@makaio/framework 1.0.0-dev-1779046984397
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/LICENSE +21 -0
- package/README.md +363 -0
- package/dist/account-identity-Ce1Bwrqi.mjs +1 -0
- package/dist/adapter-CbyjCE2d.mjs +1 -0
- package/dist/adapters/acp-client/index.d.mts +209 -0
- package/dist/adapters/acp-client/index.mjs +1 -0
- package/dist/adapters/config/index.d.mts +429 -0
- package/dist/adapters/config/index.mjs +1 -0
- package/dist/adapters/index.d.mts +4175 -0
- package/dist/adapters/index.mjs +11 -0
- package/dist/adapters/node.d.mts +263 -0
- package/dist/adapters/node.mjs +4 -0
- package/dist/adapters/stream-session/index.d.mts +1384 -0
- package/dist/adapters/stream-session/index.mjs +1 -0
- package/dist/adapters/stream-session/testing/index.d.mts +29 -0
- package/dist/adapters/stream-session/testing/index.mjs +1 -0
- package/dist/base-orchestrator-9z8TuA5a.d.mts +772 -0
- package/dist/bus/index.d.mts +3331 -0
- package/dist/bus/index.mjs +1 -0
- package/dist/bus-B1seC4M_.mjs +2 -0
- package/dist/capability-service-tnpR_TaB.mjs +1 -0
- package/dist/chunk-Dc06z0qk.mjs +1 -0
- package/dist/chunk-cpUYaJdV.mjs +1 -0
- package/dist/cleanEnvForAdapter-DvcIGXTG.mjs +1 -0
- package/dist/client-Dh4x4GQN.mjs +1 -0
- package/dist/clients/index.d.mts +2786 -0
- package/dist/clients/index.mjs +1 -0
- package/dist/clients-namespace-B0xAPZ6J.d.mts +332 -0
- package/dist/config-namespace-DLSs83zr.d.mts +638 -0
- package/dist/config-namespace-MJT8P0Ud.mjs +1 -0
- package/dist/contracts/adapter/index.d.mts +3 -0
- package/dist/contracts/adapter/index.mjs +1 -0
- package/dist/contracts/adapter/schemas/session-lineage.d.mts +2 -0
- package/dist/contracts/adapter/schemas/session-lineage.mjs +1 -0
- package/dist/contracts/client/index.d.mts +3 -0
- package/dist/contracts/client/index.mjs +1 -0
- package/dist/contracts/common/index.d.mts +2 -0
- package/dist/contracts/common/index.mjs +1 -0
- package/dist/contracts/config/index.d.mts +455 -0
- package/dist/contracts/config/index.mjs +1 -0
- package/dist/contracts/extension/index.d.mts +3 -0
- package/dist/contracts/extension/index.mjs +1 -0
- package/dist/contracts/harness/index.d.mts +2 -0
- package/dist/contracts/harness/index.mjs +1 -0
- package/dist/contracts/host/index.d.mts +2 -0
- package/dist/contracts/host/index.mjs +1 -0
- package/dist/contracts/index.d.mts +12665 -0
- package/dist/contracts/index.mjs +1 -0
- package/dist/contracts/model-registry/index.d.mts +2 -0
- package/dist/contracts/model-registry/index.mjs +1 -0
- package/dist/contracts/native-session-supervisor/index.d.mts +2 -0
- package/dist/contracts/native-session-supervisor/index.mjs +1 -0
- package/dist/contracts/platform/index.d.mts +2 -0
- package/dist/contracts/platform/index.mjs +1 -0
- package/dist/contracts/provider/index.d.mts +3 -0
- package/dist/contracts/provider/index.mjs +1 -0
- package/dist/contracts/session/index.d.mts +3 -0
- package/dist/contracts/session/index.mjs +1 -0
- package/dist/contracts/shared/index.d.mts +2 -0
- package/dist/contracts/shared/index.mjs +1 -0
- package/dist/contracts/skill/index.d.mts +2 -0
- package/dist/contracts/skill/index.mjs +1 -0
- package/dist/contracts/toast/index.d.mts +198 -0
- package/dist/contracts/toast/index.mjs +1 -0
- package/dist/contracts/variant/index.d.mts +2 -0
- package/dist/contracts/variant/index.mjs +1 -0
- package/dist/core/index.d.mts +1001 -0
- package/dist/core/index.mjs +1 -0
- package/dist/credential-ref-DLCsoKVZ.mjs +1 -0
- package/dist/cursor-storage-DOQdvo9j.mjs +1 -0
- package/dist/definition-DkYy1PZz.mjs +1 -0
- package/dist/definition-DtUNiGom.d.mts +158 -0
- package/dist/definition-DxvZ9e22.d.mts +376 -0
- package/dist/drizzle-CWVVw7Er.mjs +1 -0
- package/dist/execution-target-BW_uiBVe.mjs +1 -0
- package/dist/extension-COqwS-2Q.mjs +1 -0
- package/dist/extension-Cbrl4YGX.mjs +1 -0
- package/dist/extension-namespace-zaGKi6Qj.mjs +1 -0
- package/dist/handlers-iGKUJ380.mjs +41 -0
- package/dist/harness-CEq1Zkf9.mjs +1 -0
- package/dist/hooks/index.d.mts +423 -0
- package/dist/hooks/index.mjs +1 -0
- package/dist/host-CXAUGGN0.mjs +1 -0
- package/dist/identity-B_A0mE63.mjs +1 -0
- package/dist/index-6lyShOoU.d.mts +225 -0
- package/dist/index-7sXlairn2.d.mts +43 -0
- package/dist/index-BAKM2GMH2.d.mts +535 -0
- package/dist/index-BB419vv-.d.mts +3897 -0
- package/dist/index-BJOfdtbw.d.mts +729 -0
- package/dist/index-BXP9GK5q.d.mts +1075 -0
- package/dist/index-BdPwu6c0.d.mts +1730 -0
- package/dist/index-BePI0ckL.d.mts +40 -0
- package/dist/index-Bigx81Kr.d.mts +37 -0
- package/dist/index-BnNqbx2I.d.mts +134 -0
- package/dist/index-Bv15sNLn.d.mts +389 -0
- package/dist/index-C-myW_aK.d.mts +412 -0
- package/dist/index-C9F3Fc1A.d.mts +2938 -0
- package/dist/index-CNxS4Tlu.d.mts +1 -0
- package/dist/index-CVA0m1g9.d.mts +995 -0
- package/dist/index-C_kS2aqV2.d.mts +438 -0
- package/dist/index-Ch3ph52M2.d.mts +40 -0
- package/dist/index-CnZOKNjU.d.mts +89 -0
- package/dist/index-D1T-PPqF.d.mts +67 -0
- package/dist/index-D7T8XCku.d.mts +341 -0
- package/dist/index-DBQtpFLE.d.mts +4843 -0
- package/dist/index-DEw90pa2.d.mts +183 -0
- package/dist/index-DQRsGXb5.d.mts +109 -0
- package/dist/index-Dd5s4MSm.d.mts +72 -0
- package/dist/index-DubqLGH8.d.mts +1002 -0
- package/dist/index-ESSDWIB7.d.mts +11 -0
- package/dist/index-N5K1NOYs.d.mts +184 -0
- package/dist/index-PdUSmPT2.d.mts +180 -0
- package/dist/index-SzSiyG61.d.mts +117 -0
- package/dist/index-T0471kWA.d.mts +6760 -0
- package/dist/index-WKjrpcA_.d.mts +218 -0
- package/dist/index-hapw9_En.d.mts +13592 -0
- package/dist/index-iID2R9G1.d.mts +1490 -0
- package/dist/kernel/cli/index.d.mts +141 -0
- package/dist/kernel/cli/index.mjs +1 -0
- package/dist/kernel/cli/schemas.d.mts +63 -0
- package/dist/kernel/cli/schemas.mjs +1 -0
- package/dist/kernel/extension/index.d.mts +2 -0
- package/dist/kernel/extension/index.mjs +1 -0
- package/dist/kernel/index.d.mts +296 -0
- package/dist/kernel/index.mjs +1 -0
- package/dist/kernel/namespace/index.d.mts +2 -0
- package/dist/kernel/namespace/index.mjs +1 -0
- package/dist/kernel/observability/index.d.mts +2 -0
- package/dist/kernel/observability/index.mjs +1 -0
- package/dist/kernel/providers/index.d.mts +2 -0
- package/dist/kernel/providers/index.mjs +1 -0
- package/dist/kernel/window/index.d.mts +2 -0
- package/dist/kernel/window/index.mjs +1 -0
- package/dist/model-registry-BNzpR6TU.mjs +1 -0
- package/dist/model-registry-CIscwC52.mjs +1 -0
- package/dist/namespace-0yuzAKlr.mjs +1 -0
- package/dist/namespace-8cNguvIp.mjs +1 -0
- package/dist/namespace-BK2erxpV.d.mts +921 -0
- package/dist/namespace-Bmc7AW4J2.mjs +1 -0
- package/dist/namespace-C2ufjgaQ.d.mts +767 -0
- package/dist/namespace-C54Oj025.d.mts +159 -0
- package/dist/namespace-CCDEOwmW.d.mts +1313 -0
- package/dist/namespace-CfEWMXBx.mjs +1 -0
- package/dist/namespace-CkLUtc0g.d.mts +580 -0
- package/dist/namespace-D5Wrt7YU.mjs +1 -0
- package/dist/namespace-DZcuLwEA.d.mts +51 -0
- package/dist/namespace-Db-p67Rg.mjs +1 -0
- package/dist/namespace-FWx6HxaW.d.mts +611 -0
- package/dist/namespace-GLGGcWPH.d.mts +43 -0
- package/dist/namespace-N0dfwSg6.mjs +1 -0
- package/dist/namespace-O5SNY-LV.d.mts +2226 -0
- package/dist/namespace-ZbthBQVt.d.mts +142 -0
- package/dist/namespace-bq4Prtzn.d.mts +2046 -0
- package/dist/namespace-pNcSglBS.mjs +1 -0
- package/dist/namespace-ptv-pw_g.d.mts +3019 -0
- package/dist/namespace-xkvVw3hf2.d.mts +189 -0
- package/dist/native-session-supervisor-L-UIaEfd.mjs +1 -0
- package/dist/node/bus-server/index.d.mts +178 -0
- package/dist/node/bus-server/index.mjs +1 -0
- package/dist/node/bus-server/server-lifecycle.d.mts +2 -0
- package/dist/node/bus-server/server-lifecycle.mjs +1 -0
- package/dist/node/machine-identity/index.d.mts +85 -0
- package/dist/node/machine-identity/index.mjs +3 -0
- package/dist/node/transports/index.d.mts +1752 -0
- package/dist/node/transports/index.mjs +2 -0
- package/dist/orchestrator-shared-DrjtTXYh.d.mts +249 -0
- package/dist/orchestrator-shared-Wv1GI2mW.mjs +1 -0
- package/dist/platform-BbSLVg5b.mjs +1 -0
- package/dist/profile-4StaDQW0.mjs +1 -0
- package/dist/provider-context-CNRQ4d5m.mjs +1 -0
- package/dist/providers/index.d.mts +135 -0
- package/dist/providers/index.mjs +1 -0
- package/dist/providers-Cr4Za8a1.mjs +1 -0
- package/dist/providers-namespace-CDwxY_DV.d.mts +583 -0
- package/dist/schema-BwzXEtT2.d.mts +837 -0
- package/dist/schema-CAw_BqaG.mjs +1 -0
- package/dist/schema-introspection-D61TT_7b.mjs +1 -0
- package/dist/schema-uSGW-6oM.mjs +1 -0
- package/dist/schemas-BXstpWVp.mjs +1 -0
- package/dist/schemas-BdMU-gew.d.mts +160 -0
- package/dist/schemas-C40ZAJ33.mjs +1 -0
- package/dist/schemas-C5xtVqdb.d.mts +46 -0
- package/dist/schemas-CGZy_rU6.d.mts +13 -0
- package/dist/schemas-CLxtoKFy.mjs +1 -0
- package/dist/schemas-Co_sVhzz.mjs +1 -0
- package/dist/schemas-D9108Iv1.d.mts +182 -0
- package/dist/schemas-DENVYyds.d.mts +463 -0
- package/dist/schemas-DbWs_hj8.d.mts +174 -0
- package/dist/schemas-Di0XnnMX.d.mts +73 -0
- package/dist/schemas-KMA1efQg.d.mts +944 -0
- package/dist/schemas-qmn5SWPU.d.mts +312 -0
- package/dist/schemas-sshQEF3l.d.mts +237 -0
- package/dist/server-lifecycle-Cf_SZ27k.d.mts +160 -0
- package/dist/server-lifecycle-DbFwlrTW.mjs +1 -0
- package/dist/service-base/index.d.mts +98 -0
- package/dist/service-base/index.mjs +1 -0
- package/dist/services/adapter-runtime/index.d.mts +4 -0
- package/dist/services/adapter-runtime/index.mjs +1 -0
- package/dist/services/adapter-runtime/namespace.d.mts +2 -0
- package/dist/services/adapter-runtime/namespace.mjs +1 -0
- package/dist/services/adapter-runtime/schemas.d.mts +2 -0
- package/dist/services/adapter-runtime/schemas.mjs +1 -0
- package/dist/services/adapter-subsystem/index.d.mts +3 -0
- package/dist/services/adapter-subsystem/index.mjs +1 -0
- package/dist/services/adapter-subsystem/namespace.d.mts +2 -0
- package/dist/services/adapter-subsystem/namespace.mjs +1 -0
- package/dist/services/agent-runtime/index.d.mts +3 -0
- package/dist/services/agent-runtime/index.mjs +1 -0
- package/dist/services/agent-runtime/namespace.d.mts +2 -0
- package/dist/services/agent-runtime/namespace.mjs +1 -0
- package/dist/services/agent-runtime/schemas.d.mts +2 -0
- package/dist/services/agent-runtime/schemas.mjs +1 -0
- package/dist/services/capability/index.d.mts +2 -0
- package/dist/services/capability/index.mjs +1 -0
- package/dist/services/cli-detection/namespace.d.mts +56 -0
- package/dist/services/cli-detection/namespace.mjs +1 -0
- package/dist/services/codebase/index.d.mts +3 -0
- package/dist/services/codebase/index.mjs +1 -0
- package/dist/services/codebase/namespace.d.mts +2 -0
- package/dist/services/codebase/namespace.mjs +1 -0
- package/dist/services/codebase/schemas.d.mts +2 -0
- package/dist/services/codebase/schemas.mjs +1 -0
- package/dist/services/compression/index.d.mts +3 -0
- package/dist/services/compression/index.mjs +1 -0
- package/dist/services/compression/namespace.d.mts +2 -0
- package/dist/services/compression/namespace.mjs +1 -0
- package/dist/services/compression/schemas.d.mts +2 -0
- package/dist/services/compression/schemas.mjs +1 -0
- package/dist/services/context-rules/index.d.mts +412 -0
- package/dist/services/context-rules/index.mjs +1 -0
- package/dist/services/credential-change/index.d.mts +17 -0
- package/dist/services/credential-change/index.mjs +1 -0
- package/dist/services/definition/index.d.mts +2 -0
- package/dist/services/definition/index.mjs +1 -0
- package/dist/services/definition/namespace.d.mts +71 -0
- package/dist/services/definition/namespace.mjs +1 -0
- package/dist/services/definition/schemas.d.mts +38 -0
- package/dist/services/definition/schemas.mjs +1 -0
- package/dist/services/dialog/namespace.d.mts +105 -0
- package/dist/services/dialog/namespace.mjs +1 -0
- package/dist/services/dialog/schemas.d.mts +109 -0
- package/dist/services/dialog/schemas.mjs +1 -0
- package/dist/services/execution-target/index.d.mts +4 -0
- package/dist/services/execution-target/index.mjs +1 -0
- package/dist/services/execution-target/namespace.d.mts +2 -0
- package/dist/services/execution-target/namespace.mjs +1 -0
- package/dist/services/execution-target/schemas.d.mts +2 -0
- package/dist/services/execution-target/schemas.mjs +1 -0
- package/dist/services/filesystem/namespace.d.mts +432 -0
- package/dist/services/filesystem/namespace.mjs +1 -0
- package/dist/services/filesystem/schemas.d.mts +240 -0
- package/dist/services/filesystem/schemas.mjs +1 -0
- package/dist/services/harness/index.d.mts +861 -0
- package/dist/services/harness/index.mjs +1 -0
- package/dist/services/harness/storage/schema.d.mts +424 -0
- package/dist/services/harness/storage/schema.mjs +1 -0
- package/dist/services/index.d.mts +5703 -0
- package/dist/services/index.mjs +1 -0
- package/dist/services/local-notification/index.d.mts +25 -0
- package/dist/services/local-notification/index.mjs +1 -0
- package/dist/services/local-notification/namespace.d.mts +73 -0
- package/dist/services/local-notification/namespace.mjs +1 -0
- package/dist/services/local-notification/schemas.d.mts +88 -0
- package/dist/services/local-notification/schemas.mjs +1 -0
- package/dist/services/log-import/browser.d.mts +3 -0
- package/dist/services/log-import/browser.mjs +1 -0
- package/dist/services/log-import/index.d.mts +275 -0
- package/dist/services/log-import/index.mjs +2 -0
- package/dist/services/log-import/log-import.d.mts +3 -0
- package/dist/services/log-import/log-import.mjs +1 -0
- package/dist/services/log-import/namespace.d.mts +327 -0
- package/dist/services/log-import/namespace.mjs +1 -0
- package/dist/services/log-import/schemas.d.mts +217 -0
- package/dist/services/log-import/schemas.mjs +1 -0
- package/dist/services/model-registry/index.d.mts +2 -0
- package/dist/services/model-registry/index.mjs +1 -0
- package/dist/services/preferences/index.d.mts +3 -0
- package/dist/services/preferences/index.mjs +1 -0
- package/dist/services/preferences/schemas.d.mts +2 -0
- package/dist/services/preferences/schemas.mjs +1 -0
- package/dist/services/preferences/storage-namespace.d.mts +3 -0
- package/dist/services/preferences/storage-namespace.mjs +1 -0
- package/dist/services/provider-context/index.d.mts +2 -0
- package/dist/services/provider-context/index.mjs +1 -0
- package/dist/services/provider-runtime/index.d.mts +136 -0
- package/dist/services/provider-runtime/index.mjs +1 -0
- package/dist/services/session/handlers/index.d.mts +2 -0
- package/dist/services/session/handlers/index.mjs +1 -0
- package/dist/services/session/index.d.mts +10 -0
- package/dist/services/session/index.mjs +1 -0
- package/dist/services/session/messages/namespace.d.mts +2 -0
- package/dist/services/session/messages/namespace.mjs +1 -0
- package/dist/services/session/orchestrator-testing/index.d.mts +2 -0
- package/dist/services/session/orchestrator-testing/index.mjs +1 -0
- package/dist/services/session/session-events/namespace.d.mts +2 -0
- package/dist/services/session/session-events/namespace.mjs +1 -0
- package/dist/services/session/storage/namespace.d.mts +2 -0
- package/dist/services/session/storage/namespace.mjs +1 -0
- package/dist/services/session/storage/schema.d.mts +2 -0
- package/dist/services/session/storage/schema.mjs +1 -0
- package/dist/services/session/testing/index.d.mts +35 -0
- package/dist/services/session/testing/index.mjs +52 -0
- package/dist/services/session/testing/orchestrator-shared.d.mts +2 -0
- package/dist/services/session/testing/orchestrator-shared.mjs +1 -0
- package/dist/services/session/turns/namespace.d.mts +2 -0
- package/dist/services/session/turns/namespace.mjs +1 -0
- package/dist/services/session-editor/index.d.mts +119 -0
- package/dist/services/session-editor/index.mjs +1 -0
- package/dist/services/settings/index.d.mts +47 -0
- package/dist/services/settings/index.mjs +1 -0
- package/dist/services/settings/namespace.d.mts +662 -0
- package/dist/services/settings/namespace.mjs +1 -0
- package/dist/services/settings/storage/clients-namespace.d.mts +2 -0
- package/dist/services/settings/storage/clients-namespace.mjs +1 -0
- package/dist/services/settings/storage/extension-configs/namespace.d.mts +184 -0
- package/dist/services/settings/storage/extension-configs/namespace.mjs +1 -0
- package/dist/services/settings/storage/index.d.mts +4 -0
- package/dist/services/settings/storage/index.mjs +1 -0
- package/dist/services/settings/storage/providers-namespace.d.mts +2 -0
- package/dist/services/settings/storage/providers-namespace.mjs +1 -0
- package/dist/services/tool-approval/index.d.mts +2 -0
- package/dist/services/tool-approval/index.mjs +1 -0
- package/dist/services/tools/index.d.mts +2 -0
- package/dist/services/tools/index.mjs +1 -0
- package/dist/services/tray-menu/index.d.mts +4 -0
- package/dist/services/tray-menu/index.mjs +1 -0
- package/dist/services/tray-menu/namespace.d.mts +2 -0
- package/dist/services/tray-menu/namespace.mjs +1 -0
- package/dist/services/tray-menu/schemas.d.mts +2 -0
- package/dist/services/tray-menu/schemas.mjs +1 -0
- package/dist/services/turn/index.d.mts +2 -0
- package/dist/services/turn/index.mjs +1 -0
- package/dist/services/turn/namespace.d.mts +2 -0
- package/dist/services/turn/namespace.mjs +1 -0
- package/dist/services/turn/schemas.d.mts +335 -0
- package/dist/services/turn/schemas.mjs +1 -0
- package/dist/services/worker/index.d.mts +3 -0
- package/dist/services/worker/index.mjs +1 -0
- package/dist/services/worker/namespace.d.mts +2 -0
- package/dist/services/worker/namespace.mjs +1 -0
- package/dist/services/worker/schemas.d.mts +2 -0
- package/dist/services/worker/schemas.mjs +1 -0
- package/dist/session-Do6lDZM4.mjs +123 -0
- package/dist/session-lineage-Eev4uo4I.d.mts +65 -0
- package/dist/session-piI1R5rP.mjs +1 -0
- package/dist/shared-DxHLl9UP.mjs +1 -0
- package/dist/shared-schemas-BgQv_tnu.mjs +1 -0
- package/dist/skill-CB5h-ZFQ.mjs +1 -0
- package/dist/storage/drizzle/client.d.mts +78 -0
- package/dist/storage/drizzle/client.mjs +1 -0
- package/dist/storage/drizzle/index.d.mts +98 -0
- package/dist/storage/drizzle/index.mjs +1 -0
- package/dist/storage/handlers/drizzle/index.d.mts +2 -0
- package/dist/storage/handlers/drizzle/index.mjs +1 -0
- package/dist/storage/handlers/index.d.mts +33 -0
- package/dist/storage/handlers/index.mjs +1 -0
- package/dist/storage/index.d.mts +192 -0
- package/dist/storage/index.mjs +1 -0
- package/dist/storage-namespace-ADwyijoe.mjs +1 -0
- package/dist/storage-namespace-DAm8iWEj.d.mts +221 -0
- package/dist/storage-namespace-definition-CHu2k14q.mjs +1 -0
- package/dist/storage-namespace-definition-CJgqyXH1.d.mts +17 -0
- package/dist/style.css +3782 -0
- package/dist/testing/drizzle-harness.d.mts +130 -0
- package/dist/testing/drizzle-harness.mjs +1 -0
- package/dist/testing/index.d.mts +106 -0
- package/dist/testing/index.mjs +1 -0
- package/dist/tool-approval-service-BcBSUZCO.mjs +1 -0
- package/dist/tools/index.d.mts +825 -0
- package/dist/tools/index.mjs +1 -0
- package/dist/tools/testing/index.d.mts +53 -0
- package/dist/tools/testing/index.mjs +1 -0
- package/dist/tools-CDSgj0ee.mjs +1 -0
- package/dist/tray-menu-service-CTXC1Elg.mjs +1 -0
- package/dist/types-6WxLfoM3.d.mts +31 -0
- package/dist/types-BjToUrHp.d.mts +6619 -0
- package/dist/types-CD1LJwPc.d.mts +1009 -0
- package/dist/types-Cvrj2ogm.d.mts +305 -0
- package/dist/types-DYF5LxZY.d.mts +233 -0
- package/dist/types-t295YC6T.d.mts +262 -0
- package/dist/types-vNpkAe4Y.d.mts +128 -0
- package/dist/ui-components/index.d.mts +2342 -0
- package/dist/ui-components/index.mjs +8 -0
- package/dist/ui-config-CXmbsqZV.mjs +1 -0
- package/dist/ui-hooks/index.d.mts +1805 -0
- package/dist/ui-hooks/index.mjs +1 -0
- package/dist/ui-kernel/index.d.mts +2793 -0
- package/dist/ui-kernel/index.mjs +1 -0
- package/dist/ui-kernel/pages/namespace.d.mts +88 -0
- package/dist/ui-kernel/pages/namespace.mjs +1 -0
- package/dist/ui-kernel/pages/schemas.d.mts +2 -0
- package/dist/ui-kernel/pages/schemas.mjs +1 -0
- package/dist/ui-views/index.d.mts +487 -0
- package/dist/ui-views/index.mjs +30 -0
- package/dist/utils/health-probe.d.mts +26 -0
- package/dist/utils/health-probe.mjs +1 -0
- package/dist/utils/index.d.mts +227 -0
- package/dist/utils/index.mjs +2 -0
- package/dist/utils/keychain.d.mts +31 -0
- package/dist/utils/keychain.mjs +1 -0
- package/dist/utils/resolve-package-root.d.mts +12 -0
- package/dist/utils/resolve-package-root.mjs +1 -0
- package/dist/utils/workspace-root.d.mts +27 -0
- package/dist/utils/workspace-root.mjs +2 -0
- package/dist/variant-D5kSrL3m.mjs +1 -0
- package/dist/version-CjS20oXi.mjs +1 -0
- package/dist/visibility-CZu8ooOA.mjs +1 -0
- package/dist/window-registry-CUftmDr3.mjs +1 -0
- package/dist/window-registry-C_IJmY8_.d.mts +130 -0
- package/package.json +346 -0
|
@@ -0,0 +1,2786 @@
|
|
|
1
|
+
import * as _$zod from "zod";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import * as _$_makaio_core0 from "@makaio/framework/core";
|
|
4
|
+
import { EventMessagePayload, RequestMessagePayload, SchemaRecord, SubjectDefinition, SubjectRecord } from "@makaio/framework/core";
|
|
5
|
+
import { IMakaioBus } from "@makaio/framework/bus";
|
|
6
|
+
import * as _$_makaio_contracts0 from "@makaio/framework/contracts";
|
|
7
|
+
import { ClientDefinition, ExtensionServiceLifecycle, LatestVersionSourceStatus, MakaioNodeExtension } from "@makaio/framework/contracts";
|
|
8
|
+
import { BaseService } from "@makaio/framework/service-base";
|
|
9
|
+
import { ClientAccountIdentifier, ClientDefinition as ClientDefinition$1, ClientExecutionContext, ClientInstallCompleted, ClientInstallProgress, ClientRuntimeObserveRequest, ClientSessionObservedBase, ClientSubjects, ClientUsageSnapshot, ClientWiringEntry, ClientWiringEntrySchema, LatestVersionSourceStatus as LatestVersionSourceStatus$1, ManagedInstallDescriptor, ManagedInstallStrategy, PostInstallDescriptor } from "@makaio/framework/contracts/client";
|
|
10
|
+
import * as _$zod_v4_core0 from "zod/v4/core";
|
|
11
|
+
|
|
12
|
+
//#region packages/clients-core/src/atomic-modify-file.d.ts
|
|
13
|
+
/**
|
|
14
|
+
* Atomic file read-modify-write utility with per-path mutex serialization.
|
|
15
|
+
*
|
|
16
|
+
* Provides a generic helper for safely updating JSON config files: reads the
|
|
17
|
+
* current JSON, validates it through a caller-supplied parser, applies a
|
|
18
|
+
* modifier, and writes the result atomically (write-to-UUID-tmp then rename).
|
|
19
|
+
* Concurrent calls to the same path are serialized via the caller-owned mutex
|
|
20
|
+
* map.
|
|
21
|
+
* @packageDocumentation
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* Descriptor returned by an {@link AtomicModifier}.
|
|
25
|
+
* @typeParam TContent - The JSON-serializable type of the file's content.
|
|
26
|
+
* @typeParam TResult - An arbitrary caller-defined result value.
|
|
27
|
+
*/
|
|
28
|
+
interface AtomicModifyOutcome<TContent, TResult> {
|
|
29
|
+
/**
|
|
30
|
+
* The (potentially updated) content to persist. Ignored when
|
|
31
|
+
* `changed` is `false`.
|
|
32
|
+
*/
|
|
33
|
+
readonly content: TContent;
|
|
34
|
+
/**
|
|
35
|
+
* Whether the file should be written. When `false`, no I/O is performed
|
|
36
|
+
* and the resolved promise carries `result` without touching the disk.
|
|
37
|
+
*/
|
|
38
|
+
readonly changed: boolean;
|
|
39
|
+
/** Caller-defined value forwarded as the resolved value of {@link atomicModifyFile}. */
|
|
40
|
+
readonly result: TResult;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Modifier function supplied by the caller.
|
|
44
|
+
*
|
|
45
|
+
* Receives the current file content (or the default value when the file is
|
|
46
|
+
* absent) and returns an {@link AtomicModifyOutcome} describing the desired
|
|
47
|
+
* new content and whether a write is needed.
|
|
48
|
+
*
|
|
49
|
+
* The modifier **must be synchronous or return a resolved-in-the-same-tick
|
|
50
|
+
* promise** — it runs inside the mutex chain so async work inside the modifier
|
|
51
|
+
* is safe, but long-running modifiers will delay subsequent serialized writes.
|
|
52
|
+
* @typeParam TContent - The JSON-serializable type of the file's content.
|
|
53
|
+
* @typeParam TResult - An arbitrary caller-defined result value.
|
|
54
|
+
*/
|
|
55
|
+
type AtomicModifier<TContent, TResult> = (current: TContent) => AtomicModifyOutcome<TContent, TResult> | Promise<AtomicModifyOutcome<TContent, TResult>>;
|
|
56
|
+
/**
|
|
57
|
+
* Parser function supplied by the caller.
|
|
58
|
+
*
|
|
59
|
+
* The helper reads disk JSON as `unknown`; client-specific settings modules
|
|
60
|
+
* own the schema that turns unknown JSON into a trusted content type.
|
|
61
|
+
* @typeParam TContent - The validated content type consumed by the modifier.
|
|
62
|
+
*/
|
|
63
|
+
type AtomicContentParser<TContent> = (raw: unknown) => TContent;
|
|
64
|
+
/**
|
|
65
|
+
* Read the current file content, validate it with `parseContent`, apply
|
|
66
|
+
* `modifier`, and atomically persist the result when `changed` is `true`.
|
|
67
|
+
*
|
|
68
|
+
* **Atomicity:** the updated content is written to a UUID-suffixed sibling file
|
|
69
|
+
* in the same directory, then renamed into place. Readers never observe a
|
|
70
|
+
* partial write. The temp file is unlinked on write failure.
|
|
71
|
+
*
|
|
72
|
+
* **Serialization:** the caller owns the `mutex` map and passes the same
|
|
73
|
+
* instance for all calls sharing the same logical file namespace. The helper
|
|
74
|
+
* chains on the existing in-flight promise for `filePath` so concurrent calls
|
|
75
|
+
* are queued rather than racing. The entry is pruned from the map once no
|
|
76
|
+
* further work is queued.
|
|
77
|
+
*
|
|
78
|
+
* **Parent directory:** created automatically when absent (`mkdir -p`).
|
|
79
|
+
* @typeParam TContent - The JSON-serializable type of the file's content.
|
|
80
|
+
* @typeParam TResult - An arbitrary caller-defined result value.
|
|
81
|
+
* @param filePath - Absolute path to the target file.
|
|
82
|
+
* @param defaultContent - Raw value parsed when the file does not exist.
|
|
83
|
+
* @param mutex - Module-scoped per-path mutex map owned by the caller.
|
|
84
|
+
* @param parseContent - Parser that validates unknown disk JSON before mutation.
|
|
85
|
+
* @param modifier - Pure function that transforms the current content.
|
|
86
|
+
* @returns The `result` value produced by `modifier`.
|
|
87
|
+
*/
|
|
88
|
+
declare function atomicModifyFile<TContent, TResult>(filePath: string, defaultContent: unknown, mutex: Map<string, Promise<void>>, parseContent: AtomicContentParser<TContent>, modifier: AtomicModifier<TContent, TResult>): Promise<TResult>;
|
|
89
|
+
//#endregion
|
|
90
|
+
//#region packages/clients-core/src/client-binary-errors.d.ts
|
|
91
|
+
/**
|
|
92
|
+
* Typed error classes for the client binary management subsystem.
|
|
93
|
+
* @packageDocumentation
|
|
94
|
+
*/
|
|
95
|
+
/**
|
|
96
|
+
* Thrown by `client.resolveBinary` when no managed version is active and the
|
|
97
|
+
* global PATH scan finds no matching binary for the client.
|
|
98
|
+
*
|
|
99
|
+
* Callers that need to distinguish "binary absent" from other resolution
|
|
100
|
+
* failures (e.g. corrupted managed state, storage errors) should check for
|
|
101
|
+
* this class rather than matching the error message string.
|
|
102
|
+
*/
|
|
103
|
+
declare class BinaryNotFoundError extends Error {
|
|
104
|
+
/** Discriminant code for structured error detection without string matching. */
|
|
105
|
+
readonly code: "BINARY_NOT_FOUND";
|
|
106
|
+
/**
|
|
107
|
+
* @param clientId - Stable client identifier for which no binary was found
|
|
108
|
+
*/
|
|
109
|
+
constructor(clientId: string);
|
|
110
|
+
}
|
|
111
|
+
//#endregion
|
|
112
|
+
//#region packages/clients-core/src/client-account-registry.d.ts
|
|
113
|
+
/**
|
|
114
|
+
* Result returned when account identifiers are observed or ingested.
|
|
115
|
+
*/
|
|
116
|
+
interface ClientAccountUpsertResult {
|
|
117
|
+
/** Stable in-memory account ID selected or created for the identifier set. */
|
|
118
|
+
readonly clientAccountId: string;
|
|
119
|
+
/** Latest non-empty display label retained for the account, if any. */
|
|
120
|
+
readonly displayLabel?: string;
|
|
121
|
+
/** Any prior account IDs folded into the canonical account during upsert. */
|
|
122
|
+
readonly mergedAccountIds: ReadonlyArray<string>;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* In-memory registry that canonicalizes client accounts across identifiers.
|
|
126
|
+
*
|
|
127
|
+
* Identifiers are scoped by `clientId`, `scheme`, and `value`, so the same raw
|
|
128
|
+
* identifier value used by different clients does not collide.
|
|
129
|
+
*/
|
|
130
|
+
declare class ClientAccountRegistry {
|
|
131
|
+
private nextAccountSequence;
|
|
132
|
+
private readonly accountIdsByIdentifier;
|
|
133
|
+
private readonly accounts;
|
|
134
|
+
/**
|
|
135
|
+
* Upsert an account record for the provided identifiers.
|
|
136
|
+
*
|
|
137
|
+
* Reuses an existing account ID when any identifier is already known, and
|
|
138
|
+
* folds all supplied identifiers onto the canonical account mapping.
|
|
139
|
+
* @param options - Client/account identity inputs to observe
|
|
140
|
+
* @returns Canonical account ID plus any merged prior IDs
|
|
141
|
+
*/
|
|
142
|
+
upsertAccount(options: {
|
|
143
|
+
clientId: string;
|
|
144
|
+
identifiers: ReadonlyArray<ClientAccountIdentifier>;
|
|
145
|
+
displayLabel?: string;
|
|
146
|
+
}): ClientAccountUpsertResult;
|
|
147
|
+
/**
|
|
148
|
+
* Remove all in-memory state.
|
|
149
|
+
*/
|
|
150
|
+
clear(): void;
|
|
151
|
+
private createAccount;
|
|
152
|
+
private mergeInto;
|
|
153
|
+
}
|
|
154
|
+
//#endregion
|
|
155
|
+
//#region packages/clients-core/src/client-binary-feed-cache.d.ts
|
|
156
|
+
/**
|
|
157
|
+
* In-memory cache of latest-available-version metadata per managed client.
|
|
158
|
+
*
|
|
159
|
+
* **Lifecycle:**
|
|
160
|
+
* 1. Call {@link ClientBinaryFeedCache.hydrate} at boot to populate the cache
|
|
161
|
+
* from persisted state rows.
|
|
162
|
+
* 2. Call {@link ClientBinaryFeedCache.update} after every feed refresh to
|
|
163
|
+
* update the in-memory entry and persist the new metadata to the database.
|
|
164
|
+
*
|
|
165
|
+
* The cache is write-only from the outside: the manager reads feed metadata
|
|
166
|
+
* exclusively via {@link ClientBinaryVersionResolver.getLatestVersionMeta}.
|
|
167
|
+
* The in-memory `cache` Map is retained internally so that
|
|
168
|
+
* {@link ClientBinaryFeedCache.update} can preserve the last-successful
|
|
169
|
+
* `lastCheckedAt` timestamp on error without an extra storage round-trip.
|
|
170
|
+
*/
|
|
171
|
+
declare class ClientBinaryFeedCache {
|
|
172
|
+
private readonly cache;
|
|
173
|
+
private readonly bus;
|
|
174
|
+
/**
|
|
175
|
+
* @param bus - Bus instance used to persist feed-cache updates to storage
|
|
176
|
+
*/
|
|
177
|
+
constructor(bus: IMakaioBus);
|
|
178
|
+
/**
|
|
179
|
+
* Hydrates the in-memory cache from all persisted state rows.
|
|
180
|
+
*
|
|
181
|
+
* Must be called once at boot, before any calls to {@link update}. Rows that
|
|
182
|
+
* have `latestVersionLastCheckedAt` set are
|
|
183
|
+
* classified as `'cached'`; rows without it are classified as `'error'`
|
|
184
|
+
* (the feed has never been successfully checked).
|
|
185
|
+
*
|
|
186
|
+
* Returns the raw state rows so the caller can reuse them (e.g. to seed
|
|
187
|
+
* the version resolver) without a second `loadAllState` bus round-trip.
|
|
188
|
+
* @returns All persisted state rows fetched during hydration
|
|
189
|
+
*/
|
|
190
|
+
hydrate(): Promise<ReadonlyArray<{
|
|
191
|
+
clientId: string;
|
|
192
|
+
latestAvailableVersion: string | null;
|
|
193
|
+
latestVersionLastCheckedAt: number | null;
|
|
194
|
+
latestVersionSourceStatus: LatestVersionSourceStatus;
|
|
195
|
+
}>>;
|
|
196
|
+
/**
|
|
197
|
+
* Persist the feed-cache entry for a client to storage and then update the
|
|
198
|
+
* in-memory cache.
|
|
199
|
+
*
|
|
200
|
+
* Storage is written first so that a bus failure leaves the in-memory cache
|
|
201
|
+
* unchanged, keeping the resolver and storage in sync. The in-memory entry is
|
|
202
|
+
* only updated after the bus request succeeds.
|
|
203
|
+
*
|
|
204
|
+
* Call this after every feed refresh attempt, including failures (using
|
|
205
|
+
* `'error'` as the `sourceStatus`). On error the caller should pass the
|
|
206
|
+
* last-known version from the version resolver — not `null` — so that the
|
|
207
|
+
* cached value remains useful for subsequent list operations.
|
|
208
|
+
* @param clientId - Stable client identifier to update
|
|
209
|
+
* @param latestAvailableVersion - Latest version from the upstream feed,
|
|
210
|
+
* or the previously cached version when the refresh failed
|
|
211
|
+
* @param sourceStatus - Freshness classification for this update
|
|
212
|
+
*/
|
|
213
|
+
update(clientId: string, latestAvailableVersion: string | null, sourceStatus: LatestVersionSourceStatus): Promise<void>;
|
|
214
|
+
}
|
|
215
|
+
//#endregion
|
|
216
|
+
//#region packages/clients-core/src/binary-strategies/types.d.ts
|
|
217
|
+
/**
|
|
218
|
+
* Injected I/O dependencies for install strategy implementations.
|
|
219
|
+
*
|
|
220
|
+
* Abstracting these operations behind an interface makes every strategy
|
|
221
|
+
* testable without touching the network or file system.
|
|
222
|
+
*/
|
|
223
|
+
interface StrategyDependencies {
|
|
224
|
+
/**
|
|
225
|
+
* Fetch `url` and return the full response body as a string.
|
|
226
|
+
* @param url - The URL to fetch.
|
|
227
|
+
* @returns The raw response body text.
|
|
228
|
+
*/
|
|
229
|
+
fetchText(url: string): Promise<string>;
|
|
230
|
+
/**
|
|
231
|
+
* Fetch `url`, parse the response body as JSON, and return it.
|
|
232
|
+
* @param url - The URL to fetch.
|
|
233
|
+
* @returns The parsed JSON value.
|
|
234
|
+
*/
|
|
235
|
+
fetchJson(url: string): Promise<unknown>;
|
|
236
|
+
/**
|
|
237
|
+
* Download `url` to `destPath` on disk, optionally reporting byte progress.
|
|
238
|
+
* @param url - The URL to download.
|
|
239
|
+
* @param destPath - Absolute destination file path.
|
|
240
|
+
* @param onProgress - Optional callback; `total` is `null` when the server
|
|
241
|
+
* does not advertise a `Content-Length`.
|
|
242
|
+
* @returns The resolved absolute destination path.
|
|
243
|
+
*/
|
|
244
|
+
downloadFile(url: string, destPath: string, onProgress?: (downloaded: number, total: number | null) => void): Promise<string>;
|
|
245
|
+
/**
|
|
246
|
+
* Execute a shell command and return its stdout.
|
|
247
|
+
* @param command - The executable to run (no shell expansion).
|
|
248
|
+
* @param args - Positional arguments passed to the executable.
|
|
249
|
+
* @param options - Optional execution options.
|
|
250
|
+
* @returns Trimmed stdout string.
|
|
251
|
+
*/
|
|
252
|
+
exec(command: string, args: string[], options?: {
|
|
253
|
+
cwd?: string;
|
|
254
|
+
}): Promise<string>;
|
|
255
|
+
/**
|
|
256
|
+
* Extract an archive file into `destDir`.
|
|
257
|
+
* @param archivePath - Absolute path to the archive file.
|
|
258
|
+
* @param destDir - Absolute directory to extract into.
|
|
259
|
+
* @param format - Archive type (`'tar.gz'` or `'zip'`).
|
|
260
|
+
*/
|
|
261
|
+
extractArchive(archivePath: string, destDir: string, format: 'tar.gz' | 'zip'): Promise<void>;
|
|
262
|
+
/**
|
|
263
|
+
* Delete a single file from disk.
|
|
264
|
+
*
|
|
265
|
+
* Implementations must be idempotent — if `filePath` does not exist the call
|
|
266
|
+
* should resolve without error.
|
|
267
|
+
* @param filePath - Absolute path to the file to remove.
|
|
268
|
+
*/
|
|
269
|
+
deleteFile(filePath: string): Promise<void>;
|
|
270
|
+
/**
|
|
271
|
+
* Compute the checksum of a file at `filePath`.
|
|
272
|
+
* @param filePath - Absolute path to the file to hash.
|
|
273
|
+
* @param algorithm - Hash algorithm name (defaults to `'sha256'`).
|
|
274
|
+
* @returns Lowercase hex-encoded digest string.
|
|
275
|
+
*/
|
|
276
|
+
computeChecksum(filePath: string, algorithm?: string): Promise<string>;
|
|
277
|
+
/**
|
|
278
|
+
* Recursively remove a directory and all of its contents.
|
|
279
|
+
*
|
|
280
|
+
* Implementations must be idempotent — if `dirPath` does not exist the
|
|
281
|
+
* call should resolve without error. This mirrors the `force` flag of
|
|
282
|
+
* `fs.rm` from `node:fs/promises`.
|
|
283
|
+
* @param dirPath - Absolute path to the directory to remove.
|
|
284
|
+
*/
|
|
285
|
+
removeDirectory(dirPath: string): Promise<void>;
|
|
286
|
+
}
|
|
287
|
+
//#endregion
|
|
288
|
+
//#region packages/clients-core/src/client-binary-manager-types.d.ts
|
|
289
|
+
/**
|
|
290
|
+
* Configuration for the managed binary base directory.
|
|
291
|
+
*
|
|
292
|
+
* The manager derives per-client, per-version install directories from
|
|
293
|
+
* `basePath` using the pattern `{basePath}/{clientId}/{version}/`.
|
|
294
|
+
*
|
|
295
|
+
* TODO: ClientBinaryJobRunner only consumes basePath — introduce a narrowed
|
|
296
|
+
* runner-specific config (e.g. `Pick<ClientBinaryManagerConfig, 'basePath'>`) to
|
|
297
|
+
* decouple the runner from manager-only config such as configBasePath.
|
|
298
|
+
*/
|
|
299
|
+
interface ClientBinaryManagerConfig {
|
|
300
|
+
/**
|
|
301
|
+
* Absolute base directory under which all managed binary versions are
|
|
302
|
+
* installed (e.g. `~/.makaio/binaries/`).
|
|
303
|
+
*/
|
|
304
|
+
basePath: string;
|
|
305
|
+
/**
|
|
306
|
+
* Base directory for per-client config isolation directories.
|
|
307
|
+
*
|
|
308
|
+
* Managed binaries get `{configBasePath}/{clientId}/config/` as their
|
|
309
|
+
* isolated config dir (e.g. `~/.makaio/clients/claude-code/config/`).
|
|
310
|
+
*
|
|
311
|
+
* Used by `client.resolveBinary` to construct the managed config path when
|
|
312
|
+
* the definition declares `configIsolation`.
|
|
313
|
+
*/
|
|
314
|
+
configBasePath: string;
|
|
315
|
+
/**
|
|
316
|
+
* Framework-owned handlers for declarative post-install descriptors.
|
|
317
|
+
*
|
|
318
|
+
* Client packages declare `postInstall.kind`; the host supplies the handler
|
|
319
|
+
* implementation here. Missing handlers fail the install job rather than
|
|
320
|
+
* silently skipping a declared lifecycle step.
|
|
321
|
+
*/
|
|
322
|
+
postInstallHandlers?: ReadonlyMap<string, PostInstallHandler>;
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Context passed to a framework-owned post-install handler.
|
|
326
|
+
*/
|
|
327
|
+
interface PostInstallContext {
|
|
328
|
+
/** Stable client identifier being installed. */
|
|
329
|
+
clientId: string;
|
|
330
|
+
/** Concrete version that was installed. */
|
|
331
|
+
version: string;
|
|
332
|
+
/** Absolute directory where the strategy installed the binary. */
|
|
333
|
+
installPath: string;
|
|
334
|
+
/** Declarative descriptor from the client definition. */
|
|
335
|
+
descriptor: PostInstallDescriptor;
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* Framework-owned handler for a declarative post-install action.
|
|
339
|
+
*
|
|
340
|
+
* Returning metadata is optional; when present it is forwarded on install
|
|
341
|
+
* progress and completion events.
|
|
342
|
+
*/
|
|
343
|
+
type PostInstallHandler = (context: PostInstallContext) => Promise<Record<string, unknown> | void> | Record<string, unknown> | void;
|
|
344
|
+
/**
|
|
345
|
+
* An in-flight or completed install/update job.
|
|
346
|
+
*
|
|
347
|
+
* Jobs are created synchronously by `client.install` and `client.update`
|
|
348
|
+
* handlers and executed asynchronously by the {@link ClientBinaryJobRunner}.
|
|
349
|
+
*/
|
|
350
|
+
interface InstallJob {
|
|
351
|
+
/** Opaque stable identifier for this job (UUID v4). */
|
|
352
|
+
jobId: string;
|
|
353
|
+
/** Stable client identifier this job is installing. */
|
|
354
|
+
clientId: string;
|
|
355
|
+
/**
|
|
356
|
+
* Concrete version to install. Set immediately after version resolution;
|
|
357
|
+
* remains the resolved version string throughout execution.
|
|
358
|
+
*/
|
|
359
|
+
version: string;
|
|
360
|
+
/**
|
|
361
|
+
* Install strategy discriminant corresponding to the managed install
|
|
362
|
+
* descriptor that was used to create the job.
|
|
363
|
+
*/
|
|
364
|
+
strategy: ManagedInstallStrategy;
|
|
365
|
+
/** Current lifecycle state of the job. */
|
|
366
|
+
status: 'pending' | 'running' | 'completed' | 'failed';
|
|
367
|
+
/**
|
|
368
|
+
* When `true`, the job runner sets this version as active on successful
|
|
369
|
+
* completion.
|
|
370
|
+
*/
|
|
371
|
+
makeActive: boolean;
|
|
372
|
+
/**
|
|
373
|
+
* The originating bus subject that created this job.
|
|
374
|
+
*
|
|
375
|
+
* Used to set the correct `reason` on `client.version.changed` events:
|
|
376
|
+
* `'install'` for `client.install` requests, `'update'` for `client.update`
|
|
377
|
+
* requests.
|
|
378
|
+
*/
|
|
379
|
+
reason: 'install' | 'update';
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* Read-only interface used by the manager to retrieve client definitions.
|
|
383
|
+
*
|
|
384
|
+
* On the production boot path the manager receives a
|
|
385
|
+
* {@link ClientDefinitionRegistry} fully seeded before `init()` is called.
|
|
386
|
+
* The manager depends only on the read side of the registry contract;
|
|
387
|
+
* mutation is available on the concrete {@link ClientDefinitionRegistry} class
|
|
388
|
+
* for tests and administrative tooling.
|
|
389
|
+
*/
|
|
390
|
+
interface ClientDefinitionLookup {
|
|
391
|
+
/**
|
|
392
|
+
* Return the static definition for the given client identifier, or
|
|
393
|
+
* `undefined` when no definition is registered.
|
|
394
|
+
* @param clientId - Stable client identifier (e.g. `'claude-code'`)
|
|
395
|
+
* @returns The registered {@link ClientDefinition}, or `undefined`
|
|
396
|
+
*/
|
|
397
|
+
getDefinition(clientId: string): ClientDefinition$1 | undefined;
|
|
398
|
+
/**
|
|
399
|
+
* Return all registered definitions known to this lookup.
|
|
400
|
+
*
|
|
401
|
+
* `client.list` uses this to include managed clients that have no installed
|
|
402
|
+
* versions or state rows yet.
|
|
403
|
+
* @returns Registered client definitions
|
|
404
|
+
*/
|
|
405
|
+
listDefinitions(): readonly ClientDefinition$1[];
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
* Result passed to the completion callback after a successful install.
|
|
409
|
+
*
|
|
410
|
+
* Bundles the job identity and artifact information into a single object
|
|
411
|
+
* so the callback signature stays stable as new fields are added.
|
|
412
|
+
*/
|
|
413
|
+
interface JobCompletionResult {
|
|
414
|
+
/** Job identifier that completed. */
|
|
415
|
+
jobId: string;
|
|
416
|
+
/** Stable client identifier. */
|
|
417
|
+
clientId: string;
|
|
418
|
+
/** Installed version string. */
|
|
419
|
+
version: string;
|
|
420
|
+
/** Absolute path to the installed binary directory. */
|
|
421
|
+
installPath: string;
|
|
422
|
+
/** Whether to activate this version. */
|
|
423
|
+
makeActive: boolean;
|
|
424
|
+
/** Originating operation reason forwarded to `client.version.changed`. */
|
|
425
|
+
reason: 'install' | 'update';
|
|
426
|
+
}
|
|
427
|
+
/**
|
|
428
|
+
* Callback invoked by the job runner when a job completes successfully and
|
|
429
|
+
* the binary has been written to disk but before activation.
|
|
430
|
+
*
|
|
431
|
+
* The manager uses this to persist the installed version to storage and
|
|
432
|
+
* optionally set it as active.
|
|
433
|
+
* @param result - Completion result with job and artifact details
|
|
434
|
+
*/
|
|
435
|
+
type JobCompletionCallback = (result: JobCompletionResult) => Promise<void>;
|
|
436
|
+
/**
|
|
437
|
+
* Callback invoked by the job runner at each install pipeline stage transition.
|
|
438
|
+
*
|
|
439
|
+
* The manager provides this callback and emits the typed
|
|
440
|
+
* `client.installJob.progress` bus event.
|
|
441
|
+
* @param payload - Progress event payload to emit
|
|
442
|
+
*/
|
|
443
|
+
type JobProgressCallback = (payload: ClientInstallProgress) => void;
|
|
444
|
+
/**
|
|
445
|
+
* Callback invoked by the job runner when the install pipeline terminates
|
|
446
|
+
* (success or failure).
|
|
447
|
+
*
|
|
448
|
+
* The manager provides this callback and emits the typed
|
|
449
|
+
* `client.installJob.completed` bus event.
|
|
450
|
+
* @param payload - Completed event payload to emit
|
|
451
|
+
*/
|
|
452
|
+
type JobCompletedCallback = (payload: ClientInstallCompleted) => Promise<void>;
|
|
453
|
+
/**
|
|
454
|
+
* Return `true` when `candidate` resolves within `base`.
|
|
455
|
+
*
|
|
456
|
+
* Used by the manager and job runner to guard against path-traversal
|
|
457
|
+
* in persisted install paths and user-supplied version strings.
|
|
458
|
+
*
|
|
459
|
+
* Both arguments must be absolute paths. Relative inputs are rejected before
|
|
460
|
+
* `path.resolve()` runs so the process working directory cannot turn a
|
|
461
|
+
* relative candidate into an apparently managed path.
|
|
462
|
+
* @param base - Absolute base path
|
|
463
|
+
* @param candidate - Absolute path to validate
|
|
464
|
+
* @returns `true` when the candidate is safely within `base`
|
|
465
|
+
*/
|
|
466
|
+
declare function isPathWithinBase(base: string, candidate: string): boolean;
|
|
467
|
+
/**
|
|
468
|
+
* Resolve and validate `basePath`, returning the resolved absolute path.
|
|
469
|
+
*
|
|
470
|
+
* Both {@link ClientBinaryManager} and {@link ClientBinaryJobRunner} call this
|
|
471
|
+
* at construction time so the resolved base is computed once and reused.
|
|
472
|
+
* @param basePath - Raw base path from configuration
|
|
473
|
+
* @param caller - Class name for error messages
|
|
474
|
+
* @returns Resolved absolute base path
|
|
475
|
+
* @throws When `basePath` is empty or not absolute
|
|
476
|
+
*/
|
|
477
|
+
declare function resolveAndValidateBasePath(basePath: string, caller: string): string;
|
|
478
|
+
//#endregion
|
|
479
|
+
//#region packages/clients-core/src/client-binary-manager.d.ts
|
|
480
|
+
/**
|
|
481
|
+
* In-memory manager for the global `client.*` binary-management contracts.
|
|
482
|
+
*
|
|
483
|
+
* **Responsibilities:**
|
|
484
|
+
* - Hydrate the feed cache and version resolver from storage on boot.
|
|
485
|
+
* - Handle `client.list`, `client.install`, `client.update`,
|
|
486
|
+
* `client.setActive`, and `client.uninstall` bus subjects.
|
|
487
|
+
* - Delegate async install/update execution to {@link ClientBinaryJobRunner}.
|
|
488
|
+
* - Persist installation state via `client-binary:storage.*` subjects.
|
|
489
|
+
* - Emit `client.version.changed` whenever the active version pointer changes.
|
|
490
|
+
* - Provide typed progress and completed callbacks to the job runner so that
|
|
491
|
+
* bus emissions remain in the manager layer with correct type inference.
|
|
492
|
+
*
|
|
493
|
+
* **One job per client invariant:** only one install or update job is allowed
|
|
494
|
+
* to run for a given client at a time. Concurrent requests are rejected with
|
|
495
|
+
* an error until the in-flight job completes.
|
|
496
|
+
*/
|
|
497
|
+
declare class ClientBinaryManager extends BaseService {
|
|
498
|
+
private readonly config;
|
|
499
|
+
private readonly definitionLookup;
|
|
500
|
+
private readonly feedCache;
|
|
501
|
+
private readonly versionResolver;
|
|
502
|
+
private readonly jobRunner;
|
|
503
|
+
private readonly strategyDeps;
|
|
504
|
+
private readonly resolvedBasePath;
|
|
505
|
+
private readonly resolver;
|
|
506
|
+
/**
|
|
507
|
+
* Set of client IDs with an operation (install, update, or uninstall) in
|
|
508
|
+
* progress.
|
|
509
|
+
*
|
|
510
|
+
* Acquired synchronously before any async work to serialize concurrent
|
|
511
|
+
* requests per client and prevent the TOCTOU window between a guard check
|
|
512
|
+
* and the eventual {@link ClientBinaryJobRunner.startJob} call.
|
|
513
|
+
*
|
|
514
|
+
* Released by the `makeCompletedCallback` `.finally()` on job termination,
|
|
515
|
+
* by the `handleUninstall` `finally` block on uninstall completion, or by
|
|
516
|
+
* {@link onDestroy} on manager teardown.
|
|
517
|
+
*/
|
|
518
|
+
private readonly pendingClients;
|
|
519
|
+
/**
|
|
520
|
+
* Creates a new binary manager.
|
|
521
|
+
* @param bus - Bus instance for handler registration and event emission
|
|
522
|
+
* @param config - Manager configuration; `basePath` and `configBasePath` must be non-empty absolute paths
|
|
523
|
+
* @param definitionLookup - Client definition registry
|
|
524
|
+
* @param strategyDeps - I/O dependency implementations for strategies
|
|
525
|
+
* @throws When `config.basePath` or `config.configBasePath` is empty or relative
|
|
526
|
+
*/
|
|
527
|
+
constructor(bus: IMakaioBus | undefined, config: ClientBinaryManagerConfig, definitionLookup?: ClientDefinitionLookup, strategyDeps?: StrategyDependencies);
|
|
528
|
+
/**
|
|
529
|
+
* Hydrate state from storage and register bus handlers.
|
|
530
|
+
*/
|
|
531
|
+
protected onInit(): Promise<void>;
|
|
532
|
+
/**
|
|
533
|
+
* Cancel all running jobs and clear in-memory state.
|
|
534
|
+
*/
|
|
535
|
+
protected onDestroy(): void;
|
|
536
|
+
/**
|
|
537
|
+
* Assemble the installation inventory for all managed clients.
|
|
538
|
+
*
|
|
539
|
+
* Delegates to {@link assembleBinaryList} for the read-model assembly logic.
|
|
540
|
+
* @param forceRefresh - When `true`, force a live upstream feed refresh
|
|
541
|
+
* @returns Assembled list of client binary entries
|
|
542
|
+
*/
|
|
543
|
+
private handleList;
|
|
544
|
+
/**
|
|
545
|
+
* Enqueue a background install job for a managed client binary.
|
|
546
|
+
*
|
|
547
|
+
* Resolves the target version (explicit or latest-from-feed) and returns
|
|
548
|
+
* a `jobId` immediately. The job runs asynchronously; callers track progress
|
|
549
|
+
* via `client.installJob.progress` and `client.installJob.completed` events.
|
|
550
|
+
* @param clientId - Stable client identifier to install
|
|
551
|
+
* @param requestedVersion - Explicit version to install, or `undefined` for latest
|
|
552
|
+
* @returns Job acknowledgement with resolved version
|
|
553
|
+
*/
|
|
554
|
+
private handleInstall;
|
|
555
|
+
/**
|
|
556
|
+
* Refresh the feed, resolve the latest version, and enqueue an update job
|
|
557
|
+
* that installs and activates the result.
|
|
558
|
+
* @param clientId - Stable client identifier to update
|
|
559
|
+
* @returns Job acknowledgement with resolved version
|
|
560
|
+
*/
|
|
561
|
+
private handleUpdate;
|
|
562
|
+
/**
|
|
563
|
+
* Switch the active binary pointer to an already-installed version.
|
|
564
|
+
*
|
|
565
|
+
* The requested version must be present in the installed versions list;
|
|
566
|
+
* requests for uninstalled versions are rejected with an error.
|
|
567
|
+
* @param clientId - Stable client identifier
|
|
568
|
+
* @param version - Exact installed version string to activate
|
|
569
|
+
* @returns Updated client and active version
|
|
570
|
+
*/
|
|
571
|
+
private handleSetActive;
|
|
572
|
+
/**
|
|
573
|
+
* Remove a specific installed version of a managed client binary.
|
|
574
|
+
*
|
|
575
|
+
* The version row and active-version pointer are cleared atomically in a
|
|
576
|
+
* single storage transaction via `removeVersionAndClearActive`. Filesystem
|
|
577
|
+
* cleanup and event emission occur in the manager layer after the transaction
|
|
578
|
+
* commits, keeping I/O out of the storage handler.
|
|
579
|
+
*
|
|
580
|
+
* If the removed version was active, `client.version.changed` is emitted.
|
|
581
|
+
* No automatic replacement is made — callers must explicitly call
|
|
582
|
+
* `client.setActive` to promote another version.
|
|
583
|
+
* @param clientId - Stable client identifier
|
|
584
|
+
* @param version - Exact version string to remove
|
|
585
|
+
* @returns Removal result with the updated active version
|
|
586
|
+
*/
|
|
587
|
+
private handleUninstall;
|
|
588
|
+
/**
|
|
589
|
+
* Update the active version pointer and optionally emit
|
|
590
|
+
* `client.version.changed`.
|
|
591
|
+
*
|
|
592
|
+
* Centralizes the storage-side active-version mutation used by
|
|
593
|
+
* `handleSetActive` and the job completion callback. Feed-cache fields are
|
|
594
|
+
* preserved by `client-binary:storage.setActiveVersion`.
|
|
595
|
+
* @param clientId - Stable client identifier
|
|
596
|
+
* @param newActiveVersion - Version to set active, or `null` to clear
|
|
597
|
+
* @param reason - Operation that triggered the change
|
|
598
|
+
* @returns The previous active version before the mutation
|
|
599
|
+
*/
|
|
600
|
+
private patchActiveVersion;
|
|
601
|
+
/**
|
|
602
|
+
* Hydrate feed cache and version resolver from persisted storage.
|
|
603
|
+
*
|
|
604
|
+
* Called once during `onInit()`. Populates the in-memory caches so that
|
|
605
|
+
* `client.list` and `client.install` requests do not need a live feed fetch
|
|
606
|
+
* on the first call after a process restart. Both caches are seeded from
|
|
607
|
+
* a single `loadAllState` bus round-trip.
|
|
608
|
+
*/
|
|
609
|
+
private hydrateFromStorage;
|
|
610
|
+
/**
|
|
611
|
+
* Look up and validate a managed client definition.
|
|
612
|
+
*
|
|
613
|
+
* Throws when no definition is registered for `clientId` or when the
|
|
614
|
+
* definition lacks a `managedInstall` descriptor.
|
|
615
|
+
* @param clientId - Stable client identifier
|
|
616
|
+
* @param subject - Bus subject name used in error messages
|
|
617
|
+
* @returns The full definition and its managed install descriptor
|
|
618
|
+
*/
|
|
619
|
+
private requireManagedDefinition;
|
|
620
|
+
/**
|
|
621
|
+
* Acquire the per-client operation lock, run `fn`, and release the lock on
|
|
622
|
+
* pre-job errors via the catch path.
|
|
623
|
+
*
|
|
624
|
+
* On successful job start the lock transfers to the
|
|
625
|
+
* `makeCompletedCallback`, which releases it on job termination.
|
|
626
|
+
* @param clientId - Stable client identifier to lock
|
|
627
|
+
* @param fn - Async work to run while the lock is held
|
|
628
|
+
* @returns The result of `fn`
|
|
629
|
+
*/
|
|
630
|
+
private withClientLock;
|
|
631
|
+
/**
|
|
632
|
+
* Build an {@link InstallJob} and hand it to the job runner.
|
|
633
|
+
* @param clientId - Stable client identifier
|
|
634
|
+
* @param resolvedVersion - Concrete version to install
|
|
635
|
+
* @param descriptor - Managed install descriptor
|
|
636
|
+
* @param definition - Full client definition (for post-install and version command)
|
|
637
|
+
* @param makeActive - Whether to activate the version after install
|
|
638
|
+
* @param reason - Originating operation
|
|
639
|
+
* @returns The generated `jobId`
|
|
640
|
+
*/
|
|
641
|
+
private startInstallJob;
|
|
642
|
+
/**
|
|
643
|
+
* Create the completion callback passed to the job runner.
|
|
644
|
+
*
|
|
645
|
+
* Persists the installed version to storage and optionally sets it as active,
|
|
646
|
+
* then emits `client.version.changed` with the originating operation reason.
|
|
647
|
+
*
|
|
648
|
+
* **Consistency guarantee:** version persistence and optional activation
|
|
649
|
+
* are committed through one storage transaction, so a failed activation
|
|
650
|
+
* cannot leave a version row pointing at a directory the runner will remove.
|
|
651
|
+
* @returns Bound completion callback for the job runner
|
|
652
|
+
*/
|
|
653
|
+
private makeCompletionCallback;
|
|
654
|
+
}
|
|
655
|
+
//#endregion
|
|
656
|
+
//#region packages/clients-core/src/client-binary-job-runner.d.ts
|
|
657
|
+
/**
|
|
658
|
+
* Executes install jobs asynchronously and delivers progress and completed
|
|
659
|
+
* notifications via caller-provided typed callbacks.
|
|
660
|
+
*
|
|
661
|
+
* **Lifecycle:**
|
|
662
|
+
* 1. The {@link ClientBinaryManager} creates an {@link InstallJob} and calls
|
|
663
|
+
* {@link startJob}.
|
|
664
|
+
* 2. The runner starts the job in the background (fire-and-forget `void`).
|
|
665
|
+
* 3. As the strategy moves through pipeline stages, the runner invokes the
|
|
666
|
+
* `onProgress` callback with typed progress payloads.
|
|
667
|
+
* 4. On success the runner invokes {@link JobCompletionCallback} (for
|
|
668
|
+
* persistence and activation) and then `onCompleted` with
|
|
669
|
+
* `status: 'success'`.
|
|
670
|
+
* 5. On failure the runner invokes `onCompleted` with `status: 'error'` and
|
|
671
|
+
* skips the persistence callback.
|
|
672
|
+
* 6. {@link cancelAll} sets a cancellation flag and clears the job map so
|
|
673
|
+
* that any in-flight async work skips callbacks after shutdown. The
|
|
674
|
+
* underlying I/O (network, disk) is not interrupted.
|
|
675
|
+
*/
|
|
676
|
+
declare class ClientBinaryJobRunner {
|
|
677
|
+
#private;
|
|
678
|
+
private readonly strategyDeps;
|
|
679
|
+
private readonly config;
|
|
680
|
+
/** Active jobs keyed by `jobId`. */
|
|
681
|
+
private readonly jobs;
|
|
682
|
+
private readonly resolvedBasePath;
|
|
683
|
+
/**
|
|
684
|
+
* @param strategyDeps - I/O dependency implementations forwarded to each strategy
|
|
685
|
+
* @param config - Manager configuration (provides `basePath`)
|
|
686
|
+
*/
|
|
687
|
+
constructor(strategyDeps: StrategyDependencies, config: ClientBinaryManagerConfig);
|
|
688
|
+
/**
|
|
689
|
+
* Start a background install job and return immediately.
|
|
690
|
+
*
|
|
691
|
+
* The job is registered in the internal job map and executed asynchronously.
|
|
692
|
+
* Callers must not await the returned value — the job reports its outcome
|
|
693
|
+
* through the provided callbacks.
|
|
694
|
+
*
|
|
695
|
+
* Pipeline order:
|
|
696
|
+
* 1. Strategy execute (download → checksum → extract → install)
|
|
697
|
+
* 2. Post-install hook (if declared)
|
|
698
|
+
* 3. Version verification (if `versionCommand` is provided)
|
|
699
|
+
* 4. `onComplete` persistence callback
|
|
700
|
+
* 5. `onCompleted` bus-event callback
|
|
701
|
+
* @param job - Job descriptor created by the manager
|
|
702
|
+
* @param descriptor - Managed install descriptor for the client
|
|
703
|
+
* @param onProgress - Callback invoked at each pipeline stage transition
|
|
704
|
+
* @param onComplete - Callback invoked by the runner on successful completion (persistence)
|
|
705
|
+
* @param onCompleted - Callback invoked after completion (bus event emission)
|
|
706
|
+
* @param postInstall - Optional post-install descriptor from the client definition
|
|
707
|
+
* @param versionCommand - Optional version command used to verify the installed binary
|
|
708
|
+
* @returns The `jobId` of the started job (same as `job.jobId`)
|
|
709
|
+
*/
|
|
710
|
+
startJob(job: InstallJob, descriptor: ManagedInstallDescriptor, onProgress: JobProgressCallback, onComplete: JobCompletionCallback, onCompleted: JobCompletedCallback, postInstall?: PostInstallDescriptor, versionCommand?: readonly [string, ...string[]]): string;
|
|
711
|
+
/**
|
|
712
|
+
* Signal cancellation and clear all tracked jobs.
|
|
713
|
+
*
|
|
714
|
+
* Called by the manager during shutdown. Sets the cancellation flag so that
|
|
715
|
+
* any in-flight async work skips its callbacks after this point. Clears the
|
|
716
|
+
* internal job map to avoid memory leaks across test resets.
|
|
717
|
+
*/
|
|
718
|
+
cancelAll(): void;
|
|
719
|
+
/**
|
|
720
|
+
* Invoke the progress callback without propagating exceptions.
|
|
721
|
+
*
|
|
722
|
+
* Progress emission is best-effort: if the manager's progress publisher
|
|
723
|
+
* throws (e.g. a bus error or a subscriber that throws), the error is
|
|
724
|
+
* swallowed so that the install pipeline can continue unaffected.
|
|
725
|
+
* @param onProgress - Progress notification callback provided by the manager
|
|
726
|
+
* @param payload - Progress event payload to emit
|
|
727
|
+
*/
|
|
728
|
+
private safeOnProgress;
|
|
729
|
+
/**
|
|
730
|
+
* Emit progress only while the runner is active.
|
|
731
|
+
*
|
|
732
|
+
* Helper methods use this instead of open-coding `#cancelled` checks so a
|
|
733
|
+
* shutdown that arrives between the caller's outer guard and the helper body
|
|
734
|
+
* cannot leak progress events from a destroyed manager.
|
|
735
|
+
* @param onProgress - Progress notification callback provided by the manager
|
|
736
|
+
* @param payload - Progress event payload to emit
|
|
737
|
+
* @returns `true` when the event was emitted; `false` when cancelled
|
|
738
|
+
*/
|
|
739
|
+
private emitProgressIfActive;
|
|
740
|
+
/**
|
|
741
|
+
* Execute a single install job to completion.
|
|
742
|
+
*
|
|
743
|
+
* This method drives the strategy pipeline, invokes the progress callback
|
|
744
|
+
* at each stage, calls the persistence callback on success, and always
|
|
745
|
+
* invokes the completed callback at the end regardless of outcome.
|
|
746
|
+
*
|
|
747
|
+
* All callbacks are guarded by the `#cancelled` flag: if {@link cancelAll}
|
|
748
|
+
* is called while the job is in flight (e.g. during shutdown), no further
|
|
749
|
+
* callbacks will fire after that point.
|
|
750
|
+
* @param job - The running job descriptor
|
|
751
|
+
* @param descriptor - Managed install descriptor for the client
|
|
752
|
+
* @param onProgress - Progress notification callback
|
|
753
|
+
* @param onComplete - Persistence callback invoked on successful completion
|
|
754
|
+
* @param onCompleted - Bus event emission callback invoked after all work
|
|
755
|
+
* @param postInstall - Optional declarative post-install descriptor
|
|
756
|
+
* @param versionCommand - Optional version command used to verify the installed binary
|
|
757
|
+
*/
|
|
758
|
+
private runJob;
|
|
759
|
+
/**
|
|
760
|
+
* Drive the success-path finalization: emit the `activating` stage when
|
|
761
|
+
* applicable, persist the artifact via `onComplete`, then emit the
|
|
762
|
+
* `client.installJob.completed` event via `onCompleted`.
|
|
763
|
+
*
|
|
764
|
+
* Extracted from {@link runJob} to keep that method within the line-count
|
|
765
|
+
* lint budget while retaining readable control flow.
|
|
766
|
+
* @param job - Running job descriptor
|
|
767
|
+
* @param artifact - Normalized install artifact returned by the strategy
|
|
768
|
+
* @param metadata - Optional post-install handler metadata
|
|
769
|
+
* @param onProgress - Progress callback (best-effort via {@link safeOnProgress})
|
|
770
|
+
* @param onComplete - Persistence callback invoked before event emission
|
|
771
|
+
* @param onCompleted - Bus event emission callback
|
|
772
|
+
*/
|
|
773
|
+
private finalizeSuccess;
|
|
774
|
+
/**
|
|
775
|
+
* Best-effort cleanup for an artifact that passed strategy execution but failed
|
|
776
|
+
* before it could be persisted as an installed version.
|
|
777
|
+
* @param installPath - Absolute staged install directory to remove
|
|
778
|
+
*/
|
|
779
|
+
private cleanupStagedArtifact;
|
|
780
|
+
/**
|
|
781
|
+
* Run the optional declarative post-install hook through a framework-owned
|
|
782
|
+
* handler registered on the manager config.
|
|
783
|
+
* @param job - Running job descriptor
|
|
784
|
+
* @param installPath - Absolute installed binary directory
|
|
785
|
+
* @param postInstall - Declarative post-install descriptor, if any
|
|
786
|
+
* @param onProgress - Progress callback used to emit `post-install`
|
|
787
|
+
* @returns Optional handler metadata
|
|
788
|
+
*/
|
|
789
|
+
private runPostInstall;
|
|
790
|
+
/**
|
|
791
|
+
* Emit a `verifying` progress event and invoke {@link verifyInstalledVersion}.
|
|
792
|
+
*
|
|
793
|
+
* Emits a `verifying` progress event with `metadata.kind: 'version-command'`
|
|
794
|
+
* before executing the command so that callers can display real-time feedback.
|
|
795
|
+
* The verification runs synchronously after the event is emitted.
|
|
796
|
+
* @param job - Running job descriptor
|
|
797
|
+
* @param installPath - Absolute installed binary directory
|
|
798
|
+
* @param versionCommand - Command and args declared on the client definition
|
|
799
|
+
* @param onProgress - Progress callback for the verifying stage
|
|
800
|
+
* @throws When path validation fails or the binary reports an unexpected version
|
|
801
|
+
*/
|
|
802
|
+
private runVersionVerification;
|
|
803
|
+
/**
|
|
804
|
+
* Resolve a post-install handler by descriptor kind.
|
|
805
|
+
* @param postInstall - Declarative post-install descriptor
|
|
806
|
+
* @returns Registered handler for the descriptor kind
|
|
807
|
+
* @throws When no handler is registered for the descriptor kind
|
|
808
|
+
*/
|
|
809
|
+
private resolvePostInstallHandler;
|
|
810
|
+
/**
|
|
811
|
+
* Build a progress payload for runner-owned stages.
|
|
812
|
+
* @param job - Running job descriptor
|
|
813
|
+
* @param stage - Install stage to report
|
|
814
|
+
* @param progress - Stage progress value
|
|
815
|
+
* @param installPath - Absolute installed binary directory
|
|
816
|
+
* @param metadata - Optional event metadata
|
|
817
|
+
* @returns Install progress payload
|
|
818
|
+
*/
|
|
819
|
+
private buildProgressPayload;
|
|
820
|
+
/**
|
|
821
|
+
* Resolve the absolute install directory for a specific client version.
|
|
822
|
+
*
|
|
823
|
+
* The convention is `{basePath}/{clientId}/{version}/`. Both `clientId` and
|
|
824
|
+
* `version` are resolved against the base path and validated to prevent path
|
|
825
|
+
* traversal sequences (e.g. `..`) from escaping the install root.
|
|
826
|
+
* @param clientId - Stable client identifier
|
|
827
|
+
* @param version - Resolved version string
|
|
828
|
+
* @returns Absolute target directory path
|
|
829
|
+
* @throws When the resolved path would escape `basePath`
|
|
830
|
+
*/
|
|
831
|
+
private resolveTargetDir;
|
|
832
|
+
}
|
|
833
|
+
//#endregion
|
|
834
|
+
//#region packages/clients-core/src/client-definition-registry.d.ts
|
|
835
|
+
/**
|
|
836
|
+
* Concrete {@link ClientDefinitionLookup} implementation seeded with a fixed
|
|
837
|
+
* set of definitions at construction time.
|
|
838
|
+
*
|
|
839
|
+
* Definitions are indexed by {@link ClientDefinition.id} for O(1) lookup.
|
|
840
|
+
* The constructor validates that all supplied definitions have unique IDs,
|
|
841
|
+
* throwing immediately on a duplicate to surface misconfiguration at boot
|
|
842
|
+
* rather than silently overwriting an existing entry.
|
|
843
|
+
* @example
|
|
844
|
+
* ```ts
|
|
845
|
+
* const registry = new ClientDefinitionRegistry([claudeCodeDefinition]);
|
|
846
|
+
* const manager = new ClientBinaryManager(bus, config, registry, strategyDeps);
|
|
847
|
+
* await manager.init();
|
|
848
|
+
* ```
|
|
849
|
+
*/
|
|
850
|
+
declare class ClientDefinitionRegistry implements ClientDefinitionLookup {
|
|
851
|
+
private readonly definitions;
|
|
852
|
+
/**
|
|
853
|
+
* Create a registry pre-seeded with the supplied definitions.
|
|
854
|
+
*
|
|
855
|
+
* Throws when any two definitions share the same `id` — duplicate IDs
|
|
856
|
+
* indicate a misconfigured boot path that should fail loudly rather than
|
|
857
|
+
* silently drop or overwrite an entry.
|
|
858
|
+
* @param initialDefinitions - Ordered list of client definitions to register at construction time
|
|
859
|
+
* @throws When two definitions in `initialDefinitions` share the same `id`
|
|
860
|
+
*/
|
|
861
|
+
constructor(initialDefinitions?: readonly ClientDefinition$1[]);
|
|
862
|
+
/**
|
|
863
|
+
* Return the static definition for the given client identifier, or
|
|
864
|
+
* `undefined` when no definition is registered.
|
|
865
|
+
* @param clientId - Stable client identifier (e.g. `'claude-code'`)
|
|
866
|
+
* @returns The registered {@link ClientDefinition}, or `undefined`
|
|
867
|
+
*/
|
|
868
|
+
getDefinition(clientId: string): ClientDefinition$1 | undefined;
|
|
869
|
+
/**
|
|
870
|
+
* Return all registered definitions in insertion order.
|
|
871
|
+
*
|
|
872
|
+
* `client.list` uses this to include managed clients that have no installed
|
|
873
|
+
* versions or state rows yet.
|
|
874
|
+
* @returns All registered client definitions
|
|
875
|
+
*/
|
|
876
|
+
listDefinitions(): readonly ClientDefinition$1[];
|
|
877
|
+
/**
|
|
878
|
+
* Register a client definition, replacing any existing entry for the same
|
|
879
|
+
* `definition.id`.
|
|
880
|
+
*
|
|
881
|
+
* **Test and admin path only.** This method is intentionally excluded from
|
|
882
|
+
* the normal application boot sequence. On the production path, all
|
|
883
|
+
* definitions are supplied to the constructor so the registry is immutable
|
|
884
|
+
* from the manager's perspective. Call `register` only from tests or
|
|
885
|
+
* administrative tooling that needs to inject or replace a definition after
|
|
886
|
+
* construction.
|
|
887
|
+
* @param definition - Client definition to register; its `id` is used as the registry key
|
|
888
|
+
*/
|
|
889
|
+
register(definition: ClientDefinition$1): void;
|
|
890
|
+
/**
|
|
891
|
+
* Internal helper that registers a definition and throws on a duplicate ID.
|
|
892
|
+
*
|
|
893
|
+
* Used exclusively by the constructor to enforce uniqueness during seeding.
|
|
894
|
+
* @param definition - Client definition to register
|
|
895
|
+
* @throws When a definition with the same `id` is already registered
|
|
896
|
+
*/
|
|
897
|
+
private registerUnique;
|
|
898
|
+
}
|
|
899
|
+
//#endregion
|
|
900
|
+
//#region packages/clients-core/src/client-binary-version-resolver.d.ts
|
|
901
|
+
/**
|
|
902
|
+
* Upstream feed fetcher abstraction.
|
|
903
|
+
*
|
|
904
|
+
* Implementors are responsible for the strategy-specific network calls needed
|
|
905
|
+
* to discover the latest published version of a managed client binary. The
|
|
906
|
+
* resolver treats this as a pure dependency so callers can substitute a mock
|
|
907
|
+
* in tests.
|
|
908
|
+
*/
|
|
909
|
+
interface FeedFetcher {
|
|
910
|
+
/**
|
|
911
|
+
* Fetch the latest available version string for the given install descriptor.
|
|
912
|
+
*
|
|
913
|
+
* The returned string must be a non-empty version identifier (semver or
|
|
914
|
+
* opaque tag). The implementor should throw on any network or parse error so
|
|
915
|
+
* the resolver can apply its fallback logic.
|
|
916
|
+
* @param descriptor - Managed install descriptor for the client
|
|
917
|
+
* @returns Resolved latest version string
|
|
918
|
+
*/
|
|
919
|
+
fetchLatestVersion(descriptor: ManagedInstallDescriptor): Promise<string>;
|
|
920
|
+
}
|
|
921
|
+
/**
|
|
922
|
+
* Resolution result returned by {@link ClientBinaryVersionResolver.resolveInstallVersion}.
|
|
923
|
+
*/
|
|
924
|
+
interface ResolvedInstallVersion {
|
|
925
|
+
/** Concrete version string to install. */
|
|
926
|
+
version: string;
|
|
927
|
+
/**
|
|
928
|
+
* `true` when the version was supplied explicitly by the caller;
|
|
929
|
+
* `false` when the resolver fell back to the cached latest.
|
|
930
|
+
*/
|
|
931
|
+
explicit: boolean;
|
|
932
|
+
}
|
|
933
|
+
/**
|
|
934
|
+
* Latest-version metadata for a single client, suitable for inclusion in a
|
|
935
|
+
* `client.list` response.
|
|
936
|
+
*/
|
|
937
|
+
interface LatestVersionMeta {
|
|
938
|
+
/** Latest version string known to the resolver, or `null` when unknown. */
|
|
939
|
+
latestAvailableVersion: string | null;
|
|
940
|
+
/** Epoch timestamp when the latest-version index was last checked, or `null`. */
|
|
941
|
+
latestVersionLastCheckedAt: number | null;
|
|
942
|
+
/** Freshness classification of the cache entry. */
|
|
943
|
+
latestVersionSourceStatus: LatestVersionSourceStatus$1;
|
|
944
|
+
}
|
|
945
|
+
/**
|
|
946
|
+
* In-memory version resolver for managed client binaries.
|
|
947
|
+
*
|
|
948
|
+
* Responsibilities:
|
|
949
|
+
* - Resolving a concrete version for `client.install` requests, falling back
|
|
950
|
+
* to the last known latest when no explicit version is given.
|
|
951
|
+
* - Refreshing the latest-version cache on demand (for `client.list` with
|
|
952
|
+
* `forceRefresh: true`), with a graceful fallback to the cached value on
|
|
953
|
+
* network failure.
|
|
954
|
+
* - Exposing the cache state for `client.list` response assembly.
|
|
955
|
+
*
|
|
956
|
+
* This class is intentionally bus-free. The `ClientBinaryManager` owns bus
|
|
957
|
+
* registration and calls into this resolver.
|
|
958
|
+
*/
|
|
959
|
+
declare class ClientBinaryVersionResolver {
|
|
960
|
+
#private;
|
|
961
|
+
private readonly feedFetcher;
|
|
962
|
+
private readonly cache;
|
|
963
|
+
/**
|
|
964
|
+
* Creates a new resolver instance.
|
|
965
|
+
* @param feedFetcher - Strategy-agnostic upstream feed fetcher
|
|
966
|
+
*/
|
|
967
|
+
constructor(feedFetcher: FeedFetcher);
|
|
968
|
+
/**
|
|
969
|
+
* Resolve the version to install for a `client.install` request.
|
|
970
|
+
*
|
|
971
|
+
* When `explicitVersion` is supplied it is returned unchanged. When it is
|
|
972
|
+
* absent the resolver returns the last cached latest version. If no cache
|
|
973
|
+
* entry exists for the client, the resolver attempts a live feed refresh; if
|
|
974
|
+
* that also fails, an error is thrown so the caller can reject the request
|
|
975
|
+
* with a clear message rather than installing a phantom version.
|
|
976
|
+
* @param clientId - Stable client identifier (e.g. `'claude-code'`)
|
|
977
|
+
* @param descriptor - Managed install descriptor for the client
|
|
978
|
+
* @param explicitVersion - Version string supplied by the caller, or `undefined`
|
|
979
|
+
* @returns Resolved version and whether it was explicitly requested
|
|
980
|
+
*/
|
|
981
|
+
resolveInstallVersion(clientId: string, descriptor: ManagedInstallDescriptor, explicitVersion: string | undefined): Promise<ResolvedInstallVersion>;
|
|
982
|
+
/**
|
|
983
|
+
* Attempt a live feed refresh and update the in-memory cache.
|
|
984
|
+
*
|
|
985
|
+
* On success the cache entry is updated to `'fresh'`. On failure the
|
|
986
|
+
* existing entry (if any) is retained but its status is set to `'error'` so
|
|
987
|
+
* that callers can surface degraded-mode metadata without losing the last
|
|
988
|
+
* known version.
|
|
989
|
+
* @param clientId - Stable client identifier (e.g. `'claude-code'`)
|
|
990
|
+
* @param descriptor - Managed install descriptor for the client
|
|
991
|
+
* @returns `true` when the refresh succeeded, `false` when it failed
|
|
992
|
+
*/
|
|
993
|
+
refresh(clientId: string, descriptor: ManagedInstallDescriptor): Promise<boolean>;
|
|
994
|
+
/**
|
|
995
|
+
* Return the current latest-version metadata for a client, suitable for
|
|
996
|
+
* embedding in a `client.list` response.
|
|
997
|
+
*
|
|
998
|
+
* When no cache entry exists, the returned object has `null` fields and
|
|
999
|
+
* status `'error'` — the absence of a cached value is itself an error state
|
|
1000
|
+
* from the perspective of the list consumer.
|
|
1001
|
+
* @param clientId - Stable client identifier (e.g. `'claude-code'`)
|
|
1002
|
+
* @returns Latest-version metadata object
|
|
1003
|
+
*/
|
|
1004
|
+
getLatestVersionMeta(clientId: string): LatestVersionMeta;
|
|
1005
|
+
/**
|
|
1006
|
+
* Seed the cache with a previously persisted latest-version entry.
|
|
1007
|
+
*
|
|
1008
|
+
* This is called by the `ClientBinaryManager` at startup to restore the
|
|
1009
|
+
* feed-cache state from durable storage so that `resolveInstallVersion` does
|
|
1010
|
+
* not need a live fetch on the first call after a restart.
|
|
1011
|
+
*
|
|
1012
|
+
* The seeded entry defaults to `'cached'` because it survived a process
|
|
1013
|
+
* restart and has not been confirmed live in this session. Callers may pass
|
|
1014
|
+
* `'error'` when the persisted row records a failed refresh attempt that
|
|
1015
|
+
* should remain visible after hydration.
|
|
1016
|
+
* @param clientId - Stable client identifier (e.g. `'claude-code'`)
|
|
1017
|
+
* @param version - Version string from storage
|
|
1018
|
+
* @param checkedAt - Epoch timestamp when the version was last fetched
|
|
1019
|
+
* @param status - Persisted source status to seed
|
|
1020
|
+
*/
|
|
1021
|
+
seedFromStorage(clientId: string, version: string, checkedAt: number, status?: LatestVersionSourceStatus$1): void;
|
|
1022
|
+
/**
|
|
1023
|
+
* Clear all in-memory cache entries.
|
|
1024
|
+
*
|
|
1025
|
+
* Intended for use in tests and on service destroy.
|
|
1026
|
+
*/
|
|
1027
|
+
clear(): void;
|
|
1028
|
+
}
|
|
1029
|
+
//#endregion
|
|
1030
|
+
//#region packages/clients-core/src/client-runtime-registry-types.d.ts
|
|
1031
|
+
/**
|
|
1032
|
+
* Shared types for the client runtime registry.
|
|
1033
|
+
*
|
|
1034
|
+
* Defines the in-memory record shape and upsert result
|
|
1035
|
+
* consumed by {@link ClientRuntimeRegistry} and its storage layer.
|
|
1036
|
+
* @packageDocumentation
|
|
1037
|
+
*/
|
|
1038
|
+
/**
|
|
1039
|
+
* All valid lifecycle status values for a client runtime record.
|
|
1040
|
+
*
|
|
1041
|
+
* - `'observed'` — weaker evidence only (pid without supervisorSessionId); the
|
|
1042
|
+
* runtime has been detected but not yet confirmed as fully started.
|
|
1043
|
+
* - `'started'` — strong evidence present (supervisorSessionId, or an adapter
|
|
1044
|
+
* confirmed the process); the runtime is confirmed started.
|
|
1045
|
+
*/
|
|
1046
|
+
declare const CLIENT_RUNTIME_STATUSES: readonly ["observed", "started"];
|
|
1047
|
+
/** Lifecycle status of a client runtime record. */
|
|
1048
|
+
type ClientRuntimeStatus = (typeof CLIENT_RUNTIME_STATUSES)[number];
|
|
1049
|
+
/**
|
|
1050
|
+
* In-memory record for a single client runtime instance.
|
|
1051
|
+
*
|
|
1052
|
+
* All fields except `clientRuntimeId`, `clientId`, `status`, `observedAt`,
|
|
1053
|
+
* `createdAt`, and `updatedAt` are optional because evidence accumulates
|
|
1054
|
+
* incrementally across multiple observations.
|
|
1055
|
+
*/
|
|
1056
|
+
interface ClientRuntimeRecord {
|
|
1057
|
+
/** Stable runtime identifier assigned by the registry (UUID v4). */
|
|
1058
|
+
readonly clientRuntimeId: string;
|
|
1059
|
+
/** Stable client identifier (e.g. `'claude-code'`). */
|
|
1060
|
+
readonly clientId: string;
|
|
1061
|
+
/** Current lifecycle status of the runtime. */
|
|
1062
|
+
status: ClientRuntimeStatus;
|
|
1063
|
+
/** Supervisor-assigned session ID, if observed. */
|
|
1064
|
+
supervisorSessionId?: string;
|
|
1065
|
+
/** OS process ID of the client binary, if observed. */
|
|
1066
|
+
pid?: number;
|
|
1067
|
+
/** OS process ID of the parent process, if observed. */
|
|
1068
|
+
parentPid?: number;
|
|
1069
|
+
/** Raw session identifier from the client runtime, if observed. */
|
|
1070
|
+
adapterSessionId?: string;
|
|
1071
|
+
/** Framework session ID, if already resolved. */
|
|
1072
|
+
sessionId?: string;
|
|
1073
|
+
/** Working directory of the client process, if observed. */
|
|
1074
|
+
cwd?: string;
|
|
1075
|
+
/** Full argv of the client process, if observed. */
|
|
1076
|
+
argv?: string[];
|
|
1077
|
+
/** Arbitrary pass-through metadata from the most recent observation. */
|
|
1078
|
+
metadata?: Record<string, unknown>;
|
|
1079
|
+
/** Unix epoch timestamp in milliseconds of the latest captured observation while the record was observed. */
|
|
1080
|
+
observedAt: number;
|
|
1081
|
+
/** Unix epoch timestamp in milliseconds when this record was created. */
|
|
1082
|
+
readonly createdAt: number;
|
|
1083
|
+
/** Unix epoch timestamp in milliseconds of the last mutation. */
|
|
1084
|
+
updatedAt: number;
|
|
1085
|
+
}
|
|
1086
|
+
/**
|
|
1087
|
+
* Result returned by {@link ClientRuntimeRegistry.upsertRuntime}.
|
|
1088
|
+
*/
|
|
1089
|
+
interface RuntimeUpsertResult {
|
|
1090
|
+
/** Stable runtime record ID assigned or retrieved by the registry. */
|
|
1091
|
+
readonly clientRuntimeId: string;
|
|
1092
|
+
/** `true` when this observation created a new runtime record. */
|
|
1093
|
+
readonly created: boolean;
|
|
1094
|
+
/**
|
|
1095
|
+
* `true` when this observation promoted an existing record from `'observed'`
|
|
1096
|
+
* to `'started'` status.
|
|
1097
|
+
*/
|
|
1098
|
+
readonly promoted: boolean;
|
|
1099
|
+
/** The upserted runtime record (post-enrichment). */
|
|
1100
|
+
readonly record: ClientRuntimeRecord;
|
|
1101
|
+
}
|
|
1102
|
+
//#endregion
|
|
1103
|
+
//#region packages/clients-core/src/client-runtime-registry.d.ts
|
|
1104
|
+
/**
|
|
1105
|
+
* In-memory registry that canonicalizes client runtime instances across
|
|
1106
|
+
* evidence fields and optionally persists them via a bus-backed handler.
|
|
1107
|
+
*
|
|
1108
|
+
* Construct the registry with an optional bus instance. When a bus is
|
|
1109
|
+
* provided, every upsert is mirrored to the Drizzle handler via the
|
|
1110
|
+
* `client-runtime:storage.upsert` subject. Call {@link loadFromStorage}
|
|
1111
|
+
* once at boot to hydrate the in-memory map from persisted records.
|
|
1112
|
+
*/
|
|
1113
|
+
declare class ClientRuntimeRegistry {
|
|
1114
|
+
private readonly runtimeMap;
|
|
1115
|
+
private readonly bus;
|
|
1116
|
+
/**
|
|
1117
|
+
* Creates a new runtime registry.
|
|
1118
|
+
* @param bus - Optional bus instance used to persist runtime records. When
|
|
1119
|
+
* absent, the registry operates purely in memory without persistence.
|
|
1120
|
+
*/
|
|
1121
|
+
constructor(bus?: IMakaioBus);
|
|
1122
|
+
/**
|
|
1123
|
+
* Hydrate the in-memory map from all records persisted in storage.
|
|
1124
|
+
*
|
|
1125
|
+
* Must be called once at service boot before accepting observations. When
|
|
1126
|
+
* no bus is wired in, this is a no-op.
|
|
1127
|
+
*/
|
|
1128
|
+
loadFromStorage(): Promise<void>;
|
|
1129
|
+
/**
|
|
1130
|
+
* Upsert a runtime record for the provided observation evidence.
|
|
1131
|
+
*
|
|
1132
|
+
* Matching priority:
|
|
1133
|
+
* 1. `supervisorSessionId` — globally unique; matches across clients.
|
|
1134
|
+
* 2. `pid + clientId` — strong OS-level identity.
|
|
1135
|
+
* 3. `adapterSessionId + clientId` — weaker adapter-level identity.
|
|
1136
|
+
*
|
|
1137
|
+
* When no existing record matches, a new runtime is created. When a match
|
|
1138
|
+
* is found, the record is enriched with any new evidence fields and promoted
|
|
1139
|
+
* to `'started'` when the incoming evidence warrants it.
|
|
1140
|
+
* @param input - Runtime observation evidence
|
|
1141
|
+
* @returns Upsert result with the stable `clientRuntimeId` and change flags
|
|
1142
|
+
*/
|
|
1143
|
+
upsertRuntime(input: ClientRuntimeObserveRequest): Promise<RuntimeUpsertResult>;
|
|
1144
|
+
/**
|
|
1145
|
+
* Retrieve a runtime record by its stable ID.
|
|
1146
|
+
*
|
|
1147
|
+
* Returns a detached snapshot so caller mutations cannot affect registry
|
|
1148
|
+
* records or secondary indexes.
|
|
1149
|
+
* @param clientRuntimeId - Stable runtime identifier
|
|
1150
|
+
* @returns The record, or `undefined` when not found
|
|
1151
|
+
*/
|
|
1152
|
+
getRuntime(clientRuntimeId: string): ClientRuntimeRecord | undefined;
|
|
1153
|
+
/**
|
|
1154
|
+
* Remove all in-memory state.
|
|
1155
|
+
*
|
|
1156
|
+
* Does not touch persisted records — the storage layer is authoritative
|
|
1157
|
+
* across restarts. Call {@link loadFromStorage} to re-hydrate.
|
|
1158
|
+
*/
|
|
1159
|
+
clear(): void;
|
|
1160
|
+
/**
|
|
1161
|
+
* Return the number of runtime records currently held in memory.
|
|
1162
|
+
* @returns Number of runtime records in the in-memory map
|
|
1163
|
+
*/
|
|
1164
|
+
get size(): number;
|
|
1165
|
+
private persistRecord;
|
|
1166
|
+
}
|
|
1167
|
+
//#endregion
|
|
1168
|
+
//#region packages/clients-core/src/client-runtime-service.d.ts
|
|
1169
|
+
/**
|
|
1170
|
+
* In-memory runtime service for the global `client.*` contracts.
|
|
1171
|
+
*
|
|
1172
|
+
* The service owns six concerns:
|
|
1173
|
+
* - account identity canonicalization via {@link ClientAccountRegistry}
|
|
1174
|
+
* - latest usage snapshot retention and `client.usage.snapshot` emission
|
|
1175
|
+
* - active account identity tracking (`account.activate` / `account.getActive`)
|
|
1176
|
+
* - CLI-backed client discovery via storage + CLI detection orchestration
|
|
1177
|
+
* - client runtime instance lifecycle via {@link ClientRuntimeRegistry}
|
|
1178
|
+
* - global wiring aggregation via `client.wiring.list` fan-out to enabled clients
|
|
1179
|
+
*/
|
|
1180
|
+
declare class ClientRuntimeService extends BaseService {
|
|
1181
|
+
private readonly accountRegistry;
|
|
1182
|
+
private readonly runtimeRegistry;
|
|
1183
|
+
private readonly latestSnapshots;
|
|
1184
|
+
/**
|
|
1185
|
+
* Most recently activated account identity per client, keyed by `clientId`.
|
|
1186
|
+
*
|
|
1187
|
+
* Populated by the `account.activate` handler and queried by `account.getActive`.
|
|
1188
|
+
* This allows services (e.g. the Claude Code client) to resolve an active
|
|
1189
|
+
* account identity without requiring a persisted session.
|
|
1190
|
+
*/
|
|
1191
|
+
private readonly activeIdentities;
|
|
1192
|
+
/**
|
|
1193
|
+
* Creates a new client runtime service.
|
|
1194
|
+
* @param bus - Bus instance used for client request/event handling
|
|
1195
|
+
* @param accountRegistry - In-memory account registry implementation
|
|
1196
|
+
* @param runtimeRegistry - Registry for client runtime instance lifecycle
|
|
1197
|
+
*/
|
|
1198
|
+
constructor(bus?: IMakaioBus, accountRegistry?: ClientAccountRegistry, runtimeRegistry?: ClientRuntimeRegistry);
|
|
1199
|
+
/**
|
|
1200
|
+
* Register client runtime handlers on the bus.
|
|
1201
|
+
*/
|
|
1202
|
+
protected onInit(): Promise<void>;
|
|
1203
|
+
/**
|
|
1204
|
+
* Clear all in-memory state on destroy.
|
|
1205
|
+
*/
|
|
1206
|
+
protected onDestroy(): void;
|
|
1207
|
+
/**
|
|
1208
|
+
* Return the latest snapshot retained for an account, if one exists.
|
|
1209
|
+
* @param clientAccountId - Canonical account ID
|
|
1210
|
+
* @returns Latest snapshot or undefined
|
|
1211
|
+
*/
|
|
1212
|
+
getLatestSnapshot(clientAccountId: string): ClientUsageSnapshot | undefined;
|
|
1213
|
+
private handleAccountObserve;
|
|
1214
|
+
private handleUsageIngest;
|
|
1215
|
+
private handleRuntimeObserve;
|
|
1216
|
+
private scanClients;
|
|
1217
|
+
private listScannableStoredClients;
|
|
1218
|
+
/**
|
|
1219
|
+
* Fan out a `wiring.list` request to each enabled client and aggregate the
|
|
1220
|
+
* results.
|
|
1221
|
+
*
|
|
1222
|
+
* Only enabled clients respond; clients whose per-client `wiring.list`
|
|
1223
|
+
* handler is not registered are skipped via `requestOptional`, and clients
|
|
1224
|
+
* whose handler throws (I/O error, timeout, etc.) are omitted with a
|
|
1225
|
+
* warning so that one failing client does not break status for the rest.
|
|
1226
|
+
*
|
|
1227
|
+
* The `payload` object accepts three optional filter fields:
|
|
1228
|
+
* - `clientId` — when present, only the matching client is queried.
|
|
1229
|
+
* - `projectDir` — forwarded verbatim to each per-client handler.
|
|
1230
|
+
* - `makaioCommand` — forwarded verbatim to each per-client handler.
|
|
1231
|
+
* @param payload - Filtering options forwarded to each per-client handler.
|
|
1232
|
+
* @returns Aggregated wiring results for all responding enabled clients.
|
|
1233
|
+
*/
|
|
1234
|
+
private listWirings;
|
|
1235
|
+
private consolidateMergedSnapshots;
|
|
1236
|
+
}
|
|
1237
|
+
//#endregion
|
|
1238
|
+
//#region packages/clients-core/src/client-profile-service.d.ts
|
|
1239
|
+
/**
|
|
1240
|
+
* Handles the `client.profile.*` bus subjects, providing full CRUD for named
|
|
1241
|
+
* client configuration profiles plus filesystem directory management.
|
|
1242
|
+
*
|
|
1243
|
+
* Filesystem layout managed by this service:
|
|
1244
|
+
* ```
|
|
1245
|
+
* {clientsBasePath}/{clientId}/profiles/{name}/
|
|
1246
|
+
* ```
|
|
1247
|
+
*/
|
|
1248
|
+
declare class ClientProfileService extends BaseService {
|
|
1249
|
+
private readonly clientsBasePath;
|
|
1250
|
+
/**
|
|
1251
|
+
* @param bus - Bus instance used for handler registration and storage requests
|
|
1252
|
+
* @param clientsBasePath - Absolute path to the top-level clients directory
|
|
1253
|
+
* (e.g. `~/.makaio/clients/`)
|
|
1254
|
+
*/
|
|
1255
|
+
constructor(bus: IMakaioBus, clientsBasePath: string);
|
|
1256
|
+
/**
|
|
1257
|
+
* Register all `client.profile.*` handlers.
|
|
1258
|
+
*/
|
|
1259
|
+
protected onInit(): Promise<void>;
|
|
1260
|
+
/**
|
|
1261
|
+
* Register the `client.profile.create` handler.
|
|
1262
|
+
*/
|
|
1263
|
+
private registerCreateHandler;
|
|
1264
|
+
/**
|
|
1265
|
+
* Register the `client.profile.list` handler.
|
|
1266
|
+
*/
|
|
1267
|
+
private registerListHandler;
|
|
1268
|
+
/**
|
|
1269
|
+
* Register the `client.profile.get` handler.
|
|
1270
|
+
*/
|
|
1271
|
+
private registerGetHandler;
|
|
1272
|
+
/**
|
|
1273
|
+
* Register the `client.profile.update` handler.
|
|
1274
|
+
*/
|
|
1275
|
+
private registerUpdateHandler;
|
|
1276
|
+
/**
|
|
1277
|
+
* Register the `client.profile.delete` handler.
|
|
1278
|
+
*/
|
|
1279
|
+
private registerDeleteHandler;
|
|
1280
|
+
/**
|
|
1281
|
+
* Register the `client.profile.setDefault` handler.
|
|
1282
|
+
*/
|
|
1283
|
+
private registerSetDefaultHandler;
|
|
1284
|
+
}
|
|
1285
|
+
//#endregion
|
|
1286
|
+
//#region packages/clients-core/src/client-session-config-service.d.ts
|
|
1287
|
+
/**
|
|
1288
|
+
* Handles `client.sessionConfig.*` bus subjects, providing per-session config
|
|
1289
|
+
* directory isolation for client processes.
|
|
1290
|
+
*/
|
|
1291
|
+
declare class ClientSessionConfigService extends BaseService {
|
|
1292
|
+
private readonly clientsBasePath;
|
|
1293
|
+
private readonly getNow;
|
|
1294
|
+
/**
|
|
1295
|
+
* @param bus - Bus instance used for handler registration and storage requests
|
|
1296
|
+
* @param clientsBasePath - Absolute path to the top-level clients directory
|
|
1297
|
+
* (e.g. `~/.makaio/clients/`)
|
|
1298
|
+
* @param getNow - Returns the current Unix epoch in milliseconds; injectable
|
|
1299
|
+
* for deterministic testing (defaults to `Date.now`)
|
|
1300
|
+
*/
|
|
1301
|
+
constructor(bus: IMakaioBus, clientsBasePath: string, getNow?: () => number);
|
|
1302
|
+
/**
|
|
1303
|
+
* Register all `client.sessionConfig.*` handlers and run boot-time cleanup.
|
|
1304
|
+
*/
|
|
1305
|
+
protected onInit(): Promise<void>;
|
|
1306
|
+
/**
|
|
1307
|
+
* Resolve the base configuration directory for a session.
|
|
1308
|
+
*
|
|
1309
|
+
* Resolution order:
|
|
1310
|
+
* 1. Explicit `baseConfigDir` from the request payload.
|
|
1311
|
+
* 2. Named profile's `configDir` looked up via storage.
|
|
1312
|
+
* 3. Default profile's `configDir` when no explicit name was provided.
|
|
1313
|
+
* 4. `sessionDir` — the client-owned setup handler decides the actual source
|
|
1314
|
+
* (e.g. `~/.claude` for Claude Code) when no profile is configured.
|
|
1315
|
+
* @param clientId - Canonicalized stable client identifier
|
|
1316
|
+
* @param sessionDir - Absolute path to the already-created session directory
|
|
1317
|
+
* @param profileName - Optional profile name to look up
|
|
1318
|
+
* @param explicitBaseConfigDir - Caller-supplied override, if any
|
|
1319
|
+
* @returns Resolved absolute path for the base config directory
|
|
1320
|
+
*/
|
|
1321
|
+
private resolveBaseConfigDir;
|
|
1322
|
+
/**
|
|
1323
|
+
* Scan session directories and remove those older than {@link SESSION_MAX_AGE_MS}.
|
|
1324
|
+
*
|
|
1325
|
+
* When `clientId` is supplied only that client's sessions are scanned.
|
|
1326
|
+
* Omit it to clean across all clients.
|
|
1327
|
+
* @param clientId - Optional client ID to scope cleanup
|
|
1328
|
+
* @returns Absolute paths of all directories that were removed
|
|
1329
|
+
*/
|
|
1330
|
+
private cleanupOrphanedDirs;
|
|
1331
|
+
/**
|
|
1332
|
+
* Remove every per-client config directory for a closed framework session.
|
|
1333
|
+
* @param sessionId - Framework session ID from `session.closed`.
|
|
1334
|
+
*/
|
|
1335
|
+
private destroySessionDirsForSessionId;
|
|
1336
|
+
/**
|
|
1337
|
+
* Run client-owned session config teardown before removing the directory.
|
|
1338
|
+
* @param clientId - Canonical client identifier.
|
|
1339
|
+
* @param sessionDir - Absolute session config directory to destroy.
|
|
1340
|
+
*/
|
|
1341
|
+
private destroyClientSessionDir;
|
|
1342
|
+
/**
|
|
1343
|
+
* Check whether a stale-looking directory belongs to a still-active session.
|
|
1344
|
+
* @param sessionId - Session directory name.
|
|
1345
|
+
* @returns `true` when the session registry still marks the session active.
|
|
1346
|
+
*/
|
|
1347
|
+
private isActiveSession;
|
|
1348
|
+
/**
|
|
1349
|
+
* Resolve a session directory for a canonical client ID.
|
|
1350
|
+
* @param clientId - Canonical client identifier.
|
|
1351
|
+
* @param sessionId - Framework session ID.
|
|
1352
|
+
* @param operation - Operation name used in error messages.
|
|
1353
|
+
* @returns Absolute session directory path.
|
|
1354
|
+
*/
|
|
1355
|
+
private resolveClientSessionDir;
|
|
1356
|
+
/**
|
|
1357
|
+
* List all client IDs that currently have a directory under `clientsBasePath`.
|
|
1358
|
+
* @returns Array of directory names (one per client)
|
|
1359
|
+
*/
|
|
1360
|
+
private listClientIds;
|
|
1361
|
+
}
|
|
1362
|
+
//#endregion
|
|
1363
|
+
//#region packages/clients-core/src/client-session-observed-semantics.d.ts
|
|
1364
|
+
/**
|
|
1365
|
+
* Canonical schema for the raw catch-all hook payload delivered on
|
|
1366
|
+
* `client:<id>.hook.received`.
|
|
1367
|
+
*
|
|
1368
|
+
* Client ingress CLIs are dumb bridges: they accept any native hook event and
|
|
1369
|
+
* publish it verbatim on this subject. Downstream normalizers are responsible
|
|
1370
|
+
* for interpreting `eventName` and mapping the `payload` to structured
|
|
1371
|
+
* `client.session.*` observations.
|
|
1372
|
+
*
|
|
1373
|
+
* Fields:
|
|
1374
|
+
* - `eventName` — the hook event name as reported by the client CLI
|
|
1375
|
+
* (e.g. `'PreToolUse'`, `'Stop'`).
|
|
1376
|
+
* - `receivedAt` — Unix epoch timestamp in milliseconds when the bridge
|
|
1377
|
+
* received the hook call.
|
|
1378
|
+
* - `payload` — raw JSON object forwarded verbatim from the client CLI.
|
|
1379
|
+
* - `metadata` — optional pass-through metadata added by the bridge (e.g.
|
|
1380
|
+
* process PID, invocation arguments).
|
|
1381
|
+
*/
|
|
1382
|
+
declare const RawClientHookPayloadSchema: z.ZodObject<{
|
|
1383
|
+
eventName: z.ZodString;
|
|
1384
|
+
receivedAt: z.ZodNumber;
|
|
1385
|
+
payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
1386
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1387
|
+
}, z.core.$strip>;
|
|
1388
|
+
type RawClientHookPayload = z.infer<typeof RawClientHookPayloadSchema>;
|
|
1389
|
+
/**
|
|
1390
|
+
* Normalize user-provided client identifiers to the stable suffix used in
|
|
1391
|
+
* `client:<id>` namespaces.
|
|
1392
|
+
* @param clientId - Raw client identifier, optionally prefixed with `client:`
|
|
1393
|
+
* @param caller - Optional function name used in thrown error messages
|
|
1394
|
+
* @returns Canonical lowercase client identifier without the `client:` prefix
|
|
1395
|
+
*/
|
|
1396
|
+
declare function canonicalizeClientId(clientId: string, caller?: string): string;
|
|
1397
|
+
type RawClientHookSubjectRecord = SubjectRecord<'hook.received', EventMessagePayload<RawClientHookPayload>>;
|
|
1398
|
+
/**
|
|
1399
|
+
* Subject definition for the raw catch-all hook event in a concrete
|
|
1400
|
+
* `client:<id>` namespace.
|
|
1401
|
+
*/
|
|
1402
|
+
type RawClientHookReceivedSubject = SubjectDefinition<RawClientHookSubjectRecord, 'hook.received', `client:${string}`>;
|
|
1403
|
+
/**
|
|
1404
|
+
* Build a non-owning subject definition for `client:<id>.hook.received`.
|
|
1405
|
+
*
|
|
1406
|
+
* This is intentionally not a namespace registration. Concrete client packages
|
|
1407
|
+
* own their full `client:<id>` namespace via {@link createClientNamespace}; the
|
|
1408
|
+
* generic CLI bridge only needs to emit the shared hook subject and must not
|
|
1409
|
+
* accidentally register a narrower namespace before the concrete owner loads.
|
|
1410
|
+
* When the concrete owner is loaded, normal bus schema validation applies. When
|
|
1411
|
+
* it is not loaded, the ad-hoc subject still allows the raw event to traverse
|
|
1412
|
+
* transports to a process that owns the namespace.
|
|
1413
|
+
* @param clientId - Stable client identifier, optionally prefixed with `client:`
|
|
1414
|
+
* @returns Non-owning subject definition for the client's raw hook ingress
|
|
1415
|
+
*/
|
|
1416
|
+
declare function createRawClientHookReceivedSubject(clientId: string): RawClientHookReceivedSubject;
|
|
1417
|
+
/**
|
|
1418
|
+
* Trim and return a string value when non-empty, otherwise `undefined`.
|
|
1419
|
+
*
|
|
1420
|
+
* Primitive building block for normalizers that accept `unknown` values from
|
|
1421
|
+
* raw JSON payloads. Returns `undefined` when the input is not a string, or
|
|
1422
|
+
* is a string that is empty or whitespace-only after trimming.
|
|
1423
|
+
* @param value - Unknown value to inspect.
|
|
1424
|
+
* @returns Trimmed non-empty string, or `undefined`.
|
|
1425
|
+
*/
|
|
1426
|
+
declare function pickNonEmptyStringValue(value: unknown): string | undefined;
|
|
1427
|
+
/**
|
|
1428
|
+
* Extract a non-empty string value from an unknown-typed hook payload object.
|
|
1429
|
+
*
|
|
1430
|
+
* Convenience helper used by client hook normalizers to pick a single key from
|
|
1431
|
+
* a raw JSON payload. Returns `undefined` when the key is absent, not a
|
|
1432
|
+
* string, or an empty string — so callers can use the `?? undefined` pattern
|
|
1433
|
+
* or spread conditionally without additional checks.
|
|
1434
|
+
* @param payload - Raw hook payload object forwarded by the ingress bridge.
|
|
1435
|
+
* @param key - Property key to read.
|
|
1436
|
+
* @returns Non-empty string value, or `undefined` when absent or empty.
|
|
1437
|
+
*/
|
|
1438
|
+
declare function pickNonEmptyString(payload: Record<string, unknown>, key: string): string | undefined;
|
|
1439
|
+
/**
|
|
1440
|
+
* Options for constructing a {@link ClientSessionObservedBase} payload.
|
|
1441
|
+
*/
|
|
1442
|
+
interface BuildClientSessionBaseOpts {
|
|
1443
|
+
/** Stable client identifier (e.g. `'codex'`, `'claude-code'`). */
|
|
1444
|
+
clientId: string;
|
|
1445
|
+
/** Framework session ID, if already resolved at emission time. */
|
|
1446
|
+
sessionId?: string;
|
|
1447
|
+
/** Raw session identifier from the client runtime, if available. */
|
|
1448
|
+
adapterSessionId?: string;
|
|
1449
|
+
}
|
|
1450
|
+
/**
|
|
1451
|
+
* Build a {@link ClientSessionObservedBase} payload for a `client.session.*`
|
|
1452
|
+
* observed-semantics event.
|
|
1453
|
+
*
|
|
1454
|
+
* Always stamps `source: 'adapter-derived'` and `observedAt: Date.now()`.
|
|
1455
|
+
* The optional `sessionId` and `adapterSessionId` fields are omitted when
|
|
1456
|
+
* undefined so Zod validation does not receive explicit `undefined` values.
|
|
1457
|
+
* @param opts - Client and session identifiers for the observation
|
|
1458
|
+
* @returns Base payload ready for emission or spread-extension
|
|
1459
|
+
*/
|
|
1460
|
+
declare function buildClientSessionBase(opts: BuildClientSessionBaseOpts): ClientSessionObservedBase;
|
|
1461
|
+
/**
|
|
1462
|
+
* Execute an async emission thunk best-effort, swallowing any rejection.
|
|
1463
|
+
*
|
|
1464
|
+
* Adapters use this to emit `client.session.*` observed-semantics events
|
|
1465
|
+
* without risking disruption of the core adapter operation when no handler
|
|
1466
|
+
* is registered for the observed-semantics surface.
|
|
1467
|
+
* @param fn - Async emission thunk to execute fire-and-forget
|
|
1468
|
+
*/
|
|
1469
|
+
declare function emitBestEffort(fn: () => Promise<void>): void;
|
|
1470
|
+
//#endregion
|
|
1471
|
+
//#region packages/clients-core/src/create-client-namespace.d.ts
|
|
1472
|
+
/**
|
|
1473
|
+
* Result returned by {@link createClientNamespace}.
|
|
1474
|
+
* @typeParam AdditionalSchemas - Extra subject schemas registered alongside the
|
|
1475
|
+
* shared `hook.received` subject. Defaults to an empty record (no extras).
|
|
1476
|
+
*/
|
|
1477
|
+
interface ClientNamespaceResult<AdditionalSchemas extends SchemaRecord = Record<never, never>> {
|
|
1478
|
+
/**
|
|
1479
|
+
* The fully-qualified bus namespace domain string (e.g. `'client:codex'`).
|
|
1480
|
+
*/
|
|
1481
|
+
readonly namespaceDomain: string;
|
|
1482
|
+
/**
|
|
1483
|
+
* Typed bus subjects for the per-client namespace.
|
|
1484
|
+
*
|
|
1485
|
+
* Always includes `hook.received` for the raw catch-all hook ingress.
|
|
1486
|
+
* When `additionalSchemas` were provided at construction time the extra
|
|
1487
|
+
* subjects are also present here, fully typed.
|
|
1488
|
+
*/
|
|
1489
|
+
readonly subjects: ReturnType<typeof buildClientSubjects<AdditionalSchemas>>;
|
|
1490
|
+
}
|
|
1491
|
+
/**
|
|
1492
|
+
* Build the subjects object for a per-client namespace.
|
|
1493
|
+
*
|
|
1494
|
+
* Extracted to a named generic function so the inferred return type is stable
|
|
1495
|
+
* and can be referenced by {@link ClientNamespaceResult} via instantiation
|
|
1496
|
+
* expressions.
|
|
1497
|
+
* @param clientId - Stable client identifier (e.g. `'codex'`)
|
|
1498
|
+
* @param additionalSchemas - Extra subjects to register alongside `hook.received`
|
|
1499
|
+
* @returns Namespace subjects with `hook.received` plus any additional subjects
|
|
1500
|
+
*/
|
|
1501
|
+
declare function buildClientSubjects<AdditionalSchemas extends SchemaRecord>(clientId: string, additionalSchemas: AdditionalSchemas): _$_makaio_core0.BusSubjects<_$_makaio_core0.FlatSubjectDefinitions<`client:${string}`, {
|
|
1502
|
+
'hook.received': _$zod.ZodObject<{
|
|
1503
|
+
eventName: _$zod.ZodString;
|
|
1504
|
+
receivedAt: _$zod.ZodNumber;
|
|
1505
|
+
payload: _$zod.ZodRecord<_$zod.ZodString, _$zod.ZodUnknown>;
|
|
1506
|
+
metadata: _$zod.ZodOptional<_$zod.ZodRecord<_$zod.ZodString, _$zod.ZodUnknown>>;
|
|
1507
|
+
}, _$zod_v4_core0.$strip>;
|
|
1508
|
+
} & AdditionalSchemas>, `client:${string}`>;
|
|
1509
|
+
/**
|
|
1510
|
+
* Create (or retrieve) the per-client bus namespace for `client:<clientId>`.
|
|
1511
|
+
*
|
|
1512
|
+
* The namespace is registered idempotently — calling this function multiple
|
|
1513
|
+
* times with the same `clientId` returns equivalent subjects.
|
|
1514
|
+
*
|
|
1515
|
+
* The resulting namespace pre-registers the `hook.received` subject so client
|
|
1516
|
+
* ingress bridges have a consistent raw-event ingress point:
|
|
1517
|
+
*
|
|
1518
|
+
* ```ts
|
|
1519
|
+
* // In @makaio/client-codex
|
|
1520
|
+
* export const { subjects: CodexClientSubjects } = createClientNamespace('codex');
|
|
1521
|
+
* // CodexClientSubjects.hook.received → 'client:codex.hook.received'
|
|
1522
|
+
* ```
|
|
1523
|
+
*
|
|
1524
|
+
* Clients that need extra subjects pass them as the second argument:
|
|
1525
|
+
*
|
|
1526
|
+
* ```ts
|
|
1527
|
+
* // In @makaio/client-claude-code
|
|
1528
|
+
* export const { subjects } = createClientNamespace('claude-code', {
|
|
1529
|
+
* 'statusline.received': ClaudeCodeStatuslinePayloadSchema,
|
|
1530
|
+
* });
|
|
1531
|
+
* // subjects.statusline.received → 'client:claude-code.statusline.received'
|
|
1532
|
+
* ```
|
|
1533
|
+
* @param clientId - Stable client identifier (e.g. `'codex'`,
|
|
1534
|
+
* `'claude-code'`), optionally prefixed with `client:`. Canonicalized to
|
|
1535
|
+
* lowercase and restricted to letters, numbers, and hyphens.
|
|
1536
|
+
* @param additionalSchemas - Optional extra subject schemas to register alongside
|
|
1537
|
+
* the shared `hook.received` subject.
|
|
1538
|
+
* @returns Namespace domain string and typed bus subjects.
|
|
1539
|
+
*/
|
|
1540
|
+
declare function createClientNamespace<AdditionalSchemas extends SchemaRecord = Record<never, never>>(clientId: string, additionalSchemas?: AdditionalSchemas): ClientNamespaceResult<AdditionalSchemas>;
|
|
1541
|
+
//#endregion
|
|
1542
|
+
//#region packages/clients-core/src/wiring-schemas.d.ts
|
|
1543
|
+
/**
|
|
1544
|
+
* Non-empty absolute filesystem path.
|
|
1545
|
+
*
|
|
1546
|
+
* Used for `projectDir` across all config and wiring subjects to ensure paths
|
|
1547
|
+
* are not resolved relative to the service process cwd.
|
|
1548
|
+
*/
|
|
1549
|
+
declare const AbsolutePathSchema: z.ZodString;
|
|
1550
|
+
/**
|
|
1551
|
+
* Shared response schema for per-client `wiring.list`.
|
|
1552
|
+
*
|
|
1553
|
+
* Returns all known wiring entries for the requested scope, indicating which
|
|
1554
|
+
* are currently installed.
|
|
1555
|
+
*/
|
|
1556
|
+
declare const ClientWiringListResponseSchema: z.ZodObject<{
|
|
1557
|
+
entries: z.ZodArray<z.ZodObject<{
|
|
1558
|
+
group: z.ZodString;
|
|
1559
|
+
name: z.ZodString;
|
|
1560
|
+
installed: z.ZodBoolean;
|
|
1561
|
+
command: z.ZodString;
|
|
1562
|
+
}, z.core.$strip>>;
|
|
1563
|
+
}, z.core.$strip>;
|
|
1564
|
+
/** Inferred type for {@link ClientWiringListResponseSchema}. */
|
|
1565
|
+
type ClientWiringListResponse = z.infer<typeof ClientWiringListResponseSchema>;
|
|
1566
|
+
/**
|
|
1567
|
+
* Shared response schema for per-client `wiring.apply`.
|
|
1568
|
+
*
|
|
1569
|
+
* Reports how many entries were written and how many were already in place.
|
|
1570
|
+
*/
|
|
1571
|
+
declare const ClientWiringApplyResponseSchema: z.ZodObject<{
|
|
1572
|
+
applied: z.ZodNumber;
|
|
1573
|
+
skipped: z.ZodNumber;
|
|
1574
|
+
}, z.core.$strip>;
|
|
1575
|
+
/** Inferred type for {@link ClientWiringApplyResponseSchema}. */
|
|
1576
|
+
type ClientWiringApplyResponse = z.infer<typeof ClientWiringApplyResponseSchema>;
|
|
1577
|
+
/**
|
|
1578
|
+
* Shared response schema for per-client `wiring.remove`.
|
|
1579
|
+
*
|
|
1580
|
+
* Reports how many entries were removed from the config file.
|
|
1581
|
+
*/
|
|
1582
|
+
declare const ClientWiringRemoveResponseSchema: z.ZodObject<{
|
|
1583
|
+
removed: z.ZodNumber;
|
|
1584
|
+
}, z.core.$strip>;
|
|
1585
|
+
/** Inferred type for {@link ClientWiringRemoveResponseSchema}. */
|
|
1586
|
+
type ClientWiringRemoveResponse = z.infer<typeof ClientWiringRemoveResponseSchema>;
|
|
1587
|
+
/**
|
|
1588
|
+
* A single client's wiring result in the global aggregation response.
|
|
1589
|
+
*
|
|
1590
|
+
* Returned by `client.wiring.list` for each enabled client that responded
|
|
1591
|
+
* to the per-client `wiring.list` bus request.
|
|
1592
|
+
*/
|
|
1593
|
+
declare const ClientWiringAggregatedResultSchema: z.ZodObject<{
|
|
1594
|
+
clientId: z.ZodString;
|
|
1595
|
+
entries: z.ZodArray<z.ZodObject<{
|
|
1596
|
+
group: z.ZodString;
|
|
1597
|
+
name: z.ZodString;
|
|
1598
|
+
installed: z.ZodBoolean;
|
|
1599
|
+
command: z.ZodString;
|
|
1600
|
+
}, z.core.$strip>>;
|
|
1601
|
+
}, z.core.$strip>;
|
|
1602
|
+
/** Inferred type for {@link ClientWiringAggregatedResultSchema}. */
|
|
1603
|
+
type ClientWiringAggregatedResult = z.infer<typeof ClientWiringAggregatedResultSchema>;
|
|
1604
|
+
/**
|
|
1605
|
+
* Assert that `projectDir`, when provided, is an absolute path.
|
|
1606
|
+
*
|
|
1607
|
+
* Prevents relative paths from being resolved against the service process cwd
|
|
1608
|
+
* and causing writes to unintended filesystem locations. Used by per-client
|
|
1609
|
+
* wiring handlers as a runtime guard when bus-layer Zod validation may be
|
|
1610
|
+
* skipped in production.
|
|
1611
|
+
* @param projectDir - Path value from the request payload, or `undefined`.
|
|
1612
|
+
* @throws Error When `projectDir` is defined but not an absolute path.
|
|
1613
|
+
*/
|
|
1614
|
+
declare function assertAbsoluteProjectDir(projectDir: string | undefined): void;
|
|
1615
|
+
//#endregion
|
|
1616
|
+
//#region packages/clients-core/src/create-client-wiring-list-subject.d.ts
|
|
1617
|
+
/** Untyped wiring subject definition returned by {@link createClientWiringSubjectDef}. */
|
|
1618
|
+
interface ClientWiringSubjectDefBase {
|
|
1619
|
+
/** Subject key within the client namespace (e.g. `'wiring.list'`). */
|
|
1620
|
+
subject: string;
|
|
1621
|
+
/** Standard `$meta` applied to all per-client wiring subjects. */
|
|
1622
|
+
$meta: {
|
|
1623
|
+
/** Resolved `client:<id>` namespace for this subject. */namespace: string; /** Always `true` — wiring subjects are request/response pairs. */
|
|
1624
|
+
isRequest: true; /** Always `false` — wiring subjects are not local-only. */
|
|
1625
|
+
local: false; /** Always `false` — wiring subjects are not channels. */
|
|
1626
|
+
channel: false;
|
|
1627
|
+
};
|
|
1628
|
+
}
|
|
1629
|
+
/**
|
|
1630
|
+
* Build a non-owning typed subject definition for any per-client wiring
|
|
1631
|
+
* subject.
|
|
1632
|
+
*
|
|
1633
|
+
* Encapsulates the standard `$meta` structure shared by all
|
|
1634
|
+
* `client:<id>.wiring.*` subjects: `isRequest: true`, `local: false`,
|
|
1635
|
+
* `channel: false`. The `clientId` is canonicalized via
|
|
1636
|
+
* {@link canonicalizeClientId} so callers need not normalize the input.
|
|
1637
|
+
*
|
|
1638
|
+
* This helper returns a plain object — callers cast it to their concrete
|
|
1639
|
+
* {@link SubjectDefinition} type exactly as `createRawClientHookReceivedSubject`
|
|
1640
|
+
* does.
|
|
1641
|
+
* @param clientId - Stable client identifier, optionally prefixed with `client:`.
|
|
1642
|
+
* @param subjectSuffix - Subject key within the namespace (e.g. `'wiring.list'`).
|
|
1643
|
+
* @returns Plain subject definition object ready to be cast to the concrete type.
|
|
1644
|
+
*/
|
|
1645
|
+
declare function createClientWiringSubjectDef(clientId: string, subjectSuffix: string): ClientWiringSubjectDefBase;
|
|
1646
|
+
/**
|
|
1647
|
+
* Typed payload for the per-client `wiring.list` request/response pair.
|
|
1648
|
+
*
|
|
1649
|
+
* The request accepts an optional `projectDir` and `makaioCommand` — the
|
|
1650
|
+
* same optional filtering fields supported by all known client wiring
|
|
1651
|
+
* implementations. The response carries an `entries` array.
|
|
1652
|
+
*/
|
|
1653
|
+
type ClientWiringListPayload = RequestMessagePayload<{
|
|
1654
|
+
projectDir?: string;
|
|
1655
|
+
makaioCommand: string;
|
|
1656
|
+
}, {
|
|
1657
|
+
entries: ClientWiringEntry[];
|
|
1658
|
+
}>;
|
|
1659
|
+
type ClientWiringListSubjectRecord = SubjectRecord<'wiring.list', ClientWiringListPayload>;
|
|
1660
|
+
/**
|
|
1661
|
+
* Non-owning typed {@link SubjectDefinition} for `client:<id>.wiring.list`.
|
|
1662
|
+
*/
|
|
1663
|
+
type ClientWiringListSubjectDef = SubjectDefinition<ClientWiringListSubjectRecord, 'wiring.list', `client:${string}`>;
|
|
1664
|
+
/**
|
|
1665
|
+
* Build a non-owning typed {@link SubjectDefinition} for
|
|
1666
|
+
* `client:<clientId>.wiring.list`.
|
|
1667
|
+
*
|
|
1668
|
+
* This is intentionally **not** a namespace registration. Concrete client
|
|
1669
|
+
* packages own their full `client:<id>` namespace; the aggregator only needs
|
|
1670
|
+
* to dispatch the list request without registering a conflicting namespace.
|
|
1671
|
+
* When the concrete owner is loaded, normal bus schema validation applies;
|
|
1672
|
+
* when it is not, the ad-hoc subject still dispatches locally.
|
|
1673
|
+
* @param clientId - Stable client identifier (e.g. `'claude-code'`,
|
|
1674
|
+
* `'codex'`), optionally prefixed with `client:`.
|
|
1675
|
+
* @returns Non-owning typed subject definition for the per-client wiring list.
|
|
1676
|
+
*/
|
|
1677
|
+
declare function createClientWiringListSubjectDef(clientId: string): ClientWiringListSubjectDef;
|
|
1678
|
+
//#endregion
|
|
1679
|
+
//#region packages/clients-core/src/package.d.ts
|
|
1680
|
+
/**
|
|
1681
|
+
* Composite service that initialises and destroys the
|
|
1682
|
+
* {@link ClientRuntimeService}, the {@link ClientBinaryManager}, the
|
|
1683
|
+
* {@link ClientProfileService}, and the {@link ClientSessionConfigService}
|
|
1684
|
+
* under a single {@link ExtensionServiceLifecycle} handle.
|
|
1685
|
+
*
|
|
1686
|
+
* The host coordinator calls `init()` once and `destroy()` once; this class
|
|
1687
|
+
* ensures all four services participate in the same lifecycle without any
|
|
1688
|
+
* requiring knowledge of the others.
|
|
1689
|
+
*/
|
|
1690
|
+
declare class ClientsCoreService implements ExtensionServiceLifecycle {
|
|
1691
|
+
private readonly runtimeService;
|
|
1692
|
+
private readonly binaryManager;
|
|
1693
|
+
private readonly profileService;
|
|
1694
|
+
private readonly sessionConfigService;
|
|
1695
|
+
/**
|
|
1696
|
+
* @param runtimeService - Handles `client.*` runtime observation subjects
|
|
1697
|
+
* @param binaryManager - Handles `client.*` binary-management subjects
|
|
1698
|
+
* @param profileService - Handles `client.profile.*` CRUD subjects
|
|
1699
|
+
* @param sessionConfigService - Handles `client.sessionConfig.*` isolation subjects
|
|
1700
|
+
*/
|
|
1701
|
+
constructor(runtimeService: ClientRuntimeService, binaryManager: ClientBinaryManager, profileService: ClientProfileService, sessionConfigService: ClientSessionConfigService);
|
|
1702
|
+
/**
|
|
1703
|
+
* Initialize all four sub-services in parallel.
|
|
1704
|
+
*
|
|
1705
|
+
* Uses {@link Promise.allSettled} so every service always attempts
|
|
1706
|
+
* initialisation — matching the resilience pattern used by {@link destroy}.
|
|
1707
|
+
* If any service fails, the first rejection is re-thrown after all attempts
|
|
1708
|
+
* have settled. Secondary failures are logged for observability.
|
|
1709
|
+
*/
|
|
1710
|
+
init(): Promise<void>;
|
|
1711
|
+
/**
|
|
1712
|
+
* Destroy all four sub-services in parallel.
|
|
1713
|
+
*
|
|
1714
|
+
* Uses {@link Promise.allSettled} to guarantee every cleanup runs even when
|
|
1715
|
+
* one rejects. Any rejections are logged for observability — matching the
|
|
1716
|
+
* secondary-failure logging pattern used by {@link init}.
|
|
1717
|
+
*/
|
|
1718
|
+
destroy(): Promise<void>;
|
|
1719
|
+
}
|
|
1720
|
+
/** Typed package token for retrieving the clients-core service. */
|
|
1721
|
+
declare const ClientsCoreToken: _$_makaio_contracts0.ExtensionToken<ClientsCoreService>;
|
|
1722
|
+
/**
|
|
1723
|
+
* Options accepted by {@link createClientsCorePackage}.
|
|
1724
|
+
*
|
|
1725
|
+
* Definitions supplied here are seeded into a {@link ClientDefinitionRegistry}
|
|
1726
|
+
* at construction time, before the coordinator calls `init()` on the returned
|
|
1727
|
+
* service. All definitions must be available before `init()` runs — there is
|
|
1728
|
+
* no post-start mutation path on the service surface.
|
|
1729
|
+
*/
|
|
1730
|
+
interface ClientsCorePackageOptions {
|
|
1731
|
+
/**
|
|
1732
|
+
* Client definitions to register before service initialisation.
|
|
1733
|
+
*
|
|
1734
|
+
* Typically populated by the boot composition root from discovered client
|
|
1735
|
+
* packages via `loadMakaioExtensions` before calling `coordinator.load`.
|
|
1736
|
+
*/
|
|
1737
|
+
readonly definitions?: readonly ClientDefinition[];
|
|
1738
|
+
/**
|
|
1739
|
+
* I/O dependency implementations for the binary install strategies.
|
|
1740
|
+
*
|
|
1741
|
+
* When omitted the manager uses a no-op implementation that throws on every
|
|
1742
|
+
* call — correct for framework-only test callers that do not exercise binary
|
|
1743
|
+
* management, but must be replaced before binary installation is functional.
|
|
1744
|
+
*
|
|
1745
|
+
* Host composition roots pass their concrete strategy dependency
|
|
1746
|
+
* implementation here on real boot paths.
|
|
1747
|
+
*/
|
|
1748
|
+
readonly strategyDependencies?: StrategyDependencies;
|
|
1749
|
+
/**
|
|
1750
|
+
* Framework-owned handlers for declarative post-install descriptors.
|
|
1751
|
+
*
|
|
1752
|
+
* Client packages declare `postInstall.kind`; the host supplies the handler
|
|
1753
|
+
* implementation here. Missing handlers fail the install job rather than
|
|
1754
|
+
* silently skipping a declared lifecycle step.
|
|
1755
|
+
*
|
|
1756
|
+
* When omitted no post-install handlers are registered.
|
|
1757
|
+
*/
|
|
1758
|
+
readonly postInstallHandlers?: ReadonlyMap<string, PostInstallHandler>;
|
|
1759
|
+
}
|
|
1760
|
+
/**
|
|
1761
|
+
* Run storage handler registrations and return one cleanup that unwinds every
|
|
1762
|
+
* successful registration in reverse order.
|
|
1763
|
+
*
|
|
1764
|
+
* If any registration throws, previously registered handlers are immediately
|
|
1765
|
+
* rolled back so package startup remains retry-safe.
|
|
1766
|
+
* @param registrations - Ordered storage registration callbacks
|
|
1767
|
+
* @returns Cleanup function for all successful registrations
|
|
1768
|
+
*/
|
|
1769
|
+
declare function registerStorageHandlersWithRollback(registrations: ReadonlyArray<() => () => void>): () => void;
|
|
1770
|
+
/**
|
|
1771
|
+
* Create the MakaioExtension manifest for the in-memory client runtime service
|
|
1772
|
+
* and the client binary manager.
|
|
1773
|
+
*
|
|
1774
|
+
* `@makaio/runtime-node` calls this factory after loading client packages and passes
|
|
1775
|
+
* the resulting manifest to the extension coordinator. Definitions supplied
|
|
1776
|
+
* via {@link ClientsCorePackageOptions.definitions} are seeded into a
|
|
1777
|
+
* {@link ClientDefinitionRegistry} before `init()` runs, so
|
|
1778
|
+
* `client.list` returns managed clients immediately after service startup.
|
|
1779
|
+
* @example
|
|
1780
|
+
* ```ts
|
|
1781
|
+
* const clientPackages = await loadMakaioExtensions(discoveredClients, { importModule });
|
|
1782
|
+
* const pkg = createClientsCorePackage({
|
|
1783
|
+
* definitions: clientPackages.flatMap((p) => p.clients ?? []),
|
|
1784
|
+
* });
|
|
1785
|
+
* coordinator.load([pkg, ...otherPackages], configDefaults);
|
|
1786
|
+
* await coordinator.startAll();
|
|
1787
|
+
* ```
|
|
1788
|
+
* @param options - Package options including pre-seeded client definitions,
|
|
1789
|
+
* strategy I/O dependencies, and post-install handlers
|
|
1790
|
+
* @returns Configured MakaioExtension manifest
|
|
1791
|
+
*/
|
|
1792
|
+
declare function createClientsCorePackage(options?: ClientsCorePackageOptions): MakaioNodeExtension<IMakaioBus>;
|
|
1793
|
+
//#endregion
|
|
1794
|
+
//#region packages/clients-core/src/storage/client-binary-storage-namespace.d.ts
|
|
1795
|
+
/**
|
|
1796
|
+
* Zod schema for a persisted installed-version record transported over the bus.
|
|
1797
|
+
*/
|
|
1798
|
+
declare const ClientBinaryVersionRecordSchema: z.ZodObject<{
|
|
1799
|
+
id: z.ZodString;
|
|
1800
|
+
clientId: z.ZodString;
|
|
1801
|
+
version: z.ZodString;
|
|
1802
|
+
installPath: z.ZodString;
|
|
1803
|
+
installedAt: z.ZodNumber;
|
|
1804
|
+
createdAt: z.ZodNumber;
|
|
1805
|
+
}, z.core.$strip>;
|
|
1806
|
+
/**
|
|
1807
|
+
* Zod schema for the per-client binary state record transported over the bus.
|
|
1808
|
+
*/
|
|
1809
|
+
declare const ClientBinaryStateRecordSchema: z.ZodObject<{
|
|
1810
|
+
clientId: z.ZodString;
|
|
1811
|
+
activeVersion: z.ZodNullable<z.ZodString>;
|
|
1812
|
+
latestAvailableVersion: z.ZodNullable<z.ZodString>;
|
|
1813
|
+
latestVersionLastCheckedAt: z.ZodNullable<z.ZodNumber>;
|
|
1814
|
+
latestVersionSourceStatus: z.ZodEnum<{
|
|
1815
|
+
error: "error";
|
|
1816
|
+
fresh: "fresh";
|
|
1817
|
+
cached: "cached";
|
|
1818
|
+
}>;
|
|
1819
|
+
updatedAt: z.ZodNumber;
|
|
1820
|
+
}, z.core.$strip>;
|
|
1821
|
+
/**
|
|
1822
|
+
* Internal bus namespace for client binary storage operations.
|
|
1823
|
+
*
|
|
1824
|
+
* Subjects registered here are consumed exclusively by the Drizzle handler
|
|
1825
|
+
* and the binary manager — they are not part of the public `client.*` namespace.
|
|
1826
|
+
*/
|
|
1827
|
+
declare const ClientBinaryStorageNamespace: _$_makaio_core0.BusNamespaceDefinition<"client-binary:storage", {
|
|
1828
|
+
/** Insert a new installed-version row. */insertVersion: {
|
|
1829
|
+
request: z.ZodObject<{
|
|
1830
|
+
id: z.ZodString;
|
|
1831
|
+
clientId: z.ZodString;
|
|
1832
|
+
version: z.ZodString;
|
|
1833
|
+
installPath: z.ZodString;
|
|
1834
|
+
installedAt: z.ZodNumber;
|
|
1835
|
+
createdAt: z.ZodNumber;
|
|
1836
|
+
}, z.core.$strip>;
|
|
1837
|
+
response: z.ZodObject<{
|
|
1838
|
+
success: z.ZodBoolean;
|
|
1839
|
+
}, z.core.$strip>;
|
|
1840
|
+
};
|
|
1841
|
+
/**
|
|
1842
|
+
* Atomically record an installed version and optionally mark it active.
|
|
1843
|
+
*
|
|
1844
|
+
* Used by successful install/update jobs so storage never commits a version
|
|
1845
|
+
* row without the requested active pointer update.
|
|
1846
|
+
*/
|
|
1847
|
+
recordInstalledVersion: {
|
|
1848
|
+
request: z.ZodObject<{
|
|
1849
|
+
versionRecord: z.ZodObject<{
|
|
1850
|
+
id: z.ZodString;
|
|
1851
|
+
clientId: z.ZodString;
|
|
1852
|
+
version: z.ZodString;
|
|
1853
|
+
installPath: z.ZodString;
|
|
1854
|
+
installedAt: z.ZodNumber;
|
|
1855
|
+
createdAt: z.ZodNumber;
|
|
1856
|
+
}, z.core.$strip>;
|
|
1857
|
+
makeActive: z.ZodBoolean;
|
|
1858
|
+
updatedAt: z.ZodNumber;
|
|
1859
|
+
}, z.core.$strip>;
|
|
1860
|
+
response: z.ZodObject<{
|
|
1861
|
+
previousActiveVersion: z.ZodNullable<z.ZodString>;
|
|
1862
|
+
activeVersion: z.ZodNullable<z.ZodString>;
|
|
1863
|
+
}, z.core.$strip>;
|
|
1864
|
+
}; /** Return all installed-version rows for a given client. */
|
|
1865
|
+
listVersions: {
|
|
1866
|
+
request: z.ZodObject<{
|
|
1867
|
+
clientId: z.ZodString;
|
|
1868
|
+
}, z.core.$strip>;
|
|
1869
|
+
response: z.ZodObject<{
|
|
1870
|
+
versions: z.ZodArray<z.ZodObject<{
|
|
1871
|
+
id: z.ZodString;
|
|
1872
|
+
clientId: z.ZodString;
|
|
1873
|
+
version: z.ZodString;
|
|
1874
|
+
installPath: z.ZodString;
|
|
1875
|
+
installedAt: z.ZodNumber;
|
|
1876
|
+
createdAt: z.ZodNumber;
|
|
1877
|
+
}, z.core.$strip>>;
|
|
1878
|
+
}, z.core.$strip>;
|
|
1879
|
+
};
|
|
1880
|
+
/**
|
|
1881
|
+
* Return a single-client state + installed-version snapshot from one storage
|
|
1882
|
+
* read boundary.
|
|
1883
|
+
*/
|
|
1884
|
+
getSnapshot: {
|
|
1885
|
+
request: z.ZodObject<{
|
|
1886
|
+
clientId: z.ZodString;
|
|
1887
|
+
}, z.core.$strip>;
|
|
1888
|
+
response: z.ZodObject<{
|
|
1889
|
+
state: z.ZodNullable<z.ZodObject<{
|
|
1890
|
+
clientId: z.ZodString;
|
|
1891
|
+
activeVersion: z.ZodNullable<z.ZodString>;
|
|
1892
|
+
latestAvailableVersion: z.ZodNullable<z.ZodString>;
|
|
1893
|
+
latestVersionLastCheckedAt: z.ZodNullable<z.ZodNumber>;
|
|
1894
|
+
latestVersionSourceStatus: z.ZodEnum<{
|
|
1895
|
+
error: "error";
|
|
1896
|
+
fresh: "fresh";
|
|
1897
|
+
cached: "cached";
|
|
1898
|
+
}>;
|
|
1899
|
+
updatedAt: z.ZodNumber;
|
|
1900
|
+
}, z.core.$strip>>;
|
|
1901
|
+
versions: z.ZodArray<z.ZodObject<{
|
|
1902
|
+
id: z.ZodString;
|
|
1903
|
+
clientId: z.ZodString;
|
|
1904
|
+
version: z.ZodString;
|
|
1905
|
+
installPath: z.ZodString;
|
|
1906
|
+
installedAt: z.ZodNumber;
|
|
1907
|
+
createdAt: z.ZodNumber;
|
|
1908
|
+
}, z.core.$strip>>;
|
|
1909
|
+
}, z.core.$strip>;
|
|
1910
|
+
}; /** Return all installed-version rows across every client (used for boot hydration). */
|
|
1911
|
+
loadAllVersions: {
|
|
1912
|
+
request: z.ZodObject<{}, z.core.$strip>;
|
|
1913
|
+
response: z.ZodObject<{
|
|
1914
|
+
versions: z.ZodArray<z.ZodObject<{
|
|
1915
|
+
id: z.ZodString;
|
|
1916
|
+
clientId: z.ZodString;
|
|
1917
|
+
version: z.ZodString;
|
|
1918
|
+
installPath: z.ZodString;
|
|
1919
|
+
installedAt: z.ZodNumber;
|
|
1920
|
+
createdAt: z.ZodNumber;
|
|
1921
|
+
}, z.core.$strip>>;
|
|
1922
|
+
}, z.core.$strip>;
|
|
1923
|
+
}; /** Upsert the per-client binary state row (active version + feed cache). */
|
|
1924
|
+
upsertState: {
|
|
1925
|
+
request: z.ZodObject<{
|
|
1926
|
+
clientId: z.ZodString;
|
|
1927
|
+
activeVersion: z.ZodNullable<z.ZodString>;
|
|
1928
|
+
latestAvailableVersion: z.ZodNullable<z.ZodString>;
|
|
1929
|
+
latestVersionLastCheckedAt: z.ZodNullable<z.ZodNumber>;
|
|
1930
|
+
latestVersionSourceStatus: z.ZodEnum<{
|
|
1931
|
+
error: "error";
|
|
1932
|
+
fresh: "fresh";
|
|
1933
|
+
cached: "cached";
|
|
1934
|
+
}>;
|
|
1935
|
+
updatedAt: z.ZodNumber;
|
|
1936
|
+
}, z.core.$strip>;
|
|
1937
|
+
response: z.ZodObject<{
|
|
1938
|
+
success: z.ZodBoolean;
|
|
1939
|
+
}, z.core.$strip>;
|
|
1940
|
+
};
|
|
1941
|
+
/**
|
|
1942
|
+
* Set the active version without touching feed-cache fields.
|
|
1943
|
+
*
|
|
1944
|
+
* Creates a minimal state row when one does not exist yet.
|
|
1945
|
+
*/
|
|
1946
|
+
setActiveVersion: {
|
|
1947
|
+
request: z.ZodObject<{
|
|
1948
|
+
clientId: z.ZodString;
|
|
1949
|
+
activeVersion: z.ZodNullable<z.ZodString>;
|
|
1950
|
+
updatedAt: z.ZodNumber;
|
|
1951
|
+
}, z.core.$strip>;
|
|
1952
|
+
response: z.ZodObject<{
|
|
1953
|
+
previousActiveVersion: z.ZodNullable<z.ZodString>;
|
|
1954
|
+
activeVersion: z.ZodNullable<z.ZodString>;
|
|
1955
|
+
}, z.core.$strip>;
|
|
1956
|
+
}; /** Return the per-client binary state row, or `null` when it does not exist. */
|
|
1957
|
+
getState: {
|
|
1958
|
+
request: z.ZodObject<{
|
|
1959
|
+
clientId: z.ZodString;
|
|
1960
|
+
}, z.core.$strip>;
|
|
1961
|
+
response: z.ZodObject<{
|
|
1962
|
+
state: z.ZodNullable<z.ZodObject<{
|
|
1963
|
+
clientId: z.ZodString;
|
|
1964
|
+
activeVersion: z.ZodNullable<z.ZodString>;
|
|
1965
|
+
latestAvailableVersion: z.ZodNullable<z.ZodString>;
|
|
1966
|
+
latestVersionLastCheckedAt: z.ZodNullable<z.ZodNumber>;
|
|
1967
|
+
latestVersionSourceStatus: z.ZodEnum<{
|
|
1968
|
+
error: "error";
|
|
1969
|
+
fresh: "fresh";
|
|
1970
|
+
cached: "cached";
|
|
1971
|
+
}>;
|
|
1972
|
+
updatedAt: z.ZodNumber;
|
|
1973
|
+
}, z.core.$strip>>;
|
|
1974
|
+
}, z.core.$strip>;
|
|
1975
|
+
}; /** Return the state rows for all clients (used for boot hydration). */
|
|
1976
|
+
loadAllState: {
|
|
1977
|
+
request: z.ZodObject<{}, z.core.$strip>;
|
|
1978
|
+
response: z.ZodObject<{
|
|
1979
|
+
states: z.ZodArray<z.ZodObject<{
|
|
1980
|
+
clientId: z.ZodString;
|
|
1981
|
+
activeVersion: z.ZodNullable<z.ZodString>;
|
|
1982
|
+
latestAvailableVersion: z.ZodNullable<z.ZodString>;
|
|
1983
|
+
latestVersionLastCheckedAt: z.ZodNullable<z.ZodNumber>;
|
|
1984
|
+
latestVersionSourceStatus: z.ZodEnum<{
|
|
1985
|
+
error: "error";
|
|
1986
|
+
fresh: "fresh";
|
|
1987
|
+
cached: "cached";
|
|
1988
|
+
}>;
|
|
1989
|
+
updatedAt: z.ZodNumber;
|
|
1990
|
+
}, z.core.$strip>>;
|
|
1991
|
+
}, z.core.$strip>;
|
|
1992
|
+
}; /** Return all state and installed-version rows from one storage read boundary. */
|
|
1993
|
+
loadSnapshot: {
|
|
1994
|
+
request: z.ZodObject<{}, z.core.$strip>;
|
|
1995
|
+
response: z.ZodObject<{
|
|
1996
|
+
states: z.ZodArray<z.ZodObject<{
|
|
1997
|
+
clientId: z.ZodString;
|
|
1998
|
+
activeVersion: z.ZodNullable<z.ZodString>;
|
|
1999
|
+
latestAvailableVersion: z.ZodNullable<z.ZodString>;
|
|
2000
|
+
latestVersionLastCheckedAt: z.ZodNullable<z.ZodNumber>;
|
|
2001
|
+
latestVersionSourceStatus: z.ZodEnum<{
|
|
2002
|
+
error: "error";
|
|
2003
|
+
fresh: "fresh";
|
|
2004
|
+
cached: "cached";
|
|
2005
|
+
}>;
|
|
2006
|
+
updatedAt: z.ZodNumber;
|
|
2007
|
+
}, z.core.$strip>>;
|
|
2008
|
+
versions: z.ZodArray<z.ZodObject<{
|
|
2009
|
+
id: z.ZodString;
|
|
2010
|
+
clientId: z.ZodString;
|
|
2011
|
+
version: z.ZodString;
|
|
2012
|
+
installPath: z.ZodString;
|
|
2013
|
+
installedAt: z.ZodNumber;
|
|
2014
|
+
createdAt: z.ZodNumber;
|
|
2015
|
+
}, z.core.$strip>>;
|
|
2016
|
+
}, z.core.$strip>;
|
|
2017
|
+
};
|
|
2018
|
+
/**
|
|
2019
|
+
* Persist an updated feed-cache entry for a client.
|
|
2020
|
+
*
|
|
2021
|
+
* This is a subset of `upsertState` — the handler merges the feed fields
|
|
2022
|
+
* into the existing row (or creates a minimal row) without touching
|
|
2023
|
+
* `activeVersion`.
|
|
2024
|
+
*/
|
|
2025
|
+
updateFeedCache: {
|
|
2026
|
+
request: z.ZodObject<{
|
|
2027
|
+
clientId: z.ZodString;
|
|
2028
|
+
latestAvailableVersion: z.ZodNullable<z.ZodString>;
|
|
2029
|
+
latestVersionLastCheckedAt: z.ZodNullable<z.ZodNumber>;
|
|
2030
|
+
latestVersionSourceStatus: z.ZodEnum<{
|
|
2031
|
+
error: "error";
|
|
2032
|
+
fresh: "fresh";
|
|
2033
|
+
cached: "cached";
|
|
2034
|
+
}>;
|
|
2035
|
+
updatedAt: z.ZodNumber;
|
|
2036
|
+
}, z.core.$strip>;
|
|
2037
|
+
response: z.ZodObject<{
|
|
2038
|
+
success: z.ZodBoolean;
|
|
2039
|
+
}, z.core.$strip>;
|
|
2040
|
+
};
|
|
2041
|
+
/**
|
|
2042
|
+
* Atomically remove an installed-version row and clear the active-version
|
|
2043
|
+
* pointer when it currently points to the deleted version.
|
|
2044
|
+
*
|
|
2045
|
+
* Both operations are executed inside a single SQLite transaction so that
|
|
2046
|
+
* concurrent reads never observe a state where the version row is absent but
|
|
2047
|
+
* the active pointer still references it.
|
|
2048
|
+
*/
|
|
2049
|
+
removeVersionAndClearActive: {
|
|
2050
|
+
request: z.ZodObject<{
|
|
2051
|
+
clientId: z.ZodString;
|
|
2052
|
+
version: z.ZodString;
|
|
2053
|
+
updatedAt: z.ZodNumber;
|
|
2054
|
+
}, z.core.$strip>;
|
|
2055
|
+
response: z.ZodObject<{
|
|
2056
|
+
previousActiveVersion: z.ZodNullable<z.ZodString>;
|
|
2057
|
+
activeVersion: z.ZodNullable<z.ZodString>;
|
|
2058
|
+
removedVersion: z.ZodNullable<z.ZodString>;
|
|
2059
|
+
}, z.core.$strip>;
|
|
2060
|
+
};
|
|
2061
|
+
}>;
|
|
2062
|
+
/** Typed bus subjects for client binary storage. */
|
|
2063
|
+
declare const ClientBinaryStorageSubjects: _$_makaio_core0.BusSubjects<_$_makaio_core0.FlatSubjectDefinitions<"client-binary:storage", {
|
|
2064
|
+
/** Insert a new installed-version row. */insertVersion: {
|
|
2065
|
+
request: z.ZodObject<{
|
|
2066
|
+
id: z.ZodString;
|
|
2067
|
+
clientId: z.ZodString;
|
|
2068
|
+
version: z.ZodString;
|
|
2069
|
+
installPath: z.ZodString;
|
|
2070
|
+
installedAt: z.ZodNumber;
|
|
2071
|
+
createdAt: z.ZodNumber;
|
|
2072
|
+
}, z.core.$strip>;
|
|
2073
|
+
response: z.ZodObject<{
|
|
2074
|
+
success: z.ZodBoolean;
|
|
2075
|
+
}, z.core.$strip>;
|
|
2076
|
+
};
|
|
2077
|
+
/**
|
|
2078
|
+
* Atomically record an installed version and optionally mark it active.
|
|
2079
|
+
*
|
|
2080
|
+
* Used by successful install/update jobs so storage never commits a version
|
|
2081
|
+
* row without the requested active pointer update.
|
|
2082
|
+
*/
|
|
2083
|
+
recordInstalledVersion: {
|
|
2084
|
+
request: z.ZodObject<{
|
|
2085
|
+
versionRecord: z.ZodObject<{
|
|
2086
|
+
id: z.ZodString;
|
|
2087
|
+
clientId: z.ZodString;
|
|
2088
|
+
version: z.ZodString;
|
|
2089
|
+
installPath: z.ZodString;
|
|
2090
|
+
installedAt: z.ZodNumber;
|
|
2091
|
+
createdAt: z.ZodNumber;
|
|
2092
|
+
}, z.core.$strip>;
|
|
2093
|
+
makeActive: z.ZodBoolean;
|
|
2094
|
+
updatedAt: z.ZodNumber;
|
|
2095
|
+
}, z.core.$strip>;
|
|
2096
|
+
response: z.ZodObject<{
|
|
2097
|
+
previousActiveVersion: z.ZodNullable<z.ZodString>;
|
|
2098
|
+
activeVersion: z.ZodNullable<z.ZodString>;
|
|
2099
|
+
}, z.core.$strip>;
|
|
2100
|
+
}; /** Return all installed-version rows for a given client. */
|
|
2101
|
+
listVersions: {
|
|
2102
|
+
request: z.ZodObject<{
|
|
2103
|
+
clientId: z.ZodString;
|
|
2104
|
+
}, z.core.$strip>;
|
|
2105
|
+
response: z.ZodObject<{
|
|
2106
|
+
versions: z.ZodArray<z.ZodObject<{
|
|
2107
|
+
id: z.ZodString;
|
|
2108
|
+
clientId: z.ZodString;
|
|
2109
|
+
version: z.ZodString;
|
|
2110
|
+
installPath: z.ZodString;
|
|
2111
|
+
installedAt: z.ZodNumber;
|
|
2112
|
+
createdAt: z.ZodNumber;
|
|
2113
|
+
}, z.core.$strip>>;
|
|
2114
|
+
}, z.core.$strip>;
|
|
2115
|
+
};
|
|
2116
|
+
/**
|
|
2117
|
+
* Return a single-client state + installed-version snapshot from one storage
|
|
2118
|
+
* read boundary.
|
|
2119
|
+
*/
|
|
2120
|
+
getSnapshot: {
|
|
2121
|
+
request: z.ZodObject<{
|
|
2122
|
+
clientId: z.ZodString;
|
|
2123
|
+
}, z.core.$strip>;
|
|
2124
|
+
response: z.ZodObject<{
|
|
2125
|
+
state: z.ZodNullable<z.ZodObject<{
|
|
2126
|
+
clientId: z.ZodString;
|
|
2127
|
+
activeVersion: z.ZodNullable<z.ZodString>;
|
|
2128
|
+
latestAvailableVersion: z.ZodNullable<z.ZodString>;
|
|
2129
|
+
latestVersionLastCheckedAt: z.ZodNullable<z.ZodNumber>;
|
|
2130
|
+
latestVersionSourceStatus: z.ZodEnum<{
|
|
2131
|
+
error: "error";
|
|
2132
|
+
fresh: "fresh";
|
|
2133
|
+
cached: "cached";
|
|
2134
|
+
}>;
|
|
2135
|
+
updatedAt: z.ZodNumber;
|
|
2136
|
+
}, z.core.$strip>>;
|
|
2137
|
+
versions: z.ZodArray<z.ZodObject<{
|
|
2138
|
+
id: z.ZodString;
|
|
2139
|
+
clientId: z.ZodString;
|
|
2140
|
+
version: z.ZodString;
|
|
2141
|
+
installPath: z.ZodString;
|
|
2142
|
+
installedAt: z.ZodNumber;
|
|
2143
|
+
createdAt: z.ZodNumber;
|
|
2144
|
+
}, z.core.$strip>>;
|
|
2145
|
+
}, z.core.$strip>;
|
|
2146
|
+
}; /** Return all installed-version rows across every client (used for boot hydration). */
|
|
2147
|
+
loadAllVersions: {
|
|
2148
|
+
request: z.ZodObject<{}, z.core.$strip>;
|
|
2149
|
+
response: z.ZodObject<{
|
|
2150
|
+
versions: z.ZodArray<z.ZodObject<{
|
|
2151
|
+
id: z.ZodString;
|
|
2152
|
+
clientId: z.ZodString;
|
|
2153
|
+
version: z.ZodString;
|
|
2154
|
+
installPath: z.ZodString;
|
|
2155
|
+
installedAt: z.ZodNumber;
|
|
2156
|
+
createdAt: z.ZodNumber;
|
|
2157
|
+
}, z.core.$strip>>;
|
|
2158
|
+
}, z.core.$strip>;
|
|
2159
|
+
}; /** Upsert the per-client binary state row (active version + feed cache). */
|
|
2160
|
+
upsertState: {
|
|
2161
|
+
request: z.ZodObject<{
|
|
2162
|
+
clientId: z.ZodString;
|
|
2163
|
+
activeVersion: z.ZodNullable<z.ZodString>;
|
|
2164
|
+
latestAvailableVersion: z.ZodNullable<z.ZodString>;
|
|
2165
|
+
latestVersionLastCheckedAt: z.ZodNullable<z.ZodNumber>;
|
|
2166
|
+
latestVersionSourceStatus: z.ZodEnum<{
|
|
2167
|
+
error: "error";
|
|
2168
|
+
fresh: "fresh";
|
|
2169
|
+
cached: "cached";
|
|
2170
|
+
}>;
|
|
2171
|
+
updatedAt: z.ZodNumber;
|
|
2172
|
+
}, z.core.$strip>;
|
|
2173
|
+
response: z.ZodObject<{
|
|
2174
|
+
success: z.ZodBoolean;
|
|
2175
|
+
}, z.core.$strip>;
|
|
2176
|
+
};
|
|
2177
|
+
/**
|
|
2178
|
+
* Set the active version without touching feed-cache fields.
|
|
2179
|
+
*
|
|
2180
|
+
* Creates a minimal state row when one does not exist yet.
|
|
2181
|
+
*/
|
|
2182
|
+
setActiveVersion: {
|
|
2183
|
+
request: z.ZodObject<{
|
|
2184
|
+
clientId: z.ZodString;
|
|
2185
|
+
activeVersion: z.ZodNullable<z.ZodString>;
|
|
2186
|
+
updatedAt: z.ZodNumber;
|
|
2187
|
+
}, z.core.$strip>;
|
|
2188
|
+
response: z.ZodObject<{
|
|
2189
|
+
previousActiveVersion: z.ZodNullable<z.ZodString>;
|
|
2190
|
+
activeVersion: z.ZodNullable<z.ZodString>;
|
|
2191
|
+
}, z.core.$strip>;
|
|
2192
|
+
}; /** Return the per-client binary state row, or `null` when it does not exist. */
|
|
2193
|
+
getState: {
|
|
2194
|
+
request: z.ZodObject<{
|
|
2195
|
+
clientId: z.ZodString;
|
|
2196
|
+
}, z.core.$strip>;
|
|
2197
|
+
response: z.ZodObject<{
|
|
2198
|
+
state: z.ZodNullable<z.ZodObject<{
|
|
2199
|
+
clientId: z.ZodString;
|
|
2200
|
+
activeVersion: z.ZodNullable<z.ZodString>;
|
|
2201
|
+
latestAvailableVersion: z.ZodNullable<z.ZodString>;
|
|
2202
|
+
latestVersionLastCheckedAt: z.ZodNullable<z.ZodNumber>;
|
|
2203
|
+
latestVersionSourceStatus: z.ZodEnum<{
|
|
2204
|
+
error: "error";
|
|
2205
|
+
fresh: "fresh";
|
|
2206
|
+
cached: "cached";
|
|
2207
|
+
}>;
|
|
2208
|
+
updatedAt: z.ZodNumber;
|
|
2209
|
+
}, z.core.$strip>>;
|
|
2210
|
+
}, z.core.$strip>;
|
|
2211
|
+
}; /** Return the state rows for all clients (used for boot hydration). */
|
|
2212
|
+
loadAllState: {
|
|
2213
|
+
request: z.ZodObject<{}, z.core.$strip>;
|
|
2214
|
+
response: z.ZodObject<{
|
|
2215
|
+
states: z.ZodArray<z.ZodObject<{
|
|
2216
|
+
clientId: z.ZodString;
|
|
2217
|
+
activeVersion: z.ZodNullable<z.ZodString>;
|
|
2218
|
+
latestAvailableVersion: z.ZodNullable<z.ZodString>;
|
|
2219
|
+
latestVersionLastCheckedAt: z.ZodNullable<z.ZodNumber>;
|
|
2220
|
+
latestVersionSourceStatus: z.ZodEnum<{
|
|
2221
|
+
error: "error";
|
|
2222
|
+
fresh: "fresh";
|
|
2223
|
+
cached: "cached";
|
|
2224
|
+
}>;
|
|
2225
|
+
updatedAt: z.ZodNumber;
|
|
2226
|
+
}, z.core.$strip>>;
|
|
2227
|
+
}, z.core.$strip>;
|
|
2228
|
+
}; /** Return all state and installed-version rows from one storage read boundary. */
|
|
2229
|
+
loadSnapshot: {
|
|
2230
|
+
request: z.ZodObject<{}, z.core.$strip>;
|
|
2231
|
+
response: z.ZodObject<{
|
|
2232
|
+
states: z.ZodArray<z.ZodObject<{
|
|
2233
|
+
clientId: z.ZodString;
|
|
2234
|
+
activeVersion: z.ZodNullable<z.ZodString>;
|
|
2235
|
+
latestAvailableVersion: z.ZodNullable<z.ZodString>;
|
|
2236
|
+
latestVersionLastCheckedAt: z.ZodNullable<z.ZodNumber>;
|
|
2237
|
+
latestVersionSourceStatus: z.ZodEnum<{
|
|
2238
|
+
error: "error";
|
|
2239
|
+
fresh: "fresh";
|
|
2240
|
+
cached: "cached";
|
|
2241
|
+
}>;
|
|
2242
|
+
updatedAt: z.ZodNumber;
|
|
2243
|
+
}, z.core.$strip>>;
|
|
2244
|
+
versions: z.ZodArray<z.ZodObject<{
|
|
2245
|
+
id: z.ZodString;
|
|
2246
|
+
clientId: z.ZodString;
|
|
2247
|
+
version: z.ZodString;
|
|
2248
|
+
installPath: z.ZodString;
|
|
2249
|
+
installedAt: z.ZodNumber;
|
|
2250
|
+
createdAt: z.ZodNumber;
|
|
2251
|
+
}, z.core.$strip>>;
|
|
2252
|
+
}, z.core.$strip>;
|
|
2253
|
+
};
|
|
2254
|
+
/**
|
|
2255
|
+
* Persist an updated feed-cache entry for a client.
|
|
2256
|
+
*
|
|
2257
|
+
* This is a subset of `upsertState` — the handler merges the feed fields
|
|
2258
|
+
* into the existing row (or creates a minimal row) without touching
|
|
2259
|
+
* `activeVersion`.
|
|
2260
|
+
*/
|
|
2261
|
+
updateFeedCache: {
|
|
2262
|
+
request: z.ZodObject<{
|
|
2263
|
+
clientId: z.ZodString;
|
|
2264
|
+
latestAvailableVersion: z.ZodNullable<z.ZodString>;
|
|
2265
|
+
latestVersionLastCheckedAt: z.ZodNullable<z.ZodNumber>;
|
|
2266
|
+
latestVersionSourceStatus: z.ZodEnum<{
|
|
2267
|
+
error: "error";
|
|
2268
|
+
fresh: "fresh";
|
|
2269
|
+
cached: "cached";
|
|
2270
|
+
}>;
|
|
2271
|
+
updatedAt: z.ZodNumber;
|
|
2272
|
+
}, z.core.$strip>;
|
|
2273
|
+
response: z.ZodObject<{
|
|
2274
|
+
success: z.ZodBoolean;
|
|
2275
|
+
}, z.core.$strip>;
|
|
2276
|
+
};
|
|
2277
|
+
/**
|
|
2278
|
+
* Atomically remove an installed-version row and clear the active-version
|
|
2279
|
+
* pointer when it currently points to the deleted version.
|
|
2280
|
+
*
|
|
2281
|
+
* Both operations are executed inside a single SQLite transaction so that
|
|
2282
|
+
* concurrent reads never observe a state where the version row is absent but
|
|
2283
|
+
* the active pointer still references it.
|
|
2284
|
+
*/
|
|
2285
|
+
removeVersionAndClearActive: {
|
|
2286
|
+
request: z.ZodObject<{
|
|
2287
|
+
clientId: z.ZodString;
|
|
2288
|
+
version: z.ZodString;
|
|
2289
|
+
updatedAt: z.ZodNumber;
|
|
2290
|
+
}, z.core.$strip>;
|
|
2291
|
+
response: z.ZodObject<{
|
|
2292
|
+
previousActiveVersion: z.ZodNullable<z.ZodString>;
|
|
2293
|
+
activeVersion: z.ZodNullable<z.ZodString>;
|
|
2294
|
+
removedVersion: z.ZodNullable<z.ZodString>;
|
|
2295
|
+
}, z.core.$strip>;
|
|
2296
|
+
};
|
|
2297
|
+
}>, "client-binary:storage">;
|
|
2298
|
+
/** Persisted installed-version record as exchanged over the bus. */
|
|
2299
|
+
type ClientBinaryVersionRecord = z.infer<typeof ClientBinaryVersionRecordSchema>;
|
|
2300
|
+
/** Per-client binary state record as exchanged over the bus. */
|
|
2301
|
+
type ClientBinaryStateRecord = z.infer<typeof ClientBinaryStateRecordSchema>;
|
|
2302
|
+
//#endregion
|
|
2303
|
+
//#region packages/clients-core/src/storage/runtime-storage-namespace.d.ts
|
|
2304
|
+
/**
|
|
2305
|
+
* Zod schema for a fully-populated runtime record transported over the bus.
|
|
2306
|
+
*
|
|
2307
|
+
* Mirrors {@link ClientRuntimeRecord} with explicit Zod types so the bus can
|
|
2308
|
+
* validate payloads at runtime.
|
|
2309
|
+
*/
|
|
2310
|
+
declare const RuntimeRecordSchema: z.ZodObject<{
|
|
2311
|
+
clientRuntimeId: z.ZodString;
|
|
2312
|
+
clientId: z.ZodString;
|
|
2313
|
+
status: z.ZodEnum<{
|
|
2314
|
+
started: "started";
|
|
2315
|
+
observed: "observed";
|
|
2316
|
+
}>;
|
|
2317
|
+
supervisorSessionId: z.ZodOptional<z.ZodString>;
|
|
2318
|
+
pid: z.ZodOptional<z.ZodNumber>;
|
|
2319
|
+
parentPid: z.ZodOptional<z.ZodNumber>;
|
|
2320
|
+
adapterSessionId: z.ZodOptional<z.ZodString>;
|
|
2321
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
2322
|
+
cwd: z.ZodOptional<z.ZodString>;
|
|
2323
|
+
argv: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2324
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
2325
|
+
observedAt: z.ZodNumber;
|
|
2326
|
+
createdAt: z.ZodNumber;
|
|
2327
|
+
updatedAt: z.ZodNumber;
|
|
2328
|
+
}, z.core.$strip>;
|
|
2329
|
+
/**
|
|
2330
|
+
* Internal bus namespace for client runtime storage operations.
|
|
2331
|
+
*
|
|
2332
|
+
* Subjects registered here are consumed exclusively by the Drizzle handler
|
|
2333
|
+
* and the registry — they are not part of the public `client.*` namespace.
|
|
2334
|
+
*/
|
|
2335
|
+
declare const ClientRuntimeStorageNamespace: _$_makaio_core0.BusNamespaceDefinition<"client-runtime:storage", {
|
|
2336
|
+
upsert: {
|
|
2337
|
+
request: z.ZodObject<{
|
|
2338
|
+
clientRuntimeId: z.ZodString;
|
|
2339
|
+
clientId: z.ZodString;
|
|
2340
|
+
status: z.ZodEnum<{
|
|
2341
|
+
started: "started";
|
|
2342
|
+
observed: "observed";
|
|
2343
|
+
}>;
|
|
2344
|
+
supervisorSessionId: z.ZodOptional<z.ZodString>;
|
|
2345
|
+
pid: z.ZodOptional<z.ZodNumber>;
|
|
2346
|
+
parentPid: z.ZodOptional<z.ZodNumber>;
|
|
2347
|
+
adapterSessionId: z.ZodOptional<z.ZodString>;
|
|
2348
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
2349
|
+
cwd: z.ZodOptional<z.ZodString>;
|
|
2350
|
+
argv: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2351
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
2352
|
+
observedAt: z.ZodNumber;
|
|
2353
|
+
createdAt: z.ZodNumber;
|
|
2354
|
+
updatedAt: z.ZodNumber;
|
|
2355
|
+
}, z.core.$strip>;
|
|
2356
|
+
response: z.ZodObject<{
|
|
2357
|
+
success: z.ZodBoolean;
|
|
2358
|
+
}, z.core.$strip>;
|
|
2359
|
+
};
|
|
2360
|
+
loadAll: {
|
|
2361
|
+
request: z.ZodObject<{}, z.core.$strip>;
|
|
2362
|
+
response: z.ZodObject<{
|
|
2363
|
+
records: z.ZodArray<z.ZodObject<{
|
|
2364
|
+
clientRuntimeId: z.ZodString;
|
|
2365
|
+
clientId: z.ZodString;
|
|
2366
|
+
status: z.ZodEnum<{
|
|
2367
|
+
started: "started";
|
|
2368
|
+
observed: "observed";
|
|
2369
|
+
}>;
|
|
2370
|
+
supervisorSessionId: z.ZodOptional<z.ZodString>;
|
|
2371
|
+
pid: z.ZodOptional<z.ZodNumber>;
|
|
2372
|
+
parentPid: z.ZodOptional<z.ZodNumber>;
|
|
2373
|
+
adapterSessionId: z.ZodOptional<z.ZodString>;
|
|
2374
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
2375
|
+
cwd: z.ZodOptional<z.ZodString>;
|
|
2376
|
+
argv: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2377
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
2378
|
+
observedAt: z.ZodNumber;
|
|
2379
|
+
createdAt: z.ZodNumber;
|
|
2380
|
+
updatedAt: z.ZodNumber;
|
|
2381
|
+
}, z.core.$strip>>;
|
|
2382
|
+
}, z.core.$strip>;
|
|
2383
|
+
};
|
|
2384
|
+
}>;
|
|
2385
|
+
/** Typed bus subjects for client runtime storage. */
|
|
2386
|
+
declare const ClientRuntimeStorageSubjects: _$_makaio_core0.BusSubjects<_$_makaio_core0.FlatSubjectDefinitions<"client-runtime:storage", {
|
|
2387
|
+
upsert: {
|
|
2388
|
+
request: z.ZodObject<{
|
|
2389
|
+
clientRuntimeId: z.ZodString;
|
|
2390
|
+
clientId: z.ZodString;
|
|
2391
|
+
status: z.ZodEnum<{
|
|
2392
|
+
started: "started";
|
|
2393
|
+
observed: "observed";
|
|
2394
|
+
}>;
|
|
2395
|
+
supervisorSessionId: z.ZodOptional<z.ZodString>;
|
|
2396
|
+
pid: z.ZodOptional<z.ZodNumber>;
|
|
2397
|
+
parentPid: z.ZodOptional<z.ZodNumber>;
|
|
2398
|
+
adapterSessionId: z.ZodOptional<z.ZodString>;
|
|
2399
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
2400
|
+
cwd: z.ZodOptional<z.ZodString>;
|
|
2401
|
+
argv: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2402
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
2403
|
+
observedAt: z.ZodNumber;
|
|
2404
|
+
createdAt: z.ZodNumber;
|
|
2405
|
+
updatedAt: z.ZodNumber;
|
|
2406
|
+
}, z.core.$strip>;
|
|
2407
|
+
response: z.ZodObject<{
|
|
2408
|
+
success: z.ZodBoolean;
|
|
2409
|
+
}, z.core.$strip>;
|
|
2410
|
+
};
|
|
2411
|
+
loadAll: {
|
|
2412
|
+
request: z.ZodObject<{}, z.core.$strip>;
|
|
2413
|
+
response: z.ZodObject<{
|
|
2414
|
+
records: z.ZodArray<z.ZodObject<{
|
|
2415
|
+
clientRuntimeId: z.ZodString;
|
|
2416
|
+
clientId: z.ZodString;
|
|
2417
|
+
status: z.ZodEnum<{
|
|
2418
|
+
started: "started";
|
|
2419
|
+
observed: "observed";
|
|
2420
|
+
}>;
|
|
2421
|
+
supervisorSessionId: z.ZodOptional<z.ZodString>;
|
|
2422
|
+
pid: z.ZodOptional<z.ZodNumber>;
|
|
2423
|
+
parentPid: z.ZodOptional<z.ZodNumber>;
|
|
2424
|
+
adapterSessionId: z.ZodOptional<z.ZodString>;
|
|
2425
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
2426
|
+
cwd: z.ZodOptional<z.ZodString>;
|
|
2427
|
+
argv: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2428
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
2429
|
+
observedAt: z.ZodNumber;
|
|
2430
|
+
createdAt: z.ZodNumber;
|
|
2431
|
+
updatedAt: z.ZodNumber;
|
|
2432
|
+
}, z.core.$strip>>;
|
|
2433
|
+
}, z.core.$strip>;
|
|
2434
|
+
};
|
|
2435
|
+
}>, "client-runtime:storage">;
|
|
2436
|
+
//#endregion
|
|
2437
|
+
//#region packages/clients-core/src/storage/profile-storage-namespace.d.ts
|
|
2438
|
+
/**
|
|
2439
|
+
* Zod schema for a persisted client profile record transported over the bus.
|
|
2440
|
+
*
|
|
2441
|
+
* Reuses {@link ClientProfileSchema} from contracts so the storage namespace
|
|
2442
|
+
* and the public client contract share a single source of truth.
|
|
2443
|
+
*/
|
|
2444
|
+
declare const ClientProfileRecordSchema: z.ZodObject<{
|
|
2445
|
+
id: z.ZodString;
|
|
2446
|
+
clientId: z.ZodString;
|
|
2447
|
+
name: z.ZodString;
|
|
2448
|
+
description: z.ZodNullable<z.ZodString>;
|
|
2449
|
+
configDir: z.ZodString;
|
|
2450
|
+
isDefault: z.ZodBoolean;
|
|
2451
|
+
createdAt: z.ZodNumber;
|
|
2452
|
+
updatedAt: z.ZodNumber;
|
|
2453
|
+
}, z.core.$strip>;
|
|
2454
|
+
/**
|
|
2455
|
+
* Internal bus namespace for client profile storage operations.
|
|
2456
|
+
*
|
|
2457
|
+
* Subjects registered here are consumed exclusively by the Drizzle handler
|
|
2458
|
+
* and the profile manager — they are not part of the public `client.*` namespace.
|
|
2459
|
+
*/
|
|
2460
|
+
declare const ClientProfileStorageNamespace: _$_makaio_core0.BusNamespaceDefinition<"client-profile:storage", {
|
|
2461
|
+
/** Return a single profile record identified by `(clientId, name)`, or `null` when not found. */get: {
|
|
2462
|
+
request: z.ZodObject<{
|
|
2463
|
+
clientId: z.ZodString;
|
|
2464
|
+
name: z.ZodString;
|
|
2465
|
+
}, z.core.$strip>;
|
|
2466
|
+
response: z.ZodObject<{
|
|
2467
|
+
record: z.ZodNullable<z.ZodObject<{
|
|
2468
|
+
id: z.ZodString;
|
|
2469
|
+
clientId: z.ZodString;
|
|
2470
|
+
name: z.ZodString;
|
|
2471
|
+
description: z.ZodNullable<z.ZodString>;
|
|
2472
|
+
configDir: z.ZodString;
|
|
2473
|
+
isDefault: z.ZodBoolean;
|
|
2474
|
+
createdAt: z.ZodNumber;
|
|
2475
|
+
updatedAt: z.ZodNumber;
|
|
2476
|
+
}, z.core.$strip>>;
|
|
2477
|
+
}, z.core.$strip>;
|
|
2478
|
+
}; /** Return a single profile record by its stable row ID, or `null` when not found. */
|
|
2479
|
+
getById: {
|
|
2480
|
+
request: z.ZodObject<{
|
|
2481
|
+
id: z.ZodString;
|
|
2482
|
+
}, z.core.$strip>;
|
|
2483
|
+
response: z.ZodObject<{
|
|
2484
|
+
record: z.ZodNullable<z.ZodObject<{
|
|
2485
|
+
id: z.ZodString;
|
|
2486
|
+
clientId: z.ZodString;
|
|
2487
|
+
name: z.ZodString;
|
|
2488
|
+
description: z.ZodNullable<z.ZodString>;
|
|
2489
|
+
configDir: z.ZodString;
|
|
2490
|
+
isDefault: z.ZodBoolean;
|
|
2491
|
+
createdAt: z.ZodNumber;
|
|
2492
|
+
updatedAt: z.ZodNumber;
|
|
2493
|
+
}, z.core.$strip>>;
|
|
2494
|
+
}, z.core.$strip>;
|
|
2495
|
+
}; /** Return all profile records for a given client. */
|
|
2496
|
+
list: {
|
|
2497
|
+
request: z.ZodObject<{
|
|
2498
|
+
clientId: z.ZodString;
|
|
2499
|
+
}, z.core.$strip>;
|
|
2500
|
+
response: z.ZodObject<{
|
|
2501
|
+
records: z.ZodArray<z.ZodObject<{
|
|
2502
|
+
id: z.ZodString;
|
|
2503
|
+
clientId: z.ZodString;
|
|
2504
|
+
name: z.ZodString;
|
|
2505
|
+
description: z.ZodNullable<z.ZodString>;
|
|
2506
|
+
configDir: z.ZodString;
|
|
2507
|
+
isDefault: z.ZodBoolean;
|
|
2508
|
+
createdAt: z.ZodNumber;
|
|
2509
|
+
updatedAt: z.ZodNumber;
|
|
2510
|
+
}, z.core.$strip>>;
|
|
2511
|
+
}, z.core.$strip>;
|
|
2512
|
+
};
|
|
2513
|
+
/**
|
|
2514
|
+
* Insert or update a profile record identified by its stable row ID.
|
|
2515
|
+
*
|
|
2516
|
+
* On conflict, all mutable fields (`name`, `description`, `configDir`,
|
|
2517
|
+
* `isDefault`, `updatedAt`) are overwritten. `createdAt` is preserved on
|
|
2518
|
+
* subsequent upserts.
|
|
2519
|
+
*/
|
|
2520
|
+
set: {
|
|
2521
|
+
request: z.ZodObject<{
|
|
2522
|
+
id: z.ZodString;
|
|
2523
|
+
clientId: z.ZodString;
|
|
2524
|
+
name: z.ZodString;
|
|
2525
|
+
description: z.ZodNullable<z.ZodString>;
|
|
2526
|
+
configDir: z.ZodString;
|
|
2527
|
+
isDefault: z.ZodBoolean;
|
|
2528
|
+
createdAt: z.ZodNumber;
|
|
2529
|
+
updatedAt: z.ZodNumber;
|
|
2530
|
+
}, z.core.$strip>;
|
|
2531
|
+
response: z.ZodObject<{
|
|
2532
|
+
success: z.ZodBoolean;
|
|
2533
|
+
}, z.core.$strip>;
|
|
2534
|
+
};
|
|
2535
|
+
/**
|
|
2536
|
+
* Delete the profile record identified by `(clientId, name)`.
|
|
2537
|
+
*
|
|
2538
|
+
* Returns `{ success: true }` when a row was deleted and
|
|
2539
|
+
* `{ success: false }` when no matching row was found.
|
|
2540
|
+
*/
|
|
2541
|
+
delete: {
|
|
2542
|
+
request: z.ZodObject<{
|
|
2543
|
+
clientId: z.ZodString;
|
|
2544
|
+
name: z.ZodString;
|
|
2545
|
+
}, z.core.$strip>;
|
|
2546
|
+
response: z.ZodObject<{
|
|
2547
|
+
success: z.ZodBoolean;
|
|
2548
|
+
}, z.core.$strip>;
|
|
2549
|
+
};
|
|
2550
|
+
/**
|
|
2551
|
+
* Clear the `isDefault` flag on all profiles for a given client.
|
|
2552
|
+
*
|
|
2553
|
+
* Low-level maintenance operation. Normal default promotion must use
|
|
2554
|
+
* `setDefault` so clearing and promotion share one storage transaction.
|
|
2555
|
+
*/
|
|
2556
|
+
clearDefault: {
|
|
2557
|
+
request: z.ZodObject<{
|
|
2558
|
+
clientId: z.ZodString;
|
|
2559
|
+
}, z.core.$strip>;
|
|
2560
|
+
response: z.ZodObject<{
|
|
2561
|
+
success: z.ZodBoolean;
|
|
2562
|
+
}, z.core.$strip>;
|
|
2563
|
+
};
|
|
2564
|
+
/**
|
|
2565
|
+
* Atomically promote one profile to default and clear the previous default.
|
|
2566
|
+
*/
|
|
2567
|
+
setDefault: {
|
|
2568
|
+
request: z.ZodObject<{
|
|
2569
|
+
clientId: z.ZodString;
|
|
2570
|
+
name: z.ZodString;
|
|
2571
|
+
}, z.core.$strip>;
|
|
2572
|
+
response: z.ZodObject<{
|
|
2573
|
+
record: z.ZodNullable<z.ZodObject<{
|
|
2574
|
+
id: z.ZodString;
|
|
2575
|
+
clientId: z.ZodString;
|
|
2576
|
+
name: z.ZodString;
|
|
2577
|
+
description: z.ZodNullable<z.ZodString>;
|
|
2578
|
+
configDir: z.ZodString;
|
|
2579
|
+
isDefault: z.ZodBoolean;
|
|
2580
|
+
createdAt: z.ZodNumber;
|
|
2581
|
+
updatedAt: z.ZodNumber;
|
|
2582
|
+
}, z.core.$strip>>;
|
|
2583
|
+
}, z.core.$strip>;
|
|
2584
|
+
};
|
|
2585
|
+
}>;
|
|
2586
|
+
/** Typed bus subjects for client profile storage. */
|
|
2587
|
+
declare const ClientProfileStorageSubjects: _$_makaio_core0.BusSubjects<_$_makaio_core0.FlatSubjectDefinitions<"client-profile:storage", {
|
|
2588
|
+
/** Return a single profile record identified by `(clientId, name)`, or `null` when not found. */get: {
|
|
2589
|
+
request: z.ZodObject<{
|
|
2590
|
+
clientId: z.ZodString;
|
|
2591
|
+
name: z.ZodString;
|
|
2592
|
+
}, z.core.$strip>;
|
|
2593
|
+
response: z.ZodObject<{
|
|
2594
|
+
record: z.ZodNullable<z.ZodObject<{
|
|
2595
|
+
id: z.ZodString;
|
|
2596
|
+
clientId: z.ZodString;
|
|
2597
|
+
name: z.ZodString;
|
|
2598
|
+
description: z.ZodNullable<z.ZodString>;
|
|
2599
|
+
configDir: z.ZodString;
|
|
2600
|
+
isDefault: z.ZodBoolean;
|
|
2601
|
+
createdAt: z.ZodNumber;
|
|
2602
|
+
updatedAt: z.ZodNumber;
|
|
2603
|
+
}, z.core.$strip>>;
|
|
2604
|
+
}, z.core.$strip>;
|
|
2605
|
+
}; /** Return a single profile record by its stable row ID, or `null` when not found. */
|
|
2606
|
+
getById: {
|
|
2607
|
+
request: z.ZodObject<{
|
|
2608
|
+
id: z.ZodString;
|
|
2609
|
+
}, z.core.$strip>;
|
|
2610
|
+
response: z.ZodObject<{
|
|
2611
|
+
record: z.ZodNullable<z.ZodObject<{
|
|
2612
|
+
id: z.ZodString;
|
|
2613
|
+
clientId: z.ZodString;
|
|
2614
|
+
name: z.ZodString;
|
|
2615
|
+
description: z.ZodNullable<z.ZodString>;
|
|
2616
|
+
configDir: z.ZodString;
|
|
2617
|
+
isDefault: z.ZodBoolean;
|
|
2618
|
+
createdAt: z.ZodNumber;
|
|
2619
|
+
updatedAt: z.ZodNumber;
|
|
2620
|
+
}, z.core.$strip>>;
|
|
2621
|
+
}, z.core.$strip>;
|
|
2622
|
+
}; /** Return all profile records for a given client. */
|
|
2623
|
+
list: {
|
|
2624
|
+
request: z.ZodObject<{
|
|
2625
|
+
clientId: z.ZodString;
|
|
2626
|
+
}, z.core.$strip>;
|
|
2627
|
+
response: z.ZodObject<{
|
|
2628
|
+
records: z.ZodArray<z.ZodObject<{
|
|
2629
|
+
id: z.ZodString;
|
|
2630
|
+
clientId: z.ZodString;
|
|
2631
|
+
name: z.ZodString;
|
|
2632
|
+
description: z.ZodNullable<z.ZodString>;
|
|
2633
|
+
configDir: z.ZodString;
|
|
2634
|
+
isDefault: z.ZodBoolean;
|
|
2635
|
+
createdAt: z.ZodNumber;
|
|
2636
|
+
updatedAt: z.ZodNumber;
|
|
2637
|
+
}, z.core.$strip>>;
|
|
2638
|
+
}, z.core.$strip>;
|
|
2639
|
+
};
|
|
2640
|
+
/**
|
|
2641
|
+
* Insert or update a profile record identified by its stable row ID.
|
|
2642
|
+
*
|
|
2643
|
+
* On conflict, all mutable fields (`name`, `description`, `configDir`,
|
|
2644
|
+
* `isDefault`, `updatedAt`) are overwritten. `createdAt` is preserved on
|
|
2645
|
+
* subsequent upserts.
|
|
2646
|
+
*/
|
|
2647
|
+
set: {
|
|
2648
|
+
request: z.ZodObject<{
|
|
2649
|
+
id: z.ZodString;
|
|
2650
|
+
clientId: z.ZodString;
|
|
2651
|
+
name: z.ZodString;
|
|
2652
|
+
description: z.ZodNullable<z.ZodString>;
|
|
2653
|
+
configDir: z.ZodString;
|
|
2654
|
+
isDefault: z.ZodBoolean;
|
|
2655
|
+
createdAt: z.ZodNumber;
|
|
2656
|
+
updatedAt: z.ZodNumber;
|
|
2657
|
+
}, z.core.$strip>;
|
|
2658
|
+
response: z.ZodObject<{
|
|
2659
|
+
success: z.ZodBoolean;
|
|
2660
|
+
}, z.core.$strip>;
|
|
2661
|
+
};
|
|
2662
|
+
/**
|
|
2663
|
+
* Delete the profile record identified by `(clientId, name)`.
|
|
2664
|
+
*
|
|
2665
|
+
* Returns `{ success: true }` when a row was deleted and
|
|
2666
|
+
* `{ success: false }` when no matching row was found.
|
|
2667
|
+
*/
|
|
2668
|
+
delete: {
|
|
2669
|
+
request: z.ZodObject<{
|
|
2670
|
+
clientId: z.ZodString;
|
|
2671
|
+
name: z.ZodString;
|
|
2672
|
+
}, z.core.$strip>;
|
|
2673
|
+
response: z.ZodObject<{
|
|
2674
|
+
success: z.ZodBoolean;
|
|
2675
|
+
}, z.core.$strip>;
|
|
2676
|
+
};
|
|
2677
|
+
/**
|
|
2678
|
+
* Clear the `isDefault` flag on all profiles for a given client.
|
|
2679
|
+
*
|
|
2680
|
+
* Low-level maintenance operation. Normal default promotion must use
|
|
2681
|
+
* `setDefault` so clearing and promotion share one storage transaction.
|
|
2682
|
+
*/
|
|
2683
|
+
clearDefault: {
|
|
2684
|
+
request: z.ZodObject<{
|
|
2685
|
+
clientId: z.ZodString;
|
|
2686
|
+
}, z.core.$strip>;
|
|
2687
|
+
response: z.ZodObject<{
|
|
2688
|
+
success: z.ZodBoolean;
|
|
2689
|
+
}, z.core.$strip>;
|
|
2690
|
+
};
|
|
2691
|
+
/**
|
|
2692
|
+
* Atomically promote one profile to default and clear the previous default.
|
|
2693
|
+
*/
|
|
2694
|
+
setDefault: {
|
|
2695
|
+
request: z.ZodObject<{
|
|
2696
|
+
clientId: z.ZodString;
|
|
2697
|
+
name: z.ZodString;
|
|
2698
|
+
}, z.core.$strip>;
|
|
2699
|
+
response: z.ZodObject<{
|
|
2700
|
+
record: z.ZodNullable<z.ZodObject<{
|
|
2701
|
+
id: z.ZodString;
|
|
2702
|
+
clientId: z.ZodString;
|
|
2703
|
+
name: z.ZodString;
|
|
2704
|
+
description: z.ZodNullable<z.ZodString>;
|
|
2705
|
+
configDir: z.ZodString;
|
|
2706
|
+
isDefault: z.ZodBoolean;
|
|
2707
|
+
createdAt: z.ZodNumber;
|
|
2708
|
+
updatedAt: z.ZodNumber;
|
|
2709
|
+
}, z.core.$strip>>;
|
|
2710
|
+
}, z.core.$strip>;
|
|
2711
|
+
};
|
|
2712
|
+
}>, "client-profile:storage">;
|
|
2713
|
+
/** Persisted client profile record as exchanged over the bus. */
|
|
2714
|
+
type ClientProfileRecord = z.infer<typeof ClientProfileRecordSchema>;
|
|
2715
|
+
//#endregion
|
|
2716
|
+
//#region packages/clients-core/src/resolve-client-binary.d.ts
|
|
2717
|
+
/**
|
|
2718
|
+
* Resolve the execution context for a client binary via the bus.
|
|
2719
|
+
*
|
|
2720
|
+
* Uses `requestOptional` so the adapter continues to function in
|
|
2721
|
+
* framework-only boot where no `client.resolveBinary` handler is registered.
|
|
2722
|
+
* In that case `undefined` is returned and callers fall back to PATH lookup.
|
|
2723
|
+
* @param clientId - Stable client identifier to resolve (e.g. `'claude-code'`)
|
|
2724
|
+
* @returns Resolved execution context (source `'managed'` or `'global'`), or
|
|
2725
|
+
* `undefined` when no `client.resolveBinary` handler is registered
|
|
2726
|
+
* (framework-only boot)
|
|
2727
|
+
*/
|
|
2728
|
+
declare function resolveClientBinary(clientId: string): Promise<ClientExecutionContext | undefined>;
|
|
2729
|
+
//#endregion
|
|
2730
|
+
//#region packages/clients-core/src/wiring-helpers.d.ts
|
|
2731
|
+
/**
|
|
2732
|
+
* Minimal descriptor for a single session-event wiring entry.
|
|
2733
|
+
*
|
|
2734
|
+
* Produced by {@link deriveSessionEventDescriptors} and consumed by the
|
|
2735
|
+
* per-client `buildWiringList`, `applyWiring`, and `removeWiring` functions to
|
|
2736
|
+
* iterate over the events that need hook installation.
|
|
2737
|
+
*/
|
|
2738
|
+
interface SessionEventDescriptor {
|
|
2739
|
+
/** Native event name as declared in the client definition (e.g. `'SessionStart'`). */
|
|
2740
|
+
readonly eventName: string;
|
|
2741
|
+
}
|
|
2742
|
+
/**
|
|
2743
|
+
* Build a shell-safe client command string from an executable and argv tokens.
|
|
2744
|
+
*
|
|
2745
|
+
* Native client settings store command strings rather than argv arrays, so the
|
|
2746
|
+
* executable and arguments must be rendered with shell quoting before they are
|
|
2747
|
+
* persisted.
|
|
2748
|
+
*
|
|
2749
|
+
* When `envPairs` is provided, each `KEY=value` string is prepended before the
|
|
2750
|
+
* executable as inline environment variable assignments — the standard POSIX
|
|
2751
|
+
* shell pattern for per-command env overrides.
|
|
2752
|
+
* @param makaioCommand - Makaio CLI binary name or absolute path.
|
|
2753
|
+
* @param args - Argument tokens appended after the Makaio command.
|
|
2754
|
+
* @param envPairs - Optional `KEY=value` pairs prepended before the executable.
|
|
2755
|
+
* @returns Shell-safe command string.
|
|
2756
|
+
*/
|
|
2757
|
+
declare function buildClientCommand(makaioCommand: string, args: readonly string[], envPairs?: readonly string[]): string;
|
|
2758
|
+
/**
|
|
2759
|
+
* Build the full hook command string for a single session-event wiring entry.
|
|
2760
|
+
*
|
|
2761
|
+
* The resulting command takes the form:
|
|
2762
|
+
* `[envPairs...] <makaioCommand> <sentinel> <eventName>`
|
|
2763
|
+
*
|
|
2764
|
+
* For example, given `'makaio'`, `'hook received claude-code'`, `'SessionStart'`
|
|
2765
|
+
* the function returns `'makaio hook received claude-code SessionStart'`.
|
|
2766
|
+
* @param makaioCommand - Makaio CLI binary name or path (e.g. `'makaio'`).
|
|
2767
|
+
* @param sentinel - Client-specific sentinel string embedded in every Makaio
|
|
2768
|
+
* hook command (e.g. `'hook received claude-code'`).
|
|
2769
|
+
* @param eventName - Native hook event name (e.g. `'SessionStart'`).
|
|
2770
|
+
* @param envPairs - Optional `KEY=value` pairs prepended before the executable.
|
|
2771
|
+
* @returns Full hook command string to write into the client's native config.
|
|
2772
|
+
*/
|
|
2773
|
+
declare function buildHookCommand(makaioCommand: string, sentinel: string, eventName: string, envPairs?: readonly string[]): string;
|
|
2774
|
+
/**
|
|
2775
|
+
* Derive the ordered list of session-event wiring descriptors from a client
|
|
2776
|
+
* definition.
|
|
2777
|
+
*
|
|
2778
|
+
* Only hook events that carry a `frameworkSubject` are included — events
|
|
2779
|
+
* without one are client-internal and do not need framework wiring.
|
|
2780
|
+
* @param clientDefinition - The parsed static client definition whose
|
|
2781
|
+
* `runtimeCapabilities.hookEvents` array is the source of truth.
|
|
2782
|
+
* @returns Read-only array of `{ eventName }` descriptors in declaration order.
|
|
2783
|
+
*/
|
|
2784
|
+
declare function deriveSessionEventDescriptors(clientDefinition: ClientDefinition$1): ReadonlyArray<SessionEventDescriptor>;
|
|
2785
|
+
//#endregion
|
|
2786
|
+
export { AbsolutePathSchema, type AtomicContentParser, type AtomicModifier, type AtomicModifyOutcome, BinaryNotFoundError, type BuildClientSessionBaseOpts, CLIENT_RUNTIME_STATUSES, ClientAccountRegistry, type ClientAccountUpsertResult, ClientBinaryFeedCache, ClientBinaryJobRunner, ClientBinaryManager, type ClientBinaryManagerConfig, type ClientBinaryStateRecord, ClientBinaryStateRecordSchema, ClientBinaryStorageNamespace, ClientBinaryStorageSubjects, type ClientBinaryVersionRecord, ClientBinaryVersionRecordSchema, ClientBinaryVersionResolver, type ClientDefinitionLookup, ClientDefinitionRegistry, type ClientNamespaceResult, type ClientProfileRecord, ClientProfileRecordSchema, ClientProfileService, ClientProfileStorageNamespace, ClientProfileStorageSubjects, type ClientRuntimeRecord, ClientRuntimeRegistry, ClientRuntimeService, type ClientRuntimeStatus, ClientRuntimeStorageNamespace, ClientRuntimeStorageSubjects, ClientSessionConfigService, ClientSubjects, type ClientWiringAggregatedResult, ClientWiringAggregatedResultSchema, type ClientWiringApplyResponse, ClientWiringApplyResponseSchema, type ClientWiringEntry, ClientWiringEntrySchema, type ClientWiringListResponse, ClientWiringListResponseSchema, type ClientWiringListSubjectDef, type ClientWiringRemoveResponse, ClientWiringRemoveResponseSchema, type ClientWiringSubjectDefBase, type ClientsCorePackageOptions, ClientsCoreService, ClientsCoreToken, type FeedFetcher, type InstallJob, type JobCompletedCallback, type JobCompletionCallback, type JobCompletionResult, type JobProgressCallback, type LatestVersionMeta, type PostInstallContext, type PostInstallHandler, type RawClientHookPayload, RawClientHookPayloadSchema, type RawClientHookReceivedSubject, type ResolvedInstallVersion, RuntimeRecordSchema, type RuntimeUpsertResult, type SessionEventDescriptor, type StrategyDependencies, assertAbsoluteProjectDir, atomicModifyFile, buildClientCommand, buildClientSessionBase, buildHookCommand, canonicalizeClientId, createClientNamespace, createClientWiringListSubjectDef, createClientWiringSubjectDef, createClientsCorePackage, createRawClientHookReceivedSubject, deriveSessionEventDescriptors, emitBestEffort, isPathWithinBase, pickNonEmptyString, pickNonEmptyStringValue, registerStorageHandlersWithRollback, resolveAndValidateBasePath, resolveClientBinary };
|