@desplega.ai/agent-swarm 1.146.0 → 1.147.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 +1 -1
- package/dist/{acp-adapter-jnq4612m.js → acp-adapter-9n319wqc.js} +42 -4
- package/dist/{actions-s41xcn3f.js → actions-2vxqvpr9.js} +9 -8
- package/dist/{app-j8bfw3f6.js → app-w066xfy0.js} +6 -5
- package/dist/assistant-kt31dj2h.js +236 -0
- package/dist/{boot-reembed-jxdz46jp.js → boot-reembed-az5rassp.js} +7 -6
- package/dist/{boot-reembed-x1476agm.js → boot-reembed-j3mm3rfz.js} +8 -7
- package/dist/{boot-scrub-logs-rab9h5bt.js → boot-scrub-logs-b6h54817.js} +4 -4
- package/dist/{claude-adapter-ep6qekbm.js → claude-adapter-w1z04ann.js} +8 -6
- package/dist/{claude-managed-setup-w619jncn.js → claude-managed-setup-f5pmsyrp.js} +24 -3
- package/dist/{claude-sdk-session-0wp3qrcy.js → claude-sdk-session-f0cc1kec.js} +8 -6
- package/dist/{cli-bafd6xnf.js → cli-0b6y7kxm.js} +1 -1
- package/dist/{cli-jyy3e193.js → cli-12fz972k.js} +4 -4
- package/dist/{cli-pzfc7j7g.js → cli-1th1728g.js} +2 -2
- package/dist/{cli-68h2mfrn.js → cli-3tgwnf43.js} +3 -3
- package/dist/{cli-q3qr220d.js → cli-4nr988h6.js} +1 -1
- package/dist/{cli-m4xsy03s.js → cli-53s590z8.js} +1 -1
- package/dist/{cli-c8q7292f.js → cli-54wwve05.js} +5 -4
- package/dist/{cli-rymrjneb.js → cli-719k9j2c.js} +2 -2
- package/dist/{cli-zn65x0w8.js → cli-89xfd7f9.js} +21 -47
- package/dist/{cli-506z6jqa.js → cli-8v0g1yc8.js} +1 -1
- package/dist/cli-9d8ntetj.js +42 -0
- package/dist/{cli-dhg6j8h3.js → cli-atcve9y8.js} +826 -737
- package/dist/{cli-46yck6nj.js → cli-b5bq9crk.js} +14 -31
- package/dist/cli-d8brzxjb.js +190 -0
- package/dist/{cli-a960nkfb.js → cli-de14znh8.js} +2 -2
- package/dist/{cli-s8sbe32s.js → cli-dttph1bw.js} +2 -2
- package/dist/cli-ep19k3mb.js +19 -0
- package/dist/{cli-d9pnxgth.js → cli-f146mn5s.js} +7 -50
- package/dist/{cli-qar1f940.js → cli-f7dsy61y.js} +5 -3
- package/dist/{cli-d4xqde2b.js → cli-ftht3zzj.js} +2780 -2587
- package/dist/{cli-pmwbdw36.js → cli-hbv0kq6w.js} +2 -2
- package/dist/{cli-fhsz3twr.js → cli-jsp14b6c.js} +171 -1
- package/dist/{cli-2zvtzevh.js → cli-kpv03zhj.js} +13 -11
- package/dist/{cli-a9bn9svs.js → cli-m8yrsg97.js} +2 -2
- package/dist/cli-m9sxbkhm.js +779 -0
- package/dist/cli-mmemxxdc.js +823 -0
- package/dist/{cli-6xwhtc64.js → cli-n8508nre.js} +1 -1
- package/dist/{cli-q0qq1sxw.js → cli-p1d5b073.js} +37 -2
- package/dist/{cli-yqeb27t1.js → cli-rw51bq3j.js} +13 -10
- package/dist/{cli-zww3vcnm.js → cli-smby5m17.js} +7 -6
- package/dist/{cli-ah5hjk49.js → cli-tzvk9haz.js} +94 -372
- package/dist/{cli-yxwe913z.js → cli-w9kb3bk1.js} +1 -1
- package/dist/{cli-skd674mt.js → cli-y6b6fb76.js} +25 -3
- package/dist/{cli-3k2g3kg2.js → cli-yz3djrm0.js} +9 -9
- package/dist/{cli-4secrq32.js → cli-zhjmqxzh.js} +1 -1
- package/dist/cli.js +13 -13
- package/dist/{codex-adapter-d6qajxj3.js → codex-adapter-zw4dwsx7.js} +2 -2
- package/dist/{codex-hook-n7m5k7cr.js → codex-hook-bw8p5nh4.js} +2 -2
- package/dist/{codex-session-runner-v9krqe4x.js → codex-session-runner-k981s65v.js} +2 -2
- package/dist/{commands-923wsas7.js → commands-sykrxx7e.js} +4 -4
- package/dist/{db-m1hy4zh5.js → db-sfbsc8wt.js} +6 -4
- package/dist/handlers-0aspcejm.js +603 -0
- package/dist/{hook-ee4hff56.js → hook-4nvqj2sb.js} +7 -5
- package/dist/{hook-bxe3bkdy.js → hook-hxccs7m5.js} +24 -49
- package/dist/{http-a8rx91me.js → http-y06z517d.js} +223 -92
- package/dist/{index-697zfzv1.js → index-hssww7kj.js} +15 -14
- package/dist/{index-3x9g3nbg.js → index-k8znfx0z.js} +13 -12
- package/dist/{index-1j9va48r.js → index-tce1rss4.js} +371 -110
- package/dist/{index-jj4q3x59.js → index-x5j894zf.js} +14 -13
- package/dist/{keepalive-sds4e4ce.js → keepalive-w733ax66.js} +6 -6
- package/dist/{lead-ggq6szk8.js → lead-75bjqa9d.js} +29 -27
- package/dist/{maintenance-093p41d4.js → maintenance-w4f1zjck.js} +8 -7
- package/dist/{oauth-refresh-sweep-dvzq4ckj.js → oauth-refresh-sweep-wdetky26.js} +5 -5
- package/dist/{onboard-ydr9tzw5.js → onboard-bb5net8s.js} +2 -2
- package/dist/{otel-impl-zx3tdf3j.js → otel-impl-0w7c14ap.js} +1 -1
- package/dist/{pi-mono-adapter-dtkz4e7j.js → pi-mono-adapter-2has4gnp.js} +12 -2
- package/dist/{pricing-refresh-7e6pqnzp.js → pricing-refresh-9nzsrgcq.js} +6 -6
- package/dist/{rbac-roles-p2rh6d0r.js → rbac-roles-r3hqjp09.js} +5 -5
- package/dist/{rbac-roles-0dv1wt0w.js → rbac-roles-z1jrffbt.js} +4 -4
- package/dist/{registry-9kdck5ye.js → registry-v5wytg0s.js} +1 -2
- package/dist/{render-v2-4k3jt4r2.js → render-v2-vbr89fnb.js} +6 -5
- package/dist/{seed-pricing-2cc1qmcd.js → seed-pricing-g62hy1pk.js} +7 -5
- package/dist/{setup-c5yss30k.js → setup-gnfqnptp.js} +2 -2
- package/dist/{worker-7srgeqcr.js → worker-kznxp4qm.js} +29 -27
- package/openapi.json +263 -12
- package/package.json +1 -1
- package/plugin/commands/start-worker.md +4 -9
- package/plugin/pi-skills/start-worker/SKILL.md +4 -9
- package/src/be/db/agents.ts +556 -0
- package/src/be/db/context-versions.ts +117 -0
- package/src/be/db/runtime.ts +406 -0
- package/src/be/db/tasks/read.ts +1167 -0
- package/src/be/db/tasks/write.ts +953 -0
- package/src/be/db.ts +583 -3428
- package/src/be/migrations/147_scheduled_tasks_parent_task.sql +7 -0
- package/src/be/migrations/148_pages_svg.sql +123 -0
- package/src/be/migrations/149_session_tokens.sql +24 -0
- package/src/be/scripts/typecheck.ts +1 -0
- package/src/be/seed-pricing.ts +13 -8
- package/src/be/seed-scripts/catalog/ops-catalog-audit.inline.ts +1 -1
- package/src/be/seed-scripts/catalog/ops-catalog-audit.ts +1 -1
- package/src/be/seed-scripts/catalog/star-history-refresh.ts +101 -0
- package/src/be/seed-scripts/catalog/star-history-renderer.ts +119 -0
- package/src/be/seed-scripts/index.ts +17 -0
- package/src/be/seed-skills/index.ts +14 -0
- package/src/be/swarm-config-guard.ts +1 -1
- package/src/be/task-attachment-store.ts +70 -0
- package/src/be/users.ts +77 -0
- package/src/commands/attachments-section.ts +37 -0
- package/src/commands/claude-managed-setup.ts +45 -3
- package/src/commands/claude-md-session.ts +408 -0
- package/src/commands/context-preamble.ts +15 -3
- package/src/commands/profile-sync.ts +205 -5
- package/src/commands/provider-credentials.ts +60 -27
- package/src/commands/runner.ts +63 -58
- package/src/commands/templates.ts +25 -2
- package/src/hooks/hook.ts +26 -67
- package/src/http/agents.ts +40 -1
- package/src/http/auth.ts +13 -1
- package/src/http/fs.ts +21 -51
- package/src/http/mcp.ts +32 -0
- package/src/http/pages-public.ts +20 -4
- package/src/http/poll.ts +4 -0
- package/src/http/repos.ts +3 -3
- package/src/http/sessions.ts +82 -0
- package/src/http/tasks.ts +10 -2
- package/src/prompts/session-templates.ts +4 -2
- package/src/providers/acp-adapter.ts +42 -6
- package/src/providers/pi-mono-adapter.ts +23 -6
- package/src/scheduler/scheduler.test.ts +49 -2
- package/src/scheduler/scheduler.ts +4 -0
- package/src/scripts-runtime/sdk-allowlist.ts +1 -0
- package/src/scripts-runtime/types/stdlib.d.ts +8 -0
- package/src/scripts-runtime/types/swarm-sdk.d.ts +8 -0
- package/src/server.ts +2 -0
- package/src/slack/assistant.ts +87 -46
- package/src/slack/handlers.test.ts +1 -3
- package/src/slack/handlers.ts +102 -87
- package/src/slack/inbound-files.ts +466 -0
- package/src/slack/templates.ts +14 -0
- package/src/tasks/task-terminal-effects.ts +158 -0
- package/src/tests/acp-adapter.test.ts +327 -192
- package/src/tests/budget-claim-gate.test.ts +1 -0
- package/src/tests/build-pi-skills.test.ts +5 -7
- package/src/tests/claude-managed-setup.test.ts +52 -4
- package/src/tests/claude-md-session.test.ts +603 -0
- package/src/tests/codex-skill-resolver.test.ts +19 -0
- package/src/tests/context-versioning.test.ts +107 -0
- package/src/tests/credential-check.test.ts +157 -14
- package/src/tests/db-agents.test.ts +91 -0
- package/src/tests/db-context-versions.test.ts +37 -0
- package/src/tests/db-extraction-contract.test.ts +45 -0
- package/src/tests/db-runtime.test.ts +70 -0
- package/src/tests/db-task-read-contract.test.ts +624 -0
- package/src/tests/db-task-write-contract.test.ts +653 -0
- package/src/tests/db-tasks-read.test.ts +183 -0
- package/src/tests/db-tasks-write.test.ts +230 -0
- package/src/tests/defer-task.test.ts +389 -0
- package/src/tests/docs-index-footprint.test.js +2 -2
- package/src/tests/e2e-visuals-stage.test.ts +151 -0
- package/src/tests/file-lock.test.ts +144 -0
- package/src/tests/fixtures/file-lock-holder.ts +13 -0
- package/src/tests/fixtures/hold-file-lock.ts +25 -0
- package/src/tests/heartbeat-expiry.test.ts +188 -0
- package/src/tests/http-api-integration.test.ts +78 -1
- package/src/tests/pages-public-html.test.ts +43 -0
- package/src/tests/pages-svg-migration.test.ts +42 -0
- package/src/tests/preload.ts +4 -1
- package/src/tests/profile-sync-warning.test.ts +16 -0
- package/src/tests/profile-sync.test.ts +126 -0
- package/src/tests/prompt-template-session.test.ts +20 -4
- package/src/tests/provider-registration.test.ts +93 -0
- package/src/tests/rbac-e2e-helpers.test.ts +53 -0
- package/src/tests/rbac-e2e-helpers.ts +19 -2
- package/src/tests/routing-affinity-inventory.test.ts +1 -1
- package/src/tests/runner-attachments-section.test.ts +22 -2
- package/src/tests/runner-context-preamble.test.ts +30 -0
- package/src/tests/runner-deployment-resume.test.ts +107 -0
- package/src/tests/runner-repo-autostash.test.ts +12 -0
- package/src/tests/script-connections.test.ts +4 -0
- package/src/tests/seed-scripts.test.ts +2 -2
- package/src/tests/session-tokens.test.ts +279 -0
- package/src/tests/slack-file-tools-attachments.test.ts +408 -0
- package/src/tests/slack-inbound-files.test.ts +847 -0
- package/src/tests/star-history-refresh.test.ts +102 -0
- package/src/tests/swarm-repos.test.ts +20 -0
- package/src/tests/tool-annotations.test.ts +4 -3
- package/src/tests/ui-logs-parser.test.ts +176 -0
- package/src/tools/create-page.ts +4 -2
- package/src/tools/defer-task.ts +239 -0
- package/src/tools/repos/update-repo.ts +2 -2
- package/src/tools/schedules/create-schedule.ts +1 -0
- package/src/tools/schedules/list-schedules.ts +1 -0
- package/src/tools/schedules/patch-schedule.ts +1 -0
- package/src/tools/schedules/update-schedule.ts +1 -0
- package/src/tools/slack-download-file.ts +60 -29
- package/src/tools/slack-read.ts +73 -32
- package/src/tools/store-progress.ts +16 -146
- package/src/tools/tool-config.ts +1 -0
- package/src/tools/utils.ts +21 -0
- package/src/types.ts +37 -4
- package/src/utils/acp-session-token.ts +56 -0
- package/src/utils/file-lock.ts +111 -0
- package/src/utils/heartbeat-expiry.ts +78 -0
- package/src/utils/request-auth-context.ts +2 -0
- package/src/utils/task-attachment-links.ts +22 -0
- package/templates/skills/code-quality/content.md +8 -5
- package/templates/skills/download-task-attachment/content.md +2 -1
- package/{plugin/pi-skills → templates/skills}/review-offered-task/SKILL.md +5 -5
- package/templates/skills/review-offered-task/config.json +14 -0
- package/{plugin/commands/review-offered-task.md → templates/skills/review-offered-task/content.md} +3 -8
- package/templates/skills/scheduling/content.md +4 -0
- package/templates/skills/slack-interaction/content.md +2 -2
- package/templates/skills/work-on-task/SKILL.md +16 -0
- package/templates/skills/work-on-task/config.json +14 -0
- package/templates/skills/work-on-task/content.md +11 -0
- package/dist/assistant-dx3ew4d8.js +0 -212
- package/dist/cli-00kyrp1a.js +0 -317
- package/dist/cli-n1q8q14d.js +0 -177
- package/dist/cli-ss6vybmt.js +0 -269
- package/dist/handlers-e9vp2fr8.js +0 -592
- package/plugin/commands/work-on-task.md +0 -39
- package/plugin/pi-skills/work-on-task/SKILL.md +0 -39
package/README.md
CHANGED
|
@@ -96,7 +96,7 @@ Read [CONTRIBUTING.md](./CONTRIBUTING.md), fork the repository, create a branch,
|
|
|
96
96
|
|
|
97
97
|
## Star History
|
|
98
98
|
|
|
99
|
-
<picture><source media="(prefers-color-scheme: dark)" srcset="
|
|
99
|
+
<picture><source media="(prefers-color-scheme: dark)" srcset="https://api.desplega.agent-swarm.dev/p/e3473addceb348c0bed6cb93bd5aa532" /> <source media="(prefers-color-scheme: light)" srcset="https://api.desplega.agent-swarm.dev/p/4b5cdc17c45e4a63845fb0a71ed9609c" /> <img alt="Star History Chart" src="https://api.desplega.agent-swarm.dev/p/4b5cdc17c45e4a63845fb0a71ed9609c" /></picture>
|
|
100
100
|
|
|
101
101
|
## License
|
|
102
102
|
|
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
import {
|
|
30
30
|
init_package,
|
|
31
31
|
package_default
|
|
32
|
-
} from "./cli-
|
|
32
|
+
} from "./cli-w9kb3bk1.js";
|
|
33
33
|
import {
|
|
34
34
|
init_secret_scrubber,
|
|
35
35
|
scrubSecrets
|
|
@@ -4347,6 +4347,34 @@ class ClientSideConnection {
|
|
|
4347
4347
|
|
|
4348
4348
|
// src/providers/acp-adapter.ts
|
|
4349
4349
|
init_package();
|
|
4350
|
+
|
|
4351
|
+
// src/utils/acp-session-token.ts
|
|
4352
|
+
var ACP_SESSION_TOKEN_TTL_MS = 24 * 60 * 60 * 1000;
|
|
4353
|
+
async function mintAcpSessionToken(apiUrl, apiKey, agentId, taskId) {
|
|
4354
|
+
const res = await fetch(`${apiUrl.replace(/\/+$/, "")}/api/sessions/tokens`, {
|
|
4355
|
+
method: "POST",
|
|
4356
|
+
headers: {
|
|
4357
|
+
Authorization: `Bearer ${apiKey}`,
|
|
4358
|
+
"Content-Type": "application/json"
|
|
4359
|
+
},
|
|
4360
|
+
body: JSON.stringify({ agentId, taskId, ttlMs: ACP_SESSION_TOKEN_TTL_MS })
|
|
4361
|
+
});
|
|
4362
|
+
if (!res.ok) {
|
|
4363
|
+
throw new Error(`\x1B[33m[acp]\x1B[0m Session token mint failed (${res.status})`);
|
|
4364
|
+
}
|
|
4365
|
+
const data = await res.json();
|
|
4366
|
+
return { tokenId: data.tokenId, plaintext: data.plaintext };
|
|
4367
|
+
}
|
|
4368
|
+
async function revokeAcpSessionToken(apiUrl, apiKey, tokenId) {
|
|
4369
|
+
try {
|
|
4370
|
+
await fetch(`${apiUrl.replace(/\/+$/, "")}/api/sessions/tokens/${tokenId}`, {
|
|
4371
|
+
method: "DELETE",
|
|
4372
|
+
headers: { Authorization: `Bearer ${apiKey}` }
|
|
4373
|
+
});
|
|
4374
|
+
} catch {}
|
|
4375
|
+
}
|
|
4376
|
+
|
|
4377
|
+
// src/providers/acp-adapter.ts
|
|
4350
4378
|
init_secret_scrubber();
|
|
4351
4379
|
|
|
4352
4380
|
// src/providers/acp-swarm-events.ts
|
|
@@ -4748,11 +4776,13 @@ class ACPSession {
|
|
|
4748
4776
|
output = "";
|
|
4749
4777
|
completionPromise;
|
|
4750
4778
|
completionResolve;
|
|
4751
|
-
|
|
4779
|
+
ephemeralTokenId = null;
|
|
4780
|
+
constructor(connection, process2, config, sessionId, providerMeta, ephemeralTokenId) {
|
|
4752
4781
|
this.connection = connection;
|
|
4753
4782
|
this.process = process2;
|
|
4754
4783
|
this.config = config;
|
|
4755
4784
|
this.sessionId = sessionId;
|
|
4785
|
+
this.ephemeralTokenId = ephemeralTokenId ?? null;
|
|
4756
4786
|
this.completionPromise = new Promise((resolve) => {
|
|
4757
4787
|
this.completionResolve = resolve;
|
|
4758
4788
|
});
|
|
@@ -4898,6 +4928,9 @@ class ACPSession {
|
|
|
4898
4928
|
return;
|
|
4899
4929
|
this.completed = true;
|
|
4900
4930
|
this.completionResolve(result);
|
|
4931
|
+
if (this.ephemeralTokenId) {
|
|
4932
|
+
revokeAcpSessionToken(this.config.apiUrl, this.config.apiKey, this.ephemeralTokenId);
|
|
4933
|
+
}
|
|
4901
4934
|
}
|
|
4902
4935
|
}
|
|
4903
4936
|
|
|
@@ -4929,12 +4962,14 @@ class ACPAdapter {
|
|
|
4929
4962
|
});
|
|
4930
4963
|
const stream = ndJsonStream2(fileSinkWritableStream(proc.stdin), proc.stdout);
|
|
4931
4964
|
const connection = new ClientSideConnection(() => client2, stream);
|
|
4965
|
+
let ephemeralToken = null;
|
|
4932
4966
|
try {
|
|
4933
4967
|
await connection.initialize({
|
|
4934
4968
|
protocolVersion: PROTOCOL_VERSION,
|
|
4935
4969
|
clientInfo: { name: "agent-swarm", version: package_default.version },
|
|
4936
4970
|
clientCapabilities: { session: { configOptions: { boolean: {} } } }
|
|
4937
4971
|
});
|
|
4972
|
+
ephemeralToken = await mintAcpSessionToken(config.apiUrl, config.apiKey, config.agentId, config.taskId);
|
|
4938
4973
|
const installedServers = await fetchInstalledMcpServers(config.apiUrl, config.apiKey, config.agentId, "claude");
|
|
4939
4974
|
const newSession = await connection.newSession({
|
|
4940
4975
|
cwd: config.cwd,
|
|
@@ -4944,7 +4979,7 @@ class ACPAdapter {
|
|
|
4944
4979
|
name: "swarm",
|
|
4945
4980
|
url: `${config.apiUrl.replace(/\/+$/, "")}/mcp`,
|
|
4946
4981
|
headers: [
|
|
4947
|
-
{ name: "Authorization", value: `Bearer ${
|
|
4982
|
+
{ name: "Authorization", value: `Bearer ${ephemeralToken.plaintext}` },
|
|
4948
4983
|
{ name: "X-Agent-ID", value: config.agentId },
|
|
4949
4984
|
{ name: "X-Source-Task-Id", value: config.taskId }
|
|
4950
4985
|
]
|
|
@@ -4956,11 +4991,14 @@ class ACPAdapter {
|
|
|
4956
4991
|
session = new ACPSession(connection, proc, config, newSession.sessionId, {
|
|
4957
4992
|
target: target.target,
|
|
4958
4993
|
configOptions: sanitizeAcpConfigOptions(configOptions)
|
|
4959
|
-
});
|
|
4994
|
+
}, ephemeralToken.tokenId);
|
|
4960
4995
|
for (const event of preSessionEvents)
|
|
4961
4996
|
session.emitFromAcp(event);
|
|
4962
4997
|
return session;
|
|
4963
4998
|
} catch (err) {
|
|
4999
|
+
if (ephemeralToken && !session) {
|
|
5000
|
+
revokeAcpSessionToken(config.apiUrl, config.apiKey, ephemeralToken.tokenId);
|
|
5001
|
+
}
|
|
4964
5002
|
await terminateProcessGroup(proc.pid);
|
|
4965
5003
|
throw new Error(`ACP target failed during startup: ${scrubSecrets(formatError(err))}`);
|
|
4966
5004
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resolveSlackUserId
|
|
3
|
-
} from "./cli-
|
|
4
|
-
import"./cli-
|
|
3
|
+
} from "./cli-dttph1bw.js";
|
|
4
|
+
import"./cli-p1d5b073.js";
|
|
5
5
|
import {
|
|
6
6
|
createTaskWithSiblingAwareness
|
|
7
|
-
} from "./cli-
|
|
7
|
+
} from "./cli-53s590z8.js";
|
|
8
8
|
import {
|
|
9
9
|
buildCancelledBlocks,
|
|
10
10
|
ensureSlackThreadTree,
|
|
@@ -12,8 +12,9 @@ import {
|
|
|
12
12
|
getAgentEmoji,
|
|
13
13
|
getTaskLink,
|
|
14
14
|
isSlackRenderV2Enabled
|
|
15
|
-
} from "./cli-
|
|
15
|
+
} from "./cli-b5bq9crk.js";
|
|
16
16
|
import"./cli-q51yprfq.js";
|
|
17
|
+
import"./cli-9d8ntetj.js";
|
|
17
18
|
import"./cli-yatxqynm.js";
|
|
18
19
|
import {
|
|
19
20
|
cancelTask,
|
|
@@ -23,15 +24,15 @@ import {
|
|
|
23
24
|
init_context_key,
|
|
24
25
|
init_db,
|
|
25
26
|
slackContextKey
|
|
26
|
-
} from "./cli-
|
|
27
|
-
import"./cli-
|
|
28
|
-
import"./cli-
|
|
27
|
+
} from "./cli-ftht3zzj.js";
|
|
28
|
+
import"./cli-y6b6fb76.js";
|
|
29
|
+
import"./cli-kpv03zhj.js";
|
|
29
30
|
import"./cli-e29gmdmw.js";
|
|
30
31
|
import"./cli-c2mk1kgf.js";
|
|
31
32
|
import"./cli-ej6gbxfb.js";
|
|
32
33
|
import"./cli-sd0mxa3c.js";
|
|
33
34
|
import"./cli-w5e1d1vv.js";
|
|
34
|
-
import"./cli-
|
|
35
|
+
import"./cli-w9kb3bk1.js";
|
|
35
36
|
import"./cli-xqcq9y5e.js";
|
|
36
37
|
import"./cli-pzxba7gw.js";
|
|
37
38
|
import"./cli-zf8jjwex.js";
|
|
@@ -3,18 +3,19 @@ import {
|
|
|
3
3
|
initSlackApp,
|
|
4
4
|
startSlackApp,
|
|
5
5
|
stopSlackApp
|
|
6
|
-
} from "./cli-
|
|
6
|
+
} from "./cli-b5bq9crk.js";
|
|
7
7
|
import"./cli-q51yprfq.js";
|
|
8
|
+
import"./cli-9d8ntetj.js";
|
|
8
9
|
import"./cli-yatxqynm.js";
|
|
9
|
-
import"./cli-
|
|
10
|
-
import"./cli-
|
|
11
|
-
import"./cli-
|
|
10
|
+
import"./cli-ftht3zzj.js";
|
|
11
|
+
import"./cli-y6b6fb76.js";
|
|
12
|
+
import"./cli-kpv03zhj.js";
|
|
12
13
|
import"./cli-e29gmdmw.js";
|
|
13
14
|
import"./cli-c2mk1kgf.js";
|
|
14
15
|
import"./cli-ej6gbxfb.js";
|
|
15
16
|
import"./cli-sd0mxa3c.js";
|
|
16
17
|
import"./cli-w5e1d1vv.js";
|
|
17
|
-
import"./cli-
|
|
18
|
+
import"./cli-w9kb3bk1.js";
|
|
18
19
|
import"./cli-xqcq9y5e.js";
|
|
19
20
|
import"./cli-pzxba7gw.js";
|
|
20
21
|
import"./cli-zf8jjwex.js";
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import {
|
|
2
|
+
bufferThreadMessage,
|
|
3
|
+
getBufferMessageCount,
|
|
4
|
+
wasEventSeen
|
|
5
|
+
} from "./cli-f146mn5s.js";
|
|
6
|
+
import {
|
|
7
|
+
bufferedFileFailures,
|
|
8
|
+
buildEffectiveText,
|
|
9
|
+
createSlackTaskWithFiles,
|
|
10
|
+
fetchSlackFiles,
|
|
11
|
+
hasOtherUserMention,
|
|
12
|
+
notifySlackFileFailures
|
|
13
|
+
} from "./cli-mmemxxdc.js";
|
|
14
|
+
import"./cli-jsp14b6c.js";
|
|
15
|
+
import {
|
|
16
|
+
resolveSlackUserId,
|
|
17
|
+
rewriteSlackMentions
|
|
18
|
+
} from "./cli-dttph1bw.js";
|
|
19
|
+
import"./cli-p1d5b073.js";
|
|
20
|
+
import"./cli-53s590z8.js";
|
|
21
|
+
import {
|
|
22
|
+
ackSlackMessage,
|
|
23
|
+
ensureSlackThreadTree,
|
|
24
|
+
isSlackRenderV2Enabled,
|
|
25
|
+
require_dist
|
|
26
|
+
} from "./cli-b5bq9crk.js";
|
|
27
|
+
import"./cli-q51yprfq.js";
|
|
28
|
+
import"./cli-9d8ntetj.js";
|
|
29
|
+
import"./cli-yatxqynm.js";
|
|
30
|
+
import {
|
|
31
|
+
getAgentWorkingOnThread,
|
|
32
|
+
getLeadAgent,
|
|
33
|
+
getMostRecentTaskInThread,
|
|
34
|
+
init_context_key,
|
|
35
|
+
init_db,
|
|
36
|
+
reactionName,
|
|
37
|
+
slackContextKey
|
|
38
|
+
} from "./cli-ftht3zzj.js";
|
|
39
|
+
import"./cli-y6b6fb76.js";
|
|
40
|
+
import {
|
|
41
|
+
init_resolver,
|
|
42
|
+
resolveTemplate
|
|
43
|
+
} from "./cli-kpv03zhj.js";
|
|
44
|
+
import"./cli-e29gmdmw.js";
|
|
45
|
+
import"./cli-c2mk1kgf.js";
|
|
46
|
+
import {
|
|
47
|
+
init_env_flag,
|
|
48
|
+
isEnvFlagEnabled
|
|
49
|
+
} from "./cli-ej6gbxfb.js";
|
|
50
|
+
import"./cli-sd0mxa3c.js";
|
|
51
|
+
import"./cli-w5e1d1vv.js";
|
|
52
|
+
import"./cli-w9kb3bk1.js";
|
|
53
|
+
import"./cli-xqcq9y5e.js";
|
|
54
|
+
import"./cli-pzxba7gw.js";
|
|
55
|
+
import"./cli-zf8jjwex.js";
|
|
56
|
+
import"./cli-bd957dgb.js";
|
|
57
|
+
import {
|
|
58
|
+
__callDispose,
|
|
59
|
+
__toESM,
|
|
60
|
+
__using
|
|
61
|
+
} from "./cli-bc05qbss.js";
|
|
62
|
+
|
|
63
|
+
// src/slack/assistant.ts
|
|
64
|
+
init_db();
|
|
65
|
+
init_resolver();
|
|
66
|
+
init_context_key();
|
|
67
|
+
var import_bolt = __toESM(require_dist(), 1);
|
|
68
|
+
init_env_flag();
|
|
69
|
+
var isAdditiveSlack = () => isEnvFlagEnabled("ADDITIVE_SLACK", false);
|
|
70
|
+
var cachedBotUserId = null;
|
|
71
|
+
function createAssistant() {
|
|
72
|
+
return new import_bolt.Assistant({
|
|
73
|
+
threadStarted: async ({ say, setSuggestedPrompts, saveThreadContext }) => {
|
|
74
|
+
try {
|
|
75
|
+
await saveThreadContext();
|
|
76
|
+
if (!isSlackRenderV2Enabled()) {
|
|
77
|
+
const greetingResult = resolveTemplate("slack.assistant.greeting", {});
|
|
78
|
+
await say(greetingResult.text);
|
|
79
|
+
}
|
|
80
|
+
await setSuggestedPrompts({
|
|
81
|
+
title: "Try these:",
|
|
82
|
+
prompts: [
|
|
83
|
+
{ title: "Check status", message: "What's the current status of all agents?" },
|
|
84
|
+
{ title: "Assign a task", message: "Can you help me with..." },
|
|
85
|
+
{ title: "List recent tasks", message: "Show me the most recent tasks" }
|
|
86
|
+
]
|
|
87
|
+
});
|
|
88
|
+
} catch (error) {
|
|
89
|
+
console.error("[Slack] Assistant threadStarted error:", error);
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
threadContextChanged: async ({ saveThreadContext }) => {
|
|
93
|
+
await saveThreadContext();
|
|
94
|
+
},
|
|
95
|
+
userMessage: async ({ message, body, say, setStatus, setTitle, getThreadContext, client }) => {
|
|
96
|
+
const eventId = body?.event_id;
|
|
97
|
+
if (wasEventSeen(eventId)) {
|
|
98
|
+
console.log(`[Slack] dropping Slack retry: event_id=${eventId}`);
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
const safeSetStatus = async (status) => {
|
|
102
|
+
try {
|
|
103
|
+
await setStatus(status);
|
|
104
|
+
} catch (error) {
|
|
105
|
+
console.warn("[Slack] setStatus failed (thread may not be an assistant thread):", error);
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
const safeSetTitle = async (title) => {
|
|
109
|
+
try {
|
|
110
|
+
await setTitle(title);
|
|
111
|
+
} catch (error) {
|
|
112
|
+
console.warn("[Slack] setTitle failed (thread may not be an assistant thread):", error);
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
try {
|
|
116
|
+
let __stack = [];
|
|
117
|
+
try {
|
|
118
|
+
const msg = message;
|
|
119
|
+
const threadTs = msg.thread_ts || message.ts;
|
|
120
|
+
const channelId = message.channel;
|
|
121
|
+
const messageText = msg.text || "";
|
|
122
|
+
const files = msg.files;
|
|
123
|
+
const userId = msg.user || "";
|
|
124
|
+
if (!cachedBotUserId) {
|
|
125
|
+
try {
|
|
126
|
+
const authResult = await client.auth.test();
|
|
127
|
+
cachedBotUserId = authResult.user_id ?? null;
|
|
128
|
+
} catch (e) {
|
|
129
|
+
console.warn("[Slack] assistant: auth.test() failed — skipping bot-mention check", e);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
if (cachedBotUserId) {
|
|
133
|
+
const botMentioned = messageText.includes(`<@${cachedBotUserId}>`);
|
|
134
|
+
if (!botMentioned && hasOtherUserMention(messageText, cachedBotUserId)) {
|
|
135
|
+
console.log(`[Slack] assistant: skipping message in ${channelId}/${threadTs} — mentions another user, not us`);
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
const requestedByUserId = userId ? await resolveSlackUserId(client, userId, {
|
|
140
|
+
sampleEventType: "assistant_message",
|
|
141
|
+
sampleContext: messageText
|
|
142
|
+
}) : undefined;
|
|
143
|
+
const workingAgent = await getAgentWorkingOnThread(channelId, threadTs);
|
|
144
|
+
if (workingAgent && workingAgent.status !== "offline" && isAdditiveSlack()) {
|
|
145
|
+
const unattached2 = bufferedFileFailures(files);
|
|
146
|
+
bufferThreadMessage(channelId, threadTs, buildEffectiveText(messageText, files, unattached2), userId, message.ts);
|
|
147
|
+
const count = getBufferMessageCount(`${channelId}:${threadTs}`);
|
|
148
|
+
const event = count === 1 ? "accepted" : "buffered";
|
|
149
|
+
await ackSlackMessage(client, channelId, message.ts, reactionName(event), event);
|
|
150
|
+
await notifySlackFileFailures(client, channelId, threadTs, unattached2);
|
|
151
|
+
await safeSetStatus("Queuing follow-up...");
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
if (files?.length)
|
|
155
|
+
await safeSetStatus("Downloading attachments...");
|
|
156
|
+
const inbound = __using(__stack, await fetchSlackFiles(client, files), 1);
|
|
157
|
+
const renderedMessageText = await rewriteSlackMentions(buildEffectiveText(messageText, inbound.files, inbound.failed));
|
|
158
|
+
if (workingAgent && workingAgent.status !== "offline") {
|
|
159
|
+
const latestTask = await getMostRecentTaskInThread(channelId, threadTs);
|
|
160
|
+
const { task: task2, unattached: unattached2 } = await createSlackTaskWithFiles(renderedMessageText, {
|
|
161
|
+
agentId: workingAgent.id,
|
|
162
|
+
source: "slack",
|
|
163
|
+
slackChannelId: channelId,
|
|
164
|
+
slackThreadTs: threadTs,
|
|
165
|
+
slackTriggerMessageTs: message.ts,
|
|
166
|
+
slackUserId: userId,
|
|
167
|
+
parentTaskId: latestTask?.id,
|
|
168
|
+
requestedByUserId,
|
|
169
|
+
contextKey: slackContextKey({ channelId, threadTs })
|
|
170
|
+
}, inbound);
|
|
171
|
+
await ackSlackMessage(client, channelId, message.ts, reactionName("accepted"), "accepted");
|
|
172
|
+
await notifySlackFileFailures(client, channelId, threadTs, unattached2);
|
|
173
|
+
if (isSlackRenderV2Enabled())
|
|
174
|
+
await ensureSlackThreadTree([task2.id]);
|
|
175
|
+
await safeSetStatus("Processing follow-up...");
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
await safeSetStatus("Processing your request...");
|
|
179
|
+
if (renderedMessageText) {
|
|
180
|
+
const title = renderedMessageText.length > 50 ? `${renderedMessageText.slice(0, 47)}...` : renderedMessageText;
|
|
181
|
+
await safeSetTitle(title);
|
|
182
|
+
}
|
|
183
|
+
const ctx = await getThreadContext();
|
|
184
|
+
const channelContext = ctx && typeof ctx === "object" && "channel_id" in ctx && ctx.channel_id ? `
|
|
185
|
+
|
|
186
|
+
[User is viewing channel <#${ctx.channel_id}>]` : "";
|
|
187
|
+
const lead = await getLeadAgent();
|
|
188
|
+
if (!lead) {
|
|
189
|
+
const { task: task2, unattached: unattached2 } = await createSlackTaskWithFiles(renderedMessageText + channelContext, {
|
|
190
|
+
source: "slack",
|
|
191
|
+
slackChannelId: channelId,
|
|
192
|
+
slackThreadTs: threadTs,
|
|
193
|
+
slackTriggerMessageTs: message.ts,
|
|
194
|
+
slackUserId: userId,
|
|
195
|
+
requestedByUserId,
|
|
196
|
+
contextKey: slackContextKey({ channelId, threadTs })
|
|
197
|
+
}, inbound);
|
|
198
|
+
await ackSlackMessage(client, channelId, message.ts, reactionName("accepted"), "accepted");
|
|
199
|
+
await notifySlackFileFailures(client, channelId, threadTs, unattached2);
|
|
200
|
+
if (isSlackRenderV2Enabled()) {
|
|
201
|
+
await ensureSlackThreadTree([task2.id]);
|
|
202
|
+
} else {
|
|
203
|
+
const offlineResult = resolveTemplate("slack.assistant.offline", {});
|
|
204
|
+
await say(offlineResult.text);
|
|
205
|
+
}
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
const { task, unattached } = await createSlackTaskWithFiles(renderedMessageText + channelContext, {
|
|
209
|
+
agentId: lead.id,
|
|
210
|
+
source: "slack",
|
|
211
|
+
slackChannelId: channelId,
|
|
212
|
+
slackThreadTs: threadTs,
|
|
213
|
+
slackTriggerMessageTs: message.ts,
|
|
214
|
+
slackUserId: userId,
|
|
215
|
+
requestedByUserId,
|
|
216
|
+
contextKey: slackContextKey({ channelId, threadTs })
|
|
217
|
+
}, inbound);
|
|
218
|
+
await ackSlackMessage(client, channelId, message.ts, reactionName("accepted"), "accepted");
|
|
219
|
+
await notifySlackFileFailures(client, channelId, threadTs, unattached);
|
|
220
|
+
if (isSlackRenderV2Enabled())
|
|
221
|
+
await ensureSlackThreadTree([task.id]);
|
|
222
|
+
} catch (_catch) {
|
|
223
|
+
var _err = _catch, _hasErr = 1;
|
|
224
|
+
} finally {
|
|
225
|
+
var _promise = __callDispose(__stack, _err, _hasErr);
|
|
226
|
+
_promise && await _promise;
|
|
227
|
+
}
|
|
228
|
+
} catch (error) {
|
|
229
|
+
console.error("[Slack] Assistant userMessage error:", error);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
export {
|
|
235
|
+
createAssistant
|
|
236
|
+
};
|
|
@@ -3,21 +3,22 @@ import {
|
|
|
3
3
|
getEmbeddingProvider,
|
|
4
4
|
getMemoryStore,
|
|
5
5
|
init_constants
|
|
6
|
-
} from "./cli-
|
|
7
|
-
import"./cli-
|
|
6
|
+
} from "./cli-1th1728g.js";
|
|
7
|
+
import"./cli-m9sxbkhm.js";
|
|
8
8
|
import"./cli-aehm1rbq.js";
|
|
9
|
+
import"./cli-9d8ntetj.js";
|
|
9
10
|
import {
|
|
10
11
|
getDbClient,
|
|
11
12
|
init_db
|
|
12
|
-
} from "./cli-
|
|
13
|
-
import"./cli-
|
|
14
|
-
import"./cli-
|
|
13
|
+
} from "./cli-ftht3zzj.js";
|
|
14
|
+
import"./cli-y6b6fb76.js";
|
|
15
|
+
import"./cli-kpv03zhj.js";
|
|
15
16
|
import"./cli-e29gmdmw.js";
|
|
16
17
|
import"./cli-c2mk1kgf.js";
|
|
17
18
|
import"./cli-ej6gbxfb.js";
|
|
18
19
|
import"./cli-sd0mxa3c.js";
|
|
19
20
|
import"./cli-w5e1d1vv.js";
|
|
20
|
-
import"./cli-
|
|
21
|
+
import"./cli-w9kb3bk1.js";
|
|
21
22
|
import"./cli-xqcq9y5e.js";
|
|
22
23
|
import"./cli-zf8jjwex.js";
|
|
23
24
|
import"./cli-bc05qbss.js";
|
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
import {
|
|
2
2
|
embedScript,
|
|
3
3
|
embeddingProvider
|
|
4
|
-
} from "./cli-
|
|
5
|
-
import"./cli-
|
|
6
|
-
import"./cli-
|
|
4
|
+
} from "./cli-hbv0kq6w.js";
|
|
5
|
+
import"./cli-1th1728g.js";
|
|
6
|
+
import"./cli-m9sxbkhm.js";
|
|
7
7
|
import"./cli-aehm1rbq.js";
|
|
8
|
+
import"./cli-9d8ntetj.js";
|
|
8
9
|
import {
|
|
9
10
|
getDbClient,
|
|
10
11
|
init_db
|
|
11
|
-
} from "./cli-
|
|
12
|
-
import"./cli-
|
|
13
|
-
import"./cli-
|
|
12
|
+
} from "./cli-ftht3zzj.js";
|
|
13
|
+
import"./cli-y6b6fb76.js";
|
|
14
|
+
import"./cli-kpv03zhj.js";
|
|
14
15
|
import"./cli-e29gmdmw.js";
|
|
15
16
|
import"./cli-c2mk1kgf.js";
|
|
16
17
|
import"./cli-ej6gbxfb.js";
|
|
17
18
|
import"./cli-sd0mxa3c.js";
|
|
18
19
|
import"./cli-w5e1d1vv.js";
|
|
19
|
-
import"./cli-
|
|
20
|
+
import"./cli-w9kb3bk1.js";
|
|
20
21
|
import"./cli-xqcq9y5e.js";
|
|
21
22
|
import"./cli-zf8jjwex.js";
|
|
22
23
|
import"./cli-bc05qbss.js";
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getDbClient,
|
|
3
3
|
init_db
|
|
4
|
-
} from "./cli-
|
|
5
|
-
import"./cli-
|
|
6
|
-
import"./cli-
|
|
4
|
+
} from "./cli-ftht3zzj.js";
|
|
5
|
+
import"./cli-y6b6fb76.js";
|
|
6
|
+
import"./cli-kpv03zhj.js";
|
|
7
7
|
import"./cli-e29gmdmw.js";
|
|
8
8
|
import"./cli-c2mk1kgf.js";
|
|
9
9
|
import"./cli-ej6gbxfb.js";
|
|
10
10
|
import"./cli-sd0mxa3c.js";
|
|
11
11
|
import"./cli-w5e1d1vv.js";
|
|
12
|
-
import"./cli-
|
|
12
|
+
import"./cli-w9kb3bk1.js";
|
|
13
13
|
import {
|
|
14
14
|
init_secret_scrubber,
|
|
15
15
|
scrubSecrets
|
|
@@ -17,8 +17,9 @@ import {
|
|
|
17
17
|
resolveClaudeBridgeEnabled,
|
|
18
18
|
resolveClaudeQueueSteeringOverride,
|
|
19
19
|
runClaudeSessionSummary
|
|
20
|
-
} from "./cli-
|
|
21
|
-
import"./cli-
|
|
20
|
+
} from "./cli-719k9j2c.js";
|
|
21
|
+
import"./cli-89xfd7f9.js";
|
|
22
|
+
import"./cli-d8brzxjb.js";
|
|
22
23
|
import"./cli-b5b30yzk.js";
|
|
23
24
|
import"./cli-rvqz34y5.js";
|
|
24
25
|
import"./cli-hp1n6zq3.js";
|
|
@@ -34,16 +35,17 @@ import"./cli-e7d20cty.js";
|
|
|
34
35
|
import"./cli-3dpj7atn.js";
|
|
35
36
|
import"./cli-y89t4nca.js";
|
|
36
37
|
import"./cli-f14fvzag.js";
|
|
37
|
-
import"./cli-
|
|
38
|
+
import"./cli-m9sxbkhm.js";
|
|
38
39
|
import"./cli-bsakbbkm.js";
|
|
39
|
-
import"./cli-
|
|
40
|
-
import"./cli-
|
|
40
|
+
import"./cli-9d8ntetj.js";
|
|
41
|
+
import"./cli-y6b6fb76.js";
|
|
42
|
+
import"./cli-kpv03zhj.js";
|
|
41
43
|
import"./cli-e29gmdmw.js";
|
|
42
44
|
import"./cli-c2mk1kgf.js";
|
|
43
45
|
import"./cli-ej6gbxfb.js";
|
|
44
46
|
import"./cli-sd0mxa3c.js";
|
|
45
47
|
import"./cli-w5e1d1vv.js";
|
|
46
|
-
import"./cli-
|
|
48
|
+
import"./cli-w9kb3bk1.js";
|
|
47
49
|
import"./cli-xqcq9y5e.js";
|
|
48
50
|
import"./cli-knd276ed.js";
|
|
49
51
|
import"./cli-c4eeb5q2.js";
|
|
@@ -4,6 +4,9 @@ import {
|
|
|
4
4
|
ConflictError,
|
|
5
5
|
toFile
|
|
6
6
|
} from "./cli-j490egb5.js";
|
|
7
|
+
import {
|
|
8
|
+
buildSkillContent
|
|
9
|
+
} from "./cli-ep19k3mb.js";
|
|
7
10
|
import"./cli-e7d20cty.js";
|
|
8
11
|
import {
|
|
9
12
|
getApiKey
|
|
@@ -85,7 +88,9 @@ async function promptHiddenInput(label, _defaultValue, helpText) {
|
|
|
85
88
|
// src/commands/claude-managed-setup.ts
|
|
86
89
|
var DEFAULT_AGENT_MODEL = "claude-sonnet-5";
|
|
87
90
|
var SKILLS_DIR_RELATIVE = "plugin/commands";
|
|
91
|
+
var SEEDED_SKILLS_DIR_RELATIVE = "templates/skills";
|
|
88
92
|
var SKILLS_BETA_HEADER = "skills-2025-10-02";
|
|
93
|
+
var SEEDED_SKILLS_TO_UPLOAD = ["work-on-task", "review-offered-task"];
|
|
89
94
|
var CONFIG_KEY_AGENT_ID = "managed_agent_id";
|
|
90
95
|
var CONFIG_KEY_ENVIRONMENT_ID = "managed_environment_id";
|
|
91
96
|
var CONFIG_KEY_API_KEY = "anthropic_api_key";
|
|
@@ -122,7 +127,8 @@ Options:
|
|
|
122
127
|
|
|
123
128
|
This command:
|
|
124
129
|
1. Creates an Anthropic-side environment (cloud, unrestricted networking).
|
|
125
|
-
2. Uploads each plugin/commands/*.md
|
|
130
|
+
2. Uploads each plugin/commands/*.md plus the turn-prompt skills under
|
|
131
|
+
templates/skills/ as managed-agents skills (skips on 409).
|
|
126
132
|
3. Creates a managed-agents agent referencing the uploaded skills + the
|
|
127
133
|
swarm MCP server (MCP_BASE_URL/mcp).
|
|
128
134
|
4. Persists the resulting IDs to swarm_config (managed_agent_id,
|
|
@@ -186,6 +192,16 @@ async function loadSkillFiles(skillsDir) {
|
|
|
186
192
|
}
|
|
187
193
|
return out;
|
|
188
194
|
}
|
|
195
|
+
async function loadSeededSkillFiles(templatesDir, names = SEEDED_SKILLS_TO_UPLOAD) {
|
|
196
|
+
const out = [];
|
|
197
|
+
for (const name of names) {
|
|
198
|
+
const dir = path.join(templatesDir, name);
|
|
199
|
+
const config = JSON.parse(await readFile(path.join(dir, "config.json"), "utf8"));
|
|
200
|
+
const body = await readFile(path.join(dir, "content.md"), "utf8");
|
|
201
|
+
out.push({ slug: name, absPath: dir, content: buildSkillContent(config, body) });
|
|
202
|
+
}
|
|
203
|
+
return out;
|
|
204
|
+
}
|
|
189
205
|
async function uploadSkill(client, slug, content, log, existingByTitle) {
|
|
190
206
|
if (existingByTitle?.has(slug)) {
|
|
191
207
|
const id = existingByTitle.get(slug);
|
|
@@ -317,8 +333,10 @@ async function runClaudeManagedSetupFlow(config, deps = {}) {
|
|
|
317
333
|
const fetchCfg = deps.fetchConfig ?? fetchConfigByKey;
|
|
318
334
|
const upsert = deps.upsert ?? upsertConfig;
|
|
319
335
|
const loadSkills = deps.loadSkills ?? loadSkillFiles;
|
|
336
|
+
const loadSeededSkills = deps.loadSeededSkills ?? loadSeededSkillFiles;
|
|
320
337
|
const uploadOne = deps.uploadOne ?? uploadSkill;
|
|
321
338
|
const skillsDir = deps.skillsDir ?? path.resolve(process.cwd(), SKILLS_DIR_RELATIVE);
|
|
339
|
+
const seededSkillsDir = deps.seededSkillsDir ?? path.resolve(process.cwd(), SEEDED_SKILLS_DIR_RELATIVE);
|
|
322
340
|
if (!config.force) {
|
|
323
341
|
const existing = await fetchCfg(config.apiUrl, config.apiKey, CONFIG_KEY_AGENT_ID);
|
|
324
342
|
if (existing?.value) {
|
|
@@ -342,8 +360,11 @@ async function runClaudeManagedSetupFlow(config, deps = {}) {
|
|
|
342
360
|
}
|
|
343
361
|
});
|
|
344
362
|
log(` + environment id=${env.id}`);
|
|
345
|
-
log(`Uploading skills from ${skillsDir} ...`);
|
|
346
|
-
const skillFiles =
|
|
363
|
+
log(`Uploading skills from ${skillsDir} and ${seededSkillsDir} ...`);
|
|
364
|
+
const skillFiles = [
|
|
365
|
+
...await loadSkills(skillsDir),
|
|
366
|
+
...await loadSeededSkills(seededSkillsDir)
|
|
367
|
+
];
|
|
347
368
|
log(` found ${skillFiles.length} skill markdown file(s)`);
|
|
348
369
|
const existingByTitle = new Map;
|
|
349
370
|
try {
|
|
@@ -3,8 +3,9 @@ import {
|
|
|
3
3
|
cleanupTaskFile,
|
|
4
4
|
normalizeClaudeMessage,
|
|
5
5
|
runClaudeSessionSummary
|
|
6
|
-
} from "./cli-
|
|
7
|
-
import"./cli-
|
|
6
|
+
} from "./cli-719k9j2c.js";
|
|
7
|
+
import"./cli-89xfd7f9.js";
|
|
8
|
+
import"./cli-d8brzxjb.js";
|
|
8
9
|
import {
|
|
9
10
|
SessionErrorTracker,
|
|
10
11
|
parseStderrForErrors,
|
|
@@ -31,16 +32,17 @@ import {
|
|
|
31
32
|
terminateProcessGroup
|
|
32
33
|
} from "./cli-y89t4nca.js";
|
|
33
34
|
import"./cli-f14fvzag.js";
|
|
34
|
-
import"./cli-
|
|
35
|
+
import"./cli-m9sxbkhm.js";
|
|
35
36
|
import"./cli-bsakbbkm.js";
|
|
36
|
-
import"./cli-
|
|
37
|
-
import"./cli-
|
|
37
|
+
import"./cli-9d8ntetj.js";
|
|
38
|
+
import"./cli-y6b6fb76.js";
|
|
39
|
+
import"./cli-kpv03zhj.js";
|
|
38
40
|
import"./cli-e29gmdmw.js";
|
|
39
41
|
import"./cli-c2mk1kgf.js";
|
|
40
42
|
import"./cli-ej6gbxfb.js";
|
|
41
43
|
import"./cli-sd0mxa3c.js";
|
|
42
44
|
import"./cli-w5e1d1vv.js";
|
|
43
|
-
import"./cli-
|
|
45
|
+
import"./cli-w9kb3bk1.js";
|
|
44
46
|
import {
|
|
45
47
|
init_secret_scrubber,
|
|
46
48
|
scrubSecrets
|