@makaio/framework 1.0.0-dev-1785409369816 → 1.0.0-dev-1787670071418
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/.makaio-build.json +4 -3
- package/dist/{account-identity-DFx8pwKL.mjs → account-identity-B3vLwm9O.mjs} +1 -1
- package/dist/adapter-Dz1fX5Wa.mjs +1 -0
- package/dist/adapter-subsystem/index.d.mts +194 -20
- package/dist/adapter-subsystem/index.mjs +1 -1
- package/dist/adapters/acp-client/index.d.mts +105 -7
- package/dist/adapters/acp-client/index.mjs +2 -2
- package/dist/adapters/claude/index.d.mts +5 -5
- package/dist/adapters/config/index.d.mts +1 -1
- package/dist/adapters/config/index.mjs +1 -1
- package/dist/adapters/index.d.mts +405 -824
- package/dist/adapters/index.mjs +6 -6
- package/dist/adapters/node.d.mts +1 -1
- package/dist/adapters/node.mjs +1 -1
- package/dist/adapters/stream-session/index.d.mts +28 -7
- package/dist/adapters/stream-session/index.mjs +1 -1
- package/dist/{ajv-DD3SIL2i.mjs → ajv-krzJXh1X.mjs} +2 -2
- package/dist/artifact-Btbuib48.mjs +1 -0
- package/dist/attach-error-Cb3GbeKe.mjs +1 -0
- package/dist/{auth-DGEdiHF6.mjs → auth-C6tVtaOX.mjs} +1 -1
- package/dist/authority-state-bootstrap-CLYus369.mjs +1 -0
- package/dist/automation-trigger-ByjNlClm.mjs +1 -0
- package/dist/await-trigger-Bkg2BQfg.mjs +1 -0
- package/dist/bus/index.d.mts +41 -9
- package/dist/bus/index.mjs +1 -1
- package/dist/bus-D6NoBhIV.mjs +2 -0
- package/dist/bus-UgFdHybD.mjs +1 -0
- package/dist/caller-owned-adapter-stub-C1M7FKrv.mjs +1 -0
- package/dist/{canonical-model-BAytQ4NV.mjs → canonical-model-DXOvCaVg.mjs} +1 -1
- package/dist/capabilities-BUwuA7XX.mjs +1 -0
- package/dist/capability-j3NekkIu.mjs +1 -0
- package/dist/{client-DbS847wW.mjs → client-BkznbdsO.mjs} +1 -1
- package/dist/clients/index.d.mts +2 -2
- package/dist/clients/index.mjs +1 -1
- package/dist/clients/managed-install.d.mts +1 -1
- package/dist/clients/managed-install.mjs +1 -1
- package/dist/code-execution/worker-entry.d.mts +21 -0
- package/dist/code-execution/worker-entry.mjs +1 -0
- package/dist/code-execution-Ckmn8OZu.mjs +1 -0
- package/dist/code-execution-CweDSWco.mjs +1 -0
- package/dist/code-execution-DqkQjKa1.mjs +1 -0
- package/dist/{compression-74fFeBha.mjs → compression-CtgeVLpP.mjs} +1 -1
- package/dist/{config-namespace-TVX-hG4I.mjs → config-namespace-CjWvw8ij.mjs} +1 -1
- package/dist/{context-resolution-DdyhpH4L.d.mts → context-resolution-841T7jBI.d.mts} +11 -11
- package/dist/contracts/adapter/index.d.mts +3 -3
- 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 +3 -3
- package/dist/contracts/artifact/index.mjs +1 -1
- package/dist/contracts/auth/index.d.mts +2 -2
- package/dist/contracts/auth/index.mjs +1 -1
- package/dist/contracts/automation-trigger/index.d.mts +4 -0
- package/dist/contracts/automation-trigger/index.mjs +1 -0
- package/dist/contracts/canonical-model/index.d.mts +1 -1
- package/dist/contracts/canonical-model/index.mjs +1 -1
- package/dist/contracts/capabilities/index.d.mts +1 -1
- package/dist/contracts/capabilities/index.mjs +1 -1
- package/dist/contracts/client/index.d.mts +2 -2
- package/dist/contracts/client/index.mjs +1 -1
- package/dist/contracts/code-execution/index.d.mts +2 -0
- package/dist/contracts/code-execution/index.mjs +1 -0
- package/dist/contracts/common/index.d.mts +1 -1
- package/dist/contracts/config/index.d.mts +1 -1
- package/dist/contracts/config/index.mjs +1 -1
- package/dist/contracts/extension/index.d.mts +6 -5
- package/dist/contracts/extension/index.mjs +1 -1
- package/dist/contracts/facet/index.d.mts +1 -1
- package/dist/contracts/facet/index.mjs +1 -1
- package/dist/contracts/harness/index.d.mts +1 -1
- package/dist/contracts/harness/index.mjs +1 -1
- package/dist/contracts/host/index.d.mts +1 -1
- package/dist/contracts/host/index.mjs +1 -1
- package/dist/contracts/index.d.mts +171 -100
- package/dist/contracts/index.mjs +1 -1
- package/dist/contracts/materialization/index.d.mts +3 -3
- package/dist/contracts/materialization/index.mjs +1 -1
- package/dist/contracts/model-registry/index.d.mts +1 -1
- package/dist/contracts/model-registry/index.mjs +1 -1
- package/dist/contracts/native-session-supervisor/index.d.mts +1 -1
- package/dist/contracts/native-session-supervisor/index.mjs +1 -1
- package/dist/contracts/platform/index.d.mts +1 -1
- package/dist/contracts/platform/index.mjs +1 -1
- package/dist/contracts/provider/index.d.mts +2 -2
- package/dist/contracts/provider/index.mjs +1 -1
- package/dist/contracts/reaction/index.d.mts +2 -0
- package/dist/contracts/reaction/index.mjs +1 -0
- package/dist/contracts/session/index.d.mts +3 -3
- package/dist/contracts/session/index.mjs +1 -1
- package/dist/contracts/shared/index.d.mts +3 -3
- package/dist/contracts/shared/index.mjs +1 -1
- package/dist/contracts/skill/index.d.mts +1 -1
- package/dist/contracts/skill/index.mjs +1 -1
- package/dist/contracts/telemetry/index.d.mts +1 -1
- package/dist/contracts/telemetry/index.mjs +1 -1
- package/dist/contracts/timeout/index.d.mts +1 -1
- package/dist/contracts/timeout/index.mjs +1 -1
- package/dist/contracts/toast/index.mjs +1 -1
- package/dist/contracts/variant/index.d.mts +1 -1
- package/dist/contracts/variant/index.mjs +1 -1
- package/dist/contracts/worker-node/index.d.mts +1 -1
- package/dist/contracts/worker-node/index.mjs +1 -1
- package/dist/contracts/workflow/index.d.mts +3 -3
- package/dist/contracts/workflow/index.mjs +1 -1
- package/dist/contribution-CUHLVLsT.d.mts +35 -0
- package/dist/core/index.d.mts +84 -2
- package/dist/core/index.mjs +1 -1
- package/dist/{definition-CJfiv8xm.mjs → definition-BH4QLGLI.mjs} +1 -1
- package/dist/definition-DyGImhyi.d.mts +375 -0
- package/dist/{detached-extension-handle-Ddfquy5_.mjs → detached-extension-handle-D0aI0pJA.mjs} +1 -1
- package/dist/drizzle/0031_adapter_session_currency.sql +66 -0
- package/dist/drizzle/0032_native_session_ownership.sql +77 -0
- package/dist/drizzle/0033_m_msf3hu2s.sql +1 -0
- package/dist/drizzle/0034_m_msha1388.sql +41 -0
- package/dist/drizzle/0035_m_mshgj6x7.sql +40 -0
- package/dist/drizzle/0036_m_msivwbgm.sql +1 -0
- package/dist/drizzle/0037_runtime_instance_incarnation_counter.sql +6 -0
- package/dist/drizzle/meta/_journal.json +49 -0
- package/dist/event-B8ELuk6k.mjs +1 -0
- package/dist/{execution-attempt-repository-DWXKY41_.d.mts → execution-attempt-repository-BJ2W6wwx.d.mts} +1 -1
- package/dist/{execution-target-Cf645pDj.mjs → execution-target-H0RWV7Py.mjs} +1 -1
- package/dist/extension-Bfkr2DBs.mjs +1 -0
- package/dist/extension-Cz39YNXy.mjs +1 -0
- package/dist/extension-context-QmFuHdq5.d.mts +295 -0
- package/dist/{extension-discovery-CQRdbVQ6.d.mts → extension-discovery-Dhu3WplO.d.mts} +11 -1
- package/dist/{extension-namespace-Yu41YepM.mjs → extension-namespace-QoTTwKPt.mjs} +1 -1
- package/dist/extension-package-provenance-aYrZuS4W.mjs +1 -0
- package/dist/{filesystem-service-DlP2HfDg.mjs → filesystem-service-CiUw0YN5.mjs} +1 -1
- package/dist/framework-packages-BHgul8Kl.mjs +1 -0
- package/dist/git/index.mjs +2 -2
- package/dist/{globby-1yCVCk8s.mjs → globby-QBDqstzq.mjs} +1 -1
- package/dist/handlers-BsHAFtye.mjs +57 -0
- package/dist/{harness-DpwsFsE7.mjs → harness-YQ2ewID9.mjs} +1 -1
- package/dist/{hook-responses-Dh1PWXqJ.d.mts → hook-responses-9Ywsqzzq.d.mts} +2 -293
- package/dist/identity-OjRlG6dZ.mjs +1 -0
- package/dist/{index-CMgLxw14.d.mts → index-8NdPPzUh2.d.mts} +2 -2
- package/dist/{index-Ds5_rDEJ.d.mts → index-8y4hT9WL.d.mts} +1 -12
- package/dist/{index-BVlXneHH.d.mts → index-B-3I98nw.d.mts} +14 -10
- package/dist/index-B0VO0rAl.d.mts +302 -0
- package/dist/{index-gUhidukN.d.mts → index-B0yMCJW8.d.mts} +324 -2
- package/dist/index-BM56936c.d.mts +165 -0
- package/dist/{index-CLvQsL6s2.d.mts → index-BNzUyVwV.d.mts} +2105 -320
- package/dist/{index-BaZeoZoS.d.mts → index-BTEJfzjE.d.mts} +1 -1
- package/dist/{index-B0Kf_OWi.d.mts → index-BfV8U4XX.d.mts} +1 -1
- package/dist/{index-DCZ8BX9S.d.mts → index-BkbnC65b.d.mts} +487 -85
- package/dist/{index-GHASUiem.d.mts → index-BmevAPME2.d.mts} +1 -1
- package/dist/index-Bqk0pJBQ2.d.mts +138 -0
- package/dist/{index-B9UW_vPM.d.mts → index-C146Eq_J.d.mts} +2465 -273
- package/dist/{index-BAXkicoQ.d.mts → index-CIEycZrt.d.mts} +1 -1
- package/dist/{index-DkiTJM5p.d.mts → index-CMekqu_D.d.mts} +44 -10
- package/dist/{index-SsBHjUqA.d.mts → index-CPRQ4dWX.d.mts} +0 -23
- package/dist/{index-EjsSBQXy2.d.mts → index-CPi0UpRh.d.mts} +1 -1
- package/dist/{index-DSBT83c0.d.mts → index-CYjgoYeX.d.mts} +24 -3
- package/dist/{index-DnG-QFpG.d.mts → index-CmwAJ8-5.d.mts} +18 -1
- package/dist/index-Cny5RvjO.d.mts +800 -0
- package/dist/{index-BNMnIe-j.d.mts → index-D-4jv_66.d.mts} +434 -863
- package/dist/{index-brqfk9JQ.d.mts → index-D8D-yibS2.d.mts} +4 -4
- package/dist/index-DHnSLGP4.d.mts +268 -0
- package/dist/{index-D5Nb7IEP.d.mts → index-DI2lS7VT.d.mts} +79 -41
- package/dist/{index-D_ODXsBv.d.mts → index-DJ2KgJDJ2.d.mts} +51 -95
- package/dist/{index-cqLS1eFV.d.mts → index-DNI6UF9h.d.mts} +133 -134
- package/dist/index-DQ8o3JGi.d.mts +132 -0
- package/dist/index-DWBkiiXH.d.mts +18 -0
- package/dist/{index-DlsHL9Jg.d.mts → index-DXtQRehh.d.mts} +12 -12
- package/dist/{index-4VfqCjl2.d.mts → index-D_4K3Tf_.d.mts} +79 -194
- package/dist/index-Dg11JxKZ.d.mts +496 -0
- package/dist/json-value-BBZ6uGwc.mjs +1 -0
- package/dist/json-value-DPqb-SJ8.d.mts +177 -0
- package/dist/kernel/cli/index.d.mts +2 -2
- package/dist/kernel/cli/index.mjs +1 -1
- package/dist/kernel/cli/register.d.mts +1 -1
- package/dist/kernel/cli/register.mjs +1 -1
- package/dist/kernel/cli/schemas.mjs +1 -1
- package/dist/kernel/extension/index.d.mts +1 -1
- package/dist/kernel/extension/index.mjs +1 -1
- package/dist/kernel/index.d.mts +9 -9
- package/dist/kernel/index.mjs +1 -1
- package/dist/kernel/namespace/index.d.mts +2 -2
- package/dist/kernel/namespace/index.mjs +1 -1
- package/dist/kernel/observability/index.d.mts +1 -1
- package/dist/kernel/observability/index.mjs +1 -1
- package/dist/kernel/providers/index.d.mts +1 -1
- package/dist/kernel/providers/index.mjs +1 -1
- package/dist/kernel/window/index.d.mts +1 -1
- package/dist/kernel/window/index.mjs +1 -1
- package/dist/{lib-DErgth_E.mjs → lib-BpGvHZye.mjs} +2 -2
- package/dist/{lib-C7-s68uf.mjs → lib-Cm-uEoC1.mjs} +1 -1
- package/dist/{load-extensions-BxsDB87B.d.mts → load-extensions-BQoXaHhR.d.mts} +17 -13
- package/dist/load-extensions-DG5LvPyM.mjs +1 -0
- package/dist/{materialization-Jd198K3y.mjs → materialization-lVd9_-jr.mjs} +1 -1
- package/dist/mcp-http-server/index.mjs +1 -1
- package/dist/model-DrzPt3ou.mjs +1 -0
- package/dist/{namespace-BqxtpNAn.mjs → namespace-BL7lHlmg.mjs} +1 -1
- package/dist/{namespace-CjjFvrIA2.d.mts → namespace-BNp7n_gu.d.mts} +25 -25
- package/dist/{namespace-g_mbIZq_.d.mts → namespace-BRuHzhPo.d.mts} +564 -28
- package/dist/{namespace-DV-Hr9sZ.d.mts → namespace-C06lJSuj.d.mts} +17 -7
- package/dist/{namespace-TseEI3Pu.d.mts → namespace-DOezqDti.d.mts} +18 -10
- package/dist/{namespace-CErHuXtb.d.mts → namespace-DknCutQZ.d.mts} +50 -0
- package/dist/{namespace-B8uKAzWJ.mjs → namespace-Du0accdE.mjs} +1 -1
- package/dist/{namespace-CWUDFGOy.mjs → namespace-NXm_zvL1.mjs} +1 -1
- package/dist/{namespace-CupOzbRv.d.mts → namespace-l-HG1rLF.d.mts} +24 -20
- package/dist/namespace-sCPb79-7.mjs +1 -0
- package/dist/{native-session-supervisor-DRx0MX-d.mjs → native-session-supervisor-LKio8XZn.mjs} +1 -1
- package/dist/node/bus-server/index.d.mts +1 -1
- package/dist/node/bus-server/index.mjs +1 -1
- package/dist/node/bus-server/server-lifecycle.d.mts +1 -1
- package/dist/node/bus-server/server-lifecycle.mjs +1 -1
- package/dist/npm-package-name-DuTYVICk.mjs +1 -0
- package/dist/orchestrator-shared-BGlN-m-V.mjs +1 -0
- package/dist/{orchestrator-shared-BHCv-l2O.d.mts → orchestrator-shared-CNHSImNY.d.mts} +10 -10
- package/dist/ownership-memory-handler-BpGdR_uG.mjs +1 -0
- package/dist/ownership-recovery-guard-DyW5vGBr.mjs +1 -0
- package/dist/package-B01gmu75.mjs +7 -0
- package/dist/{package-DWMxGfzK.d.mts → package-BNFTUFLB.d.mts} +234 -84
- package/dist/package-DttKA9wN.mjs +1 -0
- package/dist/package-EGTn-Ng1.mjs +1 -0
- package/dist/package-JtjbO-Oi.mjs +1 -0
- package/dist/package.json +1 -1
- package/dist/{profile-BTAI31Nt.mjs → profile-N5qGUpF0.mjs} +1 -1
- package/dist/{provider-context-PZIQWcqQ.mjs → provider-context-CG42JlP9.mjs} +1 -1
- package/dist/{provider-context-Dq53Cgzz.mjs → provider-context-zTDSH2x9.mjs} +1 -1
- package/dist/reaction-D3TNwPK8.mjs +1 -0
- package/dist/{registry-wfF2uTty.mjs → registry-Dk12tAfv.mjs} +2 -2
- package/dist/{resolved-DZgqql2Z.mjs → resolved-sq8RXNDf.mjs} +1 -1
- package/dist/rules/index.d.mts +1 -1
- package/dist/rules/index.mjs +1 -1
- package/dist/rules/schemas.d.mts +1 -1
- package/dist/rules/schemas.mjs +1 -1
- package/dist/runtime-bun/index.mjs +1 -1
- package/dist/runtime-node/code-execution/index.d.mts +3 -0
- package/dist/runtime-node/code-execution/index.mjs +1 -0
- 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 +7 -5
- package/dist/runtime-node/index.mjs +24 -24
- package/dist/runtime-node/makaio-config.d.mts +1 -1
- package/dist/runtime-node/makaio-config.mjs +1 -1
- package/dist/runtime-node/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-DKUb4rkr.d.mts → schema-B3Pf7JP7.d.mts} +778 -21
- package/dist/{schema-Dd-e89MO.mjs → schema-Dq-7si8u.mjs} +1 -1
- package/dist/{schemas-B1NWNASS.d.mts → schemas-BXc9qOpl.d.mts} +2 -0
- package/dist/schemas-BfO5jkrL.mjs +1 -0
- package/dist/{schemas-CR8hSqTy.d.mts → schemas-C1mxTfd7.d.mts} +60 -4
- package/dist/schemas-C3kyQWGf.mjs +1 -0
- package/dist/{schemas-DnYiAvfz.d.mts → schemas-D7ScxLrf.d.mts} +24 -20
- package/dist/{schemas-BsVYZviy.d.mts → schemas-OWvBn7AH.d.mts} +4 -4
- package/dist/{schemas-DaHQzpgm.mjs → schemas-QWDnauKX.mjs} +1 -1
- package/dist/schemas-TK29KWx-.mjs +1 -0
- package/dist/schemas-_2Syo_01.mjs +1 -0
- package/dist/scoped-bus-DoPmCJeM.mjs +1 -0
- package/dist/{selection-BNwTKEVT.mjs → selection-DL3ric7K.mjs} +1 -1
- package/dist/services/adapter-runtime/index.d.mts +4 -4
- package/dist/services/adapter-runtime/index.mjs +1 -1
- package/dist/services/adapter-runtime/namespace.d.mts +1 -1
- package/dist/services/adapter-runtime/schemas.d.mts +2 -2
- package/dist/services/adapter-runtime/schemas.mjs +1 -1
- package/dist/services/adapter-subsystem/index.d.mts +4 -4
- package/dist/services/adapter-subsystem/index.mjs +1 -1
- package/dist/services/adapter-subsystem/namespace.d.mts +2 -2
- package/dist/services/adapter-subsystem/namespace.mjs +1 -1
- package/dist/services/agent-runtime/index.d.mts +2 -2
- package/dist/services/agent-runtime/namespace.d.mts +1 -1
- package/dist/services/agent-runtime/schemas.d.mts +1 -1
- package/dist/services/automation-trigger/index.d.mts +943 -0
- package/dist/services/automation-trigger/index.mjs +1 -0
- package/dist/services/capability/index.d.mts +3 -2
- package/dist/services/capability/index.mjs +1 -1
- package/dist/services/code-execution/index.d.mts +2 -0
- package/dist/services/code-execution/index.mjs +1 -0
- package/dist/services/codebase/index.d.mts +2 -2
- package/dist/services/codebase/namespace.d.mts +1 -1
- package/dist/services/codebase/schemas.d.mts +1 -1
- package/dist/services/compression/index.d.mts +2 -2
- package/dist/services/compression/namespace.d.mts +1 -1
- package/dist/services/compression/schemas.d.mts +1 -1
- package/dist/services/context-rules/index.d.mts +1 -1
- package/dist/services/context-rules/index.mjs +1 -1
- package/dist/services/execution-target/index.d.mts +3 -3
- package/dist/services/execution-target/index.mjs +1 -1
- package/dist/services/execution-target/namespace.d.mts +1 -1
- package/dist/services/execution-target/namespace.mjs +1 -1
- package/dist/services/execution-target/schemas.d.mts +1 -1
- package/dist/services/execution-target/schemas.mjs +1 -1
- package/dist/services/filesystem/index.d.mts +1 -1
- package/dist/services/filesystem/index.mjs +1 -1
- package/dist/services/filesystem/namespace.d.mts +6 -6
- package/dist/services/filesystem/schemas.d.mts +3 -3
- package/dist/services/git/namespace.d.mts +18 -0
- package/dist/services/git/namespace.mjs +1 -1
- package/dist/services/git/schemas.d.mts +10 -1
- package/dist/services/git/schemas.mjs +1 -1
- package/dist/services/harness/index.mjs +1 -1
- package/dist/services/index.d.mts +567 -101
- 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 +3 -3
- package/dist/services/log-import/log-import.d.mts +1 -1
- package/dist/services/log-import/log-import.mjs +1 -1
- package/dist/services/log-import/namespace.mjs +1 -1
- package/dist/services/log-import/schemas.mjs +1 -1
- package/dist/services/materialization/index.d.mts +1 -1
- package/dist/services/materialization/index.mjs +1 -1
- package/dist/services/model-registry/index.d.mts +1 -1
- package/dist/services/model-registry/index.mjs +1 -1
- package/dist/services/preferences/index.d.mts +2 -2
- package/dist/services/preferences/schemas.d.mts +1 -1
- package/dist/services/preferences/storage-namespace.d.mts +2 -2
- package/dist/services/provider-context/index.d.mts +1 -1
- package/dist/services/provider-context/index.mjs +1 -1
- package/dist/services/provider-runtime/index.mjs +1 -1
- package/dist/services/session/handlers/index.d.mts +2 -2
- package/dist/services/session/handlers/index.mjs +1 -1
- package/dist/services/session/index.d.mts +10 -10
- package/dist/services/session/index.mjs +1 -1
- package/dist/services/session/messages/namespace.d.mts +1 -1
- package/dist/services/session/messages/namespace.mjs +1 -1
- package/dist/services/session/orchestrator-testing/index.d.mts +1 -1
- package/dist/services/session/orchestrator-testing/index.mjs +1 -1
- package/dist/services/session/session-events/namespace.d.mts +1 -1
- package/dist/services/session/session-events/namespace.mjs +1 -1
- package/dist/services/session/storage/namespace.d.mts +1 -1
- package/dist/services/session/storage/schema.d.mts +2 -2
- package/dist/services/session/storage/schema.mjs +1 -1
- package/dist/services/session/testing/index.d.mts +33 -4
- package/dist/services/session/testing/index.mjs +68 -12
- package/dist/services/session/testing/orchestrator-shared.d.mts +1 -1
- package/dist/services/session/testing/orchestrator-shared.mjs +1 -1
- package/dist/services/session/turns/namespace.d.mts +1 -1
- package/dist/services/session/turns/namespace.mjs +1 -1
- package/dist/services/session-editor/index.d.mts +1 -1
- package/dist/services/session-editor/index.mjs +1 -1
- package/dist/services/settings/index.d.mts +3 -3
- package/dist/services/settings/index.mjs +1 -1
- package/dist/services/settings/namespace.mjs +1 -1
- package/dist/services/settings/storage/clients-namespace.d.mts +1 -1
- package/dist/services/settings/storage/clients-namespace.mjs +1 -1
- package/dist/services/settings/storage/index.d.mts +3 -3
- package/dist/services/settings/storage/index.mjs +1 -1
- package/dist/services/settings/storage/providers-namespace.d.mts +1 -1
- package/dist/services/settings/storage/providers-namespace.mjs +1 -1
- package/dist/services/subagent/index.d.mts +1 -1
- package/dist/services/subagent/index.mjs +1 -1
- package/dist/services/subagent-template/index.d.mts +2 -2
- package/dist/services/subagent-template/namespace.d.mts +1 -1
- package/dist/services/subagent-template/schemas.d.mts +1 -1
- package/dist/services/tool-approval/index.d.mts +1 -1
- package/dist/services/tool-approval/index.mjs +1 -1
- package/dist/services/tools/index.d.mts +1 -1
- package/dist/services/tools/index.mjs +1 -1
- package/dist/services/tray-menu/index.d.mts +3 -3
- package/dist/services/tray-menu/index.mjs +1 -1
- package/dist/services/tray-menu/namespace.d.mts +1 -1
- package/dist/services/tray-menu/schemas.d.mts +1 -1
- package/dist/services/turn/index.d.mts +1 -1
- package/dist/services/turn/namespace.d.mts +1 -1
- package/dist/services/workflow-transitions/index.d.mts +1 -1
- package/dist/services/workflow-transitions/index.mjs +1 -1
- package/dist/session-BOpTI79g.mjs +1 -0
- package/dist/session-CXOPk3yg.mjs +95 -0
- package/dist/shared-B9AWRm9A.mjs +1 -0
- package/dist/{skill-BR6rkfLe.mjs → skill-DGNtc_ww.mjs} +1 -1
- package/dist/{src-DD0v-nIj.mjs → src-BmSQ3rlz.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 +81 -2
- package/dist/storage/drizzle/index.mjs +1 -1
- package/dist/storage/handlers/drizzle/index.d.mts +1 -1
- package/dist/storage/handlers/drizzle/index.mjs +1 -1
- package/dist/storage/handlers/index.d.mts +1 -1
- package/dist/storage/handlers/index.mjs +1 -1
- package/dist/tool-approval-service-BFDOFUGC.mjs +1 -0
- package/dist/{tools-PdG9fO1M.mjs → tools-DWKWX3eV.mjs} +1 -1
- package/dist/{transition-Du3MQzJV.d.mts → transition-D3zUBTPc.d.mts} +11 -38
- package/dist/{types-D7_kevBK.d.mts → types-BlB23n4f.d.mts} +1 -1
- package/dist/{types-DMLDHFR9.d.mts → types-CtDGkyLx2.d.mts} +1 -1
- package/dist/types-Cwza95hS.mjs +1 -0
- package/dist/{types-Dzrwa1GY.d.mts → types-DcxBYlPA.d.mts} +5834 -1436
- package/dist/types-DnK6Wa_Y.d.mts +260 -0
- package/dist/types-OKJCOjme.d.mts +2937 -0
- package/dist/ui-hooks/index.d.mts +29 -2
- package/dist/ui-hooks/index.mjs +1 -1
- package/dist/ui-kernel/index.d.mts +2 -2
- package/dist/ui-kernel/pages/schemas.d.mts +1 -1
- package/dist/ui-views/index.d.mts +1 -1
- package/dist/utils/index.d.mts +98 -1
- package/dist/utils/index.mjs +2 -2
- package/dist/utils/project-manifest.mjs +1 -1
- package/dist/{version-CoCeMxDT.mjs → version-BYeVh1pI.mjs} +1 -1
- package/dist/{view-builder-DeFd-k7C.d.mts → view-builder-B0j9p5C0.d.mts} +4 -4
- package/dist/{visibility-qhGWmpSJ.mjs → visibility-DtDLRBdr.mjs} +1 -1
- package/dist/worker-node-CjuQb9hl.mjs +1 -0
- package/dist/{worker-node-DZTuT1DS.mjs → worker-node-Dtf9ilsR.mjs} +1 -1
- package/dist/workflow-C4mck_NW.mjs +1 -0
- package/dist/workflow-engine/execution-attempt-repository.d.mts +1 -1
- package/dist/workflow-engine/index.d.mts +237 -518
- 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/index.d.mts +2 -2
- 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 +27 -27
- package/dist/workflow-engine/workflow-orchestrator.mjs +1 -1
- package/dist/workflow-engine/workflow-trigger-binding-consumer.d.mts +46 -0
- package/dist/workflow-engine/workflow-trigger-binding-consumer.mjs +1 -0
- package/dist/{workflow-transitions-DSc45ixc.mjs → workflow-transitions-c_VQbyV0.mjs} +1 -1
- package/dist/workflow-worker-aNbdgqml.mjs +1 -0
- package/dist/zod-json-schema-Dixc-B1T.mjs +1 -0
- package/package.json +46 -1
- package/dist/adapter-D5c5LrPN.mjs +0 -1
- package/dist/artifact-DGiXqb11.mjs +0 -1
- package/dist/attach-error-C3tngg6J.mjs +0 -1
- package/dist/authority-state-bootstrap-GPL_tqaT.mjs +0 -1
- package/dist/await-trigger-I3lrepb8.mjs +0 -1
- package/dist/bus-B6SAjgOC.mjs +0 -2
- package/dist/bus-C2l3K74u.mjs +0 -1
- package/dist/capabilities-BQEp34ir.mjs +0 -1
- package/dist/capability-service-BqiLlRGA.mjs +0 -1
- package/dist/event-CmVjR6Ib.mjs +0 -1
- package/dist/extension-DCA4pYrY.mjs +0 -1
- package/dist/extension-hjOPs10e.mjs +0 -1
- package/dist/framework-packages-C3RWfJDk.mjs +0 -1
- package/dist/handlers-CfnLyLfE.mjs +0 -57
- package/dist/identity-D6guMtmi.mjs +0 -1
- package/dist/index-CRvpVIqA.d.mts +0 -89
- package/dist/json-value-Brslhqbm.d.mts +0 -57
- package/dist/json-value-DmU8ibo_.mjs +0 -1
- package/dist/load-extensions-D0DfjYLC.mjs +0 -1
- package/dist/model-BGgVmRnN.mjs +0 -1
- package/dist/namespace-DJfUADSV.mjs +0 -1
- package/dist/orchestrator-shared-BxmHCPvx.mjs +0 -1
- package/dist/package-CNUPPcU1.mjs +0 -7
- package/dist/package-Dft_RItb.mjs +0 -1
- package/dist/schemas-CRB2O5zo.mjs +0 -1
- package/dist/schemas-Cm09dXL4.mjs +0 -1
- package/dist/schemas-tDf_WiC8.mjs +0 -1
- package/dist/scoped-bus-C9BdNwfM.mjs +0 -1
- package/dist/session-BOGCd18q.mjs +0 -1
- package/dist/session-BTFiDoGz.mjs +0 -76
- package/dist/shared-BQ0CHIVy.mjs +0 -1
- package/dist/tool-approval-service-kBA0fRzm.mjs +0 -1
- package/dist/types-CJ_QZ1yW.d.mts +0 -1487
- package/dist/worker-node-Bl9_vqYi.mjs +0 -1
- package/dist/workflow-BfDbgtIQ.mjs +0 -1
- package/dist/workflow-worker-BN9XPxQO.mjs +0 -1
- package/dist/{adapter-auth-runtime-DO-FVTXg.mjs → adapter-auth-runtime-DHHppU4f.mjs} +0 -0
- package/dist/{adapter-binding-DQchUtrK.d.mts → adapter-binding-CATvmGuz.d.mts} +0 -0
- package/dist/{attempt-record-codec-CqO1_XnE.mjs → attempt-record-codec-BYfYkj4M.mjs} +0 -0
- package/dist/{base-orchestrator-BilsQNW1.d.mts → base-orchestrator-B4YW6z_Q.d.mts} +0 -0
- package/dist/{index-DN4NOCqN2.d.mts → capability-service-BW1-teFU.d.mts} +0 -0
- package/dist/{client-B--e2qcU.d.mts → client-BG0WX5Vz.d.mts} +0 -0
- package/dist/{client-binary-version-verifier-taewmKTY.mjs → client-binary-version-verifier-0lCKZOTg.mjs} +0 -0
- package/dist/{client-binary-version-verifier-CgjM_vGF.d.mts → client-binary-version-verifier-lcv83Hq3.d.mts} +0 -0
- package/dist/{clients-namespace-DfxjG2ZP.d.mts → clients-namespace-DLAjOTTb.d.mts} +0 -0
- package/dist/{config-namespace-BCqvufbD.d.mts → config-namespace-CH7sJZ4f.d.mts} +0 -0
- package/dist/{create-static-mount-bbQhTt6W.mjs → create-static-mount-DxuixuLZ.mjs} +0 -0
- package/dist/{cross-spawn-B57KZuns.mjs → cross-spawn-CZygZJMH.mjs} +0 -0
- package/dist/{cursor-storage-DIFK_9hg.mjs → cursor-storage-bsc9lZKk.mjs} +0 -0
- package/dist/{definition-gnKgXU91.d.mts → definition-BrgzUuFk.d.mts} +0 -0
- package/dist/{definitions-xrrY0wgz.mjs → definitions-CRpdnHYM.mjs} +0 -0
- package/dist/{descriptor-to-package-DvF08krT.mjs → descriptor-to-package-CcjdoWP4.mjs} +0 -0
- package/dist/{drizzle-z_0SiGY8.mjs → drizzle-Bzc-OGVI.mjs} +0 -0
- package/dist/{esm-CltRnX8_.mjs → esm-i-S5TW72.mjs} +0 -0
- package/dist/{facet-BCI00njh.mjs → facet-BnMh7Jyc.mjs} +0 -0
- package/dist/{filesystem-service-CQ9yVkSz.d.mts → filesystem-service-ZJ43SbBi.d.mts} +0 -0
- package/dist/{handler-Cbv9FqDO.mjs → handler-DF1fVDpf.mjs} +0 -0
- package/dist/{host-Caq6ZfSJ.mjs → host-B-_ntOMH.mjs} +0 -0
- package/dist/{index-ye0oklfU.d.mts → index-B2Y1Wvbh.d.mts} +0 -0
- package/dist/{index-Cv-o5Krs.d.mts → index-B4svZC6L.d.mts} +0 -0
- package/dist/{index-DZunhZec.d.mts → index-B5dP8rj6.d.mts} +0 -0
- package/dist/{index-jTaAHsul.d.mts → index-BC-6qNeo.d.mts} +0 -0
- package/dist/{index-ByKi34v5.d.mts → index-BFWvT0NG.d.mts} +0 -0
- package/dist/{index-vA--0lOM.d.mts → index-BMRB9yhF.d.mts} +0 -0
- package/dist/{index-BskPjMet.d.mts → index-BuMsrli0.d.mts} +0 -0
- package/dist/{index-DR40QWlw.d.mts → index-C4V8Pmi4.d.mts} +0 -0
- package/dist/{index-BIdsFcQs2.d.mts → index-CL0Jo1b92.d.mts} +0 -0
- package/dist/{index-CjdRdsd0.d.mts → index-CVpaGijY.d.mts} +0 -0
- package/dist/{index-vcSj12YQ.d.mts → index-CmbkCxj-.d.mts} +0 -0
- package/dist/{index-sS6KUlrx.d.mts → index-CqdMbYmR.d.mts} +0 -0
- package/dist/{index-CnMu8BQl.d.mts → index-D037TVsm.d.mts} +0 -0
- package/dist/{index-CGZQVTid.d.mts → index-DgspOUa72.d.mts} +0 -0
- package/dist/{index-dtsLKOID.d.mts → index-Ek4y8M9J2.d.mts} +0 -0
- package/dist/{index-DjgLchuQ.d.mts → index-VzLAV0Yt.d.mts} +0 -0
- package/dist/{index-DXN_L5D6.d.mts → index-jxPncqWZ2.d.mts} +0 -0
- package/dist/{index-BVRQEpAg.d.mts → index-kzIjbrS02.d.mts} +6 -6
- /package/dist/{index-Dm1nUxCF.d.mts → index-l01zsChf.d.mts} +0 -0
- /package/dist/{index-CWHfOz6d.d.mts → index-pvX-BIpr2.d.mts} +0 -0
- /package/dist/{jsonl-transport-bQl3JwIu.mjs → jsonl-transport-Cyyh5Wje.mjs} +0 -0
- /package/dist/{lib-DOBXZmYX.mjs → lib-BqV8hYtk.mjs} +0 -0
- /package/dist/{model-registry-xyBKSye-.mjs → model-registry-C9rFu3kV.mjs} +0 -0
- /package/dist/{model-registry-CmgcPDH3.mjs → model-registry-Cixxx2jv.mjs} +0 -0
- /package/dist/{modes-BheyN7SS.mjs → modes-DwsJ3yVl.mjs} +0 -0
- /package/dist/{namespace-BOkKoq34.d.mts → namespace-B0ftHlK3.d.mts} +0 -0
- /package/dist/{namespace-YytVKIgI.d.mts → namespace-BGRHcrmp.d.mts} +0 -0
- /package/dist/{namespace-jDhZjw-i.d.mts → namespace-BUYDmd0r.d.mts} +0 -0
- /package/dist/{namespace-YxU1xf-K.mjs → namespace-BW3Bfu9h.mjs} +0 -0
- /package/dist/{namespace-DWCEo-9M.d.mts → namespace-BdAK0lD8.d.mts} +0 -0
- /package/dist/{namespace-Cv1RFP7n.d.mts → namespace-CPG6u60N.d.mts} +0 -0
- /package/dist/{namespace-GPA7zots.d.mts → namespace-CVFaZv8x.d.mts} +0 -0
- /package/dist/{namespace-Blp4c8GK.d.mts → namespace-DBO1OzYB.d.mts} +0 -0
- /package/dist/{namespace-C-9si-fV.mjs → namespace-DiwqpB-c.mjs} +0 -0
- /package/dist/{namespace-tGRAod3o.d.mts → namespace-DqZweTbX.d.mts} +0 -0
- /package/dist/{namespace-HO2J9sO8.mjs → namespace-jVTsuZHX.mjs} +0 -0
- /package/dist/{namespace-CWGKCNZm.mjs → namespace-tjoxekmf.mjs} +0 -0
- /package/dist/{out-CvjtANXN.mjs → out-8bOYN6EF.mjs} +0 -0
- /package/dist/{packages-DtEEP0Vt.mjs → packages-Bp124-gx.mjs} +0 -0
- /package/dist/{packages-BZ6pzFIq.d.mts → packages-CxPMEg8D.d.mts} +0 -0
- /package/dist/{platform-Bv8llU9c.mjs → platform-CxyYPrkf.mjs} +0 -0
- /package/dist/{provider-operation-Cxoe2SUr.d.mts → provider-operation-DbdyFwNm.d.mts} +0 -0
- /package/dist/{providers-Co5UszRH.mjs → providers-C-eekMxD.mjs} +0 -0
- /package/dist/{providers-namespace-DjFkmvBR.d.mts → providers-namespace-CfZKp-C0.d.mts} +0 -0
- /package/dist/{quick-lru-CrOpWwrf.mjs → quick-lru-CCEnf7y6.mjs} +0 -0
- /package/dist/{schema-Db-y-09L.mjs → schema-C0opCPww.mjs} +0 -0
- /package/dist/{schema-introspection-DgWQCpwx.mjs → schema-introspection-6-r_KEJQ.mjs} +0 -0
- /package/dist/{schemas-N6x2z7Lf.d.mts → schemas-B50oWBuj.d.mts} +0 -0
- /package/dist/{schemas-BO7uOum6.d.mts → schemas-B6Q-qdmn.d.mts} +0 -0
- /package/dist/{schemas-BGExwp3j.mjs → schemas-B8hKbBwI.mjs} +0 -0
- /package/dist/{schemas-miYxK_Z1.d.mts → schemas-BGvkTiCx.d.mts} +0 -0
- /package/dist/{schemas-CqRm0i9a.mjs → schemas-BivbWRkG.mjs} +0 -0
- /package/dist/{schemas-CwbYk_kZ.d.mts → schemas-ChmQldVH.d.mts} +0 -0
- /package/dist/{schemas-DrVg4aQQ.d.mts → schemas-Dd13TMgU.d.mts} +0 -0
- /package/dist/{schemas-BtZqovRH.d.mts → schemas-Pe892GgN.d.mts} +0 -0
- /package/dist/{schemas-CQyRBqD6.d.mts → schemas-bfZNpl0B.d.mts} +0 -0
- /package/dist/{schemas-Bfxskx_2.mjs → schemas-scyC2tFF.mjs} +0 -0
- /package/dist/{semver-DlM8znk4.mjs → semver-BI7kTNsY.mjs} +0 -0
- /package/dist/{server-lifecycle-kmQ5PUDv.mjs → server-lifecycle-B_OZnoe-.mjs} +0 -0
- /package/dist/{server-lifecycle-Dsq56aqC.d.mts → server-lifecycle-L8zja8t8.d.mts} +0 -0
- /package/dist/{session-lineage-B_JW5LpF.d.mts → session-lineage-bUkd3fqx.d.mts} +0 -0
- /package/dist/{shared-schemas-DXwyMCwZ.mjs → shared-schemas-CQ6blrEW.mjs} +0 -0
- /package/dist/{src-CCu8TwL6.mjs → src-BacfeiI4.mjs} +0 -0
- /package/dist/{storage-namespace-BSrv0vXR.mjs → storage-namespace-BZce8kkW.mjs} +0 -0
- /package/dist/{storage-namespace-dfywhXR3.d.mts → storage-namespace-YmE8XCCL.d.mts} +0 -0
- /package/dist/{storage-namespace-definition-BvlX0QV_.d.mts → storage-namespace-definition-BsnYAPot.d.mts} +0 -0
- /package/dist/{storage-namespace-definition-CkMKt7-I.mjs → storage-namespace-definition-Cca-zwXU.mjs} +0 -0
- /package/dist/{supports-color-DUugCQsK.mjs → supports-color-SV_FgSN2.mjs} +0 -0
- /package/dist/{telemetry-Pr3oP2rk.mjs → telemetry-BqoC87F-.mjs} +0 -0
- /package/dist/{timeout-DWDhddRJ.mjs → timeout-DVlN2Zhy.mjs} +0 -0
- /package/dist/{tray-menu-service-BBLa-Rcv.mjs → tray-menu-service-eVVxgPLc.mjs} +0 -0
- /package/dist/{types-BrcjaNPZ.d.mts → types-DdpSEmTO.d.mts} +0 -0
- /package/dist/{types-b54n1o57.d.mts → types-tyv0B605.d.mts} +0 -0
- /package/dist/{ui-config-CyCdlns_.mjs → ui-config-B35GloSX.mjs} +0 -0
- /package/dist/{variant-krjlTdJt.mjs → variant-Dwnge3J_.mjs} +0 -0
- /package/dist/{window-registry-I-imZHV_.mjs → window-registry-CKiMJjId.mjs} +0 -0
- /package/dist/{window-registry-BDnZLPVx.d.mts → window-registry-Pcf35cac.d.mts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{B as e,H as t,M as n,P as r,T as i,W as a,X as o,et as s,g as c,it as l,j as u,ot as d}from"../authority-state-bootstrap-
|
|
1
|
+
import{B as e,H as t,M as n,P as r,T as i,W as a,X as o,et as s,g as c,it as l,j as u,ot as d}from"../authority-state-bootstrap-CLYus369.mjs";import{a as f,c as p,d as m,i as h,l as g,n as _,o as v,r as y,s as b,t as x,u as S}from"../package-B01gmu75.mjs";import{assertWorkflowTriggerPayload as C,compileWorkflowTriggerBindingFilter as w}from"./workflow-trigger-binding-consumer.mjs";import{DuplicateExecutionAttemptError as T,EXECUTION_ATTEMPT_SETTLEMENT_KINDS as E,EXECUTION_ATTEMPT_STATUSES as D,sameAllocationRef as O,sameWorkflowResult as k}from"./execution-attempt-repository.mjs";import{PROVIDER_OPERATION_OBLIGATIONS as A}from"./provider-operation.mjs";import{JsonValueSchema as j,WorkflowFrameStateSchema as M}from"@makaio/framework/contracts";const N=new Set([...M.shape.status.options]);function P(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function F(e){if(!P(e))return!1;for(let t of Object.values(e))if(!P(t)||typeof t.status!=`string`||!N.has(t.status)||`result`in t&&t.result!==void 0&&!j.safeParse(t.result).success)return!1;return!0}function I(e){let t={trigger:P(e.trigger)?e.trigger:{},steps:F(e.steps)?e.steps:{},inputs:j.safeParse(e.inputs).success?e.inputs:{}};return`item`in e&&(t.item=e.item),typeof e.index==`number`&&(t.index=e.index),t}export{T as DuplicateExecutionAttemptError,E as EXECUTION_ATTEMPT_SETTLEMENT_KINDS,D as EXECUTION_ATTEMPT_STATUSES,f as ExecutionAttemptAuthority,A as PROVIDER_OPERATION_OBLIGATIONS,h as WorkflowEngineService,x as WorkflowEngineToken,b as WorkflowExecutor,u as WorkflowStorageNamespace,n as WorkflowStorageSubjects,v as WorkflowTriggerReconciler,C as assertWorkflowTriggerPayload,I as buildWorkflowExpressionContextFromResolvedInputs,w as compileWorkflowTriggerBindingFilter,_ as createWorkflowEnginePackage,g as getWorkflowState,S as initializeWorkflowState,m as patchWorkflowState,p as registerDrizzleWorkflowStorage,c as runAuthorityDispatchedAttempt,i as runShellStep,O as sameAllocationRef,k as sameWorkflowResult,r as workflowDefinitionsDual,y as workflowEnginePackage,e as workflowExecutionStateDual,t as workflowExecutionStateEventsDual,a as workflowExecutionsDual,d as workflowFinalizationsDual,o as workflowStepSpansDual,s as worklogFrameEntriesDual,l as worklogSummariesDual};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as createWorkflowEnginePackage, r as workflowEnginePackage, t as WorkflowEngineToken } from "../package-
|
|
1
|
+
import { n as createWorkflowEnginePackage, r as workflowEnginePackage, t as WorkflowEngineToken } from "../package-BNFTUFLB.mjs";
|
|
2
2
|
export { WorkflowEngineToken, createWorkflowEnginePackage, workflowEnginePackage };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,r as t,t as n}from"../package-
|
|
1
|
+
import{n as e,r as t,t as n}from"../package-B01gmu75.mjs";export{n as WorkflowEngineToken,e as createWorkflowEnginePackage,t as workflowEnginePackage};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as ProviderOperationClaim, c as ProviderOperationObligation, i as ProcessBoundProvisionerLossProof, l as ProviderOperationOwnershipRecord, n as InitialProviderOperationClaimContextSource, o as ProviderOperationClaimDecision, r as PROVIDER_OPERATION_OBLIGATIONS, s as ProviderOperationMutationDecision, t as InitialProviderOperationClaimContext } from "../provider-operation-
|
|
1
|
+
import { a as ProviderOperationClaim, c as ProviderOperationObligation, i as ProcessBoundProvisionerLossProof, l as ProviderOperationOwnershipRecord, n as InitialProviderOperationClaimContextSource, o as ProviderOperationClaimDecision, r as PROVIDER_OPERATION_OBLIGATIONS, s as ProviderOperationMutationDecision, t as InitialProviderOperationClaimContext } from "../provider-operation-DbdyFwNm.mjs";
|
|
2
2
|
export { InitialProviderOperationClaimContext, InitialProviderOperationClaimContextSource, PROVIDER_OPERATION_OBLIGATIONS, ProcessBoundProvisionerLossProof, ProviderOperationClaim, ProviderOperationClaimDecision, ProviderOperationMutationDecision, ProviderOperationObligation, ProviderOperationOwnershipRecord };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as ProviderOperationClaim, i as ProcessBoundProvisionerLossProof, l as ProviderOperationOwnershipRecord } from "../../provider-operation-
|
|
2
|
-
import { C as ProvisioningClaimDecision, a as BeginProvisioningInput, h as ExecutionAttemptRepository, p as ExecutionAttemptRecord } from "../../execution-attempt-repository-
|
|
1
|
+
import { a as ProviderOperationClaim, i as ProcessBoundProvisionerLossProof, l as ProviderOperationOwnershipRecord } from "../../provider-operation-DbdyFwNm.mjs";
|
|
2
|
+
import { C as ProvisioningClaimDecision, a as BeginProvisioningInput, h as ExecutionAttemptRepository, p as ExecutionAttemptRecord } from "../../execution-attempt-repository-BJ2W6wwx.mjs";
|
|
3
3
|
import { BoundedRecoveryEvidence, ProviderAllocationRef, WorkflowRunResult } from "@makaio/framework/contracts";
|
|
4
4
|
|
|
5
5
|
//#region subsystems/workflow-engine/src/testing/in-memory-attempt-repository.d.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{DuplicateExecutionAttemptError as e,sameAllocationRef as t,sameWorkflowResult as n}from"../execution-attempt-repository.mjs";import{a as r,c as i,i as a,l as o,n as s,o as c,r as l,s as u,t as d}from"../../attempt-record-codec-
|
|
1
|
+
import{DuplicateExecutionAttemptError as e,sameAllocationRef as t,sameWorkflowResult as n}from"../execution-attempt-repository.mjs";import{a as r,c as i,i as a,l as o,n as s,o as c,r as l,s as u,t as d}from"../../attempt-record-codec-BYfYkj4M.mjs";import{BoundedRecoveryEvidenceSchema as f,PROVIDER_ALLOCATION_REF_VERSION as p}from"@makaio/framework/contracts";function m(p={}){let m=p.attempts??new Map,h=p.operations??new Map,g=p.committedOutcomes??new Map,_=p.activeAttempts??new Map,v=e=>{let t=m.get(e.executionAttemptId),n=h.get(e.executionAttemptId);return!t||!n?{kind:`not-found`}:t.settlementKind==null?n.token===null||n.token!==e.token||n.generation!==e.generation||n.ownerId!==e.ownerId?{kind:`stale`,attempt:t}:{kind:`authorized`,attempt:t,operation:n}:{kind:`resolved`,attempt:t}},y=(e,t)=>{h.set(e.executionAttemptId,{...e,ownerId:null,token:null,leaseExpiresAt:null,lastFailure:t})},b=(e,n)=>{let a=r(e.allocationRef),o=v(e.claim);if(o.kind!==`not-found`&&i(o.attempt,a),o.kind===`resolved`)return{kind:`resolved`,allocationRef:o.attempt.allocationRef};if(o.kind!==`authorized`)return{kind:o.kind};let{attempt:s,operation:c}=o;if(s.allocationRef!==null)return t(s.allocationRef,a)?{kind:`duplicate`,allocationRef:s.allocationRef}:{kind:`conflict`,allocationRef:s.allocationRef};let l=_.get(s.executionId)===s.executionAttemptId;return m.set(s.executionAttemptId,{...s,status:`allocated`,allocationRef:a,claimable:n&&l}),h.set(c.executionAttemptId,{...c,obligation:`allocation-control`}),{kind:`recorded`}};return{async createAttempt(t){if(m.has(t.executionAttemptId))throw new e(t.executionAttemptId);let n={executionAttemptId:t.executionAttemptId,executionId:t.executionId,status:`pending`,allocationRef:null,createdAt:new Date().toISOString(),providerId:null,allocationLifetime:null,provisionerIncarnationId:null,settlementKind:null,claimable:!1,claimExpiresAt:null},r=_.get(t.executionId),i=r===void 0?void 0:m.get(r);return i?.status===`allocated`&&m.set(i.executionAttemptId,{...i,claimable:!1}),m.set(t.executionAttemptId,n),_.set(t.executionId,t.executionAttemptId),n},async beginProvisioning(e){let t=a(e.allocationLifetime),n=m.get(e.executionAttemptId);if(!n||n.executionId!==e.executionId)return{kind:`not-found`};if(_.get(e.executionId)!==e.executionAttemptId)return{kind:`fenced`};if(n.settlementKind!=null)return{kind:`resolved`,allocationRef:n.allocationRef};if(n.allocationRef!==null)return{kind:`allocated`,allocationRef:n.allocationRef};if(n.status!==`pending`)return{kind:`already-provisioning`};m.set(e.executionAttemptId,{...n,status:`provisioning`,providerId:e.providerId,allocationLifetime:t,provisionerIncarnationId:e.provisionerIncarnationId});let r={executionAttemptId:e.executionAttemptId,generation:1,ownerId:e.ownerId,token:crypto.randomUUID(),leaseExpiresAt:l(e.leaseExpiresAt)};return h.set(e.executionAttemptId,{executionAttemptId:e.executionAttemptId,generation:r.generation,ownerId:r.ownerId,token:r.token,leaseExpiresAt:r.leaseExpiresAt,obligation:`provisioning-resolution`,failureCount:0,lastFailure:null}),{kind:`started`,claim:r}},async getProviderOperation(e){return h.get(e)??null},async renewProviderOperationClaim(e){let t=v(e.claim);if(t.kind!==`authorized`)return{kind:t.kind};let n=l(e.leaseExpiresAt);return h.set(e.claim.executionAttemptId,{...t.operation,leaseExpiresAt:n}),{kind:`claimed`,claim:{...e.claim,leaseExpiresAt:n}}},async takeOverProviderOperation(e){let t=m.get(e.executionAttemptId),n=h.get(e.executionAttemptId);if(!t||!n)return{kind:`not-found`};if(t.settlementKind!=null)return{kind:`resolved`};if(n.ownerId!==null&&n.leaseExpiresAt!==null&&s(n.leaseExpiresAt)>s(e.observedAt))return{kind:`stale`};let r={executionAttemptId:e.executionAttemptId,generation:n.generation+1,ownerId:e.ownerId,token:crypto.randomUUID(),leaseExpiresAt:l(e.leaseExpiresAt)};return h.set(e.executionAttemptId,{...n,generation:r.generation,ownerId:r.ownerId,token:r.token,leaseExpiresAt:r.leaseExpiresAt}),{kind:`claimed`,claim:r}},async handoffProviderOperation(e){let t=e.evidence===void 0?void 0:f.parse(e.evidence),n=v(e.claim);return n.kind===`authorized`?(h.set(e.claim.executionAttemptId,{...n.operation,ownerId:null,token:null,leaseExpiresAt:null,lastFailure:t??n.operation.lastFailure}),{kind:`recorded`}):{kind:n.kind}},async recordProviderOperationUncertainty(e){let t=f.parse(e.evidence),n=v(e.claim);return n.kind===`authorized`?(h.set(e.claim.executionAttemptId,{...n.operation,failureCount:n.operation.failureCount+1,lastFailure:t}),{kind:`recorded`}):{kind:n.kind}},async recordAllocation(e){return b(e,!0)},async recordProvisioningAbsent(e){let t=f.parse(e.evidence),n=v(e.claim);if(n.kind!==`authorized`)return{kind:n.kind};let{attempt:r,operation:i}=n;return r.executionId===e.executionId?r.allocationRef===null?(m.set(r.executionAttemptId,{...r,status:`settled`,settlementKind:`abandoned`,claimable:!1}),y(i,t),{kind:`recorded`}):{kind:`allocated`,allocationRef:r.allocationRef}:{kind:`not-found`}},async recordProvisionerIncarnationLost(e){let t=f.parse(e.proof.evidence),n=v(e.claim);if(n.kind!==`authorized`)return{kind:n.kind};let{attempt:r,operation:i}=n;return r.executionId===e.executionId?r.allocationLifetime===`provisioner-process-bound`?r.provisionerIncarnationId===null||r.provisionerIncarnationId!==e.proof.provisionerIncarnationId?{kind:`incarnation-mismatch`,provisionerIncarnationId:r.provisionerIncarnationId}:r.allocationRef===null?(m.set(r.executionAttemptId,{...r,status:`settled`,settlementKind:`abandoned`,claimable:!1}),y(i,t),{kind:`recorded`}):{kind:`allocated`,allocationRef:r.allocationRef}:{kind:`not-process-bound`,allocationLifetime:r.allocationLifetime}:{kind:`not-found`}},async recordAllocationTerminated(e){let t=f.parse(e.evidence),n=v(e.claim);if(n.kind!==`authorized`)return{kind:n.kind};let{attempt:r,operation:i}=n;return r.allocationRef===null?{kind:`not-allocated`}:(h.set(i.executionAttemptId,{...i,obligation:`terminal-convergence`,lastFailure:t}),{kind:`recorded`})},async recordInfrastructureFailure(e){let t=v(e.claim);if(t.kind!==`authorized`)return{kind:t.kind};let{attempt:n,operation:r}=t;return n.executionId===e.executionId?n.allocationRef===null?{kind:`not-allocated`}:r.obligation===`terminal-convergence`?(m.set(n.executionAttemptId,{...n,status:`settled`,settlementKind:`infrastructure-failure`,claimable:!1}),y(r,r.lastFailure),{kind:`recorded`}):{kind:`not-terminated`}:{kind:`not-found`}},async getActiveAttempt(e,t){return _.get(e)===t?m.get(t)??null:null},async commitOutcome(e){let t=u(e.result);if(_.get(e.executionId)!==e.executionAttemptId)return{kind:`fenced`};let r=m.get(e.executionAttemptId);if(r===void 0)return{kind:`fenced`};let i=g.get(e.executionAttemptId);if(i)return n(i,t)?{kind:`duplicate`,outcome:i}:{kind:`conflict`};if(r.settlementKind!=null)return{kind:`conflict`};g.set(e.executionAttemptId,t),m.set(e.executionAttemptId,{...r,status:`settled`,settlementKind:`outcome`,claimable:!1});let a=h.get(e.executionAttemptId);return a&&y(a,a.lastFailure),{kind:`accepted`,outcome:t}},async abandonPendingAttempt(e,t){if(_.get(t)!==e)return{kind:`fenced`};let n=m.get(e);return n?n.status===`allocated`?{kind:`allocated`}:n.status===`provisioning`?{kind:`provisioning`}:n.status===`settled`?{kind:n.settlementKind===`abandoned`?`already-abandoned`:`already-settled`}:(m.set(e,{...n,status:`settled`,settlementKind:`abandoned`,claimable:!1}),{kind:`abandoned`}):{kind:`fenced`}},recovery:{async getAttemptWithAllocation(e){return m.get(e)??null},async recordDiscoveredAllocation(e){return b(e,!1)},async evolveAllocationRef(e){let{currentRef:n,nextRef:r}=c(e),i=v(e.claim);if(i.kind===`stale`)return{kind:`stale`,storedRef:i.attempt.allocationRef};if(i.kind!==`authorized`)return{kind:i.kind};let{attempt:a}=i;return a.executionId===e.executionId?a.allocationRef===null?{kind:`not-allocated`}:t(a.allocationRef,n)?(m.set(a.executionAttemptId,{...a,allocationRef:r}),{kind:`evolved`}):{kind:`stale`,storedRef:a.allocationRef}:{kind:`not-found`}},async getRecoverableAttempts(e){let t=s(new Date().toISOString()),n=[];for(let r of m.values())r.executionId===e&&r.status===`allocated`&&r.allocationRef!==null&&r.claimable===!0&&r.settlementKind==null&&(r.claimExpiresAt!=null&&s(r.claimExpiresAt)<t||n.push(o(r)));return n.sort(d)}},attempts:m,operations:h,committedOutcomes:g,activeAttempts:_}}const h=`controller-incarnation-1`,g=`provisioner-incarnation-1`,_=`test-provider`;function v(e){return new Date(Date.now()+e).toISOString()}function y(e,t,n={}){return{executionAttemptId:e,executionId:t,providerId:_,allocationLifetime:`provider-managed`,provisionerIncarnationId:g,ownerId:h,leaseExpiresAt:v(6e4),...n}}async function b(e,t,n,r={}){let i=await e.beginProvisioning(y(t,n,r));if(i.kind!==`started`)throw Error(`Expected provisioning to start, got '${i.kind}'`);return i.claim}function x(e={}){return{source:_,summary:`provider rejected the request before creating anything`,observedAt:new Date().toISOString(),...e}}function S(e=g,t=x({summary:`supervisor observed the provisioner process exit`})){return{kind:`provisioner-incarnation-lost`,provisionerIncarnationId:e,evidence:t}}function C(e=_,t={runId:1}){return{version:p,providerId:e,providerData:t}}function w(e,t=`completed`){let n={executionId:e,workflowId:`contract-workflow`};return t===`completed`?{...n,status:`completed`}:{...n,status:`failed`,error:`contract failure`}}export{h as TEST_OWNER_ID,_ as TEST_PROVIDER_ID,g as TEST_PROVISIONER_INCARNATION_ID,b as beginTestProvisioning,m as createInMemoryAttemptRepository,v as leaseAt,y as makeBeginProvisioningInput,x as makeEvidence,S as makeProcessLossProof,C as makeTestAllocationRef,w as makeTestWorkflowResult};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h as ExecutionAttemptRepository } from "../../execution-attempt-repository-
|
|
1
|
+
import { h as ExecutionAttemptRepository } from "../../execution-attempt-repository-BJ2W6wwx.mjs";
|
|
2
2
|
import { MakaioDatabase } from "@makaio/framework/storage/drizzle";
|
|
3
3
|
|
|
4
4
|
//#region subsystems/workflow-engine/src/testing/sqlite-attempt-repository.d.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{DuplicateExecutionAttemptError as e,EXECUTION_ATTEMPT_SETTLEMENT_KINDS as t,EXECUTION_ATTEMPT_STATUSES as n,sameAllocationRef as r,sameWorkflowResult as i}from"../execution-attempt-repository.mjs";import{PROVIDER_OPERATION_OBLIGATIONS as a}from"../provider-operation.mjs";import{a as o,c as s,i as c,l,n as u,o as d,r as f,s as p}from"../../attempt-record-codec-
|
|
1
|
+
import{DuplicateExecutionAttemptError as e,EXECUTION_ATTEMPT_SETTLEMENT_KINDS as t,EXECUTION_ATTEMPT_STATUSES as n,sameAllocationRef as r,sameWorkflowResult as i}from"../execution-attempt-repository.mjs";import{PROVIDER_OPERATION_OBLIGATIONS as a}from"../provider-operation.mjs";import{a as o,c as s,i as c,l,n as u,o as d,r as f,s as p}from"../../attempt-record-codec-BYfYkj4M.mjs";import{BoundedRecoveryEvidenceSchema as m,ProviderAllocationRefSchema as h,WorkerNodeAllocationLifetimeSchema as g,WorkflowRunResultSchema as _}from"@makaio/framework/contracts";import{getRawSqlExecutor as v,isSqliteUniqueViolationError as y,serializeByKey as b,serializeDatabaseOperation as x}from"@makaio/framework/storage/drizzle";import{sql as S}from"drizzle-orm";const C=[`CREATE TABLE IF NOT EXISTS test_execution_attempt (
|
|
2
2
|
execution_attempt_id TEXT PRIMARY KEY,
|
|
3
3
|
execution_id TEXT NOT NULL,
|
|
4
4
|
status TEXT NOT NULL,
|
|
@@ -25,16 +25,16 @@ import{DuplicateExecutionAttemptError as e,EXECUTION_ATTEMPT_SETTLEMENT_KINDS as
|
|
|
25
25
|
obligation TEXT NOT NULL,
|
|
26
26
|
failure_count INTEGER NOT NULL DEFAULT 0,
|
|
27
27
|
last_failure TEXT
|
|
28
|
-
)`];function w(e,t,n){let r=e.find(e=>e===t);if(r===void 0)throw Error(`Stored '${n}' value '${t}' is not part of the port's vocabulary`);return r}function T(e,t){return e===null?null:t(JSON.parse(e))}function E(e){return{executionAttemptId:e.execution_attempt_id,executionId:e.execution_id,status:w(n,e.status,`status`),allocationRef:T(e.allocation_ref,e=>h.parse(e)),createdAt:e.created_at,providerId:e.provider_id,allocationLifetime:e.allocation_lifetime===null?null:g.parse(e.allocation_lifetime),provisionerIncarnationId:e.provisioner_incarnation_id,settlementKind:e.settlement_kind===null?null:w(t,e.settlement_kind,`settlement_kind`),claimable:e.claimable!==0,claimExpiresAt:e.claim_expires_at}}function D(e){return{executionAttemptId:e.execution_attempt_id,generation:e.generation,ownerId:e.owner_id,token:e.token,leaseExpiresAt:e.lease_expires_at,obligation:w(a,e.obligation,`obligation`),failureCount:e.failure_count,lastFailure:T(e.last_failure,e=>m.parse(e))}}const O=new Map;function
|
|
28
|
+
)`];function w(e,t,n){let r=e.find(e=>e===t);if(r===void 0)throw Error(`Stored '${n}' value '${t}' is not part of the port's vocabulary`);return r}function T(e,t){return e===null?null:t(JSON.parse(e))}function E(e){return{executionAttemptId:e.execution_attempt_id,executionId:e.execution_id,status:w(n,e.status,`status`),allocationRef:T(e.allocation_ref,e=>h.parse(e)),createdAt:e.created_at,providerId:e.provider_id,allocationLifetime:e.allocation_lifetime===null?null:g.parse(e.allocation_lifetime),provisionerIncarnationId:e.provisioner_incarnation_id,settlementKind:e.settlement_kind===null?null:w(t,e.settlement_kind,`settlement_kind`),claimable:e.claimable!==0,claimExpiresAt:e.claim_expires_at}}function D(e){return{executionAttemptId:e.execution_attempt_id,generation:e.generation,ownerId:e.owner_id,token:e.token,leaseExpiresAt:e.lease_expires_at,obligation:w(a,e.obligation,`obligation`),failureCount:e.failure_count,lastFailure:T(e.last_failure,e=>m.parse(e))}}const O=new Map,k=new Map;function A(e){if(typeof e!=`object`||!e)return!1;let t=e,n=typeof t.message==`string`?t.message:``;return n.includes(`SQLITE_BUSY`)||n.startsWith(`Failed query: BEGIN IMMEDIATE`)||n.startsWith(`Failed query: COMMIT`)||A(t.cause)}function j(e){if(typeof e!=`object`||!e)return!1;let t=e;return(typeof t.message==`string`?t.message:``).includes(`no transaction is active`)||j(t.cause)}async function M(){await new Promise(e=>setImmediate(e))}async function N(e){for(let t=0;;t+=1)try{await e.run(S.raw(`COMMIT`));return}catch(e){if(!A(e)||t===100)throw e;await M()}}async function P(e,t){return b(O,e,t)}async function F(e,t){return b(k,e,t)}const I=new WeakMap;async function L(e,t){let n=(await t.all(S.raw(`PRAGMA database_list`))).find(e=>e.name===`main`)?.file??null;if(n!==null&&n!==``)return`file:${n}`;let r=I.get(e);if(r!==void 0)return r;let i=`connection:${crypto.randomUUID()}`;return I.set(e,i),i}async function R(e,t){let n=await e();if(typeof n!=`function`)return n;if((await n()).rowsAffected>0)return t;let r=await e();if(typeof r!=`function`)return r;throw Error(`A guarded transition affected no rows while durable state still permitted it`)}function z(e){return S`EXISTS (SELECT 1 FROM test_provider_operation
|
|
29
29
|
WHERE execution_attempt_id = ${e.executionAttemptId}
|
|
30
30
|
AND generation = ${e.generation}
|
|
31
31
|
AND owner_id = ${e.ownerId}
|
|
32
|
-
AND token = ${e.token})`}function
|
|
33
|
-
WHERE execution_attempt_id = ${e} AND settlement_kind IS NULL)`}function
|
|
32
|
+
AND token = ${e.token})`}function B(e){return S`EXISTS (SELECT 1 FROM test_execution_attempt
|
|
33
|
+
WHERE execution_attempt_id = ${e} AND settlement_kind IS NULL)`}function V(e){return S`${z(e)} AND ${B(e.executionAttemptId)}`}function H(e){return S`EXISTS (SELECT 1 FROM test_provider_operation
|
|
34
34
|
WHERE execution_attempt_id = ${e}
|
|
35
|
-
AND obligation = ${`terminal-convergence`})`}function
|
|
35
|
+
AND obligation = ${`terminal-convergence`})`}function U(){return S`EXISTS (SELECT 1 FROM test_active_execution_attempt
|
|
36
36
|
WHERE execution_id = test_execution_attempt.execution_id
|
|
37
|
-
AND execution_attempt_id = test_execution_attempt.execution_attempt_id)`}async function
|
|
37
|
+
AND execution_attempt_id = test_execution_attempt.execution_attempt_id)`}async function W(t){let n=v(t);await n.run(S.raw(`PRAGMA busy_timeout = 0`));let h=await L(t,n);await P(h,async()=>{for(let e of C)await n.run(S.raw(e))});let g,b=async e=>x(t,()=>F(h,async()=>{if(g!==void 0)throw Error(`This repository was retired by a failed transaction rollback`,{cause:g});for(let t=0;;t+=1)try{return await n.withSession(async t=>{let n=!1;try{await t.run(S.raw(`BEGIN IMMEDIATE`)),n=!0;let r=await e(t);return await N(t),r}catch(e){try{await t.run(S.raw(`ROLLBACK`))}catch(t){throw!n&&j(t)?e:(g=AggregateError([e,t],`Transaction rollback failed`),g)}throw e}})}catch(e){if(!A(e)||t===100)throw e;await M()}})),O=async(e,t)=>(await e.all(S`SELECT * FROM test_execution_attempt WHERE execution_attempt_id = ${t}`))[0],k=async(e,t)=>(await e.all(S`SELECT * FROM test_provider_operation WHERE execution_attempt_id = ${t}`))[0],I=async(e,t)=>(await e.all(S`SELECT execution_attempt_id FROM test_active_execution_attempt WHERE execution_id = ${t}`))[0]?.execution_attempt_id??null,W=async(e,t)=>{let n=await O(e,t.executionAttemptId),r=await k(e,t.executionAttemptId);if(n===void 0||r===void 0)return{kind:`not-found`};let i=E(n);return i.settlementKind==null?r.token===null||r.token!==t.token||r.generation!==t.generation||r.owner_id!==t.ownerId?{kind:`stale`,attempt:i}:{kind:`authorized`,attempt:i,attemptRow:n,operation:r}:{kind:`resolved`,attempt:i}},G=async(e,t)=>{let n=await W(e,t);return n.kind===`authorized`?void 0:{kind:n.kind}},K=async(e,t,n,r,i)=>{let a=await e.run(S`UPDATE test_execution_attempt
|
|
38
38
|
SET status = ${`settled`}, settlement_kind = ${n}, claimable = ${0}
|
|
39
39
|
WHERE execution_attempt_id = ${t}
|
|
40
40
|
AND settlement_kind IS NULL
|
|
@@ -42,14 +42,14 @@ import{DuplicateExecutionAttemptError as e,EXECUTION_ATTEMPT_SETTLEMENT_KINDS as
|
|
|
42
42
|
SET owner_id = NULL, token = NULL, lease_expires_at = NULL
|
|
43
43
|
WHERE execution_attempt_id = ${t}`:S`UPDATE test_provider_operation
|
|
44
44
|
SET owner_id = NULL, token = NULL, lease_expires_at = NULL, last_failure = ${JSON.stringify(i)}
|
|
45
|
-
WHERE execution_attempt_id = ${t}`),a},
|
|
45
|
+
WHERE execution_attempt_id = ${t}`),a},q=(e,t)=>{let n=o(e.allocationRef),i=t?S`CASE WHEN ${U()} THEN 1 ELSE 0 END`:S`${0}`;return b(t=>R(async()=>{let a=await W(t,e.claim);if(a.kind!==`not-found`&&s(a.attempt,n),a.kind===`resolved`)return{kind:`resolved`,allocationRef:a.attempt.allocationRef};if(a.kind!==`authorized`)return{kind:a.kind};let{attempt:o}=a;return o.allocationRef===null?async()=>{let r=await t.run(S`UPDATE test_execution_attempt
|
|
46
46
|
SET status = ${`allocated`},
|
|
47
47
|
allocation_ref = ${JSON.stringify(n)},
|
|
48
48
|
claimable = ${i}
|
|
49
49
|
WHERE execution_attempt_id = ${o.executionAttemptId}
|
|
50
50
|
AND allocation_ref IS NULL
|
|
51
|
-
AND ${
|
|
52
|
-
WHERE execution_attempt_id = ${o.executionAttemptId}`),r}:r(o.allocationRef,n)?{kind:`duplicate`,allocationRef:o.allocationRef}:{kind:`conflict`,allocationRef:o.allocationRef}},{kind:`recorded`}))};return{async createAttempt(t){return
|
|
51
|
+
AND ${V(e.claim)}`);return r.rowsAffected===0||await t.run(S`UPDATE test_provider_operation SET obligation = ${`allocation-control`}
|
|
52
|
+
WHERE execution_attempt_id = ${o.executionAttemptId}`),r}:r(o.allocationRef,n)?{kind:`duplicate`,allocationRef:o.allocationRef}:{kind:`conflict`,allocationRef:o.allocationRef}},{kind:`recorded`}))};return{async createAttempt(t){return b(async n=>{let r=new Date().toISOString();try{await n.run(S`INSERT INTO test_execution_attempt
|
|
53
53
|
(execution_attempt_id, execution_id, status, claimable, created_at)
|
|
54
54
|
VALUES (${t.executionAttemptId}, ${t.executionId}, ${`pending`}, ${0}, ${r})`)}catch(n){throw y(n)?new e(t.executionAttemptId,{cause:n}):n}return await n.run(S`UPDATE test_execution_attempt
|
|
55
55
|
SET claimable = ${0}
|
|
@@ -61,7 +61,7 @@ import{DuplicateExecutionAttemptError as e,EXECUTION_ATTEMPT_SETTLEMENT_KINDS as
|
|
|
61
61
|
AND status = ${`allocated`}`),await n.run(S`INSERT INTO test_active_execution_attempt (execution_id, execution_attempt_id)
|
|
62
62
|
VALUES (${t.executionId}, ${t.executionAttemptId})
|
|
63
63
|
ON CONFLICT(execution_id)
|
|
64
|
-
DO UPDATE SET execution_attempt_id = excluded.execution_attempt_id`),{executionAttemptId:t.executionAttemptId,executionId:t.executionId,status:`pending`,allocationRef:null,createdAt:r,providerId:null,allocationLifetime:null,provisionerIncarnationId:null,settlementKind:null,claimable:!1,claimExpiresAt:null}})},async beginProvisioning(e){let t=c(e.allocationLifetime),n={executionAttemptId:e.executionAttemptId,generation:1,ownerId:e.ownerId,token:crypto.randomUUID(),leaseExpiresAt:f(e.leaseExpiresAt)};return
|
|
64
|
+
DO UPDATE SET execution_attempt_id = excluded.execution_attempt_id`),{executionAttemptId:t.executionAttemptId,executionId:t.executionId,status:`pending`,allocationRef:null,createdAt:r,providerId:null,allocationLifetime:null,provisionerIncarnationId:null,settlementKind:null,claimable:!1,claimExpiresAt:null}})},async beginProvisioning(e){let t=c(e.allocationLifetime),n={executionAttemptId:e.executionAttemptId,generation:1,ownerId:e.ownerId,token:crypto.randomUUID(),leaseExpiresAt:f(e.leaseExpiresAt)};return b(r=>R(async()=>{let i=await O(r,e.executionAttemptId);if(i===void 0||i.execution_id!==e.executionId)return{kind:`not-found`};let a=E(i);return await I(r,e.executionId)===e.executionAttemptId?a.settlementKind==null?a.allocationRef===null?a.status===`pending`?async()=>{let i=await r.run(S`UPDATE test_execution_attempt
|
|
65
65
|
SET status = ${`provisioning`},
|
|
66
66
|
provider_id = ${e.providerId},
|
|
67
67
|
allocation_lifetime = ${t},
|
|
@@ -71,60 +71,60 @@ import{DuplicateExecutionAttemptError as e,EXECUTION_ATTEMPT_SETTLEMENT_KINDS as
|
|
|
71
71
|
AND status = ${`pending`}
|
|
72
72
|
AND allocation_ref IS NULL
|
|
73
73
|
AND settlement_kind IS NULL
|
|
74
|
-
AND ${
|
|
74
|
+
AND ${U()}`);return i.rowsAffected===0||await r.run(S`INSERT INTO test_provider_operation
|
|
75
75
|
(execution_attempt_id, generation, owner_id, token, lease_expires_at, obligation, failure_count)
|
|
76
76
|
VALUES (${e.executionAttemptId}, ${n.generation}, ${n.ownerId}, ${n.token},
|
|
77
|
-
${n.leaseExpiresAt}, ${`provisioning-resolution`}, ${0})`),i}:{kind:`already-provisioning`}:{kind:`allocated`,allocationRef:a.allocationRef}:{kind:`resolved`,allocationRef:a.allocationRef}:{kind:`fenced`}},{kind:`started`,claim:n}))},async getProviderOperation(e){return
|
|
77
|
+
${n.leaseExpiresAt}, ${`provisioning-resolution`}, ${0})`),i}:{kind:`already-provisioning`}:{kind:`allocated`,allocationRef:a.allocationRef}:{kind:`resolved`,allocationRef:a.allocationRef}:{kind:`fenced`}},{kind:`started`,claim:n}))},async getProviderOperation(e){return b(async t=>{let n=await k(t,e);return n===void 0?null:D(n)})},async renewProviderOperationClaim(e){let t=f(e.leaseExpiresAt);return b(n=>R(async()=>await G(n,e.claim)??(()=>n.run(S`UPDATE test_provider_operation SET lease_expires_at = ${t}
|
|
78
78
|
WHERE execution_attempt_id = ${e.claim.executionAttemptId}
|
|
79
|
-
AND ${
|
|
79
|
+
AND ${V(e.claim)}`)),{kind:`claimed`,claim:{...e.claim,leaseExpiresAt:t}}))},async takeOverProviderOperation(e){return b(async t=>{let n=await O(t,e.executionAttemptId),r=await k(t,e.executionAttemptId);if(n===void 0||r===void 0)return{kind:`not-found`};if(n.settlement_kind!==null)return{kind:`resolved`};if(r.owner_id!==null&&r.lease_expires_at!==null&&u(r.lease_expires_at)>u(e.observedAt))return{kind:`stale`};let i={executionAttemptId:e.executionAttemptId,generation:r.generation+1,ownerId:e.ownerId,token:crypto.randomUUID(),leaseExpiresAt:f(e.leaseExpiresAt)},{rowsAffected:a}=await t.run(S`UPDATE test_provider_operation
|
|
80
80
|
SET generation = ${i.generation}, owner_id = ${i.ownerId}, token = ${i.token},
|
|
81
81
|
lease_expires_at = ${i.leaseExpiresAt}
|
|
82
82
|
WHERE execution_attempt_id = ${e.executionAttemptId}
|
|
83
83
|
AND generation = ${r.generation}
|
|
84
|
-
AND ${
|
|
84
|
+
AND ${B(e.executionAttemptId)}`);return a===0?{kind:`stale`}:{kind:`claimed`,claim:i}})},async handoffProviderOperation(e){let t=e.evidence===void 0?null:m.parse(e.evidence);return b(n=>R(async()=>await G(n,e.claim)??(()=>n.run(t===null?S`UPDATE test_provider_operation
|
|
85
85
|
SET owner_id = NULL, token = NULL, lease_expires_at = NULL
|
|
86
86
|
WHERE execution_attempt_id = ${e.claim.executionAttemptId}
|
|
87
|
-
AND ${
|
|
87
|
+
AND ${V(e.claim)}`:S`UPDATE test_provider_operation
|
|
88
88
|
SET owner_id = NULL, token = NULL, lease_expires_at = NULL,
|
|
89
89
|
last_failure = ${JSON.stringify(t)}
|
|
90
90
|
WHERE execution_attempt_id = ${e.claim.executionAttemptId}
|
|
91
|
-
AND ${
|
|
91
|
+
AND ${V(e.claim)}`)),{kind:`recorded`}))},async recordProviderOperationUncertainty(e){let t=m.parse(e.evidence);return b(n=>R(async()=>await G(n,e.claim)??(()=>n.run(S`UPDATE test_provider_operation
|
|
92
92
|
SET failure_count = failure_count + 1, last_failure = ${JSON.stringify(t)}
|
|
93
93
|
WHERE execution_attempt_id = ${e.claim.executionAttemptId}
|
|
94
|
-
AND ${
|
|
94
|
+
AND ${V(e.claim)}`)),{kind:`recorded`}))},async recordAllocation(e){return q(e,!0)},async recordProvisioningAbsent(e){let t=m.parse(e.evidence);return b(n=>R(async()=>{let r=await W(n,e.claim);if(r.kind!==`authorized`)return{kind:r.kind};let{attempt:i}=r;return i.executionId===e.executionId?i.allocationRef===null?()=>K(n,i.executionAttemptId,`abandoned`,S`execution_id = ${e.executionId}
|
|
95
95
|
AND allocation_ref IS NULL
|
|
96
|
-
AND ${
|
|
96
|
+
AND ${z(e.claim)}`,t):{kind:`allocated`,allocationRef:i.allocationRef}:{kind:`not-found`}},{kind:`recorded`}))},async recordProvisionerIncarnationLost(e){let t=m.parse(e.proof.evidence);return b(n=>R(async()=>{let r=await W(n,e.claim);if(r.kind!==`authorized`)return{kind:r.kind};let{attempt:i}=r;return i.executionId===e.executionId?i.allocationLifetime===`provisioner-process-bound`?i.provisionerIncarnationId===null||i.provisionerIncarnationId!==e.proof.provisionerIncarnationId?{kind:`incarnation-mismatch`,provisionerIncarnationId:i.provisionerIncarnationId}:i.allocationRef===null?()=>K(n,i.executionAttemptId,`abandoned`,S`execution_id = ${e.executionId}
|
|
97
97
|
AND allocation_ref IS NULL
|
|
98
98
|
AND allocation_lifetime = ${`provisioner-process-bound`}
|
|
99
99
|
AND provisioner_incarnation_id = ${e.proof.provisionerIncarnationId}
|
|
100
|
-
AND ${
|
|
100
|
+
AND ${z(e.claim)}`,t):{kind:`allocated`,allocationRef:i.allocationRef}:{kind:`not-process-bound`,allocationLifetime:i.allocationLifetime}:{kind:`not-found`}},{kind:`recorded`}))},async recordAllocationTerminated(e){let t=m.parse(e.evidence);return b(n=>R(async()=>{let r=await W(n,e.claim);if(r.kind!==`authorized`)return{kind:r.kind};let{attempt:i}=r;return i.allocationRef===null?{kind:`not-allocated`}:()=>n.run(S`UPDATE test_provider_operation
|
|
101
101
|
SET obligation = ${`terminal-convergence`}, last_failure = ${JSON.stringify(t)}
|
|
102
102
|
WHERE execution_attempt_id = ${i.executionAttemptId}
|
|
103
|
-
AND ${
|
|
103
|
+
AND ${V(e.claim)}
|
|
104
104
|
AND EXISTS (SELECT 1 FROM test_execution_attempt
|
|
105
105
|
WHERE execution_attempt_id = ${i.executionAttemptId}
|
|
106
|
-
AND allocation_ref IS NOT NULL)`)},{kind:`recorded`}))},async recordInfrastructureFailure(e){return
|
|
106
|
+
AND allocation_ref IS NOT NULL)`)},{kind:`recorded`}))},async recordInfrastructureFailure(e){return b(t=>R(async()=>{let n=await W(t,e.claim);if(n.kind!==`authorized`)return{kind:n.kind};let{attempt:r,operation:i}=n;return r.executionId===e.executionId?r.allocationRef===null?{kind:`not-allocated`}:w(a,i.obligation,`obligation`)===`terminal-convergence`?()=>K(t,r.executionAttemptId,`infrastructure-failure`,S`execution_id = ${e.executionId}
|
|
107
107
|
AND allocation_ref IS NOT NULL
|
|
108
|
-
AND ${
|
|
109
|
-
AND ${
|
|
108
|
+
AND ${H(r.executionAttemptId)}
|
|
109
|
+
AND ${z(e.claim)}`):{kind:`not-terminated`}:{kind:`not-found`}},{kind:`recorded`}))},async getActiveAttempt(e,t){return b(async n=>{if(await I(n,e)!==t)return null;let r=await O(n,t);return r===void 0?null:E(r)})},async commitOutcome(e){let t=p(e.result);return b(n=>R(async()=>{if(await I(n,e.executionId)!==e.executionAttemptId)return{kind:`fenced`};let r=await O(n,e.executionAttemptId);if(r===void 0)return{kind:`fenced`};let a=T(r.workflow_result,e=>_.parse(e));return a===null?r.settlement_kind===null?async()=>{let r=await n.run(S`UPDATE test_execution_attempt SET workflow_result = ${JSON.stringify(t)}
|
|
110
110
|
WHERE execution_attempt_id = ${e.executionAttemptId}
|
|
111
111
|
AND workflow_result IS NULL
|
|
112
112
|
AND settlement_kind IS NULL
|
|
113
|
-
AND ${
|
|
113
|
+
AND ${U()}`);return r.rowsAffected===0?r:K(n,e.executionAttemptId,`outcome`,S`workflow_result IS NOT NULL`)}:{kind:`conflict`}:i(a,t)?{kind:`duplicate`,outcome:a}:{kind:`conflict`}},{kind:`accepted`,outcome:t}))},async abandonPendingAttempt(e,t){return b(n=>R(async()=>{if(await I(n,t)!==e)return{kind:`fenced`};let r=await O(n,e);if(r===void 0)return{kind:`fenced`};let i=E(r);return i.status===`allocated`?{kind:`allocated`}:i.status===`provisioning`?{kind:`provisioning`}:i.status===`settled`?{kind:i.settlementKind===`abandoned`?`already-abandoned`:`already-settled`}:()=>n.run(S`UPDATE test_execution_attempt
|
|
114
114
|
SET status = ${`settled`}, settlement_kind = ${`abandoned`}, claimable = ${0}
|
|
115
115
|
WHERE execution_attempt_id = ${e}
|
|
116
116
|
AND execution_id = ${t}
|
|
117
117
|
AND status = ${`pending`}
|
|
118
118
|
AND settlement_kind IS NULL
|
|
119
|
-
AND ${
|
|
119
|
+
AND ${U()}`)},{kind:`abandoned`}))},recovery:{async getAttemptWithAllocation(e){return b(async t=>{let n=await O(t,e);return n===void 0?null:E(n)})},async recordDiscoveredAllocation(e){return q(e,!1)},async evolveAllocationRef(e){let{currentRef:t,nextRef:n}=d(e);return b(i=>R(async()=>{let a=await W(i,e.claim);if(a.kind===`stale`)return{kind:`stale`,storedRef:a.attempt.allocationRef};if(a.kind!==`authorized`)return{kind:a.kind};let{attempt:o,attemptRow:s}=a;return o.executionId===e.executionId?o.allocationRef===null?{kind:`not-allocated`}:r(o.allocationRef,t)?()=>i.run(S`UPDATE test_execution_attempt SET allocation_ref = ${JSON.stringify(n)}
|
|
120
120
|
WHERE execution_attempt_id = ${o.executionAttemptId}
|
|
121
121
|
AND execution_id = ${e.executionId}
|
|
122
122
|
AND allocation_ref = ${s.allocation_ref}
|
|
123
|
-
AND ${
|
|
123
|
+
AND ${V(e.claim)}`):{kind:`stale`,storedRef:o.allocationRef}:{kind:`not-found`}},{kind:`evolved`}))},async getRecoverableAttempts(e){return b(async t=>{let n=new Date().toISOString();return(await t.all(S`SELECT * FROM test_execution_attempt
|
|
124
124
|
WHERE execution_id = ${e}
|
|
125
125
|
AND status = ${`allocated`}
|
|
126
126
|
AND settlement_kind IS NULL
|
|
127
127
|
AND allocation_ref IS NOT NULL
|
|
128
128
|
AND claimable = ${1}
|
|
129
129
|
AND (claim_expires_at IS NULL OR claim_expires_at >= ${n})
|
|
130
|
-
ORDER BY created_at ASC, execution_attempt_id ASC`)).map(e=>l(E(e)))})}}}}export{
|
|
130
|
+
ORDER BY created_at ASC, execution_attempt_id ASC`)).map(e=>l(E(e)))})}}}}export{W as createSqliteAttemptRepository};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{D as e,M as t,c as n,ct as r,d as i,i as a,l as o,r as s,s as c,t as l,y as u}from"../authority-state-bootstrap-
|
|
1
|
+
import{D as e,M as t,c as n,ct as r,d as i,i as a,l as o,r as s,s as c,t as l,y as u}from"../authority-state-bootstrap-CLYus369.mjs";import{WORKFLOW_CANCELLED_REASON as d,WorkflowRunContextSchema as f}from"@makaio/framework/contracts";import*as p from"node:os";async function m(e,n,i,a){let o=await y(e,n,i);return await e.request(t.setExecution,{execution:o}),i===`completed`?await e.emit(r.execution.completed,{executionId:n.executionId,workflowId:n.workflowId,totalDuration:0,completedAt:o.completedAt}):await e.emit(r.execution.cancelled,{executionId:n.executionId,workflowId:n.workflowId,reason:a,completedAt:o.completedAt}),i===`cancelled`?{executionId:n.executionId,workflowId:n.workflowId,status:`cancelled`,...a===void 0?{}:{reason:a}}:{executionId:n.executionId,workflowId:n.workflowId,status:`completed`}}function h(e,t){return t.status===`completed`?{executionId:e.executionId,workflowId:e.workflowId,status:`completed`,...t.artifact===void 0?{}:{artifact:t.artifact}}:t.status===`cancelled`?{executionId:e.executionId,workflowId:e.workflowId,status:`cancelled`,...t.reason===void 0?{}:{reason:t.reason}}:t.status===`paused`?{executionId:e.executionId,workflowId:e.workflowId,status:`paused`,pausedAtGateId:t.pausedAtGateId,pausedAtFrameId:t.pausedAtFrameId}:{executionId:e.executionId,workflowId:e.workflowId,status:`failed`,error:t.error}}function g(t){let n,r=()=>{n=u({bus:t.bus,activeExecutions:t.activeExecutions,shellAbortControllers:t.shellAbortControllers,activeRunnerSteps:t.activeRunnerSteps,durableLifecycleTransitions:t.durableLifecycleTransitions,lifecyclePublications:t.lifecyclePublications,publishingLifecycleExecutions:t.publishingLifecycleExecutions,cancelTimeoutMs:e.cancelTimeoutMs},t.executionId,d).catch(e=>(console.error(`[WorkflowOrchestrator] Failed to persist cancellation for ${t.executionId}:`,e),!1))};return t.signal.addEventListener(`abort`,r,{once:!0}),t.signal.aborted&&r(),async()=>(t.signal.removeEventListener(`abort`,r),n??!1)}async function _(e,n){let r=await e.requestOptional(t.getExecution,{executionId:n});return r.handled?r.data.execution?.startedAt??void 0:void 0}async function v(e,t){return{id:t.executionId,workflowId:t.workflowId,coordinatorSessionId:t.coordinatorSessionId,status:`running`,inputs:t.inputs,config:t.config??{},startedAt:await _(e,t.executionId)??Date.now(),triggerPayload:t.triggerPayload,...t.artifactRef===void 0?{}:{artifactRef:t.artifactRef},scope:t.scope}}async function y(e,t,n){let r=Date.now();return{id:t.executionId,workflowId:t.workflowId,coordinatorSessionId:t.coordinatorSessionId,status:n,inputs:t.inputs,config:t.config??{},startedAt:await _(e,t.executionId)??r,completedAt:r,triggerPayload:t.triggerPayload,...t.artifactRef===void 0?{}:{artifactRef:t.artifactRef},scope:t.scope}}async function b(e,t,r,i,s,c,l,u,f){let m=e.suspensionStrategy===`wait-in-process`?void 0:await x(e.executionId,l,{required:!0}),h=await n({definition:t,execution:r,runContext:i,zodSchema:f?.artifact,bus:l}),g=new o(e.executionId,e.workflowId,t,r,s,l,u,void 0,h,{context:{repoPath:process.cwd(),makaioHome:process.env.MAKAIO_HOME??`${p.homedir()}/.makaio`,os:process.platform===`win32`?`win32`:process.platform===`darwin`?`darwin`:`linux`,arch:process.arch},env:e.env},{suspensionStrategy:e.suspensionStrategy,resumeFrames:m,runtimeLoopGates:c}),_=g.buildExpressionContext(),v=await a(t.root,g,_);return v.status===`failed`?{status:`failed`,error:v.error}:v.status===`paused`?{status:`paused`,pausedAtGateId:v.pausedAtGateId,pausedAtFrameId:v.pausedAtFrameId}:v.status===`cancelled`||u.aborted?{status:`cancelled`,reason:d}:{status:`completed`,artifact:h?.current}}async function x(e,n,r={}){try{let i=await n.requestOptional(t.listFrames,{executionId:e});if(!i.handled){if(r.required===!0)throw Error(`Frame storage handler is required to resume execution '${e}'.`);return}return i.data.frames.length===0?void 0:c(i.data.frames)}catch(e){if(r.required===!0)throw e;return}}function S(e,t){return f.parse({executionId:e.executionId,workflowId:e.workflowId,source:e.source.kind===`path`?{kind:`path`,path:e.materializationSpec?.sourcePath??``}:e.source,definitionSnapshot:e.source.kind===`definition`?e.definition??t:t,workerManifest:{contributionRefs:[]},inputs:e.inputs,config:e.config??{},scope:e.scope,triggerPayload:e.triggerPayload,...e.artifactRef===void 0?{}:{artifactRef:e.artifactRef},coordinatorSessionId:e.coordinatorSessionId,cancelSubject:e.cancelSubject,env:e.env,createdAt:Date.now(),suspensionStrategy:e.suspensionStrategy,...e.terminalAuthority===void 0?{}:{terminalAuthority:e.terminalAuthority},...e.materializationSpec===void 0?{}:{materializationSpec:e.materializationSpec}})}async function C(e,n,i,a,o){i.status=`paused`,await e.request(t.setExecution,{execution:i}),await e.emit(r.execution.paused,{executionId:n.executionId,workflowId:n.workflowId,pausedAtGateId:a,pausedAtFrameId:o})}async function w(e,t,n,i,a,o){n===`completed`?await e.emit(r.execution.completed,{executionId:t.executionId,workflowId:t.workflowId,totalDuration:a-i.startedAt,completedAt:a}):n===`cancelled`?await e.emit(r.execution.cancelled,{executionId:t.executionId,workflowId:t.workflowId,reason:d,completedAt:a}):await e.emit(r.execution.failed,{executionId:t.executionId,workflowId:t.workflowId,error:o??`Workflow execution failed`,completedAt:a})}async function T(e){let{config:n,loaded:r,bus:a,signal:o}=e,{definition:c}=r;if(o.aborted)return n.terminalAuthority===`authority`?{executionId:n.executionId,workflowId:n.workflowId,status:`cancelled`,reason:d}:m(a,n,`cancelled`,d);let u=await v(a,n),f=S(n,c);n.terminalAuthority===`authority`?await l(a,f,c):await i(a,u,f,c);let p=new Map(r.runtimeHandlers),_=r.runtimeLoopGates??new Map,y=new Map,x=new Map,T=new Map,E=new Map,D=new Map,O=new Set;y.set(n.executionId,{execution:u,workflow:c,runContext:f,runtimeHandlers:p,runtimeLoopGates:new Map(_)});let k=n.terminalAuthority===`authority`?async()=>!1:g({signal:o,executionId:n.executionId,bus:a,activeExecutions:y,shellAbortControllers:x,activeRunnerSteps:T,durableLifecycleTransitions:E,lifecyclePublications:D,publishingLifecycleExecutions:O}),A={status:`completed`},j=!1;try{c.root.nodes.length>0&&(s(c,_),A=await b(n,c,u,f,p,_,a,o,r.zodSchemas))}catch(e){A={status:`failed`,error:e instanceof Error?e.message:String(e)}}finally{j=await k(),y.clear()}if(j)return h(n,{status:`cancelled`,reason:d});if((o.aborted||u.status===`cancelled`)&&(A={status:`cancelled`,reason:d}),A.status===`paused`)return n.terminalAuthority!==`authority`&&await C(a,n,u,A.pausedAtGateId,A.pausedAtFrameId),h(n,A);if(n.terminalAuthority===`authority`)return h(n,A);let M=Date.now(),N=A.status===`failed`?A.error:void 0;return u.status=A.status,u.completedAt=M,u.error=N,await a.request(t.setExecution,{execution:u}),await w(a,n,A.status,u,M,N),h(n,A)}export{T as runWorkflowOrchestrator};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { JsonValue, WorkflowAutomationTriggerBinding } from "@makaio/framework/contracts";
|
|
2
|
+
|
|
3
|
+
//#region subsystems/workflow-engine/src/workflow-trigger-binding-consumer.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Predicate deciding whether one emitted trigger payload passes a workflow
|
|
6
|
+
* binding's consumer-owned filters.
|
|
7
|
+
* @param payload - Payload of an automation trigger event.
|
|
8
|
+
* @returns `true` when the payload passes every declared filter.
|
|
9
|
+
* @throws When the compiled `filterExpression` fails at evaluation time.
|
|
10
|
+
*/
|
|
11
|
+
type WorkflowTriggerPayloadPredicate = (payload: JsonValue) => boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Compiles the consumer-owned filters of a workflow trigger binding.
|
|
14
|
+
*
|
|
15
|
+
* `filter` and `filterExpression` are consumer semantics: they narrow an event
|
|
16
|
+
* that an automation trigger has already validated and emitted, so they are
|
|
17
|
+
* evaluated here rather than by the trigger source. Both are ANDed, structural
|
|
18
|
+
* filter first, and a binding that declares neither yields a predicate that
|
|
19
|
+
* accepts every payload.
|
|
20
|
+
*
|
|
21
|
+
* The expression is compiled eagerly so an unparseable expression fails at
|
|
22
|
+
* reconciliation time — where a caller can keep its last-good subscriptions —
|
|
23
|
+
* instead of silently behaving like "no expression" on every event.
|
|
24
|
+
*
|
|
25
|
+
* Evaluation failures are **not** swallowed: the predicate throws so each caller
|
|
26
|
+
* can attribute the failure to its own consumer identity before deciding to skip
|
|
27
|
+
* the event.
|
|
28
|
+
* @param binding - Persisted workflow trigger binding.
|
|
29
|
+
* @returns Predicate applying the binding's filters to an emitted payload.
|
|
30
|
+
* @throws When `filterExpression` cannot be compiled.
|
|
31
|
+
*/
|
|
32
|
+
declare function compileWorkflowTriggerBindingFilter(binding: WorkflowAutomationTriggerBinding): WorkflowTriggerPayloadPredicate;
|
|
33
|
+
/**
|
|
34
|
+
* Asserts that a generic automation event carries the object root required by a
|
|
35
|
+
* workflow start.
|
|
36
|
+
*
|
|
37
|
+
* Workflow consumers admit only descriptors whose output JSON Schema declares
|
|
38
|
+
* an object root. This assertion protects the final delivery seam from contract
|
|
39
|
+
* drift without inventing data for a scalar source.
|
|
40
|
+
* @param payload - Validated automation trigger event payload.
|
|
41
|
+
* @returns The same object payload.
|
|
42
|
+
* @throws When a workflow-incompatible payload reaches the consumer.
|
|
43
|
+
*/
|
|
44
|
+
declare function assertWorkflowTriggerPayload(payload: JsonValue): Record<string, JsonValue>;
|
|
45
|
+
//#endregion
|
|
46
|
+
export { WorkflowTriggerPayloadPredicate, assertWorkflowTriggerPayload, compileWorkflowTriggerBindingFilter };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{matchesFilter as e}from"@makaio/framework/bus";import{compile as t}from"@makaio/framework/expression";function n(n){let{filter:r,filterExpression:i}=n,a=i===void 0?void 0:t(i);return r===void 0&&a===void 0?()=>!0:t=>r!==void 0&&!e(t,r)?!1:a===void 0?!0:!!a.evalSync({payload:t})}function r(e){if(typeof e!=`object`||!e||Array.isArray(e))throw Error(`Workflow trigger payload must have an object root`);return e}export{r as assertWorkflowTriggerPayload,n as compileWorkflowTriggerBindingFilter};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{u as e}from"./framework-packages-BHgul8Kl.mjs";function t(){let t=new Map;return{filter:e=>!!(e.transitionRules?.rules?.length||e.transitionActions?.actions),async processActivated(i,a,o){let s=o.getService(e);if(!s)throw Error(`TransitionContributionProcessor: TransitionPipelineService is not available — ensure '${e.name}' is started before extensions with transitionRules or transitionActions.`);let c=a.transitionRules?.rules??[],l=a.transitionActions?.actions,u=c.length>0,d=l!==void 0;u&&n(i,c),d&&r(i,l);let f=!1,p=!1;try{u&&(s.ruleRegistry.register(i,c),f=!0),d&&(s.actionRegistry.register(i,l),p=!0)}catch(e){throw f&&s.ruleRegistry.deregister(i),p&&s.actionRegistry.deregister(i),e}t.set(i,()=>{u&&s.ruleRegistry.deregister(i),d&&s.actionRegistry.deregister(i)})},async processStopped(e){let n=t.get(e);if(n){try{n()}catch(t){console.error(`[TransitionContributionProcessor] Deregister error for "${e}":`,t)}t.delete(e)}}}}function n(e,t){let n=`${e}.`;for(let e of t)if(!e.id.startsWith(n))throw Error(`TransitionContributionProcessor: rule '${e.id}' must be namespaced by extension '${n}'`)}function r(e,t){let n=`${e}.`;for(let e of Object.keys(t))if(!e.startsWith(n))throw Error(`TransitionContributionProcessor: action type '${e}' must be namespaced by extension '${n}'`)}export{t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{resolveMakaioHome as e}from"./runtime-node/makaio-config.mjs";import{t}from"./extension-package-provenance-aYrZuS4W.mjs";import{n,o as r,t as i}from"./await-trigger-Bkg2BQfg.mjs";import*as a from"node:fs/promises";import{access as o}from"node:fs/promises";import*as s from"node:path";import{basename as c,join as l}from"node:path";import*as u from"node:crypto";import{constants as d}from"node:fs";import{createBusInstance as f,waitForSubscriptionPropagation as p}from"@makaio/framework/bus";import{AdapterSubjects as m,BoundedRecoveryEvidenceSchema as h,FrameworkContractNamespaces as g,FrameworkStorageNamespaces as _,PROVIDER_ALLOCATION_REF_VERSION as ee,ProviderAllocationRefSchema as te,RECOVERY_EVIDENCE_LIMITS as v,WorkerNodeCapabilitiesSchema as ne,WorkerNodeSubjects as y,WorkflowSubjects as re,WorkflowWorkerConfigSchema as ie,createWorkflowCancelSubject as ae}from"@makaio/framework/contracts";import{ExtensionCoordinator as oe,KernelSubjects as se,coalesceExtensionOverrides as ce,filterEligibleExtensions as le}from"@makaio/framework/kernel";import{BaseService as ue}from"@makaio/framework/service-base";import{AdapterRuntimeSubjects as de,registerAdapterRuntimeIdentityHandlers as fe}from"@makaio/framework/services/adapter-runtime";import{CLIDetectionNamespace as pe,CLIDetectionSubjects as me}from"@makaio/framework/services/cli-detection/namespace";import{SessionOrchestratorToken as he,ToolRegistryToken as ge,canonicalModelPackage as _e,createSubagentServicePackage as ve,createToolContributionProcessor as ye,frameworkCorePackages as b,sessionBridgePackage as be,sessionOrchestratorPackage as xe,sessionPackage as Se,sessionStoragePackage as Ce,toolRegistryPackage as we}from"@makaio/framework/services";import{AdapterSubsystemSubjects as x}from"@makaio/framework/services/adapter-subsystem";import{createClientsCorePackage as Te}from"@makaio/framework/clients";import{AdapterSubsystemToken as S,createAdapterSubsystemContributionProcessor as Ee,createAdapterSubsystemPackage as De,orderAfterAdapterSubsystem as Oe}from"@makaio/framework/adapter-subsystem";import{execa as ke}from"execa";import Ae from"piscina";import{ExecutionAttemptAuthority as je,runAuthorityDispatchedAttempt as Me}from"@makaio/framework/workflow-engine";import{runWorkflowOrchestrator as Ne}from"@makaio/framework/workflow-engine/workflow-orchestrator";function C(e){return e.on(m.getCapabilities,async t=>{let{adapterName:n,adapterId:r}=t.payload;if(r){await t.next();return}if(n){let r=await e.requestOptional(de.resolveId,{adapterName:n}),i=r.handled?r.data.adapterId:void 0;i&&(t.payload.adapterId=i)}await t.next()},{priority:20})}function w(e){let{coordinator:t,configRepository:n,platformDefaults:r,prepareAuthRuntime:i,runtimeSnapshotHandlerPriority:a,runtimeDefinitionHandlerPriority:o}=e,s=De({configRepository:n,coordinator:t,platformDefaults:r,...i!==void 0&&{prepareAuthRuntime:i},...a!==void 0&&{runtimeSnapshotHandlerPriority:a},...o!==void 0&&{runtimeDefinitionHandlerPriority:o}});return t.registerContributionProcessor(Ee({getAdapterSubsystemService:()=>t.getExtensionService(S)})),{adapterSubsystemPackage:s}}function T(e){let{bus:t,currentMachineId:n}=e,r=fe(t,{currentMachineId:n,listKnownAdapterNames:e.listKnownAdapterNames??(async()=>{let{configs:e}=await t.request(x.listAdapterConfigs,{});return e.map(e=>e.name)}),...e.resolveLiveAdapterId!==void 0&&{resolveLiveAdapterId:e.resolveLiveAdapterId},...e.resolveLiveAdapterIdentity!==void 0&&{resolveLiveAdapterIdentity:e.resolveLiveAdapterIdentity},...e.listLiveAdapterIdentities!==void 0&&{listLiveAdapterIdentities:e.listLiveAdapterIdentities}}),i=C(t);return{cleanup:()=>{r.cleanup(),i()}}}function E(e,t){if(!(e instanceof Error))return!1;let{rootPackageName:n,subpath:r}=Pe(t),i=(r===void 0?[t]:[t,n]).flatMap(e=>[`Cannot find package '${e}'`,`Cannot find module '${e}'`,`Cannot find package "${e}"`,`Cannot find module "${e}"`]),a=e;return(a.code===`ERR_MODULE_NOT_FOUND`||a.code===`MODULE_NOT_FOUND`)&&i.some(t=>e.message.includes(t))||a.code===`ERR_PACKAGE_PATH_NOT_EXPORTED`&&r!==void 0&&e.message.includes(`Package subpath '${r}' is not defined by "exports"`)&&Fe(e.message,n)?!0:i.some(t=>e.message.includes(t))}async function D(e){try{return await import(e)}catch(t){if(E(t,e))return null;throw t}}function Pe(e){let t=e.split(`/`);return e.startsWith(`@`)?{rootPackageName:t.slice(0,2).join(`/`),subpath:t.length>2?`./${t.slice(2).join(`/`)}`:void 0}:{rootPackageName:t[0]??e,subpath:t.length>1?`./${t.slice(1).join(`/`)}`:void 0}}function Fe(e,t){let n=t,r=t.replaceAll(`/`,`\\`);return e.includes(`/${n}/package.json`)||e.includes(`\\${r}\\package.json`)}async function O(e,t=process.env,n=process.platform){let r=t[Object.keys(t).find(e=>e.toUpperCase()===`PATH`)??`PATH`]??``,i=(t.PATHEXT??`.EXE;.CMD;.BAT;.COM`).split(`;`).filter(Boolean),a=n===`win32`?s.extname(e)===``?i:[``,...i]:[``];for(let t of r.split(s.delimiter)){let n=t.replace(/^"|"$/gu,``),r=s.resolve(n||process.cwd());for(let t of a){let n=s.join(r,`${e}${t}`);try{return await o(n,d.X_OK),n}catch{}}}}async function k(e,t=5e3,n=1e3){let{stdout:r}=await ke(e,[`--version`],{forceKillAfterDelay:n,timeout:t});return r}function Ie(e){return e.match(/(\d+\.\d+\.\d+)/u)?.[1]??`unknown`}async function Le(e,t=O,n=k){try{let r=await t(e);if(r===void 0)return{binary:e,found:!1};let i=await n(r);return i.length===0?{binary:e,found:!1}:{binary:e,found:!0,path:r,version:Ie(i)}}catch{return{binary:e,found:!1}}}async function Re(e,t=O,n=k){return Promise.all(e.map(e=>Le(e,t,n)))}var ze=class extends ue{constructor(e){super(e)}onInit(){this.registerHandler(me.scan,async e=>{let t=await Re(e.payload.binaries);e.setResult({results:t})})}};const A={name:`makaio.cli-detection`,displayName:`CLI Detection`,version:`0.1.0`,critical:!0,surface:`any`,namespaces:[pe],create:e=>new ze(e.bus)};function j(e,t){e.push(...Be(t))}function Be(e){return e===void 0?[]:typeof e==`function`?[e]:[...e]}function Ve(e,t=[]){let n=new Set([e]),r=new Set,i=new Map;for(let e of t)typeof e==`string`?n.add(e):(r.add(e.id),e.version!==void 0&&i.set(e.id,e.version));return{hosts:n,capabilities:r,...i.size>0?{capabilityVersions:i}:{}}}function He(e=[]){return e.some(e=>typeof e==`string`&&e===`node`)?e:[`node`,...e]}function M(e){return ce(le(We(e.packages,e.configProvider),e.surface,e.runtimeEnvironment))}function Ue(e,n){let r=M(n),i=new Set(r.map(t));return e.filter(({ownerPackage:e})=>i.has(e)).map(({package:e})=>e)}function We(e,t){return t?e.filter(e=>t.loadEnabled(e.name)!==!1):e}function N(e,t){return e.filter(e=>e.runtimeOwnership?.[t]===!0).map(e=>e.name)}function Ge(e,t){let n=N(e,t);if(n.length>1)throw Error(`Multiple extensions own runtimeOwnership.${t}: ${n.join(`, `)}`)}function P(e){return Ge(e,`sessionOrchestrator`),N(e,`sessionOrchestrator`).length===0}function Ke(e){return e===!0||P(e)?b:b.filter(e=>e.name!==he.name)}function F(e,t,n){let r=[];try{for(let i of e){let e=i.runtimeBoot;e&&j(r,e.configure({bus:t,registerContributionProcessor:e=>{r.push(n.registerContributionProcessor(e))},forEachActiveExtension:e=>{n.forEachActiveExtension(e)}}))}}catch(e){let t=[];for(let e of[...r].reverse())try{e()}catch(e){t.push(e)}throw t.length>0?AggregateError([e,...t],`Extension boot contribution failed and rollback cleanup reported additional errors`,{cause:e}):e}return r}function qe(){let e=process.env.MAKAIO_SKIP_EXTENSIONS;if(!e)return new Set;let t=e.split(`,`).map(e=>e.trim()).filter(Boolean);return new Set(t)}var Je=class{pool;constructor(e){this.pool=new Ae({filename:e.workerEntry,maxThreads:e.maxConcurrency??4,idleTimeout:e.idleTimeoutMs??3e4})}async run(e,t){return this.pool.run(e,{signal:t})}onMessage(e){return this.pool.on(`message`,e),()=>this.pool.off(`message`,e)}async dispose(){await this.pool.destroy()}},I=class extends Error{code;constructor(e,t){super(e),this.code=t,this.name=`MaterializationError`}};function L(e,t,n){let r=s.resolve(t)+s.sep,i=s.resolve(e);if(i!==s.resolve(t)&&!i.startsWith(r))throw new I(`${n} escapes allowed root: ${e} is not within ${t}`,`containment-violation`)}async function R(e,t,n,r){let i=r??await a.realpath(t),o;try{o=await a.realpath(e)}catch{return e}let c=i+s.sep;if(o!==i&&!o.startsWith(c))throw new I(`${n} escapes allowed root via symlink: real path ${o} is not within ${i}`,`symlink-escape`);return o}function z(e){let t=e.indexOf(`-`);if(t===-1)throw new I(`Invalid SRI integrity format: ${e}`,`contribution-integrity-mismatch`);return{algorithm:e.slice(0,t),digest:e.slice(t+1)}}async function Ye(e,t){let n=await a.readFile(e);return u.createHash(t).update(n).digest(`base64`)}const B=new Set([`.git`,`node_modules`]);function Xe(e){return B.has(e.toLowerCase())}async function Ze(e,t){let n=t.toLowerCase();if(!B.has(n))return!1;if(t===n)return!0;try{let[r,i]=await Promise.all([a.lstat(s.join(e,t)),a.lstat(s.join(e,n))]);return r.dev===i.dev&&r.ino===i.ino}catch(e){if(e.code===`ENOENT`)return!1;throw e}}const Qe=B,$e=new Set([`.DS_Store`]);async function V(e,t){let n=u.createHash(t),r=[];async function i(t){let n=await a.readdir(t,{withFileTypes:!0});for(let a of n){let n=s.join(t,a.name);if(a.isSymbolicLink())throw new I(`Contribution package contains a symbolic link: ${s.relative(e,n)}`,`symlink-escape`);if(a.isDirectory()){Qe.has(a.name)||await i(n);continue}if(a.isFile()){$e.has(a.name)||r.push(s.relative(e,n));continue}throw new I(`Contribution package contains an unsupported filesystem entry: ${s.relative(e,n)}`,`contribution-integrity-mismatch`)}}await i(e),r.sort();for(let t of r)n.update(t.split(s.sep).join(`/`)),n.update(`\0`),n.update(await a.readFile(s.join(e,t))),n.update(`\0`);return`${t}-${n.digest(`base64`)}`}async function H(e,t=`sha256`){let n=u.createHash(t),r=[];async function i(t){let n=await a.readdir(t,{withFileTypes:!0});for(let a of n){let n=s.join(t,a.name);if(!await Ze(t,a.name)){if(a.isDirectory()){await i(n);continue}if(a.isFile()){r.push(s.relative(e,n));continue}throw a.isSymbolicLink()?new I(`Workspace root contains a symbolic link: ${s.relative(e,n)}`,`symlink-escape`):new I(`Workspace root contains an unsupported filesystem entry: ${s.relative(e,n)}`,`unsupported-filesystem-entry`)}}}await i(e),r.sort();for(let t of r){n.update(t),n.update(`\0`);let r=await a.readFile(s.join(e,t));n.update(r),n.update(`\0`)}return`${t}-${n.digest(`base64`)}`}async function U(e,t,n){let r=s.join(t,`node_modules`,e.packageName);L(r,t,`Contribution package directory`),await R(r,t,`Contribution package directory`,n);let i=s.join(r,`package.json`),o;try{o=await a.readFile(i,`utf-8`)}catch{throw new I(`Contribution package not found: ${e.packageName} (expected at ${r})`,`contribution-missing`)}let c=JSON.parse(o);if(c.name!==e.packageName)throw new I(`Contribution identity mismatch: expected ${e.packageName}, found ${c.name??`<none>`}`,`contribution-missing`);if(c.version!==e.version)throw new I(`Contribution version mismatch for ${e.packageName}: expected ${e.version}, found ${c.version??`<none>`}`,`contribution-version-mismatch`);let l=s.join(r,e.entrypoint);L(l,r,`Contribution entrypoint`),await R(l,t,`Contribution entrypoint`,n);try{await a.access(l)}catch{throw new I(`Contribution entrypoint not found for ${e.packageName}: ${e.entrypoint}`,`contribution-entrypoint-mismatch`)}let{algorithm:u}=z(e.integrity),d;try{d=await V(r,u)}catch(t){if(t instanceof I)throw t;let n=typeof t==`object`&&t&&`code`in t&&typeof t.code==`string`?t.code:void 0;throw n!==void 0&&!n.startsWith(`ERR_`)?new I(`Contribution package cannot be read for ${e.packageName}`,`contribution-entrypoint-mismatch`):t}if(d!==e.integrity)throw new I(`Contribution integrity mismatch for ${e.packageName}: expected ${e.integrity}, computed ${d}`,`contribution-integrity-mismatch`);return l}async function W(e,t,n){let r=await n.resolveWorkspaceRoot(e.workspaceId);if(r===void 0)throw new I(`Unknown workspace ID: ${e.workspaceId}`,`unknown-workspace`);try{if(!(await a.stat(r)).isDirectory())throw new I(`Workspace root is not a directory: ${r}`,`containment-violation`)}catch(e){throw e instanceof I?e:new I(`Workspace root does not exist: ${r}`,`containment-violation`)}let i=await a.realpath(r),o=s.resolve(r,e.sourcePath);if(L(o,r,`Source path`),s.relative(r,o).split(s.sep).some(Xe))throw new I(`Workflow source path selects excluded workspace content: ${e.sourcePath}`,`source-path-mismatch`);await R(o,r,`Source path`,i);let c=await H(r);if(c!==e.rootDigest)throw new I(`Workspace root digest mismatch: expected ${e.rootDigest}, computed ${c}`,`digest-mismatch`);try{await a.access(o)}catch{throw new I(`Workflow source file not found: ${o}`,`source-missing`)}return{workspaceRoot:r,sourcePath:o,contributionEntrypoints:await Promise.all(t.map(e=>U(e,r,i))),platform:process.platform,arch:process.arch}}var G=class{options;manifest;pool;constructor(e){this.options=e,this.manifest=e.manifest}async run(e,t,n){this.pool??=new Je(this.options);let r=n??this.manifest,i=await this.materializeTask(e,r,t);return{state:`uncommitted`,result:await this.pool.run(i,t)}}runWithReadiness(e,t,n){this.pool??=new Je(this.options);let i=this.pool,a,o=!1,s,c=new Promise((t,n)=>{s=n,a=i.onMessage(n=>{r(n)&&(n.executionId!==e.executionId||n.cancelSubject!==e.cancelSubject||(o=!0,a?.(),t(n)))})}),l=n??this.manifest,u=this.materializeTask(e,l,t).then(e=>i.run(e,t));return u.then(()=>{o||(o=!0,a?.(),s(Error(`Workflow worker completed before ready signal: ${e.executionId}`)))},e=>{o||(o=!0,a?.(),s(e instanceof Error?e:Error(String(e))))}),{result:u,ready:c}}async dispose(){await this.pool?.dispose()}async materializeTask(e,t,n){if(n.throwIfAborted(),!(e.source.kind===`path`||t.contributionRefs.length>0))return{config:e,manifest:t,contributionEntrypoints:[]};let r=e.materializationSpec;if(r?.kind!==`local-directory`)throw Error(`ThinWorkflowPiscinaRunner requires a local-directory materialization spec for path-backed workflows or declared contributions.`);if(this.options.resolveWorkspaceRoot===void 0)throw Error(`ThinWorkflowPiscinaRunner requires a host workspace-root resolver for local-directory materialization.`);let i=await W(r,t.contributionRefs,{resolveWorkspaceRoot:this.options.resolveWorkspaceRoot});if(n.throwIfAborted(),e.source.kind!==`path`)throw Error(`local-directory materialization requires a path-backed workflow source.`);return{config:{...e,source:{kind:`path`,path:i.sourcePath}},manifest:t,contributionEntrypoints:i.contributionEntrypoints}}};function K(e){return e.mode===`source`?l(e.moduleDir,`workflow-worker`,`worker-entry.ts`):l(e.moduleDir,`workflow-worker`,`worker-entry.mjs`)}var q=class{options;constructor(e){this.options=e}async run(e,t,n,r){let i={...e,terminalAuthority:`authority`},a=n??this.options.manifest,o=this.options.requirements,s=r?.dispatchMetadata;return Me({authority:this.options.authority,executionId:e.executionId,dispatch:e=>this.options.dispatch({executionAttemptId:e,config:i,...a!==void 0&&{manifest:a},...o!==void 0&&{requirements:o},...s!==void 0&&{metadata:s}},t)})}},J=class{#e;constructor(e){this.#e=e.bus}async run(e,t,r){let a=ie.parse(e),o=await n(a);return{state:`uncommitted`,result:await Ne({config:await i(a,o,this.#e,t),loaded:o,bus:this.#e,signal:t})}}};function et(){return{contributionRefs:[]}}function tt(e){if(e.workflowRunner?.mode===`worker-node`&&!e.executionAttemptRepository)throw Error(`WorkerNode dispatch mode requires an ExecutionAttemptRepository. Pass 'executionAttemptRepository' to createNodeWorkflowRunnerPackageOptions when workflowRunner.mode is 'worker-node'.`);let t=e.executionAttemptRepository?new je(e.executionAttemptRepository):void 0,n=c(e.runtimeModuleDir)===`src`?`source`:`dist`,r=Y({moduleDir:e.runtimeModuleDir,defaultWorkerEntryMode:n,runner:e.workflowRunner,bus:e.bus,authority:t});return{...r!==void 0&&{workflowRunner:r},executorConfig:{busUrl:e.busUrl,busAuth:{kind:`none`},platformDefaults:e.platformDefaults,makaioHome:e.makaioHome},...e.executionAttemptRepository!==void 0&&{executionAttemptRepository:e.executionAttemptRepository},...t!==void 0&&{executionAttemptAuthority:t},...e.workflowMaterializationSpecResolvers!==void 0&&{workflowMaterializationSpecResolvers:e.workflowMaterializationSpecResolvers}}}function Y(e){let{runner:t}=e;if(t)switch(t.mode){case void 0:case`in-process`:if(e.bus===void 0)throw Error(`InProcessWorkflowRunner requires a bus instance. Pass 'bus' to createNodeWorkflowRunner when runner.mode is 'in-process'.`);return new J({bus:e.bus});case`worker-node`:{if(e.authority===void 0)throw Error(`WorkerNodeRunner requires an ExecutionAttemptAuthority. Pass 'authority' to createNodeWorkflowRunner when runner.mode is 'worker-node'.`);let n=e.bus,r=t.dispatch??(n===void 0?void 0:(e,t)=>n.request(y.dispatch,{executionAttemptId:e.executionAttemptId,config:e.config,manifest:e.manifest,requirements:e.requirements,metadata:e.metadata},{signal:t}));if(r===void 0)throw Error(`WorkerNodeRunner requires either a dispatch function or a bus instance. Pass 'bus' to createNodeWorkflowRunner when runner.mode is 'worker-node'.`);return new q({dispatch:r,authority:e.authority,...t.manifest!==void 0&&{manifest:t.manifest},...t.requirements!==void 0&&{requirements:t.requirements}})}case`piscina`:return new G({workerEntry:t.workerEntry??K({moduleDir:e.moduleDir,mode:t.workerEntryMode??e.defaultWorkerEntryMode}),manifest:t.manifest??et(),...t.resolveWorkspaceRoot!==void 0&&{resolveWorkspaceRoot:t.resolveWorkspaceRoot},maxConcurrency:t.maxConcurrency,idleTimeoutMs:t.idleTimeoutMs})}}const nt=new Set([`accepted`,`duplicate`]);var X=class extends Error{decision;result;reason;constructor(e,t,n=`authority-rejected`){super(`Outcome delivery ${n===`deadline-exceeded`?`deadline exceeded`:`rejected by Authority`} (decision=${e}, executionId=${t.executionId}, status=${t.status})`),this.decision=e,this.result=t,this.reason=n,this.name=`OutcomeDeliveryError`}};function Z(e){return new X(`deadline-exceeded`,e,`deadline-exceeded`)}function rt(e){let t={maxRetries:e?.maxRetries??7,baseDelayMs:e?.baseDelayMs??1e3,maxDelayMs:e?.maxDelayMs??3e4,deadlineMs:e?.deadlineMs??12e4};if(!Number.isSafeInteger(t.maxRetries)||t.maxRetries<0)throw TypeError(`Outcome submission maxRetries must be a non-negative safe integer, got ${t.maxRetries}`);for(let[e,n]of Object.entries({baseDelayMs:t.baseDelayMs,maxDelayMs:t.maxDelayMs,deadlineMs:t.deadlineMs}))if(!Number.isFinite(n)||n<=0)throw TypeError(`Outcome submission ${e} must be a positive finite number, got ${n}`);return t}async function it(e,t,n,r){let i=t.baseDelayMs*2**(e-1),a=n-Date.now(),o=Math.min(i,t.maxDelayMs,a);await new Promise(e=>setTimeout(e,o));let s=n-Date.now();if(s<=0)return!1;if(r!==void 0){let e;try{await Promise.race([r(),new Promise(t=>{e=setTimeout(t,s)})])}catch{}finally{e!==void 0&&clearTimeout(e)}}return Date.now()<n}async function Q(e,t,n){let r=rt(n?.retry),i=n?.reconnect,a=Date.now()+r.deadlineMs,o;for(let n=0;n<=r.maxRetries;n++){if(a-Date.now()<=0||n>0&&!await it(n,r,a,i))throw Z(t.result);try{let n=a-Date.now();if(n<=0)throw Z(t.result);let{decision:r}=await e.request(y.control.outcome.submit,{executionAttemptId:t.executionAttemptId,executionId:t.executionId,result:t.result},{timeout:n});if(nt.has(r))return r;throw new X(r,t.result)}catch(e){if(e instanceof X)throw e;if(o=e,Date.now()>=a)throw Z(t.result)}}throw o??Z(t.result)}const at={maxRetries:3,baseDelayMs:200,maxDelayMs:2e3,deadlineMs:1e4},ot={persistentStorage:!0,customCapabilities:[`workflow.local-runtime`,`workflow.thin-runner`],suspensionStrategy:`wait-in-process`,supportsRecovery:!1,materializationModes:[`local-directory`]};function st(e){let t=new Set,n;return{conclude:r=>{if(n!==void 0)return;n={evidence:h.parse({source:e.slice(0,v.source),summary:r.slice(0,v.summary),observedAt:new Date().toISOString()})};let i=[...t];t.clear();for(let e of i)try{e(n)}catch(e){console.error(`[PiscinaThinWorkflowProvider] Infrastructure-conclusion observer failed:`,e)}},observe:e=>n===void 0?(t.add(e),()=>t.delete(e)):(e(n),()=>void 0)}}var ct=class{executionAttemptId;controller;detachCallerAbort;infrastructure;constructor(e,t,n,r){this.executionAttemptId=e,this.controller=t,this.detachCallerAbort=n,this.infrastructure=r}cancel(e){return this.controller.abort(e??`WorkerNode cancelled`),this.detachCallerAbort(),Promise.resolve()}terminate(){return this.controller.abort(`WorkerNode terminated`),this.detachCallerAbort(),Promise.resolve()}release(){return this.detachCallerAbort(),Promise.resolve()}observeInfrastructureConclusion(e){return this.infrastructure.observe(e)}},lt=class{options;environment=`piscina`;allocationLifetime=`provisioner-process-bound`;baseCapabilities;constructor(e){this.options=e,this.baseCapabilities=ne.parse({...ot,...e.baseCapabilities,suspensionStrategy:e.baseCapabilities?.suspensionStrategy??ot.suspensionStrategy,supportsRecovery:!1})}get id(){return this.options.id}get displayName(){return this.options.displayName}async provision(e,t){t.throwIfAborted();let n=new AbortController,r=st(this.id),i=()=>{n.abort(t.reason)};t.addEventListener(`abort`,i,{once:!0});let a=()=>t.removeEventListener(`abort`,i);try{let{executionAttemptId:i,executionId:o,workerConfig:s}=e,c=this.buildAllocationRef(i),l=new ct(i,n,a,r);t.throwIfAborted();let u=this.options.runner.runWithReadiness(e.workerConfig,n.signal,e.workerManifest);return u.ready.then(async e=>{n.signal.aborted||await this.options.bus.emit(y.control[`attempt-ready`],{executionAttemptId:i,executionId:o,adapters:[...e.adapters]})},()=>void 0).catch(e=>n.abort(e)),this.submitOutcomeOnSettlement(u.result,o,i,s.workflowId,r.conclude),{kind:`allocated`,allocationRef:c,handle:l}}catch(e){throw n.abort(e),a(),e}}async submitOutcomeOnSettlement(e,t,n,r,i){let a;try{a=await e}catch(e){a={executionId:t,workflowId:r,status:`failed`,error:e instanceof Error?e.message:String(e)}}try{let e={...at,...this.options.outcomeRetry};await Q(this.options.bus,{executionAttemptId:n,executionId:t,result:a},{retry:e})}catch(e){e instanceof X?console.error(`[PiscinaThinWorkflowProvider] Outcome rejected for execution '${t}' attempt '${n}' (decision=${e.decision}):`,e):console.error(`[PiscinaThinWorkflowProvider] Failed to submit outcome for execution '${t}' attempt '${n}':`,e),i(`Piscina worker for attempt '${n}' ended without an acknowledged outcome because outcome submission could not be completed`)}}buildAllocationRef(e){let t={version:ee,providerId:this.id,providerData:{executionAttemptId:e,allocatedAt:Date.now()}};return te.parse(t)}};const ut=[Ce,be,Se];function dt(e){let t;return()=>(t??=(async()=>{let t=[];for(let n of[...e].reverse())try{await n()}catch(e){t.push(e)}if(t.length===1)throw t[0];if(t.length>1)throw AggregateError(t,`Isolated workflow runtime shutdown reported errors`)})(),t)}function ft(e,t,n){return T({bus:e,currentMachineId:n,resolveLiveAdapterId:e=>t.getExtensionService(S)?.resolveLiveAdapterId(e),resolveLiveAdapterIdentity:e=>t.getExtensionService(S)?.resolveLiveAdapterIdentity(e),listLiveAdapterIdentities:()=>t.getExtensionService(S)?.getLiveAdapterIdentities()??[]})}async function pt(e){let t=f();t.registerNamespaces([...g,..._]);let{context:n}=e,r=new oe(t,{surface:`headless`,extensionContextBase:{cwd:n.cwd,platform:n.platform,homedir:n.homedir,makaioHome:n.makaioHome,username:n.username,machineId:n.machineId,tryImport:D}}),i,a=[()=>t.disconnect()],o=dt(a);try{await e.connectAuthority(t);let s=[...e.contributedPackages,...await e.loadContributedPackages?.(t)??[]],{adapterSubsystemPackage:c}=w({coordinator:r,configRepository:e.configRepository,platformDefaults:{cwd:n.cwd},runtimeSnapshotHandlerPriority:1,runtimeDefinitionHandlerPriority:1,...e.prepareAuthRuntime!==void 0&&{prepareAuthRuntime:e.prepareAuthRuntime}}),l=Te({definitions:s.flatMap(e=>e.clients??[]),binaryResolutionPolicy:`global-only`});r.registerContributionProcessor(ye());let u=[...ut,c,_e,...P(s)?[xe]:[],ve(1),we,A,l,...Oe(s)];r.load(u),a.push(...F(u,t,r)),a.push(()=>r.shutdown()),await r.startAll(),i=ft(t,r,n.machineId),a.push(()=>{i?.cleanup(),i=void 0});let d=r.getExtensionService(ge);if(d===void 0)throw Error(`Isolated workflow tool registry did not start.`);for(let t of e.toolsets)await d.register(t);return await t.emit(se.ready,{machineId:n.machineId}),{bus:t,coordinator:r,machineId:n.machineId,shutdown:o}}catch(e){throw await o().catch(()=>void 0),e}}function mt(e,t){return{executionId:e,workflowId:t,status:`cancelled`,reason:`Execution cancelled`}}async function $(e,t,n){let r=new AbortController,i=e.on(ae(t),()=>{r.abort()}),a=()=>{r.abort()};return n?.addEventListener(`abort`,a,{once:!0}),n?.aborted&&r.abort(),await p(i),{signal:r.signal,cleanup:()=>{n?.removeEventListener(`abort`,a),i()}}}function ht(t,n){let r=e();return{cwd:t.workspaceRoot,platform:t.platform,homedir:r,makaioHome:r,username:`workflow-worker`,machineId:n}}async function gt(e,t,n,r,i,a){return await pt({connectAuthority:async n=>{await e.connectBus(n,t,i)},contributedPackages:[...r],configRepository:e.configRepository,context:ht(n,a),toolsets:[...e.toolsets],...e.prepareAuthRuntime!==void 0&&{prepareAuthRuntime:e.prepareAuthRuntime}})}async function _t(e,t,n){let{executionId:r,executionAttemptId:i}=e,a=mt(r,n);return{result:a,decision:await Q(t,{executionAttemptId:i,executionId:r,result:a},{retry:e.outcomeRetry,reconnect:()=>t.reconnect()})}}async function vt(e,t,n,r,i){let{executionId:a,executionAttemptId:o}=e,s;try{s=await e.execute(t.bus,n,r,i)}catch(e){s=i.aborted&&e instanceof DOMException&&e.name===`AbortError`?mt(a,n.workflowId):{executionId:a,workflowId:n.workflowId,status:`failed`,error:e instanceof Error?e.message:String(e)}}let c=await Q(t.bus,{executionAttemptId:o,executionId:a,result:s},{retry:e.outcomeRetry,reconnect:()=>t.bus.reconnect()});if(e.onPostCommit!==void 0)try{await e.onPostCommit(s,c)}catch{}return{result:s,decision:c}}async function yt(e,t,n,r,i,a){let o=await $(n,r.cancelSubject),s=AbortSignal.any([i,o.signal]),c=s,l,u,d;try{s.throwIfAborted();let f=await e.materialize(r,s),p=f.context;d=f.cleanup,s.throwIfAborted();let m=await e.loadContributions(p,s);s.throwIfAborted(),l=await gt(e,t,p,m,s,a),u=await $(l.bus,r.cancelSubject,o.signal),o.cleanup(),n.disconnect();let h=AbortSignal.any([i,u.signal]);c=h,h.throwIfAborted();let{adapters:g}=await l.bus.request(x.listAdapters,{});return h.throwIfAborted(),await l.bus.emit(y.control[`attempt-ready`],{executionAttemptId:e.executionAttemptId,executionId:e.executionId,adapters:g.map(e=>e.name)}),await vt(e,l,r,p,h)}catch(t){if(!(c.aborted&&t instanceof DOMException&&t.name===`AbortError`))throw t;return await _t(e,l?.bus??n,r.workflowId)}finally{o.cleanup(),u?.cleanup(),l!==void 0&&await l.shutdown().catch(()=>void 0),d!==void 0&&await d().catch(()=>void 0)}}async function bt(e,t){t.throwIfAborted();let n=await e.bootstrap(t);t.throwIfAborted();let r=f();r.registerNamespaces([...g,..._]);try{return await e.connectBus(r,n,t),await yt(e,n,r,await r.request(re.getRunContext,{executionId:e.executionId},{signal:t}),t,`headless-worker-${e.executionAttemptId}`)}finally{try{r.disconnect()}catch{}}}export{A,j as C,M as D,F as E,C as F,D as M,T as N,Ue as O,w as P,Ve as S,qe as T,H as _,X as a,z as b,tt as c,K as d,G as f,V as g,R as h,nt as i,E as j,Ke as k,J as l,L as m,pt as n,Q as o,I as p,lt as r,Y as s,bt as t,q as u,Ye as v,He as w,U as x,W as y};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{z as e}from"zod";function t(t,n=`output`){let{$schema:r,...i}=e.toJSONSchema(t,{io:n});return i}export{t};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@makaio/framework",
|
|
3
|
-
"version": "1.0.0-dev-
|
|
3
|
+
"version": "1.0.0-dev-1787670071418",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/makaio-ai/makaio-framework.git",
|
|
@@ -9,6 +9,9 @@
|
|
|
9
9
|
"description": "Typed, bus-centric framework for building and orchestrating AI agents with tools, sessions, and events",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"type": "module",
|
|
12
|
+
"engines": {
|
|
13
|
+
"node": ">=22.15.0"
|
|
14
|
+
},
|
|
12
15
|
"files": [
|
|
13
16
|
"dist",
|
|
14
17
|
"LICENSE",
|
|
@@ -26,17 +29,28 @@
|
|
|
26
29
|
"execa": "^9.5.2",
|
|
27
30
|
"glob": "13.0.6",
|
|
28
31
|
"hono": "^4.12.23",
|
|
32
|
+
"piscina": "^5.1.4",
|
|
33
|
+
"tsx": "^4.22.3",
|
|
29
34
|
"type-fest": "^5.2.0",
|
|
30
35
|
"ws": "^8.21.0",
|
|
31
36
|
"zod": "4.4.3"
|
|
32
37
|
},
|
|
33
38
|
"peerDependenciesMeta": {
|
|
39
|
+
"@modelcontextprotocol/sdk": {
|
|
40
|
+
"optional": true
|
|
41
|
+
},
|
|
42
|
+
"@types/react-grid-layout": {
|
|
43
|
+
"optional": true
|
|
44
|
+
},
|
|
34
45
|
"react": {
|
|
35
46
|
"optional": true
|
|
36
47
|
},
|
|
37
48
|
"react-dom": {
|
|
38
49
|
"optional": true
|
|
39
50
|
},
|
|
51
|
+
"react-grid-layout": {
|
|
52
|
+
"optional": true
|
|
53
|
+
},
|
|
40
54
|
"react-resizable": {
|
|
41
55
|
"optional": true
|
|
42
56
|
},
|
|
@@ -102,6 +116,10 @@
|
|
|
102
116
|
"types": "./dist/contracts/client/index.d.mts",
|
|
103
117
|
"default": "./dist/contracts/client/index.mjs"
|
|
104
118
|
},
|
|
119
|
+
"./contracts/code-execution": {
|
|
120
|
+
"types": "./dist/contracts/code-execution/index.d.mts",
|
|
121
|
+
"default": "./dist/contracts/code-execution/index.mjs"
|
|
122
|
+
},
|
|
105
123
|
"./contracts/common": {
|
|
106
124
|
"types": "./dist/contracts/common/index.d.mts",
|
|
107
125
|
"default": "./dist/contracts/common/index.mjs"
|
|
@@ -130,6 +148,10 @@
|
|
|
130
148
|
"types": "./dist/contracts/materialization/index.d.mts",
|
|
131
149
|
"default": "./dist/contracts/materialization/index.mjs"
|
|
132
150
|
},
|
|
151
|
+
"./contracts/reaction": {
|
|
152
|
+
"types": "./dist/contracts/reaction/index.d.mts",
|
|
153
|
+
"default": "./dist/contracts/reaction/index.mjs"
|
|
154
|
+
},
|
|
133
155
|
"./contracts/native-session-supervisor": {
|
|
134
156
|
"types": "./dist/contracts/native-session-supervisor/index.d.mts",
|
|
135
157
|
"default": "./dist/contracts/native-session-supervisor/index.mjs"
|
|
@@ -214,10 +236,18 @@
|
|
|
214
236
|
"types": "./dist/services/index.d.mts",
|
|
215
237
|
"default": "./dist/services/index.mjs"
|
|
216
238
|
},
|
|
239
|
+
"./services/automation-trigger": {
|
|
240
|
+
"types": "./dist/services/automation-trigger/index.d.mts",
|
|
241
|
+
"default": "./dist/services/automation-trigger/index.mjs"
|
|
242
|
+
},
|
|
217
243
|
"./services/capability": {
|
|
218
244
|
"types": "./dist/services/capability/index.d.mts",
|
|
219
245
|
"default": "./dist/services/capability/index.mjs"
|
|
220
246
|
},
|
|
247
|
+
"./services/code-execution": {
|
|
248
|
+
"types": "./dist/services/code-execution/index.d.mts",
|
|
249
|
+
"default": "./dist/services/code-execution/index.mjs"
|
|
250
|
+
},
|
|
221
251
|
"./services/materialization": {
|
|
222
252
|
"types": "./dist/services/materialization/index.d.mts",
|
|
223
253
|
"default": "./dist/services/materialization/index.mjs"
|
|
@@ -334,6 +364,10 @@
|
|
|
334
364
|
"types": "./dist/services/provider-runtime/index.d.mts",
|
|
335
365
|
"default": "./dist/services/provider-runtime/index.mjs"
|
|
336
366
|
},
|
|
367
|
+
"./services/settings": {
|
|
368
|
+
"types": "./dist/services/settings/index.d.mts",
|
|
369
|
+
"default": "./dist/services/settings/index.mjs"
|
|
370
|
+
},
|
|
337
371
|
"./services/settings/namespace": {
|
|
338
372
|
"types": "./dist/services/settings/namespace.d.mts",
|
|
339
373
|
"default": "./dist/services/settings/namespace.mjs"
|
|
@@ -498,6 +532,10 @@
|
|
|
498
532
|
"types": "./dist/runtime-node/workflow-worker/worker-entry.d.mts",
|
|
499
533
|
"default": "./dist/runtime-node/workflow-worker/worker-entry.mjs"
|
|
500
534
|
},
|
|
535
|
+
"./runtime-node/code-execution": {
|
|
536
|
+
"types": "./dist/runtime-node/code-execution/index.d.mts",
|
|
537
|
+
"default": "./dist/runtime-node/code-execution/index.mjs"
|
|
538
|
+
},
|
|
501
539
|
"./runtime-bun": {
|
|
502
540
|
"types": "./dist/runtime-bun/index.d.mts",
|
|
503
541
|
"default": "./dist/runtime-bun/index.mjs"
|
|
@@ -530,6 +568,10 @@
|
|
|
530
568
|
"types": "./dist/workflow-engine/package.d.mts",
|
|
531
569
|
"default": "./dist/workflow-engine/package.mjs"
|
|
532
570
|
},
|
|
571
|
+
"./workflow-engine/workflow-trigger-binding-consumer": {
|
|
572
|
+
"types": "./dist/workflow-engine/workflow-trigger-binding-consumer.d.mts",
|
|
573
|
+
"default": "./dist/workflow-engine/workflow-trigger-binding-consumer.mjs"
|
|
574
|
+
},
|
|
533
575
|
"./workflow-engine/workflow-orchestrator": {
|
|
534
576
|
"types": "./dist/workflow-engine/workflow-orchestrator.d.mts",
|
|
535
577
|
"default": "./dist/workflow-engine/workflow-orchestrator.mjs"
|
|
@@ -557,8 +599,11 @@
|
|
|
557
599
|
},
|
|
558
600
|
"private": false,
|
|
559
601
|
"peerDependencies": {
|
|
602
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
603
|
+
"@types/react-grid-layout": "^1.3.5",
|
|
560
604
|
"react": "^18.0.0 || ^19.0.0",
|
|
561
605
|
"react-dom": "^18.0.0 || ^19.0.0",
|
|
606
|
+
"react-grid-layout": "^1.4.4",
|
|
562
607
|
"react-resizable": "3.1.3",
|
|
563
608
|
"vitest": "^4.1.0"
|
|
564
609
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_ as e,b as t,c as n,d as r,f as i,g as a,h as o,ht as s,l as c,m as l,o as u,p as d,s as f,t as p,u as m,v as h,y as g}from"./schemas-Cm09dXL4.mjs";import"./compression-74fFeBha.mjs";import"./provider-context-Dq53Cgzz.mjs";import"./contracts/adapter/schemas/session-lineage.mjs";import{createBusNamespace as _}from"@makaio/framework/core";const v={getCapabilities:s,startAgent:t,infer:g,listAgents:h,getAgent:e,stopAgent:a,rehydrateAgent:o,getConfigSchema:l,"agent.created":d,"session.created":i,"session.discovered":p,"session.usage":r,"session.closed":m,log:c,error:n,initialized:f,quota:u},y=_(`adapter`,v),b=y.subjects;export{b as n,v as r,y as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Q as e,Z as t,a as n,d as r,f as i,l as a,m as o,n as s,o as c,r as l,s as u,x as d}from"./schemas-CRB2O5zo.mjs";import{z as f}from"zod";import{createBusNamespace as p}from"@makaio/framework/core";function m(e){let{$schema:t,...n}=f.toJSONSchema(e);return n}function h(e){return{...e,toRegistration:()=>({kind:e.kind,description:e.description,schemaVersion:e.schemaVersion,dataSchema:m(e.dataSchema),...e.scopeSchema?{scopeSchema:m(e.scopeSchema)}:{},...e.observationSchema?{observationSchema:m(e.observationSchema)}:{},...e.discriminator===void 0?{}:{discriminator:typeof e.discriminator==`string`?e.discriminator:Array.from(e.discriminator)},conflictPolicy:e.conflictPolicy,...e.status?{status:{...e.status,...e.status.values?{values:[...e.status.values]}:{}}}:{},...e.lifecycle?{lifecycle:e.lifecycle}:{},...e.indexedFields?{indexedFields:[...e.indexedFields]}:{},...e.searchableFields?{searchableFields:[...e.searchableFields]}:{},...e.projection?{projection:{...e.projection,...e.projection.semanticEvents?{semanticEvents:[...e.projection.semanticEvents]}:{},...e.projection.projectedFields?{projectedFields:e.projection.projectedFields.map(e=>({...e}))}:{},...e.projection.affordances?{affordances:e.projection.affordances.map(e=>structuredClone(e))}:{}}}:{},...e.defaultContext?{defaultContext:structuredClone(e.defaultContext)}:{}})}}function g(e){return{hooks:[...e.hooks]}}function _(e){return JSON.stringify([e.kind,e.id,e.revision])}const v=f.enum([`not-selected`,`not-found`,`depth-exceeded`,`unsupported-ref-class`,`cycle-detected`]),y=f.object({target:i,sourceRef:a,relationType:f.string().min(1),hint:t,status:f.enum([`resolved`,`unresolved`]),reason:v.optional()}).superRefine((e,t)=>{e.status===`unresolved`&&e.reason===void 0&&t.addIssue({code:f.ZodIssueCode.custom,path:[`reason`],message:`reason is required for unresolved artifact context refs`}),e.status===`resolved`&&e.reason!==void 0&&t.addIssue({code:f.ZodIssueCode.custom,path:[`reason`],message:`reason must be omitted for resolved artifact context refs`}),e.status===`resolved`&&e.target.refClass!==`artifact`&&t.addIssue({code:f.ZodIssueCode.custom,path:[`target`],message:`resolved artifact context refs must target an artifact revision`})}),b=f.object({rootRef:a,refs:f.array(y),resolved:f.array(o)}).superRefine((e,t)=>{let n=new Set(e.resolved.map(_));n.has(_(e.rootRef))||t.addIssue({code:f.ZodIssueCode.custom,path:[`resolved`],message:`resolved artifact context wire payloads must include the root artifact revision`}),e.refs.forEach((e,r)=>{n.has(_(e.sourceRef))||t.addIssue({code:f.ZodIssueCode.custom,path:[`refs`,r,`sourceRef`],message:`artifact context ref sources must have a matching revision in resolved`}),!(e.status!==`resolved`||e.target.refClass!==`artifact`)&&(n.has(_(e.target))||t.addIssue({code:f.ZodIssueCode.custom,path:[`refs`,r,`target`],message:`resolved artifact context refs must have a matching revision in resolved`}))})});function x(e){let t=b.parse(e),n=new Map(t.resolved.map(e=>[E(e),e])),r=new Map;for(let e of t.refs){let t=E(e.sourceRef),n=r.get(t);n||(n=[],r.set(t,n)),n.push(e)}let i=n.get(E(t.rootRef));if(!i)throw Error(`Resolved artifact context is missing root artifact '${E(t.rootRef)}'`);let a=S(t.rootRef,i,`inline`,r,n);return{root:a,flatten(){let e=[];return T(a,e),e}}}function S(e,t,n,r,i){return{status:`resolved`,ref:e,artifact:t,hint:n,children:w(e,r,i,new Set([E(e)]))}}function C(e,t,n,r,i,a,o){let s=E(e),c=new Set(o);return c.add(s),{status:`resolved`,ref:e,artifact:t,relation:n,hint:r,children:w(e,i,a,c)}}function w(e,t,n,r){return(t.get(E(e))??[]).map(e=>{if(e.status===`unresolved`)return{status:`unresolved`,target:e.target,relation:e.relationType,hint:e.hint,reason:e.reason};if(e.target.refClass!==`artifact`)throw Error(`Resolved artifact context refs must target an artifact revision`);let i=E(e.target),a=n.get(i);if(!a)throw Error(`Resolved artifact context is missing target artifact '${i}'`);return r.has(i)?{status:`unresolved`,target:e.target,relation:e.relationType,hint:e.hint,reason:`cycle-detected`}:C(e.target,a,e.relationType,e.hint,t,n,r)})}function T(e,t){if(e.status!==`unresolved`){t.push(e.artifact);for(let n of e.children)T(n,t)}}function E(e){return JSON.stringify([e.kind,e.id,e.revision])}const D={"kind.register":{request:n,response:f.object({registered:f.boolean()})},"kind.list":{request:f.object({kind:f.string().min(1).optional()}),response:f.object({kinds:f.array(n)})},"relation-type.register":{request:d,response:f.object({registered:f.boolean()})},"relation-type.list":{request:f.object({type:f.string().min(1).optional()}),response:f.object({relationTypes:f.array(d)})},create:{request:o.omit({id:!0,revision:!0,timestamp:!0}),response:f.object({artifact:o})},revise:{request:f.object({previous:a,revision:o.omit({id:!0,revision:!0,timestamp:!0})}),response:f.object({artifact:o})},resolve:{request:f.object({ref:a}),response:f.object({artifact:o.nullable()})},query:{request:u,response:f.object({artifacts:f.array(o)})},compare:{request:s,response:l},resolveContext:{request:f.object({ref:a,selectors:e.optional(),maxDepth:f.number().int().min(1).max(20).default(5)}),response:f.object({context:b})},created:f.object({artifact:o}),revised:f.object({previous:a,artifact:o}),"relation.added":f.object({artifact:a,relation:r}),"observation.added":f.object({artifact:a,observation:c}),"status.changed":f.object({artifact:a,path:f.string().min(1),previous:f.unknown().optional(),current:f.unknown().optional()}),"kind.changed":f.object({kind:f.string().min(1),schemaVersion:f.string().min(1)})},O=p(`artifact`,D),k=O.subjects;export{y as a,g as c,x as i,h as l,D as n,v as o,k as r,b as s,O as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e=class extends Error{stage;constructor(e,t){super(t instanceof Error?t.message:String(t),{cause:t}),this.stage=e,this.name=`SessionAgentAttachError`}};function t(t){let n=t,r=new Set;for(;n instanceof Error&&!r.has(n);){if(n instanceof e)return n;r.add(n),n=n.cause}}export{t as n,e as t};
|