@agent-commons/sdk 0.0.0-staging-20260714131205
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.cjs +1047 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.mts +1735 -0
- package/dist/index.d.ts +1735 -0
- package/dist/index.mjs +1017 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +35 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,1735 @@
|
|
|
1
|
+
type ModelProvider = "openai" | "anthropic" | "google" | "mistral" | "groq" | "ollama" | "openrouter" | "xai" | "custom";
|
|
2
|
+
interface ModelConfig {
|
|
3
|
+
provider: ModelProvider;
|
|
4
|
+
modelId: string;
|
|
5
|
+
apiKey?: string;
|
|
6
|
+
baseUrl?: string;
|
|
7
|
+
temperature?: number;
|
|
8
|
+
maxTokens?: number;
|
|
9
|
+
topP?: number;
|
|
10
|
+
reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh";
|
|
11
|
+
verbosity?: "low" | "medium" | "high";
|
|
12
|
+
}
|
|
13
|
+
type AgentRuntimeType = "native" | "openclaw" | "hermes" | "custom";
|
|
14
|
+
type AgentRuntimeStatus = "disabled" | "provisioning" | "starting" | "ready" | "degraded" | "stopped" | "failed";
|
|
15
|
+
interface AgentRuntimeConfig {
|
|
16
|
+
deploymentMode?: "managed" | "external";
|
|
17
|
+
channelPolicy?: "pairing" | "allowlist" | "open" | "disabled";
|
|
18
|
+
enabledPlugins?: string[];
|
|
19
|
+
enabledToolsets?: string[];
|
|
20
|
+
memoryMode?: "native" | "platform" | "hybrid";
|
|
21
|
+
metadata?: Record<string, string | number | boolean>;
|
|
22
|
+
}
|
|
23
|
+
interface AgentRuntime {
|
|
24
|
+
runtimeType: AgentRuntimeType;
|
|
25
|
+
version?: string | null;
|
|
26
|
+
status: AgentRuntimeStatus;
|
|
27
|
+
config: AgentRuntimeConfig;
|
|
28
|
+
capabilities: Record<string, boolean>;
|
|
29
|
+
updatedAt?: string | null;
|
|
30
|
+
managed: boolean;
|
|
31
|
+
computer?: AgentComputer | null;
|
|
32
|
+
}
|
|
33
|
+
interface Agent {
|
|
34
|
+
agentId: string;
|
|
35
|
+
name: string;
|
|
36
|
+
owner?: string;
|
|
37
|
+
instructions?: string;
|
|
38
|
+
persona?: string;
|
|
39
|
+
greeting?: string;
|
|
40
|
+
conversationStarters?: string[];
|
|
41
|
+
avatar?: string;
|
|
42
|
+
modelProvider: ModelProvider;
|
|
43
|
+
modelId: string;
|
|
44
|
+
temperature?: number;
|
|
45
|
+
maxTokens?: number;
|
|
46
|
+
topP?: number;
|
|
47
|
+
presencePenalty?: number;
|
|
48
|
+
frequencyPenalty?: number;
|
|
49
|
+
commonTools?: string[];
|
|
50
|
+
externalTools?: string[];
|
|
51
|
+
isLiaison?: boolean;
|
|
52
|
+
externalUrl?: string;
|
|
53
|
+
createdAt: string;
|
|
54
|
+
runtimeType?: AgentRuntimeType;
|
|
55
|
+
runtimeVersion?: string | null;
|
|
56
|
+
runtimeStatus?: AgentRuntimeStatus;
|
|
57
|
+
runtimeConfig?: AgentRuntimeConfig;
|
|
58
|
+
runtimeCapabilities?: Record<string, boolean>;
|
|
59
|
+
}
|
|
60
|
+
/** Agent computers are durable. Runtime pods may be replaced, but this identity persists. */
|
|
61
|
+
type AgentComputerLifecycle = "persistent";
|
|
62
|
+
type ComputerPersistence = AgentComputerLifecycle;
|
|
63
|
+
type ComputerLifecycle = AgentComputerLifecycle;
|
|
64
|
+
type ComputerResourceProfile = "starter" | "standard" | "performance" | "gpu";
|
|
65
|
+
type ComputerResourceMode = "fixed" | "elastic";
|
|
66
|
+
type AgentComputerResourceProfile = ComputerResourceProfile;
|
|
67
|
+
type AgentComputerResourceMode = ComputerResourceMode;
|
|
68
|
+
/**
|
|
69
|
+
* Common accelerator names. Providers may expose additional values without
|
|
70
|
+
* requiring an SDK release, so string extensions remain valid.
|
|
71
|
+
*/
|
|
72
|
+
type ComputerGpuType = "nvidia-t4" | "nvidia-l4" | "nvidia-a10" | "nvidia-a100" | "nvidia-h100" | "nvidia-h200" | "nvidia-b200" | (string & {});
|
|
73
|
+
interface ComputerGpu {
|
|
74
|
+
count: number;
|
|
75
|
+
type?: ComputerGpuType;
|
|
76
|
+
}
|
|
77
|
+
type AgentComputerGpuType = ComputerGpuType;
|
|
78
|
+
type AgentComputerGpu = ComputerGpu;
|
|
79
|
+
/** Public, provider-neutral resource units. */
|
|
80
|
+
interface ComputerResources {
|
|
81
|
+
vcpu: number;
|
|
82
|
+
memoryGiB: number;
|
|
83
|
+
storageGiB: number;
|
|
84
|
+
gpu?: ComputerGpu | null;
|
|
85
|
+
}
|
|
86
|
+
type AgentComputerResources = ComputerResources;
|
|
87
|
+
interface ComputerResourceUpdate {
|
|
88
|
+
vcpu?: number;
|
|
89
|
+
memoryGiB?: number;
|
|
90
|
+
storageGiB?: number;
|
|
91
|
+
gpu?: ComputerGpu | null;
|
|
92
|
+
}
|
|
93
|
+
type AgentComputerDesiredState = "running" | "sleeping" | "disabled";
|
|
94
|
+
type AgentComputerStatus = "disabled" | "provisioning" | "starting" | "running" | "idle" | "sleeping" | "resizing" | "restarting" | "stopping" | "error" | "unavailable" | "stopped" | "terminated" | "failed";
|
|
95
|
+
type ComputerNetworkAccess = "standard" | "restricted" | "disabled" | (string & {});
|
|
96
|
+
/**
|
|
97
|
+
* Mutable computer settings only. Server-owned identity, provider, billing,
|
|
98
|
+
* timestamps, and runtime fields intentionally cannot be submitted here.
|
|
99
|
+
*/
|
|
100
|
+
interface ComputerConfigUpdate {
|
|
101
|
+
enabled?: boolean;
|
|
102
|
+
autoWake?: boolean;
|
|
103
|
+
allowAgentUse?: boolean;
|
|
104
|
+
allowBrowser?: boolean;
|
|
105
|
+
allowTerminal?: boolean;
|
|
106
|
+
allowFilesystem?: boolean;
|
|
107
|
+
networkAccess?: ComputerNetworkAccess;
|
|
108
|
+
resourceProfile?: ComputerResourceProfile;
|
|
109
|
+
resourceMode?: ComputerResourceMode;
|
|
110
|
+
resources?: ComputerResourceUpdate;
|
|
111
|
+
}
|
|
112
|
+
interface AgentComputerConfig {
|
|
113
|
+
configId: string;
|
|
114
|
+
agentId: string;
|
|
115
|
+
enabled: boolean;
|
|
116
|
+
/** @deprecated Computers are always persistent. */
|
|
117
|
+
defaultMode: AgentComputerLifecycle | "ephemeral";
|
|
118
|
+
/** @deprecated Use autoWake. */
|
|
119
|
+
autoStart: boolean;
|
|
120
|
+
/** @deprecated Use allowAgentUse. */
|
|
121
|
+
allowAgentStart: boolean;
|
|
122
|
+
/** @deprecated The singleton computer is selected implicitly. */
|
|
123
|
+
allowUserSelect: boolean;
|
|
124
|
+
allowBrowser: boolean;
|
|
125
|
+
allowTerminal: boolean;
|
|
126
|
+
allowFilesystem: boolean;
|
|
127
|
+
networkAccess: ComputerNetworkAccess;
|
|
128
|
+
/** @deprecated The singleton limit is always one. */
|
|
129
|
+
maxPersistentComputers: number;
|
|
130
|
+
/** @deprecated Ephemeral computers are no longer supported. */
|
|
131
|
+
maxEphemeralComputers: number;
|
|
132
|
+
/** @deprecated The singleton limit is always one. */
|
|
133
|
+
maxConcurrentComputers: number;
|
|
134
|
+
/** @deprecated Use the service's sleep policy. */
|
|
135
|
+
idleTtlMinutes: number;
|
|
136
|
+
/** @deprecated Persistent computers are not scoped to chat sessions. */
|
|
137
|
+
sessionTtlMinutes: number;
|
|
138
|
+
image?: string | null;
|
|
139
|
+
/** @deprecated Provider quantities are represented by resources. */
|
|
140
|
+
cpuLimit?: string | null;
|
|
141
|
+
/** @deprecated Provider quantities are represented by resources. */
|
|
142
|
+
memoryLimit?: string | null;
|
|
143
|
+
/** @deprecated Provider quantities are represented by resources. */
|
|
144
|
+
storageLimit?: string | null;
|
|
145
|
+
region?: string | null;
|
|
146
|
+
provider: string;
|
|
147
|
+
metadata?: Record<string, any> | null;
|
|
148
|
+
createdAt: string;
|
|
149
|
+
updatedAt: string;
|
|
150
|
+
persistence?: ComputerPersistence;
|
|
151
|
+
autoWake?: boolean;
|
|
152
|
+
allowAgentUse?: boolean;
|
|
153
|
+
resourceProfile?: ComputerResourceProfile;
|
|
154
|
+
resourceMode?: ComputerResourceMode;
|
|
155
|
+
resources?: ComputerResources;
|
|
156
|
+
cpuRequest?: string | null;
|
|
157
|
+
memoryRequest?: string | null;
|
|
158
|
+
gpuType?: ComputerGpuType | null;
|
|
159
|
+
gpuCount?: number;
|
|
160
|
+
billingMode?: "tier" | "usage" | (string & {});
|
|
161
|
+
}
|
|
162
|
+
interface AgentComputerBrowser {
|
|
163
|
+
status?: "off" | "starting" | "on" | "error";
|
|
164
|
+
url?: string | null;
|
|
165
|
+
title?: string | null;
|
|
166
|
+
screenshot?: string | null;
|
|
167
|
+
lastAction?: string | null;
|
|
168
|
+
error?: string | null;
|
|
169
|
+
updatedAt?: string | null;
|
|
170
|
+
}
|
|
171
|
+
interface AgentComputerTerminal {
|
|
172
|
+
lastCommand?: string | null;
|
|
173
|
+
lastExitCode?: number | null;
|
|
174
|
+
lastOutput?: string | null;
|
|
175
|
+
updatedAt?: string | null;
|
|
176
|
+
}
|
|
177
|
+
/** The one persistent cloud computer assigned to an agent. */
|
|
178
|
+
interface AgentComputer {
|
|
179
|
+
computerId: string;
|
|
180
|
+
agentId: string;
|
|
181
|
+
enabled: boolean;
|
|
182
|
+
persistence: ComputerPersistence;
|
|
183
|
+
desiredState: AgentComputerDesiredState;
|
|
184
|
+
status: AgentComputerStatus;
|
|
185
|
+
resourceProfile: ComputerResourceProfile;
|
|
186
|
+
resourceMode: ComputerResourceMode;
|
|
187
|
+
resources: ComputerResources;
|
|
188
|
+
provider?: string;
|
|
189
|
+
cloudProvider?: string | null;
|
|
190
|
+
region?: string | null;
|
|
191
|
+
runtimeId?: string | null;
|
|
192
|
+
runtimeGeneration?: number;
|
|
193
|
+
namespaceId?: string | null;
|
|
194
|
+
workspaceRoot?: string | null;
|
|
195
|
+
browser?: AgentComputerBrowser | null;
|
|
196
|
+
terminal?: AgentComputerTerminal | null;
|
|
197
|
+
lastActivityAt?: string | null;
|
|
198
|
+
startedAt?: string | null;
|
|
199
|
+
sleptAt?: string | null;
|
|
200
|
+
errorMessage?: string | null;
|
|
201
|
+
createdAt: string;
|
|
202
|
+
updatedAt: string;
|
|
203
|
+
}
|
|
204
|
+
/** @deprecated Use AgentComputer. */
|
|
205
|
+
interface AgentComputerInstance {
|
|
206
|
+
computerId: string;
|
|
207
|
+
agentId: string;
|
|
208
|
+
sessionId?: string | null;
|
|
209
|
+
ownerUserId?: string | null;
|
|
210
|
+
workspaceId?: string | null;
|
|
211
|
+
name: string;
|
|
212
|
+
/** @deprecated Ephemeral values may be read from historical records only. */
|
|
213
|
+
lifecycle: AgentComputerLifecycle | "ephemeral";
|
|
214
|
+
status: AgentComputerStatus;
|
|
215
|
+
provider: string;
|
|
216
|
+
cloudProvider?: string | null;
|
|
217
|
+
region?: string | null;
|
|
218
|
+
namespaceId?: string | null;
|
|
219
|
+
podName?: string | null;
|
|
220
|
+
image?: string | null;
|
|
221
|
+
cpuLimit?: string | null;
|
|
222
|
+
memoryLimit?: string | null;
|
|
223
|
+
storageLimit?: string | null;
|
|
224
|
+
workspaceRoot?: string | null;
|
|
225
|
+
workspaceSnapshot?: string | null;
|
|
226
|
+
browser?: AgentComputerBrowser | null;
|
|
227
|
+
terminal?: AgentComputerTerminal | null;
|
|
228
|
+
metadata?: Record<string, any> | null;
|
|
229
|
+
lastActivityAt?: string | null;
|
|
230
|
+
expiresAt?: string | null;
|
|
231
|
+
startedAt?: string | null;
|
|
232
|
+
stoppedAt?: string | null;
|
|
233
|
+
errorMessage?: string | null;
|
|
234
|
+
createdAt: string;
|
|
235
|
+
updatedAt: string;
|
|
236
|
+
canonical?: boolean;
|
|
237
|
+
enabled?: boolean;
|
|
238
|
+
persistence?: ComputerPersistence;
|
|
239
|
+
desiredState?: AgentComputerDesiredState;
|
|
240
|
+
resourceProfile?: ComputerResourceProfile;
|
|
241
|
+
resourceMode?: ComputerResourceMode;
|
|
242
|
+
resources?: ComputerResources;
|
|
243
|
+
cpuRequest?: string | null;
|
|
244
|
+
memoryRequest?: string | null;
|
|
245
|
+
gpuType?: ComputerGpuType | null;
|
|
246
|
+
gpuCount?: number;
|
|
247
|
+
runtimeId?: string | null;
|
|
248
|
+
runtimeGeneration?: number;
|
|
249
|
+
persistentVolumeId?: string | null;
|
|
250
|
+
computeTenantId?: string | null;
|
|
251
|
+
computeCellId?: string | null;
|
|
252
|
+
}
|
|
253
|
+
interface ComputerActionParams {
|
|
254
|
+
reason?: string;
|
|
255
|
+
}
|
|
256
|
+
interface ComputerResizeParams {
|
|
257
|
+
resourceProfile?: ComputerResourceProfile;
|
|
258
|
+
resourceMode?: ComputerResourceMode;
|
|
259
|
+
resources?: ComputerResourceUpdate;
|
|
260
|
+
}
|
|
261
|
+
interface ComputerCommandParams {
|
|
262
|
+
command: string;
|
|
263
|
+
cwd?: string;
|
|
264
|
+
timeoutSeconds?: number;
|
|
265
|
+
}
|
|
266
|
+
interface ComputerFile {
|
|
267
|
+
path: string;
|
|
268
|
+
content: string;
|
|
269
|
+
}
|
|
270
|
+
interface ComputerBrowserOpenParams {
|
|
271
|
+
url: string;
|
|
272
|
+
}
|
|
273
|
+
interface AgentComputerEvent {
|
|
274
|
+
eventId: string;
|
|
275
|
+
computerId: string;
|
|
276
|
+
agentId: string;
|
|
277
|
+
sessionId?: string | null;
|
|
278
|
+
eventType: string;
|
|
279
|
+
actorType: string;
|
|
280
|
+
actorId?: string | null;
|
|
281
|
+
summary?: string | null;
|
|
282
|
+
payload?: Record<string, any> | null;
|
|
283
|
+
createdAt: string;
|
|
284
|
+
}
|
|
285
|
+
interface CreateAgentParams {
|
|
286
|
+
name: string;
|
|
287
|
+
instructions?: string;
|
|
288
|
+
persona?: string;
|
|
289
|
+
greeting?: string;
|
|
290
|
+
conversationStarters?: string[];
|
|
291
|
+
owner?: string;
|
|
292
|
+
ownerUserId?: string;
|
|
293
|
+
workspaceId?: string | null;
|
|
294
|
+
metadata?: Record<string, unknown>;
|
|
295
|
+
modelProvider?: ModelProvider;
|
|
296
|
+
modelId?: string;
|
|
297
|
+
modelApiKey?: string;
|
|
298
|
+
modelBaseUrl?: string;
|
|
299
|
+
temperature?: number;
|
|
300
|
+
maxTokens?: number;
|
|
301
|
+
topP?: number;
|
|
302
|
+
commonTools?: string[];
|
|
303
|
+
avatar?: string;
|
|
304
|
+
runtimeType?: AgentRuntimeType;
|
|
305
|
+
runtimeVersion?: string;
|
|
306
|
+
runtimeConfig?: AgentRuntimeConfig;
|
|
307
|
+
}
|
|
308
|
+
interface Session {
|
|
309
|
+
sessionId: string;
|
|
310
|
+
agentId: string;
|
|
311
|
+
initiator: string;
|
|
312
|
+
title?: string;
|
|
313
|
+
model: ModelConfig & {
|
|
314
|
+
name?: string;
|
|
315
|
+
};
|
|
316
|
+
createdAt: string;
|
|
317
|
+
/** 'cli' | 'web' — origin of the session, used for filtering in the UI */
|
|
318
|
+
source?: "cli" | "web";
|
|
319
|
+
/** Same as source; returned from the backend column `initiator_type` */
|
|
320
|
+
initiatorType?: "cli" | "web";
|
|
321
|
+
}
|
|
322
|
+
interface RunParams {
|
|
323
|
+
agentId: string;
|
|
324
|
+
messages: ChatMessage[];
|
|
325
|
+
sessionId?: string;
|
|
326
|
+
initiatorId?: string;
|
|
327
|
+
computerRequest?: {
|
|
328
|
+
enabled: boolean;
|
|
329
|
+
/** @deprecated The agent's singleton computer is selected implicitly. */
|
|
330
|
+
computerIds?: string[];
|
|
331
|
+
/** @deprecated Computers are always persistent; this value is ignored. */
|
|
332
|
+
lifecycle?: AgentComputerLifecycle | "ephemeral";
|
|
333
|
+
};
|
|
334
|
+
/** Uploaded file references. Raw file bytes must be uploaded separately. */
|
|
335
|
+
attachments?: Array<{
|
|
336
|
+
fileId: string;
|
|
337
|
+
}>;
|
|
338
|
+
/** Extra text injected into the agent's system prompt. Used by the CLI to deliver the local tools manifest. */
|
|
339
|
+
cliContext?: string;
|
|
340
|
+
/** Caller-owned function catalog executed through cli_tool_request events. */
|
|
341
|
+
cliTools?: Array<{
|
|
342
|
+
name: string;
|
|
343
|
+
description: string;
|
|
344
|
+
parameters: Record<string, unknown>;
|
|
345
|
+
}>;
|
|
346
|
+
}
|
|
347
|
+
interface ChatMessage {
|
|
348
|
+
role: "user" | "assistant" | "system" | "tool";
|
|
349
|
+
content: string | Array<{
|
|
350
|
+
type: "text";
|
|
351
|
+
text: string;
|
|
352
|
+
} | {
|
|
353
|
+
type: "image_url";
|
|
354
|
+
image_url: {
|
|
355
|
+
url: string;
|
|
356
|
+
};
|
|
357
|
+
} | Record<string, any>>;
|
|
358
|
+
tool_call_id?: string;
|
|
359
|
+
name?: string;
|
|
360
|
+
}
|
|
361
|
+
type StreamEventType = "token" | "tool" | "toolProgress" | "toolStart" | "toolEnd" | "agent_step" | "run_started" | "final" | "completed" | "failed" | "cancelled" | "status" | "keepalive" | "cli_tool_request" | "error";
|
|
362
|
+
interface StreamEvent {
|
|
363
|
+
type: StreamEventType;
|
|
364
|
+
/** Identifies the run; pass to POST /v1/agents/runs/:runId/stream to resume a dropped stream. */
|
|
365
|
+
runId?: string;
|
|
366
|
+
/** Monotonic per-run sequence number; resume with `after: <last seen seq>` to avoid duplicates. */
|
|
367
|
+
seq?: number;
|
|
368
|
+
phase?: "commentary" | "final_answer" | string;
|
|
369
|
+
role?: string;
|
|
370
|
+
content?: string;
|
|
371
|
+
stage?: string;
|
|
372
|
+
status?: "queued" | "running" | "completed" | "failed" | string;
|
|
373
|
+
name?: string;
|
|
374
|
+
toolName?: string;
|
|
375
|
+
tool?: string;
|
|
376
|
+
toolCallId?: string;
|
|
377
|
+
input?: string;
|
|
378
|
+
args?: any;
|
|
379
|
+
output?: any;
|
|
380
|
+
result?: any;
|
|
381
|
+
requestId?: string;
|
|
382
|
+
timestamp?: string;
|
|
383
|
+
sessionId?: string;
|
|
384
|
+
payload?: any;
|
|
385
|
+
message?: string;
|
|
386
|
+
detail?: string;
|
|
387
|
+
}
|
|
388
|
+
interface Workflow {
|
|
389
|
+
workflowId: string;
|
|
390
|
+
name: string;
|
|
391
|
+
description?: string;
|
|
392
|
+
definition: WorkflowDefinition;
|
|
393
|
+
ownerId: string;
|
|
394
|
+
ownerType: "user" | "agent";
|
|
395
|
+
isPublic?: boolean;
|
|
396
|
+
category?: string;
|
|
397
|
+
tags?: string[];
|
|
398
|
+
createdAt: string;
|
|
399
|
+
}
|
|
400
|
+
interface WorkflowDefinition {
|
|
401
|
+
startNodeId?: string;
|
|
402
|
+
endNodeId?: string;
|
|
403
|
+
nodes: WorkflowNode[];
|
|
404
|
+
edges: WorkflowEdge[];
|
|
405
|
+
outputMapping?: Record<string, string>;
|
|
406
|
+
}
|
|
407
|
+
type WorkflowNodeType = "tool" | "input" | "output" | "condition" | "transform" | "loop" | "agent_processor" | "workflow" | "human_approval";
|
|
408
|
+
interface WorkflowNode {
|
|
409
|
+
id: string;
|
|
410
|
+
type: WorkflowNodeType | string;
|
|
411
|
+
toolId?: string;
|
|
412
|
+
toolName?: string;
|
|
413
|
+
agentId?: string;
|
|
414
|
+
agentAvatar?: string;
|
|
415
|
+
workflowId?: string;
|
|
416
|
+
label?: string;
|
|
417
|
+
position?: {
|
|
418
|
+
x: number;
|
|
419
|
+
y: number;
|
|
420
|
+
};
|
|
421
|
+
config?: Record<string, any>;
|
|
422
|
+
}
|
|
423
|
+
interface WorkflowEdge {
|
|
424
|
+
id: string;
|
|
425
|
+
source: string;
|
|
426
|
+
target: string;
|
|
427
|
+
/** For condition nodes: 'true' routes the true branch, 'false' the false branch */
|
|
428
|
+
sourceHandle?: string;
|
|
429
|
+
targetHandle?: string;
|
|
430
|
+
mapping?: Record<string, string>;
|
|
431
|
+
/** Runtime target types used for dynamic (`any`) values and safe coercion. */
|
|
432
|
+
targetTypes?: Record<string, string>;
|
|
433
|
+
mappingMode?: "exact" | "dynamic" | "coerce";
|
|
434
|
+
}
|
|
435
|
+
interface WorkflowExecution {
|
|
436
|
+
executionId: string;
|
|
437
|
+
workflowId: string;
|
|
438
|
+
status: "running" | "completed" | "failed" | "cancelled" | "awaiting_approval";
|
|
439
|
+
startedAt?: string;
|
|
440
|
+
completedAt?: string;
|
|
441
|
+
outputData?: any;
|
|
442
|
+
/** Alias returned by the immediate execute/status REST response. */
|
|
443
|
+
result?: any;
|
|
444
|
+
nodeResults?: Record<string, any>;
|
|
445
|
+
/** Alias returned by the immediate execute/status REST response. */
|
|
446
|
+
stepResults?: Record<string, any>;
|
|
447
|
+
errorMessage?: string;
|
|
448
|
+
currentNode?: string;
|
|
449
|
+
/** Set when status is 'awaiting_approval' */
|
|
450
|
+
pausedAtNode?: string;
|
|
451
|
+
approvalToken?: string;
|
|
452
|
+
}
|
|
453
|
+
interface Task {
|
|
454
|
+
taskId: string;
|
|
455
|
+
agentId: string;
|
|
456
|
+
sessionId: string;
|
|
457
|
+
title: string;
|
|
458
|
+
description?: string;
|
|
459
|
+
status: "pending" | "started" | "running" | "completed" | "failed" | "cancelled";
|
|
460
|
+
executionMode: "single" | "workflow" | "sequential";
|
|
461
|
+
workflowId?: string;
|
|
462
|
+
cronExpression?: string;
|
|
463
|
+
isRecurring?: boolean;
|
|
464
|
+
scheduledFor?: string;
|
|
465
|
+
nextRunAt?: string;
|
|
466
|
+
lastRunAt?: string;
|
|
467
|
+
actualStart?: string;
|
|
468
|
+
actualEnd?: string;
|
|
469
|
+
estimatedDuration?: number;
|
|
470
|
+
dependsOn?: string[];
|
|
471
|
+
metadata?: Record<string, any>;
|
|
472
|
+
priority?: number;
|
|
473
|
+
timeoutMs?: number;
|
|
474
|
+
progress?: number;
|
|
475
|
+
resultContent?: any;
|
|
476
|
+
summary?: string;
|
|
477
|
+
errorMessage?: string;
|
|
478
|
+
createdBy: string;
|
|
479
|
+
createdByType: "user" | "agent";
|
|
480
|
+
createdAt: string;
|
|
481
|
+
updatedAt?: string;
|
|
482
|
+
}
|
|
483
|
+
interface CreateTaskParams {
|
|
484
|
+
agentId: string;
|
|
485
|
+
sessionId: string;
|
|
486
|
+
title: string;
|
|
487
|
+
description?: string;
|
|
488
|
+
executionMode?: "single" | "workflow" | "sequential";
|
|
489
|
+
workflowId?: string;
|
|
490
|
+
workflowInputs?: Record<string, any>;
|
|
491
|
+
cronExpression?: string;
|
|
492
|
+
scheduledFor?: Date;
|
|
493
|
+
isRecurring?: boolean;
|
|
494
|
+
dependsOn?: string[];
|
|
495
|
+
tools?: string[];
|
|
496
|
+
toolConstraintType?: "hard" | "soft" | "none";
|
|
497
|
+
toolInstructions?: string;
|
|
498
|
+
priority?: number;
|
|
499
|
+
/** Max execution time in milliseconds for workflow tasks */
|
|
500
|
+
timeoutMs?: number;
|
|
501
|
+
createdBy: string;
|
|
502
|
+
createdByType: "user" | "agent";
|
|
503
|
+
}
|
|
504
|
+
interface Tool {
|
|
505
|
+
toolId: string;
|
|
506
|
+
name: string;
|
|
507
|
+
displayName?: string;
|
|
508
|
+
description?: string;
|
|
509
|
+
schema: any;
|
|
510
|
+
owner?: string;
|
|
511
|
+
isPublic?: boolean;
|
|
512
|
+
tags?: string[];
|
|
513
|
+
createdAt: string;
|
|
514
|
+
}
|
|
515
|
+
interface CreateToolParams {
|
|
516
|
+
name: string;
|
|
517
|
+
displayName?: string;
|
|
518
|
+
description?: string;
|
|
519
|
+
schema: any;
|
|
520
|
+
apiSpec?: {
|
|
521
|
+
baseUrl: string;
|
|
522
|
+
path: string;
|
|
523
|
+
method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | string;
|
|
524
|
+
headers?: Record<string, string>;
|
|
525
|
+
queryParams?: Record<string, string>;
|
|
526
|
+
bodyTemplate?: any;
|
|
527
|
+
authType?: "none" | "bearer" | "api-key" | "basic" | "oauth2" | string;
|
|
528
|
+
authKeyName?: string;
|
|
529
|
+
oauthProviderKey?: string;
|
|
530
|
+
oauthScopes?: string[];
|
|
531
|
+
oauthTokenLocation?: "header" | "query" | "body";
|
|
532
|
+
oauthTokenKey?: string;
|
|
533
|
+
oauthTokenPrefix?: string;
|
|
534
|
+
};
|
|
535
|
+
category?: string;
|
|
536
|
+
icon?: string;
|
|
537
|
+
inputSchema?: any;
|
|
538
|
+
outputSchema?: any;
|
|
539
|
+
owner?: string;
|
|
540
|
+
ownerType?: "user" | "agent";
|
|
541
|
+
visibility?: "private" | "public" | "platform";
|
|
542
|
+
tags?: string[];
|
|
543
|
+
version?: string;
|
|
544
|
+
rateLimitPerMinute?: number;
|
|
545
|
+
rateLimitPerHour?: number;
|
|
546
|
+
}
|
|
547
|
+
interface ToolKey {
|
|
548
|
+
keyId: string;
|
|
549
|
+
toolId?: string;
|
|
550
|
+
ownerId: string;
|
|
551
|
+
ownerType: "user" | "agent";
|
|
552
|
+
keyName: string;
|
|
553
|
+
displayName?: string;
|
|
554
|
+
description?: string;
|
|
555
|
+
maskedValue?: string;
|
|
556
|
+
isActive?: boolean;
|
|
557
|
+
usageCount?: number;
|
|
558
|
+
createdAt: string;
|
|
559
|
+
}
|
|
560
|
+
interface CreateToolKeyParams {
|
|
561
|
+
toolId?: string;
|
|
562
|
+
ownerId: string;
|
|
563
|
+
ownerType: "user" | "agent";
|
|
564
|
+
keyName: string;
|
|
565
|
+
value: string;
|
|
566
|
+
displayName?: string;
|
|
567
|
+
description?: string;
|
|
568
|
+
keyType?: string;
|
|
569
|
+
}
|
|
570
|
+
interface ToolPermission {
|
|
571
|
+
id: string;
|
|
572
|
+
toolId: string;
|
|
573
|
+
subjectId: string;
|
|
574
|
+
subjectType: "user" | "agent";
|
|
575
|
+
permission: "read" | "execute" | "admin";
|
|
576
|
+
grantedBy?: string;
|
|
577
|
+
createdAt: string;
|
|
578
|
+
expiresAt?: string;
|
|
579
|
+
}
|
|
580
|
+
type A2ATaskState = "submitted" | "working" | "input-required" | "completed" | "failed" | "canceled";
|
|
581
|
+
interface A2ATextPart {
|
|
582
|
+
type: "text";
|
|
583
|
+
text: string;
|
|
584
|
+
metadata?: Record<string, any>;
|
|
585
|
+
}
|
|
586
|
+
interface A2ADataPart {
|
|
587
|
+
type: "data";
|
|
588
|
+
data: Record<string, any>;
|
|
589
|
+
metadata?: Record<string, any>;
|
|
590
|
+
}
|
|
591
|
+
interface A2AFilePart {
|
|
592
|
+
type: "file";
|
|
593
|
+
file: {
|
|
594
|
+
name?: string;
|
|
595
|
+
mimeType?: string;
|
|
596
|
+
bytes?: string;
|
|
597
|
+
uri?: string;
|
|
598
|
+
};
|
|
599
|
+
metadata?: Record<string, any>;
|
|
600
|
+
}
|
|
601
|
+
type A2AMessagePart = A2ATextPart | A2ADataPart | A2AFilePart;
|
|
602
|
+
interface A2AMessage {
|
|
603
|
+
role: "user" | "agent";
|
|
604
|
+
parts: A2AMessagePart[];
|
|
605
|
+
contextId?: string;
|
|
606
|
+
messageId?: string;
|
|
607
|
+
taskId?: string;
|
|
608
|
+
metadata?: Record<string, any>;
|
|
609
|
+
}
|
|
610
|
+
interface A2AArtifact {
|
|
611
|
+
artifactId?: string;
|
|
612
|
+
name?: string;
|
|
613
|
+
description?: string;
|
|
614
|
+
parts: A2AMessagePart[];
|
|
615
|
+
index?: number;
|
|
616
|
+
metadata?: Record<string, any>;
|
|
617
|
+
}
|
|
618
|
+
interface A2ATask {
|
|
619
|
+
id: string;
|
|
620
|
+
contextId?: string;
|
|
621
|
+
status: {
|
|
622
|
+
state: A2ATaskState;
|
|
623
|
+
message?: A2AMessage;
|
|
624
|
+
timestamp?: string;
|
|
625
|
+
};
|
|
626
|
+
artifacts?: A2AArtifact[];
|
|
627
|
+
history?: A2AMessage[];
|
|
628
|
+
metadata?: Record<string, any>;
|
|
629
|
+
}
|
|
630
|
+
interface A2ASkill {
|
|
631
|
+
id: string;
|
|
632
|
+
name: string;
|
|
633
|
+
description?: string;
|
|
634
|
+
tags?: string[];
|
|
635
|
+
examples?: string[];
|
|
636
|
+
inputModes?: string[];
|
|
637
|
+
outputModes?: string[];
|
|
638
|
+
}
|
|
639
|
+
interface AgentCard {
|
|
640
|
+
name: string;
|
|
641
|
+
description?: string;
|
|
642
|
+
url: string;
|
|
643
|
+
version: string;
|
|
644
|
+
capabilities: {
|
|
645
|
+
streaming?: boolean;
|
|
646
|
+
pushNotifications?: boolean;
|
|
647
|
+
stateTransitionHistory?: boolean;
|
|
648
|
+
};
|
|
649
|
+
defaultInputModes: string[];
|
|
650
|
+
defaultOutputModes: string[];
|
|
651
|
+
skills: A2ASkill[];
|
|
652
|
+
}
|
|
653
|
+
interface A2ASendTaskParams {
|
|
654
|
+
id?: string;
|
|
655
|
+
message: A2AMessage;
|
|
656
|
+
pushNotification?: {
|
|
657
|
+
url: string;
|
|
658
|
+
token?: string;
|
|
659
|
+
};
|
|
660
|
+
}
|
|
661
|
+
type McpConnectionType = "stdio" | "sse" | "http" | "streamable-http";
|
|
662
|
+
interface McpServer {
|
|
663
|
+
serverId: string;
|
|
664
|
+
name: string;
|
|
665
|
+
description?: string;
|
|
666
|
+
connectionType: McpConnectionType;
|
|
667
|
+
connectionConfig: Record<string, any>;
|
|
668
|
+
status: "connected" | "disconnected" | "error";
|
|
669
|
+
toolsCount: number;
|
|
670
|
+
capabilities?: Record<string, any>;
|
|
671
|
+
isPublic: boolean;
|
|
672
|
+
ownerId: string;
|
|
673
|
+
ownerType: "user" | "agent";
|
|
674
|
+
createdAt: string;
|
|
675
|
+
}
|
|
676
|
+
interface McpResource {
|
|
677
|
+
uri: string;
|
|
678
|
+
name: string;
|
|
679
|
+
description?: string;
|
|
680
|
+
mimeType?: string;
|
|
681
|
+
}
|
|
682
|
+
interface McpPrompt {
|
|
683
|
+
name: string;
|
|
684
|
+
description?: string;
|
|
685
|
+
arguments?: Array<{
|
|
686
|
+
name: string;
|
|
687
|
+
description?: string;
|
|
688
|
+
required?: boolean;
|
|
689
|
+
}>;
|
|
690
|
+
}
|
|
691
|
+
interface CommonsClientConfig {
|
|
692
|
+
/** Defaults to the unified Commons API platform. */
|
|
693
|
+
baseUrl?: string;
|
|
694
|
+
apiKey?: string;
|
|
695
|
+
initiator?: string;
|
|
696
|
+
/** Fetch implementation — defaults to global fetch */
|
|
697
|
+
fetch?: typeof fetch;
|
|
698
|
+
}
|
|
699
|
+
interface Skill {
|
|
700
|
+
skillId: string;
|
|
701
|
+
slug: string;
|
|
702
|
+
name: string;
|
|
703
|
+
description: string;
|
|
704
|
+
instructions: string;
|
|
705
|
+
tools: string[];
|
|
706
|
+
triggers: string[];
|
|
707
|
+
ownerId?: string | null;
|
|
708
|
+
ownerType: string;
|
|
709
|
+
isPublic: boolean;
|
|
710
|
+
isActive: boolean;
|
|
711
|
+
version: string;
|
|
712
|
+
tags: string[];
|
|
713
|
+
icon?: string | null;
|
|
714
|
+
usageCount: number;
|
|
715
|
+
source: string;
|
|
716
|
+
sourceUrl?: string | null;
|
|
717
|
+
createdAt: string;
|
|
718
|
+
updatedAt: string;
|
|
719
|
+
}
|
|
720
|
+
interface SkillIndex {
|
|
721
|
+
skillId: string;
|
|
722
|
+
slug: string;
|
|
723
|
+
name: string;
|
|
724
|
+
description: string;
|
|
725
|
+
tags: string[];
|
|
726
|
+
icon?: string | null;
|
|
727
|
+
triggers: string[];
|
|
728
|
+
}
|
|
729
|
+
interface CreateSkillParams {
|
|
730
|
+
slug: string;
|
|
731
|
+
name: string;
|
|
732
|
+
description: string;
|
|
733
|
+
instructions: string;
|
|
734
|
+
tools?: string[];
|
|
735
|
+
triggers?: string[];
|
|
736
|
+
ownerId?: string;
|
|
737
|
+
ownerType?: "platform" | "user" | "agent";
|
|
738
|
+
isPublic?: boolean;
|
|
739
|
+
tags?: string[];
|
|
740
|
+
icon?: string;
|
|
741
|
+
source?: string;
|
|
742
|
+
sourceUrl?: string;
|
|
743
|
+
}
|
|
744
|
+
type MemoryType = "episodic" | "semantic" | "procedural";
|
|
745
|
+
type MemorySourceType = "auto" | "manual";
|
|
746
|
+
interface AgentMemory {
|
|
747
|
+
memoryId: string;
|
|
748
|
+
agentId: string;
|
|
749
|
+
sessionId?: string;
|
|
750
|
+
memoryType: MemoryType;
|
|
751
|
+
content: string;
|
|
752
|
+
summary: string;
|
|
753
|
+
importanceScore: number;
|
|
754
|
+
accessCount: number;
|
|
755
|
+
lastAccessedAt?: string;
|
|
756
|
+
tags: string[];
|
|
757
|
+
sourceType: MemorySourceType;
|
|
758
|
+
isActive: boolean;
|
|
759
|
+
expiresAt?: string;
|
|
760
|
+
createdAt: string;
|
|
761
|
+
updatedAt: string;
|
|
762
|
+
}
|
|
763
|
+
interface MemoryStats {
|
|
764
|
+
total: number;
|
|
765
|
+
episodic: number;
|
|
766
|
+
semantic: number;
|
|
767
|
+
procedural: number;
|
|
768
|
+
avgImportance: number;
|
|
769
|
+
}
|
|
770
|
+
interface CreateMemoryParams {
|
|
771
|
+
agentId: string;
|
|
772
|
+
sessionId?: string;
|
|
773
|
+
memoryType?: MemoryType;
|
|
774
|
+
content: string;
|
|
775
|
+
summary: string;
|
|
776
|
+
importanceScore?: number;
|
|
777
|
+
tags?: string[];
|
|
778
|
+
}
|
|
779
|
+
interface UpdateMemoryParams {
|
|
780
|
+
content?: string;
|
|
781
|
+
summary?: string;
|
|
782
|
+
importanceScore?: number;
|
|
783
|
+
tags?: string[];
|
|
784
|
+
isActive?: boolean;
|
|
785
|
+
memoryType?: MemoryType;
|
|
786
|
+
}
|
|
787
|
+
interface SharedMemoryScope {
|
|
788
|
+
scopeId: string;
|
|
789
|
+
name: string;
|
|
790
|
+
description?: string | null;
|
|
791
|
+
access?: "read" | "write" | "admin";
|
|
792
|
+
updatedAt: string;
|
|
793
|
+
}
|
|
794
|
+
interface CreateSharedMemoryScopeParams {
|
|
795
|
+
name: string;
|
|
796
|
+
description?: string;
|
|
797
|
+
agentIds: string[];
|
|
798
|
+
}
|
|
799
|
+
interface UsageEvent {
|
|
800
|
+
eventId: string;
|
|
801
|
+
agentId: string;
|
|
802
|
+
sessionId?: string;
|
|
803
|
+
taskId?: string;
|
|
804
|
+
workflowExecutionId?: string;
|
|
805
|
+
provider: string;
|
|
806
|
+
modelId: string;
|
|
807
|
+
inputTokens: number;
|
|
808
|
+
outputTokens: number;
|
|
809
|
+
cachedTokens: number;
|
|
810
|
+
totalTokens: number;
|
|
811
|
+
costUsd: number;
|
|
812
|
+
isByok: boolean;
|
|
813
|
+
durationMs?: number;
|
|
814
|
+
/** Trace ID — links all LLM calls in a single runAgent() invocation. */
|
|
815
|
+
traceId?: string;
|
|
816
|
+
createdAt: string;
|
|
817
|
+
}
|
|
818
|
+
interface UsageAggregation {
|
|
819
|
+
totalInputTokens: number;
|
|
820
|
+
totalOutputTokens: number;
|
|
821
|
+
totalTokens: number;
|
|
822
|
+
totalCostUsd: number;
|
|
823
|
+
callCount: number;
|
|
824
|
+
events: UsageEvent[];
|
|
825
|
+
}
|
|
826
|
+
type CreditDirection = "grant" | "debit" | "adjustment" | "refund" | "expiration";
|
|
827
|
+
type CreditPlatform = "agent_commons" | "commonlab" | "common_os" | "system";
|
|
828
|
+
interface CreditLedgerEntry {
|
|
829
|
+
entryId: string;
|
|
830
|
+
principalId: string;
|
|
831
|
+
principalType: "user" | "agent" | "service";
|
|
832
|
+
workspaceId?: string | null;
|
|
833
|
+
amount: number;
|
|
834
|
+
currency: "credits";
|
|
835
|
+
direction: CreditDirection;
|
|
836
|
+
eventType: string;
|
|
837
|
+
sourcePlatform: CreditPlatform;
|
|
838
|
+
idempotencyKey: string;
|
|
839
|
+
description?: string | null;
|
|
840
|
+
relatedCourseId?: string | null;
|
|
841
|
+
relatedChallengeId?: string | null;
|
|
842
|
+
agentId?: string | null;
|
|
843
|
+
sessionId?: string | null;
|
|
844
|
+
taskId?: string | null;
|
|
845
|
+
workflowId?: string | null;
|
|
846
|
+
usageEventId?: string | null;
|
|
847
|
+
metadata?: Record<string, unknown>;
|
|
848
|
+
createdBy?: string | null;
|
|
849
|
+
createdByType?: string | null;
|
|
850
|
+
expiresAt?: string | null;
|
|
851
|
+
voidedAt?: string | null;
|
|
852
|
+
createdAt: string;
|
|
853
|
+
}
|
|
854
|
+
interface CreditBalance {
|
|
855
|
+
principalId: string;
|
|
856
|
+
workspaceId?: string | null;
|
|
857
|
+
balance: number;
|
|
858
|
+
currency: "credits";
|
|
859
|
+
}
|
|
860
|
+
interface CreditWriteParams {
|
|
861
|
+
principalId: string;
|
|
862
|
+
principalType?: "user" | "agent" | "service";
|
|
863
|
+
workspaceId?: string | null;
|
|
864
|
+
amount: number;
|
|
865
|
+
eventType: string;
|
|
866
|
+
sourcePlatform: CreditPlatform;
|
|
867
|
+
idempotencyKey: string;
|
|
868
|
+
description?: string;
|
|
869
|
+
relatedCourseId?: string;
|
|
870
|
+
relatedChallengeId?: string;
|
|
871
|
+
agentId?: string;
|
|
872
|
+
sessionId?: string;
|
|
873
|
+
taskId?: string;
|
|
874
|
+
workflowId?: string;
|
|
875
|
+
usageEventId?: string;
|
|
876
|
+
metadata?: Record<string, unknown>;
|
|
877
|
+
}
|
|
878
|
+
type PlanKey = "free" | "plus" | "pro" | "max";
|
|
879
|
+
type ComputeProfile = "starter" | "standard" | "performance" | "gpu";
|
|
880
|
+
type ModelTier = "frontier" | "standard" | "fast" | "local";
|
|
881
|
+
interface PlanEntitlements {
|
|
882
|
+
computerUse: boolean;
|
|
883
|
+
allowedProfiles: ComputeProfile[];
|
|
884
|
+
maxConcurrentComputers: number;
|
|
885
|
+
modelTiers: ModelTier[];
|
|
886
|
+
maxConcurrentRuns: number;
|
|
887
|
+
}
|
|
888
|
+
interface SubscriptionInfo {
|
|
889
|
+
planKey: PlanKey;
|
|
890
|
+
planName: string;
|
|
891
|
+
monthlyCredits: number;
|
|
892
|
+
entitlements: PlanEntitlements;
|
|
893
|
+
status: string;
|
|
894
|
+
currentPeriodEnd: string | null;
|
|
895
|
+
cancelAtPeriodEnd: boolean;
|
|
896
|
+
}
|
|
897
|
+
interface FlagEvaluation {
|
|
898
|
+
key: string;
|
|
899
|
+
enabled: boolean;
|
|
900
|
+
variant: string | null;
|
|
901
|
+
payload?: unknown;
|
|
902
|
+
}
|
|
903
|
+
type WalletType = "eoa" | "erc4337" | "external";
|
|
904
|
+
interface AgentWallet {
|
|
905
|
+
id: string;
|
|
906
|
+
agentId: string;
|
|
907
|
+
walletType: WalletType;
|
|
908
|
+
address: string;
|
|
909
|
+
smartAccountAddress?: string | null;
|
|
910
|
+
chainId: string;
|
|
911
|
+
label?: string | null;
|
|
912
|
+
isActive: boolean;
|
|
913
|
+
createdAt: string;
|
|
914
|
+
}
|
|
915
|
+
interface WalletBalance {
|
|
916
|
+
address: string;
|
|
917
|
+
chainId: string;
|
|
918
|
+
native: string;
|
|
919
|
+
usdc: string;
|
|
920
|
+
}
|
|
921
|
+
interface CreateWalletParams {
|
|
922
|
+
agentId: string;
|
|
923
|
+
walletType?: WalletType;
|
|
924
|
+
label?: string;
|
|
925
|
+
/** For 'external' wallets: the owner-provided address */
|
|
926
|
+
externalAddress?: string;
|
|
927
|
+
chainId?: string;
|
|
928
|
+
}
|
|
929
|
+
type ApiKeyPrincipalType = "user" | "agent";
|
|
930
|
+
interface ApiKey {
|
|
931
|
+
id: string;
|
|
932
|
+
label?: string | null;
|
|
933
|
+
principalId: string;
|
|
934
|
+
principalType: ApiKeyPrincipalType;
|
|
935
|
+
active: boolean;
|
|
936
|
+
createdAt: string;
|
|
937
|
+
lastUsedAt?: string | null;
|
|
938
|
+
}
|
|
939
|
+
interface CreateApiKeyParams {
|
|
940
|
+
principalId: string;
|
|
941
|
+
principalType: ApiKeyPrincipalType;
|
|
942
|
+
label?: string;
|
|
943
|
+
}
|
|
944
|
+
/** Returned only on creation — the plaintext key is never available again. */
|
|
945
|
+
interface CreatedApiKey extends ApiKey {
|
|
946
|
+
key: string;
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
declare class CommonsClient {
|
|
950
|
+
private readonly baseUrl;
|
|
951
|
+
private readonly apiKey?;
|
|
952
|
+
private readonly initiator?;
|
|
953
|
+
private readonly _fetch;
|
|
954
|
+
constructor(config: CommonsClientConfig);
|
|
955
|
+
private headers;
|
|
956
|
+
private request;
|
|
957
|
+
get models(): {
|
|
958
|
+
/** List all available LLM models from the registry */
|
|
959
|
+
list: () => Promise<{
|
|
960
|
+
data: any[];
|
|
961
|
+
grouped: Record<string, any[]>;
|
|
962
|
+
}>;
|
|
963
|
+
};
|
|
964
|
+
get agents(): {
|
|
965
|
+
create: (params: CreateAgentParams) => Promise<{
|
|
966
|
+
data: Agent;
|
|
967
|
+
}>;
|
|
968
|
+
list: (owner?: string) => Promise<{
|
|
969
|
+
data: Agent[];
|
|
970
|
+
}>;
|
|
971
|
+
get: (agentId: string) => Promise<{
|
|
972
|
+
data: Agent;
|
|
973
|
+
}>;
|
|
974
|
+
update: (agentId: string, params: Partial<CreateAgentParams>) => Promise<{
|
|
975
|
+
data: Agent;
|
|
976
|
+
}>;
|
|
977
|
+
getRuntime: (agentId: string) => Promise<{
|
|
978
|
+
data: AgentRuntime;
|
|
979
|
+
}>;
|
|
980
|
+
configureRuntime: (agentId: string, params: {
|
|
981
|
+
runtimeType?: AgentRuntimeType;
|
|
982
|
+
version?: string | null;
|
|
983
|
+
config?: AgentRuntimeConfig;
|
|
984
|
+
deploy?: boolean;
|
|
985
|
+
}) => Promise<{
|
|
986
|
+
data: AgentRuntime;
|
|
987
|
+
}>;
|
|
988
|
+
deployRuntime: (agentId: string) => Promise<{
|
|
989
|
+
data: AgentRuntime;
|
|
990
|
+
}>;
|
|
991
|
+
sleepRuntime: (agentId: string) => Promise<{
|
|
992
|
+
data: AgentRuntime;
|
|
993
|
+
}>;
|
|
994
|
+
restartRuntime: (agentId: string) => Promise<{
|
|
995
|
+
data: AgentRuntime;
|
|
996
|
+
}>;
|
|
997
|
+
/** List tools assigned to an agent. */
|
|
998
|
+
listTools: (agentId: string) => Promise<{
|
|
999
|
+
data: any[];
|
|
1000
|
+
}>;
|
|
1001
|
+
/** Assign a tool to an agent. */
|
|
1002
|
+
addTool: (agentId: string, params: {
|
|
1003
|
+
toolId: string;
|
|
1004
|
+
usageComments?: string;
|
|
1005
|
+
}) => Promise<{
|
|
1006
|
+
data: any;
|
|
1007
|
+
}>;
|
|
1008
|
+
/** Remove a tool assignment from an agent. */
|
|
1009
|
+
removeTool: (assignmentId: string) => Promise<void>;
|
|
1010
|
+
/** Create a liaison agent for an external agent. */
|
|
1011
|
+
createLiaison: (params: Record<string, any>) => Promise<any>;
|
|
1012
|
+
/**
|
|
1013
|
+
* Stream an agent run. Returns an async generator of StreamEvents.
|
|
1014
|
+
* Works in Node.js, browsers, and Edge runtimes.
|
|
1015
|
+
*
|
|
1016
|
+
* @example
|
|
1017
|
+
* for await (const event of client.agents.stream({ agentId, messages })) {
|
|
1018
|
+
* if (event.type === 'token') process.stdout.write(event.content ?? '');
|
|
1019
|
+
* }
|
|
1020
|
+
*/
|
|
1021
|
+
stream: (params: RunParams) => AsyncGenerator<StreamEvent>;
|
|
1022
|
+
/** Get the current heartbeat status for an agent. */
|
|
1023
|
+
getAutonomy: (agentId: string) => Promise<{
|
|
1024
|
+
data: {
|
|
1025
|
+
enabled: boolean;
|
|
1026
|
+
intervalSec: number;
|
|
1027
|
+
isArmed: boolean;
|
|
1028
|
+
lastBeatAt: string | null;
|
|
1029
|
+
nextBeatAt: string | null;
|
|
1030
|
+
};
|
|
1031
|
+
}>;
|
|
1032
|
+
/** Enable or disable the heartbeat, optionally setting the interval. */
|
|
1033
|
+
setAutonomy: (agentId: string, params: {
|
|
1034
|
+
enabled: boolean;
|
|
1035
|
+
intervalSec?: number;
|
|
1036
|
+
}) => Promise<{
|
|
1037
|
+
data: {
|
|
1038
|
+
enabled: boolean;
|
|
1039
|
+
intervalSec: number;
|
|
1040
|
+
isArmed: boolean;
|
|
1041
|
+
};
|
|
1042
|
+
}>;
|
|
1043
|
+
/** Trigger a single heartbeat immediately. */
|
|
1044
|
+
triggerHeartbeat: (agentId: string) => Promise<{
|
|
1045
|
+
message: string;
|
|
1046
|
+
}>;
|
|
1047
|
+
/**
|
|
1048
|
+
* Manually trigger an agent (fire-and-forget).
|
|
1049
|
+
* Requires autonomy to be enabled on the agent.
|
|
1050
|
+
*/
|
|
1051
|
+
trigger: (agentId: string) => Promise<{
|
|
1052
|
+
message: string;
|
|
1053
|
+
}>;
|
|
1054
|
+
/** Get the knowledgebase entries for an agent. */
|
|
1055
|
+
getKnowledgebase: (agentId: string) => Promise<{
|
|
1056
|
+
data: any[];
|
|
1057
|
+
}>;
|
|
1058
|
+
/** Replace the knowledgebase entries for an agent. */
|
|
1059
|
+
updateKnowledgebase: (agentId: string, knowledgebase: any[]) => Promise<{
|
|
1060
|
+
data: any[];
|
|
1061
|
+
}>;
|
|
1062
|
+
/** List agents that this agent prefers to collaborate with. */
|
|
1063
|
+
getPreferredConnections: (agentId: string) => Promise<{
|
|
1064
|
+
data: any[];
|
|
1065
|
+
}>;
|
|
1066
|
+
/** Add a preferred agent connection. */
|
|
1067
|
+
addPreferredConnection: (agentId: string, params: {
|
|
1068
|
+
preferredAgentId: string;
|
|
1069
|
+
usageComments?: string;
|
|
1070
|
+
}) => Promise<{
|
|
1071
|
+
data: any;
|
|
1072
|
+
}>;
|
|
1073
|
+
/** Remove a preferred agent connection by its record ID. */
|
|
1074
|
+
removePreferredConnection: (id: string) => Promise<{
|
|
1075
|
+
success: boolean;
|
|
1076
|
+
}>;
|
|
1077
|
+
getComputerConfig: (agentId: string) => Promise<{
|
|
1078
|
+
data: AgentComputerConfig;
|
|
1079
|
+
}>;
|
|
1080
|
+
updateComputerConfig: (agentId: string, params: ComputerConfigUpdate) => Promise<{
|
|
1081
|
+
data: AgentComputerConfig;
|
|
1082
|
+
}>;
|
|
1083
|
+
/** Get the agent's one persistent cloud computer. */
|
|
1084
|
+
getComputer: (agentId: string, _legacyComputerId?: string) => Promise<{
|
|
1085
|
+
data: AgentComputer | null;
|
|
1086
|
+
}>;
|
|
1087
|
+
/** Wake the agent's persistent cloud computer, provisioning it if needed. */
|
|
1088
|
+
wakeComputer: (agentId: string, params?: ComputerActionParams) => Promise<{
|
|
1089
|
+
data: AgentComputer;
|
|
1090
|
+
}>;
|
|
1091
|
+
/** Sleep the runtime while preserving the computer's durable workspace. */
|
|
1092
|
+
sleepComputer: (agentId: string, params?: ComputerActionParams) => Promise<{
|
|
1093
|
+
data: AgentComputer;
|
|
1094
|
+
}>;
|
|
1095
|
+
/** Replace the runtime without replacing the persistent computer. */
|
|
1096
|
+
restartComputer: (agentId: string, params?: ComputerActionParams) => Promise<{
|
|
1097
|
+
data: AgentComputer;
|
|
1098
|
+
}>;
|
|
1099
|
+
resizeComputer: (agentId: string, params: ComputerResizeParams) => Promise<{
|
|
1100
|
+
data: AgentComputer;
|
|
1101
|
+
}>;
|
|
1102
|
+
execComputer: (agentId: string, params: ComputerCommandParams) => Promise<{
|
|
1103
|
+
data: any;
|
|
1104
|
+
}>;
|
|
1105
|
+
readComputerFile: (agentId: string, pathOrLegacyComputerId: string, legacyPath?: string) => Promise<{
|
|
1106
|
+
data: ComputerFile;
|
|
1107
|
+
}>;
|
|
1108
|
+
openComputerBrowser: (agentId: string, paramsOrLegacyComputerId: ComputerBrowserOpenParams | string, legacyParams?: ComputerBrowserOpenParams) => Promise<{
|
|
1109
|
+
data: any;
|
|
1110
|
+
}>;
|
|
1111
|
+
listComputerEvents: (agentId: string, limitOrLegacyComputerId?: number | string, legacyLimit?: number) => Promise<{
|
|
1112
|
+
data: AgentComputerEvent[];
|
|
1113
|
+
}>;
|
|
1114
|
+
/** @deprecated Use getComputer. The singleton is returned as a one-item list. */
|
|
1115
|
+
listComputers: (agentId: string, _filter?: {
|
|
1116
|
+
sessionId?: string;
|
|
1117
|
+
includeTerminated?: boolean;
|
|
1118
|
+
}) => Promise<{
|
|
1119
|
+
data: AgentComputerInstance[];
|
|
1120
|
+
}>;
|
|
1121
|
+
/** @deprecated Use wakeComputer. Lifecycle, name, and session are ignored. */
|
|
1122
|
+
startComputer: (agentId: string, params?: {
|
|
1123
|
+
sessionId?: string;
|
|
1124
|
+
lifecycle?: "persistent" | "ephemeral";
|
|
1125
|
+
name?: string;
|
|
1126
|
+
reason?: string;
|
|
1127
|
+
}) => Promise<{
|
|
1128
|
+
data: AgentComputerInstance;
|
|
1129
|
+
}>;
|
|
1130
|
+
/** @deprecated Use getComputer. Computer IDs are ignored. */
|
|
1131
|
+
refreshComputer: (agentId: string, _computerId?: string) => Promise<{
|
|
1132
|
+
data: AgentComputerInstance;
|
|
1133
|
+
}>;
|
|
1134
|
+
/** @deprecated Use sleepComputer. Computer IDs are ignored. */
|
|
1135
|
+
stopComputer: (agentId: string, _computerId?: string) => Promise<{
|
|
1136
|
+
data: AgentComputerInstance;
|
|
1137
|
+
}>;
|
|
1138
|
+
/** @deprecated Use execComputer. Computer IDs are ignored. */
|
|
1139
|
+
runComputerCommand: (agentId: string, paramsOrLegacyComputerId: ComputerCommandParams | string, legacyParams?: ComputerCommandParams) => Promise<{
|
|
1140
|
+
data: any;
|
|
1141
|
+
}>;
|
|
1142
|
+
/**
|
|
1143
|
+
* List available TTS voices for a provider.
|
|
1144
|
+
* @param provider - 'openai' (default) or 'elevenlabs'
|
|
1145
|
+
* @param q - optional search query to filter voices
|
|
1146
|
+
*/
|
|
1147
|
+
listVoices: (provider?: "openai" | "elevenlabs", q?: string) => Promise<{
|
|
1148
|
+
data: any[];
|
|
1149
|
+
}>;
|
|
1150
|
+
};
|
|
1151
|
+
get run(): {
|
|
1152
|
+
once: (params: RunParams) => Promise<any>;
|
|
1153
|
+
};
|
|
1154
|
+
get workflows(): {
|
|
1155
|
+
create: (params: {
|
|
1156
|
+
name: string;
|
|
1157
|
+
description?: string;
|
|
1158
|
+
definition: any;
|
|
1159
|
+
ownerId: string;
|
|
1160
|
+
ownerType: "user" | "agent";
|
|
1161
|
+
isPublic?: boolean;
|
|
1162
|
+
category?: string;
|
|
1163
|
+
tags?: string[];
|
|
1164
|
+
}) => Promise<Workflow>;
|
|
1165
|
+
list: (ownerId: string, ownerType: "user" | "agent") => Promise<Workflow[]>;
|
|
1166
|
+
get: (workflowId: string) => Promise<Workflow>;
|
|
1167
|
+
update: (workflowId: string, updates: Partial<Workflow>) => Promise<Workflow>;
|
|
1168
|
+
delete: (workflowId: string) => Promise<{
|
|
1169
|
+
success: boolean;
|
|
1170
|
+
}>;
|
|
1171
|
+
execute: (workflowId: string, params: {
|
|
1172
|
+
agentId?: string;
|
|
1173
|
+
sessionId?: string;
|
|
1174
|
+
inputData?: Record<string, any>;
|
|
1175
|
+
userId?: string;
|
|
1176
|
+
}) => Promise<WorkflowExecution>;
|
|
1177
|
+
getExecution: (workflowId: string, executionId: string) => Promise<WorkflowExecution>;
|
|
1178
|
+
listExecutions: (workflowId: string, limit?: number) => Promise<WorkflowExecution[]>;
|
|
1179
|
+
cancelExecution: (workflowId: string, executionId: string) => Promise<{
|
|
1180
|
+
success: boolean;
|
|
1181
|
+
}>;
|
|
1182
|
+
/** Approve a paused human_approval node and resume execution. */
|
|
1183
|
+
approveExecution: (workflowId: string, executionId: string, params: {
|
|
1184
|
+
approvalToken: string;
|
|
1185
|
+
approvalData?: Record<string, any>;
|
|
1186
|
+
}) => Promise<{
|
|
1187
|
+
success: boolean;
|
|
1188
|
+
executionId: string;
|
|
1189
|
+
action: string;
|
|
1190
|
+
}>;
|
|
1191
|
+
/** Reject a paused human_approval node and terminate execution. */
|
|
1192
|
+
rejectExecution: (workflowId: string, executionId: string, params: {
|
|
1193
|
+
approvalToken: string;
|
|
1194
|
+
reason?: string;
|
|
1195
|
+
}) => Promise<{
|
|
1196
|
+
success: boolean;
|
|
1197
|
+
executionId: string;
|
|
1198
|
+
action: string;
|
|
1199
|
+
}>;
|
|
1200
|
+
/** Stream execution progress via SSE. Returns an async generator. */
|
|
1201
|
+
stream: (workflowId: string, executionId: string) => AsyncGenerator<StreamEvent>;
|
|
1202
|
+
};
|
|
1203
|
+
get tasks(): {
|
|
1204
|
+
create: (params: CreateTaskParams) => Promise<{
|
|
1205
|
+
data: Task;
|
|
1206
|
+
}>;
|
|
1207
|
+
list: (filter: {
|
|
1208
|
+
sessionId?: string;
|
|
1209
|
+
agentId?: string;
|
|
1210
|
+
ownerId?: string;
|
|
1211
|
+
ownerType?: "user" | "agent";
|
|
1212
|
+
}) => Promise<{
|
|
1213
|
+
data: Task[];
|
|
1214
|
+
}>;
|
|
1215
|
+
get: (taskId: string) => Promise<{
|
|
1216
|
+
data: Task;
|
|
1217
|
+
}>;
|
|
1218
|
+
execute: (taskId: string) => Promise<{
|
|
1219
|
+
success: boolean;
|
|
1220
|
+
data: any;
|
|
1221
|
+
}>;
|
|
1222
|
+
cancel: (taskId: string) => Promise<{
|
|
1223
|
+
success: boolean;
|
|
1224
|
+
}>;
|
|
1225
|
+
delete: (taskId: string) => Promise<{
|
|
1226
|
+
success: boolean;
|
|
1227
|
+
}>;
|
|
1228
|
+
/** Edit human-facing task details (title/description/priority). */
|
|
1229
|
+
update: (taskId: string, params: {
|
|
1230
|
+
title?: string;
|
|
1231
|
+
description?: string;
|
|
1232
|
+
priority?: number;
|
|
1233
|
+
}) => Promise<{
|
|
1234
|
+
data: Task;
|
|
1235
|
+
}>;
|
|
1236
|
+
/** Reschedule a task's upcoming run and/or resize its estimated duration. */
|
|
1237
|
+
reschedule: (taskId: string, params: {
|
|
1238
|
+
scheduledFor?: Date;
|
|
1239
|
+
estimatedDuration?: number;
|
|
1240
|
+
}) => Promise<{
|
|
1241
|
+
data: Task;
|
|
1242
|
+
rescheduledRun: {
|
|
1243
|
+
runId: string;
|
|
1244
|
+
created: boolean;
|
|
1245
|
+
} | null;
|
|
1246
|
+
}>;
|
|
1247
|
+
/** Stream task status updates via SSE. Returns an async generator. */
|
|
1248
|
+
stream: (taskId: string) => AsyncGenerator<StreamEvent>;
|
|
1249
|
+
};
|
|
1250
|
+
get sessions(): {
|
|
1251
|
+
list: (agentId: string, initiatorId: string) => Promise<{
|
|
1252
|
+
data: Session[];
|
|
1253
|
+
}>;
|
|
1254
|
+
/** List all sessions for a given agent (all initiators). */
|
|
1255
|
+
listByAgent: (agentId: string) => Promise<{
|
|
1256
|
+
data: Session[];
|
|
1257
|
+
}>;
|
|
1258
|
+
/** List all sessions for a user across all agents. */
|
|
1259
|
+
listByUser: (initiator: string) => Promise<{
|
|
1260
|
+
data: Session[];
|
|
1261
|
+
}>;
|
|
1262
|
+
create: (params: {
|
|
1263
|
+
agentId: string;
|
|
1264
|
+
initiator: string;
|
|
1265
|
+
title?: string;
|
|
1266
|
+
model?: Record<string, any>;
|
|
1267
|
+
/** 'cli' | 'web' — marks the origin of this session for filtering in the UI */
|
|
1268
|
+
source?: "cli" | "web";
|
|
1269
|
+
}) => Promise<{
|
|
1270
|
+
data: Session;
|
|
1271
|
+
}>;
|
|
1272
|
+
get: (sessionId: string) => Promise<{
|
|
1273
|
+
data: Session;
|
|
1274
|
+
}>;
|
|
1275
|
+
/** Get full session with history, tasks, childSessions, and spaces. */
|
|
1276
|
+
getFull: (sessionId: string) => Promise<{
|
|
1277
|
+
data: any;
|
|
1278
|
+
}>;
|
|
1279
|
+
};
|
|
1280
|
+
get tools(): {
|
|
1281
|
+
list: (filter?: {
|
|
1282
|
+
agentId?: string;
|
|
1283
|
+
owner?: string;
|
|
1284
|
+
ownerType?: string;
|
|
1285
|
+
visibility?: string;
|
|
1286
|
+
}) => Promise<{
|
|
1287
|
+
data: Tool[];
|
|
1288
|
+
}>;
|
|
1289
|
+
get: (toolId: string) => Promise<{
|
|
1290
|
+
data: Tool;
|
|
1291
|
+
}>;
|
|
1292
|
+
create: (params: CreateToolParams) => Promise<{
|
|
1293
|
+
data: Tool;
|
|
1294
|
+
}>;
|
|
1295
|
+
update: (toolId: string, params: Partial<CreateToolParams>) => Promise<{
|
|
1296
|
+
data: Tool;
|
|
1297
|
+
}>;
|
|
1298
|
+
delete: (toolId: string) => Promise<{
|
|
1299
|
+
success: boolean;
|
|
1300
|
+
}>;
|
|
1301
|
+
/** List built-in static tools available to all agents. */
|
|
1302
|
+
listStatic: () => Promise<{
|
|
1303
|
+
data: Tool[];
|
|
1304
|
+
}>;
|
|
1305
|
+
};
|
|
1306
|
+
get oauth(): {
|
|
1307
|
+
/** List OAuth providers available on the platform (Google Workspace, GitHub, …). */
|
|
1308
|
+
listProviders: () => Promise<{
|
|
1309
|
+
providers: any[];
|
|
1310
|
+
}>;
|
|
1311
|
+
/** Get one provider's details, including its scope groups. */
|
|
1312
|
+
getProvider: (providerKey: string) => Promise<{
|
|
1313
|
+
provider: any;
|
|
1314
|
+
}>;
|
|
1315
|
+
/**
|
|
1316
|
+
* List the caller's OAuth connections (the accounts agents act with).
|
|
1317
|
+
* `ownerId` is only needed when authenticating with a management key.
|
|
1318
|
+
*/
|
|
1319
|
+
listConnections: (params?: {
|
|
1320
|
+
ownerId?: string;
|
|
1321
|
+
ownerType?: "user" | "agent";
|
|
1322
|
+
}) => Promise<{
|
|
1323
|
+
connections: any[];
|
|
1324
|
+
}>;
|
|
1325
|
+
/**
|
|
1326
|
+
* Start an OAuth connect flow. Returns the authorization URL the user
|
|
1327
|
+
* must open in a browser to grant access.
|
|
1328
|
+
*/
|
|
1329
|
+
connect: (params: {
|
|
1330
|
+
providerKey: string;
|
|
1331
|
+
scopes?: string[];
|
|
1332
|
+
redirectUri?: string;
|
|
1333
|
+
}) => Promise<{
|
|
1334
|
+
authorizationUrl: string;
|
|
1335
|
+
state: string;
|
|
1336
|
+
expiresAt: string;
|
|
1337
|
+
}>;
|
|
1338
|
+
/** Refresh a connection's access token now. */
|
|
1339
|
+
refresh: (connectionId: string) => Promise<{
|
|
1340
|
+
success: boolean;
|
|
1341
|
+
}>;
|
|
1342
|
+
/** Check whether a connection's token is valid. */
|
|
1343
|
+
test: (connectionId: string) => Promise<{
|
|
1344
|
+
success: boolean;
|
|
1345
|
+
status: string;
|
|
1346
|
+
accessTokenValid: boolean;
|
|
1347
|
+
providerUserEmail?: string;
|
|
1348
|
+
error?: string;
|
|
1349
|
+
}>;
|
|
1350
|
+
/** Revoke a connection and delete its tokens. */
|
|
1351
|
+
revoke: (connectionId: string) => Promise<{
|
|
1352
|
+
success: boolean;
|
|
1353
|
+
}>;
|
|
1354
|
+
};
|
|
1355
|
+
get toolKeys(): {
|
|
1356
|
+
list: (filter: {
|
|
1357
|
+
ownerId?: string;
|
|
1358
|
+
ownerType?: string;
|
|
1359
|
+
toolId?: string;
|
|
1360
|
+
}) => Promise<{
|
|
1361
|
+
success: boolean;
|
|
1362
|
+
data: ToolKey[];
|
|
1363
|
+
}>;
|
|
1364
|
+
create: (params: CreateToolKeyParams) => Promise<{
|
|
1365
|
+
success: boolean;
|
|
1366
|
+
data: ToolKey;
|
|
1367
|
+
}>;
|
|
1368
|
+
delete: (keyId: string) => Promise<{
|
|
1369
|
+
success: boolean;
|
|
1370
|
+
}>;
|
|
1371
|
+
};
|
|
1372
|
+
get toolPermissions(): {
|
|
1373
|
+
list: (toolId?: string) => Promise<{
|
|
1374
|
+
success: boolean;
|
|
1375
|
+
data: ToolPermission[];
|
|
1376
|
+
}>;
|
|
1377
|
+
grant: (params: {
|
|
1378
|
+
toolId: string;
|
|
1379
|
+
subjectId: string;
|
|
1380
|
+
subjectType: "user" | "agent";
|
|
1381
|
+
permission: "read" | "execute" | "admin";
|
|
1382
|
+
grantedBy?: string;
|
|
1383
|
+
}) => Promise<{
|
|
1384
|
+
success: boolean;
|
|
1385
|
+
data: ToolPermission;
|
|
1386
|
+
}>;
|
|
1387
|
+
revoke: (permissionId: string) => Promise<{
|
|
1388
|
+
success: boolean;
|
|
1389
|
+
}>;
|
|
1390
|
+
};
|
|
1391
|
+
get skills(): {
|
|
1392
|
+
list: (filter?: {
|
|
1393
|
+
ownerId?: string;
|
|
1394
|
+
ownerType?: string;
|
|
1395
|
+
isPublic?: boolean;
|
|
1396
|
+
}) => Promise<{
|
|
1397
|
+
data: Skill[];
|
|
1398
|
+
}>;
|
|
1399
|
+
get: (skillIdOrSlug: string) => Promise<{
|
|
1400
|
+
data: Skill;
|
|
1401
|
+
}>;
|
|
1402
|
+
getIndex: (ownerId?: string) => Promise<{
|
|
1403
|
+
data: SkillIndex[];
|
|
1404
|
+
}>;
|
|
1405
|
+
create: (params: CreateSkillParams) => Promise<{
|
|
1406
|
+
data: Skill;
|
|
1407
|
+
}>;
|
|
1408
|
+
update: (skillIdOrSlug: string, updates: Partial<CreateSkillParams>) => Promise<{
|
|
1409
|
+
data: Skill;
|
|
1410
|
+
}>;
|
|
1411
|
+
delete: (skillIdOrSlug: string) => Promise<{
|
|
1412
|
+
deleted: boolean;
|
|
1413
|
+
}>;
|
|
1414
|
+
};
|
|
1415
|
+
get wallets(): {
|
|
1416
|
+
/** List all wallets for an agent. */
|
|
1417
|
+
list: (agentId: string) => Promise<AgentWallet[]>;
|
|
1418
|
+
/** Get the primary active wallet for an agent. */
|
|
1419
|
+
primary: (agentId: string) => Promise<AgentWallet | null>;
|
|
1420
|
+
/** Get a specific wallet by ID. */
|
|
1421
|
+
get: (walletId: string) => Promise<AgentWallet>;
|
|
1422
|
+
/** Create a new wallet for an agent. */
|
|
1423
|
+
create: (params: CreateWalletParams) => Promise<AgentWallet>;
|
|
1424
|
+
/** Get USDC and native token balance for a wallet. */
|
|
1425
|
+
balance: (walletId: string) => Promise<WalletBalance>;
|
|
1426
|
+
/** Transfer USDC or ETH to another address. */
|
|
1427
|
+
transfer: (walletId: string, params: {
|
|
1428
|
+
toAddress: string;
|
|
1429
|
+
amount: string;
|
|
1430
|
+
tokenSymbol?: "USDC" | "ETH";
|
|
1431
|
+
}) => Promise<{
|
|
1432
|
+
txHash: string;
|
|
1433
|
+
}>;
|
|
1434
|
+
/**
|
|
1435
|
+
* Proxy an HTTP request through an agent's primary wallet, automatically
|
|
1436
|
+
* handling x402 payment challenges. The wallet signs the payment and
|
|
1437
|
+
* retries once if the target responds with HTTP 402.
|
|
1438
|
+
*/
|
|
1439
|
+
x402Fetch: (agentId: string, params: {
|
|
1440
|
+
url: string;
|
|
1441
|
+
method?: string;
|
|
1442
|
+
headers?: Record<string, string>;
|
|
1443
|
+
body?: string;
|
|
1444
|
+
}) => Promise<{
|
|
1445
|
+
status: number;
|
|
1446
|
+
body: unknown;
|
|
1447
|
+
}>;
|
|
1448
|
+
/** Deactivate a wallet. */
|
|
1449
|
+
deactivate: (walletId: string) => Promise<void>;
|
|
1450
|
+
};
|
|
1451
|
+
get auth(): {
|
|
1452
|
+
/**
|
|
1453
|
+
* GET /v1/auth/me
|
|
1454
|
+
*
|
|
1455
|
+
* Returns the principalId (wallet address / user ID) and principalType
|
|
1456
|
+
* that the current API key belongs to. Use this to auto-detect the
|
|
1457
|
+
* initiator without asking the user to type their address manually.
|
|
1458
|
+
*/
|
|
1459
|
+
me: () => Promise<{
|
|
1460
|
+
principalId: string | null;
|
|
1461
|
+
principalType: string | null;
|
|
1462
|
+
}>;
|
|
1463
|
+
};
|
|
1464
|
+
get apiKeys(): {
|
|
1465
|
+
/**
|
|
1466
|
+
* Generate a new API key for a principal (user or agent).
|
|
1467
|
+
* The plaintext key is returned only in this response — never again.
|
|
1468
|
+
*/
|
|
1469
|
+
create: (params: CreateApiKeyParams) => Promise<CreatedApiKey>;
|
|
1470
|
+
/** List all active API keys for a principal (key values not included). */
|
|
1471
|
+
list: (principalId: string, principalType: ApiKeyPrincipalType) => Promise<ApiKey[]>;
|
|
1472
|
+
/** Revoke (soft-delete) an API key by its UUID. */
|
|
1473
|
+
revoke: (id: string) => Promise<{
|
|
1474
|
+
revoked: boolean;
|
|
1475
|
+
}>;
|
|
1476
|
+
};
|
|
1477
|
+
private _streamAgentRun;
|
|
1478
|
+
private _streamSse;
|
|
1479
|
+
private _parseEventStream;
|
|
1480
|
+
get a2a(): {
|
|
1481
|
+
/** Fetch the A2A Agent Card for an agent. */
|
|
1482
|
+
getAgentCard: (agentId: string) => Promise<AgentCard>;
|
|
1483
|
+
/** Send a task to an agent (synchronous, waits for completion). */
|
|
1484
|
+
sendTask: (agentId: string, params: A2ASendTaskParams) => Promise<A2ATask>;
|
|
1485
|
+
/** Get A2A task status. */
|
|
1486
|
+
getTask: (agentId: string, taskId: string) => Promise<A2ATask>;
|
|
1487
|
+
/** Cancel a running A2A task. */
|
|
1488
|
+
cancelTask: (agentId: string, taskId: string) => Promise<A2ATask>;
|
|
1489
|
+
/** List recent A2A tasks for an agent. */
|
|
1490
|
+
listTasks: (agentId: string, limit?: number) => Promise<{
|
|
1491
|
+
tasks: A2ATask[];
|
|
1492
|
+
total: number;
|
|
1493
|
+
}>;
|
|
1494
|
+
/** Stream A2A task updates (SSE). */
|
|
1495
|
+
stream: (agentId: string, taskId: string) => AsyncGenerator<StreamEvent>;
|
|
1496
|
+
};
|
|
1497
|
+
get mcp(): {
|
|
1498
|
+
/** List MCP servers for an owner. */
|
|
1499
|
+
listServers: (ownerId: string, ownerType: "user" | "agent") => Promise<{
|
|
1500
|
+
servers: McpServer[];
|
|
1501
|
+
total: number;
|
|
1502
|
+
}>;
|
|
1503
|
+
/** Create a new MCP server. */
|
|
1504
|
+
createServer: (params: {
|
|
1505
|
+
name: string;
|
|
1506
|
+
description?: string;
|
|
1507
|
+
connectionType: McpConnectionType;
|
|
1508
|
+
connectionConfig: Record<string, any>;
|
|
1509
|
+
isPublic?: boolean;
|
|
1510
|
+
tags?: string[];
|
|
1511
|
+
ownerId: string;
|
|
1512
|
+
ownerType: "user" | "agent";
|
|
1513
|
+
}) => Promise<McpServer>;
|
|
1514
|
+
/** Get MCP server by ID. */
|
|
1515
|
+
getServer: (serverId: string) => Promise<McpServer>;
|
|
1516
|
+
/** Update an MCP server's configuration. */
|
|
1517
|
+
updateServer: (serverId: string, params: Partial<{
|
|
1518
|
+
name: string;
|
|
1519
|
+
description: string;
|
|
1520
|
+
connectionConfig: Record<string, any>;
|
|
1521
|
+
isPublic: boolean;
|
|
1522
|
+
tags: string[];
|
|
1523
|
+
}>) => Promise<McpServer>;
|
|
1524
|
+
/** Delete an MCP server. */
|
|
1525
|
+
deleteServer: (serverId: string) => Promise<void>;
|
|
1526
|
+
/** List public MCP servers (marketplace). */
|
|
1527
|
+
getMarketplace: () => Promise<{
|
|
1528
|
+
servers: McpServer[];
|
|
1529
|
+
total: number;
|
|
1530
|
+
}>;
|
|
1531
|
+
/** Get connection status for an MCP server. */
|
|
1532
|
+
getServerStatus: (serverId: string) => Promise<{
|
|
1533
|
+
connected: boolean;
|
|
1534
|
+
capabilities: string[];
|
|
1535
|
+
toolsDiscovered: number;
|
|
1536
|
+
lastConnectedAt: Date | null;
|
|
1537
|
+
lastError: string | null;
|
|
1538
|
+
}>;
|
|
1539
|
+
/** Connect to an MCP server. */
|
|
1540
|
+
connect: (serverId: string) => Promise<{
|
|
1541
|
+
connected: boolean;
|
|
1542
|
+
}>;
|
|
1543
|
+
/** Disconnect from an MCP server. */
|
|
1544
|
+
disconnect: (serverId: string) => Promise<void>;
|
|
1545
|
+
/** Sync tools + resources + prompts from the MCP server. */
|
|
1546
|
+
sync: (serverId: string) => Promise<{
|
|
1547
|
+
toolsDiscovered: number;
|
|
1548
|
+
resourcesDiscovered: number;
|
|
1549
|
+
promptsDiscovered: number;
|
|
1550
|
+
}>;
|
|
1551
|
+
/** List tools discovered from an MCP server. */
|
|
1552
|
+
listTools: (serverId: string) => Promise<{
|
|
1553
|
+
tools: any[];
|
|
1554
|
+
total: number;
|
|
1555
|
+
}>;
|
|
1556
|
+
/** List all MCP tools across all servers for a given owner. */
|
|
1557
|
+
listToolsByOwner: (ownerId: string, ownerType: "user" | "agent") => Promise<{
|
|
1558
|
+
tools: any[];
|
|
1559
|
+
}>;
|
|
1560
|
+
/** List resources from an MCP server. */
|
|
1561
|
+
listResources: (serverId: string) => Promise<{
|
|
1562
|
+
resources: McpResource[];
|
|
1563
|
+
total: number;
|
|
1564
|
+
}>;
|
|
1565
|
+
/** Read a resource by URI. */
|
|
1566
|
+
readResource: (serverId: string, uri: string) => Promise<{
|
|
1567
|
+
uri: string;
|
|
1568
|
+
contents: any;
|
|
1569
|
+
}>;
|
|
1570
|
+
/** List prompts from an MCP server. */
|
|
1571
|
+
listPrompts: (serverId: string) => Promise<{
|
|
1572
|
+
prompts: McpPrompt[];
|
|
1573
|
+
total: number;
|
|
1574
|
+
}>;
|
|
1575
|
+
/** Render a prompt with arguments. */
|
|
1576
|
+
getPrompt: (serverId: string, promptName: string, args?: Record<string, string>) => Promise<{
|
|
1577
|
+
description?: string;
|
|
1578
|
+
messages: any[];
|
|
1579
|
+
}>;
|
|
1580
|
+
};
|
|
1581
|
+
get memory(): {
|
|
1582
|
+
/** List all memories for an agent. */
|
|
1583
|
+
list: (agentId: string, opts?: {
|
|
1584
|
+
type?: MemoryType;
|
|
1585
|
+
limit?: number;
|
|
1586
|
+
}) => Promise<{
|
|
1587
|
+
data: AgentMemory[];
|
|
1588
|
+
}>;
|
|
1589
|
+
/** Get memory stats for an agent. */
|
|
1590
|
+
stats: (agentId: string) => Promise<{
|
|
1591
|
+
data: MemoryStats;
|
|
1592
|
+
}>;
|
|
1593
|
+
/** Retrieve memories most relevant to a query. */
|
|
1594
|
+
retrieve: (agentId: string, query: string, limit?: number) => Promise<{
|
|
1595
|
+
data: AgentMemory[];
|
|
1596
|
+
}>;
|
|
1597
|
+
/** Get a single memory by ID. */
|
|
1598
|
+
get: (memoryId: string) => Promise<{
|
|
1599
|
+
data: AgentMemory;
|
|
1600
|
+
}>;
|
|
1601
|
+
/** Manually create a memory. */
|
|
1602
|
+
create: (params: CreateMemoryParams) => Promise<{
|
|
1603
|
+
data: AgentMemory;
|
|
1604
|
+
}>;
|
|
1605
|
+
/** Update a memory. */
|
|
1606
|
+
update: (memoryId: string, params: UpdateMemoryParams) => Promise<{
|
|
1607
|
+
data: AgentMemory;
|
|
1608
|
+
}>;
|
|
1609
|
+
/** Soft-delete (deactivate) a memory. */
|
|
1610
|
+
delete: (memoryId: string) => Promise<void>;
|
|
1611
|
+
/** Create an append-only memory scope shared by a set of owned agents. */
|
|
1612
|
+
createSharedScope: (params: CreateSharedMemoryScopeParams) => Promise<{
|
|
1613
|
+
data: SharedMemoryScope;
|
|
1614
|
+
}>;
|
|
1615
|
+
/** List shared-memory scopes available to an agent. */
|
|
1616
|
+
listSharedScopes: (agentId: string) => Promise<{
|
|
1617
|
+
data: SharedMemoryScope[];
|
|
1618
|
+
}>;
|
|
1619
|
+
};
|
|
1620
|
+
get usage(): {
|
|
1621
|
+
/** Get aggregated token + cost usage for an agent. */
|
|
1622
|
+
getAgentUsage: (agentId: string, opts?: {
|
|
1623
|
+
from?: string;
|
|
1624
|
+
to?: string;
|
|
1625
|
+
}) => Promise<{
|
|
1626
|
+
data: UsageAggregation;
|
|
1627
|
+
}>;
|
|
1628
|
+
/** Get aggregated token + cost usage for a session. */
|
|
1629
|
+
getSessionUsage: (sessionId: string) => Promise<{
|
|
1630
|
+
data: UsageAggregation;
|
|
1631
|
+
}>;
|
|
1632
|
+
};
|
|
1633
|
+
get credits(): {
|
|
1634
|
+
balance: (filter?: {
|
|
1635
|
+
principalId?: string;
|
|
1636
|
+
workspaceId?: string;
|
|
1637
|
+
}) => Promise<{
|
|
1638
|
+
data: CreditBalance;
|
|
1639
|
+
}>;
|
|
1640
|
+
ledger: (filter?: {
|
|
1641
|
+
principalId?: string;
|
|
1642
|
+
workspaceId?: string;
|
|
1643
|
+
limit?: number;
|
|
1644
|
+
}) => Promise<{
|
|
1645
|
+
data: CreditLedgerEntry[];
|
|
1646
|
+
}>;
|
|
1647
|
+
grant: (params: CreditWriteParams) => Promise<{
|
|
1648
|
+
data: CreditLedgerEntry;
|
|
1649
|
+
}>;
|
|
1650
|
+
debit: (params: CreditWriteParams) => Promise<{
|
|
1651
|
+
data: CreditLedgerEntry;
|
|
1652
|
+
}>;
|
|
1653
|
+
};
|
|
1654
|
+
get billing(): {
|
|
1655
|
+
/** Current plan, status, and entitlements for the caller. */
|
|
1656
|
+
subscription: () => Promise<{
|
|
1657
|
+
data: SubscriptionInfo;
|
|
1658
|
+
}>;
|
|
1659
|
+
/** Entitlements only (what paid features the caller may use). */
|
|
1660
|
+
entitlements: () => Promise<{
|
|
1661
|
+
data: PlanEntitlements;
|
|
1662
|
+
}>;
|
|
1663
|
+
/** Create a Stripe Checkout session for a subscription plan. */
|
|
1664
|
+
subscribe: (planKey: "plus" | "pro" | "max") => Promise<{
|
|
1665
|
+
data: {
|
|
1666
|
+
url: string;
|
|
1667
|
+
};
|
|
1668
|
+
}>;
|
|
1669
|
+
/** Create a Stripe Checkout session for a one-time credit top-up. */
|
|
1670
|
+
topup: (packKey: string) => Promise<{
|
|
1671
|
+
data: {
|
|
1672
|
+
url: string;
|
|
1673
|
+
};
|
|
1674
|
+
}>;
|
|
1675
|
+
/** Open the Stripe billing portal. */
|
|
1676
|
+
portal: () => Promise<{
|
|
1677
|
+
data: {
|
|
1678
|
+
url: string;
|
|
1679
|
+
};
|
|
1680
|
+
}>;
|
|
1681
|
+
};
|
|
1682
|
+
get flags(): {
|
|
1683
|
+
/** Evaluate all active flags for the caller (call once at boot). */
|
|
1684
|
+
all: () => Promise<{
|
|
1685
|
+
data: Record<string, FlagEvaluation>;
|
|
1686
|
+
}>;
|
|
1687
|
+
/** Evaluate a single flag for the caller. */
|
|
1688
|
+
evaluate: (key: string) => Promise<{
|
|
1689
|
+
data: FlagEvaluation;
|
|
1690
|
+
}>;
|
|
1691
|
+
};
|
|
1692
|
+
}
|
|
1693
|
+
declare class CommonsError extends Error {
|
|
1694
|
+
readonly status: number;
|
|
1695
|
+
readonly data?: unknown | undefined;
|
|
1696
|
+
constructor(message: string, status: number, data?: unknown | undefined);
|
|
1697
|
+
}
|
|
1698
|
+
|
|
1699
|
+
type WorkflowTemplateName = 'country-weather-brief' | 'agent-research-summary' | 'multi-agent-field-report' | 'workflow-invocation-smoke';
|
|
1700
|
+
interface WorkflowTemplateContext {
|
|
1701
|
+
ownerId: string;
|
|
1702
|
+
prefix: string;
|
|
1703
|
+
agentId?: string;
|
|
1704
|
+
reviewerAgentId?: string;
|
|
1705
|
+
childWorkflowId?: string;
|
|
1706
|
+
}
|
|
1707
|
+
interface WorkflowTemplateTool {
|
|
1708
|
+
key: string;
|
|
1709
|
+
payload: CreateToolParams;
|
|
1710
|
+
}
|
|
1711
|
+
interface WorkflowTemplateBuild {
|
|
1712
|
+
name: string;
|
|
1713
|
+
description: string;
|
|
1714
|
+
tags: string[];
|
|
1715
|
+
category: string;
|
|
1716
|
+
tools: WorkflowTemplateTool[];
|
|
1717
|
+
buildDefinition: (toolIds: Record<string, string>, ctx: WorkflowTemplateContext) => WorkflowDefinition;
|
|
1718
|
+
sampleInput: Record<string, any>;
|
|
1719
|
+
}
|
|
1720
|
+
declare function listWorkflowTemplates(): readonly [{
|
|
1721
|
+
readonly name: "country-weather-brief";
|
|
1722
|
+
readonly description: "Tool-only workflow using countries.dev and Open-Meteo.";
|
|
1723
|
+
}, {
|
|
1724
|
+
readonly name: "agent-research-summary";
|
|
1725
|
+
readonly description: "Multi-tool workflow with an agent_processor summarization step.";
|
|
1726
|
+
}, {
|
|
1727
|
+
readonly name: "multi-agent-field-report";
|
|
1728
|
+
readonly description: "Multi-tool workflow with two agent_processor nodes.";
|
|
1729
|
+
}, {
|
|
1730
|
+
readonly name: "workflow-invocation-smoke";
|
|
1731
|
+
readonly description: "Parent workflow that invokes another workflow as a workflow node.";
|
|
1732
|
+
}];
|
|
1733
|
+
declare function buildWorkflowTemplate(templateName: WorkflowTemplateName, ctx: WorkflowTemplateContext): WorkflowTemplateBuild;
|
|
1734
|
+
|
|
1735
|
+
export { type A2AArtifact, type A2ADataPart, type A2AFilePart, type A2AMessage, type A2AMessagePart, type A2ASendTaskParams, type A2ASkill, type A2ATask, type A2ATaskState, type A2ATextPart, type Agent, type AgentCard, type AgentComputer, type AgentComputerBrowser, type AgentComputerConfig, type AgentComputerDesiredState, type AgentComputerEvent, type AgentComputerGpu, type AgentComputerGpuType, type AgentComputerInstance, type AgentComputerLifecycle, type AgentComputerResourceMode, type AgentComputerResourceProfile, type AgentComputerResources, type AgentComputerStatus, type AgentComputerTerminal, type AgentMemory, type AgentWallet, type ApiKey, type ApiKeyPrincipalType, type ChatMessage, CommonsClient, type CommonsClientConfig, CommonsError, type ComputeProfile, type ComputerActionParams, type ComputerBrowserOpenParams, type ComputerCommandParams, type ComputerConfigUpdate, type ComputerFile, type ComputerGpu, type ComputerGpuType, type ComputerLifecycle, type ComputerNetworkAccess, type ComputerPersistence, type ComputerResizeParams, type ComputerResourceMode, type ComputerResourceProfile, type ComputerResourceUpdate, type ComputerResources, type CreateAgentParams, type CreateApiKeyParams, type CreateMemoryParams, type CreateSkillParams, type CreateTaskParams, type CreateToolKeyParams, type CreateToolParams, type CreateWalletParams, type CreatedApiKey, type FlagEvaluation, type McpConnectionType, type McpPrompt, type McpResource, type McpServer, type MemorySourceType, type MemoryStats, type MemoryType, type ModelConfig, type ModelProvider, type ModelTier, type PlanEntitlements, type PlanKey, type RunParams, type Session, type Skill, type SkillIndex, type StreamEvent, type StreamEventType, type SubscriptionInfo, type Task, type Tool, type ToolKey, type ToolPermission, type UpdateMemoryParams, type UsageAggregation, type UsageEvent, type WalletBalance, type WalletType, type Workflow, type WorkflowDefinition, type WorkflowEdge, type WorkflowExecution, type WorkflowNode, type WorkflowNodeType, type WorkflowTemplateBuild, type WorkflowTemplateContext, type WorkflowTemplateName, type WorkflowTemplateTool, buildWorkflowTemplate, listWorkflowTemplates };
|