@desplega.ai/agent-swarm 2.9.0 → 2.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/acp-adapter-bht22g3k.js +16 -0
- package/dist/{acp-targets-swxq55dr.js → acp-targets-arrwv4f0.js} +7 -7
- package/dist/{actions-pb678g3e.js → actions-y0d2n1c2.js} +102 -21
- package/dist/{agent-fs-provision-dmhnc38q.js → agent-fs-provision-tpj7sktd.js} +4 -4
- package/dist/{amp-adapter-3pa66q27.js → amp-adapter-vmmnmw8d.js} +2 -2
- package/dist/{anthropic-messages-x2cp5fvf.js → anthropic-messages-zdca3gv1.js} +22 -22
- package/dist/{app-17d12ev4.js → app-wb7w45dq.js} +6 -3
- package/dist/{approval-notifications-h7vd9pmg.js → approval-notifications-7mqr6vbd.js} +8 -5
- package/dist/{assistant-t7k39ree.js → assistant-gf60454p.js} +23 -21
- package/dist/{boot-args-schema-0gqmkfbe.js → boot-args-schema-qxmd59sr.js} +1 -1
- package/dist/{boot-reembed-f064w382.js → boot-reembed-5tmeskj2.js} +1 -1
- package/dist/{boot-reembed-n6anc01d.js → boot-reembed-wb44vc3s.js} +1 -1
- package/dist/boot-scrub-sweep-25bxhnw4.js +9 -0
- package/dist/{boot-seeds-f99fjs5q.js → boot-seeds-nj9za0vk.js} +4 -4
- package/dist/{claude-adapter-gvznwxgc.js → claude-adapter-d3krpdyb.js} +7 -7
- package/dist/{claude-managed-adapter-pbrbvc64.js → claude-managed-adapter-t8nfgcgz.js} +2 -2
- package/dist/{claude-managed-setup-kdxttvc3.js → claude-managed-setup-7y4pwd81.js} +3 -3
- package/dist/{claude-sdk-session-0t2teq6n.js → claude-sdk-session-d138zy0e.js} +7 -7
- package/dist/{cli-6dp0jkfj.js → cli-01k6wpr9.js} +4 -4
- package/dist/{cli-c07v0qfa.js → cli-124ntmf0.js} +83 -74
- package/dist/{cli-1tvdx9t5.js → cli-2rnd5j3t.js} +1 -1
- package/dist/{cli-4ghh072d.js → cli-2spnz7ye.js} +36 -36
- package/dist/{cli-dd37e0cm.js → cli-2v2zdm0a.js} +1 -1
- package/dist/{cli-aa8s22gn.js → cli-3aaeb78m.js} +195 -186
- package/dist/{cli-8x8y70av.js → cli-3caf7pmg.js} +2 -2
- package/dist/{cli-jd3kxppb.js → cli-3et6fmfe.js} +1 -1
- package/dist/{cli-kaa4bd7x.js → cli-3f8zbtqa.js} +9 -8
- package/dist/{cli-57pvhnyt.js → cli-43evxwj4.js} +1 -1
- package/dist/cli-43ms35q9.js +270 -0
- package/dist/cli-47hz21se.js +25584 -0
- package/dist/{cli-n515ex5z.js → cli-4ymxrwg5.js} +16 -16
- package/dist/{cli-2tnbc3gw.js → cli-539h29es.js} +2379 -66
- package/dist/{cli-rts1qvb4.js → cli-5qhfv9rw.js} +2 -2
- package/dist/{cli-faf46gdq.js → cli-6037prsx.js} +10 -10
- package/dist/{cli-bk9v1xrv.js → cli-6cwr32fe.js} +25 -25
- package/dist/{cli-812paz57.js → cli-6ehs4mta.js} +18 -2
- package/dist/{cli-95930z69.js → cli-6ym4jhzp.js} +2 -2
- package/dist/{cli-zg3z63x3.js → cli-7mv4h3sn.js} +1 -1
- package/dist/{cli-9a2rtd77.js → cli-7r162fxe.js} +24 -15
- package/dist/{cli-eg437b5p.js → cli-7sf9sb0w.js} +2 -1
- package/dist/{cli-vw5x18yj.js → cli-8st34zhr.js} +20 -10
- package/dist/{cli-fgphc007.js → cli-91pkxres.js} +1 -1
- package/dist/{cli-2kg31ted.js → cli-9fjr27ez.js} +11 -11
- package/dist/{cli-wr1h0k28.js → cli-9w8712tq.js} +617 -278
- package/dist/cli-aw83sr40.js +98 -0
- package/dist/{cli-ssvdrk4y.js → cli-b6px1k1q.js} +1 -1
- package/dist/{cli-w7dxb2fj.js → cli-cc93xzes.js} +6 -6
- package/dist/{cli-js8zrfyg.js → cli-fcfbct2j.js} +5 -5
- package/dist/{cli-3zxdz9r7.js → cli-fq2rr3jb.js} +6 -6
- package/dist/{boot-scrub-sweep-ejd5dnrz.js → cli-had1p04a.js} +8 -9
- package/dist/{cli-7cgf614g.js → cli-j6te8keb.js} +5 -5
- package/dist/{cli-25nstr34.js → cli-jrbq4djp.js} +1 -1
- package/dist/{cli-pz1c00aa.js → cli-k3q2va86.js} +2 -2
- package/dist/{cli-nhq5js1b.js → cli-k5yewqgd.js} +3 -3
- package/dist/cli-kbtzfrxj.js +404 -0
- package/dist/{cli-dx439zpg.js → cli-kpgcm7xy.js} +13 -1
- package/dist/{cli-mc1fx4xd.js → cli-m9cvf7vs.js} +10 -10
- package/dist/{cli-kmvcm34h.js → cli-md50mj0r.js} +2 -2
- package/dist/{cli-q8cfh1t9.js → cli-mk7c5ac4.js} +1 -1
- package/dist/cli-mys27d03.js +321 -0
- package/dist/{cli-spzkdgtg.js → cli-n3qe7tyr.js} +172 -168
- package/dist/{cli-7akn6ze9.js → cli-nh7x3133.js} +7 -28
- package/dist/{cli-fnh4b12r.js → cli-nstkanmx.js} +6 -6
- package/dist/{cli-g3zzby8t.js → cli-nv4xsvmk.js} +5 -5
- package/dist/{cli-sn4pc4qx.js → cli-p0c3vtch.js} +2 -2
- package/dist/{cli-5ntc4we6.js → cli-p0n7b5rz.js} +859 -2058
- package/dist/{cli-pn1v1pb0.js → cli-psffsanb.js} +3 -2
- package/dist/{cli-svc803vq.js → cli-q5srsxq2.js} +15 -15
- package/dist/{cli-nmcpzbty.js → cli-qrta34nb.js} +4 -4
- package/dist/{cli-k09cxm6m.js → cli-qx4f057j.js} +2 -2
- package/dist/{cli-eepnpee7.js → cli-s1khw52h.js} +12 -12
- package/dist/{cli-h474mvp5.js → cli-s1zqk1aj.js} +21 -11
- package/dist/{cli-8axx8vnw.js → cli-sb4426be.js} +10 -10
- package/dist/{cli-kqh27v2y.js → cli-th1dkc2v.js} +1 -1
- package/dist/{cli-cw7mc1je.js → cli-tr27kwyg.js} +3 -3
- package/dist/{cli-5kcmxwxv.js → cli-tvgqesec.js} +7 -5
- package/dist/{cli-a9hfzg2r.js → cli-ty3gha1p.js} +6 -6
- package/dist/{cli-fjggej24.js → cli-v46zsvqk.js} +1 -1
- package/dist/{cli-5gygrr67.js → cli-v8z0yga9.js} +4 -4
- package/dist/{cli-k7pt28ad.js → cli-vfqvrd82.js} +5 -5
- package/dist/{cli-vvgaz8t6.js → cli-vq2eg24x.js} +2 -2
- package/dist/{cli-pwsax0vp.js → cli-vsw91x06.js} +23 -22
- package/dist/{cli-7fx9jyfs.js → cli-w1q68d8x.js} +67 -11
- package/dist/{cli-c5cspahx.js → cli-wafmk3fn.js} +45 -20
- package/dist/{cli-ymct0ycy.js → cli-wwp1bd3n.js} +5495 -5095
- package/dist/{cli-me4maa4j.js → cli-y4ccxtz5.js} +45 -9
- package/dist/{cli-m1fbz2wj.js → cli-y8p78ekx.js} +178 -19
- package/dist/{cli-nr46j5pw.js → cli-z0m452jr.js} +1 -1
- package/dist/{cli-gddgcnav.js → cli-zeh2mhkg.js} +1 -1
- package/dist/{cli-e9973bf0.js → cli-zk7v5s89.js} +2 -2
- package/dist/cli.js +24 -23
- package/dist/{cloudflare-workers-ai-system-one-9y1zx3pt.js → cloudflare-workers-ai-system-one-4aysy6rh.js} +2 -2
- package/dist/{codex-adapter-44yq2fkn.js → codex-adapter-exfdbj73.js} +6 -6
- package/dist/{codex-hook-h1zb7cfk.js → codex-hook-59atdwd8.js} +1 -1
- package/dist/{codex-login-cdyrr5y1.js → codex-login-a239g1ah.js} +1 -1
- package/dist/{codex-session-runner-zbh26gbw.js → codex-session-runner-xhznc4g3.js} +6 -6
- package/dist/{commands-54f02v5b.js → commands-d8g349v4.js} +3 -3
- package/dist/{controller-9gpwcdek.js → controller-mwgdmb8y.js} +6 -3
- package/dist/{controllers-connect-61re6k1n.js → controllers-connect-5v7qx04j.js} +22 -20
- package/dist/core-sxy4epp2.js +38 -0
- package/dist/{cursor-adapter-7e4g81vd.js → cursor-adapter-p2q5h35d.js} +1 -1
- package/dist/{db-wnh0qjy1.js → db-qpganbeb.js} +3 -3
- package/dist/{db-dg2gc7fd.js → db-wcw0b2j8.js} +8 -2
- package/dist/{dispatcher-jrm24r43.js → dispatcher-8d8s49yz.js} +20 -18
- package/dist/{docker-9aq30pp2.js → docker-09tkkg0n.js} +42 -3
- package/dist/{dsh-adapter-1yqk267c.js → dsh-adapter-me0twn13.js} +1 -1
- package/dist/{easter-egg-3d-r4h9cs9m.js → easter-egg-3d-wv7w5ty6.js} +1 -1
- package/dist/{embedding-space-bafjr5f7.js → embedding-space-e48xchqa.js} +6 -6
- package/dist/{embeddings-7xmgqe0e.js → embeddings-tgq2afbq.js} +1 -1
- package/dist/{execute-d6jg5ns0.js → execute-8rhwrk7f.js} +1 -1
- package/dist/{external-channel-frq1xvq2.js → external-channel-8bt3j2pm.js} +2 -2
- package/dist/fx-adapter-adtdb3jb.js +19 -0
- package/dist/{google-generative-ai-hh7strj3.js → google-generative-ai-bh0djqjp.js} +5 -5
- package/dist/{google-vertex-fy5bw2pm.js → google-vertex-prjbw8dj.js} +9 -9
- package/dist/grok-adapter-accnn9km.js +19 -0
- package/dist/handlers-1x77561e.js +35 -0
- package/dist/{heartbeat-6bpa611t.js → heartbeat-x0056ra5.js} +23 -21
- package/dist/{hook-hvm5nf46.js → hook-a7vmn2st.js} +5 -5
- package/dist/{hook-w12k146y.js → hook-mrd2ayxv.js} +6 -6
- package/dist/{http-43tthdvs.js → http-ym9c5svp.js} +1335 -363
- package/dist/{index-fn054vsf.js → index-01ns1pkw.js} +1 -1
- package/dist/{index-1f0vypbg.js → index-0h6qd4p1.js} +34 -24
- package/dist/index-48qzcqzj.js +35 -0
- package/dist/{index-4b1q8kan.js → index-4k7m5dgj.js} +629 -354
- package/dist/index-620y7jzq.js +15 -0
- package/dist/{index-cret47a5.js → index-8p0j4h4j.js} +506 -43
- package/dist/{index-m5gx1xd6.js → index-9myfj74s.js} +40 -40
- package/dist/{index-bs7gw5fd.js → index-b5wgnm78.js} +44 -44
- package/dist/{index-ftywhyr0.js → index-ny60jcat.js} +394 -66
- package/dist/{index-tx9mc2ap.js → index-p46tvwtx.js} +24 -22
- package/dist/{index-585gyczt.js → index-pe3d8jfy.js} +3 -3
- package/dist/index-rkvaambe.js +36 -0
- package/dist/{index-mhq4sh5w.js → index-x6azjwm8.js} +1 -1
- package/dist/index-xj1mq27m.js +40 -0
- package/dist/k8s-m56sw868.js +217 -0
- package/dist/{keepalive-rk0j0jvh.js → keepalive-7yxg8z4c.js} +3 -3
- package/dist/lead-enzn86bz.js +74 -0
- package/dist/{maintenance-g6z6kaxw.js → maintenance-6tefxmk1.js} +1 -1
- package/dist/{node-jftbyawr.js → node-2wfcey7d.js} +1 -1
- package/dist/{oauth-refresh-sweep-2k3g2q4w.js → oauth-refresh-sweep-70cavc3a.js} +2 -2
- package/dist/{onboard-6fdbvh3v.js → onboard-fja65z08.js} +5 -5
- package/dist/{openai-decisions-q3hh60wr.js → openai-decisions-ytp6w6xh.js} +1 -1
- package/dist/{opencode-adapter-fdbsvts7.js → opencode-adapter-hakkm7yh.js} +6 -6
- package/dist/{otel-impl-rvwtc09q.js → otel-impl-7zhnt6gj.js} +1 -1
- package/dist/{pending-sqkrb836.js → pending-h01yzpx4.js} +21 -19
- package/dist/{pi-mono-adapter-asqayqcg.js → pi-mono-adapter-f52hz743.js} +40 -13
- package/dist/{pricing-refresh-f5tkgmw2.js → pricing-refresh-fzxvk2zf.js} +2 -2
- package/dist/{rbac-roles-06s555fa.js → rbac-roles-9v6vhgbs.js} +3 -3
- package/dist/{rbac-roles-szxsg8t1.js → rbac-roles-hfgh8sba.js} +2 -2
- package/dist/{render-v2-103p266q.js → render-v2-1rgspxzf.js} +6 -3
- package/dist/{resume-v7kjewt9.js → resume-tqy61x24.js} +10 -7
- package/dist/{runtime-f1gmk0b7.js → runtime-exkxyx5f.js} +1 -1
- package/dist/{session-access-6shev8ts.js → session-access-3act7vt4.js} +4 -4
- package/dist/{session-source-backfill-bd7spzjd.js → session-source-backfill-82qe7fqq.js} +3 -3
- package/dist/{setup-kmxmztdb.js → setup-ry1vfdef.js} +1 -1
- package/dist/thread-buffer-3x93yexa.js +38 -0
- package/dist/{typesafe-system-one-f2en2knd.js → typesafe-system-one-vcfj2ak8.js} +2 -2
- package/dist/user-merge-jobs-bx6bf7db.js +22 -0
- package/dist/{virtual-modules-57eje5wy.js → virtual-modules-s0rjzcqq.js} +3 -3
- package/dist/{work-objects-zr47ygmf.js → work-objects-z2e5tv03.js} +29 -23
- package/dist/{worker-follow-up-grrr3fda.js → worker-follow-up-y3xeg89w.js} +20 -18
- package/dist/worker-zfcv2wbf.js +74 -0
- package/openapi.json +2763 -147
- package/package.json +9 -8
- package/src/apps/catalog.generated.json +43 -3
- package/src/apps/page-validator.ts +27 -0
- package/src/be/boot-seeds.ts +7 -1
- package/src/be/db/model-groups.ts +238 -0
- package/src/be/db/model-profiles.ts +28 -7
- package/src/be/db/session-costs.ts +225 -0
- package/src/be/db/session-log-reasoning.ts +36 -0
- package/src/be/db/tasks/read.ts +8 -3
- package/src/be/db/tasks/write.ts +34 -1
- package/src/be/db/user-references.ts +75 -0
- package/src/be/db/users/references.ts +185 -0
- package/src/be/db-client.ts +70 -19
- package/src/be/db.ts +232 -361
- package/src/be/key-window-usage.ts +386 -0
- package/src/be/memory/demotion-evidence.ts +34 -0
- package/src/be/memory/reranker.ts +34 -12
- package/src/be/memory/review-recall-filter.ts +83 -0
- package/src/be/memory/search-candidates.ts +19 -6
- package/src/be/memory/types.ts +11 -0
- package/src/be/migrations/303_task_ui_specs.sql +28 -0
- package/src/be/migrations/306_provider_account_telemetry.sql +1 -0
- package/src/be/migrations/307_session_cost_credential_attribution.sql +23 -0
- package/src/be/migrations/310_session_logs_reasoning.sql +12 -0
- package/src/be/migrations/312_task_ui_action_runs_repeatable.sql +6 -0
- package/src/be/migrations/314_model_groups.sql +85 -0
- package/src/be/migrations/318_superseded_workflow_cut_backfill.sql +22 -0
- package/src/be/migrations/319_user_fk_indexes.sql +153 -0
- package/src/be/migrations/320_session_costs_kind.sql +4 -0
- package/src/be/migrations/321_user_merge_jobs.sql +52 -0
- package/src/be/pricing-normalize.ts +2 -0
- package/src/be/rbac-roles.ts +6 -4
- package/src/be/runtime-pools/db.ts +23 -5
- package/src/be/runtime-pools/supervisor.ts +15 -1
- package/src/be/scripts/db.ts +11 -0
- package/src/be/scripts/typecheck.ts +2 -0
- package/src/be/seed-model-groups.ts +86 -0
- package/src/be/seed-model-profiles.ts +20 -13
- package/src/be/seed-scripts/catalog/boot-triage.inline.ts +1 -0
- package/src/be/seed-scripts/catalog/boot-triage.ts +1 -0
- package/src/be/seed-scripts/catalog/dreaming-gather.ts +165 -1
- package/src/be/seed-scripts/catalog/wait-for-task.ts +5 -1
- package/src/be/seed-skills/index.ts +3 -0
- package/src/be/swarm-config-guard.ts +58 -1
- package/src/be/task-ui-spec.ts +259 -0
- package/src/be/user-merge-jobs.ts +564 -0
- package/src/be/users.ts +41 -23
- package/src/commands/controller.ts +3 -0
- package/src/commands/credential-outcome-report.ts +13 -3
- package/src/commands/onboard/agent-fs-version.ts +1 -1
- package/src/commands/onboard/compose-generator.ts +1 -1
- package/src/commands/onboard/env-generator.ts +1 -1
- package/src/commands/provider-credentials.ts +1 -1
- package/src/commands/rate-limit-outcome.ts +6 -0
- package/src/commands/runner.ts +34 -53
- package/src/extensions/catalog.generated.json +3 -3
- package/src/extensions/contract-types.generated.ts +1 -1
- package/src/extensions/contract.ts +15 -0
- package/src/extensions/dispatcher.ts +14 -4
- package/src/github/handlers.ts +57 -0
- package/src/github/types.ts +4 -0
- package/src/http/all-routes.ts +2 -0
- package/src/http/api-keys.ts +258 -30
- package/src/http/approval-requests.ts +5 -1
- package/src/http/auth.ts +3 -1
- package/src/http/config.ts +34 -1
- package/src/http/index.ts +13 -0
- package/src/http/memory.ts +19 -6
- package/src/http/model-groups.ts +277 -0
- package/src/http/model-profiles.ts +30 -13
- package/src/http/session-data.ts +74 -23
- package/src/http/sessions.ts +6 -2
- package/src/http/tasks.ts +140 -5
- package/src/http/tool-hooks.ts +140 -0
- package/src/http/users.ts +142 -19
- package/src/http/workflows.ts +19 -1
- package/src/integrations/chat-sdk/inbound.ts +8 -2
- package/src/integrations/chat-sdk/limits.ts +8 -3
- package/src/integrations/chat-sdk/relay.ts +87 -0
- package/src/jira/outbound.ts +5 -3
- package/src/linear/outbound.ts +5 -1
- package/src/prompts/base-prompt.ts +8 -0
- package/src/prompts/session-templates.ts +19 -2
- package/src/providers/acp-targets.ts +2 -2
- package/src/providers/amp-adapter.ts +1 -1
- package/src/providers/claude-adapter.ts +27 -4
- package/src/providers/claude-flag-settings.ts +39 -1
- package/src/providers/codex-adapter.ts +85 -3
- package/src/providers/codex-app-server.ts +9 -5
- package/src/providers/codex-oauth/auth-json.ts +1 -0
- package/src/providers/pi-mono-adapter.ts +35 -2
- package/src/providers/pricing-sources.md +41 -0
- package/src/providers/types.ts +11 -0
- package/src/rbac/legacy-policy.ts +1 -0
- package/src/rbac/permissions.ts +5 -0
- package/src/runtime-providers/docker.ts +65 -1
- package/src/runtime-providers/index.ts +7 -5
- package/src/runtime-providers/k8s.ts +250 -0
- package/src/scheduler/deferred-task-waits.ts +18 -5
- package/src/scripts-runtime/types/stdlib.d.ts +2 -0
- package/src/scripts-runtime/types/swarm-extension.d.ts +24 -9
- package/src/scripts-runtime/types/swarm-sdk.d.ts +2 -0
- package/src/slack/actions.ts +79 -0
- package/src/slack/app.ts +22 -15
- package/src/slack/blocks.ts +23 -2
- package/src/slack/inbound-files.ts +2 -0
- package/src/slack/render-v2.ts +154 -23
- package/src/slack/responses.ts +3 -2
- package/src/slack/work-objects.ts +4 -1
- package/src/tasks/errors.ts +5 -0
- package/src/tests/acp-adapter.test.ts +30 -6
- package/src/tests/api-key-tracking.test.ts +0 -72
- package/src/tests/api-keys-status-model-limits.test.ts +93 -1
- package/src/tests/api-keys-validation.test.ts +42 -0
- package/src/tests/approval-card-resolution.test.ts +7 -1
- package/src/tests/approval-requests-notifications.test.ts +11 -1
- package/src/tests/apps-catalog-page-frame.test.ts +49 -0
- package/src/tests/apps-session-thread.test.ts +79 -0
- package/src/tests/base-prompt.test.ts +111 -5
- package/src/tests/chat-sdk-relay.test.ts +170 -2
- package/src/tests/check-pr-body.test.ts +43 -0
- package/src/tests/claude-adapter-binary.test.ts +67 -6
- package/src/tests/claude-flag-settings.test.ts +29 -0
- package/src/tests/claude-sdk-lifecycle.test.ts +5 -0
- package/src/tests/codex-adapter.test.ts +340 -2
- package/src/tests/codex-app-server.test.ts +16 -0
- package/src/tests/codex-oauth.test.ts +3 -1
- package/src/tests/codex-rate-limits.test.ts +384 -0
- package/src/tests/credential-check.test.ts +14 -6
- package/src/tests/credential-outcome-report.test.ts +20 -0
- package/src/tests/db-client.test.ts +146 -0
- package/src/tests/db-task-read-contract.test.ts +3 -0
- package/src/tests/db-task-write-contract.test.ts +4 -0
- package/src/tests/deferred-task-wake.test.ts +63 -1
- package/src/tests/deploy-guard.test.ts +7 -7
- package/src/tests/deploy-select.test.ts +83 -0
- package/src/tests/docker-isolation-config-guard.test.ts +29 -0
- package/src/tests/docs-index-footprint.test.js +11 -3
- package/src/tests/dreaming-gather-corrections.test.ts +467 -0
- package/src/tests/e2e-visuals-comment.test.ts +82 -0
- package/src/tests/e2e-visuals-verify-pr.test.ts +138 -0
- package/src/tests/event-loop-lag.test.ts +9 -7
- package/src/tests/extensions-example-sql-admin-only.test.ts +7 -4
- package/src/tests/fixtures/extensions/native-tool-recorder/hooks.ts +26 -0
- package/src/tests/fixtures/extensions/native-tool-recorder/manifest.json +10 -0
- package/src/tests/fixtures/onboard/content.compose.yml.txt +1 -1
- package/src/tests/fixtures/onboard/content.env.txt +1 -1
- package/src/tests/fixtures/onboard/dev.compose.yml.txt +1 -1
- package/src/tests/fixtures/onboard/dev.env.txt +1 -1
- package/src/tests/fixtures/onboard/full-all.compose.yml.txt +1 -1
- package/src/tests/fixtures/onboard/full-all.env.txt +1 -1
- package/src/tests/fixtures/onboard/full.compose.yml.txt +1 -1
- package/src/tests/fixtures/onboard/full.env.txt +1 -1
- package/src/tests/fixtures/onboard/research.compose.yml.txt +1 -1
- package/src/tests/fixtures/onboard/research.env.txt +1 -1
- package/src/tests/fixtures/onboard/solo.compose.yml.txt +1 -1
- package/src/tests/fixtures/onboard/solo.env.txt +1 -1
- package/src/tests/fixtures/ui-spec-slack/deploys.json +121 -0
- package/src/tests/fixtures/ui-spec-slack/incident.json +183 -0
- package/src/tests/fixtures/ui-spec-slack/three-charts-stale.json +196 -0
- package/src/tests/fixtures/ui-spec-slack/video-rejected-by-slack.json +183 -0
- package/src/tests/fixtures/ui-spec-slack/video.json +446 -0
- package/src/tests/github-event-filter.test.ts +8 -0
- package/src/tests/github-handlers-inline-comments.test.ts +2 -0
- package/src/tests/github-handlers-reactions.test.ts +4 -0
- package/src/tests/github-handlers.test.ts +3 -0
- package/src/tests/github-sender-trust.test.ts +223 -0
- package/src/tests/gitleaks-download-retry.test.ts +85 -0
- package/src/tests/http-users.test.ts +142 -41
- package/src/tests/human-thread-routing.test.ts +187 -0
- package/src/tests/jira-outbound-sync.test.ts +33 -1
- package/src/tests/k8s-pool-smoke.test.ts +190 -0
- package/src/tests/key-window-usage.test.ts +846 -0
- package/src/tests/linear-outbound-sync.test.ts +30 -1
- package/src/tests/memory-rater-store.test.ts +35 -1
- package/src/tests/memory-reranker.test.ts +39 -4
- package/src/tests/memory-review-recall-filter.test.ts +205 -0
- package/src/tests/migration-318-superseded-workflow-cut-backfill.test.ts +74 -0
- package/src/tests/model-groups-api.test.ts +415 -0
- package/src/tests/model-profiles-api.test.ts +1 -0
- package/src/tests/operator-granted-credentials.test.ts +7 -2
- package/src/tests/operator-granted-role-wire.test.ts +2 -1
- package/src/tests/pi-mono-adapter.test.ts +79 -0
- package/src/tests/preload-env.test.ts +2 -0
- package/src/tests/preload.ts +3 -1
- package/src/tests/prompt-template-session.test.ts +4 -3
- package/src/tests/provider-quota-persistence.test.ts +362 -0
- package/src/tests/rate-limit-event.test.ts +22 -0
- package/src/tests/rbac-engine.test.ts +1 -0
- package/src/tests/reasoning-events.test.ts +164 -0
- package/src/tests/routing-affinity-inventory.test.ts +22 -0
- package/src/tests/runtime-k8s-pools.test.ts +142 -0
- package/src/tests/runtime-pools-db.test.ts +42 -2
- package/src/tests/runtime-pools-http.test.ts +47 -2
- package/src/tests/runtime-provider-registration.test.ts +5 -14
- package/src/tests/runtime-providers-docker.test.ts +91 -0
- package/src/tests/runtime-providers-k8s.test.ts +303 -0
- package/src/tests/script-connections.test.ts +18 -1
- package/src/tests/secret-canary-sweep.test.ts +41 -5
- package/src/tests/seed-scripts.test.ts +23 -0
- package/src/tests/session-cost-attribution.test.ts +748 -0
- package/src/tests/session-costs.test.ts +14 -15
- package/src/tests/session-logs.test.ts +83 -0
- package/src/tests/sessions-detail-batch.test.ts +7 -0
- package/src/tests/short-id.test.ts +23 -0
- package/src/tests/slack-blocks.test.ts +69 -0
- package/src/tests/slack-render-v2.test.ts +411 -0
- package/src/tests/slack-start-reload-race.test.ts +67 -0
- package/src/tests/spec-base-url.test.ts +13 -1
- package/src/tests/subscription-plans.test.ts +20 -1
- package/src/tests/system-one-decide-session-cost.test.ts +196 -0
- package/src/tests/task-ui-action-route.test.ts +249 -0
- package/src/tests/task-ui-actions.test.ts +195 -0
- package/src/tests/task-ui-script-actions.test.ts +517 -0
- package/src/tests/task-ui-spec-fallback.test.ts +65 -0
- package/src/tests/task-ui-spec.test.ts +368 -0
- package/src/tests/tool-hooks-http.test.ts +187 -0
- package/src/tests/ui-spec-script-actions-config.test.ts +196 -0
- package/src/tests/user-delete-perf.test.ts +321 -0
- package/src/tests/user-merge-jobs.test.ts +680 -0
- package/src/tests/vcs-provider.test.ts +25 -5
- package/src/tests/vendored-openapi.test.ts +13 -1
- package/src/tests/workflow-agent-task-retry.test.ts +96 -1
- package/src/tests/workflow-foreach-supersede-retry.test.ts +10 -0
- package/src/tests/workflow-http-v2.test.ts +27 -0
- package/src/tests/workflow-replay.test.ts +10 -1
- package/src/tests/workflow-triggers-v2.test.ts +128 -0
- package/src/tests/workflow-wait-event.test.ts +109 -1
- package/src/tools/defer-task.ts +1 -1
- package/src/tools/memory-search.ts +14 -3
- package/src/tools/store-progress.ts +69 -3
- package/src/tools/swarm-config/delete-config.ts +12 -1
- package/src/tools/swarm-config/set-config.ts +8 -0
- package/src/tools/system-one-decide.ts +113 -3
- package/src/tools/utils.ts +4 -1
- package/src/tools/workflows/create-workflow.ts +2 -0
- package/src/tools/workflows/update-workflow.ts +3 -1
- package/src/types.ts +93 -4
- package/src/ui-spec/actions.ts +112 -0
- package/src/ui-spec/fallback.ts +19 -0
- package/src/ui-spec/schema.ts +38 -0
- package/src/ui-spec/script-actions.ts +340 -0
- package/src/ui-spec/script-allowlist.ts +48 -0
- package/src/ui-spec/slack.ts +17 -0
- package/src/ui-spec/validate.ts +169 -0
- package/src/utils/codex-rate-limits.ts +159 -0
- package/src/utils/credentials.ts +2 -0
- package/src/utils/error-tracker.ts +19 -0
- package/src/utils/provider-account-telemetry.ts +331 -0
- package/src/utils/reasoning-events.ts +107 -0
- package/src/utils/short-id.ts +20 -14
- package/src/utils/subscription-plans.ts +11 -59
- package/src/utils/task-ui-spec.ts +79 -0
- package/src/vcs/index.ts +12 -2
- package/src/workflows/executors/system-one-decision.ts +2 -2
- package/src/workflows/resume.ts +3 -2
- package/src/workflows/task-step-routing.ts +38 -13
- package/src/workflows/triggers.ts +35 -3
- package/templates/extensions/manifest.schema.json +13 -0
- package/templates/extensions/sql-admin-only/README.md +2 -1
- package/templates/extensions/sql-admin-only/hooks.ts +7 -3
- package/templates/extensions/sql-admin-only/manifest.json +1 -1
- package/templates/skills/apps/SKILL.md +32 -5
- package/templates/skills/apps/content.md +32 -5
- package/templates/skills/swarm-docs/content.md +2 -0
- package/templates/skills/ui-spec/config.json +14 -0
- package/templates/skills/ui-spec/content.md +133 -0
- package/templates/workflows/dreaming/content.md +1 -1
- package/dist/acp-adapter-jqn86aam.js +0 -16
- package/dist/cli-7831nhaw.js +0 -93
- package/dist/cli-srtkr1h2.js +0 -12078
- package/dist/fx-adapter-0zrkfbkd.js +0 -19
- package/dist/grok-adapter-3db1c538.js +0 -19
- package/dist/handlers-k22n8mnn.js +0 -33
- package/dist/index-8xcyd3mc.js +0 -33
- package/dist/index-9sy2bh6n.js +0 -38
- package/dist/index-b24j7t2m.js +0 -12797
- package/dist/index-wjd56k1v.js +0 -34
- package/dist/lead-atxf3q6e.js +0 -72
- package/dist/thread-buffer-4yz236d0.js +0 -36
- package/dist/worker-p4hbtcy3.js +0 -72
- package/dist/{azure-openai-responses-590s1eea.js → azure-openai-responses-b3y7fz36.js} +8 -8
- package/dist/{cli-j49yqpvh.js → cli-7evph51z.js} +3 -3
- package/dist/{cli-g0vv9dg4.js → cli-8y43jx2r.js} +8 -8
- package/dist/{cli-m0cy2vyf.js → cli-k6nejceb.js} +4 -4
- package/dist/{mistral-conversations-0c30em7t.js → mistral-conversations-tm2vd4gc.js} +8 -8
- package/dist/{openai-codex-responses-bkcd8pjj.js → openai-codex-responses-sxjv60xx.js} +4 -4
- package/dist/{openai-completions-f3n69rep.js → openai-completions-0c7qnhsx.js} +20 -20
- package/dist/{openai-responses-gbh0wfqe.js → openai-responses-a7h29chp.js} +15 -15
- package/dist/{pi-messages-zebyt7gb.js → pi-messages-2j0fpqwq.js} +5 -5
|
@@ -7,8 +7,7 @@
|
|
|
7
7
|
* (`chatgpt_plan_type`), see `codexPlanFromClaim`. A Claude token from
|
|
8
8
|
* `claude setup-token` has only the `user:inference` scope, so Anthropic's
|
|
9
9
|
* `/api/oauth/profile` answers 403 (checked 2026-09-25). The Claude plan is
|
|
10
|
-
*
|
|
11
|
-
* the operator can always pick it on the dashboard.
|
|
10
|
+
* unknown unless the operator selects it. Historical estimates remain uncertain.
|
|
12
11
|
*/
|
|
13
12
|
|
|
14
13
|
import type { ModelFamily } from "./model-rate-limit-windows";
|
|
@@ -24,20 +23,20 @@ export interface SubscriptionPlan {
|
|
|
24
23
|
excludedModelFamilies?: readonly ModelFamily[];
|
|
25
24
|
}
|
|
26
25
|
|
|
27
|
-
/** List prices from claude.com/pricing and chatgpt.com/pricing, checked 2026-
|
|
28
|
-
export const SUBSCRIPTION_PLANS_CHECKED_AT = "2026-
|
|
26
|
+
/** List prices from claude.com/pricing and chatgpt.com/pricing, checked 2026-11-08. */
|
|
27
|
+
export const SUBSCRIPTION_PLANS_CHECKED_AT = "2026-11-08";
|
|
29
28
|
|
|
30
29
|
export const SUBSCRIPTION_PLANS: readonly SubscriptionPlan[] = [
|
|
31
30
|
{ id: "claude_pro", label: "Claude Pro", keyType: "CLAUDE_CODE_OAUTH_TOKEN", monthlyUsd: 20 },
|
|
32
31
|
{
|
|
33
32
|
id: "claude_max_5x",
|
|
34
|
-
label: "Claude Max
|
|
33
|
+
label: "Claude Max",
|
|
35
34
|
keyType: "CLAUDE_CODE_OAUTH_TOKEN",
|
|
36
35
|
monthlyUsd: 100,
|
|
37
36
|
},
|
|
38
37
|
{
|
|
39
38
|
id: "claude_max_20x",
|
|
40
|
-
label: "Claude
|
|
39
|
+
label: "Claude Ultra",
|
|
41
40
|
keyType: "CLAUDE_CODE_OAUTH_TOKEN",
|
|
42
41
|
monthlyUsd: 200,
|
|
43
42
|
},
|
|
@@ -46,8 +45,8 @@ export const SUBSCRIPTION_PLANS: readonly SubscriptionPlan[] = [
|
|
|
46
45
|
label: "Claude Team, standard seat",
|
|
47
46
|
keyType: "CLAUDE_CODE_OAUTH_TOKEN",
|
|
48
47
|
monthlyUsd: 25,
|
|
49
|
-
//
|
|
50
|
-
//
|
|
48
|
+
// Preserve the existing routing policy. This label update does not
|
|
49
|
+
// establish whether paid usage credits permit a model.
|
|
51
50
|
excludedModelFamilies: ["fable"],
|
|
52
51
|
},
|
|
53
52
|
{
|
|
@@ -58,8 +57,9 @@ export const SUBSCRIPTION_PLANS: readonly SubscriptionPlan[] = [
|
|
|
58
57
|
},
|
|
59
58
|
{ id: "chatgpt_go", label: "ChatGPT Go", keyType: "CODEX_OAUTH", monthlyUsd: 8 },
|
|
60
59
|
{ id: "chatgpt_plus", label: "ChatGPT Plus", keyType: "CODEX_OAUTH", monthlyUsd: 20 },
|
|
61
|
-
{ id: "chatgpt_pro_5x", label: "ChatGPT Pro
|
|
62
|
-
{ id: "chatgpt_pro", label: "ChatGPT Pro
|
|
60
|
+
{ id: "chatgpt_pro_5x", label: "ChatGPT Pro 100", keyType: "CODEX_OAUTH", monthlyUsd: 100 },
|
|
61
|
+
{ id: "chatgpt_pro", label: "ChatGPT Pro 200", keyType: "CODEX_OAUTH", monthlyUsd: 200 },
|
|
62
|
+
{ id: "chatgpt_pro_500", label: "ChatGPT Pro 500", keyType: "CODEX_OAUTH", monthlyUsd: 500 },
|
|
63
63
|
{
|
|
64
64
|
id: "chatgpt_business",
|
|
65
65
|
label: "ChatGPT Business, standard seat",
|
|
@@ -96,20 +96,13 @@ export function planAllowsModelFamily(
|
|
|
96
96
|
return !record.excludedModelFamilies.includes(family);
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
/**
|
|
100
|
-
* Map the `chatgpt_plan_type` JWT claim to a plan id. The claim says `pro`
|
|
101
|
-
* for both Pro tiers, so `pro` maps to the 20x plan (the operator can change
|
|
102
|
-
* it). `free`, `enterprise`, `edu` and unknown values have no list price and
|
|
103
|
-
* return null.
|
|
104
|
-
*/
|
|
99
|
+
/** Map only unambiguous claims to priced plans. Preserve raw Pro identities separately. */
|
|
105
100
|
export function codexPlanFromClaim(claim: string | null | undefined): string | null {
|
|
106
101
|
switch (claim?.toLowerCase()) {
|
|
107
102
|
case "go":
|
|
108
103
|
return "chatgpt_go";
|
|
109
104
|
case "plus":
|
|
110
105
|
return "chatgpt_plus";
|
|
111
|
-
case "pro":
|
|
112
|
-
return "chatgpt_pro";
|
|
113
106
|
case "team":
|
|
114
107
|
case "business":
|
|
115
108
|
return "chatgpt_business";
|
|
@@ -117,44 +110,3 @@ export function codexPlanFromClaim(claim: string | null | undefined): string | n
|
|
|
117
110
|
return null;
|
|
118
111
|
}
|
|
119
112
|
}
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* A Claude token cannot tell its plan, but the provider reports how much of
|
|
123
|
-
* each rate-limit window the credential used. The API-priced spend it ran in
|
|
124
|
-
* the 7-day window, divided by that share, is the window's capacity in USD.
|
|
125
|
-
* Measured on production on 2026-09-25, 3 Max 20x credentials held about
|
|
126
|
-
* $2,000 per 7-day window (8 of 8 windows classified right). Max 5x has 1/4 of
|
|
127
|
-
* the Max 20x capacity and Pro 1/20. The 5-hour window was too noisy (15% of
|
|
128
|
-
* windows looked like Max 5x), so it is not used.
|
|
129
|
-
*/
|
|
130
|
-
const MAX_20X_WEEKLY_CAPACITY_USD = 2000;
|
|
131
|
-
/** Below this share of the week the spend is too small to classify. */
|
|
132
|
-
export const MIN_ESTIMATE_UTILIZATION = 0.25;
|
|
133
|
-
const CLAUDE_TIERS: readonly (readonly [plan: string, shareOfMax20x: number])[] = [
|
|
134
|
-
["claude_pro", 1 / 20],
|
|
135
|
-
["claude_max_5x", 1 / 4],
|
|
136
|
-
["claude_max_20x", 1],
|
|
137
|
-
];
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* Estimate a Claude plan from the 7-day window: the nearest tier on a log
|
|
141
|
-
* scale. Returns null when the window is too little used. Usage outside the
|
|
142
|
-
* swarm on the same account raises the utilization, so it can read a tier low.
|
|
143
|
-
*/
|
|
144
|
-
export function estimateClaudePlan(
|
|
145
|
-
weeklyUtilization: number,
|
|
146
|
-
weeklySpendUsd: number,
|
|
147
|
-
): string | null {
|
|
148
|
-
if (weeklyUtilization < MIN_ESTIMATE_UTILIZATION || weeklySpendUsd <= 0) return null;
|
|
149
|
-
const share = weeklySpendUsd / weeklyUtilization / MAX_20X_WEEKLY_CAPACITY_USD;
|
|
150
|
-
let best: string | null = null;
|
|
151
|
-
let bestDistance = Number.POSITIVE_INFINITY;
|
|
152
|
-
for (const [plan, tierShare] of CLAUDE_TIERS) {
|
|
153
|
-
const distance = Math.abs(Math.log(share / tierShare));
|
|
154
|
-
if (distance < bestDistance) {
|
|
155
|
-
best = plan;
|
|
156
|
-
bestDistance = distance;
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
return best;
|
|
160
|
-
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser-safe constants and types for task UI specs (json-render chat catalog).
|
|
3
|
+
* No package imports: the dashboard imports this file directly.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/** Max UTF-8 bytes of `JSON.stringify(spec)`. */
|
|
7
|
+
export const UI_SPEC_MAX_BYTES = 32_768;
|
|
8
|
+
|
|
9
|
+
/** Max Slack blocks one spec may render as. */
|
|
10
|
+
export const UI_SPEC_MAX_BLOCKS = 45;
|
|
11
|
+
|
|
12
|
+
/** Max elements in one Slack `actions` block. */
|
|
13
|
+
export const UI_SPEC_MAX_ACTIONS_ROW_ELEMENTS = 25;
|
|
14
|
+
|
|
15
|
+
/** Max entries in a uiSpec's `actions` map. Bounds the write-time script checks. */
|
|
16
|
+
export const UI_SPEC_MAX_ACTIONS = 25;
|
|
17
|
+
|
|
18
|
+
/** Prefix on the Slack `action_id` of every spec Button. */
|
|
19
|
+
export const UI_SPEC_ACTION_PREFIX = "swarm_ui:";
|
|
20
|
+
|
|
21
|
+
/** Emitted after a script action replaced a task's card. Data: `{ taskId }`. */
|
|
22
|
+
export const TASK_UI_SPEC_UPDATED_EVENT = "task.ui_spec_updated";
|
|
23
|
+
|
|
24
|
+
/** Allowed id of a declared action, and of the Button that names it. */
|
|
25
|
+
export const UI_SPEC_ACTION_ID = /^[a-z][a-z0-9_]{0,39}$/;
|
|
26
|
+
|
|
27
|
+
/** Limits passed to `toCard` from `@json-render/chat`. */
|
|
28
|
+
export const UI_SPEC_CARD_LIMITS = {
|
|
29
|
+
tables: 1,
|
|
30
|
+
charts: 2,
|
|
31
|
+
chartLabel: 20,
|
|
32
|
+
chartTitle: 50,
|
|
33
|
+
tableRows: 100,
|
|
34
|
+
tableColumns: 20,
|
|
35
|
+
} as const;
|
|
36
|
+
|
|
37
|
+
/** The chat catalog components. Kept equal to `@json-render/chat` by a drift test. */
|
|
38
|
+
export const UI_SPEC_COMPONENTS = [
|
|
39
|
+
"Card",
|
|
40
|
+
"Section",
|
|
41
|
+
"Text",
|
|
42
|
+
"Fields",
|
|
43
|
+
"Field",
|
|
44
|
+
"Table",
|
|
45
|
+
"Chart",
|
|
46
|
+
"Divider",
|
|
47
|
+
"Image",
|
|
48
|
+
"Actions",
|
|
49
|
+
"Button",
|
|
50
|
+
"LinkButton",
|
|
51
|
+
] as const;
|
|
52
|
+
|
|
53
|
+
export type UiSpecComponent = (typeof UI_SPEC_COMPONENTS)[number];
|
|
54
|
+
|
|
55
|
+
export interface TaskUiSpecDocument {
|
|
56
|
+
root: string;
|
|
57
|
+
elements: Record<string, unknown>;
|
|
58
|
+
state?: Record<string, unknown>;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** Max UTF-8 bytes of `JSON.stringify(args)` on a `script` action. */
|
|
62
|
+
export const UI_SPEC_SCRIPT_ARGS_MAX_BYTES = 4_096;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* `follow_up` starts a Lead task once. `script` re-runs an allowlisted global
|
|
66
|
+
* script with frozen `args` and replaces the card with its output.
|
|
67
|
+
*/
|
|
68
|
+
export type TaskUiSpecAction =
|
|
69
|
+
| { kind: "follow_up"; prompt: string }
|
|
70
|
+
| { kind: "script"; script: string; args?: Record<string, unknown> };
|
|
71
|
+
|
|
72
|
+
export interface TaskUiSpec {
|
|
73
|
+
spec: TaskUiSpecDocument;
|
|
74
|
+
actions?: Record<string, TaskUiSpecAction>;
|
|
75
|
+
fallbackText: string;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** What an agent sends on `store-progress`: the spec without the derived fallback text. */
|
|
79
|
+
export type TaskUiSpecInput = Omit<TaskUiSpec, "fallbackText">;
|
package/src/vcs/index.ts
CHANGED
|
@@ -16,9 +16,19 @@ export type { VcsProvider } from "./types";
|
|
|
16
16
|
export function detectVcsProvider(url: string): VcsProvider | null {
|
|
17
17
|
if (isAzureDevOpsUrl(url)) return "azure-devops";
|
|
18
18
|
if (isBitbucketUrl(url)) return "bitbucket";
|
|
19
|
-
// The configured GHES host wins
|
|
19
|
+
// The configured GHES host wins even when its hostname starts with gitlab.
|
|
20
20
|
if (getGitHubLinkConfig().enterprise && isGitHubUrl(url)) return "github";
|
|
21
|
-
|
|
21
|
+
let hostname: string | undefined;
|
|
22
|
+
try {
|
|
23
|
+
hostname = new URL(url).hostname.toLowerCase();
|
|
24
|
+
} catch {
|
|
25
|
+
// SCP-style SSH remotes: user@host:path.
|
|
26
|
+
hostname = url
|
|
27
|
+
.trim()
|
|
28
|
+
.match(/^[^@/\s:]+@([^:/\s]+):/)?.[1]
|
|
29
|
+
?.toLowerCase();
|
|
30
|
+
}
|
|
31
|
+
if (hostname?.startsWith("gitlab.")) return "gitlab";
|
|
22
32
|
if (url.includes("github.com") || /^[\w.-]+\/[\w.-]+$/.test(url)) return "github";
|
|
23
33
|
return null;
|
|
24
34
|
}
|
|
@@ -916,7 +916,7 @@ export class SystemOneDecisionExecutor extends BaseExecutor<
|
|
|
916
916
|
async decide(
|
|
917
917
|
config: SystemOneDecisionConfig,
|
|
918
918
|
): Promise<
|
|
919
|
-
| { ok: true; output: SystemOneDecisionOutput }
|
|
919
|
+
| { ok: true; output: SystemOneDecisionOutput; provider: SystemOneProviderId }
|
|
920
920
|
| { ok: false; error: string; deploymentRefused?: true }
|
|
921
921
|
> {
|
|
922
922
|
const providerId = config.provider ?? (await this.defaultProvider());
|
|
@@ -980,7 +980,7 @@ export class SystemOneDecisionExecutor extends BaseExecutor<
|
|
|
980
980
|
}
|
|
981
981
|
throw err;
|
|
982
982
|
}
|
|
983
|
-
return { ok: true, output: decision };
|
|
983
|
+
return { ok: true, output: decision, provider: providerId };
|
|
984
984
|
}
|
|
985
985
|
|
|
986
986
|
/**
|
package/src/workflows/resume.ts
CHANGED
|
@@ -1370,8 +1370,9 @@ async function processBusEvent(eventName: string, payload: unknown): Promise<voi
|
|
|
1370
1370
|
}
|
|
1371
1371
|
}
|
|
1372
1372
|
|
|
1373
|
-
//
|
|
1374
|
-
|
|
1373
|
+
// Resuming can replace this set with a new wait for the same event. Only
|
|
1374
|
+
// clean up the set this handler processed, never its replacement.
|
|
1375
|
+
if (set.size === 0 && waitsByEvent.get(eventName) === set) {
|
|
1375
1376
|
waitsByEvent.delete(eventName);
|
|
1376
1377
|
const listener = listenersByEvent.get(eventName);
|
|
1377
1378
|
if (listener) {
|
|
@@ -2,8 +2,10 @@ import {
|
|
|
2
2
|
detachTaskFromWorkflowRunStep,
|
|
3
3
|
getDbClient,
|
|
4
4
|
getTaskById,
|
|
5
|
+
getTaskByWorkflowRunStepId,
|
|
5
6
|
getWorkflowRun,
|
|
6
7
|
getWorkflowRunStep,
|
|
8
|
+
markWorkflowStepTaskSuperseded,
|
|
7
9
|
updateWorkflowRun,
|
|
8
10
|
updateWorkflowRunStep,
|
|
9
11
|
} from "../be/db";
|
|
@@ -216,9 +218,10 @@ export const SUPERSEDE_RETRY_POLICY: RetryPolicy = {
|
|
|
216
218
|
* bound to the failed task, detach that task (the executor reuses any task
|
|
217
219
|
* bound to the step, so a bound failed task would park the retry forever), and
|
|
218
220
|
* record the failure with `nextRetryAt` so the retry poller re-dispatches a new
|
|
219
|
-
* task.
|
|
220
|
-
*
|
|
221
|
-
*
|
|
221
|
+
* task. A detached task failed by a supersede cut moves to `superseded`.
|
|
222
|
+
* Bounded by `maxRetries` via the step's persisted `retryCount`, read only
|
|
223
|
+
* after ownership is confirmed: a stale caller's step snapshot may carry the
|
|
224
|
+
* counter of a newer attempt.
|
|
222
225
|
*
|
|
223
226
|
* A foreach child (`<foreachId>#<key>`) with an `agent-task` body takes the
|
|
224
227
|
* parent foreach node's `retry`, else the same supersede default. While queued
|
|
@@ -266,6 +269,9 @@ export async function scheduleTaskStepRetry(
|
|
|
266
269
|
if (current.retryCount >= policy.maxRetries) return "not-eligible";
|
|
267
270
|
await detachTaskFromWorkflowRunStep(taskId);
|
|
268
271
|
await checkpointStepFailure(runId, step.id, reason, current.retryCount, policy);
|
|
272
|
+
// A supersede cut that gets a retry is not a real failure: the step goes
|
|
273
|
+
// on in a fresh task. A cut with no retry stays `failed`.
|
|
274
|
+
await markWorkflowStepTaskSuperseded(taskId);
|
|
269
275
|
return "scheduled";
|
|
270
276
|
});
|
|
271
277
|
}
|
|
@@ -279,6 +285,8 @@ async function isSupersedeCut(taskId: string, reason: string): Promise<boolean>
|
|
|
279
285
|
/**
|
|
280
286
|
* Persist an agent-task result and resolve its next nodes. Synthetic foreach
|
|
281
287
|
* children never checkpoint into workflow context; only their parent join does.
|
|
288
|
+
* With `failureReason` (a failed task the workflow carries on without), a
|
|
289
|
+
* supersede cut on the step's task moves to `superseded`.
|
|
282
290
|
*/
|
|
283
291
|
export async function completeTaskStepAndResolveSuccessors(
|
|
284
292
|
def: WorkflowDefinition,
|
|
@@ -303,11 +311,19 @@ export async function completeTaskStepAndResolveSuccessors(
|
|
|
303
311
|
// A late result inside a cancelled tree routes nothing and revives nothing.
|
|
304
312
|
if (await getRunLineageBlock(runId)) return UNCLAIMED;
|
|
305
313
|
|
|
314
|
+
// Read before the step settles: the task stays bound, so the step's task
|
|
315
|
+
// is the one whose failure this call absorbs.
|
|
316
|
+
const failedTaskId =
|
|
317
|
+
failureReason !== undefined
|
|
318
|
+
? (ownerTaskId ?? (await getTaskByWorkflowRunStepId(step.id))?.id)
|
|
319
|
+
: undefined;
|
|
320
|
+
|
|
321
|
+
let result: TaskStepRoutingResult;
|
|
306
322
|
if (resolveForeachParent(def, step.nodeId)) {
|
|
307
323
|
// onNodeFailure:"continue" completions persist the failure reason as
|
|
308
324
|
// explicit metadata — the join classifies children on THIS, not on
|
|
309
325
|
// whether user-controlled output text happens to start with "[FAILED:".
|
|
310
|
-
|
|
326
|
+
result = toRoutingResult(
|
|
311
327
|
await settleForeachChild(
|
|
312
328
|
def,
|
|
313
329
|
runId,
|
|
@@ -321,16 +337,25 @@ export async function completeTaskStepAndResolveSuccessors(
|
|
|
321
337
|
{ registry },
|
|
322
338
|
),
|
|
323
339
|
);
|
|
340
|
+
} else {
|
|
341
|
+
await checkpointStep(runId, step.id, step.nodeId, { output }, ctx);
|
|
342
|
+
await updateWorkflowRun(runId, { status: "running" });
|
|
343
|
+
result = {
|
|
344
|
+
claimed: true,
|
|
345
|
+
foreachChild: false,
|
|
346
|
+
joined: true,
|
|
347
|
+
successors: getSuccessors(def, step.nodeId),
|
|
348
|
+
runFailed: false,
|
|
349
|
+
};
|
|
324
350
|
}
|
|
325
351
|
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
};
|
|
352
|
+
// The workflow absorbed the failure (onNodeFailure "continue" or a
|
|
353
|
+
// collect-outcomes fan-out): the step ends `completed` and the run goes on,
|
|
354
|
+
// so a supersede cut behind it is not a real failure either. A cut whose
|
|
355
|
+
// step ends `failed` never reaches here and stays `failed`.
|
|
356
|
+
if (failedTaskId && result.claimed && !result.runFailed) {
|
|
357
|
+
await markWorkflowStepTaskSuperseded(failedTaskId);
|
|
358
|
+
}
|
|
359
|
+
return result;
|
|
335
360
|
});
|
|
336
361
|
}
|
|
@@ -13,6 +13,9 @@ const DEFAULT_HMAC_HEADER = "X-Hub-Signature-256";
|
|
|
13
13
|
/** Fallback header names checked (case-insensitive) after the trigger's configured header. */
|
|
14
14
|
const FALLBACK_HMAC_HEADERS = ["x-hub-signature-256", "x-signature", "x-webhook-signature"];
|
|
15
15
|
|
|
16
|
+
/** Header read for a webhook trigger's `events` allowlist when it configures no `eventHeader`. */
|
|
17
|
+
const DEFAULT_EVENT_HEADER = "X-GitHub-Event";
|
|
18
|
+
|
|
16
19
|
/** A bag of HTTP headers — values may be a string, a string array, or absent. */
|
|
17
20
|
export type HeaderBag = Record<string, string | string[] | undefined>;
|
|
18
21
|
|
|
@@ -152,6 +155,25 @@ export async function verifyWebhookRequest(
|
|
|
152
155
|
}
|
|
153
156
|
}
|
|
154
157
|
|
|
158
|
+
/**
|
|
159
|
+
* Event of a delivery a webhook trigger's `events` allowlist does not admit,
|
|
160
|
+
* or `undefined` when the delivery may start a run. A missing header counts
|
|
161
|
+
* as not admitted (`null`): an allowlist is a closed gate.
|
|
162
|
+
*/
|
|
163
|
+
function filteredWebhookEvent(
|
|
164
|
+
trigger: WebhookTriggerConfig,
|
|
165
|
+
headers: HeaderBag,
|
|
166
|
+
): string | null | undefined {
|
|
167
|
+
if (!trigger.events || trigger.events.length === 0) return undefined;
|
|
168
|
+
const event = getHeader(headers, trigger.eventHeader || DEFAULT_EVENT_HEADER) ?? null;
|
|
169
|
+
return event !== null && trigger.events.includes(event) ? undefined : event;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/** Outcome of a webhook delivery: a started run, or a delivery the trigger's `events` allowlist dropped. */
|
|
173
|
+
export type WebhookTriggerResult =
|
|
174
|
+
| { runId: string; skipped?: undefined }
|
|
175
|
+
| { runId?: undefined; skipped: true; reason: "event-not-allowed"; event: string | null };
|
|
176
|
+
|
|
155
177
|
export interface HandleWebhookTriggerOptions {
|
|
156
178
|
/**
|
|
157
179
|
* Skip the "workflow must declare a webhook trigger" gate. ONLY for callers
|
|
@@ -174,11 +196,14 @@ export interface HandleWebhookTriggerOptions {
|
|
|
174
196
|
* trigger — being reachable over `/api/webhooks/:workflowId` is opt-in
|
|
175
197
|
* 3. If `hmacSecret` / `verification` is set, resolves the signature header +
|
|
176
198
|
* secret and verifies the signature against the raw body bytes
|
|
177
|
-
* 4.
|
|
199
|
+
* 4. If the trigger sets an `events` allowlist, drops a delivery whose event
|
|
200
|
+
* header is missing or not listed: no run is persisted, and the caller
|
|
201
|
+
* gets a `skipped` result to acknowledge with a 2xx
|
|
202
|
+
* 5. Parses the raw body as JSON (falling back to the raw string when the
|
|
178
203
|
* body is non-JSON) so downstream `{{trigger.deep.path}}` interpolation
|
|
179
204
|
* can traverse the object — matches the shape produced by the
|
|
180
205
|
* `trigger-workflow` MCP tool.
|
|
181
|
-
*
|
|
206
|
+
* 6. Starts the workflow execution with the parsed payload
|
|
182
207
|
*/
|
|
183
208
|
export async function handleWebhookTrigger(
|
|
184
209
|
workflowId: string,
|
|
@@ -186,7 +211,7 @@ export async function handleWebhookTrigger(
|
|
|
186
211
|
headers: HeaderBag,
|
|
187
212
|
registry: ExecutorRegistry,
|
|
188
213
|
options: HandleWebhookTriggerOptions = {},
|
|
189
|
-
): Promise<
|
|
214
|
+
): Promise<WebhookTriggerResult> {
|
|
190
215
|
const workflow = await getWorkflow(workflowId);
|
|
191
216
|
if (!workflow) {
|
|
192
217
|
throw new WebhookError("Workflow not found", 404);
|
|
@@ -221,6 +246,13 @@ export async function handleWebhookTrigger(
|
|
|
221
246
|
typeof payload === "string" ? payload : JSON.stringify(payload),
|
|
222
247
|
headers,
|
|
223
248
|
);
|
|
249
|
+
|
|
250
|
+
// After verification, so a bad signature is still a 401 for any event.
|
|
251
|
+
// Before the run is persisted, so a dropped delivery writes no rows.
|
|
252
|
+
const filtered = filteredWebhookEvent(webhookTrigger, headers);
|
|
253
|
+
if (filtered !== undefined) {
|
|
254
|
+
return { skipped: true, reason: "event-not-allowed", event: filtered };
|
|
255
|
+
}
|
|
224
256
|
}
|
|
225
257
|
|
|
226
258
|
// Parse the raw body so downstream nodes can interpolate deep paths
|
|
@@ -165,6 +165,19 @@
|
|
|
165
165
|
"author": {
|
|
166
166
|
"type": "string",
|
|
167
167
|
"minLength": 1
|
|
168
|
+
},
|
|
169
|
+
"toolSources": {
|
|
170
|
+
"description": "Which tool calls reach this extension's `pre.tool.call` and `post.tool.call` handlers: `\"mcp\"` for swarm MCP tools, `\"native\"` for harness built-ins (bash, read, write, edit) reported through `POST /api/tool-hooks`. Default `[\"mcp\"]`.",
|
|
171
|
+
"readOnly": true,
|
|
172
|
+
"minItems": 1,
|
|
173
|
+
"type": "array",
|
|
174
|
+
"items": {
|
|
175
|
+
"type": "string",
|
|
176
|
+
"enum": [
|
|
177
|
+
"mcp",
|
|
178
|
+
"native"
|
|
179
|
+
]
|
|
180
|
+
}
|
|
168
181
|
}
|
|
169
182
|
},
|
|
170
183
|
"required": [
|
|
@@ -5,9 +5,10 @@ Blocks `db-query` tool calls made on a task whose creator (`requestedByUserId`)
|
|
|
5
5
|
| Task creator | `db-query` |
|
|
6
6
|
|---|---|
|
|
7
7
|
| Not set, or the call has no task | Allowed |
|
|
8
|
+
| The header's id has no task row (a session with no task) | Allowed |
|
|
8
9
|
| Set, holds an admin role | Allowed |
|
|
9
10
|
| Set, no admin role | Blocked |
|
|
10
|
-
| Set, but the lookup fails
|
|
11
|
+
| Set, but the lookup fails or times out | Blocked |
|
|
11
12
|
|
|
12
13
|
No config. "Admin" means the creator's `users.role` is `admin` (case-insensitive), the role the swarm shows next to a requester's name. Only Lead (`manage-user`) and REST callers with `user.role.manage` can set it. RBAC roles are not used, because every user is created with the RBAC `admin` role. A creator whose user row is gone counts as non-admin.
|
|
13
14
|
|
|
@@ -9,7 +9,7 @@ const SQL_TOOLS = new Set(["db-query"]);
|
|
|
9
9
|
const manifest = {
|
|
10
10
|
name: "sql-admin-only",
|
|
11
11
|
description: "Blocks db-query tool calls on tasks created by a non-admin user",
|
|
12
|
-
version: "1.
|
|
12
|
+
version: "1.1.0",
|
|
13
13
|
runtime: "api",
|
|
14
14
|
assets: { hooks: "hooks.ts" },
|
|
15
15
|
config,
|
|
@@ -64,7 +64,7 @@ const extension: SwarmExtension<typeof manifest> = (api) => {
|
|
|
64
64
|
const taskId = event.requestInfo?.sourceTaskId;
|
|
65
65
|
if (!taskId) return;
|
|
66
66
|
|
|
67
|
-
// Creator lookup.
|
|
67
|
+
// Creator lookup. A failed lookup blocks this SQL call only (fail closed).
|
|
68
68
|
let creator: string;
|
|
69
69
|
let role: string;
|
|
70
70
|
try {
|
|
@@ -74,7 +74,11 @@ const extension: SwarmExtension<typeof manifest> = (api) => {
|
|
|
74
74
|
)) as Envelope;
|
|
75
75
|
if (q?.success === false) throw new Error("db-query lookup returned success=false");
|
|
76
76
|
const row = (q?.data?.rows ?? q?.rows ?? [])[0];
|
|
77
|
-
|
|
77
|
+
// A successful lookup with no row: the id is not a task. The runner sends a
|
|
78
|
+
// random correlation id for sessions with no task (pool or channel-message
|
|
79
|
+
// triggers, src/commands/runner.ts effectiveTaskId). No task means no creator:
|
|
80
|
+
// allow, the same as a missing header. Errors and timeouts above still block.
|
|
81
|
+
if (!row) return;
|
|
78
82
|
creator = String(cell(row, 0, "requestedByUserId") ?? "");
|
|
79
83
|
role = String(cell(row, 1, "role") ?? "");
|
|
80
84
|
} catch (err) {
|
|
@@ -555,7 +555,7 @@ Tones: Badge, Metric and Progress `tone` take `neutral`, `success`, `active`, `e
|
|
|
555
555
|
| `Text` | `content` | `tone: "default" or "muted"`. |
|
|
556
556
|
| `Markdown` | `content` | Rendered Markdown for help, instructions, and rich prose; no children. A link to a GitHub PR, issue, commit or repo, a dashboard task, agent, session or app, or an agent-fs file renders as a chip (icon plus short label), like agent output in a session; `[text](url)` keeps its text. |
|
|
557
557
|
| `SearchInput` | `id` | `placeholder`, `label`, `shortcut` (one key, usually `"/"`: shows a keycap and focuses the field); writes debounced text to `/ui/<id>/value`; no children. |
|
|
558
|
-
| `Select` | `id`, `options` | `options` are strings or `{ value, label?, icon?, hint? }`; `placeholder`, `label`, `clearable`, `searchable` (type to filter; on by default past 8 options), `searchPlaceholder`, `multiple`, `defaultValue` (seeds `/ui/<id>/value` once, before any interaction; a one-entry array with `multiple
|
|
558
|
+
| `Select` | `id`, `options` | `options` are strings or `{ value, label?, icon?, hint? }`; `placeholder`, `label`, `clearable`, `searchable` (type to filter; on by default past 8 options), `searchPlaceholder`, `multiple`, `defaultValue` (seeds `/ui/<id>/value` once, before any interaction; a one-entry array with `multiple`; a value bound to a query that is still loading seeds when it arrives, unless the viewer already picked); writes a string or null to `/ui/<id>/value`, or with `multiple` a string array (empty = nothing picked); no children. |
|
|
559
559
|
| `NumberInput` | `id` | `label`, `placeholder`, `min`, `max`; a text field with a decimal keyboard that writes the parsed number to `/ui/<id>/value` on every change (no debounce), or null when the field is empty; non-numeric text (a bare `-` mid-edit, letters) leaves the stored value untouched; `min`/`max` clamp the stored value and the visible text snaps to it when the field loses focus; no children. |
|
|
560
560
|
| `Chips` | `id`, `options` | Toggle chips for quick filters. `options` are strings or `{ value, label?, icon? }`; `multiple`; `label` (group name for screen readers). Writes a string or null to `/ui/<id>/value`, or a string array with `multiple`; pressing the selected chip clears it. |
|
|
561
561
|
| `Button` | `label` | `variant: "default", "secondary", "outline", "ghost", "destructive", or "destructive-outline"` (use `destructive-outline` for standalone deletes); `disabled` (constant or bound boolean); `busyWith: "<actionName>"` swaps the label for a spinner while that custom action's `/actions/<name>/status` is `"running"` (presses are ignored), then shows a check and `successLabel` for about 1.5s when it turns `"ok"`; `icon`, `iconPosition: "start" or "end"`; `size: "sm", "default", or "lg"`; `shortcut` (one key, shown as a keycap, presses the button); `hint` (tooltip); dispatch with element-level `on.press`. |
|
|
@@ -589,6 +589,7 @@ Tones: Badge, Metric and Progress `tone` take `neutral`, `success`, `active`, `e
|
|
|
589
589
|
| `SchemaForm` | `id`, `schema` | `value`, `baseDoc`, `nodeKey`, `onChange`, `fill`; form generated from a JSON schema's `properties`, mirrored to `/ui/<id>/value`; see below. |
|
|
590
590
|
| `Approval` | `requestId` | `showResolved` (default true), `compact`, `onResolved`; one approval request answered in place by the viewer; see below. |
|
|
591
591
|
| `SessionThread` | `id`, `sessionKey` | `scope`, `placeholder`, `onDispatch`, `fill`; the dashboard's session conversation (the "Session about this page" panel) for one session per viewer and key, with a composer that steers or chains tasks; the draft is mirrored to `/ui/<id>/value`; see below. |
|
|
592
|
+
| `PageFrame` | `pageId` | `device` (`desktop` default, or `mobile`: a 390 px wide frame), `height` (default `640px`), `fill`; a live, clickable swarm Page that reloads when the page changes; see below. |
|
|
592
593
|
|
|
593
594
|
Table details:
|
|
594
595
|
|
|
@@ -714,7 +715,7 @@ SessionThread details — a chat on an app page, one session per viewer and `ses
|
|
|
714
715
|
- Each `app.action` step of `onDispatch` is sent with the session (`{ key, scope }`) and with `followUp: false` unless the step sets `followUp` itself, so the Lead adds no review task to the chain and each message stays one task. A Lead review that is in the chain anyway (a steer the server promoted to a task) is never steered or chained under.
|
|
715
716
|
- "New session" (shown once a session exists) starts over: the next message creates a new root, and the thread shows only sessions created after the current one. Nothing is deleted; older sessions stay in the dashboard's Sessions list.
|
|
716
717
|
- While the session loads, the composer is disabled with a loading notice. A session whose chain cannot be found blocks sending. After a send, the composer stays busy until the new task shows up, for at most 30 seconds.
|
|
717
|
-
- Without `fill` the thread is 420 px tall; `fill: true` fills a `fill`-aware parent. Inside an element instance, `id` is namespaced per instance, so two instances keep separate drafts.
|
|
718
|
+
- Without `fill` the thread is 420 px tall; `fill: true` fills a `fill`-aware parent, and keeps at least 420 px on a phone, where a `Split` or `Grid` stacks its panes. Inside an element instance, `id` is namespaced per instance, so two instances keep separate drafts.
|
|
718
719
|
|
|
719
720
|
```json
|
|
720
721
|
{ "type": "SessionThread", "props": {
|
|
@@ -725,6 +726,22 @@ SessionThread details — a chat on an app page, one session per viewer and `ses
|
|
|
725
726
|
} }
|
|
726
727
|
```
|
|
727
728
|
|
|
729
|
+
PageFrame details — a live swarm Page inside the app, for a preview pane next to a `SessionThread`:
|
|
730
|
+
|
|
731
|
+
- It renders the body `/pages/<pageId>` shows: an HTML page in a sandboxed iframe (scripts, forms and popups; never top navigation), a JSON page inline. The viewer can click and scroll it.
|
|
732
|
+
- It checks the page every 3 s and reloads by itself when the page's `updatedAt` moves: a new version, a restore, a theme switch. A reload resets scroll and any state inside the page.
|
|
733
|
+
- `pageId` is a page id (32 hex characters), usually bound: `{ "$state": "/queries/project/data/0/pageId" }`. A literal slug is rejected; an empty id shows "No page selected".
|
|
734
|
+
- The viewer needs read access to the page: an authed page launches a page session for them, a password page asks for its password.
|
|
735
|
+
- `device: "mobile"` centers a 390 px wide frame, so the page's own media queries see a phone. A JSON page follows the dashboard viewport instead. Switch devices with two `PageFrame`s in `Tabs`, or bind `device` to a `Select`.
|
|
736
|
+
|
|
737
|
+
```json
|
|
738
|
+
{ "type": "PageFrame", "props": {
|
|
739
|
+
"pageId": { "$state": "/queries/project/data/0/pageId" },
|
|
740
|
+
"device": { "$state": "/ui/device/value" },
|
|
741
|
+
"fill": true
|
|
742
|
+
} }
|
|
743
|
+
```
|
|
744
|
+
|
|
728
745
|
Form details:
|
|
729
746
|
|
|
730
747
|
- `fields[]`: `{ name, label?, kind?, options?: string[], placeholder?, required? }`; `kind` is `string`, `text`, `number`, `boolean`, `date`, `enum`, or `file`, and enum fields need `options`.
|
|
@@ -854,16 +871,26 @@ Only inside action-chain `params` (`on.<event>`, `Table.rowActions[].actions`, `
|
|
|
854
871
|
| `{ "$form": "title" }` | One current Form value. |
|
|
855
872
|
| `{ "$form": "" }` | All current Form values. |
|
|
856
873
|
| `{ "$state": "/queries/allIdeas/data" }` | Current value at a valid app state path, including action state such as `/actions/refreshIssues/status`. |
|
|
857
|
-
| `{ "$chain": "leafTaskId" }` | One chain-scope value, published by the component that runs the chain: a task chain (`SessionThread`) carries `leafTaskId` and `newTaskId`; `Approval.onResolved` carries `status`, `responses` and `resolvedBy
|
|
874
|
+
| `{ "$chain": "leafTaskId" }` | One chain-scope value, published by the component that runs the chain: a task chain (`SessionThread`) carries `leafTaskId` and `newTaskId`; `Approval.onResolved` carries `status`, `responses` and `resolvedBy`; `Form.onSubmit` carries `createdRowId` (the row its newest `app.mutate` create step made). The component publishes every key, `null` when it has no value yet; a `null` key resolves to nothing and its param is dropped (a `parentTaskId` bound to a `null` `leafTaskId` creates a root task). Where no chain scope is published (Table), or the key is not one the scope carries (a typo), the sentinel is left in place and the action fails instead of silently dropping the parent. An empty string is not "no parent": a `$state` slot meaning "no parent yet" must hold `null`. |
|
|
858
875
|
| `{ "$chain": "" }` | The whole chain scope. |
|
|
859
876
|
|
|
860
877
|
Each sentinel object must contain exactly the single key shown.
|
|
861
878
|
|
|
862
879
|
An action-chain step is `{ "action": "<type>", "params": {...} }`. Available action types:
|
|
863
880
|
|
|
864
|
-
- `app.mutate`: `{ model, op, rowId?, values?, formId? }`, where `op` is `"create"`, `"update"`, or `"delete"`. `update`/`delete` require `rowId` (usually `{ "$row": "id" }`, or `{ "$state": "/route/params/<param>" }` in a Drawer footer); literal `values` keys must be model columns. Successful mutation refetches all queries on that model.
|
|
881
|
+
- `app.mutate`: `{ model, op, rowId?, values?, formId? }`, where `op` is `"create"`, `"update"`, or `"delete"`. `update`/`delete` require `rowId` (usually `{ "$row": "id" }`, or `{ "$state": "/route/params/<param>" }` in a Drawer footer); literal `values` keys must be model columns. Successful mutation refetches all queries on that model. In a `Form.onSubmit` chain, steps after a `create` read the new row's id as `{ "$chain": "createdRowId" }`, e.g. to navigate to the new row (not `$state`: the renderer resolves a chain's `$state` reads when the form renders, before the row exists).
|
|
865
882
|
- `app.refresh`: `{ query? }`; omit `query` to refetch all, or name a declared query.
|
|
866
|
-
- `app.action`: `{ name, input?, parentTaskId?, followUp? }`; `name` must be declared in definition `actions`. For a task-kind row action, pass whole-row context with `input: { issue: { "$row": "" } }`. `parentTaskId` chains the created task under an existing one for task-kind actions (typically `{ "$chain": "leafTaskId" }`; a literal or `$state` task id also works); a script or sync action rejects it with 400. `followUp: false` creates the task with no Lead follow-up (the review task the Lead adds when a worker task finishes); script and sync actions ignore it. A task an action creates is attributed to the viewer's identity. `session: { key, scope }`
|
|
883
|
+
- `app.action`: `{ name, input?, parentTaskId?, followUp? }`; `name` must be declared in definition `actions`. For a task-kind row action, pass whole-row context with `input: { issue: { "$row": "" } }`. `parentTaskId` chains the created task under an existing one for task-kind actions (typically `{ "$chain": "leafTaskId" }`; a literal or `$state` task id also works); a script or sync action rejects it with 400. `followUp: false` creates the task with no Lead follow-up (the review task the Lead adds when a worker task finishes); script and sync actions ignore it. A task an action creates is attributed to the viewer's identity. `session: { key, scope? }` keys a task-kind action's task into the viewer's `SessionThread` session for that key; the server builds the key, never the page. SessionThread sets it on its own `onDispatch` steps (replacing any value there). Any other chain can set it to start a session: `key` is a literal plain token (validated like `sessionKey`) or a binding; a key that does not resolve to a token fails the step instead of creating a task outside the session, `scope: "shared"` is rejected, and a session step defaults to `followUp: false`. Example, a create form that sends the idea as the chat's first message:
|
|
884
|
+
|
|
885
|
+
```json
|
|
886
|
+
"onSubmit": [
|
|
887
|
+
{ "action": "app.mutate", "params": { "model": "project", "op": "create", "values": { "name": { "$form": "name" } } } },
|
|
888
|
+
{ "action": "app.action", "params": { "name": "build", "input": { "message": { "$form": "idea" } }, "session": { "key": { "$chain": "createdRowId" } } } },
|
|
889
|
+
{ "action": "app.navigate", "params": { "page": "studio", "params": { "projectId": { "$chain": "createdRowId" } } } }
|
|
890
|
+
]
|
|
891
|
+
```
|
|
892
|
+
|
|
893
|
+
The `studio` page's `SessionThread` with `"sessionKey": { "$state": "/route/params/projectId" }` then shows the idea as its first message and the running task, with no second send.
|
|
867
894
|
- `app.navigate`: `{ page, params? }`; `page` must be declared, supplied keys must be params of the target page, and every required target param must be supplied. `params` replace the current route params wholesale and may contain action sentinels. Navigation pushes history, so browser Back returns to the previous page/params; only `mode` is preserved automatically.
|
|
868
895
|
- `ui.toast`: `{ message, description?, tone?, undo? }`, where `tone` is `"success"`, `"error"`, `"info"` (default), or `"warning"`. `undo: { label?, actions }` adds an Undo button (default label `Undo`) that runs `actions` as a chain; its steps are validated like any chain. Put it after the step it confirms, e.g. a row delete followed by `{ "action": "ui.toast", "params": { "message": "Order deleted", "undo": { "actions": [{ "action": "app.mutate", "params": { "model": "order", "op": "create", "values": { "title": { "$row": "title" } } } }] } } }`. Undo params resolve `$state` when Undo is pressed; `$row` / `$form` resolve when the toast is shown.
|
|
869
896
|
- `swarm.sdk`: `{ sdk, args? }`; invokes a catalog-supported Swarm browser SDK method with the viewer's bearer.
|