@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,825 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { MakaioContext } from "@makaio/framework/core";
|
|
3
|
+
import { IMakaioBus } from "@makaio/framework/bus";
|
|
4
|
+
import { ToolAnnotations, ToolAnnotations as ToolAnnotations$1 } from "@makaio/framework/contracts";
|
|
5
|
+
import * as zCore from "zod/v4/core";
|
|
6
|
+
|
|
7
|
+
//#region packages/tools-core/src/types.d.ts
|
|
8
|
+
/**
|
|
9
|
+
* Type alias for the bus interface used in tool execution contexts.
|
|
10
|
+
*
|
|
11
|
+
* Tools receive IMakaioBus instances for type-safe event communication.
|
|
12
|
+
* This ensures full type safety with typed subjects from `@makaio/contracts`.
|
|
13
|
+
*/
|
|
14
|
+
type BusLike = IMakaioBus;
|
|
15
|
+
/**
|
|
16
|
+
* Extended execution context for tools that need session and bus access.
|
|
17
|
+
*
|
|
18
|
+
* Extends MakaioContext with optional sessionId and bus properties for tools
|
|
19
|
+
* that need to:
|
|
20
|
+
* - Correlate operations with a specific session (sessionId)
|
|
21
|
+
* - Emit events or make requests during execution (bus)
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* const result = await tool.execute(input, {
|
|
25
|
+
* cwd: '/workspace',
|
|
26
|
+
* env: { NODE_ENV: 'development' },
|
|
27
|
+
* platform: 'posix',
|
|
28
|
+
* sessionId: 'session-123',
|
|
29
|
+
* bus: makaioBus,
|
|
30
|
+
* });
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
interface ToolExecutionContext extends MakaioContext {
|
|
34
|
+
/**
|
|
35
|
+
* Session identifier for multi-session task correlation.
|
|
36
|
+
* Tools can use this to associate work with a specific session.
|
|
37
|
+
*/
|
|
38
|
+
sessionId?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Agent identifier for attribution (optional).
|
|
41
|
+
* Provided when tool execution is tied to a specific agent.
|
|
42
|
+
*/
|
|
43
|
+
agentId?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Adapter identifier for adapter-scoped runtime behavior.
|
|
46
|
+
* Provided when the caller knows the concrete runtime adapter instance.
|
|
47
|
+
*/
|
|
48
|
+
adapterId?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Adapter name for adapter-scoped runtime behavior.
|
|
51
|
+
* Preferred when the caller wants stable logical adapter identity.
|
|
52
|
+
*/
|
|
53
|
+
adapterName?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Turn identifier for attribution (optional).
|
|
56
|
+
* Provided when tool execution occurs within a specific turn.
|
|
57
|
+
*/
|
|
58
|
+
turnId?: string;
|
|
59
|
+
/**
|
|
60
|
+
* Turn-scoped context contributed by PreUserMessage hooks.
|
|
61
|
+
* Toolsets can use this for session-bound execution metadata.
|
|
62
|
+
*/
|
|
63
|
+
turnContext?: Record<string, unknown>;
|
|
64
|
+
/**
|
|
65
|
+
* Tool call ID for the current invocation.
|
|
66
|
+
* Provided when the tool is executed as part of a structured tool call
|
|
67
|
+
* (e.g., from an LLM response). Allows tools to correlate their execution
|
|
68
|
+
* with the originating tool call in the adapter.
|
|
69
|
+
*/
|
|
70
|
+
toolCallId?: string;
|
|
71
|
+
/**
|
|
72
|
+
* Bus instance for event communication.
|
|
73
|
+
* Tools can use this to emit events (e.g., task.created, task.updated).
|
|
74
|
+
*/
|
|
75
|
+
bus?: BusLike;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Tool metadata containing descriptive information.
|
|
79
|
+
*/
|
|
80
|
+
interface ToolMetadata {
|
|
81
|
+
/** Unique tool name (identifier) */
|
|
82
|
+
name: string;
|
|
83
|
+
/** Human-readable description */
|
|
84
|
+
description: string;
|
|
85
|
+
/** Optional behavior annotations */
|
|
86
|
+
annotations?: ToolAnnotations$1;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Structured error returned from failed tool executions.
|
|
90
|
+
*/
|
|
91
|
+
interface ToolError {
|
|
92
|
+
/** Error code for programmatic handling */
|
|
93
|
+
code: string;
|
|
94
|
+
/** Human-readable error message */
|
|
95
|
+
message: string;
|
|
96
|
+
/** Optional additional error context */
|
|
97
|
+
details?: unknown;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Successful tool execution result.
|
|
101
|
+
* @typeParam T - Type of the success data
|
|
102
|
+
*/
|
|
103
|
+
type ToolSuccess<T> = {
|
|
104
|
+
success: true;
|
|
105
|
+
data: T;
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* Failed tool execution result.
|
|
109
|
+
* Used for functions that always return an error (like toolError, errorToToolResult).
|
|
110
|
+
*/
|
|
111
|
+
type ToolFailure = {
|
|
112
|
+
success: false;
|
|
113
|
+
error: ToolError;
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* Discriminated union result type for tool executions.
|
|
117
|
+
* Always returns either success with data or failure with error.
|
|
118
|
+
* @typeParam T - Type of the success data
|
|
119
|
+
* @example
|
|
120
|
+
* ```typescript
|
|
121
|
+
* const result: ToolResult<string> = await tool.execute(input, context);
|
|
122
|
+
* if (result.success) {
|
|
123
|
+
* console.debug(result.data); // string
|
|
124
|
+
* } else {
|
|
125
|
+
* console.error(result.error.message);
|
|
126
|
+
* }
|
|
127
|
+
* ```
|
|
128
|
+
*/
|
|
129
|
+
type ToolResult<T> = ToolSuccess<T> | ToolFailure;
|
|
130
|
+
/**
|
|
131
|
+
* Base tool definition interface with erased type parameters.
|
|
132
|
+
*
|
|
133
|
+
* Use this type for collections (arrays, records) where specific input/output
|
|
134
|
+
* types are not needed. For type-safe individual tools, use ToolDefinition.
|
|
135
|
+
*/
|
|
136
|
+
interface AnyToolDefinition {
|
|
137
|
+
/** Tool metadata (name, description, annotations) */
|
|
138
|
+
metadata: ToolMetadata;
|
|
139
|
+
/** Zod schema for input validation */
|
|
140
|
+
inputSchema: z.ZodTypeAny;
|
|
141
|
+
/** Zod schema for output validation */
|
|
142
|
+
outputSchema: z.ZodTypeAny;
|
|
143
|
+
/**
|
|
144
|
+
* Execute the tool with validated input.
|
|
145
|
+
* Method syntax enables bivariant checking, allowing ToolDefinition<T>
|
|
146
|
+
* to be assignable to AnyToolDefinition for use in collections.
|
|
147
|
+
* @param input - Validated input matching inputSchema
|
|
148
|
+
* @param context - Execution context with cwd, env, platform, sessionId, adapter identity, bus, etc.
|
|
149
|
+
* @returns Promise resolving to success with data or failure with error
|
|
150
|
+
*/
|
|
151
|
+
execute(input: unknown, context: ToolExecutionContext): Promise<ToolResult<unknown>>;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Core tool definition interface.
|
|
155
|
+
*
|
|
156
|
+
* A tool is a pure function with validated input/output schemas.
|
|
157
|
+
* Tools receive a MakaioContext for execution environment information.
|
|
158
|
+
*
|
|
159
|
+
* For collections of tools (toolsets, arrays), use AnyToolDefinition which
|
|
160
|
+
* erases the type parameters to avoid TypeScript variance issues.
|
|
161
|
+
* @typeParam TInput - Zod schema for input validation
|
|
162
|
+
* @typeParam TOutput - Zod schema for output validation
|
|
163
|
+
* @example
|
|
164
|
+
* ```typescript
|
|
165
|
+
* const readFileTool: ToolDefinition<typeof ReadFileInputSchema, typeof ReadFileOutputSchema> = {
|
|
166
|
+
* metadata: {
|
|
167
|
+
* name: 'readFile',
|
|
168
|
+
* description: 'Reads a file from the filesystem',
|
|
169
|
+
* annotations: { readOnly: true },
|
|
170
|
+
* },
|
|
171
|
+
* inputSchema: ReadFileInputSchema,
|
|
172
|
+
* outputSchema: ReadFileOutputSchema,
|
|
173
|
+
* execute: async (input, context) => {
|
|
174
|
+
* // Implementation...
|
|
175
|
+
* return { success: true, data: content };
|
|
176
|
+
* },
|
|
177
|
+
* };
|
|
178
|
+
* ```
|
|
179
|
+
*/
|
|
180
|
+
interface ToolDefinition<TInput extends z.ZodTypeAny = z.ZodTypeAny, TOutput extends z.ZodTypeAny = z.ZodTypeAny> {
|
|
181
|
+
/** Tool metadata (name, description, annotations) */
|
|
182
|
+
metadata: ToolMetadata;
|
|
183
|
+
/** Zod schema for input validation */
|
|
184
|
+
inputSchema: TInput;
|
|
185
|
+
/** Zod schema for output validation */
|
|
186
|
+
outputSchema: TOutput;
|
|
187
|
+
/**
|
|
188
|
+
* Execute the tool with validated input.
|
|
189
|
+
* Method syntax enables bivariant checking, allowing ToolDefinition<T>
|
|
190
|
+
* to be assignable to AnyToolDefinition for use in collections.
|
|
191
|
+
* @param input - Validated input matching inputSchema
|
|
192
|
+
* @param context - Execution context with cwd, env, platform, sessionId, adapter identity, bus, etc.
|
|
193
|
+
* @returns Promise resolving to success with data or failure with error
|
|
194
|
+
*/
|
|
195
|
+
execute(input: z.infer<TInput>, context: ToolExecutionContext): Promise<ToolResult<z.infer<TOutput>>>;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Toolset metadata for grouping related tools.
|
|
199
|
+
*/
|
|
200
|
+
interface ToolsetMetadata {
|
|
201
|
+
/** Unique toolset name */
|
|
202
|
+
name: string;
|
|
203
|
+
/** Human-readable description */
|
|
204
|
+
description: string;
|
|
205
|
+
/** Semantic version string */
|
|
206
|
+
version: string;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* A collection of related tools with shared metadata.
|
|
210
|
+
*
|
|
211
|
+
* Toolsets provide logical grouping and versioning for tools.
|
|
212
|
+
* Uses AnyToolDefinition to avoid TypeScript variance issues with
|
|
213
|
+
* heterogeneous tool collections.
|
|
214
|
+
* @typeParam TTools - Record type mapping tool names to definitions
|
|
215
|
+
* @example
|
|
216
|
+
* ```typescript
|
|
217
|
+
* const filesystemToolset: Toolset = {
|
|
218
|
+
* metadata: {
|
|
219
|
+
* name: 'filesystem',
|
|
220
|
+
* description: 'File system operations',
|
|
221
|
+
* version: '1.0.0',
|
|
222
|
+
* },
|
|
223
|
+
* tools: {
|
|
224
|
+
* readFile: readFileTool,
|
|
225
|
+
* writeFile: writeFileTool,
|
|
226
|
+
* },
|
|
227
|
+
* };
|
|
228
|
+
* ```
|
|
229
|
+
*/
|
|
230
|
+
interface Toolset<TTools extends Record<string, AnyToolDefinition> = Record<string, AnyToolDefinition>> {
|
|
231
|
+
/** Toolset metadata */
|
|
232
|
+
metadata: ToolsetMetadata;
|
|
233
|
+
/** Map of tool names to definitions */
|
|
234
|
+
tools: TTools;
|
|
235
|
+
/** Optional Zod schema for toolset configuration (used for UI generation) */
|
|
236
|
+
configSchema?: z.ZodTypeAny;
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Info structure returned from registry list operations.
|
|
240
|
+
* Includes inputSchema as JSON Schema for format conversion (e.g., OpenAI).
|
|
241
|
+
*/
|
|
242
|
+
interface ToolInfo {
|
|
243
|
+
/** Tool name */
|
|
244
|
+
name: string;
|
|
245
|
+
/** Tool description */
|
|
246
|
+
description: string;
|
|
247
|
+
/** Toolset this tool belongs to */
|
|
248
|
+
toolsetName: string;
|
|
249
|
+
/** Optional behavior annotations */
|
|
250
|
+
annotations?: ToolAnnotations$1;
|
|
251
|
+
/** JSON Schema for input parameters (for format conversion) */
|
|
252
|
+
inputSchema?: Record<string, unknown>;
|
|
253
|
+
}
|
|
254
|
+
//#endregion
|
|
255
|
+
//#region packages/tools-core/src/errors.d.ts
|
|
256
|
+
/**
|
|
257
|
+
* Standard error codes for tool execution failures.
|
|
258
|
+
* Use these codes for consistent error handling across tools.
|
|
259
|
+
*/
|
|
260
|
+
declare const ToolErrorCodes: {
|
|
261
|
+
/** Tool not found in registry */readonly TOOL_NOT_FOUND: "TOOL_NOT_FOUND"; /** Input validation failed against schema */
|
|
262
|
+
readonly VALIDATION_FAILED: "VALIDATION_FAILED"; /** Tool execution not permitted */
|
|
263
|
+
readonly PERMISSION_DENIED: "PERMISSION_DENIED"; /** Tool execution timed out */
|
|
264
|
+
readonly TIMEOUT: "TIMEOUT"; /** Tool was aborted via signal */
|
|
265
|
+
readonly ABORTED: "ABORTED"; /** Generic execution error */
|
|
266
|
+
readonly EXECUTION_ERROR: "EXECUTION_ERROR"; /** Tool returned invalid output */
|
|
267
|
+
readonly INVALID_OUTPUT: "INVALID_OUTPUT"; /** Required resource not found */
|
|
268
|
+
readonly RESOURCE_NOT_FOUND: "RESOURCE_NOT_FOUND"; /** Resource limit exceeded (e.g., max concurrent shells) */
|
|
269
|
+
readonly RESOURCE_EXHAUSTED: "RESOURCE_EXHAUSTED"; /** Internal tool error */
|
|
270
|
+
readonly INTERNAL_ERROR: "INTERNAL_ERROR";
|
|
271
|
+
};
|
|
272
|
+
type ToolErrorCode = (typeof ToolErrorCodes)[keyof typeof ToolErrorCodes];
|
|
273
|
+
/**
|
|
274
|
+
* Error class for tool execution failures.
|
|
275
|
+
* Provides structured error information and conversion to ToolError format.
|
|
276
|
+
* @example
|
|
277
|
+
* ```typescript
|
|
278
|
+
* throw new ToolExecutionError(
|
|
279
|
+
* ToolErrorCodes.VALIDATION_FAILED,
|
|
280
|
+
* 'Input path must be absolute',
|
|
281
|
+
* { path: input.path }
|
|
282
|
+
* );
|
|
283
|
+
* ```
|
|
284
|
+
*/
|
|
285
|
+
declare class ToolExecutionError extends Error {
|
|
286
|
+
readonly code: string;
|
|
287
|
+
readonly details?: unknown | undefined;
|
|
288
|
+
/**
|
|
289
|
+
* Creates a new ToolExecutionError.
|
|
290
|
+
* @param code - Error code from ToolErrorCodes
|
|
291
|
+
* @param message - Human-readable error message
|
|
292
|
+
* @param details - Optional additional error context
|
|
293
|
+
*/
|
|
294
|
+
constructor(code: string, message: string, details?: unknown | undefined);
|
|
295
|
+
/**
|
|
296
|
+
* Converts the error to a ToolError object for result formatting.
|
|
297
|
+
* @returns ToolError suitable for ToolResult
|
|
298
|
+
*/
|
|
299
|
+
toToolError(): ToolError;
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* Creates a failed ToolResult from error parameters.
|
|
303
|
+
* @param code - Error code
|
|
304
|
+
* @param message - Error message
|
|
305
|
+
* @param details - Optional error details
|
|
306
|
+
* @returns Failed ToolResult with error information
|
|
307
|
+
* @example
|
|
308
|
+
* ```typescript
|
|
309
|
+
* if (!fileExists) {
|
|
310
|
+
* return toolError(
|
|
311
|
+
* ToolErrorCodes.RESOURCE_NOT_FOUND,
|
|
312
|
+
* `File not found: ${path}`
|
|
313
|
+
* );
|
|
314
|
+
* }
|
|
315
|
+
* ```
|
|
316
|
+
*/
|
|
317
|
+
declare function toolError(code: string, message: string, details?: unknown): ToolFailure;
|
|
318
|
+
/**
|
|
319
|
+
* Creates a successful ToolResult with data.
|
|
320
|
+
* @typeParam T - Type of the success data
|
|
321
|
+
* @param data - Success data to wrap
|
|
322
|
+
* @returns Successful ToolResult with data
|
|
323
|
+
* @example
|
|
324
|
+
* ```typescript
|
|
325
|
+
* const content = await fs.readFile(path, 'utf-8');
|
|
326
|
+
* return toolSuccess({ content });
|
|
327
|
+
* ```
|
|
328
|
+
*/
|
|
329
|
+
declare function toolSuccess<T>(data: T): ToolSuccess<T>;
|
|
330
|
+
/**
|
|
331
|
+
* Converts an unknown error to a ToolResult.
|
|
332
|
+
* Preserves ToolExecutionError details or wraps other errors.
|
|
333
|
+
* @param error - Error to convert
|
|
334
|
+
* @param defaultCode - Error code to use for non-ToolExecutionError
|
|
335
|
+
* @returns Failed ToolResult with error information
|
|
336
|
+
*/
|
|
337
|
+
declare function errorToToolResult(error: unknown, defaultCode?: string): ToolFailure;
|
|
338
|
+
//#endregion
|
|
339
|
+
//#region packages/tools-core/src/define-tool.d.ts
|
|
340
|
+
/**
|
|
341
|
+
* Configuration object for defining a tool.
|
|
342
|
+
* Provides ergonomic API for creating ToolDefinition instances.
|
|
343
|
+
* @typeParam TInput - Zod schema type for input validation
|
|
344
|
+
* @typeParam TOutput - Zod schema type for output validation
|
|
345
|
+
*/
|
|
346
|
+
interface DefineToolConfig<TInput extends z.ZodTypeAny, TOutput extends z.ZodTypeAny> {
|
|
347
|
+
/** Unique tool name (identifier) */
|
|
348
|
+
name: string;
|
|
349
|
+
/** Human-readable description of what the tool does */
|
|
350
|
+
description: string;
|
|
351
|
+
/** Optional behavior annotations for consumers */
|
|
352
|
+
annotations?: ToolAnnotations$1;
|
|
353
|
+
/** Zod schema for input validation */
|
|
354
|
+
inputSchema: TInput;
|
|
355
|
+
/** Zod schema for output validation */
|
|
356
|
+
outputSchema: TOutput;
|
|
357
|
+
/**
|
|
358
|
+
* Tool execution function.
|
|
359
|
+
* @param input - Validated input matching inputSchema
|
|
360
|
+
* @param context - Execution context with cwd, env, platform, sessionId, bus, etc.
|
|
361
|
+
* @returns Promise resolving to success with data or failure with error
|
|
362
|
+
*/
|
|
363
|
+
execute: (input: z.infer<TInput>, context: ToolExecutionContext) => Promise<ToolResult<z.infer<TOutput>>>;
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* Creates a ToolDefinition from a configuration object.
|
|
367
|
+
*
|
|
368
|
+
* Provides a clean builder API for defining tools with full type inference.
|
|
369
|
+
* The returned ToolDefinition can be used directly or registered with a toolset.
|
|
370
|
+
* @typeParam TInput - Zod schema type for input validation
|
|
371
|
+
* @typeParam TOutput - Zod schema type for output validation
|
|
372
|
+
* @param config - Tool configuration
|
|
373
|
+
* @returns Fully typed ToolDefinition
|
|
374
|
+
* @example
|
|
375
|
+
* ```typescript
|
|
376
|
+
* import { z } from 'zod';
|
|
377
|
+
* import { defineTool, toolSuccess, toolError, ToolErrorCodes } from '@makaio/framework/tools';
|
|
378
|
+
*
|
|
379
|
+
* const ReadFileInputSchema = z.object({
|
|
380
|
+
* path: z.string().describe('File path to read'),
|
|
381
|
+
* encoding: z.enum(['utf-8', 'base64']).default('utf-8'),
|
|
382
|
+
* });
|
|
383
|
+
*
|
|
384
|
+
* const ReadFileOutputSchema = z.object({
|
|
385
|
+
* content: z.string(),
|
|
386
|
+
* size: z.number(),
|
|
387
|
+
* });
|
|
388
|
+
*
|
|
389
|
+
* const readFileTool = defineTool({
|
|
390
|
+
* name: 'readFile',
|
|
391
|
+
* description: 'Reads a file from the filesystem',
|
|
392
|
+
* annotations: { readOnly: true },
|
|
393
|
+
* inputSchema: ReadFileInputSchema,
|
|
394
|
+
* outputSchema: ReadFileOutputSchema,
|
|
395
|
+
* execute: async (input, context) => {
|
|
396
|
+
* const fullPath = path.resolve(context.cwd, input.path);
|
|
397
|
+
*
|
|
398
|
+
* try {
|
|
399
|
+
* const content = await fs.readFile(fullPath, input.encoding);
|
|
400
|
+
* const stats = await fs.stat(fullPath);
|
|
401
|
+
* return toolSuccess({ content, size: stats.size });
|
|
402
|
+
* } catch (err) {
|
|
403
|
+
* return toolError(
|
|
404
|
+
* ToolErrorCodes.RESOURCE_NOT_FOUND,
|
|
405
|
+
* `Failed to read file: ${fullPath}`
|
|
406
|
+
* );
|
|
407
|
+
* }
|
|
408
|
+
* },
|
|
409
|
+
* });
|
|
410
|
+
* ```
|
|
411
|
+
*/
|
|
412
|
+
declare function defineTool<TInput extends z.ZodTypeAny, TOutput extends z.ZodTypeAny>(config: DefineToolConfig<TInput, TOutput>): ToolDefinition<TInput, TOutput>;
|
|
413
|
+
//#endregion
|
|
414
|
+
//#region packages/tools-core/src/define-toolset.d.ts
|
|
415
|
+
/**
|
|
416
|
+
* Input type for tools parameter in defineToolset.
|
|
417
|
+
* Accepts a record, single tool, or array of tools for flexibility.
|
|
418
|
+
* Uses AnyToolDefinition to avoid TypeScript variance issues.
|
|
419
|
+
*/
|
|
420
|
+
type ToolsInput = Record<string, AnyToolDefinition> | AnyToolDefinition | AnyToolDefinition[];
|
|
421
|
+
/**
|
|
422
|
+
* Configuration object for defining a toolset.
|
|
423
|
+
*/
|
|
424
|
+
interface DefineToolsetConfig<TTools extends ToolsInput> {
|
|
425
|
+
/** Unique toolset name */
|
|
426
|
+
name: string;
|
|
427
|
+
/** Human-readable description */
|
|
428
|
+
description: string;
|
|
429
|
+
/** Semantic version string */
|
|
430
|
+
version: string;
|
|
431
|
+
/**
|
|
432
|
+
* Tools to include in the toolset.
|
|
433
|
+
* Can be:
|
|
434
|
+
* - A record of named tools
|
|
435
|
+
* - A single tool (uses tool.metadata.name as key)
|
|
436
|
+
* - An array of tools (uses each tool.metadata.name as key)
|
|
437
|
+
*/
|
|
438
|
+
tools: TTools;
|
|
439
|
+
/** Optional Zod schema for toolset configuration (used for UI generation) */
|
|
440
|
+
configSchema?: z.ZodTypeAny;
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
443
|
+
* Extracts the Record type from various tools input formats.
|
|
444
|
+
* Used for type inference in defineToolset return type.
|
|
445
|
+
*/
|
|
446
|
+
type ExtractToolsRecord<T extends ToolsInput> = T extends Record<string, AnyToolDefinition> ? T : T extends AnyToolDefinition ? Record<string, AnyToolDefinition> : T extends AnyToolDefinition[] ? Record<string, AnyToolDefinition> : Record<string, AnyToolDefinition>;
|
|
447
|
+
/**
|
|
448
|
+
* Creates a Toolset from a configuration object.
|
|
449
|
+
*
|
|
450
|
+
* Provides flexibility in how tools are specified:
|
|
451
|
+
* - As a record with explicit keys
|
|
452
|
+
* - As a single tool (uses tool name as key)
|
|
453
|
+
* - As an array of tools (uses each tool name as key)
|
|
454
|
+
* @typeParam TTools - Input tools type (record, single, or array)
|
|
455
|
+
* @param config - Toolset configuration
|
|
456
|
+
* @returns Toolset with normalized tools record
|
|
457
|
+
* @example
|
|
458
|
+
* ```typescript
|
|
459
|
+
* // With a record (explicit keys)
|
|
460
|
+
* const fsToolset = defineToolset({
|
|
461
|
+
* name: 'filesystem',
|
|
462
|
+
* description: 'File system operations',
|
|
463
|
+
* version: '1.0.0',
|
|
464
|
+
* tools: {
|
|
465
|
+
* read: readFileTool,
|
|
466
|
+
* write: writeFileTool,
|
|
467
|
+
* delete: deleteFileTool,
|
|
468
|
+
* },
|
|
469
|
+
* });
|
|
470
|
+
*
|
|
471
|
+
* // With a single tool
|
|
472
|
+
* const singleToolset = defineToolset({
|
|
473
|
+
* name: 'echo',
|
|
474
|
+
* description: 'Echo utility',
|
|
475
|
+
* version: '1.0.0',
|
|
476
|
+
* tools: echoTool,
|
|
477
|
+
* });
|
|
478
|
+
*
|
|
479
|
+
* // With an array
|
|
480
|
+
* const arrayToolset = defineToolset({
|
|
481
|
+
* name: 'utilities',
|
|
482
|
+
* description: 'Utility tools',
|
|
483
|
+
* version: '1.0.0',
|
|
484
|
+
* tools: [echoTool, sleepTool, dateTool],
|
|
485
|
+
* });
|
|
486
|
+
* ```
|
|
487
|
+
*/
|
|
488
|
+
declare function defineToolset<TTools extends ToolsInput>(config: DefineToolsetConfig<TTools>): Toolset<ExtractToolsRecord<TTools>>;
|
|
489
|
+
//#endregion
|
|
490
|
+
//#region packages/tools-core/src/export.d.ts
|
|
491
|
+
type JSONSchema = zCore.JSONSchema.JSONSchema;
|
|
492
|
+
/**
|
|
493
|
+
* MCP (Model Context Protocol) tool definition.
|
|
494
|
+
* @see https://spec.modelcontextprotocol.io/specification/server/tools/
|
|
495
|
+
*/
|
|
496
|
+
interface McpToolDefinition {
|
|
497
|
+
/** Tool name (unique identifier) */
|
|
498
|
+
name: string;
|
|
499
|
+
/** Human-readable description */
|
|
500
|
+
description: string;
|
|
501
|
+
/** JSON Schema for input parameters */
|
|
502
|
+
inputSchema: JSONSchema;
|
|
503
|
+
/**
|
|
504
|
+
* Optional annotations providing hints about tool behavior.
|
|
505
|
+
* MCP clients may use these to optimize tool usage.
|
|
506
|
+
*/
|
|
507
|
+
annotations?: {
|
|
508
|
+
/** Tool only reads data, doesn't modify anything */readOnly?: boolean; /** Tool may permanently delete or modify data */
|
|
509
|
+
destructive?: boolean; /** Calling the tool multiple times with same input has same effect */
|
|
510
|
+
idempotent?: boolean; /** Execution may take a long time */
|
|
511
|
+
openWorldHint?: boolean;
|
|
512
|
+
};
|
|
513
|
+
}
|
|
514
|
+
/**
|
|
515
|
+
* OpenAI function calling definition.
|
|
516
|
+
* @see https://platform.openai.com/docs/guides/function-calling
|
|
517
|
+
*/
|
|
518
|
+
interface OpenAIFunctionDefinition {
|
|
519
|
+
/** Function name */
|
|
520
|
+
name: string;
|
|
521
|
+
/** Human-readable description */
|
|
522
|
+
description: string;
|
|
523
|
+
/** JSON Schema for function parameters */
|
|
524
|
+
parameters: JSONSchema;
|
|
525
|
+
}
|
|
526
|
+
/** Valid target formats for JSON Schema generation */
|
|
527
|
+
type SchemaTarget = 'jsonSchema7' | 'jsonSchema2019-09' | 'openApi3' | 'openAi';
|
|
528
|
+
/**
|
|
529
|
+
* Options for schema conversion.
|
|
530
|
+
*/
|
|
531
|
+
interface ExportOptions {
|
|
532
|
+
/**
|
|
533
|
+
* Target schema version.
|
|
534
|
+
* - 'jsonSchema7' (default): JSON Schema Draft-07
|
|
535
|
+
* - 'jsonSchema2019-09': JSON Schema 2019-09
|
|
536
|
+
* - 'openApi3': OpenAPI 3.0 compatible
|
|
537
|
+
* - 'openAi': OpenAI function calling compatible
|
|
538
|
+
*/
|
|
539
|
+
schemaTarget?: SchemaTarget;
|
|
540
|
+
/**
|
|
541
|
+
* Whether to remove $schema property from output.
|
|
542
|
+
* Default is true for cleaner output.
|
|
543
|
+
*/
|
|
544
|
+
removeSchema?: boolean;
|
|
545
|
+
}
|
|
546
|
+
/**
|
|
547
|
+
* Converts a ToolDefinition to MCP tool format.
|
|
548
|
+
* @param tool - Makaio tool definition
|
|
549
|
+
* @returns MCP-compatible tool definition
|
|
550
|
+
* @example
|
|
551
|
+
* ```typescript
|
|
552
|
+
* const mcpTool = toMcpTool(readFileTool);
|
|
553
|
+
* // Result:
|
|
554
|
+
* // {
|
|
555
|
+
* // name: 'readFile',
|
|
556
|
+
* // description: 'Reads a file from the filesystem',
|
|
557
|
+
* // inputSchema: { type: 'object', properties: { path: { type: 'string' } }, ... },
|
|
558
|
+
* // annotations: { readOnly: true }
|
|
559
|
+
* // }
|
|
560
|
+
* ```
|
|
561
|
+
*/
|
|
562
|
+
declare function toMcpTool(tool: AnyToolDefinition): McpToolDefinition;
|
|
563
|
+
/**
|
|
564
|
+
* Converts a ToolDefinition to OpenAI function format.
|
|
565
|
+
* @param tool - Makaio tool definition
|
|
566
|
+
* @returns OpenAI-compatible function definition
|
|
567
|
+
* @example
|
|
568
|
+
* ```typescript
|
|
569
|
+
* const openAIFunc = toOpenAIFunction(readFileTool);
|
|
570
|
+
* // Result:
|
|
571
|
+
* // {
|
|
572
|
+
* // name: 'readFile',
|
|
573
|
+
* // description: 'Reads a file from the filesystem',
|
|
574
|
+
* // parameters: { type: 'object', properties: { path: { type: 'string' } }, ... }
|
|
575
|
+
* // }
|
|
576
|
+
* ```
|
|
577
|
+
*/
|
|
578
|
+
declare function toOpenAIFunction(tool: AnyToolDefinition): OpenAIFunctionDefinition;
|
|
579
|
+
/**
|
|
580
|
+
* Converts all tools in a Toolset to MCP format.
|
|
581
|
+
* @param toolset - Makaio toolset
|
|
582
|
+
* @returns Array of MCP-compatible tool definitions
|
|
583
|
+
* @example
|
|
584
|
+
* ```typescript
|
|
585
|
+
* const mcpTools = toolsetToMcpTools(filesystemToolset);
|
|
586
|
+
* // Returns array of MCP tool definitions for all tools in the toolset
|
|
587
|
+
* ```
|
|
588
|
+
*/
|
|
589
|
+
declare function toolsetToMcpTools(toolset: Toolset): McpToolDefinition[];
|
|
590
|
+
/**
|
|
591
|
+
* Converts all tools in a Toolset to OpenAI function format.
|
|
592
|
+
* @param toolset - Makaio toolset
|
|
593
|
+
* @returns Array of OpenAI-compatible function definitions
|
|
594
|
+
* @example
|
|
595
|
+
* ```typescript
|
|
596
|
+
* const openAIFunctions = toolsetToOpenAIFunctions(filesystemToolset);
|
|
597
|
+
* // Returns array of OpenAI function definitions for all tools in the toolset
|
|
598
|
+
* ```
|
|
599
|
+
*/
|
|
600
|
+
declare function toolsetToOpenAIFunctions(toolset: Toolset): OpenAIFunctionDefinition[];
|
|
601
|
+
//#endregion
|
|
602
|
+
//#region packages/tools-core/src/memory-store.d.ts
|
|
603
|
+
/**
|
|
604
|
+
* Generic memory store for managing working memory instances across sessions.
|
|
605
|
+
*
|
|
606
|
+
* Provides session-keyed isolation for state when tool instances are
|
|
607
|
+
* singleton in the registry.
|
|
608
|
+
*
|
|
609
|
+
* Type Parameters:
|
|
610
|
+
* - T: The working memory class type
|
|
611
|
+
* - TArgs: Constructor arguments for the working memory class
|
|
612
|
+
* @example
|
|
613
|
+
* ```typescript
|
|
614
|
+
* class MyMemoryStore extends MemoryStore<MyWorkingMemory, [string]> {
|
|
615
|
+
* constructor() {
|
|
616
|
+
* super((sessionId) => new MyWorkingMemory(sessionId));
|
|
617
|
+
* }
|
|
618
|
+
* }
|
|
619
|
+
*
|
|
620
|
+
* const store = new MyMemoryStore();
|
|
621
|
+
* const memory = store.get('session-123');
|
|
622
|
+
* store.delete('session-123');
|
|
623
|
+
* ```
|
|
624
|
+
*/
|
|
625
|
+
declare class MemoryStore<T, TArgs extends unknown[]> {
|
|
626
|
+
private factory;
|
|
627
|
+
private sessions;
|
|
628
|
+
/**
|
|
629
|
+
* Creates a new memory store.
|
|
630
|
+
* @param factory - Factory function to create new memory instances
|
|
631
|
+
*/
|
|
632
|
+
constructor(factory: (sessionId: string, ...args: TArgs) => T);
|
|
633
|
+
/**
|
|
634
|
+
* Gets or creates working memory for a session.
|
|
635
|
+
* Returns the same instance for the same sessionId.
|
|
636
|
+
* @param sessionId - Session identifier
|
|
637
|
+
* @param args - Additional arguments passed to the factory
|
|
638
|
+
* @returns Working memory instance for the session
|
|
639
|
+
*/
|
|
640
|
+
get(sessionId: string, ...args: TArgs): T;
|
|
641
|
+
/**
|
|
642
|
+
* Checks if a session has working memory.
|
|
643
|
+
* @param sessionId - Session identifier
|
|
644
|
+
* @returns true if session exists
|
|
645
|
+
*/
|
|
646
|
+
has(sessionId: string): boolean;
|
|
647
|
+
/**
|
|
648
|
+
* Deletes session memory (for cleanup on session close).
|
|
649
|
+
* @param sessionId - Session identifier
|
|
650
|
+
* @returns true if deleted, false if not found
|
|
651
|
+
*/
|
|
652
|
+
delete(sessionId: string): boolean;
|
|
653
|
+
/**
|
|
654
|
+
* Iterates over all session memories.
|
|
655
|
+
* @returns Iterator of [sessionId, memory] pairs
|
|
656
|
+
*/
|
|
657
|
+
entries(): IterableIterator<[string, T]>;
|
|
658
|
+
/**
|
|
659
|
+
* Returns all session IDs with active memory.
|
|
660
|
+
* @returns Array of session IDs
|
|
661
|
+
*/
|
|
662
|
+
sessionIds(): string[];
|
|
663
|
+
/**
|
|
664
|
+
* Returns the number of sessions with active memory.
|
|
665
|
+
* @returns Session count
|
|
666
|
+
*/
|
|
667
|
+
get size(): number;
|
|
668
|
+
}
|
|
669
|
+
//#endregion
|
|
670
|
+
//#region packages/tools-core/src/tool-utils.d.ts
|
|
671
|
+
/**
|
|
672
|
+
* Validates that sessionId is present in the context.
|
|
673
|
+
* @param context - Tool execution context
|
|
674
|
+
* @param entityName - Name of entity for error message (e.g., 'artifact', 'task')
|
|
675
|
+
* @returns Session ID if valid, or error result
|
|
676
|
+
*/
|
|
677
|
+
declare function validateSessionId(context: ToolExecutionContext, entityName?: string): {
|
|
678
|
+
valid: true;
|
|
679
|
+
sessionId: string;
|
|
680
|
+
} | {
|
|
681
|
+
valid: false;
|
|
682
|
+
error: ToolResult<never>;
|
|
683
|
+
};
|
|
684
|
+
/**
|
|
685
|
+
* Emits an event on the bus if available.
|
|
686
|
+
*
|
|
687
|
+
* The subject must be a properly typed subject definition from a registered namespace.
|
|
688
|
+
* Type inference ensures the payload matches the subject's schema at compile time.
|
|
689
|
+
* @param context - Tool execution context
|
|
690
|
+
* @param subject - Typed subject definition from a registered namespace
|
|
691
|
+
* @param payload - Event payload matching the subject's schema
|
|
692
|
+
* @example
|
|
693
|
+
* ```typescript
|
|
694
|
+
* import { TaskSubjects } from '@makaio/tools-tasks/subjects';
|
|
695
|
+
*
|
|
696
|
+
* await emitEvent(context, TaskSubjects.created, {
|
|
697
|
+
* taskId: '123',
|
|
698
|
+
* title: 'Fix bug',
|
|
699
|
+
* });
|
|
700
|
+
* ```
|
|
701
|
+
*/
|
|
702
|
+
declare function emitEvent<S extends {
|
|
703
|
+
$meta: {
|
|
704
|
+
payload: unknown;
|
|
705
|
+
};
|
|
706
|
+
}>(context: ToolExecutionContext, subject: S, payload: S['$meta']['payload']): Promise<void>;
|
|
707
|
+
/**
|
|
708
|
+
* Operation handler function type for CRUD tools.
|
|
709
|
+
*
|
|
710
|
+
* Handler functions receive the operation-specific input, validated sessionId,
|
|
711
|
+
* and execution context.
|
|
712
|
+
*
|
|
713
|
+
* Type parameters:
|
|
714
|
+
* - TInput: The operation-specific input type (extracted from discriminated union)
|
|
715
|
+
* - TOutput: The tool's output type
|
|
716
|
+
*/
|
|
717
|
+
type OperationHandler<TInput, TOutput> = (input: TInput, sessionId: string, context: ToolExecutionContext) => Promise<ToolResult<TOutput>>;
|
|
718
|
+
/**
|
|
719
|
+
* Handler map for discriminated union CRUD operations.
|
|
720
|
+
*
|
|
721
|
+
* Maps operation names (discriminator values) to their handler functions.
|
|
722
|
+
*
|
|
723
|
+
* Type parameters:
|
|
724
|
+
* - TInput: The full discriminated union input type
|
|
725
|
+
* - TOutput: The tool's output type
|
|
726
|
+
*/
|
|
727
|
+
type OperationHandlers<TInput extends {
|
|
728
|
+
op: string;
|
|
729
|
+
}, TOutput> = { [K in TInput['op']]: OperationHandler<Extract<TInput, {
|
|
730
|
+
op: K;
|
|
731
|
+
}>, TOutput> };
|
|
732
|
+
/**
|
|
733
|
+
* Executes a CRUD tool operation with session validation and operation routing.
|
|
734
|
+
*
|
|
735
|
+
* This helper consolidates the common pattern of:
|
|
736
|
+
* 1. Validating sessionId from context
|
|
737
|
+
* 2. Routing to operation-specific handlers based on discriminated union
|
|
738
|
+
*
|
|
739
|
+
* The input type must be a discriminated union with an `op` field.
|
|
740
|
+
* Handler functions are provided in a map keyed by operation name.
|
|
741
|
+
*
|
|
742
|
+
* Type parameters:
|
|
743
|
+
* - TInput: Discriminated union input type with `op` field
|
|
744
|
+
* - TOutput: Tool output type
|
|
745
|
+
* @param input - The tool input with operation discriminator
|
|
746
|
+
* @param context - Tool execution context
|
|
747
|
+
* @param entityName - Entity name for validation error messages (e.g., 'task', 'artifact')
|
|
748
|
+
* @param handlers - Map of operation names to handler functions
|
|
749
|
+
* @returns Tool result from the appropriate operation handler
|
|
750
|
+
* @example
|
|
751
|
+
* ```typescript
|
|
752
|
+
* export const myTool = defineTool({
|
|
753
|
+
* name: 'my_tool',
|
|
754
|
+
* inputSchema: z.discriminatedUnion('op', [
|
|
755
|
+
* z.object({ op: z.literal('create'), data: z.string() }),
|
|
756
|
+
* z.object({ op: z.literal('list') }),
|
|
757
|
+
* ]),
|
|
758
|
+
* execute: async (input, context) => {
|
|
759
|
+
* return executeCrudOperation(input, context, 'item', {
|
|
760
|
+
* create: async (input, sessionId, context) => {
|
|
761
|
+
* // Handle create...
|
|
762
|
+
* },
|
|
763
|
+
* list: async (input, sessionId, context) => {
|
|
764
|
+
* // Handle list...
|
|
765
|
+
* },
|
|
766
|
+
* });
|
|
767
|
+
* },
|
|
768
|
+
* });
|
|
769
|
+
* ```
|
|
770
|
+
*/
|
|
771
|
+
declare function executeCrudOperation<TInput extends {
|
|
772
|
+
op: string;
|
|
773
|
+
}, TOutput>(input: TInput, context: ToolExecutionContext, entityName: string, handlers: OperationHandlers<TInput, TOutput>): Promise<ToolResult<TOutput>>;
|
|
774
|
+
//#endregion
|
|
775
|
+
//#region packages/tools-core/src/widen-tool.d.ts
|
|
776
|
+
/**
|
|
777
|
+
* Widens a strongly-typed tool definition for use in heterogeneous collections.
|
|
778
|
+
*
|
|
779
|
+
* Tool definitions are invariant in their input/output generic parameters. This
|
|
780
|
+
* helper provides a single canonical widening point for `defineToolset({ tools: [...] })`
|
|
781
|
+
* call sites that need `AnyToolDefinition`.
|
|
782
|
+
* @param tool - Strongly-typed tool definition
|
|
783
|
+
* @returns The same tool typed as AnyToolDefinition
|
|
784
|
+
*/
|
|
785
|
+
declare function widenTool<TInput extends z.ZodTypeAny, TOutput extends z.ZodTypeAny>(tool: ToolDefinition<TInput, TOutput>): AnyToolDefinition;
|
|
786
|
+
//#endregion
|
|
787
|
+
//#region packages/tools-core/src/file-access.d.ts
|
|
788
|
+
/**
|
|
789
|
+
* Compiled file access rules injected into tool execution context constraints.
|
|
790
|
+
*/
|
|
791
|
+
interface FileAccessRules {
|
|
792
|
+
/**
|
|
793
|
+
* Directory allow-list.
|
|
794
|
+
* - `undefined`: no directory restriction
|
|
795
|
+
* - `[]`: deny all filesystem paths
|
|
796
|
+
* - non-empty array: allow-list to these directories
|
|
797
|
+
*/
|
|
798
|
+
readonly allowedDirectories?: readonly string[];
|
|
799
|
+
/**
|
|
800
|
+
* Sync predicate that returns true when the absolute path is denied.
|
|
801
|
+
* @param absolutePath - Normalized absolute path to test
|
|
802
|
+
*/
|
|
803
|
+
readonly isDenied: (absolutePath: string) => boolean;
|
|
804
|
+
}
|
|
805
|
+
/**
|
|
806
|
+
* Provides filesystem access rules for a given working directory.
|
|
807
|
+
* @param cwd - Absolute working directory
|
|
808
|
+
* @param allowedDirectories - Directory allow-list from the active execution policy
|
|
809
|
+
*/
|
|
810
|
+
type FileAccessRuleProvider = (cwd: string, allowedDirectories?: readonly string[]) => Promise<FileAccessRules>;
|
|
811
|
+
/** Constraints key for FileAccessRules in MakaioContext.constraints. */
|
|
812
|
+
declare const FILE_ACCESS_RULES_KEY: "fileAccessRules";
|
|
813
|
+
/**
|
|
814
|
+
* Extract the target file path from a filesystem tool call's arguments.
|
|
815
|
+
*
|
|
816
|
+
* Returns the resolved absolute path, or `null` if the tool is not a known
|
|
817
|
+
* filesystem tool or the args don't contain the expected path field.
|
|
818
|
+
* @param toolName - Name of the tool being called
|
|
819
|
+
* @param args - Tool arguments record
|
|
820
|
+
* @param cwd - Working directory to resolve relative paths against
|
|
821
|
+
* @returns Absolute path to the target file, or `null` if not applicable
|
|
822
|
+
*/
|
|
823
|
+
declare function extractToolFilePath(toolName: string | undefined, args: Record<string, unknown> | undefined, cwd: string): string | null;
|
|
824
|
+
//#endregion
|
|
825
|
+
export { type AnyToolDefinition, type BusLike, type DefineToolConfig, type DefineToolsetConfig, type ExportOptions, FILE_ACCESS_RULES_KEY, type FileAccessRuleProvider, type FileAccessRules, type McpToolDefinition, MemoryStore, type OpenAIFunctionDefinition, type ToolAnnotations, type ToolDefinition, type ToolError, type ToolErrorCode, ToolErrorCodes, type ToolExecutionContext, ToolExecutionError, type ToolFailure, type ToolInfo, type ToolMetadata, type ToolResult, type ToolSuccess, type Toolset, type ToolsetMetadata, defineTool, defineToolset, emitEvent, errorToToolResult, executeCrudOperation, extractToolFilePath, toMcpTool, toOpenAIFunction, toolError, toolSuccess, toolsetToMcpTools, toolsetToOpenAIFunctions, validateSessionId, widenTool };
|