agor-live 0.21.2 → 0.22.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/cli/commands/branch/env/restart.js +1 -1
- package/dist/cli/commands/branch/env/start.js +1 -1
- package/dist/cli/commands/branch/env/stop.js +1 -1
- package/dist/core/api/index.cjs +5 -1
- package/dist/core/api/index.d.ts +6 -1
- package/dist/core/api/index.d.ts.map +1 -1
- package/dist/core/api/index.js +5 -1
- package/dist/core/claude/index.cjs +162 -14
- package/dist/core/claude/index.js +166 -18
- package/dist/core/client/index.cjs +43 -3
- package/dist/core/client/index.js +37 -3
- package/dist/core/config/browser.cjs +2 -2
- package/dist/core/config/browser.js +2 -2
- package/dist/core/config/config-manager.d.ts.map +1 -1
- package/dist/core/config/constants.d.ts +1 -1
- package/dist/core/config/index.cjs +174 -20
- package/dist/core/config/index.js +178 -24
- package/dist/core/config/types.d.ts +8 -0
- package/dist/core/config/types.d.ts.map +1 -1
- package/dist/core/db/index.cjs +495 -86
- package/dist/core/db/index.js +482 -75
- package/dist/core/db/repositories/artifacts.d.ts.map +1 -1
- package/dist/core/db/repositories/branches.d.ts +13 -1
- package/dist/core/db/repositories/branches.d.ts.map +1 -1
- package/dist/core/db/repositories/gateway-channels.d.ts.map +1 -1
- package/dist/core/db/repositories/index.d.ts +1 -0
- package/dist/core/db/repositories/index.d.ts.map +1 -1
- package/dist/core/db/repositories/session-relationships.d.ts +30 -0
- package/dist/core/db/repositories/session-relationships.d.ts.map +1 -0
- package/dist/core/db/repositories/users.d.ts +11 -0
- package/dist/core/db/repositories/users.d.ts.map +1 -1
- package/dist/core/db/schema.d.ts +421 -4
- package/dist/core/db/schema.d.ts.map +1 -1
- package/dist/core/db/schema.postgres.d.ts +226 -2
- package/dist/core/db/schema.postgres.d.ts.map +1 -1
- package/dist/core/db/schema.sqlite.d.ts +228 -2
- package/dist/core/db/schema.sqlite.d.ts.map +1 -1
- package/dist/core/drizzle/postgres/0050_artifact_source_session.sql +3 -0
- package/dist/core/drizzle/postgres/0051_session_relationships.sql +26 -0
- package/dist/core/drizzle/postgres/meta/_journal.json +14 -0
- package/dist/core/drizzle/sqlite/0059_artifact_source_session.sql +2 -0
- package/dist/core/drizzle/sqlite/0060_session_relationships.sql +23 -0
- package/dist/core/drizzle/sqlite/meta/_journal.json +14 -0
- package/dist/core/gateway/connector-registry.d.ts.map +1 -1
- package/dist/core/gateway/connector.d.ts +22 -0
- package/dist/core/gateway/connector.d.ts.map +1 -1
- package/dist/core/gateway/connectors/slack.d.ts +35 -3
- package/dist/core/gateway/connectors/slack.d.ts.map +1 -1
- package/dist/core/gateway/connectors/teams.d.ts +107 -0
- package/dist/core/gateway/connectors/teams.d.ts.map +1 -0
- package/dist/core/gateway/context.d.ts.map +1 -1
- package/dist/core/gateway/index.cjs +552 -52
- package/dist/core/gateway/index.d.ts +3 -2
- package/dist/core/gateway/index.d.ts.map +1 -1
- package/dist/core/gateway/index.js +544 -52
- package/dist/core/gateway/system-message.d.ts +21 -0
- package/dist/core/gateway/system-message.d.ts.map +1 -1
- package/dist/core/index.cjs +616 -127
- package/dist/core/index.js +597 -116
- package/dist/core/mcp/index.cjs +146 -9
- package/dist/core/mcp/index.js +146 -9
- package/dist/core/mcp/template-resolver.d.ts.map +1 -1
- package/dist/core/seed/index.cjs +375 -59
- package/dist/core/seed/index.js +378 -62
- package/dist/core/sessions/index.cjs +19 -0
- package/dist/core/sessions/index.js +19 -0
- package/dist/core/templates/agor-system-prompt.md +21 -53
- package/dist/core/templates/session-context.cjs +2 -73
- package/dist/core/templates/session-context.d.ts +9 -53
- package/dist/core/templates/session-context.d.ts.map +1 -1
- package/dist/core/templates/session-context.js +2 -72
- package/dist/core/tools/mcp/jwt-auth.cjs +2 -20
- package/dist/core/tools/mcp/jwt-auth.d.ts.map +1 -1
- package/dist/core/tools/mcp/jwt-auth.js +2 -20
- package/dist/core/tools/mcp/oauth-mcp-transport.cjs +2 -15
- package/dist/core/tools/mcp/oauth-mcp-transport.d.ts.map +1 -1
- package/dist/core/tools/mcp/oauth-mcp-transport.js +2 -15
- package/dist/core/tools/mcp/oauth-refresh.cjs +167 -19
- package/dist/core/tools/mcp/oauth-refresh.js +167 -19
- package/dist/core/types/artifact.d.ts +5 -1
- package/dist/core/types/artifact.d.ts.map +1 -1
- package/dist/core/types/branch.d.ts +14 -0
- package/dist/core/types/branch.d.ts.map +1 -1
- package/dist/core/types/gateway.d.ts +1 -1
- package/dist/core/types/gateway.d.ts.map +1 -1
- package/dist/core/types/id.d.ts +1 -0
- package/dist/core/types/id.d.ts.map +1 -1
- package/dist/core/types/index.cjs +36 -0
- package/dist/core/types/index.js +30 -0
- package/dist/core/types/session.d.ts +65 -1
- package/dist/core/types/session.d.ts.map +1 -1
- package/dist/core/types/task.d.ts +9 -0
- package/dist/core/types/task.d.ts.map +1 -1
- package/dist/core/unix/index.cjs +371 -55
- package/dist/core/unix/index.js +374 -58
- package/dist/core/unix/unix-integration-service.d.ts +10 -7
- package/dist/core/unix/unix-integration-service.d.ts.map +1 -1
- package/dist/core/utils/permission-mode-mapper.cjs +19 -0
- package/dist/core/utils/permission-mode-mapper.js +19 -0
- package/dist/daemon/declarations.d.ts +7 -0
- package/dist/daemon/declarations.d.ts.map +1 -1
- package/dist/daemon/hooks/gateway-route.d.ts.map +1 -1
- package/dist/daemon/hooks/gateway-route.js +53 -1
- package/dist/daemon/index.js +3760 -2107
- package/dist/daemon/main.js +3760 -2107
- package/dist/daemon/mcp/server.js +155 -17
- package/dist/daemon/mcp/tools/analytics.js +6 -7
- package/dist/daemon/mcp/tools/artifacts.d.ts.map +1 -1
- package/dist/daemon/mcp/tools/artifacts.js +7 -7
- package/dist/daemon/mcp/tools/boards.js +6 -7
- package/dist/daemon/mcp/tools/branches.js +6 -7
- package/dist/daemon/mcp/tools/card-types.js +6 -7
- package/dist/daemon/mcp/tools/cards.js +6 -7
- package/dist/daemon/mcp/tools/environment.d.ts.map +1 -1
- package/dist/daemon/mcp/tools/environment.js +19 -12
- package/dist/daemon/mcp/tools/knowledge.js +6 -7
- package/dist/daemon/mcp/tools/mcp-servers.js +6 -7
- package/dist/daemon/mcp/tools/messages.js +6 -7
- package/dist/daemon/mcp/tools/proxies.js +6 -7
- package/dist/daemon/mcp/tools/repos.js +6 -7
- package/dist/daemon/mcp/tools/schedules.js +6 -7
- package/dist/daemon/mcp/tools/search.js +6 -7
- package/dist/daemon/mcp/tools/sessions.d.ts.map +1 -1
- package/dist/daemon/mcp/tools/sessions.js +140 -11
- package/dist/daemon/mcp/tools/tasks.js +6 -7
- package/dist/daemon/mcp/tools/users.js +6 -7
- package/dist/daemon/mcp/tools/widgets.js +7 -8
- package/dist/daemon/register-hooks.d.ts +5 -1
- package/dist/daemon/register-hooks.d.ts.map +1 -1
- package/dist/daemon/register-hooks.js +404 -179
- package/dist/daemon/register-routes.d.ts.map +1 -1
- package/dist/daemon/register-routes.js +360 -162
- package/dist/daemon/register-services.d.ts.map +1 -1
- package/dist/daemon/register-services.js +1928 -671
- package/dist/daemon/services/artifacts.d.ts +10 -1
- package/dist/daemon/services/artifacts.d.ts.map +1 -1
- package/dist/daemon/services/artifacts.js +25 -1
- package/dist/daemon/services/branches.d.ts +11 -1
- package/dist/daemon/services/branches.d.ts.map +1 -1
- package/dist/daemon/services/branches.js +470 -184
- package/dist/daemon/services/claude-models.js +879 -339
- package/dist/daemon/services/gateway.d.ts +58 -2
- package/dist/daemon/services/gateway.d.ts.map +1 -1
- package/dist/daemon/services/gateway.js +590 -47
- package/dist/daemon/services/groups.d.ts +2 -0
- package/dist/daemon/services/groups.d.ts.map +1 -1
- package/dist/daemon/services/groups.js +56 -0
- package/dist/daemon/services/mcp-servers.d.ts.map +1 -1
- package/dist/daemon/services/mcp-servers.js +0 -6
- package/dist/daemon/services/scheduler.d.ts.map +1 -1
- package/dist/daemon/services/scheduler.js +6 -2
- package/dist/daemon/services/sessions.d.ts +11 -3
- package/dist/daemon/services/sessions.d.ts.map +1 -1
- package/dist/daemon/services/sessions.js +68 -7
- package/dist/daemon/services/tasks.d.ts +13 -2
- package/dist/daemon/services/tasks.d.ts.map +1 -1
- package/dist/daemon/services/tasks.js +42 -26
- package/dist/daemon/startup.js +6 -2
- package/dist/daemon/utils/session-stop.d.ts +43 -0
- package/dist/daemon/utils/session-stop.d.ts.map +1 -0
- package/dist/daemon/utils/session-stop.js +102 -0
- package/dist/daemon/utils/session-task-state.d.ts +7 -2
- package/dist/daemon/utils/session-task-state.d.ts.map +1 -1
- package/dist/daemon/utils/session-task-state.js +9 -3
- package/dist/daemon/utils/session-tasks.d.ts +4 -4
- package/dist/daemon/utils/session-tasks.d.ts.map +1 -1
- package/dist/daemon/utils/session-tasks.js +4 -8
- package/dist/executor/commands/environment.d.ts +13 -0
- package/dist/executor/commands/environment.d.ts.map +1 -0
- package/dist/executor/commands/environment.js +287 -0
- package/dist/executor/commands/index.d.ts.map +1 -1
- package/dist/executor/commands/index.js +5 -1
- package/dist/executor/commands/unix.d.ts +8 -1
- package/dist/executor/commands/unix.d.ts.map +1 -1
- package/dist/executor/commands/unix.js +157 -2
- package/dist/executor/payload-types.d.ts +201 -5
- package/dist/executor/payload-types.d.ts.map +1 -1
- package/dist/executor/payload-types.js +98 -0
- package/dist/executor/sdk-handlers/base/mcp-scoping.d.ts.map +1 -1
- package/dist/executor/sdk-handlers/base/mcp-scoping.js +14 -0
- package/dist/executor/sdk-handlers/claude/message-processor.d.ts.map +1 -1
- package/dist/executor/sdk-handlers/claude/message-processor.js +0 -1
- package/dist/executor/sdk-handlers/claude/query-builder.d.ts +1 -0
- package/dist/executor/sdk-handlers/claude/query-builder.d.ts.map +1 -1
- package/dist/executor/sdk-handlers/claude/query-builder.js +91 -39
- package/dist/executor/sdk-handlers/codex/prompt-service.d.ts +12 -5
- package/dist/executor/sdk-handlers/codex/prompt-service.d.ts.map +1 -1
- package/dist/executor/sdk-handlers/codex/prompt-service.js +72 -30
- package/dist/executor/sdk-handlers/copilot/prompt-service.d.ts +2 -4
- package/dist/executor/sdk-handlers/copilot/prompt-service.d.ts.map +1 -1
- package/dist/executor/sdk-handlers/copilot/prompt-service.js +4 -13
- package/dist/executor/sdk-handlers/gemini/prompt-service.d.ts +2 -4
- package/dist/executor/sdk-handlers/gemini/prompt-service.d.ts.map +1 -1
- package/dist/executor/sdk-handlers/gemini/prompt-service.js +4 -13
- package/dist/ui/assets/App-DcEY8Ota.js +3 -0
- package/dist/ui/assets/App-DcEY8Ota.js.gz +0 -0
- package/dist/ui/assets/{ArtifactConsentModal-ParNk5kW.js → ArtifactConsentModal-CiCbK9iv.js} +1 -1
- package/dist/ui/assets/ArtifactConsentModal-CiCbK9iv.js.gz +0 -0
- package/dist/ui/assets/ArtifactFullscreenPage-CfsTEGKd.js +9 -0
- package/dist/ui/assets/ArtifactFullscreenPage-CfsTEGKd.js.gz +0 -0
- package/dist/ui/assets/AutocompleteTextarea-BAFFH_5e.js +18 -0
- package/dist/ui/assets/AutocompleteTextarea-BAFFH_5e.js.gz +0 -0
- package/dist/ui/assets/BoardObjectNodes-D-O6bZIG.js +34 -0
- package/dist/ui/assets/BoardObjectNodes-D-O6bZIG.js.gz +0 -0
- package/dist/ui/assets/{CodeEditor.inner-D51Z_CLQ.js → CodeEditor.inner-DBgsP4tn.js} +2 -2
- package/dist/ui/assets/CodeEditor.inner-DBgsP4tn.js.gz +0 -0
- package/dist/ui/assets/ConversationView-CUWR0gR6.js +1 -0
- package/dist/ui/assets/ConversationView-CUWR0gR6.js.gz +0 -0
- package/dist/ui/assets/KnowledgePage-B2bzlXfn.js +24 -0
- package/dist/ui/assets/KnowledgePage-B2bzlXfn.js.gz +0 -0
- package/dist/ui/assets/MarketingScreenshotPage-9Qd7eZsm.css +1 -0
- package/dist/ui/assets/MarketingScreenshotPage-zv5RUCuV.js +143 -0
- package/dist/ui/assets/MarketingScreenshotPage-zv5RUCuV.js.gz +0 -0
- package/dist/ui/assets/MobileApp-VgVnsnsN.js +1 -0
- package/dist/ui/assets/MobileApp-VgVnsnsN.js.gz +0 -0
- package/dist/ui/assets/SessionCanvas-f1-1Gbcw.js +20 -0
- package/dist/ui/assets/SessionCanvas-f1-1Gbcw.js.gz +0 -0
- package/dist/ui/assets/{App-BAdBsEnV.css → SessionCanvas-mEmYGZhC.css} +1 -1
- package/dist/ui/assets/SessionCanvas-mEmYGZhC.css.gz +0 -0
- package/dist/ui/assets/{StreamdownDemoPage-B9wbgp2s.js → StreamdownDemoPage-wzWaqWwr.js} +1 -1
- package/dist/ui/assets/StreamdownDemoPage-wzWaqWwr.js.gz +0 -0
- package/dist/ui/assets/{ThemeSwitcher-ubn6IOz9.js → ThemeSwitcher-Dly2y9pi.js} +1 -1
- package/dist/ui/assets/ThemeSwitcher-Dly2y9pi.js.gz +0 -0
- package/dist/ui/assets/antd-CfbbHJOz.js +401 -0
- package/dist/ui/assets/antd-CfbbHJOz.js.gz +0 -0
- package/dist/ui/assets/architecture-U656AL7Q-CykGFbQU.js +1 -0
- package/dist/ui/assets/{architectureDiagram-VXUJARFQ-ChmZt3zk.js → architectureDiagram-VXUJARFQ-C8HXAenz.js} +1 -1
- package/dist/ui/assets/architectureDiagram-VXUJARFQ-C8HXAenz.js.gz +0 -0
- package/dist/ui/assets/{blockDiagram-VD42YOAC-CzGHAHao.js → blockDiagram-VD42YOAC-BhZaEN19.js} +1 -1
- package/dist/ui/assets/blockDiagram-VD42YOAC-BhZaEN19.js.gz +0 -0
- package/dist/ui/assets/{c4Diagram-YG6GDRKO-DscJyaWN.js → c4Diagram-YG6GDRKO-Dk_UH-sY.js} +1 -1
- package/dist/ui/assets/c4Diagram-YG6GDRKO-Dk_UH-sY.js.gz +0 -0
- package/dist/ui/assets/channel-D6_nUWlW.js +1 -0
- package/dist/ui/assets/{chunk-4BX2VUAB-DoWpTvP8.js → chunk-4BX2VUAB-XprbG2TG.js} +1 -1
- package/dist/ui/assets/chunk-55IACEB6-ByzqIgSb.js +1 -0
- package/dist/ui/assets/{chunk-ABZYJK2D-RzDCrjE6.js → chunk-ABZYJK2D-BJcrryHK.js} +1 -1
- package/dist/ui/assets/chunk-ABZYJK2D-BJcrryHK.js.gz +0 -0
- package/dist/ui/assets/{chunk-AGHRB4JF-jidCS5Of.js → chunk-AGHRB4JF-DvxmfbM0.js} +1 -1
- package/dist/ui/assets/chunk-AGHRB4JF-DvxmfbM0.js.gz +0 -0
- package/dist/ui/assets/{chunk-ATLVNIR6-BEIIfJtC.js → chunk-ATLVNIR6-DbeJ0OrR.js} +1 -1
- package/dist/ui/assets/chunk-ATLVNIR6-DbeJ0OrR.js.gz +0 -0
- package/dist/ui/assets/{chunk-B4BG7PRW-B8b6dQQ2.js → chunk-B4BG7PRW-C53q2ggf.js} +1 -1
- package/dist/ui/assets/chunk-B4BG7PRW-C53q2ggf.js.gz +0 -0
- package/dist/ui/assets/{chunk-CVBHYZKI-D-mQAfrk.js → chunk-CVBHYZKI-B3EBSlb3.js} +1 -1
- package/dist/ui/assets/{chunk-DI55MBZ5-BfATX3V8.js → chunk-DI55MBZ5-vIyNEQN-.js} +1 -1
- package/dist/ui/assets/chunk-DI55MBZ5-vIyNEQN-.js.gz +0 -0
- package/dist/ui/assets/chunk-EXTU4WIE-B3ObkuOm.js +1 -0
- package/dist/ui/assets/{chunk-FMBD7UC4-fqXscNvc.js → chunk-FMBD7UC4-rddmfK-Z.js} +1 -1
- package/dist/ui/assets/{chunk-HN2XXSSU-BCHvD80g.js → chunk-HN2XXSSU-Dttqcg3b.js} +1 -1
- package/dist/ui/assets/chunk-HN2XXSSU-Dttqcg3b.js.gz +0 -0
- package/dist/ui/assets/{chunk-JA3XYJ7Z-Cp6dqHnY.js → chunk-JA3XYJ7Z-DbNDev3D.js} +1 -1
- package/dist/ui/assets/chunk-JA3XYJ7Z-DbNDev3D.js.gz +0 -0
- package/dist/ui/assets/{chunk-JZLCHNYA-cKMooY3y.js → chunk-JZLCHNYA-EUmx2y4H.js} +1 -1
- package/dist/ui/assets/chunk-JZLCHNYA-EUmx2y4H.js.gz +0 -0
- package/dist/ui/assets/{chunk-MI3HLSF2-BlzO5wOE.js → chunk-MI3HLSF2-65n9Mkyc.js} +1 -1
- package/dist/ui/assets/chunk-MI3HLSF2-65n9Mkyc.js.gz +0 -0
- package/dist/ui/assets/chunk-N4CR4FBY-mv5koXqW.js +2 -0
- package/dist/ui/assets/chunk-N4CR4FBY-mv5koXqW.js.gz +0 -0
- package/dist/ui/assets/{chunk-QN33PNHL-DIHGQ_pd.js → chunk-QN33PNHL-DsRKK6NR.js} +1 -1
- package/dist/ui/assets/{chunk-QXUST7PY-C9l0muI0.js → chunk-QXUST7PY-BCYnMiS3.js} +1 -1
- package/dist/ui/assets/chunk-QXUST7PY-BCYnMiS3.js.gz +0 -0
- package/dist/ui/assets/chunk-QZHKN3VN-HucAw4xW.js +1 -0
- package/dist/ui/assets/{chunk-S3R3BYOJ-VJiLzt2o.js → chunk-S3R3BYOJ-CWMEa9Dc.js} +1 -1
- package/dist/ui/assets/chunk-S3R3BYOJ-CWMEa9Dc.js.gz +0 -0
- package/dist/ui/assets/{chunk-TZMSLE5B-DZwI0C_2.js → chunk-TZMSLE5B-BuQUQcTr.js} +1 -1
- package/dist/ui/assets/chunk-TZMSLE5B-BuQUQcTr.js.gz +0 -0
- package/dist/ui/assets/classDiagram-2ON5EDUG-CUT3rPTB.js +1 -0
- package/dist/ui/assets/classDiagram-v2-WZHVMYZB-CUT3rPTB.js +1 -0
- package/dist/ui/assets/{cose-bilkent-S5V4N54A-Ipik-oSD.js → cose-bilkent-S5V4N54A-CnPB3ARO.js} +1 -1
- package/dist/ui/assets/cose-bilkent-S5V4N54A-CnPB3ARO.js.gz +0 -0
- package/dist/ui/assets/cursor-QEb7m-rN.png +0 -0
- package/dist/ui/assets/{dagre-6UL2VRFP-BDpyWQnh.js → dagre-6UL2VRFP-DhS-k_Se.js} +1 -1
- package/dist/ui/assets/dagre-6UL2VRFP-DhS-k_Se.js.gz +0 -0
- package/dist/ui/assets/{dagre-CgA4KhUX.js → dagre-KgLoHEuy.js} +1 -1
- package/dist/ui/assets/dagre-KgLoHEuy.js.gz +0 -0
- package/dist/ui/assets/{diagram-PSM6KHXK-B4GRzxLJ.js → diagram-PSM6KHXK-BZg3MJmb.js} +1 -1
- package/dist/ui/assets/diagram-PSM6KHXK-BZg3MJmb.js.gz +0 -0
- package/dist/ui/assets/{diagram-QEK2KX5R-BWPW28XI.js → diagram-QEK2KX5R-BPCitvbo.js} +1 -1
- package/dist/ui/assets/diagram-QEK2KX5R-BPCitvbo.js.gz +0 -0
- package/dist/ui/assets/{diagram-S2PKOQOG-BIHhcGoV.js → diagram-S2PKOQOG-NW4uK6sx.js} +1 -1
- package/dist/ui/assets/diagram-S2PKOQOG-NW4uK6sx.js.gz +0 -0
- package/dist/ui/assets/{editor-C-HJ7Yw0.js → editor-CzFWIUw2.js} +1 -1
- package/dist/ui/assets/editor-CzFWIUw2.js.gz +0 -0
- package/dist/ui/assets/{emoji-D8F6B62m.js → emoji-Dkz4Zzv_.js} +1 -1
- package/dist/ui/assets/emoji-Dkz4Zzv_.js.gz +0 -0
- package/dist/ui/assets/{erDiagram-Q2GNP2WA-ubTaAFcK.js → erDiagram-Q2GNP2WA-me1fboaf.js} +1 -1
- package/dist/ui/assets/erDiagram-Q2GNP2WA-me1fboaf.js.gz +0 -0
- package/dist/ui/assets/{flowDiagram-NV44I4VS-BHLCTYjI.js → flowDiagram-NV44I4VS-DzE8dGsh.js} +1 -1
- package/dist/ui/assets/flowDiagram-NV44I4VS-DzE8dGsh.js.gz +0 -0
- package/dist/ui/assets/{ganttDiagram-LVOFAZNH-ClC3pay1.js → ganttDiagram-LVOFAZNH-CFQD09Mi.js} +2 -2
- package/dist/ui/assets/ganttDiagram-LVOFAZNH-CFQD09Mi.js.gz +0 -0
- package/dist/ui/assets/{gitGraph-F6HP7TQM-DghoobE6.js → gitGraph-F6HP7TQM-CfFE_uAC.js} +1 -1
- package/dist/ui/assets/{gitGraphDiagram-NY62KEGX-Clqpiswu.js → gitGraphDiagram-NY62KEGX-CaVoxU4C.js} +1 -1
- package/dist/ui/assets/gitGraphDiagram-NY62KEGX-CaVoxU4C.js.gz +0 -0
- package/dist/ui/assets/index-BN5_Qq7R.js +324 -0
- package/dist/ui/assets/index-BN5_Qq7R.js.gz +0 -0
- package/dist/ui/assets/index-DxuPq13l.css +1 -0
- package/dist/ui/assets/index-DxuPq13l.css.gz +0 -0
- package/dist/ui/assets/{info-NVLQJR56-0ZldEXPQ.js → info-NVLQJR56-i_xHYg3f.js} +1 -1
- package/dist/ui/assets/{infoDiagram-ER5ION4S-DMmPX-il.js → infoDiagram-ER5ION4S-2NL93b78.js} +1 -1
- package/dist/ui/assets/{journeyDiagram-XKPGCS4Q-CrVickA2.js → journeyDiagram-XKPGCS4Q-CZF-2DHU.js} +1 -1
- package/dist/ui/assets/journeyDiagram-XKPGCS4Q-CZF-2DHU.js.gz +0 -0
- package/dist/ui/assets/{kanban-definition-3W4ZIXB7-C_BsdHYL.js → kanban-definition-3W4ZIXB7-CfvJIOny.js} +1 -1
- package/dist/ui/assets/kanban-definition-3W4ZIXB7-CfvJIOny.js.gz +0 -0
- package/dist/ui/assets/{line-CfBP7Yic.js → line-DDv8kOJk.js} +1 -1
- package/dist/ui/assets/{linear-BsjageUB.js → linear-Daef-l29.js} +1 -1
- package/dist/ui/assets/linear-Daef-l29.js.gz +0 -0
- package/dist/ui/assets/{mermaid-parser.core-DZdP-NFq.js → mermaid-parser.core-CdK9QgYV.js} +2 -2
- package/dist/ui/assets/mermaid-parser.core-CdK9QgYV.js.gz +0 -0
- package/dist/ui/assets/{mermaid.core-TNrI0pHG.js → mermaid.core-D6GS9mU-.js} +3 -3
- package/dist/ui/assets/mermaid.core-D6GS9mU-.js.gz +0 -0
- package/dist/ui/assets/message-SqLqNYcv.js +36 -0
- package/dist/ui/assets/message-SqLqNYcv.js.gz +0 -0
- package/dist/ui/assets/{mindmap-definition-VGOIOE7T-BbmaUjMY.js → mindmap-definition-VGOIOE7T-Cb3QMflX.js} +1 -1
- package/dist/ui/assets/mindmap-definition-VGOIOE7T-Cb3QMflX.js.gz +0 -0
- package/dist/ui/assets/{packet-BFZMPI3H-D_ZhkXuT.js → packet-BFZMPI3H-Bm2uwz4i.js} +1 -1
- package/dist/ui/assets/{particles-Dv28pjOd.js → particles-DsJFOarW.js} +1 -1
- package/dist/ui/assets/particles-DsJFOarW.js.gz +0 -0
- package/dist/ui/assets/{pie-7BOR55EZ-Dn0Q3qNx.js → pie-7BOR55EZ-5i17tVnF.js} +1 -1
- package/dist/ui/assets/{pieDiagram-ADFJNKIX-BbyjfYu8.js → pieDiagram-ADFJNKIX-BxIwQWvw.js} +1 -1
- package/dist/ui/assets/pieDiagram-ADFJNKIX-BxIwQWvw.js.gz +0 -0
- package/dist/ui/assets/{quadrantDiagram-AYHSOK5B-Bc3GqMKz.js → quadrantDiagram-AYHSOK5B-B5HPe4ga.js} +1 -1
- package/dist/ui/assets/quadrantDiagram-AYHSOK5B-B5HPe4ga.js.gz +0 -0
- package/dist/ui/assets/{radar-NHE76QYJ-BHwoAy1q.js → radar-NHE76QYJ-BTn-tq0k.js} +1 -1
- package/dist/ui/assets/{reactflow-BVYPxNhc.js → reactflow-Bf74ngoo.js} +2 -2
- package/dist/ui/assets/reactflow-Bf74ngoo.js.gz +0 -0
- package/dist/ui/assets/{requirementDiagram-UZGBJVZJ-BQaKKL09.js → requirementDiagram-UZGBJVZJ-YfI6llkX.js} +1 -1
- package/dist/ui/assets/requirementDiagram-UZGBJVZJ-YfI6llkX.js.gz +0 -0
- package/dist/ui/assets/{sandpack-BQW_FQ7G.js → sandpack-D7koO5op.js} +1 -1
- package/dist/ui/assets/sandpack-D7koO5op.js.gz +0 -0
- package/dist/ui/assets/{sankeyDiagram-TZEHDZUN-DiJvDvhb.js → sankeyDiagram-TZEHDZUN-DOk_B10B.js} +1 -1
- package/dist/ui/assets/sankeyDiagram-TZEHDZUN-DOk_B10B.js.gz +0 -0
- package/dist/ui/assets/{sequenceDiagram-WL72ISMW-Dw32824o.js → sequenceDiagram-WL72ISMW-DAe4Um17.js} +1 -1
- package/dist/ui/assets/sequenceDiagram-WL72ISMW-DAe4Um17.js.gz +0 -0
- package/dist/ui/assets/{stateDiagram-FKZM4ZOC-BCOpNdHV.js → stateDiagram-FKZM4ZOC-CCesDu_C.js} +1 -1
- package/dist/ui/assets/stateDiagram-FKZM4ZOC-CCesDu_C.js.gz +0 -0
- package/dist/ui/assets/stateDiagram-v2-4FDKWEC3-CMlIrsoO.js +1 -0
- package/dist/ui/assets/{syntax-VJrU5BEu.js → syntax-C-M-8jOU.js} +1 -1
- package/dist/ui/assets/syntax-C-M-8jOU.js.gz +0 -0
- package/dist/ui/assets/{theme-DZtFA8b4.js → theme-BQZdiqwv.js} +1 -1
- package/dist/ui/assets/{timeline-definition-IT6M3QCI-Jh_WZzXv.js → timeline-definition-IT6M3QCI-D6P5txjT.js} +1 -1
- package/dist/ui/assets/timeline-definition-IT6M3QCI-D6P5txjT.js.gz +0 -0
- package/dist/ui/assets/{treemap-KMMF4GRG-CPYIgjxE.js → treemap-KMMF4GRG-Bitm3gy4.js} +1 -1
- package/dist/ui/assets/{knowledgeRoutes-CivaUqha.js → useUserLocalStorage-Ckb8HsIw.js} +1 -1
- package/dist/ui/assets/useUserLocalStorage-Ckb8HsIw.js.gz +0 -0
- package/dist/ui/assets/{xychartDiagram-PRI3JC2R-CERc7Rdb.js → xychartDiagram-PRI3JC2R-CsybjUbd.js} +1 -1
- package/dist/ui/assets/xychartDiagram-PRI3JC2R-CsybjUbd.js.gz +0 -0
- package/dist/ui/index.html +13 -11
- package/dist/ui/index.html.gz +0 -0
- package/package.json +10 -9
- package/dist/ui/assets/App-9s2WHM6S.js +0 -22
- package/dist/ui/assets/App-9s2WHM6S.js.gz +0 -0
- package/dist/ui/assets/App-BAdBsEnV.css.gz +0 -0
- package/dist/ui/assets/ArtifactConsentModal-ParNk5kW.js.gz +0 -0
- package/dist/ui/assets/ArtifactFullscreenPage-VQxLMCiN.js +0 -9
- package/dist/ui/assets/ArtifactFullscreenPage-VQxLMCiN.js.gz +0 -0
- package/dist/ui/assets/AutocompleteTextarea-3RchrIgk.js +0 -18
- package/dist/ui/assets/AutocompleteTextarea-3RchrIgk.js.gz +0 -0
- package/dist/ui/assets/CodeEditor.inner-D51Z_CLQ.js.gz +0 -0
- package/dist/ui/assets/ConversationView-Dyddw2b1.js +0 -34
- package/dist/ui/assets/ConversationView-Dyddw2b1.js.gz +0 -0
- package/dist/ui/assets/KnowledgePage-CdftslnF.js +0 -24
- package/dist/ui/assets/KnowledgePage-CdftslnF.js.gz +0 -0
- package/dist/ui/assets/MobileApp-BdBMpnJ1.js +0 -1
- package/dist/ui/assets/MobileApp-BdBMpnJ1.js.gz +0 -0
- package/dist/ui/assets/StreamdownDemoPage-B9wbgp2s.js.gz +0 -0
- package/dist/ui/assets/ThemeSwitcher-ubn6IOz9.js.gz +0 -0
- package/dist/ui/assets/antd-C-HfEC4E.js +0 -400
- package/dist/ui/assets/antd-C-HfEC4E.js.gz +0 -0
- package/dist/ui/assets/architecture-U656AL7Q-dkBewUpN.js +0 -1
- package/dist/ui/assets/architectureDiagram-VXUJARFQ-ChmZt3zk.js.gz +0 -0
- package/dist/ui/assets/blockDiagram-VD42YOAC-CzGHAHao.js.gz +0 -0
- package/dist/ui/assets/c4Diagram-YG6GDRKO-DscJyaWN.js.gz +0 -0
- package/dist/ui/assets/channel-DvRQqEqC.js +0 -1
- package/dist/ui/assets/chunk-55IACEB6-DojF2pZN.js +0 -1
- package/dist/ui/assets/chunk-ABZYJK2D-RzDCrjE6.js.gz +0 -0
- package/dist/ui/assets/chunk-AGHRB4JF-jidCS5Of.js.gz +0 -0
- package/dist/ui/assets/chunk-ATLVNIR6-BEIIfJtC.js.gz +0 -0
- package/dist/ui/assets/chunk-B4BG7PRW-B8b6dQQ2.js.gz +0 -0
- package/dist/ui/assets/chunk-DI55MBZ5-BfATX3V8.js.gz +0 -0
- package/dist/ui/assets/chunk-EXTU4WIE-BKt6lPJM.js +0 -1
- package/dist/ui/assets/chunk-HN2XXSSU-BCHvD80g.js.gz +0 -0
- package/dist/ui/assets/chunk-JA3XYJ7Z-Cp6dqHnY.js.gz +0 -0
- package/dist/ui/assets/chunk-JZLCHNYA-cKMooY3y.js.gz +0 -0
- package/dist/ui/assets/chunk-MI3HLSF2-BlzO5wOE.js.gz +0 -0
- package/dist/ui/assets/chunk-N4CR4FBY-pASDorUx.js +0 -2
- package/dist/ui/assets/chunk-N4CR4FBY-pASDorUx.js.gz +0 -0
- package/dist/ui/assets/chunk-QXUST7PY-C9l0muI0.js.gz +0 -0
- package/dist/ui/assets/chunk-QZHKN3VN-CZskCFCf.js +0 -1
- package/dist/ui/assets/chunk-S3R3BYOJ-VJiLzt2o.js.gz +0 -0
- package/dist/ui/assets/chunk-TZMSLE5B-DZwI0C_2.js.gz +0 -0
- package/dist/ui/assets/classDiagram-2ON5EDUG-BFASUbmZ.js +0 -1
- package/dist/ui/assets/classDiagram-v2-WZHVMYZB-BFASUbmZ.js +0 -1
- package/dist/ui/assets/cose-bilkent-S5V4N54A-Ipik-oSD.js.gz +0 -0
- package/dist/ui/assets/dagre-6UL2VRFP-BDpyWQnh.js.gz +0 -0
- package/dist/ui/assets/dagre-CgA4KhUX.js.gz +0 -0
- package/dist/ui/assets/diagram-PSM6KHXK-B4GRzxLJ.js.gz +0 -0
- package/dist/ui/assets/diagram-QEK2KX5R-BWPW28XI.js.gz +0 -0
- package/dist/ui/assets/diagram-S2PKOQOG-BIHhcGoV.js.gz +0 -0
- package/dist/ui/assets/editor-C-HJ7Yw0.js.gz +0 -0
- package/dist/ui/assets/emoji-D8F6B62m.js.gz +0 -0
- package/dist/ui/assets/erDiagram-Q2GNP2WA-ubTaAFcK.js.gz +0 -0
- package/dist/ui/assets/flowDiagram-NV44I4VS-BHLCTYjI.js.gz +0 -0
- package/dist/ui/assets/ganttDiagram-LVOFAZNH-ClC3pay1.js.gz +0 -0
- package/dist/ui/assets/gitGraphDiagram-NY62KEGX-Clqpiswu.js.gz +0 -0
- package/dist/ui/assets/index-D9OElx9A.css +0 -1
- package/dist/ui/assets/index-D9OElx9A.css.gz +0 -0
- package/dist/ui/assets/index-DxPuzG7E.js +0 -350
- package/dist/ui/assets/index-DxPuzG7E.js.gz +0 -0
- package/dist/ui/assets/journeyDiagram-XKPGCS4Q-CrVickA2.js.gz +0 -0
- package/dist/ui/assets/kanban-definition-3W4ZIXB7-C_BsdHYL.js.gz +0 -0
- package/dist/ui/assets/knowledgeRoutes-CivaUqha.js.gz +0 -0
- package/dist/ui/assets/linear-BsjageUB.js.gz +0 -0
- package/dist/ui/assets/mermaid-parser.core-DZdP-NFq.js.gz +0 -0
- package/dist/ui/assets/mermaid.core-TNrI0pHG.js.gz +0 -0
- package/dist/ui/assets/message-BtWWJ9Af.js +0 -36
- package/dist/ui/assets/message-BtWWJ9Af.js.gz +0 -0
- package/dist/ui/assets/mindmap-definition-VGOIOE7T-BbmaUjMY.js.gz +0 -0
- package/dist/ui/assets/particles-Dv28pjOd.js.gz +0 -0
- package/dist/ui/assets/pieDiagram-ADFJNKIX-BbyjfYu8.js.gz +0 -0
- package/dist/ui/assets/quadrantDiagram-AYHSOK5B-Bc3GqMKz.js.gz +0 -0
- package/dist/ui/assets/reactflow-BVYPxNhc.js.gz +0 -0
- package/dist/ui/assets/requirementDiagram-UZGBJVZJ-BQaKKL09.js.gz +0 -0
- package/dist/ui/assets/sandpack-BQW_FQ7G.js.gz +0 -0
- package/dist/ui/assets/sankeyDiagram-TZEHDZUN-DiJvDvhb.js.gz +0 -0
- package/dist/ui/assets/sequenceDiagram-WL72ISMW-Dw32824o.js.gz +0 -0
- package/dist/ui/assets/stateDiagram-FKZM4ZOC-BCOpNdHV.js.gz +0 -0
- package/dist/ui/assets/stateDiagram-v2-4FDKWEC3-Cuqwvgfg.js +0 -1
- package/dist/ui/assets/syntax-VJrU5BEu.js.gz +0 -0
- package/dist/ui/assets/timeline-definition-IT6M3QCI-Jh_WZzXv.js.gz +0 -0
- package/dist/ui/assets/xychartDiagram-PRI3JC2R-CERc7Rdb.js.gz +0 -0
|
@@ -208,7 +208,7 @@ var init_unix_group_init = __esm({
|
|
|
208
208
|
}
|
|
209
209
|
});
|
|
210
210
|
|
|
211
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
211
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/internal/tslib.mjs
|
|
212
212
|
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
213
213
|
if (kind === "m")
|
|
214
214
|
throw new TypeError("Private method is not writable");
|
|
@@ -226,15 +226,15 @@ function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
|
226
226
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
227
227
|
}
|
|
228
228
|
var init_tslib = __esm({
|
|
229
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
229
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/internal/tslib.mjs"() {
|
|
230
230
|
"use strict";
|
|
231
231
|
}
|
|
232
232
|
});
|
|
233
233
|
|
|
234
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
234
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/internal/utils/uuid.mjs
|
|
235
235
|
var uuid4;
|
|
236
236
|
var init_uuid = __esm({
|
|
237
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
237
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/internal/utils/uuid.mjs"() {
|
|
238
238
|
"use strict";
|
|
239
239
|
uuid4 = function() {
|
|
240
240
|
const { crypto: crypto3 } = globalThis;
|
|
@@ -249,7 +249,7 @@ var init_uuid = __esm({
|
|
|
249
249
|
}
|
|
250
250
|
});
|
|
251
251
|
|
|
252
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
252
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/internal/errors.mjs
|
|
253
253
|
function isAbortError(err) {
|
|
254
254
|
return typeof err === "object" && err !== null && // Spec-compliant fetch implementations
|
|
255
255
|
("name" in err && err.name === "AbortError" || // Expo fetch
|
|
@@ -257,7 +257,7 @@ function isAbortError(err) {
|
|
|
257
257
|
}
|
|
258
258
|
var castToError;
|
|
259
259
|
var init_errors = __esm({
|
|
260
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
260
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/internal/errors.mjs"() {
|
|
261
261
|
"use strict";
|
|
262
262
|
castToError = (err) => {
|
|
263
263
|
if (err instanceof Error)
|
|
@@ -286,10 +286,10 @@ var init_errors = __esm({
|
|
|
286
286
|
}
|
|
287
287
|
});
|
|
288
288
|
|
|
289
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
290
|
-
var AnthropicError, APIError, APIUserAbortError, APIConnectionError, APIConnectionTimeoutError, BadRequestError, AuthenticationError, PermissionDeniedError, NotFoundError3, ConflictError, UnprocessableEntityError, RateLimitError, InternalServerError;
|
|
289
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/core/error.mjs
|
|
290
|
+
var AnthropicError, APIError, APIUserAbortError, APIConnectionError, APIConnectionTimeoutError, RetryableError, BadRequestError, AuthenticationError, PermissionDeniedError, NotFoundError3, ConflictError, UnprocessableEntityError, RateLimitError, InternalServerError;
|
|
291
291
|
var init_error = __esm({
|
|
292
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
292
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/core/error.mjs"() {
|
|
293
293
|
"use strict";
|
|
294
294
|
init_errors();
|
|
295
295
|
AnthropicError = class extends Error {
|
|
@@ -366,6 +366,13 @@ var init_error = __esm({
|
|
|
366
366
|
super({ message: message ?? "Request timed out." });
|
|
367
367
|
}
|
|
368
368
|
};
|
|
369
|
+
RetryableError = class extends AnthropicError {
|
|
370
|
+
constructor(message, { cause } = {}) {
|
|
371
|
+
super(message ?? "Retryable error.");
|
|
372
|
+
if (cause !== void 0)
|
|
373
|
+
this.cause = cause;
|
|
374
|
+
}
|
|
375
|
+
};
|
|
369
376
|
BadRequestError = class extends APIError {
|
|
370
377
|
};
|
|
371
378
|
AuthenticationError = class extends APIError {
|
|
@@ -385,7 +392,7 @@ var init_error = __esm({
|
|
|
385
392
|
}
|
|
386
393
|
});
|
|
387
394
|
|
|
388
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
395
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/internal/utils/values.mjs
|
|
389
396
|
function maybeObj(x) {
|
|
390
397
|
if (typeof x !== "object") {
|
|
391
398
|
return {};
|
|
@@ -404,7 +411,7 @@ function hasOwn(obj, key) {
|
|
|
404
411
|
}
|
|
405
412
|
var startsWithSchemeRegexp, isAbsoluteURL, isArray, isReadonlyArray, validatePositiveInteger, safeJSON;
|
|
406
413
|
var init_values = __esm({
|
|
407
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
414
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/internal/utils/values.mjs"() {
|
|
408
415
|
"use strict";
|
|
409
416
|
init_error();
|
|
410
417
|
startsWithSchemeRegexp = /^[a-z][a-z0-9+.-]*:/i;
|
|
@@ -432,10 +439,10 @@ var init_values = __esm({
|
|
|
432
439
|
}
|
|
433
440
|
});
|
|
434
441
|
|
|
435
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
442
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/internal/utils/sleep.mjs
|
|
436
443
|
var sleep;
|
|
437
444
|
var init_sleep = __esm({
|
|
438
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
445
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/internal/utils/sleep.mjs"() {
|
|
439
446
|
"use strict";
|
|
440
447
|
sleep = (ms, signal) => new Promise((resolve7) => {
|
|
441
448
|
if (signal?.aborted)
|
|
@@ -453,16 +460,16 @@ var init_sleep = __esm({
|
|
|
453
460
|
}
|
|
454
461
|
});
|
|
455
462
|
|
|
456
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
463
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/version.mjs
|
|
457
464
|
var VERSION;
|
|
458
465
|
var init_version = __esm({
|
|
459
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
466
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/version.mjs"() {
|
|
460
467
|
"use strict";
|
|
461
|
-
VERSION = "0.
|
|
468
|
+
VERSION = "0.105.0";
|
|
462
469
|
}
|
|
463
470
|
});
|
|
464
471
|
|
|
465
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
472
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/internal/detect-platform.mjs
|
|
466
473
|
function getDetectedPlatform() {
|
|
467
474
|
if (typeof Deno !== "undefined" && Deno.build != null) {
|
|
468
475
|
return "deno";
|
|
@@ -500,7 +507,7 @@ function getBrowserInfo() {
|
|
|
500
507
|
}
|
|
501
508
|
var isRunningInBrowser, getPlatformProperties, normalizeArch, normalizePlatform, _platformHeaders, getPlatformHeaders;
|
|
502
509
|
var init_detect_platform = __esm({
|
|
503
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
510
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/internal/detect-platform.mjs"() {
|
|
504
511
|
"use strict";
|
|
505
512
|
init_version();
|
|
506
513
|
isRunningInBrowser = () => {
|
|
@@ -602,7 +609,7 @@ var init_detect_platform = __esm({
|
|
|
602
609
|
}
|
|
603
610
|
});
|
|
604
611
|
|
|
605
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
612
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/internal/shims.mjs
|
|
606
613
|
function getDefaultFetch() {
|
|
607
614
|
if (typeof fetch !== "undefined") {
|
|
608
615
|
return fetch;
|
|
@@ -610,11 +617,11 @@ function getDefaultFetch() {
|
|
|
610
617
|
throw new Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new Anthropic({ fetch })` or polyfill the global, `globalThis.fetch = fetch`");
|
|
611
618
|
}
|
|
612
619
|
function makeReadableStream(...args) {
|
|
613
|
-
const
|
|
614
|
-
if (typeof
|
|
620
|
+
const ReadableStream2 = globalThis.ReadableStream;
|
|
621
|
+
if (typeof ReadableStream2 === "undefined") {
|
|
615
622
|
throw new Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");
|
|
616
623
|
}
|
|
617
|
-
return new
|
|
624
|
+
return new ReadableStream2(...args);
|
|
618
625
|
}
|
|
619
626
|
function ReadableStreamFrom(iterable) {
|
|
620
627
|
let iter = Symbol.asyncIterator in iterable ? iterable[Symbol.asyncIterator]() : iterable[Symbol.iterator]();
|
|
@@ -674,15 +681,15 @@ async function CancelReadableStream(stream) {
|
|
|
674
681
|
await cancelPromise;
|
|
675
682
|
}
|
|
676
683
|
var init_shims = __esm({
|
|
677
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
684
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/internal/shims.mjs"() {
|
|
678
685
|
"use strict";
|
|
679
686
|
}
|
|
680
687
|
});
|
|
681
688
|
|
|
682
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
689
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/internal/request-options.mjs
|
|
683
690
|
var FallbackEncoder;
|
|
684
691
|
var init_request_options = __esm({
|
|
685
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
692
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/internal/request-options.mjs"() {
|
|
686
693
|
"use strict";
|
|
687
694
|
FallbackEncoder = ({ headers, body }) => {
|
|
688
695
|
return {
|
|
@@ -695,10 +702,10 @@ var init_request_options = __esm({
|
|
|
695
702
|
}
|
|
696
703
|
});
|
|
697
704
|
|
|
698
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
705
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/internal/qs/formats.mjs
|
|
699
706
|
var default_format, default_formatter, formatters, RFC1738;
|
|
700
707
|
var init_formats = __esm({
|
|
701
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
708
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/internal/qs/formats.mjs"() {
|
|
702
709
|
"use strict";
|
|
703
710
|
default_format = "RFC3986";
|
|
704
711
|
default_formatter = (v) => String(v);
|
|
@@ -710,7 +717,7 @@ var init_formats = __esm({
|
|
|
710
717
|
}
|
|
711
718
|
});
|
|
712
719
|
|
|
713
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
720
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/internal/qs/utils.mjs
|
|
714
721
|
function is_buffer(obj) {
|
|
715
722
|
if (!obj || typeof obj !== "object") {
|
|
716
723
|
return false;
|
|
@@ -729,7 +736,7 @@ function maybe_map(val, fn) {
|
|
|
729
736
|
}
|
|
730
737
|
var has, hex_table, limit, encode;
|
|
731
738
|
var init_utils = __esm({
|
|
732
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
739
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/internal/qs/utils.mjs"() {
|
|
733
740
|
"use strict";
|
|
734
741
|
init_formats();
|
|
735
742
|
init_values();
|
|
@@ -797,11 +804,11 @@ var init_utils = __esm({
|
|
|
797
804
|
}
|
|
798
805
|
});
|
|
799
806
|
|
|
800
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
807
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/internal/qs/stringify.mjs
|
|
801
808
|
function is_non_nullish_primitive(v) {
|
|
802
809
|
return typeof v === "string" || typeof v === "number" || typeof v === "boolean" || typeof v === "symbol" || typeof v === "bigint";
|
|
803
810
|
}
|
|
804
|
-
function inner_stringify(object, prefix, generateArrayPrefix, commaRoundTrip, allowEmptyArrays, strictNullHandling, skipNulls, encodeDotInKeys,
|
|
811
|
+
function inner_stringify(object, prefix, generateArrayPrefix, commaRoundTrip, allowEmptyArrays, strictNullHandling, skipNulls, encodeDotInKeys, encoder2, filter, sort, allowDots, serializeDate, format, formatter, encodeValuesOnly, charset, sideChannel) {
|
|
805
812
|
let obj = object;
|
|
806
813
|
let tmp_sc = sideChannel;
|
|
807
814
|
let step = 0;
|
|
@@ -834,19 +841,19 @@ function inner_stringify(object, prefix, generateArrayPrefix, commaRoundTrip, al
|
|
|
834
841
|
}
|
|
835
842
|
if (obj === null) {
|
|
836
843
|
if (strictNullHandling) {
|
|
837
|
-
return
|
|
844
|
+
return encoder2 && !encodeValuesOnly ? (
|
|
838
845
|
// @ts-expect-error
|
|
839
|
-
|
|
846
|
+
encoder2(prefix, defaults.encoder, charset, "key", format)
|
|
840
847
|
) : prefix;
|
|
841
848
|
}
|
|
842
849
|
obj = "";
|
|
843
850
|
}
|
|
844
851
|
if (is_non_nullish_primitive(obj) || is_buffer(obj)) {
|
|
845
|
-
if (
|
|
846
|
-
const key_value = encodeValuesOnly ? prefix :
|
|
852
|
+
if (encoder2) {
|
|
853
|
+
const key_value = encodeValuesOnly ? prefix : encoder2(prefix, defaults.encoder, charset, "key", format);
|
|
847
854
|
return [
|
|
848
855
|
formatter?.(key_value) + "=" + // @ts-expect-error
|
|
849
|
-
formatter?.(
|
|
856
|
+
formatter?.(encoder2(obj, defaults.encoder, charset, "value", format))
|
|
850
857
|
];
|
|
851
858
|
}
|
|
852
859
|
return [formatter?.(prefix) + "=" + formatter?.(String(obj))];
|
|
@@ -857,8 +864,8 @@ function inner_stringify(object, prefix, generateArrayPrefix, commaRoundTrip, al
|
|
|
857
864
|
}
|
|
858
865
|
let obj_keys;
|
|
859
866
|
if (generateArrayPrefix === "comma" && isArray(obj)) {
|
|
860
|
-
if (encodeValuesOnly &&
|
|
861
|
-
obj = maybe_map(obj,
|
|
867
|
+
if (encodeValuesOnly && encoder2) {
|
|
868
|
+
obj = maybe_map(obj, encoder2);
|
|
862
869
|
}
|
|
863
870
|
obj_keys = [{ value: obj.length > 0 ? obj.join(",") || null : void 0 }];
|
|
864
871
|
} else if (isArray(filter)) {
|
|
@@ -896,7 +903,7 @@ function inner_stringify(object, prefix, generateArrayPrefix, commaRoundTrip, al
|
|
|
896
903
|
skipNulls,
|
|
897
904
|
encodeDotInKeys,
|
|
898
905
|
// @ts-ignore
|
|
899
|
-
generateArrayPrefix === "comma" && encodeValuesOnly && isArray(obj) ? null :
|
|
906
|
+
generateArrayPrefix === "comma" && encodeValuesOnly && isArray(obj) ? null : encoder2,
|
|
900
907
|
filter,
|
|
901
908
|
sort,
|
|
902
909
|
allowDots,
|
|
@@ -1037,7 +1044,7 @@ function stringify(object, opts = {}) {
|
|
|
1037
1044
|
}
|
|
1038
1045
|
var array_prefix_generators, push_to_array, toISOString, defaults, sentinel;
|
|
1039
1046
|
var init_stringify = __esm({
|
|
1040
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
1047
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/internal/qs/stringify.mjs"() {
|
|
1041
1048
|
"use strict";
|
|
1042
1049
|
init_utils();
|
|
1043
1050
|
init_formats();
|
|
@@ -1083,18 +1090,18 @@ var init_stringify = __esm({
|
|
|
1083
1090
|
}
|
|
1084
1091
|
});
|
|
1085
1092
|
|
|
1086
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
1093
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/internal/utils/query.mjs
|
|
1087
1094
|
function stringifyQuery(query) {
|
|
1088
1095
|
return stringify(query, { arrayFormat: "brackets" });
|
|
1089
1096
|
}
|
|
1090
1097
|
var init_query = __esm({
|
|
1091
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
1098
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/internal/utils/query.mjs"() {
|
|
1092
1099
|
"use strict";
|
|
1093
1100
|
init_stringify();
|
|
1094
1101
|
}
|
|
1095
1102
|
});
|
|
1096
1103
|
|
|
1097
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
1104
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/lib/credentials/types.mjs
|
|
1098
1105
|
function requireSecureTokenEndpoint(baseURL) {
|
|
1099
1106
|
if (!baseURL)
|
|
1100
1107
|
return;
|
|
@@ -1241,7 +1248,7 @@ async function readLimitedText(resp) {
|
|
|
1241
1248
|
}
|
|
1242
1249
|
var GRANT_TYPE_JWT_BEARER, GRANT_TYPE_REFRESH_TOKEN, TOKEN_ENDPOINT, OAUTH_API_BETA_HEADER, FEDERATION_BETA_HEADER, ADVISORY_REFRESH_THRESHOLD_IN_SECONDS, MANDATORY_REFRESH_THRESHOLD_IN_SECONDS, ADVISORY_REFRESH_BACKOFF_IN_SECONDS, MAX_TOKEN_RESPONSE_BYTES, MAX_ERROR_BODY_CHARS, SAFE_ERROR_KEYS, WorkloadIdentityError;
|
|
1243
1250
|
var init_types = __esm({
|
|
1244
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
1251
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/lib/credentials/types.mjs"() {
|
|
1245
1252
|
"use strict";
|
|
1246
1253
|
init_error();
|
|
1247
1254
|
GRANT_TYPE_JWT_BEARER = "urn:ietf:params:oauth:grant-type:jwt-bearer";
|
|
@@ -1266,20 +1273,20 @@ var init_types = __esm({
|
|
|
1266
1273
|
}
|
|
1267
1274
|
});
|
|
1268
1275
|
|
|
1269
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
1276
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/internal/utils/time.mjs
|
|
1270
1277
|
function nowAsSeconds() {
|
|
1271
1278
|
return Math.floor(Date.now() / 1e3);
|
|
1272
1279
|
}
|
|
1273
1280
|
var init_time = __esm({
|
|
1274
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
1281
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/internal/utils/time.mjs"() {
|
|
1275
1282
|
"use strict";
|
|
1276
1283
|
}
|
|
1277
1284
|
});
|
|
1278
1285
|
|
|
1279
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
1286
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/lib/credentials/token-cache.mjs
|
|
1280
1287
|
var TokenCache;
|
|
1281
1288
|
var init_token_cache = __esm({
|
|
1282
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
1289
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/lib/credentials/token-cache.mjs"() {
|
|
1283
1290
|
"use strict";
|
|
1284
1291
|
init_types();
|
|
1285
1292
|
init_time();
|
|
@@ -1373,10 +1380,10 @@ var init_token_cache = __esm({
|
|
|
1373
1380
|
}
|
|
1374
1381
|
});
|
|
1375
1382
|
|
|
1376
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
1383
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/internal/utils/env.mjs
|
|
1377
1384
|
var readEnv;
|
|
1378
1385
|
var init_env = __esm({
|
|
1379
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
1386
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/internal/utils/env.mjs"() {
|
|
1380
1387
|
"use strict";
|
|
1381
1388
|
readEnv = (env) => {
|
|
1382
1389
|
if (typeof globalThis.process !== "undefined") {
|
|
@@ -1390,7 +1397,7 @@ var init_env = __esm({
|
|
|
1390
1397
|
}
|
|
1391
1398
|
});
|
|
1392
1399
|
|
|
1393
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
1400
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/internal/utils/bytes.mjs
|
|
1394
1401
|
function concatBytes(buffers) {
|
|
1395
1402
|
let length = 0;
|
|
1396
1403
|
for (const buffer of buffers) {
|
|
@@ -1405,8 +1412,8 @@ function concatBytes(buffers) {
|
|
|
1405
1412
|
return output;
|
|
1406
1413
|
}
|
|
1407
1414
|
function encodeUTF8(str) {
|
|
1408
|
-
let
|
|
1409
|
-
return (encodeUTF8_ ?? (
|
|
1415
|
+
let encoder2;
|
|
1416
|
+
return (encodeUTF8_ ?? (encoder2 = new globalThis.TextEncoder(), encodeUTF8_ = encoder2.encode.bind(encoder2)))(str);
|
|
1410
1417
|
}
|
|
1411
1418
|
function decodeUTF8(bytes) {
|
|
1412
1419
|
let decoder;
|
|
@@ -1414,21 +1421,21 @@ function decodeUTF8(bytes) {
|
|
|
1414
1421
|
}
|
|
1415
1422
|
var encodeUTF8_, decodeUTF8_;
|
|
1416
1423
|
var init_bytes = __esm({
|
|
1417
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
1424
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/internal/utils/bytes.mjs"() {
|
|
1418
1425
|
"use strict";
|
|
1419
1426
|
}
|
|
1420
1427
|
});
|
|
1421
1428
|
|
|
1422
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
1429
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/internal/utils/base64.mjs
|
|
1423
1430
|
var init_base64 = __esm({
|
|
1424
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
1431
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/internal/utils/base64.mjs"() {
|
|
1425
1432
|
"use strict";
|
|
1426
1433
|
init_error();
|
|
1427
1434
|
init_bytes();
|
|
1428
1435
|
}
|
|
1429
1436
|
});
|
|
1430
1437
|
|
|
1431
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
1438
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/internal/utils/log.mjs
|
|
1432
1439
|
function noop() {
|
|
1433
1440
|
}
|
|
1434
1441
|
function makeLogFn(fnLevel, logger, logLevel) {
|
|
@@ -1438,12 +1445,7 @@ function makeLogFn(fnLevel, logger, logLevel) {
|
|
|
1438
1445
|
return logger[fnLevel].bind(logger);
|
|
1439
1446
|
}
|
|
1440
1447
|
}
|
|
1441
|
-
function
|
|
1442
|
-
const logger = client.logger;
|
|
1443
|
-
const logLevel = client.logLevel ?? "off";
|
|
1444
|
-
if (!logger) {
|
|
1445
|
-
return noopLogger;
|
|
1446
|
-
}
|
|
1448
|
+
function filterLogger(logger, logLevel) {
|
|
1447
1449
|
const cachedLogger = cachedLoggers.get(logger);
|
|
1448
1450
|
if (cachedLogger && cachedLogger[0] === logLevel) {
|
|
1449
1451
|
return cachedLogger[1];
|
|
@@ -1457,11 +1459,29 @@ function loggerFor(client) {
|
|
|
1457
1459
|
cachedLoggers.set(logger, [logLevel, levelLogger]);
|
|
1458
1460
|
return levelLogger;
|
|
1459
1461
|
}
|
|
1460
|
-
|
|
1462
|
+
function loggerFor(client) {
|
|
1463
|
+
const logger = client.logger;
|
|
1464
|
+
const logLevel = client.logLevel ?? "off";
|
|
1465
|
+
if (!logger) {
|
|
1466
|
+
return noopLogger;
|
|
1467
|
+
}
|
|
1468
|
+
return filterLogger(logger, logLevel);
|
|
1469
|
+
}
|
|
1470
|
+
function defaultLogger() {
|
|
1471
|
+
const envLevel = readEnv("ANTHROPIC_LOG");
|
|
1472
|
+
if (!cachedDefaultLogger || envLevel !== lastEnvLevel) {
|
|
1473
|
+
lastEnvLevel = envLevel;
|
|
1474
|
+
cachedDefaultLogger = filterLogger(console, parseLogLevel(envLevel, "process.env['ANTHROPIC_LOG']", filterLogger(console, defaultLogLevel)) ?? defaultLogLevel);
|
|
1475
|
+
}
|
|
1476
|
+
return cachedDefaultLogger;
|
|
1477
|
+
}
|
|
1478
|
+
var defaultLogLevel, levelNumbers, parseLogLevel, noopLogger, cachedLoggers, lastEnvLevel, cachedDefaultLogger, formatRequestDetails;
|
|
1461
1479
|
var init_log = __esm({
|
|
1462
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
1480
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/internal/utils/log.mjs"() {
|
|
1463
1481
|
"use strict";
|
|
1464
1482
|
init_values();
|
|
1483
|
+
init_env();
|
|
1484
|
+
defaultLogLevel = "warn";
|
|
1465
1485
|
levelNumbers = {
|
|
1466
1486
|
off: 0,
|
|
1467
1487
|
error: 200,
|
|
@@ -1469,14 +1489,14 @@ var init_log = __esm({
|
|
|
1469
1489
|
info: 400,
|
|
1470
1490
|
debug: 500
|
|
1471
1491
|
};
|
|
1472
|
-
parseLogLevel = (maybeLevel, sourceName,
|
|
1492
|
+
parseLogLevel = (maybeLevel, sourceName, logger) => {
|
|
1473
1493
|
if (!maybeLevel) {
|
|
1474
1494
|
return void 0;
|
|
1475
1495
|
}
|
|
1476
1496
|
if (hasOwn(levelNumbers, maybeLevel)) {
|
|
1477
1497
|
return maybeLevel;
|
|
1478
1498
|
}
|
|
1479
|
-
|
|
1499
|
+
logger.warn(`${sourceName} was set to ${JSON.stringify(maybeLevel)}, expected one of ${JSON.stringify(Object.keys(levelNumbers))}`);
|
|
1480
1500
|
return void 0;
|
|
1481
1501
|
};
|
|
1482
1502
|
noopLogger = {
|
|
@@ -1508,9 +1528,9 @@ var init_log = __esm({
|
|
|
1508
1528
|
}
|
|
1509
1529
|
});
|
|
1510
1530
|
|
|
1511
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
1531
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/internal/utils.mjs
|
|
1512
1532
|
var init_utils2 = __esm({
|
|
1513
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
1533
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/internal/utils.mjs"() {
|
|
1514
1534
|
"use strict";
|
|
1515
1535
|
init_values();
|
|
1516
1536
|
init_base64();
|
|
@@ -1522,7 +1542,7 @@ var init_utils2 = __esm({
|
|
|
1522
1542
|
}
|
|
1523
1543
|
});
|
|
1524
1544
|
|
|
1525
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
1545
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/core/credentials.mjs
|
|
1526
1546
|
function validateProfileName(name) {
|
|
1527
1547
|
if (!name) {
|
|
1528
1548
|
throw new Error("profile name is empty");
|
|
@@ -1539,7 +1559,7 @@ function validateProfileName(name) {
|
|
|
1539
1559
|
}
|
|
1540
1560
|
var CREDENTIALS_FILE_VERSION, PROFILE_NAME_PATTERN, loadConfigWithSource, getCredentialsPath, getRootConfigPath, supportsLocalConfigFiles, getActiveProfileName;
|
|
1541
1561
|
var init_credentials = __esm({
|
|
1542
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
1562
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/core/credentials.mjs"() {
|
|
1543
1563
|
"use strict";
|
|
1544
1564
|
init_detect_platform();
|
|
1545
1565
|
init_utils2();
|
|
@@ -1704,7 +1724,7 @@ var init_credentials = __esm({
|
|
|
1704
1724
|
}
|
|
1705
1725
|
});
|
|
1706
1726
|
|
|
1707
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
1727
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/lib/credentials/identity-token.mjs
|
|
1708
1728
|
function identityTokenFromFile(path13) {
|
|
1709
1729
|
if (!path13) {
|
|
1710
1730
|
throw new AnthropicError("Identity token file path is empty");
|
|
@@ -1731,13 +1751,13 @@ function identityTokenFromValue(token) {
|
|
|
1731
1751
|
return () => token;
|
|
1732
1752
|
}
|
|
1733
1753
|
var init_identity_token = __esm({
|
|
1734
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
1754
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/lib/credentials/identity-token.mjs"() {
|
|
1735
1755
|
"use strict";
|
|
1736
1756
|
init_error();
|
|
1737
1757
|
}
|
|
1738
1758
|
});
|
|
1739
1759
|
|
|
1740
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
1760
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/lib/credentials/oidc-federation.mjs
|
|
1741
1761
|
function oidcFederationProvider(config) {
|
|
1742
1762
|
return async () => {
|
|
1743
1763
|
requireSecureTokenEndpoint(config.baseURL);
|
|
@@ -1795,7 +1815,7 @@ function oidcFederationProvider(config) {
|
|
|
1795
1815
|
};
|
|
1796
1816
|
}
|
|
1797
1817
|
var init_oidc_federation = __esm({
|
|
1798
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
1818
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/lib/credentials/oidc-federation.mjs"() {
|
|
1799
1819
|
"use strict";
|
|
1800
1820
|
init_types();
|
|
1801
1821
|
init_time();
|
|
@@ -1803,7 +1823,7 @@ var init_oidc_federation = __esm({
|
|
|
1803
1823
|
}
|
|
1804
1824
|
});
|
|
1805
1825
|
|
|
1806
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
1826
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/lib/credentials/user-oauth.mjs
|
|
1807
1827
|
function userOAuthProvider(config) {
|
|
1808
1828
|
return async (opts) => {
|
|
1809
1829
|
const fs9 = await import("fs");
|
|
@@ -1877,7 +1897,7 @@ function userOAuthProvider(config) {
|
|
|
1877
1897
|
};
|
|
1878
1898
|
}
|
|
1879
1899
|
var init_user_oauth = __esm({
|
|
1880
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
1900
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/lib/credentials/user-oauth.mjs"() {
|
|
1881
1901
|
"use strict";
|
|
1882
1902
|
init_credentials();
|
|
1883
1903
|
init_types();
|
|
@@ -1886,7 +1906,7 @@ var init_user_oauth = __esm({
|
|
|
1886
1906
|
}
|
|
1887
1907
|
});
|
|
1888
1908
|
|
|
1889
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
1909
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/lib/credentials/credential-chain.mjs
|
|
1890
1910
|
function resolveCredentialsFromConfig(config, options) {
|
|
1891
1911
|
const credentialsPath = config.authentication.credentials_path ?? null;
|
|
1892
1912
|
const effectiveBaseURL = (config.base_url || options.baseURL).replace(/\/+$/, "");
|
|
@@ -2018,7 +2038,7 @@ function cachedExchangeProvider(exchange, credentialsPath, onCacheWriteError, on
|
|
|
2018
2038
|
};
|
|
2019
2039
|
}
|
|
2020
2040
|
var init_credential_chain = __esm({
|
|
2021
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
2041
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/lib/credentials/credential-chain.mjs"() {
|
|
2022
2042
|
"use strict";
|
|
2023
2043
|
init_env();
|
|
2024
2044
|
init_credentials();
|
|
@@ -2030,7 +2050,7 @@ var init_credential_chain = __esm({
|
|
|
2030
2050
|
}
|
|
2031
2051
|
});
|
|
2032
2052
|
|
|
2033
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
2053
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/internal/decoders/line.mjs
|
|
2034
2054
|
function findNewlineIndex(buffer, startIndex) {
|
|
2035
2055
|
const newline = 10;
|
|
2036
2056
|
const carriage = 13;
|
|
@@ -2062,7 +2082,7 @@ function findDoubleNewlineIndex(buffer) {
|
|
|
2062
2082
|
}
|
|
2063
2083
|
var _LineDecoder_buffer, _LineDecoder_carriageReturnIndex, LineDecoder;
|
|
2064
2084
|
var init_line = __esm({
|
|
2065
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
2085
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/internal/decoders/line.mjs"() {
|
|
2066
2086
|
"use strict";
|
|
2067
2087
|
init_tslib();
|
|
2068
2088
|
init_bytes();
|
|
@@ -2113,7 +2133,7 @@ var init_line = __esm({
|
|
|
2113
2133
|
}
|
|
2114
2134
|
});
|
|
2115
2135
|
|
|
2116
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
2136
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/core/streaming.mjs
|
|
2117
2137
|
async function* _iterSSEMessages(response, controller) {
|
|
2118
2138
|
if (!response.body) {
|
|
2119
2139
|
controller.abort();
|
|
@@ -2168,7 +2188,7 @@ function partition(str, delimiter2) {
|
|
|
2168
2188
|
}
|
|
2169
2189
|
var _Stream_client, Stream, SSEDecoder;
|
|
2170
2190
|
var init_streaming = __esm({
|
|
2171
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
2191
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/core/streaming.mjs"() {
|
|
2172
2192
|
"use strict";
|
|
2173
2193
|
init_tslib();
|
|
2174
2194
|
init_error();
|
|
@@ -2187,6 +2207,17 @@ var init_streaming = __esm({
|
|
|
2187
2207
|
this.controller = controller;
|
|
2188
2208
|
__classPrivateFieldSet(this, _Stream_client, client, "f");
|
|
2189
2209
|
}
|
|
2210
|
+
/**
|
|
2211
|
+
* Iterate the raw Server-Sent Events from `response` — `{event, data, raw}`
|
|
2212
|
+
* objects, before any JSON parsing or event-name filtering.
|
|
2213
|
+
*
|
|
2214
|
+
* This reads `response.body` directly (not a clone), so the response is
|
|
2215
|
+
* consumed. Use this in middleware that fully replaces the stream body; for
|
|
2216
|
+
* read-only observation of parsed events, use `ctx.parse()` instead.
|
|
2217
|
+
*/
|
|
2218
|
+
static rawEvents(response, controller = new AbortController()) {
|
|
2219
|
+
return _iterSSEMessages(response, controller);
|
|
2220
|
+
}
|
|
2190
2221
|
static fromSSEResponse(response, controller, client) {
|
|
2191
2222
|
let consumed = false;
|
|
2192
2223
|
const logger = client ? loggerFor(client) : console;
|
|
@@ -2379,15 +2410,12 @@ var init_streaming = __esm({
|
|
|
2379
2410
|
}
|
|
2380
2411
|
});
|
|
2381
2412
|
|
|
2382
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
2413
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/internal/parse.mjs
|
|
2383
2414
|
async function defaultParseResponse(client, props) {
|
|
2384
2415
|
const { response, requestLogID, retryOfRequestLogID, startTime } = props;
|
|
2385
2416
|
const body = await (async () => {
|
|
2386
2417
|
if (props.options.stream) {
|
|
2387
2418
|
loggerFor(client).debug("response", response.status, response.url, response.headers, response.body);
|
|
2388
|
-
if (props.options.__streamClass) {
|
|
2389
|
-
return props.options.__streamClass.fromSSEResponse(response, props.controller);
|
|
2390
|
-
}
|
|
2391
2419
|
return Stream.fromSSEResponse(response, props.controller);
|
|
2392
2420
|
}
|
|
2393
2421
|
if (response.status === 204) {
|
|
@@ -2429,17 +2457,124 @@ function addRequestID(value, response) {
|
|
|
2429
2457
|
});
|
|
2430
2458
|
}
|
|
2431
2459
|
var init_parse = __esm({
|
|
2432
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
2460
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/internal/parse.mjs"() {
|
|
2433
2461
|
"use strict";
|
|
2434
2462
|
init_streaming();
|
|
2435
2463
|
init_log();
|
|
2436
2464
|
}
|
|
2437
2465
|
});
|
|
2438
2466
|
|
|
2439
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
2467
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/core/middleware.mjs
|
|
2468
|
+
function isFetchOriginError(err) {
|
|
2469
|
+
return typeof err === "object" && err !== null && fetchOriginErrors.has(err);
|
|
2470
|
+
}
|
|
2471
|
+
function isRetryableError(err) {
|
|
2472
|
+
const seen = /* @__PURE__ */ new Set();
|
|
2473
|
+
while (typeof err === "object" && err !== null && !seen.has(err)) {
|
|
2474
|
+
seen.add(err);
|
|
2475
|
+
if (isFetchOriginError(err) || isAbortError(err) || err instanceof APIConnectionError || err instanceof RetryableError) {
|
|
2476
|
+
return true;
|
|
2477
|
+
}
|
|
2478
|
+
err = err.cause;
|
|
2479
|
+
}
|
|
2480
|
+
return false;
|
|
2481
|
+
}
|
|
2482
|
+
function wrapFetchWithMiddleware(fetchFn, middleware, options, client) {
|
|
2483
|
+
return async (url, init = {}) => {
|
|
2484
|
+
if (middleware.length === 0) {
|
|
2485
|
+
return fetchFn.call(void 0, url, init);
|
|
2486
|
+
}
|
|
2487
|
+
const headers = init.headers instanceof Headers ? init.headers : new Headers(init.headers);
|
|
2488
|
+
const response = await applyMiddleware(fetchFn, middleware, options, client)({
|
|
2489
|
+
...init,
|
|
2490
|
+
headers,
|
|
2491
|
+
url: typeof url === "string" ? url : url instanceof URL ? url.href : url.url
|
|
2492
|
+
});
|
|
2493
|
+
if (response.bodyUsed || response.body?.locked) {
|
|
2494
|
+
throw new AnthropicError("middleware consumed the response body; use response.clone() to inspect it, or return new Response(body, response) to consume and replace it");
|
|
2495
|
+
}
|
|
2496
|
+
return response;
|
|
2497
|
+
};
|
|
2498
|
+
}
|
|
2499
|
+
function createMiddlewareContext(options, client) {
|
|
2500
|
+
const cache = /* @__PURE__ */ new WeakMap();
|
|
2501
|
+
return {
|
|
2502
|
+
options,
|
|
2503
|
+
// Resolved per chain, so changes to the client's `logLevel`/`logger`
|
|
2504
|
+
// apply to subsequent requests.
|
|
2505
|
+
logger: client ? loggerFor(client) : defaultLogger(),
|
|
2506
|
+
parse(response) {
|
|
2507
|
+
if (options?.stream && response.ok) {
|
|
2508
|
+
return parseMiddlewareResponse(response, options);
|
|
2509
|
+
}
|
|
2510
|
+
let parsed = cache.get(response);
|
|
2511
|
+
if (!parsed) {
|
|
2512
|
+
parsed = parseMiddlewareResponse(response, options);
|
|
2513
|
+
cache.set(response, parsed);
|
|
2514
|
+
}
|
|
2515
|
+
return parsed;
|
|
2516
|
+
}
|
|
2517
|
+
};
|
|
2518
|
+
}
|
|
2519
|
+
async function parseMiddlewareResponse(response, options) {
|
|
2520
|
+
if (response.bodyUsed || response.body?.locked) {
|
|
2521
|
+
throw new AnthropicError("cannot ctx.parse() a response whose body was already consumed; call ctx.parse() instead of reading the body, or read via response.clone()");
|
|
2522
|
+
}
|
|
2523
|
+
if (options?.stream && response.ok) {
|
|
2524
|
+
return Stream.fromSSEResponse(response.clone(), new AbortController());
|
|
2525
|
+
}
|
|
2526
|
+
if (response.status === 204) {
|
|
2527
|
+
return null;
|
|
2528
|
+
}
|
|
2529
|
+
if (options?.__binaryResponse) {
|
|
2530
|
+
return response;
|
|
2531
|
+
}
|
|
2532
|
+
const contentType = response.headers.get("content-type");
|
|
2533
|
+
const mediaType = contentType?.split(";")[0]?.trim();
|
|
2534
|
+
const isJSON = mediaType?.includes("application/json") || mediaType?.endsWith("+json");
|
|
2535
|
+
if (isJSON) {
|
|
2536
|
+
if (response.headers.get("content-length") === "0") {
|
|
2537
|
+
return void 0;
|
|
2538
|
+
}
|
|
2539
|
+
return addRequestID(await response.clone().json(), response);
|
|
2540
|
+
}
|
|
2541
|
+
return await response.clone().text();
|
|
2542
|
+
}
|
|
2543
|
+
function applyMiddleware(fetchFn, middleware, options, client) {
|
|
2544
|
+
let next = async ({ url, ...init }) => {
|
|
2545
|
+
try {
|
|
2546
|
+
return await fetchFn.call(void 0, url, init);
|
|
2547
|
+
} catch (err) {
|
|
2548
|
+
const error = castToError(err);
|
|
2549
|
+
fetchOriginErrors.add(error);
|
|
2550
|
+
throw error;
|
|
2551
|
+
}
|
|
2552
|
+
};
|
|
2553
|
+
const ctx = createMiddlewareContext(options, client);
|
|
2554
|
+
for (let i = middleware.length - 1; i >= 0; i--) {
|
|
2555
|
+
const mw = middleware[i];
|
|
2556
|
+
const nextInner = next;
|
|
2557
|
+
next = async (request) => mw(request, nextInner, ctx);
|
|
2558
|
+
}
|
|
2559
|
+
return next;
|
|
2560
|
+
}
|
|
2561
|
+
var fetchOriginErrors;
|
|
2562
|
+
var init_middleware = __esm({
|
|
2563
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/core/middleware.mjs"() {
|
|
2564
|
+
"use strict";
|
|
2565
|
+
init_errors();
|
|
2566
|
+
init_parse();
|
|
2567
|
+
init_log();
|
|
2568
|
+
init_error();
|
|
2569
|
+
init_streaming();
|
|
2570
|
+
fetchOriginErrors = /* @__PURE__ */ new WeakSet();
|
|
2571
|
+
}
|
|
2572
|
+
});
|
|
2573
|
+
|
|
2574
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/core/api-promise.mjs
|
|
2440
2575
|
var _APIPromise_client, APIPromise;
|
|
2441
2576
|
var init_api_promise = __esm({
|
|
2442
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
2577
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/core/api-promise.mjs"() {
|
|
2443
2578
|
"use strict";
|
|
2444
2579
|
init_tslib();
|
|
2445
2580
|
init_parse();
|
|
@@ -2506,10 +2641,10 @@ var init_api_promise = __esm({
|
|
|
2506
2641
|
}
|
|
2507
2642
|
});
|
|
2508
2643
|
|
|
2509
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
2644
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/core/pagination.mjs
|
|
2510
2645
|
var _AbstractPage_client, AbstractPage, PagePromise, Page, PageCursor;
|
|
2511
2646
|
var init_pagination = __esm({
|
|
2512
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
2647
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/core/pagination.mjs"() {
|
|
2513
2648
|
"use strict";
|
|
2514
2649
|
init_tslib();
|
|
2515
2650
|
init_error();
|
|
@@ -2641,7 +2776,7 @@ var init_pagination = __esm({
|
|
|
2641
2776
|
}
|
|
2642
2777
|
});
|
|
2643
2778
|
|
|
2644
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
2779
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/internal/uploads.mjs
|
|
2645
2780
|
function makeFile(fileBits, fileName, options) {
|
|
2646
2781
|
checkFileSupport();
|
|
2647
2782
|
return new File(fileBits, fileName ?? "unknown_file", options);
|
|
@@ -2672,7 +2807,7 @@ function supportsFormData(fetchObject) {
|
|
|
2672
2807
|
}
|
|
2673
2808
|
var checkFileSupport, isAsyncIterable, multipartFormRequestOptions, supportsFormDataMap, createForm, isNamedBlob, addFormValue;
|
|
2674
2809
|
var init_uploads = __esm({
|
|
2675
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
2810
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/internal/uploads.mjs"() {
|
|
2676
2811
|
"use strict";
|
|
2677
2812
|
init_shims();
|
|
2678
2813
|
checkFileSupport = () => {
|
|
@@ -2726,7 +2861,7 @@ var init_uploads = __esm({
|
|
|
2726
2861
|
}
|
|
2727
2862
|
});
|
|
2728
2863
|
|
|
2729
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
2864
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/internal/to-file.mjs
|
|
2730
2865
|
async function toFile(value, name, options) {
|
|
2731
2866
|
checkFileSupport();
|
|
2732
2867
|
value = await value;
|
|
@@ -2780,7 +2915,7 @@ function propsForError(value) {
|
|
|
2780
2915
|
}
|
|
2781
2916
|
var isBlobLike, isFileLike, isResponseLike;
|
|
2782
2917
|
var init_to_file = __esm({
|
|
2783
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
2918
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/internal/to-file.mjs"() {
|
|
2784
2919
|
"use strict";
|
|
2785
2920
|
init_uploads();
|
|
2786
2921
|
init_uploads();
|
|
@@ -2790,25 +2925,25 @@ var init_to_file = __esm({
|
|
|
2790
2925
|
}
|
|
2791
2926
|
});
|
|
2792
2927
|
|
|
2793
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
2928
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/core/uploads.mjs
|
|
2794
2929
|
var init_uploads2 = __esm({
|
|
2795
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
2930
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/core/uploads.mjs"() {
|
|
2796
2931
|
"use strict";
|
|
2797
2932
|
init_to_file();
|
|
2798
2933
|
}
|
|
2799
2934
|
});
|
|
2800
2935
|
|
|
2801
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
2936
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/resources/shared.mjs
|
|
2802
2937
|
var init_shared = __esm({
|
|
2803
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
2938
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/resources/shared.mjs"() {
|
|
2804
2939
|
"use strict";
|
|
2805
2940
|
}
|
|
2806
2941
|
});
|
|
2807
2942
|
|
|
2808
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
2943
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/core/resource.mjs
|
|
2809
2944
|
var APIResource;
|
|
2810
2945
|
var init_resource = __esm({
|
|
2811
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
2946
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/core/resource.mjs"() {
|
|
2812
2947
|
"use strict";
|
|
2813
2948
|
APIResource = class {
|
|
2814
2949
|
constructor(client) {
|
|
@@ -2818,7 +2953,7 @@ var init_resource = __esm({
|
|
|
2818
2953
|
}
|
|
2819
2954
|
});
|
|
2820
2955
|
|
|
2821
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
2956
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/internal/headers.mjs
|
|
2822
2957
|
function* iterateHeaders(headers) {
|
|
2823
2958
|
if (!headers)
|
|
2824
2959
|
return;
|
|
@@ -2859,7 +2994,7 @@ function* iterateHeaders(headers) {
|
|
|
2859
2994
|
}
|
|
2860
2995
|
var brand_privateNullableHeaders, buildHeaders;
|
|
2861
2996
|
var init_headers = __esm({
|
|
2862
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
2997
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/internal/headers.mjs"() {
|
|
2863
2998
|
"use strict";
|
|
2864
2999
|
init_values();
|
|
2865
3000
|
brand_privateNullableHeaders = Symbol.for("brand.privateNullableHeaders");
|
|
@@ -2888,62 +3023,13 @@ var init_headers = __esm({
|
|
|
2888
3023
|
}
|
|
2889
3024
|
});
|
|
2890
3025
|
|
|
2891
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
2892
|
-
function wasCreatedByStainlessHelper(value) {
|
|
2893
|
-
return typeof value === "object" && value !== null && SDK_HELPER_SYMBOL in value;
|
|
2894
|
-
}
|
|
2895
|
-
function collectStainlessHelpers(tools, messages) {
|
|
2896
|
-
const helpers = /* @__PURE__ */ new Set();
|
|
2897
|
-
if (tools) {
|
|
2898
|
-
for (const tool of tools) {
|
|
2899
|
-
if (wasCreatedByStainlessHelper(tool)) {
|
|
2900
|
-
helpers.add(tool[SDK_HELPER_SYMBOL]);
|
|
2901
|
-
}
|
|
2902
|
-
}
|
|
2903
|
-
}
|
|
2904
|
-
if (messages) {
|
|
2905
|
-
for (const message of messages) {
|
|
2906
|
-
if (wasCreatedByStainlessHelper(message)) {
|
|
2907
|
-
helpers.add(message[SDK_HELPER_SYMBOL]);
|
|
2908
|
-
}
|
|
2909
|
-
if (Array.isArray(message.content)) {
|
|
2910
|
-
for (const block of message.content) {
|
|
2911
|
-
if (wasCreatedByStainlessHelper(block)) {
|
|
2912
|
-
helpers.add(block[SDK_HELPER_SYMBOL]);
|
|
2913
|
-
}
|
|
2914
|
-
}
|
|
2915
|
-
}
|
|
2916
|
-
}
|
|
2917
|
-
}
|
|
2918
|
-
return Array.from(helpers);
|
|
2919
|
-
}
|
|
2920
|
-
function stainlessHelperHeader(tools, messages) {
|
|
2921
|
-
const helpers = collectStainlessHelpers(tools, messages);
|
|
2922
|
-
if (helpers.length === 0)
|
|
2923
|
-
return {};
|
|
2924
|
-
return { "x-stainless-helper": helpers.join(", ") };
|
|
2925
|
-
}
|
|
2926
|
-
function stainlessHelperHeaderFromFile(file) {
|
|
2927
|
-
if (wasCreatedByStainlessHelper(file)) {
|
|
2928
|
-
return { "x-stainless-helper": file[SDK_HELPER_SYMBOL] };
|
|
2929
|
-
}
|
|
2930
|
-
return {};
|
|
2931
|
-
}
|
|
2932
|
-
var SDK_HELPER_SYMBOL;
|
|
2933
|
-
var init_stainless_helper_header = __esm({
|
|
2934
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.100.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/lib/stainless-helper-header.mjs"() {
|
|
2935
|
-
"use strict";
|
|
2936
|
-
SDK_HELPER_SYMBOL = Symbol("anthropic.sdk.stainlessHelper");
|
|
2937
|
-
}
|
|
2938
|
-
});
|
|
2939
|
-
|
|
2940
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.100.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/internal/utils/path.mjs
|
|
3026
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/internal/utils/path.mjs
|
|
2941
3027
|
function encodeURIPath(str) {
|
|
2942
3028
|
return str.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g, encodeURIComponent);
|
|
2943
3029
|
}
|
|
2944
3030
|
var EMPTY, createPathTagFunction, path4;
|
|
2945
3031
|
var init_path = __esm({
|
|
2946
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
3032
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/internal/utils/path.mjs"() {
|
|
2947
3033
|
"use strict";
|
|
2948
3034
|
init_error();
|
|
2949
3035
|
EMPTY = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.create(null));
|
|
@@ -2999,10 +3085,302 @@ ${underline}`);
|
|
|
2999
3085
|
}
|
|
3000
3086
|
});
|
|
3001
3087
|
|
|
3002
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
3088
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/resources/beta/deployment-runs.mjs
|
|
3089
|
+
var DeploymentRuns;
|
|
3090
|
+
var init_deployment_runs = __esm({
|
|
3091
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/resources/beta/deployment-runs.mjs"() {
|
|
3092
|
+
"use strict";
|
|
3093
|
+
init_resource();
|
|
3094
|
+
init_pagination();
|
|
3095
|
+
init_headers();
|
|
3096
|
+
init_path();
|
|
3097
|
+
DeploymentRuns = class extends APIResource {
|
|
3098
|
+
/**
|
|
3099
|
+
* Get Deployment Run
|
|
3100
|
+
*
|
|
3101
|
+
* @example
|
|
3102
|
+
* ```ts
|
|
3103
|
+
* const betaManagedAgentsDeploymentRun =
|
|
3104
|
+
* await client.beta.deploymentRuns.retrieve(
|
|
3105
|
+
* 'deployment_run_id',
|
|
3106
|
+
* );
|
|
3107
|
+
* ```
|
|
3108
|
+
*/
|
|
3109
|
+
retrieve(deploymentRunID, params = {}, options) {
|
|
3110
|
+
const { betas } = params ?? {};
|
|
3111
|
+
return this._client.get(path4`/v1/deployment_runs/${deploymentRunID}?beta=true`, {
|
|
3112
|
+
...options,
|
|
3113
|
+
headers: buildHeaders([
|
|
3114
|
+
{ "anthropic-beta": [...betas ?? [], "managed-agents-2026-04-01"].toString() },
|
|
3115
|
+
options?.headers
|
|
3116
|
+
])
|
|
3117
|
+
});
|
|
3118
|
+
}
|
|
3119
|
+
/**
|
|
3120
|
+
* List Deployment Runs
|
|
3121
|
+
*
|
|
3122
|
+
* @example
|
|
3123
|
+
* ```ts
|
|
3124
|
+
* // Automatically fetches more pages as needed.
|
|
3125
|
+
* for await (const betaManagedAgentsDeploymentRun of client.beta.deploymentRuns.list()) {
|
|
3126
|
+
* // ...
|
|
3127
|
+
* }
|
|
3128
|
+
* ```
|
|
3129
|
+
*/
|
|
3130
|
+
list(params = {}, options) {
|
|
3131
|
+
const { betas, ...query } = params ?? {};
|
|
3132
|
+
return this._client.getAPIList("/v1/deployment_runs?beta=true", PageCursor, {
|
|
3133
|
+
query,
|
|
3134
|
+
...options,
|
|
3135
|
+
headers: buildHeaders([
|
|
3136
|
+
{ "anthropic-beta": [...betas ?? [], "managed-agents-2026-04-01"].toString() },
|
|
3137
|
+
options?.headers
|
|
3138
|
+
])
|
|
3139
|
+
});
|
|
3140
|
+
}
|
|
3141
|
+
};
|
|
3142
|
+
}
|
|
3143
|
+
});
|
|
3144
|
+
|
|
3145
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/resources/beta/deployments.mjs
|
|
3146
|
+
var Deployments;
|
|
3147
|
+
var init_deployments = __esm({
|
|
3148
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/resources/beta/deployments.mjs"() {
|
|
3149
|
+
"use strict";
|
|
3150
|
+
init_resource();
|
|
3151
|
+
init_pagination();
|
|
3152
|
+
init_headers();
|
|
3153
|
+
init_path();
|
|
3154
|
+
Deployments = class extends APIResource {
|
|
3155
|
+
/**
|
|
3156
|
+
* Create Deployment
|
|
3157
|
+
*
|
|
3158
|
+
* @example
|
|
3159
|
+
* ```ts
|
|
3160
|
+
* const betaManagedAgentsDeployment =
|
|
3161
|
+
* await client.beta.deployments.create({
|
|
3162
|
+
* agent: 'string',
|
|
3163
|
+
* environment_id: 'x',
|
|
3164
|
+
* initial_events: [
|
|
3165
|
+
* {
|
|
3166
|
+
* content: [
|
|
3167
|
+
* {
|
|
3168
|
+
* text: 'Where is my order #1234?',
|
|
3169
|
+
* type: 'text',
|
|
3170
|
+
* },
|
|
3171
|
+
* ],
|
|
3172
|
+
* type: 'user.message',
|
|
3173
|
+
* },
|
|
3174
|
+
* ],
|
|
3175
|
+
* name: 'x',
|
|
3176
|
+
* });
|
|
3177
|
+
* ```
|
|
3178
|
+
*/
|
|
3179
|
+
create(params, options) {
|
|
3180
|
+
const { betas, ...body } = params;
|
|
3181
|
+
return this._client.post("/v1/deployments?beta=true", {
|
|
3182
|
+
body,
|
|
3183
|
+
...options,
|
|
3184
|
+
headers: buildHeaders([
|
|
3185
|
+
{ "anthropic-beta": [...betas ?? [], "managed-agents-2026-04-01"].toString() },
|
|
3186
|
+
options?.headers
|
|
3187
|
+
])
|
|
3188
|
+
});
|
|
3189
|
+
}
|
|
3190
|
+
/**
|
|
3191
|
+
* Get Deployment
|
|
3192
|
+
*
|
|
3193
|
+
* @example
|
|
3194
|
+
* ```ts
|
|
3195
|
+
* const betaManagedAgentsDeployment =
|
|
3196
|
+
* await client.beta.deployments.retrieve('deployment_id');
|
|
3197
|
+
* ```
|
|
3198
|
+
*/
|
|
3199
|
+
retrieve(deploymentID, params = {}, options) {
|
|
3200
|
+
const { betas } = params ?? {};
|
|
3201
|
+
return this._client.get(path4`/v1/deployments/${deploymentID}?beta=true`, {
|
|
3202
|
+
...options,
|
|
3203
|
+
headers: buildHeaders([
|
|
3204
|
+
{ "anthropic-beta": [...betas ?? [], "managed-agents-2026-04-01"].toString() },
|
|
3205
|
+
options?.headers
|
|
3206
|
+
])
|
|
3207
|
+
});
|
|
3208
|
+
}
|
|
3209
|
+
/**
|
|
3210
|
+
* Update Deployment
|
|
3211
|
+
*
|
|
3212
|
+
* @example
|
|
3213
|
+
* ```ts
|
|
3214
|
+
* const betaManagedAgentsDeployment =
|
|
3215
|
+
* await client.beta.deployments.update('deployment_id');
|
|
3216
|
+
* ```
|
|
3217
|
+
*/
|
|
3218
|
+
update(deploymentID, params, options) {
|
|
3219
|
+
const { betas, ...body } = params;
|
|
3220
|
+
return this._client.post(path4`/v1/deployments/${deploymentID}?beta=true`, {
|
|
3221
|
+
body,
|
|
3222
|
+
...options,
|
|
3223
|
+
headers: buildHeaders([
|
|
3224
|
+
{ "anthropic-beta": [...betas ?? [], "managed-agents-2026-04-01"].toString() },
|
|
3225
|
+
options?.headers
|
|
3226
|
+
])
|
|
3227
|
+
});
|
|
3228
|
+
}
|
|
3229
|
+
/**
|
|
3230
|
+
* List Deployments
|
|
3231
|
+
*
|
|
3232
|
+
* @example
|
|
3233
|
+
* ```ts
|
|
3234
|
+
* // Automatically fetches more pages as needed.
|
|
3235
|
+
* for await (const betaManagedAgentsDeployment of client.beta.deployments.list()) {
|
|
3236
|
+
* // ...
|
|
3237
|
+
* }
|
|
3238
|
+
* ```
|
|
3239
|
+
*/
|
|
3240
|
+
list(params = {}, options) {
|
|
3241
|
+
const { betas, ...query } = params ?? {};
|
|
3242
|
+
return this._client.getAPIList("/v1/deployments?beta=true", PageCursor, {
|
|
3243
|
+
query,
|
|
3244
|
+
...options,
|
|
3245
|
+
headers: buildHeaders([
|
|
3246
|
+
{ "anthropic-beta": [...betas ?? [], "managed-agents-2026-04-01"].toString() },
|
|
3247
|
+
options?.headers
|
|
3248
|
+
])
|
|
3249
|
+
});
|
|
3250
|
+
}
|
|
3251
|
+
/**
|
|
3252
|
+
* Archive Deployment
|
|
3253
|
+
*
|
|
3254
|
+
* @example
|
|
3255
|
+
* ```ts
|
|
3256
|
+
* const betaManagedAgentsDeployment =
|
|
3257
|
+
* await client.beta.deployments.archive('deployment_id');
|
|
3258
|
+
* ```
|
|
3259
|
+
*/
|
|
3260
|
+
archive(deploymentID, params = {}, options) {
|
|
3261
|
+
const { betas } = params ?? {};
|
|
3262
|
+
return this._client.post(path4`/v1/deployments/${deploymentID}/archive?beta=true`, {
|
|
3263
|
+
...options,
|
|
3264
|
+
headers: buildHeaders([
|
|
3265
|
+
{ "anthropic-beta": [...betas ?? [], "managed-agents-2026-04-01"].toString() },
|
|
3266
|
+
options?.headers
|
|
3267
|
+
])
|
|
3268
|
+
});
|
|
3269
|
+
}
|
|
3270
|
+
/**
|
|
3271
|
+
* Pause Deployment
|
|
3272
|
+
*
|
|
3273
|
+
* @example
|
|
3274
|
+
* ```ts
|
|
3275
|
+
* const betaManagedAgentsDeployment =
|
|
3276
|
+
* await client.beta.deployments.pause('deployment_id');
|
|
3277
|
+
* ```
|
|
3278
|
+
*/
|
|
3279
|
+
pause(deploymentID, params = {}, options) {
|
|
3280
|
+
const { betas } = params ?? {};
|
|
3281
|
+
return this._client.post(path4`/v1/deployments/${deploymentID}/pause?beta=true`, {
|
|
3282
|
+
...options,
|
|
3283
|
+
headers: buildHeaders([
|
|
3284
|
+
{ "anthropic-beta": [...betas ?? [], "managed-agents-2026-04-01"].toString() },
|
|
3285
|
+
options?.headers
|
|
3286
|
+
])
|
|
3287
|
+
});
|
|
3288
|
+
}
|
|
3289
|
+
/**
|
|
3290
|
+
* Run Deployment Now
|
|
3291
|
+
*
|
|
3292
|
+
* @example
|
|
3293
|
+
* ```ts
|
|
3294
|
+
* const betaManagedAgentsDeploymentRun =
|
|
3295
|
+
* await client.beta.deployments.run('deployment_id');
|
|
3296
|
+
* ```
|
|
3297
|
+
*/
|
|
3298
|
+
run(deploymentID, params = {}, options) {
|
|
3299
|
+
const { betas } = params ?? {};
|
|
3300
|
+
return this._client.post(path4`/v1/deployments/${deploymentID}/run?beta=true`, {
|
|
3301
|
+
...options,
|
|
3302
|
+
headers: buildHeaders([
|
|
3303
|
+
{ "anthropic-beta": [...betas ?? [], "managed-agents-2026-04-01"].toString() },
|
|
3304
|
+
options?.headers
|
|
3305
|
+
])
|
|
3306
|
+
});
|
|
3307
|
+
}
|
|
3308
|
+
/**
|
|
3309
|
+
* Unpause Deployment
|
|
3310
|
+
*
|
|
3311
|
+
* @example
|
|
3312
|
+
* ```ts
|
|
3313
|
+
* const betaManagedAgentsDeployment =
|
|
3314
|
+
* await client.beta.deployments.unpause('deployment_id');
|
|
3315
|
+
* ```
|
|
3316
|
+
*/
|
|
3317
|
+
unpause(deploymentID, params = {}, options) {
|
|
3318
|
+
const { betas } = params ?? {};
|
|
3319
|
+
return this._client.post(path4`/v1/deployments/${deploymentID}/unpause?beta=true`, {
|
|
3320
|
+
...options,
|
|
3321
|
+
headers: buildHeaders([
|
|
3322
|
+
{ "anthropic-beta": [...betas ?? [], "managed-agents-2026-04-01"].toString() },
|
|
3323
|
+
options?.headers
|
|
3324
|
+
])
|
|
3325
|
+
});
|
|
3326
|
+
}
|
|
3327
|
+
};
|
|
3328
|
+
}
|
|
3329
|
+
});
|
|
3330
|
+
|
|
3331
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/lib/stainless-helper-header.mjs
|
|
3332
|
+
function wasCreatedByStainlessHelper(value) {
|
|
3333
|
+
return typeof value === "object" && value !== null && SDK_HELPER_SYMBOL in value;
|
|
3334
|
+
}
|
|
3335
|
+
function collectStainlessHelpers(tools, messages) {
|
|
3336
|
+
const helpers = /* @__PURE__ */ new Set();
|
|
3337
|
+
if (tools) {
|
|
3338
|
+
for (const tool of tools) {
|
|
3339
|
+
if (wasCreatedByStainlessHelper(tool)) {
|
|
3340
|
+
helpers.add(tool[SDK_HELPER_SYMBOL]);
|
|
3341
|
+
}
|
|
3342
|
+
}
|
|
3343
|
+
}
|
|
3344
|
+
if (messages) {
|
|
3345
|
+
for (const message of messages) {
|
|
3346
|
+
if (wasCreatedByStainlessHelper(message)) {
|
|
3347
|
+
helpers.add(message[SDK_HELPER_SYMBOL]);
|
|
3348
|
+
}
|
|
3349
|
+
if (Array.isArray(message.content)) {
|
|
3350
|
+
for (const block of message.content) {
|
|
3351
|
+
if (wasCreatedByStainlessHelper(block)) {
|
|
3352
|
+
helpers.add(block[SDK_HELPER_SYMBOL]);
|
|
3353
|
+
}
|
|
3354
|
+
}
|
|
3355
|
+
}
|
|
3356
|
+
}
|
|
3357
|
+
}
|
|
3358
|
+
return Array.from(helpers);
|
|
3359
|
+
}
|
|
3360
|
+
function stainlessHelperHeader(tools, messages) {
|
|
3361
|
+
const helpers = collectStainlessHelpers(tools, messages);
|
|
3362
|
+
if (helpers.length === 0)
|
|
3363
|
+
return {};
|
|
3364
|
+
return { "x-stainless-helper": helpers.join(", ") };
|
|
3365
|
+
}
|
|
3366
|
+
function stainlessHelperHeaderFromFile(file) {
|
|
3367
|
+
if (wasCreatedByStainlessHelper(file)) {
|
|
3368
|
+
return { "x-stainless-helper": file[SDK_HELPER_SYMBOL] };
|
|
3369
|
+
}
|
|
3370
|
+
return {};
|
|
3371
|
+
}
|
|
3372
|
+
var SDK_HELPER_SYMBOL;
|
|
3373
|
+
var init_stainless_helper_header = __esm({
|
|
3374
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/lib/stainless-helper-header.mjs"() {
|
|
3375
|
+
"use strict";
|
|
3376
|
+
SDK_HELPER_SYMBOL = Symbol("anthropic.sdk.stainlessHelper");
|
|
3377
|
+
}
|
|
3378
|
+
});
|
|
3379
|
+
|
|
3380
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/resources/beta/files.mjs
|
|
3003
3381
|
var Files;
|
|
3004
3382
|
var init_files = __esm({
|
|
3005
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
3383
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/resources/beta/files.mjs"() {
|
|
3006
3384
|
"use strict";
|
|
3007
3385
|
init_resource();
|
|
3008
3386
|
init_pagination();
|
|
@@ -3125,10 +3503,10 @@ var init_files = __esm({
|
|
|
3125
3503
|
}
|
|
3126
3504
|
});
|
|
3127
3505
|
|
|
3128
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
3506
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/resources/beta/models.mjs
|
|
3129
3507
|
var Models;
|
|
3130
3508
|
var init_models = __esm({
|
|
3131
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
3509
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/resources/beta/models.mjs"() {
|
|
3132
3510
|
"use strict";
|
|
3133
3511
|
init_resource();
|
|
3134
3512
|
init_pagination();
|
|
@@ -3187,10 +3565,10 @@ var init_models = __esm({
|
|
|
3187
3565
|
}
|
|
3188
3566
|
});
|
|
3189
3567
|
|
|
3190
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
3568
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/resources/beta/user-profiles.mjs
|
|
3191
3569
|
var UserProfiles;
|
|
3192
3570
|
var init_user_profiles = __esm({
|
|
3193
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
3571
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/resources/beta/user-profiles.mjs"() {
|
|
3194
3572
|
"use strict";
|
|
3195
3573
|
init_resource();
|
|
3196
3574
|
init_pagination();
|
|
@@ -4042,13 +4420,13 @@ var require_dist = __commonJS({
|
|
|
4042
4420
|
const computedSignature = this.sign(msgId, timestamp, payload);
|
|
4043
4421
|
const expectedSignature = computedSignature.split(",")[1];
|
|
4044
4422
|
const passedSignatures = msgSignature.split(" ");
|
|
4045
|
-
const
|
|
4423
|
+
const encoder2 = new globalThis.TextEncoder();
|
|
4046
4424
|
for (const versionedSignature of passedSignatures) {
|
|
4047
4425
|
const [version, signature] = versionedSignature.split(",");
|
|
4048
4426
|
if (version !== "v1") {
|
|
4049
4427
|
continue;
|
|
4050
4428
|
}
|
|
4051
|
-
if ((0, timing_safe_equal_1.timingSafeEqual)(
|
|
4429
|
+
if ((0, timing_safe_equal_1.timingSafeEqual)(encoder2.encode(signature), encoder2.encode(expectedSignature))) {
|
|
4052
4430
|
return JSON.parse(payload.toString());
|
|
4053
4431
|
}
|
|
4054
4432
|
}
|
|
@@ -4061,9 +4439,9 @@ var require_dist = __commonJS({
|
|
|
4061
4439
|
} else {
|
|
4062
4440
|
throw new Error("Expected payload to be of type string or Buffer.");
|
|
4063
4441
|
}
|
|
4064
|
-
const
|
|
4442
|
+
const encoder2 = new TextEncoder();
|
|
4065
4443
|
const timestampNumber = Math.floor(timestamp.getTime() / 1e3);
|
|
4066
|
-
const toSign =
|
|
4444
|
+
const toSign = encoder2.encode(`${msgId}.${timestampNumber}.${payload}`);
|
|
4067
4445
|
const expectedSignature = base64.encode(sha256.hmac(this.key, toSign));
|
|
4068
4446
|
return `v1,${expectedSignature}`;
|
|
4069
4447
|
}
|
|
@@ -4087,10 +4465,10 @@ var require_dist = __commonJS({
|
|
|
4087
4465
|
}
|
|
4088
4466
|
});
|
|
4089
4467
|
|
|
4090
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
4468
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/resources/beta/webhooks.mjs
|
|
4091
4469
|
var import_standardwebhooks, Webhooks;
|
|
4092
4470
|
var init_webhooks = __esm({
|
|
4093
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
4471
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/resources/beta/webhooks.mjs"() {
|
|
4094
4472
|
"use strict";
|
|
4095
4473
|
init_resource();
|
|
4096
4474
|
import_standardwebhooks = __toESM(require_dist(), 1);
|
|
@@ -4109,10 +4487,10 @@ var init_webhooks = __esm({
|
|
|
4109
4487
|
}
|
|
4110
4488
|
});
|
|
4111
4489
|
|
|
4112
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
4490
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/resources/beta/agents/versions.mjs
|
|
4113
4491
|
var Versions;
|
|
4114
4492
|
var init_versions = __esm({
|
|
4115
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
4493
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/resources/beta/agents/versions.mjs"() {
|
|
4116
4494
|
"use strict";
|
|
4117
4495
|
init_resource();
|
|
4118
4496
|
init_pagination();
|
|
@@ -4147,10 +4525,10 @@ var init_versions = __esm({
|
|
|
4147
4525
|
}
|
|
4148
4526
|
});
|
|
4149
4527
|
|
|
4150
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
4528
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/resources/beta/agents/agents.mjs
|
|
4151
4529
|
var Agents;
|
|
4152
4530
|
var init_agents = __esm({
|
|
4153
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
4531
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/resources/beta/agents/agents.mjs"() {
|
|
4154
4532
|
"use strict";
|
|
4155
4533
|
init_resource();
|
|
4156
4534
|
init_versions();
|
|
@@ -4279,7 +4657,7 @@ var init_agents = __esm({
|
|
|
4279
4657
|
}
|
|
4280
4658
|
});
|
|
4281
4659
|
|
|
4282
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
4660
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/internal/utils/abort.mjs
|
|
4283
4661
|
function linkAbort(external, controller) {
|
|
4284
4662
|
if (!external)
|
|
4285
4663
|
return () => {
|
|
@@ -4294,12 +4672,12 @@ function linkAbort(external, controller) {
|
|
|
4294
4672
|
return () => external.removeEventListener("abort", onAbort);
|
|
4295
4673
|
}
|
|
4296
4674
|
var init_abort = __esm({
|
|
4297
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
4675
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/internal/utils/abort.mjs"() {
|
|
4298
4676
|
"use strict";
|
|
4299
4677
|
}
|
|
4300
4678
|
});
|
|
4301
4679
|
|
|
4302
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
4680
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/internal/utils/backoff.mjs
|
|
4303
4681
|
function isStatus(e, code) {
|
|
4304
4682
|
return e instanceof APIError && e.status === code;
|
|
4305
4683
|
}
|
|
@@ -4319,13 +4697,13 @@ function applyJitter(ms) {
|
|
|
4319
4697
|
return ms * (1 - Math.random() * 0.25);
|
|
4320
4698
|
}
|
|
4321
4699
|
var init_backoff = __esm({
|
|
4322
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
4700
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/internal/utils/backoff.mjs"() {
|
|
4323
4701
|
"use strict";
|
|
4324
4702
|
init_error();
|
|
4325
4703
|
}
|
|
4326
4704
|
});
|
|
4327
4705
|
|
|
4328
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
4706
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/lib/helper-client.mjs
|
|
4329
4707
|
function copyClientForHelper(client, { authToken, helper }) {
|
|
4330
4708
|
if (!authToken) {
|
|
4331
4709
|
throw new AnthropicError(`copyClientForHelper: expected a non-empty authToken but received ${JSON.stringify(authToken)}`);
|
|
@@ -4351,14 +4729,14 @@ function copyClientForHelper(client, { authToken, helper }) {
|
|
|
4351
4729
|
});
|
|
4352
4730
|
}
|
|
4353
4731
|
var init_helper_client = __esm({
|
|
4354
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
4732
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/lib/helper-client.mjs"() {
|
|
4355
4733
|
"use strict";
|
|
4356
4734
|
init_error();
|
|
4357
4735
|
init_headers();
|
|
4358
4736
|
}
|
|
4359
4737
|
});
|
|
4360
4738
|
|
|
4361
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
4739
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/lib/environments/poller.mjs
|
|
4362
4740
|
function backoff2(attempt) {
|
|
4363
4741
|
return backoff(attempt, POLL_BACKOFF_BASE_MS, POLL_BACKOFF_CAP_MS);
|
|
4364
4742
|
}
|
|
@@ -4369,7 +4747,7 @@ function defaultWorkerId() {
|
|
|
4369
4747
|
}
|
|
4370
4748
|
var _WorkPoller_runnerClient, _WorkPoller_consumed, _WorkPoller_controller, _WorkPoller_detachExternal, _WorkPoller_autoStop, _WorkPoller_drain, _WorkPoller_blockMs, _WorkPoller_reclaimOlderThanMs, _WorkPoller_requestOpts, POLL_BLOCK_MS, POLL_BACKOFF_BASE_MS, POLL_BACKOFF_CAP_MS, WorkPoller;
|
|
4371
4749
|
var init_poller = __esm({
|
|
4372
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
4750
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/lib/environments/poller.mjs"() {
|
|
4373
4751
|
"use strict";
|
|
4374
4752
|
init_tslib();
|
|
4375
4753
|
init_error();
|
|
@@ -4492,10 +4870,10 @@ var init_poller = __esm({
|
|
|
4492
4870
|
}
|
|
4493
4871
|
});
|
|
4494
4872
|
|
|
4495
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
4873
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/internal/utils/async-queue.mjs
|
|
4496
4874
|
var _AsyncQueue_items, _AsyncQueue_waiters, _AsyncQueue_closed, AsyncQueue;
|
|
4497
4875
|
var init_async_queue = __esm({
|
|
4498
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
4876
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/internal/utils/async-queue.mjs"() {
|
|
4499
4877
|
"use strict";
|
|
4500
4878
|
init_tslib();
|
|
4501
4879
|
AsyncQueue = class {
|
|
@@ -4562,10 +4940,10 @@ var init_async_queue = __esm({
|
|
|
4562
4940
|
}
|
|
4563
4941
|
});
|
|
4564
4942
|
|
|
4565
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
4943
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/lib/tools/ToolError.mjs
|
|
4566
4944
|
var ToolError;
|
|
4567
4945
|
var init_ToolError = __esm({
|
|
4568
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
4946
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/lib/tools/ToolError.mjs"() {
|
|
4569
4947
|
"use strict";
|
|
4570
4948
|
ToolError = class extends Error {
|
|
4571
4949
|
constructor(content) {
|
|
@@ -4582,7 +4960,7 @@ var init_ToolError = __esm({
|
|
|
4582
4960
|
}
|
|
4583
4961
|
});
|
|
4584
4962
|
|
|
4585
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
4963
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/lib/tools/BetaRunnableTool.mjs
|
|
4586
4964
|
function toolName(tool) {
|
|
4587
4965
|
return "name" in tool ? tool.name : tool.mcp_server_name;
|
|
4588
4966
|
}
|
|
@@ -4599,13 +4977,13 @@ async function runRunnableTool(tool, rawInput, context) {
|
|
|
4599
4977
|
}
|
|
4600
4978
|
}
|
|
4601
4979
|
var init_BetaRunnableTool = __esm({
|
|
4602
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
4980
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/lib/tools/BetaRunnableTool.mjs"() {
|
|
4603
4981
|
"use strict";
|
|
4604
4982
|
init_ToolError();
|
|
4605
4983
|
}
|
|
4606
4984
|
});
|
|
4607
4985
|
|
|
4608
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
4986
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/lib/tools/SessionToolRunner.mjs
|
|
4609
4987
|
function isEndTurnIdle(ev) {
|
|
4610
4988
|
return ev.type === "session.status_idle" && ev.stop_reason?.type === "end_turn";
|
|
4611
4989
|
}
|
|
@@ -4638,7 +5016,7 @@ function toSessionContent(content) {
|
|
|
4638
5016
|
}
|
|
4639
5017
|
var _SessionToolRunner_instances, _SessionToolRunner_consumed, _SessionToolRunner_controller, _SessionToolRunner_detachExternal, _SessionToolRunner_requestOpts, _SessionToolRunner_toolByName, _SessionToolRunner_logger, _SessionToolRunner_seen, _SessionToolRunner_answered, _SessionToolRunner_results, _SessionToolRunner_inFlightCount, _SessionToolRunner_onIdle, _SessionToolRunner_idleTimer, _SessionToolRunner_requestOptions, _SessionToolRunner_streamLoop, _SessionToolRunner_reconcile, _SessionToolRunner_ingestHistory, _SessionToolRunner_handleStreamEvent, _SessionToolRunner_armIdleTimer, _SessionToolRunner_disarmIdleTimer, _SessionToolRunner_execute, _SessionToolRunner_sendResult, _SessionToolRunner_drain, HELPER_NAME, STREAM_BACKOFF_START_MS, STREAM_BACKOFF_CAP_MS, TOOL_TIMEOUT_MS, DRAIN_TIMEOUT_MS, SEND_RETRIES, DEFAULT_MAX_IDLE_MS, SessionToolRunner;
|
|
4640
5018
|
var init_SessionToolRunner = __esm({
|
|
4641
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
5019
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/lib/tools/SessionToolRunner.mjs"() {
|
|
4642
5020
|
"use strict";
|
|
4643
5021
|
init_tslib();
|
|
4644
5022
|
init_error();
|
|
@@ -4949,15 +5327,15 @@ var init_SessionToolRunner = __esm({
|
|
|
4949
5327
|
}
|
|
4950
5328
|
});
|
|
4951
5329
|
|
|
4952
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
5330
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/lib/transform-json-schema.mjs
|
|
4953
5331
|
var init_transform_json_schema = __esm({
|
|
4954
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
5332
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/lib/transform-json-schema.mjs"() {
|
|
4955
5333
|
"use strict";
|
|
4956
5334
|
init_utils2();
|
|
4957
5335
|
}
|
|
4958
5336
|
});
|
|
4959
5337
|
|
|
4960
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
5338
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/helpers/beta/json-schema.mjs
|
|
4961
5339
|
function betaTool(options) {
|
|
4962
5340
|
if (options.inputSchema.type !== "object") {
|
|
4963
5341
|
throw new Error(`JSON schema for tool "${options.name}" must be an object, but got ${options.inputSchema.type}`);
|
|
@@ -4973,14 +5351,14 @@ function betaTool(options) {
|
|
|
4973
5351
|
};
|
|
4974
5352
|
}
|
|
4975
5353
|
var init_json_schema = __esm({
|
|
4976
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
5354
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/helpers/beta/json-schema.mjs"() {
|
|
4977
5355
|
"use strict";
|
|
4978
5356
|
init_sdk();
|
|
4979
5357
|
init_transform_json_schema();
|
|
4980
5358
|
}
|
|
4981
5359
|
});
|
|
4982
5360
|
|
|
4983
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
5361
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/internal/utils/promise.mjs
|
|
4984
5362
|
function promiseWithResolvers() {
|
|
4985
5363
|
let resolve7;
|
|
4986
5364
|
let reject;
|
|
@@ -4991,12 +5369,12 @@ function promiseWithResolvers() {
|
|
|
4991
5369
|
return { promise, resolve: resolve7, reject };
|
|
4992
5370
|
}
|
|
4993
5371
|
var init_promise = __esm({
|
|
4994
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
5372
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/internal/utils/promise.mjs"() {
|
|
4995
5373
|
"use strict";
|
|
4996
5374
|
}
|
|
4997
5375
|
});
|
|
4998
5376
|
|
|
4999
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
5377
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/tools/agent-toolset/fs-util.mjs
|
|
5000
5378
|
import * as fs4 from "fs/promises";
|
|
5001
5379
|
import * as path5 from "path";
|
|
5002
5380
|
import { randomUUID } from "crypto";
|
|
@@ -5100,7 +5478,7 @@ function fsErrorMessage(err, file) {
|
|
|
5100
5478
|
}
|
|
5101
5479
|
var DIR_CREATE_MODE, FILE_CREATE_MODE;
|
|
5102
5480
|
var init_fs_util = __esm({
|
|
5103
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
5481
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/tools/agent-toolset/fs-util.mjs"() {
|
|
5104
5482
|
"use strict";
|
|
5105
5483
|
init_ToolError();
|
|
5106
5484
|
DIR_CREATE_MODE = 493;
|
|
@@ -5108,7 +5486,7 @@ var init_fs_util = __esm({
|
|
|
5108
5486
|
}
|
|
5109
5487
|
});
|
|
5110
5488
|
|
|
5111
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
5489
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/tools/agent-toolset/skills.mjs
|
|
5112
5490
|
import * as fs5 from "fs/promises";
|
|
5113
5491
|
import * as fssync from "fs";
|
|
5114
5492
|
import * as path6 from "path";
|
|
@@ -5129,10 +5507,10 @@ async function setupSkills(ctx) {
|
|
|
5129
5507
|
try {
|
|
5130
5508
|
const versionId = await resolveSkillVersion(client, skill.skill_id, skill.version);
|
|
5131
5509
|
const version = await client.beta.skills.versions.retrieve(versionId, { skill_id: skill.skill_id });
|
|
5132
|
-
let
|
|
5133
|
-
if (
|
|
5134
|
-
|
|
5135
|
-
const dest = path6.resolve(skillsRoot,
|
|
5510
|
+
let dirname5 = path6.basename(version.name.trim());
|
|
5511
|
+
if (dirname5 === "" || dirname5 === "." || dirname5 === "..")
|
|
5512
|
+
dirname5 = skill.skill_id;
|
|
5513
|
+
const dest = path6.resolve(skillsRoot, dirname5);
|
|
5136
5514
|
if (dest !== skillsRoot && !dest.startsWith(skillsRoot + path6.sep)) {
|
|
5137
5515
|
log.warn("skill name escapes the skills dir; skipping", {
|
|
5138
5516
|
component: "agent-tool-context",
|
|
@@ -5265,7 +5643,7 @@ async function readHead(file, n) {
|
|
|
5265
5643
|
}
|
|
5266
5644
|
var execFileAsync;
|
|
5267
5645
|
var init_skills = __esm({
|
|
5268
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
5646
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/tools/agent-toolset/skills.mjs"() {
|
|
5269
5647
|
"use strict";
|
|
5270
5648
|
init_error();
|
|
5271
5649
|
init_log();
|
|
@@ -5274,7 +5652,7 @@ var init_skills = __esm({
|
|
|
5274
5652
|
}
|
|
5275
5653
|
});
|
|
5276
5654
|
|
|
5277
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
5655
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.mjs
|
|
5278
5656
|
var node_exports = {};
|
|
5279
5657
|
__export(node_exports, {
|
|
5280
5658
|
BashSession: () => BashSession,
|
|
@@ -5720,7 +6098,7 @@ async function findRg() {
|
|
|
5720
6098
|
}
|
|
5721
6099
|
var _BashSession_instances, _BashSession_proc, _BashSession_buf, _BashSession_truncated, _BashSession_closed, _BashSession_waiting, _BashSession_append, BASH_OUTPUT_LIMIT, BASH_DEFAULT_TIMEOUT_MS, DEFAULT_MAX_FILE_BYTES, GREP_OUTPUT_LIMIT, GREP_MAX_LINE_LENGTH, GLOB_RESULT_LIMIT, ANSI_RE, fsGlob, BashSession, WALK_MAX_DEPTH, WALK_MAX_ENTRIES;
|
|
5722
6100
|
var init_node = __esm({
|
|
5723
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
6101
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.mjs"() {
|
|
5724
6102
|
"use strict";
|
|
5725
6103
|
init_tslib();
|
|
5726
6104
|
init_error();
|
|
@@ -5863,7 +6241,7 @@ ${out}`;
|
|
|
5863
6241
|
}
|
|
5864
6242
|
});
|
|
5865
6243
|
|
|
5866
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
6244
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/lib/environments/worker.mjs
|
|
5867
6245
|
async function forceStop(client, work, log, requestOptions) {
|
|
5868
6246
|
try {
|
|
5869
6247
|
await client.beta.environments.work.stop(
|
|
@@ -5917,7 +6295,7 @@ async function heartbeatLoop(client, work, ctrl, logger, requestOptions) {
|
|
|
5917
6295
|
}
|
|
5918
6296
|
var _EnvironmentWorker_instances, _EnvironmentWorker_signal, _EnvironmentWorker_handleItem, HEARTBEAT_DEFAULT_MS, NO_HEARTBEAT_SENTINEL, EnvironmentWorker;
|
|
5919
6297
|
var init_worker = __esm({
|
|
5920
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
6298
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/lib/environments/worker.mjs"() {
|
|
5921
6299
|
"use strict";
|
|
5922
6300
|
init_tslib();
|
|
5923
6301
|
init_error();
|
|
@@ -6076,10 +6454,10 @@ var init_worker = __esm({
|
|
|
6076
6454
|
}
|
|
6077
6455
|
});
|
|
6078
6456
|
|
|
6079
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
6457
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/resources/beta/environments/work.mjs
|
|
6080
6458
|
var Work;
|
|
6081
6459
|
var init_work = __esm({
|
|
6082
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
6460
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/resources/beta/environments/work.mjs"() {
|
|
6083
6461
|
"use strict";
|
|
6084
6462
|
init_resource();
|
|
6085
6463
|
init_pagination();
|
|
@@ -6350,10 +6728,10 @@ var init_work = __esm({
|
|
|
6350
6728
|
}
|
|
6351
6729
|
});
|
|
6352
6730
|
|
|
6353
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
6731
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/resources/beta/environments/environments.mjs
|
|
6354
6732
|
var Environments;
|
|
6355
6733
|
var init_environments = __esm({
|
|
6356
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
6734
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/resources/beta/environments/environments.mjs"() {
|
|
6357
6735
|
"use strict";
|
|
6358
6736
|
init_resource();
|
|
6359
6737
|
init_work();
|
|
@@ -6501,10 +6879,10 @@ var init_environments = __esm({
|
|
|
6501
6879
|
}
|
|
6502
6880
|
});
|
|
6503
6881
|
|
|
6504
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
6882
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memories.mjs
|
|
6505
6883
|
var Memories;
|
|
6506
6884
|
var init_memories = __esm({
|
|
6507
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
6885
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memories.mjs"() {
|
|
6508
6886
|
"use strict";
|
|
6509
6887
|
init_resource();
|
|
6510
6888
|
init_pagination();
|
|
@@ -6633,10 +7011,10 @@ var init_memories = __esm({
|
|
|
6633
7011
|
}
|
|
6634
7012
|
});
|
|
6635
7013
|
|
|
6636
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
7014
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memory-versions.mjs
|
|
6637
7015
|
var MemoryVersions;
|
|
6638
7016
|
var init_memory_versions = __esm({
|
|
6639
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
7017
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memory-versions.mjs"() {
|
|
6640
7018
|
"use strict";
|
|
6641
7019
|
init_resource();
|
|
6642
7020
|
init_pagination();
|
|
@@ -6716,10 +7094,10 @@ var init_memory_versions = __esm({
|
|
|
6716
7094
|
}
|
|
6717
7095
|
});
|
|
6718
7096
|
|
|
6719
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
7097
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memory-stores.mjs
|
|
6720
7098
|
var MemoryStores;
|
|
6721
7099
|
var init_memory_stores = __esm({
|
|
6722
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
7100
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memory-stores.mjs"() {
|
|
6723
7101
|
"use strict";
|
|
6724
7102
|
init_resource();
|
|
6725
7103
|
init_memories();
|
|
@@ -6862,18 +7240,18 @@ var init_memory_stores = __esm({
|
|
|
6862
7240
|
}
|
|
6863
7241
|
});
|
|
6864
7242
|
|
|
6865
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
7243
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/error.mjs
|
|
6866
7244
|
var init_error2 = __esm({
|
|
6867
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
7245
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/error.mjs"() {
|
|
6868
7246
|
"use strict";
|
|
6869
7247
|
init_error();
|
|
6870
7248
|
}
|
|
6871
7249
|
});
|
|
6872
7250
|
|
|
6873
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
7251
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/internal/decoders/jsonl.mjs
|
|
6874
7252
|
var JSONLDecoder;
|
|
6875
7253
|
var init_jsonl = __esm({
|
|
6876
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
7254
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/internal/decoders/jsonl.mjs"() {
|
|
6877
7255
|
"use strict";
|
|
6878
7256
|
init_error();
|
|
6879
7257
|
init_shims();
|
|
@@ -6911,10 +7289,10 @@ var init_jsonl = __esm({
|
|
|
6911
7289
|
}
|
|
6912
7290
|
});
|
|
6913
7291
|
|
|
6914
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
7292
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/resources/beta/messages/batches.mjs
|
|
6915
7293
|
var Batches;
|
|
6916
7294
|
var init_batches = __esm({
|
|
6917
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
7295
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/resources/beta/messages/batches.mjs"() {
|
|
6918
7296
|
"use strict";
|
|
6919
7297
|
init_resource();
|
|
6920
7298
|
init_pagination();
|
|
@@ -7115,10 +7493,10 @@ var init_batches = __esm({
|
|
|
7115
7493
|
}
|
|
7116
7494
|
});
|
|
7117
7495
|
|
|
7118
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
7496
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/internal/constants.mjs
|
|
7119
7497
|
var MODEL_NONSTREAMING_TOKENS;
|
|
7120
7498
|
var init_constants = __esm({
|
|
7121
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
7499
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/internal/constants.mjs"() {
|
|
7122
7500
|
"use strict";
|
|
7123
7501
|
MODEL_NONSTREAMING_TOKENS = {
|
|
7124
7502
|
"claude-opus-4-20250514": 8192,
|
|
@@ -7133,7 +7511,7 @@ var init_constants = __esm({
|
|
|
7133
7511
|
}
|
|
7134
7512
|
});
|
|
7135
7513
|
|
|
7136
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
7514
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/lib/beta-parser.mjs
|
|
7137
7515
|
function getOutputFormat(params) {
|
|
7138
7516
|
return params?.output_format ?? params?.output_config?.format;
|
|
7139
7517
|
}
|
|
@@ -7206,16 +7584,24 @@ function parseBetaOutputFormat(params, content) {
|
|
|
7206
7584
|
}
|
|
7207
7585
|
}
|
|
7208
7586
|
var init_beta_parser = __esm({
|
|
7209
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
7587
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/lib/beta-parser.mjs"() {
|
|
7210
7588
|
"use strict";
|
|
7211
7589
|
init_error();
|
|
7212
7590
|
}
|
|
7213
7591
|
});
|
|
7214
7592
|
|
|
7215
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
7593
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/streaming.mjs
|
|
7594
|
+
var init_streaming2 = __esm({
|
|
7595
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/streaming.mjs"() {
|
|
7596
|
+
"use strict";
|
|
7597
|
+
init_streaming();
|
|
7598
|
+
}
|
|
7599
|
+
});
|
|
7600
|
+
|
|
7601
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/_vendor/partial-json-parser/parser.mjs
|
|
7216
7602
|
var tokenize, strip, unstrip, generate, partialParse;
|
|
7217
7603
|
var init_parser = __esm({
|
|
7218
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
7604
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/_vendor/partial-json-parser/parser.mjs"() {
|
|
7219
7605
|
"use strict";
|
|
7220
7606
|
tokenize = (input) => {
|
|
7221
7607
|
let current = 0;
|
|
@@ -7317,7 +7703,9 @@ var init_parser = __esm({
|
|
|
7317
7703
|
value += char;
|
|
7318
7704
|
char = input[++current];
|
|
7319
7705
|
}
|
|
7320
|
-
while (char && NUMBERS.test(char) || char === "."
|
|
7706
|
+
while (char && (NUMBERS.test(char) || char === "." || // exponent marker, e.g. `1e10` or `1.5E-9`
|
|
7707
|
+
char === "e" || char === "E" || // exponent sign, only valid immediately after the exponent marker
|
|
7708
|
+
(char === "-" || char === "+") && (value[value.length - 1] === "e" || value[value.length - 1] === "E"))) {
|
|
7321
7709
|
value += char;
|
|
7322
7710
|
char = input[++current];
|
|
7323
7711
|
}
|
|
@@ -7364,7 +7752,7 @@ var init_parser = __esm({
|
|
|
7364
7752
|
break;
|
|
7365
7753
|
case "number":
|
|
7366
7754
|
let lastCharacterOfLastToken = lastToken.value[lastToken.value.length - 1];
|
|
7367
|
-
if (lastCharacterOfLastToken === "." || lastCharacterOfLastToken === "-") {
|
|
7755
|
+
if (lastCharacterOfLastToken === "." || lastCharacterOfLastToken === "-" || lastCharacterOfLastToken === "+" || lastCharacterOfLastToken === "e" || lastCharacterOfLastToken === "E") {
|
|
7368
7756
|
tokens = tokens.slice(0, tokens.length - 1);
|
|
7369
7757
|
return strip(tokens);
|
|
7370
7758
|
}
|
|
@@ -7438,31 +7826,54 @@ var init_parser = __esm({
|
|
|
7438
7826
|
}
|
|
7439
7827
|
});
|
|
7440
7828
|
|
|
7441
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
7442
|
-
|
|
7443
|
-
|
|
7829
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/internal/message-stream-utils.mjs
|
|
7830
|
+
function withLazyInput(prev, jsonBuf) {
|
|
7831
|
+
const next = {};
|
|
7832
|
+
for (const key of Object.keys(prev)) {
|
|
7833
|
+
if (key !== "input")
|
|
7834
|
+
next[key] = prev[key];
|
|
7835
|
+
}
|
|
7836
|
+
Object.defineProperty(next, JSON_BUF_PROPERTY, { value: jsonBuf, enumerable: false, writable: true });
|
|
7837
|
+
let input;
|
|
7838
|
+
let parsed = false;
|
|
7839
|
+
Object.defineProperty(next, "input", {
|
|
7840
|
+
enumerable: true,
|
|
7841
|
+
configurable: true,
|
|
7842
|
+
get() {
|
|
7843
|
+
if (!parsed) {
|
|
7844
|
+
input = jsonBuf ? partialParse(jsonBuf) : {};
|
|
7845
|
+
parsed = true;
|
|
7846
|
+
}
|
|
7847
|
+
return input;
|
|
7848
|
+
}
|
|
7849
|
+
});
|
|
7850
|
+
return next;
|
|
7851
|
+
}
|
|
7852
|
+
var JSON_BUF_PROPERTY;
|
|
7853
|
+
var init_message_stream_utils = __esm({
|
|
7854
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/internal/message-stream-utils.mjs"() {
|
|
7444
7855
|
"use strict";
|
|
7445
|
-
|
|
7856
|
+
init_parser();
|
|
7857
|
+
JSON_BUF_PROPERTY = "__json_buf";
|
|
7446
7858
|
}
|
|
7447
7859
|
});
|
|
7448
7860
|
|
|
7449
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
7861
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/lib/BetaMessageStream.mjs
|
|
7450
7862
|
function tracksToolInput(content) {
|
|
7451
7863
|
return content.type === "tool_use" || content.type === "server_tool_use" || content.type === "mcp_tool_use";
|
|
7452
7864
|
}
|
|
7453
7865
|
function checkNever(x) {
|
|
7454
7866
|
}
|
|
7455
|
-
var _BetaMessageStream_instances, _BetaMessageStream_currentMessageSnapshot, _BetaMessageStream_params, _BetaMessageStream_connectedPromise, _BetaMessageStream_resolveConnectedPromise, _BetaMessageStream_rejectConnectedPromise, _BetaMessageStream_endPromise, _BetaMessageStream_resolveEndPromise, _BetaMessageStream_rejectEndPromise, _BetaMessageStream_listeners, _BetaMessageStream_ended, _BetaMessageStream_errored, _BetaMessageStream_aborted, _BetaMessageStream_catchingPromiseCreated, _BetaMessageStream_response, _BetaMessageStream_request_id, _BetaMessageStream_logger, _BetaMessageStream_getFinalMessage, _BetaMessageStream_getFinalText, _BetaMessageStream_handleError, _BetaMessageStream_beginRequest, _BetaMessageStream_addStreamEvent, _BetaMessageStream_endRequest, _BetaMessageStream_accumulateMessage,
|
|
7867
|
+
var _BetaMessageStream_instances, _BetaMessageStream_currentMessageSnapshot, _BetaMessageStream_params, _BetaMessageStream_connectedPromise, _BetaMessageStream_resolveConnectedPromise, _BetaMessageStream_rejectConnectedPromise, _BetaMessageStream_endPromise, _BetaMessageStream_resolveEndPromise, _BetaMessageStream_rejectEndPromise, _BetaMessageStream_listeners, _BetaMessageStream_ended, _BetaMessageStream_errored, _BetaMessageStream_aborted, _BetaMessageStream_catchingPromiseCreated, _BetaMessageStream_response, _BetaMessageStream_request_id, _BetaMessageStream_logger, _BetaMessageStream_getFinalMessage, _BetaMessageStream_getFinalText, _BetaMessageStream_handleError, _BetaMessageStream_beginRequest, _BetaMessageStream_addStreamEvent, _BetaMessageStream_endRequest, _BetaMessageStream_accumulateMessage, _BetaMessageStream_toolInputParseError, BetaMessageStream;
|
|
7456
7868
|
var init_BetaMessageStream = __esm({
|
|
7457
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
7869
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/lib/BetaMessageStream.mjs"() {
|
|
7458
7870
|
"use strict";
|
|
7459
7871
|
init_tslib();
|
|
7460
|
-
init_parser();
|
|
7461
7872
|
init_error2();
|
|
7462
7873
|
init_errors();
|
|
7463
7874
|
init_streaming2();
|
|
7464
7875
|
init_beta_parser();
|
|
7465
|
-
|
|
7876
|
+
init_message_stream_utils();
|
|
7466
7877
|
BetaMessageStream = class _BetaMessageStream {
|
|
7467
7878
|
constructor(params, opts) {
|
|
7468
7879
|
_BetaMessageStream_instances.add(this);
|
|
@@ -7819,8 +8230,15 @@ var init_BetaMessageStream = __esm({
|
|
|
7819
8230
|
break;
|
|
7820
8231
|
}
|
|
7821
8232
|
case "input_json_delta": {
|
|
7822
|
-
if (tracksToolInput(content) &&
|
|
7823
|
-
|
|
8233
|
+
if (tracksToolInput(content) && __classPrivateFieldGet(this, _BetaMessageStream_listeners, "f").inputJson?.length) {
|
|
8234
|
+
let jsonSnapshot;
|
|
8235
|
+
try {
|
|
8236
|
+
jsonSnapshot = content.input;
|
|
8237
|
+
} catch (err) {
|
|
8238
|
+
__classPrivateFieldGet(this, _BetaMessageStream_handleError, "f").call(this, __classPrivateFieldGet(this, _BetaMessageStream_instances, "m", _BetaMessageStream_toolInputParseError).call(this, content, err));
|
|
8239
|
+
break;
|
|
8240
|
+
}
|
|
8241
|
+
this._emit("inputJson", event.delta.partial_json, jsonSnapshot);
|
|
7824
8242
|
}
|
|
7825
8243
|
break;
|
|
7826
8244
|
}
|
|
@@ -7892,6 +8310,9 @@ var init_BetaMessageStream = __esm({
|
|
|
7892
8310
|
snapshot.container = event.delta.container;
|
|
7893
8311
|
snapshot.stop_reason = event.delta.stop_reason;
|
|
7894
8312
|
snapshot.stop_sequence = event.delta.stop_sequence;
|
|
8313
|
+
if (event.delta.stop_details != null) {
|
|
8314
|
+
snapshot.stop_details = event.delta.stop_details;
|
|
8315
|
+
}
|
|
7895
8316
|
snapshot.usage.output_tokens = event.usage.output_tokens;
|
|
7896
8317
|
snapshot.context_management = event.context_management;
|
|
7897
8318
|
if (event.usage.input_tokens != null) {
|
|
@@ -7912,6 +8333,9 @@ var init_BetaMessageStream = __esm({
|
|
|
7912
8333
|
return snapshot;
|
|
7913
8334
|
case "content_block_start":
|
|
7914
8335
|
snapshot.content.push(event.content_block);
|
|
8336
|
+
if (event.content_block.type === "fallback") {
|
|
8337
|
+
snapshot.model = event.content_block.to.model;
|
|
8338
|
+
}
|
|
7915
8339
|
return snapshot;
|
|
7916
8340
|
case "content_block_delta": {
|
|
7917
8341
|
const snapshotContent = snapshot.content.at(event.index);
|
|
@@ -7936,23 +8360,8 @@ var init_BetaMessageStream = __esm({
|
|
|
7936
8360
|
}
|
|
7937
8361
|
case "input_json_delta": {
|
|
7938
8362
|
if (snapshotContent && tracksToolInput(snapshotContent)) {
|
|
7939
|
-
|
|
7940
|
-
|
|
7941
|
-
const newContent = { ...snapshotContent };
|
|
7942
|
-
Object.defineProperty(newContent, JSON_BUF_PROPERTY, {
|
|
7943
|
-
value: jsonBuf,
|
|
7944
|
-
enumerable: false,
|
|
7945
|
-
writable: true
|
|
7946
|
-
});
|
|
7947
|
-
if (jsonBuf) {
|
|
7948
|
-
try {
|
|
7949
|
-
newContent.input = partialParse(jsonBuf);
|
|
7950
|
-
} catch (err) {
|
|
7951
|
-
const error = new AnthropicError(`Unable to parse tool parameter JSON from model. Please retry your request or adjust your prompt. Error: ${err}. JSON: ${jsonBuf}`);
|
|
7952
|
-
__classPrivateFieldGet(this, _BetaMessageStream_handleError, "f").call(this, error);
|
|
7953
|
-
}
|
|
7954
|
-
}
|
|
7955
|
-
snapshot.content[event.index] = newContent;
|
|
8363
|
+
const jsonBuf = (snapshotContent[JSON_BUF_PROPERTY] || "") + event.delta.partial_json;
|
|
8364
|
+
snapshot.content[event.index] = withLazyInput(snapshotContent, jsonBuf);
|
|
7956
8365
|
}
|
|
7957
8366
|
break;
|
|
7958
8367
|
}
|
|
@@ -7978,7 +8387,8 @@ var init_BetaMessageStream = __esm({
|
|
|
7978
8387
|
if (snapshotContent?.type === "compaction") {
|
|
7979
8388
|
snapshot.content[event.index] = {
|
|
7980
8389
|
...snapshotContent,
|
|
7981
|
-
content: (snapshotContent.content || "") + event.delta.content
|
|
8390
|
+
content: (snapshotContent.content || "") + event.delta.content,
|
|
8391
|
+
encrypted_content: event.delta.encrypted_content
|
|
7982
8392
|
};
|
|
7983
8393
|
}
|
|
7984
8394
|
break;
|
|
@@ -7988,9 +8398,29 @@ var init_BetaMessageStream = __esm({
|
|
|
7988
8398
|
}
|
|
7989
8399
|
return snapshot;
|
|
7990
8400
|
}
|
|
7991
|
-
case "content_block_stop":
|
|
8401
|
+
case "content_block_stop": {
|
|
8402
|
+
const snapshotContent = snapshot.content.at(event.index);
|
|
8403
|
+
if (snapshotContent && tracksToolInput(snapshotContent) && JSON_BUF_PROPERTY in snapshotContent) {
|
|
8404
|
+
let input;
|
|
8405
|
+
try {
|
|
8406
|
+
input = snapshotContent.input;
|
|
8407
|
+
} catch (err) {
|
|
8408
|
+
input = {};
|
|
8409
|
+
__classPrivateFieldGet(this, _BetaMessageStream_handleError, "f").call(this, __classPrivateFieldGet(this, _BetaMessageStream_instances, "m", _BetaMessageStream_toolInputParseError).call(this, snapshotContent, err));
|
|
8410
|
+
}
|
|
8411
|
+
Object.defineProperty(snapshotContent, "input", {
|
|
8412
|
+
value: input,
|
|
8413
|
+
enumerable: true,
|
|
8414
|
+
configurable: true,
|
|
8415
|
+
writable: true
|
|
8416
|
+
});
|
|
8417
|
+
}
|
|
7992
8418
|
return snapshot;
|
|
8419
|
+
}
|
|
7993
8420
|
}
|
|
8421
|
+
}, _BetaMessageStream_toolInputParseError = function _BetaMessageStream_toolInputParseError2(block, err) {
|
|
8422
|
+
const jsonBuf = block[JSON_BUF_PROPERTY];
|
|
8423
|
+
return new AnthropicError(`Unable to parse tool parameter JSON from model. Please retry your request or adjust your prompt. Error: ${err}. JSON: ${jsonBuf}`);
|
|
7994
8424
|
}, Symbol.asyncIterator)]() {
|
|
7995
8425
|
const pushQueue = [];
|
|
7996
8426
|
const readQueue = [];
|
|
@@ -8049,10 +8479,10 @@ var init_BetaMessageStream = __esm({
|
|
|
8049
8479
|
}
|
|
8050
8480
|
});
|
|
8051
8481
|
|
|
8052
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
8482
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/lib/tools/CompactionControl.mjs
|
|
8053
8483
|
var DEFAULT_TOKEN_THRESHOLD, DEFAULT_SUMMARY_PROMPT;
|
|
8054
8484
|
var init_CompactionControl = __esm({
|
|
8055
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
8485
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/lib/tools/CompactionControl.mjs"() {
|
|
8056
8486
|
"use strict";
|
|
8057
8487
|
DEFAULT_TOKEN_THRESHOLD = 1e5;
|
|
8058
8488
|
DEFAULT_SUMMARY_PROMPT = `You have been working on the task described above but have not yet completed it. Write a continuation summary that will allow you (or another instance of yourself) to resume work efficiently in a future context window where the conversation history will be replaced with this summary. Your summary should be structured, concise, and actionable. Include:
|
|
@@ -8081,7 +8511,7 @@ Wrap your summary in <summary></summary> tags.`;
|
|
|
8081
8511
|
}
|
|
8082
8512
|
});
|
|
8083
8513
|
|
|
8084
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
8514
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/lib/tools/BetaToolRunner.mjs
|
|
8085
8515
|
async function generateToolResponse(params, lastMessage = params.messages.at(-1), requestOptions) {
|
|
8086
8516
|
if (!lastMessage || lastMessage.role !== "assistant" || !lastMessage.content || typeof lastMessage.content === "string") {
|
|
8087
8517
|
return null;
|
|
@@ -8131,7 +8561,7 @@ async function generateToolResponse(params, lastMessage = params.messages.at(-1)
|
|
|
8131
8561
|
}
|
|
8132
8562
|
var _BetaToolRunner_instances, _BetaToolRunner_consumed, _BetaToolRunner_mutated, _BetaToolRunner_state, _BetaToolRunner_options, _BetaToolRunner_message, _BetaToolRunner_toolResponse, _BetaToolRunner_completion, _BetaToolRunner_iterationCount, _BetaToolRunner_checkAndCompact, _BetaToolRunner_generateToolResponse, BetaToolRunner;
|
|
8133
8563
|
var init_BetaToolRunner = __esm({
|
|
8134
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
8564
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/lib/tools/BetaToolRunner.mjs"() {
|
|
8135
8565
|
"use strict";
|
|
8136
8566
|
init_tslib();
|
|
8137
8567
|
init_ToolError();
|
|
@@ -8267,8 +8697,11 @@ var init_BetaToolRunner = __esm({
|
|
|
8267
8697
|
const isCompacted = await __classPrivateFieldGet(this, _BetaToolRunner_instances, "m", _BetaToolRunner_checkAndCompact).call(this);
|
|
8268
8698
|
if (!isCompacted) {
|
|
8269
8699
|
if (!__classPrivateFieldGet(this, _BetaToolRunner_mutated, "f")) {
|
|
8270
|
-
const
|
|
8271
|
-
__classPrivateFieldGet(this, _BetaToolRunner_state, "f").params.messages.push({ role, content });
|
|
8700
|
+
const message = await __classPrivateFieldGet(this, _BetaToolRunner_message, "f");
|
|
8701
|
+
__classPrivateFieldGet(this, _BetaToolRunner_state, "f").params.messages.push({ role: message.role, content: message.content });
|
|
8702
|
+
if (message.stop_reason === "refusal") {
|
|
8703
|
+
break;
|
|
8704
|
+
}
|
|
8272
8705
|
}
|
|
8273
8706
|
const toolMessage = await __classPrivateFieldGet(this, _BetaToolRunner_instances, "m", _BetaToolRunner_generateToolResponse).call(this, __classPrivateFieldGet(this, _BetaToolRunner_state, "f").params.messages.at(-1));
|
|
8274
8707
|
if (toolMessage) {
|
|
@@ -8427,7 +8860,7 @@ var init_BetaToolRunner = __esm({
|
|
|
8427
8860
|
}
|
|
8428
8861
|
});
|
|
8429
8862
|
|
|
8430
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
8863
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/resources/beta/messages/messages.mjs
|
|
8431
8864
|
function transformOutputFormat(params) {
|
|
8432
8865
|
if (!params.output_format) {
|
|
8433
8866
|
return params;
|
|
@@ -8446,7 +8879,7 @@ function transformOutputFormat(params) {
|
|
|
8446
8879
|
}
|
|
8447
8880
|
var DEPRECATED_MODELS, MODELS_TO_WARN_WITH_THINKING_ENABLED, Messages;
|
|
8448
8881
|
var init_messages = __esm({
|
|
8449
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
8882
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/resources/beta/messages/messages.mjs"() {
|
|
8450
8883
|
"use strict";
|
|
8451
8884
|
init_error2();
|
|
8452
8885
|
init_batches();
|
|
@@ -8472,7 +8905,16 @@ var init_messages = __esm({
|
|
|
8472
8905
|
"claude-2.1": "July 21st, 2025",
|
|
8473
8906
|
"claude-2.0": "July 21st, 2025",
|
|
8474
8907
|
"claude-3-7-sonnet-latest": "February 19th, 2026",
|
|
8475
|
-
"claude-3-7-sonnet-20250219": "February 19th, 2026"
|
|
8908
|
+
"claude-3-7-sonnet-20250219": "February 19th, 2026",
|
|
8909
|
+
"claude-3-5-haiku-latest": "February 19th, 2026",
|
|
8910
|
+
"claude-3-5-haiku-20241022": "February 19th, 2026",
|
|
8911
|
+
"claude-opus-4-0": "June 15th, 2026",
|
|
8912
|
+
"claude-opus-4-20250514": "June 15th, 2026",
|
|
8913
|
+
"claude-sonnet-4-0": "June 15th, 2026",
|
|
8914
|
+
"claude-sonnet-4-20250514": "June 15th, 2026",
|
|
8915
|
+
"claude-opus-4-1": "August 5th, 2026",
|
|
8916
|
+
"claude-opus-4-1-20250805": "August 5th, 2026",
|
|
8917
|
+
"claude-mythos-preview": "June 30th, 2026"
|
|
8476
8918
|
};
|
|
8477
8919
|
MODELS_TO_WARN_WITH_THINKING_ENABLED = ["claude-mythos-preview", "claude-opus-4-6"];
|
|
8478
8920
|
Messages = class extends APIResource {
|
|
@@ -8580,10 +9022,10 @@ Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resour
|
|
|
8580
9022
|
}
|
|
8581
9023
|
});
|
|
8582
9024
|
|
|
8583
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
9025
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/resources/beta/sessions/events.mjs
|
|
8584
9026
|
var Events;
|
|
8585
9027
|
var init_events = __esm({
|
|
8586
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
9028
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/resources/beta/sessions/events.mjs"() {
|
|
8587
9029
|
"use strict";
|
|
8588
9030
|
init_resource();
|
|
8589
9031
|
init_pagination();
|
|
@@ -8700,10 +9142,10 @@ var init_events = __esm({
|
|
|
8700
9142
|
}
|
|
8701
9143
|
});
|
|
8702
9144
|
|
|
8703
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
9145
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/resources/beta/sessions/resources.mjs
|
|
8704
9146
|
var Resources;
|
|
8705
9147
|
var init_resources = __esm({
|
|
8706
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
9148
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/resources/beta/sessions/resources.mjs"() {
|
|
8707
9149
|
"use strict";
|
|
8708
9150
|
init_resource();
|
|
8709
9151
|
init_pagination();
|
|
@@ -8834,10 +9276,10 @@ var init_resources = __esm({
|
|
|
8834
9276
|
}
|
|
8835
9277
|
});
|
|
8836
9278
|
|
|
8837
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
9279
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/events.mjs
|
|
8838
9280
|
var Events2;
|
|
8839
9281
|
var init_events2 = __esm({
|
|
8840
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
9282
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/events.mjs"() {
|
|
8841
9283
|
"use strict";
|
|
8842
9284
|
init_resource();
|
|
8843
9285
|
init_pagination();
|
|
@@ -8896,10 +9338,10 @@ var init_events2 = __esm({
|
|
|
8896
9338
|
}
|
|
8897
9339
|
});
|
|
8898
9340
|
|
|
8899
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
9341
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/threads.mjs
|
|
8900
9342
|
var Threads;
|
|
8901
9343
|
var init_threads = __esm({
|
|
8902
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
9344
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/threads.mjs"() {
|
|
8903
9345
|
"use strict";
|
|
8904
9346
|
init_resource();
|
|
8905
9347
|
init_events2();
|
|
@@ -8985,10 +9427,10 @@ var init_threads = __esm({
|
|
|
8985
9427
|
}
|
|
8986
9428
|
});
|
|
8987
9429
|
|
|
8988
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
9430
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/resources/beta/sessions/sessions.mjs
|
|
8989
9431
|
var Sessions;
|
|
8990
9432
|
var init_sessions = __esm({
|
|
8991
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
9433
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/resources/beta/sessions/sessions.mjs"() {
|
|
8992
9434
|
"use strict";
|
|
8993
9435
|
init_resource();
|
|
8994
9436
|
init_events();
|
|
@@ -9144,10 +9586,10 @@ var init_sessions = __esm({
|
|
|
9144
9586
|
}
|
|
9145
9587
|
});
|
|
9146
9588
|
|
|
9147
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
9589
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/resources/beta/skills/versions.mjs
|
|
9148
9590
|
var Versions2;
|
|
9149
9591
|
var init_versions2 = __esm({
|
|
9150
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
9592
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/resources/beta/skills/versions.mjs"() {
|
|
9151
9593
|
"use strict";
|
|
9152
9594
|
init_resource();
|
|
9153
9595
|
init_pagination();
|
|
@@ -9274,10 +9716,10 @@ var init_versions2 = __esm({
|
|
|
9274
9716
|
}
|
|
9275
9717
|
});
|
|
9276
9718
|
|
|
9277
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
9719
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/resources/beta/skills/skills.mjs
|
|
9278
9720
|
var Skills;
|
|
9279
9721
|
var init_skills2 = __esm({
|
|
9280
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
9722
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/resources/beta/skills/skills.mjs"() {
|
|
9281
9723
|
"use strict";
|
|
9282
9724
|
init_resource();
|
|
9283
9725
|
init_versions2();
|
|
@@ -9373,10 +9815,10 @@ var init_skills2 = __esm({
|
|
|
9373
9815
|
}
|
|
9374
9816
|
});
|
|
9375
9817
|
|
|
9376
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
9818
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/resources/beta/vaults/credentials.mjs
|
|
9377
9819
|
var Credentials;
|
|
9378
9820
|
var init_credentials2 = __esm({
|
|
9379
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
9821
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/resources/beta/vaults/credentials.mjs"() {
|
|
9380
9822
|
"use strict";
|
|
9381
9823
|
init_resource();
|
|
9382
9824
|
init_pagination();
|
|
@@ -9552,10 +9994,10 @@ var init_credentials2 = __esm({
|
|
|
9552
9994
|
}
|
|
9553
9995
|
});
|
|
9554
9996
|
|
|
9555
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
9997
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/resources/beta/vaults/vaults.mjs
|
|
9556
9998
|
var Vaults;
|
|
9557
9999
|
var init_vaults = __esm({
|
|
9558
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
10000
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/resources/beta/vaults/vaults.mjs"() {
|
|
9559
10001
|
"use strict";
|
|
9560
10002
|
init_resource();
|
|
9561
10003
|
init_credentials2();
|
|
@@ -9702,12 +10144,16 @@ var init_vaults = __esm({
|
|
|
9702
10144
|
}
|
|
9703
10145
|
});
|
|
9704
10146
|
|
|
9705
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
10147
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/resources/beta/beta.mjs
|
|
9706
10148
|
var Beta;
|
|
9707
10149
|
var init_beta = __esm({
|
|
9708
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
10150
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/resources/beta/beta.mjs"() {
|
|
9709
10151
|
"use strict";
|
|
9710
10152
|
init_resource();
|
|
10153
|
+
init_deployment_runs();
|
|
10154
|
+
init_deployment_runs();
|
|
10155
|
+
init_deployments();
|
|
10156
|
+
init_deployments();
|
|
9711
10157
|
init_files();
|
|
9712
10158
|
init_files();
|
|
9713
10159
|
init_models();
|
|
@@ -9738,6 +10184,8 @@ var init_beta = __esm({
|
|
|
9738
10184
|
this.agents = new Agents(this._client);
|
|
9739
10185
|
this.environments = new Environments(this._client);
|
|
9740
10186
|
this.sessions = new Sessions(this._client);
|
|
10187
|
+
this.deployments = new Deployments(this._client);
|
|
10188
|
+
this.deploymentRuns = new DeploymentRuns(this._client);
|
|
9741
10189
|
this.vaults = new Vaults(this._client);
|
|
9742
10190
|
this.memoryStores = new MemoryStores(this._client);
|
|
9743
10191
|
this.files = new Files(this._client);
|
|
@@ -9751,6 +10199,8 @@ var init_beta = __esm({
|
|
|
9751
10199
|
Beta.Agents = Agents;
|
|
9752
10200
|
Beta.Environments = Environments;
|
|
9753
10201
|
Beta.Sessions = Sessions;
|
|
10202
|
+
Beta.Deployments = Deployments;
|
|
10203
|
+
Beta.DeploymentRuns = DeploymentRuns;
|
|
9754
10204
|
Beta.Vaults = Vaults;
|
|
9755
10205
|
Beta.MemoryStores = MemoryStores;
|
|
9756
10206
|
Beta.Files = Files;
|
|
@@ -9760,10 +10210,10 @@ var init_beta = __esm({
|
|
|
9760
10210
|
}
|
|
9761
10211
|
});
|
|
9762
10212
|
|
|
9763
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
10213
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/resources/completions.mjs
|
|
9764
10214
|
var Completions;
|
|
9765
10215
|
var init_completions = __esm({
|
|
9766
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
10216
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/resources/completions.mjs"() {
|
|
9767
10217
|
"use strict";
|
|
9768
10218
|
init_resource();
|
|
9769
10219
|
init_headers();
|
|
@@ -9785,7 +10235,7 @@ var init_completions = __esm({
|
|
|
9785
10235
|
}
|
|
9786
10236
|
});
|
|
9787
10237
|
|
|
9788
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
10238
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/lib/parser.mjs
|
|
9789
10239
|
function getOutputFormat2(params) {
|
|
9790
10240
|
return params?.output_config?.format;
|
|
9791
10241
|
}
|
|
@@ -9846,29 +10296,28 @@ function parseOutputFormat(params, content) {
|
|
|
9846
10296
|
}
|
|
9847
10297
|
}
|
|
9848
10298
|
var init_parser2 = __esm({
|
|
9849
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
10299
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/lib/parser.mjs"() {
|
|
9850
10300
|
"use strict";
|
|
9851
10301
|
init_error();
|
|
9852
10302
|
}
|
|
9853
10303
|
});
|
|
9854
10304
|
|
|
9855
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
10305
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/lib/MessageStream.mjs
|
|
9856
10306
|
function tracksToolInput2(content) {
|
|
9857
10307
|
return content.type === "tool_use" || content.type === "server_tool_use";
|
|
9858
10308
|
}
|
|
9859
10309
|
function checkNever2(x) {
|
|
9860
10310
|
}
|
|
9861
|
-
var _MessageStream_instances, _MessageStream_currentMessageSnapshot, _MessageStream_params, _MessageStream_connectedPromise, _MessageStream_resolveConnectedPromise, _MessageStream_rejectConnectedPromise, _MessageStream_endPromise, _MessageStream_resolveEndPromise, _MessageStream_rejectEndPromise, _MessageStream_listeners, _MessageStream_ended, _MessageStream_errored, _MessageStream_aborted, _MessageStream_catchingPromiseCreated, _MessageStream_response, _MessageStream_request_id, _MessageStream_logger, _MessageStream_getFinalMessage, _MessageStream_getFinalText, _MessageStream_handleError, _MessageStream_beginRequest, _MessageStream_addStreamEvent, _MessageStream_endRequest, _MessageStream_accumulateMessage,
|
|
10311
|
+
var _MessageStream_instances, _MessageStream_currentMessageSnapshot, _MessageStream_params, _MessageStream_connectedPromise, _MessageStream_resolveConnectedPromise, _MessageStream_rejectConnectedPromise, _MessageStream_endPromise, _MessageStream_resolveEndPromise, _MessageStream_rejectEndPromise, _MessageStream_listeners, _MessageStream_ended, _MessageStream_errored, _MessageStream_aborted, _MessageStream_catchingPromiseCreated, _MessageStream_response, _MessageStream_request_id, _MessageStream_logger, _MessageStream_getFinalMessage, _MessageStream_getFinalText, _MessageStream_handleError, _MessageStream_beginRequest, _MessageStream_addStreamEvent, _MessageStream_endRequest, _MessageStream_accumulateMessage, MessageStream;
|
|
9862
10312
|
var init_MessageStream = __esm({
|
|
9863
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
10313
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/lib/MessageStream.mjs"() {
|
|
9864
10314
|
"use strict";
|
|
9865
10315
|
init_tslib();
|
|
9866
10316
|
init_errors();
|
|
9867
10317
|
init_error2();
|
|
9868
10318
|
init_streaming2();
|
|
9869
|
-
init_parser();
|
|
9870
10319
|
init_parser2();
|
|
9871
|
-
|
|
10320
|
+
init_message_stream_utils();
|
|
9872
10321
|
MessageStream = class _MessageStream {
|
|
9873
10322
|
constructor(params, opts) {
|
|
9874
10323
|
_MessageStream_instances.add(this);
|
|
@@ -10225,7 +10674,7 @@ var init_MessageStream = __esm({
|
|
|
10225
10674
|
break;
|
|
10226
10675
|
}
|
|
10227
10676
|
case "input_json_delta": {
|
|
10228
|
-
if (tracksToolInput2(content) &&
|
|
10677
|
+
if (tracksToolInput2(content) && __classPrivateFieldGet(this, _MessageStream_listeners, "f").inputJson?.length) {
|
|
10229
10678
|
this._emit("inputJson", event.delta.partial_json, content.input);
|
|
10230
10679
|
}
|
|
10231
10680
|
break;
|
|
@@ -10334,18 +10783,8 @@ var init_MessageStream = __esm({
|
|
|
10334
10783
|
}
|
|
10335
10784
|
case "input_json_delta": {
|
|
10336
10785
|
if (snapshotContent && tracksToolInput2(snapshotContent)) {
|
|
10337
|
-
|
|
10338
|
-
|
|
10339
|
-
const newContent = { ...snapshotContent };
|
|
10340
|
-
Object.defineProperty(newContent, JSON_BUF_PROPERTY2, {
|
|
10341
|
-
value: jsonBuf,
|
|
10342
|
-
enumerable: false,
|
|
10343
|
-
writable: true
|
|
10344
|
-
});
|
|
10345
|
-
if (jsonBuf) {
|
|
10346
|
-
newContent.input = partialParse(jsonBuf);
|
|
10347
|
-
}
|
|
10348
|
-
snapshot.content[event.index] = newContent;
|
|
10786
|
+
const jsonBuf = (snapshotContent[JSON_BUF_PROPERTY] || "") + event.delta.partial_json;
|
|
10787
|
+
snapshot.content[event.index] = withLazyInput(snapshotContent, jsonBuf);
|
|
10349
10788
|
}
|
|
10350
10789
|
break;
|
|
10351
10790
|
}
|
|
@@ -10372,8 +10811,18 @@ var init_MessageStream = __esm({
|
|
|
10372
10811
|
}
|
|
10373
10812
|
return snapshot;
|
|
10374
10813
|
}
|
|
10375
|
-
case "content_block_stop":
|
|
10814
|
+
case "content_block_stop": {
|
|
10815
|
+
const snapshotContent = snapshot.content.at(event.index);
|
|
10816
|
+
if (snapshotContent && tracksToolInput2(snapshotContent) && JSON_BUF_PROPERTY in snapshotContent) {
|
|
10817
|
+
Object.defineProperty(snapshotContent, "input", {
|
|
10818
|
+
value: snapshotContent.input,
|
|
10819
|
+
enumerable: true,
|
|
10820
|
+
configurable: true,
|
|
10821
|
+
writable: true
|
|
10822
|
+
});
|
|
10823
|
+
}
|
|
10376
10824
|
return snapshot;
|
|
10825
|
+
}
|
|
10377
10826
|
}
|
|
10378
10827
|
}, Symbol.asyncIterator)]() {
|
|
10379
10828
|
const pushQueue = [];
|
|
@@ -10433,10 +10882,10 @@ var init_MessageStream = __esm({
|
|
|
10433
10882
|
}
|
|
10434
10883
|
});
|
|
10435
10884
|
|
|
10436
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
10885
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/resources/messages/batches.mjs
|
|
10437
10886
|
var Batches2;
|
|
10438
10887
|
var init_batches2 = __esm({
|
|
10439
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
10888
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/resources/messages/batches.mjs"() {
|
|
10440
10889
|
"use strict";
|
|
10441
10890
|
init_resource();
|
|
10442
10891
|
init_pagination();
|
|
@@ -10586,10 +11035,10 @@ var init_batches2 = __esm({
|
|
|
10586
11035
|
}
|
|
10587
11036
|
});
|
|
10588
11037
|
|
|
10589
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
11038
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/resources/messages/messages.mjs
|
|
10590
11039
|
var Messages2, DEPRECATED_MODELS2, MODELS_TO_WARN_WITH_THINKING_ENABLED2;
|
|
10591
11040
|
var init_messages2 = __esm({
|
|
10592
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
11041
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/resources/messages/messages.mjs"() {
|
|
10593
11042
|
"use strict";
|
|
10594
11043
|
init_resource();
|
|
10595
11044
|
init_headers();
|
|
@@ -10710,17 +11159,20 @@ Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resour
|
|
|
10710
11159
|
"claude-opus-4-0": "June 15th, 2026",
|
|
10711
11160
|
"claude-opus-4-20250514": "June 15th, 2026",
|
|
10712
11161
|
"claude-sonnet-4-0": "June 15th, 2026",
|
|
10713
|
-
"claude-sonnet-4-20250514": "June 15th, 2026"
|
|
11162
|
+
"claude-sonnet-4-20250514": "June 15th, 2026",
|
|
11163
|
+
"claude-opus-4-1": "August 5th, 2026",
|
|
11164
|
+
"claude-opus-4-1-20250805": "August 5th, 2026",
|
|
11165
|
+
"claude-mythos-preview": "June 30th, 2026"
|
|
10714
11166
|
};
|
|
10715
11167
|
MODELS_TO_WARN_WITH_THINKING_ENABLED2 = ["claude-mythos-preview", "claude-opus-4-6"];
|
|
10716
11168
|
Messages2.Batches = Batches2;
|
|
10717
11169
|
}
|
|
10718
11170
|
});
|
|
10719
11171
|
|
|
10720
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
11172
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/resources/models.mjs
|
|
10721
11173
|
var Models2;
|
|
10722
11174
|
var init_models2 = __esm({
|
|
10723
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
11175
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/resources/models.mjs"() {
|
|
10724
11176
|
"use strict";
|
|
10725
11177
|
init_resource();
|
|
10726
11178
|
init_pagination();
|
|
@@ -10764,9 +11216,9 @@ var init_models2 = __esm({
|
|
|
10764
11216
|
}
|
|
10765
11217
|
});
|
|
10766
11218
|
|
|
10767
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
11219
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/resources/index.mjs
|
|
10768
11220
|
var init_resources2 = __esm({
|
|
10769
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
11221
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/resources/index.mjs"() {
|
|
10770
11222
|
"use strict";
|
|
10771
11223
|
init_shared();
|
|
10772
11224
|
init_beta();
|
|
@@ -10776,10 +11228,10 @@ var init_resources2 = __esm({
|
|
|
10776
11228
|
}
|
|
10777
11229
|
});
|
|
10778
11230
|
|
|
10779
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
11231
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/client.mjs
|
|
10780
11232
|
var _BaseAnthropic_instances, _a, _BaseAnthropic_encoder, _BaseAnthropic_baseURLOverridden, HUMAN_PROMPT, AI_PROMPT, BaseAnthropic, Anthropic;
|
|
10781
11233
|
var init_client = __esm({
|
|
10782
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
11234
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/client.mjs"() {
|
|
10783
11235
|
"use strict";
|
|
10784
11236
|
init_tslib();
|
|
10785
11237
|
init_uuid();
|
|
@@ -10795,6 +11247,7 @@ var init_client = __esm({
|
|
|
10795
11247
|
init_types();
|
|
10796
11248
|
init_token_cache();
|
|
10797
11249
|
init_credential_chain();
|
|
11250
|
+
init_middleware();
|
|
10798
11251
|
init_pagination();
|
|
10799
11252
|
init_uploads2();
|
|
10800
11253
|
init_resources2();
|
|
@@ -10866,13 +11319,13 @@ var init_client = __esm({
|
|
|
10866
11319
|
this._baseURLIsExplicit = opts.__baseURLIsExplicit ?? !!baseURL;
|
|
10867
11320
|
this.timeout = options.timeout ?? _a.DEFAULT_TIMEOUT;
|
|
10868
11321
|
this.logger = options.logger ?? console;
|
|
10869
|
-
const defaultLogLevel = "warn";
|
|
10870
11322
|
this.logLevel = defaultLogLevel;
|
|
10871
|
-
this.logLevel = parseLogLevel(options.logLevel, "ClientOptions.logLevel", this) ?? parseLogLevel(readEnv("ANTHROPIC_LOG"), "process.env['ANTHROPIC_LOG']", this) ?? defaultLogLevel;
|
|
11323
|
+
this.logLevel = parseLogLevel(options.logLevel, "ClientOptions.logLevel", loggerFor(this)) ?? parseLogLevel(readEnv("ANTHROPIC_LOG"), "process.env['ANTHROPIC_LOG']", loggerFor(this)) ?? defaultLogLevel;
|
|
10872
11324
|
this.fetchOptions = options.fetchOptions;
|
|
10873
11325
|
this.maxRetries = options.maxRetries ?? 2;
|
|
10874
11326
|
this.fetch = options.fetch ?? getDefaultFetch();
|
|
10875
11327
|
__classPrivateFieldSet(this, _BaseAnthropic_encoder, FallbackEncoder, "f");
|
|
11328
|
+
this.middleware = [...options.middleware ?? []];
|
|
10876
11329
|
const customHeadersEnv = readEnv("ANTHROPIC_CUSTOM_HEADERS");
|
|
10877
11330
|
if (customHeadersEnv) {
|
|
10878
11331
|
const parsed = {};
|
|
@@ -10943,7 +11396,7 @@ var init_client = __esm({
|
|
|
10943
11396
|
_credentialResolverOptions() {
|
|
10944
11397
|
return {
|
|
10945
11398
|
baseURL: this.baseURL,
|
|
10946
|
-
fetch: this.
|
|
11399
|
+
fetch: this._credentialsFetch(),
|
|
10947
11400
|
userAgent: this.getUserAgent(),
|
|
10948
11401
|
onCacheWriteError: (err) => {
|
|
10949
11402
|
loggerFor(this).debug("credential cache write failed (best-effort)", err);
|
|
@@ -10953,6 +11406,18 @@ var init_client = __esm({
|
|
|
10953
11406
|
}
|
|
10954
11407
|
};
|
|
10955
11408
|
}
|
|
11409
|
+
/**
|
|
11410
|
+
* A `Fetch` for first-party credential token-exchange requests (OIDC
|
|
11411
|
+
* federation jwt-bearer grants, user-OAuth refresh grants) that routes
|
|
11412
|
+
* through this client's middleware chain, so middleware observes token
|
|
11413
|
+
* traffic like any other request. Only client-level middleware applies:
|
|
11414
|
+
* a minted token is shared across requests, so attributing the exchange
|
|
11415
|
+
* to any one request's per-request middleware would be arbitrary. For the
|
|
11416
|
+
* same reason, `ctx.options` is undefined for these requests.
|
|
11417
|
+
*/
|
|
11418
|
+
_credentialsFetch() {
|
|
11419
|
+
return wrapFetchWithMiddleware(this.fetch, this.middleware, void 0, this);
|
|
11420
|
+
}
|
|
10956
11421
|
_makeTokenCache(provider) {
|
|
10957
11422
|
return new TokenCache(provider, (err) => {
|
|
10958
11423
|
loggerFor(this).debug("advisory token refresh failed; serving cached token", err);
|
|
@@ -10981,6 +11446,7 @@ var init_client = __esm({
|
|
|
10981
11446
|
logLevel: this.logLevel,
|
|
10982
11447
|
fetch: this.fetch,
|
|
10983
11448
|
fetchOptions: this.fetchOptions,
|
|
11449
|
+
middleware: this.middleware,
|
|
10984
11450
|
apiKey: this.apiKey,
|
|
10985
11451
|
authToken: this.authToken,
|
|
10986
11452
|
webhookKey: this.webhookKey,
|
|
@@ -11130,6 +11596,13 @@ var init_client = __esm({
|
|
|
11130
11596
|
*
|
|
11131
11597
|
* This is useful for cases where you want to add certain headers based off of
|
|
11132
11598
|
* the request properties, e.g. `method` or `url`.
|
|
11599
|
+
*
|
|
11600
|
+
* Runs after all middleware (including {@link backendMiddleware}),
|
|
11601
|
+
* immediately before each underlying fetch call, so it sees exactly what
|
|
11602
|
+
* goes over the wire. Middleware may replay a request by calling `next()`
|
|
11603
|
+
* more than once, so this hook can run multiple times per attempt:
|
|
11604
|
+
* overrides must be idempotent and overwrite headers from a previous
|
|
11605
|
+
* invocation rather than append to them.
|
|
11133
11606
|
*/
|
|
11134
11607
|
async prepareRequest(request, { url, options }) {
|
|
11135
11608
|
if (this._authState.tokenCache && this.apiKey == null) {
|
|
@@ -11145,6 +11618,27 @@ var init_client = __esm({
|
|
|
11145
11618
|
request.headers = headers;
|
|
11146
11619
|
}
|
|
11147
11620
|
}
|
|
11621
|
+
/**
|
|
11622
|
+
* Internal {@link Middleware} composed innermost in the chain — inside both
|
|
11623
|
+
* client-level and per-request middleware, immediately around the underlying
|
|
11624
|
+
* `fetch`. Subclasses for third-party backends override this to adapt the
|
|
11625
|
+
* canonical Anthropic-shaped request to the backend's wire shape (URL/body
|
|
11626
|
+
* rewriting, request signing) and to normalize the wire response back to the
|
|
11627
|
+
* canonical shape (e.g. AWS EventStream to SSE).
|
|
11628
|
+
*
|
|
11629
|
+
* Running inside the user's middleware means user middleware always observes
|
|
11630
|
+
* canonical Anthropic-shaped traffic, and the adaptation re-runs (e.g.
|
|
11631
|
+
* re-signs) on every `next()` invocation, covering whatever the middleware
|
|
11632
|
+
* mutated.
|
|
11633
|
+
*
|
|
11634
|
+
* Errors thrown here follow the middleware error policy: they propagate to
|
|
11635
|
+
* the caller as-is — no retries, no `APIConnectionError` wrapping — unless
|
|
11636
|
+
* retryable (see {@link Middleware}); throw a `RetryableError` to opt into
|
|
11637
|
+
* the retry path.
|
|
11638
|
+
*/
|
|
11639
|
+
backendMiddleware() {
|
|
11640
|
+
return [];
|
|
11641
|
+
}
|
|
11148
11642
|
get(path13, opts) {
|
|
11149
11643
|
return this.methodRequest("get", path13, opts);
|
|
11150
11644
|
}
|
|
@@ -11179,22 +11673,17 @@ var init_client = __esm({
|
|
|
11179
11673
|
const { req, url, timeout } = await this.buildRequest(options, {
|
|
11180
11674
|
retryCount: maxRetries - retriesRemaining
|
|
11181
11675
|
});
|
|
11182
|
-
await this.prepareRequest(req, { url, options });
|
|
11183
11676
|
const requestLogID = "log_" + (Math.random() * (1 << 24) | 0).toString(16).padStart(6, "0");
|
|
11184
11677
|
const retryLogStr = retryOfRequestLogID === void 0 ? "" : `, retryOf: ${retryOfRequestLogID}`;
|
|
11185
11678
|
const startTime = Date.now();
|
|
11186
|
-
loggerFor(this).debug(`[${requestLogID}] sending request`, formatRequestDetails({
|
|
11187
|
-
retryOfRequestLogID,
|
|
11188
|
-
method: options.method,
|
|
11189
|
-
url,
|
|
11190
|
-
options,
|
|
11191
|
-
headers: req.headers
|
|
11192
|
-
}));
|
|
11193
11679
|
if (options.signal?.aborted) {
|
|
11194
11680
|
throw new APIUserAbortError();
|
|
11195
11681
|
}
|
|
11196
11682
|
const controller = new AbortController();
|
|
11197
|
-
const response = await this.fetchWithTimeout(url, req, timeout, controller
|
|
11683
|
+
const response = await this.fetchWithTimeout(url, req, timeout, controller, options, {
|
|
11684
|
+
requestLogID,
|
|
11685
|
+
retryOfRequestLogID
|
|
11686
|
+
}).catch(castToError);
|
|
11198
11687
|
const headersTime = Date.now();
|
|
11199
11688
|
if (response instanceof globalThis.Error) {
|
|
11200
11689
|
const retryMessage = `retrying, ${retriesRemaining} attempts remaining`;
|
|
@@ -11202,6 +11691,17 @@ var init_client = __esm({
|
|
|
11202
11691
|
throw new APIUserAbortError();
|
|
11203
11692
|
}
|
|
11204
11693
|
const isTimeout = isAbortError(response) || /timed? ?out/i.test(String(response) + ("cause" in response ? String(response.cause) : ""));
|
|
11694
|
+
const hasMiddleware = this.middleware.length > 0 || !!options.middleware?.length || this.backendMiddleware().length > 0;
|
|
11695
|
+
if (hasMiddleware && !isTimeout && !isRetryableError(response)) {
|
|
11696
|
+
loggerFor(this).info(`[${requestLogID}] middleware error (not retryable)`);
|
|
11697
|
+
loggerFor(this).debug(`[${requestLogID}] middleware error (not retryable)`, formatRequestDetails({
|
|
11698
|
+
retryOfRequestLogID,
|
|
11699
|
+
url,
|
|
11700
|
+
durationMs: headersTime - startTime,
|
|
11701
|
+
message: response.message
|
|
11702
|
+
}));
|
|
11703
|
+
throw response;
|
|
11704
|
+
}
|
|
11205
11705
|
if (retriesRemaining) {
|
|
11206
11706
|
loggerFor(this).info(`[${requestLogID}] connection ${isTimeout ? "timed out" : "failed"} - ${retryMessage}`);
|
|
11207
11707
|
loggerFor(this).debug(`[${requestLogID}] connection ${isTimeout ? "timed out" : "failed"} (${retryMessage})`, formatRequestDetails({
|
|
@@ -11222,6 +11722,9 @@ var init_client = __esm({
|
|
|
11222
11722
|
if (isTimeout) {
|
|
11223
11723
|
throw new APIConnectionTimeoutError();
|
|
11224
11724
|
}
|
|
11725
|
+
if (hasMiddleware && !isFetchOriginError(response)) {
|
|
11726
|
+
throw response;
|
|
11727
|
+
}
|
|
11225
11728
|
throw new APIConnectionError({ cause: response });
|
|
11226
11729
|
}
|
|
11227
11730
|
const specialHeaders = [...response.headers.entries()].filter(([name]) => name === "request-id").map(([name, value]) => ", " + name + ": " + JSON.stringify(value)).join("");
|
|
@@ -11274,12 +11777,11 @@ var init_client = __esm({
|
|
|
11274
11777
|
const request = this.makeRequest(options, null, void 0);
|
|
11275
11778
|
return new PagePromise(this, request, Page2);
|
|
11276
11779
|
}
|
|
11277
|
-
async fetchWithTimeout(url, init, ms, controller) {
|
|
11780
|
+
async fetchWithTimeout(url, init, ms, controller, requestOptions, logCtx) {
|
|
11278
11781
|
const { signal, method, ...options } = init || {};
|
|
11279
11782
|
const abort = this._makeAbort(controller);
|
|
11280
11783
|
if (signal)
|
|
11281
11784
|
signal.addEventListener("abort", abort, { once: true });
|
|
11282
|
-
const timeout = setTimeout(abort, ms);
|
|
11283
11785
|
const isReadableBody = globalThis.ReadableStream && options.body instanceof globalThis.ReadableStream || typeof options.body === "object" && options.body !== null && Symbol.asyncIterator in options.body;
|
|
11284
11786
|
const fetchOptions = {
|
|
11285
11787
|
signal: controller.signal,
|
|
@@ -11290,11 +11792,34 @@ var init_client = __esm({
|
|
|
11290
11792
|
if (method) {
|
|
11291
11793
|
fetchOptions.method = method.toUpperCase();
|
|
11292
11794
|
}
|
|
11293
|
-
|
|
11294
|
-
|
|
11295
|
-
|
|
11296
|
-
|
|
11297
|
-
|
|
11795
|
+
const baseFetch = this.fetch;
|
|
11796
|
+
const timedFetch = async (innerUrl, innerInit) => {
|
|
11797
|
+
const timeout = setTimeout(abort, ms);
|
|
11798
|
+
try {
|
|
11799
|
+
return await baseFetch.call(void 0, innerUrl, innerInit);
|
|
11800
|
+
} finally {
|
|
11801
|
+
clearTimeout(timeout);
|
|
11802
|
+
}
|
|
11803
|
+
};
|
|
11804
|
+
const innerFetch = requestOptions === void 0 ? timedFetch : (async (innerUrl, innerInit = {}) => {
|
|
11805
|
+
const innerUrlStr = typeof innerUrl === "string" ? innerUrl : innerUrl instanceof URL ? innerUrl.href : innerUrl.url;
|
|
11806
|
+
innerInit.headers = innerInit.headers instanceof Headers ? innerInit.headers : new Headers(innerInit.headers);
|
|
11807
|
+
await this.prepareRequest(innerInit, { url: innerUrlStr, options: requestOptions });
|
|
11808
|
+
if (logCtx) {
|
|
11809
|
+
loggerFor(this).debug(`[${logCtx.requestLogID}] sending request`, formatRequestDetails({
|
|
11810
|
+
retryOfRequestLogID: logCtx.retryOfRequestLogID,
|
|
11811
|
+
method: innerInit.method,
|
|
11812
|
+
url: innerUrlStr,
|
|
11813
|
+
options: requestOptions,
|
|
11814
|
+
headers: innerInit.headers
|
|
11815
|
+
}));
|
|
11816
|
+
}
|
|
11817
|
+
return timedFetch(innerUrl, innerInit);
|
|
11818
|
+
});
|
|
11819
|
+
const requestMiddleware = requestOptions?.middleware;
|
|
11820
|
+
const backendMiddleware = this.backendMiddleware();
|
|
11821
|
+
const allMiddleware = requestMiddleware?.length || backendMiddleware.length ? [...this.middleware, ...requestMiddleware ?? [], ...backendMiddleware] : this.middleware;
|
|
11822
|
+
return await wrapFetchWithMiddleware(innerFetch, allMiddleware, requestOptions, this)(url, fetchOptions);
|
|
11298
11823
|
}
|
|
11299
11824
|
async shouldRetry(response, options) {
|
|
11300
11825
|
const flags = this._authFlags(options);
|
|
@@ -11479,13 +12004,28 @@ var init_client = __esm({
|
|
|
11479
12004
|
}
|
|
11480
12005
|
});
|
|
11481
12006
|
|
|
11482
|
-
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
12007
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/lib/middleware.mjs
|
|
12008
|
+
var encoder;
|
|
12009
|
+
var init_middleware2 = __esm({
|
|
12010
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/lib/middleware.mjs"() {
|
|
12011
|
+
"use strict";
|
|
12012
|
+
init_error();
|
|
12013
|
+
init_streaming();
|
|
12014
|
+
init_errors();
|
|
12015
|
+
init_values();
|
|
12016
|
+
init_request_options();
|
|
12017
|
+
encoder = new TextEncoder();
|
|
12018
|
+
}
|
|
12019
|
+
});
|
|
12020
|
+
|
|
12021
|
+
// ../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/index.mjs
|
|
11483
12022
|
var init_sdk = __esm({
|
|
11484
|
-
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.
|
|
12023
|
+
"../../node_modules/.pnpm/@anthropic-ai+sdk@0.105.0_zod@4.4.3/node_modules/@anthropic-ai/sdk/index.mjs"() {
|
|
11485
12024
|
"use strict";
|
|
11486
12025
|
init_client();
|
|
11487
12026
|
init_uploads2();
|
|
11488
12027
|
init_api_promise();
|
|
12028
|
+
init_middleware2();
|
|
11489
12029
|
init_client();
|
|
11490
12030
|
init_pagination();
|
|
11491
12031
|
init_error();
|
|
@@ -11890,8 +12430,8 @@ var init_mcp_probe_templates = __esm({
|
|
|
11890
12430
|
|
|
11891
12431
|
// src/register-services.ts
|
|
11892
12432
|
import {
|
|
11893
|
-
PublicBaseUrlNotConfiguredError,
|
|
11894
|
-
requirePublicBaseUrl
|
|
12433
|
+
PublicBaseUrlNotConfiguredError as PublicBaseUrlNotConfiguredError2,
|
|
12434
|
+
requirePublicBaseUrl as requirePublicBaseUrl2
|
|
11895
12435
|
} from "@agor/core/config";
|
|
11896
12436
|
import {
|
|
11897
12437
|
and as and3,
|
|
@@ -11907,7 +12447,13 @@ import {
|
|
|
11907
12447
|
UserMCPOAuthTokenRepository as UserMCPOAuthTokenRepository3
|
|
11908
12448
|
} from "@agor/core/db";
|
|
11909
12449
|
import { Forbidden as Forbidden18, NotAuthenticated as NotAuthenticated10 } from "@agor/core/feathers";
|
|
11910
|
-
import {
|
|
12450
|
+
import {
|
|
12451
|
+
AGENTIC_TOOL_CAPABILITIES,
|
|
12452
|
+
isSessionExecuting,
|
|
12453
|
+
isTaskExecuting,
|
|
12454
|
+
SessionStatus as SessionStatus5,
|
|
12455
|
+
TaskStatus as TaskStatus3
|
|
12456
|
+
} from "@agor/core/types";
|
|
11911
12457
|
|
|
11912
12458
|
// src/executor-tracking.ts
|
|
11913
12459
|
import { shortId } from "@agor/core/db";
|
|
@@ -12959,6 +13505,23 @@ var ArtifactsService = class extends DrizzleService {
|
|
|
12959
13505
|
"Direct artifact creation not supported. Use publishArtifact() or agor_artifacts_publish MCP tool."
|
|
12960
13506
|
);
|
|
12961
13507
|
}
|
|
13508
|
+
/**
|
|
13509
|
+
* Direct REST/service updates are metadata-only and must not rewrite
|
|
13510
|
+
* provenance. `source_session_id` is stamped by publishArtifact() from the
|
|
13511
|
+
* trusted MCP/session context; letting generic PATCH/UPDATE mutate it would
|
|
13512
|
+
* make the "created by session" link spoofable.
|
|
13513
|
+
*/
|
|
13514
|
+
stripClientControlledProvenance(data) {
|
|
13515
|
+
const { source_session_id: _sourceSessionId, ...safeData } = data;
|
|
13516
|
+
return safeData;
|
|
13517
|
+
}
|
|
13518
|
+
async update(id, data, params) {
|
|
13519
|
+
return await super.update(
|
|
13520
|
+
id,
|
|
13521
|
+
this.stripClientControlledProvenance(data),
|
|
13522
|
+
params
|
|
13523
|
+
);
|
|
13524
|
+
}
|
|
12962
13525
|
/**
|
|
12963
13526
|
* Patch override: route board_id and placement changes through
|
|
12964
13527
|
* updateMetadata so the board_objects entry is moved/resized alongside the
|
|
@@ -12992,7 +13555,11 @@ var ArtifactsService = class extends DrizzleService {
|
|
|
12992
13555
|
callerRole
|
|
12993
13556
|
);
|
|
12994
13557
|
}
|
|
12995
|
-
return await super.patch(
|
|
13558
|
+
return await super.patch(
|
|
13559
|
+
id,
|
|
13560
|
+
this.stripClientControlledProvenance(data),
|
|
13561
|
+
params
|
|
13562
|
+
);
|
|
12996
13563
|
}
|
|
12997
13564
|
/**
|
|
12998
13565
|
* Centralized visibility predicate. Private artifacts are only readable
|
|
@@ -13083,6 +13650,7 @@ var ArtifactsService = class extends DrizzleService {
|
|
|
13083
13650
|
const updated = await this.artifactRepo.update(existing.artifact_id, {
|
|
13084
13651
|
name: resolvedName,
|
|
13085
13652
|
branch_id: matchedBranchId ?? existing.branch_id ?? null,
|
|
13653
|
+
source_session_id: data.source_session_id ?? existing.source_session_id ?? null,
|
|
13086
13654
|
files,
|
|
13087
13655
|
dependencies: cachedDeps,
|
|
13088
13656
|
entry: cachedEntry,
|
|
@@ -13110,6 +13678,7 @@ var ArtifactsService = class extends DrizzleService {
|
|
|
13110
13678
|
artifact_id: artifactId,
|
|
13111
13679
|
board_id: resolvedBoardId,
|
|
13112
13680
|
branch_id: matchedBranchId,
|
|
13681
|
+
source_session_id: data.source_session_id ?? null,
|
|
13113
13682
|
name: resolvedName,
|
|
13114
13683
|
path: folderPath,
|
|
13115
13684
|
template,
|
|
@@ -13414,6 +13983,7 @@ var ArtifactsService = class extends DrizzleService {
|
|
|
13414
13983
|
const legacy = detectLegacyFormat(artifact);
|
|
13415
13984
|
const payload = {
|
|
13416
13985
|
artifact_id: artifact.artifact_id,
|
|
13986
|
+
source_session_id: artifact.source_session_id ?? null,
|
|
13417
13987
|
name: artifact.name,
|
|
13418
13988
|
description: artifact.description,
|
|
13419
13989
|
template: artifact.template,
|
|
@@ -15271,19 +15841,19 @@ function generateTaskId() {
|
|
|
15271
15841
|
return Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
15272
15842
|
}
|
|
15273
15843
|
function findExecutorPath() {
|
|
15274
|
-
const
|
|
15844
|
+
const dirname5 = typeof __dirname !== "undefined" ? __dirname : path3.dirname(fileURLToPath(import.meta.url));
|
|
15275
15845
|
const possiblePaths = [
|
|
15276
|
-
path3.join(
|
|
15846
|
+
path3.join(dirname5, "../executor/cli.js"),
|
|
15277
15847
|
// Bundled in agor-live
|
|
15278
|
-
path3.join(
|
|
15848
|
+
path3.join(dirname5, "../../executor/cli.js"),
|
|
15279
15849
|
// Bundled one level up
|
|
15280
|
-
path3.join(
|
|
15850
|
+
path3.join(dirname5, "../../../packages/executor/bin/agor-executor"),
|
|
15281
15851
|
// Development - bin script
|
|
15282
|
-
path3.join(
|
|
15852
|
+
path3.join(dirname5, "../../../packages/executor/dist/cli.js"),
|
|
15283
15853
|
// Development - built dist
|
|
15284
|
-
path3.join(
|
|
15854
|
+
path3.join(dirname5, "../../../../packages/executor/bin/agor-executor"),
|
|
15285
15855
|
// Development from deeper nesting
|
|
15286
|
-
path3.join(
|
|
15856
|
+
path3.join(dirname5, "../../../../packages/executor/dist/cli.js")
|
|
15287
15857
|
// Development from deeper nesting
|
|
15288
15858
|
];
|
|
15289
15859
|
const executorPath = possiblePaths.find((p) => existsSync2(p));
|
|
@@ -15913,15 +16483,19 @@ function setupBranchOwnersService(app, branchRepo, config = {}) {
|
|
|
15913
16483
|
|
|
15914
16484
|
// src/services/branches.ts
|
|
15915
16485
|
import { existsSync as existsSync3 } from "fs";
|
|
15916
|
-
import { mkdir as mkdir2 } from "fs/promises";
|
|
15917
|
-
import { homedir } from "os";
|
|
15918
|
-
import { dirname as dirname2, join as join2 } from "path";
|
|
15919
16486
|
import { analyticsLogger } from "@agor/core/analytics";
|
|
15920
|
-
import {
|
|
16487
|
+
import {
|
|
16488
|
+
createUserProcessEnvironment,
|
|
16489
|
+
ENVIRONMENT,
|
|
16490
|
+
isBranchRbacEnabled,
|
|
16491
|
+
loadConfig as loadConfig2,
|
|
16492
|
+
PAGINATION as PAGINATION4
|
|
16493
|
+
} from "@agor/core/config";
|
|
15921
16494
|
import {
|
|
15922
16495
|
BoardRepository as BoardRepository3,
|
|
15923
16496
|
BranchRepository as BranchRepository3,
|
|
15924
|
-
KnowledgeNamespaceRepository as KnowledgeNamespaceRepository2
|
|
16497
|
+
KnowledgeNamespaceRepository as KnowledgeNamespaceRepository2,
|
|
16498
|
+
UsersRepository as UsersRepository2
|
|
15925
16499
|
} from "@agor/core/db";
|
|
15926
16500
|
import { renderBranchSnapshot } from "@agor/core/environment/render-snapshot";
|
|
15927
16501
|
import {
|
|
@@ -15934,7 +16508,11 @@ import {
|
|
|
15934
16508
|
import { BadRequest, Forbidden as Forbidden4, NotAuthenticated as NotAuthenticated4 } from "@agor/core/feathers";
|
|
15935
16509
|
import { stripGitUrlCredentials } from "@agor/core/git";
|
|
15936
16510
|
import { getAssistantConfig as getAssistantConfig2, isAssistant as isAssistant3 } from "@agor/core/types";
|
|
15937
|
-
import {
|
|
16511
|
+
import {
|
|
16512
|
+
getGidFromGroupName,
|
|
16513
|
+
resolveUnixUserForImpersonation,
|
|
16514
|
+
validateResolvedUnixUser
|
|
16515
|
+
} from "@agor/core/unix";
|
|
15938
16516
|
import { resolveHostIpAddress } from "@agor/core/utils/host-ip";
|
|
15939
16517
|
import { isAllowedHealthCheckUrl } from "@agor/core/utils/url";
|
|
15940
16518
|
|
|
@@ -16265,6 +16843,136 @@ var BranchesService = class extends DrizzleService {
|
|
|
16265
16843
|
truncated
|
|
16266
16844
|
};
|
|
16267
16845
|
}
|
|
16846
|
+
async resolveEnvironmentExecutorContext(branch) {
|
|
16847
|
+
const config = await loadConfig2();
|
|
16848
|
+
const unixUserMode = config.execution?.unix_user_mode ?? "simple";
|
|
16849
|
+
let asUser;
|
|
16850
|
+
if (unixUserMode !== "simple") {
|
|
16851
|
+
const usersRepo = new UsersRepository2(this.db);
|
|
16852
|
+
const user = await usersRepo.findById(branch.created_by);
|
|
16853
|
+
const impersonationResult = resolveUnixUserForImpersonation({
|
|
16854
|
+
mode: unixUserMode,
|
|
16855
|
+
userUnixUsername: user?.unix_username,
|
|
16856
|
+
executorUnixUser: config.execution?.executor_unix_user
|
|
16857
|
+
});
|
|
16858
|
+
asUser = impersonationResult.unixUser ?? void 0;
|
|
16859
|
+
if (asUser) {
|
|
16860
|
+
validateResolvedUnixUser(unixUserMode, asUser);
|
|
16861
|
+
}
|
|
16862
|
+
}
|
|
16863
|
+
const env = await createUserProcessEnvironment(branch.created_by, this.db, void 0, !!asUser);
|
|
16864
|
+
return { asUser, env };
|
|
16865
|
+
}
|
|
16866
|
+
async createEnvironmentExecutorPayload(options) {
|
|
16867
|
+
const { branch, action, params } = options;
|
|
16868
|
+
const userId = params?.user?.user_id ?? branch.created_by;
|
|
16869
|
+
const appWithToken = this.app;
|
|
16870
|
+
const sessionToken = await appWithToken.sessionTokenService?.generateToken(
|
|
16871
|
+
`environment-${action}`,
|
|
16872
|
+
userId,
|
|
16873
|
+
{ branchId: branch.branch_id, maxUses: -1 }
|
|
16874
|
+
);
|
|
16875
|
+
if (!sessionToken) {
|
|
16876
|
+
throw new Error(`Session token service unavailable; cannot dispatch environment ${action}`);
|
|
16877
|
+
}
|
|
16878
|
+
const { asUser, env } = await this.resolveEnvironmentExecutorContext(branch);
|
|
16879
|
+
return {
|
|
16880
|
+
asUser,
|
|
16881
|
+
env,
|
|
16882
|
+
payload: {
|
|
16883
|
+
command: "environment.lifecycle",
|
|
16884
|
+
sessionToken,
|
|
16885
|
+
daemonUrl: getDaemonUrl(),
|
|
16886
|
+
env,
|
|
16887
|
+
params: {
|
|
16888
|
+
branchId: branch.branch_id,
|
|
16889
|
+
branchPath: branch.path,
|
|
16890
|
+
action,
|
|
16891
|
+
startCommand: branch.start_command,
|
|
16892
|
+
stopCommand: branch.stop_command,
|
|
16893
|
+
nukeCommand: branch.nuke_command,
|
|
16894
|
+
appUrl: branch.app_url
|
|
16895
|
+
}
|
|
16896
|
+
}
|
|
16897
|
+
};
|
|
16898
|
+
}
|
|
16899
|
+
async dispatchEnvironmentExecutor(options) {
|
|
16900
|
+
const { branch, action } = options;
|
|
16901
|
+
const { payload, asUser, env } = await this.createEnvironmentExecutorPayload(options);
|
|
16902
|
+
spawnExecutor(payload, {
|
|
16903
|
+
logPrefix: `[Environment.${action} ${branch.name}]`,
|
|
16904
|
+
asUser,
|
|
16905
|
+
preparedEnv: env,
|
|
16906
|
+
templateVariables: {
|
|
16907
|
+
branch_id: branch.branch_id
|
|
16908
|
+
}
|
|
16909
|
+
});
|
|
16910
|
+
}
|
|
16911
|
+
async runEnvironmentExecutor(options) {
|
|
16912
|
+
const { branch, action } = options;
|
|
16913
|
+
const { payload, asUser, env } = await this.createEnvironmentExecutorPayload(options);
|
|
16914
|
+
const result = await runExecutorCommand(payload, {
|
|
16915
|
+
logPrefix: `[Environment.${action} ${branch.name}]`,
|
|
16916
|
+
asUser,
|
|
16917
|
+
preparedEnv: env,
|
|
16918
|
+
// Mixed webhook/shell restart needs the daemon to wait for shell stop
|
|
16919
|
+
// before it invokes the daemon-owned webhook start. Keep this generous
|
|
16920
|
+
// enough for docker compose down while still bounding the request.
|
|
16921
|
+
timeoutMs: 10 * 6e4,
|
|
16922
|
+
templateVariables: {
|
|
16923
|
+
branch_id: branch.branch_id
|
|
16924
|
+
}
|
|
16925
|
+
});
|
|
16926
|
+
if (!result.success) {
|
|
16927
|
+
const details = result.error?.details;
|
|
16928
|
+
const error = new Error(
|
|
16929
|
+
result.error?.message || "Executor environment command failed"
|
|
16930
|
+
);
|
|
16931
|
+
error.commandOutput = details?.output;
|
|
16932
|
+
throw error;
|
|
16933
|
+
}
|
|
16934
|
+
}
|
|
16935
|
+
async fetchEnvironmentLogsViaExecutor(branch, logsCommand, params) {
|
|
16936
|
+
const userId = params?.user?.user_id ?? branch.created_by;
|
|
16937
|
+
const appWithToken = this.app;
|
|
16938
|
+
const sessionToken = await appWithToken.sessionTokenService?.generateToken(
|
|
16939
|
+
"environment-logs",
|
|
16940
|
+
userId,
|
|
16941
|
+
{ branchId: branch.branch_id, maxUses: -1 }
|
|
16942
|
+
);
|
|
16943
|
+
if (!sessionToken) {
|
|
16944
|
+
throw new Error("Session token service unavailable; cannot fetch environment logs");
|
|
16945
|
+
}
|
|
16946
|
+
const { asUser, env } = await this.resolveEnvironmentExecutorContext(branch);
|
|
16947
|
+
const result = await runExecutorCommand(
|
|
16948
|
+
{
|
|
16949
|
+
command: "environment.logs",
|
|
16950
|
+
sessionToken,
|
|
16951
|
+
daemonUrl: getDaemonUrl(),
|
|
16952
|
+
env,
|
|
16953
|
+
params: {
|
|
16954
|
+
branchId: branch.branch_id,
|
|
16955
|
+
branchPath: branch.path,
|
|
16956
|
+
logsCommand
|
|
16957
|
+
}
|
|
16958
|
+
},
|
|
16959
|
+
{
|
|
16960
|
+
logPrefix: `[Environment.logs ${branch.name}]`,
|
|
16961
|
+
asUser,
|
|
16962
|
+
preparedEnv: env,
|
|
16963
|
+
timeoutMs: ENVIRONMENT.LOGS_TIMEOUT_MS,
|
|
16964
|
+
templateVariables: {
|
|
16965
|
+
branch_id: branch.branch_id
|
|
16966
|
+
}
|
|
16967
|
+
}
|
|
16968
|
+
);
|
|
16969
|
+
if (!result.success) {
|
|
16970
|
+
const details = result.error?.details;
|
|
16971
|
+
throw new Error(result.error?.message || details?.output || "Failed to fetch logs");
|
|
16972
|
+
}
|
|
16973
|
+
const data = result.data ?? {};
|
|
16974
|
+
return { stdout: data.logs ?? "", stderr: "", truncated: data.truncated ?? false };
|
|
16975
|
+
}
|
|
16268
16976
|
/**
|
|
16269
16977
|
* Extract caller identity for audit logging. Internal/daemon-initiated
|
|
16270
16978
|
* calls (no params.provider, no user) return undefined which the audit
|
|
@@ -17118,8 +17826,18 @@ var BranchesService = class extends DrizzleService {
|
|
|
17118
17826
|
/**
|
|
17119
17827
|
* Custom method: Update environment status
|
|
17120
17828
|
*/
|
|
17121
|
-
async updateEnvironment(
|
|
17122
|
-
const
|
|
17829
|
+
async updateEnvironment(idOrData, environmentUpdateOrParams, params) {
|
|
17830
|
+
const isRpcEnvelope = typeof idOrData === "object";
|
|
17831
|
+
const id = isRpcEnvelope ? idOrData.branch_id ?? idOrData.branchId : idOrData;
|
|
17832
|
+
const environmentUpdate = isRpcEnvelope ? idOrData.environment_update ?? idOrData.environmentUpdate : environmentUpdateOrParams;
|
|
17833
|
+
const resolvedParams = isRpcEnvelope ? environmentUpdateOrParams : params;
|
|
17834
|
+
if (!id) {
|
|
17835
|
+
throw new Error("Branch ID is required to update environment status");
|
|
17836
|
+
}
|
|
17837
|
+
if (!environmentUpdate) {
|
|
17838
|
+
throw new Error("Environment update is required");
|
|
17839
|
+
}
|
|
17840
|
+
const existing = await this.get(id, resolvedParams);
|
|
17123
17841
|
const updatedEnvironment = {
|
|
17124
17842
|
...existing.environment_instance,
|
|
17125
17843
|
...environmentUpdate
|
|
@@ -17144,7 +17862,7 @@ var BranchesService = class extends DrizzleService {
|
|
|
17144
17862
|
environment_instance: updatedEnvironment,
|
|
17145
17863
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
17146
17864
|
},
|
|
17147
|
-
|
|
17865
|
+
resolvedParams
|
|
17148
17866
|
);
|
|
17149
17867
|
return branch;
|
|
17150
17868
|
}
|
|
@@ -17160,6 +17878,9 @@ var BranchesService = class extends DrizzleService {
|
|
|
17160
17878
|
if (branch.environment_instance?.status === "running") {
|
|
17161
17879
|
throw new Error("Environment is already running");
|
|
17162
17880
|
}
|
|
17881
|
+
const command = branch.start_command;
|
|
17882
|
+
const execution = await this.resolveEnvironmentCommand(command, "start");
|
|
17883
|
+
const access_urls = branch.app_url ? [{ name: "App", url: branch.app_url }] : void 0;
|
|
17163
17884
|
await this.updateEnvironment(
|
|
17164
17885
|
id,
|
|
17165
17886
|
{
|
|
@@ -17168,26 +17889,16 @@ var BranchesService = class extends DrizzleService {
|
|
|
17168
17889
|
...branch.environment_instance?.process,
|
|
17169
17890
|
started_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
17170
17891
|
},
|
|
17892
|
+
access_urls,
|
|
17171
17893
|
last_health_check: void 0,
|
|
17172
17894
|
last_error: void 0
|
|
17173
17895
|
},
|
|
17174
17896
|
params
|
|
17175
17897
|
);
|
|
17176
17898
|
try {
|
|
17177
|
-
const command = branch.start_command;
|
|
17178
|
-
const execution = await this.resolveEnvironmentCommand(command, "start");
|
|
17179
17899
|
console.log(
|
|
17180
17900
|
`\u{1F680} Starting environment for branch ${branch.name}: ${execution.kind === "webhook" ? redactManagedEnvWebhookUrlForAudit(execution.url) : execution.command}`
|
|
17181
17901
|
);
|
|
17182
|
-
const logPath = join2(
|
|
17183
|
-
homedir(),
|
|
17184
|
-
".agor",
|
|
17185
|
-
"logs",
|
|
17186
|
-
"branches",
|
|
17187
|
-
branch.branch_id,
|
|
17188
|
-
"environment.log"
|
|
17189
|
-
);
|
|
17190
|
-
await mkdir2(dirname2(logPath), { recursive: true });
|
|
17191
17902
|
if (execution.kind === "webhook") {
|
|
17192
17903
|
await this.executeEnvironmentWebhook({
|
|
17193
17904
|
url: execution.url,
|
|
@@ -17198,61 +17909,9 @@ var BranchesService = class extends DrizzleService {
|
|
|
17198
17909
|
});
|
|
17199
17910
|
console.log(`\u2705 Start webhook completed successfully for ${branch.name}`);
|
|
17200
17911
|
} else {
|
|
17201
|
-
|
|
17202
|
-
command: execution.command,
|
|
17203
|
-
branch,
|
|
17204
|
-
db: this.db,
|
|
17205
|
-
commandType: "start",
|
|
17206
|
-
stdio: "pipe",
|
|
17207
|
-
triggeredBy: this.extractTriggeredBy(params)
|
|
17208
|
-
});
|
|
17209
|
-
const outputChunks = [];
|
|
17210
|
-
const MAX_OUTPUT_LINES = 100;
|
|
17211
|
-
const collectOutput = (stream, prefix) => {
|
|
17212
|
-
if (!stream) return;
|
|
17213
|
-
stream.on("data", (chunk) => {
|
|
17214
|
-
const text = chunk.toString();
|
|
17215
|
-
if (prefix) {
|
|
17216
|
-
process.stderr.write(text);
|
|
17217
|
-
} else {
|
|
17218
|
-
process.stdout.write(text);
|
|
17219
|
-
}
|
|
17220
|
-
outputChunks.push(text);
|
|
17221
|
-
});
|
|
17222
|
-
};
|
|
17223
|
-
collectOutput(childProcess2.stdout);
|
|
17224
|
-
collectOutput(childProcess2.stderr, "stderr");
|
|
17225
|
-
await new Promise((resolve7, reject) => {
|
|
17226
|
-
childProcess2.on("exit", (code) => {
|
|
17227
|
-
if (code === 0) {
|
|
17228
|
-
console.log(`\u2705 Start command completed successfully for ${branch.name}`);
|
|
17229
|
-
resolve7();
|
|
17230
|
-
} else {
|
|
17231
|
-
const fullOutput = outputChunks.join("");
|
|
17232
|
-
const lines = fullOutput.split("\n");
|
|
17233
|
-
const truncated = lines.length > MAX_OUTPUT_LINES ? `... (truncated ${lines.length - MAX_OUTPUT_LINES} lines)
|
|
17234
|
-
${lines.slice(-MAX_OUTPUT_LINES).join("\n")}` : fullOutput;
|
|
17235
|
-
const output = truncated.trim();
|
|
17236
|
-
const err = new Error(`Start command exited with code ${code}`);
|
|
17237
|
-
err.commandOutput = output || void 0;
|
|
17238
|
-
reject(err);
|
|
17239
|
-
}
|
|
17240
|
-
});
|
|
17241
|
-
childProcess2.on("error", (error) => reject(error));
|
|
17242
|
-
});
|
|
17912
|
+
await this.dispatchEnvironmentExecutor({ branch, action: "start", params });
|
|
17243
17913
|
}
|
|
17244
|
-
|
|
17245
|
-
if (branch.app_url) {
|
|
17246
|
-
access_urls = [{ name: "App", url: branch.app_url }];
|
|
17247
|
-
}
|
|
17248
|
-
return await this.updateEnvironment(
|
|
17249
|
-
id,
|
|
17250
|
-
{
|
|
17251
|
-
// Don't change status - keep as 'starting' until first successful health check
|
|
17252
|
-
access_urls
|
|
17253
|
-
},
|
|
17254
|
-
params
|
|
17255
|
-
);
|
|
17914
|
+
return await this.get(id, params);
|
|
17256
17915
|
} catch (error) {
|
|
17257
17916
|
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
17258
17917
|
const commandOutput = error instanceof Error ? error.commandOutput : void 0;
|
|
@@ -17278,17 +17937,10 @@ ${lines.slice(-MAX_OUTPUT_LINES).join("\n")}` : fullOutput;
|
|
|
17278
17937
|
async stopEnvironment(id, params) {
|
|
17279
17938
|
await this.ensureCanTriggerEnv(id, params, "stop branch environments");
|
|
17280
17939
|
const branch = await this.get(id, params);
|
|
17281
|
-
await this.updateEnvironment(
|
|
17282
|
-
id,
|
|
17283
|
-
{
|
|
17284
|
-
status: "stopping"
|
|
17285
|
-
},
|
|
17286
|
-
params
|
|
17287
|
-
);
|
|
17940
|
+
await this.updateEnvironment(id, { status: "stopping" }, params);
|
|
17288
17941
|
try {
|
|
17289
17942
|
if (branch.stop_command) {
|
|
17290
|
-
const
|
|
17291
|
-
const execution = await this.resolveEnvironmentCommand(command, "stop");
|
|
17943
|
+
const execution = await this.resolveEnvironmentCommand(branch.stop_command, "stop");
|
|
17292
17944
|
console.log(
|
|
17293
17945
|
`\u{1F6D1} Stopping environment for branch ${branch.name}: ${execution.kind === "webhook" ? redactManagedEnvWebhookUrlForAudit(execution.url) : execution.command}`
|
|
17294
17946
|
);
|
|
@@ -17301,23 +17953,8 @@ ${lines.slice(-MAX_OUTPUT_LINES).join("\n")}` : fullOutput;
|
|
|
17301
17953
|
maxBytes: 16 * 1024
|
|
17302
17954
|
});
|
|
17303
17955
|
} else {
|
|
17304
|
-
|
|
17305
|
-
|
|
17306
|
-
branch,
|
|
17307
|
-
db: this.db,
|
|
17308
|
-
commandType: "stop",
|
|
17309
|
-
triggeredBy: this.extractTriggeredBy(params)
|
|
17310
|
-
});
|
|
17311
|
-
await new Promise((resolve7, reject) => {
|
|
17312
|
-
stopProcess.on("exit", (code) => {
|
|
17313
|
-
if (code === 0) {
|
|
17314
|
-
resolve7();
|
|
17315
|
-
} else {
|
|
17316
|
-
reject(new Error(`Down command exited with code ${code}`));
|
|
17317
|
-
}
|
|
17318
|
-
});
|
|
17319
|
-
stopProcess.on("error", (error) => reject(error));
|
|
17320
|
-
});
|
|
17956
|
+
await this.dispatchEnvironmentExecutor({ branch, action: "stop", params });
|
|
17957
|
+
return await this.get(id, params);
|
|
17321
17958
|
}
|
|
17322
17959
|
} else {
|
|
17323
17960
|
const managedProcess = this.processes.get(id);
|
|
@@ -17369,11 +18006,42 @@ ${lines.slice(-MAX_OUTPUT_LINES).join("\n")}` : fullOutput;
|
|
|
17369
18006
|
async restartEnvironment(id, params) {
|
|
17370
18007
|
await this.ensureCanTriggerEnv(id, params, "restart branch environments");
|
|
17371
18008
|
const branch = await this.get(id, params);
|
|
17372
|
-
if (branch.
|
|
18009
|
+
if (!branch.start_command) {
|
|
18010
|
+
throw new Error("No start command configured for this branch");
|
|
18011
|
+
}
|
|
18012
|
+
if (branch.environment_instance?.status !== "running") {
|
|
18013
|
+
return await this.startEnvironment(id, params);
|
|
18014
|
+
}
|
|
18015
|
+
const startExecution = await this.resolveEnvironmentCommand(branch.start_command, "start");
|
|
18016
|
+
const stopExecution = branch.stop_command ? await this.resolveEnvironmentCommand(branch.stop_command, "stop") : void 0;
|
|
18017
|
+
if (!branch.stop_command || stopExecution?.kind === "webhook") {
|
|
17373
18018
|
await this.stopEnvironment(id, params);
|
|
17374
|
-
await
|
|
18019
|
+
return await this.startEnvironment(id, params);
|
|
18020
|
+
}
|
|
18021
|
+
if (startExecution.kind === "webhook") {
|
|
18022
|
+
await this.updateEnvironment(id, { status: "stopping" }, params);
|
|
18023
|
+
await this.runEnvironmentExecutor({ branch, action: "stop", params });
|
|
18024
|
+
return await this.startEnvironment(id, params);
|
|
18025
|
+
}
|
|
18026
|
+
await this.updateEnvironment(id, { status: "stopping" }, params);
|
|
18027
|
+
try {
|
|
18028
|
+
await this.dispatchEnvironmentExecutor({ branch, action: "restart", params });
|
|
18029
|
+
return await this.get(id, params);
|
|
18030
|
+
} catch (error) {
|
|
18031
|
+
await this.updateEnvironment(
|
|
18032
|
+
id,
|
|
18033
|
+
{
|
|
18034
|
+
status: "error",
|
|
18035
|
+
last_health_check: {
|
|
18036
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
18037
|
+
status: "unhealthy",
|
|
18038
|
+
message: error instanceof Error ? error.message : "Unknown error during restart"
|
|
18039
|
+
}
|
|
18040
|
+
},
|
|
18041
|
+
params
|
|
18042
|
+
);
|
|
18043
|
+
throw error;
|
|
17375
18044
|
}
|
|
17376
|
-
return await this.startEnvironment(id, params);
|
|
17377
18045
|
}
|
|
17378
18046
|
/**
|
|
17379
18047
|
* Custom method: Nuke environment (destructive operation)
|
|
@@ -17384,16 +18052,9 @@ ${lines.slice(-MAX_OUTPUT_LINES).join("\n")}` : fullOutput;
|
|
|
17384
18052
|
if (!branch.nuke_command) {
|
|
17385
18053
|
throw new Error("No nuke_command configured for this branch");
|
|
17386
18054
|
}
|
|
17387
|
-
await this.updateEnvironment(
|
|
17388
|
-
id,
|
|
17389
|
-
{
|
|
17390
|
-
status: "stopping"
|
|
17391
|
-
},
|
|
17392
|
-
params
|
|
17393
|
-
);
|
|
18055
|
+
await this.updateEnvironment(id, { status: "stopping" }, params);
|
|
17394
18056
|
try {
|
|
17395
|
-
const
|
|
17396
|
-
const execution = await this.resolveEnvironmentCommand(command, "nuke");
|
|
18057
|
+
const execution = await this.resolveEnvironmentCommand(branch.nuke_command, "nuke");
|
|
17397
18058
|
console.log(
|
|
17398
18059
|
`\u{1F4A3} NUKING environment for branch ${branch.name}: ${execution.kind === "webhook" ? redactManagedEnvWebhookUrlForAudit(execution.url) : execution.command}`
|
|
17399
18060
|
);
|
|
@@ -17407,23 +18068,8 @@ ${lines.slice(-MAX_OUTPUT_LINES).join("\n")}` : fullOutput;
|
|
|
17407
18068
|
maxBytes: 16 * 1024
|
|
17408
18069
|
});
|
|
17409
18070
|
} else {
|
|
17410
|
-
|
|
17411
|
-
|
|
17412
|
-
branch,
|
|
17413
|
-
db: this.db,
|
|
17414
|
-
commandType: "nuke",
|
|
17415
|
-
triggeredBy: this.extractTriggeredBy(params)
|
|
17416
|
-
});
|
|
17417
|
-
await new Promise((resolve7, reject) => {
|
|
17418
|
-
nukeProcess.on("exit", (code) => {
|
|
17419
|
-
if (code === 0) {
|
|
17420
|
-
resolve7();
|
|
17421
|
-
} else {
|
|
17422
|
-
reject(new Error(`Nuke command exited with code ${code}`));
|
|
17423
|
-
}
|
|
17424
|
-
});
|
|
17425
|
-
nukeProcess.on("error", (error) => reject(error));
|
|
17426
|
-
});
|
|
18071
|
+
await this.dispatchEnvironmentExecutor({ branch, action: "nuke", params });
|
|
18072
|
+
return await this.get(id, params);
|
|
17427
18073
|
}
|
|
17428
18074
|
const managedProcess = this.processes.get(id);
|
|
17429
18075
|
if (managedProcess) {
|
|
@@ -17581,54 +18227,7 @@ ${lines.slice(-MAX_OUTPUT_LINES).join("\n")}` : fullOutput;
|
|
|
17581
18227
|
commandType: "logs",
|
|
17582
18228
|
triggeredBy: this.extractTriggeredBy(params),
|
|
17583
18229
|
maxBytes: ENVIRONMENT.LOGS_MAX_BYTES
|
|
17584
|
-
}).then(({ body, truncated: truncated2 }) => ({ stdout: body, stderr: "", truncated: truncated2 })) : await
|
|
17585
|
-
spawnEnvironmentCommand({
|
|
17586
|
-
command: execution.command,
|
|
17587
|
-
branch,
|
|
17588
|
-
db: this.db,
|
|
17589
|
-
commandType: "logs",
|
|
17590
|
-
stdio: "pipe",
|
|
17591
|
-
// Need to capture output for logs
|
|
17592
|
-
triggeredBy: this.extractTriggeredBy(params)
|
|
17593
|
-
}).then((childProcess2) => {
|
|
17594
|
-
let stdout = "";
|
|
17595
|
-
let stderr = "";
|
|
17596
|
-
let truncated2 = false;
|
|
17597
|
-
const timeout = setTimeout(() => {
|
|
17598
|
-
childProcess2.kill("SIGTERM");
|
|
17599
|
-
reject(
|
|
17600
|
-
new Error(
|
|
17601
|
-
`Logs command timed out after ${ENVIRONMENT.LOGS_TIMEOUT_MS / 1e3}s`
|
|
17602
|
-
)
|
|
17603
|
-
);
|
|
17604
|
-
}, ENVIRONMENT.LOGS_TIMEOUT_MS);
|
|
17605
|
-
childProcess2.stdout?.on("data", (data) => {
|
|
17606
|
-
const chunk = data.toString();
|
|
17607
|
-
if (stdout.length + chunk.length <= ENVIRONMENT.LOGS_MAX_BYTES) {
|
|
17608
|
-
stdout += chunk;
|
|
17609
|
-
} else {
|
|
17610
|
-
stdout += chunk.substring(0, ENVIRONMENT.LOGS_MAX_BYTES - stdout.length);
|
|
17611
|
-
truncated2 = true;
|
|
17612
|
-
childProcess2.kill("SIGTERM");
|
|
17613
|
-
}
|
|
17614
|
-
});
|
|
17615
|
-
childProcess2.stderr?.on("data", (data) => {
|
|
17616
|
-
stderr += data.toString();
|
|
17617
|
-
});
|
|
17618
|
-
childProcess2.on("exit", (code) => {
|
|
17619
|
-
clearTimeout(timeout);
|
|
17620
|
-
if (code === 0 || stdout.length > 0) {
|
|
17621
|
-
resolve7({ stdout, stderr, truncated: truncated2 });
|
|
17622
|
-
} else {
|
|
17623
|
-
reject(new Error(stderr || `Logs command exited with code ${code}`));
|
|
17624
|
-
}
|
|
17625
|
-
});
|
|
17626
|
-
childProcess2.on("error", (error) => {
|
|
17627
|
-
clearTimeout(timeout);
|
|
17628
|
-
reject(error);
|
|
17629
|
-
});
|
|
17630
|
-
}).catch(reject);
|
|
17631
|
-
});
|
|
18230
|
+
}).then(({ body, truncated: truncated2 }) => ({ stdout: body, stderr: "", truncated: truncated2 })) : await this.fetchEnvironmentLogsViaExecutor(branch, execution.command, params);
|
|
17632
18231
|
const allLines = result.stdout.split("\n");
|
|
17633
18232
|
let finalLines = allLines;
|
|
17634
18233
|
let wasTruncatedByLines = false;
|
|
@@ -17885,8 +18484,8 @@ function createCardsService(db) {
|
|
|
17885
18484
|
|
|
17886
18485
|
// src/services/check-auth.ts
|
|
17887
18486
|
import { promises as fs3 } from "fs";
|
|
17888
|
-
import { homedir
|
|
17889
|
-
import { join as
|
|
18487
|
+
import { homedir } from "os";
|
|
18488
|
+
import { join as join2 } from "path";
|
|
17890
18489
|
import { resolveApiKey } from "@agor/core/config";
|
|
17891
18490
|
import { Claude } from "@agor/core/sdk";
|
|
17892
18491
|
import { TOOL_API_KEY_NAMES } from "@agor/core/types";
|
|
@@ -17938,8 +18537,8 @@ async function probeClaudeCodeAuth() {
|
|
|
17938
18537
|
}
|
|
17939
18538
|
}
|
|
17940
18539
|
async function probeCodexAuth() {
|
|
17941
|
-
const codexHome = process.env.CODEX_HOME ||
|
|
17942
|
-
const authPath =
|
|
18540
|
+
const codexHome = process.env.CODEX_HOME || join2(homedir(), ".codex");
|
|
18541
|
+
const authPath = join2(codexHome, "auth.json");
|
|
17943
18542
|
let parsed;
|
|
17944
18543
|
try {
|
|
17945
18544
|
const raw = await fs3.readFile(authPath, "utf-8");
|
|
@@ -18442,7 +19041,7 @@ function createConfigService(db) {
|
|
|
18442
19041
|
|
|
18443
19042
|
// src/services/context.ts
|
|
18444
19043
|
import { readdir as readdir3, readFile as readFile2, stat as stat2 } from "fs/promises";
|
|
18445
|
-
import { isAbsolute as isAbsolute5, join as
|
|
19044
|
+
import { isAbsolute as isAbsolute5, join as join6, relative as relative3, resolve as resolve5 } from "path";
|
|
18446
19045
|
import { ROLES as ROLES6 } from "@agor/core/types";
|
|
18447
19046
|
|
|
18448
19047
|
// src/utils/authorization.ts
|
|
@@ -18550,15 +19149,15 @@ var ContextService = class {
|
|
|
18550
19149
|
* Recursively scan directory for markdown files
|
|
18551
19150
|
*/
|
|
18552
19151
|
async scanDirectory(basePath, relativePath, files) {
|
|
18553
|
-
const dirPath =
|
|
19152
|
+
const dirPath = join6(basePath, relativePath);
|
|
18554
19153
|
try {
|
|
18555
19154
|
const entries = await readdir3(dirPath, { withFileTypes: true });
|
|
18556
19155
|
for (const entry of entries) {
|
|
18557
|
-
const entryRelPath = relativePath ?
|
|
19156
|
+
const entryRelPath = relativePath ? join6(relativePath, entry.name) : entry.name;
|
|
18558
19157
|
if (entry.isDirectory()) {
|
|
18559
19158
|
await this.scanDirectory(basePath, entryRelPath, files);
|
|
18560
19159
|
} else if (entry.isFile() && entry.name.endsWith(".md")) {
|
|
18561
|
-
const fullPath =
|
|
19160
|
+
const fullPath = join6(dirPath, entry.name);
|
|
18562
19161
|
const stats = await stat2(fullPath);
|
|
18563
19162
|
const content = await readFile2(fullPath, "utf-8");
|
|
18564
19163
|
const title = this.extractTitle(content, entryRelPath);
|
|
@@ -18772,7 +19371,7 @@ function createCursorModelsService(db) {
|
|
|
18772
19371
|
|
|
18773
19372
|
// src/services/file.ts
|
|
18774
19373
|
import { lstat as lstat2, readdir as readdir4, readFile as readFile3, realpath as realpath4 } from "fs/promises";
|
|
18775
|
-
import { extname, isAbsolute as isAbsolute6, join as
|
|
19374
|
+
import { extname, isAbsolute as isAbsolute6, join as join7, relative as relative4, resolve as resolve6, sep as sep5 } from "path";
|
|
18776
19375
|
import { ROLES as ROLES7 } from "@agor/core/types";
|
|
18777
19376
|
var MAX_FILES = 5e4;
|
|
18778
19377
|
var MAX_PREVIEW_SIZE = 1024 * 1024;
|
|
@@ -18980,7 +19579,7 @@ var FileService = class {
|
|
|
18980
19579
|
scanState.truncated = true;
|
|
18981
19580
|
return;
|
|
18982
19581
|
}
|
|
18983
|
-
const fullPath =
|
|
19582
|
+
const fullPath = join7(currentDir, entry.name);
|
|
18984
19583
|
const stats = await lstat2(fullPath);
|
|
18985
19584
|
if (stats.isSymbolicLink()) {
|
|
18986
19585
|
console.log(`[File Service] Skipping symlink: ${fullPath}`);
|
|
@@ -19056,11 +19655,11 @@ function createFileService(branchRepo) {
|
|
|
19056
19655
|
}
|
|
19057
19656
|
|
|
19058
19657
|
// src/services/files.ts
|
|
19059
|
-
import { BranchRepository as BranchRepository4, SessionRepository, UsersRepository as
|
|
19658
|
+
import { BranchRepository as BranchRepository4, SessionRepository, UsersRepository as UsersRepository4 } from "@agor/core/db";
|
|
19060
19659
|
|
|
19061
19660
|
// src/utils/executor-read-impersonation.ts
|
|
19062
19661
|
import { loadConfigSync as loadConfigSync3 } from "@agor/core/config";
|
|
19063
|
-
import { UsersRepository as
|
|
19662
|
+
import { UsersRepository as UsersRepository3 } from "@agor/core/db";
|
|
19064
19663
|
async function resolveExecutorReadAsUser(db, userOrId) {
|
|
19065
19664
|
const config = loadConfigSync3();
|
|
19066
19665
|
const unixMode = config.execution?.unix_user_mode ?? "simple";
|
|
@@ -19069,7 +19668,7 @@ async function resolveExecutorReadAsUser(db, userOrId) {
|
|
|
19069
19668
|
}
|
|
19070
19669
|
let user;
|
|
19071
19670
|
if (typeof userOrId === "string") {
|
|
19072
|
-
user = await new
|
|
19671
|
+
user = await new UsersRepository3(db).findById(userOrId);
|
|
19073
19672
|
} else {
|
|
19074
19673
|
user = userOrId;
|
|
19075
19674
|
}
|
|
@@ -19099,7 +19698,7 @@ var FilesService = class {
|
|
|
19099
19698
|
this.app = app;
|
|
19100
19699
|
this.sessionRepo = new SessionRepository(db);
|
|
19101
19700
|
this.branchRepo = new BranchRepository4(db);
|
|
19102
|
-
this.usersRepo = new
|
|
19701
|
+
this.usersRepo = new UsersRepository4(db);
|
|
19103
19702
|
}
|
|
19104
19703
|
sessionRepo;
|
|
19105
19704
|
branchRepo;
|
|
@@ -19169,17 +19768,20 @@ function createFilesService(db, app) {
|
|
|
19169
19768
|
}
|
|
19170
19769
|
|
|
19171
19770
|
// src/services/gateway.ts
|
|
19771
|
+
import { PublicBaseUrlNotConfiguredError, requirePublicBaseUrl } from "@agor/core/config";
|
|
19172
19772
|
import {
|
|
19173
19773
|
GatewayChannelRepository,
|
|
19174
19774
|
MCPServerRepository as MCPServerRepository2,
|
|
19175
19775
|
shortId as shortId10,
|
|
19176
19776
|
ThreadSessionMapRepository,
|
|
19177
19777
|
UserMCPOAuthTokenRepository as UserMCPOAuthTokenRepository2,
|
|
19178
|
-
UsersRepository as
|
|
19778
|
+
UsersRepository as UsersRepository5
|
|
19179
19779
|
} from "@agor/core/db";
|
|
19180
19780
|
import {
|
|
19181
19781
|
formatGatewayContext,
|
|
19182
|
-
|
|
19782
|
+
formatGatewayFollowUpRoutingMessage,
|
|
19783
|
+
formatGatewaySessionCreatedMessage,
|
|
19784
|
+
formatGatewaySystemPayload,
|
|
19183
19785
|
getConnector,
|
|
19184
19786
|
hasConnector,
|
|
19185
19787
|
normalizeOutbound,
|
|
@@ -19187,6 +19789,7 @@ import {
|
|
|
19187
19789
|
} from "@agor/core/gateway";
|
|
19188
19790
|
import { resolveSessionDefaults } from "@agor/core/sessions";
|
|
19189
19791
|
import { SessionStatus } from "@agor/core/types";
|
|
19792
|
+
import { getSessionUrl } from "@agor/core/utils/url";
|
|
19190
19793
|
function hasListeningConfig(channel) {
|
|
19191
19794
|
const config = channel.config;
|
|
19192
19795
|
switch (channel.channel_type) {
|
|
@@ -19194,10 +19797,15 @@ function hasListeningConfig(channel) {
|
|
|
19194
19797
|
return !!config.app_token;
|
|
19195
19798
|
case "github":
|
|
19196
19799
|
return !!(config.app_id && config.private_key && config.installation_id && config.watch_repos?.length);
|
|
19800
|
+
case "teams":
|
|
19801
|
+
return !!(config.app_id && config.app_password);
|
|
19197
19802
|
default:
|
|
19198
19803
|
return false;
|
|
19199
19804
|
}
|
|
19200
19805
|
}
|
|
19806
|
+
function isSlackThinkingPlaceholder(text) {
|
|
19807
|
+
return /^thinking\s*\.{3}$/i.test(text.trim());
|
|
19808
|
+
}
|
|
19201
19809
|
function buildGitHubInitialPrompt(threadId, text, metadata) {
|
|
19202
19810
|
try {
|
|
19203
19811
|
const { owner, repo, number } = parseGitHubThreadId(threadId);
|
|
@@ -19272,6 +19880,26 @@ function buildGatewayContext(channel, data) {
|
|
|
19272
19880
|
extras
|
|
19273
19881
|
};
|
|
19274
19882
|
}
|
|
19883
|
+
case "teams": {
|
|
19884
|
+
const conversationType = meta.teams_conversation_type;
|
|
19885
|
+
const isPersonal = conversationType === "personal";
|
|
19886
|
+
let channelKind;
|
|
19887
|
+
if (isPersonal) {
|
|
19888
|
+
channelKind = "DM";
|
|
19889
|
+
} else if (conversationType === "channel") {
|
|
19890
|
+
channelKind = "Channel";
|
|
19891
|
+
} else if (conversationType === "groupChat") {
|
|
19892
|
+
channelKind = "Group Chat";
|
|
19893
|
+
}
|
|
19894
|
+
const channelName = isPersonal ? void 0 : meta.teams_channel_name ?? meta.teams_team_name ?? void 0;
|
|
19895
|
+
return {
|
|
19896
|
+
platform: "teams",
|
|
19897
|
+
channelName,
|
|
19898
|
+
channelKind,
|
|
19899
|
+
userName: meta.teams_user_name ?? void 0,
|
|
19900
|
+
userEmail: meta.teams_user_email ?? void 0
|
|
19901
|
+
};
|
|
19902
|
+
}
|
|
19275
19903
|
default:
|
|
19276
19904
|
return {
|
|
19277
19905
|
platform: channel.channel_type,
|
|
@@ -19279,7 +19907,7 @@ function buildGatewayContext(channel, data) {
|
|
|
19279
19907
|
};
|
|
19280
19908
|
}
|
|
19281
19909
|
}
|
|
19282
|
-
var GatewayService = class {
|
|
19910
|
+
var GatewayService = class _GatewayService {
|
|
19283
19911
|
channelRepo;
|
|
19284
19912
|
threadMapRepo;
|
|
19285
19913
|
usersRepo;
|
|
@@ -19303,10 +19931,25 @@ var GatewayService = class {
|
|
|
19303
19931
|
* previous one — only the final message matters.
|
|
19304
19932
|
*/
|
|
19305
19933
|
githubMessageBuffer = /* @__PURE__ */ new Map();
|
|
19934
|
+
/**
|
|
19935
|
+
* Slack status updates are serialized and lightly throttled so concurrent
|
|
19936
|
+
* tool/message hooks do not race while deleting/reposting the transient row.
|
|
19937
|
+
* Terminal states always bypass this throttle.
|
|
19938
|
+
*/
|
|
19939
|
+
slackProgressLastUpdate = /* @__PURE__ */ new Map();
|
|
19940
|
+
slackProgressQueues = /* @__PURE__ */ new Map();
|
|
19941
|
+
slackStreamsByTask = /* @__PURE__ */ new Map();
|
|
19942
|
+
slackStreamStatusRefreshLast = /* @__PURE__ */ new Map();
|
|
19943
|
+
slackStreamedMessageIds = /* @__PURE__ */ new Set();
|
|
19944
|
+
slackStreamedTaskIds = /* @__PURE__ */ new Set();
|
|
19945
|
+
slackStreamTaskByMessage = /* @__PURE__ */ new Map();
|
|
19946
|
+
static SLACK_PROGRESS_MIN_UPDATE_MS = 2500;
|
|
19947
|
+
static SLACK_STREAM_STATUS_REFRESH_MS = 300;
|
|
19948
|
+
static SLACK_STREAMED_MESSAGE_CACHE_MAX = 500;
|
|
19306
19949
|
constructor(db, app) {
|
|
19307
19950
|
this.channelRepo = new GatewayChannelRepository(db);
|
|
19308
19951
|
this.threadMapRepo = new ThreadSessionMapRepository(db);
|
|
19309
|
-
this.usersRepo = new
|
|
19952
|
+
this.usersRepo = new UsersRepository5(db);
|
|
19310
19953
|
this.mcpServerRepo = new MCPServerRepository2(db);
|
|
19311
19954
|
this.userTokenRepo = new UserMCPOAuthTokenRepository2(db);
|
|
19312
19955
|
this.app = app;
|
|
@@ -19323,21 +19966,479 @@ var GatewayService = class {
|
|
|
19323
19966
|
);
|
|
19324
19967
|
}
|
|
19325
19968
|
/**
|
|
19326
|
-
* Send a
|
|
19969
|
+
* Send a system message to the platform thread (fire-and-forget).
|
|
19327
19970
|
* Useful for giving the user visibility into what's happening.
|
|
19328
19971
|
*/
|
|
19329
|
-
|
|
19972
|
+
sendSystemMessage(channel, threadId, text, opts) {
|
|
19330
19973
|
if (channel.channel_type === "github") return;
|
|
19974
|
+
if (channel.channel_type === "slack" && opts?.suppressSlack) return;
|
|
19331
19975
|
if (!hasConnector(channel.channel_type)) return;
|
|
19332
19976
|
try {
|
|
19333
|
-
const connector = getConnector(channel.channel_type, channel.config);
|
|
19977
|
+
const connector = this.activeListeners.get(channel.id) ?? getConnector(channel.channel_type, channel.config);
|
|
19334
19978
|
connector.sendMessage({
|
|
19335
19979
|
threadId,
|
|
19336
|
-
|
|
19980
|
+
...formatGatewaySystemPayload(channel.channel_type, text)
|
|
19337
19981
|
}).catch((err) => console.warn("[gateway] Debug message failed:", err));
|
|
19338
19982
|
} catch {
|
|
19339
19983
|
}
|
|
19340
19984
|
}
|
|
19985
|
+
truncateSlackInline(value, maxChars = 70) {
|
|
19986
|
+
const singleLine = value.replace(/\s+/g, " ").trim();
|
|
19987
|
+
if (singleLine.length <= maxChars) return singleLine;
|
|
19988
|
+
return `${singleLine.slice(0, Math.max(0, maxChars - 1))}\u2026`;
|
|
19989
|
+
}
|
|
19990
|
+
formatSlackLoadingMessage(text) {
|
|
19991
|
+
return this.truncateSlackInline(text, 50);
|
|
19992
|
+
}
|
|
19993
|
+
makeSlackThreadIdForMessage(rootThreadId, messageTs) {
|
|
19994
|
+
const lastHyphen = rootThreadId.lastIndexOf("-");
|
|
19995
|
+
if (lastHyphen === -1) return null;
|
|
19996
|
+
const channelId = rootThreadId.slice(0, lastHyphen);
|
|
19997
|
+
if (!channelId || !messageTs) return null;
|
|
19998
|
+
return `${channelId}-${messageTs}`;
|
|
19999
|
+
}
|
|
20000
|
+
async addSlackThreadAlias(mapping, messageTs, reason) {
|
|
20001
|
+
const aliasThreadId = this.makeSlackThreadIdForMessage(mapping.thread_id, messageTs);
|
|
20002
|
+
if (!aliasThreadId || aliasThreadId === mapping.thread_id) return;
|
|
20003
|
+
const freshMapping = await this.threadMapRepo.findById(mapping.id);
|
|
20004
|
+
const metadata = (freshMapping ?? mapping).metadata ?? {};
|
|
20005
|
+
const aliases = Array.isArray(metadata.slack_thread_aliases) ? metadata.slack_thread_aliases.filter((alias) => typeof alias === "string") : [];
|
|
20006
|
+
if (aliases.includes(aliasThreadId)) return;
|
|
20007
|
+
await this.threadMapRepo.updateMetadata(mapping.id, {
|
|
20008
|
+
...metadata,
|
|
20009
|
+
slack_thread_aliases: [...aliases, aliasThreadId].slice(-50),
|
|
20010
|
+
slack_thread_alias_last_reason: reason
|
|
20011
|
+
});
|
|
20012
|
+
}
|
|
20013
|
+
getActiveSlackThreadId(mapping) {
|
|
20014
|
+
const metadata = mapping.metadata ?? {};
|
|
20015
|
+
return typeof metadata.slack_active_thread_id === "string" ? metadata.slack_active_thread_id : mapping.thread_id;
|
|
20016
|
+
}
|
|
20017
|
+
pickSlackRoutingMetadata(metadata) {
|
|
20018
|
+
return {
|
|
20019
|
+
...typeof metadata.slack_active_thread_id === "string" ? { slack_active_thread_id: metadata.slack_active_thread_id } : {},
|
|
20020
|
+
...Array.isArray(metadata.slack_thread_aliases) ? { slack_thread_aliases: metadata.slack_thread_aliases } : {},
|
|
20021
|
+
...typeof metadata.slack_thread_alias_last_reason === "string" ? { slack_thread_alias_last_reason: metadata.slack_thread_alias_last_reason } : {}
|
|
20022
|
+
};
|
|
20023
|
+
}
|
|
20024
|
+
async findSlackThreadAliasMapping(channelId, threadId) {
|
|
20025
|
+
const mappings = channelId ? await this.threadMapRepo.findByChannel(channelId, "active") : (await this.threadMapRepo.findAll()).filter((mapping) => mapping.status === "active");
|
|
20026
|
+
return mappings.find((mapping) => {
|
|
20027
|
+
const metadata = mapping.metadata ?? {};
|
|
20028
|
+
return Array.isArray(metadata.slack_thread_aliases) && metadata.slack_thread_aliases.includes(threadId);
|
|
20029
|
+
}) ?? null;
|
|
20030
|
+
}
|
|
20031
|
+
parseGatewayTodos(raw) {
|
|
20032
|
+
const candidate = typeof raw === "string" ? (() => {
|
|
20033
|
+
try {
|
|
20034
|
+
return JSON.parse(raw);
|
|
20035
|
+
} catch {
|
|
20036
|
+
return null;
|
|
20037
|
+
}
|
|
20038
|
+
})() : raw;
|
|
20039
|
+
if (!Array.isArray(candidate)) return [];
|
|
20040
|
+
return candidate.map((item) => {
|
|
20041
|
+
if (!item || typeof item !== "object") return null;
|
|
20042
|
+
const record = item;
|
|
20043
|
+
const content = typeof record.content === "string" ? record.content : typeof record.activeForm === "string" ? record.activeForm : null;
|
|
20044
|
+
if (!content) return null;
|
|
20045
|
+
const status = record.status;
|
|
20046
|
+
if (status !== "pending" && status !== "in_progress" && status !== "completed" && status !== "stopped" && status !== "unknown") {
|
|
20047
|
+
return { content, status: "pending" };
|
|
20048
|
+
}
|
|
20049
|
+
return {
|
|
20050
|
+
content,
|
|
20051
|
+
...typeof record.activeForm === "string" ? { activeForm: record.activeForm } : {},
|
|
20052
|
+
status
|
|
20053
|
+
};
|
|
20054
|
+
}).filter((item) => item !== null);
|
|
20055
|
+
}
|
|
20056
|
+
formatSlackToolSummary(toolName2, input) {
|
|
20057
|
+
if (!toolName2) return "Waiting for the agent...";
|
|
20058
|
+
const str = (value) => typeof value === "string" && value.trim().length > 0 ? value : void 0;
|
|
20059
|
+
const preview = (value, maxChars = 70) => {
|
|
20060
|
+
const text = str(value);
|
|
20061
|
+
return text ? this.truncateSlackInline(text, maxChars) : void 0;
|
|
20062
|
+
};
|
|
20063
|
+
const withPreview = (value) => value ? `\`${toolName2}\` ${value}` : `\`${toolName2}\``;
|
|
20064
|
+
if (toolName2 === "TodoWrite") {
|
|
20065
|
+
const todos = this.parseGatewayTodos(input?.todos);
|
|
20066
|
+
if (todos.length > 0) {
|
|
20067
|
+
const completed = todos.filter((todo) => todo.status === "completed").length;
|
|
20068
|
+
const inProgress = todos.filter((todo) => todo.status === "in_progress").length;
|
|
20069
|
+
const parts = [`${completed}/${todos.length} done`];
|
|
20070
|
+
if (inProgress > 0) parts.push(`${inProgress} in progress`);
|
|
20071
|
+
return withPreview(parts.join(", "));
|
|
20072
|
+
}
|
|
20073
|
+
}
|
|
20074
|
+
switch (toolName2) {
|
|
20075
|
+
case "Read":
|
|
20076
|
+
case "Write":
|
|
20077
|
+
case "Edit":
|
|
20078
|
+
case "NotebookEdit":
|
|
20079
|
+
return withPreview(preview(input?.file_path));
|
|
20080
|
+
case "Bash":
|
|
20081
|
+
case "exec_command":
|
|
20082
|
+
return withPreview(preview(input?.description) ?? preview(input?.command));
|
|
20083
|
+
case "Grep":
|
|
20084
|
+
case "Glob":
|
|
20085
|
+
return withPreview(preview(input?.pattern));
|
|
20086
|
+
case "ToolSearch":
|
|
20087
|
+
case "WebSearch":
|
|
20088
|
+
case "web_search":
|
|
20089
|
+
return withPreview(preview(input?.query));
|
|
20090
|
+
case "WebFetch":
|
|
20091
|
+
return withPreview(preview(input?.url));
|
|
20092
|
+
case "Agent":
|
|
20093
|
+
return withPreview(preview(input?.description));
|
|
20094
|
+
case "Skill":
|
|
20095
|
+
case "SlashCommand":
|
|
20096
|
+
return withPreview(preview(input?.skill) ?? preview(input?.name));
|
|
20097
|
+
case "Task":
|
|
20098
|
+
return withPreview(preview(str(input?.prompt)?.split("\n")[0], 100));
|
|
20099
|
+
case "edit_files": {
|
|
20100
|
+
const changes = input?.changes;
|
|
20101
|
+
if (Array.isArray(changes) && changes.length > 0) {
|
|
20102
|
+
if (changes.length === 1) {
|
|
20103
|
+
const change = changes[0];
|
|
20104
|
+
const kind = str(change.kind) ?? "update";
|
|
20105
|
+
const path13 = str(change.path) ?? "";
|
|
20106
|
+
return withPreview(this.truncateSlackInline(`${kind} ${path13}`.trim(), 70));
|
|
20107
|
+
}
|
|
20108
|
+
return withPreview(`${changes.length} files`);
|
|
20109
|
+
}
|
|
20110
|
+
break;
|
|
20111
|
+
}
|
|
20112
|
+
}
|
|
20113
|
+
return `\`${toolName2}\``;
|
|
20114
|
+
}
|
|
20115
|
+
buildSlackAssistantStatus(data, existingMetadata) {
|
|
20116
|
+
if (data.state === "done") return "";
|
|
20117
|
+
if (data.state === "failed") return "ran into an error.";
|
|
20118
|
+
if (data.state === "queued") {
|
|
20119
|
+
const position = typeof data.queue_position === "number" ? ` at position ${data.queue_position}` : "";
|
|
20120
|
+
return `is queued${position}.`;
|
|
20121
|
+
}
|
|
20122
|
+
const latestToolName = data.tool_name ?? (typeof existingMetadata.slack_status_tool_name === "string" ? existingMetadata.slack_status_tool_name : void 0);
|
|
20123
|
+
return latestToolName ? `is using ${this.truncateSlackInline(latestToolName, 40)}.` : "is working on your request.";
|
|
20124
|
+
}
|
|
20125
|
+
buildSlackAssistantLoadingMessage(data, existingMetadata) {
|
|
20126
|
+
if (data.state === "done") return void 0;
|
|
20127
|
+
if (data.state === "failed") return this.formatSlackLoadingMessage("Agor ran into an error.");
|
|
20128
|
+
if (data.state === "queued") return this.formatSlackLoadingMessage("Queued in Agor\u2026");
|
|
20129
|
+
const latestToolSummary = data.tool_name || data.tool_input ? this.formatSlackToolSummary(data.tool_name, data.tool_input) : typeof existingMetadata.slack_status_tool_summary === "string" ? existingMetadata.slack_status_tool_summary : void 0;
|
|
20130
|
+
if (latestToolSummary) {
|
|
20131
|
+
return this.formatSlackLoadingMessage(`Using ${latestToolSummary.replace(/`/g, "")}\u2026`);
|
|
20132
|
+
}
|
|
20133
|
+
const latestToolName = data.tool_name ?? (typeof existingMetadata.slack_status_tool_name === "string" ? existingMetadata.slack_status_tool_name : void 0);
|
|
20134
|
+
if (latestToolName) {
|
|
20135
|
+
return this.formatSlackLoadingMessage(`Using ${latestToolName}\u2026`);
|
|
20136
|
+
}
|
|
20137
|
+
return this.formatSlackLoadingMessage("Working in Agor\u2026");
|
|
20138
|
+
}
|
|
20139
|
+
stripSlackProgressMetadata(metadata) {
|
|
20140
|
+
const {
|
|
20141
|
+
slack_status_message_ts: _statusTs,
|
|
20142
|
+
slack_status_started_at: _startedAt,
|
|
20143
|
+
slack_status_tool_name: _toolName,
|
|
20144
|
+
slack_status_tool_summary: _toolSummary,
|
|
20145
|
+
slack_status_todos: _todos,
|
|
20146
|
+
slack_status_state: _state2,
|
|
20147
|
+
slack_status_task_id: _taskId,
|
|
20148
|
+
...rest
|
|
20149
|
+
} = metadata;
|
|
20150
|
+
return rest;
|
|
20151
|
+
}
|
|
20152
|
+
stripSlackProgressMessageMetadata(metadata) {
|
|
20153
|
+
const { slack_status_message_ts: _statusTs, ...rest } = metadata;
|
|
20154
|
+
return rest;
|
|
20155
|
+
}
|
|
20156
|
+
async refreshSlackAssistantStatusAfterStreamStart(threadId, connector, sessionId, taskId, metadata) {
|
|
20157
|
+
if (!connector.setThreadStatus) return;
|
|
20158
|
+
const progress = {
|
|
20159
|
+
session_id: sessionId,
|
|
20160
|
+
state: "working",
|
|
20161
|
+
...taskId ? { task_id: taskId } : {}
|
|
20162
|
+
};
|
|
20163
|
+
const loadingMessage = this.buildSlackAssistantLoadingMessage(progress, metadata) ?? this.formatSlackLoadingMessage("Writing response\u2026");
|
|
20164
|
+
await connector.setThreadStatus({
|
|
20165
|
+
threadId,
|
|
20166
|
+
status: this.buildSlackAssistantStatus(progress, metadata),
|
|
20167
|
+
loadingMessages: [loadingMessage],
|
|
20168
|
+
iconEmoji: ":hourglass_flowing_sand:"
|
|
20169
|
+
});
|
|
20170
|
+
if (taskId) {
|
|
20171
|
+
this.slackStreamStatusRefreshLast.set(taskId, Date.now());
|
|
20172
|
+
}
|
|
20173
|
+
}
|
|
20174
|
+
async refreshSlackAssistantStatusAfterStreamAppend(threadId, connector, sessionId, taskId, metadata) {
|
|
20175
|
+
if (!taskId) return;
|
|
20176
|
+
const now = Date.now();
|
|
20177
|
+
const lastRefresh = this.slackStreamStatusRefreshLast.get(taskId) ?? 0;
|
|
20178
|
+
if (now - lastRefresh < _GatewayService.SLACK_STREAM_STATUS_REFRESH_MS) return;
|
|
20179
|
+
this.slackStreamStatusRefreshLast.set(taskId, now);
|
|
20180
|
+
await this.refreshSlackAssistantStatusAfterStreamStart(
|
|
20181
|
+
threadId,
|
|
20182
|
+
connector,
|
|
20183
|
+
sessionId,
|
|
20184
|
+
taskId,
|
|
20185
|
+
metadata
|
|
20186
|
+
);
|
|
20187
|
+
}
|
|
20188
|
+
/**
|
|
20189
|
+
* Update Slack's native assistant status/stream chrome for a gateway thread.
|
|
20190
|
+
*
|
|
20191
|
+
* We expose a short, Slack-safe tool summary and TodoWrite plan state, never
|
|
20192
|
+
* raw JSON args/results. Raw tool inputs are already persisted in Agor's
|
|
20193
|
+
* transcript; Slack receives only a compact truncated preview.
|
|
20194
|
+
*/
|
|
20195
|
+
async updateProgress(data) {
|
|
20196
|
+
const previous = this.slackProgressQueues.get(data.session_id) ?? Promise.resolve();
|
|
20197
|
+
const next = previous.catch(() => void 0).then(() => this.updateProgressNow(data));
|
|
20198
|
+
this.slackProgressQueues.set(data.session_id, next);
|
|
20199
|
+
try {
|
|
20200
|
+
await next;
|
|
20201
|
+
} finally {
|
|
20202
|
+
if (this.slackProgressQueues.get(data.session_id) === next) {
|
|
20203
|
+
this.slackProgressQueues.delete(data.session_id);
|
|
20204
|
+
}
|
|
20205
|
+
}
|
|
20206
|
+
}
|
|
20207
|
+
wasMessageStreamedToSlack(messageId) {
|
|
20208
|
+
return this.slackStreamedMessageIds.has(messageId);
|
|
20209
|
+
}
|
|
20210
|
+
wasTaskStreamedToSlack(taskId) {
|
|
20211
|
+
return !!taskId && this.slackStreamedTaskIds.has(taskId);
|
|
20212
|
+
}
|
|
20213
|
+
markMessageStreamedToSlack(messageId) {
|
|
20214
|
+
this.slackStreamedMessageIds.add(messageId);
|
|
20215
|
+
if (this.slackStreamedMessageIds.size > _GatewayService.SLACK_STREAMED_MESSAGE_CACHE_MAX) {
|
|
20216
|
+
const oldest = this.slackStreamedMessageIds.values().next().value;
|
|
20217
|
+
if (oldest) this.slackStreamedMessageIds.delete(oldest);
|
|
20218
|
+
}
|
|
20219
|
+
}
|
|
20220
|
+
markTaskStreamedToSlack(taskId) {
|
|
20221
|
+
if (!taskId) return;
|
|
20222
|
+
this.slackStreamedTaskIds.add(taskId);
|
|
20223
|
+
if (this.slackStreamedTaskIds.size > _GatewayService.SLACK_STREAMED_MESSAGE_CACHE_MAX) {
|
|
20224
|
+
const oldest = this.slackStreamedTaskIds.values().next().value;
|
|
20225
|
+
if (oldest) this.slackStreamedTaskIds.delete(oldest);
|
|
20226
|
+
}
|
|
20227
|
+
}
|
|
20228
|
+
async stopSlackTaskStream(taskId, connector) {
|
|
20229
|
+
if (!taskId) return;
|
|
20230
|
+
const stream = this.slackStreamsByTask.get(taskId);
|
|
20231
|
+
if (!stream) return;
|
|
20232
|
+
if (!stream.hasContent && connector.deleteMessage) {
|
|
20233
|
+
await connector.deleteMessage({
|
|
20234
|
+
threadId: stream.threadId,
|
|
20235
|
+
messageId: stream.ts
|
|
20236
|
+
});
|
|
20237
|
+
this.slackStreamsByTask.delete(taskId);
|
|
20238
|
+
this.slackStreamStatusRefreshLast.delete(taskId);
|
|
20239
|
+
return;
|
|
20240
|
+
}
|
|
20241
|
+
const streamConnector = connector;
|
|
20242
|
+
if (!streamConnector.stopStream) return;
|
|
20243
|
+
await streamConnector.stopStream({
|
|
20244
|
+
threadId: stream.threadId,
|
|
20245
|
+
ts: stream.ts
|
|
20246
|
+
});
|
|
20247
|
+
this.slackStreamsByTask.delete(taskId);
|
|
20248
|
+
this.slackStreamStatusRefreshLast.delete(taskId);
|
|
20249
|
+
}
|
|
20250
|
+
async updateProgressNow(data) {
|
|
20251
|
+
if (!this.hasActiveChannels) return;
|
|
20252
|
+
const mapping = await this.threadMapRepo.findBySession(data.session_id);
|
|
20253
|
+
if (!mapping) return;
|
|
20254
|
+
const channel = await this.channelRepo.findById(mapping.channel_id);
|
|
20255
|
+
if (!channel?.enabled || channel.channel_type !== "slack") return;
|
|
20256
|
+
const now = Date.now();
|
|
20257
|
+
const isTerminal = data.state === "done" || data.state === "failed";
|
|
20258
|
+
const metadata = mapping.metadata ?? {};
|
|
20259
|
+
const isNewTask = typeof data.task_id === "string" && data.task_id !== metadata.slack_status_task_id;
|
|
20260
|
+
const isRestartingAfterTerminal = (data.state === "queued" || data.state === "working") && (metadata.slack_status_state === "done" || metadata.slack_status_state === "failed");
|
|
20261
|
+
const lastUpdate = this.slackProgressLastUpdate.get(data.session_id) ?? 0;
|
|
20262
|
+
if (!isTerminal && !data.tool_name && !isNewTask && !isRestartingAfterTerminal && now - lastUpdate < _GatewayService.SLACK_PROGRESS_MIN_UPDATE_MS) {
|
|
20263
|
+
return;
|
|
20264
|
+
}
|
|
20265
|
+
this.slackProgressLastUpdate.set(data.session_id, now);
|
|
20266
|
+
const statusStartedAt = isNewTask || isRestartingAfterTerminal ? new Date(now).toISOString() : typeof metadata.slack_status_started_at === "string" ? metadata.slack_status_started_at : new Date(now).toISOString();
|
|
20267
|
+
const toolTodos = data.tool_name === "TodoWrite" ? this.parseGatewayTodos(data.tool_input?.todos) : [];
|
|
20268
|
+
const toolSummary = data.tool_name || data.tool_input ? this.formatSlackToolSummary(data.tool_name, data.tool_input) : void 0;
|
|
20269
|
+
const baseMetadata = isNewTask || isRestartingAfterTerminal ? this.stripSlackProgressMetadata(metadata) : metadata;
|
|
20270
|
+
const metadataWithStart = {
|
|
20271
|
+
...baseMetadata,
|
|
20272
|
+
slack_status_started_at: statusStartedAt,
|
|
20273
|
+
slack_status_state: data.state,
|
|
20274
|
+
...data.task_id ? { slack_status_task_id: data.task_id } : {},
|
|
20275
|
+
...data.tool_name ? { slack_status_tool_name: data.tool_name } : {},
|
|
20276
|
+
...toolSummary ? { slack_status_tool_summary: toolSummary } : {},
|
|
20277
|
+
...toolTodos.length > 0 ? { slack_status_todos: toolTodos } : {}
|
|
20278
|
+
};
|
|
20279
|
+
const connector = this.activeListeners.get(channel.id) ?? getConnector(channel.channel_type, channel.config);
|
|
20280
|
+
const activeTaskId = typeof metadata.slack_status_task_id === "string" ? metadata.slack_status_task_id : void 0;
|
|
20281
|
+
try {
|
|
20282
|
+
if (isTerminal) {
|
|
20283
|
+
try {
|
|
20284
|
+
await this.stopSlackTaskStream(activeTaskId, connector);
|
|
20285
|
+
} catch (error) {
|
|
20286
|
+
console.warn("[gateway] Failed to stop Slack task stream:", error);
|
|
20287
|
+
}
|
|
20288
|
+
}
|
|
20289
|
+
const freshMapping = await this.threadMapRepo.findById(mapping.id);
|
|
20290
|
+
const freshMetadata = freshMapping?.metadata ?? {};
|
|
20291
|
+
const metadataForWrite = {
|
|
20292
|
+
...isTerminal ? this.stripSlackProgressMetadata(metadataWithStart) : this.stripSlackProgressMessageMetadata(metadataWithStart),
|
|
20293
|
+
...this.pickSlackRoutingMetadata(freshMetadata)
|
|
20294
|
+
};
|
|
20295
|
+
const slackThreadId = typeof metadataForWrite.slack_active_thread_id === "string" ? metadataForWrite.slack_active_thread_id : mapping.thread_id;
|
|
20296
|
+
await this.threadMapRepo.updateMetadata(mapping.id, metadataForWrite);
|
|
20297
|
+
if (!connector.setThreadStatus) return;
|
|
20298
|
+
try {
|
|
20299
|
+
const loadingMessage = this.buildSlackAssistantLoadingMessage(data, metadataWithStart);
|
|
20300
|
+
await connector.setThreadStatus({
|
|
20301
|
+
threadId: slackThreadId,
|
|
20302
|
+
status: this.buildSlackAssistantStatus(data, metadataWithStart),
|
|
20303
|
+
loadingMessages: loadingMessage ? [loadingMessage] : void 0,
|
|
20304
|
+
iconEmoji: ":hourglass_flowing_sand:"
|
|
20305
|
+
});
|
|
20306
|
+
} catch (error) {
|
|
20307
|
+
console.warn("[gateway] Failed to set Slack assistant status:", error);
|
|
20308
|
+
}
|
|
20309
|
+
} catch (error) {
|
|
20310
|
+
console.warn("[gateway] Failed to update Slack progress status:", error);
|
|
20311
|
+
}
|
|
20312
|
+
}
|
|
20313
|
+
async handleMessageStreamingEvent(event, data) {
|
|
20314
|
+
if (!this.hasActiveChannels) return;
|
|
20315
|
+
const sessionId = typeof data.session_id === "string" ? data.session_id : void 0;
|
|
20316
|
+
const messageId = typeof data.message_id === "string" ? data.message_id : void 0;
|
|
20317
|
+
const taskId = typeof data.task_id === "string" ? data.task_id : void 0;
|
|
20318
|
+
if (!sessionId || !messageId) return;
|
|
20319
|
+
if (event === "streaming:start") {
|
|
20320
|
+
if (taskId) {
|
|
20321
|
+
this.slackStreamTaskByMessage.set(messageId, taskId);
|
|
20322
|
+
}
|
|
20323
|
+
return;
|
|
20324
|
+
}
|
|
20325
|
+
const taskKey = taskId ?? this.slackStreamTaskByMessage.get(messageId) ?? messageId;
|
|
20326
|
+
const mapping = await this.threadMapRepo.findBySession(sessionId);
|
|
20327
|
+
if (!mapping) return;
|
|
20328
|
+
const channel = await this.channelRepo.findById(mapping.channel_id);
|
|
20329
|
+
if (!channel?.enabled || channel.channel_type !== "slack") return;
|
|
20330
|
+
const connector = this.activeListeners.get(channel.id) ?? getConnector(channel.channel_type, channel.config);
|
|
20331
|
+
const streamConnector = connector;
|
|
20332
|
+
if (!streamConnector.startStream || !streamConnector.appendStream) {
|
|
20333
|
+
return;
|
|
20334
|
+
}
|
|
20335
|
+
try {
|
|
20336
|
+
const metadata = mapping.metadata ?? {};
|
|
20337
|
+
const slackThreadId = this.getActiveSlackThreadId(mapping);
|
|
20338
|
+
const recipientUserId = typeof metadata.slack_user_id === "string" ? metadata.slack_user_id : void 0;
|
|
20339
|
+
const recipientTeamId = typeof metadata.slack_team_id === "string" ? metadata.slack_team_id : void 0;
|
|
20340
|
+
if (event === "streaming:chunk") {
|
|
20341
|
+
const chunk = typeof data.chunk === "string" ? data.chunk : "";
|
|
20342
|
+
if (!chunk) return;
|
|
20343
|
+
if (isSlackThinkingPlaceholder(chunk)) {
|
|
20344
|
+
return;
|
|
20345
|
+
}
|
|
20346
|
+
const existing = this.slackStreamsByTask.get(taskKey);
|
|
20347
|
+
if (!existing) {
|
|
20348
|
+
const ts = await streamConnector.startStream({
|
|
20349
|
+
threadId: slackThreadId,
|
|
20350
|
+
text: chunk,
|
|
20351
|
+
recipientUserId,
|
|
20352
|
+
recipientTeamId
|
|
20353
|
+
});
|
|
20354
|
+
this.slackStreamsByTask.set(taskKey, {
|
|
20355
|
+
threadId: slackThreadId,
|
|
20356
|
+
ts,
|
|
20357
|
+
hasContent: true,
|
|
20358
|
+
taskId: taskKey,
|
|
20359
|
+
lastMessageId: messageId
|
|
20360
|
+
});
|
|
20361
|
+
await this.addSlackThreadAlias(mapping, ts, "stream");
|
|
20362
|
+
try {
|
|
20363
|
+
await this.refreshSlackAssistantStatusAfterStreamStart(
|
|
20364
|
+
slackThreadId,
|
|
20365
|
+
connector,
|
|
20366
|
+
sessionId,
|
|
20367
|
+
taskKey,
|
|
20368
|
+
metadata
|
|
20369
|
+
);
|
|
20370
|
+
} catch (error) {
|
|
20371
|
+
console.warn("[gateway] Failed to refresh Slack status after stream start:", error);
|
|
20372
|
+
}
|
|
20373
|
+
this.markMessageStreamedToSlack(messageId);
|
|
20374
|
+
this.markTaskStreamedToSlack(taskKey);
|
|
20375
|
+
return;
|
|
20376
|
+
}
|
|
20377
|
+
const text = existing.hasContent && existing.lastMessageId && existing.lastMessageId !== messageId ? `
|
|
20378
|
+
|
|
20379
|
+
${chunk}` : chunk;
|
|
20380
|
+
await streamConnector.appendStream({
|
|
20381
|
+
threadId: existing.threadId,
|
|
20382
|
+
ts: existing.ts,
|
|
20383
|
+
text
|
|
20384
|
+
});
|
|
20385
|
+
try {
|
|
20386
|
+
await this.refreshSlackAssistantStatusAfterStreamAppend(
|
|
20387
|
+
existing.threadId,
|
|
20388
|
+
connector,
|
|
20389
|
+
sessionId,
|
|
20390
|
+
taskKey,
|
|
20391
|
+
metadata
|
|
20392
|
+
);
|
|
20393
|
+
} catch (error) {
|
|
20394
|
+
console.warn("[gateway] Failed to refresh Slack status after stream append:", error);
|
|
20395
|
+
}
|
|
20396
|
+
existing.hasContent = true;
|
|
20397
|
+
existing.lastMessageId = messageId;
|
|
20398
|
+
this.markMessageStreamedToSlack(messageId);
|
|
20399
|
+
this.markTaskStreamedToSlack(taskKey);
|
|
20400
|
+
return;
|
|
20401
|
+
}
|
|
20402
|
+
if (event === "streaming:end") {
|
|
20403
|
+
const existing = this.slackStreamsByTask.get(taskKey);
|
|
20404
|
+
if (existing?.hasContent) {
|
|
20405
|
+
this.markMessageStreamedToSlack(messageId);
|
|
20406
|
+
this.markTaskStreamedToSlack(taskKey);
|
|
20407
|
+
}
|
|
20408
|
+
this.slackStreamTaskByMessage.delete(messageId);
|
|
20409
|
+
return;
|
|
20410
|
+
}
|
|
20411
|
+
if (event === "streaming:error") {
|
|
20412
|
+
this.slackStreamTaskByMessage.delete(messageId);
|
|
20413
|
+
}
|
|
20414
|
+
} catch (error) {
|
|
20415
|
+
this.slackStreamsByTask.delete(taskKey);
|
|
20416
|
+
this.slackStreamTaskByMessage.delete(messageId);
|
|
20417
|
+
console.warn("[gateway] Failed to mirror message stream to Slack:", error);
|
|
20418
|
+
}
|
|
20419
|
+
}
|
|
20420
|
+
async fetchExistingSessionUrlForGatewayUser(sessionId, user) {
|
|
20421
|
+
try {
|
|
20422
|
+
const baseUrl = await requirePublicBaseUrl();
|
|
20423
|
+
return getSessionUrl(sessionId, baseUrl);
|
|
20424
|
+
} catch (error) {
|
|
20425
|
+
if (!(error instanceof PublicBaseUrlNotConfiguredError)) {
|
|
20426
|
+
console.warn("[gateway] Failed to build public session URL:", error);
|
|
20427
|
+
}
|
|
20428
|
+
}
|
|
20429
|
+
try {
|
|
20430
|
+
const sessionsService = this.app.service("sessions");
|
|
20431
|
+
const sessionWithUrl = await sessionsService.get(sessionId, { user });
|
|
20432
|
+
const sessionUrl = sessionWithUrl.url || null;
|
|
20433
|
+
if (!sessionUrl) return null;
|
|
20434
|
+
const hostname = new URL(sessionUrl).hostname;
|
|
20435
|
+
if (hostname === "0.0.0.0") return null;
|
|
20436
|
+
return sessionUrl;
|
|
20437
|
+
} catch (error) {
|
|
20438
|
+
console.warn("[gateway] Failed to fetch session URL:", error);
|
|
20439
|
+
return null;
|
|
20440
|
+
}
|
|
20441
|
+
}
|
|
19341
20442
|
/**
|
|
19342
20443
|
* Inbound routing: platform → session
|
|
19343
20444
|
*
|
|
@@ -19352,12 +20453,27 @@ var GatewayService = class {
|
|
|
19352
20453
|
if (!channel.enabled) {
|
|
19353
20454
|
throw new Error("Channel is disabled");
|
|
19354
20455
|
}
|
|
19355
|
-
|
|
20456
|
+
let existingMapping = await this.threadMapRepo.findByChannelAndThread(
|
|
19356
20457
|
channel.id,
|
|
19357
20458
|
data.thread_id
|
|
19358
20459
|
);
|
|
20460
|
+
if (!existingMapping && channel.channel_type === "slack") {
|
|
20461
|
+
existingMapping = await this.findSlackThreadAliasMapping(channel.id, data.thread_id);
|
|
20462
|
+
if (existingMapping) {
|
|
20463
|
+
console.log(
|
|
20464
|
+
`[gateway] Found Slack thread alias: ${data.thread_id} \u2192 ${existingMapping.thread_id}`
|
|
20465
|
+
);
|
|
20466
|
+
}
|
|
20467
|
+
}
|
|
20468
|
+
if (existingMapping && channel.channel_type === "slack") {
|
|
20469
|
+
console.log(
|
|
20470
|
+
`[gateway] Slack inbound thread ${data.thread_id} \u2192 session ${shortId10(existingMapping.session_id)} (root ${existingMapping.thread_id})`
|
|
20471
|
+
);
|
|
20472
|
+
}
|
|
19359
20473
|
if (!existingMapping) {
|
|
19360
|
-
const
|
|
20474
|
+
const exactThreadMapping = await this.threadMapRepo.findByThread(data.thread_id);
|
|
20475
|
+
const aliasThreadMapping = channel.channel_type === "slack" ? await this.findSlackThreadAliasMapping(void 0, data.thread_id) : null;
|
|
20476
|
+
const otherChannelMapping = exactThreadMapping && exactThreadMapping.channel_id !== channel.id ? exactThreadMapping : aliasThreadMapping && aliasThreadMapping.channel_id !== channel.id ? aliasThreadMapping : null;
|
|
19361
20477
|
if (otherChannelMapping) {
|
|
19362
20478
|
console.log(
|
|
19363
20479
|
`[gateway] IGNORED: Thread ${data.thread_id} owned by channel ${shortId10(otherChannelMapping.channel_id)}, not ours (${shortId10(channel.id)}). Silently dropping.`
|
|
@@ -19390,7 +20506,7 @@ var GatewayService = class {
|
|
|
19390
20506
|
console.error(
|
|
19391
20507
|
`[gateway] Channel "${channel.name}" has no agor_user_id and alignment is OFF. Cannot process message.`
|
|
19392
20508
|
);
|
|
19393
|
-
this.
|
|
20509
|
+
this.sendSystemMessage(channel, data.thread_id, errMsg);
|
|
19394
20510
|
if (channel.channel_type === "github" && data.metadata?.processing_comment_id) {
|
|
19395
20511
|
try {
|
|
19396
20512
|
const connector = getConnector(channel.channel_type, channel.config);
|
|
@@ -19414,7 +20530,7 @@ var GatewayService = class {
|
|
|
19414
20530
|
if (alignSlackUsers) {
|
|
19415
20531
|
if (data.metadata?.slack_user_email && typeof data.metadata.slack_user_email === "string") {
|
|
19416
20532
|
const email = data.metadata.slack_user_email.toLowerCase().trim();
|
|
19417
|
-
const matchedUser = await this.usersRepo.
|
|
20533
|
+
const matchedUser = await this.usersRepo.findByEmailForAlignment(email);
|
|
19418
20534
|
if (matchedUser) {
|
|
19419
20535
|
console.log(
|
|
19420
20536
|
`[gateway] Slack user aligned: ${email} \u2192 Agor user ${shortId10(matchedUser.user_id)} (${matchedUser.name || matchedUser.email})`
|
|
@@ -19422,7 +20538,7 @@ var GatewayService = class {
|
|
|
19422
20538
|
user = await usersService.get(matchedUser.user_id);
|
|
19423
20539
|
} else {
|
|
19424
20540
|
console.log(`[gateway] Slack user alignment failed: no Agor user with email ${email}`);
|
|
19425
|
-
this.
|
|
20541
|
+
this.sendSystemMessage(
|
|
19426
20542
|
channel,
|
|
19427
20543
|
data.thread_id,
|
|
19428
20544
|
`User ${email} doesn't have an Agor account. Ask an admin to create an account with this email, or disable user alignment.`
|
|
@@ -19437,7 +20553,7 @@ var GatewayService = class {
|
|
|
19437
20553
|
console.log(
|
|
19438
20554
|
`[gateway] Slack user alignment failed: could not resolve email for Slack user ${data.user_name ?? "unknown"} (thread=${data.thread_id})`
|
|
19439
20555
|
);
|
|
19440
|
-
this.
|
|
20556
|
+
this.sendSystemMessage(
|
|
19441
20557
|
channel,
|
|
19442
20558
|
data.thread_id,
|
|
19443
20559
|
"Couldn't resolve your Slack identity. The bot may be missing the `users:read.email` scope, or your Slack profile has no email. Ask an admin to check the bot's scopes."
|
|
@@ -19455,7 +20571,7 @@ var GatewayService = class {
|
|
|
19455
20571
|
const userMap = channelConfig.user_map;
|
|
19456
20572
|
const mappedEmail = githubLogin && userMap?.[githubLogin] ? userMap[githubLogin].toLowerCase().trim() : null;
|
|
19457
20573
|
if (mappedEmail) {
|
|
19458
|
-
const matchedUser = await this.usersRepo.
|
|
20574
|
+
const matchedUser = await this.usersRepo.findByEmailForAlignment(mappedEmail);
|
|
19459
20575
|
if (matchedUser) {
|
|
19460
20576
|
console.log(
|
|
19461
20577
|
`[gateway] GitHub user aligned via user_map: ${githubLogin} \u2192 ${mappedEmail} \u2192 Agor user ${shortId10(matchedUser.user_id)}`
|
|
@@ -19471,7 +20587,7 @@ var GatewayService = class {
|
|
|
19471
20587
|
if (!resolved) {
|
|
19472
20588
|
const githubEmail = data.metadata?.github_user_email && typeof data.metadata.github_user_email === "string" ? data.metadata.github_user_email.toLowerCase().trim() : null;
|
|
19473
20589
|
if (githubEmail) {
|
|
19474
|
-
const matchedUser = await this.usersRepo.
|
|
20590
|
+
const matchedUser = await this.usersRepo.findByEmailForAlignment(githubEmail);
|
|
19475
20591
|
if (matchedUser) {
|
|
19476
20592
|
console.log(
|
|
19477
20593
|
`[gateway] GitHub user aligned via email: ${githubLogin} (${githubEmail}) \u2192 Agor user ${shortId10(matchedUser.user_id)}`
|
|
@@ -19529,24 +20645,34 @@ var GatewayService = class {
|
|
|
19529
20645
|
if (existingMapping) {
|
|
19530
20646
|
sessionId = existingMapping.session_id;
|
|
19531
20647
|
await this.threadMapRepo.updateLastMessage(existingMapping.id);
|
|
19532
|
-
|
|
19533
|
-
|
|
19534
|
-
|
|
19535
|
-
|
|
19536
|
-
}
|
|
19537
|
-
|
|
20648
|
+
const existingMetadata = existingMapping.metadata ?? {};
|
|
20649
|
+
await this.threadMapRepo.updateMetadata(existingMapping.id, {
|
|
20650
|
+
...existingMetadata,
|
|
20651
|
+
...data.metadata?.processing_comment_id ? { processing_comment_id: data.metadata.processing_comment_id } : {},
|
|
20652
|
+
...typeof data.metadata?.slack_user_id === "string" ? { slack_user_id: data.metadata.slack_user_id } : {},
|
|
20653
|
+
...typeof data.metadata?.slack_team_id === "string" ? { slack_team_id: data.metadata.slack_team_id } : {},
|
|
20654
|
+
...channel.channel_type === "slack" ? { slack_active_thread_id: data.thread_id } : {}
|
|
20655
|
+
});
|
|
20656
|
+
if (channel.channel_type === "slack") {
|
|
20657
|
+
console.log(
|
|
20658
|
+
`[gateway] Slack active outbound thread for session ${shortId10(sessionId)} set to ${data.thread_id}`
|
|
20659
|
+
);
|
|
20660
|
+
}
|
|
20661
|
+
const sessionUrl = await this.fetchExistingSessionUrlForGatewayUser(sessionId, user);
|
|
20662
|
+
if (sessionUrl) {
|
|
20663
|
+
this.sendSystemMessage(
|
|
20664
|
+
channel,
|
|
20665
|
+
data.thread_id,
|
|
20666
|
+
formatGatewayFollowUpRoutingMessage(sessionId, sessionUrl)
|
|
20667
|
+
);
|
|
19538
20668
|
}
|
|
19539
|
-
this.sendDebugMessage(
|
|
19540
|
-
channel,
|
|
19541
|
-
data.thread_id,
|
|
19542
|
-
`Received follow-up, routing to session ${shortId10(sessionId)}...`
|
|
19543
|
-
);
|
|
19544
20669
|
} else {
|
|
19545
20670
|
const sessionsService = this.app.service("sessions");
|
|
19546
|
-
this.
|
|
20671
|
+
this.sendSystemMessage(
|
|
19547
20672
|
channel,
|
|
19548
20673
|
data.thread_id,
|
|
19549
|
-
`Creating new ${agenticTool} session (${permissionMode} mode)
|
|
20674
|
+
`Creating new ${agenticTool} session (${permissionMode} mode)...`,
|
|
20675
|
+
{ suppressSlack: true }
|
|
19550
20676
|
);
|
|
19551
20677
|
const gatewaySource = {
|
|
19552
20678
|
channel_id: channel.id,
|
|
@@ -19622,19 +20748,16 @@ var GatewayService = class {
|
|
|
19622
20748
|
session_id: session.session_id,
|
|
19623
20749
|
branch_id: channel.target_branch_id,
|
|
19624
20750
|
status: "active",
|
|
19625
|
-
metadata: data.metadata ?? null
|
|
20751
|
+
metadata: channel.channel_type === "slack" ? { ...data.metadata ?? {}, slack_active_thread_id: data.thread_id } : data.metadata ?? null
|
|
19626
20752
|
});
|
|
19627
|
-
|
|
19628
|
-
|
|
19629
|
-
|
|
19630
|
-
|
|
19631
|
-
|
|
19632
|
-
|
|
19633
|
-
|
|
20753
|
+
const sessionUrl = await this.fetchExistingSessionUrlForGatewayUser(sessionId, user);
|
|
20754
|
+
if (sessionUrl) {
|
|
20755
|
+
this.sendSystemMessage(
|
|
20756
|
+
channel,
|
|
20757
|
+
data.thread_id,
|
|
20758
|
+
formatGatewaySessionCreatedMessage(sessionId, sessionUrl)
|
|
20759
|
+
);
|
|
19634
20760
|
}
|
|
19635
|
-
const sessionIdShort = shortId10(sessionId);
|
|
19636
|
-
const message = sessionUrl ? `Session created: ${sessionUrl}` : `Session ${sessionIdShort} created, sending prompt to agent...`;
|
|
19637
|
-
this.sendDebugMessage(channel, data.thread_id, message);
|
|
19638
20761
|
if (channel.channel_type === "github" && data.metadata?.processing_comment_id) {
|
|
19639
20762
|
try {
|
|
19640
20763
|
const connector = getConnector(channel.channel_type, channel.config);
|
|
@@ -19677,19 +20800,36 @@ ${promptText}`;
|
|
|
19677
20800
|
console.log(
|
|
19678
20801
|
`[gateway] Message queued for session ${shortId10(sessionId)} at position ${task.queue_position}`
|
|
19679
20802
|
);
|
|
19680
|
-
this.
|
|
20803
|
+
this.sendSystemMessage(
|
|
19681
20804
|
channel,
|
|
19682
20805
|
data.thread_id,
|
|
19683
|
-
`Session is busy, message queued at position ${task.queue_position}
|
|
20806
|
+
`Session is busy, message queued at position ${task.queue_position}`,
|
|
20807
|
+
{ suppressSlack: true }
|
|
19684
20808
|
);
|
|
20809
|
+
void this.updateProgress({
|
|
20810
|
+
session_id: sessionId,
|
|
20811
|
+
state: "queued",
|
|
20812
|
+
task_id: task.task_id,
|
|
20813
|
+
queue_position: task.queue_position
|
|
20814
|
+
});
|
|
19685
20815
|
} else {
|
|
19686
20816
|
console.log(
|
|
19687
20817
|
`[gateway] Prompt sent to session ${shortId10(sessionId)} via /sessions/:id/prompt`
|
|
19688
20818
|
);
|
|
20819
|
+
void this.updateProgress({
|
|
20820
|
+
session_id: sessionId,
|
|
20821
|
+
state: "working",
|
|
20822
|
+
task_id: task.task_id
|
|
20823
|
+
});
|
|
19689
20824
|
}
|
|
19690
20825
|
} catch (error) {
|
|
19691
20826
|
console.error("[gateway] Failed to send prompt to session:", error);
|
|
19692
|
-
this.
|
|
20827
|
+
this.sendSystemMessage(channel, data.thread_id, `Error sending prompt: ${error}`);
|
|
20828
|
+
void this.updateProgress({
|
|
20829
|
+
session_id: sessionId,
|
|
20830
|
+
state: "failed",
|
|
20831
|
+
error_message: error instanceof Error ? error.message : String(error)
|
|
20832
|
+
});
|
|
19693
20833
|
}
|
|
19694
20834
|
return {
|
|
19695
20835
|
success: true,
|
|
@@ -19732,19 +20872,21 @@ ${promptText}`;
|
|
|
19732
20872
|
return { routed: true, channelType: "github" };
|
|
19733
20873
|
}
|
|
19734
20874
|
try {
|
|
19735
|
-
const connector = getConnector(channel.channel_type, channel.config);
|
|
20875
|
+
const connector = this.activeListeners.get(channel.id) ?? getConnector(channel.channel_type, channel.config);
|
|
19736
20876
|
const { text, blocks } = normalizeOutbound(
|
|
19737
20877
|
connector.formatMessage ? connector.formatMessage(data.message) : data.message
|
|
19738
20878
|
);
|
|
19739
|
-
|
|
19740
|
-
|
|
20879
|
+
const threadId = channel.channel_type === "slack" ? this.getActiveSlackThreadId(mapping) : mapping.thread_id;
|
|
20880
|
+
const sentTs = await connector.sendMessage({
|
|
20881
|
+
threadId,
|
|
19741
20882
|
text,
|
|
19742
20883
|
blocks,
|
|
19743
20884
|
metadata: data.metadata
|
|
19744
20885
|
});
|
|
19745
|
-
|
|
19746
|
-
|
|
19747
|
-
|
|
20886
|
+
if (channel.channel_type === "slack") {
|
|
20887
|
+
await this.addSlackThreadAlias(mapping, sentTs, "message");
|
|
20888
|
+
}
|
|
20889
|
+
console.log(`[gateway] Routed message to ${channel.channel_type} thread ${threadId}`);
|
|
19748
20890
|
} catch (error) {
|
|
19749
20891
|
console.error(`[gateway] Failed to route message to ${channel.channel_type}:`, error);
|
|
19750
20892
|
return { routed: false, channelType: channel.channel_type };
|
|
@@ -20563,6 +21705,60 @@ function setupBranchEffectiveAccessService(app, branchRepo) {
|
|
|
20563
21705
|
{ methods: ["find"] }
|
|
20564
21706
|
);
|
|
20565
21707
|
}
|
|
21708
|
+
function setupBoardAlignedBranchesService(app, branchRepo) {
|
|
21709
|
+
app.use(
|
|
21710
|
+
"boards/:id/aligned-branches",
|
|
21711
|
+
{
|
|
21712
|
+
async find(params) {
|
|
21713
|
+
const authParams = params;
|
|
21714
|
+
if (authParams?.provider && !authParams.user?._isServiceAccount) {
|
|
21715
|
+
const user = authParams.user;
|
|
21716
|
+
if (!user) throw new NotAuthenticated7("Authentication required");
|
|
21717
|
+
if (!hasMinimumRole7(user.role, ROLES9.ADMIN)) {
|
|
21718
|
+
throw new Forbidden8("Only admins can list board-aligned branches");
|
|
21719
|
+
}
|
|
21720
|
+
}
|
|
21721
|
+
const boardId = paramsRoute(params)?.id;
|
|
21722
|
+
if (!boardId) throw new BadRequest3("Board ID is required");
|
|
21723
|
+
return branchRepo.findBoardAlignedBranches(boardId);
|
|
21724
|
+
}
|
|
21725
|
+
},
|
|
21726
|
+
{ methods: ["find"] }
|
|
21727
|
+
);
|
|
21728
|
+
}
|
|
21729
|
+
function setupBranchFsAccessUsersService(app, branchRepo) {
|
|
21730
|
+
app.use(
|
|
21731
|
+
"branches/:id/fs-access-users",
|
|
21732
|
+
{
|
|
21733
|
+
async find(params) {
|
|
21734
|
+
const authParams = params;
|
|
21735
|
+
if (authParams?.provider && !authParams.user?._isServiceAccount) {
|
|
21736
|
+
const user = authParams.user;
|
|
21737
|
+
if (!user) throw new NotAuthenticated7("Authentication required");
|
|
21738
|
+
if (!hasMinimumRole7(user.role, ROLES9.ADMIN)) {
|
|
21739
|
+
throw new Forbidden8("Only admins can list branch filesystem access users");
|
|
21740
|
+
}
|
|
21741
|
+
}
|
|
21742
|
+
const branchId = paramsRoute(params)?.id;
|
|
21743
|
+
if (!branchId) throw new BadRequest3("Branch ID is required");
|
|
21744
|
+
const userIds = await branchRepo.findExplicitFsAccessUserIds(branchId);
|
|
21745
|
+
const usersService = app.service("users");
|
|
21746
|
+
const users3 = await Promise.all(
|
|
21747
|
+
userIds.map(async (userId) => {
|
|
21748
|
+
try {
|
|
21749
|
+
return await usersService.get(userId);
|
|
21750
|
+
} catch (error) {
|
|
21751
|
+
console.error(`Failed to fetch branch filesystem access user ${userId}:`, error);
|
|
21752
|
+
return null;
|
|
21753
|
+
}
|
|
21754
|
+
})
|
|
21755
|
+
);
|
|
21756
|
+
return users3.filter((user) => user !== null);
|
|
21757
|
+
}
|
|
21758
|
+
},
|
|
21759
|
+
{ methods: ["find"] }
|
|
21760
|
+
);
|
|
21761
|
+
}
|
|
20566
21762
|
|
|
20567
21763
|
// src/services/knowledge-document-edits.ts
|
|
20568
21764
|
import { KnowledgeDocumentVersionRepository, KnowledgeNamespaceRepository as KnowledgeNamespaceRepository3 } from "@agor/core/db";
|
|
@@ -23233,12 +24429,6 @@ var MCPServersService = class extends DrizzleService {
|
|
|
23233
24429
|
* Override find to support filter params
|
|
23234
24430
|
*/
|
|
23235
24431
|
async find(params) {
|
|
23236
|
-
const paramsRecord = params;
|
|
23237
|
-
const userRecord = paramsRecord?.user;
|
|
23238
|
-
const userId = userRecord?.user_id;
|
|
23239
|
-
console.log(
|
|
23240
|
-
`[MCPServersService.find] Called with userId: ${userId || "NONE"}, provider: ${params?.provider || "internal"}, hasConnection: ${!!paramsRecord?.connection}`
|
|
23241
|
-
);
|
|
23242
24432
|
const filters = {};
|
|
23243
24433
|
if (params?.query) {
|
|
23244
24434
|
if (params.query.scope) filters.scope = params.query.scope;
|
|
@@ -23426,7 +24616,7 @@ async function performOAuthDisconnect(deps) {
|
|
|
23426
24616
|
}
|
|
23427
24617
|
|
|
23428
24618
|
// src/services/repos.ts
|
|
23429
|
-
import { homedir as
|
|
24619
|
+
import { homedir as homedir2 } from "os";
|
|
23430
24620
|
import path8 from "path";
|
|
23431
24621
|
import {
|
|
23432
24622
|
ensureBranchStorageModeAllowed,
|
|
@@ -23734,7 +24924,7 @@ var ReposService = class extends DrizzleService {
|
|
|
23734
24924
|
throw new Error("Path is required to add a local repository");
|
|
23735
24925
|
}
|
|
23736
24926
|
if (inputPath.startsWith("~")) {
|
|
23737
|
-
const homeDir =
|
|
24927
|
+
const homeDir = homedir2();
|
|
23738
24928
|
inputPath = path8.join(homeDir, inputPath.slice(1).replace(/^[/\\]?/, ""));
|
|
23739
24929
|
}
|
|
23740
24930
|
if (!path8.isAbsolute(inputPath)) {
|
|
@@ -24332,8 +25522,9 @@ import {
|
|
|
24332
25522
|
BranchRepository as BranchRepository6,
|
|
24333
25523
|
SessionEnvSelectionRepository as SessionEnvSelectionRepository2,
|
|
24334
25524
|
SessionMCPServerRepository as SessionMCPServerRepository2,
|
|
25525
|
+
SessionRelationshipRepository,
|
|
24335
25526
|
SessionRepository as SessionRepository2,
|
|
24336
|
-
UsersRepository as
|
|
25527
|
+
UsersRepository as UsersRepository6
|
|
24337
25528
|
} from "@agor/core/db";
|
|
24338
25529
|
import { Forbidden as Forbidden15 } from "@agor/core/feathers";
|
|
24339
25530
|
import { formatModelToolMismatchWarning, lintModelToolMatch } from "@agor/core/models";
|
|
@@ -24345,10 +25536,16 @@ function getInheritableConfig(parent) {
|
|
|
24345
25536
|
model_config: parent.model_config
|
|
24346
25537
|
};
|
|
24347
25538
|
}
|
|
25539
|
+
var remoteRelationshipsEnrichedResults = /* @__PURE__ */ new WeakSet();
|
|
25540
|
+
function markRemoteRelationshipsEnrichedResult(result) {
|
|
25541
|
+
remoteRelationshipsEnrichedResults.add(result);
|
|
25542
|
+
return result;
|
|
25543
|
+
}
|
|
24348
25544
|
var SessionsService = class extends DrizzleService {
|
|
24349
25545
|
sessionRepo;
|
|
24350
25546
|
app;
|
|
24351
25547
|
sessionMCPRepo;
|
|
25548
|
+
sessionRelationshipRepo;
|
|
24352
25549
|
sessionEnvSelectionRepo;
|
|
24353
25550
|
usersRepo;
|
|
24354
25551
|
branchRepo;
|
|
@@ -24367,9 +25564,30 @@ var SessionsService = class extends DrizzleService {
|
|
|
24367
25564
|
this.sessionRepo = sessionRepo;
|
|
24368
25565
|
this.app = app;
|
|
24369
25566
|
this.sessionMCPRepo = new SessionMCPServerRepository2(db);
|
|
25567
|
+
this.sessionRelationshipRepo = new SessionRelationshipRepository(db);
|
|
24370
25568
|
this.sessionEnvSelectionRepo = new SessionEnvSelectionRepository2(db);
|
|
24371
25569
|
this.branchRepo = new BranchRepository6(db);
|
|
24372
|
-
this.usersRepo = new
|
|
25570
|
+
this.usersRepo = new UsersRepository6(db);
|
|
25571
|
+
}
|
|
25572
|
+
async enrichRemoteRelationships(sessionList) {
|
|
25573
|
+
const sessionIds = sessionList.map((session) => session.session_id);
|
|
25574
|
+
if (sessionIds.length === 0) return sessionList;
|
|
25575
|
+
const relationships = await this.sessionRelationshipRepo.findForSessions(sessionIds);
|
|
25576
|
+
if (relationships.length === 0) return sessionList;
|
|
25577
|
+
const bySessionId = /* @__PURE__ */ new Map();
|
|
25578
|
+
for (const relationship of relationships) {
|
|
25579
|
+
const sourceBucket = bySessionId.get(relationship.source_session_id) ?? { as_source: [], as_target: [] };
|
|
25580
|
+
sourceBucket.as_source?.push(relationship);
|
|
25581
|
+
bySessionId.set(relationship.source_session_id, sourceBucket);
|
|
25582
|
+
const targetBucket = bySessionId.get(relationship.target_session_id) ?? { as_source: [], as_target: [] };
|
|
25583
|
+
targetBucket.as_target?.push(relationship);
|
|
25584
|
+
bySessionId.set(relationship.target_session_id, targetBucket);
|
|
25585
|
+
}
|
|
25586
|
+
return sessionList.map((session) => {
|
|
25587
|
+
const remoteRelationships = bySessionId.get(session.session_id);
|
|
25588
|
+
if (!remoteRelationships) return session;
|
|
25589
|
+
return { ...session, remote_relationships: remoteRelationships };
|
|
25590
|
+
});
|
|
24373
25591
|
}
|
|
24374
25592
|
/**
|
|
24375
25593
|
* Attach explicit MCP server IDs to a session.
|
|
@@ -24773,6 +25991,24 @@ ${data.extraInstructions}`;
|
|
|
24773
25991
|
this.emit?.("removed", session, params);
|
|
24774
25992
|
return session;
|
|
24775
25993
|
}
|
|
25994
|
+
/**
|
|
25995
|
+
* Override patch to keep durable relationship callback state synchronized
|
|
25996
|
+
* with the existing callback_config.enabled execution switch.
|
|
25997
|
+
*/
|
|
25998
|
+
async patch(id, data, params) {
|
|
25999
|
+
const result = await super.patch(id, data, params);
|
|
26000
|
+
const callbackEnabled = data.callback_config?.enabled;
|
|
26001
|
+
if (typeof callbackEnabled === "boolean" && !params?._skipRelationshipCallbackSync) {
|
|
26002
|
+
const sessionsToSync = Array.isArray(result) ? result : [result];
|
|
26003
|
+
for (const session of sessionsToSync) {
|
|
26004
|
+
await this.sessionRelationshipRepo.setCallbackEnabledForTargetSession(
|
|
26005
|
+
session.session_id,
|
|
26006
|
+
callbackEnabled
|
|
26007
|
+
);
|
|
26008
|
+
}
|
|
26009
|
+
}
|
|
26010
|
+
return result;
|
|
26011
|
+
}
|
|
24776
26012
|
/**
|
|
24777
26013
|
* Override get to optionally enrich with last message
|
|
24778
26014
|
*
|
|
@@ -24783,6 +26019,8 @@ ${data.extraInstructions}`;
|
|
|
24783
26019
|
const includeLastMessageRoot = params?._include_last_message;
|
|
24784
26020
|
const includeLastMessage = includeLastMessageRoot ?? includeLastMessageQuery;
|
|
24785
26021
|
const session = await super.get(id, params);
|
|
26022
|
+
const [enrichedSession] = await this.enrichRemoteRelationships([session]);
|
|
26023
|
+
const sessionWithRelationships = enrichedSession ?? session;
|
|
24786
26024
|
if (includeLastMessage === true || includeLastMessage === "true") {
|
|
24787
26025
|
const truncationLengthQuery = params?.query?.last_message_truncation_length;
|
|
24788
26026
|
const truncationLengthRoot = params?._last_message_truncation_length;
|
|
@@ -24790,20 +26028,28 @@ ${data.extraInstructions}`;
|
|
|
24790
26028
|
truncationLengthRoot ?? truncationLengthQuery
|
|
24791
26029
|
);
|
|
24792
26030
|
const result = await this.sessionRepo.enrichWithLastMessage(
|
|
24793
|
-
|
|
26031
|
+
sessionWithRelationships,
|
|
24794
26032
|
truncationLength
|
|
24795
26033
|
);
|
|
24796
26034
|
return result;
|
|
24797
26035
|
}
|
|
24798
|
-
return
|
|
26036
|
+
return sessionWithRelationships;
|
|
24799
26037
|
}
|
|
24800
26038
|
/**
|
|
24801
|
-
* Override find
|
|
24802
|
-
*
|
|
24803
|
-
* Note: Last message is NOT included in list operations - only on single GET
|
|
26039
|
+
* Override find to include durable remote relationships in list results.
|
|
26040
|
+
* Note: Last message is NOT included in list operations - only on single GET.
|
|
24804
26041
|
*/
|
|
24805
26042
|
async find(params) {
|
|
24806
|
-
|
|
26043
|
+
const result = await super.find(params);
|
|
26044
|
+
if (Array.isArray(result)) {
|
|
26045
|
+
const enriched = await this.enrichRemoteRelationships(result);
|
|
26046
|
+
return markRemoteRelationshipsEnrichedResult(enriched);
|
|
26047
|
+
}
|
|
26048
|
+
const enrichedData = await this.enrichRemoteRelationships(result.data);
|
|
26049
|
+
return markRemoteRelationshipsEnrichedResult({
|
|
26050
|
+
...result,
|
|
26051
|
+
data: enrichedData
|
|
26052
|
+
});
|
|
24807
26053
|
}
|
|
24808
26054
|
};
|
|
24809
26055
|
function createSessionsService(db, app) {
|
|
@@ -25132,7 +26378,7 @@ var TasksService = class extends DrizzleService {
|
|
|
25132
26378
|
},
|
|
25133
26379
|
{
|
|
25134
26380
|
...params,
|
|
25135
|
-
|
|
26381
|
+
suppressTerminalSessionStateUpdate: true,
|
|
25136
26382
|
suppressTerminalQueueProcessing: true
|
|
25137
26383
|
}
|
|
25138
26384
|
);
|
|
@@ -25144,10 +26390,17 @@ var TasksService = class extends DrizzleService {
|
|
|
25144
26390
|
);
|
|
25145
26391
|
return failedTask;
|
|
25146
26392
|
}
|
|
26393
|
+
const sessionPatchParams = {
|
|
26394
|
+
...params,
|
|
26395
|
+
suppressTerminalQueueProcessing: true
|
|
26396
|
+
};
|
|
25147
26397
|
await this.app.service("sessions").patch(
|
|
25148
26398
|
failedTask.session_id,
|
|
25149
|
-
{
|
|
25150
|
-
|
|
26399
|
+
{
|
|
26400
|
+
status: SessionStatus3.FAILED,
|
|
26401
|
+
ready_for_prompt: true
|
|
26402
|
+
},
|
|
26403
|
+
sessionPatchParams
|
|
25151
26404
|
).catch((error) => {
|
|
25152
26405
|
console.warn(
|
|
25153
26406
|
`[executor-heartbeat] Failed to mark session ${shortId15(failedTask.session_id)} failed after stale heartbeat:`,
|
|
@@ -25186,11 +26439,10 @@ var TasksService = class extends DrizzleService {
|
|
|
25186
26439
|
*/
|
|
25187
26440
|
async patch(id, data, params) {
|
|
25188
26441
|
const nextStatus = data.status;
|
|
25189
|
-
const
|
|
25190
|
-
|
|
25191
|
-
if (currentTask && isTerminalTaskStatus(currentTask.status) && isTerminalTaskStatus(nextStatus)) {
|
|
26442
|
+
const currentTask = nextStatus !== void 0 ? await this.get(id, params) : void 0;
|
|
26443
|
+
if (currentTask && isTerminalTaskStatus(currentTask.status) && nextStatus !== void 0) {
|
|
25192
26444
|
console.warn(
|
|
25193
|
-
`\u23ED\uFE0F [TasksService] Ignoring
|
|
26445
|
+
`\u23ED\uFE0F [TasksService] Ignoring status rewrite for terminal task ${shortId15(currentTask.task_id)} (${currentTask.status} \u2192 ${nextStatus})`
|
|
25194
26446
|
);
|
|
25195
26447
|
return currentTask;
|
|
25196
26448
|
}
|
|
@@ -25267,49 +26519,59 @@ var TasksService = class extends DrizzleService {
|
|
|
25267
26519
|
});
|
|
25268
26520
|
}
|
|
25269
26521
|
const latestTaskId = session.tasks?.[session.tasks.length - 1];
|
|
26522
|
+
const suppressCompletionCallbacks = params?.suppressCompletionCallbacks === true;
|
|
26523
|
+
const suppressBtwCleanup = params?.suppressBtwCleanup === true;
|
|
25270
26524
|
if (latestTaskId && latestTaskId !== task.task_id) {
|
|
25271
26525
|
console.log(
|
|
25272
|
-
`\u23ED\uFE0F [TasksService] Skipping session
|
|
26526
|
+
`\u23ED\uFE0F [TasksService] Skipping session terminal-state update - task ${shortId15(task.task_id)} is not the latest (latest: ${shortId15(latestTaskId)})`
|
|
25273
26527
|
);
|
|
25274
|
-
|
|
26528
|
+
if (!suppressCompletionCallbacks) {
|
|
26529
|
+
await this.dispatchCompletionCallbacks(task, session, params);
|
|
26530
|
+
}
|
|
25275
26531
|
return result;
|
|
25276
26532
|
}
|
|
25277
26533
|
const isUserInitiatedStop = data.status === TaskStatus.STOPPED;
|
|
25278
26534
|
if (isUserInitiatedStop) {
|
|
25279
26535
|
console.log(
|
|
25280
|
-
`\u23ED\uFE0F [TasksService] Skipping session
|
|
26536
|
+
`\u23ED\uFE0F [TasksService] Skipping session terminal-state update for STOPPED task ${shortId15(task.task_id)} \u2014 stop endpoint handles session state`
|
|
25281
26537
|
);
|
|
25282
|
-
} else if (params?.
|
|
26538
|
+
} else if (params?.suppressTerminalSessionStateUpdate) {
|
|
25283
26539
|
console.log(
|
|
25284
|
-
`\u23ED\uFE0F [TasksService] Skipping session
|
|
26540
|
+
`\u23ED\uFE0F [TasksService] Skipping session terminal-state update for task ${shortId15(task.task_id)} (${data.status}) due to internal patch params`
|
|
25285
26541
|
);
|
|
25286
26542
|
} else {
|
|
25287
26543
|
await this.app.service("sessions").patch(
|
|
25288
26544
|
task.session_id,
|
|
25289
26545
|
{
|
|
25290
|
-
status:
|
|
26546
|
+
status: data.status === TaskStatus.FAILED ? SessionStatus3.FAILED : SessionStatus3.IDLE,
|
|
25291
26547
|
ready_for_prompt: true
|
|
25292
26548
|
},
|
|
25293
26549
|
params
|
|
25294
26550
|
);
|
|
25295
26551
|
console.log(
|
|
25296
|
-
`\u2705 [TasksService] Session ${shortId15(task.session_id)} status updated
|
|
26552
|
+
`\u2705 [TasksService] Session ${shortId15(task.session_id)} status updated after terminal task (task ${shortId15(task.task_id)} ${data.status})`
|
|
25297
26553
|
);
|
|
25298
26554
|
}
|
|
25299
|
-
|
|
26555
|
+
if (!suppressCompletionCallbacks) {
|
|
26556
|
+
await this.dispatchCompletionCallbacks(task, session, params);
|
|
26557
|
+
}
|
|
25300
26558
|
if (session.fork_origin === "btw") {
|
|
25301
|
-
|
|
25302
|
-
|
|
25303
|
-
|
|
25304
|
-
|
|
25305
|
-
|
|
25306
|
-
|
|
25307
|
-
|
|
25308
|
-
|
|
25309
|
-
|
|
25310
|
-
|
|
26559
|
+
if (!suppressBtwCleanup) {
|
|
26560
|
+
try {
|
|
26561
|
+
await this.app.service("sessions").patch(session.session_id, {
|
|
26562
|
+
archived: true,
|
|
26563
|
+
archived_reason: "btw_completed"
|
|
26564
|
+
});
|
|
26565
|
+
console.log(
|
|
26566
|
+
`\u{1F4E6} [TasksService] Auto-archived btw fork session ${shortId15(session.session_id)}`
|
|
26567
|
+
);
|
|
26568
|
+
} catch (error) {
|
|
26569
|
+
console.warn(`\u26A0\uFE0F [TasksService] Failed to auto-archive btw fork:`, error);
|
|
26570
|
+
}
|
|
26571
|
+
}
|
|
26572
|
+
if (!suppressCompletionCallbacks) {
|
|
26573
|
+
await this.injectBtwResultMessage(task, session, params);
|
|
25311
26574
|
}
|
|
25312
|
-
await this.injectBtwResultMessage(task, session, params);
|
|
25313
26575
|
}
|
|
25314
26576
|
const sessionsService = this.app.service("sessions");
|
|
25315
26577
|
if (!params?.suppressTerminalQueueProcessing && sessionsService.triggerQueueProcessing) {
|
|
@@ -25717,7 +26979,7 @@ import os2 from "os";
|
|
|
25717
26979
|
import path11 from "path";
|
|
25718
26980
|
import { buildClaudeCliSpawn as buildClaudeCliSpawn2 } from "@agor/core/claude-cli";
|
|
25719
26981
|
import {
|
|
25720
|
-
createUserProcessEnvironment,
|
|
26982
|
+
createUserProcessEnvironment as createUserProcessEnvironment2,
|
|
25721
26983
|
loadConfig as loadConfig9,
|
|
25722
26984
|
resolveUserEnvironment as resolveUserEnvironment2
|
|
25723
26985
|
} from "@agor/core/config";
|
|
@@ -25725,13 +26987,13 @@ import {
|
|
|
25725
26987
|
BranchRepository as BranchRepository7,
|
|
25726
26988
|
SessionRepository as SessionRepository6,
|
|
25727
26989
|
shortId as shortId18,
|
|
25728
|
-
UsersRepository as
|
|
26990
|
+
UsersRepository as UsersRepository7
|
|
25729
26991
|
} from "@agor/core/db";
|
|
25730
26992
|
import { Forbidden as Forbidden16 } from "@agor/core/feathers";
|
|
25731
26993
|
import {
|
|
25732
|
-
resolveUnixUserForImpersonation as
|
|
26994
|
+
resolveUnixUserForImpersonation as resolveUnixUserForImpersonation3,
|
|
25733
26995
|
UnixUserNotFoundError,
|
|
25734
|
-
validateResolvedUnixUser
|
|
26996
|
+
validateResolvedUnixUser as validateResolvedUnixUser2
|
|
25735
26997
|
} from "@agor/core/unix";
|
|
25736
26998
|
|
|
25737
26999
|
// src/utils/mcp-token-authorization.ts
|
|
@@ -25773,7 +27035,7 @@ import {
|
|
|
25773
27035
|
import {
|
|
25774
27036
|
getHomedirFromUsername,
|
|
25775
27037
|
isValidUnixUsername,
|
|
25776
|
-
resolveUnixUserForImpersonation
|
|
27038
|
+
resolveUnixUserForImpersonation as resolveUnixUserForImpersonation2
|
|
25777
27039
|
} from "@agor/core/unix";
|
|
25778
27040
|
|
|
25779
27041
|
// src/utils/build-initial-user-message.ts
|
|
@@ -25844,7 +27106,7 @@ function buildClaudeCliAgorMcpConfig(params) {
|
|
|
25844
27106
|
}
|
|
25845
27107
|
function resolveClaudeCliMcpConfigTargetUnixUser(config, session) {
|
|
25846
27108
|
const mode = config?.execution?.unix_user_mode ?? "simple";
|
|
25847
|
-
const result =
|
|
27109
|
+
const result = resolveUnixUserForImpersonation2({
|
|
25848
27110
|
mode,
|
|
25849
27111
|
userUnixUsername: session.unix_username,
|
|
25850
27112
|
executorUnixUser: config?.execution?.executor_unix_user
|
|
@@ -26344,7 +27606,7 @@ var TerminalsService = class {
|
|
|
26344
27606
|
const unixUserMode = config.execution?.unix_user_mode ?? "simple";
|
|
26345
27607
|
const executorUser = config.execution?.executor_unix_user;
|
|
26346
27608
|
let impersonatedUser = null;
|
|
26347
|
-
const usersRepo = new
|
|
27609
|
+
const usersRepo = new UsersRepository7(this.db);
|
|
26348
27610
|
try {
|
|
26349
27611
|
const user = await usersRepo.findById(userId);
|
|
26350
27612
|
if (user?.unix_username) {
|
|
@@ -26353,14 +27615,14 @@ var TerminalsService = class {
|
|
|
26353
27615
|
} catch (error) {
|
|
26354
27616
|
console.warn(`\u26A0\uFE0F Failed to load user ${userId}:`, error);
|
|
26355
27617
|
}
|
|
26356
|
-
const impersonationResult =
|
|
27618
|
+
const impersonationResult = resolveUnixUserForImpersonation3({
|
|
26357
27619
|
mode: unixUserMode,
|
|
26358
27620
|
userUnixUsername: impersonatedUser,
|
|
26359
27621
|
executorUnixUser: executorUser
|
|
26360
27622
|
});
|
|
26361
27623
|
const finalUnixUser = impersonationResult.unixUser;
|
|
26362
27624
|
try {
|
|
26363
|
-
|
|
27625
|
+
validateResolvedUnixUser2(unixUserMode, finalUnixUser);
|
|
26364
27626
|
} catch (err) {
|
|
26365
27627
|
if (err instanceof UnixUserNotFoundError) {
|
|
26366
27628
|
throw new Error(`${err.message}`);
|
|
@@ -26388,7 +27650,7 @@ var TerminalsService = class {
|
|
|
26388
27650
|
const sessionToken = generateSessionToken(this.app);
|
|
26389
27651
|
const userEnv = await resolveUserEnvironment2(userId, this.db);
|
|
26390
27652
|
const envFile = writeEnvFile(userId, userEnv, finalUnixUser);
|
|
26391
|
-
const executorEnv = await
|
|
27653
|
+
const executorEnv = await createUserProcessEnvironment2(
|
|
26392
27654
|
userId,
|
|
26393
27655
|
this.db,
|
|
26394
27656
|
void 0,
|
|
@@ -27042,7 +28304,7 @@ function shouldExposeMCPServerSecrets(params, options = {}) {
|
|
|
27042
28304
|
// src/utils/session-state.ts
|
|
27043
28305
|
import { createHash as createHash4 } from "crypto";
|
|
27044
28306
|
import { createReadStream as createReadStream2, createWriteStream as createWriteStream2 } from "fs";
|
|
27045
|
-
import { mkdir as
|
|
28307
|
+
import { mkdir as mkdir4, readdir as readdir5, readFile as readFile4, stat as stat3 } from "fs/promises";
|
|
27046
28308
|
import os3 from "os";
|
|
27047
28309
|
import path12 from "path";
|
|
27048
28310
|
import { createGunzip, createGzip } from "zlib";
|
|
@@ -27120,7 +28382,7 @@ async function serializeFile(filePath) {
|
|
|
27120
28382
|
});
|
|
27121
28383
|
}
|
|
27122
28384
|
async function restoreFile(filePath, payload) {
|
|
27123
|
-
await
|
|
28385
|
+
await mkdir4(path12.dirname(filePath), { recursive: true });
|
|
27124
28386
|
return new Promise((resolve7, reject) => {
|
|
27125
28387
|
const gunzip = createGunzip();
|
|
27126
28388
|
const out = createWriteStream2(filePath);
|
|
@@ -27365,6 +28627,7 @@ async function registerServices(ctx) {
|
|
|
27365
28627
|
"update",
|
|
27366
28628
|
"patch",
|
|
27367
28629
|
"remove",
|
|
28630
|
+
"updateEnvironment",
|
|
27368
28631
|
"initializeUnixGroup",
|
|
27369
28632
|
"ensureAssistantKnowledgeNamespace"
|
|
27370
28633
|
]
|
|
@@ -27390,6 +28653,8 @@ async function registerServices(ctx) {
|
|
|
27390
28653
|
methods: ["find", "create", "remove"]
|
|
27391
28654
|
});
|
|
27392
28655
|
setupBranchEffectiveAccessService(app, new BranchRepository8(db));
|
|
28656
|
+
setupBoardAlignedBranchesService(app, new BranchRepository8(db));
|
|
28657
|
+
setupBranchFsAccessUsersService(app, new BranchRepository8(db));
|
|
27393
28658
|
if (branchRbacEnabled) {
|
|
27394
28659
|
setupBoardOwnersService(app, new BoardRepository5(db));
|
|
27395
28660
|
setupBoardGroupGrantsService(app, db);
|
|
@@ -27479,8 +28744,8 @@ async function registerServices(ctx) {
|
|
|
27479
28744
|
app.use("/cursor-models", createCursorModelsService(db));
|
|
27480
28745
|
app.service("/cursor-models").hooks({ before: { find: [ctx.requireAuth] } });
|
|
27481
28746
|
const branchRepository = new BranchRepository8(db);
|
|
27482
|
-
const { UsersRepository:
|
|
27483
|
-
const usersRepository = new
|
|
28747
|
+
const { UsersRepository: UsersRepository8, SessionRepository: SessionRepository7 } = await import("@agor/core/db");
|
|
28748
|
+
const usersRepository = new UsersRepository8(db);
|
|
27484
28749
|
const sessionsRepository = new SessionRepository7(db);
|
|
27485
28750
|
if (svcEnabled("file_browser")) {
|
|
27486
28751
|
app.use("/context", createContextService(branchRepository));
|
|
@@ -27604,31 +28869,24 @@ function createExecuteHandler(ctx, sessionsService, sessionTokenService) {
|
|
|
27604
28869
|
}
|
|
27605
28870
|
}
|
|
27606
28871
|
const {
|
|
27607
|
-
resolveUnixUserForImpersonation:
|
|
27608
|
-
validateResolvedUnixUser:
|
|
28872
|
+
resolveUnixUserForImpersonation: resolveUnixUserForImpersonation4,
|
|
28873
|
+
validateResolvedUnixUser: validateResolvedUnixUser3,
|
|
27609
28874
|
UnixUserNotFoundError: UnixUserNotFoundError2,
|
|
27610
28875
|
getHomedirFromUsername: getHomedirFromUsername2
|
|
27611
28876
|
} = await import("@agor/core/unix");
|
|
27612
28877
|
const unixUserMode = config.execution?.unix_user_mode ?? "simple";
|
|
27613
28878
|
const configExecutorUser = config.execution?.executor_unix_user;
|
|
27614
28879
|
const sessionUnixUser = session.unix_username;
|
|
27615
|
-
|
|
27616
|
-
sessionId: shortId21(session.session_id),
|
|
27617
|
-
unixUserMode,
|
|
27618
|
-
sessionUnixUser,
|
|
27619
|
-
configExecutorUser
|
|
27620
|
-
});
|
|
27621
|
-
const impersonationResult = resolveUnixUserForImpersonation3({
|
|
28880
|
+
const impersonationResult = resolveUnixUserForImpersonation4({
|
|
27622
28881
|
mode: unixUserMode,
|
|
27623
28882
|
userUnixUsername: sessionUnixUser,
|
|
27624
28883
|
executorUnixUser: configExecutorUser
|
|
27625
28884
|
});
|
|
27626
28885
|
const executorUnixUser = impersonationResult.unixUser;
|
|
27627
|
-
console.log(`[Daemon] Executor impersonation: ${impersonationResult.reason}`);
|
|
27628
28886
|
const effectivePermissionMode = data.permissionMode || session.permission_config?.mode || void 0;
|
|
27629
28887
|
const permissionModeForPayload = effectivePermissionMode === "default" ? void 0 : effectivePermissionMode;
|
|
27630
28888
|
try {
|
|
27631
|
-
|
|
28889
|
+
validateResolvedUnixUser3(unixUserMode, executorUnixUser);
|
|
27632
28890
|
} catch (err) {
|
|
27633
28891
|
if (err instanceof UnixUserNotFoundError2) {
|
|
27634
28892
|
throw new Error(
|
|
@@ -27637,7 +28895,7 @@ function createExecuteHandler(ctx, sessionsService, sessionTokenService) {
|
|
|
27637
28895
|
}
|
|
27638
28896
|
throw err;
|
|
27639
28897
|
}
|
|
27640
|
-
const { createUserProcessEnvironment:
|
|
28898
|
+
const { createUserProcessEnvironment: createUserProcessEnvironment3 } = await import("@agor/core/config");
|
|
27641
28899
|
const userId = params.user?.user_id;
|
|
27642
28900
|
let gatewayEnv;
|
|
27643
28901
|
const gatewaySource = session.custom_context?.gateway_source;
|
|
@@ -27662,7 +28920,7 @@ function createExecuteHandler(ctx, sessionsService, sessionTokenService) {
|
|
|
27662
28920
|
} catch {
|
|
27663
28921
|
}
|
|
27664
28922
|
}
|
|
27665
|
-
const executorEnv = await
|
|
28923
|
+
const executorEnv = await createUserProcessEnvironment3(
|
|
27666
28924
|
userId,
|
|
27667
28925
|
db,
|
|
27668
28926
|
void 0,
|
|
@@ -27757,11 +29015,10 @@ function createExecuteHandler(ctx, sessionsService, sessionTokenService) {
|
|
|
27757
29015
|
console.log(
|
|
27758
29016
|
`\u23ED\uFE0F [Executor] Task ${shortId21(taskId)} is not the latest (latest: ${shortId21(latestTaskId)}), skipping safety net`
|
|
27759
29017
|
);
|
|
27760
|
-
} else if (currentSession
|
|
29018
|
+
} else if (isSessionExecuting(currentSession) || currentSession.status === SessionStatus5.TIMED_OUT) {
|
|
27761
29019
|
try {
|
|
27762
29020
|
const currentTask = await app.service("tasks").get(taskId, params);
|
|
27763
|
-
|
|
27764
|
-
if (isTaskStillActive) {
|
|
29021
|
+
if (isTaskExecuting(currentTask) || currentTask.status === TaskStatus3.TIMED_OUT) {
|
|
27765
29022
|
await app.service("tasks").patch(
|
|
27766
29023
|
taskId,
|
|
27767
29024
|
{
|
|
@@ -27894,7 +29151,7 @@ async function registerMCPServices(ctx, sessionsService) {
|
|
|
27894
29151
|
}
|
|
27895
29152
|
async function startTwoPhaseMCPOAuthFlowInternal(opts, awaitToken) {
|
|
27896
29153
|
const { startMCPOAuthFlow } = await import("@agor/core/tools/mcp/oauth-mcp-transport");
|
|
27897
|
-
const baseUrl = await
|
|
29154
|
+
const baseUrl = await requirePublicBaseUrl2();
|
|
27898
29155
|
const redirectUri = new URL("/mcp-servers/oauth-callback", baseUrl).toString();
|
|
27899
29156
|
const hasRfc9728 = !!opts.resourceMetadataUrl;
|
|
27900
29157
|
const hasAsDirect = !!opts.prefetchedAuthServerMetadata;
|
|
@@ -28155,7 +29412,7 @@ async function registerMCPServices(ctx, sessionsService) {
|
|
|
28155
29412
|
socketId: connection?.id
|
|
28156
29413
|
});
|
|
28157
29414
|
} catch (err) {
|
|
28158
|
-
if (err instanceof
|
|
29415
|
+
if (err instanceof PublicBaseUrlNotConfiguredError2) {
|
|
28159
29416
|
return { success: false, error: err.message, oauthType: "oauth2.1" };
|
|
28160
29417
|
}
|
|
28161
29418
|
throw err;
|
|
@@ -28413,7 +29670,7 @@ async function registerMCPServices(ctx, sessionsService) {
|
|
|
28413
29670
|
socketId
|
|
28414
29671
|
});
|
|
28415
29672
|
} catch (err) {
|
|
28416
|
-
if (err instanceof
|
|
29673
|
+
if (err instanceof PublicBaseUrlNotConfiguredError2) {
|
|
28417
29674
|
console.error("[OAuth Start]", err.message);
|
|
28418
29675
|
return { success: false, error: err.message };
|
|
28419
29676
|
}
|
|
@@ -28834,7 +30091,7 @@ async function registerMCPServices(ctx, sessionsService) {
|
|
|
28834
30091
|
const tokenResponse = await started.awaitToken();
|
|
28835
30092
|
return tokenResponse.access_token;
|
|
28836
30093
|
} catch (error) {
|
|
28837
|
-
if (error instanceof
|
|
30094
|
+
if (error instanceof PublicBaseUrlNotConfiguredError2) throw error;
|
|
28838
30095
|
console.error("[MCP Discovery] OAuth token acquisition failed:", error);
|
|
28839
30096
|
return void 0;
|
|
28840
30097
|
}
|
|
@@ -28990,7 +30247,7 @@ async function registerMCPServices(ctx, sessionsService) {
|
|
|
28990
30247
|
}
|
|
28991
30248
|
}
|
|
28992
30249
|
} catch (error) {
|
|
28993
|
-
if (error instanceof
|
|
30250
|
+
if (error instanceof PublicBaseUrlNotConfiguredError2) {
|
|
28994
30251
|
console.error("[MCP Discovery]", error.message);
|
|
28995
30252
|
return { success: false, error: error.message };
|
|
28996
30253
|
}
|