@agent-commons/sdk 0.2.1 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -7,6 +7,8 @@ interface ModelConfig {
7
7
  temperature?: number;
8
8
  maxTokens?: number;
9
9
  topP?: number;
10
+ reasoningEffort?: 'none' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh';
11
+ verbosity?: 'low' | 'medium' | 'high';
10
12
  }
11
13
  interface Agent {
12
14
  agentId: string;
@@ -30,6 +32,91 @@ interface Agent {
30
32
  externalUrl?: string;
31
33
  createdAt: string;
32
34
  }
35
+ type AgentComputerLifecycle = 'persistent' | 'ephemeral';
36
+ type AgentComputerStatus = 'provisioning' | 'starting' | 'running' | 'idle' | 'stopping' | 'stopped' | 'terminated' | 'failed' | 'error' | 'unavailable';
37
+ interface AgentComputerConfig {
38
+ configId: string;
39
+ agentId: string;
40
+ enabled: boolean;
41
+ defaultMode: AgentComputerLifecycle;
42
+ autoStart: boolean;
43
+ allowAgentStart: boolean;
44
+ allowUserSelect: boolean;
45
+ allowBrowser: boolean;
46
+ allowTerminal: boolean;
47
+ allowFilesystem: boolean;
48
+ networkAccess: 'standard' | 'restricted' | 'disabled' | string;
49
+ maxPersistentComputers: number;
50
+ maxEphemeralComputers: number;
51
+ maxConcurrentComputers: number;
52
+ idleTtlMinutes: number;
53
+ sessionTtlMinutes: number;
54
+ image?: string | null;
55
+ cpuLimit?: string | null;
56
+ memoryLimit?: string | null;
57
+ storageLimit?: string | null;
58
+ region?: string | null;
59
+ provider: string;
60
+ metadata?: Record<string, any> | null;
61
+ createdAt: string;
62
+ updatedAt: string;
63
+ }
64
+ interface AgentComputerInstance {
65
+ computerId: string;
66
+ agentId: string;
67
+ sessionId?: string | null;
68
+ ownerUserId?: string | null;
69
+ workspaceId?: string | null;
70
+ name: string;
71
+ lifecycle: AgentComputerLifecycle;
72
+ status: AgentComputerStatus;
73
+ provider: string;
74
+ cloudProvider?: string | null;
75
+ region?: string | null;
76
+ namespaceId?: string | null;
77
+ podName?: string | null;
78
+ image?: string | null;
79
+ cpuLimit?: string | null;
80
+ memoryLimit?: string | null;
81
+ storageLimit?: string | null;
82
+ workspaceRoot?: string | null;
83
+ workspaceSnapshot?: string | null;
84
+ browser?: {
85
+ status?: 'off' | 'starting' | 'on' | 'error';
86
+ url?: string | null;
87
+ title?: string | null;
88
+ screenshot?: string | null;
89
+ lastAction?: string | null;
90
+ error?: string | null;
91
+ updatedAt?: string | null;
92
+ } | null;
93
+ terminal?: {
94
+ lastCommand?: string | null;
95
+ lastExitCode?: number | null;
96
+ lastOutput?: string | null;
97
+ updatedAt?: string | null;
98
+ } | null;
99
+ metadata?: Record<string, any> | null;
100
+ lastActivityAt?: string | null;
101
+ expiresAt?: string | null;
102
+ startedAt?: string | null;
103
+ stoppedAt?: string | null;
104
+ errorMessage?: string | null;
105
+ createdAt: string;
106
+ updatedAt: string;
107
+ }
108
+ interface AgentComputerEvent {
109
+ eventId: string;
110
+ computerId: string;
111
+ agentId: string;
112
+ sessionId?: string | null;
113
+ eventType: string;
114
+ actorType: string;
115
+ actorId?: string | null;
116
+ summary?: string | null;
117
+ payload?: Record<string, any> | null;
118
+ createdAt: string;
119
+ }
33
120
  interface CreateAgentParams {
34
121
  name: string;
35
122
  instructions?: string;
@@ -69,6 +156,15 @@ interface RunParams {
69
156
  messages: ChatMessage[];
70
157
  sessionId?: string;
71
158
  initiatorId?: string;
159
+ computerRequest?: {
160
+ enabled: boolean;
161
+ computerIds?: string[];
162
+ lifecycle?: AgentComputerLifecycle;
163
+ };
164
+ /** Uploaded file references. Raw file bytes must be uploaded separately. */
165
+ attachments?: Array<{
166
+ fileId: string;
167
+ }>;
72
168
  /** Extra text injected into the agent's system prompt. Used by the CLI to deliver the local tools manifest. */
73
169
  cliContext?: string;
74
170
  /** Caller-owned function catalog executed through cli_tool_request events. */
@@ -80,21 +176,40 @@ interface RunParams {
80
176
  }
81
177
  interface ChatMessage {
82
178
  role: 'user' | 'assistant' | 'system' | 'tool';
83
- content: string;
179
+ content: string | Array<{
180
+ type: 'text';
181
+ text: string;
182
+ } | {
183
+ type: 'image_url';
184
+ image_url: {
185
+ url: string;
186
+ };
187
+ } | Record<string, any>>;
84
188
  tool_call_id?: string;
85
189
  name?: string;
86
190
  }
87
- type StreamEventType = 'token' | 'toolStart' | 'toolEnd' | 'agent_step' | 'final' | 'completed' | 'failed' | 'cancelled' | 'status' | 'keepalive' | 'cli_tool_request' | 'error';
191
+ type StreamEventType = 'token' | 'tool' | 'toolProgress' | 'toolStart' | 'toolEnd' | 'agent_step' | 'final' | 'completed' | 'failed' | 'cancelled' | 'status' | 'keepalive' | 'cli_tool_request' | 'error';
88
192
  interface StreamEvent {
89
193
  type: StreamEventType;
194
+ phase?: 'commentary' | 'final_answer' | string;
90
195
  role?: string;
91
196
  content?: string;
197
+ stage?: string;
198
+ status?: 'queued' | 'running' | 'completed' | 'failed' | string;
199
+ name?: string;
92
200
  toolName?: string;
201
+ tool?: string;
202
+ toolCallId?: string;
93
203
  input?: string;
204
+ args?: any;
94
205
  output?: any;
206
+ result?: any;
207
+ requestId?: string;
95
208
  timestamp?: string;
209
+ sessionId?: string;
96
210
  payload?: any;
97
211
  message?: string;
212
+ detail?: string;
98
213
  }
99
214
  interface Workflow {
100
215
  workflowId: string;
@@ -160,6 +275,14 @@ interface Task {
160
275
  workflowId?: string;
161
276
  cronExpression?: string;
162
277
  isRecurring?: boolean;
278
+ scheduledFor?: string;
279
+ nextRunAt?: string;
280
+ lastRunAt?: string;
281
+ actualStart?: string;
282
+ actualEnd?: string;
283
+ estimatedDuration?: number;
284
+ dependsOn?: string[];
285
+ metadata?: Record<string, any>;
163
286
  priority?: number;
164
287
  timeoutMs?: number;
165
288
  progress?: number;
@@ -169,6 +292,7 @@ interface Task {
169
292
  createdBy: string;
170
293
  createdByType: 'user' | 'agent';
171
294
  createdAt: string;
295
+ updatedAt?: string;
172
296
  }
173
297
  interface CreateTaskParams {
174
298
  agentId: string;
@@ -707,6 +831,56 @@ declare class CommonsClient {
707
831
  removePreferredConnection: (id: string) => Promise<{
708
832
  success: boolean;
709
833
  }>;
834
+ getComputerConfig: (agentId: string) => Promise<{
835
+ data: AgentComputerConfig;
836
+ }>;
837
+ updateComputerConfig: (agentId: string, params: Partial<AgentComputerConfig>) => Promise<{
838
+ data: AgentComputerConfig;
839
+ }>;
840
+ listComputers: (agentId: string, filter?: {
841
+ sessionId?: string;
842
+ includeTerminated?: boolean;
843
+ }) => Promise<{
844
+ data: AgentComputerInstance[];
845
+ }>;
846
+ startComputer: (agentId: string, params: {
847
+ sessionId?: string;
848
+ lifecycle?: "persistent" | "ephemeral";
849
+ name?: string;
850
+ reason?: string;
851
+ }) => Promise<{
852
+ data: AgentComputerInstance;
853
+ }>;
854
+ getComputer: (agentId: string, computerId: string) => Promise<{
855
+ data: AgentComputerInstance;
856
+ }>;
857
+ refreshComputer: (agentId: string, computerId: string) => Promise<{
858
+ data: AgentComputerInstance;
859
+ }>;
860
+ stopComputer: (agentId: string, computerId: string) => Promise<{
861
+ data: AgentComputerInstance;
862
+ }>;
863
+ readComputerFile: (agentId: string, computerId: string, path: string) => Promise<{
864
+ data: {
865
+ path: string;
866
+ content: string;
867
+ };
868
+ }>;
869
+ runComputerCommand: (agentId: string, computerId: string, params: {
870
+ command: string;
871
+ cwd?: string;
872
+ timeoutSeconds?: number;
873
+ }) => Promise<{
874
+ data: any;
875
+ }>;
876
+ openComputerBrowser: (agentId: string, computerId: string, params: {
877
+ url: string;
878
+ }) => Promise<{
879
+ data: any;
880
+ }>;
881
+ listComputerEvents: (agentId: string, computerId: string, limit?: number) => Promise<{
882
+ data: AgentComputerEvent[];
883
+ }>;
710
884
  /**
711
885
  * List available TTS voices for a provider.
712
886
  * @param provider - 'openai' (default) or 'elevenlabs'
@@ -793,6 +967,25 @@ declare class CommonsClient {
793
967
  delete: (taskId: string) => Promise<{
794
968
  success: boolean;
795
969
  }>;
970
+ /** Edit human-facing task details (title/description/priority). */
971
+ update: (taskId: string, params: {
972
+ title?: string;
973
+ description?: string;
974
+ priority?: number;
975
+ }) => Promise<{
976
+ data: Task;
977
+ }>;
978
+ /** Reschedule a task's upcoming run and/or resize its estimated duration. */
979
+ reschedule: (taskId: string, params: {
980
+ scheduledFor?: Date;
981
+ estimatedDuration?: number;
982
+ }) => Promise<{
983
+ data: Task;
984
+ rescheduledRun: {
985
+ runId: string;
986
+ created: boolean;
987
+ } | null;
988
+ }>;
796
989
  /** Stream task status updates via SSE. Returns an async generator. */
797
990
  stream: (taskId: string) => AsyncGenerator<StreamEvent>;
798
991
  };
package/dist/index.d.ts CHANGED
@@ -7,6 +7,8 @@ interface ModelConfig {
7
7
  temperature?: number;
8
8
  maxTokens?: number;
9
9
  topP?: number;
10
+ reasoningEffort?: 'none' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh';
11
+ verbosity?: 'low' | 'medium' | 'high';
10
12
  }
11
13
  interface Agent {
12
14
  agentId: string;
@@ -30,6 +32,91 @@ interface Agent {
30
32
  externalUrl?: string;
31
33
  createdAt: string;
32
34
  }
35
+ type AgentComputerLifecycle = 'persistent' | 'ephemeral';
36
+ type AgentComputerStatus = 'provisioning' | 'starting' | 'running' | 'idle' | 'stopping' | 'stopped' | 'terminated' | 'failed' | 'error' | 'unavailable';
37
+ interface AgentComputerConfig {
38
+ configId: string;
39
+ agentId: string;
40
+ enabled: boolean;
41
+ defaultMode: AgentComputerLifecycle;
42
+ autoStart: boolean;
43
+ allowAgentStart: boolean;
44
+ allowUserSelect: boolean;
45
+ allowBrowser: boolean;
46
+ allowTerminal: boolean;
47
+ allowFilesystem: boolean;
48
+ networkAccess: 'standard' | 'restricted' | 'disabled' | string;
49
+ maxPersistentComputers: number;
50
+ maxEphemeralComputers: number;
51
+ maxConcurrentComputers: number;
52
+ idleTtlMinutes: number;
53
+ sessionTtlMinutes: number;
54
+ image?: string | null;
55
+ cpuLimit?: string | null;
56
+ memoryLimit?: string | null;
57
+ storageLimit?: string | null;
58
+ region?: string | null;
59
+ provider: string;
60
+ metadata?: Record<string, any> | null;
61
+ createdAt: string;
62
+ updatedAt: string;
63
+ }
64
+ interface AgentComputerInstance {
65
+ computerId: string;
66
+ agentId: string;
67
+ sessionId?: string | null;
68
+ ownerUserId?: string | null;
69
+ workspaceId?: string | null;
70
+ name: string;
71
+ lifecycle: AgentComputerLifecycle;
72
+ status: AgentComputerStatus;
73
+ provider: string;
74
+ cloudProvider?: string | null;
75
+ region?: string | null;
76
+ namespaceId?: string | null;
77
+ podName?: string | null;
78
+ image?: string | null;
79
+ cpuLimit?: string | null;
80
+ memoryLimit?: string | null;
81
+ storageLimit?: string | null;
82
+ workspaceRoot?: string | null;
83
+ workspaceSnapshot?: string | null;
84
+ browser?: {
85
+ status?: 'off' | 'starting' | 'on' | 'error';
86
+ url?: string | null;
87
+ title?: string | null;
88
+ screenshot?: string | null;
89
+ lastAction?: string | null;
90
+ error?: string | null;
91
+ updatedAt?: string | null;
92
+ } | null;
93
+ terminal?: {
94
+ lastCommand?: string | null;
95
+ lastExitCode?: number | null;
96
+ lastOutput?: string | null;
97
+ updatedAt?: string | null;
98
+ } | null;
99
+ metadata?: Record<string, any> | null;
100
+ lastActivityAt?: string | null;
101
+ expiresAt?: string | null;
102
+ startedAt?: string | null;
103
+ stoppedAt?: string | null;
104
+ errorMessage?: string | null;
105
+ createdAt: string;
106
+ updatedAt: string;
107
+ }
108
+ interface AgentComputerEvent {
109
+ eventId: string;
110
+ computerId: string;
111
+ agentId: string;
112
+ sessionId?: string | null;
113
+ eventType: string;
114
+ actorType: string;
115
+ actorId?: string | null;
116
+ summary?: string | null;
117
+ payload?: Record<string, any> | null;
118
+ createdAt: string;
119
+ }
33
120
  interface CreateAgentParams {
34
121
  name: string;
35
122
  instructions?: string;
@@ -69,6 +156,15 @@ interface RunParams {
69
156
  messages: ChatMessage[];
70
157
  sessionId?: string;
71
158
  initiatorId?: string;
159
+ computerRequest?: {
160
+ enabled: boolean;
161
+ computerIds?: string[];
162
+ lifecycle?: AgentComputerLifecycle;
163
+ };
164
+ /** Uploaded file references. Raw file bytes must be uploaded separately. */
165
+ attachments?: Array<{
166
+ fileId: string;
167
+ }>;
72
168
  /** Extra text injected into the agent's system prompt. Used by the CLI to deliver the local tools manifest. */
73
169
  cliContext?: string;
74
170
  /** Caller-owned function catalog executed through cli_tool_request events. */
@@ -80,21 +176,40 @@ interface RunParams {
80
176
  }
81
177
  interface ChatMessage {
82
178
  role: 'user' | 'assistant' | 'system' | 'tool';
83
- content: string;
179
+ content: string | Array<{
180
+ type: 'text';
181
+ text: string;
182
+ } | {
183
+ type: 'image_url';
184
+ image_url: {
185
+ url: string;
186
+ };
187
+ } | Record<string, any>>;
84
188
  tool_call_id?: string;
85
189
  name?: string;
86
190
  }
87
- type StreamEventType = 'token' | 'toolStart' | 'toolEnd' | 'agent_step' | 'final' | 'completed' | 'failed' | 'cancelled' | 'status' | 'keepalive' | 'cli_tool_request' | 'error';
191
+ type StreamEventType = 'token' | 'tool' | 'toolProgress' | 'toolStart' | 'toolEnd' | 'agent_step' | 'final' | 'completed' | 'failed' | 'cancelled' | 'status' | 'keepalive' | 'cli_tool_request' | 'error';
88
192
  interface StreamEvent {
89
193
  type: StreamEventType;
194
+ phase?: 'commentary' | 'final_answer' | string;
90
195
  role?: string;
91
196
  content?: string;
197
+ stage?: string;
198
+ status?: 'queued' | 'running' | 'completed' | 'failed' | string;
199
+ name?: string;
92
200
  toolName?: string;
201
+ tool?: string;
202
+ toolCallId?: string;
93
203
  input?: string;
204
+ args?: any;
94
205
  output?: any;
206
+ result?: any;
207
+ requestId?: string;
95
208
  timestamp?: string;
209
+ sessionId?: string;
96
210
  payload?: any;
97
211
  message?: string;
212
+ detail?: string;
98
213
  }
99
214
  interface Workflow {
100
215
  workflowId: string;
@@ -160,6 +275,14 @@ interface Task {
160
275
  workflowId?: string;
161
276
  cronExpression?: string;
162
277
  isRecurring?: boolean;
278
+ scheduledFor?: string;
279
+ nextRunAt?: string;
280
+ lastRunAt?: string;
281
+ actualStart?: string;
282
+ actualEnd?: string;
283
+ estimatedDuration?: number;
284
+ dependsOn?: string[];
285
+ metadata?: Record<string, any>;
163
286
  priority?: number;
164
287
  timeoutMs?: number;
165
288
  progress?: number;
@@ -169,6 +292,7 @@ interface Task {
169
292
  createdBy: string;
170
293
  createdByType: 'user' | 'agent';
171
294
  createdAt: string;
295
+ updatedAt?: string;
172
296
  }
173
297
  interface CreateTaskParams {
174
298
  agentId: string;
@@ -707,6 +831,56 @@ declare class CommonsClient {
707
831
  removePreferredConnection: (id: string) => Promise<{
708
832
  success: boolean;
709
833
  }>;
834
+ getComputerConfig: (agentId: string) => Promise<{
835
+ data: AgentComputerConfig;
836
+ }>;
837
+ updateComputerConfig: (agentId: string, params: Partial<AgentComputerConfig>) => Promise<{
838
+ data: AgentComputerConfig;
839
+ }>;
840
+ listComputers: (agentId: string, filter?: {
841
+ sessionId?: string;
842
+ includeTerminated?: boolean;
843
+ }) => Promise<{
844
+ data: AgentComputerInstance[];
845
+ }>;
846
+ startComputer: (agentId: string, params: {
847
+ sessionId?: string;
848
+ lifecycle?: "persistent" | "ephemeral";
849
+ name?: string;
850
+ reason?: string;
851
+ }) => Promise<{
852
+ data: AgentComputerInstance;
853
+ }>;
854
+ getComputer: (agentId: string, computerId: string) => Promise<{
855
+ data: AgentComputerInstance;
856
+ }>;
857
+ refreshComputer: (agentId: string, computerId: string) => Promise<{
858
+ data: AgentComputerInstance;
859
+ }>;
860
+ stopComputer: (agentId: string, computerId: string) => Promise<{
861
+ data: AgentComputerInstance;
862
+ }>;
863
+ readComputerFile: (agentId: string, computerId: string, path: string) => Promise<{
864
+ data: {
865
+ path: string;
866
+ content: string;
867
+ };
868
+ }>;
869
+ runComputerCommand: (agentId: string, computerId: string, params: {
870
+ command: string;
871
+ cwd?: string;
872
+ timeoutSeconds?: number;
873
+ }) => Promise<{
874
+ data: any;
875
+ }>;
876
+ openComputerBrowser: (agentId: string, computerId: string, params: {
877
+ url: string;
878
+ }) => Promise<{
879
+ data: any;
880
+ }>;
881
+ listComputerEvents: (agentId: string, computerId: string, limit?: number) => Promise<{
882
+ data: AgentComputerEvent[];
883
+ }>;
710
884
  /**
711
885
  * List available TTS voices for a provider.
712
886
  * @param provider - 'openai' (default) or 'elevenlabs'
@@ -793,6 +967,25 @@ declare class CommonsClient {
793
967
  delete: (taskId: string) => Promise<{
794
968
  success: boolean;
795
969
  }>;
970
+ /** Edit human-facing task details (title/description/priority). */
971
+ update: (taskId: string, params: {
972
+ title?: string;
973
+ description?: string;
974
+ priority?: number;
975
+ }) => Promise<{
976
+ data: Task;
977
+ }>;
978
+ /** Reschedule a task's upcoming run and/or resize its estimated duration. */
979
+ reschedule: (taskId: string, params: {
980
+ scheduledFor?: Date;
981
+ estimatedDuration?: number;
982
+ }) => Promise<{
983
+ data: Task;
984
+ rescheduledRun: {
985
+ runId: string;
986
+ created: boolean;
987
+ } | null;
988
+ }>;
796
989
  /** Stream task status updates via SSE. Returns an async generator. */
797
990
  stream: (taskId: string) => AsyncGenerator<StreamEvent>;
798
991
  };
package/dist/index.mjs CHANGED
@@ -81,6 +81,24 @@ var CommonsClient = class {
81
81
  addPreferredConnection: (agentId, params) => this.request("POST", `/v1/agents/${agentId}/preferred-connections`, params),
82
82
  /** Remove a preferred agent connection by its record ID. */
83
83
  removePreferredConnection: (id) => this.request("DELETE", `/v1/agents/preferred-connections/${id}`),
84
+ // ── Computers ────────────────────────────────────────────────────────
85
+ getComputerConfig: (agentId) => this.request("GET", `/v1/agents/${agentId}/computer/config`),
86
+ updateComputerConfig: (agentId, params) => this.request("PUT", `/v1/agents/${agentId}/computer/config`, params),
87
+ listComputers: (agentId, filter) => {
88
+ const qs = new URLSearchParams();
89
+ if (filter?.sessionId) qs.set("sessionId", filter.sessionId);
90
+ if (filter?.includeTerminated) qs.set("includeTerminated", "true");
91
+ const query = qs.toString();
92
+ return this.request("GET", `/v1/agents/${agentId}/computers${query ? `?${query}` : ""}`);
93
+ },
94
+ startComputer: (agentId, params) => this.request("POST", `/v1/agents/${agentId}/computers`, params),
95
+ getComputer: (agentId, computerId) => this.request("GET", `/v1/agents/${agentId}/computers/${computerId}`),
96
+ refreshComputer: (agentId, computerId) => this.request("POST", `/v1/agents/${agentId}/computers/${computerId}/refresh`),
97
+ stopComputer: (agentId, computerId) => this.request("POST", `/v1/agents/${agentId}/computers/${computerId}/stop`),
98
+ readComputerFile: (agentId, computerId, path) => this.request("GET", `/v1/agents/${agentId}/computers/${computerId}/files/read?path=${encodeURIComponent(path)}`),
99
+ runComputerCommand: (agentId, computerId, params) => this.request("POST", `/v1/agents/${agentId}/computers/${computerId}/commands`, params),
100
+ openComputerBrowser: (agentId, computerId, params) => this.request("POST", `/v1/agents/${agentId}/computers/${computerId}/browser/open`, params),
101
+ listComputerEvents: (agentId, computerId, limit) => this.request("GET", `/v1/agents/${agentId}/computers/${computerId}/events${limit ? `?limit=${limit}` : ""}`),
84
102
  // ── TTS Voices ───────────────────────────────────────────────────────
85
103
  /**
86
104
  * List available TTS voices for a provider.
@@ -134,6 +152,10 @@ var CommonsClient = class {
134
152
  execute: (taskId) => this.request("POST", `/v1/tasks/${taskId}/execute`),
135
153
  cancel: (taskId) => this.request("POST", `/v1/tasks/${taskId}/cancel`),
136
154
  delete: (taskId) => this.request("DELETE", `/v1/tasks/${taskId}`),
155
+ /** Edit human-facing task details (title/description/priority). */
156
+ update: (taskId, params) => this.request("PATCH", `/v1/tasks/${taskId}`, params),
157
+ /** Reschedule a task's upcoming run and/or resize its estimated duration. */
158
+ reschedule: (taskId, params) => this.request("PATCH", `/v1/tasks/${taskId}/schedule`, params),
137
159
  /** Stream task status updates via SSE. Returns an async generator. */
138
160
  stream: (taskId) => this._streamSse(`/v1/tasks/${taskId}/stream`)
139
161
  };