@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
|
@@ -1,20 +1,26 @@
|
|
|
1
|
+
import {
|
|
2
|
+
assertProviderQuotaCapacity,
|
|
3
|
+
parseProviderAccount,
|
|
4
|
+
applyProviderQuotaReport,
|
|
5
|
+
scrubProviderQuotaReport,
|
|
6
|
+
init_provider_account_telemetry
|
|
7
|
+
} from "./cli-k3c13za2.js";
|
|
8
|
+
import {
|
|
9
|
+
resolveGitHubHost,
|
|
10
|
+
getGitHubLinkConfig,
|
|
11
|
+
getGitHubHostForSql,
|
|
12
|
+
init_github_host
|
|
13
|
+
} from "./cli-9ttx00s3.js";
|
|
1
14
|
import {
|
|
2
15
|
ampPinProviderError,
|
|
3
16
|
ampPinCatalogError,
|
|
4
17
|
ampModelError,
|
|
5
18
|
init_amp_models
|
|
6
|
-
} from "./cli-
|
|
19
|
+
} from "./cli-5ptj757f.js";
|
|
7
20
|
import {
|
|
8
21
|
ALL_TOOLS,
|
|
9
22
|
init_tool_config
|
|
10
23
|
} from "./cli-0b4zam62.js";
|
|
11
|
-
import {
|
|
12
|
-
assertProviderQuotaCapacity,
|
|
13
|
-
parseProviderAccount,
|
|
14
|
-
applyProviderQuotaReport,
|
|
15
|
-
scrubProviderQuotaReport,
|
|
16
|
-
init_provider_account_telemetry
|
|
17
|
-
} from "./cli-43ms35q9.js";
|
|
18
24
|
import {
|
|
19
25
|
CODEX_AUTH_FAILURE_BENCH_THRESHOLD,
|
|
20
26
|
CODEX_AUTH_FAILURE_BENCH_MS,
|
|
@@ -59,13 +65,7 @@ import {
|
|
|
59
65
|
SUPERSEDED_WORKFLOW_TASK_REASON,
|
|
60
66
|
PageThemeTokensSchema,
|
|
61
67
|
init_types5
|
|
62
|
-
} from "./cli-
|
|
63
|
-
import {
|
|
64
|
-
resolveGitHubHost,
|
|
65
|
-
getGitHubLinkConfig,
|
|
66
|
-
getGitHubHostForSql,
|
|
67
|
-
init_github_host
|
|
68
|
-
} from "./cli-9ttx00s3.js";
|
|
68
|
+
} from "./cli-1h4njv9y.js";
|
|
69
69
|
import {
|
|
70
70
|
init_templates4,
|
|
71
71
|
generateDefaultClaudeMd2,
|
|
@@ -80,15 +80,15 @@ import {
|
|
|
80
80
|
init_identity_field_budget,
|
|
81
81
|
contentSha256,
|
|
82
82
|
init_profile_sync
|
|
83
|
-
} from "./cli-
|
|
84
|
-
import {
|
|
85
|
-
isSlackConfigured,
|
|
86
|
-
init_config4
|
|
87
|
-
} from "./cli-eetzmsy5.js";
|
|
83
|
+
} from "./cli-mhrr4d5b.js";
|
|
88
84
|
import {
|
|
89
85
|
isSteeringEnabled2,
|
|
90
86
|
init_steering_enabled
|
|
91
87
|
} from "./cli-4sydckyj.js";
|
|
88
|
+
import {
|
|
89
|
+
isSlackConfigured,
|
|
90
|
+
init_config4
|
|
91
|
+
} from "./cli-eetzmsy5.js";
|
|
92
92
|
import {
|
|
93
93
|
kindForModelString,
|
|
94
94
|
init_models2
|
|
@@ -99,10 +99,6 @@ import {
|
|
|
99
99
|
codexPlanFromClaim,
|
|
100
100
|
init_subscription_plans
|
|
101
101
|
} from "./cli-nh7x3133.js";
|
|
102
|
-
import {
|
|
103
|
-
getOpenRouterAttributionHeaders,
|
|
104
|
-
init_openrouter_base_url
|
|
105
|
-
} from "./cli-dfyv0jdy.js";
|
|
106
102
|
import {
|
|
107
103
|
activeModelBlock,
|
|
108
104
|
init_model_rate_limit_windows,
|
|
@@ -112,7 +108,11 @@ import {
|
|
|
112
108
|
splitCredentialPool,
|
|
113
109
|
selectCredential,
|
|
114
110
|
init_credentials2
|
|
115
|
-
} from "./cli-
|
|
111
|
+
} from "./cli-ha4ek2nb.js";
|
|
112
|
+
import {
|
|
113
|
+
getOpenRouterAttributionHeaders,
|
|
114
|
+
init_openrouter_base_url
|
|
115
|
+
} from "./cli-dfyv0jdy.js";
|
|
116
116
|
import {
|
|
117
117
|
registerTemplate,
|
|
118
118
|
getAllTemplateDefinitions,
|
|
@@ -120,15 +120,15 @@ import {
|
|
|
120
120
|
configureDbResolver,
|
|
121
121
|
init_resolver,
|
|
122
122
|
init_session_templates
|
|
123
|
-
} from "./cli-
|
|
123
|
+
} from "./cli-2z2c4k6q.js";
|
|
124
124
|
import {
|
|
125
125
|
setRuntimeModelCatalog,
|
|
126
126
|
runtimeHarnessSections,
|
|
127
127
|
init_runtime_model_catalog
|
|
128
|
-
} from "./cli-
|
|
128
|
+
} from "./cli-9yjhshah.js";
|
|
129
129
|
import {
|
|
130
130
|
init_zod
|
|
131
|
-
} from "./cli-
|
|
131
|
+
} from "./cli-96234j5w.js";
|
|
132
132
|
import {
|
|
133
133
|
string2,
|
|
134
134
|
uuid,
|
|
@@ -145,7 +145,7 @@ import {
|
|
|
145
145
|
_enum2,
|
|
146
146
|
literal2,
|
|
147
147
|
exports_iso
|
|
148
|
-
} from "./cli-
|
|
148
|
+
} from "./cli-qrzq3hvg.js";
|
|
149
149
|
import {
|
|
150
150
|
isEnvFlagEnabled,
|
|
151
151
|
init_env_flag
|
|
@@ -153,7 +153,7 @@ import {
|
|
|
153
153
|
import {
|
|
154
154
|
init_package,
|
|
155
155
|
package_default
|
|
156
|
-
} from "./cli-
|
|
156
|
+
} from "./cli-a6q6x15h.js";
|
|
157
157
|
import {
|
|
158
158
|
getNodeEnv,
|
|
159
159
|
init_node_env
|
|
@@ -184,7 +184,7 @@ import {
|
|
|
184
184
|
registerVolatileSecret,
|
|
185
185
|
registerSensitiveKeyName,
|
|
186
186
|
init_secret_scrubber
|
|
187
|
-
} from "./cli-
|
|
187
|
+
} from "./cli-7e8sxqv5.js";
|
|
188
188
|
import {
|
|
189
189
|
__toCommonJS,
|
|
190
190
|
__commonJS,
|
|
@@ -493,6 +493,7 @@ var init_default_bindings = __esm(() => {
|
|
|
493
493
|
});
|
|
494
494
|
|
|
495
495
|
// src/utils/egress-guard.ts
|
|
496
|
+
import { lookup } from "node:dns/promises";
|
|
496
497
|
function parseIPv4(host) {
|
|
497
498
|
const parts = host.split(".");
|
|
498
499
|
if (parts.length !== 4)
|
|
@@ -648,6 +649,227 @@ function assertUrlSafe(rawUrl, opts = {}) {
|
|
|
648
649
|
}
|
|
649
650
|
return parsed;
|
|
650
651
|
}
|
|
652
|
+
function nextHopRequest(status, from, to, request) {
|
|
653
|
+
const headers = new Headers(request.headers);
|
|
654
|
+
if (to.origin !== from.origin) {
|
|
655
|
+
for (const name of CREDENTIAL_HEADERS)
|
|
656
|
+
headers.delete(name);
|
|
657
|
+
}
|
|
658
|
+
const method = request.method.toUpperCase();
|
|
659
|
+
const toGet = status === 303 ? method !== "HEAD" : (status === 301 || status === 302) && method === "POST";
|
|
660
|
+
if (!toGet)
|
|
661
|
+
return { method, headers, body: request.body };
|
|
662
|
+
headers.delete("content-type");
|
|
663
|
+
headers.delete("content-length");
|
|
664
|
+
return { method: "GET", headers, body: undefined };
|
|
665
|
+
}
|
|
666
|
+
async function defaultResolve(hostname) {
|
|
667
|
+
const records = await lookup(hostname, { all: true, verbatim: true });
|
|
668
|
+
return records.map((record) => record.address);
|
|
669
|
+
}
|
|
670
|
+
function effectivePort(url) {
|
|
671
|
+
if (url.port)
|
|
672
|
+
return url.port;
|
|
673
|
+
return url.protocol === "https:" ? "443" : "80";
|
|
674
|
+
}
|
|
675
|
+
function matchesAllowlist(url, allowlist) {
|
|
676
|
+
const host = stripBrackets(url.hostname.toLowerCase()).replace(/\.$/, "");
|
|
677
|
+
const port = effectivePort(url);
|
|
678
|
+
return allowlist.some((rawEntry) => {
|
|
679
|
+
const entry = rawEntry.trim().toLowerCase();
|
|
680
|
+
if (!entry)
|
|
681
|
+
return false;
|
|
682
|
+
let entryHost = entry;
|
|
683
|
+
let entryPort = null;
|
|
684
|
+
const bracketed = /^\[([^\]]+)\](?::(\d+))?$/.exec(entry);
|
|
685
|
+
if (bracketed) {
|
|
686
|
+
entryHost = bracketed[1] ?? "";
|
|
687
|
+
entryPort = bracketed[2] ?? null;
|
|
688
|
+
} else if ((entry.match(/:/g) ?? []).length === 1) {
|
|
689
|
+
const [name, portText] = entry.split(":");
|
|
690
|
+
entryHost = name ?? "";
|
|
691
|
+
entryPort = portText ?? null;
|
|
692
|
+
}
|
|
693
|
+
if (entryPort !== null && entryPort !== port)
|
|
694
|
+
return false;
|
|
695
|
+
if (entryHost.startsWith("*.")) {
|
|
696
|
+
const suffix = entryHost.slice(1);
|
|
697
|
+
return host.endsWith(suffix) && host.length > suffix.length;
|
|
698
|
+
}
|
|
699
|
+
return host === entryHost;
|
|
700
|
+
});
|
|
701
|
+
}
|
|
702
|
+
async function assertEgressAllowed(url, options) {
|
|
703
|
+
if (url.protocol !== "http:" && url.protocol !== "https:") {
|
|
704
|
+
if (url.protocol === "data:" || url.protocol === "blob:")
|
|
705
|
+
return null;
|
|
706
|
+
throw new EgressDeniedError(`Script egress refused: unsupported protocol ${url.protocol}`);
|
|
707
|
+
}
|
|
708
|
+
if (options.isTrusted?.(url))
|
|
709
|
+
return null;
|
|
710
|
+
const { policy } = options;
|
|
711
|
+
if (policy.allowlist && policy.allowlist.length > 0) {
|
|
712
|
+
if (matchesAllowlist(url, policy.allowlist))
|
|
713
|
+
return null;
|
|
714
|
+
throw new EgressDeniedError(`Script egress refused: ${url.host} is not in SCRIPT_EGRESS_ALLOWLIST`);
|
|
715
|
+
}
|
|
716
|
+
if (policy.allowPrivate)
|
|
717
|
+
return null;
|
|
718
|
+
const host = stripBrackets(url.hostname);
|
|
719
|
+
const denied = () => new EgressDeniedError(`Script egress refused: ${url.host} is a private or loopback address. Add it to SCRIPT_EGRESS_ALLOWLIST or set SCRIPT_EGRESS_ALLOW_PRIVATE=true`);
|
|
720
|
+
if (isLoopbackName(host))
|
|
721
|
+
throw denied();
|
|
722
|
+
if (isIPv4Literal(host) || isIPv6Literal(host)) {
|
|
723
|
+
if (isPrivateAddress(host))
|
|
724
|
+
throw denied();
|
|
725
|
+
return null;
|
|
726
|
+
}
|
|
727
|
+
let addresses;
|
|
728
|
+
try {
|
|
729
|
+
addresses = await (options.resolve ?? defaultResolve)(host);
|
|
730
|
+
} catch (error) {
|
|
731
|
+
throw new EgressDeniedError(`Script egress refused: could not resolve ${host} (${error instanceof Error ? error.message : String(error)})`);
|
|
732
|
+
}
|
|
733
|
+
if (addresses.length === 0) {
|
|
734
|
+
throw new EgressDeniedError(`Script egress refused: ${host} resolved to no address`);
|
|
735
|
+
}
|
|
736
|
+
if (addresses.some(isPrivateAddress))
|
|
737
|
+
throw denied();
|
|
738
|
+
return addresses.find(isIPv4Literal) ?? addresses[0];
|
|
739
|
+
}
|
|
740
|
+
function pinToAddress(url, address, init) {
|
|
741
|
+
const target = new URL(url.href);
|
|
742
|
+
target.hostname = isIPv6Literal(address) ? `[${stripBrackets(address)}]` : address;
|
|
743
|
+
const headers = new Headers(init.headers);
|
|
744
|
+
if (!headers.has("host"))
|
|
745
|
+
headers.set("host", url.host);
|
|
746
|
+
const pinned = { ...init, headers };
|
|
747
|
+
if (url.protocol === "https:") {
|
|
748
|
+
const callerTls = init.tls;
|
|
749
|
+
pinned.tls = { ...callerTls, serverName: url.hostname.replace(/\.$/, "") };
|
|
750
|
+
}
|
|
751
|
+
return [target, pinned];
|
|
752
|
+
}
|
|
753
|
+
function chunkBytes(chunk) {
|
|
754
|
+
if (typeof chunk === "string")
|
|
755
|
+
return new TextEncoder().encode(chunk);
|
|
756
|
+
if (chunk instanceof ArrayBuffer)
|
|
757
|
+
return new Uint8Array(chunk);
|
|
758
|
+
if (ArrayBuffer.isView(chunk)) {
|
|
759
|
+
return new Uint8Array(chunk.buffer, chunk.byteOffset, chunk.byteLength);
|
|
760
|
+
}
|
|
761
|
+
throw new TypeError("Request body stream yielded a chunk that is not bytes or a string");
|
|
762
|
+
}
|
|
763
|
+
async function replayableBody(body, signal, maxBytes = MAX_REPLAY_BODY_BYTES) {
|
|
764
|
+
if (!(body instanceof ReadableStream))
|
|
765
|
+
return { body: body ?? undefined, replayable: true };
|
|
766
|
+
const reader = body.getReader();
|
|
767
|
+
const onAbort = () => {
|
|
768
|
+
reader.cancel(signal?.reason).catch(() => {});
|
|
769
|
+
};
|
|
770
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
771
|
+
const chunks = [];
|
|
772
|
+
let size = 0;
|
|
773
|
+
let overCap = false;
|
|
774
|
+
try {
|
|
775
|
+
for (;; ) {
|
|
776
|
+
signal?.throwIfAborted();
|
|
777
|
+
const { done, value } = await reader.read();
|
|
778
|
+
signal?.throwIfAborted();
|
|
779
|
+
if (done)
|
|
780
|
+
break;
|
|
781
|
+
const bytes = chunkBytes(value);
|
|
782
|
+
size += bytes.byteLength;
|
|
783
|
+
chunks.push(bytes);
|
|
784
|
+
if (size > maxBytes) {
|
|
785
|
+
overCap = true;
|
|
786
|
+
break;
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
} catch (error) {
|
|
790
|
+
reader.cancel(error).catch(() => {});
|
|
791
|
+
reader.releaseLock();
|
|
792
|
+
throw error;
|
|
793
|
+
} finally {
|
|
794
|
+
signal?.removeEventListener("abort", onAbort);
|
|
795
|
+
}
|
|
796
|
+
if (overCap) {
|
|
797
|
+
const stream = new ReadableStream({
|
|
798
|
+
start(controller) {
|
|
799
|
+
for (const chunk of chunks.splice(0))
|
|
800
|
+
controller.enqueue(chunk);
|
|
801
|
+
},
|
|
802
|
+
async pull(controller) {
|
|
803
|
+
const { done, value } = await reader.read();
|
|
804
|
+
if (done)
|
|
805
|
+
controller.close();
|
|
806
|
+
else
|
|
807
|
+
controller.enqueue(chunkBytes(value));
|
|
808
|
+
},
|
|
809
|
+
cancel(reason) {
|
|
810
|
+
return reader.cancel(reason);
|
|
811
|
+
}
|
|
812
|
+
});
|
|
813
|
+
return { body: stream, replayable: false };
|
|
814
|
+
}
|
|
815
|
+
reader.releaseLock();
|
|
816
|
+
const out = new Uint8Array(size);
|
|
817
|
+
let offset = 0;
|
|
818
|
+
for (const chunk of chunks) {
|
|
819
|
+
out.set(chunk, offset);
|
|
820
|
+
offset += chunk.byteLength;
|
|
821
|
+
}
|
|
822
|
+
return { body: out, replayable: true };
|
|
823
|
+
}
|
|
824
|
+
function createGuardedFetch(baseFetch, options) {
|
|
825
|
+
const guarded = async (input, init) => {
|
|
826
|
+
const request = input instanceof Request ? input : null;
|
|
827
|
+
let url = new URL(input instanceof Request ? input.url : input instanceof URL ? input.href : input);
|
|
828
|
+
const mode = init?.redirect ?? request?.redirect ?? "follow";
|
|
829
|
+
let method = (init?.method ?? request?.method ?? "GET").toUpperCase();
|
|
830
|
+
let headers = new Headers(init?.headers ?? request?.headers);
|
|
831
|
+
const signal = init?.signal ?? request?.signal;
|
|
832
|
+
let body = init?.body ?? (request ? request.body : undefined);
|
|
833
|
+
let replayable = true;
|
|
834
|
+
if (mode === "follow")
|
|
835
|
+
({ body, replayable } = await replayableBody(body, signal));
|
|
836
|
+
for (let hop = 0;; hop++) {
|
|
837
|
+
const address = await assertEgressAllowed(url, options);
|
|
838
|
+
const hopInit = {
|
|
839
|
+
...init,
|
|
840
|
+
method,
|
|
841
|
+
headers,
|
|
842
|
+
body,
|
|
843
|
+
signal,
|
|
844
|
+
redirect: "manual"
|
|
845
|
+
};
|
|
846
|
+
const response = address ? await baseFetch(...pinToAddress(url, address, hopInit)) : await baseFetch(url, hopInit);
|
|
847
|
+
if (address)
|
|
848
|
+
Object.defineProperty(response, "url", { value: url.href });
|
|
849
|
+
if (!REDIRECT_STATUSES.has(response.status) || mode === "manual")
|
|
850
|
+
return response;
|
|
851
|
+
const location = response.headers.get("location");
|
|
852
|
+
if (!location)
|
|
853
|
+
return response;
|
|
854
|
+
if (mode === "error")
|
|
855
|
+
throw new TypeError(`fetch redirect refused (redirect: "error"): ${url.href}`);
|
|
856
|
+
if (hop >= MAX_REDIRECTS) {
|
|
857
|
+
throw new EgressDeniedError(`Script egress refused: more than ${MAX_REDIRECTS} redirects`);
|
|
858
|
+
}
|
|
859
|
+
await response.body?.cancel().catch(() => {});
|
|
860
|
+
const next = new URL(location, url);
|
|
861
|
+
({ method, headers, body } = nextHopRequest(response.status, url, next, {
|
|
862
|
+
method,
|
|
863
|
+
headers,
|
|
864
|
+
body
|
|
865
|
+
}));
|
|
866
|
+
if (!replayable && body !== undefined)
|
|
867
|
+
throw new RequestBodyTooLargeError(MAX_REPLAY_BODY_BYTES);
|
|
868
|
+
url = next;
|
|
869
|
+
}
|
|
870
|
+
};
|
|
871
|
+
return Object.assign(guarded, { preconnect: baseFetch.preconnect });
|
|
872
|
+
}
|
|
651
873
|
function parseEgressAllowlist(value) {
|
|
652
874
|
const entries = (value ?? "").split(",").map((entry) => entry.trim()).filter(Boolean);
|
|
653
875
|
return entries.length > 0 ? entries : null;
|
|
@@ -661,7 +883,7 @@ function validateEgressAllowlist(value) {
|
|
|
661
883
|
}
|
|
662
884
|
return null;
|
|
663
885
|
}
|
|
664
|
-
var BLOCKED_IPV4, BLOCKED_IPV4_RANGES, REDIRECT_STATUSES, MAX_REPLAY_BODY_BYTES;
|
|
886
|
+
var BLOCKED_IPV4, BLOCKED_IPV4_RANGES, EgressDeniedError, MAX_REDIRECTS = 5, REDIRECT_STATUSES, CREDENTIAL_HEADERS, MAX_REPLAY_BODY_BYTES, RequestBodyTooLargeError;
|
|
665
887
|
var init_egress_guard = __esm(() => {
|
|
666
888
|
BLOCKED_IPV4 = [
|
|
667
889
|
["0.0.0.0", 8],
|
|
@@ -680,8 +902,21 @@ var init_egress_guard = __esm(() => {
|
|
|
680
902
|
const size = 2 ** (32 - bits);
|
|
681
903
|
return { start: parseIPv4(network), size };
|
|
682
904
|
});
|
|
905
|
+
EgressDeniedError = class EgressDeniedError extends Error {
|
|
906
|
+
constructor(message) {
|
|
907
|
+
super(message);
|
|
908
|
+
this.name = "EgressDeniedError";
|
|
909
|
+
}
|
|
910
|
+
};
|
|
683
911
|
REDIRECT_STATUSES = new Set([301, 302, 303, 307, 308]);
|
|
912
|
+
CREDENTIAL_HEADERS = ["authorization", "cookie", "proxy-authorization"];
|
|
684
913
|
MAX_REPLAY_BODY_BYTES = 1024 * 1024;
|
|
914
|
+
RequestBodyTooLargeError = class RequestBodyTooLargeError extends Error {
|
|
915
|
+
constructor(limitBytes) {
|
|
916
|
+
super(`Cannot resend a streamed request body over ${limitBytes / (1024 * 1024)} MiB on a 307/308 redirect: it is sent as it is read, not kept in memory. Send a smaller or non-streamed body, or use redirect: "manual"`);
|
|
917
|
+
this.name = "RequestBodyTooLargeError";
|
|
918
|
+
}
|
|
919
|
+
};
|
|
685
920
|
});
|
|
686
921
|
|
|
687
922
|
// src/scripts-runtime/credential-broker/fetch-patch.ts
|
|
@@ -1031,6 +1266,27 @@ function timedStatement(sql, run) {
|
|
|
1031
1266
|
warnIfSlowStatement(sql, performance.now() - startedAt);
|
|
1032
1267
|
}
|
|
1033
1268
|
}
|
|
1269
|
+
function markSlice() {
|
|
1270
|
+
if (sliceStartedAt !== 0)
|
|
1271
|
+
return;
|
|
1272
|
+
sliceStartedAt = performance.now();
|
|
1273
|
+
setTimeout(() => {
|
|
1274
|
+
sliceStartedAt = 0;
|
|
1275
|
+
}, 0);
|
|
1276
|
+
}
|
|
1277
|
+
async function yieldIfSliceSpent() {
|
|
1278
|
+
markSlice();
|
|
1279
|
+
if (performance.now() - sliceStartedAt < SLICE_MS)
|
|
1280
|
+
return;
|
|
1281
|
+
await new Promise((resolve) => setImmediate(resolve));
|
|
1282
|
+
sliceStartedAt = 0;
|
|
1283
|
+
}
|
|
1284
|
+
async function runThenYield(run) {
|
|
1285
|
+
markSlice();
|
|
1286
|
+
const result = run();
|
|
1287
|
+
await yieldIfSliceSpent();
|
|
1288
|
+
return result;
|
|
1289
|
+
}
|
|
1034
1290
|
function sleep(ms) {
|
|
1035
1291
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
1036
1292
|
}
|
|
@@ -1143,7 +1399,7 @@ class BunSqliteClient {
|
|
|
1143
1399
|
}
|
|
1144
1400
|
async runTransactionAttempt(fn, readOnly, finalAttempt = false, deadlineAt) {
|
|
1145
1401
|
const release = await this.lock.acquire();
|
|
1146
|
-
const ctx = { closed: false, afterCommit: [] };
|
|
1402
|
+
const ctx = { closed: false, afterCommit: [], afterRollback: [] };
|
|
1147
1403
|
let began = false;
|
|
1148
1404
|
try {
|
|
1149
1405
|
const db = this.getDatabase();
|
|
@@ -1176,6 +1432,13 @@ class BunSqliteClient {
|
|
|
1176
1432
|
try {
|
|
1177
1433
|
this.getDatabase().run("ROLLBACK");
|
|
1178
1434
|
} catch {}
|
|
1435
|
+
for (const hook of ctx.afterRollback) {
|
|
1436
|
+
try {
|
|
1437
|
+
hook();
|
|
1438
|
+
} catch (hookErr) {
|
|
1439
|
+
console.error("[db-client] afterRollback hook threw:", hookErr);
|
|
1440
|
+
}
|
|
1441
|
+
}
|
|
1179
1442
|
}
|
|
1180
1443
|
throw err;
|
|
1181
1444
|
} finally {
|
|
@@ -1191,6 +1454,11 @@ class BunSqliteClient {
|
|
|
1191
1454
|
}
|
|
1192
1455
|
this.scheduleHook(fn);
|
|
1193
1456
|
}
|
|
1457
|
+
afterRollback(fn) {
|
|
1458
|
+
const ctx = txContext.getStore();
|
|
1459
|
+
if (ctx && !ctx.closed)
|
|
1460
|
+
ctx.afterRollback.push(fn);
|
|
1461
|
+
}
|
|
1194
1462
|
scheduleHook(fn) {
|
|
1195
1463
|
this.lock.acquire().then((release) => {
|
|
1196
1464
|
release();
|
|
@@ -1241,7 +1509,7 @@ class BunSqliteClient {
|
|
|
1241
1509
|
const ctx = txContext.getStore();
|
|
1242
1510
|
if (ctx && !ctx.closed) {
|
|
1243
1511
|
const db = this.getDatabase();
|
|
1244
|
-
return timed(() => op(db));
|
|
1512
|
+
return runThenYield(() => timed(() => op(db)));
|
|
1245
1513
|
}
|
|
1246
1514
|
let sleptMs = 0;
|
|
1247
1515
|
let sawBusy = false;
|
|
@@ -1251,6 +1519,7 @@ class BunSqliteClient {
|
|
|
1251
1519
|
const release = await this.lock.acquire();
|
|
1252
1520
|
let backoff = 0;
|
|
1253
1521
|
try {
|
|
1522
|
+
await yieldIfSliceSpent();
|
|
1254
1523
|
const db = this.getDatabase();
|
|
1255
1524
|
const result = timed(() => this.shortSpin(db, () => op(db), !canRetryAfter), canRetryAfter);
|
|
1256
1525
|
if (sawBusy)
|
|
@@ -1312,19 +1581,19 @@ class BunSqliteClient {
|
|
|
1312
1581
|
return this.getDatabase();
|
|
1313
1582
|
};
|
|
1314
1583
|
return {
|
|
1315
|
-
query:
|
|
1316
|
-
get:
|
|
1317
|
-
run:
|
|
1584
|
+
query: (sql, params = []) => runThenYield(() => timedStatement(sql, () => guard().query(sql).all(...params))),
|
|
1585
|
+
get: (sql, params = []) => runThenYield(() => timedStatement(sql, () => guard().query(sql).get(...params))),
|
|
1586
|
+
run: (sql, params = []) => runThenYield(() => {
|
|
1318
1587
|
const result = timedStatement(sql, () => guard().query(sql).run(...params));
|
|
1319
1588
|
return { changes: result.changes };
|
|
1320
|
-
}
|
|
1589
|
+
})
|
|
1321
1590
|
};
|
|
1322
1591
|
}
|
|
1323
1592
|
}
|
|
1324
1593
|
function createBunSqliteClient(getDatabase, busyRetry) {
|
|
1325
1594
|
return new BunSqliteClient(getDatabase, busyRetry);
|
|
1326
1595
|
}
|
|
1327
|
-
var DbTransactionDeadlineError, LOCK_WATCHDOG_MS = 30000, txContext, DEFAULT_FINAL_ATTEMPT_SPIN_MS = 250, DEFAULT_BUSY_RETRY, SLOW_STATEMENT_WARN_MS = 100, SLOW_STATEMENT_SQL_MAX_CHARS = 200, DEFAULT_MAX_GATE_MS = 1000, GATE_DECAY_MS = 5000;
|
|
1596
|
+
var DbTransactionDeadlineError, LOCK_WATCHDOG_MS = 30000, txContext, DEFAULT_FINAL_ATTEMPT_SPIN_MS = 250, DEFAULT_BUSY_RETRY, SLOW_STATEMENT_WARN_MS = 100, SLOW_STATEMENT_SQL_MAX_CHARS = 200, SLICE_MS = 25, sliceStartedAt = 0, DEFAULT_MAX_GATE_MS = 1000, GATE_DECAY_MS = 5000;
|
|
1328
1597
|
var init_db_client = __esm(() => {
|
|
1329
1598
|
init_secret_scrubber();
|
|
1330
1599
|
init_event_loop_lag();
|
|
@@ -2070,6 +2339,10 @@ var init_seed_prompt_templates = __esm(() => {
|
|
|
2070
2339
|
|
|
2071
2340
|
// src/be/db/runtime.ts
|
|
2072
2341
|
import { Database } from "bun:sqlite";
|
|
2342
|
+
function wasDbCreatedThisBoot() {
|
|
2343
|
+
getDb2();
|
|
2344
|
+
return dbCreatedThisBoot;
|
|
2345
|
+
}
|
|
2073
2346
|
function isSqliteVecAvailable2() {
|
|
2074
2347
|
return sqliteVecAvailable;
|
|
2075
2348
|
}
|
|
@@ -2140,6 +2413,7 @@ function initDb2(dbPath = "./agent-swarm-db.sqlite") {
|
|
|
2140
2413
|
}
|
|
2141
2414
|
}
|
|
2142
2415
|
function bootOpenedDb(database, dbPath, resolvePromptTemplate, autoEncryptLegacyPlaintextSecrets) {
|
|
2416
|
+
dbCreatedThisBoot = database.prepare("SELECT 1 FROM sqlite_master LIMIT 1").get() === null;
|
|
2143
2417
|
database.run("PRAGMA journal_mode = WAL;");
|
|
2144
2418
|
database.run("PRAGMA busy_timeout = 5000;");
|
|
2145
2419
|
database.run("PRAGMA foreign_keys = ON;");
|
|
@@ -2253,6 +2527,7 @@ function closeDb2() {
|
|
|
2253
2527
|
db = null;
|
|
2254
2528
|
}
|
|
2255
2529
|
sqliteVecAvailable = false;
|
|
2530
|
+
dbCreatedThisBoot = false;
|
|
2256
2531
|
}
|
|
2257
2532
|
function getDbClient2() {
|
|
2258
2533
|
if (!dbClientInstance) {
|
|
@@ -2298,7 +2573,7 @@ function seedContextVersions() {
|
|
|
2298
2573
|
}
|
|
2299
2574
|
}
|
|
2300
2575
|
}
|
|
2301
|
-
var db = null, sqliteVecAvailable = false, cachedSqliteVecExtensionPath = null, dbClientInstance = null, VERSIONABLE_FIELDS;
|
|
2576
|
+
var db = null, sqliteVecAvailable = false, dbCreatedThisBoot = false, cachedSqliteVecExtensionPath = null, dbClientInstance = null, VERSIONABLE_FIELDS;
|
|
2302
2577
|
var init_runtime2 = __esm(() => {
|
|
2303
2578
|
init_resolver();
|
|
2304
2579
|
init_types5();
|
|
@@ -2342,6 +2617,7 @@ function rowToSessionCost(row) {
|
|
|
2342
2617
|
model: row.model,
|
|
2343
2618
|
isError: row.isError === 1,
|
|
2344
2619
|
costSource: row.costSource ?? "harness",
|
|
2620
|
+
kind: row.kind ?? "harness",
|
|
2345
2621
|
harnessCostUsd: row.harnessCostUsd,
|
|
2346
2622
|
cacheWrite5mTokens: row.cacheWrite5mTokens,
|
|
2347
2623
|
cacheWrite1hTokens: row.cacheWrite1hTokens,
|
|
@@ -2375,9 +2651,9 @@ async function insertSessionCost2(input) {
|
|
|
2375
2651
|
reasoningOutputTokens, thinkingTokens,
|
|
2376
2652
|
durationMs, numTurns, model, isError,
|
|
2377
2653
|
costSource, harnessCostUsd, cacheWrite5mTokens, cacheWrite1hTokens,
|
|
2378
|
-
modelBreakdown, credentialKeyType, credentialKeySuffix, harness, createdAt
|
|
2654
|
+
modelBreakdown, credentialKeyType, credentialKeySuffix, harness, kind, createdAt
|
|
2379
2655
|
)
|
|
2380
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))
|
|
2656
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))
|
|
2381
2657
|
ON CONFLICT(id) DO NOTHING`, [
|
|
2382
2658
|
id,
|
|
2383
2659
|
input.sessionId,
|
|
@@ -2404,7 +2680,8 @@ async function insertSessionCost2(input) {
|
|
|
2404
2680
|
}))) : null,
|
|
2405
2681
|
input.credentialKeyType ?? null,
|
|
2406
2682
|
input.credentialKeySuffix ?? null,
|
|
2407
|
-
input.harness ?? null
|
|
2683
|
+
input.harness ?? null,
|
|
2684
|
+
input.kind ?? "harness"
|
|
2408
2685
|
]);
|
|
2409
2686
|
const row = await client.get("SELECT * FROM session_costs WHERE id = ?", [id]);
|
|
2410
2687
|
if (!row)
|
|
@@ -5414,7 +5691,7 @@ var init_telemetry = __esm(() => {
|
|
|
5414
5691
|
// src/telemetry-identity.ts
|
|
5415
5692
|
async function loadUserRole(userId) {
|
|
5416
5693
|
try {
|
|
5417
|
-
const { getUserGrant } = await import("./rbac-roles-
|
|
5694
|
+
const { getUserGrant } = await import("./rbac-roles-8msjr07m.js");
|
|
5418
5695
|
const grant = await getUserGrant(userId);
|
|
5419
5696
|
const role = grant.grantsAll ? "admin" : "member";
|
|
5420
5697
|
const user = await getDbClient2().get("SELECT json_extract(metadata, '$.jobFunction') AS jobFunction FROM users WHERE id = ? AND json_valid(metadata)", [userId]);
|
|
@@ -6286,7 +6563,7 @@ function scheduleApprovalCardUpdates(approvals) {
|
|
|
6286
6563
|
const posted = approvals.filter((approval) => approval.notificationChannels?.some((n) => n.channel === "slack" && n.messageTs));
|
|
6287
6564
|
if (posted.length === 0)
|
|
6288
6565
|
return;
|
|
6289
|
-
getDbClient2().afterCommit(() => import("./approval-notifications-
|
|
6566
|
+
getDbClient2().afterCommit(() => import("./approval-notifications-a0db0esw.js").then(({ updateResolvedApprovalCards }) => updateResolvedApprovalCards(posted)).catch((err) => console.error("[HITL] Slack card update not run:", scrubSecrets(err instanceof Error ? err.message : String(err)))));
|
|
6290
6567
|
}
|
|
6291
6568
|
var init_approvals = __esm(() => {
|
|
6292
6569
|
init_secret_scrubber();
|
|
@@ -6640,6 +6917,7 @@ var init_legacy_policy = __esm(() => {
|
|
|
6640
6917
|
"models.catalog.write": leadOrOperator,
|
|
6641
6918
|
"models.harness-support.write": agentOrOperator,
|
|
6642
6919
|
"models.profiles.write": operatorOnly,
|
|
6920
|
+
"models.groups.write": leadOrOperatorOrUser,
|
|
6643
6921
|
"skill.create.swarm": leadOnly,
|
|
6644
6922
|
"skill.install.any": leadOnly,
|
|
6645
6923
|
"skill.install.global": leadOnly,
|
|
@@ -6940,6 +7218,10 @@ var init_permissions = __esm(() => {
|
|
|
6940
7218
|
description: "Create, update, or delete model profiles (named harness + model + effort). Operator (shared API key) only.",
|
|
6941
7219
|
namespace: "models"
|
|
6942
7220
|
},
|
|
7221
|
+
"models.groups.write": {
|
|
7222
|
+
description: "Create, update, reorder, or delete model groups (named, ordered lists of model profiles). Lead, operator, or dashboard user.",
|
|
7223
|
+
namespace: "models"
|
|
7224
|
+
},
|
|
6943
7225
|
"config.read.secrets": {
|
|
6944
7226
|
description: "Read unmasked secret config values.",
|
|
6945
7227
|
namespace: "config"
|
|
@@ -7338,7 +7620,8 @@ var init_pricing_normalize = __esm(() => {
|
|
|
7338
7620
|
amp: ["anthropic/", "openai/", "google-vertex/", "google/"],
|
|
7339
7621
|
cursor: [],
|
|
7340
7622
|
grok: ["openrouter/", "xai/"],
|
|
7341
|
-
fx: ["openrouter/", "vercel/"]
|
|
7623
|
+
fx: ["openrouter/", "vercel/"],
|
|
7624
|
+
"system-one": []
|
|
7342
7625
|
};
|
|
7343
7626
|
AMP_DATED_SUFFIX = /-\d{4}-\d{2}-\d{2}$/;
|
|
7344
7627
|
});
|
|
@@ -10352,17 +10635,24 @@ async function modelProfileReferences(name) {
|
|
|
10352
10635
|
const fallbackOf = await getDbClient2().query(`SELECT o.name FROM model_profiles o,
|
|
10353
10636
|
json_each(CASE WHEN json_valid(o.fallbacks) THEN o.fallbacks ELSE '[]' END) j
|
|
10354
10637
|
WHERE j.value = ? AND o.name <> ? ORDER BY o.name`, [name, name]);
|
|
10638
|
+
const groups = await getDbClient2().query(`SELECT g.name FROM model_group_members m JOIN model_groups g ON g.id = m.groupId
|
|
10639
|
+
WHERE m.profileName = ? ORDER BY g.name`, [name]);
|
|
10355
10640
|
return {
|
|
10356
10641
|
agentIds: agents.map((a) => a.scopeId),
|
|
10357
10642
|
openTaskCount: tasks?.n ?? 0,
|
|
10358
10643
|
scheduleIds: schedules.map((s) => s.id),
|
|
10359
|
-
fallbackOf: [...new Set(fallbackOf.map((p) => p.name))]
|
|
10644
|
+
fallbackOf: [...new Set(fallbackOf.map((p) => p.name))],
|
|
10645
|
+
groups: groups.map((g) => g.name)
|
|
10360
10646
|
};
|
|
10361
10647
|
}
|
|
10362
10648
|
function modelProfileRefError(error) {
|
|
10363
10649
|
const message = error instanceof Error ? error.message : "";
|
|
10364
10650
|
return message.includes("model-profile-missing:") ? "missing" : null;
|
|
10365
10651
|
}
|
|
10652
|
+
function isModelNameTakenError(error) {
|
|
10653
|
+
const message = error instanceof Error ? error.message : "";
|
|
10654
|
+
return message.includes("model-name-taken:");
|
|
10655
|
+
}
|
|
10366
10656
|
async function deleteModelProfile(name) {
|
|
10367
10657
|
const row = await getDbClient2().get(`DELETE FROM model_profiles
|
|
10368
10658
|
WHERE name = ?
|
|
@@ -10376,6 +10666,8 @@ async function deleteModelProfile(name) {
|
|
|
10376
10666
|
AND NOT EXISTS (
|
|
10377
10667
|
SELECT 1 FROM scheduled_tasks s WHERE s.profile = model_profiles.name)
|
|
10378
10668
|
AND NOT ${LISTED_AS_FALLBACK_SQL}
|
|
10669
|
+
AND NOT EXISTS (
|
|
10670
|
+
SELECT 1 FROM model_group_members m WHERE m.profileName = model_profiles.name)
|
|
10379
10671
|
RETURNING id`, [name, repairWindowStart(), MODEL_PROFILE_CONFIG_KEY]);
|
|
10380
10672
|
if (row)
|
|
10381
10673
|
return "deleted";
|
|
@@ -11287,7 +11579,9 @@ async function closeSlackTreeIfSettled(id) {
|
|
|
11287
11579
|
WHERE tree.id = ?
|
|
11288
11580
|
AND tree.kind = 'tree'
|
|
11289
11581
|
AND tree.closed_at IS NULL
|
|
11290
|
-
AND tree.ts NOT LIKE 'pending:%'
|
|
11582
|
+
AND (tree.ts NOT LIKE 'pending:%' OR EXISTS (
|
|
11583
|
+
SELECT 1 FROM slack_render_v2_state state WHERE state.id = 1 AND NOT ${SLACK_TREE_VISIBLE_SQL}
|
|
11584
|
+
))
|
|
11291
11585
|
AND EXISTS (
|
|
11292
11586
|
SELECT 1 FROM slack_render_v2_state state
|
|
11293
11587
|
WHERE state.id = 1 AND NOT ${SLACK_TREE_NEEDS_RENDER_SQL}
|
|
@@ -11314,7 +11608,19 @@ async function getSlackThreadsOfTasks(taskIds) {
|
|
|
11314
11608
|
}
|
|
11315
11609
|
return { threads: [...threads.values()], wakeTouched };
|
|
11316
11610
|
}
|
|
11317
|
-
async function
|
|
11611
|
+
async function slackThreadHasBotReplySince(channelId, threadTs, since, taskId) {
|
|
11612
|
+
const row = await getDbClient2().get(`SELECT EXISTS (
|
|
11613
|
+
SELECT 1 FROM slack_messages reply
|
|
11614
|
+
WHERE reply.channel_id = ? AND reply.thread_ts = ? AND reply.created_at >= ?
|
|
11615
|
+
AND (reply.kind = 'agent'
|
|
11616
|
+
OR (reply.kind = 'outcome' AND reply.finalized_at IS NOT NULL AND reply.task_id != ?))
|
|
11617
|
+
) AS found`, [channelId, threadTs, since, taskId]);
|
|
11618
|
+
return !!row?.found;
|
|
11619
|
+
}
|
|
11620
|
+
function slackOutcomeWindowParams(window2) {
|
|
11621
|
+
return [window2.finishedAfter, Number(window2.delegationEnabled), window2.closureActiveAfter];
|
|
11622
|
+
}
|
|
11623
|
+
async function slackThreadHasOutcomeWork(thread, window2) {
|
|
11318
11624
|
const row = await getDbClient2().get(`SELECT EXISTS (
|
|
11319
11625
|
SELECT 1 FROM agent_tasks task, slack_render_v2_state state
|
|
11320
11626
|
WHERE state.id = 1
|
|
@@ -11322,6 +11628,7 @@ async function slackThreadHasOutcomeWork(thread) {
|
|
|
11322
11628
|
AND task.source = 'slack'
|
|
11323
11629
|
AND task.createdAt >= state.activated_at
|
|
11324
11630
|
AND task.status IN ('completed', 'failed', 'cancelled')
|
|
11631
|
+
AND ${SLACK_OUTCOME_WINDOW_SQL}
|
|
11325
11632
|
AND NOT EXISTS (
|
|
11326
11633
|
SELECT 1 FROM slack_messages outcome
|
|
11327
11634
|
WHERE outcome.kind = 'outcome'
|
|
@@ -11333,10 +11640,116 @@ async function slackThreadHasOutcomeWork(thread) {
|
|
|
11333
11640
|
WHERE outcome.kind = 'outcome'
|
|
11334
11641
|
AND outcome.channel_id = ? AND outcome.thread_ts = ?
|
|
11335
11642
|
AND outcome.finalized_at IS NULL AND outcome.delivery_abandoned_at IS NULL
|
|
11336
|
-
) AS pending`, [
|
|
11643
|
+
) AS pending`, [
|
|
11644
|
+
thread.channelId,
|
|
11645
|
+
thread.threadTs,
|
|
11646
|
+
...slackOutcomeWindowParams(window2),
|
|
11647
|
+
thread.channelId,
|
|
11648
|
+
thread.threadTs
|
|
11649
|
+
]);
|
|
11337
11650
|
return !!row?.pending;
|
|
11338
11651
|
}
|
|
11339
|
-
|
|
11652
|
+
async function observeSlackTreeVisibility(enabled) {
|
|
11653
|
+
const current = await getDbClient2().get("SELECT task_tree_enabled, task_tree_enabled_at FROM slack_render_v2_state WHERE id = 1");
|
|
11654
|
+
if (!current || current.task_tree_enabled === Number(enabled)) {
|
|
11655
|
+
return current?.task_tree_enabled_at ?? null;
|
|
11656
|
+
}
|
|
11657
|
+
const row = await getDbClient2().get(`UPDATE slack_render_v2_state SET
|
|
11658
|
+
task_tree_enabled_at = CASE WHEN task_tree_enabled = 0 AND ? = 1
|
|
11659
|
+
THEN ? ELSE task_tree_enabled_at END,
|
|
11660
|
+
task_tree_enabled = ?
|
|
11661
|
+
WHERE id = 1 RETURNING task_tree_enabled_at`, [Number(enabled), new Date().toISOString(), Number(enabled)]);
|
|
11662
|
+
return row?.task_tree_enabled_at ?? null;
|
|
11663
|
+
}
|
|
11664
|
+
async function getSlackProcessingThreads(delegationEnabled, treesEnabled, window2) {
|
|
11665
|
+
return getDbClient2().transaction(async () => {
|
|
11666
|
+
const state = await getDbClient2().get("SELECT reconcile_cursors FROM slack_render_v2_state WHERE id = 1");
|
|
11667
|
+
if (!state)
|
|
11668
|
+
return [];
|
|
11669
|
+
const cursors = JSON.parse(state.reconcile_cursors);
|
|
11670
|
+
const threads = new Map;
|
|
11671
|
+
async function page(source, sql, extra = []) {
|
|
11672
|
+
const rows = await getDbClient2().query(sql, [cursors[source] ?? "", SLACK_RECONCILE_PAGE_SIZE, ...extra]);
|
|
11673
|
+
cursors[source] = rows.length < SLACK_RECONCILE_PAGE_SIZE ? "" : rows.at(-1).id;
|
|
11674
|
+
for (const row of rows) {
|
|
11675
|
+
if (row.eligible)
|
|
11676
|
+
threads.set(`${row.channelId}\x00${row.threadTs}`, {
|
|
11677
|
+
channelId: row.channelId,
|
|
11678
|
+
threadTs: row.threadTs
|
|
11679
|
+
});
|
|
11680
|
+
}
|
|
11681
|
+
}
|
|
11682
|
+
await page("active", `WITH candidates AS MATERIALIZED (
|
|
11683
|
+
SELECT id, slackChannelId, slackThreadTs, createdAt FROM agent_tasks INDEXED BY idx_slack_reconcile_active
|
|
11684
|
+
WHERE slackChannelId IS NOT NULL AND slackThreadTs IS NOT NULL
|
|
11685
|
+
AND status IN ('offered', 'reviewing', 'pending', 'in_progress', 'paused')
|
|
11686
|
+
AND id > ? ORDER BY id LIMIT ?
|
|
11687
|
+
) SELECT task.id, task.slackChannelId AS channelId, task.slackThreadTs AS threadTs,
|
|
11688
|
+
task.createdAt >= state.activated_at AS eligible
|
|
11689
|
+
FROM candidates task, slack_render_v2_state state WHERE state.id = 1 ORDER BY task.id`);
|
|
11690
|
+
await page("terminal", `WITH candidates AS MATERIALIZED (
|
|
11691
|
+
SELECT * FROM agent_tasks INDEXED BY idx_slack_reconcile_terminal
|
|
11692
|
+
WHERE slackChannelId IS NOT NULL AND slackThreadTs IS NOT NULL
|
|
11693
|
+
AND status IN ('completed', 'failed', 'cancelled')
|
|
11694
|
+
AND id > ? ORDER BY id LIMIT ?
|
|
11695
|
+
) SELECT task.id, task.slackChannelId AS channelId, task.slackThreadTs AS threadTs,
|
|
11696
|
+
(task.createdAt >= state.activated_at
|
|
11697
|
+
AND (task.source = 'slack'
|
|
11698
|
+
OR (task.source = 'schedule' AND task.taskType = 'deferred')
|
|
11699
|
+
OR (? = 1 AND task.parentTaskId IS NOT NULL AND task.createdAt >= state.delegation_activated_at
|
|
11700
|
+
AND task.status IN ('completed', 'failed') AND task.slackReplySent = 0
|
|
11701
|
+
AND COALESCE(task.taskType, '') NOT IN ('follow-up', 'reroute-decision')))
|
|
11702
|
+
AND ${SLACK_OUTCOME_WINDOW_SQL}
|
|
11703
|
+
AND NOT (task.source = 'schedule' AND task.taskType = 'deferred'
|
|
11704
|
+
AND ${SLACK_WAKE_ALREADY_ANSWERED_SQL})
|
|
11705
|
+
AND NOT EXISTS (
|
|
11706
|
+
SELECT 1 FROM agent_tasks parent JOIN slack_messages parent_card ON parent_card.task_id = parent.id
|
|
11707
|
+
WHERE task.source = 'schedule' AND task.taskType = 'deferred' AND parent.id = task.parentTaskId
|
|
11708
|
+
AND parent.deferredAt IS NOT NULL AND parent_card.kind = 'outcome'
|
|
11709
|
+
AND parent_card.finalized_at IS NOT NULL AND parent_card.deferral_abandoned_at IS NULL
|
|
11710
|
+
)
|
|
11711
|
+
AND NOT EXISTS (SELECT 1 FROM slack_messages card WHERE card.kind = 'outcome'
|
|
11712
|
+
AND card.task_id = task.id
|
|
11713
|
+
AND (card.finalized_at IS NOT NULL OR card.delivery_abandoned_at IS NOT NULL))) AS eligible
|
|
11714
|
+
FROM candidates task, slack_render_v2_state state WHERE state.id = 1 ORDER BY task.id`, [Number(delegationEnabled), ...slackOutcomeWindowParams(window2)]);
|
|
11715
|
+
await page("outcome", `SELECT id, channel_id AS channelId, thread_ts AS threadTs, 1 AS eligible
|
|
11716
|
+
FROM slack_messages INDEXED BY idx_slack_reconcile_outcome
|
|
11717
|
+
WHERE kind = 'outcome' AND finalized_at IS NULL AND delivery_abandoned_at IS NULL
|
|
11718
|
+
AND id > ? ORDER BY id LIMIT ?`);
|
|
11719
|
+
if (treesEnabled)
|
|
11720
|
+
await page("tree", `WITH candidates AS MATERIALIZED (
|
|
11721
|
+
SELECT * FROM slack_messages INDEXED BY idx_slack_reconcile_tree
|
|
11722
|
+
WHERE kind = 'tree' AND closed_at IS NULL AND id > ? ORDER BY id LIMIT ?
|
|
11723
|
+
) SELECT tree.id, tree.channel_id AS channelId, tree.thread_ts AS threadTs,
|
|
11724
|
+
${SLACK_TREE_NEEDS_RENDER_SQL} AS eligible
|
|
11725
|
+
FROM candidates tree, slack_render_v2_state state WHERE state.id = 1 ORDER BY tree.id`);
|
|
11726
|
+
const next = JSON.stringify(cursors);
|
|
11727
|
+
if (next !== state.reconcile_cursors)
|
|
11728
|
+
await getDbClient2().run("UPDATE slack_render_v2_state SET reconcile_cursors = ? WHERE id = 1", [next]);
|
|
11729
|
+
return [...threads.values()];
|
|
11730
|
+
});
|
|
11731
|
+
}
|
|
11732
|
+
var SLACK_TREE_VISIBLE_SQL = `(COALESCE(state.task_tree_enabled, 1) = 1 AND (
|
|
11733
|
+
state.task_tree_enabled_at IS NULL OR EXISTS (
|
|
11734
|
+
SELECT 1 FROM agent_tasks visible_task
|
|
11735
|
+
WHERE visible_task.slackChannelId = tree.channel_id
|
|
11736
|
+
AND visible_task.slackThreadTs = tree.thread_ts
|
|
11737
|
+
AND (visible_task.status NOT IN ('completed', 'failed', 'cancelled', 'superseded', 'skipped')
|
|
11738
|
+
OR visible_task.finishedAt > state.task_tree_enabled_at)
|
|
11739
|
+
)
|
|
11740
|
+
))`, SLACK_TREE_NEEDS_RENDER_SQL, THREAD_LOOKUP_CHUNK = 500, SLACK_OUTCOME_WINDOW_SQL = `(COALESCE(task.finishedAt, task.lastUpdatedAt) >= ?
|
|
11741
|
+
OR (? = 1 AND task.source = 'slack' AND task.createdAt >= state.delegation_activated_at
|
|
11742
|
+
AND EXISTS (SELECT 1 FROM agent_tasks recent
|
|
11743
|
+
WHERE recent.slackChannelId = task.slackChannelId AND recent.slackThreadTs = task.slackThreadTs
|
|
11744
|
+
AND recent.lastUpdatedAt >= ?)))`, SLACK_WAKE_ALREADY_ANSWERED_SQL = `(task.slackReplySent = 1 OR EXISTS (
|
|
11745
|
+
SELECT 1 FROM slack_messages reply
|
|
11746
|
+
WHERE reply.channel_id = task.slackChannelId AND reply.thread_ts = task.slackThreadTs
|
|
11747
|
+
AND reply.created_at >= task.createdAt
|
|
11748
|
+
AND (reply.kind = 'agent'
|
|
11749
|
+
OR (reply.kind = 'outcome' AND reply.finalized_at IS NOT NULL AND reply.task_id != task.id))))`, SLACK_RECONCILE_PAGE_SIZE = 50;
|
|
11750
|
+
var init_slack_trees = __esm(() => {
|
|
11751
|
+
init_db4();
|
|
11752
|
+
SLACK_TREE_NEEDS_RENDER_SQL = `(${SLACK_TREE_VISIBLE_SQL} AND (
|
|
11340
11753
|
(tree.ts LIKE 'pending:%' AND tree.created_at >= state.activated_at)
|
|
11341
11754
|
OR EXISTS (
|
|
11342
11755
|
SELECT 1 FROM agent_tasks task
|
|
@@ -11379,9 +11792,7 @@ var SLACK_TREE_NEEDS_RENDER_SQL = `(
|
|
|
11379
11792
|
OR outcome.updated_at > tree.updated_at
|
|
11380
11793
|
)
|
|
11381
11794
|
)
|
|
11382
|
-
)
|
|
11383
|
-
var init_slack_trees = __esm(() => {
|
|
11384
|
-
init_db4();
|
|
11795
|
+
))`;
|
|
11385
11796
|
});
|
|
11386
11797
|
|
|
11387
11798
|
// src/be/db/tasks/eligibility-scan.ts
|
|
@@ -11950,7 +12361,7 @@ async function completeTask2(id, output, options) {
|
|
|
11950
12361
|
});
|
|
11951
12362
|
} catch {}
|
|
11952
12363
|
getDbClient2().afterCommit(() => {
|
|
11953
|
-
import("./event-bus-
|
|
12364
|
+
import("./event-bus-swr88jg5.js").then(({ workflowEventBus }) => {
|
|
11954
12365
|
workflowEventBus.emit("task.completed", {
|
|
11955
12366
|
taskId: id,
|
|
11956
12367
|
output: scrubbedOutput,
|
|
@@ -12005,7 +12416,7 @@ async function failTask2(id, reason, opts = {}) {
|
|
|
12005
12416
|
});
|
|
12006
12417
|
} catch {}
|
|
12007
12418
|
getDbClient2().afterCommit(() => {
|
|
12008
|
-
import("./event-bus-
|
|
12419
|
+
import("./event-bus-swr88jg5.js").then(({ workflowEventBus }) => {
|
|
12009
12420
|
workflowEventBus.emit("task.failed", {
|
|
12010
12421
|
taskId: id,
|
|
12011
12422
|
failureReason: scrubbedReason,
|
|
@@ -12087,7 +12498,7 @@ async function cancelTask2(id, reason, options = {}) {
|
|
|
12087
12498
|
});
|
|
12088
12499
|
} catch {}
|
|
12089
12500
|
getDbClient2().afterCommit(() => {
|
|
12090
|
-
import("./event-bus-
|
|
12501
|
+
import("./event-bus-swr88jg5.js").then(({ workflowEventBus }) => {
|
|
12091
12502
|
workflowEventBus.emit("task.cancelled", {
|
|
12092
12503
|
taskId: id,
|
|
12093
12504
|
agentId: row.agentId,
|
|
@@ -12099,7 +12510,7 @@ async function cancelTask2(id, reason, options = {}) {
|
|
|
12099
12510
|
if (row.source === "schedule" && row.taskType === "deferred" && row.parentTaskId) {
|
|
12100
12511
|
getDbClient2().afterCommit(async () => {
|
|
12101
12512
|
try {
|
|
12102
|
-
const { createWorkerTaskFollowUp } = await import("./worker-follow-up-
|
|
12513
|
+
const { createWorkerTaskFollowUp } = await import("./worker-follow-up-1gs4aw7y.js");
|
|
12103
12514
|
await createWorkerTaskFollowUp({
|
|
12104
12515
|
task: rowToAgentTask(row),
|
|
12105
12516
|
status: "failed",
|
|
@@ -12148,7 +12559,7 @@ async function skipTask2(id, reason) {
|
|
|
12148
12559
|
});
|
|
12149
12560
|
} catch {}
|
|
12150
12561
|
getDbClient2().afterCommit(() => {
|
|
12151
|
-
import("./event-bus-
|
|
12562
|
+
import("./event-bus-swr88jg5.js").then(({ workflowEventBus }) => {
|
|
12152
12563
|
workflowEventBus.emit("task.skipped", {
|
|
12153
12564
|
taskId: id,
|
|
12154
12565
|
failureReason: skipReason,
|
|
@@ -12200,7 +12611,7 @@ async function supersedeTask2(id, args) {
|
|
|
12200
12611
|
});
|
|
12201
12612
|
} catch {}
|
|
12202
12613
|
getDbClient2().afterCommit(() => {
|
|
12203
|
-
import("./event-bus-
|
|
12614
|
+
import("./event-bus-swr88jg5.js").then(({ workflowEventBus }) => {
|
|
12204
12615
|
workflowEventBus.emit("task.superseded", {
|
|
12205
12616
|
taskId: id,
|
|
12206
12617
|
reason: args.reason,
|
|
@@ -12435,7 +12846,7 @@ async function updateTaskProgress2(id, progress) {
|
|
|
12435
12846
|
});
|
|
12436
12847
|
} catch {}
|
|
12437
12848
|
getDbClient2().afterCommit(() => {
|
|
12438
|
-
import("./event-bus-
|
|
12849
|
+
import("./event-bus-swr88jg5.js").then(({ workflowEventBus }) => {
|
|
12439
12850
|
workflowEventBus.emit("task.progress", {
|
|
12440
12851
|
taskId: id,
|
|
12441
12852
|
progress: scrubbedProgress,
|
|
@@ -12464,6 +12875,47 @@ var init_write = __esm(() => {
|
|
|
12464
12875
|
lastAffinityDispatchSkipLoggedAt = new Map;
|
|
12465
12876
|
});
|
|
12466
12877
|
|
|
12878
|
+
// src/be/db/user-references.ts
|
|
12879
|
+
function quoteSqlIdentifier(identifier) {
|
|
12880
|
+
return `"${identifier.replaceAll('"', '""')}"`;
|
|
12881
|
+
}
|
|
12882
|
+
function userReferenceRewriteSql(reference) {
|
|
12883
|
+
const table = quoteSqlIdentifier(reference.tableName);
|
|
12884
|
+
const column = quoteSqlIdentifier(reference.columnName);
|
|
12885
|
+
return `UPDATE ${table} SET ${column} = ? WHERE ${column} = ?`;
|
|
12886
|
+
}
|
|
12887
|
+
var USER_REFERENCE_COLUMNS_SQL = `SELECT tables.name AS tableName, foreign_keys."from" AS columnName
|
|
12888
|
+
FROM sqlite_schema AS tables
|
|
12889
|
+
JOIN pragma_foreign_key_list(tables.name) AS foreign_keys
|
|
12890
|
+
JOIN pragma_table_info(tables.name) AS columns
|
|
12891
|
+
ON columns.name = foreign_keys."from"
|
|
12892
|
+
WHERE tables.type = 'table'
|
|
12893
|
+
AND foreign_keys."table" = 'users'
|
|
12894
|
+
AND foreign_keys.on_delete IN ('NO ACTION', 'RESTRICT')
|
|
12895
|
+
AND columns."notnull" = 0
|
|
12896
|
+
UNION ALL
|
|
12897
|
+
SELECT 'scheduled_tasks' AS tableName, columns.name AS columnName
|
|
12898
|
+
FROM pragma_table_info('scheduled_tasks') AS columns
|
|
12899
|
+
WHERE columns.name IN ('created_by', 'updated_by')
|
|
12900
|
+
AND columns."notnull" = 0
|
|
12901
|
+
AND NOT EXISTS (
|
|
12902
|
+
SELECT 1
|
|
12903
|
+
FROM pragma_foreign_key_list('scheduled_tasks') AS foreign_keys
|
|
12904
|
+
WHERE foreign_keys."from" = columns.name
|
|
12905
|
+
AND foreign_keys."table" = 'users'
|
|
12906
|
+
)`, WORKFLOW_CONTEXT_REQUESTER_SQL = "CASE WHEN json_valid(context) THEN json_extract(context, '$.swarm.requestedByUserId') END", WORKFLOW_SEALED_CONTEXT_BY_REQUESTER_SQL, WORKFLOW_CONTEXT_SET_REQUESTER_SQL, WORKFLOW_CONTEXT_REMOVE_REQUESTER_SQL;
|
|
12907
|
+
var init_user_references = __esm(() => {
|
|
12908
|
+
WORKFLOW_SEALED_CONTEXT_BY_REQUESTER_SQL = `SELECT id, context_replay FROM workflow_runs
|
|
12909
|
+
WHERE ${WORKFLOW_CONTEXT_REQUESTER_SQL} = ?
|
|
12910
|
+
AND context_replay IS NOT NULL`;
|
|
12911
|
+
WORKFLOW_CONTEXT_SET_REQUESTER_SQL = `UPDATE workflow_runs
|
|
12912
|
+
SET context = json_set(context, '$.swarm.requestedByUserId', ?)
|
|
12913
|
+
WHERE ${WORKFLOW_CONTEXT_REQUESTER_SQL} = ?`;
|
|
12914
|
+
WORKFLOW_CONTEXT_REMOVE_REQUESTER_SQL = `UPDATE workflow_runs
|
|
12915
|
+
SET context = json_remove(context, '$.swarm.requestedByUserId')
|
|
12916
|
+
WHERE ${WORKFLOW_CONTEXT_REQUESTER_SQL} = ?`;
|
|
12917
|
+
});
|
|
12918
|
+
|
|
12467
12919
|
// src/be/db/workflow-idempotency.ts
|
|
12468
12920
|
function sha256(text) {
|
|
12469
12921
|
const hasher = new Bun.CryptoHasher("sha256");
|
|
@@ -12963,7 +13415,7 @@ function emitRunFinished(runId, workflowId, status) {
|
|
|
12963
13415
|
}
|
|
12964
13416
|
function emitBusEventAfterCommit(event, payload) {
|
|
12965
13417
|
getDbClient2().afterCommit(() => {
|
|
12966
|
-
import("./event-bus-
|
|
13418
|
+
import("./event-bus-swr88jg5.js").then(({ workflowEventBus }) => {
|
|
12967
13419
|
workflowEventBus.emit(event, payload);
|
|
12968
13420
|
}).catch((err) => console.error(`[db] ${event} event not emitted:`, scrubSecrets(err instanceof Error ? err.message : String(err))));
|
|
12969
13421
|
});
|
|
@@ -13324,11 +13776,26 @@ function normalizeSlackReactionShortcode(raw) {
|
|
|
13324
13776
|
}
|
|
13325
13777
|
function reactionName(event) {
|
|
13326
13778
|
const raw = process.env[SLACK_REACTION_CONFIG_KEYS[event]];
|
|
13779
|
+
if (raw !== undefined && raw.trim() === "")
|
|
13780
|
+
return null;
|
|
13327
13781
|
const normalized = normalizeSlackReactionShortcode(raw);
|
|
13328
13782
|
return normalized ?? SLACK_REACTION_DEFAULTS[event];
|
|
13329
13783
|
}
|
|
13784
|
+
function isSlackIconConfigKey(key) {
|
|
13785
|
+
return key === SLACK_STATUS_ICON_COMPLETED_KEY || Object.values(SLACK_REACTION_CONFIG_KEYS).includes(key);
|
|
13786
|
+
}
|
|
13787
|
+
function reactionStatusIcon(event) {
|
|
13788
|
+
const name = reactionName(event);
|
|
13789
|
+
return name === null ? "" : `:${name}:`;
|
|
13790
|
+
}
|
|
13791
|
+
function iconPrefix(icon) {
|
|
13792
|
+
return icon ? `${icon} ` : "";
|
|
13793
|
+
}
|
|
13330
13794
|
function completedStatusIcon() {
|
|
13331
|
-
const
|
|
13795
|
+
const raw = process.env[SLACK_STATUS_ICON_COMPLETED_KEY];
|
|
13796
|
+
if (raw !== undefined && raw.trim() === "")
|
|
13797
|
+
return "";
|
|
13798
|
+
const normalized = normalizeSlackReactionShortcode(raw);
|
|
13332
13799
|
return normalized ? `:${normalized}:` : SLACK_STATUS_ICON_COMPLETED_DEFAULT;
|
|
13333
13800
|
}
|
|
13334
13801
|
var SLACK_REACTION_DEFAULTS, SLACK_REACTION_CONFIG_KEYS, SLACK_REACTION_SHORTCODE_PATTERN, SLACK_STATUS_ICON_COMPLETED_KEY = "SLACK_STATUS_ICON_COMPLETED", SLACK_STATUS_ICON_COMPLETED_DEFAULT = "✅";
|
|
@@ -13354,6 +13821,36 @@ var init_reaction_shortcode = __esm(() => {
|
|
|
13354
13821
|
SLACK_REACTION_SHORTCODE_PATTERN = /^[a-z0-9_+'-]+(::skin-tone-[2-6])?$/;
|
|
13355
13822
|
});
|
|
13356
13823
|
|
|
13824
|
+
// src/ui-spec/script-allowlist.ts
|
|
13825
|
+
function parseScriptActionAllowlist(raw) {
|
|
13826
|
+
const pins = [];
|
|
13827
|
+
const issues = [];
|
|
13828
|
+
for (const entry of (raw ?? "").split(",")) {
|
|
13829
|
+
const trimmed = entry.trim();
|
|
13830
|
+
if (!trimmed)
|
|
13831
|
+
continue;
|
|
13832
|
+
const at = trimmed.lastIndexOf("@");
|
|
13833
|
+
const name = at > 0 ? trimmed.slice(0, at).trim() : "";
|
|
13834
|
+
const hashPrefix = at > 0 ? trimmed.slice(at + 1).trim().toLowerCase() : "";
|
|
13835
|
+
if (!name || name.length > 200 || !PIN_HASH.test(hashPrefix)) {
|
|
13836
|
+
issues.push(`"${trimmed}" must be name@<contentHash>, with at least 12 hex chars of the script's contentHash`);
|
|
13837
|
+
continue;
|
|
13838
|
+
}
|
|
13839
|
+
pins.push({ name, hashPrefix });
|
|
13840
|
+
}
|
|
13841
|
+
return { pins, issues };
|
|
13842
|
+
}
|
|
13843
|
+
function validateScriptActionAllowlist(value) {
|
|
13844
|
+
if (typeof value !== "string")
|
|
13845
|
+
return "UI_SPEC_SCRIPT_ACTIONS must be a string";
|
|
13846
|
+
const { issues } = parseScriptActionAllowlist(value);
|
|
13847
|
+
return issues.length > 0 ? `UI_SPEC_SCRIPT_ACTIONS: ${issues.join("; ")}` : null;
|
|
13848
|
+
}
|
|
13849
|
+
var UI_SPEC_SCRIPT_ACTIONS_KEY = "UI_SPEC_SCRIPT_ACTIONS", PIN_HASH;
|
|
13850
|
+
var init_script_allowlist = __esm(() => {
|
|
13851
|
+
PIN_HASH = /^[0-9a-f]{12,64}$/;
|
|
13852
|
+
});
|
|
13853
|
+
|
|
13357
13854
|
// src/utils/api-drain.ts
|
|
13358
13855
|
function isApiDrainingResponse(response) {
|
|
13359
13856
|
return response.headers.get(API_DRAINING_HEADER) === "1";
|
|
@@ -13436,6 +13933,15 @@ function internalConfigKeyError(key) {
|
|
|
13436
13933
|
const owner = lower === "runtime_owner_id" ? "the runtime supervisor" : lower === TELEMETRY_RANKING_KEY ? "/api/ranking" : "/api/onboarding";
|
|
13437
13934
|
return new Error(`Key '${key}' is managed by ${owner}`);
|
|
13438
13935
|
}
|
|
13936
|
+
function isHumanOnlyConfigKey(key) {
|
|
13937
|
+
return HUMAN_ONLY_CONFIG_KEYS.has(key.toUpperCase());
|
|
13938
|
+
}
|
|
13939
|
+
function humanOnlyConfigKeyError(key) {
|
|
13940
|
+
return `Key '${key}' can only be changed by an admin user (a user token or dashboard session). Agents and the shared API key cannot change it.`;
|
|
13941
|
+
}
|
|
13942
|
+
function humanOnlyConfigKeyPageError(key) {
|
|
13943
|
+
return `Key '${key}' cannot be changed from a page session. Change it from the dashboard or with a user token.`;
|
|
13944
|
+
}
|
|
13439
13945
|
function isReservedConfigKey(key) {
|
|
13440
13946
|
return RESERVED_KEYS.has(key.toUpperCase());
|
|
13441
13947
|
}
|
|
@@ -13465,10 +13971,10 @@ function enumValidator(key, options) {
|
|
|
13465
13971
|
};
|
|
13466
13972
|
}
|
|
13467
13973
|
function shortcodeValidators(keys) {
|
|
13468
|
-
const message = (key) => `Invalid ${key} (must be a Slack emoji shortcode: lowercase letters, digits, _ + ' -, with optional surrounding colons)`;
|
|
13974
|
+
const message = (key) => `Invalid ${key} (must be empty to disable, or a Slack emoji shortcode: lowercase letters, digits, _ + ' -, with optional surrounding colons)`;
|
|
13469
13975
|
return Object.fromEntries(keys.map((key) => [
|
|
13470
13976
|
key,
|
|
13471
|
-
(value) => normalizeSlackReactionShortcode(value) !== null ? null : message(key)
|
|
13977
|
+
(value) => typeof value === "string" && (value.trim() === "" || normalizeSlackReactionShortcode(value) !== null) ? null : message(key)
|
|
13472
13978
|
]));
|
|
13473
13979
|
}
|
|
13474
13980
|
function integerValidators(keys, min) {
|
|
@@ -13575,13 +14081,14 @@ function validateConfigEntry(entry) {
|
|
|
13575
14081
|
function validateExportToEnv(key, exportToEnv) {
|
|
13576
14082
|
return exportToEnv === true && isEnvExportRestrictedKey(key) ? envExportRestrictedError(key) : null;
|
|
13577
14083
|
}
|
|
13578
|
-
var TEAMS_SDK_ENV_KEYS, RESERVED_KEYS, API_ONLY_CONFIG_KEYS, INTERNAL_CONFIG_KEYS, BOOLEAN_LITERALS, MAX_DB_RETENTION_DAYS = 1e6, DB_RETENTION_TUNING_BOUNDS, APPS_JSON_COLUMN_MAX_BYTES_BOUNDS, CODEX_OAUTH_KEEP_WARM_MAX_AGE_HOURS_BOUNDS, SYSTEM_ONE_DEFAULT_PROVIDER_OPTIONS, SYSTEM_ONE_EXTRACT_DEFAULT_PROVIDER_OPTIONS, validateControllerTokenTtlDays, validateControllerGraceSec, VALIDATED_KEYS;
|
|
14084
|
+
var TEAMS_SDK_ENV_KEYS, RESERVED_KEYS, API_ONLY_CONFIG_KEYS, INTERNAL_CONFIG_KEYS, HUMAN_ONLY_CONFIG_KEYS, BOOLEAN_LITERALS, MAX_DB_RETENTION_DAYS = 1e6, DB_RETENTION_TUNING_BOUNDS, APPS_JSON_COLUMN_MAX_BYTES_BOUNDS, CODEX_OAUTH_KEEP_WARM_MAX_AGE_HOURS_BOUNDS, SYSTEM_ONE_DEFAULT_PROVIDER_OPTIONS, SYSTEM_ONE_EXTRACT_DEFAULT_PROVIDER_OPTIONS, validateControllerTokenTtlDays, validateControllerGraceSec, VALIDATED_KEYS;
|
|
13579
14085
|
var init_swarm_config_guard = __esm(() => {
|
|
13580
14086
|
init_schema();
|
|
13581
14087
|
init_telemetry_ranking();
|
|
13582
14088
|
init_quickjs_pool_config();
|
|
13583
14089
|
init_reaction_shortcode();
|
|
13584
14090
|
init_types5();
|
|
14091
|
+
init_script_allowlist();
|
|
13585
14092
|
init_api_drain2();
|
|
13586
14093
|
init_company_profile();
|
|
13587
14094
|
init_config_env_export();
|
|
@@ -13610,7 +14117,8 @@ var init_swarm_config_guard = __esm(() => {
|
|
|
13610
14117
|
"DESPLEGA_TELEMETRY_ENDPOINT",
|
|
13611
14118
|
"CLOUDFLARE_API_BASE_URL",
|
|
13612
14119
|
"GITHUB_URL",
|
|
13613
|
-
"GITHUB_API_URL"
|
|
14120
|
+
"GITHUB_API_URL",
|
|
14121
|
+
"GITHUB_APP_INSTALLATION_ID"
|
|
13614
14122
|
]);
|
|
13615
14123
|
API_ONLY_CONFIG_KEYS = new Set([
|
|
13616
14124
|
"API_AGENT_FS_API_KEY",
|
|
@@ -13622,6 +14130,7 @@ var init_swarm_config_guard = __esm(() => {
|
|
|
13622
14130
|
"runtime_owner_id",
|
|
13623
14131
|
TELEMETRY_RANKING_KEY
|
|
13624
14132
|
]);
|
|
14133
|
+
HUMAN_ONLY_CONFIG_KEYS = new Set([UI_SPEC_SCRIPT_ACTIONS_KEY]);
|
|
13625
14134
|
BOOLEAN_LITERALS = ["true", "false", "1", "0"];
|
|
13626
14135
|
DB_RETENTION_TUNING_BOUNDS = {
|
|
13627
14136
|
DB_RETENTION_TICK_BUDGET_MS: { min: 1000, max: 300000 },
|
|
@@ -13641,6 +14150,7 @@ var init_swarm_config_guard = __esm(() => {
|
|
|
13641
14150
|
validateControllerTokenTtlDays = boundedIntegerValidators(["RUNTIME_CONTROLLER_TOKEN_TTL_DAYS"], 1, 3650).RUNTIME_CONTROLLER_TOKEN_TTL_DAYS;
|
|
13642
14151
|
validateControllerGraceSec = boundedIntegerValidators(["RUNTIME_CONTROLLER_GRACE_SEC"], 0, 86400).RUNTIME_CONTROLLER_GRACE_SEC;
|
|
13643
14152
|
VALIDATED_KEYS = {
|
|
14153
|
+
[UI_SPEC_SCRIPT_ACTIONS_KEY]: validateScriptActionAllowlist,
|
|
13644
14154
|
...booleanValidators(["RUNTIME_POOLS_ENABLED", "DOCKER_HARDENED"]),
|
|
13645
14155
|
DOCKER_RUNTIME: validateDockerRuntime,
|
|
13646
14156
|
DOCKER_PIDS_LIMIT: validateDockerPidsLimit,
|
|
@@ -13804,6 +14314,7 @@ var init_swarm_config_guard = __esm(() => {
|
|
|
13804
14314
|
"SLACK_DISABLE",
|
|
13805
14315
|
"CHAT_SDK_ENABLED",
|
|
13806
14316
|
"SLACK_RENDER_V2",
|
|
14317
|
+
"SLACK_RENDER_V2_TASK_TREE_ENABLED",
|
|
13807
14318
|
"SLACK_RENDER_V2_DELEGATION",
|
|
13808
14319
|
"SLACK_BLOCK_EXTERNAL_CHANNELS",
|
|
13809
14320
|
"GITHUB_DISABLE",
|
|
@@ -13890,6 +14401,7 @@ var init_swarm_config_guard = __esm(() => {
|
|
|
13890
14401
|
"AGENT_LOG_RETENTION_DAYS",
|
|
13891
14402
|
"EVENTS_RETENTION_DAYS",
|
|
13892
14403
|
"SCRIPT_RUNS_RETENTION_DAYS",
|
|
14404
|
+
"WORKFLOW_RUNS_RETENTION_DAYS",
|
|
13893
14405
|
"CONTEXT_VERSIONS_KEEP_LATEST"
|
|
13894
14406
|
], 1, MAX_DB_RETENTION_DAYS),
|
|
13895
14407
|
...integerValidators(["HEARTBEAT_MAX_AUTO_ASSIGN"], 0),
|
|
@@ -14428,11 +14940,15 @@ var init_oauth = __esm(() => {
|
|
|
14428
14940
|
// src/utils/short-id.ts
|
|
14429
14941
|
import { randomBytes as randomBytes4 } from "node:crypto";
|
|
14430
14942
|
function generateShortId(len = 12) {
|
|
14943
|
+
return randomChars(LETTERS, len);
|
|
14944
|
+
}
|
|
14945
|
+
function randomChars(alphabet, len, source = randomBytes4) {
|
|
14946
|
+
const accept = 256 - 256 % alphabet.length;
|
|
14431
14947
|
let out = "";
|
|
14432
14948
|
while (out.length < len) {
|
|
14433
|
-
for (const byte of
|
|
14434
|
-
if (byte <
|
|
14435
|
-
out +=
|
|
14949
|
+
for (const byte of source((len - out.length) * 2)) {
|
|
14950
|
+
if (byte < accept) {
|
|
14951
|
+
out += alphabet[byte % alphabet.length];
|
|
14436
14952
|
if (out.length === len)
|
|
14437
14953
|
break;
|
|
14438
14954
|
}
|
|
@@ -14440,14 +14956,8 @@ function generateShortId(len = 12) {
|
|
|
14440
14956
|
}
|
|
14441
14957
|
return out;
|
|
14442
14958
|
}
|
|
14443
|
-
function base62(bytes) {
|
|
14444
|
-
let out = "";
|
|
14445
|
-
for (const byte of bytes)
|
|
14446
|
-
out += BASE62[byte % 62];
|
|
14447
|
-
return out;
|
|
14448
|
-
}
|
|
14449
14959
|
function generateBearerToken() {
|
|
14450
|
-
return `xsk_${
|
|
14960
|
+
return `xsk_${randomChars(BASE62, 24)}`;
|
|
14451
14961
|
}
|
|
14452
14962
|
var LETTERS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", BASE62 = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|
14453
14963
|
var init_short_id = () => {};
|
|
@@ -22538,7 +23048,7 @@ function noteEmbeddingSuccess() {
|
|
|
22538
23048
|
const report = (what) => (err) => {
|
|
22539
23049
|
console.error(`[memory] ${what} backfill after embeddings recovered failed:`, err.message);
|
|
22540
23050
|
};
|
|
22541
|
-
backfill2 = import("./embedding-space-
|
|
23051
|
+
backfill2 = import("./embedding-space-z6ptw3jk.js").then(({ runEmbeddingMaintenance }) => runEmbeddingMaintenance({ backfill: true })).catch(report("Embedding")).finally(() => {
|
|
22542
23052
|
backfill2 = null;
|
|
22543
23053
|
});
|
|
22544
23054
|
}
|
|
@@ -22840,19 +23350,28 @@ function pathWeight(key, tags = []) {
|
|
|
22840
23350
|
}
|
|
22841
23351
|
function readDemotionFloor() {
|
|
22842
23352
|
const raw = process.env.MEMORY_DEMOTION_FLOOR;
|
|
22843
|
-
const n = raw == null || raw === "" ?
|
|
22844
|
-
return Number.isFinite(n) ? n :
|
|
23353
|
+
const n = raw == null || raw === "" ? DEFAULT_DEMOTION_FLOOR : Number(raw);
|
|
23354
|
+
return Number.isFinite(n) ? n : DEFAULT_DEMOTION_FLOOR;
|
|
23355
|
+
}
|
|
23356
|
+
function hasDemotionEvidence(evidence) {
|
|
23357
|
+
if (!evidence)
|
|
23358
|
+
return false;
|
|
23359
|
+
if (evidence.selfBeta !== evidence.selfAlpha)
|
|
23360
|
+
return evidence.selfBeta > evidence.selfAlpha;
|
|
23361
|
+
const llmMean = (1 + evidence.llmAlpha) / (2 + evidence.llmAlpha + evidence.llmBeta);
|
|
23362
|
+
return evidence.llmCount >= DEMOTION_MIN_LLM_RATINGS && llmMean < DEMOTION_MAX_LLM_MEAN;
|
|
22845
23363
|
}
|
|
22846
|
-
function usefulness(alpha, beta) {
|
|
23364
|
+
function usefulness(alpha, beta, evidence) {
|
|
22847
23365
|
const denom = alpha + beta;
|
|
22848
23366
|
if (denom <= 0)
|
|
22849
23367
|
return 1;
|
|
22850
|
-
const
|
|
22851
|
-
|
|
23368
|
+
const score = Math.min(2, 2 * alpha / denom);
|
|
23369
|
+
const demote = score < 1 && hasDemotionEvidence(evidence);
|
|
23370
|
+
return Math.max(readDemotionFloor(), demote ? score : Math.max(1, score));
|
|
22852
23371
|
}
|
|
22853
23372
|
function computeScore(candidate, now) {
|
|
22854
23373
|
const decay = candidate.recencyDecayApplied ? 1 : recencyDecay(candidate.createdAt, now, candidate.source, candidate.key);
|
|
22855
|
-
return candidate.similarity * decay * accessBoost(candidate.accessedAt, candidate.accessCount, now) * sourceQuality(candidate.source, candidate.key) * pathWeight(candidate.key, candidate.tags) * usefulness(candidate.alpha, candidate.beta);
|
|
23374
|
+
return candidate.similarity * decay * accessBoost(candidate.accessedAt, candidate.accessCount, now) * sourceQuality(candidate.source, candidate.key) * pathWeight(candidate.key, candidate.tags) * usefulness(candidate.alpha, candidate.beta, candidate.demotionEvidence);
|
|
22856
23375
|
}
|
|
22857
23376
|
function rerank(candidates, options) {
|
|
22858
23377
|
const { limit, now = new Date } = options;
|
|
@@ -22905,7 +23424,7 @@ function collapseTaskCompletionChunks(ranked) {
|
|
|
22905
23424
|
return true;
|
|
22906
23425
|
});
|
|
22907
23426
|
}
|
|
22908
|
-
var MS_PER_DAY, MS_PER_HOUR;
|
|
23427
|
+
var MS_PER_DAY, MS_PER_HOUR, DEFAULT_DEMOTION_FLOOR = 0.5, DEMOTION_MIN_LLM_RATINGS = 10, DEMOTION_MAX_LLM_MEAN = 0.25;
|
|
22909
23428
|
var init_reranker = __esm(() => {
|
|
22910
23429
|
init_constants2();
|
|
22911
23430
|
init_key_paths();
|
|
@@ -22913,6 +23432,64 @@ var init_reranker = __esm(() => {
|
|
|
22913
23432
|
MS_PER_HOUR = 1000 * 60 * 60;
|
|
22914
23433
|
});
|
|
22915
23434
|
|
|
23435
|
+
// src/be/memory/review-recall-filter.ts
|
|
23436
|
+
function isReviewTask(task) {
|
|
23437
|
+
return task.taskType === REVIEW_TASK_TYPE || (task.tags ?? []).some((t) => REVIEW_TASK_TAGS.includes(t));
|
|
23438
|
+
}
|
|
23439
|
+
function parseTags(raw) {
|
|
23440
|
+
try {
|
|
23441
|
+
const tags = JSON.parse(raw ?? "[]");
|
|
23442
|
+
return Array.isArray(tags) ? tags.filter((t) => typeof t === "string") : [];
|
|
23443
|
+
} catch {
|
|
23444
|
+
return [];
|
|
23445
|
+
}
|
|
23446
|
+
}
|
|
23447
|
+
function notReviewTaskCompletionSql(memoryAlias = "") {
|
|
23448
|
+
const col = (name) => memoryAlias ? `${memoryAlias}.${name}` : name;
|
|
23449
|
+
return {
|
|
23450
|
+
sql: `NOT (${col("source")} = 'task_completion' AND EXISTS (
|
|
23451
|
+
SELECT 1 FROM agent_tasks rt
|
|
23452
|
+
WHERE rt.id = ${col("sourceTaskId")}
|
|
23453
|
+
AND (rt.taskType = ?
|
|
23454
|
+
OR CASE WHEN json_valid(rt.tags)
|
|
23455
|
+
THEN json_type(rt.tags) = 'array' AND EXISTS (
|
|
23456
|
+
SELECT 1 FROM json_each(rt.tags)
|
|
23457
|
+
WHERE value IN (${REVIEW_TASK_TAGS.map(() => "?").join(",")}))
|
|
23458
|
+
ELSE 0 END)))`,
|
|
23459
|
+
params: [REVIEW_TASK_TYPE, ...REVIEW_TASK_TAGS]
|
|
23460
|
+
};
|
|
23461
|
+
}
|
|
23462
|
+
async function isReviewTaskId(taskId) {
|
|
23463
|
+
if (!taskId)
|
|
23464
|
+
return false;
|
|
23465
|
+
const task = await getTaskById2(taskId);
|
|
23466
|
+
return task ? isReviewTask(task) : false;
|
|
23467
|
+
}
|
|
23468
|
+
async function dropReviewTaskCompletions(candidates) {
|
|
23469
|
+
const sourceIds = [
|
|
23470
|
+
...new Set(candidates.filter((c) => c.source === "task_completion" && c.sourceTaskId).map((c) => c.sourceTaskId))
|
|
23471
|
+
];
|
|
23472
|
+
if (sourceIds.length === 0)
|
|
23473
|
+
return candidates;
|
|
23474
|
+
const reviewIds = new Set;
|
|
23475
|
+
for (let i = 0;i < sourceIds.length; i += ID_CHUNK) {
|
|
23476
|
+
const chunk = sourceIds.slice(i, i + ID_CHUNK);
|
|
23477
|
+
const rows = await getDbClient2().query(`SELECT id, taskType, tags FROM agent_tasks WHERE id IN (${chunk.map(() => "?").join(",")})`, chunk);
|
|
23478
|
+
for (const row of rows) {
|
|
23479
|
+
if (isReviewTask({ taskType: row.taskType, tags: parseTags(row.tags) }))
|
|
23480
|
+
reviewIds.add(row.id);
|
|
23481
|
+
}
|
|
23482
|
+
}
|
|
23483
|
+
if (reviewIds.size === 0)
|
|
23484
|
+
return candidates;
|
|
23485
|
+
return candidates.filter((c) => !(c.source === "task_completion" && c.sourceTaskId && reviewIds.has(c.sourceTaskId)));
|
|
23486
|
+
}
|
|
23487
|
+
var REVIEW_TASK_TYPE = "review", REVIEW_TASK_TAGS, ID_CHUNK = 500;
|
|
23488
|
+
var init_review_recall_filter = __esm(() => {
|
|
23489
|
+
init_db4();
|
|
23490
|
+
REVIEW_TASK_TAGS = ["re-review", "pr-review-demo"];
|
|
23491
|
+
});
|
|
23492
|
+
|
|
22916
23493
|
// src/be/memory/search-candidates.ts
|
|
22917
23494
|
function countCandidateDocuments(candidates) {
|
|
22918
23495
|
const documents = new Set;
|
|
@@ -22927,17 +23504,21 @@ function countCandidateDocuments(candidates) {
|
|
|
22927
23504
|
return standalone + documents.size;
|
|
22928
23505
|
}
|
|
22929
23506
|
async function searchMemoryCandidates(store, embedding, agentId, options) {
|
|
23507
|
+
const keep = (rows) => options.excludeReviewTaskCompletions ? dropReviewTaskCompletions(rows) : Promise.resolve(rows);
|
|
22930
23508
|
let fetchLimit = options.limit;
|
|
22931
|
-
let
|
|
23509
|
+
let raw = await store.search(embedding, agentId, { ...options, limit: fetchLimit });
|
|
23510
|
+
let rows = await keep(raw);
|
|
22932
23511
|
while (fetchLimit < MAX_CANDIDATE_FETCH) {
|
|
22933
23512
|
const documents = countCandidateDocuments(rows);
|
|
22934
|
-
if (documents >= options.limit || documents === rows.length)
|
|
23513
|
+
if (documents >= options.limit || documents === rows.length && rows.length === raw.length) {
|
|
22935
23514
|
break;
|
|
23515
|
+
}
|
|
22936
23516
|
const nextLimit = Math.min(fetchLimit * WIDEN_FACTOR, MAX_CANDIDATE_FETCH);
|
|
22937
23517
|
const wider = await store.search(embedding, agentId, { ...options, limit: nextLimit });
|
|
22938
|
-
if (wider.length <=
|
|
23518
|
+
if (wider.length <= raw.length)
|
|
22939
23519
|
break;
|
|
22940
|
-
|
|
23520
|
+
raw = wider;
|
|
23521
|
+
rows = await keep(raw);
|
|
22941
23522
|
fetchLimit = nextLimit;
|
|
22942
23523
|
}
|
|
22943
23524
|
return rows;
|
|
@@ -22945,6 +23526,7 @@ async function searchMemoryCandidates(store, embedding, agentId, options) {
|
|
|
22945
23526
|
var MAX_CANDIDATE_FETCH = 4096, WIDEN_FACTOR = 4;
|
|
22946
23527
|
var init_search_candidates = __esm(() => {
|
|
22947
23528
|
init_reranker();
|
|
23529
|
+
init_review_recall_filter();
|
|
22948
23530
|
});
|
|
22949
23531
|
|
|
22950
23532
|
// src/be/memory/providers/sqlite-store.ts
|
|
@@ -23037,6 +23619,7 @@ class SqliteMemoryStore {
|
|
|
23037
23619
|
ftsInitialized = false;
|
|
23038
23620
|
ftsPopulate = null;
|
|
23039
23621
|
lastPopulate = null;
|
|
23622
|
+
searchHealthCache = null;
|
|
23040
23623
|
constructor() {
|
|
23041
23624
|
this.ensureVecTable();
|
|
23042
23625
|
this.ensureFtsTable();
|
|
@@ -23124,16 +23707,19 @@ class SqliteMemoryStore {
|
|
|
23124
23707
|
whenFtsPopulated() {
|
|
23125
23708
|
return this.ftsPopulate ?? Promise.resolve();
|
|
23126
23709
|
}
|
|
23127
|
-
async syncFtsRow(memoryId, name, content) {
|
|
23710
|
+
async syncFtsRow(memoryId, name, content, freshId = false) {
|
|
23128
23711
|
if (!this.ftsInitialized && !await this.getFtsTableSchema())
|
|
23129
23712
|
return;
|
|
23130
23713
|
try {
|
|
23131
|
-
await getDbClient2().
|
|
23132
|
-
|
|
23133
|
-
|
|
23134
|
-
name,
|
|
23135
|
-
|
|
23136
|
-
|
|
23714
|
+
await getDbClient2().transaction(async (tx) => {
|
|
23715
|
+
if (!freshId)
|
|
23716
|
+
await tx.run("DELETE FROM memory_fts WHERE memory_id = ?", [memoryId]);
|
|
23717
|
+
await tx.run("INSERT INTO memory_fts(memory_id, name, content) VALUES (?, ?, ?)", [
|
|
23718
|
+
memoryId,
|
|
23719
|
+
name,
|
|
23720
|
+
content
|
|
23721
|
+
]);
|
|
23722
|
+
});
|
|
23137
23723
|
} catch (err) {
|
|
23138
23724
|
console.error(`[memory-fts] sync failed memory_id=${memoryId}: ${err.message}`);
|
|
23139
23725
|
}
|
|
@@ -23220,6 +23806,7 @@ class SqliteMemoryStore {
|
|
|
23220
23806
|
}
|
|
23221
23807
|
}
|
|
23222
23808
|
const afterCount = this.getVecCount();
|
|
23809
|
+
this.searchHealthCache = null;
|
|
23223
23810
|
this.lastPopulate = {
|
|
23224
23811
|
attempted,
|
|
23225
23812
|
inserted,
|
|
@@ -23295,9 +23882,9 @@ class SqliteMemoryStore {
|
|
|
23295
23882
|
input.agentId ?? null,
|
|
23296
23883
|
input.agentId ?? null
|
|
23297
23884
|
]);
|
|
23885
|
+
await this.syncFtsRow(inserted.id, inserted.name, inserted.content, true);
|
|
23298
23886
|
return inserted;
|
|
23299
23887
|
});
|
|
23300
|
-
await this.syncFtsRow(row.id, row.name, row.content);
|
|
23301
23888
|
return rowToAgentMemory(row);
|
|
23302
23889
|
}
|
|
23303
23890
|
async storeBatch(inputs) {
|
|
@@ -23352,7 +23939,8 @@ class SqliteMemoryStore {
|
|
|
23352
23939
|
source,
|
|
23353
23940
|
isLead = false,
|
|
23354
23941
|
includeExpired = false,
|
|
23355
|
-
keyPrefix
|
|
23942
|
+
keyPrefix,
|
|
23943
|
+
excludeReviewTaskCompletions
|
|
23356
23944
|
} = options;
|
|
23357
23945
|
if (options.exhaustive) {
|
|
23358
23946
|
return this.searchExhaustive(embedding, agentId, {
|
|
@@ -23362,10 +23950,11 @@ class SqliteMemoryStore {
|
|
|
23362
23950
|
isLead,
|
|
23363
23951
|
includeExpired,
|
|
23364
23952
|
keyPrefix,
|
|
23953
|
+
excludeReviewTaskCompletions,
|
|
23365
23954
|
minSimilarity: options.minSimilarity
|
|
23366
23955
|
});
|
|
23367
23956
|
}
|
|
23368
|
-
const health = this.
|
|
23957
|
+
const health = this.searchHealth();
|
|
23369
23958
|
if (isHybridSearchEnabled() && options.queryText && this.ftsInitialized && await this.getFtsTableSchema() && health.retrievalMode === "vec" && embedding.length === EMBEDDING_DIMENSIONS) {
|
|
23370
23959
|
console.log(`[memory-search] retrieval_path=hybrid scope=${scope} limit=${limit} vec_rows=${health.counts.memoryVec} searchable=${health.counts.searchable}`);
|
|
23371
23960
|
return this.searchHybrid(embedding, options.queryText, agentId, {
|
|
@@ -23374,7 +23963,8 @@ class SqliteMemoryStore {
|
|
|
23374
23963
|
source,
|
|
23375
23964
|
isLead,
|
|
23376
23965
|
includeExpired,
|
|
23377
|
-
keyPrefix
|
|
23966
|
+
keyPrefix,
|
|
23967
|
+
excludeReviewTaskCompletions
|
|
23378
23968
|
});
|
|
23379
23969
|
}
|
|
23380
23970
|
if (health.retrievalMode === "vec" && embedding.length === EMBEDDING_DIMENSIONS) {
|
|
@@ -23386,6 +23976,7 @@ class SqliteMemoryStore {
|
|
|
23386
23976
|
isLead,
|
|
23387
23977
|
includeExpired,
|
|
23388
23978
|
keyPrefix,
|
|
23979
|
+
excludeReviewTaskCompletions,
|
|
23389
23980
|
minSimilarity: options.minSimilarity
|
|
23390
23981
|
});
|
|
23391
23982
|
}
|
|
@@ -23397,7 +23988,8 @@ class SqliteMemoryStore {
|
|
|
23397
23988
|
source,
|
|
23398
23989
|
isLead,
|
|
23399
23990
|
includeExpired,
|
|
23400
|
-
keyPrefix
|
|
23991
|
+
keyPrefix,
|
|
23992
|
+
excludeReviewTaskCompletions
|
|
23401
23993
|
});
|
|
23402
23994
|
}
|
|
23403
23995
|
console.log(`[memory-search] retrieval_path=fallback scope=${scope} limit=${limit} reason=${embedding.length !== EMBEDDING_DIMENSIONS ? "query_dimension_mismatch" : health.reasons.join("|") || "vec_unavailable"}`);
|
|
@@ -23408,6 +24000,7 @@ class SqliteMemoryStore {
|
|
|
23408
24000
|
isLead,
|
|
23409
24001
|
includeExpired,
|
|
23410
24002
|
keyPrefix,
|
|
24003
|
+
excludeReviewTaskCompletions,
|
|
23411
24004
|
minSimilarity: options.minSimilarity
|
|
23412
24005
|
});
|
|
23413
24006
|
}
|
|
@@ -23472,6 +24065,7 @@ class SqliteMemoryStore {
|
|
|
23472
24065
|
const params = [match];
|
|
23473
24066
|
this.addScopeConditions(conditions, params, agentId, scope, isLead, "m");
|
|
23474
24067
|
this.addKeyPrefixCondition(conditions, params, keyPrefix, "m");
|
|
24068
|
+
this.addReviewExclusion(conditions, params, options.excludeReviewTaskCompletions, "m");
|
|
23475
24069
|
if (source) {
|
|
23476
24070
|
conditions.push("m.source = ?");
|
|
23477
24071
|
params.push(source);
|
|
@@ -23512,11 +24106,12 @@ class SqliteMemoryStore {
|
|
|
23512
24106
|
const { scope, limit, source, isLead, includeExpired, keyPrefix } = options;
|
|
23513
24107
|
const floor = options.minSimilarity ?? minSimilarity();
|
|
23514
24108
|
const embeddingBuffer = serializeEmbedding(queryEmbedding);
|
|
23515
|
-
const knnLimit =
|
|
24109
|
+
const knnLimit = 4096;
|
|
23516
24110
|
const conditions = ["v.embedding MATCH ?"];
|
|
23517
24111
|
const params = [embeddingBuffer];
|
|
23518
24112
|
this.addScopeConditions(conditions, params, agentId, scope, isLead, "m");
|
|
23519
24113
|
this.addKeyPrefixCondition(conditions, params, keyPrefix, "m");
|
|
24114
|
+
this.addReviewExclusion(conditions, params, options.excludeReviewTaskCompletions, "m");
|
|
23520
24115
|
if (source) {
|
|
23521
24116
|
conditions.push("m.source = ?");
|
|
23522
24117
|
params.push(source);
|
|
@@ -23548,6 +24143,7 @@ class SqliteMemoryStore {
|
|
|
23548
24143
|
const params = [];
|
|
23549
24144
|
this.addScopeConditions(conditions, params, agentId, scope, isLead);
|
|
23550
24145
|
this.addKeyPrefixCondition(conditions, params, keyPrefix);
|
|
24146
|
+
this.addReviewExclusion(conditions, params, options.excludeReviewTaskCompletions);
|
|
23551
24147
|
if (source) {
|
|
23552
24148
|
conditions.push("source = ?");
|
|
23553
24149
|
params.push(source);
|
|
@@ -23610,6 +24206,7 @@ class SqliteMemoryStore {
|
|
|
23610
24206
|
const params = [];
|
|
23611
24207
|
this.addScopeConditions(conditions, params, agentId, scope, isLead);
|
|
23612
24208
|
this.addKeyPrefixCondition(conditions, params, keyPrefix);
|
|
24209
|
+
this.addReviewExclusion(conditions, params, options.excludeReviewTaskCompletions);
|
|
23613
24210
|
if (source) {
|
|
23614
24211
|
conditions.push("source = ?");
|
|
23615
24212
|
params.push(source);
|
|
@@ -23661,6 +24258,13 @@ class SqliteMemoryStore {
|
|
|
23661
24258
|
conditions.push(`substr(${key}, 1, length(?)) = ?`);
|
|
23662
24259
|
params.push(keyPrefix, keyPrefix);
|
|
23663
24260
|
}
|
|
24261
|
+
addReviewExclusion(conditions, params, exclude, tableAlias = "") {
|
|
24262
|
+
if (!exclude)
|
|
24263
|
+
return;
|
|
24264
|
+
const filter = notReviewTaskCompletionSql(tableAlias);
|
|
24265
|
+
conditions.push(filter.sql);
|
|
24266
|
+
params.push(...filter.params);
|
|
24267
|
+
}
|
|
23664
24268
|
buildListWhereClause(agentId, options) {
|
|
23665
24269
|
const { scope = "all", isLead = false, ownerAgentId, source, sourcePath, keyPrefix } = options;
|
|
23666
24270
|
const conditions = [];
|
|
@@ -23843,6 +24447,7 @@ class SqliteMemoryStore {
|
|
|
23843
24447
|
if (this.vecInitialized && this.getVecTableSchema()) {
|
|
23844
24448
|
const placeholders = ids.map(() => "?").join(",");
|
|
23845
24449
|
await getDbClient2().run(`DELETE FROM memory_vec WHERE memory_id IN (${placeholders})`, ids);
|
|
24450
|
+
this.noteVecWrite();
|
|
23846
24451
|
}
|
|
23847
24452
|
await this.deleteFtsRows(ids);
|
|
23848
24453
|
}
|
|
@@ -23913,8 +24518,10 @@ class SqliteMemoryStore {
|
|
|
23913
24518
|
id,
|
|
23914
24519
|
vecBuffer
|
|
23915
24520
|
]);
|
|
24521
|
+
this.noteVecWrite();
|
|
23916
24522
|
} catch (err) {
|
|
23917
24523
|
console.error(`[memory-vec] update failed memory_id=${id}: ${err.message}`);
|
|
24524
|
+
this.searchHealthCache = null;
|
|
23918
24525
|
}
|
|
23919
24526
|
}
|
|
23920
24527
|
});
|
|
@@ -23926,6 +24533,7 @@ class SqliteMemoryStore {
|
|
|
23926
24533
|
]);
|
|
23927
24534
|
if (this.vecInitialized && this.getVecTableSchema()) {
|
|
23928
24535
|
await tx.run("DELETE FROM memory_vec WHERE memory_id = ?", [id]);
|
|
24536
|
+
this.noteVecWrite();
|
|
23929
24537
|
}
|
|
23930
24538
|
});
|
|
23931
24539
|
}
|
|
@@ -23952,6 +24560,7 @@ class SqliteMemoryStore {
|
|
|
23952
24560
|
return false;
|
|
23953
24561
|
if (contentChanged && this.vecInitialized && this.getVecTableSchema()) {
|
|
23954
24562
|
await tx.run("DELETE FROM memory_vec WHERE memory_id = ?", [id]);
|
|
24563
|
+
this.noteVecWrite();
|
|
23955
24564
|
}
|
|
23956
24565
|
if (after.name !== before.name || contentChanged) {
|
|
23957
24566
|
await this.syncFtsRow(id, after.name, after.content);
|
|
@@ -23985,28 +24594,42 @@ class SqliteMemoryStore {
|
|
|
23985
24594
|
const tableExists = this.getVecTableSchema() !== null;
|
|
23986
24595
|
const tableUsable = tableExists && isSqliteVecAvailable2();
|
|
23987
24596
|
const count = (sql) => db.prepare(sql).get()?.count ?? 0;
|
|
24597
|
+
const validEmbedding = count(`SELECT COUNT(*) as count FROM agent_memory WHERE embedding IS NOT NULL AND length(embedding) = ${VECTOR_BYTES}`);
|
|
23988
24598
|
return {
|
|
23989
24599
|
total: count("SELECT COUNT(*) as count FROM agent_memory"),
|
|
23990
24600
|
withEmbedding: count("SELECT COUNT(*) as count FROM agent_memory WHERE embedding IS NOT NULL"),
|
|
23991
|
-
validEmbedding
|
|
24601
|
+
validEmbedding,
|
|
23992
24602
|
invalidEmbedding: count(`SELECT COUNT(*) as count FROM agent_memory WHERE embedding IS NOT NULL AND length(embedding) != ${VECTOR_BYTES}`),
|
|
23993
24603
|
searchable: count(`SELECT COUNT(*) as count FROM agent_memory
|
|
23994
24604
|
WHERE embedding IS NOT NULL
|
|
23995
24605
|
AND length(embedding) = ${VECTOR_BYTES}
|
|
23996
24606
|
AND (expiresAt IS NULL OR expiresAt > datetime('now'))`),
|
|
23997
24607
|
memoryVec: tableUsable ? count("SELECT COUNT(*) as count FROM memory_vec") : 0,
|
|
23998
|
-
missingFromVec: tableUsable ? count(`SELECT COUNT(*) as count
|
|
23999
|
-
FROM
|
|
24000
|
-
|
|
24608
|
+
missingFromVec: tableUsable ? validEmbedding - count(`SELECT COUNT(*) as count
|
|
24609
|
+
FROM memory_vec v
|
|
24610
|
+
CROSS JOIN agent_memory m ON m.id = v.memory_id
|
|
24001
24611
|
WHERE m.embedding IS NOT NULL
|
|
24002
|
-
AND length(m.embedding) = ${VECTOR_BYTES}
|
|
24003
|
-
AND v.memory_id IS NULL`) : count(`SELECT COUNT(*) as count FROM agent_memory WHERE embedding IS NOT NULL AND length(embedding) = ${VECTOR_BYTES}`),
|
|
24612
|
+
AND length(m.embedding) = ${VECTOR_BYTES}`) : validEmbedding,
|
|
24004
24613
|
extraInVec: tableUsable ? count(`SELECT COUNT(*) as count
|
|
24005
24614
|
FROM memory_vec v
|
|
24006
24615
|
LEFT JOIN agent_memory m ON m.id = v.memory_id
|
|
24007
24616
|
WHERE m.id IS NULL`) : 0
|
|
24008
24617
|
};
|
|
24009
24618
|
}
|
|
24619
|
+
searchHealth() {
|
|
24620
|
+
const db = getDb2();
|
|
24621
|
+
const cached = this.searchHealthCache;
|
|
24622
|
+
if (cached && cached.db === db && Date.now() - cached.at < SEARCH_HEALTH_TTL_MS) {
|
|
24623
|
+
return cached.health;
|
|
24624
|
+
}
|
|
24625
|
+
const health = this.getHealth();
|
|
24626
|
+
this.searchHealthCache = { health, db, at: Date.now() };
|
|
24627
|
+
return health;
|
|
24628
|
+
}
|
|
24629
|
+
noteVecWrite() {
|
|
24630
|
+
if (this.searchHealthCache?.health.retrievalMode !== "vec")
|
|
24631
|
+
this.searchHealthCache = null;
|
|
24632
|
+
}
|
|
24010
24633
|
getHealth() {
|
|
24011
24634
|
const schema = this.getVecTableSchema();
|
|
24012
24635
|
const counts = this.getHealthCounts();
|
|
@@ -24043,7 +24666,7 @@ var VECTOR_BYTES, FTS_SCAN_BATCH_SQL = `SELECT rowid AS rowid, memory_id AS memo
|
|
|
24043
24666
|
memory_id IS NOT NULL
|
|
24044
24667
|
AND NOT EXISTS (SELECT 1 FROM agent_memory m WHERE m.id = memory_fts.memory_id) AS orphan
|
|
24045
24668
|
FROM memory_fts WHERE rowid > ? ORDER BY rowid LIMIT ?`, MEMORY_ID_BATCH_SQL = `SELECT rowid AS rowid, id FROM agent_memory
|
|
24046
|
-
WHERE rowid > ? ORDER BY rowid LIMIT ?`, FTS_SCAN_BATCH_SIZE = 1000, FTS_POPULATE_BATCH_SIZE = 500;
|
|
24669
|
+
WHERE rowid > ? ORDER BY rowid LIMIT ?`, SEARCH_HEALTH_TTL_MS = 60000, FTS_SCAN_BATCH_SIZE = 1000, FTS_POPULATE_BATCH_SIZE = 500;
|
|
24047
24670
|
var init_sqlite_store = __esm(() => {
|
|
24048
24671
|
init_db4();
|
|
24049
24672
|
init_embedding();
|
|
@@ -24053,6 +24676,7 @@ var init_sqlite_store = __esm(() => {
|
|
|
24053
24676
|
init_constants2();
|
|
24054
24677
|
init_key_paths();
|
|
24055
24678
|
init_reranker();
|
|
24679
|
+
init_review_recall_filter();
|
|
24056
24680
|
init_search_candidates();
|
|
24057
24681
|
VECTOR_BYTES = EMBEDDING_DIMENSIONS * Float32Array.BYTES_PER_ELEMENT;
|
|
24058
24682
|
});
|
|
@@ -24459,6 +25083,13 @@ async function getScript(args) {
|
|
|
24459
25083
|
const row = scopeId === null ? await getDbClient2().get("SELECT * FROM scripts WHERE name = ? AND scope = ? AND scopeId IS NULL", [args.name, args.scope]) : await getDbClient2().get("SELECT * FROM scripts WHERE name = ? AND scope = ? AND scopeId = ?", [args.name, args.scope, scopeId]);
|
|
24460
25084
|
return row ? rowToScript2(row) : null;
|
|
24461
25085
|
}
|
|
25086
|
+
async function getGlobalScriptContentHashes(names) {
|
|
25087
|
+
if (names.length === 0)
|
|
25088
|
+
return new Map;
|
|
25089
|
+
const rows = await getDbClient2().query(`SELECT name, contentHash FROM scripts
|
|
25090
|
+
WHERE scope = 'global' AND scopeId IS NULL AND name IN (${names.map(() => "?").join(", ")})`, names);
|
|
25091
|
+
return new Map(rows.map((row) => [row.name, row.contentHash]));
|
|
25092
|
+
}
|
|
24462
25093
|
async function getScriptById(id) {
|
|
24463
25094
|
const row = await getDbClient2().get("SELECT * FROM scripts WHERE id = ?", [id]);
|
|
24464
25095
|
return row ? rowToScript2(row) : null;
|
|
@@ -24731,7 +25362,7 @@ async function loadSecretRegistry() {
|
|
|
24731
25362
|
result.failed += 1;
|
|
24732
25363
|
}
|
|
24733
25364
|
try {
|
|
24734
|
-
const { loadRuntimeControllerSecrets } = await import("./db-
|
|
25365
|
+
const { loadRuntimeControllerSecrets } = await import("./db-p5drc1d1.js");
|
|
24735
25366
|
const loaded = await loadRuntimeControllerSecrets();
|
|
24736
25367
|
result.runtimeController = loaded.count;
|
|
24737
25368
|
result.failed += loaded.failed;
|
|
@@ -24892,7 +25523,7 @@ async function requestSteering(args) {
|
|
|
24892
25523
|
}
|
|
24893
25524
|
const requestedMode = args.mode ?? "queue";
|
|
24894
25525
|
const onUnsupported = args.onUnsupported ?? "degrade";
|
|
24895
|
-
const { dispatchPre, extensionIdForAgent } = await import("./dispatcher-
|
|
25526
|
+
const { dispatchPre, extensionIdForAgent } = await import("./dispatcher-x6w14pde.js");
|
|
24896
25527
|
const preSteer = await dispatchPre("pre.task.steer", {
|
|
24897
25528
|
task,
|
|
24898
25529
|
message: args.message,
|
|
@@ -27127,7 +27758,7 @@ async function createTaskExtended2(task, options) {
|
|
|
27127
27758
|
priority: row.priority
|
|
27128
27759
|
}, (task) => task !== null, row.requestedByUserId);
|
|
27129
27760
|
getDbClient2().afterCommit(() => {
|
|
27130
|
-
import("./event-bus-
|
|
27761
|
+
import("./event-bus-swr88jg5.js").then(({ workflowEventBus }) => {
|
|
27131
27762
|
workflowEventBus.emit("task.created", {
|
|
27132
27763
|
taskId: row.id,
|
|
27133
27764
|
task: row.task,
|
|
@@ -27209,7 +27840,7 @@ async function releaseTask2(taskId, wakeSnapshot) {
|
|
|
27209
27840
|
} catch {}
|
|
27210
27841
|
if (isRuntimePoolsEnabled() && !wakeSnapshot)
|
|
27211
27842
|
getDbClient2().afterCommit(() => {
|
|
27212
|
-
import("./event-bus-
|
|
27843
|
+
import("./event-bus-swr88jg5.js").then(({ workflowEventBus }) => workflowEventBus.emit("task.unassigned", { taskId })).catch((error) => console.error("[db] Routing event failed:", scrubSecrets(String(error))));
|
|
27213
27844
|
});
|
|
27214
27845
|
}
|
|
27215
27846
|
return row ? rowToAgentTask(row) : null;
|
|
@@ -27279,7 +27910,7 @@ async function rejectTask2(taskId, agentId, reason) {
|
|
|
27279
27910
|
} catch {}
|
|
27280
27911
|
if (isRuntimePoolsEnabled())
|
|
27281
27912
|
getDbClient2().afterCommit(() => {
|
|
27282
|
-
import("./event-bus-
|
|
27913
|
+
import("./event-bus-swr88jg5.js").then(({ workflowEventBus }) => workflowEventBus.emit("task.unassigned", { taskId })).catch((error) => console.error("[db] Routing event failed:", scrubSecrets(String(error))));
|
|
27283
27914
|
});
|
|
27284
27915
|
}
|
|
27285
27916
|
return row ? rowToAgentTask(row) : null;
|
|
@@ -28928,7 +29559,7 @@ async function deleteScheduledTask2(id) {
|
|
|
28928
29559
|
const parent = await getTaskById2(deferred.parentTaskId);
|
|
28929
29560
|
if (!parent?.deferredAt)
|
|
28930
29561
|
return;
|
|
28931
|
-
const { createWorkerTaskFollowUp } = await import("./worker-follow-up-
|
|
29562
|
+
const { createWorkerTaskFollowUp } = await import("./worker-follow-up-1gs4aw7y.js");
|
|
28932
29563
|
await createWorkerTaskFollowUp({
|
|
28933
29564
|
task: parent,
|
|
28934
29565
|
status: "failed",
|
|
@@ -32116,6 +32747,7 @@ function rowToUser(row) {
|
|
|
32116
32747
|
metadata: row.metadata ? JSON.parse(row.metadata) : undefined,
|
|
32117
32748
|
dailyBudgetUsd: row.dailyBudgetUsd ?? null,
|
|
32118
32749
|
status: row.status ?? "active",
|
|
32750
|
+
...row.mergedIntoUserId ? { mergedIntoUserId: row.mergedIntoUserId } : {},
|
|
32119
32751
|
createdAt: row.createdAt,
|
|
32120
32752
|
lastUpdatedAt: row.lastUpdatedAt
|
|
32121
32753
|
};
|
|
@@ -32209,9 +32841,6 @@ async function updateUser2(id, data) {
|
|
|
32209
32841
|
}
|
|
32210
32842
|
return row ? rowToUser(row) : null;
|
|
32211
32843
|
}
|
|
32212
|
-
function quoteSqlIdentifier(identifier) {
|
|
32213
|
-
return `"${identifier.replaceAll('"', '""')}"`;
|
|
32214
|
-
}
|
|
32215
32844
|
async function deleteUser2(id, replacementUserId) {
|
|
32216
32845
|
if (replacementUserId === id) {
|
|
32217
32846
|
throw new Error("Replacement user must differ from deleted user");
|
|
@@ -32225,40 +32854,13 @@ async function deleteUser2(id, replacementUserId) {
|
|
|
32225
32854
|
if (!replacementExists)
|
|
32226
32855
|
throw new Error("Replacement user not found");
|
|
32227
32856
|
}
|
|
32228
|
-
const references = await tx.query(
|
|
32229
|
-
FROM sqlite_schema AS tables
|
|
32230
|
-
JOIN pragma_foreign_key_list(tables.name) AS foreign_keys
|
|
32231
|
-
JOIN pragma_table_info(tables.name) AS columns
|
|
32232
|
-
ON columns.name = foreign_keys."from"
|
|
32233
|
-
WHERE tables.type = 'table'
|
|
32234
|
-
AND foreign_keys."table" = 'users'
|
|
32235
|
-
AND foreign_keys.on_delete IN ('NO ACTION', 'RESTRICT')
|
|
32236
|
-
AND columns."notnull" = 0
|
|
32237
|
-
UNION ALL
|
|
32238
|
-
SELECT 'scheduled_tasks' AS tableName, columns.name AS columnName
|
|
32239
|
-
FROM pragma_table_info('scheduled_tasks') AS columns
|
|
32240
|
-
WHERE columns.name IN ('created_by', 'updated_by')
|
|
32241
|
-
AND columns."notnull" = 0
|
|
32242
|
-
AND NOT EXISTS (
|
|
32243
|
-
SELECT 1
|
|
32244
|
-
FROM pragma_foreign_key_list('scheduled_tasks') AS foreign_keys
|
|
32245
|
-
WHERE foreign_keys."from" = columns.name
|
|
32246
|
-
AND foreign_keys."table" = 'users'
|
|
32247
|
-
)`);
|
|
32857
|
+
const references = await tx.query(USER_REFERENCE_COLUMNS_SQL);
|
|
32248
32858
|
const replacement = replacementUserId ?? null;
|
|
32249
32859
|
const reclassifySeedIds = replacementUserId ? [] : (await tx.query(`SELECT id FROM agent_tasks WHERE requestedByUserId = ?
|
|
32250
32860
|
UNION
|
|
32251
32861
|
SELECT id FROM agent_tasks
|
|
32252
32862
|
WHERE workflowRunId IN (SELECT id FROM workflow_runs WHERE created_by = ?)`, [id, id])).map((row) => row.id);
|
|
32253
|
-
|
|
32254
|
-
const table = quoteSqlIdentifier(reference.tableName);
|
|
32255
|
-
const column = quoteSqlIdentifier(reference.columnName);
|
|
32256
|
-
await tx.run(`UPDATE ${table} SET ${column} = ? WHERE ${column} = ?`, [replacement, id]);
|
|
32257
|
-
}
|
|
32258
|
-
const sealedContexts = await tx.query(`SELECT id, context_replay FROM workflow_runs
|
|
32259
|
-
WHERE context_replay IS NOT NULL
|
|
32260
|
-
AND json_valid(context)
|
|
32261
|
-
AND json_extract(context, '$.swarm.requestedByUserId') = ?`, [id]);
|
|
32863
|
+
const sealedContexts = await tx.query(WORKFLOW_SEALED_CONTEXT_BY_REQUESTER_SQL, [id]);
|
|
32262
32864
|
for (const row of sealedContexts) {
|
|
32263
32865
|
let context;
|
|
32264
32866
|
try {
|
|
@@ -32279,15 +32881,12 @@ async function deleteUser2(id, replacementUserId) {
|
|
|
32279
32881
|
]);
|
|
32280
32882
|
}
|
|
32281
32883
|
if (replacementUserId) {
|
|
32282
|
-
await tx.run(
|
|
32283
|
-
SET context = json_set(context, '$.swarm.requestedByUserId', ?)
|
|
32284
|
-
WHERE json_valid(context)
|
|
32285
|
-
AND json_extract(context, '$.swarm.requestedByUserId') = ?`, [replacementUserId, id]);
|
|
32884
|
+
await tx.run(WORKFLOW_CONTEXT_SET_REQUESTER_SQL, [replacementUserId, id]);
|
|
32286
32885
|
} else {
|
|
32287
|
-
await tx.run(
|
|
32288
|
-
|
|
32289
|
-
|
|
32290
|
-
|
|
32886
|
+
await tx.run(WORKFLOW_CONTEXT_REMOVE_REQUESTER_SQL, [id]);
|
|
32887
|
+
}
|
|
32888
|
+
for (const reference of references) {
|
|
32889
|
+
await tx.run(userReferenceRewriteSql(reference), [replacement, id]);
|
|
32291
32890
|
}
|
|
32292
32891
|
await reclassifyTaskHumanFree(reclassifySeedIds);
|
|
32293
32892
|
const result = await tx.run("DELETE FROM users WHERE id = ?", [id]);
|
|
@@ -33287,6 +33886,7 @@ var init_db4 = __esm(() => {
|
|
|
33287
33886
|
init_human_free();
|
|
33288
33887
|
init_read();
|
|
33289
33888
|
init_write();
|
|
33889
|
+
init_user_references();
|
|
33290
33890
|
init_workflow_idempotency();
|
|
33291
33891
|
init_workflow_run_definitions();
|
|
33292
33892
|
init_workflow_runs();
|
|
@@ -33312,7 +33912,7 @@ var init_db4 = __esm(() => {
|
|
|
33312
33912
|
configureAgentDependencies({
|
|
33313
33913
|
createLogEntry: (entry) => createLogEntry2(entry),
|
|
33314
33914
|
installSystemDefaultSkillsForAgent: (agentId) => installSystemDefaultSkillsForAgent2(agentId),
|
|
33315
|
-
resolvePendingImportAssignments: async (agent) => (await import("./pending-
|
|
33915
|
+
resolvePendingImportAssignments: async (agent) => (await import("./pending-fwj2fatd.js")).resolvePendingImportAssignments(agent)
|
|
33316
33916
|
});
|
|
33317
33917
|
configureTaskWriteDependencies({
|
|
33318
33918
|
createLogEntry: (...args) => createLogEntry2(...args),
|
|
@@ -33362,4 +33962,4 @@ var init_db4 = __esm(() => {
|
|
|
33362
33962
|
};
|
|
33363
33963
|
});
|
|
33364
33964
|
|
|
33365
|
-
export { auditAssetKeys, init_asset_key_audit, CredentialBindingSchema, placeholderForConfigKey, CredentialBroker, defaultCredentialBindings, isPrivateAddress, assertUrlSafe, parseEgressAllowlist, init_egress_guard, init_credential_broker, encryptSecret, decryptSecret, getEncryptionKey, init_crypto, withLoopPath, bindLoopPath, startEventLoopLagProbe, stopEventLoopLagProbe, init_event_loop_lag, DbTransactionDeadlineError, isInTransaction, init_db_client, breaksJsonValidity, scrubJsonValue, foldHexCopies, init_scrub_json, sealJson, init_sealed_json, getPromptTemplateDefaultDrift, init_default_drift, init_templates2, init_templates3, isSqliteVecAvailable2, resolveSqliteVecExtensionPath2, __resetSqliteVecExtensionPathCacheForTests2, initDb2, getDb2, closeDb2, getDbClient2, init_runtime2, SessionCostConflictError2, insertSessionCost2, slackContextKey, chatSdkContextKey, chatThreadOfContextKey, agentmailContextKey, githubContextKey, gitlabContextKey, azureDevOpsContextKey, azureDevOpsWorkItemContextKey, bitbucketContextKey, linearContextKey, buildJiraContextKey, scheduleContextKey, workflowContextKey, agentContextKey, pageContextKey, APP_SESSION_KEY_PATTERN, appSessionContextKey, init_context_key, sessionSourceKey, sourceOfKey, SOURCE_GROUPS_READ_ONLY, sourceMoveError, init_source_key, TaskCreationBlockedError, TaskRoutingAuthorizationError, init_errors2, checkSlackRoutingCoherence, init_slack_routing, init_catalog, catalog_default, COMPANY_TEAM_SIZES, COMPANY_USE_CASES, USER_FUNCTIONS, reportedUseCase, reportedUserFunction, init_company_profile, mapTriggerSurface, init_telemetry_context, TELEMETRY_PROXY_ORIGIN, normalizeOrgWebsite, orgLogoUrl, isFilledOrgLogoUrl, init_org_website, beginRequestAuthScope, setRequestAuth, getRequestAuth, runWithoutRequestAuth, authUserId, authUser, isOperatorAuth, getCurrentRequestUserId, getCurrentRunProvenance, init_request_auth_context, setTelemetryIngestObserver, isTelemetryEnabled, _resolveIntegrationType, _resolveIntegrationProvider, initTelemetry, setTelemetryRoleResolver, setTelemetryFunctionResolver, isTelemetryReady, track, trackRelayed, telemetry, emitIntegrationConnected, init_telemetry, isRbacEnabled, decideAdmission, decideToolAdmission, grantLeadEquivalence, revokeLeadEquivalence, init_elevated_agents, LEGACY_RULES, setAuditSink, clearAuditSink, can, PermissionVerbSchema, init_rbac, CHAT_SDK_ADAPTER_NAMES, CHAT_SDK_ADAPTER_SCHEMAS, ChatSdkAdaptersDraftSchema, firstIssueText, isAdapterEntryEnabled, init_schema, TELEMETRY_RANKING_KEY, PUBLIC_RANKING_ENABLED_KEY, RANKING_CATEGORIES, readTelemetryRanking, rankingFormSchema, buildListing, init_telemetry_ranking, resolveQuickJSPoolSize, init_quickjs_pool_config, SLACK_REACTION_DEFAULTS, SLACK_REACTION_CONFIG_KEYS, reactionName, completedStatusIcon, init_reaction_shortcode, API_DRAINING_HEADER, API_DRAIN_MAX_MS_LIMIT, isApiDrainingResponse, init_api_drain2, isEnvExportRestrictedKey, init_config_env_export, parseEnabledTools, init_enabled_tools, parseFollowUpGateScheduleIds, isFollowUpGateScheduleId, init_follow_up_gate_schedule_ids, parseTaskToolManifest, CHAT_TASK_ONLY_TOOLS, isChatSdkTask, selectTaskTools, init_task_tool_manifest, tierConfigKey, init_model_tier_keys, isApiOnlyConfigKey, isInternalConfigKey, internalConfigKeyError, isReservedConfigKey, reservedKeyError, MAX_DB_RETENTION_DAYS, DB_RETENTION_TUNING_BOUNDS, APPS_JSON_COLUMN_MAX_BYTES_BOUNDS, CODEX_OAUTH_KEEP_WARM_MAX_AGE_HOURS_BOUNDS, validateRuntimeTokenTtlHours, validateControllerTokenTtlDays, validateControllerGraceSec, validateConfigValue, validateConfigEntry, validateExportToEnv, init_swarm_config_guard, cachedUserRole, cachedUserFunction, invalidateTelemetryUserRole, configureOrgDomainPersistence, recomputeOrgDomain, scheduleOrgDomainRecompute, init_telemetry_identity, resolveTriggerSurface, emitTaskTelemetry, init_telemetry_trigger, MASKED_SECRET_VALUE, init_config_secrets, HeartbeatExpiryError, init_heartbeat_expiry, isEffectiveOutputSchema, init_output_schema, isRuntimePoolsEnabled, init_runtime_pools_flag, normalizeDate, normalizeDateRequired, init_date_utils, rowToAgent, updateAgentCredentialState2, updateAgentCredentialMissing2, createAgent2, getAgentById2, EXTENSION_AGENT_ROLE2, NOT_EXTENSION_AGENT_SQL2, isExtensionAgent2, extensionAgentAssignmentError2, ReservedAgentRoleError2, reservedRoleViolation2, ExtensionAgentAssignmentError2, getAllAgents2, getAgentStatusCounts2, getLeadAgent2, updateAgentStatus2, updateAgentMaxTasks2, updateAgentProvider2, setAgentHarnessProvider2, updateAgentCredStatus2, listAgentsWithCredStatusByProvider2, getAgentHarnessProviders2, updateAgentActivity2, MAX_EMPTY_POLLS2, incrementEmptyPollCount2, resetEmptyPollCount2, shouldBlockPolling2, deleteAgent2, getActiveTaskCount2, hasCapacity2, getRemainingCapacity2, updateAgentStatusFromCapacity2, isPoolAffinityEnforcementEnabled2, buildRoutingAffinityFromAgent2, isAgentEligibleForTask2, getAgentDailyTaskCounts2, init_agents, closeSlackTreeIfSettled, getSlackThreadsOfTasks, slackThreadHasOutcomeWork, init_slack_trees, WorkflowReplayStateError, init_workflow_replay, getWorkflowRunTriggeredByAgentId, getWorkflowRunSummary, getWorkflowRunStepsSlimByRunId, WORKFLOW_RUN_TREE_MAX_DEPTH, WorkflowRunTreeError, getRunLineageBlock, getWorkflowRunTreeIds, getWorkflowRunStatus, getOpenWorkflowTreeTaskIds, getTaskIdsWithDependents, workflowRunTreeHasOpenWork, getWorkflowRunTree, cancelOpenWorkflowTreeSteps, disarmWorkflowTreeRetries, cancelLiveWorkflowTreeRuns, getChildWorkflowRunId, isParentStepAttemptCurrent, getRunningSubWorkflowSteps, getWorkflowRunParent, getWorkflowRunLineage, getSettledChildRunParentSteps, emitRunFinished, createForeachChildSteps, createForeachAttemptSteps, init_workflow_runs, OpenAI2, init_openai2, LEARNING_TTL_DAYS, LEARNING_DUPLICATE_MIN_SIMILARITY, CANDIDATE_SET_MULTIPLIER, isGraphExpansionEnabled, EMBEDDING_DIMENSIONS, init_constants2, LONGTERM_ROOT, LEARNINGS_ROOT, MEMORY_KEY_PATTERN, MEMORY_KEY_PATTERN_MESSAGE, MEMORY_KEY_MAX_LENGTH, isLongtermKey, longtermKeyError, isConsolidatedKey, consolidatedKeyMessage, resolveStoreKey, init_key_paths, computeScore, rerank, init_reranker, searchMemoryCandidates, init_search_candidates, rowToCandidate, init_sqlite_store, getEmbeddingProvider2, resetEmbeddingProvider2, getMemoryStore2, init_memory, embeddingProvider2, computeScriptEmbedding2, writeScriptEmbedding2, embedScript2, searchScripts2, reembedAllScripts2, init_embeddings, upsertScriptByName, getScript, getScriptById, getScriptVersion, listScripts, listScriptVersions, deleteScript, touchScratchScriptLastUsed, restoreScratchScriptLastUsedIfUnchanged, createScriptApi, listScriptApisForScript, getScriptApiById, getScriptApiSecret, updateScriptApi, rotateScriptApiSecret, deleteScriptApi, recordScriptApiUsage, init_db3, oauthSecretName, registerStoredSecret, loadSecretRegistry, init_secret_registry, getDefaultAuthorizationIdForProvider, getOAuthApp, getOAuthAppById, getOAuthAppIdByProvider, createOAuthApp, updateOAuthAppById, upsertOAuthApp, listAuthorizationsForApp, getAuthorizationById, upsertAuthorization, updateAuthorizationTokens, updateAuthorizationIdentity, deleteAuthorizationById, deleteAuthorizationsForApp, createOAuthPending, consumeOAuthPending, gcOAuthPending, markAuthorizationRefreshFailed, hasOAuthTokens, getOAuthTokens, listAuthorizationSweepRows, listKeepAliveAuthorizations, deleteOAuthTokens, acquireOAuthRefreshLock, releaseOAuthRefreshLock, init_oauth, normalizeVcsRepo, vcsRepoName, vcsRepoUrlMatches, init_vcs_repo_match, taskModelPin, resumedTaskModelSelection, init_model_pin, normalizeModelKey, init_pricing_normalize, buildModelsDevSeedRows, seedPricingFromModelsDev, init_seed_pricing, buildCatalogEntries, replaceModelCatalog, touchModelCatalogCheckedAt, countModelCatalog, getModelCatalogMeta, updateModelCatalogMeta, upsertModelCatalogOverlay, deleteModelCatalogOverlay, expireMatchedOverlays, applyOverlayPricingRows, reloadModelsCatalog, loadModelsCatalog, init_model_catalog_store, listHarnessModelSupport, recordHarnessModelSupport, agentRanModel, getAgentHarnessCliVersion, setAgentHarnessCliVersion, init_harness_model_support, sanitizeModelTierOverrides, parseModelTierOverridesHeader, setAgentModelTierOverrides, previewModelTiers, recordClaimModelResolution, init_model_tier_resolution, harnessModelErrorFor, poolTaskRunsOnHarness, explicitModelError, explicitModelErrorForAgent, init_model_validation2, runtimeReadsRepoSecrets, checkProfileForAgent, formatProfileCheckFailures, init_model_profile_check, startTaskSearchBackfill, stopTaskSearchBackfill, init_search_index, rowToAgentTask, getTaskById2, getChildTasks2, TASK_LINEAGE_LIMITS2, getTaskLineage2, hasNonTerminalResumeChild2, SUPERSEDED_RESUME_REPAIR_WINDOW_MS2, getSupersededTasksWithoutResume2, getSupersededTasksWithUnsettledDependents2, hasNonTerminalRerouteDecisionChild2, getTasksByAgentId2, getTasksDispatchedFrom2, getAgentCurrentTask2, getTasksByStatus2, findTaskByVcs2, findActiveTasksByVcs2, findTaskByGitHub2, readableSessionCondition, getAllTasks2, getTasksCount2, getTaskStats2, getCompletedSlackTasks2, getPendingSlackRelayTasks2, markSlackRelayAttempted2, markSlackRelayDelivered2, markFinalizedSlackRelaysDelivered2, getPendingChatRelayTasks2, giveUpStaleChatRelays2, markChatRelayAttempted2, recordChatRelayError2, markChatRelayDelivered2, markChatRelayGivenUp2, getRecentlyFinishedWorkerTasks2, markTasksNotified2, resetTasksNotified2, getInProgressSlackTasks2, getSlackTasksMissingTree2, getInProgressTasksByContextKey2, isLinearTrackerContextKey2, findExistingLinearTrackerContextWork2, getLatestTaskByContextKey2, getLatestScriptRunStepTaskByContextKey2, getAgentWorkingOnThread2, getLatestActiveTaskInThread2, getLatestLeadTaskInThread2, getAgentWorkingOnContextKey2, getLatestTaskByContextKeyPrefix2, getLatestActiveTaskByContextKey2, getLatestLeadTaskByContextKey2, getFirstTaskInThread2, getMostRecentTaskInThread2, findCompletedTasksInThread2, findRecentFailedTaskInThread2, countAgentDispatchesInThread2, findRecentCancelledTaskInThread2, init_read, MODEL_PROFILE_CONFIG_KEY, hasUnreadableCredentialAllowlist, listModelProfiles, getModelProfileByName, createModelProfile, updateModelProfile, modelProfileReferences, modelProfileRefError, deleteModelProfile, MAX_MODEL_PROFILE_FALLBACKS, modelProfileFallbacksError, taskProfileError, scheduleProfileUpdate, init_model_profiles, SESSION_ACTIVITY_REFRESH_MIN_INTERVAL_MS2, refreshActiveSessionOnActivity2, getActiveSessionById, init_active_sessions, STEERING_MOVED_ERROR, SteeringRequestError, SteeringBlockedError, isSteeringEnabled, getTaskSteeringFields, getTaskSteeringFieldsForTasks, promotePendingSteeringForTask, markSteeringUndeliverable, carryUnhandledSteering, requestSteering, init_steering2, listApprovalRequestSummaries2, getPendingApprovalVoteState2, recordApprovalVotes2, getPendingApprovalsForTasks2, approvalCancellationNotificationKey, listUndeliveredCancelledApprovalRequestIds, init_approvals, computeContentHash2, createContextVersion2, getLatestContextVersion2, getContextVersion2, getContextVersionHistory2, AssetKeyMovesBlockedError2, assertAssetKeyMovesAllowed2, moveTaskChainKeyInTx2, moveSessionChains, moveKeyFavorites, listPrefixRoots, listSharedPrefixRoots, init_session_moves, getSessionGroupKey, sessionSummaryQuery, getSessionReadState, getSessionTree, triageSessionList, init_session_tree, setHumanFreeQueueListener, drainHumanFreeReclassifyQueue, init_human_free, onTaskStarted, init_task_lifecycle_events, channelTopic, addWorkerSubscription, removeWorkerSubscription, listSubscribedWorkerAgents, init_channels, publishWorkerNudge, init_worker_nudges, createTask2, getPendingTaskForAgent2, assignUnassignedTaskPending2, startTask2, updateTaskClaudeSessionId2, recordTaskProviderIfUnset2, updateTaskTitle2, updateTaskTags2, setTaskTitleIfUnset2, completeTask2, failTask2, overwriteTerminalTaskResultText2, cancelTask2, skipTask2, supersedeTask2, markWorkflowStepTaskSuperseded2, settleSupersededTaskDependents2, backfillSupersedeTaskResumeTaskId2, pauseTask2, resumeTask2, getPausedTasksForAgent2, getOrphanedInProgressTasksForAgent2, resetOrphanedInProgressTasksForAgent2, getRecentlyCancelledTasksForAgent2, deleteTask2, updateTaskProgress2, init_write, IdempotencyKeyTakenError, workflowRequestFingerprint, findAcceptedWorkflowOperation, assertWorkflowIdempotencyKeyUnused, recordAcceptedWorkflowOperation, init_workflow_idempotency, PINNED_WORKFLOW_KEYS2, toPinnedDefinition2, pinWorkflowDefinition2, getRunWorkflow2, recordKeySeatMismatch2, recordKeyValidation2, retirePoolKeyStatus, init_api_keys, getScriptRunExecutionArgs2, getScriptRunFollowUpGuard2, setScriptRunFollowUpGuard2, literalPrefixPattern2, getSlackRenderV2ActivatedAt2, ensureSlackRenderV2Activation2, getSlackDelegationActivatedAt2, ensureSlackDelegationActivation2, isPendingSlackMessage2, isSettledSlackMessage2, recordSlackMessage2, reserveSlackMessage2, bindSlackMessageTimestamp2, updateSlackMessageRecord2, markSlackTreeRendered2, deleteSlackMessageRecord2, getSlackTreeMessage2, getSlackTreeMessageByThread2, getSlackOutcomeMessage2, getResolvableDeferralOutcomes2, markSlackDeferralResolved2, noteSlackOutcomeDeliveryFailure2, abandonSlackOutcomeDelivery2, getSlackTreeMessages2, getSlackMessageByChannelTs2, getSlackTasksInThread2, listSlackThreadsAwaitingHuman2, isSlackThreadAwaitingHuman2, markTaskSlackReplySent2, setSlackMessageTracking2, updateTaskVcs2, insertTaskAttachment2, recordTaskPullRequestAttachments2, getAssetKeyMappingByProvider2, upsertAssetKeyMapping2, getAssetKeyMapping2, listAssetSummaries2, moveAssetKey2, deleteTaskAttachment2, replaceTaskAttachment2, getTaskAttachments2, createSteeringMessage2, getSteeringMessagesForTask2, getSteeringMessageById2, getPendingSteeringForTask2, getPendingSteeringForAgent2, markSteeringDelivered2, markSteeringHandled2, markSteeringPromoted2, cancelPendingSteeringForTask2, hasPendingSteering2, getAgentWithTasks2, getAllAgentsWithTasks2, createLogEntry2, getLogsByAgentId2, getLogsByTaskId2, getLogsByTaskIdAndEventType2, getLogsByTaskIdChronological2, getLogsByEventType2, getAllLogs2, findRecentSimilarTasks2, createTaskExtended2, claimTask2, releaseTask2, acceptTask2, rejectTask2, moveTaskToBacklog2, moveTaskFromBacklog2, promoteDraftTask2, refreshDraftTaskLease2, promoteAbandonedDraftTasks2, releaseStaleReviewingTasks2, releaseStaleOfferedTasksForOfflineAgents2, getOfferedTasksForAgent2, claimOfferedTask2, getUnassignedTasksCount2, getUnassignedTaskIds2, getUnassignedTaskIdsForAgent2, checkDependencies2, getDependentTasks2, cascadeFailDependents2, updateAgentProfile2, updateAgentName2, createChannel2, getMessageById2, getChannelById2, getChannelByName2, getAllChannels2, deleteChannel2, postMessage2, getChannelMessages2, updateReadState2, getLastReadAt2, getUnreadMessages2, getMentionsForAgent2, getInboxSummary2, claimMentions2, releaseMentionProcessing2, releaseStaleMentionProcessing2, createService2, getServiceById2, getServiceByAgentAndName2, getServicesByAgentId2, getAllServices2, updateServiceStatus2, deleteService2, upsertService2, deleteServicesByAgentId2, createSessionLogs2, getSessionLogsByTaskId2, getSessionLogsBySession2, createSessionCost2, getSessionCostsByTaskId2, getSessionCostsByAgentId2, getAllSessionCosts2, getSessionCostsFiltered2, UNATTRIBUTED_USER_ID2, getSessionCostSummary2, getAttributionByPerson2, getDashboardCostSummary2, createInboxMessage2, getInboxMessageById2, getUnreadInboxMessages2, claimInboxMessages2, markInboxMessageRead2, markInboxMessageResponded2, markInboxMessageDelegated2, releaseStaleProcessingInbox2, getConcurrentContext2, getScheduledTasks2, getScheduledTaskById2, getScheduledTaskByName2, createScheduledTask2, updateScheduledTask2, deleteScheduledTask2, getDueScheduledTasks2, autoEncryptLegacyPlaintextSecrets2, maskSecrets2, getSwarmConfigs2, getInjectableGlobalConfigs2, getSwarmConfigById2, getSwarmConfigLookupById2, upsertSwarmConfig2, emitBuiltInIntegrationConnectedOnce2, deleteSwarmConfig2, deleteSwarmConfigByKey2, getResolvedConfig2, getSwarmRepos2, getSwarmRepoById2, getSwarmRepoByName2, getSwarmRepoByUrl2, createSwarmRepo2, updateSwarmRepo2, deleteSwarmRepo2, getAgentMailInboxMapping2, getAgentMailInboxMappingsByAgent2, getAllAgentMailInboxMappings2, createAgentMailInboxMapping2, deleteAgentMailInboxMapping2, findTaskByAgentMailThread2, insertActiveSession2, deleteActiveSession2, deleteActiveSessionById2, getActiveSessions2, heartbeatActiveSession2, cleanupStaleSessions2, cleanupAgentSessions2, updateActiveSessionProviderSessionId2, getActiveSessionForTask2, reassociateSessionLogs2, getStalledInProgressTasks2, getStalePinnedResumes2, failPendingResumeIfUnclaimed2, getIdleWorkersWithCapacity2, getUnassignedPoolTasks2, getStaleUnassignedAffinityTasks2, getRecentFailedTasks2, getRecentCompletedCount2, getRecentFailedCount2, createWorkflow2, getWorkflow2, listWorkflows2, updateWorkflow2, deleteWorkflow2, getWorkflowsByScheduleId2, createWorkflowRun2, getWorkflowRun2, updateWorkflowRun2, listWorkflowRuns2, countWorkflowRuns2, listWorkflowRunsPage2, createWorkflowRunStep2, getWorkflowRunStep2, updateWorkflowRunStep2, getWorkflowRunStepsByRunId2, getStuckWorkflowRuns2, getLastSuccessfulRun2, getLastRunStart2, getRetryableSteps2, getCompletedStepNodeIds2, getTaskByWorkflowRunStepId2, detachTaskFromWorkflowRunStep2, getStepByIdempotencyKey2, getStepCountForNode2, getLatestStepForNode2, getCurrentStepForNode2, createWorkflowVersion2, getWorkflowVersions2, getWorkflowVersion2, createAppVersion2, getAppVersions2, getAppVersion2, createPage2, getPage2, getPageBySlug2, getLatestPageBySlug2, listPagesByAgent2, listAllPages2, countAllPages2, countPagesByAgent2, updatePage2, deletePage2, incrementPageViewCount2, createPageVersion2, getPageVersions2, getPageVersion2, createMetric2, getMetric2, getMetricBySlug2, listMetricsByAgent2, listAllMetrics2, countAllMetrics2, countMetricsByAgent2, updateMetric2, deleteMetric2, createMetricVersion2, getMetricVersions2, getMetricVersion2, getPromptTemplates2, getPromptTemplateById2, upsertPromptTemplate2, deletePromptTemplate2, resetPromptTemplateToDefault2, getPromptTemplateHistory2, resolvePromptTemplate2, checkoutPromptTemplate2, getAllChannelActivityCursors2, getChannelActivityCursor2, upsertChannelActivityCursor2, createApprovalRequest2, getApprovalRequestById2, resolveApprovalRequest2, cancelApprovalRequestById2, cancelPendingApprovalRequestsForRun2, listCancelledApprovalRequestsForRun2, listCancelledApprovalRequestsForStep2, claimApprovalCancellationNotification2, completeApprovalCancellationNotificationClaim2, releaseApprovalCancellationNotificationClaim2, updateApprovalRequestNotifications2, listApprovalRequests2, getStuckApprovalRuns2, getApprovalRequestByStepId2, getExpiredPendingApprovals2, getStaleApprovalRequests2, createWaitState2, getWaitStateById2, getWaitStateByStepId2, getDueWaitStates2, getPendingEventWaitNames2, getPendingWaitsByEvent2, resolveWaitState2, getStuckWaitRuns2, SKILL_FILE_LIMITS2, normalizeSkillFilePath2, createSkill2, updateSkill2, listSkillFileManifest2, getSkillFiles2, getSkillFile2, upsertSkillFile2, upsertSkillFiles2, deleteSkillFile2, deleteSkill2, getSkillById2, getSkillByName2, listSkills2, searchSkills2, installSkill2, getSystemDefaultSkills2, installSystemDefaultSkillsForAgent2, uninstallSkill2, getAgentSkills2, toggleAgentSkill2, createMcpServer2, emitMcpServerConnectedTelemetry2, updateMcpServer2, deleteMcpServer2, getMcpServerById2, getMcpServerByName2, listMcpServers2, installMcpServer2, uninstallMcpServer2, getAgentMcpServers2, createContextSnapshot2, getContextSnapshotsByTaskId2, getContextSnapshotsBySessionId2, getContextSummaryByTaskId2, getAvailableKeyIndices2, recordKeyUsage2, setApiKeyPlan2, markKeyRateLimited2, recordKeyAuthFailure2, recordKeyRateLimitWindows2, setApiKeyName2, clearKeyRateLimit2, getKeyStatuses2, getKeyCostSummary2, getUserById2, getAllUsers2, createUser2, updateUser2, deleteUser2, listInboxState2, upsertInboxState2, listFavorites2, listUserFavorites2, getFavoriteItemIdSet2, setFavorite2, setUserFavorite2, withFavoriteFlags2, listTaskTemplates2, getRootTaskChain2, listRecentSessions2, countSessions2, getBudget2, getBudgets2, upsertBudget2, deleteBudget2, getAllPricingRows2, getPricingRows2, getActivePricingRow2, insertPricingRow2, deletePricingRow2, getDailySpendForAgent2, getDailySpendGlobal2, getDailySpendForUser2, recordBudgetRefusalNotification2, getBudgetRefusalNotification2, getRecentBudgetRefusalNotifications2, hasBudgetRefusalNotificationToday2, setBudgetRefusalFollowUpTaskId2, getLiveAgentCounts2, getReadyAgentCounts2, getInstanceActivity2, getSwarmMetrics2, hasFirstCompletedTask2, getKv2, sweepExpiredKv2, sweepExpiredKvPrefix2, upsertKv2, claimKv2, deleteKv2, KvTypeCollisionError2, incrKv2, kvPrefixUpperBound2, listKv2, countKv2, createScriptRun2, recordInlineScriptRun2, getScriptRun2, getScriptRunByIdempotencyKey2, listScriptRuns2, countScriptRuns2, countActiveScriptRuns2, updateScriptRun2, updateScriptRunIfNotTerminal2, updateScriptRunIfRunning2, getRunningScriptRuns2, getScriptRunJournalStep2, upsertScriptRunJournalStep2, listScriptRunJournalSteps2, countScriptRunJournalSteps2, countScriptRunJournalAgentTaskSteps2, exports_db, init_db4 };
|
|
33965
|
+
export { auditAssetKeys, init_asset_key_audit, CredentialBindingSchema, placeholderForConfigKey, CredentialBroker, defaultCredentialBindings, isPrivateAddress, assertUrlSafe, EgressDeniedError, createGuardedFetch, parseEgressAllowlist, init_egress_guard, init_credential_broker, encryptSecret, decryptSecret, getEncryptionKey, init_crypto, withLoopPath, bindLoopPath, startEventLoopLagProbe, stopEventLoopLagProbe, init_event_loop_lag, DbTransactionDeadlineError, isInTransaction, init_db_client, breaksJsonValidity, scrubJsonValue, foldHexCopies, init_scrub_json, sealJson, openSealedJson, init_sealed_json, getPromptTemplateDefaultDrift, init_default_drift, init_templates2, init_templates3, wasDbCreatedThisBoot, isSqliteVecAvailable2, resolveSqliteVecExtensionPath2, __resetSqliteVecExtensionPathCacheForTests2, initDb2, getDb2, closeDb2, getDbClient2, init_runtime2, SessionCostConflictError2, insertSessionCost2, slackContextKey, chatSdkContextKey, chatThreadOfContextKey, agentmailContextKey, githubContextKey, gitlabContextKey, azureDevOpsContextKey, azureDevOpsWorkItemContextKey, bitbucketContextKey, linearContextKey, buildJiraContextKey, scheduleContextKey, workflowContextKey, agentContextKey, pageContextKey, APP_SESSION_KEY_PATTERN, appSessionContextKey, init_context_key, sessionSourceKey, sourceOfKey, SOURCE_GROUPS_READ_ONLY, sourceMoveError, init_source_key, TaskCreationBlockedError, TaskRoutingAuthorizationError, init_errors2, checkSlackRoutingCoherence, init_slack_routing, init_catalog, catalog_default, COMPANY_TEAM_SIZES, COMPANY_USE_CASES, USER_FUNCTIONS, reportedUseCase, reportedUserFunction, init_company_profile, mapTriggerSurface, init_telemetry_context, TELEMETRY_PROXY_ORIGIN, normalizeOrgWebsite, orgLogoUrl, isFilledOrgLogoUrl, init_org_website, beginRequestAuthScope, setRequestAuth, getRequestAuth, runWithoutRequestAuth, authUserId, authUser, isOperatorAuth, getCurrentRequestUserId, getCurrentRunProvenance, init_request_auth_context, setTelemetryIngestObserver, isTelemetryEnabled, _resolveIntegrationType, _resolveIntegrationProvider, initTelemetry, setTelemetryRoleResolver, setTelemetryFunctionResolver, isTelemetryReady, track, trackRelayed, telemetry, emitIntegrationConnected, init_telemetry, isRbacEnabled, decideAdmission, decideToolAdmission, grantLeadEquivalence, revokeLeadEquivalence, init_elevated_agents, LEGACY_RULES, setAuditSink, clearAuditSink, can, PermissionVerbSchema, init_rbac, randomChars, init_short_id, CHAT_SDK_ADAPTER_NAMES, CHAT_SDK_ADAPTER_SCHEMAS, ChatSdkAdaptersDraftSchema, firstIssueText, isAdapterEntryEnabled, init_schema, TELEMETRY_RANKING_KEY, PUBLIC_RANKING_ENABLED_KEY, RANKING_CATEGORIES, readTelemetryRanking, rankingFormSchema, buildListing, init_telemetry_ranking, resolveQuickJSPoolSize, init_quickjs_pool_config, SLACK_REACTION_DEFAULTS, SLACK_REACTION_CONFIG_KEYS, reactionName, isSlackIconConfigKey, reactionStatusIcon, iconPrefix, completedStatusIcon, init_reaction_shortcode, UI_SPEC_SCRIPT_ACTIONS_KEY, parseScriptActionAllowlist, init_script_allowlist, API_DRAINING_HEADER, API_DRAIN_MAX_MS_LIMIT, isApiDrainingResponse, init_api_drain2, isEnvExportRestrictedKey, init_config_env_export, parseEnabledTools, init_enabled_tools, parseFollowUpGateScheduleIds, isFollowUpGateScheduleId, init_follow_up_gate_schedule_ids, parseTaskToolManifest, CHAT_TASK_ONLY_TOOLS, isChatSdkTask, selectTaskTools, init_task_tool_manifest, tierConfigKey, init_model_tier_keys, isApiOnlyConfigKey, isInternalConfigKey, internalConfigKeyError, isHumanOnlyConfigKey, humanOnlyConfigKeyError, humanOnlyConfigKeyPageError, isReservedConfigKey, reservedKeyError, MAX_DB_RETENTION_DAYS, DB_RETENTION_TUNING_BOUNDS, APPS_JSON_COLUMN_MAX_BYTES_BOUNDS, CODEX_OAUTH_KEEP_WARM_MAX_AGE_HOURS_BOUNDS, validateRuntimeTokenTtlHours, validateControllerTokenTtlDays, validateControllerGraceSec, validateConfigValue, validateConfigEntry, validateExportToEnv, init_swarm_config_guard, cachedUserRole, cachedUserFunction, invalidateTelemetryUserRole, configureOrgDomainPersistence, recomputeOrgDomain, scheduleOrgDomainRecompute, init_telemetry_identity, resolveTriggerSurface, emitTaskTelemetry, init_telemetry_trigger, MASKED_SECRET_VALUE, init_config_secrets, HeartbeatExpiryError, init_heartbeat_expiry, isEffectiveOutputSchema, init_output_schema, isRuntimePoolsEnabled, init_runtime_pools_flag, normalizeDate, normalizeDateRequired, init_date_utils, rowToAgent, updateAgentCredentialState2, updateAgentCredentialMissing2, createAgent2, getAgentById2, EXTENSION_AGENT_ROLE2, NOT_EXTENSION_AGENT_SQL2, isExtensionAgent2, extensionAgentAssignmentError2, ReservedAgentRoleError2, reservedRoleViolation2, ExtensionAgentAssignmentError2, getAllAgents2, getAgentStatusCounts2, getLeadAgent2, updateAgentStatus2, updateAgentMaxTasks2, updateAgentProvider2, setAgentHarnessProvider2, updateAgentCredStatus2, listAgentsWithCredStatusByProvider2, getAgentHarnessProviders2, updateAgentActivity2, MAX_EMPTY_POLLS2, incrementEmptyPollCount2, resetEmptyPollCount2, shouldBlockPolling2, deleteAgent2, getActiveTaskCount2, hasCapacity2, getRemainingCapacity2, updateAgentStatusFromCapacity2, isPoolAffinityEnforcementEnabled2, buildRoutingAffinityFromAgent2, isAgentEligibleForTask2, getAgentDailyTaskCounts2, init_agents, closeSlackTreeIfSettled, getSlackThreadsOfTasks, slackThreadHasBotReplySince, slackThreadHasOutcomeWork, observeSlackTreeVisibility, getSlackProcessingThreads, init_slack_trees, WorkflowReplayStateError, init_workflow_replay, getWorkflowRunTriggeredByAgentId, getWorkflowRunSummary, getWorkflowRunStepsSlimByRunId, WORKFLOW_RUN_TREE_MAX_DEPTH, WorkflowRunTreeError, getRunLineageBlock, getWorkflowRunTreeIds, getWorkflowRunStatus, getOpenWorkflowTreeTaskIds, getTaskIdsWithDependents, workflowRunTreeHasOpenWork, getWorkflowRunTree, cancelOpenWorkflowTreeSteps, disarmWorkflowTreeRetries, cancelLiveWorkflowTreeRuns, getChildWorkflowRunId, isParentStepAttemptCurrent, getRunningSubWorkflowSteps, getWorkflowRunParent, getWorkflowRunLineage, getSettledChildRunParentSteps, emitRunFinished, createForeachChildSteps, createForeachAttemptSteps, init_workflow_runs, OpenAI2, init_openai2, LEARNING_TTL_DAYS, LEARNING_DUPLICATE_MIN_SIMILARITY, CANDIDATE_SET_MULTIPLIER, isGraphExpansionEnabled, EMBEDDING_DIMENSIONS, init_constants2, LONGTERM_ROOT, LEARNINGS_ROOT, MEMORY_KEY_PATTERN, MEMORY_KEY_PATTERN_MESSAGE, MEMORY_KEY_MAX_LENGTH, isLongtermKey, longtermKeyError, isConsolidatedKey, consolidatedKeyMessage, resolveStoreKey, init_key_paths, computeScore, rerank, init_reranker, isReviewTaskId, dropReviewTaskCompletions, init_review_recall_filter, searchMemoryCandidates, init_search_candidates, rowToCandidate, init_sqlite_store, getEmbeddingProvider2, resetEmbeddingProvider2, getMemoryStore2, init_memory, embeddingProvider2, computeScriptEmbedding2, writeScriptEmbedding2, embedScript2, searchScripts2, reembedAllScripts2, init_embeddings, upsertScriptByName, getScript, getGlobalScriptContentHashes, getScriptById, getScriptVersion, listScripts, listScriptVersions, deleteScript, touchScratchScriptLastUsed, restoreScratchScriptLastUsedIfUnchanged, createScriptApi, listScriptApisForScript, getScriptApiById, getScriptApiSecret, updateScriptApi, rotateScriptApiSecret, deleteScriptApi, recordScriptApiUsage, init_db3, oauthSecretName, registerStoredSecret, loadSecretRegistry, init_secret_registry, getDefaultAuthorizationIdForProvider, getOAuthApp, getOAuthAppById, getOAuthAppIdByProvider, createOAuthApp, updateOAuthAppById, upsertOAuthApp, listAuthorizationsForApp, getAuthorizationById, upsertAuthorization, updateAuthorizationTokens, updateAuthorizationIdentity, deleteAuthorizationById, deleteAuthorizationsForApp, createOAuthPending, consumeOAuthPending, gcOAuthPending, markAuthorizationRefreshFailed, hasOAuthTokens, getOAuthTokens, listAuthorizationSweepRows, listKeepAliveAuthorizations, deleteOAuthTokens, acquireOAuthRefreshLock, releaseOAuthRefreshLock, init_oauth, normalizeVcsRepo, vcsRepoName, vcsRepoUrlMatches, init_vcs_repo_match, taskModelPin, resumedTaskModelSelection, init_model_pin, normalizeModelKey, init_pricing_normalize, buildModelsDevSeedRows, seedPricingFromModelsDev, init_seed_pricing, buildCatalogEntries, replaceModelCatalog, touchModelCatalogCheckedAt, countModelCatalog, getModelCatalogMeta, updateModelCatalogMeta, upsertModelCatalogOverlay, deleteModelCatalogOverlay, expireMatchedOverlays, applyOverlayPricingRows, reloadModelsCatalog, loadModelsCatalog, init_model_catalog_store, listHarnessModelSupport, recordHarnessModelSupport, agentRanModel, getAgentHarnessCliVersion, setAgentHarnessCliVersion, init_harness_model_support, sanitizeModelTierOverrides, parseModelTierOverridesHeader, setAgentModelTierOverrides, previewModelTiers, recordClaimModelResolution, init_model_tier_resolution, harnessModelErrorFor, poolTaskRunsOnHarness, explicitModelError, explicitModelErrorForAgent, init_model_validation2, runtimeReadsRepoSecrets, configPools, checkProfileForAgent, formatProfileCheckFailures, init_model_profile_check, startTaskSearchBackfill, stopTaskSearchBackfill, init_search_index, rowToAgentTask, getTaskById2, getChildTasks2, TASK_LINEAGE_LIMITS2, getTaskLineage2, hasNonTerminalResumeChild2, SUPERSEDED_RESUME_REPAIR_WINDOW_MS2, getSupersededTasksWithoutResume2, getSupersededTasksWithUnsettledDependents2, hasNonTerminalRerouteDecisionChild2, getTasksByAgentId2, getTasksDispatchedFrom2, getAgentCurrentTask2, getTasksByStatus2, findTaskByVcs2, findActiveTasksByVcs2, findTaskByGitHub2, readableSessionCondition, getAllTasks2, getTasksCount2, getTaskStats2, getCompletedSlackTasks2, getPendingSlackRelayTasks2, markSlackRelayAttempted2, markSlackRelayDelivered2, markFinalizedSlackRelaysDelivered2, getPendingChatRelayTasks2, giveUpStaleChatRelays2, markChatRelayAttempted2, recordChatRelayError2, markChatRelayDelivered2, markChatRelayGivenUp2, getRecentlyFinishedWorkerTasks2, markTasksNotified2, resetTasksNotified2, getInProgressSlackTasks2, getSlackTasksMissingTree2, getInProgressTasksByContextKey2, isLinearTrackerContextKey2, findExistingLinearTrackerContextWork2, getLatestTaskByContextKey2, getLatestScriptRunStepTaskByContextKey2, getAgentWorkingOnThread2, getLatestActiveTaskInThread2, getLatestLeadTaskInThread2, getAgentWorkingOnContextKey2, getLatestTaskByContextKeyPrefix2, getLatestActiveTaskByContextKey2, getLatestLeadTaskByContextKey2, getFirstTaskInThread2, getMostRecentTaskInThread2, findCompletedTasksInThread2, findRecentFailedTaskInThread2, countAgentDispatchesInThread2, findRecentCancelledTaskInThread2, init_read, MODEL_PROFILE_CONFIG_KEY, hasUnreadableCredentialAllowlist, listModelProfiles, getModelProfileByName, createModelProfile, updateModelProfile, TASK_HOLDS_PROFILE_SQL, repairWindowStart, modelProfileReferences, modelProfileRefError, isModelNameTakenError, deleteModelProfile, MAX_MODEL_PROFILE_FALLBACKS, modelProfileFallbacksError, taskProfileError, scheduleProfileUpdate, init_model_profiles, SESSION_ACTIVITY_REFRESH_MIN_INTERVAL_MS2, refreshActiveSessionOnActivity2, getActiveSessionById, init_active_sessions, STEERING_MOVED_ERROR, SteeringRequestError, SteeringBlockedError, isSteeringEnabled, getTaskSteeringFields, getTaskSteeringFieldsForTasks, promotePendingSteeringForTask, markSteeringUndeliverable, carryUnhandledSteering, requestSteering, init_steering2, onTaskStarted, init_task_lifecycle_events, listApprovalRequestSummaries2, getPendingApprovalVoteState2, recordApprovalVotes2, getPendingApprovalsForTasks2, approvalCancellationNotificationKey, listUndeliveredCancelledApprovalRequestIds, init_approvals, computeContentHash2, createContextVersion2, getLatestContextVersion2, getContextVersion2, getContextVersionHistory2, AssetKeyMovesBlockedError2, assertAssetKeyMovesAllowed2, moveTaskChainKeyInTx2, moveSessionChains, moveKeyFavorites, listPrefixRoots, listSharedPrefixRoots, init_session_moves, getSessionGroupKey, sessionSummaryQuery, getSessionReadState, getSessionTree, triageSessionList, init_session_tree, setHumanFreeQueueListener, reclassifyTaskHumanFree, drainHumanFreeReclassifyQueue, init_human_free, channelTopic, addWorkerSubscription, removeWorkerSubscription, listSubscribedWorkerAgents, init_channels, publishWorkerNudge, init_worker_nudges, createTask2, getPendingTaskForAgent2, assignUnassignedTaskPending2, startTask2, updateTaskClaudeSessionId2, recordTaskProviderIfUnset2, updateTaskTitle2, updateTaskTags2, setTaskTitleIfUnset2, completeTask2, failTask2, overwriteTerminalTaskResultText2, cancelTask2, skipTask2, supersedeTask2, markWorkflowStepTaskSuperseded2, settleSupersededTaskDependents2, backfillSupersedeTaskResumeTaskId2, pauseTask2, resumeTask2, getPausedTasksForAgent2, getOrphanedInProgressTasksForAgent2, resetOrphanedInProgressTasksForAgent2, getRecentlyCancelledTasksForAgent2, deleteTask2, updateTaskProgress2, init_write, quoteSqlIdentifier, USER_REFERENCE_COLUMNS_SQL, userReferenceRewriteSql, WORKFLOW_CONTEXT_REQUESTER_SQL, init_user_references, IdempotencyKeyTakenError, workflowRequestFingerprint, findAcceptedWorkflowOperation, assertWorkflowIdempotencyKeyUnused, recordAcceptedWorkflowOperation, init_workflow_idempotency, PINNED_WORKFLOW_KEYS2, toPinnedDefinition2, pinWorkflowDefinition2, getRunWorkflow2, deleteOrphanedRunDefinitions, init_workflow_run_definitions, recordKeySeatMismatch2, recordKeyValidation2, retirePoolKeyStatus, init_api_keys, getScriptRunExecutionArgs2, getScriptRunFollowUpGuard2, setScriptRunFollowUpGuard2, literalPrefixPattern2, getSlackRenderV2ActivatedAt2, ensureSlackRenderV2Activation2, getSlackDelegationActivatedAt2, ensureSlackDelegationActivation2, isPendingSlackMessage2, isSettledSlackMessage2, recordSlackMessage2, reserveSlackMessage2, bindSlackMessageTimestamp2, updateSlackMessageRecord2, markSlackTreeRendered2, deleteSlackMessageRecord2, getSlackTreeMessage2, getSlackTreeMessageByThread2, getSlackOutcomeMessage2, getResolvableDeferralOutcomes2, markSlackDeferralResolved2, noteSlackOutcomeDeliveryFailure2, abandonSlackOutcomeDelivery2, getSlackTreeMessages2, getSlackMessageByChannelTs2, getSlackTasksInThread2, listSlackThreadsAwaitingHuman2, isSlackThreadAwaitingHuman2, markTaskSlackReplySent2, setSlackMessageTracking2, updateTaskVcs2, insertTaskAttachment2, recordTaskPullRequestAttachments2, getAssetKeyMappingByProvider2, upsertAssetKeyMapping2, getAssetKeyMapping2, listAssetSummaries2, moveAssetKey2, deleteTaskAttachment2, replaceTaskAttachment2, getTaskAttachments2, createSteeringMessage2, getSteeringMessagesForTask2, getSteeringMessageById2, getPendingSteeringForTask2, getPendingSteeringForAgent2, markSteeringDelivered2, markSteeringHandled2, markSteeringPromoted2, cancelPendingSteeringForTask2, hasPendingSteering2, getAgentWithTasks2, getAllAgentsWithTasks2, createLogEntry2, getLogsByAgentId2, getLogsByTaskId2, getLogsByTaskIdAndEventType2, getLogsByTaskIdChronological2, getLogsByEventType2, getAllLogs2, findRecentSimilarTasks2, createTaskExtended2, claimTask2, releaseTask2, acceptTask2, rejectTask2, moveTaskToBacklog2, moveTaskFromBacklog2, promoteDraftTask2, refreshDraftTaskLease2, promoteAbandonedDraftTasks2, releaseStaleReviewingTasks2, releaseStaleOfferedTasksForOfflineAgents2, getOfferedTasksForAgent2, claimOfferedTask2, getUnassignedTasksCount2, getUnassignedTaskIds2, getUnassignedTaskIdsForAgent2, checkDependencies2, getDependentTasks2, cascadeFailDependents2, updateAgentProfile2, updateAgentName2, createChannel2, getMessageById2, getChannelById2, getChannelByName2, getAllChannels2, deleteChannel2, postMessage2, getChannelMessages2, updateReadState2, getLastReadAt2, getUnreadMessages2, getMentionsForAgent2, getInboxSummary2, claimMentions2, releaseMentionProcessing2, releaseStaleMentionProcessing2, createService2, getServiceById2, getServiceByAgentAndName2, getServicesByAgentId2, getAllServices2, updateServiceStatus2, deleteService2, upsertService2, deleteServicesByAgentId2, createSessionLogs2, getSessionLogsByTaskId2, getSessionLogsBySession2, createSessionCost2, getSessionCostsByTaskId2, getSessionCostsByAgentId2, getAllSessionCosts2, getSessionCostsFiltered2, UNATTRIBUTED_USER_ID2, getSessionCostSummary2, getAttributionByPerson2, getDashboardCostSummary2, createInboxMessage2, getInboxMessageById2, getUnreadInboxMessages2, claimInboxMessages2, markInboxMessageRead2, markInboxMessageResponded2, markInboxMessageDelegated2, releaseStaleProcessingInbox2, getConcurrentContext2, getScheduledTasks2, getScheduledTaskById2, getScheduledTaskByName2, createScheduledTask2, updateScheduledTask2, deleteScheduledTask2, getDueScheduledTasks2, autoEncryptLegacyPlaintextSecrets2, maskSecrets2, getSwarmConfigs2, getInjectableGlobalConfigs2, getSwarmConfigById2, getSwarmConfigLookupById2, upsertSwarmConfig2, emitBuiltInIntegrationConnectedOnce2, deleteSwarmConfig2, deleteSwarmConfigByKey2, getResolvedConfig2, getSwarmRepos2, getSwarmRepoById2, getSwarmRepoByName2, getSwarmRepoByUrl2, createSwarmRepo2, updateSwarmRepo2, deleteSwarmRepo2, getAgentMailInboxMapping2, getAgentMailInboxMappingsByAgent2, getAllAgentMailInboxMappings2, createAgentMailInboxMapping2, deleteAgentMailInboxMapping2, findTaskByAgentMailThread2, insertActiveSession2, deleteActiveSession2, deleteActiveSessionById2, getActiveSessions2, heartbeatActiveSession2, cleanupStaleSessions2, cleanupAgentSessions2, updateActiveSessionProviderSessionId2, getActiveSessionForTask2, reassociateSessionLogs2, getStalledInProgressTasks2, getStalePinnedResumes2, failPendingResumeIfUnclaimed2, getIdleWorkersWithCapacity2, getUnassignedPoolTasks2, getStaleUnassignedAffinityTasks2, getRecentFailedTasks2, getRecentCompletedCount2, getRecentFailedCount2, createWorkflow2, getWorkflow2, listWorkflows2, updateWorkflow2, deleteWorkflow2, getWorkflowsByScheduleId2, createWorkflowRun2, getWorkflowRun2, updateWorkflowRun2, listWorkflowRuns2, countWorkflowRuns2, listWorkflowRunsPage2, createWorkflowRunStep2, getWorkflowRunStep2, updateWorkflowRunStep2, getWorkflowRunStepsByRunId2, getStuckWorkflowRuns2, getLastSuccessfulRun2, getLastRunStart2, getRetryableSteps2, getCompletedStepNodeIds2, getTaskByWorkflowRunStepId2, detachTaskFromWorkflowRunStep2, getStepByIdempotencyKey2, getStepCountForNode2, getLatestStepForNode2, getCurrentStepForNode2, createWorkflowVersion2, getWorkflowVersions2, getWorkflowVersion2, createAppVersion2, getAppVersions2, getAppVersion2, createPage2, getPage2, getPageBySlug2, getLatestPageBySlug2, listPagesByAgent2, listAllPages2, countAllPages2, countPagesByAgent2, updatePage2, deletePage2, incrementPageViewCount2, createPageVersion2, getPageVersions2, getPageVersion2, createMetric2, getMetric2, getMetricBySlug2, listMetricsByAgent2, listAllMetrics2, countAllMetrics2, countMetricsByAgent2, updateMetric2, deleteMetric2, createMetricVersion2, getMetricVersions2, getMetricVersion2, getPromptTemplates2, getPromptTemplateById2, upsertPromptTemplate2, deletePromptTemplate2, resetPromptTemplateToDefault2, getPromptTemplateHistory2, resolvePromptTemplate2, checkoutPromptTemplate2, getAllChannelActivityCursors2, getChannelActivityCursor2, upsertChannelActivityCursor2, createApprovalRequest2, getApprovalRequestById2, resolveApprovalRequest2, cancelApprovalRequestById2, cancelPendingApprovalRequestsForRun2, listCancelledApprovalRequestsForRun2, listCancelledApprovalRequestsForStep2, claimApprovalCancellationNotification2, completeApprovalCancellationNotificationClaim2, releaseApprovalCancellationNotificationClaim2, updateApprovalRequestNotifications2, listApprovalRequests2, getStuckApprovalRuns2, getApprovalRequestByStepId2, getExpiredPendingApprovals2, getStaleApprovalRequests2, createWaitState2, getWaitStateById2, getWaitStateByStepId2, getDueWaitStates2, getPendingEventWaitNames2, getPendingWaitsByEvent2, resolveWaitState2, getStuckWaitRuns2, SKILL_FILE_LIMITS2, normalizeSkillFilePath2, createSkill2, updateSkill2, listSkillFileManifest2, getSkillFiles2, getSkillFile2, upsertSkillFile2, upsertSkillFiles2, deleteSkillFile2, deleteSkill2, getSkillById2, getSkillByName2, listSkills2, searchSkills2, installSkill2, getSystemDefaultSkills2, installSystemDefaultSkillsForAgent2, uninstallSkill2, getAgentSkills2, toggleAgentSkill2, createMcpServer2, emitMcpServerConnectedTelemetry2, updateMcpServer2, deleteMcpServer2, getMcpServerById2, getMcpServerByName2, listMcpServers2, installMcpServer2, uninstallMcpServer2, getAgentMcpServers2, createContextSnapshot2, getContextSnapshotsByTaskId2, getContextSnapshotsBySessionId2, getContextSummaryByTaskId2, getAvailableKeyIndices2, recordKeyUsage2, setApiKeyPlan2, markKeyRateLimited2, recordKeyAuthFailure2, recordKeyRateLimitWindows2, setApiKeyName2, clearKeyRateLimit2, getKeyStatuses2, getKeyCostSummary2, getUserById2, getAllUsers2, createUser2, updateUser2, deleteUser2, listInboxState2, upsertInboxState2, listFavorites2, listUserFavorites2, getFavoriteItemIdSet2, setFavorite2, setUserFavorite2, withFavoriteFlags2, listTaskTemplates2, getRootTaskChain2, listRecentSessions2, countSessions2, getBudget2, getBudgets2, upsertBudget2, deleteBudget2, getAllPricingRows2, getPricingRows2, getActivePricingRow2, insertPricingRow2, deletePricingRow2, getDailySpendForAgent2, getDailySpendGlobal2, getDailySpendForUser2, recordBudgetRefusalNotification2, getBudgetRefusalNotification2, getRecentBudgetRefusalNotifications2, hasBudgetRefusalNotificationToday2, setBudgetRefusalFollowUpTaskId2, getLiveAgentCounts2, getReadyAgentCounts2, getInstanceActivity2, getSwarmMetrics2, hasFirstCompletedTask2, getKv2, sweepExpiredKv2, sweepExpiredKvPrefix2, upsertKv2, claimKv2, deleteKv2, KvTypeCollisionError2, incrKv2, kvPrefixUpperBound2, listKv2, countKv2, createScriptRun2, recordInlineScriptRun2, getScriptRun2, getScriptRunByIdempotencyKey2, listScriptRuns2, countScriptRuns2, countActiveScriptRuns2, updateScriptRun2, updateScriptRunIfNotTerminal2, updateScriptRunIfRunning2, getRunningScriptRuns2, getScriptRunJournalStep2, upsertScriptRunJournalStep2, listScriptRunJournalSteps2, countScriptRunJournalSteps2, countScriptRunJournalAgentTaskSteps2, exports_db, init_db4 };
|