@skaile/workspaces 0.22.0-beta.0 → 0.22.0-beta.2
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 +221 -0
- package/dist/{asset-feeds-PJDJ3QYI.js → asset-feeds-2M6UKEJ7.js} +13 -14
- package/dist/asset-feeds-2M6UKEJ7.js.map +1 -0
- package/dist/asset-manager/catalog-deployer.d.ts +2 -0
- package/dist/asset-manager/contrib.d.ts +2 -0
- package/dist/asset-manager/fragments.d.ts +2 -0
- package/dist/asset-manager/history.d.ts +2 -0
- package/dist/asset-manager/index.d.ts +2 -0
- package/dist/asset-manager/index.js +7 -7
- package/dist/asset-manager/installer.d.ts +2 -0
- package/dist/asset-manager/installer.js +6 -6
- package/dist/asset-manager/renderers.d.ts +2 -0
- package/dist/asset-manager/src/index.d.ts +18 -7
- package/dist/asset-manager/src/index.d.ts.map +1 -1
- package/dist/asset-manager/src/installer.d.ts +3 -3
- package/dist/asset-manager/src/installer.d.ts.map +1 -1
- package/dist/base-assets/connectors/deploy.d.ts +2 -0
- package/dist/base-assets/connectors/deploy.js +8 -8
- package/dist/base-assets/connectors/devserver.d.ts +2 -0
- package/dist/base-assets/connectors/devserver.js +8 -8
- package/dist/base-assets/connectors/flow/adapter.js +8 -8
- package/dist/base-assets/connectors/flow/engine.d.ts +2 -0
- package/dist/base-assets/connectors/flow/run-flow.js +9 -9
- package/dist/base-assets/connectors/flow.d.ts +2 -0
- package/dist/base-assets/connectors/flow.js +8 -8
- package/dist/base-assets/connectors/git/driver.d.ts.map +1 -1
- package/dist/base-assets/connectors/git.d.ts +2 -0
- package/dist/base-assets/connectors/git.js +8 -8
- package/dist/base-assets/connectors/gmail.d.ts +2 -0
- package/dist/base-assets/connectors/gmail.js +8 -8
- package/dist/base-assets/connectors/googledrive.d.ts +2 -0
- package/dist/base-assets/connectors/googledrive.js +8 -8
- package/dist/base-assets/connectors/local.d.ts +2 -0
- package/dist/base-assets/connectors/local.js +8 -8
- package/dist/base-assets/connectors/mattermost.d.ts +2 -0
- package/dist/base-assets/connectors/mattermost.js +8 -8
- package/dist/base-assets/connectors/memory.d.ts +2 -0
- package/dist/base-assets/connectors/memory.js +8 -8
- package/dist/base-assets/connectors/minio.d.ts +2 -0
- package/dist/base-assets/connectors/minio.js +8 -8
- package/dist/base-assets/connectors/postgres.d.ts +2 -0
- package/dist/base-assets/connectors/postgres.js +8 -8
- package/dist/base-assets/connectors/s3.d.ts +2 -0
- package/dist/base-assets/connectors/s3.js +8 -8
- package/dist/base-assets/connectors/sharepoint.d.ts +2 -0
- package/dist/base-assets/connectors/sharepoint.js +8 -8
- package/dist/base-assets/connectors/sqlite.d.ts +2 -0
- package/dist/base-assets/connectors/sqlite.js +8 -8
- package/dist/base-assets/connectors/static-server.d.ts +2 -0
- package/dist/base-assets/connectors/static-server.js +8 -8
- package/dist/base-assets/connectors/tunnel.d.ts +2 -0
- package/dist/base-assets/connectors/tunnel.js +8 -8
- package/dist/base-assets/connectors/webdav.d.ts +2 -0
- package/dist/base-assets/connectors/webdav.js +8 -8
- package/dist/base-assets/connectors/xstate-store.d.ts +2 -0
- package/dist/base-assets/connectors/xstate-store.js +8 -8
- package/dist/base-assets/connectors/xstate.d.ts +2 -0
- package/dist/base-assets/connectors/xstate.js +8 -8
- package/dist/bridge/drivers/claude-sdk.d.ts +2 -0
- package/dist/bridge/drivers/claude-sdk.js +2 -2
- package/dist/bridge/drivers/codex.d.ts +2 -0
- package/dist/bridge/drivers/codex.js +2 -2
- package/dist/bridge/drivers/echo.d.ts +2 -0
- package/dist/bridge/drivers/echo.js +2 -2
- package/dist/bridge/drivers/omp.d.ts +2 -0
- package/dist/bridge/drivers/omp.js +2 -2
- package/dist/bridge/index.d.ts +2 -0
- package/dist/bridge/index.js +3 -3
- package/dist/bridge/src/registry.d.ts +4 -2
- package/dist/bridge/src/registry.d.ts.map +1 -1
- package/dist/chunk-32NA4TVC.js +30 -0
- package/dist/chunk-32NA4TVC.js.map +1 -0
- package/dist/{chunk-CSDQBWE6.js → chunk-3KLWGHDE.js} +5 -5
- package/dist/{chunk-CSDQBWE6.js.map → chunk-3KLWGHDE.js.map} +1 -1
- package/dist/{chunk-UZRY5UI2.js → chunk-6E6PKKAD.js} +68 -3
- package/dist/chunk-6E6PKKAD.js.map +1 -0
- package/dist/{chunk-G6GKWGOW.js → chunk-6SA2SIOU.js} +26 -10
- package/dist/chunk-6SA2SIOU.js.map +1 -0
- package/dist/{chunk-IGQEXBBG.js → chunk-6VTG73UY.js} +13 -9
- package/dist/chunk-6VTG73UY.js.map +1 -0
- package/dist/{chunk-TTY56FQQ.js → chunk-74GTZ4TJ.js} +17 -5
- package/dist/chunk-74GTZ4TJ.js.map +1 -0
- package/dist/chunk-7QBNJTTQ.js +3 -0
- package/dist/{chunk-W2O5LWYU.js.map → chunk-7QBNJTTQ.js.map} +1 -1
- package/dist/{chunk-SL6JVGRD.js → chunk-CEUHU3C4.js} +3 -3
- package/dist/{chunk-SL6JVGRD.js.map → chunk-CEUHU3C4.js.map} +1 -1
- package/dist/{chunk-J2FCO6TM.js → chunk-FIHVQFXB.js} +2 -2
- package/dist/{chunk-J2FCO6TM.js.map → chunk-FIHVQFXB.js.map} +1 -1
- package/dist/{chunk-F3MGZ5E6.js → chunk-FVZLCBSX.js} +3 -3
- package/dist/{chunk-F3MGZ5E6.js.map → chunk-FVZLCBSX.js.map} +1 -1
- package/dist/{chunk-7PTP3SQJ.js → chunk-GTS2FODO.js} +32 -7
- package/dist/chunk-GTS2FODO.js.map +1 -0
- package/dist/{chunk-KA46DUM4.js → chunk-I5SGBFMM.js} +51 -3
- package/dist/chunk-I5SGBFMM.js.map +1 -0
- package/dist/{chunk-MO4JPTRD.js → chunk-LDLZFYLR.js} +5 -5
- package/dist/{chunk-MO4JPTRD.js.map → chunk-LDLZFYLR.js.map} +1 -1
- package/dist/{chunk-TKOLD2O7.js → chunk-LDYPQVRU.js} +516 -145
- package/dist/chunk-LDYPQVRU.js.map +1 -0
- package/dist/{chunk-GKM6MDUC.js → chunk-M5JDVO6D.js} +3 -3
- package/dist/{chunk-GKM6MDUC.js.map → chunk-M5JDVO6D.js.map} +1 -1
- package/dist/{chunk-XHFMUGDD.js → chunk-M5TE6YI5.js} +3 -3
- package/dist/{chunk-XHFMUGDD.js.map → chunk-M5TE6YI5.js.map} +1 -1
- package/dist/{chunk-NGC7ZQI4.js → chunk-NICAMYPV.js} +39 -45
- package/dist/chunk-NICAMYPV.js.map +1 -0
- package/dist/{chunk-WIR34WMU.js → chunk-NQL3T75I.js} +24 -59
- package/dist/chunk-NQL3T75I.js.map +1 -0
- package/dist/{chunk-RENHNO4J.js → chunk-P4FYHEHW.js} +206 -137
- package/dist/chunk-P4FYHEHW.js.map +1 -0
- package/dist/{chunk-2DNSSQ22.js → chunk-TWQPDBHB.js} +270 -173
- package/dist/chunk-TWQPDBHB.js.map +1 -0
- package/dist/{chunk-UZVHJ7LX.js → chunk-UBLTUFFI.js} +4 -4
- package/dist/{chunk-UZVHJ7LX.js.map → chunk-UBLTUFFI.js.map} +1 -1
- package/dist/{chunk-X5Y4EGZB.js → chunk-VUCPJBAG.js} +43 -10
- package/dist/chunk-VUCPJBAG.js.map +1 -0
- package/dist/{chunk-PBWMV5GM.js → chunk-WQ7DE5UC.js} +18 -4
- package/dist/chunk-WQ7DE5UC.js.map +1 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.js +258 -262
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/src/commands/deploy.d.ts.map +1 -1
- package/dist/cli/src/commands/manage.d.ts +22 -31
- package/dist/cli/src/commands/manage.d.ts.map +1 -1
- package/dist/cli/src/commands/npx.d.ts +5 -3
- package/dist/cli/src/commands/npx.d.ts.map +1 -1
- package/dist/cli/src/commands/project.d.ts.map +1 -1
- package/dist/cli/src/commands/source.d.ts +7 -0
- package/dist/cli/src/commands/source.d.ts.map +1 -1
- package/dist/cli/src/commands/update.d.ts.map +1 -1
- package/dist/cli/src/ensure-sources.d.ts.map +1 -1
- package/dist/client/index.d.ts +2 -0
- package/dist/connectors/config.d.ts +2 -0
- package/dist/connectors/config.js +6 -6
- package/dist/connectors/index.d.ts +2 -0
- package/dist/connectors/index.js +8 -8
- package/dist/connectors/rclone-config.d.ts +2 -0
- package/dist/connectors/rclone.d.ts +2 -0
- package/dist/connectors-shared/index.d.ts +2 -0
- package/dist/core/discovery.d.ts +2 -0
- package/dist/core/driver-targets.d.ts +2 -0
- package/dist/core/framework.d.ts +2 -0
- package/dist/core/index.d.ts +2 -0
- package/dist/core/index.js +5 -5
- package/dist/core/logging.d.ts +2 -0
- package/dist/core/manifest.d.ts +2 -0
- package/dist/core/manifest.js +2 -2
- package/dist/core/models.d.ts +2 -0
- package/dist/core/models.js +1 -1
- package/dist/core/runtime-assets.d.ts +2 -0
- package/dist/core/runtime-assets.js +4 -4
- package/dist/core/src/index.d.ts +7 -5
- package/dist/core/src/index.d.ts.map +1 -1
- package/dist/core/src/lock.d.ts +47 -26
- package/dist/core/src/lock.d.ts.map +1 -1
- package/dist/core/src/manifest.d.ts.map +1 -1
- package/dist/core/src/models.d.ts +61 -49
- package/dist/core/src/models.d.ts.map +1 -1
- package/dist/core/src/repo-manager.d.ts +79 -36
- package/dist/core/src/repo-manager.d.ts.map +1 -1
- package/dist/core/src/runtime-assets.d.ts.map +1 -1
- package/dist/core/src/walker.d.ts +52 -0
- package/dist/core/src/walker.d.ts.map +1 -0
- package/dist/core/src/workspace-config.d.ts +160 -45
- package/dist/core/src/workspace-config.d.ts.map +1 -1
- package/dist/core/src/workspace-yaml-editor.d.ts +33 -16
- package/dist/core/src/workspace-yaml-editor.d.ts.map +1 -1
- package/dist/core/store.d.ts +2 -0
- package/dist/core/workspace-config.d.ts +2 -0
- package/dist/core/workspace-config.js +3 -3
- package/dist/deploy/index.d.ts +2 -0
- package/dist/deploy/index.js +167 -52
- package/dist/deploy/index.js.map +1 -1
- package/dist/deploy/src/index.d.ts +4 -3
- package/dist/deploy/src/index.d.ts.map +1 -1
- package/dist/deploy/src/targets/container-runtime.d.ts +1 -0
- package/dist/deploy/src/targets/container-runtime.d.ts.map +1 -1
- package/dist/deploy/src/targets/docker.d.ts +1 -0
- package/dist/deploy/src/targets/docker.d.ts.map +1 -1
- package/dist/deploy/src/targets/local.d.ts.map +1 -1
- package/dist/deploy/src/targets/nix.d.ts +36 -0
- package/dist/deploy/src/targets/nix.d.ts.map +1 -0
- package/dist/deploy/src/targets/podman.d.ts +1 -0
- package/dist/deploy/src/targets/podman.d.ts.map +1 -1
- package/dist/deploy/src/targets/process-handle.d.ts +34 -0
- package/dist/deploy/src/targets/process-handle.d.ts.map +1 -0
- package/dist/discovery/index.d.ts +2 -0
- package/dist/discovery/index.js +3 -3
- package/dist/discovery/src/source-config.d.ts +2 -2
- package/dist/{ensure-sources-COGVKY44.js → ensure-sources-ALTI5PXR.js} +20 -16
- package/dist/ensure-sources-ALTI5PXR.js.map +1 -0
- package/dist/library/index.d.ts +2 -0
- package/dist/library/index.js +4 -4
- package/dist/library/src/remote/remote-catalog-source.d.ts +17 -0
- package/dist/library/src/remote/remote-catalog-source.d.ts.map +1 -1
- package/dist/open-library-EEGG6RDN.js +13 -0
- package/dist/{open-library-DWAQFUSQ.js.map → open-library-EEGG6RDN.js.map} +1 -1
- package/dist/plugin-registry/index.d.ts +2 -0
- package/dist/plugin-registry/index.js +1 -1
- package/dist/plugin-registry/src/context.d.ts +30 -1
- package/dist/plugin-registry/src/context.d.ts.map +1 -1
- package/dist/plugin-registry/src/deploy-handle.d.ts +17 -1
- package/dist/plugin-registry/src/deploy-handle.d.ts.map +1 -1
- package/dist/plugin-registry/src/deploy-helpers.d.ts +69 -0
- package/dist/plugin-registry/src/deploy-helpers.d.ts.map +1 -0
- package/dist/plugin-registry/src/index.d.ts +6 -4
- package/dist/plugin-registry/src/index.d.ts.map +1 -1
- package/dist/plugin-registry/src/internal.d.ts.map +1 -1
- package/dist/plugin-registry/src/registry.d.ts +1 -0
- package/dist/plugin-registry/src/registry.d.ts.map +1 -1
- package/dist/plugin-registry/src/targets.d.ts +4 -0
- package/dist/plugin-registry/src/targets.d.ts.map +1 -1
- package/dist/{plugin-store-6OENKNFW.js → plugin-store-G277ZX3B.js} +8 -8
- package/dist/{plugin-store-6OENKNFW.js.map → plugin-store-G277ZX3B.js.map} +1 -1
- package/dist/plugins/index.d.ts +2 -0
- package/dist/plugins/src/catalog-source.d.ts +5 -0
- package/dist/plugins/src/catalog-source.d.ts.map +1 -1
- package/dist/resolver/index.d.ts +2 -0
- package/dist/runner/index.d.ts +2 -0
- package/dist/runner/index.js +17 -16
- package/dist/runner/prompt-assembly.d.ts +2 -0
- package/dist/runner/src/resources.d.ts.map +1 -1
- package/dist/runner/src/serve.d.ts +7 -0
- package/dist/runner/src/serve.d.ts.map +1 -1
- package/dist/sdk/asset-manager.d.ts +2 -0
- package/dist/sdk/asset-manager.js +7 -7
- package/dist/sdk/bridge.d.ts +2 -0
- package/dist/sdk/bridge.js +3 -3
- package/dist/sdk/client.d.ts +2 -0
- package/dist/sdk/core.d.ts +2 -0
- package/dist/sdk/core.js +5 -5
- package/dist/sdk/flow.d.ts +2 -0
- package/dist/sdk/index.d.ts +2 -0
- package/dist/sdk/index.js +53 -19
- package/dist/sdk/index.js.map +1 -1
- package/dist/sdk/resolver.d.ts +2 -0
- package/dist/sdk/runner.d.ts +2 -0
- package/dist/sdk/runner.js +17 -16
- package/dist/sdk/session.d.ts +2 -0
- package/dist/sdk/src/local-runtime.d.ts +8 -0
- package/dist/sdk/src/local-runtime.d.ts.map +1 -1
- package/dist/sdk/src/transport.d.ts +7 -1
- package/dist/sdk/src/transport.d.ts.map +1 -1
- package/dist/sdk/store.d.ts +2 -0
- package/dist/sdk/telemetry.d.ts +2 -0
- package/dist/sdk/transport/ws/client.d.ts +2 -0
- package/dist/sdk/transport/ws/client.js +2 -1
- package/dist/sdk/transport/ws/server.d.ts +2 -0
- package/dist/sdk/transport/ws/server.js +2 -1
- package/dist/sdk/transport/ws.d.ts +2 -0
- package/dist/sdk/transport/ws.js +4 -3
- package/dist/sdk/transport.d.ts +2 -0
- package/dist/sdk/transport.js +4 -3
- package/dist/sdk/types.d.ts +2 -0
- package/dist/secrets/index.d.ts +2 -0
- package/dist/session/index.d.ts +2 -0
- package/dist/{setup-ACMP3QZC.js → setup-REX4I5NE.js} +10 -10
- package/dist/{setup-ACMP3QZC.js.map → setup-REX4I5NE.js.map} +1 -1
- package/dist/store/index.d.ts +2 -0
- package/dist/store/react.d.ts +2 -0
- package/dist/store/vue.d.ts +2 -0
- package/dist/store-client-IX3Y67NK.js +14 -0
- package/dist/{store-client-ZSLNOOQG.js.map → store-client-IX3Y67NK.js.map} +1 -1
- package/dist/telemetry/index.d.ts +2 -0
- package/dist/transport/index.d.ts +2 -0
- package/dist/transport/index.js +4 -3
- package/dist/transport/src/ws/auth.d.ts +34 -0
- package/dist/transport/src/ws/auth.d.ts.map +1 -0
- package/dist/transport/src/ws/client.d.ts +4 -0
- package/dist/transport/src/ws/client.d.ts.map +1 -1
- package/dist/transport/src/ws/index.d.ts +3 -2
- package/dist/transport/src/ws/index.d.ts.map +1 -1
- package/dist/transport/src/ws/server.d.ts +5 -0
- package/dist/transport/src/ws/server.d.ts.map +1 -1
- package/dist/transport/ws/client.d.ts +2 -0
- package/dist/transport/ws/client.js +2 -1
- package/dist/transport/ws/server.d.ts +2 -0
- package/dist/transport/ws/server.js +2 -1
- package/dist/transport/ws.d.ts +2 -0
- package/dist/transport/ws.js +4 -3
- package/dist/tui/index.d.ts +2 -0
- package/dist/tui/index.js +17 -16
- package/dist/tui/index.js.map +1 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/manifests.d.ts +2 -0
- package/dist/workspace-plugin/adapters/mcp.d.ts +2 -0
- package/dist/workspace-plugin/adapters/omp.d.ts +2 -0
- package/dist/workspace-plugin/index.d.ts +2 -0
- package/dist/workspace-plugin/index.js +1 -1
- package/package.json +4 -2
- package/dist/asset-feeds-PJDJ3QYI.js.map +0 -1
- package/dist/chunk-2DNSSQ22.js.map +0 -1
- package/dist/chunk-7PTP3SQJ.js.map +0 -1
- package/dist/chunk-G6GKWGOW.js.map +0 -1
- package/dist/chunk-IGQEXBBG.js.map +0 -1
- package/dist/chunk-KA46DUM4.js.map +0 -1
- package/dist/chunk-NGC7ZQI4.js.map +0 -1
- package/dist/chunk-PBWMV5GM.js.map +0 -1
- package/dist/chunk-RENHNO4J.js.map +0 -1
- package/dist/chunk-TKOLD2O7.js.map +0 -1
- package/dist/chunk-TTY56FQQ.js.map +0 -1
- package/dist/chunk-UZRY5UI2.js.map +0 -1
- package/dist/chunk-W2O5LWYU.js +0 -3
- package/dist/chunk-WIR34WMU.js.map +0 -1
- package/dist/chunk-X5Y4EGZB.js.map +0 -1
- package/dist/ensure-sources-COGVKY44.js.map +0 -1
- package/dist/open-library-DWAQFUSQ.js +0 -13
- package/dist/store-client-ZSLNOOQG.js +0 -14
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { pluginRegistry } from './chunk-
|
|
1
|
+
import { pluginRegistry } from './chunk-6E6PKKAD.js';
|
|
2
2
|
import { createLogger } from './chunk-24UIWON4.js';
|
|
3
3
|
import { EventEmitter } from 'events';
|
|
4
4
|
|
|
@@ -169,6 +169,10 @@ async function registerBuiltinDrivers(registry = pluginRegistry) {
|
|
|
169
169
|
if (registry === pluginRegistry) _driversRegistered = true;
|
|
170
170
|
}
|
|
171
171
|
async function createDriver(id, config, ctx) {
|
|
172
|
+
const target = await resolveDriverTarget(id);
|
|
173
|
+
return target.create(config, ctx ?? {});
|
|
174
|
+
}
|
|
175
|
+
async function resolveDriverTarget(id) {
|
|
172
176
|
await registerBuiltinDrivers();
|
|
173
177
|
const target = pluginRegistry.get("driver", id);
|
|
174
178
|
if (!target) {
|
|
@@ -179,7 +183,7 @@ async function createDriver(id, config, ctx) {
|
|
|
179
183
|
`Unknown agent driver: "${id}". Available: ${listDrivers().map((d) => d.id).join(", ")}`
|
|
180
184
|
);
|
|
181
185
|
}
|
|
182
|
-
return target
|
|
186
|
+
return target;
|
|
183
187
|
}
|
|
184
188
|
function listDrivers() {
|
|
185
189
|
const merged = /* @__PURE__ */ new Map();
|
|
@@ -188,22 +192,22 @@ function listDrivers() {
|
|
|
188
192
|
}
|
|
189
193
|
for (const meta of pluginRegistry.list("driver")) {
|
|
190
194
|
if (!merged.has(meta.id)) {
|
|
195
|
+
const target = pluginRegistry.get("driver", meta.id);
|
|
191
196
|
merged.set(meta.id, {
|
|
192
197
|
id: meta.id,
|
|
193
198
|
name: meta.displayName,
|
|
194
|
-
modelAgnostic: false,
|
|
195
|
-
supportsInBandAbort: false
|
|
199
|
+
modelAgnostic: target?.modelAgnostic ?? false,
|
|
200
|
+
supportsInBandAbort: target?.supportsInBandAbort ?? false
|
|
196
201
|
});
|
|
197
202
|
}
|
|
198
203
|
}
|
|
199
204
|
return [...merged.values()];
|
|
200
205
|
}
|
|
201
206
|
async function listModelsForDriver(driverId, apiKeys) {
|
|
202
|
-
await
|
|
203
|
-
|
|
204
|
-
return await target?.listModels?.(apiKeys) ?? [];
|
|
207
|
+
const target = await resolveDriverTarget(driverId);
|
|
208
|
+
return await target.listModels?.(apiKeys) ?? [];
|
|
205
209
|
}
|
|
206
210
|
|
|
207
211
|
export { AgentDriver, BUILTIN_DRIVER_CATALOG, DRIVER_CATALOG, createDriver, getBridgeLogger, listDrivers, listModelsForDriver, registerBuiltinDrivers };
|
|
208
|
-
//# sourceMappingURL=chunk-
|
|
209
|
-
//# sourceMappingURL=chunk-
|
|
212
|
+
//# sourceMappingURL=chunk-6VTG73UY.js.map
|
|
213
|
+
//# sourceMappingURL=chunk-6VTG73UY.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../bridge/src/logger.ts","../bridge/src/types.ts","../bridge/src/registry.ts"],"names":[],"mappings":";;;;;AAuBO,SAAS,gBAAgB,OAAA,EAAyB;AACvD,EAAA,OAAO,YAAA,CAAa,EAAE,IAAA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ridgeLogger(subkind)` at\n * construction time. Falls back to an off-mode Logger (stdout only) when\n * no LogStore is registered — see @skaile/workspaces/core/logging for details.\n */\n\nimport { createLogger } from \"@skaile/workspaces/core/logging\";\nimport type { Logger } from \"@skaile/workspaces/types\";\n\n/**\n * Construct a bridge-scoped Logger for a given driver subkind.\n *\n * Creates a `Logger` with `kind: \"bridge\"` and the specified `subkind`. Falls back to\n * an off-mode Logger (stdout only) when no `LogStore` is registered — see\n * `@skaile/workspaces/core/logging` for details. Each driver calls this once at construction\n * time; never re-construct per call.\n *\n * @param subkind - Driver id, e.g. `\"claude-sdk\"`, `\"omp\"`, `\"echo\"`, `\"codex\"`.\n * @returns A `Logger` scoped to `bridge:<subkind>`.\n * @docLink packages/bridge/api-reference#logger\n */\nexport function getBridgeLogger(subkind: string): Logger {\n return createLogger({ kind: \"bridge\", subkind });\n}\n","import { EventEmitter } from \"node:events\";\nimport type { Span, TelemetryProvider, Trace } from \"@skaile/workspaces/telemetry\";\nimport type {\n Capability,\n CredentialMint,\n RenderInvokedEvent,\n TokenUsage,\n} from \"@skaile/workspaces/types\";\nimport type { ModelEntry } from \"./models.js\";\n\n/**\n * Minimal LLM tool descriptor used by the capability dispatch path. Mirrors\n * the runner's `LLMTool` shape so drivers can consume registry output without\n * importing `@skaile/workspaces/runner` (which would create a circular dep).\n *\n * @category Capabilities\n * @since 2.0.0\n * @docLink packages/bridge/concepts#bridge-capability-tool\n */\nexport interface BridgeCapabilityTool {\n /** Capability name; used as the LLM-visible tool name. */\n name: string;\n /** Human/LLM-readable description. */\n description: string;\n /** JSON Schema for the tool's input parameters. */\n parameters: Record<string, unknown>;\n}\n\n/**\n * Render-cap event emission callback used by the bridge when the LLM invokes\n * a capability that carries a `render` spec. The runner provides the actual\n * sink (transport.send / sendEvent); the bridge only emits.\n *\n * @category Capabilities\n * @since 2.0.0\n * @docLink packages/bridge/concepts#bridge-render-emit\n */\nexport type BridgeRenderEmit = (event: RenderInvokedEvent) => void;\n\n/**\n * Text-event emission callback for render-capability fallbacks. When a\n * `RenderCapability` carries `render.fallback` and the LLM invokes it, the\n * bridge substitutes `{{prop}}` placeholders (top-level keys of `props`,\n * optional dotted-path traversal `{{user.name}}`) and pushes the rendered\n * string through this callback so clients without a render layer still see\n * a textual representation. No-op when `fallback` is absent.\n *\n * @category Capabilities\n * @since 2.0.0\n * @docLink packages/bridge/concepts#bridge-text-emit\n */\nexport type BridgeTextEmit = (text: string) => void;\n\n/**\n * Bundle of capability dispatch hooks. Registered into the driver via\n * `AgentConfig.capabilities`; the driver routes registered LLM tool calls\n * back into `invoke()` instead of using its native dispatch path.\n *\n * The runner constructs this from a `CapabilityRegistry` instance and threads\n * it through `createAgentSession()`. Drivers that don't yet implement\n * capability dispatch ignore the field — legacy v1 paths stay intact.\n *\n * @category Capabilities\n * @since 2.0.0\n * @docLink packages/bridge/concepts#bridge-capability-hooks\n */\nexport interface BridgeCapabilityHooks {\n /** Build the LLM tool descriptor list from the registry. Called per turn so registration changes take effect. */\n composeTools(): BridgeCapabilityTool[];\n /** Resolve a wire-format Capability descriptor by name. Used by the bridge to inspect `fireAndForget` / `render`. */\n resolve(name: string): Capability | null;\n /** Validate input + dispatch through the registry. Logging is wired by the registry. */\n invoke(name: string, input: unknown): Promise<unknown>;\n /** Emit a render-invoked event. The runner forwards via the WebSocket transport. */\n emitRender?: BridgeRenderEmit;\n /** Emit a text fallback for render capabilities with `render.fallback`. */\n emitText?: BridgeTextEmit;\n /** Session id passed through to the runner's per-handler logger. */\n sessionId: string;\n}\n\n/**\n * Static metadata for a registered agent driver backend.\n *\n * Returned by {@link listDrivers} and exposed on every {@link AgentDriver} instance\n * via `driverInfo`.\n *\n * @docLink packages/bridge/concepts#driver-info\n */\nexport interface DriverInfo {\n /** Stable machine identifier used to look up the driver in the registry (e.g. `\"omp\"`, `\"claude-sdk\"`). */\n id: string;\n /** Human-readable display name shown in UIs and logs. */\n name: string;\n /** `true` when the driver can target any LLM provider; `false` for Anthropic-only drivers. */\n modelAgnostic: boolean;\n /**\n * `true` when the driver supports mid-stream abort via `abort()` without killing the process.\n * Drivers that return `false` can only be stopped via `kill()`.\n */\n supportsInBandAbort: boolean;\n}\n\n/**\n * Codex-specific tuning options passed through `DriverOptions.codex`.\n *\n * @remarks These are forwarded verbatim to the Codex driver and have no effect on other drivers.\n * @docLink packages/bridge/concepts#codex-driver-options\n */\nexport interface CodexDriverOptions {\n /** Controls whether Codex may auto-apply edits without user approval. */\n approvalPolicy?: \"never\" | \"on-request\" | \"on-failure\" | \"untrusted\";\n /** Filesystem sandbox level for the Codex process. */\n sandboxMode?: \"read-only\" | \"workspace-write\" | \"danger-full-access\";\n /** Reasoning budget passed to the model. */\n reasoningEffort?: \"minimal\" | \"low\" | \"medium\" | \"high\" | \"xhigh\";\n /** When `true`, the Codex sandbox is allowed to make outbound network requests. */\n networkAccessEnabled?: boolean;\n /** Extra directories made accessible to the Codex sandbox in addition to `cwd`. */\n additionalDirectories?: string[];\n}\n\n/**\n * Driver-specific configuration bag.\n *\n * Fields are keyed by driver ID so that callers can pass driver-specific options\n * through the common {@link AgentConfig} without breaking other drivers.\n *\n * @docLink packages/bridge/concepts#driver-options\n */\nexport interface DriverOptions {\n /** Codex-specific options. Ignored by all other drivers. */\n codex?: CodexDriverOptions;\n}\n\n/**\n * Configuration passed to a driver when it is created via {@link createDriver}.\n *\n * All fields are shared across drivers; driver-specific behaviour is documented\n * per field. Fields that are silently ignored by a driver are marked accordingly.\n *\n * @docLink packages/bridge/concepts#agent-config\n */\nexport interface AgentConfig {\n /** Absolute path to the working directory the agent operates in. */\n cwd: string;\n /**\n * LLM provider name (e.g. `\"anthropic\"`, `\"openai\"`, `\"google\"`).\n * Combined with `model` as `provider/model` for omp's `--model` flag.\n * Ignored by claude-sdk (always Anthropic).\n */\n provider?: string;\n /**\n * LLM model identifier (e.g. `\"claude-sonnet-4-5\"`, `\"gpt-4o\"`).\n * For omp: passed as `--model [provider/]model`.\n * For claude-sdk: passed as the `model` query option.\n */\n model?: string;\n /**\n * Provider API keys keyed by provider name (e.g. `{ anthropic: \"sk-...\" }`).\n * Drivers inject the relevant key into the environment or SDK options.\n */\n apiKeys?: Record<string, string>;\n /**\n * Additional environment variables merged into the child process environment.\n * For omp: merged with `process.env` before spawn. For claude-sdk: accessed\n * via `env.ANTHROPIC_API_KEY` as an alternative to `apiKeys.anthropic`.\n */\n env?: Record<string, string>;\n /** Inline system prompt — written to .omp/system.md and passed via --append-system-prompt (omp driver) */\n systemPrompt?: string;\n /** Path to project .omp/ directory (PI_CODING_AGENT_DIR for omp driver) */\n agentDir?: string;\n /** SSH key path — injected as GIT_SSH_COMMAND */\n sshKeyPath?: string;\n /** Pre-assign a UUID as the session ID for a new session (claude-sdk: passed as sessionId option) */\n sessionId?: string;\n /** Resume this specific past session by UUID instead of starting fresh (claude-sdk: passed as resume option) */\n resumeSessionId?: string;\n /** Maximum agentic turns per query (claude-sdk: passed as maxTurns option) */\n maxTurns?: number;\n /** Agent name — selects a deployed sub-agent definition as the main agent identity.\n * claude-sdk: passed as `agent` option to query() → reads .claude/agents/<name>.md natively.\n * omp: ignored (omp uses agentDir/PI_CODING_AGENT_DIR instead). */\n agentName?: string;\n /** In-process SDK MCP servers for custom tool injection (Claude SDK only, ignored by other drivers) */\n mcpServers?: Record<string, unknown>;\n /** Tool restrictions from agent.yaml — applied to the main agent session */\n tools?: {\n /** Tool names that the agent is allowed to invoke. An empty array means no restriction. */\n allowed?: string[];\n /** Tool names that the agent is explicitly forbidden from invoking. */\n denied?: string[];\n };\n /** Thinking mode for Claude models: adaptive (Claude decides), enabled (always think), disabled (no thinking). */\n thinking?: \"adaptive\" | \"enabled\" | \"disabled\";\n /** Reasoning effort level for Claude models. */\n effort?: \"low\" | \"medium\" | \"high\" | \"max\";\n /** Driver-specific configuration bag. */\n driverOptions?: DriverOptions;\n /**\n * Protocol v2 capability dispatch hooks. When present, the driver uses the\n * registry as the source of LLM tool definitions and routes invocations\n * through `capabilities.invoke()`. Absent → legacy v1 path (existing\n * mcpServers / native dispatch).\n *\n * @since 2.0.0\n */\n capabilities?: BridgeCapabilityHooks;\n /**\n * The platform's `AIProviderConfig.id` for the AI credential currently\n * provisioned into this driver. The runner reads this off `AgentConfig`\n * during 401 mediation and passes it as `configId` in\n * `request_access_token { kind: 'ai-credentials' }`. The driver itself\n * does not consume this field — only the runner uses it.\n *\n * Set by the platform agent-gateway in `ConfigureCommandV2` for mediated\n * sessions. Standalone runners (CLI / forge / Claude plugin) leave it\n * undefined; the runner falls back to surfacing the auth error to the\n * user without mediating.\n *\n * Spec: `_devlog/specs/2026-05-07-unified-credential-mediation.md`\n * § \"Wire `aiProviderConfigId` end-to-end\".\n *\n * @since 3.3.0\n */\n aiProviderConfigId?: string;\n /**\n * Optional callback invoked by the driver when the underlying agent\n * surfaces an `authentication_error`. In Protocol v3 the runner mediates\n * the refresh via the `host.refresh_credential` capability and returns a\n * typed {@link CredentialMint}. The driver inspects the discriminator:\n *\n * - `mint.ok === true`: a fresh credential is now provisioned. The\n * driver re-attempts the in-flight prompt once.\n * - `mint.ok === false`: refresh failed (`code` carries a stable reason\n * such as `revoked`, `not-configured`, `provider-error`,\n * `backend-error`). The driver surfaces the original `AuthError` to\n * the caller.\n *\n * `args.configId` carries the platform `AIProviderConfig.id` the driver\n * was provisioned with (mirrors {@link AgentConfig.aiProviderConfigId}).\n * The runner uses it to scope the refresh to the correct AI credential.\n *\n * When omitted, the driver throws `AuthError` immediately as before\n * (standalone CLI / forge mode — there is no platform mediator to ask).\n *\n * Centralising auth-retry inside the driver means every consumer of\n * `driver.prompt(...)` (serve handler, compaction orchestrator, flow\n * orchestrator, …) gets self-healing for free — there is no per-call-site\n * wrapping.\n *\n * Spec: `_devlog/specs/2026-05-10-deterministic-session-bootstrap.md`\n * § \"host.refresh_credential capability\".\n *\n * @since 3.4.0\n */\n onAuthError?: (args: { configId: string }) => Promise<CredentialMint>;\n}\n\n/**\n * A single message in an agent conversation.\n *\n * Emitted as part of {@link AgentEvent} variants (`message_start`, `message_update`, `message_end`).\n *\n * @docLink packages/bridge/concepts#agent-message\n */\nexport interface AgentMessage {\n /** Originator of the message. */\n role: \"user\" | \"assistant\" | \"tool\";\n /** Message body — either a plain string or a list of typed content blocks. */\n content: string | ContentBlock[];\n /** Tool invocations made by the assistant in this message. */\n toolCalls?: ToolCall[];\n /** For `role === \"tool\"`: the name of the tool whose result this message carries. */\n toolName?: string;\n /** For `role === \"tool\"`: `true` when the tool returned an error. */\n isError?: boolean;\n /** Optional structured payload for tool results. */\n data?: unknown;\n}\n\n/**\n * A typed block within an {@link AgentMessage}'s content array.\n *\n * Mirrors the Anthropic content block schema but is driver-agnostic.\n *\n * @docLink packages/bridge/concepts#content-block\n */\nexport interface ContentBlock {\n /** Block discriminant. */\n type: \"text\" | \"tool_use\" | \"tool_result\" | \"thinking\";\n /** Present for `text` and `thinking` blocks. */\n text?: string;\n /** Tool use / tool result correlation ID. */\n id?: string;\n /** Tool name (present on `tool_use` blocks). */\n name?: string;\n /** Tool input arguments (present on `tool_use` blocks). */\n input?: any;\n /** Serialised tool result content (present on `tool_result` blocks). */\n content?: string;\n}\n\n/**\n * A single tool invocation made by the agent within a message.\n *\n * @docLink packages/bridge/concepts#tool-call\n */\nexport interface ToolCall {\n /** Correlation ID used to match the call with its result. */\n id: string;\n /** Name of the tool being invoked. */\n name: string;\n /** Arguments passed to the tool. */\n input: any;\n}\n\n/**\n * Error classification for agent failures.\n *\n * Used to determine whether a failure is retryable and to surface actionable\n * hints to the user. See `bridge/CLAUDE.md` for the full category-to-behaviour matrix.\n *\n * @see AgentError\n * @docLink packages/bridge/concepts#error-category\n */\nexport type ErrorCategory =\n | \"auth\"\n | \"rate_limit\"\n | \"model\"\n | \"network\"\n | \"config\"\n | \"process\"\n | \"validation\"\n | \"unknown\";\n\n/**\n * Structured error payload emitted inside the `error` {@link AgentEvent}.\n *\n * Consumers should inspect `retryable` before deciding to surface a retry button,\n * and `hint` to provide an actionable message to the user.\n *\n * @docLink packages/bridge/concepts#agent-error\n */\nexport interface AgentError {\n /** Human-readable error description. */\n message: string;\n /** Coarse failure classification used for retry logic and telemetry. */\n category: ErrorCategory;\n /** HTTP status code if the error originated from an API response. */\n statusCode?: number;\n /** `true` when the caller may safely retry the same operation. */\n retryable: boolean;\n /** Short actionable advice suitable for display in the UI. */\n hint?: string;\n}\n\n/**\n * Metadata for a slash command exposed by the active agent runtime.\n *\n * @docLink packages/bridge/concepts#slash-command-info\n */\nexport interface SlashCommandInfo {\n /** Command name without the leading slash (e.g. `\"compact\"`). */\n name: string;\n /** One-line description shown in command pickers. */\n description: string;\n /** Placeholder text describing what argument the command expects. */\n argumentHint?: string;\n}\n\n/**\n * Discriminated union of all events emitted by a driver on the `'agent-event'` channel.\n *\n * @remarks\n * Consumers listen via `driver.on('agent-event', (event: AgentEvent) => ...)`.\n * The `[k: string]: any` index signature on most variants allows drivers to attach\n * driver-specific fields (e.g. `_textDelta`) without breaking the union.\n *\n * @docLink packages/bridge/concepts#agent-event\n */\nexport type AgentEvent =\n | { type: \"message_start\"; message: AgentMessage; [k: string]: any }\n | { type: \"message_update\"; message: AgentMessage; [k: string]: any }\n | { type: \"message_end\"; message: AgentMessage; [k: string]: any }\n | { type: \"turn_end\"; toolResults?: AgentMessage[]; [k: string]: any }\n | { type: \"agent_end\"; [k: string]: any }\n | {\n type: \"result\";\n subtype: string;\n summary?: string;\n costUsd?: number;\n /** Per-turn token usage when the driver tracks it. Added in 3.1.0. */\n tokens?: TokenUsage;\n errors?: string[];\n [k: string]: any;\n }\n | { type: \"error\"; error: string; detail?: AgentError; fatal?: boolean; [k: string]: any }\n | { type: \"tool_call\"; name?: string; tool?: { name: string }; [k: string]: any }\n | { type: \"tool_execution_end\"; toolName?: string; [k: string]: any }\n | { type: \"commands_available\"; commands: SlashCommandInfo[] }\n | { type: \"session_info\"; driverSessionId: string; sessionFile?: string }\n | { type: \"ui_render\"; [k: string]: any }\n | { type: \"ui_render_update\"; [k: string]: any }\n | { type: \"ui_clear\"; [k: string]: any }\n // Phase 3 (resume cascade) — driver-emitted resume outcome.\n | {\n type: \"resume_failed\";\n resumeSessionId: string;\n reason: \"signature_mismatch\" | \"model_mismatch\" | \"jsonl_lost\" | \"jsonl_poisoned\";\n [k: string]: any;\n };\n\n/**\n * Abstract base class for agent driver backends.\n *\n * Wraps an LLM coding agent behind a single `prompt()` interface.\n * All drivers emit `'agent-event'` with {@link AgentEvent} payloads.\n *\n * @remarks\n * Subclasses must implement `start`, `prompt`, `abort`, `kill`, and `isRunning`.\n * Implementations should never emit an event name other than `'agent-event'` as\n * the public streaming channel — internal events (`'ready'`, `'exit'`, etc.) are\n * driver-private.\n *\n * @example\n * ```ts\n * const driver = createDriver('omp', config);\n * driver.on('agent-event', (event) => console.log(event.type));\n * await driver.start();\n * await driver.prompt('Refactor the auth module');\n * driver.kill();\n * ```\n *\n * @docLink packages/bridge/concepts#agent-driver\n */\nexport abstract class AgentDriver extends EventEmitter {\n /** Static metadata describing this driver's capabilities. */\n abstract readonly driverInfo: DriverInfo;\n\n /**\n * Initialises the driver backend — spawns the child process (omp) or loads\n * the SDK module (claude-sdk). Resolves when the backend is ready to accept\n * prompts. Idempotent: calling `start()` on an already-running driver is a no-op.\n *\n * @throws {Error} When the backend binary is missing or the SDK cannot be loaded.\n */\n abstract start(): Promise<void>;\n\n /**\n * Sends a user message to the agent and resolves when the agent's turn completes\n * (i.e. after the `agent_end` event has been emitted).\n *\n * @param message - Plain-text user prompt to send to the agent.\n * @throws {Error} When the driver is not running or the underlying backend reports a fatal error.\n */\n abstract prompt(message: string): Promise<void>;\n\n /**\n * Sends an in-band abort signal to the agent, requesting it to stop the current\n * turn without terminating the process. The driver remains usable after `abort()`.\n *\n * @remarks Only meaningful when `driverInfo.supportsInBandAbort` is `true`.\n * For other drivers, prefer `kill()` followed by creating a new driver instance.\n */\n abstract abort(): Promise<void>;\n\n /**\n * Terminates the agent backend immediately (SIGTERM for subprocess drivers,\n * `close()` for in-process drivers). The driver instance must not be reused\n * after `kill()`.\n */\n abstract kill(): void;\n\n /** `true` when the backend is alive and able to accept new prompts. */\n abstract get isRunning(): boolean;\n\n /** Optional provider-native session/thread identifier for resume support. */\n get runtimeSessionId(): string | undefined {\n return undefined;\n }\n\n /** Slash commands discovered from the agent runtime. Override in drivers that support introspection. */\n getSlashCommands(): SlashCommandInfo[] {\n return [];\n }\n\n // ── Live reconfiguration ────────────────────────────────────────────────\n\n /**\n * Live-update driver configuration. The new values take effect on the next\n * prompt() call. Only model/thinking/effort are reconfigurable mid-session.\n *\n * Subclasses that store config locally should override this to apply the\n * patch to their own config field. The base implementation is a no-op.\n */\n reconfigure(patch: Partial<Pick<AgentConfig, \"model\" | \"thinking\" | \"effort\">>): void {\n // No-op — subclasses override to apply to their own config.\n void patch;\n }\n\n /**\n * Returns the model identifier currently configured on this driver.\n * Subclasses that store config locally should override this.\n */\n getModel(): string | undefined {\n return undefined;\n }\n\n // ── Compaction support ──────────────────────────────────────────────────\n\n /**\n * Returns the token usage from the most recent completed turn.\n * Returns `null` if usage data is unavailable (e.g. driver doesn't track it).\n *\n * Widened in 3.1.0 to return the full `TokenUsage` shape (input / output /\n * cache-read / cache-creation / reasoning). All fields are optional so\n * drivers can populate just what their provider reports. Existing callers\n * that read only `inputTokens` / `outputTokens` keep working — those fields\n * are still present and carry the same semantics as before.\n */\n getTokenUsage(): TokenUsage | null {\n return null;\n }\n\n /**\n * Returns the model's context window size in tokens.\n * Returns `null` if unknown.\n */\n getContextWindow(): number | null {\n return null;\n }\n\n /**\n * Returns the list of models available to this driver without starting a session.\n * Drivers that can enumerate their own models override this method.\n * Returns an empty array by default.\n */\n async listModels(): Promise<ModelEntry[]> {\n return [];\n }\n\n /**\n * Closes the current conversation session and prepares for a fresh start.\n * The next `prompt()` call will begin a new session without prior history.\n * The driver remains usable after `resetSession()`.\n */\n abstract resetSession(): Promise<void>;\n\n // ── Telemetry ─────────────────────────────────────────────────────────────\n\n protected _telemetry?: TelemetryProvider;\n protected _activeTrace?: Trace;\n protected _activeTurnSpan?: Span;\n private _turnStartTime?: number;\n\n /**\n * Attach a telemetry provider and active trace to this driver.\n * Called by the runner after creating the driver but before start().\n */\n setTelemetry(provider: TelemetryProvider, trace: Trace): void {\n this._telemetry = provider;\n this._activeTrace = trace;\n }\n\n /**\n * Begin a turn span. Called by the runner before prompt().\n * Pass a parent span (e.g. the turn span from the orchestrator) for nesting.\n * Returns the span so the runner can annotate it further.\n */\n beginTurnSpan(\n parent?: Trace | Span,\n attrs?: Record<string, string | number | boolean>,\n ): Span | undefined {\n if (!this._telemetry || !this._activeTrace) return undefined;\n this._turnStartTime = Date.now();\n this._activeTurnSpan = this._telemetry.startSpan(parent ?? this._activeTrace, {\n name: \"llm_generation\",\n kind: \"llm_generation\",\n attributes: attrs,\n });\n return this._activeTurnSpan;\n }\n\n /**\n * End the current turn span with generation data.\n * Called by the runner after agent_end. Model and provider are passed\n * explicitly — the driver base class does not access config directly.\n */\n endTurnSpan(result?: {\n model?: string;\n provider?: string;\n inputTokens?: number;\n outputTokens?: number;\n stopReason?: string;\n error?: string;\n }): void {\n if (!this._telemetry || !this._activeTurnSpan) return;\n const durationMs = this._turnStartTime ? Date.now() - this._turnStartTime : 0;\n\n if (result?.inputTokens !== undefined || result?.outputTokens !== undefined) {\n this._telemetry.logGeneration(this._activeTurnSpan, {\n model: result?.model ?? \"unknown\",\n provider: result?.provider ?? \"unknown\",\n inputTokens: result.inputTokens,\n outputTokens: result.outputTokens,\n durationMs,\n stopReason: result.stopReason,\n });\n }\n\n this._telemetry.endSpan(this._activeTurnSpan, {\n status: result?.error ? \"error\" : \"ok\",\n error: result?.error,\n attributes: { \"skaile.turn.duration_ms\": durationMs },\n });\n\n this._activeTurnSpan = undefined;\n this._turnStartTime = undefined;\n }\n}\n\n/**\n * Factory function signature registered in the driver registry.\n *\n * @param config - Configuration for the new driver instance.\n * @returns A freshly constructed (not yet started) {@link AgentDriver}.\n * @docLink packages/bridge/concepts#driver-factory\n */\nexport type DriverFactory = (config: AgentConfig) => AgentDriver;\n","import type { DriverContext } from \"@skaile/workspaces/plugin-registry\";\nimport { type PluginRegistry, pluginRegistry } from \"@skaile/workspaces/plugin-registry\";\nimport type { ModelEntry } from \"./models.js\";\nimport type { AgentConfig, AgentDriver, DriverInfo } from \"./types.js\";\n\n// Build-time backend gating. `bun build --compile --define:__INCLUDE_*__=...`\n// folds these to literal booleans so an excluded backend's driver module and\n// its SDK are dead-code-stripped from the binary. Under tsup / vitest / bun\n// run-on-source no `--define` runs and the `typeof` guard defaults to `true` —\n// every backend is available (the SDKs stay optional peers).\ndeclare const __INCLUDE_CLAUDE_SDK__: boolean;\ndeclare const __INCLUDE_CODEX__: boolean;\nconst INCLUDE_CLAUDE_SDK =\n typeof __INCLUDE_CLAUDE_SDK__ === \"undefined\" ? true : __INCLUDE_CLAUDE_SDK__;\nconst INCLUDE_CODEX = typeof __INCLUDE_CODEX__ === \"undefined\" ? true : __INCLUDE_CODEX__;\n\n/**\n * Static capability metadata for every built-in backend.\n *\n * Pure data — this object imports no driver module and references no backend\n * SDK. {@link listDrivers} returns it (merged with any third-party drivers)\n * so selection UIs can enumerate every backend without loading a single\n * driver module. The matching driver module's `DriverTarget` is registered\n * into the plugin registry by {@link registerBuiltinDrivers}.\n *\n * @docLink packages/bridge/api-reference#registry\n */\nexport const BUILTIN_DRIVER_CATALOG: Record<string, DriverInfo> = {\n omp: {\n id: \"omp\",\n name: \"omp (oh-my-pi)\",\n modelAgnostic: true,\n supportsInBandAbort: true,\n },\n \"claude-sdk\": {\n id: \"claude-sdk\",\n name: \"Claude Agent SDK\",\n modelAgnostic: false,\n supportsInBandAbort: true,\n },\n codex: {\n id: \"codex\",\n name: \"OpenAI Codex\",\n modelAgnostic: false,\n supportsInBandAbort: true,\n },\n echo: {\n id: \"echo\",\n name: \"Echo (E2E mock)\",\n modelAgnostic: true,\n supportsInBandAbort: false,\n },\n};\n\n/**\n * Back-compat alias for {@link BUILTIN_DRIVER_CATALOG}. Consumers and tests that\n * predate the plugin-registry refactor still import `DRIVER_CATALOG`.\n *\n * @docLink packages/bridge/api-reference#registry\n */\nexport const DRIVER_CATALOG = BUILTIN_DRIVER_CATALOG;\n\nlet _driversRegistered = false;\n\n/**\n * Register every built-in driver's `DriverTarget` into the plugin registry.\n *\n * This is the single id → module map in bridge core. Every specifier is a\n * literal string so `bun --compile` can statically bundle the driver module\n * (and, transitively, its SDK). The in-process-SDK backends (`claude-sdk`,\n * `codex`) are wrapped in build-constant guards so an excluded backend's\n * `await import` folds to dead code in the compiled binary. `omp` and `echo`\n * carry no SDK weight and are always available.\n *\n * **Static import discipline.** Every `import()` specifier below must be a\n * string literal — never aliased through a variable. Indirection defeats\n * `bun --compile`'s static analysis and silently drops the module from the\n * binary.\n *\n * Idempotent: guarded by a module flag so a second call is a no-op (a duplicate\n * `register` would otherwise throw `RegistrationError`).\n *\n * @docLink packages/bridge/api-reference#registry\n */\nexport async function registerBuiltinDrivers(\n registry: PluginRegistry = pluginRegistry,\n): Promise<void> {\n if (registry === pluginRegistry && _driversRegistered) return;\n\n if (!registry.get(\"driver\", \"omp\")) {\n const m = await import(\"@skaile/workspaces/drivers/omp\");\n registry.register(\"driver\", m.ompDriverTarget);\n }\n if (!registry.get(\"driver\", \"echo\")) {\n const m = await import(\"@skaile/workspaces/drivers/echo\");\n registry.register(\"driver\", m.echoDriverTarget);\n }\n if (INCLUDE_CLAUDE_SDK && !registry.get(\"driver\", \"claude-sdk\")) {\n const m = await import(\"@skaile/workspaces/drivers/claude-sdk\");\n registry.register(\"driver\", m.claudeSdkDriverTarget);\n }\n if (INCLUDE_CODEX && !registry.get(\"driver\", \"codex\")) {\n const m = await import(\"@skaile/workspaces/drivers/codex\");\n registry.register(\"driver\", m.codexDriverTarget);\n }\n\n if (registry === pluginRegistry) _driversRegistered = true;\n}\n\n/**\n * Creates a new driver instance for the given backend id.\n *\n * Ensures the built-in driver targets are registered (idempotent), then looks\n * up the target in the plugin registry and calls its `create()`. The returned\n * driver has not been started yet — call `driver.start()` before sending\n * prompts.\n *\n * @param id - Registered driver identifier (e.g. `\"omp\"`, `\"claude-sdk\"`).\n * @param config - Configuration forwarded to the driver constructor.\n * @param ctx - Optional driver context (logger / abort signal). Defaults to `{}`.\n * @returns A freshly constructed (not yet started) {@link AgentDriver}.\n * @throws {Error} When `id` is a known backend excluded from this build, or\n * when `id` does not match any registered driver at all.\n * @docLink packages/bridge/api-reference#registry\n */\nexport async function createDriver(\n id: string,\n config: AgentConfig,\n ctx?: DriverContext,\n): Promise<AgentDriver> {\n const target = await resolveDriverTarget(id);\n return target.create(config, ctx ?? {});\n}\n\n/**\n * Resolve a registered driver target by id, ensuring the built-ins are\n * registered first. Throws the canonical \"not bundled\" / \"unknown driver\"\n * errors so every caller (`createDriver`, `listModelsForDriver`) reports an\n * unrecognized id the same way instead of silently degrading.\n *\n * @throws {Error} When `id` is a known backend excluded from this build, or\n * when `id` does not match any registered driver at all.\n */\nasync function resolveDriverTarget(id: string) {\n await registerBuiltinDrivers();\n const target = pluginRegistry.get(\"driver\", id);\n if (!target) {\n if (id in BUILTIN_DRIVER_CATALOG) {\n throw new Error(`Agent driver \"${id}\" is not bundled in this build.`);\n }\n throw new Error(\n `Unknown agent driver: \"${id}\". Available: ${listDrivers()\n .map((d) => d.id)\n .join(\", \")}`,\n );\n }\n return target;\n}\n\n/**\n * Returns the capability metadata for every available driver.\n *\n * Enumerates every built-in backend from {@link BUILTIN_DRIVER_CATALOG} without\n * loading a single driver module or backend SDK, then merges in any third-party\n * driver targets registered into the plugin registry that are not already in\n * the catalog. Use this to populate driver selection UIs.\n *\n * @returns Array of {@link DriverInfo} objects, one per available driver.\n * @docLink packages/bridge/api-reference#registry\n */\nexport function listDrivers(): DriverInfo[] {\n const merged = new Map<string, DriverInfo>();\n for (const info of Object.values(BUILTIN_DRIVER_CATALOG)) {\n merged.set(info.id, info);\n }\n for (const meta of pluginRegistry.list(\"driver\")) {\n if (!merged.has(meta.id)) {\n // Third-party drivers carry no DriverInfo row; read the capability flags\n // off the registered target (defaulting to conservative false) so a\n // model-agnostic / in-band-abort backend can still advertise them.\n const target = pluginRegistry.get(\"driver\", meta.id);\n merged.set(meta.id, {\n id: meta.id,\n name: meta.displayName,\n modelAgnostic: target?.modelAgnostic ?? false,\n supportsInBandAbort: target?.supportsInBandAbort ?? false,\n });\n }\n }\n return [...merged.values()];\n}\n\n/**\n * List models available to a specific driver without starting a full agent session.\n *\n * Ensures the built-in driver targets are registered (idempotent), then\n * delegates to the target's optional `listModels()`. API keys are forwarded so\n * drivers can authenticate against provider REST APIs if needed. Throws on an\n * unknown / not-bundled id (same contract as {@link createDriver}); returns `[]`\n * only when the target exists but exposes no `listModels`.\n *\n * @param driverId - Registered driver id (e.g. `\"omp\"`, `\"claude-sdk\"`, `\"codex\"`).\n * @param apiKeys - Provider API keys keyed by provider name (e.g. `{ anthropic: \"sk-...\" }`).\n * Pass `settings.apiKeys ?? {}` from forge-assistant's resolved settings.\n * @throws {Error} When `driverId` is unknown or excluded from this build.\n * @docLink packages/bridge/api-reference#registry\n */\nexport async function listModelsForDriver(\n driverId: string,\n apiKeys: Record<string, string>,\n): Promise<ModelEntry[]> {\n const target = await resolveDriverTarget(driverId);\n return (await target.listModels?.(apiKeys)) ?? [];\n}\n"]}
|
|
@@ -1,10 +1,22 @@
|
|
|
1
|
-
import { resolveSkWorkspaceConfig, readLinks } from './chunk-
|
|
2
|
-
import { scanDirectory } from './chunk-
|
|
1
|
+
import { resolveSkWorkspaceConfig, readLinks } from './chunk-LDYPQVRU.js';
|
|
2
|
+
import { scanDirectory } from './chunk-NQL3T75I.js';
|
|
3
3
|
import { existsSync, readFileSync, lstatSync } from 'fs';
|
|
4
4
|
import { resolve, join, dirname } from 'path';
|
|
5
5
|
import { fileURLToPath } from 'url';
|
|
6
6
|
import { createRequire } from 'module';
|
|
7
|
+
import { homedir } from 'os';
|
|
7
8
|
|
|
9
|
+
function sourcesToDeclarations(sources) {
|
|
10
|
+
const home = process.env.SKAILE_HOME ?? join(homedir(), ".skaile");
|
|
11
|
+
const sourcesDir = join(home, "sources");
|
|
12
|
+
const out = {};
|
|
13
|
+
for (const s of sources ?? []) {
|
|
14
|
+
const slug = s.url.replace(/\.git$/, "").split(/[/:]/).pop() ?? "source";
|
|
15
|
+
if (out[slug]) continue;
|
|
16
|
+
out[slug] = { path: join(sourcesDir, slug), url: s.url, branch: s.pin };
|
|
17
|
+
}
|
|
18
|
+
return out;
|
|
19
|
+
}
|
|
8
20
|
var BASE_ASSETS_REPO_NAME = "base-assets";
|
|
9
21
|
async function resolveRuntimeAssets(projectDir) {
|
|
10
22
|
const result = {
|
|
@@ -65,7 +77,7 @@ async function populate(projectDir, target) {
|
|
|
65
77
|
target.requiredNpmDeps = { required: [], optional: [] };
|
|
66
78
|
target.warnings = [];
|
|
67
79
|
const config = resolveSkWorkspaceConfig(projectDir);
|
|
68
|
-
const repositories = buildEffectiveRepositories(config.
|
|
80
|
+
const repositories = buildEffectiveRepositories(sourcesToDeclarations(config.sources));
|
|
69
81
|
const links = readLinks(projectDir);
|
|
70
82
|
for (const [name, decl] of Object.entries(repositories)) {
|
|
71
83
|
const repoDir = resolveRepoDir(name, decl, projectDir, links);
|
|
@@ -165,5 +177,5 @@ function findCatalogEntry(entries, query) {
|
|
|
165
177
|
}
|
|
166
178
|
|
|
167
179
|
export { BASE_ASSETS_REPO_NAME, resolveBaseAssetsRoot, resolveRuntimeAssets };
|
|
168
|
-
//# sourceMappingURL=chunk-
|
|
169
|
-
//# sourceMappingURL=chunk-
|
|
180
|
+
//# sourceMappingURL=chunk-74GTZ4TJ.js.map
|
|
181
|
+
//# sourceMappingURL=chunk-74GTZ4TJ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../core/src/runtime-assets.ts"],"names":["resolvePath","require"],"mappings":";;;;;;;;AA0CA,SAAS,sBACP,OAAA,EACmC;AACnC,EAAA,MAAM,OAAO,OAAA,CAAQ,GAAA,CAAI,eAAe,IAAA,CAA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AC3E;AACA,EAAA,MAAM,OAAA,GAAU,QAAQ,MAAA,CAAO,CAAC,MAAM,CAAA,CAAE,IAAA,KAAS,MAAM,IAAI,CAAA;AAC3D,EAAA,IAAI,OAAA,CAAQ,MAAA,KAAW,CAAA,EAAG,OAAO,QAAQ,CAAC,CAAA;AAE1C,EAAA,OAAO,MAAA;AACT","file":"chunk-74GTZ4TJ.js","sourcesContent":["/**\n * Runtime asset resolution — read `skaile.yaml`, scan all declared repositories\n * (including the built-in `base-assets/` directory as an implicit default), and\n * produce a unified view of connector catalog entries plus the implicit refs\n * that the `skaile.yaml` `connectors:` section adds to the dependency graph.\n *\n * This module is the single source of truth for \"which connectors does this\n * project see at runtime, and where do their implementations live on disk\".\n * Both the runner (serve, REPL, flow) and the platform's mid-session\n * `add_resource` flow consume `RuntimeAssetsResult.catalogEntries` and pass\n * it into `ConnectorManager` for catalog-based resolution.\n *\n * `base-assets/` is a subdirectory of the single published `@skaile/workspaces`\n * package — not a standalone package. Its on-disk path is resolved with this\n * precedence:\n * 1. `process.env.SKAILE_BASE_ASSETS_DIR` — set by the agent container at\n * runtime to point at `/app/base-assets/`.\n * 2. `require.resolve('@skaile/workspaces/package.json')` + `base-assets/` —\n * works when `@skaile/workspaces` is installed as a dependency.\n * 3. Walk upward from this module's location for the `@skaile/workspaces`\n * package root (a `package.json` whose `name` is `@skaile/workspaces`)\n * that contains a `base-assets/` subdirectory. This is the dev-workspace\n * fallback — it is bounded and works regardless of where the consumer\n * lives in the tree.\n */\n\nimport { existsSync, lstatSync, readFileSync } from \"node:fs\";\nimport { dirname, join, resolve as resolvePath } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { createRequire } from \"node:module\";\nimport type { CatalogEntry } from \"./models.js\";\nimport { scanDirectory } from \"./manifest.js\";\nimport { homedir } from \"node:os\";\nimport type { SourceDeclaration, SourceEntry } from \"./workspace-config.js\";\nimport { resolveSkWorkspaceConfig } from \"./workspace-config.js\";\nimport { readLinks } from \"./repo-manager.js\";\n\n/**\n * Map declared `sources[]` to internal `SourceDeclaration`s keyed by the\n * URL-derived cache slug, pointing at the machine-cache clone path\n * (`~/.skaile/sources/<slug>/`).\n */\nfunction sourcesToDeclarations(\n sources: SourceEntry[] | undefined,\n): Record<string, SourceDeclaration> {\n const home = process.env.SKAILE_HOME ?? join(homedir(), \".skaile\");\n const sourcesDir = join(home, \"sources\");\n const out: Record<string, SourceDeclaration> = {};\n for (const s of sources ?? []) {\n const slug =\n s.url\n .replace(/\\.git$/, \"\")\n .split(/[/:]/)\n .pop() ?? \"source\";\n if (out[slug]) continue;\n out[slug] = { path: join(sourcesDir, slug), url: s.url, branch: s.pin };\n }\n return out;\n}\n\n// ─── Types ────────────────────────────────────────────────────────────────────\n\n/**\n * Catalog entry filtered to mount/connector kinds. Same shape as `CatalogEntry`.\n * @docLink packages/core/concepts#runtime-catalog-entry\n */\nexport type RuntimeCatalogEntry = CatalogEntry;\n\n/**\n * Implicit catalog reference derived from a `connectors:` declaration in `skaile.yaml`.\n * Each connector driver becomes an implicit ref that must be resolved in the catalog.\n * @docLink packages/core/concepts#runtime-asset-ref\n */\nexport interface RuntimeAssetRef {\n kind: \"connector\";\n /** Driver name — matches `RuntimeCatalogEntry.name`. */\n name: string;\n /** Source declaration id from `skaile.yaml`. */\n declarationId: string;\n}\n\n/**\n * Aggregated npm packages required by all resolved mount/connector adapters.\n * Populated from `metadata.npm_deps` in each matched catalog entry.\n * @docLink packages/core/concepts#runtime-npm-deps\n */\nexport interface RuntimeNpmDeps {\n required: string[];\n optional: string[];\n}\n\n/**\n * Non-fatal warning emitted during `resolveRuntimeAssets` when a repo is unavailable\n * or a driver is not found in any catalog.\n * @docLink packages/core/concepts#runtime-asset-warning\n */\nexport interface RuntimeAssetWarning {\n /** Stable code for filtering / structured logging. */\n code: \"missing_driver\" | \"repo_unavailable\" | \"invalid_repo_decl\";\n message: string;\n /** Declaration id when applicable. */\n declarationId?: string;\n /** Driver / repository name when applicable. */\n name?: string;\n}\n\n/**\n * Repository name used for the implicit `@skaile/base-assets` catalog entry.\n * Callers can override this repo by declaring `repositories: { base-assets: ... }` in `skaile.yaml`.\n * @docLink packages/core/concepts#base-assets-repo-name\n */\nexport const BASE_ASSETS_REPO_NAME = \"base-assets\";\n\n/**\n * Result of `resolveRuntimeAssets`.\n * The same object is mutated in place by `refresh()`, allowing callers to hold\n * a stable reference and observe updates after a new repository is cloned or\n * a driver is installed mid-session.\n * @docLink packages/core/concepts#runtime-assets-result\n */\nexport interface RuntimeAssetsResult {\n catalogEntries: RuntimeCatalogEntry[];\n implicitRefs: RuntimeAssetRef[];\n requiredNpmDeps: RuntimeNpmDeps;\n warnings: RuntimeAssetWarning[];\n /** Re-scan repositories and re-derive implicit refs. Mutates in place. */\n refresh(): Promise<void>;\n /**\n * Catalog lookup. When `kind` is omitted and multiple entries share the\n * `name`, returns `undefined` (caller must disambiguate).\n */\n findEntry(query: { kind?: \"connector\"; name: string }): RuntimeCatalogEntry | undefined;\n}\n\n// ─── Public API ───────────────────────────────────────────────────────────────\n\n/**\n * Resolve all runtime assets visible to a project by scanning declared repositories.\n *\n * Reads `skaile.yaml`, scans every declared repository (plus the implicit\n * `@skaile/base-assets` repo), and derives implicit refs from `mounts:` /\n * `connectors:` declarations. Does not clone or install anything — purely a\n * read-only scan of what is already on disk. URL-only repositories that have\n * not been cloned yet are reported as `repo_unavailable` warnings.\n *\n * @param projectDir - Absolute path to the project workspace root\n * @returns `RuntimeAssetsResult` with catalog entries, implicit refs, npm deps, and warnings\n * @docLink packages/core/concepts#resolve-runtime-assets\n */\nexport async function resolveRuntimeAssets(projectDir: string): Promise<RuntimeAssetsResult> {\n const result: RuntimeAssetsResult = {\n catalogEntries: [],\n implicitRefs: [],\n requiredNpmDeps: { required: [], optional: [] },\n warnings: [],\n refresh: async () => {\n await populate(projectDir, result);\n },\n findEntry: (query) => findCatalogEntry(result.catalogEntries, query),\n };\n\n await populate(projectDir, result);\n return result;\n}\n\n/**\n * Resolve the on-disk root of `@skaile/base-assets`.\n *\n * Resolution tiers:\n * 1. `SKAILE_BASE_ASSETS_DIR` env var\n * 2. `require.resolve('@skaile/workspaces/base-assets/package.json')` (npm install / hoisted)\n * 3. Walk upward from this module looking for `base-assets/package.json` or\n * `ai-assets-skaile/package.json` (legacy shell-repo layout)\n *\n * @returns Absolute path to the `@skaile/base-assets` package directory\n * @throws When none of the three tiers can locate the package\n * @docLink packages/core/concepts#resolve-base-assets-root\n */\nexport function resolveBaseAssetsRoot(): string {\n const envDir = process.env.SKAILE_BASE_ASSETS_DIR;\n if (envDir && existsSync(envDir)) return resolvePath(envDir);\n\n try {\n const require = createRequire(import.meta.url);\n const pkgJson = require.resolve(\"@skaile/workspaces/package.json\");\n const candidate = join(dirname(pkgJson), \"base-assets\");\n if (existsSync(candidate)) return candidate;\n } catch {\n // Fall through to workspace walk.\n }\n\n const workspaceHit = findInWorkspace(import.meta.url);\n if (workspaceHit) return workspaceHit;\n\n throw new Error(\n `Cannot resolve the base-assets directory. ` +\n `Set SKAILE_BASE_ASSETS_DIR to the on-disk path, ` +\n `ensure @skaile/workspaces is installed, ` +\n `or run from within the @skaile/workspaces package tree.`,\n );\n}\n\n/**\n * Walk upward from `startUrl` looking for the `@skaile/workspaces` package\n * root — a directory whose `package.json` `name` is `@skaile/workspaces` and\n * which contains a `base-assets/` subdirectory. Bounded to 8 levels.\n */\nfunction findInWorkspace(startUrl: string): string | null {\n let dir: string;\n try {\n dir = dirname(fileURLToPath(startUrl));\n } catch {\n return null;\n }\n for (let i = 0; i < 8; i++) {\n const pkgPath = join(dir, \"package.json\");\n const baseAssets = join(dir, \"base-assets\");\n if (existsSync(pkgPath) && existsSync(baseAssets)) {\n try {\n const pkg = JSON.parse(readFileSync(pkgPath, \"utf-8\")) as { name?: string };\n if (pkg.name === \"@skaile/workspaces\") return baseAssets;\n } catch {\n // Ignore malformed package.json and keep walking.\n }\n }\n const parent = dirname(dir);\n if (parent === dir) break;\n dir = parent;\n }\n return null;\n}\n\n// ─── Internals ────────────────────────────────────────────────────────────────\n\nasync function populate(projectDir: string, target: RuntimeAssetsResult): Promise<void> {\n target.catalogEntries = [];\n target.implicitRefs = [];\n target.requiredNpmDeps = { required: [], optional: [] };\n target.warnings = [];\n\n const config = resolveSkWorkspaceConfig(projectDir);\n // Connector catalog scan runs over the project's declared sources[] (resolved\n // to their machine-cache clone paths) plus the implicit base-assets repo.\n const repositories = buildEffectiveRepositories(sourcesToDeclarations(config.sources));\n const links = readLinks(projectDir);\n\n // Scan each repository for connector entries.\n for (const [name, decl] of Object.entries(repositories)) {\n const repoDir = resolveRepoDir(name, decl, projectDir, links);\n if (!repoDir) {\n target.warnings.push({\n code: \"repo_unavailable\",\n name,\n message: repoUnavailableMessage(name, decl),\n });\n continue;\n }\n try {\n const entries = scanDirectory(repoDir, name).filter((e) => e.kind === \"connector\");\n target.catalogEntries.push(...entries);\n } catch (err) {\n target.warnings.push({\n code: \"repo_unavailable\",\n name,\n message: `Failed to scan repository \"${name}\" at ${repoDir}: ${\n err instanceof Error ? err.message : String(err)\n }`,\n });\n }\n }\n\n // Derive implicit refs from skaile.yaml connectors.\n for (const c of config.connectors ?? []) {\n target.implicitRefs.push({ kind: \"connector\", name: c.driver, declarationId: c.id });\n }\n\n // Validate refs and aggregate npm deps.\n const requiredSet = new Set<string>();\n const optionalSet = new Set<string>();\n for (const ref of target.implicitRefs) {\n const entry = findCatalogEntry(target.catalogEntries, ref);\n if (!entry) {\n target.warnings.push({\n code: \"missing_driver\",\n declarationId: ref.declarationId,\n name: ref.name,\n message:\n `Unknown ${ref.kind} driver \"${ref.name}\" referenced by ${ref.kind} \"${ref.declarationId}\". ` +\n `Run \\`skaile ${ref.kind} catalog\\` to see available drivers, ` +\n `or declare a repository in skaile.yaml that provides this driver.`,\n });\n continue;\n }\n const npm = (entry.metadata?.npm_deps ?? {}) as { required?: string[]; optional?: string[] };\n for (const p of npm.required ?? []) requiredSet.add(p);\n for (const p of npm.optional ?? []) optionalSet.add(p);\n }\n target.requiredNpmDeps.required = [...requiredSet];\n target.requiredNpmDeps.optional = [...optionalSet];\n}\n\n/**\n * Build the effective `repositories` map: caller's declarations first, then\n * the implicit `base-assets` repo if absent. Caller's entries always win — an\n * org can override the default by declaring `repositories: { base-assets: {...} }`.\n */\nfunction buildEffectiveRepositories(\n declared: Record<string, SourceDeclaration> | undefined,\n): Record<string, SourceDeclaration> {\n const result: Record<string, SourceDeclaration> = { ...(declared ?? {}) };\n if (!result[BASE_ASSETS_REPO_NAME]) {\n try {\n const baseDir = resolveBaseAssetsRoot();\n result[BASE_ASSETS_REPO_NAME] = { path: baseDir };\n } catch (err) {\n // Surface as a warning during scan rather than throwing here — let the\n // caller decide whether base-assets is required for this project.\n // We re-discover the failure in resolveRepoDir() and emit there.\n result[BASE_ASSETS_REPO_NAME] = { path: \"\" };\n }\n }\n return result;\n}\n\n/**\n * Resolve a repository declaration to an on-disk directory. Order:\n * 1. Linked override (`.skaile/links.yaml`).\n * 2. Local `path` — relative to `projectDir`.\n * 3. Cloned URL repo at `.skaile/repos/<name>/` (must already exist).\n *\n * Returns `null` when none of these resolve. Does not clone.\n */\nfunction resolveRepoDir(\n name: string,\n decl: SourceDeclaration,\n projectDir: string,\n links: Record<string, string>,\n): string | null {\n // 1. Linked override\n const linked = links[name];\n if (linked && existsSync(linked)) return linked;\n\n // 2. Local path\n if (decl.path) {\n const resolved = resolvePath(projectDir, decl.path);\n return existsSync(resolved) ? resolved : null;\n }\n\n // 3. URL repo cloned to project's .skaile/repos/<name>\n if (decl.url) {\n const projectDest = join(projectDir, \".skaile\", \"repos\", name);\n if (existsSync(projectDest)) {\n // Either a real directory or a symlink to the global cache.\n try {\n return lstatSync(projectDest).isSymbolicLink() ? projectDest : projectDest;\n } catch {\n return null;\n }\n }\n return null;\n }\n\n return null;\n}\n\nfunction repoUnavailableMessage(name: string, decl: SourceDeclaration): string {\n if (name === BASE_ASSETS_REPO_NAME && !decl.path && !decl.url) {\n return (\n `Cannot resolve @skaile/base-assets. ` +\n `Set SKAILE_BASE_ASSETS_DIR or ensure the package is installed.`\n );\n }\n if (decl.url) {\n return `Repository \"${name}\" (${decl.url}) is not available. Register it as a Library Source via \\`skaile source add\\`.`;\n }\n if (decl.path) {\n return `Repository \"${name}\" path not found: ${decl.path}`;\n }\n return `Repository \"${name}\" has neither url nor path.`;\n}\n\nfunction findCatalogEntry(\n entries: RuntimeCatalogEntry[],\n query: { kind?: \"connector\"; name: string },\n): RuntimeCatalogEntry | undefined {\n if (query.kind) {\n return entries.find((e) => e.kind === query.kind && e.name === query.name);\n }\n const matches = entries.filter((e) => e.name === query.name);\n if (matches.length === 1) return matches[0];\n // 0 or >1 with no kind — caller must disambiguate.\n return undefined;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"chunk-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"chunk-7QBNJTTQ.js"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AssetKindRegistryFrozenError, AssetKindConflictError, AssetKindPatternConflictError, AssetKindPathAmbiguityError } from './chunk-OKRUTSG7.js';
|
|
2
|
-
import { parseFrontmatter } from './chunk-
|
|
2
|
+
import { parseFrontmatter } from './chunk-NQL3T75I.js';
|
|
3
3
|
import { validatePersona, validateRuleset, validateSkill, validateAgent, validateConnector, validateMcpServer, validateContract, validatePrompt, validatePreset } from './chunk-NELZIQ2E.js';
|
|
4
4
|
import * as fs from 'fs';
|
|
5
5
|
import * as path from 'path';
|
|
@@ -1524,5 +1524,5 @@ function validateRequiresSyntax2(requires) {
|
|
|
1524
1524
|
var VERSION = "0.0.0";
|
|
1525
1525
|
|
|
1526
1526
|
export { AssetKindRegistry, BUILTIN_PROVIDERS, SEMVER_RE, SourceConfigSchema, VERSION, agentProvider, buildRequiresGraph, computeDeterministicHash, computeDeterministicHashDetailed, connectorProvider, contractProvider, createDefaultRegistry, detectCycles, discoverAssetsInTree, discoverAssetsInTreeEntries, discoverFromManifest, extractRequires, isExcludedDevPath, isManifestMode, loadMergedSourceConfig, loadSourceConfig, mcpServerProvider, mergeSourceConfigs, parseSourceConfig, personaProvider, presetProvider, promptProvider, rulesetProvider, skillProvider, validateSourceConfig };
|
|
1527
|
-
//# sourceMappingURL=chunk-
|
|
1528
|
-
//# sourceMappingURL=chunk-
|
|
1527
|
+
//# sourceMappingURL=chunk-CEUHU3C4.js.map
|
|
1528
|
+
//# sourceMappingURL=chunk-CEUHU3C4.js.map
|