@desplega.ai/agent-swarm 1.152.2 → 1.153.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-pfeje2v5.js → acp-adapter-ahmjxhek.js} +4 -4
- package/dist/{actions-0sttc7f5.js → actions-jzrfpkmn.js} +30 -26
- package/dist/{anthropic-messages-2y8nktar.js → anthropic-messages-9vqsbznt.js} +112 -84
- package/dist/{app-p8teva95.js → app-03na2vwb.js} +9 -6
- package/dist/{assistant-r45jnsrt.js → assistant-hfkxvhgt.js} +31 -27
- package/dist/{azure-openai-responses-f38x2avq.js → azure-openai-responses-04qwdwfq.js} +27 -13
- package/dist/{boot-reembed-je26h5y7.js → boot-reembed-c98xrad3.js} +8 -6
- package/dist/{boot-reembed-1qmybsd4.js → boot-reembed-zt3qm9xn.js} +9 -7
- package/dist/{boot-scrub-logs-gte3h1mm.js → boot-scrub-logs-jcqd8ksj.js} +6 -4
- package/dist/{claude-adapter-csc1mzka.js → claude-adapter-mgryg8g3.js} +17 -15
- package/dist/{claude-managed-adapter-dsmkcrjy.js → claude-managed-adapter-ea2aga6w.js} +3 -3
- package/dist/{claude-sdk-session-fcd6f078.js → claude-sdk-session-jjf4zss1.js} +17 -15
- package/dist/{cli-r2fpe7cx.js → cli-00w2c66p.js} +61 -55
- package/dist/{cli-fm4ytsdk.js → cli-0d9nbqxf.js} +1 -1
- package/dist/cli-0x5qzvkg.js +4279 -0
- package/dist/{cli-d3p82erb.js → cli-18amys3y.js} +9 -9
- package/dist/{cli-wbyk465z.js → cli-1hwnb4hc.js} +1 -1
- package/dist/{cli-xw7vak96.js → cli-3bcmp015.js} +5 -5
- package/dist/cli-3er6gcsn.js +1849 -0
- package/dist/{cli-c4eeb5q2.js → cli-5b6b62tz.js} +1 -1
- package/dist/{cli-4ahpr4sw.js → cli-5mbmvxnn.js} +5 -5
- package/dist/{cli-xy1cchaf.js → cli-5taqtpze.js} +235 -8
- package/dist/{cli-fmy65jdn.js → cli-6ks9xf1n.js} +7 -5
- package/dist/cli-7g9s78jf.js +2827 -0
- package/dist/{cli-jew3jda5.js → cli-7pnz2v6s.js} +2 -2
- package/dist/{cli-r84ctdxn.js → cli-83wkg402.js} +2 -2
- package/dist/{cli-jvy9qgjs.js → cli-a9scg8sv.js} +4 -4
- package/dist/{cli-4yc5d8fk.js → cli-avkd6mqv.js} +50 -0
- package/dist/{cli-ht5rs63n.js → cli-b2g6mzjc.js} +15 -6
- package/dist/{cli-jbmc0r7r.js → cli-bw0dfwkr.js} +1 -1
- package/dist/{cli-8wrympd7.js → cli-bzr0ftht.js} +26 -7
- package/dist/{cli-wpv5rgg2.js → cli-cdq08v3r.js} +2 -2
- package/dist/cli-cgj4hc12.js +18902 -0
- package/dist/cli-d6hk10xx.js +14075 -0
- package/dist/{cli-zvgj5zg8.js → cli-djvxhnc4.js} +31 -3324
- package/dist/{cli-s25avqg9.js → cli-e781c6f9.js} +1 -0
- package/dist/{cli-3bpzj8me.js → cli-eazstkad.js} +2 -2
- package/dist/{cli-s2qjdd6z.js → cli-eetrvv91.js} +1 -1
- package/dist/cli-h38x0qhg.js +6912 -0
- package/dist/{cli-9xvdm3bx.js → cli-h60qfasa.js} +742 -278
- package/dist/{pi-mono-adapter-jcqt71cg.js → cli-ja7mrygn.js} +67343 -101083
- package/dist/{cli-j8dggbcr.js → cli-k0g1sjzm.js} +23 -31
- package/dist/{cli-gphgnvpf.js → cli-m04pt18h.js} +2 -2
- package/dist/{cli-rgvp6r2x.js → cli-mcnhgnn1.js} +193 -4
- package/dist/{cli-j4nv2wqy.js → cli-mzgyhxbe.js} +10 -4
- package/dist/{cli-qn042eh7.js → cli-n0q9b7j4.js} +46 -1870
- package/dist/cli-n7h1kqpf.js +29 -0
- package/dist/{cli-ckz5t2hb.js → cli-nq0kgyxe.js} +5 -5
- package/dist/{cli-z3wkng35.js → cli-qrqhc31j.js} +151 -125
- package/dist/{cli-56h18ng2.js → cli-r8tdds6s.js} +1 -1
- package/dist/{cli-ch38q5z4.js → cli-rj7de4b2.js} +6788 -2541
- package/dist/{cli-qd65dvr6.js → cli-s5s1f2yn.js} +56 -40
- package/dist/{cli-kj76p1ez.js → cli-scwq51gn.js} +13 -7
- package/dist/{cli-2nnd56zt.js → cli-tdh4hjr2.js} +3 -2
- package/dist/{cli-c2mk1kgf.js → cli-v4en75c5.js} +8 -1
- package/dist/{cli-b9dd0h3k.js → cli-vw03hg5t.js} +3 -2
- package/dist/{cli-zvkq5csn.js → cli-ybpp1srm.js} +6 -6
- package/dist/cli-yn0a417a.js +4069 -0
- package/dist/{cli-gpqcs935.js → cli-ysc1kbet.js} +2 -2
- package/dist/{cli-zfzznn7c.js → cli-ytxs7mn1.js} +26 -2
- package/dist/cli-zcsyfw2z.js +3335 -0
- package/dist/{cli-4j8k1m4w.js → cli-zt1227k1.js} +1162 -192
- package/dist/cli-zy5w9gpt.js +230 -0
- package/dist/cli.js +26 -34
- package/dist/{codex-adapter-fxmpsabw.js → codex-adapter-8548daap.js} +12 -11
- package/dist/{codex-session-runner-rr1e47ea.js → codex-session-runner-2dad8p4x.js} +12 -11
- package/dist/{commands-0f5rxz51.js → commands-355dbpa8.js} +6 -4
- package/dist/{db-r3jxf3wy.js → db-4jjvwz1s.js} +6 -4
- package/dist/{dispatcher-06vph6q4.js → dispatcher-ca590nkz.js} +29 -25
- package/dist/dsh-adapter-rgvj6ykp.js +19 -0
- package/dist/{e2b-413b8t4v.js → e2b-93x1k0j5.js} +6 -7
- package/dist/{google-generative-ai-ndjmj5fa.js → google-generative-ai-xtw7tggr.js} +33 -73
- package/dist/{google-vertex-fr665tqs.js → google-vertex-zdqpms6n.js} +38 -68
- package/dist/{handlers-0hgtc910.js → handlers-2y6dqpvf.js} +32 -28
- package/dist/{hook-9kvrv1er.js → hook-0s8knepr.js} +11 -9
- package/dist/{hook-fbfhkat3.js → hook-k0gec254.js} +12 -10
- package/dist/{http-xbyx8k5j.js → http-jp2nb4zw.js} +300 -237
- package/dist/{index-tfsdxyv6.js → index-0wzg3sp3.js} +39 -24
- package/dist/{index-rnyahfn5.js → index-3mq6ce93.js} +29 -25
- package/dist/{index-jsw3aynb.js → index-42s7eezq.js} +29 -25
- package/dist/{cli-pdz9qde4.js → index-9ch1n761.js} +10 -11
- package/dist/{index-gpfn1741.js → index-b56xkbc7.js} +8 -6
- package/dist/{index-66xz5e9j.js → index-h5gs261z.js} +521 -9
- package/dist/{index-2sp0384z.js → index-kkeftv5h.js} +738 -21
- package/dist/{index-sgk50mbg.js → index-s37dbevy.js} +30 -26
- package/dist/index-w097eg0x.js +5 -0
- package/dist/jiti-loader-b4837mtm.js +34 -0
- package/dist/jiti-static-loader-q2g5ds0y.js +31267 -0
- package/dist/{keepalive-s3xpr7sw.js → keepalive-9pfw7t02.js} +8 -6
- package/dist/{lead-rq4n5r16.js → lead-7vcmcdq4.js} +44 -39
- package/dist/{maintenance-f0atj1ab.js → maintenance-x277jbpd.js} +9 -7
- package/dist/{mistral-conversations-qhr84ph3.js → mistral-conversations-zx0kn554.js} +24 -18
- package/dist/{node-x1g4v0pq.js → node-5qtycf6a.js} +16 -11
- package/dist/{oauth-refresh-sweep-q0t3bxre.js → oauth-refresh-sweep-5fwa7th2.js} +7 -5
- package/dist/{onboard-br5j1kch.js → onboard-17sv0f51.js} +103 -35
- package/dist/{openai-codex-responses-wy6a43wd.js → openai-codex-responses-4vjqzvjp.js} +33 -27
- package/dist/{openai-completions-32rdwmze.js → openai-completions-pxsmym7g.js} +52 -64
- package/dist/{openai-responses-6xwf7bzg.js → openai-responses-tmn0rqp0.js} +23 -24
- package/dist/{opencode-adapter-28axqa09.js → opencode-adapter-qbmv4tpy.js} +6 -6
- package/dist/{otel-impl-vdqge2nt.js → otel-impl-srjy4be4.js} +4 -4
- package/dist/{pi-messages-b1mbr6gp.js → pi-messages-txpjj39q.js} +3 -3
- package/dist/pi-mono-adapter-946a0sdd.js +1316 -0
- package/dist/{pricing-refresh-hb3691fd.js → pricing-refresh-vetcm563.js} +8 -6
- package/dist/{rbac-roles-jh280k9g.js → rbac-roles-cfzgr6r1.js} +8 -6
- package/dist/{rbac-roles-t78xt39b.js → rbac-roles-cmxaddmy.js} +7 -5
- package/dist/{render-v2-7p8r2ymg.js → render-v2-f9hzff72.js} +9 -6
- package/dist/{seed-pricing-hf889enh.js → seed-pricing-jggk6rsy.js} +7 -5
- package/dist/{setup-w6mb03jv.js → setup-8mfceb9t.js} +4 -5
- package/dist/virtual-modules-ax661xp0.js +54 -0
- package/dist/{work-objects-nt8gy1kj.js → work-objects-vdsdcczj.js} +32 -28
- package/dist/{worker-dwy617t0.js → worker-cd0nhyv1.js} +44 -39
- package/openapi.json +36 -14
- package/package.json +6 -6
- package/src/be/automation-preflight.ts +6 -4
- package/src/be/extensions/db.ts +35 -4
- package/src/be/models-catalog.ts +2 -0
- package/src/be/modelsdev-cache.json +213 -0
- package/src/be/rbac-audit.ts +2 -0
- package/src/be/seed-pricing.ts +3 -1
- package/src/be/swarm-config-guard.ts +1 -0
- package/src/commands/onboard/compose-generator.ts +6 -1
- package/src/commands/onboard/env-generator.ts +6 -1
- package/src/commands/onboard/manifest.ts +1 -0
- package/src/commands/onboard/steps/integration-slack.tsx +56 -16
- package/src/commands/onboard/steps/review.tsx +5 -0
- package/src/commands/onboard/types.ts +6 -0
- package/src/commands/onboard.tsx +5 -1
- package/src/commands/provider-credentials.ts +14 -2
- package/src/extensions/lifecycle.ts +15 -21
- package/src/http/agents.ts +2 -2
- package/src/http/config.ts +1 -1
- package/src/http/core.ts +5 -3
- package/src/http/extensions.ts +108 -34
- package/src/http/status.ts +22 -10
- package/src/prompts/base-prompt.ts +15 -7
- package/src/providers/claude-managed-models.ts +8 -0
- package/src/providers/codex-models.ts +15 -1
- package/src/providers/dsh-adapter.ts +248 -0
- package/src/providers/index.ts +5 -1
- package/src/providers/modelsdev-reasoning.json +50 -0
- package/src/rbac/legacy-policy.ts +15 -1
- package/src/rbac/types.ts +2 -0
- package/src/server.ts +7 -1
- package/src/slack/app.ts +32 -10
- package/src/slack/config.ts +29 -0
- package/src/telemetry.ts +2 -3
- package/src/tests/agents-harness-provider.test.ts +19 -0
- package/src/tests/agents-list-model-display.test.ts +60 -1
- package/src/tests/base-prompt.test.ts +25 -0
- package/src/tests/claude-managed-adapter.test.ts +6 -0
- package/src/tests/codex-gpt6-release.test.ts +97 -0
- package/src/tests/config-api-only-keys.test.ts +9 -0
- package/src/tests/context-window.test.ts +1 -0
- package/src/tests/dsh-adapter.test.ts +276 -0
- package/src/tests/e2e-nightly-report.test.ts +3 -3
- package/src/tests/e2e-redact.test.ts +2 -0
- package/src/tests/env-flag.test.ts +6 -0
- package/src/tests/extensions-db.test.ts +41 -0
- package/src/tests/extensions-http.test.ts +148 -4
- package/src/tests/extensions-lifecycle.test.ts +18 -0
- package/src/tests/extensions-mcp-tools.test.ts +9 -5
- package/src/tests/internal-ai/complete-structured.test.ts +32 -9
- package/src/tests/internal-ai/credentials.test.ts +4 -4
- package/src/tests/internal-ai/models.test.ts +20 -0
- package/src/tests/migration-046-budgets.test.ts +2 -0
- package/src/tests/model-control.test.ts +2 -2
- package/src/tests/onboard-compose.test.ts +14 -0
- package/src/tests/onboard-env.test.ts +17 -0
- package/src/tests/onboard-manifest.test.ts +12 -0
- package/src/tests/opus-5-5-registry.test.ts +48 -0
- package/src/tests/pricing-refresh.test.ts +1 -1
- package/src/tests/pricing-routes.test.ts +15 -3
- package/src/tests/provider-registration.test.ts +5 -2
- package/src/tests/rbac-admission-e2e.test.ts +54 -0
- package/src/tests/rbac-e2e-helpers.ts +2 -0
- package/src/tests/rbac-engine.test.ts +32 -0
- package/src/tests/rbac-wire-e2e.test.ts +33 -0
- package/src/tests/reasoning-effort.test.ts +8 -0
- package/src/tests/reload-config.test.ts +33 -0
- package/src/tests/session-costs-model-key-normalize.test.ts +1 -0
- package/src/tests/slack-config.test.ts +136 -0
- package/src/tests/slack-mode-lifecycle.test.ts +69 -0
- package/src/tests/status.test.ts +22 -2
- package/src/tests/task-tool-preload-mcp.test.ts +3 -1
- package/src/tests/telemetry-init.test.ts +18 -0
- package/src/tests/workflow-llm.test.ts +3 -3
- package/src/tools/extension-common.ts +4 -0
- package/src/tools/extension-install.ts +1 -1
- package/src/tools/extension-list.ts +4 -3
- package/src/types.ts +17 -8
- package/src/utils/context-window.ts +1 -0
- package/src/utils/credentials.ts +8 -0
- package/src/utils/internal-ai/complete-structured.ts +8 -0
- package/src/utils/internal-ai/models.ts +5 -5
- package/templates/schedules/daily-status-report/content.md +25 -12
- package/templates/schedules/daily-workflow-health-audit/content.md +1 -1
- package/templates/skills/swarm-extensions/content.md +9 -5
- package/dist/cli-4wppfkcm.js +0 -16384
- package/dist/cli-55qrx3q8.js +0 -6041
- package/dist/cli-cg4vnyh4.js +0 -305
- package/dist/cli-jyetr64j.js +0 -52
- package/dist/cli-pp9ax9pa.js +0 -520
- package/dist/cli-qa66qaf0.js +0 -6076
- package/dist/cli-qghpvca2.js +0 -590
- package/dist/cli-rembwgt8.js +0 -861
- package/dist/cli-tcvj7j2r.js +0 -1971
- package/dist/cli-vfcth11k.js +0 -36
- package/dist/cli-w1d1bgkk.js +0 -1422
- package/dist/cli-y6x0gqtg.js +0 -5977
- package/dist/es5-tj3tn4jj.js +0 -844
- package/dist/index-1kq5hw2p.js +0 -467
- package/dist/index-1p8wdstt.js +0 -7
- package/dist/index-8fdjzb2f.js +0 -100
- package/dist/index-bxmwzbgw.js +0 -365
- package/dist/index-nzerxd5z.js +0 -7
- package/dist/index-pyymnzat.js +0 -1168
- package/dist/index-qv6atbab.js +0 -619
- package/dist/index-rja32qa7.js +0 -801
- package/dist/index-tzg5srfp.js +0 -211
- package/dist/index-vhncw983.js +0 -90
- package/dist/index-xk036zsk.js +0 -859
- package/dist/index-zyazbzcb.js +0 -6
- package/dist/{claude-managed-setup-48dwg9bv.js → claude-managed-setup-f5pmsyrp.js} +3 -3
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@ agent-swarm.dev is an open-source operating system for AI work. A lead agent del
|
|
|
19
19
|
- Workers in isolated Docker containers with development environments
|
|
20
20
|
- Memory and identity that persist across sessions
|
|
21
21
|
- Workflows, schedules, scripts, and apps for recurring work
|
|
22
|
-
- [Extensions](https://docs.agent-swarm.dev/docs/guides/extensions) for trusted TypeScript hooks, installed as drafts and activated by a trusted lead or
|
|
22
|
+
- [Extensions](https://docs.agent-swarm.dev/docs/guides/extensions) for trusted TypeScript hooks, installed as agent-owned inert drafts and activated by a trusted lead, operator, or dashboard user
|
|
23
23
|
- [Realtime rooms](./runbooks/realtime-rooms.md) for shared page state, presence, and live channels
|
|
24
24
|
- Your choice of harness and models: Claude Code, Codex, pi, opencode, Devin, or ACP agents
|
|
25
25
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
fetchInstalledMcpServers
|
|
3
|
-
} from "./cli-tng3131n.js";
|
|
4
1
|
import {
|
|
5
2
|
getAcpTargetCatalogEntry,
|
|
6
3
|
isAcpTarget
|
|
7
4
|
} from "./cli-dgnj0zcc.js";
|
|
5
|
+
import {
|
|
6
|
+
fetchInstalledMcpServers
|
|
7
|
+
} from "./cli-tng3131n.js";
|
|
8
8
|
import"./cli-dpvkp2et.js";
|
|
9
9
|
import {
|
|
10
10
|
detachedProcessGroup,
|
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
import {
|
|
30
30
|
init_package,
|
|
31
31
|
package_default
|
|
32
|
-
} from "./cli-
|
|
32
|
+
} from "./cli-ybpp1srm.js";
|
|
33
33
|
import {
|
|
34
34
|
init_secret_scrubber,
|
|
35
35
|
scrubSecrets
|
|
@@ -1,26 +1,31 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resolveSlackUserId
|
|
3
|
-
} from "./cli-
|
|
3
|
+
} from "./cli-eazstkad.js";
|
|
4
4
|
import {
|
|
5
5
|
createTaskWithSiblingAwareness
|
|
6
|
-
} from "./cli-
|
|
6
|
+
} from "./cli-qrqhc31j.js";
|
|
7
7
|
import"./cli-0z2v4nhw.js";
|
|
8
|
-
import"./cli-
|
|
8
|
+
import"./cli-7g9s78jf.js";
|
|
9
9
|
import"./cli-e7d20cty.js";
|
|
10
10
|
import"./cli-re8z5p8p.js";
|
|
11
11
|
import"./cli-3dpj7atn.js";
|
|
12
|
-
import"./cli-
|
|
13
|
-
import"./cli-
|
|
14
|
-
import"./cli-
|
|
15
|
-
import"./cli-
|
|
12
|
+
import"./cli-d6hk10xx.js";
|
|
13
|
+
import"./cli-vw03hg5t.js";
|
|
14
|
+
import"./cli-tdh4hjr2.js";
|
|
15
|
+
import"./cli-83wkg402.js";
|
|
16
|
+
import"./cli-ytxs7mn1.js";
|
|
17
|
+
import"./cli-6ks9xf1n.js";
|
|
16
18
|
import"./cli-epan13p1.js";
|
|
17
19
|
import"./cli-y89t4nca.js";
|
|
18
20
|
import"./cli-f14fvzag.js";
|
|
19
|
-
import"./cli-
|
|
20
|
-
import"./cli-56h18ng2.js";
|
|
21
|
-
import"./cli-2nnd56zt.js";
|
|
21
|
+
import"./cli-r8tdds6s.js";
|
|
22
22
|
import"./cli-bsakbbkm.js";
|
|
23
|
-
import"./cli-
|
|
23
|
+
import"./cli-fad8m16k.js";
|
|
24
|
+
import"./cli-jsp14b6c.js";
|
|
25
|
+
import"./cli-ysc1kbet.js";
|
|
26
|
+
import"./cli-7pnz2v6s.js";
|
|
27
|
+
import"./cli-0d9nbqxf.js";
|
|
28
|
+
import"./cli-aehm1rbq.js";
|
|
24
29
|
import"./cli-51tf7ac3.js";
|
|
25
30
|
import {
|
|
26
31
|
buildCancelledBlocks,
|
|
@@ -29,14 +34,11 @@ import {
|
|
|
29
34
|
getAgentEmoji,
|
|
30
35
|
getTaskLink,
|
|
31
36
|
isSlackRenderV2Enabled
|
|
32
|
-
} from "./cli-
|
|
37
|
+
} from "./cli-n0q9b7j4.js";
|
|
33
38
|
import"./cli-q51yprfq.js";
|
|
39
|
+
import"./cli-3er6gcsn.js";
|
|
34
40
|
import"./cli-yatxqynm.js";
|
|
35
|
-
import"./cli-jew3jda5.js";
|
|
36
|
-
import"./cli-fm4ytsdk.js";
|
|
37
|
-
import"./cli-aehm1rbq.js";
|
|
38
41
|
import"./cli-2658f6at.js";
|
|
39
|
-
import"./cli-jsp14b6c.js";
|
|
40
42
|
import {
|
|
41
43
|
cancelTask,
|
|
42
44
|
getAgentById,
|
|
@@ -45,25 +47,27 @@ import {
|
|
|
45
47
|
init_context_key,
|
|
46
48
|
init_db,
|
|
47
49
|
slackContextKey
|
|
48
|
-
} from "./cli-
|
|
49
|
-
import"./cli-
|
|
50
|
+
} from "./cli-djvxhnc4.js";
|
|
51
|
+
import"./cli-zcsyfw2z.js";
|
|
52
|
+
import"./cli-b2g6mzjc.js";
|
|
50
53
|
import"./cli-z61ykvam.js";
|
|
54
|
+
import"./cli-v4en75c5.js";
|
|
51
55
|
import"./cli-dv6cdjs2.js";
|
|
52
|
-
import"./cli-
|
|
56
|
+
import"./cli-n7h1kqpf.js";
|
|
53
57
|
import"./cli-ej6gbxfb.js";
|
|
54
58
|
import"./cli-sd0mxa3c.js";
|
|
55
59
|
import"./cli-w5e1d1vv.js";
|
|
56
|
-
import"./cli-
|
|
60
|
+
import"./cli-ybpp1srm.js";
|
|
57
61
|
import"./cli-r2ap2czm.js";
|
|
58
|
-
import"./cli-
|
|
59
|
-
import"./cli-f7kvq46p.js";
|
|
60
|
-
import"./cli-zf8jjwex.js";
|
|
61
|
-
import"./cli-c4eeb5q2.js";
|
|
62
|
-
import"./cli-rgvp6r2x.js";
|
|
62
|
+
import"./cli-5b6b62tz.js";
|
|
63
63
|
import"./cli-btbzvq95.js";
|
|
64
64
|
import"./cli-1m2e086m.js";
|
|
65
|
-
import"./cli-
|
|
65
|
+
import"./cli-mcnhgnn1.js";
|
|
66
|
+
import"./cli-bzr0ftht.js";
|
|
66
67
|
import"./cli-bd957dgb.js";
|
|
68
|
+
import"./cli-pzxba7gw.js";
|
|
69
|
+
import"./cli-f7kvq46p.js";
|
|
70
|
+
import"./cli-zf8jjwex.js";
|
|
67
71
|
import"./cli-bc05qbss.js";
|
|
68
72
|
|
|
69
73
|
// src/slack/actions.ts
|
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
splitDeferredTools
|
|
3
|
-
} from "./cli-vfcth11k.js";
|
|
4
1
|
import {
|
|
5
2
|
buildCopilotDynamicHeaders,
|
|
6
3
|
hasCopilotVisionInput
|
|
7
4
|
} from "./cli-67bad0ze.js";
|
|
8
|
-
import {
|
|
9
|
-
Anthropic
|
|
10
|
-
} from "./cli-9xvdm3bx.js";
|
|
11
5
|
import {
|
|
12
6
|
retryProviderRequest
|
|
13
7
|
} from "./cli-s8s499xy.js";
|
|
14
8
|
import {
|
|
15
9
|
getPiUserAgent
|
|
16
10
|
} from "./cli-et1bbwqf.js";
|
|
11
|
+
import {
|
|
12
|
+
Anthropic
|
|
13
|
+
} from "./cli-h60qfasa.js";
|
|
17
14
|
import"./cli-51tf7ac3.js";
|
|
18
15
|
import {
|
|
19
16
|
adjustMaxTokensForThinking,
|
|
@@ -22,16 +19,13 @@ import {
|
|
|
22
19
|
getJsonSchemaToolParameters,
|
|
23
20
|
resolveJsonSchemaStrictSampling,
|
|
24
21
|
transformMessages
|
|
25
|
-
} from "./cli-
|
|
22
|
+
} from "./cli-k0g1sjzm.js";
|
|
26
23
|
import {
|
|
27
24
|
sanitizeSurrogates
|
|
28
25
|
} from "./cli-y2apkfe2.js";
|
|
29
26
|
import {
|
|
30
27
|
headersToRecord
|
|
31
28
|
} from "./cli-vapyk8sw.js";
|
|
32
|
-
import {
|
|
33
|
-
calculateCost
|
|
34
|
-
} from "./cli-rgvp6r2x.js";
|
|
35
29
|
import {
|
|
36
30
|
getProviderEnvValue
|
|
37
31
|
} from "./cli-btbzvq95.js";
|
|
@@ -39,10 +33,20 @@ import {
|
|
|
39
33
|
parseJsonWithRepair,
|
|
40
34
|
parseStreamingJson
|
|
41
35
|
} from "./cli-1m2e086m.js";
|
|
36
|
+
import {
|
|
37
|
+
calculateCost,
|
|
38
|
+
getCurrentTools,
|
|
39
|
+
getDeclaredTools,
|
|
40
|
+
getInitialSystemMessage,
|
|
41
|
+
getSystemMessageText,
|
|
42
|
+
hasToolRedefinitions,
|
|
43
|
+
renderSystemMessageUpdate,
|
|
44
|
+
resolveTranscript
|
|
45
|
+
} from "./cli-mcnhgnn1.js";
|
|
42
46
|
import {
|
|
43
47
|
AssistantMessageEventStream,
|
|
44
48
|
appendAssistantMessageDiagnostic
|
|
45
|
-
} from "./cli-
|
|
49
|
+
} from "./cli-bzr0ftht.js";
|
|
46
50
|
import"./cli-bc05qbss.js";
|
|
47
51
|
|
|
48
52
|
// node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js
|
|
@@ -66,7 +70,7 @@ function getCacheControl(model, cacheRetention, env) {
|
|
|
66
70
|
cacheControl: { type: "ephemeral", ...ttl && { ttl } }
|
|
67
71
|
};
|
|
68
72
|
}
|
|
69
|
-
var claudeCodeVersion = "2.1.
|
|
73
|
+
var claudeCodeVersion = "2.1.280";
|
|
70
74
|
var claudeCodeTools = [
|
|
71
75
|
"Read",
|
|
72
76
|
"Write",
|
|
@@ -133,31 +137,31 @@ var INTERLEAVED_THINKING_BETA = "interleaved-thinking-2025-05-14";
|
|
|
133
137
|
var SERVER_SIDE_FALLBACK_BETA = "server-side-fallback-2026-07-01";
|
|
134
138
|
var MID_CONVERSATION_OUTPUT_CONFIG_BETA = "mid-conversation-output-config-2026-07-01";
|
|
135
139
|
var THINKING_BINDING_CONTROLS_BETA = "thinking-binding-controls-2026-08-01";
|
|
140
|
+
var MID_CONVERSATION_TOOL_CHANGES_BETA = "mid-conversation-tool-changes-2026-07-01";
|
|
141
|
+
var DEFERRED_TOOL_PLACEHOLDER = {
|
|
142
|
+
name: "__pi_deferred_placeholder__",
|
|
143
|
+
description: "Reserved placeholder. Never available. Never call this.",
|
|
144
|
+
input_schema: { type: "object", properties: {}, required: [] },
|
|
145
|
+
defer_loading: true
|
|
146
|
+
};
|
|
136
147
|
function shouldUseServerSideFallbackBeta(model) {
|
|
137
148
|
return (model.compat?.allowedFallbackModels?.length ?? 0) > 0;
|
|
138
149
|
}
|
|
139
150
|
function getAnthropicCompat(model) {
|
|
151
|
+
const isOpenRouter = model.provider === "openrouter" || model.baseUrl.includes("openrouter.ai");
|
|
140
152
|
return {
|
|
141
153
|
supportsEagerToolInputStreaming: model.compat?.supportsEagerToolInputStreaming ?? true,
|
|
142
154
|
supportsLongCacheRetention: model.compat?.supportsLongCacheRetention ?? true,
|
|
143
|
-
sendSessionAffinityHeaders: model.compat?.sendSessionAffinityHeaders ??
|
|
155
|
+
sendSessionAffinityHeaders: model.compat?.sendSessionAffinityHeaders ?? isOpenRouter,
|
|
156
|
+
sessionAffinityFormat: model.compat?.sessionAffinityFormat ?? (isOpenRouter ? "openrouter" : undefined),
|
|
144
157
|
supportsCacheControlOnTools: model.compat?.supportsCacheControlOnTools ?? true,
|
|
145
158
|
supportsTemperature: model.compat?.supportsTemperature ?? true,
|
|
146
159
|
allowEmptySignature: model.compat?.allowEmptySignature ?? false,
|
|
147
160
|
supportsStrictTools: model.compat?.supportsStrictTools ?? false,
|
|
148
|
-
|
|
161
|
+
supportsMidConvoSystemMessages: model.compat?.supportsMidConvoSystemMessages ?? false,
|
|
162
|
+
supportsMidConvoToolChanges: model.compat?.supportsMidConvoToolChanges ?? false
|
|
149
163
|
};
|
|
150
164
|
}
|
|
151
|
-
function defaultSupportsToolReferences(model) {
|
|
152
|
-
if (model.provider !== "anthropic" || model.id.includes("haiku"))
|
|
153
|
-
return false;
|
|
154
|
-
const version = model.id.match(/^claude-(?:opus|sonnet|fable)-(\d+)(?:-(\d+))?(?:-|$)/);
|
|
155
|
-
if (!version)
|
|
156
|
-
return false;
|
|
157
|
-
const major = Number(version[1]);
|
|
158
|
-
const minor = version[2] && version[2].length < 8 ? Number(version[2]) : 0;
|
|
159
|
-
return major > 4 || major === 4 && minor >= 5;
|
|
160
|
-
}
|
|
161
165
|
function mergeHeaders(...headerSources) {
|
|
162
166
|
const merged = {};
|
|
163
167
|
for (const headers of headerSources) {
|
|
@@ -340,6 +344,8 @@ async function* iterateAnthropicEvents(response, signal) {
|
|
|
340
344
|
}
|
|
341
345
|
var stream = (model, context, options) => {
|
|
342
346
|
const stream2 = new AssistantMessageEventStream;
|
|
347
|
+
const normalizedContext = resolveTranscript(context, getAnthropicCompat(model).supportsMidConvoSystemMessages);
|
|
348
|
+
const currentTools = getCurrentTools(normalizedContext.messages);
|
|
343
349
|
(async () => {
|
|
344
350
|
const providerThinkingLevel = model.compat?.supportsMidConvoEffort ? options?.effort ?? "high" : undefined;
|
|
345
351
|
const output = {
|
|
@@ -373,9 +379,9 @@ var stream = (model, context, options) => {
|
|
|
373
379
|
assertRequestAuth(model.provider, apiKey, options?.headers);
|
|
374
380
|
let copilotDynamicHeaders;
|
|
375
381
|
if (model.provider === "github-copilot") {
|
|
376
|
-
const hasImages = hasCopilotVisionInput(
|
|
382
|
+
const hasImages = hasCopilotVisionInput(normalizedContext.messages);
|
|
377
383
|
copilotDynamicHeaders = buildCopilotDynamicHeaders({
|
|
378
|
-
messages:
|
|
384
|
+
messages: normalizedContext.messages,
|
|
379
385
|
hasImages
|
|
380
386
|
});
|
|
381
387
|
}
|
|
@@ -385,7 +391,7 @@ var stream = (model, context, options) => {
|
|
|
385
391
|
client = created.client;
|
|
386
392
|
isOAuth = created.isOAuthToken;
|
|
387
393
|
}
|
|
388
|
-
let params = buildParams(model,
|
|
394
|
+
let params = buildParams(model, normalizedContext, isOAuth, options);
|
|
389
395
|
const nextParams = await options?.onPayload?.(params, model);
|
|
390
396
|
if (nextParams !== undefined) {
|
|
391
397
|
params = { ...nextParams, stream: true };
|
|
@@ -409,9 +415,11 @@ var stream = (model, context, options) => {
|
|
|
409
415
|
const transformations = event.message.input_transformations;
|
|
410
416
|
if (Array.isArray(transformations))
|
|
411
417
|
inputTransformations = transformations;
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
418
|
+
const responseModel = event.message.model;
|
|
419
|
+
if (responseModel !== model.id)
|
|
420
|
+
output.responseModel = responseModel;
|
|
421
|
+
const fallbackCost = responseModel === model.id ? undefined : model.compat?.allowedFallbackModels?.find((fallback) => fallback.provider === model.provider && fallback.model === responseModel)?.cost;
|
|
422
|
+
usageModel = fallbackCost ? { ...model, id: responseModel, cost: fallbackCost } : model;
|
|
415
423
|
output.usage.input = event.message.usage.input_tokens || 0;
|
|
416
424
|
output.usage.output = event.message.usage.output_tokens || 0;
|
|
417
425
|
output.usage.cacheRead = event.message.usage.cache_read_input_tokens || 0;
|
|
@@ -457,7 +465,7 @@ var stream = (model, context, options) => {
|
|
|
457
465
|
const block = {
|
|
458
466
|
type: "toolCall",
|
|
459
467
|
id: event.content_block.id,
|
|
460
|
-
name: isOAuth ? fromClaudeCodeName(event.content_block.name,
|
|
468
|
+
name: isOAuth ? fromClaudeCodeName(event.content_block.name, currentTools) : event.content_block.name,
|
|
461
469
|
arguments: event.content_block.input ?? {},
|
|
462
470
|
partialJson: "",
|
|
463
471
|
index: event.index
|
|
@@ -691,7 +699,12 @@ function createClient(model, apiKey, optionsHeaders, fetch, dynamicHeaders, sess
|
|
|
691
699
|
});
|
|
692
700
|
return { client: client2, isOAuthToken: true };
|
|
693
701
|
}
|
|
694
|
-
const
|
|
702
|
+
const compat = getAnthropicCompat(model);
|
|
703
|
+
const sessionAffinityHeaders = {};
|
|
704
|
+
if (sessionId && compat.sendSessionAffinityHeaders) {
|
|
705
|
+
const header = compat.sessionAffinityFormat === "openrouter" ? "x-session-id" : "x-session-affinity";
|
|
706
|
+
sessionAffinityHeaders[header] = sessionId;
|
|
707
|
+
}
|
|
695
708
|
const defaultHeaders = mergeClientHeaders({
|
|
696
709
|
accept: "application/json",
|
|
697
710
|
"anthropic-dangerous-direct-browser-access": "true"
|
|
@@ -706,7 +719,7 @@ function createClient(model, apiKey, optionsHeaders, fetch, dynamicHeaders, sess
|
|
|
706
719
|
});
|
|
707
720
|
return { client, isOAuthToken: false };
|
|
708
721
|
}
|
|
709
|
-
function getBetaFeatures(model, context, isOAuthToken2, options) {
|
|
722
|
+
function getBetaFeatures(model, context, isOAuthToken2, nativeToolChanges, options) {
|
|
710
723
|
let configuredFeatures;
|
|
711
724
|
for (const headers of [model.headers, options?.headers]) {
|
|
712
725
|
for (const [name, value] of Object.entries(headers ?? {})) {
|
|
@@ -734,24 +747,22 @@ function getBetaFeatures(model, context, isOAuthToken2, options) {
|
|
|
734
747
|
if (model.compat?.supportsMidConvoEffort === true) {
|
|
735
748
|
features.push(MID_CONVERSATION_OUTPUT_CONFIG_BETA, THINKING_BINDING_CONTROLS_BETA);
|
|
736
749
|
}
|
|
750
|
+
if (nativeToolChanges)
|
|
751
|
+
features.push(MID_CONVERSATION_TOOL_CHANGES_BETA);
|
|
737
752
|
return [...new Set(features)];
|
|
738
753
|
}
|
|
739
754
|
function buildParams(model, context, isOAuthToken2, options) {
|
|
740
755
|
const { cacheControl } = getCacheControl(model, options?.cacheRetention, options?.env);
|
|
741
756
|
const compat = getAnthropicCompat(model);
|
|
757
|
+
const initialSystemMessage = getInitialSystemMessage(context.messages);
|
|
758
|
+
const initialSystemText = initialSystemMessage ? getSystemMessageText(initialSystemMessage) : "";
|
|
742
759
|
const transformedMessages = transformMessages(context.messages, model, normalizeToolCallId);
|
|
743
|
-
const
|
|
744
|
-
const
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
if (immediateTools.length === 0 && deferredTools.length > 0) {
|
|
748
|
-
immediateTools = deferredTools;
|
|
749
|
-
deferredTools = [];
|
|
750
|
-
}
|
|
751
|
-
const deferredToolNames = new Set(deferredTools.map((tool) => normalizeToolName(tool.name)));
|
|
752
|
-
const converted = convertMessages(transformedMessages, isOAuthToken2, cacheControl, compat.allowEmptySignature, deferredToolNames, normalizeToolName, model.compat?.supportsMidConvoEffort === true ? model.provider : undefined);
|
|
760
|
+
const conversationMessages = initialSystemMessage ? transformedMessages.slice(1) : transformedMessages;
|
|
761
|
+
const initialTools = initialSystemMessage?.toolsAdded ?? [];
|
|
762
|
+
const nativeToolChanges = compat.supportsMidConvoSystemMessages && compat.supportsMidConvoToolChanges && initialTools.length > 0 && !hasToolRedefinitions(context.messages);
|
|
763
|
+
const converted = convertMessages(conversationMessages, isOAuthToken2, cacheControl, compat.allowEmptySignature, model.compat?.supportsMidConvoEffort === true ? model.provider : undefined, nativeToolChanges);
|
|
753
764
|
const activeEffort = options?.effort ?? "high";
|
|
754
|
-
const betaFeatures = getBetaFeatures(model, context, isOAuthToken2, options);
|
|
765
|
+
const betaFeatures = getBetaFeatures(model, context, isOAuthToken2, nativeToolChanges, options);
|
|
755
766
|
const params = {
|
|
756
767
|
model: model.id,
|
|
757
768
|
messages: model.compat?.supportsMidConvoEffort === true ? insertThinkingLevelMessages(converted, activeEffort) : converted.messages,
|
|
@@ -767,18 +778,18 @@ function buildParams(model, context, isOAuthToken2, options) {
|
|
|
767
778
|
...cacheControl ? { cache_control: cacheControl } : {}
|
|
768
779
|
}
|
|
769
780
|
];
|
|
770
|
-
if (
|
|
781
|
+
if (initialSystemText) {
|
|
771
782
|
params.system.push({
|
|
772
783
|
type: "text",
|
|
773
|
-
text: sanitizeSurrogates(
|
|
784
|
+
text: sanitizeSurrogates(initialSystemText),
|
|
774
785
|
...cacheControl ? { cache_control: cacheControl } : {}
|
|
775
786
|
});
|
|
776
787
|
}
|
|
777
|
-
} else if (
|
|
788
|
+
} else if (initialSystemText) {
|
|
778
789
|
params.system = [
|
|
779
790
|
{
|
|
780
791
|
type: "text",
|
|
781
|
-
text: sanitizeSurrogates(
|
|
792
|
+
text: sanitizeSurrogates(initialSystemText),
|
|
782
793
|
...cacheControl ? { cache_control: cacheControl } : {}
|
|
783
794
|
}
|
|
784
795
|
];
|
|
@@ -786,11 +797,20 @@ function buildParams(model, context, isOAuthToken2, options) {
|
|
|
786
797
|
if (options?.temperature !== undefined && !options?.thinkingEnabled && model.compat?.supportsMidConvoEffort !== true && compat.supportsTemperature) {
|
|
787
798
|
params.temperature = options.temperature;
|
|
788
799
|
}
|
|
789
|
-
|
|
800
|
+
const toolCacheControl = compat.supportsCacheControlOnTools ? cacheControl : undefined;
|
|
801
|
+
if (nativeToolChanges) {
|
|
802
|
+
const initialNames = new Set(initialTools.map((tool) => tool.name));
|
|
803
|
+
const laterTools = getDeclaredTools(context.messages).filter((tool) => !initialNames.has(tool.name));
|
|
790
804
|
params.tools = [
|
|
791
|
-
...convertTools(
|
|
792
|
-
|
|
805
|
+
...convertTools(initialTools, isOAuthToken2, compat.supportsEagerToolInputStreaming, compat.supportsStrictTools, toolCacheControl),
|
|
806
|
+
DEFERRED_TOOL_PLACEHOLDER,
|
|
807
|
+
...convertTools(laterTools, isOAuthToken2, compat.supportsEagerToolInputStreaming, compat.supportsStrictTools).map((tool) => ({ ...tool, defer_loading: true }))
|
|
793
808
|
];
|
|
809
|
+
} else {
|
|
810
|
+
const tools = getCurrentTools(context.messages);
|
|
811
|
+
if (tools.length > 0) {
|
|
812
|
+
params.tools = convertTools(tools, isOAuthToken2, compat.supportsEagerToolInputStreaming, compat.supportsStrictTools, toolCacheControl);
|
|
813
|
+
}
|
|
794
814
|
}
|
|
795
815
|
if (model.compat?.supportsMidConvoEffort === true) {
|
|
796
816
|
params.thinking = {
|
|
@@ -840,36 +860,46 @@ function buildParams(model, context, isOAuthToken2, options) {
|
|
|
840
860
|
function normalizeToolCallId(id) {
|
|
841
861
|
return id.replace(/[^a-zA-Z0-9_-]/g, "_").slice(0, 64);
|
|
842
862
|
}
|
|
843
|
-
function convertToolResult(msg
|
|
844
|
-
const references = [];
|
|
845
|
-
for (const name of msg.addedToolNames ?? []) {
|
|
846
|
-
const normalizedName = normalizeToolName(name);
|
|
847
|
-
if (!deferredToolNames.has(normalizedName) || loadedToolNames.has(normalizedName))
|
|
848
|
-
continue;
|
|
849
|
-
loadedToolNames.add(normalizedName);
|
|
850
|
-
references.push({
|
|
851
|
-
type: "tool_reference",
|
|
852
|
-
tool_name: isOAuthToken2 ? toClaudeCodeName(name) : name
|
|
853
|
-
});
|
|
854
|
-
}
|
|
855
|
-
const convertedContent = convertContentBlocks(msg.content);
|
|
863
|
+
function convertToolResult(msg) {
|
|
856
864
|
return {
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
is_error: msg.isError
|
|
862
|
-
},
|
|
863
|
-
siblingContent: references.length === 0 ? [] : typeof convertedContent === "string" ? [{ type: "text", text: convertedContent }] : convertedContent
|
|
865
|
+
type: "tool_result",
|
|
866
|
+
tool_use_id: msg.toolCallId,
|
|
867
|
+
content: convertContentBlocks(msg.content),
|
|
868
|
+
is_error: msg.isError
|
|
864
869
|
};
|
|
865
870
|
}
|
|
866
|
-
function convertMessages(transformedMessages, isOAuthToken2, cacheControl, allowEmptySignature = false,
|
|
871
|
+
function convertMessages(transformedMessages, isOAuthToken2, cacheControl, allowEmptySignature = false, managedProvider, nativeToolChanges = false) {
|
|
867
872
|
const params = [];
|
|
868
873
|
const assistantLevels = new Map;
|
|
869
|
-
const
|
|
874
|
+
const pendingSystemMessages = [];
|
|
875
|
+
const flushPendingSystemMessages = () => {
|
|
876
|
+
params.push(...pendingSystemMessages);
|
|
877
|
+
pendingSystemMessages.length = 0;
|
|
878
|
+
};
|
|
870
879
|
for (let i = 0;i < transformedMessages.length; i++) {
|
|
871
880
|
const msg = transformedMessages[i];
|
|
872
|
-
if (msg.role === "
|
|
881
|
+
if (msg.role === "system") {
|
|
882
|
+
const text = renderSystemMessageUpdate(msg);
|
|
883
|
+
const blocks = [];
|
|
884
|
+
if (text.length > 0)
|
|
885
|
+
blocks.push({ type: "text", text: sanitizeSurrogates(text) });
|
|
886
|
+
if (nativeToolChanges) {
|
|
887
|
+
for (const tool of msg.toolsRemoved ?? []) {
|
|
888
|
+
blocks.push({
|
|
889
|
+
type: "tool_removal",
|
|
890
|
+
tool: { type: "tool_reference", name: isOAuthToken2 ? toClaudeCodeName(tool.name) : tool.name }
|
|
891
|
+
});
|
|
892
|
+
}
|
|
893
|
+
for (const tool of msg.toolsAdded ?? []) {
|
|
894
|
+
blocks.push({
|
|
895
|
+
type: "tool_addition",
|
|
896
|
+
tool: { type: "tool_reference", name: isOAuthToken2 ? toClaudeCodeName(tool.name) : tool.name }
|
|
897
|
+
});
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
if (blocks.length > 0)
|
|
901
|
+
pendingSystemMessages.push({ role: "system", content: blocks });
|
|
902
|
+
} else if (msg.role === "user") {
|
|
873
903
|
if (typeof msg.content === "string") {
|
|
874
904
|
if (msg.content.trim().length > 0) {
|
|
875
905
|
params.push({
|
|
@@ -909,6 +939,7 @@ function convertMessages(transformedMessages, isOAuthToken2, cacheControl, allow
|
|
|
909
939
|
});
|
|
910
940
|
}
|
|
911
941
|
} else if (msg.role === "assistant") {
|
|
942
|
+
flushPendingSystemMessages();
|
|
912
943
|
const blocks = [];
|
|
913
944
|
for (const block of msg.content) {
|
|
914
945
|
if (block.type === "text") {
|
|
@@ -967,27 +998,25 @@ function convertMessages(transformedMessages, isOAuthToken2, cacheControl, allow
|
|
|
967
998
|
}
|
|
968
999
|
} else if (msg.role === "toolResult") {
|
|
969
1000
|
const toolResults = [];
|
|
970
|
-
const siblingContent = [];
|
|
971
1001
|
let j = i;
|
|
972
1002
|
while (j < transformedMessages.length && transformedMessages[j].role === "toolResult") {
|
|
973
|
-
|
|
974
|
-
toolResults.push(converted.toolResult);
|
|
975
|
-
siblingContent.push(...converted.siblingContent);
|
|
1003
|
+
toolResults.push(convertToolResult(transformedMessages[j]));
|
|
976
1004
|
j++;
|
|
977
1005
|
}
|
|
978
1006
|
i = j - 1;
|
|
979
1007
|
params.push({
|
|
980
1008
|
role: "user",
|
|
981
|
-
content:
|
|
1009
|
+
content: toolResults
|
|
982
1010
|
});
|
|
983
1011
|
}
|
|
984
1012
|
}
|
|
1013
|
+
flushPendingSystemMessages();
|
|
985
1014
|
if (cacheControl && params.length > 0) {
|
|
986
1015
|
const lastMessage = params[params.length - 1];
|
|
987
|
-
if (lastMessage.role === "user") {
|
|
1016
|
+
if (lastMessage.role === "user" || lastMessage.role === "system") {
|
|
988
1017
|
if (Array.isArray(lastMessage.content)) {
|
|
989
1018
|
const lastBlock = lastMessage.content[lastMessage.content.length - 1];
|
|
990
|
-
if (lastBlock && (lastBlock.type === "text" || lastBlock.type === "image" || lastBlock.type === "tool_result")) {
|
|
1019
|
+
if (lastBlock && (lastBlock.type === "text" || lastBlock.type === "image" || lastBlock.type === "tool_result" || lastBlock.type === "tool_addition" || lastBlock.type === "tool_removal")) {
|
|
991
1020
|
lastBlock.cache_control = cacheControl;
|
|
992
1021
|
}
|
|
993
1022
|
} else if (typeof lastMessage.content === "string") {
|
|
@@ -1019,9 +1048,9 @@ function insertThinkingLevelMessages(converted, activeEffort) {
|
|
|
1019
1048
|
return messages;
|
|
1020
1049
|
}
|
|
1021
1050
|
function shouldUseFineGrainedToolStreamingBeta(model, context) {
|
|
1022
|
-
return
|
|
1051
|
+
return getCurrentTools(context.messages).length > 0 && !getAnthropicCompat(model).supportsEagerToolInputStreaming;
|
|
1023
1052
|
}
|
|
1024
|
-
function convertTools(tools, isOAuthToken2, supportsEagerToolInputStreaming, supportsStrictTools, cacheControl
|
|
1053
|
+
function convertTools(tools, isOAuthToken2, supportsEagerToolInputStreaming, supportsStrictTools, cacheControl) {
|
|
1025
1054
|
if (!tools)
|
|
1026
1055
|
return [];
|
|
1027
1056
|
return tools.map((tool, index) => {
|
|
@@ -1043,7 +1072,6 @@ function convertTools(tools, isOAuthToken2, supportsEagerToolInputStreaming, sup
|
|
|
1043
1072
|
...supportsEagerToolInputStreaming ? { eager_input_streaming: true } : {},
|
|
1044
1073
|
...strict === true ? { strict: true } : {},
|
|
1045
1074
|
input_schema: inputSchema,
|
|
1046
|
-
...deferLoading ? { defer_loading: true } : {},
|
|
1047
1075
|
...cacheControl && index === tools.length - 1 ? { cache_control: cacheControl } : {}
|
|
1048
1076
|
};
|
|
1049
1077
|
});
|
|
@@ -3,23 +3,26 @@ import {
|
|
|
3
3
|
initSlackApp,
|
|
4
4
|
startSlackApp,
|
|
5
5
|
stopSlackApp
|
|
6
|
-
} from "./cli-
|
|
6
|
+
} from "./cli-n0q9b7j4.js";
|
|
7
7
|
import"./cli-q51yprfq.js";
|
|
8
|
+
import"./cli-3er6gcsn.js";
|
|
8
9
|
import"./cli-yatxqynm.js";
|
|
9
10
|
import"./cli-2658f6at.js";
|
|
10
|
-
import"./cli-
|
|
11
|
-
import"./cli-
|
|
11
|
+
import"./cli-djvxhnc4.js";
|
|
12
|
+
import"./cli-zcsyfw2z.js";
|
|
13
|
+
import"./cli-b2g6mzjc.js";
|
|
12
14
|
import"./cli-z61ykvam.js";
|
|
15
|
+
import"./cli-v4en75c5.js";
|
|
13
16
|
import"./cli-dv6cdjs2.js";
|
|
14
|
-
import"./cli-
|
|
17
|
+
import"./cli-n7h1kqpf.js";
|
|
15
18
|
import"./cli-ej6gbxfb.js";
|
|
16
19
|
import"./cli-sd0mxa3c.js";
|
|
17
20
|
import"./cli-w5e1d1vv.js";
|
|
18
|
-
import"./cli-
|
|
21
|
+
import"./cli-ybpp1srm.js";
|
|
19
22
|
import"./cli-r2ap2czm.js";
|
|
23
|
+
import"./cli-bd957dgb.js";
|
|
20
24
|
import"./cli-pzxba7gw.js";
|
|
21
25
|
import"./cli-zf8jjwex.js";
|
|
22
|
-
import"./cli-bd957dgb.js";
|
|
23
26
|
import"./cli-bc05qbss.js";
|
|
24
27
|
export {
|
|
25
28
|
getSlackApp,
|