@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
|
@@ -35,6 +35,9 @@ import {
|
|
|
35
35
|
placeholderForConfigKey,
|
|
36
36
|
assertUrlSafe,
|
|
37
37
|
init_credential_broker,
|
|
38
|
+
withLoopPath,
|
|
39
|
+
bindLoopPath,
|
|
40
|
+
init_event_loop_lag,
|
|
38
41
|
isInTransaction,
|
|
39
42
|
init_db_client,
|
|
40
43
|
breaksJsonValidity,
|
|
@@ -45,6 +48,13 @@ import {
|
|
|
45
48
|
getDb2,
|
|
46
49
|
getDbClient2,
|
|
47
50
|
init_runtime2,
|
|
51
|
+
isRbacEnabled,
|
|
52
|
+
decideAdmission,
|
|
53
|
+
grantLeadEquivalence,
|
|
54
|
+
revokeLeadEquivalence,
|
|
55
|
+
init_elevated_agents,
|
|
56
|
+
can,
|
|
57
|
+
init_rbac,
|
|
48
58
|
CHAT_SDK_ADAPTER_NAMES,
|
|
49
59
|
CHAT_SDK_ADAPTER_SCHEMAS,
|
|
50
60
|
ChatSdkAdaptersDraftSchema,
|
|
@@ -58,8 +68,6 @@ import {
|
|
|
58
68
|
parseFollowUpGateScheduleIds,
|
|
59
69
|
isFollowUpGateScheduleId,
|
|
60
70
|
init_follow_up_gate_schedule_ids,
|
|
61
|
-
tierConfigKey,
|
|
62
|
-
init_model_tier_keys,
|
|
63
71
|
isInternalConfigKey,
|
|
64
72
|
internalConfigKeyError,
|
|
65
73
|
isReservedConfigKey,
|
|
@@ -94,6 +102,14 @@ import {
|
|
|
94
102
|
computeContentHash2,
|
|
95
103
|
getContextVersion2,
|
|
96
104
|
getContextVersionHistory2,
|
|
105
|
+
taskModelPin,
|
|
106
|
+
init_model_pin,
|
|
107
|
+
upsertModelCatalogOverlay,
|
|
108
|
+
init_model_catalog_store,
|
|
109
|
+
explicitModelErrorForAgent,
|
|
110
|
+
init_model_validation2,
|
|
111
|
+
checkProfileForAgent,
|
|
112
|
+
init_model_profile_check,
|
|
97
113
|
getTaskById2,
|
|
98
114
|
hasNonTerminalRerouteDecisionChild2,
|
|
99
115
|
getAgentCurrentTask2,
|
|
@@ -113,6 +129,7 @@ import {
|
|
|
113
129
|
getLatestTaskByContextKey2,
|
|
114
130
|
getAgentWorkingOnThread2,
|
|
115
131
|
getAgentWorkingOnContextKey2,
|
|
132
|
+
getLatestTaskByContextKeyPrefix2,
|
|
116
133
|
getLatestActiveTaskByContextKey2,
|
|
117
134
|
getLatestLeadTaskByContextKey2,
|
|
118
135
|
findCompletedTasksInThread2,
|
|
@@ -121,11 +138,9 @@ import {
|
|
|
121
138
|
findRecentCancelledTaskInThread2,
|
|
122
139
|
init_read,
|
|
123
140
|
listModelProfiles,
|
|
124
|
-
getModelProfileByName,
|
|
125
141
|
modelProfileRefError,
|
|
126
|
-
getAgentDefaultProfileName,
|
|
127
|
-
repoModelOverrideKeys,
|
|
128
142
|
taskProfileError,
|
|
143
|
+
scheduleProfileUpdate,
|
|
129
144
|
init_model_profiles,
|
|
130
145
|
onTaskStarted,
|
|
131
146
|
init_task_lifecycle_events,
|
|
@@ -138,11 +153,13 @@ import {
|
|
|
138
153
|
getAuthorizationById,
|
|
139
154
|
getOAuthTokens,
|
|
140
155
|
init_oauth,
|
|
156
|
+
LEARNING_TTL_DAYS,
|
|
141
157
|
LEARNING_DUPLICATE_MIN_SIMILARITY,
|
|
142
158
|
CANDIDATE_SET_MULTIPLIER,
|
|
143
159
|
isGraphExpansionEnabled,
|
|
144
160
|
init_constants2,
|
|
145
161
|
LONGTERM_ROOT,
|
|
162
|
+
LEARNINGS_ROOT,
|
|
146
163
|
MEMORY_KEY_PATTERN,
|
|
147
164
|
MEMORY_KEY_PATTERN_MESSAGE,
|
|
148
165
|
MEMORY_KEY_MAX_LENGTH,
|
|
@@ -202,6 +219,7 @@ import {
|
|
|
202
219
|
findAcceptedWorkflowOperation,
|
|
203
220
|
recordAcceptedWorkflowOperation,
|
|
204
221
|
init_workflow_idempotency,
|
|
222
|
+
getRunWorkflow2,
|
|
205
223
|
recordSlackMessage2,
|
|
206
224
|
getSlackTreeMessageByThread2,
|
|
207
225
|
markTaskSlackReplySent2,
|
|
@@ -357,30 +375,23 @@ import {
|
|
|
357
375
|
recordInlineScriptRun2,
|
|
358
376
|
exports_db,
|
|
359
377
|
init_db4
|
|
360
|
-
} from "./cli-
|
|
378
|
+
} from "./cli-h38x262p.js";
|
|
361
379
|
import {
|
|
362
380
|
assertMayActOnOperatorGrantedTarget2,
|
|
363
381
|
getUserGrant2,
|
|
364
382
|
init_rbac_roles
|
|
365
|
-
} from "./cli-
|
|
383
|
+
} from "./cli-c55z5chy.js";
|
|
366
384
|
import {
|
|
367
385
|
ensurePricingSeeded2,
|
|
368
386
|
ensureRbacSeeded2,
|
|
369
387
|
ensureModelProfilesSeeded2,
|
|
370
388
|
init_boot_seeds
|
|
371
|
-
} from "./cli-
|
|
389
|
+
} from "./cli-4txa0ter.js";
|
|
372
390
|
import {
|
|
373
|
-
buildCatalogEntries,
|
|
374
|
-
listModelCatalog,
|
|
375
|
-
listModelCatalogOverlay,
|
|
376
|
-
upsertModelCatalogOverlay,
|
|
377
|
-
getCatalogGeneration,
|
|
378
|
-
loadModelsCatalog,
|
|
379
|
-
init_model_catalog_store,
|
|
380
391
|
requestModelCatalogRefresh2,
|
|
381
392
|
startPricingRefreshLoop2,
|
|
382
393
|
init_pricing_refresh
|
|
383
|
-
} from "./cli-
|
|
394
|
+
} from "./cli-f3vq58d2.js";
|
|
384
395
|
import {
|
|
385
396
|
workflowEventBus2,
|
|
386
397
|
init_event_bus
|
|
@@ -393,10 +404,12 @@ import {
|
|
|
393
404
|
externalChannelToolError2,
|
|
394
405
|
getChannelBlockReason2,
|
|
395
406
|
init_external_channel
|
|
396
|
-
} from "./cli-
|
|
407
|
+
} from "./cli-qsnnd04k.js";
|
|
397
408
|
import {
|
|
398
409
|
noteSlackInboundSideEffect,
|
|
399
410
|
init_inbound_dispatch,
|
|
411
|
+
runSlackLifecycleExclusive,
|
|
412
|
+
init_lifecycle_lock,
|
|
400
413
|
terminalReactionEvent,
|
|
401
414
|
init_reaction_events,
|
|
402
415
|
withSpan2,
|
|
@@ -428,9 +441,9 @@ import {
|
|
|
428
441
|
init_responses,
|
|
429
442
|
getSlackApp2,
|
|
430
443
|
startSlackApp2,
|
|
431
|
-
|
|
444
|
+
stopSlackAppUnderLifecycleLock2,
|
|
432
445
|
init_app3
|
|
433
|
-
} from "./cli-
|
|
446
|
+
} from "./cli-p1bq50aa.js";
|
|
434
447
|
import {
|
|
435
448
|
shapeApprovalResolution,
|
|
436
449
|
init_approval_resolution,
|
|
@@ -454,7 +467,7 @@ import {
|
|
|
454
467
|
resumeFromChildRun2,
|
|
455
468
|
initWaitBusSubscriptions2,
|
|
456
469
|
init_resume
|
|
457
|
-
} from "./cli-
|
|
470
|
+
} from "./cli-pasjcnmj.js";
|
|
458
471
|
import {
|
|
459
472
|
FilesError,
|
|
460
473
|
providerPath,
|
|
@@ -464,11 +477,15 @@ import {
|
|
|
464
477
|
init_agent_fs_provider,
|
|
465
478
|
getFileStorageProvider2,
|
|
466
479
|
init_registry2
|
|
467
|
-
} from "./cli-
|
|
480
|
+
} from "./cli-7cp6aa1q.js";
|
|
481
|
+
import {
|
|
482
|
+
tableToAscii2,
|
|
483
|
+
init_dist4
|
|
484
|
+
} from "./cli-n9ftpys4.js";
|
|
468
485
|
import {
|
|
469
486
|
getRuntimePool2,
|
|
470
487
|
init_db2
|
|
471
|
-
} from "./cli-
|
|
488
|
+
} from "./cli-8kzasymh.js";
|
|
472
489
|
import {
|
|
473
490
|
duplicateGuardedQueryKey,
|
|
474
491
|
parseQueryParams,
|
|
@@ -501,19 +518,13 @@ import {
|
|
|
501
518
|
findRoute,
|
|
502
519
|
route,
|
|
503
520
|
init_route_def
|
|
504
|
-
} from "./cli-
|
|
521
|
+
} from "./cli-m28atx8q.js";
|
|
505
522
|
import {
|
|
506
523
|
COMPOSIO_HTTP_METHODS,
|
|
507
524
|
executeComposioRequest,
|
|
508
525
|
composioArgsFromParts,
|
|
509
526
|
init_composio
|
|
510
527
|
} from "./cli-28fq781p.js";
|
|
511
|
-
import {
|
|
512
|
-
ampPinProviderError,
|
|
513
|
-
ampPinCatalogError,
|
|
514
|
-
ampModelError,
|
|
515
|
-
init_amp_models
|
|
516
|
-
} from "./cli-qkdmz8c8.js";
|
|
517
528
|
import {
|
|
518
529
|
object,
|
|
519
530
|
init_v4_mini
|
|
@@ -531,10 +542,6 @@ import {
|
|
|
531
542
|
LlmRater,
|
|
532
543
|
init_llm
|
|
533
544
|
} from "./cli-2xv18ywz.js";
|
|
534
|
-
import {
|
|
535
|
-
loadModelsDevCache,
|
|
536
|
-
init_modelsdev_cache
|
|
537
|
-
} from "./cli-a0657jmf.js";
|
|
538
545
|
import {
|
|
539
546
|
require_dist2,
|
|
540
547
|
ConnectionAuthInputSchema,
|
|
@@ -613,7 +620,7 @@ import {
|
|
|
613
620
|
init_typecheck,
|
|
614
621
|
parseSkillContent,
|
|
615
622
|
init_skill_parser
|
|
616
|
-
} from "./cli-
|
|
623
|
+
} from "./cli-j790gp2w.js";
|
|
617
624
|
import {
|
|
618
625
|
detachedProcessGroup,
|
|
619
626
|
registerProcessGroup,
|
|
@@ -628,7 +635,7 @@ import {
|
|
|
628
635
|
ensureToken,
|
|
629
636
|
ensureTokenOrThrow,
|
|
630
637
|
init_ensure_token
|
|
631
|
-
} from "./cli-
|
|
638
|
+
} from "./cli-sdtt3men.js";
|
|
632
639
|
import {
|
|
633
640
|
require_fast_deep_equal
|
|
634
641
|
} from "./cli-bhp11egn.js";
|
|
@@ -723,7 +730,7 @@ import {
|
|
|
723
730
|
validateDefinition,
|
|
724
731
|
applyDefinitionPatch,
|
|
725
732
|
init_definition2
|
|
726
|
-
} from "./cli-
|
|
733
|
+
} from "./cli-qfedvmcr.js";
|
|
727
734
|
import {
|
|
728
735
|
isMultiRuntimeEnabled,
|
|
729
736
|
init_multi_runtime2
|
|
@@ -744,24 +751,15 @@ import {
|
|
|
744
751
|
isSlackLeaveThreadDisabled,
|
|
745
752
|
leaveSlackThread,
|
|
746
753
|
init_left_threads
|
|
747
|
-
} from "./cli-
|
|
754
|
+
} from "./cli-a7wvp2km.js";
|
|
748
755
|
import {
|
|
749
756
|
publicEndpointSsrfOptions,
|
|
750
757
|
init_mcp_wrapper
|
|
751
|
-
} from "./cli-
|
|
758
|
+
} from "./cli-s7t6p9my.js";
|
|
752
759
|
import {
|
|
753
760
|
canProvisionKind,
|
|
754
761
|
init_runtime_providers
|
|
755
762
|
} from "./cli-hxpyc9sn.js";
|
|
756
|
-
import {
|
|
757
|
-
isRbacEnabled,
|
|
758
|
-
decideAdmission,
|
|
759
|
-
grantLeadEquivalence,
|
|
760
|
-
revokeLeadEquivalence,
|
|
761
|
-
init_elevated_agents,
|
|
762
|
-
can,
|
|
763
|
-
init_rbac
|
|
764
|
-
} from "./cli-cyn9v8zr.js";
|
|
765
763
|
import {
|
|
766
764
|
findUserById,
|
|
767
765
|
findUserByExternalId,
|
|
@@ -776,9 +774,11 @@ import {
|
|
|
776
774
|
resolveSessionToken,
|
|
777
775
|
fingerprintApiKey,
|
|
778
776
|
init_users
|
|
779
|
-
} from "./cli-
|
|
777
|
+
} from "./cli-gxkx0zzp.js";
|
|
780
778
|
import {
|
|
781
779
|
normalizeAssetKey,
|
|
780
|
+
SESSION_RESOURCE_KINDS,
|
|
781
|
+
sessionResourceGroupOf,
|
|
782
782
|
sessionGroupKey,
|
|
783
783
|
parseAssetKey,
|
|
784
784
|
canWriteAssetKey,
|
|
@@ -796,10 +796,8 @@ import {
|
|
|
796
796
|
init_zod_openapi,
|
|
797
797
|
AssetKeySchema,
|
|
798
798
|
ModelTierSchema,
|
|
799
|
-
MODEL_TIERS,
|
|
800
799
|
ReasoningEffortSchema,
|
|
801
800
|
DEFAULT_MODEL_TIER_MAP,
|
|
802
|
-
parseModelTier,
|
|
803
801
|
splitLegacyModelAlias,
|
|
804
802
|
AgentTaskStatusSchema,
|
|
805
803
|
isTerminalTaskStatus,
|
|
@@ -813,6 +811,7 @@ import {
|
|
|
813
811
|
AttachmentInputSchema,
|
|
814
812
|
AgentStatusSchema,
|
|
815
813
|
AgentAvatarSchema,
|
|
814
|
+
AppIconSchema,
|
|
816
815
|
AgentSlackIconSchema,
|
|
817
816
|
ChannelTypeSchema,
|
|
818
817
|
ScheduledTaskTargetTypeSchema,
|
|
@@ -844,7 +843,7 @@ import {
|
|
|
844
843
|
KvNamespaceSchema,
|
|
845
844
|
KvKeySchema,
|
|
846
845
|
init_types4
|
|
847
|
-
} from "./cli-
|
|
846
|
+
} from "./cli-2zp0et3v.js";
|
|
848
847
|
import {
|
|
849
848
|
generateDefaultClaudeMd2,
|
|
850
849
|
generateDefaultSoulMd2,
|
|
@@ -855,9 +854,10 @@ import {
|
|
|
855
854
|
init_task_attachment_links,
|
|
856
855
|
contentSha256,
|
|
857
856
|
init_profile_sync
|
|
858
|
-
} from "./cli-
|
|
857
|
+
} from "./cli-tk7cjj8h.js";
|
|
859
858
|
import {
|
|
860
859
|
getSlackConfiguration,
|
|
860
|
+
isSlackConfigured,
|
|
861
861
|
init_config4
|
|
862
862
|
} from "./cli-eetzmsy5.js";
|
|
863
863
|
import {
|
|
@@ -867,7 +867,7 @@ import {
|
|
|
867
867
|
import {
|
|
868
868
|
selectCredential,
|
|
869
869
|
init_credentials2
|
|
870
|
-
} from "./cli-
|
|
870
|
+
} from "./cli-5mrq3ake.js";
|
|
871
871
|
import {
|
|
872
872
|
findInterpolationTokens,
|
|
873
873
|
interpolate,
|
|
@@ -877,7 +877,7 @@ import {
|
|
|
877
877
|
init_registry3,
|
|
878
878
|
resolveTemplate,
|
|
879
879
|
init_resolver
|
|
880
|
-
} from "./cli-
|
|
880
|
+
} from "./cli-v1dv1r37.js";
|
|
881
881
|
import {
|
|
882
882
|
init_zod
|
|
883
883
|
} from "./cli-zcfpsfzf.js";
|
|
@@ -912,7 +912,7 @@ import {
|
|
|
912
912
|
import {
|
|
913
913
|
init_package,
|
|
914
914
|
package_default
|
|
915
|
-
} from "./cli-
|
|
915
|
+
} from "./cli-334z18y3.js";
|
|
916
916
|
import {
|
|
917
917
|
realtimeBus,
|
|
918
918
|
init_bus
|
|
@@ -945,18 +945,7 @@ import {
|
|
|
945
945
|
init_api_key
|
|
946
946
|
} from "./cli-pax9q4ff.js";
|
|
947
947
|
import {
|
|
948
|
-
chatgptSubscriptionModelId,
|
|
949
|
-
isAlias,
|
|
950
|
-
parseAlias,
|
|
951
|
-
resolveAlias,
|
|
952
|
-
harnessCatalogSection,
|
|
953
|
-
isHarnessModelJudged,
|
|
954
|
-
harnessModelIds,
|
|
955
|
-
modelFamilyKey,
|
|
956
|
-
buildClaudeShortnameMap,
|
|
957
|
-
harnessModelMismatch,
|
|
958
948
|
openAICompatibleProviderIds,
|
|
959
|
-
claudeCatalogModelId,
|
|
960
949
|
init_src2,
|
|
961
950
|
scrubSecrets,
|
|
962
951
|
scrubObject,
|
|
@@ -19867,600 +19856,6 @@ var init_additive_ingress = __esm(() => {
|
|
|
19867
19856
|
init_additive_buffer();
|
|
19868
19857
|
});
|
|
19869
19858
|
|
|
19870
|
-
// src/tasks/model-pin.ts
|
|
19871
|
-
function taskModelPin(task) {
|
|
19872
|
-
if (task.modelSource === "model")
|
|
19873
|
-
return task.modelAlias ?? task.model ?? undefined;
|
|
19874
|
-
if (task.modelSource === "fallback:cli-unsupported:model" && task.modelAlias) {
|
|
19875
|
-
return task.modelAlias;
|
|
19876
|
-
}
|
|
19877
|
-
if (task.modelSource === "fallback:cli-unsupported" && task.modelAlias && !task.modelTier) {
|
|
19878
|
-
return task.modelAlias;
|
|
19879
|
-
}
|
|
19880
|
-
if (!task.modelSource && !task.resolvedModel && !task.claudeSessionId) {
|
|
19881
|
-
return task.model ?? undefined;
|
|
19882
|
-
}
|
|
19883
|
-
return;
|
|
19884
|
-
}
|
|
19885
|
-
function resumedTaskModelSelection(task) {
|
|
19886
|
-
const pin = taskModelPin(task);
|
|
19887
|
-
if (!pin)
|
|
19888
|
-
return { model: undefined, resolvedModel: undefined, modelSource: undefined };
|
|
19889
|
-
return {
|
|
19890
|
-
model: pin,
|
|
19891
|
-
resolvedModel: task.resolvedModel ?? undefined,
|
|
19892
|
-
modelSource: task.modelSource ?? undefined
|
|
19893
|
-
};
|
|
19894
|
-
}
|
|
19895
|
-
var init_model_pin = () => {};
|
|
19896
|
-
|
|
19897
|
-
// src/be/harness-model-support.ts
|
|
19898
|
-
async function getHarnessModelSupport(harness, cliVersion, modelId) {
|
|
19899
|
-
const row = await getDbClient2().get("SELECT status FROM harness_model_support WHERE harness = ? AND cliVersion = ? AND modelId = ?", [harness, cliVersion, modelId]);
|
|
19900
|
-
return row?.status ?? "unknown";
|
|
19901
|
-
}
|
|
19902
|
-
async function listHarnessModelSupport(filter) {
|
|
19903
|
-
const where = [];
|
|
19904
|
-
const params = [];
|
|
19905
|
-
if (filter?.harness) {
|
|
19906
|
-
where.push("harness = ?");
|
|
19907
|
-
params.push(filter.harness);
|
|
19908
|
-
}
|
|
19909
|
-
if (filter?.cliVersion) {
|
|
19910
|
-
where.push("cliVersion = ?");
|
|
19911
|
-
params.push(filter.cliVersion);
|
|
19912
|
-
}
|
|
19913
|
-
return await getDbClient2().query(`SELECT harness, cliVersion, modelId, status, checkedAt, error FROM harness_model_support${where.length > 0 ? ` WHERE ${where.join(" AND ")}` : ""} ORDER BY checkedAt DESC`, params);
|
|
19914
|
-
}
|
|
19915
|
-
async function recordHarnessModelSupport(input) {
|
|
19916
|
-
const checkedAt = input.now ?? Date.now();
|
|
19917
|
-
const error = input.error ? scrubSecrets(input.error).slice(0, 2000) : null;
|
|
19918
|
-
await getDbClient2().run(`INSERT INTO harness_model_support (harness, cliVersion, modelId, status, checkedAt, error)
|
|
19919
|
-
VALUES (?, ?, ?, ?, ?, ?)
|
|
19920
|
-
ON CONFLICT (harness, cliVersion, modelId) DO UPDATE SET
|
|
19921
|
-
status = CASE WHEN excluded.status = 'unknown' THEN harness_model_support.status ELSE excluded.status END,
|
|
19922
|
-
checkedAt = excluded.checkedAt,
|
|
19923
|
-
error = excluded.error`, [input.harness, input.cliVersion, input.modelId, input.status, checkedAt, error]);
|
|
19924
|
-
const row = await getDbClient2().get("SELECT harness, cliVersion, modelId, status, checkedAt, error FROM harness_model_support WHERE harness = ? AND cliVersion = ? AND modelId = ?", [input.harness, input.cliVersion, input.modelId]);
|
|
19925
|
-
if (!row)
|
|
19926
|
-
throw new Error("harness_model_support upsert returned no row");
|
|
19927
|
-
return row;
|
|
19928
|
-
}
|
|
19929
|
-
async function agentRanModel(agentId, modelId) {
|
|
19930
|
-
const row = await getDbClient2().get(`SELECT id FROM agent_tasks
|
|
19931
|
-
WHERE agentId = ? AND (resolvedModel = ? OR (resolvedModel IS NULL AND model = ?))
|
|
19932
|
-
LIMIT 1`, [agentId, modelId, modelId]);
|
|
19933
|
-
return row !== null && row !== undefined;
|
|
19934
|
-
}
|
|
19935
|
-
async function getAgentHarnessCliVersion(agentId) {
|
|
19936
|
-
const row = await getDbClient2().get("SELECT harnessCliVersion FROM agents WHERE id = ?", [agentId]);
|
|
19937
|
-
return row?.harnessCliVersion ?? null;
|
|
19938
|
-
}
|
|
19939
|
-
async function setAgentHarnessCliVersion(agentId, cliVersion) {
|
|
19940
|
-
await getDbClient2().run("UPDATE agents SET harnessCliVersion = ? WHERE id = ? AND harnessCliVersion IS NOT ?", [cliVersion, agentId, cliVersion]);
|
|
19941
|
-
}
|
|
19942
|
-
function unsupportedModelMessage(harness, cliVersion, model) {
|
|
19943
|
-
return `Model "${model}" is not supported by the ${harness} CLI ${cliVersion} on this worker. A CLI bump is needed before tasks can pin it.`;
|
|
19944
|
-
}
|
|
19945
|
-
async function fallbackForUnsupportedModel(harness, cliVersion, model, catalogSection) {
|
|
19946
|
-
if (!harnessCatalogSection(harness))
|
|
19947
|
-
return null;
|
|
19948
|
-
const family = modelFamilyKey(harness === "claude" ? claudeCatalogModelId(model, catalogSection) : model);
|
|
19949
|
-
const rejected = new Set((await listHarnessModelSupport({ harness, cliVersion })).filter((r) => r.status === "unsupported").map((r) => r.modelId));
|
|
19950
|
-
for (const id of harnessModelIds(harness, catalogSection)) {
|
|
19951
|
-
if (id === model || rejected.has(id))
|
|
19952
|
-
continue;
|
|
19953
|
-
if (modelFamilyKey(id) === family)
|
|
19954
|
-
return id;
|
|
19955
|
-
}
|
|
19956
|
-
return null;
|
|
19957
|
-
}
|
|
19958
|
-
function noticeCliUnsupported(harness, cliVersion, model, fallback) {
|
|
19959
|
-
const key = `${harness}|${cliVersion}|${model}`;
|
|
19960
|
-
if (noticed.has(key))
|
|
19961
|
-
return;
|
|
19962
|
-
noticed.add(key);
|
|
19963
|
-
console.warn(`[model-tiers] ${model} is unsupported on ${harness} CLI ${cliVersion}; tier/alias tasks fall back to ${fallback} until the CLI is bumped`);
|
|
19964
|
-
}
|
|
19965
|
-
var CLI_PINNED_HARNESSES, noticed;
|
|
19966
|
-
var init_harness_model_support = __esm(() => {
|
|
19967
|
-
init_src2();
|
|
19968
|
-
init_secret_scrubber();
|
|
19969
|
-
init_db4();
|
|
19970
|
-
CLI_PINNED_HARNESSES = new Set(["claude", "codex"]);
|
|
19971
|
-
noticed = new Set;
|
|
19972
|
-
});
|
|
19973
|
-
|
|
19974
|
-
// src/be/model-tier-resolution.ts
|
|
19975
|
-
function sanitizeModelTierOverrides(raw) {
|
|
19976
|
-
const parsed = OverridesSchema.safeParse(raw);
|
|
19977
|
-
if (!parsed.success)
|
|
19978
|
-
return {};
|
|
19979
|
-
const result = {};
|
|
19980
|
-
for (const [provider, tiers] of Object.entries(parsed.data)) {
|
|
19981
|
-
if (!ProviderNameSchema.safeParse(provider).success)
|
|
19982
|
-
continue;
|
|
19983
|
-
const clean = {};
|
|
19984
|
-
for (const [tier, value] of Object.entries(tiers)) {
|
|
19985
|
-
const t = parseModelTier(tier);
|
|
19986
|
-
const v = value.trim();
|
|
19987
|
-
if (t && t === tier && v && v.length <= 200 && !/\s/.test(v))
|
|
19988
|
-
clean[t] = v;
|
|
19989
|
-
}
|
|
19990
|
-
if (Object.keys(clean).length > 0)
|
|
19991
|
-
result[provider] = clean;
|
|
19992
|
-
}
|
|
19993
|
-
return result;
|
|
19994
|
-
}
|
|
19995
|
-
function parseModelTierOverridesHeader(header) {
|
|
19996
|
-
if (header === null || header === undefined || header === "")
|
|
19997
|
-
return;
|
|
19998
|
-
try {
|
|
19999
|
-
return sanitizeModelTierOverrides(JSON.parse(decodeURIComponent(header)));
|
|
20000
|
-
} catch {
|
|
20001
|
-
return;
|
|
20002
|
-
}
|
|
20003
|
-
}
|
|
20004
|
-
async function getAgentModelTierOverrides(agentId) {
|
|
20005
|
-
const row = await getDbClient2().get("SELECT modelTierOverrides FROM agents WHERE id = ?", [agentId]);
|
|
20006
|
-
if (!row?.modelTierOverrides)
|
|
20007
|
-
return {};
|
|
20008
|
-
try {
|
|
20009
|
-
return sanitizeModelTierOverrides(JSON.parse(row.modelTierOverrides));
|
|
20010
|
-
} catch {
|
|
20011
|
-
return {};
|
|
20012
|
-
}
|
|
20013
|
-
}
|
|
20014
|
-
async function setAgentModelTierOverrides(agentId, overrides) {
|
|
20015
|
-
const next = Object.keys(overrides).length > 0 ? JSON.stringify(overrides) : null;
|
|
20016
|
-
await getDbClient2().run("UPDATE agents SET modelTierOverrides = ? WHERE id = ? AND modelTierOverrides IS NOT ?", [next, agentId, next]);
|
|
20017
|
-
}
|
|
20018
|
-
function mergeFacts(base, overlay) {
|
|
20019
|
-
const merged = { ...base };
|
|
20020
|
-
for (const [key, value] of Object.entries(overlay)) {
|
|
20021
|
-
if (value !== null && value !== undefined) {
|
|
20022
|
-
merged[key] = value;
|
|
20023
|
-
}
|
|
20024
|
-
}
|
|
20025
|
-
return merged;
|
|
20026
|
-
}
|
|
20027
|
-
async function loadResolutionCatalog() {
|
|
20028
|
-
const now = Date.now();
|
|
20029
|
-
const generation = getCatalogGeneration();
|
|
20030
|
-
if (cachedCatalog && cachedCatalog.generation === generation && now - cachedCatalog.at < CATALOG_TTL_MS) {
|
|
20031
|
-
return cachedCatalog;
|
|
20032
|
-
}
|
|
20033
|
-
let entries = await listModelCatalog();
|
|
20034
|
-
if (entries.length === 0) {
|
|
20035
|
-
const snapshot = loadModelsDevCache();
|
|
20036
|
-
entries = snapshot ? buildCatalogEntries(snapshot, 0) : [];
|
|
20037
|
-
}
|
|
20038
|
-
const facts = new Map;
|
|
20039
|
-
for (const entry of entries) {
|
|
20040
|
-
facts.set(`${entry.provider}/${entry.modelId}`, {
|
|
20041
|
-
provider: entry.provider,
|
|
20042
|
-
modelId: entry.modelId,
|
|
20043
|
-
facts: entry
|
|
20044
|
-
});
|
|
20045
|
-
}
|
|
20046
|
-
for (const overlay of await listModelCatalogOverlay()) {
|
|
20047
|
-
const key = `${overlay.provider}/${overlay.modelId}`;
|
|
20048
|
-
const existing = facts.get(key);
|
|
20049
|
-
facts.set(key, {
|
|
20050
|
-
provider: overlay.provider,
|
|
20051
|
-
modelId: overlay.modelId,
|
|
20052
|
-
facts: existing ? mergeFacts(existing.facts, overlay) : overlay
|
|
20053
|
-
});
|
|
20054
|
-
}
|
|
20055
|
-
const catalog = {};
|
|
20056
|
-
const priced = new Set;
|
|
20057
|
-
for (const { provider, modelId, facts: f } of facts.values()) {
|
|
20058
|
-
catalog[provider] ??= { id: provider, name: provider, models: {} };
|
|
20059
|
-
const model = {
|
|
20060
|
-
...f.name ? { name: f.name } : {},
|
|
20061
|
-
...f.releaseDate ? { release_date: f.releaseDate } : {},
|
|
20062
|
-
...f.contextWindow ? { limit: { context: f.contextWindow } } : {},
|
|
20063
|
-
...f.pricing ? { cost: f.pricing } : {}
|
|
20064
|
-
};
|
|
20065
|
-
catalog[provider].models[modelId] = model;
|
|
20066
|
-
const p = f.pricing;
|
|
20067
|
-
if (p && (typeof p.input === "number" || typeof p.output === "number")) {
|
|
20068
|
-
priced.add(`${provider}/${modelId}`);
|
|
20069
|
-
}
|
|
20070
|
-
}
|
|
20071
|
-
cachedCatalog = { at: now, generation, catalog, priced };
|
|
20072
|
-
return cachedCatalog;
|
|
20073
|
-
}
|
|
20074
|
-
function soakDays() {
|
|
20075
|
-
const raw = process.env.MODEL_LATEST_SOAK_DAYS?.trim();
|
|
20076
|
-
if (!raw)
|
|
20077
|
-
return DEFAULT_MODEL_LATEST_SOAK_DAYS;
|
|
20078
|
-
const n = Number(raw);
|
|
20079
|
-
return Number.isInteger(n) && n >= 0 ? n : DEFAULT_MODEL_LATEST_SOAK_DAYS;
|
|
20080
|
-
}
|
|
20081
|
-
function autoUpgradeEnabled() {
|
|
20082
|
-
const raw = process.env.MODEL_AUTO_UPGRADE?.trim().toLowerCase();
|
|
20083
|
-
return !(raw === "false" || raw === "0");
|
|
20084
|
-
}
|
|
20085
|
-
async function lastAliasResolution(alias) {
|
|
20086
|
-
const row = await getDbClient2().get("SELECT newModel FROM model_alias_resolutions WHERE alias = ? ORDER BY id DESC LIMIT 1", [alias]);
|
|
20087
|
-
return row?.newModel ?? null;
|
|
20088
|
-
}
|
|
20089
|
-
async function resolveLatestAlias(alias, now = new Date, opts = {}) {
|
|
20090
|
-
const parsed = parseAlias(alias);
|
|
20091
|
-
if (!parsed)
|
|
20092
|
-
return null;
|
|
20093
|
-
const key = alias.trim().toLowerCase();
|
|
20094
|
-
const previous = await lastAliasResolution(key);
|
|
20095
|
-
if (previous && !autoUpgradeEnabled())
|
|
20096
|
-
return previous;
|
|
20097
|
-
const { catalog, priced } = await loadResolutionCatalog();
|
|
20098
|
-
const section = parsed.kind;
|
|
20099
|
-
const resolved = resolveAlias(key, catalog, {
|
|
20100
|
-
soakDays: soakDays(),
|
|
20101
|
-
now,
|
|
20102
|
-
isSupported: (id) => priced.has(`${section}/${id}`)
|
|
20103
|
-
});
|
|
20104
|
-
if (!resolved)
|
|
20105
|
-
return null;
|
|
20106
|
-
if (resolved !== previous && opts.record !== false) {
|
|
20107
|
-
await getDbClient2().run("INSERT INTO model_alias_resolutions (alias, previousModel, newModel, changedAt) VALUES (?, ?, ?, ?)", [key, previous, resolved, now.getTime()]);
|
|
20108
|
-
getDbClient2().afterCommit(() => {
|
|
20109
|
-
console.info(`[model-tiers] alias ${key} now resolves to ${resolved}${previous ? ` (was ${previous})` : ""}`);
|
|
20110
|
-
});
|
|
20111
|
-
}
|
|
20112
|
-
return resolved;
|
|
20113
|
-
}
|
|
20114
|
-
function taskModelCandidates(input) {
|
|
20115
|
-
const candidates = [];
|
|
20116
|
-
const model = input.model?.trim();
|
|
20117
|
-
if (model)
|
|
20118
|
-
candidates.push({ value: model, source: "model" });
|
|
20119
|
-
const tier = parseModelTier(input.modelTier);
|
|
20120
|
-
const provider = input.harnessProvider;
|
|
20121
|
-
if (tier && provider) {
|
|
20122
|
-
const worker = input.workerOverrides?.[provider]?.[tier]?.trim();
|
|
20123
|
-
if (worker)
|
|
20124
|
-
candidates.push({ value: worker, source: "worker-env" });
|
|
20125
|
-
const env = input.env ?? process.env;
|
|
20126
|
-
const configured = env[tierConfigKey(provider, tier)]?.trim();
|
|
20127
|
-
if (configured)
|
|
20128
|
-
candidates.push({ value: configured, source: "tier-config" });
|
|
20129
|
-
const fallback = DEFAULT_MODEL_TIER_MAP[provider]?.[tier];
|
|
20130
|
-
if (fallback)
|
|
20131
|
-
candidates.push({ value: fallback, source: "tier-default" });
|
|
20132
|
-
}
|
|
20133
|
-
return candidates;
|
|
20134
|
-
}
|
|
20135
|
-
function harnessMismatchReason(model, harness) {
|
|
20136
|
-
return `[model-harness-mismatch] Model "${model}" does not run on the ${harness} harness of this worker. The task pinned a model from another harness family. Re-create the task with modelTier or with a ${harness} model.`;
|
|
20137
|
-
}
|
|
20138
|
-
async function resolveTaskModel(input) {
|
|
20139
|
-
const harness = input.harnessProvider ?? null;
|
|
20140
|
-
const judged = harness !== null && isHarnessModelJudged(harness);
|
|
20141
|
-
const sections = judged ? (await loadResolutionCatalog()).catalog : {};
|
|
20142
|
-
for (const candidate of taskModelCandidates(input)) {
|
|
20143
|
-
let resolution = null;
|
|
20144
|
-
if (!isAlias(candidate.value)) {
|
|
20145
|
-
resolution = {
|
|
20146
|
-
resolvedModel: candidate.value,
|
|
20147
|
-
modelSource: candidate.source,
|
|
20148
|
-
modelAlias: null
|
|
20149
|
-
};
|
|
20150
|
-
} else {
|
|
20151
|
-
const resolved = await resolveLatestAlias(candidate.value, input.now, {
|
|
20152
|
-
record: input.record
|
|
20153
|
-
});
|
|
20154
|
-
if (resolved) {
|
|
20155
|
-
resolution = {
|
|
20156
|
-
resolvedModel: resolved,
|
|
20157
|
-
modelSource: candidate.source,
|
|
20158
|
-
modelAlias: candidate.value.trim().toLowerCase()
|
|
20159
|
-
};
|
|
20160
|
-
}
|
|
20161
|
-
}
|
|
20162
|
-
if (!resolution) {
|
|
20163
|
-
console.warn(`[model-tiers] ${candidate.source} alias ${candidate.value} resolved to nothing; trying next layer`);
|
|
20164
|
-
continue;
|
|
20165
|
-
}
|
|
20166
|
-
if (judged && harnessModelMismatch(resolution.resolvedModel, harness, sections)) {
|
|
20167
|
-
if (candidate.source === "model") {
|
|
20168
|
-
return { harnessMismatch: harnessMismatchReason(candidate.value, harness) };
|
|
20169
|
-
}
|
|
20170
|
-
console.warn(`[model-tiers] ${candidate.source} value ${candidate.value} does not run on ${harness}; trying next layer`);
|
|
20171
|
-
continue;
|
|
20172
|
-
}
|
|
20173
|
-
return resolution;
|
|
20174
|
-
}
|
|
20175
|
-
return null;
|
|
20176
|
-
}
|
|
20177
|
-
async function previewModelTiers(opts = {}) {
|
|
20178
|
-
const env = opts.env ?? process.env;
|
|
20179
|
-
const rows = [];
|
|
20180
|
-
for (const provider of ProviderNameSchema.options) {
|
|
20181
|
-
if (MODEL_TIERS.every((tier) => !DEFAULT_MODEL_TIER_MAP[provider][tier]))
|
|
20182
|
-
continue;
|
|
20183
|
-
for (const tier of MODEL_TIERS) {
|
|
20184
|
-
const key = tierConfigKey(provider, tier);
|
|
20185
|
-
const configured = env[key]?.trim() || null;
|
|
20186
|
-
const resolution = await resolveTaskModel({
|
|
20187
|
-
modelTier: tier,
|
|
20188
|
-
harnessProvider: provider,
|
|
20189
|
-
env,
|
|
20190
|
-
now: opts.now,
|
|
20191
|
-
record: false
|
|
20192
|
-
});
|
|
20193
|
-
const previewed = resolution && "harnessMismatch" in resolution ? null : resolution;
|
|
20194
|
-
rows.push({
|
|
20195
|
-
provider,
|
|
20196
|
-
tier,
|
|
20197
|
-
key,
|
|
20198
|
-
defaultValue: DEFAULT_MODEL_TIER_MAP[provider][tier],
|
|
20199
|
-
configured,
|
|
20200
|
-
source: previewed?.modelSource === "tier-config" ? "tier-config" : "tier-default",
|
|
20201
|
-
resolvedModel: previewed?.resolvedModel ?? null,
|
|
20202
|
-
alias: previewed?.modelAlias ?? null
|
|
20203
|
-
});
|
|
20204
|
-
}
|
|
20205
|
-
}
|
|
20206
|
-
return rows;
|
|
20207
|
-
}
|
|
20208
|
-
async function applyCliSupport(resolution, harness, cliVersion) {
|
|
20209
|
-
if (!harness || !cliVersion || !CLI_PINNED_HARNESSES.has(harness))
|
|
20210
|
-
return resolution;
|
|
20211
|
-
const status = await getHarnessModelSupport(harness, cliVersion, resolution.resolvedModel);
|
|
20212
|
-
if (status !== "unsupported")
|
|
20213
|
-
return resolution;
|
|
20214
|
-
if (resolution.modelSource === "model" && !resolution.modelAlias) {
|
|
20215
|
-
return { unsupported: unsupportedModelMessage(harness, cliVersion, resolution.resolvedModel) };
|
|
20216
|
-
}
|
|
20217
|
-
const section = harnessCatalogSection(harness);
|
|
20218
|
-
const { catalog, priced } = await loadResolutionCatalog();
|
|
20219
|
-
const candidates = Object.fromEntries(Object.entries(section && catalog[section]?.models || {}).filter(([id]) => priced.has(`${section}/${id}`)));
|
|
20220
|
-
const fallback = await fallbackForUnsupportedModel(harness, cliVersion, resolution.resolvedModel, candidates);
|
|
20221
|
-
if (!fallback)
|
|
20222
|
-
return resolution;
|
|
20223
|
-
noticeCliUnsupported(harness, cliVersion, resolution.resolvedModel, fallback);
|
|
20224
|
-
const modelSource = resolution.modelSource.startsWith("profile:") ? resolution.modelSource : resolution.modelSource === "model" ? "fallback:cli-unsupported:model" : "fallback:cli-unsupported";
|
|
20225
|
-
return { ...resolution, resolvedModel: fallback, modelSource };
|
|
20226
|
-
}
|
|
20227
|
-
async function resolveClaimProfile(name, source, harness) {
|
|
20228
|
-
const isTask = source === "profile:task";
|
|
20229
|
-
const profile = await getModelProfileByName(name);
|
|
20230
|
-
if (!profile) {
|
|
20231
|
-
return isTask ? { modelUnsupported: `[model-profile-missing] Model profile "${name}" no longer exists.` } : null;
|
|
20232
|
-
}
|
|
20233
|
-
if (profile.harness !== harness) {
|
|
20234
|
-
if (!isTask)
|
|
20235
|
-
return null;
|
|
20236
|
-
return {
|
|
20237
|
-
modelUnsupported: `[model-harness-mismatch] Model profile "${name}" runs on the ${profile.harness} harness, not on the ${harness ?? "unknown"} harness of this worker. Re-create the task with a ${harness ?? "matching"} profile.`
|
|
20238
|
-
};
|
|
20239
|
-
}
|
|
20240
|
-
let resolution = {
|
|
20241
|
-
resolvedModel: profile.model,
|
|
20242
|
-
modelSource: source,
|
|
20243
|
-
modelAlias: null
|
|
20244
|
-
};
|
|
20245
|
-
if (isAlias(profile.model)) {
|
|
20246
|
-
const resolved = await resolveLatestAlias(profile.model);
|
|
20247
|
-
if (!resolved) {
|
|
20248
|
-
if (!isTask)
|
|
20249
|
-
return null;
|
|
20250
|
-
return {
|
|
20251
|
-
modelUnsupported: `[model-profile-unresolved] Model profile "${name}" names ${profile.model}, which resolves to no usable model.`
|
|
20252
|
-
};
|
|
20253
|
-
}
|
|
20254
|
-
resolution = {
|
|
20255
|
-
resolvedModel: resolved,
|
|
20256
|
-
modelSource: source,
|
|
20257
|
-
modelAlias: profile.model.trim().toLowerCase()
|
|
20258
|
-
};
|
|
20259
|
-
}
|
|
20260
|
-
return { profile: { name: profile.name, effort: profile.effort }, resolution };
|
|
20261
|
-
}
|
|
20262
|
-
async function recordClaimModelResolution(task, agent, { includeRepoSecrets = true } = {}) {
|
|
20263
|
-
const harnessProvider = agent.harnessProvider ?? agent.provider ?? null;
|
|
20264
|
-
if (!task.model?.trim()) {
|
|
20265
|
-
const taskProfile = task.profile?.trim();
|
|
20266
|
-
const agentDefault = taskProfile || parseModelTier(task.modelTier) ? null : await getAgentDefaultProfileName(agent.id);
|
|
20267
|
-
const repoKeys = agentDefault ? await repoModelOverrideKeys(task.vcsRepo, { includeSecrets: includeRepoSecrets }) : new Set;
|
|
20268
|
-
const defaultProfile = repoKeys.has("MODEL_OVERRIDE") ? null : agentDefault;
|
|
20269
|
-
const picked = taskProfile ? await resolveClaimProfile(taskProfile, "profile:task", harnessProvider) : defaultProfile ? await resolveClaimProfile(defaultProfile, "profile:agent-default", harnessProvider) : null;
|
|
20270
|
-
if (picked && "modelUnsupported" in picked)
|
|
20271
|
-
return { modelUnsupported: picked.modelUnsupported };
|
|
20272
|
-
if (picked) {
|
|
20273
|
-
const checked = await applyCliSupport(picked.resolution, harnessProvider, await getAgentHarnessCliVersion(agent.id));
|
|
20274
|
-
const resolution = "unsupported" in checked ? picked.resolution : checked;
|
|
20275
|
-
await getDbClient2().run("UPDATE agent_tasks SET resolvedModel = ?, modelSource = ?, modelAlias = ?, resolvedProfile = ? WHERE id = ?", [
|
|
20276
|
-
resolution.resolvedModel,
|
|
20277
|
-
resolution.modelSource,
|
|
20278
|
-
resolution.modelAlias,
|
|
20279
|
-
picked.profile.name,
|
|
20280
|
-
task.id
|
|
20281
|
-
]);
|
|
20282
|
-
return {
|
|
20283
|
-
resolvedModel: resolution.resolvedModel,
|
|
20284
|
-
modelSource: resolution.modelSource,
|
|
20285
|
-
...resolution.modelAlias ? { modelAlias: resolution.modelAlias } : {},
|
|
20286
|
-
resolvedProfile: picked.profile.name,
|
|
20287
|
-
...!task.effort && picked.profile.effort && !repoKeys.has("REASONING_EFFORT_OVERRIDE") ? { effort: picked.profile.effort } : {}
|
|
20288
|
-
};
|
|
20289
|
-
}
|
|
20290
|
-
}
|
|
20291
|
-
const resolved = await resolveTaskModel({
|
|
20292
|
-
model: task.model,
|
|
20293
|
-
modelTier: task.modelTier,
|
|
20294
|
-
harnessProvider,
|
|
20295
|
-
workerOverrides: await getAgentModelTierOverrides(agent.id)
|
|
20296
|
-
});
|
|
20297
|
-
if (!resolved) {
|
|
20298
|
-
await getDbClient2().run(`UPDATE agent_tasks SET resolvedModel = NULL, modelSource = NULL, modelAlias = NULL, resolvedProfile = NULL
|
|
20299
|
-
WHERE id = ? AND (resolvedModel IS NOT NULL OR modelSource IS NOT NULL OR modelAlias IS NOT NULL
|
|
20300
|
-
OR resolvedProfile IS NOT NULL)`, [task.id]);
|
|
20301
|
-
return {};
|
|
20302
|
-
}
|
|
20303
|
-
if ("harnessMismatch" in resolved)
|
|
20304
|
-
return { modelUnsupported: resolved.harnessMismatch };
|
|
20305
|
-
const checked = await applyCliSupport(resolved, harnessProvider, await getAgentHarnessCliVersion(agent.id));
|
|
20306
|
-
if ("unsupported" in checked) {
|
|
20307
|
-
return { modelUnsupported: checked.unsupported };
|
|
20308
|
-
}
|
|
20309
|
-
const resolution = checked;
|
|
20310
|
-
await getDbClient2().run("UPDATE agent_tasks SET resolvedModel = ?, modelSource = ?, modelAlias = ?, resolvedProfile = NULL WHERE id = ?", [resolution.resolvedModel, resolution.modelSource, resolution.modelAlias, task.id]);
|
|
20311
|
-
return resolution.modelAlias ? resolution : { resolvedModel: resolution.resolvedModel, modelSource: resolution.modelSource };
|
|
20312
|
-
}
|
|
20313
|
-
var DEFAULT_MODEL_LATEST_SOAK_DAYS = 2, OverridesSchema, CATALOG_TTL_MS = 30000, cachedCatalog = null;
|
|
20314
|
-
var init_model_tier_resolution = __esm(() => {
|
|
20315
|
-
init_src2();
|
|
20316
|
-
init_zod();
|
|
20317
|
-
init_types4();
|
|
20318
|
-
init_db4();
|
|
20319
|
-
init_model_profiles();
|
|
20320
|
-
init_harness_model_support();
|
|
20321
|
-
init_model_catalog_store();
|
|
20322
|
-
init_model_tier_keys();
|
|
20323
|
-
init_modelsdev_cache();
|
|
20324
|
-
init_model_tier_keys();
|
|
20325
|
-
OverridesSchema = record2(string2(), record2(string2(), string2()));
|
|
20326
|
-
});
|
|
20327
|
-
|
|
20328
|
-
// src/be/model-validation.ts
|
|
20329
|
-
function hasModel(catalog, provider, modelId) {
|
|
20330
|
-
const models = catalog[provider]?.models;
|
|
20331
|
-
return Boolean(models && Object.hasOwn(models, modelId));
|
|
20332
|
-
}
|
|
20333
|
-
function isKnownCatalogModel(model, catalog) {
|
|
20334
|
-
const id = model.trim().replace(CONTEXT_SUFFIX_RE, "");
|
|
20335
|
-
if (!id)
|
|
20336
|
-
return false;
|
|
20337
|
-
const subscriptionId = chatgptSubscriptionModelId(id);
|
|
20338
|
-
if (subscriptionId)
|
|
20339
|
-
return hasModel(catalog, "openai", subscriptionId);
|
|
20340
|
-
const slash = id.indexOf("/");
|
|
20341
|
-
if (slash > 0) {
|
|
20342
|
-
const provider = id.slice(0, slash);
|
|
20343
|
-
const rest = id.slice(slash + 1);
|
|
20344
|
-
if (hasModel(catalog, provider, rest))
|
|
20345
|
-
return true;
|
|
20346
|
-
if (provider === "amazon-bedrock") {
|
|
20347
|
-
return hasModel(catalog, provider, rest.replace(BEDROCK_REGION_PREFIX_RE, ""));
|
|
20348
|
-
}
|
|
20349
|
-
}
|
|
20350
|
-
for (const provider of Object.keys(catalog)) {
|
|
20351
|
-
if (hasModel(catalog, provider, id))
|
|
20352
|
-
return true;
|
|
20353
|
-
}
|
|
20354
|
-
const anthropic = catalog.anthropic?.models;
|
|
20355
|
-
return Object.hasOwn(buildClaudeShortnameMap(anthropic), id);
|
|
20356
|
-
}
|
|
20357
|
-
function claudeShortnameToCatalogId(model, catalog) {
|
|
20358
|
-
const anthropic = catalog.anthropic?.models;
|
|
20359
|
-
const shortnames = buildClaudeShortnameMap(anthropic);
|
|
20360
|
-
const bare = model.replace(CONTEXT_SUFFIX_RE, "");
|
|
20361
|
-
return Object.hasOwn(shortnames, bare) ? shortnames[bare] : model;
|
|
20362
|
-
}
|
|
20363
|
-
async function harnessModelErrorFor(model, harness) {
|
|
20364
|
-
const { providers } = await loadModelsCatalog();
|
|
20365
|
-
return harnessModelMismatch(model, harness, providers, {});
|
|
20366
|
-
}
|
|
20367
|
-
async function poolTaskRunsOnHarness(task, harness) {
|
|
20368
|
-
const profileName = task?.profile?.trim();
|
|
20369
|
-
if (profileName) {
|
|
20370
|
-
const profile = await getModelProfileByName(profileName);
|
|
20371
|
-
return !profile || !harness || profile.harness === harness;
|
|
20372
|
-
}
|
|
20373
|
-
const model = taskModelPin(task ?? {})?.trim();
|
|
20374
|
-
if (!model)
|
|
20375
|
-
return true;
|
|
20376
|
-
return await harnessModelErrorFor(model, harness) === null;
|
|
20377
|
-
}
|
|
20378
|
-
async function explicitModelError(check) {
|
|
20379
|
-
const model = check.model?.trim();
|
|
20380
|
-
if (!model)
|
|
20381
|
-
return null;
|
|
20382
|
-
if (check.harnessProvider && FREE_FORM_HARNESSES.has(check.harnessProvider))
|
|
20383
|
-
return null;
|
|
20384
|
-
if (check.harnessProvider === "amp") {
|
|
20385
|
-
const shapeError = ampModelError(model);
|
|
20386
|
-
if (shapeError || check.allowCustomModel)
|
|
20387
|
-
return shapeError;
|
|
20388
|
-
const { providers } = await loadModelsCatalog();
|
|
20389
|
-
return ampPinProviderError(model) ?? ampPinCatalogError(model, providers);
|
|
20390
|
-
}
|
|
20391
|
-
const { providers } = await loadModelsCatalog();
|
|
20392
|
-
const catalog = providers;
|
|
20393
|
-
if (check.harnessProvider) {
|
|
20394
|
-
const harnessModel = harnessCatalogSection(check.harnessProvider) === "anthropic" ? model : claudeShortnameToCatalogId(model, catalog);
|
|
20395
|
-
const mismatch = harnessModelMismatch(harnessModel, check.harnessProvider, catalog, { agentId: check.agentId, agentName: check.agentName });
|
|
20396
|
-
if (mismatch)
|
|
20397
|
-
return mismatch;
|
|
20398
|
-
}
|
|
20399
|
-
if (check.allowCustomModel)
|
|
20400
|
-
return null;
|
|
20401
|
-
if (isAlias(model)) {
|
|
20402
|
-
if (!parseAlias(model)) {
|
|
20403
|
-
return `Invalid model alias "${model}". Use latest:<provider>/<family>[@stable|@any], e.g. latest:anthropic/opus.`;
|
|
20404
|
-
}
|
|
20405
|
-
const resolved = await resolveLatestAlias(model, new Date, { record: false });
|
|
20406
|
-
return resolved ? null : `Model alias "${model}" matches no model in the catalog. Check the provider and family, or use a concrete model id.`;
|
|
20407
|
-
}
|
|
20408
|
-
if (Object.keys(catalog).length === 0)
|
|
20409
|
-
return null;
|
|
20410
|
-
if (isKnownCatalogModel(model, catalog))
|
|
20411
|
-
return null;
|
|
20412
|
-
return `Unknown model "${model}": it is not in the model catalog. Use a catalog model id, a Claude CLI shortname (opus, sonnet, haiku, fable), a latest:<provider>/<family> alias, or modelTier. To run a custom model id anyway, set allowCustomModel: true (allow_custom_model on the agent runtime).`;
|
|
20413
|
-
}
|
|
20414
|
-
async function explicitModelErrorForAgent(check) {
|
|
20415
|
-
const model = check.model?.trim();
|
|
20416
|
-
if (!model)
|
|
20417
|
-
return null;
|
|
20418
|
-
const agent = check.agentId ? await getAgentById2(check.agentId) : null;
|
|
20419
|
-
if (agent) {
|
|
20420
|
-
return explicitModelError({
|
|
20421
|
-
...check,
|
|
20422
|
-
agentId: agent.id,
|
|
20423
|
-
agentName: agent.name,
|
|
20424
|
-
harnessProvider: agent.harnessProvider ?? agent.provider ?? null
|
|
20425
|
-
});
|
|
20426
|
-
}
|
|
20427
|
-
if (!check.agentId && !isAlias(model)) {
|
|
20428
|
-
const poolError = await poolHarnessModelError(model);
|
|
20429
|
-
if (poolError)
|
|
20430
|
-
return poolError;
|
|
20431
|
-
}
|
|
20432
|
-
return explicitModelError({ ...check, harnessProvider: null });
|
|
20433
|
-
}
|
|
20434
|
-
async function poolHarnessModelError(model) {
|
|
20435
|
-
const agents = await getAllAgents2({ slim: true });
|
|
20436
|
-
if (agents.length === 0)
|
|
20437
|
-
return null;
|
|
20438
|
-
const { providers } = await loadModelsCatalog();
|
|
20439
|
-
const sections = providers;
|
|
20440
|
-
const harnesses = new Set;
|
|
20441
|
-
for (const agent of agents) {
|
|
20442
|
-
const harness = agent.harnessProvider ?? agent.provider ?? null;
|
|
20443
|
-
if (!harnessModelMismatch(model, harness, sections))
|
|
20444
|
-
return null;
|
|
20445
|
-
if (harness)
|
|
20446
|
-
harnesses.add(harness);
|
|
20447
|
-
}
|
|
20448
|
-
return `Model "${model}" does not run on any registered agent harness (${[...harnesses].sort().join(", ")}). Use modelTier (smol, regular, smart, ultra) for portable intent, or omit model and let the claiming agent resolve it.`;
|
|
20449
|
-
}
|
|
20450
|
-
var FREE_FORM_HARNESSES, CONTEXT_SUFFIX_RE, BEDROCK_REGION_PREFIX_RE;
|
|
20451
|
-
var init_model_validation = __esm(() => {
|
|
20452
|
-
init_src2();
|
|
20453
|
-
init_model_pin();
|
|
20454
|
-
init_amp_models();
|
|
20455
|
-
init_db4();
|
|
20456
|
-
init_model_profiles();
|
|
20457
|
-
init_model_catalog_store();
|
|
20458
|
-
init_model_tier_resolution();
|
|
20459
|
-
FREE_FORM_HARNESSES = new Set(["acp", "devin", "dsh", "cursor"]);
|
|
20460
|
-
CONTEXT_SUFFIX_RE = /\[1m\]$/i;
|
|
20461
|
-
BEDROCK_REGION_PREFIX_RE = /^(?:us|eu|apac|global|us-gov)\./;
|
|
20462
|
-
});
|
|
20463
|
-
|
|
20464
19859
|
// src/extensions/manifest-format.ts
|
|
20465
19860
|
function parseStructuredText(filename, text) {
|
|
20466
19861
|
const lower = filename.toLowerCase();
|
|
@@ -20537,7 +19932,7 @@ async function recoverRunningRuns(registry) {
|
|
|
20537
19932
|
await failRunningRun(runId, "Child workflow run lost its initial context in a restart");
|
|
20538
19933
|
continue;
|
|
20539
19934
|
}
|
|
20540
|
-
const workflow = await
|
|
19935
|
+
const workflow = await getRunWorkflow2(run);
|
|
20541
19936
|
if (!workflow)
|
|
20542
19937
|
continue;
|
|
20543
19938
|
const completedNodeIds = new Set(await getCompletedStepNodeIds2(runId));
|
|
@@ -20584,7 +19979,7 @@ async function recoverOrphanedSubWorkflowSteps(registry) {
|
|
|
20584
19979
|
const run = await getWorkflowRun2(row.runId);
|
|
20585
19980
|
if (!run || run.status !== "running" && run.status !== "waiting")
|
|
20586
19981
|
continue;
|
|
20587
|
-
const workflow = await
|
|
19982
|
+
const workflow = await getRunWorkflow2(run);
|
|
20588
19983
|
const node = workflow?.definition.nodes.find((n) => n.id === row.nodeId);
|
|
20589
19984
|
if (!workflow || !node)
|
|
20590
19985
|
continue;
|
|
@@ -20647,7 +20042,7 @@ async function recoverWaitingRuns(registry) {
|
|
|
20647
20042
|
for (const stuck of stuckRuns) {
|
|
20648
20043
|
try {
|
|
20649
20044
|
const run = await getWorkflowRun2(stuck.runId);
|
|
20650
|
-
const workflow = await
|
|
20045
|
+
const workflow = await getRunWorkflow2({ id: stuck.runId, workflowId: stuck.workflowId });
|
|
20651
20046
|
if (!run || run.status !== "waiting" || !workflow)
|
|
20652
20047
|
continue;
|
|
20653
20048
|
const taskCompleted = stuck.taskStatus === "completed";
|
|
@@ -20712,7 +20107,7 @@ async function recoverApprovalWaitingRuns(registry) {
|
|
|
20712
20107
|
for (const stuck of stuckRuns) {
|
|
20713
20108
|
try {
|
|
20714
20109
|
const run = await getWorkflowRun2(stuck.runId);
|
|
20715
|
-
const workflow = await
|
|
20110
|
+
const workflow = await getRunWorkflow2({ id: stuck.runId, workflowId: stuck.workflowId });
|
|
20716
20111
|
if (!run || !workflow)
|
|
20717
20112
|
continue;
|
|
20718
20113
|
const ctx = run.context ?? {};
|
|
@@ -20793,7 +20188,7 @@ async function recoverForeachFanouts(registry) {
|
|
|
20793
20188
|
let recovered = 0;
|
|
20794
20189
|
for (const fanout of fanouts.values()) {
|
|
20795
20190
|
try {
|
|
20796
|
-
const workflow = await
|
|
20191
|
+
const workflow = await getRunWorkflow2({ id: fanout.runId, workflowId: fanout.workflowId });
|
|
20797
20192
|
const parent = workflow?.definition.nodes.find((node) => node.id === fanout.parentNodeId);
|
|
20798
20193
|
if (parent?.type !== "foreach")
|
|
20799
20194
|
continue;
|
|
@@ -20839,7 +20234,7 @@ function startRetryPoller(registry, intervalMs = 5000) {
|
|
|
20839
20234
|
const run = await getWorkflowRun2(step.runId);
|
|
20840
20235
|
if (!run)
|
|
20841
20236
|
continue;
|
|
20842
|
-
const workflow = await
|
|
20237
|
+
const workflow = await getRunWorkflow2(run);
|
|
20843
20238
|
if (!workflow)
|
|
20844
20239
|
continue;
|
|
20845
20240
|
const foreachParent = resolveForeachParent(workflow.definition, step.nodeId);
|
|
@@ -20907,7 +20302,7 @@ function startRetryPoller(registry, intervalMs = 5000) {
|
|
|
20907
20302
|
if (!waiting)
|
|
20908
20303
|
continue;
|
|
20909
20304
|
if (result.waitFor === "workflow.child.finished") {
|
|
20910
|
-
const { resumeFromChildRun } = await import("./resume-
|
|
20305
|
+
const { resumeFromChildRun } = await import("./resume-cnnrjfxa.js");
|
|
20911
20306
|
await resumeFromChildRun(step.id, registry);
|
|
20912
20307
|
}
|
|
20913
20308
|
} else {
|
|
@@ -21396,7 +20791,8 @@ var init_errors2 = __esm(() => {
|
|
|
21396
20791
|
var AgentTaskConfigSchema, AgentTaskOutputSchema, AgentTaskExecutor;
|
|
21397
20792
|
var init_agent_task = __esm(() => {
|
|
21398
20793
|
init_zod();
|
|
21399
|
-
|
|
20794
|
+
init_model_profiles();
|
|
20795
|
+
init_model_validation2();
|
|
21400
20796
|
init_apply_task_create();
|
|
21401
20797
|
init_context_key();
|
|
21402
20798
|
init_errors2();
|
|
@@ -21416,6 +20812,7 @@ var init_agent_task = __esm(() => {
|
|
|
21416
20812
|
modelTier: ModelTierSchema.optional(),
|
|
21417
20813
|
allowCustomModel: boolean().optional(),
|
|
21418
20814
|
effort: ReasoningEffortSchema.optional(),
|
|
20815
|
+
profile: string2().min(1).optional(),
|
|
21419
20816
|
parentTaskId: string2().uuid().optional(),
|
|
21420
20817
|
requestedByUserId: string2().optional(),
|
|
21421
20818
|
outputSchema: record2(string2(), unknown()).optional(),
|
|
@@ -21454,7 +20851,7 @@ var init_agent_task = __esm(() => {
|
|
|
21454
20851
|
let effectiveVcsRepo = config.vcsRepo;
|
|
21455
20852
|
let effectiveKey;
|
|
21456
20853
|
if (meta.workflowId) {
|
|
21457
|
-
const workflow = await db.
|
|
20854
|
+
const workflow = await db.getRunWorkflow({ id: meta.runId, workflowId: meta.workflowId });
|
|
21458
20855
|
if (workflow) {
|
|
21459
20856
|
if (!effectiveDir && workflow.dir)
|
|
21460
20857
|
effectiveDir = workflow.dir;
|
|
@@ -21470,6 +20867,15 @@ var init_agent_task = __esm(() => {
|
|
|
21470
20867
|
});
|
|
21471
20868
|
if (modelError)
|
|
21472
20869
|
return { status: "failed", error: modelError };
|
|
20870
|
+
const profileError = await taskProfileError({
|
|
20871
|
+
profile: config.profile,
|
|
20872
|
+
model: config.model,
|
|
20873
|
+
modelTier: config.modelTier,
|
|
20874
|
+
agentId: config.agentId,
|
|
20875
|
+
vcsRepo: effectiveVcsRepo
|
|
20876
|
+
});
|
|
20877
|
+
if (profileError)
|
|
20878
|
+
return { status: "failed", error: profileError };
|
|
21473
20879
|
const preCreate = await applyPreTaskCreate({
|
|
21474
20880
|
description: config.template,
|
|
21475
20881
|
options: {
|
|
@@ -21488,6 +20894,7 @@ var init_agent_task = __esm(() => {
|
|
|
21488
20894
|
vcsRepo: effectiveVcsRepo,
|
|
21489
20895
|
...splitLegacyModelAlias({ model: config.model, modelTier: config.modelTier }),
|
|
21490
20896
|
effort: config.effort,
|
|
20897
|
+
profile: config.profile?.trim() || undefined,
|
|
21491
20898
|
parentTaskId: config.parentTaskId,
|
|
21492
20899
|
requestedByUserId: config.requestedByUserId ?? meta.requestedByUserId,
|
|
21493
20900
|
outputSchema: config.outputSchema,
|
|
@@ -21500,7 +20907,14 @@ var init_agent_task = __esm(() => {
|
|
|
21500
20907
|
if (preCreate.kind === "blocked") {
|
|
21501
20908
|
throw new TaskCreationBlockedError(preCreate.reason, preCreate.extension);
|
|
21502
20909
|
}
|
|
21503
|
-
|
|
20910
|
+
let task;
|
|
20911
|
+
try {
|
|
20912
|
+
task = await db.createTaskExtended(preCreate.description, preCreate.options);
|
|
20913
|
+
} catch (error) {
|
|
20914
|
+
if (modelProfileRefError(error) !== "missing")
|
|
20915
|
+
throw error;
|
|
20916
|
+
return { status: "failed", error: `Unknown model profile "${config.profile}".` };
|
|
20917
|
+
}
|
|
21504
20918
|
return {
|
|
21505
20919
|
status: "success",
|
|
21506
20920
|
async: true,
|
|
@@ -21576,11 +20990,25 @@ var init_code_match = __esm(() => {
|
|
|
21576
20990
|
});
|
|
21577
20991
|
|
|
21578
20992
|
// src/workflows/executors/notify.ts
|
|
21579
|
-
|
|
20993
|
+
async function waitForSlackApp(getApp, signal) {
|
|
20994
|
+
const deadline = Date.now() + slackReadyWait.timeoutMs;
|
|
20995
|
+
while (Date.now() < deadline && !signal?.aborted) {
|
|
20996
|
+
await Bun.sleep(Math.min(slackReadyWait.pollMs, Math.max(0, deadline - Date.now())));
|
|
20997
|
+
if (signal?.aborted)
|
|
20998
|
+
return null;
|
|
20999
|
+
const app = getApp();
|
|
21000
|
+
if (app)
|
|
21001
|
+
return app;
|
|
21002
|
+
}
|
|
21003
|
+
return null;
|
|
21004
|
+
}
|
|
21005
|
+
var slackReadyWait, NotifyConfigSchema, NotifyOutputSchema, NotifyExecutor;
|
|
21580
21006
|
var init_notify = __esm(() => {
|
|
21581
21007
|
init_zod();
|
|
21008
|
+
init_config4();
|
|
21582
21009
|
init_secret_scrubber();
|
|
21583
21010
|
init_base();
|
|
21011
|
+
slackReadyWait = { timeoutMs: 25000, pollMs: 250 };
|
|
21584
21012
|
NotifyConfigSchema = object2({
|
|
21585
21013
|
channel: _enum2(["swarm", "slack", "email"]),
|
|
21586
21014
|
target: string2().optional(),
|
|
@@ -21596,7 +21024,7 @@ var init_notify = __esm(() => {
|
|
|
21596
21024
|
mode = "instant";
|
|
21597
21025
|
configSchema = NotifyConfigSchema;
|
|
21598
21026
|
outputSchema = NotifyOutputSchema;
|
|
21599
|
-
async execute(config, context,
|
|
21027
|
+
async execute(config, context, meta) {
|
|
21600
21028
|
const message = scrubSecrets(this.deps.interpolate(config.template, context));
|
|
21601
21029
|
switch (config.channel) {
|
|
21602
21030
|
case "swarm": {
|
|
@@ -21620,13 +21048,28 @@ var init_notify = __esm(() => {
|
|
|
21620
21048
|
}
|
|
21621
21049
|
}
|
|
21622
21050
|
case "slack": {
|
|
21623
|
-
const { getSlackApp } = await import("./app-
|
|
21624
|
-
|
|
21051
|
+
const { getSlackApp } = await import("./app-b9fbkp9v.js");
|
|
21052
|
+
let app = getSlackApp();
|
|
21625
21053
|
if (!app) {
|
|
21626
|
-
|
|
21627
|
-
|
|
21628
|
-
|
|
21629
|
-
|
|
21054
|
+
if (!isSlackConfigured()) {
|
|
21055
|
+
return {
|
|
21056
|
+
status: "success",
|
|
21057
|
+
output: { sent: false, message }
|
|
21058
|
+
};
|
|
21059
|
+
}
|
|
21060
|
+
app = await waitForSlackApp(getSlackApp, meta.signal);
|
|
21061
|
+
if (meta.signal?.aborted) {
|
|
21062
|
+
return {
|
|
21063
|
+
status: "failed",
|
|
21064
|
+
error: "Step deadline reached while waiting for the Slack client; message not sent"
|
|
21065
|
+
};
|
|
21066
|
+
}
|
|
21067
|
+
if (!app) {
|
|
21068
|
+
return {
|
|
21069
|
+
status: "failed",
|
|
21070
|
+
error: `Slack is configured but its client was not ready within ${slackReadyWait.timeoutMs}ms; message not sent`
|
|
21071
|
+
};
|
|
21072
|
+
}
|
|
21630
21073
|
}
|
|
21631
21074
|
try {
|
|
21632
21075
|
const result = await app.client.chat.postMessage({
|
|
@@ -21738,7 +21181,7 @@ var init_property_match = __esm(() => {
|
|
|
21738
21181
|
async function executeRawLlm(config) {
|
|
21739
21182
|
let modelName = config.model ?? "google/gemini-3-flash-preview";
|
|
21740
21183
|
try {
|
|
21741
|
-
const { createOpenAI } = await import("./index-
|
|
21184
|
+
const { createOpenAI } = await import("./index-m5gx1xd6.js");
|
|
21742
21185
|
const llmConfig = await resolveWorkflowLlmConfig(config.model);
|
|
21743
21186
|
modelName = llmConfig.model;
|
|
21744
21187
|
const provider = createOpenAI({
|
|
@@ -21748,7 +21191,7 @@ async function executeRawLlm(config) {
|
|
|
21748
21191
|
});
|
|
21749
21192
|
const model = provider(llmConfig.model);
|
|
21750
21193
|
if (config.schema) {
|
|
21751
|
-
const { generateObject, jsonSchema } = await import("./index-
|
|
21194
|
+
const { generateObject, jsonSchema } = await import("./index-0rvk3vd4.js");
|
|
21752
21195
|
const { object } = await generateObject({
|
|
21753
21196
|
model,
|
|
21754
21197
|
schema: jsonSchema(config.schema),
|
|
@@ -21762,7 +21205,7 @@ async function executeRawLlm(config) {
|
|
|
21762
21205
|
output: { result: object, model: modelName }
|
|
21763
21206
|
};
|
|
21764
21207
|
}
|
|
21765
|
-
const { generateText } = await import("./index-
|
|
21208
|
+
const { generateText } = await import("./index-0rvk3vd4.js");
|
|
21766
21209
|
const { text } = await generateText({
|
|
21767
21210
|
model,
|
|
21768
21211
|
prompt: config.prompt
|
|
@@ -22129,7 +21572,10 @@ var init_swarm_script = __esm(() => {
|
|
|
22129
21572
|
error: "swarm-script: fsMode 'workspace-rw' is v2 only; use 'none' or omit"
|
|
22130
21573
|
};
|
|
22131
21574
|
}
|
|
22132
|
-
const workflow = await this.deps.db.
|
|
21575
|
+
const workflow = await this.deps.db.getRunWorkflow({
|
|
21576
|
+
id: meta.runId,
|
|
21577
|
+
workflowId: meta.workflowId
|
|
21578
|
+
});
|
|
22133
21579
|
const agentId = workflow?.createdByAgentId ?? await getWorkflowRunTriggeredByAgentId(meta.runId) ?? undefined;
|
|
22134
21580
|
const resolved = await resolveScriptSource(config, agentId);
|
|
22135
21581
|
if (!resolved.ok) {
|
|
@@ -22319,8 +21765,8 @@ var init_validate2 = __esm(() => {
|
|
|
22319
21765
|
const interpolatedPrompt = this.deps.interpolate(prompt, context);
|
|
22320
21766
|
const outputStr = typeof targetOutput === "string" ? targetOutput : JSON.stringify(targetOutput);
|
|
22321
21767
|
try {
|
|
22322
|
-
const { createOpenAI } = await import("./index-
|
|
22323
|
-
const { generateObject, jsonSchema } = await import("./index-
|
|
21768
|
+
const { createOpenAI } = await import("./index-m5gx1xd6.js");
|
|
21769
|
+
const { generateObject, jsonSchema } = await import("./index-0rvk3vd4.js");
|
|
22324
21770
|
const llmConfig = await resolveWorkflowLlmConfig();
|
|
22325
21771
|
const provider = createOpenAI({
|
|
22326
21772
|
baseURL: llmConfig.baseURL,
|
|
@@ -22587,6 +22033,7 @@ async function prepareStandaloneScheduleTask(schedule, extraTags = []) {
|
|
|
22587
22033
|
routingSource: schedule.targetAgentId ? "engine_default" : undefined,
|
|
22588
22034
|
model: schedule.model,
|
|
22589
22035
|
modelTier: schedule.modelTier,
|
|
22036
|
+
profile: schedule.profile,
|
|
22590
22037
|
scheduleId: schedule.id,
|
|
22591
22038
|
source: "schedule",
|
|
22592
22039
|
requestedByUserId: schedule.createdBy,
|
|
@@ -23133,7 +22580,7 @@ function startScheduler2(registry, intervalMs = 1e4, opts) {
|
|
|
23133
22580
|
if (schedulerRun !== run)
|
|
23134
22581
|
return;
|
|
23135
22582
|
schedulerInterval = setInterval(() => {
|
|
23136
|
-
processSchedules().catch((err) => console.error("[Scheduler] Poll failed:", err));
|
|
22583
|
+
withLoopPath("scheduler.poll", () => processSchedules()).catch((err) => console.error("[Scheduler] Poll failed:", err));
|
|
23137
22584
|
}, intervalMs);
|
|
23138
22585
|
await processSchedules();
|
|
23139
22586
|
}).catch((err) => console.error("[Scheduler] Poll failed:", err));
|
|
@@ -23231,6 +22678,7 @@ var init_scheduler = __esm(() => {
|
|
|
23231
22678
|
init_workflows();
|
|
23232
22679
|
init_engine();
|
|
23233
22680
|
init_triggers();
|
|
22681
|
+
init_event_loop_lag();
|
|
23234
22682
|
init_business_use();
|
|
23235
22683
|
init_secret_scrubber();
|
|
23236
22684
|
init_deferred_task_waits();
|
|
@@ -24291,6 +23739,7 @@ var init_sdk_allowlist = __esm(() => {
|
|
|
24291
23739
|
modelCatalog_refresh: "model-catalog-refresh",
|
|
24292
23740
|
modelCatalog_overlayUpsert: "model-catalog-overlay-upsert",
|
|
24293
23741
|
modelProfile_list: "list-model-profiles",
|
|
23742
|
+
modelProfile_check: "check-model-profile",
|
|
24294
23743
|
slack_read: "slack-read",
|
|
24295
23744
|
slack_listChannels: "slack-list-channels",
|
|
24296
23745
|
slack_post: "slack-post",
|
|
@@ -24759,6 +24208,12 @@ function formatIdleDuration(ms) {
|
|
|
24759
24208
|
const remMinutes = minutes % 60;
|
|
24760
24209
|
return remMinutes > 0 ? `${hours}h${remMinutes}m` : `${hours}h`;
|
|
24761
24210
|
}
|
|
24211
|
+
function modelTierDeprecation(tier, harness) {
|
|
24212
|
+
if (!tier)
|
|
24213
|
+
return;
|
|
24214
|
+
const seeded = harness ? Boolean(DEFAULT_MODEL_TIER_MAP[harness]?.[tier]) : false;
|
|
24215
|
+
return { tier, suggestedProfile: seeded ? `${harness}-${tier}` : null };
|
|
24216
|
+
}
|
|
24762
24217
|
function composeWireResult(r) {
|
|
24763
24218
|
const normalizedDetails = r.details?.trim() || undefined;
|
|
24764
24219
|
const dataFallback = !normalizedDetails && r.data && Object.keys(r.data).length > 0 ? JSON.stringify(r.data, null, 2) : undefined;
|
|
@@ -25015,7 +24470,7 @@ function setPreloadedTools(server, names) {
|
|
|
25015
24470
|
async function applyPreToolCall(name, args, requestInfo, inputSchema) {
|
|
25016
24471
|
if (requestInfo.callOrigin !== "mcp")
|
|
25017
24472
|
return { args };
|
|
25018
|
-
const dispatcher = await import("./dispatcher-
|
|
24473
|
+
const dispatcher = await import("./dispatcher-jnybck15.js");
|
|
25019
24474
|
const result = await dispatcher.dispatchPre("pre.tool.call", { tool: name, args, requestInfo }, inputSchema ? {
|
|
25020
24475
|
validateModify: async (data) => {
|
|
25021
24476
|
const schema = normalizeObjectSchema(inputSchema) ?? inputSchema;
|
|
@@ -25108,17 +24563,28 @@ var scriptSdkRequestOrigins, extensionRequestOrigins, getRequestInfo = (req) =>
|
|
|
25108
24563
|
if (typeof ms !== "number")
|
|
25109
24564
|
return;
|
|
25110
24565
|
return `That reads as blocked-waiting, ${formatIdleDuration(ms)} since your last update — keep working if you can, and if the wait is genuinely long, defer-task is one way to resume later instead of polling.`;
|
|
25111
|
-
}, storeProgressNudge = (r) => {
|
|
24566
|
+
}, LEARNING_NOISE_FLOOR_NUDGES, storeProgressNudge = (r) => {
|
|
25112
24567
|
const learning = r.data?.learning;
|
|
25113
24568
|
if (r.ok && learning?.status === "duplicate" && typeof learning.memoryId === "string") {
|
|
25114
24569
|
return `That learning repeats memory ${learning.memoryId}; if your text adds something, memory-edit that memory instead of storing a new one.`;
|
|
25115
24570
|
}
|
|
24571
|
+
const noiseSteer = r.ok && learning?.status === "failed" && typeof learning.noiseFloor === "string" ? LEARNING_NOISE_FLOOR_NUDGES[learning.noiseFloor] : undefined;
|
|
24572
|
+
if (noiseSteer)
|
|
24573
|
+
return noiseSteer;
|
|
25116
24574
|
return storeProgressBlockedWaitingNudge(r);
|
|
25117
24575
|
}, workflowLongScriptTimeoutNudge = (r) => {
|
|
25118
24576
|
if (!r.ok)
|
|
25119
24577
|
return;
|
|
25120
24578
|
const hint = r.data?.longScriptTimeoutHint;
|
|
25121
24579
|
return hint ? WORKFLOW_LONG_SCRIPT_TIMEOUT_NUDGE : undefined;
|
|
24580
|
+
}, modelTierDeprecatedOutputSchema, modelTierDeprecatedNudge = (r) => {
|
|
24581
|
+
if (!r.ok)
|
|
24582
|
+
return;
|
|
24583
|
+
const note = r.data?.modelTierDeprecated;
|
|
24584
|
+
if (!note)
|
|
24585
|
+
return;
|
|
24586
|
+
const profile = typeof note.suggestedProfile === "string" ? note.suggestedProfile : `<harness>-${String(note.tier)}`;
|
|
24587
|
+
return `modelTier is deprecated: pass profile "${profile}" (same model).`;
|
|
25122
24588
|
}, createPageNudge = (r) => {
|
|
25123
24589
|
if (!r.ok)
|
|
25124
24590
|
return;
|
|
@@ -25200,7 +24666,7 @@ ${preview}`));
|
|
|
25200
24666
|
return (name, config, cb) => {
|
|
25201
24667
|
const toolConfig = preloadedToolsByServer.get(server)?.has(name) ? { ...config, _meta: { ...config._meta, "anthropic/alwaysLoad": true } } : config;
|
|
25202
24668
|
if (config.inputSchema === undefined) {
|
|
25203
|
-
|
|
24669
|
+
const handler = async (meta) => {
|
|
25204
24670
|
const requestInfo = getRequestInfo(meta);
|
|
25205
24671
|
return withSpan2("mcp.tool", async (span) => {
|
|
25206
24672
|
const pre = await applyPreToolCall(name, {}, requestInfo);
|
|
@@ -25219,9 +24685,10 @@ ${preview}`));
|
|
|
25219
24685
|
span.setAttributes(toolResultAttributes(result));
|
|
25220
24686
|
return result;
|
|
25221
24687
|
}, toolRequestAttributes(name, requestInfo));
|
|
25222
|
-
}
|
|
24688
|
+
};
|
|
24689
|
+
return server.registerTool(name, toolConfig, bindLoopPath(`mcp.tool ${name}`, handler));
|
|
25223
24690
|
}
|
|
25224
|
-
|
|
24691
|
+
const handler = async (args, meta) => {
|
|
25225
24692
|
const requestInfo = getRequestInfo(meta);
|
|
25226
24693
|
return withSpan2(`mcp.tool ${name}`, async (span) => {
|
|
25227
24694
|
const pre = await applyPreToolCall(name, args, requestInfo, config.inputSchema);
|
|
@@ -25241,18 +24708,21 @@ ${preview}`));
|
|
|
25241
24708
|
span.setAttributes(toolResultAttributes(result));
|
|
25242
24709
|
return result;
|
|
25243
24710
|
}, toolRequestAttributes(name, requestInfo, args));
|
|
25244
|
-
}
|
|
24711
|
+
};
|
|
24712
|
+
return server.registerTool(name, toolConfig, bindLoopPath(`mcp.tool ${name}`, handler));
|
|
25245
24713
|
};
|
|
25246
24714
|
};
|
|
25247
24715
|
var init_utils = __esm(() => {
|
|
25248
24716
|
init_zod_compat();
|
|
25249
24717
|
init_zod();
|
|
25250
24718
|
init_db4();
|
|
24719
|
+
init_event_loop_lag();
|
|
25251
24720
|
init_kv_overflow();
|
|
25252
24721
|
init_kv_view();
|
|
25253
24722
|
init_otel();
|
|
25254
24723
|
init_color_literals();
|
|
25255
24724
|
init_types3();
|
|
24725
|
+
init_types4();
|
|
25256
24726
|
init_secret_scrubber();
|
|
25257
24727
|
scriptSdkRequestOrigins = new WeakSet;
|
|
25258
24728
|
extensionRequestOrigins = new WeakSet;
|
|
@@ -25276,6 +24746,14 @@ var init_utils = __esm(() => {
|
|
|
25276
24746
|
nudge: string2().optional(),
|
|
25277
24747
|
truncation: swarmToolTruncationSchema.optional()
|
|
25278
24748
|
};
|
|
24749
|
+
LEARNING_NOISE_FLOOR_NUDGES = {
|
|
24750
|
+
"too-short": 'That learning was too short to hold a lesson; resend it as a title line, then the rule as "When X, do Y", or drop it if it is only status.',
|
|
24751
|
+
"repeats-progress": `That learning restates this call's progress or output; resend only the rule the next agent should follow ("When X, do Y"), or drop it.`
|
|
24752
|
+
};
|
|
24753
|
+
modelTierDeprecatedOutputSchema = looseObject({
|
|
24754
|
+
tier: string2().optional(),
|
|
24755
|
+
suggestedProfile: string2().nullable().optional()
|
|
24756
|
+
});
|
|
25279
24757
|
NUDGES = {
|
|
25280
24758
|
"defer-task": (r) => r.ok ? "Stop working on this task now; the wake-up task will carry your note." : undefined,
|
|
25281
24759
|
"store-progress": storeProgressNudge,
|
|
@@ -25288,6 +24766,11 @@ var init_utils = __esm(() => {
|
|
|
25288
24766
|
"patch-workflow": workflowLongScriptTimeoutNudge,
|
|
25289
24767
|
"patch-workflow-node": workflowLongScriptTimeoutNudge,
|
|
25290
24768
|
"slack-download-file": slackDownloadFileNudge,
|
|
24769
|
+
"send-task": modelTierDeprecatedNudge,
|
|
24770
|
+
"task-action": modelTierDeprecatedNudge,
|
|
24771
|
+
"create-schedule": modelTierDeprecatedNudge,
|
|
24772
|
+
"update-schedule": modelTierDeprecatedNudge,
|
|
24773
|
+
"patch-schedule": modelTierDeprecatedNudge,
|
|
25291
24774
|
"slack-read": slackReadNudge,
|
|
25292
24775
|
create_page: createPageNudge,
|
|
25293
24776
|
"script-search": (r) => {
|
|
@@ -26024,7 +25507,15 @@ async function callBridgeApi(name, args, config, options = {}) {
|
|
|
26024
25507
|
const message = data && typeof data === "object" && "error" in data ? String(data.error) : `api failed with ${res.status}`;
|
|
26025
25508
|
throw new Error(`swarm-sdk: ${name} failed with ${res.status}: ${message}`);
|
|
26026
25509
|
}
|
|
26027
|
-
|
|
25510
|
+
const envelope = data !== null && typeof data === "object" ? data : undefined;
|
|
25511
|
+
const toolRefused = envelope?.success === false;
|
|
25512
|
+
const refusalMessage = toolRefused ? envelope?.message : undefined;
|
|
25513
|
+
return scrubObject({
|
|
25514
|
+
success: res.ok && !toolRefused,
|
|
25515
|
+
status: res.status,
|
|
25516
|
+
data,
|
|
25517
|
+
...typeof refusalMessage === "string" ? { message: refusalMessage } : {}
|
|
25518
|
+
});
|
|
26028
25519
|
}
|
|
26029
25520
|
const res = await fetch(`${baseUrl}${request.path}`, {
|
|
26030
25521
|
method: request.method,
|
|
@@ -27468,7 +26959,7 @@ async function applyPreTaskCreate(args) {
|
|
|
27468
26959
|
}
|
|
27469
26960
|
var MODIFIABLE_OPTION_KEYS, MODIFIABLE_OPTION_KEY_SET;
|
|
27470
26961
|
var init_apply_task_create = __esm(() => {
|
|
27471
|
-
|
|
26962
|
+
init_model_validation2();
|
|
27472
26963
|
init_types4();
|
|
27473
26964
|
init_secret_scrubber();
|
|
27474
26965
|
init_event_bus();
|
|
@@ -32493,7 +31984,7 @@ async function loadAdapter(name, config, logger) {
|
|
|
32493
31984
|
const base = { ...config, apiUrl, logger };
|
|
32494
31985
|
switch (name) {
|
|
32495
31986
|
case "telegram": {
|
|
32496
|
-
const { TelegramAdapter } = await import("./index-
|
|
31987
|
+
const { TelegramAdapter } = await import("./index-rvccek1w.js");
|
|
32497
31988
|
|
|
32498
31989
|
class SwarmTelegramAdapter extends TelegramAdapter {
|
|
32499
31990
|
isBotMentioned(message, text) {
|
|
@@ -32507,7 +31998,7 @@ async function loadAdapter(name, config, logger) {
|
|
|
32507
31998
|
});
|
|
32508
31999
|
}
|
|
32509
32000
|
case "slack": {
|
|
32510
|
-
const { createSlackAdapter } = await import("./index-
|
|
32001
|
+
const { createSlackAdapter } = await import("./index-0eny15vj.js");
|
|
32511
32002
|
return createSlackAdapter({
|
|
32512
32003
|
...base,
|
|
32513
32004
|
signingSecret: config.signingSecret ?? "",
|
|
@@ -32517,7 +32008,7 @@ async function loadAdapter(name, config, logger) {
|
|
|
32517
32008
|
});
|
|
32518
32009
|
}
|
|
32519
32010
|
case "discord": {
|
|
32520
|
-
const { createDiscordAdapter } = await import("./index-
|
|
32011
|
+
const { createDiscordAdapter } = await import("./index-w7em4ktq.js");
|
|
32521
32012
|
return createDiscordAdapter({
|
|
32522
32013
|
...base,
|
|
32523
32014
|
logger: withInfoFilter(logger, keepDiscordInfoLine),
|
|
@@ -32526,7 +32017,7 @@ async function loadAdapter(name, config, logger) {
|
|
|
32526
32017
|
});
|
|
32527
32018
|
}
|
|
32528
32019
|
case "teams": {
|
|
32529
|
-
const { createTeamsAdapter } = await import("./index-
|
|
32020
|
+
const { createTeamsAdapter } = await import("./index-1qw6f2dc.js");
|
|
32530
32021
|
const { teamsWebhookVerifier, teamsToken } = getChatSdkTestHooks();
|
|
32531
32022
|
return createTeamsAdapter({
|
|
32532
32023
|
...base,
|
|
@@ -32735,7 +32226,7 @@ async function readPersistedThreadHistory(threadId) {
|
|
|
32735
32226
|
const rows = await new SqliteChatState().getList(`${SDK_THREAD_HISTORY_PREFIX}${threadId}`);
|
|
32736
32227
|
if (rows.length === 0)
|
|
32737
32228
|
return [];
|
|
32738
|
-
const { Message: MessageClass } = await import("./index-
|
|
32229
|
+
const { Message: MessageClass } = await import("./index-e5pfbsys.js");
|
|
32739
32230
|
return rows.map((row) => MessageClass.fromJSON(row));
|
|
32740
32231
|
}
|
|
32741
32232
|
var SDK_THREAD_HISTORY_PREFIX = "msg-history:";
|
|
@@ -32926,8 +32417,29 @@ async function assigneeLabel(task) {
|
|
|
32926
32417
|
const agent = await getAgentById2(task.agentId);
|
|
32927
32418
|
return agent ? `assigned to ${agent.name}` : "assigned to a removed agent";
|
|
32928
32419
|
}
|
|
32929
|
-
|
|
32930
|
-
const
|
|
32420
|
+
function commandScope(threadId) {
|
|
32421
|
+
const separator = threadId.indexOf(":");
|
|
32422
|
+
const adapter = threadId.slice(0, separator);
|
|
32423
|
+
const parts = threadId.slice(separator + 1).split(":");
|
|
32424
|
+
switch (adapter) {
|
|
32425
|
+
case "telegram":
|
|
32426
|
+
return "conversation";
|
|
32427
|
+
case "discord":
|
|
32428
|
+
if (parts[0] === "@me")
|
|
32429
|
+
return "conversation";
|
|
32430
|
+
return parts.length <= 2 ? "shared" : "conversation";
|
|
32431
|
+
case "slack":
|
|
32432
|
+
if (parts[1])
|
|
32433
|
+
return "conversation";
|
|
32434
|
+
return parts[0]?.startsWith("D") ? "dm" : "shared";
|
|
32435
|
+
default:
|
|
32436
|
+
return "shared";
|
|
32437
|
+
}
|
|
32438
|
+
}
|
|
32439
|
+
async function statusText(target) {
|
|
32440
|
+
const latest = target ? await getLatestTaskByContextKey2(chatSdkContextKey(target.threadId), {
|
|
32441
|
+
requestedByUserId: target.owner
|
|
32442
|
+
}) : null;
|
|
32931
32443
|
if (!latest)
|
|
32932
32444
|
return "No task yet for this chat. Send a message to create one.";
|
|
32933
32445
|
const lines = [
|
|
@@ -32939,27 +32451,65 @@ async function statusText(contextKey) {
|
|
|
32939
32451
|
return lines.join(`
|
|
32940
32452
|
`);
|
|
32941
32453
|
}
|
|
32942
|
-
async function cancelActiveTasks(
|
|
32454
|
+
async function cancelActiveTasks(target, requestedBy) {
|
|
32943
32455
|
const cancelled = [];
|
|
32944
|
-
|
|
32945
|
-
const
|
|
32946
|
-
|
|
32947
|
-
|
|
32948
|
-
|
|
32949
|
-
|
|
32950
|
-
|
|
32951
|
-
|
|
32952
|
-
|
|
32953
|
-
|
|
32456
|
+
if (target) {
|
|
32457
|
+
const contextKey = chatSdkContextKey(target.threadId);
|
|
32458
|
+
for (let i = 0;i < CANCEL_LIMIT; i++) {
|
|
32459
|
+
const active = await getLatestActiveTaskByContextKey2(contextKey, "chat", target.owner);
|
|
32460
|
+
if (!active)
|
|
32461
|
+
break;
|
|
32462
|
+
const task = await cancelTask2(active.id, `Cancelled from chat by ${requestedBy}`);
|
|
32463
|
+
if (!task)
|
|
32464
|
+
break;
|
|
32465
|
+
if (task.agentId)
|
|
32466
|
+
await updateAgentStatusFromCapacity2(task.agentId);
|
|
32467
|
+
cancelled.push(task);
|
|
32468
|
+
}
|
|
32469
|
+
if (!await getLatestActiveTaskByContextKey2(contextKey, "chat")) {
|
|
32470
|
+
stopTypingKeepalive(target.threadId);
|
|
32471
|
+
}
|
|
32954
32472
|
}
|
|
32955
|
-
stopTypingKeepalive(threadId);
|
|
32956
32473
|
if (cancelled.length === 0)
|
|
32957
32474
|
return "No running task in this chat.";
|
|
32958
32475
|
const ids = cancelled.map(shortId).join(", ");
|
|
32959
32476
|
return cancelled.length === 1 ? `Cancelled task ${ids}.` : `Cancelled ${cancelled.length} tasks: ${ids}.`;
|
|
32960
32477
|
}
|
|
32961
|
-
async function
|
|
32962
|
-
const
|
|
32478
|
+
async function resolveCommandTarget(threadId, activeOnly, senderUserId) {
|
|
32479
|
+
const scope = commandScope(threadId);
|
|
32480
|
+
if (scope === "conversation")
|
|
32481
|
+
return { threadId };
|
|
32482
|
+
if (scope === "shared" && !senderUserId)
|
|
32483
|
+
return null;
|
|
32484
|
+
const owner = scope === "shared" ? senderUserId : undefined;
|
|
32485
|
+
const contextKey = chatSdkContextKey(threadId);
|
|
32486
|
+
const exact = activeOnly ? await getLatestActiveTaskByContextKey2(contextKey, "chat", owner) : await getLatestTaskByContextKey2(contextKey, { requestedByUserId: owner });
|
|
32487
|
+
const threaded = await getLatestTaskByContextKeyPrefix2(`${contextKey}${encodeURIComponent(":")}`, activeOnly ? { activeOnly, source: "chat", requestedByUserId: owner } : { requestedByUserId: owner });
|
|
32488
|
+
const latest = exact && threaded && threaded.createdAt > exact.createdAt ? threaded : exact ?? threaded;
|
|
32489
|
+
const found = chatThreadOfContextKey(latest?.contextKey)?.threadId;
|
|
32490
|
+
if (found)
|
|
32491
|
+
return owner ? { threadId: found, owner } : { threadId: found };
|
|
32492
|
+
return scope === "dm" ? { threadId: `${threadId}:` } : null;
|
|
32493
|
+
}
|
|
32494
|
+
async function resetText(target) {
|
|
32495
|
+
if (!target)
|
|
32496
|
+
return "No conversation of yours here to reset.";
|
|
32497
|
+
const contextKey = chatSdkContextKey(target.threadId);
|
|
32498
|
+
if (target.owner && await getLatestTaskByContextKey2(contextKey, { notRequestedByUserId: target.owner })) {
|
|
32499
|
+
return "Other people also asked in your latest thread, so a reset would change their context. Nothing was reset.";
|
|
32500
|
+
}
|
|
32501
|
+
await markChatThreadReset(target.threadId);
|
|
32502
|
+
const lines = ["Context reset. Your next message starts a new conversation."];
|
|
32503
|
+
if (await getLatestActiveTaskByContextKey2(contextKey, "chat")) {
|
|
32504
|
+
lines.push("A task is still running in this chat. Send /cancel to stop it.");
|
|
32505
|
+
}
|
|
32506
|
+
return lines.join(`
|
|
32507
|
+
`);
|
|
32508
|
+
}
|
|
32509
|
+
async function runChatCommand(command, threadId, requestedBy, senderUserId) {
|
|
32510
|
+
let name = command.replace(/^\//, "").toLowerCase();
|
|
32511
|
+
if (name.startsWith(COMMAND_ALIAS_PREFIX))
|
|
32512
|
+
name = name.slice(COMMAND_ALIAS_PREFIX.length);
|
|
32963
32513
|
if (name === "help")
|
|
32964
32514
|
return helpText();
|
|
32965
32515
|
if (name === "start")
|
|
@@ -32968,30 +32518,33 @@ async function runChatCommand(command, threadId, requestedBy) {
|
|
|
32968
32518
|
return `Unknown command /${name}.
|
|
32969
32519
|
${helpText()}`;
|
|
32970
32520
|
}
|
|
32971
|
-
let contextKey;
|
|
32972
32521
|
try {
|
|
32973
|
-
|
|
32522
|
+
chatSdkContextKey(threadId);
|
|
32974
32523
|
} catch {
|
|
32975
32524
|
return "This command works only in a chat the swarm can address.";
|
|
32976
32525
|
}
|
|
32977
32526
|
switch (name) {
|
|
32978
32527
|
case "status":
|
|
32979
|
-
return statusText(
|
|
32528
|
+
return statusText(await resolveCommandTarget(threadId, false, senderUserId));
|
|
32980
32529
|
case "cancel":
|
|
32981
|
-
return cancelActiveTasks(
|
|
32982
|
-
case "reset":
|
|
32983
|
-
await
|
|
32984
|
-
const lines = ["Context reset. Your next message starts a new conversation."];
|
|
32985
|
-
if (await getLatestActiveTaskByContextKey2(contextKey, "chat")) {
|
|
32986
|
-
lines.push("A task is still running in this chat. Send /cancel to stop it.");
|
|
32987
|
-
}
|
|
32988
|
-
return lines.join(`
|
|
32989
|
-
`);
|
|
32990
|
-
}
|
|
32530
|
+
return cancelActiveTasks(await resolveCommandTarget(threadId, true, senderUserId), requestedBy);
|
|
32531
|
+
case "reset":
|
|
32532
|
+
return resetText(await resolveCommandTarget(threadId, false, senderUserId));
|
|
32991
32533
|
default:
|
|
32992
32534
|
return helpText();
|
|
32993
32535
|
}
|
|
32994
32536
|
}
|
|
32537
|
+
async function resolveCommandSender(adapter, userId) {
|
|
32538
|
+
if (!userId || userId.startsWith("chat:"))
|
|
32539
|
+
return;
|
|
32540
|
+
try {
|
|
32541
|
+
const resolution = await resolveIdentity(adapter, userId);
|
|
32542
|
+
return resolution.status === "resolved" ? resolution.userId : undefined;
|
|
32543
|
+
} catch (error) {
|
|
32544
|
+
console.warn(`[chat-sdk] Could not resolve the command sender: ${errorMessage(error)}`);
|
|
32545
|
+
return;
|
|
32546
|
+
}
|
|
32547
|
+
}
|
|
32995
32548
|
async function onSlashCommand(event) {
|
|
32996
32549
|
const adapter = event.adapter.name;
|
|
32997
32550
|
const threadId = event.channel.id;
|
|
@@ -32999,7 +32552,8 @@ async function onSlashCommand(event) {
|
|
|
32999
32552
|
console.log(`[chat-sdk] ${adapter} ${threadId}: command ${event.command} from ${requestedBy}`);
|
|
33000
32553
|
let reply;
|
|
33001
32554
|
try {
|
|
33002
|
-
|
|
32555
|
+
const senderUserId = await resolveCommandSender(adapter, event.user.userId);
|
|
32556
|
+
reply = await runChatCommand(event.command, threadId, requestedBy, senderUserId);
|
|
33003
32557
|
} catch (error) {
|
|
33004
32558
|
console.warn(scrubSecrets(`[chat-sdk] ${threadId}: command ${event.command} failed: ${errorMessage(error)}`));
|
|
33005
32559
|
reply = "The command failed. Check the API log.";
|
|
@@ -33028,9 +32582,10 @@ async function registerTelegramCommands(config) {
|
|
|
33028
32582
|
commands: CHAT_COMMANDS.map((c) => ({ command: c.command, description: c.description }))
|
|
33029
32583
|
});
|
|
33030
32584
|
}
|
|
33031
|
-
var CHAT_COMMANDS, RESET_KEY_PREFIX = "swarm:reset:", RESET_TTL_MS, CANCEL_LIMIT = 20;
|
|
32585
|
+
var CHAT_COMMANDS, COMMAND_ALIAS_PREFIX = "agent-swarm-", RESET_KEY_PREFIX = "swarm:reset:", RESET_TTL_MS, CANCEL_LIMIT = 20;
|
|
33032
32586
|
var init_commands = __esm(() => {
|
|
33033
32587
|
init_db4();
|
|
32588
|
+
init_identity();
|
|
33034
32589
|
init_context_key();
|
|
33035
32590
|
init_secret_scrubber();
|
|
33036
32591
|
init_adapters();
|
|
@@ -33172,9 +32727,47 @@ async function rememberSessionLabel(key, label, ttlMs) {
|
|
|
33172
32727
|
expiresAt: ttlMs === undefined ? null : Date.now() + ttlMs
|
|
33173
32728
|
});
|
|
33174
32729
|
}
|
|
33175
|
-
|
|
32730
|
+
async function getResourceSessionLabels(keys) {
|
|
32731
|
+
const groups = keys.flatMap((key) => {
|
|
32732
|
+
const resource = sessionResourceGroupOf(key);
|
|
32733
|
+
return resource ? [{ key, resource }] : [];
|
|
32734
|
+
});
|
|
32735
|
+
const labels = {};
|
|
32736
|
+
for (const { key, resource } of groups) {
|
|
32737
|
+
if (resource.action)
|
|
32738
|
+
labels[key] = resource.action;
|
|
32739
|
+
}
|
|
32740
|
+
const rowId = (resource) => resource.kind === "fs" ? resource.id.slice(resource.id.lastIndexOf(":") + 1) : resource.id;
|
|
32741
|
+
await Promise.all(SESSION_RESOURCE_KINDS.map(async (kind) => {
|
|
32742
|
+
const wanted = groups.filter(({ resource }) => resource.kind === kind && !resource.action);
|
|
32743
|
+
if (wanted.length === 0)
|
|
32744
|
+
return;
|
|
32745
|
+
const ids = [...new Set(wanted.map(({ resource }) => rowId(resource)))];
|
|
32746
|
+
const { table, column } = RESOURCE_NAMES[kind];
|
|
32747
|
+
const rows = await getDbClient2().query(`SELECT lower(id) AS id, NULLIF(trim(${column}), '') AS name FROM ${table}
|
|
32748
|
+
WHERE id IN (${ids.map(() => "?").join(", ")})`, ids);
|
|
32749
|
+
const names = new Map(rows.map((row) => [row.id, row.name]));
|
|
32750
|
+
for (const { key, resource } of wanted) {
|
|
32751
|
+
const name = names.get(rowId(resource));
|
|
32752
|
+
if (!name)
|
|
32753
|
+
continue;
|
|
32754
|
+
labels[key] = kind === "fs" ? name.replace(/\/+$/, "").split("/").pop() || name : name;
|
|
32755
|
+
}
|
|
32756
|
+
}));
|
|
32757
|
+
return labels;
|
|
32758
|
+
}
|
|
32759
|
+
var NAMESPACE = "session-labels", RESOURCE_NAMES;
|
|
33176
32760
|
var init_session_labels = __esm(() => {
|
|
32761
|
+
init_key();
|
|
33177
32762
|
init_db4();
|
|
32763
|
+
RESOURCE_NAMES = {
|
|
32764
|
+
page: { table: "pages", column: "title" },
|
|
32765
|
+
workflow: { table: "workflows", column: "name" },
|
|
32766
|
+
schedule: { table: "scheduled_tasks", column: "name" },
|
|
32767
|
+
app: { table: "apps", column: "name" },
|
|
32768
|
+
script: { table: "scripts", column: "name" },
|
|
32769
|
+
fs: { table: "asset_key_mappings", column: "provider_key" }
|
|
32770
|
+
};
|
|
33178
32771
|
});
|
|
33179
32772
|
|
|
33180
32773
|
// src/be/unmapped-identities.ts
|
|
@@ -33625,6 +33218,95 @@ var init_attachments = __esm(() => {
|
|
|
33625
33218
|
CHAT_INBOUND_FILE_LIMITS = { telegram: 20 * MB };
|
|
33626
33219
|
});
|
|
33627
33220
|
|
|
33221
|
+
// src/integrations/chat-sdk/message-text.ts
|
|
33222
|
+
function chatMessageText(message) {
|
|
33223
|
+
try {
|
|
33224
|
+
const rendered = message.formatted ? renderBlocks(message.formatted).trim() : "";
|
|
33225
|
+
if (rendered)
|
|
33226
|
+
return rendered;
|
|
33227
|
+
} catch {}
|
|
33228
|
+
return message.text ?? "";
|
|
33229
|
+
}
|
|
33230
|
+
function renderBlocks(node) {
|
|
33231
|
+
return (node.children ?? []).map(render).join(`
|
|
33232
|
+
|
|
33233
|
+
`);
|
|
33234
|
+
}
|
|
33235
|
+
function renderInline(node) {
|
|
33236
|
+
return (node.children ?? []).map(render).join("");
|
|
33237
|
+
}
|
|
33238
|
+
function inlineCode(value) {
|
|
33239
|
+
const longest = Math.max(0, ...(value.match(/`+/g) ?? []).map((run) => run.length));
|
|
33240
|
+
const fence = "`".repeat(longest + 1);
|
|
33241
|
+
const pad = value.startsWith("`") || value.endsWith("`") ? " " : "";
|
|
33242
|
+
return `${fence}${pad}${value}${pad}${fence}`;
|
|
33243
|
+
}
|
|
33244
|
+
function codeBlock(value, lang) {
|
|
33245
|
+
const longest = Math.max(2, ...(value.match(/`{3,}/gm) ?? []).map((run) => run.length));
|
|
33246
|
+
const fence = "`".repeat(longest + 1);
|
|
33247
|
+
return `${fence}${lang ?? ""}
|
|
33248
|
+
${value}
|
|
33249
|
+
${fence}`;
|
|
33250
|
+
}
|
|
33251
|
+
function renderList(node) {
|
|
33252
|
+
const start = node.start ?? 1;
|
|
33253
|
+
return (node.children ?? []).map((item, index) => {
|
|
33254
|
+
const marker = node.ordered ? `${start + index}. ` : "- ";
|
|
33255
|
+
const pad = " ".repeat(marker.length);
|
|
33256
|
+
const [first = "", ...rest] = (item.children ?? []).map(render).join(`
|
|
33257
|
+
`).split(`
|
|
33258
|
+
`);
|
|
33259
|
+
return [`${marker}${first}`, ...rest.map((line) => line ? pad + line : line)].join(`
|
|
33260
|
+
`);
|
|
33261
|
+
}).join(`
|
|
33262
|
+
`);
|
|
33263
|
+
}
|
|
33264
|
+
function render(node) {
|
|
33265
|
+
switch (node.type) {
|
|
33266
|
+
case "text":
|
|
33267
|
+
case "html":
|
|
33268
|
+
return node.value ?? "";
|
|
33269
|
+
case "inlineCode":
|
|
33270
|
+
return inlineCode(node.value ?? "");
|
|
33271
|
+
case "code":
|
|
33272
|
+
return codeBlock(node.value ?? "", node.lang);
|
|
33273
|
+
case "link": {
|
|
33274
|
+
const label = renderInline(node);
|
|
33275
|
+
return !label || label === node.url ? node.url ?? "" : `[${label}](${node.url ?? ""})`;
|
|
33276
|
+
}
|
|
33277
|
+
case "image":
|
|
33278
|
+
return ``;
|
|
33279
|
+
case "strong":
|
|
33280
|
+
return `**${renderInline(node)}**`;
|
|
33281
|
+
case "emphasis":
|
|
33282
|
+
return `_${renderInline(node)}_`;
|
|
33283
|
+
case "delete":
|
|
33284
|
+
return `~~${renderInline(node)}~~`;
|
|
33285
|
+
case "break":
|
|
33286
|
+
return `
|
|
33287
|
+
`;
|
|
33288
|
+
case "thematicBreak":
|
|
33289
|
+
return "---";
|
|
33290
|
+
case "heading":
|
|
33291
|
+
return `${"#".repeat(node.depth ?? 1)} ${renderInline(node)}`;
|
|
33292
|
+
case "blockquote":
|
|
33293
|
+
return renderBlocks(node).split(`
|
|
33294
|
+
`).map((line) => `> ${line}`.trimEnd()).join(`
|
|
33295
|
+
`);
|
|
33296
|
+
case "list":
|
|
33297
|
+
return renderList(node);
|
|
33298
|
+
case "table":
|
|
33299
|
+
return codeBlock(tableToAscii2(node), null);
|
|
33300
|
+
case "paragraph":
|
|
33301
|
+
return renderInline(node);
|
|
33302
|
+
default:
|
|
33303
|
+
return node.children ? renderBlocks(node) : node.value ?? "";
|
|
33304
|
+
}
|
|
33305
|
+
}
|
|
33306
|
+
var init_message_text2 = __esm(() => {
|
|
33307
|
+
init_dist4();
|
|
33308
|
+
});
|
|
33309
|
+
|
|
33628
33310
|
// src/integrations/chat-sdk/limits.ts
|
|
33629
33311
|
function chatMessageLimit(adapter) {
|
|
33630
33312
|
return CHAT_MESSAGE_LIMITS[adapter] ?? FALLBACK_LIMIT;
|
|
@@ -34275,7 +33957,7 @@ async function handleChatInbound(thread, message, kind) {
|
|
|
34275
33957
|
text: message.text,
|
|
34276
33958
|
messageId: message.id
|
|
34277
33959
|
});
|
|
34278
|
-
let text = stripBotMention(message
|
|
33960
|
+
let text = stripBotMention(chatMessageText(message), thread.adapter);
|
|
34279
33961
|
const immediate = /^!now\b/i.test(text);
|
|
34280
33962
|
if (immediate)
|
|
34281
33963
|
text = text.replace(/^!now\s*/i, "").trim();
|
|
@@ -34402,12 +34084,12 @@ async function getChatThreadContext(thread, exclude, since) {
|
|
|
34402
34084
|
byId.set(m.id, m);
|
|
34403
34085
|
for (const m of thread.recentMessages)
|
|
34404
34086
|
byId.set(m.id, m);
|
|
34405
|
-
return [...byId.values()].sort((a, b) => a.metadata.dateSent.getTime() - b.metadata.dateSent.getTime()).filter((m) => !exclude.has(m.id) &&
|
|
34087
|
+
return [...byId.values()].sort((a, b) => a.metadata.dateSent.getTime() - b.metadata.dateSent.getTime()).map((m) => ({ m, text: chatMessageText(m) })).filter(({ m, text }) => !exclude.has(m.id) && text.trim() !== "").filter(({ m }) => since === null || m.metadata.dateSent.getTime() > since.getTime()).slice(-THREAD_CONTEXT_LIMIT).map(({ m, text }) => {
|
|
34406
34088
|
if (m.author.isMe || m.author.isBot === true) {
|
|
34407
|
-
const truncated =
|
|
34089
|
+
const truncated = text.length > AGENT_MESSAGE_TRUNCATE ? `${text.slice(0, AGENT_MESSAGE_TRUNCATE)}...` : text;
|
|
34408
34090
|
return `[Agent]: ${truncated}`;
|
|
34409
34091
|
}
|
|
34410
|
-
return `${m.author.userName || m.author.fullName || m.author.userId}: ${
|
|
34092
|
+
return `${m.author.userName || m.author.fullName || m.author.userId}: ${text}`;
|
|
34411
34093
|
}).join(`
|
|
34412
34094
|
`);
|
|
34413
34095
|
} catch (error) {
|
|
@@ -34665,6 +34347,7 @@ var init_inbound = __esm(() => {
|
|
|
34665
34347
|
init_commands();
|
|
34666
34348
|
init_facts();
|
|
34667
34349
|
init_logger();
|
|
34350
|
+
init_message_text2();
|
|
34668
34351
|
init_outbound2();
|
|
34669
34352
|
init_reactions3();
|
|
34670
34353
|
init_router2();
|
|
@@ -35087,7 +34770,7 @@ async function startChatSdk() {
|
|
|
35087
34770
|
for (const [name, reason] of Object.entries(config.incomplete ?? {})) {
|
|
35088
34771
|
console.warn(`[chat-sdk] ${name} not started, incomplete: ${scrubSecrets(reason)}`);
|
|
35089
34772
|
}
|
|
35090
|
-
const { Chat: ChatClass } = await import("./index-
|
|
34773
|
+
const { Chat: ChatClass } = await import("./index-e5pfbsys.js");
|
|
35091
34774
|
const state = new SqliteChatState;
|
|
35092
34775
|
startChatRelayWatcher();
|
|
35093
34776
|
await Promise.all(CHAT_SDK_ADAPTER_NAMES.map(async (name) => {
|
|
@@ -35994,7 +35677,7 @@ async function notifySlack(text) {
|
|
|
35994
35677
|
return;
|
|
35995
35678
|
}
|
|
35996
35679
|
try {
|
|
35997
|
-
const { getSlackApp } = await import("./app-
|
|
35680
|
+
const { getSlackApp } = await import("./app-b9fbkp9v.js");
|
|
35998
35681
|
const app = getSlackApp();
|
|
35999
35682
|
if (!app) {
|
|
36000
35683
|
console.warn("[Jira webhook keepalive] Slack not available, cannot send notification");
|
|
@@ -36065,7 +35748,7 @@ async function deleteJiraWebhook(webhookId) {
|
|
|
36065
35748
|
console.log(`[Jira webhook keepalive] Deleted webhook id=${webhookId}`);
|
|
36066
35749
|
}
|
|
36067
35750
|
async function overwriteWebhookIds(next) {
|
|
36068
|
-
const { getDbClient } = await import("./db-
|
|
35751
|
+
const { getDbClient } = await import("./db-c6np41ca.js");
|
|
36069
35752
|
await getDbClient().transaction(async (tx) => {
|
|
36070
35753
|
const row = await tx.get("SELECT metadata FROM oauth_apps WHERE provider = 'jira'");
|
|
36071
35754
|
if (!row) {
|
|
@@ -109557,17 +109240,17 @@ async function loadGlobalConfigsIntoEnv(override = false) {
|
|
|
109557
109240
|
return updated;
|
|
109558
109241
|
}
|
|
109559
109242
|
async function reloadGlobalConfigsAndIntegrations() {
|
|
109560
|
-
return runWithoutRequestAuth(() => reloadGlobalConfigsAndIntegrationsInner());
|
|
109243
|
+
return runWithoutRequestAuth(() => runSlackLifecycleExclusive(() => reloadGlobalConfigsAndIntegrationsInner()));
|
|
109561
109244
|
}
|
|
109562
109245
|
async function reloadGlobalConfigsAndIntegrationsInner() {
|
|
109563
|
-
const { getEmbeddingProvider, resetEmbeddingProvider } = await import("./index-
|
|
109246
|
+
const { getEmbeddingProvider, resetEmbeddingProvider } = await import("./index-ysvbhg5m.js");
|
|
109564
109247
|
const wasEmbeddingsConfigured = getEmbeddingProvider().isConfigured();
|
|
109565
109248
|
const updated = await loadGlobalConfigsIntoEnv(true);
|
|
109566
109249
|
await syncTelemetryEnabled("settings").catch((err) => {
|
|
109567
109250
|
console.error("[config-reload] telemetry re-init failed (non-fatal):", err);
|
|
109568
109251
|
});
|
|
109569
|
-
await
|
|
109570
|
-
const { resetFileStorageProvider } = await import("./registry-
|
|
109252
|
+
await stopSlackAppUnderLifecycleLock2();
|
|
109253
|
+
const { resetFileStorageProvider } = await import("./registry-32b1mft6.js");
|
|
109571
109254
|
resetFileStorageProvider();
|
|
109572
109255
|
resetEmbeddingProvider();
|
|
109573
109256
|
const isEmbeddingsConfigured = getEmbeddingProvider().isConfigured();
|
|
@@ -109576,7 +109259,7 @@ async function reloadGlobalConfigsAndIntegrationsInner() {
|
|
|
109576
109259
|
integrations.push("embeddings");
|
|
109577
109260
|
}
|
|
109578
109261
|
if (isEmbeddingsConfigured) {
|
|
109579
|
-
import("./embedding-space-
|
|
109262
|
+
import("./embedding-space-crsm2zp0.js").then(({ runEmbeddingMaintenance }) => runEmbeddingMaintenance({ backfill: !wasEmbeddingsConfigured })).catch((err) => {
|
|
109580
109263
|
console.error("[config-reload] embedding maintenance failed (non-fatal):", err);
|
|
109581
109264
|
});
|
|
109582
109265
|
}
|
|
@@ -109970,6 +109653,7 @@ var init_core = __esm(() => {
|
|
|
109970
109653
|
init_linear();
|
|
109971
109654
|
init_rbac();
|
|
109972
109655
|
init_slack();
|
|
109656
|
+
init_lifecycle_lock();
|
|
109973
109657
|
init_multi_runtime2();
|
|
109974
109658
|
init_request_auth_context();
|
|
109975
109659
|
init_secret_scrubber();
|
|
@@ -113431,6 +113115,7 @@ var init_apps = __esm(() => {
|
|
|
113431
113115
|
id: string2(),
|
|
113432
113116
|
name: string2(),
|
|
113433
113117
|
description: string2().optional(),
|
|
113118
|
+
icon: AppIconSchema.optional(),
|
|
113434
113119
|
createdAt: string2(),
|
|
113435
113120
|
updatedAt: string2()
|
|
113436
113121
|
});
|
|
@@ -114583,7 +114268,7 @@ var init_app_sync = __esm(() => {
|
|
|
114583
114268
|
var registerAppUpsertTool = (server) => {
|
|
114584
114269
|
createToolRegistrar(server)("app-upsert", {
|
|
114585
114270
|
title: "Create or update an app",
|
|
114586
|
-
description:
|
|
114271
|
+
description: `Stores a schema-backed app definition with models, queries/actions, pages, reusable elements, optional userConfig fields, an optional top-level theme (a dashboard preset slug for the app's canvas: hive (stock; omit to inherit the viewer's theme), meadow, iris, rose, cobalt, ember, carbon, paper (the warm editorial paper look), plus the classic presets github, vscode, material, solarized, tokyo, monokai, gruvbox, catppuccin; viewers can override it per-user; unknown slugs degrade to the viewer's dashboard theme), and an optional top-level icon ({ type: "lucide", icon: "<kebab-case lucide icon name>", color?: "#RRGGBB" }) shown as the app's icon on the dashboard Apps page (omit it, or use an unrecognized name, for a generic default), then returns its dashboard URL. userConfig is versioned schema only; each user's values are stored separately, survive rollback, and schema changes are always compatible. Pages may bind a declared field read-only at exactly /user/<field>; pure and bound reusable elements must receive that value through a prop. Elements are private by default: pure elements read declared props, allow $item/$index inside repeats, may expose one leaf ElementSlot, and cannot invoke actions; bound elements may use the defining app's queries/actions, while exported bound elements cannot navigate. Prop kinds include enum with a required non-empty enum values array. Pages or elements reuse them with literal ElementRef targets, and cross-app refs require export: true. Zero-model pure-UI apps are valid. Pass appId to update; breaking a referenced export is blocked by the compatibility gate unless forceElementBreak explicitly names it.`,
|
|
114587
114272
|
annotations: { destructiveHint: false },
|
|
114588
114273
|
inputSchema: object2({
|
|
114589
114274
|
name: string2().min(1).describe("Human-readable app name."),
|
|
@@ -119484,6 +119169,29 @@ async function createWorkerTaskFollowUp2(args) {
|
|
|
119484
119169
|
} catch {}
|
|
119485
119170
|
return null;
|
|
119486
119171
|
}
|
|
119172
|
+
let chainRejection = null;
|
|
119173
|
+
if (status === "completed" && args.chainedTaskId) {
|
|
119174
|
+
const chain = await checkChainedTask(task, args.chainedTaskId, args.completingAgentId ?? task.agentId ?? "");
|
|
119175
|
+
if (chain.ok) {
|
|
119176
|
+
try {
|
|
119177
|
+
await createLogEntry2({
|
|
119178
|
+
eventType: "task_follow_up_suppressed",
|
|
119179
|
+
taskId: task.id,
|
|
119180
|
+
agentId: leadAgent.id,
|
|
119181
|
+
metadata: {
|
|
119182
|
+
reason: "chained_task_live",
|
|
119183
|
+
status,
|
|
119184
|
+
chainedTaskId: chain.child.id,
|
|
119185
|
+
chainedTaskStatus: chain.child.status,
|
|
119186
|
+
...task.followUpConfig?.onCompleted ? { droppedOnCompleted: true } : {}
|
|
119187
|
+
}
|
|
119188
|
+
});
|
|
119189
|
+
} catch {}
|
|
119190
|
+
console.log(`[worker-follow-up] Skipped follow-up for completed task ${task.id.slice(0, 8)}: work continues in chained task ${chain.child.id.slice(0, 8)} (${chain.child.status})`);
|
|
119191
|
+
return null;
|
|
119192
|
+
}
|
|
119193
|
+
chainRejection = chain;
|
|
119194
|
+
}
|
|
119487
119195
|
const agentName = taskAgent.name || task.agentId?.slice(0, 8) || "Unknown";
|
|
119488
119196
|
const taskDesc = task.task.slice(0, 200);
|
|
119489
119197
|
const creatorAgent = task.creatorAgentId ? `${task.creatorAgentId}${task.creatorAgentId === leadAgent.id ? " (you)" : ""}` : "<none>";
|
|
@@ -119505,6 +119213,12 @@ ${instructions}
|
|
|
119505
119213
|
task_id: task.id
|
|
119506
119214
|
});
|
|
119507
119215
|
followUpDescription = completedResult.text;
|
|
119216
|
+
if (chainRejection) {
|
|
119217
|
+
followUpDescription += resolveTemplate("task.worker.chain_rejected", {
|
|
119218
|
+
chained_task_id: chainRejection.chainedTaskId,
|
|
119219
|
+
reason: chainRejection.reason
|
|
119220
|
+
}).text;
|
|
119221
|
+
}
|
|
119508
119222
|
} else {
|
|
119509
119223
|
const reason = failureReason || "(no reason given)";
|
|
119510
119224
|
const failedResult = resolveTemplate("task.worker.failed", {
|
|
@@ -119544,7 +119258,7 @@ ${depLines.join(`
|
|
|
119544
119258
|
return null;
|
|
119545
119259
|
const changes = preFollowUp.action === "modify" ? preFollowUp.data : {};
|
|
119546
119260
|
const followUpAgentId = changes.agentId === undefined ? leadAgent.id : changes.agentId;
|
|
119547
|
-
const wake = followUpAgentId && !instructions ? await findDeferredWakeFor(task.id, followUpAgentId) : null;
|
|
119261
|
+
const wake = followUpAgentId && !instructions && !chainRejection ? await findDeferredWakeFor(task.id, followUpAgentId) : null;
|
|
119548
119262
|
if (wake) {
|
|
119549
119263
|
try {
|
|
119550
119264
|
await createLogEntry2({
|
|
@@ -119592,6 +119306,27 @@ ${depLines.join(`
|
|
|
119592
119306
|
}
|
|
119593
119307
|
return followUp;
|
|
119594
119308
|
}
|
|
119309
|
+
async function checkChainedTask(task, chainedTaskId, completingAgentId) {
|
|
119310
|
+
const reject = (reason) => ({ ok: false, chainedTaskId, reason });
|
|
119311
|
+
let child;
|
|
119312
|
+
try {
|
|
119313
|
+
child = await getTaskById2(chainedTaskId);
|
|
119314
|
+
} catch (err) {
|
|
119315
|
+
return reject(`lookup failed (${err instanceof Error ? err.message : String(err)})`);
|
|
119316
|
+
}
|
|
119317
|
+
if (!child)
|
|
119318
|
+
return reject("no task has this id");
|
|
119319
|
+
if (child.parentTaskId !== task.id) {
|
|
119320
|
+
return reject(child.parentTaskId ? `its parentTaskId is ${child.parentTaskId}, not this task` : "it has no parentTaskId");
|
|
119321
|
+
}
|
|
119322
|
+
if (!completingAgentId || child.creatorAgentId !== completingAgentId) {
|
|
119323
|
+
return reject("it was not created by the agent that completed this task");
|
|
119324
|
+
}
|
|
119325
|
+
if (!LIVE_CHAINED_TASK_STATUSES.has(child.status)) {
|
|
119326
|
+
return reject(`it is ${child.status}, not live`);
|
|
119327
|
+
}
|
|
119328
|
+
return { ok: true, child };
|
|
119329
|
+
}
|
|
119595
119330
|
async function deferredWorkChatContextKey(task) {
|
|
119596
119331
|
if (chatThreadOfContextKey(task.contextKey))
|
|
119597
119332
|
return;
|
|
@@ -119787,7 +119522,7 @@ async function createPoolStarvationDecisionTask2(args) {
|
|
|
119787
119522
|
});
|
|
119788
119523
|
return { kind: "created", task: created };
|
|
119789
119524
|
}
|
|
119790
|
-
var TaskFollowUpModifySchema, WORKER_LIVENESS_WINDOW_SECONDS, RESUME_GENERATION_TAG_PREFIX = "resume-generation:", CRASH_RECOVERY_PIN_TAG = "crash-recovery-pin", GRACEFUL_SHUTDOWN_PIN_TAG = "graceful-shutdown-pin", REBOOT_RETRY_PIN_TAG2 = "reboot-retry-pin", MAX_CONTINUATION_HOPS = 32;
|
|
119525
|
+
var TaskFollowUpModifySchema, WORKER_LIVENESS_WINDOW_SECONDS, RESUME_GENERATION_TAG_PREFIX = "resume-generation:", CRASH_RECOVERY_PIN_TAG = "crash-recovery-pin", GRACEFUL_SHUTDOWN_PIN_TAG = "graceful-shutdown-pin", REBOOT_RETRY_PIN_TAG2 = "reboot-retry-pin", LIVE_CHAINED_TASK_STATUSES, MAX_CONTINUATION_HOPS = 32;
|
|
119791
119526
|
var init_worker_follow_up = __esm(() => {
|
|
119792
119527
|
init_zod();
|
|
119793
119528
|
init_db4();
|
|
@@ -119811,6 +119546,13 @@ var init_worker_follow_up = __esm(() => {
|
|
|
119811
119546
|
followUpConfig: true
|
|
119812
119547
|
}).partial().extend({ description: string2().trim().min(1).optional() }).strict();
|
|
119813
119548
|
WORKER_LIVENESS_WINDOW_SECONDS = Number(process.env.WORKER_LIVENESS_WINDOW_SECONDS || "30");
|
|
119549
|
+
LIVE_CHAINED_TASK_STATUSES = new Set([
|
|
119550
|
+
"offered",
|
|
119551
|
+
"reviewing",
|
|
119552
|
+
"pending",
|
|
119553
|
+
"in_progress",
|
|
119554
|
+
"paused"
|
|
119555
|
+
]);
|
|
119814
119556
|
});
|
|
119815
119557
|
|
|
119816
119558
|
// src/tasks/task-terminal-effects.ts
|
|
@@ -119894,7 +119636,9 @@ ${taskContent}`,
|
|
|
119894
119636
|
task: { ...task, task: safeTask },
|
|
119895
119637
|
status,
|
|
119896
119638
|
output: safeOutput,
|
|
119897
|
-
failureReason: safeFailureReason
|
|
119639
|
+
failureReason: safeFailureReason,
|
|
119640
|
+
chainedTaskId: args.chainedTaskId,
|
|
119641
|
+
completingAgentId: agentId
|
|
119898
119642
|
});
|
|
119899
119643
|
if (followUp) {
|
|
119900
119644
|
console.log(`[task-terminal-effects] Created follow-up task ${followUp.id.slice(0, 8)} for ${status} task ${taskId.slice(0, 8)}`);
|
|
@@ -122769,7 +122513,7 @@ var agentMemoryOutputSchema, registerMemoryEditTool = (server) => {
|
|
|
122769
122513
|
newString: string2().optional().describe("Replacement for oldString. Required for 'exact' mode. Can be empty to delete."),
|
|
122770
122514
|
intent: string2().min(1).describe("Why you are editing this memory."),
|
|
122771
122515
|
expectedVersion: number2().int().min(1).optional(),
|
|
122772
|
-
newKey: string2().max(MEMORY_KEY_MAX_LENGTH).regex(MEMORY_KEY_PATTERN, MEMORY_KEY_PATTERN_MESSAGE).optional().describe(
|
|
122516
|
+
newKey: string2().max(MEMORY_KEY_MAX_LENGTH).regex(MEMORY_KEY_PATTERN, MEMORY_KEY_PATTERN_MESSAGE).optional().describe(`Move the memory to this logical path, for example '/longterm/facts/swarm-runtime/slug'. Alone it is a pure move: omit content/oldString/newString. Fails when the key is already used in this scope by the same owner. Moving into /longterm marks the memory as curated on every chunk: it stops expiring and is protected from cleanup, and moving it out later does not bring the expiry back. A move into /learnings starts a ${LEARNING_TTL_DAYS}-day expiry; a move out of /learnings takes the source's own expiry (none for manual). A key under /longterm must start with /longterm/company-story, /longterm/entities/people, /longterm/entities/customers, /longterm/facts, /longterm/decisions, /longterm/workstreams or /longterm/timeline. Paths under /longterm/company-story, /longterm/entities and /longterm/timeline are lead-only.`)
|
|
122773
122517
|
}),
|
|
122774
122518
|
outputSchema: swarmToolOutputSchema({
|
|
122775
122519
|
yourAgentId: string2().optional(),
|
|
@@ -122884,6 +122628,7 @@ var init_memory_edit = __esm(() => {
|
|
|
122884
122628
|
init_zod();
|
|
122885
122629
|
init_db4();
|
|
122886
122630
|
init_memory();
|
|
122631
|
+
init_constants2();
|
|
122887
122632
|
init_key_guard();
|
|
122888
122633
|
init_key_paths();
|
|
122889
122634
|
init_link_resolver();
|
|
@@ -123672,6 +123417,51 @@ var init_model_catalog = __esm(() => {
|
|
|
123672
123417
|
init_utils();
|
|
123673
123418
|
});
|
|
123674
123419
|
|
|
123420
|
+
// src/tools/model-profiles/check-model-profile.ts
|
|
123421
|
+
var registerCheckModelProfileTool = (server) => {
|
|
123422
|
+
createToolRegistrar(server)("check-model-profile", {
|
|
123423
|
+
title: "Check Model Profile",
|
|
123424
|
+
description: "Check whether an agent can run a model profile before you pass it as `profile` or set it as the agent's default. Judges the harness, the model, the agent's credential report and the profile's credential allowlist. Each row is pass, warn, fail or unverified; only a fail blocks.",
|
|
123425
|
+
annotations: { readOnlyHint: true },
|
|
123426
|
+
inputSchema: object2({
|
|
123427
|
+
agentId: string2().min(1).describe("The agent that would run the profile."),
|
|
123428
|
+
profile: string2().min(1).describe("Model profile name (see list-model-profiles).")
|
|
123429
|
+
}),
|
|
123430
|
+
outputSchema: swarmToolOutputSchema({
|
|
123431
|
+
result: looseObject({
|
|
123432
|
+
agentId: string2().optional(),
|
|
123433
|
+
ok: boolean().optional(),
|
|
123434
|
+
profiles: array2(looseObject({
|
|
123435
|
+
name: string2().optional(),
|
|
123436
|
+
ok: boolean().optional(),
|
|
123437
|
+
checks: array2(looseObject({
|
|
123438
|
+
check: string2().optional(),
|
|
123439
|
+
state: string2().optional(),
|
|
123440
|
+
detail: string2().optional()
|
|
123441
|
+
})).optional()
|
|
123442
|
+
})).optional()
|
|
123443
|
+
}).optional()
|
|
123444
|
+
})
|
|
123445
|
+
}, async ({ agentId, profile }) => {
|
|
123446
|
+
if (!await getAgentById2(agentId))
|
|
123447
|
+
return toolErr(`Agent ${agentId} not found.`);
|
|
123448
|
+
const result = await checkProfileForAgent(agentId, profile);
|
|
123449
|
+
if (!result) {
|
|
123450
|
+
return toolErr(`Unknown model profile "${profile}". List profiles with list-model-profiles.`);
|
|
123451
|
+
}
|
|
123452
|
+
const primary = result.profiles[0];
|
|
123453
|
+
const lines = (primary?.checks ?? []).map((row) => `${row.check}: ${row.state}${row.detail ? ` (${row.detail})` : ""}`);
|
|
123454
|
+
return toolOk(`Agent ${agentId} ${result.ok ? "can" : "cannot"} run model profile "${profile}".`, { details: lines.join(`
|
|
123455
|
+
`), data: { result } });
|
|
123456
|
+
});
|
|
123457
|
+
};
|
|
123458
|
+
var init_check_model_profile = __esm(() => {
|
|
123459
|
+
init_zod();
|
|
123460
|
+
init_db4();
|
|
123461
|
+
init_model_profile_check();
|
|
123462
|
+
init_utils();
|
|
123463
|
+
});
|
|
123464
|
+
|
|
123675
123465
|
// src/tools/model-profiles/list-model-profiles.ts
|
|
123676
123466
|
var registerListModelProfilesTool = (server) => {
|
|
123677
123467
|
createToolRegistrar(server)("list-model-profiles", {
|
|
@@ -132101,7 +131891,8 @@ var import_cron_parser2, createScheduleInputSchema, scheduleDataShape, registerC
|
|
|
132101
131891
|
inputSchema: createScheduleInputSchema,
|
|
132102
131892
|
outputSchema: swarmToolOutputSchema({
|
|
132103
131893
|
yourAgentId: string2().optional(),
|
|
132104
|
-
schedule: looseObject(scheduleDataShape).optional()
|
|
131894
|
+
schedule: looseObject(scheduleDataShape).optional(),
|
|
131895
|
+
modelTierDeprecated: modelTierDeprecatedOutputSchema.optional()
|
|
132105
131896
|
})
|
|
132106
131897
|
}, async ({
|
|
132107
131898
|
key,
|
|
@@ -132125,6 +131916,7 @@ var import_cron_parser2, createScheduleInputSchema, scheduleDataShape, registerC
|
|
|
132125
131916
|
enabled,
|
|
132126
131917
|
model,
|
|
132127
131918
|
modelTier,
|
|
131919
|
+
profile,
|
|
132128
131920
|
allowCustomModel
|
|
132129
131921
|
}, requestInfo, _meta) => {
|
|
132130
131922
|
if (!requestInfo.agentId) {
|
|
@@ -132164,6 +131956,7 @@ var import_cron_parser2, createScheduleInputSchema, scheduleDataShape, registerC
|
|
|
132164
131956
|
if (existing) {
|
|
132165
131957
|
return toolErr(`Schedule with name "${name}" already exists.`);
|
|
132166
131958
|
}
|
|
131959
|
+
let targetHarness = null;
|
|
132167
131960
|
if (targetAgentId) {
|
|
132168
131961
|
const agent = await getAgentById2(targetAgentId);
|
|
132169
131962
|
if (!agent) {
|
|
@@ -132172,6 +131965,7 @@ var import_cron_parser2, createScheduleInputSchema, scheduleDataShape, registerC
|
|
|
132172
131965
|
if (isExtensionAgent2(agent)) {
|
|
132173
131966
|
return toolErr(extensionAgentAssignmentError2(agent));
|
|
132174
131967
|
}
|
|
131968
|
+
targetHarness = agent.harnessProvider;
|
|
132175
131969
|
}
|
|
132176
131970
|
const resolvedTargetType = targetType ?? "agent-task";
|
|
132177
131971
|
if (resolvedTargetType === "agent-task" && !taskTemplate) {
|
|
@@ -132201,6 +131995,14 @@ var import_cron_parser2, createScheduleInputSchema, scheduleDataShape, registerC
|
|
|
132201
131995
|
});
|
|
132202
131996
|
if (modelError)
|
|
132203
131997
|
return toolErr(modelError);
|
|
131998
|
+
const profileError = await taskProfileError({
|
|
131999
|
+
profile,
|
|
132000
|
+
model,
|
|
132001
|
+
modelTier,
|
|
132002
|
+
agentId: targetAgentId
|
|
132003
|
+
});
|
|
132004
|
+
if (profileError)
|
|
132005
|
+
return toolErr(profileError);
|
|
132204
132006
|
try {
|
|
132205
132007
|
let nextRunAt;
|
|
132206
132008
|
if (enabled === false) {
|
|
@@ -132238,14 +132040,25 @@ var import_cron_parser2, createScheduleInputSchema, scheduleDataShape, registerC
|
|
|
132238
132040
|
createdByAgentId: requestInfo.agentId,
|
|
132239
132041
|
model: normalizedModel.model,
|
|
132240
132042
|
modelTier: normalizedModel.modelTier,
|
|
132043
|
+
profile,
|
|
132241
132044
|
scheduleType: scheduleType ?? "recurring",
|
|
132242
132045
|
createdBy
|
|
132243
132046
|
});
|
|
132244
132047
|
const scheduleDesc = isOneTime ? `one-time at ${schedule.nextRunAt}` : cronExpression || `every ${intervalMs}ms`;
|
|
132048
|
+
const modelTierDeprecated = modelTierDeprecation(modelTier, targetHarness);
|
|
132245
132049
|
return toolOk(`Created schedule "${name}" (${scheduleDesc}). Next run: ${schedule.nextRunAt || "disabled"}`, {
|
|
132246
|
-
data: {
|
|
132050
|
+
data: {
|
|
132051
|
+
yourAgentId: requestInfo.agentId,
|
|
132052
|
+
schedule,
|
|
132053
|
+
...modelTierDeprecated ? { modelTierDeprecated } : {}
|
|
132054
|
+
}
|
|
132247
132055
|
});
|
|
132248
132056
|
} catch (error) {
|
|
132057
|
+
if (modelProfileRefError(error) === "missing") {
|
|
132058
|
+
return toolErr(`Unknown model profile "${profile}".`, {
|
|
132059
|
+
data: { yourAgentId: requestInfo.agentId }
|
|
132060
|
+
});
|
|
132061
|
+
}
|
|
132249
132062
|
const message = error instanceof Error ? error.message : "Unknown error";
|
|
132250
132063
|
return toolErr(`Failed to create schedule: ${message}`, {
|
|
132251
132064
|
data: { yourAgentId: requestInfo.agentId }
|
|
@@ -132258,7 +132071,8 @@ var init_create_schedule = __esm(() => {
|
|
|
132258
132071
|
init_asset_key_auth();
|
|
132259
132072
|
init_audit_user();
|
|
132260
132073
|
init_db4();
|
|
132261
|
-
|
|
132074
|
+
init_model_profiles();
|
|
132075
|
+
init_model_validation2();
|
|
132262
132076
|
init_db3();
|
|
132263
132077
|
init_scheduler2();
|
|
132264
132078
|
init_utils();
|
|
@@ -132284,8 +132098,9 @@ var init_create_schedule = __esm(() => {
|
|
|
132284
132098
|
targetAgentId: string2().optional().describe("Agent to assign tasks to (omit for task pool)"),
|
|
132285
132099
|
timezone: string2().default("UTC").optional().describe("Timezone for cron schedules"),
|
|
132286
132100
|
enabled: boolean().default(true).optional().describe("Whether the schedule is enabled (default: true)"),
|
|
132287
|
-
model: string2().trim().min(1).optional().describe("Concrete model override for tasks created by this schedule. Interpreted by each assignee's harness/provider and does not switch providers. Prefer
|
|
132288
|
-
modelTier: ModelTierSchema.optional().describe("Portable model tier for tasks created by this schedule: 'smol', 'regular', 'smart', or 'ultra'. Resolved
|
|
132101
|
+
model: string2().trim().min(1).optional().describe("Concrete model override for tasks created by this schedule. Interpreted by each assignee's harness/provider and does not switch providers. Prefer `profile` for a named harness + model + effort. The model must run on the assignee's harness (an Anthropic model on a Claude agent, an OpenAI model on a Codex agent); a mismatch is rejected."),
|
|
132102
|
+
modelTier: ModelTierSchema.optional().describe(`Deprecated: pass profile "<harness>-<tier>" instead (same model). Portable model tier for tasks created by this schedule: 'smol', 'regular', 'smart', or 'ultra'. Resolved at claim time through the seeded <harness>-<tier> profile of each assignee's harness.`),
|
|
132103
|
+
profile: string2().trim().min(1).optional().describe("Model profile name for tasks created by this schedule (see list-model-profiles): a named harness + model + effort, applied when each task is claimed. Must run on the target agent. Exclusive with model and modelTier."),
|
|
132289
132104
|
allowCustomModel: boolean().optional().describe("Accept a `model` the model catalog does not list. Without it an unknown model id is rejected. Only for ids the catalog cannot know yet.")
|
|
132290
132105
|
});
|
|
132291
132106
|
scheduleDataShape = {
|
|
@@ -132308,6 +132123,7 @@ var init_create_schedule = __esm(() => {
|
|
|
132308
132123
|
timezone: string2().optional(),
|
|
132309
132124
|
model: string2().optional(),
|
|
132310
132125
|
modelTier: ModelTierSchema.optional(),
|
|
132126
|
+
profile: string2().optional(),
|
|
132311
132127
|
scheduleType: string2().optional(),
|
|
132312
132128
|
targetType: ScheduledTaskTargetTypeSchema.optional(),
|
|
132313
132129
|
workflowId: string2().optional(),
|
|
@@ -132933,7 +132749,8 @@ var import_cron_parser3, patchScheduleInputSchema, scheduleDataShape2, registerP
|
|
|
132933
132749
|
inputSchema: patchScheduleInputSchema,
|
|
132934
132750
|
outputSchema: swarmToolOutputSchema({
|
|
132935
132751
|
yourAgentId: string2().optional(),
|
|
132936
|
-
schedule: looseObject(scheduleDataShape2).optional()
|
|
132752
|
+
schedule: looseObject(scheduleDataShape2).optional(),
|
|
132753
|
+
modelTierDeprecated: modelTierDeprecatedOutputSchema.optional()
|
|
132937
132754
|
})
|
|
132938
132755
|
}, async ({
|
|
132939
132756
|
key,
|
|
@@ -132956,6 +132773,7 @@ var import_cron_parser3, patchScheduleInputSchema, scheduleDataShape2, registerP
|
|
|
132956
132773
|
enabled,
|
|
132957
132774
|
model,
|
|
132958
132775
|
modelTier,
|
|
132776
|
+
profile,
|
|
132959
132777
|
allowCustomModel
|
|
132960
132778
|
}, requestInfo, _meta) => {
|
|
132961
132779
|
if (!requestInfo.agentId) {
|
|
@@ -133061,6 +132879,14 @@ var import_cron_parser3, patchScheduleInputSchema, scheduleDataShape2, registerP
|
|
|
133061
132879
|
if (enabled !== undefined)
|
|
133062
132880
|
updateData.enabled = enabled;
|
|
133063
132881
|
const agentChanged = targetAgentId !== undefined && targetAgentId !== schedule.targetAgentId;
|
|
132882
|
+
const profileUpdate = await scheduleProfileUpdate(schedule, {
|
|
132883
|
+
profile,
|
|
132884
|
+
model,
|
|
132885
|
+
modelTier,
|
|
132886
|
+
targetAgentId
|
|
132887
|
+
});
|
|
132888
|
+
if (profileUpdate.error !== undefined)
|
|
132889
|
+
return toolErr(profileUpdate.error);
|
|
133064
132890
|
if (model !== undefined || modelTier !== undefined) {
|
|
133065
132891
|
const normalizedModel = splitLegacyModelAlias({ model, modelTier });
|
|
133066
132892
|
if (normalizedModel.model !== schedule.model || agentChanged) {
|
|
@@ -133077,7 +132903,7 @@ var import_cron_parser3, patchScheduleInputSchema, scheduleDataShape2, registerP
|
|
|
133077
132903
|
if (modelTier !== undefined || normalizedModel.modelTier) {
|
|
133078
132904
|
updateData.modelTier = normalizedModel.modelTier ?? null;
|
|
133079
132905
|
}
|
|
133080
|
-
} else if (agentChanged && schedule.model) {
|
|
132906
|
+
} else if (agentChanged && schedule.model && !profileUpdate.fields.profile) {
|
|
133081
132907
|
const modelError = await explicitModelErrorForAgent({
|
|
133082
132908
|
model: schedule.model,
|
|
133083
132909
|
allowCustomModel: true,
|
|
@@ -133086,6 +132912,7 @@ var import_cron_parser3, patchScheduleInputSchema, scheduleDataShape2, registerP
|
|
|
133086
132912
|
if (modelError)
|
|
133087
132913
|
return toolErr(modelError);
|
|
133088
132914
|
}
|
|
132915
|
+
Object.assign(updateData, profileUpdate.fields);
|
|
133089
132916
|
if (schedule.scheduleType === "one_time") {
|
|
133090
132917
|
if (enabled === false) {
|
|
133091
132918
|
updateData.nextRunAt = null;
|
|
@@ -133118,10 +132945,20 @@ var import_cron_parser3, patchScheduleInputSchema, scheduleDataShape2, registerP
|
|
|
133118
132945
|
if (!updated) {
|
|
133119
132946
|
return toolErr("Failed to update schedule.");
|
|
133120
132947
|
}
|
|
132948
|
+
const modelTierDeprecated = modelTierDeprecation(modelTier, updated.targetAgentId ? (await getAgentById2(updated.targetAgentId))?.harnessProvider : null);
|
|
133121
132949
|
return toolOk(`Patched schedule "${updated.name}". Next run: ${updated.nextRunAt || "disabled"}`, {
|
|
133122
|
-
data: {
|
|
132950
|
+
data: {
|
|
132951
|
+
yourAgentId: requestInfo.agentId,
|
|
132952
|
+
schedule: updated,
|
|
132953
|
+
...modelTierDeprecated ? { modelTierDeprecated } : {}
|
|
132954
|
+
}
|
|
133123
132955
|
});
|
|
133124
132956
|
} catch (error) {
|
|
132957
|
+
if (modelProfileRefError(error) === "missing") {
|
|
132958
|
+
return toolErr(`Unknown model profile "${profile}".`, {
|
|
132959
|
+
data: { yourAgentId: requestInfo.agentId }
|
|
132960
|
+
});
|
|
132961
|
+
}
|
|
133125
132962
|
const message = error instanceof Error ? error.message : "Unknown error";
|
|
133126
132963
|
return toolErr(`Failed to update schedule: ${message}`, {
|
|
133127
132964
|
data: { yourAgentId: requestInfo.agentId }
|
|
@@ -133134,7 +132971,8 @@ var init_patch_schedule = __esm(() => {
|
|
|
133134
132971
|
init_asset_key_auth();
|
|
133135
132972
|
init_audit_user();
|
|
133136
132973
|
init_db4();
|
|
133137
|
-
|
|
132974
|
+
init_model_profiles();
|
|
132975
|
+
init_model_validation2();
|
|
133138
132976
|
init_validate();
|
|
133139
132977
|
init_db3();
|
|
133140
132978
|
init_rbac();
|
|
@@ -133162,7 +133000,8 @@ var init_patch_schedule = __esm(() => {
|
|
|
133162
133000
|
timezone: string2().optional().describe("New timezone"),
|
|
133163
133001
|
enabled: boolean().optional().describe("Enable or disable the schedule"),
|
|
133164
133002
|
model: string2().trim().min(1).nullable().optional().describe("Concrete model override for tasks created by this schedule. Set to null to clear. The model must run on the assignee's harness (an Anthropic model on a Claude agent, an OpenAI model on a Codex agent); a mismatch is rejected."),
|
|
133165
|
-
modelTier: ModelTierSchema.nullable().optional().describe("Portable model tier for tasks created by this schedule. Set to null to clear.
|
|
133003
|
+
modelTier: ModelTierSchema.nullable().optional().describe('Deprecated: pass profile "<harness>-<tier>" instead (same model). Portable model tier for tasks created by this schedule, resolved at claim time through the seeded <harness>-<tier> profile. Set to null to clear.'),
|
|
133004
|
+
profile: string2().trim().min(1).nullable().optional().describe("Model profile name for tasks created by this schedule (see list-model-profiles). Must run on the target agent. Exclusive with model and modelTier: setting a profile clears them, and setting either clears the profile. Set to null to clear."),
|
|
133166
133005
|
allowCustomModel: boolean().optional().describe("Accept a `model` the model catalog does not list. Without it an unknown model id is rejected. Only for ids the catalog cannot know yet.")
|
|
133167
133006
|
});
|
|
133168
133007
|
scheduleDataShape2 = {
|
|
@@ -133185,6 +133024,7 @@ var init_patch_schedule = __esm(() => {
|
|
|
133185
133024
|
timezone: string2().optional(),
|
|
133186
133025
|
model: string2().optional(),
|
|
133187
133026
|
modelTier: ModelTierSchema.optional(),
|
|
133027
|
+
profile: string2().optional(),
|
|
133188
133028
|
scheduleType: string2().optional(),
|
|
133189
133029
|
targetType: ScheduledTaskTargetTypeSchema.optional(),
|
|
133190
133030
|
workflowId: string2().optional(),
|
|
@@ -133267,7 +133107,8 @@ var import_cron_parser4, updateScheduleInputSchema, scheduleDataShape3, register
|
|
|
133267
133107
|
inputSchema: updateScheduleInputSchema,
|
|
133268
133108
|
outputSchema: swarmToolOutputSchema({
|
|
133269
133109
|
yourAgentId: string2().optional(),
|
|
133270
|
-
schedule: looseObject(scheduleDataShape3).optional()
|
|
133110
|
+
schedule: looseObject(scheduleDataShape3).optional(),
|
|
133111
|
+
modelTierDeprecated: modelTierDeprecatedOutputSchema.optional()
|
|
133271
133112
|
})
|
|
133272
133113
|
}, async ({
|
|
133273
133114
|
key,
|
|
@@ -133290,6 +133131,7 @@ var import_cron_parser4, updateScheduleInputSchema, scheduleDataShape3, register
|
|
|
133290
133131
|
enabled,
|
|
133291
133132
|
model,
|
|
133292
133133
|
modelTier,
|
|
133134
|
+
profile,
|
|
133293
133135
|
allowCustomModel
|
|
133294
133136
|
}, requestInfo, _meta) => {
|
|
133295
133137
|
if (!requestInfo.agentId) {
|
|
@@ -133395,6 +133237,14 @@ var import_cron_parser4, updateScheduleInputSchema, scheduleDataShape3, register
|
|
|
133395
133237
|
if (enabled !== undefined)
|
|
133396
133238
|
updateData.enabled = enabled;
|
|
133397
133239
|
const agentChanged = targetAgentId !== undefined && targetAgentId !== schedule.targetAgentId;
|
|
133240
|
+
const profileUpdate = await scheduleProfileUpdate(schedule, {
|
|
133241
|
+
profile,
|
|
133242
|
+
model,
|
|
133243
|
+
modelTier,
|
|
133244
|
+
targetAgentId
|
|
133245
|
+
});
|
|
133246
|
+
if (profileUpdate.error !== undefined)
|
|
133247
|
+
return toolErr(profileUpdate.error);
|
|
133398
133248
|
if (model !== undefined || modelTier !== undefined) {
|
|
133399
133249
|
const normalizedModel = splitLegacyModelAlias({ model, modelTier });
|
|
133400
133250
|
if (normalizedModel.model !== schedule.model || agentChanged) {
|
|
@@ -133411,7 +133261,7 @@ var import_cron_parser4, updateScheduleInputSchema, scheduleDataShape3, register
|
|
|
133411
133261
|
if (modelTier !== undefined || normalizedModel.modelTier) {
|
|
133412
133262
|
updateData.modelTier = normalizedModel.modelTier ?? null;
|
|
133413
133263
|
}
|
|
133414
|
-
} else if (agentChanged && schedule.model) {
|
|
133264
|
+
} else if (agentChanged && schedule.model && !profileUpdate.fields.profile) {
|
|
133415
133265
|
const modelError = await explicitModelErrorForAgent({
|
|
133416
133266
|
model: schedule.model,
|
|
133417
133267
|
allowCustomModel: true,
|
|
@@ -133420,6 +133270,7 @@ var import_cron_parser4, updateScheduleInputSchema, scheduleDataShape3, register
|
|
|
133420
133270
|
if (modelError)
|
|
133421
133271
|
return toolErr(modelError);
|
|
133422
133272
|
}
|
|
133273
|
+
Object.assign(updateData, profileUpdate.fields);
|
|
133423
133274
|
if (schedule.scheduleType === "one_time") {
|
|
133424
133275
|
if (enabled === false) {
|
|
133425
133276
|
updateData.nextRunAt = null;
|
|
@@ -133452,10 +133303,20 @@ var import_cron_parser4, updateScheduleInputSchema, scheduleDataShape3, register
|
|
|
133452
133303
|
if (!updated) {
|
|
133453
133304
|
return toolErr("Failed to update schedule.");
|
|
133454
133305
|
}
|
|
133306
|
+
const modelTierDeprecated = modelTierDeprecation(modelTier, updated.targetAgentId ? (await getAgentById2(updated.targetAgentId))?.harnessProvider : null);
|
|
133455
133307
|
return toolOk(`Updated schedule "${updated.name}". Next run: ${updated.nextRunAt || "disabled"}`, {
|
|
133456
|
-
data: {
|
|
133308
|
+
data: {
|
|
133309
|
+
yourAgentId: requestInfo.agentId,
|
|
133310
|
+
schedule: updated,
|
|
133311
|
+
...modelTierDeprecated ? { modelTierDeprecated } : {}
|
|
133312
|
+
}
|
|
133457
133313
|
});
|
|
133458
133314
|
} catch (error) {
|
|
133315
|
+
if (modelProfileRefError(error) === "missing") {
|
|
133316
|
+
return toolErr(`Unknown model profile "${profile}".`, {
|
|
133317
|
+
data: { yourAgentId: requestInfo.agentId }
|
|
133318
|
+
});
|
|
133319
|
+
}
|
|
133459
133320
|
const message = error instanceof Error ? error.message : "Unknown error";
|
|
133460
133321
|
return toolErr(`Failed to update schedule: ${message}`, {
|
|
133461
133322
|
data: { yourAgentId: requestInfo.agentId }
|
|
@@ -133468,7 +133329,8 @@ var init_update_schedule = __esm(() => {
|
|
|
133468
133329
|
init_asset_key_auth();
|
|
133469
133330
|
init_audit_user();
|
|
133470
133331
|
init_db4();
|
|
133471
|
-
|
|
133332
|
+
init_model_profiles();
|
|
133333
|
+
init_model_validation2();
|
|
133472
133334
|
init_validate();
|
|
133473
133335
|
init_db3();
|
|
133474
133336
|
init_rbac();
|
|
@@ -133496,7 +133358,8 @@ var init_update_schedule = __esm(() => {
|
|
|
133496
133358
|
timezone: string2().optional().describe("New timezone"),
|
|
133497
133359
|
enabled: boolean().optional().describe("Enable or disable the schedule"),
|
|
133498
133360
|
model: string2().trim().min(1).nullable().optional().describe("Concrete model override for tasks created by this schedule. Set to null to clear. The model must run on the assignee's harness (an Anthropic model on a Claude agent, an OpenAI model on a Codex agent); a mismatch is rejected."),
|
|
133499
|
-
modelTier: ModelTierSchema.nullable().optional().describe("Portable model tier for tasks created by this schedule. Set to null to clear.
|
|
133361
|
+
modelTier: ModelTierSchema.nullable().optional().describe('Deprecated: pass profile "<harness>-<tier>" instead (same model). Portable model tier for tasks created by this schedule, resolved at claim time through the seeded <harness>-<tier> profile. Set to null to clear.'),
|
|
133362
|
+
profile: string2().trim().min(1).nullable().optional().describe("Model profile name for tasks created by this schedule (see list-model-profiles). Must run on the target agent. Exclusive with model and modelTier: setting a profile clears them, and setting either clears the profile. Set to null to clear."),
|
|
133500
133363
|
allowCustomModel: boolean().optional().describe("Accept a `model` the model catalog does not list. Without it an unknown model id is rejected. Only for ids the catalog cannot know yet.")
|
|
133501
133364
|
});
|
|
133502
133365
|
scheduleDataShape3 = {
|
|
@@ -133519,6 +133382,7 @@ var init_update_schedule = __esm(() => {
|
|
|
133519
133382
|
timezone: string2().optional(),
|
|
133520
133383
|
model: string2().optional(),
|
|
133521
133384
|
modelTier: ModelTierSchema.optional(),
|
|
133385
|
+
profile: string2().optional(),
|
|
133522
133386
|
scheduleType: string2().optional(),
|
|
133523
133387
|
targetType: ScheduledTaskTargetTypeSchema.optional(),
|
|
133524
133388
|
workflowId: string2().optional(),
|
|
@@ -134646,7 +134510,8 @@ async function sendTaskHandler(ctx, {
|
|
|
134646
134510
|
profile,
|
|
134647
134511
|
model: normalizedModel.model,
|
|
134648
134512
|
modelTier: normalizedModel.modelTier,
|
|
134649
|
-
agentId: effectiveAgentId
|
|
134513
|
+
agentId: effectiveAgentId,
|
|
134514
|
+
vcsRepo: effectiveVcsRepo || effectiveParentTask?.vcsRepo
|
|
134650
134515
|
});
|
|
134651
134516
|
if (profileError)
|
|
134652
134517
|
return toolErr(profileError, { data: { yourAgentId: creatorAgentId } });
|
|
@@ -134828,9 +134693,12 @@ async function sendTaskHandler(ctx, {
|
|
|
134828
134693
|
throw error;
|
|
134829
134694
|
return { success: false, message: `Unknown model profile "${profile}".`, task: undefined };
|
|
134830
134695
|
});
|
|
134696
|
+
const assigneeId = result.task?.agentId ?? result.task?.offeredTo;
|
|
134697
|
+
const modelTierDeprecated = result.success && modelTier ? modelTierDeprecation(modelTier, assigneeId ? (await getAgentById2(assigneeId))?.harnessProvider : null) : undefined;
|
|
134831
134698
|
const data = {
|
|
134832
134699
|
yourAgentId: creatorAgentId,
|
|
134833
|
-
task: result.task
|
|
134700
|
+
task: result.task,
|
|
134701
|
+
...modelTierDeprecated ? { modelTierDeprecated } : {}
|
|
134834
134702
|
};
|
|
134835
134703
|
const details = result.task ? JSON.stringify(result.task, null, 2) : undefined;
|
|
134836
134704
|
return result.success ? toolOk(result.message, { data, details }) : toolErr(result.message, { data, details });
|
|
@@ -134851,7 +134719,7 @@ var init_send_task = __esm(() => {
|
|
|
134851
134719
|
init_db4();
|
|
134852
134720
|
init_model_profiles();
|
|
134853
134721
|
init_tracker();
|
|
134854
|
-
|
|
134722
|
+
init_model_validation2();
|
|
134855
134723
|
init_apply_task_create();
|
|
134856
134724
|
init_rbac();
|
|
134857
134725
|
init_follow_up_redelegation_guard();
|
|
@@ -134879,8 +134747,8 @@ var init_send_task = __esm(() => {
|
|
|
134879
134747
|
parentTaskId: uuid().optional().describe("Parent task ID for session continuity. Child task will resume the parent's Claude session. Auto-routes to the same worker unless agentId is explicitly provided."),
|
|
134880
134748
|
dir: string2().min(1).startsWith("/").optional().describe("Working directory (absolute path) for the agent to start in. If the directory doesn't exist, falls back to the default working directory."),
|
|
134881
134749
|
vcsRepo: string2().optional().describe("VCS repo identifier (e.g., 'desplega-ai/agent-swarm' for GitHub or 'group/project' for GitLab). Links the task to a registered repo for workspace context."),
|
|
134882
|
-
model: string2().trim().min(1).optional().describe("Concrete model override for this task, interpreted by the assignee's harness/provider. This does not switch providers. Prefer
|
|
134883
|
-
modelTier: ModelTierSchema.optional().describe("Portable model tier for this task: 'smol', 'regular', 'smart', or 'ultra'. Resolved at claim
|
|
134750
|
+
model: string2().trim().min(1).optional().describe("Concrete model override for this task, interpreted by the assignee's harness/provider. This does not switch providers. Prefer `profile` for a named harness + model + effort. The model must run on the assignee's harness (an Anthropic model on a Claude agent, an OpenAI model on a Codex agent); a mismatch is rejected."),
|
|
134751
|
+
modelTier: ModelTierSchema.optional().describe(`Deprecated: pass profile "<harness>-<tier>" instead (same model). Portable model tier for this task: 'smol', 'regular', 'smart', or 'ultra'. Resolved at claim time through the seeded <harness>-<tier> profile of the assignee's harness. Legacy model shortnames map as haiku→smol, sonnet→regular, opus→smart, fable→ultra.`),
|
|
134884
134752
|
allowCustomModel: boolean().optional().describe("Accept a `model` the model catalog does not list. Without it an unknown model id is rejected. Only for ids the catalog cannot know yet (a fresh launch, a private deployment)."),
|
|
134885
134753
|
effort: ReasoningEffortSchema.optional().describe("Reasoning effort for this task: 'off', 'low', 'medium', 'high', 'xhigh', or 'max'. If omitted, the assignee's REASONING_EFFORT_OVERRIDE/default applies."),
|
|
134886
134754
|
profile: string2().trim().min(1).optional().describe("Model profile name (see list-model-profiles): a named harness + model + effort, applied when the task is claimed. Must run on the assignee's harness. Exclusive with model and modelTier. A set `effort` still wins over the profile's."),
|
|
@@ -134921,7 +134789,8 @@ var init_send_task = __esm(() => {
|
|
|
134921
134789
|
});
|
|
134922
134790
|
sendTaskOutputSchema = swarmToolOutputSchema({
|
|
134923
134791
|
yourAgentId: string2().optional(),
|
|
134924
|
-
task: looseAgentTaskOutputSchema.optional()
|
|
134792
|
+
task: looseAgentTaskOutputSchema.optional(),
|
|
134793
|
+
modelTierDeprecated: modelTierDeprecatedOutputSchema.optional()
|
|
134925
134794
|
});
|
|
134926
134795
|
TRACKER_OWNERSHIP_TRANSFER_PARENT_STATUSES = new Set([
|
|
134927
134796
|
"superseded",
|
|
@@ -138031,6 +137900,9 @@ async function storeTaskLearning(params) {
|
|
|
138031
137900
|
if (tags.length > LEARNING_MAX_TAGS) {
|
|
138032
137901
|
return { status: "failed", error: `learning takes at most ${LEARNING_MAX_TAGS} tags` };
|
|
138033
137902
|
}
|
|
137903
|
+
const noise = checkNoiseFloor(text, params.sameCall);
|
|
137904
|
+
if (noise)
|
|
137905
|
+
return noise;
|
|
138034
137906
|
const workstream = resolveLearningWorkstream(input.workstream === undefined ? undefined : scrubSecrets(input.workstream), task.vcsRepo === undefined ? undefined : scrubSecrets(task.vcsRepo));
|
|
138035
137907
|
try {
|
|
138036
137908
|
const replay = await findReplay(task.id, contentSha256(text));
|
|
@@ -138049,6 +137921,29 @@ async function storeTaskLearning(params) {
|
|
|
138049
137921
|
};
|
|
138050
137922
|
}
|
|
138051
137923
|
}
|
|
137924
|
+
function normalizeForEcho(value) {
|
|
137925
|
+
return value.toLowerCase().replace(/\s+/g, " ").trim();
|
|
137926
|
+
}
|
|
137927
|
+
function checkNoiseFloor(text, sameCall) {
|
|
137928
|
+
if (text.length < LEARNING_MIN_CHARS) {
|
|
137929
|
+
return {
|
|
137930
|
+
status: "failed",
|
|
137931
|
+
noiseFloor: "too-short",
|
|
137932
|
+
error: `learning is under ${LEARNING_MIN_CHARS} characters; write a title line, then the rule as "When X, do Y"`
|
|
137933
|
+
};
|
|
137934
|
+
}
|
|
137935
|
+
const learning = normalizeForEcho(text);
|
|
137936
|
+
for (const [field, value] of Object.entries(sameCall ?? {})) {
|
|
137937
|
+
if (value && normalizeForEcho(scrubSecrets(value)).includes(learning)) {
|
|
137938
|
+
return {
|
|
137939
|
+
status: "failed",
|
|
137940
|
+
noiseFloor: "repeats-progress",
|
|
137941
|
+
error: `learning repeats this call's ${field}; store the rule the next agent should follow, not the result`
|
|
137942
|
+
};
|
|
137943
|
+
}
|
|
137944
|
+
}
|
|
137945
|
+
return null;
|
|
137946
|
+
}
|
|
138052
137947
|
async function findReplay(taskId, contentHash) {
|
|
138053
137948
|
const replay = await getDbClient2().get(`SELECT id, key FROM agent_memory
|
|
138054
137949
|
WHERE sourceTaskId = ? AND contentHash = ? AND key LIKE '${LEARNINGS_ROOT}/%'
|
|
@@ -138065,7 +137960,9 @@ async function findNearDuplicate(params) {
|
|
|
138065
137960
|
scope: "swarm",
|
|
138066
137961
|
isLead: params.isLead,
|
|
138067
137962
|
keyPrefix,
|
|
138068
|
-
limit: 1
|
|
137963
|
+
limit: 1,
|
|
137964
|
+
exhaustive: true,
|
|
137965
|
+
minSimilarity: LEARNING_DUPLICATE_MIN_SIMILARITY
|
|
138069
137966
|
})));
|
|
138070
137967
|
const best = results.flat().filter((candidate) => candidate.key).sort((a, b) => b.similarity - a.similarity)[0];
|
|
138071
137968
|
if (!best || best.similarity < LEARNING_DUPLICATE_MIN_SIMILARITY)
|
|
@@ -138130,16 +138027,17 @@ async function insertLearning(params) {
|
|
|
138130
138027
|
}
|
|
138131
138028
|
return { status: "failed", error: `no free key under ${baseKey}` };
|
|
138132
138029
|
}
|
|
138133
|
-
var LEARNING_MAX_CHARS = 2000, LEARNING_MAX_TAGS = 5,
|
|
138030
|
+
var LEARNING_MAX_CHARS = 2000, LEARNING_MAX_TAGS = 5, LEARNING_MIN_CHARS = 80, SEGMENT_MAX_CHARS = 60, KEY_ATTEMPTS = 4, DUPLICATE_SEARCH_PREFIXES, LEARNING_DUPLICATE_RATING_SOURCE = "learning-duplicate";
|
|
138134
138031
|
var init_task_learning = __esm(() => {
|
|
138135
138032
|
init_db4();
|
|
138136
138033
|
init_memory();
|
|
138137
138034
|
init_constants2();
|
|
138138
138035
|
init_index_content();
|
|
138036
|
+
init_key_paths();
|
|
138139
138037
|
init_store();
|
|
138140
138038
|
init_profile_sync();
|
|
138141
138039
|
init_secret_scrubber();
|
|
138142
|
-
DUPLICATE_SEARCH_PREFIXES = [`${LEARNINGS_ROOT}/`,
|
|
138040
|
+
DUPLICATE_SEARCH_PREFIXES = [`${LEARNINGS_ROOT}/`, `${LONGTERM_ROOT}/`];
|
|
138143
138041
|
});
|
|
138144
138042
|
|
|
138145
138043
|
// src/tasks/task-skip.ts
|
|
@@ -138184,7 +138082,7 @@ function learningSentence(result) {
|
|
|
138184
138082
|
var BLOCKED_WAITING_PATTERN, BLOCKED_WAITING_MIN_ELAPSED_MS, storeProgressOutputSchema, registerStoreProgressTool = (server) => {
|
|
138185
138083
|
createToolRegistrar(server)("store-progress", {
|
|
138186
138084
|
title: "Store task progress",
|
|
138187
|
-
description: "Stores the progress of a specific task. Can also mark task as completed, failed, or skipped, which will set the agent back to idle. Use skipped only when the work is not yours to handle, such as a Slack thread message addressed to someone else; never skip an explicit @mention of you or work assigned to you.",
|
|
138085
|
+
description: "Stores the progress of a specific task. Can also mark task as completed, failed, or skipped, which will set the agent back to idle. Use skipped only when the work is not yours to handle, such as a Slack thread message addressed to someone else; never skip an explicit @mention of you or work assigned to you. When a live child task you created continues the work, complete with chainedTaskId so the lead is not woken for this step.",
|
|
138188
138086
|
annotations: { idempotentHint: true },
|
|
138189
138087
|
inputSchema: object2({
|
|
138190
138088
|
taskId: uuid().optional().describe("Full task UUID. Defaults to the caller-owned task in X-Source-Task-Id; required outside task context."),
|
|
@@ -138201,8 +138099,9 @@ var BLOCKED_WAITING_PATTERN, BLOCKED_WAITING_MIN_ELAPSED_MS, storeProgressOutput
|
|
|
138201
138099
|
workstream: string2().optional(),
|
|
138202
138100
|
tags: array2(string2()).optional()
|
|
138203
138101
|
})
|
|
138204
|
-
]).optional().describe(`A lesson to keep. Add one only when it would change how the next agent works: a gotcha, a dead end, a pattern that worked. Not a progress
|
|
138102
|
+
]).optional().describe(`A lesson to keep. Add one only when it would change how the next agent works: a gotcha, a dead end, a pattern that worked. Line 1 of text is the title. Line 2 is the rule, as "When X, do Y"; evidence goes after it, since recall shows only the first 300 characters. Not a learning: a status or pass/fail line, a restatement of this call's progress or output, text already in a skill, a claim you did not verify. Text under ${LEARNING_MIN_CHARS} characters, or contained in this call's progress or output, is rejected. Stored as a swarm memory at /learnings/<workstream>/<slug>, tagged "learning" and tied to this task. Expires after ${LEARNING_TTL_DAYS} days. At most ~500 tokens and ${LEARNING_MAX_TAGS} kebab tags. workstream defaults to the task's repo name, else "general". Send it on or before the completing call: a call on a finished task stores nothing. A failed learning write is reported in the result and never blocks the progress update.`),
|
|
138205
138103
|
persistMemory: boolean().optional().describe("Opt in to task_completion memory persistence for automatic/recurring tasks. Manual tasks are persisted by default; scheduled, system, heartbeat/boot-triage, monitor, and digest tasks are skipped unless this is true."),
|
|
138104
|
+
chainedTaskId: uuid().optional().describe("With status 'completed' only: the id of a live child task you created (send-task with parentTaskId set to this task) that carries this result forward. The engine then creates no lead follow-up for this completion and logs the handoff on this task. The child must exist, have this task as parentTaskId, be created by you, and be pending, offered, reviewing, in_progress or paused. If any check fails, the normal follow-up is created and names the reason; the completion itself never fails. Ignored for every other status: a failure always wakes the lead."),
|
|
138206
138105
|
force: boolean().optional().describe("On an already-terminal task, overwrite explicitly provided output and/or failureReason text while preserving status and finishedAt and without replaying events, memory writes, follow-up creation, business-use ensure, or capacity updates. Differing terminal text is otherwise discarded and reported as a failure.")
|
|
138207
138106
|
}),
|
|
138208
138107
|
outputSchema: storeProgressOutputSchema
|
|
@@ -138216,6 +138115,7 @@ var BLOCKED_WAITING_PATTERN, BLOCKED_WAITING_MIN_ELAPSED_MS, storeProgressOutput
|
|
|
138216
138115
|
citations,
|
|
138217
138116
|
learning,
|
|
138218
138117
|
persistMemory,
|
|
138118
|
+
chainedTaskId,
|
|
138219
138119
|
force
|
|
138220
138120
|
}, requestInfo, _meta) => {
|
|
138221
138121
|
if (!requestInfo.agentId) {
|
|
@@ -138392,7 +138292,8 @@ var BLOCKED_WAITING_PATTERN, BLOCKED_WAITING_MIN_ELAPSED_MS, storeProgressOutput
|
|
|
138392
138292
|
agentId: agent.id,
|
|
138393
138293
|
isLead: agent.isLead === true,
|
|
138394
138294
|
task: existingTask,
|
|
138395
|
-
learning
|
|
138295
|
+
learning,
|
|
138296
|
+
sameCall: { progress, output }
|
|
138396
138297
|
}).then(resolve, (err) => resolve({ status: "failed", error: scrubSecrets(String(err)) })));
|
|
138397
138298
|
});
|
|
138398
138299
|
}
|
|
@@ -138522,7 +138423,8 @@ This check refuses once per task; the next completion is accepted and unfixed ci
|
|
|
138522
138423
|
output,
|
|
138523
138424
|
failureReason,
|
|
138524
138425
|
agentId: requestInfo.agentId,
|
|
138525
|
-
persistMemory
|
|
138426
|
+
persistMemory,
|
|
138427
|
+
...status === "completed" && chainedTaskId ? { chainedTaskId } : {}
|
|
138526
138428
|
});
|
|
138527
138429
|
}
|
|
138528
138430
|
const skipWasFresh = status === "skipped" && result.success && result.task?.status === "skipped" && !(("wasNoOp" in result) && result.wasNoOp) && !(("wasForcedOverwrite" in result) && result.wasForcedOverwrite);
|
|
@@ -138552,6 +138454,7 @@ This check refuses once per task; the next completion is accepted and unfixed ci
|
|
|
138552
138454
|
var init_store_progress = __esm(() => {
|
|
138553
138455
|
init_zod();
|
|
138554
138456
|
init_db4();
|
|
138457
|
+
init_constants2();
|
|
138555
138458
|
init_task_learning();
|
|
138556
138459
|
init_task_citations2();
|
|
138557
138460
|
init_agent_fs_provider();
|
|
@@ -138582,8 +138485,9 @@ var init_store_progress = __esm(() => {
|
|
|
138582
138485
|
memoryId: string2().optional(),
|
|
138583
138486
|
workstream: string2().optional(),
|
|
138584
138487
|
similarity: number2().optional(),
|
|
138585
|
-
error: string2().optional()
|
|
138586
|
-
|
|
138488
|
+
error: string2().optional(),
|
|
138489
|
+
noiseFloor: string2().optional()
|
|
138490
|
+
}).optional().describe("Present when the call carried a learning: stored, replayed (same text already stored for this task), duplicate (an existing swarm memory at key/memoryId says the same; similarity is the raw cosine), or failed with error. A failed learning rejected as noise also carries noiseFloor: too-short or repeats-progress.")
|
|
138587
138491
|
});
|
|
138588
138492
|
});
|
|
138589
138493
|
|
|
@@ -139729,10 +139633,12 @@ async function taskActionHandler(ctx, input) {
|
|
|
139729
139633
|
switch (action) {
|
|
139730
139634
|
case "create": {
|
|
139731
139635
|
const newTask = await createTaskExtended2(preparedCreate.description, preparedCreate.options);
|
|
139636
|
+
const modelTierDeprecated = modelTierDeprecation(input.modelTier, null);
|
|
139732
139637
|
return {
|
|
139733
139638
|
success: true,
|
|
139734
139639
|
message: `Created unassigned task "${newTask.id}".`,
|
|
139735
|
-
task: newTask
|
|
139640
|
+
task: newTask,
|
|
139641
|
+
...modelTierDeprecated ? { modelTierDeprecated } : {}
|
|
139736
139642
|
};
|
|
139737
139643
|
}
|
|
139738
139644
|
case "claim": {
|
|
@@ -140022,7 +139928,7 @@ var init_task_action = __esm(() => {
|
|
|
140022
139928
|
init_budget_refusal_notify();
|
|
140023
139929
|
init_db4();
|
|
140024
139930
|
init_model_profiles();
|
|
140025
|
-
|
|
139931
|
+
init_model_validation2();
|
|
140026
139932
|
init_multi_runtime();
|
|
140027
139933
|
init_apply_task_create();
|
|
140028
139934
|
init_task_tool_ctx();
|
|
@@ -140051,7 +139957,7 @@ var init_task_action = __esm(() => {
|
|
|
140051
139957
|
reason: string2().optional().describe("Reason for rejection (optional for 'reject')."),
|
|
140052
139958
|
dir: string2().min(1).startsWith("/").optional().describe("Working directory (absolute path) for the agent to start in. Only used with 'create' action."),
|
|
140053
139959
|
model: string2().trim().min(1).optional().describe("Concrete model override for the created task, interpreted by the claiming worker's harness/provider. This does not switch providers. Only used with 'create' action. The model must run on the assignee's harness (an Anthropic model on a Claude agent, an OpenAI model on a Codex agent); a mismatch is rejected."),
|
|
140054
|
-
modelTier: ModelTierSchema.optional().describe("Portable model tier for the created task: 'smol', 'regular', 'smart', or 'ultra'. Resolved when a worker claims
|
|
139960
|
+
modelTier: ModelTierSchema.optional().describe(`Deprecated: pass profile "<harness>-<tier>" instead (same model). Portable model tier for the created task: 'smol', 'regular', 'smart', or 'ultra'. Resolved when a worker claims the task, through the seeded <harness>-<tier> profile of its harness. Only used with 'create' action.`),
|
|
140055
139961
|
allowCustomModel: boolean().optional().describe("Accept a `model` the model catalog does not list. Without it an unknown model id is rejected. Only used with 'create' action."),
|
|
140056
139962
|
effort: ReasoningEffortSchema.optional().describe("Reasoning effort for the created task: 'off', 'low', 'medium', 'high', 'xhigh', or 'max'. Only used with 'create' action."),
|
|
140057
139963
|
profile: string2().trim().min(1).optional().describe("Model profile name for the created pool task (see list-model-profiles); only workers on its harness claim it. Exclusive with model and modelTier. Only used with 'create' action."),
|
|
@@ -140068,7 +139974,8 @@ var init_task_action = __esm(() => {
|
|
|
140068
139974
|
globalBudget: number2().optional(),
|
|
140069
139975
|
userSpend: number2().optional(),
|
|
140070
139976
|
userBudget: number2().optional(),
|
|
140071
|
-
resetAt: string2().optional()
|
|
139977
|
+
resetAt: string2().optional(),
|
|
139978
|
+
modelTierDeprecated: modelTierDeprecatedOutputSchema.optional()
|
|
140072
139979
|
});
|
|
140073
139980
|
});
|
|
140074
139981
|
|
|
@@ -140630,7 +140537,10 @@ function asConfig(value) {
|
|
|
140630
140537
|
function isStatic(value) {
|
|
140631
140538
|
return typeof value === "string" && value.trim() !== "" && !value.includes("{{");
|
|
140632
140539
|
}
|
|
140633
|
-
|
|
140540
|
+
function asString(value) {
|
|
140541
|
+
return typeof value === "string" ? value : undefined;
|
|
140542
|
+
}
|
|
140543
|
+
async function workflowModelErrors(def, { vcsRepo } = {}) {
|
|
140634
140544
|
const errors = [];
|
|
140635
140545
|
for (const node of def.nodes) {
|
|
140636
140546
|
const targets = [];
|
|
@@ -140642,6 +140552,17 @@ async function workflowModelErrors(def) {
|
|
|
140642
140552
|
targets.push({ config: body, path: "config.body.config" });
|
|
140643
140553
|
}
|
|
140644
140554
|
for (const { config, path } of targets) {
|
|
140555
|
+
if (isStatic(config.profile)) {
|
|
140556
|
+
const error = await taskProfileError({
|
|
140557
|
+
profile: config.profile,
|
|
140558
|
+
model: asString(config.model),
|
|
140559
|
+
modelTier: asString(config.modelTier),
|
|
140560
|
+
agentId: isStatic(config.agentId) ? config.agentId : undefined,
|
|
140561
|
+
vcsRepo: config.vcsRepo === undefined ? vcsRepo : asString(config.vcsRepo)
|
|
140562
|
+
});
|
|
140563
|
+
if (error)
|
|
140564
|
+
errors.push(`Node "${node.id}" ${path}.profile: ${error}`);
|
|
140565
|
+
}
|
|
140645
140566
|
if (!isStatic(config.model) || !isStatic(config.agentId))
|
|
140646
140567
|
continue;
|
|
140647
140568
|
const modelTier = typeof config.modelTier === "string" ? config.modelTier : undefined;
|
|
@@ -140656,8 +140577,9 @@ async function workflowModelErrors(def) {
|
|
|
140656
140577
|
}
|
|
140657
140578
|
return errors;
|
|
140658
140579
|
}
|
|
140659
|
-
var
|
|
140660
|
-
|
|
140580
|
+
var init_model_validation = __esm(() => {
|
|
140581
|
+
init_model_profiles();
|
|
140582
|
+
init_model_validation2();
|
|
140661
140583
|
init_types4();
|
|
140662
140584
|
});
|
|
140663
140585
|
|
|
@@ -140712,7 +140634,7 @@ var registerCreateWorkflowTool = (server) => {
|
|
|
140712
140634
|
if (!validation.valid) {
|
|
140713
140635
|
return toolErr(`Invalid definition: ${validation.errors.join("; ")}`);
|
|
140714
140636
|
}
|
|
140715
|
-
const modelErrors = await workflowModelErrors(definition);
|
|
140637
|
+
const modelErrors = await workflowModelErrors(definition, { vcsRepo });
|
|
140716
140638
|
if (modelErrors.length > 0) {
|
|
140717
140639
|
return toolErr(`Invalid definition: ${modelErrors.join("; ")}`);
|
|
140718
140640
|
}
|
|
@@ -140757,7 +140679,7 @@ var init_create_workflow = __esm(() => {
|
|
|
140757
140679
|
init_types4();
|
|
140758
140680
|
init_workflows();
|
|
140759
140681
|
init_definition2();
|
|
140760
|
-
|
|
140682
|
+
init_model_validation();
|
|
140761
140683
|
init_readiness();
|
|
140762
140684
|
});
|
|
140763
140685
|
|
|
@@ -141024,7 +140946,9 @@ async function patchWorkflowDefinition(options) {
|
|
|
141024
140946
|
if (!validation.valid) {
|
|
141025
140947
|
return { ok: false, reason: "invalid", errors: validation.errors };
|
|
141026
140948
|
}
|
|
141027
|
-
const modelErrors = await workflowModelErrors(patchResult.definition
|
|
140949
|
+
const modelErrors = await workflowModelErrors(patchResult.definition, {
|
|
140950
|
+
vcsRepo: updates?.vcsRepo === undefined ? existing.vcsRepo : updates.vcsRepo
|
|
140951
|
+
});
|
|
141028
140952
|
if (modelErrors.length > 0) {
|
|
141029
140953
|
return { ok: false, reason: "invalid", errors: modelErrors };
|
|
141030
140954
|
}
|
|
@@ -141045,7 +140969,7 @@ async function patchWorkflowDefinition(options) {
|
|
|
141045
140969
|
var init_patch_definition = __esm(() => {
|
|
141046
140970
|
init_db4();
|
|
141047
140971
|
init_definition2();
|
|
141048
|
-
|
|
140972
|
+
init_model_validation();
|
|
141049
140973
|
init_version();
|
|
141050
140974
|
});
|
|
141051
140975
|
|
|
@@ -141223,7 +141147,7 @@ var registerRetryWorkflowRunTool = (server) => {
|
|
|
141223
141147
|
createToolRegistrar(server)("retry-workflow-run", {
|
|
141224
141148
|
title: "Retry Workflow Run",
|
|
141225
141149
|
annotations: { destructiveHint: false },
|
|
141226
|
-
description: "Resume the same failed workflow run from its failed step(s); completed steps are not re-run. Retrying re-creates the failed node's side effects (e.g. an agent task), so check the target state first if that work was already done manually.",
|
|
141150
|
+
description: "Resume the same failed workflow run from its failed step(s); completed steps are not re-run. Retrying re-creates the failed node's side effects (e.g. an agent task), so check the target state first if that work was already done manually. Retries on the definition the run started with; to use an edited workflow, trigger a new run.",
|
|
141227
141151
|
inputSchema: object2({
|
|
141228
141152
|
runId: string2().uuid().describe("Workflow run ID to retry")
|
|
141229
141153
|
}),
|
|
@@ -141489,7 +141413,13 @@ var registerUpdateWorkflowTool = (server) => {
|
|
|
141489
141413
|
if (!validation.valid) {
|
|
141490
141414
|
return toolErr(`Invalid definition: ${validation.errors.join("; ")}`);
|
|
141491
141415
|
}
|
|
141492
|
-
|
|
141416
|
+
}
|
|
141417
|
+
const repoChanged = vcsRepo !== undefined && (vcsRepo ?? null) !== (existing.vcsRepo ?? null);
|
|
141418
|
+
const judged = definition ?? (repoChanged ? existing.definition : undefined);
|
|
141419
|
+
if (judged) {
|
|
141420
|
+
const modelErrors = await workflowModelErrors(judged, {
|
|
141421
|
+
vcsRepo: vcsRepo === undefined ? existing.vcsRepo : vcsRepo
|
|
141422
|
+
});
|
|
141493
141423
|
if (modelErrors.length > 0) {
|
|
141494
141424
|
return toolErr(`Invalid definition: ${modelErrors.join("; ")}`);
|
|
141495
141425
|
}
|
|
@@ -141538,7 +141468,7 @@ var init_update_workflow = __esm(() => {
|
|
|
141538
141468
|
init_types4();
|
|
141539
141469
|
init_workflows();
|
|
141540
141470
|
init_definition2();
|
|
141541
|
-
|
|
141471
|
+
init_model_validation();
|
|
141542
141472
|
init_readiness();
|
|
141543
141473
|
init_version();
|
|
141544
141474
|
});
|
|
@@ -141679,6 +141609,7 @@ async function createServer(opts = {}) {
|
|
|
141679
141609
|
registerGetMetricsTool(server);
|
|
141680
141610
|
registerSendTaskTool(server);
|
|
141681
141611
|
registerListModelProfilesTool(server);
|
|
141612
|
+
registerCheckModelProfileTool(server);
|
|
141682
141613
|
registerGetTaskDetailsTool(server);
|
|
141683
141614
|
registerStoreProgressTool(server);
|
|
141684
141615
|
registerMyAgentInfoTool(server);
|
|
@@ -141957,6 +141888,7 @@ var init_server = __esm(() => {
|
|
|
141957
141888
|
init_memory_search();
|
|
141958
141889
|
init_memory_store();
|
|
141959
141890
|
init_model_catalog();
|
|
141891
|
+
init_check_model_profile();
|
|
141960
141892
|
init_list_model_profiles();
|
|
141961
141893
|
init_my_agent_info();
|
|
141962
141894
|
init_oauth_access_token();
|
|
@@ -142061,4 +141993,4 @@ var init_server = __esm(() => {
|
|
|
142061
141993
|
loggedToolAllowlistWarnings = new Set;
|
|
142062
141994
|
});
|
|
142063
141995
|
|
|
142064
|
-
export { DEFAULT_NEGOTIATED_PROTOCOL_VERSION, SUPPORTED_PROTOCOL_VERSIONS, isJSONRPCRequest, isJSONRPCResultResponse, isJSONRPCErrorResponse, JSONRPCMessageSchema, isInitializeRequest, init_types, McpServer, init_mcp, repointTrackerSyncBySwarmId, init_tracker, isRuntimePoolWakeable, isAgentReachable, init_reachability, referencedBundlePaths, skillDirs, init_manifest_format, TaskCreationBlockedError, init_errors2, resolveIdentity, renderIdentity, init_identity, recordUnmappedIdentity, init_unmapped_identities, MAX_TASK_ATTACHMENT_BYTES, recordTaskAttachmentUpload, scopeFromAttachment, backingProviderId, init_task_attachment_store,
|
|
141996
|
+
export { DEFAULT_NEGOTIATED_PROTOCOL_VERSION, SUPPORTED_PROTOCOL_VERSIONS, isJSONRPCRequest, isJSONRPCResultResponse, isJSONRPCErrorResponse, JSONRPCMessageSchema, isInitializeRequest, init_types, McpServer, init_mcp, repointTrackerSyncBySwarmId, init_tracker, isRuntimePoolWakeable, isAgentReachable, init_reachability, referencedBundlePaths, skillDirs, init_manifest_format, TaskCreationBlockedError, init_errors2, resolveIdentity, renderIdentity, init_identity, recordUnmappedIdentity, init_unmapped_identities, MAX_TASK_ATTACHMENT_BYTES, recordTaskAttachmentUpload, scopeFromAttachment, backingProviderId, init_task_attachment_store, stripSiblingBlock, init_sibling_block, createTaskWithSiblingAwareness, init_sibling_awareness, transcribeAudioNotes, init_transcription, init_templates, buildEffectiveText, bufferedFileFailures, fetchSlackFiles, createSlackTaskWithFiles, notifySlackFileFailures, init_inbound_files, isAddressedToOtherUser, broadcastMatches, routeMessage, extractTaskFromMessage, init_router, extractSlackMessageText, slackInboundMessageText, collectSlackMessageFiles, init_message_text, createAdditiveBuffer, init_additive_buffer, recoverIncompleteRuns, init_recovery, handleWebhookTrigger, verifyHmacSignature, WebhookError, init_triggers, snapshotAndUpdateWorkflow, init_version, RawLlmConfigSchema, RawLlmOutputSchema, executeRawLlm, init_raw_llm, getExecutorRegistry2, initWorkflows2, init_workflows, dispatchScheduleTarget, calculateNextRun2, startScheduler2, stopScheduler2, runScheduleNow2, init_scheduler, ExtensionAssetConflictError, init_assets, ExtensionOwnershipError, getExtensionFiles, getExtensionById, getExtensionByName, listExtensions, listExtensionVersions, updateExtensionMeta, listExtensionRuns, init_db, SDK_ALLOWLIST, mcpToolNameForSdkMethod, init_sdk_allowlist, MCP_OVERFLOW_NAMESPACE, mcpOverflowAuthError, init_kv_overflow, hasKvViewArgs, resolveKvView, init_kv_view, COLOR_LITERAL_THRESHOLD, countColorLiterals, init_color_literals, toolErr, createToolRegistrar, init_utils, handleMcpBridge, init_mcp_bridge, Redacted, init_redacted, SCRIPT_SDK_RESPONSE_LIMIT_BYTES, readScriptSdkJsonResponse, init_response_limit, ExtensionConfigError, init_loader, ExtensionLifecycleError, setExtensionLoopbackBaseUrl, enableExtension, disableExtension, activateVersion, ExtensionAssetsInvalidError, installExtensionWithAssets, uninstallExtension, reloadExtension, loadEnabledExtensions, stopExtensionRuntime, init_lifecycle, ExtensionAbortedError2, isRegistered2, isExtensionAgentId2, getExtensionBridgeToken2, resolveBridgeCallOrigin2, extensionIdForAgent2, runContext2, registerLoaded2, unregister2, listRegistered2, dispatchPre2, dispatchPost2, init_dispatcher, REBOOT_RETRY_PIN_TAG2, getPinCandidateAgent2, resolveLeadOnlyRecoveryAssignment2, getResumeGeneration2, getNextResumeGeneration2, inheritedModelSelection2, createWorkerTaskFollowUp2, createResumeFollowUp2, createRerouteDecisionTask2, createPoolStarvationDecisionTask2, init_worker_follow_up, isGitHubEnabled, initGitHub, verifyWebhookSignature, isAgentMailEnabled, initAgentMail, verifyAgentMailWebhook, isInboxAllowed, isSenderAllowed, handleMessageReceived, init_agentmail, isAzureDevOpsEnabled, initAzureDevOps, verifyAzureDevOpsWebhook, isAzureDevOpsUrl, canonicalAzureDevOpsRepoUrl, parseAzureDevOpsRepoUrl, init_azure_devops, createdPullRequestOf, commentedPayloadOf, handlePullRequestCreated, handlePullRequestCommented, handleWorkItemCreated, handleWorkItemUpdated, handleWorkItemCommented, handleWorkItemDeleted, handleWorkItemRestored, initAzureDevOpsOutbound, init_azure_devops2, enqueueAuditRow, enqueueAdmissionRow, flushAuditBuffer, startAuditWriter, stopAuditWriter, startAuditGc, stopAuditGc, init_rbac_audit, getTelemetryIngestAnchor, init_telemetry_ingest_anchor, initApiTelemetry, syncTelemetryEnabled, init_telemetry_enable, isBitbucketEnabled, initBitbucket, verifyBitbucketWebhook, isDuplicateDelivery, markDeliveryProcessed, pullRequestEventOf, pullRequestCommentEventOf, handlePullRequestCreated2, handlePullRequestCommentCreated, handlePullRequestClosed, init_bitbucket, handlePullRequest, handleIssue, handleComment, handlePullRequestReview, handleCheckRun, handleCheckSuite, handleWorkflowRun, init_github, isGitLabEnabled, initGitLab, verifyGitLabWebhook, handleMergeRequest, handleIssue2, handleNote, handlePipeline, init_gitlab, isChatSdkEnabled, getChatSdkConfig, init_config, errorMessage, init_logger, resolveAdapterApiUrl, init_adapters, trackBackground, init_background, TelegramBotApiError, callTelegramBotApi, init_telegram_api, isTrustedTeamsServiceUrl, init_teams_origin, getSessionLabels, rememberSessionLabel, getResourceSessionLabels, init_session_labels, isChatSdkStopping, startChatSdk, getChatInstance, isChatAdapterConfigured, getChatSdkHealth, stopChatSdk, init_runtime, getJiraMetadata, updateJiraMetadata, clearJiraMetadata, init_metadata, registerJiraWebhook, deleteJiraWebhook, init_webhook_lifecycle, isJiraEnabled, initJira, init_app, handleJiraWebhook, init_webhook, init_jira, handleAgentSessionEvent, handleIssueUpdate, handleIssueDelete, handleAgentSessionPrompted, init_sync, isLinearEnabled, initLinear, init_app2, init_linear, init_slack, verifyPageSession, LEGACY_PAGE_SESSION_COOKIE, isCookieSafePageId, extractPageSession, extractLegacyPageSession, extractAndVerifyCookie, isLocalDevPageRequest, pageSessionSetCookies, init_page_session, resolveHttpRequestAuth, init_auth, getDeploymentEnvValue, loadGlobalConfigsIntoEnv, reloadGlobalConfigsAndIntegrations, scheduleIntegrationsReload, handleCore, init_core, MCP_MAX_TOOL_INPUT_ELEMENTS, MCP_MAX_REQUEST_BODY_BYTES, init_mcp_limits, userCtx, init_task_tool_ctx, requestPrincipal, agentFirstPrincipal, requireAuthKind, rejectGuest, init_request_principal, handleApps, init_apps, cancelApprovalRequest, cancelApprovalRequestAndRun, init_approval_cancel, getUserCommsPrefs, init_requester_comms, getTaskDetailsInputSchema, getTaskDetailsOutputSchema, getTaskDetailsHandler, init_get_task_details, cancelTaskInputSchema, cancelTaskOutputSchema, cancelTaskHandler, init_cancel_task, executeReadOnlyQuery, assertSelectOnlyQuery, handleDbQuery, init_db_query, snapshotMetric, init_version2, AssetKeyAuthorizationError, authorizeAssetKeyWrite, init_asset_key_auth, getPageEditCounter, init_page_versions, snapshotPage, init_version3, DEFAULT_THEME_ID, THEME_PRESET_IDS, getThemePreset, init_presets, readThemeFields, init_page_fields, assertOAuthAppUrlsSafe, assertOAuthEgressUrlSafe, init_app_validation, listOAuthPresets, listOAuthPresetIds, getOAuthPreset, hydrateOAuthAppFromPreset, init_presets2, scopedResourceScopeIdSchema, resolveScopedResourceId, init_scoped_resource, MemoryKeyError, init_key_guard, refreshLinks, init_link_resolver, indexMemoryContent, init_index_content, dedupeMemoryDocumentIds, recordMemoryAccesses, recordRetrievals, init_retrieval, ExplicitSelfDuplicateError, applyRating, init_store, shouldPersistAutomaticTaskMemory, init_automatic_task_gate, guardTerminalTaskResultWrite, init_terminal_result_guard, getTasksInputSchema, getTasksOutputSchema, getTasksHandler, init_get_tasks, reservedNamespaceError, privateNamespaceError, reservedRoomKeyError, init_kv_reserved_namespaces, updateMcpServerChecked, init_mcp_server_checked_update, updateTouchesStdioExecution, init_mcp_server_stdio_gate, canReadMemory, init_access, getLinksForMemory, init_links_store, expandCandidatesWithGraph, init_graph_expansion, isApiDraining, drainApi, init_api_drain, markKapsoMessageRead, sendKapsoReaction, init_client, getKapsoConfig, getKapsoNumberMapping, markKapsoMessageSeen, init_config2, changesAllowMerge, init_repo_merge_policy, updateSwarmRepoChecked, init_repo_checked_update, getCombConfig, init_config3, resolveRoomNamespace, roomRequestInfo, authorizeRoomNamespace, sessionAccessTopic, sessionPresenceRoot, init_auth2, RoomOperationSchema, init_document, removeAwarenessStates, init_awareness, roomTopic, decodeRoomSnapshot, roomView, getRoom, changeRoom, applyRoomUpdate, resetRoom, sweepRooms, closeRooms, removeNamespaceRooms, init_rooms, init_scheduler2, MEMORY_KEYS_DEFAULT_PREFIX, MEMORY_KEYS_MAX_LIMIT, estimateTokens, posteriorMean, listMemoryKeys, checkChunkIntegrity, getMemoryChunks, getPosteriorsByIds, init_key_browser, createEvent, createEventsBatch, getEventCountsFiltered, getEventsFiltered, init_events, mergeScheduleTiming, validateRecurringTiming, init_validate, followUpThreadForSourceTask, evaluateFollowUpRedelegation, init_follow_up_redelegation_guard, checkOutputSchemaShape, sendTaskOutputSchema, sendTaskHandler, init_send_task, steerTaskUserInputSchema, steerTaskOutputSchema, steerTaskHandler, init_steer_task, skipReasonFrom, finalizeSkippedTaskReaction, init_task_skip, IMPROVEMENT_TEXT_MAX, IMPROVEMENT_STATUSES, IMPROVEMENT_SOURCES, ImprovementError, isImprovementsEnabled, getImprovement, listImprovements, createImprovement, approveAndSend, discardImprovement, improvementLeakHints, init_improvements, canClaim, init_budget_admission, emitBudgetRefusalSideEffects, init_budget_refusal_notify, workflowModelErrors, init_model_validation, patchWorkflowDefinition, init_patch_definition, idempotencyKeyHeader, readIdempotencyKey, replayAcceptedOperation, init_idempotency_key, resolveScriptsOnlyMode, init_scripts_only_mode, ALL_CAPABILITIES, hasCapability, getEnabledCapabilities, createServer, init_server };
|