@desplega.ai/agent-swarm 2.9.1 → 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-ny75x1qy.js → acp-targets-arrwv4f0.js} +6 -6
- package/dist/{actions-b9qgrmeq.js → actions-y0d2n1c2.js} +49 -28
- package/dist/{agent-fs-provision-b5dhdsbd.js → agent-fs-provision-tpj7sktd.js} +4 -4
- package/dist/{amp-adapter-vtax2c9s.js → amp-adapter-vmmnmw8d.js} +1 -1
- package/dist/{anthropic-messages-r5xf5hqw.js → anthropic-messages-zdca3gv1.js} +13 -13
- package/dist/{app-g2z15hax.js → app-wb7w45dq.js} +3 -3
- package/dist/{approval-notifications-yt13wp8r.js → approval-notifications-7mqr6vbd.js} +5 -5
- package/dist/{assistant-2cgfxsgk.js → assistant-gf60454p.js} +19 -19
- package/dist/{boot-args-schema-3gwy0f60.js → boot-args-schema-qxmd59sr.js} +1 -1
- package/dist/{boot-reembed-mywmyp4s.js → boot-reembed-5tmeskj2.js} +1 -1
- package/dist/{boot-reembed-92g7s5zp.js → boot-reembed-wb44vc3s.js} +1 -1
- package/dist/boot-scrub-sweep-25bxhnw4.js +9 -0
- package/dist/{boot-seeds-ce7rvgq1.js → boot-seeds-nj9za0vk.js} +4 -4
- package/dist/{claude-adapter-3m4q7735.js → claude-adapter-d3krpdyb.js} +5 -5
- package/dist/{claude-managed-setup-c217draw.js → claude-managed-setup-7y4pwd81.js} +1 -1
- package/dist/{claude-sdk-session-7fbqm51z.js → claude-sdk-session-d138zy0e.js} +5 -5
- package/dist/{cli-tvc4jag9.js → cli-01k6wpr9.js} +3 -3
- package/dist/{cli-2xs8tsf7.js → cli-124ntmf0.js} +42 -36
- package/dist/{cli-jm0hvmz2.js → cli-2rnd5j3t.js} +1 -1
- package/dist/{cli-32djehja.js → cli-2spnz7ye.js} +8 -8
- package/dist/{cli-2dq9yv8p.js → cli-2v2zdm0a.js} +1 -1
- package/dist/{cli-fkef327x.js → cli-3caf7pmg.js} +2 -2
- package/dist/{cli-mw620q3n.js → cli-3et6fmfe.js} +1 -1
- package/dist/{cli-h9yqfzx9.js → cli-3f8zbtqa.js} +3 -3
- package/dist/{cli-mhapr559.js → cli-43evxwj4.js} +1 -1
- package/dist/{cli-pyjn0qhk.js → cli-539h29es.js} +138 -21
- package/dist/{cli-bnqncekd.js → cli-5qhfv9rw.js} +2 -2
- package/dist/{cli-p4kckx1z.js → cli-6037prsx.js} +6 -6
- package/dist/{cli-zr6qy15y.js → cli-6cwr32fe.js} +17 -17
- package/dist/{cli-1jykg0py.js → cli-7r162fxe.js} +22 -15
- package/dist/{cli-sn650d7x.js → cli-8st34zhr.js} +20 -10
- package/dist/{cli-rq5rpv6k.js → cli-91pkxres.js} +1 -1
- package/dist/{cli-m7zvgt57.js → cli-9fjr27ez.js} +10 -10
- package/dist/{cli-f8x9drqr.js → cli-aw83sr40.js} +19 -5
- package/dist/{cli-jkw6ptfw.js → cli-cc93xzes.js} +5 -5
- package/dist/{cli-gfy38pvt.js → cli-fcfbct2j.js} +5 -5
- package/dist/{cli-nafvvsp8.js → cli-fq2rr3jb.js} +5 -5
- package/dist/{boot-scrub-sweep-7dkdzqxx.js → cli-had1p04a.js} +8 -9
- package/dist/{cli-bg63qmsx.js → cli-j6te8keb.js} +4 -4
- package/dist/{cli-br0924pw.js → cli-jrbq4djp.js} +1 -1
- package/dist/{cli-kxx4k2jw.js → cli-k3q2va86.js} +2 -2
- package/dist/{cli-jaw5v1sy.js → cli-k5yewqgd.js} +3 -3
- package/dist/cli-kbtzfrxj.js +404 -0
- package/dist/{cli-td9tb872.js → cli-m9cvf7vs.js} +7 -7
- package/dist/{cli-f3jyzq4g.js → cli-md50mj0r.js} +2 -2
- package/dist/{cli-xag7btpe.js → cli-mk7c5ac4.js} +1 -1
- package/dist/cli-mys27d03.js +321 -0
- package/dist/{cli-nbt14he0.js → cli-nstkanmx.js} +5 -5
- package/dist/{cli-wn13hhdt.js → cli-nv4xsvmk.js} +4 -4
- package/dist/{cli-vyff45ve.js → cli-p0c3vtch.js} +2 -2
- package/dist/{cli-2czxfnvj.js → cli-p0n7b5rz.js} +662 -93
- package/dist/{cli-j7svy295.js → cli-q5srsxq2.js} +12 -12
- package/dist/{cli-vt89089n.js → cli-qrta34nb.js} +4 -4
- package/dist/{cli-ysvspf5e.js → cli-qx4f057j.js} +2 -2
- package/dist/{cli-zh0e5x7p.js → cli-s1khw52h.js} +11 -11
- package/dist/{cli-mkwkwq81.js → cli-s1zqk1aj.js} +18 -11
- package/dist/{cli-f9gz2vyj.js → cli-sb4426be.js} +7 -7
- package/dist/{cli-dgs10ttj.js → cli-th1dkc2v.js} +1 -1
- package/dist/{cli-3j873zxq.js → cli-tr27kwyg.js} +2 -2
- package/dist/{cli-6945ywhr.js → cli-tvgqesec.js} +6 -4
- package/dist/{cli-fjggej24.js → cli-v46zsvqk.js} +1 -1
- package/dist/{cli-67mwzr35.js → cli-v8z0yga9.js} +4 -4
- package/dist/{cli-pb2ay3sh.js → cli-vfqvrd82.js} +5 -5
- package/dist/{cli-fh97xn30.js → cli-vq2eg24x.js} +2 -2
- package/dist/{cli-v57d7fmm.js → cli-vsw91x06.js} +23 -22
- package/dist/{cli-2yjj3e31.js → cli-w1q68d8x.js} +9 -7
- package/dist/{cli-y2ewxhth.js → cli-wafmk3fn.js} +10 -10
- package/dist/{cli-ctx0b85j.js → cli-wwp1bd3n.js} +257 -101
- package/dist/{cli-bkjdknnp.js → cli-y4ccxtz5.js} +37 -5
- package/dist/{cli-w4n323t3.js → cli-y8p78ekx.js} +7 -7
- package/dist/{cli-8zh9nrew.js → cli-z0m452jr.js} +1 -1
- package/dist/{cli-mjw0yf82.js → cli-zeh2mhkg.js} +1 -1
- package/dist/{cli-jwampxxq.js → cli-zk7v5s89.js} +2 -2
- package/dist/cli.js +16 -16
- package/dist/{cloudflare-workers-ai-system-one-9y1zx3pt.js → cloudflare-workers-ai-system-one-4aysy6rh.js} +2 -2
- package/dist/{codex-adapter-n656pvb8.js → codex-adapter-exfdbj73.js} +4 -4
- package/dist/{codex-session-runner-p0fbv5y9.js → codex-session-runner-xhznc4g3.js} +4 -4
- package/dist/{commands-gwea8z5p.js → commands-d8g349v4.js} +3 -3
- package/dist/{controller-t67c3grh.js → controller-mwgdmb8y.js} +3 -3
- package/dist/{controllers-connect-ks155r0h.js → controllers-connect-5v7qx04j.js} +19 -19
- package/dist/core-sxy4epp2.js +38 -0
- package/dist/{cursor-adapter-ygwrtmkv.js → cursor-adapter-p2q5h35d.js} +1 -1
- package/dist/{db-rb2xqdb1.js → db-qpganbeb.js} +3 -3
- package/dist/{db-kpmx06s9.js → db-wcw0b2j8.js} +2 -2
- package/dist/{dispatcher-31sm0ej2.js → dispatcher-8d8s49yz.js} +17 -17
- package/dist/{dsh-adapter-qyxh0w31.js → dsh-adapter-me0twn13.js} +1 -1
- package/dist/{easter-egg-3d-00wjscn6.js → easter-egg-3d-wv7w5ty6.js} +1 -1
- package/dist/{embedding-space-qhw4g68n.js → embedding-space-e48xchqa.js} +6 -6
- package/dist/{embeddings-zdv9ke6x.js → embeddings-tgq2afbq.js} +1 -1
- package/dist/{execute-zna8wwr7.js → execute-8rhwrk7f.js} +1 -1
- package/dist/{external-channel-1ac6t56s.js → external-channel-8bt3j2pm.js} +2 -2
- package/dist/{fx-adapter-sk7n0fzc.js → fx-adapter-adtdb3jb.js} +8 -8
- package/dist/{grok-adapter-sjbcm5ew.js → grok-adapter-accnn9km.js} +8 -8
- package/dist/handlers-1x77561e.js +35 -0
- package/dist/{heartbeat-2f6z4kdx.js → heartbeat-x0056ra5.js} +20 -20
- package/dist/{hook-w1skzaqc.js → hook-a7vmn2st.js} +4 -4
- package/dist/{hook-8y0gvtp1.js → hook-mrd2ayxv.js} +5 -5
- package/dist/{http-wghxvpef.js → http-ym9c5svp.js} +676 -273
- package/dist/{index-s71ez27v.js → index-01ns1pkw.js} +1 -1
- package/dist/index-48qzcqzj.js +35 -0
- package/dist/{index-9zkchs9t.js → index-ny60jcat.js} +186 -14
- package/dist/{index-rv89fvzf.js → index-p46tvwtx.js} +21 -21
- package/dist/index-rkvaambe.js +36 -0
- package/dist/{index-8zn8nxn5.js → index-x6azjwm8.js} +1 -1
- package/dist/{index-25pvya7q.js → index-xj1mq27m.js} +17 -17
- package/dist/k8s-m56sw868.js +217 -0
- package/dist/{keepalive-sh02349h.js → keepalive-7yxg8z4c.js} +3 -3
- package/dist/lead-enzn86bz.js +74 -0
- package/dist/{maintenance-yj0dcjja.js → maintenance-6tefxmk1.js} +1 -1
- package/dist/{oauth-refresh-sweep-d9xedk66.js → oauth-refresh-sweep-70cavc3a.js} +2 -2
- package/dist/{onboard-dpgjn03r.js → onboard-fja65z08.js} +5 -5
- package/dist/{openai-decisions-q3hh60wr.js → openai-decisions-ytp6w6xh.js} +1 -1
- package/dist/{opencode-adapter-2d31cpjc.js → opencode-adapter-hakkm7yh.js} +5 -5
- package/dist/{otel-impl-1skarpfq.js → otel-impl-7zhnt6gj.js} +1 -1
- package/dist/{pending-bfmxtx0g.js → pending-h01yzpx4.js} +18 -18
- package/dist/{pi-mono-adapter-gvppnasy.js → pi-mono-adapter-f52hz743.js} +6 -6
- package/dist/{pricing-refresh-c6b325mk.js → pricing-refresh-fzxvk2zf.js} +2 -2
- package/dist/{rbac-roles-h80qbdbs.js → rbac-roles-9v6vhgbs.js} +3 -3
- package/dist/{rbac-roles-zfcx68tx.js → rbac-roles-hfgh8sba.js} +2 -2
- package/dist/{render-v2-nx20t3rb.js → render-v2-1rgspxzf.js} +3 -3
- package/dist/{resume-5ep8agan.js → resume-tqy61x24.js} +7 -7
- package/dist/{runtime-r3pj4mce.js → runtime-exkxyx5f.js} +1 -1
- package/dist/{session-access-n7p3m15b.js → session-access-3act7vt4.js} +4 -4
- package/dist/{session-source-backfill-v8mt0zwn.js → session-source-backfill-82qe7fqq.js} +2 -2
- package/dist/{setup-z1psaqhe.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-rrbjdpxn.js → virtual-modules-s0rjzcqq.js} +3 -3
- package/dist/{work-objects-4aghh73z.js → work-objects-z2e5tv03.js} +20 -20
- package/dist/{worker-follow-up-166zmex1.js → worker-follow-up-y3xeg89w.js} +17 -17
- package/dist/worker-zfcv2wbf.js +74 -0
- package/openapi.json +1630 -388
- package/package.json +3 -3
- package/src/be/boot-seeds.ts +7 -1
- package/src/be/db/model-groups.ts +238 -0
- package/src/be/db/model-profiles.ts +26 -8
- package/src/be/db/session-costs.ts +8 -2
- package/src/be/db/tasks/read.ts +3 -2
- package/src/be/db/tasks/write.ts +2 -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 +32 -57
- package/src/be/key-window-usage.ts +1 -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/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 +20 -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/dreaming-gather.ts +165 -1
- package/src/be/swarm-config-guard.ts +34 -0
- package/src/be/task-ui-spec.ts +102 -1
- package/src/be/user-merge-jobs.ts +564 -0
- package/src/be/users.ts +41 -23
- 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/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/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/tasks.ts +41 -6
- 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/providers/acp-targets.ts +2 -2
- package/src/providers/amp-adapter.ts +1 -1
- package/src/providers/pricing-sources.md +9 -0
- package/src/rbac/legacy-policy.ts +1 -0
- package/src/rbac/permissions.ts +5 -0
- package/src/runtime-providers/index.ts +7 -5
- package/src/runtime-providers/k8s.ts +250 -0
- package/src/scripts-runtime/types/stdlib.d.ts +2 -0
- package/src/scripts-runtime/types/swarm-extension.d.ts +16 -1
- package/src/scripts-runtime/types/swarm-sdk.d.ts +2 -0
- package/src/slack/actions.ts +33 -10
- package/src/slack/blocks.ts +23 -2
- package/src/slack/render-v2.ts +47 -0
- package/src/tests/acp-adapter.test.ts +26 -0
- package/src/tests/chat-sdk-relay.test.ts +21 -1
- package/src/tests/check-pr-body.test.ts +43 -0
- package/src/tests/credential-check.test.ts +14 -6
- package/src/tests/db-client.test.ts +146 -0
- package/src/tests/deploy-guard.test.ts +7 -7
- package/src/tests/deploy-select.test.ts +83 -0
- package/src/tests/dreaming-gather-corrections.test.ts +467 -0
- package/src/tests/event-loop-lag.test.ts +9 -7
- 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/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/http-users.test.ts +142 -41
- package/src/tests/k8s-pool-smoke.test.ts +190 -0
- package/src/tests/key-window-usage.test.ts +15 -0
- 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/rbac-engine.test.ts +1 -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-k8s.test.ts +303 -0
- package/src/tests/script-connections.test.ts +13 -1
- 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 +54 -0
- package/src/tests/spec-base-url.test.ts +13 -1
- package/src/tests/system-one-decide-session-cost.test.ts +196 -0
- package/src/tests/task-ui-action-route.test.ts +59 -1
- package/src/tests/task-ui-script-actions.test.ts +517 -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 +62 -0
- 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/memory-search.ts +14 -3
- package/src/tools/store-progress.ts +26 -26
- 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 +86 -2
- package/src/ui-spec/actions.ts +30 -4
- 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/utils/short-id.ts +20 -14
- package/src/utils/task-ui-spec.ts +16 -4
- 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 +30 -10
- package/src/workflows/triggers.ts +35 -3
- package/templates/extensions/manifest.schema.json +13 -0
- package/templates/skills/swarm-docs/content.md +2 -0
- package/templates/skills/ui-spec/content.md +7 -1
- package/templates/workflows/dreaming/content.md +1 -1
- package/dist/acp-adapter-g909b5hw.js +0 -16
- package/dist/cli-b91nz213.js +0 -93
- package/dist/handlers-yzy0c87x.js +0 -35
- package/dist/index-2t4859r5.js +0 -35
- package/dist/index-cxca2t8y.js +0 -36
- package/dist/lead-gk4h5eg7.js +0 -74
- package/dist/thread-buffer-a1re2r9r.js +0 -38
- package/dist/worker-3dyyb8ev.js +0 -74
- package/dist/{azure-openai-responses-590s1eea.js → azure-openai-responses-b3y7fz36.js} +8 -8
- package/dist/{cli-m7c2380k.js → cli-3aaeb78m.js} +4 -4
- package/dist/{cli-g0vv9dg4.js → cli-8y43jx2r.js} +8 -8
- package/dist/{cli-m0cy2vyf.js → cli-k6nejceb.js} +4 -4
- package/dist/{google-generative-ai-maq6c9bf.js → google-generative-ai-bh0djqjp.js} +4 -4
- package/dist/{google-vertex-2jgsw2nb.js → google-vertex-prjbw8dj.js} +8 -8
- package/dist/{mistral-conversations-0c30em7t.js → mistral-conversations-tm2vd4gc.js} +8 -8
- package/dist/{node-dqm4xgxw.js → node-2wfcey7d.js} +0 -0
- 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
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
getDb2,
|
|
17
17
|
getDbClient2,
|
|
18
18
|
init_runtime2,
|
|
19
|
+
insertSessionCost2,
|
|
19
20
|
chatSdkContextKey,
|
|
20
21
|
chatThreadOfContextKey,
|
|
21
22
|
agentmailContextKey,
|
|
@@ -66,6 +67,9 @@ import {
|
|
|
66
67
|
firstIssueText,
|
|
67
68
|
isAdapterEntryEnabled,
|
|
68
69
|
init_schema,
|
|
70
|
+
UI_SPEC_SCRIPT_ACTIONS_KEY,
|
|
71
|
+
parseScriptActionAllowlist,
|
|
72
|
+
init_script_allowlist,
|
|
69
73
|
API_DRAIN_MAX_MS_LIMIT,
|
|
70
74
|
init_api_drain2,
|
|
71
75
|
parseEnabledTools,
|
|
@@ -75,6 +79,8 @@ import {
|
|
|
75
79
|
init_follow_up_gate_schedule_ids,
|
|
76
80
|
isInternalConfigKey,
|
|
77
81
|
internalConfigKeyError,
|
|
82
|
+
isHumanOnlyConfigKey,
|
|
83
|
+
humanOnlyConfigKeyError,
|
|
78
84
|
isReservedConfigKey,
|
|
79
85
|
reservedKeyError,
|
|
80
86
|
validateConfigValue,
|
|
@@ -132,6 +138,9 @@ import {
|
|
|
132
138
|
computeScore,
|
|
133
139
|
rerank,
|
|
134
140
|
init_reranker,
|
|
141
|
+
isReviewTaskId,
|
|
142
|
+
dropReviewTaskCompletions,
|
|
143
|
+
init_review_recall_filter,
|
|
135
144
|
searchMemoryCandidates,
|
|
136
145
|
init_search_candidates,
|
|
137
146
|
rowToCandidate,
|
|
@@ -143,6 +152,7 @@ import {
|
|
|
143
152
|
init_embeddings,
|
|
144
153
|
upsertScriptByName,
|
|
145
154
|
getScript,
|
|
155
|
+
getGlobalScriptContentHashes,
|
|
146
156
|
getScriptById,
|
|
147
157
|
getScriptVersion,
|
|
148
158
|
deleteScript,
|
|
@@ -160,6 +170,8 @@ import {
|
|
|
160
170
|
init_oauth,
|
|
161
171
|
taskModelPin,
|
|
162
172
|
init_model_pin,
|
|
173
|
+
normalizeModelKey,
|
|
174
|
+
init_pricing_normalize,
|
|
163
175
|
upsertModelCatalogOverlay,
|
|
164
176
|
init_model_catalog_store,
|
|
165
177
|
explicitModelErrorForAgent,
|
|
@@ -206,6 +218,8 @@ import {
|
|
|
206
218
|
carryUnhandledSteering,
|
|
207
219
|
requestSteering,
|
|
208
220
|
init_steering2,
|
|
221
|
+
onTaskStarted,
|
|
222
|
+
init_task_lifecycle_events,
|
|
209
223
|
computeContentHash2,
|
|
210
224
|
getContextVersion2,
|
|
211
225
|
getContextVersionHistory2,
|
|
@@ -213,8 +227,6 @@ import {
|
|
|
213
227
|
assertAssetKeyMovesAllowed2,
|
|
214
228
|
moveSessionChains,
|
|
215
229
|
init_session_moves,
|
|
216
|
-
onTaskStarted,
|
|
217
|
-
init_task_lifecycle_events,
|
|
218
230
|
getPendingTaskForAgent2,
|
|
219
231
|
startTask2,
|
|
220
232
|
updateTaskClaudeSessionId2,
|
|
@@ -369,6 +381,7 @@ import {
|
|
|
369
381
|
deleteUser2,
|
|
370
382
|
getRootTaskChain2,
|
|
371
383
|
getBudget2,
|
|
384
|
+
getActivePricingRow2,
|
|
372
385
|
getDailySpendForAgent2,
|
|
373
386
|
getDailySpendGlobal2,
|
|
374
387
|
getDailySpendForUser2,
|
|
@@ -387,23 +400,23 @@ import {
|
|
|
387
400
|
recordInlineScriptRun2,
|
|
388
401
|
exports_db,
|
|
389
402
|
init_db4
|
|
390
|
-
} from "./cli-
|
|
403
|
+
} from "./cli-wwp1bd3n.js";
|
|
391
404
|
import {
|
|
392
405
|
assertMayActOnOperatorGrantedTarget2,
|
|
393
406
|
getUserGrant2,
|
|
394
407
|
init_rbac_roles
|
|
395
|
-
} from "./cli-
|
|
408
|
+
} from "./cli-vfqvrd82.js";
|
|
396
409
|
import {
|
|
397
410
|
ensurePricingSeeded2,
|
|
398
411
|
ensureRbacSeeded2,
|
|
399
412
|
ensureModelProfilesSeeded2,
|
|
400
413
|
init_boot_seeds
|
|
401
|
-
} from "./cli-
|
|
414
|
+
} from "./cli-mys27d03.js";
|
|
402
415
|
import {
|
|
403
416
|
requestModelCatalogRefresh2,
|
|
404
417
|
startPricingRefreshLoop2,
|
|
405
418
|
init_pricing_refresh
|
|
406
|
-
} from "./cli-
|
|
419
|
+
} from "./cli-th1dkc2v.js";
|
|
407
420
|
import {
|
|
408
421
|
workflowEventBus2,
|
|
409
422
|
init_event_bus
|
|
@@ -416,7 +429,7 @@ import {
|
|
|
416
429
|
externalChannelToolError2,
|
|
417
430
|
getChannelBlockReason2,
|
|
418
431
|
init_external_channel
|
|
419
|
-
} from "./cli-
|
|
432
|
+
} from "./cli-mk7c5ac4.js";
|
|
420
433
|
import {
|
|
421
434
|
tableToAscii2,
|
|
422
435
|
init_dist8
|
|
@@ -452,14 +465,19 @@ import {
|
|
|
452
465
|
init_task_citations2,
|
|
453
466
|
getTaskUiSpec,
|
|
454
467
|
upsertTaskUiSpec,
|
|
468
|
+
acquireTaskUiScriptActionRun,
|
|
469
|
+
finishTaskUiScriptActionRun,
|
|
455
470
|
hasTaskUiSpecCheckRefusal,
|
|
456
471
|
init_task_ui_spec,
|
|
457
472
|
standardComponentDefinitions,
|
|
458
473
|
CardSpecError,
|
|
459
474
|
toCard,
|
|
460
475
|
init_dist5,
|
|
476
|
+
UI_SPEC_MAX_ACTIONS,
|
|
477
|
+
TASK_UI_SPEC_UPDATED_EVENT,
|
|
461
478
|
UI_SPEC_ACTION_ID,
|
|
462
479
|
UI_SPEC_CARD_LIMITS,
|
|
480
|
+
UI_SPEC_SCRIPT_ARGS_MAX_BYTES,
|
|
463
481
|
init_task_ui_spec2,
|
|
464
482
|
validateTaskUiSpec,
|
|
465
483
|
init_validate2,
|
|
@@ -474,7 +492,7 @@ import {
|
|
|
474
492
|
startSlackApp2,
|
|
475
493
|
stopSlackAppUnderLifecycleLock2,
|
|
476
494
|
init_app3
|
|
477
|
-
} from "./cli-
|
|
495
|
+
} from "./cli-539h29es.js";
|
|
478
496
|
import {
|
|
479
497
|
AGENT_MAX_TASKS_CONFIG_KEY,
|
|
480
498
|
resetAgentMaxTasksMirror,
|
|
@@ -495,7 +513,7 @@ import {
|
|
|
495
513
|
postApprovalCancellationUpdates2,
|
|
496
514
|
createApprovalFollowUpTask2,
|
|
497
515
|
init_approval_notifications
|
|
498
|
-
} from "./cli-
|
|
516
|
+
} from "./cli-cc93xzes.js";
|
|
499
517
|
import {
|
|
500
518
|
shapeApprovalResolution,
|
|
501
519
|
init_approval_resolution,
|
|
@@ -519,7 +537,7 @@ import {
|
|
|
519
537
|
resumeFromChildRun2,
|
|
520
538
|
initWaitBusSubscriptions2,
|
|
521
539
|
init_resume
|
|
522
|
-
} from "./cli-
|
|
540
|
+
} from "./cli-7r162fxe.js";
|
|
523
541
|
import {
|
|
524
542
|
FilesError,
|
|
525
543
|
providerPath,
|
|
@@ -533,7 +551,7 @@ import {
|
|
|
533
551
|
import {
|
|
534
552
|
getRuntimePool2,
|
|
535
553
|
init_db2
|
|
536
|
-
} from "./cli-
|
|
554
|
+
} from "./cli-s1zqk1aj.js";
|
|
537
555
|
import {
|
|
538
556
|
duplicateGuardedQueryKey,
|
|
539
557
|
parseQueryParams,
|
|
@@ -569,7 +587,7 @@ import {
|
|
|
569
587
|
findRoute,
|
|
570
588
|
route,
|
|
571
589
|
init_route_def
|
|
572
|
-
} from "./cli-
|
|
590
|
+
} from "./cli-nstkanmx.js";
|
|
573
591
|
import {
|
|
574
592
|
COMPOSIO_HTTP_METHODS,
|
|
575
593
|
executeComposioRequest,
|
|
@@ -671,7 +689,7 @@ import {
|
|
|
671
689
|
init_typecheck,
|
|
672
690
|
parseSkillContent,
|
|
673
691
|
init_skill_parser
|
|
674
|
-
} from "./cli-
|
|
692
|
+
} from "./cli-w1q68d8x.js";
|
|
675
693
|
import {
|
|
676
694
|
detachedProcessGroup,
|
|
677
695
|
registerProcessGroup,
|
|
@@ -686,24 +704,16 @@ import {
|
|
|
686
704
|
ensureToken,
|
|
687
705
|
ensureTokenOrThrow,
|
|
688
706
|
init_ensure_token
|
|
689
|
-
} from "./cli-
|
|
690
|
-
import {
|
|
691
|
-
require_fast_deep_equal
|
|
692
|
-
} from "./cli-bhp11egn.js";
|
|
693
|
-
import {
|
|
694
|
-
ZodFirstPartyTypeKind,
|
|
695
|
-
objectType,
|
|
696
|
-
init_v3
|
|
697
|
-
} from "./cli-ytyvpye5.js";
|
|
698
|
-
import {
|
|
699
|
-
init_v4
|
|
700
|
-
} from "./cli-3kd08rej.js";
|
|
707
|
+
} from "./cli-2rnd5j3t.js";
|
|
701
708
|
import {
|
|
702
709
|
SLACK_LEAVE_THREAD_DISABLE,
|
|
703
710
|
isSlackLeaveThreadDisabled,
|
|
704
711
|
leaveSlackThread,
|
|
705
712
|
init_left_threads
|
|
706
|
-
} from "./cli-
|
|
713
|
+
} from "./cli-jrbq4djp.js";
|
|
714
|
+
import {
|
|
715
|
+
require_fast_deep_equal
|
|
716
|
+
} from "./cli-bhp11egn.js";
|
|
707
717
|
import {
|
|
708
718
|
notifyAutomationPreflightFailure,
|
|
709
719
|
init_automation_preflight_alert,
|
|
@@ -778,11 +788,19 @@ import {
|
|
|
778
788
|
validateDefinition,
|
|
779
789
|
applyDefinitionPatch,
|
|
780
790
|
init_definition2
|
|
781
|
-
} from "./cli-
|
|
791
|
+
} from "./cli-q5srsxq2.js";
|
|
782
792
|
import {
|
|
783
793
|
isMultiRuntimeEnabled,
|
|
784
794
|
init_multi_runtime2
|
|
785
795
|
} from "./cli-mdb054w3.js";
|
|
796
|
+
import {
|
|
797
|
+
ZodFirstPartyTypeKind,
|
|
798
|
+
objectType,
|
|
799
|
+
init_v3
|
|
800
|
+
} from "./cli-ytyvpye5.js";
|
|
801
|
+
import {
|
|
802
|
+
init_v4
|
|
803
|
+
} from "./cli-3kd08rej.js";
|
|
786
804
|
import {
|
|
787
805
|
require_dist2
|
|
788
806
|
} from "./cli-xf1wn5ns.js";
|
|
@@ -793,11 +811,11 @@ import {
|
|
|
793
811
|
import {
|
|
794
812
|
canProvisionKind,
|
|
795
813
|
init_runtime_providers
|
|
796
|
-
} from "./cli-
|
|
814
|
+
} from "./cli-tvgqesec.js";
|
|
797
815
|
import {
|
|
798
816
|
publicEndpointSsrfOptions,
|
|
799
817
|
init_mcp_wrapper
|
|
800
|
-
} from "./cli-
|
|
818
|
+
} from "./cli-2v2zdm0a.js";
|
|
801
819
|
import {
|
|
802
820
|
findUserById,
|
|
803
821
|
findUserByExternalId,
|
|
@@ -812,7 +830,20 @@ import {
|
|
|
812
830
|
resolveSessionToken,
|
|
813
831
|
fingerprintApiKey,
|
|
814
832
|
init_users
|
|
815
|
-
} from "./cli-
|
|
833
|
+
} from "./cli-vsw91x06.js";
|
|
834
|
+
import {
|
|
835
|
+
resolveGitHubHost,
|
|
836
|
+
getGitHubLinkConfig,
|
|
837
|
+
getGitHubGraphqlUrl,
|
|
838
|
+
githubApiUrl,
|
|
839
|
+
init_github_host
|
|
840
|
+
} from "./cli-9ttx00s3.js";
|
|
841
|
+
import {
|
|
842
|
+
AMP_ESTIMATE_MODELS,
|
|
843
|
+
ampBillsCacheWrites,
|
|
844
|
+
resolveAmpModel,
|
|
845
|
+
init_amp_models
|
|
846
|
+
} from "./cli-zeh2mhkg.js";
|
|
816
847
|
import {
|
|
817
848
|
normalizeAssetKey,
|
|
818
849
|
defaultAssetKey,
|
|
@@ -884,14 +915,7 @@ import {
|
|
|
884
915
|
KvNamespaceSchema,
|
|
885
916
|
KvKeySchema,
|
|
886
917
|
init_types5
|
|
887
|
-
} from "./cli-
|
|
888
|
-
import {
|
|
889
|
-
resolveGitHubHost,
|
|
890
|
-
getGitHubLinkConfig,
|
|
891
|
-
getGitHubGraphqlUrl,
|
|
892
|
-
githubApiUrl,
|
|
893
|
-
init_github_host
|
|
894
|
-
} from "./cli-9ttx00s3.js";
|
|
918
|
+
} from "./cli-y4ccxtz5.js";
|
|
895
919
|
import {
|
|
896
920
|
generateDefaultClaudeMd2,
|
|
897
921
|
generateDefaultSoulMd2,
|
|
@@ -902,16 +926,16 @@ import {
|
|
|
902
926
|
init_task_attachment_links,
|
|
903
927
|
contentSha256,
|
|
904
928
|
init_profile_sync
|
|
905
|
-
} from "./cli-
|
|
929
|
+
} from "./cli-3aaeb78m.js";
|
|
930
|
+
import {
|
|
931
|
+
isSteeringEnabled2,
|
|
932
|
+
init_steering_enabled
|
|
933
|
+
} from "./cli-4sydckyj.js";
|
|
906
934
|
import {
|
|
907
935
|
getSlackConfiguration,
|
|
908
936
|
isSlackConfigured,
|
|
909
937
|
init_config4
|
|
910
938
|
} from "./cli-eetzmsy5.js";
|
|
911
|
-
import {
|
|
912
|
-
isSteeringEnabled2,
|
|
913
|
-
init_steering_enabled
|
|
914
|
-
} from "./cli-4sydckyj.js";
|
|
915
939
|
import {
|
|
916
940
|
selectCredential,
|
|
917
941
|
init_credentials2
|
|
@@ -978,7 +1002,7 @@ import {
|
|
|
978
1002
|
import {
|
|
979
1003
|
init_package,
|
|
980
1004
|
package_default
|
|
981
|
-
} from "./cli-
|
|
1005
|
+
} from "./cli-3f8zbtqa.js";
|
|
982
1006
|
import {
|
|
983
1007
|
getNodeEnv,
|
|
984
1008
|
isDevOrTestNodeEnv,
|
|
@@ -20356,7 +20380,7 @@ function startRetryPoller(registry, intervalMs = 5000) {
|
|
|
20356
20380
|
if (!waiting)
|
|
20357
20381
|
continue;
|
|
20358
20382
|
if (result.waitFor === "workflow.child.finished") {
|
|
20359
|
-
const { resumeFromChildRun } = await import("./resume-
|
|
20383
|
+
const { resumeFromChildRun } = await import("./resume-tqy61x24.js");
|
|
20360
20384
|
await resumeFromChildRun(step.id, registry);
|
|
20361
20385
|
}
|
|
20362
20386
|
} else {
|
|
@@ -20568,6 +20592,12 @@ async function verifyWebhookRequest(trigger, rawBody, headers) {
|
|
|
20568
20592
|
throw new WebhookError("Invalid signature", 401);
|
|
20569
20593
|
}
|
|
20570
20594
|
}
|
|
20595
|
+
function filteredWebhookEvent(trigger, headers) {
|
|
20596
|
+
if (!trigger.events || trigger.events.length === 0)
|
|
20597
|
+
return;
|
|
20598
|
+
const event = getHeader(headers, trigger.eventHeader || DEFAULT_EVENT_HEADER) ?? null;
|
|
20599
|
+
return event !== null && trigger.events.includes(event) ? undefined : event;
|
|
20600
|
+
}
|
|
20571
20601
|
async function handleWebhookTrigger(workflowId, payload, headers, registry, options = {}) {
|
|
20572
20602
|
const workflow = await getWorkflow2(workflowId);
|
|
20573
20603
|
if (!workflow) {
|
|
@@ -20583,6 +20613,10 @@ async function handleWebhookTrigger(workflowId, payload, headers, registry, opti
|
|
|
20583
20613
|
}
|
|
20584
20614
|
} else {
|
|
20585
20615
|
await verifyWebhookRequest(webhookTrigger, typeof payload === "string" ? payload : JSON.stringify(payload), headers);
|
|
20616
|
+
const filtered = filteredWebhookEvent(webhookTrigger, headers);
|
|
20617
|
+
if (filtered !== undefined) {
|
|
20618
|
+
return { skipped: true, reason: "event-not-allowed", event: filtered };
|
|
20619
|
+
}
|
|
20586
20620
|
}
|
|
20587
20621
|
const triggerData = parseTriggerPayload(payload);
|
|
20588
20622
|
const runId = await startWorkflowExecution2(workflow, triggerData, registry, {
|
|
@@ -20733,7 +20767,7 @@ function timingSafeEqualHex(providedHex, expected) {
|
|
|
20733
20767
|
return false;
|
|
20734
20768
|
}
|
|
20735
20769
|
}
|
|
20736
|
-
var DEFAULT_HMAC_HEADER = "X-Hub-Signature-256", FALLBACK_HMAC_HEADERS, STANDARD_WEBHOOK_SECRET_PREFIX = "whsec_", WebhookError;
|
|
20770
|
+
var DEFAULT_HMAC_HEADER = "X-Hub-Signature-256", FALLBACK_HMAC_HEADERS, DEFAULT_EVENT_HEADER = "X-GitHub-Event", STANDARD_WEBHOOK_SECRET_PREFIX = "whsec_", WebhookError;
|
|
20737
20771
|
var init_triggers = __esm(() => {
|
|
20738
20772
|
init_db4();
|
|
20739
20773
|
init_engine();
|
|
@@ -21087,7 +21121,7 @@ var init_notify = __esm(() => {
|
|
|
21087
21121
|
}
|
|
21088
21122
|
}
|
|
21089
21123
|
case "slack": {
|
|
21090
|
-
const { getSlackApp } = await import("./app-
|
|
21124
|
+
const { getSlackApp } = await import("./app-wb7w45dq.js");
|
|
21091
21125
|
let app = getSlackApp();
|
|
21092
21126
|
if (!app) {
|
|
21093
21127
|
if (!isSlackConfigured()) {
|
|
@@ -24516,7 +24550,7 @@ function setPreloadedTools(server, names) {
|
|
|
24516
24550
|
async function applyPreToolCall(name, args, requestInfo, inputSchema) {
|
|
24517
24551
|
if (requestInfo.callOrigin !== "mcp")
|
|
24518
24552
|
return { args };
|
|
24519
|
-
const dispatcher = await import("./dispatcher-
|
|
24553
|
+
const dispatcher = await import("./dispatcher-8d8s49yz.js");
|
|
24520
24554
|
const result = await dispatcher.dispatchPre("pre.tool.call", { tool: name, args, requestInfo }, inputSchema ? {
|
|
24521
24555
|
validateModify: async (data) => {
|
|
24522
24556
|
const schema = normalizeObjectSchema(inputSchema) ?? inputSchema;
|
|
@@ -26812,8 +26846,14 @@ function positiveEnv(name, fallback) {
|
|
|
26812
26846
|
const value = Number(process.env[name]);
|
|
26813
26847
|
return Number.isFinite(value) && value > 0 ? Math.floor(value) : fallback;
|
|
26814
26848
|
}
|
|
26815
|
-
function
|
|
26816
|
-
|
|
26849
|
+
function toolSourceOf(event, payload) {
|
|
26850
|
+
if (event !== "pre.tool.call" && event !== "post.tool.call")
|
|
26851
|
+
return;
|
|
26852
|
+
return stringField(payload, "requestInfo", "callOrigin") === "native" ? "native" : "mcp";
|
|
26853
|
+
}
|
|
26854
|
+
function handlersFor(event, payload, opts) {
|
|
26855
|
+
const toolSource = toolSourceOf(event, payload);
|
|
26856
|
+
return [...registry2.values()].filter((loaded) => loaded.record.id !== opts?.skipExtensionId).filter((loaded) => !toolSource || (loaded.manifest.toolSources ?? ["mcp"]).includes(toolSource)).flatMap((loaded) => loaded.handlers.filter((handler) => handler.event === event).map((handler) => ({ loaded, handler }))).sort((a, b) => a.handler.priority - b.handler.priority || a.loaded.record.name.localeCompare(b.loaded.record.name));
|
|
26817
26857
|
}
|
|
26818
26858
|
function snippet(text, max = 80) {
|
|
26819
26859
|
const flat = String(text ?? "").replace(/\s+/g, " ").trim();
|
|
@@ -27026,7 +27066,7 @@ async function dispatchPre2(event, payload, opts) {
|
|
|
27026
27066
|
let currentPayload = { ...payload };
|
|
27027
27067
|
const mergedData = {};
|
|
27028
27068
|
let modified = false;
|
|
27029
|
-
for (const { loaded, handler } of handlersFor(event, opts)) {
|
|
27069
|
+
for (const { loaded, handler } of handlersFor(event, payload, opts)) {
|
|
27030
27070
|
if (!isRegistered2(loaded.record.id))
|
|
27031
27071
|
continue;
|
|
27032
27072
|
const run = await runHandler(loaded, handler, event, currentPayload);
|
|
@@ -27088,7 +27128,7 @@ async function dispatchPre2(event, payload, opts) {
|
|
|
27088
27128
|
return modified ? { action: "modify", data: mergedData } : { action: "continue" };
|
|
27089
27129
|
}
|
|
27090
27130
|
async function dispatchPost2(event, payload, opts) {
|
|
27091
|
-
for (const { loaded, handler } of handlersFor(event, opts)) {
|
|
27131
|
+
for (const { loaded, handler } of handlersFor(event, payload, opts)) {
|
|
27092
27132
|
if (!isRegistered2(loaded.record.id))
|
|
27093
27133
|
continue;
|
|
27094
27134
|
const run = await runHandler(loaded, handler, event, payload);
|
|
@@ -30553,6 +30593,18 @@ async function resolveGitHubSender(login, sampleEventType, sampleContext) {
|
|
|
30553
30593
|
await incrKv2(UNMAPPED_NAMESPACE3, `${login}:count`, 1);
|
|
30554
30594
|
return;
|
|
30555
30595
|
}
|
|
30596
|
+
function isTrustedGitHubSender(login, requestedByUserId, content) {
|
|
30597
|
+
if (requestedByUserId || isBotAssignee(login))
|
|
30598
|
+
return true;
|
|
30599
|
+
const normalized = login.toLowerCase();
|
|
30600
|
+
const allowed = (process.env.GITHUB_ALLOWED_SENDERS ?? "").split(",").map((name) => name.trim().toLowerCase()).filter(Boolean);
|
|
30601
|
+
if (allowed.includes(normalized))
|
|
30602
|
+
return true;
|
|
30603
|
+
return content.user.login.toLowerCase() === normalized && TRUSTED_AUTHOR_ASSOCIATIONS.has(content.author_association ?? "");
|
|
30604
|
+
}
|
|
30605
|
+
function logUntrustedSender(eventType, login, repo, number) {
|
|
30606
|
+
console.log(`[GitHub] Skipped ${eventType} by ${login} on ${repo}#${number}: ${UNTRUSTED_SENDER_REASON}`);
|
|
30607
|
+
}
|
|
30556
30608
|
async function handlePullRequest(event) {
|
|
30557
30609
|
const {
|
|
30558
30610
|
action,
|
|
@@ -30766,6 +30818,10 @@ async function handlePullRequest(event) {
|
|
|
30766
30818
|
if (!hasMention) {
|
|
30767
30819
|
return { created: false };
|
|
30768
30820
|
}
|
|
30821
|
+
if (!isTrustedGitHubSender(sender.login, requestedByUserId, pr)) {
|
|
30822
|
+
logUntrustedSender(`pull_request.${action}`, sender.login, repository.full_name, pr.number);
|
|
30823
|
+
return { created: false };
|
|
30824
|
+
}
|
|
30769
30825
|
const eventKey = `pr:${repository.full_name}:${pr.number}:${action}`;
|
|
30770
30826
|
if (isDuplicate4(eventKey)) {
|
|
30771
30827
|
return { created: false };
|
|
@@ -30930,6 +30986,10 @@ async function handleIssue(event) {
|
|
|
30930
30986
|
if (!hasMention) {
|
|
30931
30987
|
return { created: false };
|
|
30932
30988
|
}
|
|
30989
|
+
if (!isTrustedGitHubSender(sender.login, requestedByUserId, issue)) {
|
|
30990
|
+
logUntrustedSender(`issues.${action}`, sender.login, repository.full_name, issue.number);
|
|
30991
|
+
return { created: false };
|
|
30992
|
+
}
|
|
30933
30993
|
const eventKey = `issue:${repository.full_name}:${issue.number}:${action}`;
|
|
30934
30994
|
if (isDuplicate4(eventKey)) {
|
|
30935
30995
|
return { created: false };
|
|
@@ -30984,6 +31044,9 @@ async function handleComment(event, eventType) {
|
|
|
30984
31044
|
if (!detectMention3(comment.body)) {
|
|
30985
31045
|
return skip("no bot mention");
|
|
30986
31046
|
}
|
|
31047
|
+
if (!isTrustedGitHubSender(sender.login, requestedByUserId, comment)) {
|
|
31048
|
+
return skip(UNTRUSTED_SENDER_REASON);
|
|
31049
|
+
}
|
|
30987
31050
|
const eventKey = `comment:${repository.full_name}:${comment.id}`;
|
|
30988
31051
|
if (isDuplicate4(eventKey)) {
|
|
30989
31052
|
return skip("duplicate delivery");
|
|
@@ -31215,6 +31278,10 @@ async function handlePullRequestReview(event) {
|
|
|
31215
31278
|
if (action !== "submitted") {
|
|
31216
31279
|
return { created: false };
|
|
31217
31280
|
}
|
|
31281
|
+
if (!isTrustedGitHubSender(sender.login, requestedByUserId, review)) {
|
|
31282
|
+
logUntrustedSender("pull_request_review", sender.login, repository.full_name, pr.number);
|
|
31283
|
+
return { created: false };
|
|
31284
|
+
}
|
|
31218
31285
|
const eventKey = `pr-review:${repository.full_name}:${pr.number}:${review.id}`;
|
|
31219
31286
|
if (isDuplicate4(eventKey)) {
|
|
31220
31287
|
return { created: false };
|
|
@@ -31311,7 +31378,7 @@ async function handleWorkflowRun(event) {
|
|
|
31311
31378
|
console.log(`[GitHub:suppressed] workflow_run.${action} (${conclusion}) on ${repository.full_name} — CI events disabled by default`);
|
|
31312
31379
|
return { created: false };
|
|
31313
31380
|
}
|
|
31314
|
-
var processedEvents4, EVENT_TTL2 = 60000, cancelOnUnassignEnabled = () => cancelFlagEnabled("github.cancelOnUnassign"), cancelOnReviewRequestRemovedEnabled = () => cancelFlagEnabled("github.cancelOnReviewRequestRemoved"), UNMAPPED_NAMESPACE3 = "integration:unmapped:github", UNMAPPED_TTL_MS3, REVIEW_COMMENTS_EMPTY_RETRY_DELAYS_MS, defaultReviewCommentsRetryDelay = (ms) => new Promise((resolve) => setTimeout(resolve, ms)), reviewCommentsRetryDelay, PR_REVIEW_ACTION_ITEMS_QUERY = `query($owner: String!, $name: String!, $number: Int!) {
|
|
31381
|
+
var processedEvents4, EVENT_TTL2 = 60000, cancelOnUnassignEnabled = () => cancelFlagEnabled("github.cancelOnUnassign"), cancelOnReviewRequestRemovedEnabled = () => cancelFlagEnabled("github.cancelOnReviewRequestRemoved"), UNMAPPED_NAMESPACE3 = "integration:unmapped:github", UNMAPPED_TTL_MS3, TRUSTED_AUTHOR_ASSOCIATIONS, UNTRUSTED_SENDER_REASON = "sender is not a linked user, an allowed sender, or a repo owner, member or collaborator", REVIEW_COMMENTS_EMPTY_RETRY_DELAYS_MS, defaultReviewCommentsRetryDelay = (ms) => new Promise((resolve) => setTimeout(resolve, ms)), reviewCommentsRetryDelay, PR_REVIEW_ACTION_ITEMS_QUERY = `query($owner: String!, $name: String!, $number: Int!) {
|
|
31315
31382
|
repository(owner: $owner, name: $name) {
|
|
31316
31383
|
pullRequest(number: $number) {
|
|
31317
31384
|
mergeStateStatus
|
|
@@ -31336,6 +31403,7 @@ var init_handlers4 = __esm(() => {
|
|
|
31336
31403
|
init_templates7();
|
|
31337
31404
|
processedEvents4 = new Map;
|
|
31338
31405
|
UNMAPPED_TTL_MS3 = 30 * 24 * 60 * 60 * 1000;
|
|
31406
|
+
TRUSTED_AUTHOR_ASSOCIATIONS = new Set(["OWNER", "MEMBER", "COLLABORATOR"]);
|
|
31339
31407
|
REVIEW_COMMENTS_EMPTY_RETRY_DELAYS_MS = [1500, 3000, 3000];
|
|
31340
31408
|
reviewCommentsRetryDelay = defaultReviewCommentsRetryDelay;
|
|
31341
31409
|
});
|
|
@@ -33614,9 +33682,11 @@ function splitChatMessage(text, limit) {
|
|
|
33614
33682
|
if (code >= 55296 && code <= 56319) {
|
|
33615
33683
|
cut = cut > 1 ? cut - 1 : cut + 1;
|
|
33616
33684
|
}
|
|
33685
|
+
} else {
|
|
33686
|
+
cut += 1;
|
|
33617
33687
|
}
|
|
33618
|
-
chunks.push(rest.slice(0, cut)
|
|
33619
|
-
rest = rest.slice(cut)
|
|
33688
|
+
chunks.push(rest.slice(0, cut));
|
|
33689
|
+
rest = rest.slice(cut);
|
|
33620
33690
|
}
|
|
33621
33691
|
if (rest.length > 0 || chunks.length === 0)
|
|
33622
33692
|
chunks.push(rest);
|
|
@@ -34565,7 +34635,7 @@ async function flushChatThread(threadId, items, immediate) {
|
|
|
34565
34635
|
stopTypingKeepalive(threadId);
|
|
34566
34636
|
await clearChatMessageReactions(adapter, threadId, reacted);
|
|
34567
34637
|
try {
|
|
34568
|
-
const
|
|
34638
|
+
const result = await handleWebhookTrigger(target.workflowId, {
|
|
34569
34639
|
adapter,
|
|
34570
34640
|
channelId: first.channelId,
|
|
34571
34641
|
threadId,
|
|
@@ -34575,7 +34645,11 @@ async function flushChatThread(threadId, items, immediate) {
|
|
|
34575
34645
|
text: rawText,
|
|
34576
34646
|
messageIds: items.map((item) => item.messageId)
|
|
34577
34647
|
}, {}, getExecutorRegistry2(), { alreadyAuthenticated: true });
|
|
34578
|
-
|
|
34648
|
+
if (result.skipped) {
|
|
34649
|
+
console.warn(`[chat-sdk] ${threadId}: workflow webhook trigger skipped (${result.reason})`);
|
|
34650
|
+
return;
|
|
34651
|
+
}
|
|
34652
|
+
console.log(`[chat-sdk] ${threadId}: started workflow run ${result.runId}`);
|
|
34579
34653
|
await subscribe(thread);
|
|
34580
34654
|
} catch (error) {
|
|
34581
34655
|
console.error(`[chat-sdk] ${threadId}: workflow dispatch failed: ${errorMessage(error)}`);
|
|
@@ -36103,7 +36177,7 @@ async function notifySlack(text) {
|
|
|
36103
36177
|
return;
|
|
36104
36178
|
}
|
|
36105
36179
|
try {
|
|
36106
|
-
const { getSlackApp } = await import("./app-
|
|
36180
|
+
const { getSlackApp } = await import("./app-wb7w45dq.js");
|
|
36107
36181
|
const app = getSlackApp();
|
|
36108
36182
|
if (!app) {
|
|
36109
36183
|
console.warn("[Jira webhook keepalive] Slack not available, cannot send notification");
|
|
@@ -36174,7 +36248,7 @@ async function deleteJiraWebhook(webhookId) {
|
|
|
36174
36248
|
console.log(`[Jira webhook keepalive] Deleted webhook id=${webhookId}`);
|
|
36175
36249
|
}
|
|
36176
36250
|
async function overwriteWebhookIds(next) {
|
|
36177
|
-
const { getDbClient } = await import("./db-
|
|
36251
|
+
const { getDbClient } = await import("./db-wcw0b2j8.js");
|
|
36178
36252
|
await getDbClient().transaction(async (tx) => {
|
|
36179
36253
|
const row = await tx.get("SELECT metadata FROM oauth_apps WHERE provider = 'jira'");
|
|
36180
36254
|
if (!row) {
|
|
@@ -109494,7 +109568,7 @@ async function resolveHttpRequestAuth(req, apiKey, options = {}) {
|
|
|
109494
109568
|
return null;
|
|
109495
109569
|
}
|
|
109496
109570
|
function isActiveUser(user) {
|
|
109497
|
-
return !!user && user.status === "active";
|
|
109571
|
+
return !!user && user.status === "active" && !user.mergedIntoUserId;
|
|
109498
109572
|
}
|
|
109499
109573
|
var init_auth = __esm(() => {
|
|
109500
109574
|
init_db4();
|
|
@@ -109624,11 +109698,11 @@ var init_openapi = __esm(() => {
|
|
|
109624
109698
|
});
|
|
109625
109699
|
|
|
109626
109700
|
// src/http/core.ts
|
|
109627
|
-
function
|
|
109701
|
+
function getDeploymentEnvValue2(key) {
|
|
109628
109702
|
const tracked = injectedEnvOriginals.get(key);
|
|
109629
109703
|
return tracked && process.env[key] === tracked.injected ? tracked.original : process.env[key];
|
|
109630
109704
|
}
|
|
109631
|
-
async function
|
|
109705
|
+
async function loadGlobalConfigsIntoEnv2(override = false) {
|
|
109632
109706
|
const globalConfigs = await getInjectableGlobalConfigs2();
|
|
109633
109707
|
const updated = [];
|
|
109634
109708
|
const liveKeys = new Set;
|
|
@@ -109666,13 +109740,13 @@ async function loadGlobalConfigsIntoEnv(override = false) {
|
|
|
109666
109740
|
}
|
|
109667
109741
|
return updated;
|
|
109668
109742
|
}
|
|
109669
|
-
async function
|
|
109743
|
+
async function reloadGlobalConfigsAndIntegrations2() {
|
|
109670
109744
|
return runWithoutRequestAuth(() => runSlackLifecycleExclusive(() => reloadGlobalConfigsAndIntegrationsInner()));
|
|
109671
109745
|
}
|
|
109672
109746
|
async function reloadGlobalConfigsAndIntegrationsInner() {
|
|
109673
|
-
const { getEmbeddingProvider, resetEmbeddingProvider } = await import("./index-
|
|
109747
|
+
const { getEmbeddingProvider, resetEmbeddingProvider } = await import("./index-01ns1pkw.js");
|
|
109674
109748
|
const wasEmbeddingsConfigured = getEmbeddingProvider().isConfigured();
|
|
109675
|
-
const updated = await
|
|
109749
|
+
const updated = await loadGlobalConfigsIntoEnv2(true);
|
|
109676
109750
|
await syncTelemetryEnabled("settings").catch((err) => {
|
|
109677
109751
|
console.error("[config-reload] telemetry re-init failed (non-fatal):", err);
|
|
109678
109752
|
});
|
|
@@ -109686,7 +109760,7 @@ async function reloadGlobalConfigsAndIntegrationsInner() {
|
|
|
109686
109760
|
integrations.push("embeddings");
|
|
109687
109761
|
}
|
|
109688
109762
|
if (isEmbeddingsConfigured) {
|
|
109689
|
-
import("./embedding-space-
|
|
109763
|
+
import("./embedding-space-e48xchqa.js").then(({ runEmbeddingMaintenance }) => runEmbeddingMaintenance({ backfill: !wasEmbeddingsConfigured })).catch((err) => {
|
|
109690
109764
|
console.error("[config-reload] embedding maintenance failed (non-fatal):", err);
|
|
109691
109765
|
});
|
|
109692
109766
|
}
|
|
@@ -109729,7 +109803,7 @@ async function reloadGlobalConfigsAndIntegrationsInner() {
|
|
|
109729
109803
|
integrationsReinitialized: integrations
|
|
109730
109804
|
};
|
|
109731
109805
|
}
|
|
109732
|
-
function
|
|
109806
|
+
function scheduleIntegrationsReload2(delayMs = AUTO_RELOAD_DEBOUNCE_MS) {
|
|
109733
109807
|
if (inFlightReload) {
|
|
109734
109808
|
reloadRerunRequested = true;
|
|
109735
109809
|
return;
|
|
@@ -109740,7 +109814,7 @@ function scheduleIntegrationsReload(delayMs = AUTO_RELOAD_DEBOUNCE_MS) {
|
|
|
109740
109814
|
pendingReloadTimer = setTimeout(() => {
|
|
109741
109815
|
pendingReloadTimer = null;
|
|
109742
109816
|
autoReloadInvocations += 1;
|
|
109743
|
-
inFlightReload =
|
|
109817
|
+
inFlightReload = reloadGlobalConfigsAndIntegrations2().then((r) => {
|
|
109744
109818
|
console.log(`[auto-reload] Loaded ${r.configsLoaded} config(s), re-initialized: ${r.integrationsReinitialized.join(", ") || "none"}`);
|
|
109745
109819
|
return r;
|
|
109746
109820
|
}).catch((err) => {
|
|
@@ -109751,7 +109825,7 @@ function scheduleIntegrationsReload(delayMs = AUTO_RELOAD_DEBOUNCE_MS) {
|
|
|
109751
109825
|
inFlightReload = null;
|
|
109752
109826
|
if (reloadRerunRequested) {
|
|
109753
109827
|
reloadRerunRequested = false;
|
|
109754
|
-
|
|
109828
|
+
scheduleIntegrationsReload2(delayMs);
|
|
109755
109829
|
}
|
|
109756
109830
|
});
|
|
109757
109831
|
}, delayMs);
|
|
@@ -109760,7 +109834,7 @@ function singleHeader2(req, name) {
|
|
|
109760
109834
|
const raw = req.headers[name];
|
|
109761
109835
|
return Array.isArray(raw) ? raw[0] : raw;
|
|
109762
109836
|
}
|
|
109763
|
-
async function
|
|
109837
|
+
async function handleCore2(req, res, myAgentId, apiKey) {
|
|
109764
109838
|
beginRequestAuthScope();
|
|
109765
109839
|
let auth = await resolveHttpRequestAuth(req, apiKey);
|
|
109766
109840
|
if (auth?.kind === "controller") {
|
|
@@ -109896,7 +109970,7 @@ async function handleCore(req, res, myAgentId, apiKey) {
|
|
|
109896
109970
|
}
|
|
109897
109971
|
if (req.method === "POST" && req.url === "/internal/reload-config") {
|
|
109898
109972
|
try {
|
|
109899
|
-
const result = await
|
|
109973
|
+
const result = await reloadGlobalConfigsAndIntegrations2();
|
|
109900
109974
|
console.log(`[reload-config] Loaded ${result.configsLoaded} config(s), re-initialized: ${result.integrationsReinitialized.join(", ") || "none"}`);
|
|
109901
109975
|
res.writeHead(200, { "Content-Type": "application/json" });
|
|
109902
109976
|
res.end(JSON.stringify({ success: true, ...result }));
|
|
@@ -123936,6 +124010,32 @@ var init_memory_rate = __esm(() => {
|
|
|
123936
124010
|
REFERENCES_SOURCE_DESCRIPTION = "Optional external source ID this memory references. Free-form string, " + 'convention "<source>:<identifier>" (e.g. "github:owner/repo#N", ' + '"linear:KEY-N", "customer:<slug>", "slack:<channel>:<ts>", ' + '"agentmail:<thread-id>"). Pick any prefix that fits — no closed enum. ' + "When present, an edge from this memory to the external source is " + "created/updated.";
|
|
123937
124011
|
});
|
|
123938
124012
|
|
|
124013
|
+
// src/be/memory/demotion-evidence.ts
|
|
124014
|
+
async function attachDemotionEvidence(candidates) {
|
|
124015
|
+
const ids = [...new Set(candidates.filter((c) => c.beta > c.alpha).map((c) => c.id))];
|
|
124016
|
+
if (ids.length === 0)
|
|
124017
|
+
return candidates;
|
|
124018
|
+
const rows = await getDbClient2().query(`SELECT memoryId,
|
|
124019
|
+
SUM(CASE WHEN source = 'explicit-self' AND signal > 0 THEN signal * weight ELSE 0 END) AS selfAlpha,
|
|
124020
|
+
SUM(CASE WHEN source = 'explicit-self' AND signal < 0 THEN -signal * weight ELSE 0 END) AS selfBeta,
|
|
124021
|
+
SUM(CASE WHEN source = 'llm' AND signal > 0 THEN signal * weight ELSE 0 END) AS llmAlpha,
|
|
124022
|
+
SUM(CASE WHEN source = 'llm' AND signal < 0 THEN -signal * weight ELSE 0 END) AS llmBeta,
|
|
124023
|
+
SUM(CASE WHEN source = 'llm' THEN 1 ELSE 0 END) AS llmCount
|
|
124024
|
+
FROM memory_rating
|
|
124025
|
+
WHERE source IN ('explicit-self', 'llm') AND memoryId IN (${ids.map(() => "?").join(", ")})
|
|
124026
|
+
GROUP BY memoryId`, ids);
|
|
124027
|
+
if (rows.length === 0)
|
|
124028
|
+
return candidates;
|
|
124029
|
+
const byId = new Map(rows.map(({ memoryId, ...evidence }) => [memoryId, evidence]));
|
|
124030
|
+
return candidates.map((c) => {
|
|
124031
|
+
const demotionEvidence = byId.get(c.id);
|
|
124032
|
+
return demotionEvidence ? { ...c, demotionEvidence } : c;
|
|
124033
|
+
});
|
|
124034
|
+
}
|
|
124035
|
+
var init_demotion_evidence = __esm(() => {
|
|
124036
|
+
init_db4();
|
|
124037
|
+
});
|
|
124038
|
+
|
|
123939
124039
|
// src/be/memory/graph-expansion.ts
|
|
123940
124040
|
function addNeighborScopeConditions(conditions, params, agentId, scope, isLead) {
|
|
123941
124041
|
if (!isLead) {
|
|
@@ -124078,22 +124178,25 @@ var NUDGE_ELIGIBLE_SOURCES2, memorySearchOutputSchema, registerMemorySearchTool
|
|
|
124078
124178
|
const store = getMemoryStore2();
|
|
124079
124179
|
const queryEmbedding = await provider.embed(query, { kind: "query" });
|
|
124080
124180
|
const candidateLimit = limit * CANDIDATE_SET_MULTIPLIER;
|
|
124181
|
+
const excludeReviewTaskCompletions = await isReviewTaskId(requestInfo.sourceTaskId);
|
|
124081
124182
|
const candidates = await searchMemoryCandidates(store, queryEmbedding ?? new Float32Array(0), requestInfo.agentId, {
|
|
124082
124183
|
scope,
|
|
124083
124184
|
limit: candidateLimit,
|
|
124084
124185
|
source,
|
|
124085
124186
|
isLead,
|
|
124086
124187
|
queryText: query,
|
|
124087
|
-
keyPrefix
|
|
124188
|
+
keyPrefix,
|
|
124189
|
+
excludeReviewTaskCompletions
|
|
124088
124190
|
});
|
|
124089
|
-
const
|
|
124191
|
+
const graphExpanded = await expandCandidatesWithGraph(candidates, requestInfo.agentId, {
|
|
124090
124192
|
scope,
|
|
124091
124193
|
source,
|
|
124092
124194
|
keyPrefix,
|
|
124093
124195
|
isLead
|
|
124094
124196
|
});
|
|
124197
|
+
const expanded = excludeReviewTaskCompletions ? await dropReviewTaskCompletions(graphExpanded) : graphExpanded;
|
|
124095
124198
|
if (expanded.length > 0) {
|
|
124096
|
-
const ranked = rerank(expanded, { limit });
|
|
124199
|
+
const ranked = rerank(await attachDemotionEvidence(expanded), { limit });
|
|
124097
124200
|
if (requestInfo.sourceTaskId) {
|
|
124098
124201
|
try {
|
|
124099
124202
|
await recordRetrievals(requestInfo.sourceTaskId, requestInfo.agentId, ranked.map((r) => ({
|
|
@@ -124132,13 +124235,14 @@ var NUDGE_ELIGIBLE_SOURCES2, memorySearchOutputSchema, registerMemorySearchTool
|
|
|
124132
124235
|
data: { yourAgentId: requestInfo.agentId, results: mapped }
|
|
124133
124236
|
});
|
|
124134
124237
|
}
|
|
124135
|
-
const
|
|
124238
|
+
const listed = await store.list(requestInfo.agentId, {
|
|
124136
124239
|
scope,
|
|
124137
124240
|
limit,
|
|
124138
124241
|
isLead,
|
|
124139
124242
|
source,
|
|
124140
124243
|
keyPrefix
|
|
124141
124244
|
});
|
|
124245
|
+
const recent = excludeReviewTaskCompletions ? await dropReviewTaskCompletions(listed) : listed;
|
|
124142
124246
|
const consumedIds = dedupeMemoryDocumentIds(recent);
|
|
124143
124247
|
try {
|
|
124144
124248
|
await recordMemoryAccesses(consumedIds);
|
|
@@ -124167,10 +124271,12 @@ var init_memory_search = __esm(() => {
|
|
|
124167
124271
|
init_db4();
|
|
124168
124272
|
init_memory();
|
|
124169
124273
|
init_constants2();
|
|
124274
|
+
init_demotion_evidence();
|
|
124170
124275
|
init_graph_expansion();
|
|
124171
124276
|
init_key_paths();
|
|
124172
124277
|
init_retrieval();
|
|
124173
124278
|
init_reranker();
|
|
124279
|
+
init_review_recall_filter();
|
|
124174
124280
|
init_search_candidates();
|
|
124175
124281
|
init_utils();
|
|
124176
124282
|
init_types5();
|
|
@@ -139178,6 +139284,259 @@ var init_task_skip = __esm(() => {
|
|
|
139178
139284
|
init_secret_scrubber();
|
|
139179
139285
|
});
|
|
139180
139286
|
|
|
139287
|
+
// src/ui-spec/schema.ts
|
|
139288
|
+
var TaskUiSpecActionInputSchema, TaskUiSpecInputSchema;
|
|
139289
|
+
var init_schema2 = __esm(() => {
|
|
139290
|
+
init_zod();
|
|
139291
|
+
init_task_ui_spec2();
|
|
139292
|
+
TaskUiSpecActionInputSchema = discriminatedUnion("kind", [
|
|
139293
|
+
object2({ kind: literal2("follow_up"), prompt: string2().min(1).max(4000) }),
|
|
139294
|
+
object2({
|
|
139295
|
+
kind: literal2("script"),
|
|
139296
|
+
script: string2().min(1).max(200).describe("A global script named in UI_SPEC_SCRIPT_ACTIONS."),
|
|
139297
|
+
args: record2(string2(), unknown()).optional().describe("Frozen script input, at most 4 KB of JSON. A click sends no input.")
|
|
139298
|
+
})
|
|
139299
|
+
]);
|
|
139300
|
+
TaskUiSpecInputSchema = object2({
|
|
139301
|
+
spec: object2({
|
|
139302
|
+
root: string2().min(1),
|
|
139303
|
+
elements: record2(string2(), unknown()),
|
|
139304
|
+
state: record2(string2(), unknown()).optional()
|
|
139305
|
+
}).describe("A json-render spec for the chat catalog. Root must be a Card."),
|
|
139306
|
+
actions: record2(string2().regex(UI_SPEC_ACTION_ID), TaskUiSpecActionInputSchema).refine((actions) => Object.keys(actions).length <= UI_SPEC_MAX_ACTIONS, {
|
|
139307
|
+
message: `At most ${UI_SPEC_MAX_ACTIONS} actions.`
|
|
139308
|
+
}).optional().describe(`Actions that Button ids name, at most ${UI_SPEC_MAX_ACTIONS}. Needs UI_SPEC_ACTIONS_ENABLED=true. A \`script\` action also needs its script pinned in UI_SPEC_SCRIPT_ACTIONS.`)
|
|
139309
|
+
});
|
|
139310
|
+
});
|
|
139311
|
+
|
|
139312
|
+
// src/ui-spec/script-actions.ts
|
|
139313
|
+
async function readScriptActionAllowlist() {
|
|
139314
|
+
const [row] = await getSwarmConfigs2({ scope: "global", key: UI_SPEC_SCRIPT_ACTIONS_KEY });
|
|
139315
|
+
if (row)
|
|
139316
|
+
return row.value;
|
|
139317
|
+
const { getDeploymentEnvValue } = await import("./core-sxy4epp2.js");
|
|
139318
|
+
return getDeploymentEnvValue(UI_SPEC_SCRIPT_ACTIONS_KEY);
|
|
139319
|
+
}
|
|
139320
|
+
async function loadScriptActionLookups() {
|
|
139321
|
+
return {
|
|
139322
|
+
allPins: parseScriptActionAllowlist(await readScriptActionAllowlist()).pins,
|
|
139323
|
+
scripts: new Map
|
|
139324
|
+
};
|
|
139325
|
+
}
|
|
139326
|
+
async function resolveScriptAction(actionId, action, lookups) {
|
|
139327
|
+
const { allPins, scripts } = lookups ?? await loadScriptActionLookups();
|
|
139328
|
+
const pins = allPins.filter((pin) => pin.name === action.script);
|
|
139329
|
+
if (pins.length === 0) {
|
|
139330
|
+
return {
|
|
139331
|
+
ok: false,
|
|
139332
|
+
reason: "not_allowlisted",
|
|
139333
|
+
issue: `Action "${actionId}" runs script "${action.script}", which is not allowlisted in UI_SPEC_SCRIPT_ACTIONS.`
|
|
139334
|
+
};
|
|
139335
|
+
}
|
|
139336
|
+
let lookup = scripts.get(action.script);
|
|
139337
|
+
if (!lookup) {
|
|
139338
|
+
lookup = getScript({ name: action.script, scope: "global" });
|
|
139339
|
+
scripts.set(action.script, lookup);
|
|
139340
|
+
}
|
|
139341
|
+
const script = await lookup;
|
|
139342
|
+
if (!script) {
|
|
139343
|
+
return {
|
|
139344
|
+
ok: false,
|
|
139345
|
+
reason: "missing",
|
|
139346
|
+
issue: `Action "${actionId}" runs script "${action.script}", which is not a global script.`
|
|
139347
|
+
};
|
|
139348
|
+
}
|
|
139349
|
+
if (!pins.some((pin) => script.contentHash.toLowerCase().startsWith(pin.hashPrefix))) {
|
|
139350
|
+
return {
|
|
139351
|
+
ok: false,
|
|
139352
|
+
reason: "script_changed",
|
|
139353
|
+
issue: `Action "${actionId}": script "${action.script}" changed since it was allowlisted (contentHash ${script.contentHash.slice(0, 12)}). A human must re-pin it in UI_SPEC_SCRIPT_ACTIONS.`
|
|
139354
|
+
};
|
|
139355
|
+
}
|
|
139356
|
+
return { ok: true, script };
|
|
139357
|
+
}
|
|
139358
|
+
function argsIssue(actionId, action, script) {
|
|
139359
|
+
const args = action.args ?? {};
|
|
139360
|
+
const bytes = new TextEncoder().encode(JSON.stringify(args)).length;
|
|
139361
|
+
if (bytes > UI_SPEC_SCRIPT_ARGS_MAX_BYTES) {
|
|
139362
|
+
return `Action "${actionId}" args are ${bytes} bytes; the limit is ${UI_SPEC_SCRIPT_ARGS_MAX_BYTES}.`;
|
|
139363
|
+
}
|
|
139364
|
+
if (!script.argsJsonSchema)
|
|
139365
|
+
return null;
|
|
139366
|
+
let schema;
|
|
139367
|
+
try {
|
|
139368
|
+
schema = JSON.parse(script.argsJsonSchema);
|
|
139369
|
+
} catch {
|
|
139370
|
+
return `Action "${actionId}": script "${script.name}" has an unreadable argsJsonSchema.`;
|
|
139371
|
+
}
|
|
139372
|
+
const errors = validateJsonSchema(schema, args);
|
|
139373
|
+
return errors.length > 0 ? `Action "${actionId}" args do not match the script's argsJsonSchema: ${errors[0]}` : null;
|
|
139374
|
+
}
|
|
139375
|
+
async function scriptActionIssues(actions) {
|
|
139376
|
+
const issues = [];
|
|
139377
|
+
let lookups;
|
|
139378
|
+
for (const [actionId, action] of Object.entries(actions ?? {})) {
|
|
139379
|
+
if (action.kind !== "script")
|
|
139380
|
+
continue;
|
|
139381
|
+
if (!isEnvFlagEnabled("UI_SPEC_ACTIONS_ENABLED", false)) {
|
|
139382
|
+
issues.push(`Action "${actionId}" needs UI_SPEC_ACTIONS_ENABLED=true.`);
|
|
139383
|
+
continue;
|
|
139384
|
+
}
|
|
139385
|
+
lookups ??= await loadScriptActionLookups();
|
|
139386
|
+
const resolved = await resolveScriptAction(actionId, action, lookups);
|
|
139387
|
+
const issue = resolved.ok ? argsIssue(actionId, action, resolved.script) : resolved.issue;
|
|
139388
|
+
if (issue)
|
|
139389
|
+
issues.push(issue);
|
|
139390
|
+
}
|
|
139391
|
+
return issues;
|
|
139392
|
+
}
|
|
139393
|
+
async function scriptActionPinIssues(actions) {
|
|
139394
|
+
const scriptActions = Object.entries(actions ?? {}).filter((entry) => entry[1].kind === "script");
|
|
139395
|
+
if (scriptActions.length === 0)
|
|
139396
|
+
return [];
|
|
139397
|
+
const allPins = parseScriptActionAllowlist(await readScriptActionAllowlist()).pins;
|
|
139398
|
+
const hashes = await getGlobalScriptContentHashes([
|
|
139399
|
+
...new Set(scriptActions.map(([, action]) => action.script))
|
|
139400
|
+
]);
|
|
139401
|
+
const issues = [];
|
|
139402
|
+
for (const [actionId, action] of scriptActions) {
|
|
139403
|
+
const hash = hashes.get(action.script)?.toLowerCase();
|
|
139404
|
+
const pins = allPins.filter((pin) => pin.name === action.script);
|
|
139405
|
+
if (!hash || !pins.some((pin) => hash.startsWith(pin.hashPrefix))) {
|
|
139406
|
+
issues.push(`Action "${actionId}": script "${action.script}" is no longer allowlisted at its current contentHash in UI_SPEC_SCRIPT_ACTIONS.`);
|
|
139407
|
+
}
|
|
139408
|
+
}
|
|
139409
|
+
return issues;
|
|
139410
|
+
}
|
|
139411
|
+
function shortError(text) {
|
|
139412
|
+
const line = scrubSecrets(text).replace(/\s+/g, " ").trim();
|
|
139413
|
+
return line.length > 300 ? `${line.slice(0, 297)}...` : line;
|
|
139414
|
+
}
|
|
139415
|
+
async function runAndValidate(task, action, script, stored) {
|
|
139416
|
+
if (!task.agentId)
|
|
139417
|
+
return {
|
|
139418
|
+
ok: false,
|
|
139419
|
+
kind: "script_failed",
|
|
139420
|
+
error: "the task has no agent to run the script as"
|
|
139421
|
+
};
|
|
139422
|
+
const output = await runSavedScriptAsAgent({
|
|
139423
|
+
script,
|
|
139424
|
+
input: action.args ?? {},
|
|
139425
|
+
agentId: task.agentId,
|
|
139426
|
+
timeoutMs: UI_SPEC_SCRIPT_ACTION_TIMEOUT_MS
|
|
139427
|
+
});
|
|
139428
|
+
if (output.exitCode !== 0 || output.error || output.runtimeError) {
|
|
139429
|
+
const reason = output.runtimeError ? `${output.runtimeError.name}: ${output.runtimeError.message}` : output.error ? `script ${output.error}` : `script exited ${output.exitCode}`;
|
|
139430
|
+
return { ok: false, kind: "script_failed", error: reason };
|
|
139431
|
+
}
|
|
139432
|
+
const parsed = TaskUiSpecInputSchema.safeParse(output.result);
|
|
139433
|
+
if (!parsed.success) {
|
|
139434
|
+
const issue = parsed.error.issues[0];
|
|
139435
|
+
const path = issue?.path.join(".") || "result";
|
|
139436
|
+
return {
|
|
139437
|
+
ok: false,
|
|
139438
|
+
kind: "invalid_output",
|
|
139439
|
+
error: `script output is not { spec, actions? }: ${path}: ${issue?.message ?? "invalid"}`
|
|
139440
|
+
};
|
|
139441
|
+
}
|
|
139442
|
+
const newActions = parsed.data.actions;
|
|
139443
|
+
const scriptIssues = await scriptActionIssues(newActions);
|
|
139444
|
+
if (scriptIssues.length > 0)
|
|
139445
|
+
return { ok: false, kind: "invalid_output", error: scriptIssues[0] ?? "invalid action" };
|
|
139446
|
+
const actions = newActions ?? stored.actions;
|
|
139447
|
+
const validation = validateTaskUiSpec({ spec: parsed.data.spec, ...actions ? { actions } : {} }, { taskId: task.id, actionsEnabled: true });
|
|
139448
|
+
if (!validation.ok)
|
|
139449
|
+
return { ok: false, kind: "invalid_output", error: validation.issues[0] ?? "invalid uiSpec" };
|
|
139450
|
+
return {
|
|
139451
|
+
ok: true,
|
|
139452
|
+
uiSpec: {
|
|
139453
|
+
spec: validation.spec,
|
|
139454
|
+
...validation.actions ? { actions: validation.actions } : {},
|
|
139455
|
+
fallbackText: validation.fallbackText
|
|
139456
|
+
}
|
|
139457
|
+
};
|
|
139458
|
+
}
|
|
139459
|
+
async function runTaskUiScriptAction({
|
|
139460
|
+
task,
|
|
139461
|
+
actionId,
|
|
139462
|
+
action,
|
|
139463
|
+
stored,
|
|
139464
|
+
surface,
|
|
139465
|
+
actorUserId,
|
|
139466
|
+
slackUserId
|
|
139467
|
+
}) {
|
|
139468
|
+
const resolved = await resolveScriptAction(actionId, action);
|
|
139469
|
+
if (!resolved.ok) {
|
|
139470
|
+
if (resolved.reason === "missing") {
|
|
139471
|
+
return { status: "script_failed", error: `script "${action.script}" no longer exists` };
|
|
139472
|
+
}
|
|
139473
|
+
return { status: resolved.reason };
|
|
139474
|
+
}
|
|
139475
|
+
const lock = await acquireTaskUiScriptActionRun({
|
|
139476
|
+
taskId: task.id,
|
|
139477
|
+
actionId,
|
|
139478
|
+
surface,
|
|
139479
|
+
slackUserId,
|
|
139480
|
+
userId: actorUserId,
|
|
139481
|
+
leaseMs: UI_SPEC_SCRIPT_ACTION_LEASE_MS,
|
|
139482
|
+
cooldownMs: UI_SPEC_SCRIPT_ACTION_COOLDOWN_MS
|
|
139483
|
+
});
|
|
139484
|
+
if (lock.status !== "acquired")
|
|
139485
|
+
return lock;
|
|
139486
|
+
let outcome;
|
|
139487
|
+
try {
|
|
139488
|
+
outcome = await runAndValidate(task, action, resolved.script, stored);
|
|
139489
|
+
} catch (error) {
|
|
139490
|
+
outcome = {
|
|
139491
|
+
ok: false,
|
|
139492
|
+
kind: "script_failed",
|
|
139493
|
+
error: error instanceof Error ? error.message : String(error)
|
|
139494
|
+
};
|
|
139495
|
+
}
|
|
139496
|
+
if (outcome.ok) {
|
|
139497
|
+
const okOutcome = outcome;
|
|
139498
|
+
const pinIssue = await getDbClient2().transaction(async () => {
|
|
139499
|
+
const [issue] = await scriptActionPinIssues(okOutcome.uiSpec.actions);
|
|
139500
|
+
if (!issue)
|
|
139501
|
+
await upsertTaskUiSpec(task.id, okOutcome.uiSpec, actorUserId);
|
|
139502
|
+
return issue;
|
|
139503
|
+
});
|
|
139504
|
+
if (pinIssue)
|
|
139505
|
+
outcome = { ok: false, kind: "invalid_output", error: pinIssue };
|
|
139506
|
+
}
|
|
139507
|
+
if (!outcome.ok) {
|
|
139508
|
+
const error = shortError(outcome.error);
|
|
139509
|
+
await finishTaskUiScriptActionRun(task.id, actionId, error);
|
|
139510
|
+
await createLogEntry2({
|
|
139511
|
+
eventType: "task_ui_script_action_failed",
|
|
139512
|
+
...task.agentId ? { agentId: task.agentId } : {},
|
|
139513
|
+
taskId: task.id,
|
|
139514
|
+
newValue: error,
|
|
139515
|
+
metadata: { actionId, script: action.script, kind: outcome.kind }
|
|
139516
|
+
});
|
|
139517
|
+
return { status: outcome.kind, error };
|
|
139518
|
+
}
|
|
139519
|
+
await finishTaskUiScriptActionRun(task.id, actionId, null);
|
|
139520
|
+
getDbClient2().afterCommit(() => workflowEventBus2.emit(TASK_UI_SPEC_UPDATED_EVENT, { taskId: task.id }));
|
|
139521
|
+
return { status: "refreshed", uiSpec: await getTaskUiSpec(task.id) ?? outcome.uiSpec };
|
|
139522
|
+
}
|
|
139523
|
+
var UI_SPEC_SCRIPT_ACTION_TIMEOUT_MS = 30000, UI_SPEC_SCRIPT_ACTION_LEASE_MS, UI_SPEC_SCRIPT_ACTION_COOLDOWN_MS = 30000;
|
|
139524
|
+
var init_script_actions = __esm(() => {
|
|
139525
|
+
init_db4();
|
|
139526
|
+
init_db3();
|
|
139527
|
+
init_run_saved();
|
|
139528
|
+
init_task_ui_spec();
|
|
139529
|
+
init_env_flag();
|
|
139530
|
+
init_secret_scrubber();
|
|
139531
|
+
init_task_ui_spec2();
|
|
139532
|
+
init_event_bus();
|
|
139533
|
+
init_json_schema_validator();
|
|
139534
|
+
init_schema2();
|
|
139535
|
+
init_script_allowlist();
|
|
139536
|
+
init_validate2();
|
|
139537
|
+
UI_SPEC_SCRIPT_ACTION_LEASE_MS = UI_SPEC_SCRIPT_ACTION_TIMEOUT_MS + 15000;
|
|
139538
|
+
});
|
|
139539
|
+
|
|
139181
139540
|
// src/tools/store-progress.ts
|
|
139182
139541
|
async function foreignTaskWriteError(caller, task, sourceTaskId) {
|
|
139183
139542
|
const decision = can({
|
|
@@ -139216,14 +139575,7 @@ var BLOCKED_WAITING_PATTERN, BLOCKED_WAITING_MIN_ELAPSED_MS, storeProgressOutput
|
|
|
139216
139575
|
failureReason: string2().optional().describe("The reason for failure (used when failing), or the one-line reason for a skip (required with status 'skipped')."),
|
|
139217
139576
|
attachments: array2(AttachmentInputSchema).max(20).optional().describe("Pointer-based artifacts produced by this step — agent-fs path, URL, shared-fs path, or swarm Page. No inline file data; upload to agent-fs first and attach by path. Agent-fs pointers are verified before task state changes, using the explicit org/drive pair or the registering agent's configured defaults. May be sent on any call (progress or completion) and accumulates across calls; duplicates are de-duped by sha256 (when present) or by (kind, pointer, name)."),
|
|
139218
139577
|
citations: array2(CitationInputSchema).max(MAX_TASK_CITATIONS).catch([]).optional().describe('Claim sources, upserted by index across calls. Use only for factual claims the reader cannot already see in the thread or task tree, 1-2 sources; none on delegation, routing, acks, or status replies. Reference each one in output with [citation:N], or set general: true for a source that backs the whole answer (it renders under "General sources"). ref per kind: task = task UUID; memory = memory UUID (optional quote must appear verbatim in it); github = owner/repo#N, owner/repo@<sha>, or a github.com pull, issues, or commit URL; slack = permalink or channel/ts; agent-fs = file path; page = page id; script-run = script run id; url = http(s) URL. The first completing call is refused, and the task stays in progress, if a marker has no entry, a citation fails validation, or a non-general citation is unreferenced; the response lists each problem. After one refusal, completion proceeds and those markers and sources are dropped from rendered output. At most 50 citations per call/task, refs up to 2048 characters, labels up to 200. Invalid or oversized batches are ignored; existing indices can still be updated at capacity.'),
|
|
139219
|
-
uiSpec:
|
|
139220
|
-
spec: object2({
|
|
139221
|
-
root: string2().min(1),
|
|
139222
|
-
elements: record2(string2(), unknown()),
|
|
139223
|
-
state: record2(string2(), unknown()).optional()
|
|
139224
|
-
}).describe("A json-render spec for the chat catalog. Root must be a Card."),
|
|
139225
|
-
actions: record2(string2().regex(UI_SPEC_ACTION_ID), object2({ kind: literal2("follow_up"), prompt: string2().min(1).max(4000) })).optional().describe("Actions that Button ids name. Needs UI_SPEC_ACTIONS_ENABLED=true.")
|
|
139226
|
-
}).optional().describe("Optional rich card for this result, rendered in the Slack outcome card, the session view and Chat SDK channels. `output` stays the prose answer. A Slack card shows only the spec of its own task. See the ui-spec skill."),
|
|
139578
|
+
uiSpec: TaskUiSpecInputSchema.optional().describe("Optional rich card for this result, rendered in the Slack outcome card, the session view and Chat SDK channels. `output` stays the prose answer. A Slack card shows only the spec of its own task. See the ui-spec skill."),
|
|
139227
139579
|
learning: union3([
|
|
139228
139580
|
string2(),
|
|
139229
139581
|
object2({
|
|
@@ -139348,6 +139700,7 @@ var BLOCKED_WAITING_PATTERN, BLOCKED_WAITING_MIN_ELAPSED_MS, storeProgressOutput
|
|
|
139348
139700
|
}
|
|
139349
139701
|
}
|
|
139350
139702
|
let learningWrite;
|
|
139703
|
+
const uiSpecScriptIssues = uiSpec && status === "completed" && isEnvFlagEnabled("UI_SPEC_ENABLED", false) ? await scriptActionIssues(uiSpec.actions) : [];
|
|
139351
139704
|
let uiSpecNote;
|
|
139352
139705
|
const result = await getDbClient2().transaction(async () => {
|
|
139353
139706
|
const agent = await getAgentById2(requestInfo.agentId ?? "");
|
|
@@ -139485,7 +139838,8 @@ This check refuses once per task; the next completion is accepted and unfixed ci
|
|
|
139485
139838
|
} else if (uiSpec && status !== "completed") {
|
|
139486
139839
|
uiSpecNote = 'uiSpec is stored only with status "completed".';
|
|
139487
139840
|
} else if (uiSpec) {
|
|
139488
|
-
const
|
|
139841
|
+
const scriptIssues = uiSpecScriptIssues.length > 0 ? uiSpecScriptIssues : await scriptActionPinIssues(uiSpec.actions);
|
|
139842
|
+
const validation = scriptIssues.length > 0 ? { ok: false, issues: scriptIssues } : validateTaskUiSpec(uiSpec, {
|
|
139489
139843
|
taskId,
|
|
139490
139844
|
actionsEnabled: isEnvFlagEnabled("UI_SPEC_ACTIONS_ENABLED", false)
|
|
139491
139845
|
});
|
|
@@ -139641,11 +139995,12 @@ var init_store_progress = __esm(() => {
|
|
|
139641
139995
|
init_terminal_result_guard();
|
|
139642
139996
|
init_utils();
|
|
139643
139997
|
init_types5();
|
|
139998
|
+
init_schema2();
|
|
139999
|
+
init_script_actions();
|
|
139644
140000
|
init_validate2();
|
|
139645
140001
|
init_env_flag();
|
|
139646
140002
|
init_secret_scrubber();
|
|
139647
140003
|
init_task_citations();
|
|
139648
|
-
init_task_ui_spec2();
|
|
139649
140004
|
init_business_use();
|
|
139650
140005
|
BLOCKED_WAITING_PATTERN = /\b(waiting (for|on)|blocked (on|until|by)|still waiting|awaiting)\b/i;
|
|
139651
140006
|
BLOCKED_WAITING_MIN_ELAPSED_MS = 3 * 60 * 1000;
|
|
@@ -140022,6 +140377,11 @@ var registerDeleteConfigTool = (server) => {
|
|
|
140022
140377
|
data: { yourAgentId: requestInfo.agentId }
|
|
140023
140378
|
});
|
|
140024
140379
|
}
|
|
140380
|
+
if (isHumanOnlyConfigKey(existing.key)) {
|
|
140381
|
+
return toolErr(humanOnlyConfigKeyError(existing.key), {
|
|
140382
|
+
data: { yourAgentId: requestInfo.agentId }
|
|
140383
|
+
});
|
|
140384
|
+
}
|
|
140025
140385
|
if (isInternalConfigKey(existing.key)) {
|
|
140026
140386
|
return toolErr(internalConfigKeyError(existing.key).message, {
|
|
140027
140387
|
data: { yourAgentId: requestInfo.agentId }
|
|
@@ -140037,7 +140397,7 @@ var registerDeleteConfigTool = (server) => {
|
|
|
140037
140397
|
});
|
|
140038
140398
|
}
|
|
140039
140399
|
if (existing.scope === "global") {
|
|
140040
|
-
|
|
140400
|
+
scheduleIntegrationsReload2();
|
|
140041
140401
|
}
|
|
140042
140402
|
return toolOk(`Config "${existing.key}" deleted successfully.`, {
|
|
140043
140403
|
details: `Config "${existing.key}" (scope: ${existing.scope}${existing.scopeId ? `, scopeId: ${existing.scopeId}` : ""}) deleted successfully.`,
|
|
@@ -140288,6 +140648,11 @@ var configEntryShape3, registerSetConfigTool = (server) => {
|
|
|
140288
140648
|
const message = reservedKeyError(key).message;
|
|
140289
140649
|
return toolErr(message, { data: { yourAgentId: requestInfo.agentId } });
|
|
140290
140650
|
}
|
|
140651
|
+
if (isHumanOnlyConfigKey(key)) {
|
|
140652
|
+
return toolErr(humanOnlyConfigKeyError(key), {
|
|
140653
|
+
data: { yourAgentId: requestInfo.agentId }
|
|
140654
|
+
});
|
|
140655
|
+
}
|
|
140291
140656
|
if (isInternalConfigKey(key)) {
|
|
140292
140657
|
return toolErr(internalConfigKeyError(key).message, {
|
|
140293
140658
|
data: { yourAgentId: requestInfo.agentId }
|
|
@@ -140324,7 +140689,7 @@ var configEntryShape3, registerSetConfigTool = (server) => {
|
|
|
140324
140689
|
exportToEnv
|
|
140325
140690
|
});
|
|
140326
140691
|
if (scope === "global") {
|
|
140327
|
-
|
|
140692
|
+
scheduleIntegrationsReload2();
|
|
140328
140693
|
}
|
|
140329
140694
|
const [masked] = maskSecrets2([config]);
|
|
140330
140695
|
return toolOk(`Config "${key}" set successfully.`, {
|
|
@@ -140449,7 +140814,189 @@ var init_swarm_x = __esm(() => {
|
|
|
140449
140814
|
primitiveQueryValueSchema = union3([string2(), number2(), boolean()]);
|
|
140450
140815
|
});
|
|
140451
140816
|
|
|
140817
|
+
// src/http/session-cost-recompute.ts
|
|
140818
|
+
function cacheWriteSplit(input) {
|
|
140819
|
+
if (input.cacheWrite5mTokens == null || input.cacheWrite1hTokens == null)
|
|
140820
|
+
return null;
|
|
140821
|
+
const total = input.cacheWrite5mTokens + input.cacheWrite1hTokens;
|
|
140822
|
+
if (total === 0)
|
|
140823
|
+
return null;
|
|
140824
|
+
return {
|
|
140825
|
+
fiveMinuteRatio: input.cacheWrite5mTokens / total,
|
|
140826
|
+
oneHourRatio: input.cacheWrite1hTokens / total
|
|
140827
|
+
};
|
|
140828
|
+
}
|
|
140829
|
+
async function priceModel(provider, usage, split, atEpochMs, lookupRate) {
|
|
140830
|
+
const lookupModel = normalizeModelKey(provider, usage.model);
|
|
140831
|
+
const inputRate = await lookupRate(provider, lookupModel, "input", atEpochMs);
|
|
140832
|
+
const outputRate = await lookupRate(provider, lookupModel, "output", atEpochMs);
|
|
140833
|
+
if (inputRate == null || outputRate == null)
|
|
140834
|
+
return null;
|
|
140835
|
+
const cacheReadRate = await lookupRate(provider, lookupModel, "cached_input", atEpochMs) ?? 0;
|
|
140836
|
+
const uncachedInputTokens = INCLUSIVE_INPUT_PROVIDERS.has(provider) ? Math.max(0, usage.inputTokens - usage.cacheReadTokens) : usage.inputTokens;
|
|
140837
|
+
let cacheWriteCostUnits = 0;
|
|
140838
|
+
if (split) {
|
|
140839
|
+
const fiveMinuteTokens = usage.cacheWriteTokens * split.fiveMinuteRatio;
|
|
140840
|
+
const oneHourTokens = usage.cacheWriteTokens * split.oneHourRatio;
|
|
140841
|
+
const fiveMinuteRate = await lookupRate(provider, lookupModel, "cache_write", atEpochMs) ?? 0;
|
|
140842
|
+
const oneHourRate = await lookupRate(provider, lookupModel, "cache_write_1h", atEpochMs);
|
|
140843
|
+
if (oneHourTokens > 0 && oneHourRate == null)
|
|
140844
|
+
return null;
|
|
140845
|
+
cacheWriteCostUnits = fiveMinuteTokens * fiveMinuteRate + oneHourTokens * (oneHourRate ?? 0);
|
|
140846
|
+
} else {
|
|
140847
|
+
const cacheWriteRate = await lookupRate(provider, lookupModel, "cache_write", atEpochMs) ?? 0;
|
|
140848
|
+
cacheWriteCostUnits = usage.cacheWriteTokens * cacheWriteRate;
|
|
140849
|
+
}
|
|
140850
|
+
return (uncachedInputTokens * inputRate + usage.cacheReadTokens * cacheReadRate + cacheWriteCostUnits + usage.outputTokens * outputRate) / PER_MILLION;
|
|
140851
|
+
}
|
|
140852
|
+
function unpricedResult(input, modelBreakdown) {
|
|
140853
|
+
return {
|
|
140854
|
+
totalCostUsd: input.harnessCostUsd,
|
|
140855
|
+
costSource: "unpriced",
|
|
140856
|
+
modelBreakdown
|
|
140857
|
+
};
|
|
140858
|
+
}
|
|
140859
|
+
async function estimateAmpCost(input, lookupRate) {
|
|
140860
|
+
let selection;
|
|
140861
|
+
try {
|
|
140862
|
+
selection = resolveAmpModel(input.model);
|
|
140863
|
+
} catch {
|
|
140864
|
+
selection = undefined;
|
|
140865
|
+
}
|
|
140866
|
+
const candidates = [
|
|
140867
|
+
...new Set([
|
|
140868
|
+
selection?.pin,
|
|
140869
|
+
selection ? AMP_ESTIMATE_MODELS[selection.baseMode] : undefined,
|
|
140870
|
+
AMP_ESTIMATE_MODELS.medium
|
|
140871
|
+
])
|
|
140872
|
+
].filter((model) => !!model);
|
|
140873
|
+
for (const model of candidates) {
|
|
140874
|
+
const writes = ampBillsCacheWrites(model);
|
|
140875
|
+
const costUsd = await priceModel("amp", {
|
|
140876
|
+
model,
|
|
140877
|
+
inputTokens: input.inputTokens + (writes ? 0 : input.cacheWriteTokens),
|
|
140878
|
+
outputTokens: input.outputTokens,
|
|
140879
|
+
cacheReadTokens: input.cacheReadTokens,
|
|
140880
|
+
cacheWriteTokens: writes ? input.cacheWriteTokens : 0
|
|
140881
|
+
}, null, input.atEpochMs, lookupRate);
|
|
140882
|
+
if (costUsd != null)
|
|
140883
|
+
return { totalCostUsd: costUsd, costSource: "estimated", modelBreakdown: undefined };
|
|
140884
|
+
}
|
|
140885
|
+
return unpricedResult(input, undefined);
|
|
140886
|
+
}
|
|
140887
|
+
async function recomputeSessionCost(input, lookupRate) {
|
|
140888
|
+
const modelUsageEntries = input.models?.length ? input.models : undefined;
|
|
140889
|
+
const modelBreakdown = modelUsageEntries?.map((model) => ({ ...model }));
|
|
140890
|
+
if (!input.provider) {
|
|
140891
|
+
return {
|
|
140892
|
+
totalCostUsd: input.harnessCostUsd,
|
|
140893
|
+
costSource: "harness",
|
|
140894
|
+
modelBreakdown
|
|
140895
|
+
};
|
|
140896
|
+
}
|
|
140897
|
+
if ((input.provider === "amp" || input.provider === "grok" || input.harnessCostBilled) && input.harnessCostUsd > 0) {
|
|
140898
|
+
const priced = await recomputeSessionCost({ ...input, harnessCostUsd: 0, harnessCostBilled: false }, lookupRate);
|
|
140899
|
+
return {
|
|
140900
|
+
totalCostUsd: input.harnessCostUsd,
|
|
140901
|
+
costSource: "harness",
|
|
140902
|
+
modelBreakdown: priced.modelBreakdown
|
|
140903
|
+
};
|
|
140904
|
+
}
|
|
140905
|
+
if (input.provider === "acp" && input.harnessCostUsd > 0) {
|
|
140906
|
+
return { totalCostUsd: input.harnessCostUsd, costSource: "harness", modelBreakdown };
|
|
140907
|
+
}
|
|
140908
|
+
if (input.provider === "amp" && !modelUsageEntries)
|
|
140909
|
+
return estimateAmpCost(input, lookupRate);
|
|
140910
|
+
const split = cacheWriteSplit(input);
|
|
140911
|
+
const usages = modelUsageEntries ? modelUsageEntries : input.model ? [
|
|
140912
|
+
{
|
|
140913
|
+
model: input.model,
|
|
140914
|
+
inputTokens: input.inputTokens,
|
|
140915
|
+
outputTokens: input.outputTokens,
|
|
140916
|
+
cacheReadTokens: input.cacheReadTokens,
|
|
140917
|
+
cacheWriteTokens: input.cacheWriteTokens
|
|
140918
|
+
}
|
|
140919
|
+
] : [];
|
|
140920
|
+
if (usages.length === 0) {
|
|
140921
|
+
return {
|
|
140922
|
+
totalCostUsd: input.harnessCostUsd,
|
|
140923
|
+
costSource: "harness",
|
|
140924
|
+
modelBreakdown
|
|
140925
|
+
};
|
|
140926
|
+
}
|
|
140927
|
+
const pricedModels = [];
|
|
140928
|
+
let pricedCostUsd = 0;
|
|
140929
|
+
const hasWebSearchRequests = usages.some((usage) => (usage.webSearchRequests ?? 0) > 0);
|
|
140930
|
+
const webSearchRate = hasWebSearchRequests ? await lookupRate(input.provider, "*", "web_search", input.atEpochMs) : null;
|
|
140931
|
+
for (const usage of usages) {
|
|
140932
|
+
const tokenCostUsd = await priceModel(input.provider, usage, split, input.atEpochMs, lookupRate);
|
|
140933
|
+
if (tokenCostUsd == null)
|
|
140934
|
+
return unpricedResult(input, modelBreakdown);
|
|
140935
|
+
const webSearchCostUsd = (usage.webSearchRequests ?? 0) * (webSearchRate ?? 0) / PER_MILLION;
|
|
140936
|
+
const costUsd = tokenCostUsd + webSearchCostUsd;
|
|
140937
|
+
pricedCostUsd += costUsd;
|
|
140938
|
+
if (modelUsageEntries)
|
|
140939
|
+
pricedModels.push({ ...usage, costUsd });
|
|
140940
|
+
}
|
|
140941
|
+
let sessionFeesUsd = 0;
|
|
140942
|
+
const durationMs = input.durationMs ?? 0;
|
|
140943
|
+
if (input.provider === "claude-managed" && durationMs > 0) {
|
|
140944
|
+
const runtimeRate = await lookupRate(input.provider, "*", "runtime_hour", input.atEpochMs);
|
|
140945
|
+
if (runtimeRate == null)
|
|
140946
|
+
return unpricedResult(input, modelBreakdown);
|
|
140947
|
+
sessionFeesUsd += durationMs / 3600000 * (runtimeRate / PER_MILLION);
|
|
140948
|
+
}
|
|
140949
|
+
return {
|
|
140950
|
+
totalCostUsd: pricedCostUsd + sessionFeesUsd,
|
|
140951
|
+
costSource: "pricing-table",
|
|
140952
|
+
modelBreakdown: modelUsageEntries ? pricedModels : undefined
|
|
140953
|
+
};
|
|
140954
|
+
}
|
|
140955
|
+
var PER_MILLION = 1e6, INCLUSIVE_INPUT_PROVIDERS;
|
|
140956
|
+
var init_session_cost_recompute = __esm(() => {
|
|
140957
|
+
init_pricing_normalize();
|
|
140958
|
+
init_amp_models();
|
|
140959
|
+
INCLUSIVE_INPUT_PROVIDERS = new Set(["codex"]);
|
|
140960
|
+
});
|
|
140961
|
+
|
|
140452
140962
|
// src/tools/system-one-decide.ts
|
|
140963
|
+
async function costTask(taskId, requestInfo) {
|
|
140964
|
+
const id = taskId ?? requestInfo.sourceTaskId;
|
|
140965
|
+
if (!id)
|
|
140966
|
+
return {};
|
|
140967
|
+
const task = await getTaskById2(id);
|
|
140968
|
+
const allowed = !!task && (requestInfo.callOrigin === "extension" || task.agentId === requestInfo.agentId);
|
|
140969
|
+
if (allowed)
|
|
140970
|
+
return { task };
|
|
140971
|
+
return taskId ? { error: `taskId ${taskId} is not a task this caller can charge` } : {};
|
|
140972
|
+
}
|
|
140973
|
+
async function recordDecisionCost(task, callerAgentId, provider, output, durationMs) {
|
|
140974
|
+
const model = `${provider}/${output.model}`;
|
|
140975
|
+
const priced = await recomputeSessionCost({
|
|
140976
|
+
provider: "system-one",
|
|
140977
|
+
model,
|
|
140978
|
+
harnessCostUsd: 0,
|
|
140979
|
+
inputTokens: output.usage.input_tokens,
|
|
140980
|
+
outputTokens: output.usage.output_tokens,
|
|
140981
|
+
cacheReadTokens: 0,
|
|
140982
|
+
cacheWriteTokens: 0,
|
|
140983
|
+
atEpochMs: Date.now()
|
|
140984
|
+
}, async (pricingProvider, lookupModel, tokenClass, atEpochMs) => (await getActivePricingRow2(pricingProvider, lookupModel, tokenClass, atEpochMs))?.pricePerMillionUsd ?? null);
|
|
140985
|
+
const { cost } = await insertSessionCost2({
|
|
140986
|
+
sessionId: `system-one:${crypto.randomUUID()}`,
|
|
140987
|
+
taskId: task.id,
|
|
140988
|
+
agentId: task.agentId ?? callerAgentId,
|
|
140989
|
+
totalCostUsd: priced.totalCostUsd,
|
|
140990
|
+
inputTokens: output.usage.input_tokens,
|
|
140991
|
+
outputTokens: output.usage.output_tokens,
|
|
140992
|
+
durationMs,
|
|
140993
|
+
numTurns: null,
|
|
140994
|
+
model,
|
|
140995
|
+
costSource: priced.costSource,
|
|
140996
|
+
kind: "system-one"
|
|
140997
|
+
});
|
|
140998
|
+
return { taskId: task.id, costUsd: cost.totalCostUsd, costSource: cost.costSource };
|
|
140999
|
+
}
|
|
140453
141000
|
var registerSystemOneDecideTool = (server) => {
|
|
140454
141001
|
createToolRegistrar(server)("system-one-decide", {
|
|
140455
141002
|
title: "Ask a SystemOne decision model",
|
|
@@ -140461,19 +141008,28 @@ var registerSystemOneDecideTool = (server) => {
|
|
|
140461
141008
|
state: union3([string2(), array2(string2()), record2(string2(), unknown())]).describe("The state to decide on"),
|
|
140462
141009
|
questions: record2(string2(), record2(string2(), unknown())).describe("Questions by id, each `{ type: 'noul' | 'choice' | 'score', instructions, criteria }`"),
|
|
140463
141010
|
timeoutMs: number2().int().optional().describe("Time budget for the call, retries included (default 30000)"),
|
|
140464
|
-
maxRetries: number2().int().optional().describe("Retries on transient failures inside the time budget (default 2)")
|
|
141011
|
+
maxRetries: number2().int().optional().describe("Retries on transient failures inside the time budget (default 2)"),
|
|
141012
|
+
taskId: uuid().optional().describe("Task this decision serves; its cost is recorded on that task's session costs (default: the caller's X-Source-Task-Id). Must be the caller's own task, or, from an extension, the task of the event it handles")
|
|
140465
141013
|
}),
|
|
140466
141014
|
outputSchema: swarmToolOutputSchema({
|
|
140467
141015
|
model: string2().optional(),
|
|
140468
141016
|
answers: record2(string2(), unknown()).optional(),
|
|
140469
141017
|
usage: record2(string2(), unknown()).optional(),
|
|
140470
141018
|
requestId: string2().optional(),
|
|
141019
|
+
cost: looseObject({
|
|
141020
|
+
taskId: string2().optional(),
|
|
141021
|
+
costUsd: number2().optional(),
|
|
141022
|
+
costSource: string2().optional()
|
|
141023
|
+
}).optional().describe("The session-cost row recorded on the task, when a task was in scope"),
|
|
140471
141024
|
providerUnavailable: boolean().optional().describe("On an error: true when this deployment refuses the provider (e.g. OpenRouter behind a gateway) and no request was sent, so a caller choosing automatically can try its next provider")
|
|
140472
141025
|
})
|
|
140473
|
-
}, async ({ provider, model, state, questions, timeoutMs, maxRetries }, requestInfo) => {
|
|
141026
|
+
}, async ({ provider, model, state, questions, timeoutMs, maxRetries, taskId }, requestInfo) => {
|
|
140474
141027
|
if (!requestInfo.agentId) {
|
|
140475
141028
|
return toolErr('Agent ID not found. The MCP client should define the "X-Agent-ID" header.');
|
|
140476
141029
|
}
|
|
141030
|
+
const scope = await costTask(taskId, requestInfo);
|
|
141031
|
+
if (scope.error)
|
|
141032
|
+
return toolErr(scope.error);
|
|
140477
141033
|
const returns = Object.fromEntries(Object.entries(questions).map(([id, question]) => [id, { type: question.type }]));
|
|
140478
141034
|
const parsed = SystemOneDecisionConfigSchema.safeParse({
|
|
140479
141035
|
provider,
|
|
@@ -140492,23 +141048,35 @@ var registerSystemOneDecideTool = (server) => {
|
|
|
140492
141048
|
if (!(executor instanceof SystemOneDecisionExecutor)) {
|
|
140493
141049
|
return toolErr("The system-one-decision executor is not available");
|
|
140494
141050
|
}
|
|
141051
|
+
const startedAt = Date.now();
|
|
140495
141052
|
const decided = await executor.decide(parsed.data);
|
|
140496
141053
|
if (!decided.ok) {
|
|
140497
141054
|
return toolErr(decided.error, decided.deploymentRefused ? { data: { providerUnavailable: true } } : {});
|
|
140498
141055
|
}
|
|
140499
141056
|
const { output } = decided;
|
|
141057
|
+
let cost;
|
|
141058
|
+
if (scope.task) {
|
|
141059
|
+
try {
|
|
141060
|
+
cost = await recordDecisionCost(scope.task, requestInfo.agentId, decided.provider, output, Date.now() - startedAt);
|
|
141061
|
+
} catch (err) {
|
|
141062
|
+
console.warn(`[system-one-decide] cost not recorded on task ${scope.task.id}: ${err instanceof Error ? err.message : String(err)}`);
|
|
141063
|
+
}
|
|
141064
|
+
}
|
|
140500
141065
|
return toolOk(`Decision from ${output.model}`, {
|
|
140501
141066
|
data: {
|
|
140502
141067
|
model: output.model,
|
|
140503
141068
|
answers: output.answers,
|
|
140504
141069
|
usage: output.usage,
|
|
140505
|
-
requestId: output.requestId
|
|
141070
|
+
requestId: output.requestId,
|
|
141071
|
+
...cost ? { cost } : {}
|
|
140506
141072
|
}
|
|
140507
141073
|
});
|
|
140508
141074
|
});
|
|
140509
141075
|
};
|
|
140510
141076
|
var init_system_one_decide = __esm(() => {
|
|
140511
141077
|
init_zod();
|
|
141078
|
+
init_db4();
|
|
141079
|
+
init_session_cost_recompute();
|
|
140512
141080
|
init_utils();
|
|
140513
141081
|
init_workflows();
|
|
140514
141082
|
init_system_one_decision();
|
|
@@ -141776,6 +142344,7 @@ var registerCreateWorkflowTool = (server) => {
|
|
|
141776
142344
|
` + "- FOREACH NODE: type 'foreach' runs its body once per item. Config: " + "{ over: <array or exact {{input}} token>, itemKey: <property name>, body: { type: <any executor except foreach>, config: {...} }, " + "concurrency?: <integer >= 1, items in flight; unbounded when absent>, failurePolicy?: 'fail-fast' | 'collect-outcomes' }. " + "The body config is interpolated once per item with {{item.*}} and {{index}}. Child steps use synthetic IDs " + "'<foreachNodeId>#<itemKey>'; the parent waits for every child and exposes one aggregate result to successors. " + "failurePolicy defaults from onNodeFailure ('continue' = collect-outcomes, else fail-fast); fail-fast cancels queued items. " + `retry-workflow-run on a failed fan-out reruns only failed and cancelled items.
|
|
141777
142345
|
` + "- TRIGGER SCHEMA: Optional 'triggerSchema' is a JSON-Schema object that validates incoming trigger payloads. " + "Supported keywords: type, required, properties, enum, const, items (recursive into arrays). " + `Other JSON-Schema keywords (oneOf/anyOf/$ref/pattern/format/additionalProperties) are silently ignored.
|
|
141778
142346
|
` + "- WEBHOOK VERIFICATION: Webhook triggers use hmacSecret for all verification formats. " + "Omit verification for legacy HMAC-SHA256 over the raw body with fallback header scanning; " + "or set verification to { format: 'hmac-sha256', header }, { format: 'timestamped-hmac-sha256', header, toleranceSeconds? }, " + "{ format: 'token-equality', header }, or { format: 'standard-webhooks', toleranceSeconds? } " + "(standardwebhooks.com: webhook-id/webhook-timestamp/webhook-signature headers, hmacSecret is the whsec_ signing secret). Example: { type: 'webhook', hmacSecret: 'secret.SUPERAGENT_WEBHOOK_SECRET', " + `verification: { format: 'timestamped-hmac-sha256', header: 'X-Superagent-Signature', toleranceSeconds: 300 } }.
|
|
142347
|
+
` + "- WEBHOOK EVENT FILTER: optional events: ['pull_request'] on a webhook trigger drops other deliveries after signature verification, " + `before any run is saved (2xx skipped reply). The event is read from eventHeader (default X-GitHub-Event).
|
|
141779
142348
|
` + "- WAIT NODE: type 'wait' pauses a workflow for a duration or until a named workflowEventBus event arrives. " + "See runbooks/workflows.md#wait-nodes for config shapes, ordering caveats, and built-in event names.",
|
|
141780
142349
|
inputSchema: object2({
|
|
141781
142350
|
name: string2().describe("Unique name for the workflow"),
|
|
@@ -142547,7 +143116,7 @@ var registerUpdateWorkflowTool = (server) => {
|
|
|
142547
143116
|
createToolRegistrar(server)("update-workflow", {
|
|
142548
143117
|
title: "Update Workflow",
|
|
142549
143118
|
annotations: { destructiveHint: false },
|
|
142550
|
-
description: "Update an existing workflow's name, description, definition, triggers, cooldown, input, triggerSchema, or enabled state. " + "Creates a version snapshot before applying changes. " + "TRIGGER SCHEMA: pass 'triggerSchema' as a JSON-Schema object to set/replace, or 'null' to clear. " + "Supported JSON-Schema keywords: type, required, properties, enum, const, items (recursive into arrays). " + "Other JSON-Schema keywords (oneOf/anyOf/$ref/pattern/format/additionalProperties) are silently ignored. " + "WEBHOOK VERIFICATION: webhook triggers use hmacSecret for all verification formats. " + "Omit verification for legacy HMAC-SHA256 over the raw body with fallback header scanning; " + "or set verification to { format: 'hmac-sha256', header }, { format: 'timestamped-hmac-sha256', header, toleranceSeconds? }, " + "{ format: 'token-equality', header }, or { format: 'standard-webhooks', toleranceSeconds? } " + "(standardwebhooks.com: webhook-id/webhook-timestamp/webhook-signature headers, hmacSecret is the whsec_ signing secret).",
|
|
143119
|
+
description: "Update an existing workflow's name, description, definition, triggers, cooldown, input, triggerSchema, or enabled state. " + "Creates a version snapshot before applying changes. " + "TRIGGER SCHEMA: pass 'triggerSchema' as a JSON-Schema object to set/replace, or 'null' to clear. " + "Supported JSON-Schema keywords: type, required, properties, enum, const, items (recursive into arrays). " + "Other JSON-Schema keywords (oneOf/anyOf/$ref/pattern/format/additionalProperties) are silently ignored. " + "WEBHOOK VERIFICATION: webhook triggers use hmacSecret for all verification formats. " + "Omit verification for legacy HMAC-SHA256 over the raw body with fallback header scanning; " + "or set verification to { format: 'hmac-sha256', header }, { format: 'timestamped-hmac-sha256', header, toleranceSeconds? }, " + "{ format: 'token-equality', header }, or { format: 'standard-webhooks', toleranceSeconds? } " + "(standardwebhooks.com: webhook-id/webhook-timestamp/webhook-signature headers, hmacSecret is the whsec_ signing secret). " + "WEBHOOK EVENT FILTER: optional events: ['pull_request'] on a webhook trigger drops other deliveries after signature verification, " + "before any run is saved (2xx skipped reply). The event is read from eventHeader (default X-GitHub-Event).",
|
|
142551
143120
|
inputSchema: object2({
|
|
142552
143121
|
id: string2().uuid().describe("Workflow ID to update"),
|
|
142553
143122
|
key: AssetKeySchema.optional().describe("Move to a logical namespace."),
|
|
@@ -142733,7 +143302,7 @@ function removeTools(server, names) {
|
|
|
142733
143302
|
tools[name]?.remove();
|
|
142734
143303
|
}
|
|
142735
143304
|
async function createServer(opts = {}) {
|
|
142736
|
-
await
|
|
143305
|
+
await loadGlobalConfigsIntoEnv2(true);
|
|
142737
143306
|
const toolAllowlist = opts.fullSurface === true ? undefined : resolveToolAllowlist(opts.enabledTools ?? process.env.SWARM_ENABLED_TOOLS);
|
|
142738
143307
|
const hasCapability = (cap) => opts.fullSurface === true || toolAllowlist !== undefined || (cap === "chat-sdk" ? isChatSdkEnabled() : getCapabilities().has(cap));
|
|
142739
143308
|
initDb2(process.env.DATABASE_PATH);
|
|
@@ -143173,4 +143742,4 @@ var init_server = __esm(() => {
|
|
|
143173
143742
|
loggedToolAllowlistWarnings = new Set;
|
|
143174
143743
|
});
|
|
143175
143744
|
|
|
143176
|
-
export { DEFAULT_NEGOTIATED_PROTOCOL_VERSION, SUPPORTED_PROTOCOL_VERSIONS, isJSONRPCRequest, isJSONRPCResultResponse, isJSONRPCErrorResponse, JSONRPCMessageSchema, isInitializeRequest, init_types, McpServer, init_mcp, referencedBundlePaths, skillDirs, init_manifest_format, recoverIncompleteRuns, init_recovery, handleWebhookTrigger, verifyHmacSignature, WebhookError, init_triggers, snapshotAndUpdateWorkflow, init_version, applyPreTaskCreate, init_apply_task_create, RawLlmConfigSchema, RawLlmOutputSchema, executeRawLlm, init_raw_llm, getExecutorRegistry2, initWorkflows2, init_workflows, stripSiblingBlock, init_sibling_block, createTaskWithSiblingAwareness, init_sibling_awareness, dispatchScheduleTarget, calculateNextRun2, startScheduler2, stopScheduler2, runScheduleNow2, init_scheduler, ExtensionAssetConflictError, hashOf, scriptHash, liveScriptSpec, liveWorkflowSpec, skillSpecOf, liveSkillSpec, skillHash, init_assets, ExtensionOwnershipError, getExtensionFiles, getExtensionById, getExtensionByName, listExtensions, listExtensionVersions, updateExtensionMeta, listExtensionRuns, init_db, SDK_ALLOWLIST, mcpToolNameForSdkMethod, init_sdk_allowlist, MCP_OVERFLOW_NAMESPACE, mcpOverflowAuthError, init_kv_overflow, hasKvViewArgs, resolveKvView, init_kv_view, COLOR_LITERAL_THRESHOLD, countColorLiterals, init_color_literals, toolErr, createToolRegistrar, init_utils, handleMcpBridge, init_mcp_bridge, Redacted, init_redacted, SCRIPT_SDK_RESPONSE_LIMIT_BYTES, readScriptSdkJsonResponse, init_response_limit, retry, init_retry, ExtensionConfigError, init_loader, ExtensionLifecycleError, setExtensionLoopbackBaseUrl, enableExtension, disableExtension, activateVersion, ExtensionAssetsInvalidError, installExtensionWithAssets, uninstallExtension, reloadExtension, loadEnabledExtensions, stopExtensionRuntime, init_lifecycle, ExtensionAbortedError2, isRegistered2, isExtensionAgentId2, getExtensionBridgeToken2, resolveBridgeCallOrigin2, extensionIdForAgent2, runContext2, registerLoaded2, unregister2, listRegistered2, dispatchPre2, dispatchPost2, init_dispatcher, resolveIdentity, renderIdentity, init_identity, recordUnmappedIdentity, init_unmapped_identities, getDeliveredSlackMessageTs, foldIntoPendingSlackTask, init_slack_fold, MAX_TASK_ATTACHMENT_BYTES, recordTaskAttachmentUpload, scopeFromAttachment, backingProviderId, init_task_attachment_store, transcribeAudioNotes, init_transcription, init_templates, buildEffectiveText, bufferedFileFailures, fetchSlackFiles, createSlackTaskWithFiles, attachSlackFilesToDraft, notifySlackFileFailures, init_inbound_files, pendingWorkForAgent, countPoolRuntimes, computeDesired, init_demand, isRuntimePoolWakeable, isAgentReachable, isAgentOnDemand, init_reachability, isAddressedToOtherUser, broadcastMatches, routeMessage, extractTaskFromMessage, init_router, extractSlackMessageText, slackInboundMessageText, collectSlackMessageFiles, init_message_text, createAdditiveBuffer, init_additive_buffer, repointTrackerSyncBySwarmId, init_tracker, REBOOT_RETRY_PIN_TAG2, getPinCandidateAgent2, resolveLeadOnlyRecoveryAssignment2, getResumeGeneration2, getNextResumeGeneration2, inheritedModelSelection2, nextFallback2, createWorkerTaskFollowUp2, createResumeFollowUp2, createRerouteDecisionTask2, createPoolStarvationDecisionTask2, init_worker_follow_up, isGitHubEnabled, initGitHub, verifyWebhookSignature, isAgentMailEnabled, initAgentMail, verifyAgentMailWebhook, isInboxAllowed, isSenderAllowed, handleMessageReceived, init_agentmail, isAzureDevOpsEnabled, initAzureDevOps, verifyAzureDevOpsWebhook, isAzureDevOpsUrl, canonicalAzureDevOpsRepoUrl, parseAzureDevOpsRepoUrl, init_azure_devops, createdPullRequestOf, commentedPayloadOf, handlePullRequestCreated, handlePullRequestCommented, handleWorkItemCreated, handleWorkItemUpdated, handleWorkItemCommented, handleWorkItemDeleted, handleWorkItemRestored, initAzureDevOpsOutbound, init_azure_devops2, enqueueAuditRow, enqueueAdmissionRow, flushAuditBuffer, startAuditWriter, stopAuditWriter, startAuditGc, stopAuditGc, init_rbac_audit, getTelemetryIngestAnchor, init_telemetry_ingest_anchor, initApiTelemetry, syncTelemetryEnabled, init_telemetry_enable, isBitbucketEnabled, initBitbucket, verifyBitbucketWebhook, isDuplicateDelivery, markDeliveryProcessed, pullRequestEventOf, pullRequestCommentEventOf, handlePullRequestCreated2, handlePullRequestCommentCreated, handlePullRequestClosed, init_bitbucket, handlePullRequest, handleIssue, handleComment, handlePullRequestReview, handleCheckRun, handleCheckSuite, handleWorkflowRun, init_github, isGitLabEnabled, initGitLab, verifyGitLabWebhook, handleMergeRequest, handleIssue2, handleNote, handlePipeline, init_gitlab, isChatSdkEnabled, getChatSdkConfig, init_config, errorMessage, init_logger, resolveAdapterApiUrl, init_adapters, trackBackground, init_background, TelegramBotApiError, callTelegramBotApi, init_telegram_api, isTrustedTeamsServiceUrl, init_teams_origin, getSessionLabels, rememberSessionLabel, getResourceSessionLabels, init_session_labels, isChatSdkStopping, startChatSdk, getChatInstance, isChatAdapterConfigured, getChatSdkHealth, stopChatSdk, init_runtime, getJiraMetadata, updateJiraMetadata, clearJiraMetadata, init_metadata, registerJiraWebhook, deleteJiraWebhook, init_webhook_lifecycle, isJiraEnabled, initJira, init_app, handleJiraWebhook, init_webhook, init_jira, handleAgentSessionEvent, handleIssueUpdate, handleIssueDelete, handleAgentSessionPrompted, init_sync, isLinearEnabled, initLinear, init_app2, init_linear, init_slack, verifyPageSession, LEGACY_PAGE_SESSION_COOKIE, isCookieSafePageId, extractPageSession, extractLegacyPageSession, extractAndVerifyCookie, isLocalDevPageRequest, pageSessionSetCookies, init_page_session, resolveHttpRequestAuth, init_auth, getDeploymentEnvValue, loadGlobalConfigsIntoEnv, reloadGlobalConfigsAndIntegrations, scheduleIntegrationsReload, handleCore, init_core, MCP_MAX_TOOL_INPUT_ELEMENTS, MCP_MAX_REQUEST_BODY_BYTES, init_mcp_limits, userCtx, init_task_tool_ctx, resolveRequestPrincipal, requestPrincipal, agentFirstPrincipal, requireAuthKind, rejectGuest, init_request_principal, resolveTaskRequester, init_task_requester, handleApps, init_apps, cancelApprovalRequest, cancelApprovalRequestAndRun, init_approval_cancel, getUserCommsPrefs, init_requester_comms, getTaskDetailsInputSchema, getTaskDetailsOutputSchema, getTaskDetailsHandler, init_get_task_details, cancelTaskInputSchema, cancelTaskOutputSchema, cancelTaskHandler, init_cancel_task, DbQueryTimeoutError, DbQueryConcurrencyCapError, executeReadOnlyQuery, getDbQueryHttpBudgetMs, init_db_query_shared, assertSelectOnlyQuery, executeReadOnlyQueryGated, handleDbQuery, init_db_query, snapshotMetric, init_version2, AssetKeyAuthorizationError, authorizeAssetKeyWrite, init_asset_key_auth, getPageEditCounter, init_page_versions, snapshotPage, init_version3, DEFAULT_THEME_ID, THEME_PRESET_IDS, getThemePreset, init_presets, readThemeFields, init_page_fields, assertOAuthAppUrlsSafe, assertOAuthEgressUrlSafe, init_app_validation, listOAuthPresets, listOAuthPresetIds, getOAuthPreset, hydrateOAuthAppFromPreset, init_presets2, scopedResourceScopeIdSchema, resolveScopedResourceId, init_scoped_resource, MemoryKeyError, init_key_guard, refreshLinks, init_link_resolver, indexMemoryContent, init_index_content, dedupeMemoryDocumentIds, recordMemoryAccesses, recordRetrievals, init_retrieval, ExplicitSelfDuplicateError, applyRating, init_store, shouldPersistAutomaticTaskMemory, init_automatic_task_gate, guardTerminalTaskResultWrite, init_terminal_result_guard, getTasksInputSchema, getTasksOutputSchema, getTasksHandler, init_get_tasks, requiresLeadToWrite, reservedNamespaceError, privateNamespaceError, reservedRoomKeyError, init_kv_reserved_namespaces, updateMcpServerChecked, init_mcp_server_checked_update, updateTouchesStdioExecution, init_mcp_server_stdio_gate, canReadMemory, init_access, getLinksForMemory, init_links_store, expandCandidatesWithGraph, init_graph_expansion, isApiDraining, drainApi, init_api_drain, markKapsoMessageRead, sendKapsoReaction, init_client, getKapsoConfig, getKapsoNumberMapping, markKapsoMessageSeen, init_config2, changesAllowMerge, init_repo_merge_policy, updateSwarmRepoChecked, init_repo_checked_update, getCombConfig, init_config3, resolveRoomNamespace, roomRequestInfo, authorizeRoomNamespace, sessionAccessTopic, sessionPresenceRoot, init_auth2, RoomOperationSchema, init_document, removeAwarenessStates, init_awareness, roomTopic, decodeRoomSnapshot, roomView, getRoom, changeRoom, applyRoomUpdate, resetRoom, sweepRooms, closeRooms, removeNamespaceRooms, init_rooms, init_scheduler2, MEMORY_KEYS_DEFAULT_PREFIX, MEMORY_KEYS_MAX_LIMIT, estimateTokens, posteriorMean, listMemoryKeys, checkChunkIntegrity, getMemoryChunks, getPosteriorsByIds, init_key_browser, createEvent, createEventsBatch, getEventCountsFiltered, getEventsFiltered, init_events, mergeScheduleTiming, validateRecurringTiming, init_validate, followUpThreadForSourceTask, evaluateFollowUpRedelegation, init_follow_up_redelegation_guard, checkOutputSchemaShape, sendTaskOutputSchema, sendTaskHandler, init_send_task, steerTaskUserInputSchema, steerTaskOutputSchema, steerTaskHandler, init_steer_task, skipReasonFrom, finalizeSkippedTaskReaction, init_task_skip, IMPROVEMENT_TEXT_MAX, IMPROVEMENT_STATUSES, IMPROVEMENT_SOURCES, ImprovementError, isImprovementsEnabled, getImprovement, listImprovements, createImprovement, approveAndSend, discardImprovement, improvementLeakHints, init_improvements, canClaim, init_budget_admission, emitBudgetRefusalSideEffects, init_budget_refusal_notify, workflowModelErrors, init_model_validation, patchWorkflowDefinition, init_patch_definition, idempotencyKeyHeader, readIdempotencyKey, replayAcceptedOperation, init_idempotency_key, resolveScriptsOnlyMode, init_scripts_only_mode, ALL_CAPABILITIES, hasCapability, getEnabledCapabilities, createServer, init_server };
|
|
143745
|
+
export { DEFAULT_NEGOTIATED_PROTOCOL_VERSION, SUPPORTED_PROTOCOL_VERSIONS, isJSONRPCRequest, isJSONRPCResultResponse, isJSONRPCErrorResponse, JSONRPCMessageSchema, isInitializeRequest, init_types, McpServer, init_mcp, referencedBundlePaths, skillDirs, init_manifest_format, recoverIncompleteRuns, init_recovery, handleWebhookTrigger, verifyHmacSignature, WebhookError, init_triggers, snapshotAndUpdateWorkflow, init_version, applyPreTaskCreate, init_apply_task_create, RawLlmConfigSchema, RawLlmOutputSchema, executeRawLlm, init_raw_llm, getExecutorRegistry2, initWorkflows2, init_workflows, stripSiblingBlock, init_sibling_block, createTaskWithSiblingAwareness, init_sibling_awareness, dispatchScheduleTarget, calculateNextRun2, startScheduler2, stopScheduler2, runScheduleNow2, init_scheduler, ExtensionAssetConflictError, hashOf, scriptHash, liveScriptSpec, liveWorkflowSpec, skillSpecOf, liveSkillSpec, skillHash, init_assets, ExtensionOwnershipError, getExtensionFiles, getExtensionById, getExtensionByName, listExtensions, listExtensionVersions, updateExtensionMeta, listExtensionRuns, init_db, SDK_ALLOWLIST, mcpToolNameForSdkMethod, init_sdk_allowlist, MCP_OVERFLOW_NAMESPACE, mcpOverflowAuthError, init_kv_overflow, hasKvViewArgs, resolveKvView, init_kv_view, COLOR_LITERAL_THRESHOLD, countColorLiterals, init_color_literals, toolErr, createToolRegistrar, init_utils, handleMcpBridge, init_mcp_bridge, Redacted, init_redacted, SCRIPT_SDK_RESPONSE_LIMIT_BYTES, readScriptSdkJsonResponse, init_response_limit, retry, init_retry, ExtensionConfigError, init_loader, ExtensionLifecycleError, setExtensionLoopbackBaseUrl, enableExtension, disableExtension, activateVersion, ExtensionAssetsInvalidError, installExtensionWithAssets, uninstallExtension, reloadExtension, loadEnabledExtensions, stopExtensionRuntime, init_lifecycle, ExtensionAbortedError2, isRegistered2, isExtensionAgentId2, getExtensionBridgeToken2, resolveBridgeCallOrigin2, extensionIdForAgent2, runContext2, registerLoaded2, unregister2, listRegistered2, dispatchPre2, dispatchPost2, init_dispatcher, resolveIdentity, renderIdentity, init_identity, recordUnmappedIdentity, init_unmapped_identities, getDeliveredSlackMessageTs, foldIntoPendingSlackTask, init_slack_fold, MAX_TASK_ATTACHMENT_BYTES, recordTaskAttachmentUpload, scopeFromAttachment, backingProviderId, init_task_attachment_store, transcribeAudioNotes, init_transcription, init_templates, buildEffectiveText, bufferedFileFailures, fetchSlackFiles, createSlackTaskWithFiles, attachSlackFilesToDraft, notifySlackFileFailures, init_inbound_files, pendingWorkForAgent, countPoolRuntimes, computeDesired, init_demand, isRuntimePoolWakeable, isAgentReachable, isAgentOnDemand, init_reachability, isAddressedToOtherUser, broadcastMatches, routeMessage, extractTaskFromMessage, init_router, extractSlackMessageText, slackInboundMessageText, collectSlackMessageFiles, init_message_text, createAdditiveBuffer, init_additive_buffer, isAgentMailEnabled, initAgentMail, verifyAgentMailWebhook, isInboxAllowed, isSenderAllowed, handleMessageReceived, init_agentmail, isAzureDevOpsEnabled, initAzureDevOps, verifyAzureDevOpsWebhook, repointTrackerSyncBySwarmId, init_tracker, isAzureDevOpsUrl, canonicalAzureDevOpsRepoUrl, parseAzureDevOpsRepoUrl, init_azure_devops, createdPullRequestOf, commentedPayloadOf, handlePullRequestCreated, handlePullRequestCommented, handleWorkItemCreated, handleWorkItemUpdated, handleWorkItemCommented, handleWorkItemDeleted, handleWorkItemRestored, initAzureDevOpsOutbound, init_azure_devops2, enqueueAuditRow, enqueueAdmissionRow, flushAuditBuffer, startAuditWriter, stopAuditWriter, startAuditGc, stopAuditGc, init_rbac_audit, getTelemetryIngestAnchor, init_telemetry_ingest_anchor, initApiTelemetry, syncTelemetryEnabled, init_telemetry_enable, isBitbucketEnabled, initBitbucket, verifyBitbucketWebhook, isDuplicateDelivery, markDeliveryProcessed, pullRequestEventOf, pullRequestCommentEventOf, handlePullRequestCreated2, handlePullRequestCommentCreated, handlePullRequestClosed, init_bitbucket, isGitHubEnabled, initGitHub, verifyWebhookSignature, handlePullRequest, handleIssue, handleComment, handlePullRequestReview, handleCheckRun, handleCheckSuite, handleWorkflowRun, init_github, isGitLabEnabled, initGitLab, verifyGitLabWebhook, handleMergeRequest, handleIssue2, handleNote, handlePipeline, init_gitlab, isChatSdkEnabled, getChatSdkConfig, init_config, errorMessage, init_logger, resolveAdapterApiUrl, init_adapters, trackBackground, init_background, TelegramBotApiError, callTelegramBotApi, init_telegram_api, isTrustedTeamsServiceUrl, init_teams_origin, getSessionLabels, rememberSessionLabel, getResourceSessionLabels, init_session_labels, isChatSdkStopping, startChatSdk, getChatInstance, isChatAdapterConfigured, getChatSdkHealth, stopChatSdk, init_runtime, getJiraMetadata, updateJiraMetadata, clearJiraMetadata, init_metadata, registerJiraWebhook, deleteJiraWebhook, init_webhook_lifecycle, isJiraEnabled, initJira, init_app, handleJiraWebhook, init_webhook, init_jira, handleAgentSessionEvent, handleIssueUpdate, handleIssueDelete, handleAgentSessionPrompted, init_sync, isLinearEnabled, initLinear, init_app2, init_linear, init_slack, verifyPageSession, LEGACY_PAGE_SESSION_COOKIE, isCookieSafePageId, extractPageSession, extractLegacyPageSession, extractAndVerifyCookie, isLocalDevPageRequest, pageSessionSetCookies, init_page_session, resolveHttpRequestAuth, init_auth, getDeploymentEnvValue2, loadGlobalConfigsIntoEnv2, reloadGlobalConfigsAndIntegrations2, scheduleIntegrationsReload2, handleCore2, init_core, runTaskUiScriptAction, init_script_actions, REBOOT_RETRY_PIN_TAG2, getPinCandidateAgent2, resolveLeadOnlyRecoveryAssignment2, getResumeGeneration2, getNextResumeGeneration2, inheritedModelSelection2, nextFallback2, createWorkerTaskFollowUp2, createResumeFollowUp2, createRerouteDecisionTask2, createPoolStarvationDecisionTask2, init_worker_follow_up, MCP_MAX_TOOL_INPUT_ELEMENTS, MCP_MAX_REQUEST_BODY_BYTES, init_mcp_limits, userCtx, init_task_tool_ctx, resolveRequestPrincipal, requestPrincipal, agentFirstPrincipal, requireAuthKind, rejectGuest, init_request_principal, resolveTaskRequester, init_task_requester, handleApps, init_apps, cancelApprovalRequest, cancelApprovalRequestAndRun, init_approval_cancel, getUserCommsPrefs, init_requester_comms, getTaskDetailsInputSchema, getTaskDetailsOutputSchema, getTaskDetailsHandler, init_get_task_details, cancelTaskInputSchema, cancelTaskOutputSchema, cancelTaskHandler, init_cancel_task, DbQueryTimeoutError, DbQueryConcurrencyCapError, executeReadOnlyQuery, getDbQueryHttpBudgetMs, init_db_query_shared, assertSelectOnlyQuery, executeReadOnlyQueryGated, handleDbQuery, init_db_query, snapshotMetric, init_version2, AssetKeyAuthorizationError, authorizeAssetKeyWrite, init_asset_key_auth, getPageEditCounter, init_page_versions, snapshotPage, init_version3, DEFAULT_THEME_ID, THEME_PRESET_IDS, getThemePreset, init_presets, readThemeFields, init_page_fields, assertOAuthAppUrlsSafe, assertOAuthEgressUrlSafe, init_app_validation, listOAuthPresets, listOAuthPresetIds, getOAuthPreset, hydrateOAuthAppFromPreset, init_presets2, scopedResourceScopeIdSchema, resolveScopedResourceId, init_scoped_resource, MemoryKeyError, init_key_guard, refreshLinks, init_link_resolver, indexMemoryContent, init_index_content, dedupeMemoryDocumentIds, recordMemoryAccesses, recordRetrievals, init_retrieval, ExplicitSelfDuplicateError, applyRating, init_store, shouldPersistAutomaticTaskMemory, init_automatic_task_gate, guardTerminalTaskResultWrite, init_terminal_result_guard, getTasksInputSchema, getTasksOutputSchema, getTasksHandler, init_get_tasks, requiresLeadToWrite, reservedNamespaceError, privateNamespaceError, reservedRoomKeyError, init_kv_reserved_namespaces, updateMcpServerChecked, init_mcp_server_checked_update, updateTouchesStdioExecution, init_mcp_server_stdio_gate, canReadMemory, init_access, getLinksForMemory, init_links_store, attachDemotionEvidence, init_demotion_evidence, expandCandidatesWithGraph, init_graph_expansion, isApiDraining, drainApi, init_api_drain, markKapsoMessageRead, sendKapsoReaction, init_client, getKapsoConfig, getKapsoNumberMapping, markKapsoMessageSeen, init_config2, changesAllowMerge, init_repo_merge_policy, updateSwarmRepoChecked, init_repo_checked_update, getCombConfig, init_config3, resolveRoomNamespace, roomRequestInfo, authorizeRoomNamespace, sessionAccessTopic, sessionPresenceRoot, init_auth2, RoomOperationSchema, init_document, removeAwarenessStates, init_awareness, roomTopic, decodeRoomSnapshot, roomView, getRoom, changeRoom, applyRoomUpdate, resetRoom, sweepRooms, closeRooms, removeNamespaceRooms, init_rooms, init_scheduler2, MEMORY_KEYS_DEFAULT_PREFIX, MEMORY_KEYS_MAX_LIMIT, estimateTokens, posteriorMean, listMemoryKeys, checkChunkIntegrity, getMemoryChunks, getPosteriorsByIds, init_key_browser, createEvent, createEventsBatch, getEventCountsFiltered, getEventsFiltered, init_events, mergeScheduleTiming, validateRecurringTiming, init_validate, followUpThreadForSourceTask, evaluateFollowUpRedelegation, init_follow_up_redelegation_guard, checkOutputSchemaShape, sendTaskOutputSchema, sendTaskHandler, init_send_task, steerTaskUserInputSchema, steerTaskOutputSchema, steerTaskHandler, init_steer_task, skipReasonFrom, finalizeSkippedTaskReaction, init_task_skip, IMPROVEMENT_TEXT_MAX, IMPROVEMENT_STATUSES, IMPROVEMENT_SOURCES, ImprovementError, isImprovementsEnabled, getImprovement, listImprovements, createImprovement, approveAndSend, discardImprovement, improvementLeakHints, init_improvements, recomputeSessionCost, init_session_cost_recompute, canClaim, init_budget_admission, emitBudgetRefusalSideEffects, init_budget_refusal_notify, workflowModelErrors, init_model_validation, patchWorkflowDefinition, init_patch_definition, idempotencyKeyHeader, readIdempotencyKey, replayAcceptedOperation, init_idempotency_key, resolveScriptsOnlyMode, init_scripts_only_mode, ALL_CAPABILITIES, hasCapability, getEnabledCapabilities, createServer, init_server };
|