@agent-commons/sdk 0.2.1 → 0.2.2

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,39 @@ 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' | '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;
93
202
  input?: string;
203
+ args?: any;
94
204
  output?: any;
205
+ result?: any;
206
+ requestId?: string;
95
207
  timestamp?: string;
208
+ sessionId?: string;
96
209
  payload?: any;
97
210
  message?: string;
211
+ detail?: string;
98
212
  }
99
213
  interface Workflow {
100
214
  workflowId: string;
@@ -707,6 +821,56 @@ declare class CommonsClient {
707
821
  removePreferredConnection: (id: string) => Promise<{
708
822
  success: boolean;
709
823
  }>;
824
+ getComputerConfig: (agentId: string) => Promise<{
825
+ data: AgentComputerConfig;
826
+ }>;
827
+ updateComputerConfig: (agentId: string, params: Partial<AgentComputerConfig>) => Promise<{
828
+ data: AgentComputerConfig;
829
+ }>;
830
+ listComputers: (agentId: string, filter?: {
831
+ sessionId?: string;
832
+ includeTerminated?: boolean;
833
+ }) => Promise<{
834
+ data: AgentComputerInstance[];
835
+ }>;
836
+ startComputer: (agentId: string, params: {
837
+ sessionId?: string;
838
+ lifecycle?: "persistent" | "ephemeral";
839
+ name?: string;
840
+ reason?: string;
841
+ }) => Promise<{
842
+ data: AgentComputerInstance;
843
+ }>;
844
+ getComputer: (agentId: string, computerId: string) => Promise<{
845
+ data: AgentComputerInstance;
846
+ }>;
847
+ refreshComputer: (agentId: string, computerId: string) => Promise<{
848
+ data: AgentComputerInstance;
849
+ }>;
850
+ stopComputer: (agentId: string, computerId: string) => Promise<{
851
+ data: AgentComputerInstance;
852
+ }>;
853
+ readComputerFile: (agentId: string, computerId: string, path: string) => Promise<{
854
+ data: {
855
+ path: string;
856
+ content: string;
857
+ };
858
+ }>;
859
+ runComputerCommand: (agentId: string, computerId: string, params: {
860
+ command: string;
861
+ cwd?: string;
862
+ timeoutSeconds?: number;
863
+ }) => Promise<{
864
+ data: any;
865
+ }>;
866
+ openComputerBrowser: (agentId: string, computerId: string, params: {
867
+ url: string;
868
+ }) => Promise<{
869
+ data: any;
870
+ }>;
871
+ listComputerEvents: (agentId: string, computerId: string, limit?: number) => Promise<{
872
+ data: AgentComputerEvent[];
873
+ }>;
710
874
  /**
711
875
  * List available TTS voices for a provider.
712
876
  * @param provider - 'openai' (default) or 'elevenlabs'
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,39 @@ 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' | '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;
93
202
  input?: string;
203
+ args?: any;
94
204
  output?: any;
205
+ result?: any;
206
+ requestId?: string;
95
207
  timestamp?: string;
208
+ sessionId?: string;
96
209
  payload?: any;
97
210
  message?: string;
211
+ detail?: string;
98
212
  }
99
213
  interface Workflow {
100
214
  workflowId: string;
@@ -707,6 +821,56 @@ declare class CommonsClient {
707
821
  removePreferredConnection: (id: string) => Promise<{
708
822
  success: boolean;
709
823
  }>;
824
+ getComputerConfig: (agentId: string) => Promise<{
825
+ data: AgentComputerConfig;
826
+ }>;
827
+ updateComputerConfig: (agentId: string, params: Partial<AgentComputerConfig>) => Promise<{
828
+ data: AgentComputerConfig;
829
+ }>;
830
+ listComputers: (agentId: string, filter?: {
831
+ sessionId?: string;
832
+ includeTerminated?: boolean;
833
+ }) => Promise<{
834
+ data: AgentComputerInstance[];
835
+ }>;
836
+ startComputer: (agentId: string, params: {
837
+ sessionId?: string;
838
+ lifecycle?: "persistent" | "ephemeral";
839
+ name?: string;
840
+ reason?: string;
841
+ }) => Promise<{
842
+ data: AgentComputerInstance;
843
+ }>;
844
+ getComputer: (agentId: string, computerId: string) => Promise<{
845
+ data: AgentComputerInstance;
846
+ }>;
847
+ refreshComputer: (agentId: string, computerId: string) => Promise<{
848
+ data: AgentComputerInstance;
849
+ }>;
850
+ stopComputer: (agentId: string, computerId: string) => Promise<{
851
+ data: AgentComputerInstance;
852
+ }>;
853
+ readComputerFile: (agentId: string, computerId: string, path: string) => Promise<{
854
+ data: {
855
+ path: string;
856
+ content: string;
857
+ };
858
+ }>;
859
+ runComputerCommand: (agentId: string, computerId: string, params: {
860
+ command: string;
861
+ cwd?: string;
862
+ timeoutSeconds?: number;
863
+ }) => Promise<{
864
+ data: any;
865
+ }>;
866
+ openComputerBrowser: (agentId: string, computerId: string, params: {
867
+ url: string;
868
+ }) => Promise<{
869
+ data: any;
870
+ }>;
871
+ listComputerEvents: (agentId: string, computerId: string, limit?: number) => Promise<{
872
+ data: AgentComputerEvent[];
873
+ }>;
710
874
  /**
711
875
  * List available TTS voices for a provider.
712
876
  * @param provider - 'openai' (default) or 'elevenlabs'
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.