@makaio/framework 1.0.0-dev-1784889676396 → 1.0.0-dev-1785344643235
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/.makaio-build.json +3 -2
- package/dist/{account-identity-CP4DC0DL.mjs → account-identity-DFx8pwKL.mjs} +1 -1
- package/dist/{adapter-CYobxqN_.mjs → adapter-D5c5LrPN.mjs} +1 -1
- package/dist/adapters/claude/index.d.mts +204 -27
- package/dist/adapters/claude/index.mjs +3 -3
- package/dist/adapters/config/index.d.mts +2 -2
- package/dist/adapters/config/index.mjs +1 -1
- package/dist/adapters/index.d.mts +49 -4
- package/dist/adapters/index.mjs +3 -3
- package/dist/adapters/node.d.mts +1 -1
- package/dist/adapters/node.mjs +1 -1
- package/dist/{artifact-DCkizHkS.mjs → artifact-DGiXqb11.mjs} +1 -1
- package/dist/attempt-record-codec-CqO1_XnE.mjs +1 -0
- package/dist/{auth-C3NOWqTU.mjs → auth-DGEdiHF6.mjs} +1 -1
- package/dist/authority-state-bootstrap-GPL_tqaT.mjs +1 -0
- package/dist/bus/index.mjs +1 -1
- package/dist/{canonical-model-EMRYCVjX.mjs → canonical-model-BAytQ4NV.mjs} +1 -1
- package/dist/capabilities-BQEp34ir.mjs +1 -0
- package/dist/{client-OYk0Ttck.mjs → client-DbS847wW.mjs} +1 -1
- package/dist/clients/index.d.mts +5 -3
- package/dist/clients/index.mjs +1 -1
- package/dist/clients/managed-install.d.mts +1 -1
- package/dist/clients/managed-install.mjs +1 -1
- package/dist/{compression-CZ_6fYq8.mjs → compression-74fFeBha.mjs} +1 -1
- package/dist/{config-namespace-DTA6EQL8.mjs → config-namespace-TVX-hG4I.mjs} +1 -1
- package/dist/{context-resolution-B9ANWbG0.d.mts → context-resolution-BQBk4Ish.d.mts} +6 -4
- package/dist/contracts/adapter/index.d.mts +2 -2
- package/dist/contracts/adapter/index.mjs +1 -1
- package/dist/contracts/adapter/schemas/session-lineage.d.mts +1 -1
- package/dist/contracts/artifact/index.d.mts +2 -2
- package/dist/contracts/artifact/index.mjs +1 -1
- package/dist/contracts/auth/index.d.mts +2 -2
- package/dist/contracts/auth/index.mjs +1 -1
- package/dist/contracts/canonical-model/index.d.mts +1 -1
- package/dist/contracts/canonical-model/index.mjs +1 -1
- package/dist/contracts/capabilities/index.d.mts +2 -0
- package/dist/contracts/capabilities/index.mjs +1 -0
- package/dist/contracts/client/index.d.mts +2 -2
- package/dist/contracts/client/index.mjs +1 -1
- package/dist/contracts/common/index.d.mts +1 -1
- package/dist/contracts/config/index.d.mts +24 -2
- package/dist/contracts/config/index.mjs +1 -1
- package/dist/contracts/extension/index.d.mts +4 -4
- package/dist/contracts/extension/index.mjs +1 -1
- package/dist/contracts/facet/index.d.mts +1 -1
- package/dist/contracts/facet/index.mjs +1 -1
- package/dist/contracts/harness/index.d.mts +1 -1
- package/dist/contracts/harness/index.mjs +1 -1
- package/dist/contracts/host/index.d.mts +1 -1
- package/dist/contracts/host/index.mjs +1 -1
- package/dist/contracts/index.d.mts +1682 -9431
- package/dist/contracts/index.mjs +1 -1
- package/dist/contracts/materialization/index.d.mts +3 -3
- package/dist/contracts/materialization/index.mjs +1 -1
- package/dist/contracts/model-registry/index.d.mts +1 -1
- package/dist/contracts/model-registry/index.mjs +1 -1
- package/dist/contracts/native-session-supervisor/index.d.mts +1 -1
- package/dist/contracts/native-session-supervisor/index.mjs +1 -1
- package/dist/contracts/platform/index.d.mts +1 -1
- package/dist/contracts/platform/index.mjs +1 -1
- package/dist/contracts/provider/index.d.mts +2 -2
- package/dist/contracts/provider/index.mjs +1 -1
- package/dist/contracts/session/index.d.mts +2 -2
- package/dist/contracts/session/index.mjs +1 -1
- package/dist/contracts/shared/index.d.mts +2 -2
- package/dist/contracts/shared/index.mjs +1 -1
- package/dist/contracts/skill/index.d.mts +1 -1
- package/dist/contracts/skill/index.mjs +1 -1
- package/dist/contracts/telemetry/index.d.mts +1 -1
- package/dist/contracts/telemetry/index.mjs +1 -1
- package/dist/contracts/timeout/index.d.mts +1 -1
- package/dist/contracts/timeout/index.mjs +1 -1
- package/dist/contracts/toast/index.mjs +1 -1
- package/dist/contracts/variant/index.d.mts +1 -1
- package/dist/contracts/variant/index.mjs +1 -1
- package/dist/contracts/worker-node/index.d.mts +2 -0
- package/dist/contracts/worker-node/index.mjs +1 -0
- package/dist/contracts/workflow/index.d.mts +3 -3
- package/dist/contracts/workflow/index.mjs +1 -1
- package/dist/{definition-K3m51lgO.mjs → definition-CJfiv8xm.mjs} +1 -1
- package/dist/{detached-extension-handle-BsywhHfk.mjs → detached-extension-handle-Ddfquy5_.mjs} +1 -1
- package/dist/drizzle/0030_remote-worker-execution.sql +6 -0
- package/dist/drizzle/meta/_journal.json +7 -0
- package/dist/execution-attempt-repository-DWXKY41_.d.mts +1056 -0
- package/dist/execution-target-Cf645pDj.mjs +1 -0
- package/dist/{extension-Cgg45Xk1.mjs → extension-DCA4pYrY.mjs} +1 -1
- package/dist/extension-hjOPs10e.mjs +1 -0
- package/dist/{filesystem-service-Cupz_Z7S.mjs → filesystem-service-DlP2HfDg.mjs} +1 -1
- package/dist/framework-packages-C3RWfJDk.mjs +1 -0
- package/dist/git/index.mjs +1 -1
- package/dist/{globby-DWp7V-P2.mjs → globby-1yCVCk8s.mjs} +1 -1
- package/dist/{handlers-cMBmexF4.mjs → handlers-CfnLyLfE.mjs} +1 -1
- package/dist/{harness-DflvHAGV.mjs → harness-DpwsFsE7.mjs} +1 -1
- package/dist/{index-BhXCCgJV2.d.mts → index-4fE_hUP02.d.mts} +1 -1
- package/dist/{index-BMx59xb7.d.mts → index-8gKx-OVP.d.mts} +13 -7
- package/dist/index-B0Kf_OWi.d.mts +267 -0
- package/dist/{index-DRiTICBU.d.mts → index-BAXkicoQ.d.mts} +1 -1
- package/dist/{index-CnXXq6sW.d.mts → index-BC79QrGC.d.mts} +10 -10
- package/dist/{index-CvmWRumB.d.mts → index-BQLUVXIB.d.mts} +1024 -888
- package/dist/{index-CKO9S6oo.d.mts → index-BXD3kEs_.d.mts} +28 -10
- package/dist/{index-DUf47Jn_.d.mts → index-BskPjMet.d.mts} +8 -8
- package/dist/{index-CjyfQ_vQ.d.mts → index-CL-0NeQW.d.mts} +8 -5
- package/dist/{index-Cw7_69gV.d.mts → index-CRvpVIqA.d.mts} +1 -1
- package/dist/{index-7FjcxGlK.d.mts → index-CUvNKYkV.d.mts} +1 -1
- package/dist/{index-CtUTCAJ6.d.mts → index-CVaRZoiu.d.mts} +4 -4
- package/dist/{index-Cw84_Dqi.d.mts → index-CnMu8BQl.d.mts} +4 -4
- package/dist/{index-DaMfTvfz.d.mts → index-DA9g2A5P.d.mts} +1 -1
- package/dist/{index-Bi5jFT9S.d.mts → index-DJAmSnuh.d.mts} +12 -12
- package/dist/{index-pjATMrvJ.d.mts → index-DkiTJM5p.d.mts} +693 -31
- package/dist/{index-jbgHR5J2.d.mts → index-GHASUiem.d.mts} +1 -1
- package/dist/{index-BDDbcWNI.d.mts → index-HsTxm-R3.d.mts} +3 -3
- package/dist/{index-Bs3CXR232.d.mts → index-I5YG-qrb2.d.mts} +6 -6
- package/dist/{index-0Ju2i8gV.d.mts → index-SsBHjUqA.d.mts} +204 -165
- package/dist/index-XZyMxxnU.d.mts +1602 -0
- package/dist/{index-dkvGHN10.d.mts → index-brqfk9JQ.d.mts} +6 -6
- package/dist/{index-D43lQCHs.d.mts → index-q0Tiqems.d.mts} +131 -131
- package/dist/index-w_FmghjT.d.mts +7295 -0
- package/dist/kernel/cli/index.d.mts +2 -2
- package/dist/kernel/cli/index.mjs +1 -1
- package/dist/kernel/cli/register.d.mts +1 -1
- package/dist/kernel/cli/register.mjs +1 -1
- package/dist/kernel/cli/schemas.mjs +1 -1
- package/dist/kernel/extension/index.d.mts +1 -1
- package/dist/kernel/extension/index.mjs +1 -1
- package/dist/kernel/index.d.mts +14 -8
- package/dist/kernel/index.mjs +1 -1
- package/dist/kernel/namespace/index.d.mts +1 -1
- package/dist/kernel/namespace/index.mjs +1 -1
- package/dist/kernel/observability/index.d.mts +1 -1
- package/dist/kernel/observability/index.mjs +1 -1
- package/dist/kernel/providers/index.d.mts +1 -1
- package/dist/kernel/providers/index.mjs +1 -1
- package/dist/kernel/window/index.d.mts +1 -1
- package/dist/kernel/window/index.mjs +1 -1
- package/dist/{lib-BeMM738r.mjs → lib-C7-s68uf.mjs} +1 -1
- package/dist/{lib-B7TpTzkG.mjs → lib-DErgth_E.mjs} +2 -2
- package/dist/{load-extensions-BLdG90Zi.d.mts → load-extensions-BxsDB87B.d.mts} +1 -1
- package/dist/{load-extensions-CUmFCcYi.mjs → load-extensions-D0DfjYLC.mjs} +1 -1
- package/dist/{materialization-s8eR1eQ4.mjs → materialization-Jd198K3y.mjs} +1 -1
- package/dist/mcp-http-server/index.d.mts +305 -79
- package/dist/mcp-http-server/index.mjs +4 -4
- package/dist/model-BGgVmRnN.mjs +1 -0
- package/dist/modes-BheyN7SS.mjs +1 -0
- package/dist/{namespace-DwQtzlY-.mjs → namespace-BqxtpNAn.mjs} +1 -1
- package/dist/{namespace-BHliaabz.d.mts → namespace-DBm9K23m.d.mts} +6 -6
- package/dist/{namespace-zOfq1Uhn.d.mts → namespace-DI4Yx_xu.d.mts} +27 -27
- package/dist/namespace-DJfUADSV.mjs +1 -0
- package/dist/{namespace-BphMM6S82.d.mts → namespace-DPgxPa8m2.d.mts} +1 -1
- package/dist/{namespace-Bd49QmzS.d.mts → namespace-DWCEo-9M.d.mts} +0 -60
- package/dist/{namespace-CriPb5wY.d.mts → namespace-jPUGV-b2.d.mts} +42 -42
- package/dist/{native-session-supervisor-Bgz-Q1WH.mjs → native-session-supervisor-DRx0MX-d.mjs} +1 -1
- package/dist/node/bus-server/index.d.mts +1 -1
- package/dist/node/bus-server/index.mjs +1 -1
- package/dist/node/bus-server/server-lifecycle.d.mts +1 -1
- package/dist/node/bus-server/server-lifecycle.mjs +1 -1
- package/dist/node/transports/index.d.mts +81 -9
- package/dist/node/transports/index.mjs +2 -2
- package/dist/{orchestrator-shared-CY7Tu7kZ.mjs → orchestrator-shared-BxmHCPvx.mjs} +1 -1
- package/dist/package-CNUPPcU1.mjs +7 -0
- package/dist/package-DWMxGfzK.d.mts +827 -0
- package/dist/{package-DKnzOvoR.mjs → package-Dft_RItb.mjs} +1 -1
- package/dist/package.json +1 -1
- package/dist/{packages-zDnokBpl.mjs → packages-DtEEP0Vt.mjs} +1 -1
- package/dist/{profile-BRi6K6am.mjs → profile-BTAI31Nt.mjs} +1 -1
- package/dist/{provider-context-DOsjOjiR.mjs → provider-context-Dq53Cgzz.mjs} +1 -1
- package/dist/{provider-context-BYkMl--1.mjs → provider-context-PZIQWcqQ.mjs} +1 -1
- package/dist/provider-operation-Cxoe2SUr.d.mts +207 -0
- package/dist/providers/index.mjs +1 -1
- package/dist/{registry-Dw6l7k3e.mjs → registry-wfF2uTty.mjs} +29 -29
- package/dist/{resolved-O2XXjTeu.mjs → resolved-DZgqql2Z.mjs} +1 -1
- package/dist/rules/index.d.mts +1 -1
- package/dist/rules/index.mjs +1 -1
- package/dist/rules/schemas.d.mts +1 -1
- package/dist/runtime-bun/index.mjs +1 -1
- package/dist/runtime-node/extension-discovery.d.mts +1 -1
- package/dist/runtime-node/extension-validation.d.mts +1 -1
- package/dist/runtime-node/extension-validation.mjs +1 -1
- package/dist/runtime-node/index.d.mts +4 -4
- package/dist/runtime-node/index.mjs +24 -24
- package/dist/runtime-node/makaio-config.d.mts +1 -1
- package/dist/runtime-node/makaio-config.mjs +1 -1
- package/dist/runtime-node/static/model-registry.yaml +348 -0
- package/dist/runtime-node/workflow-worker/index.d.mts +2 -2
- package/dist/runtime-node/workflow-worker/index.mjs +1 -1
- package/dist/runtime-node/workflow-worker/worker-entry.d.mts +7 -4
- package/dist/runtime-node/workflow-worker/worker-entry.mjs +1 -1
- package/dist/{schema-BO9TgmOs.d.mts → schema-Bwr_NrOS.d.mts} +2 -2
- package/dist/{schema-BI0aCHvV.mjs → schema-Dd-e89MO.mjs} +1 -1
- package/dist/{schemas-B5tMYfhC.d.mts → schemas-C4yUXs4G.d.mts} +4 -4
- package/dist/schemas-CRB2O5zo.mjs +1 -0
- package/dist/{schemas-Dgj3WaOI.mjs → schemas-Cm09dXL4.mjs} +1 -1
- package/dist/{schemas-BJ8VMXhO.mjs → schemas-DaHQzpgm.mjs} +1 -1
- package/dist/{schemas-BDC2Nqj1.d.mts → schemas-ENwK6jmV.d.mts} +14 -14
- package/dist/{schemas-ChF2z4RB.d.mts → schemas-N6x2z7Lf.d.mts} +0 -45
- package/dist/schemas-tDf_WiC8.mjs +1 -0
- package/dist/selection-BNwTKEVT.mjs +1 -0
- package/dist/service-base/index.d.mts +47 -2
- package/dist/service-base/index.mjs +1 -1
- package/dist/services/adapter-runtime/index.d.mts +3 -3
- package/dist/services/adapter-runtime/index.mjs +1 -1
- package/dist/services/adapter-runtime/namespace.d.mts +1 -1
- package/dist/services/adapter-runtime/schemas.d.mts +1 -1
- package/dist/services/adapter-subsystem/index.d.mts +3 -3
- package/dist/services/adapter-subsystem/index.mjs +1 -1
- package/dist/services/adapter-subsystem/namespace.d.mts +1 -1
- package/dist/services/adapter-subsystem/namespace.mjs +1 -1
- package/dist/services/agent-runtime/index.d.mts +2 -2
- package/dist/services/agent-runtime/namespace.d.mts +1 -1
- package/dist/services/agent-runtime/schemas.d.mts +1 -1
- package/dist/services/capability/index.d.mts +1 -1
- package/dist/services/capability/index.mjs +1 -1
- package/dist/services/codebase/index.d.mts +2 -2
- package/dist/services/codebase/namespace.d.mts +1 -1
- package/dist/services/codebase/schemas.d.mts +1 -1
- package/dist/services/compression/index.d.mts +2 -2
- package/dist/services/compression/namespace.d.mts +1 -1
- package/dist/services/compression/schemas.d.mts +1 -1
- package/dist/services/context-rules/index.d.mts +7 -7
- package/dist/services/context-rules/index.mjs +1 -1
- package/dist/services/execution-target/index.d.mts +4 -4
- package/dist/services/execution-target/index.mjs +1 -1
- package/dist/services/execution-target/namespace.d.mts +1 -1
- package/dist/services/execution-target/namespace.mjs +1 -1
- package/dist/services/execution-target/schemas.d.mts +1 -1
- package/dist/services/execution-target/schemas.mjs +1 -1
- package/dist/services/filesystem/index.d.mts +1 -1
- package/dist/services/filesystem/index.mjs +1 -1
- package/dist/services/git/namespace.d.mts +2 -2
- package/dist/services/git/namespace.mjs +1 -1
- package/dist/services/git/schemas.d.mts +2 -2
- package/dist/services/git/schemas.mjs +1 -1
- package/dist/services/harness/index.d.mts +3 -3
- package/dist/services/harness/index.mjs +1 -1
- package/dist/services/index.d.mts +86 -371
- package/dist/services/index.mjs +1 -1
- package/dist/services/log-import/browser.d.mts +2 -2
- package/dist/services/log-import/index.d.mts +2 -2
- package/dist/services/log-import/log-import.d.mts +1 -1
- package/dist/services/log-import/log-import.mjs +1 -1
- package/dist/services/log-import/namespace.d.mts +2 -2
- package/dist/services/log-import/namespace.mjs +1 -1
- package/dist/services/log-import/schemas.d.mts +1 -1
- package/dist/services/log-import/schemas.mjs +1 -1
- package/dist/services/materialization/index.d.mts +1 -1
- package/dist/services/materialization/index.mjs +1 -1
- package/dist/services/model-registry/index.d.mts +1 -1
- package/dist/services/model-registry/index.mjs +1 -1
- package/dist/services/preferences/index.d.mts +2 -2
- package/dist/services/preferences/schemas.d.mts +1 -1
- package/dist/services/preferences/storage-namespace.d.mts +2 -2
- package/dist/services/provider-context/index.d.mts +1 -1
- package/dist/services/provider-context/index.mjs +1 -1
- package/dist/services/provider-runtime/index.mjs +1 -1
- package/dist/services/session/handlers/index.d.mts +1 -1
- package/dist/services/session/handlers/index.mjs +1 -1
- package/dist/services/session/index.d.mts +9 -9
- package/dist/services/session/index.mjs +1 -1
- package/dist/services/session/messages/namespace.d.mts +1 -1
- package/dist/services/session/messages/namespace.mjs +1 -1
- package/dist/services/session/orchestrator-testing/index.d.mts +1 -1
- package/dist/services/session/orchestrator-testing/index.mjs +1 -1
- package/dist/services/session/session-events/namespace.d.mts +1 -1
- package/dist/services/session/session-events/namespace.mjs +1 -1
- package/dist/services/session/storage/namespace.d.mts +1 -1
- package/dist/services/session/storage/schema.d.mts +1 -1
- package/dist/services/session/testing/index.mjs +1 -1
- package/dist/services/session/testing/orchestrator-shared.d.mts +1 -1
- package/dist/services/session/testing/orchestrator-shared.mjs +1 -1
- package/dist/services/session/turns/namespace.d.mts +1 -1
- package/dist/services/session/turns/namespace.mjs +1 -1
- package/dist/services/session-editor/index.d.mts +1 -1
- package/dist/services/session-editor/index.mjs +1 -1
- package/dist/services/settings/index.d.mts +3 -3
- package/dist/services/settings/index.mjs +1 -1
- package/dist/services/settings/namespace.d.mts +14 -14
- package/dist/services/settings/namespace.mjs +1 -1
- package/dist/services/settings/storage/clients-namespace.d.mts +1 -1
- package/dist/services/settings/storage/clients-namespace.mjs +1 -1
- package/dist/services/settings/storage/extension-configs/namespace.d.mts +3 -3
- package/dist/services/settings/storage/index.d.mts +3 -3
- package/dist/services/settings/storage/index.mjs +1 -1
- package/dist/services/settings/storage/providers-namespace.d.mts +1 -1
- package/dist/services/settings/storage/providers-namespace.mjs +1 -1
- package/dist/services/subagent/index.d.mts +1 -1
- package/dist/services/subagent/index.mjs +1 -1
- package/dist/services/subagent-template/index.d.mts +2 -2
- package/dist/services/subagent-template/namespace.d.mts +1 -1
- package/dist/services/subagent-template/schemas.d.mts +1 -1
- package/dist/services/tool-approval/index.d.mts +1 -1
- package/dist/services/tool-approval/index.mjs +1 -1
- package/dist/services/tools/index.d.mts +1 -1
- package/dist/services/tools/index.mjs +1 -1
- package/dist/services/tray-menu/index.d.mts +3 -3
- package/dist/services/tray-menu/index.mjs +1 -1
- package/dist/services/tray-menu/namespace.d.mts +1 -1
- package/dist/services/tray-menu/schemas.d.mts +1 -1
- package/dist/services/turn/index.d.mts +1 -1
- package/dist/services/turn/namespace.d.mts +1 -1
- package/dist/services/workflow-transitions/index.d.mts +2 -0
- package/dist/services/workflow-transitions/index.mjs +1 -0
- package/dist/{session-Carng3Yk.mjs → session-BOGCd18q.mjs} +1 -1
- package/dist/{session-idI1jk5X.mjs → session-BTFiDoGz.mjs} +1 -1
- package/dist/{session-lineage-Cte63dGx.d.mts → session-lineage-B_JW5LpF.d.mts} +1 -1
- package/dist/{shared-RP_KARKF.mjs → shared-BQ0CHIVy.mjs} +1 -1
- package/dist/{skill-CpNjWFuE.mjs → skill-BR6rkfLe.mjs} +1 -1
- package/dist/{src-XihJcAQS.mjs → src-DD0v-nIj.mjs} +1 -1
- package/dist/storage/drizzle/client.d.mts +1 -1
- package/dist/storage/drizzle/client.mjs +1 -1
- package/dist/storage/drizzle/index.d.mts +50 -2
- package/dist/storage/drizzle/index.mjs +1 -1
- package/dist/storage/handlers/drizzle/index.d.mts +1 -1
- package/dist/storage/handlers/drizzle/index.mjs +1 -1
- package/dist/storage/handlers/index.d.mts +1 -1
- package/dist/storage/handlers/index.mjs +1 -1
- package/dist/testing/drizzle-harness.d.mts +44 -3
- package/dist/testing/drizzle-harness.mjs +1 -1
- package/dist/{tool-approval-service-fIZ9x0kL.mjs → tool-approval-service-kBA0fRzm.mjs} +1 -1
- package/dist/tools-PdG9fO1M.mjs +1 -0
- package/dist/{transition-BodgGLZx.d.mts → transition-DuVzKt8-.d.mts} +3 -42
- package/dist/{types-LspCUW09.d.mts → types-B1MNcwgH.d.mts} +1 -1
- package/dist/{types-Bzxo7ATi.d.mts → types-BqVAOzJP.d.mts} +48 -48
- package/dist/{types-DBb5jY4Z.d.mts → types-CJ_QZ1yW.d.mts} +47 -3
- package/dist/ui-kernel/index.d.mts +1 -1
- package/dist/ui-kernel/index.mjs +1 -1
- package/dist/ui-kernel/pages/schemas.d.mts +1 -1
- package/dist/utils/index.d.mts +18 -4
- package/dist/utils/index.mjs +1 -1
- package/dist/{version-BbWrAPld.mjs → version-CoCeMxDT.mjs} +1 -1
- package/dist/{view-builder-tU7iaxrk.d.mts → view-builder-CvoSL2oL.d.mts} +2 -1
- package/dist/visibility-qhGWmpSJ.mjs +1 -0
- package/dist/worker-node-Bl9_vqYi.mjs +1 -0
- package/dist/worker-node-DZTuT1DS.mjs +1 -0
- package/dist/workflow-BfDbgtIQ.mjs +1 -0
- package/dist/workflow-engine/execution-attempt-repository.d.mts +2 -0
- package/dist/workflow-engine/execution-attempt-repository.mjs +1 -0
- package/dist/workflow-engine/index.d.mts +619 -685
- package/dist/workflow-engine/index.mjs +1 -1
- package/dist/workflow-engine/package.d.mts +1 -1
- package/dist/workflow-engine/package.mjs +1 -1
- package/dist/workflow-engine/provider-operation.d.mts +2 -0
- package/dist/workflow-engine/provider-operation.mjs +1 -0
- package/dist/workflow-engine/testing/index.d.mts +146 -0
- package/dist/workflow-engine/testing/index.mjs +1 -0
- package/dist/workflow-engine/testing/sqlite.d.mts +22 -0
- package/dist/workflow-engine/testing/sqlite.mjs +130 -0
- package/dist/workflow-engine/workflow-orchestrator.mjs +1 -1
- package/dist/workflow-transitions-DSc45ixc.mjs +1 -0
- package/dist/workflow-worker-BN9XPxQO.mjs +1 -0
- package/package.json +20 -3
- package/dist/authority-state-bootstrap-C_-F_dtq.mjs +0 -1
- package/dist/execution-target-CsZXIvli.mjs +0 -1
- package/dist/extension-CjTu6mzW.mjs +0 -1
- package/dist/model-uE5IyUFJ.mjs +0 -1
- package/dist/namespace-C05pkLbN.mjs +0 -1
- package/dist/package-BSG1681x.d.mts +0 -427
- package/dist/package-DW1Upu8E.mjs +0 -7
- package/dist/schemas-BRxU_oqL.mjs +0 -1
- package/dist/schemas-C-J4W1ID.mjs +0 -1
- package/dist/selection-YRuVSdck.mjs +0 -1
- package/dist/tools-Cs2DwjCC.mjs +0 -1
- package/dist/visibility-Cb62p9bv.mjs +0 -1
- package/dist/workflow-BX-FxDb0.mjs +0 -1
- package/dist/workflow-worker-DR9qYOFc.mjs +0 -1
- /package/dist/{adapter-auth-runtime-DFBLXD5K.mjs → adapter-auth-runtime-DO-FVTXg.mjs} +0 -0
- /package/dist/{adapter-binding-Dfk_g-lP.d.mts → adapter-binding-DQchUtrK.d.mts} +0 -0
- /package/dist/{ajv-C8r45sFs.mjs → ajv-DD3SIL2i.mjs} +0 -0
- /package/dist/{attach-error-DCnzW-Yz.mjs → attach-error-C3tngg6J.mjs} +0 -0
- /package/dist/{await-trigger-UceeyCyi.mjs → await-trigger-I3lrepb8.mjs} +0 -0
- /package/dist/{base-orchestrator-5yH3l39s.d.mts → base-orchestrator-BilsQNW1.d.mts} +0 -0
- /package/dist/{capability-service-BzKBK0n2.mjs → capability-service-BqiLlRGA.mjs} +0 -0
- /package/dist/{client-DYEHDiJN.d.mts → client-B--e2qcU.d.mts} +0 -0
- /package/dist/{client-binary-version-verifier-C12PvQmz.d.mts → client-binary-version-verifier-CgjM_vGF.d.mts} +0 -0
- /package/dist/{client-binary-version-verifier-Dv7TGFxh.mjs → client-binary-version-verifier-taewmKTY.mjs} +0 -0
- /package/dist/{clients-namespace-DcFmhtLv.d.mts → clients-namespace-DfxjG2ZP.d.mts} +0 -0
- /package/dist/{config-namespace-DmP7NVju.d.mts → config-namespace-BCqvufbD.d.mts} +0 -0
- /package/dist/{create-static-mount-BLbqGmva.mjs → create-static-mount-bbQhTt6W.mjs} +0 -0
- /package/dist/{cross-spawn-BXxQUsPS.mjs → cross-spawn-B57KZuns.mjs} +0 -0
- /package/dist/{cursor-storage-DCj4uUxr.mjs → cursor-storage-DIFK_9hg.mjs} +0 -0
- /package/dist/{definition-BEvV7tbD.d.mts → definition-gnKgXU91.d.mts} +0 -0
- /package/dist/{definitions-C1pgx0Nq.mjs → definitions-xrrY0wgz.mjs} +0 -0
- /package/dist/{descriptor-to-package-VfB8lK5w.mjs → descriptor-to-package-DvF08krT.mjs} +0 -0
- /package/dist/{drizzle-oCH9H53q.mjs → drizzle-z_0SiGY8.mjs} +0 -0
- /package/dist/{esm-ClQELElL.mjs → esm-CltRnX8_.mjs} +0 -0
- /package/dist/{event-BOLVCfhH.mjs → event-CmVjR6Ib.mjs} +0 -0
- /package/dist/{extension-discovery-B6p3iZaV.d.mts → extension-discovery-CQRdbVQ6.d.mts} +0 -0
- /package/dist/{extension-namespace-vrh4ERXR.mjs → extension-namespace-Yu41YepM.mjs} +0 -0
- /package/dist/{facet-DqPBpqkl.mjs → facet-BCI00njh.mjs} +0 -0
- /package/dist/{filesystem-service-CGdboor3.d.mts → filesystem-service-CQ9yVkSz.d.mts} +0 -0
- /package/dist/{handler-GGOD_ofd.mjs → handler-Cbv9FqDO.mjs} +0 -0
- /package/dist/{hook-responses-Dg8wDvRo.d.mts → hook-responses-Dh1PWXqJ.d.mts} +0 -0
- /package/dist/{host-BfgdjlII.mjs → host-Caq6ZfSJ.mjs} +0 -0
- /package/dist/{identity-BmEHHoBw.mjs → identity-D6guMtmi.mjs} +0 -0
- /package/dist/{index-DEchpaya.d.mts → index-BIdsFcQs2.d.mts} +0 -0
- /package/dist/{index-DquI_1X5.d.mts → index-BVRQEpAg.d.mts} +0 -0
- /package/dist/{index-Brdc35b-.d.mts → index-BaZeoZoS.d.mts} +0 -0
- /package/dist/{index-BSmwpgkR.d.mts → index-ByKi34v5.d.mts} +0 -0
- /package/dist/{index-oYGf2zIe.d.mts → index-CGZQVTid.d.mts} +0 -0
- /package/dist/{index-Chy9aknK.d.mts → index-CMJZ2Z8m.d.mts} +0 -0
- /package/dist/{index-Bd1GC1kU2.d.mts → index-CjdRdsd0.d.mts} +0 -0
- /package/dist/{index-DYUxNOIX.d.mts → index-Cv-o5Krs.d.mts} +0 -0
- /package/dist/{index-DC0yVsYL.d.mts → index-DN4NOCqN2.d.mts} +0 -0
- /package/dist/{index-CcsJnJOD.d.mts → index-DR40QWlw.d.mts} +0 -0
- /package/dist/{index-BG9-vQHD.d.mts → index-DZunhZec.d.mts} +0 -0
- /package/dist/{index-BsBvs0aK.d.mts → index-DjgLchuQ.d.mts} +0 -0
- /package/dist/{index-pgYFJ5h6.d.mts → index-Dm1nUxCF.d.mts} +0 -0
- /package/dist/{index-C96LlS5m.d.mts → index-Ds5_rDEJ.d.mts} +0 -0
- /package/dist/{index-GYZs75UP.d.mts → index-dtsLKOID.d.mts} +0 -0
- /package/dist/{index-8fJ6dkzR.d.mts → index-gUhidukN.d.mts} +0 -0
- /package/dist/{index-BgpYhR2z.d.mts → index-jTaAHsul.d.mts} +0 -0
- /package/dist/{index-Ci3_i-WC2.d.mts → index-sS6KUlrx.d.mts} +0 -0
- /package/dist/{index-CFeY8lfU.d.mts → index-vA--0lOM.d.mts} +0 -0
- /package/dist/{index-BUYyZm5I.d.mts → index-vcSj12YQ.d.mts} +0 -0
- /package/dist/{index-CdEhEXlY.d.mts → index-ye0oklfU.d.mts} +0 -0
- /package/dist/{json-value-BwVdTylT.d.mts → json-value-Brslhqbm.d.mts} +0 -0
- /package/dist/{jsonl-transport-D8RBF0dK.mjs → jsonl-transport-bQl3JwIu.mjs} +0 -0
- /package/dist/{lib-3_xcE8J-.mjs → lib-DOBXZmYX.mjs} +0 -0
- /package/dist/{model-registry-CoegIvks.mjs → model-registry-CmgcPDH3.mjs} +0 -0
- /package/dist/{model-registry-BneK5SGo.mjs → model-registry-xyBKSye-.mjs} +0 -0
- /package/dist/{namespace-CDO4rY11.mjs → namespace-B8uKAzWJ.mjs} +0 -0
- /package/dist/{namespace-BsF9IxJ9.d.mts → namespace-BOkKoq34.d.mts} +0 -0
- /package/dist/{namespace-SQAGytmu.d.mts → namespace-Blp4c8GK.d.mts} +0 -0
- /package/dist/{namespace-BeED_Ojz.mjs → namespace-C-9si-fV.mjs} +0 -0
- /package/dist/{namespace-De9Mg3zv.d.mts → namespace-CErHuXtb.d.mts} +0 -0
- /package/dist/{namespace-BHj13hbA.mjs → namespace-CWGKCNZm.mjs} +0 -0
- /package/dist/{namespace-D7pE2QWv.mjs → namespace-CWUDFGOy.mjs} +0 -0
- /package/dist/{namespace-D9HNjIdc.d.mts → namespace-Cv1RFP7n.d.mts} +0 -0
- /package/dist/{namespace-CI313bRv.d.mts → namespace-Dkod-w11.d.mts} +0 -0
- /package/dist/{namespace-lWlqWTKu.d.mts → namespace-GPA7zots.d.mts} +0 -0
- /package/dist/{namespace-DWwWnLBu.mjs → namespace-HO2J9sO8.mjs} +0 -0
- /package/dist/{namespace-C238RqwB.mjs → namespace-YxU1xf-K.mjs} +0 -0
- /package/dist/{namespace-BetqZA7Z.d.mts → namespace-YytVKIgI.d.mts} +0 -0
- /package/dist/{namespace-B9CYb9Gh.d.mts → namespace-jDhZjw-i.d.mts} +0 -0
- /package/dist/{namespace-BSXHdCVh2.d.mts → namespace-tGRAod3o.d.mts} +0 -0
- /package/dist/{orchestrator-shared-BB6j8ezL.d.mts → orchestrator-shared-BHCv-l2O.d.mts} +0 -0
- /package/dist/{out-CFkI17mk.mjs → out-CvjtANXN.mjs} +0 -0
- /package/dist/{packages-DeIgn0Hn.d.mts → packages-BZ6pzFIq.d.mts} +0 -0
- /package/dist/{platform-CWhGFQFX.mjs → platform-Bv8llU9c.mjs} +0 -0
- /package/dist/{providers-CUnrif24.mjs → providers-Co5UszRH.mjs} +0 -0
- /package/dist/{providers-namespace-sPbGcZ6I.d.mts → providers-namespace-DjFkmvBR.d.mts} +0 -0
- /package/dist/{quick-lru-CTBjxfgD.mjs → quick-lru-CrOpWwrf.mjs} +0 -0
- /package/dist/{schema-cus0dJ81.mjs → schema-Db-y-09L.mjs} +0 -0
- /package/dist/{schema-introspection-BsWLmoFp.mjs → schema-introspection-DgWQCpwx.mjs} +0 -0
- /package/dist/{schemas-DYvvMd3c.d.mts → schemas-B1NWNASS.d.mts} +0 -0
- /package/dist/{schemas-CMyv7l7-.mjs → schemas-BGExwp3j.mjs} +0 -0
- /package/dist/{schemas-Dmij0PIc.d.mts → schemas-BO7uOum6.d.mts} +0 -0
- /package/dist/{schemas-BGS9RfqV.mjs → schemas-Bfxskx_2.mjs} +0 -0
- /package/dist/{schemas-BKKpQC4X2.d.mts → schemas-BtZqovRH.d.mts} +0 -0
- /package/dist/{schemas-BAvt2HDy.d.mts → schemas-CQyRBqD6.d.mts} +0 -0
- /package/dist/{schemas-D55eXBgl.d.mts → schemas-CR8hSqTy.d.mts} +0 -0
- /package/dist/{schemas-CWxf_Yut.mjs → schemas-CqRm0i9a.mjs} +0 -0
- /package/dist/{schemas-CiWCNQ9a2.d.mts → schemas-CwbYk_kZ.d.mts} +0 -0
- /package/dist/{schemas-CbMWN9-z.d.mts → schemas-DuIlOWR3.d.mts} +0 -0
- /package/dist/{schemas-B4FyOOJj.d.mts → schemas-miYxK_Z1.d.mts} +0 -0
- /package/dist/{semver-D3Y7uMEb.mjs → semver-DlM8znk4.mjs} +0 -0
- /package/dist/{server-lifecycle-C-3OgoKi.d.mts → server-lifecycle-Dsq56aqC.d.mts} +0 -0
- /package/dist/{server-lifecycle-DV6NMsgH.mjs → server-lifecycle-kmQ5PUDv.mjs} +0 -0
- /package/dist/{shared-schemas-BNCPgGYP.mjs → shared-schemas-DXwyMCwZ.mjs} +0 -0
- /package/dist/{src-ftBp6GpR.mjs → src-CCu8TwL6.mjs} +0 -0
- /package/dist/{storage-namespace-B1GI4elv.mjs → storage-namespace-BSrv0vXR.mjs} +0 -0
- /package/dist/{storage-namespace-definition-V8sc3drq.d.mts → storage-namespace-definition-BvlX0QV_.d.mts} +0 -0
- /package/dist/{storage-namespace-definition-4UYuij1r.mjs → storage-namespace-definition-CkMKt7-I.mjs} +0 -0
- /package/dist/{storage-namespace-9N9R61pI.d.mts → storage-namespace-dfywhXR3.d.mts} +0 -0
- /package/dist/{supports-color-DwW9N6YC.mjs → supports-color-DUugCQsK.mjs} +0 -0
- /package/dist/{telemetry-B42EMbZt.mjs → telemetry-Pr3oP2rk.mjs} +0 -0
- /package/dist/{timeout-CvONPl0l.mjs → timeout-DWDhddRJ.mjs} +0 -0
- /package/dist/{tray-menu-service-Dgedanv-.mjs → tray-menu-service-BBLa-Rcv.mjs} +0 -0
- /package/dist/{types-DkFvBdIY.d.mts → types-BrcjaNPZ.d.mts} +0 -0
- /package/dist/{types-DVLq657Y.d.mts → types-DHmPneIO.d.mts} +0 -0
- /package/dist/{types-Bju4dmAg.d.mts → types-b54n1o57.d.mts} +0 -0
- /package/dist/{ui-config-B2L3Xgqo.mjs → ui-config-CyCdlns_.mjs} +0 -0
- /package/dist/{variant-ByI-RZua.mjs → variant-krjlTdJt.mjs} +0 -0
- /package/dist/{window-registry-Qcnvlhp7.d.mts → window-registry-BDnZLPVx.d.mts} +0 -0
- /package/dist/{window-registry-DsWnCc8z.mjs → window-registry-I-imZHV_.mjs} +0 -0
package/dist/.makaio-build.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 1,
|
|
3
|
-
"fingerprint": "
|
|
4
|
-
"builtAt": "2026-07-
|
|
3
|
+
"fingerprint": "0dde88d0ba30c0895cbcceadc2b537465a725a4c6fefdf967734470ee95041b1",
|
|
4
|
+
"builtAt": "2026-07-29T17:05:21.163Z",
|
|
5
|
+
"declarations": true
|
|
5
6
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./json-value-DmU8ibo_.mjs";import"./shared-
|
|
1
|
+
import{t as e}from"./json-value-DmU8ibo_.mjs";import"./shared-BQ0CHIVy.mjs";import{g as t,h as n,m as r}from"./profile-BTAI31Nt.mjs";import{n as i}from"./version-CoCeMxDT.mjs";import{z as a}from"zod";const o=a.enum([`strong`,`alias`]),s=a.object({scheme:t,value:t,strength:o}),c=a.object({key:t,label:a.string(),usedPercentage:a.number().finite().min(0).max(100),resetsAt:n.optional()}),l=a.object({windows:a.array(c)}),u=a.record(a.string(),a.unknown()).optional(),d=a.object({clientId:t,found:a.boolean(),binaryPath:r.optional(),version:a.string().optional(),warningMessage:a.string().optional()}),f=a.object({clientId:t,binaryName:t,supportedVersions:i.optional()}),p=a.object({clientAccountId:t,clientId:t,observedAt:n,source:t,displayLabel:a.string().optional(),usage:l,metadata:u}),m=a.discriminatedUnion(`kind`,[a.object({kind:a.literal(`session`),sessionId:t}),a.object({kind:a.literal(`adapter-session`),adapterSessionId:t}),a.object({kind:a.literal(`both`),sessionId:t,adapterSessionId:t})]),h=a.object({clientId:a.string(),source:a.string(),kind:a.string(),observedAt:n,payload:e}),g={request:a.object({clientId:t,observedAt:n.optional(),displayLabel:a.string().optional(),identifiers:a.array(s).min(1),metadata:u}),response:a.object({clientAccountId:t,displayLabel:a.string().optional()})},_={request:h.extend({locator:m}),response:a.object({handled:a.boolean(),sessionId:t.nullable(),clientAccountId:t.nullable(),changed:a.boolean()})},v={request:a.object({clientId:t,observedAt:n,source:t,account:a.object({displayLabel:a.string().optional(),identifiers:a.array(s).min(1)}),usage:l,metadata:u}),response:a.object({clientAccountId:t,snapshot:p})};export{u as a,_ as c,p as d,c as f,h as i,m as l,g as n,d as o,l as p,o as r,f as s,s as t,v as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,b as t,c as n,d as r,f as i,g as a,h as o,ht as s,l as c,m as l,o as u,p as d,s as f,t as p,u as m,v as h,y as g}from"./schemas-
|
|
1
|
+
import{_ as e,b as t,c as n,d as r,f as i,g as a,h as o,ht as s,l as c,m as l,o as u,p as d,s as f,t as p,u as m,v as h,y as g}from"./schemas-Cm09dXL4.mjs";import"./compression-74fFeBha.mjs";import"./provider-context-Dq53Cgzz.mjs";import"./contracts/adapter/schemas/session-lineage.mjs";import{createBusNamespace as _}from"@makaio/framework/core";const v={getCapabilities:s,startAgent:t,infer:g,listAgents:h,getAgent:e,stopAgent:a,rehydrateAgent:o,getConfigSchema:l,"agent.created":d,"session.created":i,"session.discovered":p,"session.usage":r,"session.closed":m,log:c,error:n,initialized:f,quota:u},y=_(`adapter`,v),b=y.subjects;export{b as n,v as r,y as t};
|
|
@@ -1155,6 +1155,12 @@ type BetaContentBlockParam = z.infer<typeof BetaContentBlockParamSchema>;
|
|
|
1155
1155
|
* Note: Uses z.union() instead of z.discriminatedUnion() because
|
|
1156
1156
|
* SDKSystemMessageSchema and SDKResultMessageSchema are already
|
|
1157
1157
|
* discriminated unions on 'subtype'.
|
|
1158
|
+
*
|
|
1159
|
+
* The union is wider than `KNOWN_SDK_MESSAGE_TYPES` on purpose: it describes
|
|
1160
|
+
* every payload the client knowingly emits on `sdk.event`, while the known-type
|
|
1161
|
+
* set describes the subset the turn-state machine may consume. Diagnostic-only
|
|
1162
|
+
* messages such as `rate_limit_event` and `command_lifecycle`
|
|
1163
|
+
* belong here but not there.
|
|
1158
1164
|
*/
|
|
1159
1165
|
declare const SDKMessageSchema: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1160
1166
|
uuid: z.ZodString;
|
|
@@ -2359,7 +2365,64 @@ declare const SDKMessageSchema: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodD
|
|
|
2359
2365
|
type: z.ZodLiteral<"content_block_stop">;
|
|
2360
2366
|
index: z.ZodNumber;
|
|
2361
2367
|
}, z.core.$strip>], "type">;
|
|
2362
|
-
}, z.core.$strip
|
|
2368
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2369
|
+
uuid: z.ZodString;
|
|
2370
|
+
session_id: z.ZodString;
|
|
2371
|
+
correlation_id: z.ZodOptional<z.ZodString>;
|
|
2372
|
+
agentId: z.ZodOptional<z.ZodString>;
|
|
2373
|
+
timestamp: z.ZodOptional<z.ZodString>;
|
|
2374
|
+
cwd: z.ZodOptional<z.ZodString>;
|
|
2375
|
+
type: z.ZodLiteral<"rate_limit_event">;
|
|
2376
|
+
rate_limit_info: z.ZodObject<{
|
|
2377
|
+
status: z.ZodEnum<{
|
|
2378
|
+
rejected: "rejected";
|
|
2379
|
+
allowed: "allowed";
|
|
2380
|
+
allowed_warning: "allowed_warning";
|
|
2381
|
+
}>;
|
|
2382
|
+
resetsAt: z.ZodOptional<z.ZodNumber>;
|
|
2383
|
+
rateLimitType: z.ZodOptional<z.ZodEnum<{
|
|
2384
|
+
overage: "overage";
|
|
2385
|
+
five_hour: "five_hour";
|
|
2386
|
+
seven_day: "seven_day";
|
|
2387
|
+
seven_day_opus: "seven_day_opus";
|
|
2388
|
+
seven_day_sonnet: "seven_day_sonnet";
|
|
2389
|
+
}>>;
|
|
2390
|
+
utilization: z.ZodOptional<z.ZodNumber>;
|
|
2391
|
+
overageStatus: z.ZodOptional<z.ZodEnum<{
|
|
2392
|
+
rejected: "rejected";
|
|
2393
|
+
allowed: "allowed";
|
|
2394
|
+
allowed_warning: "allowed_warning";
|
|
2395
|
+
}>>;
|
|
2396
|
+
overageResetsAt: z.ZodOptional<z.ZodNumber>;
|
|
2397
|
+
overageDisabledReason: z.ZodOptional<z.ZodEnum<{
|
|
2398
|
+
unknown: "unknown";
|
|
2399
|
+
overage_not_provisioned: "overage_not_provisioned";
|
|
2400
|
+
org_level_disabled: "org_level_disabled";
|
|
2401
|
+
org_level_disabled_until: "org_level_disabled_until";
|
|
2402
|
+
out_of_credits: "out_of_credits";
|
|
2403
|
+
seat_tier_level_disabled: "seat_tier_level_disabled";
|
|
2404
|
+
member_level_disabled: "member_level_disabled";
|
|
2405
|
+
seat_tier_zero_credit_limit: "seat_tier_zero_credit_limit";
|
|
2406
|
+
group_zero_credit_limit: "group_zero_credit_limit";
|
|
2407
|
+
member_zero_credit_limit: "member_zero_credit_limit";
|
|
2408
|
+
org_service_level_disabled: "org_service_level_disabled";
|
|
2409
|
+
no_limits_configured: "no_limits_configured";
|
|
2410
|
+
fetch_error: "fetch_error";
|
|
2411
|
+
}>>;
|
|
2412
|
+
isUsingOverage: z.ZodOptional<z.ZodBoolean>;
|
|
2413
|
+
surpassedThreshold: z.ZodOptional<z.ZodNumber>;
|
|
2414
|
+
}, z.core.$strip>;
|
|
2415
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2416
|
+
uuid: z.ZodString;
|
|
2417
|
+
session_id: z.ZodString;
|
|
2418
|
+
correlation_id: z.ZodOptional<z.ZodString>;
|
|
2419
|
+
agentId: z.ZodOptional<z.ZodString>;
|
|
2420
|
+
timestamp: z.ZodOptional<z.ZodString>;
|
|
2421
|
+
cwd: z.ZodOptional<z.ZodString>;
|
|
2422
|
+
type: z.ZodLiteral<"command_lifecycle">;
|
|
2423
|
+
subtype: z.ZodString;
|
|
2424
|
+
command_uuid: z.ZodOptional<z.ZodString>;
|
|
2425
|
+
}, z.core.$loose>]>;
|
|
2363
2426
|
/** Raw SDK message type — `agentId` may be absent. */
|
|
2364
2427
|
type SDKMessage = z.infer<typeof SDKMessageSchema>;
|
|
2365
2428
|
//#endregion
|
|
@@ -3631,7 +3694,64 @@ declare function createClaudeConnectorNamespace<N extends string>(namespaceName:
|
|
|
3631
3694
|
type: z.ZodLiteral<"content_block_stop">;
|
|
3632
3695
|
index: z.ZodNumber;
|
|
3633
3696
|
}, z.core.$strip>], "type">;
|
|
3634
|
-
}, z.core.$strip
|
|
3697
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
3698
|
+
uuid: z.ZodString;
|
|
3699
|
+
session_id: z.ZodString;
|
|
3700
|
+
correlation_id: z.ZodOptional<z.ZodString>;
|
|
3701
|
+
agentId: z.ZodOptional<z.ZodString>;
|
|
3702
|
+
timestamp: z.ZodOptional<z.ZodString>;
|
|
3703
|
+
cwd: z.ZodOptional<z.ZodString>;
|
|
3704
|
+
type: z.ZodLiteral<"rate_limit_event">;
|
|
3705
|
+
rate_limit_info: z.ZodObject<{
|
|
3706
|
+
status: z.ZodEnum<{
|
|
3707
|
+
rejected: "rejected";
|
|
3708
|
+
allowed: "allowed";
|
|
3709
|
+
allowed_warning: "allowed_warning";
|
|
3710
|
+
}>;
|
|
3711
|
+
resetsAt: z.ZodOptional<z.ZodNumber>;
|
|
3712
|
+
rateLimitType: z.ZodOptional<z.ZodEnum<{
|
|
3713
|
+
overage: "overage";
|
|
3714
|
+
five_hour: "five_hour";
|
|
3715
|
+
seven_day: "seven_day";
|
|
3716
|
+
seven_day_opus: "seven_day_opus";
|
|
3717
|
+
seven_day_sonnet: "seven_day_sonnet";
|
|
3718
|
+
}>>;
|
|
3719
|
+
utilization: z.ZodOptional<z.ZodNumber>;
|
|
3720
|
+
overageStatus: z.ZodOptional<z.ZodEnum<{
|
|
3721
|
+
rejected: "rejected";
|
|
3722
|
+
allowed: "allowed";
|
|
3723
|
+
allowed_warning: "allowed_warning";
|
|
3724
|
+
}>>;
|
|
3725
|
+
overageResetsAt: z.ZodOptional<z.ZodNumber>;
|
|
3726
|
+
overageDisabledReason: z.ZodOptional<z.ZodEnum<{
|
|
3727
|
+
unknown: "unknown";
|
|
3728
|
+
overage_not_provisioned: "overage_not_provisioned";
|
|
3729
|
+
org_level_disabled: "org_level_disabled";
|
|
3730
|
+
org_level_disabled_until: "org_level_disabled_until";
|
|
3731
|
+
out_of_credits: "out_of_credits";
|
|
3732
|
+
seat_tier_level_disabled: "seat_tier_level_disabled";
|
|
3733
|
+
member_level_disabled: "member_level_disabled";
|
|
3734
|
+
seat_tier_zero_credit_limit: "seat_tier_zero_credit_limit";
|
|
3735
|
+
group_zero_credit_limit: "group_zero_credit_limit";
|
|
3736
|
+
member_zero_credit_limit: "member_zero_credit_limit";
|
|
3737
|
+
org_service_level_disabled: "org_service_level_disabled";
|
|
3738
|
+
no_limits_configured: "no_limits_configured";
|
|
3739
|
+
fetch_error: "fetch_error";
|
|
3740
|
+
}>>;
|
|
3741
|
+
isUsingOverage: z.ZodOptional<z.ZodBoolean>;
|
|
3742
|
+
surpassedThreshold: z.ZodOptional<z.ZodNumber>;
|
|
3743
|
+
}, z.core.$strip>;
|
|
3744
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
3745
|
+
uuid: z.ZodString;
|
|
3746
|
+
session_id: z.ZodString;
|
|
3747
|
+
correlation_id: z.ZodOptional<z.ZodString>;
|
|
3748
|
+
agentId: z.ZodOptional<z.ZodString>;
|
|
3749
|
+
timestamp: z.ZodOptional<z.ZodString>;
|
|
3750
|
+
cwd: z.ZodOptional<z.ZodString>;
|
|
3751
|
+
type: z.ZodLiteral<"command_lifecycle">;
|
|
3752
|
+
subtype: z.ZodString;
|
|
3753
|
+
command_uuid: z.ZodOptional<z.ZodString>;
|
|
3754
|
+
}, z.core.$loose>]>, z.ZodObject<{
|
|
3635
3755
|
originatingMessageId: z.ZodOptional<z.ZodString>;
|
|
3636
3756
|
}, z.core.$strip>>;
|
|
3637
3757
|
can_use_tool: {
|
|
@@ -4873,16 +4993,16 @@ declare function createClaudeConnectorNamespace<N extends string>(namespaceName:
|
|
|
4873
4993
|
adapterId: z.ZodString;
|
|
4874
4994
|
agentId: z.ZodString;
|
|
4875
4995
|
oldState: z.ZodEnum<{
|
|
4876
|
-
idle: "idle";
|
|
4877
4996
|
paused: "paused";
|
|
4997
|
+
idle: "idle";
|
|
4878
4998
|
turn_started: "turn_started";
|
|
4879
4999
|
step_started: "step_started";
|
|
4880
5000
|
step_finished: "step_finished";
|
|
4881
5001
|
turn_finished: "turn_finished";
|
|
4882
5002
|
}>;
|
|
4883
5003
|
newState: z.ZodEnum<{
|
|
4884
|
-
idle: "idle";
|
|
4885
5004
|
paused: "paused";
|
|
5005
|
+
idle: "idle";
|
|
4886
5006
|
turn_started: "turn_started";
|
|
4887
5007
|
step_started: "step_started";
|
|
4888
5008
|
step_finished: "step_finished";
|
|
@@ -4894,16 +5014,16 @@ declare function createClaudeConnectorNamespace<N extends string>(namespaceName:
|
|
|
4894
5014
|
adapterId: z.ZodString;
|
|
4895
5015
|
agentId: z.ZodString;
|
|
4896
5016
|
oldState: z.ZodEnum<{
|
|
4897
|
-
idle: "idle";
|
|
4898
5017
|
paused: "paused";
|
|
5018
|
+
idle: "idle";
|
|
4899
5019
|
turn_started: "turn_started";
|
|
4900
5020
|
step_started: "step_started";
|
|
4901
5021
|
step_finished: "step_finished";
|
|
4902
5022
|
turn_finished: "turn_finished";
|
|
4903
5023
|
}>;
|
|
4904
5024
|
newState: z.ZodEnum<{
|
|
4905
|
-
idle: "idle";
|
|
4906
5025
|
paused: "paused";
|
|
5026
|
+
idle: "idle";
|
|
4907
5027
|
turn_started: "turn_started";
|
|
4908
5028
|
step_started: "step_started";
|
|
4909
5029
|
step_finished: "step_finished";
|
|
@@ -4915,16 +5035,16 @@ declare function createClaudeConnectorNamespace<N extends string>(namespaceName:
|
|
|
4915
5035
|
adapterId: z.ZodString;
|
|
4916
5036
|
agentId: z.ZodString;
|
|
4917
5037
|
oldState: z.ZodEnum<{
|
|
4918
|
-
idle: "idle";
|
|
4919
5038
|
paused: "paused";
|
|
5039
|
+
idle: "idle";
|
|
4920
5040
|
turn_started: "turn_started";
|
|
4921
5041
|
step_started: "step_started";
|
|
4922
5042
|
step_finished: "step_finished";
|
|
4923
5043
|
turn_finished: "turn_finished";
|
|
4924
5044
|
}>;
|
|
4925
5045
|
newState: z.ZodEnum<{
|
|
4926
|
-
idle: "idle";
|
|
4927
5046
|
paused: "paused";
|
|
5047
|
+
idle: "idle";
|
|
4928
5048
|
turn_started: "turn_started";
|
|
4929
5049
|
step_started: "step_started";
|
|
4930
5050
|
step_finished: "step_finished";
|
|
@@ -4936,16 +5056,16 @@ declare function createClaudeConnectorNamespace<N extends string>(namespaceName:
|
|
|
4936
5056
|
adapterId: z.ZodString;
|
|
4937
5057
|
agentId: z.ZodString;
|
|
4938
5058
|
oldState: z.ZodEnum<{
|
|
4939
|
-
idle: "idle";
|
|
4940
5059
|
paused: "paused";
|
|
5060
|
+
idle: "idle";
|
|
4941
5061
|
turn_started: "turn_started";
|
|
4942
5062
|
step_started: "step_started";
|
|
4943
5063
|
step_finished: "step_finished";
|
|
4944
5064
|
turn_finished: "turn_finished";
|
|
4945
5065
|
}>;
|
|
4946
5066
|
newState: z.ZodEnum<{
|
|
4947
|
-
idle: "idle";
|
|
4948
5067
|
paused: "paused";
|
|
5068
|
+
idle: "idle";
|
|
4949
5069
|
turn_started: "turn_started";
|
|
4950
5070
|
step_started: "step_started";
|
|
4951
5071
|
step_finished: "step_finished";
|
|
@@ -4957,16 +5077,16 @@ declare function createClaudeConnectorNamespace<N extends string>(namespaceName:
|
|
|
4957
5077
|
adapterId: z.ZodString;
|
|
4958
5078
|
agentId: z.ZodString;
|
|
4959
5079
|
oldState: z.ZodEnum<{
|
|
4960
|
-
idle: "idle";
|
|
4961
5080
|
paused: "paused";
|
|
5081
|
+
idle: "idle";
|
|
4962
5082
|
turn_started: "turn_started";
|
|
4963
5083
|
step_started: "step_started";
|
|
4964
5084
|
step_finished: "step_finished";
|
|
4965
5085
|
turn_finished: "turn_finished";
|
|
4966
5086
|
}>;
|
|
4967
5087
|
newState: z.ZodEnum<{
|
|
4968
|
-
idle: "idle";
|
|
4969
5088
|
paused: "paused";
|
|
5089
|
+
idle: "idle";
|
|
4970
5090
|
turn_started: "turn_started";
|
|
4971
5091
|
step_started: "step_started";
|
|
4972
5092
|
step_finished: "step_finished";
|
|
@@ -4978,16 +5098,16 @@ declare function createClaudeConnectorNamespace<N extends string>(namespaceName:
|
|
|
4978
5098
|
adapterId: z.ZodString;
|
|
4979
5099
|
agentId: z.ZodString;
|
|
4980
5100
|
oldState: z.ZodEnum<{
|
|
4981
|
-
idle: "idle";
|
|
4982
5101
|
paused: "paused";
|
|
5102
|
+
idle: "idle";
|
|
4983
5103
|
turn_started: "turn_started";
|
|
4984
5104
|
step_started: "step_started";
|
|
4985
5105
|
step_finished: "step_finished";
|
|
4986
5106
|
turn_finished: "turn_finished";
|
|
4987
5107
|
}>;
|
|
4988
5108
|
newState: z.ZodEnum<{
|
|
4989
|
-
idle: "idle";
|
|
4990
5109
|
paused: "paused";
|
|
5110
|
+
idle: "idle";
|
|
4991
5111
|
turn_started: "turn_started";
|
|
4992
5112
|
step_started: "step_started";
|
|
4993
5113
|
step_finished: "step_finished";
|
|
@@ -6201,7 +6321,64 @@ declare function createClaudeConnectorNamespace<N extends string>(namespaceName:
|
|
|
6201
6321
|
type: z.ZodLiteral<"content_block_stop">;
|
|
6202
6322
|
index: z.ZodNumber;
|
|
6203
6323
|
}, z.core.$strip>], "type">;
|
|
6204
|
-
}, z.core.$strip
|
|
6324
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
6325
|
+
uuid: z.ZodString;
|
|
6326
|
+
session_id: z.ZodString;
|
|
6327
|
+
correlation_id: z.ZodOptional<z.ZodString>;
|
|
6328
|
+
agentId: z.ZodOptional<z.ZodString>;
|
|
6329
|
+
timestamp: z.ZodOptional<z.ZodString>;
|
|
6330
|
+
cwd: z.ZodOptional<z.ZodString>;
|
|
6331
|
+
type: z.ZodLiteral<"rate_limit_event">;
|
|
6332
|
+
rate_limit_info: z.ZodObject<{
|
|
6333
|
+
status: z.ZodEnum<{
|
|
6334
|
+
rejected: "rejected";
|
|
6335
|
+
allowed: "allowed";
|
|
6336
|
+
allowed_warning: "allowed_warning";
|
|
6337
|
+
}>;
|
|
6338
|
+
resetsAt: z.ZodOptional<z.ZodNumber>;
|
|
6339
|
+
rateLimitType: z.ZodOptional<z.ZodEnum<{
|
|
6340
|
+
overage: "overage";
|
|
6341
|
+
five_hour: "five_hour";
|
|
6342
|
+
seven_day: "seven_day";
|
|
6343
|
+
seven_day_opus: "seven_day_opus";
|
|
6344
|
+
seven_day_sonnet: "seven_day_sonnet";
|
|
6345
|
+
}>>;
|
|
6346
|
+
utilization: z.ZodOptional<z.ZodNumber>;
|
|
6347
|
+
overageStatus: z.ZodOptional<z.ZodEnum<{
|
|
6348
|
+
rejected: "rejected";
|
|
6349
|
+
allowed: "allowed";
|
|
6350
|
+
allowed_warning: "allowed_warning";
|
|
6351
|
+
}>>;
|
|
6352
|
+
overageResetsAt: z.ZodOptional<z.ZodNumber>;
|
|
6353
|
+
overageDisabledReason: z.ZodOptional<z.ZodEnum<{
|
|
6354
|
+
unknown: "unknown";
|
|
6355
|
+
overage_not_provisioned: "overage_not_provisioned";
|
|
6356
|
+
org_level_disabled: "org_level_disabled";
|
|
6357
|
+
org_level_disabled_until: "org_level_disabled_until";
|
|
6358
|
+
out_of_credits: "out_of_credits";
|
|
6359
|
+
seat_tier_level_disabled: "seat_tier_level_disabled";
|
|
6360
|
+
member_level_disabled: "member_level_disabled";
|
|
6361
|
+
seat_tier_zero_credit_limit: "seat_tier_zero_credit_limit";
|
|
6362
|
+
group_zero_credit_limit: "group_zero_credit_limit";
|
|
6363
|
+
member_zero_credit_limit: "member_zero_credit_limit";
|
|
6364
|
+
org_service_level_disabled: "org_service_level_disabled";
|
|
6365
|
+
no_limits_configured: "no_limits_configured";
|
|
6366
|
+
fetch_error: "fetch_error";
|
|
6367
|
+
}>>;
|
|
6368
|
+
isUsingOverage: z.ZodOptional<z.ZodBoolean>;
|
|
6369
|
+
surpassedThreshold: z.ZodOptional<z.ZodNumber>;
|
|
6370
|
+
}, z.core.$strip>;
|
|
6371
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
6372
|
+
uuid: z.ZodString;
|
|
6373
|
+
session_id: z.ZodString;
|
|
6374
|
+
correlation_id: z.ZodOptional<z.ZodString>;
|
|
6375
|
+
agentId: z.ZodOptional<z.ZodString>;
|
|
6376
|
+
timestamp: z.ZodOptional<z.ZodString>;
|
|
6377
|
+
cwd: z.ZodOptional<z.ZodString>;
|
|
6378
|
+
type: z.ZodLiteral<"command_lifecycle">;
|
|
6379
|
+
subtype: z.ZodString;
|
|
6380
|
+
command_uuid: z.ZodOptional<z.ZodString>;
|
|
6381
|
+
}, z.core.$loose>]>, z.ZodObject<{
|
|
6205
6382
|
originatingMessageId: z.ZodOptional<z.ZodString>;
|
|
6206
6383
|
}, z.core.$strip>>;
|
|
6207
6384
|
can_use_tool: {
|
|
@@ -7443,16 +7620,16 @@ declare function createClaudeConnectorNamespace<N extends string>(namespaceName:
|
|
|
7443
7620
|
adapterId: z.ZodString;
|
|
7444
7621
|
agentId: z.ZodString;
|
|
7445
7622
|
oldState: z.ZodEnum<{
|
|
7446
|
-
idle: "idle";
|
|
7447
7623
|
paused: "paused";
|
|
7624
|
+
idle: "idle";
|
|
7448
7625
|
turn_started: "turn_started";
|
|
7449
7626
|
step_started: "step_started";
|
|
7450
7627
|
step_finished: "step_finished";
|
|
7451
7628
|
turn_finished: "turn_finished";
|
|
7452
7629
|
}>;
|
|
7453
7630
|
newState: z.ZodEnum<{
|
|
7454
|
-
idle: "idle";
|
|
7455
7631
|
paused: "paused";
|
|
7632
|
+
idle: "idle";
|
|
7456
7633
|
turn_started: "turn_started";
|
|
7457
7634
|
step_started: "step_started";
|
|
7458
7635
|
step_finished: "step_finished";
|
|
@@ -7464,16 +7641,16 @@ declare function createClaudeConnectorNamespace<N extends string>(namespaceName:
|
|
|
7464
7641
|
adapterId: z.ZodString;
|
|
7465
7642
|
agentId: z.ZodString;
|
|
7466
7643
|
oldState: z.ZodEnum<{
|
|
7467
|
-
idle: "idle";
|
|
7468
7644
|
paused: "paused";
|
|
7645
|
+
idle: "idle";
|
|
7469
7646
|
turn_started: "turn_started";
|
|
7470
7647
|
step_started: "step_started";
|
|
7471
7648
|
step_finished: "step_finished";
|
|
7472
7649
|
turn_finished: "turn_finished";
|
|
7473
7650
|
}>;
|
|
7474
7651
|
newState: z.ZodEnum<{
|
|
7475
|
-
idle: "idle";
|
|
7476
7652
|
paused: "paused";
|
|
7653
|
+
idle: "idle";
|
|
7477
7654
|
turn_started: "turn_started";
|
|
7478
7655
|
step_started: "step_started";
|
|
7479
7656
|
step_finished: "step_finished";
|
|
@@ -7485,16 +7662,16 @@ declare function createClaudeConnectorNamespace<N extends string>(namespaceName:
|
|
|
7485
7662
|
adapterId: z.ZodString;
|
|
7486
7663
|
agentId: z.ZodString;
|
|
7487
7664
|
oldState: z.ZodEnum<{
|
|
7488
|
-
idle: "idle";
|
|
7489
7665
|
paused: "paused";
|
|
7666
|
+
idle: "idle";
|
|
7490
7667
|
turn_started: "turn_started";
|
|
7491
7668
|
step_started: "step_started";
|
|
7492
7669
|
step_finished: "step_finished";
|
|
7493
7670
|
turn_finished: "turn_finished";
|
|
7494
7671
|
}>;
|
|
7495
7672
|
newState: z.ZodEnum<{
|
|
7496
|
-
idle: "idle";
|
|
7497
7673
|
paused: "paused";
|
|
7674
|
+
idle: "idle";
|
|
7498
7675
|
turn_started: "turn_started";
|
|
7499
7676
|
step_started: "step_started";
|
|
7500
7677
|
step_finished: "step_finished";
|
|
@@ -7506,16 +7683,16 @@ declare function createClaudeConnectorNamespace<N extends string>(namespaceName:
|
|
|
7506
7683
|
adapterId: z.ZodString;
|
|
7507
7684
|
agentId: z.ZodString;
|
|
7508
7685
|
oldState: z.ZodEnum<{
|
|
7509
|
-
idle: "idle";
|
|
7510
7686
|
paused: "paused";
|
|
7687
|
+
idle: "idle";
|
|
7511
7688
|
turn_started: "turn_started";
|
|
7512
7689
|
step_started: "step_started";
|
|
7513
7690
|
step_finished: "step_finished";
|
|
7514
7691
|
turn_finished: "turn_finished";
|
|
7515
7692
|
}>;
|
|
7516
7693
|
newState: z.ZodEnum<{
|
|
7517
|
-
idle: "idle";
|
|
7518
7694
|
paused: "paused";
|
|
7695
|
+
idle: "idle";
|
|
7519
7696
|
turn_started: "turn_started";
|
|
7520
7697
|
step_started: "step_started";
|
|
7521
7698
|
step_finished: "step_finished";
|
|
@@ -7527,16 +7704,16 @@ declare function createClaudeConnectorNamespace<N extends string>(namespaceName:
|
|
|
7527
7704
|
adapterId: z.ZodString;
|
|
7528
7705
|
agentId: z.ZodString;
|
|
7529
7706
|
oldState: z.ZodEnum<{
|
|
7530
|
-
idle: "idle";
|
|
7531
7707
|
paused: "paused";
|
|
7708
|
+
idle: "idle";
|
|
7532
7709
|
turn_started: "turn_started";
|
|
7533
7710
|
step_started: "step_started";
|
|
7534
7711
|
step_finished: "step_finished";
|
|
7535
7712
|
turn_finished: "turn_finished";
|
|
7536
7713
|
}>;
|
|
7537
7714
|
newState: z.ZodEnum<{
|
|
7538
|
-
idle: "idle";
|
|
7539
7715
|
paused: "paused";
|
|
7716
|
+
idle: "idle";
|
|
7540
7717
|
turn_started: "turn_started";
|
|
7541
7718
|
step_started: "step_started";
|
|
7542
7719
|
step_finished: "step_finished";
|
|
@@ -7548,16 +7725,16 @@ declare function createClaudeConnectorNamespace<N extends string>(namespaceName:
|
|
|
7548
7725
|
adapterId: z.ZodString;
|
|
7549
7726
|
agentId: z.ZodString;
|
|
7550
7727
|
oldState: z.ZodEnum<{
|
|
7551
|
-
idle: "idle";
|
|
7552
7728
|
paused: "paused";
|
|
7729
|
+
idle: "idle";
|
|
7553
7730
|
turn_started: "turn_started";
|
|
7554
7731
|
step_started: "step_started";
|
|
7555
7732
|
step_finished: "step_finished";
|
|
7556
7733
|
turn_finished: "turn_finished";
|
|
7557
7734
|
}>;
|
|
7558
7735
|
newState: z.ZodEnum<{
|
|
7559
|
-
idle: "idle";
|
|
7560
7736
|
paused: "paused";
|
|
7737
|
+
idle: "idle";
|
|
7561
7738
|
turn_started: "turn_started";
|
|
7562
7739
|
step_started: "step_started";
|
|
7563
7740
|
step_finished: "step_finished";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{z as e}from"zod";import{AuthenticationError as
|
|
2
|
-
`)}function _e(e){return e.type!==`tool_use`||!e.id||!e.name?null:{toolCallId:e.id,toolName:e.name}}var ve=class extends ee{supportsNativeResume(){return!0}supportsNativeFork(){return!0}currentStepType=`text`;currentTextContent=``;currentReasoningContent=``;currentToolCall=null;toolBlockIndexMap=new Map;currentToolArgsJson=``;wireEvents(e){let t=e;this.wireConnectorEvents(t),this.wireToolApprovalRpc(e)}subscribeClaudeConnector(e,t,n,r){this.addConnectorWiringCleanup(e.on(t,n,r))}wireConnectorEvents(e){let t=this.getSubjects();this.subscribeClaudeConnector(e,t.sdk.event,async e=>{let t=e.payload,n=t.originatingMessageId;switch(t.type){case`system`:t.subtype===`init`&&await this.emitStart();break;case`assistant`:{let e=t.message?.content;if(!e)break;await ce(e,h,async(e,t)=>{if(e.subject===`tool.use`){if(n===void 0)return;let e=t;await this.emitToolUse(n,e.toolName,e.args,e.toolCallId)}else if(e.subject===`tool.started`||e.subject===`tool.completed`){if(n===void 0)return;await this.emitGlobal(e,{...t,messageId:n})}else await this.emitGlobal(e,t)});break}case`stream_event`:{let e=t.event;e.type===`content_block_start`?await this.handleContentBlockStart(e,n):e.type===`content_block_stop`?await this.handleContentBlockStop(e):e.type===`content_block_delta`&&await this.handleContentBlockDelta(e);break}case`result`:await this.handleResultEvent(t);break;case`user`:await this.handleUserEvent(t,n);break}})}async handleContentBlockStart(e,t){let n=e.content_block,r=_e(n),i=n.type===`thinking`?`reasoning`:n.type===`tool_use`?`tool_use`:`text`;this.currentStepType=i,this.currentTextContent=``,this.currentReasoningContent=``,this.currentToolArgsJson=``,this.currentToolCall=null;let a=r?{type:`tool_use`,toolName:r.toolName,toolCallId:r.toolCallId}:n.type===`tool_use`?void 0:{type:i},s;if(r&&(this.currentToolCall={toolCallId:r.toolCallId,name:r.toolName,args:{}},this.toolBlockIndexMap.set(r.toolCallId,e.index),s={type:`tool_call`,toolCallId:r.toolCallId,name:r.toolName,args:{}}),n.type===`tool_use`&&!r&&console.warn(`[ClaudeCodeAdapter] Received tool_use block without id or name; skipping tool correlation setup`),r&&t===void 0){console.warn(`[ClaudeCodeAdapter] Received tool_use block without originating message identity; skipping tool events`);return}await this.emitGlobal(o.step.started,{...t!==void 0&&{messageId:t},stepType:i,blockIndex:e.index,blockData:a,content:s}),r&&await this.emitGlobal(o.tool.started,{...t!==void 0&&{messageId:t},toolName:r.toolName,toolCallId:r.toolCallId})}async handleContentBlockStop(e){if(this.currentStepType!==`tool_use`){let t=this.currentStepType===`text`?{type:`text`,content:this.currentTextContent}:{type:`reasoning`,content:this.currentReasoningContent};await this.emitGlobal(o.step.finished,{stepType:this.currentStepType,blockIndex:e.index,content:t})}else if(this.currentToolCall&&this.currentToolArgsJson)try{this.currentToolCall.args=JSON.parse(this.currentToolArgsJson)}catch{}}async handleContentBlockDelta(e){let t=e.delta;switch(t.type){case`text_delta`:this.currentTextContent+=t.text,await this.emitGlobal(o.message_delta,{text:t.text});break;case`thinking_delta`:this.currentReasoningContent+=t.thinking,await this.emitGlobal(o.reasoning_delta,{content:t.thinking});break;case`input_json_delta`:`partial_json`in t&&(this.currentToolArgsJson+=t.partial_json);break}}async handleResultEvent(e){if(e.usage){let t=e.usage;await this.trackUsage(fe(t,e.total_cost_usd)),await this.emitContextWindowUpdate({currentTokens:pe(t),maxTokens:this.getContextWindowSize()??2e5,cachedTokens:t.cache_read_input_tokens})}}async handleUserEvent(e,t){await me({messageId:t,payload:e,resolveToolOutput:async(e,t,n)=>await this.emitToolOutput(e,t,{nativeId:n}),emitToolCompleted:async e=>await this.emitGlobal(o.tool.completed,e),emitToolStepFinished:async e=>await this.emitGlobal(o.step.finished,{stepType:`tool_use`,blockIndex:e.blockIndex,content:{type:`tool_output`,toolCallId:e.toolCallId,output:e.output,isError:e.isError}}),consumeToolBlockIndex:e=>this.consumeToolBlockIndex(e)})}consumeToolBlockIndex(e){if(e===void 0)return-1;let t=this.toolBlockIndexMap.get(e);return this.toolBlockIndexMap.delete(e),t===void 0&&console.warn(`[ClaudeCodeAdapter] toolCallId ${e} not found in toolBlockIndexMap - possible state mismatch`),t??-1}wireToolApprovalRpc(e){this.addConnectorWiringCleanup(m(e,this.getSubjects(),async()=>({adapterId:this.adapterId,adapterName:this.adapterName,agentId:this.agentId,adapterSessionId:await this.getAdapterSessionId(),sessionId:this.sessionId}),this.globalBus))}},ye=class{queue=[];resolvers=[];done=!1;async*[Symbol.asyncIterator](){for(;;)if(this.queue.length>0)yield this.queue.shift();else if(this.done)return;else yield await new Promise(e=>{this.resolvers.push(t=>{t.done||e(t.value)})})}push(e){if(this.done)throw Error(`Cannot push to completed source`);this.resolvers.length>0?this.resolvers.shift()({value:e,done:!1}):this.queue.push(e)}complete(){this.done=!0;for(let e of this.resolvers)e({value:void 0,done:!0});this.resolvers=[]}clear(){this.queue=[]}},be=class extends te{queryInstance;activeMessageHandle;pausedDeferred;isPausedFlag=!1;connectorBus;subjects;agentId;expectingInterruptResult=!1;constructor(e,t,n,r,i,a,o){super(e,n,r,`idle`),this.connectorBus=e,this.subjects=t,this.agentId=i,this.queryInstance=a,this.activeMessageHandle=o}setActiveMessageHandle(e){this.activeMessageHandle=e}async emitStateChange(e,t){let n={adapterId:this.adapterId,agentId:this.agentId,oldState:e,newState:t,timestamp:Date.now()};switch(await this.connectorBus.emit(this.subjects.turn.state_changed,n),t){case`turn_started`:await this.connectorBus.emit(this.subjects.turn.turn_started,n);break;case`step_started`:await this.connectorBus.emit(this.subjects.turn.step_started,n);break;case`step_finished`:await this.connectorBus.emit(this.subjects.turn.step_finished,n);break;case`turn_finished`:await this.connectorBus.emit(this.subjects.turn.turn_finished,n);break;case`paused`:await this.connectorBus.emit(this.subjects.turn.paused,n);break}}async start(){await this.transitionTo(`turn_started`)}async pause(){if(this.state===`turn_finished`)return{stateBeforePause:this.state,turnEnded:!0};if(this.isPausedFlag)return{stateBeforePause:this.state,turnEnded:!1};if(this.state!==`step_finished`&&(await this.waitForStepFinished(),this.getState()===`turn_finished`)||(await this.queryInstance.interrupt(),this.getState()===`turn_finished`))return{stateBeforePause:this.state,turnEnded:!0};this.expectingInterruptResult=!0,this.isPausedFlag=!0;let e=this.state;return await this.transitionTo(`paused`),{stateBeforePause:e,turnEnded:!1}}async resume(e){if(!this.isPausedFlag)throw Error(`Cannot resume - turn not paused`);this.isPausedFlag=!1,await this.transitionTo(`step_started`)}isPaused(){return this.isPausedFlag}async handleSdkEvent(e){if(e.type===`stream_event`)e.event.type===`content_block_start`?await this.transitionTo(`step_started`):e.event.type===`content_block_stop`&&(await this.transitionTo(`step_finished`),this.pausedDeferred?.resolve());else if(e.type===`result`){if(this.expectingInterruptResult){this.expectingInterruptResult=!1;return}await this.transitionTo(`turn_finished`)}}isExpectingInterruptResult(){return this.expectingInterruptResult}async finishOnError(){this.pausedDeferred?.resolve(),this.pausedDeferred=void 0,this.isPausedFlag=!1,this.expectingInterruptResult=!1,this.state!==`turn_finished`&&await this.transitionTo(`turn_finished`)}async waitForStepFinished(){if(this.state!==`step_finished`){this.pausedDeferred=new le;try{await this.pausedDeferred.getPromise()}finally{this.pausedDeferred=void 0}}}isCompleted(){return this.state===`turn_finished`}canAcceptImmediate(){return this.state!==`turn_finished`&&!this.isPausedFlag}};const g=Object.freeze({approve:`claude-code.tool-response.approve`,deny:`claude-code.tool-response.deny`});c({id:`claude-code`,name:`Claude Code`,version:`0.1.0`,description:`Anthropic Claude Code CLI — an agentic coding assistant`,binary:{name:`claude`,supportedVersions:`^2.1.143`},managedInstall:{type:`signed-binary-bucket`,version:`2.1.143`,config:{baseUrl:`https://downloads.claude.ai/claude-code-releases`,manifestPathTemplate:`{version}/manifest.json`,manifestSignaturePathTemplate:`{version}/manifest.json.sig`,publicKeyUrl:`https://downloads.claude.ai/keys/claude-code.asc`,publicKeyFingerprint:`31DD DE24 DDFA B679 F42D 7BD2 BAA9 29FF 1A7E CACE`,binaryPathTemplate:`{version}/{platform}/{binary}`,platforms:{"darwin-arm64":`darwin-arm64`,"darwin-x64":`darwin-x64`,"linux-arm64":`linux-arm64`,"linux-x64":`linux-x64`,"linux-arm64-musl":`linux-arm64-musl`,"linux-x64-musl":`linux-x64-musl`,"win32-arm64":`win32-arm64`,"win32-x64":`win32-x64`}}},versionCommand:{executable:{default:`claude`,win32:`claude.exe`},args:[`--version`]},configIsolation:{envVar:`CLAUDE_CONFIG_DIR`,defaultPath:`~/.claude`},nativeTools:[{name:`bash`,friendlyName:`Terminal`,description:`Execute shell commands`,category:`System`,capabilities:[{tag:`shell.execute`},{tag:`file.read`},{tag:`file.write`},{tag:`file.delete`},{tag:`network.request`},{tag:`process.manage`}]},{name:`text_editor`,friendlyName:`Text Editor`,description:`View and edit files`,category:`Files`,capabilities:[{tag:`file.read`},{tag:`file.write`}]},{name:`list_directory`,friendlyName:`List Directory`,description:`List directory contents`,category:`Files`,capabilities:[{tag:`file.read`},{tag:`search.files`}]},{name:`read_file`,friendlyName:`Read File`,description:`Read file contents`,category:`Files`,capabilities:[{tag:`file.read`}]},{name:`write_file`,friendlyName:`Write File`,description:`Write content to a file`,category:`Files`,capabilities:[{tag:`file.write`}]}],defaultApprovalPolicy:`full-access`,authMethods:[{id:`native`,mode:`inferred`,label:`Native account`},{id:`oauth-token`,mode:`explicit`,label:`OAuth token`,fields:[{id:`oauthToken`,label:`OAuth token`,required:!0,secret:!0,sourceHints:[{kind:`environment`,variable:`CLAUDE_CODE_OAUTH_TOKEN`}]}]}],defaultAuth:{providerDefinitionId:`anthropic-oauth`,methodId:`native`},runtimeCapabilities:{supportsHooks:!0,supportsStatusline:!0,supportsSupervisorLaunch:!1,supportsManagedBinary:!0,hookEvents:[{name:`SessionStart`,frameworkSubject:`client.session.started`},{name:`UserPromptSubmit`,frameworkSubject:`client.session.userPrompt.submitted`},{name:`PreToolUse`,frameworkSubject:`client.session.tool.pre`,responseCapabilities:[g.approve,g.deny,`context.append`]},{name:`PostToolUse`,frameworkSubject:`client.session.tool.post`},{name:`Stop`,frameworkSubject:`client.session.turn.completed`},{name:`SubagentStop`},{name:`Notification`},{name:`MCPServerStart`},{name:`MCPServerStop`}]}});const _=e.object({uuid:e.string(),session_id:e.string(),type:e.string(),correlation_id:e.string().optional(),agentId:e.string().optional(),timestamp:e.string().optional(),cwd:e.string().optional()}),v=_.extend({parent_tool_use_id:e.string().nullable().optional()});_.required({agentId:!0}).extend({parent_tool_use_id:e.string().nullable().optional()});const y=e.enum([`invalid_tool_input`,`unavailable`,`too_many_requests`,`execution_time_exceeded`]),b=e.object({web_search_requests:e.number()}),xe=e.object({ephemeral_1h_input_tokens:e.number(),ephemeral_5m_input_tokens:e.number()}),x=e.object({cache_creation:xe.nullable().optional(),cache_creation_input_tokens:e.number().nullable().optional(),cache_read_input_tokens:e.number().nullable().optional(),input_tokens:e.number(),output_tokens:e.number(),server_tool_use:b.nullable().optional(),service_tier:e.enum([`standard`,`priority`,`batch`]).nullable().optional()});e.object({cache_creation_input_tokens:e.number().nullable().optional(),cache_read_input_tokens:e.number().nullable().optional(),input_tokens:e.number().nullable().optional(),output_tokens:e.number(),server_tool_use:b.nullable().optional()});const S=e.object({type:e.literal(`ephemeral`),ttl:e.enum([`5m`,`1h`]).optional()}),Se=e.object({data:e.string(),media_type:e.enum([`image/jpeg`,`image/png`,`image/gif`,`image/webp`]),type:e.literal(`base64`)}),Ce=e.object({type:e.literal(`url`),url:e.string()}),we=e.object({file_id:e.string(),type:e.literal(`file`)}),Te=e.discriminatedUnion(`type`,[Se,Ce,we]),Ee=e.object({data:e.string(),media_type:e.literal(`application/pdf`),type:e.literal(`base64`)}),De=e.object({type:e.literal(`url`),url:e.string()}),Oe=e.object({file_id:e.string(),type:e.literal(`file`)}),ke=e.object({data:e.string(),media_type:e.literal(`text/plain`),type:e.literal(`text`)}),Ae=e.object({cited_text:e.string(),document_index:e.number(),document_title:e.string().nullable(),end_char_index:e.number(),file_id:e.string().nullable().optional(),start_char_index:e.number(),type:e.literal(`char_location`)}),je=e.object({cited_text:e.string(),document_index:e.number(),document_title:e.string().nullable(),end_char_index:e.number(),start_char_index:e.number(),type:e.literal(`char_location`)}),Me=e.object({cited_text:e.string(),document_index:e.number(),document_title:e.string().nullable(),end_page_number:e.number(),file_id:e.string().nullable().optional(),start_page_number:e.number(),type:e.literal(`page_location`)}),Ne=e.object({cited_text:e.string(),document_index:e.number(),document_title:e.string().nullable(),end_page_number:e.number(),start_page_number:e.number(),type:e.literal(`page_location`)}),Pe=e.object({cited_text:e.string(),document_index:e.number(),document_title:e.string().nullable(),end_block_index:e.number(),file_id:e.string().nullable().optional(),start_block_index:e.number(),type:e.literal(`content_block_location`)}),Fe=e.object({cited_text:e.string(),document_index:e.number(),document_title:e.string().nullable(),end_block_index:e.number(),start_block_index:e.number(),type:e.literal(`content_block_location`)}),Ie=e.object({cited_text:e.string(),encrypted_index:e.string(),title:e.string().nullable().optional(),type:e.literal(`web_search_result_location`),url:e.string()}),Le=e.object({cited_text:e.string(),encrypted_index:e.string(),title:e.string().nullable().optional(),type:e.literal(`web_search_result_location`),url:e.string()}),Re=e.object({cited_text:e.string(),end_block_index:e.number(),search_result_index:e.number(),source:e.string(),start_block_index:e.number(),title:e.string().nullable().optional(),type:e.literal(`search_result_location`)}),ze=e.object({cited_text:e.string(),end_block_index:e.number(),search_result_index:e.number(),source:e.string(),start_block_index:e.number(),title:e.string().nullable().optional(),type:e.literal(`search_result_location`)}),C=e.discriminatedUnion(`type`,[Ae,Me,Pe,Ie,Re]),Be=e.discriminatedUnion(`type`,[je,Ne,Fe,Le,ze]);e.object({citation:C,type:e.literal(`citations_delta`)});const w=e.object({enabled:e.boolean().optional()}),Ve=e.object({id:e.string(),expires_at:e.string()}),He=e.enum([`end_turn`,`max_tokens`,`stop_sequence`,`tool_use`,`pause_turn`,`refusal`]),T=e.object({text:e.string(),type:e.literal(`text`),cache_control:S.nullable().optional(),citations:e.array(Be).nullable().optional()}),E=e.object({source:Te,type:e.literal(`image`),cache_control:S.nullable().optional()}),Ue=e.object({content:e.union([e.string(),e.array(e.union([T,E]))]),type:e.literal(`content`)}),We=e.object({source:e.union([Ee,ke,Ue,De,Oe]),type:e.literal(`document`),cache_control:S.nullable().optional(),citations:w.optional(),context:e.string().nullable().optional(),title:e.string().nullable().optional()}),D=e.object({content:e.array(T),source:e.string(),title:e.string(),type:e.literal(`search_result`),cache_control:S.nullable().optional(),citations:w.optional()}),O=e.object({citations:e.array(C).nullable().optional(),text:e.string(),type:e.literal(`text`)}),k=e.object({signature:e.string(),thinking:e.string(),type:e.literal(`thinking`)}),Ge=e.object({data:e.string(),type:e.literal(`redacted_thinking`)}),Ke=e.object({id:e.string(),input:e.looseObject({}),name:e.string(),type:e.literal(`tool_use`)}),qe=e.object({id:e.string(),input:e.looseObject({}),name:e.enum([`web_search`,`code_execution`]),type:e.literal(`server_tool_use`)}),Je=e.object({encrypted_content:e.string(),page_age:e.string().nullable().optional(),title:e.string(),type:e.literal(`web_search_result`),url:e.string()}),Ye=e.enum([`invalid_tool_input`,`unavailable`,`max_uses_exceeded`,`too_many_requests`,`query_too_long`]),Xe=e.object({error_code:Ye,type:e.literal(`web_search_tool_result_error`)}),Ze=e.union([Xe,e.array(Je)]),Qe=e.object({content:Ze,tool_use_id:e.string(),type:e.literal(`web_search_tool_result`)}),$e=e.object({file_id:e.string(),type:e.literal(`code_execution_output`)}),et=e.object({content:e.array($e),return_code:e.number(),stderr:e.string(),stdout:e.string(),type:e.literal(`code_execution_result`)}),tt=e.object({error_code:y,type:e.literal(`code_execution_tool_result_error`)}),nt=e.union([tt,et]),rt=e.object({content:nt,tool_use_id:e.string(),type:e.literal(`code_execution_tool_result`)}),it=e.object({id:e.string(),input:e.looseObject({}),name:e.string(),server_name:e.string(),type:e.literal(`mcp_tool_use`)}),at=e.object({content:e.union([e.string(),e.array(O)]),is_error:e.boolean(),tool_use_id:e.string(),type:e.literal(`mcp_tool_result`)}),ot=e.object({file_id:e.string(),type:e.literal(`container_upload`)}),A=e.discriminatedUnion(`type`,[O,k,Ge,Ke,qe,Qe,rt,it,at,ot]),st=k.extend({}),ct=e.object({data:e.string(),type:e.literal(`redacted_thinking`)}),lt=e.object({id:e.string(),input:e.record(e.string(),e.unknown()),name:e.string(),type:e.literal(`tool_use`),cache_control:S.nullable().optional()}),ut=e.object({tool_use_id:e.string(),type:e.literal(`tool_result`),cache_control:S.nullable().optional(),content:e.union([e.string(),e.array(e.union([T,E,D]))]).optional(),is_error:e.boolean().optional()}),dt=e.object({id:e.string(),input:e.record(e.string(),e.unknown()),name:e.enum([`web_search`,`code_execution`]),type:e.literal(`server_tool_use`),cache_control:S.nullable().optional()}),ft=e.object({encrypted_content:e.string(),title:e.string(),type:e.literal(`web_search_result`),url:e.string(),page_age:e.string().nullable().optional()}),pt=e.object({error_code:e.enum([`invalid_tool_input`,`unavailable`,`max_uses_exceeded`,`too_many_requests`,`query_too_long`]),type:e.literal(`web_search_tool_result_error`)}),mt=e.union([e.array(ft),pt]),ht=e.object({content:mt,tool_use_id:e.string(),type:e.literal(`web_search_tool_result`),cache_control:S.nullable().optional()}),gt=e.object({file_id:e.string(),type:e.literal(`code_execution_output`)}),_t=e.object({content:e.array(gt),return_code:e.number(),stderr:e.string(),stdout:e.string(),type:e.literal(`code_execution_result`)}),vt=e.object({error_code:y,type:e.literal(`code_execution_tool_result_error`)}),yt=e.union([vt,_t]),bt=e.object({content:yt,tool_use_id:e.string(),type:e.literal(`code_execution_tool_result`),cache_control:S.nullable().optional()}),xt=e.object({id:e.string(),input:e.record(e.string(),e.unknown()),name:e.string(),server_name:e.string(),type:e.literal(`mcp_tool_use`),cache_control:S.nullable().optional()}),St=e.object({tool_use_id:e.string(),type:e.literal(`mcp_tool_result`),cache_control:S.nullable().optional(),content:e.union([e.string(),e.array(T)]).optional(),is_error:e.boolean().optional()}),Ct=e.object({file_id:e.string(),type:e.literal(`container_upload`),cache_control:S.nullable().optional()}),wt=e.discriminatedUnion(`type`,[T,E,We,D,st,ct,lt,ut,dt,ht,bt,xt,St,Ct]),Tt=e.object({id:e.string(),type:e.literal(`message`),role:e.literal(`assistant`),model:e.string(),content:e.array(A),stop_reason:He.nullable().optional(),stop_sequence:e.string().nullable().optional(),usage:x,container:Ve.nullable().optional()}),j=v.extend({type:e.literal(`assistant`),message:Tt}),Et=e.object({role:e.enum([`user`,`assistant`]),content:e.union([e.string(),e.array(wt)])}),Dt=x.extend({cache_creation:x.shape.cache_creation.unwrap(),cache_creation_input_tokens:e.number(),cache_read_input_tokens:e.number(),server_tool_use:x.shape.server_tool_use.unwrap(),service_tier:e.enum([`standard`,`priority`,`batch`])}),Ot=e.object({inputTokens:e.number(),outputTokens:e.number(),cacheReadInputTokens:e.number(),cacheCreationInputTokens:e.number(),webSearchRequests:e.number(),costUSD:e.number(),contextWindow:e.number()}),kt=e.object({tool_name:e.string(),tool_use_id:e.string(),tool_input:e.unknown()}),M=_.extend({type:e.literal(`result`),duration_ms:e.number(),duration_api_ms:e.number(),is_error:e.boolean(),num_turns:e.number(),total_cost_usd:e.number(),usage:Dt,modelUsage:e.record(e.string(),Ot),permission_denials:e.array(kt)}),At=M.extend({subtype:e.literal(`success`),result:e.string(),structured_output:s.optional()}),jt=M.extend({subtype:e.enum([`error_during_execution`,`error_max_turns`,`error_max_budget_usd`,`error_max_structured_output_retries`]),errors:e.array(e.string()),stop_reason:e.string().nullable()}),N=e.discriminatedUnion(`subtype`,[At,jt]),Mt=e.object({type:e.literal(`message_start`),message:e.object({id:e.string(),type:e.literal(`message`),role:e.literal(`assistant`)})}),Nt=e.object({type:e.literal(`message_delta`),delta:e.object({stop_reason:e.string().nullable().optional(),stop_sequence:e.string().nullable().optional(),container:e.object({id:e.string(),expires_at:e.string()}).nullable().optional()}),usage:x}),Pt=e.object({type:e.literal(`message_stop`)}),Ft=e.object({type:e.literal(`content_block_start`),index:e.number(),content_block:A}),It=e.object({type:e.literal(`content_block_delta`),index:e.number(),delta:e.discriminatedUnion(`type`,[e.object({type:e.literal(`text_delta`),text:e.string()}),e.object({type:e.literal(`thinking_delta`),thinking:e.string()}),e.object({type:e.literal(`input_json_delta`),partial_json:e.string()}),e.object({type:e.literal(`citations_delta`),citation:C}),e.object({type:e.literal(`signature_delta`),signature:e.string()})])}),Lt=e.object({type:e.literal(`content_block_stop`),index:e.number()}),Rt=e.discriminatedUnion(`type`,[Mt,Nt,Pt,Ft,It,Lt]),P=v.extend({type:e.literal(`stream_event`),event:Rt}),zt=[`init`,`compact_boundary`],Bt=e.enum([`user`,`project`,`org`,`temporary`,`none`]),Vt=e.enum([`default`,`acceptEdits`,`bypassPermissions`,`plan`]),Ht=e.object({name:e.string(),status:e.string()}),Ut=e.object({trigger:e.enum([`manual`,`auto`]),pre_tokens:e.number()}),Wt=_.extend({type:e.literal(`system`),subtype:e.literal(`init`),agents:e.array(e.string()).optional(),apiKeySource:Bt,cwd:e.string(),tools:e.array(e.string()),mcp_servers:e.array(Ht),model:e.string(),permissionMode:Vt,slash_commands:e.array(e.string()),output_style:e.string()}),Gt=_.extend({type:e.literal(`system`),subtype:e.literal(`compact_boundary`),compact_metadata:Ut}),Kt=e.discriminatedUnion(`subtype`,[Wt,Gt]),qt=_.extend({type:e.literal(`system`),subtype:e.string().refine(e=>!zt.some(t=>t===e))}).passthrough(),F=e.union([Kt,qt]),I=v.extend({type:e.literal(`user`),message:Et,isSynthetic:e.boolean().optional(),isCompactSummary:e.boolean().optional(),tool_use_result:e.object({stdout:e.string().optional(),stderr:e.string().optional(),interrupted:e.boolean().optional(),isImage:e.boolean().optional()}).or(e.string()).optional()}).refine(e=>!e.isCompactSummary||e.isSynthetic===!0,{message:`Compact summary messages must be synthetic`,path:[`isCompactSummary`]}),L=e.enum([`idle`,`turn_started`,`step_started`,`step_finished`,`turn_finished`,`paused`]),R=e.object({adapterId:e.string(),agentId:e.string(),oldState:L,newState:L,timestamp:e.number()}),z=e.union([F,j,I,N,P]);e.intersection(z,e.object({agentId:e.string()}));const B=e.object({used_percentage:e.number().optional(),resets_at:e.number().optional()}).passthrough(),Jt=e.object({five_hour:B.optional(),seven_day:B.optional()}).passthrough(),Yt=e.object({input_tokens:e.number().optional(),output_tokens:e.number().optional(),cache_creation_input_tokens:e.number().optional(),cache_read_input_tokens:e.number().optional()}).passthrough();e.object({cwd:e.string().optional(),session_id:e.string().optional(),session_name:e.string().optional(),transcript_path:e.string().optional(),model:e.object({id:e.string().optional(),display_name:e.string().optional(),family:e.string().optional()}).passthrough().optional(),workspace:e.object({current_dir:e.string().optional(),project_dir:e.string().optional(),added_dirs:e.array(e.string()).optional(),git_worktree:e.string().optional()}).passthrough().optional(),version:e.string().optional(),output_style:e.object({name:e.string().optional(),variant:e.string().optional()}).passthrough().optional(),cost:e.object({total_cost_usd:e.number().optional(),total_duration_ms:e.number().optional(),total_api_duration_ms:e.number().optional(),total_lines_added:e.number().optional(),total_lines_removed:e.number().optional(),total_edits:e.number().optional()}).passthrough().optional(),context_window:e.object({total_input_tokens:e.number().optional(),total_output_tokens:e.number().optional(),context_window_size:e.number().optional(),used_percentage:e.number().nullable().optional(),remaining_percentage:e.number().nullable().optional(),current_usage:Yt.nullable().optional()}).passthrough().nullable().optional(),exceeds_200k_tokens:e.boolean().optional(),rate_limits:Jt.optional(),vim:e.object({mode:e.string().optional()}).passthrough().optional(),agent:e.object({name:e.string().optional(),kind:e.string().optional()}).passthrough().optional(),worktree:e.object({name:e.string().optional(),path:e.string().optional(),branch:e.string().optional(),original_cwd:e.string().optional(),original_branch:e.string().optional(),provider:e.string().optional()}).passthrough().optional()}).passthrough();const V=e.enum([`user`,`project`,`local`]),H=e.object({type:e.literal(`command`),command:e.string().min(1),padding:e.number().optional()}),U=e.object({type:e.literal(`command`),command:e.string().min(1),timeout:e.number().optional()}),W=e.object({matcher:e.string().optional(),hooks:e.array(U)}),G=e.object({type:e.string().min(1),url:e.string().optional(),command:e.string().optional(),args:e.array(e.string()).optional(),env:e.record(e.string(),e.string()).optional()}).passthrough(),Xt=e.object({scope:V,path:e.string(),value:H.nullable()}),Zt=e.object({scope:V,path:e.string(),events:e.record(e.string(),e.array(W))}),Qt=e.object({name:e.string().min(1),enabled:e.boolean(),scope:V});e.object({projectDir:f.optional()}),e.object({effective:H.nullable(),perScope:e.array(Xt)}),e.object({scope:V,projectDir:f.optional(),value:H}).refine(e=>e.scope===`user`||e.projectDir!==void 0,{message:`projectDir is required when scope is project or local`,path:[`projectDir`]}),e.object({previous:H.nullable(),applied:H}),e.object({eventName:e.string().optional(),projectDir:f.optional()}),e.object({effective:e.record(e.string(),e.array(W)),perScope:e.array(Zt)}),e.object({scope:V,projectDir:f.optional(),eventName:e.string().min(1),matcher:e.string().min(1).optional(),hook:U}).refine(e=>e.scope===`user`||e.projectDir!==void 0,{message:`projectDir is required when scope is project or local`,path:[`projectDir`]}),e.object({added:e.boolean()}),e.object({scope:V,projectDir:f.optional(),eventName:e.string().min(1),match:e.object({commandContains:e.string().min(1)})}).refine(e=>e.scope===`user`||e.projectDir!==void 0,{message:`projectDir is required when scope is project or local`,path:[`projectDir`]}),e.object({removed:e.number()}),e.object({projectDir:f.optional()}),e.object({plugins:e.array(Qt)}),e.object({projectDir:f}),e.object({servers:e.record(e.string(),G)}),e.object({projectDir:f,name:e.string().min(1),server:G}),e.object({added:e.boolean(),replaced:e.boolean()}),e.object({projectDir:f,name:e.string().min(1)}),e.object({removed:e.boolean()}),e.object({projectDir:f.optional(),makaioCommand:e.string().min(1),envPairs:e.array(e.string()).optional()}),e.object({scope:V,projectDir:f.optional(),makaioCommand:e.string().min(1),envPairs:e.array(e.string()).optional(),configDir:f.optional(),skipDangerousModePermissionPrompt:e.boolean().optional()}).refine(e=>e.scope===`user`||e.projectDir!==void 0,{message:`projectDir is required when scope is project or local`,path:[`projectDir`]}),e.object({scope:V,projectDir:f.optional()}).refine(e=>e.scope===`user`||e.projectDir!==void 0,{message:`projectDir is required when scope is project or local`,path:[`projectDir`]});const $t={none:0,low:4e3,medium:8e3,high:16e3,"extra-high":32e3},en=e.intersection(z,e.object({originatingMessageId:e.string().optional()})),tn=/(?:api[_-]?key|authorization|bearer|credential|password|private[_-]?key|secret|token|(?:^|[_-])key(?:$|[_-])|(?:^|[_-])pat(?:$|[_-]))/i,nn=/^(?:message|content|prompt|text|output)$/i;function rn(e){return e.length>80?`${e.slice(0,80)}... [redacted-text]`:`[redacted-text]`}function K(e){return Array.isArray(e.errors)?e.errors.flatMap(e=>Array.isArray(e)?e.flatMap(e=>K(e)):[]):[`${e.path?.map(String).join(`.`)||`(root)`}: ${e.message??`Invalid input`}`]}function q(e,t){if(e&&e!==`apiKeySource`&&tn.test(e))return`[redacted]`;if(typeof t==`string`&&(e&&nn.test(e)||t.length>80))return rn(t);if(Array.isArray(t))return t.map(e=>q(void 0,e));if(t&&typeof t==`object`){let e={};for(let[n,r]of Object.entries(t))e[n]=q(n,r);return e}return t}function an(e){let t=q(void 0,e);return t&&typeof t==`object`&&!Array.isArray(t)?t:void 0}function on(e){let t={subject:e.subject,issues:e.issues.flatMap(e=>K(e)),sample:an(e.payload)};console.warn(`[BUS:VIOLATION] ${JSON.stringify(t)}`)}function J(e,t){return re(e,{"sdk.event":en,can_use_tool:ne,system:F,assistant:j,user:I,result:N,stream_event:P,"turn.state_changed":R,"turn.turn_started":R,"turn.step_started":R,"turn.step_finished":R,"turn.turn_finished":R,"turn.paused":R},t??{busValidationMode:`lenient`,onSchemaViolation:on})}function Y(e){try{return new TextDecoder().decode(Uint8Array.from(atob(e),e=>e.charCodeAt(0)))}catch{return``}}const X=[`image/jpeg`,`image/png`,`image/gif`,`image/webp`];function sn(e,t,n){return e!==void 0&&t.includes(e)?e:n}function Z(e,t){return e.type===`base64`?{type:`image`,source:{type:`base64`,data:e.data,media_type:sn(t??u(e.mimeType),X,`image/jpeg`)}}:{type:`image`,source:{type:`url`,url:e.url}}}function Q(e){return{type:`text`,data:e,media_type:`text/plain`}}function cn(e){return e.type===`base64`?u(e.mimeType)===`text/plain`?{type:`document`,source:Q(Y(e.data))}:{type:`document`,source:{type:`base64`,data:e.data,media_type:`application/pdf`}}:{type:`document`,source:{type:`url`,url:e.url}}}function ln(e){let{source:t}=e;if(t.type===`base64`){let e=u(t.mimeType);if(X.includes(e))return Z(t,e);if(e===`application/pdf`)return{type:`document`,source:{type:`base64`,data:t.data,media_type:`application/pdf`}};if(se(e))return{type:`document`,source:Q(Y(t.data))}}return{type:`text`,text:d(e)}}function $(e){return e.map(e=>{switch(e.type){case`text`:return{type:`text`,text:e.content};case`image`:{let t=e.source.type===`base64`?u(e.source.mimeType):void 0;return Z(e.source,t)}case`document`:return cn(e.source);case`attachment`:return ln(e);default:return{type:`text`,text:d(e)}}})}const un=250;function dn(e){if(e.type!==`assistant`)return``;let t=e.message.content;return typeof t==`string`?t:Array.isArray(t)?t.filter(e=>typeof e==`object`&&!!e&&`type`in e&&e.type===`text`&&`text`in e).map(e=>e.text).join(``):``}function fn(e,o,s){let c=typeof o==`string`?o:``;switch(e){case`rate_limit_error`:return new a(c||`Rate limit exceeded`);case`authentication_error`:case`permission_error`:return new t(c||`Authentication failed`);case`overloaded_error`:return new i(c||`Service overloaded`);case`not_found_error`:{let e=typeof s==`string`?s.match(/model: ([^"]*)/)?.[1]:null;return e?new n(e):new r(c||`Model not found`)}default:return null}}function pn(e){return e.subtype!==`success`&&e.errors&&e.errors.length>0?e.errors.join(`
|
|
3
|
-
`):e.subtype===`success`&&e.is_error&&e.result?e.result:e.subtype}function
|
|
1
|
+
import{z as e}from"zod";import{DeferredPromise as t}from"@makaio/framework/utils";import{AuthenticationError as n,InvalidModelError as r,ModelUnavailableError as i,QuotaExceededError as a,RateLimitError as o}from"@makaio/framework/core";import{AgentSubjects as s,JsonValueSchema as c,createClientDefinition as ee}from"@makaio/framework/contracts";import{AIAgent as te,BaseConnectorTurn as ne,ScopedToolApprovalSchema as re,createAdapterNamespace as ie,createToolApprovalHandler as ae,defineDiscriminatedHandlers as oe,formatContextBlockAsText as se,isTextLikeMimeType as ce,mergeScopedToolApproval as l,normalizeMimeType as u,processDiscriminatedItems as le,serializeBlockToText as d}from"@makaio/framework/adapters";import{AbsolutePathSchema as f}from"@makaio/framework/clients";function p(e,t){return l(e,t,`claude-shared`)}function ue(e){return e.action===`allow`?{behavior:`allow`,updatedInput:e.updatedInput,updatedPermissions:e.updatedPermissions}:{behavior:`deny`,message:e.message,interrupt:e.shouldAbort??!1}}function m(e,t,n,r){return ae(t.can_use_tool,p,e=>e)(e,n,r)}async function de(e,t,n,r={}){let i=l(t,n??{},`claude-shared`,{allowPayloadSessionFallback:r.allowPayloadSessionFallback??!1,allowPayloadIdentityFallback:r.allowPayloadIdentityFallback??!1});return e.request(s.toolApprove,i)}const h=oe(`type`,{text:(e,t)=>t(s.message,{content:e.text}),thinking:(e,t)=>t(s.reasoning,{content:e.thinking}),tool_use:(e,t)=>t(s.tool.use,{toolName:e.name,args:e.input,toolCallId:e.id}),server_tool_use:(e,t)=>t(s.tool.started,{toolName:e.name,toolCallId:e.id}),web_search_tool_result:(e,t)=>{let n=!Array.isArray(e.content);return t(s.tool.completed,{toolName:`web_search`,result:e.content,success:!n,toolCallId:e.tool_use_id})},code_execution_tool_result:(e,t)=>{let n=e.content,r=n.type===`code_execution_result`&&n.return_code===0;return t(s.tool.completed,{toolName:`code_execution`,result:n,success:r,toolCallId:e.tool_use_id})},redacted_thinking:(e,t)=>{},mcp_tool_use:(e,t)=>{},mcp_tool_result:(e,t)=>{},container_upload:(e,t)=>{}});function fe(e,t){return{provider:`anthropic`,granularity:`query-aggregate`,inputTokens:e.input_tokens,inputCachedTokens:e.cache_read_input_tokens??0,cacheWriteTokens:e.cache_creation_input_tokens,outputTokens:e.output_tokens,reasoningTokens:0,totalTokens:e.input_tokens+(e.cache_read_input_tokens??0)+e.output_tokens,costUnits:1,costUnitType:`requests`,...t===void 0?{}:{cost:t,costProvenance:`provider-reported`},serviceTier:e.service_tier}}function pe(e){return e.input_tokens+(e.cache_creation_input_tokens??0)+(e.cache_read_input_tokens??0)+e.output_tokens}async function me(e){let{messageId:t}=e;if(t===void 0)return;let n=e.payload.message?.content,r=Array.isArray(n)?n:n?[n]:[];for(let n of r){if(!he(n))continue;let r=n.tool_use_id,i=ge(e.payload.tool_use_result),a=await e.resolveToolOutput(t,i,r);await e.emitToolCompleted({messageId:t,toolName:a.toolName,args:a.args,result:{content:n.content??{}},success:!n.is_error,toolCallId:a.toolCallId}),await e.emitToolStepFinished({blockIndex:e.consumeToolBlockIndex(r),toolCallId:a.toolCallId,output:i,isError:n.is_error??!1})}}function he(e){return typeof e==`object`&&!!e&&e.type===`tool_result`}function ge(e){return typeof e==`string`?e:[e?.stdout,e?.stderr].filter(Boolean).join(`
|
|
2
|
+
`)}function _e(e){return e.type!==`tool_use`||!e.id||!e.name?null:{toolCallId:e.id,toolName:e.name}}var ve=class extends te{supportsNativeResume(){return!0}supportsNativeFork(){return!0}currentStepType=`text`;currentTextContent=``;currentReasoningContent=``;currentToolCall=null;toolBlockIndexMap=new Map;currentToolArgsJson=``;wireEvents(e){let t=e;this.wireConnectorEvents(t),this.wireToolApprovalRpc(e)}subscribeClaudeConnector(e,t,n,r){this.addConnectorWiringCleanup(e.on(t,n,r))}wireConnectorEvents(e){let t=this.getSubjects();this.subscribeClaudeConnector(e,t.sdk.event,async e=>{let t=e.payload,n=t.originatingMessageId;switch(t.type){case`system`:t.subtype===`init`&&await this.emitStart();break;case`assistant`:{let e=t.message?.content;if(!e)break;await le(e,h,async(e,t)=>{if(e.subject===`tool.use`){if(n===void 0)return;let e=t;await this.emitToolUse(n,e.toolName,e.args,e.toolCallId)}else if(e.subject===`tool.started`||e.subject===`tool.completed`){if(n===void 0)return;await this.emitGlobal(e,{...t,messageId:n})}else await this.emitGlobal(e,t)});break}case`stream_event`:{let e=t.event;e.type===`content_block_start`?await this.handleContentBlockStart(e,n):e.type===`content_block_stop`?await this.handleContentBlockStop(e):e.type===`content_block_delta`&&await this.handleContentBlockDelta(e);break}case`result`:await this.handleResultEvent(t);break;case`user`:await this.handleUserEvent(t,n);break}})}async handleContentBlockStart(e,t){let n=e.content_block,r=_e(n),i=n.type===`thinking`?`reasoning`:n.type===`tool_use`?`tool_use`:`text`;this.currentStepType=i,this.currentTextContent=``,this.currentReasoningContent=``,this.currentToolArgsJson=``,this.currentToolCall=null;let a=r?{type:`tool_use`,toolName:r.toolName,toolCallId:r.toolCallId}:n.type===`tool_use`?void 0:{type:i},o;if(r&&(this.currentToolCall={toolCallId:r.toolCallId,name:r.toolName,args:{}},this.toolBlockIndexMap.set(r.toolCallId,e.index),o={type:`tool_call`,toolCallId:r.toolCallId,name:r.toolName,args:{}}),n.type===`tool_use`&&!r&&console.warn(`[ClaudeCodeAdapter] Received tool_use block without id or name; skipping tool correlation setup`),r&&t===void 0){console.warn(`[ClaudeCodeAdapter] Received tool_use block without originating message identity; skipping tool events`);return}await this.emitGlobal(s.step.started,{...t!==void 0&&{messageId:t},stepType:i,blockIndex:e.index,blockData:a,content:o}),r&&await this.emitGlobal(s.tool.started,{...t!==void 0&&{messageId:t},toolName:r.toolName,toolCallId:r.toolCallId})}async handleContentBlockStop(e){if(this.currentStepType!==`tool_use`){let t=this.currentStepType===`text`?{type:`text`,content:this.currentTextContent}:{type:`reasoning`,content:this.currentReasoningContent};await this.emitGlobal(s.step.finished,{stepType:this.currentStepType,blockIndex:e.index,content:t})}else if(this.currentToolCall&&this.currentToolArgsJson)try{this.currentToolCall.args=JSON.parse(this.currentToolArgsJson)}catch{}}async handleContentBlockDelta(e){let t=e.delta;switch(t.type){case`text_delta`:this.currentTextContent+=t.text,await this.emitGlobal(s.message_delta,{text:t.text});break;case`thinking_delta`:this.currentReasoningContent+=t.thinking,await this.emitGlobal(s.reasoning_delta,{content:t.thinking});break;case`input_json_delta`:`partial_json`in t&&(this.currentToolArgsJson+=t.partial_json);break}}async handleResultEvent(e){if(e.usage){let t=e.usage;await this.trackUsage(fe(t,e.total_cost_usd)),await this.emitContextWindowUpdate({currentTokens:pe(t),maxTokens:this.getContextWindowSize()??2e5,cachedTokens:t.cache_read_input_tokens})}}async handleUserEvent(e,t){await me({messageId:t,payload:e,resolveToolOutput:async(e,t,n)=>await this.emitToolOutput(e,t,{nativeId:n}),emitToolCompleted:async e=>await this.emitGlobal(s.tool.completed,e),emitToolStepFinished:async e=>await this.emitGlobal(s.step.finished,{stepType:`tool_use`,blockIndex:e.blockIndex,content:{type:`tool_output`,toolCallId:e.toolCallId,output:e.output,isError:e.isError}}),consumeToolBlockIndex:e=>this.consumeToolBlockIndex(e)})}consumeToolBlockIndex(e){if(e===void 0)return-1;let t=this.toolBlockIndexMap.get(e);return this.toolBlockIndexMap.delete(e),t===void 0&&console.warn(`[ClaudeCodeAdapter] toolCallId ${e} not found in toolBlockIndexMap - possible state mismatch`),t??-1}wireToolApprovalRpc(e){this.addConnectorWiringCleanup(m(e,this.getSubjects(),async()=>({adapterId:this.adapterId,adapterName:this.adapterName,agentId:this.agentId,adapterSessionId:await this.getAdapterSessionId(),sessionId:this.sessionId}),this.globalBus))}},ye=class{queue=[];resolvers=[];done=!1;async*[Symbol.asyncIterator](){for(;;)if(this.queue.length>0)yield this.queue.shift();else if(this.done)return;else yield await new Promise(e=>{this.resolvers.push(t=>{t.done||e(t.value)})})}push(e){if(this.done)throw Error(`Cannot push to completed source`);this.resolvers.length>0?this.resolvers.shift()({value:e,done:!1}):this.queue.push(e)}complete(){this.done=!0;for(let e of this.resolvers)e({value:void 0,done:!0});this.resolvers=[]}clear(){this.queue=[]}},be=class extends ne{queryInstance;activeMessageHandle;pausedDeferred;isPausedFlag=!1;connectorBus;subjects;agentId;expectingInterruptResult=!1;constructor(e,t,n,r,i,a,o){super(e,n,r,`idle`),this.connectorBus=e,this.subjects=t,this.agentId=i,this.queryInstance=a,this.activeMessageHandle=o}setActiveMessageHandle(e){this.activeMessageHandle=e}async emitStateChange(e,t){let n={adapterId:this.adapterId,agentId:this.agentId,oldState:e,newState:t,timestamp:Date.now()};switch(await this.connectorBus.emit(this.subjects.turn.state_changed,n),t){case`turn_started`:await this.connectorBus.emit(this.subjects.turn.turn_started,n);break;case`step_started`:await this.connectorBus.emit(this.subjects.turn.step_started,n);break;case`step_finished`:await this.connectorBus.emit(this.subjects.turn.step_finished,n);break;case`turn_finished`:await this.connectorBus.emit(this.subjects.turn.turn_finished,n);break;case`paused`:await this.connectorBus.emit(this.subjects.turn.paused,n);break}}async start(){await this.transitionTo(`turn_started`)}async pause(){if(this.state===`turn_finished`)return{stateBeforePause:this.state,turnEnded:!0};if(this.isPausedFlag)return{stateBeforePause:this.state,turnEnded:!1};if(this.state!==`step_finished`&&(await this.waitForStepFinished(),this.getState()===`turn_finished`)||(await this.queryInstance.interrupt(),this.getState()===`turn_finished`))return{stateBeforePause:this.state,turnEnded:!0};this.expectingInterruptResult=!0,this.isPausedFlag=!0;let e=this.state;return await this.transitionTo(`paused`),{stateBeforePause:e,turnEnded:!1}}async resume(e){if(!this.isPausedFlag)throw Error(`Cannot resume - turn not paused`);this.isPausedFlag=!1,await this.transitionTo(`step_started`)}isPaused(){return this.isPausedFlag}async handleSdkEvent(e){if(e.type===`stream_event`)e.event.type===`content_block_start`?await this.transitionTo(`step_started`):e.event.type===`content_block_stop`&&(await this.transitionTo(`step_finished`),this.pausedDeferred?.resolve());else if(e.type===`result`){if(this.expectingInterruptResult){this.expectingInterruptResult=!1;return}await this.transitionTo(`turn_finished`)}}isExpectingInterruptResult(){return this.expectingInterruptResult}async finishOnError(){this.pausedDeferred?.resolve(),this.pausedDeferred=void 0,this.isPausedFlag=!1,this.expectingInterruptResult=!1,this.state!==`turn_finished`&&await this.transitionTo(`turn_finished`)}async waitForStepFinished(){if(this.state!==`step_finished`){this.pausedDeferred=new t;try{await this.pausedDeferred.getPromise()}finally{this.pausedDeferred=void 0}}}isCompleted(){return this.state===`turn_finished`}canAcceptImmediate(){return this.state!==`turn_finished`&&!this.isPausedFlag}};const g=Object.freeze({approve:`claude-code.tool-response.approve`,deny:`claude-code.tool-response.deny`});ee({id:`claude-code`,name:`Claude Code`,version:`0.1.0`,description:`Anthropic Claude Code CLI — an agentic coding assistant`,binary:{name:`claude`,supportedVersions:`^2.1.0`},managedInstall:{type:`signed-binary-bucket`,version:`2.1.219`,config:{baseUrl:`https://downloads.claude.ai/claude-code-releases`,manifestPathTemplate:`{version}/manifest.json`,manifestSignaturePathTemplate:`{version}/manifest.json.sig`,publicKeyUrl:`https://downloads.claude.ai/keys/claude-code.asc`,publicKeyFingerprint:`31DD DE24 DDFA B679 F42D 7BD2 BAA9 29FF 1A7E CACE`,binaryPathTemplate:`{version}/{platform}/{binary}`,platforms:{"darwin-arm64":`darwin-arm64`,"darwin-x64":`darwin-x64`,"linux-arm64":`linux-arm64`,"linux-x64":`linux-x64`,"linux-arm64-musl":`linux-arm64-musl`,"linux-x64-musl":`linux-x64-musl`,"win32-arm64":`win32-arm64`,"win32-x64":`win32-x64`}}},versionCommand:{executable:{default:`claude`,win32:`claude.exe`},args:[`--version`]},configIsolation:{envVar:`CLAUDE_CONFIG_DIR`,defaultPath:`~/.claude`},nativeTools:[{name:`bash`,friendlyName:`Terminal`,description:`Execute shell commands`,category:`System`,capabilities:[{tag:`shell.execute`},{tag:`file.read`},{tag:`file.write`},{tag:`file.delete`},{tag:`network.request`},{tag:`process.manage`}]},{name:`text_editor`,friendlyName:`Text Editor`,description:`View and edit files`,category:`Files`,capabilities:[{tag:`file.read`},{tag:`file.write`}]},{name:`list_directory`,friendlyName:`List Directory`,description:`List directory contents`,category:`Files`,capabilities:[{tag:`file.read`},{tag:`search.files`}]},{name:`read_file`,friendlyName:`Read File`,description:`Read file contents`,category:`Files`,capabilities:[{tag:`file.read`}]},{name:`write_file`,friendlyName:`Write File`,description:`Write content to a file`,category:`Files`,capabilities:[{tag:`file.write`}]}],defaultApprovalPolicy:`full-access`,authMethods:[{id:`native`,mode:`inferred`,label:`Native account`},{id:`oauth-token`,mode:`explicit`,label:`OAuth token`,fields:[{id:`oauthToken`,label:`OAuth token`,required:!0,secret:!0,sourceHints:[{kind:`environment`,variable:`CLAUDE_CODE_OAUTH_TOKEN`}]}]}],defaultAuth:{providerDefinitionId:`anthropic-oauth`,methodId:`native`},runtimeCapabilities:{supportsHooks:!0,supportsStatusline:!0,supportsSupervisorLaunch:!1,supportsManagedBinary:!0,hookEvents:[{name:`SessionStart`,frameworkSubject:`client.session.started`,responseCapabilities:[`context.append`]},{name:`UserPromptSubmit`,frameworkSubject:`client.session.userPrompt.submitted`},{name:`PreToolUse`,frameworkSubject:`client.session.tool.pre`,responseCapabilities:[g.approve,g.deny,`context.append`]},{name:`PostToolUse`,frameworkSubject:`client.session.tool.post`},{name:`Stop`,frameworkSubject:`client.session.turn.completed`},{name:`SubagentStop`},{name:`Notification`},{name:`MCPServerStart`},{name:`MCPServerStop`}]}});const _=e.object({uuid:e.string(),session_id:e.string(),type:e.string(),correlation_id:e.string().optional(),agentId:e.string().optional(),timestamp:e.string().optional(),cwd:e.string().optional()}),v=_.extend({parent_tool_use_id:e.string().nullable().optional()});_.required({agentId:!0}).extend({parent_tool_use_id:e.string().nullable().optional()});const y=e.enum([`invalid_tool_input`,`unavailable`,`too_many_requests`,`execution_time_exceeded`]),b=e.object({web_search_requests:e.number()}),xe=e.object({ephemeral_1h_input_tokens:e.number(),ephemeral_5m_input_tokens:e.number()}),x=e.object({cache_creation:xe.nullable().optional(),cache_creation_input_tokens:e.number().nullable().optional(),cache_read_input_tokens:e.number().nullable().optional(),input_tokens:e.number(),output_tokens:e.number(),server_tool_use:b.nullable().optional(),service_tier:e.enum([`standard`,`priority`,`batch`]).nullable().optional()});e.object({cache_creation_input_tokens:e.number().nullable().optional(),cache_read_input_tokens:e.number().nullable().optional(),input_tokens:e.number().nullable().optional(),output_tokens:e.number(),server_tool_use:b.nullable().optional()});const S=e.object({type:e.literal(`ephemeral`),ttl:e.enum([`5m`,`1h`]).optional()}),Se=e.object({data:e.string(),media_type:e.enum([`image/jpeg`,`image/png`,`image/gif`,`image/webp`]),type:e.literal(`base64`)}),Ce=e.object({type:e.literal(`url`),url:e.string()}),we=e.object({file_id:e.string(),type:e.literal(`file`)}),Te=e.discriminatedUnion(`type`,[Se,Ce,we]),Ee=e.object({data:e.string(),media_type:e.literal(`application/pdf`),type:e.literal(`base64`)}),De=e.object({type:e.literal(`url`),url:e.string()}),Oe=e.object({file_id:e.string(),type:e.literal(`file`)}),ke=e.object({data:e.string(),media_type:e.literal(`text/plain`),type:e.literal(`text`)}),Ae=e.object({cited_text:e.string(),document_index:e.number(),document_title:e.string().nullable(),end_char_index:e.number(),file_id:e.string().nullable().optional(),start_char_index:e.number(),type:e.literal(`char_location`)}),je=e.object({cited_text:e.string(),document_index:e.number(),document_title:e.string().nullable(),end_char_index:e.number(),start_char_index:e.number(),type:e.literal(`char_location`)}),Me=e.object({cited_text:e.string(),document_index:e.number(),document_title:e.string().nullable(),end_page_number:e.number(),file_id:e.string().nullable().optional(),start_page_number:e.number(),type:e.literal(`page_location`)}),Ne=e.object({cited_text:e.string(),document_index:e.number(),document_title:e.string().nullable(),end_page_number:e.number(),start_page_number:e.number(),type:e.literal(`page_location`)}),Pe=e.object({cited_text:e.string(),document_index:e.number(),document_title:e.string().nullable(),end_block_index:e.number(),file_id:e.string().nullable().optional(),start_block_index:e.number(),type:e.literal(`content_block_location`)}),Fe=e.object({cited_text:e.string(),document_index:e.number(),document_title:e.string().nullable(),end_block_index:e.number(),start_block_index:e.number(),type:e.literal(`content_block_location`)}),Ie=e.object({cited_text:e.string(),encrypted_index:e.string(),title:e.string().nullable().optional(),type:e.literal(`web_search_result_location`),url:e.string()}),Le=e.object({cited_text:e.string(),encrypted_index:e.string(),title:e.string().nullable().optional(),type:e.literal(`web_search_result_location`),url:e.string()}),Re=e.object({cited_text:e.string(),end_block_index:e.number(),search_result_index:e.number(),source:e.string(),start_block_index:e.number(),title:e.string().nullable().optional(),type:e.literal(`search_result_location`)}),ze=e.object({cited_text:e.string(),end_block_index:e.number(),search_result_index:e.number(),source:e.string(),start_block_index:e.number(),title:e.string().nullable().optional(),type:e.literal(`search_result_location`)}),C=e.discriminatedUnion(`type`,[Ae,Me,Pe,Ie,Re]),Be=e.discriminatedUnion(`type`,[je,Ne,Fe,Le,ze]);e.object({citation:C,type:e.literal(`citations_delta`)});const w=e.object({enabled:e.boolean().optional()}),Ve=e.object({id:e.string(),expires_at:e.string()}),He=e.enum([`end_turn`,`max_tokens`,`stop_sequence`,`tool_use`,`pause_turn`,`refusal`]),T=e.object({text:e.string(),type:e.literal(`text`),cache_control:S.nullable().optional(),citations:e.array(Be).nullable().optional()}),E=e.object({source:Te,type:e.literal(`image`),cache_control:S.nullable().optional()}),Ue=e.object({content:e.union([e.string(),e.array(e.union([T,E]))]),type:e.literal(`content`)}),We=e.object({source:e.union([Ee,ke,Ue,De,Oe]),type:e.literal(`document`),cache_control:S.nullable().optional(),citations:w.optional(),context:e.string().nullable().optional(),title:e.string().nullable().optional()}),D=e.object({content:e.array(T),source:e.string(),title:e.string(),type:e.literal(`search_result`),cache_control:S.nullable().optional(),citations:w.optional()}),O=e.object({citations:e.array(C).nullable().optional(),text:e.string(),type:e.literal(`text`)}),k=e.object({signature:e.string(),thinking:e.string(),type:e.literal(`thinking`)}),Ge=e.object({data:e.string(),type:e.literal(`redacted_thinking`)}),Ke=e.object({id:e.string(),input:e.looseObject({}),name:e.string(),type:e.literal(`tool_use`)}),qe=e.object({id:e.string(),input:e.looseObject({}),name:e.enum([`web_search`,`code_execution`]),type:e.literal(`server_tool_use`)}),Je=e.object({encrypted_content:e.string(),page_age:e.string().nullable().optional(),title:e.string(),type:e.literal(`web_search_result`),url:e.string()}),Ye=e.enum([`invalid_tool_input`,`unavailable`,`max_uses_exceeded`,`too_many_requests`,`query_too_long`]),Xe=e.object({error_code:Ye,type:e.literal(`web_search_tool_result_error`)}),Ze=e.union([Xe,e.array(Je)]),Qe=e.object({content:Ze,tool_use_id:e.string(),type:e.literal(`web_search_tool_result`)}),$e=e.object({file_id:e.string(),type:e.literal(`code_execution_output`)}),et=e.object({content:e.array($e),return_code:e.number(),stderr:e.string(),stdout:e.string(),type:e.literal(`code_execution_result`)}),tt=e.object({error_code:y,type:e.literal(`code_execution_tool_result_error`)}),nt=e.union([tt,et]),rt=e.object({content:nt,tool_use_id:e.string(),type:e.literal(`code_execution_tool_result`)}),it=e.object({id:e.string(),input:e.looseObject({}),name:e.string(),server_name:e.string(),type:e.literal(`mcp_tool_use`)}),at=e.object({content:e.union([e.string(),e.array(O)]),is_error:e.boolean(),tool_use_id:e.string(),type:e.literal(`mcp_tool_result`)}),ot=e.object({file_id:e.string(),type:e.literal(`container_upload`)}),A=e.discriminatedUnion(`type`,[O,k,Ge,Ke,qe,Qe,rt,it,at,ot]),st=k.extend({}),ct=e.object({data:e.string(),type:e.literal(`redacted_thinking`)}),lt=e.object({id:e.string(),input:e.record(e.string(),e.unknown()),name:e.string(),type:e.literal(`tool_use`),cache_control:S.nullable().optional()}),ut=e.object({tool_use_id:e.string(),type:e.literal(`tool_result`),cache_control:S.nullable().optional(),content:e.union([e.string(),e.array(e.union([T,E,D]))]).optional(),is_error:e.boolean().optional()}),dt=e.object({id:e.string(),input:e.record(e.string(),e.unknown()),name:e.enum([`web_search`,`code_execution`]),type:e.literal(`server_tool_use`),cache_control:S.nullable().optional()}),ft=e.object({encrypted_content:e.string(),title:e.string(),type:e.literal(`web_search_result`),url:e.string(),page_age:e.string().nullable().optional()}),pt=e.object({error_code:e.enum([`invalid_tool_input`,`unavailable`,`max_uses_exceeded`,`too_many_requests`,`query_too_long`]),type:e.literal(`web_search_tool_result_error`)}),mt=e.union([e.array(ft),pt]),ht=e.object({content:mt,tool_use_id:e.string(),type:e.literal(`web_search_tool_result`),cache_control:S.nullable().optional()}),gt=e.object({file_id:e.string(),type:e.literal(`code_execution_output`)}),_t=e.object({content:e.array(gt),return_code:e.number(),stderr:e.string(),stdout:e.string(),type:e.literal(`code_execution_result`)}),vt=e.object({error_code:y,type:e.literal(`code_execution_tool_result_error`)}),yt=e.union([vt,_t]),bt=e.object({content:yt,tool_use_id:e.string(),type:e.literal(`code_execution_tool_result`),cache_control:S.nullable().optional()}),xt=e.object({id:e.string(),input:e.record(e.string(),e.unknown()),name:e.string(),server_name:e.string(),type:e.literal(`mcp_tool_use`),cache_control:S.nullable().optional()}),St=e.object({tool_use_id:e.string(),type:e.literal(`mcp_tool_result`),cache_control:S.nullable().optional(),content:e.union([e.string(),e.array(T)]).optional(),is_error:e.boolean().optional()}),Ct=e.object({file_id:e.string(),type:e.literal(`container_upload`),cache_control:S.nullable().optional()}),j=e.discriminatedUnion(`type`,[T,E,We,D,st,ct,lt,ut,dt,ht,bt,xt,St,Ct]),wt=e.object({id:e.string(),type:e.literal(`message`),role:e.literal(`assistant`),model:e.string(),content:e.array(A),stop_reason:He.nullable().optional(),stop_sequence:e.string().nullable().optional(),usage:x,container:Ve.nullable().optional()}),M=v.extend({type:e.literal(`assistant`),message:wt}),Tt=e.object({role:e.enum([`user`,`assistant`]),content:e.union([e.string(),e.array(j)])}),Et=x.extend({cache_creation:x.shape.cache_creation.unwrap(),cache_creation_input_tokens:e.number(),cache_read_input_tokens:e.number(),server_tool_use:x.shape.server_tool_use.unwrap(),service_tier:e.enum([`standard`,`priority`,`batch`])}),Dt=e.object({inputTokens:e.number(),outputTokens:e.number(),cacheReadInputTokens:e.number(),cacheCreationInputTokens:e.number(),webSearchRequests:e.number(),costUSD:e.number(),contextWindow:e.number()}),Ot=e.object({tool_name:e.string(),tool_use_id:e.string(),tool_input:e.unknown()}),N=_.extend({type:e.literal(`result`),duration_ms:e.number(),duration_api_ms:e.number(),is_error:e.boolean(),num_turns:e.number(),total_cost_usd:e.number(),usage:Et,modelUsage:e.record(e.string(),Dt),permission_denials:e.array(Ot)}),kt=N.extend({subtype:e.literal(`success`),result:e.string(),structured_output:c.optional()}),At=N.extend({subtype:e.enum([`error_during_execution`,`error_max_turns`,`error_max_budget_usd`,`error_max_structured_output_retries`]),errors:e.array(e.string()),stop_reason:e.string().nullable()}),P=e.discriminatedUnion(`subtype`,[kt,At]),jt=e.object({type:e.literal(`message_start`),message:e.object({id:e.string(),type:e.literal(`message`),role:e.literal(`assistant`)})}),Mt=e.object({type:e.literal(`message_delta`),delta:e.object({stop_reason:e.string().nullable().optional(),stop_sequence:e.string().nullable().optional(),container:e.object({id:e.string(),expires_at:e.string()}).nullable().optional()}),usage:x}),Nt=e.object({type:e.literal(`message_stop`)}),Pt=e.object({type:e.literal(`content_block_start`),index:e.number(),content_block:A}),Ft=e.object({type:e.literal(`content_block_delta`),index:e.number(),delta:e.discriminatedUnion(`type`,[e.object({type:e.literal(`text_delta`),text:e.string()}),e.object({type:e.literal(`thinking_delta`),thinking:e.string()}),e.object({type:e.literal(`input_json_delta`),partial_json:e.string()}),e.object({type:e.literal(`citations_delta`),citation:C}),e.object({type:e.literal(`signature_delta`),signature:e.string()})])}),It=e.object({type:e.literal(`content_block_stop`),index:e.number()}),Lt=e.discriminatedUnion(`type`,[jt,Mt,Nt,Pt,Ft,It]),F=v.extend({type:e.literal(`stream_event`),event:Lt}),Rt=[`init`,`compact_boundary`],zt=e.enum([`user`,`project`,`org`,`temporary`,`none`]),Bt=e.enum([`default`,`acceptEdits`,`bypassPermissions`,`plan`]),Vt=e.object({name:e.string(),status:e.string()}),Ht=e.object({trigger:e.enum([`manual`,`auto`]),pre_tokens:e.number()}),Ut=_.extend({type:e.literal(`system`),subtype:e.literal(`init`),agents:e.array(e.string()).optional(),apiKeySource:zt,cwd:e.string(),tools:e.array(e.string()),mcp_servers:e.array(Vt),model:e.string(),permissionMode:Bt,slash_commands:e.array(e.string()),output_style:e.string()}),Wt=_.extend({type:e.literal(`system`),subtype:e.literal(`compact_boundary`),compact_metadata:Ht}),Gt=e.discriminatedUnion(`subtype`,[Ut,Wt]),Kt=_.extend({type:e.literal(`system`),subtype:e.string().refine(e=>!Rt.some(t=>t===e))}).passthrough(),I=e.union([Gt,Kt]),L=v.extend({type:e.literal(`user`),message:Tt,isSynthetic:e.boolean().optional(),isCompactSummary:e.boolean().optional(),tool_use_result:e.object({stdout:e.string().optional(),stderr:e.string().optional(),interrupted:e.boolean().optional(),isImage:e.boolean().optional()}).or(e.string()).optional()}).refine(e=>!e.isCompactSummary||e.isSynthetic===!0,{message:`Compact summary messages must be synthetic`,path:[`isCompactSummary`]}),R=e.enum([`idle`,`turn_started`,`step_started`,`step_finished`,`turn_finished`,`paused`]),z=e.object({adapterId:e.string(),agentId:e.string(),oldState:R,newState:R,timestamp:e.number()}),qt=e.object({status:e.enum([`allowed`,`allowed_warning`,`rejected`]),resetsAt:e.number().optional(),rateLimitType:e.enum([`five_hour`,`seven_day`,`seven_day_opus`,`seven_day_sonnet`,`overage`]).optional(),utilization:e.number().optional(),overageStatus:e.enum([`allowed`,`allowed_warning`,`rejected`]).optional(),overageResetsAt:e.number().optional(),overageDisabledReason:e.enum([`overage_not_provisioned`,`org_level_disabled`,`org_level_disabled_until`,`out_of_credits`,`seat_tier_level_disabled`,`member_level_disabled`,`seat_tier_zero_credit_limit`,`group_zero_credit_limit`,`member_zero_credit_limit`,`org_service_level_disabled`,`no_limits_configured`,`fetch_error`,`unknown`]).optional(),isUsingOverage:e.boolean().optional(),surpassedThreshold:e.number().optional()}),Jt=_.extend({type:e.literal(`rate_limit_event`),rate_limit_info:qt}),Yt=_.extend({type:e.literal(`command_lifecycle`),subtype:e.string(),command_uuid:e.string().optional()}).passthrough(),B=e.union([I,M,L,P,F,Jt,Yt]);e.intersection(B,e.object({agentId:e.string()}));const V=e.object({used_percentage:e.number().optional(),resets_at:e.number().optional()}).passthrough(),Xt=e.object({five_hour:V.optional(),seven_day:V.optional()}).passthrough(),Zt=e.object({input_tokens:e.number().optional(),output_tokens:e.number().optional(),cache_creation_input_tokens:e.number().optional(),cache_read_input_tokens:e.number().optional()}).passthrough();e.object({cwd:e.string().optional(),session_id:e.string().optional(),session_name:e.string().optional(),transcript_path:e.string().optional(),model:e.object({id:e.string().optional(),display_name:e.string().optional(),family:e.string().optional()}).passthrough().optional(),workspace:e.object({current_dir:e.string().optional(),project_dir:e.string().optional(),added_dirs:e.array(e.string()).optional(),git_worktree:e.string().optional()}).passthrough().optional(),version:e.string().optional(),output_style:e.object({name:e.string().optional(),variant:e.string().optional()}).passthrough().optional(),cost:e.object({total_cost_usd:e.number().optional(),total_duration_ms:e.number().optional(),total_api_duration_ms:e.number().optional(),total_lines_added:e.number().optional(),total_lines_removed:e.number().optional(),total_edits:e.number().optional()}).passthrough().optional(),context_window:e.object({total_input_tokens:e.number().optional(),total_output_tokens:e.number().optional(),context_window_size:e.number().optional(),used_percentage:e.number().nullable().optional(),remaining_percentage:e.number().nullable().optional(),current_usage:Zt.nullable().optional()}).passthrough().nullable().optional(),exceeds_200k_tokens:e.boolean().optional(),rate_limits:Xt.optional(),vim:e.object({mode:e.string().optional()}).passthrough().optional(),agent:e.object({name:e.string().optional(),kind:e.string().optional()}).passthrough().optional(),worktree:e.object({name:e.string().optional(),path:e.string().optional(),branch:e.string().optional(),original_cwd:e.string().optional(),original_branch:e.string().optional(),provider:e.string().optional()}).passthrough().optional()}).passthrough();const H=e.enum([`user`,`project`,`local`]),U=e.object({type:e.literal(`command`),command:e.string().min(1),padding:e.number().optional()}),W=e.object({type:e.literal(`command`),command:e.string().min(1),timeout:e.number().optional()}),G=e.object({matcher:e.string().optional(),hooks:e.array(W)}),K=e.object({type:e.string().min(1),url:e.string().optional(),command:e.string().optional(),args:e.array(e.string()).optional(),env:e.record(e.string(),e.string()).optional()}).passthrough(),Qt=e.object({scope:H,path:e.string(),value:U.nullable()}),$t=e.object({scope:H,path:e.string(),events:e.record(e.string(),e.array(G))}),en=e.object({name:e.string().min(1),enabled:e.boolean(),scope:H});e.object({projectDir:f.optional()}),e.object({effective:U.nullable(),perScope:e.array(Qt)}),e.object({scope:H,projectDir:f.optional(),value:U}).refine(e=>e.scope===`user`||e.projectDir!==void 0,{message:`projectDir is required when scope is project or local`,path:[`projectDir`]}),e.object({previous:U.nullable(),applied:U}),e.object({eventName:e.string().optional(),projectDir:f.optional()}),e.object({effective:e.record(e.string(),e.array(G)),perScope:e.array($t)}),e.object({scope:H,projectDir:f.optional(),eventName:e.string().min(1),matcher:e.string().min(1).optional(),hook:W}).refine(e=>e.scope===`user`||e.projectDir!==void 0,{message:`projectDir is required when scope is project or local`,path:[`projectDir`]}),e.object({added:e.boolean()}),e.object({scope:H,projectDir:f.optional(),eventName:e.string().min(1),match:e.object({commandContains:e.string().min(1)})}).refine(e=>e.scope===`user`||e.projectDir!==void 0,{message:`projectDir is required when scope is project or local`,path:[`projectDir`]}),e.object({removed:e.number()}),e.object({projectDir:f.optional()}),e.object({plugins:e.array(en)}),e.object({projectDir:f}),e.object({servers:e.record(e.string(),K)}),e.object({projectDir:f,name:e.string().min(1),server:K}),e.object({added:e.boolean(),replaced:e.boolean()}),e.object({projectDir:f,name:e.string().min(1)}),e.object({removed:e.boolean()}),e.object({projectDir:f.optional(),makaioCommand:e.string().min(1),envPairs:e.array(e.string()).optional()}),e.object({scope:H,projectDir:f.optional(),makaioCommand:e.string().min(1),envPairs:e.array(e.string()).optional(),configDir:f.optional(),skipDangerousModePermissionPrompt:e.boolean().optional()}).refine(e=>e.scope===`user`||e.projectDir!==void 0,{message:`projectDir is required when scope is project or local`,path:[`projectDir`]}),e.object({scope:H,projectDir:f.optional()}).refine(e=>e.scope===`user`||e.projectDir!==void 0,{message:`projectDir is required when scope is project or local`,path:[`projectDir`]});const tn={none:0,low:4e3,medium:8e3,high:16e3,"extra-high":32e3},nn=e.intersection(B,e.object({originatingMessageId:e.string().optional()})),rn=/(?:api[_-]?key|authorization|bearer|credential|password|private[_-]?key|secret|token|(?:^|[_-])key(?:$|[_-])|(?:^|[_-])pat(?:$|[_-]))/i,an=/^(?:message|content|prompt|text|output)$/i;function on(e){return e.length>80?`${e.slice(0,80)}... [redacted-text]`:`[redacted-text]`}function q(e){return Array.isArray(e.errors)?e.errors.flatMap(e=>Array.isArray(e)?e.flatMap(e=>q(e)):[]):[`${e.path?.map(String).join(`.`)||`(root)`}: ${e.message??`Invalid input`}`]}function J(e,t){if(e&&e!==`apiKeySource`&&rn.test(e))return`[redacted]`;if(typeof t==`string`&&(e&&an.test(e)||t.length>80))return on(t);if(Array.isArray(t))return t.map(e=>J(void 0,e));if(t&&typeof t==`object`){let e={};for(let[n,r]of Object.entries(t))e[n]=J(n,r);return e}return t}function sn(e){let t=J(void 0,e);return t&&typeof t==`object`&&!Array.isArray(t)?t:void 0}function cn(e){let t={subject:e.subject,issues:e.issues.flatMap(e=>q(e)),sample:sn(e.payload)};console.warn(`[BUS:VIOLATION] ${JSON.stringify(t)}`)}function ln(e,t){return ie(e,{"sdk.event":nn,can_use_tool:re,system:I,assistant:M,user:L,result:P,stream_event:F,"turn.state_changed":z,"turn.turn_started":z,"turn.step_started":z,"turn.step_finished":z,"turn.turn_finished":z,"turn.paused":z},t??{busValidationMode:`lenient`,onSchemaViolation:cn})}function Y(e){try{return new TextDecoder().decode(Uint8Array.from(atob(e),e=>e.charCodeAt(0)))}catch{return``}}const X=[`image/jpeg`,`image/png`,`image/gif`,`image/webp`];function un(e,t,n){return e!==void 0&&t.includes(e)?e:n}function Z(e,t){return e.type===`base64`?{type:`image`,source:{type:`base64`,data:e.data,media_type:un(t??u(e.mimeType),X,`image/jpeg`)}}:{type:`image`,source:{type:`url`,url:e.url}}}function Q(e){return{type:`text`,data:e,media_type:`text/plain`}}function dn(e){return e.type===`base64`?u(e.mimeType)===`text/plain`?{type:`document`,source:Q(Y(e.data))}:{type:`document`,source:{type:`base64`,data:e.data,media_type:`application/pdf`}}:{type:`document`,source:{type:`url`,url:e.url}}}function fn(e){let{source:t}=e;if(t.type===`base64`){let e=u(t.mimeType);if(X.includes(e))return Z(t,e);if(e===`application/pdf`)return{type:`document`,source:{type:`base64`,data:t.data,media_type:`application/pdf`}};if(ce(e))return{type:`document`,source:Q(Y(t.data))}}return{type:`text`,text:d(e)}}function $(e){return e.map(e=>{switch(e.type){case`text`:return{type:`text`,text:e.content};case`image`:{let t=e.source.type===`base64`?u(e.source.mimeType):void 0;return Z(e.source,t)}case`document`:return dn(e.source);case`attachment`:return fn(e);default:return{type:`text`,text:d(e)}}})}const pn=250;function mn(e){if(e.type!==`assistant`)return``;let t=e.message.content;return typeof t==`string`?t:Array.isArray(t)?t.filter(e=>typeof e==`object`&&!!e&&`type`in e&&e.type===`text`&&`text`in e).map(e=>e.text).join(``):``}function hn(e,t,s){let c=typeof t==`string`?t:``;switch(e){case`rate_limit_error`:return new o(c||`Rate limit exceeded`);case`authentication_error`:case`permission_error`:return new n(c||`Authentication failed`);case`overloaded_error`:return new a(c||`Service overloaded`);case`not_found_error`:{let e=typeof s==`string`?s.match(/model: ([^"]*)/)?.[1]:null;return e?new r(e):new i(c||`Model not found`)}default:return null}}function gn(e){return e.subtype!==`success`&&e.errors&&e.errors.length>0?e.errors.join(`
|
|
3
|
+
`):e.subtype===`success`&&e.is_error&&e.result?e.result:e.subtype}function _n(e){let t=e.toLowerCase();return t.includes(`rate limit`)||t.includes(`rate_limit`)?new o(e):t.includes(`quota`)||t.includes(`overloaded`)?new a(e):t.includes(`authentication`)||t.includes(`unauthorized`)||t.includes(`permission`)?new n(e):t.includes(`model`)&&(t.includes(`not found`)||t.includes(`unavailable`))?new i(e):null}function vn(e){let t=e.subtype===`success`&&e.is_error,n=gn(e);return hn(e.subtype,n,e.result)||(t&&typeof e.result==`string`?_n(e.result)||e.result:n)}function yn(e,t,n){let r={type:`text`,text:se(t,n)},i=e.message.content,a=Array.isArray(i)?i:[{type:`text`,text:i}];return{...e,isSynthetic:!0,message:{...e.message,content:[r,...a]}}}function bn(e,t,n,r){return{uuid:e,session_id:t,agentId:n,type:`user`,parent_tool_use_id:null,isSynthetic:!1,message:{role:`user`,content:typeof r.message==`string`?r.message:$(r.blocks)}}}function xn(e){return`structured_output`in e&&e.structured_output!==void 0?JSON.stringify(e.structured_output):e.result??``}function Sn(e,t){return e}export{ye as AsyncQuerySource,h as CONTENT_BLOCK_HANDLERS,ve as ClaudeCodeAgent,be as ClaudeConnectorTurn,B as SDKMessageSchema,pn as TERMINAL_RESULT_DRAIN_TIMEOUT_MS,$ as blocksToContentBlocks,tn as claudeReasoningLevels,ln as createClaudeConnectorNamespace,Y as decodeBase64Text,mn as extractTextFromMessage,ue as fromGlobalToolApproval,vn as parseResultError,yn as prependContextBlock,m as registerToolApprovalHandler,de as requestToolApproval,xn as resolveResultMessage,bn as sdkUserMessageFromNormalized,p as toGlobalToolApproval,Sn as unwrapBlockFromMessage};
|