@skaile/workspaces 3.27.0 → 4.0.0
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/CHANGELOG.md +480 -0
- package/dist/app-sdk/index.js +1 -1
- package/dist/{asset-feeds-AJOUKX55.js → asset-feeds-OPG6SUXU.js} +11 -9
- package/dist/asset-feeds-OPG6SUXU.js.map +1 -0
- package/dist/asset-manager/catalog-deployer.js +5 -3
- package/dist/asset-manager/index.js +11 -9
- package/dist/asset-manager/installer.js +8 -6
- package/dist/asset-manager/renderers.js +2 -2
- package/dist/asset-manager/src/renderers.d.ts.map +1 -1
- package/dist/bridge/drivers/claude-sdk.js +102 -55
- package/dist/bridge/drivers/claude-sdk.js.map +1 -1
- package/dist/bridge/drivers/codex.js +178 -22
- package/dist/bridge/drivers/codex.js.map +1 -1
- package/dist/bridge/drivers/continue.js +199 -7
- package/dist/bridge/drivers/continue.js.map +1 -1
- package/dist/bridge/drivers/echo.js +10 -4
- package/dist/bridge/drivers/echo.js.map +1 -1
- package/dist/bridge/drivers/gemini.js +7 -4
- package/dist/bridge/drivers/goose.js +160 -7
- package/dist/bridge/drivers/goose.js.map +1 -1
- package/dist/bridge/drivers/omp.js +321 -96
- package/dist/bridge/drivers/omp.js.map +1 -1
- package/dist/bridge/drivers/opencode.js +148 -13
- package/dist/bridge/drivers/opencode.js.map +1 -1
- package/dist/bridge/drivers/qwen.js +41 -11
- package/dist/bridge/drivers/qwen.js.map +1 -1
- package/dist/bridge/index.js +12 -9
- package/dist/bridge/src/cloud.d.ts +62 -71
- package/dist/bridge/src/cloud.d.ts.map +1 -1
- package/dist/bridge/src/codex/config-toml.d.ts +128 -0
- package/dist/bridge/src/codex/config-toml.d.ts.map +1 -0
- package/dist/bridge/src/codex/credentials.d.ts +26 -0
- package/dist/bridge/src/codex/credentials.d.ts.map +1 -1
- package/dist/bridge/src/codex/managed-driver.d.ts.map +1 -1
- package/dist/bridge/src/drivers/_subprocess-cli.d.ts +9 -4
- package/dist/bridge/src/drivers/_subprocess-cli.d.ts.map +1 -1
- package/dist/bridge/src/drivers/claude-sdk.d.ts +19 -11
- package/dist/bridge/src/drivers/claude-sdk.d.ts.map +1 -1
- package/dist/bridge/src/drivers/codex.d.ts +26 -1
- package/dist/bridge/src/drivers/codex.d.ts.map +1 -1
- package/dist/bridge/src/drivers/continue.d.ts +31 -5
- package/dist/bridge/src/drivers/continue.d.ts.map +1 -1
- package/dist/bridge/src/drivers/echo.d.ts.map +1 -1
- package/dist/bridge/src/drivers/gemini.d.ts +34 -3
- package/dist/bridge/src/drivers/gemini.d.ts.map +1 -1
- package/dist/bridge/src/drivers/goose.d.ts +26 -2
- package/dist/bridge/src/drivers/goose.d.ts.map +1 -1
- package/dist/bridge/src/drivers/omp-models-yml.d.ts +216 -0
- package/dist/bridge/src/drivers/omp-models-yml.d.ts.map +1 -0
- package/dist/bridge/src/drivers/omp.d.ts +26 -23
- package/dist/bridge/src/drivers/omp.d.ts.map +1 -1
- package/dist/bridge/src/drivers/opencode.d.ts +28 -3
- package/dist/bridge/src/drivers/opencode.d.ts.map +1 -1
- package/dist/bridge/src/drivers/qwen.d.ts +10 -4
- package/dist/bridge/src/drivers/qwen.d.ts.map +1 -1
- package/dist/bridge/src/index.d.ts +3 -1
- package/dist/bridge/src/index.d.ts.map +1 -1
- package/dist/bridge/src/models.d.ts +118 -19
- package/dist/bridge/src/models.d.ts.map +1 -1
- package/dist/bridge/src/provider-catalog.d.ts +188 -0
- package/dist/bridge/src/provider-catalog.d.ts.map +1 -0
- package/dist/bridge/src/provider-materialize/continue-config-yaml.d.ts +117 -0
- package/dist/bridge/src/provider-materialize/continue-config-yaml.d.ts.map +1 -0
- package/dist/bridge/src/provider-materialize/credential-env.d.ts +103 -0
- package/dist/bridge/src/provider-materialize/credential-env.d.ts.map +1 -0
- package/dist/bridge/src/provider-materialize/env-drivers.d.ts +209 -0
- package/dist/bridge/src/provider-materialize/env-drivers.d.ts.map +1 -0
- package/dist/bridge/src/provider-materialize/goose-custom-providers.d.ts +127 -0
- package/dist/bridge/src/provider-materialize/goose-custom-providers.d.ts.map +1 -0
- package/dist/bridge/src/provider-materialize/opencode-config.d.ts +127 -0
- package/dist/bridge/src/provider-materialize/opencode-config.d.ts.map +1 -0
- package/dist/bridge/src/provider-materialize/session-config-home.d.ts +63 -0
- package/dist/bridge/src/provider-materialize/session-config-home.d.ts.map +1 -0
- package/dist/bridge/src/provider-registry-derive.d.ts +59 -0
- package/dist/bridge/src/provider-registry-derive.d.ts.map +1 -0
- package/dist/bridge/src/registry.d.ts +19 -7
- package/dist/bridge/src/registry.d.ts.map +1 -1
- package/dist/bridge/src/runtime.d.ts.map +1 -1
- package/dist/bridge/src/types.d.ts +79 -60
- package/dist/bridge/src/types.d.ts.map +1 -1
- package/dist/bridge/src/validation.d.ts +2 -3
- package/dist/bridge/src/validation.d.ts.map +1 -1
- package/dist/{chunk-GURXUF2J.js → chunk-3ZTQY276.js} +95 -80
- package/dist/chunk-3ZTQY276.js.map +1 -0
- package/dist/{chunk-T3YLZQS4.js → chunk-45LLHKQ2.js} +24 -3
- package/dist/chunk-45LLHKQ2.js.map +1 -0
- package/dist/{chunk-UAEGKCE5.js → chunk-5IIHO2HI.js} +7 -7
- package/dist/{chunk-UAEGKCE5.js.map → chunk-5IIHO2HI.js.map} +1 -1
- package/dist/{chunk-HSRHO7SK.js → chunk-C3QLJTMB.js} +106 -150
- package/dist/chunk-C3QLJTMB.js.map +1 -0
- package/dist/chunk-CUU3AMGE.js +500 -0
- package/dist/chunk-CUU3AMGE.js.map +1 -0
- package/dist/{chunk-K6VZQNTR.js → chunk-DKCFWSVW.js} +3 -3
- package/dist/{chunk-K6VZQNTR.js.map → chunk-DKCFWSVW.js.map} +1 -1
- package/dist/{chunk-AEN2UFDN.js → chunk-DNGAA24M.js} +7 -7
- package/dist/{chunk-AEN2UFDN.js.map → chunk-DNGAA24M.js.map} +1 -1
- package/dist/{chunk-TCHEW3T2.js → chunk-EBHY23RZ.js} +6 -6
- package/dist/{chunk-TCHEW3T2.js.map → chunk-EBHY23RZ.js.map} +1 -1
- package/dist/{chunk-MQASB52N.js → chunk-FEFTOV2Y.js} +3 -3
- package/dist/{chunk-MQASB52N.js.map → chunk-FEFTOV2Y.js.map} +1 -1
- package/dist/{chunk-XMULHVKX.js → chunk-FODAC4RE.js} +17 -15
- package/dist/chunk-FODAC4RE.js.map +1 -0
- package/dist/{chunk-6H6HLMWG.js → chunk-G2F3ZCPK.js} +3 -3
- package/dist/{chunk-6H6HLMWG.js.map → chunk-G2F3ZCPK.js.map} +1 -1
- package/dist/{chunk-YLL65VXQ.js → chunk-HO2FQ76C.js} +175 -178
- package/dist/chunk-HO2FQ76C.js.map +1 -0
- package/dist/chunk-ILG4BXYE.js +936 -0
- package/dist/chunk-ILG4BXYE.js.map +1 -0
- package/dist/{chunk-E7HKNQTH.js → chunk-JXCUUZA3.js} +3 -4
- package/dist/chunk-JXCUUZA3.js.map +1 -0
- package/dist/{chunk-MBARHWMZ.js → chunk-K27T47OO.js} +79 -53
- package/dist/chunk-K27T47OO.js.map +1 -0
- package/dist/chunk-K3YR33F6.js +187 -0
- package/dist/chunk-K3YR33F6.js.map +1 -0
- package/dist/{chunk-7P6ASOFL.js → chunk-KIQGTAJ5.js} +3 -3
- package/dist/{chunk-7P6ASOFL.js.map → chunk-KIQGTAJ5.js.map} +1 -1
- package/dist/chunk-KSIRR5PL.js +142 -0
- package/dist/chunk-KSIRR5PL.js.map +1 -0
- package/dist/{chunk-SIREWRZE.js → chunk-KW7YIRYL.js} +3 -3
- package/dist/{chunk-SIREWRZE.js.map → chunk-KW7YIRYL.js.map} +1 -1
- package/dist/{chunk-3U3ZKYR7.js → chunk-LN2BQVRB.js} +139 -29
- package/dist/chunk-LN2BQVRB.js.map +1 -0
- package/dist/{chunk-DZ4UZOFB.js → chunk-M5H4DWIA.js} +3 -3
- package/dist/{chunk-DZ4UZOFB.js.map → chunk-M5H4DWIA.js.map} +1 -1
- package/dist/{chunk-JMYOJ3PA.js → chunk-MIP4IC3O.js} +3 -3
- package/dist/{chunk-JMYOJ3PA.js.map → chunk-MIP4IC3O.js.map} +1 -1
- package/dist/{chunk-O5JUZIVR.js → chunk-MJY2BO6N.js} +6 -6
- package/dist/{chunk-O5JUZIVR.js.map → chunk-MJY2BO6N.js.map} +1 -1
- package/dist/{chunk-AN6NAFRT.js → chunk-N7B3LZ7V.js} +31 -6
- package/dist/chunk-N7B3LZ7V.js.map +1 -0
- package/dist/{chunk-MX6TGDZ7.js → chunk-NBPL76HH.js} +5 -5
- package/dist/{chunk-MX6TGDZ7.js.map → chunk-NBPL76HH.js.map} +1 -1
- package/dist/{chunk-DY5GHUTC.js → chunk-NR6BPOW5.js} +2 -7
- package/dist/chunk-NR6BPOW5.js.map +1 -0
- package/dist/{chunk-F2GEM5B3.js → chunk-PCJF3XBH.js} +10 -10
- package/dist/{chunk-F2GEM5B3.js.map → chunk-PCJF3XBH.js.map} +1 -1
- package/dist/{chunk-NW65H5EV.js → chunk-PTETBRRC.js} +3 -3
- package/dist/{chunk-NW65H5EV.js.map → chunk-PTETBRRC.js.map} +1 -1
- package/dist/{chunk-UL4LD7KD.js → chunk-QQL3ET3J.js} +3 -3
- package/dist/{chunk-UL4LD7KD.js.map → chunk-QQL3ET3J.js.map} +1 -1
- package/dist/{chunk-IB4XKQMQ.js → chunk-REILIKVM.js} +3 -3
- package/dist/{chunk-IB4XKQMQ.js.map → chunk-REILIKVM.js.map} +1 -1
- package/dist/{chunk-N27DSFA7.js → chunk-RM4C5AU3.js} +27 -21
- package/dist/chunk-RM4C5AU3.js.map +1 -0
- package/dist/chunk-SG4D2UOK.js +843 -0
- package/dist/chunk-SG4D2UOK.js.map +1 -0
- package/dist/{chunk-AU4TUVHW.js → chunk-T7RHDVSY.js} +4 -4
- package/dist/{chunk-AU4TUVHW.js.map → chunk-T7RHDVSY.js.map} +1 -1
- package/dist/{chunk-773WLEXL.js → chunk-UKWEJPZZ.js} +3 -3
- package/dist/{chunk-773WLEXL.js.map → chunk-UKWEJPZZ.js.map} +1 -1
- package/dist/{chunk-3NCGSSCU.js → chunk-WLFRA5RM.js} +47 -45
- package/dist/chunk-WLFRA5RM.js.map +1 -0
- package/dist/{chunk-FFE7YLYO.js → chunk-XEVWRSLS.js} +7 -7
- package/dist/chunk-XEVWRSLS.js.map +1 -0
- package/dist/{chunk-5UWAOYDN.js → chunk-Y6E62LFB.js} +9 -12
- package/dist/chunk-Y6E62LFB.js.map +1 -0
- package/dist/{chunk-72DG6GSB.js → chunk-YS4XBN7O.js} +4 -4
- package/dist/{chunk-72DG6GSB.js.map → chunk-YS4XBN7O.js.map} +1 -1
- package/dist/chunk-YSJKLJD4.js +32 -0
- package/dist/chunk-YSJKLJD4.js.map +1 -0
- package/dist/cli/index.js +765 -334
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/src/commands/config.d.ts +17 -6
- package/dist/cli/src/commands/config.d.ts.map +1 -1
- package/dist/cli/src/commands/migrate-legacy-entry.d.ts +46 -0
- package/dist/cli/src/commands/migrate-legacy-entry.d.ts.map +1 -0
- package/dist/cli/src/commands/migrate-providers.d.ts +93 -0
- package/dist/cli/src/commands/migrate-providers.d.ts.map +1 -0
- package/dist/cli/src/commands/providers.d.ts +89 -0
- package/dist/cli/src/commands/providers.d.ts.map +1 -0
- package/dist/cli/src/commands/run.d.ts +1 -1
- package/dist/cli/src/commands/run.d.ts.map +1 -1
- package/dist/cli/src/setup.d.ts +46 -6
- package/dist/cli/src/setup.d.ts.map +1 -1
- package/dist/connectors/config.js +6 -4
- package/dist/connectors/index.js +15 -12
- package/dist/core/index.js +5 -3
- package/dist/core/provider-registry-credentials.d.ts +2 -0
- package/dist/core/provider-registry-credentials.js +5 -0
- package/dist/core/provider-registry-credentials.js.map +1 -0
- package/dist/core/provider-registry.d.ts +2 -0
- package/dist/core/provider-registry.js +4 -0
- package/dist/core/provider-registry.js.map +1 -0
- package/dist/core/runtime-assets.js +2 -2
- package/dist/core/src/index.d.ts +10 -4
- package/dist/core/src/index.d.ts.map +1 -1
- package/dist/core/src/provider-registry-credentials.d.ts +50 -0
- package/dist/core/src/provider-registry-credentials.d.ts.map +1 -0
- package/dist/core/src/provider-registry-files.d.ts +97 -0
- package/dist/core/src/provider-registry-files.d.ts.map +1 -0
- package/dist/core/src/provider-registry.d.ts +450 -0
- package/dist/core/src/provider-registry.d.ts.map +1 -0
- package/dist/core/src/settings.d.ts +18 -78
- package/dist/core/src/settings.d.ts.map +1 -1
- package/dist/core/src/workspace-config.d.ts +31 -47
- package/dist/core/src/workspace-config.d.ts.map +1 -1
- package/dist/core/src/workspace-yaml-editor.d.ts.map +1 -1
- package/dist/core/workspace-config.js +1 -1
- package/dist/deploy/index.js +5 -3
- package/dist/deploy/index.js.map +1 -1
- package/dist/discovery/index.js +2 -2
- package/dist/{ensure-sources-DYGQNAJM.js → ensure-sources-QZAQ4SY2.js} +14 -12
- package/dist/ensure-sources-QZAQ4SY2.js.map +1 -0
- package/dist/factory-assets/connectors/box.js +15 -12
- package/dist/factory-assets/connectors/deploy.js +15 -12
- package/dist/factory-assets/connectors/devserver.js +15 -12
- package/dist/factory-assets/connectors/flow/adapter.js +15 -12
- package/dist/factory-assets/connectors/flow/engine.js +6 -4
- package/dist/factory-assets/connectors/flow/index.d.ts +1 -1
- package/dist/factory-assets/connectors/flow/index.d.ts.map +1 -1
- package/dist/factory-assets/connectors/flow/run-flow.d.ts +0 -3
- package/dist/factory-assets/connectors/flow/run-flow.d.ts.map +1 -1
- package/dist/factory-assets/connectors/flow/run-flow.js +16 -13
- package/dist/factory-assets/connectors/flow/subprompt-runner.d.ts +31 -28
- package/dist/factory-assets/connectors/flow/subprompt-runner.d.ts.map +1 -1
- package/dist/factory-assets/connectors/flow.js +15 -12
- package/dist/factory-assets/connectors/git.js +15 -12
- package/dist/factory-assets/connectors/gmail.js +15 -12
- package/dist/factory-assets/connectors/googledrive.js +15 -12
- package/dist/factory-assets/connectors/local.js +15 -12
- package/dist/factory-assets/connectors/mattermost.js +15 -12
- package/dist/factory-assets/connectors/memory.js +15 -12
- package/dist/factory-assets/connectors/minio.js +15 -12
- package/dist/factory-assets/connectors/postgres.js +15 -12
- package/dist/factory-assets/connectors/s3.js +15 -12
- package/dist/factory-assets/connectors/sharepoint.js +15 -12
- package/dist/factory-assets/connectors/sqlite.js +15 -12
- package/dist/factory-assets/connectors/static-server.js +15 -12
- package/dist/factory-assets/connectors/tunnel.js +15 -12
- package/dist/factory-assets/connectors/webdav.js +15 -12
- package/dist/factory-assets/connectors/xstate-store.js +15 -12
- package/dist/factory-assets/connectors/xstate.js +15 -12
- package/dist/{flows-MI2VM5JZ.js → flows-4EIENFNT.js} +9 -7
- package/dist/{flows-MI2VM5JZ.js.map → flows-4EIENFNT.js.map} +1 -1
- package/dist/{helpers-G6XZPN6L.js → helpers-DISRVGRJ.js} +14 -12
- package/dist/{helpers-G6XZPN6L.js.map → helpers-DISRVGRJ.js.map} +1 -1
- package/dist/library/index.js +8 -6
- package/dist/library/install.js +5 -3
- package/dist/{library-publish-WHGKK7G5.js → library-publish-I2QYQSB4.js} +18 -16
- package/dist/library-publish-I2QYQSB4.js.map +1 -0
- package/dist/{open-library-4JSLGWL6.js → open-library-6LM4W4DR.js} +16 -14
- package/dist/{open-library-4JSLGWL6.js.map → open-library-6LM4W4DR.js.map} +1 -1
- package/dist/paths-P26QGQP5.js +18 -0
- package/dist/{paths-CZEH643M.js.map → paths-P26QGQP5.js.map} +1 -1
- package/dist/plugin-registry/src/targets.d.ts +16 -2
- package/dist/plugin-registry/src/targets.d.ts.map +1 -1
- package/dist/{plugin-store-QJNBPIQK.js → plugin-store-T2DJGKBW.js} +7 -5
- package/dist/plugin-store-T2DJGKBW.js.map +1 -0
- package/dist/{project-LISE6I5O.js → project-HP3IR7RW.js} +15 -13
- package/dist/{project-LISE6I5O.js.map → project-HP3IR7RW.js.map} +1 -1
- package/dist/resolver/index.js +5 -3
- package/dist/runner/index.js +25 -22
- package/dist/runner/src/agent.d.ts +0 -2
- package/dist/runner/src/agent.d.ts.map +1 -1
- package/dist/runner/src/codex-init.d.ts.map +1 -1
- package/dist/runner/src/codex-resource-tools.d.ts.map +1 -1
- package/dist/runner/src/managed-codex-bootstrap.d.ts.map +1 -1
- package/dist/runner/src/resources.d.ts +1 -2
- package/dist/runner/src/resources.d.ts.map +1 -1
- package/dist/runner/src/serve.d.ts.map +1 -1
- package/dist/runner/src/session-builder.d.ts +31 -35
- package/dist/runner/src/session-builder.d.ts.map +1 -1
- package/dist/runner/src/session.d.ts +0 -2
- package/dist/runner/src/session.d.ts.map +1 -1
- package/dist/sdk/asset-manager.js +11 -9
- package/dist/sdk/bridge.js +12 -9
- package/dist/sdk/core.js +5 -3
- package/dist/sdk/flow.js +6 -4
- package/dist/sdk/index.js +25 -22
- package/dist/sdk/index.js.map +1 -1
- package/dist/sdk/resolver.js +5 -3
- package/dist/sdk/runner.js +25 -22
- package/dist/sdk/session.js +2 -2
- package/dist/sdk/types.js +1 -1
- package/dist/session/index.js +2 -2
- package/dist/setup-HLRSU3MR.js +435 -0
- package/dist/setup-HLRSU3MR.js.map +1 -0
- package/dist/{skills-IE3IWWB7.js → skills-QPYHHZ54.js} +7 -5
- package/dist/{skills-IE3IWWB7.js.map → skills-QPYHHZ54.js.map} +1 -1
- package/dist/{source-FKVEUOBQ.js → source-G2VCWPDU.js} +17 -15
- package/dist/{source-FKVEUOBQ.js.map → source-G2VCWPDU.js.map} +1 -1
- package/dist/{source-manifest-publish-LTRXO2OQ.js → source-manifest-publish-WYKCKJFC.js} +19 -17
- package/dist/source-manifest-publish-WYKCKJFC.js.map +1 -0
- package/dist/tui/index.js +25 -23
- package/dist/tui/index.js.map +1 -1
- package/dist/tui/src/repl.d.ts +0 -2
- package/dist/tui/src/repl.d.ts.map +1 -1
- package/dist/types/index.js +1 -1
- package/dist/types/manifests.js +1 -1
- package/dist/types/src/flow.d.ts +6 -1
- package/dist/types/src/flow.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/lifecycle.d.ts +35 -10
- package/dist/types/src/lifecycle.d.ts.map +1 -1
- package/dist/types/src/manifests/agent.d.ts +116 -22
- package/dist/types/src/manifests/agent.d.ts.map +1 -1
- package/dist/types/src/manifests/index.d.ts +2 -2
- package/dist/types/src/manifests/index.d.ts.map +1 -1
- package/dist/types/src/manifests/preset.d.ts +5 -5
- package/dist/types/src/runtime.d.ts +51 -5
- package/dist/types/src/runtime.d.ts.map +1 -1
- package/dist/types/src/version.d.ts +18 -2
- package/dist/types/src/version.d.ts.map +1 -1
- package/dist/validator-P5ESKTW5.js +5 -0
- package/dist/{validator-RN64BKFW.js.map → validator-P5ESKTW5.js.map} +1 -1
- package/dist/workspace-plugin/adapters/mcp.js +11 -9
- package/dist/workspace-plugin/adapters/omp.js +11 -11
- package/dist/workspace-plugin/adapters/omp.js.map +1 -1
- package/dist/workspace-plugin/index.js +1 -1
- package/dist/workspace-plugin/src/plugin.d.ts +1 -4
- package/dist/workspace-plugin/src/plugin.d.ts.map +1 -1
- package/dist/workspace-plugin/src/tools/validator.d.ts +4 -4
- package/dist/workspace-plugin/src/tools/validator.d.ts.map +1 -1
- package/package.json +13 -1
- package/dist/asset-feeds-AJOUKX55.js.map +0 -1
- package/dist/bridge/src/provider-endpoints.d.ts +0 -55
- package/dist/bridge/src/provider-endpoints.d.ts.map +0 -1
- package/dist/chunk-3NCGSSCU.js.map +0 -1
- package/dist/chunk-3U3ZKYR7.js.map +0 -1
- package/dist/chunk-5UWAOYDN.js.map +0 -1
- package/dist/chunk-AN6NAFRT.js.map +0 -1
- package/dist/chunk-AQW4BWNR.js +0 -324
- package/dist/chunk-AQW4BWNR.js.map +0 -1
- package/dist/chunk-DY5GHUTC.js.map +0 -1
- package/dist/chunk-E7HKNQTH.js.map +0 -1
- package/dist/chunk-FFE7YLYO.js.map +0 -1
- package/dist/chunk-FYIHH56K.js +0 -110
- package/dist/chunk-FYIHH56K.js.map +0 -1
- package/dist/chunk-GURXUF2J.js.map +0 -1
- package/dist/chunk-HSRHO7SK.js.map +0 -1
- package/dist/chunk-MBARHWMZ.js.map +0 -1
- package/dist/chunk-N27DSFA7.js.map +0 -1
- package/dist/chunk-T3YLZQS4.js.map +0 -1
- package/dist/chunk-XMULHVKX.js.map +0 -1
- package/dist/chunk-YLL65VXQ.js.map +0 -1
- package/dist/ensure-sources-DYGQNAJM.js.map +0 -1
- package/dist/library-publish-WHGKK7G5.js.map +0 -1
- package/dist/paths-CZEH643M.js +0 -16
- package/dist/plugin-store-QJNBPIQK.js.map +0 -1
- package/dist/runner/src/cloud-bundle.d.ts +0 -36
- package/dist/runner/src/cloud-bundle.d.ts.map +0 -1
- package/dist/setup-CIRH5BYB.js +0 -517
- package/dist/setup-CIRH5BYB.js.map +0 -1
- package/dist/source-manifest-publish-LTRXO2OQ.js.map +0 -1
- package/dist/validator-RN64BKFW.js +0 -5
|
@@ -1,25 +1,27 @@
|
|
|
1
|
-
export { buildWorkspaceMcpServer, buildWorkspaceMcpStdioServer, buildWorkspaceToolDefs, runMcpServerStdio } from '../../chunk-
|
|
2
|
-
import '../../chunk-
|
|
3
|
-
import '../../chunk-FUCYTGAE.js';
|
|
4
|
-
import '../../chunk-773WLEXL.js';
|
|
5
|
-
import '../../chunk-R6O6YWU7.js';
|
|
1
|
+
export { buildWorkspaceMcpServer, buildWorkspaceMcpStdioServer, buildWorkspaceToolDefs, runMcpServerStdio } from '../../chunk-XEVWRSLS.js';
|
|
2
|
+
import '../../chunk-UKWEJPZZ.js';
|
|
6
3
|
import '../../chunk-FAI2SMFE.js';
|
|
7
4
|
import '../../chunk-7IRJ4K4F.js';
|
|
5
|
+
import '../../chunk-JXCUUZA3.js';
|
|
6
|
+
import '../../chunk-FUCYTGAE.js';
|
|
7
|
+
import '../../chunk-R6O6YWU7.js';
|
|
8
8
|
import '../../chunk-X5YPJV4N.js';
|
|
9
9
|
import '../../chunk-3XXQPHGL.js';
|
|
10
10
|
import '../../chunk-7BUZQVRR.js';
|
|
11
|
-
import '../../chunk-
|
|
12
|
-
import '../../chunk-
|
|
11
|
+
import '../../chunk-YS4XBN7O.js';
|
|
12
|
+
import '../../chunk-C3QLJTMB.js';
|
|
13
|
+
import '../../chunk-REILIKVM.js';
|
|
13
14
|
import '../../chunk-F3HNW354.js';
|
|
14
15
|
import '../../chunk-K5GBV4SA.js';
|
|
15
16
|
import '../../chunk-QVZA2MDT.js';
|
|
16
|
-
import '../../chunk-
|
|
17
|
-
import '../../chunk-MBARHWMZ.js';
|
|
17
|
+
import '../../chunk-K27T47OO.js';
|
|
18
18
|
import '../../chunk-MENCWIHW.js';
|
|
19
19
|
import '../../chunk-P4VHQA4N.js';
|
|
20
20
|
import '../../chunk-MKZOK4JU.js';
|
|
21
21
|
import '../../chunk-GEEW6SY2.js';
|
|
22
22
|
import '../../chunk-FTG7CRFD.js';
|
|
23
|
+
import '../../chunk-KSIRR5PL.js';
|
|
24
|
+
import '../../chunk-ILG4BXYE.js';
|
|
23
25
|
import '../../chunk-W4IPN3DD.js';
|
|
24
26
|
import '../../chunk-NSBPE2FW.js';
|
|
25
27
|
//# sourceMappingURL=mcp.js.map
|
|
@@ -74,7 +74,7 @@ function buildOmpToolSet(plugin) {
|
|
|
74
74
|
description: "List all available flow definitions from ai-assets.",
|
|
75
75
|
parameters: {},
|
|
76
76
|
handler: async () => {
|
|
77
|
-
const { flowList } = await import('../../flows-
|
|
77
|
+
const { flowList } = await import('../../flows-4EIENFNT.js');
|
|
78
78
|
return (await flowList(plugin.projectDir)).content[0].text;
|
|
79
79
|
}
|
|
80
80
|
},
|
|
@@ -83,7 +83,7 @@ function buildOmpToolSet(plugin) {
|
|
|
83
83
|
description: "List past flow run sessions for this workspace.",
|
|
84
84
|
parameters: {},
|
|
85
85
|
handler: async () => {
|
|
86
|
-
const { flowListSessions } = await import('../../flows-
|
|
86
|
+
const { flowListSessions } = await import('../../flows-4EIENFNT.js');
|
|
87
87
|
return (await flowListSessions(plugin.projectDir)).content[0].text;
|
|
88
88
|
}
|
|
89
89
|
},
|
|
@@ -92,7 +92,7 @@ function buildOmpToolSet(plugin) {
|
|
|
92
92
|
description: "List all skills in the ai-assets catalog.",
|
|
93
93
|
parameters: { domain: { type: "string", optional: true } },
|
|
94
94
|
handler: async ({ domain }) => {
|
|
95
|
-
const { skillList } = await import('../../skills-
|
|
95
|
+
const { skillList } = await import('../../skills-QPYHHZ54.js');
|
|
96
96
|
return (await skillList(plugin.projectDir, domain)).content[0].text;
|
|
97
97
|
}
|
|
98
98
|
},
|
|
@@ -101,7 +101,7 @@ function buildOmpToolSet(plugin) {
|
|
|
101
101
|
description: "Search skills by name, description, or keywords.",
|
|
102
102
|
parameters: { query: { type: "string" } },
|
|
103
103
|
handler: async ({ query }) => {
|
|
104
|
-
const { skillSearch } = await import('../../skills-
|
|
104
|
+
const { skillSearch } = await import('../../skills-QPYHHZ54.js');
|
|
105
105
|
return (await skillSearch(plugin.projectDir, query)).content[0].text;
|
|
106
106
|
}
|
|
107
107
|
},
|
|
@@ -110,7 +110,7 @@ function buildOmpToolSet(plugin) {
|
|
|
110
110
|
description: "Show the full SKILL.md content for a skill.",
|
|
111
111
|
parameters: { skill_id: { type: "string" } },
|
|
112
112
|
handler: async ({ skill_id }) => {
|
|
113
|
-
const { skillShow } = await import('../../skills-
|
|
113
|
+
const { skillShow } = await import('../../skills-QPYHHZ54.js');
|
|
114
114
|
return (await skillShow(plugin.projectDir, skill_id)).content[0].text;
|
|
115
115
|
}
|
|
116
116
|
},
|
|
@@ -163,7 +163,7 @@ function buildOmpToolSet(plugin) {
|
|
|
163
163
|
description: "Run a full health check on the workspace config.",
|
|
164
164
|
parameters: {},
|
|
165
165
|
handler: async () => {
|
|
166
|
-
const { workspaceValidate } = await import('../../validator-
|
|
166
|
+
const { workspaceValidate } = await import('../../validator-P5ESKTW5.js');
|
|
167
167
|
return (await workspaceValidate(plugin, plugin.driver ?? "omp")).content[0].text;
|
|
168
168
|
}
|
|
169
169
|
},
|
|
@@ -172,8 +172,8 @@ function buildOmpToolSet(plugin) {
|
|
|
172
172
|
description: "Show workspace configuration (driver, model, resource counts).",
|
|
173
173
|
parameters: {},
|
|
174
174
|
handler: async () => {
|
|
175
|
-
const { workspaceInfo } = await import('../../validator-
|
|
176
|
-
return (await workspaceInfo(plugin, plugin.driver ?? "omp", plugin.
|
|
175
|
+
const { workspaceInfo } = await import('../../validator-P5ESKTW5.js');
|
|
176
|
+
return (await workspaceInfo(plugin, plugin.driver ?? "omp", plugin.model)).content[0].text;
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
179
|
];
|
|
@@ -201,7 +201,7 @@ async function handleSlashCommand(plugin, group, args) {
|
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
203
|
async function handleFlowCommand(plugin, sub, rest) {
|
|
204
|
-
const { flowList, flowShow, flowListSessions, flowGetSession } = await import('../../flows-
|
|
204
|
+
const { flowList, flowShow, flowListSessions, flowGetSession } = await import('../../flows-4EIENFNT.js');
|
|
205
205
|
if (!sub || sub === "list") return (await flowList(plugin.projectDir)).content[0].text;
|
|
206
206
|
if (sub === "show" && rest[0])
|
|
207
207
|
return (await flowShow(plugin.projectDir, rest[0])).content[0].text;
|
|
@@ -230,7 +230,7 @@ async function handleConnectorCommand(plugin, sub, rest) {
|
|
|
230
230
|
return "Usage: /connector list | read <id> <path> | exec <id> <op> [json-args] | describe <id>";
|
|
231
231
|
}
|
|
232
232
|
async function handleSkillCommand(plugin, sub, rest) {
|
|
233
|
-
const { skillList, skillShow, skillSearch } = await import('../../skills-
|
|
233
|
+
const { skillList, skillShow, skillSearch } = await import('../../skills-QPYHHZ54.js');
|
|
234
234
|
if (sub === "run" && rest[0])
|
|
235
235
|
return (await skillShow(plugin.projectDir, rest[0])).content[0].text;
|
|
236
236
|
if (!sub || sub === "list") return (await skillList(plugin.projectDir, rest[0])).content[0].text;
|
|
@@ -250,7 +250,7 @@ async function handleMountsCommand(plugin, sub, rest) {
|
|
|
250
250
|
return "Usage: /mounts list | sync <id> | status <id>";
|
|
251
251
|
}
|
|
252
252
|
async function handleValidateCommand(plugin) {
|
|
253
|
-
const { workspaceValidate } = await import('../../validator-
|
|
253
|
+
const { workspaceValidate } = await import('../../validator-P5ESKTW5.js');
|
|
254
254
|
return (await workspaceValidate(plugin, plugin.driver ?? "omp")).content[0].text;
|
|
255
255
|
}
|
|
256
256
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../workspace-plugin/src/adapters/omp.ts"],"names":[],"mappings":";;;AAyBO,SAAS,wBAAwB,UAAA,EAA4B;AAClE,EAAA,MAAM,OAAA,GAAU,IAAA,CAAK,SAAA,CAAU,UAAU,CAAA;AACzC,EAAA,OAAO,CAAA;AAAA;AAAA;AAAA,kEAAA,EAG2D,UAAU;AAAA;;AAAA,iDAAA,EAG3B,OAAO,CAAA;;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAuC1D;AAsBO,SAAS,gBAAgB,MAAA,EAAoC;AAClE,EAAA,OAAO;AAAA,IACL;AAAA,MACE,IAAA,EAAM,YAAA;AAAA,MACN,WAAA,EAAa,kEAAA;AAAA,MACb,YAAY,EAAC;AAAA,MACb,SAAS,YAAY;AACnB,QAAA,MAAM,EAAE,SAAA,EAAU,GAAI,MAAM,OAAO,8BAAwB,CAAA;AAC3D,QAAA,OAAA,CAAQ,MAAM,SAAA,CAAU,MAAA,CAAO,gBAAgB,CAAA,EAAG,OAAA,CAAQ,CAAC,CAAA,CAAE,IAAA;AAAA,MAC/D;AAAA,KACF;AAAA,IACA;AAAA,MACE,IAAA,EAAM,YAAA;AAAA,MACN,WAAA,EAAa,yCAAA;AAAA,MAC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acePlugin } from \"../plugin.js\";\n\n// ── Extension source generator (STATELESS) ──────────────────────────────────\n// This function generates the .omp/extensions/skaile.ts file content.\n// It is stateless — takes only projectDir, does not require a booted plugin.\n// OMP tool set in the generated file is intentionally a reduced subset\n// (high-frequency tools only) — the full set is available via the MCP adapter.\n\n/**\n * Generate the `.omp/extensions/skaile.ts` file content for a given project.\n *\n * Stateless — accepts only `projectDir` and embeds it as a JSON string\n * literal in the generated TypeScript source. No `boot()` or plugin instance\n * is required; this function is safe to call from install commands.\n *\n * The generated file exports `onInit`, `tools`, and `slashCommands` as\n * required by the OMP extension API.\n *\n * @param projectDir - Absolute path to the skaile project root (embedded in\n * the generated source).\n * @returns A TypeScript source string ready to be written to\n * `.omp/extensions/skaile.ts`.\n *\n * @docLink packages/workspace-plugin/concepts#adapters\n */\nexport function buildOmpExtensionSource(projectDir: string): string {\n const escaped = JSON.stringify(projectDir);\n return `// .omp/extensions/skaile.ts\n// Generated by: skaile plugin install --driver omp\n// or: skaile repl --driver omp (ephemeral — removed on exit)\n// Re-generate: skaile plugin install --driver omp --project-dir ${projectDir}\nimport { WorkspacePlugin } from \"@skaile/workspaces/workspace-plugin\";\n\nconst plugin = new WorkspacePlugin({ projectDir: ${escaped}, bootOwned: true });\n\nexport async function onInit() {\n await plugin.boot();\n return { systemPromptAppend: plugin.buildSystemPromptSection() };\n}\n\nexport function tools() {\n return plugin.buildOmpToolSet();\n}\n\nexport const slashCommands = [\n {\n name: \"/flow\",\n description: \"Flow inspection: /flow list | show <id> | sessions | session <runId>\",\n handler: (args: string[]) => plugin.handleSlashCommand(\"flow\", args),\n },\n {\n name: \"/connector\",\n description: \"Connector CRUD: /connector list | read <id> <path> | exec <id> <op> [json-args] | describe <id>\",\n handler: (args: string[]) => plugin.handleSlashCommand(\"connector\", args),\n },\n {\n name: \"/skill\",\n description: \"Skill catalog: /skill list [domain] | show <id> | search <query> | run <id>\",\n handler: (args: string[]) => plugin.handleSlashCommand(\"skill\", args),\n },\n {\n name: \"/mounts\",\n description: \"Mount management: /mounts list | sync <id> | status <id>\",\n handler: (args: string[]) => plugin.handleSlashCommand(\"mounts\", args),\n },\n {\n name: \"/validate\",\n description: \"Validate workspace config (skaile.yaml)\",\n handler: () => plugin.handleSlashCommand(\"validate\", []),\n },\n];\n`;\n}\n\n// ── OMP tool set builder ──────────────────────────────────────────────────────\n// OMP tool definition shape: { name, description, parameters, handler }\n// This is a reduced subset of the MCP tool surface (high-frequency tools only).\n\n/**\n * Build the OMP-native tool set for a booted `WorkspacePlugin`.\n *\n * Returns 13 tool objects in OMP's `{ name, description, parameters, handler }`\n * shape — a high-frequency subset of the 28 MCP tools. The full tool surface\n * is available via the MCP adapter.\n *\n * Included tools: `mount_list`, `mount_sync`, `flow_list`, `flow_list_sessions`,\n * `skill_list`, `skill_search`, `skill_show`, `connector_list`, `connector_read`,\n * `connector_exec`, `session_list`, `workspace_validate`, `workspace_info`.\n *\n * @param plugin - A booted `WorkspacePlugin` instance.\n * @returns Array of OMP tool definition objects.\n *\n * @docLink packages/workspace-plugin/concepts#adapters\n */\nexport function buildOmpToolSet(plugin: WorkspacePlugin): unknown[] {\n return [\n {\n name: \"mount_list\",\n description: \"List all mounts declared in skaile.yaml with their mount status.\",\n parameters: {},\n handler: async () => {\n const { mountList } = await import(\"../tools/connectors.js\");\n return (await mountList(plugin.connectorManager)).content[0].text;\n },\n },\n {\n name: \"mount_sync\",\n description: \"Sync a mount (pull latest from remote).\",\n parameters: { mount_id: { type: \"string\" } },\n handler: async ({ mount_id }: { mount_id: string }) => {\n const { mountSync } = await import(\"../tools/connectors.js\");\n return (await mountSync(plugin.connectorManager, mount_id)).content[0].text;\n },\n },\n {\n name: \"flow_list\",\n description: \"List all available flow definitions from ai-assets.\",\n parameters: {},\n handler: async () => {\n const { flowList } = await import(\"../tools/flows.js\");\n return (await flowList(plugin.projectDir)).content[0].text;\n },\n },\n {\n name: \"flow_list_sessions\",\n description: \"List past flow run sessions for this workspace.\",\n parameters: {},\n handler: async () => {\n const { flowListSessions } = await import(\"../tools/flows.js\");\n return (await flowListSessions(plugin.projectDir)).content[0].text;\n },\n },\n {\n name: \"skill_list\",\n description: \"List all skills in the ai-assets catalog.\",\n parameters: { domain: { type: \"string\", optional: true } },\n handler: async ({ domain }: { domain?: string }) => {\n const { skillList } = await import(\"../tools/skills.js\");\n return (await skillList(plugin.projectDir, domain)).content[0].text;\n },\n },\n {\n name: \"skill_search\",\n description: \"Search skills by name, description, or keywords.\",\n parameters: { query: { type: \"string\" } },\n handler: async ({ query }: { query: string }) => {\n const { skillSearch } = await import(\"../tools/skills.js\");\n return (await skillSearch(plugin.projectDir, query)).content[0].text;\n },\n },\n {\n name: \"skill_show\",\n description: \"Show the full SKILL.md content for a skill.\",\n parameters: { skill_id: { type: \"string\" } },\n handler: async ({ skill_id }: { skill_id: string }) => {\n const { skillShow } = await import(\"../tools/skills.js\");\n return (await skillShow(plugin.projectDir, skill_id)).content[0].text;\n },\n },\n {\n name: \"connector_list\",\n description:\n \"List connectors declared in skaile.yaml as {connected, failed}. `failed` holds connectors that did not connect this session, with the failure reason — their mount paths are dead directories, not synced workspaces.\",\n parameters: {},\n handler: async () => {\n const { connectorList } = await import(\"../tools/connectors.js\");\n return (await connectorList(plugin.connectorManager)).content[0].text;\n },\n },\n {\n name: \"connector_read\",\n description: \"Read content from a connector by path.\",\n parameters: { connector_id: { type: \"string\" }, path: { type: \"string\" } },\n handler: async ({ connector_id, path }: { connector_id: string; path: string }) => {\n const { connectorRead } = await import(\"../tools/connectors.js\");\n return (await connectorRead(plugin.connectorManager, connector_id, path)).content[0].text;\n },\n },\n {\n name: \"connector_exec\",\n description: \"Execute a custom operation on a connector.\",\n parameters: {\n connector_id: { type: \"string\" },\n operation: { type: \"string\" },\n args: { type: \"object\", optional: true },\n },\n handler: async ({\n connector_id,\n operation,\n args,\n }: {\n connector_id: string;\n operation: string;\n args?: Record<string, unknown>;\n }) => {\n const { connectorExec } = await import(\"../tools/connectors.js\");\n return (await connectorExec(plugin.connectorManager, connector_id, operation, args ?? {}))\n .content[0].text;\n },\n },\n {\n name: \"session_list\",\n description: \"List past agent run sessions.\",\n parameters: {},\n handler: async () => {\n const { sessionList } = await import(\"../tools/sessions.js\");\n return (await sessionList(plugin.projectDir)).content[0].text;\n },\n },\n {\n name: \"workspace_validate\",\n description: \"Run a full health check on the workspace config.\",\n parameters: {},\n handler: async () => {\n const { workspaceValidate } = await import(\"../tools/validator.js\");\n return (await workspaceValidate(plugin, plugin.driver ?? \"omp\")).content[0].text;\n },\n },\n {\n name: \"workspace_info\",\n description: \"Show workspace configuration (driver, model, resource counts).\",\n parameters: {},\n handler: async () => {\n const { workspaceInfo } = await import(\"../tools/validator.js\");\n return (await workspaceInfo(plugin, plugin.driver ?? \"omp\", plugin.provider, plugin.model))\n .content[0].text;\n },\n },\n ];\n}\n\n// ── Slash command dispatcher ──────────────────────────────────────────────────\n\n/**\n * Dispatch an OMP slash command to the appropriate tool group.\n *\n * Routes the command group string to the corresponding tool functions.\n * Supported groups: `\"flow\"`, `\"connector\"`, `\"skill\"`, `\"mounts\"`,\n * `\"validate\"`. Returns a human-readable string for display in the OMP\n * terminal.\n *\n * Sub-commands per group:\n * - `flow`: `list` | `show <id>` | `sessions` | `session <runId>`\n * - `connector`: `list` | `read <id> <path>` | `exec <id> <op> [json-args]` | `describe <id>`\n * - `skill`: `list [domain]` | `show <id>` | `search <query>` | `run <id>`\n * - `mounts`: `list` | `sync <id>` | `status <id>`\n * - `validate`: (no sub-commands)\n *\n * @param plugin - A booted `WorkspacePlugin` instance.\n * @param group - Slash command group name (without the leading `/`).\n * @param args - Tokenised arguments following the group name.\n * @returns Plain-text result string for the OMP terminal.\n *\n * @docLink packages/workspace-plugin/concepts#adapters\n */\nexport async function handleSlashCommand(\n plugin: WorkspacePlugin,\n group: string,\n args: string[],\n): Promise<string> {\n const sub = args[0];\n const rest = args.slice(1);\n\n try {\n switch (group) {\n case \"flow\":\n return await handleFlowCommand(plugin, sub, rest);\n case \"connector\":\n return await handleConnectorCommand(plugin, sub, rest);\n case \"skill\":\n return await handleSkillCommand(plugin, sub, rest);\n case \"mounts\":\n return await handleMountsCommand(plugin, sub, rest);\n case \"validate\":\n return await handleValidateCommand(plugin);\n default:\n return `Unknown group '${group}'`;\n }\n } catch (e: unknown) {\n return `Error: ${e instanceof Error ? e.message : String(e)}`;\n }\n}\n\nasync function handleFlowCommand(\n plugin: WorkspacePlugin,\n sub: string | undefined,\n rest: string[],\n): Promise<string> {\n const { flowList, flowShow, flowListSessions, flowGetSession } = await import(\n \"../tools/flows.js\"\n );\n if (!sub || sub === \"list\") return (await flowList(plugin.projectDir)).content[0].text;\n if (sub === \"show\" && rest[0])\n return (await flowShow(plugin.projectDir, rest[0])).content[0].text;\n if (sub === \"sessions\") return (await flowListSessions(plugin.projectDir)).content[0].text;\n if (sub === \"session\" && rest[0])\n return (await flowGetSession(plugin.projectDir, rest[0])).content[0].text;\n return \"Usage: /flow list | show <id> | sessions | session <runId>\";\n}\n\nasync function handleConnectorCommand(\n plugin: WorkspacePlugin,\n sub: string | undefined,\n rest: string[],\n): Promise<string> {\n const { connectorList, connectorRead, connectorExec, connectorDescribe } = await import(\n \"../tools/connectors.js\"\n );\n if (!sub || sub === \"list\") return (await connectorList(plugin.connectorManager)).content[0].text;\n if (sub === \"read\" && rest[0] && rest[1])\n return (await connectorRead(plugin.connectorManager, rest[0], rest[1])).content[0].text;\n if (sub === \"exec\" && rest[0] && rest[1]) {\n let args: Record<string, unknown> = {};\n if (rest[2]) {\n try {\n args = JSON.parse(rest.slice(2).join(\" \"));\n } catch {\n /* best-effort parse */\n }\n }\n return (await connectorExec(plugin.connectorManager, rest[0], rest[1], args)).content[0].text;\n }\n if (sub === \"describe\" && rest[0])\n return (await connectorDescribe(plugin.connectorManager, rest[0])).content[0].text;\n return \"Usage: /connector list | read <id> <path> | exec <id> <op> [json-args] | describe <id>\";\n}\n\nasync function handleSkillCommand(\n plugin: WorkspacePlugin,\n sub: string | undefined,\n rest: string[],\n): Promise<string> {\n const { skillList, skillShow, skillSearch } = await import(\"../tools/skills.js\");\n if (sub === \"run\" && rest[0])\n return (await skillShow(plugin.projectDir, rest[0])).content[0].text;\n if (!sub || sub === \"list\") return (await skillList(plugin.projectDir, rest[0])).content[0].text;\n if (sub === \"show\" && rest[0])\n return (await skillShow(plugin.projectDir, rest[0])).content[0].text;\n if (sub === \"search\" && rest[0])\n return (await skillSearch(plugin.projectDir, rest.join(\" \"))).content[0].text;\n return \"Usage: /skill list [domain] | show <id> | search <query> | run <id>\";\n}\n\nasync function handleMountsCommand(\n plugin: WorkspacePlugin,\n sub: string | undefined,\n rest: string[],\n): Promise<string> {\n const { mountList, mountSync, mountStatus } = await import(\"../tools/connectors.js\");\n if (!sub || sub === \"list\") return (await mountList(plugin.connectorManager)).content[0].text;\n if (sub === \"sync\" && rest[0])\n return (await mountSync(plugin.connectorManager, rest[0])).content[0].text;\n if (sub === \"status\" && rest[0])\n return (await mountStatus(plugin.connectorManager, rest[0])).content[0].text;\n return \"Usage: /mounts list | sync <id> | status <id>\";\n}\n\nasync function handleValidateCommand(plugin: WorkspacePlugin): Promise<string> {\n const { workspaceValidate } = await import(\"../tools/validator.js\");\n return (await workspaceValidate(plugin, plugin.driver ?? \"omp\")).content[0].text;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../workspace-plugin/src/adapters/omp.ts"],"names":[],"mappings":";;;AAyBO,SAAS,wBAAwB,UAAA,EAA4B;AAClE,EAAA,MAAM,OAAA,GAAU,IAAA,CAAK,SAAA,CAAU,UAAU,CAAA;AACzC,EAAA,OAAO,CAAA;AAAA;AAAA;AAAA,kEAAA,EAG2D,UAAU;AAAA;;AAAA,iDAAA,EAG3B,OAAO,CAAA;;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA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AA,IAAI,GAAA,KAAQ,QAAA,IAAY,IAAA,CAAK,CAAC,CAAA;AAC5B,IAAA,OAAA,CAAQ,MAAM,WAAA,CAAY,MAAA,CAAO,gBAAA,EAAkB,IAAA,CAAK,CAAC,CAAC,CAAA,EAAG,OAAA,CAAQ,CAAC,CAAA,CAAE,IAAA;AAC1E,EAAA,OAAO,+CAAA;AACT;AAEA,eAAe,sBAAsB,MAAA,EAA0C;AAC7E,EAAA,MAAM,EAAE,iBAAA,EAAkB,GAAI,MAAM,OAAO,6BAAuB,CAAA;AAClE,EAAA,OAAA,CAAQ,MAAM,kBAAkB,MAAA,EAAQ,MAAA,CAAO,UAAU,KAAK,CAAA,EAAG,OAAA,CAAQ,CAAC,CAAA,CAAE,IAAA;AAC9E","file":"omp.js","sourcesContent":["import type { WorkspacePlugin } from \"../plugin.js\";\n\n// ── Extension source generator (STATELESS) ──────────────────────────────────\n// This function generates the .omp/extensions/skaile.ts file content.\n// It is stateless — takes only projectDir, does not require a booted plugin.\n// OMP tool set in the generated file is intentionally a reduced subset\n// (high-frequency tools only) — the full set is available via the MCP adapter.\n\n/**\n * Generate the `.omp/extensions/skaile.ts` file content for a given project.\n *\n * Stateless — accepts only `projectDir` and embeds it as a JSON string\n * literal in the generated TypeScript source. No `boot()` or plugin instance\n * is required; this function is safe to call from install commands.\n *\n * The generated file exports `onInit`, `tools`, and `slashCommands` as\n * required by the OMP extension API.\n *\n * @param projectDir - Absolute path to the skaile project root (embedded in\n * the generated source).\n * @returns A TypeScript source string ready to be written to\n * `.omp/extensions/skaile.ts`.\n *\n * @docLink packages/workspace-plugin/concepts#adapters\n */\nexport function buildOmpExtensionSource(projectDir: string): string {\n const escaped = JSON.stringify(projectDir);\n return `// .omp/extensions/skaile.ts\n// Generated by: skaile plugin install --driver omp\n// or: skaile repl --driver omp (ephemeral — removed on exit)\n// Re-generate: skaile plugin install --driver omp --project-dir ${projectDir}\nimport { WorkspacePlugin } from \"@skaile/workspaces/workspace-plugin\";\n\nconst plugin = new WorkspacePlugin({ projectDir: ${escaped}, bootOwned: true });\n\nexport async function onInit() {\n await plugin.boot();\n return { systemPromptAppend: plugin.buildSystemPromptSection() };\n}\n\nexport function tools() {\n return plugin.buildOmpToolSet();\n}\n\nexport const slashCommands = [\n {\n name: \"/flow\",\n description: \"Flow inspection: /flow list | show <id> | sessions | session <runId>\",\n handler: (args: string[]) => plugin.handleSlashCommand(\"flow\", args),\n },\n {\n name: \"/connector\",\n description: \"Connector CRUD: /connector list | read <id> <path> | exec <id> <op> [json-args] | describe <id>\",\n handler: (args: string[]) => plugin.handleSlashCommand(\"connector\", args),\n },\n {\n name: \"/skill\",\n description: \"Skill catalog: /skill list [domain] | show <id> | search <query> | run <id>\",\n handler: (args: string[]) => plugin.handleSlashCommand(\"skill\", args),\n },\n {\n name: \"/mounts\",\n description: \"Mount management: /mounts list | sync <id> | status <id>\",\n handler: (args: string[]) => plugin.handleSlashCommand(\"mounts\", args),\n },\n {\n name: \"/validate\",\n description: \"Validate workspace config (skaile.yaml)\",\n handler: () => plugin.handleSlashCommand(\"validate\", []),\n },\n];\n`;\n}\n\n// ── OMP tool set builder ──────────────────────────────────────────────────────\n// OMP tool definition shape: { name, description, parameters, handler }\n// This is a reduced subset of the MCP tool surface (high-frequency tools only).\n\n/**\n * Build the OMP-native tool set for a booted `WorkspacePlugin`.\n *\n * Returns 13 tool objects in OMP's `{ name, description, parameters, handler }`\n * shape — a high-frequency subset of the 28 MCP tools. The full tool surface\n * is available via the MCP adapter.\n *\n * Included tools: `mount_list`, `mount_sync`, `flow_list`, `flow_list_sessions`,\n * `skill_list`, `skill_search`, `skill_show`, `connector_list`, `connector_read`,\n * `connector_exec`, `session_list`, `workspace_validate`, `workspace_info`.\n *\n * @param plugin - A booted `WorkspacePlugin` instance.\n * @returns Array of OMP tool definition objects.\n *\n * @docLink packages/workspace-plugin/concepts#adapters\n */\nexport function buildOmpToolSet(plugin: WorkspacePlugin): unknown[] {\n return [\n {\n name: \"mount_list\",\n description: \"List all mounts declared in skaile.yaml with their mount status.\",\n parameters: {},\n handler: async () => {\n const { mountList } = await import(\"../tools/connectors.js\");\n return (await mountList(plugin.connectorManager)).content[0].text;\n },\n },\n {\n name: \"mount_sync\",\n description: \"Sync a mount (pull latest from remote).\",\n parameters: { mount_id: { type: \"string\" } },\n handler: async ({ mount_id }: { mount_id: string }) => {\n const { mountSync } = await import(\"../tools/connectors.js\");\n return (await mountSync(plugin.connectorManager, mount_id)).content[0].text;\n },\n },\n {\n name: \"flow_list\",\n description: \"List all available flow definitions from ai-assets.\",\n parameters: {},\n handler: async () => {\n const { flowList } = await import(\"../tools/flows.js\");\n return (await flowList(plugin.projectDir)).content[0].text;\n },\n },\n {\n name: \"flow_list_sessions\",\n description: \"List past flow run sessions for this workspace.\",\n parameters: {},\n handler: async () => {\n const { flowListSessions } = await import(\"../tools/flows.js\");\n return (await flowListSessions(plugin.projectDir)).content[0].text;\n },\n },\n {\n name: \"skill_list\",\n description: \"List all skills in the ai-assets catalog.\",\n parameters: { domain: { type: \"string\", optional: true } },\n handler: async ({ domain }: { domain?: string }) => {\n const { skillList } = await import(\"../tools/skills.js\");\n return (await skillList(plugin.projectDir, domain)).content[0].text;\n },\n },\n {\n name: \"skill_search\",\n description: \"Search skills by name, description, or keywords.\",\n parameters: { query: { type: \"string\" } },\n handler: async ({ query }: { query: string }) => {\n const { skillSearch } = await import(\"../tools/skills.js\");\n return (await skillSearch(plugin.projectDir, query)).content[0].text;\n },\n },\n {\n name: \"skill_show\",\n description: \"Show the full SKILL.md content for a skill.\",\n parameters: { skill_id: { type: \"string\" } },\n handler: async ({ skill_id }: { skill_id: string }) => {\n const { skillShow } = await import(\"../tools/skills.js\");\n return (await skillShow(plugin.projectDir, skill_id)).content[0].text;\n },\n },\n {\n name: \"connector_list\",\n description:\n \"List connectors declared in skaile.yaml as {connected, failed}. `failed` holds connectors that did not connect this session, with the failure reason — their mount paths are dead directories, not synced workspaces.\",\n parameters: {},\n handler: async () => {\n const { connectorList } = await import(\"../tools/connectors.js\");\n return (await connectorList(plugin.connectorManager)).content[0].text;\n },\n },\n {\n name: \"connector_read\",\n description: \"Read content from a connector by path.\",\n parameters: { connector_id: { type: \"string\" }, path: { type: \"string\" } },\n handler: async ({ connector_id, path }: { connector_id: string; path: string }) => {\n const { connectorRead } = await import(\"../tools/connectors.js\");\n return (await connectorRead(plugin.connectorManager, connector_id, path)).content[0].text;\n },\n },\n {\n name: \"connector_exec\",\n description: \"Execute a custom operation on a connector.\",\n parameters: {\n connector_id: { type: \"string\" },\n operation: { type: \"string\" },\n args: { type: \"object\", optional: true },\n },\n handler: async ({\n connector_id,\n operation,\n args,\n }: {\n connector_id: string;\n operation: string;\n args?: Record<string, unknown>;\n }) => {\n const { connectorExec } = await import(\"../tools/connectors.js\");\n return (await connectorExec(plugin.connectorManager, connector_id, operation, args ?? {}))\n .content[0].text;\n },\n },\n {\n name: \"session_list\",\n description: \"List past agent run sessions.\",\n parameters: {},\n handler: async () => {\n const { sessionList } = await import(\"../tools/sessions.js\");\n return (await sessionList(plugin.projectDir)).content[0].text;\n },\n },\n {\n name: \"workspace_validate\",\n description: \"Run a full health check on the workspace config.\",\n parameters: {},\n handler: async () => {\n const { workspaceValidate } = await import(\"../tools/validator.js\");\n return (await workspaceValidate(plugin, plugin.driver ?? \"omp\")).content[0].text;\n },\n },\n {\n name: \"workspace_info\",\n description: \"Show workspace configuration (driver, model, resource counts).\",\n parameters: {},\n handler: async () => {\n const { workspaceInfo } = await import(\"../tools/validator.js\");\n return (await workspaceInfo(plugin, plugin.driver ?? \"omp\", plugin.model))\n .content[0].text;\n },\n },\n ];\n}\n\n// ── Slash command dispatcher ──────────────────────────────────────────────────\n\n/**\n * Dispatch an OMP slash command to the appropriate tool group.\n *\n * Routes the command group string to the corresponding tool functions.\n * Supported groups: `\"flow\"`, `\"connector\"`, `\"skill\"`, `\"mounts\"`,\n * `\"validate\"`. Returns a human-readable string for display in the OMP\n * terminal.\n *\n * Sub-commands per group:\n * - `flow`: `list` | `show <id>` | `sessions` | `session <runId>`\n * - `connector`: `list` | `read <id> <path>` | `exec <id> <op> [json-args]` | `describe <id>`\n * - `skill`: `list [domain]` | `show <id>` | `search <query>` | `run <id>`\n * - `mounts`: `list` | `sync <id>` | `status <id>`\n * - `validate`: (no sub-commands)\n *\n * @param plugin - A booted `WorkspacePlugin` instance.\n * @param group - Slash command group name (without the leading `/`).\n * @param args - Tokenised arguments following the group name.\n * @returns Plain-text result string for the OMP terminal.\n *\n * @docLink packages/workspace-plugin/concepts#adapters\n */\nexport async function handleSlashCommand(\n plugin: WorkspacePlugin,\n group: string,\n args: string[],\n): Promise<string> {\n const sub = args[0];\n const rest = args.slice(1);\n\n try {\n switch (group) {\n case \"flow\":\n return await handleFlowCommand(plugin, sub, rest);\n case \"connector\":\n return await handleConnectorCommand(plugin, sub, rest);\n case \"skill\":\n return await handleSkillCommand(plugin, sub, rest);\n case \"mounts\":\n return await handleMountsCommand(plugin, sub, rest);\n case \"validate\":\n return await handleValidateCommand(plugin);\n default:\n return `Unknown group '${group}'`;\n }\n } catch (e: unknown) {\n return `Error: ${e instanceof Error ? e.message : String(e)}`;\n }\n}\n\nasync function handleFlowCommand(\n plugin: WorkspacePlugin,\n sub: string | undefined,\n rest: string[],\n): Promise<string> {\n const { flowList, flowShow, flowListSessions, flowGetSession } = await import(\n \"../tools/flows.js\"\n );\n if (!sub || sub === \"list\") return (await flowList(plugin.projectDir)).content[0].text;\n if (sub === \"show\" && rest[0])\n return (await flowShow(plugin.projectDir, rest[0])).content[0].text;\n if (sub === \"sessions\") return (await flowListSessions(plugin.projectDir)).content[0].text;\n if (sub === \"session\" && rest[0])\n return (await flowGetSession(plugin.projectDir, rest[0])).content[0].text;\n return \"Usage: /flow list | show <id> | sessions | session <runId>\";\n}\n\nasync function handleConnectorCommand(\n plugin: WorkspacePlugin,\n sub: string | undefined,\n rest: string[],\n): Promise<string> {\n const { connectorList, connectorRead, connectorExec, connectorDescribe } = await import(\n \"../tools/connectors.js\"\n );\n if (!sub || sub === \"list\") return (await connectorList(plugin.connectorManager)).content[0].text;\n if (sub === \"read\" && rest[0] && rest[1])\n return (await connectorRead(plugin.connectorManager, rest[0], rest[1])).content[0].text;\n if (sub === \"exec\" && rest[0] && rest[1]) {\n let args: Record<string, unknown> = {};\n if (rest[2]) {\n try {\n args = JSON.parse(rest.slice(2).join(\" \"));\n } catch {\n /* best-effort parse */\n }\n }\n return (await connectorExec(plugin.connectorManager, rest[0], rest[1], args)).content[0].text;\n }\n if (sub === \"describe\" && rest[0])\n return (await connectorDescribe(plugin.connectorManager, rest[0])).content[0].text;\n return \"Usage: /connector list | read <id> <path> | exec <id> <op> [json-args] | describe <id>\";\n}\n\nasync function handleSkillCommand(\n plugin: WorkspacePlugin,\n sub: string | undefined,\n rest: string[],\n): Promise<string> {\n const { skillList, skillShow, skillSearch } = await import(\"../tools/skills.js\");\n if (sub === \"run\" && rest[0])\n return (await skillShow(plugin.projectDir, rest[0])).content[0].text;\n if (!sub || sub === \"list\") return (await skillList(plugin.projectDir, rest[0])).content[0].text;\n if (sub === \"show\" && rest[0])\n return (await skillShow(plugin.projectDir, rest[0])).content[0].text;\n if (sub === \"search\" && rest[0])\n return (await skillSearch(plugin.projectDir, rest.join(\" \"))).content[0].text;\n return \"Usage: /skill list [domain] | show <id> | search <query> | run <id>\";\n}\n\nasync function handleMountsCommand(\n plugin: WorkspacePlugin,\n sub: string | undefined,\n rest: string[],\n): Promise<string> {\n const { mountList, mountSync, mountStatus } = await import(\"../tools/connectors.js\");\n if (!sub || sub === \"list\") return (await mountList(plugin.connectorManager)).content[0].text;\n if (sub === \"sync\" && rest[0])\n return (await mountSync(plugin.connectorManager, rest[0])).content[0].text;\n if (sub === \"status\" && rest[0])\n return (await mountStatus(plugin.connectorManager, rest[0])).content[0].text;\n return \"Usage: /mounts list | sync <id> | status <id>\";\n}\n\nasync function handleValidateCommand(plugin: WorkspacePlugin): Promise<string> {\n const { workspaceValidate } = await import(\"../tools/validator.js\");\n return (await workspaceValidate(plugin, plugin.driver ?? \"omp\")).content[0].text;\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { PluginStore, WorkspacePlugin, buildClaudePluginFiles, resolveProjectDir } from '../chunk-
|
|
1
|
+
export { PluginStore, WorkspacePlugin, buildClaudePluginFiles, resolveProjectDir } from '../chunk-NR6BPOW5.js';
|
|
2
2
|
export { err, ok, okJson } from '../chunk-X5YPJV4N.js';
|
|
3
3
|
import '../chunk-FTG7CRFD.js';
|
|
4
4
|
import '../chunk-W4IPN3DD.js';
|
|
@@ -5,7 +5,7 @@ import { PluginStore } from "./store.js";
|
|
|
5
5
|
*
|
|
6
6
|
* At minimum `projectDir` must be supplied. All other fields are optional
|
|
7
7
|
* and are pre-resolved by the caller when available (e.g. the runner already
|
|
8
|
-
* knows `driver`/`
|
|
8
|
+
* knows `driver`/`model` from its own settings resolution).
|
|
9
9
|
*
|
|
10
10
|
* @docLink packages/workspace-plugin/concepts#workspaceplugin-lifecycle
|
|
11
11
|
*/
|
|
@@ -20,8 +20,6 @@ export interface WorkspacePluginOpts {
|
|
|
20
20
|
onLog?: (msg: string) => void;
|
|
21
21
|
/** Pre-resolved driver type (avoids needing boot() to read settings). */
|
|
22
22
|
driver?: string;
|
|
23
|
-
/** Pre-resolved provider. */
|
|
24
|
-
provider?: string;
|
|
25
23
|
/** Pre-resolved model. */
|
|
26
24
|
model?: string;
|
|
27
25
|
}
|
|
@@ -54,7 +52,6 @@ export declare class WorkspacePlugin {
|
|
|
54
52
|
private readonly onLog;
|
|
55
53
|
private readonly log;
|
|
56
54
|
driver?: string;
|
|
57
|
-
provider?: string;
|
|
58
55
|
model?: string;
|
|
59
56
|
constructor(opts: WorkspacePluginOpts);
|
|
60
57
|
boot(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../workspace-plugin/src/plugin.ts"],"names":[],"mappings":"AAEA,OAAO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Q,CAAC,GAAG,CAGjB;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;gBAEH,IAAI,EAAE,mBAAmB;IAgB/B,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAwDrB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAMvB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAY/B,wBAAwB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM;IAyCjD;;;OAGG;IACG,uBAAuB,IAAI,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;IAcxD;;;;OAIG;IACG,4BAA4B,IAAI,OAAO,CAAC,OAAO,CAAC;IAMtD;;;;OAIG;IACG,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC;IAMlC,eAAe,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;IAKrC,uBAAuB,IAAI,OAAO,CAAC,MAAM,CAAC;IAK1C,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC;CAIzE"}
|
|
@@ -14,17 +14,17 @@ interface PluginLike {
|
|
|
14
14
|
/**
|
|
15
15
|
* Return a summary of the current workspace configuration.
|
|
16
16
|
*
|
|
17
|
-
* Reports the active driver,
|
|
18
|
-
*
|
|
17
|
+
* Reports the active driver, model, mount count, connector count, and
|
|
18
|
+
* per-resource descriptors. Endpoints are not summarised here: they live in
|
|
19
|
+
* the session's AI provider registry, which `skaile providers list` prints.
|
|
19
20
|
*
|
|
20
21
|
* @param plugin - Plugin instance (or compatible shape) exposing managers.
|
|
21
22
|
* @param driver - Driver name (e.g. `"omp"`, `"claude-sdk"`).
|
|
22
|
-
* @param provider - Provider identifier, if resolved.
|
|
23
23
|
* @param model - Model identifier, if resolved.
|
|
24
24
|
*
|
|
25
25
|
* @docLink packages/workspace-plugin/concepts#tool-delivery
|
|
26
26
|
*/
|
|
27
|
-
export declare function workspaceInfo(plugin: PluginLike, driver: string,
|
|
27
|
+
export declare function workspaceInfo(plugin: PluginLike, driver: string, model: string | undefined): Promise<ToolResult>;
|
|
28
28
|
/**
|
|
29
29
|
* Test resolution of a secret reference.
|
|
30
30
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../../../workspace-plugin/src/tools/validator.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAkB9C,UAAU,gBAAgB;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AACD,UAAU,UAAU;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE;QAAE,cAAc,IAAI,gBAAgB,EAAE,CAAA;KAAE,GAAG,IAAI,CAAC;IAClE,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACzB;AAoCD;;;;;;;;;;;;GAYG;AACH,wBAAsB,aAAa,CACjC,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,MAAM,EACd,
|
|
1
|
+
{"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../../../workspace-plugin/src/tools/validator.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAkB9C,UAAU,gBAAgB;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AACD,UAAU,UAAU;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE;QAAE,cAAc,IAAI,gBAAgB,EAAE,CAAA;KAAE,GAAG,IAAI,CAAC;IAClE,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACzB;AAoCD;;;;;;;;;;;;GAYG;AACH,wBAAsB,aAAa,CACjC,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,GAAG,SAAS,GACxB,OAAO,CAAC,UAAU,CAAC,CAerB;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAoB1E;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CA+C/F;AAED;;;;;;;;;GASG;AACH,wBAAsB,eAAe,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAW7E"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skaile/workspaces",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "Skaile workspaces runtime — types, core, bridge, runner, store, connectors, and supporting layers as one publishable package",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"packageManager": "bun@1.3.9",
|
|
@@ -392,6 +392,18 @@
|
|
|
392
392
|
"import": "./dist/core/publish-manifest.js",
|
|
393
393
|
"default": "./dist/core/publish-manifest.js"
|
|
394
394
|
},
|
|
395
|
+
"./core/provider-registry": {
|
|
396
|
+
"skaile-src": "./core/src/provider-registry.ts",
|
|
397
|
+
"types": "./dist/core/src/provider-registry.d.ts",
|
|
398
|
+
"import": "./dist/core/provider-registry.js",
|
|
399
|
+
"default": "./dist/core/provider-registry.js"
|
|
400
|
+
},
|
|
401
|
+
"./core/provider-registry-credentials": {
|
|
402
|
+
"skaile-src": "./core/src/provider-registry-credentials.ts",
|
|
403
|
+
"types": "./dist/core/src/provider-registry-credentials.d.ts",
|
|
404
|
+
"import": "./dist/core/provider-registry-credentials.js",
|
|
405
|
+
"default": "./dist/core/provider-registry-credentials.js"
|
|
406
|
+
},
|
|
395
407
|
"./core/runtime-assets": {
|
|
396
408
|
"skaile-src": "./core/src/runtime-assets.ts",
|
|
397
409
|
"types": "./dist/core/src/runtime-assets.d.ts",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../cli/src/asset-feeds.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAqFA,SAAS,QAAQ,CAAA,EAAmB;AAClC,EAAA,OAAO,CAAA,CAAE,KAAA,CAAW,IAAA,CAAA,GAAG,CAAA,CAAE,KAAK,GAAG,CAAA;AACnC;AAGA,eAAe,cAAc,IAAA,EAAmC;AAC9D,EAAA,MAAM,MAAkB,EAAC;AACzB,EAAA,WAAA,MAAiB,EAAE,IAAA,EAAM,QAAA,EAAU,MAAK,IAAK,OAAA,CAAQ,IAAI,CAAA,EAAG;AAC1D,IAAA,IAAI,SAAS,kBAAA,EAAoB;AACjC,IAAA,IAAI;AACF,MAAA,MAAM,EAAE,IAAA,EAAK,GAAI,iBAAiB,YAAA,CAAa,QAAA,EAAU,MAAM,CAAC,CAAA;AAChE,MAAA,GAAA,CAAI,IAAA,CAAK,cAAc,OAAA,CAAa,IAAA,CAAA,QAAA,CAAS,MAAM,QAAQ,CAAC,CAAA,EAAG,IAAI,CAAC,CAAA;AAAA,IACtE,CAAA,CAAA,MAAQ;AAAA,IAAC;AAAA,EACX;AACA,EAAA,OAAO,GAAA;AACT;AAcA,eAAe,YAAA,CACb,IAAA,EACA,YAAA,EACA,OAAA,EACA,qBAAqB,IAAA,EACK;AAC1B,EAAA,MAAM,SAAA,GAAY,MAAM,aAAA,CAAc,IAAI,CAAA;AAC1C,EAAA,MAAM,WAAA,GAAc,OAAA,CAAQ,GAAA,CAAI,CAAC,KAAA,MAAW;AAAA,IAC1C,KAAA;AAAA,IACA,KAAK,CAAA,EAAG,KAAA,CAAM,IAAI,CAAA,CAAA,EAAI,MAAM,IAAI,CAAA,CAAA;AAAA,IAChC,cAAc,OAAA,CAAa,IAAA,CAAA,Q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,IACL,OAAA,EAAS;AAAA,MACP,GAAG,GAAA,CAAI,OAAA;AAAA,MACP,GAAG,IAAA,CAAK,OAAA;AAAA,MACR,GAAG,GAAA,CAAI,SAAA,EAAW,OAAA,CAAQ,OAAO,CAAA;AAAA,MACjC,GAAG,GAAA,CAAI,OAAA,EAAS,KAAA,CAAM,OAAO;AAAA,KAC/B;AAAA;AAAA;AAAA,IAGA,OAAA,EAAS,YAAA,CAAa,CAAC,GAAG,MAAM,OAAA,EAAS,GAAG,GAAA,CAAI,OAAA,EAAS,GAAG,IAAA,CAAK,OAAA,EAAS,GAAG,OAAA,CAAQ,OAAO,CAAC,CAAA;AAAA,IAC7F,KAAA,EAAO,CAAC,GAAG,IAAA,CAAK,KAAA,EAAO,GAAG,KAAA,CAAM,KAAA,EAAO,GAAG,OAAA,CAAQ,KAAK;AAAA,GACzD;AACF;AAGA,SAAS,aAAa,OAAA,EAA2C;AAC/D,EAAA,MAAM,IAAA,uBAAW,GAAA,EAAY;AAC7B,EAAA,MAAM,MAAuB,EAAC;AAC9B,EAAA,KAAA,MAAW,KAAK,OAAA,EAAS;AACvB,IAAA,IAAI,IAAA,CAAK,GAAA,CAAI,CAAA,CAAE,IAAI,CAAA,EAAG;AACtB,IAAA,IAAA,CAAK,GAAA,CAAI,EAAE,IAAI,CAAA;AACf,IAAA,GAAA,CAAI,KAAK,CAAC,CAAA;AAAA,EACZ;AACA,EAAA,OAAO,GAAA;AACT","file":"asset-feeds-AJOUKX55.js","sourcesContent":["/**\n * asset-feeds.ts — gather installable assets from every feed the manage TUI\n * surfaces.\n *\n * Four feeds, normalized into `CatalogEntry`:\n * - **Project sources** — `skaile.yaml` `sources:` entries (scanned via\n * `AssetManager.search()`; the new `sources:` field is merged into the\n * legacy repositories map in `AssetManager.loadConfig`).\n * - **Local libraries** — user authoring places from `LocalIndex` (filesystem\n * scan of each library's `path`).\n * - **Factory assets** — the bundled first-party `factory-assets` tree\n * (`factoryAssetRoots()`), scanned from disk. Always present; no network.\n * - **Remote store** — the configured catalog source when `catalog.url` is\n * not `local`. Failures are non-fatal — they surface as notes.\n */\n\nimport { existsSync, readFileSync } from \"node:fs\";\nimport * as path from \"node:path\";\nimport {\n type AssetKind,\n type CatalogDomain,\n type CatalogEntry,\n factoryAssetRoots,\n parseFrontmatter,\n scanRepo,\n walkDir,\n} from \"@skaile/workspaces/core\";\nimport {\n assignDomain,\n buildDomainIndex,\n DOMAIN_MD_FILENAME,\n type DomainMd,\n parseDomainMd,\n} from \"@skaile/workspaces/discovery\";\n\n/** One non-fatal note returned to the caller for surfacing in the UI. */\nexport interface FeedNote {\n feed: \"sources\" | \"libraries\" | \"store\" | \"factory\";\n message: string;\n}\n\n/**\n * Which feed an asset came from. This is the top-level grouping axis in the\n * manage TUI (\"where is this skill coming from?\") and is intentionally distinct\n * from `publisher` (asset-intrinsic identity): the same publisher can legitimately\n * appear under more than one origin (e.g. a github repo you added as a `source`\n * that is also listed in the remote `store`).\n */\nexport type AssetOrigin = \"source\" | \"library\" | \"factory\" | \"store\";\n\n/** A catalog entry tagged with the feed it was gathered from. */\nexport interface OriginEntry {\n origin: AssetOrigin;\n entry: CatalogEntry;\n /**\n * Second-level grouping label for the manage tree. Defaults (when unset) to the\n * entry's `publisher`; the source feed sets it to the source's short repo name\n * so the Sources band groups by source — \"which repo did this come from\" — not\n * by the asset-intrinsic publisher.\n */\n group?: string;\n}\n\nexport interface AssetFeedResult {\n entries: OriginEntry[];\n /**\n * Display-only domain metadata, keyed (by the consumer) on `slug`. Populated\n * from the store's `catalog.listDomains` when the connected catalog source\n * exposes it; empty otherwise. The manage TUI joins `entry.domainSlug` → a\n * domain for grouping headers, descriptions, and relation badges.\n */\n domains: CatalogDomain[];\n notes: FeedNote[];\n}\n\n// ── Domain stamping (on-disk feeds) ──────────────────────────────────────────\n//\n// `scanRepo` (the source / library / factory scan path) does not read the\n// `DOMAIN.md` sidecars, so its entries arrive with no `domainSlug` and render\n// flat under their publisher band. We re-derive the grouping here from the\n// root's `DOMAIN.md` files (the same sidecars the remote store computes\n// server-side), and fall back to the repo/source name for any entry no domain\n// claims so it still groups instead of landing in the synthetic \"no domain\" pile.\n\n/** Repo-relative POSIX path (DOMAIN.md slugs are matched whole-segment, `/`-joined). */\nfunction toPosix(p: string): string {\n return p.split(path.sep).join(\"/\");\n}\n\n/** Parse every `DOMAIN.md` sidecar under `root` into a {@link DomainMd}. */\nasync function loadDomainMds(root: string): Promise<DomainMd[]> {\n const out: DomainMd[] = [];\n for await (const { path: filePath, name } of walkDir(root)) {\n if (name !== DOMAIN_MD_FILENAME) continue;\n try {\n const { data } = parseFrontmatter(readFileSync(filePath, \"utf8\"));\n out.push(parseDomainMd(toPosix(path.relative(root, filePath)), data));\n } catch {}\n }\n return out;\n}\n\n/**\n * Stamp `domainSlug` onto every entry scanned from `root` using the root's\n * `DOMAIN.md` sidecars. Returns the `CatalogDomain` registry for the real\n * domains, plus a synthetic fallback domain when any entry used the fallback.\n * Mutates `entries` in place (sets `entry.domainSlug`).\n *\n * `synthesizeFallback` (default true): entries no domain claims fall back to\n * `fallbackSlug` (the repo/source name). Pass `false` when the caller already\n * groups these entries one level up (e.g. the source feed groups by source\n * node) — unmatched entries then get no domain (`\"\"`) and hang directly under\n * that parent, instead of nesting under a same-named fallback domain.\n */\nasync function stampDomains(\n root: string,\n fallbackSlug: string,\n entries: CatalogEntry[],\n synthesizeFallback = true,\n): Promise<CatalogDomain[]> {\n const domainMds = await loadDomainMds(root);\n const assignables = entries.map((entry) => ({\n entry,\n ref: `${entry.kind}:${entry.name}`,\n relativePath: toPosix(path.relative(root, entry.source)),\n }));\n\n let usedFallback = false;\n for (const a of assignables) {\n const slug = assignDomain(a.relativePath, domainMds);\n if (slug) a.entry.domainSlug = slug;\n else if (synthesizeFallback) {\n a.entry.domainSlug = fallbackSlug;\n usedFallback = true;\n } else a.entry.domainSlug = \"\";\n }\n\n const { index } = buildDomainIndex(assignables, domainMds);\n const catalog: CatalogDomain[] = Object.values(index).map((d) => ({\n slug: d.slug,\n title: d.title,\n ...(d.description ? { description: d.description } : {}),\n ...(d.relation ? { relation: d.relation } : {}),\n ...(d.order !== undefined ? { order: d.order } : {}),\n ...(d.recommended[0] ? { recommendedRef: d.recommended[0] } : {}),\n }));\n if (usedFallback) catalog.push({ slug: fallbackSlug, title: fallbackSlug });\n return catalog;\n}\n\n/**\n * Pull assets from local libraries (the authoring places under\n * `~/.skaile/libraries/<name>/`, not the `~/.skaile/cache/sources/` cache). Each\n * library's `path` is scanned with `scanRepo` and grouped under the bare library\n * name (`group: <name>`) so the manage TUI shows a clean `<name>` band — no\n * `library:` prefix and no redundant same-named fallback domain (mirrors the\n * source feed).\n */\nasync function libraryAssets(): Promise<{\n entries: OriginEntry[];\n domains: CatalogDomain[];\n notes: FeedNote[];\n}> {\n const notes: FeedNote[] = [];\n const domains: CatalogDomain[] = [];\n try {\n const [{ openLibraryManager }, { skaileHomeDir }, { getGlobalCacheDir }] = await Promise.all([\n import(\"./open-library.ts\"),\n import(\"@skaile/workspaces/library\"),\n import(\"@skaile/workspaces/core\"),\n ]);\n const { manager, close } = await openLibraryManager();\n try {\n // Authoring libraries are the rows that are NOT source clones. index.db\n // rows predating the cache migration still carry the legacy\n // ~/.skaile/sources path, so exclude both roots.\n const newRoot = getGlobalCacheDir();\n const legacyRoot = path.join(skaileHomeDir(), \"sources\");\n const libs = (await manager.listLibraries()).filter(\n (l) => !l.path.startsWith(newRoot) && !l.path.startsWith(legacyRoot),\n );\n const entries: OriginEntry[] = [];\n for (const lib of libs) {\n if (!existsSync(lib.path)) continue;\n // Scan + group under the bare library name. `synthesizeFallback: false`\n // (as the source feed does) keeps domainless assets directly under the\n // library band instead of a redundant same-named fallback domain.\n const libEntries = [...(await scanRepo(lib.path, lib.name))];\n domains.push(...(await stampDomains(lib.path, lib.name, libEntries, false)));\n for (const entry of libEntries) entries.push({ origin: \"library\", entry, group: lib.name });\n }\n return { entries, domains, notes };\n } finally {\n close();\n }\n } catch (err) {\n notes.push({\n feed: \"libraries\",\n message: err instanceof Error ? err.message : String(err),\n });\n return { entries: [], domains, notes };\n }\n}\n\n/**\n * Pull a (best-effort) snapshot of the connected remote store catalog.\n *\n * - Returns no entries when the resolved catalog is local-only or the host\n * is unreachable (the failure becomes a note, not an exception).\n * - Maps `CatalogAsset` → `CatalogEntry`, carrying `publisher`, `repo`, and\n * `category` straight through and using `source = \"store://<id>\"`; per-file\n * `source` paths are not available for remote assets so the canonical ref is\n * a stable placeholder.\n */\nasync function storeAssets(projectDir: string): Promise<{\n entries: CatalogEntry[];\n domains: CatalogDomain[];\n notes: FeedNote[];\n}> {\n const notes: FeedNote[] = [];\n try {\n const { resolveCatalogSource } = await import(\"./open-library.ts\");\n const { source, close } = await resolveCatalogSource({ projectDir });\n try {\n const assets = await source.listAssets();\n const entries: CatalogEntry[] = assets.map((a) => ({\n name: a.name,\n kind: (a.kind as AssetKind) ?? \"skill\",\n description: a.description ?? \"\",\n source: `store://${a.id}`,\n publisher: a.publisher,\n repo: a.repo,\n domainSlug: a.domainSlug,\n category: a.category,\n version: a.version,\n requires: [],\n dependencies: [],\n }));\n // Domains are optional on the catalog source — only the store backend\n // (post Part 4 `catalog.listDomains`) exposes them. Duck-type the call so\n // older sources and the local catalog degrade to no domains, not an error.\n const domains = await loadDomains(source);\n return { entries, domains, notes };\n } finally {\n close();\n }\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err);\n // Local-only catalog throws a recognizable message — silence it; absence\n // is the user's choice, not an error.\n if (!/local/i.test(msg)) {\n notes.push({ feed: \"store\", message: msg });\n }\n return { entries: [], domains: [], notes };\n }\n}\n\n/** Optional `listDomains` capability — returns `[]` when the source lacks it. */\nasync function loadDomains(source: unknown): Promise<CatalogDomain[]> {\n const fn = (source as { listDomains?: () => Promise<CatalogDomain[]> }).listDomains;\n if (typeof fn !== \"function\") return [];\n const domains = await fn.call(source);\n return Array.isArray(domains) ? domains : [];\n}\n\n/** The slice of `AssetManager` the source feed needs (kept narrow for tests). */\ninterface AssetManagerLike {\n search: () => Promise<CatalogEntry[]>;\n searchRepoRoots: () => { repoName: string; root: string }[];\n}\n\n/**\n * Project-source feed: leans on `AssetManager.search()`, which now merges\n * `skaile.yaml`'s `sources:` field into the repositories map, then stamps\n * `DOMAIN.md`-derived domain grouping onto the scanned entries via\n * `searchRepoRoots()`.\n */\nasync function sourceAssets(\n am: AssetManagerLike,\n): Promise<{ entries: OriginEntry[]; domains: CatalogDomain[] }> {\n // The bundled factory tree is injected into the repositories map as an implicit\n // source, so `am.search()` returns it too. It has its own `factory` origin band,\n // so drop it here — otherwise the same first-party skills list twice under Sources.\n const factoryPrefixes = factoryAssetRoots().map((r) => (r.endsWith(path.sep) ? r : r + path.sep));\n const isFactoryPath = (p: string) =>\n factoryPrefixes.some((fp) => p === fp.slice(0, -1) || p.startsWith(fp));\n\n const all = (await am.search()).filter((e) => !isFactoryPath(e.source));\n const entries: OriginEntry[] = [];\n const domains: CatalogDomain[] = [];\n // Group each source's entries under the source node (its short repo name), not\n // the publisher: under Sources the navigational question is \"which repo did\n // this come from\". Each entry's `source` (absolute manifest path) lives under\n // exactly one declared root, so group + stamp by prefix. The cache slug is\n // URL-keyed `github.com/<org>/<repo>` — take the trailing segment.\n for (const { repoName, root } of am.searchRepoRoots()) {\n if (isFactoryPath(root)) continue;\n const prefix = root.endsWith(path.sep) ? root : root + path.sep;\n const owned = all.filter((e) => e.source === root || e.source.startsWith(prefix));\n if (owned.length === 0) continue;\n const sourceName = repoName.split(\"/\").pop() || repoName;\n // No synthetic fallback domain — the source node already groups these, so a\n // same-named fallback would just nest the source under itself.\n domains.push(...(await stampDomains(root, sourceName, owned, false)));\n for (const entry of owned) entries.push({ origin: \"source\", entry, group: sourceName });\n }\n return { entries, domains };\n}\n\n/**\n * Factory-asset feed: scan the bundled first-party `factory-assets` tree(s)\n * resolved by `factoryAssetRoots()` (the `SKAILE_FACTORY_ASSETS_DIR` override\n * layer ahead of the bundled tree). Local disk only, no network — the entries are\n * the built-in skills / connectors / bundles that ship with `@skaile/workspaces`.\n * `factoryAssetRoots()` already dedupes, so the env override pointing at the\n * bundled dir collapses to one root.\n */\nasync function factoryAssets(): Promise<{\n entries: CatalogEntry[];\n domains: CatalogDomain[];\n notes: FeedNote[];\n}> {\n const notes: FeedNote[] = [];\n const domains: CatalogDomain[] = [];\n try {\n const entries: CatalogEntry[] = [];\n for (const root of factoryAssetRoots()) {\n const rootEntries = [...(await scanRepo(root, \"skaile-factory\"))];\n domains.push(...(await stampDomains(root, \"skaile-factory\", rootEntries)));\n entries.push(...rootEntries);\n }\n return { entries, domains, notes };\n } catch (err) {\n notes.push({\n feed: \"factory\",\n message: err instanceof Error ? err.message : String(err),\n });\n return { entries: [], domains, notes };\n }\n}\n\n/** Tag a flat entry list with a single origin. */\nfunction tag(origin: AssetOrigin, entries: CatalogEntry[]): OriginEntry[] {\n return entries.map((entry) => ({ origin, entry }));\n}\n\n/**\n * Run all feeds and return a single normalized result.\n *\n * Feeds run in parallel where possible — the store fetch is the slow one\n * (one HTTP call) and is fired alongside the local library walk. The factory\n * scan is local disk only, so it runs inline.\n */\nexport async function gatherAssetFeeds(\n am: AssetManagerLike,\n projectDir: string,\n): Promise<AssetFeedResult> {\n const [libs, store] = await Promise.all([libraryAssets(), storeAssets(projectDir)]);\n const factory = await factoryAssets();\n const src = await sourceAssets(am);\n return {\n entries: [\n ...src.entries,\n ...libs.entries,\n ...tag(\"factory\", factory.entries),\n ...tag(\"store\", store.entries),\n ],\n // Store domains first (server-curated), then the on-disk feeds; dedupe by\n // slug, first-wins, so a store-served domain shadows a same-slug local one.\n domains: dedupeBySlug([...store.domains, ...src.domains, ...libs.domains, ...factory.domains]),\n notes: [...libs.notes, ...store.notes, ...factory.notes],\n };\n}\n\n/** First-wins dedupe of a domain list by `slug`. */\nfunction dedupeBySlug(domains: CatalogDomain[]): CatalogDomain[] {\n const seen = new Set<string>();\n const out: CatalogDomain[] = [];\n for (const d of domains) {\n if (seen.has(d.slug)) continue;\n seen.add(d.slug);\n out.push(d);\n }\n return out;\n}\n"]}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared per-provider REST endpoint config (url / auth headers / query param).
|
|
3
|
-
*
|
|
4
|
-
* Single source of truth consumed by both `fetchProviderModels` (models.ts) and
|
|
5
|
-
* `validateApiKey` (validation.ts), which both hit each provider's models
|
|
6
|
-
* endpoint. Model-list response `parse` logic stays in models.ts — it has no
|
|
7
|
-
* bearing on key validation.
|
|
8
|
-
*/
|
|
9
|
-
/** REST endpoint descriptor for a provider's models listing. */
|
|
10
|
-
export interface ProviderEndpoint {
|
|
11
|
-
/** Full models-list URL against the provider's own public API. */
|
|
12
|
-
url: string;
|
|
13
|
-
/**
|
|
14
|
-
* Path appended to a caller- or env-supplied base URL. Present only for
|
|
15
|
-
* providers that can legitimately be addressed through a gateway/proxy that
|
|
16
|
-
* emulates their wire protocol.
|
|
17
|
-
*/
|
|
18
|
-
path?: string;
|
|
19
|
-
/**
|
|
20
|
-
* Env var carrying a base-URL override for this provider, using the same
|
|
21
|
-
* name the provider's own SDK reads. Consulted by
|
|
22
|
-
* {@link resolveProviderModelsUrl} when no explicit base URL is passed.
|
|
23
|
-
*/
|
|
24
|
-
baseUrlEnv?: string;
|
|
25
|
-
headers: (key: string) => Record<string, string>;
|
|
26
|
-
queryParam?: string;
|
|
27
|
-
}
|
|
28
|
-
export declare const PROVIDER_ENDPOINTS: Record<string, ProviderEndpoint>;
|
|
29
|
-
/**
|
|
30
|
-
* Resolve the models-list URL for a provider, honouring a configured base URL.
|
|
31
|
-
*
|
|
32
|
-
* Behind a gateway (LiteLLM, a corporate proxy, an Anthropic-compatible
|
|
33
|
-
* router) the credential in play is the *gateway's*, not the provider's. Firing
|
|
34
|
-
* discovery at the provider's own public API therefore 401s and yields an empty
|
|
35
|
-
* catalog — which a caller that reads "empty" as "unknown" then degrades into
|
|
36
|
-
* "accept anything". Resolving against the same base URL the runtime already
|
|
37
|
-
* routes completions through keeps discovery and dispatch pointed at one place.
|
|
38
|
-
*
|
|
39
|
-
* Precedence: explicit `baseUrl` argument → the endpoint's `baseUrlEnv` value
|
|
40
|
-
* in `env` → the provider's own `url`. A provider with no `path` has no
|
|
41
|
-
* gateway form and always returns `url`.
|
|
42
|
-
*
|
|
43
|
-
* The base URL is joined tolerantly: a trailing slash is stripped, and a base
|
|
44
|
-
* that already ends in the path's leading version segment (`…/v1` for a
|
|
45
|
-
* `/v1/models` path) is not doubled up. Both spellings are common in the wild.
|
|
46
|
-
*
|
|
47
|
-
* Pure: reads only the `env` record it is handed.
|
|
48
|
-
*
|
|
49
|
-
* @since 1.5.0
|
|
50
|
-
*/
|
|
51
|
-
export declare function resolveProviderModelsUrl(provider: string, options?: {
|
|
52
|
-
baseUrl?: string;
|
|
53
|
-
env?: Record<string, string | undefined>;
|
|
54
|
-
}): string | undefined;
|
|
55
|
-
//# sourceMappingURL=provider-endpoints.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"provider-endpoints.d.ts","sourceRoot":"","sources":["../../../bridge/src/provider-endpoints.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,gEAAgE;AAChE,MAAM,WAAW,gBAAgB;IAC/B,kEAAkE;IAClE,GAAG,EAAE,MAAM,CAAC;IACZ;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjD,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CA8C/D,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE;IAAE,OAAO,CAA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vB,CAAA;AACD,EAAA,OAAO,MAAA;AACT;ACtcA,IAAM,uBAAA,GAA0B,GAAA;AAwBzB,SAAS,uBAAuB,GAAA,EAAkD;AACvF,EAAA,OAAO,GAAA,EAAK,qBAAqB,OAAA,CAAQ,GAAA,CAAI,qBAAqBA,IAAAA,CAAK,OAAA,IAAW,SAAS,CAAA;AAC7F;AAgBA,eAAsB,qBAAA,CACpB,WACA,IAAA,EAKyC;AACzC,EAAA,MAAM,SAAA,GAAY,sBAAA,CAAuB,IAAA,EAAM,GAAG,CAAA;AAClD,EAAA,MAAM,SAAA,GAAY,MAAM,SAAA,IAAa,uBAAA;AACrC,EAAA,MAAM,MAAA,GAAS,MAAM,MAAA,IAAU,oBAAA;AAC/B,EAAA,IAAI;AAIF,IAAA,MAAM,WAAW,MAAM,cAAA;AAAA,MACrB,gBAAgB,SAAS,CAAA,CAAA;AAAA,MACzB,MAAM,MAAA,CAAO,SAAA,EAAW,SAAS,CAAA;AAAA,MACjC;AAAA,KACF;AACA,IAAA,OAAO,WAAW,kBAAA,GAAqB,YAAA;AAAA,EACzC,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,MAAA;AAAA,EACT;AACF","file":"chunk-3NCGSSCU.js","sourcesContent":["/**\n * AI cloud-provider transport dimension for the `claude-sdk` driver.\n *\n * `cloud` is a config axis orthogonal to `provider` (model vendor) and\n * `driver` (agent runtime). Under `driver: claude-sdk` each non-default value\n * maps to one of the Claude Agent SDK's native env-var transports:\n * Amazon Bedrock, Google Vertex AI, Azure AI Foundry, or a generic\n * `ANTHROPIC_BASE_URL` gateway (LiteLLM / corporate proxy).\n *\n * Cross-repo contract: env key names and semantics here are load-bearing —\n * the platform resolves credential bundles against the same key set.\n */\n\n/**\n * Canonical list of supported cloud transports. `\"default\"` (or an absent\n * `cloud` field) means the provider's native API — today's behavior, unchanged.\n *\n * The codec in `core/workspace-config.ts` keeps a local copy (`KNOWN_CLOUDS`)\n * to avoid an import cycle; a drift test asserts parity.\n *\n * @since 1.3.0\n */\nexport const SUPPORTED_CLOUDS = [\"default\", \"bedrock\", \"vertex\", \"azure\", \"gateway\"] as const;\n\n/** One of the supported cloud transport identifiers. */\nexport type CloudId = (typeof SUPPORTED_CLOUDS)[number];\n\n/**\n * Non-secret transport settings for a cloud. Sourced from skaile.yaml\n * `cloud_config` (snake_case on the wire, camelCase in-process — converted\n * exactly once at the settings/serve boundary).\n *\n * Must stay field-identical with core's `CloudTransportConfig` and the inline\n * `AgentSessionConfig.cloudConfig` shape (kept separate to avoid a core↔bridge\n * import cycle) — a field added here must be added there too.\n *\n * @since 1.3.0\n */\nexport interface CloudConfig {\n /** bedrock: AWS region (`AWS_REGION`); vertex: `CLOUD_ML_REGION`. */\n region?: string;\n /** vertex only: GCP project (`ANTHROPIC_VERTEX_PROJECT_ID`). */\n projectId?: string;\n /** azure only: Foundry resource name (`ANTHROPIC_FOUNDRY_RESOURCE`). */\n resource?: string;\n /** azure (alternative to `resource`) / gateway (required): endpoint base URL. */\n baseUrl?: string;\n}\n\n/**\n * Secret env keys that make up the credential bundle for each non-default\n * cloud. The platform delivers these env-keyed in the `session_init` secrets\n * map; the runner picks them out via `resolveCloudSecretBundle`.\n *\n * Vertex note: `GOOGLE_APPLICATION_CREDENTIALS_JSON` is our convention for the\n * raw service-account JSON blob. The runner materializes it to a 0600 file and\n * hands the driver `GOOGLE_APPLICATION_CREDENTIALS` (a path) instead — the\n * driver never sees the raw JSON.\n *\n * @since 1.3.0\n */\nexport const CLOUD_SECRET_ENV_KEYS: Record<Exclude<CloudId, \"default\">, readonly string[]> = {\n bedrock: [\n \"AWS_ACCESS_KEY_ID\",\n \"AWS_SECRET_ACCESS_KEY\",\n \"AWS_SESSION_TOKEN\",\n \"AWS_BEARER_TOKEN_BEDROCK\",\n ],\n vertex: [\"GOOGLE_APPLICATION_CREDENTIALS_JSON\"],\n azure: [\"ANTHROPIC_FOUNDRY_API_KEY\"],\n gateway: [\"ANTHROPIC_AUTH_TOKEN\", \"ANTHROPIC_API_KEY\"],\n};\n\n/**\n * Env vars scrubbed from the inherited environment before a non-default cloud\n * transport is assembled. Ambient first-party credentials or a stale\n * `CLAUDE_CODE_USE_*` flag must never leak into a Bedrock/Vertex/Foundry/\n * gateway session (the gateway branch re-adds its own carriers explicitly).\n *\n * Deliberately NOT exhaustive across clouds: ambient cloud-specific vars\n * (AWS_*, GOOGLE_*, ANTHROPIC_VERTEX_PROJECT_ID, ANTHROPIC_FOUNDRY_*) survive\n * so a standalone CLI inherits its own cloud's environment; the SDK ignores\n * vars whose transport flag is unset.\n */\nconst SCRUBBED_ENV_KEYS = [\"ANTHROPIC_API_KEY\", \"ANTHROPIC_AUTH_TOKEN\", \"ANTHROPIC_BASE_URL\"];\n\n/**\n * Assemble the Claude Agent SDK child env for a non-default cloud transport.\n *\n * Pure function (no external state touched; the returned `env` is a fresh\n * object — inputs are never mutated): starts from `baseEnv` (caller passes a\n * copy of `process.env` with undefined stripped) merged with `configEnv`,\n * scrubs inherited Anthropic\n * credential/routing vars and every `CLAUDE_CODE_USE_*` flag, then sets exactly\n * one `CLAUDE_CODE_USE_*` flag (none for gateway) plus the cloud's credential\n * bundle and derived non-secret vars. AWS_* / GOOGLE_* ambient values are NOT\n * scrubbed, so a standalone CLI inherits ambient cloud credentials when no\n * explicit `cloudSecrets` bundle is provided. Gateway is the mirror case: its\n * carriers ARE the scrubbed Anthropic vars, so the gateway branch restores\n * them from `cloudSecrets` → `fallbackApiKey` (resolved `apiKeys.anthropic`)\n * → the pre-scrub config/ambient value — otherwise a standalone gateway\n * session would have no reachable auth carrier at all.\n *\n * Never returns `undefined` values; absent settings are simply omitted.\n *\n * @since 1.3.0\n */\nexport function buildClaudeCloudEnv(args: {\n cloud: Exclude<CloudId, \"default\">;\n cloudConfig?: CloudConfig;\n cloudSecrets?: Record<string, string>;\n baseEnv: Record<string, string>;\n configEnv?: Record<string, string>;\n /** Resolved API key (e.g. `apiKeys.anthropic`) — gateway auth fallback only. */\n fallbackApiKey?: string;\n}): Record<string, string> {\n const { cloud, cloudConfig, cloudSecrets, baseEnv, configEnv, fallbackApiKey } = args;\n const env: Record<string, string> = { ...baseEnv, ...(configEnv ?? {}) };\n\n // Captured before the scrub — gateway falls back to these carriers.\n const ambient = {\n authToken: env.ANTHROPIC_AUTH_TOKEN,\n apiKey: env.ANTHROPIC_API_KEY,\n baseUrl: env.ANTHROPIC_BASE_URL,\n };\n\n for (const key of Object.keys(env)) {\n if (SCRUBBED_ENV_KEYS.includes(key) || key.startsWith(\"CLAUDE_CODE_USE_\")) {\n delete env[key];\n }\n }\n\n const set = (key: string, value: string | undefined) => {\n // Falsy check is deliberate: an empty-string credential/setting is never\n // valid env — dropping it beats shipping a key the SDK treats as set.\n if (value) env[key] = value;\n };\n\n switch (cloud) {\n case \"bedrock\": {\n env.CLAUDE_CODE_USE_BEDROCK = \"1\";\n // Explicit bundle values override ambient AWS_* (which survive the scrub\n // so a standalone CLI keeps its ambient credentials).\n for (const key of CLOUD_SECRET_ENV_KEYS.bedrock) set(key, cloudSecrets?.[key]);\n set(\"AWS_REGION\", cloudConfig?.region);\n break;\n }\n case \"vertex\": {\n env.CLAUDE_CODE_USE_VERTEX = \"1\";\n // Runner-materialized SA file path; ambient GOOGLE_APPLICATION_CREDENTIALS\n // is kept when no bundle value is provided.\n set(\"GOOGLE_APPLICATION_CREDENTIALS\", cloudSecrets?.GOOGLE_APPLICATION_CREDENTIALS);\n set(\"ANTHROPIC_VERTEX_PROJECT_ID\", cloudConfig?.projectId);\n set(\"CLOUD_ML_REGION\", cloudConfig?.region);\n break;\n }\n case \"azure\": {\n env.CLAUDE_CODE_USE_FOUNDRY = \"1\";\n set(\"ANTHROPIC_FOUNDRY_API_KEY\", cloudSecrets?.ANTHROPIC_FOUNDRY_API_KEY);\n // Resource wins over base_url when both are configured.\n if (cloudConfig?.resource) {\n env.ANTHROPIC_FOUNDRY_RESOURCE = cloudConfig.resource;\n } else {\n set(\"ANTHROPIC_FOUNDRY_BASE_URL\", cloudConfig?.baseUrl);\n }\n break;\n }\n case \"gateway\": {\n // No CLAUDE_CODE_USE_* flag — the gateway is addressed purely via\n // ANTHROPIC_BASE_URL plus an auth carrier. Explicit bundle wins;\n // standalone sessions fall back to the resolved key / ambient carriers.\n set(\"ANTHROPIC_BASE_URL\", cloudConfig?.baseUrl ?? ambient.baseUrl);\n const authToken = cloudSecrets?.ANTHROPIC_AUTH_TOKEN ?? ambient.authToken;\n if (authToken) {\n env.ANTHROPIC_AUTH_TOKEN = authToken;\n } else {\n set(\n \"ANTHROPIC_API_KEY\",\n cloudSecrets?.ANTHROPIC_API_KEY ?? fallbackApiKey ?? ambient.apiKey,\n );\n }\n break;\n }\n }\n\n return env;\n}\n","/**\n * Poisoned-transcript repair for the Claude Agent SDK driver.\n *\n * The Anthropic Messages API can permanently reject a conversation once its\n * persisted history contains a malformed content block. Because the bad block\n * lives in the SDK's on-disk JSONL transcript, every replayed turn fails with\n * the same `400 invalid_request_error` and the session is bricked with no\n * in-band recovery.\n *\n * This module repairs the transcript in place, covering three known poison\n * classes:\n *\n * 1. **Image `media_type` mismatch / omission.** An image block whose declared\n * `media_type` does not match — or is missing for — the actual bytes:\n * `... The image was specified using the image/png media type, but the\n * image appears to be a image/jpeg image`. Produced by the Claude Code\n * `Read` tool's format fallback (anthropics/claude-code#55338, #30124,\n * #33179). Repaired by sniffing the base64 magic bytes and correcting\n * `media_type`.\n * 2. **Oversized image.** An image whose decoded payload exceeds the API's\n * 5 MB per-image limit (anthropics/claude-code#34566). Replaced with a\n * text stub — the byte budget cannot be recovered any other way.\n * 3. **`cache_control` on an empty text block.** A text block carrying a\n * `cache_control` marker with empty/whitespace `text`\n * (anthropics/claude-code#59626). The `cache_control` field is stripped.\n *\n * Genuinely unidentifiable image blocks are also replaced with a text stub.\n *\n * Recovering by content scan (rather than parsing the API's `messages.N`\n * index) is deliberate: the index addresses the assembled API request, not a\n * JSONL line, and reproducing the SDK's message-assembly is fragile. A full\n * scan is index-free and repairs every poisoned block in one pass.\n *\n * **Async and line-streaming since #454.** A Claude Code transcript is routinely\n * multi-megabyte (base64 images inline in `tool_result` blocks), and this runs on\n * a failed turn *and before every resume* — inside the single-threaded `skaile\n * serve` loop. The previous `readFileSync` + `writeFileSync` + `renameSync` held\n * the loop for the whole file and materialised it twice over as one string. Both\n * passes now stream line by line off a `createReadStream`, so the loop is yielded\n * between lines and peak memory is one JSONL line rather than the whole file, and\n * every I/O phase is deadline-bounded.\n *\n * Streaming was chosen over a worker thread: the work is I/O-bound rather than\n * CPU-bound (per-line `JSON.parse` on a yielded loop is not what stalls a turn),\n * and a worker would add a structured-clone of the same multi-MB payload plus a\n * thread lifecycle to a path that must never block a turn.\n *\n * @module\n */\n\nimport { createReadStream, createWriteStream } from \"node:fs\";\nimport { readdir, rename, stat, unlink } from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport { pipeline } from \"node:stream/promises\";\nimport { fsDeadlineMs, tryWithFsDeadline, withFsDeadline } from \"@skaile/workspaces/core\";\n\n/**\n * Minimal logger shape accepted by {@link scrubPoisonedTranscript}. Compatible\n * with the bridge `Logger`, but narrowed so the helper stays unit-testable\n * without a real logger instance.\n *\n * @category Transcript repair\n */\nexport interface ScrubLogger {\n info(message: string, data?: Record<string, unknown>): void;\n warn(message: string, data?: Record<string, unknown>): void;\n}\n\n/**\n * Options for {@link scrubPoisonedTranscript}.\n *\n * @category Transcript repair\n */\nexport interface ScrubTranscriptOptions {\n /**\n * Claude Code config directory — the parent of `projects/`. Resolve from\n * `CLAUDE_CONFIG_DIR`, falling back to `~/.claude`.\n */\n configDir: string;\n /** SDK session id whose transcript JSONL should be repaired. */\n sessionId: string;\n /** Optional logger for diagnostics. */\n log?: ScrubLogger;\n}\n\n/**\n * Outcome of a {@link scrubPoisonedTranscript} pass.\n *\n * @category Transcript repair\n */\nexport interface ScrubTranscriptResult {\n /** The located JSONL transcript path, or `null` when not found. */\n filePath: string | null;\n /** Image blocks whose `media_type` was corrected (or filled in) to match the bytes. */\n corrected: number;\n /**\n * Image blocks replaced with a text stub — either unidentifiable bytes or a\n * payload over the API's 5 MB per-image limit.\n */\n stubbed: number;\n /** Empty text blocks from which a rejected `cache_control` marker was stripped. */\n cacheStripped: number;\n /**\n * `true` when the transcript was located, contained at least one poisoned\n * block, and was rewritten. `false` means nothing needed repair (or the\n * file was not found) — the caller should not retry the resume.\n */\n changed: boolean;\n}\n\n/** Text inserted in place of an image block whose format cannot be identified. */\nconst STUB_TEXT = \"[image removed: unprocessable image data]\";\n\n/** Text inserted in place of an image block that exceeds the API size limit. */\nconst STUB_TEXT_OVERSIZED = \"[image removed: image too large]\";\n\n/**\n * The Anthropic Messages API rejects any single image whose decoded payload\n * exceeds 5 MB. An image at or under this is left alone; a larger one is\n * stubbed (its byte budget cannot be recovered).\n */\nconst MAX_IMAGE_BYTES = 5 * 1024 * 1024;\n\n/**\n * Identify an image's media type from the leading bytes of its base64 payload.\n *\n * Recognises the four formats the Anthropic API accepts. Returns `null` when\n * the magic bytes match no known format — the caller treats that as a\n * genuinely corrupt block and stubs it.\n *\n * @param base64 - Base64-encoded image data (only the prefix is inspected).\n * @returns An `image/*` media type, or `null` when unrecognised.\n * @category Transcript repair\n */\nexport function sniffImageMediaType(base64: string): string | null {\n let buf: Buffer;\n try {\n // 32 base64 chars decode to 24 bytes — enough for the WebP check at 12.\n buf = Buffer.from(base64.slice(0, 32), \"base64\");\n } catch {\n return null;\n }\n if (buf.length < 4) {\n return null;\n }\n // JPEG — SOI marker `FF D8`. Third byte varies (and may be corrupt), so a\n // two-byte check is intentional: it still matches malformed JPEGs, which is\n // exactly the poison case the API flags as \"appears to be image/jpeg\".\n if (buf[0] === 0xff && buf[1] === 0xd8) {\n return \"image/jpeg\";\n }\n // PNG — `89 50 4E 47`.\n if (buf[0] === 0x89 && buf[1] === 0x50 && buf[2] === 0x4e && buf[3] === 0x47) {\n return \"image/png\";\n }\n // GIF — `47 49 46 38` (\"GIF8\").\n if (buf[0] === 0x47 && buf[1] === 0x49 && buf[2] === 0x46 && buf[3] === 0x38) {\n return \"image/gif\";\n }\n // WebP — `RIFF` at 0..3 and `WEBP` at 8..11.\n if (\n buf.length >= 12 &&\n buf[0] === 0x52 &&\n buf[1] === 0x49 &&\n buf[2] === 0x46 &&\n buf[3] === 0x46 &&\n buf[8] === 0x57 &&\n buf[9] === 0x45 &&\n buf[10] === 0x42 &&\n buf[11] === 0x50\n ) {\n return \"image/webp\";\n }\n return null;\n}\n\n/** A base64 image source on a content block (shape is SDK-defined). */\ninterface Base64ImageSource {\n type?: string;\n media_type?: string;\n data?: string;\n}\n\n/** Loosely-typed content block from a transcript message. */\ninterface ContentBlockLike {\n type?: string;\n source?: Base64ImageSource;\n content?: unknown;\n [k: string]: unknown;\n}\n\n/** Mutable counters threaded through one scrub pass. */\ninterface ScrubCounters {\n corrected: number;\n stubbed: number;\n cacheStripped: number;\n}\n\n/** Total repairs recorded in a counter set — used to detect per-line changes. */\nfunction totalChanges(c: ScrubCounters): number {\n return c.corrected + c.stubbed + c.cacheStripped;\n}\n\n/**\n * Repair a single content block. Returns the (possibly replaced) block.\n *\n * - A `tool_result` block recurses into its `content` array.\n * - A text block carrying a `cache_control` marker whose `text` is empty or\n * whitespace has the marker stripped (the API rejects `cache_control` on\n * empty text blocks).\n * - An image block whose decoded payload exceeds the API's 5 MB limit is\n * replaced with a text stub.\n * - An image block whose bytes match no known format is replaced with a text\n * stub (an image cannot simply be dropped — a `tool_result` must keep at\n * least one content entry, and a bare `image` block is replaced 1:1).\n * - An image block whose declared `media_type` mismatches (or is missing for)\n * the sniffed type is corrected in place.\n * - Every other block is returned untouched.\n */\nfunction scrubBlock(block: ContentBlockLike, counters: ScrubCounters): ContentBlockLike {\n if (block.type === \"tool_result\" && Array.isArray(block.content)) {\n return {\n ...block,\n content: (block.content as ContentBlockLike[]).map((inner) => scrubBlock(inner, counters)),\n };\n }\n\n // A `cache_control` marker on a text block whose text is empty or whitespace\n // is rejected by the API (\"cache_control cannot be set for empty text\n // blocks\"). Strip the marker — the empty block itself is harmless.\n if (block.type === \"text\" && block.cache_control != null) {\n const text = typeof block.text === \"string\" ? block.text : \"\";\n if (text.trim() === \"\") {\n counters.cacheStripped++;\n const clone = { ...block };\n delete clone.cache_control;\n return clone;\n }\n }\n\n if (\n block.type === \"image\" &&\n block.source?.type === \"base64\" &&\n typeof block.source.data === \"string\"\n ) {\n const data = block.source.data;\n // The API rejects any image whose decoded payload exceeds 5 MB. The byte\n // budget cannot be salvaged, so the whole block becomes a text stub.\n // base64 encodes 3 bytes per 4 chars, so decoded length ≈ len * 3 / 4.\n if (Math.floor((data.length * 3) / 4) > MAX_IMAGE_BYTES) {\n counters.stubbed++;\n return { type: \"text\", text: STUB_TEXT_OVERSIZED };\n }\n const sniffed = sniffImageMediaType(data);\n if (sniffed === null) {\n counters.stubbed++;\n return { type: \"text\", text: STUB_TEXT };\n }\n if (sniffed !== block.source.media_type) {\n counters.corrected++;\n return { ...block, source: { ...block.source, media_type: sniffed } };\n }\n }\n\n return block;\n}\n\n/**\n * Locate the JSONL transcript for `sessionId` under `<configDir>/projects/`.\n *\n * Claude Code encodes the project directory into the `projects/` subfolder\n * name; rather than reproduce that encoding, this scans every subfolder for\n * `<sessionId>.jsonl` (the session id is a UUID — globally unique).\n *\n * Async and deadline-bounded since #454. The `existsSync(projectsDir)` probe is\n * gone: `readdir` already fails on a missing directory, so the probe was a\n * second stat on the same path for no information.\n *\n * `timeoutMs` defaults to {@link fsDeadlineMs} so callers that only need the\n * path (the resume probe) can omit it.\n *\n * @category Transcript repair\n */\nexport async function locateTranscriptPath(\n configDir: string,\n sessionId: string,\n timeoutMs: number = fsDeadlineMs(),\n): Promise<string | null> {\n const projectsDir = join(configDir, \"projects\");\n const entries = await tryWithFsDeadline(\n `readdir ${projectsDir}`,\n () => readdir(projectsDir),\n null,\n timeoutMs,\n );\n if (!entries) return null;\n for (const entry of entries) {\n const candidate = join(projectsDir, entry, `${sessionId}.jsonl`);\n const found = await tryWithFsDeadline(\n `stat ${candidate}`,\n async () => (await stat(candidate)).isFile(),\n false,\n timeoutMs,\n );\n if (found) return candidate;\n }\n return null;\n}\n\n/**\n * Yield a file's contents line by line, reproducing `readFileSync(...).split(\"\\n\")`\n * exactly — including the final (possibly empty) segment, so a trailing newline\n * survives a rewrite byte for byte.\n *\n * Splits on `\\n` alone, so a line out of a CRLF transcript arrives with its\n * `\\r` still attached. That carrier byte is part of the line here, and\n * {@link repairLine} re-attaches it to a line it rewrites — the file keeps the\n * terminator style it arrived with. Deliberately not `node:readline`:\n * `crlfDelay` strips the `\\r` outright (rewriting a CRLF transcript to LF) and\n * the interface swallows the trailing-newline distinction, either of which\n * would make the \"clean transcript is left byte-for-byte untouched\" guarantee\n * false. Only one line is held in memory at a time, so a multi-MB transcript\n * never materialises as a single string.\n */\nasync function* streamLines(filePath: string): AsyncGenerator<string> {\n const stream = createReadStream(filePath, { encoding: \"utf8\" });\n let pending = \"\";\n try {\n for await (const chunk of stream) {\n pending += chunk as string;\n let idx = pending.indexOf(\"\\n\");\n while (idx !== -1) {\n yield pending.slice(0, idx);\n pending = pending.slice(idx + 1);\n idx = pending.indexOf(\"\\n\");\n }\n }\n yield pending;\n } finally {\n stream.destroy();\n }\n}\n\n/**\n * Repair one JSONL line, returning the (possibly rewritten) line and mutating\n * `counters`. A non-JSON, blank, or content-less line is returned untouched.\n *\n * The reader splits on `\\n` only, so a line from a CRLF transcript still carries\n * its trailing `\\r`. An untouched line is returned verbatim and keeps it; a\n * rewritten one is rebuilt by `JSON.stringify`, which would drop it — leaving a\n * repaired CRLF transcript with mixed line endings. So the terminator is split\n * off before the parse and re-appended to the rewritten line.\n */\nfunction repairLine(line: string, counters: ScrubCounters): string {\n if (line.trim() === \"\") return line;\n const eol = line.endsWith(\"\\r\") ? \"\\r\" : \"\";\n const body = eol === \"\" ? line : line.slice(0, -1);\n let entry: { message?: { content?: unknown } };\n try {\n entry = JSON.parse(body);\n } catch {\n return line; // Not JSON — leave untouched.\n }\n const content = entry.message?.content;\n if (!Array.isArray(content)) return line;\n const before = totalChanges(counters);\n const scrubbed = (content as ContentBlockLike[]).map((block) => scrubBlock(block, counters));\n if (totalChanges(counters) === before) return line; // Nothing changed on this line.\n return `${JSON.stringify({ ...entry, message: { ...entry.message, content: scrubbed } })}${eol}`;\n}\n\n/**\n * Scan a Claude Code SDK transcript for image content blocks whose declared\n * `media_type` does not match the actual bytes, repair them, and atomically\n * rewrite the file.\n *\n * Safe to call after a turn has failed: the SDK query is dead at that point,\n * and the next resume re-reads the transcript from disk.\n *\n * **Async since #454.** Two streaming passes rather than one whole-file read:\n * pass 1 counts repairs without writing anything, and pass 2 runs only when\n * pass 1 found something. The common case — the preventive scrub of a clean\n * transcript before every resume — is therefore one streaming read and zero\n * writes, and a clean transcript is still left byte-for-byte untouched.\n *\n * @param opts - Config directory, session id, and an optional logger.\n * @returns A {@link ScrubTranscriptResult}. When `changed` is `true` the\n * caller may retry the resume with the same session id.\n * @category Transcript repair\n */\nexport async function scrubPoisonedTranscript(\n opts: ScrubTranscriptOptions,\n): Promise<ScrubTranscriptResult> {\n const { configDir, sessionId, log } = opts;\n const timeoutMs = fsDeadlineMs();\n const result: ScrubTranscriptResult = {\n filePath: null,\n corrected: 0,\n stubbed: 0,\n cacheStripped: 0,\n changed: false,\n };\n\n const filePath = await locateTranscriptPath(configDir, sessionId, timeoutMs);\n if (!filePath) {\n log?.warn(\"scrub-transcript: no transcript found\", { configDir, sessionId });\n return result;\n }\n result.filePath = filePath;\n\n // ── Pass 1: detect. Streams the transcript, counting repairs, writing nothing.\n const counters: ScrubCounters = { corrected: 0, stubbed: 0, cacheStripped: 0 };\n try {\n await withFsDeadline(\n `scan transcript ${filePath}`,\n async () => {\n for await (const line of streamLines(filePath)) repairLine(line, counters);\n },\n timeoutMs,\n );\n } catch (err) {\n log?.warn(\"scrub-transcript: failed to read transcript\", {\n filePath,\n error: err instanceof Error ? err.message : String(err),\n });\n return result;\n }\n\n result.corrected = counters.corrected;\n result.stubbed = counters.stubbed;\n result.cacheStripped = counters.cacheStripped;\n\n if (totalChanges(counters) === 0) {\n return result;\n }\n\n // ── Pass 2: rewrite. Atomic: stream a sibling temp file, then rename over the\n // original. Line separators are re-emitted exactly as pass 1 split them, so a\n // trailing newline and any blank lines survive verbatim.\n const tmpPath = `${filePath}.scrub-tmp`;\n try {\n await withFsDeadline(\n `rewrite transcript ${filePath}`,\n async () => {\n const discard: ScrubCounters = { corrected: 0, stubbed: 0, cacheStripped: 0 };\n await pipeline(\n (async function* () {\n let first = true;\n for await (const line of streamLines(filePath)) {\n yield first ? repairLine(line, discard) : `\\n${repairLine(line, discard)}`;\n first = false;\n }\n })(),\n createWriteStream(tmpPath, { encoding: \"utf8\" }),\n );\n await rename(tmpPath, filePath);\n },\n timeoutMs,\n );\n } catch (err) {\n log?.warn(\"scrub-transcript: failed to rewrite transcript\", {\n filePath,\n error: err instanceof Error ? err.message : String(err),\n });\n // Never leave a half-written sibling behind — the next scrub would rewrite\n // it anyway, but a stray `.scrub-tmp` in the SDK's projects dir is noise.\n await tryWithFsDeadline(`unlink ${tmpPath}`, () => unlink(tmpPath), undefined, timeoutMs);\n return result;\n }\n\n result.changed = true;\n log?.info(\"scrub-transcript: repaired poisoned transcript\", {\n filePath,\n corrected: result.corrected,\n stubbed: result.stubbed,\n cacheStripped: result.cacheStripped,\n });\n return result;\n}\n","/**\n * Pre-first-turn resume probe for the Claude Agent SDK driver.\n *\n * A tier-1 native resume only hands its session id to the SDK inside the first\n * real turn, so the `jsonl_lost` outcome (\"No conversation found\") is invisible\n * until a turn is consumed. The runner shares the container filesystem with the\n * SDK, so a cheap `stat` of the on-disk JSONL transcript is an authoritative,\n * side-effect-free signal of whether the resume will find its history — no\n * probe query, no spurious model turn.\n *\n * @module\n */\n\nimport { homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport { withFsDeadline } from \"@skaile/workspaces/core\";\nimport { locateTranscriptPath } from \"./scrub-transcript.js\";\n\n/**\n * Overall wall-clock budget for the probe. Deliberately a small fraction of the\n * platform's `session_init_ack` timeout (`DEFAULT_INIT_ACK_TIMEOUT_MS`, 15s):\n * the probe runs synchronously on the pre-ack path, so a wedged\n * `CLAUDE_CONFIG_DIR` mount must never push the ack past its deadline.\n */\nconst RESUME_PROBE_TIMEOUT_MS = 2_000;\n\n/**\n * Outcome of {@link probeResumeTranscript}: whether the SDK transcript for a\n * requested tier-1 resume exists on disk.\n *\n * @category Resume probe\n */\nexport type ResumeProbeOutcome = \"transcript_found\" | \"jsonl_lost\";\n\n/**\n * Resolve the Claude Code config directory — the parent of `projects/` — from\n * an explicit env map, the process environment, or the `~/.claude` default.\n *\n * The runner's probe and the claude-sdk driver share this one resolver, so they\n * agree as long as they see the same `CLAUDE_CONFIG_DIR`. Today they do:\n * `CLAUDE_CONFIG_DIR` is container-scoped and neither side threads a per-session\n * override through `config.env`, so both fall through to `process.env`. If a\n * future change ever set the driver's `config.env.CLAUDE_CONFIG_DIR` to a\n * divergent path, the reactive `resume_failed { jsonl_lost }` turn remains the\n * safety net.\n *\n * @category Resume probe\n */\nexport function resolveClaudeConfigDir(env?: Record<string, string | undefined>): string {\n return env?.CLAUDE_CONFIG_DIR || process.env.CLAUDE_CONFIG_DIR || join(homedir(), \".claude\");\n}\n\n/**\n * Probe whether the SDK JSONL transcript for `sessionId` exists on disk.\n *\n * Non-null locator result → `transcript_found`; null → `jsonl_lost`;\n * `undefined` → outcome unknown (the probe exceeded its budget or errored). The\n * caller leaves the ack field ABSENT on `undefined` so the reactive\n * `resume_failed { jsonl_lost }` turn stays the safety net — a timed-out probe\n * must never masquerade as a genuine `jsonl_lost` and force a needless downgrade.\n *\n * `opts.timeoutMs` overrides {@link RESUME_PROBE_TIMEOUT_MS}; `opts.locate`\n * overrides the transcript locator (used by tests / alternate stores).\n *\n * @category Resume probe\n */\nexport async function probeResumeTranscript(\n sessionId: string,\n opts?: {\n env?: Record<string, string | undefined>;\n timeoutMs?: number;\n locate?: (configDir: string, sessionId: string) => Promise<string | null>;\n },\n): Promise<ResumeProbeOutcome | undefined> {\n const configDir = resolveClaudeConfigDir(opts?.env);\n const timeoutMs = opts?.timeoutMs ?? RESUME_PROBE_TIMEOUT_MS;\n const locate = opts?.locate ?? locateTranscriptPath;\n try {\n // Bound the whole probe on wall-clock and THROW on expiry: the inner per-op\n // deadline swallows a timeout into a null path (a false `jsonl_lost`), so a\n // wedged mount must yield \"unknown\" here rather than a spurious downgrade.\n const filePath = await withFsDeadline(\n `resume-probe ${sessionId}`,\n () => locate(configDir, sessionId),\n timeoutMs,\n );\n return filePath ? \"transcript_found\" : \"jsonl_lost\";\n } catch {\n return undefined;\n }\n}\n"]}
|