@desplega.ai/agent-swarm 2.7.9 → 2.8.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-t949vbbp.js +15 -0
- package/dist/{actions-g563mbn2.js → actions-7e9czc7s.js} +19 -19
- package/dist/{amp-adapter-q61w05eb.js → amp-adapter-gv6cbb7d.js} +2 -3
- package/dist/app-b9fbkp9v.js +20 -0
- package/dist/{assistant-p477rjwj.js → assistant-wjb7v4c7.js} +22 -22
- package/dist/{boot-args-schema-h4qj462e.js → boot-args-schema-2t37e0fe.js} +1 -1
- package/dist/{boot-reembed-n1ehfbsw.js → boot-reembed-a35nkyr1.js} +1 -1
- package/dist/{boot-reembed-qw4mc0pt.js → boot-reembed-gka3zas7.js} +1 -1
- package/dist/{boot-scrub-sweep-9w9jp4sm.js → boot-scrub-sweep-65sdnp6c.js} +3 -3
- package/dist/{boot-seeds-qdaf3sdy.js → boot-seeds-x42tzytw.js} +4 -5
- package/dist/{claude-adapter-348p5hx9.js → claude-adapter-v221b2fd.js} +7 -8
- package/dist/{claude-managed-adapter-h74d06yz.js → claude-managed-adapter-29eq09wd.js} +2 -2
- package/dist/{claude-managed-setup-7787fxtp.js → claude-managed-setup-9m6450zk.js} +2 -2
- package/dist/{claude-sdk-session-hbszbt8a.js → claude-sdk-session-0q0ptaba.js} +9066 -8818
- package/dist/{cli-n5yexkdg.js → cli-0b4zam62.js} +1 -0
- package/dist/{cli-21159vea.js → cli-0jzra9ad.js} +2 -2
- package/dist/{cli-eqtfgfr6.js → cli-2gxeg5gr.js} +1 -1
- package/dist/{cli-k70e3x9e.js → cli-2wnq8jkz.js} +9 -9
- package/dist/{cli-cvs2r2vq.js → cli-2zp0et3v.js} +59 -6
- package/dist/{cli-650zv9q9.js → cli-334z18y3.js} +4 -4
- package/dist/{cli-12xyjhws.js → cli-3rkdne1h.js} +2 -2
- package/dist/{cli-2a8py3sx.js → cli-4txa0ter.js} +5 -7
- package/dist/{cli-jc1g9ndz.js → cli-5j88qqa8.js} +10 -5
- package/dist/{cli-xfjrc279.js → cli-5mrq3ake.js} +48 -14
- package/dist/{cli-v3cf1ts9.js → cli-6t09sdhy.js} +3 -3
- package/dist/{cli-qzt90yze.js → cli-6wxjceza.js} +8 -8
- package/dist/{cli-9aezs55w.js → cli-7b8sbmag.js} +8 -8
- package/dist/{cli-3xj33nrx.js → cli-7cp6aa1q.js} +10 -3
- package/dist/{cli-jfx48xrj.js → cli-7p1kvkck.js} +6 -6
- package/dist/{cli-b932gexn.js → cli-8aes17e4.js} +2 -2
- package/dist/{cli-3tqcamp6.js → cli-8fknbnhw.js} +14 -13
- package/dist/{cli-587857ys.js → cli-8kzasymh.js} +3 -3
- package/dist/{cli-sgs5k6yd.js → cli-a7wvp2km.js} +1 -1
- package/dist/{cli-varqt4d1.js → cli-abejgen1.js} +69 -22
- package/dist/{cli-rwymrnaz.js → cli-bsywb58a.js} +8 -8
- package/dist/{cli-btc9cb4c.js → cli-c55z5chy.js} +4 -6
- package/dist/{cli-ms5m5r1y.js → cli-deefvewm.js} +1 -1
- package/dist/{cli-p17970qv.js → cli-ee0b971j.js} +3 -3
- package/dist/cli-f3vq58d2.js +242 -0
- package/dist/{cli-3xcwp3z8.js → cli-ffhtssbp.js} +2 -2
- package/dist/{cli-hwprv9e4.js → cli-g70vxtjh.js} +2 -2
- package/dist/{cli-4t0fmf3z.js → cli-gxkx0zzp.js} +1 -1
- package/dist/{cli-neyag5p6.js → cli-h38x262p.js} +3365 -429
- package/dist/{cli-2ccpqyyf.js → cli-j790gp2w.js} +105 -22
- package/dist/{cli-f2zenhja.js → cli-kc7v1nfv.js} +1 -1
- package/dist/{cli-vxh6acp7.js → cli-m23zjcy2.js} +10 -10
- package/dist/{cli-y8nbefpb.js → cli-m28atx8q.js} +12 -10
- package/dist/{cli-serm8zrx.js → cli-m4dqmnbp.js} +1 -1
- package/dist/{cli-ybjdc978.js → cli-mrt48bx7.js} +7 -4
- package/dist/{cli-y5rbvxhc.js → cli-n515ex5z.js} +14 -14
- package/dist/{cli-ypff1qwp.js → cli-n9ftpys4.js} +7 -7
- package/dist/{cli-605nn699.js → cli-p1bq50aa.js} +894 -226
- package/dist/{cli-qkdmz8c8.js → cli-p1w18yhx.js} +1 -1
- package/dist/{cli-xk879m3k.js → cli-p2gfst4m.js} +52 -43
- package/dist/{cli-sya22y84.js → cli-pasjcnmj.js} +12 -12
- package/dist/{cli-0whpms1z.js → cli-qa4wdgsy.js} +5 -5
- package/dist/{cli-ejkvvqbe.js → cli-qfedvmcr.js} +50 -24
- package/dist/{cli-tqq0hspb.js → cli-qmqk2yc2.js} +1 -1
- package/dist/{cli-qmd3mse0.js → cli-qsnnd04k.js} +1 -1
- package/dist/{cli-agyaeef4.js → cli-qwca7s44.js} +3 -3
- package/dist/{cli-fayav105.js → cli-rfywm85n.js} +724 -792
- package/dist/{cli-zgv8gxgs.js → cli-rmmpt0wm.js} +6 -6
- package/dist/{cli-hae9j8sv.js → cli-rzsy6nc6.js} +12 -8
- package/dist/{cli-btf6fw39.js → cli-s7t6p9my.js} +1 -1
- package/dist/{cli-cseh6f8w.js → cli-sdtt3men.js} +1 -1
- package/dist/{cli-9r5gtwjr.js → cli-tk7cjj8h.js} +197 -2
- package/dist/{cli-q26b9wre.js → cli-tph5wt3y.js} +4 -4
- package/dist/{cli-gce09r66.js → cli-tqegb8eq.js} +3 -3
- package/dist/{cli-kf3pxxdg.js → cli-v1dv1r37.js} +1 -1
- package/dist/{cli-09kmfkmq.js → cli-wcg8x116.js} +1 -1
- package/dist/{cli-mnrkgg60.js → cli-wk18cm92.js} +5 -5
- package/dist/{cli-p0m0p34z.js → cli-x1wa213s.js} +3 -3
- package/dist/{cli-jrp1dt73.js → cli-xzm9vcfg.js} +1 -1
- package/dist/{cli-715t1gx6.js → cli-y97qxcfx.js} +9 -9
- package/dist/{cli-bc779n4v.js → cli-yq3zak69.js} +1 -1
- package/dist/cli.js +17 -17
- package/dist/{codex-adapter-ysq6bzha.js → codex-adapter-30j9bpzd.js} +5 -6
- package/dist/{codex-hook-fac6175r.js → codex-hook-h3vk6xzr.js} +1 -1
- package/dist/{codex-session-runner-qakzfx93.js → codex-session-runner-8vp57v8w.js} +5 -6
- package/dist/{commands-rs7hkv9r.js → commands-bngnz9g7.js} +3 -3
- package/dist/{controller-r5x9bg6e.js → controller-hxx8wwy1.js} +2 -2
- package/dist/{controllers-connect-498hrxvk.js → controllers-connect-e2b4gyxc.js} +20 -20
- package/dist/{cursor-adapter-d46qszer.js → cursor-adapter-n5nc3mfe.js} +1 -2
- package/dist/{db-s13dqhr6.js → db-bgm7vkc0.js} +3 -3
- package/dist/{db-pm96nhdb.js → db-c6np41ca.js} +12 -2
- package/dist/{devin-adapter-z46ep5ph.js → devin-adapter-xedz98zv.js} +1 -1
- package/dist/{dispatcher-j3h81t7m.js → dispatcher-jnybck15.js} +18 -18
- package/dist/{dsh-adapter-rw0d5rc4.js → dsh-adapter-nrhbrjz8.js} +1 -2
- package/dist/{easter-egg-3d-qtgfxgze.js → easter-egg-3d-533knw22.js} +1 -1
- package/dist/{embedding-space-xh8p4q4x.js → embedding-space-crsm2zp0.js} +6 -6
- package/dist/{embeddings-wp745m91.js → embeddings-e7z3f27f.js} +1 -1
- package/dist/{execute-2fzb9z74.js → execute-b3mrb1mv.js} +1 -1
- package/dist/{external-channel-ys21h3sy.js → external-channel-m77wf5z3.js} +2 -2
- package/dist/{fx-adapter-vz0b9z3g.js → fx-adapter-b6w0kf56.js} +7 -8
- package/dist/{google-generative-ai-ytpgncx9.js → google-generative-ai-h7s3e9kk.js} +1 -1
- package/dist/{google-vertex-tqhze5j7.js → google-vertex-fhxaafzw.js} +1 -1
- package/dist/{grok-adapter-spea7zkj.js → grok-adapter-4sqtebdk.js} +7 -8
- package/dist/handlers-kdjcyzdj.js +32 -0
- package/dist/heartbeat-xgb036sx.js +43 -0
- package/dist/{hook-amcj4s10.js → hook-5h02c9ga.js} +6 -6
- package/dist/{hook-bc6n49qn.js → hook-xsk1jbha.js} +5 -5
- package/dist/{http-7374brv5.js → http-txe7qhvn.js} +448 -165
- package/dist/{index-pxn30mse.js → index-0eny15vj.js} +8 -8
- package/dist/{index-5a9jtqde.js → index-0rvk3vd4.js} +46 -46
- package/dist/{index-fvzke5kx.js → index-1qw6f2dc.js} +10 -10
- package/dist/{index-q5cmtbz5.js → index-4a0670yh.js} +15939 -14244
- package/dist/index-835xdgnm.js +33 -0
- package/dist/index-d469300x.js +37 -0
- package/dist/{index-h7f61sy9.js → index-e5pfbsys.js} +3 -3
- package/dist/{index-hsad2t3r.js → index-m5gx1xd6.js} +38 -38
- package/dist/{index-5fx3b3kw.js → index-rvccek1w.js} +9 -9
- package/dist/index-rzqwp11g.js +32 -0
- package/dist/{index-w4m9z29z.js → index-tvfafeyy.js} +1 -1
- package/dist/{index-c9y31ytf.js → index-vk63emp7.js} +979 -35
- package/dist/{index-514d9pf6.js → index-w7em4ktq.js} +8 -8
- package/dist/{index-p4hjwbvw.js → index-ysvbhg5m.js} +1 -1
- package/dist/{keepalive-wy29kbrg.js → keepalive-4zsrce78.js} +3 -3
- package/dist/lead-yqt47dkr.js +70 -0
- package/dist/{maintenance-h2ds9w6c.js → maintenance-86jvartk.js} +1 -1
- package/dist/{oauth-refresh-sweep-q7mtbyp3.js → oauth-refresh-sweep-j52kg9pr.js} +2 -2
- package/dist/{onboard-vw8r2fdw.js → onboard-c2aj5p8q.js} +3 -3
- package/dist/{opencode-adapter-mtb0953j.js → opencode-adapter-dsagkhtw.js} +5 -6
- package/dist/{otel-impl-j42czw3r.js → otel-impl-yyy203z8.js} +1 -1
- package/dist/{pi-mono-adapter-zk8pg9jr.js → pi-mono-adapter-546cd1cc.js} +9 -9
- package/dist/{pricing-refresh-x7nhv23d.js → pricing-refresh-1rgzqyzz.js} +2 -3
- package/dist/{rbac-roles-9044425x.js → rbac-roles-e70xfeyj.js} +4 -6
- package/dist/{rbac-roles-bzvee6cf.js → rbac-roles-q89qe8er.js} +3 -3
- package/dist/{registry-hpjfmcfz.js → registry-32b1mft6.js} +1 -1
- package/dist/{render-v2-t7bn4skz.js → render-v2-k6tt107q.js} +9 -4
- package/dist/{resume-x94gemep.js → resume-cnnrjfxa.js} +6 -6
- package/dist/{runtime-breq6fmv.js → runtime-1hv06jsn.js} +1 -1
- package/dist/{session-access-q7dmqjvt.js → session-access-xkxkjw3n.js} +4 -4
- package/dist/{session-source-backfill-440ysamr.js → session-source-backfill-1d5pdwww.js} +2 -2
- package/dist/{setup-07n4727s.js → setup-se8q7gkc.js} +1 -1
- package/dist/{virtual-modules-z5h6mcyf.js → virtual-modules-gazyapte.js} +3 -3
- package/dist/{work-objects-pnq5y534.js → work-objects-1kxnbzy5.js} +22 -22
- package/dist/{worker-follow-up-7z1gfkr8.js → worker-follow-up-zqm8apt4.js} +18 -18
- package/dist/worker-j6xxtq7p.js +70 -0
- package/openapi.json +334 -7
- package/package.json +4 -4
- package/src/apps/catalog.generated.json +55 -0
- package/src/apps/definition.ts +11 -0
- package/src/apps/page-validator.ts +19 -0
- package/src/apps/store.ts +28 -8
- package/src/assets/key.ts +77 -4
- package/src/be/db/model-profiles.ts +147 -38
- package/src/be/db/session-labels.ts +57 -0
- package/src/be/db/session-tree.ts +51 -7
- package/src/be/db/slack-trees.ts +146 -0
- package/src/be/db/tasks/read.ts +107 -8
- package/src/be/db/workflow-run-definitions.ts +117 -0
- package/src/be/db-client.ts +8 -2
- package/src/be/db.ts +119 -87
- package/src/be/event-loop-lag.ts +146 -0
- package/src/be/mcp-overflow-sweep.ts +2 -1
- package/src/be/memory/constants.ts +14 -1
- package/src/be/memory/key-paths.ts +8 -0
- package/src/be/memory/providers/sqlite-store.ts +199 -18
- package/src/be/memory/task-learning.ts +79 -14
- package/src/be/memory/types.ts +24 -1
- package/src/be/migrations/278_slack_render_v2_reconcile.sql +108 -0
- package/src/be/migrations/279_backfill_learning_expiry.sql +15 -0
- package/src/be/migrations/281_model_profiles_pr2.sql +28 -0
- package/src/be/migrations/283_workflow_run_definitions.sql +14 -0
- package/src/be/model-profile-check.ts +284 -0
- package/src/be/model-tier-resolution.ts +112 -12
- package/src/be/multi-runtime.ts +27 -0
- package/src/be/runtime-pools/routing.ts +52 -4
- package/src/be/scripts/typecheck.ts +1 -0
- package/src/be/seed-scripts/catalog/dreaming-learnings.ts +552 -0
- package/src/be/seed-scripts/catalog/dreaming-memtax-create.ts +389 -14
- package/src/be/seed-scripts/catalog/dreaming-memtax.ts +6 -3
- package/src/be/seed-scripts/index.ts +9 -0
- package/src/be/steering.ts +8 -2
- package/src/be/swarm-config-guard.ts +2 -0
- package/src/commands/context-preamble.ts +258 -0
- package/src/commands/onboard/agent-fs-version.ts +1 -1
- package/src/commands/runner.ts +32 -1
- package/src/extensions/catalog.generated.json +3 -3
- package/src/fs/provider.ts +17 -3
- package/src/heartbeat/heartbeat.ts +17 -5
- package/src/heartbeat/index.ts +1 -0
- package/src/http/agents.ts +56 -4
- package/src/http/apps.ts +3 -1
- package/src/http/config.ts +2 -6
- package/src/http/core.ts +9 -3
- package/src/http/index.ts +12 -9
- package/src/http/memory.ts +9 -4
- package/src/http/model-profiles.ts +58 -10
- package/src/http/poll.ts +36 -3
- package/src/http/schedules.ts +42 -3
- package/src/http/sessions.ts +16 -3
- package/src/http/tasks.ts +37 -12
- package/src/http/utils.ts +18 -0
- package/src/http/webhooks.ts +48 -0
- package/src/http/workflows.ts +15 -2
- package/src/integrations/chat-sdk/commands.ts +167 -31
- package/src/integrations/chat-sdk/inbound.ts +10 -8
- package/src/integrations/chat-sdk/message-text.ts +117 -0
- package/src/prompts/session-templates.ts +1 -1
- package/src/providers/acp-targets.ts +11 -6
- package/src/providers/amp-adapter.ts +1 -1
- package/src/providers/claude-sdk-session.ts +132 -23
- package/src/providers/codex-skill-resolver.ts +10 -4
- package/src/providers/cursor-adapter.ts +1 -1
- package/src/providers/devin-skill-resolver.ts +5 -5
- package/src/providers/dsh-adapter.ts +1 -1
- package/src/scheduler/schedule-task.ts +1 -0
- package/src/scheduler/scheduler.ts +4 -1
- package/src/scripts-runtime/executors/quickjs-runner.ts +2 -0
- package/src/scripts-runtime/executors/quickjs-structured-clone.ts +180 -0
- package/src/scripts-runtime/quickjs-compat.ts +0 -1
- package/src/scripts-runtime/sdk-allowlist.ts +1 -0
- package/src/scripts-runtime/swarm-sdk.ts +18 -1
- package/src/scripts-runtime/types/stdlib.d.ts +1 -0
- package/src/scripts-runtime/types/swarm-sdk.d.ts +1 -0
- package/src/server.ts +2 -0
- package/src/slack/app.ts +425 -10
- package/src/slack/handlers.ts +9 -2
- package/src/slack/inbound-dispatch.ts +18 -1
- package/src/slack/index.ts +7 -1
- package/src/slack/lifecycle-lock.ts +29 -0
- package/src/slack/render-v2.ts +424 -212
- package/src/slack/socket-fence.ts +64 -0
- package/src/slack/watcher.ts +42 -8
- package/src/slack/workspace-guard.ts +345 -0
- package/src/tasks/task-terminal-effects.ts +4 -0
- package/src/tasks/worker-follow-up.ts +102 -2
- package/src/tests/acp-adapter.test.ts +82 -0
- package/src/tests/apps-icon.test.ts +120 -0
- package/src/tests/apps-schema-form.test.ts +151 -0
- package/src/tests/chained-task-follow-up.test.ts +248 -0
- package/src/tests/chat-sdk-commands.test.ts +359 -2
- package/src/tests/chat-sdk-inbound.test.ts +20 -0
- package/src/tests/chat-sdk-slack.test.ts +189 -1
- package/src/tests/check-pr-body.test.ts +40 -0
- package/src/tests/claude-sdk-lifecycle.test.ts +216 -1
- package/src/tests/claude-sdk-process.fixture.ts +57 -0
- package/src/tests/codex-skill-resolver.test.ts +31 -0
- package/src/tests/credentials-allowlist.test.ts +470 -0
- package/src/tests/db-client-busy-retry.test.ts +69 -18
- package/src/tests/db-client.test.ts +26 -1
- package/src/tests/db-task-read-contract.test.ts +7 -0
- package/src/tests/db-task-write-contract.test.ts +6 -0
- package/src/tests/deferred-wake-follow-up.test.ts +47 -0
- package/src/tests/docs-index-footprint.test.js +3 -3
- package/src/tests/dreaming-learnings.test.ts +1395 -0
- package/src/tests/dsh-adapter.test.ts +1 -1
- package/src/tests/event-loop-lag.test.ts +184 -0
- package/src/tests/explicit-model-validation.test.ts +2 -0
- package/src/tests/extensions-example-comms-adherence-gate.test.ts +115 -0
- package/src/tests/fs-provider.test.ts +42 -0
- package/src/tests/github-webhook-early-ack.test.ts +144 -0
- package/src/tests/heartbeat.test.ts +28 -1
- package/src/tests/http-api-integration.test.ts +2 -0
- package/src/tests/http-log-scrubbing.test.ts +68 -2
- package/src/tests/human-free-reclassify.test.ts +5 -1
- package/src/tests/kv-storage.test.ts +92 -1
- package/src/tests/list-endpoint-slimming.test.ts +17 -0
- package/src/tests/memory-key-paths.test.ts +57 -0
- package/src/tests/memory-retrieval-purge.test.ts +19 -0
- package/src/tests/migration-283-workflow-run-definitions.test.ts +69 -0
- package/src/tests/model-profile-check.test.ts +387 -0
- package/src/tests/model-profiles-api.test.ts +528 -1
- package/src/tests/profile-claim.test.ts +415 -3
- package/src/tests/profile-tier-alias.test.ts +382 -0
- package/src/tests/quickjs-compat.test.ts +1 -1
- package/src/tests/runner-context-preamble.test.ts +552 -0
- package/src/tests/schedule-profile.test.ts +359 -0
- package/src/tests/script-connections.test.ts +9 -0
- package/src/tests/script-executor-conformance.test.ts +188 -0
- package/src/tests/script-per-script-executor.test.ts +1 -0
- package/src/tests/scripts-sdk-bridge-tool-failure.test.ts +141 -0
- package/src/tests/seed-scripts.test.ts +2 -2
- package/src/tests/sessions-tree.test.ts +133 -2
- package/src/tests/slack-app-icon.test.ts +4 -0
- package/src/tests/slack-dm-implicit-mention.test.ts +236 -0
- package/src/tests/slack-file-tools-attachments.test.ts +1 -0
- package/src/tests/slack-inbound-receipts.test.ts +22 -2
- package/src/tests/slack-read-boundaries.test.ts +4 -3
- package/src/tests/slack-render-v2-query-plans.test.ts +262 -3
- package/src/tests/slack-render-v2-reconcile.test.ts +201 -0
- package/src/tests/slack-socket-ack.test.ts +16 -1
- package/src/tests/slack-socket-watchdog.test.ts +748 -0
- package/src/tests/slack-workspace-guard.test.ts +905 -0
- package/src/tests/steering-core.test.ts +40 -0
- package/src/tests/store-progress-learning.test.ts +605 -20
- package/src/tests/tool-annotations.test.ts +1 -1
- package/src/tests/vcs-identity-inheritance.test.ts +85 -0
- package/src/tests/workflow-convergence.test.ts +46 -40
- package/src/tests/workflow-definition-pinning-recovery.test.ts +552 -0
- package/src/tests/workflow-definition-pinning.test.ts +645 -0
- package/src/tests/workflow-executors.test.ts +16 -7
- package/src/tests/workflow-foreach.test.ts +43 -20
- package/src/tests/workflow-notify-slack-ready.test.ts +161 -0
- package/src/tests/workflow-profile.test.ts +328 -0
- package/src/tools/app-upsert.ts +1 -1
- package/src/tools/memory-edit.ts +2 -1
- package/src/tools/model-profiles/check-model-profile.ts +63 -0
- package/src/tools/schedules/create-schedule.ts +45 -4
- package/src/tools/schedules/patch-schedule.ts +50 -4
- package/src/tools/schedules/update-schedule.ts +50 -4
- package/src/tools/send-task.ts +17 -2
- package/src/tools/store-progress.ts +15 -3
- package/src/tools/task-action.ts +9 -1
- package/src/tools/templates.ts +13 -0
- package/src/tools/tool-config.ts +2 -1
- package/src/tools/utils.ts +77 -11
- package/src/tools/workflows/create-workflow.ts +1 -1
- package/src/tools/workflows/retry-workflow-run.ts +1 -1
- package/src/tools/workflows/update-workflow.ts +10 -1
- package/src/types.ts +56 -1
- package/src/utils/credentials.ts +89 -12
- package/src/workflows/engine.ts +10 -1
- package/src/workflows/executors/agent-task.ts +21 -2
- package/src/workflows/executors/foreach.ts +4 -1
- package/src/workflows/executors/notify.ts +62 -6
- package/src/workflows/executors/sub-workflow.ts +1 -1
- package/src/workflows/executors/swarm-script.ts +4 -1
- package/src/workflows/foreach-driver.ts +8 -5
- package/src/workflows/limits.ts +2 -1
- package/src/workflows/model-validation.ts +27 -2
- package/src/workflows/patch-definition.ts +3 -1
- package/src/workflows/recovery.ts +6 -6
- package/src/workflows/resume.ts +9 -9
- package/src/workflows/retry-poller.ts +2 -2
- package/templates/extensions/comms-adherence-gate/README.md +25 -0
- package/templates/extensions/comms-adherence-gate/hooks.ts +100 -11
- package/templates/extensions/comms-adherence-gate/manifest.json +1 -1
- package/templates/skills/apps/SKILL.md +9 -0
- package/templates/skills/apps/content.md +9 -0
- package/templates/skills/code-quality/content.md +12 -0
- package/templates/skills/memory/content.md +8 -0
- package/templates/skills/scheduling/config.json +1 -1
- package/templates/skills/scheduling/content.md +2 -2
- package/templates/skills/swarm-docs/content.md +4 -0
- package/templates/skills/swarm-extensions/content.md +1 -1
- package/templates/skills/swarm-scripts/SKILL.md +1 -1
- package/templates/skills/swarm-scripts/content.md +1 -1
- package/templates/skills/work-on-task/SKILL.md +2 -0
- package/templates/skills/work-on-task/content.md +2 -0
- package/templates/workflows/dreaming/content.md +174 -7
- package/dist/acp-adapter-dn4gdsgr.js +0 -16
- package/dist/app-a66ssc4k.js +0 -17
- package/dist/cli-530hkwdy.js +0 -779
- package/dist/cli-a0657jmf.js +0 -339
- package/dist/cli-cyn9v8zr.js +0 -748
- package/dist/handlers-crckt5dq.js +0 -32
- package/dist/heartbeat-8phn1kdq.js +0 -41
- package/dist/index-4x08sjtk.js +0 -30
- package/dist/index-8ybffts4.js +0 -37
- package/dist/index-nfy4kkg5.js +0 -33
- package/dist/lead-zdqxsvjn.js +0 -71
- package/dist/worker-y62rvvq3.js +0 -71
- package/dist/{cli-gxy8y1dt.js → cli-8bpgbr8k.js} +3 -3
|
@@ -52,6 +52,10 @@ import {
|
|
|
52
52
|
decryptSecret,
|
|
53
53
|
getEncryptionKey,
|
|
54
54
|
init_crypto,
|
|
55
|
+
withLoopPath,
|
|
56
|
+
startEventLoopLagProbe,
|
|
57
|
+
stopEventLoopLagProbe,
|
|
58
|
+
init_event_loop_lag,
|
|
55
59
|
getPromptTemplateDefaultDrift,
|
|
56
60
|
init_default_drift,
|
|
57
61
|
init_templates2,
|
|
@@ -60,6 +64,13 @@ import {
|
|
|
60
64
|
closeDb2,
|
|
61
65
|
getDbClient2,
|
|
62
66
|
init_runtime2,
|
|
67
|
+
isRbacEnabled,
|
|
68
|
+
decideToolAdmission,
|
|
69
|
+
LEGACY_RULES,
|
|
70
|
+
setAuditSink,
|
|
71
|
+
clearAuditSink,
|
|
72
|
+
can,
|
|
73
|
+
init_rbac,
|
|
63
74
|
CHAT_SDK_ADAPTER_NAMES,
|
|
64
75
|
isAdapterEntryEnabled,
|
|
65
76
|
init_schema,
|
|
@@ -130,6 +141,35 @@ import {
|
|
|
130
141
|
recordApprovalVotes2,
|
|
131
142
|
getPendingApprovalsForTasks2,
|
|
132
143
|
computeContentHash2,
|
|
144
|
+
taskModelPin,
|
|
145
|
+
init_model_pin,
|
|
146
|
+
normalizeModelKey,
|
|
147
|
+
init_pricing_normalize,
|
|
148
|
+
upsertModelCatalogOverlay,
|
|
149
|
+
deleteModelCatalogOverlay,
|
|
150
|
+
loadModelsCatalog,
|
|
151
|
+
init_model_catalog_store,
|
|
152
|
+
listHarnessModelSupport,
|
|
153
|
+
recordHarnessModelSupport,
|
|
154
|
+
agentRanModel,
|
|
155
|
+
getAgentHarnessCliVersion,
|
|
156
|
+
setAgentHarnessCliVersion,
|
|
157
|
+
init_harness_model_support,
|
|
158
|
+
sanitizeModelTierOverrides,
|
|
159
|
+
parseModelTierOverridesHeader,
|
|
160
|
+
setAgentModelTierOverrides,
|
|
161
|
+
previewModelTiers,
|
|
162
|
+
recordClaimModelResolution,
|
|
163
|
+
init_model_tier_resolution,
|
|
164
|
+
harnessModelErrorFor,
|
|
165
|
+
poolTaskRunsOnHarness,
|
|
166
|
+
explicitModelError,
|
|
167
|
+
explicitModelErrorForAgent,
|
|
168
|
+
init_model_validation2,
|
|
169
|
+
runtimeReadsRepoSecrets,
|
|
170
|
+
checkProfileForAgent,
|
|
171
|
+
formatProfileCheckFailures,
|
|
172
|
+
init_model_profile_check,
|
|
133
173
|
startTaskSearchBackfill,
|
|
134
174
|
stopTaskSearchBackfill,
|
|
135
175
|
init_search_index,
|
|
@@ -144,6 +184,7 @@ import {
|
|
|
144
184
|
getLatestScriptRunStepTaskByContextKey2,
|
|
145
185
|
init_read,
|
|
146
186
|
MODEL_PROFILE_CONFIG_KEY,
|
|
187
|
+
hasUnreadableCredentialAllowlist,
|
|
147
188
|
listModelProfiles,
|
|
148
189
|
getModelProfileByName,
|
|
149
190
|
createModelProfile,
|
|
@@ -152,6 +193,7 @@ import {
|
|
|
152
193
|
modelProfileRefError,
|
|
153
194
|
deleteModelProfile,
|
|
154
195
|
taskProfileError,
|
|
196
|
+
scheduleProfileUpdate,
|
|
155
197
|
init_model_profiles,
|
|
156
198
|
AssetKeyMovesBlockedError2,
|
|
157
199
|
assertAssetKeyMovesAllowed2,
|
|
@@ -480,7 +522,7 @@ import {
|
|
|
480
522
|
countScriptRunJournalSteps2,
|
|
481
523
|
countScriptRunJournalAgentTaskSteps2,
|
|
482
524
|
init_db4
|
|
483
|
-
} from "./cli-
|
|
525
|
+
} from "./cli-h38x262p.js";
|
|
484
526
|
import {
|
|
485
527
|
PRIMARY_ROLE_NAMES2,
|
|
486
528
|
OperatorGrantedTargetError2,
|
|
@@ -494,21 +536,17 @@ import {
|
|
|
494
536
|
assertNotLastAdmin2,
|
|
495
537
|
setUserRoles2,
|
|
496
538
|
init_rbac_roles
|
|
497
|
-
} from "./cli-
|
|
498
|
-
import"./cli-
|
|
539
|
+
} from "./cli-c55z5chy.js";
|
|
540
|
+
import"./cli-4txa0ter.js";
|
|
499
541
|
import {
|
|
500
|
-
upsertModelCatalogOverlay,
|
|
501
|
-
deleteModelCatalogOverlay,
|
|
502
|
-
loadModelsCatalog,
|
|
503
|
-
init_model_catalog_store,
|
|
504
542
|
requestModelCatalogRefresh2,
|
|
505
543
|
init_pricing_refresh
|
|
506
|
-
} from "./cli-
|
|
544
|
+
} from "./cli-f3vq58d2.js";
|
|
507
545
|
import {
|
|
508
546
|
workflowEventBus2,
|
|
509
547
|
init_event_bus
|
|
510
548
|
} from "./cli-eddnyg3t.js";
|
|
511
|
-
import"./cli-
|
|
549
|
+
import"./cli-qsnnd04k.js";
|
|
512
550
|
import {
|
|
513
551
|
require_dist4,
|
|
514
552
|
getSlackConnectionState,
|
|
@@ -539,12 +577,12 @@ import {
|
|
|
539
577
|
startSlackApp2,
|
|
540
578
|
stopSlackApp2,
|
|
541
579
|
init_app3
|
|
542
|
-
} from "./cli-
|
|
580
|
+
} from "./cli-p1bq50aa.js";
|
|
543
581
|
import {
|
|
544
582
|
retryFailedRun2,
|
|
545
583
|
cancelWorkflowRun2,
|
|
546
584
|
init_resume
|
|
547
|
-
} from "./cli-
|
|
585
|
+
} from "./cli-pasjcnmj.js";
|
|
548
586
|
import {
|
|
549
587
|
DEFAULT_NEGOTIATED_PROTOCOL_VERSION,
|
|
550
588
|
SUPPORTED_PROTOCOL_VERSIONS,
|
|
@@ -571,25 +609,6 @@ import {
|
|
|
571
609
|
scopeFromAttachment,
|
|
572
610
|
backingProviderId,
|
|
573
611
|
init_task_attachment_store,
|
|
574
|
-
taskModelPin,
|
|
575
|
-
init_model_pin,
|
|
576
|
-
listHarnessModelSupport,
|
|
577
|
-
recordHarnessModelSupport,
|
|
578
|
-
agentRanModel,
|
|
579
|
-
getAgentHarnessCliVersion,
|
|
580
|
-
setAgentHarnessCliVersion,
|
|
581
|
-
init_harness_model_support,
|
|
582
|
-
sanitizeModelTierOverrides,
|
|
583
|
-
parseModelTierOverridesHeader,
|
|
584
|
-
setAgentModelTierOverrides,
|
|
585
|
-
previewModelTiers,
|
|
586
|
-
recordClaimModelResolution,
|
|
587
|
-
init_model_tier_resolution,
|
|
588
|
-
harnessModelErrorFor,
|
|
589
|
-
poolTaskRunsOnHarness,
|
|
590
|
-
explicitModelError,
|
|
591
|
-
explicitModelErrorForAgent,
|
|
592
|
-
init_model_validation,
|
|
593
612
|
stripSiblingBlock,
|
|
594
613
|
init_sibling_block,
|
|
595
614
|
createTaskWithSiblingAwareness,
|
|
@@ -744,6 +763,7 @@ import {
|
|
|
744
763
|
init_teams_origin,
|
|
745
764
|
getSessionLabels,
|
|
746
765
|
rememberSessionLabel,
|
|
766
|
+
getResourceSessionLabels,
|
|
747
767
|
init_session_labels,
|
|
748
768
|
isChatSdkStopping,
|
|
749
769
|
startChatSdk,
|
|
@@ -966,7 +986,7 @@ import {
|
|
|
966
986
|
emitBudgetRefusalSideEffects,
|
|
967
987
|
init_budget_refusal_notify,
|
|
968
988
|
workflowModelErrors,
|
|
969
|
-
|
|
989
|
+
init_model_validation,
|
|
970
990
|
patchWorkflowDefinition,
|
|
971
991
|
init_patch_definition,
|
|
972
992
|
idempotencyKeyHeader,
|
|
@@ -980,7 +1000,7 @@ import {
|
|
|
980
1000
|
getEnabledCapabilities,
|
|
981
1001
|
createServer,
|
|
982
1002
|
init_server
|
|
983
|
-
} from "./cli-
|
|
1003
|
+
} from "./cli-rfywm85n.js";
|
|
984
1004
|
import {
|
|
985
1005
|
FilesError,
|
|
986
1006
|
normalizeFilesError,
|
|
@@ -990,7 +1010,8 @@ import {
|
|
|
990
1010
|
init_agent_fs_provider,
|
|
991
1011
|
getFileStorageProvider2,
|
|
992
1012
|
init_registry2
|
|
993
|
-
} from "./cli-
|
|
1013
|
+
} from "./cli-7cp6aa1q.js";
|
|
1014
|
+
import"./cli-n9ftpys4.js";
|
|
994
1015
|
import {
|
|
995
1016
|
RuntimePoolError2,
|
|
996
1017
|
mintControllerToken,
|
|
@@ -1012,7 +1033,7 @@ import {
|
|
|
1012
1033
|
resolvePoolDelivery2,
|
|
1013
1034
|
createPoolAgent2,
|
|
1014
1035
|
init_db2
|
|
1015
|
-
} from "./cli-
|
|
1036
|
+
} from "./cli-8kzasymh.js";
|
|
1016
1037
|
import {
|
|
1017
1038
|
duplicateGuardedQueryKey,
|
|
1018
1039
|
warnIfCorsAllowsAnyOrigin,
|
|
@@ -1023,6 +1044,7 @@ import {
|
|
|
1023
1044
|
getPathSegments,
|
|
1024
1045
|
wireHttpSpanLifecycle,
|
|
1025
1046
|
redactShareTokenInPath,
|
|
1047
|
+
loopPathForRequest,
|
|
1026
1048
|
safeRequestUrlForLog,
|
|
1027
1049
|
agentWithCapacity,
|
|
1028
1050
|
RequestBodyTooLargeError,
|
|
@@ -1068,7 +1090,7 @@ import {
|
|
|
1068
1090
|
describeRequestRoute,
|
|
1069
1091
|
route,
|
|
1070
1092
|
init_route_def
|
|
1071
|
-
} from "./cli-
|
|
1093
|
+
} from "./cli-m28atx8q.js";
|
|
1072
1094
|
import {
|
|
1073
1095
|
startPoolRouting,
|
|
1074
1096
|
stopPoolRouting,
|
|
@@ -1081,17 +1103,17 @@ import {
|
|
|
1081
1103
|
checkHeartbeatChecklist2,
|
|
1082
1104
|
runHeartbeatSweep2,
|
|
1083
1105
|
stopHeartbeat2
|
|
1084
|
-
} from "./cli-
|
|
1085
|
-
import"./cli-
|
|
1106
|
+
} from "./cli-abejgen1.js";
|
|
1107
|
+
import"./cli-m4dqmnbp.js";
|
|
1086
1108
|
import {
|
|
1087
1109
|
runtimeSupervisorStatus,
|
|
1088
1110
|
startRuntimeSupervisor,
|
|
1089
1111
|
stopRuntimeSupervisor
|
|
1090
|
-
} from "./cli-
|
|
1112
|
+
} from "./cli-6wxjceza.js";
|
|
1091
1113
|
import {
|
|
1092
1114
|
TASK_TITLE_TIMEOUT_MS,
|
|
1093
1115
|
generateTaskTitle
|
|
1094
|
-
} from "./cli-
|
|
1116
|
+
} from "./cli-8aes17e4.js";
|
|
1095
1117
|
import"./cli-ns59dc6r.js";
|
|
1096
1118
|
import {
|
|
1097
1119
|
ACP_TARGET_IDS
|
|
@@ -1102,7 +1124,7 @@ import {
|
|
|
1102
1124
|
} from "./cli-jrzkw01m.js";
|
|
1103
1125
|
import {
|
|
1104
1126
|
MAX_RATE_LIMIT_RESET_MS
|
|
1105
|
-
} from "./cli-
|
|
1127
|
+
} from "./cli-kc7v1nfv.js";
|
|
1106
1128
|
import {
|
|
1107
1129
|
isLeadChannelMonitoringEnabled,
|
|
1108
1130
|
ORG_IDENTITY_KEYS,
|
|
@@ -1112,11 +1134,11 @@ import {
|
|
|
1112
1134
|
isUnknownModelError,
|
|
1113
1135
|
checkProviderPoolKey,
|
|
1114
1136
|
writeSkillsToFilesystem
|
|
1115
|
-
} from "./cli-
|
|
1137
|
+
} from "./cli-ee0b971j.js";
|
|
1116
1138
|
import {
|
|
1117
1139
|
inviteEmailToSharedOrg,
|
|
1118
1140
|
ensureAgentFsCredentialsForAgent
|
|
1119
|
-
} from "./cli-
|
|
1141
|
+
} from "./cli-qwca7s44.js";
|
|
1120
1142
|
import {
|
|
1121
1143
|
Anthropic
|
|
1122
1144
|
} from "./cli-t73cas91.js";
|
|
@@ -1127,22 +1149,12 @@ import {
|
|
|
1127
1149
|
resolveClaudeTransport,
|
|
1128
1150
|
isClaudeBridgeEffective
|
|
1129
1151
|
} from "./cli-9fzgd3hg.js";
|
|
1130
|
-
import {
|
|
1131
|
-
AMP_ESTIMATE_MODELS,
|
|
1132
|
-
ampBillsCacheWrites,
|
|
1133
|
-
resolveAmpModel,
|
|
1134
|
-
init_amp_models
|
|
1135
|
-
} from "./cli-qkdmz8c8.js";
|
|
1136
1152
|
import {
|
|
1137
1153
|
RATING_MODEL_MAX_LENGTH,
|
|
1138
1154
|
REFERENCES_SOURCE_MAX_LENGTH,
|
|
1139
1155
|
sanitizeReferencesSource,
|
|
1140
1156
|
init_types2
|
|
1141
1157
|
} from "./cli-2xv18ywz.js";
|
|
1142
|
-
import {
|
|
1143
|
-
normalizeModelKey,
|
|
1144
|
-
init_pricing_normalize
|
|
1145
|
-
} from "./cli-a0657jmf.js";
|
|
1146
1158
|
import {
|
|
1147
1159
|
require_dist2,
|
|
1148
1160
|
getMcpOAuthToken,
|
|
@@ -1231,7 +1243,7 @@ import {
|
|
|
1231
1243
|
init_typecheck,
|
|
1232
1244
|
parseSkillContent,
|
|
1233
1245
|
init_skill_parser
|
|
1234
|
-
} from "./cli-
|
|
1246
|
+
} from "./cli-j790gp2w.js";
|
|
1235
1247
|
import {
|
|
1236
1248
|
signalProcessGroup,
|
|
1237
1249
|
detachedProcessGroup,
|
|
@@ -1248,7 +1260,7 @@ import {
|
|
|
1248
1260
|
forceRefreshAuthorizationOrThrow,
|
|
1249
1261
|
forceRefreshTokenOrThrow,
|
|
1250
1262
|
init_ensure_token
|
|
1251
|
-
} from "./cli-
|
|
1263
|
+
} from "./cli-sdtt3men.js";
|
|
1252
1264
|
import {
|
|
1253
1265
|
automationIntegrationFixUrl,
|
|
1254
1266
|
preflightAutomation,
|
|
@@ -1292,7 +1304,7 @@ import {
|
|
|
1292
1304
|
definitionNodeIds,
|
|
1293
1305
|
validateDefinition,
|
|
1294
1306
|
init_definition2
|
|
1295
|
-
} from "./cli-
|
|
1307
|
+
} from "./cli-qfedvmcr.js";
|
|
1296
1308
|
import {
|
|
1297
1309
|
_fetchHolder,
|
|
1298
1310
|
CLIENT_ID,
|
|
@@ -1316,7 +1328,7 @@ import {
|
|
|
1316
1328
|
import {
|
|
1317
1329
|
require_content_type
|
|
1318
1330
|
} from "./cli-yjdgea32.js";
|
|
1319
|
-
import"./cli-
|
|
1331
|
+
import"./cli-a7wvp2km.js";
|
|
1320
1332
|
import {
|
|
1321
1333
|
isInvalidClientError,
|
|
1322
1334
|
publicEndpointSsrfOptions,
|
|
@@ -1334,7 +1346,7 @@ import {
|
|
|
1334
1346
|
revokeMcpToken,
|
|
1335
1347
|
computeExpiresAt,
|
|
1336
1348
|
init_mcp_wrapper
|
|
1337
|
-
} from "./cli-
|
|
1349
|
+
} from "./cli-s7t6p9my.js";
|
|
1338
1350
|
import {
|
|
1339
1351
|
createRuntimeProvider,
|
|
1340
1352
|
init_runtime_providers
|
|
@@ -1349,15 +1361,6 @@ import {
|
|
|
1349
1361
|
import_websocket_server,
|
|
1350
1362
|
init_wrapper2
|
|
1351
1363
|
} from "./cli-69szn7w7.js";
|
|
1352
|
-
import {
|
|
1353
|
-
isRbacEnabled,
|
|
1354
|
-
decideToolAdmission,
|
|
1355
|
-
LEGACY_RULES,
|
|
1356
|
-
setAuditSink,
|
|
1357
|
-
clearAuditSink,
|
|
1358
|
-
can,
|
|
1359
|
-
init_rbac
|
|
1360
|
-
} from "./cli-cyn9v8zr.js";
|
|
1361
1364
|
import {
|
|
1362
1365
|
registerSessionTokenConnection,
|
|
1363
1366
|
init_session_token_connections,
|
|
@@ -1384,11 +1387,19 @@ import {
|
|
|
1384
1387
|
revokeAgentTokens,
|
|
1385
1388
|
fingerprintApiKey,
|
|
1386
1389
|
init_users
|
|
1387
|
-
} from "./cli-
|
|
1390
|
+
} from "./cli-gxkx0zzp.js";
|
|
1391
|
+
import {
|
|
1392
|
+
AMP_ESTIMATE_MODELS,
|
|
1393
|
+
ampBillsCacheWrites,
|
|
1394
|
+
resolveAmpModel,
|
|
1395
|
+
init_amp_models
|
|
1396
|
+
} from "./cli-p1w18yhx.js";
|
|
1388
1397
|
import {
|
|
1389
1398
|
ASSET_KEY_MAX_LENGTH,
|
|
1390
1399
|
normalizeAssetKey,
|
|
1391
1400
|
defaultAssetKey,
|
|
1401
|
+
isResourceGroupPrefix,
|
|
1402
|
+
RESOURCE_GROUPS_READ_ONLY,
|
|
1392
1403
|
parseAssetKey,
|
|
1393
1404
|
init_key,
|
|
1394
1405
|
isSafeBundlePath,
|
|
@@ -1413,7 +1424,9 @@ import {
|
|
|
1413
1424
|
RoutingReasonSchema,
|
|
1414
1425
|
ProviderNameSchema,
|
|
1415
1426
|
ModelProfileNameSchema,
|
|
1427
|
+
ModelProfileCredentialsSchema,
|
|
1416
1428
|
ModelProfileSchema,
|
|
1429
|
+
ProfileCheckResultSchema,
|
|
1417
1430
|
SessionAccessSchema,
|
|
1418
1431
|
SessionOwnerSchema,
|
|
1419
1432
|
SessionSharesSchema,
|
|
@@ -1542,7 +1555,7 @@ import {
|
|
|
1542
1555
|
KvKeySchema,
|
|
1543
1556
|
KvEntrySchema,
|
|
1544
1557
|
init_types4
|
|
1545
|
-
} from "./cli-
|
|
1558
|
+
} from "./cli-2zp0et3v.js";
|
|
1546
1559
|
import {
|
|
1547
1560
|
CODEX_AUTH_FAILURE_BENCH_THRESHOLD,
|
|
1548
1561
|
CODEX_AUTH_WATCH_NAMESPACE,
|
|
@@ -1553,7 +1566,7 @@ import {
|
|
|
1553
1566
|
IDENTITY_FIELD_BUDGETS,
|
|
1554
1567
|
IdentityFieldBudgetError,
|
|
1555
1568
|
init_identity_field_budget
|
|
1556
|
-
} from "./cli-
|
|
1569
|
+
} from "./cli-tk7cjj8h.js";
|
|
1557
1570
|
import {
|
|
1558
1571
|
getSlackConfiguration,
|
|
1559
1572
|
init_config4
|
|
@@ -1577,10 +1590,12 @@ import {
|
|
|
1577
1590
|
activeModelBlocks,
|
|
1578
1591
|
init_model_rate_limit_windows,
|
|
1579
1592
|
CREDENTIAL_POOL_VARS,
|
|
1593
|
+
PROVIDER_CREDENTIAL_VARS,
|
|
1594
|
+
getModelAwareCredentialVars,
|
|
1580
1595
|
splitCredentialPool,
|
|
1581
1596
|
selectCredential,
|
|
1582
1597
|
init_credentials2
|
|
1583
|
-
} from "./cli-
|
|
1598
|
+
} from "./cli-5mrq3ake.js";
|
|
1584
1599
|
import {
|
|
1585
1600
|
interpolate,
|
|
1586
1601
|
init_template2,
|
|
@@ -1590,7 +1605,7 @@ import {
|
|
|
1590
1605
|
resolveTemplate,
|
|
1591
1606
|
init_resolver,
|
|
1592
1607
|
init_session_templates
|
|
1593
|
-
} from "./cli-
|
|
1608
|
+
} from "./cli-v1dv1r37.js";
|
|
1594
1609
|
import {
|
|
1595
1610
|
init_zod
|
|
1596
1611
|
} from "./cli-zcfpsfzf.js";
|
|
@@ -1622,7 +1637,7 @@ import {
|
|
|
1622
1637
|
import {
|
|
1623
1638
|
init_package,
|
|
1624
1639
|
package_default
|
|
1625
|
-
} from "./cli-
|
|
1640
|
+
} from "./cli-334z18y3.js";
|
|
1626
1641
|
import {
|
|
1627
1642
|
realtimeBus,
|
|
1628
1643
|
init_bus
|
|
@@ -2248,6 +2263,9 @@ async function stopDbRetention() {
|
|
|
2248
2263
|
await retentionTickPromise;
|
|
2249
2264
|
}
|
|
2250
2265
|
|
|
2266
|
+
// src/http/index.ts
|
|
2267
|
+
init_event_loop_lag();
|
|
2268
|
+
|
|
2251
2269
|
// src/be/human-free-drain.ts
|
|
2252
2270
|
init_human_free();
|
|
2253
2271
|
var YIELD_MS2 = 25;
|
|
@@ -2307,6 +2325,7 @@ function stopHumanFreeDrain() {
|
|
|
2307
2325
|
// src/be/mcp-overflow-sweep.ts
|
|
2308
2326
|
init_kv_overflow();
|
|
2309
2327
|
init_db4();
|
|
2328
|
+
init_event_loop_lag();
|
|
2310
2329
|
var MCP_OVERFLOW_SWEEP_INTERVAL_MS = 10 * 60 * 1000;
|
|
2311
2330
|
var sweepTimer = null;
|
|
2312
2331
|
async function runMcpOverflowSweep(now = Date.now()) {
|
|
@@ -2325,7 +2344,7 @@ function startMcpOverflowSweep(intervalMs = MCP_OVERFLOW_SWEEP_INTERVAL_MS) {
|
|
|
2325
2344
|
if (sweepTimer)
|
|
2326
2345
|
return;
|
|
2327
2346
|
sweepTimer = setInterval(() => {
|
|
2328
|
-
runMcpOverflowSweep();
|
|
2347
|
+
withLoopPath("mcp-overflow.sweep", () => runMcpOverflowSweep());
|
|
2329
2348
|
}, intervalMs);
|
|
2330
2349
|
if (typeof sweepTimer?.unref === "function")
|
|
2331
2350
|
sweepTimer.unref();
|
|
@@ -5068,8 +5087,9 @@ init_db4();
|
|
|
5068
5087
|
init_model_profiles();
|
|
5069
5088
|
init_events();
|
|
5070
5089
|
init_harness_model_support();
|
|
5090
|
+
init_model_profile_check();
|
|
5071
5091
|
init_model_tier_resolution();
|
|
5072
|
-
|
|
5092
|
+
init_model_validation2();
|
|
5073
5093
|
init_multi_runtime();
|
|
5074
5094
|
init_db2();
|
|
5075
5095
|
init_server();
|
|
@@ -5225,7 +5245,7 @@ var updateAgentRuntimeRoute = route({
|
|
|
5225
5245
|
path: "/api/agents/{id}/runtime",
|
|
5226
5246
|
pattern: ["api", "agents", null, "runtime"],
|
|
5227
5247
|
summary: "Update an agent's runtime harness and default model",
|
|
5228
|
-
description: "Updates `agents.harness_provider` and agent-scoped runtime config. The settings apply to future provider sessions. For `model`, `reasoning_effort`, and `claude.transport`: omit the field to leave it unchanged, send `null` to clear the corresponding override, or send a value to set it. A `model` the model catalog does not list is a 400 unless `allow_custom_model` is true. A `latest:` alias is not accepted here (aliases resolve for a task's model and for `MODEL_TIER_*` values); `reasoning_effort` must be one the harness and model support. `profile` sets the agent's default model profile (same tri-state): it must exist
|
|
5248
|
+
description: "Updates `agents.harness_provider` and agent-scoped runtime config. The settings apply to future provider sessions. For `model`, `reasoning_effort`, and `claude.transport`: omit the field to leave it unchanged, send `null` to clear the corresponding override, or send a value to set it. A `model` the model catalog does not list is a 400 unless `allow_custom_model` is true. A `latest:` alias is not accepted here (aliases resolve for a task's model and for `MODEL_TIER_*` values); `reasoning_effort` must be one the harness and model support. `profile` sets the agent's default model profile (same tri-state): it must exist, run on `harness_provider` and pass the profile check (`GET /api/agents/{id}/profile-check`) against it, and it cannot be sent with `model`. A failing check is a 400 `{ error, check }`; a passing one returns the result as `profileCheck`. Sending `model`, or changing the model or effort override by any path, clears the default profile.",
|
|
5229
5249
|
tags: ["Agents"],
|
|
5230
5250
|
params: object2({ id: string2() }),
|
|
5231
5251
|
query: object2({ repoId: string2().optional() }),
|
|
@@ -5239,8 +5259,11 @@ var updateAgentRuntimeRoute = route({
|
|
|
5239
5259
|
claude: ClaudeRuntimeConfigSchema.optional()
|
|
5240
5260
|
}),
|
|
5241
5261
|
responses: {
|
|
5242
|
-
200: {
|
|
5243
|
-
|
|
5262
|
+
200: {
|
|
5263
|
+
description: "Updated agent row. `profileCheck` is set when the body set `profile`, so warnings show.",
|
|
5264
|
+
schema: AgentWithCapacitySchema.extend({ profileCheck: ProfileCheckResultSchema.optional() })
|
|
5265
|
+
},
|
|
5266
|
+
400: { description: "Validation error, or `{ error, check }` when the profile check fails" },
|
|
5244
5267
|
404: { description: "Agent not found" }
|
|
5245
5268
|
}
|
|
5246
5269
|
});
|
|
@@ -5494,6 +5517,20 @@ var getAgentCredentialStatusRoute = route({
|
|
|
5494
5517
|
404: { description: "Agent not found" }
|
|
5495
5518
|
}
|
|
5496
5519
|
});
|
|
5520
|
+
var getAgentProfileCheckRoute = route({
|
|
5521
|
+
method: "get",
|
|
5522
|
+
path: "/api/agents/{id}/profile-check",
|
|
5523
|
+
pattern: ["api", "agents", null, "profile-check"],
|
|
5524
|
+
summary: "Check whether an agent can run a model profile",
|
|
5525
|
+
description: "Read-only. Judges the profile's harness, model, the agent's credential report and the profile's credential allowlist. Each row is pass, warn, fail or unverified; `ok` is false only when a row fails. Never returns a secret value.",
|
|
5526
|
+
tags: ["Agents"],
|
|
5527
|
+
params: object2({ id: string2() }),
|
|
5528
|
+
query: object2({ profile: string2().trim().min(1) }),
|
|
5529
|
+
responses: {
|
|
5530
|
+
200: { description: "The check result", schema: ProfileCheckResultSchema },
|
|
5531
|
+
404: { description: "Agent or profile not found" }
|
|
5532
|
+
}
|
|
5533
|
+
});
|
|
5497
5534
|
var listCredentialStatusRoute = route({
|
|
5498
5535
|
method: "get",
|
|
5499
5536
|
path: "/api/agents/credential-status",
|
|
@@ -5897,6 +5934,7 @@ async function handleAgentsRest(req, res, pathSegments, queryParams, myAgentId)
|
|
|
5897
5934
|
if (!parsed)
|
|
5898
5935
|
return true;
|
|
5899
5936
|
const { harness_provider, model, allow_custom_model, reasoning_effort, profile, acp, claude } = parsed.body;
|
|
5937
|
+
let profileCheck = null;
|
|
5900
5938
|
if (typeof profile === "string") {
|
|
5901
5939
|
if (model !== undefined) {
|
|
5902
5940
|
jsonError(res, "Send `profile` or `model`, not both", 400);
|
|
@@ -5911,6 +5949,13 @@ async function handleAgentsRest(req, res, pathSegments, queryParams, myAgentId)
|
|
|
5911
5949
|
jsonError(res, `Model profile "${profile}" runs on the ${picked.harness} harness, not ${harness_provider}`, 400);
|
|
5912
5950
|
return true;
|
|
5913
5951
|
}
|
|
5952
|
+
profileCheck = await checkProfileForAgent(parsed.params.id, profile, {
|
|
5953
|
+
harness: harness_provider
|
|
5954
|
+
});
|
|
5955
|
+
if (profileCheck && !profileCheck.ok) {
|
|
5956
|
+
json(res, { error: formatProfileCheckFailures(profileCheck), check: profileCheck }, 400);
|
|
5957
|
+
return true;
|
|
5958
|
+
}
|
|
5914
5959
|
}
|
|
5915
5960
|
if (acp && harness_provider !== "acp") {
|
|
5916
5961
|
jsonError(res, "ACP configuration requires harness_provider=acp", 400);
|
|
@@ -6096,7 +6141,10 @@ async function handleAgentsRest(req, res, pathSegments, queryParams, myAgentId)
|
|
|
6096
6141
|
jsonError(res, "Agent not found", 404);
|
|
6097
6142
|
return true;
|
|
6098
6143
|
}
|
|
6099
|
-
updateAgentRuntimeRoute.respond(res, 200,
|
|
6144
|
+
updateAgentRuntimeRoute.respond(res, 200, {
|
|
6145
|
+
...await agentWithCapacity(agent),
|
|
6146
|
+
...profileCheck ? { profileCheck } : {}
|
|
6147
|
+
});
|
|
6100
6148
|
return true;
|
|
6101
6149
|
}
|
|
6102
6150
|
if (listCredentialStatusRoute.match(req.method, pathSegments)) {
|
|
@@ -6200,6 +6248,22 @@ async function handleAgentsRest(req, res, pathSegments, queryParams, myAgentId)
|
|
|
6200
6248
|
});
|
|
6201
6249
|
return true;
|
|
6202
6250
|
}
|
|
6251
|
+
if (getAgentProfileCheckRoute.match(req.method, pathSegments)) {
|
|
6252
|
+
const parsed = await getAgentProfileCheckRoute.parse(req, res, pathSegments, queryParams);
|
|
6253
|
+
if (!parsed)
|
|
6254
|
+
return true;
|
|
6255
|
+
if (!await getAgentById2(parsed.params.id)) {
|
|
6256
|
+
jsonError(res, "Agent not found", 404);
|
|
6257
|
+
return true;
|
|
6258
|
+
}
|
|
6259
|
+
const result = await checkProfileForAgent(parsed.params.id, parsed.query.profile);
|
|
6260
|
+
if (!result) {
|
|
6261
|
+
jsonError(res, `Model profile "${parsed.query.profile}" not found`, 404);
|
|
6262
|
+
return true;
|
|
6263
|
+
}
|
|
6264
|
+
getAgentProfileCheckRoute.respond(res, 200, result);
|
|
6265
|
+
return true;
|
|
6266
|
+
}
|
|
6203
6267
|
if (getAgent.match(req.method, pathSegments)) {
|
|
6204
6268
|
const parsed = await getAgent.parse(req, res, pathSegments, queryParams);
|
|
6205
6269
|
if (!parsed)
|
|
@@ -6945,6 +7009,7 @@ init_event_bus();
|
|
|
6945
7009
|
init_zod();
|
|
6946
7010
|
init_db4();
|
|
6947
7011
|
init_model_profiles();
|
|
7012
|
+
init_model_profile_check();
|
|
6948
7013
|
init_multi_runtime();
|
|
6949
7014
|
|
|
6950
7015
|
// src/be/org-profile.ts
|
|
@@ -7419,12 +7484,7 @@ function singleHeader(req, name) {
|
|
|
7419
7484
|
function readsRepoSecrets(auth, agent) {
|
|
7420
7485
|
if (auth?.kind !== "agent" || !auth.runtimeId)
|
|
7421
7486
|
return true;
|
|
7422
|
-
return
|
|
7423
|
-
principal: { kind: "agent", agentId: auth.agentId, isLead: agent?.isLead ?? false },
|
|
7424
|
-
verb: "config.read.secrets",
|
|
7425
|
-
resource: { kind: "none" },
|
|
7426
|
-
source: "http"
|
|
7427
|
-
}).allow;
|
|
7487
|
+
return runtimeReadsRepoSecrets({ id: auth.agentId, isLead: agent?.isLead });
|
|
7428
7488
|
}
|
|
7429
7489
|
async function requestSecretReadScope(req, resolvedScope) {
|
|
7430
7490
|
const principal = await requestPrincipal(req, undefined);
|
|
@@ -12125,7 +12185,7 @@ var catalog_generated_default = {
|
|
|
12125
12185
|
$schema: "../manifest.schema.json",
|
|
12126
12186
|
name: "comms-adherence-gate",
|
|
12127
12187
|
description: "Judges every Slack-facing store-progress completion and agent Slack post against the comms preferences of the requester, or of the person it @-mentions, their latest request and a plain-language rubric with Jev (TypeSafe or OpenRouter), and in enforce blocks a failing call once per task",
|
|
12128
|
-
version: "1.
|
|
12188
|
+
version: "1.8.0",
|
|
12129
12189
|
runtime: "api",
|
|
12130
12190
|
assets: {
|
|
12131
12191
|
hooks: "hooks.ts"
|
|
@@ -12188,6 +12248,12 @@ export const config = z.object({
|
|
|
12188
12248
|
openrouterModel: z.string().default("typesafe/jev-1.13"),
|
|
12189
12249
|
/** Explicit TypeSafe key; otherwise TYPESAFE_API_KEY from the API process env. */
|
|
12190
12250
|
apiKey: z.string().optional(),
|
|
12251
|
+
/**
|
|
12252
|
+
* Fixed text the operator's own templates mandate, judged by the self-test and
|
|
12253
|
+
* expected to pass. Kept loose here and parsed per entry by \`fixturesOf\`, so one
|
|
12254
|
+
* bad entry cannot fail the whole config and drop \`mode\` back to its default.
|
|
12255
|
+
*/
|
|
12256
|
+
fixtures: z.unknown().optional(),
|
|
12191
12257
|
});
|
|
12192
12258
|
|
|
12193
12259
|
type Cfg = z.infer<typeof config>;
|
|
@@ -12388,6 +12454,27 @@ export const resolveTransport = (cfg: Cfg): JevTransport => {
|
|
|
12388
12454
|
);
|
|
12389
12455
|
};
|
|
12390
12456
|
|
|
12457
|
+
/**
|
|
12458
|
+
* The judge input for one message. The live gate and the self-test fixtures build it
|
|
12459
|
+
* here, so a fixture is judged exactly like real traffic.
|
|
12460
|
+
*/
|
|
12461
|
+
export const gateState = (s: {
|
|
12462
|
+
requester: string;
|
|
12463
|
+
prefs: Prefs;
|
|
12464
|
+
ask: string;
|
|
12465
|
+
threadOpening: string;
|
|
12466
|
+
text: string;
|
|
12467
|
+
}): Record<string, unknown> => ({
|
|
12468
|
+
role: "You audit an AI agent's message to the human who requested the work.",
|
|
12469
|
+
requester: s.requester,
|
|
12470
|
+
requester_preferences: s.prefs,
|
|
12471
|
+
latest_request: s.ask,
|
|
12472
|
+
thread_opening: s.threadOpening,
|
|
12473
|
+
judging_rules: JUDGING_RULES,
|
|
12474
|
+
plain_language_rules: PLAIN_RULES,
|
|
12475
|
+
agent_message: s.text,
|
|
12476
|
+
});
|
|
12477
|
+
|
|
12391
12478
|
/** One Jev call; returns the \`noul\` score per question. Throws on any failure. */
|
|
12392
12479
|
export const askJev = async (
|
|
12393
12480
|
state: Record<string, unknown>,
|
|
@@ -12444,6 +12531,72 @@ const SELFTEST_PLAIN_GOOD =
|
|
|
12444
12531
|
const below = (bad: unknown, good: unknown, threshold: number): boolean =>
|
|
12445
12532
|
typeof bad === "number" && typeof good === "number" && bad < threshold && good >= threshold;
|
|
12446
12533
|
|
|
12534
|
+
/** Fixtures judged per self-test run: one Jev call each, inside the 5 s handler budget. */
|
|
12535
|
+
export const MAX_FIXTURES = 8;
|
|
12536
|
+
const fixture = z.object({
|
|
12537
|
+
name: z.string().min(1).max(80),
|
|
12538
|
+
/** The fixed text as it will be posted, placeholders filled with sample values. */
|
|
12539
|
+
text: z.string().min(1).max(4000),
|
|
12540
|
+
/** Audience preferences; omit to judge \`plain\` only. */
|
|
12541
|
+
prefs: z
|
|
12542
|
+
.object({
|
|
12543
|
+
verbosity: z.string().optional(),
|
|
12544
|
+
tone: z.string().optional(),
|
|
12545
|
+
language: z.string().optional(),
|
|
12546
|
+
})
|
|
12547
|
+
.optional(),
|
|
12548
|
+
/** The request the text answers, as \`latest_request\`. */
|
|
12549
|
+
request: z.string().max(900).optional(),
|
|
12550
|
+
});
|
|
12551
|
+
export type Fixture = z.infer<typeof fixture>;
|
|
12552
|
+
|
|
12553
|
+
/** Valid fixture entries, in order, capped at MAX_FIXTURES; invalid entries are skipped. */
|
|
12554
|
+
export const fixturesOf = (raw: unknown): Fixture[] =>
|
|
12555
|
+
(Array.isArray(raw) ? raw : [])
|
|
12556
|
+
.map((f) => fixture.safeParse(f))
|
|
12557
|
+
.filter((r) => r.success)
|
|
12558
|
+
.map((r) => r.data)
|
|
12559
|
+
.slice(0, MAX_FIXTURES);
|
|
12560
|
+
|
|
12561
|
+
/**
|
|
12562
|
+
* Judge each fixture with the live gate's questions and state. A fixture is fixed
|
|
12563
|
+
* text the operator expects to pass, so any dimension below its threshold fails it.
|
|
12564
|
+
*/
|
|
12565
|
+
const judgeFixtures = async (
|
|
12566
|
+
fixtures: Fixture[],
|
|
12567
|
+
transport: JevTransport,
|
|
12568
|
+
cfg: Cfg,
|
|
12569
|
+
signal?: AbortSignal,
|
|
12570
|
+
) =>
|
|
12571
|
+
Promise.all(
|
|
12572
|
+
fixtures.map(async (f) => {
|
|
12573
|
+
const prefs: Prefs = f.prefs ?? {};
|
|
12574
|
+
const questions = { ...buildQuestions(prefs), plain: PLAIN_QUESTION };
|
|
12575
|
+
try {
|
|
12576
|
+
const { scores } = await askJev(
|
|
12577
|
+
gateState({
|
|
12578
|
+
requester: "the requester",
|
|
12579
|
+
prefs,
|
|
12580
|
+
ask: f.request ?? "",
|
|
12581
|
+
threadOpening: "",
|
|
12582
|
+
text: f.text,
|
|
12583
|
+
}),
|
|
12584
|
+
questions,
|
|
12585
|
+
transport,
|
|
12586
|
+
cfg,
|
|
12587
|
+
signal,
|
|
12588
|
+
);
|
|
12589
|
+
const failed = Object.keys(questions).filter((dim) => {
|
|
12590
|
+
const s = scores[dim];
|
|
12591
|
+
return typeof s !== "number" || s < (dim === "plain" ? cfg.plainThreshold : cfg.threshold);
|
|
12592
|
+
});
|
|
12593
|
+
return { name: f.name, scores, failed, pass: failed.length === 0 };
|
|
12594
|
+
} catch (err) {
|
|
12595
|
+
return { name: f.name, error: String(err).slice(0, 200), pass: false };
|
|
12596
|
+
}
|
|
12597
|
+
}),
|
|
12598
|
+
);
|
|
12599
|
+
|
|
12447
12600
|
/**
|
|
12448
12601
|
* Run the judge on known-bad (positive control, must score below threshold) and
|
|
12449
12602
|
* known-good (negative control, must score at or above it) messages and record
|
|
@@ -12464,11 +12617,13 @@ const selfTest = async (swarm: Swarm, cfg: Cfg, signal?: AbortSignal): Promise<v
|
|
|
12464
12617
|
cfg,
|
|
12465
12618
|
signal,
|
|
12466
12619
|
).then((r) => r.scores[dim] ?? null);
|
|
12467
|
-
const
|
|
12620
|
+
const fixtures = fixturesOf(cfg.fixtures);
|
|
12621
|
+
const [bad, good, plainBad, plainGood, fixtureResults] = await Promise.all([
|
|
12468
12622
|
judge(SELFTEST_BAD, "verbosity"),
|
|
12469
12623
|
judge(SELFTEST_GOOD, "verbosity"),
|
|
12470
12624
|
judge(SELFTEST_PLAIN_BAD, "plain"),
|
|
12471
12625
|
judge(SELFTEST_PLAIN_GOOD, "plain"),
|
|
12626
|
+
judgeFixtures(fixtures, transport, cfg, signal),
|
|
12472
12627
|
]);
|
|
12473
12628
|
await swarm.kv_set({
|
|
12474
12629
|
namespace: NS,
|
|
@@ -12484,6 +12639,9 @@ const selfTest = async (swarm: Swarm, cfg: Cfg, signal?: AbortSignal): Promise<v
|
|
|
12484
12639
|
plainPositiveControlBadScore: plainBad,
|
|
12485
12640
|
plainNegativeControlGoodScore: plainGood,
|
|
12486
12641
|
plainControlsOk: below(plainBad, plainGood, cfg.plainThreshold),
|
|
12642
|
+
fixtures: fixtureResults,
|
|
12643
|
+
// null when none are configured: zero fixtures is not a pass.
|
|
12644
|
+
fixturesOk: fixtureResults.length === 0 ? null : fixtureResults.every((f) => f.pass),
|
|
12487
12645
|
latencyMs: Date.now() - started,
|
|
12488
12646
|
},
|
|
12489
12647
|
});
|
|
@@ -12695,16 +12853,7 @@ const extension: SwarmExtension = (api) => {
|
|
|
12695
12853
|
|
|
12696
12854
|
const transport = resolveTransport(cfg);
|
|
12697
12855
|
const { scores, latencyMs } = await askJev(
|
|
12698
|
-
{
|
|
12699
|
-
role: "You audit an AI agent's message to the human who requested the work.",
|
|
12700
|
-
requester: audienceName,
|
|
12701
|
-
requester_preferences: prefs,
|
|
12702
|
-
latest_request: ask,
|
|
12703
|
-
thread_opening: threadOpening,
|
|
12704
|
-
judging_rules: JUDGING_RULES,
|
|
12705
|
-
plain_language_rules: PLAIN_RULES,
|
|
12706
|
-
agent_message: text,
|
|
12707
|
-
},
|
|
12856
|
+
gateState({ requester: audienceName, prefs, ask, threadOpening, text }),
|
|
12708
12857
|
questions,
|
|
12709
12858
|
transport,
|
|
12710
12859
|
cfg,
|
|
@@ -12826,7 +12975,7 @@ const extension: SwarmExtension = (api) => {
|
|
|
12826
12975
|
export default extension;
|
|
12827
12976
|
`
|
|
12828
12977
|
},
|
|
12829
|
-
readme: '# comms-adherence-gate\n\nAgents finish Slack tasks with a final message a human reads, and post to Slack threads directly. This extension judges that text with Jev, [TypeSafe](https://typesafe.ai)\'s decision model: against the requester\'s stated comms preferences and their latest request, and against a plain-language rubric that applies to every message. In `enforce` it blocks a failing call once and tells the agent what to fix. A `plain` failure points the agent at the `comms` skill.\n\nInstall config:\n\n```json\n{ "mode": "shadow", "plainMode": "shadow" }\n```\n\nStart in `shadow`, read the verdicts in KV for a few days, then switch to `enforce`. `mode` and `plainMode` move independently.\n\n## Modes\n\n| `mode` | Effect |\n|---|---|\n| `off` | Never evaluates. |\n| `shadow` (default) | Asks Jev and records the verdict. Never blocks. |\n| `enforce` | Asks Jev, records the verdict, and blocks the call when a dimension fails, at most `maxBlocksPerTask` times per task. The agent gets the failed dimensions, their scores and the stated preference, and calls again. |\n\n`mode` governs the preference dimensions (`verbosity`, `tone`, `language`). `plainMode` governs `plain`. A dimension blocks only when its own mode is `enforce`. Both share one block budget per task, across every gated tool.\n\n## What it gates\n\nHook: `pre.tool.call` on:\n\n- `store-progress` with `status: "completed"` and a non-empty `output`, on a task that came from Slack (`source = "slack"` or a `slackThreadTs`). Other completions pass without a Jev call.\n- `slack-reply`, `slack-post`, `slack-start-thread` and `slack-update`, judged on `message`. The task is `slack-reply`\'s `taskId`, else the caller\'s task context. A post with no task context passes.\n\nOnly a call the tool itself accepts is judged, so no other task\'s text reaches Jev. For `store-progress` the caller must own the task, the task must be unassigned, or the caller must be a lead. For the Slack tools the caller must be the task\'s assignee or its creator, the rule `slack-reply` enforces. Calls made by extensions are skipped. Script SDK calls never reach `pre.tool.call` (the tool registrar dispatches it only for MCP calls); if one ever does, the gate records it and never blocks.\n\nA requester with no stated preferences in `users.metadata.comms` still gets the `plain` question. Set preferences with the `manage-user` tool.\n\nIn a thread with several people, the requester is the person whose message created the task. A message that @-mentions someone (`<@U123>`) is judged against the first mentioned person with stored preferences, resolved through their Slack identity in `user_external_ids`; otherwise against the requester. The lookup is one SQL read, only when the text mentions someone and `mode` is not `off`. The verdict records who was judged in `judgedFor` (`mention` or `requester`) and `audience`.\n\n## Decision\n\nThe gate reads the task row and asks one `noul` question per stated preference it knows: `verbosity`, `tone`, `language`. Any other key in `comms` is context only.\n\nJev sees the preferences, the requester\'s latest message (the text after the last `</thread_context>`, from the last 1,400 characters of the task), the first 400 characters of the task, and the output. Its judging rules say an explicit request outranks the stored default. A requested long answer, story or document is not a verbosity failure.\n\nIt also asks `plain` on every message unless `plainMode` is `off` or the text is a JSON document (structured output for an `outputSchema`). The rubric comes from the `comms` skill: everyday words, one idea per sentence, every number with a unit and a direction word, and no unexplained shorthand (n, median, p90, cohort, baseline, delta, `±X at 95%`). Code identifiers, task ids, PR numbers, links and versions are fine. Jev gets contrasting plain and dense examples in `plain_language_rules`; a prose-only rubric scored plain rewrites as low as the dense originals.\n\nAll questions go in one Jev request. A preference dimension fails below `threshold`; `plain` fails below `plainThreshold`. Any failed dimension fails the message.\n\n### Calibration of `plain`\n\nJev scores dense status text near 0 and plain text near 0.8 to 0.9, with a wide middle of compact but readable engineering notes. Measured on 400 Slack-facing completions over 7 days, at `threshold` 0.75 for preferences:\n\n| `plainThreshold` | Newly blocked (of messages that pass today) |\n|---|---|\n| 0.75 | 81% to 83% |\n| 0.3 | 9% to 13% |\n| 0.25 (default) | 5% to 7% |\n\nAt 0.25 the dense prompt-cache-monitor post scores about 0.15 and its plain rewrite about 0.81.\n\n## Jev transport\n\nJev is reachable two ways. Both take the same request and return the same answer.\n\n| `provider` | Endpoint | Key | Model |\n|---|---|---|---|\n| `typesafe` | `POST https://api.typesafe.ai/v1/systemone` | `TYPESAFE_API_KEY` (or `apiKey`) | `model`, default `jev-latest` |\n| `openrouter` | `POST https://openrouter.ai/api/alpha/decisions` | `OPENROUTER_API_KEY` | `openrouterModel`, default `typesafe/jev-1.13` |\n| `auto` (default) | TypeSafe when its key is set, else OpenRouter | | |\n\nEach verdict row records the `provider` that answered.\n\n## Fail open\n\nEvery error lets the completion through: a missing key, an HTTP error, a network error, a timeout, a malformed answer, or a failed DB read. The handler never throws, so an outage cannot auto-disable the extension. Each failure bumps the `error` counter and overwrites `error:last`.\n\n## Self-test\n\nCall `store-progress` with a non-completed status and `progress` starting with `comms-gate-selftest`. The gate judges a known-bad and a known-good message against a terse preference, and a dense and a plain message on `plain`, then writes `selftest:last`: every score, both thresholds, the provider, `controlsOk` (verbosity: bad below `threshold`, good at or above it) and `plainControlsOk` (the same against `plainThreshold`). Real traffic is untouched.\n\n## Config\n\n| Key | Default | Notes |\n|---|---|---|\n| `mode` | `shadow` | `off`, `shadow`, or `enforce` |\n| `threshold` | `0.5` | A preference dimension scoring below this fails |\n| `plainMode` | `shadow` | `off`, `shadow`, or `enforce` for the `plain` dimension |\n| `plainThreshold` | `0.25` | `plain` scoring below this fails. See [Calibration](#calibration-of-plain) |\n| `timeoutMs` | `4000` | Jev call timeout, capped at 4000 (the dispatcher cancels a handler at 5 s) |\n| `maxBlocksPerTask` | `1` | Blocks per task in `enforce`; after that the gate records and lets it through |\n| `provider` | `auto` | `auto`, `typesafe`, or `openrouter`. See [Jev transport](#jev-transport) |\n| `model` | `jev-latest` | Jev model on TypeSafe |\n| `openrouterModel` | `typesafe/jev-1.13` | Jev model on OpenRouter |\n| `apiKey` | unset | Explicit TypeSafe key. Prefer the `TYPESAFE_API_KEY` secret below |\n\n## Required secrets\n\nRead from the API process environment at call time. Set them as global `swarm_config` secrets: the API process loads global rows into `process.env` at boot and on config reload.\n\n- `TYPESAFE_API_KEY` or `OPENROUTER_API_KEY`: one is required for any evaluation. Under `auto`, TypeSafe wins when both are set. Without either, every completion fails open.\n\nNo key is written to config, KV, logs, or a block reason.\n\n## KV namespace `ext:comms-gate`\n\n- `last`: the latest verdict, with `tool`, `scores`, `failed`, `mode`, `plainMode`, `provider`, `latencyMs`, the preferences, a 400-character `askPreview` and a 700-character `outputPreview`.\n- `fail:<epochMs>:<taskId>`: one row per failed verdict, with `action` (`blocked` or `recorded`).\n- `blocks:<taskId>`: blocks issued for that task.\n- `error:last`, `selftest:last`.\n- Counters: `total`, `pass`, `fail`, `blocked`, `escaped` (a blocking dimension failed, block budget spent), `shadowed` (only non-blocking dimensions failed), `error`, and `dim:<dimension>`.\n\n## Known limits\n\n- Only the last 1,400 characters of the task are searched for the latest request. A very long final message is cut to its last 900 characters.\n- The block budget is per task, so a retried call after a block goes through once the budget is spent, even if it still fails.\n- Each gated Slack post waits for one Jev call (about 0.2 s measured, capped by `timeoutMs`).\n'
|
|
12978
|
+
readme: '# comms-adherence-gate\n\nAgents finish Slack tasks with a final message a human reads, and post to Slack threads directly. This extension judges that text with Jev, [TypeSafe](https://typesafe.ai)\'s decision model: against the requester\'s stated comms preferences and their latest request, and against a plain-language rubric that applies to every message. In `enforce` it blocks a failing call once and tells the agent what to fix. A `plain` failure points the agent at the `comms` skill.\n\nInstall config:\n\n```json\n{ "mode": "shadow", "plainMode": "shadow" }\n```\n\nStart in `shadow`, read the verdicts in KV for a few days, then switch to `enforce`. `mode` and `plainMode` move independently.\n\n## Modes\n\n| `mode` | Effect |\n|---|---|\n| `off` | Never evaluates. |\n| `shadow` (default) | Asks Jev and records the verdict. Never blocks. |\n| `enforce` | Asks Jev, records the verdict, and blocks the call when a dimension fails, at most `maxBlocksPerTask` times per task. The agent gets the failed dimensions, their scores and the stated preference, and calls again. |\n\n`mode` governs the preference dimensions (`verbosity`, `tone`, `language`). `plainMode` governs `plain`. A dimension blocks only when its own mode is `enforce`. Both share one block budget per task, across every gated tool.\n\n## What it gates\n\nHook: `pre.tool.call` on:\n\n- `store-progress` with `status: "completed"` and a non-empty `output`, on a task that came from Slack (`source = "slack"` or a `slackThreadTs`). Other completions pass without a Jev call.\n- `slack-reply`, `slack-post`, `slack-start-thread` and `slack-update`, judged on `message`. The task is `slack-reply`\'s `taskId`, else the caller\'s task context. A post with no task context passes.\n\nOnly a call the tool itself accepts is judged, so no other task\'s text reaches Jev. For `store-progress` the caller must own the task, the task must be unassigned, or the caller must be a lead. For the Slack tools the caller must be the task\'s assignee or its creator, the rule `slack-reply` enforces. Calls made by extensions are skipped. Script SDK calls never reach `pre.tool.call` (the tool registrar dispatches it only for MCP calls); if one ever does, the gate records it and never blocks.\n\nA requester with no stated preferences in `users.metadata.comms` still gets the `plain` question. Set preferences with the `manage-user` tool.\n\nIn a thread with several people, the requester is the person whose message created the task. A message that @-mentions someone (`<@U123>`) is judged against the first mentioned person with stored preferences, resolved through their Slack identity in `user_external_ids`; otherwise against the requester. The lookup is one SQL read, only when the text mentions someone and `mode` is not `off`. The verdict records who was judged in `judgedFor` (`mention` or `requester`) and `audience`.\n\n## Decision\n\nThe gate reads the task row and asks one `noul` question per stated preference it knows: `verbosity`, `tone`, `language`. Any other key in `comms` is context only.\n\nJev sees the preferences, the requester\'s latest message (the text after the last `</thread_context>`, from the last 1,400 characters of the task), the first 400 characters of the task, and the output. Its judging rules say an explicit request outranks the stored default. A requested long answer, story or document is not a verbosity failure.\n\nIt also asks `plain` on every message unless `plainMode` is `off` or the text is a JSON document (structured output for an `outputSchema`). The rubric comes from the `comms` skill: everyday words, one idea per sentence, every number with a unit and a direction word, and no unexplained shorthand (n, median, p90, cohort, baseline, delta, `±X at 95%`). Code identifiers, task ids, PR numbers, links and versions are fine. Jev gets contrasting plain and dense examples in `plain_language_rules`; a prose-only rubric scored plain rewrites as low as the dense originals.\n\nAll questions go in one Jev request. A preference dimension fails below `threshold`; `plain` fails below `plainThreshold`. Any failed dimension fails the message.\n\n### Calibration of `plain`\n\nJev scores dense status text near 0 and plain text near 0.8 to 0.9, with a wide middle of compact but readable engineering notes. Measured on 400 Slack-facing completions over 7 days, at `threshold` 0.75 for preferences:\n\n| `plainThreshold` | Newly blocked (of messages that pass today) |\n|---|---|\n| 0.75 | 81% to 83% |\n| 0.3 | 9% to 13% |\n| 0.25 (default) | 5% to 7% |\n\nAt 0.25 the dense prompt-cache-monitor post scores about 0.15 and its plain rewrite about 0.81.\n\n## Jev transport\n\nJev is reachable two ways. Both take the same request and return the same answer.\n\n| `provider` | Endpoint | Key | Model |\n|---|---|---|---|\n| `typesafe` | `POST https://api.typesafe.ai/v1/systemone` | `TYPESAFE_API_KEY` (or `apiKey`) | `model`, default `jev-latest` |\n| `openrouter` | `POST https://openrouter.ai/api/alpha/decisions` | `OPENROUTER_API_KEY` | `openrouterModel`, default `typesafe/jev-1.13` |\n| `auto` (default) | TypeSafe when its key is set, else OpenRouter | | |\n\nEach verdict row records the `provider` that answered.\n\n## Fail open\n\nEvery error lets the completion through: a missing key, an HTTP error, a network error, a timeout, a malformed answer, or a failed DB read. The handler never throws, so an outage cannot auto-disable the extension. Each failure bumps the `error` counter and overwrites `error:last`.\n\n## Self-test\n\nCall `store-progress` with a non-completed status and `progress` starting with `comms-gate-selftest`. The gate judges a known-bad and a known-good message against a terse preference, and a dense and a plain message on `plain`, then writes `selftest:last`: every score, both thresholds, the provider, `controlsOk` (verbosity: bad below `threshold`, good at or above it) and `plainControlsOk` (the same against `plainThreshold`). Real traffic is untouched.\n\n### Fixtures\n\nFixed text that your own templates tell an agent to post (a daily report\'s all-clear line, a standard reply) should pass the gate. List it under `fixtures` and the self-test judges each entry with the same state and questions as real traffic, then records `fixtures` (per entry: `name`, `scores`, `failed`, `pass`) and `fixturesOk` in `selftest:last`. A failing fixture means the template line or the gate needs a fix before a quiet day forces an ad-hoc rewrite.\n\n```json\n{\n "fixtures": [\n { "name": "daily-report-all-clear", "text": "📊 11-03: all clear, nothing for you. 56 of 73 workflows are turned on." },\n {\n "name": "short-reply",\n "text": "Went with option B: it keeps the migration reversible. PR #123.",\n "prefs": { "verbosity": "very terse, ~400 chars max" },\n "request": "which option did you pick?"\n }\n ]\n}\n```\n\nFill placeholders with realistic sample values. `prefs` adds the preference dimensions it names; without it only `plain` is judged. At most 8 entries run; an invalid entry is skipped, never fatal to the rest of the config.\n\n`fixturesOk` is `true` only when at least one entry ran and every entry passed. It is `null` when no valid entry ran: `fixtures` unset, an explicit `fixtures: []`, or every entry invalid. `null` means nothing was checked, so never read it as a pass. A skipped entry is missing from `fixtures` in `selftest:last`, so compare that list with your config.\n\nUnit tests mock Jev, so they cannot show that a line passes. Only the self-test, which calls the live judge, can.\n\n## Config\n\n| Key | Default | Notes |\n|---|---|---|\n| `mode` | `shadow` | `off`, `shadow`, or `enforce` |\n| `threshold` | `0.5` | A preference dimension scoring below this fails |\n| `plainMode` | `shadow` | `off`, `shadow`, or `enforce` for the `plain` dimension |\n| `plainThreshold` | `0.25` | `plain` scoring below this fails. See [Calibration](#calibration-of-plain) |\n| `timeoutMs` | `4000` | Jev call timeout, capped at 4000 (the dispatcher cancels a handler at 5 s) |\n| `maxBlocksPerTask` | `1` | Blocks per task in `enforce`; after that the gate records and lets it through |\n| `provider` | `auto` | `auto`, `typesafe`, or `openrouter`. See [Jev transport](#jev-transport) |\n| `model` | `jev-latest` | Jev model on TypeSafe |\n| `openrouterModel` | `typesafe/jev-1.13` | Jev model on OpenRouter |\n| `apiKey` | unset | Explicit TypeSafe key. Prefer the `TYPESAFE_API_KEY` secret below |\n| `fixtures` | unset | Fixed template text the self-test expects to pass. See [Fixtures](#fixtures) |\n\n## Required secrets\n\nRead from the API process environment at call time. Set them as global `swarm_config` secrets: the API process loads global rows into `process.env` at boot and on config reload.\n\n- `TYPESAFE_API_KEY` or `OPENROUTER_API_KEY`: one is required for any evaluation. Under `auto`, TypeSafe wins when both are set. Without either, every completion fails open.\n\nNo key is written to config, KV, logs, or a block reason.\n\n## KV namespace `ext:comms-gate`\n\n- `last`: the latest verdict, with `tool`, `scores`, `failed`, `mode`, `plainMode`, `provider`, `latencyMs`, the preferences, a 400-character `askPreview` and a 700-character `outputPreview`.\n- `fail:<epochMs>:<taskId>`: one row per failed verdict, with `action` (`blocked` or `recorded`).\n- `blocks:<taskId>`: blocks issued for that task.\n- `error:last`, `selftest:last`.\n- Counters: `total`, `pass`, `fail`, `blocked`, `escaped` (a blocking dimension failed, block budget spent), `shadowed` (only non-blocking dimensions failed), `error`, and `dim:<dimension>`.\n\n## Known limits\n\n- Only the last 1,400 characters of the task are searched for the latest request. A very long final message is cut to its last 900 characters.\n- The block budget is per task, so a retried call after a block goes through once the budget is spent, even if it still fails.\n- Each gated Slack post waits for one Jev call (about 0.2 s measured, capped by `timeoutMs`).\n'
|
|
12830
12979
|
},
|
|
12831
12980
|
"deploy-awareness": {
|
|
12832
12981
|
manifestFile: "manifest.json",
|
|
@@ -20374,6 +20523,7 @@ function closeIdleMcpUserTransports(transports, sessionUsers, sessionActivity, o
|
|
|
20374
20523
|
// src/http/memory.ts
|
|
20375
20524
|
init_zod();
|
|
20376
20525
|
init_db4();
|
|
20526
|
+
init_event_loop_lag();
|
|
20377
20527
|
init_memory();
|
|
20378
20528
|
init_access();
|
|
20379
20529
|
init_constants2();
|
|
@@ -21823,7 +21973,7 @@ async function handleMemory(req, res, pathSegments, callerAgentId) {
|
|
|
21823
21973
|
var MEMORY_GC_INTERVAL_MS = 60 * 60 * 1000;
|
|
21824
21974
|
var memoryGcTimer = null;
|
|
21825
21975
|
var SEARCH_RETRIEVAL_TTL_DAYS = 90;
|
|
21826
|
-
var SEARCH_RETRIEVAL_PURGE_BATCH =
|
|
21976
|
+
var SEARCH_RETRIEVAL_PURGE_BATCH = 500;
|
|
21827
21977
|
async function purgeStaleSearchRetrievals(batchSize = SEARCH_RETRIEVAL_PURGE_BATCH) {
|
|
21828
21978
|
try {
|
|
21829
21979
|
const cutoff = new Date(Date.now() - SEARCH_RETRIEVAL_TTL_DAYS * 24 * 60 * 60 * 1000).toISOString();
|
|
@@ -21863,12 +22013,12 @@ async function startMemoryGc(intervalMs = MEMORY_GC_INTERVAL_MS, initialDelayMs
|
|
|
21863
22013
|
return;
|
|
21864
22014
|
memoryGcInitialTimer = setTimeout(() => {
|
|
21865
22015
|
memoryGcInitialTimer = null;
|
|
21866
|
-
runMemoryGcTick("Initial");
|
|
22016
|
+
withLoopPath("memory-gc.tick", () => runMemoryGcTick("Initial"));
|
|
21867
22017
|
}, initialDelayMs);
|
|
21868
22018
|
if (typeof memoryGcInitialTimer?.unref === "function")
|
|
21869
22019
|
memoryGcInitialTimer.unref();
|
|
21870
22020
|
memoryGcTimer = setInterval(() => {
|
|
21871
|
-
runMemoryGcTick("Periodic");
|
|
22021
|
+
withLoopPath("memory-gc.tick", () => runMemoryGcTick("Periodic"));
|
|
21872
22022
|
}, intervalMs);
|
|
21873
22023
|
if (typeof memoryGcTimer?.unref === "function")
|
|
21874
22024
|
memoryGcTimer.unref();
|
|
@@ -22347,9 +22497,10 @@ init_src2();
|
|
|
22347
22497
|
init_zod();
|
|
22348
22498
|
init_audit_user();
|
|
22349
22499
|
init_model_profiles();
|
|
22350
|
-
|
|
22500
|
+
init_model_validation2();
|
|
22351
22501
|
init_rbac();
|
|
22352
22502
|
init_types4();
|
|
22503
|
+
init_credentials2();
|
|
22353
22504
|
init_request_principal();
|
|
22354
22505
|
init_route_def();
|
|
22355
22506
|
init_utils2();
|
|
@@ -22385,7 +22536,7 @@ var createProfile = route({
|
|
|
22385
22536
|
path: "/api/model-profiles",
|
|
22386
22537
|
pattern: ["api", "model-profiles"],
|
|
22387
22538
|
summary: "Create a model profile",
|
|
22388
|
-
description: "A profile runs on one harness. `model` must run on that harness and be in the model catalog unless `allowCustomModel` is true (a gateway id, a fresh launch); a `latest:` alias is accepted and resolves at claim. `effort` must be a level the harness and model support. Operator only (the shared API key).",
|
|
22539
|
+
description: "A profile runs on one harness. `model` must run on that harness and be in the model catalog unless `allowCustomModel` is true (a gateway id, a fresh launch); a `latest:` alias is accepted and resolves at claim. `effort` must be a level the harness and model support. `credentials` pins which pooled keys the profile uses: per credential var of the harness, the last 5 characters of each allowed key (`CODEX_OAUTH` is not supported). Operator only (the shared API key).",
|
|
22389
22540
|
tags: ["Models"],
|
|
22390
22541
|
rbac: { permission: "models.profiles.write" },
|
|
22391
22542
|
body: object2({
|
|
@@ -22394,7 +22545,8 @@ var createProfile = route({
|
|
|
22394
22545
|
model: string2().trim().min(1),
|
|
22395
22546
|
effort: ReasoningEffortSchema.nullable().optional(),
|
|
22396
22547
|
allowCustomModel: boolean().optional().default(false),
|
|
22397
|
-
description: string2().trim().max(500).nullable().optional()
|
|
22548
|
+
description: string2().trim().max(500).nullable().optional(),
|
|
22549
|
+
credentials: ModelProfileCredentialsSchema.nullable().optional()
|
|
22398
22550
|
}),
|
|
22399
22551
|
responses: {
|
|
22400
22552
|
201: { description: "Profile created", schema: ModelProfileSchema },
|
|
@@ -22408,7 +22560,7 @@ var updateProfile = route({
|
|
|
22408
22560
|
path: "/api/model-profiles/{name}",
|
|
22409
22561
|
pattern: ["api", "model-profiles", null],
|
|
22410
22562
|
summary: "Update a model profile",
|
|
22411
|
-
description: "Changes the model, effort, custom-model flag or
|
|
22563
|
+
description: "Changes the model, effort, custom-model flag, description or credential allowlist; the name and harness are fixed. Omit a field to keep it; `effort: null` and `credentials: null` clear it. Applies to tasks claimed after the change. Operator only (the shared API key).",
|
|
22412
22564
|
tags: ["Models"],
|
|
22413
22565
|
rbac: { permission: "models.profiles.write" },
|
|
22414
22566
|
params: object2({ name: string2() }),
|
|
@@ -22416,7 +22568,8 @@ var updateProfile = route({
|
|
|
22416
22568
|
model: string2().trim().min(1).optional(),
|
|
22417
22569
|
effort: ReasoningEffortSchema.nullable().optional(),
|
|
22418
22570
|
allowCustomModel: boolean().optional(),
|
|
22419
|
-
description: string2().trim().max(500).nullable().optional()
|
|
22571
|
+
description: string2().trim().max(500).nullable().optional(),
|
|
22572
|
+
credentials: ModelProfileCredentialsSchema.nullable().optional()
|
|
22420
22573
|
}),
|
|
22421
22574
|
responses: {
|
|
22422
22575
|
200: { description: "Profile updated", schema: ModelProfileSchema },
|
|
@@ -22430,7 +22583,7 @@ var deleteProfile = route({
|
|
|
22430
22583
|
path: "/api/model-profiles/{name}",
|
|
22431
22584
|
pattern: ["api", "model-profiles", null],
|
|
22432
22585
|
summary: "Delete a model profile",
|
|
22433
|
-
description: "Refused (409) for a shipped `<harness>-<tier>` seed (edit it instead; it would come back at the next boot), and while an agent has the profile as its default or a task holds it (unfinished, or superseded and still owed its resume). Operator only (the shared API key).",
|
|
22586
|
+
description: "Refused (409) for a shipped `<harness>-<tier>` seed (edit it instead; it would come back at the next boot), and while an agent has the profile as its default, a schedule names it, or a task holds it (unfinished, or superseded and still owed its resume). Operator only (the shared API key).",
|
|
22434
22587
|
tags: ["Models"],
|
|
22435
22588
|
rbac: { permission: "models.profiles.write" },
|
|
22436
22589
|
params: object2({ name: string2() }),
|
|
@@ -22441,6 +22594,28 @@ var deleteProfile = route({
|
|
|
22441
22594
|
409: { description: "The profile is a seed or still in use" }
|
|
22442
22595
|
}
|
|
22443
22596
|
});
|
|
22597
|
+
function credentialsError(harness, model, credentials) {
|
|
22598
|
+
if (!credentials)
|
|
22599
|
+
return null;
|
|
22600
|
+
const base = PROVIDER_CREDENTIAL_VARS[harness] ?? [];
|
|
22601
|
+
const allowed = new Set(base.length > 0 ? getModelAwareCredentialVars(harness, model) : []);
|
|
22602
|
+
for (const [envVar, suffixes] of Object.entries(credentials)) {
|
|
22603
|
+
if (envVar === "CODEX_OAUTH") {
|
|
22604
|
+
return "A credential allowlist for CODEX_OAUTH is not supported in v1.";
|
|
22605
|
+
}
|
|
22606
|
+
if (!allowed.has(envVar)) {
|
|
22607
|
+
return `"${envVar}" is not a credential var of the ${harness} harness${allowed.size > 0 ? ` (expected one of ${[...allowed].join(", ")})` : ""}.`;
|
|
22608
|
+
}
|
|
22609
|
+
if (suffixes.length === 0)
|
|
22610
|
+
return `The allowlist for ${envVar} is empty.`;
|
|
22611
|
+
}
|
|
22612
|
+
return null;
|
|
22613
|
+
}
|
|
22614
|
+
function dedupeCredentials(credentials) {
|
|
22615
|
+
if (!credentials)
|
|
22616
|
+
return credentials;
|
|
22617
|
+
return Object.fromEntries(Object.entries(credentials).map(([envVar, suffixes]) => [envVar, [...new Set(suffixes)]]));
|
|
22618
|
+
}
|
|
22444
22619
|
async function profileValueError(input) {
|
|
22445
22620
|
const modelError = await explicitModelError({
|
|
22446
22621
|
model: input.model,
|
|
@@ -22452,7 +22627,7 @@ async function profileValueError(input) {
|
|
|
22452
22627
|
if (input.effort && !isAlias(input.model) && !supportedReasoningLevels(input.harness, input.model).includes(input.effort)) {
|
|
22453
22628
|
return `Effort "${input.effort}" is not supported by ${input.model} on ${input.harness}.`;
|
|
22454
22629
|
}
|
|
22455
|
-
return
|
|
22630
|
+
return credentialsError(input.harness, input.model, input.credentials);
|
|
22456
22631
|
}
|
|
22457
22632
|
async function canWriteProfiles(req, res, myAgentId) {
|
|
22458
22633
|
const decision = can({
|
|
@@ -22495,7 +22670,7 @@ async function handleModelProfiles(req, res, pathSegments, queryParams, myAgentI
|
|
|
22495
22670
|
return true;
|
|
22496
22671
|
if (!await canWriteProfiles(req, res, myAgentId))
|
|
22497
22672
|
return true;
|
|
22498
|
-
const body = parsed.body;
|
|
22673
|
+
const body = { ...parsed.body, credentials: dedupeCredentials(parsed.body.credentials) };
|
|
22499
22674
|
const error = await profileValueError({ ...body, effort: body.effort ?? null });
|
|
22500
22675
|
if (error) {
|
|
22501
22676
|
jsonError(res, error, 400);
|
|
@@ -22522,12 +22697,13 @@ async function handleModelProfiles(req, res, pathSegments, queryParams, myAgentI
|
|
|
22522
22697
|
jsonError(res, "Model profile not found", 404);
|
|
22523
22698
|
return true;
|
|
22524
22699
|
}
|
|
22525
|
-
const body = parsed.body;
|
|
22700
|
+
const body = { ...parsed.body, credentials: dedupeCredentials(parsed.body.credentials) };
|
|
22526
22701
|
const error = await profileValueError({
|
|
22527
22702
|
harness: current.harness,
|
|
22528
22703
|
model: body.model ?? current.model,
|
|
22529
22704
|
effort: body.effort === undefined ? current.effort : body.effort,
|
|
22530
|
-
allowCustomModel: body.allowCustomModel ?? current.allowCustomModel
|
|
22705
|
+
allowCustomModel: body.allowCustomModel ?? current.allowCustomModel,
|
|
22706
|
+
credentials: body.credentials === undefined ? current.credentials : body.credentials
|
|
22531
22707
|
});
|
|
22532
22708
|
if (error) {
|
|
22533
22709
|
jsonError(res, error, 400);
|
|
@@ -22559,13 +22735,14 @@ async function handleModelProfiles(req, res, pathSegments, queryParams, myAgentI
|
|
|
22559
22735
|
return true;
|
|
22560
22736
|
}
|
|
22561
22737
|
const refs = await modelProfileReferences(current.name);
|
|
22562
|
-
if (refs.agentIds.length > 0 || refs.openTaskCount > 0) {
|
|
22563
|
-
|
|
22738
|
+
if (refs.agentIds.length > 0 || refs.openTaskCount > 0 || refs.scheduleIds.length > 0) {
|
|
22739
|
+
const schedules = refs.scheduleIds.length > 0 ? ` (${refs.scheduleIds.join(", ")})` : "";
|
|
22740
|
+
jsonError(res, `"${current.name}" is in use: default of ${refs.agentIds.length} agent(s), held by ${refs.openTaskCount} unfinished or awaiting-resume task(s), named by ${refs.scheduleIds.length} schedule(s)${schedules}.`, 409);
|
|
22564
22741
|
return true;
|
|
22565
22742
|
}
|
|
22566
22743
|
const outcome = await deleteModelProfile(current.name);
|
|
22567
22744
|
if (outcome === "in-use") {
|
|
22568
|
-
jsonError(res, `"${current.name}" is in use by a task or an agent default created just now.`, 409);
|
|
22745
|
+
jsonError(res, `"${current.name}" is in use by a task, a schedule or an agent default created just now.`, 409);
|
|
22569
22746
|
return true;
|
|
22570
22747
|
}
|
|
22571
22748
|
if (outcome === "missing") {
|
|
@@ -24625,7 +24802,7 @@ init_asset_key_auth();
|
|
|
24625
24802
|
init_audit_user();
|
|
24626
24803
|
init_db4();
|
|
24627
24804
|
init_model_profiles();
|
|
24628
|
-
|
|
24805
|
+
init_model_validation2();
|
|
24629
24806
|
init_rbac_roles();
|
|
24630
24807
|
init_session_shares();
|
|
24631
24808
|
init_steering2();
|
|
@@ -24746,6 +24923,8 @@ var AgentTaskSummarySchema = AgentTaskSchema.pick({
|
|
|
24746
24923
|
modelAlias: true,
|
|
24747
24924
|
effort: true,
|
|
24748
24925
|
resolvedEffort: true,
|
|
24926
|
+
profile: true,
|
|
24927
|
+
resolvedProfile: true,
|
|
24749
24928
|
provider: true,
|
|
24750
24929
|
requestedByUserId: true,
|
|
24751
24930
|
progress: true,
|
|
@@ -25204,7 +25383,8 @@ var listPausedTasks = route({
|
|
|
25204
25383
|
schema: object2({
|
|
25205
25384
|
tasks: array2(AgentTaskSchema.extend({
|
|
25206
25385
|
attachments: array2(TaskAttachmentSchema),
|
|
25207
|
-
requestedBy: TaskRequestedBySchema.optional()
|
|
25386
|
+
requestedBy: TaskRequestedBySchema.optional(),
|
|
25387
|
+
credentialAllowlist: ModelProfileCredentialsSchema.optional()
|
|
25208
25388
|
}))
|
|
25209
25389
|
})
|
|
25210
25390
|
}
|
|
@@ -25466,15 +25646,6 @@ async function handleTasks(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
25466
25646
|
jsonError(res, modelError, 400);
|
|
25467
25647
|
return true;
|
|
25468
25648
|
}
|
|
25469
|
-
const profileError = await taskProfileError({
|
|
25470
|
-
profile: parsed.body.profile,
|
|
25471
|
-
...splitLegacyModelAlias({ model: parsed.body.model, modelTier: parsed.body.modelTier }),
|
|
25472
|
-
agentId: defaultAgentId
|
|
25473
|
-
});
|
|
25474
|
-
if (profileError) {
|
|
25475
|
-
jsonError(res, profileError, 400);
|
|
25476
|
-
return true;
|
|
25477
|
-
}
|
|
25478
25649
|
const parentTask = parsed.body.parentTaskId ? await getTaskById2(parsed.body.parentTaskId) : null;
|
|
25479
25650
|
const principal = await resolveTaskWritePrincipal(req, myAgentId);
|
|
25480
25651
|
if (parentTask && await denyParentAttach2(req, res, myAgentId, parentTask, principal)) {
|
|
@@ -25488,6 +25659,16 @@ async function handleTasks(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
25488
25659
|
jsonError(res, "You don't have access to the tasks in this context.", 403);
|
|
25489
25660
|
return true;
|
|
25490
25661
|
}
|
|
25662
|
+
const profileError = await taskProfileError({
|
|
25663
|
+
profile: parsed.body.profile,
|
|
25664
|
+
...splitLegacyModelAlias({ model: parsed.body.model, modelTier: parsed.body.modelTier }),
|
|
25665
|
+
agentId: defaultAgentId,
|
|
25666
|
+
vcsRepo: parentTask?.vcsRepo
|
|
25667
|
+
});
|
|
25668
|
+
if (profileError) {
|
|
25669
|
+
jsonError(res, profileError, 400);
|
|
25670
|
+
return true;
|
|
25671
|
+
}
|
|
25491
25672
|
let assetKey;
|
|
25492
25673
|
try {
|
|
25493
25674
|
const inheritedKey = parentTask?.key;
|
|
@@ -26097,13 +26278,19 @@ async function handleTasks(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
26097
26278
|
const pausedTasks = await getPausedTasksForAgent2(myAgentId, readableByFor2(await resolveSessionActor2(req, myAgentId)));
|
|
26098
26279
|
const tasks = await Promise.all(pausedTasks.map(async (task) => {
|
|
26099
26280
|
const requestedBy = await buildTaskRequestedBy(task);
|
|
26281
|
+
const profile = task.resolvedProfile ? await getModelProfileByName(task.resolvedProfile) : null;
|
|
26282
|
+
if (profile && hasUnreadableCredentialAllowlist(profile)) {
|
|
26283
|
+
console.warn(`[paused-tasks] holding task ${task.id}: profile "${profile.name}" has an unreadable credential allowlist`);
|
|
26284
|
+
return null;
|
|
26285
|
+
}
|
|
26100
26286
|
return {
|
|
26101
26287
|
...task,
|
|
26102
26288
|
attachments: await getTaskAttachments2(task.id),
|
|
26103
|
-
...requestedBy && { requestedBy }
|
|
26289
|
+
...requestedBy && { requestedBy },
|
|
26290
|
+
...profile?.credentials && { credentialAllowlist: profile.credentials }
|
|
26104
26291
|
};
|
|
26105
26292
|
}));
|
|
26106
|
-
listPausedTasks.respond(res, 200, { tasks });
|
|
26293
|
+
listPausedTasks.respond(res, 200, { tasks: tasks.filter((task) => task !== null) });
|
|
26107
26294
|
return true;
|
|
26108
26295
|
}
|
|
26109
26296
|
if (pauseTaskRoute.match(req.method, pathSegments)) {
|
|
@@ -29618,8 +29805,9 @@ init_api_drain();
|
|
|
29618
29805
|
init_budget_admission();
|
|
29619
29806
|
init_budget_refusal_notify();
|
|
29620
29807
|
init_db4();
|
|
29808
|
+
init_model_profile_check();
|
|
29621
29809
|
init_model_tier_resolution();
|
|
29622
|
-
|
|
29810
|
+
init_model_validation2();
|
|
29623
29811
|
init_multi_runtime();
|
|
29624
29812
|
init_server();
|
|
29625
29813
|
|
|
@@ -29776,7 +29964,8 @@ var PollTaskAssignedTriggerSchema = object2({
|
|
|
29776
29964
|
taskId: string2(),
|
|
29777
29965
|
triggerSurface: string2().optional(),
|
|
29778
29966
|
task: AgentTaskSchema.extend({
|
|
29779
|
-
attachments: array2(PollTriggerAttachmentSchema)
|
|
29967
|
+
attachments: array2(PollTriggerAttachmentSchema),
|
|
29968
|
+
credentialAllowlist: ModelProfileCredentialsSchema.optional()
|
|
29780
29969
|
}),
|
|
29781
29970
|
requestedBy: TaskRequestedBySchema.optional()
|
|
29782
29971
|
});
|
|
@@ -29841,7 +30030,8 @@ async function claimModelFields(task, agent, auth) {
|
|
|
29841
30030
|
resolvedModel: undefined,
|
|
29842
30031
|
modelSource: undefined,
|
|
29843
30032
|
modelAlias: undefined,
|
|
29844
|
-
resolvedProfile: undefined
|
|
30033
|
+
resolvedProfile: undefined,
|
|
30034
|
+
credentialAllowlist: undefined
|
|
29845
30035
|
};
|
|
29846
30036
|
try {
|
|
29847
30037
|
return {
|
|
@@ -30048,7 +30238,22 @@ async function handlePoll(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
30048
30238
|
if (agent.isLead) {} else {
|
|
30049
30239
|
if (await hasCapacity2(myAgentId)) {
|
|
30050
30240
|
const harness = agent.harnessProvider ?? agent.provider ?? null;
|
|
30051
|
-
const
|
|
30241
|
+
const profileOk = new Map;
|
|
30242
|
+
const includeRepoSecrets = readsRepoSecrets(getRequestAuth(req), agent);
|
|
30243
|
+
const passesProfileCheck = async (profile, vcsRepo) => {
|
|
30244
|
+
const memoKey = JSON.stringify([profile, vcsRepo ?? null]);
|
|
30245
|
+
const cached = profileOk.get(memoKey);
|
|
30246
|
+
if (cached !== undefined)
|
|
30247
|
+
return cached;
|
|
30248
|
+
const result = await checkProfileForAgent(myAgentId, profile, {
|
|
30249
|
+
vcsRepo,
|
|
30250
|
+
includeRepoSecrets
|
|
30251
|
+
});
|
|
30252
|
+
const ok = result?.ok !== false;
|
|
30253
|
+
profileOk.set(memoKey, ok);
|
|
30254
|
+
return ok;
|
|
30255
|
+
};
|
|
30256
|
+
const unassignedIds = await getUnassignedTaskIdsForAgent2(myAgentId, 5, async (task) => await poolTaskRunsOnHarness(task, harness) && (!task.profile || await passesProfileCheck(task.profile, task.vcsRepo)));
|
|
30052
30257
|
if (unassignedIds.length > 0) {
|
|
30053
30258
|
const candidateId = unassignedIds[0];
|
|
30054
30259
|
const candidateTask = await getTaskById2(candidateId);
|
|
@@ -32087,7 +32292,8 @@ init_zod();
|
|
|
32087
32292
|
init_asset_key_auth();
|
|
32088
32293
|
init_audit_user();
|
|
32089
32294
|
init_db4();
|
|
32090
|
-
|
|
32295
|
+
init_model_profiles();
|
|
32296
|
+
init_model_validation2();
|
|
32091
32297
|
init_validate();
|
|
32092
32298
|
init_db3();
|
|
32093
32299
|
init_rbac();
|
|
@@ -32113,6 +32319,7 @@ var scheduleUpdateBodySchema = object2({
|
|
|
32113
32319
|
timezone: string2().optional(),
|
|
32114
32320
|
model: string2().nullable().optional(),
|
|
32115
32321
|
modelTier: ModelTierSchema.nullable().optional(),
|
|
32322
|
+
profile: string2().nullable().optional(),
|
|
32116
32323
|
allowCustomModel: boolean().optional(),
|
|
32117
32324
|
nextRunAt: string2().nullable().optional(),
|
|
32118
32325
|
targetType: ScheduledTaskTargetTypeSchema.optional(),
|
|
@@ -32154,6 +32361,7 @@ var createSchedule = route({
|
|
|
32154
32361
|
timezone: string2().optional(),
|
|
32155
32362
|
model: string2().optional(),
|
|
32156
32363
|
modelTier: ModelTierSchema.optional(),
|
|
32364
|
+
profile: string2().optional(),
|
|
32157
32365
|
allowCustomModel: boolean().optional(),
|
|
32158
32366
|
scheduleType: _enum2(["recurring", "one_time"]).optional(),
|
|
32159
32367
|
targetType: ScheduledTaskTargetTypeSchema.optional(),
|
|
@@ -32407,6 +32615,16 @@ async function handleSchedules(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
32407
32615
|
jsonError(res, modelError, 400);
|
|
32408
32616
|
return true;
|
|
32409
32617
|
}
|
|
32618
|
+
const profileError = await taskProfileError({
|
|
32619
|
+
profile: body.profile,
|
|
32620
|
+
model: body.model,
|
|
32621
|
+
modelTier: body.modelTier,
|
|
32622
|
+
agentId: body.targetAgentId
|
|
32623
|
+
});
|
|
32624
|
+
if (profileError) {
|
|
32625
|
+
jsonError(res, profileError, 400);
|
|
32626
|
+
return true;
|
|
32627
|
+
}
|
|
32410
32628
|
try {
|
|
32411
32629
|
const trustedUserId = await resolveHttpAuditUserId(req, myAgentId);
|
|
32412
32630
|
let key;
|
|
@@ -32449,6 +32667,7 @@ async function handleSchedules(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
32449
32667
|
nextRunAt,
|
|
32450
32668
|
timezone: body.timezone,
|
|
32451
32669
|
...splitLegacyModelAlias({ model: body.model, modelTier: body.modelTier }),
|
|
32670
|
+
profile: body.profile?.trim() || undefined,
|
|
32452
32671
|
scheduleType: body.scheduleType,
|
|
32453
32672
|
targetType: body.targetType,
|
|
32454
32673
|
workflowId: body.workflowId,
|
|
@@ -32460,7 +32679,11 @@ async function handleSchedules(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
32460
32679
|
createdBy: await resolveHttpAuditUserId(req, myAgentId) ?? undefined
|
|
32461
32680
|
});
|
|
32462
32681
|
createSchedule.respond(res, 201, schedule);
|
|
32463
|
-
} catch (
|
|
32682
|
+
} catch (error) {
|
|
32683
|
+
if (modelProfileRefError(error) === "missing") {
|
|
32684
|
+
jsonError(res, `Unknown model profile "${body.profile}".`, 400);
|
|
32685
|
+
return true;
|
|
32686
|
+
}
|
|
32464
32687
|
jsonError(res, "Failed to create schedule", 500);
|
|
32465
32688
|
}
|
|
32466
32689
|
return true;
|
|
@@ -32555,6 +32778,11 @@ async function handleSchedules(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
32555
32778
|
}
|
|
32556
32779
|
}
|
|
32557
32780
|
const agentChanged = parsed.body.targetAgentId !== undefined && parsed.body.targetAgentId !== existing.targetAgentId;
|
|
32781
|
+
const profileUpdate = await scheduleProfileUpdate(existing, parsed.body);
|
|
32782
|
+
if (profileUpdate.error !== undefined) {
|
|
32783
|
+
jsonError(res, profileUpdate.error, 400);
|
|
32784
|
+
return true;
|
|
32785
|
+
}
|
|
32558
32786
|
if (parsed.body.model !== undefined || parsed.body.modelTier !== undefined) {
|
|
32559
32787
|
const normalizedModel = splitLegacyModelAlias({
|
|
32560
32788
|
model: parsed.body.model,
|
|
@@ -32576,7 +32804,7 @@ async function handleSchedules(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
32576
32804
|
if (parsed.body.modelTier !== undefined || normalizedModel.modelTier) {
|
|
32577
32805
|
body.modelTier = normalizedModel.modelTier ?? null;
|
|
32578
32806
|
}
|
|
32579
|
-
} else if (agentChanged && existing.model) {
|
|
32807
|
+
} else if (agentChanged && existing.model && !profileUpdate.fields.profile) {
|
|
32580
32808
|
const modelError = await explicitModelErrorForAgent({
|
|
32581
32809
|
model: existing.model,
|
|
32582
32810
|
allowCustomModel: true,
|
|
@@ -32587,6 +32815,7 @@ async function handleSchedules(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
32587
32815
|
return true;
|
|
32588
32816
|
}
|
|
32589
32817
|
}
|
|
32818
|
+
Object.assign(body, profileUpdate.fields);
|
|
32590
32819
|
if (existing.scheduleType === "one_time" && !existing.enabled && existing.lastRunAt) {
|
|
32591
32820
|
jsonError(res, "One-time schedule has already executed. Create a new one instead.", 400);
|
|
32592
32821
|
return true;
|
|
@@ -32681,7 +32910,15 @@ async function handleSchedules(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
32681
32910
|
const updatedBy = await resolveHttpAuditUserId(req, myAgentId);
|
|
32682
32911
|
if (updatedBy !== null)
|
|
32683
32912
|
body.updatedBy = updatedBy;
|
|
32684
|
-
|
|
32913
|
+
let schedule;
|
|
32914
|
+
try {
|
|
32915
|
+
schedule = await updateScheduledTask2(parsed.params.id, body);
|
|
32916
|
+
} catch (error) {
|
|
32917
|
+
if (modelProfileRefError(error) !== "missing")
|
|
32918
|
+
throw error;
|
|
32919
|
+
jsonError(res, `Unknown model profile "${body.profile}".`, 400);
|
|
32920
|
+
return true;
|
|
32921
|
+
}
|
|
32685
32922
|
routeHandle.respond(res, 200, schedule);
|
|
32686
32923
|
return true;
|
|
32687
32924
|
}
|
|
@@ -34754,7 +34991,7 @@ async function handleScriptConnections(req, res, pathSegments, queryParams, agen
|
|
|
34754
34991
|
// src/http/script-runs.ts
|
|
34755
34992
|
init_zod();
|
|
34756
34993
|
init_db4();
|
|
34757
|
-
|
|
34994
|
+
init_model_validation2();
|
|
34758
34995
|
|
|
34759
34996
|
// src/be/scripts/source-secrets.ts
|
|
34760
34997
|
init_secret_scrubber();
|
|
@@ -37838,8 +38075,12 @@ async function handleSessions(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
37838
38075
|
hideSource: parsed.query.hideSource,
|
|
37839
38076
|
showSource: parsed.query.showSource
|
|
37840
38077
|
});
|
|
37841
|
-
const { sourceGroups, slackChannels, threadLabels, ...counts } = tree;
|
|
37842
|
-
const
|
|
38078
|
+
const { sourceGroups, slackChannels, threadLabels, resourceGroups, ...counts } = tree;
|
|
38079
|
+
const [sourceLabels, resourceLabels] = await Promise.all([
|
|
38080
|
+
getSessionLabels(sourceGroups),
|
|
38081
|
+
getResourceSessionLabels(resourceGroups)
|
|
38082
|
+
]);
|
|
38083
|
+
const labels = { ...threadLabels, ...sourceLabels, ...resourceLabels };
|
|
37843
38084
|
warmSlackChannelLabels(slackChannels.map((id) => `shared/slack/${id}/`).filter((key) => labels[key] === undefined));
|
|
37844
38085
|
sessionTree.respond(res, 200, { ...counts, labels });
|
|
37845
38086
|
return true;
|
|
@@ -37893,6 +38134,10 @@ async function handleSessions(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
37893
38134
|
jsonError(res, SOURCE_GROUPS_READ_ONLY, 400);
|
|
37894
38135
|
return true;
|
|
37895
38136
|
}
|
|
38137
|
+
if (isResourceGroupPrefix(from) || parsed.body.to && isResourceGroupPrefix(normalizeAssetKey(parsed.body.to))) {
|
|
38138
|
+
jsonError(res, RESOURCE_GROUPS_READ_ONLY, 400);
|
|
38139
|
+
return true;
|
|
38140
|
+
}
|
|
37896
38141
|
if (parseAssetKey(from).relativeSegments.length === 0) {
|
|
37897
38142
|
jsonError(res, "Cannot move a namespace root", 400);
|
|
37898
38143
|
return true;
|
|
@@ -42151,6 +42396,32 @@ async function runBlockableHandler(source, handler) {
|
|
|
42151
42396
|
return { created: false, skipped: true, reason: err.reason, extension: err.extension };
|
|
42152
42397
|
}
|
|
42153
42398
|
}
|
|
42399
|
+
var GITHUB_VERIFIED_EVENTS = new Set([
|
|
42400
|
+
"ping",
|
|
42401
|
+
"pull_request",
|
|
42402
|
+
"issues",
|
|
42403
|
+
"issue_comment",
|
|
42404
|
+
"pull_request_review_comment",
|
|
42405
|
+
"pull_request_review"
|
|
42406
|
+
]);
|
|
42407
|
+
var GITHUB_IGNORED_SUMMARY_MS = 60000;
|
|
42408
|
+
var githubIgnoredCounts = new Map;
|
|
42409
|
+
var githubIgnoredTimer = null;
|
|
42410
|
+
function flushGithubIgnoredCounts() {
|
|
42411
|
+
if (githubIgnoredCounts.size === 0)
|
|
42412
|
+
return;
|
|
42413
|
+
const parts = [...githubIgnoredCounts.entries()].map(([name, n]) => `${name}=${n}`);
|
|
42414
|
+
githubIgnoredCounts.clear();
|
|
42415
|
+
console.log(`[GitHub] ignored events last ${GITHUB_IGNORED_SUMMARY_MS / 1000}s: ${parts.join(" ")}`);
|
|
42416
|
+
}
|
|
42417
|
+
function countGithubIgnoredEvent(eventType) {
|
|
42418
|
+
const key = githubIgnoredCounts.has(eventType) || githubIgnoredCounts.size < 50 ? eventType : "other";
|
|
42419
|
+
githubIgnoredCounts.set(key, (githubIgnoredCounts.get(key) ?? 0) + 1);
|
|
42420
|
+
if (!githubIgnoredTimer) {
|
|
42421
|
+
githubIgnoredTimer = setInterval(flushGithubIgnoredCounts, GITHUB_IGNORED_SUMMARY_MS);
|
|
42422
|
+
githubIgnoredTimer.unref();
|
|
42423
|
+
}
|
|
42424
|
+
}
|
|
42154
42425
|
var githubWebhook = route({
|
|
42155
42426
|
method: "post",
|
|
42156
42427
|
path: "/api/github/webhook",
|
|
@@ -42355,6 +42626,12 @@ async function handleWebhooks(req, res, pathSegments) {
|
|
|
42355
42626
|
}
|
|
42356
42627
|
const eventType = req.headers["x-github-event"];
|
|
42357
42628
|
const signature = req.headers["x-hub-signature-256"];
|
|
42629
|
+
if (typeof eventType === "string" && eventType && !GITHUB_VERIFIED_EVENTS.has(eventType)) {
|
|
42630
|
+
countGithubIgnoredEvent(eventType);
|
|
42631
|
+
githubWebhook.respond(res, 200, { created: false });
|
|
42632
|
+
req.resume();
|
|
42633
|
+
return true;
|
|
42634
|
+
}
|
|
42358
42635
|
const chunks = [];
|
|
42359
42636
|
for await (const chunk of req) {
|
|
42360
42637
|
chunks.push(chunk);
|
|
@@ -43062,7 +43339,7 @@ init_workflows();
|
|
|
43062
43339
|
init_definition2();
|
|
43063
43340
|
init_engine();
|
|
43064
43341
|
init_json_schema_validator();
|
|
43065
|
-
|
|
43342
|
+
init_model_validation();
|
|
43066
43343
|
init_patch_definition();
|
|
43067
43344
|
init_readiness();
|
|
43068
43345
|
init_resume();
|
|
@@ -43368,6 +43645,7 @@ var retryWorkflowRunRoute = route({
|
|
|
43368
43645
|
path: "/api/workflow-runs/{id}/retry",
|
|
43369
43646
|
pattern: ["api", "workflow-runs", null, "retry"],
|
|
43370
43647
|
summary: "Retry a failed workflow run",
|
|
43648
|
+
description: "Retries on the definition the run started with; to use an edited workflow, trigger a new run.",
|
|
43371
43649
|
tags: ["Workflows"],
|
|
43372
43650
|
params: object2({ id: string2() }),
|
|
43373
43651
|
responses: {
|
|
@@ -43573,7 +43851,9 @@ async function handleWorkflows(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
43573
43851
|
jsonError(res, `Invalid definition: ${validation.errors.join("; ")}`, 400);
|
|
43574
43852
|
return true;
|
|
43575
43853
|
}
|
|
43576
|
-
const modelErrors = await workflowModelErrors(parsed.body.definition
|
|
43854
|
+
const modelErrors = await workflowModelErrors(parsed.body.definition, {
|
|
43855
|
+
vcsRepo: parsed.body.vcsRepo
|
|
43856
|
+
});
|
|
43577
43857
|
if (modelErrors.length > 0) {
|
|
43578
43858
|
jsonError(res, `Invalid definition: ${modelErrors.join("; ")}`, 400);
|
|
43579
43859
|
return true;
|
|
@@ -43755,7 +44035,13 @@ async function handleWorkflows(req, res, pathSegments, queryParams, myAgentId) {
|
|
|
43755
44035
|
jsonError(res, `Invalid definition: ${validation.errors.join("; ")}`, 400);
|
|
43756
44036
|
return true;
|
|
43757
44037
|
}
|
|
43758
|
-
|
|
44038
|
+
}
|
|
44039
|
+
const repoChanged = body.vcsRepo !== undefined && (body.vcsRepo ?? null) !== (existing.vcsRepo ?? null);
|
|
44040
|
+
const judged = body.definition ?? (repoChanged ? existing.definition : undefined);
|
|
44041
|
+
if (judged) {
|
|
44042
|
+
const modelErrors = await workflowModelErrors(judged, {
|
|
44043
|
+
vcsRepo: body.vcsRepo === undefined ? existing.vcsRepo : body.vcsRepo
|
|
44044
|
+
});
|
|
43759
44045
|
if (modelErrors.length > 0) {
|
|
43760
44046
|
jsonError(res, `Invalid definition: ${modelErrors.join("; ")}`, 400);
|
|
43761
44047
|
return true;
|
|
@@ -44238,7 +44524,7 @@ function startApiGcInterval() {
|
|
|
44238
44524
|
console.log("[HTTP] Explicit GC unavailable; idle MCP transport sweeps remain enabled");
|
|
44239
44525
|
}
|
|
44240
44526
|
const interval = setInterval(() => {
|
|
44241
|
-
sweepRooms().catch((error) => console.error("[rooms] Sweep failed:", scrubSecrets(String(error))));
|
|
44527
|
+
withLoopPath("http.gc-interval", () => sweepRooms()).catch((error) => console.error("[rooms] Sweep failed:", scrubSecrets(String(error))));
|
|
44242
44528
|
const closedOwnerTransports = closeIdleMcpTransports(transports, transportActivity, {
|
|
44243
44529
|
idleTimeoutMs: MCP_TRANSPORT_IDLE_TIMEOUT_MS,
|
|
44244
44530
|
label: "MCP",
|
|
@@ -44406,15 +44692,11 @@ var httpServer = createHttpServer(async (req, res) => {
|
|
|
44406
44692
|
writeUnhandledError(res, err, req);
|
|
44407
44693
|
}
|
|
44408
44694
|
};
|
|
44409
|
-
|
|
44410
|
-
await withSpanContext2(span, handleRequest);
|
|
44411
|
-
} else {
|
|
44412
|
-
await handleRequest();
|
|
44413
|
-
}
|
|
44695
|
+
await withLoopPath(loopPathForRequest(req.method, pathSegments), () => span ? withSpanContext2(span, handleRequest) : handleRequest());
|
|
44414
44696
|
});
|
|
44415
44697
|
});
|
|
44416
44698
|
var detachRealtime = attachRealtimeTransport(httpServer);
|
|
44417
|
-
var { attachControllerTransport } = await import("./controllers-connect-
|
|
44699
|
+
var { attachControllerTransport } = await import("./controllers-connect-e2b4gyxc.js");
|
|
44418
44700
|
var detachControllers = attachControllerTransport(httpServer);
|
|
44419
44701
|
var stopWorkerNudges = startWorkerNudgeListener();
|
|
44420
44702
|
var taskAutoTitles = startTaskAutoTitleListener();
|
|
@@ -44445,7 +44727,7 @@ async function shutdown() {
|
|
|
44445
44727
|
sessionsProcessed: getServerSessionsProcessed()
|
|
44446
44728
|
});
|
|
44447
44729
|
if (hasCapability("scheduling")) {
|
|
44448
|
-
const { stopScheduler } = await import("./index-
|
|
44730
|
+
const { stopScheduler } = await import("./index-835xdgnm.js");
|
|
44449
44731
|
stopScheduler();
|
|
44450
44732
|
}
|
|
44451
44733
|
stopHeartbeat2();
|
|
@@ -44457,7 +44739,7 @@ async function shutdown() {
|
|
|
44457
44739
|
await stopSlackApp2();
|
|
44458
44740
|
await stopChatSdk();
|
|
44459
44741
|
if (!isEnvFlagEnabled("OAUTH_KEEPALIVE_DISABLE", false)) {
|
|
44460
|
-
const { stopOAuthKeepalive } = await import("./keepalive-
|
|
44742
|
+
const { stopOAuthKeepalive } = await import("./keepalive-4zsrce78.js");
|
|
44461
44743
|
await stopOAuthKeepalive();
|
|
44462
44744
|
}
|
|
44463
44745
|
stopOAuthPendingGc();
|
|
@@ -44476,6 +44758,7 @@ async function shutdown() {
|
|
|
44476
44758
|
clearInterval(globalState.__apiGcInterval);
|
|
44477
44759
|
delete globalState.__apiGcInterval;
|
|
44478
44760
|
}
|
|
44761
|
+
stopEventLoopLagProbe();
|
|
44479
44762
|
for (const [id, transport] of Object.entries(transports)) {
|
|
44480
44763
|
console.log(`[HTTP] Closing transport ${id}`);
|
|
44481
44764
|
transport.close();
|
|
@@ -44513,6 +44796,7 @@ if (!globalState.__runId) {
|
|
|
44513
44796
|
globalState.__runId = `run_${Date.now()}`;
|
|
44514
44797
|
}
|
|
44515
44798
|
startApiGcInterval();
|
|
44799
|
+
startEventLoopLagProbe();
|
|
44516
44800
|
var startupConfigsInjected = [];
|
|
44517
44801
|
try {
|
|
44518
44802
|
startupConfigsInjected = await loadGlobalConfigsIntoEnv(true);
|
|
@@ -44539,21 +44823,21 @@ try {
|
|
|
44539
44823
|
console.warn("[startup] CAPABILITIES upgrade seed failed (non-fatal):", err);
|
|
44540
44824
|
}
|
|
44541
44825
|
try {
|
|
44542
|
-
const { ensurePricingSeeded } = await import("./boot-seeds-
|
|
44826
|
+
const { ensurePricingSeeded } = await import("./boot-seeds-x42tzytw.js");
|
|
44543
44827
|
ensurePricingSeeded();
|
|
44544
|
-
const { startPricingRefreshLoop } = await import("./pricing-refresh-
|
|
44828
|
+
const { startPricingRefreshLoop } = await import("./pricing-refresh-1rgzqyzz.js");
|
|
44545
44829
|
startPricingRefreshLoop();
|
|
44546
44830
|
} catch (err) {
|
|
44547
44831
|
console.error("[startup] Failed to seed pricing rows:", err);
|
|
44548
44832
|
}
|
|
44549
44833
|
try {
|
|
44550
|
-
const { ensureModelProfilesSeeded } = await import("./boot-seeds-
|
|
44834
|
+
const { ensureModelProfilesSeeded } = await import("./boot-seeds-x42tzytw.js");
|
|
44551
44835
|
await ensureModelProfilesSeeded();
|
|
44552
44836
|
} catch (err) {
|
|
44553
44837
|
console.error("[startup] Failed to seed model profiles:", err);
|
|
44554
44838
|
}
|
|
44555
44839
|
try {
|
|
44556
|
-
const { ensureRbacSeeded } = await import("./boot-seeds-
|
|
44840
|
+
const { ensureRbacSeeded } = await import("./boot-seeds-x42tzytw.js");
|
|
44557
44841
|
ensureRbacSeeded();
|
|
44558
44842
|
} catch (err) {
|
|
44559
44843
|
console.error("[startup] Failed to sync RBAC seed rows:", err);
|
|
@@ -44561,7 +44845,7 @@ try {
|
|
|
44561
44845
|
throw err;
|
|
44562
44846
|
}
|
|
44563
44847
|
try {
|
|
44564
|
-
const { runAllSeeders } = await import("./index-
|
|
44848
|
+
const { runAllSeeders } = await import("./index-vk63emp7.js");
|
|
44565
44849
|
await runAllSeeders({ scriptEmbeddingMode: "skip" });
|
|
44566
44850
|
} catch (err) {
|
|
44567
44851
|
console.error("[startup] Failed to seed built-in entities:", err);
|
|
@@ -44624,26 +44908,25 @@ httpServer.listen(port, async () => {
|
|
|
44624
44908
|
await initWorkflows2();
|
|
44625
44909
|
await startScriptRunSupervisor(getMcpBaseUrl());
|
|
44626
44910
|
if (hasCapability("scheduling")) {
|
|
44627
|
-
const { startScheduler } = await import("./index-
|
|
44628
|
-
const { getExecutorRegistry } = await import("./index-
|
|
44911
|
+
const { startScheduler } = await import("./index-835xdgnm.js");
|
|
44912
|
+
const { getExecutorRegistry } = await import("./index-d469300x.js");
|
|
44629
44913
|
const intervalMs = Number(process.env.SCHEDULER_INTERVAL_MS) || 1e4;
|
|
44630
44914
|
startScheduler(getExecutorRegistry(), intervalMs, {
|
|
44631
44915
|
runId: globalState.__runId
|
|
44632
44916
|
});
|
|
44633
44917
|
}
|
|
44634
44918
|
if (!isEnvFlagEnabled("HEARTBEAT_DISABLE", false)) {
|
|
44635
|
-
const { startHeartbeat } = await import("./index-
|
|
44636
|
-
|
|
44637
|
-
startHeartbeat(heartbeatMs);
|
|
44919
|
+
const { parseHeartbeatIntervalMs, startHeartbeat } = await import("./index-rzqwp11g.js");
|
|
44920
|
+
startHeartbeat(parseHeartbeatIntervalMs(process.env.HEARTBEAT_INTERVAL_MS));
|
|
44638
44921
|
}
|
|
44639
44922
|
startPoolRouting();
|
|
44640
44923
|
startRuntimeSupervisor();
|
|
44641
44924
|
if (!isEnvFlagEnabled("OAUTH_KEEPALIVE_DISABLE", false)) {
|
|
44642
|
-
const { startOAuthKeepalive } = await import("./keepalive-
|
|
44925
|
+
const { startOAuthKeepalive } = await import("./keepalive-4zsrce78.js");
|
|
44643
44926
|
startOAuthKeepalive();
|
|
44644
44927
|
}
|
|
44645
44928
|
if (!isEnvFlagEnabled("OAUTH_REFRESH_SWEEP_DISABLE", false)) {
|
|
44646
|
-
const { startOAuthRefreshSweep } = await import("./oauth-refresh-sweep-
|
|
44929
|
+
const { startOAuthRefreshSweep } = await import("./oauth-refresh-sweep-j52kg9pr.js");
|
|
44647
44930
|
startOAuthRefreshSweep();
|
|
44648
44931
|
}
|
|
44649
44932
|
startOAuthPendingGc();
|
|
@@ -44652,19 +44935,19 @@ httpServer.listen(port, async () => {
|
|
|
44652
44935
|
await startDbRetention();
|
|
44653
44936
|
startHumanFreeDrain();
|
|
44654
44937
|
startTaskSearchBackfill();
|
|
44655
|
-
import("./embedding-space-
|
|
44938
|
+
import("./embedding-space-crsm2zp0.js").then(({ runEmbeddingMaintenance, setDeploymentEnvReader }) => {
|
|
44656
44939
|
setDeploymentEnvReader(getDeploymentEnvValue);
|
|
44657
44940
|
return runEmbeddingMaintenance({ backfill: true });
|
|
44658
44941
|
}).catch((err) => {
|
|
44659
44942
|
console.error("[embedding-space] startup maintenance failed (non-fatal):", err);
|
|
44660
44943
|
});
|
|
44661
|
-
import("./boot-args-schema-
|
|
44944
|
+
import("./boot-args-schema-2t37e0fe.js").then(({ runBootArgsSchemaBackfill }) => runBootArgsSchemaBackfill()).catch((err) => {
|
|
44662
44945
|
console.error("[boot-args-schema] startup backfill failed (non-fatal):", err);
|
|
44663
44946
|
});
|
|
44664
|
-
import("./boot-scrub-sweep-
|
|
44947
|
+
import("./boot-scrub-sweep-65sdnp6c.js").then(({ runBootScrubSweep }) => runBootScrubSweep()).catch((err) => {
|
|
44665
44948
|
console.error("[boot-scrub-sweep] startup scrub failed (non-fatal):", err);
|
|
44666
44949
|
});
|
|
44667
|
-
import("./session-source-backfill-
|
|
44950
|
+
import("./session-source-backfill-1d5pdwww.js").then(({ runSessionSourceBackfill }) => runSessionSourceBackfill()).catch((err) => {
|
|
44668
44951
|
console.error("[session-source-backfill] startup run failed (non-fatal):", err);
|
|
44669
44952
|
});
|
|
44670
44953
|
}).on("error", (err) => {
|