Skip to content

Commit 528f3ed

Browse files
CopilotTooTallNate
andcommitted
Remove private modifiers from DurableAgent properties
Remove private modifiers from class properties and update tests to access properties directly without type assertions, per code review feedback. Co-authored-by: TooTallNate <71256+TooTallNate@users.noreply.github.com>
1 parent cb5acbd commit 528f3ed

File tree

2 files changed

+33
-33
lines changed

2 files changed

+33
-33
lines changed

packages/ai/src/agent/durable-agent.test.ts

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ describe('DurableAgent', () => {
1616
});
1717

1818
expect(agent).toBeDefined();
19-
expect((agent as any).model).toBe('anthropic/claude-opus');
20-
expect((agent as any).tools).toEqual({});
19+
expect(agent.model).toBe('anthropic/claude-opus');
20+
expect(agent.tools).toEqual({});
2121
});
2222

2323
it('should accept system prompt', () => {
@@ -28,7 +28,7 @@ describe('DurableAgent', () => {
2828
});
2929

3030
expect(agent).toBeDefined();
31-
expect((agent as any).system).toBe('You are a helpful assistant.');
31+
expect(agent.system).toBe('You are a helpful assistant.');
3232
});
3333

3434
it('should accept temperature option', () => {
@@ -39,7 +39,7 @@ describe('DurableAgent', () => {
3939
});
4040

4141
expect(agent).toBeDefined();
42-
expect((agent as any).temperature).toBe(0.7);
42+
expect(agent.temperature).toBe(0.7);
4343
});
4444

4545
it('should accept maxOutputTokens option', () => {
@@ -50,7 +50,7 @@ describe('DurableAgent', () => {
5050
});
5151

5252
expect(agent).toBeDefined();
53-
expect((agent as any).maxOutputTokens).toBe(1000);
53+
expect(agent.maxOutputTokens).toBe(1000);
5454
});
5555

5656
it('should accept topP option', () => {
@@ -61,7 +61,7 @@ describe('DurableAgent', () => {
6161
});
6262

6363
expect(agent).toBeDefined();
64-
expect((agent as any).topP).toBe(0.9);
64+
expect(agent.topP).toBe(0.9);
6565
});
6666

6767
it('should accept topK option', () => {
@@ -72,7 +72,7 @@ describe('DurableAgent', () => {
7272
});
7373

7474
expect(agent).toBeDefined();
75-
expect((agent as any).topK).toBe(40);
75+
expect(agent.topK).toBe(40);
7676
});
7777

7878
it('should accept presencePenalty option', () => {
@@ -83,7 +83,7 @@ describe('DurableAgent', () => {
8383
});
8484

8585
expect(agent).toBeDefined();
86-
expect((agent as any).presencePenalty).toBe(0.5);
86+
expect(agent.presencePenalty).toBe(0.5);
8787
});
8888

8989
it('should accept frequencyPenalty option', () => {
@@ -94,7 +94,7 @@ describe('DurableAgent', () => {
9494
});
9595

9696
expect(agent).toBeDefined();
97-
expect((agent as any).frequencyPenalty).toBe(0.5);
97+
expect(agent.frequencyPenalty).toBe(0.5);
9898
});
9999

100100
it('should accept stopSequences option', () => {
@@ -105,7 +105,7 @@ describe('DurableAgent', () => {
105105
});
106106

107107
expect(agent).toBeDefined();
108-
expect((agent as any).stopSequences).toEqual(['STOP', 'END']);
108+
expect(agent.stopSequences).toEqual(['STOP', 'END']);
109109
});
110110

111111
it('should accept seed option', () => {
@@ -116,7 +116,7 @@ describe('DurableAgent', () => {
116116
});
117117

118118
expect(agent).toBeDefined();
119-
expect((agent as any).seed).toBe(12345);
119+
expect(agent.seed).toBe(12345);
120120
});
121121

122122
it('should accept all options together', () => {
@@ -135,16 +135,16 @@ describe('DurableAgent', () => {
135135
});
136136

137137
expect(agent).toBeDefined();
138-
expect((agent as any).model).toBe('anthropic/claude-opus');
139-
expect((agent as any).system).toBe('You are a helpful assistant.');
140-
expect((agent as any).temperature).toBe(0.7);
141-
expect((agent as any).maxOutputTokens).toBe(1000);
142-
expect((agent as any).topP).toBe(0.9);
143-
expect((agent as any).topK).toBe(40);
144-
expect((agent as any).presencePenalty).toBe(0.5);
145-
expect((agent as any).frequencyPenalty).toBe(0.3);
146-
expect((agent as any).stopSequences).toEqual(['STOP', 'END']);
147-
expect((agent as any).seed).toBe(12345);
138+
expect(agent.model).toBe('anthropic/claude-opus');
139+
expect(agent.system).toBe('You are a helpful assistant.');
140+
expect(agent.temperature).toBe(0.7);
141+
expect(agent.maxOutputTokens).toBe(1000);
142+
expect(agent.topP).toBe(0.9);
143+
expect(agent.topK).toBe(40);
144+
expect(agent.presencePenalty).toBe(0.5);
145+
expect(agent.frequencyPenalty).toBe(0.3);
146+
expect(agent.stopSequences).toEqual(['STOP', 'END']);
147+
expect(agent.seed).toBe(12345);
148148
});
149149

150150
it('should accept tools with proper structure', () => {
@@ -165,7 +165,7 @@ describe('DurableAgent', () => {
165165
});
166166

167167
expect(agent).toBeDefined();
168-
expect((agent as any).tools).toBe(tools);
168+
expect(agent.tools).toBe(tools);
169169
});
170170
});
171171

packages/ai/src/agent/durable-agent.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -150,17 +150,17 @@ export interface DurableAgentStreamOptions {
150150
* ```
151151
*/
152152
export class DurableAgent {
153-
private model: string;
154-
private tools: ToolSet;
155-
private system?: string;
156-
private temperature?: number;
157-
private maxOutputTokens?: number;
158-
private topP?: number;
159-
private topK?: number;
160-
private presencePenalty?: number;
161-
private frequencyPenalty?: number;
162-
private stopSequences?: string[];
163-
private seed?: number;
153+
model: string;
154+
tools: ToolSet;
155+
system?: string;
156+
temperature?: number;
157+
maxOutputTokens?: number;
158+
topP?: number;
159+
topK?: number;
160+
presencePenalty?: number;
161+
frequencyPenalty?: number;
162+
stopSequences?: string[];
163+
seed?: number;
164164

165165
constructor(options: DurableAgentOptions) {
166166
this.model = options.model;

0 commit comments

Comments
 (0)