@desplega.ai/agent-swarm 1.158.0 → 1.160.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/README.md +1 -1
- package/dist/{acp-adapter-xaq4n6pc.js → acp-adapter-2mjwcsfh.js} +124 -27
- package/dist/{actions-p9hz5yat.js → actions-e43rxskr.js} +35 -30
- package/dist/{anthropic-messages-51pz26qe.js → anthropic-messages-5qx80j9k.js} +106 -16
- package/dist/{app-g26wdcz6.js → app-mc7xfagn.js} +12 -10
- package/dist/{assistant-wydfqkb3.js → assistant-sedkzv3b.js} +42 -31
- package/dist/{azure-openai-responses-8gksqtmz.js → azure-openai-responses-nfb21z9a.js} +13 -14
- package/dist/{boot-reembed-se8zmdcp.js → boot-reembed-cqz9swn5.js} +13 -12
- package/dist/{boot-reembed-g5ckg9yb.js → boot-reembed-m3656j2n.js} +14 -13
- package/dist/{boot-scrub-logs-wfxqan61.js → boot-scrub-logs-xbxf5d7w.js} +11 -9
- package/dist/boot-seeds-gsetbs5y.js +28 -0
- package/dist/{claude-adapter-tv2x4f36.js → claude-adapter-dc6289mc.js} +28 -23
- package/dist/{claude-managed-adapter-41b2s7fd.js → claude-managed-adapter-naaw51me.js} +4 -3
- package/dist/{claude-managed-setup-60g8aazx.js → claude-managed-setup-eacvchx0.js} +12 -3
- package/dist/claude-sdk-session-bqp2xvym.js +29722 -0
- package/dist/{cli-987hg0aa.js → cli-0jwe9034.js} +2 -2
- package/dist/{cli-vj6h9kc2.js → cli-0m7wct0d.js} +59 -1
- package/dist/{cli-c07r9a2m.js → cli-0q3avq3s.js} +12 -11
- package/dist/{cli-19jenss3.js → cli-0wgxmwf6.js} +31 -10
- package/dist/cli-0x01kwrd.js +491 -0
- package/dist/cli-0xqde53b.js +176 -0
- package/dist/cli-10nhj6xq.js +8355 -0
- package/dist/{cli-tt9k8r35.js → cli-12tszpk9.js} +479 -910
- package/dist/{cli-5b6b62tz.js → cli-13hw4z91.js} +1 -1
- package/dist/{cli-cqt19wg6.js → cli-1a2j50m0.js} +11 -2
- package/dist/{cli-xberxa1r.js → cli-25fcq4b4.js} +2 -2
- package/dist/{cli-npssxgaz.js → cli-2pdaysab.js} +52 -2
- package/dist/cli-3qhyh31j.js +166 -0
- package/dist/cli-447dt1h3.js +3828 -0
- package/dist/cli-4derpgyk.js +115 -0
- package/dist/{cli-00w2c66p.js → cli-523679eh.js} +13 -2
- package/dist/{cli-y95wp3tg.js → cli-58e8yr0d.js} +1 -1
- package/dist/{cli-24k806sc.js → cli-5nbmpy8w.js} +3 -3
- package/dist/{cli-53sz8gkz.js → cli-6cs6wzxt.js} +1 -1
- package/dist/cli-741yb0xx.js +1027 -0
- package/dist/cli-74h9hscv.js +69 -0
- package/dist/cli-7cxw8b60.js +14910 -0
- package/dist/{cli-xhaeg2nc.js → cli-7e398j1h.js} +1 -1
- package/dist/cli-7kyk9jr3.js +22 -0
- package/dist/cli-89s4ngw3.js +183 -0
- package/dist/{cli-9b13ggd1.js → cli-89v6kyq7.js} +1 -0
- package/dist/{cli-ftfvggzx.js → cli-9hsgwz4w.js} +1045 -581
- package/dist/{cli-rqz8qbw7.js → cli-a8dvhzrt.js} +59 -20
- package/dist/{cli-j57qkrpq.js → cli-azhgzetg.js} +395 -56
- package/dist/cli-br0qdrnp.js +2150 -0
- package/dist/{cli-rj19hc34.js → cli-btfv8y88.js} +1 -1
- package/dist/{cli-8qmme6vd.js → cli-c8a36vcc.js} +2 -2
- package/dist/cli-cpvsaqsw.js +333 -0
- package/dist/cli-d5czme6m.js +17805 -0
- package/dist/{cli-h38x0qhg.js → cli-et8m9xsv.js} +4 -3
- package/dist/{cli-x24pshtq.js → cli-evvtk35y.js} +6 -6
- package/dist/{cli-7s3syk22.js → cli-f8gy6r2r.js} +5 -5
- package/dist/{cli-zt1227k1.js → cli-fkqhbg8g.js} +5 -3
- package/dist/{cli-9httdpyq.js → cli-g2whhdrf.js} +1 -1
- package/dist/cli-gt4hxb8p.js +99 -0
- package/dist/{cli-s8eet254.js → cli-jajnsm8q.js} +37184 -53838
- package/dist/{cli-7gtvvpbh.js → cli-jayjpjmb.js} +21 -12
- package/dist/{cli-68w09sjw.js → cli-jyk0ynw2.js} +27 -89
- package/dist/{cli-aehm1rbq.js → cli-jz4w45qt.js} +1152 -61
- package/dist/cli-kmcpfwn2.js +333856 -0
- package/dist/{cli-4198qc9v.js → cli-ktmyrtpn.js} +19 -3
- package/dist/{cli-j55n64b6.js → cli-mfe5btp9.js} +505 -189
- package/dist/{cli-q67y4wzm.js → cli-phsaj4xq.js} +24 -2
- package/dist/{cli-1hkrch3k.js → cli-pm1rst0h.js} +46 -7
- package/dist/{cli-pw9rj5t9.js → cli-pqetb83f.js} +1 -176
- package/dist/{cli-ggm92wcn.js → cli-ptr8h7kp.js} +20 -1
- package/dist/{cli-s8s499xy.js → cli-qbksc292.js} +3 -2
- package/dist/{cli-47m6dkd3.js → cli-qydf22qq.js} +597 -346
- package/dist/{cli-3gmcwfyx.js → cli-r1mxd1xh.js} +13 -6
- package/dist/cli-rb9m6rpe.js +4980 -0
- package/dist/cli-rykfmgwg.js +102 -0
- package/dist/{cli-5d10vd2m.js → cli-shkxm1vn.js} +6 -5
- package/dist/{cli-eetrvv91.js → cli-t3p77qk1.js} +1 -1
- package/dist/cli-tfky2838.js +756 -0
- package/dist/{cli-g8djp6qe.js → cli-tmqt7dpj.js} +40 -0
- package/dist/{cli-fgqxwrpv.js → cli-tpq83z89.js} +1631 -127
- package/dist/cli-trc24wk2.js +143 -0
- package/dist/{cli-aky8tctm.js → cli-tzx2ke1v.js} +3 -3
- package/dist/cli-v7fn5gms.js +1425 -0
- package/dist/{cli-wscdvcqz.js → cli-vctdqs5h.js} +1 -1
- package/dist/{cli-cw9zck8j.js → cli-xjcywfsf.js} +8 -4
- package/dist/{cli-k0g1sjzm.js → cli-ybgv4kw2.js} +18 -11
- package/dist/{cli-rjehvrts.js → cli-ydmcgve1.js} +8 -8
- package/dist/{cli-vhjwh6cz.js → cli-ygwm91nt.js} +1 -1
- package/dist/{cli-mcnhgnn1.js → cli-ykk5jaax.js} +184 -26
- package/dist/{cli-de1396j2.js → cli-ywybs5as.js} +7 -1
- package/dist/cli-zpep9q5e.js +491 -0
- package/dist/cli.js +41 -32
- package/dist/cloudflare-workers-ai-system-one-k6fbxw9d.js +46 -0
- package/dist/{codex-adapter-cnm8wk11.js → codex-adapter-nmxcatww.js} +26 -17
- package/dist/{codex-hook-9hptmdhj.js → codex-hook-20me6byw.js} +2 -2
- package/dist/{codex-login-x3jk4etn.js → codex-login-w6fz4xbz.js} +50 -5
- package/dist/{codex-session-runner-gfg547zj.js → codex-session-runner-90aa80ev.js} +24 -17
- package/dist/{commands-e3bn0p75.js → commands-8wcq1kn7.js} +11 -9
- package/dist/{db-03v9kzr2.js → db-j40kc4se.js} +25 -11
- package/dist/{devin-adapter-8vgkwh29.js → devin-adapter-dpsv6hd9.js} +1 -1
- package/dist/{dispatcher-nrmg8yht.js → dispatcher-4zqy768d.js} +34 -29
- package/dist/{dsh-adapter-k03nfqa6.js → dsh-adapter-mpnzgztj.js} +3 -3
- package/dist/{e2b-93x1k0j5.js → e2b-ez07znam.js} +4 -3
- package/dist/execute-6e7qeyk4.js +1017 -0
- package/dist/{google-generative-ai-bxmv50nc.js → google-generative-ai-k6n5nbpp.js} +6 -5
- package/dist/{google-vertex-809af514.js → google-vertex-44xxtcvp.js} +6 -5
- package/dist/{handlers-aqcedbyb.js → handlers-kjdce1w5.js} +37 -32
- package/dist/{hook-ybvmrmhq.js → hook-czx13n12.js} +19 -15
- package/dist/{hook-7vkskkre.js → hook-r2t4bqfg.js} +18 -14
- package/dist/{http-2eqa8t24.js → http-3bbb19be.js} +900 -145
- package/dist/{index-f6cryxwe.js → index-4a5njnm1.js} +2 -59
- package/dist/{index-x71bvq0p.js → index-668me3f0.js} +35 -30
- package/dist/{index-c6zsv1bd.js → index-7aj368tw.js} +13 -12
- package/dist/{index-1yks3qcr.js → index-fg0dsp6c.js} +34 -29
- package/dist/{index-chgdkq36.js → index-kkv84jq9.js} +34 -29
- package/dist/{index-a3vn96n8.js → index-zg7vp46x.js} +198 -54
- package/dist/{keepalive-vtkf5n99.js → keepalive-yra8dy57.js} +13 -11
- package/dist/{lead-h3sp357x.js → lead-va0pad2c.js} +54 -49
- package/dist/llama-cpp-classify-tgj35k8d.js +335 -0
- package/dist/{maintenance-jzeqtk3q.js → maintenance-hqewtmyg.js} +14 -13
- package/dist/{mistral-conversations-zx0kn554.js → mistral-conversations-pc3ntnxt.js} +14 -17
- package/dist/{oauth-refresh-sweep-qp3dzmdp.js → oauth-refresh-sweep-7rdt1m9n.js} +12 -10
- package/dist/{onboard-tmsp0qbz.js → onboard-j6ms6d0x.js} +6 -5
- package/dist/{openai-codex-responses-4vjqzvjp.js → openai-codex-responses-bbancrr0.js} +21 -8
- package/dist/{openai-completions-9hjrqbw8.js → openai-completions-jpaj5g2b.js} +9 -12
- package/dist/{openai-responses-7b1pn0xt.js → openai-responses-200k1wx4.js} +23 -18
- package/dist/{opencode-adapter-x6x2da1z.js → opencode-adapter-89rabkw2.js} +8 -7
- package/dist/{openrouter-images-9f9ek4rw.js → openrouter-images-8yx3487g.js} +5 -7
- package/dist/{otel-impl-9mz73q65.js → otel-impl-a792rjz0.js} +1 -1
- package/dist/{pi-messages-txpjj39q.js → pi-messages-vxdt8v7j.js} +2 -1
- package/dist/{pi-mono-adapter-m6dvv0dz.js → pi-mono-adapter-g7qzvr3v.js} +295 -70
- package/dist/pricing-refresh-wx0tp7cb.js +39 -0
- package/dist/quickjs-r1pq2107.wasm +0 -0
- package/dist/{rbac-roles-c9wqz83x.js → rbac-roles-8tzawacv.js} +12 -10
- package/dist/{render-v2-gryrh9h8.js → render-v2-mm7zswb8.js} +12 -10
- package/dist/runtime-zyssgse0.js +24 -0
- package/dist/{setup-q9720bt6.js → setup-8y70ys6t.js} +6 -5
- package/dist/typesafe-system-one-2ef30pec.js +27 -0
- package/dist/{virtual-modules-3htpgn8x.js → virtual-modules-6nmk7h3n.js} +22 -13
- package/dist/{work-objects-b76x7deb.js → work-objects-fg6xkb0n.js} +37 -32
- package/dist/{worker-6vrxbv41.js → worker-wmwhxsph.js} +54 -49
- package/openapi.json +1314 -91
- package/package.json +12 -11
- package/src/be/db/agents.ts +20 -0
- package/src/be/db/api-keys.ts +70 -0
- package/src/be/db/tasks/human-free.ts +442 -0
- package/src/be/db/tasks/read.ts +56 -1
- package/src/be/db/tasks/write.ts +107 -11
- package/src/be/db.ts +274 -188
- package/src/be/harness-model-support.ts +182 -0
- package/src/be/human-free-drain.ts +67 -0
- package/src/be/memory/providers/sqlite-store.ts +51 -15
- package/src/be/migrations/182_task_human_free_flag.sql +63 -0
- package/src/be/migrations/183_human_free_reclassify_queue.sql +25 -0
- package/src/be/migrations/184_model_catalog.sql +120 -0
- package/src/be/migrations/185_api_key_auth_failures.sql +6 -0
- package/src/be/migrations/186_api_key_seat_mismatch.sql +8 -0
- package/src/be/model-catalog-store.ts +644 -0
- package/src/be/model-tier-keys.ts +46 -0
- package/src/be/model-tier-resolution.ts +534 -0
- package/src/be/model-validation.ts +188 -0
- package/src/be/models-catalog.ts +61 -7
- package/src/be/modelsdev-cache.json +82 -0
- package/src/be/modelsdev-cache.ts +2 -0
- package/src/be/pricing-refresh.ts +154 -12
- package/src/be/scripts/typecheck.ts +15 -0
- package/src/be/seed/runner.ts +18 -12
- package/src/be/seed/types.ts +1 -0
- package/src/be/seed-scripts/catalog/task-failure-audit.ts +61 -9
- package/src/be/swarm-config-guard.ts +8 -0
- package/src/cli.tsx +10 -0
- package/src/commands/claude-managed-setup.ts +3 -1
- package/src/commands/codex-login.ts +67 -0
- package/src/commands/credential-outcome-report.ts +191 -0
- package/src/commands/rate-limit-outcome.ts +34 -4
- package/src/commands/runner.ts +357 -186
- package/src/commands/seat-mismatch-report.ts +46 -0
- package/src/extensions/apply-task-create.ts +27 -1
- package/src/extensions/contract-types.generated.ts +1 -1
- package/src/heartbeat/heartbeat.ts +79 -17
- package/src/heartbeat/templates.ts +2 -2
- package/src/http/agents.ts +62 -1
- package/src/http/api-keys.ts +140 -2
- package/src/http/codex-oauth-keep-warm.ts +3 -5
- package/src/http/index.ts +8 -0
- package/src/http/memory.ts +12 -5
- package/src/http/models-catalog.ts +357 -8
- package/src/http/poll.ts +54 -3
- package/src/http/schedules.ts +51 -6
- package/src/http/script-runs.ts +12 -0
- package/src/http/session-data.ts +2 -5
- package/src/http/stats.ts +6 -8
- package/src/http/status.ts +15 -1
- package/src/http/tasks.ts +90 -7
- package/src/http/usage-cache.ts +56 -15
- package/src/http/workflows.ts +46 -8
- package/src/mcp-client/http-client.ts +5 -0
- package/src/memory/recall-query.ts +74 -0
- package/src/prompts/base-prompt.ts +15 -4
- package/src/prompts/session-templates.ts +23 -1
- package/src/providers/acp-adapter.ts +1 -0
- package/src/providers/claude-adapter.ts +14 -5
- package/src/providers/claude-managed-adapter.ts +1 -0
- package/src/providers/claude-managed-models.ts +47 -161
- package/src/providers/claude-sdk-session.ts +3 -1
- package/src/providers/codex-adapter.ts +14 -14
- package/src/providers/codex-models.ts +65 -198
- package/src/providers/devin-adapter.ts +1 -0
- package/src/providers/dsh-adapter.ts +2 -1
- package/src/providers/harness-version.ts +83 -7
- package/src/providers/opencode-adapter.ts +53 -1
- package/src/providers/pi-binary-root/src/extensions/codemode/worker.ts +11 -0
- package/src/providers/pi-codemode-runtime.ts +17 -0
- package/src/providers/pi-mono-adapter.ts +361 -83
- package/src/providers/pi-mono-extension.ts +16 -1
- package/src/providers/reasoning-effort.ts +44 -140
- package/src/providers/types.ts +8 -0
- package/src/rbac/legacy-policy.ts +43 -0
- package/src/rbac/permissions.ts +15 -0
- package/src/scripts-runtime/sdk-allowlist.ts +4 -0
- package/src/scripts-runtime/types/stdlib.d.ts +15 -0
- package/src/scripts-runtime/types/swarm-extension.d.ts +3 -0
- package/src/scripts-runtime/types/swarm-sdk.d.ts +15 -0
- package/src/server.ts +6 -0
- package/src/slack/assistant.ts +13 -0
- package/src/slack/message-text.ts +56 -2
- package/src/slack/render-v2.ts +87 -37
- package/src/slack/session-status.ts +541 -0
- package/src/slack/thread-buffer.ts +10 -2
- package/src/tasks/sibling-awareness.ts +3 -2
- package/src/telemetry.ts +5 -4
- package/src/templates.d.ts +6 -0
- package/src/tests/agents-list-model-display.test.ts +4 -6
- package/src/tests/api-key-auth-failure-route.test.ts +142 -0
- package/src/tests/api-key-tracking.test.ts +368 -1
- package/src/tests/base-prompt.test.ts +43 -2
- package/src/tests/claude-adapter.test.ts +68 -0
- package/src/tests/claude-managed-adapter.test.ts +12 -18
- package/src/tests/codex-adapter.test.ts +2 -1
- package/src/tests/codex-auth-failure.test.ts +52 -0
- package/src/tests/codex-gpt6-release.test.ts +66 -5
- package/src/tests/codex-login.test.ts +116 -0
- package/src/tests/context-window.test.ts +7 -5
- package/src/tests/credential-exhaustion-policy.test.ts +118 -3
- package/src/tests/credential-outcome-report.test.ts +171 -0
- package/src/tests/credential-status-api.test.ts +103 -2
- package/src/tests/db-extraction-contract.test.ts +1 -0
- package/src/tests/db-task-read-contract.test.ts +10 -1
- package/src/tests/db-task-write-contract.test.ts +535 -2
- package/src/tests/docs-index-footprint.test.js +3 -3
- package/src/tests/dokploy-deploy.test.ts +315 -0
- package/src/tests/dsh-adapter.test.ts +1 -1
- package/src/tests/explicit-model-validation.test.ts +583 -0
- package/src/tests/extensions-pre-task.test.ts +73 -0
- package/src/tests/fetch-resolved-env.test.ts +46 -0
- package/src/tests/hang-watchdog-worker.ts +47 -0
- package/src/tests/hang-watchdog.test.ts +45 -0
- package/src/tests/hang-watchdog.ts +30 -0
- package/src/tests/harness-model-guard.test.ts +123 -0
- package/src/tests/harness-model-support.test.ts +374 -0
- package/src/tests/harness-version.test.ts +70 -3
- package/src/tests/heartbeat-checklist-config.test.ts +71 -0
- package/src/tests/heartbeat-checklist.test.ts +4 -2
- package/src/tests/heartbeat-orphan-resume.test.ts +48 -0
- package/src/tests/http-task-write-ownership.test.ts +172 -0
- package/src/tests/human-free-flag.test.ts +279 -0
- package/src/tests/human-free-oracle.ts +57 -0
- package/src/tests/human-free-reclassify.test.ts +669 -0
- package/src/tests/memory-fts-populate.test.ts +139 -0
- package/src/tests/memory-http-recall-gating.test.ts +125 -1
- package/src/tests/migration-046-budgets.test.ts +3 -3
- package/src/tests/model-catalog-migration.test.ts +134 -0
- package/src/tests/model-catalog-table.test.ts +249 -0
- package/src/tests/model-catalog-write-access.test.ts +387 -0
- package/src/tests/model-rate-limit-windows.test.ts +19 -0
- package/src/tests/model-tier-resolution.test.ts +611 -0
- package/src/tests/models-catalog.test.ts +1 -1
- package/src/tests/multi-runtime-enabled-stats.test.ts +65 -1
- package/src/tests/opencode-adapter.test.ts +157 -2
- package/src/tests/package-publish.test.ts +137 -36
- package/src/tests/pi-codemode.test.ts +246 -0
- package/src/tests/pi-mono-adapter.test.ts +3 -0
- package/src/tests/pi-native-mcp.test.ts +193 -0
- package/src/tests/pi-tool-exposure.test.ts +374 -0
- package/src/tests/preload.ts +3 -0
- package/src/tests/pricing-routes.test.ts +2 -2
- package/src/tests/prompt-template-session.test.ts +5 -3
- package/src/tests/rate-limit-event.test.ts +65 -0
- package/src/tests/rate-limit-outcome.test.ts +90 -0
- package/src/tests/rbac-engine.test.ts +77 -3
- package/src/tests/reasoning-effort.test.ts +109 -0
- package/src/tests/refresh-modelsdev-carryforward.test.ts +5 -5
- package/src/tests/runner-key-completion-outcome.test.ts +112 -0
- package/src/tests/runner-key-outcome-late-reset.test.ts +224 -0
- package/src/tests/runner-registration-retry.test.ts +149 -0
- package/src/tests/runtime-model-catalog.test.ts +86 -0
- package/src/tests/script-connections.test.ts +9 -0
- package/src/tests/seat-mismatch-report.test.ts +85 -0
- package/src/tests/seed-scripts.test.ts +138 -0
- package/src/tests/seed.test.ts +25 -0
- package/src/tests/session-costs.test.ts +14 -11
- package/src/tests/slack-message-text.test.ts +101 -0
- package/src/tests/slack-render-v2.test.ts +96 -0
- package/src/tests/slack-session-status.test.ts +626 -0
- package/src/tests/slack-thread-buffer-context.test.ts +93 -0
- package/src/tests/status.test.ts +29 -0
- package/src/tests/steering-promotion.test.ts +51 -0
- package/src/tests/store-progress-ownership.test.ts +136 -0
- package/src/tests/subscription-plans.test.ts +28 -0
- package/src/tests/task-cascade-fail.test.ts +148 -2
- package/src/tests/task-citations.test.ts +3 -2
- package/src/tests/tool-annotations.test.ts +1 -1
- package/src/tests/usage-cache.test.ts +166 -0
- package/src/tests/workflow-agent-task.test.ts +30 -0
- package/src/tests/workflow-executors.test.ts +5 -2
- package/src/tests/workflow-system-one-decision-review.test.ts +1021 -0
- package/src/tests/workflow-system-one-decision-save-warnings.test.ts +365 -0
- package/src/tests/workflow-system-one-decision.test.ts +2063 -0
- package/src/tests/workflow-triggers-v2.test.ts +320 -0
- package/src/tools/model-catalog/index.ts +137 -0
- package/src/tools/schedules/create-schedule.ts +17 -2
- package/src/tools/schedules/patch-schedule.ts +31 -1
- package/src/tools/schedules/update-schedule.ts +31 -1
- package/src/tools/send-task.ts +18 -1
- package/src/tools/store-progress.ts +49 -4
- package/src/tools/task-action.ts +14 -1
- package/src/tools/tool-config.ts +3 -1
- package/src/tools/workflows/create-workflow.ts +17 -4
- package/src/tools/workflows/patch-workflow-node.ts +17 -7
- package/src/tools/workflows/patch-workflow.ts +9 -2
- package/src/tools/workflows/update-workflow.ts +17 -4
- package/src/types.ts +41 -1
- package/src/utils/codex-auth-failure.ts +34 -0
- package/src/utils/context-window.ts +47 -53
- package/src/utils/credentials.ts +72 -30
- package/src/utils/error-tracker.ts +80 -0
- package/src/utils/harness-cli-version.ts +115 -0
- package/src/utils/harness-model-error.ts +33 -0
- package/src/utils/model-rate-limit-windows.ts +12 -0
- package/src/utils/runtime-model-catalog.ts +152 -0
- package/src/utils/spawn-model-guard.ts +43 -0
- package/src/utils/subscription-plans.ts +22 -0
- package/src/workflows/approval-resolution.ts +39 -0
- package/src/workflows/definition.ts +7 -0
- package/src/workflows/engine.ts +69 -1
- package/src/workflows/executors/agent-task.ts +16 -6
- package/src/workflows/executors/base.ts +53 -0
- package/src/workflows/executors/human-in-the-loop.ts +8 -8
- package/src/workflows/executors/index.ts +1 -0
- package/src/workflows/executors/registry.ts +2 -0
- package/src/workflows/executors/system-one-decision.ts +1232 -0
- package/src/workflows/executors/system-one-providers.ts +301 -0
- package/src/workflows/executors/workflow-llm.ts +13 -1
- package/src/workflows/model-validation.ts +45 -0
- package/src/workflows/patch-definition.ts +5 -0
- package/src/workflows/readiness.ts +86 -0
- package/src/workflows/recovery.ts +12 -12
- package/src/workflows/resume.ts +23 -9
- package/src/workflows/triggers.ts +85 -0
- package/templates/schedules/daily-blocker-digest/content.md +4 -5
- package/templates/skills/agent-browser/SKILL.md +6 -5
- package/templates/skills/agent-browser/content.md +6 -5
- package/templates/skills/heartbeat-runbook/config.json +1 -1
- package/templates/skills/heartbeat-runbook/content.md +2 -2
- package/templates/skills/swarm-scripts/SKILL.md +1 -1
- package/templates/skills/swarm-scripts/content.md +1 -1
- package/templates/skills/workflow-iterate/content.md +82 -1
- package/templates/workflows/claude-code-changelog-watch/content.md +2 -0
- package/templates/workflows/pr-review-status-sweep/content.md +2 -0
- package/dist/boot-seeds-s3q01xj3.js +0 -26
- package/dist/claude-sdk-session-t442qz6f.js +0 -39108
- package/dist/cli-0xjkj1j7.js +0 -61
- package/dist/cli-20cj37vt.js +0 -335561
- package/dist/cli-2djtr51b.js +0 -48
- package/dist/cli-65hjmev5.js +0 -1141
- package/dist/cli-aw1jwp1r.js +0 -14075
- package/dist/cli-h967nb6r.js +0 -6603
- package/dist/cli-vapyk8sw.js +0 -20
- package/dist/cli-ws6rqycm.js +0 -247
- package/dist/pricing-refresh-v1cbr9te.js +0 -27
- package/src/providers/modelsdev-reasoning.json +0 -6453
- package/dist/{index-f24115ge.js → index-2wsdsnmm.js} +3 -3
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BASE_SUMMARIZE_PROMPT,
|
|
3
3
|
SummaryWithRatingsSchema,
|
|
4
|
-
buildSummaryWithRatingsPrompt
|
|
4
|
+
buildSummaryWithRatingsPrompt
|
|
5
|
+
} from "./cli-cpvsaqsw.js";
|
|
6
|
+
import {
|
|
5
7
|
parseModelStr,
|
|
6
8
|
resolveCredential
|
|
7
|
-
} from "./cli-
|
|
9
|
+
} from "./cli-12tszpk9.js";
|
|
8
10
|
import {
|
|
9
11
|
DEFAULT_OPENROUTER_BASE_URL,
|
|
10
12
|
getOpenRouterBaseUrl
|
|
11
13
|
} from "./cli-3dpj7atn.js";
|
|
12
14
|
import {
|
|
13
15
|
complete,
|
|
14
|
-
exports_typebox,
|
|
15
16
|
getBuiltinModel
|
|
16
|
-
} from "./cli-
|
|
17
|
+
} from "./cli-10nhj6xq.js";
|
|
18
|
+
import {
|
|
19
|
+
exports_typebox
|
|
20
|
+
} from "./cli-rb9m6rpe.js";
|
|
17
21
|
import {
|
|
18
22
|
init_zod
|
|
19
23
|
} from "./cli-sd0mxa3c.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getSystemMessageText
|
|
3
|
-
} from "./cli-
|
|
3
|
+
} from "./cli-ykk5jaax.js";
|
|
4
4
|
|
|
5
5
|
// node_modules/@earendil-works/pi-ai/dist/api/constrained-sampling.js
|
|
6
6
|
class UnsupportedStrictJsonSchemaError extends Error {
|
|
@@ -41,7 +41,7 @@ function schemaAllowsNull(schema) {
|
|
|
41
41
|
return true;
|
|
42
42
|
return Array.isArray(schema.anyOf) && schema.anyOf.some((variant) => schemaAllowsNull(variant));
|
|
43
43
|
}
|
|
44
|
-
function makeJsonSchemaNodeStrict(schema) {
|
|
44
|
+
function makeJsonSchemaNodeStrict(schema, isUnsupportedKeyword) {
|
|
45
45
|
if (!isJsonSchemaObject(schema)) {
|
|
46
46
|
throw new UnsupportedStrictJsonSchemaError("boolean schemas are unsupported");
|
|
47
47
|
}
|
|
@@ -50,6 +50,13 @@ function makeJsonSchemaNodeStrict(schema) {
|
|
|
50
50
|
throw new UnsupportedStrictJsonSchemaError(`${key} schemas are unsupported`);
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
+
if (isUnsupportedKeyword) {
|
|
54
|
+
for (const [key, value] of Object.entries(schema)) {
|
|
55
|
+
if (isUnsupportedKeyword(key, value)) {
|
|
56
|
+
throw new UnsupportedStrictJsonSchemaError(`${key}: ${JSON.stringify(value)} is unsupported`);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
53
60
|
if (schema.anyOf !== undefined) {
|
|
54
61
|
if (!Array.isArray(schema.anyOf) || schema.anyOf.length === 0) {
|
|
55
62
|
throw new UnsupportedStrictJsonSchemaError("anyOf must contain at least one schema");
|
|
@@ -58,14 +65,14 @@ function makeJsonSchemaNodeStrict(schema) {
|
|
|
58
65
|
if (isStructuredSchema(variant)) {
|
|
59
66
|
throw new UnsupportedStrictJsonSchemaError("object and array unions are unsupported");
|
|
60
67
|
}
|
|
61
|
-
makeJsonSchemaNodeStrict(variant);
|
|
68
|
+
makeJsonSchemaNodeStrict(variant, isUnsupportedKeyword);
|
|
62
69
|
}
|
|
63
70
|
}
|
|
64
71
|
if (schema.items !== undefined) {
|
|
65
72
|
if (Array.isArray(schema.items)) {
|
|
66
73
|
throw new UnsupportedStrictJsonSchemaError("tuple schemas are unsupported");
|
|
67
74
|
}
|
|
68
|
-
makeJsonSchemaNodeStrict(schema.items);
|
|
75
|
+
makeJsonSchemaNodeStrict(schema.items, isUnsupportedKeyword);
|
|
69
76
|
}
|
|
70
77
|
const isObjectSchema = schema.type === "object";
|
|
71
78
|
if (schema.properties !== undefined && !isObjectSchema) {
|
|
@@ -89,7 +96,7 @@ function makeJsonSchemaNodeStrict(schema) {
|
|
|
89
96
|
throw new UnsupportedStrictJsonSchemaError("required contains an unknown property");
|
|
90
97
|
}
|
|
91
98
|
for (const [key, property] of Object.entries(properties)) {
|
|
92
|
-
makeJsonSchemaNodeStrict(property);
|
|
99
|
+
makeJsonSchemaNodeStrict(property, isUnsupportedKeyword);
|
|
93
100
|
if (!required.has(key) && !schemaAllowsNull(property)) {
|
|
94
101
|
properties[key] = { anyOf: [property, { type: "null" }] };
|
|
95
102
|
}
|
|
@@ -97,12 +104,12 @@ function makeJsonSchemaNodeStrict(schema) {
|
|
|
97
104
|
schema.required = propertyNames;
|
|
98
105
|
schema.additionalProperties = false;
|
|
99
106
|
}
|
|
100
|
-
function makeStrictJsonSchema(schema) {
|
|
107
|
+
function makeStrictJsonSchema(schema, isUnsupportedKeyword) {
|
|
101
108
|
const cloned = structuredClone(schema);
|
|
102
109
|
if (!isJsonSchemaObject(cloned)) {
|
|
103
110
|
throw new UnsupportedStrictJsonSchemaError("root schema must have type object");
|
|
104
111
|
}
|
|
105
|
-
makeJsonSchemaNodeStrict(cloned);
|
|
112
|
+
makeJsonSchemaNodeStrict(cloned, isUnsupportedKeyword);
|
|
106
113
|
if (cloned.type !== "object") {
|
|
107
114
|
throw new UnsupportedStrictJsonSchemaError("root schema must have type object");
|
|
108
115
|
}
|
|
@@ -160,13 +167,13 @@ function inferGrammarInputProperty(tool) {
|
|
|
160
167
|
}
|
|
161
168
|
return inputProperty;
|
|
162
169
|
}
|
|
163
|
-
function resolveJsonSchemaStrictSampling(tool, supportsStrictMode) {
|
|
170
|
+
function resolveJsonSchemaStrictSampling(tool, supportsStrictMode, isUnsupportedKeyword) {
|
|
164
171
|
const config = tool.constrainedSampling;
|
|
165
172
|
if (!config || config.type !== "json_schema")
|
|
166
173
|
return;
|
|
167
174
|
if (supportsStrictMode) {
|
|
168
175
|
try {
|
|
169
|
-
makeStrictJsonSchema(tool.parameters);
|
|
176
|
+
makeStrictJsonSchema(tool.parameters, isUnsupportedKeyword);
|
|
170
177
|
return true;
|
|
171
178
|
} catch (error) {
|
|
172
179
|
if (!(error instanceof UnsupportedStrictJsonSchemaError))
|
|
@@ -313,10 +320,9 @@ function clampMaxTokensToContext(model, context, maxTokens) {
|
|
|
313
320
|
return Math.min(maxTokens, Math.max(MIN_MAX_TOKENS, available));
|
|
314
321
|
}
|
|
315
322
|
function buildBaseOptions(model, context, options, apiKey) {
|
|
316
|
-
const samplingParams = model.samplingParams || options?.samplingParams ? { ...model.samplingParams, ...options?.samplingParams } : undefined;
|
|
317
323
|
return {
|
|
318
324
|
temperature: options?.temperature,
|
|
319
|
-
samplingParams,
|
|
325
|
+
samplingParams: options?.samplingParams,
|
|
320
326
|
maxTokens: clampMaxTokensToContext(model, context, options?.maxTokens ?? model.maxTokens),
|
|
321
327
|
signal: options?.signal,
|
|
322
328
|
telemetryContext: options?.telemetryContext,
|
|
@@ -328,6 +334,7 @@ function buildBaseOptions(model, context, options, apiKey) {
|
|
|
328
334
|
headers: options?.headers,
|
|
329
335
|
onPayload: options?.onPayload,
|
|
330
336
|
onResponse: options?.onResponse,
|
|
337
|
+
onProviderStreamEvent: options?.onProviderStreamEvent,
|
|
331
338
|
timeoutMs: options?.timeoutMs,
|
|
332
339
|
websocketConnectTimeoutMs: options?.websocketConnectTimeoutMs,
|
|
333
340
|
maxRetries: options?.maxRetries,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resolveSlackUserId,
|
|
3
3
|
rewriteSlackMentions
|
|
4
|
-
} from "./cli-
|
|
4
|
+
} from "./cli-c8a36vcc.js";
|
|
5
5
|
import {
|
|
6
6
|
bufferedFileFailures,
|
|
7
7
|
buildEffectiveText,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
fetchSlackFiles,
|
|
12
12
|
findUserByExternalId,
|
|
13
13
|
notifySlackFileFailures
|
|
14
|
-
} from "./cli-
|
|
14
|
+
} from "./cli-9hsgwz4w.js";
|
|
15
15
|
import {
|
|
16
16
|
buildBufferFlushBlocks,
|
|
17
17
|
ensureSlackThreadTree,
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
getSlackApp,
|
|
21
21
|
isSlackRenderV2Enabled,
|
|
22
22
|
registerTreeMessage
|
|
23
|
-
} from "./cli-
|
|
23
|
+
} from "./cli-azhgzetg.js";
|
|
24
24
|
import {
|
|
25
25
|
createLogEntry,
|
|
26
26
|
getAgentById,
|
|
@@ -33,11 +33,11 @@ import {
|
|
|
33
33
|
init_steering,
|
|
34
34
|
requestSteering,
|
|
35
35
|
slackContextKey
|
|
36
|
-
} from "./cli-
|
|
36
|
+
} from "./cli-qydf22qq.js";
|
|
37
37
|
import {
|
|
38
38
|
init_steering_enabled,
|
|
39
39
|
isSteeringEnabled
|
|
40
|
-
} from "./cli-
|
|
40
|
+
} from "./cli-ptr8h7kp.js";
|
|
41
41
|
import {
|
|
42
42
|
__callDispose,
|
|
43
43
|
__using
|
|
@@ -173,7 +173,7 @@ function getBufferMessageCount(key) {
|
|
|
173
173
|
async function instantFlush(key) {
|
|
174
174
|
await slackBuffer.instantFlush(key);
|
|
175
175
|
}
|
|
176
|
-
async function getThreadContextForBuffer(channelId, threadTs, botUserId) {
|
|
176
|
+
async function getThreadContextForBuffer(channelId, threadTs, excludeTs, botUserId) {
|
|
177
177
|
const app = getSlackApp();
|
|
178
178
|
if (!app)
|
|
179
179
|
return "";
|
|
@@ -186,7 +186,7 @@ async function getThreadContextForBuffer(channelId, threadTs, botUserId) {
|
|
|
186
186
|
const messages = result.messages || [];
|
|
187
187
|
if (messages.length === 0)
|
|
188
188
|
return "";
|
|
189
|
-
const formatted = messages.filter((m) => extractSlackMessageText(m) !== "").map((m) => {
|
|
189
|
+
const formatted = messages.filter((m) => !(m.ts && excludeTs.has(m.ts)) && extractSlackMessageText(m) !== "").map((m) => {
|
|
190
190
|
const msg = m;
|
|
191
191
|
const isBotMessage = msg.bot_id !== undefined || msg.subtype === "bot_message";
|
|
192
192
|
const text = extractSlackMessageText(m);
|
|
@@ -276,7 +276,7 @@ ${combinedText}`;
|
|
|
276
276
|
return;
|
|
277
277
|
}
|
|
278
278
|
const lead = await getLeadAgent();
|
|
279
|
-
const threadContext = await getThreadContextForBuffer(channelId, threadTs, botUserId);
|
|
279
|
+
const threadContext = await getThreadContextForBuffer(channelId, threadTs, new Set(items.map((item) => item.ts)), botUserId);
|
|
280
280
|
const fullDescription = threadContext ? `<thread_context>
|
|
281
281
|
${threadContext}
|
|
282
282
|
</thread_context>
|
|
@@ -380,7 +380,7 @@ class InMemoryCredentialStore {
|
|
|
380
380
|
}
|
|
381
381
|
}
|
|
382
382
|
|
|
383
|
-
// node_modules/@earendil-works/pi-ai/dist/
|
|
383
|
+
// node_modules/@earendil-works/pi-ai/dist/utils/models-error.js
|
|
384
384
|
class ModelsError extends Error {
|
|
385
385
|
code;
|
|
386
386
|
constructor(code, message, options) {
|
|
@@ -397,6 +397,8 @@ function withCauseDetail(message, cause) {
|
|
|
397
397
|
return message;
|
|
398
398
|
return `${message}: ${detail}`;
|
|
399
399
|
}
|
|
400
|
+
|
|
401
|
+
// node_modules/@earendil-works/pi-ai/dist/auth/resolve.js
|
|
400
402
|
function resolveProviderAuth(provider, credentials, authContext, overrides) {
|
|
401
403
|
const signal = operationSignal(overrides?.signal);
|
|
402
404
|
return raceWithAbortSignal(resolveProviderAuthWithSignal(provider, credentials, authContext, overrides, signal), signal);
|
|
@@ -505,7 +507,59 @@ class InMemoryModelsStore {
|
|
|
505
507
|
}
|
|
506
508
|
}
|
|
507
509
|
|
|
510
|
+
// node_modules/@earendil-works/pi-ai/dist/utils/model-operations.js
|
|
511
|
+
function getModelType(model) {
|
|
512
|
+
return model.type ?? "chat";
|
|
513
|
+
}
|
|
514
|
+
function isModelType(model, type) {
|
|
515
|
+
return getModelType(model) === type;
|
|
516
|
+
}
|
|
517
|
+
function assertChatModel(model) {
|
|
518
|
+
if (!isModelType(model, "chat")) {
|
|
519
|
+
throw new ModelsError("provider", `Model ${model.provider}/${model.id} is not a chat model`);
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
function assertImageModel(model) {
|
|
523
|
+
if (!isModelType(model, "image")) {
|
|
524
|
+
throw new ModelsError("provider", `Model ${model.provider}/${model.id} is not an image model`);
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
function assertClassifierModel(model) {
|
|
528
|
+
if (!isModelType(model, "classifier")) {
|
|
529
|
+
throw new ModelsError("provider", `Model ${model.provider}/${model.id} is not a classifier model`);
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
function imageErrorResult(model, error, aborted = false) {
|
|
533
|
+
return {
|
|
534
|
+
api: model.api,
|
|
535
|
+
provider: model.provider,
|
|
536
|
+
model: model.id,
|
|
537
|
+
output: [],
|
|
538
|
+
stopReason: aborted ? "aborted" : "error",
|
|
539
|
+
errorMessage: error instanceof Error ? error.message : String(error),
|
|
540
|
+
timestamp: Date.now()
|
|
541
|
+
};
|
|
542
|
+
}
|
|
543
|
+
function classifierErrorResult(model, error, aborted = false) {
|
|
544
|
+
return {
|
|
545
|
+
api: model.api,
|
|
546
|
+
provider: model.provider,
|
|
547
|
+
model: model.id,
|
|
548
|
+
answers: {},
|
|
549
|
+
stopReason: aborted ? "aborted" : "error",
|
|
550
|
+
errorMessage: error instanceof Error ? error.message : String(error),
|
|
551
|
+
timestamp: Date.now()
|
|
552
|
+
};
|
|
553
|
+
}
|
|
554
|
+
|
|
508
555
|
// node_modules/@earendil-works/pi-ai/dist/models.js
|
|
556
|
+
var KNOWN_MODEL_TYPES = { chat: true, image: true, classifier: true };
|
|
557
|
+
function hasKnownModelType(model) {
|
|
558
|
+
return Object.hasOwn(KNOWN_MODEL_TYPES, getModelType(model));
|
|
559
|
+
}
|
|
560
|
+
function withKnownModelTypes(entry) {
|
|
561
|
+
return { ...entry, models: entry.models.filter(hasKnownModelType) };
|
|
562
|
+
}
|
|
509
563
|
function mergeHeaders(base, override) {
|
|
510
564
|
if (!base && !override)
|
|
511
565
|
return;
|
|
@@ -573,9 +627,34 @@ class ModelsImpl {
|
|
|
573
627
|
}
|
|
574
628
|
return models;
|
|
575
629
|
}
|
|
630
|
+
getAllModels(provider) {
|
|
631
|
+
if (provider !== undefined) {
|
|
632
|
+
const entry = this.providers.get(provider);
|
|
633
|
+
if (!entry)
|
|
634
|
+
return [];
|
|
635
|
+
try {
|
|
636
|
+
return entry.getAllModels?.() ?? entry.getModels();
|
|
637
|
+
} catch {
|
|
638
|
+
return [];
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
const models = [];
|
|
642
|
+
for (const entry of this.providers.values()) {
|
|
643
|
+
try {
|
|
644
|
+
models.push(...entry.getAllModels?.() ?? entry.getModels());
|
|
645
|
+
} catch {}
|
|
646
|
+
}
|
|
647
|
+
return models;
|
|
648
|
+
}
|
|
649
|
+
getModelsOfType(type, provider) {
|
|
650
|
+
return this.getAllModels(provider).filter((model) => isModelType(model, type));
|
|
651
|
+
}
|
|
576
652
|
getModel(provider, id) {
|
|
577
653
|
return this.getModels(provider).find((model) => model.id === id);
|
|
578
654
|
}
|
|
655
|
+
getModelOfType(type, provider, id) {
|
|
656
|
+
return this.getModelsOfType(type, provider).find((model) => model.id === id);
|
|
657
|
+
}
|
|
579
658
|
supersedeProviderRefresh(providerId) {
|
|
580
659
|
const generation = (this.refreshGenerations.get(providerId) ?? 0) + 1;
|
|
581
660
|
this.refreshGenerations.set(providerId, generation);
|
|
@@ -620,7 +699,7 @@ class ModelsImpl {
|
|
|
620
699
|
const stored = await this.modelsStore.read(provider.id, { signal });
|
|
621
700
|
await provider.refreshModels({
|
|
622
701
|
credential,
|
|
623
|
-
stored: stored ? structuredClone(stored) : undefined,
|
|
702
|
+
stored: stored ? withKnownModelTypes(structuredClone(stored)) : undefined,
|
|
624
703
|
publish: (publication) => this.publishProviderModels(provider.id, generation, signal, publication),
|
|
625
704
|
allowNetwork,
|
|
626
705
|
force: allowNetwork ? force : undefined,
|
|
@@ -740,24 +819,45 @@ class ModelsImpl {
|
|
|
740
819
|
})();
|
|
741
820
|
return raceWithAbortSignal(check, signal);
|
|
742
821
|
}
|
|
822
|
+
async getAuthenticatedProviders(providerId, signal) {
|
|
823
|
+
signal.throwIfAborted();
|
|
824
|
+
const providers = providerId ? [this.providers.get(providerId)].filter((entry) => entry !== undefined) : this.getProviders();
|
|
825
|
+
const checks = await Promise.all(providers.map(async (provider) => {
|
|
826
|
+
const credential = await this.readCredential(provider.id, signal);
|
|
827
|
+
return { provider, credential, auth: await this.checkProviderAuth(provider, credential, signal) };
|
|
828
|
+
}));
|
|
829
|
+
return checks.filter((entry) => entry.auth !== undefined);
|
|
830
|
+
}
|
|
743
831
|
getAvailable(providerId, options) {
|
|
744
832
|
const signal = operationSignal(options?.signal);
|
|
745
833
|
const available = (async () => {
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
const checks = await Promise.all(providers.map(async (provider) => {
|
|
749
|
-
const credential = await this.readCredential(provider.id, signal);
|
|
750
|
-
return { provider, credential, auth: await this.checkProviderAuth(provider, credential, signal) };
|
|
751
|
-
}));
|
|
752
|
-
return checks.flatMap(({ provider, credential, auth }) => {
|
|
753
|
-
if (!auth)
|
|
754
|
-
return [];
|
|
834
|
+
const providers = await this.getAuthenticatedProviders(providerId, signal);
|
|
835
|
+
return providers.flatMap(({ provider, credential }) => {
|
|
755
836
|
const models = provider.getModels();
|
|
756
837
|
return provider.filterModels?.(models, credential) ?? models;
|
|
757
838
|
});
|
|
758
839
|
})();
|
|
759
840
|
return raceWithAbortSignal(available, signal);
|
|
760
841
|
}
|
|
842
|
+
async getAvailableOfType(type, providerId, options) {
|
|
843
|
+
return (await this.getAllAvailable(providerId, options)).filter((model) => isModelType(model, type));
|
|
844
|
+
}
|
|
845
|
+
getAllAvailable(providerId, options) {
|
|
846
|
+
const signal = operationSignal(options?.signal);
|
|
847
|
+
const available = (async () => {
|
|
848
|
+
const providers = await this.getAuthenticatedProviders(providerId, signal);
|
|
849
|
+
return providers.flatMap(({ provider, credential }) => {
|
|
850
|
+
const models = provider.getAllModels?.() ?? provider.getModels();
|
|
851
|
+
if (provider.filterAllModels)
|
|
852
|
+
return provider.filterAllModels(models, credential);
|
|
853
|
+
if (!provider.filterModels)
|
|
854
|
+
return models;
|
|
855
|
+
const availableChatIds = new Set(provider.filterModels(provider.getModels(), credential).map((model) => model.id));
|
|
856
|
+
return models.filter((model) => !isModelType(model, "chat") || availableChatIds.has(model.id));
|
|
857
|
+
});
|
|
858
|
+
})();
|
|
859
|
+
return raceWithAbortSignal(available, signal);
|
|
860
|
+
}
|
|
761
861
|
async getAuth(providerOrModel, overrides) {
|
|
762
862
|
const signal = operationSignal(overrides?.signal);
|
|
763
863
|
const providerId = typeof providerOrModel === "string" ? providerOrModel : providerOrModel.provider;
|
|
@@ -775,7 +875,7 @@ class ModelsImpl {
|
|
|
775
875
|
}
|
|
776
876
|
};
|
|
777
877
|
}
|
|
778
|
-
async login(providerId, type, interaction) {
|
|
878
|
+
async login(providerId, type, interaction, options) {
|
|
779
879
|
const signal = operationSignal(interaction.signal);
|
|
780
880
|
signal.throwIfAborted();
|
|
781
881
|
const provider = this.providers.get(providerId);
|
|
@@ -785,7 +885,7 @@ class ModelsImpl {
|
|
|
785
885
|
if (!method?.login) {
|
|
786
886
|
throw new ModelsError("auth", `${provider.name} does not support ${type} login`);
|
|
787
887
|
}
|
|
788
|
-
const loginOperation = method.login({ ...interaction, signal });
|
|
888
|
+
const loginOperation = method.login({ ...interaction, signal }, options);
|
|
789
889
|
const credential = await raceWithAbortSignal(loginOperation, signal);
|
|
790
890
|
let mutationStarted = false;
|
|
791
891
|
let markMutationStarted;
|
|
@@ -839,6 +939,10 @@ class ModelsImpl {
|
|
|
839
939
|
}
|
|
840
940
|
return provider;
|
|
841
941
|
}
|
|
942
|
+
requireChatProvider(model) {
|
|
943
|
+
assertChatModel(model);
|
|
944
|
+
return this.requireProvider(model);
|
|
945
|
+
}
|
|
842
946
|
async applyAuth(model, options) {
|
|
843
947
|
this.requireProvider(model);
|
|
844
948
|
const resolution = await this.getAuth(model, {
|
|
@@ -863,7 +967,7 @@ class ModelsImpl {
|
|
|
863
967
|
stream(model, context, options) {
|
|
864
968
|
const transcript = normalizeContext(context);
|
|
865
969
|
return lazyStream(model, async () => {
|
|
866
|
-
const provider = this.
|
|
970
|
+
const provider = this.requireChatProvider(model);
|
|
867
971
|
const { requestModel, requestOptions } = await this.applyAuth(model, options);
|
|
868
972
|
return provider.stream(requestModel, transcript, requestOptions);
|
|
869
973
|
});
|
|
@@ -874,7 +978,7 @@ class ModelsImpl {
|
|
|
874
978
|
streamSimple(model, context, options) {
|
|
875
979
|
const transcript = normalizeContext(context);
|
|
876
980
|
return lazyStream(model, async () => {
|
|
877
|
-
const provider = this.
|
|
981
|
+
const provider = this.requireChatProvider(model);
|
|
878
982
|
const { requestModel, requestOptions } = await this.applyAuth(model, options);
|
|
879
983
|
return provider.streamSimple(requestModel, transcript, requestOptions);
|
|
880
984
|
});
|
|
@@ -884,7 +988,7 @@ class ModelsImpl {
|
|
|
884
988
|
}
|
|
885
989
|
streamDeferred(model, handle, options) {
|
|
886
990
|
return lazyStream(model, async () => {
|
|
887
|
-
const provider = this.
|
|
991
|
+
const provider = this.requireChatProvider(model);
|
|
888
992
|
if (!provider.fetchDeferred) {
|
|
889
993
|
throw new ModelsError("provider", `Provider ${model.provider} does not support deferred responses`);
|
|
890
994
|
}
|
|
@@ -896,25 +1000,61 @@ class ModelsImpl {
|
|
|
896
1000
|
return this.streamDeferred(model, handle, options).result();
|
|
897
1001
|
}
|
|
898
1002
|
async cancelDeferred(model, handle, options) {
|
|
899
|
-
const provider = this.
|
|
1003
|
+
const provider = this.requireChatProvider(model);
|
|
900
1004
|
if (!provider.cancelDeferred) {
|
|
901
1005
|
throw new ModelsError("provider", `Provider ${model.provider} does not support deferred responses`);
|
|
902
1006
|
}
|
|
903
1007
|
const { requestModel, requestOptions } = await this.applyAuth(model, options);
|
|
904
1008
|
await provider.cancelDeferred(requestModel, handle, requestOptions);
|
|
905
1009
|
}
|
|
1010
|
+
async generateImages(model, context, options) {
|
|
1011
|
+
try {
|
|
1012
|
+
assertImageModel(model);
|
|
1013
|
+
const provider = this.requireProvider(model);
|
|
1014
|
+
if (!provider.generateImages) {
|
|
1015
|
+
throw new ModelsError("provider", `Provider ${model.provider} does not support image generation`);
|
|
1016
|
+
}
|
|
1017
|
+
const { requestModel, requestOptions } = await this.applyAuth(model, options);
|
|
1018
|
+
return await provider.generateImages(requestModel, context, requestOptions);
|
|
1019
|
+
} catch (error) {
|
|
1020
|
+
return imageErrorResult(model, error, options?.signal?.aborted);
|
|
1021
|
+
}
|
|
1022
|
+
}
|
|
1023
|
+
async classify(model, context, options) {
|
|
1024
|
+
try {
|
|
1025
|
+
assertClassifierModel(model);
|
|
1026
|
+
const provider = this.requireProvider(model);
|
|
1027
|
+
if (!provider.classify) {
|
|
1028
|
+
throw new ModelsError("provider", `Provider ${model.provider} does not support classification`);
|
|
1029
|
+
}
|
|
1030
|
+
const { requestModel, requestOptions } = await this.applyAuth(model, options);
|
|
1031
|
+
return await provider.classify(requestModel, context, requestOptions);
|
|
1032
|
+
} catch (error) {
|
|
1033
|
+
return classifierErrorResult(model, error, options?.signal?.aborted);
|
|
1034
|
+
}
|
|
1035
|
+
}
|
|
906
1036
|
}
|
|
907
1037
|
function createModels(options) {
|
|
908
1038
|
return new ModelsImpl(options);
|
|
909
1039
|
}
|
|
910
1040
|
function createProvider(input) {
|
|
1041
|
+
const single = input.api && typeof input.api.stream === "function" ? input.api : undefined;
|
|
1042
|
+
const byApi = single || !input.api ? undefined : input.api;
|
|
1043
|
+
const images = input.images;
|
|
1044
|
+
const classifiers = input.classifiers;
|
|
1045
|
+
const streams = single ? [single] : Object.values(byApi ?? {}).filter((entry) => entry !== undefined);
|
|
1046
|
+
const imageImplementations = Object.values(images ?? {}).filter((entry) => entry !== undefined);
|
|
1047
|
+
const classifierImplementations = Object.values(classifiers ?? {}).filter((entry) => entry !== undefined);
|
|
1048
|
+
if (streams.length === 0 && imageImplementations.length === 0 && classifierImplementations.length === 0) {
|
|
1049
|
+
throw new Error(`Provider ${input.id}: at least one of "api", "images", or "classifiers" is required.`);
|
|
1050
|
+
}
|
|
911
1051
|
const baselineModels = input.models;
|
|
912
1052
|
let dynamicModels = [];
|
|
913
1053
|
const fetchModels = input.fetchModels;
|
|
914
1054
|
const currentModels = () => {
|
|
915
1055
|
const merged = [...baselineModels];
|
|
916
1056
|
for (const model of dynamicModels) {
|
|
917
|
-
const index = merged.findIndex((entry) => entry.id === model.id);
|
|
1057
|
+
const index = merged.findIndex((entry) => getModelType(entry) === getModelType(model) && entry.id === model.id);
|
|
918
1058
|
if (index >= 0)
|
|
919
1059
|
merged[index] = model;
|
|
920
1060
|
else
|
|
@@ -922,8 +1062,6 @@ function createProvider(input) {
|
|
|
922
1062
|
}
|
|
923
1063
|
return merged;
|
|
924
1064
|
};
|
|
925
|
-
const single = typeof input.api.stream === "function" ? input.api : undefined;
|
|
926
|
-
const byApi = single ? undefined : input.api;
|
|
927
1065
|
const apiFor = (model) => single ?? byApi?.[model.api];
|
|
928
1066
|
const dispatch = (model, run) => {
|
|
929
1067
|
const streams2 = apiFor(model);
|
|
@@ -940,7 +1078,8 @@ function createProvider(input) {
|
|
|
940
1078
|
baseUrl: input.baseUrl,
|
|
941
1079
|
headers: input.headers,
|
|
942
1080
|
auth: input.auth,
|
|
943
|
-
getModels: currentModels,
|
|
1081
|
+
getModels: () => currentModels().filter((model) => isModelType(model, "chat")),
|
|
1082
|
+
getAllModels: currentModels,
|
|
944
1083
|
refreshModels: fetchModels ? async (context) => {
|
|
945
1084
|
if (context.stored) {
|
|
946
1085
|
const restored = context.stored.models.filter((model) => model.provider === input.id).map((model) => model);
|
|
@@ -954,9 +1093,10 @@ function createProvider(input) {
|
|
|
954
1093
|
}
|
|
955
1094
|
if (!context.allowNetwork || context.signal.aborted)
|
|
956
1095
|
return;
|
|
957
|
-
const
|
|
1096
|
+
const fetched = await fetchModels(context);
|
|
958
1097
|
if (context.signal.aborted)
|
|
959
1098
|
return;
|
|
1099
|
+
const refreshed = fetched.filter(hasKnownModelType);
|
|
960
1100
|
await context.publish({
|
|
961
1101
|
persist: { models: refreshed, checkedAt: Date.now() },
|
|
962
1102
|
update: () => {
|
|
@@ -965,10 +1105,10 @@ function createProvider(input) {
|
|
|
965
1105
|
});
|
|
966
1106
|
} : undefined,
|
|
967
1107
|
filterModels: input.filterModels,
|
|
1108
|
+
filterAllModels: input.filterAllModels,
|
|
968
1109
|
stream: (model, context, options) => dispatch(model, (streams2) => streams2.stream(model, context, options)),
|
|
969
1110
|
streamSimple: (model, context, options) => dispatch(model, (streams2) => streams2.streamSimple(model, context, options))
|
|
970
1111
|
};
|
|
971
|
-
const streams = single ? [single] : Object.values(byApi ?? {}).filter((entry) => entry !== undefined);
|
|
972
1112
|
if (streams.some((entry) => entry.fetchDeferred !== undefined)) {
|
|
973
1113
|
provider.fetchDeferred = (model, handle, options) => lazyStream(model, async () => {
|
|
974
1114
|
const implementation = apiFor(model);
|
|
@@ -987,10 +1127,28 @@ function createProvider(input) {
|
|
|
987
1127
|
await implementation.cancelDeferred(model, handle, options);
|
|
988
1128
|
};
|
|
989
1129
|
}
|
|
1130
|
+
if (images && imageImplementations.length > 0) {
|
|
1131
|
+
provider.generateImages = async (model, context, options) => {
|
|
1132
|
+
const implementation = images[model.api];
|
|
1133
|
+
if (!implementation) {
|
|
1134
|
+
return imageErrorResult(model, new ModelsError("provider", `Provider ${input.id} has no image generation implementation for "${model.api}"`));
|
|
1135
|
+
}
|
|
1136
|
+
return implementation.generateImages(model, context, options);
|
|
1137
|
+
};
|
|
1138
|
+
}
|
|
1139
|
+
if (classifiers && classifierImplementations.length > 0) {
|
|
1140
|
+
provider.classify = async (model, context, options) => {
|
|
1141
|
+
const implementation = classifiers[model.api];
|
|
1142
|
+
if (!implementation) {
|
|
1143
|
+
return classifierErrorResult(model, new ModelsError("provider", `Provider ${input.id} has no classifier implementation for "${model.api}"`));
|
|
1144
|
+
}
|
|
1145
|
+
return implementation.classify(model, context, options);
|
|
1146
|
+
};
|
|
1147
|
+
}
|
|
990
1148
|
return provider;
|
|
991
1149
|
}
|
|
992
1150
|
function hasApi(model, api) {
|
|
993
|
-
return model.api === api;
|
|
1151
|
+
return isModelType(model, "chat") && model.api === api;
|
|
994
1152
|
}
|
|
995
1153
|
function calculateCost(model, usage) {
|
|
996
1154
|
const inputTokens = usage.input + usage.cacheRead + usage.cacheWrite;
|
|
@@ -1046,7 +1204,7 @@ function clampThinkingLevel(model, level) {
|
|
|
1046
1204
|
function modelsAreEqual(a, b) {
|
|
1047
1205
|
if (!a || !b)
|
|
1048
1206
|
return false;
|
|
1049
|
-
return a.id === b.id && a.provider === b.provider;
|
|
1207
|
+
return getModelType(a) === getModelType(b) && a.id === b.id && a.provider === b.provider;
|
|
1050
1208
|
}
|
|
1051
1209
|
|
|
1052
|
-
export { lazyStream, lazyApi, defaultProviderAuthContext, InMemoryCredentialStore, ModelsError,
|
|
1210
|
+
export { lazyStream, lazyApi, defaultProviderAuthContext, InMemoryCredentialStore, ModelsError, InMemoryModelsStore, getModelType, isModelType, assertChatModel, assertImageModel, assertClassifierModel, imageErrorResult, classifierErrorResult, contentText, getSystemMessageText, renderSystemMessageUpdate, createInitialSystemMessage, normalizeContext, getInitialSystemMessage, withoutInitialSystemMessage, getCurrentTools, getCurrentSystemMessage, getCurrentSystemPrompt, collapseSystemMessages, resolveTranscript, toToolDeclaration, declarationsEqual, getToolStateChanges, getDeclaredTools, hasToolRedefinitions, hasNonAdditiveToolChanges, resolveTranscriptTools, createModels, createProvider, hasApi, calculateCost, getSupportedThinkingLevels, clampThinkingLevel, modelsAreEqual };
|
|
@@ -35,6 +35,12 @@ function parseModelLimitMessage(text) {
|
|
|
35
35
|
return;
|
|
36
36
|
return match[1].toLowerCase();
|
|
37
37
|
}
|
|
38
|
+
function parseCreditsRequiredMessage(text) {
|
|
39
|
+
const match = text.match(/(Fable|Opus|Sonnet)(?:[^.]|\.(?=\d)){0,40}requires usage credits/i);
|
|
40
|
+
if (!match)
|
|
41
|
+
return;
|
|
42
|
+
return match[1].toLowerCase();
|
|
43
|
+
}
|
|
38
44
|
function activeModelBlock(windows, family, nowMs) {
|
|
39
45
|
if (!windows)
|
|
40
46
|
return;
|
|
@@ -75,4 +81,4 @@ var init_model_rate_limit_windows = __esm(() => {
|
|
|
75
81
|
};
|
|
76
82
|
});
|
|
77
83
|
|
|
78
|
-
export { MODEL_SCOPED_WINDOWS, modelFamilyOf, windowForModelFamily, isModelScopedWindow, parseModelLimitMessage, activeModelBlock, activeModelBlocks, init_model_rate_limit_windows };
|
|
84
|
+
export { MODEL_SCOPED_WINDOWS, modelFamilyOf, windowForModelFamily, isModelScopedWindow, parseModelLimitMessage, parseCreditsRequiredMessage, activeModelBlock, activeModelBlocks, init_model_rate_limit_windows };
|