@desplega.ai/agent-swarm 2.9.1 → 2.11.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-weaaxey3.js +16 -0
- package/dist/{acp-targets-ny75x1qy.js → acp-targets-5wyy2b9m.js} +9 -9
- package/dist/{actions-b9qgrmeq.js → actions-4nxq386s.js} +54 -32
- package/dist/{agent-fs-provision-b5dhdsbd.js → agent-fs-provision-v6enh76w.js} +4 -4
- package/dist/{amp-adapter-vtax2c9s.js → amp-adapter-ze3x22qn.js} +3 -3
- package/dist/{anthropic-messages-r5xf5hqw.js → anthropic-messages-88b7s3n9.js} +189 -37
- package/dist/{app-g2z15hax.js → app-kyqt8ehw.js} +7 -6
- package/dist/{approval-notifications-yt13wp8r.js → approval-notifications-a0db0esw.js} +7 -6
- package/dist/{assistant-2cgfxsgk.js → assistant-9g5jzq25.js} +26 -25
- package/dist/{azure-openai-responses-590s1eea.js → azure-openai-responses-jeaas6x0.js} +18 -18
- package/dist/{boot-args-schema-3gwy0f60.js → boot-args-schema-d7fme4q1.js} +1 -1
- package/dist/{boot-reembed-92g7s5zp.js → boot-reembed-6wpazmpw.js} +1 -1
- package/dist/{boot-reembed-mywmyp4s.js → boot-reembed-jrwxeye2.js} +1 -1
- package/dist/boot-scrub-sweep-52h7yntp.js +9 -0
- package/dist/{boot-seeds-ce7rvgq1.js → boot-seeds-kb3dxjex.js} +4 -4
- package/dist/{boxd-wn235q80.js → boxd-jrrmkv3w.js} +2 -2
- package/dist/{claude-adapter-3m4q7735.js → claude-adapter-0c0y8fqp.js} +8 -8
- package/dist/{claude-managed-adapter-t8nfgcgz.js → claude-managed-adapter-w2es07qq.js} +4 -4
- package/dist/{claude-managed-setup-c217draw.js → claude-managed-setup-9ssb7ct4.js} +4 -4
- package/dist/{claude-sdk-session-7fbqm51z.js → claude-sdk-session-p6t0gyse.js} +10941 -10412
- package/dist/{cli-2czxfnvj.js → cli-075ccjh6.js} +961 -178
- package/dist/{cli-fkef327x.js → cli-0bgj4rh5.js} +3 -3
- package/dist/{cli-1jykg0py.js → cli-14xdms9a.js} +41 -28
- package/dist/{cli-rqx70rcz.js → cli-17qzb39j.js} +5 -2
- package/dist/{cli-bkjdknnp.js → cli-1h4njv9y.js} +177 -7
- package/dist/{cli-6ym4jhzp.js → cli-27fat7st.js} +7 -7
- package/dist/{cli-kxx4k2jw.js → cli-2aacfdcn.js} +5 -5
- package/dist/{cli-fh97xn30.js → cli-2gvdvsxj.js} +3 -3
- package/dist/{cli-f9gz2vyj.js → cli-2jtfm8kh.js} +10 -10
- package/dist/{cli-6ehs4mta.js → cli-2z2c4k6q.js} +18 -4
- package/dist/{cli-6237rnyr.js → cli-3bpr3wks.js} +1 -1
- package/dist/{cli-bnqncekd.js → cli-453497a0.js} +44 -17
- package/dist/{cli-jm0hvmz2.js → cli-4aswccje.js} +2 -2
- package/dist/{cli-4ymxrwg5.js → cli-4dyzzkfb.js} +2 -2
- package/dist/{cli-vyff45ve.js → cli-4g323fjh.js} +772 -515
- package/dist/{cli-3kd08rej.js → cli-4jjrhy48.js} +1 -1
- package/dist/{cli-gfy38pvt.js → cli-4kzp7r0q.js} +8 -8
- package/dist/{cli-kxn3747f.js → cli-4se3x6qm.js} +1 -26
- package/dist/{cli-mjw0yf82.js → cli-5ptj757f.js} +1 -1
- package/dist/{cli-pyjn0qhk.js → cli-6a3j25xd.js} +348 -196
- package/dist/{cli-hnamkvnc.js → cli-6c9ve77f.js} +2 -2
- package/dist/{cli-mw620q3n.js → cli-6n7y5ypy.js} +1 -1
- package/dist/{cli-g0vv9dg4.js → cli-6p8p2e6r.js} +19 -12
- package/dist/{cli-jwampxxq.js → cli-6tvh1fwq.js} +3 -3
- package/dist/{cli-p74md7t8.js → cli-7b7rxz22.js} +13 -15
- package/dist/{cli-5a6pqy45.js → cli-7e8sxqv5.js} +1 -1
- package/dist/{cli-p4kckx1z.js → cli-892y3vfp.js} +13 -13
- package/dist/cli-8mfdbdhe.js +43 -0
- package/dist/{cli-mkwkwq81.js → cli-8zmpwe79.js} +29 -16
- package/dist/{cli-zcfpsfzf.js → cli-96234j5w.js} +3 -3
- package/dist/{cli-1z4qggfe.js → cli-9fvk9mv8.js} +30 -21
- package/dist/{cli-7mv4h3sn.js → cli-9g12h1aq.js} +2 -2
- package/dist/{cli-f8x9drqr.js → cli-9knhkkgr.js} +19 -5
- package/dist/{cli-5mpy301f.js → cli-9t7syepg.js} +1 -1
- package/dist/{cli-qj39vrc6.js → cli-9yjhshah.js} +1 -1
- package/dist/{cli-zr6qy15y.js → cli-a02habn6.js} +427 -145
- package/dist/{cli-7evph51z.js → cli-a49frv85.js} +2 -2
- package/dist/{cli-h9yqfzx9.js → cli-a6q6x15h.js} +11 -10
- package/dist/{cli-bg63qmsx.js → cli-atm0hkes.js} +11 -11
- package/dist/{cli-m7zvgt57.js → cli-b82a13ga.js} +13 -13
- package/dist/{cli-7zm3b3f5.js → cli-bf0t77nf.js} +1 -1
- package/dist/{cli-2xv18ywz.js → cli-bmqp0ser.js} +2 -2
- package/dist/{cli-xag7btpe.js → cli-bq97k63w.js} +2 -2
- package/dist/{cli-pb2ay3sh.js → cli-cstggwq7.js} +5 -5
- package/dist/{cli-f3jyzq4g.js → cli-czvvnfr9.js} +3 -3
- package/dist/{cli-b6px1k1q.js → cli-dd2k2mcd.js} +1 -1
- package/dist/{cli-nafvvsp8.js → cli-djt6wmrc.js} +9 -9
- package/dist/{cli-tsa40663.js → cli-ebqx630g.js} +3 -3
- package/dist/{cli-8zh9nrew.js → cli-f7dhm7hh.js} +1 -1
- package/dist/cli-f8yhybxr.js +321 -0
- package/dist/{cli-5gpqgs8b.js → cli-fwjwkw66.js} +2 -2
- package/dist/{cli-gabsjg8x.js → cli-g56fxddf.js} +1 -1
- package/dist/{cli-w4n323t3.js → cli-h2qtafm4.js} +19 -19
- package/dist/{cli-psffsanb.js → cli-ha4ek2nb.js} +6 -1
- package/dist/{cli-dgs10ttj.js → cli-hnh8erra.js} +2 -2
- package/dist/{cli-w16kwbzw.js → cli-htymm48w.js} +1 -1
- package/dist/{cli-2xs8tsf7.js → cli-j2r1apqm.js} +152 -67
- package/dist/{cli-43ms35q9.js → cli-k3c13za2.js} +3 -3
- package/dist/{cli-54vrpgm0.js → cli-k3facve0.js} +8 -5
- package/dist/{cli-67mwzr35.js → cli-k4r5sfaj.js} +7 -7
- package/dist/{cli-rq5rpv6k.js → cli-kbm659dk.js} +2 -2
- package/dist/{cli-j7svy295.js → cli-m00c47q6.js} +114 -31
- package/dist/{cli-m7c2380k.js → cli-mhrr4d5b.js} +99 -14
- package/dist/{cli-xqdz5cqm.js → cli-mz7ycqn8.js} +1 -0
- package/dist/{cli-vt89089n.js → cli-n6ygvrrm.js} +4 -4
- package/dist/{cli-jaw5v1sy.js → cli-nbakg5xh.js} +3 -3
- package/dist/{cli-nbt14he0.js → cli-nc39ym5q.js} +8 -8
- package/dist/{cli-tvc4jag9.js → cli-p1a4khta.js} +8 -8
- package/dist/{cli-t9ga4qmb.js → cli-p8zqbbt1.js} +40 -33
- package/dist/{cli-fjggej24.js → cli-ph95yejc.js} +2 -2
- package/dist/{cli-m0cy2vyf.js → cli-q4z9s6zs.js} +5 -5
- package/dist/cli-q71g5q39.js +404 -0
- package/dist/{cli-vs9vdpy0.js → cli-qncx2r0s.js} +1 -1
- package/dist/{cli-hg42n3hx.js → cli-qrzq3hvg.js} +8 -8
- package/dist/{cli-x40a0w9j.js → cli-r813c7rb.js} +1 -1
- package/dist/{cli-kpgcm7xy.js → cli-ramn8jae.js} +1 -1
- package/dist/{cli-jkw6ptfw.js → cli-raqw9fw9.js} +28 -17
- package/dist/cli-rhsc2zyx.js +68 -0
- package/dist/{cli-sn650d7x.js → cli-rpmw4fsv.js} +68 -20
- package/dist/{boot-scrub-sweep-7dkdzqxx.js → cli-rwgwen5v.js} +9 -10
- package/dist/{cli-3j873zxq.js → cli-rytq7dm2.js} +261 -6
- package/dist/{cli-zh0e5x7p.js → cli-s9twe4x0.js} +71 -22
- package/dist/{cli-2dq9yv8p.js → cli-t2s7j5cy.js} +2 -2
- package/dist/{cli-wn13hhdt.js → cli-tb4j757d.js} +7 -7
- package/dist/{cli-q2d3e1k1.js → cli-thd3005a.js} +1 -1
- package/dist/cli-tsfkcd4v.js +30 -0
- package/dist/{cli-br0924pw.js → cli-v3zcnr8g.js} +1 -1
- package/dist/{cli-zfqg6fzn.js → cli-vbppqvte.js} +3 -3
- package/dist/{cli-ysvspf5e.js → cli-vy3fn0mz.js} +4 -4
- package/dist/{cli-7sf9sb0w.js → cli-w5dar1bk.js} +1 -1
- package/dist/{cli-2yjj3e31.js → cli-wz4e5am2.js} +12 -10
- package/dist/{cli-td9tb872.js → cli-xqbqwpxr.js} +14 -14
- package/dist/{cli-32djehja.js → cli-ynph3b70.js} +11137 -8332
- package/dist/{cli-mhapr559.js → cli-yvzxbztc.js} +9 -4
- package/dist/{cli-v57d7fmm.js → cli-yzxqwcvq.js} +25 -27
- package/dist/{cli-y2ewxhth.js → cli-zb1hff00.js} +16 -16
- package/dist/{cli-yab6sh8p.js → cli-zcghfsdg.js} +23 -4
- package/dist/{cli-ctx0b85j.js → cli-zhn4r1rz.js} +757 -157
- package/dist/{cli-6945ywhr.js → cli-zqq57pgx.js} +9 -7
- package/dist/cli.js +30 -29
- package/dist/{cloudflare-workers-ai-system-one-9y1zx3pt.js → cloudflare-workers-ai-system-one-w3m0fbf8.js} +2 -2
- package/dist/{codex-adapter-n656pvb8.js → codex-adapter-ssahg4h4.js} +8 -8
- package/dist/{codex-hook-59atdwd8.js → codex-hook-aqtj17yr.js} +1 -1
- package/dist/{codex-login-a239g1ah.js → codex-login-9c7aggxe.js} +1 -1
- package/dist/{codex-session-runner-p0fbv5y9.js → codex-session-runner-xn63q3h7.js} +9 -9
- package/dist/{commands-gwea8z5p.js → commands-ctey7tr5.js} +3 -3
- package/dist/{controller-t67c3grh.js → controller-rqhbppg9.js} +4 -4
- package/dist/{controllers-connect-ks155r0h.js → controllers-connect-w3qbpbt1.js} +22 -21
- package/dist/core-df1n049h.js +39 -0
- package/dist/{cursor-adapter-ygwrtmkv.js → cursor-adapter-r819hf1a.js} +2 -2
- package/dist/{db-kpmx06s9.js → db-2ah39cyx.js} +2 -2
- package/dist/{db-rb2xqdb1.js → db-p5drc1d1.js} +3 -3
- package/dist/{devin-adapter-zp4tqq53.js → devin-adapter-bc6g0x29.js} +1 -1
- package/dist/{dispatcher-31sm0ej2.js → dispatcher-x6w14pde.js} +19 -18
- package/dist/{docker-09tkkg0n.js → docker-6c4reetq.js} +51 -14
- package/dist/{dsh-adapter-qyxh0w31.js → dsh-adapter-h8qn14n4.js} +2 -2
- package/dist/{e2b-sm28k0k3.js → e2b-jg7kyyef.js} +6 -6
- package/dist/{e2b-3v1e745x.js → e2b-z4ec0qve.js} +3 -3
- package/dist/{easter-egg-3d-00wjscn6.js → easter-egg-3d-1y6r9gxy.js} +1 -1
- package/dist/{embedding-space-qhw4g68n.js → embedding-space-z6ptw3jk.js} +6 -6
- package/dist/{embeddings-zdv9ke6x.js → embeddings-0sxb1d2h.js} +1 -1
- package/dist/{event-bus-xr83x566.js → event-bus-swr88jg5.js} +1 -1
- package/dist/{execute-zna8wwr7.js → execute-6m1ex8ce.js} +8 -4
- package/dist/{external-channel-1ac6t56s.js → external-channel-ezer7pk0.js} +2 -2
- package/dist/fx-adapter-zwmps9re.js +19 -0
- package/dist/{google-generative-ai-maq6c9bf.js → google-generative-ai-sw77egmr.js} +13 -13
- package/dist/{google-vertex-2jgsw2nb.js → google-vertex-rrw93g8h.js} +13 -13
- package/dist/grok-adapter-q0avf919.js +19 -0
- package/dist/handlers-g5jq0e4q.js +36 -0
- package/dist/{heartbeat-2f6z4kdx.js → heartbeat-6c4fr49t.js} +22 -21
- package/dist/{hook-8y0gvtp1.js → hook-02rt5tvq.js} +8 -8
- package/dist/{hook-w1skzaqc.js → hook-t1c5avbv.js} +5 -5
- package/dist/{http-wghxvpef.js → http-qa3h32a1.js} +2659 -355
- package/dist/index-1f6m47mq.js +37 -0
- package/dist/index-1p1mpqda.js +36 -0
- package/dist/{index-rv89fvzf.js → index-akbgsdhh.js} +25 -24
- package/dist/{index-9zkchs9t.js → index-e42j998x.js} +190 -15
- package/dist/{index-b5wgnm78.js → index-kdmkfjt7.js} +4 -4
- package/dist/{index-s71ez27v.js → index-kqv9ebfj.js} +1 -1
- package/dist/{index-9myfj74s.js → index-kzdqn3dd.js} +3 -3
- package/dist/{index-4a0670yh.js → index-p2f5xg64.js} +6 -6
- package/dist/{index-8zn8nxn5.js → index-qpjk2hxk.js} +1 -1
- package/dist/index-tnkd410q.js +41 -0
- package/dist/k8s-7jrh5va2.js +276 -0
- package/dist/{keepalive-sh02349h.js → keepalive-jmf6pn8c.js} +4 -4
- package/dist/lead-m5e7xt93.js +75 -0
- package/dist/{llama-cpp-classify-nfgswa1m.js → llama-cpp-classify-yvb8vh7w.js} +2 -2
- package/dist/{maintenance-yj0dcjja.js → maintenance-g7v15tj1.js} +1 -1
- package/dist/{mistral-conversations-0c30em7t.js → mistral-conversations-w4bncwbt.js} +11 -11
- package/dist/{node-7qsx5kvm.js → node-z67yjre7.js} +19 -13
- package/dist/{oauth-refresh-sweep-d9xedk66.js → oauth-refresh-sweep-ywgf8tbr.js} +3 -3
- package/dist/{onboard-dpgjn03r.js → onboard-m3fedypq.js} +6 -6
- package/dist/{openai-codex-responses-bkcd8pjj.js → openai-codex-responses-70g39cgz.js} +24 -18
- package/dist/{openai-completions-f3n69rep.js → openai-completions-cv3hp4h5.js} +33 -26
- package/dist/{openai-decisions-q3hh60wr.js → openai-decisions-fyq1p9f9.js} +2 -2
- package/dist/{openai-responses-gbh0wfqe.js → openai-responses-trsvnks6.js} +24 -22
- package/dist/{opencode-adapter-2d31cpjc.js → opencode-adapter-19ktcbb9.js} +7 -7
- package/dist/{openrouter-images-xr9gme9x.js → openrouter-images-0jj12a2q.js} +6 -6
- package/dist/{otel-impl-1skarpfq.js → otel-impl-3ehm1hgc.js} +2 -2
- package/dist/{pending-bfmxtx0g.js → pending-fwj2fatd.js} +20 -19
- package/dist/{pi-messages-zebyt7gb.js → pi-messages-zk3g4esn.js} +6 -6
- package/dist/{pi-mono-adapter-gvppnasy.js → pi-mono-adapter-xdeesvc4.js} +18 -17
- package/dist/{pricing-refresh-c6b325mk.js → pricing-refresh-4j8dzvxg.js} +2 -2
- package/dist/{rbac-roles-h80qbdbs.js → rbac-roles-8msjr07m.js} +3 -3
- package/dist/{rbac-roles-zfcx68tx.js → rbac-roles-n7t2acv8.js} +2 -2
- package/dist/{render-v2-nx20t3rb.js → render-v2-j7qggj8h.js} +7 -6
- package/dist/{resume-5ep8agan.js → resume-hj1mn65y.js} +9 -8
- package/dist/{runtime-r3pj4mce.js → runtime-z31mdsgv.js} +2 -2
- package/dist/{session-access-n7p3m15b.js → session-access-w38fh09a.js} +4 -4
- package/dist/{session-source-backfill-v8mt0zwn.js → session-source-backfill-ax6qxv20.js} +3 -3
- package/dist/{setup-z1psaqhe.js → setup-dsqmpfcr.js} +1 -1
- package/dist/thread-buffer-nf55vwx3.js +39 -0
- package/dist/tree-visibility-6vqmnr71.js +24 -0
- package/dist/{typesafe-system-one-f2en2knd.js → typesafe-system-one-qkvkgrcz.js} +2 -2
- package/dist/user-merge-jobs-mvheb3ed.js +22 -0
- package/dist/{virtual-modules-rrbjdpxn.js → virtual-modules-w2qk2wew.js} +32 -10
- package/dist/{work-objects-4aghh73z.js → work-objects-4ahy5es5.js} +22 -21
- package/dist/worker-ews1nyhw.js +75 -0
- package/dist/{worker-follow-up-166zmex1.js → worker-follow-up-1gs4aw7y.js} +19 -18
- package/dist/{x-wg164ss9.js → x-3wr8c5sh.js} +2 -2
- package/openapi.json +2576 -388
- package/package.json +11 -10
- 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/request-composition.ts +190 -0
- package/src/be/db/runtime.ts +15 -0
- package/src/be/db/session-costs.ts +8 -2
- package/src/be/db/slack-trees.ts +220 -10
- package/src/be/db/tasks/human-free.ts +3 -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/workflow-run-retention.ts +101 -0
- package/src/be/db-client.ts +93 -20
- package/src/be/db-retention-defaults.ts +46 -0
- package/src/be/db-retention.ts +55 -6
- package/src/be/db.ts +32 -57
- package/src/be/key-window-usage.ts +1 -0
- package/src/be/mcp-events/catalog.ts +108 -0
- package/src/be/mcp-events/dispatcher.ts +202 -0
- package/src/be/mcp-events/protocol.ts +296 -0
- package/src/be/mcp-events/store.ts +231 -0
- package/src/be/mcp-events/webhook.ts +226 -0
- package/src/be/memory/demotion-evidence.ts +34 -0
- package/src/be/memory/providers/sqlite-store.ts +110 -24
- package/src/be/memory/reranker.ts +34 -12
- package/src/be/memory/review-recall-filter.ts +105 -0
- package/src/be/memory/search-candidates.ts +16 -5
- package/src/be/memory/types.ts +16 -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/migrations/322_runtime_pool_workspace.sql +8 -0
- package/src/be/migrations/323_slack_task_tree_visibility.sql +9 -0
- package/src/be/migrations/326_slack_reconcile_pages.sql +13 -0
- package/src/be/migrations/327_mcp_event_subscriptions.sql +57 -0
- package/src/be/migrations/329_workflow_run_retention.sql +9 -0
- package/src/be/migrations/330_request_composition.sql +22 -0
- package/src/be/model-profile-check.ts +1 -1
- package/src/be/multi-runtime.ts +32 -4
- package/src/be/pricing-normalize.ts +2 -0
- package/src/be/rbac-roles.ts +6 -4
- package/src/be/runtime-pools/controllers.ts +18 -3
- package/src/be/runtime-pools/db.ts +35 -9
- package/src/be/runtime-pools/supervisor.ts +57 -3
- 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 +44 -2
- 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/context-preamble.ts +11 -4
- package/src/commands/credential-outcome-report.ts +33 -9
- package/src/commands/e2b-stack-wizard.tsx +12 -6
- package/src/commands/onboard/agent-fs-version.ts +1 -1
- package/src/commands/onboard/compose-generator.ts +1 -1
- package/src/commands/onboard/env-generator.ts +1 -1
- package/src/commands/provider-credentials.ts +1 -1
- package/src/commands/runner.ts +116 -12
- package/src/extensions/catalog.generated.json +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/app.ts +59 -14
- package/src/github/handlers.ts +57 -0
- package/src/github/types.ts +4 -0
- package/src/http/all-routes.ts +4 -0
- package/src/http/approval-requests.ts +5 -1
- package/src/http/auth.ts +3 -1
- package/src/http/config.ts +36 -2
- package/src/http/core.ts +2 -0
- package/src/http/github-token.ts +66 -0
- package/src/http/index.ts +34 -0
- package/src/http/mcp-user.ts +11 -8
- package/src/http/mcp.ts +58 -42
- 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/prompt-templates.ts +1 -0
- package/src/http/request-composition.ts +310 -0
- package/src/http/tasks.ts +46 -6
- package/src/http/tool-hooks.ts +140 -0
- package/src/http/tool-schema-estimate.ts +95 -0
- package/src/http/users.ts +142 -19
- package/src/http/workflows.ts +37 -1
- package/src/integrations/chat-sdk/inbound.ts +8 -2
- package/src/integrations/chat-sdk/limits.ts +8 -3
- package/src/prompts/base-prompt.ts +133 -7
- package/src/prompts/resolver.ts +41 -2
- package/src/providers/acp-targets.ts +2 -2
- package/src/providers/amp-adapter.ts +1 -1
- package/src/providers/opencode-adapter.ts +72 -1
- package/src/providers/opencode-swarm-plugin.ts +22 -3
- package/src/providers/pi-mono-adapter.ts +1 -0
- package/src/providers/pi-mono-extension.ts +71 -0
- package/src/providers/pricing-sources.md +13 -0
- package/src/providers/request-composition-hook.ts +312 -0
- package/src/providers/types.ts +5 -0
- package/src/rbac/legacy-policy.ts +1 -0
- package/src/rbac/permissions.ts +5 -0
- package/src/runtime-providers/controller-protocol.ts +7 -0
- package/src/runtime-providers/docker.ts +80 -12
- package/src/runtime-providers/index.ts +7 -5
- package/src/runtime-providers/k8s.ts +355 -0
- package/src/runtime-providers/types.ts +17 -0
- package/src/scheduler/scheduler.ts +1 -1
- 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/server-user.ts +16 -1
- package/src/slack/ack.ts +10 -5
- package/src/slack/actions.ts +36 -13
- package/src/slack/app.ts +2 -0
- package/src/slack/assistant.ts +4 -4
- package/src/slack/blocks.ts +26 -5
- package/src/slack/handlers.ts +3 -3
- package/src/slack/reaction-shortcode.ts +23 -2
- package/src/slack/render-v2.ts +344 -200
- package/src/slack/responses.ts +7 -5
- package/src/slack/thread-buffer.ts +3 -3
- package/src/slack/tree-visibility.ts +64 -0
- package/src/tasks/worker-follow-up.ts +127 -17
- package/src/tests/acp-adapter.test.ts +26 -0
- package/src/tests/azure-devops-outbound.test.ts +47 -14
- package/src/tests/base-prompt.test.ts +149 -1
- package/src/tests/chat-sdk-relay.test.ts +21 -1
- package/src/tests/check-playwright-version.test.ts +33 -0
- package/src/tests/check-pr-body.test.ts +43 -0
- package/src/tests/context-preamble-budget.test.ts +65 -0
- package/src/tests/credential-check.test.ts +14 -6
- package/src/tests/credential-outcome-report.test.ts +81 -1
- package/src/tests/db-client.test.ts +168 -0
- package/src/tests/db-retention-defaults.test.ts +244 -0
- package/src/tests/db-retention.test.ts +2 -1
- package/src/tests/db-runtime.test.ts +2 -1
- package/src/tests/deploy-guard.test.ts +7 -7
- package/src/tests/deploy-release-dispatch.test.ts +332 -0
- package/src/tests/deploy-select.test.ts +83 -0
- package/src/tests/dreaming-gather-corrections.test.ts +467 -0
- package/src/tests/e2b-stack-wizard.test.tsx +156 -0
- package/src/tests/entrypoint-chown-no-follow.test.ts +69 -0
- package/src/tests/entrypoint-repo-clone-target.test.ts +112 -0
- package/src/tests/env-flag.test.ts +4 -2
- package/src/tests/event-loop-lag.test.ts +16 -20
- package/src/tests/extensions-example-slack-reply-gate.test.ts +15 -0
- package/src/tests/fixtures/base-prompt-baseline-cases.ts +78 -0
- package/src/tests/fixtures/base-prompt-baseline.json +18 -0
- 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-app-worker-auth-helper.test.ts +325 -0
- package/src/tests/github-event-filter.test.ts +8 -0
- package/src/tests/github-handlers-inline-comments.test.ts +2 -0
- package/src/tests/github-handlers-reactions.test.ts +4 -0
- package/src/tests/github-handlers.test.ts +3 -0
- package/src/tests/github-installation-token-route.test.ts +199 -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/mcp-user-events.test.ts +708 -0
- package/src/tests/memory-key-paths.test.ts +4 -1
- package/src/tests/memory-rater-store.test.ts +35 -1
- package/src/tests/memory-reranker.test.ts +39 -4
- package/src/tests/memory-review-recall-filter.test.ts +205 -0
- package/src/tests/memory-search-stall.test.ts +421 -0
- package/src/tests/migration-318-superseded-workflow-cut-backfill.test.ts +74 -0
- package/src/tests/migration-322-runtime-pool-workspace.test.ts +116 -0
- package/src/tests/migration-329-workflow-run-retention.test.ts +32 -0
- package/src/tests/model-groups-api.test.ts +415 -0
- package/src/tests/model-profile-fallbacks.test.ts +236 -2
- package/src/tests/model-profiles-api.test.ts +1 -0
- package/src/tests/opencode-adapter.test.ts +86 -0
- package/src/tests/operator-granted-credentials.test.ts +7 -2
- package/src/tests/operator-granted-role-wire.test.ts +2 -1
- package/src/tests/pi-mono-extension.test.ts +168 -0
- package/src/tests/preload-env.test.ts +61 -1
- package/src/tests/preload.ts +22 -0
- package/src/tests/prompt-template-resolver.test.ts +85 -0
- package/src/tests/rbac-engine.test.ts +1 -0
- package/src/tests/reload-config.test.ts +45 -0
- package/src/tests/request-composition.test.ts +447 -0
- package/src/tests/runner-max-concurrent.test.ts +86 -0
- package/src/tests/runtime-k8s-pools.test.ts +142 -0
- package/src/tests/runtime-pools-db.test.ts +122 -2
- package/src/tests/runtime-pools-http.test.ts +47 -2
- package/src/tests/runtime-provider-registration.test.ts +13 -14
- package/src/tests/runtime-providers-docker.test.ts +192 -1
- package/src/tests/runtime-providers-k8s.test.ts +430 -0
- package/src/tests/runtime-remote-controller.test.ts +64 -1
- package/src/tests/runtime-supervisor.test.ts +101 -0
- package/src/tests/script-connections.test.ts +21 -1
- package/src/tests/short-id.test.ts +23 -0
- package/src/tests/slack-blocks.test.ts +87 -0
- package/src/tests/slack-empty-icon-config.test.ts +113 -0
- package/src/tests/slack-reaction-config.test.ts +38 -2
- package/src/tests/slack-render-v2-query-plans.test.ts +100 -1
- package/src/tests/slack-render-v2-reconcile.test.ts +75 -4
- package/src/tests/slack-render-v2.test.ts +737 -11
- package/src/tests/spec-base-url.test.ts +13 -1
- package/src/tests/swarm-config-reserved-keys.test.ts +1 -0
- package/src/tests/system-one-decide-session-cost.test.ts +196 -0
- package/src/tests/task-session-prompts.test.ts +37 -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 +348 -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/webhook-filter.test.ts +327 -0
- package/src/tests/workflow-agent-task-retry.test.ts +62 -0
- package/src/tests/workflow-async-v2.test.ts +19 -16
- package/src/tests/workflow-definition-telemetry.test.ts +15 -5
- package/src/tests/workflow-e2e.test.ts +1 -9
- package/src/tests/workflow-finalization-races.test.ts +553 -0
- package/src/tests/workflow-foreach-supersede-retry.test.ts +10 -0
- package/src/tests/workflow-foreach.test.ts +2 -0
- package/src/tests/workflow-hitl-routing.test.ts +26 -20
- package/src/tests/workflow-http-v2.test.ts +132 -2
- package/src/tests/workflow-idempotency.test.ts +41 -0
- package/src/tests/workflow-mcp-webhook-filter.test.ts +214 -0
- package/src/tests/workflow-parallel-park.test.ts +297 -0
- package/src/tests/workflow-replay.test.ts +10 -1
- package/src/tests/workflow-retry-v2.test.ts +57 -21
- package/src/tests/workflow-retry-validation.test.ts +13 -13
- package/src/tests/workflow-runs-retention.test.ts +533 -0
- package/src/tests/workflow-script-principal.test.ts +7 -2
- package/src/tests/workflow-tla-races.test.ts +7 -2
- package/src/tests/workflow-triggers-v2.test.ts +329 -0
- package/src/tests/workflow-wait-builtin-events.test.ts +3 -1
- package/src/tests/workflow-wait-event.test.ts +137 -3
- package/src/tests/workflow-wait-poller.test.ts +94 -0
- package/src/tests/workflow-wait-time.test.ts +7 -3
- package/src/tests/workflow-wait.test.ts +26 -0
- package/src/tests/workflow-wait.ts +44 -0
- 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 +7 -1
- package/src/tools/workflows/update-workflow.ts +8 -2
- package/src/types.ts +284 -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/credentials.ts +7 -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/checkpoint.ts +18 -0
- package/src/workflows/engine.ts +38 -10
- package/src/workflows/executors/system-one-decision.ts +2 -2
- package/src/workflows/foreach-driver.ts +42 -4
- package/src/workflows/recovery.ts +6 -1
- package/src/workflows/resume.ts +14 -5
- package/src/workflows/retry-poller.ts +17 -4
- package/src/workflows/successor-routing.ts +108 -0
- package/src/workflows/task-step-routing.ts +35 -12
- package/src/workflows/triggers.ts +25 -8
- package/src/workflows/wait-poller.ts +6 -2
- package/src/workflows/webhook-filter.ts +203 -0
- package/templates/extensions/manifest.schema.json +13 -0
- package/templates/extensions/slack-reply-gate/hooks.ts +8 -4
- package/templates/skills/swarm-docs/content.md +4 -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/fx-adapter-sk7n0fzc.js +0 -19
- package/dist/grok-adapter-sjbcm5ew.js +0 -19
- package/dist/handlers-yzy0c87x.js +0 -35
- package/dist/index-25pvya7q.js +0 -40
- 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/{node-dqm4xgxw.js → node-2wfcey7d.js} +0 -0
|
@@ -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,10 +170,13 @@ 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,
|
|
166
178
|
init_model_validation2,
|
|
179
|
+
configPools,
|
|
167
180
|
checkProfileForAgent,
|
|
168
181
|
init_model_profile_check,
|
|
169
182
|
rowToAgentTask,
|
|
@@ -194,6 +207,7 @@ import {
|
|
|
194
207
|
countAgentDispatchesInThread2,
|
|
195
208
|
findRecentCancelledTaskInThread2,
|
|
196
209
|
init_read,
|
|
210
|
+
hasUnreadableCredentialAllowlist,
|
|
197
211
|
listModelProfiles,
|
|
198
212
|
getModelProfileByName,
|
|
199
213
|
modelProfileRefError,
|
|
@@ -206,6 +220,8 @@ import {
|
|
|
206
220
|
carryUnhandledSteering,
|
|
207
221
|
requestSteering,
|
|
208
222
|
init_steering2,
|
|
223
|
+
onTaskStarted,
|
|
224
|
+
init_task_lifecycle_events,
|
|
209
225
|
computeContentHash2,
|
|
210
226
|
getContextVersion2,
|
|
211
227
|
getContextVersionHistory2,
|
|
@@ -213,8 +229,6 @@ import {
|
|
|
213
229
|
assertAssetKeyMovesAllowed2,
|
|
214
230
|
moveSessionChains,
|
|
215
231
|
init_session_moves,
|
|
216
|
-
onTaskStarted,
|
|
217
|
-
init_task_lifecycle_events,
|
|
218
232
|
getPendingTaskForAgent2,
|
|
219
233
|
startTask2,
|
|
220
234
|
updateTaskClaudeSessionId2,
|
|
@@ -362,6 +376,7 @@ import {
|
|
|
362
376
|
installMcpServer2,
|
|
363
377
|
uninstallMcpServer2,
|
|
364
378
|
getAgentMcpServers2,
|
|
379
|
+
getAvailableKeyIndices2,
|
|
365
380
|
getUserById2,
|
|
366
381
|
getAllUsers2,
|
|
367
382
|
createUser2,
|
|
@@ -369,6 +384,7 @@ import {
|
|
|
369
384
|
deleteUser2,
|
|
370
385
|
getRootTaskChain2,
|
|
371
386
|
getBudget2,
|
|
387
|
+
getActivePricingRow2,
|
|
372
388
|
getDailySpendForAgent2,
|
|
373
389
|
getDailySpendGlobal2,
|
|
374
390
|
getDailySpendForUser2,
|
|
@@ -387,27 +403,27 @@ import {
|
|
|
387
403
|
recordInlineScriptRun2,
|
|
388
404
|
exports_db,
|
|
389
405
|
init_db4
|
|
390
|
-
} from "./cli-
|
|
406
|
+
} from "./cli-zhn4r1rz.js";
|
|
391
407
|
import {
|
|
392
408
|
assertMayActOnOperatorGrantedTarget2,
|
|
393
409
|
getUserGrant2,
|
|
394
410
|
init_rbac_roles
|
|
395
|
-
} from "./cli-
|
|
411
|
+
} from "./cli-cstggwq7.js";
|
|
396
412
|
import {
|
|
397
413
|
ensurePricingSeeded2,
|
|
398
414
|
ensureRbacSeeded2,
|
|
399
415
|
ensureModelProfilesSeeded2,
|
|
400
416
|
init_boot_seeds
|
|
401
|
-
} from "./cli-
|
|
417
|
+
} from "./cli-f8yhybxr.js";
|
|
402
418
|
import {
|
|
403
419
|
requestModelCatalogRefresh2,
|
|
404
420
|
startPricingRefreshLoop2,
|
|
405
421
|
init_pricing_refresh
|
|
406
|
-
} from "./cli-
|
|
422
|
+
} from "./cli-hnh8erra.js";
|
|
407
423
|
import {
|
|
408
424
|
workflowEventBus2,
|
|
409
425
|
init_event_bus
|
|
410
|
-
} from "./cli-
|
|
426
|
+
} from "./cli-thd3005a.js";
|
|
411
427
|
import {
|
|
412
428
|
slackCode,
|
|
413
429
|
slackMissingScopeMessage,
|
|
@@ -416,7 +432,7 @@ import {
|
|
|
416
432
|
externalChannelToolError2,
|
|
417
433
|
getChannelBlockReason2,
|
|
418
434
|
init_external_channel
|
|
419
|
-
} from "./cli-
|
|
435
|
+
} from "./cli-bq97k63w.js";
|
|
420
436
|
import {
|
|
421
437
|
tableToAscii2,
|
|
422
438
|
init_dist8
|
|
@@ -452,14 +468,19 @@ import {
|
|
|
452
468
|
init_task_citations2,
|
|
453
469
|
getTaskUiSpec,
|
|
454
470
|
upsertTaskUiSpec,
|
|
471
|
+
acquireTaskUiScriptActionRun,
|
|
472
|
+
finishTaskUiScriptActionRun,
|
|
455
473
|
hasTaskUiSpecCheckRefusal,
|
|
456
474
|
init_task_ui_spec,
|
|
457
475
|
standardComponentDefinitions,
|
|
458
476
|
CardSpecError,
|
|
459
477
|
toCard,
|
|
460
478
|
init_dist5,
|
|
479
|
+
UI_SPEC_MAX_ACTIONS,
|
|
480
|
+
TASK_UI_SPEC_UPDATED_EVENT,
|
|
461
481
|
UI_SPEC_ACTION_ID,
|
|
462
482
|
UI_SPEC_CARD_LIMITS,
|
|
483
|
+
UI_SPEC_SCRIPT_ARGS_MAX_BYTES,
|
|
463
484
|
init_task_ui_spec2,
|
|
464
485
|
validateTaskUiSpec,
|
|
465
486
|
init_validate2,
|
|
@@ -473,8 +494,8 @@ import {
|
|
|
473
494
|
getSlackApp2,
|
|
474
495
|
startSlackApp2,
|
|
475
496
|
stopSlackAppUnderLifecycleLock2,
|
|
476
|
-
|
|
477
|
-
} from "./cli-
|
|
497
|
+
init_app4
|
|
498
|
+
} from "./cli-6a3j25xd.js";
|
|
478
499
|
import {
|
|
479
500
|
AGENT_MAX_TASKS_CONFIG_KEY,
|
|
480
501
|
resetAgentMaxTasksMirror,
|
|
@@ -495,7 +516,7 @@ import {
|
|
|
495
516
|
postApprovalCancellationUpdates2,
|
|
496
517
|
createApprovalFollowUpTask2,
|
|
497
518
|
init_approval_notifications
|
|
498
|
-
} from "./cli-
|
|
519
|
+
} from "./cli-raqw9fw9.js";
|
|
499
520
|
import {
|
|
500
521
|
shapeApprovalResolution,
|
|
501
522
|
init_approval_resolution,
|
|
@@ -519,7 +540,7 @@ import {
|
|
|
519
540
|
resumeFromChildRun2,
|
|
520
541
|
initWaitBusSubscriptions2,
|
|
521
542
|
init_resume
|
|
522
|
-
} from "./cli-
|
|
543
|
+
} from "./cli-14xdms9a.js";
|
|
523
544
|
import {
|
|
524
545
|
FilesError,
|
|
525
546
|
providerPath,
|
|
@@ -533,7 +554,7 @@ import {
|
|
|
533
554
|
import {
|
|
534
555
|
getRuntimePool2,
|
|
535
556
|
init_db2
|
|
536
|
-
} from "./cli-
|
|
557
|
+
} from "./cli-8zmpwe79.js";
|
|
537
558
|
import {
|
|
538
559
|
duplicateGuardedQueryKey,
|
|
539
560
|
parseQueryParams,
|
|
@@ -569,21 +590,17 @@ import {
|
|
|
569
590
|
findRoute,
|
|
570
591
|
route,
|
|
571
592
|
init_route_def
|
|
572
|
-
} from "./cli-
|
|
593
|
+
} from "./cli-nc39ym5q.js";
|
|
573
594
|
import {
|
|
574
595
|
COMPOSIO_HTTP_METHODS,
|
|
575
596
|
executeComposioRequest,
|
|
576
597
|
composioArgsFromParts,
|
|
577
598
|
init_composio
|
|
578
|
-
} from "./cli-
|
|
599
|
+
} from "./cli-bf0t77nf.js";
|
|
579
600
|
import {
|
|
580
601
|
object,
|
|
581
602
|
init_v4_mini
|
|
582
|
-
} from "./cli-
|
|
583
|
-
import {
|
|
584
|
-
addMinutes,
|
|
585
|
-
init_date_fns
|
|
586
|
-
} from "./cli-wqb4sdt1.js";
|
|
603
|
+
} from "./cli-vbppqvte.js";
|
|
587
604
|
import {
|
|
588
605
|
getMemoryRaterNames,
|
|
589
606
|
init_memory_raters,
|
|
@@ -592,7 +609,11 @@ import {
|
|
|
592
609
|
init_types2,
|
|
593
610
|
LlmRater,
|
|
594
611
|
init_llm
|
|
595
|
-
} from "./cli-
|
|
612
|
+
} from "./cli-bmqp0ser.js";
|
|
613
|
+
import {
|
|
614
|
+
addMinutes,
|
|
615
|
+
init_date_fns
|
|
616
|
+
} from "./cli-wqb4sdt1.js";
|
|
596
617
|
import {
|
|
597
618
|
require_dist,
|
|
598
619
|
ConnectionAuthInputSchema,
|
|
@@ -671,7 +692,7 @@ import {
|
|
|
671
692
|
init_typecheck,
|
|
672
693
|
parseSkillContent,
|
|
673
694
|
init_skill_parser
|
|
674
|
-
} from "./cli-
|
|
695
|
+
} from "./cli-wz4e5am2.js";
|
|
675
696
|
import {
|
|
676
697
|
detachedProcessGroup,
|
|
677
698
|
registerProcessGroup,
|
|
@@ -686,24 +707,16 @@ import {
|
|
|
686
707
|
ensureToken,
|
|
687
708
|
ensureTokenOrThrow,
|
|
688
709
|
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";
|
|
710
|
+
} from "./cli-4aswccje.js";
|
|
701
711
|
import {
|
|
702
712
|
SLACK_LEAVE_THREAD_DISABLE,
|
|
703
713
|
isSlackLeaveThreadDisabled,
|
|
704
714
|
leaveSlackThread,
|
|
705
715
|
init_left_threads
|
|
706
|
-
} from "./cli-
|
|
716
|
+
} from "./cli-v3zcnr8g.js";
|
|
717
|
+
import {
|
|
718
|
+
require_fast_deep_equal
|
|
719
|
+
} from "./cli-bhp11egn.js";
|
|
707
720
|
import {
|
|
708
721
|
notifyAutomationPreflightFailure,
|
|
709
722
|
init_automation_preflight_alert,
|
|
@@ -728,6 +741,7 @@ import {
|
|
|
728
741
|
SystemOneDecisionConfigSchema,
|
|
729
742
|
SystemOneDecisionExecutor,
|
|
730
743
|
init_system_one_decision,
|
|
744
|
+
adoptStoredContext,
|
|
731
745
|
checkpointStep,
|
|
732
746
|
checkpointStepFailure,
|
|
733
747
|
checkpointStepWaiting,
|
|
@@ -746,6 +760,8 @@ import {
|
|
|
746
760
|
workflowSaveWarnings,
|
|
747
761
|
withSaveWarnings,
|
|
748
762
|
init_readiness,
|
|
763
|
+
hasOwedSuccessors,
|
|
764
|
+
init_successor_routing,
|
|
749
765
|
init_template,
|
|
750
766
|
runStepValidation,
|
|
751
767
|
init_validation,
|
|
@@ -778,11 +794,19 @@ import {
|
|
|
778
794
|
validateDefinition,
|
|
779
795
|
applyDefinitionPatch,
|
|
780
796
|
init_definition2
|
|
781
|
-
} from "./cli-
|
|
797
|
+
} from "./cli-m00c47q6.js";
|
|
782
798
|
import {
|
|
783
799
|
isMultiRuntimeEnabled,
|
|
784
800
|
init_multi_runtime2
|
|
785
801
|
} from "./cli-mdb054w3.js";
|
|
802
|
+
import {
|
|
803
|
+
ZodFirstPartyTypeKind,
|
|
804
|
+
objectType,
|
|
805
|
+
init_v3
|
|
806
|
+
} from "./cli-ytyvpye5.js";
|
|
807
|
+
import {
|
|
808
|
+
init_v4
|
|
809
|
+
} from "./cli-4jjrhy48.js";
|
|
786
810
|
import {
|
|
787
811
|
require_dist2
|
|
788
812
|
} from "./cli-xf1wn5ns.js";
|
|
@@ -793,11 +817,11 @@ import {
|
|
|
793
817
|
import {
|
|
794
818
|
canProvisionKind,
|
|
795
819
|
init_runtime_providers
|
|
796
|
-
} from "./cli-
|
|
820
|
+
} from "./cli-zqq57pgx.js";
|
|
797
821
|
import {
|
|
798
822
|
publicEndpointSsrfOptions,
|
|
799
823
|
init_mcp_wrapper
|
|
800
|
-
} from "./cli-
|
|
824
|
+
} from "./cli-t2s7j5cy.js";
|
|
801
825
|
import {
|
|
802
826
|
findUserById,
|
|
803
827
|
findUserByExternalId,
|
|
@@ -812,7 +836,20 @@ import {
|
|
|
812
836
|
resolveSessionToken,
|
|
813
837
|
fingerprintApiKey,
|
|
814
838
|
init_users
|
|
815
|
-
} from "./cli-
|
|
839
|
+
} from "./cli-yzxqwcvq.js";
|
|
840
|
+
import {
|
|
841
|
+
resolveGitHubHost,
|
|
842
|
+
getGitHubLinkConfig,
|
|
843
|
+
getGitHubGraphqlUrl,
|
|
844
|
+
githubApiUrl,
|
|
845
|
+
init_github_host
|
|
846
|
+
} from "./cli-9ttx00s3.js";
|
|
847
|
+
import {
|
|
848
|
+
AMP_ESTIMATE_MODELS,
|
|
849
|
+
ampBillsCacheWrites,
|
|
850
|
+
resolveAmpModel,
|
|
851
|
+
init_amp_models
|
|
852
|
+
} from "./cli-5ptj757f.js";
|
|
816
853
|
import {
|
|
817
854
|
normalizeAssetKey,
|
|
818
855
|
defaultAssetKey,
|
|
@@ -865,6 +902,8 @@ import {
|
|
|
865
902
|
SUPERSEDED_WORKFLOW_TASK_REASON,
|
|
866
903
|
WorkflowDefinitionSchema,
|
|
867
904
|
WorkflowNodePatchSchema,
|
|
905
|
+
WEBHOOK_FILTER_PRESETS,
|
|
906
|
+
WebhookDeliveryFilterSchema,
|
|
868
907
|
TriggerConfigSchema,
|
|
869
908
|
CooldownConfigSchema,
|
|
870
909
|
InputValueSchema,
|
|
@@ -884,14 +923,7 @@ import {
|
|
|
884
923
|
KvNamespaceSchema,
|
|
885
924
|
KvKeySchema,
|
|
886
925
|
init_types5
|
|
887
|
-
} from "./cli-
|
|
888
|
-
import {
|
|
889
|
-
resolveGitHubHost,
|
|
890
|
-
getGitHubLinkConfig,
|
|
891
|
-
getGitHubGraphqlUrl,
|
|
892
|
-
githubApiUrl,
|
|
893
|
-
init_github_host
|
|
894
|
-
} from "./cli-9ttx00s3.js";
|
|
926
|
+
} from "./cli-1h4njv9y.js";
|
|
895
927
|
import {
|
|
896
928
|
generateDefaultClaudeMd2,
|
|
897
929
|
generateDefaultSoulMd2,
|
|
@@ -902,20 +934,25 @@ import {
|
|
|
902
934
|
init_task_attachment_links,
|
|
903
935
|
contentSha256,
|
|
904
936
|
init_profile_sync
|
|
905
|
-
} from "./cli-
|
|
937
|
+
} from "./cli-mhrr4d5b.js";
|
|
938
|
+
import {
|
|
939
|
+
isSteeringEnabled2,
|
|
940
|
+
init_steering_enabled
|
|
941
|
+
} from "./cli-4sydckyj.js";
|
|
906
942
|
import {
|
|
907
943
|
getSlackConfiguration,
|
|
908
944
|
isSlackConfigured,
|
|
909
945
|
init_config4
|
|
910
946
|
} from "./cli-eetzmsy5.js";
|
|
911
947
|
import {
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
948
|
+
modelFamilyOf,
|
|
949
|
+
windowForModelFamily,
|
|
950
|
+
init_model_rate_limit_windows,
|
|
951
|
+
keySuffix,
|
|
952
|
+
splitCredentialPool,
|
|
916
953
|
selectCredential,
|
|
917
954
|
init_credentials2
|
|
918
|
-
} from "./cli-
|
|
955
|
+
} from "./cli-ha4ek2nb.js";
|
|
919
956
|
import {
|
|
920
957
|
findInterpolationTokens,
|
|
921
958
|
interpolate,
|
|
@@ -925,12 +962,12 @@ import {
|
|
|
925
962
|
init_registry3,
|
|
926
963
|
resolveTemplate,
|
|
927
964
|
init_resolver
|
|
928
|
-
} from "./cli-
|
|
965
|
+
} from "./cli-2z2c4k6q.js";
|
|
929
966
|
import {
|
|
930
967
|
init_zod
|
|
931
|
-
} from "./cli-
|
|
968
|
+
} from "./cli-96234j5w.js";
|
|
932
969
|
import {
|
|
933
|
-
|
|
970
|
+
safeParse2,
|
|
934
971
|
safeParseAsync,
|
|
935
972
|
toJSONSchema,
|
|
936
973
|
string2,
|
|
@@ -956,7 +993,7 @@ import {
|
|
|
956
993
|
ZodIssueCode,
|
|
957
994
|
datetime,
|
|
958
995
|
number3
|
|
959
|
-
} from "./cli-
|
|
996
|
+
} from "./cli-qrzq3hvg.js";
|
|
960
997
|
import {
|
|
961
998
|
MAX_PROFILE_FILE_LENGTH,
|
|
962
999
|
getConfiguredAppUrls,
|
|
@@ -978,7 +1015,7 @@ import {
|
|
|
978
1015
|
import {
|
|
979
1016
|
init_package,
|
|
980
1017
|
package_default
|
|
981
|
-
} from "./cli-
|
|
1018
|
+
} from "./cli-a6q6x15h.js";
|
|
982
1019
|
import {
|
|
983
1020
|
getNodeEnv,
|
|
984
1021
|
isDevOrTestNodeEnv,
|
|
@@ -998,7 +1035,7 @@ import {
|
|
|
998
1035
|
registerVolatileSecret,
|
|
999
1036
|
registerSensitiveKeyName,
|
|
1000
1037
|
init_secret_scrubber
|
|
1001
|
-
} from "./cli-
|
|
1038
|
+
} from "./cli-7e8sxqv5.js";
|
|
1002
1039
|
import {
|
|
1003
1040
|
__toESM,
|
|
1004
1041
|
__commonJS,
|
|
@@ -1025,9 +1062,9 @@ function objectFromShape(shape) {
|
|
|
1025
1062
|
return objectType(shape);
|
|
1026
1063
|
throw new Error("Mixed Zod versions detected in object shape.");
|
|
1027
1064
|
}
|
|
1028
|
-
function
|
|
1065
|
+
function safeParse(schema, data) {
|
|
1029
1066
|
if (isZ4Schema(schema)) {
|
|
1030
|
-
const result =
|
|
1067
|
+
const result = safeParse2(schema, data);
|
|
1031
1068
|
return result;
|
|
1032
1069
|
}
|
|
1033
1070
|
const v3Schema = schema;
|
|
@@ -3482,7 +3519,7 @@ function getMethodLiteral(schema) {
|
|
|
3482
3519
|
return value;
|
|
3483
3520
|
}
|
|
3484
3521
|
function parseWithCompat(schema, data) {
|
|
3485
|
-
const result =
|
|
3522
|
+
const result = safeParse(schema, data);
|
|
3486
3523
|
if (!result.success) {
|
|
3487
3524
|
throw result.error;
|
|
3488
3525
|
}
|
|
@@ -4062,7 +4099,7 @@ class Protocol {
|
|
|
4062
4099
|
return reject(response);
|
|
4063
4100
|
}
|
|
4064
4101
|
try {
|
|
4065
|
-
const parseResult =
|
|
4102
|
+
const parseResult = safeParse(resultSchema, response.result);
|
|
4066
4103
|
if (!parseResult.success) {
|
|
4067
4104
|
reject(parseResult.error);
|
|
4068
4105
|
} else {
|
|
@@ -11006,7 +11043,7 @@ var init_server3 = __esm(() => {
|
|
|
11006
11043
|
const method = methodValue;
|
|
11007
11044
|
if (method === "tools/call") {
|
|
11008
11045
|
const wrappedHandler = async (request, extra) => {
|
|
11009
|
-
const validatedRequest =
|
|
11046
|
+
const validatedRequest = safeParse(CallToolRequestSchema, request);
|
|
11010
11047
|
if (!validatedRequest.success) {
|
|
11011
11048
|
const errorMessage = validatedRequest.error instanceof Error ? validatedRequest.error.message : String(validatedRequest.error);
|
|
11012
11049
|
throw new McpError(ErrorCode.InvalidParams, `Invalid tools/call request: ${errorMessage}`);
|
|
@@ -11014,14 +11051,14 @@ var init_server3 = __esm(() => {
|
|
|
11014
11051
|
const { params } = validatedRequest.data;
|
|
11015
11052
|
const result = await Promise.resolve(handler(request, extra));
|
|
11016
11053
|
if (params.task) {
|
|
11017
|
-
const taskValidationResult =
|
|
11054
|
+
const taskValidationResult = safeParse(CreateTaskResultSchema, result);
|
|
11018
11055
|
if (!taskValidationResult.success) {
|
|
11019
11056
|
const errorMessage = taskValidationResult.error instanceof Error ? taskValidationResult.error.message : String(taskValidationResult.error);
|
|
11020
11057
|
throw new McpError(ErrorCode.InvalidParams, `Invalid task creation result: ${errorMessage}`);
|
|
11021
11058
|
}
|
|
11022
11059
|
return taskValidationResult.data;
|
|
11023
11060
|
}
|
|
11024
|
-
const validationResult =
|
|
11061
|
+
const validationResult = safeParse(CallToolResultSchema, result);
|
|
11025
11062
|
if (!validationResult.success) {
|
|
11026
11063
|
const errorMessage = validationResult.error instanceof Error ? validationResult.error.message : String(validationResult.error);
|
|
11027
11064
|
throw new McpError(ErrorCode.InvalidParams, `Invalid tools/call result: ${errorMessage}`);
|
|
@@ -12152,6 +12189,10 @@ var init_mcp = __esm(() => {
|
|
|
12152
12189
|
});
|
|
12153
12190
|
|
|
12154
12191
|
// src/github/app.ts
|
|
12192
|
+
function decodePrivateKey(raw) {
|
|
12193
|
+
return raw.startsWith("-----BEGIN") ? raw.replace(/\\n/g, `
|
|
12194
|
+
`) : Buffer.from(raw, "base64").toString("utf-8");
|
|
12195
|
+
}
|
|
12155
12196
|
function isGitHubEnabled() {
|
|
12156
12197
|
if (isEnvFlagEnabled("GITHUB_DISABLE", false)) {
|
|
12157
12198
|
return false;
|
|
@@ -12191,12 +12232,7 @@ function initGitHub() {
|
|
|
12191
12232
|
appId = process.env.GITHUB_APP_ID ?? null;
|
|
12192
12233
|
const rawPrivateKey = process.env.GITHUB_APP_PRIVATE_KEY ?? null;
|
|
12193
12234
|
if (appId && rawPrivateKey) {
|
|
12194
|
-
|
|
12195
|
-
privateKey = rawPrivateKey.replace(/\\n/g, `
|
|
12196
|
-
`);
|
|
12197
|
-
} else {
|
|
12198
|
-
privateKey = Buffer.from(rawPrivateKey, "base64").toString("utf-8");
|
|
12199
|
-
}
|
|
12235
|
+
privateKey = decodePrivateKey(rawPrivateKey);
|
|
12200
12236
|
console.log("[GitHub] App credentials loaded for bot reactions");
|
|
12201
12237
|
} else {
|
|
12202
12238
|
console.log("[GitHub] No App credentials, bot reactions disabled");
|
|
@@ -12236,15 +12272,16 @@ async function verifyWebhookSignature(payload, signature) {
|
|
|
12236
12272
|
}
|
|
12237
12273
|
return isValid;
|
|
12238
12274
|
}
|
|
12239
|
-
async function generateAppJWT() {
|
|
12240
|
-
|
|
12275
|
+
async function generateAppJWT(creds = { appId, privateKey }) {
|
|
12276
|
+
const { appId: appId2, privateKey: privateKey2 } = creds;
|
|
12277
|
+
if (!appId2 || !privateKey2) {
|
|
12241
12278
|
return null;
|
|
12242
12279
|
}
|
|
12243
12280
|
const now = Math.floor(Date.now() / 1000);
|
|
12244
12281
|
const payload = {
|
|
12245
12282
|
iat: now - 60,
|
|
12246
12283
|
exp: now + 600,
|
|
12247
|
-
iss:
|
|
12284
|
+
iss: appId2
|
|
12248
12285
|
};
|
|
12249
12286
|
const base64url = (data) => {
|
|
12250
12287
|
const base64 = Buffer.isBuffer(data) ? data.toString("base64") : Buffer.from(data).toString("base64");
|
|
@@ -12258,7 +12295,7 @@ async function generateAppJWT() {
|
|
|
12258
12295
|
const crypto2 = await import("node:crypto");
|
|
12259
12296
|
const sign = crypto2.createSign("RSA-SHA256");
|
|
12260
12297
|
sign.update(signingInput);
|
|
12261
|
-
const signature = sign.sign(
|
|
12298
|
+
const signature = sign.sign(privateKey2);
|
|
12262
12299
|
const signatureB64 = base64url(signature);
|
|
12263
12300
|
return `${signingInput}.${signatureB64}`;
|
|
12264
12301
|
} catch (error) {
|
|
@@ -12267,11 +12304,14 @@ async function generateAppJWT() {
|
|
|
12267
12304
|
}
|
|
12268
12305
|
}
|
|
12269
12306
|
async function getInstallationToken(installationId) {
|
|
12307
|
+
return (await mintInstallationToken(installationId, { appId, privateKey }, 60000))?.token ?? null;
|
|
12308
|
+
}
|
|
12309
|
+
async function mintInstallationToken(installationId, creds, minValidityMs) {
|
|
12270
12310
|
const cached = tokenCache.get(installationId);
|
|
12271
|
-
if (cached && cached.expiresAt > Date.now() +
|
|
12272
|
-
return cached
|
|
12311
|
+
if (cached && cached.expiresAt > Date.now() + minValidityMs) {
|
|
12312
|
+
return cached;
|
|
12273
12313
|
}
|
|
12274
|
-
const jwt = await generateAppJWT();
|
|
12314
|
+
const jwt = await generateAppJWT(creds);
|
|
12275
12315
|
if (!jwt) {
|
|
12276
12316
|
console.log("[GitHub] No JWT available, cannot get installation token");
|
|
12277
12317
|
return null;
|
|
@@ -12292,16 +12332,33 @@ async function getInstallationToken(installationId) {
|
|
|
12292
12332
|
}
|
|
12293
12333
|
const data = await response.json();
|
|
12294
12334
|
const expiresAt = new Date(data.expires_at).getTime();
|
|
12295
|
-
|
|
12335
|
+
const minted = { token: data.token, expiresAt };
|
|
12336
|
+
tokenCache.set(installationId, minted);
|
|
12296
12337
|
console.log(`[GitHub] Got installation token for ${installationId}, expires at ${data.expires_at}`);
|
|
12297
|
-
return
|
|
12338
|
+
return minted;
|
|
12298
12339
|
} catch (error) {
|
|
12299
12340
|
console.error("[GitHub] Error getting installation token:", error);
|
|
12300
12341
|
return null;
|
|
12301
12342
|
}
|
|
12302
12343
|
}
|
|
12344
|
+
async function getWorkerInstallationToken() {
|
|
12345
|
+
if (isEnvFlagEnabled("GITHUB_DISABLE", false))
|
|
12346
|
+
return { status: "unconfigured" };
|
|
12347
|
+
const workerAppId = process.env.GITHUB_APP_ID?.trim();
|
|
12348
|
+
const rawKey = process.env.GITHUB_APP_PRIVATE_KEY?.trim();
|
|
12349
|
+
const rawInstallation = process.env.GITHUB_APP_INSTALLATION_ID?.trim() ?? "";
|
|
12350
|
+
if (!workerAppId || !rawKey || !/^[1-9][0-9]{0,15}$/.test(rawInstallation)) {
|
|
12351
|
+
return { status: "unconfigured" };
|
|
12352
|
+
}
|
|
12353
|
+
if (!resolveGitHubHost().ok)
|
|
12354
|
+
return { status: "error" };
|
|
12355
|
+
const minted = await mintInstallationToken(Number(rawInstallation), { appId: workerAppId, privateKey: decodePrivateKey(rawKey) }, 600000);
|
|
12356
|
+
if (!minted)
|
|
12357
|
+
return { status: "error" };
|
|
12358
|
+
return { status: "ok", token: minted.token, expiresAt: new Date(minted.expiresAt).toISOString() };
|
|
12359
|
+
}
|
|
12303
12360
|
var initialized = false, webhookSecret = null, appId = null, privateKey = null, tokenCache;
|
|
12304
|
-
var
|
|
12361
|
+
var init_app = __esm(() => {
|
|
12305
12362
|
init_env_flag();
|
|
12306
12363
|
init_github_host();
|
|
12307
12364
|
tokenCache = new Map;
|
|
@@ -12399,7 +12456,7 @@ async function addGraphQLReaction(nodeId, reaction, installationId) {
|
|
|
12399
12456
|
var init_reactions = __esm(() => {
|
|
12400
12457
|
init_github_host();
|
|
12401
12458
|
init_secret_scrubber();
|
|
12402
|
-
|
|
12459
|
+
init_app();
|
|
12403
12460
|
});
|
|
12404
12461
|
|
|
12405
12462
|
// src/github/task-reactions.ts
|
|
@@ -20065,7 +20122,7 @@ async function completeIfSettled(runId, ctx) {
|
|
|
20065
20122
|
if (await getRunLineageBlock(runId))
|
|
20066
20123
|
return false;
|
|
20067
20124
|
const steps = await getWorkflowRunStepsByRunId2(runId);
|
|
20068
|
-
if (retryPendingNodeIds(steps).size > 0)
|
|
20125
|
+
if (retryPendingNodeIds(steps).size > 0 || hasOwedSuccessors(runId))
|
|
20069
20126
|
return false;
|
|
20070
20127
|
const latest = new Map;
|
|
20071
20128
|
for (const step of steps)
|
|
@@ -20075,6 +20132,7 @@ async function completeIfSettled(runId, ctx) {
|
|
|
20075
20132
|
return false;
|
|
20076
20133
|
}
|
|
20077
20134
|
}
|
|
20135
|
+
await adoptStoredContext(runId, ctx);
|
|
20078
20136
|
await updateWorkflowRun2(runId, {
|
|
20079
20137
|
status: "completed",
|
|
20080
20138
|
context: ctx,
|
|
@@ -20134,7 +20192,7 @@ async function recoverWaitingRuns(registry) {
|
|
|
20134
20192
|
await finalizeOrWait2(stuck.runId);
|
|
20135
20193
|
} else {
|
|
20136
20194
|
const secretKeys = getSecretInputKeys(workflow.input);
|
|
20137
|
-
await walkGraph(workflow.definition, stuck.runId, ctx, routing.successors, registry, workflow.id, secretKeys);
|
|
20195
|
+
await walkGraph(workflow.definition, stuck.runId, ctx, routing.successors, registry, workflow.id, secretKeys, { successorDebt: routing.successorDebt });
|
|
20138
20196
|
}
|
|
20139
20197
|
recovered++;
|
|
20140
20198
|
} catch (err) {
|
|
@@ -20188,7 +20246,7 @@ async function recoverApprovalWaitingRuns(registry) {
|
|
|
20188
20246
|
continue;
|
|
20189
20247
|
if (routing.successors.length > 0) {
|
|
20190
20248
|
const secretKeys = getSecretInputKeys(workflow.input);
|
|
20191
|
-
await walkGraph(workflow.definition, stuck.runId, ctx, routing.successors, registry, workflow.id, secretKeys);
|
|
20249
|
+
await walkGraph(workflow.definition, stuck.runId, ctx, routing.successors, registry, workflow.id, secretKeys, { successorDebt: routing.successorDebt });
|
|
20192
20250
|
} else {
|
|
20193
20251
|
await finalizeOrWait2(stuck.runId);
|
|
20194
20252
|
}
|
|
@@ -20265,6 +20323,7 @@ var init_recovery = __esm(() => {
|
|
|
20265
20323
|
init_db4();
|
|
20266
20324
|
init_workflow_runs();
|
|
20267
20325
|
init_approval_resolution();
|
|
20326
|
+
init_checkpoint();
|
|
20268
20327
|
init_completed_step_routing();
|
|
20269
20328
|
init_constants();
|
|
20270
20329
|
init_engine();
|
|
@@ -20272,6 +20331,7 @@ var init_recovery = __esm(() => {
|
|
|
20272
20331
|
init_foreach_driver();
|
|
20273
20332
|
init_input();
|
|
20274
20333
|
init_resume();
|
|
20334
|
+
init_successor_routing();
|
|
20275
20335
|
init_task_step_routing();
|
|
20276
20336
|
});
|
|
20277
20337
|
|
|
@@ -20279,6 +20339,7 @@ var init_recovery = __esm(() => {
|
|
|
20279
20339
|
function startRetryPoller(registry, intervalMs = 5000) {
|
|
20280
20340
|
if (pollerTimeout !== null)
|
|
20281
20341
|
return;
|
|
20342
|
+
const generation = pollerGeneration;
|
|
20282
20343
|
async function poll() {
|
|
20283
20344
|
try {
|
|
20284
20345
|
const retryableSteps = await getRetryableSteps2();
|
|
@@ -20347,7 +20408,7 @@ function startRetryPoller(registry, intervalMs = 5000) {
|
|
|
20347
20408
|
if (!drive.joined)
|
|
20348
20409
|
continue;
|
|
20349
20410
|
if (drive.successors.length > 0) {
|
|
20350
|
-
await walkGraph(workflow.definition, run.id, ctx, drive.successors, registry, workflow.id);
|
|
20411
|
+
await walkGraph(workflow.definition, run.id, ctx, drive.successors, registry, workflow.id, undefined, { successorDebt: drive.successorDebt });
|
|
20351
20412
|
} else {
|
|
20352
20413
|
await completeRunIfSettled(run.id, ctx);
|
|
20353
20414
|
}
|
|
@@ -20356,7 +20417,7 @@ function startRetryPoller(registry, intervalMs = 5000) {
|
|
|
20356
20417
|
if (!waiting)
|
|
20357
20418
|
continue;
|
|
20358
20419
|
if (result.waitFor === "workflow.child.finished") {
|
|
20359
|
-
const { resumeFromChildRun } = await import("./resume-
|
|
20420
|
+
const { resumeFromChildRun } = await import("./resume-hj1mn65y.js");
|
|
20360
20421
|
await resumeFromChildRun(step.id, registry);
|
|
20361
20422
|
}
|
|
20362
20423
|
} else {
|
|
@@ -20411,7 +20472,8 @@ function startRetryPoller(registry, intervalMs = 5000) {
|
|
|
20411
20472
|
} catch (err) {
|
|
20412
20473
|
console.error("[workflows] Retry poller error:", err);
|
|
20413
20474
|
}
|
|
20414
|
-
|
|
20475
|
+
if (generation === pollerGeneration)
|
|
20476
|
+
pollerTimeout = setTimeout(poll, intervalMs);
|
|
20415
20477
|
}
|
|
20416
20478
|
pollerTimeout = setTimeout(poll, intervalMs);
|
|
20417
20479
|
}
|
|
@@ -20451,8 +20513,9 @@ async function completeRunIfSettled(runId, ctx) {
|
|
|
20451
20513
|
return;
|
|
20452
20514
|
const steps = await getWorkflowRunStepsByRunId2(runId);
|
|
20453
20515
|
const live = steps.some((s) => s.status === "running" || s.status === "waiting" || s.status === "failed" && s.nextRetryAt != null);
|
|
20454
|
-
if (live)
|
|
20516
|
+
if (live || hasOwedSuccessors(runId))
|
|
20455
20517
|
return;
|
|
20518
|
+
await adoptStoredContext(runId, ctx);
|
|
20456
20519
|
await updateWorkflowRun2(runId, {
|
|
20457
20520
|
status: "completed",
|
|
20458
20521
|
context: ctx,
|
|
@@ -20460,7 +20523,7 @@ async function completeRunIfSettled(runId, ctx) {
|
|
|
20460
20523
|
});
|
|
20461
20524
|
});
|
|
20462
20525
|
}
|
|
20463
|
-
var pollerTimeout = null, RETRYABLE_RUN_STATUSES;
|
|
20526
|
+
var pollerTimeout = null, pollerGeneration = 0, RETRYABLE_RUN_STATUSES;
|
|
20464
20527
|
var init_retry_poller = __esm(() => {
|
|
20465
20528
|
init_db4();
|
|
20466
20529
|
init_workflow_runs();
|
|
@@ -20470,6 +20533,7 @@ var init_retry_poller = __esm(() => {
|
|
|
20470
20533
|
init_foreach_driver();
|
|
20471
20534
|
init_foreach_join();
|
|
20472
20535
|
init_step_input();
|
|
20536
|
+
init_successor_routing();
|
|
20473
20537
|
init_validation();
|
|
20474
20538
|
RETRYABLE_RUN_STATUSES = new Set(["running", "waiting", "failed"]);
|
|
20475
20539
|
});
|
|
@@ -20477,6 +20541,127 @@ var init_retry_poller = __esm(() => {
|
|
|
20477
20541
|
// src/workflows/templates.ts
|
|
20478
20542
|
var init_templates2 = () => {};
|
|
20479
20543
|
|
|
20544
|
+
// src/workflows/webhook-filter.ts
|
|
20545
|
+
function headerValue(headers, name) {
|
|
20546
|
+
const target = name.toLowerCase();
|
|
20547
|
+
for (const [key, value] of Object.entries(headers)) {
|
|
20548
|
+
if (key.toLowerCase() !== target)
|
|
20549
|
+
continue;
|
|
20550
|
+
const first = Array.isArray(value) ? value[0] : value;
|
|
20551
|
+
return typeof first === "string" ? first : undefined;
|
|
20552
|
+
}
|
|
20553
|
+
return;
|
|
20554
|
+
}
|
|
20555
|
+
function isPreset(value) {
|
|
20556
|
+
return typeof value === "string" && WEBHOOK_FILTER_PRESETS.includes(value);
|
|
20557
|
+
}
|
|
20558
|
+
function listed(value) {
|
|
20559
|
+
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean" || value === null) {
|
|
20560
|
+
return [value];
|
|
20561
|
+
}
|
|
20562
|
+
return value;
|
|
20563
|
+
}
|
|
20564
|
+
function valueAllowed(value, allowed) {
|
|
20565
|
+
return allowed.some((candidate) => Object.is(candidate, value));
|
|
20566
|
+
}
|
|
20567
|
+
function readBodyPath(body, path) {
|
|
20568
|
+
let current = body;
|
|
20569
|
+
for (const segment of path.split(".")) {
|
|
20570
|
+
if (Array.isArray(current)) {
|
|
20571
|
+
if (!/^(0|[1-9]\d*)$/.test(segment) || !Object.hasOwn(current, segment)) {
|
|
20572
|
+
return { found: false };
|
|
20573
|
+
}
|
|
20574
|
+
current = current[Number(segment)];
|
|
20575
|
+
continue;
|
|
20576
|
+
}
|
|
20577
|
+
if (current === null || typeof current !== "object")
|
|
20578
|
+
return { found: false };
|
|
20579
|
+
if (!Object.hasOwn(current, segment))
|
|
20580
|
+
return { found: false };
|
|
20581
|
+
current = current[segment];
|
|
20582
|
+
}
|
|
20583
|
+
return { found: true, value: current };
|
|
20584
|
+
}
|
|
20585
|
+
function clauseMatches(clause, headers, body) {
|
|
20586
|
+
if (clause.source === "header") {
|
|
20587
|
+
return valueAllowed(headerValue(headers, clause.path), clause.allowed);
|
|
20588
|
+
}
|
|
20589
|
+
const read = readBodyPath(body, clause.path);
|
|
20590
|
+
return read.found && valueAllowed(read.value, clause.allowed);
|
|
20591
|
+
}
|
|
20592
|
+
function observedEvent(clause, headers, body) {
|
|
20593
|
+
if (clause.source === "header")
|
|
20594
|
+
return headerValue(headers, clause.path) ?? null;
|
|
20595
|
+
const read = readBodyPath(body, clause.path);
|
|
20596
|
+
return read.found && typeof read.value === "string" ? read.value : null;
|
|
20597
|
+
}
|
|
20598
|
+
function invalid(message) {
|
|
20599
|
+
return { action: "invalid", message };
|
|
20600
|
+
}
|
|
20601
|
+
function decideWebhookDelivery(trigger, headers, body) {
|
|
20602
|
+
if (trigger.preset !== undefined && !isPreset(trigger.preset)) {
|
|
20603
|
+
return invalid(WEBHOOK_PRESET_INVALID_MESSAGE);
|
|
20604
|
+
}
|
|
20605
|
+
if (trigger.eventHeader !== undefined && (typeof trigger.eventHeader !== "string" || trigger.eventHeader.length === 0)) {
|
|
20606
|
+
return invalid(WEBHOOK_EVENT_HEADER_INVALID_MESSAGE);
|
|
20607
|
+
}
|
|
20608
|
+
if (trigger.events != null) {
|
|
20609
|
+
if (!Array.isArray(trigger.events) || trigger.events.some((event) => typeof event !== "string")) {
|
|
20610
|
+
return invalid(WEBHOOK_EVENTS_INVALID_MESSAGE);
|
|
20611
|
+
}
|
|
20612
|
+
}
|
|
20613
|
+
const clauses = [];
|
|
20614
|
+
const events = Array.isArray(trigger.events) ? trigger.events : [];
|
|
20615
|
+
if (events.length > 0) {
|
|
20616
|
+
const preset = isPreset(trigger.preset) ? trigger.preset : "github";
|
|
20617
|
+
const source = typeof trigger.eventHeader === "string" ? { source: "header", path: trigger.eventHeader } : EVENT_SOURCES[preset];
|
|
20618
|
+
clauses.push({ ...source, allowed: events, origin: "events" });
|
|
20619
|
+
}
|
|
20620
|
+
if (trigger.filter !== undefined) {
|
|
20621
|
+
const parsed = WebhookDeliveryFilterSchema.safeParse(trigger.filter);
|
|
20622
|
+
if (!parsed.success)
|
|
20623
|
+
return invalid(WEBHOOK_FILTER_INVALID_MESSAGE);
|
|
20624
|
+
for (const [name, allowed] of Object.entries(parsed.data.headers ?? {})) {
|
|
20625
|
+
clauses.push({ source: "header", path: name, allowed: listed(allowed), origin: "filter" });
|
|
20626
|
+
}
|
|
20627
|
+
for (const [path, allowed] of Object.entries(parsed.data.body ?? {})) {
|
|
20628
|
+
clauses.push({ source: "body", path, allowed: listed(allowed), origin: "filter" });
|
|
20629
|
+
}
|
|
20630
|
+
}
|
|
20631
|
+
for (const clause of clauses) {
|
|
20632
|
+
if (clauseMatches(clause, headers, body))
|
|
20633
|
+
continue;
|
|
20634
|
+
if (clause.origin === "events") {
|
|
20635
|
+
return {
|
|
20636
|
+
action: "skip",
|
|
20637
|
+
skip: {
|
|
20638
|
+
skipped: true,
|
|
20639
|
+
reason: "event-not-allowed",
|
|
20640
|
+
event: observedEvent(clause, headers, body)
|
|
20641
|
+
}
|
|
20642
|
+
};
|
|
20643
|
+
}
|
|
20644
|
+
return {
|
|
20645
|
+
action: "skip",
|
|
20646
|
+
skip: {
|
|
20647
|
+
skipped: true,
|
|
20648
|
+
reason: "filter-not-matched",
|
|
20649
|
+
match: { source: clause.source, path: clause.path }
|
|
20650
|
+
}
|
|
20651
|
+
};
|
|
20652
|
+
}
|
|
20653
|
+
return { action: "allow" };
|
|
20654
|
+
}
|
|
20655
|
+
var WEBHOOK_FILTER_INVALID_MESSAGE = "Webhook trigger filter is invalid", WEBHOOK_PRESET_INVALID_MESSAGE = "Webhook trigger preset is invalid", WEBHOOK_EVENTS_INVALID_MESSAGE = "Webhook trigger events allowlist is invalid", WEBHOOK_EVENT_HEADER_INVALID_MESSAGE = "Webhook trigger eventHeader is invalid", EVENT_SOURCES;
|
|
20656
|
+
var init_webhook_filter = __esm(() => {
|
|
20657
|
+
init_types5();
|
|
20658
|
+
EVENT_SOURCES = {
|
|
20659
|
+
github: { source: "header", path: "X-GitHub-Event" },
|
|
20660
|
+
gitlab: { source: "header", path: "X-Gitlab-Event" },
|
|
20661
|
+
"standard-webhooks": { source: "body", path: "type" }
|
|
20662
|
+
};
|
|
20663
|
+
});
|
|
20664
|
+
|
|
20480
20665
|
// src/workflows/triggers.ts
|
|
20481
20666
|
import crypto2 from "node:crypto";
|
|
20482
20667
|
function getHeader(headers, name) {
|
|
@@ -20585,6 +20770,14 @@ async function handleWebhookTrigger(workflowId, payload, headers, registry, opti
|
|
|
20585
20770
|
await verifyWebhookRequest(webhookTrigger, typeof payload === "string" ? payload : JSON.stringify(payload), headers);
|
|
20586
20771
|
}
|
|
20587
20772
|
const triggerData = parseTriggerPayload(payload);
|
|
20773
|
+
if (webhookTrigger) {
|
|
20774
|
+
const decision = decideWebhookDelivery(webhookTrigger, headers, triggerData);
|
|
20775
|
+
if (decision.action === "invalid") {
|
|
20776
|
+
throw new WebhookError(decision.message, 500);
|
|
20777
|
+
}
|
|
20778
|
+
if (decision.action === "skip")
|
|
20779
|
+
return decision.skip;
|
|
20780
|
+
}
|
|
20588
20781
|
const runId = await startWorkflowExecution2(workflow, triggerData, registry, {
|
|
20589
20782
|
triggerType: "event",
|
|
20590
20783
|
requestedByUserId: options.requestedByUserId
|
|
@@ -20738,6 +20931,7 @@ var init_triggers = __esm(() => {
|
|
|
20738
20931
|
init_db4();
|
|
20739
20932
|
init_engine();
|
|
20740
20933
|
init_input();
|
|
20934
|
+
init_webhook_filter();
|
|
20741
20935
|
FALLBACK_HMAC_HEADERS = ["x-hub-signature-256", "x-signature", "x-webhook-signature"];
|
|
20742
20936
|
WebhookError = class WebhookError extends Error {
|
|
20743
20937
|
statusCode;
|
|
@@ -20802,6 +20996,7 @@ var init_version = __esm(() => {
|
|
|
20802
20996
|
function startWaitPoller(registry, intervalMs = 5000) {
|
|
20803
20997
|
if (pollerTimeout2 !== null)
|
|
20804
20998
|
return;
|
|
20999
|
+
const generation = pollerGeneration2;
|
|
20805
21000
|
async function poll() {
|
|
20806
21001
|
try {
|
|
20807
21002
|
const dueWaits = await getDueWaitStates2();
|
|
@@ -20816,11 +21011,12 @@ function startWaitPoller(registry, intervalMs = 5000) {
|
|
|
20816
21011
|
} catch (err) {
|
|
20817
21012
|
console.error("[workflows] Wait poller tick error:", err);
|
|
20818
21013
|
}
|
|
20819
|
-
|
|
21014
|
+
if (generation === pollerGeneration2)
|
|
21015
|
+
pollerTimeout2 = setTimeout(poll, intervalMs);
|
|
20820
21016
|
}
|
|
20821
21017
|
pollerTimeout2 = setTimeout(poll, intervalMs);
|
|
20822
21018
|
}
|
|
20823
|
-
var pollerTimeout2 = null;
|
|
21019
|
+
var pollerTimeout2 = null, pollerGeneration2 = 0;
|
|
20824
21020
|
var init_wait_poller = __esm(() => {
|
|
20825
21021
|
init_db4();
|
|
20826
21022
|
init_resume();
|
|
@@ -21087,7 +21283,7 @@ var init_notify = __esm(() => {
|
|
|
21087
21283
|
}
|
|
21088
21284
|
}
|
|
21089
21285
|
case "slack": {
|
|
21090
|
-
const { getSlackApp } = await import("./app-
|
|
21286
|
+
const { getSlackApp } = await import("./app-kyqt8ehw.js");
|
|
21091
21287
|
let app = getSlackApp();
|
|
21092
21288
|
if (!app) {
|
|
21093
21289
|
if (!isSlackConfigured()) {
|
|
@@ -21220,7 +21416,7 @@ var init_property_match = __esm(() => {
|
|
|
21220
21416
|
async function executeRawLlm(config) {
|
|
21221
21417
|
let modelName = config.model ?? "google/gemini-3-flash-preview";
|
|
21222
21418
|
try {
|
|
21223
|
-
const { createOpenAI } = await import("./index-
|
|
21419
|
+
const { createOpenAI } = await import("./index-kzdqn3dd.js");
|
|
21224
21420
|
const llmConfig = await resolveWorkflowLlmConfig(config.model);
|
|
21225
21421
|
modelName = llmConfig.model;
|
|
21226
21422
|
const provider = createOpenAI({
|
|
@@ -21230,7 +21426,7 @@ async function executeRawLlm(config) {
|
|
|
21230
21426
|
});
|
|
21231
21427
|
const model = provider(llmConfig.model);
|
|
21232
21428
|
if (config.schema) {
|
|
21233
|
-
const { generateObject, jsonSchema } = await import("./index-
|
|
21429
|
+
const { generateObject, jsonSchema } = await import("./index-kdmkfjt7.js");
|
|
21234
21430
|
const { object } = await generateObject({
|
|
21235
21431
|
model,
|
|
21236
21432
|
schema: jsonSchema(config.schema),
|
|
@@ -21244,7 +21440,7 @@ async function executeRawLlm(config) {
|
|
|
21244
21440
|
output: { result: object, model: modelName }
|
|
21245
21441
|
};
|
|
21246
21442
|
}
|
|
21247
|
-
const { generateText } = await import("./index-
|
|
21443
|
+
const { generateText } = await import("./index-kdmkfjt7.js");
|
|
21248
21444
|
const { text } = await generateText({
|
|
21249
21445
|
model,
|
|
21250
21446
|
prompt: config.prompt
|
|
@@ -21804,8 +22000,8 @@ var init_validate3 = __esm(() => {
|
|
|
21804
22000
|
const interpolatedPrompt = this.deps.interpolate(prompt, context);
|
|
21805
22001
|
const outputStr = typeof targetOutput === "string" ? targetOutput : JSON.stringify(targetOutput);
|
|
21806
22002
|
try {
|
|
21807
|
-
const { createOpenAI } = await import("./index-
|
|
21808
|
-
const { generateObject, jsonSchema } = await import("./index-
|
|
22003
|
+
const { createOpenAI } = await import("./index-kzdqn3dd.js");
|
|
22004
|
+
const { generateObject, jsonSchema } = await import("./index-kdmkfjt7.js");
|
|
21809
22005
|
const llmConfig = await resolveWorkflowLlmConfig();
|
|
21810
22006
|
const provider = createOpenAI({
|
|
21811
22007
|
baseURL: llmConfig.baseURL,
|
|
@@ -24516,7 +24712,7 @@ function setPreloadedTools(server, names) {
|
|
|
24516
24712
|
async function applyPreToolCall(name, args, requestInfo, inputSchema) {
|
|
24517
24713
|
if (requestInfo.callOrigin !== "mcp")
|
|
24518
24714
|
return { args };
|
|
24519
|
-
const dispatcher = await import("./dispatcher-
|
|
24715
|
+
const dispatcher = await import("./dispatcher-x6w14pde.js");
|
|
24520
24716
|
const result = await dispatcher.dispatchPre("pre.tool.call", { tool: name, args, requestInfo }, inputSchema ? {
|
|
24521
24717
|
validateModify: async (data) => {
|
|
24522
24718
|
const schema = normalizeObjectSchema(inputSchema) ?? inputSchema;
|
|
@@ -24903,7 +25099,7 @@ async function invokeToolInProcess(args) {
|
|
|
24903
25099
|
}
|
|
24904
25100
|
return tool.inputSchema ? await Promise.resolve(tool.handler(handlerArgs, extra)) : await Promise.resolve(tool.handler(extra));
|
|
24905
25101
|
}
|
|
24906
|
-
function
|
|
25102
|
+
function headerValue2(req, name) {
|
|
24907
25103
|
const value = req.headers[name];
|
|
24908
25104
|
return Array.isArray(value) ? value[0] : value;
|
|
24909
25105
|
}
|
|
@@ -24914,8 +25110,8 @@ async function handleMcpBridge(req, res, pathSegments, _queryParams, myAgentId)
|
|
|
24914
25110
|
if (!parsed)
|
|
24915
25111
|
return true;
|
|
24916
25112
|
const { tool: toolName, args } = parsed.body;
|
|
24917
|
-
const sourceTaskId =
|
|
24918
|
-
const runtimeInstanceId =
|
|
25113
|
+
const sourceTaskId = headerValue2(req, "x-source-task-id");
|
|
25114
|
+
const runtimeInstanceId = headerValue2(req, "x-runtime-instance-id");
|
|
24919
25115
|
try {
|
|
24920
25116
|
const result = await invokeToolInProcess({
|
|
24921
25117
|
toolName,
|
|
@@ -24923,7 +25119,7 @@ async function handleMcpBridge(req, res, pathSegments, _queryParams, myAgentId)
|
|
|
24923
25119
|
agentId: myAgentId,
|
|
24924
25120
|
sourceTaskId,
|
|
24925
25121
|
runtimeInstanceId,
|
|
24926
|
-
callOrigin: resolveBridgeCallOrigin2(myAgentId,
|
|
25122
|
+
callOrigin: resolveBridgeCallOrigin2(myAgentId, headerValue2(req, "x-extension-token"))
|
|
24927
25123
|
});
|
|
24928
25124
|
if (result && typeof result === "object" && "structuredContent" in result) {
|
|
24929
25125
|
json(res, result.structuredContent);
|
|
@@ -26812,8 +27008,14 @@ function positiveEnv(name, fallback) {
|
|
|
26812
27008
|
const value = Number(process.env[name]);
|
|
26813
27009
|
return Number.isFinite(value) && value > 0 ? Math.floor(value) : fallback;
|
|
26814
27010
|
}
|
|
26815
|
-
function
|
|
26816
|
-
|
|
27011
|
+
function toolSourceOf(event, payload) {
|
|
27012
|
+
if (event !== "pre.tool.call" && event !== "post.tool.call")
|
|
27013
|
+
return;
|
|
27014
|
+
return stringField(payload, "requestInfo", "callOrigin") === "native" ? "native" : "mcp";
|
|
27015
|
+
}
|
|
27016
|
+
function handlersFor(event, payload, opts) {
|
|
27017
|
+
const toolSource = toolSourceOf(event, payload);
|
|
27018
|
+
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
27019
|
}
|
|
26818
27020
|
function snippet(text, max = 80) {
|
|
26819
27021
|
const flat = String(text ?? "").replace(/\s+/g, " ").trim();
|
|
@@ -27026,7 +27228,7 @@ async function dispatchPre2(event, payload, opts) {
|
|
|
27026
27228
|
let currentPayload = { ...payload };
|
|
27027
27229
|
const mergedData = {};
|
|
27028
27230
|
let modified = false;
|
|
27029
|
-
for (const { loaded, handler } of handlersFor(event, opts)) {
|
|
27231
|
+
for (const { loaded, handler } of handlersFor(event, payload, opts)) {
|
|
27030
27232
|
if (!isRegistered2(loaded.record.id))
|
|
27031
27233
|
continue;
|
|
27032
27234
|
const run = await runHandler(loaded, handler, event, currentPayload);
|
|
@@ -27088,7 +27290,7 @@ async function dispatchPre2(event, payload, opts) {
|
|
|
27088
27290
|
return modified ? { action: "modify", data: mergedData } : { action: "continue" };
|
|
27089
27291
|
}
|
|
27090
27292
|
async function dispatchPost2(event, payload, opts) {
|
|
27091
|
-
for (const { loaded, handler } of handlersFor(event, opts)) {
|
|
27293
|
+
for (const { loaded, handler } of handlersFor(event, payload, opts)) {
|
|
27092
27294
|
if (!isRegistered2(loaded.record.id))
|
|
27093
27295
|
continue;
|
|
27094
27296
|
const run = await runHandler(loaded, handler, event, payload);
|
|
@@ -30553,6 +30755,18 @@ async function resolveGitHubSender(login, sampleEventType, sampleContext) {
|
|
|
30553
30755
|
await incrKv2(UNMAPPED_NAMESPACE3, `${login}:count`, 1);
|
|
30554
30756
|
return;
|
|
30555
30757
|
}
|
|
30758
|
+
function isTrustedGitHubSender(login, requestedByUserId, content) {
|
|
30759
|
+
if (requestedByUserId || isBotAssignee(login))
|
|
30760
|
+
return true;
|
|
30761
|
+
const normalized = login.toLowerCase();
|
|
30762
|
+
const allowed = (process.env.GITHUB_ALLOWED_SENDERS ?? "").split(",").map((name) => name.trim().toLowerCase()).filter(Boolean);
|
|
30763
|
+
if (allowed.includes(normalized))
|
|
30764
|
+
return true;
|
|
30765
|
+
return content.user.login.toLowerCase() === normalized && TRUSTED_AUTHOR_ASSOCIATIONS.has(content.author_association ?? "");
|
|
30766
|
+
}
|
|
30767
|
+
function logUntrustedSender(eventType, login, repo, number) {
|
|
30768
|
+
console.log(`[GitHub] Skipped ${eventType} by ${login} on ${repo}#${number}: ${UNTRUSTED_SENDER_REASON}`);
|
|
30769
|
+
}
|
|
30556
30770
|
async function handlePullRequest(event) {
|
|
30557
30771
|
const {
|
|
30558
30772
|
action,
|
|
@@ -30766,6 +30980,10 @@ async function handlePullRequest(event) {
|
|
|
30766
30980
|
if (!hasMention) {
|
|
30767
30981
|
return { created: false };
|
|
30768
30982
|
}
|
|
30983
|
+
if (!isTrustedGitHubSender(sender.login, requestedByUserId, pr)) {
|
|
30984
|
+
logUntrustedSender(`pull_request.${action}`, sender.login, repository.full_name, pr.number);
|
|
30985
|
+
return { created: false };
|
|
30986
|
+
}
|
|
30769
30987
|
const eventKey = `pr:${repository.full_name}:${pr.number}:${action}`;
|
|
30770
30988
|
if (isDuplicate4(eventKey)) {
|
|
30771
30989
|
return { created: false };
|
|
@@ -30930,6 +31148,10 @@ async function handleIssue(event) {
|
|
|
30930
31148
|
if (!hasMention) {
|
|
30931
31149
|
return { created: false };
|
|
30932
31150
|
}
|
|
31151
|
+
if (!isTrustedGitHubSender(sender.login, requestedByUserId, issue)) {
|
|
31152
|
+
logUntrustedSender(`issues.${action}`, sender.login, repository.full_name, issue.number);
|
|
31153
|
+
return { created: false };
|
|
31154
|
+
}
|
|
30933
31155
|
const eventKey = `issue:${repository.full_name}:${issue.number}:${action}`;
|
|
30934
31156
|
if (isDuplicate4(eventKey)) {
|
|
30935
31157
|
return { created: false };
|
|
@@ -30984,6 +31206,9 @@ async function handleComment(event, eventType) {
|
|
|
30984
31206
|
if (!detectMention3(comment.body)) {
|
|
30985
31207
|
return skip("no bot mention");
|
|
30986
31208
|
}
|
|
31209
|
+
if (!isTrustedGitHubSender(sender.login, requestedByUserId, comment)) {
|
|
31210
|
+
return skip(UNTRUSTED_SENDER_REASON);
|
|
31211
|
+
}
|
|
30987
31212
|
const eventKey = `comment:${repository.full_name}:${comment.id}`;
|
|
30988
31213
|
if (isDuplicate4(eventKey)) {
|
|
30989
31214
|
return skip("duplicate delivery");
|
|
@@ -31215,6 +31440,10 @@ async function handlePullRequestReview(event) {
|
|
|
31215
31440
|
if (action !== "submitted") {
|
|
31216
31441
|
return { created: false };
|
|
31217
31442
|
}
|
|
31443
|
+
if (!isTrustedGitHubSender(sender.login, requestedByUserId, review)) {
|
|
31444
|
+
logUntrustedSender("pull_request_review", sender.login, repository.full_name, pr.number);
|
|
31445
|
+
return { created: false };
|
|
31446
|
+
}
|
|
31218
31447
|
const eventKey = `pr-review:${repository.full_name}:${pr.number}:${review.id}`;
|
|
31219
31448
|
if (isDuplicate4(eventKey)) {
|
|
31220
31449
|
return { created: false };
|
|
@@ -31311,7 +31540,7 @@ async function handleWorkflowRun(event) {
|
|
|
31311
31540
|
console.log(`[GitHub:suppressed] workflow_run.${action} (${conclusion}) on ${repository.full_name} — CI events disabled by default`);
|
|
31312
31541
|
return { created: false };
|
|
31313
31542
|
}
|
|
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!) {
|
|
31543
|
+
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
31544
|
repository(owner: $owner, name: $name) {
|
|
31316
31545
|
pullRequest(number: $number) {
|
|
31317
31546
|
mergeStateStatus
|
|
@@ -31330,19 +31559,20 @@ var init_handlers4 = __esm(() => {
|
|
|
31330
31559
|
init_sibling_awareness();
|
|
31331
31560
|
init_env_flag();
|
|
31332
31561
|
init_github_host();
|
|
31333
|
-
|
|
31562
|
+
init_app();
|
|
31334
31563
|
init_mentions();
|
|
31335
31564
|
init_task_reactions();
|
|
31336
31565
|
init_templates7();
|
|
31337
31566
|
processedEvents4 = new Map;
|
|
31338
31567
|
UNMAPPED_TTL_MS3 = 30 * 24 * 60 * 60 * 1000;
|
|
31568
|
+
TRUSTED_AUTHOR_ASSOCIATIONS = new Set(["OWNER", "MEMBER", "COLLABORATOR"]);
|
|
31339
31569
|
REVIEW_COMMENTS_EMPTY_RETRY_DELAYS_MS = [1500, 3000, 3000];
|
|
31340
31570
|
reviewCommentsRetryDelay = defaultReviewCommentsRetryDelay;
|
|
31341
31571
|
});
|
|
31342
31572
|
|
|
31343
31573
|
// src/github/index.ts
|
|
31344
31574
|
var init_github = __esm(() => {
|
|
31345
|
-
|
|
31575
|
+
init_app();
|
|
31346
31576
|
init_handlers4();
|
|
31347
31577
|
init_mentions();
|
|
31348
31578
|
init_reactions();
|
|
@@ -33614,9 +33844,11 @@ function splitChatMessage(text, limit) {
|
|
|
33614
33844
|
if (code >= 55296 && code <= 56319) {
|
|
33615
33845
|
cut = cut > 1 ? cut - 1 : cut + 1;
|
|
33616
33846
|
}
|
|
33847
|
+
} else {
|
|
33848
|
+
cut += 1;
|
|
33617
33849
|
}
|
|
33618
|
-
chunks.push(rest.slice(0, cut)
|
|
33619
|
-
rest = rest.slice(cut)
|
|
33850
|
+
chunks.push(rest.slice(0, cut));
|
|
33851
|
+
rest = rest.slice(cut);
|
|
33620
33852
|
}
|
|
33621
33853
|
if (rest.length > 0 || chunks.length === 0)
|
|
33622
33854
|
chunks.push(rest);
|
|
@@ -34565,7 +34797,7 @@ async function flushChatThread(threadId, items, immediate) {
|
|
|
34565
34797
|
stopTypingKeepalive(threadId);
|
|
34566
34798
|
await clearChatMessageReactions(adapter, threadId, reacted);
|
|
34567
34799
|
try {
|
|
34568
|
-
const
|
|
34800
|
+
const result = await handleWebhookTrigger(target.workflowId, {
|
|
34569
34801
|
adapter,
|
|
34570
34802
|
channelId: first.channelId,
|
|
34571
34803
|
threadId,
|
|
@@ -34575,7 +34807,11 @@ async function flushChatThread(threadId, items, immediate) {
|
|
|
34575
34807
|
text: rawText,
|
|
34576
34808
|
messageIds: items.map((item) => item.messageId)
|
|
34577
34809
|
}, {}, getExecutorRegistry2(), { alreadyAuthenticated: true });
|
|
34578
|
-
|
|
34810
|
+
if (result.skipped) {
|
|
34811
|
+
console.warn(`[chat-sdk] ${threadId}: workflow webhook trigger skipped (${result.reason})`);
|
|
34812
|
+
return;
|
|
34813
|
+
}
|
|
34814
|
+
console.log(`[chat-sdk] ${threadId}: started workflow run ${result.runId}`);
|
|
34579
34815
|
await subscribe(thread);
|
|
34580
34816
|
} catch (error) {
|
|
34581
34817
|
console.error(`[chat-sdk] ${threadId}: workflow dispatch failed: ${errorMessage(error)}`);
|
|
@@ -36103,7 +36339,7 @@ async function notifySlack(text) {
|
|
|
36103
36339
|
return;
|
|
36104
36340
|
}
|
|
36105
36341
|
try {
|
|
36106
|
-
const { getSlackApp } = await import("./app-
|
|
36342
|
+
const { getSlackApp } = await import("./app-kyqt8ehw.js");
|
|
36107
36343
|
const app = getSlackApp();
|
|
36108
36344
|
if (!app) {
|
|
36109
36345
|
console.warn("[Jira webhook keepalive] Slack not available, cannot send notification");
|
|
@@ -36174,7 +36410,7 @@ async function deleteJiraWebhook(webhookId) {
|
|
|
36174
36410
|
console.log(`[Jira webhook keepalive] Deleted webhook id=${webhookId}`);
|
|
36175
36411
|
}
|
|
36176
36412
|
async function overwriteWebhookIds(next) {
|
|
36177
|
-
const { getDbClient } = await import("./db-
|
|
36413
|
+
const { getDbClient } = await import("./db-2ah39cyx.js");
|
|
36178
36414
|
await getDbClient().transaction(async (tx) => {
|
|
36179
36415
|
const row = await tx.get("SELECT metadata FROM oauth_apps WHERE provider = 'jira'");
|
|
36180
36416
|
if (!row) {
|
|
@@ -36347,7 +36583,7 @@ function warnIfMcpBaseUrlLooksLikeAppUrl() {
|
|
|
36347
36583
|
}
|
|
36348
36584
|
}
|
|
36349
36585
|
var initialized6 = false;
|
|
36350
|
-
var
|
|
36586
|
+
var init_app2 = __esm(() => {
|
|
36351
36587
|
init_oauth();
|
|
36352
36588
|
init_constants3();
|
|
36353
36589
|
init_env_flag();
|
|
@@ -36446,7 +36682,7 @@ var init_webhook = __esm(() => {
|
|
|
36446
36682
|
// src/jira/index.ts
|
|
36447
36683
|
var init_jira = __esm(() => {
|
|
36448
36684
|
init_adf();
|
|
36449
|
-
|
|
36685
|
+
init_app2();
|
|
36450
36686
|
init_sync2();
|
|
36451
36687
|
init_webhook();
|
|
36452
36688
|
init_webhook_lifecycle();
|
|
@@ -108957,7 +109193,7 @@ function warnIfMcpBaseUrlLooksLikeAppUrl2() {
|
|
|
108957
109193
|
}
|
|
108958
109194
|
}
|
|
108959
109195
|
var initialized7 = false, unsubscribeRefresh = null;
|
|
108960
|
-
var
|
|
109196
|
+
var init_app3 = __esm(() => {
|
|
108961
109197
|
init_oauth();
|
|
108962
109198
|
init_ensure_token();
|
|
108963
109199
|
init_constants3();
|
|
@@ -108968,7 +109204,7 @@ var init_app2 = __esm(() => {
|
|
|
108968
109204
|
|
|
108969
109205
|
// src/linear/index.ts
|
|
108970
109206
|
var init_linear = __esm(() => {
|
|
108971
|
-
|
|
109207
|
+
init_app3();
|
|
108972
109208
|
});
|
|
108973
109209
|
|
|
108974
109210
|
// src/slack/files.ts
|
|
@@ -109200,7 +109436,7 @@ var init_router = __esm(() => {
|
|
|
109200
109436
|
|
|
109201
109437
|
// src/slack/index.ts
|
|
109202
109438
|
var init_slack = __esm(() => {
|
|
109203
|
-
|
|
109439
|
+
init_app4();
|
|
109204
109440
|
init_files();
|
|
109205
109441
|
init_router();
|
|
109206
109442
|
});
|
|
@@ -109494,7 +109730,7 @@ async function resolveHttpRequestAuth(req, apiKey, options = {}) {
|
|
|
109494
109730
|
return null;
|
|
109495
109731
|
}
|
|
109496
109732
|
function isActiveUser(user) {
|
|
109497
|
-
return !!user && user.status === "active";
|
|
109733
|
+
return !!user && user.status === "active" && !user.mergedIntoUserId;
|
|
109498
109734
|
}
|
|
109499
109735
|
var init_auth = __esm(() => {
|
|
109500
109736
|
init_db4();
|
|
@@ -109624,11 +109860,11 @@ var init_openapi = __esm(() => {
|
|
|
109624
109860
|
});
|
|
109625
109861
|
|
|
109626
109862
|
// src/http/core.ts
|
|
109627
|
-
function
|
|
109863
|
+
function getDeploymentEnvValue2(key) {
|
|
109628
109864
|
const tracked = injectedEnvOriginals.get(key);
|
|
109629
109865
|
return tracked && process.env[key] === tracked.injected ? tracked.original : process.env[key];
|
|
109630
109866
|
}
|
|
109631
|
-
async function
|
|
109867
|
+
async function loadGlobalConfigsIntoEnv2(override = false) {
|
|
109632
109868
|
const globalConfigs = await getInjectableGlobalConfigs2();
|
|
109633
109869
|
const updated = [];
|
|
109634
109870
|
const liveKeys = new Set;
|
|
@@ -109664,15 +109900,17 @@ async function loadGlobalConfigsIntoEnv(override = false) {
|
|
|
109664
109900
|
if (updated.length > 0) {
|
|
109665
109901
|
refreshSecretScrubberCache();
|
|
109666
109902
|
}
|
|
109903
|
+
const { syncSlackTreeVisibility } = await import("./tree-visibility-6vqmnr71.js");
|
|
109904
|
+
await syncSlackTreeVisibility();
|
|
109667
109905
|
return updated;
|
|
109668
109906
|
}
|
|
109669
|
-
async function
|
|
109907
|
+
async function reloadGlobalConfigsAndIntegrations2() {
|
|
109670
109908
|
return runWithoutRequestAuth(() => runSlackLifecycleExclusive(() => reloadGlobalConfigsAndIntegrationsInner()));
|
|
109671
109909
|
}
|
|
109672
109910
|
async function reloadGlobalConfigsAndIntegrationsInner() {
|
|
109673
|
-
const { getEmbeddingProvider, resetEmbeddingProvider } = await import("./index-
|
|
109911
|
+
const { getEmbeddingProvider, resetEmbeddingProvider } = await import("./index-kqv9ebfj.js");
|
|
109674
109912
|
const wasEmbeddingsConfigured = getEmbeddingProvider().isConfigured();
|
|
109675
|
-
const updated = await
|
|
109913
|
+
const updated = await loadGlobalConfigsIntoEnv2(true);
|
|
109676
109914
|
await syncTelemetryEnabled("settings").catch((err) => {
|
|
109677
109915
|
console.error("[config-reload] telemetry re-init failed (non-fatal):", err);
|
|
109678
109916
|
});
|
|
@@ -109686,7 +109924,7 @@ async function reloadGlobalConfigsAndIntegrationsInner() {
|
|
|
109686
109924
|
integrations.push("embeddings");
|
|
109687
109925
|
}
|
|
109688
109926
|
if (isEmbeddingsConfigured) {
|
|
109689
|
-
import("./embedding-space-
|
|
109927
|
+
import("./embedding-space-z6ptw3jk.js").then(({ runEmbeddingMaintenance }) => runEmbeddingMaintenance({ backfill: !wasEmbeddingsConfigured })).catch((err) => {
|
|
109690
109928
|
console.error("[config-reload] embedding maintenance failed (non-fatal):", err);
|
|
109691
109929
|
});
|
|
109692
109930
|
}
|
|
@@ -109729,7 +109967,7 @@ async function reloadGlobalConfigsAndIntegrationsInner() {
|
|
|
109729
109967
|
integrationsReinitialized: integrations
|
|
109730
109968
|
};
|
|
109731
109969
|
}
|
|
109732
|
-
function
|
|
109970
|
+
function scheduleIntegrationsReload2(delayMs = AUTO_RELOAD_DEBOUNCE_MS) {
|
|
109733
109971
|
if (inFlightReload) {
|
|
109734
109972
|
reloadRerunRequested = true;
|
|
109735
109973
|
return;
|
|
@@ -109740,7 +109978,7 @@ function scheduleIntegrationsReload(delayMs = AUTO_RELOAD_DEBOUNCE_MS) {
|
|
|
109740
109978
|
pendingReloadTimer = setTimeout(() => {
|
|
109741
109979
|
pendingReloadTimer = null;
|
|
109742
109980
|
autoReloadInvocations += 1;
|
|
109743
|
-
inFlightReload =
|
|
109981
|
+
inFlightReload = reloadGlobalConfigsAndIntegrations2().then((r) => {
|
|
109744
109982
|
console.log(`[auto-reload] Loaded ${r.configsLoaded} config(s), re-initialized: ${r.integrationsReinitialized.join(", ") || "none"}`);
|
|
109745
109983
|
return r;
|
|
109746
109984
|
}).catch((err) => {
|
|
@@ -109751,7 +109989,7 @@ function scheduleIntegrationsReload(delayMs = AUTO_RELOAD_DEBOUNCE_MS) {
|
|
|
109751
109989
|
inFlightReload = null;
|
|
109752
109990
|
if (reloadRerunRequested) {
|
|
109753
109991
|
reloadRerunRequested = false;
|
|
109754
|
-
|
|
109992
|
+
scheduleIntegrationsReload2(delayMs);
|
|
109755
109993
|
}
|
|
109756
109994
|
});
|
|
109757
109995
|
}, delayMs);
|
|
@@ -109760,7 +109998,7 @@ function singleHeader2(req, name) {
|
|
|
109760
109998
|
const raw = req.headers[name];
|
|
109761
109999
|
return Array.isArray(raw) ? raw[0] : raw;
|
|
109762
110000
|
}
|
|
109763
|
-
async function
|
|
110001
|
+
async function handleCore2(req, res, myAgentId, apiKey) {
|
|
109764
110002
|
beginRequestAuthScope();
|
|
109765
110003
|
let auth = await resolveHttpRequestAuth(req, apiKey);
|
|
109766
110004
|
if (auth?.kind === "controller") {
|
|
@@ -109896,7 +110134,7 @@ async function handleCore(req, res, myAgentId, apiKey) {
|
|
|
109896
110134
|
}
|
|
109897
110135
|
if (req.method === "POST" && req.url === "/internal/reload-config") {
|
|
109898
110136
|
try {
|
|
109899
|
-
const result = await
|
|
110137
|
+
const result = await reloadGlobalConfigsAndIntegrations2();
|
|
109900
110138
|
console.log(`[reload-config] Loaded ${result.configsLoaded} config(s), re-initialized: ${result.integrationsReinitialized.join(", ") || "none"}`);
|
|
109901
110139
|
res.writeHead(200, { "Content-Type": "application/json" });
|
|
109902
110140
|
res.end(JSON.stringify({ success: true, ...result }));
|
|
@@ -119978,18 +120216,45 @@ function inheritedModelSelection2(parent) {
|
|
|
119978
120216
|
...parent.profile ? { profile: parent.profile } : {}
|
|
119979
120217
|
};
|
|
119980
120218
|
}
|
|
120219
|
+
async function keyPoolOf(parent, profileName, options) {
|
|
120220
|
+
const keyType = parent.credentialKeyType;
|
|
120221
|
+
if (!keyType || !parent.credentialKeySuffix || !parent.agentId)
|
|
120222
|
+
return null;
|
|
120223
|
+
const profile = await getModelProfileByName(profileName);
|
|
120224
|
+
if (!profile || hasUnreadableCredentialAllowlist(profile)) {
|
|
120225
|
+
return null;
|
|
120226
|
+
}
|
|
120227
|
+
const pools = await configPools(parent.agentId, {
|
|
120228
|
+
vcsRepo: parent.vcsRepo,
|
|
120229
|
+
includeRepoSecrets: options.includeRepoSecrets
|
|
120230
|
+
});
|
|
120231
|
+
const pool = pools.get(keyType);
|
|
120232
|
+
if (pool === undefined)
|
|
120233
|
+
return null;
|
|
120234
|
+
const suffixes = splitCredentialPool(pool).map(keySuffix);
|
|
120235
|
+
const allowlist = profile.credentials?.[keyType];
|
|
120236
|
+
const usable = (suffix) => !allowlist || allowlist.includes(suffix);
|
|
120237
|
+
const size = suffixes.filter(usable).length;
|
|
120238
|
+
if (size < 2)
|
|
120239
|
+
return null;
|
|
120240
|
+
const family = modelFamilyOf(parent.resolvedModel ?? profile.model);
|
|
120241
|
+
const { availableIndices } = await getAvailableKeyIndices2(keyType, suffixes.length, "global", null, family && windowForModelFamily(family) ? family : undefined, suffixes);
|
|
120242
|
+
const free = availableIndices.map((i) => suffixes[i]).filter((suffix) => usable(suffix) && suffix !== parent.credentialKeySuffix).length;
|
|
120243
|
+
return { keyType, size, free };
|
|
120244
|
+
}
|
|
119981
120245
|
async function nextFallback2(parent, errorClass, options = {}) {
|
|
119982
120246
|
const current = parent.resolvedProfile;
|
|
119983
120247
|
if (!current || !parent.agentId)
|
|
119984
120248
|
return { kind: "none", message: null };
|
|
119985
120249
|
const hops = parent.fallbackHops ?? [];
|
|
119986
|
-
const
|
|
120250
|
+
const profileHops = hops.filter((hop) => hop.from !== hop.profile);
|
|
120251
|
+
const path = profileHops.length > 0 ? [profileHops[0].from, ...profileHops.map((hop) => hop.profile)] : [current];
|
|
119987
120252
|
if (path[path.length - 1] !== current)
|
|
119988
120253
|
path.push(current);
|
|
119989
120254
|
const visited = new Set(path);
|
|
119990
120255
|
const skipped = [];
|
|
119991
120256
|
const judged = new Set;
|
|
119992
|
-
let configured =
|
|
120257
|
+
let configured = profileHops.length > 0;
|
|
119993
120258
|
if (parent.routingAffinity?.leadOnly) {
|
|
119994
120259
|
const agent = await getAgentById2(parent.agentId);
|
|
119995
120260
|
if (!agent?.isLead || !isAgentEligibleForTask2(agent, parent)) {
|
|
@@ -120002,6 +120267,21 @@ async function nextFallback2(parent, errorClass, options = {}) {
|
|
|
120002
120267
|
};
|
|
120003
120268
|
}
|
|
120004
120269
|
}
|
|
120270
|
+
let keysExhausted = "";
|
|
120271
|
+
if (KEY_SCOPED_ERRORS.has(errorClass)) {
|
|
120272
|
+
const pool = await keyPoolOf(parent, current, options);
|
|
120273
|
+
if (pool) {
|
|
120274
|
+
const retries = hops.filter((hop) => hop.from === current && hop.profile === current).length;
|
|
120275
|
+
if (pool.free > 0 && retries < pool.size) {
|
|
120276
|
+
return {
|
|
120277
|
+
kind: "picked",
|
|
120278
|
+
profile: current,
|
|
120279
|
+
hop: { from: current, profile: current, errorClass, at: new Date().toISOString() }
|
|
120280
|
+
};
|
|
120281
|
+
}
|
|
120282
|
+
keysExhausted = pool.free > 0 ? `no key retry left (${retries} retries on a pool of ${pool.size} ${pool.keyType} keys); ` : `no key left (all ${pool.size} ${pool.keyType} keys are rate-limited or just failed); `;
|
|
120283
|
+
}
|
|
120284
|
+
}
|
|
120005
120285
|
for (let i = path.length - 1;i >= 0; i--) {
|
|
120006
120286
|
const profile = await getModelProfileByName(path[i]);
|
|
120007
120287
|
for (const name of profile?.fallbacks ?? []) {
|
|
@@ -120030,12 +120310,16 @@ async function nextFallback2(parent, errorClass, options = {}) {
|
|
|
120030
120310
|
skipped.push({ profile: name, reason: result ? firstFailingRow(result) : "not found" });
|
|
120031
120311
|
}
|
|
120032
120312
|
}
|
|
120033
|
-
if (!configured)
|
|
120034
|
-
return {
|
|
120313
|
+
if (!configured) {
|
|
120314
|
+
return {
|
|
120315
|
+
kind: "none",
|
|
120316
|
+
message: keysExhausted ? `${errorClass} on ${current}; ${keysExhausted}no fallback configured` : null
|
|
120317
|
+
};
|
|
120318
|
+
}
|
|
120035
120319
|
const skippedText = skipped.length > 0 ? `; skipped: ${skipped.map((s) => `${s.profile} (${s.reason})`).join(", ")}` : "";
|
|
120036
120320
|
return {
|
|
120037
120321
|
kind: "none",
|
|
120038
|
-
message: `${errorClass} on ${current}; no fallback left (tried: ${path.join(" → ")})${skippedText}`
|
|
120322
|
+
message: `${errorClass} on ${current}; ${keysExhausted}no fallback left (tried: ${path.join(" → ")})${skippedText}`
|
|
120039
120323
|
};
|
|
120040
120324
|
}
|
|
120041
120325
|
function firstFailingRow(result) {
|
|
@@ -120331,10 +120615,11 @@ async function createResumeFollowUp2(args) {
|
|
|
120331
120615
|
].join(`
|
|
120332
120616
|
`);
|
|
120333
120617
|
const priority = Math.min(100, (parent.priority ?? 50) + 10);
|
|
120618
|
+
const generation = args.reason === "provider_fallback" ? getResumeGeneration2(parent) : getNextResumeGeneration2(parent);
|
|
120334
120619
|
const tags = [
|
|
120335
120620
|
"auto-resume",
|
|
120336
120621
|
`reason:${args.reason}`,
|
|
120337
|
-
`${RESUME_GENERATION_TAG_PREFIX}${
|
|
120622
|
+
...generation > 0 ? [`${RESUME_GENERATION_TAG_PREFIX}${generation}`] : []
|
|
120338
120623
|
];
|
|
120339
120624
|
if (args.reason === "crash_recovery" && preferredAgentId === parent.agentId) {
|
|
120340
120625
|
tags.push(CRASH_RECOVERY_PIN_TAG);
|
|
@@ -120465,7 +120750,7 @@ async function createPoolStarvationDecisionTask2(args) {
|
|
|
120465
120750
|
});
|
|
120466
120751
|
return { kind: "created", task: created };
|
|
120467
120752
|
}
|
|
120468
|
-
var TaskFollowUpModifySchema, WORKER_LIVENESS_WINDOW_SECONDS, RESUME_GENERATION_TAG_PREFIX = "resume-generation:", CRASH_RECOVERY_PIN_TAG = "crash-recovery-pin", GRACEFUL_SHUTDOWN_PIN_TAG = "graceful-shutdown-pin", REBOOT_RETRY_PIN_TAG2 = "reboot-retry-pin", LIVE_CHAINED_TASK_STATUSES, MAX_CONTINUATION_HOPS = 32;
|
|
120753
|
+
var TaskFollowUpModifySchema, WORKER_LIVENESS_WINDOW_SECONDS, RESUME_GENERATION_TAG_PREFIX = "resume-generation:", CRASH_RECOVERY_PIN_TAG = "crash-recovery-pin", GRACEFUL_SHUTDOWN_PIN_TAG = "graceful-shutdown-pin", REBOOT_RETRY_PIN_TAG2 = "reboot-retry-pin", KEY_SCOPED_ERRORS, LIVE_CHAINED_TASK_STATUSES, MAX_CONTINUATION_HOPS = 32;
|
|
120469
120754
|
var init_worker_follow_up = __esm(() => {
|
|
120470
120755
|
init_zod();
|
|
120471
120756
|
init_db4();
|
|
@@ -120478,7 +120763,9 @@ var init_worker_follow_up = __esm(() => {
|
|
|
120478
120763
|
init_resolver();
|
|
120479
120764
|
init_deferred_task_waits();
|
|
120480
120765
|
init_types5();
|
|
120766
|
+
init_credentials2();
|
|
120481
120767
|
init_env_flag();
|
|
120768
|
+
init_model_rate_limit_windows();
|
|
120482
120769
|
init_task_attachment_links();
|
|
120483
120770
|
init_context_key();
|
|
120484
120771
|
init_follow_up_gate();
|
|
@@ -120491,6 +120778,7 @@ var init_worker_follow_up = __esm(() => {
|
|
|
120491
120778
|
followUpConfig: true
|
|
120492
120779
|
}).partial().extend({ description: string2().trim().min(1).optional() }).strict();
|
|
120493
120780
|
WORKER_LIVENESS_WINDOW_SECONDS = Number(process.env.WORKER_LIVENESS_WINDOW_SECONDS || "30");
|
|
120781
|
+
KEY_SCOPED_ERRORS = new Set(["rate_limit", "credits"]);
|
|
120494
120782
|
LIVE_CHAINED_TASK_STATUSES = new Set([
|
|
120495
120783
|
"offered",
|
|
120496
120784
|
"reviewing",
|
|
@@ -123936,6 +124224,32 @@ var init_memory_rate = __esm(() => {
|
|
|
123936
124224
|
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
124225
|
});
|
|
123938
124226
|
|
|
124227
|
+
// src/be/memory/demotion-evidence.ts
|
|
124228
|
+
async function attachDemotionEvidence(candidates) {
|
|
124229
|
+
const ids = [...new Set(candidates.filter((c) => c.beta > c.alpha).map((c) => c.id))];
|
|
124230
|
+
if (ids.length === 0)
|
|
124231
|
+
return candidates;
|
|
124232
|
+
const rows = await getDbClient2().query(`SELECT memoryId,
|
|
124233
|
+
SUM(CASE WHEN source = 'explicit-self' AND signal > 0 THEN signal * weight ELSE 0 END) AS selfAlpha,
|
|
124234
|
+
SUM(CASE WHEN source = 'explicit-self' AND signal < 0 THEN -signal * weight ELSE 0 END) AS selfBeta,
|
|
124235
|
+
SUM(CASE WHEN source = 'llm' AND signal > 0 THEN signal * weight ELSE 0 END) AS llmAlpha,
|
|
124236
|
+
SUM(CASE WHEN source = 'llm' AND signal < 0 THEN -signal * weight ELSE 0 END) AS llmBeta,
|
|
124237
|
+
SUM(CASE WHEN source = 'llm' THEN 1 ELSE 0 END) AS llmCount
|
|
124238
|
+
FROM memory_rating
|
|
124239
|
+
WHERE source IN ('explicit-self', 'llm') AND memoryId IN (${ids.map(() => "?").join(", ")})
|
|
124240
|
+
GROUP BY memoryId`, ids);
|
|
124241
|
+
if (rows.length === 0)
|
|
124242
|
+
return candidates;
|
|
124243
|
+
const byId = new Map(rows.map(({ memoryId, ...evidence }) => [memoryId, evidence]));
|
|
124244
|
+
return candidates.map((c) => {
|
|
124245
|
+
const demotionEvidence = byId.get(c.id);
|
|
124246
|
+
return demotionEvidence ? { ...c, demotionEvidence } : c;
|
|
124247
|
+
});
|
|
124248
|
+
}
|
|
124249
|
+
var init_demotion_evidence = __esm(() => {
|
|
124250
|
+
init_db4();
|
|
124251
|
+
});
|
|
124252
|
+
|
|
123939
124253
|
// src/be/memory/graph-expansion.ts
|
|
123940
124254
|
function addNeighborScopeConditions(conditions, params, agentId, scope, isLead) {
|
|
123941
124255
|
if (!isLead) {
|
|
@@ -124078,22 +124392,25 @@ var NUDGE_ELIGIBLE_SOURCES2, memorySearchOutputSchema, registerMemorySearchTool
|
|
|
124078
124392
|
const store = getMemoryStore2();
|
|
124079
124393
|
const queryEmbedding = await provider.embed(query, { kind: "query" });
|
|
124080
124394
|
const candidateLimit = limit * CANDIDATE_SET_MULTIPLIER;
|
|
124395
|
+
const excludeReviewTaskCompletions = await isReviewTaskId(requestInfo.sourceTaskId);
|
|
124081
124396
|
const candidates = await searchMemoryCandidates(store, queryEmbedding ?? new Float32Array(0), requestInfo.agentId, {
|
|
124082
124397
|
scope,
|
|
124083
124398
|
limit: candidateLimit,
|
|
124084
124399
|
source,
|
|
124085
124400
|
isLead,
|
|
124086
124401
|
queryText: query,
|
|
124087
|
-
keyPrefix
|
|
124402
|
+
keyPrefix,
|
|
124403
|
+
excludeReviewTaskCompletions
|
|
124088
124404
|
});
|
|
124089
|
-
const
|
|
124405
|
+
const graphExpanded = await expandCandidatesWithGraph(candidates, requestInfo.agentId, {
|
|
124090
124406
|
scope,
|
|
124091
124407
|
source,
|
|
124092
124408
|
keyPrefix,
|
|
124093
124409
|
isLead
|
|
124094
124410
|
});
|
|
124411
|
+
const expanded = excludeReviewTaskCompletions ? await dropReviewTaskCompletions(graphExpanded) : graphExpanded;
|
|
124095
124412
|
if (expanded.length > 0) {
|
|
124096
|
-
const ranked = rerank(expanded, { limit });
|
|
124413
|
+
const ranked = rerank(await attachDemotionEvidence(expanded), { limit });
|
|
124097
124414
|
if (requestInfo.sourceTaskId) {
|
|
124098
124415
|
try {
|
|
124099
124416
|
await recordRetrievals(requestInfo.sourceTaskId, requestInfo.agentId, ranked.map((r) => ({
|
|
@@ -124132,13 +124449,14 @@ var NUDGE_ELIGIBLE_SOURCES2, memorySearchOutputSchema, registerMemorySearchTool
|
|
|
124132
124449
|
data: { yourAgentId: requestInfo.agentId, results: mapped }
|
|
124133
124450
|
});
|
|
124134
124451
|
}
|
|
124135
|
-
const
|
|
124452
|
+
const listed = await store.list(requestInfo.agentId, {
|
|
124136
124453
|
scope,
|
|
124137
124454
|
limit,
|
|
124138
124455
|
isLead,
|
|
124139
124456
|
source,
|
|
124140
124457
|
keyPrefix
|
|
124141
124458
|
});
|
|
124459
|
+
const recent = excludeReviewTaskCompletions ? await dropReviewTaskCompletions(listed) : listed;
|
|
124142
124460
|
const consumedIds = dedupeMemoryDocumentIds(recent);
|
|
124143
124461
|
try {
|
|
124144
124462
|
await recordMemoryAccesses(consumedIds);
|
|
@@ -124167,10 +124485,12 @@ var init_memory_search = __esm(() => {
|
|
|
124167
124485
|
init_db4();
|
|
124168
124486
|
init_memory();
|
|
124169
124487
|
init_constants2();
|
|
124488
|
+
init_demotion_evidence();
|
|
124170
124489
|
init_graph_expansion();
|
|
124171
124490
|
init_key_paths();
|
|
124172
124491
|
init_retrieval();
|
|
124173
124492
|
init_reranker();
|
|
124493
|
+
init_review_recall_filter();
|
|
124174
124494
|
init_search_candidates();
|
|
124175
124495
|
init_utils();
|
|
124176
124496
|
init_types5();
|
|
@@ -136754,7 +137074,7 @@ var init_slack_archive_channel = __esm(() => {
|
|
|
136754
137074
|
init_zod();
|
|
136755
137075
|
init_db4();
|
|
136756
137076
|
init_rbac();
|
|
136757
|
-
|
|
137077
|
+
init_app4();
|
|
136758
137078
|
init_channel_join();
|
|
136759
137079
|
init_channel_lifecycle();
|
|
136760
137080
|
init_utils();
|
|
@@ -136816,7 +137136,7 @@ var init_slack_create_channel = __esm(() => {
|
|
|
136816
137136
|
init_zod();
|
|
136817
137137
|
init_db4();
|
|
136818
137138
|
init_rbac();
|
|
136819
|
-
|
|
137139
|
+
init_app4();
|
|
136820
137140
|
init_channel_join();
|
|
136821
137141
|
init_channel_lifecycle();
|
|
136822
137142
|
init_utils();
|
|
@@ -137167,7 +137487,7 @@ var init_slack_delete = __esm(() => {
|
|
|
137167
137487
|
init_zod();
|
|
137168
137488
|
init_db4();
|
|
137169
137489
|
init_rbac();
|
|
137170
|
-
|
|
137490
|
+
init_app4();
|
|
137171
137491
|
init_message_text();
|
|
137172
137492
|
init_utils();
|
|
137173
137493
|
});
|
|
@@ -137709,7 +138029,7 @@ ${fetchCommand}`,
|
|
|
137709
138029
|
var init_slack_download_file = __esm(() => {
|
|
137710
138030
|
init_zod();
|
|
137711
138031
|
init_db4();
|
|
137712
|
-
|
|
138032
|
+
init_app4();
|
|
137713
138033
|
init_files();
|
|
137714
138034
|
init_inbound_files();
|
|
137715
138035
|
init_utils();
|
|
@@ -137770,7 +138090,7 @@ var init_slack_invite_to_channel = __esm(() => {
|
|
|
137770
138090
|
init_zod();
|
|
137771
138091
|
init_db4();
|
|
137772
138092
|
init_rbac();
|
|
137773
|
-
|
|
138093
|
+
init_app4();
|
|
137774
138094
|
init_channel_join();
|
|
137775
138095
|
init_channel_lifecycle();
|
|
137776
138096
|
init_utils();
|
|
@@ -137936,7 +138256,7 @@ var SlackChannelSchema, registerSlackListChannelsTool = (server) => {
|
|
|
137936
138256
|
var init_slack_list_channels = __esm(() => {
|
|
137937
138257
|
init_zod();
|
|
137938
138258
|
init_db4();
|
|
137939
|
-
|
|
138259
|
+
init_app4();
|
|
137940
138260
|
init_utils();
|
|
137941
138261
|
SlackChannelSchema = looseObject({
|
|
137942
138262
|
id: string2().optional(),
|
|
@@ -138070,7 +138390,7 @@ var init_slack_post = __esm(() => {
|
|
|
138070
138390
|
init_db4();
|
|
138071
138391
|
init_cards();
|
|
138072
138392
|
init_rbac();
|
|
138073
|
-
|
|
138393
|
+
init_app4();
|
|
138074
138394
|
init_blocks();
|
|
138075
138395
|
init_channel_join();
|
|
138076
138396
|
init_dm();
|
|
@@ -138306,7 +138626,7 @@ var init_slack_read = __esm(() => {
|
|
|
138306
138626
|
init_zod();
|
|
138307
138627
|
init_db4();
|
|
138308
138628
|
init_rbac();
|
|
138309
|
-
|
|
138629
|
+
init_app4();
|
|
138310
138630
|
init_channel_join();
|
|
138311
138631
|
init_dm();
|
|
138312
138632
|
init_external_channel();
|
|
@@ -138491,7 +138811,7 @@ var init_slack_reply = __esm(() => {
|
|
|
138491
138811
|
init_db4();
|
|
138492
138812
|
init_task_citations2();
|
|
138493
138813
|
init_cards();
|
|
138494
|
-
|
|
138814
|
+
init_app4();
|
|
138495
138815
|
init_blocks();
|
|
138496
138816
|
init_channel_join();
|
|
138497
138817
|
init_external_channel();
|
|
@@ -138592,7 +138912,7 @@ var init_slack_start_thread = __esm(() => {
|
|
|
138592
138912
|
init_zod();
|
|
138593
138913
|
init_db4();
|
|
138594
138914
|
init_rbac();
|
|
138595
|
-
|
|
138915
|
+
init_app4();
|
|
138596
138916
|
init_blocks();
|
|
138597
138917
|
init_channel_join();
|
|
138598
138918
|
init_dm();
|
|
@@ -138684,7 +139004,7 @@ var init_slack_update = __esm(() => {
|
|
|
138684
139004
|
init_zod();
|
|
138685
139005
|
init_db4();
|
|
138686
139006
|
init_rbac();
|
|
138687
|
-
|
|
139007
|
+
init_app4();
|
|
138688
139008
|
init_blocks();
|
|
138689
139009
|
init_external_channel();
|
|
138690
139010
|
init_message_text();
|
|
@@ -138887,7 +139207,7 @@ var init_slack_upload_file = __esm(() => {
|
|
|
138887
139207
|
init_zod();
|
|
138888
139208
|
init_db4();
|
|
138889
139209
|
init_rbac();
|
|
138890
|
-
|
|
139210
|
+
init_app4();
|
|
138891
139211
|
init_external_channel();
|
|
138892
139212
|
init_files();
|
|
138893
139213
|
init_utils();
|
|
@@ -139178,6 +139498,259 @@ var init_task_skip = __esm(() => {
|
|
|
139178
139498
|
init_secret_scrubber();
|
|
139179
139499
|
});
|
|
139180
139500
|
|
|
139501
|
+
// src/ui-spec/schema.ts
|
|
139502
|
+
var TaskUiSpecActionInputSchema, TaskUiSpecInputSchema;
|
|
139503
|
+
var init_schema2 = __esm(() => {
|
|
139504
|
+
init_zod();
|
|
139505
|
+
init_task_ui_spec2();
|
|
139506
|
+
TaskUiSpecActionInputSchema = discriminatedUnion("kind", [
|
|
139507
|
+
object2({ kind: literal2("follow_up"), prompt: string2().min(1).max(4000) }),
|
|
139508
|
+
object2({
|
|
139509
|
+
kind: literal2("script"),
|
|
139510
|
+
script: string2().min(1).max(200).describe("A global script named in UI_SPEC_SCRIPT_ACTIONS."),
|
|
139511
|
+
args: record2(string2(), unknown()).optional().describe("Frozen script input, at most 4 KB of JSON. A click sends no input.")
|
|
139512
|
+
})
|
|
139513
|
+
]);
|
|
139514
|
+
TaskUiSpecInputSchema = object2({
|
|
139515
|
+
spec: object2({
|
|
139516
|
+
root: string2().min(1),
|
|
139517
|
+
elements: record2(string2(), unknown()),
|
|
139518
|
+
state: record2(string2(), unknown()).optional()
|
|
139519
|
+
}).describe("A json-render spec for the chat catalog. Root must be a Card."),
|
|
139520
|
+
actions: record2(string2().regex(UI_SPEC_ACTION_ID), TaskUiSpecActionInputSchema).refine((actions) => Object.keys(actions).length <= UI_SPEC_MAX_ACTIONS, {
|
|
139521
|
+
message: `At most ${UI_SPEC_MAX_ACTIONS} actions.`
|
|
139522
|
+
}).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.`)
|
|
139523
|
+
});
|
|
139524
|
+
});
|
|
139525
|
+
|
|
139526
|
+
// src/ui-spec/script-actions.ts
|
|
139527
|
+
async function readScriptActionAllowlist() {
|
|
139528
|
+
const [row] = await getSwarmConfigs2({ scope: "global", key: UI_SPEC_SCRIPT_ACTIONS_KEY });
|
|
139529
|
+
if (row)
|
|
139530
|
+
return row.value;
|
|
139531
|
+
const { getDeploymentEnvValue } = await import("./core-df1n049h.js");
|
|
139532
|
+
return getDeploymentEnvValue(UI_SPEC_SCRIPT_ACTIONS_KEY);
|
|
139533
|
+
}
|
|
139534
|
+
async function loadScriptActionLookups() {
|
|
139535
|
+
return {
|
|
139536
|
+
allPins: parseScriptActionAllowlist(await readScriptActionAllowlist()).pins,
|
|
139537
|
+
scripts: new Map
|
|
139538
|
+
};
|
|
139539
|
+
}
|
|
139540
|
+
async function resolveScriptAction(actionId, action, lookups) {
|
|
139541
|
+
const { allPins, scripts } = lookups ?? await loadScriptActionLookups();
|
|
139542
|
+
const pins = allPins.filter((pin) => pin.name === action.script);
|
|
139543
|
+
if (pins.length === 0) {
|
|
139544
|
+
return {
|
|
139545
|
+
ok: false,
|
|
139546
|
+
reason: "not_allowlisted",
|
|
139547
|
+
issue: `Action "${actionId}" runs script "${action.script}", which is not allowlisted in UI_SPEC_SCRIPT_ACTIONS.`
|
|
139548
|
+
};
|
|
139549
|
+
}
|
|
139550
|
+
let lookup = scripts.get(action.script);
|
|
139551
|
+
if (!lookup) {
|
|
139552
|
+
lookup = getScript({ name: action.script, scope: "global" });
|
|
139553
|
+
scripts.set(action.script, lookup);
|
|
139554
|
+
}
|
|
139555
|
+
const script = await lookup;
|
|
139556
|
+
if (!script) {
|
|
139557
|
+
return {
|
|
139558
|
+
ok: false,
|
|
139559
|
+
reason: "missing",
|
|
139560
|
+
issue: `Action "${actionId}" runs script "${action.script}", which is not a global script.`
|
|
139561
|
+
};
|
|
139562
|
+
}
|
|
139563
|
+
if (!pins.some((pin) => script.contentHash.toLowerCase().startsWith(pin.hashPrefix))) {
|
|
139564
|
+
return {
|
|
139565
|
+
ok: false,
|
|
139566
|
+
reason: "script_changed",
|
|
139567
|
+
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.`
|
|
139568
|
+
};
|
|
139569
|
+
}
|
|
139570
|
+
return { ok: true, script };
|
|
139571
|
+
}
|
|
139572
|
+
function argsIssue(actionId, action, script) {
|
|
139573
|
+
const args = action.args ?? {};
|
|
139574
|
+
const bytes = new TextEncoder().encode(JSON.stringify(args)).length;
|
|
139575
|
+
if (bytes > UI_SPEC_SCRIPT_ARGS_MAX_BYTES) {
|
|
139576
|
+
return `Action "${actionId}" args are ${bytes} bytes; the limit is ${UI_SPEC_SCRIPT_ARGS_MAX_BYTES}.`;
|
|
139577
|
+
}
|
|
139578
|
+
if (!script.argsJsonSchema)
|
|
139579
|
+
return null;
|
|
139580
|
+
let schema;
|
|
139581
|
+
try {
|
|
139582
|
+
schema = JSON.parse(script.argsJsonSchema);
|
|
139583
|
+
} catch {
|
|
139584
|
+
return `Action "${actionId}": script "${script.name}" has an unreadable argsJsonSchema.`;
|
|
139585
|
+
}
|
|
139586
|
+
const errors = validateJsonSchema(schema, args);
|
|
139587
|
+
return errors.length > 0 ? `Action "${actionId}" args do not match the script's argsJsonSchema: ${errors[0]}` : null;
|
|
139588
|
+
}
|
|
139589
|
+
async function scriptActionIssues(actions) {
|
|
139590
|
+
const issues = [];
|
|
139591
|
+
let lookups;
|
|
139592
|
+
for (const [actionId, action] of Object.entries(actions ?? {})) {
|
|
139593
|
+
if (action.kind !== "script")
|
|
139594
|
+
continue;
|
|
139595
|
+
if (!isEnvFlagEnabled("UI_SPEC_ACTIONS_ENABLED", false)) {
|
|
139596
|
+
issues.push(`Action "${actionId}" needs UI_SPEC_ACTIONS_ENABLED=true.`);
|
|
139597
|
+
continue;
|
|
139598
|
+
}
|
|
139599
|
+
lookups ??= await loadScriptActionLookups();
|
|
139600
|
+
const resolved = await resolveScriptAction(actionId, action, lookups);
|
|
139601
|
+
const issue = resolved.ok ? argsIssue(actionId, action, resolved.script) : resolved.issue;
|
|
139602
|
+
if (issue)
|
|
139603
|
+
issues.push(issue);
|
|
139604
|
+
}
|
|
139605
|
+
return issues;
|
|
139606
|
+
}
|
|
139607
|
+
async function scriptActionPinIssues(actions) {
|
|
139608
|
+
const scriptActions = Object.entries(actions ?? {}).filter((entry) => entry[1].kind === "script");
|
|
139609
|
+
if (scriptActions.length === 0)
|
|
139610
|
+
return [];
|
|
139611
|
+
const allPins = parseScriptActionAllowlist(await readScriptActionAllowlist()).pins;
|
|
139612
|
+
const hashes = await getGlobalScriptContentHashes([
|
|
139613
|
+
...new Set(scriptActions.map(([, action]) => action.script))
|
|
139614
|
+
]);
|
|
139615
|
+
const issues = [];
|
|
139616
|
+
for (const [actionId, action] of scriptActions) {
|
|
139617
|
+
const hash = hashes.get(action.script)?.toLowerCase();
|
|
139618
|
+
const pins = allPins.filter((pin) => pin.name === action.script);
|
|
139619
|
+
if (!hash || !pins.some((pin) => hash.startsWith(pin.hashPrefix))) {
|
|
139620
|
+
issues.push(`Action "${actionId}": script "${action.script}" is no longer allowlisted at its current contentHash in UI_SPEC_SCRIPT_ACTIONS.`);
|
|
139621
|
+
}
|
|
139622
|
+
}
|
|
139623
|
+
return issues;
|
|
139624
|
+
}
|
|
139625
|
+
function shortError(text) {
|
|
139626
|
+
const line = scrubSecrets(text).replace(/\s+/g, " ").trim();
|
|
139627
|
+
return line.length > 300 ? `${line.slice(0, 297)}...` : line;
|
|
139628
|
+
}
|
|
139629
|
+
async function runAndValidate(task, action, script, stored) {
|
|
139630
|
+
if (!task.agentId)
|
|
139631
|
+
return {
|
|
139632
|
+
ok: false,
|
|
139633
|
+
kind: "script_failed",
|
|
139634
|
+
error: "the task has no agent to run the script as"
|
|
139635
|
+
};
|
|
139636
|
+
const output = await runSavedScriptAsAgent({
|
|
139637
|
+
script,
|
|
139638
|
+
input: action.args ?? {},
|
|
139639
|
+
agentId: task.agentId,
|
|
139640
|
+
timeoutMs: UI_SPEC_SCRIPT_ACTION_TIMEOUT_MS
|
|
139641
|
+
});
|
|
139642
|
+
if (output.exitCode !== 0 || output.error || output.runtimeError) {
|
|
139643
|
+
const reason = output.runtimeError ? `${output.runtimeError.name}: ${output.runtimeError.message}` : output.error ? `script ${output.error}` : `script exited ${output.exitCode}`;
|
|
139644
|
+
return { ok: false, kind: "script_failed", error: reason };
|
|
139645
|
+
}
|
|
139646
|
+
const parsed = TaskUiSpecInputSchema.safeParse(output.result);
|
|
139647
|
+
if (!parsed.success) {
|
|
139648
|
+
const issue = parsed.error.issues[0];
|
|
139649
|
+
const path = issue?.path.join(".") || "result";
|
|
139650
|
+
return {
|
|
139651
|
+
ok: false,
|
|
139652
|
+
kind: "invalid_output",
|
|
139653
|
+
error: `script output is not { spec, actions? }: ${path}: ${issue?.message ?? "invalid"}`
|
|
139654
|
+
};
|
|
139655
|
+
}
|
|
139656
|
+
const newActions = parsed.data.actions;
|
|
139657
|
+
const scriptIssues = await scriptActionIssues(newActions);
|
|
139658
|
+
if (scriptIssues.length > 0)
|
|
139659
|
+
return { ok: false, kind: "invalid_output", error: scriptIssues[0] ?? "invalid action" };
|
|
139660
|
+
const actions = newActions ?? stored.actions;
|
|
139661
|
+
const validation = validateTaskUiSpec({ spec: parsed.data.spec, ...actions ? { actions } : {} }, { taskId: task.id, actionsEnabled: true });
|
|
139662
|
+
if (!validation.ok)
|
|
139663
|
+
return { ok: false, kind: "invalid_output", error: validation.issues[0] ?? "invalid uiSpec" };
|
|
139664
|
+
return {
|
|
139665
|
+
ok: true,
|
|
139666
|
+
uiSpec: {
|
|
139667
|
+
spec: validation.spec,
|
|
139668
|
+
...validation.actions ? { actions: validation.actions } : {},
|
|
139669
|
+
fallbackText: validation.fallbackText
|
|
139670
|
+
}
|
|
139671
|
+
};
|
|
139672
|
+
}
|
|
139673
|
+
async function runTaskUiScriptAction({
|
|
139674
|
+
task,
|
|
139675
|
+
actionId,
|
|
139676
|
+
action,
|
|
139677
|
+
stored,
|
|
139678
|
+
surface,
|
|
139679
|
+
actorUserId,
|
|
139680
|
+
slackUserId
|
|
139681
|
+
}) {
|
|
139682
|
+
const resolved = await resolveScriptAction(actionId, action);
|
|
139683
|
+
if (!resolved.ok) {
|
|
139684
|
+
if (resolved.reason === "missing") {
|
|
139685
|
+
return { status: "script_failed", error: `script "${action.script}" no longer exists` };
|
|
139686
|
+
}
|
|
139687
|
+
return { status: resolved.reason };
|
|
139688
|
+
}
|
|
139689
|
+
const lock = await acquireTaskUiScriptActionRun({
|
|
139690
|
+
taskId: task.id,
|
|
139691
|
+
actionId,
|
|
139692
|
+
surface,
|
|
139693
|
+
slackUserId,
|
|
139694
|
+
userId: actorUserId,
|
|
139695
|
+
leaseMs: UI_SPEC_SCRIPT_ACTION_LEASE_MS,
|
|
139696
|
+
cooldownMs: UI_SPEC_SCRIPT_ACTION_COOLDOWN_MS
|
|
139697
|
+
});
|
|
139698
|
+
if (lock.status !== "acquired")
|
|
139699
|
+
return lock;
|
|
139700
|
+
let outcome;
|
|
139701
|
+
try {
|
|
139702
|
+
outcome = await runAndValidate(task, action, resolved.script, stored);
|
|
139703
|
+
} catch (error) {
|
|
139704
|
+
outcome = {
|
|
139705
|
+
ok: false,
|
|
139706
|
+
kind: "script_failed",
|
|
139707
|
+
error: error instanceof Error ? error.message : String(error)
|
|
139708
|
+
};
|
|
139709
|
+
}
|
|
139710
|
+
if (outcome.ok) {
|
|
139711
|
+
const okOutcome = outcome;
|
|
139712
|
+
const pinIssue = await getDbClient2().transaction(async () => {
|
|
139713
|
+
const [issue] = await scriptActionPinIssues(okOutcome.uiSpec.actions);
|
|
139714
|
+
if (!issue)
|
|
139715
|
+
await upsertTaskUiSpec(task.id, okOutcome.uiSpec, actorUserId);
|
|
139716
|
+
return issue;
|
|
139717
|
+
});
|
|
139718
|
+
if (pinIssue)
|
|
139719
|
+
outcome = { ok: false, kind: "invalid_output", error: pinIssue };
|
|
139720
|
+
}
|
|
139721
|
+
if (!outcome.ok) {
|
|
139722
|
+
const error = shortError(outcome.error);
|
|
139723
|
+
await finishTaskUiScriptActionRun(task.id, actionId, error);
|
|
139724
|
+
await createLogEntry2({
|
|
139725
|
+
eventType: "task_ui_script_action_failed",
|
|
139726
|
+
...task.agentId ? { agentId: task.agentId } : {},
|
|
139727
|
+
taskId: task.id,
|
|
139728
|
+
newValue: error,
|
|
139729
|
+
metadata: { actionId, script: action.script, kind: outcome.kind }
|
|
139730
|
+
});
|
|
139731
|
+
return { status: outcome.kind, error };
|
|
139732
|
+
}
|
|
139733
|
+
await finishTaskUiScriptActionRun(task.id, actionId, null);
|
|
139734
|
+
getDbClient2().afterCommit(() => workflowEventBus2.emit(TASK_UI_SPEC_UPDATED_EVENT, { taskId: task.id }));
|
|
139735
|
+
return { status: "refreshed", uiSpec: await getTaskUiSpec(task.id) ?? outcome.uiSpec };
|
|
139736
|
+
}
|
|
139737
|
+
var UI_SPEC_SCRIPT_ACTION_TIMEOUT_MS = 30000, UI_SPEC_SCRIPT_ACTION_LEASE_MS, UI_SPEC_SCRIPT_ACTION_COOLDOWN_MS = 30000;
|
|
139738
|
+
var init_script_actions = __esm(() => {
|
|
139739
|
+
init_db4();
|
|
139740
|
+
init_db3();
|
|
139741
|
+
init_run_saved();
|
|
139742
|
+
init_task_ui_spec();
|
|
139743
|
+
init_env_flag();
|
|
139744
|
+
init_secret_scrubber();
|
|
139745
|
+
init_task_ui_spec2();
|
|
139746
|
+
init_event_bus();
|
|
139747
|
+
init_json_schema_validator();
|
|
139748
|
+
init_schema2();
|
|
139749
|
+
init_script_allowlist();
|
|
139750
|
+
init_validate2();
|
|
139751
|
+
UI_SPEC_SCRIPT_ACTION_LEASE_MS = UI_SPEC_SCRIPT_ACTION_TIMEOUT_MS + 15000;
|
|
139752
|
+
});
|
|
139753
|
+
|
|
139181
139754
|
// src/tools/store-progress.ts
|
|
139182
139755
|
async function foreignTaskWriteError(caller, task, sourceTaskId) {
|
|
139183
139756
|
const decision = can({
|
|
@@ -139216,14 +139789,7 @@ var BLOCKED_WAITING_PATTERN, BLOCKED_WAITING_MIN_ELAPSED_MS, storeProgressOutput
|
|
|
139216
139789
|
failureReason: string2().optional().describe("The reason for failure (used when failing), or the one-line reason for a skip (required with status 'skipped')."),
|
|
139217
139790
|
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
139791
|
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."),
|
|
139792
|
+
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
139793
|
learning: union3([
|
|
139228
139794
|
string2(),
|
|
139229
139795
|
object2({
|
|
@@ -139348,6 +139914,7 @@ var BLOCKED_WAITING_PATTERN, BLOCKED_WAITING_MIN_ELAPSED_MS, storeProgressOutput
|
|
|
139348
139914
|
}
|
|
139349
139915
|
}
|
|
139350
139916
|
let learningWrite;
|
|
139917
|
+
const uiSpecScriptIssues = uiSpec && status === "completed" && isEnvFlagEnabled("UI_SPEC_ENABLED", false) ? await scriptActionIssues(uiSpec.actions) : [];
|
|
139351
139918
|
let uiSpecNote;
|
|
139352
139919
|
const result = await getDbClient2().transaction(async () => {
|
|
139353
139920
|
const agent = await getAgentById2(requestInfo.agentId ?? "");
|
|
@@ -139485,7 +140052,8 @@ This check refuses once per task; the next completion is accepted and unfixed ci
|
|
|
139485
140052
|
} else if (uiSpec && status !== "completed") {
|
|
139486
140053
|
uiSpecNote = 'uiSpec is stored only with status "completed".';
|
|
139487
140054
|
} else if (uiSpec) {
|
|
139488
|
-
const
|
|
140055
|
+
const scriptIssues = uiSpecScriptIssues.length > 0 ? uiSpecScriptIssues : await scriptActionPinIssues(uiSpec.actions);
|
|
140056
|
+
const validation = scriptIssues.length > 0 ? { ok: false, issues: scriptIssues } : validateTaskUiSpec(uiSpec, {
|
|
139489
140057
|
taskId,
|
|
139490
140058
|
actionsEnabled: isEnvFlagEnabled("UI_SPEC_ACTIONS_ENABLED", false)
|
|
139491
140059
|
});
|
|
@@ -139641,11 +140209,12 @@ var init_store_progress = __esm(() => {
|
|
|
139641
140209
|
init_terminal_result_guard();
|
|
139642
140210
|
init_utils();
|
|
139643
140211
|
init_types5();
|
|
140212
|
+
init_schema2();
|
|
140213
|
+
init_script_actions();
|
|
139644
140214
|
init_validate2();
|
|
139645
140215
|
init_env_flag();
|
|
139646
140216
|
init_secret_scrubber();
|
|
139647
140217
|
init_task_citations();
|
|
139648
|
-
init_task_ui_spec2();
|
|
139649
140218
|
init_business_use();
|
|
139650
140219
|
BLOCKED_WAITING_PATTERN = /\b(waiting (for|on)|blocked (on|until|by)|still waiting|awaiting)\b/i;
|
|
139651
140220
|
BLOCKED_WAITING_MIN_ELAPSED_MS = 3 * 60 * 1000;
|
|
@@ -140022,6 +140591,11 @@ var registerDeleteConfigTool = (server) => {
|
|
|
140022
140591
|
data: { yourAgentId: requestInfo.agentId }
|
|
140023
140592
|
});
|
|
140024
140593
|
}
|
|
140594
|
+
if (isHumanOnlyConfigKey(existing.key)) {
|
|
140595
|
+
return toolErr(humanOnlyConfigKeyError(existing.key), {
|
|
140596
|
+
data: { yourAgentId: requestInfo.agentId }
|
|
140597
|
+
});
|
|
140598
|
+
}
|
|
140025
140599
|
if (isInternalConfigKey(existing.key)) {
|
|
140026
140600
|
return toolErr(internalConfigKeyError(existing.key).message, {
|
|
140027
140601
|
data: { yourAgentId: requestInfo.agentId }
|
|
@@ -140037,7 +140611,7 @@ var registerDeleteConfigTool = (server) => {
|
|
|
140037
140611
|
});
|
|
140038
140612
|
}
|
|
140039
140613
|
if (existing.scope === "global") {
|
|
140040
|
-
|
|
140614
|
+
scheduleIntegrationsReload2();
|
|
140041
140615
|
}
|
|
140042
140616
|
return toolOk(`Config "${existing.key}" deleted successfully.`, {
|
|
140043
140617
|
details: `Config "${existing.key}" (scope: ${existing.scope}${existing.scopeId ? `, scopeId: ${existing.scopeId}` : ""}) deleted successfully.`,
|
|
@@ -140288,6 +140862,11 @@ var configEntryShape3, registerSetConfigTool = (server) => {
|
|
|
140288
140862
|
const message = reservedKeyError(key).message;
|
|
140289
140863
|
return toolErr(message, { data: { yourAgentId: requestInfo.agentId } });
|
|
140290
140864
|
}
|
|
140865
|
+
if (isHumanOnlyConfigKey(key)) {
|
|
140866
|
+
return toolErr(humanOnlyConfigKeyError(key), {
|
|
140867
|
+
data: { yourAgentId: requestInfo.agentId }
|
|
140868
|
+
});
|
|
140869
|
+
}
|
|
140291
140870
|
if (isInternalConfigKey(key)) {
|
|
140292
140871
|
return toolErr(internalConfigKeyError(key).message, {
|
|
140293
140872
|
data: { yourAgentId: requestInfo.agentId }
|
|
@@ -140324,7 +140903,7 @@ var configEntryShape3, registerSetConfigTool = (server) => {
|
|
|
140324
140903
|
exportToEnv
|
|
140325
140904
|
});
|
|
140326
140905
|
if (scope === "global") {
|
|
140327
|
-
|
|
140906
|
+
scheduleIntegrationsReload2();
|
|
140328
140907
|
}
|
|
140329
140908
|
const [masked] = maskSecrets2([config]);
|
|
140330
140909
|
return toolOk(`Config "${key}" set successfully.`, {
|
|
@@ -140449,7 +141028,189 @@ var init_swarm_x = __esm(() => {
|
|
|
140449
141028
|
primitiveQueryValueSchema = union3([string2(), number2(), boolean()]);
|
|
140450
141029
|
});
|
|
140451
141030
|
|
|
141031
|
+
// src/http/session-cost-recompute.ts
|
|
141032
|
+
function cacheWriteSplit(input) {
|
|
141033
|
+
if (input.cacheWrite5mTokens == null || input.cacheWrite1hTokens == null)
|
|
141034
|
+
return null;
|
|
141035
|
+
const total = input.cacheWrite5mTokens + input.cacheWrite1hTokens;
|
|
141036
|
+
if (total === 0)
|
|
141037
|
+
return null;
|
|
141038
|
+
return {
|
|
141039
|
+
fiveMinuteRatio: input.cacheWrite5mTokens / total,
|
|
141040
|
+
oneHourRatio: input.cacheWrite1hTokens / total
|
|
141041
|
+
};
|
|
141042
|
+
}
|
|
141043
|
+
async function priceModel(provider, usage, split, atEpochMs, lookupRate) {
|
|
141044
|
+
const lookupModel = normalizeModelKey(provider, usage.model);
|
|
141045
|
+
const inputRate = await lookupRate(provider, lookupModel, "input", atEpochMs);
|
|
141046
|
+
const outputRate = await lookupRate(provider, lookupModel, "output", atEpochMs);
|
|
141047
|
+
if (inputRate == null || outputRate == null)
|
|
141048
|
+
return null;
|
|
141049
|
+
const cacheReadRate = await lookupRate(provider, lookupModel, "cached_input", atEpochMs) ?? 0;
|
|
141050
|
+
const uncachedInputTokens = INCLUSIVE_INPUT_PROVIDERS.has(provider) ? Math.max(0, usage.inputTokens - usage.cacheReadTokens) : usage.inputTokens;
|
|
141051
|
+
let cacheWriteCostUnits = 0;
|
|
141052
|
+
if (split) {
|
|
141053
|
+
const fiveMinuteTokens = usage.cacheWriteTokens * split.fiveMinuteRatio;
|
|
141054
|
+
const oneHourTokens = usage.cacheWriteTokens * split.oneHourRatio;
|
|
141055
|
+
const fiveMinuteRate = await lookupRate(provider, lookupModel, "cache_write", atEpochMs) ?? 0;
|
|
141056
|
+
const oneHourRate = await lookupRate(provider, lookupModel, "cache_write_1h", atEpochMs);
|
|
141057
|
+
if (oneHourTokens > 0 && oneHourRate == null)
|
|
141058
|
+
return null;
|
|
141059
|
+
cacheWriteCostUnits = fiveMinuteTokens * fiveMinuteRate + oneHourTokens * (oneHourRate ?? 0);
|
|
141060
|
+
} else {
|
|
141061
|
+
const cacheWriteRate = await lookupRate(provider, lookupModel, "cache_write", atEpochMs) ?? 0;
|
|
141062
|
+
cacheWriteCostUnits = usage.cacheWriteTokens * cacheWriteRate;
|
|
141063
|
+
}
|
|
141064
|
+
return (uncachedInputTokens * inputRate + usage.cacheReadTokens * cacheReadRate + cacheWriteCostUnits + usage.outputTokens * outputRate) / PER_MILLION;
|
|
141065
|
+
}
|
|
141066
|
+
function unpricedResult(input, modelBreakdown) {
|
|
141067
|
+
return {
|
|
141068
|
+
totalCostUsd: input.harnessCostUsd,
|
|
141069
|
+
costSource: "unpriced",
|
|
141070
|
+
modelBreakdown
|
|
141071
|
+
};
|
|
141072
|
+
}
|
|
141073
|
+
async function estimateAmpCost(input, lookupRate) {
|
|
141074
|
+
let selection;
|
|
141075
|
+
try {
|
|
141076
|
+
selection = resolveAmpModel(input.model);
|
|
141077
|
+
} catch {
|
|
141078
|
+
selection = undefined;
|
|
141079
|
+
}
|
|
141080
|
+
const candidates = [
|
|
141081
|
+
...new Set([
|
|
141082
|
+
selection?.pin,
|
|
141083
|
+
selection ? AMP_ESTIMATE_MODELS[selection.baseMode] : undefined,
|
|
141084
|
+
AMP_ESTIMATE_MODELS.medium
|
|
141085
|
+
])
|
|
141086
|
+
].filter((model) => !!model);
|
|
141087
|
+
for (const model of candidates) {
|
|
141088
|
+
const writes = ampBillsCacheWrites(model);
|
|
141089
|
+
const costUsd = await priceModel("amp", {
|
|
141090
|
+
model,
|
|
141091
|
+
inputTokens: input.inputTokens + (writes ? 0 : input.cacheWriteTokens),
|
|
141092
|
+
outputTokens: input.outputTokens,
|
|
141093
|
+
cacheReadTokens: input.cacheReadTokens,
|
|
141094
|
+
cacheWriteTokens: writes ? input.cacheWriteTokens : 0
|
|
141095
|
+
}, null, input.atEpochMs, lookupRate);
|
|
141096
|
+
if (costUsd != null)
|
|
141097
|
+
return { totalCostUsd: costUsd, costSource: "estimated", modelBreakdown: undefined };
|
|
141098
|
+
}
|
|
141099
|
+
return unpricedResult(input, undefined);
|
|
141100
|
+
}
|
|
141101
|
+
async function recomputeSessionCost(input, lookupRate) {
|
|
141102
|
+
const modelUsageEntries = input.models?.length ? input.models : undefined;
|
|
141103
|
+
const modelBreakdown = modelUsageEntries?.map((model) => ({ ...model }));
|
|
141104
|
+
if (!input.provider) {
|
|
141105
|
+
return {
|
|
141106
|
+
totalCostUsd: input.harnessCostUsd,
|
|
141107
|
+
costSource: "harness",
|
|
141108
|
+
modelBreakdown
|
|
141109
|
+
};
|
|
141110
|
+
}
|
|
141111
|
+
if ((input.provider === "amp" || input.provider === "grok" || input.harnessCostBilled) && input.harnessCostUsd > 0) {
|
|
141112
|
+
const priced = await recomputeSessionCost({ ...input, harnessCostUsd: 0, harnessCostBilled: false }, lookupRate);
|
|
141113
|
+
return {
|
|
141114
|
+
totalCostUsd: input.harnessCostUsd,
|
|
141115
|
+
costSource: "harness",
|
|
141116
|
+
modelBreakdown: priced.modelBreakdown
|
|
141117
|
+
};
|
|
141118
|
+
}
|
|
141119
|
+
if (input.provider === "acp" && input.harnessCostUsd > 0) {
|
|
141120
|
+
return { totalCostUsd: input.harnessCostUsd, costSource: "harness", modelBreakdown };
|
|
141121
|
+
}
|
|
141122
|
+
if (input.provider === "amp" && !modelUsageEntries)
|
|
141123
|
+
return estimateAmpCost(input, lookupRate);
|
|
141124
|
+
const split = cacheWriteSplit(input);
|
|
141125
|
+
const usages = modelUsageEntries ? modelUsageEntries : input.model ? [
|
|
141126
|
+
{
|
|
141127
|
+
model: input.model,
|
|
141128
|
+
inputTokens: input.inputTokens,
|
|
141129
|
+
outputTokens: input.outputTokens,
|
|
141130
|
+
cacheReadTokens: input.cacheReadTokens,
|
|
141131
|
+
cacheWriteTokens: input.cacheWriteTokens
|
|
141132
|
+
}
|
|
141133
|
+
] : [];
|
|
141134
|
+
if (usages.length === 0) {
|
|
141135
|
+
return {
|
|
141136
|
+
totalCostUsd: input.harnessCostUsd,
|
|
141137
|
+
costSource: "harness",
|
|
141138
|
+
modelBreakdown
|
|
141139
|
+
};
|
|
141140
|
+
}
|
|
141141
|
+
const pricedModels = [];
|
|
141142
|
+
let pricedCostUsd = 0;
|
|
141143
|
+
const hasWebSearchRequests = usages.some((usage) => (usage.webSearchRequests ?? 0) > 0);
|
|
141144
|
+
const webSearchRate = hasWebSearchRequests ? await lookupRate(input.provider, "*", "web_search", input.atEpochMs) : null;
|
|
141145
|
+
for (const usage of usages) {
|
|
141146
|
+
const tokenCostUsd = await priceModel(input.provider, usage, split, input.atEpochMs, lookupRate);
|
|
141147
|
+
if (tokenCostUsd == null)
|
|
141148
|
+
return unpricedResult(input, modelBreakdown);
|
|
141149
|
+
const webSearchCostUsd = (usage.webSearchRequests ?? 0) * (webSearchRate ?? 0) / PER_MILLION;
|
|
141150
|
+
const costUsd = tokenCostUsd + webSearchCostUsd;
|
|
141151
|
+
pricedCostUsd += costUsd;
|
|
141152
|
+
if (modelUsageEntries)
|
|
141153
|
+
pricedModels.push({ ...usage, costUsd });
|
|
141154
|
+
}
|
|
141155
|
+
let sessionFeesUsd = 0;
|
|
141156
|
+
const durationMs = input.durationMs ?? 0;
|
|
141157
|
+
if (input.provider === "claude-managed" && durationMs > 0) {
|
|
141158
|
+
const runtimeRate = await lookupRate(input.provider, "*", "runtime_hour", input.atEpochMs);
|
|
141159
|
+
if (runtimeRate == null)
|
|
141160
|
+
return unpricedResult(input, modelBreakdown);
|
|
141161
|
+
sessionFeesUsd += durationMs / 3600000 * (runtimeRate / PER_MILLION);
|
|
141162
|
+
}
|
|
141163
|
+
return {
|
|
141164
|
+
totalCostUsd: pricedCostUsd + sessionFeesUsd,
|
|
141165
|
+
costSource: "pricing-table",
|
|
141166
|
+
modelBreakdown: modelUsageEntries ? pricedModels : undefined
|
|
141167
|
+
};
|
|
141168
|
+
}
|
|
141169
|
+
var PER_MILLION = 1e6, INCLUSIVE_INPUT_PROVIDERS;
|
|
141170
|
+
var init_session_cost_recompute = __esm(() => {
|
|
141171
|
+
init_pricing_normalize();
|
|
141172
|
+
init_amp_models();
|
|
141173
|
+
INCLUSIVE_INPUT_PROVIDERS = new Set(["codex"]);
|
|
141174
|
+
});
|
|
141175
|
+
|
|
140452
141176
|
// src/tools/system-one-decide.ts
|
|
141177
|
+
async function costTask(taskId, requestInfo) {
|
|
141178
|
+
const id = taskId ?? requestInfo.sourceTaskId;
|
|
141179
|
+
if (!id)
|
|
141180
|
+
return {};
|
|
141181
|
+
const task = await getTaskById2(id);
|
|
141182
|
+
const allowed = !!task && (requestInfo.callOrigin === "extension" || task.agentId === requestInfo.agentId);
|
|
141183
|
+
if (allowed)
|
|
141184
|
+
return { task };
|
|
141185
|
+
return taskId ? { error: `taskId ${taskId} is not a task this caller can charge` } : {};
|
|
141186
|
+
}
|
|
141187
|
+
async function recordDecisionCost(task, callerAgentId, provider, output, durationMs) {
|
|
141188
|
+
const model = `${provider}/${output.model}`;
|
|
141189
|
+
const priced = await recomputeSessionCost({
|
|
141190
|
+
provider: "system-one",
|
|
141191
|
+
model,
|
|
141192
|
+
harnessCostUsd: 0,
|
|
141193
|
+
inputTokens: output.usage.input_tokens,
|
|
141194
|
+
outputTokens: output.usage.output_tokens,
|
|
141195
|
+
cacheReadTokens: 0,
|
|
141196
|
+
cacheWriteTokens: 0,
|
|
141197
|
+
atEpochMs: Date.now()
|
|
141198
|
+
}, async (pricingProvider, lookupModel, tokenClass, atEpochMs) => (await getActivePricingRow2(pricingProvider, lookupModel, tokenClass, atEpochMs))?.pricePerMillionUsd ?? null);
|
|
141199
|
+
const { cost } = await insertSessionCost2({
|
|
141200
|
+
sessionId: `system-one:${crypto.randomUUID()}`,
|
|
141201
|
+
taskId: task.id,
|
|
141202
|
+
agentId: task.agentId ?? callerAgentId,
|
|
141203
|
+
totalCostUsd: priced.totalCostUsd,
|
|
141204
|
+
inputTokens: output.usage.input_tokens,
|
|
141205
|
+
outputTokens: output.usage.output_tokens,
|
|
141206
|
+
durationMs,
|
|
141207
|
+
numTurns: null,
|
|
141208
|
+
model,
|
|
141209
|
+
costSource: priced.costSource,
|
|
141210
|
+
kind: "system-one"
|
|
141211
|
+
});
|
|
141212
|
+
return { taskId: task.id, costUsd: cost.totalCostUsd, costSource: cost.costSource };
|
|
141213
|
+
}
|
|
140453
141214
|
var registerSystemOneDecideTool = (server) => {
|
|
140454
141215
|
createToolRegistrar(server)("system-one-decide", {
|
|
140455
141216
|
title: "Ask a SystemOne decision model",
|
|
@@ -140461,19 +141222,28 @@ var registerSystemOneDecideTool = (server) => {
|
|
|
140461
141222
|
state: union3([string2(), array2(string2()), record2(string2(), unknown())]).describe("The state to decide on"),
|
|
140462
141223
|
questions: record2(string2(), record2(string2(), unknown())).describe("Questions by id, each `{ type: 'noul' | 'choice' | 'score', instructions, criteria }`"),
|
|
140463
141224
|
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)")
|
|
141225
|
+
maxRetries: number2().int().optional().describe("Retries on transient failures inside the time budget (default 2)"),
|
|
141226
|
+
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
141227
|
}),
|
|
140466
141228
|
outputSchema: swarmToolOutputSchema({
|
|
140467
141229
|
model: string2().optional(),
|
|
140468
141230
|
answers: record2(string2(), unknown()).optional(),
|
|
140469
141231
|
usage: record2(string2(), unknown()).optional(),
|
|
140470
141232
|
requestId: string2().optional(),
|
|
141233
|
+
cost: looseObject({
|
|
141234
|
+
taskId: string2().optional(),
|
|
141235
|
+
costUsd: number2().optional(),
|
|
141236
|
+
costSource: string2().optional()
|
|
141237
|
+
}).optional().describe("The session-cost row recorded on the task, when a task was in scope"),
|
|
140471
141238
|
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
141239
|
})
|
|
140473
|
-
}, async ({ provider, model, state, questions, timeoutMs, maxRetries }, requestInfo) => {
|
|
141240
|
+
}, async ({ provider, model, state, questions, timeoutMs, maxRetries, taskId }, requestInfo) => {
|
|
140474
141241
|
if (!requestInfo.agentId) {
|
|
140475
141242
|
return toolErr('Agent ID not found. The MCP client should define the "X-Agent-ID" header.');
|
|
140476
141243
|
}
|
|
141244
|
+
const scope = await costTask(taskId, requestInfo);
|
|
141245
|
+
if (scope.error)
|
|
141246
|
+
return toolErr(scope.error);
|
|
140477
141247
|
const returns = Object.fromEntries(Object.entries(questions).map(([id, question]) => [id, { type: question.type }]));
|
|
140478
141248
|
const parsed = SystemOneDecisionConfigSchema.safeParse({
|
|
140479
141249
|
provider,
|
|
@@ -140492,23 +141262,35 @@ var registerSystemOneDecideTool = (server) => {
|
|
|
140492
141262
|
if (!(executor instanceof SystemOneDecisionExecutor)) {
|
|
140493
141263
|
return toolErr("The system-one-decision executor is not available");
|
|
140494
141264
|
}
|
|
141265
|
+
const startedAt = Date.now();
|
|
140495
141266
|
const decided = await executor.decide(parsed.data);
|
|
140496
141267
|
if (!decided.ok) {
|
|
140497
141268
|
return toolErr(decided.error, decided.deploymentRefused ? { data: { providerUnavailable: true } } : {});
|
|
140498
141269
|
}
|
|
140499
141270
|
const { output } = decided;
|
|
141271
|
+
let cost;
|
|
141272
|
+
if (scope.task) {
|
|
141273
|
+
try {
|
|
141274
|
+
cost = await recordDecisionCost(scope.task, requestInfo.agentId, decided.provider, output, Date.now() - startedAt);
|
|
141275
|
+
} catch (err) {
|
|
141276
|
+
console.warn(`[system-one-decide] cost not recorded on task ${scope.task.id}: ${err instanceof Error ? err.message : String(err)}`);
|
|
141277
|
+
}
|
|
141278
|
+
}
|
|
140500
141279
|
return toolOk(`Decision from ${output.model}`, {
|
|
140501
141280
|
data: {
|
|
140502
141281
|
model: output.model,
|
|
140503
141282
|
answers: output.answers,
|
|
140504
141283
|
usage: output.usage,
|
|
140505
|
-
requestId: output.requestId
|
|
141284
|
+
requestId: output.requestId,
|
|
141285
|
+
...cost ? { cost } : {}
|
|
140506
141286
|
}
|
|
140507
141287
|
});
|
|
140508
141288
|
});
|
|
140509
141289
|
};
|
|
140510
141290
|
var init_system_one_decide = __esm(() => {
|
|
140511
141291
|
init_zod();
|
|
141292
|
+
init_db4();
|
|
141293
|
+
init_session_cost_recompute();
|
|
140512
141294
|
init_utils();
|
|
140513
141295
|
init_workflows();
|
|
140514
141296
|
init_system_one_decision();
|
|
@@ -140633,7 +141415,7 @@ async function emitBudgetRefusalSideEffects(ctx, inserted) {
|
|
|
140633
141415
|
console.warn(`[budget-refusal-notify] Failed to create follow-up task for budget refusal (task=${ctx.task.id.slice(0, 8)}): ${err}`);
|
|
140634
141416
|
}
|
|
140635
141417
|
}
|
|
140636
|
-
import("./event-bus-
|
|
141418
|
+
import("./event-bus-swr88jg5.js").then(({ workflowEventBus }) => {
|
|
140637
141419
|
workflowEventBus.emit("task.budget_refused", {
|
|
140638
141420
|
taskId: ctx.task.id,
|
|
140639
141421
|
agentId: ctx.agentId,
|
|
@@ -141776,13 +142558,14 @@ var registerCreateWorkflowTool = (server) => {
|
|
|
141776
142558
|
` + "- 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
142559
|
` + "- 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
142560
|
` + "- 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 } }.
|
|
142561
|
+
` + "- WEBHOOK DELIVERY FILTER: optional filter on a webhook trigger drops deliveries after signature verification and before any run is saved " + "(200 { skipped: true, reason }). filter.headers and filter.body are allowlists (a string or an array of scalars); every field must match. " + "Header names are case-insensitive; values and JSON paths are exact, with no type coercion. " + 'preset "github" | "gitlab" | "standard-webhooks" selects where the deprecated events allowlist is read ' + "(X-GitHub-Event, X-Gitlab-Event, or JSON body type). events and eventHeader still work and are AND-ed with filter; eventHeader overrides preset. " + `Omit filter and events to accept every delivery.
|
|
141779
142562
|
` + "- 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
142563
|
inputSchema: object2({
|
|
141781
142564
|
name: string2().describe("Unique name for the workflow"),
|
|
141782
142565
|
key: AssetKeySchema.optional().describe("Logical namespace. Defaults to a shared/workflow:<id>/ resource key."),
|
|
141783
142566
|
description: string2().optional().describe("Description of what this workflow does"),
|
|
141784
142567
|
definition: WorkflowDefinitionSchema.describe("The workflow definition with nodes (each node has id, type, config, and optional next/retry/validation)"),
|
|
141785
|
-
triggers: array2(TriggerConfigSchema).optional().describe("Optional trigger configurations (webhook, schedule, event).
|
|
142568
|
+
triggers: array2(TriggerConfigSchema).optional().describe("Optional trigger configurations (webhook, schedule, event). A webhook trigger accepts filter (headers and body allowlists) and preset (github, gitlab, standard-webhooks). events and eventHeader remain a deprecated alias of one filter clause. Verification formats: legacy omitted verification, hmac-sha256, timestamped-hmac-sha256, token-equality, standard-webhooks."),
|
|
141786
142569
|
cooldown: CooldownConfigSchema.optional().describe("Optional cooldown configuration to prevent re-triggering too frequently"),
|
|
141787
142570
|
input: record2(string2(), InputValueSchema).optional().describe("Optional input values resolved at execution time (env vars like VAR_NAME, secrets secret.NAME, or literals)"),
|
|
141788
142571
|
dir: string2().min(1).startsWith("/").optional().describe("Default working directory for all agent-task nodes (absolute path, e.g. /tmp/workspace)"),
|
|
@@ -142547,14 +143330,14 @@ var registerUpdateWorkflowTool = (server) => {
|
|
|
142547
143330
|
createToolRegistrar(server)("update-workflow", {
|
|
142548
143331
|
title: "Update Workflow",
|
|
142549
143332
|
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).",
|
|
143333
|
+
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 DELIVERY FILTER: optional filter on a webhook trigger drops deliveries after signature verification and before any run is saved " + "(200 { skipped: true, reason }). filter.headers and filter.body are allowlists (a string or an array of scalars); every field must match. " + "Header names are case-insensitive; values and JSON paths are exact, with no type coercion. " + 'preset "github" | "gitlab" | "standard-webhooks" selects where the deprecated events allowlist is read ' + "(X-GitHub-Event, X-Gitlab-Event, or JSON body type). events and eventHeader still work and are AND-ed with filter; eventHeader overrides preset. " + "Omit filter and events to accept every delivery.",
|
|
142551
143334
|
inputSchema: object2({
|
|
142552
143335
|
id: string2().uuid().describe("Workflow ID to update"),
|
|
142553
143336
|
key: AssetKeySchema.optional().describe("Move to a logical namespace."),
|
|
142554
143337
|
name: string2().optional().describe("New name for the workflow"),
|
|
142555
143338
|
description: string2().optional().describe("New description"),
|
|
142556
143339
|
definition: WorkflowDefinitionSchema.optional().describe("New workflow definition"),
|
|
142557
|
-
triggers: array2(TriggerConfigSchema).optional().describe("
|
|
143340
|
+
triggers: array2(TriggerConfigSchema).optional().describe("Replacement trigger list. A webhook trigger accepts filter (headers and body allowlists) and preset (github, gitlab, standard-webhooks). events and eventHeader remain a deprecated alias of one filter clause. Verification formats: legacy omitted verification, hmac-sha256, timestamped-hmac-sha256, token-equality, standard-webhooks."),
|
|
142558
143341
|
cooldown: CooldownConfigSchema.optional().nullable().describe("New cooldown configuration (null to remove)"),
|
|
142559
143342
|
input: record2(string2(), InputValueSchema).optional().nullable().describe("New input values (null to remove)"),
|
|
142560
143343
|
dir: string2().min(1).startsWith("/").optional().nullable().describe("Default working directory for all agent-task nodes (null to remove)"),
|
|
@@ -142733,7 +143516,7 @@ function removeTools(server, names) {
|
|
|
142733
143516
|
tools[name]?.remove();
|
|
142734
143517
|
}
|
|
142735
143518
|
async function createServer(opts = {}) {
|
|
142736
|
-
await
|
|
143519
|
+
await loadGlobalConfigsIntoEnv2(true);
|
|
142737
143520
|
const toolAllowlist = opts.fullSurface === true ? undefined : resolveToolAllowlist(opts.enabledTools ?? process.env.SWARM_ENABLED_TOOLS);
|
|
142738
143521
|
const hasCapability = (cap) => opts.fullSurface === true || toolAllowlist !== undefined || (cap === "chat-sdk" ? isChatSdkEnabled() : getCapabilities().has(cap));
|
|
142739
143522
|
initDb2(process.env.DATABASE_PATH);
|
|
@@ -143173,4 +143956,4 @@ var init_server = __esm(() => {
|
|
|
143173
143956
|
loggedToolAllowlistWarnings = new Set;
|
|
143174
143957
|
});
|
|
143175
143958
|
|
|
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 };
|
|
143959
|
+
export { safeParse, getObjectShape, getLiteralValue, init_zod_compat, LATEST_PROTOCOL_VERSION, DEFAULT_NEGOTIATED_PROTOCOL_VERSION, SUPPORTED_PROTOCOL_VERSIONS, isJSONRPCRequest, isJSONRPCResultResponse, ErrorCode, isJSONRPCErrorResponse, JSONRPCMessageSchema, EmptyResultSchema, isInitializeRequest, InitializeResultSchema, CreateTaskResultSchema, ListResourcesResultSchema, ListResourceTemplatesResultSchema, ReadResourceResultSchema, ResourceListChangedNotificationSchema, ListPromptsResultSchema, GetPromptResultSchema, PromptListChangedNotificationSchema, ListToolsResultSchema, CallToolResultSchema, ToolListChangedNotificationSchema, ListChangedOptionsBaseSchema, CreateMessageRequestSchema, CreateMessageResultSchema, CreateMessageResultWithToolsSchema, ElicitRequestSchema, ElicitResultSchema, CompleteResultSchema, McpError, init_types, Protocol, mergeCapabilities, init_protocol, AjvJsonSchemaValidator, init_ajv_provider, assertToolsCallTaskCapability, assertClientRequestTaskCapability, init_helpers, 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, getWorkerInstallationToken, init_app, 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_app2, handleJiraWebhook, init_webhook, init_jira, handleAgentSessionEvent, handleIssueUpdate, handleIssueDelete, handleAgentSessionPrompted, init_sync, isLinearEnabled, initLinear, init_app3, 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 };
|