@makaio/framework 1.0.0-dev-1789609124644 → 1.0.0-dev-1790066089222
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 +2 -2
- package/dist/{adapter-C4v_gNTI.mjs → adapter-DSRgsh2d.mjs} +1 -1
- package/dist/adapter-subsystem/index.d.mts +15 -7
- package/dist/adapter-subsystem/index.mjs +1 -1
- package/dist/adapters/claude/index.mjs +3 -3
- package/dist/adapters/config/index.d.mts +1 -1
- package/dist/adapters/index.d.mts +2 -2
- package/dist/adapters/node.d.mts +1 -1
- package/dist/{attempt-record-codec-DaQ3WHUs.mjs → attempt-record-codec-DXpdMgyI.mjs} +1 -1
- package/dist/bus/index.d.mts +120 -8
- package/dist/bus/index.mjs +1 -1
- package/dist/bus-ceMF9rsq.mjs +9 -0
- package/dist/client-DWSwtFyI.mjs +1 -0
- package/dist/clients/index.d.mts +179 -12
- package/dist/clients/index.mjs +1 -1
- package/dist/clients/managed-install.d.mts +1 -1
- package/dist/code-execution/worker-entry.d.mts +1 -1
- package/dist/code-execution/worker-entry.mjs +1 -1
- package/dist/{code-execution-pUF4IO462.mjs → code-execution-DWSux6k1.mjs} +1 -1
- 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/auth/index.d.mts +2 -2
- package/dist/contracts/automation-trigger/index.d.mts +3 -3
- package/dist/contracts/canonical-model/index.d.mts +1 -1
- package/dist/contracts/capabilities/index.d.mts +1 -1
- package/dist/contracts/client/index.d.mts +3 -3
- package/dist/contracts/client/index.mjs +1 -1
- package/dist/contracts/code-execution/index.d.mts +1 -1
- package/dist/contracts/common/index.d.mts +1 -1
- package/dist/contracts/config/index.d.mts +2 -47
- package/dist/contracts/context-projection/index.d.mts +232 -0
- package/dist/contracts/context-projection/index.mjs +1 -0
- package/dist/contracts/extension/index.d.mts +6 -6
- package/dist/contracts/extension/index.mjs +1 -1
- package/dist/contracts/facet/index.d.mts +1 -1
- package/dist/contracts/harness/index.d.mts +1 -1
- package/dist/contracts/host/index.d.mts +1 -1
- package/dist/contracts/index.d.mts +43 -43
- package/dist/contracts/index.mjs +1 -1
- package/dist/contracts/materialization/index.d.mts +2 -2
- package/dist/contracts/model-registry/index.d.mts +1 -1
- package/dist/contracts/native-session-supervisor/index.d.mts +1 -1
- package/dist/contracts/platform/index.d.mts +1 -1
- package/dist/contracts/provider/index.d.mts +2 -2
- package/dist/contracts/reaction/index.d.mts +1 -1
- package/dist/contracts/session/index.d.mts +3 -3
- package/dist/contracts/session/index.mjs +1 -1
- package/dist/contracts/shared/index.d.mts +2 -2
- package/dist/contracts/skill/index.d.mts +1 -1
- package/dist/contracts/telemetry/index.d.mts +1 -1
- package/dist/contracts/timeout/index.d.mts +1 -1
- package/dist/contracts/variant/index.d.mts +1 -1
- package/dist/contracts/worker/index.d.mts +2 -2
- package/dist/contracts/workflow/index.d.mts +2 -2
- package/dist/{contribution-DDbHzCPF.d.mts → contribution-1GL7Rjaq.d.mts} +2 -2
- package/dist/credential-ref-w4ZYpYW0.d.mts +49 -0
- package/dist/{definition-CuaBQyde.d.mts → definition-DeIGoROj.d.mts} +1 -1
- package/dist/{descriptor-to-package-Dw8dnl5E.mjs → descriptor-to-package-BPIArq6N.mjs} +1 -1
- package/dist/{detached-extension-handle-DN3aqLyq.mjs → detached-extension-handle-W5_yfCyE.mjs} +1 -1
- package/dist/drizzle/0040_session_generation.sql +1 -0
- package/dist/drizzle/0041_session_principal_owner.sql +1 -0
- package/dist/drizzle/meta/_journal.json +14 -0
- package/dist/{execution-attempt-owner-recovery-CE_rvHKE.mjs → execution-attempt-owner-recovery-BZOEVYFH.mjs} +1 -1
- package/dist/extension-C6ANjR33.mjs +1 -0
- package/dist/{extension-context-BH31eOMv.d.mts → extension-context-pQ7Uio_s.d.mts} +44 -1
- package/dist/{extension-discovery-CA2IhDRo.d.mts → extension-discovery-Rup-gANp.d.mts} +114 -15
- package/dist/extension-kOwzAMud.mjs +1 -0
- package/dist/extension-namespace-CeRpt6C8.mjs +1 -0
- package/dist/{framework-packages-Bg4edkkM.mjs → framework-packages-U4Xhouxe.mjs} +1 -1
- package/dist/{hook-responses-Dq16X3Cb.d.mts → hook-responses-B882RcQc.d.mts} +48 -5
- package/dist/{index-Dm3d490n.d.mts → index-B2bxgKiK.d.mts} +1 -1
- package/dist/{index-7CVumCjj.d.mts → index-BTpkpHIS.d.mts} +65 -9
- package/dist/{index-Bh57xARQ.d.mts → index-BUv9gfRT.d.mts} +3 -3
- package/dist/{index-C6e9cwAl2.d.mts → index-BjQtqMxP2.d.mts} +4 -4
- package/dist/{index-B-u0Tu8X.d.mts → index-Bqi44ODz.d.mts} +37 -37
- package/dist/{index-CIzvBH8O.d.mts → index-C8two8wz.d.mts} +1 -1
- package/dist/{index-oxZt93RL.d.mts → index-CESqYf8a.d.mts} +2 -2
- package/dist/{index-C87P0WpY2.d.mts → index-CmCLAMNs.d.mts} +1 -1
- package/dist/index-CyEE1RI5.d.mts +869 -0
- package/dist/{index-De_oh9M-2.d.mts → index-D6Uq1btG.d.mts} +87 -10
- package/dist/{index-CRZ1jrxp.d.mts → index-DDSt0uS2.d.mts} +160 -12
- package/dist/{index-B6WkHnCQ.d.mts → index-DRxgmrad.d.mts} +1 -1
- package/dist/{index-U--ajOHy.d.mts → index-DUYjTfHD.d.mts} +1 -1
- package/dist/{index-HJkz7i4E.d.mts → index-DdJKsdya.d.mts} +188 -10
- package/dist/{index-B4pPwpKk.d.mts → index-DfREUyAk.d.mts} +1 -1
- package/dist/{index-ClKwF6LE.d.mts → index-Di-R1gmo.d.mts} +2 -2
- package/dist/{index-DWANFpTG.d.mts → index-Jdju2W3y.d.mts} +1 -1
- package/dist/{index-DQKVQPUS.d.mts → index-L6mssyeZ.d.mts} +1 -1
- package/dist/{index-B8v1-2-V2.d.mts → index-anIxF_eT.d.mts} +1 -1
- package/dist/{index-iVisrVdC2.d.mts → index-bYBnDBl32.d.mts} +539 -4
- package/dist/{index-Bg3WVL8n.d.mts → index-gNdH1F6r.d.mts} +531 -26
- package/dist/{index-zmDRR8gv2.d.mts → index-m5ZQFglW2.d.mts} +1 -1
- package/dist/{index-mTaFX2HH2.d.mts → index-uk8icWON2.d.mts} +419 -19
- package/dist/kernel/cli/index.d.mts +2 -2
- package/dist/kernel/cli/register.d.mts +1 -1
- package/dist/kernel/extension/index.d.mts +3 -2
- package/dist/kernel/extension/index.mjs +1 -1
- package/dist/kernel/index.d.mts +6 -6
- package/dist/kernel/index.mjs +1 -1
- package/dist/kernel/namespace/index.d.mts +1 -1
- package/dist/kernel/observability/index.d.mts +2 -2
- package/dist/kernel/observability/index.mjs +1 -1
- package/dist/kernel/providers/index.d.mts +1 -1
- package/dist/kernel/window/index.d.mts +1 -1
- package/dist/{lib-BF5XBSfw.mjs → lib-BdyGVjpO.mjs} +1 -1
- package/dist/{lib-Dljw2Cqh.mjs → lib-DxP3tPm9.mjs} +1 -1
- package/dist/load-extensions-BGfSWW_R.mjs +1 -0
- package/dist/{load-extensions-DGstT4_p.d.mts → load-extensions-Be_lOjm_.d.mts} +27 -14
- package/dist/mcp-http-server/index.mjs +1 -1
- package/dist/{namespace-BMdYJN_t.mjs → namespace-CqJhR19O.mjs} +1 -1
- package/dist/{namespace-Cmu-5_P9.d.mts → namespace-DudchWPb.d.mts} +457 -0
- package/dist/{namespace-BEbQb19g.d.mts → namespace-Eir1wQ_r.d.mts} +2 -2
- package/dist/node/bus-server/index.d.mts +1 -1
- package/dist/node/bus-server/server-lifecycle.d.mts +1 -1
- package/dist/node/transports/index.d.mts +102 -4
- package/dist/node/transports/index.mjs +2 -2
- package/dist/{orchestrator-shared-CtPB6PAr.mjs → orchestrator-shared-CF-jPH91.mjs} +1 -1
- package/dist/ownership-memory-handler-C-y9zQf8.mjs +1 -0
- package/dist/package-AlsbnlSt.mjs +159 -0
- package/dist/{package-CDj3F-L3.d.mts → package-CwyC-Krg.d.mts} +1 -1
- package/dist/{package-DYScYC0D.mjs → package-kkPGlxMm.mjs} +1 -1
- package/dist/package.json +1 -1
- package/dist/{registry-DNMjJ-Oj.mjs → registry-DtaRGU8i.mjs} +1 -0
- 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.d.mts +2 -2
- package/dist/runtime-bun/index.mjs +1 -1
- package/dist/runtime-node/boot-config.d.mts +45 -0
- package/dist/runtime-node/boot-config.mjs +1 -0
- package/dist/runtime-node/code-execution/index.d.mts +2 -2
- package/dist/runtime-node/code-execution/index.mjs +1 -1
- package/dist/runtime-node/extension-discovery.d.mts +2 -2
- package/dist/runtime-node/extension-discovery.mjs +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 +345 -27
- package/dist/runtime-node/index.mjs +21 -24
- package/dist/runtime-node/makaio-config.d.mts +1 -1
- package/dist/runtime-node/makaio-config.mjs +1 -1
- package/dist/runtime-node/workflow-worker/index.d.mts +1 -1
- package/dist/runtime-node/workflow-worker/index.mjs +1 -1
- package/dist/runtime-node/workflow-worker/worker-entry.mjs +1 -1
- package/dist/{schema-BA1cHBbc.d.mts → schema-FY0EakKe.d.mts} +56 -0
- package/dist/schemas-CkxAK13D.mjs +1 -0
- package/dist/{schemas-CaYEFzK_.d.mts → schemas-FgVQek-j.d.mts} +2 -2
- package/dist/services/adapter-runtime/index.d.mts +3 -3
- 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/namespace.d.mts +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/automation-trigger/index.d.mts +19 -0
- package/dist/services/capability/index.d.mts +2 -2
- package/dist/services/code-execution/index.d.mts +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-projection/index.d.mts +94 -0
- package/dist/services/context-projection/index.mjs +1 -0
- package/dist/services/context-rules/index.d.mts +1 -1
- package/dist/services/execution-target/index.d.mts +3 -3
- package/dist/services/execution-target/namespace.d.mts +1 -1
- package/dist/services/execution-target/schemas.d.mts +1 -1
- package/dist/services/filesystem/index.d.mts +1 -1
- package/dist/services/index.d.mts +45 -40
- 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/materialization/index.d.mts +1 -1
- package/dist/services/model-registry/index.d.mts +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/session/handlers/index.d.mts +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/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/storage/namespace.d.mts +1 -1
- package/dist/services/session/storage/schema.d.mts +1 -1
- package/dist/services/session/storage/schema.mjs +1 -1
- package/dist/services/session/testing/index.mjs +4 -2
- 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-editor/index.d.mts +1 -1
- package/dist/services/settings/index.d.mts +3 -3
- package/dist/services/settings/namespace.d.mts +232 -3
- package/dist/services/settings/namespace.mjs +1 -1
- package/dist/services/settings/storage/clients-namespace.d.mts +1 -1
- package/dist/services/settings/storage/index.d.mts +3 -3
- package/dist/services/settings/storage/providers-namespace.d.mts +1 -1
- package/dist/services/subagent/index.d.mts +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/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 +1 -1
- package/dist/services/workflow-transitions/index.mjs +1 -1
- package/dist/session-BNiMZnfF.mjs +1 -0
- package/dist/session-CMbztxNO.mjs +95 -0
- package/dist/src-BZdw54VU.mjs +1 -0
- package/dist/{src-CbAw9kjJ.mjs → src-C0sw_Vs_.mjs} +1 -1
- package/dist/{src-Xn6SS74f.mjs → src-CqQSqLQI.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 +1 -1
- package/dist/storage/drizzle/index.mjs +1 -1
- package/dist/storage/handlers/drizzle/index.d.mts +1 -1
- package/dist/storage/handlers/index.d.mts +1 -1
- package/dist/{tool-approval-service-pbkGcAV8.mjs → tool-approval-service-CRo3fZRF.mjs} +1 -1
- package/dist/{tools-C5Gy0IQG.mjs → tools-CKaxi3Mb.mjs} +1 -1
- package/dist/{transition-D-Lgbp1j.d.mts → transition-DMv8cgEd.d.mts} +2 -2
- package/dist/{types-CjYcHDPo2.d.mts → types-7L3BrU9m2.d.mts} +1 -1
- package/dist/{types-DhbllltK.d.mts → types-DNYO_Rxj.d.mts} +12 -3
- package/dist/ui-hooks/index.d.mts +17 -24
- package/dist/ui-hooks/index.mjs +1 -1
- package/dist/ui-kernel/index.d.mts +11 -2
- package/dist/ui-kernel/index.mjs +1 -1
- package/dist/ui-kernel/pages/schemas.d.mts +1 -1
- package/dist/ui-views/index.mjs +1 -1
- package/dist/utils/index.d.mts +31 -1
- package/dist/utils/index.mjs +2 -2
- package/dist/{view-builder-CHUTXJDl.d.mts → view-builder-DJGz9I-u.d.mts} +2 -2
- package/dist/workflow-engine/execution-attempt-repository.d.mts +1 -1
- package/dist/workflow-engine/execution-attempt-repository.mjs +1 -1
- package/dist/workflow-engine/index.d.mts +2 -2
- 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 +1 -1
- package/dist/workflow-engine/testing/conformance.d.mts +1 -1
- package/dist/workflow-engine/testing/conformance.mjs +1 -1
- package/dist/workflow-engine/testing/index.d.mts +1 -1
- package/dist/workflow-engine/testing/index.mjs +1 -1
- package/dist/workflow-engine/testing/sqlite.d.mts +1 -1
- package/dist/workflow-engine/testing/sqlite.mjs +1 -1
- package/dist/workflow-engine/workflow-orchestrator.mjs +1 -1
- package/dist/{workflow-transitions-C0sg3kar.mjs → workflow-transitions-t0ORS1F5.mjs} +1 -1
- package/dist/workflow-worker-DXCXb3g-.mjs +3 -0
- package/package.json +9 -1
- package/dist/bus-BQ64i3DN.mjs +0 -9
- package/dist/client-Bg3_IdaF.mjs +0 -1
- package/dist/extension-CfrTp3rC.mjs +0 -1
- package/dist/extension-CnNcY1hR.mjs +0 -1
- package/dist/extension-namespace-Ct9L6SKr.mjs +0 -1
- package/dist/index-D_j_T3nS.d.mts +0 -435
- package/dist/load-extensions-BVgxTj_y.mjs +0 -1
- package/dist/ownership-memory-handler-xex7sLiX.mjs +0 -1
- package/dist/schemas-ClkcU_N5.mjs +0 -1
- package/dist/session-6UG5udTX.mjs +0 -95
- package/dist/session-BB0s7c2B.mjs +0 -1
- package/dist/workflow-worker-ChrMIcKm.mjs +0 -2
- /package/dist/{adapter-binding-BxjUfkOn.d.mts → adapter-binding-CaYBrIkL.d.mts} +0 -0
- /package/dist/{attempt-control-evidence-7lwRG73Y.mjs → attempt-control-evidence-CHBnJoqN.mjs} +0 -0
- /package/dist/{attempt-fixtures-DHdYmr3o.mjs → attempt-fixtures-D3IsP0KH.mjs} +0 -0
- /package/dist/{authority-state-bootstrap-CvuWPywM.mjs → authority-state-bootstrap-4F5Wc_6l.mjs} +0 -0
- /package/dist/{base-orchestrator-CrXiMJzf.d.mts → base-orchestrator-1ofFsqUz.d.mts} +0 -0
- /package/dist/{bootstrap-start-client-C1ZHbv6e.mjs → bootstrap-start-client-9nOdeDYl.mjs} +0 -0
- /package/dist/{capability-service-CQ1aw_p-.d.mts → capability-service-CUN0MIS7.d.mts} +0 -0
- /package/dist/{client-ByjHcS78.d.mts → client-BY3sBW2L.d.mts} +0 -0
- /package/dist/{client-binary-version-verifier-C4fEAUdo.d.mts → client-binary-version-verifier-BeO4Eptw.d.mts} +0 -0
- /package/dist/{clients-namespace-D4BxF2Nw.d.mts → clients-namespace-D92YsbKI.d.mts} +0 -0
- /package/dist/{config-namespace-B1zyOYwH.d.mts → config-namespace-OEckUfVE.d.mts} +0 -0
- /package/dist/{create-static-mount-Dgxgi4W3.mjs → create-static-mount-4B-mNtx1.mjs} +0 -0
- /package/dist/{cross-spawn-BMCAyqrN.mjs → cross-spawn-DGqEuNyT.mjs} +0 -0
- /package/dist/{definition-ClWxAKQ2.d.mts → definition-DLJg-P4G.d.mts} +0 -0
- /package/dist/{esm-Ccx-3z8E.mjs → esm-DwiWcwH0.mjs} +0 -0
- /package/dist/{execution-attempt-repository-aabFKcXN.mjs → execution-attempt-repository-CY289HlC.mjs} +0 -0
- /package/dist/{execution-attempt-repository-BUah8hma.d.mts → execution-attempt-repository-DOb5V4N2.d.mts} +0 -0
- /package/dist/{extension-package-provenance-C7oO5JAE.mjs → extension-package-provenance-ClpN3GHp.mjs} +0 -0
- /package/dist/{filesystem-service-CDYoiwWY.d.mts → filesystem-service-BmavE-uO.d.mts} +0 -0
- /package/dist/{index-BbkcbY6d.d.mts → index--gbsE1W0.d.mts} +0 -0
- /package/dist/{index-DdVpWkaI.d.mts → index-B36rL4gp.d.mts} +0 -0
- /package/dist/{index-DM72_93s.d.mts → index-BD1SbHpP.d.mts} +0 -0
- /package/dist/{index-KdlZRuTp.d.mts → index-BDcK7jqJ2.d.mts} +0 -0
- /package/dist/{index-DAaQ--ki.d.mts → index-BQYGOXY5.d.mts} +0 -0
- /package/dist/{index-gAyARaKS.d.mts → index-BneZFJ7x.d.mts} +0 -0
- /package/dist/{index-D8ELwT5y.d.mts → index-BujgCaKt.d.mts} +0 -0
- /package/dist/{index-DfU8s_xP.d.mts → index-C2StVLk4.d.mts} +0 -0
- /package/dist/{index-BGnQ0EyD.d.mts → index-CCTzitBA.d.mts} +0 -0
- /package/dist/{index-CVRT01082.d.mts → index-Cj_V1aRL.d.mts} +0 -0
- /package/dist/{index-nkix3hP7.d.mts → index-CpN2C9jq.d.mts} +0 -0
- /package/dist/{index-D6p17KPs.d.mts → index-CsRPJ9FV.d.mts} +0 -0
- /package/dist/{index-BPNfYEA22.d.mts → index-CvdvuhTL2.d.mts} +0 -0
- /package/dist/{index-DmX9W3xH2.d.mts → index-D3peNmHN2.d.mts} +0 -0
- /package/dist/{index-DiZ4LmyE.d.mts → index-D7smT-YD.d.mts} +0 -0
- /package/dist/{index-B78CRVi9.d.mts → index-DEx4ZFkz.d.mts} +0 -0
- /package/dist/{index-CjDQn6lw.d.mts → index-DGoJayJg.d.mts} +0 -0
- /package/dist/{index-F7cVpFJ9.d.mts → index-DTvYp2GT.d.mts} +0 -0
- /package/dist/{index-Htfr-K5U2.d.mts → index-DqliLe_D2.d.mts} +0 -0
- /package/dist/{index-BCU5oByg.d.mts → index-DubyRZD9.d.mts} +0 -0
- /package/dist/{index-DjSUOMlr.d.mts → index-DwOpaQAE.d.mts} +0 -0
- /package/dist/{index-BZoOYV-y.d.mts → index-DxkSkszz.d.mts} +0 -0
- /package/dist/{index-tbjIqwa3.d.mts → index-TBJ1kIGA.d.mts} +0 -0
- /package/dist/{index-DXQTkwLB.d.mts → index-YOXWpZAS.d.mts} +0 -0
- /package/dist/{index-CXpgL3gz2.d.mts → index-aIJ7A4DC2.d.mts} +0 -0
- /package/dist/{index-D6liU_KS.d.mts → index-fxh7TB0q.d.mts} +0 -0
- /package/dist/{index-xsaaa85T.d.mts → index-qczb9Yx3.d.mts} +0 -0
- /package/dist/{index-C_kOkO3E.d.mts → index-zqo2mX_Z.d.mts} +0 -0
- /package/dist/{json-value-Ymw2f8i_.d.mts → json-value-Bjl8jzom.d.mts} +0 -0
- /package/dist/{jsonl-transport-Bg033Ng0.mjs → jsonl-transport-Ct1RWs0h.mjs} +0 -0
- /package/dist/{lib-BizqbepU.mjs → lib-DomKag_k.mjs} +0 -0
- /package/dist/{namespace-rJ3ycPMg.d.mts → namespace-Bhx72V7S.d.mts} +0 -0
- /package/dist/{namespace-BCVKdu-U.d.mts → namespace-CxEQv9iZ.d.mts} +0 -0
- /package/dist/{namespace-COHHDh2I.d.mts → namespace-D09uQ231.d.mts} +0 -0
- /package/dist/{namespace-UFcDEBJB.d.mts → namespace-D5DkpaaN.d.mts} +0 -0
- /package/dist/{namespace-CvK86QFk.d.mts → namespace-DHLwz4o3.d.mts} +0 -0
- /package/dist/{namespace-B5IFLQc-.d.mts → namespace-DHbrNQYD.d.mts} +0 -0
- /package/dist/{namespace-s0e215xO.d.mts → namespace-DyD06b5-.d.mts} +0 -0
- /package/dist/{namespace-C1pPZKtI.d.mts → namespace-Dz5_Hrz7.d.mts} +0 -0
- /package/dist/{namespace-Phxf0Lep.d.mts → namespace-Lkv2nyzb.d.mts} +0 -0
- /package/dist/{namespace-DM5vykb7.d.mts → namespace-hlhPqSsw.d.mts} +0 -0
- /package/dist/{namespace-DlOQmhgX.d.mts → namespace-x-gk5SmK.d.mts} +0 -0
- /package/dist/{namespace-f6Kz5cwX.d.mts → namespace-zusFEJPh.d.mts} +0 -0
- /package/dist/{orchestrator-shared--srEeSaY.d.mts → orchestrator-shared-ChU5qRSe.d.mts} +0 -0
- /package/dist/{packages-B98-WETs.d.mts → packages-D2s51nGU.d.mts} +0 -0
- /package/dist/{providers-namespace-DRcl03bo.d.mts → providers-namespace-BLVt8OyP.d.mts} +0 -0
- /package/dist/{runtime-inputs-DBtVIy9h.d.mts → runtime-inputs-BU_kBrP7.d.mts} +0 -0
- /package/dist/{schemas-CEJe8O6P.d.mts → schemas-3KTmPuZg.d.mts} +0 -0
- /package/dist/{schemas-D_-iXLQ9.d.mts → schemas-B-5_Dp4_.d.mts} +0 -0
- /package/dist/{schemas-CeItAAQM.d.mts → schemas-BLxdGZkr.d.mts} +0 -0
- /package/dist/{schemas-Cj6Gbqch.d.mts → schemas-BegArpU_.d.mts} +0 -0
- /package/dist/{schemas-Ca5RILd-2.d.mts → schemas-BzB6z9oX2.d.mts} +0 -0
- /package/dist/{schemas-CtzZDp29.d.mts → schemas-CBBzvIh0.d.mts} +0 -0
- /package/dist/{schemas-Cq1d5tid.d.mts → schemas-CD3Mq-jC.d.mts} +0 -0
- /package/dist/{schemas-LiiyNNpr.d.mts → schemas-Cl7fPlRv.d.mts} +0 -0
- /package/dist/{schemas-DJ2vMsgm.d.mts → schemas-CqawCYTY.d.mts} +0 -0
- /package/dist/{schemas-2_D4iVbb.d.mts → schemas-DEg6R9ph.d.mts} +0 -0
- /package/dist/{schemas-JjyFxrC0.d.mts → schemas-rMUsvzeJ.d.mts} +0 -0
- /package/dist/{server-lifecycle-DUKp1Fbf.d.mts → server-lifecycle-CTJvpdeL.d.mts} +0 -0
- /package/dist/{session-lineage-C3myyt5x.d.mts → session-lineage-BuGN3RZs.d.mts} +0 -0
- /package/dist/{storage-namespace-IvLOIP7j.d.mts → storage-namespace-B5r_ScUz.d.mts} +0 -0
- /package/dist/{storage-namespace-definition-Cv0XiTXb.d.mts → storage-namespace-definition-DiYr8UNl.d.mts} +0 -0
- /package/dist/{types-hkExapGH.d.mts → types-BSx8YYlc.d.mts} +0 -0
- /package/dist/{types-BYEybzjX.d.mts → types-CpEoQapk.d.mts} +0 -0
- /package/dist/{types-QRSc2AUU.d.mts → types-Cuhnt15L.d.mts} +0 -0
- /package/dist/{types-QsyX4H21.d.mts → types-DEGuc-fn.d.mts} +0 -0
- /package/dist/{types-BRM1AZaP.d.mts → types-DciLiPMd.d.mts} +0 -0
- /package/dist/{types-CsmvIK25.mjs → types-wwuw7RkB.mjs} +0 -0
- /package/dist/{window-registry-DeG37kt8.d.mts → window-registry-C3W2wtlX.d.mts} +0 -0
|
@@ -1,3 +1,3 @@
|
|
|
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
|
|
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`,responseCapabilities:[`context.append`]},{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:`SubagentStart`,frameworkSubject:`client.session.subagent.started`,responseCapabilities:[`context.append`]},{name:`SubagentStop`,frameworkSubject:`client.session.subagent.completed`},{name:`PreCompact`,frameworkSubject:`client.session.compaction.pre`},{name:`PostCompact`},{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
|
|
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{CANONICAL_HOOK_RESPONSE_CAPABILITIES as te}from"@makaio/framework/contracts/client";import{AIAgent as ne,BaseConnectorTurn as re,ScopedToolApprovalSchema as ie,createAdapterNamespace as ae,createToolApprovalHandler as oe,defineDiscriminatedHandlers as se,formatContextBlockAsText as ce,isTextLikeMimeType as le,mergeScopedToolApproval as l,normalizeMimeType as u,processDiscriminatedItems as ue,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 de(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 oe(t.can_use_tool,p,e=>e)(e,n,r)}async function fe(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=se(`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 pe(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 me(e){return e.input_tokens+(e.cache_creation_input_tokens??0)+(e.cache_read_input_tokens??0)+e.output_tokens}async function he(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(!ge(n))continue;let r=n.tool_use_id,i=_e(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 ge(e){return typeof e==`object`&&!!e&&e.type===`tool_result`}function _e(e){return typeof e==`string`?e:[e?.stdout,e?.stderr].filter(Boolean).join(`
|
|
2
|
+
`)}function ve(e){return e.type!==`tool_use`||!e.id||!e.name?null:{toolCallId:e.id,toolName:e.name}}var ye=class extends ne{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 ue(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=ve(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(pe(t,e.total_cost_usd)),await this.emitContextWindowUpdate({currentTokens:me(t),maxTokens:this.getContextWindowSize()??2e5,cachedTokens:t.cache_read_input_tokens})}}async handleUserEvent(e,t){await he({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))}},be=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=[]}},xe=class extends re{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`,te.sessionToken]},{name:`UserPromptSubmit`,frameworkSubject:`client.session.userPrompt.submitted`,responseCapabilities:[`context.append`]},{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:`SubagentStart`,frameworkSubject:`client.session.subagent.started`,responseCapabilities:[`context.append`]},{name:`SubagentStop`,frameworkSubject:`client.session.subagent.completed`},{name:`PreCompact`,frameworkSubject:`client.session.compaction.pre`},{name:`PostCompact`,minimumVersion:`2.1.76`},{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()}),Se=e.object({ephemeral_1h_input_tokens:e.number(),ephemeral_5m_input_tokens:e.number()}),x=e.object({cache_creation:Se.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()}),Ce=e.object({data:e.string(),media_type:e.enum([`image/jpeg`,`image/png`,`image/gif`,`image/webp`]),type:e.literal(`base64`)}),we=e.object({type:e.literal(`url`),url:e.string()}),Te=e.object({file_id:e.string(),type:e.literal(`file`)}),Ee=e.discriminatedUnion(`type`,[Ce,we,Te]),De=e.object({data:e.string(),media_type:e.literal(`application/pdf`),type:e.literal(`base64`)}),Oe=e.object({type:e.literal(`url`),url:e.string()}),ke=e.object({file_id:e.string(),type:e.literal(`file`)}),Ae=e.object({data:e.string(),media_type:e.literal(`text/plain`),type:e.literal(`text`)}),je=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`)}),Me=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`)}),Ne=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`)}),Pe=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`)}),Fe=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`)}),Ie=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`)}),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(),encrypted_index:e.string(),title:e.string().nullable().optional(),type:e.literal(`web_search_result_location`),url:e.string()}),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`)}),Be=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`,[je,Ne,Fe,Le,ze]),Ve=e.discriminatedUnion(`type`,[Me,Pe,Ie,Re,Be]);e.object({citation:C,type:e.literal(`citations_delta`)});const w=e.object({enabled:e.boolean().optional()}),He=e.object({id:e.string(),expires_at:e.string()}),Ue=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(Ve).nullable().optional()}),E=e.object({source:Ee,type:e.literal(`image`),cache_control:S.nullable().optional()}),We=e.object({content:e.union([e.string(),e.array(e.union([T,E]))]),type:e.literal(`content`)}),Ge=e.object({source:e.union([De,Ae,We,Oe,ke]),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`)}),Ke=e.object({data:e.string(),type:e.literal(`redacted_thinking`)}),qe=e.object({id:e.string(),input:e.looseObject({}),name:e.string(),type:e.literal(`tool_use`)}),Je=e.object({id:e.string(),input:e.looseObject({}),name:e.enum([`web_search`,`code_execution`]),type:e.literal(`server_tool_use`)}),Ye=e.object({encrypted_content:e.string(),page_age:e.string().nullable().optional(),title:e.string(),type:e.literal(`web_search_result`),url:e.string()}),Xe=e.enum([`invalid_tool_input`,`unavailable`,`max_uses_exceeded`,`too_many_requests`,`query_too_long`]),Ze=e.object({error_code:Xe,type:e.literal(`web_search_tool_result_error`)}),Qe=e.union([Ze,e.array(Ye)]),$e=e.object({content:Qe,tool_use_id:e.string(),type:e.literal(`web_search_tool_result`)}),et=e.object({file_id:e.string(),type:e.literal(`code_execution_output`)}),tt=e.object({content:e.array(et),return_code:e.number(),stderr:e.string(),stdout:e.string(),type:e.literal(`code_execution_result`)}),nt=e.object({error_code:y,type:e.literal(`code_execution_tool_result_error`)}),rt=e.union([nt,tt]),it=e.object({content:rt,tool_use_id:e.string(),type:e.literal(`code_execution_tool_result`)}),at=e.object({id:e.string(),input:e.looseObject({}),name:e.string(),server_name:e.string(),type:e.literal(`mcp_tool_use`)}),ot=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`)}),st=e.object({file_id:e.string(),type:e.literal(`container_upload`)}),A=e.discriminatedUnion(`type`,[O,k,Ke,qe,Je,$e,it,at,ot,st]),ct=k.extend({}),lt=e.object({data:e.string(),type:e.literal(`redacted_thinking`)}),ut=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()}),dt=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()}),ft=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()}),pt=e.object({encrypted_content:e.string(),title:e.string(),type:e.literal(`web_search_result`),url:e.string(),page_age:e.string().nullable().optional()}),mt=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`)}),ht=e.union([e.array(pt),mt]),gt=e.object({content:ht,tool_use_id:e.string(),type:e.literal(`web_search_tool_result`),cache_control:S.nullable().optional()}),_t=e.object({file_id:e.string(),type:e.literal(`code_execution_output`)}),vt=e.object({content:e.array(_t),return_code:e.number(),stderr:e.string(),stdout:e.string(),type:e.literal(`code_execution_result`)}),yt=e.object({error_code:y,type:e.literal(`code_execution_tool_result_error`)}),bt=e.union([yt,vt]),xt=e.object({content:bt,tool_use_id:e.string(),type:e.literal(`code_execution_tool_result`),cache_control:S.nullable().optional()}),St=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()}),Ct=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()}),wt=e.object({file_id:e.string(),type:e.literal(`container_upload`),cache_control:S.nullable().optional()}),Tt=e.discriminatedUnion(`type`,[T,E,Ge,D,ct,lt,ut,dt,ft,gt,xt,St,Ct,wt]),Et=e.object({id:e.string(),type:e.literal(`message`),role:e.literal(`assistant`),model:e.string(),content:e.array(A),stop_reason:Ue.nullable().optional(),stop_sequence:e.string().nullable().optional(),usage:x,container:He.nullable().optional()}),j=v.extend({type:e.literal(`assistant`),message:Et}),Dt=e.object({role:e.enum([`user`,`assistant`]),content:e.union([e.string(),e.array(Tt)])}),Ot=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`])}),kt=e.object({inputTokens:e.number(),outputTokens:e.number(),cacheReadInputTokens:e.number(),cacheCreationInputTokens:e.number(),webSearchRequests:e.number(),costUSD:e.number(),contextWindow:e.number()}),At=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:Ot,modelUsage:e.record(e.string(),kt),permission_denials:e.array(At)}),jt=M.extend({subtype:e.literal(`success`),result:e.string(),structured_output:c.optional()}),Mt=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`,[jt,Mt]),Nt=e.object({type:e.literal(`message_start`),message:e.object({id:e.string(),type:e.literal(`message`),role:e.literal(`assistant`)})}),Pt=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}),Ft=e.object({type:e.literal(`message_stop`)}),It=e.object({type:e.literal(`content_block_start`),index:e.number(),content_block:A}),Lt=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()})])}),Rt=e.object({type:e.literal(`content_block_stop`),index:e.number()}),zt=e.discriminatedUnion(`type`,[Nt,Pt,Ft,It,Lt,Rt]),P=v.extend({type:e.literal(`stream_event`),event:zt}),Bt=[`init`,`compact_boundary`],Vt=e.enum([`user`,`project`,`org`,`temporary`,`none`]),Ht=e.enum([`default`,`acceptEdits`,`bypassPermissions`,`plan`]),Ut=e.object({name:e.string(),status:e.string()}),Wt=e.object({trigger:e.enum([`manual`,`auto`]),pre_tokens:e.number()}),Gt=_.extend({type:e.literal(`system`),subtype:e.literal(`init`),agents:e.array(e.string()).optional(),apiKeySource:Vt,cwd:e.string(),tools:e.array(e.string()),mcp_servers:e.array(Ut),model:e.string(),permissionMode:Ht,slash_commands:e.array(e.string()),output_style:e.string()}),Kt=_.extend({type:e.literal(`system`),subtype:e.literal(`compact_boundary`),compact_metadata:Wt}),qt=e.discriminatedUnion(`subtype`,[Gt,Kt]),Jt=_.extend({type:e.literal(`system`),subtype:e.string().refine(e=>!Bt.some(t=>t===e))}).passthrough(),F=e.union([qt,Jt]),I=v.extend({type:e.literal(`user`),message:Dt,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()}),Yt=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()}),Xt=_.extend({type:e.literal(`rate_limit_event`),rate_limit_info:Yt}),Zt=_.extend({type:e.literal(`command_lifecycle`),subtype:e.string(),command_uuid:e.string().optional()}).passthrough(),z=e.union([F,j,I,N,P,Xt,Zt]);e.intersection(z,e.object({agentId:e.string()}));const B=e.object({used_percentage:e.number().optional(),resets_at:e.number().optional()}).passthrough(),Qt=e.object({five_hour:B.optional(),seven_day:B.optional()}).passthrough(),$t=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:$t.nullable().optional()}).passthrough().nullable().optional(),exceeds_200k_tokens:e.boolean().optional(),rate_limits:Qt.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(),en=e.object({scope:V,path:e.string(),value:H.nullable()}),tn=e.object({scope:V,path:e.string(),events:e.record(e.string(),e.array(W))}),nn=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(en)}),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(tn)}),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(nn)}),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(),binaryVersion:e.string().nullable().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 rn={none:0,low:4e3,medium:8e3,high:16e3,"extra-high":32e3},an=e.intersection(z,e.object({originatingMessageId:e.string().optional()})),on=/(?:api[_-]?key|authorization|bearer|credential|password|private[_-]?key|secret|token|(?:^|[_-])key(?:$|[_-])|(?:^|[_-])pat(?:$|[_-]))/i,sn=/^(?:message|content|prompt|text|output)$/i;function cn(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`&&on.test(e))return`[redacted]`;if(typeof t==`string`&&(e&&sn.test(e)||t.length>80))return cn(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 ln(e){let t=q(void 0,e);return t&&typeof t==`object`&&!Array.isArray(t)?t:void 0}function un(e){let t={subject:e.subject,issues:e.issues.flatMap(e=>K(e)),sample:ln(e.payload)};console.warn(`[BUS:VIOLATION] ${JSON.stringify(t)}`)}function dn(e,t){return ae(e,{"sdk.event":an,can_use_tool:ie,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:un})}function J(e){try{return new TextDecoder().decode(Uint8Array.from(atob(e),e=>e.charCodeAt(0)))}catch{return``}}const Y=[`image/jpeg`,`image/png`,`image/gif`,`image/webp`];function X(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:X(t??u(e.mimeType),Y,`image/jpeg`)}}:{type:`image`,source:{type:`url`,url:e.url}}}function Q(e){return{type:`text`,data:e,media_type:`text/plain`}}function fn(e){return e.type===`base64`?u(e.mimeType)===`text/plain`?{type:`document`,source:Q(J(e.data))}:{type:`document`,source:{type:`base64`,data:e.data,media_type:`application/pdf`}}:{type:`document`,source:{type:`url`,url:e.url}}}function pn(e){let{source:t}=e;if(t.type===`base64`){let e=u(t.mimeType);if(Y.includes(e))return Z(t,e);if(e===`application/pdf`)return{type:`document`,source:{type:`base64`,data:t.data,media_type:`application/pdf`}};if(le(e))return{type:`document`,source:Q(J(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 fn(e.source);case`attachment`:return pn(e);default:return{type:`text`,text:d(e)}}})}const mn=250;function hn(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 gn(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 _n(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 vn(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 yn(e){let t=e.subtype===`success`&&e.is_error,n=_n(e);return gn(e.subtype,n,e.result)||(t&&typeof e.result==`string`?vn(e.result)||e.result:n)}function bn(e,t,n){let r={type:`text`,text:ce(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 xn(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 Sn(e){return`structured_output`in e&&e.structured_output!==void 0?JSON.stringify(e.structured_output):e.result??``}function Cn(e,t){return e}export{be as AsyncQuerySource,h as CONTENT_BLOCK_HANDLERS,ye as ClaudeCodeAgent,xe as ClaudeConnectorTurn,z as SDKMessageSchema,mn as TERMINAL_RESULT_DRAIN_TIMEOUT_MS,$ as blocksToContentBlocks,rn as claudeReasoningLevels,dn as createClaudeConnectorNamespace,J as decodeBase64Text,hn as extractTextFromMessage,de as fromGlobalToolApproval,yn as parseResultError,bn as prependContextBlock,m as registerToolApprovalHandler,fe as requestToolApproval,Sn as resolveResultMessage,xn as sdkUserMessageFromNormalized,p as toGlobalToolApproval,Cn as unwrapBlockFromMessage};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as bindProviderAuth, B as PreparedAdapterAuthRuntime, G as AdapterAuthError, H as SuppliedAdapterAuthRuntime, J as BoundProviderAuthContext, K as AdapterAuthErrorReason, L as AdapterAuthLeaseHandle, Q as ResolvedConnectorAuthDelivery, R as AdapterAuthRuntimePreparer, U as applySuppliedAdapterAuthRuntime, V as ResolvedAdapterRuntimeConfig, W as prepareAdapterAuthRuntime, X as ResolvedAdapterAuth, Y as ResolveAuthCredentialRefs, Z as ResolvedAuthCredentialValues, _ as BaseAgentConnectorConfig, et as getOptionalAuthCredentialFields, q as BindProviderAuthOptions, tt as resolveBoundProviderAuth, z as BoundAdapterRuntimeConfig } from "../../types-
|
|
1
|
+
import { $ as bindProviderAuth, B as PreparedAdapterAuthRuntime, G as AdapterAuthError, H as SuppliedAdapterAuthRuntime, J as BoundProviderAuthContext, K as AdapterAuthErrorReason, L as AdapterAuthLeaseHandle, Q as ResolvedConnectorAuthDelivery, R as AdapterAuthRuntimePreparer, U as applySuppliedAdapterAuthRuntime, V as ResolvedAdapterRuntimeConfig, W as prepareAdapterAuthRuntime, X as ResolvedAdapterAuth, Y as ResolveAuthCredentialRefs, Z as ResolvedAuthCredentialValues, _ as BaseAgentConnectorConfig, et as getOptionalAuthCredentialFields, q as BindProviderAuthOptions, tt as resolveBoundProviderAuth, z as BoundAdapterRuntimeConfig } from "../../types-CpEoQapk.mjs";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { TimeoutConfig, TrackedTimeoutConfig } from "@makaio/framework/utils";
|
|
4
4
|
import { AIModelSchema, AdapterProviderAuth, ProtocolId, ProviderContext, ResolvedProviderAuth } from "@makaio/framework/contracts";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $t as SessionToolLedger, A as AgentTeardownArbiter, At as runBestEffortStage, Bt as MessageHandle, C as NormalizedCallUsage, Ct as ObservedExitOptions, D as AdapterProviderDefinition, Dt as reportBestEffortStages, E as StartAgentOptions, Et as exitWasObserved, F as TeardownSubject, Ft as unknownTeardown, Gt as MessageState, Ht as NormalizedMessageInput, I as CreateConnectorRuntimeOptions, It as CONNECTOR_EXIT_OBSERVATION_MS, Jt as AIModel, Kt as ProcessingState, Lt as SWAP_SETTLEMENT_WAIT_MS, M as ConnectorReplacementSettlement, Mt as TeardownReport, N as ConnectorSwapAdmission, Nt as aggregateTeardownReports, O as ConfigFactoryInput, Ot as reportObservedExit, P as ConnectorSwapHandover, Pt as rethrowTeardownFailure, Qt as LedgerSessionContext, R as AdapterAuthRuntimePreparer, Rt as AIAgentConnector, S as GetCapabilitiesResponsePayload, St as SupersededGeneration, T as SendMessageResponsePayload, Tt as describeTeardownFailure, Ut as normalizeMessageInput, Vt as markCompletedWithFinalResult, Wt as MessageResult, Xt as ReasoningLevelMap, Yt as AIReasoningLevel, Zt as ISessionToolLedger, _ as BaseAgentConnectorConfig, _t as BaseConnectorTurn, a as AgentCredentialChangeResponsePayload, at as WireSessionSubjects, b as ContextWindowInput, bt as ConnectorSessionConfig, c as AgentIdentity, ct as QueueableTurn, d as AgentMcpServersSetRequestPayload, dt as rejectQueuedHandles, en as ToolLedgerEntry, f as AgentMcpServersSetResponsePayload, ft as UserMessageQueue, g as AgentStartResult, gt as TurnSubjects, h as AgentSendMessageOptions, ht as ProceduralTurnState, i as AgentCredentialChangeRequestPayload, it as WireSessionConfig, j as ClosableConnectorRuntime, jt as stageFailure, k as IAdapterConfigFactory, kt as reportRepeatTeardown, l as AgentInterruptRequestPayload, lt as SESSION_CLOSED_QUEUE_ERROR, m as AgentModelChangeResponsePayload, mt as ProceduralTurnConfig, n as AgentConnectorConfigOverrides, nt as ProceduralAgentConnector, o as AgentCwdChangeRequestPayload, ot as MergeResult, p as AgentModelChangeRequestPayload, pt as ProceduralConnectorTurn, qt as SendMessageOptions, r as AgentContext, rt as ProceduralConnectorSession, s as AgentCwdChangeResponsePayload, st as ProcessQueueCallbacks, t as AIAgentConfig, u as AgentInterruptResponsePayload, ut as processQueueMessages, v as ConnectorSendMessageOptions, vt as PauseResult, w as SendMessageRequestPayload, wt as capTeardownEvidence, x as ExecutionContext, xt as GenerationRetirementLedger, y as ConnectorStartOptions, yt as BaseConnectorSession, zt as MessageDeliveryMode } from "../types-
|
|
2
|
-
import { S as toImportSegment, _ as LogImporter, a as CompactionMetadata, b as ProcessLogFileResult, c as ExternalToolIdentifiers, d as ImportMetadata, f as ImportSegment, g as LogImportTestConfig, h as LogImportSessionContext, l as ExternalToolMeta, m as ImportSegmentTurn, n as LogOrchestratorConfig, o as DiscoveryMetadata, p as ImportSegmentLineage, r as ParseFileResult, s as ExternalToolIdentifier, u as ImportCursorPosition, v as LogImporterConfig, x as StorageMessagePayload, y as NormalizedEvent } from "../base-orchestrator-
|
|
1
|
+
import { $t as SessionToolLedger, A as AgentTeardownArbiter, At as runBestEffortStage, Bt as MessageHandle, C as NormalizedCallUsage, Ct as ObservedExitOptions, D as AdapterProviderDefinition, Dt as reportBestEffortStages, E as StartAgentOptions, Et as exitWasObserved, F as TeardownSubject, Ft as unknownTeardown, Gt as MessageState, Ht as NormalizedMessageInput, I as CreateConnectorRuntimeOptions, It as CONNECTOR_EXIT_OBSERVATION_MS, Jt as AIModel, Kt as ProcessingState, Lt as SWAP_SETTLEMENT_WAIT_MS, M as ConnectorReplacementSettlement, Mt as TeardownReport, N as ConnectorSwapAdmission, Nt as aggregateTeardownReports, O as ConfigFactoryInput, Ot as reportObservedExit, P as ConnectorSwapHandover, Pt as rethrowTeardownFailure, Qt as LedgerSessionContext, R as AdapterAuthRuntimePreparer, Rt as AIAgentConnector, S as GetCapabilitiesResponsePayload, St as SupersededGeneration, T as SendMessageResponsePayload, Tt as describeTeardownFailure, Ut as normalizeMessageInput, Vt as markCompletedWithFinalResult, Wt as MessageResult, Xt as ReasoningLevelMap, Yt as AIReasoningLevel, Zt as ISessionToolLedger, _ as BaseAgentConnectorConfig, _t as BaseConnectorTurn, a as AgentCredentialChangeResponsePayload, at as WireSessionSubjects, b as ContextWindowInput, bt as ConnectorSessionConfig, c as AgentIdentity, ct as QueueableTurn, d as AgentMcpServersSetRequestPayload, dt as rejectQueuedHandles, en as ToolLedgerEntry, f as AgentMcpServersSetResponsePayload, ft as UserMessageQueue, g as AgentStartResult, gt as TurnSubjects, h as AgentSendMessageOptions, ht as ProceduralTurnState, i as AgentCredentialChangeRequestPayload, it as WireSessionConfig, j as ClosableConnectorRuntime, jt as stageFailure, k as IAdapterConfigFactory, kt as reportRepeatTeardown, l as AgentInterruptRequestPayload, lt as SESSION_CLOSED_QUEUE_ERROR, m as AgentModelChangeResponsePayload, mt as ProceduralTurnConfig, n as AgentConnectorConfigOverrides, nt as ProceduralAgentConnector, o as AgentCwdChangeRequestPayload, ot as MergeResult, p as AgentModelChangeRequestPayload, pt as ProceduralConnectorTurn, qt as SendMessageOptions, r as AgentContext, rt as ProceduralConnectorSession, s as AgentCwdChangeResponsePayload, st as ProcessQueueCallbacks, t as AIAgentConfig, u as AgentInterruptResponsePayload, ut as processQueueMessages, v as ConnectorSendMessageOptions, vt as PauseResult, w as SendMessageRequestPayload, wt as capTeardownEvidence, x as ExecutionContext, xt as GenerationRetirementLedger, y as ConnectorStartOptions, yt as BaseConnectorSession, zt as MessageDeliveryMode } from "../types-CpEoQapk.mjs";
|
|
2
|
+
import { S as toImportSegment, _ as LogImporter, a as CompactionMetadata, b as ProcessLogFileResult, c as ExternalToolIdentifiers, d as ImportMetadata, f as ImportSegment, g as LogImportTestConfig, h as LogImportSessionContext, l as ExternalToolMeta, m as ImportSegmentTurn, n as LogOrchestratorConfig, o as DiscoveryMetadata, p as ImportSegmentLineage, r as ParseFileResult, s as ExternalToolIdentifier, u as ImportCursorPosition, v as LogImporterConfig, x as StorageMessagePayload, y as NormalizedEvent } from "../base-orchestrator-1ofFsqUz.mjs";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import * as _$_makaio_core0 from "@makaio/framework/core";
|
|
5
5
|
import { CreateBusNamespaceOptions, ExtractSubjectPayload, FilterablePayloadIntersection, HandlerForSubjectDefinition, RegistrableBusNamespaceDefinition, RequestContext, SchemaRecord, ScopedSubjectDefinition, SubjectDefinition, SubjectRecordFromSchemaRecord } from "@makaio/framework/core";
|
package/dist/adapters/node.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as LogImporter, i as LogFileChangeEvent, n as LogOrchestratorConfig, t as BaseLogOrchestrator } from "../base-orchestrator-
|
|
1
|
+
import { _ as LogImporter, i as LogFileChangeEvent, n as LogOrchestratorConfig, t as BaseLogOrchestrator } from "../base-orchestrator-1ofFsqUz.mjs";
|
|
2
2
|
|
|
3
3
|
//#region adapters/core/src/log-importer/jsonl-parser.d.ts
|
|
4
4
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as e}from"./execution-attempt-owner-recovery-
|
|
1
|
+
import{s as e}from"./execution-attempt-owner-recovery-BZOEVYFH.mjs";import{z as t}from"zod";import{ExecutionAttemptPreparationResultSchema as n,ProviderAllocationRefSchema as r,WorkerAllocationLifetimeSchema as i}from"@makaio/framework/contracts";function a(e){let t=Date.parse(e);if(Number.isNaN(t))throw Error(`Expected an ISO-8601 timestamp, received '${e}'`);return t}function o(e){return new Date(a(e)).toISOString()}function s(e){if(!Number.isSafeInteger(e)||e<=0)throw RangeError(`bootstrapTimeoutMs must be a positive safe integer`);let t=Date.now(),n=t+e;if(!Number.isSafeInteger(n)||!Number.isFinite(new Date(n).getTime()))throw RangeError(`bootstrapTimeoutMs produces an unrepresentable bootstrap deadline`);return{createdAt:new Date(t).toISOString(),bootstrapDeadlineAt:new Date(n).toISOString()}}function c(t){return e(t,e=>n.parse(e))}const l=t.array(t.object({operationId:t.string().min(1),runtimeGeneration:t.number().int().positive(),result:n}).strict());function u(t){return e(t,e=>l.parse(e))}function d(t){return e(t,e=>r.parse(e))}function f(e){return i.parse(e)}function p(e){let t=r.parse(e.currentRef),n=d(e.nextRef);if(t.providerId!==n.providerId)throw Error(`Allocation reference evolution must keep one provider, received '${t.providerId}' and '${n.providerId}'`);return{currentRef:t,nextRef:n}}function m(e,t){if(e.providerId!==t.providerId)throw Error(`Allocation reference for attempt '${e.executionAttemptId}' names provider '${t.providerId}' but the attempt is bound to '${e.providerId??`no provider`}'`)}const h={runtimeGeneration:0,runtimeIncarnationId:null,runtimeReadyAt:null,operationStartGate:`open`,activeOperationId:null,activeOperationKind:null,activeOperationKey:null,activeOperationGeneration:null,activeOperationAdmittedAt:null,lastCompletedOperationId:null};function g(e){return{runtimeGeneration:e.runtimeGeneration,runtimeIncarnationId:e.runtimeIncarnationId,runtimeReadyAt:e.runtimeReadyAt,operationStartGate:e.operationStartGate,activeOperationId:e.activeOperationId,activeOperationKind:e.activeOperationKind,activeOperationKey:e.activeOperationKey,activeOperationGeneration:e.activeOperationGeneration,activeOperationAdmittedAt:e.activeOperationAdmittedAt,lastCompletedOperationId:e.lastCompletedOperationId}}function _(e,t){let n=a(e.createdAt)-a(t.createdAt);return n===0?e.executionAttemptId<t.executionAttemptId?-1:+(e.executionAttemptId>t.executionAttemptId):n}function v(e){let{status:t,claimable:n,settlementKind:r,allocationRef:i,providerId:a}=e,{allocationLifetime:o,provisionerIncarnationId:s}=e;if(t!==`allocated`||n!==!0||r!=null||i===null||a===null||o===null||s===null)throw Error(`Attempt '${e.executionAttemptId}' was selected as recoverable but is not: status '${t}', claimable '${String(n)}', settlement '${String(r)}', allocation '${i===null?`none`:`present`}', provider '${String(a)}', lifetime '${String(o)}', provisioner '${String(s)}'`);return{...e,status:t,claimable:!0,settlementKind:null,allocationRef:i,providerId:a,allocationLifetime:o,provisionerIncarnationId:s}}export{o as a,p as c,m as d,g as f,a as i,u as l,_ as n,f as o,v as p,s as r,d as s,h as t,c as u};
|
package/dist/bus/index.d.mts
CHANGED
|
@@ -1491,6 +1491,18 @@ type NamespaceRegistry = ReturnType<typeof createNamespaceRegistry>;
|
|
|
1491
1491
|
//#region core/bus-core/src/registries/transport-registry.d.ts
|
|
1492
1492
|
interface BusTransportRegistry extends Record<string, BusTransport> {}
|
|
1493
1493
|
type BusTransportKeys = keyof BusTransportRegistry;
|
|
1494
|
+
/**
|
|
1495
|
+
* One transport whose `ready` promise has not settled yet.
|
|
1496
|
+
*
|
|
1497
|
+
* The name travels with the promise so a caller gated on readiness can report
|
|
1498
|
+
* which transport it is waiting for.
|
|
1499
|
+
*/
|
|
1500
|
+
interface PendingReadyEntry {
|
|
1501
|
+
/** Registry key of the transport. */
|
|
1502
|
+
name: string;
|
|
1503
|
+
/** The transport session's unresolved `ready` promise. */
|
|
1504
|
+
ready: Promise<void>;
|
|
1505
|
+
}
|
|
1494
1506
|
/**
|
|
1495
1507
|
* Creates the transport registry used by a bus context.
|
|
1496
1508
|
*
|
|
@@ -1525,12 +1537,26 @@ declare const createTransportRegistry: (context: MakaioBusContext) => {
|
|
|
1525
1537
|
all(): BusTransport[];
|
|
1526
1538
|
names(): BusTransportKeys[];
|
|
1527
1539
|
/**
|
|
1528
|
-
* Return
|
|
1540
|
+
* Return unresolved transport `ready` entries for dispatch-level gating.
|
|
1541
|
+
*
|
|
1542
|
+
* Entries carry the transport name alongside the promise so a caller waiting
|
|
1543
|
+
* on readiness can report which transport it is waiting for.
|
|
1544
|
+
* @param names - Optional transport names to restrict the result to. Omit to
|
|
1545
|
+
* report every pending transport; names that are absent or already ready
|
|
1546
|
+
* contribute nothing.
|
|
1547
|
+
* @returns Pending entries (empty when all requested transports are ready)
|
|
1548
|
+
*/
|
|
1549
|
+
getPendingReadyEntries(names?: ReadonlyArray<string>): PendingReadyEntry[];
|
|
1550
|
+
/**
|
|
1551
|
+
* Return unresolved transport `ready` promises for dispatch-level gating.
|
|
1529
1552
|
*
|
|
1530
1553
|
* Use `Promise.all(registry.getPendingReady())` to await full initialization.
|
|
1531
|
-
*
|
|
1554
|
+
* Prefer `getPendingReadyEntries()` when the caller needs to name the
|
|
1555
|
+
* transports it is waiting for.
|
|
1556
|
+
* @param names - Optional transport names to restrict the result to
|
|
1557
|
+
* @returns Array of pending ready promises (empty when all are ready)
|
|
1532
1558
|
*/
|
|
1533
|
-
getPendingReady(): Promise<void>[];
|
|
1559
|
+
getPendingReady(names?: ReadonlyArray<string>): Promise<void>[];
|
|
1534
1560
|
/**
|
|
1535
1561
|
* Set the lifecycle emitter used to publish `BusLifecycle.connected` /
|
|
1536
1562
|
* `BusLifecycle.disconnected` events whenever a transport connects or
|
|
@@ -1679,13 +1705,26 @@ interface BusRequestMessage {
|
|
|
1679
1705
|
correlationId: string;
|
|
1680
1706
|
messageId: string;
|
|
1681
1707
|
/**
|
|
1682
|
-
*
|
|
1708
|
+
* Remaining request budget in milliseconds at the moment this hop was sent.
|
|
1683
1709
|
*
|
|
1684
|
-
*
|
|
1685
|
-
*
|
|
1686
|
-
* A value
|
|
1710
|
+
* Each hop recomputes it from its own remaining deadline before sending, so it
|
|
1711
|
+
* decreases along the chain rather than restarting the original caller's budget.
|
|
1712
|
+
* A receiving hop anchors its deadline from this value, because it is relative and
|
|
1713
|
+
* therefore clock-independent. A value of `0` means no automatic timeout.
|
|
1714
|
+
*
|
|
1715
|
+
* Wire latency between send and receive is unaccounted for by design: measuring it
|
|
1716
|
+
* would need a clock the two nodes share, and the alternative — trusting the sender's
|
|
1717
|
+
* absolute `deadline` — is worse, since a trailing clock would expire a request that
|
|
1718
|
+
* still has its full budget. The unmeasured slack is one network hop per link.
|
|
1687
1719
|
*/
|
|
1688
1720
|
timeout?: number;
|
|
1721
|
+
/**
|
|
1722
|
+
* Readiness-gate budget in milliseconds for this hop, when the caller set one.
|
|
1723
|
+
*
|
|
1724
|
+
* Carried so an inbound hop gates on the originating caller's budget rather than
|
|
1725
|
+
* silently falling back to the default. Absent means "use the default".
|
|
1726
|
+
*/
|
|
1727
|
+
readinessTimeout?: number;
|
|
1689
1728
|
/**
|
|
1690
1729
|
* Priority cursor for cross-transport priority-based dispatch.
|
|
1691
1730
|
*
|
|
@@ -1700,6 +1739,13 @@ interface BusRequestMessage {
|
|
|
1700
1739
|
* Set on the first dispatch hop and propagated through all subsequent hops so
|
|
1701
1740
|
* that each hop can compute its remaining time budget without relying on the
|
|
1702
1741
|
* original timeout value alone.
|
|
1742
|
+
*
|
|
1743
|
+
* This is an absolute instant on the *sender's* clock. **Receivers must not consume
|
|
1744
|
+
* it**, not even as a cap: two nodes' clocks need not agree, and a sender trailing by
|
|
1745
|
+
* more than `timeout` would hand over an already-expired instant for a request that
|
|
1746
|
+
* still has its full budget. A receiving hop anchors its own deadline from the
|
|
1747
|
+
* clock-independent `timeout` instead. The field remains on the wire for the sender's
|
|
1748
|
+
* own bookkeeping and for diagnostics.
|
|
1703
1749
|
*/
|
|
1704
1750
|
deadline?: number;
|
|
1705
1751
|
}
|
|
@@ -1876,6 +1922,8 @@ interface BusTransport {
|
|
|
1876
1922
|
* console.warn('Event not delivered - no subscribers');
|
|
1877
1923
|
* }
|
|
1878
1924
|
* ```
|
|
1925
|
+
* @remarks
|
|
1926
|
+
* The bus never re-sends a request: a rejection ends that hop.
|
|
1879
1927
|
*/
|
|
1880
1928
|
send<TMessage extends BusMessage>(message: TMessage, timeout?: number): Promise<TMessage extends BusRequestMessage ? unknown : TMessage extends BusBroadcastMessage ? Array<{
|
|
1881
1929
|
nodeId: string;
|
|
@@ -1964,6 +2012,30 @@ interface BusTransport {
|
|
|
1964
2012
|
* @returns `true` if the transport can send messages, `false` otherwise
|
|
1965
2013
|
*/
|
|
1966
2014
|
isReady?(): boolean;
|
|
2015
|
+
/**
|
|
2016
|
+
* Optional: message-selective outbound eligibility check for transports whose
|
|
2017
|
+
* encoding capability depends on the message (e.g. an end-to-end codec that
|
|
2018
|
+
* passes control-plane frames in plaintext before a session exists).
|
|
2019
|
+
*
|
|
2020
|
+
* **When it applies:** the bus consults `canSend` on outbound event and broadcast
|
|
2021
|
+
* paths (both local-origin and relay). Request paths do not consult `canSend`; the
|
|
2022
|
+
* relay leg is still attempted and any encode error is logged.
|
|
2023
|
+
*
|
|
2024
|
+
* **Governs instead of `isReady`:** when `canSend` is present, the bus uses it in
|
|
2025
|
+
* place of `isReady()` to gate the specific message being sent. Implementers must
|
|
2026
|
+
* therefore fold their own wire-session readiness into the return value — the bus
|
|
2027
|
+
* will not call `isReady()` as a fallback when `canSend` is defined and the message
|
|
2028
|
+
* is available.
|
|
2029
|
+
*
|
|
2030
|
+
* **Must not throw:** `canSend` is called inside a transport-list filter. An
|
|
2031
|
+
* unhandled exception aborts the entire emit, so implementers must catch any
|
|
2032
|
+
* internal errors and return `false` instead of letting them propagate.
|
|
2033
|
+
*
|
|
2034
|
+
* When absent, `isReady()` governs.
|
|
2035
|
+
* @param message - Outbound bus message to test
|
|
2036
|
+
* @returns `true` when the transport can encode and send this message; `false` otherwise
|
|
2037
|
+
*/
|
|
2038
|
+
canSend?(message: BusMessage): boolean;
|
|
1967
2039
|
/**
|
|
1968
2040
|
* Optional: Report which subjects this transport is interested in.
|
|
1969
2041
|
* Enables transport-level filtering for efficiency.
|
|
@@ -2060,6 +2132,20 @@ interface BroadcastContext<Request, Response> extends RequestContext<Request, Re
|
|
|
2060
2132
|
* Shared policy constant used when callers omit `RequestOptions.timeout`.
|
|
2061
2133
|
*/
|
|
2062
2134
|
declare const DEFAULT_REQUEST_TIMEOUT_MS = 60000;
|
|
2135
|
+
/**
|
|
2136
|
+
* Default readiness budget in milliseconds for the dispatch readiness gate.
|
|
2137
|
+
*
|
|
2138
|
+
* The gate waits for transports that have not yet completed their `ready`
|
|
2139
|
+
* handshake so that late-arriving remote routes can join the dispatch chain.
|
|
2140
|
+
* That wait is a routing *hint*, not a precondition: it runs on this dedicated
|
|
2141
|
+
* budget rather than on the caller's request timeout, and dispatch proceeds
|
|
2142
|
+
* with the routes known so far once the budget expires.
|
|
2143
|
+
*
|
|
2144
|
+
* Kept short on purpose — a transport that has not synced within this window
|
|
2145
|
+
* is either slow or structurally unable to complete the handshake, and neither
|
|
2146
|
+
* case justifies spending the caller's full request budget.
|
|
2147
|
+
*/
|
|
2148
|
+
declare const DEFAULT_READINESS_TIMEOUT_MS = 1500;
|
|
2063
2149
|
/**
|
|
2064
2150
|
* Options for subscribing to events/requests via on().
|
|
2065
2151
|
*/
|
|
@@ -2146,6 +2232,32 @@ interface RequestOptions extends EmitOptions {
|
|
|
2146
2232
|
* rejected, or cancelled via the `signal` AbortSignal.
|
|
2147
2233
|
*/
|
|
2148
2234
|
timeout?: number;
|
|
2235
|
+
/**
|
|
2236
|
+
* Budget in milliseconds for the dispatch readiness gate.
|
|
2237
|
+
*
|
|
2238
|
+
* When any transport eligible for this request is still completing its `ready`
|
|
2239
|
+
* handshake, dispatch waits up to this long for its routes to arrive, then builds
|
|
2240
|
+
* the handler chain once. The wait happens whether or not a local handler could
|
|
2241
|
+
* answer: a pending peer may yet advertise a *higher-priority* route, and the
|
|
2242
|
+
* cross-transport priority contract says that route runs first. Local-only subjects
|
|
2243
|
+
* (and `transports: []`) never wait, because no peer can contribute to them.
|
|
2244
|
+
*
|
|
2245
|
+
* The practical cost is up to this budget per request during a transport's connect
|
|
2246
|
+
* window, and nothing at all once transports have settled. On expiry dispatch
|
|
2247
|
+
* proceeds with the routes advertised so far — the gate never fails a request, it
|
|
2248
|
+
* only delays it.
|
|
2249
|
+
*
|
|
2250
|
+
* This budget is separate from {@link RequestOptions.timeout} so a transport
|
|
2251
|
+
* that never completes its handshake cannot consume the caller's whole
|
|
2252
|
+
* request budget. The overall request timeout, the request deadline and `signal`
|
|
2253
|
+
* all still bound it.
|
|
2254
|
+
*
|
|
2255
|
+
* Use `0` to disable the cap, matching `timeout: 0` semantics. A non-finite or
|
|
2256
|
+
* negative value is rejected with a `RangeError` at the request seam rather than
|
|
2257
|
+
* being allowed to fail the request from inside the gate.
|
|
2258
|
+
* @defaultValue DEFAULT_READINESS_TIMEOUT_MS (1.5 seconds)
|
|
2259
|
+
*/
|
|
2260
|
+
readinessTimeout?: number;
|
|
2149
2261
|
/**
|
|
2150
2262
|
* AbortSignal to cancel the request.
|
|
2151
2263
|
*
|
|
@@ -4218,4 +4330,4 @@ interface ProjectedTelemetryTransportOptions {
|
|
|
4218
4330
|
*/
|
|
4219
4331
|
declare function createProjectedTelemetryTransport(options: ProjectedTelemetryTransportOptions): BusTransport;
|
|
4220
4332
|
//#endregion
|
|
4221
|
-
export { type BroadcastContext, type BroadcastResult, BusAbortError, type BusBroadcastMessage, type BusBroadcastResponseMessage, BusError, type BusEventMessage, type BusHeartbeatMessage, BusLifecycle, type BusMessage, type BusMessageObserver, type BusNamespace, type BusReceiveHandler, type BusRequestMessage, type BusResponseMessage, type BusSubscribeMessage, type BusSubscribeSyncCompleteMessage, type BusSubscriptionAckMessage, type BusTransport, type BusTransportError, type BusTransportKeys, type BusTransportRegistry, type BusUnsubscribeMessage, type BusUrlConfig, type BusValidationMode, CONNECTION_LOST_ERROR_CODE, ChannelAuthError, ChannelClosedError, type ChannelEndpoint, type ChannelEndpointOptions, ChannelOnlyError, type ConnectOptions, type ConnectedPayload, ConnectionLostError, CorrelationTracker, DEFAULT_REQUEST_TIMEOUT_MS, type DefinedSubjectExtension, type DisconnectedPayload, type EmitOptions, type EventSubjectExtension, type ExtendedSubjectDefinition, type ExtensionNamespace, type ExtensionNamespaceConfig, type ExtensionNamespaceExtensions, type ExtensionNamespaceFromConfig, type IDirectChannel, type IFilteredBus, type IMakaioBus, type InterceptorContext, LOCAL_ORIGIN, LocalSubjectError, MakaioBus, type MakaioBusContext, NO_HANDLER_ERROR_CODE, type NamespaceRegistrationOptions, NoHandlerError, type ObservedBusMessage, type OnOptions, OnceAbortError, type OptionalResult, type ProjectableBusMessage, type ProjectedTelemetryTransportOptions, REMOTE_ORIGIN, RequestError, type RequestOptions, type RequestSubjectExtension, type SchemaViolationCallback, type SchemaViolationReport, type ScopedBus, type ScopedBusFor, type SubjectExtension, type SubjectTelemetryAttributes, type SubjectTelemetryProjectionInput, type SubjectTelemetryProjector, type SubjectTelemetryProjectorInput, type SubjectTelemetryProjectorRegistry, type SubscriptionDeliveryClass, type SubscriptionEntry, SystemChannelSchemas, TimeoutError, type TransportRegistration, ValidationError, __resetWarnedSubjects, buildSubscribeMessage, buildUnsubscribeMessage, channelSubject, collectorOnlySubject, createBusContext, createBusInstance, createChannelEndpoint, createExtensionNamespace, createFilteredBus, createProjectedTelemetryTransport, createSubjectTelemetryProjectorRegistry, defaultTransports, defineSubjectExtension, deserializeTransportError, extendSubjectImpl as extendSubject, findInErrorChain, getFullSubjectForSubjectDefinition, getPath, getSubjectFromBusMessage, handleCorrelationResponse, hostLocalRequest, isNoHandlerErrorForSubject, isRequestCancellation, isRequestSchema, localSubject, matchesAnySubscription, matchesFilter, matchesSubscription, mergeFilters, openChannel, parseBusUrl, projectSubjectTelemetryFacts, serializeTransportError, shouldReceiveMessage, trackMessageCorrelation, transportErrorData, waitForSubscriptionPropagation };
|
|
4333
|
+
export { type BroadcastContext, type BroadcastResult, BusAbortError, type BusBroadcastMessage, type BusBroadcastResponseMessage, BusError, type BusEventMessage, type BusHeartbeatMessage, BusLifecycle, type BusMessage, type BusMessageObserver, type BusNamespace, type BusReceiveHandler, type BusRequestMessage, type BusResponseMessage, type BusSubscribeMessage, type BusSubscribeSyncCompleteMessage, type BusSubscriptionAckMessage, type BusTransport, type BusTransportError, type BusTransportKeys, type BusTransportRegistry, type BusUnsubscribeMessage, type BusUrlConfig, type BusValidationMode, CONNECTION_LOST_ERROR_CODE, ChannelAuthError, ChannelClosedError, type ChannelEndpoint, type ChannelEndpointOptions, ChannelOnlyError, type ConnectOptions, type ConnectedPayload, ConnectionLostError, CorrelationTracker, DEFAULT_READINESS_TIMEOUT_MS, DEFAULT_REQUEST_TIMEOUT_MS, type DefinedSubjectExtension, type DisconnectedPayload, type EmitOptions, type EventSubjectExtension, type ExtendedSubjectDefinition, type ExtensionNamespace, type ExtensionNamespaceConfig, type ExtensionNamespaceExtensions, type ExtensionNamespaceFromConfig, type IDirectChannel, type IFilteredBus, type IMakaioBus, type InterceptorContext, LOCAL_ORIGIN, LocalSubjectError, MakaioBus, type MakaioBusContext, NO_HANDLER_ERROR_CODE, type NamespaceRegistrationOptions, NoHandlerError, type ObservedBusMessage, type OnOptions, OnceAbortError, type OptionalResult, type PendingReadyEntry, type ProjectableBusMessage, type ProjectedTelemetryTransportOptions, REMOTE_ORIGIN, RequestError, type RequestOptions, type RequestSubjectExtension, type SchemaViolationCallback, type SchemaViolationReport, type ScopedBus, type ScopedBusFor, type SubjectExtension, type SubjectTelemetryAttributes, type SubjectTelemetryProjectionInput, type SubjectTelemetryProjector, type SubjectTelemetryProjectorInput, type SubjectTelemetryProjectorRegistry, type SubscriptionDeliveryClass, type SubscriptionEntry, SystemChannelSchemas, TimeoutError, type TransportRegistration, ValidationError, __resetWarnedSubjects, buildSubscribeMessage, buildUnsubscribeMessage, channelSubject, collectorOnlySubject, createBusContext, createBusInstance, createChannelEndpoint, createExtensionNamespace, createFilteredBus, createProjectedTelemetryTransport, createSubjectTelemetryProjectorRegistry, defaultTransports, defineSubjectExtension, deserializeTransportError, extendSubjectImpl as extendSubject, findInErrorChain, getFullSubjectForSubjectDefinition, getPath, getSubjectFromBusMessage, handleCorrelationResponse, hostLocalRequest, isNoHandlerErrorForSubject, isRequestCancellation, isRequestSchema, localSubject, matchesAnySubscription, matchesFilter, matchesSubscription, mergeFilters, openChannel, parseBusUrl, projectSubjectTelemetryFacts, serializeTransportError, shouldReceiveMessage, trackMessageCorrelation, transportErrorData, waitForSubscriptionPropagation };
|
package/dist/bus/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$ as e,A as t,B as n,C as r,D as i,E as a,F as o,G as s,H as c,I as l,J as u,K as d,L as ee,M as f,N as te,O as ne,P as re,Q as ie,R as p,S as m,T as ae,U as oe,V as h,W as g,X as se,Y as ce,Z as _,_ as le,a as ue,b as de,d as v,et as fe,f as pe,g as me,h as y,i as he,it as ge,j as b,k as x,l as S,m as C,nt as w,o as T,p as E,q as D,r as O,rt as k,s as A,t as j,tt as M,u as N,v as P,w as F,x as I,y as L,z as _e}from"../bus-BQ64i3DN.mjs";import{z as R}from"zod";const z={"channel.open":{request:R.object({endpoint:R.string(),token:R.string(),clientPubKey:R.string(),transports:R.array(R.string())}),response:R.object({channelId:R.string(),endpointPubKey:R.string()})}};function B(e){let t=e instanceof Uint8Array?e:new Uint8Array(e),n=Array(t.length);for(let e=0;e<t.length;e++)n[e]=String.fromCharCode(t[e]);return btoa(n.join(``))}function V(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n.buffer}async function H(){return globalThis.crypto.subtle.generateKey({name:`ECDH`,namedCurve:`P-256`},!1,[`deriveKey`])}async function U(e){return B(await globalThis.crypto.subtle.exportKey(`raw`,e))}async function W(e){let t=V(e);return globalThis.crypto.subtle.importKey(`raw`,t,{name:`ECDH`,namedCurve:`P-256`},!1,[])}async function G(e,t){return globalThis.crypto.subtle.deriveKey({name:`ECDH`,public:t},e,{name:`AES-GCM`,length:256},!1,[`encrypt`,`decrypt`])}async function K(e,t,n){let r=globalThis.crypto.getRandomValues(new Uint8Array(12)),i=new TextEncoder().encode(t),a={name:`AES-GCM`,iv:r};n!==void 0&&(a.additionalData=new TextEncoder().encode(n));let o=await globalThis.crypto.subtle.encrypt(a,e,i);return{iv:B(r),data:B(o)}}async function q(e,t,n){let r=V(t.iv),i=V(t.data),a={name:`AES-GCM`,iv:r};n!==void 0&&(a.additionalData=new TextEncoder().encode(n));let o=await globalThis.crypto.subtle.decrypt(a,e,i);return new TextDecoder().decode(o)}function J(e,t){return{subject:t,$meta:{namespace:`channel:${e}`,isRequest:!1,payload:{},local:!1,channel:!1}}}function Y(e,t){return{subject:t,$meta:{namespace:`channel:${e}`,isRequest:!0,payload:{},local:!1,channel:!1}}}var X=class{channelId;sharedKey;context;transportNames;cleanups=[];pendingRequests=new Set;closed=!1;constructor(e,t,n,r){this.channelId=e,this.sharedKey=t,this.context=n,this.transportNames=r;let i=J(e,`$close`);this.cleanups.push(this.registerEventHandler(i,t,e=>{this.handlePeerClose()}))}on(e,t,n){this.assertOpen();let r=this.requireKey(),i=e.$meta.isRequest?this.registerRequestHandler(e,r,t,n):this.registerEventHandler(e,r,t,n);return this.cleanups.push(i),()=>{i();let e=this.cleanups.indexOf(i);e!==-1&&this.cleanups.splice(e,1)}}once(e,t){this.assertOpen();let n=this.requireKey(),r=null,i=(e=>{let n=r;if(r=null,n){let e=this.cleanups.indexOf(n);e!==-1&&this.cleanups.splice(e,1)}return n?.(),t(e)});return r=e.$meta.isRequest?this.registerRequestHandler(e,n,i):this.registerEventHandler(e,n,i),this.cleanups.push(r),()=>{if(r){let e=r;r=null;let t=this.cleanups.indexOf(e);t!==-1&&this.cleanups.splice(t,1),e()}}}async emit(e,t){this.assertOpen();let n=this.requireKey(),r=J(this.channelId,e.subject),i=await K(n,JSON.stringify(t),`${this.channelId}:${e.subject}:evt`);await E(this.context,r,i,{...this.transportNames?{transports:[...this.transportNames]}:{}})}async request(e,t,n){this.assertOpen();let r=this.requireKey(),i=new AbortController;this.pendingRequests.add(i);try{let a=Y(this.channelId,e.subject),o=await K(r,JSON.stringify(t),`${this.channelId}:${e.subject}:req`),s=await q(r,await v(this.context,a,o,{signal:i.signal,...n?.timeout===void 0?{}:{timeout:n.timeout},...this.transportNames?{transports:[...this.transportNames]}:{}}),`${this.channelId}:${e.subject}:res`);return JSON.parse(s)}finally{this.pendingRequests.delete(i)}}async requestOptional(e,t,n){try{return{handled:!0,data:await this.request(e,t,n)}}catch(e){if(e instanceof o)return{handled:!1};throw e}}close(){if(this.closed)return;this.closed=!0;let e=this.sharedKey;if(e){let t=J(this.channelId,`$close`);K(e,JSON.stringify({}),`${this.channelId}:$close:evt`).then(e=>E(this.context,t,e,{...this.transportNames?{transports:[...this.transportNames]}:{}})).catch(()=>{})}this.abortPendingRequests(),this.runCleanups(),this.sharedKey=null}assertOpen(){if(this.closed)throw new n(this.channelId)}requireKey(){return this.sharedKey}registerEventHandler(e,t,n,r){let i=J(this.channelId,e.subject),a=`${this.channelId}:${e.subject}:evt`;return y(this.context,i,async e=>{let r=await q(t,e.payload,a),i=JSON.parse(r);return n({...e,payload:i})},r)}registerRequestHandler(e,t,n,r){let i=Y(this.channelId,e.subject),a=`${this.channelId}:${e.subject}:req`,o=`${this.channelId}:${e.subject}:res`;return y(this.context,i,async e=>{let r=await q(t,e.payload,a),i=JSON.parse(r),s,c=e=>{s={value:e}},l=e=>{s={value:{...s?.value??{},...e}}},u=async()=>{let n=s;if(await e.next(),n!==void 0){s=n;return}let r=e.result;if(r!==void 0){let e=await q(t,r,o);s={value:JSON.parse(e)}}};if(await n({...e,payload:i,get result(){return s?.value},setResult:c,extendResult:l,next:u}),s!==void 0){let n=await K(t,JSON.stringify(s.value),o);e.setResult(n)}},r)}handlePeerClose(){this.closed||(this.closed=!0,this.abortPendingRequests(),this.runCleanups(),this.sharedKey=null)}abortPendingRequests(){let e=new n(this.channelId);for(let t of this.pendingRequests)t.abort(e);this.pendingRequests.clear()}runCleanups(){for(let e of this.cleanups)try{e()}catch{}this.cleanups.length=0}};function Z(e){return e.namespaceRegistry.registerNamespace(_(`system`,z)).subjects.channel.open}function ve(e,t,n,r){let i=y(e,Z(e),async i=>{if(i.payload.endpoint!==t){await i.next();return}if(i.payload.token!==r.token)throw new h(t);let{publicKey:a,privateKey:o}=await H(),s=await G(o,await W(i.payload.clientPubKey)),c=globalThis.crypto.randomUUID(),l=new Set(e.transportRegistry.names()),u=new X(c,s,e,(i.payload.transports??[]).filter(e=>l.has(e)));try{n(u),i.setResult({channelId:c,endpointPubKey:await U(a)})}catch(e){throw u.close(),e}});return{name:t,token:r.token,close:i}}async function ye(e,t,n){let r=Z(e),{publicKey:i,privateKey:a}=await H(),o=await U(i),s=n.transports!==void 0,c=s?[...n.transports]:[...e.transportRegistry.names()],l=s?{transports:c}:void 0,u=await v(e,r,{endpoint:t,token:n.token,clientPubKey:o,transports:c},l),d=await G(a,await W(u.endpointPubKey));return new X(u.channelId,d,e,c)}var be=class{pending;constructor(){this.pending=new Map}track(e,t,n){return new Promise((r,i)=>{if(n?.aborted){i(g(n.reason));return}let a=t===0?void 0:setTimeout(()=>{let n=this.pending.get(e);n!==void 0&&(clearTimeout(n.timeoutId),n.removeAbortListener?.(),this.pending.delete(e),n.reject(new f(e,t)))},t);if(this.pending.set(e,{resolve:r,reject:i,timeoutId:a,removeAbortListener:void 0}),n){let t=()=>{this.reject(e,g(n.reason))};n.addEventListener(`abort`,t,{once:!0});let r=()=>{n.removeEventListener(`abort`,t)},i=this.pending.get(e);i&&(i.removeAbortListener=r)}n?.aborted&&this.reject(e,g(n.reason))})}resolve(e,t){let n=this.pending.get(e);n&&(clearTimeout(n.timeoutId),n.removeAbortListener?.(),this.pending.delete(e),n.resolve(t))}reject(e,t){let n=this.pending.get(e);n&&(clearTimeout(n.timeoutId),n.removeAbortListener?.(),this.pending.delete(e),n.reject(t))}cancel(e,t){this.reject(e,t??g(void 0))}rejectAll(e){for(let[t,n]of this.pending.entries())clearTimeout(n.timeoutId),n.removeAbortListener?.(),n.reject(e);this.pending.clear()}cleanup(){this.rejectAll(Error(`Transport disconnected`))}};const xe=_(`bus:lifecycle`,ue).subjects;function Q(e,t){let n={},r={},i={};for(let[t,a]of e)n[t]=a.priorities,r[t]=a.deliveryClass??`relayable`,a.filter!==void 0&&(i[t]=a.filter);return{type:`subscribe`,...t===void 0?{}:{ackId:t},subjects:n,deliveryClasses:r,...Object.keys(i).length>0&&{filters:i}}}function Se(e,t){return{type:`unsubscribe`,...t===void 0?{}:{ackId:t},subjects:e}}function Ce(e,t){let n=e.trim();if(n.length===0||n.startsWith(`extension:`))throw Error(`Invalid extensionName: expected a non-empty extension name without the "extension:" prefix.`);let r=n;return{..._(`extension:${r}`,t.schemas),domain:r,extensions:t.extensions??{}}}function $(e,t){return`${e}.${t}`}function we(){let e=new Map;return{register(t){let n=$(t.namespace,t.subject);return e.set(n,t),()=>{e.get(n)===t&&e.delete(n)}},get(t,n){return e.get($(t,n))}}}const Te=t.fact.$meta.namespace,Ee=t.fact.subject;function De(e){return e.type===`event`||e.type===`request`||e.type===`broadcast`}async function Oe(e,t,n,r,i,a){let o=C({message:t,direction:`outbound`,observedAt:a(),machineId:i,namespaceRegistry:n,projectorRegistry:r});for(let n of o)await e.send({type:`event`,namespace:Te,subject:Ee,payload:n,messageId:`${t.messageId}:telemetry:${n.factId}`,correlationId:t.correlationId})}function ke(e,t,n,r,i){return async function(a,o){if(!De(a))return!0;if(await Oe(e,a,t,n,r,i),a.type===`request`)throw Error(`Projected telemetry transport cannot satisfy request responses; exclude it from request routing.`);return a.type===`broadcast`?[]:!0}}function Ae(e){let{inner:t,namespaceRegistry:n,projectorRegistry:r,machineId:i,now:a=Date.now}=e,o={name:e.name,send:ke(t,n,r,i,a),onReceive(e){return t.onReceive(async()=>{})},connect(){return t.connect()},disconnect(){return t.disconnect()},subscribe(){return Promise.resolve()},unsubscribe(){return Promise.resolve()},get ready(){return t.ready},get onNewReadySession(){return t.onNewReadySession},set onNewReadySession(e){t.onNewReadySession=e},get onConnected(){return t.onConnected},set onConnected(e){t.onConnected=e},get onDisconnected(){return t.onDisconnected},set onDisconnected(e){t.onDisconnected=e},isReady(){return t.isReady?.()??!0},cancelRequest(e,n){t.cancelRequest?.(e,n)},onBroadcastResults(e,n,r){t.onBroadcastResults?.(e,n,r)}};return t.reconnect&&(o.reconnect=()=>t.reconnect()),o}export{c as BusAbortError,s as BusError,xe as BusLifecycle,ee as CONNECTION_LOST_ERROR_CODE,h as ChannelAuthError,n as ChannelClosedError,_e as ChannelOnlyError,p as ConnectionLostError,be as CorrelationTracker,pe as DEFAULT_REQUEST_TIMEOUT_MS,L as LOCAL_ORIGIN,l as LocalSubjectError,j as MakaioBus,re as NO_HANDLER_ERROR_CODE,o as NoHandlerError,N as OnceAbortError,de as REMOTE_ORIGIN,te as RequestError,z as SystemChannelSchemas,f as TimeoutError,b as ValidationError,le as __resetWarnedSubjects,Q as buildSubscribeMessage,Se as buildUnsubscribeMessage,k as channelSubject,e as collectorOnlySubject,O as createBusContext,he as createBusInstance,ve as createChannelEndpoint,Ce as createExtensionNamespace,S as createFilteredBus,Ae as createProjectedTelemetryTransport,we as createSubjectTelemetryProjectorRegistry,fe as defaultTransports,T as defineSubjectExtension,ae as deserializeTransportError,A as extendSubject,a as findInErrorChain,ie as getFullSubjectForSubjectDefinition,d as getPath,i as getSubjectFromBusMessage,I as handleCorrelationResponse,M as hostLocalRequest,ne as isNoHandlerErrorForSubject,oe as isRequestCancellation,ge as isRequestSchema,w as localSubject,ce as matchesAnySubscription,D as matchesFilter,se as matchesSubscription,u as mergeFilters,ye as openChannel,P as parseBusUrl,C as projectSubjectTelemetryFacts,m as serializeTransportError,r as shouldReceiveMessage,F as trackMessageCorrelation,x as transportErrorData,me as waitForSubscriptionPropagation};
|
|
1
|
+
import{$ as e,A as t,B as n,C as r,D as i,E as a,F as o,G as s,H as c,I as l,J as u,K as d,L as ee,M as te,N as f,O as ne,P as re,Q as p,R as m,S as h,T as ie,U as ae,V as g,W as oe,X as se,Y as ce,Z as le,_ as ue,a as de,at as fe,b as pe,d as _,et as me,f as he,g as v,h as y,i as ge,it as b,j as x,k as S,l as C,m as w,nt as T,o as E,p as D,q as O,r as k,rt as A,s as j,t as M,tt as N,u as P,v as F,w as I,x as L,y as _e,z as ve}from"../bus-ceMF9rsq.mjs";import{z as R}from"zod";const z={"channel.open":{request:R.object({endpoint:R.string(),token:R.string(),clientPubKey:R.string(),transports:R.array(R.string())}),response:R.object({channelId:R.string(),endpointPubKey:R.string()})}};function B(e){let t=e instanceof Uint8Array?e:new Uint8Array(e),n=Array(t.length);for(let e=0;e<t.length;e++)n[e]=String.fromCharCode(t[e]);return btoa(n.join(``))}function V(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n.buffer}async function H(){return globalThis.crypto.subtle.generateKey({name:`ECDH`,namedCurve:`P-256`},!1,[`deriveKey`])}async function U(e){return B(await globalThis.crypto.subtle.exportKey(`raw`,e))}async function W(e){let t=V(e);return globalThis.crypto.subtle.importKey(`raw`,t,{name:`ECDH`,namedCurve:`P-256`},!1,[])}async function G(e,t){return globalThis.crypto.subtle.deriveKey({name:`ECDH`,public:t},e,{name:`AES-GCM`,length:256},!1,[`encrypt`,`decrypt`])}async function K(e,t,n){let r=globalThis.crypto.getRandomValues(new Uint8Array(12)),i=new TextEncoder().encode(t),a={name:`AES-GCM`,iv:r};n!==void 0&&(a.additionalData=new TextEncoder().encode(n));let o=await globalThis.crypto.subtle.encrypt(a,e,i);return{iv:B(r),data:B(o)}}async function q(e,t,n){let r=V(t.iv),i=V(t.data),a={name:`AES-GCM`,iv:r};n!==void 0&&(a.additionalData=new TextEncoder().encode(n));let o=await globalThis.crypto.subtle.decrypt(a,e,i);return new TextDecoder().decode(o)}function J(e,t){return{subject:t,$meta:{namespace:`channel:${e}`,isRequest:!1,payload:{},local:!1,channel:!1}}}function Y(e,t){return{subject:t,$meta:{namespace:`channel:${e}`,isRequest:!0,payload:{},local:!1,channel:!1}}}var X=class{channelId;sharedKey;context;transportNames;cleanups=[];pendingRequests=new Set;closed=!1;constructor(e,t,n,r){this.channelId=e,this.sharedKey=t,this.context=n,this.transportNames=r;let i=J(e,`$close`);this.cleanups.push(this.registerEventHandler(i,t,e=>{this.handlePeerClose()}))}on(e,t,n){this.assertOpen();let r=this.requireKey(),i=e.$meta.isRequest?this.registerRequestHandler(e,r,t,n):this.registerEventHandler(e,r,t,n);return this.cleanups.push(i),()=>{i();let e=this.cleanups.indexOf(i);e!==-1&&this.cleanups.splice(e,1)}}once(e,t){this.assertOpen();let n=this.requireKey(),r=null,i=(e=>{let n=r;if(r=null,n){let e=this.cleanups.indexOf(n);e!==-1&&this.cleanups.splice(e,1)}return n?.(),t(e)});return r=e.$meta.isRequest?this.registerRequestHandler(e,n,i):this.registerEventHandler(e,n,i),this.cleanups.push(r),()=>{if(r){let e=r;r=null;let t=this.cleanups.indexOf(e);t!==-1&&this.cleanups.splice(t,1),e()}}}async emit(e,t){this.assertOpen();let n=this.requireKey(),r=J(this.channelId,e.subject),i=await K(n,JSON.stringify(t),`${this.channelId}:${e.subject}:evt`);await w(this.context,r,i,{...this.transportNames?{transports:[...this.transportNames]}:{}})}async request(e,t,n){this.assertOpen();let r=this.requireKey(),i=new AbortController;this.pendingRequests.add(i);try{let a=Y(this.channelId,e.subject),o=await K(r,JSON.stringify(t),`${this.channelId}:${e.subject}:req`),s=await q(r,await _(this.context,a,o,{signal:i.signal,...n?.timeout===void 0?{}:{timeout:n.timeout},...this.transportNames?{transports:[...this.transportNames]}:{}}),`${this.channelId}:${e.subject}:res`);return JSON.parse(s)}finally{this.pendingRequests.delete(i)}}async requestOptional(e,t,n){try{return{handled:!0,data:await this.request(e,t,n)}}catch(e){if(e instanceof l)return{handled:!1};throw e}}close(){if(this.closed)return;this.closed=!0;let e=this.sharedKey;if(e){let t=J(this.channelId,`$close`);K(e,JSON.stringify({}),`${this.channelId}:$close:evt`).then(e=>w(this.context,t,e,{...this.transportNames?{transports:[...this.transportNames]}:{}})).catch(()=>{})}this.abortPendingRequests(),this.runCleanups(),this.sharedKey=null}assertOpen(){if(this.closed)throw new g(this.channelId)}requireKey(){return this.sharedKey}registerEventHandler(e,t,n,r){let i=J(this.channelId,e.subject),a=`${this.channelId}:${e.subject}:evt`;return v(this.context,i,async e=>{let r=await q(t,e.payload,a),i=JSON.parse(r);return n({...e,payload:i})},r)}registerRequestHandler(e,t,n,r){let i=Y(this.channelId,e.subject),a=`${this.channelId}:${e.subject}:req`,o=`${this.channelId}:${e.subject}:res`;return v(this.context,i,async e=>{let r=await q(t,e.payload,a),i=JSON.parse(r),s,c=e=>{s={value:e}},l=e=>{s={value:{...s?.value??{},...e}}},u=async()=>{let n=s;if(await e.next(),n!==void 0){s=n;return}let r=e.result;if(r!==void 0){let e=await q(t,r,o);s={value:JSON.parse(e)}}};if(await n({...e,payload:i,get result(){return s?.value},setResult:c,extendResult:l,next:u}),s!==void 0){let n=await K(t,JSON.stringify(s.value),o);e.setResult(n)}},r)}handlePeerClose(){this.closed||(this.closed=!0,this.abortPendingRequests(),this.runCleanups(),this.sharedKey=null)}abortPendingRequests(){let e=new g(this.channelId);for(let t of this.pendingRequests)t.abort(e);this.pendingRequests.clear()}runCleanups(){for(let e of this.cleanups)try{e()}catch{}this.cleanups.length=0}};function Z(e){return e.namespaceRegistry.registerNamespace(p(`system`,z)).subjects.channel.open}function ye(e,t,n,r){let i=v(e,Z(e),async i=>{if(i.payload.endpoint!==t){await i.next();return}if(i.payload.token!==r.token)throw new c(t);let{publicKey:a,privateKey:o}=await H(),s=await G(o,await W(i.payload.clientPubKey)),l=globalThis.crypto.randomUUID(),u=new Set(e.transportRegistry.names()),d=new X(l,s,e,(i.payload.transports??[]).filter(e=>u.has(e)));try{n(d),i.setResult({channelId:l,endpointPubKey:await U(a)})}catch(e){throw d.close(),e}});return{name:t,token:r.token,close:i}}async function be(e,t,n){let r=Z(e),{publicKey:i,privateKey:a}=await H(),o=await U(i),s=n.transports!==void 0,c=s?[...n.transports]:[...e.transportRegistry.names()],l=s?{transports:c}:void 0,u=await _(e,r,{endpoint:t,token:n.token,clientPubKey:o,transports:c},l),d=await G(a,await W(u.endpointPubKey));return new X(u.channelId,d,e,c)}var xe=class{pending;constructor(){this.pending=new Map}track(e,t,n){return new Promise((r,i)=>{if(n?.aborted){i(s(n.reason));return}let a=t===0?void 0:setTimeout(()=>{let n=this.pending.get(e);n!==void 0&&(clearTimeout(n.timeoutId),n.removeAbortListener?.(),this.pending.delete(e),n.reject(new f(e,t)))},t);if(this.pending.set(e,{resolve:r,reject:i,timeoutId:a,removeAbortListener:void 0}),n){let t=()=>{this.reject(e,s(n.reason))};n.addEventListener(`abort`,t,{once:!0});let r=()=>{n.removeEventListener(`abort`,t)},i=this.pending.get(e);i&&(i.removeAbortListener=r)}n?.aborted&&this.reject(e,s(n.reason))})}resolve(e,t){let n=this.pending.get(e);n&&(clearTimeout(n.timeoutId),n.removeAbortListener?.(),this.pending.delete(e),n.resolve(t))}reject(e,t){let n=this.pending.get(e);n&&(clearTimeout(n.timeoutId),n.removeAbortListener?.(),this.pending.delete(e),n.reject(t))}cancel(e,t){this.reject(e,t??s(void 0))}rejectAll(e){for(let[t,n]of this.pending.entries())clearTimeout(n.timeoutId),n.removeAbortListener?.(),n.reject(e);this.pending.clear()}cleanup(){this.rejectAll(Error(`Transport disconnected`))}};const Se=p(`bus:lifecycle`,de).subjects;function Ce(e,t){let n={},r={},i={};for(let[t,a]of e)n[t]=a.priorities,r[t]=a.deliveryClass??`relayable`,a.filter!==void 0&&(i[t]=a.filter);return{type:`subscribe`,...t===void 0?{}:{ackId:t},subjects:n,deliveryClasses:r,...Object.keys(i).length>0&&{filters:i}}}function we(e,t){return{type:`unsubscribe`,...t===void 0?{}:{ackId:t},subjects:e}}function Q(e,t){let n=e.trim();if(n.length===0||n.startsWith(`extension:`))throw Error(`Invalid extensionName: expected a non-empty extension name without the "extension:" prefix.`);let r=n;return{...p(`extension:${r}`,t.schemas),domain:r,extensions:t.extensions??{}}}function $(e,t){return`${e}.${t}`}function Te(){let e=new Map;return{register(t){let n=$(t.namespace,t.subject);return e.set(n,t),()=>{e.get(n)===t&&e.delete(n)}},get(t,n){return e.get($(t,n))}}}const Ee=x.fact.$meta.namespace,De=x.fact.subject;function Oe(e){return e.type===`event`||e.type===`request`||e.type===`broadcast`}async function ke(e,t,n,r,i,a){let o=y({message:t,direction:`outbound`,observedAt:a(),machineId:i,namespaceRegistry:n,projectorRegistry:r});for(let n of o)await e.send({type:`event`,namespace:Ee,subject:De,payload:n,messageId:`${t.messageId}:telemetry:${n.factId}`,correlationId:t.correlationId})}function Ae(e,t,n,r,i){return async function(a,o){if(!Oe(a))return!0;if(await ke(e,a,t,n,r,i),a.type===`request`)throw Error(`Projected telemetry transport cannot satisfy request responses; exclude it from request routing.`);return a.type===`broadcast`?[]:!0}}function je(e){let{inner:t,namespaceRegistry:n,projectorRegistry:r,machineId:i,now:a=Date.now}=e,o={name:e.name,send:Ae(t,n,r,i,a),onReceive(e){return t.onReceive(async()=>{})},connect(){return t.connect()},disconnect(){return t.disconnect()},subscribe(){return Promise.resolve()},unsubscribe(){return Promise.resolve()},get ready(){return t.ready},get onNewReadySession(){return t.onNewReadySession},set onNewReadySession(e){t.onNewReadySession=e},get onConnected(){return t.onConnected},set onConnected(e){t.onConnected=e},get onDisconnected(){return t.onDisconnected},set onDisconnected(e){t.onDisconnected=e},isReady(){return t.isReady?.()??!0},cancelRequest(e,n){t.cancelRequest?.(e,n)},onBroadcastResults(e,n,r){t.onBroadcastResults?.(e,n,r)}};return t.reconnect&&(o.reconnect=()=>t.reconnect()),o}export{ae as BusAbortError,d as BusError,Se as BusLifecycle,m as CONNECTION_LOST_ERROR_CODE,c as ChannelAuthError,g as ChannelClosedError,n as ChannelOnlyError,ve as ConnectionLostError,xe as CorrelationTracker,he as DEFAULT_READINESS_TIMEOUT_MS,D as DEFAULT_REQUEST_TIMEOUT_MS,pe as LOCAL_ORIGIN,ee as LocalSubjectError,M as MakaioBus,o as NO_HANDLER_ERROR_CODE,l as NoHandlerError,P as OnceAbortError,L as REMOTE_ORIGIN,re as RequestError,z as SystemChannelSchemas,f as TimeoutError,te as ValidationError,F as __resetWarnedSubjects,Ce as buildSubscribeMessage,we as buildUnsubscribeMessage,b as channelSubject,me as collectorOnlySubject,k as createBusContext,ge as createBusInstance,ye as createChannelEndpoint,Q as createExtensionNamespace,C as createFilteredBus,je as createProjectedTelemetryTransport,Te as createSubjectTelemetryProjectorRegistry,N as defaultTransports,E as defineSubjectExtension,a as deserializeTransportError,j as extendSubject,i as findInErrorChain,e as getFullSubjectForSubjectDefinition,O as getPath,ne as getSubjectFromBusMessage,h as handleCorrelationResponse,T as hostLocalRequest,S as isNoHandlerErrorForSubject,oe as isRequestCancellation,fe as isRequestSchema,A as localSubject,se as matchesAnySubscription,u as matchesFilter,le as matchesSubscription,ce as mergeFilters,be as openChannel,_e as parseBusUrl,y as projectSubjectTelemetryFacts,r as serializeTransportError,I as shouldReceiveMessage,ie as trackMessageCorrelation,t as transportErrorData,ue as waitForSubscriptionPropagation};
|