@desplega.ai/agent-swarm 1.90.0 → 1.92.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/README.md +2 -1
- package/openapi.json +803 -150
- package/package.json +5 -5
- package/src/artifact-sdk/server.ts +2 -1
- package/src/be/db.ts +337 -1
- package/src/be/memory/providers/sqlite-store.ts +6 -1
- package/src/be/memory/types.ts +1 -0
- package/src/be/migrations/083_script_workflows.sql +51 -0
- package/src/be/modelsdev-cache.json +42352 -38595
- package/src/be/scripts/typecheck.ts +181 -1
- package/src/be/seed-scripts/catalog/compound-insights.ts +398 -0
- package/src/be/seed-scripts/catalog/ops-catalog-audit.ts +911 -0
- package/src/be/seed-scripts/catalog/schedule-health.ts +73 -0
- package/src/be/seed-scripts/catalog/smart-recall.ts +65 -0
- package/src/be/seed-scripts/catalog/task-context-gathering.ts +92 -0
- package/src/be/seed-scripts/catalog/tool-usage.ts +59 -0
- package/src/be/seed-scripts/index.ts +54 -0
- package/src/be/seed-skills/index.ts +7 -0
- package/src/be/swarm-config-guard.ts +17 -0
- package/src/commands/artifact.ts +3 -2
- package/src/commands/profile-sync.ts +310 -0
- package/src/commands/runner.ts +134 -3
- package/src/hooks/hook.ts +32 -9
- package/src/http/db-query.ts +20 -5
- package/src/http/index.ts +57 -0
- package/src/http/integrations.ts +6 -1
- package/src/http/mcp-bridge.ts +117 -0
- package/src/http/mcp-oauth.ts +97 -39
- package/src/http/memory.ts +5 -2
- package/src/http/openapi.ts +2 -2
- package/src/http/pages-public.ts +10 -11
- package/src/http/pages.ts +7 -11
- package/src/http/script-runs.ts +555 -0
- package/src/http/scripts.ts +24 -1
- package/src/http/utils.ts +11 -4
- package/src/jira/app.ts +2 -3
- package/src/jira/webhook-lifecycle.ts +2 -1
- package/src/linear/app.ts +2 -3
- package/src/prompts/session-templates.ts +24 -4
- package/src/providers/claude-adapter.ts +86 -13
- package/src/script-workflows/executor.ts +110 -0
- package/src/script-workflows/harness.ts +73 -0
- package/src/script-workflows/label-lint.ts +51 -0
- package/src/script-workflows/limits.ts +22 -0
- package/src/script-workflows/supervisor.ts +139 -0
- package/src/script-workflows/workflow-ctx.ts +205 -0
- package/src/scripts-runtime/executors/native.ts +1 -0
- package/src/scripts-runtime/sdk-allowlist.ts +124 -0
- package/src/scripts-runtime/swarm-sdk.ts +198 -3
- package/src/scripts-runtime/types/stdlib.d.ts +287 -0
- package/src/scripts-runtime/types/swarm-sdk.d.ts +287 -0
- package/src/server.ts +2 -0
- package/src/slack/handlers.ts +11 -4
- package/src/slack/message-text.ts +98 -0
- package/src/slack/thread-buffer.ts +5 -3
- package/src/tests/claude-adapter-binary.test.ts +147 -4
- package/src/tests/claude-adapter-otel.test.ts +85 -1
- package/src/tests/db-query.test.ts +28 -0
- package/src/tests/error-tracker.test.ts +121 -0
- package/src/tests/harness-provider-resolution.test.ts +33 -0
- package/src/tests/hook-registration-nudge.test.ts +69 -0
- package/src/tests/mcp-oauth-manual-client.test.ts +213 -0
- package/src/tests/mcp-tools.test.ts +6 -0
- package/src/tests/pages-public-html.test.ts +41 -0
- package/src/tests/pages-public-json-redirect.test.ts +37 -2
- package/src/tests/profile-sync.test.ts +282 -0
- package/src/tests/prompt-template-session.test.ts +34 -5
- package/src/tests/script-runs-http.test.ts +278 -0
- package/src/tests/script-workflows-label-lint.test.ts +43 -0
- package/src/tests/script-workflows-runtime-e2e.test.ts +170 -0
- package/src/tests/scripts-mcp-e2e.test.ts +49 -2
- package/src/tests/scripts-runtime.test.ts +33 -0
- package/src/tests/seed-scripts.test.ts +347 -2
- package/src/tests/slack-message-text.test.ts +250 -0
- package/src/tests/system-default-skills.test.ts +40 -0
- package/src/tools/create-metric.ts +2 -3
- package/src/tools/create-page.ts +3 -6
- package/src/tools/db-query.ts +16 -6
- package/src/tools/memory-rate.ts +2 -1
- package/src/tools/memory-search.ts +1 -0
- package/src/tools/register-kapso-number.ts +2 -4
- package/src/tools/request-human-input.ts +2 -1
- package/src/tools/script-common.ts +2 -4
- package/src/tools/script-run.ts +7 -0
- package/src/tools/script-runs.ts +123 -0
- package/src/tools/slack-read.ts +12 -3
- package/src/tools/tool-config.ts +4 -1
- package/src/types.ts +52 -0
- package/src/utils/constants.ts +58 -8
- package/src/utils/error-tracker.ts +40 -1
- package/src/utils/internal-ai/complete-structured.ts +10 -4
- package/src/workflows/executors/raw-llm.ts +76 -59
- package/templates/skills/pages/content.md +205 -55
- package/templates/skills/script-workflows/config.json +14 -0
- package/templates/skills/script-workflows/content.md +68 -0
- package/templates/skills/swarm-scripts/content.md +45 -7
|
@@ -47,6 +47,7 @@ declare module "swarm-sdk" {
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
export interface SwarmSdk {
|
|
50
|
+
// --- memory ---
|
|
50
51
|
memory_search(args: {
|
|
51
52
|
query: string;
|
|
52
53
|
scope?: "all" | "agent" | "swarm";
|
|
@@ -55,9 +56,12 @@ declare module "swarm-sdk" {
|
|
|
55
56
|
}): Promise<unknown>;
|
|
56
57
|
memory_get(args: { memoryId: string }): Promise<unknown>;
|
|
57
58
|
memory_rate(args: { id: string; useful: boolean; note?: string }): Promise<unknown>;
|
|
59
|
+
// --- tasks ---
|
|
58
60
|
task_list(args?: Record<string, unknown>): Promise<unknown>;
|
|
59
61
|
task_get(args: { taskId: string }): Promise<unknown>;
|
|
60
62
|
task_storeProgress(args: Record<string, unknown>): Promise<unknown>;
|
|
63
|
+
task_poll(args?: Record<string, unknown>): Promise<unknown>;
|
|
64
|
+
// --- kv ---
|
|
61
65
|
kv_get(args: { key: string; namespace?: string }): Promise<unknown>;
|
|
62
66
|
kv_set(args: {
|
|
63
67
|
key: string;
|
|
@@ -69,8 +73,11 @@ declare module "swarm-sdk" {
|
|
|
69
73
|
kv_del(args: { key: string; namespace?: string }): Promise<unknown>;
|
|
70
74
|
kv_incr(args: { key: string; by?: number; namespace?: string }): Promise<unknown>;
|
|
71
75
|
kv_list(args?: { prefix?: string; namespace?: string; limit?: number }): Promise<unknown>;
|
|
76
|
+
// --- repos ---
|
|
72
77
|
repo_list(args?: Record<string, unknown>): Promise<unknown>;
|
|
78
|
+
// --- schedules ---
|
|
73
79
|
schedule_list(args?: Record<string, unknown>): Promise<unknown>;
|
|
80
|
+
// --- scripts ---
|
|
74
81
|
script_search(args: { query?: string; scope?: ScriptScope; limit?: number }): Promise<unknown>;
|
|
75
82
|
script_run(args: {
|
|
76
83
|
name?: string;
|
|
@@ -79,7 +86,241 @@ declare module "swarm-sdk" {
|
|
|
79
86
|
intent?: string;
|
|
80
87
|
scope?: ScriptScope;
|
|
81
88
|
fsMode?: ScriptFsMode;
|
|
89
|
+
idempotencyKey?: string;
|
|
82
90
|
}): Promise<unknown>;
|
|
91
|
+
// --- swarm / agent ---
|
|
92
|
+
swarm_get(args?: { includeFull?: boolean }): Promise<unknown>;
|
|
93
|
+
agent_info(args?: Record<string, unknown>): Promise<unknown>;
|
|
94
|
+
metrics_get(args?: Record<string, unknown>): Promise<unknown>;
|
|
95
|
+
user_resolve(args?: {
|
|
96
|
+
kind?: string;
|
|
97
|
+
externalId?: string;
|
|
98
|
+
email?: string;
|
|
99
|
+
userId?: string;
|
|
100
|
+
}): Promise<unknown>;
|
|
101
|
+
db_query(args: { sql: string; params?: unknown[] }): Promise<unknown>;
|
|
102
|
+
// --- config ---
|
|
103
|
+
config_get(args?: {
|
|
104
|
+
agentId?: string;
|
|
105
|
+
repoId?: string;
|
|
106
|
+
key?: string;
|
|
107
|
+
includeSecrets?: boolean;
|
|
108
|
+
}): Promise<unknown>;
|
|
109
|
+
config_list(args?: {
|
|
110
|
+
scope?: "global" | "agent" | "repo";
|
|
111
|
+
scopeId?: string;
|
|
112
|
+
key?: string;
|
|
113
|
+
includeSecrets?: boolean;
|
|
114
|
+
}): Promise<unknown>;
|
|
115
|
+
// --- slack ---
|
|
116
|
+
slack_read(args?: {
|
|
117
|
+
inboxMessageId?: string;
|
|
118
|
+
taskId?: string;
|
|
119
|
+
channelId?: string;
|
|
120
|
+
threadTs?: string;
|
|
121
|
+
limit?: number;
|
|
122
|
+
includeFiles?: boolean;
|
|
123
|
+
}): Promise<unknown>;
|
|
124
|
+
slack_listChannels(args?: {
|
|
125
|
+
types?: Array<"public" | "private" | "dm" | "mpim">;
|
|
126
|
+
limit?: number;
|
|
127
|
+
}): Promise<unknown>;
|
|
128
|
+
// --- messaging ---
|
|
129
|
+
message_read(args?: {
|
|
130
|
+
channel?: string;
|
|
131
|
+
limit?: number;
|
|
132
|
+
since?: string;
|
|
133
|
+
unreadOnly?: boolean;
|
|
134
|
+
mentionsOnly?: boolean;
|
|
135
|
+
markAsRead?: boolean;
|
|
136
|
+
}): Promise<unknown>;
|
|
137
|
+
// --- services ---
|
|
138
|
+
service_list(args?: {
|
|
139
|
+
agentId?: string;
|
|
140
|
+
name?: string;
|
|
141
|
+
status?: "starting" | "healthy" | "unhealthy" | "stopped";
|
|
142
|
+
includeOwn?: boolean;
|
|
143
|
+
}): Promise<unknown>;
|
|
144
|
+
// --- context / profiles ---
|
|
145
|
+
context_history(args?: {
|
|
146
|
+
agentId?: string;
|
|
147
|
+
field?: "soulMd" | "identityMd" | "toolsMd" | "claudeMd" | "setupScript";
|
|
148
|
+
limit?: number;
|
|
149
|
+
}): Promise<unknown>;
|
|
150
|
+
context_diff(args: { versionId: string; compareToVersionId?: string }): Promise<unknown>;
|
|
151
|
+
// --- workflows ---
|
|
152
|
+
workflow_list(args?: { enabled?: boolean; includeFull?: boolean }): Promise<unknown>;
|
|
153
|
+
workflow_get(args: { id: string }): Promise<unknown>;
|
|
154
|
+
workflow_listRuns(args: {
|
|
155
|
+
workflowId: string;
|
|
156
|
+
status?: "running" | "waiting" | "completed" | "failed" | "skipped" | "cancelled";
|
|
157
|
+
}): Promise<unknown>;
|
|
158
|
+
workflow_getRun(args: { id: string }): Promise<unknown>;
|
|
159
|
+
// --- prompt templates ---
|
|
160
|
+
prompt_list(args?: {
|
|
161
|
+
eventType?: string;
|
|
162
|
+
scope?: "global" | "agent" | "repo";
|
|
163
|
+
scopeId?: string;
|
|
164
|
+
isDefault?: boolean;
|
|
165
|
+
}): Promise<unknown>;
|
|
166
|
+
prompt_get(args: { id: string }): Promise<unknown>;
|
|
167
|
+
// --- tracker ---
|
|
168
|
+
tracker_status(args?: Record<string, unknown>): Promise<unknown>;
|
|
169
|
+
tracker_syncStatus(args?: Record<string, unknown>): Promise<unknown>;
|
|
170
|
+
tracker_linkTask(args: {
|
|
171
|
+
taskId: string;
|
|
172
|
+
externalId: string;
|
|
173
|
+
provider?: string;
|
|
174
|
+
}): Promise<unknown>;
|
|
175
|
+
tracker_unlink(args: { taskId: string }): Promise<unknown>;
|
|
176
|
+
tracker_mapAgent(args: {
|
|
177
|
+
agentId: string;
|
|
178
|
+
externalId: string;
|
|
179
|
+
provider?: string;
|
|
180
|
+
}): Promise<unknown>;
|
|
181
|
+
|
|
182
|
+
// --- write: memory ---
|
|
183
|
+
memory_delete(args: { id: string }): Promise<unknown>;
|
|
184
|
+
inject_learning(args: {
|
|
185
|
+
content: string;
|
|
186
|
+
name?: string;
|
|
187
|
+
scope?: "agent" | "swarm";
|
|
188
|
+
source?: string;
|
|
189
|
+
tags?: string[];
|
|
190
|
+
}): Promise<unknown>;
|
|
191
|
+
|
|
192
|
+
// --- write: tasks ---
|
|
193
|
+
task_send(args: Record<string, unknown>): Promise<unknown>;
|
|
194
|
+
task_cancel(args: { taskId: string }): Promise<unknown>;
|
|
195
|
+
task_action(args: Record<string, unknown>): Promise<unknown>;
|
|
196
|
+
|
|
197
|
+
// --- write: config ---
|
|
198
|
+
config_set(args: {
|
|
199
|
+
key: string;
|
|
200
|
+
value: unknown;
|
|
201
|
+
scope?: "global" | "agent" | "repo";
|
|
202
|
+
scopeId?: string;
|
|
203
|
+
isSecret?: boolean;
|
|
204
|
+
}): Promise<unknown>;
|
|
205
|
+
config_delete(args: { id: string }): Promise<unknown>;
|
|
206
|
+
|
|
207
|
+
// --- write: slack ---
|
|
208
|
+
slack_post(args: { channelId: string; message: string; blocks?: unknown }): Promise<unknown>;
|
|
209
|
+
slack_reply(args: {
|
|
210
|
+
channelId?: string;
|
|
211
|
+
threadTs?: string;
|
|
212
|
+
message: string;
|
|
213
|
+
taskId?: string;
|
|
214
|
+
}): Promise<unknown>;
|
|
215
|
+
slack_startThread(args: { channelId: string; message: string }): Promise<unknown>;
|
|
216
|
+
slack_uploadFile(args: Record<string, unknown>): Promise<unknown>;
|
|
217
|
+
slack_downloadFile(args: { url: string }): Promise<unknown>;
|
|
218
|
+
|
|
219
|
+
// --- write: messaging (internal) ---
|
|
220
|
+
message_post(args: { channel?: string; content: string; to?: string }): Promise<unknown>;
|
|
221
|
+
|
|
222
|
+
// --- write: profiles ---
|
|
223
|
+
profile_update(args: Record<string, unknown>): Promise<unknown>;
|
|
224
|
+
|
|
225
|
+
// --- write: services ---
|
|
226
|
+
service_register(args: Record<string, unknown>): Promise<unknown>;
|
|
227
|
+
service_unregister(args: { name: string }): Promise<unknown>;
|
|
228
|
+
service_updateStatus(args: {
|
|
229
|
+
name: string;
|
|
230
|
+
status: "starting" | "healthy" | "unhealthy" | "stopped";
|
|
231
|
+
}): Promise<unknown>;
|
|
232
|
+
|
|
233
|
+
// --- write: schedules ---
|
|
234
|
+
schedule_create(args: Record<string, unknown>): Promise<unknown>;
|
|
235
|
+
schedule_update(args: Record<string, unknown>): Promise<unknown>;
|
|
236
|
+
schedule_delete(args: { id: string }): Promise<unknown>;
|
|
237
|
+
schedule_runNow(args: { id: string }): Promise<unknown>;
|
|
238
|
+
|
|
239
|
+
// --- write: workflows ---
|
|
240
|
+
workflow_create(args: Record<string, unknown>): Promise<unknown>;
|
|
241
|
+
workflow_update(args: Record<string, unknown>): Promise<unknown>;
|
|
242
|
+
workflow_patch(args: Record<string, unknown>): Promise<unknown>;
|
|
243
|
+
workflow_patchNode(args: Record<string, unknown>): Promise<unknown>;
|
|
244
|
+
workflow_delete(args: { id: string }): Promise<unknown>;
|
|
245
|
+
workflow_trigger(args: { id: string; input?: Record<string, unknown> }): Promise<unknown>;
|
|
246
|
+
workflow_retryRun(args: { id: string }): Promise<unknown>;
|
|
247
|
+
workflow_cancelRun(args: { id: string }): Promise<unknown>;
|
|
248
|
+
|
|
249
|
+
// --- write: prompt templates ---
|
|
250
|
+
prompt_set(args: Record<string, unknown>): Promise<unknown>;
|
|
251
|
+
prompt_delete(args: { id: string }): Promise<unknown>;
|
|
252
|
+
prompt_preview(args: Record<string, unknown>): Promise<unknown>;
|
|
253
|
+
|
|
254
|
+
// --- write: scripts ---
|
|
255
|
+
script_upsert(args: {
|
|
256
|
+
name: string;
|
|
257
|
+
source: string;
|
|
258
|
+
description?: string;
|
|
259
|
+
intent?: string;
|
|
260
|
+
scope?: ScriptScope;
|
|
261
|
+
fsMode?: ScriptFsMode;
|
|
262
|
+
}): Promise<unknown>;
|
|
263
|
+
script_delete(args: { name: string; scope?: ScriptScope }): Promise<unknown>;
|
|
264
|
+
script_queryTypes(args: { name: string; scope?: ScriptScope }): Promise<unknown>;
|
|
265
|
+
script_launchRun(args: {
|
|
266
|
+
source: string;
|
|
267
|
+
args?: unknown;
|
|
268
|
+
idempotencyKey?: string;
|
|
269
|
+
scriptName?: string;
|
|
270
|
+
requestedByUserId?: string;
|
|
271
|
+
}): Promise<unknown>;
|
|
272
|
+
script_getRun(args: { id: string }): Promise<unknown>;
|
|
273
|
+
script_listRuns(args?: {
|
|
274
|
+
status?: "running" | "paused" | "completed" | "failed" | "cancelled" | "aborted_limit";
|
|
275
|
+
agentId?: string;
|
|
276
|
+
limit?: number;
|
|
277
|
+
offset?: number;
|
|
278
|
+
}): Promise<unknown>;
|
|
279
|
+
|
|
280
|
+
// --- write: repos ---
|
|
281
|
+
repo_update(args: Record<string, unknown>): Promise<unknown>;
|
|
282
|
+
|
|
283
|
+
// --- write: agent ---
|
|
284
|
+
agent_join(args: {
|
|
285
|
+
name: string;
|
|
286
|
+
role?: string;
|
|
287
|
+
description?: string;
|
|
288
|
+
capabilities?: string[];
|
|
289
|
+
requestedId?: string;
|
|
290
|
+
lead?: boolean;
|
|
291
|
+
}): Promise<unknown>;
|
|
292
|
+
user_manage(args: Record<string, unknown>): Promise<unknown>;
|
|
293
|
+
|
|
294
|
+
// --- skills ---
|
|
295
|
+
skill_list(args?: {
|
|
296
|
+
scope?: string;
|
|
297
|
+
scopeId?: string;
|
|
298
|
+
includeBuiltin?: boolean;
|
|
299
|
+
}): Promise<unknown>;
|
|
300
|
+
skill_get(args: { id: string }): Promise<unknown>;
|
|
301
|
+
skill_search(args: { query: string; limit?: number }): Promise<unknown>;
|
|
302
|
+
skill_create(args: Record<string, unknown>): Promise<unknown>;
|
|
303
|
+
skill_update(args: Record<string, unknown>): Promise<unknown>;
|
|
304
|
+
skill_delete(args: { id: string }): Promise<unknown>;
|
|
305
|
+
skill_install(args: Record<string, unknown>): Promise<unknown>;
|
|
306
|
+
skill_uninstall(args: Record<string, unknown>): Promise<unknown>;
|
|
307
|
+
skill_publish(args: Record<string, unknown>): Promise<unknown>;
|
|
308
|
+
|
|
309
|
+
// --- mcp servers ---
|
|
310
|
+
mcpServer_list(args?: Record<string, unknown>): Promise<unknown>;
|
|
311
|
+
mcpServer_get(args: { id: string }): Promise<unknown>;
|
|
312
|
+
mcpServer_create(args: Record<string, unknown>): Promise<unknown>;
|
|
313
|
+
mcpServer_update(args: Record<string, unknown>): Promise<unknown>;
|
|
314
|
+
mcpServer_delete(args: { id: string }): Promise<unknown>;
|
|
315
|
+
mcpServer_install(args: Record<string, unknown>): Promise<unknown>;
|
|
316
|
+
mcpServer_uninstall(args: Record<string, unknown>): Promise<unknown>;
|
|
317
|
+
|
|
318
|
+
// --- pages & metrics ---
|
|
319
|
+
page_create(args: Record<string, unknown>): Promise<unknown>;
|
|
320
|
+
metric_create(args: Record<string, unknown>): Promise<unknown>;
|
|
321
|
+
|
|
322
|
+
// --- human input ---
|
|
323
|
+
request_humanInput(args: Record<string, unknown>): Promise<unknown>;
|
|
83
324
|
}
|
|
84
325
|
|
|
85
326
|
export interface ScriptStdlib {
|
|
@@ -93,7 +334,53 @@ declare module "swarm-sdk" {
|
|
|
93
334
|
|
|
94
335
|
export interface ScriptLogger extends Console {}
|
|
95
336
|
|
|
337
|
+
export interface ScriptRunContext {
|
|
338
|
+
id: string;
|
|
339
|
+
agentId: string;
|
|
340
|
+
args: unknown;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
export interface ScriptWorkflowSteps {
|
|
344
|
+
rawLlm(
|
|
345
|
+
label: string,
|
|
346
|
+
config: { prompt: string; model?: string; schema?: Record<string, unknown> },
|
|
347
|
+
): Promise<unknown>;
|
|
348
|
+
agentTask(
|
|
349
|
+
label: string,
|
|
350
|
+
config: {
|
|
351
|
+
template?: string;
|
|
352
|
+
task?: string;
|
|
353
|
+
agentId?: string;
|
|
354
|
+
tags?: string[];
|
|
355
|
+
priority?: number;
|
|
356
|
+
offerMode?: boolean;
|
|
357
|
+
dir?: string;
|
|
358
|
+
vcsRepo?: string;
|
|
359
|
+
model?: string;
|
|
360
|
+
parentTaskId?: string;
|
|
361
|
+
requestedByUserId?: string;
|
|
362
|
+
outputSchema?: Record<string, unknown>;
|
|
363
|
+
},
|
|
364
|
+
): Promise<unknown>;
|
|
365
|
+
swarmScript(
|
|
366
|
+
label: string,
|
|
367
|
+
config: {
|
|
368
|
+
name?: string;
|
|
369
|
+
scriptName?: string;
|
|
370
|
+
source?: string;
|
|
371
|
+
args?: unknown;
|
|
372
|
+
scope?: ScriptScope;
|
|
373
|
+
fsMode?: ScriptFsMode;
|
|
374
|
+
intent?: string;
|
|
375
|
+
idempotencyKey?: string;
|
|
376
|
+
},
|
|
377
|
+
): Promise<unknown>;
|
|
378
|
+
humanInTheLoop(): Promise<never>;
|
|
379
|
+
}
|
|
380
|
+
|
|
96
381
|
export interface ScriptContext {
|
|
382
|
+
run?: ScriptRunContext;
|
|
383
|
+
step?: ScriptWorkflowSteps;
|
|
97
384
|
swarm: SwarmSdk & { config: SwarmConfig };
|
|
98
385
|
stdlib: ScriptStdlib;
|
|
99
386
|
logger: ScriptLogger;
|
|
@@ -29,6 +29,7 @@ declare module "swarm-sdk" {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
export interface SwarmSdk {
|
|
32
|
+
// --- memory ---
|
|
32
33
|
memory_search(args: {
|
|
33
34
|
query: string;
|
|
34
35
|
scope?: "all" | "agent" | "swarm";
|
|
@@ -37,9 +38,12 @@ declare module "swarm-sdk" {
|
|
|
37
38
|
}): Promise<unknown>;
|
|
38
39
|
memory_get(args: { memoryId: string }): Promise<unknown>;
|
|
39
40
|
memory_rate(args: { id: string; useful: boolean; note?: string }): Promise<unknown>;
|
|
41
|
+
// --- tasks ---
|
|
40
42
|
task_list(args?: Record<string, unknown>): Promise<unknown>;
|
|
41
43
|
task_get(args: { taskId: string }): Promise<unknown>;
|
|
42
44
|
task_storeProgress(args: Record<string, unknown>): Promise<unknown>;
|
|
45
|
+
task_poll(args?: Record<string, unknown>): Promise<unknown>;
|
|
46
|
+
// --- kv ---
|
|
43
47
|
kv_get(args: { key: string; namespace?: string }): Promise<unknown>;
|
|
44
48
|
kv_set(args: {
|
|
45
49
|
key: string;
|
|
@@ -51,8 +55,11 @@ declare module "swarm-sdk" {
|
|
|
51
55
|
kv_del(args: { key: string; namespace?: string }): Promise<unknown>;
|
|
52
56
|
kv_incr(args: { key: string; by?: number; namespace?: string }): Promise<unknown>;
|
|
53
57
|
kv_list(args?: { prefix?: string; namespace?: string; limit?: number }): Promise<unknown>;
|
|
58
|
+
// --- repos ---
|
|
54
59
|
repo_list(args?: Record<string, unknown>): Promise<unknown>;
|
|
60
|
+
// --- schedules ---
|
|
55
61
|
schedule_list(args?: Record<string, unknown>): Promise<unknown>;
|
|
62
|
+
// --- scripts ---
|
|
56
63
|
script_search(args: { query?: string; scope?: ScriptScope; limit?: number }): Promise<unknown>;
|
|
57
64
|
script_run(args: {
|
|
58
65
|
name?: string;
|
|
@@ -61,7 +68,241 @@ declare module "swarm-sdk" {
|
|
|
61
68
|
intent?: string;
|
|
62
69
|
scope?: ScriptScope;
|
|
63
70
|
fsMode?: ScriptFsMode;
|
|
71
|
+
idempotencyKey?: string;
|
|
64
72
|
}): Promise<unknown>;
|
|
73
|
+
// --- swarm / agent ---
|
|
74
|
+
swarm_get(args?: { includeFull?: boolean }): Promise<unknown>;
|
|
75
|
+
agent_info(args?: Record<string, unknown>): Promise<unknown>;
|
|
76
|
+
metrics_get(args?: Record<string, unknown>): Promise<unknown>;
|
|
77
|
+
user_resolve(args?: {
|
|
78
|
+
kind?: string;
|
|
79
|
+
externalId?: string;
|
|
80
|
+
email?: string;
|
|
81
|
+
userId?: string;
|
|
82
|
+
}): Promise<unknown>;
|
|
83
|
+
db_query(args: { sql: string; params?: unknown[] }): Promise<unknown>;
|
|
84
|
+
// --- config ---
|
|
85
|
+
config_get(args?: {
|
|
86
|
+
agentId?: string;
|
|
87
|
+
repoId?: string;
|
|
88
|
+
key?: string;
|
|
89
|
+
includeSecrets?: boolean;
|
|
90
|
+
}): Promise<unknown>;
|
|
91
|
+
config_list(args?: {
|
|
92
|
+
scope?: "global" | "agent" | "repo";
|
|
93
|
+
scopeId?: string;
|
|
94
|
+
key?: string;
|
|
95
|
+
includeSecrets?: boolean;
|
|
96
|
+
}): Promise<unknown>;
|
|
97
|
+
// --- slack ---
|
|
98
|
+
slack_read(args?: {
|
|
99
|
+
inboxMessageId?: string;
|
|
100
|
+
taskId?: string;
|
|
101
|
+
channelId?: string;
|
|
102
|
+
threadTs?: string;
|
|
103
|
+
limit?: number;
|
|
104
|
+
includeFiles?: boolean;
|
|
105
|
+
}): Promise<unknown>;
|
|
106
|
+
slack_listChannels(args?: {
|
|
107
|
+
types?: Array<"public" | "private" | "dm" | "mpim">;
|
|
108
|
+
limit?: number;
|
|
109
|
+
}): Promise<unknown>;
|
|
110
|
+
// --- messaging ---
|
|
111
|
+
message_read(args?: {
|
|
112
|
+
channel?: string;
|
|
113
|
+
limit?: number;
|
|
114
|
+
since?: string;
|
|
115
|
+
unreadOnly?: boolean;
|
|
116
|
+
mentionsOnly?: boolean;
|
|
117
|
+
markAsRead?: boolean;
|
|
118
|
+
}): Promise<unknown>;
|
|
119
|
+
// --- services ---
|
|
120
|
+
service_list(args?: {
|
|
121
|
+
agentId?: string;
|
|
122
|
+
name?: string;
|
|
123
|
+
status?: "starting" | "healthy" | "unhealthy" | "stopped";
|
|
124
|
+
includeOwn?: boolean;
|
|
125
|
+
}): Promise<unknown>;
|
|
126
|
+
// --- context / profiles ---
|
|
127
|
+
context_history(args?: {
|
|
128
|
+
agentId?: string;
|
|
129
|
+
field?: "soulMd" | "identityMd" | "toolsMd" | "claudeMd" | "setupScript";
|
|
130
|
+
limit?: number;
|
|
131
|
+
}): Promise<unknown>;
|
|
132
|
+
context_diff(args: { versionId: string; compareToVersionId?: string }): Promise<unknown>;
|
|
133
|
+
// --- workflows ---
|
|
134
|
+
workflow_list(args?: { enabled?: boolean; includeFull?: boolean }): Promise<unknown>;
|
|
135
|
+
workflow_get(args: { id: string }): Promise<unknown>;
|
|
136
|
+
workflow_listRuns(args: {
|
|
137
|
+
workflowId: string;
|
|
138
|
+
status?: "running" | "waiting" | "completed" | "failed" | "skipped" | "cancelled";
|
|
139
|
+
}): Promise<unknown>;
|
|
140
|
+
workflow_getRun(args: { id: string }): Promise<unknown>;
|
|
141
|
+
// --- prompt templates ---
|
|
142
|
+
prompt_list(args?: {
|
|
143
|
+
eventType?: string;
|
|
144
|
+
scope?: "global" | "agent" | "repo";
|
|
145
|
+
scopeId?: string;
|
|
146
|
+
isDefault?: boolean;
|
|
147
|
+
}): Promise<unknown>;
|
|
148
|
+
prompt_get(args: { id: string }): Promise<unknown>;
|
|
149
|
+
// --- tracker ---
|
|
150
|
+
tracker_status(args?: Record<string, unknown>): Promise<unknown>;
|
|
151
|
+
tracker_syncStatus(args?: Record<string, unknown>): Promise<unknown>;
|
|
152
|
+
tracker_linkTask(args: {
|
|
153
|
+
taskId: string;
|
|
154
|
+
externalId: string;
|
|
155
|
+
provider?: string;
|
|
156
|
+
}): Promise<unknown>;
|
|
157
|
+
tracker_unlink(args: { taskId: string }): Promise<unknown>;
|
|
158
|
+
tracker_mapAgent(args: {
|
|
159
|
+
agentId: string;
|
|
160
|
+
externalId: string;
|
|
161
|
+
provider?: string;
|
|
162
|
+
}): Promise<unknown>;
|
|
163
|
+
|
|
164
|
+
// --- write: memory ---
|
|
165
|
+
memory_delete(args: { id: string }): Promise<unknown>;
|
|
166
|
+
inject_learning(args: {
|
|
167
|
+
content: string;
|
|
168
|
+
name?: string;
|
|
169
|
+
scope?: "agent" | "swarm";
|
|
170
|
+
source?: string;
|
|
171
|
+
tags?: string[];
|
|
172
|
+
}): Promise<unknown>;
|
|
173
|
+
|
|
174
|
+
// --- write: tasks ---
|
|
175
|
+
task_send(args: Record<string, unknown>): Promise<unknown>;
|
|
176
|
+
task_cancel(args: { taskId: string }): Promise<unknown>;
|
|
177
|
+
task_action(args: Record<string, unknown>): Promise<unknown>;
|
|
178
|
+
|
|
179
|
+
// --- write: config ---
|
|
180
|
+
config_set(args: {
|
|
181
|
+
key: string;
|
|
182
|
+
value: unknown;
|
|
183
|
+
scope?: "global" | "agent" | "repo";
|
|
184
|
+
scopeId?: string;
|
|
185
|
+
isSecret?: boolean;
|
|
186
|
+
}): Promise<unknown>;
|
|
187
|
+
config_delete(args: { id: string }): Promise<unknown>;
|
|
188
|
+
|
|
189
|
+
// --- write: slack ---
|
|
190
|
+
slack_post(args: { channelId: string; message: string; blocks?: unknown }): Promise<unknown>;
|
|
191
|
+
slack_reply(args: {
|
|
192
|
+
channelId?: string;
|
|
193
|
+
threadTs?: string;
|
|
194
|
+
message: string;
|
|
195
|
+
taskId?: string;
|
|
196
|
+
}): Promise<unknown>;
|
|
197
|
+
slack_startThread(args: { channelId: string; message: string }): Promise<unknown>;
|
|
198
|
+
slack_uploadFile(args: Record<string, unknown>): Promise<unknown>;
|
|
199
|
+
slack_downloadFile(args: { url: string }): Promise<unknown>;
|
|
200
|
+
|
|
201
|
+
// --- write: messaging (internal) ---
|
|
202
|
+
message_post(args: { channel?: string; content: string; to?: string }): Promise<unknown>;
|
|
203
|
+
|
|
204
|
+
// --- write: profiles ---
|
|
205
|
+
profile_update(args: Record<string, unknown>): Promise<unknown>;
|
|
206
|
+
|
|
207
|
+
// --- write: services ---
|
|
208
|
+
service_register(args: Record<string, unknown>): Promise<unknown>;
|
|
209
|
+
service_unregister(args: { name: string }): Promise<unknown>;
|
|
210
|
+
service_updateStatus(args: {
|
|
211
|
+
name: string;
|
|
212
|
+
status: "starting" | "healthy" | "unhealthy" | "stopped";
|
|
213
|
+
}): Promise<unknown>;
|
|
214
|
+
|
|
215
|
+
// --- write: schedules ---
|
|
216
|
+
schedule_create(args: Record<string, unknown>): Promise<unknown>;
|
|
217
|
+
schedule_update(args: Record<string, unknown>): Promise<unknown>;
|
|
218
|
+
schedule_delete(args: { id: string }): Promise<unknown>;
|
|
219
|
+
schedule_runNow(args: { id: string }): Promise<unknown>;
|
|
220
|
+
|
|
221
|
+
// --- write: workflows ---
|
|
222
|
+
workflow_create(args: Record<string, unknown>): Promise<unknown>;
|
|
223
|
+
workflow_update(args: Record<string, unknown>): Promise<unknown>;
|
|
224
|
+
workflow_patch(args: Record<string, unknown>): Promise<unknown>;
|
|
225
|
+
workflow_patchNode(args: Record<string, unknown>): Promise<unknown>;
|
|
226
|
+
workflow_delete(args: { id: string }): Promise<unknown>;
|
|
227
|
+
workflow_trigger(args: { id: string; input?: Record<string, unknown> }): Promise<unknown>;
|
|
228
|
+
workflow_retryRun(args: { id: string }): Promise<unknown>;
|
|
229
|
+
workflow_cancelRun(args: { id: string }): Promise<unknown>;
|
|
230
|
+
|
|
231
|
+
// --- write: prompt templates ---
|
|
232
|
+
prompt_set(args: Record<string, unknown>): Promise<unknown>;
|
|
233
|
+
prompt_delete(args: { id: string }): Promise<unknown>;
|
|
234
|
+
prompt_preview(args: Record<string, unknown>): Promise<unknown>;
|
|
235
|
+
|
|
236
|
+
// --- write: scripts ---
|
|
237
|
+
script_upsert(args: {
|
|
238
|
+
name: string;
|
|
239
|
+
source: string;
|
|
240
|
+
description?: string;
|
|
241
|
+
intent?: string;
|
|
242
|
+
scope?: ScriptScope;
|
|
243
|
+
fsMode?: ScriptFsMode;
|
|
244
|
+
}): Promise<unknown>;
|
|
245
|
+
script_delete(args: { name: string; scope?: ScriptScope }): Promise<unknown>;
|
|
246
|
+
script_queryTypes(args: { name: string; scope?: ScriptScope }): Promise<unknown>;
|
|
247
|
+
script_launchRun(args: {
|
|
248
|
+
source: string;
|
|
249
|
+
args?: unknown;
|
|
250
|
+
idempotencyKey?: string;
|
|
251
|
+
scriptName?: string;
|
|
252
|
+
requestedByUserId?: string;
|
|
253
|
+
}): Promise<unknown>;
|
|
254
|
+
script_getRun(args: { id: string }): Promise<unknown>;
|
|
255
|
+
script_listRuns(args?: {
|
|
256
|
+
status?: "running" | "paused" | "completed" | "failed" | "cancelled" | "aborted_limit";
|
|
257
|
+
agentId?: string;
|
|
258
|
+
limit?: number;
|
|
259
|
+
offset?: number;
|
|
260
|
+
}): Promise<unknown>;
|
|
261
|
+
|
|
262
|
+
// --- write: repos ---
|
|
263
|
+
repo_update(args: Record<string, unknown>): Promise<unknown>;
|
|
264
|
+
|
|
265
|
+
// --- write: agent ---
|
|
266
|
+
agent_join(args: {
|
|
267
|
+
name: string;
|
|
268
|
+
role?: string;
|
|
269
|
+
description?: string;
|
|
270
|
+
capabilities?: string[];
|
|
271
|
+
requestedId?: string;
|
|
272
|
+
lead?: boolean;
|
|
273
|
+
}): Promise<unknown>;
|
|
274
|
+
user_manage(args: Record<string, unknown>): Promise<unknown>;
|
|
275
|
+
|
|
276
|
+
// --- skills ---
|
|
277
|
+
skill_list(args?: {
|
|
278
|
+
scope?: string;
|
|
279
|
+
scopeId?: string;
|
|
280
|
+
includeBuiltin?: boolean;
|
|
281
|
+
}): Promise<unknown>;
|
|
282
|
+
skill_get(args: { id: string }): Promise<unknown>;
|
|
283
|
+
skill_search(args: { query: string; limit?: number }): Promise<unknown>;
|
|
284
|
+
skill_create(args: Record<string, unknown>): Promise<unknown>;
|
|
285
|
+
skill_update(args: Record<string, unknown>): Promise<unknown>;
|
|
286
|
+
skill_delete(args: { id: string }): Promise<unknown>;
|
|
287
|
+
skill_install(args: Record<string, unknown>): Promise<unknown>;
|
|
288
|
+
skill_uninstall(args: Record<string, unknown>): Promise<unknown>;
|
|
289
|
+
skill_publish(args: Record<string, unknown>): Promise<unknown>;
|
|
290
|
+
|
|
291
|
+
// --- mcp servers ---
|
|
292
|
+
mcpServer_list(args?: Record<string, unknown>): Promise<unknown>;
|
|
293
|
+
mcpServer_get(args: { id: string }): Promise<unknown>;
|
|
294
|
+
mcpServer_create(args: Record<string, unknown>): Promise<unknown>;
|
|
295
|
+
mcpServer_update(args: Record<string, unknown>): Promise<unknown>;
|
|
296
|
+
mcpServer_delete(args: { id: string }): Promise<unknown>;
|
|
297
|
+
mcpServer_install(args: Record<string, unknown>): Promise<unknown>;
|
|
298
|
+
mcpServer_uninstall(args: Record<string, unknown>): Promise<unknown>;
|
|
299
|
+
|
|
300
|
+
// --- pages & metrics ---
|
|
301
|
+
page_create(args: Record<string, unknown>): Promise<unknown>;
|
|
302
|
+
metric_create(args: Record<string, unknown>): Promise<unknown>;
|
|
303
|
+
|
|
304
|
+
// --- human input ---
|
|
305
|
+
request_humanInput(args: Record<string, unknown>): Promise<unknown>;
|
|
65
306
|
}
|
|
66
307
|
|
|
67
308
|
export interface ScriptStdlib {
|
|
@@ -75,7 +316,53 @@ declare module "swarm-sdk" {
|
|
|
75
316
|
|
|
76
317
|
export interface ScriptLogger extends Console {}
|
|
77
318
|
|
|
319
|
+
export interface ScriptRunContext {
|
|
320
|
+
id: string;
|
|
321
|
+
agentId: string;
|
|
322
|
+
args: unknown;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
export interface ScriptWorkflowSteps {
|
|
326
|
+
rawLlm(
|
|
327
|
+
label: string,
|
|
328
|
+
config: { prompt: string; model?: string; schema?: Record<string, unknown> },
|
|
329
|
+
): Promise<unknown>;
|
|
330
|
+
agentTask(
|
|
331
|
+
label: string,
|
|
332
|
+
config: {
|
|
333
|
+
template?: string;
|
|
334
|
+
task?: string;
|
|
335
|
+
agentId?: string;
|
|
336
|
+
tags?: string[];
|
|
337
|
+
priority?: number;
|
|
338
|
+
offerMode?: boolean;
|
|
339
|
+
dir?: string;
|
|
340
|
+
vcsRepo?: string;
|
|
341
|
+
model?: string;
|
|
342
|
+
parentTaskId?: string;
|
|
343
|
+
requestedByUserId?: string;
|
|
344
|
+
outputSchema?: Record<string, unknown>;
|
|
345
|
+
},
|
|
346
|
+
): Promise<unknown>;
|
|
347
|
+
swarmScript(
|
|
348
|
+
label: string,
|
|
349
|
+
config: {
|
|
350
|
+
name?: string;
|
|
351
|
+
scriptName?: string;
|
|
352
|
+
source?: string;
|
|
353
|
+
args?: unknown;
|
|
354
|
+
scope?: ScriptScope;
|
|
355
|
+
fsMode?: ScriptFsMode;
|
|
356
|
+
intent?: string;
|
|
357
|
+
idempotencyKey?: string;
|
|
358
|
+
},
|
|
359
|
+
): Promise<unknown>;
|
|
360
|
+
humanInTheLoop(): Promise<never>;
|
|
361
|
+
}
|
|
362
|
+
|
|
78
363
|
export interface ScriptContext {
|
|
364
|
+
run?: ScriptRunContext;
|
|
365
|
+
step?: ScriptWorkflowSteps;
|
|
79
366
|
swarm: SwarmSdk & { config: SwarmConfig };
|
|
80
367
|
stdlib: ScriptStdlib;
|
|
81
368
|
logger: ScriptLogger;
|
package/src/server.ts
CHANGED
|
@@ -78,6 +78,7 @@ import {
|
|
|
78
78
|
import { registerScriptDeleteTool } from "./tools/script-delete";
|
|
79
79
|
import { registerScriptQueryTypesTool } from "./tools/script-query-types";
|
|
80
80
|
import { registerScriptRunTool } from "./tools/script-run";
|
|
81
|
+
import { registerScriptRunsTools } from "./tools/script-runs";
|
|
81
82
|
import { registerScriptSearchTool } from "./tools/script-search";
|
|
82
83
|
import { registerScriptUpsertTool } from "./tools/script-upsert";
|
|
83
84
|
import { registerSendTaskTool } from "./tools/send-task";
|
|
@@ -227,6 +228,7 @@ export function createServer() {
|
|
|
227
228
|
registerScriptUpsertTool(server);
|
|
228
229
|
registerScriptDeleteTool(server);
|
|
229
230
|
registerScriptQueryTypesTool(server);
|
|
231
|
+
registerScriptRunsTools(server);
|
|
230
232
|
|
|
231
233
|
// External command routes - mirrors the `agent-swarm x ...` CLI surface.
|
|
232
234
|
registerSwarmXTool(server);
|