@makaio/framework 1.0.0-dev-1781729394463 → 1.0.0-dev-1781729807808
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/{account-identity-D5TUafYg.mjs → account-identity-D-9gunfD.mjs} +1 -1
- package/dist/adapter-Cxcqmp04.mjs +1 -0
- package/dist/adapters/config/index.d.mts +1 -1
- package/dist/adapters/config/index.mjs +1 -1
- package/dist/adapters/index.d.mts +2 -2
- package/dist/adapters/index.mjs +1 -1
- package/dist/adapters/node.d.mts +1 -1
- package/dist/adapters/node.mjs +1 -1
- package/dist/adapters/stream-session/index.d.mts +2 -0
- package/dist/await-trigger-Cjfj0yp_.mjs +1 -0
- package/dist/bus/index.d.mts +21 -21
- package/dist/bus/index.mjs +1 -1
- package/dist/canonical-model-C-jhofjd.mjs +1 -0
- package/dist/{client-BO-0jTSV.mjs → client-D24ebgGH.mjs} +1 -1
- package/dist/compression-BPOKUc6y.mjs +1 -0
- 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 +1 -1
- package/dist/contracts/canonical-model/index.d.mts +1 -1
- package/dist/contracts/canonical-model/index.mjs +1 -1
- package/dist/contracts/client/index.d.mts +2 -2
- package/dist/contracts/client/index.mjs +1 -1
- package/dist/contracts/common/index.d.mts +1 -1
- package/dist/contracts/config/index.d.mts +13 -13
- package/dist/contracts/config/index.mjs +1 -1
- package/dist/contracts/extension/index.d.mts +3 -3
- 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 +9913 -206
- package/dist/contracts/index.mjs +1 -1
- package/dist/contracts/materialization/index.d.mts +3 -3
- package/dist/contracts/materialization/index.mjs +1 -1
- package/dist/contracts/model-registry/index.d.mts +1 -1
- package/dist/contracts/model-registry/index.mjs +1 -1
- package/dist/contracts/native-session-supervisor/index.d.mts +1 -1
- package/dist/contracts/native-session-supervisor/index.mjs +1 -1
- package/dist/contracts/platform/index.d.mts +1 -1
- package/dist/contracts/platform/index.mjs +1 -1
- package/dist/contracts/provider/index.d.mts +2 -2
- package/dist/contracts/session/index.d.mts +2 -2
- package/dist/contracts/session/index.mjs +1 -1
- package/dist/contracts/shared/index.d.mts +1 -2
- 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/toast/index.mjs +1 -1
- package/dist/contracts/variant/index.d.mts +1 -1
- package/dist/contracts/variant/index.mjs +1 -1
- package/dist/{definition-b9jyJqPD.d.mts → definition-CZcVOhXZ.d.mts} +1 -1
- package/dist/{detached-extension-handle-Cx6-0eqg.mjs → detached-extension-handle-BYxNmLfv.mjs} +1 -1
- package/dist/{extension-BJHRahFl.mjs → extension-CTkoi8MV.mjs} +1 -1
- package/dist/{extension-CfL70C5n.mjs → extension-CkU_hqra.mjs} +1 -1
- package/dist/{filesystem-service-Bmyqo6po.mjs → filesystem-service-T8JOIWeP.mjs} +1 -1
- package/dist/git/index.mjs +1 -1
- package/dist/{globby-D4SANVoq.mjs → globby-Bos1vjKj.mjs} +1 -1
- package/dist/{handlers-BAycjV02.mjs → handlers-dnpT_hsm.mjs} +1 -1
- package/dist/{harness-DkUpbsuY.mjs → harness-HEpELa_v.mjs} +1 -1
- package/dist/{index-D9-vOJvZ.d.mts → index-6QvT0ljq.d.mts} +1 -1
- package/dist/{index-BEzRpWsS.d.mts → index-BFW1X6SW.d.mts} +356 -356
- package/dist/{index-DLNRgZPo2.d.mts → index-BQ8H7cvY.d.mts} +1 -1
- package/dist/{index-NkNbYFud.d.mts → index-BZuF4I8O.d.mts} +55 -1
- package/dist/{index-aciWhUWw.d.mts → index-BuaP2Q0b.d.mts} +389 -389
- package/dist/{index-DiifAKRu.d.mts → index-ByRAbcZd.d.mts} +2 -7
- package/dist/{index-CmHdpW0E.d.mts → index-C2XLjebs.d.mts} +4 -4
- package/dist/{index-CZJc-V9L.d.mts → index-CUYDEQvN.d.mts} +4 -4
- package/dist/{index-kwq54nx4.d.mts → index-CkpGuNLe.d.mts} +16 -16
- package/dist/{index-BAQ6QBcU.d.mts → index-Cy75lJ1O.d.mts} +32 -32
- package/dist/{index-mU2lnU7O.d.mts → index-DNmENr9M.d.mts} +6 -6
- package/dist/{index-DTBQOCar.d.mts → index-DUI1W-zN.d.mts} +8 -8
- package/dist/{index-CYHWOXUm.d.mts → index-Dbd0Tgba.d.mts} +2 -2
- package/dist/{index-Dw7ErgWU.d.mts → index-Dn73XrXA.d.mts} +457 -10
- package/dist/{index-D1KPCXBN.d.mts → index-Dpu4e9NK.d.mts} +3 -3
- package/dist/{index-DKNmj2sa.d.mts → index-HiAth5G0.d.mts} +28 -28
- package/dist/{index-DWKCb-eJ.d.mts → index-WWYQEH0q.d.mts} +24 -24
- package/dist/{index-CW_LbXdg.d.mts → index-XcnFGiKL.d.mts} +8 -8
- package/dist/{index-BWIkf5oJ.d.mts → index-cN4DkU5Y2.d.mts} +3 -3
- package/dist/{index-DMz-2ACU.d.mts → index-xeg-bqxO.d.mts} +105 -105
- 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-Ba55od_d.mjs → lib-B-R6VZW0.mjs} +1 -1
- package/dist/{lib-CM_BUxN8.mjs → lib-BwYODPdd.mjs} +1 -1
- package/dist/{load-extensions-DNRIy4zC.d.mts → load-extensions-CQqw0Smr.d.mts} +1 -1
- package/dist/{load-extensions-Cze1RHcG.mjs → load-extensions-D-DyzN4j.mjs} +1 -1
- package/dist/mcp-http-server/index.mjs +2 -2
- package/dist/{namespace-65uwTpbg.d.mts → namespace-B091meTj.d.mts} +6 -6
- package/dist/{namespace-COEUMuHL.d.mts → namespace-BQgZChZl.d.mts} +154 -154
- package/dist/{namespace-3yGm4WF9.d.mts → namespace-Ba1gUpUu.d.mts} +2 -2
- package/dist/{namespace-C-piH3w4.mjs → namespace-BxrHvS5c.mjs} +1 -1
- package/dist/namespace-CH_NWUKW.mjs +1 -0
- package/dist/{namespace-DYJZAGzR.d.mts → namespace-CO3DK1v_.d.mts} +42 -42
- package/dist/{namespace-B95uYmZB.d.mts → namespace-CZgcOQTh.d.mts} +52 -52
- package/dist/{namespace-CTsfVI3H.d.mts → namespace-Daq_-170.d.mts} +6 -6
- package/dist/{native-session-supervisor-7ElwM6Is.mjs → native-session-supervisor-DbrqcFq9.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-Cxk3x8Vs.mjs → orchestrator-shared-yFP8e7d5.mjs} +1 -1
- package/dist/package-DP8lk0-a.mjs +1 -0
- package/dist/{package-MmQvNJ3u.d.mts → package-fwIv7zzj.d.mts} +1 -1
- package/dist/package.json +1 -1
- package/dist/primitive-runtime-Dw6OC8w5.mjs +1 -0
- package/dist/{profile-BMBXUqqh.mjs → profile-r4G32bCH.mjs} +1 -1
- package/dist/{provider-context-DC_eq7es.mjs → provider-context-Ds6GNYnE.mjs} +1 -1
- package/dist/rules/index.d.mts +1 -1
- package/dist/rules/index.mjs +1 -1
- package/dist/rules/schemas.d.mts +1 -1
- package/dist/runtime-bun/index.mjs +1 -1
- package/dist/runtime-node/extension-discovery.d.mts +1 -1
- package/dist/runtime-node/extension-validation.d.mts +1 -1
- package/dist/runtime-node/extension-validation.mjs +1 -1
- package/dist/runtime-node/index.d.mts +3 -3
- package/dist/runtime-node/index.mjs +2 -2
- 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-B2bO5Yui.d.mts → schema-DcZifH6p.d.mts} +1 -1
- package/dist/{schema-D6WAI8OL.mjs → schema-atatXwNg.mjs} +1 -1
- package/dist/{schemas-DMMWmWjq.d.mts → schemas-BbFAwUpf.d.mts} +1 -1
- package/dist/{schemas-D4zaFE2p.d.mts → schemas-BqscWIoC.d.mts} +6 -6
- package/dist/{schemas-ByssHRGU2.d.mts → schemas-CTIaU6Rt2.d.mts} +2 -2
- package/dist/{schemas-CscdPqCt.d.mts → schemas-IDGAJ_zv.d.mts} +3 -3
- package/dist/schemas-dNCdjOLB.mjs +1 -0
- package/dist/{schemas-CDBn9MTz.d.mts → schemas-fEoe6H0K.d.mts} +154 -154
- 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 +2 -2
- package/dist/services/adapter-subsystem/index.mjs +1 -1
- package/dist/services/adapter-subsystem/namespace.d.mts +1 -1
- package/dist/services/adapter-subsystem/namespace.mjs +1 -1
- package/dist/services/agent-runtime/index.d.mts +2 -2
- package/dist/services/agent-runtime/namespace.d.mts +1 -1
- package/dist/services/agent-runtime/schemas.d.mts +1 -1
- package/dist/services/capability/index.d.mts +1 -1
- package/dist/services/capability/index.mjs +1 -1
- package/dist/services/codebase/index.d.mts +2 -2
- package/dist/services/codebase/namespace.d.mts +1 -1
- package/dist/services/codebase/schemas.d.mts +1 -1
- package/dist/services/compression/index.d.mts +2 -2
- package/dist/services/compression/namespace.d.mts +1 -1
- package/dist/services/compression/schemas.d.mts +1 -1
- package/dist/services/context-rules/index.d.mts +1 -1
- package/dist/services/context-rules/index.mjs +1 -1
- package/dist/services/execution-target/index.d.mts +3 -3
- package/dist/services/execution-target/index.mjs +1 -1
- package/dist/services/execution-target/namespace.d.mts +1 -1
- package/dist/services/execution-target/schemas.d.mts +1 -1
- package/dist/services/filesystem/index.d.mts +1 -1
- package/dist/services/filesystem/index.mjs +1 -1
- package/dist/services/filesystem/namespace.d.mts +6 -6
- package/dist/services/filesystem/schemas.d.mts +3 -3
- package/dist/services/git/namespace.mjs +1 -1
- package/dist/services/git/schemas.mjs +1 -1
- package/dist/services/harness/index.d.mts +6 -6
- package/dist/services/harness/index.mjs +1 -1
- package/dist/services/index.d.mts +150 -150
- package/dist/services/index.mjs +1 -1
- package/dist/services/log-import/browser.d.mts +2 -2
- package/dist/services/log-import/index.d.mts +2 -2
- package/dist/services/log-import/log-import.d.mts +1 -1
- package/dist/services/log-import/log-import.mjs +1 -1
- package/dist/services/log-import/namespace.mjs +1 -1
- package/dist/services/log-import/schemas.mjs +1 -1
- package/dist/services/model-registry/index.d.mts +1 -1
- package/dist/services/model-registry/index.mjs +1 -1
- package/dist/services/preferences/index.d.mts +2 -2
- package/dist/services/preferences/schemas.d.mts +1 -1
- package/dist/services/preferences/storage-namespace.d.mts +2 -2
- package/dist/services/provider-context/index.d.mts +1 -1
- package/dist/services/provider-context/index.mjs +1 -1
- package/dist/services/provider-runtime/index.mjs +1 -1
- package/dist/services/session/handlers/index.d.mts +1 -1
- package/dist/services/session/handlers/index.mjs +1 -1
- package/dist/services/session/index.d.mts +9 -9
- package/dist/services/session/index.mjs +1 -1
- package/dist/services/session/messages/namespace.d.mts +1 -1
- package/dist/services/session/messages/namespace.mjs +1 -1
- package/dist/services/session/orchestrator-testing/index.d.mts +1 -1
- package/dist/services/session/orchestrator-testing/index.mjs +1 -1
- package/dist/services/session/session-events/namespace.d.mts +1 -1
- package/dist/services/session/session-events/namespace.mjs +1 -1
- package/dist/services/session/storage/namespace.d.mts +1 -1
- package/dist/services/session/storage/schema.d.mts +1 -1
- package/dist/services/session/testing/index.mjs +1 -1
- package/dist/services/session/testing/orchestrator-shared.d.mts +1 -1
- package/dist/services/session/testing/orchestrator-shared.mjs +1 -1
- package/dist/services/session/turns/namespace.d.mts +1 -1
- package/dist/services/session/turns/namespace.mjs +1 -1
- package/dist/services/session-editor/index.d.mts +1 -1
- package/dist/services/session-editor/index.mjs +1 -1
- package/dist/services/settings/index.d.mts +3 -3
- package/dist/services/settings/index.mjs +1 -1
- package/dist/services/settings/namespace.d.mts +2 -2
- 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 +6 -6
- 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/{session-Bey-bzcX.mjs → session-DApMcL_0.mjs} +1 -1
- package/dist/{session-0nWT4st6.mjs → session-R-wciAdJ.mjs} +1 -1
- package/dist/{skill-N-ttlp1i.mjs → skill-B_VlGon5.mjs} +1 -1
- package/dist/{src-Ck2sbaDa.mjs → src-6n-8M8EU.mjs} +1 -1
- package/dist/storage/drizzle/client.d.mts +1 -1
- package/dist/storage/drizzle/client.mjs +1 -1
- package/dist/storage/drizzle/index.d.mts +1 -1
- package/dist/storage/drizzle/index.mjs +1 -1
- package/dist/storage/handlers/drizzle/index.d.mts +1 -1
- package/dist/storage/handlers/drizzle/index.mjs +1 -1
- package/dist/storage/handlers/index.d.mts +1 -1
- package/dist/storage/handlers/index.mjs +1 -1
- package/dist/{tool-approval-service-DEQiipxj.mjs → tool-approval-service-DhAqQqev.mjs} +1 -1
- package/dist/tools/index.d.mts +8 -0
- package/dist/tools-DeZIVtxe.mjs +1 -0
- package/dist/{types-BslClRkH.d.mts → types-BB8iIAjZ.d.mts} +1 -1
- package/dist/{types-Cagp7JXb.d.mts → types-CCsvoUTA.d.mts} +254 -255
- package/dist/ui-kernel/index.d.mts +1 -1
- package/dist/ui-kernel/pages/schemas.d.mts +1 -1
- package/dist/{version-DoV_pSzT.mjs → version-SYP_DX4M.mjs} +1 -1
- package/dist/workflow-engine/index.d.mts +29 -35
- 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/workflow-orchestrator.d.mts +1 -3
- package/dist/workflow-engine/workflow-orchestrator.mjs +1 -1
- package/dist/{workflow-worker-CojIlB6k.mjs → workflow-worker-DMFhz1q_.mjs} +1 -1
- package/package.json +1 -1
- package/dist/adapter-B5I7Wp4y.mjs +0 -1
- package/dist/await-trigger-DcMVmNW5.mjs +0 -1
- package/dist/canonical-model-BWGkgf3v.mjs +0 -1
- package/dist/compression-DMoeVgKx.mjs +0 -1
- package/dist/contracts/workflow/index.d.mts +0 -3
- package/dist/contracts/workflow/index.mjs +0 -1
- package/dist/index-Cjo24O5I.d.mts +0 -10036
- package/dist/json-value-DtIkQN7g.d.mts +0 -57
- package/dist/loop-gate-handlers-CwU5zAGs.mjs +0 -1
- package/dist/namespace-DibbhCPP.mjs +0 -1
- package/dist/package-rdrXr17q.mjs +0 -1
- package/dist/provider-context-DjSUpHSM.mjs +0 -1
- package/dist/schemas-BWasvfw2.mjs +0 -1
- package/dist/schemas-CE1gbhxu.mjs +0 -1
- package/dist/tools-uAgIrqan.mjs +0 -1
- package/dist/transition-Coowd2dA.d.mts +0 -454
- package/dist/workflow-BCKOJ4UC.mjs +0 -1
- /package/dist/{ajv-B5dPIck0.mjs → ajv-Cx19PP7Q.mjs} +0 -0
- /package/dist/{base-orchestrator-Cw0vpNgB.d.mts → base-orchestrator-BRq4MXa7.d.mts} +0 -0
- /package/dist/{capability-service-XlymTzz1.mjs → capability-service-CHl8rrwb.mjs} +0 -0
- /package/dist/{cleanEnvForAdapter-BooAgM2R.mjs → cleanEnvForAdapter-D32WnVuy.mjs} +0 -0
- /package/dist/{client-CebV_fZc.d.mts → client-D2ZftNb6.d.mts} +0 -0
- /package/dist/{clients-namespace-Bt_VTkEU.d.mts → clients-namespace-CeAB0t06.d.mts} +0 -0
- /package/dist/{config-namespace-CY9leBnE.mjs → config-namespace-DW5KHKPW.mjs} +0 -0
- /package/dist/{config-namespace-DqdFE6zk.d.mts → config-namespace-DloU-hNB.d.mts} +0 -0
- /package/dist/{create-static-mount-DkK28kKW.mjs → create-static-mount-Bi0VpYS8.mjs} +0 -0
- /package/dist/{cross-spawn-CDXy3BjE.mjs → cross-spawn-C58yEvsS.mjs} +0 -0
- /package/dist/{cursor-storage-luQAg7E_.mjs → cursor-storage-CpuT5POU.mjs} +0 -0
- /package/dist/{definition-CuJvtYeG.d.mts → definition-BdxbXbrq.d.mts} +0 -0
- /package/dist/{definition-Cllhr9mi.d.mts → definition-GOb_oOmb.d.mts} +0 -0
- /package/dist/{descriptor-to-package-DdpjpT7n.mjs → descriptor-to-package-D-FNxohm.mjs} +0 -0
- /package/dist/{drizzle-DVTAl7Us.mjs → drizzle-D7dkDEB5.mjs} +0 -0
- /package/dist/{esm-CQG9Pc7n.mjs → esm-CP2zvvlx.mjs} +0 -0
- /package/dist/{event-DguYjV6D.mjs → event-DaXakaHo.mjs} +0 -0
- /package/dist/{execution-target-BR8bLkCR.mjs → execution-target-Da6Vjvba.mjs} +0 -0
- /package/dist/{extension-discovery-CIZn5bkq.d.mts → extension-discovery-Bv5FDtrM.d.mts} +0 -0
- /package/dist/{extension-namespace-v3K0qVry.mjs → extension-namespace-O3sKdnY9.mjs} +0 -0
- /package/dist/{facet-BM4y4aQP.mjs → facet-Q_vgXb23.mjs} +0 -0
- /package/dist/{filesystem-service-Cwp0sWNc.d.mts → filesystem-service-89fN-2Dd.d.mts} +0 -0
- /package/dist/{handler-2bPhRn0u.mjs → handler-BIA3ld4C.mjs} +0 -0
- /package/dist/{host-vY07gek-.mjs → host-DFqmG2qO.mjs} +0 -0
- /package/dist/{identity-BarL3JYI.mjs → identity-CA5MzB19.mjs} +0 -0
- /package/dist/{index-D7Hkmrr3.d.mts → index-BE-yMFTz.d.mts} +0 -0
- /package/dist/{index-Dfi8Rorw.d.mts → index-BUilJdHr.d.mts} +0 -0
- /package/dist/{index-B92mToDo2.d.mts → index-BVhnqzDC2.d.mts} +0 -0
- /package/dist/{index-BvLXySoB2.d.mts → index-BeNVLvtk2.d.mts} +0 -0
- /package/dist/{index-DtwGhFFQ.d.mts → index-BplsE3qw.d.mts} +0 -0
- /package/dist/{index-gAFwNiJT.d.mts → index-BtL_9HBk.d.mts} +0 -0
- /package/dist/{index-CuHqL95P.d.mts → index-CBTp2XuF.d.mts} +0 -0
- /package/dist/{index-DUD7wikz2.d.mts → index-CYZqADXY2.d.mts} +0 -0
- /package/dist/{index-D3ahzHwb.d.mts → index-CfpfkKih.d.mts} +0 -0
- /package/dist/{index-Cr9lh21j.d.mts → index-CkPIPbx9.d.mts} +0 -0
- /package/dist/{index-Y8rMeYYX.d.mts → index-D0RWuwl5.d.mts} +0 -0
- /package/dist/{index-COI1tjAf.d.mts → index-DHHKwLww.d.mts} +0 -0
- /package/dist/{index-C23g_M_J2.d.mts → index-DJSffYTW2.d.mts} +0 -0
- /package/dist/{index-CfIW5biI.d.mts → index-DLPjliGd.d.mts} +0 -0
- /package/dist/{index-OGIC4puQ.d.mts → index-DVgKfgh1.d.mts} +0 -0
- /package/dist/{index-DOOrKin9.d.mts → index-DWqSqcpW.d.mts} +0 -0
- /package/dist/{index-wq7XeqyG.d.mts → index-DdCyeZ59.d.mts} +0 -0
- /package/dist/{index-BjoOSg95.d.mts → index-cFuQpzIm.d.mts} +0 -0
- /package/dist/{index-C4nStEdA.d.mts → index-kOSSuOcK.d.mts} +0 -0
- /package/dist/{index-CpKikwK4.d.mts → index-orAkFukT.d.mts} +0 -0
- /package/dist/{jsonl-transport-CGPgD8iU.mjs → jsonl-transport-Bb8ltqOe.mjs} +0 -0
- /package/dist/{lib-ZKtnbCqH.mjs → lib-BmcGxHXH.mjs} +0 -0
- /package/dist/{materialization-DBXjSiBn.mjs → materialization-DsPIGQP1.mjs} +0 -0
- /package/dist/{model-registry-rYICIwyR.mjs → model-registry-DLeMw3l8.mjs} +0 -0
- /package/dist/{model-registry-C2VXobZj.mjs → model-registry-DQDclqdw.mjs} +0 -0
- /package/dist/{namespace-BsYKEMd8.d.mts → namespace-2G7A4Sza.d.mts} +0 -0
- /package/dist/{namespace-6sIu5nBI2.d.mts → namespace-6u1Uf-iw2.d.mts} +0 -0
- /package/dist/{namespace-KMxsPJwm.d.mts → namespace-B1Bldc48.d.mts} +0 -0
- /package/dist/{namespace-DYSFDC2G.mjs → namespace-CN-Llu7H.mjs} +0 -0
- /package/dist/{namespace-LUNf8zo5.d.mts → namespace-DKnJL0Ja.d.mts} +0 -0
- /package/dist/{namespace-CQ8uza7o.d.mts → namespace-DMhz3yvr.d.mts} +0 -0
- /package/dist/{namespace-Dk4OslmY.d.mts → namespace-DcUwOJ4f.d.mts} +0 -0
- /package/dist/{namespace-BO3tODGC.mjs → namespace-DrpHLJAy.mjs} +0 -0
- /package/dist/{namespace-DBHwyhME.mjs → namespace-FJsnoEQy.mjs} +0 -0
- /package/dist/{namespace-wke7juzy.mjs → namespace-UUw-S7ia.mjs} +0 -0
- /package/dist/{namespace-D2s-4pyg.d.mts → namespace-nQS4XwnT.d.mts} +0 -0
- /package/dist/{namespace-B3ol3pc-.d.mts → namespace-q5dD3acO.d.mts} +0 -0
- /package/dist/{namespace-BdO4e1Fm.mjs → namespace-uGUGfpGQ.mjs} +0 -0
- /package/dist/{namespace-CVMZVqB5.mjs → namespace-zWB-ULrX.mjs} +0 -0
- /package/dist/{orchestrator-shared-ChOdIgh6.d.mts → orchestrator-shared-CbS4ueeq.d.mts} +0 -0
- /package/dist/{out-BoEZjBNz.mjs → out-BUHr98Xe.mjs} +0 -0
- /package/dist/{package-CF_Zm2v4.mjs → package-YQeRE8bV.mjs} +0 -0
- /package/dist/{platform-DnbSvm2u.mjs → platform-CsO-MRJP.mjs} +0 -0
- /package/dist/{providers-Bd7BOZs0.mjs → providers-FEZT2bQG.mjs} +0 -0
- /package/dist/{providers-namespace-5GoTlHXz.d.mts → providers-namespace-B4INLPUc.d.mts} +0 -0
- /package/dist/{quick-lru-6e7I1Bgf.mjs → quick-lru-C7AXdpbU.mjs} +0 -0
- /package/dist/{registry-U_3aYSin.mjs → registry-CwjZvH2s.mjs} +0 -0
- /package/dist/{schema-DHlTAy0N.mjs → schema-Ba64XQjo.mjs} +0 -0
- /package/dist/{schema-introspection-B7xODt4I.mjs → schema-introspection-D5FaI5B_.mjs} +0 -0
- /package/dist/{schemas-CPI00yvh.mjs → schemas-5kegIs9D.mjs} +0 -0
- /package/dist/{schemas-DKncXGnb.d.mts → schemas-9Ifo5zSf.d.mts} +0 -0
- /package/dist/{schemas-ArqQTC0Q.mjs → schemas-9QC3nvYP.mjs} +0 -0
- /package/dist/{schemas-KlH1hB7u.d.mts → schemas-BSAKbVyd.d.mts} +0 -0
- /package/dist/{schemas-DmGRSeIq.d.mts → schemas-BxI5Yq8d.d.mts} +0 -0
- /package/dist/{schemas-BemsLc_V.d.mts → schemas-CRS7tkFP.d.mts} +0 -0
- /package/dist/{schemas-XeIBqwvE.mjs → schemas-DAYPhB5K.mjs} +0 -0
- /package/dist/{schemas-DWfo0wp4.d.mts → schemas-DZfBym73.d.mts} +0 -0
- /package/dist/{schemas-B6tEKf9T.d.mts → schemas-DznsZ0bq.d.mts} +0 -0
- /package/dist/{semver-CIhHqMkw.mjs → semver-ClOD8k8c.mjs} +0 -0
- /package/dist/{server-lifecycle-_AA6EfzL.d.mts → server-lifecycle-5iHxcgBO.d.mts} +0 -0
- /package/dist/{server-lifecycle-C5Z5PSMD.mjs → server-lifecycle-CFQaPTf7.mjs} +0 -0
- /package/dist/{session-lineage-Cht4jbvV.d.mts → session-lineage-D_8W1MI0.d.mts} +0 -0
- /package/dist/{shared-schemas-BEVG96xW.mjs → shared-schemas-jG3EtHZT.mjs} +0 -0
- /package/dist/{src-_VODAJnf.mjs → src-CRDOZl7K.mjs} +0 -0
- /package/dist/{storage-namespace-D5q9CrBp.mjs → storage-namespace-C1JVmZF1.mjs} +0 -0
- /package/dist/{storage-namespace-definition-BffdI5Bz.d.mts → storage-namespace-definition-BPYSLTfN.d.mts} +0 -0
- /package/dist/{storage-namespace-definition-CzXPW45M.mjs → storage-namespace-definition-Df8S3E3r.mjs} +0 -0
- /package/dist/{storage-namespace-Di1A3DMm.d.mts → storage-namespace-gey7EUhM.d.mts} +0 -0
- /package/dist/{supports-color-DcXkvGDF.mjs → supports-color-AnssSSH9.mjs} +0 -0
- /package/dist/{telemetry-Cvi4rxiE.mjs → telemetry-DdbvlZ8s.mjs} +0 -0
- /package/dist/{tray-menu-service-B2AxiQqL.mjs → tray-menu-service-am356993.mjs} +0 -0
- /package/dist/{types-DCvp_swt.d.mts → types-Bj7cOrBQ.d.mts} +0 -0
- /package/dist/{types-CPmOg4X7.d.mts → types-D-GeeSdd.d.mts} +0 -0
- /package/dist/{types-BMS6yfLS.d.mts → types-DhlQpVEb.d.mts} +0 -0
- /package/dist/{types-Bo78h9e3.d.mts → types-xLd-e0wf.d.mts} +0 -0
- /package/dist/{variant-5huHjUTm.mjs → variant-BdNN5edM.mjs} +0 -0
- /package/dist/{window-registry-ofIUQnfo.d.mts → window-registry-CA6AC8n7.d.mts} +0 -0
- /package/dist/{window-registry-PkrFIwX2.mjs → window-registry-LRjWPwr4.mjs} +0 -0
package/dist/tools-uAgIrqan.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{SessionStorageSubjects as e}from"./services/session/storage/namespace.mjs";import{x as t}from"./handlers-BAycjV02.mjs";import{A as n,G as r,K as i,L as a,Y as o,a as s,b as c,c as l,i as u,n as d,p as f,r as ee,w as te,z as ne}from"./session-0nWT4st6.mjs";import{n as p}from"./namespace-DBHwyhME.mjs";import{t as re}from"./capability-service-XlymTzz1.mjs";import"./services/adapter-subsystem/index.mjs";import{i as ie,s as ae}from"./model-registry-rYICIwyR.mjs";import{t as oe}from"./tool-approval-service-DEQiipxj.mjs";import{t as se}from"./tray-menu-service-B2AxiQqL.mjs";import{r as m,t as h}from"./handler-2bPhRn0u.mjs";import{n as ce}from"./package-CF_Zm2v4.mjs";import{t as le}from"./filesystem-service-Bmyqo6po.mjs";import{z as g}from"zod";import{createHash as ue}from"node:crypto";import{MakaioError as de,createMakaioContext as fe}from"@makaio/framework/core";import{MakaioBus as _}from"@makaio/framework/bus";import{AdapterSubjects as pe,ArtifactSubjects as v,CanonicalModelSubjects as me,DEFAULT_HARNESSES as he,HarnessDefinitionCreateSchema as ge,HarnessSubjects as y,JsonValueSchema as _e,ToolSubjects as b,TransitionRuleDefinitionSchema as ve,WorkflowBlocksSubjects as ye,WorkflowSubjects as be,dep as x,extensionToken as S,validateToolAdapterIdentity as xe,zodSchemaToJsonRecord as C}from"@makaio/framework/contracts";import{BaseService as w}from"@makaio/framework/service-base";import{registerDrizzleHandlers as T}from"@makaio/framework/storage/drizzle";import{slugifyProviderConfigName as Se}from"@makaio/framework/contracts/config";import{ClientAccountIdentifierSchema as Ce,ClientSessionAccountObserveSchema as we,ClientSubjects as E}from"@makaio/framework/contracts/client";import{FacetSubjects as D}from"@makaio/framework/contracts/facet";import{MaterializationSubjects as O}from"@makaio/framework/contracts/materialization";import{FILE_ACCESS_RULES_KEY as Te,FILE_ACCESS_RULES_KEY as Ee,ToolErrorCodes as k,errorToToolResult as De,extractToolFilePath as Oe,toolError as A,toolSuccess as ke}from"@makaio/framework/tools";import{ConditionSchema as Ae,evaluate as je}from"@makaio/framework/rules";import{evaluateSync as Me}from"@makaio/framework/expression";import{GitService as Ne}from"@makaio/framework/git";const Pe=[{type:`supersedes`,symmetry:`asymmetric`},{type:`contradicts`,symmetry:`symmetric`},{type:`derives_from`,symmetry:`asymmetric`},{type:`responds_to`,symmetry:`asymmetric`},{type:`contains`,symmetry:`asymmetric`},{type:`refines`,symmetry:`asymmetric`},{type:`scopes`,symmetry:`asymmetric`},{type:`references`,symmetry:`asymmetric`},{type:`evidenced_by`,symmetry:`asymmetric`}],j={extension:0,"factory-repo":1,"target-repo":2},M={source:`extension`,ownerKey:`extension:bus`};function N(e){return`${e.source}:${e.ownerKey}`}function Fe(e,t){return e.source===t.source&&e.ownerKey===t.ownerKey}function P(e){return structuredClone(e)}function F(e,t){return`${e}@${t}`}var I=class extends w{kinds=new Map;kindContributions=new Map;nextKindContributionOrder=0;relationTypes=new Map;constructor(e){super(e)}async onInit(){for(let e of Pe)this.relationTypes.set(e.type,e);this.registerHandler(v.kind.register,e=>{this.registerKind(e.payload),e.setResult({registered:!0})}),this.registerHandler(v.kind.list,e=>{let{kind:t}=e.payload,n=[...this.kinds.values()].filter(e=>!t||e.kind===t).map(P);e.setResult({kinds:n})}),this.registerHandler(v[`relation-type`].register,e=>{this.storeRelationType(e.payload),e.setResult({registered:!0})}),this.registerHandler(v[`relation-type`].list,e=>{let{type:t}=e.payload,n=[...this.relationTypes.values()].filter(e=>!t||e.type===t).map(P);e.setResult({relationTypes:n})})}compareKindContributions(e,t){let n=j[e.owner.source]-j[t.owner.source];return n===0?e.owner.source===`extension`?t.order-e.order:e.order-t.order:n}findSameTierRepoConflict(e,t,n){return[...e.values()].find(e=>!Fe(e.owner,t)&&e.owner.source===t.source&&t.source!==`extension`&&e.order<=n)}recomputeKindWinner(e){let t=this.kindContributions.get(e),n=this.kinds.get(e);if(t===void 0||t.size===0){this.kindContributions.delete(e),this.kinds.delete(e),this.emitKindChangedFromKey(e,n);return}let r;for(let e of t.values())(r===void 0||this.compareKindContributions(e,r)<0)&&(r=e);let i=r;this.kinds.set(e,P(i.registration)),JSON.stringify(n)!==JSON.stringify(i.registration)&&this.bus.emit(v.kind.changed,{kind:i.registration.kind,schemaVersion:i.registration.schemaVersion})}emitKindChangedFromKey(e,t){t!==void 0&&this.bus.emit(v.kind.changed,{kind:t.kind,schemaVersion:t.schemaVersion})}registerKind(e,t=M){let n=F(e.kind,e.schemaVersion),r=this.kindContributions.get(n)??new Map,i=N(t),a=r.get(i),o=t.source===`extension`?this.nextKindContributionOrder:a?.order??this.nextKindContributionOrder,s=this.findSameTierRepoConflict(r,t,o);if(s!==void 0){console.warn(`[ArtifactSchemaRegistry] Artifact kind '${n}' is already registered by '${s.owner.ownerKey}' at the same priority; keeping the existing owner.`);return}r.set(i,{owner:t,registration:P(e),order:t.source===`extension`||a===void 0?this.nextKindContributionOrder++:a.order}),this.kindContributions.set(n,r),this.recomputeKindWinner(n)}deregisterKind(e,t,n=M){let r=F(e,t),i=this.kindContributions.get(r);i!==void 0&&(i.delete(N(n)),this.recomputeKindWinner(r))}replaceKindRegistrationsForOwner(e,t){let n=new Set,r=N(e),i=new Map;for(let[e,t]of this.kindContributions.entries()){let a=t.get(r);a!==void 0&&(i.set(e,a.order),t.delete(r),n.add(e))}for(let a of t){let t=F(a.kind,a.schemaVersion),o=this.kindContributions.get(t)??new Map,s=e.source===`extension`?void 0:i.get(t),c=s??this.nextKindContributionOrder,l=this.findSameTierRepoConflict(o,e,c);if(l!==void 0){console.warn(`[ArtifactSchemaRegistry] Artifact kind '${t}' is already registered by '${l.owner.ownerKey}' at the same priority; keeping the existing owner.`);continue}o.set(r,{owner:e,registration:P(a),order:s??this.nextKindContributionOrder++}),this.kindContributions.set(t,o),n.add(t)}for(let e of n)this.recomputeKindWinner(e)}storeRelationType(e){let t=this.relationTypes.get(e.type);if(t){if(t.symmetry!==e.symmetry)throw Error(`Relation type '${e.type}' is already registered with different symmetry (existing: '${t.symmetry}', new: '${e.symmetry}')`);return}this.relationTypes.set(e.type,P(e))}getKind(e,t){let n=this.kinds.get(F(e,t));return n?P(n):void 0}getRelationType(e){let t=this.relationTypes.get(e);return t?P(t):void 0}onDestroy(){this.kinds.clear(),this.kindContributions.clear(),this.relationTypes.clear(),this.nextKindContributionOrder=0}},L=class extends Error{reason;hookId;constructor(e,t){super(`Artifact write rejected by hook '${t}': ${e}`),this.reason=e,this.hookId=t,this.name=`ArtifactLifecycleHookRejectedError`}};function R(e,t){return e?!(e.kind!==void 0&&e.kind!==`*`&&e.kind!==t.kind||e.schemaVersion!==void 0&&e.schemaVersion!==t.schemaVersion):!0}function z(e){return e.priority??0}function Ie(e,t,n){return e.filter(e=>e.event===t&&R(e.filter,n)).sort((e,t)=>z(t)-z(e))}function Le(e,t,n){return e.filter(e=>e.event===t&&R(e.filter,n)).sort((e,t)=>z(t)-z(e))}function Re(e,t){return{...e,...`data`in t?{data:t.data}:{},...`relations`in t?{relations:t.relations}:{},...`confidence`in t?{confidence:t.confidence}:{},...`representations`in t?{representations:t.representations}:{},...`actor`in t?{actor:t.actor}:{}}}function ze(e,t){let{confidence:n,representations:r,...i}=e;return{...i,data:t.data,relations:[...t.relations],...t.confidence===void 0?{}:{confidence:t.confidence},...t.representations===void 0?{}:{representations:t.representations},actor:t.actor}}var B=class extends w{registrations=new Map;constructor(e){super(e)}async onInit(){}onDestroy(){this.registrations.clear()}registerHooks(e,t){let n=[...t];this.registrations.set(e,n);let r=!1;return()=>{r||(r=!0,this.registrations.get(e)===n&&this.registrations.delete(e))}}allHooks(){let e=[];for(let t of this.registrations.values())e.push(...t);return e}async runBeforeCreate(e){return this.runBeforeHooks(`beforeCreate`,e)}async runBeforeRevise(e){return this.runBeforeHooks(`beforeRevise`,e)}async runBeforeHooks(e,t){let{draft:n,previous:r,kindRegistration:i}=t,a=Ie(this.allHooks(),e,n),o=new Map,s={kind:n.kind,schemaVersion:n.schemaVersion,scope:n.scope,data:n.data,relations:n.relations,...n.confidence===void 0?{}:{confidence:n.confidence},...n.representations===void 0?{}:{representations:n.representations},actor:n.actor},c=!1;for(let t of a){let n,a={event:e,get draft(){return s},previous:r,kindRegistration:i,bus:this.bus,meta:o,rejectCreation(e){n={reason:e}},skipMaterialization(){c=!0},updateDraft(e){s=Re(s,e)}};if(await t.handler(a),n)throw new L(n.reason,t.id)}return{draft:ze(n,s),skipMaterialization:c,meta:o}}async runAfterCreate(e){await this.runAfterHooks(`afterCreate`,`created`,e)}async runAfterRevise(e){await this.runAfterHooks(`afterRevise`,`revised`,e)}async runAfterStatusChanged(e){await this.runAfterHooks(`afterStatusChanged`,`status-changed`,e)}async runAfterObservationAdded(e){await this.runAfterHooks(`afterObservationAdded`,`observation-added`,e)}async runAfterHooks(e,t,n){let{artifact:r,previous:i,observation:a,kindRegistration:o,projectionPolicy:s,skipDefaultProjection:c,meta:l}=n,u=Le(this.allHooks(),e,r),d=this.bus,f=!1;for(let n of u){if(c&&(n.priority??0)<0||f&&(n.priority??0)<0)continue;let u={event:e,semanticEvent:t,artifact:r,previous:i?{refClass:`artifact`,id:i.id,revision:i.revision,kind:i.kind}:void 0,observation:a,kindRegistration:o,projectionPolicy:s,bus:d,meta:l,preventDefault(){f=!0},async resolveRelations(e){let t=r.relations.filter(t=>t.type===e).map(e=>e.target),n=[];for(let e of t){let t=e;if(t.refClass===`artifact`){let e=t,{artifact:r}=await d.request(v.resolve,{ref:e});r&&n.push(r)}}return n}};try{await n.handler(u)}catch(t){console.error(`[ArtifactLifecycleHookRegistry] Hook '${n.id}' threw during '${e}':`,t)}}}};function V(e){return structuredClone(e)}var Be=class extends w{namespaces=new Map;constructor(e){super(e)}async onInit(){this.registerHandler(D.namespace.register,e=>{this.registerNamespace(e.payload),e.setResult({registered:!0})}),this.registerHandler(D.namespace.list,e=>{let{namespace:t}=e.payload,n=[...this.namespaces.values()].filter(e=>!t||e.namespace===t).map(V);e.setResult({namespaces:n})})}registerNamespace(e){let t=this.namespaces.get(e.namespace);if(t){if(JSON.stringify(t)!==JSON.stringify(e))throw Error(`Facet namespace '${e.namespace}' is already registered with a different definition`);return}this.namespaces.set(e.namespace,V(e)),this.bus.emit(D.namespace.changed,{namespace:e.namespace})}deregisterNamespace(e){this.namespaces.delete(e)&&this.bus.emit(D.namespace.changed,{namespace:e})}getNamespace(e){let t=this.namespaces.get(e);return t?V(t):void 0}onDestroy(){this.namespaces.clear()}};function H(e){return structuredClone(e)}var Ve=class extends w{bindings=new Map;constructor(e){super(e)}async onInit(){this.registerHandler(O.surfaceBinding.register,e=>{this.registerBinding(e.payload),e.setResult({registered:!0})}),this.registerHandler(O.surfaceBinding.list,e=>{let{provider:t,namespace:n}=e.payload,r=[...this.bindings.values()].filter(e=>(!t||e.provider===t)&&(!n||e.namespace===n)).map(H);e.setResult({bindings:r})})}registerBinding(e){let t=this.bindings.get(e.id);if(t){if(JSON.stringify(t)!==JSON.stringify(e))throw Error(`Surface binding '${e.id}' is already registered with a different definition`);return}this.bindings.set(e.id,H(e)),this.bus.emit(O.surfaceBinding.changed,{id:e.id,provider:e.provider})}deregisterBinding(e){let t=this.bindings.get(e);t&&(this.bindings.delete(e),this.bus.emit(O.surfaceBinding.changed,{id:e,provider:t.provider}))}getBinding(e){let t=this.bindings.get(e);return t?H(t):void 0}onDestroy(){this.bindings.clear()}},U=class extends de{code;suggestions;constructor(e,t,n){super(e),this.code=t,this.suggestions=n}},He=class{deps;constructor(e){this.deps=e}async resolve(e,t){switch(e.kind){case`bare`:return this.resolveBare(e.model);case`qualified`:return this.resolveQualified(e.segment1,e.segment2,e.model)}}async resolveBare(e){let t=await this.deps.resolveDefaultModelTarget(e);switch(t.kind){case`resolved`:return{kind:`adapter`,adapterName:t.target.adapterName,providerConfigId:t.target.providerConfigId,model:t.target.model};case`ambiguous`:throw new U(`Model "${e}" is available via multiple providers. Use a qualified reference to select one.`,`ambiguous-model`,t.matches.map(e=>e.qualifiedName));case`not-found`:throw new U(`Model "${e}" was not found in any enabled adapter's registry.`,`model-not-found`)}}async resolveQualified(e,t,n){return t===void 0?this.resolveQualifiedOneSegment(e,n):this.resolveQualifiedTwoSegments(e,t,n)}async resolveQualifiedTwoSegments(e,t,n){let r=await this.deps.listEnabledAdapterNames();if(!r.includes(e))throw new U(`Adapter "${e}" is not enabled or does not exist.`,`adapter-not-found`);return{kind:`adapter`,adapterName:e,providerConfigId:await this.resolveProviderSegment(t,e,r),model:n}}async resolveQualifiedOneSegment(e,t){let n=await this.deps.listEnabledAdapterNames();if(n.includes(e)){let n=await this.deps.getDefaultBinding(e);if(!n)throw new U(`Adapter "${e}" has no enabled provider binding. Configure or enable a provider binding first.`,`no-binding`);return{kind:`adapter`,adapterName:e,providerConfigId:n.providerConfigId,model:t}}let r=await this.deps.findProviderConfigByName(e);if(r)return{kind:`adapter`,adapterName:(await this.pickBindingForConfig(r.id,n)).adapterName,providerConfigId:r.id,model:t};let i=await this.deps.findProviderDefinition(e,n);if(i){let r=await this.deps.findDefaultConfigForDefinition(i.id);if(!r)throw new U(`Provider definition "${e}" exists but has no configured provider config. Create a provider config first.`,`provider-not-found`);return{kind:`adapter`,adapterName:(await this.pickBindingForConfig(r.id,n)).adapterName,providerConfigId:r.id,model:t}}throw new U(`"${e}" does not match any enabled adapter name, provider config name, or provider definition ID.`,`adapter-not-found`)}async resolveProviderSegment(e,t,n){let r=await this.deps.findProviderConfigByName(e);if(r)return await this.requireBindingForAdapterAndConfig(t,r.id,e),r.id;let i=await this.deps.findProviderDefinition(e,n);if(i){let n=await this.deps.findConfigForDefinitionAndAdapter(i.id,t);if(!n)throw new U(`Provider definition "${e}" has no enabled config bound to adapter "${t}". Create a provider config and binding first.`,`no-binding`);return n.id}throw new U(`"${e}" does not match any provider config name or provider definition ID.`,`provider-not-found`)}async requireBindingForAdapterAndConfig(e,t,n){if(!(await this.deps.listBindingsForConfig(t)).some(t=>t.adapterName===e))throw new U(`No binding exists between adapter "${e}" and provider "${n}". Create a binding first.`,`no-binding`)}async pickBindingForConfig(e,t){let n=(await this.deps.listBindingsForConfig(e)).filter(e=>t.includes(e.adapterName));if(n.length===0)throw new U(`Provider config "${e}" has no bindings to enabled adapters. Bind it to an enabled adapter first.`,`no-binding`);return n.find(e=>e.isDefault)??n[0]}},Ue=class e extends w{constructor(e=_){super(e)}async onInit(){await this.bus.request(p.ensureReady,{});let e=new He(this.createDeps());this.registerHandler(me.resolve,async t=>{let n=await e.resolve(t.payload.parsed,t.payload.context);t.setResult(n)})}createDeps(){let e=this.bus,t=async()=>{let{adapters:t}=await e.request(p.listAdapters,{});return t.filter(e=>e.enabled).map(e=>e.name)},n=async t=>{let[n,r]=await Promise.all([e.request(p.getDefaultBinding,{adapterName:t}),this.listEnabledProviderConfigIds()]);if(n.binding&&r.has(n.binding.providerConfigId))return n.binding;let{bindings:i}=await e.request(p.listBindings,{adapterName:t}),a=i.filter(e=>r.has(e.providerConfigId));return a.find(e=>e.isDefault)??a[0]},r=async t=>{let{definitions:n}=await e.request(p.getProviderDefinitionsByAdapter,{adapterName:t});return n},i=async t=>{let{bindings:n}=await e.request(p.listBindingsByConfig,{providerConfigId:t});return n},a=async t=>{let{configs:n}=await e.request(p.listProviderConfigs,{enabled:!0}),r=Se(t);return n.find(e=>Se(e.name)===r)},o=this.buildFindProviderDefinition(t,r),s=async t=>{let{configs:n}=await e.request(p.listProviderConfigsByDefinition,{definitionId:t}),r=n.filter(e=>e.enabled);return r.find(e=>e.isDefault)??r[0]},c=async(t,n)=>{let{config:r}=await e.request(p.findConfigForDefinitionAndAdapter,{definitionId:t,adapterName:n});return r?{id:r.id}:void 0};return{listEnabledAdapterNames:t,getDefaultBinding:n,findProviderConfigByName:a,findProviderDefinition:o,listBindingsForConfig:i,findDefaultConfigForDefinition:s,findConfigForDefinitionAndAdapter:c,resolveDefaultModelTarget:this.buildResolveDefaultModelTarget(t,r,c)}}buildFindProviderDefinition(e,t){return async(n,r)=>{let i=r??await e();for(let e of i){let r=(await t(e)).find(e=>e.id===n);if(r)return r}}}buildResolveDefaultModelTarget(t,n,r){let i=this.bus;return async a=>{let o=await t(),s=await Promise.all(o.map(async e=>({adapterName:e,definitions:await n(e)}))),c=Array.from(new Set(s.flatMap(({definitions:e})=>e.map(e=>e.id))));if(c.length===0)return{kind:`not-found`};let{matches:l}=await i.request(ae.checkModelInProviders,{providerIds:c,model:a}),u=(await Promise.all(s.map(({adapterName:e,definitions:t})=>this.collectAdapterCandidates(e,t,a,l,r)))).flat();return e.buildResolution(u)}}async collectAdapterCandidates(e,t,n,r,i){let a=t.filter(e=>e.id in r),o=await Promise.all(a.map(t=>i(t.id,e)));return a.flatMap((t,r)=>{let i=o[r];return i?[{adapterName:e,definitionId:t.id,providerConfigId:i.id,qualifiedName:`${e}/${t.id}::${n}`,model:n}]:[]})}static buildResolution(e){let t=Array.from(new Map(e.map(e=>[this.routeKey(e),e])).values());if(t.length===0)return{kind:`not-found`};if(t.length>1)return{kind:`ambiguous`,matches:t.map(({adapterName:e,definitionId:t,qualifiedName:n})=>({adapterName:e,definitionId:t,qualifiedName:n}))};let[n]=t;return{kind:`resolved`,target:{adapterName:n.adapterName,providerConfigId:n.providerConfigId,definitionId:n.definitionId,model:n.model}}}static routeKey(e){return`${e.adapterName}\0${e.definitionId}\0${e.providerConfigId}`}async listEnabledProviderConfigIds(){let{configs:e}=await this.bus.request(p.listProviderConfigs,{enabled:!0});return new Set(e.map(e=>e.id))}};const W={name:`makaio.canonical-model`,displayName:`Canonical Model`,version:`0.1.0`,critical:!1,create:e=>new Ue(e.bus)};function We(e){let t=xe({adapterId:e?.adapterId,adapterName:e?.adapterName,contextOverrides:{adapterId:e?.contextOverrides?.adapterId,adapterName:e?.contextOverrides?.adapterName}}),n=t.issues[0];return n?A(k.VALIDATION_FAILED,n.message):ke(t.effectiveIdentity)}function Ge(e){let t=e?.allowedDirectories;if(Array.isArray(t))return t.filter(e=>typeof e==`string`)}async function Ke(e,t,n,r){let i=new Map;for(let e of t)i.set(e.name,await r(e.name));let a=t.filter(e=>{let t=i.get(e.name);return!t?.allowedAdapters||t.allowedAdapters.length===0?!0:t.allowedAdapters.includes(n)}),o=new Set(a.map(e=>e.name));return{filteredTools:e.filter(e=>!(!o.has(e.toolsetName)||i.get(e.toolsetName)?.disabledTools?.includes(e.name))),filteredToolsets:a}}function qe(){return`exec_${Date.now()}_${Math.random().toString(36).substring(2,9)}`}var Je=class{bus;toolsets=new Map;tools=new Map;cleanupHandlers=[];handlerPriority;policyProvider;fileAccessRuleProvider;revision=0;constructor(e){this.bus=e?.bus??_,this.handlerPriority=e?.handlerPriority??0,this.policyProvider=e?.policyProvider,this.fileAccessRuleProvider=e?.fileAccessRuleProvider,this.registerHandlers()}registerHandlers(){let e=this.bus.on(b.list,async e=>{let{toolsetName:t,adapterId:n,adapterName:r}=e.payload,{tools:i,toolsets:a}=await this.listToolsWithToolsets({toolsetName:t,adapterId:n,adapterName:r});e.setResult({tools:i,toolsets:a})},{priority:this.handlerPriority});this.cleanupHandlers.push(e);let t=this.bus.on(b.execute,async e=>{let{toolName:t,input:n,adapterId:r,adapterName:i,contextOverrides:a}=e.payload,o=await this.execute(t,n,{contextOverrides:a,adapterId:r,adapterName:i});e.setResult(o)},{priority:this.handlerPriority});this.cleanupHandlers.push(t)}async register(e){if(this.toolsets.has(e.metadata.name))throw Error(`Toolset '${e.metadata.name}' is already registered`);let t=[],n=[];for(let[,r]of Object.entries(e.tools)){let i=r.metadata.name;if(this.tools.has(i))throw Error(`Tool '${i}' is already registered (from toolset '${this.tools.get(i).toolsetName}')`);n.push({tool:r,toolsetName:e.metadata.name}),t.push(i)}this.toolsets.set(e.metadata.name,e);for(let e=0;e<n.length;e+=1)this.tools.set(t[e],n[e]);await this.emitRegistryChanged(`toolset-registered`,e.metadata.name).catch(t=>console.warn(`[ToolRegistry] Failed to emit ${b.registryChanged.subject} for '${e.metadata.name}':`,t)),await this.bus.emit(b.registered,{toolsetName:e.metadata.name,toolsetVersion:e.metadata.version,toolNames:t}).catch(t=>console.warn(`[ToolRegistry] Failed to emit ${b.registered.subject} for '${e.metadata.name}':`,t))}async deregister(e){let t=this.toolsets.get(e);if(!t)throw Error(`Toolset '${e}' is not registered`);for(let e of Object.values(t.tools))this.tools.delete(e.metadata.name);this.toolsets.delete(e),await this.emitRegistryChanged(`toolset-unregistered`,e).catch(t=>console.warn(`[ToolRegistry] Failed to emit ${b.registryChanged.subject} for '${e}':`,t))}async emitRegistryChanged(e,t){this.revision+=1,await this.bus.emit(b.registryChanged,{revision:this.revision,reason:e,toolsetName:t})}async execute(e,t,n){let r=this.tools.get(e);if(!r)return A(k.TOOL_NOT_FOUND,`Tool '${e}' not found`);let i=We(n);if(!i.success)return i;let{tool:a,toolsetName:o}=r,s=await this.checkPolicy(o,e,i.data.adapterId,i.data.adapterName);if(s)return s;let c=qe(),l=Date.now();await this.bus.emit(b.started,{toolName:e,toolsetName:o,executionId:c,timestamp:l});try{let r=a.inputSchema.safeParse(t);if(!r.success){let t=A(k.VALIDATION_FAILED,`Input validation failed`,{issues:r.error.issues});return await this.bus.emit(b.error,{toolName:e,toolsetName:o,executionId:c,timestamp:Date.now(),error:t.error}),t}let s=await this.buildExecutionContext(n,i.data),u=await a.execute(r.data,s);return u.success?await this.bus.emit(b.completed,{toolName:e,toolsetName:o,executionId:c,timestamp:Date.now(),durationMs:Date.now()-l}):await this.bus.emit(b.error,{toolName:e,toolsetName:o,executionId:c,timestamp:Date.now(),error:u.error}),u}catch(t){let n=De(t);return await this.bus.emit(b.error,{toolName:e,toolsetName:o,executionId:c,timestamp:Date.now(),error:n.error}),n}}async buildExecutionContext(e,t){let n=e?.contextOverrides?.constraints;if(this.fileAccessRuleProvider){let t=e?.contextOverrides?.cwd??process.cwd(),r=Ge(n),i=await this.fileAccessRuleProvider(t,r);n={...n,[Te]:i}}let r=fe({...e?.contextOverrides,constraints:n}),i=e?.contextOverrides;return{...r,bus:this.bus,sessionId:i?.sessionId,agentId:i?.agentId,adapterId:t.adapterId,adapterName:t.adapterName,turnId:i?.turnId,turnContext:i?.turnContext,toolCallId:i?.toolCallId}}async checkPolicy(e,t,n,r){if(!this.policyProvider)return null;let i=await this.policyProvider(e);if(!i)return null;if(i.disabledTools?.includes(t))return A(k.PERMISSION_DENIED,`Tool '${t}' is disabled`,{toolsetName:e,toolName:t});if(i.allowedAdapters&&i.allowedAdapters.length>0){let t=r??n;if(!t||!i.allowedAdapters.includes(t))return A(k.PERMISSION_DENIED,`Adapter not allowed for toolset '${e}'`,{toolsetName:e,adapterId:n,adapterName:r,allowedAdapters:i.allowedAdapters})}return null}listTools(e){let t=[];for(let[,n]of this.tools){if(e?.toolsetName&&n.toolsetName!==e.toolsetName)continue;let{$schema:r,...i}=g.toJSONSchema(n.tool.inputSchema);t.push({name:n.tool.metadata.name,description:n.tool.metadata.description,toolsetName:n.toolsetName,annotations:n.tool.metadata.annotations,inputSchema:i})}return t}listToolsets(){let e=[];for(let[,t]of this.toolsets){let n={name:t.metadata.name,description:t.metadata.description,version:t.metadata.version,toolCount:Object.keys(t.tools).length};if(t.configSchema){let{$schema:e,...r}=g.toJSONSchema(t.configSchema);n.configSchema=r}e.push(n)}return e}async listToolsWithToolsets(e){let t=this.listTools(e),n=this.listToolsets(),r=e?.toolsetName?n.filter(t=>t.name===e.toolsetName):n,i=e?.adapterName??e?.adapterId;if(this.policyProvider&&i){let{filteredTools:e,filteredToolsets:n}=await Ke(t,r,i,this.policyProvider);return{tools:e,toolsets:n}}return{tools:t,toolsets:r}}getTool(e){return this.tools.get(e)?.tool}getToolset(e){return this.toolsets.get(e)}dispose(){for(let e of this.cleanupHandlers)e();this.cleanupHandlers.length=0}destroy(){this.dispose()}},Ye=class extends w{triggersByExtension=new Map;stepsByExtension=new Map;revision=0;cache=null;constructor(e){super(e)}onInit(){this.registerHandler(ye.list,e=>{e.setResult({triggers:this.listTriggers(),steps:this.listSteps()})})}async register(e,t){let n=[],r=[],i=this.snapshotExtensionState(e),a=new Set;for(let e of this.triggersByExtension.values())for(let t of e)a.add(t.metadata.name);for(let e of this.stepsByExtension.values())for(let t of e)a.add(t.metadata.name);if(t.triggers)for(let r of t.triggers)this.assertExtensionNamespace(e,r.metadata),this.assertNoCollision(r.metadata,a),a.add(r.metadata.name),n.push({metadata:{...r.metadata,extensionName:e},configSchema:C(r.configSchema),outputSchema:C(r.outputSchema)});if(t.steps)for(let n of t.steps)this.assertExtensionNamespace(e,n.metadata),this.assertNoCollision(n.metadata,a),a.add(n.metadata.name),r.push({metadata:{...n.metadata,extensionName:e},configSchema:C(n.configSchema),inputSchema:C(n.inputSchema),outputSchema:C(n.outputSchema),runs:structuredClone(n.runs)});if(n.length>0&&this.triggersByExtension.set(e,n),r.length>0&&this.stepsByExtension.set(e,r),n.length>0||r.length>0){this.revision+=1;try{await this.emitChanged(e,`registered`)}catch(t){throw this.restoreExtensionState(e,i),t}}}async deregister(e){let t=this.snapshotExtensionState(e),n=this.triggersByExtension.delete(e),r=this.stepsByExtension.delete(e);if(n||r){this.revision+=1;try{await this.emitChanged(e,`deregistered`)}catch(n){throw this.restoreExtensionState(e,t),n}}}listTriggers(){return this.getCache().triggers.map(Xe)}listSteps(){return this.getCache().steps.map(Ze)}async emitChanged(e,t){await this.bus.emit(ye.changed,{extensionName:e,revision:this.revision,reason:t})}getCache(){return(!this.cache||this.cache.revision!==this.revision)&&(this.cache={revision:this.revision,triggers:[...this.triggersByExtension.values()].flat(),steps:[...this.stepsByExtension.values()].flat()}),this.cache}snapshotExtensionState(e){return{triggers:this.triggersByExtension.get(e),steps:this.stepsByExtension.get(e),revision:this.revision,cache:this.cache}}restoreExtensionState(e,t){t.triggers?this.triggersByExtension.set(e,t.triggers):this.triggersByExtension.delete(e),t.steps?this.stepsByExtension.set(e,t.steps):this.stepsByExtension.delete(e),this.revision=t.revision,this.cache=t.cache}assertNoCollision(e,t){if(t.has(e.name))throw Error(`Workflow block name collision: '${e.name}' is already registered`)}assertExtensionNamespace(e,t){let n=`${e}.`;if(!t.name.startsWith(n))throw Error(`Workflow block '${t.name}' must be namespaced by extension '${n}'`)}};function Xe(e){return{metadata:Qe(e.metadata),configSchema:structuredClone(e.configSchema),outputSchema:structuredClone(e.outputSchema)}}function Ze(e){return{metadata:Qe(e.metadata),configSchema:structuredClone(e.configSchema),inputSchema:structuredClone(e.inputSchema),outputSchema:structuredClone(e.outputSchema),runs:structuredClone(e.runs)}}function Qe(e){return e.categories?{...e,categories:[...e.categories]}:{...e}}const G=`workflow.start`;function $e(e){return()=>({async execute(t,n){let{input:r={},executionHints:i}=t,{workflowId:a}=r;if(typeof a!=`string`||a.length===0)throw Error(`[TransitionActionRegistry] 'workflow.start' action requires a non-empty 'input.workflowId' string`);await e.request(be.start,{workflowId:a,input:et(r,n),config:r.config,artifactRef:r.artifactRef,scope:r.scope,triggerPayload:{_transitionRuleId:n._transition.ruleId,_transitionDepth:n._transition.depth,_transitionEventType:n._transition.eventType},executionHints:i})}})}function et(e,t){let n=e.inputExpression;if(typeof n!=`string`)return e.input;let r=Me(n,tt(t)),i=_e.safeParse(r);if(!i.success)throw Error(`[TransitionActionRegistry] 'workflow.start' inputExpression for rule '${t._transition.ruleId}' must resolve to a JSON value`);return i.data}function tt(e){let t={...e};return{...t,ctx:t}}var nt=class{factories=new Map;factoriesBySource=new Map;constructor(e){this.factories.set(G,$e(e)),this.factoriesBySource.set(`__builtin__`,[G])}register(e,t){let n=Object.keys(t);if(n.length!==0){if(this.factoriesBySource.has(e))throw Error(`TransitionActionRegistry: duplicate source '${e}'`);for(let t of n)if(this.factories.has(t))throw Error(`TransitionActionRegistry: duplicate action type '${t}' from source '${e}'`);for(let e of n)this.factories.set(e,t[e]);this.factoriesBySource.set(e,n)}}deregister(e){if(e===`__builtin__`)return;let t=this.factoriesBySource.get(e);if(t){for(let e of t)this.factories.delete(e);this.factoriesBySource.delete(e)}}async dispatch(e,t){let n=this.factories.get(e.type);if(!n)throw Error(`TransitionActionRegistry: unknown action type '${e.type}'. Registered types: ${[...this.factories.keys()].join(`, `)}`);await n().execute(e,t)}has(e){return this.factories.has(e)}listTypes(){return[...this.factories.keys()]}},rt=class{rulesBySource=new Map;rulesByEventType=new Map;ruleIdSet=new Set;register(e,t){if(t.length===0)return;if(this.rulesBySource.has(e))throw Error(`TransitionRuleRegistry: duplicate source '${e}'`);let n=new Set,r=[];for(let i of t){let t=ve.parse(i);if(n.has(t.id))throw Error(`TransitionRuleRegistry: duplicate rule ID '${t.id}' within source '${e}'`);if(this.ruleIdSet.has(t.id))throw Error(`TransitionRuleRegistry: duplicate rule ID '${t.id}' from source '${e}'`);n.add(t.id),r.push({rule:t,condition:t.when===void 0?void 0:Ae.parse(t.when)})}for(let e of r){let{rule:t}=e;this.ruleIdSet.add(t.id);let n=this.rulesByEventType.get(t.on)??[];n.push(e),this.rulesByEventType.set(t.on,n)}this.rulesBySource.set(e,r)}deregister(e){let t=this.rulesBySource.get(e);if(t){for(let{rule:e}of t){this.ruleIdSet.delete(e.id);let t=this.rulesByEventType.get(e.on);if(t){let n=t.filter(t=>t.rule.id!==e.id);n.length>0?this.rulesByEventType.set(e.on,n):this.rulesByEventType.delete(e.on)}}this.rulesBySource.delete(e)}}getRulesForEvent(e){let t=this.rulesByEventType.get(e);return t?t.filter(e=>e.rule.enabled):[]}snapshotSource(e){let t=this.rulesBySource.get(e);if(t)return{ruleIds:t.map(e=>e.rule.id)}}},it=class extends w{ruleRegistry;actionRegistry;depthMap=new Map;constructor(e){super(e),this.ruleRegistry=new rt,this.actionRegistry=new nt(e)}onInit(){this.registerHandler(v.created,async e=>{await this.handleArtifactEvent(`artifact.created`,{artifact:e.payload.artifact})}),this.registerHandler(v.revised,async e=>{let t=await this.resolvePreviousRevisedArtifact(e.payload.previous);await this.handleArtifactEvent(`artifact.revised`,{artifact:e.payload.artifact,previous:e.payload.previous,...t===void 0?{}:{previousArtifact:t}})}),this.registerHandler(v.status.changed,async e=>{let t=await this.resolveStatusChangedArtifact(e.payload.artifact);t!==void 0&&await this.handleArtifactEvent(`artifact.status.changed`,{artifact:t,path:e.payload.path,previous:e.payload.previous,current:e.payload.current})})}async handleArtifactEvent(e,t){let n=this.artifactKey(t.artifact),r=this.readDepth(n);if(r>=10){console.warn(`[TransitionPipelineService] Transition depth limit (10) reached for event '${e}' on artifact '${n}'. Loop protection active — skipping rule evaluation.`);return}let i=this.ruleRegistry.getRulesForEvent(e);if(i.length!==0)for(let a of i)await this.evaluateAndDispatch(a,e,t,n,r)}async resolveStatusChangedArtifact(e){let t=await this.bus.requestOptional(v.resolve,{ref:e});if(!t.handled){console.warn(`[TransitionPipelineService] No artifact resolver is registered for status transition on artifact '${this.artifactKey(e)}'. Skipping rule evaluation.`);return}if(t.data.artifact===null){console.warn(`[TransitionPipelineService] Could not resolve status transition artifact '${this.artifactKey(e)}'. Skipping rule evaluation.`);return}return t.data.artifact}async resolvePreviousRevisedArtifact(e){let t=await this.bus.requestOptional(v.resolve,{ref:e});if(!(!t.handled||t.data.artifact===null))return t.data.artifact}async evaluateAndDispatch(e,t,n,r,i){let{rule:a,condition:o}=e,s={...n,_transition:{ruleId:a.id,eventType:t,depth:i+1}};if(o!==void 0){let e={...s},t;try{t=je(o,e)}catch(e){console.error(`[TransitionPipelineService] Condition evaluation error for rule '${a.id}':`,e);return}if(!t)return}try{await this.actionRegistry.dispatch(a.action,s),a.action.type===`workflow.start`&&this.incrementDepth(r)}catch(e){console.error(`[TransitionPipelineService] Action dispatch error for rule '${a.id}' (action type '${a.action.type}'):`,e)}}artifactKey(e){return`${typeof e.kind==`string`?e.kind:`unknown`}:${typeof e.id==`string`?e.id:`unknown`}`}readDepth(e){let t=this.depthMap.get(e);return t===void 0?0:Date.now()>t.expiresAt?(this.depthMap.delete(e),0):t.count}incrementDepth(e){let t=this.depthMap.get(e);this.depthMap.set(e,{count:t===void 0?1:t.count+1,expiresAt:Date.now()+6e4})}};function at(e){return async t=>{let n=await ot(e,t);if(!n)return{handled:!1,sessionId:null,clientAccountId:null,changed:!1};let{sessionId:r}=n,{observation:i,accountObserveRequest:a}=st(t),o=await e.requestOptional(E.account.observe,a);if(!o.handled)return{handled:!1,sessionId:r,clientAccountId:null,changed:!1};let{clientAccountId:s}=o.data;return{handled:!0,sessionId:r,clientAccountId:s,changed:await mt(e,r,i,s)}}}async function ot(t,n){switch(n.locator.kind){case`session`:{let{session:r}=await t.request(e.get,{sessionId:n.locator.sessionId});return r?{sessionId:r.sessionId,session:r}:null}case`adapter-session`:{let{session:r}=await t.request(e.getByAdapterSessionId,{adapterSessionId:n.locator.adapterSessionId});return r?{sessionId:r.sessionId,session:r}:null}case`both`:{let[{session:r},{session:i}]=await Promise.all([t.request(e.get,{sessionId:n.locator.sessionId}),t.request(e.getByAdapterSessionId,{adapterSessionId:n.locator.adapterSessionId})]);if(!r&&!i)return null;if(!r||!i)throw Error(`Session locator mismatch: sessionId "${n.locator.sessionId}" and adapterSessionId "${n.locator.adapterSessionId}" must both resolve the same session`);if(r.sessionId!==i.sessionId)throw Error(`Session locator mismatch: sessionId "${n.locator.sessionId}" and adapterSessionId "${n.locator.adapterSessionId}" resolve to different sessions`);return{sessionId:r.sessionId,session:r}}}}function st(e){let t={clientId:e.clientId,source:e.source,kind:e.kind,observedAt:e.observedAt,payload:ft(e.payload)};return{observation:t,accountObserveRequest:ct(t)}}function ct(e){let t=e.payload,n=lt(t),r=ut(t);if(r.length>0)return{clientId:e.clientId,observedAt:e.observedAt,displayLabel:dt(t,n),identifiers:r};throw Error(`client.session.account.observe for "${e.clientId}" requires canonical client account identifiers`)}function lt(e){return pt(e.accountInfo)??e}function ut(e){let t=e.identifiers;if(!Array.isArray(t))return[];try{return g.array(Ce).min(1).parse(t)}catch(e){throw Error(`client.session.account.observe received malformed canonical client account identifiers`,{cause:e})}}function dt(e,t){return K(e.displayLabel)??K(t.displayLabel)??K(t.email)??K(t.label)}function ft(e){return structuredClone(e)}function pt(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}function K(e){return typeof e==`string`&&e.trim().length>0?e.trim():void 0}async function mt(t,n,r,i){let a=await t.request(e.update,{sessionId:n,clientId:r.clientId,clientAccountId:i,lastClientIdentityObservation:r});if(!a.success)throw Error(`Failed to update session "${n}" with client account linkage`);return a.clientAccountChanged??!1}const ht=S(`session-storage`).name;var gt=class extends w{constructor(e=_){super(e)}onInit(){let e=at(this.bus);this.registerHandler(E.session.account.observe,async t=>{t.setResult(await e(we.request.parse(t.payload)))})}};const _t={name:`makaio.session-client-account-linking`,displayName:`Session Client Account Linking`,version:`0.1.0`,dependencies:[x(ht),x(`makaio.clients-core`)],critical:!1,create:e=>new gt(e.bus)},vt={name:`framework-shell`,displayName:`Shell`,version:`0.1.0`,surface:`interactive`,windows:[{id:`main`,style:`utility`,width:1e3,height:700,singleton:!0}]};async function yt(e){let{harnesses:t}=await e.request(m.list,{}),n=new Set(t.map(e=>e.id));for(let t of he){if(n.has(t.id))continue;let r={...t};await e.request(m.set,{harness:r})}}function q(e,t,n){return e??t??n}var bt=class extends w{static storage={drizzle:h};constructor(e=_){super(e)}async onInit(){await yt(this.bus),this.registerHandlers()}registerHandlers(){this.registerHandler(y.get,async e=>{let t=await this.loadHarness(e.payload);if(!t)throw Error(`Harness not found`);e.setResult(t)}),this.registerHandler(y.list,async e=>{let{harnesses:t}=await this.bus.request(m.list,e.payload);e.setResult({harnesses:t})}),this.registerHandler(y.set,async e=>{let t=await this.upsertHarness(e.payload);e.setResult({id:t})}),this.registerHandler(y.delete,async e=>{let{deleted:t}=await this.bus.request(m.delete,{id:e.payload.id});e.setResult({success:t})}),this.registerHandler(y.getDefault,async e=>{let t=await this.getDefaultHarness(e.payload.adapterName,e.payload.clientId);e.setResult(t)}),this.registerHandler(y.resolve,async e=>{let{adapterName:t,clientId:n,personaHarnessId:r,profileHarnessId:i}=e.payload;if(r){let i=await this.resolveAndValidateHarness(r,t,`persona`,n);e.setResult(i);return}if(i){let r=await this.resolveAndValidateHarness(i,t,`profile`,n);e.setResult(r);return}let a=await this.getDefaultHarness(t,n);e.setResult(a)}),this.registerHandler(y.getSchema,({setResult:e})=>{let{$schema:t,...n}=g.toJSONSchema(ge);e({schema:n,uiConfig:{editMode:`fullPage`,hiddenFields:[`isDefault`]}})})}async upsertHarness(e){let t=await this.resolveHarnessId(e.name,e.adapterName,e.clientId),n=await this.loadHarness({id:t,adapterName:e.adapterName,clientId:e.clientId}),r=this.mergeHarnessPayload(t,e,n);return r.adapterName&&await this.validateNativeTools(r.adapterName,r.nativeTools),await this.bus.request(m.set,{harness:r}),t}mergeHarnessPayload(e,t,n){let r={enabled:[],disabled:[]};return{id:e,name:t.name,description:q(t.description,n?.description,void 0),adapterName:t.adapterName,clientId:q(t.clientId,n?.clientId,void 0),env:q(t.env,n?.env,void 0),credentials:q(t.credentials,n?.credentials,void 0),cwd:q(t.cwd,n?.cwd,void 0),approvalPolicy:q(t.approvalPolicy,n?.approvalPolicy,`always-ask`),nativeTools:q(t.nativeTools,n?.nativeTools,r),registryTools:q(t.registryTools,n?.registryTools,r),skills:q(t.skills,n?.skills,void 0),toolCapabilityMap:t.toolCapabilityMap??n?.toolCapabilityMap,capabilityOverrides:t.capabilityOverrides??n?.capabilityOverrides,toolApprovalOverrides:t.toolApprovalOverrides??n?.toolApprovalOverrides,isDefault:q(t.isDefault,n?.isDefault,!1),enabled:q(t.enabled,n?.enabled,!0)}}async resolveHarnessId(e,t,n){let r=n??t,{harnesses:i}=await this.bus.request(m.list,{name:e}),a=i.find(t=>t.name===e&&(t.clientId??t.adapterName)===r);if(a)return a.id;let o=i.find(t=>t.name===e&&(t.clientId??t.adapterName)!==r);if(o){let t=o.clientId?`client '${o.clientId}'`:`adapter '${o.adapterName}'`;throw Error(`Harness "${e}" already exists with scope ${t}; cannot change scope to ${r??`(none)`}`)}return this.createStableHarnessId(e,r)}async loadHarness(e){if(e.id){let{harness:t}=await this.bus.request(m.get,{id:e.id});return t&&(!e.adapterName||t.adapterName===e.adapterName)&&(!e.clientId||t.clientId===e.clientId)?t:null}if(!e.name)return null;let{harnesses:t}=await this.bus.request(m.list,{name:e.name,adapterName:e.adapterName,clientId:e.clientId});return e.clientId?t.find(t=>t.clientId===e.clientId)??null:e.adapterName?t.find(t=>t.adapterName===e.adapterName)??null:t[0]??null}async getDefaultHarness(e,t){if(t){let{harnesses:e}=await this.bus.request(m.list,{clientId:t}),n=e.find(e=>e.isDefault&&e.enabled);if(n)return n;let r=e.find(e=>e.enabled);if(r)return r}if(e){let{harnesses:t}=await this.bus.request(m.list,{adapterName:e}),n=t.find(e=>e.isDefault&&e.enabled);if(n)return n;let r=t.find(e=>e.enabled);if(r)return r}let n=t?e?`client '${t}' or adapter '${e}'`:`client '${t}'`:`adapter '${e}'`;throw Error(`No harness available for ${n}`)}assertHarnessAdapterMatch(e,t,n,r){if(e.adapterName&&t&&e.adapterName!==t)throw Error(`Resolved ${n} harness adapter mismatch: expected "${t}", got "${e.adapterName}"`);if(e.clientId&&r&&e.clientId!==r)throw Error(`Resolved ${n} harness client mismatch: expected "${r}", got "${e.clientId}"`)}assertHarnessEnabled(e,t){if(!e.enabled)throw Error(`Resolved ${t} harness is disabled: ${e.id}`)}async validateNativeTools(e,t){let n=await this.bus.requestOptional(pe.getCapabilities,{adapterName:e});if(!n.handled)return;let r=new Set(n.data.nativeTools),i=[...t.enabled,...t.disabled].filter(e=>!r.has(e));if(i.length>0)throw Error(`Tool '${i[0]}' not found in adapter '${e}' native tools. Declared tools: ${[...r].join(`, `)}`)}createStableHarnessId(e,t){return`harness-${ue(`sha256`).update(`${t??``}\0${e}`).digest(`hex`).slice(0,24)}`}async resolveAndValidateHarness(e,t,n,r){let i=await this.loadHarness({id:e});if(!i)throw Error(`${n===`persona`?`Persona`:`Profile`} harness not found: ${e}`);return this.assertHarnessAdapterMatch(i,t,n,r),this.assertHarnessEnabled(i,n),i}};const xt={name:`makaio.harness`,displayName:`Harness`,version:`0.1.0`,critical:!0,storage:{registerHandlers:T(h)},create:e=>new bt(e.bus)},J=S(`session-storage`),Y=S(`session-bridge`),X=S(`session`),St=S(`session-orchestrator`),Z=S(`tool-registry`),Ct=S(`tool-approval`),wt=S(`tray-menu`),Tt=S(`capability`),Et=S(`model-registry`),Dt=S(`workflow-block-registry`),Ot=S(`transition-pipeline`),kt=S(`filesystem`),At=S(`git`),jt=S(`artifact-schema-registry`),Mt=S(`artifact-lifecycle-hook-registry`),Nt=S(`facet-namespace-registry`),Pt=S(`surface-binding-registry`),Ft={name:jt.name,displayName:`Artifact Schema Registry`,version:`0.1.0`,critical:!0,create:e=>new I(e.bus)},It={name:Mt.name,displayName:`Artifact Lifecycle Hook Registry`,version:`0.1.0`,critical:!0,create:e=>new B(e.bus)},Lt={name:Nt.name,displayName:`Facet Namespace Registry`,version:`0.1.0`,critical:!0,create:e=>new Be(e.bus)},Rt={name:Pt.name,displayName:`Surface Binding Registry`,version:`0.1.0`,critical:!0,create:e=>new Ve(e.bus)},zt={name:J.name,displayName:`Session Storage`,version:`0.1.0`,critical:!0,storage:{registerHandlers:T((e,n)=>{let a=[],o=e=>{for(let t=a.length-1;t>=0;--t)try{a[t]?.()}catch(t){console.warn(`[sessionStoragePackage] cleanup failed during ${e}:`,t)}a.length=0};try{a.push(c(e,n)),a.push(i(e,n)),a.push(r(e,n)),a.push(ne(e,n)),a.push(t(e,n)),a.push(te(e,n)),a.push(l(e,n)),a.push(f(e,n)),a.push(s(e,n)),a.push(u(e)),a.push(ee(e)),a.push(d(e))}catch(e){throw o(`rollback`),e}return()=>{o(`shutdown`)}})}},Bt={name:Y.name,displayName:`Session Bridge`,version:`0.1.0`,dependencies:[x(J.name)],critical:!0,create:e=>new n(e.bus)},Vt={name:X.name,displayName:`Session`,version:`0.1.0`,dependencies:[x(Y.name)],critical:!0,create:e=>new o(e.bus)},Q={name:St.name,displayName:`Session Orchestrator`,version:`0.1.0`,dependencies:[x(X.name),x(W.name)],critical:!0,runtimeOwnership:{sessionOrchestrator:!0},create:e=>new a(e.bus,e.machineId)},Ht={name:Z.name,displayName:`Tool Registry`,version:`0.1.0`,critical:!0,create:e=>new Je({bus:e.bus})},Ut={name:Ct.name,displayName:`Tool Approval`,version:`0.1.0`,dependencies:[x(Z.name)],critical:!0,create:e=>new oe(e.bus)},Wt={name:wt.name,displayName:`Tray Menu`,version:`0.1.0`,critical:!0,create:e=>new se(e.bus)},Gt={name:Tt.name,displayName:`Capability`,version:`0.1.0`,critical:!0,create:e=>new re(e.bus)},Kt={name:Dt.name,displayName:`Workflow Block Registry`,version:`0.1.0`,critical:!0,create:e=>new Ye(e.bus)},$={name:Ot.name,displayName:`Transition Pipeline`,version:`0.1.0`,critical:!0,create:e=>new it(e.bus)},qt={name:kt.name,displayName:`Filesystem`,version:`0.1.0`,critical:!0,create:e=>new le(e.bus,e.machineId)},Jt={name:At.name,displayName:`Git`,version:`0.1.0`,dependencies:[x(kt.name)],critical:!0,create:e=>new Ne(e.bus)};function Yt(e){return{name:Et.name,displayName:`Model Registry`,version:`0.1.0`,critical:!0,create:t=>new ie({bus:t.bus,fetcher:e})}}const Xt=[Ft,It,Lt,Rt,zt,Bt,_t,Vt,Q,ce,Ht,Ut,Wt,Gt,xt,W,vt,Kt,$,Jt,qt];function Zt(){let e=new Map;return{filter:e=>!!e.tools?.createToolsets,async processActivated(t,n,r){let i=r.getService(Z);if(!i)throw Error(`ToolRegistry is not available. Ensure toolRegistryPackage is included in the composition root.`);let a=n.tools.createToolsets(r),o=[];try{for(let e of a)await i.register(e),o.push(()=>i.deregister(e.metadata.name))}catch(e){for(let e=o.length-1;e>=0;--e)try{await o[e]()}catch(e){console.error(`[ToolContributionProcessor] Rollback error for "${t}":`,e)}throw e}e.set(t,o)},async processStopped(t){let n=e.get(t);if(n){for(let e=n.length-1;e>=0;--e)try{await n[e]()}catch(e){console.error(`[ToolContributionProcessor] Deregister error for "${t}":`,e)}e.delete(t)}}}}export{Ut as A,Je as B,Lt as C,Vt as D,Q as E,it as F,Ve as G,Ue as H,rt as I,L as J,Be as K,nt as L,$ as M,Wt as N,zt as O,Kt as P,G as R,Yt as S,Bt as T,He as U,W as V,U as W,I as Y,wt as _,jt as a,Ft as b,Et as c,J as d,X as f,Ot as g,Z as h,Mt as i,Ht as j,Rt as k,Y as l,Ct as m,Oe as n,Tt as o,Pt as p,B as q,Zt as r,Nt as s,Ee as t,St as u,Dt as v,Xt as w,Gt as x,It as y,Ye as z};
|
|
@@ -1,454 +0,0 @@
|
|
|
1
|
-
import { mt as ArtifactRevision$1 } from "./index-DKNmj2sa.mjs";
|
|
2
|
-
import { i as JsonValue$1 } from "./json-value-DtIkQN7g.mjs";
|
|
3
|
-
import { z } from "zod";
|
|
4
|
-
import * as _$_makaio_contracts0 from "@makaio/framework/contracts";
|
|
5
|
-
|
|
6
|
-
//#region core/contracts/src/workflow/blocks.d.ts
|
|
7
|
-
/**
|
|
8
|
-
* JSON Schema document used for `outputSchema` fields on step block run mappings.
|
|
9
|
-
*
|
|
10
|
-
* A JSON Schema document is a JSON object (`Record<string, JsonValue>`). Using
|
|
11
|
-
* the inferred type from {@link JsonSchemaRecordSchema} keeps this type consistent
|
|
12
|
-
* with the schema validator used in persisted workflow node definitions.
|
|
13
|
-
*/
|
|
14
|
-
type JsonSchemaRecord = Record<string, JsonValue$1>;
|
|
15
|
-
/**
|
|
16
|
-
* Step block run mapping that compiles into a `station` primitive node.
|
|
17
|
-
*
|
|
18
|
-
* A station node is an atomic work unit executed by an AI agent or registered
|
|
19
|
-
* runtime handler. The `prompt` is a template evaluated against the builder
|
|
20
|
-
* form values; the optional `role` selects the executor role.
|
|
21
|
-
*/
|
|
22
|
-
interface StationNodeBlockRun {
|
|
23
|
-
/** Run mapping discriminant. */
|
|
24
|
-
readonly type: 'station';
|
|
25
|
-
/**
|
|
26
|
-
* Task prompt template compiled into the station node.
|
|
27
|
-
* Supports `{{ config.<field> }}` and `{{ input.<field> }}` interpolation.
|
|
28
|
-
*/
|
|
29
|
-
readonly prompt: string;
|
|
30
|
-
/**
|
|
31
|
-
* Named role reference forwarded to the compiled station node.
|
|
32
|
-
* Resolved via the bus `resolveRole` RPC before execution.
|
|
33
|
-
*/
|
|
34
|
-
readonly role?: string;
|
|
35
|
-
/**
|
|
36
|
-
* JSON Schema for the expected station output.
|
|
37
|
-
* Forwarded verbatim to the compiled station node's `outputSchema` field.
|
|
38
|
-
*/
|
|
39
|
-
readonly outputSchema?: JsonSchemaRecord;
|
|
40
|
-
/**
|
|
41
|
-
* Positive timeout in milliseconds forwarded to the compiled station node.
|
|
42
|
-
* Defaults to 300 000 ms at execution time when omitted.
|
|
43
|
-
*/
|
|
44
|
-
readonly timeoutMs?: number;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Step block run mapping that compiles into a `delegate-agent` primitive node.
|
|
48
|
-
*
|
|
49
|
-
* The `agentId` references a registered agent definition. The block builder
|
|
50
|
-
* resolves `inputExpression` against the configured form values when compiling
|
|
51
|
-
* the node.
|
|
52
|
-
*/
|
|
53
|
-
interface DelegateAgentNodeBlockRun {
|
|
54
|
-
/** Run mapping discriminant. */
|
|
55
|
-
readonly type: 'delegate-agent';
|
|
56
|
-
/**
|
|
57
|
-
* Identifier of the registered agent definition to invoke.
|
|
58
|
-
*/
|
|
59
|
-
readonly agentId: string;
|
|
60
|
-
/**
|
|
61
|
-
* jexl expression template resolving to the agent input payload.
|
|
62
|
-
* Supports `{{ config.<field> }}` and `{{ input.<field> }}` interpolation
|
|
63
|
-
* that the builder resolves when compiling into a concrete node.
|
|
64
|
-
*/
|
|
65
|
-
readonly inputExpression?: string;
|
|
66
|
-
/**
|
|
67
|
-
* JSON Schema for the expected agent output.
|
|
68
|
-
* Forwarded verbatim to the compiled node's `outputSchema` field.
|
|
69
|
-
*/
|
|
70
|
-
readonly outputSchema?: JsonSchemaRecord;
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Step block run mapping that compiles into a `delegate-role` primitive node.
|
|
74
|
-
*
|
|
75
|
-
* The `role` is a product-resolved named executor. The `prompt` template is
|
|
76
|
-
* evaluated against the builder form values when compiling the node.
|
|
77
|
-
*/
|
|
78
|
-
interface DelegateRoleNodeBlockRun {
|
|
79
|
-
/** Run mapping discriminant. */
|
|
80
|
-
readonly type: 'delegate-role';
|
|
81
|
-
/**
|
|
82
|
-
* Named role reference resolved via the bus `resolveRole` RPC at execution time.
|
|
83
|
-
*/
|
|
84
|
-
readonly role: string;
|
|
85
|
-
/**
|
|
86
|
-
* Task prompt template forwarded to the compiled node.
|
|
87
|
-
* Supports `{{ config.<field> }}` and `{{ input.<field> }}` interpolation.
|
|
88
|
-
*/
|
|
89
|
-
readonly prompt: string;
|
|
90
|
-
/**
|
|
91
|
-
* JSON Schema for the expected delegation output.
|
|
92
|
-
* Forwarded verbatim to the compiled node's `outputSchema` field.
|
|
93
|
-
*/
|
|
94
|
-
readonly outputSchema?: JsonSchemaRecord;
|
|
95
|
-
/**
|
|
96
|
-
* Positive timeout in milliseconds forwarded to the compiled node.
|
|
97
|
-
* Defaults to 300 000 ms at execution time when omitted.
|
|
98
|
-
*/
|
|
99
|
-
readonly timeoutMs?: number;
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Discriminated union of all supported workflow step block run mappings.
|
|
103
|
-
*
|
|
104
|
-
* Each variant maps a declared step block to a concrete primitive node type.
|
|
105
|
-
* The builder compiles the selected variant into the workflow definition as the
|
|
106
|
-
* corresponding {@link WorkflowNode} subtype when the block is placed in the canvas.
|
|
107
|
-
*
|
|
108
|
-
* Extend this union when new primitive node types require builder support.
|
|
109
|
-
*/
|
|
110
|
-
type WorkflowStepBlockRun = StationNodeBlockRun | DelegateAgentNodeBlockRun | DelegateRoleNodeBlockRun;
|
|
111
|
-
/**
|
|
112
|
-
* Metadata shared by all workflow blocks.
|
|
113
|
-
*/
|
|
114
|
-
interface WorkflowBlockMetadata {
|
|
115
|
-
/** Stable identifier, namespaced by extension (e.g., 'coderabbit.review-posted'). */
|
|
116
|
-
name: string;
|
|
117
|
-
/** Human-readable label for the builder UI. */
|
|
118
|
-
label: string;
|
|
119
|
-
/** Short description for tooltips and catalog. */
|
|
120
|
-
description: string;
|
|
121
|
-
/** Grouping tags for the builder palette. Uncategorized blocks appear in "Other". */
|
|
122
|
-
categories?: string[];
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* A trigger block declaration — determines WHEN a workflow starts.
|
|
126
|
-
* @typeParam TConfig - Zod shape for the builder configuration form.
|
|
127
|
-
* @typeParam TOutput - Zod type for the payload passed into the workflow as input.
|
|
128
|
-
*/
|
|
129
|
-
interface WorkflowTriggerBlock<TConfig extends z.ZodRawShape = z.ZodRawShape, TOutput extends z.ZodType = z.ZodType> {
|
|
130
|
-
/** Shared metadata used in the builder palette and catalog. */
|
|
131
|
-
metadata: WorkflowBlockMetadata;
|
|
132
|
-
/** Drives the configuration form in the builder UI. */
|
|
133
|
-
configSchema: z.ZodObject<TConfig>;
|
|
134
|
-
/** The payload shape passed into the workflow when this trigger fires. */
|
|
135
|
-
outputSchema: TOutput;
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* A step block declaration — determines WHAT happens inside a workflow.
|
|
139
|
-
*
|
|
140
|
-
* The `runs` field specifies which primitive node type this block compiles to
|
|
141
|
-
* when placed in the workflow canvas. The builder reads `runs` to construct a
|
|
142
|
-
* concrete {@link WorkflowNode} (station, delegate-agent, or delegate-role) for
|
|
143
|
-
* the persisted workflow definition.
|
|
144
|
-
* @typeParam TConfig - Zod shape for the builder configuration form.
|
|
145
|
-
* @typeParam TInput - Zod type for what this step expects from upstream.
|
|
146
|
-
* @typeParam TOutput - Zod type for what downstream steps can reference.
|
|
147
|
-
*/
|
|
148
|
-
interface WorkflowStepBlock<TConfig extends z.ZodRawShape = z.ZodRawShape, TInput extends z.ZodType = z.ZodType, TOutput extends z.ZodType = z.ZodType> {
|
|
149
|
-
/** Shared metadata used in the builder palette and catalog. */
|
|
150
|
-
metadata: WorkflowBlockMetadata;
|
|
151
|
-
/** Drives the configuration form in the builder UI. */
|
|
152
|
-
configSchema: z.ZodObject<TConfig>;
|
|
153
|
-
/** What this step expects from upstream (expressions/config). */
|
|
154
|
-
inputSchema: TInput;
|
|
155
|
-
/** What downstream steps can reference via steps.<id>.result. */
|
|
156
|
-
outputSchema: TOutput;
|
|
157
|
-
/**
|
|
158
|
-
* Primitive node compilation target for this step block.
|
|
159
|
-
*
|
|
160
|
-
* The builder reads this field and constructs the corresponding primitive
|
|
161
|
-
* node ({@link WorkflowStationNode}, {@link WorkflowDelegateAgentNode}, or
|
|
162
|
-
* {@link WorkflowDelegateRoleNode}) when the block is placed on the canvas.
|
|
163
|
-
*/
|
|
164
|
-
runs: WorkflowStepBlockRun;
|
|
165
|
-
}
|
|
166
|
-
/**
|
|
167
|
-
* Collection of workflow blocks contributed by an extension.
|
|
168
|
-
*/
|
|
169
|
-
interface WorkflowBlockCollection$1 {
|
|
170
|
-
/** Trigger block declarations — each determines WHEN a workflow starts. */
|
|
171
|
-
readonly triggers?: readonly WorkflowTriggerBlock[];
|
|
172
|
-
/** Step block declarations — each determines WHAT happens inside a workflow. */
|
|
173
|
-
readonly steps?: readonly WorkflowStepBlock[];
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* Serialized trigger block as stored in the registry and served via bus.
|
|
177
|
-
*
|
|
178
|
-
* Schema fields are stored as JSON Schema objects for transport and builder
|
|
179
|
-
* catalog rendering.
|
|
180
|
-
*/
|
|
181
|
-
interface RegisteredTriggerBlock$1 {
|
|
182
|
-
/** Trigger metadata combined with the owning extension name. */
|
|
183
|
-
metadata: WorkflowBlockMetadata & {
|
|
184
|
-
extensionName: string;
|
|
185
|
-
};
|
|
186
|
-
/** JSON Schema representation of the builder configuration form. */
|
|
187
|
-
configSchema: Record<string, unknown>;
|
|
188
|
-
/** JSON Schema representation of the trigger output payload. */
|
|
189
|
-
outputSchema: Record<string, unknown>;
|
|
190
|
-
}
|
|
191
|
-
/**
|
|
192
|
-
* Serialized step block as stored in the registry and served via bus.
|
|
193
|
-
*
|
|
194
|
-
* Schema fields are stored as JSON Schema objects for transport and builder
|
|
195
|
-
* catalog rendering. The `runs` field is preserved verbatim from the block
|
|
196
|
-
* declaration so the builder can construct the target primitive node directly.
|
|
197
|
-
*/
|
|
198
|
-
interface RegisteredStepBlock$1 {
|
|
199
|
-
/** Step metadata combined with the owning extension name. */
|
|
200
|
-
metadata: WorkflowBlockMetadata & {
|
|
201
|
-
extensionName: string;
|
|
202
|
-
};
|
|
203
|
-
/** JSON Schema representation of the builder configuration form. */
|
|
204
|
-
configSchema: Record<string, unknown>;
|
|
205
|
-
/** JSON Schema representation of the expected upstream input. */
|
|
206
|
-
inputSchema: Record<string, unknown>;
|
|
207
|
-
/** JSON Schema representation of what downstream steps can reference. */
|
|
208
|
-
outputSchema: Record<string, unknown>;
|
|
209
|
-
/**
|
|
210
|
-
* Primitive node compilation target preserved verbatim from the block declaration.
|
|
211
|
-
* The builder uses this to construct the appropriate primitive node when
|
|
212
|
-
* placing the block on the canvas.
|
|
213
|
-
*/
|
|
214
|
-
runs: WorkflowStepBlockRun;
|
|
215
|
-
}
|
|
216
|
-
//#endregion
|
|
217
|
-
//#region core/contracts/src/workflow/transition.d.ts
|
|
218
|
-
/**
|
|
219
|
-
* The set of artifact bus events that can trigger a transition rule.
|
|
220
|
-
*
|
|
221
|
-
* - `artifact.created` — fires when a new artifact is created
|
|
222
|
-
* - `artifact.revised` — fires when an existing artifact receives a new revision
|
|
223
|
-
* - `artifact.status.changed` — fires when a tracked status field changes
|
|
224
|
-
*/
|
|
225
|
-
declare const TransitionEventTypeSchema: z.ZodEnum<{
|
|
226
|
-
"artifact.created": "artifact.created";
|
|
227
|
-
"artifact.revised": "artifact.revised";
|
|
228
|
-
"artifact.status.changed": "artifact.status.changed";
|
|
229
|
-
}>;
|
|
230
|
-
type TransitionEventType$1 = z.infer<typeof TransitionEventTypeSchema>;
|
|
231
|
-
/**
|
|
232
|
-
* Serializable condition evaluated against an artifact event payload.
|
|
233
|
-
*
|
|
234
|
-
* Stored as an opaque JSON record in the contracts layer. The pipeline
|
|
235
|
-
* service interprets this using `@makaio/rules` at evaluation time,
|
|
236
|
-
* supporting field comparisons, `$and`/`$or`/`$not` combinators, and
|
|
237
|
-
* `$expr` jexl expression strings.
|
|
238
|
-
*
|
|
239
|
-
* Evaluation context shape:
|
|
240
|
-
* - `artifact` — the `ArtifactRevision` involved in the event
|
|
241
|
-
* - `previous` — the previous `ArtifactRef` for `artifact.revised` events
|
|
242
|
-
* - `previousArtifact` — the resolved previous `ArtifactRevision` for
|
|
243
|
-
* `artifact.revised` events when the artifact store can provide it
|
|
244
|
-
* - `path` — the status path for `artifact.status.changed` events
|
|
245
|
-
* - `current` — the new status value for `artifact.status.changed` events
|
|
246
|
-
*/
|
|
247
|
-
declare const TransitionConditionSchema: z.ZodRecord<z.ZodString, z.ZodType<_$_makaio_contracts0.JsonValue, unknown, z.core.$ZodTypeInternals<_$_makaio_contracts0.JsonValue, unknown>>>;
|
|
248
|
-
type TransitionCondition = z.infer<typeof TransitionConditionSchema>;
|
|
249
|
-
/**
|
|
250
|
-
* Invocation descriptor for the action to execute when a transition rule fires.
|
|
251
|
-
*
|
|
252
|
-
* `type` selects the registered action handler; `input` supplies the
|
|
253
|
-
* action-specific payload; `executionHints` threads optional infrastructure
|
|
254
|
-
* hints to the execution host.
|
|
255
|
-
*
|
|
256
|
-
* Built-in action type:
|
|
257
|
-
* - `'workflow.start'` — start a workflow execution via the bus
|
|
258
|
-
*/
|
|
259
|
-
declare const TransitionActionInvocationSchema: z.ZodObject<{
|
|
260
|
-
type: z.ZodString;
|
|
261
|
-
input: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<_$_makaio_contracts0.JsonValue, unknown, z.core.$ZodTypeInternals<_$_makaio_contracts0.JsonValue, unknown>>>>;
|
|
262
|
-
executionHints: z.ZodOptional<z.ZodObject<{
|
|
263
|
-
source: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
264
|
-
kind: z.ZodLiteral<"path">;
|
|
265
|
-
path: z.ZodString;
|
|
266
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
267
|
-
kind: z.ZodLiteral<"source">;
|
|
268
|
-
filename: z.ZodString;
|
|
269
|
-
source: z.ZodString;
|
|
270
|
-
}, z.core.$strict>], "kind">>;
|
|
271
|
-
requirements: z.ZodOptional<z.ZodObject<{
|
|
272
|
-
isolation: z.ZodOptional<z.ZodEnum<{
|
|
273
|
-
local: "local";
|
|
274
|
-
remote: "remote";
|
|
275
|
-
container: "container";
|
|
276
|
-
}>>;
|
|
277
|
-
capabilities: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
278
|
-
}, z.core.$catchall<z.ZodType<_$_makaio_contracts0.JsonValue, unknown, z.core.$ZodTypeInternals<_$_makaio_contracts0.JsonValue, unknown>>>>>;
|
|
279
|
-
providers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<_$_makaio_contracts0.JsonValue, unknown, z.core.$ZodTypeInternals<_$_makaio_contracts0.JsonValue, unknown>>>>;
|
|
280
|
-
}, z.core.$catchall<z.ZodType<_$_makaio_contracts0.JsonValue, unknown, z.core.$ZodTypeInternals<_$_makaio_contracts0.JsonValue, unknown>>>>>;
|
|
281
|
-
}, z.core.$strip>;
|
|
282
|
-
type TransitionActionInvocation$1 = z.infer<typeof TransitionActionInvocationSchema>;
|
|
283
|
-
/**
|
|
284
|
-
* Declarative rule that watches artifact events and triggers workflow actions.
|
|
285
|
-
*
|
|
286
|
-
* Transition rules are purely serializable — no functions. The pipeline service
|
|
287
|
-
* evaluates the `when` condition against the incoming artifact event payload and
|
|
288
|
-
* dispatches the `action` through the `TransitionActionRegistry` when the
|
|
289
|
-
* condition matches.
|
|
290
|
-
*
|
|
291
|
-
* ID namespacing:
|
|
292
|
-
* - Bundle-contributed rules: `'<bundleId>.<localId>'`
|
|
293
|
-
* - Extension-contributed rules: `'<extensionName>.<localId>'`
|
|
294
|
-
*
|
|
295
|
-
* Duplicate IDs across all sources hard-fail activation.
|
|
296
|
-
*/
|
|
297
|
-
declare const TransitionRuleDefinitionSchema$1: z.ZodObject<{
|
|
298
|
-
id: z.ZodString;
|
|
299
|
-
description: z.ZodOptional<z.ZodString>;
|
|
300
|
-
on: z.ZodEnum<{
|
|
301
|
-
"artifact.created": "artifact.created";
|
|
302
|
-
"artifact.revised": "artifact.revised";
|
|
303
|
-
"artifact.status.changed": "artifact.status.changed";
|
|
304
|
-
}>;
|
|
305
|
-
when: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<_$_makaio_contracts0.JsonValue, unknown, z.core.$ZodTypeInternals<_$_makaio_contracts0.JsonValue, unknown>>>>;
|
|
306
|
-
action: z.ZodObject<{
|
|
307
|
-
type: z.ZodString;
|
|
308
|
-
input: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<_$_makaio_contracts0.JsonValue, unknown, z.core.$ZodTypeInternals<_$_makaio_contracts0.JsonValue, unknown>>>>;
|
|
309
|
-
executionHints: z.ZodOptional<z.ZodObject<{
|
|
310
|
-
source: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
311
|
-
kind: z.ZodLiteral<"path">;
|
|
312
|
-
path: z.ZodString;
|
|
313
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
314
|
-
kind: z.ZodLiteral<"source">;
|
|
315
|
-
filename: z.ZodString;
|
|
316
|
-
source: z.ZodString;
|
|
317
|
-
}, z.core.$strict>], "kind">>;
|
|
318
|
-
requirements: z.ZodOptional<z.ZodObject<{
|
|
319
|
-
isolation: z.ZodOptional<z.ZodEnum<{
|
|
320
|
-
local: "local";
|
|
321
|
-
remote: "remote";
|
|
322
|
-
container: "container";
|
|
323
|
-
}>>;
|
|
324
|
-
capabilities: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
325
|
-
}, z.core.$catchall<z.ZodType<_$_makaio_contracts0.JsonValue, unknown, z.core.$ZodTypeInternals<_$_makaio_contracts0.JsonValue, unknown>>>>>;
|
|
326
|
-
providers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<_$_makaio_contracts0.JsonValue, unknown, z.core.$ZodTypeInternals<_$_makaio_contracts0.JsonValue, unknown>>>>;
|
|
327
|
-
}, z.core.$catchall<z.ZodType<_$_makaio_contracts0.JsonValue, unknown, z.core.$ZodTypeInternals<_$_makaio_contracts0.JsonValue, unknown>>>>>;
|
|
328
|
-
}, z.core.$strip>;
|
|
329
|
-
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
330
|
-
}, z.core.$strip>;
|
|
331
|
-
type TransitionRuleDefinition$1 = z.infer<typeof TransitionRuleDefinitionSchema$1>;
|
|
332
|
-
/**
|
|
333
|
-
* Transition rule contribution surface for extension packages.
|
|
334
|
-
*
|
|
335
|
-
* Declarative static rules contributed by an extension. Processed by
|
|
336
|
-
* `TransitionContributionProcessor` during extension activation.
|
|
337
|
-
*/
|
|
338
|
-
interface ExtensionTransitionRulesContribution {
|
|
339
|
-
/**
|
|
340
|
-
* Transition rule definitions contributed by this extension.
|
|
341
|
-
*
|
|
342
|
-
* All IDs must be prefixed with `'<extensionName>.'` (enforced by the
|
|
343
|
-
* contribution processor). Duplicate IDs hard-fail activation.
|
|
344
|
-
*/
|
|
345
|
-
readonly rules: readonly TransitionRuleDefinition$1[];
|
|
346
|
-
}
|
|
347
|
-
/**
|
|
348
|
-
* Callable transition action handler.
|
|
349
|
-
*
|
|
350
|
-
* Invoked by the pipeline when a matching rule fires. Receives the resolved
|
|
351
|
-
* invocation and the artifact event context so it can read artifact data when
|
|
352
|
-
* building downstream bus requests.
|
|
353
|
-
*/
|
|
354
|
-
interface TransitionActionHandler {
|
|
355
|
-
/**
|
|
356
|
-
* Execute the action.
|
|
357
|
-
* @param invocation - Resolved action invocation descriptor.
|
|
358
|
-
* @param context - Evaluation context built from the triggering artifact event.
|
|
359
|
-
* @returns Promise that resolves when the action dispatch completes.
|
|
360
|
-
*/
|
|
361
|
-
readonly execute: (invocation: TransitionActionInvocation$1, context: TransitionEvaluationContext$1) => Promise<void>;
|
|
362
|
-
}
|
|
363
|
-
/**
|
|
364
|
-
* Factory that creates a {@link TransitionActionHandler} for a given action type.
|
|
365
|
-
*
|
|
366
|
-
* Factories are registered at contribution time and instantiated lazily by the
|
|
367
|
-
* pipeline service.
|
|
368
|
-
*/
|
|
369
|
-
type TransitionActionFactory$1 = () => TransitionActionHandler;
|
|
370
|
-
/**
|
|
371
|
-
* Transition action factory contribution surface for extension packages.
|
|
372
|
-
*
|
|
373
|
-
* Extensions that need custom action semantics beyond the built-in
|
|
374
|
-
* `workflow.start` action register their handler factories here.
|
|
375
|
-
*/
|
|
376
|
-
interface ExtensionTransitionActionsContribution {
|
|
377
|
-
/**
|
|
378
|
-
* Map of action type strings to action handler factories.
|
|
379
|
-
*
|
|
380
|
-
* Each key is a registered action `type` string as declared in
|
|
381
|
-
* {@link TransitionActionInvocationSchema}. Values are factories
|
|
382
|
-
* called once per rule dispatch to produce a fresh handler.
|
|
383
|
-
*
|
|
384
|
-
* All keys must be prefixed with `'<extensionName>.'`.
|
|
385
|
-
*/
|
|
386
|
-
readonly actions: Readonly<Record<string, TransitionActionFactory$1>>;
|
|
387
|
-
}
|
|
388
|
-
/**
|
|
389
|
-
* Context object passed to condition evaluation and action dispatch.
|
|
390
|
-
*
|
|
391
|
-
* The pipeline builds this from the incoming artifact event payload so
|
|
392
|
-
* that rules can reference `artifact`, `previous`, `path`, and `current`
|
|
393
|
-
* fields using dot-notation in their `when` conditions.
|
|
394
|
-
*/
|
|
395
|
-
interface TransitionEvaluationContext$1 {
|
|
396
|
-
/**
|
|
397
|
-
* The artifact revision involved in the event.
|
|
398
|
-
*
|
|
399
|
-
* The transition pipeline resolves ref-oriented artifact events, such as
|
|
400
|
-
* `artifact.status.changed`, before evaluating rules so authoring sees a
|
|
401
|
-
* consistent full-revision context.
|
|
402
|
-
*/
|
|
403
|
-
readonly artifact: ArtifactRevision$1;
|
|
404
|
-
/**
|
|
405
|
-
* Previous value from the artifact event. For `artifact.revised` this is the
|
|
406
|
-
* previous artifact ref; for `artifact.status.changed` this is the previous
|
|
407
|
-
* status value.
|
|
408
|
-
*/
|
|
409
|
-
readonly previous?: unknown;
|
|
410
|
-
/**
|
|
411
|
-
* Resolved previous artifact revision for `artifact.revised` events.
|
|
412
|
-
*
|
|
413
|
-
* This preserves `previous` as the original event value while giving rules a
|
|
414
|
-
* full before/after snapshot when they need to detect semantic deltas.
|
|
415
|
-
*/
|
|
416
|
-
readonly previousArtifact?: ArtifactRevision$1;
|
|
417
|
-
/**
|
|
418
|
-
* JSON Pointer path to the status field that changed.
|
|
419
|
-
* Present only for `artifact.status.changed` events.
|
|
420
|
-
*/
|
|
421
|
-
readonly path?: string;
|
|
422
|
-
/**
|
|
423
|
-
* Current status value after the change.
|
|
424
|
-
* Present only for `artifact.status.changed` events.
|
|
425
|
-
*/
|
|
426
|
-
readonly current?: unknown;
|
|
427
|
-
/**
|
|
428
|
-
* Loop-protection metadata injected by the pipeline.
|
|
429
|
-
*
|
|
430
|
-
* Downstream actions can inspect this to detect and break
|
|
431
|
-
* artifact-triggered → workflow → artifact cycles.
|
|
432
|
-
*/
|
|
433
|
-
readonly _transition: {
|
|
434
|
-
/**
|
|
435
|
-
* The transition rule ID that fired this action.
|
|
436
|
-
*/
|
|
437
|
-
readonly ruleId: string;
|
|
438
|
-
/**
|
|
439
|
-
* The artifact event type that matched the rule.
|
|
440
|
-
*/
|
|
441
|
-
readonly eventType: TransitionEventType$1;
|
|
442
|
-
/**
|
|
443
|
-
* Depth counter tracking recursive transition invocations.
|
|
444
|
-
*
|
|
445
|
-
* The pipeline increments this on each nested trigger level.
|
|
446
|
-
* Action handlers that re-emit artifact events must propagate this
|
|
447
|
-
* metadata so the pipeline can reject invocations that exceed the
|
|
448
|
-
* configured maximum depth.
|
|
449
|
-
*/
|
|
450
|
-
readonly depth: number;
|
|
451
|
-
};
|
|
452
|
-
}
|
|
453
|
-
//#endregion
|
|
454
|
-
export { WorkflowTriggerBlock as C, WorkflowStepBlockRun as S, RegisteredTriggerBlock$1 as _, TransitionActionInvocation$1 as a, WorkflowBlockMetadata as b, TransitionConditionSchema as c, TransitionEventTypeSchema as d, TransitionRuleDefinition$1 as f, RegisteredStepBlock$1 as g, DelegateRoleNodeBlockRun as h, TransitionActionHandler as i, TransitionEvaluationContext$1 as l, DelegateAgentNodeBlockRun as m, ExtensionTransitionRulesContribution as n, TransitionActionInvocationSchema as o, TransitionRuleDefinitionSchema$1 as p, TransitionActionFactory$1 as r, TransitionCondition as s, ExtensionTransitionActionsContribution as t, TransitionEventType$1 as u, StationNodeBlockRun as v, WorkflowStepBlock as x, WorkflowBlockCollection$1 as y };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e,r as t,t as n}from"./json-value-CmhSGMLv.mjs";import{b as r,f as i,y as a}from"./artifact-B3npq1cy.mjs";import{a as o}from"./visibility-Cb62p9bv.mjs";import"./credential-ref-YWQQENEo.mjs";import{t as s}from"./provider-context-DjSUpHSM.mjs";import{a as c,o as l}from"./schemas-CE1gbhxu.mjs";import{z as u}from"zod";import{createBusNamespace as d,getFullSubjectForSubjectDefinition as f,observability as ee}from"@makaio/framework/core";const p=u.enum([`wait-in-process`,`exit-and-redispatch`,`exit-and-resume`]),te=u.discriminatedUnion(`kind`,[u.object({kind:u.literal(`path`),path:u.string().min(1)}).strict(),u.object({kind:u.literal(`source`),filename:u.string().min(1),source:u.string()}).strict()]),m=u.object({source:te.optional(),requirements:u.object({isolation:u.enum([`local`,`container`,`remote`]).optional(),capabilities:u.array(u.string()).optional()}).catchall(e).optional(),providers:u.record(u.string(),e).optional()}).catchall(e),h=u.object({kind:u.string().min(1),id:u.string().min(1)});function ne(e){return`${ie(e.kind)}:${ie(e.id)}`}function re(e){let t=ae(e);if(t<1)throw Error(`Invalid artifact ref key: ${e}`);let n=oe(e.slice(t+1));if(n.length===0)throw Error(`Invalid artifact ref key (empty id): ${e}`);return{kind:oe(e.slice(0,t)),id:n}}function ie(e){return e.replace(/\\/g,`\\\\`).replace(/:/g,`\\:`)}function ae(e){let t=!1;for(let n=0;n<e.length;n++){let r=e[n];if(t){t=!1;continue}if(r===`\\`){t=!0;continue}if(r===`:`)return n}return-1}function oe(e){let t=``,n=!1;for(let r of e){if(n){if(r!==`\\`&&r!==`:`)throw Error(`Invalid artifact ref key component: ${e}`);t+=r,n=!1;continue}if(r===`\\`){n=!0;continue}t+=r}if(n)throw Error(`Invalid artifact ref key component: ${e}`);return t}const g=u.union([u.string(),u.number(),u.boolean(),u.null()]),se=u.union([g,u.object({$in:u.array(g)}).strict(),u.object({$ne:g}).strict(),u.object({$exists:u.boolean()}).strict(),u.object({$startsWith:u.string()}).strict(),u.object({$endsWith:u.string()}).strict()]),ce=u.record(u.string(),se),_=u.object({type:u.literal(`bus-event`),subject:u.string(),filter:ce.optional(),filterExpression:u.string().optional()}),le=u.object({type:u.literal(`extension`),extensionType:u.string().regex(/^[a-z0-9-]+:[a-z0-9._-]+$/),config:n.optional()}),v=u.discriminatedUnion(`type`,[u.object({type:u.literal(`manual`)}),u.object({type:u.literal(`cron`),schedule:u.string(),timezone:u.string().optional()}),u.object({type:u.literal(`webhook`),event:u.string(),branch:u.string().optional(),repo:u.string().optional()}),le,_]),y=u.discriminatedUnion(`type`,[u.object({type:u.literal(`global`)}).strict(),u.object({type:u.literal(`workspace`),id:u.string().min(1)}).strict(),u.object({type:u.literal(`session`),id:u.string().min(1)}).strict(),u.object({type:u.literal(`external`),kind:u.string().min(1),id:u.string().min(1)}).strict()]),b=u.string().min(1),x=u.object({kind:u.string().min(1),schemaVersion:u.string().min(1),scope:r,resolve:u.string().min(1).optional(),create:u.string().min(1).optional(),statusPath:u.string().min(1).optional()}),ue=u.object({kind:u.string().min(1),schemaVersion:u.string().min(1),scope:r,dataExpression:u.string().optional()}),de=u.object({file:u.string().min(1),line:u.number().int().positive().optional(),column:u.number().int().positive().optional()}),S=u.enum([`station`,`delegate-agent`,`delegate-role`,`parallel`,`gate`,`iterate`,`iterate-chain`,`loop`,`sequence`]),fe=u.enum([`all-settled`,`fail-fast`]),C=u.object({id:u.string().min(1),when:b.optional(),skip:b.optional(),writes:u.array(ue).optional()}),w=u.lazy(()=>u.discriminatedUnion(`type`,[E,pe,me,he,ge,_e,ve,be,T])),T=C.extend({type:u.literal(`sequence`),nodes:u.lazy(()=>u.array(w))}),E=C.extend({type:u.literal(`station`),prompt:u.string().min(1),role:u.string().min(1).optional(),outputSchema:t.optional(),timeoutMs:u.number().int().positive().optional(),completion:c.optional()}),pe=C.extend({type:u.literal(`delegate-agent`),agentId:u.string().min(1),inputExpression:u.string().optional(),outputSchema:t.optional()}),me=C.extend({type:u.literal(`delegate-role`),role:u.string().min(1),prompt:u.string().min(1),outputSchema:t.optional(),timeoutMs:u.number().int().positive().optional(),completion:c.optional()}),he=C.extend({type:u.literal(`parallel`),mode:fe.optional(),branches:u.record(u.string().min(1),u.lazy(()=>T))}),ge=C.extend({type:u.literal(`gate`),prompt:u.string().min(1),title:u.string().optional(),autoAction:u.enum([`approve`,`reject`]),timeoutMs:u.number().int().positive().nullable(),resumeSchema:t.optional()}),_e=C.extend({type:u.literal(`iterate`),collection:u.string().min(1),body:u.lazy(()=>T),concurrency:u.number().int().nonnegative().optional()}),ve=C.extend({type:u.literal(`iterate-chain`),collection:u.string().min(1),body:u.lazy(()=>T)}),ye=u.discriminatedUnion(`kind`,[u.object({kind:u.literal(`pass`)}).strict(),u.object({kind:u.literal(`loop`)}).strict(),u.object({kind:u.literal(`escalate`),reason:u.string().min(1)}).strict()]),be=C.extend({type:u.literal(`loop`),maxRounds:u.number().int().positive(),body:u.lazy(()=>T),gate:u.object({handler:u.string().min(1),input:u.string().min(1).optional(),config:e.optional(),escalation:u.object({title:u.string().optional(),prompt:u.string().min(1),resumeSchema:t.optional(),autoAction:u.enum([`approve`,`reject`]).default(`reject`),timeoutMs:u.number().int().positive().nullable().default(null)}).strict().optional()}).strict()}),xe=u.object({factoryId:u.string().min(1),preview:u.array(u.lazy(()=>w)).optional(),sourceLocation:de.optional()}),D=u.discriminatedUnion(`kind`,[u.object({kind:u.literal(`editor`)}).strict(),u.object({kind:u.literal(`extension`),extension:u.string().min(1),externalId:u.string().min(1).optional(),syncedAt:u.string().datetime().optional(),metadata:n.default({})}).strict()]),O=u.object({schema:t,initial:e.optional()}),k=u.object({id:u.string().min(1),name:u.string().optional(),description:u.string().optional(),inputSchema:t.optional(),configSchema:t.optional(),outputSchema:t.optional(),state:O.optional(),artifact:x.optional(),root:T,triggers:u.array(v).optional(),scope:y.default({type:`global`}),canvasLayout:u.record(u.string(),e).optional(),source:D.optional(),executionHints:m.optional()}),A=u.enum([`pending`,`running`,`paused`,`completed`,`failed`,`cancelled`]),j=u.object({id:u.string(),workflowId:u.string(),coordinatorSessionId:u.string().optional(),status:A,inputs:e,config:n.optional(),startedAt:u.number(),completedAt:u.number().optional(),error:u.string().optional(),reason:u.string().optional(),triggerPayload:n.optional(),scope:y,artifactRef:h.optional()}),M=u.object({frameId:u.string(),nodeId:u.string(),nodeType:S,path:u.array(u.string()),parentFrameId:u.string().optional(),status:u.enum([`pending`,`running`,`waiting`,`completed`,`failed`,`skipped`,`cancelled`]),attempt:u.number().int().nonnegative().default(0),iteration:u.number().int().nonnegative().optional(),branchKey:u.string().optional(),output:e.optional(),error:u.string().optional(),startedAt:u.number().optional(),completedAt:u.number().optional()}),N=u.enum([`waiting`,`resumed`,`rejected`,`timed-out`,`cancelled`]),Se=u.object({executionId:u.string(),nodeId:u.string(),frameId:u.string(),schema:t,prompt:u.string().optional(),status:N,autoAction:u.enum([`approve`,`reject`]),timeoutMs:u.number().int().positive().nullable(),resumeData:e.optional(),reason:u.string().optional(),createdAt:u.number(),resolvedAt:u.number().optional()}),P=u.object({adapterName:u.string().min(1),model:u.string().optional(),reasoningEffort:o.optional(),harnessId:u.string().optional(),systemPrompt:u.string().optional(),contextMode:l.optional(),providerContext:s.optional(),completion:c.optional()}),Ce=P,we=u.object({scope:y.optional()}),Te=u.object({startedAt:u.number(),id:u.string()}),Ee=1,De=500,Oe=50,ke=u.object({workflowId:u.string().min(1).optional(),scope:y.optional(),status:A.optional(),artifactRef:h.optional(),limit:u.number().int().min(1).max(500).default(50),cursor:Te.optional()}).refine(e=>e.workflowId!==void 0||e.scope!==void 0||e.artifactRef!==void 0,{message:`Either workflowId, scope, or artifactRef is required.`}),Ae=200,je=100,Me=10,Ne=u.object({refs:u.array(h).min(1).max(200),limitPerRef:u.number().int().min(1).max(100).default(10)}),Pe=u.object({executionId:u.string().min(1).optional(),status:N.optional(),limit:u.number().int().min(1).max(500).default(50)}).refine(e=>e.executionId!==void 0||e.status!==void 0,{message:`Either executionId or status is required.`}),F=u.enum([`station`,`delegate-agent`,`delegate-role`,`gate`]),Fe=u.enum([`station`]),Ie=u.object({input:u.number().int().nonnegative(),output:u.number().int().nonnegative(),cached:u.number().int().nonnegative().optional()}),Le=u.object({duration:u.number().nonnegative(),tokenUsage:Ie.optional(),estimatedCost:u.number().nonnegative().optional(),toolCalls:u.number().int().nonnegative().optional()}),Re=u.discriminatedUnion(`kind`,[u.object({kind:u.literal(`none`)}).strict(),u.object({kind:u.literal(`hmac`),secret:u.string().min(1)}).strict()]),ze=u.object({cwd:u.string().min(1),env:u.record(u.string(),u.string()).optional()}),Be=u.object({executionId:u.string().min(1),stepId:u.string().min(1),reason:u.string().optional()});function Ve(e){let t=e.indexOf(`.`);if(t<=0||t===e.length-1)throw Error(`Invalid step cancel subject: ${e}`);return{subject:e.slice(t+1),$meta:{namespace:e.slice(0,t),isRequest:!1,payload:{},local:!1,channel:!1}}}const He=u.object({executionId:u.string().min(1),reason:u.string().optional()});function Ue(e){let t=e.indexOf(`.`);if(t<=0||t===e.length-1)throw Error(`Invalid workflow cancel subject: ${e}`);return{subject:e.slice(t+1),$meta:{namespace:e.slice(0,t),isRequest:!1,payload:{},local:!1,channel:!1}}}const We=u.object({stepId:u.string().min(1),executionId:u.string().min(1),workflowId:u.string().min(1),coordinatorSessionId:u.string().min(1),stepType:Fe,stepDefinition:E,resolvedInputs:n,busUrl:u.string().optional(),busAuth:Re.default({kind:`none`}),platformDefaults:ze,cancelSubject:u.string().min(1)}).superRefine((e,t)=>{e.stepType!==e.stepDefinition.type&&t.addIssue({code:`custom`,path:[`stepDefinition`,`type`],message:`stepDefinition.type must match stepType (${e.stepType})`})}),Ge=`Workflow cancelled`,Ke=u.object({status:u.enum([`completed`,`failed`]),output:e.optional(),error:u.string().optional(),telemetry:Le}),qe=u.enum([`running`,`completed`,`failed`,`skipped`]),I=u.object({executionId:u.string().min(1),frameId:u.string().min(1),stepId:u.string().min(1),stepType:F,status:qe,startedAt:u.number().optional(),completedAt:u.number().optional(),durationMs:u.number().nonnegative().optional(),inputTokens:u.number().int().nonnegative().optional(),outputTokens:u.number().int().nonnegative().optional(),estimatedCost:u.number().nonnegative().optional(),toolCallCount:u.number().int().nonnegative().optional(),input:u.string().optional(),output:u.string().optional()}),Je=u.enum([`triggered-by`,`feedback-loop`,`rerun-of`]),L=u.object({sourceExecutionId:u.string().min(1),targetExecutionId:u.string().min(1),linkType:Je,metadata:u.record(u.string(),u.unknown()).optional()}),Ye=u.object({sourceExecutionId:u.string().min(1).optional(),targetExecutionId:u.string().min(1).optional()}).refine(e=>e.sourceExecutionId!==void 0||e.targetExecutionId!==void 0,{message:`Either sourceExecutionId or targetExecutionId is required.`}),Xe={RUN_CONTEXT_NOT_FOUND:`WORKFLOW_RUN_CONTEXT_NOT_FOUND`,SNAPSHOT_UNAVAILABLE:`WORKFLOW_SNAPSHOT_UNAVAILABLE`,SOURCE_MISMATCH:`WORKFLOW_SOURCE_MISMATCH`,NOT_EXECUTABLE:`WORKFLOW_NOT_EXECUTABLE`,HANDLER_UNAVAILABLE:`WORKFLOW_HANDLER_UNAVAILABLE`};var Ze=class extends Error{code;constructor(e,t){super(t),this.code=e,this.name=`WorkflowError`}};const R=u.string().refine(e=>e===``||e.startsWith(`/`),{message:`JSON Patch paths must be empty or start with "/".`}),Qe=u.object({op:u.enum([`add`,`replace`,`test`]),path:R,value:e}).strict(),$e=u.object({op:u.literal(`remove`),path:R}).strict(),et=u.object({op:u.enum([`move`,`copy`]),path:R,from:R}).strict(),z=u.discriminatedUnion(`op`,[Qe,$e,et]),tt=u.object({type:u.literal(`artifact-query`),query:i,select:u.enum([`latest`,`all`]),optional:u.boolean().optional()}),nt=u.object({type:u.literal(`bus-request`),subject:u.string().min(1),payload:u.record(u.string(),u.unknown()).optional(),optional:u.boolean().optional()}),rt=u.discriminatedUnion(`type`,[tt,nt]),it=u.object({type:u.literal(`artifact`),kind:u.string().min(1),schemaVersion:u.string().min(1),scope:r,metadata:u.record(u.string(),u.unknown()).optional()}),at=u.object({type:u.literal(`bus-event`),subject:u.string().min(1),payload:u.record(u.string(),u.unknown()).optional()}),ot=u.discriminatedUnion(`type`,[it,at]),st=u.object({content:u.string(),metadata:u.record(u.string(),u.unknown()).optional()}),ct=u.object({sources:u.record(u.string(),st)}),lt=u.discriminatedUnion(`kind`,[u.object({kind:u.literal(`none`)}).strict(),u.object({kind:u.literal(`hmac`),secret:u.string().min(1)}).strict()]),B=u.discriminatedUnion(`kind`,[u.object({kind:u.literal(`path`),path:u.string().min(1)}).strict(),u.object({kind:u.literal(`source`),filename:u.string().min(1),source:u.string()}).strict(),u.object({kind:u.literal(`definition`),workflowId:u.string().min(1)}).strict()]),ut=u.object({source:B,definition:k.optional(),executionId:u.string().min(1),workflowId:u.string().min(1),triggerPayload:n.default({}),inputs:e.default({}),config:n.optional(),artifactRef:h.optional(),scope:y.default({type:`global`}),busUrl:u.string().optional(),busAuth:lt.default({kind:`none`}),context:u.object({repoPath:u.string().min(1),makaioHome:u.string().min(1),os:u.enum([`darwin`,`linux`,`win32`]),arch:u.string().min(1),worktree:u.string().optional()}),env:u.record(u.string(),u.string()).default({}),coordinatorSessionId:u.string().min(1),executionHints:m.optional(),cancelSubject:u.string().min(1),suspensionStrategy:p.default(`wait-in-process`)}),V=u.object({executionId:u.string().min(1),workflowId:u.string().min(1)}),dt=u.discriminatedUnion(`status`,[V.extend({status:u.literal(`completed`),artifact:a.optional()}).strict(),V.extend({status:u.literal(`failed`),error:u.string().min(1)}).strict(),V.extend({status:u.literal(`cancelled`),reason:u.string().min(1).optional()}).strict(),V.extend({status:u.literal(`paused`),pausedAtGateId:u.string().min(1),pausedAtFrameId:u.string().min(1)}).strict()]),ft=u.object({name:u.string().min(1),importPath:u.string().min(1)}),pt=u.object({packages:u.array(ft).default([])}),mt=u.object({executionId:u.string().min(1),workflowId:u.string().min(1),source:B,definitionSnapshot:k.optional(),workerManifest:pt.default({packages:[]}),inputs:e.default({}),config:n.optional(),scope:y.default({type:`global`}),triggerPayload:n.default({}),artifactRef:h.optional(),coordinatorSessionId:u.string().min(1),executionHints:m.optional(),dispatchMetadata:n.optional(),cancelSubject:u.string().min(1),context:u.object({repoPath:u.string().min(1),makaioHome:u.string().min(1),os:u.enum([`darwin`,`linux`,`win32`]),arch:u.string().min(1),worktree:u.string().optional()}),env:u.record(u.string(),u.string()).default({}),createdAt:u.number(),suspensionStrategy:p.default(`wait-in-process`)}).superRefine((e,t)=>{e.source.kind===`definition`&&e.definitionSnapshot===void 0&&t.addIssue({code:u.ZodIssueCode.custom,path:[`definitionSnapshot`],message:`definitionSnapshot is required when source.kind is "definition"`})}),H=u.object({executionId:u.string().min(1),workflowId:u.string().min(1),workflowName:u.string().optional(),status:u.enum([`pending`,`running`,`paused`,`completed`,`failed`,`cancelled`]),startedAt:u.number(),completedAt:u.number().optional(),durationMs:u.number().nonnegative().optional(),totalInputTokens:u.number().int().nonnegative().optional(),totalOutputTokens:u.number().int().nonnegative().optional(),totalEstimatedCost:u.number().nonnegative().optional(),error:u.string().optional(),failedNodeId:u.string().optional()}),ht=u.object({executionId:u.string().min(1),frameId:u.string().min(1),nodeId:u.string().min(1),nodeType:F,path:u.array(u.string()),status:u.enum([`pending`,`running`,`waiting`,`completed`,`failed`,`skipped`,`cancelled`]),attempt:u.number().int().nonnegative(),iteration:u.number().int().nonnegative().optional(),branchKey:u.string().optional(),startedAt:u.number().optional(),completedAt:u.number().optional(),durationMs:u.number().nonnegative().optional(),inputTokens:u.number().int().nonnegative().optional(),outputTokens:u.number().int().nonnegative().optional(),estimatedCost:u.number().nonnegative().optional(),error:u.string().optional()}),gt=u.object({executionId:u.string().min(1),frameId:u.string().min(1),nodeId:u.string().min(1),artifact:x,revision:u.string().min(1).optional(),writtenAt:u.number()}),_t=u.object({executionId:u.string().min(1),nodeId:u.string().min(1),frameId:u.string().min(1),status:u.enum([`waiting`,`resumed`,`rejected`,`timed-out`,`cancelled`]),prompt:u.string().optional(),openedAt:u.number(),resolvedAt:u.number().optional(),resumeData:e.optional()}),vt=u.object({executionId:u.string().min(1),inputTokens:u.number().int().nonnegative(),outputTokens:u.number().int().nonnegative(),cachedTokens:u.number().int().nonnegative().optional(),estimatedCost:u.number().nonnegative(),byModel:u.record(u.string(),u.object({inputTokens:u.number().int().nonnegative(),outputTokens:u.number().int().nonnegative(),estimatedCost:u.number().nonnegative()})).optional()}),yt=u.object({total:u.number().int().nonnegative(),byStatus:u.object({pending:u.number().int().nonnegative(),running:u.number().int().nonnegative(),paused:u.number().int().nonnegative(),completed:u.number().int().nonnegative(),failed:u.number().int().nonnegative(),cancelled:u.number().int().nonnegative()}),totalDurationMs:u.number().nonnegative(),totalInputTokens:u.number().int().nonnegative(),totalOutputTokens:u.number().int().nonnegative(),totalEstimatedCost:u.number().nonnegative()}),bt=u.object({executionId:u.string().min(1),frameId:u.string().min(1),factoryId:u.string().min(1),materializedNodeIds:u.array(u.string().min(1)),factoryInput:t.optional(),materializedAt:u.number()}),xt=u.object({message:u.string().min(1),details:u.string().min(1).optional(),kind:u.string().min(1).optional(),metadata:e.optional()}).strict(),U=u.object({executionId:u.string(),stepId:u.string(),stepType:u.enum([`station`,`delegate-agent`,`delegate-role`,`gate`])}),W=U.extend({stepType:u.literal(`gate`)}),St=u.discriminatedUnion(`source`,[W.extend({frameId:u.string(),action:u.enum([`approve`,`reject`]),source:u.literal(`user`),reason:u.string().optional()}),W.extend({frameId:u.string(),action:u.enum([`approve`,`reject`]),source:u.literal(`timeout`)}),W.extend({frameId:u.string(),source:u.literal(`cancelled`)})]),Ct=W.extend({workflowId:u.string(),workflowName:u.string(),title:u.string(),message:u.string(),autoAction:u.enum([`approve`,`reject`]),timeoutMs:u.number().nullable(),openedAt:u.number()}),wt={getDefinition:{request:u.object({id:u.string()}),response:u.object({workflow:k.nullable()})},setDefinition:{request:u.object({workflow:k}),response:u.object({id:u.string()})},deleteDefinition:{request:u.object({id:u.string()}),response:u.object({deleted:u.boolean()})},listDefinitions:{request:we,response:u.object({workflows:u.array(k)})},"definition.created":k,"definition.updated":k,"definition.deleted":u.object({id:u.string()}),start:{request:u.object({workflowId:u.string(),input:e.optional(),config:e.optional(),artifactRef:h.optional(),scope:y.optional(),executionHints:m.optional(),parentSessionId:u.string().optional(),triggerPayload:n.optional()}),response:u.object({executionId:u.string()})},rerun:{request:u.object({executionId:u.string().min(1),mode:u.enum([`snapshot`,`current`]),input:e.optional(),config:e.optional(),artifactRef:h.optional(),scope:y.optional(),executionHints:m.optional(),parentSessionId:u.string().optional(),triggerPayload:n.optional(),reason:u.string().min(1).optional()}),response:u.object({executionId:u.string()})},cancel:{request:u.object({executionId:u.string(),reason:u.string().optional()}),response:u.object({cancelled:u.boolean()})},getExecution:{request:u.object({executionId:u.string()}),response:u.object({execution:j.nullable()})},listExecutions:{request:ke,response:u.object({executions:u.array(j)})},listExecutionsByArtifactRefs:{request:Ne,response:u.object({executionsByRef:u.record(u.string(),u.array(j))})},listSpans:{request:u.object({executionId:u.string()}),response:u.object({spans:u.array(I)})},listGateInstances:{request:Pe,response:u.object({gates:u.array(Se)})},setExecutionLink:{request:u.object({link:L}),response:u.object({id:u.string()})},listExecutionLinks:{request:Ye,response:u.object({links:u.array(L)})},listFrames:{request:u.object({executionId:u.string().min(1)}),response:u.object({frames:u.array(M)})},listTriggerTypes:{request:u.object({}),response:u.object({triggerTypes:u.array(u.object({type:u.string(),displayName:u.string(),icon:u.string(),category:u.string(),description:u.string().optional(),configJsonSchema:t,outputJsonSchema:t,source:u.string()}))})},runFile:{request:u.object({filePath:u.string().min(1),triggerPayload:n.optional(),scope:y.optional()}),response:u.object({executionId:u.string()})},resolveRole:{request:u.object({roleId:u.string().min(1)}),response:P},resolveAgent:{request:u.object({agentId:u.string().min(1)}),response:Ce},getRunContext:{request:u.object({executionId:u.string().min(1)}),response:mt},"execution.started":u.object({executionId:u.string(),workflowId:u.string(),coordinatorSessionId:u.string().optional(),startedAt:u.number().nonnegative().optional(),artifactRef:h.optional()}),"execution.completed":u.object({executionId:u.string(),workflowId:u.string(),totalDuration:u.number(),completedAt:u.number().nonnegative().optional()}),"execution.failed":u.object({executionId:u.string(),workflowId:u.string(),error:u.string(),failedStepId:u.string().optional(),completedAt:u.number().nonnegative().optional()}),"execution.cancelled":u.object({executionId:u.string(),workflowId:u.string(),reason:u.string().optional(),completedAt:u.number().nonnegative().optional()}),"execution.progress":u.object({executionId:u.string().min(1),workflowId:u.string().min(1),frameId:u.string().min(1),nodeId:u.string().min(1),progress:xt,emittedAt:u.number().int().nonnegative()}),"execution.paused":ee.schema(u.object({executionId:u.string(),workflowId:u.string(),pausedAtGateId:u.string().min(1),pausedAtFrameId:u.string().min(1)}),{traceAll:!0}),"step.beforeStart":U,"step.started":U.extend({sessionId:u.string().optional(),subagentId:u.string().optional()}),"step.completed":U.extend({result:e.optional(),duration:u.number()}),"step.failed":U.extend({error:u.string()}),"step.skipped":U.extend({reason:u.string().optional(),condition:u.string().optional()}),"gate.requested":Ct,"gate.awaitApproval":{request:Ct,response:u.object({action:u.enum([`approve`,`reject`]),source:u.enum([`user`,`timeout`]),reason:u.string().optional()})},"gate.respond":{request:u.object({executionId:u.string(),gateId:u.string(),action:u.enum([`approve`,`reject`]),frameId:u.string().optional(),resumeData:e,reason:u.string().optional()}),response:u.object({accepted:u.boolean()})},"gate.resolved":St,"frame.started":u.object({executionId:u.string(),frameId:u.string(),nodeId:u.string(),nodeType:S,path:u.array(u.string()),parentFrameId:u.string().optional(),startedAt:u.number().nonnegative().optional()}),"frame.completed":u.object({executionId:u.string(),frameId:u.string(),nodeId:u.string(),output:e.optional(),duration:u.number().nonnegative().optional(),completedAt:u.number().nonnegative().optional()}),"frame.failed":u.object({executionId:u.string(),frameId:u.string(),nodeId:u.string(),error:u.string(),duration:u.number().nonnegative().optional(),completedAt:u.number().nonnegative().optional()}),"frame.sessionLinked":u.object({executionId:u.string(),frameId:u.string(),sessionId:u.string()}).strict(),"gate.suspended":u.object({executionId:u.string(),frameId:u.string(),nodeId:u.string(),schema:t,prompt:u.string().optional(),title:u.string().optional(),autoAction:u.enum([`approve`,`reject`]),timeoutMs:u.number().nullable(),openedAt:u.number()}),"gate.resumed":u.object({executionId:u.string(),frameId:u.string(),nodeId:u.string(),resumeData:e}),"dynamic.materialized":u.object({executionId:u.string(),frameId:u.string(),factoryId:u.string().min(1),materializedNodes:u.number().int().nonnegative()}),"artifact.updated":u.object({executionId:u.string(),frameId:u.string(),artifactRef:u.object({kind:u.string().min(1),id:u.string().min(1)}),paths:u.array(u.string()),operation:u.string().min(1),revision:u.string().min(1).optional()}),"worklog.get":{request:u.object({executionId:u.string().min(1)}),response:u.object({summary:H.nullable()})},"worklog.list":{request:u.object({workflowId:u.string().min(1).optional(),status:A.optional(),limit:u.number().int().positive().optional(),offset:u.number().int().nonnegative().optional()}),response:u.object({items:u.array(H),total:u.number().int().nonnegative()})},"worklog.stats":{request:u.object({workflowId:u.string().min(1).optional(),since:u.number().int().nonnegative().optional(),until:u.number().int().nonnegative().optional()}),response:u.object({stats:yt})},"worklog.changed":u.object({executionId:u.string().min(1)}),"state.get":{request:u.object({executionId:u.string().min(1)}),response:u.object({executionId:u.string().min(1),sequence:u.number().int().nonnegative(),value:e})},"state.patch":{request:u.object({executionId:u.string().min(1),expectedSequence:u.number().int().nonnegative(),patch:u.array(z),nextValue:e}),response:u.object({executionId:u.string().min(1),sequence:u.number().int().positive(),value:e})},"state.updated":u.object({executionId:u.string().min(1),sequence:u.number().int().positive(),patch:u.array(z),value:e,updatedAt:u.number().int().positive()})},Tt=d(`workflow`,wt),Et=Tt.subjects;function Dt(e,t){G(e,t,void 0,0,[],`root`,void 0,void 0)}function G(e,t,n,r,i,a,o,s){let c={parent:n,depth:r,ancestors:i,relationship:a,...o!==void 0&&{index:o},...s!==void 0&&{branchKey:s}};if(t.enter?.(e,c)===!1)return;let l=[...i,e.id],u=r+1;switch(e.type){case`sequence`:{let n=e;for(let r=0;r<n.nodes.length;r++)G(n.nodes[r],t,e,u,l,`sequence-child`,r,void 0);break}case`parallel`:{let n=e;for(let[r,i]of Object.entries(n.branches))G(i,t,e,u,l,`parallel-branch`,void 0,r);break}case`iterate`:G(e.body,t,e,u,l,`iterate-body`,void 0,void 0);break;case`iterate-chain`:G(e.body,t,e,u,l,`iterate-chain-body`,void 0,void 0);break;case`loop`:G(e.body,t,e,u,l,`loop-body`,void 0,void 0);break}t.leave?.(e,c)}function Ot(e){switch(e){case`station`:case`delegate-agent`:case`delegate-role`:case`gate`:return`leaf`;case`parallel`:case`iterate`:case`iterate-chain`:case`loop`:return`control`;case`sequence`:return`structural`}}function kt(e,t,n){return e===`parallel-branch`&&t!==void 0?[{kind:`branch`,key:t}]:e===`sequence-child`&&n!==void 0?[{kind:`index`,value:n}]:e===`iterate-body`||e===`iterate-chain-body`||e===`loop-body`?[{kind:`body`}]:[]}function At(e){return e.replace(/\\/g,`\\\\`).replace(/\//g,`\\/`)}function jt(e){return e.map(e=>{switch(e.kind){case`node`:return`n:${At(e.id)}`;case`branch`:return`b:${At(e.key)}`;case`index`:return`i:${e.value}`;case`body`:return`body`}}).join(`/`)}function Mt(e){let t=[],n=[],r=new Map,i=[],a=[],o=[];return Dt(e.root,{enter(e,s){let c=kt(s.relationship,s.branchKey,s.index),l={kind:`node`,id:e.id};i.push(...c,l),o.push(c.length+1);let u=[...i],d=jt(u),f=a.at(-1);if(t.push({key:d,nodeId:e.id,type:e.type,role:Ot(e.type),path:u,parentKey:f,...s.branchKey!==void 0&&{branchKey:s.branchKey}}),f!==void 0&&s.parent!==void 0)switch(s.parent.type){case`sequence`:{n.push({sourceKey:f,targetKey:d,kind:`contains`});let e=r.get(f);e!==void 0&&n.push({sourceKey:e,targetKey:d,kind:`sequence`}),r.set(f,d);break}case`parallel`:n.push({sourceKey:f,targetKey:d,kind:`branch`});break;case`iterate`:case`iterate-chain`:case`loop`:n.push({sourceKey:f,targetKey:d,kind:`body`});break;default:n.push({sourceKey:f,targetKey:d,kind:`contains`});break}a.push(d)},leave(){let e=o.pop()??0;i.splice(i.length-e,e),a.pop()}}),{nodes:t,edges:n}}function K(e){return q(e.body.nodes,e.id)}function q(e,t){for(let n of e){if(n.type===`loop`)return`Nested loop '${n.id}' found inside loop '${t}' — V1 does not support nested loops`;if(n.type===`sequence`){let e=q(n.nodes,t);if(e)return e}if(n.type===`parallel`)for(let e of Object.values(n.branches)){let n=q(e.nodes,t);if(n)return n}if(n.type===`iterate`||n.type===`iterate-chain`){let e=n.body,r=q(e.nodes,t);if(r)return r}}}const J=new WeakMap,Nt=new WeakMap;function Y(e){let{$schema:t,...n}=u.toJSONSchema(e);return n}function X(e,t,n){let r=J.get(e);if(r!==void 0&&t.set(e.id,r),e.type===`sequence`)for(let r of e.nodes)X(r,t,n);else if(e.type===`parallel`)for(let r of Object.values(e.branches))X(r,t,n);else if(e.type===`iterate`)X(e.body,t,n);else if(e.type===`iterate-chain`)X(e.body,t,n);else if(e.type===`loop`){if(n!==void 0){let t=Nt.get(e);t!==void 0&&n.set(e.gate.handler,t)}X(e.body,t,n)}}function Pt(e,t,n){let r={id:e,type:`station`,prompt:e,...n?.when!==void 0&&{when:n.when},...n?.skip!==void 0&&{skip:n.skip}};return J.set(r,t),r}function Ft(e,t,n){return{id:e,type:`delegate-agent`,agentId:t.agentId,...t.inputExpression!==void 0&&{inputExpression:t.inputExpression},...t.outputSchema!==void 0&&{outputSchema:t.outputSchema},...n?.when!==void 0&&{when:n.when},...n?.skip!==void 0&&{skip:n.skip}}}function It(e,t,n){return{id:e,type:`delegate-role`,role:t,prompt:n?.prompt??e,...n?.when!==void 0&&{when:n.when},...n?.skip!==void 0&&{skip:n.skip},...n?.outputSchema!==void 0&&{outputSchema:n.outputSchema},...n?.timeoutMs!==void 0&&{timeoutMs:n.timeoutMs},...n?.completion!==void 0&&{completion:n.completion}}}function Lt(e,t){return{id:e,type:`gate`,prompt:t.prompt,autoAction:t.autoAction,timeoutMs:t.timeoutMs,...t.title!==void 0&&{title:t.title},...t.resume!==void 0&&{resumeSchema:Y(t.resume)}}}function Rt(e,t,n){let r=`${e}__item`,i={id:r,type:`station`,prompt:r},a={id:e,type:`iterate`,collection:n.collection,body:{id:`${e}__body`,type:`sequence`,nodes:[i]},...n.concurrency!==void 0&&{concurrency:n.concurrency},...n.when!==void 0&&{when:n.when},...n.skip!==void 0&&{skip:n.skip}};return J.set(i,t),a}function zt(e,t,n){return{id:e,type:`iterate-chain`,collection:n.collection,body:{id:`${e}__body`,type:`sequence`,nodes:t},...n.when!==void 0&&{when:n.when},...n.skip!==void 0&&{skip:n.skip}}}function Bt(e,t,n){let r={id:e,type:`loop`,maxRounds:n.maxRounds,body:{id:`${e}__body`,type:`sequence`,nodes:t},gate:Vt(n),...n.when!==void 0&&{when:n.when},...n.skip!==void 0&&{skip:n.skip}},i=K(r);if(i!==void 0)throw Error(i);return Nt.set(r,n.gate.evaluate),r}function Vt(e){let t=e.gate.escalation;return{handler:e.gate.handler,...e.gate.input!==void 0&&{input:e.gate.input},...e.gate.config!==void 0&&{config:e.gate.config},...t!==void 0&&{escalation:{prompt:t.prompt,autoAction:t.autoAction??`reject`,timeoutMs:t.timeoutMs??null,...t.title!==void 0&&{title:t.title},...t.resumeSchema!==void 0&&{resumeSchema:t.resumeSchema}}}}}function Ht(e){return{type:`bus-event`,subject:f(e.subject),...e.filter!==void 0&&{filter:e.filter},...e.filterExpression!==void 0&&{filterExpression:e.filterExpression}}}function Ut(){return{type:`manual`}}function Wt(e){return{type:`cron`,schedule:e.schedule,...e.timezone!==void 0&&{timezone:e.timezone}}}function Gt(e){return{type:`webhook`,event:e.event,...e.branch!==void 0&&{branch:e.branch},...e.repo!==void 0&&{repo:e.repo}}}function Kt(e){return{type:`extension`,extensionType:e.extensionType,...e.config!==void 0&&{config:e.config}}}function Z(e,t){if(e.has(t))throw Error(`Duplicate step ID: ${t}`);e.add(t)}function Q(e,t){if(Z(e,t.id),t.type===`sequence`)for(let n of t.nodes)Q(e,n);else if(t.type===`parallel`)for(let n of Object.values(t.branches))Q(e,n);else (t.type===`iterate`||t.type===`iterate-chain`||t.type===`loop`)&&Q(e,t.body)}function qt(e,t,n,r,i){let a={};return t.forEach((t,o)=>{if(t.id.length===0)throw Error(`parallel branch at index ${o} has an empty ID`);let s=t.id,c=`${e}__${s}`;Q(n,t),Z(n,c),X(t,r,i),a[s]={id:c,type:`sequence`,nodes:[t]}}),a}function Jt(e,t,n,r,i){let a=`${e}__body`,o=`${e}__item`;Z(r,a),Z(r,o),i.set(o,t);let s={id:o,type:`station`,prompt:o};return{id:e,type:`iterate`,collection:n.collection,body:{id:a,type:`sequence`,nodes:[s]},...n.concurrency!==void 0&&{concurrency:n.concurrency},...n.when!==void 0&&{when:n.when},...n.skip!==void 0&&{skip:n.skip}}}function Yt(e,t,n){return t.resume!==void 0&&(n[e]=t.resume),{id:e,type:`gate`,prompt:t.prompt,autoAction:t.autoAction,timeoutMs:t.timeoutMs,...t.title!==void 0&&{title:t.title},...t.resume!==void 0&&{resumeSchema:Y(t.resume)}}}function Xt(e,t,n,r,i,a){let o=`${e}__body`;Z(r,o);for(let e of t)Q(r,e),X(e,i,a);return{id:e,type:`iterate-chain`,collection:n.collection,body:{id:o,type:`sequence`,nodes:t},...n.when!==void 0&&{when:n.when},...n.skip!==void 0&&{skip:n.skip}}}function Zt(e,t,n,r,i,a){let o=`${e}__body`;Z(r,o);for(let e of t)Q(r,e),X(e,i,a);let s={id:e,type:`loop`,maxRounds:n.maxRounds,body:{id:o,type:`sequence`,nodes:t},gate:Vt(n),...n.when!==void 0&&{when:n.when},...n.skip!==void 0&&{skip:n.skip}},c=K(s);if(c!==void 0)throw Error(c);return a.set(n.gate.handler,n.gate.evaluate),s}function Qt(e,t){e.input=n=>(t.zodSchemas.input=n,t.definition.inputSchema=Y(n),e),e.config=n=>(t.zodSchemas.config=n,t.definition.configSchema=Y(n),e),e.output=n=>(t.zodSchemas.output=n,t.definition.outputSchema=Y(n),e),e.artifact=n=>(n.schema!==void 0&&(t.zodSchemas.artifact=n.schema),t.definition.artifact={kind:n.kind,schemaVersion:n.schemaVersion,scope:n.scope,...n.resolve!==void 0&&{resolve:n.resolve},...n.create!==void 0&&{create:n.create},...n.statusPath!==void 0&&{statusPath:n.statusPath}},e),e.state=e=>(t.definition.state={schema:e.schema,...e.initial!==void 0&&{initial:e.initial}},$(t))}function $t(e,t){let{rootNodes:n,runtimeHandlers:r,runtimeLoopGates:i,registeredIds:a,zodGates:o}=t;e.station=(t,i,o)=>(Z(a,t),n.push({id:t,type:`station`,prompt:t,...o?.when!==void 0&&{when:o.when},...o?.skip!==void 0&&{skip:o.skip}}),r.set(t,i),e),e.delegateToAgent=(t,r,i)=>{Z(a,t);let o={id:t,type:`delegate-agent`,agentId:r.agentId,...r.inputExpression!==void 0&&{inputExpression:r.inputExpression},...r.outputSchema!==void 0&&{outputSchema:r.outputSchema},...i?.when!==void 0&&{when:i.when},...i?.skip!==void 0&&{skip:i.skip}};return n.push(o),e},e.delegateToRole=(t,r,i)=>(Z(a,t),n.push({id:t,type:`delegate-role`,role:r,prompt:i?.prompt??t,...i?.when!==void 0&&{when:i.when},...i?.skip!==void 0&&{skip:i.skip},...i?.outputSchema!==void 0&&{outputSchema:i.outputSchema},...i?.timeoutMs!==void 0&&{timeoutMs:i.timeoutMs},...i?.completion!==void 0&&{completion:i.completion}}),e),e.parallel=(t,o,s)=>(Z(a,t),n.push({id:t,type:`parallel`,mode:o.mode??`all-settled`,branches:qt(t,s,a,r,i),...o.when!==void 0&&{when:o.when},...o.skip!==void 0&&{skip:o.skip}}),e),e.gate=(t,r)=>(Z(a,t),n.push(Yt(t,r,o)),e),e.iterate=(t,i,o)=>(Z(a,t),n.push(Jt(t,i,o,a,r)),e),e.iterateChain=(t,o,s)=>(Z(a,t),n.push(Xt(t,o,s,a,r,i)),e),e.loop=(t,o,s)=>(Z(a,t),n.push(Zt(t,o,s,a,r,i)),e),e.addNode=e=>en(e,a,r,i,n)}function en(e,t,n,r,i){Q(t,e),X(e,n,r),i.push(e)}function $(e){let t={id:e.definition.id,definition:e.definition,runtimeHandlers:e.runtimeHandlers,runtimeFactories:e.runtimeFactories,runtimeLoopGates:e.runtimeLoopGates,source:void 0,get zodSchemas(){return e.zodSchemas},addTrigger(t){return e.triggers.push(t),$(e)}};return Qt(t,e),$t(t,e),t}function tn(e,t){let n=[],r=new Map,i=new Map,a=new Set,o={},s={gates:o},c=new Map,l=t?.triggers?[...t.triggers]:[];return $({rootNodes:n,runtimeHandlers:r,runtimeFactories:c,runtimeLoopGates:i,registeredIds:a,zodGates:o,zodSchemas:s,definition:{id:e,...t?.name!==void 0&&{name:t.name},...t?.description!==void 0&&{description:t.description},root:{id:`${e}__root`,type:`sequence`,nodes:n},triggers:l,scope:{type:`global`}},triggers:l})}function nn(e){if(e.workflows.length===0)throw Error(`defineWorkflowBundle: workflows must not be empty`);return{workflows:Object.freeze([...e.workflows])}}const rn=u.enum([`artifact.created`,`artifact.revised`,`artifact.status.changed`]),an=u.record(u.string(),e),on=u.object({type:u.string().min(1),input:u.record(u.string(),e).optional(),executionHints:m.optional()}),sn=u.object({id:u.string().min(1),description:u.string().optional(),on:rn,when:an.optional(),action:on,enabled:u.boolean().default(!0)});export{L as $,Ce as $t,ht as A,x as At,B,M as Bt,Tt as C,Te as Ct,gt as D,le as Dt,Et as E,Ne as Et,pt as F,pe as Ft,ct as G,_e as Gt,tt as H,ge as Ht,ft as I,me as It,st as J,C as Jt,ot as K,we as Kt,dt as L,xe as Lt,yt as M,b as Mt,vt as N,D as Nt,bt as O,Pe as Ot,mt as P,k as Pt,Ye as Q,he as Qt,lt as R,j as Rt,Dt as S,Ee as St,wt as T,A as Tt,at as U,N as Ut,it as V,Se as Vt,nt as W,ve as Wt,Ze as X,S as Xt,z as Y,w as Yt,Xe as Z,fe as Zt,Bt as _,Me as _t,nn as a,v as an,Ke as at,K as b,Oe as bt,Wt as c,ne as cn,Le as ct,Gt as d,p as dn,He as dt,P as en,Je as et,Ft as f,Fe as ft,zt as g,_ as gt,Rt as h,Ue as ht,sn as i,E as in,We as it,_t as j,ue as jt,H as k,ye as kt,Kt as l,m as ln,Ie as lt,Lt as m,Ve as mt,an as n,de as nn,qe as nt,tn as o,h as on,Re as ot,It as p,F as pt,rt as q,be as qt,rn as r,O as rn,Be as rt,Ht as s,re as sn,ze as st,on as t,T as tn,I as tt,Ut as u,te as un,Ge as ut,Pt as v,je as vt,xt as w,ke as wt,Mt as x,De as xt,Y as y,Ae as yt,ut as z,y as zt};
|
|
File without changes
|