@desplega.ai/agent-swarm 1.150.0 → 1.151.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 +11 -0
- package/dist/{acp-adapter-d5mzggyk.js → acp-adapter-ex8hzjfc.js} +5 -5
- package/dist/{actions-wn6ew0p7.js → actions-2bgpyhww.js} +38 -11
- package/dist/{anthropic-messages-ec35ktvx.js → anthropic-messages-2y8nktar.js} +16 -16
- package/dist/{app-dty7p9hg.js → app-1706zhr1.js} +7 -7
- package/dist/{assistant-q4vhgjtx.js → assistant-bavke5p7.js} +41 -16
- package/dist/{azure-openai-responses-g85jv7m8.js → azure-openai-responses-f38x2avq.js} +13 -13
- package/dist/{boot-reembed-92292pgf.js → boot-reembed-3cmrrmpa.js} +8 -8
- package/dist/{boot-reembed-n15q6s9x.js → boot-reembed-nafcmmmc.js} +13 -15
- package/dist/{boot-scrub-logs-44pc955m.js → boot-scrub-logs-cd6a2sq0.js} +5 -5
- package/dist/{claude-adapter-cjegjbje.js → claude-adapter-wfp2gzvz.js} +12 -13
- package/dist/{claude-managed-adapter-p3ts5m9m.js → claude-managed-adapter-dsmkcrjy.js} +3 -3
- package/dist/{claude-sdk-session-7ywbn12v.js → claude-sdk-session-bht9jjak.js} +12 -13
- package/dist/{cli-ceb5y160.js → cli-0qb1z6s2.js} +1 -1
- package/dist/{cli-ryz8q8p1.js → cli-2tbvf1z1.js} +40 -40
- package/dist/{cli-zthatyrx.js → cli-3v9xhjcn.js} +5 -5
- package/dist/{cli-mzb0n642.js → cli-4wppfkcm.js} +350 -20
- package/dist/{cli-3ckzxdt1.js → cli-5jd2z7av.js} +90 -81
- package/dist/{cli-3mh119qv.js → cli-5tpgq60f.js} +9726 -693
- package/dist/{cli-ck1vqzdj.js → cli-7tgcstn2.js} +9 -4
- package/dist/{cli-ttje5a4z.js → cli-9004vfdf.js} +105 -56
- package/dist/{cli-asvrh7kj.js → cli-9xvdm3bx.js} +1 -1
- package/dist/{cli-9gqddmxs.js → cli-a1z3h107.js} +8 -8
- package/dist/{cli-72xdszyx.js → cli-czjtgfys.js} +2 -2
- package/dist/{cli-5my3bjsd.js → cli-d3p82erb.js} +7 -7
- package/dist/{cli-kyysm7m3.js → cli-f1wky6zp.js} +1 -1
- package/dist/{cli-a45d5v9b.js → cli-fm4ytsdk.js} +2 -2
- package/dist/{cli-111ey3ra.js → cli-frcta2w4.js} +5 -5
- package/dist/{cli-h505yhex.js → cli-g69fdc9g.js} +2 -2
- package/dist/{cli-cmp8g3sw.js → cli-gbfwcd3k.js} +44 -9
- package/dist/{cli-hbagregr.js → cli-gjyvhmmh.js} +88 -13
- package/dist/{cli-hmyynq9b.js → cli-ht5rs63n.js} +1 -1
- package/dist/{cli-dyx0237s.js → cli-j4nv2wqy.js} +2 -4
- package/dist/{cli-vr6qj104.js → cli-j9xczhaq.js} +1 -1
- package/dist/cli-pf9q3696.js +172 -0
- package/dist/{cli-7fesa1ky.js → cli-pgj4a5fb.js} +1 -1
- package/dist/{cli-7kwmt3r5.js → cli-ppm4975n.js} +9 -3
- package/dist/{cli-8chp8xab.js → cli-q88st9aj.js} +2 -2
- package/dist/{cli-kt7wevqh.js → cli-r2q6pevn.js} +132 -46
- package/dist/{cli-07jd68a1.js → cli-re8z5p8p.js} +1 -1
- package/dist/{cli-qp69dd5d.js → cli-s14agm5s.js} +105 -12
- package/dist/{cli-zd21jrrc.js → cli-sjaae6ff.js} +9872 -424
- package/dist/{cli-taym3dmg.js → cli-vwm416m6.js} +13 -13
- package/dist/{cli-1mx65de9.js → cli-wbyk465z.js} +1 -1
- package/dist/{cli-n75jt793.js → cli-z61ykvam.js} +6 -5
- package/dist/{cli-gm0fhz13.js → cli-zkxymas5.js} +2 -1
- package/dist/cli.js +22 -21
- package/dist/{codex-adapter-rn3aq7jm.js → codex-adapter-jjjk8w4m.js} +8 -9
- package/dist/{codex-hook-gthcmm0g.js → codex-hook-8jexc34x.js} +2 -2
- package/dist/{codex-session-runner-bge0cbsw.js → codex-session-runner-nd6ayxkx.js} +8 -9
- package/dist/{commands-26phw0pc.js → commands-9v4psyq1.js} +5 -5
- package/dist/{db-jxjx6s1b.js → db-wnt58tpe.js} +5 -5
- package/dist/dispatcher-05jh1aqk.js +74 -0
- package/dist/{google-generative-ai-tsskx7te.js → google-generative-ai-ndjmj5fa.js} +7 -7
- package/dist/{google-vertex-pkhpkbq9.js → google-vertex-fr665tqs.js} +10 -10
- package/dist/handlers-tw90pkh5.js +65 -0
- package/dist/{hook-t6fqsggw.js → hook-123e2scb.js} +9 -10
- package/dist/{hook-jw0ztn96.js → hook-sxe3r349.js} +9 -10
- package/dist/{http-hyc7s57s.js → http-ecsar8ez.js} +1431 -579
- package/dist/{index-sfhaq59d.js → index-16js521z.js} +119 -101
- package/dist/{index-wtwpthe1.js → index-hw26vj40.js} +25 -19
- package/dist/{index-bcyx5djw.js → index-nnrbpcjp.js} +25 -17
- package/dist/index-ymn7em0p.js +25 -0
- package/dist/{index-1d9r6a74.js → index-zj518gf9.js} +26 -20
- package/dist/{keepalive-fbsak4ya.js → keepalive-asqtcm4y.js} +7 -7
- package/dist/{lead-rdzdm627.js → lead-xbfr7fvt.js} +41 -49
- package/dist/{maintenance-25z1c1vf.js → maintenance-qma55qvw.js} +8 -8
- package/dist/{node-209sxmg3.js → node-x1g4v0pq.js} +9 -9
- package/dist/{oauth-refresh-sweep-j3d7gtse.js → oauth-refresh-sweep-3s04c6qw.js} +6 -6
- package/dist/{onboard-dkcwrc75.js → onboard-drskd386.js} +13 -4
- package/dist/{openai-codex-responses-pm5gnyfa.js → openai-codex-responses-wy6a43wd.js} +11 -11
- package/dist/{openai-responses-vwvk1taj.js → openai-responses-6xwf7bzg.js} +13 -13
- package/dist/{opencode-adapter-dce4wskd.js → opencode-adapter-28axqa09.js} +4 -4
- package/dist/{otel-impl-8rgyy3j8.js → otel-impl-943c96er.js} +1 -1
- package/dist/{pi-mono-adapter-4s2bbkgq.js → pi-mono-adapter-jcqt71cg.js} +14 -16
- package/dist/{pricing-refresh-9cek71nq.js → pricing-refresh-mx51az05.js} +7 -7
- package/dist/{rbac-roles-z98s2ypy.js → rbac-roles-78baecqd.js} +13 -9
- package/dist/{rbac-roles-vk8mqp9v.js → rbac-roles-wcmrg6sv.js} +7 -7
- package/dist/{render-v2-3j26g0qh.js → render-v2-8zjntgf5.js} +7 -7
- package/dist/{seed-pricing-7rxhcnzm.js → seed-pricing-jqjs6cws.js} +6 -6
- package/dist/{setup-e2t7vz0c.js → setup-4pks0vfk.js} +2 -2
- package/dist/{work-objects-8d3nd3x2.js → work-objects-wangt792.js} +38 -14
- package/dist/{worker-0x9fn7nq.js → worker-p2mr422x.js} +41 -49
- package/openapi.json +1351 -265
- package/package.json +2 -1
- package/src/agentmail/handlers.ts +95 -71
- package/src/be/db-client.ts +5 -0
- package/src/be/db.ts +11 -3
- package/src/be/extensions/db.ts +461 -0
- package/src/be/extensions/validate.ts +107 -0
- package/src/be/memory/boot-reembed.ts +17 -12
- package/src/be/memory/index.ts +12 -0
- package/src/be/memory/providers/openai-embedding.ts +4 -0
- package/src/be/memory/types.ts +2 -0
- package/src/be/migrations/155_extensions.sql +66 -0
- package/src/be/migrations/156_inbox_item_state_read_at.sql +7 -0
- package/src/be/rbac-roles.ts +3 -2
- package/src/be/scripts/typecheck.ts +52 -38
- package/src/be/seed-skills/index.ts +7 -0
- package/src/be/swarm-config-guard.ts +3 -1
- package/src/commands/onboard/compose-generator.ts +14 -2
- package/src/commands/onboard/env-generator.ts +7 -0
- package/src/commands/runner.ts +1 -1
- package/src/extensions/apply-task-create.ts +135 -0
- package/src/extensions/bundle-path.ts +10 -0
- package/src/extensions/contract-runtime.ts +7 -0
- package/src/extensions/contract-types.generated.ts +4 -0
- package/src/extensions/contract.ts +270 -0
- package/src/extensions/ctx.ts +186 -0
- package/src/extensions/dispatcher.ts +479 -0
- package/src/extensions/identity.ts +44 -0
- package/src/extensions/lifecycle.ts +281 -0
- package/src/extensions/loader.ts +207 -0
- package/src/extensions/post-bridge.ts +161 -0
- package/src/github/handlers.ts +185 -149
- package/src/gitlab/handlers.ts +97 -81
- package/src/heartbeat/heartbeat.ts +152 -83
- package/src/http/agents.ts +1 -1
- package/src/http/all-routes.ts +1 -0
- package/src/http/apps.ts +14 -10
- package/src/http/core.ts +34 -0
- package/src/http/extensions.ts +547 -0
- package/src/http/inbox-state.ts +2 -0
- package/src/http/index.ts +25 -0
- package/src/http/mcp-bridge.ts +96 -62
- package/src/http/mcp.ts +1 -1
- package/src/http/status.ts +6 -4
- package/src/http/tasks.ts +51 -35
- package/src/integrations/kapso/inbound.ts +15 -11
- package/src/jira/sync.ts +26 -18
- package/src/linear/sync.ts +26 -18
- package/src/prompts/session-templates.ts +5 -4
- package/src/rbac/admission.ts +1 -1
- package/src/rbac/elevated-agents.ts +24 -0
- package/src/rbac/legacy-policy.ts +35 -6
- package/src/rbac/permissions.ts +8 -0
- package/src/scheduler/deferred-task-waits.ts +133 -51
- package/src/scheduler/schedule-task.ts +50 -24
- package/src/scheduler/scheduler.ts +4 -2
- package/src/scripts-runtime/executors/native.ts +5 -1
- package/src/scripts-runtime/executors/types.ts +5 -0
- package/src/scripts-runtime/import-allowlist.ts +79 -19
- package/src/scripts-runtime/sdk-allowlist.ts +4 -0
- package/src/scripts-runtime/swarm-config.ts +8 -0
- package/src/scripts-runtime/swarm-sdk.ts +3 -0
- package/src/scripts-runtime/types/stdlib.d.ts +9 -0
- package/src/scripts-runtime/types/swarm-extension.d.ts +562 -0
- package/src/scripts-runtime/types/swarm-sdk.d.ts +9 -0
- package/src/server.ts +6 -0
- package/src/slack/HEURISTICS.md +1 -1
- package/src/slack/actions.ts +21 -17
- package/src/slack/blocks.ts +1 -1
- package/src/slack/handlers.ts +98 -5
- package/src/slack/inbound-files.ts +6 -2
- package/src/slack/render-v2.ts +171 -35
- package/src/slack/router.ts +13 -3
- package/src/slack/steering.ts +3 -3
- package/src/tasks/errors.ts +9 -0
- package/src/tasks/sibling-awareness.ts +35 -1
- package/src/tasks/worker-follow-up.ts +64 -12
- package/src/tests/base-prompt.test.ts +1 -0
- package/src/tests/deferred-task-wake.test.ts +161 -9
- package/src/tests/docs-index-footprint.test.js +3 -3
- package/src/tests/env-flag.test.ts +1 -0
- package/src/tests/extensions-db.test.ts +216 -0
- package/src/tests/extensions-dispatcher.test.ts +275 -0
- package/src/tests/extensions-example-heartbeat-remediate.test.ts +69 -0
- package/src/tests/extensions-example-mcp-install.test.ts +63 -0
- package/src/tests/extensions-example-no-exclamation-marks.test.ts +72 -0
- package/src/tests/extensions-example-rewrite-and-suppress.test.ts +70 -0
- package/src/tests/extensions-example-route-slack-channel.test.ts +217 -0
- package/src/tests/extensions-heartbeat.test.ts +291 -0
- package/src/tests/extensions-http.test.ts +431 -0
- package/src/tests/extensions-lead-equivalence.test.ts +49 -0
- package/src/tests/extensions-lifecycle.test.ts +209 -0
- package/src/tests/extensions-loader.test.ts +95 -0
- package/src/tests/extensions-mcp-tools.test.ts +245 -0
- package/src/tests/extensions-pre-task.test.ts +487 -0
- package/src/tests/extensions-run-context.test.ts +41 -0
- package/src/tests/extensions-tool-call.test.ts +288 -0
- package/src/tests/extensions-validate.test.ts +196 -0
- package/src/tests/fixtures/extensions/bad-import/hooks.ts +8 -0
- package/src/tests/fixtures/extensions/bad-import/manifest.json +9 -0
- package/src/tests/fixtures/extensions/bad-return-shape/hooks.ts +10 -0
- package/src/tests/fixtures/extensions/bad-return-shape/manifest.json +9 -0
- package/src/tests/fixtures/extensions/block-tasks-from-source/hooks.ts +22 -0
- package/src/tests/fixtures/extensions/block-tasks-from-source/manifest.json +9 -0
- package/src/tests/fixtures/extensions/ignore-channel/hooks.ts +22 -0
- package/src/tests/fixtures/extensions/ignore-channel/manifest.json +9 -0
- package/src/tests/fixtures/extensions/load.ts +10 -0
- package/src/tests/fixtures/extensions/minimal/hooks.ts +7 -0
- package/src/tests/fixtures/extensions/minimal/manifest.json +9 -0
- package/src/tests/fixtures/extensions/never-fail-long-tasks/hooks.ts +11 -0
- package/src/tests/fixtures/extensions/never-fail-long-tasks/manifest.json +9 -0
- package/src/tests/fixtures/extensions/no-exclamation-marks/hooks.ts +23 -0
- package/src/tests/fixtures/extensions/no-exclamation-marks/manifest.json +9 -0
- package/src/tests/fixtures/extensions/post-logger/hooks.ts +9 -0
- package/src/tests/fixtures/extensions/post-logger/manifest.json +9 -0
- package/src/tests/fixtures/extensions/priority-a/hooks.ts +7 -0
- package/src/tests/fixtures/extensions/priority-a/manifest.json +9 -0
- package/src/tests/fixtures/extensions/priority-b/hooks.ts +7 -0
- package/src/tests/fixtures/extensions/priority-b/manifest.json +9 -0
- package/src/tests/fixtures/extensions/record-only-on-tag/hooks.ts +16 -0
- package/src/tests/fixtures/extensions/record-only-on-tag/manifest.json +9 -0
- package/src/tests/fixtures/extensions/reserved-assets/hooks.ts +5 -0
- package/src/tests/fixtures/extensions/reserved-assets/manifest.json +10 -0
- package/src/tests/fixtures/extensions/rewrite-progress-prefix/hooks.ts +22 -0
- package/src/tests/fixtures/extensions/rewrite-progress-prefix/manifest.json +9 -0
- package/src/tests/fixtures/extensions/rewrite-task-priority/hooks.ts +7 -0
- package/src/tests/fixtures/extensions/rewrite-task-priority/manifest.json +9 -0
- package/src/tests/fixtures/extensions/route-channel-to-agent/hooks.ts +26 -0
- package/src/tests/fixtures/extensions/route-channel-to-agent/manifest.json +9 -0
- package/src/tests/fixtures/extensions/slow/hooks.ts +10 -0
- package/src/tests/fixtures/extensions/slow/manifest.json +9 -0
- package/src/tests/fixtures/extensions/suppress-lead-follow-up/hooks.ts +12 -0
- package/src/tests/fixtures/extensions/suppress-lead-follow-up/manifest.json +9 -0
- package/src/tests/fixtures/extensions/throws/hooks.ts +12 -0
- package/src/tests/fixtures/extensions/throws/manifest.json +9 -0
- package/src/tests/fixtures/extensions/worker-runtime/hooks.ts +5 -0
- package/src/tests/fixtures/extensions/worker-runtime/manifest.json +9 -0
- package/src/tests/memory-edit-authorization.test.ts +32 -0
- package/src/tests/multi-runtime-enabled-stats.test.ts +2 -2
- package/src/tests/multi-runtime-registration.test.ts +14 -14
- package/src/tests/onboard-compose.test.ts +44 -0
- package/src/tests/preload.ts +5 -0
- package/src/tests/rbac-admission.test.ts +18 -3
- package/src/tests/rbac-engine.test.ts +39 -0
- package/src/tests/realtime-room-auth.test.ts +1 -1
- package/src/tests/reload-config.test.ts +44 -0
- package/src/tests/routing-affinity-inventory.test.ts +1 -1
- package/src/tests/script-connections.test.ts +2 -0
- package/src/tests/scripts-boot-reembed.test.ts +4 -0
- package/src/tests/scripts-embeddings.test.ts +4 -0
- package/src/tests/scripts-import-allowlist.test.ts +44 -1
- package/src/tests/scripts-mcp-e2e.test.ts +80 -0
- package/src/tests/scripts-only-gating.test.ts +2 -0
- package/src/tests/scripts-runtime-identity.test.ts +1 -1
- package/src/tests/slack-blocks.test.ts +12 -1
- package/src/tests/slack-render-v2.test.ts +76 -3
- package/src/tests/slack-router.test.ts +17 -2
- package/src/tests/slack-steering.test.ts +19 -0
- package/src/tests/status.test.ts +12 -0
- package/src/tests/steering-enabled.test.ts +6 -8
- package/src/tests/task-tool-preload-mcp.test.ts +4 -1
- package/src/tests/tool-annotations.test.ts +1 -1
- package/src/tests/tool-registrar-no-input.test.ts +42 -1
- package/src/tools/defer-task.ts +1 -1
- package/src/tools/extension-common.ts +84 -0
- package/src/tools/extension-install.ts +65 -0
- package/src/tools/extension-list.ts +66 -0
- package/src/tools/script-common.ts +43 -18
- package/src/tools/send-task.ts +69 -107
- package/src/tools/task-action.ts +43 -22
- package/src/tools/task-tool-ctx.ts +2 -0
- package/src/tools/tool-config.ts +3 -1
- package/src/tools/utils.ts +140 -16
- package/src/types.ts +133 -0
- package/src/utils/multi-runtime.ts +2 -2
- package/src/utils/steering-enabled.ts +4 -4
- package/src/workflows/executors/agent-task.ts +13 -3
- package/templates/extensions/README.md +17 -0
- package/templates/extensions/notify-on-complete/README.md +11 -0
- package/templates/extensions/notify-on-complete/hooks.ts +61 -0
- package/templates/extensions/notify-on-complete/manifest.json +7 -0
- package/templates/extensions/require-ticket-ref/README.md +11 -0
- package/templates/extensions/require-ticket-ref/hooks.ts +30 -0
- package/templates/extensions/require-ticket-ref/manifest.json +7 -0
- package/templates/extensions/require-verification-note/README.md +11 -0
- package/templates/extensions/require-verification-note/hooks.ts +32 -0
- package/templates/extensions/require-verification-note/manifest.json +7 -0
- package/templates/skills/scheduling/content.md +2 -0
- package/templates/skills/swarm-extensions/config.json +14 -0
- package/templates/skills/swarm-extensions/content.md +120 -0
- package/dist/cli-b8x19vbh.js +0 -823
- package/dist/cli-n1yj5fd5.js +0 -164
- package/dist/cli-q04q68be.js +0 -3066
- package/dist/cli-qgm2pfpq.js +0 -6377
- package/dist/cli-rnsr8asm.js +0 -4323
- package/dist/cli-rwp3ksm7.js +0 -545
- package/dist/cli-xjb9wghj.js +0 -668
- package/dist/cli-xvkmedgn.js +0 -332
- package/dist/cli-ydk0wjj8.js +0 -338
- package/dist/handlers-vr1djg4n.js +0 -41
- package/dist/{claude-managed-setup-f5pmsyrp.js → claude-managed-setup-48dwg9bv.js} +3 -3
- package/dist/{cli-81r683bv.js → cli-ch38q5z4.js} +0 -0
- package/dist/{cli-wk0gjrn3.js → cli-kj76p1ez.js} +6 -6
- package/dist/{cli-c71mg51n.js → cli-r2fpe7cx.js} +5 -5
- package/dist/{cli-8qx7jnrk.js → cli-y6x0gqtg.js} +16 -16
- package/dist/{index-aa3sa6s8.js → index-2wsdsnmm.js} +1 -1
- package/dist/{mistral-conversations-4ryk7h83.js → mistral-conversations-qhr84ph3.js} +9 -9
- package/dist/{openai-completions-qdcmkfnr.js → openai-completions-32rdwmze.js} +17 -17
- package/dist/{openrouter-images-qx18fyp8.js → openrouter-images-9f9ek4rw.js} +3 -3
- package/dist/{pi-messages-79jvzz1d.js → pi-messages-b1mbr6gp.js} +4 -4
|
@@ -5,32 +5,36 @@ import {
|
|
|
5
5
|
instantFlush,
|
|
6
6
|
requestSlackThreadSteering,
|
|
7
7
|
wasEventSeen
|
|
8
|
-
} from "./cli-
|
|
8
|
+
} from "./cli-a1z3h107.js";
|
|
9
9
|
import {
|
|
10
|
+
enrichSlackUserEmail,
|
|
11
|
+
resolveSlackUserId,
|
|
12
|
+
rewriteSlackMentions
|
|
13
|
+
} from "./cli-czjtgfys.js";
|
|
14
|
+
import {
|
|
15
|
+
TaskCreationBlockedError,
|
|
16
|
+
broadcastMatches,
|
|
10
17
|
buildEffectiveText,
|
|
11
18
|
createSlackTaskWithFiles,
|
|
19
|
+
dispatchPre,
|
|
12
20
|
extractSlackMessageText,
|
|
13
21
|
extractTaskFromMessage,
|
|
14
22
|
fetchSlackFiles,
|
|
15
23
|
hasOtherUserMention,
|
|
16
24
|
notifySlackFileFailures,
|
|
17
25
|
routeMessage
|
|
18
|
-
} from "./cli-
|
|
19
|
-
import {
|
|
20
|
-
enrichSlackUserEmail,
|
|
21
|
-
resolveSlackUserId,
|
|
22
|
-
rewriteSlackMentions
|
|
23
|
-
} from "./cli-72xdszyx.js";
|
|
26
|
+
} from "./cli-5tpgq60f.js";
|
|
24
27
|
import {
|
|
25
28
|
ackSlackMessage,
|
|
26
29
|
buildTreeBlocks,
|
|
27
30
|
ensureSlackThreadTree,
|
|
28
31
|
isSlackRenderV2Enabled,
|
|
29
32
|
registerTreeMessage
|
|
30
|
-
} from "./cli-
|
|
33
|
+
} from "./cli-r2q6pevn.js";
|
|
31
34
|
import {
|
|
32
35
|
getAgentById,
|
|
33
36
|
getAgentWorkingOnThread,
|
|
37
|
+
getAllAgents,
|
|
34
38
|
getLeadAgent,
|
|
35
39
|
getMostRecentTaskInThread,
|
|
36
40
|
getTasksByAgentId,
|
|
@@ -38,15 +42,25 @@ import {
|
|
|
38
42
|
init_db,
|
|
39
43
|
reactionName,
|
|
40
44
|
slackContextKey
|
|
41
|
-
} from "./cli-
|
|
45
|
+
} from "./cli-s14agm5s.js";
|
|
42
46
|
import {
|
|
43
47
|
init_resolver,
|
|
44
48
|
resolveTemplate
|
|
45
|
-
} from "./cli-
|
|
49
|
+
} from "./cli-z61ykvam.js";
|
|
46
50
|
import {
|
|
47
51
|
init_env_flag,
|
|
48
52
|
isEnvFlagEnabled
|
|
49
53
|
} from "./cli-ej6gbxfb.js";
|
|
54
|
+
import {
|
|
55
|
+
init_zod
|
|
56
|
+
} from "./cli-sd0mxa3c.js";
|
|
57
|
+
import {
|
|
58
|
+
exports_external
|
|
59
|
+
} from "./cli-w5e1d1vv.js";
|
|
60
|
+
import {
|
|
61
|
+
init_secret_scrubber,
|
|
62
|
+
scrubSecrets
|
|
63
|
+
} from "./cli-r2ap2czm.js";
|
|
50
64
|
import {
|
|
51
65
|
init_event_bus,
|
|
52
66
|
workflowEventBus
|
|
@@ -57,11 +71,20 @@ import {
|
|
|
57
71
|
} from "./cli-bc05qbss.js";
|
|
58
72
|
|
|
59
73
|
// src/slack/handlers.ts
|
|
74
|
+
init_zod();
|
|
60
75
|
init_db();
|
|
61
76
|
init_resolver();
|
|
62
77
|
init_context_key();
|
|
78
|
+
init_secret_scrubber();
|
|
63
79
|
init_event_bus();
|
|
64
80
|
init_env_flag();
|
|
81
|
+
var SlackRouteModifySchema = exports_external.object({
|
|
82
|
+
target: exports_external.discriminatedUnion("kind", [
|
|
83
|
+
exports_external.object({ kind: exports_external.literal("agent"), agentId: exports_external.string().min(1) }).strict(),
|
|
84
|
+
exports_external.object({ kind: exports_external.literal("lead") }).strict(),
|
|
85
|
+
exports_external.object({ kind: exports_external.literal("broadcast") }).strict()
|
|
86
|
+
])
|
|
87
|
+
}).strict();
|
|
65
88
|
var allowedEmailDomains = (process.env.SLACK_ALLOWED_EMAIL_DOMAINS || "").split(",").map((d) => d.trim().toLowerCase()).filter(Boolean);
|
|
66
89
|
var allowedUserIds = (process.env.SLACK_ALLOWED_USER_IDS || "").split(",").map((id) => id.trim()).filter(Boolean);
|
|
67
90
|
var filteringEnabled = allowedEmailDomains.length > 0 || allowedUserIds.length > 0;
|
|
@@ -274,8 +297,10 @@ function registerMessageHandler(app) {
|
|
|
274
297
|
});
|
|
275
298
|
workflowEventBus.emit("slack.message", {
|
|
276
299
|
channel: msg.channel,
|
|
300
|
+
channelId: msg.channel,
|
|
277
301
|
text: msg.text,
|
|
278
302
|
user: msg.user,
|
|
303
|
+
userId: msg.user,
|
|
279
304
|
ts: msg.ts,
|
|
280
305
|
threadTs: msg.thread_ts
|
|
281
306
|
});
|
|
@@ -323,7 +348,45 @@ function registerMessageHandler(app) {
|
|
|
323
348
|
}
|
|
324
349
|
const routingText = msg.text || effectiveText;
|
|
325
350
|
const routingThreadContext = msg.thread_ts ? { channelId: msg.channel, threadTs: msg.thread_ts } : undefined;
|
|
326
|
-
const
|
|
351
|
+
const routeResult = await dispatchPre("pre.slack.route", {
|
|
352
|
+
channelId: msg.channel,
|
|
353
|
+
userId: msg.user,
|
|
354
|
+
text: routingText,
|
|
355
|
+
...msg.thread_ts ? { threadTs: msg.thread_ts } : {},
|
|
356
|
+
botMentioned: botMentioned || isImplicitMention,
|
|
357
|
+
...routingThreadContext ? { threadContext: routingThreadContext } : {}
|
|
358
|
+
}, {
|
|
359
|
+
validateModify: (data) => {
|
|
360
|
+
const parsed = SlackRouteModifySchema.safeParse(data);
|
|
361
|
+
return parsed.success ? { success: true, data: parsed.data } : { success: false, error: new Error(parsed.error.message) };
|
|
362
|
+
}
|
|
363
|
+
});
|
|
364
|
+
if (routeResult.action === "block") {
|
|
365
|
+
console.info("[Slack] Extension blocked message routing:", scrubSecrets(routeResult.reason));
|
|
366
|
+
return;
|
|
367
|
+
}
|
|
368
|
+
let matches;
|
|
369
|
+
if (routeResult.action === "modify") {
|
|
370
|
+
const { target } = routeResult.data;
|
|
371
|
+
if (target.kind === "agent") {
|
|
372
|
+
const agent = await getAgentById(target.agentId);
|
|
373
|
+
if (agent) {
|
|
374
|
+
matches = [{ agent, matchedText: "extension" }];
|
|
375
|
+
} else {
|
|
376
|
+
console.warn("[Slack] Extension selected an unknown agent. Using the built-in router:", scrubSecrets(target.agentId));
|
|
377
|
+
}
|
|
378
|
+
} else if (target.kind === "lead") {
|
|
379
|
+
const leadAgent = await getLeadAgent();
|
|
380
|
+
if (leadAgent) {
|
|
381
|
+
matches = [{ agent: leadAgent, matchedText: "extension" }];
|
|
382
|
+
} else {
|
|
383
|
+
console.warn(scrubSecrets("[Slack] Extension selected the lead, but no lead exists. Using the built-in router."));
|
|
384
|
+
}
|
|
385
|
+
} else {
|
|
386
|
+
matches = broadcastMatches(await getAllAgents());
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
matches ??= await routeMessage(routingText, botUserId, botMentioned || isImplicitMention, routingThreadContext);
|
|
327
390
|
if (matches.length === 0) {
|
|
328
391
|
let __stack = [];
|
|
329
392
|
try {
|
|
@@ -494,8 +557,11 @@ ${taskDescription}`;
|
|
|
494
557
|
} else {
|
|
495
558
|
results.assigned.push({ agentName: agent.name, taskId: task.id });
|
|
496
559
|
}
|
|
497
|
-
} catch {
|
|
498
|
-
results.failed.push({
|
|
560
|
+
} catch (error) {
|
|
561
|
+
results.failed.push({
|
|
562
|
+
agentName: agent.name,
|
|
563
|
+
reason: error instanceof TaskCreationBlockedError ? error.reason : "error"
|
|
564
|
+
});
|
|
499
565
|
}
|
|
500
566
|
}
|
|
501
567
|
if (results.assigned.length + results.queued.length > 0) {
|
|
@@ -507,6 +573,15 @@ ${taskDescription}`;
|
|
|
507
573
|
if (isSlackRenderV2Enabled()) {
|
|
508
574
|
if (successfulTaskIds.length > 0)
|
|
509
575
|
await ensureSlackThreadTree(successfulTaskIds);
|
|
576
|
+
if (results.failed.length > 0) {
|
|
577
|
+
const failedLines = results.failed.map((f) => `⚠️ Could not assign to: *${f.agentName}* — ${f.reason}`).join(`
|
|
578
|
+
`);
|
|
579
|
+
await say({
|
|
580
|
+
text: `Could not assign to: ${results.failed.map((f) => f.agentName).join(", ")}`,
|
|
581
|
+
blocks: [{ type: "context", elements: [{ type: "mrkdwn", text: failedLines }] }],
|
|
582
|
+
thread_ts: msg.thread_ts || msg.ts
|
|
583
|
+
});
|
|
584
|
+
}
|
|
510
585
|
} else {
|
|
511
586
|
const initialNodes = results.assigned.map(({ agentName, taskId }) => ({
|
|
512
587
|
taskId,
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BASE_SUMMARIZE_PROMPT,
|
|
3
3
|
SummaryWithRatingsSchema,
|
|
4
|
-
buildSummaryWithRatingsPrompt
|
|
5
|
-
} from "./cli-xvkmedgn.js";
|
|
6
|
-
import {
|
|
4
|
+
buildSummaryWithRatingsPrompt,
|
|
7
5
|
complete,
|
|
8
6
|
exports_typebox,
|
|
9
7
|
getBuiltinModel,
|
|
10
8
|
parseModelStr,
|
|
11
9
|
resolveCredential
|
|
12
|
-
} from "./cli-
|
|
10
|
+
} from "./cli-4wppfkcm.js";
|
|
13
11
|
import {
|
|
14
12
|
DEFAULT_OPENROUTER_BASE_URL,
|
|
15
13
|
getOpenRouterBaseUrl
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
// src/prompts/memories.ts
|
|
2
|
+
var SIMILARITY_THRESHOLD = 0.4;
|
|
3
|
+
var RATE_TOOL_HINT = `
|
|
4
|
+
|
|
5
|
+
When a memory above genuinely helps you solve this task — or actively
|
|
6
|
+
misleads you — call \`memory_rate\` with the memory id and useful=true/false.
|
|
7
|
+
This trains the swarm to surface better memories next time. Use sparingly:
|
|
8
|
+
2-5 ratings per task is plenty.`;
|
|
9
|
+
function renderMemoriesPrompt(memories) {
|
|
10
|
+
const useful = memories.filter((m) => m.similarity > SIMILARITY_THRESHOLD);
|
|
11
|
+
if (useful.length === 0)
|
|
12
|
+
return null;
|
|
13
|
+
const memoryContext = useful.map((m) => `- **${m.name}** (id: ${m.id}): ${m.content.substring(0, 300)}`).join(`
|
|
14
|
+
`);
|
|
15
|
+
let prompt = `
|
|
16
|
+
|
|
17
|
+
### Relevant Past Knowledge
|
|
18
|
+
|
|
19
|
+
These memories from your previous sessions may be useful. Use \`memory-get\` with the memory ID to retrieve full details.
|
|
20
|
+
|
|
21
|
+
${memoryContext}
|
|
22
|
+
`;
|
|
23
|
+
if (isExplicitSelfRaterEnabled()) {
|
|
24
|
+
prompt += RATE_TOOL_HINT;
|
|
25
|
+
}
|
|
26
|
+
return prompt;
|
|
27
|
+
}
|
|
28
|
+
function isExplicitSelfRaterEnabled() {
|
|
29
|
+
const ratersEnabled = (process.env.MEMORY_RATERS ?? "").split(",").map((s) => s.trim()).filter(Boolean);
|
|
30
|
+
return ratersEnabled.includes("explicit-self");
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// src/utils/skill-fs-writer.ts
|
|
34
|
+
import { existsSync, mkdirSync, readdirSync, rmSync, writeFileSync } from "node:fs";
|
|
35
|
+
import { dirname, join } from "node:path";
|
|
36
|
+
var SWARM_MARKER_FILE = ".swarm-managed";
|
|
37
|
+
function reconcileManagedSkillFiles(skillDir, currentRelativeFiles) {
|
|
38
|
+
if (!existsSync(join(skillDir, SWARM_MARKER_FILE)))
|
|
39
|
+
return 0;
|
|
40
|
+
let removed = 0;
|
|
41
|
+
const walk = (dir, relativeDir = "") => {
|
|
42
|
+
let entries;
|
|
43
|
+
try {
|
|
44
|
+
entries = readdirSync(dir, { withFileTypes: true });
|
|
45
|
+
} catch {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
let hasEntries = false;
|
|
49
|
+
for (const entry of entries) {
|
|
50
|
+
const relativePath = relativeDir ? `${relativeDir}/${entry.name}` : entry.name;
|
|
51
|
+
const fullPath = join(dir, entry.name);
|
|
52
|
+
if (entry.isDirectory()) {
|
|
53
|
+
const childHasEntries = walk(fullPath, relativePath);
|
|
54
|
+
if (!childHasEntries) {
|
|
55
|
+
try {
|
|
56
|
+
rmSync(fullPath, { recursive: true, force: true });
|
|
57
|
+
} catch {
|
|
58
|
+
hasEntries = true;
|
|
59
|
+
}
|
|
60
|
+
} else {
|
|
61
|
+
hasEntries = true;
|
|
62
|
+
}
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
if (relativePath === "SKILL.md" || relativePath === SWARM_MARKER_FILE || currentRelativeFiles.has(relativePath)) {
|
|
66
|
+
hasEntries = true;
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
try {
|
|
70
|
+
rmSync(fullPath, { force: true });
|
|
71
|
+
removed++;
|
|
72
|
+
} catch {
|
|
73
|
+
hasEntries = true;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return hasEntries;
|
|
77
|
+
};
|
|
78
|
+
walk(skillDir);
|
|
79
|
+
return removed;
|
|
80
|
+
}
|
|
81
|
+
function writeSkillsToFilesystem(entries, harnessType = "all", home) {
|
|
82
|
+
const errors = [];
|
|
83
|
+
let synced = 0;
|
|
84
|
+
let removed = 0;
|
|
85
|
+
const skillDirs = [];
|
|
86
|
+
if (harnessType === "claude" || harnessType === "all") {
|
|
87
|
+
skillDirs.push(join(home, ".claude", "skills"));
|
|
88
|
+
}
|
|
89
|
+
if (harnessType === "pi" || harnessType === "all") {
|
|
90
|
+
skillDirs.push(join(home, ".pi", "agent", "skills"));
|
|
91
|
+
}
|
|
92
|
+
if (harnessType === "codex" || harnessType === "all") {
|
|
93
|
+
skillDirs.push(join(home, ".codex", "skills"));
|
|
94
|
+
}
|
|
95
|
+
if (harnessType === "opencode" || harnessType === "all") {
|
|
96
|
+
skillDirs.push(join(home, ".opencode", "skills"));
|
|
97
|
+
}
|
|
98
|
+
if (harnessType === "agents" || harnessType === "all") {
|
|
99
|
+
skillDirs.push(join(home, ".agents", "skills"));
|
|
100
|
+
}
|
|
101
|
+
for (const dir of skillDirs) {
|
|
102
|
+
mkdirSync(dir, { recursive: true });
|
|
103
|
+
}
|
|
104
|
+
const writtenNames = new Set;
|
|
105
|
+
for (const skill of entries) {
|
|
106
|
+
if (!skill.isActive || !skill.isEnabled)
|
|
107
|
+
continue;
|
|
108
|
+
if (skill.isComplex && skill.files.length === 0)
|
|
109
|
+
continue;
|
|
110
|
+
if (!skill.content)
|
|
111
|
+
continue;
|
|
112
|
+
const safeName = skill.name.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
113
|
+
if (!safeName)
|
|
114
|
+
continue;
|
|
115
|
+
writtenNames.add(safeName);
|
|
116
|
+
const currentBundledFilePaths = new Set(skill.files.filter((file) => !file.isBinary).map((file) => file.path));
|
|
117
|
+
for (const baseDir of skillDirs) {
|
|
118
|
+
const skillDir = join(baseDir, safeName);
|
|
119
|
+
const skillFile = join(skillDir, "SKILL.md");
|
|
120
|
+
const markerFile = join(skillDir, SWARM_MARKER_FILE);
|
|
121
|
+
try {
|
|
122
|
+
mkdirSync(skillDir, { recursive: true });
|
|
123
|
+
removed += reconcileManagedSkillFiles(skillDir, currentBundledFilePaths);
|
|
124
|
+
writeFileSync(skillFile, skill.content, "utf-8");
|
|
125
|
+
writeFileSync(markerFile, "", "utf-8");
|
|
126
|
+
synced++;
|
|
127
|
+
} catch (err) {
|
|
128
|
+
const msg = err instanceof Error ? err.message : "Unknown error";
|
|
129
|
+
errors.push(`${skill.name} -> ${skillDir}: ${msg}`);
|
|
130
|
+
console.error(`[skill-fs-writer] Failed to write SKILL.md for ${skill.name} to ${skillDir}: ${msg}`);
|
|
131
|
+
}
|
|
132
|
+
for (const file of skill.files) {
|
|
133
|
+
if (file.isBinary) {
|
|
134
|
+
console.log(`[skill-fs-writer] Skipping binary skill file ${skill.name}/${file.path}`);
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
const targetPath = join(skillDir, file.path);
|
|
138
|
+
try {
|
|
139
|
+
mkdirSync(dirname(targetPath), { recursive: true });
|
|
140
|
+
writeFileSync(targetPath, file.content, "utf-8");
|
|
141
|
+
} catch (err) {
|
|
142
|
+
const msg = err instanceof Error ? err.message : "Unknown error";
|
|
143
|
+
errors.push(`${skill.name}/${file.path} -> ${targetPath}: ${msg}`);
|
|
144
|
+
console.error(`[skill-fs-writer] Failed to write bundled file ${skill.name}/${file.path} to ${targetPath}: ${msg}`);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
for (const baseDir of skillDirs) {
|
|
150
|
+
if (!existsSync(baseDir))
|
|
151
|
+
continue;
|
|
152
|
+
try {
|
|
153
|
+
const existing = readdirSync(baseDir, { withFileTypes: true });
|
|
154
|
+
for (const entry of existing) {
|
|
155
|
+
if (!entry.isDirectory())
|
|
156
|
+
continue;
|
|
157
|
+
if (writtenNames.has(entry.name))
|
|
158
|
+
continue;
|
|
159
|
+
const skillDir = join(baseDir, entry.name);
|
|
160
|
+
if (!existsSync(join(skillDir, SWARM_MARKER_FILE)))
|
|
161
|
+
continue;
|
|
162
|
+
try {
|
|
163
|
+
rmSync(skillDir, { recursive: true, force: true });
|
|
164
|
+
removed++;
|
|
165
|
+
} catch {}
|
|
166
|
+
}
|
|
167
|
+
} catch {}
|
|
168
|
+
}
|
|
169
|
+
return { synced, removed, errors };
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export { SIMILARITY_THRESHOLD, renderMemoriesPrompt, writeSkillsToFilesystem };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
contentSha256,
|
|
3
3
|
init_profile_sync
|
|
4
|
-
} from "./cli-
|
|
4
|
+
} from "./cli-fm4ytsdk.js";
|
|
5
5
|
import {
|
|
6
6
|
OpenAI,
|
|
7
7
|
init_openai
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
getDbClient,
|
|
12
12
|
init_db,
|
|
13
13
|
isSqliteVecAvailable
|
|
14
|
-
} from "./cli-
|
|
14
|
+
} from "./cli-s14agm5s.js";
|
|
15
15
|
import {
|
|
16
16
|
__esm,
|
|
17
17
|
__export,
|
|
@@ -93,6 +93,9 @@ class OpenAIEmbeddingProvider {
|
|
|
93
93
|
this.dimensions = config?.dimensions ?? EMBEDDING_DIMENSIONS;
|
|
94
94
|
this.name = config?.model ? `openai/${config.model}` : process.env.EMBEDDING_MODEL ?? DEFAULT_EMBEDDING_MODEL;
|
|
95
95
|
}
|
|
96
|
+
isConfigured() {
|
|
97
|
+
return !!this.apiKey;
|
|
98
|
+
}
|
|
96
99
|
getClient() {
|
|
97
100
|
if (!this.apiKey)
|
|
98
101
|
return null;
|
|
@@ -1082,6 +1085,9 @@ function getEmbeddingProvider() {
|
|
|
1082
1085
|
}
|
|
1083
1086
|
return embeddingProvider;
|
|
1084
1087
|
}
|
|
1088
|
+
function resetEmbeddingProvider() {
|
|
1089
|
+
embeddingProvider = null;
|
|
1090
|
+
}
|
|
1085
1091
|
function getMemoryStore() {
|
|
1086
1092
|
if (!memoryStore) {
|
|
1087
1093
|
const { SqliteMemoryStore: SqliteMemoryStore2 } = (init_sqlite_store(), __toCommonJS(exports_sqlite_store));
|
|
@@ -1090,4 +1096,4 @@ function getMemoryStore() {
|
|
|
1090
1096
|
return memoryStore;
|
|
1091
1097
|
}
|
|
1092
1098
|
|
|
1093
|
-
export {
|
|
1099
|
+
export { CANDIDATE_SET_MULTIPLIER, isGraphExpansionEnabled, EMBEDDING_DIMENSIONS, init_constants, cosineSimilarity, serializeEmbedding, deserializeEmbedding, init_embedding, computeScore, rerank, init_reranker, rowToCandidate, init_sqlite_store, getEmbeddingProvider, resetEmbeddingProvider, getMemoryStore };
|
|
@@ -4,11 +4,11 @@ import {
|
|
|
4
4
|
getEmbeddingProvider,
|
|
5
5
|
init_embedding,
|
|
6
6
|
serializeEmbedding
|
|
7
|
-
} from "./cli-
|
|
7
|
+
} from "./cli-ppm4975n.js";
|
|
8
8
|
import {
|
|
9
9
|
getDbClient,
|
|
10
10
|
init_db
|
|
11
|
-
} from "./cli-
|
|
11
|
+
} from "./cli-s14agm5s.js";
|
|
12
12
|
import {
|
|
13
13
|
init_secret_scrubber,
|
|
14
14
|
scrubSecrets
|