@desplega.ai/agent-swarm 2.8.2 → 2.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/acp-adapter-xq6s2z6t.js +14 -0
- package/dist/{actions-kxek041g.js → actions-ewz7bp4g.js} +20 -19
- package/dist/{amp-adapter-ce7jjke4.js → amp-adapter-f25tqhnf.js} +3 -3
- package/dist/{app-v6zz8yh0.js → app-mkptw0k7.js} +4 -4
- package/dist/{assistant-m0sw9xx2.js → assistant-c47rfe77.js} +23 -22
- package/dist/{boot-args-schema-66bk37wv.js → boot-args-schema-4vb0xsat.js} +1 -1
- package/dist/{boot-reembed-edjpwsc1.js → boot-reembed-1ghy2sab.js} +1 -1
- package/dist/{boot-reembed-y27n09tz.js → boot-reembed-htr73hbs.js} +1 -1
- package/dist/{boot-scrub-sweep-1xc35965.js → boot-scrub-sweep-yrytg42z.js} +4 -4
- package/dist/{boot-seeds-7hjj91qj.js → boot-seeds-n2b3dx4e.js} +4 -4
- package/dist/{boxd-ent8ch04.js → boxd-jmfqgkqa.js} +1 -1
- package/dist/{claude-adapter-stw7jdcf.js → claude-adapter-r33pqnzx.js} +8 -9
- package/dist/{claude-managed-adapter-jh6c523j.js → claude-managed-adapter-hddmxjyj.js} +4 -4
- package/dist/{claude-managed-setup-y6z2perp.js → claude-managed-setup-hfvry1bd.js} +5 -5
- package/dist/{claude-sdk-session-vvya8wqk.js → claude-sdk-session-0hamqzc7.js} +10 -11
- package/dist/{cli-v1dv1r37.js → cli-0bcgyj5b.js} +74 -3
- package/dist/{cli-t2tma8gb.js → cli-0vksaxvr.js} +2 -2
- package/dist/{cli-mrt48bx7.js → cli-15204js0.js} +1 -1
- package/dist/{cli-8aes17e4.js → cli-1m96dc36.js} +3 -3
- package/dist/{cli-2r0jcc3k.js → cli-2d0cghfn.js} +1 -1
- package/dist/{cli-0cq8y6m7.js → cli-4ax9mvvg.js} +4 -4
- package/dist/{cli-tekytdq9.js → cli-4dpkjc2e.js} +6 -6
- package/dist/{cli-x1wa213s.js → cli-4e1hfbpq.js} +5 -5
- package/dist/{cli-7349va39.js → cli-500c09j9.js} +921 -431
- package/dist/{cli-9mb2q6pb.js → cli-54qr8mcd.js} +2 -2
- package/dist/{cli-m88rpzkh.js → cli-5a7szzfh.js} +2 -2
- package/dist/{cli-bst1vp7e.js → cli-5y2fvw4z.js} +13 -5
- package/dist/{cli-vj75tyaw.js → cli-6yygkr0w.js} +7 -7
- package/dist/{cli-kjtwrhea.js → cli-7c5tgqhf.js} +5 -5
- package/dist/{cli-2gxeg5gr.js → cli-8476gtwf.js} +1 -1
- package/dist/{cli-zh9rsbqf.js → cli-922z7gwm.js} +3 -3
- package/dist/{cli-jrzkw01m.js → cli-93t5s4zq.js} +2 -2
- package/dist/{cli-gyt3zydq.js → cli-9zmb7ptc.js} +9 -9
- package/dist/{cli-dzpc6en0.js → cli-am1ptset.js} +2 -2
- package/dist/{cli-w401b9tq.js → cli-awwptga4.js} +1 -1
- package/dist/{cli-26ctbcdp.js → cli-bhsfbmk8.js} +3 -3
- package/dist/{cli-mxn1qvbn.js → cli-bj6qhgte.js} +14 -32
- package/dist/{cli-g70vxtjh.js → cli-c0xjnr8z.js} +2 -2
- package/dist/{cli-jdknh18m.js → cli-c3ng0mb4.js} +13 -13
- package/dist/{cli-f4e8r23x.js → cli-c71n3bxq.js} +11 -6
- package/dist/{cli-6rc5frdm.js → cli-crpf163n.js} +25 -18
- package/dist/{cli-1qkz151v.js → cli-dpsfwh7n.js} +13 -21
- package/dist/{cli-xzm9vcfg.js → cli-dtdht77h.js} +2 -2
- package/dist/{cli-a0z912j7.js → cli-e2w34h6z.js} +137 -62
- package/dist/{cli-eddnyg3t.js → cli-emekyyhr.js} +1 -1
- package/dist/{cli-d84byzn8.js → cli-f1kwb5fc.js} +109 -33
- package/dist/{cli-0jzra9ad.js → cli-gn9y6fn7.js} +2 -2
- package/dist/{cli-vdektqgf.js → cli-gpz1d0t2.js} +4 -4
- package/dist/{cli-rcecc3yq.js → cli-h9yy18gy.js} +84 -36
- package/dist/{cli-m5akxq8q.js → cli-j8cjdzan.js} +1 -1
- package/dist/{cli-m9s2qff2.js → cli-jg5txpm6.js} +187 -93
- package/dist/{cli-b98a65ed.js → cli-k2rw11py.js} +3 -3
- package/dist/{cli-3e875j5p.js → cli-k96cecs7.js} +276 -47
- package/dist/{cli-3vjhs18n.js → cli-kd56bmk4.js} +1 -1
- package/dist/{cli-3sy2xags.js → cli-kmemts3w.js} +12 -12
- package/dist/{cli-f6bahpn5.js → cli-knva3nmx.js} +2 -2
- package/dist/{cli-959kp5h2.js → cli-kw44j53p.js} +13 -13
- package/dist/{cli-bsywb58a.js → cli-mdpbjnzq.js} +10 -10
- package/dist/{cli-2kvhc7x8.js → cli-me0r8gzr.js} +35 -76
- package/dist/{cli-4vzgeta4.js → cli-mwwmka77.js} +14 -14
- package/dist/{cli-q24n86d2.js → cli-n5t077me.js} +2 -2
- package/dist/{cli-rvhdmjvt.js → cli-nx2n3z6p.js} +1 -1
- package/dist/{cli-28fq781p.js → cli-pe4d96rb.js} +1 -1
- package/dist/{cli-3rkdne1h.js → cli-pxwtcgcp.js} +2 -2
- package/dist/{cli-n6vtrcht.js → cli-qmqt520k.js} +2 -2
- package/dist/{cli-pchypa1s.js → cli-qps8je6j.js} +17 -2
- package/dist/{cli-97ae65rz.js → cli-rjvsf9qa.js} +5 -5
- package/dist/{cli-e1p3n5gq.js → cli-rqfvkx5t.js} +6 -6
- package/dist/{cli-3vmb0n58.js → cli-s7zz734a.js} +1 -1
- package/dist/{cli-rmzsadkf.js → cli-s8p8hhty.js} +2 -2
- package/dist/{cli-j24zbska.js → cli-sdvcrq5x.js} +5 -5
- package/dist/{cli-5y340nzn.js → cli-sg27rk2t.js} +5 -5
- package/dist/{cli-d6521kb5.js → cli-skmhsnqh.js} +1 -1
- package/dist/{cli-5mrq3ake.js → cli-t4dv07kr.js} +1 -1
- package/dist/{cli-z1w943va.js → cli-t5ys4ebm.js} +3 -3
- package/dist/{cli-f4r3g076.js → cli-tas6ckky.js} +2 -2
- package/dist/{cli-1pz0330a.js → cli-tf79ryyy.js} +1 -1
- package/dist/{cli-kc7v1nfv.js → cli-tnzebztn.js} +1 -1
- package/dist/{cli-pfs8adn4.js → cli-vx421edw.js} +3 -3
- package/dist/{cli-kchjb7qy.js → cli-x3ex5bqf.js} +1 -1
- package/dist/cli-yss07azk.js +142 -0
- package/dist/{cli-fwy8kfd6.js → cli-z8cvws4c.js} +98 -16
- package/dist/{cli-g5mtmf6t.js → cli-zdaypkq9.js} +146 -52
- package/dist/{cli-fpjmegdb.js → cli-zeaehgyd.js} +2 -2
- package/dist/{cli-837vfs2x.js → cli-ztq5z4e1.js} +4 -4
- package/dist/cli.js +20 -20
- package/dist/{codex-adapter-zerf5qsp.js → codex-adapter-2brxx5ta.js} +7 -8
- package/dist/{codex-hook-30gyhzxe.js → codex-hook-c930c3ea.js} +1 -1
- package/dist/{codex-login-bcda78ge.js → codex-login-cbrs1h5w.js} +1 -1
- package/dist/{codex-session-runner-89s304py.js → codex-session-runner-y9anfj0r.js} +8 -9
- package/dist/{commands-jeh1b51j.js → commands-wn9q06qr.js} +3 -3
- package/dist/{controller-mctfbrse.js → controller-fw608czd.js} +4 -4
- package/dist/{controllers-connect-nxa1ddwn.js → controllers-connect-63j5rdcm.js} +20 -20
- package/dist/{cursor-adapter-qj8vehv6.js → cursor-adapter-6mb9jme8.js} +2 -2
- package/dist/{db-2dvay0es.js → db-0m6v5tq4.js} +3 -3
- package/dist/{db-b36qn6k3.js → db-y4wfrzbm.js} +4 -2
- package/dist/{devin-adapter-xedz98zv.js → devin-adapter-r0yx3gv8.js} +1 -1
- package/dist/{dispatcher-gndbta01.js → dispatcher-9tq2zzdj.js} +17 -17
- package/dist/{docker-866qpzt9.js → docker-j75atvpt.js} +2 -2
- package/dist/{dsh-adapter-f75sz821.js → dsh-adapter-t09sv4tq.js} +2 -2
- package/dist/{e2b-jbm7mj93.js → e2b-7s9dscap.js} +2 -2
- package/dist/{e2b-3gpc2n3w.js → e2b-a7vzs2vj.js} +2 -2
- package/dist/{easter-egg-3d-533knw22.js → easter-egg-3d-fbwvmwhe.js} +1 -1
- package/dist/{embedding-space-4p05vb2x.js → embedding-space-wh8de1t9.js} +6 -6
- package/dist/{embeddings-m6768mgh.js → embeddings-3hpbdtjr.js} +1 -1
- package/dist/{event-bus-e66gh7cc.js → event-bus-tr6h3gv8.js} +1 -1
- package/dist/{execute-b3mrb1mv.js → execute-4bdf8sdy.js} +1 -1
- package/dist/{external-channel-gjv3jne3.js → external-channel-ts2fwqh0.js} +2 -2
- package/dist/fx-adapter-1rnxnf56.js +17 -0
- package/dist/grok-adapter-efhmf1r8.js +17 -0
- package/dist/handlers-anrr3py9.js +32 -0
- package/dist/{heartbeat-a1tv60gt.js → heartbeat-2ze5fzpc.js} +20 -20
- package/dist/{hook-8h5dzcgq.js → hook-ca54yd4s.js} +5 -5
- package/dist/{hook-cyaps9ba.js → hook-gaehe2w5.js} +7 -7
- package/dist/{http-t15mhbd9.js → http-jfg8t2yk.js} +3861 -1798
- package/dist/{index-tvfafeyy.js → index-3gv6sc4z.js} +1 -1
- package/dist/{index-qav6455f.js → index-3yvzbhxd.js} +97 -22
- package/dist/index-8w2aznds.js +33 -0
- package/dist/{index-w1zqf680.js → index-csgrxedz.js} +1 -1
- package/dist/index-qnjvr362.js +37 -0
- package/dist/index-yzxd3sn9.js +32 -0
- package/dist/{keepalive-91s7hzrb.js → keepalive-k2a3qe73.js} +4 -4
- package/dist/lead-zhxqbfdv.js +69 -0
- package/dist/{maintenance-7pjmy5xy.js → maintenance-gb5sd5nc.js} +1 -1
- package/dist/{node-4c5jqxr3.js → node-7qsx5kvm.js} +1 -1
- package/dist/{oauth-refresh-sweep-rzqfm94j.js → oauth-refresh-sweep-y7rm6bkb.js} +3 -3
- package/dist/{onboard-74st7pag.js → onboard-jmc5qerv.js} +3 -3
- package/dist/{opencode-adapter-arn7gm8q.js → opencode-adapter-7eade9ev.js} +6 -7
- package/dist/{otel-impl-rnzey8cb.js → otel-impl-8j1xhxqd.js} +2 -2
- package/dist/{pi-mono-adapter-6mkwq64n.js → pi-mono-adapter-yqmaf32x.js} +13 -13
- package/dist/{pricing-refresh-ha21jhk7.js → pricing-refresh-1nj722h6.js} +2 -2
- package/dist/{rbac-roles-wqhma4dr.js → rbac-roles-b1mtr6dr.js} +3 -3
- package/dist/{rbac-roles-59dxachk.js → rbac-roles-n1f3frk1.js} +2 -2
- package/dist/{render-v2-14kpzx12.js → render-v2-1gfpd8rj.js} +4 -4
- package/dist/{resume-gsa5fb5f.js → resume-w1s1eh5v.js} +7 -7
- package/dist/{runtime-1hv06jsn.js → runtime-84g5egsc.js} +1 -1
- package/dist/{session-access-skm7bnp6.js → session-access-y6z1txk4.js} +4 -4
- package/dist/{session-source-backfill-pbqzbncv.js → session-source-backfill-gxxwfh12.js} +3 -3
- package/dist/{setup-5yermsem.js → setup-r91gstyk.js} +1 -1
- package/dist/{virtual-modules-gazyapte.js → virtual-modules-cgnj6kme.js} +3 -3
- package/dist/{work-objects-xj0ck0w4.js → work-objects-qcxzg61c.js} +20 -20
- package/dist/worker-7j2907g6.js +69 -0
- package/dist/{worker-follow-up-911xc0b8.js → worker-follow-up-y2d2h7km.js} +17 -17
- package/dist/{x-2fyrt5pp.js → x-qhxq2ama.js} +2 -2
- package/openapi.json +1214 -108
- package/package.json +3 -3
- package/src/be/db/tasks/read.ts +33 -0
- package/src/be/db.ts +32 -7
- package/src/be/migrations/289_automation_savings_daily.sql +47 -0
- package/src/be/migrations/291_task_slack_participants.sql +4 -0
- package/src/be/migrations/293_savings_component_links.sql +58 -0
- package/src/be/migrations/296_automation_savings_daily_read_index.sql +6 -0
- package/src/be/model-profile-check.ts +10 -2
- package/src/be/savings/compute.ts +511 -16
- package/src/be/savings/model.ts +282 -14
- package/src/be/savings/read.ts +1500 -0
- package/src/be/savings/rollup.ts +571 -0
- package/src/be/scripts/run-credential.ts +15 -3
- package/src/be/scripts/typecheck.ts +86 -4
- package/src/be/seed-scripts/catalog/dreaming-learnings.ts +10 -2
- package/src/be/seed-scripts/catalog/dreaming-memtax-create.ts +70 -4
- package/src/be/swarm-config-guard.ts +8 -0
- package/src/be/users.ts +29 -2
- package/src/commands/runner.ts +159 -41
- package/src/extensions/contract-types.generated.ts +1 -1
- package/src/http/index.ts +8 -1
- package/src/http/poll.ts +14 -1
- package/src/http/requested-by.ts +97 -1
- package/src/http/savings.ts +676 -190
- package/src/http/scripts.ts +26 -15
- package/src/http/tasks.ts +43 -5
- package/src/prompts/session-templates.ts +80 -3
- package/src/providers/acp-targets.ts +1 -1
- package/src/providers/amp-adapter.ts +1 -1
- package/src/providers/claude-adapter.ts +0 -20
- package/src/providers/claude-flag-settings.ts +12 -10
- package/src/providers/codex-adapter.ts +9 -34
- package/src/providers/opencode-adapter.ts +34 -12
- package/src/scheduler/scheduler.ts +20 -14
- package/src/scripts-runtime/ctx.ts +1 -1
- package/src/scripts-runtime/executors/quickjs-bundle.ts +1 -0
- package/src/scripts-runtime/executors/quickjs-prelude.ts +162 -2
- package/src/scripts-runtime/executors/quickjs-runner.ts +4 -1
- package/src/scripts-runtime/stdlib/fetch.ts +113 -15
- package/src/scripts-runtime/stdlib/index.ts +3 -1
- package/src/scripts-runtime/stdlib/retry.ts +174 -0
- package/src/scripts-runtime/swarm-sdk.ts +186 -17
- package/src/scripts-runtime/types/stdlib.d.ts +86 -4
- package/src/scripts-runtime/types/swarm-extension.d.ts +26 -0
- package/src/scripts-runtime/types/swarm-sdk.d.ts +60 -2
- package/src/slack/actions.ts +1 -0
- package/src/slack/assistant.ts +2 -0
- package/src/slack/enrich.ts +144 -50
- package/src/slack/handlers.ts +37 -95
- package/src/slack/templates.ts +9 -0
- package/src/slack/thread-buffer.ts +45 -71
- package/src/slack/thread-participants.ts +187 -0
- package/src/tests/base-prompt.test.ts +5 -4
- package/src/tests/claude-adapter-binary.test.ts +7 -1
- package/src/tests/claude-adapter.test.ts +10 -64
- package/src/tests/claude-flag-settings.test.ts +15 -11
- package/src/tests/claude-hook-credentials.test.ts +0 -1
- package/src/tests/claude-sdk-lifecycle.test.ts +5 -1
- package/src/tests/codex-adapter.test.ts +17 -78
- package/src/tests/create-task-vcs-repo.test.ts +136 -0
- package/src/tests/db-task-read-contract.test.ts +2 -0
- package/src/tests/db-task-write-contract.test.ts +1 -0
- package/src/tests/docs-index-footprint.test.js +3 -3
- package/src/tests/dreaming-learnings.test.ts +104 -0
- package/src/tests/extensions-pre-task.test.ts +4 -2
- package/src/tests/fetch-resolved-env.test.ts +47 -1
- package/src/tests/opencode-adapter.test.ts +53 -6
- package/src/tests/prompt-template-session.test.ts +17 -1
- package/src/tests/runner-requester-profile.test.ts +139 -1
- package/src/tests/savings-compound.test.ts +774 -0
- package/src/tests/savings-compute.test.ts +7 -198
- package/src/tests/savings-fleet-latency.test.ts +143 -0
- package/src/tests/savings-fleet-read.test.ts +195 -0
- package/src/tests/savings-fleet-scale.test.ts +222 -0
- package/src/tests/savings-model.test.ts +212 -0
- package/src/tests/savings-read.test.ts +367 -0
- package/src/tests/savings-rollup.test.ts +766 -0
- package/src/tests/savings-scripts.test.ts +611 -0
- package/src/tests/script-connections.test.ts +2 -0
- package/src/tests/script-executor-conformance.test.ts +444 -0
- package/src/tests/scripts-http.test.ts +55 -0
- package/src/tests/scripts-runtime-fetch.test.ts +2 -2
- package/src/tests/secret-rules.test.ts +124 -1
- package/src/tests/secret-scrubber.test.ts +1 -1
- package/src/tests/slack-dm-implicit-mention.test.ts +20 -1
- package/src/tests/slack-identity-resolution.test.ts +23 -0
- package/src/tests/slack-inbound-files.test.ts +2 -1
- package/src/tests/slack-thread-participants.test.ts +429 -0
- package/src/tests/tool-annotations.test.ts +30 -0
- package/src/types.ts +31 -0
- package/src/utils/mcp-server-fetcher.test.ts +89 -0
- package/src/utils/mcp-server-fetcher.ts +13 -5
- package/src/utils/request-auth-context.ts +24 -0
- package/src/utils/secret-rules.generated.ts +1 -1
- package/src/utils/secret-scrubber.ts +154 -29
- package/src/workflows/executors/swarm-script.ts +23 -19
- package/templates/skills/swarm-scripts/SKILL.md +5 -4
- package/templates/skills/swarm-scripts/content.md +5 -4
- package/templates/skills/work-on-task/SKILL.md +1 -1
- package/templates/skills/work-on-task/content.md +1 -1
- package/templates/workflows/dreaming/content.md +1 -1
- package/dist/acp-adapter-fqzkxyra.js +0 -15
- package/dist/cli-4bd1rck6.js +0 -4
- package/dist/cli-xf3qw745.js +0 -104
- package/dist/fx-adapter-rpsgb1tw.js +0 -18
- package/dist/grok-adapter-n2m3zjg1.js +0 -18
- package/dist/handlers-nv8edn19.js +0 -32
- package/dist/index-ksmyd6kc.js +0 -37
- package/dist/index-rjnrje98.js +0 -32
- package/dist/index-tv3413wy.js +0 -33
- package/dist/lead-3hmddvrm.js +0 -70
- package/dist/worker-qgg0m2gw.js +0 -70
- package/src/providers/ctx-mode-env.ts +0 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@desplega.ai/agent-swarm",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.3",
|
|
4
4
|
"description": "agent-swarm.dev — an open-source operating system for AI work: a lead agent breaks goals into tasks, routes them to specialized workers such as Claude Code or Codex, runs each worker in an isolated container, and preserves shared memory, tools, schedules, and review gates so delegated work compounds across sessions.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agent-swarm.dev",
|
|
@@ -205,7 +205,7 @@
|
|
|
205
205
|
"@agentclientprotocol/sdk": "2.4.0",
|
|
206
206
|
"@ai-sdk/openai": "^3.0.41",
|
|
207
207
|
"@anthropic-ai/claude-agent-sdk": "0.3.318",
|
|
208
|
-
"@anthropic-ai/sdk": "^1.
|
|
208
|
+
"@anthropic-ai/sdk": "^1.6.0",
|
|
209
209
|
"@asteasolutions/zod-to-openapi": "^8.0.0",
|
|
210
210
|
"@aws-sdk/client-bedrock": "3.1048.0",
|
|
211
211
|
"@boxd-sh/sdk": "0.2.20",
|
|
@@ -223,7 +223,7 @@
|
|
|
223
223
|
"@jitl/quickjs-singlefile-mjs-release-sync": "0.32.0",
|
|
224
224
|
"@linear/sdk": "^77.0.0",
|
|
225
225
|
"@modelcontextprotocol/sdk": "1.32.1",
|
|
226
|
-
"@openai/codex": "0.
|
|
226
|
+
"@openai/codex": "0.167.0",
|
|
227
227
|
"@openfort/openfort-node": "^0.9.1",
|
|
228
228
|
"@opentelemetry/api": "^1.9.1",
|
|
229
229
|
"@opentelemetry/api-logs": "^0.218.0",
|
package/src/be/db/tasks/read.ts
CHANGED
|
@@ -13,6 +13,7 @@ import type {
|
|
|
13
13
|
RoutingAffinity,
|
|
14
14
|
RoutingReason,
|
|
15
15
|
RoutingSource,
|
|
16
|
+
TaskSlackParticipants,
|
|
16
17
|
} from "../../../types";
|
|
17
18
|
import {
|
|
18
19
|
FallbackHopSchema,
|
|
@@ -20,6 +21,7 @@ import {
|
|
|
20
21
|
parseModelTier,
|
|
21
22
|
ReasoningEffortSchema,
|
|
22
23
|
RoutingAffinitySchema,
|
|
24
|
+
TaskSlackParticipantsSchema,
|
|
23
25
|
TERMINAL_TASK_STATUSES,
|
|
24
26
|
} from "../../../types";
|
|
25
27
|
import { normalizeOutputSchema } from "../../../utils/output-schema";
|
|
@@ -70,6 +72,7 @@ export type AgentTaskRow = {
|
|
|
70
72
|
slackThreadTs: string | null;
|
|
71
73
|
slackTriggerMessageTs: string | null;
|
|
72
74
|
slackUserId: string | null;
|
|
75
|
+
slackParticipants?: string | null;
|
|
73
76
|
slackReplySent: number;
|
|
74
77
|
slackProgressMessageTs: string | null;
|
|
75
78
|
slackTreeRootMessageTs: string | null;
|
|
@@ -275,6 +278,19 @@ function parseFallbackHops(value: string | null | undefined): FallbackHop[] | un
|
|
|
275
278
|
}
|
|
276
279
|
}
|
|
277
280
|
|
|
281
|
+
/** The stored participants; a value that does not parse reads as unset. */
|
|
282
|
+
function parseSlackParticipants(
|
|
283
|
+
value: string | null | undefined,
|
|
284
|
+
): TaskSlackParticipants | undefined {
|
|
285
|
+
if (!value) return undefined;
|
|
286
|
+
try {
|
|
287
|
+
const parsed = TaskSlackParticipantsSchema.safeParse(JSON.parse(value));
|
|
288
|
+
return parsed.success ? parsed.data : undefined;
|
|
289
|
+
} catch {
|
|
290
|
+
return undefined;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
|
|
278
294
|
export function rowToAgentTask(row: AgentTaskRow): AgentTask {
|
|
279
295
|
let followUpConfig: FollowUpConfig | undefined;
|
|
280
296
|
if (row.followUpConfig) {
|
|
@@ -345,6 +361,7 @@ export function rowToAgentTask(row: AgentTaskRow): AgentTask {
|
|
|
345
361
|
slackThreadTs: row.slackThreadTs ?? undefined,
|
|
346
362
|
slackTriggerMessageTs: row.slackTriggerMessageTs ?? undefined,
|
|
347
363
|
slackUserId: row.slackUserId ?? undefined,
|
|
364
|
+
slackParticipants: parseSlackParticipants(row.slackParticipants),
|
|
348
365
|
slackReplySent: !!row.slackReplySent,
|
|
349
366
|
slackProgressMessageTs: row.slackProgressMessageTs ?? undefined,
|
|
350
367
|
slackTreeRootMessageTs: row.slackTreeRootMessageTs ?? undefined,
|
|
@@ -2051,6 +2068,22 @@ export async function getLatestLeadTaskByContextKey(
|
|
|
2051
2068
|
* Unlike getAgentWorkingOnThread (which filters source='slack'), this finds ALL tasks
|
|
2052
2069
|
* including worker tasks that inherited Slack metadata via parentTaskId.
|
|
2053
2070
|
*/
|
|
2071
|
+
/** The oldest task in a Slack thread: who started the swarm's work there. */
|
|
2072
|
+
export async function getFirstTaskInThread(
|
|
2073
|
+
channelId: string,
|
|
2074
|
+
threadTs: string,
|
|
2075
|
+
): Promise<AgentTask | null> {
|
|
2076
|
+
const row = await getDbClient().get<AgentTaskRow>(
|
|
2077
|
+
`SELECT * FROM agent_tasks
|
|
2078
|
+
WHERE slackChannelId = ?
|
|
2079
|
+
AND slackThreadTs = ?
|
|
2080
|
+
ORDER BY createdAt ASC
|
|
2081
|
+
LIMIT 1`,
|
|
2082
|
+
[channelId, threadTs],
|
|
2083
|
+
);
|
|
2084
|
+
return row ? rowToAgentTask(row) : null;
|
|
2085
|
+
}
|
|
2086
|
+
|
|
2054
2087
|
export async function getMostRecentTaskInThread(
|
|
2055
2088
|
channelId: string,
|
|
2056
2089
|
threadTs: string,
|
package/src/be/db.ts
CHANGED
|
@@ -158,7 +158,7 @@ import {
|
|
|
158
158
|
} from "../utils/identity-field-budget";
|
|
159
159
|
import { activeModelBlock, type ModelFamily } from "../utils/model-rate-limit-windows";
|
|
160
160
|
import { isEffectiveOutputSchema } from "../utils/output-schema";
|
|
161
|
-
import { getCurrentRequestUserId } from "../utils/request-auth-context";
|
|
161
|
+
import { getCurrentRequestUserId, getCurrentRunProvenance } from "../utils/request-auth-context";
|
|
162
162
|
import { isRuntimePoolsEnabled } from "../utils/runtime-pools-flag";
|
|
163
163
|
import {
|
|
164
164
|
registerSensitiveKeyName,
|
|
@@ -368,6 +368,7 @@ export {
|
|
|
368
368
|
getAllTasks,
|
|
369
369
|
getChildTasks,
|
|
370
370
|
getCompletedSlackTasks,
|
|
371
|
+
getFirstTaskInThread,
|
|
371
372
|
getInProgressSlackTasks,
|
|
372
373
|
getInProgressTasksByContextKey,
|
|
373
374
|
getLatestActiveTaskByContextKey,
|
|
@@ -2585,6 +2586,9 @@ export async function createTaskExtended(
|
|
|
2585
2586
|
if (parent.slackUserId && !options.slackUserId && !explicitForeignChannel) {
|
|
2586
2587
|
options.slackUserId = parent.slackUserId;
|
|
2587
2588
|
}
|
|
2589
|
+
if (parent.slackParticipants && !options.slackParticipants && !explicitForeignChannel) {
|
|
2590
|
+
options.slackParticipants = parent.slackParticipants;
|
|
2591
|
+
}
|
|
2588
2592
|
|
|
2589
2593
|
// AgentMail context
|
|
2590
2594
|
if (parent.agentmailInboxId && !options.agentmailInboxId) {
|
|
@@ -2955,17 +2959,19 @@ export async function createTaskExtended(
|
|
|
2955
2959
|
workflowRunId: options?.workflowRunId,
|
|
2956
2960
|
});
|
|
2957
2961
|
|
|
2962
|
+
const provenance = getCurrentRunProvenance();
|
|
2958
2963
|
const inserted = await getDbClient().get<AgentTaskRow>(
|
|
2959
2964
|
`INSERT INTO agent_tasks (
|
|
2960
2965
|
id, "key", agentId, creatorAgentId, task, status, source, routing_reason, routing_source, routing_note,
|
|
2961
2966
|
taskType, tags, priority, dependsOn, offeredTo, offeredAt,
|
|
2962
|
-
slackChannelId, slackThreadTs, slackTriggerMessageTs, slackUserId,
|
|
2967
|
+
slackChannelId, slackThreadTs, slackTriggerMessageTs, slackUserId, slackParticipants,
|
|
2963
2968
|
vcsProvider, vcsRepo, vcsEventType, vcsNumber, vcsCommentId, vcsAuthor, vcsUrl,
|
|
2964
2969
|
vcsInstallationId, vcsNodeId,
|
|
2965
2970
|
agentmailInboxId, agentmailMessageId, agentmailThreadId,
|
|
2966
2971
|
mentionMessageId, mentionChannelId, dir, parentTaskId, dispatchedByTaskId, model, modelTier, effort, profile, fallbackHops, scheduleId,
|
|
2967
|
-
workflowRunId, workflowRunStepId, outputSchema, followUpConfig, requestedByUserId, requestedByUserIdInherited, contextKey, routingAffinity, swarmVersion, createdAt, lastUpdatedAt, created_by, updated_by, isHumanFree
|
|
2968
|
-
|
|
2972
|
+
workflowRunId, workflowRunStepId, outputSchema, followUpConfig, requestedByUserId, requestedByUserIdInherited, contextKey, routingAffinity, swarmVersion, createdAt, lastUpdatedAt, created_by, updated_by, isHumanFree,
|
|
2973
|
+
sourceStepId, sourceScriptRunId
|
|
2974
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING *`,
|
|
2969
2975
|
[
|
|
2970
2976
|
id,
|
|
2971
2977
|
insertKey,
|
|
@@ -2988,6 +2994,7 @@ export async function createTaskExtended(
|
|
|
2988
2994
|
options?.slackThreadTs ?? null,
|
|
2989
2995
|
options?.slackTriggerMessageTs ?? null,
|
|
2990
2996
|
options?.slackUserId ?? null,
|
|
2997
|
+
options?.slackParticipants ? JSON.stringify(options.slackParticipants) : null,
|
|
2991
2998
|
options?.vcsProvider ?? null,
|
|
2992
2999
|
options?.vcsRepo ?? null,
|
|
2993
3000
|
options?.vcsEventType ?? null,
|
|
@@ -3025,6 +3032,10 @@ export async function createTaskExtended(
|
|
|
3025
3032
|
auditUserId,
|
|
3026
3033
|
auditUserId,
|
|
3027
3034
|
isHumanFree ? 1 : 0,
|
|
3035
|
+
// A task a workflow node owns keeps only its workflowRunId: the engine
|
|
3036
|
+
// can run that node inside the request of the script that triggered it.
|
|
3037
|
+
options?.workflowRunId ? null : (provenance?.sourceStepId ?? null),
|
|
3038
|
+
options?.workflowRunId ? null : (provenance?.sourceScriptRunId ?? null),
|
|
3028
3039
|
],
|
|
3029
3040
|
);
|
|
3030
3041
|
if (!inserted) throw new Error("Failed to create task");
|
|
@@ -8028,7 +8039,7 @@ export async function createWorkflowRun(data: {
|
|
|
8028
8039
|
}): Promise<WorkflowRun> {
|
|
8029
8040
|
const now = new Date().toISOString();
|
|
8030
8041
|
const row = await getDbClient().get<WorkflowRunRow>(
|
|
8031
|
-
`INSERT INTO workflow_runs (id, workflowId, triggerType, startedAt, triggerData, created_by, parentStepId, parentStepAttempt, triggeredByAgentId, definitionHash) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING *`,
|
|
8042
|
+
`INSERT INTO workflow_runs (id, workflowId, triggerType, startedAt, triggerData, created_by, parentStepId, parentStepAttempt, triggeredByAgentId, definitionHash, sourceStepId) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING *`,
|
|
8032
8043
|
[
|
|
8033
8044
|
data.id,
|
|
8034
8045
|
data.workflowId,
|
|
@@ -8040,6 +8051,14 @@ export async function createWorkflowRun(data: {
|
|
|
8040
8051
|
data.parentStepAttempt ?? 0,
|
|
8041
8052
|
data.triggeredByAgentId ?? null,
|
|
8042
8053
|
data.definitionHash ?? null,
|
|
8054
|
+
// The script step whose run token started this run (trigger-workflow is
|
|
8055
|
+
// a manual or api trigger). A sub-workflow child is linked by
|
|
8056
|
+
// parentStepId instead, and an event or schedule run is never the
|
|
8057
|
+
// script's, even when it starts inside that script's request.
|
|
8058
|
+
data.parentStepId ||
|
|
8059
|
+
(data.triggerType !== "api" && (data.triggerType ?? "manual") !== "manual")
|
|
8060
|
+
? null
|
|
8061
|
+
: (getCurrentRunProvenance()?.sourceStepId ?? null),
|
|
8043
8062
|
],
|
|
8044
8063
|
);
|
|
8045
8064
|
if (!row) throw new Error("Failed to create workflow run");
|
|
@@ -14362,11 +14381,13 @@ export async function recordInlineScriptRun(data: {
|
|
|
14362
14381
|
// redact them here so every caller is covered.
|
|
14363
14382
|
const args = scrubJsonValue(data.args ?? null);
|
|
14364
14383
|
const output = data.output === undefined ? null : scrubJsonValue(data.output);
|
|
14384
|
+
const provenance = getCurrentRunProvenance();
|
|
14365
14385
|
const row = await getDbClient().get<ScriptRunRow>(
|
|
14366
14386
|
`INSERT INTO script_runs
|
|
14367
14387
|
(id, agentId, scriptName, source, args, kind, status, output, error,
|
|
14368
|
-
startedAt, finishedAt, requestedByUserId, created_by, updated_by, apiEndpointId
|
|
14369
|
-
|
|
14388
|
+
startedAt, finishedAt, requestedByUserId, created_by, updated_by, apiEndpointId,
|
|
14389
|
+
sourceStepId, parentScriptRunId)
|
|
14390
|
+
VALUES (?, ?, ?, ?, ?, 'inline', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
14370
14391
|
RETURNING *`,
|
|
14371
14392
|
[
|
|
14372
14393
|
data.id,
|
|
@@ -14383,6 +14404,10 @@ export async function recordInlineScriptRun(data: {
|
|
|
14383
14404
|
data.createdBy ?? null,
|
|
14384
14405
|
data.createdBy ?? null,
|
|
14385
14406
|
data.apiEndpointId ?? null,
|
|
14407
|
+
// A run called through another script run's token (a nested
|
|
14408
|
+
// ctx.swarm.script_run) records that run and its workflow step.
|
|
14409
|
+
provenance?.sourceStepId ?? null,
|
|
14410
|
+
provenance?.sourceScriptRunId ?? null,
|
|
14386
14411
|
],
|
|
14387
14412
|
);
|
|
14388
14413
|
if (!row) throw new Error("Failed to record inline script run");
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
-- Daily rollup of the automation savings model (src/be/savings/).
|
|
2
|
+
-- One row per job per UTC day with tier-independent counts and costs; the API
|
|
3
|
+
-- applies the tier curve, the schedule cap, the enabled-only rule and the
|
|
4
|
+
-- error band at read time. Schedule counts stay uncapped here, so the window
|
|
5
|
+
-- cap stays exact when buckets are summed. jobKind 'script' and subKind are
|
|
6
|
+
-- reserved for the script rollup; workflows use subKind ''.
|
|
7
|
+
CREATE TABLE IF NOT EXISTS automation_savings_daily (
|
|
8
|
+
day TEXT NOT NULL,
|
|
9
|
+
jobKind TEXT NOT NULL CHECK (jobKind IN ('workflow', 'script')),
|
|
10
|
+
jobId TEXT NOT NULL,
|
|
11
|
+
jobKey TEXT NOT NULL,
|
|
12
|
+
jobName TEXT NOT NULL,
|
|
13
|
+
subKind TEXT NOT NULL DEFAULT '',
|
|
14
|
+
runs INTEGER NOT NULL DEFAULT 0,
|
|
15
|
+
countedRuns INTEGER NOT NULL DEFAULT 0,
|
|
16
|
+
schedRuns INTEGER NOT NULL DEFAULT 0,
|
|
17
|
+
schedEffectRuns INTEGER NOT NULL DEFAULT 0,
|
|
18
|
+
eventRuns INTEGER NOT NULL DEFAULT 0,
|
|
19
|
+
effectRuns INTEGER NOT NULL DEFAULT 0,
|
|
20
|
+
effectOpsSum REAL NOT NULL DEFAULT 0,
|
|
21
|
+
opsSum REAL NOT NULL DEFAULT 0,
|
|
22
|
+
agentTasks INTEGER NOT NULL DEFAULT 0,
|
|
23
|
+
agentUsd REAL NOT NULL DEFAULT 0,
|
|
24
|
+
agentMs REAL NOT NULL DEFAULT 0,
|
|
25
|
+
followupUsd REAL NOT NULL DEFAULT 0,
|
|
26
|
+
recordedLlmUsd REAL NOT NULL DEFAULT 0,
|
|
27
|
+
estimatedLlmUsd REAL NOT NULL DEFAULT 0,
|
|
28
|
+
computeSecs REAL NOT NULL DEFAULT 0,
|
|
29
|
+
modelVersion INTEGER NOT NULL,
|
|
30
|
+
computedAt TEXT NOT NULL,
|
|
31
|
+
PRIMARY KEY (day, jobKind, jobId, subKind)
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
CREATE INDEX IF NOT EXISTS idx_automation_savings_daily_job
|
|
35
|
+
ON automation_savings_daily(jobKind, jobId, day);
|
|
36
|
+
CREATE INDEX IF NOT EXISTS idx_automation_savings_daily_key
|
|
37
|
+
ON automation_savings_daily(jobKind, jobKey, day);
|
|
38
|
+
|
|
39
|
+
-- Which days the rollup has computed, per job kind: a day with no runs has no
|
|
40
|
+
-- bucket rows, and this row tells it apart from a day not computed yet.
|
|
41
|
+
CREATE TABLE IF NOT EXISTS automation_savings_days (
|
|
42
|
+
day TEXT NOT NULL,
|
|
43
|
+
jobKind TEXT NOT NULL CHECK (jobKind IN ('workflow', 'script')),
|
|
44
|
+
modelVersion INTEGER NOT NULL,
|
|
45
|
+
computedAt TEXT NOT NULL,
|
|
46
|
+
PRIMARY KEY (day, jobKind)
|
|
47
|
+
);
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
-- Multi-person Slack threads: the people in the thread when the task was
|
|
2
|
+
-- created ({people: [{slackUserId, userId?, trust, starter?, newest?, asked?}],
|
|
3
|
+
-- more}). NULL: not a Slack task, or created before this column existed.
|
|
4
|
+
ALTER TABLE agent_tasks ADD COLUMN slackParticipants TEXT;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
-- Provenance for the savings "with components" view (src/be/savings/).
|
|
2
|
+
--
|
|
3
|
+
-- A script run's per-run api token (session_tokens.scriptRun = 1) now records
|
|
4
|
+
-- where the run came from: the swarm-script workflow step that started it, and
|
|
5
|
+
-- the script_runs row of the run itself. Rows created through that token carry
|
|
6
|
+
-- it, so a workflow's components (child runs, tasks and nested script runs its
|
|
7
|
+
-- script steps made) join exactly instead of by output text.
|
|
8
|
+
--
|
|
9
|
+
-- parentStepId and workflowRunId are not reused: parentStepId carries
|
|
10
|
+
-- sub-workflow attempt semantics, and a workflowRunId on a script-made task
|
|
11
|
+
-- would switch off its lead follow-up.
|
|
12
|
+
ALTER TABLE session_tokens ADD COLUMN sourceStepId TEXT;
|
|
13
|
+
ALTER TABLE session_tokens ADD COLUMN sourceScriptRunId TEXT;
|
|
14
|
+
|
|
15
|
+
ALTER TABLE agent_tasks ADD COLUMN sourceStepId TEXT;
|
|
16
|
+
ALTER TABLE agent_tasks ADD COLUMN sourceScriptRunId TEXT;
|
|
17
|
+
ALTER TABLE workflow_runs ADD COLUMN sourceStepId TEXT;
|
|
18
|
+
ALTER TABLE script_runs ADD COLUMN sourceStepId TEXT;
|
|
19
|
+
ALTER TABLE script_runs ADD COLUMN parentScriptRunId TEXT;
|
|
20
|
+
|
|
21
|
+
-- The rollup reads stamped rows one day at a time, from the child side.
|
|
22
|
+
CREATE INDEX IF NOT EXISTS idx_agent_tasks_sourceStep_created
|
|
23
|
+
ON agent_tasks(createdAt) WHERE sourceStepId IS NOT NULL;
|
|
24
|
+
CREATE INDEX IF NOT EXISTS idx_agent_tasks_sourceScriptRun_created
|
|
25
|
+
ON agent_tasks(createdAt) WHERE sourceScriptRunId IS NOT NULL;
|
|
26
|
+
CREATE INDEX IF NOT EXISTS idx_workflow_runs_sourceStep_started
|
|
27
|
+
ON workflow_runs(startedAt) WHERE sourceStepId IS NOT NULL;
|
|
28
|
+
CREATE INDEX IF NOT EXISTS idx_script_runs_sourceStep_started
|
|
29
|
+
ON script_runs(startedAt) WHERE sourceStepId IS NOT NULL;
|
|
30
|
+
CREATE INDEX IF NOT EXISTS idx_script_runs_parentScriptRunId
|
|
31
|
+
ON script_runs(parentScriptRunId) WHERE parentScriptRunId IS NOT NULL;
|
|
32
|
+
|
|
33
|
+
-- Spend of the agent tasks a workflow's runs caused without owning them:
|
|
34
|
+
-- descendants of its agent-task nodes' tasks, and tasks its script steps
|
|
35
|
+
-- created (with their descendants). Kept on both sides of the saving.
|
|
36
|
+
ALTER TABLE automation_savings_daily ADD COLUMN childTaskUsd REAL NOT NULL DEFAULT 0;
|
|
37
|
+
ALTER TABLE automation_savings_daily ADD COLUMN childTaskMs REAL NOT NULL DEFAULT 0;
|
|
38
|
+
|
|
39
|
+
-- Per UTC day (of the child), how many runs, tasks and script runs each
|
|
40
|
+
-- workflow caused. Read-time only: the "with components" view walks these
|
|
41
|
+
-- links; no list or fleet total adds them, since every child is already
|
|
42
|
+
-- priced on its own row.
|
|
43
|
+
CREATE TABLE IF NOT EXISTS automation_savings_links (
|
|
44
|
+
day TEXT NOT NULL,
|
|
45
|
+
parentJobId TEXT NOT NULL,
|
|
46
|
+
childKind TEXT NOT NULL CHECK (childKind IN ('workflow', 'script', 'task')),
|
|
47
|
+
childJobId TEXT NOT NULL,
|
|
48
|
+
linkKind TEXT NOT NULL CHECK (linkKind IN ('sub-workflow', 'step-workflow', 'step-script', 'step-task', 'descendant-task')),
|
|
49
|
+
n INTEGER NOT NULL DEFAULT 0,
|
|
50
|
+
actualUsd REAL NOT NULL DEFAULT 0,
|
|
51
|
+
keptUsd REAL NOT NULL DEFAULT 0,
|
|
52
|
+
modelVersion INTEGER NOT NULL,
|
|
53
|
+
computedAt TEXT NOT NULL,
|
|
54
|
+
PRIMARY KEY (day, parentJobId, childKind, childJobId, linkKind)
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
CREATE INDEX IF NOT EXISTS idx_automation_savings_links_parent
|
|
58
|
+
ON automation_savings_links(parentJobId, day);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
-- The savings read path filters buckets by kind, model version and a day
|
|
2
|
+
-- range (src/be/savings/read.ts). The existing indexes lead with jobId or
|
|
3
|
+
-- jobKey, so every read scanned all buckets of a kind; this one serves the
|
|
4
|
+
-- per-day row count and each day-range slice as a range scan.
|
|
5
|
+
CREATE INDEX IF NOT EXISTS idx_automation_savings_daily_read
|
|
6
|
+
ON automation_savings_daily(jobKind, modelVersion, day, subKind);
|
|
@@ -75,11 +75,19 @@ export function runtimeReadsRepoSecrets(agent: { id: string; isLead?: boolean })
|
|
|
75
75
|
*/
|
|
76
76
|
export async function vcsRepoId(vcsRepo: string | null | undefined): Promise<string | null> {
|
|
77
77
|
if (!vcsRepo?.trim()) return null;
|
|
78
|
-
const
|
|
78
|
+
const client = getDbClient();
|
|
79
|
+
const named = await client.query<{ id: string; url: string }>(
|
|
79
80
|
"SELECT id, url FROM swarm_repos WHERE name = ? ORDER BY name ASC",
|
|
80
81
|
[vcsRepoName(vcsRepo)],
|
|
81
82
|
);
|
|
82
|
-
|
|
83
|
+
const match = named.find((r) => vcsRepoUrlMatches(r.url, vcsRepo));
|
|
84
|
+
if (match) return match.id;
|
|
85
|
+
// A repo registered under a display name (`frontend` for acme/web) has no name hit:
|
|
86
|
+
// match its URL instead, as fetchRepoConfig falls back to.
|
|
87
|
+
const all = await client.query<{ id: string; url: string }>(
|
|
88
|
+
"SELECT id, url FROM swarm_repos ORDER BY name ASC",
|
|
89
|
+
);
|
|
90
|
+
return all.find((r) => vcsRepoUrlMatches(r.url, vcsRepo))?.id ?? null;
|
|
83
91
|
}
|
|
84
92
|
|
|
85
93
|
/** Pooled credential values the worker would get, by var: exported config rows only. */
|