@makaio/framework 1.0.0-dev-1788955549564 → 1.0.0-dev-1788966380232
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 → 2020-CpDjcHDh.mjs} +1 -1
- package/dist/{account-identity-B0NsOILM.mjs → account-identity-D00LLclm.mjs} +1 -1
- package/dist/{adapter-DYE_oWjj.mjs → adapter-D92pfm_b.mjs} +1 -1
- package/dist/{adapter-auth-runtime-BnPqQChk.mjs → adapter-auth-runtime-46Y9WKcB.mjs} +1 -1
- package/dist/adapter-subsystem/index.d.mts +1 -1
- package/dist/adapter-subsystem/index.mjs +1 -1
- package/dist/adapters/claude/index.d.mts +2 -2
- package/dist/adapters/claude/testing.mjs +1 -1
- package/dist/adapters/config/index.d.mts +2 -2
- package/dist/adapters/config/index.mjs +1 -1
- package/dist/adapters/index.d.mts +3 -3
- package/dist/adapters/index.mjs +6 -6
- package/dist/adapters/node.d.mts +1 -1
- package/dist/adapters/node.mjs +2 -2
- package/dist/adapters/stream-session/index.d.mts +1 -1
- package/dist/adapters/stream-session/index.mjs +1 -1
- package/dist/artifact-_pN73_7c.mjs +1 -0
- package/dist/{attempt-record-codec-6jpayBMY.mjs → attempt-record-codec-D2Gb_epJ.mjs} +1 -1
- package/dist/{auth-CeH3w2fi.mjs → auth-CB4an9bh.mjs} +1 -1
- package/dist/authority-state-bootstrap-DgoHPc9J.mjs +1 -0
- package/dist/{automation-trigger-CZfH94Fr.mjs → automation-trigger-xNDX0Am_.mjs} +1 -1
- package/dist/bootstrap-start-client-rW55mDI-.mjs +1 -0
- package/dist/bus/index.mjs +1 -1
- package/dist/{caller-owned-adapter-stub-B-Sq7ZvF.mjs → caller-owned-adapter-stub-oM1G1KvC.mjs} +1 -1
- package/dist/{canonical-model-oFNty7hj.mjs → canonical-model-D7Cg0l2R.mjs} +1 -1
- package/dist/{capabilities-BhJ3wzI8.mjs → capabilities-D2ggcMem.mjs} +1 -1
- package/dist/{capability-service-23Ot2J9A.d.mts → capability-service-Cpkonrc0.d.mts} +1 -1
- package/dist/{client-DJMzCHRm.mjs → client-CpUVfDxa.mjs} +1 -1
- package/dist/clients/index.d.mts +2 -2
- package/dist/clients/index.mjs +1 -1
- package/dist/clients/managed-install.d.mts +1 -1
- package/dist/clients/managed-install.mjs +1 -1
- package/dist/code-execution/worker-entry.d.mts +1 -1
- package/dist/code-execution/worker-entry.mjs +1 -1
- package/dist/{code-execution-B9wr0b972.mjs → code-execution-ByLSAlEg2.mjs} +1 -1
- package/dist/{code-execution-BMmUATcc.mjs → code-execution-CMqsHnGg.mjs} +1 -1
- package/dist/{code-execution-DRCzkGzO.mjs → code-execution-xn9-x3VO.mjs} +1 -1
- package/dist/common-CylczUIW.mjs +1 -0
- package/dist/{compression-nZhMDRTA.mjs → compression-Civ-rf-O.mjs} +1 -1
- package/dist/{config-namespace-MjFuIPyL.mjs → config-namespace-CQnsvr77.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 +2 -2
- package/dist/contracts/common/index.mjs +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 +73 -73
- package/dist/contracts/index.mjs +1 -1
- package/dist/contracts/materialization/index.d.mts +2 -2
- 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 +2 -2
- 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-B4t0OXKs.d.mts → contribution-BfEEQ8YZ.d.mts} +2 -2
- package/dist/{definition-Bs5hzhsT.d.mts → definition-6d5JBi55.d.mts} +1 -1
- package/dist/{definition-YGj42UeO.mjs → definition-Dqw0YJdi.mjs} +1 -1
- package/dist/{detached-extension-handle-CgJiXaqv.mjs → detached-extension-handle-BJnk3WEh.mjs} +1 -1
- package/dist/{dist-CfANkKSb.mjs → dist-DeI9zYMP.mjs} +1 -1
- package/dist/evidence/git-file/index.d.mts +54 -0
- package/dist/evidence/git-file/index.mjs +4 -0
- package/dist/{execution-attempt-owner-recovery-CdH04iwP.mjs → execution-attempt-owner-recovery-D4APLAvt.mjs} +1 -1
- package/dist/{execution-attempt-repository-CJVlPFMM.d.mts → execution-attempt-repository--RVils5-.d.mts} +273 -189
- package/dist/execution-attempt-repository-CWbgCTwA.mjs +1 -0
- package/dist/{execution-target-B9jZgDQz.mjs → execution-target-_oVNW6Zm.mjs} +1 -1
- package/dist/{extension-B51JzHJu.mjs → extension-CAi7bbyv.mjs} +1 -1
- package/dist/{extension-C1CwxkCN.mjs → extension-CrghVa93.mjs} +1 -1
- package/dist/{filesystem-service-yB8KhUGz.mjs → filesystem-service-hdz3oYti.mjs} +1 -1
- package/dist/{framework-packages-25GUGzJ-.mjs → framework-packages-BOPhhtK7.mjs} +1 -1
- package/dist/git/index.mjs +1 -1
- package/dist/{globby-z2SR0jRo.mjs → globby-Begk3aIP.mjs} +1 -1
- package/dist/{handlers-CBbFzDHc.mjs → handlers-YPTyZDhF.mjs} +1 -1
- package/dist/{harness-GNtHsoh4.mjs → harness-Ds1I4smU.mjs} +1 -1
- package/dist/{hook-responses-chgDiS8D.d.mts → hook-responses-CpEfxEmG.d.mts} +1 -1
- package/dist/hooks/index.d.mts +1 -1
- package/dist/hooks/index.mjs +1 -1
- package/dist/{index-BtPZcp4M2.d.mts → index-09eal6WI2.d.mts} +11 -11
- package/dist/{index-GNRWZONO.d.mts → index-6kg8YFYt.d.mts} +1 -1
- package/dist/{index-B6aoVzdA.d.mts → index-B3G-Hzwn.d.mts} +1 -1
- package/dist/{index-SDXlgq07.d.mts → index-B7wjmaev.d.mts} +24 -14
- package/dist/{index-DzeUtJtE.d.mts → index-BKwYE1Qk.d.mts} +5 -5
- package/dist/{index-CKjFFP6W2.d.mts → index-BM-FPWjs2.d.mts} +1 -1
- package/dist/{index-Bak5iKWv2.d.mts → index-BT5qcsEf2.d.mts} +24 -15
- package/dist/{index-BjELPYLF2.d.mts → index-BfzuauBt2.d.mts} +1 -1
- package/dist/{index-D2sbGoGS.d.mts → index-Bj2JCo9V.d.mts} +2 -2
- package/dist/{index-OXuby-ee.d.mts → index-BkQlL0Pl.d.mts} +13 -13
- package/dist/{index-CuPq_ap8.d.mts → index-BlHq_Ksb.d.mts} +2 -2
- package/dist/{index-D3RZEEE3.d.mts → index-Bn6sN1op.d.mts} +2 -2
- package/dist/{index-ConotXyG.d.mts → index-Bnm0QvJ4.d.mts} +15 -15
- package/dist/{index-Bxs-oIo4.d.mts → index-BpsurXEW.d.mts} +1 -1
- package/dist/{index-C9J8wBLV.d.mts → index-BqR2xDu6.d.mts} +655 -111
- package/dist/{index-DX_2kGSg.d.mts → index-Bxq_zO2E.d.mts} +4 -4
- package/dist/{index-CcgI6r0K.d.mts → index-C742b1FV.d.mts} +2 -2
- package/dist/{index-B6Kq1BtL.d.mts → index-C8oBOTl_.d.mts} +1 -1
- package/dist/{index-CuLDybz3.d.mts → index-CDhbUjUH.d.mts} +2 -2
- package/dist/{index-CDeN0mdC.d.mts → index-CWeWBh-_.d.mts} +1 -1
- package/dist/{index-SIP-fI28.d.mts → index-D4XNkbM4.d.mts} +1 -1
- package/dist/{index-C6eJrtTA.d.mts → index-D7IZQNhD.d.mts} +2 -2
- package/dist/{index-CU_HMaeC.d.mts → index-DCfYa3cF.d.mts} +39 -1
- package/dist/{index-VbqrC9qf.d.mts → index-DO633_D-.d.mts} +40 -40
- package/dist/{index-CVx7li6B2.d.mts → index-DU9Y9tes2.d.mts} +12 -12
- package/dist/{index-99Gz8ezO.d.mts → index-DY_0TRvM.d.mts} +3 -3
- package/dist/{index-DfJNJYPV.d.mts → index-DzlGAEws.d.mts} +4 -4
- package/dist/{index-DOkenapA.d.mts → index-LjLUr3Dm.d.mts} +10 -10
- package/dist/{index-CwJaE0fT.d.mts → index-MtDz_goH.d.mts} +125 -77
- package/dist/{index-CyB6POkH.d.mts → index-nJvYTAbD.d.mts} +1 -1
- package/dist/{index-BrelUXBT.d.mts → index-ud9i9pue.d.mts} +16 -16
- package/dist/{index-OUtnmQ8t2.d.mts → index-v9TbeVee2.d.mts} +5 -5
- 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/{lib-0MqNtDuH.mjs → lib-BmXBuE-w.mjs} +1 -1
- package/dist/{lib-dlyJT26K.mjs → lib-R-c_q77C.mjs} +1 -1
- package/dist/{load-extensions-DM1PgW4a.d.mts → load-extensions-Bu10B5B1.d.mts} +1 -1
- package/dist/{load-extensions-BHTj3d_P.mjs → load-extensions-s4YmICgn.mjs} +1 -1
- package/dist/{materialization-BQuh_gaE.mjs → materialization-BwC7pVg2.mjs} +1 -1
- package/dist/mcp-http-server/index.d.mts +1 -1
- package/dist/mcp-http-server/index.mjs +1 -1
- package/dist/model-Cn1IFEP8.mjs +1 -0
- package/dist/{namespace-c5XPzbf3.d.mts → namespace-BYsKOw-g.d.mts} +2 -2
- package/dist/{namespace-ZAIFBrIy.mjs → namespace-CnRcpgJ8.mjs} +1 -1
- package/dist/namespace-DFc1nkal.mjs +1 -0
- package/dist/{namespace-Cb0XKb4v.d.mts → namespace-KTRWfIPy.d.mts} +2 -2
- package/dist/{namespace-DiTFR4Zt.d.mts → namespace-wuGMWlyz.d.mts} +2 -2
- package/dist/{native-session-supervisor-BlGzmZrH.mjs → native-session-supervisor-B0rziwHI.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/{orchestrator-shared-5vhs4wvU.mjs → orchestrator-shared-CmS8iU9_.mjs} +1 -1
- package/dist/{orchestrator-shared-BRNZ6it3.d.mts → orchestrator-shared-Cwc6JKkV.d.mts} +1 -1
- package/dist/{ownership-memory-handler-BCu1EjFO.mjs → ownership-memory-handler-DMirNILL.mjs} +1 -1
- package/dist/package-B-xpYKe8.mjs +7 -0
- package/dist/{package-x2wRhcUt.d.mts → package-Bl0mcGb8.d.mts} +13 -3
- package/dist/{package-BiZ6ehWk.mjs → package-Co36_pRw.mjs} +1 -1
- package/dist/{package-BUSXHPOT.mjs → package-D2zvQO7X.mjs} +1 -1
- package/dist/package.json +1 -1
- package/dist/{packages-Dhgmy_LJ.mjs → packages-COqPg5TI.mjs} +1 -1
- package/dist/{packages-BSVxszLf.d.mts → packages-DTz_1dCa.d.mts} +1 -1
- package/dist/{profile-DBDvy9uc.mjs → profile-C9RV7ao-.mjs} +1 -1
- package/dist/{provider-context-CSb0qX1c.mjs → provider-context-BPITm0cn.mjs} +1 -1
- package/dist/{provider-context-CTOrOW54.mjs → provider-context-CyGvwXPz.mjs} +1 -1
- package/dist/providers/index.d.mts +1 -1
- package/dist/{reaction-6e4v007b.mjs → reaction-aQJGWUWl.mjs} +1 -1
- package/dist/repo-context-Dy6eE9cg.mjs +1 -0
- package/dist/{resolved-ONt3rOMh.mjs → resolved-M6PyrgFr.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 +6 -6
- package/dist/runtime-node/index.mjs +4 -4
- package/dist/runtime-node/makaio-config.d.mts +1 -1
- package/dist/runtime-node/makaio-config.mjs +1 -1
- package/dist/runtime-node/workflow-worker/index.d.mts +1 -1
- package/dist/runtime-node/workflow-worker/index.mjs +1 -1
- package/dist/runtime-node/workflow-worker/worker-entry.mjs +1 -1
- package/dist/{schema-B8jinlbH.mjs → schema-DrHrto2J.mjs} +1 -1
- package/dist/{schemas-BFwNBMIj.d.mts → schemas-BYyT43gX.d.mts} +4 -4
- package/dist/{schemas-BIU9Org_.mjs → schemas-CQKfd2Xd.mjs} +1 -1
- package/dist/{schemas-Di_kpQ0C.d.mts → schemas-CvUe_yff.d.mts} +13 -4
- package/dist/{schemas-BZabEyEV.d.mts → schemas-D2HmGmCt.d.mts} +1 -1
- package/dist/schemas-DRho446W.mjs +1 -0
- package/dist/{schemas-I9dZtAkj.d.mts → schemas-DwqibWUL.d.mts} +2 -2
- package/dist/{schemas-abY5VbS4.mjs → schemas-DyZNwquY.mjs} +1 -1
- package/dist/{selection-7SkHsmWs.mjs → selection-BDs7K53w.mjs} +1 -1
- package/dist/{server-lifecycle-hNz8U-QJ.mjs → server-lifecycle-C5Vl58sN.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.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.d.mts +2 -2
- package/dist/services/git/namespace.mjs +1 -1
- package/dist/services/git/schemas.d.mts +1 -1
- package/dist/services/git/schemas.mjs +1 -1
- package/dist/services/harness/index.d.mts +4 -4
- package/dist/services/harness/index.mjs +1 -1
- package/dist/services/index.d.mts +49 -49
- package/dist/services/index.mjs +1 -1
- package/dist/services/log-import/browser.d.mts +2 -2
- package/dist/services/log-import/index.d.mts +3 -3
- package/dist/services/log-import/index.mjs +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 +1 -1
- package/dist/services/materialization/index.mjs +1 -1
- package/dist/services/model-registry/index.d.mts +1 -1
- package/dist/services/model-registry/index.mjs +1 -1
- package/dist/services/preferences/index.d.mts +2 -2
- package/dist/services/preferences/schemas.d.mts +1 -1
- package/dist/services/preferences/storage-namespace.d.mts +2 -2
- package/dist/services/provider-context/index.d.mts +1 -1
- package/dist/services/provider-context/index.mjs +1 -1
- package/dist/services/provider-runtime/index.mjs +1 -1
- package/dist/services/session/handlers/index.d.mts +1 -1
- package/dist/services/session/handlers/index.mjs +1 -1
- package/dist/services/session/index.d.mts +9 -9
- package/dist/services/session/index.mjs +1 -1
- package/dist/services/session/messages/namespace.d.mts +1 -1
- package/dist/services/session/messages/namespace.mjs +1 -1
- package/dist/services/session/orchestrator-testing/index.d.mts +1 -1
- package/dist/services/session/orchestrator-testing/index.mjs +1 -1
- package/dist/services/session/session-events/namespace.d.mts +1 -1
- package/dist/services/session/session-events/namespace.mjs +1 -1
- package/dist/services/session/storage/namespace.d.mts +1 -1
- package/dist/services/session/storage/schema.d.mts +1 -1
- package/dist/services/session/testing/index.mjs +2 -2
- package/dist/services/session/testing/orchestrator-shared.d.mts +1 -1
- package/dist/services/session/testing/orchestrator-shared.mjs +1 -1
- package/dist/services/session/turns/namespace.d.mts +1 -1
- package/dist/services/session/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 +4 -4
- 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-A-h_Dwcs.mjs → session-9C42TPQq.mjs} +1 -1
- package/dist/{session-BDFNAcuY.mjs → session-Cn8z1hxD.mjs} +6 -6
- package/dist/{session-lineage-BzlpfLgC.d.mts → session-lineage-CEyJWg_J.d.mts} +1 -1
- package/dist/{shared-BZf2zoxL.mjs → shared-DqvfJVYk.mjs} +1 -1
- package/dist/{skill-1gU2q1KT.mjs → skill-BmRp8GhW.mjs} +1 -1
- package/dist/{src-Dlpw-Gh5.mjs → src-CmLn6zYj.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 +2 -2
- package/dist/storage/drizzle/index.mjs +1 -1
- package/dist/storage/handlers/drizzle/index.d.mts +1 -1
- package/dist/storage/handlers/drizzle/index.mjs +1 -1
- package/dist/storage/handlers/index.d.mts +1 -1
- package/dist/storage/handlers/index.mjs +1 -1
- package/dist/testing/index.d.mts +1 -1
- package/dist/{tool-approval-service-rpV94znP.mjs → tool-approval-service-DchkAdAr.mjs} +1 -1
- package/dist/tools/index.d.mts +1 -1
- package/dist/{tools-oQPsY7v2.mjs → tools-r50UBPJ9.mjs} +1 -1
- package/dist/{transition-BeWq5nKg.d.mts → transition-CgsrmsfE.d.mts} +2 -2
- package/dist/{types-FNVbwd7z2.d.mts → types-Bnc-pdB12.d.mts} +1 -1
- package/dist/{types-D4N56a4O.d.mts → types-Dswhi1L9.d.mts} +1 -1
- package/dist/{types-CIEJ91wm.d.mts → types-ZvPhKp3j.d.mts} +8 -8
- package/dist/ui-kernel/index.d.mts +2 -2
- package/dist/ui-kernel/pages/schemas.d.mts +1 -1
- package/dist/{version-3xWJDCeF.mjs → version-sDSWOMn_.mjs} +1 -1
- package/dist/{view-builder-BwGugMWz.d.mts → view-builder-D54kvyf7.d.mts} +10 -10
- package/dist/{visibility-C5sLzqyS.mjs → visibility-syKffo3e.mjs} +1 -1
- package/dist/{worker-qgJToDTN.mjs → worker-DRQGyWAS.mjs} +1 -1
- package/dist/{worker-Csadr_du.mjs → worker-DzbPk2YI.mjs} +1 -1
- package/dist/{workflow-Cb2Pj1h3.mjs → workflow-D-yrAZW8.mjs} +1 -1
- 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 +62 -62
- package/dist/workflow-engine/index.mjs +1 -1
- package/dist/workflow-engine/package.d.mts +1 -1
- package/dist/workflow-engine/package.mjs +1 -1
- package/dist/workflow-engine/provider-operation.d.mts +1 -1
- package/dist/workflow-engine/testing/conformance.d.mts +1 -1
- package/dist/workflow-engine/testing/conformance.mjs +2 -2
- package/dist/workflow-engine/testing/index.d.mts +3 -1
- package/dist/workflow-engine/testing/index.mjs +1 -1
- package/dist/workflow-engine/testing/sqlite.d.mts +1 -1
- package/dist/workflow-engine/testing/sqlite.mjs +66 -61
- package/dist/workflow-engine/workflow-orchestrator.d.mts +1 -1
- package/dist/workflow-engine/workflow-orchestrator.mjs +1 -1
- package/dist/{workflow-transitions-BI7PbrXv.mjs → workflow-transitions-D5RvMSnf.mjs} +1 -1
- package/dist/workflow-worker-CrnDwpkP.mjs +2 -0
- package/package.json +5 -1
- package/dist/artifact-nArLAotB.mjs +0 -1
- package/dist/authority-state-bootstrap-DnwkMieA.mjs +0 -1
- package/dist/bootstrap-start-client-Bdv-_2Q9.mjs +0 -1
- package/dist/execution-attempt-repository-DXyh1hgz.mjs +0 -1
- package/dist/model-B6t_-_sp.mjs +0 -1
- package/dist/namespace-D4zmxaC4.mjs +0 -1
- package/dist/package-DKfzsJVl.mjs +0 -7
- package/dist/schemas-FiFC_DI6.mjs +0 -1
- package/dist/workflow-worker-Db7EBUgh.mjs +0 -2
- /package/dist/{adapter-binding-BU7STlfd.d.mts → adapter-binding-DhANVB-O.d.mts} +0 -0
- /package/dist/{ajv-Dtk5hCZS.mjs → ajv-IlnfOGAj.mjs} +0 -0
- /package/dist/{attach-error-B-vXQFLQ.mjs → attach-error-DOlUtquX.mjs} +0 -0
- /package/dist/{attempt-fixtures-C-jQE_7B.mjs → attempt-fixtures-CMx-2OlG.mjs} +0 -0
- /package/dist/{base-orchestrator-DXiejwQ3.d.mts → base-orchestrator-tAgnJAKu.d.mts} +0 -0
- /package/dist/{capability-Bw4tsDQu.mjs → capability-BQHyskJB.mjs} +0 -0
- /package/dist/{client-BwFqO0cG.d.mts → client-At2zn3yg.d.mts} +0 -0
- /package/dist/{client-binary-version-verifier-DHBAzg3-.mjs → client-binary-version-verifier-DLziUQhw.mjs} +0 -0
- /package/dist/{client-binary-version-verifier-DySlUy9m.d.mts → client-binary-version-verifier-EOj8xXqm.d.mts} +0 -0
- /package/dist/{clients-namespace-Dh0SNZcQ.d.mts → clients-namespace-CVRwXq8f.d.mts} +0 -0
- /package/dist/{config-namespace-CZqPIAWt.d.mts → config-namespace-D7GbrasR.d.mts} +0 -0
- /package/dist/{create-static-mount-GSdckRQx.mjs → create-static-mount-BIH26VH8.mjs} +0 -0
- /package/dist/{cross-spawn-Bx_VEdpd.mjs → cross-spawn-Bi05YtQQ.mjs} +0 -0
- /package/dist/{cursor-storage-Co4itf44.mjs → cursor-storage-88xtgVAd.mjs} +0 -0
- /package/dist/{definition-D3HjoK-4.d.mts → definition-VK1rERAp.d.mts} +0 -0
- /package/dist/{definitions-CYZTuMdL.mjs → definitions-2T95Q-y6.mjs} +0 -0
- /package/dist/{descriptor-to-package-CZLujoiv.mjs → descriptor-to-package-GVZk9ZGT.mjs} +0 -0
- /package/dist/{drizzle-me-95ICP.mjs → drizzle-BrlzkYoe.mjs} +0 -0
- /package/dist/{esm-DILYVXmW.mjs → esm-B3t30-13.mjs} +0 -0
- /package/dist/{event-DmQPb5MB.mjs → event-DFI0F1Ws.mjs} +0 -0
- /package/dist/{extension-context-Cx8CetW3.d.mts → extension-context-Cpf_n5FH.d.mts} +0 -0
- /package/dist/{extension-discovery-CZkaPQBo.d.mts → extension-discovery-B0ZL076T.d.mts} +0 -0
- /package/dist/{extension-namespace-twXNwE4R.mjs → extension-namespace-CWfV3IiR.mjs} +0 -0
- /package/dist/{extension-package-provenance-BzvG6rDO.mjs → extension-package-provenance-Dr7JXjLS.mjs} +0 -0
- /package/dist/{facet-Cly0VpTI.mjs → facet-6tnSbjXc.mjs} +0 -0
- /package/dist/{filesystem-service-UYYyRL2y.d.mts → filesystem-service-BWoNtujU.d.mts} +0 -0
- /package/dist/{handler-BYQPNm8O.mjs → handler-CFT7_osu.mjs} +0 -0
- /package/dist/{host-CiHn8Yog.mjs → host-D7v3YlDG.mjs} +0 -0
- /package/dist/{identity-BULrIHmo.mjs → identity-CxMRRAXx.mjs} +0 -0
- /package/dist/{index-B5kqAW7h.d.mts → index-8a41yDOl.d.mts} +0 -0
- /package/dist/{index-Dmwnhnio2.d.mts → index-BBkJsViX2.d.mts} +0 -0
- /package/dist/{index-DNp9DP6W.d.mts → index-BL1F1xYB.d.mts} +0 -0
- /package/dist/{index-BCKhrNLC.d.mts → index-BTHdi23O.d.mts} +0 -0
- /package/dist/{index-BU8uFswE.d.mts → index-BcPO9w0j.d.mts} +0 -0
- /package/dist/{index-DcG3r0VL.d.mts → index-Bk0Xjk-B.d.mts} +0 -0
- /package/dist/{index-DGlSbpgS2.d.mts → index-Bn1JTbn_2.d.mts} +0 -0
- /package/dist/{index-CYUhTE552.d.mts → index-C75h1xHF2.d.mts} +0 -0
- /package/dist/{index-DB4Xggtt.d.mts → index-CDA33y5A.d.mts} +0 -0
- /package/dist/{index-B9-1l1oh.d.mts → index-CSJOBx3H.d.mts} +0 -0
- /package/dist/{index-BAL1FiaJ.d.mts → index-CVh7ZP2I.d.mts} +0 -0
- /package/dist/{index-6wmqw_ng.d.mts → index-Ccaqmi0J.d.mts} +0 -0
- /package/dist/{index-zvoiT54b.d.mts → index-CjazerMN.d.mts} +0 -0
- /package/dist/{index-C_R6ifn9.d.mts → index-DXSVC0bM.d.mts} +0 -0
- /package/dist/{index-D3_QOfke.d.mts → index-Du-eXjEN.d.mts} +0 -0
- /package/dist/{index-DbYjMWlj.d.mts → index-DwKPj8jD.d.mts} +0 -0
- /package/dist/{index-LsZNB_gb.d.mts → index-DwY1Mt9a.d.mts} +0 -0
- /package/dist/{index-C-6g2xzN.d.mts → index-DzHc6hsJ.d.mts} +0 -0
- /package/dist/{index-DQbcfjIb2.d.mts → index-krTCFThl2.d.mts} +0 -0
- /package/dist/{json-value-DyMQrwGz.d.mts → json-value-BKUDMT7k.d.mts} +0 -0
- /package/dist/{jsonl-transport-Dfv3RLzi.mjs → jsonl-transport-3yp3clGp.mjs} +0 -0
- /package/dist/{lib-BdfAJKDj.mjs → lib-DF6sgNx_.mjs} +0 -0
- /package/dist/{model-registry-B7ThN_s3.mjs → model-registry-BTjKBCCw.mjs} +0 -0
- /package/dist/{model-registry-DlUErRRt.mjs → model-registry-CAqJYbXg.mjs} +0 -0
- /package/dist/{modes-CyG4sgs_.mjs → modes-Bo9Vv5c9.mjs} +0 -0
- /package/dist/{namespace-ChjzkJIl.mjs → namespace-0TfAY2J7.mjs} +0 -0
- /package/dist/{namespace-JqvomFSV.d.mts → namespace-B1sjokHd.d.mts} +0 -0
- /package/dist/{namespace-De25c2ds.d.mts → namespace-B3MnuAqp.d.mts} +0 -0
- /package/dist/{namespace-BFlSY040.mjs → namespace-BCSJz417.mjs} +0 -0
- /package/dist/{namespace-DAbT1F_n.d.mts → namespace-BHb_9sh4.d.mts} +0 -0
- /package/dist/{namespace-BQ7eiQwr.d.mts → namespace-BNNFD-ul.d.mts} +0 -0
- /package/dist/{namespace-69c5HXtL.d.mts → namespace-BgaVgd00.d.mts} +0 -0
- /package/dist/{namespace-CBf5xG_A.d.mts → namespace-BiEV44Mk.d.mts} +0 -0
- /package/dist/{namespace-B8kUQpwo.mjs → namespace-CDoyzyV4.mjs} +0 -0
- /package/dist/{namespace-B7fMkHmy.d.mts → namespace-CjmNxtr1.d.mts} +0 -0
- /package/dist/{namespace-BoOLmi67.d.mts → namespace-Cy62a3YP.d.mts} +0 -0
- /package/dist/{namespace-CIF_1OWi.d.mts → namespace-Czr38fiF.d.mts} +0 -0
- /package/dist/{namespace-C9d0aoYT.mjs → namespace-DORNUF0_.mjs} +0 -0
- /package/dist/{namespace-QXCaZK3I.mjs → namespace-DX3QsYpv.mjs} +0 -0
- /package/dist/{namespace-ZN49zpqw.mjs → namespace-Dyxpur8_.mjs} +0 -0
- /package/dist/{namespace-CUXZS_Ia.d.mts → namespace-btfJrUf6.d.mts} +0 -0
- /package/dist/{namespace-DAW4OY3-.d.mts → namespace-fEBskugJ.d.mts} +0 -0
- /package/dist/{out-Cn6vBxlH.mjs → out-og8659Ny.mjs} +0 -0
- /package/dist/{ownership-recovery-guard-Ce9-C5Sa.mjs → ownership-recovery-guard-CYA5CsiO.mjs} +0 -0
- /package/dist/{package-D4eLGGv4.mjs → package-BecmlOXC.mjs} +0 -0
- /package/dist/{platform-C-fDsuEl.mjs → platform-BdLHWgVc.mjs} +0 -0
- /package/dist/{providers-DVlsnJaY.mjs → providers-DGTA-lki.mjs} +0 -0
- /package/dist/{providers-namespace-DcPil5uz.d.mts → providers-namespace-Bming6U8.d.mts} +0 -0
- /package/dist/{quick-lru-CVryNCTx.mjs → quick-lru-bVGGo5bq.mjs} +0 -0
- /package/dist/{registry-Q9gCZtxz.mjs → registry-Cu3eD3UY.mjs} +0 -0
- /package/dist/{runtime-inputs-CMjGjK7W.d.mts → runtime-inputs-DeOea-ab.d.mts} +0 -0
- /package/dist/{schema-DIgKUfuF.d.mts → schema-DFCBjTB7.d.mts} +0 -0
- /package/dist/{schema-introspection-CSnLZJpC.mjs → schema-introspection-BsWP1vGC.mjs} +0 -0
- /package/dist/{schema-DIHGEQx3.mjs → schema-mXXJcaQT.mjs} +0 -0
- /package/dist/{schemas-BKnJj2i-.mjs → schemas-7fHmNUQc.mjs} +0 -0
- /package/dist/{schemas-BFgsIiSb.mjs → schemas-BE-gfjGI.mjs} +0 -0
- /package/dist/{schemas-CM3Ejp-n.d.mts → schemas-BLy33xay.d.mts} +0 -0
- /package/dist/{schemas-Ge_bamoP.d.mts → schemas-BkCqhK3X.d.mts} +0 -0
- /package/dist/{schemas-NwKrrrPF.d.mts → schemas-Cz7H2f7S.d.mts} +0 -0
- /package/dist/{schemas-DYeS-mtz.d.mts → schemas-DGKWi7mk.d.mts} +0 -0
- /package/dist/{schemas-Vv0GtBaZ.d.mts → schemas-DTBWnWjN.d.mts} +0 -0
- /package/dist/{schemas-COnD70WD.d.mts → schemas-DYIVJDlx.d.mts} +0 -0
- /package/dist/{schemas-qbaSxHDL.d.mts → schemas-DqWwz4eR.d.mts} +0 -0
- /package/dist/{schemas-DTyZjKQf2.d.mts → schemas-GyKYcV-Z2.d.mts} +0 -0
- /package/dist/{schemas-CnFVygzI.mjs → schemas-HffXbw8C.mjs} +0 -0
- /package/dist/{schemas-CbhvgFQs.mjs → schemas-MIYusvwn.mjs} +0 -0
- /package/dist/{schemas-BapfTRqp.mjs → schemas-NYUz8K9Q.mjs} +0 -0
- /package/dist/{semver-D_D2mA48.mjs → semver-_h8-BJ8k.mjs} +0 -0
- /package/dist/{server-lifecycle-BPAN-b0i.d.mts → server-lifecycle-_m_x1_TC.d.mts} +0 -0
- /package/dist/{shared-schemas-kUho6Kmw.mjs → shared-schemas-CaL1iEk6.mjs} +0 -0
- /package/dist/{src-Du_285FN.mjs → src-DdaPoQOD.mjs} +0 -0
- /package/dist/{storage-namespace-Dtz2G1if.mjs → storage-namespace-DBuKMBth.mjs} +0 -0
- /package/dist/{storage-namespace-definition-BJCbqVWz.mjs → storage-namespace-definition-4UYuij1r.mjs} +0 -0
- /package/dist/{storage-namespace-definition-D6soSjKE.d.mts → storage-namespace-definition-CsaZPU3n.d.mts} +0 -0
- /package/dist/{storage-namespace-C9oFExfb.d.mts → storage-namespace-zRXWqAfO.d.mts} +0 -0
- /package/dist/{supports-color-BNmyqLq0.mjs → supports-color-DG_rcVqJ.mjs} +0 -0
- /package/dist/{telemetry-CUkZrhW6.mjs → telemetry-BLYrkonr.mjs} +0 -0
- /package/dist/{timeout-DeBYTGBR.mjs → timeout-d0dzIY3V.mjs} +0 -0
- /package/dist/{tray-menu-service-TWrmvXSo.mjs → tray-menu-service-BGwXKJYr.mjs} +0 -0
- /package/dist/{types-D9GJ7FyQ.mjs → types-Bh2fQoxM.mjs} +0 -0
- /package/dist/{types-BOsf2SVm.d.mts → types-CccTiXH2.d.mts} +0 -0
- /package/dist/{types-DZvkUmHS.d.mts → types-DXGVwrQn.d.mts} +0 -0
- /package/dist/{types-BZnJ_4e2.d.mts → types-DjxvRcX6.d.mts} +0 -0
- /package/dist/{types-CWgYlxjU.d.mts → types-nor1SQLZ.d.mts} +0 -0
- /package/dist/{ui-config-9hlZAJOS.mjs → ui-config-CsH94fwa.mjs} +0 -0
- /package/dist/{variant-73kFgYBK.mjs → variant-BZ9UcJBi.mjs} +0 -0
- /package/dist/{window-registry-Bvjvpwhn.d.mts → window-registry-DQ7udUzI.d.mts} +0 -0
- /package/dist/{window-registry-CzAwaPKL.mjs → window-registry-DQkv5wM9.mjs} +0 -0
- /package/dist/{zod-json-schema-B1mZz7S4.mjs → zod-json-schema-DGWHUOK0.mjs} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { I as RecordAllocationInput, Mt as AttemptOutcomeControlObservation, P as ProvisioningClaimDecision, Pt as ExecutionAttemptCancellationIntent, dt as ProviderOperationOwnershipRecord, it as ProviderOperationClaim, j as OutcomeCodec, r as AllocationRecordingDecision, rt as ProcessBoundProvisionerLossProof, s as AttemptControlState, u as BeginProvisioningInput, w as ExecutionOwnerId, x as ExecutionAttemptRepository, y as ExecutionAttemptRecord } from "../../execution-attempt-repository--RVils5-.mjs";
|
|
2
2
|
import { BoundedRecoveryEvidence, ExecutionAttemptInstruction, ExecutionAttemptPreparationResult, ProviderAllocationRef, WorkerAllocationLifetime, WorkflowRunResult } from "@makaio/framework/contracts";
|
|
3
3
|
|
|
4
4
|
//#region subsystems/workflow-engine/src/testing/attempt-record-codec.d.ts
|
|
@@ -43,6 +43,8 @@ interface InMemoryAttemptRepositoryState {
|
|
|
43
43
|
* freeze can protect.
|
|
44
44
|
*/
|
|
45
45
|
readonly committedOutcomes: Map<string, string>;
|
|
46
|
+
/** Commit-time control facts, absent only for outcomes created before this observation existed. */
|
|
47
|
+
readonly outcomeControlObservations: Map<string, AttemptOutcomeControlObservation>;
|
|
46
48
|
/** Active attempt per `executionId`, the fence every bootstrap path reads. */
|
|
47
49
|
readonly activeAttempts: Map<string, string>;
|
|
48
50
|
/** Request-to-attempt bindings, nested by owner and then opaque request key. */
|
|
@@ -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-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=N.cancellations??new Map,V=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)})},H=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}},U=(e,t)=>{e.completionEvidence===null&&F.set(e.executionAttemptId,{...e,completionEvidence:t})},W=(e,t)=>{let n=k(e.allocationRef),r=H(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`}},G={async getAttemptWithAllocation(e){return P.get(e)??null},async recordDiscoveredAllocation(e){return W(e,!1)},async evolveAllocationRef(e){let{currentRef:t,nextRef:n}=b(e),r=H(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)}},J=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 J({...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=J(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.operationStartGate===`closed`)return{kind:`fenced`};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=H(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=H(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=H(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?(U(r,t),n.settlementKind===null?{kind:`evidence-recorded`}:{kind:`completed`}):{kind:`evidence-recorded`}},async recordAllocation(e){return W(e,!0)},async recordProvisioningAbsent(e){let t=K.parse(e.evidence),n=H(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`)),U(i,t),{kind:`recorded`}):(U(i,t),{kind:`completed`}):{kind:`allocated`,allocationRef:r.allocationRef}:{kind:`not-found`}},async recordProvisionerIncarnationLost(e){let t=K.parse(e.proof.evidence),n=H(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`)),U(i,t),{kind:`recorded`}):(U(i,t),{kind:`completed`}):o},async recordAllocationTerminated(e){let t=K.parse(e.evidence),n=H(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=H(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=V(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=V(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=V(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 requestCancellation(e){let t={requestedAt:new Date().toISOString(),...e.reason===void 0?{}:{reason:e.reason}};for(let[n,r]of P)r.executionId===e.executionId&&(B.has(n)||B.set(n,t),P.set(n,{...r,operationStartGate:`closed`}))},async readCancellation(e){let t=B.get(e);return t===void 0?null:{...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:G,attempts:P,operations:F,committedOutcomes:L,activeAttempts:R,requestBindings:z,cancellations:B}}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
|
+
import{_ as e,a as t,b as n,c as r,d as i,f as a,g as o,h as ee,l as s,m as c,n as l,o as u,s as d,u as f,v as p,x as m,y as h}from"../../execution-attempt-repository-CWbgCTwA.mjs";import{a as g,i as _,n as v,o as y,t as b}from"../../execution-attempt-owner-recovery-D4APLAvt.mjs";import{isProviderOperationResolved as x}from"../provider-operation.mjs";import{a as S,c as C,d as w,f as T,i as E,l as D,n as O,o as k,p as A,r as j,s as M,t as N,u as P}from"../../attempt-record-codec-D2Gb_epJ.mjs";import{a as F,c as I,d as L,f as R,i as z,l as B,m as V,n as H,o as U,p as W,r as G,s as K,t as q,u as J}from"../../attempt-fixtures-CMx-2OlG.mjs";import{randomUUID as Y}from"node:crypto";import{BoundedRecoveryEvidenceSchema as X}from"@makaio/framework/contracts";function Z(e,t){return{...e,status:`settled`,settlementKind:t,claimable:!1,operationStartGate:`closed`}}function Q(F,I={}){let L=I.attempts??new Map,R=I.operations??new Map,z=e=>R.get(e)?.obligation===`terminal-convergence`,B=I.committedOutcomes??new Map,V=I.outcomeControlObservations??new Map,H=I.activeAttempts??new Map,U=I.requestBindings??new Map,W=I.cancellations??new Map,G=e=>{let t=e.settlementKind!=null,n=!t&&H.get(e.executionId)===e.executionAttemptId;return ee({matchesExecution:!0,settled:t,active:n,allocated:n&&e.allocationRef!==null&&!z(e.executionAttemptId)})},K=e=>{let t=L.get(e.executionAttemptId),n=R.get(e.executionAttemptId);return!t||!n?{kind:`not-found`}:x(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}},q=(e,t)=>{e.completionEvidence===null&&R.set(e.executionAttemptId,{...e,completionEvidence:t})},J=(e,t)=>{let n=M(e.allocationRef),r=K(e.claim);if(r.kind!==`not-found`&&w(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 d(i.allocationRef,n)?{kind:`duplicate`,allocationRef:i.allocationRef}:{kind:`conflict`,allocationRef:i.allocationRef};let o=H.get(i.executionId)===i.executionAttemptId;return L.set(i.executionAttemptId,{...i,status:i.settlementKind===null?`allocated`:i.status,allocationRef:n,claimable:i.settlementKind===null&&t&&o}),R.set(a.executionAttemptId,{...a,obligation:`allocation-control`}),{kind:`recorded`}},Q={async getAttemptWithAllocation(e){return L.get(e)??null},async recordDiscoveredAllocation(e){return J(e,!1)},async evolveAllocationRef(e){let{currentRef:t,nextRef:n}=C(e),r=K(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`}:d(i.allocationRef,t)?(L.set(i.executionAttemptId,{...i,allocationRef:n}),{kind:`evolved`}):{kind:`stale`,storedRef:i.allocationRef}:{kind:`not-found`}},async getRecoverableAttempts(e){let t=E(new Date().toISOString()),n=[];for(let r of L.values())r.executionId===e&&r.status===`allocated`&&r.allocationRef!==null&&r.claimable===!0&&r.settlementKind==null&&(r.claimExpiresAt!=null&&E(r.claimExpiresAt)<t||n.push(A(r)));return n.sort(O)},async listOpenProviderOperations(e){if(!Number.isSafeInteger(e.limit)||e.limit<=0)throw RangeError(`limit must be a positive safe integer`);let t=E(e.observedAt),n=[];for(let e of R.values()){let r=L.get(e.executionAttemptId);!r||x(r,e)||e.ownerId!==null&&e.leaseExpiresAt!==null&&E(e.leaseExpiresAt)>t||n.push({attempt:r,operation:e})}return n.sort((e,t)=>O(e.attempt,t.attempt)).slice(0,e.limit)}},$=e=>{let t=j(e.bootstrapTimeoutMs);if(L.has(e.executionAttemptId))throw new l(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,...N},r=H.get(e.executionId),i=r===void 0?void 0:L.get(r);return i!==void 0&&L.set(i.executionAttemptId,{...i,claimable:i.status===`allocated`?!1:i.claimable,operationStartGate:`closed`}),L.set(e.executionAttemptId,n),H.set(e.executionId,e.executionAttemptId),n};return{async createAttempt(e){return $({...e,instruction:y(e.instruction)})},async ensureAttempt(e){let t=_(e),n=U.get(t.executionId),r=n?.get(t.requestKey);if(r!==void 0)return v(t,L.get(r)??null);let i=$(t),a=n??new Map;return a.set(t.requestKey,i.executionAttemptId),U.set(t.executionId,a),{kind:`created`,attempt:structuredClone(i)}},async readAttemptSettlement(e){let t=g(e);return b(t,{attempt:L.get(t.executionAttemptId)??null,activeAttemptId:H.get(t.executionId)??null,outcomeText:B.get(t.executionAttemptId)??null,controlObservation:V.get(t.executionAttemptId)??null},F)},async readBootstrapStartState(e){let t=L.get(e.executionAttemptId);return!t||t.executionId!==e.executionId?null:{settled:t.settlementKind!=null,active:H.get(e.executionId)===e.executionAttemptId,allocated:t.allocationRef!==null,allocationTerminated:z(e.executionAttemptId),operationStartGate:t.operationStartGate,bootstrapDeadlineAt:t.bootstrapDeadlineAt??null}},async beginProvisioning(e){let t=k(e.allocationLifetime),n=L.get(e.executionAttemptId);if(!n||n.executionId!==e.executionId)return{kind:`not-found`};if(H.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.operationStartGate===`closed`)return{kind:`fenced`};if(n.status!==`pending`)return{kind:`already-provisioning`};L.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:S(e.leaseExpiresAt)};return R.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 R.get(e)??null},async renewProviderOperationClaim(e){let t=K(e.claim);if(t.kind!==`authorized`)return{kind:t.kind};let n=S(e.leaseExpiresAt);return R.set(e.claim.executionAttemptId,{...t.operation,leaseExpiresAt:n}),{kind:`claimed`,claim:{...e.claim,leaseExpiresAt:n}}},async takeOverProviderOperation(e){let t=L.get(e.executionAttemptId),n=R.get(e.executionAttemptId);if(!t||!n)return{kind:`not-found`};if(x(t,n))return{kind:`resolved`};if(n.ownerId!==null&&n.leaseExpiresAt!==null&&E(n.leaseExpiresAt)>E(e.observedAt))return{kind:`stale`};let r={executionAttemptId:e.executionAttemptId,generation:n.generation+1,ownerId:e.ownerId,token:crypto.randomUUID(),leaseExpiresAt:S(e.leaseExpiresAt)};return R.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:X.parse(e.evidence),n=K(e.claim);return n.kind===`authorized`?(R.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=X.parse(e.evidence),n=K(e.claim);return n.kind===`authorized`?(R.set(e.claim.executionAttemptId,{...n.operation,failureCount:n.operation.failureCount+1,lastFailure:t}),{kind:`recorded`}):{kind:n.kind}},async completeProviderOperation(e){let t=X.parse(e.evidence),n=L.get(e.claim.executionAttemptId),r=R.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`}:x(n,r)?{kind:`already-completed`}:r.completionEvidence===null?(q(r,t),n.settlementKind===null?{kind:`evidence-recorded`}:{kind:`completed`}):{kind:`evidence-recorded`}},async recordAllocation(e){return J(e,!0)},async recordProvisioningAbsent(e){let t=X.parse(e.evidence),n=K(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?(L.set(r.executionAttemptId,Z(r,`abandoned`)),q(i,t),{kind:`recorded`}):(q(i,t),{kind:`completed`}):{kind:`allocated`,allocationRef:r.allocationRef}:{kind:`not-found`}},async recordProvisionerIncarnationLost(e){let t=X.parse(e.proof.evidence),n=K(e.claim);if(n.kind!==`authorized`)return{kind:n.kind};let{attempt:r,operation:i}=n,a=h(r,e);return a===null?r.settlementKind===null?(L.set(r.executionAttemptId,Z(r,`abandoned`)),q(i,t),{kind:`recorded`}):(q(i,t),{kind:`completed`}):a},async recordAllocationTerminated(e){let t=X.parse(e.evidence),n=K(e.claim);if(n.kind!==`authorized`)return{kind:n.kind};let{attempt:r,operation:i}=n;return r.allocationRef===null?{kind:`not-allocated`}:(R.set(i.executionAttemptId,{...i,obligation:`terminal-convergence`,lastFailure:t}),{kind:`recorded`})},async recordInfrastructureFailure(e){let t=K(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`?(L.set(n.executionAttemptId,Z(n,`infrastructure-failure`)),{kind:`recorded`}):{kind:`not-terminated`}:{kind:`resolved`}:{kind:`not-found`}},async registerRuntime(e){let t=L.get(e.executionAttemptId);if(t===void 0||t.executionId!==e.executionId)return{kind:`not-found`};let n=G(t)??m(t,e);if(n!==null)return n;let r=t.runtimeGeneration+1;return L.set(t.executionAttemptId,{...t,runtimeGeneration:r,runtimeIncarnationId:e.runtimeIncarnationId,runtimeReadyAt:null,activeOperationId:null,activeOperationKind:null,activeOperationKey:null,activeOperationGeneration:null,activeOperationAdmittedAt:null}),{kind:`registered`,runtimeGeneration:r}},async admitOperation(e){let t=L.get(e.executionAttemptId);if(t===void 0||t.executionId!==e.executionId)return{kind:`not-found`};let n=G(t);if(n!==null)return n;let r=o(t,e,t.activeOperationId!==null&&t.activeOperationKey===e.admissionKey&&t.activeOperationAdmittedAt===null?S(new Date().toISOString()):``,t);if(r!==null)return r;let i=crypto.randomUUID(),a=S(new Date().toISOString());return L.set(t.executionAttemptId,{...t,activeOperationId:i,activeOperationKind:e.operationKind,activeOperationKey:e.admissionKey,activeOperationGeneration:t.runtimeGeneration,activeOperationAdmittedAt:a}),{kind:`admitted`,operationId:i,runtimeGeneration:t.runtimeGeneration,admittedAt:a}},async getInstruction(e){let t=L.get(e.executionAttemptId);return t?.executionId===e.executionId?t.instruction:null},async reportOperation(e){let t=P(e.result),n=L.get(e.executionAttemptId);if(n===void 0||n.executionId!==e.executionId)return{kind:`not-found`};let r=p({matchesExecution:!0,settled:n.settlementKind!=null,active:H.get(e.executionId)===e.executionAttemptId,allocated:n.allocationRef!==null&&!z(e.executionAttemptId)},n,n,{...e,result:t});if(r!==null)return r;let i=D([...n.preparationReceipts,{operationId:e.operationId,runtimeGeneration:e.runtimeGeneration,result:t}]);return L.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(t){let n=L.get(t.executionAttemptId);if(n===void 0)return{kind:`not-found`};if(n.settlementKind!=null)return{kind:`resolved`};let r=e(n,t);return r===null?(L.set(n.executionAttemptId,{...n,activeOperationId:null,activeOperationKind:null,activeOperationKey:null,activeOperationGeneration:null,activeOperationAdmittedAt:null,lastCompletedOperationId:t.operationId}),{kind:`completed`}):r},async markRuntimeReady(e){let t=S(e.readyAt),r=L.get(e.executionAttemptId);if(r===void 0||r.executionId!==e.executionId)return{kind:`not-found`};let i=G(r)??n(r,e);return i===null?(L.set(r.executionAttemptId,{...r,runtimeReadyAt:t}),{kind:`ready`,acceptedAt:t}):i},async getAttemptControlState(e){let t=L.get(e);return t===void 0?null:T(t)},async requestAttemptCancellation(e){let t=i(e),n=L.get(t.executionAttemptId);if(n===void 0||n.executionId!==t.executionId)return{kind:`not-found`};let r=s(W.get(t.executionAttemptId)??null,t,new Date().toISOString());return r.kind===`conflict`?r:(W.set(t.executionAttemptId,{...r.intent}),L.set(t.executionAttemptId,{...n,operationStartGate:`closed`}),r)},async requestCancellation(e){let t=a(e),n={...t,requestKey:Y()},r=new Date().toISOString(),i=[...L].filter(([,e])=>e.executionId===t.executionId).map(([e,t])=>{let i=s(W.get(e)??null,n,r);if(i.kind===`conflict`)throw Error(`Conflicting generated cancellation request key`);return{id:e,attempt:t,intent:i.intent}});for(let{id:e,attempt:t,intent:n}of i)W.set(e,{...n}),L.set(e,{...t,operationStartGate:`closed`})},async readCancellation(e){let t=W.get(e);return t===void 0?null:{...t}},async getActiveAttempt(e,t){return H.get(e)===t?L.get(t)??null:null},canonicalizeOutcome(e){return u(F,e)},decodeOutcome(e){return t(F,e)},async commitOutcome(e){let n=e.result;if(H.get(e.executionId)!==e.executionAttemptId)return{kind:`fenced`};let i=L.get(e.executionAttemptId);if(i===void 0)return{kind:`fenced`};let a=B.get(e.executionAttemptId);if(a!==void 0){let i=t(F,a);return r(a,n.text)?{kind:`duplicate`,outcome:i,text:a,controlObservation:structuredClone(V.get(e.executionAttemptId)??null)}:{kind:`conflict`}}if(i.settlementKind!=null)return{kind:`conflict`};c(i,e.runtimeFence);let o=f(W.get(e.executionAttemptId)??null);return B.set(e.executionAttemptId,n.text),V.set(e.executionAttemptId,o),L.set(e.executionAttemptId,Z(i,`outcome`)),{kind:`accepted`,outcome:t(F,n.text),text:n.text,controlObservation:structuredClone(o)}},async abandonPendingAttempt(e,t){if(H.get(t)!==e)return{kind:`fenced`};let n=L.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`}:(L.set(e,Z(n,`abandoned`)),{kind:`abandoned`}):{kind:`fenced`}},recovery:Q,attempts:L,operations:R,committedOutcomes:B,outcomeControlObservations:V,activeAttempts:H,requestBindings:U,cancellations:W}}export{N as INITIAL_ATTEMPT_CONTROL_STATE,q as TEST_OWNER_ID,H as TEST_PROVIDER_ID,G as TEST_PROVISIONER_INCARNATION_ID,z as allocateTestAttempt,F as beginTestProvisioning,Q as createInMemoryAttemptRepository,U as driveTestAttemptToAllocated,K as leaseAt,I as makeBeginProvisioningInput,B as makeEvidence,J as makeProcessLossProof,L as makeTestAllocationRef,R as makeTestInstruction,W as makeTestWorkflowResult,V as workflowRunResultOutcomeCodec};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { j as OutcomeCodec, x as ExecutionAttemptRepository } from "../../execution-attempt-repository--RVils5-.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,5 +1,7 @@
|
|
|
1
|
-
import{_ as e,
|
|
1
|
+
import{_ as e,a as t,b as n,c as r,d as i,f as a,g as o,h as s,i as c,l,m as ee,n as te,o as ne,r as u,s as d,t as f,u as re,v as ie,x as ae,y as oe}from"../../execution-attempt-repository-CWbgCTwA.mjs";import{a as se,i as ce,n as le,o as p,t as ue}from"../../execution-attempt-owner-recovery-D4APLAvt.mjs";import{PROVIDER_OPERATION_OBLIGATIONS as m,isProviderOperationResolved as h}from"../provider-operation.mjs";import{a as g,c as de,d as fe,i as _,l as v,o as pe,p as me,r as y,s as he,t as ge,u as _e}from"../../attempt-record-codec-D2Gb_epJ.mjs";import{z as b}from"zod";import{BoundedRecoveryEvidenceSchema as x,ExecutionAttemptOperationKindSchema as S,ProviderAllocationRefSchema as C,WorkerAllocationLifetimeSchema as w}from"@makaio/framework/contracts";import{getRawSqlExecutor as ve,isSqliteUniqueViolationError as ye,serializeByKey as T,serializeDatabaseOperation as be}from"@makaio/framework/storage/drizzle";import{sql as E}from"drizzle-orm";const xe=[`CREATE TABLE IF NOT EXISTS test_execution_attempt_cancellation (
|
|
2
2
|
execution_attempt_id TEXT PRIMARY KEY,
|
|
3
|
+
request_key TEXT NOT NULL,
|
|
4
|
+
control_revision INTEGER NOT NULL,
|
|
3
5
|
requested_at TEXT NOT NULL,
|
|
4
6
|
reason TEXT
|
|
5
7
|
)`,`CREATE TABLE IF NOT EXISTS test_execution_attempt (
|
|
@@ -14,6 +16,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
|
|
|
14
16
|
allocation_ref TEXT,
|
|
15
17
|
settlement_kind TEXT,
|
|
16
18
|
workflow_result TEXT,
|
|
19
|
+
outcome_control_observation TEXT,
|
|
17
20
|
claimable INTEGER NOT NULL DEFAULT 0,
|
|
18
21
|
claim_expires_at TEXT,
|
|
19
22
|
created_at TEXT NOT NULL,
|
|
@@ -49,54 +52,60 @@ 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
|
|
|
49
52
|
failure_count INTEGER NOT NULL DEFAULT 0,
|
|
50
53
|
last_failure TEXT,
|
|
51
54
|
completion_evidence TEXT
|
|
52
|
-
)`];function
|
|
55
|
+
)`];function D(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 O(e,t){return e===null?null:t(JSON.parse(e))}const k=b.object({requestKey:b.string().min(1),controlRevision:b.number().int().positive(),requestedAt:b.string().datetime(),reason:b.string().optional()}),A=b.object({controlRevision:b.number().int().nonnegative(),cancellation:k.nullable()});function j(e){if(e===null)return null;let t=A.parse(JSON.parse(e));if(t.controlRevision!==(t.cancellation?.controlRevision??0))throw Error(`Stored outcome control revision does not match its cancellation receipt`);return t}function M(e){return{runtimeGeneration:e.runtime_generation,runtimeIncarnationId:e.runtime_incarnation_id,runtimeReadyAt:e.runtime_ready_at,operationStartGate:D(f,e.operation_start_gate,`operation_start_gate`),activeOperationId:e.active_operation_id,activeOperationKind:e.active_operation_kind===null?null:S.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:p(JSON.parse(e.instruction)),preparationReceipts:v(JSON.parse(e.preparation_receipts)),status:D(c,e.status,`status`),allocationRef:O(e.allocation_ref,e=>C.parse(e)),createdAt:e.created_at,bootstrapDeadlineAt:e.bootstrap_deadline_at,providerId:e.provider_id,allocationLifetime:e.allocation_lifetime===null?null:w.parse(e.allocation_lifetime),provisionerIncarnationId:e.provisioner_incarnation_id,settlementKind:e.settlement_kind===null?null:D(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:D(m,e.obligation,`obligation`),failureCount:e.failure_count,lastFailure:O(e.last_failure,e=>x.parse(e)),completionEvidence:O(e.completion_evidence,e=>x.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 Se(e){for(let t=0;;t+=1)try{await e.run(E.raw(`COMMIT`));return}catch(e){if(!L(e)||t===100)throw e;await z()}}async function Ce(e,t){return T(F,e,t)}async function we(e,t){return T(I,e,t)}const B=new WeakMap;async function Te(e,t){let n=(await t.all(E.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 E`EXISTS (SELECT 1 FROM test_provider_operation
|
|
53
56
|
WHERE execution_attempt_id = ${e.executionAttemptId}
|
|
54
57
|
AND generation = ${e.generation}
|
|
55
58
|
AND owner_id = ${e.ownerId}
|
|
56
|
-
AND token = ${e.token})`}function U(e){return
|
|
59
|
+
AND token = ${e.token})`}function U(e){return E`(completion_evidence IS NULL
|
|
57
60
|
OR NOT EXISTS (SELECT 1 FROM test_execution_attempt
|
|
58
61
|
WHERE execution_attempt_id = ${e}
|
|
59
|
-
AND settlement_kind IS NOT NULL))`}function W(e){return
|
|
62
|
+
AND settlement_kind IS NOT NULL))`}function W(e){return E`EXISTS (SELECT 1 FROM test_provider_operation
|
|
60
63
|
WHERE execution_attempt_id = ${e.executionAttemptId}
|
|
61
64
|
AND generation = ${e.generation}
|
|
62
65
|
AND owner_id = ${e.ownerId}
|
|
63
66
|
AND token = ${e.token}
|
|
64
|
-
AND ${U(e.executionAttemptId)})`}function G(e){return
|
|
67
|
+
AND ${U(e.executionAttemptId)})`}function G(e){return E`EXISTS (SELECT 1 FROM test_provider_operation
|
|
65
68
|
WHERE execution_attempt_id = ${e}
|
|
66
|
-
AND obligation = ${`terminal-convergence`})`}function K(){return
|
|
69
|
+
AND obligation = ${`terminal-convergence`})`}function K(){return E`EXISTS (SELECT 1 FROM test_active_execution_attempt
|
|
67
70
|
WHERE execution_id = test_execution_attempt.execution_id
|
|
68
|
-
AND execution_attempt_id = test_execution_attempt.execution_attempt_id)`}async function q(
|
|
71
|
+
AND execution_attempt_id = test_execution_attempt.execution_attempt_id)`}async function q(c,u){let b=ve(c);await b.run(E.raw(`PRAGMA busy_timeout = 0`));let S=await Te(c,b);await Ce(S,async()=>{for(let e of xe)await b.run(E.raw(e));let e=await b.all(E.raw(`PRAGMA table_info(test_execution_attempt)`));e.some(e=>e.name===`bootstrap_deadline_at`)||await b.run(E.raw(`ALTER TABLE test_execution_attempt ADD COLUMN bootstrap_deadline_at TEXT`)),e.some(e=>e.name===`outcome_control_observation`)||await b.run(E.raw(`ALTER TABLE test_execution_attempt ADD COLUMN outcome_control_observation TEXT`));let t=await b.all(E.raw(`PRAGMA table_info(test_execution_attempt_cancellation)`));t.some(e=>e.name===`request_key`)||await b.run(E.raw(`ALTER TABLE test_execution_attempt_cancellation ADD COLUMN request_key TEXT`)),t.some(e=>e.name===`control_revision`)||await b.run(E.raw(`ALTER TABLE test_execution_attempt_cancellation ADD COLUMN control_revision INTEGER NOT NULL DEFAULT 1`));let n=await b.all(E`SELECT execution_attempt_id FROM test_execution_attempt_cancellation WHERE request_key IS NULL`);for(let e of n)await b.run(E`UPDATE test_execution_attempt_cancellation SET request_key = ${crypto.randomUUID()}
|
|
72
|
+
WHERE execution_attempt_id = ${e.execution_attempt_id} AND request_key IS NULL`);(await b.all(E.raw(`PRAGMA table_info(test_provider_operation)`))).some(e=>e.name===`completion_evidence`)||await b.run(E.raw(`ALTER TABLE test_provider_operation ADD COLUMN completion_evidence TEXT`))});let C,w=async e=>be(c,()=>we(S,async()=>{if(C!==void 0)throw Error(`This repository was retired by a failed transaction rollback`,{cause:C});for(let t=0;;t+=1)try{return await b.withSession(async t=>{let n=!1;try{await t.run(E.raw(`BEGIN IMMEDIATE`)),n=!0;let r=await e(t);return await Se(t),r}catch(e){try{await t.run(E.raw(`ROLLBACK`))}catch(t){throw!n&&R(t)?e:(C=AggregateError([e,t],`Transaction rollback failed`),C)}throw e}})}catch(e){if(!L(e)||t===100)throw e;await z()}})),T=async(e,t)=>{let[n]=await e.all(E`SELECT request_key, control_revision, requested_at, reason
|
|
73
|
+
FROM test_execution_attempt_cancellation WHERE execution_attempt_id = ${t}`);return n===void 0?null:k.parse({requestKey:n.request_key,controlRevision:n.control_revision,requestedAt:n.requested_at,...n.reason===null?{}:{reason:n.reason}})},O=async(e,t,n)=>{await e.run(E`INSERT INTO test_execution_attempt_cancellation
|
|
74
|
+
(execution_attempt_id, request_key, control_revision, requested_at, reason)
|
|
75
|
+
VALUES (${t}, ${n.requestKey}, ${n.controlRevision},
|
|
76
|
+
${n.requestedAt}, ${n.reason??null})`),await e.run(E`UPDATE test_execution_attempt SET operation_start_gate = 'closed'
|
|
77
|
+
WHERE execution_attempt_id = ${t}`)},A=async(e,t)=>(await e.all(E`SELECT * FROM test_execution_attempt WHERE execution_attempt_id = ${t}`))[0],F=async(e,t)=>(await e.all(E`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(E`SELECT execution_attempt_id FROM test_active_execution_attempt WHERE execution_id = ${t}`))[0]?.execution_attempt_id??null,q=async(e,t)=>{let n=t.settlement_kind!==null,r=!n&&await B(e,t.execution_id)===t.execution_attempt_id;return s({matchesExecution:!0,settled:n,active:r,allocated:r&&t.allocation_ref!==null&&!await I(e,t.execution_attempt_id)})},J=async(e,t)=>{let n=await A(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 h(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(E`UPDATE test_execution_attempt
|
|
69
78
|
SET status = ${`settled`}, settlement_kind = ${n}, claimable = ${0},
|
|
70
79
|
operation_start_gate = ${`closed`}
|
|
71
80
|
WHERE execution_attempt_id = ${t}
|
|
72
81
|
AND settlement_kind IS NULL
|
|
73
|
-
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(
|
|
82
|
+
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(E`UPDATE test_provider_operation
|
|
74
83
|
SET completion_evidence = ${JSON.stringify(i)}
|
|
75
84
|
WHERE execution_attempt_id = ${t}
|
|
76
85
|
AND ${H(n)}
|
|
77
|
-
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(
|
|
86
|
+
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(E`UPDATE test_provider_operation
|
|
78
87
|
SET completion_evidence = ${JSON.stringify(i)}
|
|
79
88
|
WHERE execution_attempt_id = ${t}
|
|
80
89
|
AND ${H(n)}
|
|
81
|
-
AND completion_evidence IS NULL`)},Q=(e,t)=>{let n=
|
|
90
|
+
AND completion_evidence IS NULL`)},Q=(e,t)=>{let n=he(e.allocationRef),r=t?E`CASE WHEN settlement_kind IS NULL AND ${K()} THEN 1 ELSE 0 END`:E`${0}`;return w(t=>V(async()=>{let i=await J(t,e.claim);if(i.kind!==`not-found`&&fe(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(E`UPDATE test_execution_attempt
|
|
82
91
|
SET status = CASE WHEN settlement_kind IS NULL THEN ${`allocated`} ELSE status END,
|
|
83
92
|
allocation_ref = ${JSON.stringify(n)},
|
|
84
93
|
claimable = ${r}
|
|
85
94
|
WHERE execution_attempt_id = ${a.executionAttemptId}
|
|
86
95
|
AND allocation_ref IS NULL
|
|
87
|
-
AND ${W(e.claim)}`);return i.rowsAffected===0||await t.run(
|
|
88
|
-
WHERE execution_attempt_id = ${a.executionAttemptId}`),i}:
|
|
96
|
+
AND ${W(e.claim)}`);return i.rowsAffected===0||await t.run(E`UPDATE test_provider_operation SET obligation = ${`allocation-control`}
|
|
97
|
+
WHERE execution_attempt_id = ${a.executionAttemptId}`),i}:d(a.allocationRef,n)?{kind:`duplicate`,allocationRef:a.allocationRef}:{kind:`conflict`,allocationRef:a.allocationRef}},{kind:`recorded`}))},Ee={async getAttemptWithAllocation(e){return w(async t=>{let n=await A(t,e);return n===void 0?null:N(n)})},async recordDiscoveredAllocation(e){return Q(e,!1)},async evolveAllocationRef(e){let{currentRef:t,nextRef:n}=de(e);return w(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`}:d(a.allocationRef,t)?()=>r.run(E`UPDATE test_execution_attempt SET allocation_ref = ${JSON.stringify(n)}
|
|
89
98
|
WHERE execution_attempt_id = ${a.executionAttemptId}
|
|
90
99
|
AND execution_id = ${e.executionId}
|
|
91
100
|
AND allocation_ref = ${o.allocation_ref}
|
|
92
|
-
AND ${W(e.claim)}`):{kind:`stale`,storedRef:a.allocationRef}:{kind:`not-found`}},{kind:`evolved`}))},async getRecoverableAttempts(e){return
|
|
101
|
+
AND ${W(e.claim)}`):{kind:`stale`,storedRef:a.allocationRef}:{kind:`not-found`}},{kind:`evolved`}))},async getRecoverableAttempts(e){return w(async t=>{let n=new Date().toISOString();return(await t.all(E`SELECT * FROM test_execution_attempt
|
|
93
102
|
WHERE execution_id = ${e}
|
|
94
103
|
AND status = ${`allocated`}
|
|
95
104
|
AND settlement_kind IS NULL
|
|
96
105
|
AND allocation_ref IS NOT NULL
|
|
97
106
|
AND claimable = ${1}
|
|
98
107
|
AND (claim_expires_at IS NULL OR claim_expires_at >= ${n})
|
|
99
|
-
ORDER BY created_at ASC, execution_attempt_id ASC`)).map(e=>
|
|
108
|
+
ORDER BY created_at ASC, execution_attempt_id ASC`)).map(e=>me(N(e)))})},async listOpenProviderOperations(e){let t=g(e.observedAt);if(!Number.isSafeInteger(e.limit)||e.limit<=0)throw RangeError(`Provider-operation recovery limit must be a positive safe integer`);return w(async n=>(await n.all(E`SELECT attempt.*, operation.generation, operation.owner_id, operation.token, operation.lease_expires_at,
|
|
100
109
|
operation.obligation, operation.failure_count, operation.last_failure, operation.completion_evidence
|
|
101
110
|
FROM test_execution_attempt AS attempt
|
|
102
111
|
INNER JOIN test_provider_operation AS operation
|
|
@@ -108,27 +117,27 @@ 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
|
|
|
108
117
|
OR operation.lease_expires_at <= ${t}
|
|
109
118
|
)
|
|
110
119
|
ORDER BY attempt.created_at ASC, attempt.execution_attempt_id ASC
|
|
111
|
-
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(
|
|
120
|
+
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(E`INSERT INTO test_execution_attempt
|
|
112
121
|
(execution_attempt_id, execution_id, instruction, status, claimable, created_at, bootstrap_deadline_at)
|
|
113
|
-
VALUES (${t.executionAttemptId}, ${t.executionId}, ${JSON.stringify(r)}, ${`pending`}, ${0}, ${i}, ${a})`)}catch(e){throw
|
|
122
|
+
VALUES (${t.executionAttemptId}, ${t.executionId}, ${JSON.stringify(r)}, ${`pending`}, ${0}, ${i}, ${a})`)}catch(e){throw ye(e)?new te(t.executionAttemptId,{cause:e}):e}return await e.run(E`UPDATE test_execution_attempt
|
|
114
123
|
SET claimable = ${0}
|
|
115
124
|
WHERE execution_attempt_id = (
|
|
116
125
|
SELECT execution_attempt_id
|
|
117
126
|
FROM test_active_execution_attempt
|
|
118
127
|
WHERE execution_id = ${t.executionId}
|
|
119
128
|
)
|
|
120
|
-
AND status = ${`allocated`}`),await e.run(
|
|
129
|
+
AND status = ${`allocated`}`),await e.run(E`UPDATE test_execution_attempt
|
|
121
130
|
SET operation_start_gate = ${`closed`}
|
|
122
131
|
WHERE execution_attempt_id = (
|
|
123
132
|
SELECT execution_attempt_id
|
|
124
133
|
FROM test_active_execution_attempt
|
|
125
134
|
WHERE execution_id = ${t.executionId}
|
|
126
|
-
)`),await e.run(
|
|
135
|
+
)`),await e.run(E`INSERT INTO test_active_execution_attempt (execution_id, execution_attempt_id)
|
|
127
136
|
VALUES (${t.executionId}, ${t.executionAttemptId})
|
|
128
137
|
ON CONFLICT(execution_id)
|
|
129
|
-
DO UPDATE SET execution_attempt_id = excluded.execution_attempt_id`),{...
|
|
130
|
-
WHERE execution_id = ${t.executionId} AND request_key = ${t.requestKey}`))[0];if(n!==void 0){let r=await
|
|
131
|
-
VALUES (${t.executionId}, ${t.requestKey}, ${r.executionAttemptId})`),{kind:`created`,attempt:structuredClone(r)}})},async readAttemptSettlement(e){let t=
|
|
138
|
+
DO UPDATE SET execution_attempt_id = excluded.execution_attempt_id`),{...ge,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:p(e.instruction)},n=y(e.bootstrapTimeoutMs);return w(e=>$(e,t,n))},async ensureAttempt(e){let t=ce(e);return w(async e=>{let n=(await e.all(E`SELECT execution_attempt_id FROM test_execution_attempt_request
|
|
139
|
+
WHERE execution_id = ${t.executionId} AND request_key = ${t.requestKey}`))[0];if(n!==void 0){let r=await A(e,n.execution_attempt_id);return le(t,r===void 0?null:N(r))}let r=await $(e,t,y(t.bootstrapTimeoutMs));return await e.run(E`INSERT INTO test_execution_attempt_request (execution_id, request_key, execution_attempt_id)
|
|
140
|
+
VALUES (${t.executionId}, ${t.requestKey}, ${r.executionAttemptId})`),{kind:`created`,attempt:structuredClone(r)}})},async readAttemptSettlement(e){let t=se(e);return w(async e=>{let n=await A(e,t.executionAttemptId);return n===void 0||n.execution_id!==t.executionId?{kind:`not-found`}:ue(t,{attempt:N(n),activeAttemptId:await B(e,t.executionId),outcomeText:n.workflow_result,controlObservation:j(n.outcome_control_observation)},u)})},async readBootstrapStartState(e){return w(async t=>{let n=await A(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:D(f,n.operation_start_gate,`operation_start_gate`),bootstrapDeadlineAt:n.bootstrap_deadline_at}})},async beginProvisioning(e){let t=pe(e.allocationLifetime),n={executionAttemptId:e.executionAttemptId,generation:1,ownerId:e.ownerId,token:crypto.randomUUID(),leaseExpiresAt:g(e.leaseExpiresAt)};return w(r=>V(async()=>{let i=await A(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.operationStartGate===`closed`?{kind:`fenced`}:a.status===`pending`?async()=>{let i=await r.run(E`UPDATE test_execution_attempt
|
|
132
141
|
SET status = ${`provisioning`},
|
|
133
142
|
provider_id = ${e.providerId},
|
|
134
143
|
allocation_lifetime = ${t},
|
|
@@ -139,62 +148,62 @@ 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
|
|
|
139
148
|
AND operation_start_gate = 'open'
|
|
140
149
|
AND allocation_ref IS NULL
|
|
141
150
|
AND settlement_kind IS NULL
|
|
142
|
-
AND ${K()}`);return i.rowsAffected===0||await r.run(
|
|
151
|
+
AND ${K()}`);return i.rowsAffected===0||await r.run(E`INSERT INTO test_provider_operation
|
|
143
152
|
(execution_attempt_id, generation, owner_id, token, lease_expires_at, obligation, failure_count)
|
|
144
153
|
VALUES (${e.executionAttemptId}, ${n.generation}, ${n.ownerId}, ${n.token},
|
|
145
|
-
${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
|
|
154
|
+
${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 w(async t=>{let n=await F(t,e);return n===void 0?null:P(n)})},async renewProviderOperationClaim(e){let t=g(e.leaseExpiresAt);return w(n=>V(async()=>await Y(n,e.claim)??(()=>n.run(E`UPDATE test_provider_operation SET lease_expires_at = ${t}
|
|
146
155
|
WHERE execution_attempt_id = ${e.claim.executionAttemptId}
|
|
147
|
-
AND ${W(e.claim)}`)),{kind:`claimed`,claim:{...e.claim,leaseExpiresAt:t}}))},async takeOverProviderOperation(e){return
|
|
156
|
+
AND ${W(e.claim)}`)),{kind:`claimed`,claim:{...e.claim,leaseExpiresAt:t}}))},async takeOverProviderOperation(e){return w(async t=>{let n=await A(t,e.executionAttemptId),r=await F(t,e.executionAttemptId);if(n===void 0||r===void 0)return{kind:`not-found`};if(h(N(n),P(r)))return{kind:`resolved`};let i=g(e.observedAt);if(r.owner_id!==null&&r.lease_expires_at!==null&&_(r.lease_expires_at)>_(i))return{kind:`stale`};let a={executionAttemptId:e.executionAttemptId,generation:r.generation+1,ownerId:e.ownerId,token:crypto.randomUUID(),leaseExpiresAt:g(e.leaseExpiresAt)},{rowsAffected:o}=await t.run(E`UPDATE test_provider_operation
|
|
148
157
|
SET generation = ${a.generation}, owner_id = ${a.ownerId}, token = ${a.token},
|
|
149
158
|
lease_expires_at = ${a.leaseExpiresAt}
|
|
150
159
|
WHERE execution_attempt_id = ${e.executionAttemptId}
|
|
151
160
|
AND generation = ${r.generation}
|
|
152
|
-
AND ${U(e.executionAttemptId)}`);if(o===0){let n=await
|
|
161
|
+
AND ${U(e.executionAttemptId)}`);if(o===0){let n=await A(t,e.executionAttemptId),r=await F(t,e.executionAttemptId);return n!==void 0&&r!==void 0&&h(N(n),P(r))?{kind:`resolved`}:{kind:`stale`}}return{kind:`claimed`,claim:a}})},async handoffProviderOperation(e){let t=e.evidence===void 0?null:x.parse(e.evidence);return w(n=>V(async()=>await Y(n,e.claim)??(()=>n.run(t===null?E`UPDATE test_provider_operation
|
|
153
162
|
SET owner_id = NULL, token = NULL, lease_expires_at = NULL
|
|
154
163
|
WHERE execution_attempt_id = ${e.claim.executionAttemptId}
|
|
155
|
-
AND ${W(e.claim)}`:
|
|
164
|
+
AND ${W(e.claim)}`:E`UPDATE test_provider_operation
|
|
156
165
|
SET owner_id = NULL, token = NULL, lease_expires_at = NULL,
|
|
157
166
|
last_failure = ${JSON.stringify(t)}
|
|
158
167
|
WHERE execution_attempt_id = ${e.claim.executionAttemptId}
|
|
159
|
-
AND ${W(e.claim)}`)),{kind:`recorded`}))},async recordProviderOperationUncertainty(e){let t=
|
|
168
|
+
AND ${W(e.claim)}`)),{kind:`recorded`}))},async recordProviderOperationUncertainty(e){let t=x.parse(e.evidence);return w(n=>V(async()=>await Y(n,e.claim)??(()=>n.run(E`UPDATE test_provider_operation
|
|
160
169
|
SET failure_count = failure_count + 1, last_failure = ${JSON.stringify(t)}
|
|
161
170
|
WHERE execution_attempt_id = ${e.claim.executionAttemptId}
|
|
162
|
-
AND ${W(e.claim)}`)),{kind:`recorded`}))},async completeProviderOperation(e){let t=
|
|
171
|
+
AND ${W(e.claim)}`)),{kind:`recorded`}))},async completeProviderOperation(e){let t=x.parse(e.evidence);return w(async n=>{let r=await A(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(h(N(r),P(i)))return{kind:`already-completed`};if(i.completion_evidence!==null)return{kind:`evidence-recorded`};if((await n.run(E`UPDATE test_provider_operation
|
|
163
172
|
SET completion_evidence = ${JSON.stringify(t)}
|
|
164
173
|
WHERE execution_attempt_id = ${e.claim.executionAttemptId}
|
|
165
174
|
AND ${H(e.claim)}
|
|
166
|
-
AND completion_evidence IS NULL`)).rowsAffected>0){let t=await
|
|
175
|
+
AND completion_evidence IS NULL`)).rowsAffected>0){let t=await A(n,e.claim.executionAttemptId);return t===void 0?{kind:`not-found`}:t.settlement_kind===null?{kind:`evidence-recorded`}:{kind:`completed`}}let a=await A(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?h(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=x.parse(e.evidence),n=!1;return w(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,E`execution_id = ${e.executionId}
|
|
167
176
|
AND allocation_ref IS NULL
|
|
168
|
-
AND ${H(e.claim)}`,t,n)):{kind:`allocated`,allocationRef:a.allocationRef}:{kind:`not-found`}},()=>n?{kind:`completed`}:{kind:`recorded`}))},async recordProvisionerIncarnationLost(e){let t=
|
|
177
|
+
AND ${H(e.claim)}`,t,n)):{kind:`allocated`,allocationRef:a.allocationRef}:{kind:`not-found`}},()=>n?{kind:`completed`}:{kind:`recorded`}))},async recordProvisionerIncarnationLost(e){let t=x.parse(e.proof.evidence),n=!1;return w(r=>V(async()=>{let i=await J(r,e.claim);if(i.kind!==`authorized`)return{kind:i.kind};let{attempt:a}=i,o=oe(a,e);return o===null?(n=a.settlementKind!==null,()=>Z(r,a.executionAttemptId,e.claim,E`execution_id = ${e.executionId}
|
|
169
178
|
AND allocation_ref IS NULL
|
|
170
179
|
AND allocation_lifetime = ${`provisioner-process-bound`}
|
|
171
180
|
AND provisioner_incarnation_id = ${e.proof.provisionerIncarnationId}
|
|
172
|
-
AND ${H(e.claim)}`,t,n)):
|
|
181
|
+
AND ${H(e.claim)}`,t,n)):o},()=>n?{kind:`completed`}:{kind:`recorded`}))},async recordAllocationTerminated(e){let t=x.parse(e.evidence);return w(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(E`UPDATE test_provider_operation
|
|
173
182
|
SET obligation = ${`terminal-convergence`}, last_failure = ${JSON.stringify(t)}
|
|
174
183
|
WHERE execution_attempt_id = ${i.executionAttemptId}
|
|
175
184
|
AND ${W(e.claim)}
|
|
176
185
|
AND EXISTS (SELECT 1 FROM test_execution_attempt
|
|
177
186
|
WHERE execution_attempt_id = ${i.executionAttemptId}
|
|
178
|
-
AND allocation_ref IS NOT NULL)`)},{kind:`recorded`}))},async recordInfrastructureFailure(e){return
|
|
187
|
+
AND allocation_ref IS NOT NULL)`)},{kind:`recorded`}))},async recordInfrastructureFailure(e){return w(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`}:D(m,i.obligation,`obligation`)===`terminal-convergence`?()=>X(t,r.executionAttemptId,`infrastructure-failure`,E`execution_id = ${e.executionId}
|
|
179
188
|
AND allocation_ref IS NOT NULL
|
|
180
189
|
AND ${G(r.executionAttemptId)}
|
|
181
|
-
AND ${H(e.claim)}`):{kind:`not-terminated`}:{kind:`resolved`}:{kind:`not-found`}},{kind:`recorded`}))},async registerRuntime(
|
|
182
|
-
SET runtime_generation = ${
|
|
183
|
-
runtime_incarnation_id = ${
|
|
190
|
+
AND ${H(e.claim)}`):{kind:`not-terminated`}:{kind:`resolved`}:{kind:`not-found`}},{kind:`recorded`}))},async registerRuntime(e){return w(async t=>{let n=0,r=await V(async()=>{let r=await A(t,e.executionAttemptId);if(r===void 0||r.execution_id!==e.executionId)return{kind:`not-found`};let i=await q(t,r);if(i!==null)return i;let a=M(r),o=ae(a,e);return o===null?(n=a.runtimeGeneration+1,()=>t.run(E`UPDATE test_execution_attempt
|
|
191
|
+
SET runtime_generation = ${n},
|
|
192
|
+
runtime_incarnation_id = ${e.runtimeIncarnationId},
|
|
184
193
|
runtime_ready_at = NULL,
|
|
185
194
|
active_operation_id = NULL,
|
|
186
195
|
active_operation_kind = NULL,
|
|
187
196
|
active_operation_key = NULL,
|
|
188
197
|
active_operation_generation = NULL,
|
|
189
198
|
active_operation_admitted_at = NULL
|
|
190
|
-
WHERE execution_attempt_id = ${
|
|
191
|
-
AND execution_id = ${
|
|
192
|
-
AND runtime_generation = ${
|
|
199
|
+
WHERE execution_attempt_id = ${e.executionAttemptId}
|
|
200
|
+
AND execution_id = ${e.executionId}
|
|
201
|
+
AND runtime_generation = ${a.runtimeGeneration}
|
|
193
202
|
AND settlement_kind IS NULL
|
|
194
203
|
AND (active_operation_id IS NULL OR active_operation_kind = ${`runtime-probe`})
|
|
195
204
|
AND allocation_ref IS NOT NULL
|
|
196
|
-
AND NOT ${G(
|
|
197
|
-
AND ${K()}`)):
|
|
205
|
+
AND NOT ${G(e.executionAttemptId)}
|
|
206
|
+
AND ${K()}`)):o},{kind:`applied`});return r.kind===`applied`?{kind:`registered`,runtimeGeneration:n}:r})},async admitOperation(e){let t=crypto.randomUUID(),n=g(new Date().toISOString()),r=e.operationKind===`runtime-probe`?E`1 = 1`:E`runtime_ready_at IS NOT NULL`;return w(i=>V(async()=>{let a=await A(i,e.executionAttemptId);if(a===void 0||a.execution_id!==e.executionId)return{kind:`not-found`};let s=await q(i,a);if(s!==null)return s;let c=o(M(a),e,n,N(a));return c===null?()=>i.run(E`UPDATE test_execution_attempt
|
|
198
207
|
SET active_operation_id = ${t},
|
|
199
208
|
active_operation_kind = ${e.operationKind},
|
|
200
209
|
active_operation_key = ${e.admissionKey},
|
|
@@ -205,13 +214,13 @@ 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
|
|
|
205
214
|
AND active_operation_id IS NULL
|
|
206
215
|
AND operation_start_gate = ${`open`}
|
|
207
216
|
AND runtime_generation = ${e.runtimeGeneration}
|
|
208
|
-
AND instruction = ${
|
|
209
|
-
AND preparation_receipts = ${
|
|
217
|
+
AND instruction = ${a.instruction}
|
|
218
|
+
AND preparation_receipts = ${a.preparation_receipts}
|
|
210
219
|
AND settlement_kind IS NULL
|
|
211
220
|
AND allocation_ref IS NOT NULL
|
|
212
221
|
AND NOT ${G(e.executionAttemptId)}
|
|
213
|
-
AND ${
|
|
214
|
-
AND ${K()}`):c},{kind:`admitted`,operationId:t,runtimeGeneration:e.runtimeGeneration,admittedAt:n}))},async getInstruction(e){return
|
|
222
|
+
AND ${r}
|
|
223
|
+
AND ${K()}`):c},{kind:`admitted`,operationId:t,runtimeGeneration:e.runtimeGeneration,admittedAt:n}))},async getInstruction(e){return w(async t=>{let n=await A(t,e.executionAttemptId);return n?.execution_id===e.executionId?p(JSON.parse(n.instruction)):null})},async reportOperation(e){let t=_e(e.result);return w(n=>V(async()=>{let r=await A(n,e.executionAttemptId);if(r===void 0||r.execution_id!==e.executionId)return{kind:`not-found`};let i=N(r),a=ie({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=v([...i.preparationReceipts,{operationId:e.operationId,runtimeGeneration:e.runtimeGeneration,result:t}]);return()=>n.run(E`UPDATE test_execution_attempt
|
|
215
224
|
SET preparation_receipts = ${JSON.stringify(o)},
|
|
216
225
|
active_operation_id = NULL,
|
|
217
226
|
active_operation_kind = NULL,
|
|
@@ -230,18 +239,18 @@ 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
|
|
|
230
239
|
AND preparation_receipts = ${r.preparation_receipts}
|
|
231
240
|
AND allocation_ref IS NOT NULL
|
|
232
241
|
AND NOT ${G(e.executionAttemptId)}
|
|
233
|
-
AND ${K()}`)},{kind:`accepted`,binding:t.binding}))},async completeOperation(
|
|
242
|
+
AND ${K()}`)},{kind:`accepted`,binding:t.binding}))},async completeOperation(t){return w(n=>V(async()=>{let r=await A(n,t.executionAttemptId);if(r===void 0)return{kind:`not-found`};if(r.settlement_kind!==null)return{kind:`resolved`};let i=e(M(r),t);return i===null?()=>n.run(E`UPDATE test_execution_attempt
|
|
234
243
|
SET active_operation_id = NULL,
|
|
235
244
|
active_operation_kind = NULL,
|
|
236
245
|
active_operation_key = NULL,
|
|
237
246
|
active_operation_generation = NULL,
|
|
238
247
|
active_operation_admitted_at = NULL,
|
|
239
|
-
last_completed_operation_id = ${
|
|
240
|
-
WHERE execution_attempt_id = ${
|
|
248
|
+
last_completed_operation_id = ${t.operationId}
|
|
249
|
+
WHERE execution_attempt_id = ${t.executionAttemptId}
|
|
241
250
|
AND settlement_kind IS NULL
|
|
242
|
-
AND active_operation_id = ${
|
|
251
|
+
AND active_operation_id = ${t.operationId}
|
|
243
252
|
AND active_operation_kind IN (${`runtime-probe`}, ${`workflow-run`})
|
|
244
|
-
AND active_operation_generation = ${
|
|
253
|
+
AND active_operation_generation = ${t.runtimeGeneration}`):i},{kind:`completed`}))},async markRuntimeReady(e){let t=g(e.readyAt);return w(r=>V(async()=>{let i=await A(r,e.executionAttemptId);if(i===void 0||i.execution_id!==e.executionId)return{kind:`not-found`};let a=await q(r,i);if(a!==null)return a;let o=n(M(i),e);return o===null?()=>r.run(E`UPDATE test_execution_attempt SET runtime_ready_at = ${t}
|
|
245
254
|
WHERE execution_attempt_id = ${e.executionAttemptId}
|
|
246
255
|
AND execution_id = ${e.executionId}
|
|
247
256
|
AND settlement_kind IS NULL
|
|
@@ -250,24 +259,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
|
|
|
250
259
|
AND active_operation_id IS NULL
|
|
251
260
|
AND allocation_ref IS NOT NULL
|
|
252
261
|
AND NOT ${G(e.executionAttemptId)}
|
|
253
|
-
AND ${K()}`):o},{kind:`ready`,acceptedAt:t}))},async getAttemptControlState(e){return
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
WHERE execution_attempt_id = ${e}`);return n===void 0?null:{requestedAt:n.requested_at,...n.reason===null?{}:{reason:n.reason}}})},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`
|
|
259
|
-
runtime_generation = ${n.runtimeGeneration}
|
|
260
|
-
AND ${n.operationId===null?k`active_operation_id IS NULL`:k`active_operation_id = ${n.operationId}
|
|
261
|
-
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}
|
|
262
|
+
AND ${K()}`):o},{kind:`ready`,acceptedAt:t}))},async getAttemptControlState(e){return w(async t=>{let n=await A(t,e);return n===void 0?null:M(n)})},async requestAttemptCancellation(e){let t=i(e);return w(async e=>{let n=await A(e,t.executionAttemptId);if(n===void 0||n.execution_id!==t.executionId)return{kind:`not-found`};let r=l(await T(e,t.executionAttemptId),t,new Date().toISOString());return r.kind===`accepted`&&await O(e,t.executionAttemptId,r.intent),r})},async requestCancellation(e){let t=a(e),n={requestKey:crypto.randomUUID(),reason:t.reason};await w(async e=>{let r=await e.all(E`SELECT execution_attempt_id FROM test_execution_attempt WHERE execution_id = ${t.executionId}`),i=new Date().toISOString(),a=[];for(let t of r){let r=l(await T(e,t.execution_attempt_id),n,i);if(r.kind===`conflict`)throw Error(`Generated cancellation request key conflicts with its receipt`);a.push({executionAttemptId:t.execution_attempt_id,decision:r})}for(let{executionAttemptId:t,decision:n}of a)n.kind===`accepted`&&await O(e,t,n.intent)})},async readCancellation(e){return w(t=>T(t,e))},async getActiveAttempt(e,t){return w(async n=>{if(await B(n,e)!==t)return null;let r=await A(n,t);return r===void 0?null:N(r)})},canonicalizeOutcome(e){return ne(u,e)},decodeOutcome(e){return t(u,e)},async commitOutcome(e){let n=e.result,i=e.runtimeFence,a=i===void 0?E`1 = 1`:E`
|
|
263
|
+
runtime_generation = ${i.runtimeGeneration}
|
|
264
|
+
AND ${i.operationId===null?E`active_operation_id IS NULL`:E`active_operation_id = ${i.operationId}
|
|
265
|
+
AND active_operation_generation = ${i.runtimeGeneration}`}`;return w(o=>{let s=null;return V(async()=>{if(await B(o,e.executionId)!==e.executionAttemptId)return{kind:`fenced`};let c=await A(o,e.executionAttemptId);if(c===void 0)return{kind:`fenced`};let l=c.workflow_result;if(l!==null){let e=t(u,l);return r(l,n.text)?{kind:`duplicate`,outcome:e,text:l,controlObservation:j(c.outcome_control_observation)}:{kind:`conflict`}}return c.settlement_kind===null?(i!==void 0&&ee(M(c),i),s=re(await T(o,e.executionAttemptId)),async()=>{let t=await o.run(E`UPDATE test_execution_attempt SET workflow_result = ${n.text},
|
|
266
|
+
outcome_control_observation = ${JSON.stringify(s)}
|
|
262
267
|
WHERE execution_attempt_id = ${e.executionAttemptId}
|
|
263
268
|
AND workflow_result IS NULL
|
|
264
269
|
AND settlement_kind IS NULL
|
|
265
|
-
AND ${
|
|
266
|
-
AND ${K()}`);return
|
|
270
|
+
AND ${a}
|
|
271
|
+
AND ${K()}`);return t.rowsAffected===0?t:X(o,e.executionAttemptId,`outcome`,E`workflow_result IS NOT NULL`)}):{kind:`conflict`}},()=>({kind:`accepted`,outcome:t(u,n.text),text:n.text,controlObservation:s}))})},async abandonPendingAttempt(e,t){return w(n=>V(async()=>{if(await B(n,t)!==e)return{kind:`fenced`};let r=await A(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(E`UPDATE test_execution_attempt
|
|
267
272
|
SET status = ${`settled`}, settlement_kind = ${`abandoned`}, claimable = ${0},
|
|
268
273
|
operation_start_gate = ${`closed`}
|
|
269
274
|
WHERE execution_attempt_id = ${e}
|
|
270
275
|
AND execution_id = ${t}
|
|
271
276
|
AND status = ${`pending`}
|
|
272
277
|
AND settlement_kind IS NULL
|
|
273
|
-
AND ${K()}`)},{kind:`abandoned`}))},recovery:
|
|
278
|
+
AND ${K()}`)},{kind:`abandoned`}))},recovery:Ee}}export{q as createSqliteAttemptRepository};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IMakaioBus } from "@makaio/framework/bus";
|
|
2
1
|
import { LoopGateHandler, StationHandler, WorkflowDefinition, WorkflowRunResult, WorkflowWorkerConfig, WorkflowZodSchemas } from "@makaio/framework/contracts";
|
|
2
|
+
import { IMakaioBus } from "@makaio/framework/bus";
|
|
3
3
|
|
|
4
4
|
//#region subsystems/workflow-engine/src/workflow-orchestrator.d.ts
|
|
5
5
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{W as e,bt as t,c as n,d as r,i,k as a,l as o,r as s,s as c,t as l,z as u}from"../authority-state-bootstrap-
|
|
1
|
+
import{W as e,bt as t,c as n,d as r,i,k as a,l as o,r as s,s as c,t as l,z as u}from"../authority-state-bootstrap-DgoHPc9J.mjs";import{WORKFLOW_CANCELLED_REASON as d,WorkflowRunContextSchema as f}from"@makaio/framework/contracts";import*as p from"node:os";async function m(n,r,i,a){let o=await y(n,r,i);return await n.request(e.setExecution,{execution:o}),i===`completed`?await n.emit(t.execution.completed,{executionId:r.executionId,workflowId:r.workflowId,totalDuration:0,completedAt:o.completedAt}):await n.emit(t.execution.cancelled,{executionId:r.executionId,workflowId:r.workflowId,reason:a,completedAt:o.completedAt}),i===`cancelled`?{executionId:r.executionId,workflowId:r.workflowId,status:`cancelled`,...a===void 0?{}:{reason:a}}:{executionId:r.executionId,workflowId:r.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 t,n=()=>{t=a({bus:e.bus,activeExecutions:e.activeExecutions,shellAbortControllers:e.shellAbortControllers,activeRunnerSteps:e.activeRunnerSteps,durableLifecycleTransitions:e.durableLifecycleTransitions,lifecyclePublications:e.lifecyclePublications,publishingLifecycleExecutions:e.publishingLifecycleExecutions,cancelTimeoutMs:u.cancelTimeoutMs},e.executionId,d).catch(t=>(console.error(`[WorkflowOrchestrator] Failed to persist cancellation for ${e.executionId}:`,t),!1))};return e.signal.addEventListener(`abort`,n,{once:!0}),e.signal.aborted&&n(),async()=>(e.signal.removeEventListener(`abort`,n),t??!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(n,r,i,a,o){i.status=`paused`,await n.request(e.setExecution,{execution:i}),await n.emit(t.execution.paused,{executionId:r.executionId,workflowId:r.workflowId,pausedAtGateId:a,pausedAtFrameId:o})}async function w(e,n,r,i,a,o){r===`completed`?await e.emit(t.execution.completed,{executionId:n.executionId,workflowId:n.workflowId,totalDuration:a-i.startedAt,completedAt:a}):r===`cancelled`?await e.emit(t.execution.cancelled,{executionId:n.executionId,workflowId:n.workflowId,reason:d,completedAt:a}):await e.emit(t.execution.failed,{executionId:n.executionId,workflowId:n.workflowId,error:o??`Workflow execution failed`,completedAt:a})}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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as e}from"./framework-packages-
|
|
1
|
+
import{u as e}from"./framework-packages-BOPhhtK7.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};
|