@agent-commons/sdk 0.3.0 → 0.4.0
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 +200 -38
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +371 -97
- package/dist/index.d.ts +371 -97
- package/dist/index.mjs +200 -38
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -30,7 +30,10 @@ module.exports = __toCommonJS(index_exports);
|
|
|
30
30
|
// src/client.ts
|
|
31
31
|
var CommonsClient = class {
|
|
32
32
|
constructor(config) {
|
|
33
|
-
this.baseUrl = (config.baseUrl ?? "https://api.agentcommons.io").replace(
|
|
33
|
+
this.baseUrl = (config.baseUrl ?? "https://api.agentcommons.io").replace(
|
|
34
|
+
/\/$/,
|
|
35
|
+
""
|
|
36
|
+
);
|
|
34
37
|
this.apiKey = config.apiKey;
|
|
35
38
|
this.initiator = config.initiator;
|
|
36
39
|
this._fetch = config.fetch ?? fetch;
|
|
@@ -68,6 +71,11 @@ var CommonsClient = class {
|
|
|
68
71
|
list: (owner) => this.request("GET", `/v1/agents${owner ? `?owner=${owner}` : ""}`),
|
|
69
72
|
get: (agentId) => this.request("GET", `/v1/agents/${agentId}`),
|
|
70
73
|
update: (agentId, params) => this.request("PUT", `/v1/agents/${agentId}`, params),
|
|
74
|
+
getRuntime: (agentId) => this.request("GET", `/v1/agents/${agentId}/runtime`),
|
|
75
|
+
configureRuntime: (agentId, params) => this.request("PUT", `/v1/agents/${agentId}/runtime`, params),
|
|
76
|
+
deployRuntime: (agentId) => this.request("POST", `/v1/agents/${agentId}/runtime/deploy`),
|
|
77
|
+
sleepRuntime: (agentId) => this.request("POST", `/v1/agents/${agentId}/runtime/sleep`),
|
|
78
|
+
restartRuntime: (agentId) => this.request("POST", `/v1/agents/${agentId}/runtime/restart`),
|
|
71
79
|
/** List tools assigned to an agent. */
|
|
72
80
|
listTools: (agentId) => this.request("GET", `/v1/agents/${agentId}/tools`),
|
|
73
81
|
/** Assign a tool to an agent. */
|
|
@@ -102,32 +110,90 @@ var CommonsClient = class {
|
|
|
102
110
|
/** Get the knowledgebase entries for an agent. */
|
|
103
111
|
getKnowledgebase: (agentId) => this.request("GET", `/v1/agents/${agentId}/knowledgebase`),
|
|
104
112
|
/** Replace the knowledgebase entries for an agent. */
|
|
105
|
-
updateKnowledgebase: (agentId, knowledgebase) => this.request("PUT", `/v1/agents/${agentId}/knowledgebase`, {
|
|
113
|
+
updateKnowledgebase: (agentId, knowledgebase) => this.request("PUT", `/v1/agents/${agentId}/knowledgebase`, {
|
|
114
|
+
knowledgebase
|
|
115
|
+
}),
|
|
106
116
|
// ── Preferred Connections ────────────────────────────────────────────
|
|
107
117
|
/** List agents that this agent prefers to collaborate with. */
|
|
108
118
|
getPreferredConnections: (agentId) => this.request("GET", `/v1/agents/${agentId}/preferred-connections`),
|
|
109
119
|
/** Add a preferred agent connection. */
|
|
110
|
-
addPreferredConnection: (agentId, params) => this.request(
|
|
120
|
+
addPreferredConnection: (agentId, params) => this.request(
|
|
121
|
+
"POST",
|
|
122
|
+
`/v1/agents/${agentId}/preferred-connections`,
|
|
123
|
+
params
|
|
124
|
+
),
|
|
111
125
|
/** Remove a preferred agent connection by its record ID. */
|
|
112
126
|
removePreferredConnection: (id) => this.request("DELETE", `/v1/agents/preferred-connections/${id}`),
|
|
113
127
|
// ── Computers ────────────────────────────────────────────────────────
|
|
114
128
|
getComputerConfig: (agentId) => this.request("GET", `/v1/agents/${agentId}/computer/config`),
|
|
115
129
|
updateComputerConfig: (agentId, params) => this.request("PUT", `/v1/agents/${agentId}/computer/config`, params),
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
130
|
+
/** Get the agent's one persistent cloud computer. */
|
|
131
|
+
getComputer: (agentId, _legacyComputerId) => this.request("GET", `/v1/agents/${agentId}/computer`),
|
|
132
|
+
/** Wake the agent's persistent cloud computer, provisioning it if needed. */
|
|
133
|
+
wakeComputer: (agentId, params) => this.request("POST", `/v1/agents/${agentId}/computer/wake`, params),
|
|
134
|
+
/** Sleep the runtime while preserving the computer's durable workspace. */
|
|
135
|
+
sleepComputer: (agentId, params) => this.request("POST", `/v1/agents/${agentId}/computer/sleep`, params),
|
|
136
|
+
/** Replace the runtime without replacing the persistent computer. */
|
|
137
|
+
restartComputer: (agentId, params) => this.request("POST", `/v1/agents/${agentId}/computer/restart`, params),
|
|
138
|
+
resizeComputer: (agentId, params) => this.request("POST", `/v1/agents/${agentId}/computer/resize`, params),
|
|
139
|
+
execComputer: (agentId, params) => this.request("POST", `/v1/agents/${agentId}/computer/exec`, params),
|
|
140
|
+
readComputerFile: (agentId, pathOrLegacyComputerId, legacyPath) => {
|
|
141
|
+
const path = legacyPath ?? pathOrLegacyComputerId;
|
|
142
|
+
return this.request(
|
|
143
|
+
"GET",
|
|
144
|
+
`/v1/agents/${agentId}/computer/files/read?path=${encodeURIComponent(path)}`
|
|
145
|
+
);
|
|
146
|
+
},
|
|
147
|
+
openComputerBrowser: (agentId, paramsOrLegacyComputerId, legacyParams) => {
|
|
148
|
+
const params = typeof paramsOrLegacyComputerId === "string" ? legacyParams : paramsOrLegacyComputerId;
|
|
149
|
+
if (!params) {
|
|
150
|
+
return Promise.reject(new TypeError("Browser options are required."));
|
|
151
|
+
}
|
|
152
|
+
return this.request(
|
|
153
|
+
"POST",
|
|
154
|
+
`/v1/agents/${agentId}/computer/browser/open`,
|
|
155
|
+
params
|
|
156
|
+
);
|
|
157
|
+
},
|
|
158
|
+
listComputerEvents: (agentId, limitOrLegacyComputerId, legacyLimit) => {
|
|
159
|
+
const limit = typeof limitOrLegacyComputerId === "number" ? limitOrLegacyComputerId : legacyLimit;
|
|
160
|
+
return this.request(
|
|
161
|
+
"GET",
|
|
162
|
+
`/v1/agents/${agentId}/computer/events${limit ? `?limit=${limit}` : ""}`
|
|
163
|
+
);
|
|
164
|
+
},
|
|
165
|
+
// ── Deprecated per-instance compatibility ────────────────────────────
|
|
166
|
+
/** @deprecated Use getComputer. The singleton is returned as a one-item list. */
|
|
167
|
+
listComputers: (agentId, _filter) => {
|
|
168
|
+
return this.request(
|
|
169
|
+
"GET",
|
|
170
|
+
`/v1/agents/${agentId}/computer`
|
|
171
|
+
).then(({ data }) => ({
|
|
172
|
+
data: data ? [data] : []
|
|
173
|
+
}));
|
|
174
|
+
},
|
|
175
|
+
/** @deprecated Use wakeComputer. Lifecycle, name, and session are ignored. */
|
|
176
|
+
startComputer: (agentId, params) => this.request(
|
|
177
|
+
"POST",
|
|
178
|
+
`/v1/agents/${agentId}/computer/wake`,
|
|
179
|
+
params?.reason ? { reason: params.reason } : void 0
|
|
180
|
+
),
|
|
181
|
+
/** @deprecated Use getComputer. Computer IDs are ignored. */
|
|
182
|
+
refreshComputer: (agentId, _computerId) => this.request("GET", `/v1/agents/${agentId}/computer`),
|
|
183
|
+
/** @deprecated Use sleepComputer. Computer IDs are ignored. */
|
|
184
|
+
stopComputer: (agentId, _computerId) => this.request("POST", `/v1/agents/${agentId}/computer/sleep`),
|
|
185
|
+
/** @deprecated Use execComputer. Computer IDs are ignored. */
|
|
186
|
+
runComputerCommand: (agentId, paramsOrLegacyComputerId, legacyParams) => {
|
|
187
|
+
const params = typeof paramsOrLegacyComputerId === "string" ? legacyParams : paramsOrLegacyComputerId;
|
|
188
|
+
if (!params) {
|
|
189
|
+
return Promise.reject(new TypeError("Command options are required."));
|
|
190
|
+
}
|
|
191
|
+
return this.request(
|
|
192
|
+
"POST",
|
|
193
|
+
`/v1/agents/${agentId}/computer/exec`,
|
|
194
|
+
params
|
|
195
|
+
);
|
|
122
196
|
},
|
|
123
|
-
startComputer: (agentId, params) => this.request("POST", `/v1/agents/${agentId}/computers`, params),
|
|
124
|
-
getComputer: (agentId, computerId) => this.request("GET", `/v1/agents/${agentId}/computers/${computerId}`),
|
|
125
|
-
refreshComputer: (agentId, computerId) => this.request("POST", `/v1/agents/${agentId}/computers/${computerId}/refresh`),
|
|
126
|
-
stopComputer: (agentId, computerId) => this.request("POST", `/v1/agents/${agentId}/computers/${computerId}/stop`),
|
|
127
|
-
readComputerFile: (agentId, computerId, path) => this.request("GET", `/v1/agents/${agentId}/computers/${computerId}/files/read?path=${encodeURIComponent(path)}`),
|
|
128
|
-
runComputerCommand: (agentId, computerId, params) => this.request("POST", `/v1/agents/${agentId}/computers/${computerId}/commands`, params),
|
|
129
|
-
openComputerBrowser: (agentId, computerId, params) => this.request("POST", `/v1/agents/${agentId}/computers/${computerId}/browser/open`, params),
|
|
130
|
-
listComputerEvents: (agentId, computerId, limit) => this.request("GET", `/v1/agents/${agentId}/computers/${computerId}/events${limit ? `?limit=${limit}` : ""}`),
|
|
131
197
|
// ── TTS Voices ───────────────────────────────────────────────────────
|
|
132
198
|
/**
|
|
133
199
|
* List available TTS voices for a provider.
|
|
@@ -139,7 +205,10 @@ var CommonsClient = class {
|
|
|
139
205
|
if (provider) params.set("provider", provider);
|
|
140
206
|
if (q) params.set("q", q);
|
|
141
207
|
const qs = params.toString();
|
|
142
|
-
return this.request(
|
|
208
|
+
return this.request(
|
|
209
|
+
"GET",
|
|
210
|
+
`/v1/agents/tts/voices${qs ? `?${qs}` : ""}`
|
|
211
|
+
);
|
|
143
212
|
}
|
|
144
213
|
};
|
|
145
214
|
}
|
|
@@ -153,20 +222,42 @@ var CommonsClient = class {
|
|
|
153
222
|
get workflows() {
|
|
154
223
|
return {
|
|
155
224
|
create: (params) => this.request("POST", "/v1/workflows", params),
|
|
156
|
-
list: (ownerId, ownerType) => this.request(
|
|
225
|
+
list: (ownerId, ownerType) => this.request(
|
|
226
|
+
"GET",
|
|
227
|
+
`/v1/workflows?ownerId=${ownerId}&ownerType=${ownerType}`
|
|
228
|
+
),
|
|
157
229
|
get: (workflowId) => this.request("GET", `/v1/workflows/${workflowId}`),
|
|
158
230
|
update: (workflowId, updates) => this.request("PUT", `/v1/workflows/${workflowId}`, updates),
|
|
159
231
|
delete: (workflowId) => this.request("DELETE", `/v1/workflows/${workflowId}`),
|
|
160
232
|
execute: (workflowId, params) => this.request("POST", `/v1/workflows/${workflowId}/execute`, params),
|
|
161
|
-
getExecution: (workflowId, executionId) => this.request(
|
|
162
|
-
|
|
163
|
-
|
|
233
|
+
getExecution: (workflowId, executionId) => this.request(
|
|
234
|
+
"GET",
|
|
235
|
+
`/v1/workflows/${workflowId}/executions/${executionId}`
|
|
236
|
+
),
|
|
237
|
+
listExecutions: (workflowId, limit) => this.request(
|
|
238
|
+
"GET",
|
|
239
|
+
`/v1/workflows/${workflowId}/executions${limit ? `?limit=${limit}` : ""}`
|
|
240
|
+
),
|
|
241
|
+
cancelExecution: (workflowId, executionId) => this.request(
|
|
242
|
+
"POST",
|
|
243
|
+
`/v1/workflows/${workflowId}/executions/${executionId}/cancel`
|
|
244
|
+
),
|
|
164
245
|
/** Approve a paused human_approval node and resume execution. */
|
|
165
|
-
approveExecution: (workflowId, executionId, params) => this.request(
|
|
246
|
+
approveExecution: (workflowId, executionId, params) => this.request(
|
|
247
|
+
"POST",
|
|
248
|
+
`/v1/workflows/${workflowId}/executions/${executionId}/approve`,
|
|
249
|
+
params
|
|
250
|
+
),
|
|
166
251
|
/** Reject a paused human_approval node and terminate execution. */
|
|
167
|
-
rejectExecution: (workflowId, executionId, params) => this.request(
|
|
252
|
+
rejectExecution: (workflowId, executionId, params) => this.request(
|
|
253
|
+
"POST",
|
|
254
|
+
`/v1/workflows/${workflowId}/executions/${executionId}/reject`,
|
|
255
|
+
params
|
|
256
|
+
),
|
|
168
257
|
/** Stream execution progress via SSE. Returns an async generator. */
|
|
169
|
-
stream: (workflowId, executionId) => this._streamSse(
|
|
258
|
+
stream: (workflowId, executionId) => this._streamSse(
|
|
259
|
+
`/v1/workflows/${workflowId}/executions/${executionId}/stream`
|
|
260
|
+
)
|
|
170
261
|
};
|
|
171
262
|
}
|
|
172
263
|
// ── Tasks ─────────────────────────────────────────────────────────────────
|
|
@@ -196,7 +287,10 @@ var CommonsClient = class {
|
|
|
196
287
|
/** List all sessions for a given agent (all initiators). */
|
|
197
288
|
listByAgent: (agentId) => this.request("GET", `/v1/sessions/agent/${agentId}`),
|
|
198
289
|
/** List all sessions for a user across all agents. */
|
|
199
|
-
listByUser: (initiator) => this.request(
|
|
290
|
+
listByUser: (initiator) => this.request(
|
|
291
|
+
"GET",
|
|
292
|
+
`/v1/sessions/user/${encodeURIComponent(initiator)}`
|
|
293
|
+
),
|
|
200
294
|
create: (params) => this.request("POST", "/v1/sessions", params),
|
|
201
295
|
get: (sessionId) => this.request("GET", `/v1/sessions/${sessionId}`),
|
|
202
296
|
/** Get full session with history, tasks, childSessions, and spaces. */
|
|
@@ -218,6 +312,37 @@ var CommonsClient = class {
|
|
|
218
312
|
listStatic: () => this.request("GET", "/v1/tools/static")
|
|
219
313
|
};
|
|
220
314
|
}
|
|
315
|
+
// ── OAuth Connections ─────────────────────────────────────────────────────
|
|
316
|
+
get oauth() {
|
|
317
|
+
return {
|
|
318
|
+
/** List OAuth providers available on the platform (Google Workspace, GitHub, …). */
|
|
319
|
+
listProviders: () => this.request("GET", "/v1/oauth/providers"),
|
|
320
|
+
/** Get one provider's details, including its scope groups. */
|
|
321
|
+
getProvider: (providerKey) => this.request(
|
|
322
|
+
"GET",
|
|
323
|
+
`/v1/oauth/providers/${encodeURIComponent(providerKey)}`
|
|
324
|
+
),
|
|
325
|
+
/**
|
|
326
|
+
* List the caller's OAuth connections (the accounts agents act with).
|
|
327
|
+
* `ownerId` is only needed when authenticating with a management key.
|
|
328
|
+
*/
|
|
329
|
+
listConnections: (params) => {
|
|
330
|
+
const q = params ? new URLSearchParams(params).toString() : "";
|
|
331
|
+
return this.request("GET", `/v1/oauth/connections${q ? `?${q}` : ""}`);
|
|
332
|
+
},
|
|
333
|
+
/**
|
|
334
|
+
* Start an OAuth connect flow. Returns the authorization URL the user
|
|
335
|
+
* must open in a browser to grant access.
|
|
336
|
+
*/
|
|
337
|
+
connect: (params) => this.request("POST", "/v1/oauth/connect", params),
|
|
338
|
+
/** Refresh a connection's access token now. */
|
|
339
|
+
refresh: (connectionId) => this.request("POST", `/v1/oauth/connections/${connectionId}/refresh`),
|
|
340
|
+
/** Check whether a connection's token is valid. */
|
|
341
|
+
test: (connectionId) => this.request("GET", `/v1/oauth/connections/${connectionId}/test`),
|
|
342
|
+
/** Revoke a connection and delete its tokens. */
|
|
343
|
+
revoke: (connectionId) => this.request("DELETE", `/v1/oauth/connections/${connectionId}`)
|
|
344
|
+
};
|
|
345
|
+
}
|
|
221
346
|
// ── Tool Keys ─────────────────────────────────────────────────────────────
|
|
222
347
|
get toolKeys() {
|
|
223
348
|
return {
|
|
@@ -247,7 +372,8 @@ var CommonsClient = class {
|
|
|
247
372
|
const params = new URLSearchParams();
|
|
248
373
|
if (filter?.ownerId) params.set("ownerId", filter.ownerId);
|
|
249
374
|
if (filter?.ownerType) params.set("ownerType", filter.ownerType);
|
|
250
|
-
if (filter?.isPublic !== void 0)
|
|
375
|
+
if (filter?.isPublic !== void 0)
|
|
376
|
+
params.set("isPublic", String(filter.isPublic));
|
|
251
377
|
const qs = params.toString();
|
|
252
378
|
return this.request("GET", `/v1/skills${qs ? `?${qs}` : ""}`);
|
|
253
379
|
},
|
|
@@ -309,7 +435,10 @@ var CommonsClient = class {
|
|
|
309
435
|
create: (params) => this.request("POST", "/v1/auth/api-keys", params),
|
|
310
436
|
/** List all active API keys for a principal (key values not included). */
|
|
311
437
|
list: (principalId, principalType) => {
|
|
312
|
-
const q = new URLSearchParams({
|
|
438
|
+
const q = new URLSearchParams({
|
|
439
|
+
principalId,
|
|
440
|
+
principalType
|
|
441
|
+
}).toString();
|
|
313
442
|
return this.request("GET", `/v1/auth/api-keys?${q}`);
|
|
314
443
|
},
|
|
315
444
|
/** Revoke (soft-delete) an API key by its UUID. */
|
|
@@ -392,7 +521,10 @@ var CommonsClient = class {
|
|
|
392
521
|
params: { id: taskId }
|
|
393
522
|
}).then((r) => r.result),
|
|
394
523
|
/** List recent A2A tasks for an agent. */
|
|
395
|
-
listTasks: (agentId, limit) => this.request(
|
|
524
|
+
listTasks: (agentId, limit) => this.request(
|
|
525
|
+
"GET",
|
|
526
|
+
`/v1/a2a/${agentId}/tasks${limit ? `?limit=${limit}` : ""}`
|
|
527
|
+
),
|
|
396
528
|
/** Stream A2A task updates (SSE). */
|
|
397
529
|
stream: (agentId, taskId) => this._streamSse(`/v1/a2a/${agentId}/tasks/${taskId}/stream`)
|
|
398
530
|
};
|
|
@@ -401,11 +533,18 @@ var CommonsClient = class {
|
|
|
401
533
|
get mcp() {
|
|
402
534
|
return {
|
|
403
535
|
/** List MCP servers for an owner. */
|
|
404
|
-
listServers: (ownerId, ownerType) => this.request(
|
|
536
|
+
listServers: (ownerId, ownerType) => this.request(
|
|
537
|
+
"GET",
|
|
538
|
+
`/v1/mcp/servers?ownerId=${ownerId}&ownerType=${ownerType}`
|
|
539
|
+
),
|
|
405
540
|
/** Create a new MCP server. */
|
|
406
541
|
createServer: (params) => {
|
|
407
542
|
const { ownerId, ownerType, ...dto } = params;
|
|
408
|
-
return this.request(
|
|
543
|
+
return this.request(
|
|
544
|
+
"POST",
|
|
545
|
+
`/v1/mcp/servers?ownerId=${ownerId}&ownerType=${ownerType}`,
|
|
546
|
+
dto
|
|
547
|
+
);
|
|
409
548
|
},
|
|
410
549
|
/** Get MCP server by ID. */
|
|
411
550
|
getServer: (serverId) => this.request("GET", `/v1/mcp/servers/${serverId}`),
|
|
@@ -426,15 +565,25 @@ var CommonsClient = class {
|
|
|
426
565
|
/** List tools discovered from an MCP server. */
|
|
427
566
|
listTools: (serverId) => this.request("GET", `/v1/mcp/servers/${serverId}/tools`),
|
|
428
567
|
/** List all MCP tools across all servers for a given owner. */
|
|
429
|
-
listToolsByOwner: (ownerId, ownerType) => this.request(
|
|
568
|
+
listToolsByOwner: (ownerId, ownerType) => this.request(
|
|
569
|
+
"GET",
|
|
570
|
+
`/v1/mcp/tools?ownerId=${ownerId}&ownerType=${ownerType}`
|
|
571
|
+
),
|
|
430
572
|
/** List resources from an MCP server. */
|
|
431
573
|
listResources: (serverId) => this.request("GET", `/v1/mcp/servers/${serverId}/resources`),
|
|
432
574
|
/** Read a resource by URI. */
|
|
433
|
-
readResource: (serverId, uri) => this.request(
|
|
575
|
+
readResource: (serverId, uri) => this.request(
|
|
576
|
+
"GET",
|
|
577
|
+
`/v1/mcp/servers/${serverId}/resources/read?uri=${encodeURIComponent(uri)}`
|
|
578
|
+
),
|
|
434
579
|
/** List prompts from an MCP server. */
|
|
435
580
|
listPrompts: (serverId) => this.request("GET", `/v1/mcp/servers/${serverId}/prompts`),
|
|
436
581
|
/** Render a prompt with arguments. */
|
|
437
|
-
getPrompt: (serverId, promptName, args) => this.request(
|
|
582
|
+
getPrompt: (serverId, promptName, args) => this.request(
|
|
583
|
+
"POST",
|
|
584
|
+
`/v1/mcp/servers/${serverId}/prompts/${promptName}`,
|
|
585
|
+
{ arguments: args }
|
|
586
|
+
)
|
|
438
587
|
};
|
|
439
588
|
}
|
|
440
589
|
// ── Memory ────────────────────────────────────────────────────────────────
|
|
@@ -446,7 +595,10 @@ var CommonsClient = class {
|
|
|
446
595
|
if (opts?.type) params.set("type", opts.type);
|
|
447
596
|
if (opts?.limit) params.set("limit", String(opts.limit));
|
|
448
597
|
const qs = params.toString();
|
|
449
|
-
return this.request(
|
|
598
|
+
return this.request(
|
|
599
|
+
"GET",
|
|
600
|
+
`/v1/memory/agents/${agentId}${qs ? `?${qs}` : ""}`
|
|
601
|
+
);
|
|
450
602
|
},
|
|
451
603
|
/** Get memory stats for an agent. */
|
|
452
604
|
stats: (agentId) => this.request("GET", `/v1/memory/agents/${agentId}/stats`),
|
|
@@ -454,7 +606,10 @@ var CommonsClient = class {
|
|
|
454
606
|
retrieve: (agentId, query, limit) => {
|
|
455
607
|
const params = new URLSearchParams({ q: query });
|
|
456
608
|
if (limit) params.set("limit", String(limit));
|
|
457
|
-
return this.request(
|
|
609
|
+
return this.request(
|
|
610
|
+
"GET",
|
|
611
|
+
`/v1/memory/agents/${agentId}/retrieve?${params}`
|
|
612
|
+
);
|
|
458
613
|
},
|
|
459
614
|
/** Get a single memory by ID. */
|
|
460
615
|
get: (memoryId) => this.request("GET", `/v1/memory/${memoryId}`),
|
|
@@ -463,7 +618,11 @@ var CommonsClient = class {
|
|
|
463
618
|
/** Update a memory. */
|
|
464
619
|
update: (memoryId, params) => this.request("PATCH", `/v1/memory/${memoryId}`, params),
|
|
465
620
|
/** Soft-delete (deactivate) a memory. */
|
|
466
|
-
delete: (memoryId) => this.request("DELETE", `/v1/memory/${memoryId}`)
|
|
621
|
+
delete: (memoryId) => this.request("DELETE", `/v1/memory/${memoryId}`),
|
|
622
|
+
/** Create an append-only memory scope shared by a set of owned agents. */
|
|
623
|
+
createSharedScope: (params) => this.request("POST", "/v1/memory/shared-scopes", params),
|
|
624
|
+
/** List shared-memory scopes available to an agent. */
|
|
625
|
+
listSharedScopes: (agentId) => this.request("GET", `/v1/memory/shared-scopes/agents/${agentId}`)
|
|
467
626
|
};
|
|
468
627
|
}
|
|
469
628
|
// ── Usage / Observability ─────────────────────────────────────────────────
|
|
@@ -475,7 +634,10 @@ var CommonsClient = class {
|
|
|
475
634
|
if (opts?.from) params.set("from", opts.from);
|
|
476
635
|
if (opts?.to) params.set("to", opts.to);
|
|
477
636
|
const qs = params.toString();
|
|
478
|
-
return this.request(
|
|
637
|
+
return this.request(
|
|
638
|
+
"GET",
|
|
639
|
+
`/v1/usage/agents/${agentId}${qs ? `?${qs}` : ""}`
|
|
640
|
+
);
|
|
479
641
|
},
|
|
480
642
|
/** Get aggregated token + cost usage for a session. */
|
|
481
643
|
getSessionUsage: (sessionId) => this.request("GET", `/v1/usage/sessions/${sessionId}`)
|