@makaio/framework 1.0.0-dev-1788863979610 → 1.0.0-dev-1788909333961
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.makaio-build.json +2 -2
- package/dist/2020-Bl3Yx3In.mjs +1 -0
- package/dist/{account-identity-B3vLwm9O.mjs → account-identity-DCBpVurJ.mjs} +1 -1
- package/dist/{adapter-Dz1fX5Wa.mjs → adapter-D6IpEDIo.mjs} +1 -1
- package/dist/adapters/config/index.d.mts +1 -1
- package/dist/adapters/config/index.mjs +1 -1
- package/dist/adapters/index.d.mts +2 -2
- package/dist/adapters/index.mjs +6 -6
- package/dist/adapters/node.d.mts +1 -1
- package/dist/adapters/node.mjs +1 -1
- package/dist/artifact-BjqkK0KX.mjs +1 -0
- package/dist/{attempt-record-codec-BcAPEIW3.mjs → attempt-record-codec-6jpayBMY.mjs} +1 -1
- package/dist/{auth-C6tVtaOX.mjs → auth-CeH3w2fi.mjs} +1 -1
- package/dist/authority-state-bootstrap-8VGt4vD2.mjs +1 -0
- package/dist/{automation-trigger-ByjNlClm.mjs → automation-trigger-D_xKqEoV.mjs} +1 -1
- package/dist/bus/index.d.mts +20 -20
- package/dist/bus/index.mjs +1 -1
- package/dist/{caller-owned-adapter-stub-C1M7FKrv.mjs → caller-owned-adapter-stub-B-Sq7ZvF.mjs} +1 -1
- package/dist/{canonical-model-DXOvCaVg.mjs → canonical-model-DwuFQ02A.mjs} +1 -1
- package/dist/{capabilities-DEvmD9VJ.mjs → capabilities-BhJ3wzI8.mjs} +1 -1
- package/dist/{client-BkznbdsO.mjs → client-CTqzLpVx.mjs} +1 -1
- package/dist/clients/index.d.mts +1 -1
- 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 +1 -1
- package/dist/code-execution/worker-entry.mjs +1 -1
- package/dist/{code-execution-Ckmn8OZu.mjs → code-execution-BMmUATcc.mjs} +1 -1
- package/dist/{code-execution-CweDSWco.mjs → code-execution-BsiB7ZeZ2.mjs} +1 -1
- package/dist/{code-execution-DqkQjKa1.mjs → code-execution-DRCzkGzO.mjs} +1 -1
- package/dist/{compression-CtgeVLpP.mjs → compression-3DauETKU.mjs} +1 -1
- package/dist/{config-namespace-CjWvw8ij.mjs → config-namespace-MjFuIPyL.mjs} +1 -1
- package/dist/contracts/adapter/index.d.mts +2 -2
- package/dist/contracts/adapter/index.mjs +1 -1
- package/dist/contracts/adapter/schemas/session-lineage.d.mts +1 -1
- package/dist/contracts/artifact/index.d.mts +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 +3 -3
- package/dist/contracts/automation-trigger/index.mjs +1 -1
- package/dist/contracts/canonical-model/index.d.mts +1 -1
- package/dist/contracts/canonical-model/index.mjs +1 -1
- package/dist/contracts/capabilities/index.d.mts +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 +1 -1
- package/dist/contracts/code-execution/index.mjs +1 -1
- 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 +5 -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 +195 -195
- package/dist/contracts/index.mjs +1 -1
- package/dist/contracts/materialization/index.d.mts +2 -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 +1 -1
- package/dist/contracts/reaction/index.mjs +1 -1
- package/dist/contracts/session/index.d.mts +2 -2
- package/dist/contracts/session/index.mjs +1 -1
- package/dist/contracts/shared/index.d.mts +2 -2
- package/dist/contracts/shared/index.mjs +1 -1
- package/dist/contracts/skill/index.d.mts +1 -1
- package/dist/contracts/skill/index.mjs +1 -1
- package/dist/contracts/telemetry/index.d.mts +1 -1
- package/dist/contracts/telemetry/index.mjs +1 -1
- package/dist/contracts/timeout/index.d.mts +1 -1
- package/dist/contracts/timeout/index.mjs +1 -1
- package/dist/contracts/toast/index.mjs +1 -1
- package/dist/contracts/variant/index.d.mts +1 -1
- package/dist/contracts/variant/index.mjs +1 -1
- package/dist/contracts/worker/index.d.mts +1 -1
- package/dist/contracts/worker/index.mjs +1 -1
- package/dist/contracts/workflow/index.d.mts +2 -2
- package/dist/contracts/workflow/index.mjs +1 -1
- package/dist/{contribution-CQIpPQLl.d.mts → contribution-B4t0OXKs.d.mts} +2 -2
- package/dist/{definition-Cdpw5l9g.d.mts → definition-Bs5hzhsT.d.mts} +1 -1
- package/dist/{definition-BH4QLGLI.mjs → definition-YGj42UeO.mjs} +1 -1
- package/dist/{detached-extension-handle-2yUaviLu.mjs → detached-extension-handle-CgJiXaqv.mjs} +1 -1
- package/dist/dist-CfANkKSb.mjs +1 -0
- package/dist/{execution-attempt-owner-recovery-BRjtmTGv.mjs → execution-attempt-owner-recovery-CdH04iwP.mjs} +1 -1
- package/dist/{execution-attempt-repository-CPk3F98N.d.mts → execution-attempt-repository-CF3cWsPo.d.mts} +495 -151
- package/dist/{execution-target-BcoF_oDB.mjs → execution-target-B9jZgDQz.mjs} +1 -1
- package/dist/{extension-Bfkr2DBs.mjs → extension-B51JzHJu.mjs} +1 -1
- package/dist/extension-BgUSK5rv.mjs +1 -0
- package/dist/{filesystem-service-CiUw0YN5.mjs → filesystem-service-yB8KhUGz.mjs} +1 -1
- package/dist/framework-packages-CxWecyPW.mjs +1 -0
- package/dist/git/index.mjs +1 -1
- package/dist/{globby-QBDqstzq.mjs → globby-z2SR0jRo.mjs} +1 -1
- package/dist/{handlers-BsHAFtye.mjs → handlers-CBbFzDHc.mjs} +1 -1
- package/dist/{harness-YQ2ewID9.mjs → harness-GNtHsoh4.mjs} +1 -1
- package/dist/{hook-responses-DK6uu35J.d.mts → hook-responses-Cs8A07ZP.d.mts} +1 -1
- package/dist/{index-fQIrZBY0.d.mts → index-B4Wg4W7d.d.mts} +100 -100
- package/dist/{index-CsDj-DEW.d.mts → index-B6aoVzdA.d.mts} +1 -1
- package/dist/{index-C3uCMCHI.d.mts → index-B7VO0gQV.d.mts} +3 -3
- package/dist/{index-CXZ8ODDT.d.mts → index-BALk4zcu.d.mts} +1 -1
- package/dist/{index-B9vEfalH.d.mts → index-BHZlMm_I.d.mts} +1 -1
- package/dist/{index-Cjy1_Hc2.d.mts → index-BO_ikAR-.d.mts} +18 -18
- package/dist/{index-B8Tc0urp.d.mts → index-BQv9mUzn.d.mts} +139 -115
- package/dist/{index-Dne0xNUI.d.mts → index-BeplDh91.d.mts} +597 -732
- package/dist/{index-BlJbchHp.d.mts → index-BjcJH3I-.d.mts} +1 -1
- package/dist/{index-D5UpsCNq.d.mts → index-BtC1JP5D.d.mts} +1 -1
- package/dist/{index-XNbcZBEZ.d.mts → index-ByJ2NESC.d.mts} +6 -6
- package/dist/{index-COSxBdTp.d.mts → index-CKvOECeR.d.mts} +2 -2
- package/dist/{index-zCstNu9J2.d.mts → index-CZuhTqsX2.d.mts} +12 -12
- package/dist/{index-DXv51ZIb.d.mts → index-CpdRe5df.d.mts} +116 -116
- package/dist/{index-DQWEOn6i.d.mts → index-D7j6v0-L.d.mts} +1 -1
- package/dist/{index-1y-PUD3B.d.mts → index-DFsJTTkS.d.mts} +1 -1
- package/dist/{index-D9CdrFKz2.d.mts → index-DI-1HK7v2.d.mts} +1 -1
- package/dist/{index-BDs5tDcM.d.mts → index-DlKxbLC9.d.mts} +8 -8
- package/dist/{index-CvWUgywU.d.mts → index-OP6Aw5jN.d.mts} +1 -1
- package/dist/{index-DmTBlEzu.d.mts → index-U0Fe0baO.d.mts} +6 -6
- package/dist/{index-jZXIrHlY.d.mts → index-VAJBIJUb.d.mts} +96 -42
- package/dist/{index-BDAPOKi3.d.mts → index-VCtdvtEk.d.mts} +360 -360
- package/dist/{index-DtHmaj-q.d.mts → index-fzrPfhS0.d.mts} +1 -1
- package/dist/{index-DvV7vEKt.d.mts → index-tDCBp28C.d.mts} +350 -350
- package/dist/{index-DwFnHNoq2.d.mts → index-uv_WSQtw2.d.mts} +17 -17
- 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 +5 -5
- package/dist/kernel/index.mjs +1 -1
- package/dist/kernel/namespace/index.d.mts +1 -1
- package/dist/kernel/namespace/index.mjs +1 -1
- package/dist/kernel/observability/index.d.mts +1 -1
- package/dist/kernel/observability/index.mjs +1 -1
- package/dist/kernel/providers/index.d.mts +1 -1
- package/dist/kernel/providers/index.mjs +1 -1
- package/dist/kernel/window/index.d.mts +1 -1
- package/dist/kernel/window/index.mjs +1 -1
- package/dist/kind-registration-T--B1wiI.mjs +1 -0
- package/dist/{lib-BB0XjVs6.mjs → lib-B8hEa65D.mjs} +1 -1
- package/dist/{lib-DNGNIb-O.mjs → lib-Ql8RWYOd.mjs} +1 -1
- package/dist/{load-extensions-CWlR-8BM.mjs → load-extensions-BHTj3d_P.mjs} +1 -1
- package/dist/{load-extensions-C3Y3y9EW.d.mts → load-extensions-un9Md47Z.d.mts} +1 -1
- package/dist/materialization-CqOHTt92.mjs +1 -0
- package/dist/mcp-http-server/index.mjs +4 -4
- package/dist/model-B6t_-_sp.mjs +1 -0
- package/dist/{namespace-agOiy4kr.d.mts → namespace-BVQ8Y2Yi.d.mts} +3 -3
- package/dist/{namespace-B8i86gVL.d.mts → namespace-BlH5BeSq.d.mts} +2 -2
- package/dist/{namespace-Bz3qcZBD.d.mts → namespace-BocL2nn7.d.mts} +6 -6
- package/dist/namespace-D4zmxaC4.mjs +1 -0
- package/dist/{namespace-BW2rjW9-.d.mts → namespace-DELzAyzb.d.mts} +152 -152
- package/dist/{namespace-BL7lHlmg.mjs → namespace-ZAIFBrIy.mjs} +1 -1
- package/dist/{native-session-supervisor-LKio8XZn.mjs → native-session-supervisor-BlGzmZrH.mjs} +1 -1
- package/dist/node/bus-server/index.d.mts +1 -1
- package/dist/node/bus-server/index.mjs +1 -1
- package/dist/node/bus-server/server-lifecycle.d.mts +1 -1
- package/dist/node/bus-server/server-lifecycle.mjs +1 -1
- package/dist/node/transports/index.d.mts +12 -1
- package/dist/node/transports/index.mjs +2 -2
- package/dist/{orchestrator-shared-BGlN-m-V.mjs → orchestrator-shared-5vhs4wvU.mjs} +1 -1
- package/dist/{ownership-memory-handler-BpGdR_uG.mjs → ownership-memory-handler-BCu1EjFO.mjs} +1 -1
- package/dist/{package-JtjbO-Oi.mjs → package-BiZ6ehWk.mjs} +1 -1
- package/dist/{package-BdOoo7XE.mjs → package-BwIbyojG.mjs} +2 -2
- package/dist/{package-w4WZqO7J.d.mts → package-DnlJ4I1i.d.mts} +32 -10
- package/dist/package.json +1 -1
- package/dist/packages-7CsXP86g.mjs +1 -0
- package/dist/{packages-uNYWGMH1.d.mts → packages-DtsjAYuf.d.mts} +12 -39
- package/dist/{profile-N5qGUpF0.mjs → profile-DBDvy9uc.mjs} +1 -1
- package/dist/{provider-context-zTDSH2x9.mjs → provider-context-CSb0qX1c.mjs} +1 -1
- package/dist/{provider-context-CG42JlP9.mjs → provider-context-CTOrOW54.mjs} +1 -1
- package/dist/{reaction-D3TNwPK8.mjs → reaction-OQibmmDW.mjs} +1 -1
- package/dist/{resolved-sq8RXNDf.mjs → resolved-ONt3rOMh.mjs} +1 -1
- package/dist/rules/index.d.mts +1 -1
- package/dist/rules/index.mjs +1 -1
- package/dist/rules/schemas.d.mts +1 -1
- package/dist/runtime-bun/index.mjs +1 -1
- package/dist/runtime-node/code-execution/index.d.mts +2 -2
- package/dist/runtime-node/code-execution/index.mjs +1 -1
- package/dist/runtime-node/extension-discovery.d.mts +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 -6
- 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-execution-bus-access.d.mts +16 -1
- package/dist/runtime-node/workflow-execution-bus-access.mjs +1 -1
- package/dist/runtime-node/workflow-worker/index.d.mts +2 -2
- package/dist/runtime-node/workflow-worker/index.mjs +1 -1
- package/dist/runtime-node/workflow-worker/worker-entry.mjs +1 -1
- package/dist/{schema-Dq-7si8u.mjs → schema-B8jinlbH.mjs} +1 -1
- package/dist/schemas-0eCrrru1.mjs +1 -0
- package/dist/{context-resolution-BZKEKzu4.d.mts → schemas-B9yLU2jM.d.mts} +134 -540
- package/dist/{schemas-B4MSOlcv.d.mts → schemas-BBatvMde.d.mts} +6 -6
- package/dist/{schemas-QWDnauKX.mjs → schemas-BUK9I-Oz.mjs} +1 -1
- package/dist/{schemas-Bw2-j1lm.d.mts → schemas-BfMFZ6J5.d.mts} +4 -4
- package/dist/{schemas-_2Syo_01.mjs → schemas-CSDiTBsU.mjs} +1 -1
- package/dist/{schemas-BfO5jkrL.mjs → schemas-CbhvgFQs.mjs} +1 -1
- package/dist/{schemas-Io717dOA.d.mts → schemas-Djt6hIjz.d.mts} +1 -1
- package/dist/{schemas-BaWB3EXP.d.mts → schemas-mGJIRIZ5.d.mts} +152 -152
- package/dist/{selection-DL3ric7K.mjs → selection-7SkHsmWs.mjs} +1 -1
- package/dist/services/adapter-runtime/index.d.mts +3 -3
- package/dist/services/adapter-runtime/index.mjs +1 -1
- package/dist/services/adapter-runtime/namespace.d.mts +1 -1
- package/dist/services/adapter-runtime/schemas.d.mts +1 -1
- package/dist/services/adapter-subsystem/index.d.mts +3 -3
- package/dist/services/adapter-subsystem/index.mjs +1 -1
- package/dist/services/adapter-subsystem/namespace.d.mts +1 -1
- package/dist/services/adapter-subsystem/namespace.mjs +1 -1
- package/dist/services/agent-runtime/index.d.mts +2 -2
- package/dist/services/agent-runtime/namespace.d.mts +1 -1
- package/dist/services/agent-runtime/schemas.d.mts +1 -1
- package/dist/services/automation-trigger/index.mjs +1 -1
- package/dist/services/capability/index.d.mts +2 -2
- package/dist/services/capability/index.mjs +1 -1
- package/dist/services/code-execution/index.d.mts +1 -1
- package/dist/services/code-execution/index.mjs +1 -1
- package/dist/services/codebase/index.d.mts +2 -2
- package/dist/services/codebase/namespace.d.mts +1 -1
- package/dist/services/codebase/schemas.d.mts +1 -1
- package/dist/services/compression/index.d.mts +2 -2
- package/dist/services/compression/namespace.d.mts +1 -1
- package/dist/services/compression/schemas.d.mts +1 -1
- package/dist/services/context-rules/index.d.mts +4 -4
- 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.mjs +1 -1
- package/dist/services/git/schemas.mjs +1 -1
- package/dist/services/harness/index.mjs +1 -1
- package/dist/services/index.d.mts +135 -156
- package/dist/services/index.mjs +1 -1
- package/dist/services/log-import/browser.d.mts +2 -2
- package/dist/services/log-import/index.d.mts +2 -2
- package/dist/services/log-import/log-import.d.mts +1 -1
- package/dist/services/log-import/log-import.mjs +1 -1
- package/dist/services/log-import/namespace.mjs +1 -1
- package/dist/services/log-import/schemas.mjs +1 -1
- package/dist/services/materialization/index.d.mts +13 -34
- package/dist/services/materialization/index.mjs +1 -1
- package/dist/services/model-registry/index.d.mts +1 -1
- package/dist/services/model-registry/index.mjs +1 -1
- package/dist/services/preferences/index.d.mts +2 -2
- package/dist/services/preferences/schemas.d.mts +1 -1
- package/dist/services/preferences/storage-namespace.d.mts +2 -2
- package/dist/services/provider-context/index.d.mts +1 -1
- package/dist/services/provider-context/index.mjs +1 -1
- package/dist/services/provider-runtime/index.mjs +1 -1
- package/dist/services/session/handlers/index.d.mts +1 -1
- package/dist/services/session/handlers/index.mjs +1 -1
- package/dist/services/session/index.d.mts +9 -9
- package/dist/services/session/index.mjs +1 -1
- package/dist/services/session/messages/namespace.d.mts +1 -1
- package/dist/services/session/messages/namespace.mjs +1 -1
- package/dist/services/session/orchestrator-testing/index.d.mts +1 -1
- package/dist/services/session/orchestrator-testing/index.mjs +1 -1
- package/dist/services/session/session-events/namespace.d.mts +1 -1
- package/dist/services/session/session-events/namespace.mjs +1 -1
- package/dist/services/session/storage/namespace.d.mts +1 -1
- package/dist/services/session/storage/schema.d.mts +1 -1
- package/dist/services/session/testing/index.mjs +1 -1
- package/dist/services/session/testing/orchestrator-shared.d.mts +1 -1
- package/dist/services/session/testing/orchestrator-shared.mjs +1 -1
- package/dist/services/session/turns/namespace.d.mts +1 -1
- package/dist/services/session/turns/namespace.mjs +1 -1
- package/dist/services/session-editor/index.d.mts +1 -1
- package/dist/services/session-editor/index.mjs +1 -1
- package/dist/services/settings/index.d.mts +3 -3
- package/dist/services/settings/index.mjs +1 -1
- package/dist/services/settings/namespace.d.mts +6 -6
- package/dist/services/settings/namespace.mjs +1 -1
- package/dist/services/settings/storage/clients-namespace.d.mts +1 -1
- package/dist/services/settings/storage/clients-namespace.mjs +1 -1
- package/dist/services/settings/storage/extension-configs/namespace.d.mts +3 -3
- package/dist/services/settings/storage/index.d.mts +3 -3
- package/dist/services/settings/storage/index.mjs +1 -1
- package/dist/services/settings/storage/providers-namespace.d.mts +1 -1
- package/dist/services/settings/storage/providers-namespace.mjs +1 -1
- package/dist/services/subagent/index.d.mts +1 -1
- package/dist/services/subagent/index.mjs +1 -1
- package/dist/services/subagent-template/index.d.mts +2 -2
- package/dist/services/subagent-template/namespace.d.mts +1 -1
- package/dist/services/subagent-template/schemas.d.mts +1 -1
- package/dist/services/tool-approval/index.d.mts +1 -1
- package/dist/services/tool-approval/index.mjs +1 -1
- package/dist/services/tools/index.d.mts +1 -1
- package/dist/services/tools/index.mjs +1 -1
- package/dist/services/tray-menu/index.d.mts +3 -3
- package/dist/services/tray-menu/index.mjs +1 -1
- package/dist/services/tray-menu/namespace.d.mts +1 -1
- package/dist/services/tray-menu/schemas.d.mts +1 -1
- package/dist/services/turn/index.d.mts +1 -1
- package/dist/services/turn/namespace.d.mts +1 -1
- package/dist/services/workflow-transitions/index.d.mts +1 -1
- package/dist/services/workflow-transitions/index.mjs +1 -1
- package/dist/{session-CXOPk3yg.mjs → session-BDFNAcuY.mjs} +1 -1
- package/dist/{session-BOpTI79g.mjs → session-CQAuApxe.mjs} +1 -1
- package/dist/{session-lineage-BRhnTWqq.d.mts → session-lineage-Bwb98OUz.d.mts} +1 -1
- package/dist/{shared-B9AWRm9A.mjs → shared-BYP7z9xy.mjs} +1 -1
- package/dist/{skill-DGNtc_ww.mjs → skill-1gU2q1KT.mjs} +1 -1
- package/dist/{src-BWEtqWTw.mjs → src-Dlpw-Gh5.mjs} +1 -1
- package/dist/storage/drizzle/client.d.mts +1 -1
- package/dist/storage/drizzle/client.mjs +1 -1
- package/dist/storage/drizzle/index.d.mts +1 -1
- package/dist/storage/drizzle/index.mjs +1 -1
- package/dist/storage/handlers/drizzle/index.d.mts +1 -1
- package/dist/storage/handlers/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 → tool-approval-service-rpV94znP.mjs} +1 -1
- package/dist/{tools-DWKWX3eV.mjs → tools-BkSFBqUz.mjs} +1 -1
- package/dist/{transition-CGnHfVIv.d.mts → transition-BbfxZ4U1.d.mts} +2 -2
- package/dist/{types-B6V3HDRl2.d.mts → types-CR415CdC2.d.mts} +1 -1
- package/dist/{types-FPmiU-3J.d.mts → types-CXwFtEIF.d.mts} +334 -334
- package/dist/ui-kernel/index.d.mts +1 -1
- package/dist/ui-kernel/pages/schemas.d.mts +1 -1
- package/dist/{version-BYeVh1pI.mjs → version-3xWJDCeF.mjs} +1 -1
- package/dist/{view-builder-CELaqM4Z.d.mts → view-builder-CJtK5hgs.d.mts} +209 -15
- package/dist/{visibility-DtDLRBdr.mjs → visibility-C5sLzqyS.mjs} +1 -1
- package/dist/{worker-B4nD_Erm.mjs → worker-VBlgozIo.mjs} +1 -1
- package/dist/worker-qgJToDTN.mjs +1 -0
- package/dist/workflow-engine/execution-attempt-repository.d.mts +2 -2
- package/dist/workflow-engine/execution-attempt-repository.mjs +1 -1
- package/dist/workflow-engine/index.d.mts +69 -70
- package/dist/workflow-engine/index.mjs +1 -1
- package/dist/workflow-engine/package.d.mts +1 -1
- package/dist/workflow-engine/package.mjs +1 -1
- package/dist/workflow-engine/provider-operation.d.mts +2 -2
- package/dist/workflow-engine/provider-operation.mjs +1 -1
- package/dist/workflow-engine/testing/conformance.d.mts +1 -1
- package/dist/workflow-engine/testing/conformance.mjs +2 -2
- package/dist/workflow-engine/testing/index.d.mts +1 -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 +76 -48
- package/dist/workflow-engine/workflow-orchestrator.mjs +1 -1
- package/dist/workflow-svpU9Cig.mjs +1 -0
- package/dist/{workflow-transitions-c_VQbyV0.mjs → workflow-transitions-Cuo6s9uv.mjs} +1 -1
- package/dist/workflow-worker-7AA-u1uC.mjs +2 -0
- package/package.json +1 -1
- package/dist/artifact-ClvHqL3w.mjs +0 -1
- package/dist/authority-state-bootstrap-7Cgb9TR2.mjs +0 -1
- package/dist/extension-Cz39YNXy.mjs +0 -1
- package/dist/framework-packages-BHgul8Kl.mjs +0 -1
- package/dist/materialization-B_LA9pfy.mjs +0 -1
- package/dist/model-DrzPt3ou.mjs +0 -1
- package/dist/namespace-sCPb79-7.mjs +0 -1
- package/dist/packages-Bp124-gx.mjs +0 -1
- package/dist/provider-operation-BwvTdAsv.d.mts +0 -207
- package/dist/schemas-CNkUEbIr.mjs +0 -1
- package/dist/worker-CLsRbzpk.mjs +0 -1
- package/dist/workflow-H8hsEikC.mjs +0 -1
- package/dist/workflow-worker-CmIkKnpF.mjs +0 -2
- package/dist/{adapter-auth-runtime-DHHppU4f.mjs → adapter-auth-runtime-BnPqQChk.mjs} +0 -0
- package/dist/{adapter-binding-C6jAAjGu.d.mts → adapter-binding-BU7STlfd.d.mts} +0 -0
- package/dist/{ajv-krzJXh1X.mjs → ajv-Dtk5hCZS.mjs} +0 -0
- package/dist/{attach-error-Cb3GbeKe.mjs → attach-error-B-vXQFLQ.mjs} +0 -0
- package/dist/{attempt-fixtures-gGhCA_WQ.mjs → attempt-fixtures-C-jQE_7B.mjs} +0 -0
- package/dist/{base-orchestrator-B9OUXDR-.d.mts → base-orchestrator-DXiejwQ3.d.mts} +0 -0
- package/dist/{bootstrap-start-client-DrvofWwi.mjs → bootstrap-start-client-Bdv-_2Q9.mjs} +0 -0
- package/dist/{capability-j3NekkIu.mjs → capability-Bw4tsDQu.mjs} +0 -0
- package/dist/{capability-service-DA9xdAyh.d.mts → capability-service-CsWaOwvH.d.mts} +0 -0
- package/dist/{client-BhRxxVig.d.mts → client-DP4ksY9q.d.mts} +0 -0
- package/dist/{client-binary-version-verifier-DXu9mjRx.d.mts → client-binary-version-verifier-BoXRTyae.d.mts} +0 -0
- package/dist/{client-binary-version-verifier-0lCKZOTg.mjs → client-binary-version-verifier-DHBAzg3-.mjs} +0 -0
- package/dist/{clients-namespace-2TIeXofb.d.mts → clients-namespace-BVDmj8uV.d.mts} +0 -0
- package/dist/{config-namespace-Burux0cR.d.mts → config-namespace-BMOKEuyf.d.mts} +0 -0
- package/dist/{create-static-mount-CuiFK6nC.mjs → create-static-mount-GSdckRQx.mjs} +0 -0
- package/dist/{cross-spawn-CZygZJMH.mjs → cross-spawn-Bx_VEdpd.mjs} +0 -0
- package/dist/{cursor-storage-bsc9lZKk.mjs → cursor-storage-Co4itf44.mjs} +0 -0
- package/dist/{definition-011l3aQ8.d.mts → definition-ByVJ3n6o.d.mts} +0 -0
- package/dist/{definitions-CRpdnHYM.mjs → definitions-CYZTuMdL.mjs} +0 -0
- package/dist/{descriptor-to-package-CcjdoWP4.mjs → descriptor-to-package-CZLujoiv.mjs} +0 -0
- package/dist/{drizzle-Bzc-OGVI.mjs → drizzle-me-95ICP.mjs} +0 -0
- package/dist/{esm-i-S5TW72.mjs → esm-DILYVXmW.mjs} +0 -0
- package/dist/{event-B8ELuk6k.mjs → event-DmQPb5MB.mjs} +0 -0
- package/dist/{execution-attempt-repository-D0cCU7dI.mjs → execution-attempt-repository-DXyh1hgz.mjs} +0 -0
- package/dist/{extension-context-CogUIfZb.d.mts → extension-context-Cx8CetW3.d.mts} +0 -0
- package/dist/{extension-discovery-CuC5Nd5d.d.mts → extension-discovery-C0Nj5EVZ.d.mts} +0 -0
- package/dist/{extension-namespace-QoTTwKPt.mjs → extension-namespace-twXNwE4R.mjs} +0 -0
- package/dist/{extension-package-provenance-aYrZuS4W.mjs → extension-package-provenance-BzvG6rDO.mjs} +0 -0
- package/dist/{facet-BnMh7Jyc.mjs → facet-Cly0VpTI.mjs} +0 -0
- package/dist/{filesystem-service-DYYL4fLd.d.mts → filesystem-service-C6D7oABi.d.mts} +0 -0
- package/dist/{handler-DF1fVDpf.mjs → handler-BYQPNm8O.mjs} +0 -0
- package/dist/{host-B-_ntOMH.mjs → host-CiHn8Yog.mjs} +0 -0
- package/dist/{identity-OjRlG6dZ.mjs → identity-BULrIHmo.mjs} +0 -0
- package/dist/{index-CweK7QAS.d.mts → index-B7g7e7_f.d.mts} +0 -0
- package/dist/{index-luD7oSCA.d.mts → index-B9-1l1oh.d.mts} +0 -0
- package/dist/{index-DuoOsxow.d.mts → index-BGWkmG9i.d.mts} +0 -0
- package/dist/{index-DiHGEgh-.d.mts → index-BR7IiCib.d.mts} +0 -0
- package/dist/{index-BlkTzRHz.d.mts → index-B_VcKELo.d.mts} +0 -0
- package/dist/{index-CUxMqAoE2.d.mts → index-BbjxBrcp2.d.mts} +0 -0
- package/dist/{index-CU90gGDk2.d.mts → index-BgY_UzH82.d.mts} +0 -0
- package/dist/{index-CrUijdhZ.d.mts → index-BnLp-7qH.d.mts} +0 -0
- package/dist/{index-DhCBbChV.d.mts → index-BpWoCe22.d.mts} +0 -0
- package/dist/{index-CKeNzHte.d.mts → index-Bpv8EpBa.d.mts} +0 -0
- package/dist/{index-CbaOOgMX.d.mts → index-BrRCVo9r.d.mts} +0 -0
- package/dist/{index-ikP83tJm.d.mts → index-CHuB40EK.d.mts} +0 -0
- package/dist/{index-C0uHQitR2.d.mts → index-CIV2G6uX2.d.mts} +0 -0
- package/dist/{index-DsIrU-pP.d.mts → index-CNOqYviR.d.mts} +0 -0
- package/dist/{index-BD1_BSMP.d.mts → index-CSEhxhIc.d.mts} +0 -0
- package/dist/{index-DmjyHIEH.d.mts → index-D3_QOfke.d.mts} +0 -0
- package/dist/{index-B4MG7PBn.d.mts → index-D6qlh6Td.d.mts} +0 -0
- package/dist/{index-CrA9tCMf.d.mts → index-DLlTuugR.d.mts} +0 -0
- package/dist/{index-BKco9D6a.d.mts → index-DOKPbF-y2.d.mts} +0 -0
- package/dist/{index-Oejq5WGD2.d.mts → index-DZv9yNKF2.d.mts} +0 -0
- package/dist/{index-09JDqcgy2.d.mts → index-DrwT45ci2.d.mts} +6 -6
- /package/dist/{index-C7ZdyYMT.d.mts → index-DxaQ-ceV.d.mts} +0 -0
- /package/dist/{index-CDJUiga3.d.mts → index-HRn0Kun0.d.mts} +0 -0
- /package/dist/{index-BPX7lMRX.d.mts → index-IkeLI7uY.d.mts} +0 -0
- /package/dist/{index-BRNRgfOm.d.mts → index-_Ngf4KAa.d.mts} +0 -0
- /package/dist/{index-BNF8osK42.d.mts → index-b_LJnwCU2.d.mts} +0 -0
- /package/dist/{json-value-BBZ6uGwc.mjs → json-value-DM-EjTC1.mjs} +0 -0
- /package/dist/{json-value-DbwI1AMR.d.mts → json-value-DyMQrwGz.d.mts} +0 -0
- /package/dist/{jsonl-transport-W03tkPvB.mjs → jsonl-transport-Dfv3RLzi.mjs} +0 -0
- /package/dist/{lib-Wtk4Ef-T.mjs → lib-BdfAJKDj.mjs} +0 -0
- /package/dist/{model-registry-C9rFu3kV.mjs → model-registry-B7ThN_s3.mjs} +0 -0
- /package/dist/{model-registry-Cixxx2jv.mjs → model-registry-DlUErRRt.mjs} +0 -0
- /package/dist/{modes-DwsJ3yVl.mjs → modes-CyG4sgs_.mjs} +0 -0
- /package/dist/{namespace-DiwqpB-c.mjs → namespace-B8kUQpwo.mjs} +0 -0
- /package/dist/{namespace-NXm_zvL1.mjs → namespace-BFlSY040.mjs} +0 -0
- /package/dist/{namespace-Du0accdE.mjs → namespace-C9d0aoYT.mjs} +0 -0
- /package/dist/{namespace-Df8uPrMr.d.mts → namespace-CQaL10rI.d.mts} +0 -0
- /package/dist/{namespace-Br7IQt88.d.mts → namespace-CcHA54E1.d.mts} +0 -0
- /package/dist/{namespace-jVTsuZHX.mjs → namespace-ChjzkJIl.mjs} +0 -0
- /package/dist/{namespace-C3Ch35nb.d.mts → namespace-Ciyw6FxO.d.mts} +0 -0
- /package/dist/{namespace-C3l4AsWS.d.mts → namespace-Ct2DKREI.d.mts} +0 -0
- /package/dist/{namespace-aUe_P5qN.d.mts → namespace-DdcRYk7b.d.mts} +0 -0
- /package/dist/{namespace-D5nHBTPz.d.mts → namespace-DtXYm32M.d.mts} +0 -0
- /package/dist/{namespace-C9X7Qvn5.d.mts → namespace-DyeMWQKf.d.mts} +0 -0
- /package/dist/{namespace-BW3Bfu9h.mjs → namespace-QXCaZK3I.mjs} +0 -0
- /package/dist/{namespace-tjoxekmf.mjs → namespace-ZN49zpqw.mjs} +0 -0
- /package/dist/{namespace-D4RJjLv8.d.mts → namespace-nE7vRctI.d.mts} +0 -0
- /package/dist/{namespace-BGi71aDN.d.mts → namespace-sTMm1voF.d.mts} +0 -0
- /package/dist/{namespace-DeezOMb9.d.mts → namespace-thsiHTFH.d.mts} +0 -0
- /package/dist/{orchestrator-shared-B2Lb5Enk.d.mts → orchestrator-shared-CYnIz5Zd.d.mts} +0 -0
- /package/dist/{out-8bOYN6EF.mjs → out-Cn6vBxlH.mjs} +0 -0
- /package/dist/{ownership-recovery-guard-DyW5vGBr.mjs → ownership-recovery-guard-Ce9-C5Sa.mjs} +0 -0
- /package/dist/{package-EGTn-Ng1.mjs → package-BUSXHPOT.mjs} +0 -0
- /package/dist/{package-DttKA9wN.mjs → package-D4eLGGv4.mjs} +0 -0
- /package/dist/{platform-CxyYPrkf.mjs → platform-C-fDsuEl.mjs} +0 -0
- /package/dist/{providers-C-eekMxD.mjs → providers-DVlsnJaY.mjs} +0 -0
- /package/dist/{providers-namespace-D-gdpu0p.d.mts → providers-namespace-BxknJ03z.d.mts} +0 -0
- /package/dist/{quick-lru-CCEnf7y6.mjs → quick-lru-CVryNCTx.mjs} +0 -0
- /package/dist/{registry-Dk12tAfv.mjs → registry-Q9gCZtxz.mjs} +0 -0
- /package/dist/{schema-BwrsXKsP.d.mts → schema-CJfSEZ8X.d.mts} +0 -0
- /package/dist/{schema-C0opCPww.mjs → schema-DIHGEQx3.mjs} +0 -0
- /package/dist/{schema-introspection-6-r_KEJQ.mjs → schema-introspection-CSnLZJpC.mjs} +0 -0
- /package/dist/{schemas-DKJyKDpe.d.mts → schemas-0VbIjfrW.d.mts} +0 -0
- /package/dist/{schemas-scyC2tFF.mjs → schemas-BFgsIiSb.mjs} +0 -0
- /package/dist/{schemas-BivbWRkG.mjs → schemas-BKnJj2i-.mjs} +0 -0
- /package/dist/{schemas-CeHU889f.mjs → schemas-BapfTRqp.mjs} +0 -0
- /package/dist/{schemas-Ds_YMFjX.d.mts → schemas-CmUWeOkr.d.mts} +0 -0
- /package/dist/{schemas-B8hKbBwI.mjs → schemas-CnFVygzI.mjs} +0 -0
- /package/dist/{schemas-CsOAG1rB.d.mts → schemas-CsRcSlvA2.d.mts} +0 -0
- /package/dist/{schemas-uaQuIxm4.d.mts → schemas-DQ5iRisA.d.mts} +0 -0
- /package/dist/{schemas-BNf-WkKF.d.mts → schemas-DzDVjYjt.d.mts} +0 -0
- /package/dist/{schemas-CMQ2PiO2.d.mts → schemas-KDl7p-wr.d.mts} +0 -0
- /package/dist/{schemas-v1W9Gj9m.d.mts → schemas-Yp3PvwsM.d.mts} +0 -0
- /package/dist/{semver-BI7kTNsY.mjs → semver-D_D2mA48.mjs} +0 -0
- /package/dist/{server-lifecycle-CmuBMs3O.d.mts → server-lifecycle-Ck6_8o8v.d.mts} +0 -0
- /package/dist/{server-lifecycle-B_OZnoe-.mjs → server-lifecycle-hNz8U-QJ.mjs} +0 -0
- /package/dist/{shared-schemas-CQ6blrEW.mjs → shared-schemas-kUho6Kmw.mjs} +0 -0
- /package/dist/{src-BA_c2cXX.mjs → src-Du_285FN.mjs} +0 -0
- /package/dist/{storage-namespace-CTXxds3h.d.mts → storage-namespace-CRdQoXZ9.d.mts} +0 -0
- /package/dist/{storage-namespace-BZce8kkW.mjs → storage-namespace-Dtz2G1if.mjs} +0 -0
- /package/dist/{storage-namespace-definition-Cca-zwXU.mjs → storage-namespace-definition-BJCbqVWz.mjs} +0 -0
- /package/dist/{storage-namespace-definition-Dkxl1FGw.d.mts → storage-namespace-definition-NBw1Y8Pa.d.mts} +0 -0
- /package/dist/{supports-color-SV_FgSN2.mjs → supports-color-BNmyqLq0.mjs} +0 -0
- /package/dist/{telemetry-BqoC87F-.mjs → telemetry-CUkZrhW6.mjs} +0 -0
- /package/dist/{timeout-DVlN2Zhy.mjs → timeout-DeBYTGBR.mjs} +0 -0
- /package/dist/{tray-menu-service-eVVxgPLc.mjs → tray-menu-service-TWrmvXSo.mjs} +0 -0
- /package/dist/{types-BklZfFWo.d.mts → types-BFv-EK2G.d.mts} +0 -0
- /package/dist/{types-BWfAz9Sh.d.mts → types-BcGXdeva.d.mts} +0 -0
- /package/dist/{types-DDfy8LgJ.d.mts → types-CUCFeisO.d.mts} +0 -0
- /package/dist/{types--Sa8Ip8j.d.mts → types-CXrp5ldz.d.mts} +0 -0
- /package/dist/{types-C4ayzk8k.d.mts → types-D4N56a4O.d.mts} +0 -0
- /package/dist/{types-Cwza95hS.mjs → types-D9GJ7FyQ.mjs} +0 -0
- /package/dist/{ui-config-B35GloSX.mjs → ui-config-9hlZAJOS.mjs} +0 -0
- /package/dist/{variant-Dwnge3J_.mjs → variant-73kFgYBK.mjs} +0 -0
- /package/dist/{window-registry-CIlKN806.d.mts → window-registry-Chi2qJ5k.d.mts} +0 -0
- /package/dist/{window-registry-CKiMJjId.mjs → window-registry-CzAwaPKL.mjs} +0 -0
- /package/dist/{zod-json-schema-Dixc-B1T.mjs → zod-json-schema-B9TYYq3e.mjs} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,c as t,d as n,f as r,g as i,h as a,l as o,m as s,n as c,o as l,p as u,s as d,u as f}from"../../execution-attempt-repository-D0cCU7dI.mjs";import{a as p,i as m,n as h,o as g,t as _}from"../../execution-attempt-owner-recovery-BRjtmTGv.mjs";import{a as v,c as y,d as b,f as x,i as S,l as C,n as w,o as T,p as E,r as D,s as O,t as k,u as A}from"../../attempt-record-codec-BcAPEIW3.mjs";import{a as j,c as M,d as N,f as P,i as F,l as I,m as L,n as R,o as z,p as B,r as V,s as H,t as U,u as W}from"../../attempt-fixtures-gGhCA_WQ.mjs";import{BoundedRecoveryEvidenceSchema as G}from"@makaio/framework/contracts";function K(e,t){return{...e,status:`settled`,settlementKind:t,claimable:!1,operationStartGate:`closed`}}function q(j,M={}){let N=M.attempts??new Map,P=M.operations??new Map,F=e=>P.get(e)?.obligation===`terminal-convergence`,I=M.committedOutcomes??new Map,L=M.activeAttempts??new Map,R=M.requestBindings??new Map,z=e=>{let t=e.settlementKind!=null,r=!t&&L.get(e.executionId)===e.executionAttemptId;return n({matchesExecution:!0,settled:t,active:r,allocated:r&&e.allocationRef!==null&&!F(e.executionAttemptId)})},B=e=>{let t=N.get(e.executionAttemptId),n=P.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}},V=(e,t)=>{P.set(e.executionAttemptId,{...e,ownerId:null,token:null,leaseExpiresAt:null,lastFailure:t})},H=(e,t)=>{let n=O(e.allocationRef),r=B(e.claim);if(r.kind!==`not-found`&&b(r.attempt,n),r.kind===`resolved`)return{kind:`resolved`,allocationRef:r.attempt.allocationRef};if(r.kind!==`authorized`)return{kind:r.kind};let{attempt:i,operation:a}=r;if(i.allocationRef!==null)return o(i.allocationRef,n)?{kind:`duplicate`,allocationRef:i.allocationRef}:{kind:`conflict`,allocationRef:i.allocationRef};let s=L.get(i.executionId)===i.executionAttemptId;return N.set(i.executionAttemptId,{...i,status:`allocated`,allocationRef:n,claimable:t&&s}),P.set(a.executionAttemptId,{...a,obligation:`allocation-control`}),{kind:`recorded`}},U={async getAttemptWithAllocation(e){return N.get(e)??null},async recordDiscoveredAllocation(e){return H(e,!1)},async evolveAllocationRef(e){let{currentRef:t,nextRef:n}=y(e),r=B(e.claim);if(r.kind===`stale`)return{kind:`stale`,storedRef:r.attempt.allocationRef};if(r.kind!==`authorized`)return{kind:r.kind};let{attempt:i}=r;return i.executionId===e.executionId?i.allocationRef===null?{kind:`not-allocated`}:o(i.allocationRef,t)?(N.set(i.executionAttemptId,{...i,allocationRef:n}),{kind:`evolved`}):{kind:`stale`,storedRef:i.allocationRef}:{kind:`not-found`}},async getRecoverableAttempts(e){let t=S(new Date().toISOString()),n=[];for(let r of N.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(E(r)));return n.sort(w)}},W=e=>{let t=D(e.bootstrapTimeoutMs);if(N.has(e.executionAttemptId))throw new c(e.executionAttemptId);let n={executionAttemptId:e.executionAttemptId,executionId:e.executionId,instruction:e.instruction,preparationReceipts:Object.freeze([]),status:`pending`,allocationRef:null,...t,providerId:null,allocationLifetime:null,provisionerIncarnationId:null,settlementKind:null,claimable:!1,claimExpiresAt:null,...k},r=L.get(e.executionId),i=r===void 0?void 0:N.get(r);return i!==void 0&&N.set(i.executionAttemptId,{...i,claimable:i.status===`allocated`?!1:i.claimable,operationStartGate:`closed`}),N.set(e.executionAttemptId,n),L.set(e.executionId,e.executionAttemptId),n};return{async createAttempt(e){return W({...e,instruction:g(e.instruction)})},async ensureAttempt(e){let t=m(e),n=R.get(t.executionId),r=n?.get(t.requestKey);if(r!==void 0)return h(t,N.get(r)??null);let i=W(t),a=n??new Map;return a.set(t.requestKey,i.executionAttemptId),R.set(t.executionId,a),{kind:`created`,attempt:structuredClone(i)}},async readAttemptSettlement(e){let t=p(e);return _(t,{attempt:N.get(t.executionAttemptId)??null,activeAttemptId:L.get(t.executionId)??null,outcomeText:I.get(t.executionAttemptId)??null},j)},async readBootstrapStartState(e){let t=N.get(e.executionAttemptId);return!t||t.executionId!==e.executionId?null:{settled:t.settlementKind!=null,active:L.get(e.executionId)===e.executionAttemptId,allocated:t.allocationRef!==null,allocationTerminated:F(e.executionAttemptId),operationStartGate:t.operationStartGate,bootstrapDeadlineAt:t.bootstrapDeadlineAt??null}},async beginProvisioning(e){let t=T(e.allocationLifetime),n=N.get(e.executionAttemptId);if(!n||n.executionId!==e.executionId)return{kind:`not-found`};if(L.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`};N.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:v(e.leaseExpiresAt)};return P.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 P.get(e)??null},async renewProviderOperationClaim(e){let t=B(e.claim);if(t.kind!==`authorized`)return{kind:t.kind};let n=v(e.leaseExpiresAt);return P.set(e.claim.executionAttemptId,{...t.operation,leaseExpiresAt:n}),{kind:`claimed`,claim:{...e.claim,leaseExpiresAt:n}}},async takeOverProviderOperation(e){let t=N.get(e.executionAttemptId),n=P.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:v(e.leaseExpiresAt)};return P.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:G.parse(e.evidence),n=B(e.claim);return n.kind===`authorized`?(P.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=G.parse(e.evidence),n=B(e.claim);return n.kind===`authorized`?(P.set(e.claim.executionAttemptId,{...n.operation,failureCount:n.operation.failureCount+1,lastFailure:t}),{kind:`recorded`}):{kind:n.kind}},async recordAllocation(e){return H(e,!0)},async recordProvisioningAbsent(e){let t=G.parse(e.evidence),n=B(e.claim);if(n.kind!==`authorized`)return{kind:n.kind};let{attempt:r,operation:i}=n;return r.executionId===e.executionId?r.allocationRef===null?(N.set(r.executionAttemptId,K(r,`abandoned`)),V(i,t),{kind:`recorded`}):{kind:`allocated`,allocationRef:r.allocationRef}:{kind:`not-found`}},async recordProvisionerIncarnationLost(e){let t=G.parse(e.proof.evidence),n=B(e.claim);if(n.kind!==`authorized`)return{kind:n.kind};let{attempt:r,operation:i}=n,o=a(r,e);return o===null?(N.set(r.executionAttemptId,K(r,`abandoned`)),V(i,t),{kind:`recorded`}):o},async recordAllocationTerminated(e){let t=G.parse(e.evidence),n=B(e.claim);if(n.kind!==`authorized`)return{kind:n.kind};let{attempt:r,operation:i}=n;return r.allocationRef===null?{kind:`not-allocated`}:(P.set(i.executionAttemptId,{...i,obligation:`terminal-convergence`,lastFailure:t}),{kind:`recorded`})},async recordInfrastructureFailure(e){let t=B(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`?(N.set(n.executionAttemptId,K(n,`infrastructure-failure`)),V(r,r.lastFailure),{kind:`recorded`}):{kind:`not-terminated`}:{kind:`not-found`}},async registerRuntime(t){let n=N.get(t.executionAttemptId);if(n===void 0||n.executionId!==t.executionId)return{kind:`not-found`};let r=z(n)??e(n,t);if(r!==null)return r;let i=n.runtimeGeneration+1;return N.set(n.executionAttemptId,{...n,runtimeGeneration:i,runtimeIncarnationId:t.runtimeIncarnationId,runtimeReadyAt:null,activeOperationId:null,activeOperationKind:null,activeOperationKey:null,activeOperationGeneration:null,activeOperationAdmittedAt:null}),{kind:`registered`,runtimeGeneration:i}},async admitOperation(e){let t=N.get(e.executionAttemptId);if(t===void 0||t.executionId!==e.executionId)return{kind:`not-found`};let n=z(t);if(n!==null)return n;let i=r(t,e,t.activeOperationId!==null&&t.activeOperationKey===e.admissionKey&&t.activeOperationAdmittedAt===null?v(new Date().toISOString()):``,t);if(i!==null)return i;let a=crypto.randomUUID(),o=v(new Date().toISOString());return N.set(t.executionAttemptId,{...t,activeOperationId:a,activeOperationKind:e.operationKind,activeOperationKey:e.admissionKey,activeOperationGeneration:t.runtimeGeneration,activeOperationAdmittedAt:o}),{kind:`admitted`,operationId:a,runtimeGeneration:t.runtimeGeneration,admittedAt:o}},async getInstruction(e){let t=N.get(e.executionAttemptId);return t?.executionId===e.executionId?t.instruction:null},async reportOperation(e){let t=A(e.result),n=N.get(e.executionAttemptId);if(n===void 0||n.executionId!==e.executionId)return{kind:`not-found`};let r=s({matchesExecution:!0,settled:n.settlementKind!=null,active:L.get(e.executionId)===e.executionAttemptId,allocated:n.allocationRef!==null&&!F(e.executionAttemptId)},n,n,{...e,result:t});if(r!==null)return r;let i=C([...n.preparationReceipts,{operationId:e.operationId,runtimeGeneration:e.runtimeGeneration,result:t}]);return N.set(e.executionAttemptId,{...n,preparationReceipts:i,activeOperationId:null,activeOperationKind:null,activeOperationKey:null,activeOperationGeneration:null,activeOperationAdmittedAt:null,lastCompletedOperationId:e.operationId}),{kind:`accepted`,binding:t.binding}},async completeOperation(e){let t=N.get(e.executionAttemptId);if(t===void 0)return{kind:`not-found`};if(t.settlementKind!=null)return{kind:`resolved`};let n=u(t,e);return n===null?(N.set(t.executionAttemptId,{...t,activeOperationId:null,activeOperationKind:null,activeOperationKey:null,activeOperationGeneration:null,activeOperationAdmittedAt:null,lastCompletedOperationId:e.operationId}),{kind:`completed`}):n},async markRuntimeReady(e){let t=v(e.readyAt),n=N.get(e.executionAttemptId);if(n===void 0||n.executionId!==e.executionId)return{kind:`not-found`};let r=z(n)??i(n,e);return r===null?(N.set(n.executionAttemptId,{...n,runtimeReadyAt:t}),{kind:`ready`,acceptedAt:t}):r},async getAttemptControlState(e){let t=N.get(e);return t===void 0?null:x(t)},async getActiveAttempt(e,t){return L.get(e)===t?N.get(t)??null:null},canonicalizeOutcome(e){return t(j,e)},decodeOutcome(e){return d(j,e)},async commitOutcome(e){let t=e.result;if(L.get(e.executionId)!==e.executionAttemptId)return{kind:`fenced`};let n=N.get(e.executionAttemptId);if(n===void 0)return{kind:`fenced`};let r=I.get(e.executionAttemptId);if(r!==void 0){let e=d(j,r);return f(r,t.text)?{kind:`duplicate`,outcome:e,text:r}:{kind:`conflict`}}if(n.settlementKind!=null)return{kind:`conflict`};l(n,e.runtimeFence),I.set(e.executionAttemptId,t.text),N.set(e.executionAttemptId,K(n,`outcome`));let i=P.get(e.executionAttemptId);return i&&V(i,i.lastFailure),{kind:`accepted`,outcome:d(j,t.text),text:t.text}},async abandonPendingAttempt(e,t){if(L.get(t)!==e)return{kind:`fenced`};let n=N.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`}:(N.set(e,K(n,`abandoned`)),{kind:`abandoned`}):{kind:`fenced`}},recovery:U,attempts:N,operations:P,committedOutcomes:I,activeAttempts:L,requestBindings:R}}export{k as INITIAL_ATTEMPT_CONTROL_STATE,U as TEST_OWNER_ID,R as TEST_PROVIDER_ID,V as TEST_PROVISIONER_INCARNATION_ID,F as allocateTestAttempt,j as beginTestProvisioning,q as createInMemoryAttemptRepository,z as driveTestAttemptToAllocated,H as leaseAt,M as makeBeginProvisioningInput,I as makeEvidence,W as makeProcessLossProof,N as makeTestAllocationRef,P as makeTestInstruction,B as makeTestWorkflowResult,L as workflowRunResultOutcomeCodec};
|
|
1
|
+
import{_ as e,c as t,d as n,f as r,g as i,h as a,l as o,m as s,n as c,o as l,p as u,s as d,u as f}from"../../execution-attempt-repository-DXyh1hgz.mjs";import{a as p,i as m,n as h,o as g,t as _}from"../../execution-attempt-owner-recovery-CdH04iwP.mjs";import{isProviderOperationResolved as v}from"../provider-operation.mjs";import{a as y,c as b,d as x,f as S,i as C,l as w,n as T,o as E,p as D,r as O,s as k,t as A,u as j}from"../../attempt-record-codec-6jpayBMY.mjs";import{a as M,c as N,d as P,f as F,i as I,l as L,m as R,n as z,o as B,p as V,r as H,s as U,t as W,u as G}from"../../attempt-fixtures-C-jQE_7B.mjs";import{BoundedRecoveryEvidenceSchema as K}from"@makaio/framework/contracts";function q(e,t){return{...e,status:`settled`,settlementKind:t,claimable:!1,operationStartGate:`closed`}}function J(M,N={}){let P=N.attempts??new Map,F=N.operations??new Map,I=e=>F.get(e)?.obligation===`terminal-convergence`,L=N.committedOutcomes??new Map,R=N.activeAttempts??new Map,z=N.requestBindings??new Map,B=e=>{let t=e.settlementKind!=null,r=!t&&R.get(e.executionId)===e.executionAttemptId;return n({matchesExecution:!0,settled:t,active:r,allocated:r&&e.allocationRef!==null&&!I(e.executionAttemptId)})},V=e=>{let t=P.get(e.executionAttemptId),n=F.get(e.executionAttemptId);return!t||!n?{kind:`not-found`}:v(t,n)?{kind:`resolved`,attempt:t}: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}},H=(e,t)=>{e.completionEvidence===null&&F.set(e.executionAttemptId,{...e,completionEvidence:t})},U=(e,t)=>{let n=k(e.allocationRef),r=V(e.claim);if(r.kind!==`not-found`&&x(r.attempt,n),r.kind===`resolved`)return{kind:`resolved`,allocationRef:r.attempt.allocationRef};if(r.kind!==`authorized`)return{kind:r.kind};let{attempt:i,operation:a}=r;if(i.allocationRef!==null)return o(i.allocationRef,n)?{kind:`duplicate`,allocationRef:i.allocationRef}:{kind:`conflict`,allocationRef:i.allocationRef};let s=R.get(i.executionId)===i.executionAttemptId;return P.set(i.executionAttemptId,{...i,status:i.settlementKind===null?`allocated`:i.status,allocationRef:n,claimable:i.settlementKind===null&&t&&s}),F.set(a.executionAttemptId,{...a,obligation:`allocation-control`}),{kind:`recorded`}},W={async getAttemptWithAllocation(e){return P.get(e)??null},async recordDiscoveredAllocation(e){return U(e,!1)},async evolveAllocationRef(e){let{currentRef:t,nextRef:n}=b(e),r=V(e.claim);if(r.kind===`stale`)return{kind:`stale`,storedRef:r.attempt.allocationRef};if(r.kind!==`authorized`)return{kind:r.kind};let{attempt:i}=r;return i.executionId===e.executionId?i.allocationRef===null?{kind:`not-allocated`}:o(i.allocationRef,t)?(P.set(i.executionAttemptId,{...i,allocationRef:n}),{kind:`evolved`}):{kind:`stale`,storedRef:i.allocationRef}:{kind:`not-found`}},async getRecoverableAttempts(e){let t=C(new Date().toISOString()),n=[];for(let r of P.values())r.executionId===e&&r.status===`allocated`&&r.allocationRef!==null&&r.claimable===!0&&r.settlementKind==null&&(r.claimExpiresAt!=null&&C(r.claimExpiresAt)<t||n.push(D(r)));return n.sort(T)},async listOpenProviderOperations(e){if(!Number.isSafeInteger(e.limit)||e.limit<=0)throw RangeError(`limit must be a positive safe integer`);let t=C(e.observedAt),n=[];for(let e of F.values()){let r=P.get(e.executionAttemptId);!r||v(r,e)||e.ownerId!==null&&e.leaseExpiresAt!==null&&C(e.leaseExpiresAt)>t||n.push({attempt:r,operation:e})}return n.sort((e,t)=>T(e.attempt,t.attempt)).slice(0,e.limit)}},G=e=>{let t=O(e.bootstrapTimeoutMs);if(P.has(e.executionAttemptId))throw new c(e.executionAttemptId);let n={executionAttemptId:e.executionAttemptId,executionId:e.executionId,instruction:e.instruction,preparationReceipts:Object.freeze([]),status:`pending`,allocationRef:null,...t,providerId:null,allocationLifetime:null,provisionerIncarnationId:null,settlementKind:null,claimable:!1,claimExpiresAt:null,...A},r=R.get(e.executionId),i=r===void 0?void 0:P.get(r);return i!==void 0&&P.set(i.executionAttemptId,{...i,claimable:i.status===`allocated`?!1:i.claimable,operationStartGate:`closed`}),P.set(e.executionAttemptId,n),R.set(e.executionId,e.executionAttemptId),n};return{async createAttempt(e){return G({...e,instruction:g(e.instruction)})},async ensureAttempt(e){let t=m(e),n=z.get(t.executionId),r=n?.get(t.requestKey);if(r!==void 0)return h(t,P.get(r)??null);let i=G(t),a=n??new Map;return a.set(t.requestKey,i.executionAttemptId),z.set(t.executionId,a),{kind:`created`,attempt:structuredClone(i)}},async readAttemptSettlement(e){let t=p(e);return _(t,{attempt:P.get(t.executionAttemptId)??null,activeAttemptId:R.get(t.executionId)??null,outcomeText:L.get(t.executionAttemptId)??null},M)},async readBootstrapStartState(e){let t=P.get(e.executionAttemptId);return!t||t.executionId!==e.executionId?null:{settled:t.settlementKind!=null,active:R.get(e.executionId)===e.executionAttemptId,allocated:t.allocationRef!==null,allocationTerminated:I(e.executionAttemptId),operationStartGate:t.operationStartGate,bootstrapDeadlineAt:t.bootstrapDeadlineAt??null}},async beginProvisioning(e){let t=E(e.allocationLifetime),n=P.get(e.executionAttemptId);if(!n||n.executionId!==e.executionId)return{kind:`not-found`};if(R.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`};P.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:y(e.leaseExpiresAt)};return F.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,completionEvidence:null}),{kind:`started`,claim:r}},async getProviderOperation(e){return F.get(e)??null},async renewProviderOperationClaim(e){let t=V(e.claim);if(t.kind!==`authorized`)return{kind:t.kind};let n=y(e.leaseExpiresAt);return F.set(e.claim.executionAttemptId,{...t.operation,leaseExpiresAt:n}),{kind:`claimed`,claim:{...e.claim,leaseExpiresAt:n}}},async takeOverProviderOperation(e){let t=P.get(e.executionAttemptId),n=F.get(e.executionAttemptId);if(!t||!n)return{kind:`not-found`};if(v(t,n))return{kind:`resolved`};if(n.ownerId!==null&&n.leaseExpiresAt!==null&&C(n.leaseExpiresAt)>C(e.observedAt))return{kind:`stale`};let r={executionAttemptId:e.executionAttemptId,generation:n.generation+1,ownerId:e.ownerId,token:crypto.randomUUID(),leaseExpiresAt:y(e.leaseExpiresAt)};return F.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:K.parse(e.evidence),n=V(e.claim);return n.kind===`authorized`?(F.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=K.parse(e.evidence),n=V(e.claim);return n.kind===`authorized`?(F.set(e.claim.executionAttemptId,{...n.operation,failureCount:n.operation.failureCount+1,lastFailure:t}),{kind:`recorded`}):{kind:n.kind}},async completeProviderOperation(e){let t=K.parse(e.evidence),n=P.get(e.claim.executionAttemptId),r=F.get(e.claim.executionAttemptId);return!n||!r?{kind:`not-found`}:r.token!==e.claim.token||r.generation!==e.claim.generation||r.ownerId!==e.claim.ownerId?{kind:`stale`}:v(n,r)?{kind:`already-completed`}:r.completionEvidence===null?(H(r,t),n.settlementKind===null?{kind:`evidence-recorded`}:{kind:`completed`}):{kind:`evidence-recorded`}},async recordAllocation(e){return U(e,!0)},async recordProvisioningAbsent(e){let t=K.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?r.settlementKind===null?(P.set(r.executionAttemptId,q(r,`abandoned`)),H(i,t),{kind:`recorded`}):(H(i,t),{kind:`completed`}):{kind:`allocated`,allocationRef:r.allocationRef}:{kind:`not-found`}},async recordProvisionerIncarnationLost(e){let t=K.parse(e.proof.evidence),n=V(e.claim);if(n.kind!==`authorized`)return{kind:n.kind};let{attempt:r,operation:i}=n,o=a(r,e);return o===null?r.settlementKind===null?(P.set(r.executionAttemptId,q(r,`abandoned`)),H(i,t),{kind:`recorded`}):(H(i,t),{kind:`completed`}):o},async recordAllocationTerminated(e){let t=K.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`}:(F.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.settlementKind===null?n.allocationRef===null?{kind:`not-allocated`}:r.obligation===`terminal-convergence`?(P.set(n.executionAttemptId,q(n,`infrastructure-failure`)),{kind:`recorded`}):{kind:`not-terminated`}:{kind:`resolved`}:{kind:`not-found`}},async registerRuntime(t){let n=P.get(t.executionAttemptId);if(n===void 0||n.executionId!==t.executionId)return{kind:`not-found`};let r=B(n)??e(n,t);if(r!==null)return r;let i=n.runtimeGeneration+1;return P.set(n.executionAttemptId,{...n,runtimeGeneration:i,runtimeIncarnationId:t.runtimeIncarnationId,runtimeReadyAt:null,activeOperationId:null,activeOperationKind:null,activeOperationKey:null,activeOperationGeneration:null,activeOperationAdmittedAt:null}),{kind:`registered`,runtimeGeneration:i}},async admitOperation(e){let t=P.get(e.executionAttemptId);if(t===void 0||t.executionId!==e.executionId)return{kind:`not-found`};let n=B(t);if(n!==null)return n;let i=r(t,e,t.activeOperationId!==null&&t.activeOperationKey===e.admissionKey&&t.activeOperationAdmittedAt===null?y(new Date().toISOString()):``,t);if(i!==null)return i;let a=crypto.randomUUID(),o=y(new Date().toISOString());return P.set(t.executionAttemptId,{...t,activeOperationId:a,activeOperationKind:e.operationKind,activeOperationKey:e.admissionKey,activeOperationGeneration:t.runtimeGeneration,activeOperationAdmittedAt:o}),{kind:`admitted`,operationId:a,runtimeGeneration:t.runtimeGeneration,admittedAt:o}},async getInstruction(e){let t=P.get(e.executionAttemptId);return t?.executionId===e.executionId?t.instruction:null},async reportOperation(e){let t=j(e.result),n=P.get(e.executionAttemptId);if(n===void 0||n.executionId!==e.executionId)return{kind:`not-found`};let r=s({matchesExecution:!0,settled:n.settlementKind!=null,active:R.get(e.executionId)===e.executionAttemptId,allocated:n.allocationRef!==null&&!I(e.executionAttemptId)},n,n,{...e,result:t});if(r!==null)return r;let i=w([...n.preparationReceipts,{operationId:e.operationId,runtimeGeneration:e.runtimeGeneration,result:t}]);return P.set(e.executionAttemptId,{...n,preparationReceipts:i,activeOperationId:null,activeOperationKind:null,activeOperationKey:null,activeOperationGeneration:null,activeOperationAdmittedAt:null,lastCompletedOperationId:e.operationId}),{kind:`accepted`,binding:t.binding}},async completeOperation(e){let t=P.get(e.executionAttemptId);if(t===void 0)return{kind:`not-found`};if(t.settlementKind!=null)return{kind:`resolved`};let n=u(t,e);return n===null?(P.set(t.executionAttemptId,{...t,activeOperationId:null,activeOperationKind:null,activeOperationKey:null,activeOperationGeneration:null,activeOperationAdmittedAt:null,lastCompletedOperationId:e.operationId}),{kind:`completed`}):n},async markRuntimeReady(e){let t=y(e.readyAt),n=P.get(e.executionAttemptId);if(n===void 0||n.executionId!==e.executionId)return{kind:`not-found`};let r=B(n)??i(n,e);return r===null?(P.set(n.executionAttemptId,{...n,runtimeReadyAt:t}),{kind:`ready`,acceptedAt:t}):r},async getAttemptControlState(e){let t=P.get(e);return t===void 0?null:S(t)},async getActiveAttempt(e,t){return R.get(e)===t?P.get(t)??null:null},canonicalizeOutcome(e){return t(M,e)},decodeOutcome(e){return d(M,e)},async commitOutcome(e){let t=e.result;if(R.get(e.executionId)!==e.executionAttemptId)return{kind:`fenced`};let n=P.get(e.executionAttemptId);if(n===void 0)return{kind:`fenced`};let r=L.get(e.executionAttemptId);if(r!==void 0){let e=d(M,r);return f(r,t.text)?{kind:`duplicate`,outcome:e,text:r}:{kind:`conflict`}}return n.settlementKind==null?(l(n,e.runtimeFence),L.set(e.executionAttemptId,t.text),P.set(e.executionAttemptId,q(n,`outcome`)),{kind:`accepted`,outcome:d(M,t.text),text:t.text}):{kind:`conflict`}},async abandonPendingAttempt(e,t){if(R.get(t)!==e)return{kind:`fenced`};let n=P.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`}:(P.set(e,q(n,`abandoned`)),{kind:`abandoned`}):{kind:`fenced`}},recovery:W,attempts:P,operations:F,committedOutcomes:L,activeAttempts:R,requestBindings:z}}export{A as INITIAL_ATTEMPT_CONTROL_STATE,W as TEST_OWNER_ID,z as TEST_PROVIDER_ID,H as TEST_PROVISIONER_INCARNATION_ID,I as allocateTestAttempt,M as beginTestProvisioning,J as createInMemoryAttemptRepository,B as driveTestAttemptToAllocated,U as leaseAt,N as makeBeginProvisioningInput,L as makeEvidence,G as makeProcessLossProof,P as makeTestAllocationRef,F as makeTestInstruction,V as makeTestWorkflowResult,R as workflowRunResultOutcomeCodec};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as ExecutionAttemptRepository,
|
|
1
|
+
import { C as ExecutionAttemptRepository, N as OutcomeCodec } from "../../execution-attempt-repository-CF3cWsPo.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{_ as e,c as t,d as n,f as r,g as i,h as a,i as o,l as s,m as c,n as ee,o as te,p as
|
|
1
|
+
import{_ as e,c as t,d as n,f as r,g as i,h as a,i as o,l as s,m as c,n as ee,o as te,p as l,r as u,s as d,t as f,u as p}from"../../execution-attempt-repository-DXyh1hgz.mjs";import{a as ne,i as re,n as ie,o as m,t as ae}from"../../execution-attempt-owner-recovery-CdH04iwP.mjs";import{PROVIDER_OPERATION_OBLIGATIONS as h,isProviderOperationResolved as g}from"../provider-operation.mjs";import{a as _,c as oe,d as se,i as v,l as y,o as ce,p as le,r as b,s as x,t as ue,u as S}from"../../attempt-record-codec-6jpayBMY.mjs";import{BoundedRecoveryEvidenceSchema as C,ExecutionAttemptOperationKindSchema as w,ProviderAllocationRefSchema as T,WorkerAllocationLifetimeSchema as E}from"@makaio/framework/contracts";import{getRawSqlExecutor as de,isSqliteUniqueViolationError as fe,serializeByKey as D,serializeDatabaseOperation as O}from"@makaio/framework/storage/drizzle";import{sql as k}from"drizzle-orm";const pe=[`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
|
instruction TEXT NOT NULL,
|
|
@@ -43,46 +43,70 @@ import{_ as e,c as t,d as n,f as r,g as i,h as a,i as o,l as s,m as c,n as ee,o
|
|
|
43
43
|
lease_expires_at TEXT,
|
|
44
44
|
obligation TEXT NOT NULL,
|
|
45
45
|
failure_count INTEGER NOT NULL DEFAULT 0,
|
|
46
|
-
last_failure TEXT
|
|
47
|
-
|
|
46
|
+
last_failure TEXT,
|
|
47
|
+
completion_evidence TEXT
|
|
48
|
+
)`];function A(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 j(e,t){return e===null?null:t(JSON.parse(e))}function M(e){return{runtimeGeneration:e.runtime_generation,runtimeIncarnationId:e.runtime_incarnation_id,runtimeReadyAt:e.runtime_ready_at,operationStartGate:A(f,e.operation_start_gate,`operation_start_gate`),activeOperationId:e.active_operation_id,activeOperationKind:e.active_operation_kind===null?null:w.parse(e.active_operation_kind),activeOperationKey:e.active_operation_key,activeOperationGeneration:e.active_operation_generation,activeOperationAdmittedAt:e.active_operation_admitted_at,lastCompletedOperationId:e.last_completed_operation_id}}function N(e){return{...M(e),executionAttemptId:e.execution_attempt_id,executionId:e.execution_id,instruction:m(JSON.parse(e.instruction)),preparationReceipts:y(JSON.parse(e.preparation_receipts)),status:A(o,e.status,`status`),allocationRef:j(e.allocation_ref,e=>T.parse(e)),createdAt:e.created_at,bootstrapDeadlineAt:e.bootstrap_deadline_at,providerId:e.provider_id,allocationLifetime:e.allocation_lifetime===null?null:E.parse(e.allocation_lifetime),provisionerIncarnationId:e.provisioner_incarnation_id,settlementKind:e.settlement_kind===null?null:A(u,e.settlement_kind,`settlement_kind`),claimable:e.claimable!==0,claimExpiresAt:e.claim_expires_at}}function P(e){return{executionAttemptId:e.execution_attempt_id,generation:e.generation,ownerId:e.owner_id,token:e.token,leaseExpiresAt:e.lease_expires_at,obligation:A(h,e.obligation,`obligation`),failureCount:e.failure_count,lastFailure:j(e.last_failure,e=>C.parse(e)),completionEvidence:j(e.completion_evidence,e=>C.parse(e))}}const F=new Map,I=new Map;function L(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`)||L(t.cause)}function R(e){if(typeof e!=`object`||!e)return!1;let t=e;return(typeof t.message==`string`?t.message:``).includes(`no transaction is active`)||R(t.cause)}async function z(){await new Promise(e=>setImmediate(e))}async function me(e){for(let t=0;;t+=1)try{await e.run(k.raw(`COMMIT`));return}catch(e){if(!L(e)||t===100)throw e;await z()}}async function he(e,t){return D(F,e,t)}async function ge(e,t){return D(I,e,t)}const B=new WeakMap;async function _e(e,t){let n=(await t.all(k.raw(`PRAGMA database_list`))).find(e=>e.name===`main`)?.file??null;if(n!==null&&n!==``)return`file:${n}`;let r=B.get(e);if(r!==void 0)return r;let i=`connection:${crypto.randomUUID()}`;return B.set(e,i),i}async function V(e,t){let n=await e();if(typeof n!=`function`)return n;if((await n()).rowsAffected>0)return typeof t==`function`?t():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 H(e){return k`EXISTS (SELECT 1 FROM test_provider_operation
|
|
48
49
|
WHERE execution_attempt_id = ${e.executionAttemptId}
|
|
49
50
|
AND generation = ${e.generation}
|
|
50
51
|
AND owner_id = ${e.ownerId}
|
|
51
|
-
AND token = ${e.token})`}function
|
|
52
|
-
|
|
52
|
+
AND token = ${e.token})`}function U(e){return k`(completion_evidence IS NULL
|
|
53
|
+
OR NOT EXISTS (SELECT 1 FROM test_execution_attempt
|
|
54
|
+
WHERE execution_attempt_id = ${e}
|
|
55
|
+
AND settlement_kind IS NOT NULL))`}function W(e){return k`EXISTS (SELECT 1 FROM test_provider_operation
|
|
56
|
+
WHERE execution_attempt_id = ${e.executionAttemptId}
|
|
57
|
+
AND generation = ${e.generation}
|
|
58
|
+
AND owner_id = ${e.ownerId}
|
|
59
|
+
AND token = ${e.token}
|
|
60
|
+
AND ${U(e.executionAttemptId)})`}function G(e){return k`EXISTS (SELECT 1 FROM test_provider_operation
|
|
53
61
|
WHERE execution_attempt_id = ${e}
|
|
54
|
-
AND obligation = ${`terminal-convergence`})`}function
|
|
62
|
+
AND obligation = ${`terminal-convergence`})`}function K(){return k`EXISTS (SELECT 1 FROM test_active_execution_attempt
|
|
55
63
|
WHERE execution_id = test_execution_attempt.execution_id
|
|
56
|
-
AND execution_attempt_id = test_execution_attempt.execution_attempt_id)`}async function
|
|
64
|
+
AND execution_attempt_id = test_execution_attempt.execution_attempt_id)`}async function q(o,u){let w=de(o);await w.run(k.raw(`PRAGMA busy_timeout = 0`));let T=await _e(o,w);await he(T,async()=>{for(let e of pe)await w.run(k.raw(e));(await w.all(k.raw(`PRAGMA table_info(test_execution_attempt)`))).some(e=>e.name===`bootstrap_deadline_at`)||await w.run(k.raw(`ALTER TABLE test_execution_attempt ADD COLUMN bootstrap_deadline_at TEXT`)),(await w.all(k.raw(`PRAGMA table_info(test_provider_operation)`))).some(e=>e.name===`completion_evidence`)||await w.run(k.raw(`ALTER TABLE test_provider_operation ADD COLUMN completion_evidence TEXT`))});let E,D=async e=>O(o,()=>ge(T,async()=>{if(E!==void 0)throw Error(`This repository was retired by a failed transaction rollback`,{cause:E});for(let t=0;;t+=1)try{return await w.withSession(async t=>{let n=!1;try{await t.run(k.raw(`BEGIN IMMEDIATE`)),n=!0;let r=await e(t);return await me(t),r}catch(e){try{await t.run(k.raw(`ROLLBACK`))}catch(t){throw!n&&R(t)?e:(E=AggregateError([e,t],`Transaction rollback failed`),E)}throw e}})}catch(e){if(!L(e)||t===100)throw e;await z()}})),j=async(e,t)=>(await e.all(k`SELECT * FROM test_execution_attempt WHERE execution_attempt_id = ${t}`))[0],F=async(e,t)=>(await e.all(k`SELECT * FROM test_provider_operation WHERE execution_attempt_id = ${t}`))[0],I=async(e,t)=>(await F(e,t))?.obligation===`terminal-convergence`,B=async(e,t)=>(await e.all(k`SELECT execution_attempt_id FROM test_active_execution_attempt WHERE execution_id = ${t}`))[0]?.execution_attempt_id??null,q=async(e,t)=>{let r=t.settlement_kind!==null,i=!r&&await B(e,t.execution_id)===t.execution_attempt_id;return n({matchesExecution:!0,settled:r,active:i,allocated:i&&t.allocation_ref!==null&&!await I(e,t.execution_attempt_id)})},J=async(e,t)=>{let n=await j(e,t.executionAttemptId),r=await F(e,t.executionAttemptId);if(n===void 0||r===void 0)return{kind:`not-found`};let i=N(n);return g(i,P(r))?{kind:`resolved`,attempt:i}: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}},Y=async(e,t)=>{let n=await J(e,t);return n.kind===`authorized`?void 0:{kind:n.kind}},X=async(e,t,n,r)=>{let i=await e.run(k`UPDATE test_execution_attempt
|
|
57
65
|
SET status = ${`settled`}, settlement_kind = ${n}, claimable = ${0},
|
|
58
66
|
operation_start_gate = ${`closed`}
|
|
59
67
|
WHERE execution_attempt_id = ${t}
|
|
60
68
|
AND settlement_kind IS NULL
|
|
61
|
-
AND ${r}`);return a.rowsAffected===0
|
|
62
|
-
SET
|
|
63
|
-
WHERE execution_attempt_id = ${t}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
69
|
+
AND ${r}`);return i.rowsAffected,i},Z=async(e,t,n,r,i,a)=>{if(!a){let a=await X(e,t,`abandoned`,r);if(a.rowsAffected===0)return a;if((await e.run(k`UPDATE test_provider_operation
|
|
70
|
+
SET completion_evidence = ${JSON.stringify(i)}
|
|
71
|
+
WHERE execution_attempt_id = ${t}
|
|
72
|
+
AND ${H(n)}
|
|
73
|
+
AND completion_evidence IS NULL`)).rowsAffected===0&&(await F(e,t))?.completion_evidence===null)throw Error(`Pre-allocation settlement succeeded without provider completion evidence`);return a}return e.run(k`UPDATE test_provider_operation
|
|
74
|
+
SET completion_evidence = ${JSON.stringify(i)}
|
|
75
|
+
WHERE execution_attempt_id = ${t}
|
|
76
|
+
AND ${H(n)}
|
|
77
|
+
AND completion_evidence IS NULL`)},Q=(e,t)=>{let n=x(e.allocationRef),r=t?k`CASE WHEN settlement_kind IS NULL AND ${K()} THEN 1 ELSE 0 END`:k`${0}`;return D(t=>V(async()=>{let i=await J(t,e.claim);if(i.kind!==`not-found`&&se(i.attempt,n),i.kind===`resolved`)return{kind:`resolved`,allocationRef:i.attempt.allocationRef};if(i.kind!==`authorized`)return{kind:i.kind};let{attempt:a}=i;return a.allocationRef===null?async()=>{let i=await t.run(k`UPDATE test_execution_attempt
|
|
78
|
+
SET status = CASE WHEN settlement_kind IS NULL THEN ${`allocated`} ELSE status END,
|
|
67
79
|
allocation_ref = ${JSON.stringify(n)},
|
|
68
80
|
claimable = ${r}
|
|
69
81
|
WHERE execution_attempt_id = ${a.executionAttemptId}
|
|
70
82
|
AND allocation_ref IS NULL
|
|
71
|
-
AND ${
|
|
72
|
-
WHERE execution_attempt_id = ${a.executionAttemptId}`),i}:s(a.allocationRef,n)?{kind:`duplicate`,allocationRef:a.allocationRef}:{kind:`conflict`,allocationRef:a.allocationRef}},{kind:`recorded`}))},
|
|
83
|
+
AND ${W(e.claim)}`);return i.rowsAffected===0||await t.run(k`UPDATE test_provider_operation SET obligation = ${`allocation-control`}
|
|
84
|
+
WHERE execution_attempt_id = ${a.executionAttemptId}`),i}:s(a.allocationRef,n)?{kind:`duplicate`,allocationRef:a.allocationRef}:{kind:`conflict`,allocationRef:a.allocationRef}},{kind:`recorded`}))},ve={async getAttemptWithAllocation(e){return D(async t=>{let n=await j(t,e);return n===void 0?null:N(n)})},async recordDiscoveredAllocation(e){return Q(e,!1)},async evolveAllocationRef(e){let{currentRef:t,nextRef:n}=oe(e);return D(r=>V(async()=>{let i=await J(r,e.claim);if(i.kind===`stale`)return{kind:`stale`,storedRef:i.attempt.allocationRef};if(i.kind!==`authorized`)return{kind:i.kind};let{attempt:a,attemptRow:o}=i;return a.executionId===e.executionId?a.allocationRef===null?{kind:`not-allocated`}:s(a.allocationRef,t)?()=>r.run(k`UPDATE test_execution_attempt SET allocation_ref = ${JSON.stringify(n)}
|
|
73
85
|
WHERE execution_attempt_id = ${a.executionAttemptId}
|
|
74
86
|
AND execution_id = ${e.executionId}
|
|
75
87
|
AND allocation_ref = ${o.allocation_ref}
|
|
76
|
-
AND ${
|
|
88
|
+
AND ${W(e.claim)}`):{kind:`stale`,storedRef:a.allocationRef}:{kind:`not-found`}},{kind:`evolved`}))},async getRecoverableAttempts(e){return D(async t=>{let n=new Date().toISOString();return(await t.all(k`SELECT * FROM test_execution_attempt
|
|
77
89
|
WHERE execution_id = ${e}
|
|
78
90
|
AND status = ${`allocated`}
|
|
79
91
|
AND settlement_kind IS NULL
|
|
80
92
|
AND allocation_ref IS NOT NULL
|
|
81
93
|
AND claimable = ${1}
|
|
82
94
|
AND (claim_expires_at IS NULL OR claim_expires_at >= ${n})
|
|
83
|
-
ORDER BY created_at ASC, execution_attempt_id ASC`)).map(e=>
|
|
95
|
+
ORDER BY created_at ASC, execution_attempt_id ASC`)).map(e=>le(N(e)))})},async listOpenProviderOperations(e){let t=_(e.observedAt);if(!Number.isSafeInteger(e.limit)||e.limit<=0)throw RangeError(`Provider-operation recovery limit must be a positive safe integer`);return D(async n=>(await n.all(k`SELECT attempt.*, operation.generation, operation.owner_id, operation.token, operation.lease_expires_at,
|
|
96
|
+
operation.obligation, operation.failure_count, operation.last_failure, operation.completion_evidence
|
|
97
|
+
FROM test_execution_attempt AS attempt
|
|
98
|
+
INNER JOIN test_provider_operation AS operation
|
|
99
|
+
ON operation.execution_attempt_id = attempt.execution_attempt_id
|
|
100
|
+
WHERE (operation.completion_evidence IS NULL OR attempt.settlement_kind IS NULL)
|
|
101
|
+
AND (
|
|
102
|
+
operation.owner_id IS NULL
|
|
103
|
+
OR operation.lease_expires_at IS NULL
|
|
104
|
+
OR operation.lease_expires_at <= ${t}
|
|
105
|
+
)
|
|
106
|
+
ORDER BY attempt.created_at ASC, attempt.execution_attempt_id ASC
|
|
107
|
+
LIMIT ${e.limit}`)).map(e=>({attempt:N(e),operation:P(e)})))}},$=async(e,t,n)=>{let{instruction:r}=t,{createdAt:i,bootstrapDeadlineAt:a}=n;try{await e.run(k`INSERT INTO test_execution_attempt
|
|
84
108
|
(execution_attempt_id, execution_id, instruction, status, claimable, created_at, bootstrap_deadline_at)
|
|
85
|
-
VALUES (${t.executionAttemptId}, ${t.executionId}, ${JSON.stringify(r)}, ${`pending`}, ${0}, ${i}, ${a})`)}catch(e){throw
|
|
109
|
+
VALUES (${t.executionAttemptId}, ${t.executionId}, ${JSON.stringify(r)}, ${`pending`}, ${0}, ${i}, ${a})`)}catch(e){throw fe(e)?new ee(t.executionAttemptId,{cause:e}):e}return await e.run(k`UPDATE test_execution_attempt
|
|
86
110
|
SET claimable = ${0}
|
|
87
111
|
WHERE execution_attempt_id = (
|
|
88
112
|
SELECT execution_attempt_id
|
|
@@ -98,9 +122,9 @@ import{_ as e,c as t,d as n,f as r,g as i,h as a,i as o,l as s,m as c,n as ee,o
|
|
|
98
122
|
)`),await e.run(k`INSERT INTO test_active_execution_attempt (execution_id, execution_attempt_id)
|
|
99
123
|
VALUES (${t.executionId}, ${t.executionAttemptId})
|
|
100
124
|
ON CONFLICT(execution_id)
|
|
101
|
-
DO UPDATE SET execution_attempt_id = excluded.execution_attempt_id`),{...
|
|
102
|
-
WHERE execution_id = ${t.executionId} AND request_key = ${t.requestKey}`))[0];if(n!==void 0){let r=await
|
|
103
|
-
VALUES (${t.executionId}, ${t.requestKey}, ${r.executionAttemptId})`),{kind:`created`,attempt:structuredClone(r)}})},async readAttemptSettlement(e){let t=
|
|
125
|
+
DO UPDATE SET execution_attempt_id = excluded.execution_attempt_id`),{...ue,executionAttemptId:t.executionAttemptId,executionId:t.executionId,instruction:r,preparationReceipts:Object.freeze([]),status:`pending`,allocationRef:null,createdAt:i,bootstrapDeadlineAt:a,providerId:null,allocationLifetime:null,provisionerIncarnationId:null,settlementKind:null,claimable:!1,claimExpiresAt:null}};return{async createAttempt(e){let t={...e,instruction:m(e.instruction)},n=b(e.bootstrapTimeoutMs);return D(e=>$(e,t,n))},async ensureAttempt(e){let t=re(e);return D(async e=>{let n=(await e.all(k`SELECT execution_attempt_id FROM test_execution_attempt_request
|
|
126
|
+
WHERE execution_id = ${t.executionId} AND request_key = ${t.requestKey}`))[0];if(n!==void 0){let r=await j(e,n.execution_attempt_id);return ie(t,r===void 0?null:N(r))}let r=await $(e,t,b(t.bootstrapTimeoutMs));return await e.run(k`INSERT INTO test_execution_attempt_request (execution_id, request_key, execution_attempt_id)
|
|
127
|
+
VALUES (${t.executionId}, ${t.requestKey}, ${r.executionAttemptId})`),{kind:`created`,attempt:structuredClone(r)}})},async readAttemptSettlement(e){let t=ne(e);return D(async e=>{let n=await j(e,t.executionAttemptId);return n===void 0||n.execution_id!==t.executionId?{kind:`not-found`}:ae(t,{attempt:N(n),activeAttemptId:await B(e,t.executionId),outcomeText:n.workflow_result},u)})},async readBootstrapStartState(e){return D(async t=>{let n=await j(t,e.executionAttemptId);return n===void 0||n.execution_id!==e.executionId?null:{settled:n.settlement_kind!==null,active:await B(t,e.executionId)===e.executionAttemptId,allocated:n.allocation_ref!==null,allocationTerminated:await I(t,e.executionAttemptId),operationStartGate:A(f,n.operation_start_gate,`operation_start_gate`),bootstrapDeadlineAt:n.bootstrap_deadline_at}})},async beginProvisioning(e){let t=ce(e.allocationLifetime),n={executionAttemptId:e.executionAttemptId,generation:1,ownerId:e.ownerId,token:crypto.randomUUID(),leaseExpiresAt:_(e.leaseExpiresAt)};return D(r=>V(async()=>{let i=await j(r,e.executionAttemptId);if(i===void 0||i.execution_id!==e.executionId)return{kind:`not-found`};let a=N(i);return await B(r,e.executionId)===e.executionAttemptId?a.settlementKind==null?a.allocationRef===null?a.status===`pending`?async()=>{let i=await r.run(k`UPDATE test_execution_attempt
|
|
104
128
|
SET status = ${`provisioning`},
|
|
105
129
|
provider_id = ${e.providerId},
|
|
106
130
|
allocation_lifetime = ${t},
|
|
@@ -110,42 +134,46 @@ import{_ as e,c as t,d as n,f as r,g as i,h as a,i as o,l as s,m as c,n as ee,o
|
|
|
110
134
|
AND status = ${`pending`}
|
|
111
135
|
AND allocation_ref IS NULL
|
|
112
136
|
AND settlement_kind IS NULL
|
|
113
|
-
AND ${
|
|
137
|
+
AND ${K()}`);return i.rowsAffected===0||await r.run(k`INSERT INTO test_provider_operation
|
|
114
138
|
(execution_attempt_id, generation, owner_id, token, lease_expires_at, obligation, failure_count)
|
|
115
139
|
VALUES (${e.executionAttemptId}, ${n.generation}, ${n.ownerId}, ${n.token},
|
|
116
|
-
${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 D(async t=>{let n=await F(t,e);return n===void 0?null:
|
|
140
|
+
${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 D(async t=>{let n=await F(t,e);return n===void 0?null:P(n)})},async renewProviderOperationClaim(e){let t=_(e.leaseExpiresAt);return D(n=>V(async()=>await Y(n,e.claim)??(()=>n.run(k`UPDATE test_provider_operation SET lease_expires_at = ${t}
|
|
117
141
|
WHERE execution_attempt_id = ${e.claim.executionAttemptId}
|
|
118
|
-
AND ${
|
|
119
|
-
SET generation = ${
|
|
120
|
-
lease_expires_at = ${
|
|
142
|
+
AND ${W(e.claim)}`)),{kind:`claimed`,claim:{...e.claim,leaseExpiresAt:t}}))},async takeOverProviderOperation(e){return D(async t=>{let n=await j(t,e.executionAttemptId),r=await F(t,e.executionAttemptId);if(n===void 0||r===void 0)return{kind:`not-found`};if(g(N(n),P(r)))return{kind:`resolved`};let i=_(e.observedAt);if(r.owner_id!==null&&r.lease_expires_at!==null&&v(r.lease_expires_at)>v(i))return{kind:`stale`};let a={executionAttemptId:e.executionAttemptId,generation:r.generation+1,ownerId:e.ownerId,token:crypto.randomUUID(),leaseExpiresAt:_(e.leaseExpiresAt)},{rowsAffected:o}=await t.run(k`UPDATE test_provider_operation
|
|
143
|
+
SET generation = ${a.generation}, owner_id = ${a.ownerId}, token = ${a.token},
|
|
144
|
+
lease_expires_at = ${a.leaseExpiresAt}
|
|
121
145
|
WHERE execution_attempt_id = ${e.executionAttemptId}
|
|
122
146
|
AND generation = ${r.generation}
|
|
123
|
-
AND ${
|
|
147
|
+
AND ${U(e.executionAttemptId)}`);if(o===0){let n=await j(t,e.executionAttemptId),r=await F(t,e.executionAttemptId);return n!==void 0&&r!==void 0&&g(N(n),P(r))?{kind:`resolved`}:{kind:`stale`}}return{kind:`claimed`,claim:a}})},async handoffProviderOperation(e){let t=e.evidence===void 0?null:C.parse(e.evidence);return D(n=>V(async()=>await Y(n,e.claim)??(()=>n.run(t===null?k`UPDATE test_provider_operation
|
|
124
148
|
SET owner_id = NULL, token = NULL, lease_expires_at = NULL
|
|
125
149
|
WHERE execution_attempt_id = ${e.claim.executionAttemptId}
|
|
126
|
-
AND ${
|
|
150
|
+
AND ${W(e.claim)}`:k`UPDATE test_provider_operation
|
|
127
151
|
SET owner_id = NULL, token = NULL, lease_expires_at = NULL,
|
|
128
152
|
last_failure = ${JSON.stringify(t)}
|
|
129
153
|
WHERE execution_attempt_id = ${e.claim.executionAttemptId}
|
|
130
|
-
AND ${
|
|
154
|
+
AND ${W(e.claim)}`)),{kind:`recorded`}))},async recordProviderOperationUncertainty(e){let t=C.parse(e.evidence);return D(n=>V(async()=>await Y(n,e.claim)??(()=>n.run(k`UPDATE test_provider_operation
|
|
131
155
|
SET failure_count = failure_count + 1, last_failure = ${JSON.stringify(t)}
|
|
132
156
|
WHERE execution_attempt_id = ${e.claim.executionAttemptId}
|
|
133
|
-
AND ${
|
|
157
|
+
AND ${W(e.claim)}`)),{kind:`recorded`}))},async completeProviderOperation(e){let t=C.parse(e.evidence);return D(async n=>{let r=await j(n,e.claim.executionAttemptId),i=await F(n,e.claim.executionAttemptId);if(r===void 0||i===void 0)return{kind:`not-found`};if(!(i.generation===e.claim.generation&&i.owner_id===e.claim.ownerId&&i.token===e.claim.token))return{kind:`stale`};if(g(N(r),P(i)))return{kind:`already-completed`};if(i.completion_evidence!==null)return{kind:`evidence-recorded`};if((await n.run(k`UPDATE test_provider_operation
|
|
158
|
+
SET completion_evidence = ${JSON.stringify(t)}
|
|
159
|
+
WHERE execution_attempt_id = ${e.claim.executionAttemptId}
|
|
160
|
+
AND ${H(e.claim)}
|
|
161
|
+
AND completion_evidence IS NULL`)).rowsAffected>0){let t=await j(n,e.claim.executionAttemptId);return t===void 0?{kind:`not-found`}:t.settlement_kind===null?{kind:`evidence-recorded`}:{kind:`completed`}}let a=await j(n,e.claim.executionAttemptId),o=await F(n,e.claim.executionAttemptId);return a===void 0||o===void 0?{kind:`not-found`}:o.generation===e.claim.generation&&o.owner_id===e.claim.ownerId&&o.token===e.claim.token?g(N(a),P(o))?{kind:`already-completed`}:o.completion_evidence===null?{kind:`stale`}:{kind:`evidence-recorded`}:{kind:`stale`}})},async recordAllocation(e){return Q(e,!0)},async recordProvisioningAbsent(e){let t=C.parse(e.evidence),n=!1;return D(r=>V(async()=>{let i=await J(r,e.claim);if(i.kind!==`authorized`)return{kind:i.kind};let{attempt:a}=i;return a.executionId===e.executionId?a.allocationRef===null?(n=a.settlementKind!==null,()=>Z(r,a.executionAttemptId,e.claim,k`execution_id = ${e.executionId}
|
|
134
162
|
AND allocation_ref IS NULL
|
|
135
|
-
AND ${
|
|
163
|
+
AND ${H(e.claim)}`,t,n)):{kind:`allocated`,allocationRef:a.allocationRef}:{kind:`not-found`}},()=>n?{kind:`completed`}:{kind:`recorded`}))},async recordProvisionerIncarnationLost(e){let t=C.parse(e.proof.evidence),n=!1;return D(r=>V(async()=>{let i=await J(r,e.claim);if(i.kind!==`authorized`)return{kind:i.kind};let{attempt:o}=i,s=a(o,e);return s===null?(n=o.settlementKind!==null,()=>Z(r,o.executionAttemptId,e.claim,k`execution_id = ${e.executionId}
|
|
136
164
|
AND allocation_ref IS NULL
|
|
137
165
|
AND allocation_lifetime = ${`provisioner-process-bound`}
|
|
138
166
|
AND provisioner_incarnation_id = ${e.proof.provisionerIncarnationId}
|
|
139
|
-
AND ${
|
|
167
|
+
AND ${H(e.claim)}`,t,n)):s},()=>n?{kind:`completed`}:{kind:`recorded`}))},async recordAllocationTerminated(e){let t=C.parse(e.evidence);return D(n=>V(async()=>{let r=await J(n,e.claim);if(r.kind!==`authorized`)return{kind:r.kind};let{attempt:i}=r;return i.allocationRef===null?{kind:`not-allocated`}:()=>n.run(k`UPDATE test_provider_operation
|
|
140
168
|
SET obligation = ${`terminal-convergence`}, last_failure = ${JSON.stringify(t)}
|
|
141
169
|
WHERE execution_attempt_id = ${i.executionAttemptId}
|
|
142
|
-
AND ${
|
|
170
|
+
AND ${W(e.claim)}
|
|
143
171
|
AND EXISTS (SELECT 1 FROM test_execution_attempt
|
|
144
172
|
WHERE execution_attempt_id = ${i.executionAttemptId}
|
|
145
|
-
AND allocation_ref IS NOT NULL)`)},{kind:`recorded`}))},async recordInfrastructureFailure(e){return D(t=>
|
|
173
|
+
AND allocation_ref IS NOT NULL)`)},{kind:`recorded`}))},async recordInfrastructureFailure(e){return D(t=>V(async()=>{let n=await J(t,e.claim);if(n.kind!==`authorized`)return{kind:n.kind};let{attempt:r,operation:i}=n;return r.executionId===e.executionId?r.settlementKind===null?r.allocationRef===null?{kind:`not-allocated`}:A(h,i.obligation,`obligation`)===`terminal-convergence`?()=>X(t,r.executionAttemptId,`infrastructure-failure`,k`execution_id = ${e.executionId}
|
|
146
174
|
AND allocation_ref IS NOT NULL
|
|
147
|
-
AND ${
|
|
148
|
-
AND ${
|
|
175
|
+
AND ${G(r.executionAttemptId)}
|
|
176
|
+
AND ${H(e.claim)}`):{kind:`not-terminated`}:{kind:`resolved`}:{kind:`not-found`}},{kind:`recorded`}))},async registerRuntime(t){return D(async n=>{let r=0,i=await V(async()=>{let i=await j(n,t.executionAttemptId);if(i===void 0||i.execution_id!==t.executionId)return{kind:`not-found`};let a=await q(n,i);if(a!==null)return a;let o=M(i),s=e(o,t);return s===null?(r=o.runtimeGeneration+1,()=>n.run(k`UPDATE test_execution_attempt
|
|
149
177
|
SET runtime_generation = ${r},
|
|
150
178
|
runtime_incarnation_id = ${t.runtimeIncarnationId},
|
|
151
179
|
runtime_ready_at = NULL,
|
|
@@ -160,8 +188,8 @@ import{_ as e,c as t,d as n,f as r,g as i,h as a,i as o,l as s,m as c,n as ee,o
|
|
|
160
188
|
AND settlement_kind IS NULL
|
|
161
189
|
AND (active_operation_id IS NULL OR active_operation_kind = ${`runtime-probe`})
|
|
162
190
|
AND allocation_ref IS NOT NULL
|
|
163
|
-
AND NOT ${
|
|
164
|
-
AND ${
|
|
191
|
+
AND NOT ${G(t.executionAttemptId)}
|
|
192
|
+
AND ${K()}`)):s},{kind:`applied`});return i.kind===`applied`?{kind:`registered`,runtimeGeneration:r}:i})},async admitOperation(e){let t=crypto.randomUUID(),n=_(new Date().toISOString()),i=e.operationKind===`runtime-probe`?k`1 = 1`:k`runtime_ready_at IS NOT NULL`;return D(a=>V(async()=>{let o=await j(a,e.executionAttemptId);if(o===void 0||o.execution_id!==e.executionId)return{kind:`not-found`};let s=await q(a,o);if(s!==null)return s;let c=r(M(o),e,n,N(o));return c===null?()=>a.run(k`UPDATE test_execution_attempt
|
|
165
193
|
SET active_operation_id = ${t},
|
|
166
194
|
active_operation_kind = ${e.operationKind},
|
|
167
195
|
active_operation_key = ${e.admissionKey},
|
|
@@ -176,9 +204,9 @@ import{_ as e,c as t,d as n,f as r,g as i,h as a,i as o,l as s,m as c,n as ee,o
|
|
|
176
204
|
AND preparation_receipts = ${o.preparation_receipts}
|
|
177
205
|
AND settlement_kind IS NULL
|
|
178
206
|
AND allocation_ref IS NOT NULL
|
|
179
|
-
AND NOT ${
|
|
207
|
+
AND NOT ${G(e.executionAttemptId)}
|
|
180
208
|
AND ${i}
|
|
181
|
-
AND ${
|
|
209
|
+
AND ${K()}`):c},{kind:`admitted`,operationId:t,runtimeGeneration:e.runtimeGeneration,admittedAt:n}))},async getInstruction(e){return D(async t=>{let n=await j(t,e.executionAttemptId);return n?.execution_id===e.executionId?m(JSON.parse(n.instruction)):null})},async reportOperation(e){let t=S(e.result);return D(n=>V(async()=>{let r=await j(n,e.executionAttemptId);if(r===void 0||r.execution_id!==e.executionId)return{kind:`not-found`};let i=N(r),a=c({matchesExecution:!0,settled:r.settlement_kind!==null,active:await B(n,e.executionId)===e.executionAttemptId,allocated:r.allocation_ref!==null&&!await I(n,e.executionAttemptId)},i,i,{...e,result:t});if(a!==null)return a;let o=y([...i.preparationReceipts,{operationId:e.operationId,runtimeGeneration:e.runtimeGeneration,result:t}]);return()=>n.run(k`UPDATE test_execution_attempt
|
|
182
210
|
SET preparation_receipts = ${JSON.stringify(o)},
|
|
183
211
|
active_operation_id = NULL,
|
|
184
212
|
active_operation_kind = NULL,
|
|
@@ -196,8 +224,8 @@ import{_ as e,c as t,d as n,f as r,g as i,h as a,i as o,l as s,m as c,n as ee,o
|
|
|
196
224
|
AND instruction = ${r.instruction}
|
|
197
225
|
AND preparation_receipts = ${r.preparation_receipts}
|
|
198
226
|
AND allocation_ref IS NOT NULL
|
|
199
|
-
AND NOT ${
|
|
200
|
-
AND ${
|
|
227
|
+
AND NOT ${G(e.executionAttemptId)}
|
|
228
|
+
AND ${K()}`)},{kind:`accepted`,binding:t.binding}))},async completeOperation(e){return D(t=>V(async()=>{let n=await j(t,e.executionAttemptId);if(n===void 0)return{kind:`not-found`};if(n.settlement_kind!==null)return{kind:`resolved`};let r=l(M(n),e);return r===null?()=>t.run(k`UPDATE test_execution_attempt
|
|
201
229
|
SET active_operation_id = NULL,
|
|
202
230
|
active_operation_kind = NULL,
|
|
203
231
|
active_operation_key = NULL,
|
|
@@ -208,7 +236,7 @@ import{_ as e,c as t,d as n,f as r,g as i,h as a,i as o,l as s,m as c,n as ee,o
|
|
|
208
236
|
AND settlement_kind IS NULL
|
|
209
237
|
AND active_operation_id = ${e.operationId}
|
|
210
238
|
AND active_operation_kind IN (${`runtime-probe`}, ${`workflow-run`})
|
|
211
|
-
AND active_operation_generation = ${e.runtimeGeneration}`):r},{kind:`completed`}))},async markRuntimeReady(e){let t=
|
|
239
|
+
AND active_operation_generation = ${e.runtimeGeneration}`):r},{kind:`completed`}))},async markRuntimeReady(e){let t=_(e.readyAt);return D(n=>V(async()=>{let r=await j(n,e.executionAttemptId);if(r===void 0||r.execution_id!==e.executionId)return{kind:`not-found`};let a=await q(n,r);if(a!==null)return a;let o=i(M(r),e);return o===null?()=>n.run(k`UPDATE test_execution_attempt SET runtime_ready_at = ${t}
|
|
212
240
|
WHERE execution_attempt_id = ${e.executionAttemptId}
|
|
213
241
|
AND execution_id = ${e.executionId}
|
|
214
242
|
AND settlement_kind IS NULL
|
|
@@ -216,20 +244,20 @@ import{_ as e,c as t,d as n,f as r,g as i,h as a,i as o,l as s,m as c,n as ee,o
|
|
|
216
244
|
AND runtime_ready_at IS NULL
|
|
217
245
|
AND active_operation_id IS NULL
|
|
218
246
|
AND allocation_ref IS NOT NULL
|
|
219
|
-
AND NOT ${
|
|
220
|
-
AND ${
|
|
247
|
+
AND NOT ${G(e.executionAttemptId)}
|
|
248
|
+
AND ${K()}`):o},{kind:`ready`,acceptedAt:t}))},async getAttemptControlState(e){return D(async t=>{let n=await j(t,e);return n===void 0?null:M(n)})},async getActiveAttempt(e,t){return D(async n=>{if(await B(n,e)!==t)return null;let r=await j(n,t);return r===void 0?null:N(r)})},canonicalizeOutcome(e){return t(u,e)},decodeOutcome(e){return d(u,e)},async commitOutcome(e){let t=e.result,n=e.runtimeFence,r=n===void 0?k`1 = 1`:k`
|
|
221
249
|
runtime_generation = ${n.runtimeGeneration}
|
|
222
250
|
AND ${n.operationId===null?k`active_operation_id IS NULL`:k`active_operation_id = ${n.operationId}
|
|
223
|
-
AND active_operation_generation = ${n.runtimeGeneration}`}`;return D(i=>
|
|
251
|
+
AND active_operation_generation = ${n.runtimeGeneration}`}`;return D(i=>V(async()=>{if(await B(i,e.executionId)!==e.executionAttemptId)return{kind:`fenced`};let a=await j(i,e.executionAttemptId);if(a===void 0)return{kind:`fenced`};let o=a.workflow_result;if(o!==null){let e=d(u,o);return p(o,t.text)?{kind:`duplicate`,outcome:e,text:o}:{kind:`conflict`}}return a.settlement_kind===null?(n!==void 0&&te(M(a),n),async()=>{let n=await i.run(k`UPDATE test_execution_attempt SET workflow_result = ${t.text}
|
|
224
252
|
WHERE execution_attempt_id = ${e.executionAttemptId}
|
|
225
253
|
AND workflow_result IS NULL
|
|
226
254
|
AND settlement_kind IS NULL
|
|
227
255
|
AND ${r}
|
|
228
|
-
AND ${
|
|
256
|
+
AND ${K()}`);return n.rowsAffected===0?n:X(i,e.executionAttemptId,`outcome`,k`workflow_result IS NOT NULL`)}):{kind:`conflict`}},{kind:`accepted`,outcome:d(u,t.text),text:t.text}))},async abandonPendingAttempt(e,t){return D(n=>V(async()=>{if(await B(n,t)!==e)return{kind:`fenced`};let r=await j(n,e);if(r===void 0)return{kind:`fenced`};let i=N(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(k`UPDATE test_execution_attempt
|
|
229
257
|
SET status = ${`settled`}, settlement_kind = ${`abandoned`}, claimable = ${0},
|
|
230
258
|
operation_start_gate = ${`closed`}
|
|
231
259
|
WHERE execution_attempt_id = ${e}
|
|
232
260
|
AND execution_id = ${t}
|
|
233
261
|
AND status = ${`pending`}
|
|
234
262
|
AND settlement_kind IS NULL
|
|
235
|
-
AND ${
|
|
263
|
+
AND ${K()}`)},{kind:`abandoned`}))},recovery:ve}}export{q as createSqliteAttemptRepository};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{H as e,L as t,c as n,d as r,i,k as a,l as o,r as s,s as c,t as l,vt as u}from"../authority-state-bootstrap-
|
|
1
|
+
import{H as e,L as t,c as n,d as r,i,k as a,l as o,r as s,s as c,t as l,vt as u}from"../authority-state-bootstrap-8VGt4vD2.mjs";import{WORKFLOW_CANCELLED_REASON as d,WorkflowRunContextSchema as f}from"@makaio/framework/contracts";import*as p from"node:os";async function m(t,n,r,i){let a=await y(t,n,r);return await t.request(e.setExecution,{execution:a}),r===`completed`?await t.emit(u.execution.completed,{executionId:n.executionId,workflowId:n.workflowId,totalDuration:0,completedAt:a.completedAt}):await t.emit(u.execution.cancelled,{executionId:n.executionId,workflowId:n.workflowId,reason:i,completedAt:a.completedAt}),r===`cancelled`?{executionId:n.executionId,workflowId:n.workflowId,status:`cancelled`,...i===void 0?{}:{reason:i}}:{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(e){let n,r=()=>{n=a({bus:e.bus,activeExecutions:e.activeExecutions,shellAbortControllers:e.shellAbortControllers,activeRunnerSteps:e.activeRunnerSteps,durableLifecycleTransitions:e.durableLifecycleTransitions,lifecyclePublications:e.lifecyclePublications,publishingLifecycleExecutions:e.publishingLifecycleExecutions,cancelTimeoutMs:t.cancelTimeoutMs},e.executionId,d).catch(t=>(console.error(`[WorkflowOrchestrator] Failed to persist cancellation for ${e.executionId}:`,t),!1))};return e.signal.addEventListener(`abort`,r,{once:!0}),e.signal.aborted&&r(),async()=>(e.signal.removeEventListener(`abort`,r),n??!1)}async function _(t,n){let r=await t.requestOptional(e.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,a,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:a,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 i(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(t,n,r={}){try{let i=await n.requestOptional(e.listFrames,{executionId:t});if(!i.handled){if(r.required===!0)throw Error(`Frame storage handler is required to resume execution '${t}'.`);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(t,n,r,i,a){r.status=`paused`,await t.request(e.setExecution,{execution:r}),await t.emit(u.execution.paused,{executionId:n.executionId,workflowId:n.workflowId,pausedAtGateId:i,pausedAtFrameId:a})}async function w(e,t,n,r,i,a){n===`completed`?await e.emit(u.execution.completed,{executionId:t.executionId,workflowId:t.workflowId,totalDuration:i-r.startedAt,completedAt:i}):n===`cancelled`?await e.emit(u.execution.cancelled,{executionId:t.executionId,workflowId:t.workflowId,reason:d,completedAt:i}):await e.emit(u.execution.failed,{executionId:t.executionId,workflowId:t.workflowId,error:a??`Workflow execution failed`,completedAt:i})}async function T(t){let{config:n,loaded:i,bus:a,signal:o}=t,{definition:c}=i;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 r(a,u,f,c);let p=new Map(i.runtimeHandlers),_=i.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,i.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(e.setExecution,{execution:u}),await w(a,n,A.status,u,M,N),h(n,A)}export{T as runWorkflowOrchestrator};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,i as t,n,o as r}from"./json-value-DM-EjTC1.mjs";import{c as i}from"./kind-registration-T--B1wiI.mjs";import{a,f as o,p as s}from"./schemas-0eCrrru1.mjs";import{t as c}from"./zod-json-schema-B9TYYq3e.mjs";import"./artifact-BjqkK0KX.mjs";import{a as l}from"./visibility-C5sLzqyS.mjs";import"./model-B6t_-_sp.mjs";import{t as u}from"./provider-context-CSb0qX1c.mjs";import{a as d,o as f}from"./schemas-BUK9I-Oz.mjs";import{A as ee,M as te,O as ne,k as p}from"./worker-qgJToDTN.mjs";import{r as re}from"./schemas-CbhvgFQs.mjs";import{z as m}from"zod";import{createBusNamespace as h,getFullSubjectForSubjectDefinition as ie,observability as g,splitSubjectKey as ae}from"@makaio/framework/core";const _=m.object({kind:m.string().min(1),id:m.string().min(1)});function oe(e){return`${ce(e.kind)}:${ce(e.id)}`}function se(e){let t=le(e);if(t<1)throw Error(`Invalid artifact ref key: ${e}`);let n=ue(e.slice(t+1));if(n.length===0)throw Error(`Invalid artifact ref key (empty id): ${e}`);return{kind:ue(e.slice(0,t)),id:n}}function ce(e){return e.replace(/\\/g,`\\\\`).replace(/:/g,`\\:`)}function le(e){let t=!1;for(let n=0;n<e.length;n++){let r=e[n];if(t){t=!1;continue}if(r===`\\`){t=!0;continue}if(r===`:`)return n}return-1}function ue(e){let t=``,n=!1;for(let r of e){if(n){if(r!==`\\`&&r!==`:`)throw Error(`Invalid artifact ref key component: ${e}`);t+=r,n=!1;continue}if(r===`\\`){n=!0;continue}t+=r}if(n)throw Error(`Invalid artifact ref key component: ${e}`);return t}const de=m.enum([`completed`,`failed`,`cancelled`]),fe=m.object({status:de,completedAt:m.number().int().nonnegative(),error:m.string().min(1).optional(),reason:m.string().min(1).optional()}).strict(),pe=m.object({executionId:m.string().min(1),workflowId:m.string().min(1),finalizerId:m.string().min(1),transitionKey:m.string().min(1),claimToken:m.string().min(1),intent:fe,claimedAt:m.number().int().nonnegative()}).strict(),me=m.object({accepted:m.boolean()}).strict(),he=/^[a-z0-9]+(?:[._-][a-z0-9]+)*$/,v=m.string().regex(he,`Workflow finalizer IDs must be lowercase dot, dash, or underscore separated names.`),y=m.string().regex(he,`Workflow delegate result finalizer IDs must be lowercase dot, dash, or underscore separated names.`),ge=m.object({toolName:m.string().min(1),outcome:m.enum([`success`,`failure`]).optional(),artifact:m.object({kind:m.string().min(1),id:m.string().min(1),revision:m.string().min(1)}).strict().optional()}).strict().superRefine((e,t)=>{e.artifact!==void 0&&e.outcome!==`success`&&t.addIssue({code:`custom`,path:[`artifact`],message:`requires an explicit successful outcome`})}),_e=m.object({durationMs:m.number().int().nonnegative(),inputTokens:m.number().int().nonnegative().optional(),outputTokens:m.number().int().nonnegative().optional(),cachedInputTokens:m.number().int().nonnegative().optional(),toolCallCount:m.number().int().nonnegative().optional(),binding:m.object({adapterName:m.string().min(1),providerConfigId:m.string().min(1).optional(),providerDefinitionId:m.string().min(1).optional(),model:m.string().min(1).optional(),auth:m.object({mode:m.enum([`explicit`,`inferred`,`none`]),owner:m.enum([`provider`,`client`]),methodId:m.string().min(1)}).strict().optional()}).strict()}).strict(),b=m.object({executionId:m.string().min(1),workflowId:m.string().min(1),frameId:m.string().min(1),nodeId:m.string().min(1),nodeType:m.enum([`delegate-agent`,`delegate-role`]),rawResult:r,toolObservations:m.array(ge),economics:_e.optional()}).strict(),ve=b.extend({finalizerId:y}).strict(),x=m.object({output:r}).strict();function ye(e){if(!v.safeParse(e).success)throw Error(`Invalid workflow finalizer ID: "${e}"`);let t=`workflow-finalizer:${e}`,n=h(t,{finalize:{request:pe,response:me}});return{namespaceDomain:t,namespace:n,subjects:n.subjects}}function be(e){if(!y.safeParse(e).success)throw Error(`Invalid workflow delegate result finalizer ID: "${e}"`);let t=`workflow-delegate-finalizer:${e}`,n=h(t,{finalize:{request:b,response:x}});return{namespaceDomain:t,namespace:n,subjects:n.subjects}}const S=m.union([m.string(),m.number(),m.boolean(),m.null()]),xe=m.union([S,m.object({$in:m.array(S)}).strict(),m.object({$ne:S}).strict(),m.object({$exists:m.boolean()}).strict(),m.object({$startsWith:m.string()}).strict(),m.object({$endsWith:m.string()}).strict()]),Se=m.record(m.string(),xe),Ce=m.object({kind:re,params:t,filter:Se.optional(),filterExpression:m.string().optional()}),C=m.discriminatedUnion(`type`,[m.object({type:m.literal(`global`)}).strict(),m.object({type:m.literal(`workspace`),id:m.string().min(1)}).strict(),m.object({type:m.literal(`session`),id:m.string().min(1)}).strict(),m.object({type:m.literal(`external`),kind:m.string().min(1),id:m.string().min(1)}).strict()]),w=m.string().min(1),T=m.object({kind:m.string().min(1),schemaVersion:i,scope:s,resolve:m.string().min(1).optional(),create:m.string().min(1).optional(),statusPath:m.string().min(1).optional()}),we=m.object({kind:m.string().min(1),schemaVersion:i,scope:s,dataExpression:m.string().optional()}),Te=m.object({file:m.string().min(1),line:m.number().int().positive().optional(),column:m.number().int().positive().optional()}),E=m.enum([`station`,`delegate-agent`,`delegate-role`,`parallel`,`gate`,`iterate`,`iterate-chain`,`loop`,`sequence`]),Ee=m.enum([`all-settled`,`fail-fast`]),D=m.object({id:m.string().min(1),when:w.optional(),skip:w.optional(),writes:m.array(we).optional()}),O=m.lazy(()=>m.discriminatedUnion(`type`,[A,De,Oe,ke,Ae,je,Me,Pe,k])),k=D.extend({type:m.literal(`sequence`),nodes:m.lazy(()=>m.array(O))}),A=D.extend({type:m.literal(`station`),prompt:m.string().min(1),role:m.string().min(1).optional(),outputSchema:e.optional(),timeoutMs:m.number().int().positive().optional(),completion:d.optional()}),De=D.extend({type:m.literal(`delegate-agent`),agentId:m.string().min(1),inputExpression:m.string().optional(),outputSchema:e.optional(),allowedTools:m.array(m.string()).optional(),completion:d.optional(),resultFinalizerId:y.optional()}),Oe=D.extend({type:m.literal(`delegate-role`),role:m.string().min(1),prompt:m.string().min(1),outputSchema:e.optional(),allowedTools:m.array(m.string()).optional(),resultFinalizerId:y.optional(),timeoutMs:m.number().int().positive().optional(),completion:d.optional()}),ke=D.extend({type:m.literal(`parallel`),mode:Ee.optional(),branches:m.record(m.string().min(1),m.lazy(()=>k))}),Ae=D.extend({type:m.literal(`gate`),prompt:m.string().min(1),title:m.string().optional(),autoAction:m.enum([`approve`,`reject`]),timeoutMs:m.number().int().positive().nullable(),resumeSchema:e.optional()}),je=D.extend({type:m.literal(`iterate`),collection:m.string().min(1),body:m.lazy(()=>k),concurrency:m.number().int().nonnegative().optional()}),Me=D.extend({type:m.literal(`iterate-chain`),collection:m.string().min(1),body:m.lazy(()=>k)}),Ne=m.discriminatedUnion(`kind`,[m.object({kind:m.literal(`pass`)}).strict(),m.object({kind:m.literal(`loop`)}).strict(),m.object({kind:m.literal(`escalate`),reason:m.string().min(1)}).strict()]),Pe=D.extend({type:m.literal(`loop`),maxRounds:m.number().int().positive(),body:m.lazy(()=>k),gate:m.object({handler:m.string().min(1),input:m.string().min(1).optional(),config:r.optional(),escalation:m.object({title:m.string().optional(),prompt:m.string().min(1),resumeSchema:e.optional(),autoAction:m.enum([`approve`,`reject`]).default(`reject`),timeoutMs:m.number().int().positive().nullable().default(null)}).strict().optional()}).strict()}),Fe=m.object({factoryId:m.string().min(1),preview:m.array(m.lazy(()=>O)).optional(),sourceLocation:Te.optional()}),Ie=m.discriminatedUnion(`kind`,[m.object({kind:m.literal(`editor`)}).strict(),m.object({kind:m.literal(`extension`),extension:m.string().min(1),externalId:m.string().min(1).optional(),syncedAt:m.string().datetime().optional(),metadata:n.default({})}).strict()]),Le=m.object({schema:e,initial:r.optional()}),Re=m.discriminatedUnion(`kind`,[m.object({kind:m.literal(`path`),path:m.string().min(1)}).strict(),m.object({kind:m.literal(`source`),filename:m.string().min(1),source:m.string()}).strict(),m.object({kind:m.literal(`definition`),workflowId:m.string().min(1)}).strict()]),j=m.object({id:m.string().min(1),name:m.string().optional(),description:m.string().optional(),inputSchema:e.optional(),configSchema:e.optional(),outputSchema:e.optional(),state:Le.optional(),artifact:T.optional(),root:k,triggers:m.array(Ce).optional(),scope:C.default({type:`global`}),canvasLayout:m.record(m.string(),r).optional(),source:Ie.optional(),executableSource:Re.optional(),requirements:ee.optional(),successFinalizerId:v.optional()}),M=m.enum([`pending`,`running`,`paused`,`finalizing`,`completed`,`failed`,`cancelled`]),N=m.object({id:m.string(),workflowId:m.string(),coordinatorSessionId:m.string().optional(),status:M,inputs:r,config:n.optional(),startedAt:m.number(),completedAt:m.number().optional(),error:m.string().optional(),reason:m.string().optional(),triggerPayload:n.optional(),scope:C,artifactRef:_.optional()}),ze=m.object({frameId:m.string(),nodeId:m.string(),nodeType:E,path:m.array(m.string()),parentFrameId:m.string().optional(),status:m.enum([`pending`,`running`,`waiting`,`completed`,`failed`,`skipped`,`cancelled`]),attempt:m.number().int().nonnegative().default(0),iteration:m.number().int().nonnegative().optional(),branchKey:m.string().optional(),output:r.optional(),error:m.string().optional(),startedAt:m.number().optional(),completedAt:m.number().optional()}),P=m.enum([`waiting`,`resumed`,`rejected`,`timed-out`,`cancelled`]),Be=m.object({executionId:m.string(),nodeId:m.string(),frameId:m.string(),schema:e,prompt:m.string().optional(),status:P,autoAction:m.enum([`approve`,`reject`]),timeoutMs:m.number().int().positive().nullable(),resumeData:r.optional(),reason:m.string().optional(),createdAt:m.number(),resolvedAt:m.number().optional()}),F=m.object({adapterName:m.string().min(1),providerConfigId:m.string().min(1).optional(),model:m.string().optional(),reasoningEffort:l.optional(),harnessId:m.string().optional(),systemPrompt:m.string().optional(),contextMode:f.optional(),providerContext:u.optional(),adapterConfig:n.optional(),tools:m.array(m.string()).optional(),disallowedTools:m.array(m.string()).optional(),allowedDirectories:m.array(m.string()).optional(),completion:d.optional()}),Ve=F,He=m.object({scope:C.optional()}),Ue=m.object({startedAt:m.number(),id:m.string()}),We=1,Ge=500,Ke=50,qe=m.object({workflowId:m.string().min(1).optional(),scope:C.optional(),status:M.optional(),artifactRef:_.optional(),limit:m.number().int().min(1).max(500).default(50),cursor:Ue.optional()}).refine(e=>e.workflowId!==void 0||e.scope!==void 0||e.artifactRef!==void 0,{message:`Either workflowId, scope, or artifactRef is required.`}),Je=200,Ye=100,Xe=10,Ze=m.object({refs:m.array(_).min(1).max(200),limitPerRef:m.number().int().min(1).max(100).default(10)}),Qe=m.object({executionId:m.string().min(1).optional(),status:P.optional(),limit:m.number().int().min(1).max(500).default(50)}).refine(e=>e.executionId!==void 0||e.status!==void 0,{message:`Either executionId or status is required.`}),I=m.enum([`station`,`delegate-agent`,`delegate-role`,`gate`]),$e=m.enum([`station`]),et=m.object({input:m.number().int().nonnegative(),output:m.number().int().nonnegative(),cached:m.number().int().nonnegative().optional()}),tt=m.object({duration:m.number().nonnegative(),tokenUsage:et.optional(),estimatedCost:m.number().nonnegative().optional(),toolCalls:m.number().int().nonnegative().optional()}),nt=m.discriminatedUnion(`kind`,[m.object({kind:m.literal(`none`)}).strict(),m.object({kind:m.literal(`hmac`),secret:m.string().min(1)}).strict()]),rt=m.object({cwd:m.string().min(1),env:m.record(m.string(),m.string()).optional()}),it=m.object({executionId:m.string().min(1),stepId:m.string().min(1),reason:m.string().optional()});function at(e){let t=ae(e);if(t===void 0)throw Error(`Invalid step cancel subject: ${e}`);return{subject:t.subject,$meta:{namespace:t.namespace,isRequest:!1,payload:{},local:!1,channel:!1}}}const ot=m.object({executionId:m.string().min(1),reason:m.string().optional()});function st(e){let t=ae(e);if(t===void 0)throw Error(`Invalid workflow cancel subject: ${e}`);return{subject:t.subject,$meta:{namespace:t.namespace,isRequest:!1,payload:{},local:!1,channel:!1}}}const ct=m.object({stepId:m.string().min(1),executionId:m.string().min(1),workflowId:m.string().min(1),coordinatorSessionId:m.string().min(1),stepType:$e,stepDefinition:A,resolvedInputs:n,busUrl:m.string().optional(),busAuth:nt.default({kind:`none`}),platformDefaults:rt,cancelSubject:m.string().min(1)}).superRefine((e,t)=>{e.stepType!==e.stepDefinition.type&&t.addIssue({code:`custom`,path:[`stepDefinition`,`type`],message:`stepDefinition.type must match stepType (${e.stepType})`})}),lt=`Workflow cancelled`,ut=m.object({status:m.enum([`completed`,`failed`]),output:r.optional(),error:m.string().optional(),telemetry:tt}),dt=m.enum([`running`,`completed`,`failed`,`skipped`]),ft=m.object({executionId:m.string().min(1),frameId:m.string().min(1),stepId:m.string().min(1),stepType:I,status:dt,startedAt:m.number().optional(),completedAt:m.number().optional(),durationMs:m.number().nonnegative().optional(),inputTokens:m.number().int().nonnegative().optional(),outputTokens:m.number().int().nonnegative().optional(),estimatedCost:m.number().nonnegative().optional(),toolCallCount:m.number().int().nonnegative().optional(),input:m.string().optional(),output:m.string().optional()}),pt=m.enum([`triggered-by`,`feedback-loop`,`rerun-of`]),L=m.object({sourceExecutionId:m.string().min(1),targetExecutionId:m.string().min(1),linkType:pt,metadata:m.record(m.string(),m.unknown()).optional()}),mt=m.object({sourceExecutionId:m.string().min(1).optional(),targetExecutionId:m.string().min(1).optional()}).refine(e=>e.sourceExecutionId!==void 0||e.targetExecutionId!==void 0,{message:`Either sourceExecutionId or targetExecutionId is required.`}),ht={RUN_CONTEXT_NOT_FOUND:`WORKFLOW_RUN_CONTEXT_NOT_FOUND`,SNAPSHOT_UNAVAILABLE:`WORKFLOW_SNAPSHOT_UNAVAILABLE`,SOURCE_MISMATCH:`WORKFLOW_SOURCE_MISMATCH`,NOT_EXECUTABLE:`WORKFLOW_NOT_EXECUTABLE`,HANDLER_UNAVAILABLE:`WORKFLOW_HANDLER_UNAVAILABLE`};var gt=class extends Error{code;constructor(e,t){super(t),this.code=e,this.name=`WorkflowError`}};const R=m.string().refine(e=>e===``||e.startsWith(`/`),{message:`JSON Patch paths must be empty or start with "/".`}),_t=m.object({op:m.enum([`add`,`replace`,`test`]),path:R,value:r}).strict(),vt=m.object({op:m.literal(`remove`),path:R}).strict(),yt=m.object({op:m.enum([`move`,`copy`]),path:R,from:R}).strict(),z=m.discriminatedUnion(`op`,[_t,vt,yt]),bt=m.object({type:m.literal(`artifact-query`),query:a,select:m.enum([`latest`,`all`]),optional:m.boolean().optional()}),xt=m.object({type:m.literal(`bus-request`),subject:m.string().min(1),payload:m.record(m.string(),m.unknown()).optional(),optional:m.boolean().optional()}),St=m.discriminatedUnion(`type`,[bt,xt]),Ct=m.object({type:m.literal(`artifact`),kind:m.string().min(1),schemaVersion:i,scope:s,metadata:m.record(m.string(),m.unknown()).optional()}),wt=m.object({type:m.literal(`bus-event`),subject:m.string().min(1),payload:m.record(m.string(),m.unknown()).optional()}),Tt=m.discriminatedUnion(`type`,[Ct,wt]),Et=m.object({content:m.string(),metadata:m.record(m.string(),m.unknown()).optional()}),Dt=m.object({sources:m.record(m.string(),Et)}),Ot=m.discriminatedUnion(`kind`,[m.object({kind:m.literal(`none`)}).strict(),m.object({kind:m.literal(`hmac`),secret:m.string().min(1)}).strict()]),kt=m.discriminatedUnion(`kind`,[m.object({kind:m.literal(`path`),path:m.string().min(1)}).strict(),m.object({kind:m.literal(`source`),filename:m.string().min(1),source:m.string()}).strict(),m.object({kind:m.literal(`definition`),workflowId:m.string().min(1)}).strict()]),B=m.enum([`immediate`,`await-trigger`]),At=m.object({source:kt,definition:j.optional(),executionId:m.string().min(1),workflowId:m.string().min(1),triggerPayload:n.default({}),triggerMode:B.optional(),inputs:r.default({}),config:n.optional(),artifactRef:_.optional(),scope:C.default({type:`global`}),busUrl:m.string().optional(),busAuth:Ot.default({kind:`none`}),env:m.record(m.string(),m.string()).default({}),coordinatorSessionId:m.string().min(1),cancelSubject:m.string().min(1),suspensionStrategy:te.default(`wait-in-process`),terminalAuthority:m.enum([`worker`,`authority`]).optional(),materializationSpec:p.optional()}),V=m.object({executionId:m.string().min(1),workflowId:m.string().min(1)}),jt=m.discriminatedUnion(`status`,[V.extend({status:m.literal(`completed`),artifact:o.optional()}).strict(),V.extend({status:m.literal(`failed`),error:m.string().min(1)}).strict(),V.extend({status:m.literal(`cancelled`),reason:m.string().min(1).optional()}).strict(),V.extend({status:m.literal(`paused`),pausedAtGateId:m.string().min(1),pausedAtFrameId:m.string().min(1)}).strict()]),Mt=m.object({contributionRefs:m.array(ne)}).strict(),Nt=m.discriminatedUnion(`kind`,[m.object({kind:m.literal(`path`),path:m.string().min(1).refine(e=>!e.startsWith(`/`)&&!/^[A-Za-z]:[/\\]/.test(e),{message:`path must be workspace-relative (no leading / or drive letter)`})}).strict(),m.object({kind:m.literal(`source`),filename:m.string().min(1),source:m.string()}).strict(),m.object({kind:m.literal(`definition`),workflowId:m.string().min(1)}).strict()]),Pt=m.object({executionId:m.string().min(1),workflowId:m.string().min(1),source:Nt,definitionSnapshot:j.optional(),workerManifest:Mt.default({contributionRefs:[]}),inputs:r.default({}),config:n.optional(),scope:C.default({type:`global`}),triggerPayload:n.default({}),triggerMode:B.optional(),artifactRef:_.optional(),coordinatorSessionId:m.string().min(1),dispatchMetadata:n.optional(),cancelSubject:m.string().min(1),env:m.record(m.string(),m.string()).default({}),createdAt:m.number(),suspensionStrategy:te.default(`wait-in-process`),terminalAuthority:m.enum([`worker`,`authority`]).optional(),materializationSpec:p.optional()}).superRefine((e,t)=>{e.source.kind===`definition`&&e.definitionSnapshot===void 0&&t.addIssue({code:m.ZodIssueCode.custom,path:[`definitionSnapshot`],message:`definitionSnapshot is required when source.kind is "definition"`}),e.source.kind===`path`?e.materializationSpec===void 0?t.addIssue({code:m.ZodIssueCode.custom,path:[`materializationSpec`],message:`materializationSpec is required when source.kind is "path"`}):e.materializationSpec.sourcePath!==e.source.path&&t.addIssue({code:m.ZodIssueCode.custom,path:[`materializationSpec`,`sourcePath`],message:`materializationSpec.sourcePath must match source.path`}):e.materializationSpec!==void 0&&t.addIssue({code:m.ZodIssueCode.custom,path:[`materializationSpec`],message:`materializationSpec is only valid when source.kind is "path"`})}),H=m.object({executionId:m.string().min(1),workflowId:m.string().min(1),workflowName:m.string().optional(),status:m.enum([`pending`,`running`,`paused`,`finalizing`,`completed`,`failed`,`cancelled`]),startedAt:m.number(),completedAt:m.number().optional(),durationMs:m.number().nonnegative().optional(),totalInputTokens:m.number().int().nonnegative().optional(),totalOutputTokens:m.number().int().nonnegative().optional(),totalEstimatedCost:m.number().nonnegative().optional(),error:m.string().optional(),failedNodeId:m.string().optional()}),Ft=m.object({executionId:m.string().min(1),frameId:m.string().min(1),nodeId:m.string().min(1),nodeType:E,path:m.array(m.string()),status:m.enum([`pending`,`running`,`waiting`,`completed`,`failed`,`skipped`,`cancelled`]),attempt:m.number().int().nonnegative(),iteration:m.number().int().nonnegative().optional(),branchKey:m.string().optional(),startedAt:m.number().optional(),completedAt:m.number().optional(),durationMs:m.number().nonnegative().optional(),inputTokens:m.number().int().nonnegative().optional(),outputTokens:m.number().int().nonnegative().optional(),estimatedCost:m.number().nonnegative().optional(),error:m.string().optional()}),It=m.object({executionId:m.string().min(1),frameId:m.string().min(1),nodeId:m.string().min(1),artifact:T,revision:m.string().min(1).optional(),writtenAt:m.number()}),Lt=m.object({executionId:m.string().min(1),nodeId:m.string().min(1),frameId:m.string().min(1),status:m.enum([`waiting`,`resumed`,`rejected`,`timed-out`,`cancelled`]),prompt:m.string().optional(),openedAt:m.number(),resolvedAt:m.number().optional(),resumeData:r.optional()}),Rt=m.object({executionId:m.string().min(1),inputTokens:m.number().int().nonnegative(),outputTokens:m.number().int().nonnegative(),cachedTokens:m.number().int().nonnegative().optional(),estimatedCost:m.number().nonnegative(),byModel:m.record(m.string(),m.object({inputTokens:m.number().int().nonnegative(),outputTokens:m.number().int().nonnegative(),estimatedCost:m.number().nonnegative()})).optional()}),zt=m.object({total:m.number().int().nonnegative(),byStatus:m.object({pending:m.number().int().nonnegative(),running:m.number().int().nonnegative(),paused:m.number().int().nonnegative(),finalizing:m.number().int().nonnegative(),completed:m.number().int().nonnegative(),failed:m.number().int().nonnegative(),cancelled:m.number().int().nonnegative()}),totalDurationMs:m.number().nonnegative(),totalInputTokens:m.number().int().nonnegative(),totalOutputTokens:m.number().int().nonnegative(),totalEstimatedCost:m.number().nonnegative()}),Bt=m.object({executionId:m.string().min(1),frameId:m.string().min(1),factoryId:m.string().min(1),materializedNodeIds:m.array(m.string().min(1)),factoryInput:e.optional(),materializedAt:m.number()}),Vt=`wfx-ext-`,Ht=m.object({frameId:m.string().min(1).optional(),nodeId:m.string().min(1),nodeType:I,path:m.array(m.string().min(1)).optional(),attempt:m.number().int().nonnegative().default(0),iteration:m.number().int().nonnegative().optional(),branchKey:m.string().min(1).optional(),startedAt:m.number().int().nonnegative().optional()}).strict(),Ut=m.object({frameId:m.string().min(1),nodeId:m.string().min(1),nodeType:I,path:m.array(m.string().min(1)),attempt:m.number().int().nonnegative().default(0),iteration:m.number().int().nonnegative().optional(),branchKey:m.string().min(1).optional(),startedAt:m.number().int().nonnegative(),durationMs:m.number().int().nonnegative().optional()}).strict(),Wt=m.object({executionId:m.string().startsWith(Vt,{message:`executionId must use the wfx-ext- prefix`}).optional(),name:m.string().min(1),startedAt:m.number().int().nonnegative().optional(),scope:C.optional(),artifactRef:_.optional(),input:r.optional(),triggerPayload:n.optional(),frame:Ht.optional()}).superRefine((e,t)=>{e.executionId!==void 0&&e.startedAt===void 0&&t.addIssue({code:m.ZodIssueCode.custom,message:`startedAt is required when executionId is supplied`,path:[`startedAt`]})}),Gt=m.object({executionId:m.string().min(1),status:m.enum([`completed`,`failed`,`cancelled`]),error:m.string().min(1).optional(),reason:m.string().min(1).optional(),completedAt:m.number().nonnegative().overwrite(e=>Math.trunc(e)).optional(),frame:Ut.optional()}).superRefine((e,t)=>{if(e.status===`failed`&&e.error===void 0&&t.addIssue({code:m.ZodIssueCode.custom,message:`status 'failed' requires a non-empty 'error' message`,path:[`error`]}),e.status===`cancelled`&&e.reason===void 0&&t.addIssue({code:m.ZodIssueCode.custom,message:`status 'cancelled' requires a non-empty 'reason' string`,path:[`reason`]}),e.status===`completed`&&e.error!==void 0&&t.addIssue({code:m.ZodIssueCode.custom,message:`status 'completed' must not carry an 'error'`,path:[`error`]}),e.status===`completed`&&e.reason!==void 0&&t.addIssue({code:m.ZodIssueCode.custom,message:`status 'completed' must not carry a 'reason'`,path:[`reason`]}),e.frame!==void 0&&e.completedAt===void 0&&t.addIssue({code:m.ZodIssueCode.custom,message:`completedAt is required when frame metadata is supplied`,path:[`completedAt`]}),e.frame!==void 0&&e.completedAt!==void 0){let n=e.completedAt-e.frame.startedAt;n<0&&t.addIssue({code:m.ZodIssueCode.custom,message:`completedAt must not precede frame.startedAt`,path:[`completedAt`]}),e.frame.durationMs!==void 0&&e.frame.durationMs!==n&&t.addIssue({code:m.ZodIssueCode.custom,message:`frame.durationMs must equal completedAt - frame.startedAt`,path:[`frame`,`durationMs`]})}}),Kt=m.object({message:m.string().min(1),details:m.string().min(1).optional(),kind:m.string().min(1).optional(),metadata:r.optional()}).strict(),U=m.object({executionId:m.string(),stepId:m.string(),stepType:m.enum([`station`,`delegate-agent`,`delegate-role`,`gate`])}),W=U.extend({stepType:m.literal(`gate`)}),qt=m.discriminatedUnion(`source`,[W.extend({frameId:m.string(),action:m.enum([`approve`,`reject`]),source:m.literal(`user`),reason:m.string().optional()}),W.extend({frameId:m.string(),action:m.enum([`approve`,`reject`]),source:m.literal(`timeout`)}),W.extend({frameId:m.string(),source:m.literal(`cancelled`)})]),Jt=W.extend({workflowId:m.string(),workflowName:m.string(),title:m.string(),message:m.string(),autoAction:m.enum([`approve`,`reject`]),timeoutMs:m.number().nullable(),openedAt:m.number()}),Yt={getDefinition:{request:m.object({id:m.string()}),response:m.object({workflow:j.nullable()})},setDefinition:{request:m.object({workflow:j}),response:m.object({id:m.string()})},deleteDefinition:{request:m.object({id:m.string()}),response:m.object({deleted:m.boolean()})},listDefinitions:{request:He,response:m.object({workflows:m.array(j)})},"definition.created":j,"definition.updated":j,"definition.deleted":m.object({id:m.string()}),start:{request:m.object({workflowId:m.string(),input:r.optional(),config:r.optional(),artifactRef:_.optional(),scope:C.optional(),parentSessionId:m.string().optional(),triggerPayload:n.optional()}),response:m.object({executionId:m.string()})},rerun:{request:m.object({executionId:m.string().min(1),mode:m.enum([`snapshot`,`current`]),input:r.optional(),config:r.optional(),artifactRef:_.optional(),scope:C.optional(),parentSessionId:m.string().optional(),triggerPayload:n.optional(),reason:m.string().min(1).optional()}),response:m.object({executionId:m.string()})},cancel:{request:m.object({executionId:m.string(),reason:m.string().optional()}),response:m.object({cancelled:m.boolean()})},bootstrapAuthorityState:{request:m.object({executionId:m.string().min(1),terminalAuthority:m.literal(`authority`),definition:j}).strict(),response:m.object({persisted:m.boolean()})},acceptAuthorityRunnerResult:{request:m.object({executionId:m.string().min(1),result:jt.refine(e=>e.status!==`paused`,{message:`Authority runner results must be terminal`})}).strict().superRefine((e,t)=>{e.result.executionId!==e.executionId&&t.addIssue({code:m.ZodIssueCode.custom,path:[`result`,`executionId`],message:`result.executionId must match executionId`})}),response:m.object({accepted:m.boolean(),status:M})},finalizeDelegateResult:{request:ve,response:x},getExecution:{request:m.object({executionId:m.string()}),response:m.object({execution:N.nullable()})},listExecutions:{request:qe,response:m.object({executions:m.array(N)})},listExecutionsByArtifactRefs:{request:Ze,response:m.object({executionsByRef:m.record(m.string(),m.array(N))})},listSpans:{request:m.object({executionId:m.string()}),response:m.object({spans:m.array(ft)})},listGateInstances:{request:Qe,response:m.object({gates:m.array(Be)})},setExecutionLink:{request:m.object({link:L}),response:m.object({id:m.string()})},listExecutionLinks:{request:mt,response:m.object({links:m.array(L)})},listFrames:{request:m.object({executionId:m.string().min(1)}),response:m.object({frames:m.array(ze)})},runFile:{request:m.object({filePath:m.string().min(1),materializationSpec:p.optional(),triggerPayload:n.optional(),triggerMode:B.default(`immediate`),scope:C.optional()}),response:m.object({executionId:m.string()})},registerExternalExecution:{request:Wt,response:m.object({executionId:m.string(),frameId:m.string().optional()})},completeExternalExecution:{request:Gt,response:m.object({success:m.boolean()})},resolveRole:{request:m.object({roleId:m.string().min(1)}),response:F},resolveAgent:{request:m.object({agentId:m.string().min(1)}),response:Ve},getRunContext:{request:m.object({executionId:m.string().min(1)}),response:Pt},"execution.started":m.object({executionId:m.string(),workflowId:m.string(),coordinatorSessionId:m.string().optional(),startedAt:m.number().nonnegative().optional(),artifactRef:_.optional()}),"execution.completed":m.object({executionId:m.string(),workflowId:m.string(),totalDuration:m.number(),completedAt:m.number().nonnegative().optional(),transitionKey:m.string().min(1).optional()}),"execution.failed":m.object({executionId:m.string(),workflowId:m.string(),error:m.string(),failedStepId:m.string().optional(),completedAt:m.number().nonnegative().optional(),transitionKey:m.string().min(1).optional()}),"execution.cancelled":m.object({executionId:m.string(),workflowId:m.string(),reason:m.string().optional(),completedAt:m.number().nonnegative().optional(),transitionKey:m.string().min(1).optional()}),"execution.progress":m.object({executionId:m.string().min(1),workflowId:m.string().min(1),frameId:m.string().min(1),nodeId:m.string().min(1),progress:Kt,emittedAt:m.number().int().nonnegative()}),"execution.paused":g.schema(m.object({executionId:m.string(),workflowId:m.string(),pausedAtGateId:m.string().min(1),pausedAtFrameId:m.string().min(1)}),{traceAll:!0}),"step.beforeStart":U,"step.started":U.extend({sessionId:m.string().optional(),subagentId:m.string().optional()}),"step.completed":U.extend({result:r.optional(),duration:m.number()}),"step.failed":U.extend({error:m.string()}),"step.skipped":U.extend({reason:m.string().optional(),condition:m.string().optional()}),"gate.requested":Jt,"gate.awaitApproval":{request:Jt,response:m.object({action:m.enum([`approve`,`reject`]),source:m.enum([`user`,`timeout`]),reason:m.string().optional()})},"gate.respond":{request:m.object({executionId:m.string(),gateId:m.string(),action:m.enum([`approve`,`reject`]),frameId:m.string().optional(),resumeData:r,reason:m.string().optional()}),response:m.object({accepted:m.boolean()})},"gate.resolved":qt,"frame.started":m.object({executionId:m.string(),frameId:m.string(),nodeId:m.string(),nodeType:E,path:m.array(m.string()),parentFrameId:m.string().optional(),startedAt:m.number().nonnegative().optional()}),"frame.completed":m.object({executionId:m.string(),frameId:m.string(),nodeId:m.string(),output:r.optional(),duration:m.number().nonnegative().optional(),completedAt:m.number().nonnegative().optional()}),"frame.failed":m.object({executionId:m.string(),frameId:m.string(),nodeId:m.string(),error:m.string(),duration:m.number().nonnegative().optional(),completedAt:m.number().nonnegative().optional()}),"frame.sessionLinked":m.object({executionId:g.attribute(m.string(),`makaio.execution.id`),frameId:g.attribute(m.string(),`makaio.frame.id`),sessionId:g.attribute(m.string(),`makaio.session.id`)}).strict(),"gate.suspended":m.object({executionId:m.string(),frameId:m.string(),nodeId:m.string(),schema:e,prompt:m.string().optional(),title:m.string().optional(),autoAction:m.enum([`approve`,`reject`]),timeoutMs:m.number().nullable(),openedAt:m.number()}),"gate.resumed":m.object({executionId:m.string(),frameId:m.string(),nodeId:m.string(),resumeData:r}),"dynamic.materialized":m.object({executionId:m.string(),frameId:m.string(),factoryId:m.string().min(1),materializedNodes:m.number().int().nonnegative()}),"artifact.updated":m.object({executionId:m.string(),frameId:m.string(),artifactRef:m.object({kind:m.string().min(1),id:m.string().min(1)}),paths:m.array(m.string()),operation:m.string().min(1),revision:m.string().min(1).optional()}),"worklog.get":{request:m.object({executionId:m.string().min(1)}),response:m.object({summary:H.nullable()})},"worklog.frame.get":{request:m.object({frameId:m.string().min(1)}),response:m.object({frame:Ft.nullable()})},"worklog.list":{request:m.object({workflowId:m.string().min(1).optional(),status:M.optional(),limit:m.number().int().positive().optional(),offset:m.number().int().nonnegative().optional()}),response:m.object({items:m.array(H),total:m.number().int().nonnegative()})},"worklog.stats":{request:m.object({workflowId:m.string().min(1).optional(),since:m.number().int().nonnegative().optional(),until:m.number().int().nonnegative().optional()}),response:m.object({stats:zt})},"worklog.changed":m.object({executionId:m.string().min(1)}),"state.get":{request:m.object({executionId:m.string().min(1)}),response:m.object({executionId:m.string().min(1),sequence:m.number().int().nonnegative(),value:r})},"state.patch":{request:m.object({executionId:m.string().min(1),expectedSequence:m.number().int().nonnegative(),patch:m.array(z),nextValue:r}),response:m.object({executionId:m.string().min(1),sequence:m.number().int().positive(),value:r})},"state.updated":m.object({executionId:m.string().min(1),sequence:m.number().int().positive(),patch:m.array(z),value:r,updatedAt:m.number().int().positive()})},Xt=h(`workflow`,Yt),Zt=Xt.subjects;function Qt(e,t){G(e,t,void 0,0,[],`root`,void 0,void 0)}function G(e,t,n,r,i,a,o,s){let c={parent:n,depth:r,ancestors:i,relationship:a,...o!==void 0&&{index:o},...s!==void 0&&{branchKey:s}};if(t.enter?.(e,c)===!1)return;let l=[...i,e.id],u=r+1;switch(e.type){case`sequence`:{let n=e;for(let r=0;r<n.nodes.length;r++)G(n.nodes[r],t,e,u,l,`sequence-child`,r,void 0);break}case`parallel`:{let n=e;for(let[r,i]of Object.entries(n.branches))G(i,t,e,u,l,`parallel-branch`,void 0,r);break}case`iterate`:G(e.body,t,e,u,l,`iterate-body`,void 0,void 0);break;case`iterate-chain`:G(e.body,t,e,u,l,`iterate-chain-body`,void 0,void 0);break;case`loop`:G(e.body,t,e,u,l,`loop-body`,void 0,void 0);break}t.leave?.(e,c)}function $t(e){switch(e){case`station`:case`delegate-agent`:case`delegate-role`:case`gate`:return`leaf`;case`parallel`:case`iterate`:case`iterate-chain`:case`loop`:return`control`;case`sequence`:return`structural`}}function en(e,t,n){return e===`parallel-branch`&&t!==void 0?[{kind:`branch`,key:t}]:e===`sequence-child`&&n!==void 0?[{kind:`index`,value:n}]:e===`iterate-body`||e===`iterate-chain-body`||e===`loop-body`?[{kind:`body`}]:[]}function tn(e){return e.replace(/\\/g,`\\\\`).replace(/\//g,`\\/`)}function nn(e){return e.map(e=>{switch(e.kind){case`node`:return`n:${tn(e.id)}`;case`branch`:return`b:${tn(e.key)}`;case`index`:return`i:${e.value}`;case`body`:return`body`}}).join(`/`)}function rn(e){let t=[],n=[],r=new Map,i=[],a=[],o=[];return Qt(e.root,{enter(e,s){let c=en(s.relationship,s.branchKey,s.index),l={kind:`node`,id:e.id};i.push(...c,l),o.push(c.length+1);let u=[...i],d=nn(u),f=a.at(-1);if(t.push({key:d,nodeId:e.id,type:e.type,role:$t(e.type),path:u,parentKey:f,...s.branchKey!==void 0&&{branchKey:s.branchKey}}),f!==void 0&&s.parent!==void 0)switch(s.parent.type){case`sequence`:{n.push({sourceKey:f,targetKey:d,kind:`contains`});let e=r.get(f);e!==void 0&&n.push({sourceKey:e,targetKey:d,kind:`sequence`}),r.set(f,d);break}case`parallel`:n.push({sourceKey:f,targetKey:d,kind:`branch`});break;case`iterate`:case`iterate-chain`:case`loop`:n.push({sourceKey:f,targetKey:d,kind:`body`});break;default:n.push({sourceKey:f,targetKey:d,kind:`contains`});break}a.push(d)},leave(){let e=o.pop()??0;i.splice(i.length-e,e),a.pop()}}),{nodes:t,edges:n}}const an=`makaio.bus-event`,on=`makaio.cron`,sn=`UTC`;function K(e,t,n){return{kind:e,params:t,...n.filter!==void 0&&{filter:n.filter},...n.filterExpression!==void 0&&{filterExpression:n.filterExpression}}}function cn(e,n){let r=t.parse(n.params);return e.paramsSchema.parse(r),K(e.kind,r,n)}function ln(e){return K(an,{subject:ie(e.subject)},e)}const un=m.object({schedule:m.string().min(1),timezone:m.string().min(1).default(`UTC`)});function dn(e){return K(on,un.parse(e),{})}function q(e){return J(e.body.nodes,e.id)}function J(e,t){for(let n of e){if(n.type===`loop`)return`Nested loop '${n.id}' found inside loop '${t}' — V1 does not support nested loops`;if(n.type===`sequence`){let e=J(n.nodes,t);if(e)return e}if(n.type===`parallel`)for(let e of Object.values(n.branches)){let n=J(e.nodes,t);if(n)return n}if(n.type===`iterate`||n.type===`iterate-chain`){let e=n.body,r=J(e.nodes,t);if(r)return r}}}const Y=new WeakMap,fn=new WeakMap;function X(e,t,n){let r=Y.get(e);if(r!==void 0&&t.set(e.id,r),e.type===`sequence`)for(let r of e.nodes)X(r,t,n);else if(e.type===`parallel`)for(let r of Object.values(e.branches))X(r,t,n);else if(e.type===`iterate`)X(e.body,t,n);else if(e.type===`iterate-chain`)X(e.body,t,n);else if(e.type===`loop`){if(n!==void 0){let t=fn.get(e);t!==void 0&&n.set(e.gate.handler,t)}X(e.body,t,n)}}function pn(e,t,n){let r={id:e,type:`station`,prompt:e,...n?.when!==void 0&&{when:n.when},...n?.skip!==void 0&&{skip:n.skip}};return Y.set(r,t),r}function mn(e,t,n){return{id:e,type:`delegate-agent`,agentId:t.agentId,...t.inputExpression!==void 0&&{inputExpression:t.inputExpression},...t.outputSchema!==void 0&&{outputSchema:t.outputSchema},...t.allowedTools!==void 0&&{allowedTools:t.allowedTools},...t.completion!==void 0&&{completion:t.completion},...t.resultFinalizerId!==void 0&&{resultFinalizerId:t.resultFinalizerId},...n?.when!==void 0&&{when:n.when},...n?.skip!==void 0&&{skip:n.skip}}}function hn(e,t,n){return{id:e,type:`delegate-role`,role:t,prompt:n?.prompt??e,...n?.when!==void 0&&{when:n.when},...n?.skip!==void 0&&{skip:n.skip},...n?.outputSchema!==void 0&&{outputSchema:n.outputSchema},...n?.timeoutMs!==void 0&&{timeoutMs:n.timeoutMs},...n?.completion!==void 0&&{completion:n.completion},...n?.allowedTools!==void 0&&{allowedTools:n.allowedTools},...n?.resultFinalizerId!==void 0&&{resultFinalizerId:n.resultFinalizerId}}}function gn(e,t){return{id:e,type:`gate`,prompt:t.prompt,autoAction:t.autoAction,timeoutMs:t.timeoutMs,...t.title!==void 0&&{title:t.title},...t.resume!==void 0&&{resumeSchema:c(t.resume)}}}function _n(e,t,n){let r=`${e}__item`,i={id:r,type:`station`,prompt:r},a={id:e,type:`iterate`,collection:n.collection,body:{id:`${e}__body`,type:`sequence`,nodes:[i]},...n.concurrency!==void 0&&{concurrency:n.concurrency},...n.when!==void 0&&{when:n.when},...n.skip!==void 0&&{skip:n.skip}};return Y.set(i,t),a}function vn(e,t,n){return{id:e,type:`iterate-chain`,collection:n.collection,body:{id:`${e}__body`,type:`sequence`,nodes:t},...n.when!==void 0&&{when:n.when},...n.skip!==void 0&&{skip:n.skip}}}function yn(e,t,n){let r={id:e,type:`loop`,maxRounds:n.maxRounds,body:{id:`${e}__body`,type:`sequence`,nodes:t},gate:bn(n),...n.when!==void 0&&{when:n.when},...n.skip!==void 0&&{skip:n.skip}},i=q(r);if(i!==void 0)throw Error(i);return fn.set(r,n.gate.evaluate),r}function bn(e){let t=e.gate.escalation;return{handler:e.gate.handler,...e.gate.input!==void 0&&{input:e.gate.input},...e.gate.config!==void 0&&{config:e.gate.config},...t!==void 0&&{escalation:{prompt:t.prompt,autoAction:t.autoAction??`reject`,timeoutMs:t.timeoutMs??null,...t.title!==void 0&&{title:t.title},...t.resumeSchema!==void 0&&{resumeSchema:t.resumeSchema}}}}}function Z(e,t){if(e.has(t))throw Error(`Duplicate step ID: ${t}`);e.add(t)}function Q(e,t){if(Z(e,t.id),t.type===`sequence`)for(let n of t.nodes)Q(e,n);else if(t.type===`parallel`)for(let n of Object.values(t.branches))Q(e,n);else (t.type===`iterate`||t.type===`iterate-chain`||t.type===`loop`)&&Q(e,t.body)}function xn(e,t,n,r,i){let a={};return t.forEach((t,o)=>{if(t.id.length===0)throw Error(`parallel branch at index ${o} has an empty ID`);let s=t.id,c=`${e}__${s}`;Q(n,t),Z(n,c),X(t,r,i),a[s]={id:c,type:`sequence`,nodes:[t]}}),a}function Sn(e,t,n,r,i){let a=`${e}__body`,o=`${e}__item`;Z(r,a),Z(r,o),i.set(o,t);let s={id:o,type:`station`,prompt:o};return{id:e,type:`iterate`,collection:n.collection,body:{id:a,type:`sequence`,nodes:[s]},...n.concurrency!==void 0&&{concurrency:n.concurrency},...n.when!==void 0&&{when:n.when},...n.skip!==void 0&&{skip:n.skip}}}function Cn(e,t,n){return t.resume!==void 0&&(n[e]=t.resume),{id:e,type:`gate`,prompt:t.prompt,autoAction:t.autoAction,timeoutMs:t.timeoutMs,...t.title!==void 0&&{title:t.title},...t.resume!==void 0&&{resumeSchema:c(t.resume)}}}function wn(e,t,n,r,i,a){let o=`${e}__body`;Z(r,o);for(let e of t)Q(r,e),X(e,i,a);return{id:e,type:`iterate-chain`,collection:n.collection,body:{id:o,type:`sequence`,nodes:t},...n.when!==void 0&&{when:n.when},...n.skip!==void 0&&{skip:n.skip}}}function Tn(e,t,n,r,i,a){let o=`${e}__body`;Z(r,o);for(let e of t)Q(r,e),X(e,i,a);let s={id:e,type:`loop`,maxRounds:n.maxRounds,body:{id:o,type:`sequence`,nodes:t},gate:bn(n),...n.when!==void 0&&{when:n.when},...n.skip!==void 0&&{skip:n.skip}},c=q(s);if(c!==void 0)throw Error(c);return a.set(n.gate.handler,n.gate.evaluate),s}function En(e,t){e.input=n=>(t.zodSchemas.input=n,t.definition.inputSchema=c(n),e),e.config=n=>(t.zodSchemas.config=n,t.definition.configSchema=c(n),e),e.output=n=>(t.zodSchemas.output=n,t.definition.outputSchema=c(n),e),e.artifact=n=>(n.schema!==void 0&&(t.zodSchemas.artifact=n.schema),t.definition.artifact={kind:n.kind,schemaVersion:n.schemaVersion,scope:n.scope,...n.resolve!==void 0&&{resolve:n.resolve},...n.create!==void 0&&{create:n.create},...n.statusPath!==void 0&&{statusPath:n.statusPath}},e),e.state=e=>(t.definition.state={schema:e.schema,...e.initial!==void 0&&{initial:e.initial}},$(t))}function Dn(e,t){let{rootNodes:n,runtimeHandlers:r,runtimeLoopGates:i,registeredIds:a,zodGates:o}=t;e.station=(t,i,o)=>(Z(a,t),n.push({id:t,type:`station`,prompt:t,...o?.when!==void 0&&{when:o.when},...o?.skip!==void 0&&{skip:o.skip}}),r.set(t,i),e),e.delegateToAgent=(t,r,i)=>(Z(a,t),n.push(mn(t,r,i)),e),e.delegateToRole=(t,r,i)=>(Z(a,t),n.push(hn(t,r,i)),e),e.parallel=(t,o,s)=>(Z(a,t),n.push({id:t,type:`parallel`,mode:o.mode??`all-settled`,branches:xn(t,s,a,r,i),...o.when!==void 0&&{when:o.when},...o.skip!==void 0&&{skip:o.skip}}),e),e.gate=(t,r)=>(Z(a,t),n.push(Cn(t,r,o)),e),e.iterate=(t,i,o)=>(Z(a,t),n.push(Sn(t,i,o,a,r)),e),e.iterateChain=(t,o,s)=>(Z(a,t),n.push(wn(t,o,s,a,r,i)),e),e.loop=(t,o,s)=>(Z(a,t),n.push(Tn(t,o,s,a,r,i)),e),e.addNode=e=>On(e,a,r,i,n)}function On(e,t,n,r,i){Q(t,e),X(e,n,r),i.push(e)}function $(e){let t={id:e.definition.id,definition:e.definition,runtimeHandlers:e.runtimeHandlers,runtimeFactories:e.runtimeFactories,runtimeLoopGates:e.runtimeLoopGates,source:void 0,get zodSchemas(){return e.zodSchemas},addTrigger(t){return e.triggers.push(t),$(e)}};return En(t,e),Dn(t,e),t}function kn(e,t){let n=[],r=new Map,i=new Map,a=new Set,o={},s={gates:o},c=new Map,l=t?.triggers?[...t.triggers]:[];return $({rootNodes:n,runtimeHandlers:r,runtimeFactories:c,runtimeLoopGates:i,registeredIds:a,zodGates:o,zodSchemas:s,definition:{id:e,...t?.name!==void 0&&{name:t.name},...t?.description!==void 0&&{description:t.description},...t?.successFinalizerId!==void 0&&{successFinalizerId:v.parse(t.successFinalizerId)},root:{id:`${e}__root`,type:`sequence`,nodes:n},triggers:l,scope:{type:`global`}},triggers:l})}function An(e){if(e.workflows.length===0)throw Error(`defineWorkflowBundle: workflows must not be empty`);return{workflows:Object.freeze([...e.workflows])}}const jn=m.enum([`artifact.created`,`artifact.revised`,`artifact.status.changed`]),Mn=m.record(m.string(),r),Nn=m.object({type:m.string().min(1),input:m.record(m.string(),r).optional()}),Pn=m.object({id:m.string().min(1),description:m.string().optional(),on:jn,when:Mn.optional(),action:Nn,enabled:m.boolean().default(!0)});export{St as $,D as $t,Ut as A,M as At,Pt as B,De as Bt,Qt as C,_ as Cn,Ye as Ct,Zt as D,We as Dt,Yt as E,Ge as Et,H as F,we as Ft,At as G,ze as Gt,jt as H,Fe as Ht,Ft as I,Ce as It,bt as J,P as Jt,kt as K,Be as Kt,Lt as L,w as Lt,Wt as M,Qe as Mt,It as N,Ne as Nt,Gt as O,Ue as Ot,Bt as P,T as Pt,Tt as Q,Pe as Qt,zt as R,Ie as Rt,rn as S,ye as Sn,Xe as St,Kt as T,oe as Tn,Ke as Tt,B as U,N as Ut,Mt as V,Oe as Vt,Ot as W,C as Wt,xt as X,je as Xt,wt as Y,Me as Yt,Dt as Z,He as Zt,ln as _,me as _n,ot as _t,An as a,F as an,L as at,dn as b,de as bn,at as bt,hn as c,Le as cn,dt as ct,vn as d,ve as dn,ut as dt,O as en,Et as et,yn as f,b as fn,nt as ft,an as g,pe as gn,lt as gt,cn as h,ge as hn,et as ht,Pn as i,Ve as in,mt as it,Ht as j,Ze as jt,Vt as k,qe as kt,gn as l,A as ln,it as lt,q as m,y as mn,tt as mt,Mn as n,Ee as nn,gt as nt,kn as o,k as on,pt as ot,pn as p,x as pn,rt as pt,Ct as q,Ae as qt,jn as r,ke as rn,ht as rt,mn as s,Te as sn,ft as st,Nn as t,E as tn,z as tt,_n as u,_e as un,ct as ut,on as v,fe as vn,$e as vt,Xt as w,se as wn,Je as wt,sn as x,be as xn,st as xt,un as y,v as yn,I as yt,Rt as z,j as zt};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as e}from"./framework-packages-
|
|
1
|
+
import{u as e}from"./framework-packages-CxWecyPW.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};
|