@skaile/workspaces 1.16.0 → 2.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 +265 -0
- package/dist/{asset-feeds-WIBEP37F.js → asset-feeds-7VQVISDI.js} +25 -24
- package/dist/asset-feeds-7VQVISDI.js.map +1 -0
- package/dist/asset-manager/catalog-deployer.js +13 -1
- package/dist/asset-manager/index.js +10 -9
- package/dist/asset-manager/installer.js +7 -6
- package/dist/asset-manager/src/catalog-deployer.d.ts +70 -5
- package/dist/asset-manager/src/catalog-deployer.d.ts.map +1 -1
- package/dist/asset-manager/src/index.d.ts +22 -17
- package/dist/asset-manager/src/index.d.ts.map +1 -1
- package/dist/bridge/drivers/claude-sdk.js +108 -56
- package/dist/bridge/drivers/claude-sdk.js.map +1 -1
- package/dist/bridge/drivers/codex.js +3 -2
- package/dist/bridge/drivers/codex.js.map +1 -1
- package/dist/bridge/drivers/continue.js +4 -3
- package/dist/bridge/drivers/continue.js.map +1 -1
- package/dist/bridge/drivers/echo.js +3 -2
- package/dist/bridge/drivers/echo.js.map +1 -1
- package/dist/bridge/drivers/gemini.js +5 -4
- package/dist/bridge/drivers/goose.js +4 -3
- package/dist/bridge/drivers/goose.js.map +1 -1
- package/dist/bridge/drivers/omp.js +3 -2
- package/dist/bridge/drivers/omp.js.map +1 -1
- package/dist/bridge/drivers/opencode.js +4 -3
- package/dist/bridge/drivers/opencode.js.map +1 -1
- package/dist/bridge/drivers/qwen.js +5 -4
- package/dist/bridge/drivers/qwen.js.map +1 -1
- package/dist/bridge/index.js +4 -3
- package/dist/bridge/src/drivers/claude-sdk.d.ts.map +1 -1
- package/dist/bridge/src/drivers/scrub-transcript.d.ts +21 -1
- package/dist/bridge/src/drivers/scrub-transcript.d.ts.map +1 -1
- package/dist/{chunk-344DEXZS.js → chunk-35ELAMQ5.js} +4 -4
- package/dist/{chunk-344DEXZS.js.map → chunk-35ELAMQ5.js.map} +1 -1
- package/dist/{chunk-WSTY3AWY.js → chunk-6FJH63NN.js} +4 -4
- package/dist/{chunk-WSTY3AWY.js.map → chunk-6FJH63NN.js.map} +1 -1
- package/dist/{chunk-ISA7R7PK.js → chunk-72EOJJOM.js} +82 -38
- package/dist/chunk-72EOJJOM.js.map +1 -0
- package/dist/chunk-7GOCNYUV.js +300 -0
- package/dist/chunk-7GOCNYUV.js.map +1 -0
- package/dist/{chunk-TFIFNDT2.js → chunk-A5OYCQGT.js} +4 -4
- package/dist/{chunk-TFIFNDT2.js.map → chunk-A5OYCQGT.js.map} +1 -1
- package/dist/{chunk-KY5NY7LB.js → chunk-BCTU4TN7.js} +11 -11
- package/dist/chunk-BCTU4TN7.js.map +1 -0
- package/dist/chunk-BEAIJRVF.js +159 -0
- package/dist/chunk-BEAIJRVF.js.map +1 -0
- package/dist/chunk-BK3WL3QK.js +10 -0
- package/dist/chunk-BK3WL3QK.js.map +1 -0
- package/dist/{chunk-BI2NKPA4.js → chunk-CA5CWLGN.js} +3 -2
- package/dist/chunk-CA5CWLGN.js.map +1 -0
- package/dist/{chunk-2TSSCHCQ.js → chunk-CKVIN4H3.js} +5 -5
- package/dist/{chunk-2TSSCHCQ.js.map → chunk-CKVIN4H3.js.map} +1 -1
- package/dist/{chunk-GXC3TYMQ.js → chunk-CZZRDYT4.js} +70 -32
- package/dist/chunk-CZZRDYT4.js.map +1 -0
- package/dist/{chunk-MNKUZUN2.js → chunk-DRXDEL3A.js} +3 -3
- package/dist/{chunk-MNKUZUN2.js.map → chunk-DRXDEL3A.js.map} +1 -1
- package/dist/{chunk-BYS6JDZB.js → chunk-DY2AK577.js} +3 -3
- package/dist/{chunk-BYS6JDZB.js.map → chunk-DY2AK577.js.map} +1 -1
- package/dist/chunk-DYMWJAL4.js +552 -0
- package/dist/chunk-DYMWJAL4.js.map +1 -0
- package/dist/{chunk-ACXLKNIM.js → chunk-E7HKNQTH.js} +10 -4
- package/dist/chunk-E7HKNQTH.js.map +1 -0
- package/dist/{chunk-O5VCUU6D.js → chunk-KUZEIKZH.js} +4 -4
- package/dist/{chunk-O5VCUU6D.js.map → chunk-KUZEIKZH.js.map} +1 -1
- package/dist/{chunk-YULV7UTU.js → chunk-KYLWY3A7.js} +10 -10
- package/dist/{chunk-YULV7UTU.js.map → chunk-KYLWY3A7.js.map} +1 -1
- package/dist/{chunk-2BQBWWFX.js → chunk-LBZP2IYG.js} +6 -6
- package/dist/chunk-LBZP2IYG.js.map +1 -0
- package/dist/{chunk-MZV6WCF3.js → chunk-MAN7AGQJ.js} +3 -3
- package/dist/{chunk-MZV6WCF3.js.map → chunk-MAN7AGQJ.js.map} +1 -1
- package/dist/{chunk-7J7LQP6T.js → chunk-MMD2KQ3A.js} +31 -19
- package/dist/chunk-MMD2KQ3A.js.map +1 -0
- package/dist/{chunk-FIUGSIKC.js → chunk-NYCJ7B27.js} +19 -11
- package/dist/chunk-NYCJ7B27.js.map +1 -0
- package/dist/{chunk-ACWCVB5Q.js → chunk-ORZW7MMO.js} +3 -3
- package/dist/{chunk-ACWCVB5Q.js.map → chunk-ORZW7MMO.js.map} +1 -1
- package/dist/{chunk-M5GJT3D7.js → chunk-OYX22NJL.js} +3 -3
- package/dist/{chunk-M5GJT3D7.js.map → chunk-OYX22NJL.js.map} +1 -1
- package/dist/{chunk-C4KVFALU.js → chunk-QIQTYN7F.js} +3 -3
- package/dist/{chunk-C4KVFALU.js.map → chunk-QIQTYN7F.js.map} +1 -1
- package/dist/{chunk-2IJFUAZB.js → chunk-RK3HU3H3.js} +123 -18
- package/dist/chunk-RK3HU3H3.js.map +1 -0
- package/dist/{chunk-5NZ56R63.js → chunk-ST3DLLNZ.js} +18 -6
- package/dist/chunk-ST3DLLNZ.js.map +1 -0
- package/dist/{chunk-6POODADP.js → chunk-SVL4EZJT.js} +453 -250
- package/dist/chunk-SVL4EZJT.js.map +1 -0
- package/dist/{chunk-JB35MVBN.js → chunk-U5POE4BA.js} +4 -298
- package/dist/chunk-U5POE4BA.js.map +1 -0
- package/dist/{chunk-MO43URUI.js → chunk-UAQVFATZ.js} +7 -7
- package/dist/{chunk-MO43URUI.js.map → chunk-UAQVFATZ.js.map} +1 -1
- package/dist/{chunk-A22KZ7GZ.js → chunk-UVW3R6S7.js} +72 -37
- package/dist/chunk-UVW3R6S7.js.map +1 -0
- package/dist/{chunk-STQOPWPS.js → chunk-VCU4NPUS.js} +4 -4
- package/dist/{chunk-STQOPWPS.js.map → chunk-VCU4NPUS.js.map} +1 -1
- package/dist/{chunk-MB6563TL.js → chunk-WCWXDW22.js} +3 -3
- package/dist/{chunk-MB6563TL.js.map → chunk-WCWXDW22.js.map} +1 -1
- package/dist/{chunk-BG4XVMG2.js → chunk-WZPADAE7.js} +254 -135
- package/dist/chunk-WZPADAE7.js.map +1 -0
- package/dist/{chunk-EPWY2ABE.js → chunk-Y3JVBJ3Y.js} +5 -5
- package/dist/{chunk-EPWY2ABE.js.map → chunk-Y3JVBJ3Y.js.map} +1 -1
- package/dist/cli/index.js +347 -127
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/src/asset-feeds.d.ts +2 -2
- package/dist/cli/src/asset-feeds.d.ts.map +1 -1
- package/dist/cli/src/commands/catalog.d.ts +51 -2
- package/dist/cli/src/commands/catalog.d.ts.map +1 -1
- package/dist/cli/src/commands/connector.d.ts +1 -1
- package/dist/cli/src/commands/connector.d.ts.map +1 -1
- package/dist/cli/src/commands/logs.d.ts.map +1 -1
- package/dist/cli/src/commands/manage.d.ts +30 -3
- package/dist/cli/src/commands/manage.d.ts.map +1 -1
- package/dist/cli/src/commands/project.d.ts +5 -2
- package/dist/cli/src/commands/project.d.ts.map +1 -1
- package/dist/connectors/config.js +7 -6
- package/dist/connectors/index.js +8 -7
- package/dist/connectors/src/connector-manager.d.ts.map +1 -1
- package/dist/connectors/src/watcher.d.ts.map +1 -1
- package/dist/connectors/src/worktree.d.ts +20 -2
- package/dist/connectors/src/worktree.d.ts.map +1 -1
- package/dist/core/index.js +6 -5
- package/dist/core/logging.js +2 -1
- package/dist/core/manifest.js +2 -1
- package/dist/core/runtime-assets.js +4 -3
- package/dist/core/src/fs-deadline.d.ts +84 -0
- package/dist/core/src/fs-deadline.d.ts.map +1 -0
- package/dist/core/src/index.d.ts +4 -3
- package/dist/core/src/index.d.ts.map +1 -1
- package/dist/core/src/manifest.d.ts +142 -18
- package/dist/core/src/manifest.d.ts.map +1 -1
- package/dist/core/src/repo-manager.d.ts +2 -2
- 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/subprocess.d.ts +33 -1
- package/dist/core/src/subprocess.d.ts.map +1 -1
- package/dist/core/src/walker.d.ts +1 -1
- package/dist/core/src/walker.d.ts.map +1 -1
- package/dist/core/src/workspace-config.d.ts +9 -2
- package/dist/core/src/workspace-config.d.ts.map +1 -1
- package/dist/core/workspace-config.js +3 -2
- package/dist/deploy/index.js +12 -7
- package/dist/deploy/index.js.map +1 -1
- package/dist/deploy/src/targets/container-runtime.d.ts.map +1 -1
- package/dist/discovery/index.js +3 -2
- package/dist/{ensure-sources-RSTZONIE.js → ensure-sources-JLVHHZI2.js} +13 -12
- package/dist/ensure-sources-JLVHHZI2.js.map +1 -0
- package/dist/factory-assets/connectors/box.js +8 -7
- package/dist/factory-assets/connectors/deploy/CONNECTOR.md +19 -0
- package/dist/factory-assets/connectors/deploy/adapter.d.ts.map +1 -1
- package/dist/factory-assets/connectors/deploy.js +8 -7
- package/dist/factory-assets/connectors/devserver/adapter.d.ts.map +1 -1
- package/dist/factory-assets/connectors/devserver.js +8 -7
- package/dist/factory-assets/connectors/flow/adapter.js +8 -7
- package/dist/factory-assets/connectors/flow/engine.js +6 -5
- package/dist/factory-assets/connectors/flow/run-flow.js +10 -9
- package/dist/factory-assets/connectors/flow.js +8 -7
- package/dist/factory-assets/connectors/git/driver.d.ts +12 -1
- package/dist/factory-assets/connectors/git/driver.d.ts.map +1 -1
- package/dist/factory-assets/connectors/git.js +8 -7
- package/dist/factory-assets/connectors/gmail.js +8 -7
- package/dist/factory-assets/connectors/googledrive.js +8 -7
- package/dist/factory-assets/connectors/local/driver.d.ts +25 -1
- package/dist/factory-assets/connectors/local/driver.d.ts.map +1 -1
- package/dist/factory-assets/connectors/local.js +8 -7
- package/dist/factory-assets/connectors/mattermost.js +8 -7
- package/dist/factory-assets/connectors/memory.js +8 -7
- package/dist/factory-assets/connectors/minio.js +8 -7
- package/dist/factory-assets/connectors/postgres.js +8 -7
- package/dist/factory-assets/connectors/s3/driver.d.ts +15 -0
- package/dist/factory-assets/connectors/s3/driver.d.ts.map +1 -1
- package/dist/factory-assets/connectors/s3.js +8 -7
- package/dist/factory-assets/connectors/sharepoint.js +8 -7
- package/dist/factory-assets/connectors/sqlite/adapter.d.ts +8 -1
- package/dist/factory-assets/connectors/sqlite/adapter.d.ts.map +1 -1
- package/dist/factory-assets/connectors/sqlite.js +8 -7
- package/dist/factory-assets/connectors/static-server/adapter.d.ts.map +1 -1
- package/dist/factory-assets/connectors/static-server.js +8 -7
- package/dist/factory-assets/connectors/tunnel.js +8 -7
- package/dist/factory-assets/connectors/webdav.js +8 -7
- package/dist/factory-assets/connectors/xstate/adapter.d.ts +6 -0
- package/dist/factory-assets/connectors/xstate/adapter.d.ts.map +1 -1
- package/dist/factory-assets/connectors/xstate-store.js +8 -7
- package/dist/factory-assets/connectors/xstate.js +8 -7
- package/dist/flows-LV5WYJ2I.js +20 -0
- package/dist/{flows-FHWBCLXF.js.map → flows-LV5WYJ2I.js.map} +1 -1
- package/dist/{helpers-GUUWPPAX.js → helpers-PJ3CPUUL.js} +13 -12
- package/dist/{helpers-GUUWPPAX.js.map → helpers-PJ3CPUUL.js.map} +1 -1
- package/dist/library/index.js +8 -7
- package/dist/library/install.js +6 -5
- package/dist/{library-publish-UKKSJP7V.js → library-publish-HVZRCE3C.js} +16 -15
- package/dist/library-publish-HVZRCE3C.js.map +1 -0
- package/dist/{open-library-VALRYGFV.js → open-library-RMI2FTQ4.js} +14 -13
- package/dist/{open-library-VALRYGFV.js.map → open-library-RMI2FTQ4.js.map} +1 -1
- package/dist/{paths-5QJJBAND.js → paths-JSVTQAVW.js} +11 -10
- package/dist/{paths-5QJJBAND.js.map → paths-JSVTQAVW.js.map} +1 -1
- package/dist/plugin-registry/src/deploy-helpers.d.ts +1 -1
- package/dist/{plugin-store-ZBJZ7F6D.js → plugin-store-7TVJB2TS.js} +8 -7
- package/dist/plugin-store-7TVJB2TS.js.map +1 -0
- package/dist/{project-IRUJLIVX.js → project-P636MSYT.js} +14 -13
- package/dist/{project-IRUJLIVX.js.map → project-P636MSYT.js.map} +1 -1
- package/dist/resolver/index.js +13 -1
- package/dist/resolver/src/types.d.ts +7 -0
- package/dist/resolver/src/types.d.ts.map +1 -1
- package/dist/resolver/src/validator.d.ts +8 -1
- package/dist/resolver/src/validator.d.ts.map +1 -1
- package/dist/runner/index.js +13 -12
- package/dist/runner/src/external-mcp.d.ts +1 -1
- package/dist/runner/src/external-mcp.d.ts.map +1 -1
- package/dist/runner/src/mcp-prompt.d.ts +7 -3
- package/dist/runner/src/mcp-prompt.d.ts.map +1 -1
- package/dist/runner/src/mcp-runtime-handlers.d.ts +12 -0
- package/dist/runner/src/mcp-runtime-handlers.d.ts.map +1 -1
- package/dist/runner/src/mixin-resolver.d.ts.map +1 -1
- package/dist/runner/src/recipe-resolver.d.ts +20 -6
- package/dist/runner/src/recipe-resolver.d.ts.map +1 -1
- package/dist/runner/src/resource-handler.d.ts +43 -0
- package/dist/runner/src/resource-handler.d.ts.map +1 -1
- package/dist/runner/src/resources.d.ts +12 -5
- package/dist/runner/src/resources.d.ts.map +1 -1
- package/dist/runner/src/serve.d.ts +5 -5
- package/dist/runner/src/serve.d.ts.map +1 -1
- package/dist/runner/src/session-builder.d.ts +9 -0
- package/dist/runner/src/session-builder.d.ts.map +1 -1
- package/dist/runner/src/session-capability-wiring.d.ts +5 -0
- package/dist/runner/src/session-capability-wiring.d.ts.map +1 -1
- package/dist/runner/src/workspace-migration.d.ts +37 -3
- package/dist/runner/src/workspace-migration.d.ts.map +1 -1
- package/dist/sdk/asset-manager.js +10 -9
- package/dist/sdk/bridge.js +4 -3
- package/dist/sdk/core.js +6 -5
- package/dist/sdk/flow.js +6 -5
- package/dist/sdk/index.js +13 -12
- package/dist/sdk/index.js.map +1 -1
- package/dist/sdk/resolver.js +13 -1
- package/dist/sdk/runner.js +13 -12
- package/dist/sdk/session.js +1 -1
- package/dist/sdk/store.js +1 -1
- package/dist/session/index.js +1 -1
- package/dist/session/src/dispatcher.d.ts.map +1 -1
- package/dist/{setup-WJPNUE32.js → setup-OYW3W3XK.js} +10 -9
- package/dist/setup-OYW3W3XK.js.map +1 -0
- package/dist/skills-QY5PHBD3.js +20 -0
- package/dist/{skills-BMI6H7HI.js.map → skills-QY5PHBD3.js.map} +1 -1
- package/dist/{source-5KDURFBS.js → source-63CHWDC2.js} +15 -14
- package/dist/{source-5KDURFBS.js.map → source-63CHWDC2.js.map} +1 -1
- package/dist/{source-manifest-publish-DPQI44D3.js → source-manifest-publish-DLASGDK5.js} +17 -16
- package/dist/source-manifest-publish-DLASGDK5.js.map +1 -0
- package/dist/store/index.js +1 -1
- package/dist/store/src/store.d.ts +9 -0
- package/dist/store/src/store.d.ts.map +1 -1
- package/dist/tui/index.js +13 -12
- package/dist/tui/index.js.map +1 -1
- package/dist/validator-RN64BKFW.js +5 -0
- package/dist/{validator-VF5M764T.js.map → validator-RN64BKFW.js.map} +1 -1
- package/dist/workspace-plugin/adapters/mcp.js +18 -5
- package/dist/workspace-plugin/adapters/mcp.js.map +1 -1
- package/dist/workspace-plugin/adapters/omp.js +10 -10
- package/dist/workspace-plugin/index.js +3 -2
- package/dist/workspace-plugin/src/tools/validator.d.ts.map +1 -1
- package/dist/workspace-plugin/src/utils/ai-assets.d.ts +11 -6
- package/dist/workspace-plugin/src/utils/ai-assets.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/asset-feeds-WIBEP37F.js.map +0 -1
- package/dist/chunk-2BQBWWFX.js.map +0 -1
- package/dist/chunk-2IJFUAZB.js.map +0 -1
- package/dist/chunk-5NZ56R63.js.map +0 -1
- package/dist/chunk-6POODADP.js.map +0 -1
- package/dist/chunk-7J7LQP6T.js.map +0 -1
- package/dist/chunk-A22KZ7GZ.js.map +0 -1
- package/dist/chunk-ACXLKNIM.js.map +0 -1
- package/dist/chunk-BG4XVMG2.js.map +0 -1
- package/dist/chunk-BI2NKPA4.js.map +0 -1
- package/dist/chunk-BQCGFPHW.js +0 -345
- package/dist/chunk-BQCGFPHW.js.map +0 -1
- package/dist/chunk-FIUGSIKC.js.map +0 -1
- package/dist/chunk-GXC3TYMQ.js.map +0 -1
- package/dist/chunk-ISA7R7PK.js.map +0 -1
- package/dist/chunk-JB35MVBN.js.map +0 -1
- package/dist/chunk-KY5NY7LB.js.map +0 -1
- package/dist/chunk-LV2HPH3C.js +0 -73
- package/dist/chunk-LV2HPH3C.js.map +0 -1
- package/dist/chunk-XCBG2KDC.js +0 -23
- package/dist/chunk-XCBG2KDC.js.map +0 -1
- package/dist/ensure-sources-RSTZONIE.js.map +0 -1
- package/dist/flows-FHWBCLXF.js +0 -7
- package/dist/library-publish-UKKSJP7V.js.map +0 -1
- package/dist/plugin-store-ZBJZ7F6D.js.map +0 -1
- package/dist/setup-WJPNUE32.js.map +0 -1
- package/dist/skills-BMI6H7HI.js +0 -7
- package/dist/source-manifest-publish-DPQI44D3.js.map +0 -1
- package/dist/validator-VF5M764T.js +0 -5
|
@@ -1,33 +1,35 @@
|
|
|
1
|
-
import { WorkspacePlugin } from './chunk-
|
|
1
|
+
import { WorkspacePlugin } from './chunk-QIQTYN7F.js';
|
|
2
2
|
import { assembleSystemPrompt, buildCapabilitiesPromptSection } from './chunk-W3UDISS2.js';
|
|
3
3
|
import { WebSocketServerTransport } from './chunk-WQ7DE5UC.js';
|
|
4
|
-
import { EventNormalizer } from './chunk-
|
|
4
|
+
import { EventNormalizer } from './chunk-OYX22NJL.js';
|
|
5
5
|
import { SUPPORTED_CLOUDS, CLOUD_SECRET_ENV_KEYS } from './chunk-ISQWMBKD.js';
|
|
6
6
|
import { classifyClaudeSdkError } from './chunk-GAH4YRCI.js';
|
|
7
|
-
import { createDriver } from './chunk-
|
|
8
|
-
import { deployCatalogEntry, undeployCatalogEntry } from './chunk-
|
|
9
|
-
import { registerBuiltinConnectors, buildConnectorPromptSection, findMissingPackages, installNpmPackages, ConnectorManager, ConnectorStartupError, buildSdkConnectorTools, buildSdkFlowTools } from './chunk-
|
|
10
|
-
import { loadConnectorDeclarations, SecretProviderChain, PreMintedSecretProvider, InMemorySecretProvider, resolvedConfigToDeclarations, isKnownSecretRef, deriveSingleMaterializedConnectorDeclaration } from './chunk-
|
|
7
|
+
import { createDriver } from './chunk-ORZW7MMO.js';
|
|
8
|
+
import { findAiAssetsRoot, deployCatalogEntry, undeployCatalogEntry } from './chunk-BEAIJRVF.js';
|
|
9
|
+
import { registerBuiltinConnectors, buildConnectorPromptSection, findMissingPackages, installNpmPackages, ConnectorManager, ConnectorStartupError, buildSdkConnectorTools, buildSdkFlowTools } from './chunk-SVL4EZJT.js';
|
|
10
|
+
import { loadConnectorDeclarations, SecretProviderChain, PreMintedSecretProvider, InMemorySecretProvider, resolvedConfigToDeclarations, isKnownSecretRef, deriveSingleMaterializedConnectorDeclaration } from './chunk-CKVIN4H3.js';
|
|
11
11
|
import { renderStimulusPrompt, buildOrchestratorPrompt } from './chunk-Y662DNQQ.js';
|
|
12
12
|
import { PROTOCOL_VERSION } from './chunk-RDE43ORT.js';
|
|
13
|
-
import { resolveSettings, resolveApiKey, providerEnvKey } from './chunk-
|
|
13
|
+
import { resolveSettings, resolveApiKey, providerEnvKey } from './chunk-ST3DLLNZ.js';
|
|
14
14
|
import { resolveDriverPaths } from './chunk-K5GBV4SA.js';
|
|
15
|
-
import { resolveRuntimeAssets } from './chunk-
|
|
16
|
-
import { resolveSkWorkspaceConfig, resolveAgentDir, cloudConfigFromProfile, stageMaterializedSkills, loadMcpServerDeclarations, COMPACTION_DEFAULTS, validateAssetRecipeAttr, deriveSingleMaterializedMcpDeclaration } from './chunk-
|
|
15
|
+
import { resolveRuntimeAssets } from './chunk-MMD2KQ3A.js';
|
|
16
|
+
import { resolveSkWorkspaceConfig, resolveAgentDir, cloudConfigFromProfile, stageMaterializedSkills, loadMcpServerDeclarations, COMPACTION_DEFAULTS, validateAssetRecipeAttr, deriveSingleMaterializedMcpDeclaration } from './chunk-72EOJJOM.js';
|
|
17
|
+
import { withFsDeadline, fsDeadlineMs, FsDeadlineError, tryWithFsDeadline } from './chunk-DYMWJAL4.js';
|
|
17
18
|
import { parseAssetRef } from './chunk-GEEW6SY2.js';
|
|
18
|
-
import {
|
|
19
|
+
import { resolveLogStoreConfig, createLogStoreFromConfig, OnLogBridgeSink, WsLogSink } from './chunk-U5POE4BA.js';
|
|
20
|
+
import { getLogStore, registerLogStore, resetLogStore, createLogger } from './chunk-7GOCNYUV.js';
|
|
19
21
|
import { __require } from './chunk-NSBPE2FW.js';
|
|
20
22
|
import pc from 'picocolors';
|
|
21
23
|
import { Marked } from 'marked';
|
|
22
24
|
import { markedTerminal } from 'marked-terminal';
|
|
23
|
-
import
|
|
25
|
+
import fs4, { readFile, stat, rm, unlink, mkdir, writeFile, readdir, rename } from 'fs/promises';
|
|
24
26
|
import path4, { join, resolve, relative, sep, isAbsolute, dirname, basename } from 'path';
|
|
27
|
+
import { existsSync, readFileSync, mkdirSync, writeFileSync, watch, chmodSync, rmSync } from 'fs';
|
|
25
28
|
import { homedir } from 'os';
|
|
26
29
|
import * as z5 from 'zod';
|
|
27
30
|
import { z } from 'zod';
|
|
28
|
-
import fs4, { mkdir, writeFile, rename, readFile } from 'fs/promises';
|
|
29
31
|
import { createHash, randomUUID } from 'crypto';
|
|
30
|
-
import { execFile
|
|
32
|
+
import { execFile } from 'child_process';
|
|
31
33
|
import { promisify } from 'util';
|
|
32
34
|
import { parse } from 'yaml';
|
|
33
35
|
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
@@ -287,7 +289,7 @@ function findInRepos(repos, kind, name, repoQualifier) {
|
|
|
287
289
|
async function loadKnowledgeDir(dir) {
|
|
288
290
|
let entries;
|
|
289
291
|
try {
|
|
290
|
-
entries =
|
|
292
|
+
entries = (await fs4.readdir(dir)).filter((e) => e.endsWith(".md"));
|
|
291
293
|
} catch {
|
|
292
294
|
return null;
|
|
293
295
|
}
|
|
@@ -838,6 +840,15 @@ var FileChangedCoalescer = class {
|
|
|
838
840
|
state.dirCapHit = false;
|
|
839
841
|
}
|
|
840
842
|
};
|
|
843
|
+
var execFileAsync2 = promisify(execFile);
|
|
844
|
+
var DEFAULT_NIX_TIMEOUT_MS = 3e4;
|
|
845
|
+
var NIX_TIMEOUT_ENV_VAR = "SKAILE_NIX_TIMEOUT_MS";
|
|
846
|
+
function nixTimeoutMs() {
|
|
847
|
+
const raw = process.env[NIX_TIMEOUT_ENV_VAR];
|
|
848
|
+
if (raw === void 0) return DEFAULT_NIX_TIMEOUT_MS;
|
|
849
|
+
const parsed = Number.parseInt(raw, 10);
|
|
850
|
+
return Number.isFinite(parsed) && parsed > 0 ? parsed : DEFAULT_NIX_TIMEOUT_MS;
|
|
851
|
+
}
|
|
841
852
|
var RecipeUnavailableError = class extends Error {
|
|
842
853
|
constructor(flakeRef, attr, cause) {
|
|
843
854
|
super(
|
|
@@ -858,21 +869,37 @@ function recipeMapPath() {
|
|
|
858
869
|
return process.env.SKAILE_NIX_RECIPE_MAP || DEFAULT_RECIPE_MAP_PATH;
|
|
859
870
|
}
|
|
860
871
|
var recipeMapMemo = null;
|
|
861
|
-
|
|
872
|
+
var recipeMapInFlight = null;
|
|
873
|
+
async function loadRecipeMap() {
|
|
862
874
|
const path5 = recipeMapPath();
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
875
|
+
const mtimeMs = await tryWithFsDeadline(
|
|
876
|
+
`stat ${path5}`,
|
|
877
|
+
async () => (await stat(path5)).mtimeMs,
|
|
878
|
+
null
|
|
879
|
+
);
|
|
880
|
+
if (mtimeMs === null) {
|
|
867
881
|
recipeMapMemo = { path: path5, mtimeMs: -1, map: null };
|
|
868
882
|
return null;
|
|
869
883
|
}
|
|
870
884
|
if (recipeMapMemo && recipeMapMemo.path === path5 && recipeMapMemo.mtimeMs === mtimeMs) {
|
|
871
885
|
return recipeMapMemo.map;
|
|
872
886
|
}
|
|
887
|
+
const key = `${path5}:${mtimeMs}`;
|
|
888
|
+
if (recipeMapInFlight?.key === key) return recipeMapInFlight.promise;
|
|
889
|
+
const promise = readRecipeMap(path5, mtimeMs);
|
|
890
|
+
recipeMapInFlight = { key, promise };
|
|
891
|
+
try {
|
|
892
|
+
return await promise;
|
|
893
|
+
} finally {
|
|
894
|
+
if (recipeMapInFlight?.key === key) recipeMapInFlight = null;
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
async function readRecipeMap(path5, mtimeMs) {
|
|
873
898
|
let map = null;
|
|
874
899
|
try {
|
|
875
|
-
const parsed = JSON.parse(
|
|
900
|
+
const parsed = JSON.parse(
|
|
901
|
+
await withFsDeadline(`readFile ${path5}`, () => readFile(path5, "utf8"))
|
|
902
|
+
);
|
|
876
903
|
map = parsed && typeof parsed === "object" ? parsed : null;
|
|
877
904
|
} catch (err) {
|
|
878
905
|
createLogger({ kind: "mcp", subkind: "recipe-resolve" }).warn(
|
|
@@ -890,8 +917,8 @@ var MapRecipeProducer = class {
|
|
|
890
917
|
}
|
|
891
918
|
load;
|
|
892
919
|
kind = "map";
|
|
893
|
-
resolve(_ref, attr) {
|
|
894
|
-
const map = this.load();
|
|
920
|
+
async resolve(_ref, attr) {
|
|
921
|
+
const map = await this.load();
|
|
895
922
|
if (!map) return null;
|
|
896
923
|
const hit = attr.split(".").reduce(
|
|
897
924
|
(o, k) => o && typeof o === "object" ? o[k] : void 0,
|
|
@@ -902,21 +929,22 @@ var MapRecipeProducer = class {
|
|
|
902
929
|
};
|
|
903
930
|
var NixRecipeProducer = class {
|
|
904
931
|
kind = "nix";
|
|
905
|
-
resolve(ref, attr) {
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
);
|
|
932
|
+
async resolve(ref, attr) {
|
|
933
|
+
let stdout;
|
|
934
|
+
try {
|
|
935
|
+
({ stdout } = await execFileAsync2("nix", ["path-info", "--offline", `${ref}#${attr}`], {
|
|
936
|
+
encoding: "utf8",
|
|
937
|
+
timeout: nixTimeoutMs(),
|
|
938
|
+
killSignal: "SIGKILL"
|
|
939
|
+
}));
|
|
940
|
+
} catch (err) {
|
|
941
|
+
const e = err;
|
|
942
|
+
const detail = typeof e.code === "number" ? new Error(`nix path-info exited ${e.code}: ${(e.stderr ?? "").trim()}`) : err;
|
|
943
|
+
throw new RecipeUnavailableError(ref, attr, detail);
|
|
916
944
|
}
|
|
917
|
-
const outPath =
|
|
945
|
+
const outPath = stdout.trim().split("\n")[0];
|
|
918
946
|
if (!outPath?.startsWith("/nix/store/")) {
|
|
919
|
-
throw new RecipeUnavailableError(ref, attr, new Error(`Unexpected output: ${
|
|
947
|
+
throw new RecipeUnavailableError(ref, attr, new Error(`Unexpected output: ${stdout}`));
|
|
920
948
|
}
|
|
921
949
|
return outPath;
|
|
922
950
|
}
|
|
@@ -924,7 +952,7 @@ var NixRecipeProducer = class {
|
|
|
924
952
|
function defaultRecipeProducers() {
|
|
925
953
|
return [new MapRecipeProducer(), new NixRecipeProducer()];
|
|
926
954
|
}
|
|
927
|
-
function resolveViaProducers(ref, attr, cache, producers = defaultRecipeProducers()) {
|
|
955
|
+
async function resolveViaProducers(ref, attr, cache, producers = defaultRecipeProducers()) {
|
|
928
956
|
const key = `${ref}#${attr}`;
|
|
929
957
|
const cached = cache.get(key);
|
|
930
958
|
if (cached) return cached;
|
|
@@ -940,7 +968,7 @@ function resolveViaProducers(ref, attr, cache, producers = defaultRecipeProducer
|
|
|
940
968
|
const log = createLogger({ kind: "mcp", subkind: "recipe-resolve" });
|
|
941
969
|
log.debug("resolving recipe", { flakeRef: ref, attr });
|
|
942
970
|
for (const producer of producers) {
|
|
943
|
-
const out = producer.resolve(ref, attr);
|
|
971
|
+
const out = await producer.resolve(ref, attr);
|
|
944
972
|
if (out) {
|
|
945
973
|
cache.set(key, out);
|
|
946
974
|
log.info("resolved recipe", { flakeRef: ref, attr, outPath: out, producer: producer.kind });
|
|
@@ -1038,13 +1066,13 @@ var RESERVED_MCP_SERVER_IDS = /* @__PURE__ */ new Set([
|
|
|
1038
1066
|
"skaile-workspace",
|
|
1039
1067
|
"skaile-capabilities"
|
|
1040
1068
|
]);
|
|
1041
|
-
function resolveExternalMcpDeclarations(projectDir, sessionId) {
|
|
1069
|
+
async function resolveExternalMcpDeclarations(projectDir, sessionId) {
|
|
1042
1070
|
const mcpLog = createLogger({
|
|
1043
1071
|
kind: "mcp",
|
|
1044
1072
|
subkind: "wiring",
|
|
1045
1073
|
instance: sessionId ?? "no-session"
|
|
1046
1074
|
});
|
|
1047
|
-
const mcpDeclarations = loadMcpServerDeclarations(projectDir);
|
|
1075
|
+
const mcpDeclarations = await loadMcpServerDeclarations(projectDir);
|
|
1048
1076
|
mcpLog.debug("loaded MCP declarations", { count: mcpDeclarations.length });
|
|
1049
1077
|
const recipeCache = createRecipeCache();
|
|
1050
1078
|
const nixFlakeRef = process.env.SKAILE_NIX_FLAKE_REF ?? "/etc/skaile/flake";
|
|
@@ -1065,7 +1093,7 @@ function resolveExternalMcpDeclarations(projectDir, sessionId) {
|
|
|
1065
1093
|
});
|
|
1066
1094
|
continue;
|
|
1067
1095
|
}
|
|
1068
|
-
const resolvedDecl = resolveRecipeDeclaration(decl, nixFlakeRef, recipeCache);
|
|
1096
|
+
const resolvedDecl = await resolveRecipeDeclaration(decl, nixFlakeRef, recipeCache);
|
|
1069
1097
|
if (resolvedDecl) resolved.push(resolvedDecl);
|
|
1070
1098
|
}
|
|
1071
1099
|
return resolved.map((decl) => ({
|
|
@@ -1075,13 +1103,13 @@ function resolveExternalMcpDeclarations(projectDir, sessionId) {
|
|
|
1075
1103
|
env: substituteWorkspaceTokenMap(decl.env, projectDir)
|
|
1076
1104
|
}));
|
|
1077
1105
|
}
|
|
1078
|
-
function resolveRecipeDeclaration(decl, nixFlakeRef, recipeCache) {
|
|
1106
|
+
async function resolveRecipeDeclaration(decl, nixFlakeRef, recipeCache) {
|
|
1079
1107
|
const recipe = decl.recipe;
|
|
1080
1108
|
const recipeLogKey = recipe.flake ? { flake: recipe.flake } : { attr: recipe.attr };
|
|
1081
1109
|
const recipeLog = createLogger({ kind: "mcp", subkind: decl.id, instance: "recipe-resolve" });
|
|
1082
1110
|
try {
|
|
1083
1111
|
const recipeKey = recipe.flake ? `mcps.${decl.id}` : recipe.attr ?? `mcps.${decl.id}`;
|
|
1084
|
-
const outPath = resolveRecipePath(nixFlakeRef, recipeKey, recipeCache);
|
|
1112
|
+
const outPath = await resolveRecipePath(nixFlakeRef, recipeKey, recipeCache);
|
|
1085
1113
|
const outPaths = /* @__PURE__ */ new Map([[decl.id, outPath]]);
|
|
1086
1114
|
const resolvedCommand = decl.command ? substituteRecipeTemplating(decl.command, outPaths) : decl.command;
|
|
1087
1115
|
const resolvedArgs = decl.args?.map((a) => substituteRecipeTemplating(a, outPaths));
|
|
@@ -1433,12 +1461,18 @@ var ExternalMcpManager = class {
|
|
|
1433
1461
|
};
|
|
1434
1462
|
|
|
1435
1463
|
// runner/src/mcp-prompt.ts
|
|
1436
|
-
function buildMcpPromptSection(declarations) {
|
|
1464
|
+
function buildMcpPromptSection(declarations, connected) {
|
|
1437
1465
|
const withGuidance = declarations.filter(
|
|
1438
1466
|
(d) => !!d.instructions && d.instructions.trim().length > 0
|
|
1439
1467
|
);
|
|
1440
|
-
|
|
1441
|
-
|
|
1468
|
+
const inventory = connected ?? [];
|
|
1469
|
+
if (withGuidance.length === 0 && inventory.length === 0) return "";
|
|
1470
|
+
const lines = ["## MCP servers", ""];
|
|
1471
|
+
if (inventory.length > 0) {
|
|
1472
|
+
const listed = inventory.map((s) => `\`${s.id}\` (${s.toolCount} tool${s.toolCount === 1 ? "" : "s"})`).join(", ");
|
|
1473
|
+
lines.push(`Connected: ${listed}. Call their tools as \`mcp__<server>__<tool>\`.`);
|
|
1474
|
+
lines.push("");
|
|
1475
|
+
}
|
|
1442
1476
|
for (const d of withGuidance) {
|
|
1443
1477
|
lines.push(`Guidance for \`${d.id}\`:`);
|
|
1444
1478
|
lines.push(d.instructions.trim());
|
|
@@ -1448,7 +1482,7 @@ function buildMcpPromptSection(declarations) {
|
|
|
1448
1482
|
}
|
|
1449
1483
|
|
|
1450
1484
|
// runner/src/resources.ts
|
|
1451
|
-
async function buildAgentResources(projectDir, driverType, _onLog, watch, secretProvider, sessionMeta, tokenMediator, preMintedSecrets, deferFilesystemMounts, capabilityRegistry, fallbackConnectorDeclarations) {
|
|
1485
|
+
async function buildAgentResources(projectDir, driverType, _onLog, watch, secretProvider, sessionMeta, tokenMediator, preMintedSecrets, deferFilesystemMounts, capabilityRegistry, fallbackConnectorDeclarations, extraMcpDeclarations) {
|
|
1452
1486
|
const resLog = createLogger({
|
|
1453
1487
|
kind: "runner",
|
|
1454
1488
|
subkind: "resources",
|
|
@@ -1533,7 +1567,10 @@ async function buildAgentResources(projectDir, driverType, _onLog, watch, secret
|
|
|
1533
1567
|
workspacePluginToShutdown = inProcess.workspacePluginToShutdown;
|
|
1534
1568
|
}
|
|
1535
1569
|
if (capabilityRegistry) {
|
|
1536
|
-
externalMcpDeclarations =
|
|
1570
|
+
externalMcpDeclarations = mergeExtraMcpDeclarations(
|
|
1571
|
+
await resolveExternalMcpDeclarations(projectDir, sessionMeta?.sessionId),
|
|
1572
|
+
extraMcpDeclarations
|
|
1573
|
+
);
|
|
1537
1574
|
externalMcpManager = await startExternalMcpServers(
|
|
1538
1575
|
capabilityRegistry,
|
|
1539
1576
|
externalMcpDeclarations,
|
|
@@ -1541,7 +1578,10 @@ async function buildAgentResources(projectDir, driverType, _onLog, watch, secret
|
|
|
1541
1578
|
sessionMeta
|
|
1542
1579
|
);
|
|
1543
1580
|
} else if (driverType === "claude-sdk") {
|
|
1544
|
-
externalMcpDeclarations = resolveExternalMcpDeclarations(
|
|
1581
|
+
externalMcpDeclarations = await resolveExternalMcpDeclarations(
|
|
1582
|
+
projectDir,
|
|
1583
|
+
sessionMeta?.sessionId
|
|
1584
|
+
);
|
|
1545
1585
|
mcpServers = wireExternalMcpServersForSdk(
|
|
1546
1586
|
mcpServers,
|
|
1547
1587
|
externalMcpDeclarations,
|
|
@@ -1594,7 +1634,10 @@ async function buildAgentResources(projectDir, driverType, _onLog, watch, secret
|
|
|
1594
1634
|
} catch {
|
|
1595
1635
|
}
|
|
1596
1636
|
};
|
|
1597
|
-
const mcpPromptSection = buildMcpPromptSection(
|
|
1637
|
+
const mcpPromptSection = buildMcpPromptSection(
|
|
1638
|
+
externalMcpDeclarations ?? [],
|
|
1639
|
+
externalMcpManager?.listServers()
|
|
1640
|
+
);
|
|
1598
1641
|
return {
|
|
1599
1642
|
resourceManager,
|
|
1600
1643
|
resourcePromptSection,
|
|
@@ -1687,6 +1730,11 @@ async function buildInProcessMcpServers(resourceManager, projectDir, driverType,
|
|
|
1687
1730
|
}
|
|
1688
1731
|
return { mcpServers, workspacePluginToShutdown: workspacePlugin };
|
|
1689
1732
|
}
|
|
1733
|
+
function mergeExtraMcpDeclarations(diskDecls, extra) {
|
|
1734
|
+
if (!extra?.length) return diskDecls;
|
|
1735
|
+
const declared = new Set(diskDecls.map((d) => d.id));
|
|
1736
|
+
return [...diskDecls, ...extra.filter((d) => !declared.has(d.id))];
|
|
1737
|
+
}
|
|
1690
1738
|
async function startExternalMcpServers(capabilityRegistry, resolvedDecls, secretProvider, sessionMeta) {
|
|
1691
1739
|
if (resolvedDecls.length === 0) return null;
|
|
1692
1740
|
const mgr = createExternalMcpManager(capabilityRegistry, secretProvider, sessionMeta);
|
|
@@ -1842,13 +1890,14 @@ async function createAgentSession(config) {
|
|
|
1842
1890
|
config.preMintedSecrets,
|
|
1843
1891
|
config.deferFilesystemMounts,
|
|
1844
1892
|
config.capabilityRegistry,
|
|
1845
|
-
config.fallbackConnectorDeclarations
|
|
1893
|
+
config.fallbackConnectorDeclarations,
|
|
1894
|
+
config.getExtraMcpDeclarations?.()
|
|
1846
1895
|
);
|
|
1847
1896
|
const wsConfig = wsConfigOverride ?? resolveSkWorkspaceConfig(projectDir);
|
|
1848
1897
|
const contextSection = buildContextSection(wsConfig.agent?.context);
|
|
1849
1898
|
const userPromptSection = wsConfig.agent?.prompt?.trim();
|
|
1850
1899
|
const environmentSection = await buildEnvironmentSection(projectDir);
|
|
1851
|
-
const promptExtensions = loadPromptExtensions(
|
|
1900
|
+
const promptExtensions = await loadPromptExtensions(
|
|
1852
1901
|
wsConfig.agent?.["prompt-extensions"],
|
|
1853
1902
|
projectDir,
|
|
1854
1903
|
sessionLog
|
|
@@ -1924,26 +1973,24 @@ async function createAgentSession(config) {
|
|
|
1924
1973
|
systemPromptSections
|
|
1925
1974
|
};
|
|
1926
1975
|
}
|
|
1927
|
-
function loadPromptExtensions(paths, projectDir, log) {
|
|
1976
|
+
async function loadPromptExtensions(paths, projectDir, log) {
|
|
1928
1977
|
if (!paths?.length) return [];
|
|
1929
|
-
const
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
}
|
|
1946
|
-
return result;
|
|
1978
|
+
const loaded = await Promise.all(
|
|
1979
|
+
paths.map(async (relPath) => {
|
|
1980
|
+
const absPath = resolve(projectDir, relPath);
|
|
1981
|
+
try {
|
|
1982
|
+
const content = (await withFsDeadline(`readFile ${absPath}`, () => readFile(absPath, "utf-8"))).trim();
|
|
1983
|
+
return content.length > 0 ? { value: content, source: relPath } : null;
|
|
1984
|
+
} catch (err) {
|
|
1985
|
+
log.warn("could not read prompt-extension", {
|
|
1986
|
+
relPath,
|
|
1987
|
+
error: err instanceof Error ? err.message : String(err)
|
|
1988
|
+
});
|
|
1989
|
+
return null;
|
|
1990
|
+
}
|
|
1991
|
+
})
|
|
1992
|
+
);
|
|
1993
|
+
return loaded.filter((e) => e !== null);
|
|
1947
1994
|
}
|
|
1948
1995
|
async function resolveSessionComposition(agentDir, manifest, projectDir, log) {
|
|
1949
1996
|
if (agentDir && manifest?.composes?.length) {
|
|
@@ -2622,6 +2669,10 @@ async function handleResourceRequest(command, manager, emit) {
|
|
|
2622
2669
|
});
|
|
2623
2670
|
}
|
|
2624
2671
|
}
|
|
2672
|
+
var MOUNT_LIST_MAX_DEPTH = 32;
|
|
2673
|
+
var MOUNT_LIST_MAX_ENTRIES = 1e4;
|
|
2674
|
+
var MOUNT_TREE_OP_DEADLINE_FACTOR = 4;
|
|
2675
|
+
var MOUNT_READ_DEADLINE_FACTOR = 4;
|
|
2625
2676
|
function getMimeType(filename) {
|
|
2626
2677
|
return mime.getType(filename) ?? "application/octet-stream";
|
|
2627
2678
|
}
|
|
@@ -2654,9 +2705,23 @@ async function handleMountResourceRequest(command, manager, emit) {
|
|
|
2654
2705
|
case "list": {
|
|
2655
2706
|
const recursive = Boolean(options?.recursive);
|
|
2656
2707
|
const collected = [];
|
|
2657
|
-
const walk = (absDir, relDir) => {
|
|
2658
|
-
|
|
2708
|
+
const walk = async (absDir, relDir, depth) => {
|
|
2709
|
+
if (depth > MOUNT_LIST_MAX_DEPTH) {
|
|
2710
|
+
throw new Error(
|
|
2711
|
+
`Listing "${relDir}" exceeds the maximum depth of ${MOUNT_LIST_MAX_DEPTH} \u2014 narrow the path or list without recursion`
|
|
2712
|
+
);
|
|
2713
|
+
}
|
|
2714
|
+
const dirents = await withFsDeadline(
|
|
2715
|
+
`readdir ${absDir}`,
|
|
2716
|
+
() => readdir(absDir, { withFileTypes: true })
|
|
2717
|
+
);
|
|
2718
|
+
for (const e of dirents) {
|
|
2659
2719
|
if (e.name.startsWith(".")) continue;
|
|
2720
|
+
if (collected.length >= MOUNT_LIST_MAX_ENTRIES) {
|
|
2721
|
+
throw new Error(
|
|
2722
|
+
`Listing exceeds the maximum of ${MOUNT_LIST_MAX_ENTRIES} entries \u2014 ` + (recursive ? "narrow the path or list without recursion" : "narrow the path")
|
|
2723
|
+
);
|
|
2724
|
+
}
|
|
2660
2725
|
const entryRel = relDir ? `${relDir}/${e.name}` : e.name;
|
|
2661
2726
|
const isDir = e.isDirectory();
|
|
2662
2727
|
const result = {
|
|
@@ -2666,21 +2731,30 @@ async function handleMountResourceRequest(command, manager, emit) {
|
|
|
2666
2731
|
};
|
|
2667
2732
|
if (!isDir) {
|
|
2668
2733
|
try {
|
|
2669
|
-
|
|
2670
|
-
|
|
2734
|
+
const st = await withFsDeadline(
|
|
2735
|
+
`stat ${join(absDir, e.name)}`,
|
|
2736
|
+
() => stat(join(absDir, e.name))
|
|
2737
|
+
);
|
|
2738
|
+
result.size = st.size;
|
|
2739
|
+
} catch (statErr) {
|
|
2740
|
+
if (statErr instanceof FsDeadlineError) throw statErr;
|
|
2671
2741
|
}
|
|
2672
2742
|
}
|
|
2673
2743
|
collected.push(result);
|
|
2674
|
-
if (isDir && recursive) walk(join(absDir, e.name), entryRel);
|
|
2744
|
+
if (isDir && recursive) await walk(join(absDir, e.name), entryRel, depth + 1);
|
|
2675
2745
|
}
|
|
2676
2746
|
};
|
|
2677
|
-
walk(targetPath, reqPath ?? "");
|
|
2747
|
+
await walk(targetPath, reqPath ?? "", 0);
|
|
2678
2748
|
data = collected;
|
|
2679
2749
|
break;
|
|
2680
2750
|
}
|
|
2681
2751
|
case "read": {
|
|
2682
2752
|
const contentType = getMimeType(basename(targetPath));
|
|
2683
|
-
const buf =
|
|
2753
|
+
const buf = await withFsDeadline(
|
|
2754
|
+
`readFile ${targetPath}`,
|
|
2755
|
+
() => readFile(targetPath),
|
|
2756
|
+
fsDeadlineMs() * MOUNT_READ_DEADLINE_FACTOR
|
|
2757
|
+
);
|
|
2684
2758
|
let bytes = buf;
|
|
2685
2759
|
const sizeFn = getAuthoritativeSize(entry.handle.state);
|
|
2686
2760
|
if (sizeFn) {
|
|
@@ -2705,22 +2779,27 @@ async function handleMountResourceRequest(command, manager, emit) {
|
|
|
2705
2779
|
break;
|
|
2706
2780
|
}
|
|
2707
2781
|
case "write": {
|
|
2708
|
-
|
|
2782
|
+
const parentDir = dirname(targetPath);
|
|
2783
|
+
await withFsDeadline(`mkdir ${parentDir}`, () => mkdir(parentDir, { recursive: true }));
|
|
2709
2784
|
const writeContent = typeof content === "string" ? content : content?.data ?? "";
|
|
2710
2785
|
const encoding = typeof content === "string" ? void 0 : content?.encoding;
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
}
|
|
2786
|
+
await withFsDeadline(
|
|
2787
|
+
`writeFile ${targetPath}`,
|
|
2788
|
+
() => encoding === "binary" ? writeFile(targetPath, Buffer.from(writeContent, "base64")) : writeFile(targetPath, writeContent, "utf-8")
|
|
2789
|
+
);
|
|
2716
2790
|
data = true;
|
|
2717
2791
|
break;
|
|
2718
2792
|
}
|
|
2719
2793
|
case "delete": {
|
|
2720
|
-
|
|
2721
|
-
|
|
2794
|
+
const st = await withFsDeadline(`stat ${targetPath}`, () => stat(targetPath));
|
|
2795
|
+
if (st.isDirectory()) {
|
|
2796
|
+
await withFsDeadline(
|
|
2797
|
+
`rm -r ${targetPath}`,
|
|
2798
|
+
() => rm(targetPath, { recursive: true, force: true }),
|
|
2799
|
+
fsDeadlineMs() * MOUNT_TREE_OP_DEADLINE_FACTOR
|
|
2800
|
+
);
|
|
2722
2801
|
} else {
|
|
2723
|
-
|
|
2802
|
+
await withFsDeadline(`unlink ${targetPath}`, () => unlink(targetPath));
|
|
2724
2803
|
}
|
|
2725
2804
|
data = true;
|
|
2726
2805
|
break;
|
|
@@ -3546,8 +3625,8 @@ function toPreMinted(token) {
|
|
|
3546
3625
|
function buildSessionResourceHandlers(deps) {
|
|
3547
3626
|
const { getResourceManager, getPreMintedSecrets, emitResourcesAvailable, log, getProjectDir } = deps;
|
|
3548
3627
|
async function add(kind, input) {
|
|
3549
|
-
const
|
|
3550
|
-
if (!
|
|
3628
|
+
const rm2 = getResourceManager();
|
|
3629
|
+
if (!rm2) return { ok: false, code: "no_session", message: "session resources not ready" };
|
|
3551
3630
|
const decl = asDeclaration(input.declaration);
|
|
3552
3631
|
if (!decl) {
|
|
3553
3632
|
return { ok: false, code: "invalid_declaration", message: "declaration missing id/driver" };
|
|
@@ -3561,7 +3640,7 @@ function buildSessionResourceHandlers(deps) {
|
|
|
3561
3640
|
);
|
|
3562
3641
|
}
|
|
3563
3642
|
try {
|
|
3564
|
-
await
|
|
3643
|
+
await rm2.connect(decl);
|
|
3565
3644
|
} catch (err) {
|
|
3566
3645
|
if (input.preMintedToken) {
|
|
3567
3646
|
getPreMintedSecrets()?.unset(kind, decl.id);
|
|
@@ -3598,8 +3677,8 @@ function buildSessionResourceHandlers(deps) {
|
|
|
3598
3677
|
message: `no materialized connector at ${join(root, name)}`
|
|
3599
3678
|
};
|
|
3600
3679
|
}
|
|
3601
|
-
const
|
|
3602
|
-
if (!
|
|
3680
|
+
const rm2 = getResourceManager();
|
|
3681
|
+
if (!rm2) return { ok: false, code: "no_session", message: "session resources not ready" };
|
|
3603
3682
|
if (preMintedToken) {
|
|
3604
3683
|
const ps = getPreMintedSecrets();
|
|
3605
3684
|
if (ps) ps.set("connector", decl.id, toPreMinted(preMintedToken));
|
|
@@ -3609,7 +3688,7 @@ function buildSessionResourceHandlers(deps) {
|
|
|
3609
3688
|
);
|
|
3610
3689
|
}
|
|
3611
3690
|
try {
|
|
3612
|
-
await
|
|
3691
|
+
await rm2.connect(decl);
|
|
3613
3692
|
} catch (err) {
|
|
3614
3693
|
if (preMintedToken) {
|
|
3615
3694
|
getPreMintedSecrets()?.unset("connector", decl.id);
|
|
@@ -3627,13 +3706,13 @@ function buildSessionResourceHandlers(deps) {
|
|
|
3627
3706
|
addMount: (input) => add("mount", input),
|
|
3628
3707
|
attachConnectorInstance,
|
|
3629
3708
|
removeResource: async (input) => {
|
|
3630
|
-
const
|
|
3631
|
-
if (!
|
|
3632
|
-
if (!
|
|
3709
|
+
const rm2 = getResourceManager();
|
|
3710
|
+
if (!rm2) return { ok: false, code: "no_session", message: "session resources not ready" };
|
|
3711
|
+
if (!rm2.has(input.id)) {
|
|
3633
3712
|
return { ok: false, code: "not_found", message: `no resource with id ${input.id}` };
|
|
3634
3713
|
}
|
|
3635
3714
|
try {
|
|
3636
|
-
await
|
|
3715
|
+
await rm2.disconnect(input.id);
|
|
3637
3716
|
} catch (err) {
|
|
3638
3717
|
const message = err instanceof Error ? err.message : String(err);
|
|
3639
3718
|
log(`[session-resource] runner.remove_resource failed for ${input.id}: ${message}`);
|
|
@@ -3649,8 +3728,8 @@ function buildSessionResourceHandlers(deps) {
|
|
|
3649
3728
|
updateCredential: async (input) => {
|
|
3650
3729
|
const ps = getPreMintedSecrets();
|
|
3651
3730
|
if (!ps) return { ok: false, code: "no_session", message: "session resources not ready" };
|
|
3652
|
-
const
|
|
3653
|
-
if (
|
|
3731
|
+
const rm2 = getResourceManager();
|
|
3732
|
+
if (rm2 && !rm2.has(input.id)) {
|
|
3654
3733
|
return { ok: false, code: "not_found", message: `no resource with id ${input.id}` };
|
|
3655
3734
|
}
|
|
3656
3735
|
ps.set(input.kind, input.id, input.mint);
|
|
@@ -3662,29 +3741,48 @@ function buildSessionResourceHandlers(deps) {
|
|
|
3662
3741
|
|
|
3663
3742
|
// runner/src/mcp-runtime-handlers.ts
|
|
3664
3743
|
function buildMcpRuntimeHandlers(deps) {
|
|
3744
|
+
const resolveManager = () => {
|
|
3745
|
+
try {
|
|
3746
|
+
return deps.getOrCreateMcpManager();
|
|
3747
|
+
} catch (err) {
|
|
3748
|
+
deps.log(
|
|
3749
|
+
`[mcp-runtime] MCP manager unavailable: ${err instanceof Error ? err.message : String(err)}`
|
|
3750
|
+
);
|
|
3751
|
+
return null;
|
|
3752
|
+
}
|
|
3753
|
+
};
|
|
3754
|
+
const settleLive = (decl) => {
|
|
3755
|
+
try {
|
|
3756
|
+
deps.registerLiveAttachedMcp(decl);
|
|
3757
|
+
if (deps.driverPicksUpToolsLive()) return true;
|
|
3758
|
+
deps.scheduleDriverRestartForToolChanges(`MCP server '${decl.id}'`);
|
|
3759
|
+
return true;
|
|
3760
|
+
} catch (err) {
|
|
3761
|
+
deps.log(
|
|
3762
|
+
`[mcp-runtime] settling ${decl.id} live failed: ${err instanceof Error ? err.message : String(err)}`
|
|
3763
|
+
);
|
|
3764
|
+
return false;
|
|
3765
|
+
}
|
|
3766
|
+
};
|
|
3665
3767
|
return {
|
|
3666
3768
|
addMcpServer: async (input) => {
|
|
3667
3769
|
const decl = input.declaration;
|
|
3668
3770
|
if (!decl?.id) {
|
|
3669
3771
|
return { ok: false, code: "invalid_declaration", message: "declaration.id is required" };
|
|
3670
3772
|
}
|
|
3671
|
-
const mgr =
|
|
3773
|
+
const mgr = resolveManager();
|
|
3672
3774
|
if (!mgr) return { ok: false, code: "no_session", message: "session resources not ready" };
|
|
3673
3775
|
if (input.preMintedToken) {
|
|
3674
3776
|
deps.getPreMintedSecrets()?.set("mcp", decl.id, toPreMinted(input.preMintedToken));
|
|
3675
3777
|
}
|
|
3676
3778
|
try {
|
|
3677
3779
|
const { toolNames } = await mgr.addServer(decl);
|
|
3780
|
+
const live = settleLive(decl);
|
|
3678
3781
|
deps.emitResourcesAvailable();
|
|
3679
3782
|
deps.log(
|
|
3680
3783
|
`[mcp-runtime] runner.add_mcp_server connected ${decl.id} (${toolNames.length} tools)`
|
|
3681
3784
|
);
|
|
3682
|
-
return {
|
|
3683
|
-
ok: true,
|
|
3684
|
-
id: decl.id,
|
|
3685
|
-
live: deps.driverPicksUpToolsLive(),
|
|
3686
|
-
toolCount: toolNames.length
|
|
3687
|
-
};
|
|
3785
|
+
return { ok: true, id: decl.id, live, toolCount: toolNames.length };
|
|
3688
3786
|
} catch (err) {
|
|
3689
3787
|
deps.getPreMintedSecrets()?.unset("mcp", decl.id);
|
|
3690
3788
|
const message = err instanceof Error ? err.message : String(err);
|
|
@@ -3722,23 +3820,19 @@ function buildMcpRuntimeHandlers(deps) {
|
|
|
3722
3820
|
message: `no materialized mcp-server at ${subDir}`
|
|
3723
3821
|
};
|
|
3724
3822
|
}
|
|
3725
|
-
const mgr =
|
|
3823
|
+
const mgr = resolveManager();
|
|
3726
3824
|
if (!mgr) return { ok: false, code: "no_session", message: "session resources not ready" };
|
|
3727
3825
|
if (input.preMintedToken) {
|
|
3728
3826
|
deps.getPreMintedSecrets()?.set("mcp", decl.id, toPreMinted(input.preMintedToken));
|
|
3729
3827
|
}
|
|
3730
3828
|
try {
|
|
3731
3829
|
const { toolNames } = await mgr.addServer(decl);
|
|
3830
|
+
const live = settleLive(decl);
|
|
3732
3831
|
deps.emitResourcesAvailable();
|
|
3733
3832
|
deps.log(
|
|
3734
3833
|
`[mcp-runtime] runner.attach_instance connected ${decl.id} (${toolNames.length} tools)`
|
|
3735
3834
|
);
|
|
3736
|
-
return {
|
|
3737
|
-
ok: true,
|
|
3738
|
-
id: decl.id,
|
|
3739
|
-
live: deps.driverPicksUpToolsLive(),
|
|
3740
|
-
toolCount: toolNames.length
|
|
3741
|
-
};
|
|
3835
|
+
return { ok: true, id: decl.id, live, toolCount: toolNames.length };
|
|
3742
3836
|
} catch (err) {
|
|
3743
3837
|
if (input.preMintedToken) deps.getPreMintedSecrets()?.unset("mcp", decl.id);
|
|
3744
3838
|
const message = err instanceof Error ? err.message : String(err);
|
|
@@ -3982,6 +4076,8 @@ function wireSessionCapabilities(deps) {
|
|
|
3982
4076
|
getCompactionOrchestrator,
|
|
3983
4077
|
getProjectDir,
|
|
3984
4078
|
attachSkillInstance,
|
|
4079
|
+
registerLiveAttachedMcp,
|
|
4080
|
+
scheduleDriverRestartForToolChanges,
|
|
3985
4081
|
log
|
|
3986
4082
|
} = deps;
|
|
3987
4083
|
capabilityRegistry.setRemoteInvoker(remoteCapabilityInvoker);
|
|
@@ -3996,6 +4092,8 @@ function wireSessionCapabilities(deps) {
|
|
|
3996
4092
|
getOrCreateMcpManager,
|
|
3997
4093
|
getPreMintedSecrets: () => getPreMintedSecrets() ?? null,
|
|
3998
4094
|
driverPicksUpToolsLive,
|
|
4095
|
+
registerLiveAttachedMcp,
|
|
4096
|
+
scheduleDriverRestartForToolChanges,
|
|
3999
4097
|
emitResourcesAvailable,
|
|
4000
4098
|
log,
|
|
4001
4099
|
getProjectDir
|
|
@@ -4236,15 +4334,6 @@ async function buildStoreSnapshotReplay(manager, activeFlows) {
|
|
|
4236
4334
|
}
|
|
4237
4335
|
return events;
|
|
4238
4336
|
}
|
|
4239
|
-
function findAiAssetsRoot(startDir) {
|
|
4240
|
-
let dir = startDir;
|
|
4241
|
-
for (let i = 0; i < 6; i++) {
|
|
4242
|
-
const candidate = join(dir, "ai-assets");
|
|
4243
|
-
if (existsSync(candidate)) return candidate;
|
|
4244
|
-
dir = join(dir, "..");
|
|
4245
|
-
}
|
|
4246
|
-
return null;
|
|
4247
|
-
}
|
|
4248
4337
|
function ensureGitConfigInclude(managedGitconfigPath) {
|
|
4249
4338
|
const home = process.env.HOME ?? homedir();
|
|
4250
4339
|
if (!home) return;
|
|
@@ -5031,7 +5120,11 @@ async function startAgentServer(opts) {
|
|
|
5031
5120
|
...aiProviderConfigId ? { aiProviderConfigId } : {},
|
|
5032
5121
|
// Disk-first fallback: only consumed when skaile.yaml + materialized
|
|
5033
5122
|
// assets yield zero connector declarations (broker mode has no yaml).
|
|
5034
|
-
...fallbackConnectorDeclarations?.length ? { fallbackConnectorDeclarations } : {}
|
|
5123
|
+
...fallbackConnectorDeclarations?.length ? { fallbackConnectorDeclarations } : {},
|
|
5124
|
+
// Read per session build, not snapshotted here: this config object is
|
|
5125
|
+
// built once and reused for every recreate, and a server may be attached
|
|
5126
|
+
// at any point after that.
|
|
5127
|
+
getExtraMcpDeclarations: () => [...liveAttachedMcpDeclarations.values()]
|
|
5035
5128
|
};
|
|
5036
5129
|
}
|
|
5037
5130
|
let resolveSessionReady;
|
|
@@ -5045,6 +5138,7 @@ async function startAgentServer(opts) {
|
|
|
5045
5138
|
let secretProvider;
|
|
5046
5139
|
let runtimeIdentity;
|
|
5047
5140
|
let preMintedSecrets;
|
|
5141
|
+
const liveAttachedMcpDeclarations = /* @__PURE__ */ new Map();
|
|
5048
5142
|
let wireAgentConfig;
|
|
5049
5143
|
let appliedWireAgentConfigKey;
|
|
5050
5144
|
const stagedSkillDirs = /* @__PURE__ */ new Set();
|
|
@@ -5063,7 +5157,7 @@ async function startAgentServer(opts) {
|
|
|
5063
5157
|
}
|
|
5064
5158
|
});
|
|
5065
5159
|
if (declared.length === 0) return;
|
|
5066
|
-
const staged = stageMaterializedSkills(opts.projectDir, skillsDir, { declared });
|
|
5160
|
+
const staged = await stageMaterializedSkills(opts.projectDir, skillsDir, { declared });
|
|
5067
5161
|
const newlyStaged = staged.filter((s) => !stagedSkillDirs.has(s));
|
|
5068
5162
|
for (const s of staged) stagedSkillDirs.add(s);
|
|
5069
5163
|
if (newlyStaged.length === 0) return;
|
|
@@ -5084,6 +5178,10 @@ async function startAgentServer(opts) {
|
|
|
5084
5178
|
const servers = agentSession?.getExternalMcpManager()?.listServers() ?? [];
|
|
5085
5179
|
bakedMcpServerIds = new Set(servers.map((s) => s.id));
|
|
5086
5180
|
};
|
|
5181
|
+
const registerLiveAttachedMcp = (decl) => {
|
|
5182
|
+
liveAttachedMcpDeclarations.set(decl.id, decl);
|
|
5183
|
+
bakedMcpServerIds = /* @__PURE__ */ new Set([...bakedMcpServerIds, decl.id]);
|
|
5184
|
+
};
|
|
5087
5185
|
if (secretsMode === "provisioned") {
|
|
5088
5186
|
log("[serve] secrets mode: provisioned \u2014 waiting for provision_secrets command");
|
|
5089
5187
|
} else {
|
|
@@ -5206,6 +5304,7 @@ async function startAgentServer(opts) {
|
|
|
5206
5304
|
}
|
|
5207
5305
|
let driverStarted = false;
|
|
5208
5306
|
const driverSwapGate = new DriverSwapGate();
|
|
5307
|
+
let driverRestartChain = Promise.resolve();
|
|
5209
5308
|
let driver = secretsMode === "env" ? agentSession.driver : void 0;
|
|
5210
5309
|
let secretsProvisioned = secretsMode === "env";
|
|
5211
5310
|
function swapDriver() {
|
|
@@ -5617,6 +5716,8 @@ async function startAgentServer(opts) {
|
|
|
5617
5716
|
getCompactionOrchestrator: () => compactionOrchestrator,
|
|
5618
5717
|
getProjectDir: () => opts.projectDir,
|
|
5619
5718
|
attachSkillInstance,
|
|
5719
|
+
registerLiveAttachedMcp,
|
|
5720
|
+
scheduleDriverRestartForToolChanges,
|
|
5620
5721
|
log
|
|
5621
5722
|
});
|
|
5622
5723
|
return { needsWireFallbackRecreate, needsWireAgentConfigRecreate };
|
|
@@ -5774,9 +5875,9 @@ async function startAgentServer(opts) {
|
|
|
5774
5875
|
log(`[serve] aiResources catalog actions: ${catalogActions.length}`);
|
|
5775
5876
|
try {
|
|
5776
5877
|
const skillsDir = join(sessionConfig.projectDir ?? process.cwd(), ".claude", "skills");
|
|
5777
|
-
const assetsRoot = process.env.SKAILE_ASSETS_ROOT ?? findAiAssetsRoot(sessionConfig.projectDir ?? process.cwd()) ?? "/app/ai-assets";
|
|
5878
|
+
const assetsRoot = process.env.SKAILE_ASSETS_ROOT ?? await findAiAssetsRoot(sessionConfig.projectDir ?? process.cwd()) ?? "/app/ai-assets";
|
|
5778
5879
|
for (const res of catalogActions) {
|
|
5779
|
-
applyCatalogAction(res, { assetsRoot, skillsDir });
|
|
5880
|
+
await applyCatalogAction(res, { assetsRoot, skillsDir });
|
|
5780
5881
|
}
|
|
5781
5882
|
await restartDriverForSkillChanges(catalogActions);
|
|
5782
5883
|
} catch (err) {
|
|
@@ -5789,10 +5890,10 @@ async function startAgentServer(opts) {
|
|
|
5789
5890
|
});
|
|
5790
5891
|
}
|
|
5791
5892
|
}
|
|
5792
|
-
function applyCatalogAction(res, paths) {
|
|
5893
|
+
async function applyCatalogAction(res, paths) {
|
|
5793
5894
|
if (res.action === "add" && res.entry) {
|
|
5794
5895
|
const entry = res.entry;
|
|
5795
|
-
const result = deployCatalogEntry(entry, {
|
|
5896
|
+
const result = await deployCatalogEntry(entry, {
|
|
5796
5897
|
assetsRoot: paths.assetsRoot,
|
|
5797
5898
|
skillsDir: paths.skillsDir,
|
|
5798
5899
|
context: res.context
|
|
@@ -5805,7 +5906,7 @@ async function startAgentServer(opts) {
|
|
|
5805
5906
|
);
|
|
5806
5907
|
}
|
|
5807
5908
|
} else if (res.action === "remove") {
|
|
5808
|
-
const removed = undeployCatalogEntry(res.name, paths.skillsDir);
|
|
5909
|
+
const removed = await undeployCatalogEntry(res.name, paths.skillsDir);
|
|
5809
5910
|
log(`[serve] ${removed ? "removed" : "not found"} skill: ${res.name}`);
|
|
5810
5911
|
}
|
|
5811
5912
|
}
|
|
@@ -5814,7 +5915,7 @@ async function startAgentServer(opts) {
|
|
|
5814
5915
|
const { skillsDir } = resolveDriverPaths({
|
|
5815
5916
|
driver: opts.driver ?? wsConfig.agent_config?.default?.driver ?? wireAgentConfig?.driver ?? "claude-sdk"
|
|
5816
5917
|
});
|
|
5817
|
-
const staged = stageMaterializedSkills(opts.projectDir, skillsDir, {
|
|
5918
|
+
const staged = await stageMaterializedSkills(opts.projectDir, skillsDir, {
|
|
5818
5919
|
declared: [name]
|
|
5819
5920
|
});
|
|
5820
5921
|
if (staged.length === 0) {
|
|
@@ -5836,14 +5937,32 @@ async function startAgentServer(opts) {
|
|
|
5836
5937
|
};
|
|
5837
5938
|
}
|
|
5838
5939
|
}
|
|
5839
|
-
async function
|
|
5940
|
+
async function restartDriverForToolChanges(reason) {
|
|
5840
5941
|
if (!driverStarted) {
|
|
5841
|
-
log(
|
|
5942
|
+
log(`[serve] ${reason} applied before driver start \u2014 picked up on the first prompt`);
|
|
5842
5943
|
return;
|
|
5843
5944
|
}
|
|
5844
5945
|
const prevSessionId = driver.runtimeSessionId;
|
|
5845
|
-
log(`[serve] restarting driver to pick up
|
|
5946
|
+
log(`[serve] restarting driver to pick up ${reason} (resume=${prevSessionId ?? "none"})`);
|
|
5846
5947
|
await recreateAgentSession({ resumeSessionId: prevSessionId });
|
|
5948
|
+
}
|
|
5949
|
+
function enqueueDriverRestart(reason) {
|
|
5950
|
+
const next = driverRestartChain.then(() => restartDriverForToolChanges(reason));
|
|
5951
|
+
driverRestartChain = next.catch(() => {
|
|
5952
|
+
});
|
|
5953
|
+
return next;
|
|
5954
|
+
}
|
|
5955
|
+
function scheduleDriverRestartForToolChanges(reason) {
|
|
5956
|
+
void enqueueDriverRestart(reason).catch((err) => {
|
|
5957
|
+
log(
|
|
5958
|
+
`[serve] background driver restart for ${reason} failed: ${err instanceof Error ? err.message : String(err)}`
|
|
5959
|
+
);
|
|
5960
|
+
});
|
|
5961
|
+
}
|
|
5962
|
+
async function restartDriverForSkillChanges(catalogActions) {
|
|
5963
|
+
const restarted = driverStarted;
|
|
5964
|
+
await enqueueDriverRestart("skill changes");
|
|
5965
|
+
if (!restarted) return;
|
|
5847
5966
|
sendEvent({
|
|
5848
5967
|
type: "skills_changed",
|
|
5849
5968
|
skills: catalogActions.map((a) => ({
|
|
@@ -6566,6 +6685,6 @@ function touchSession(state) {
|
|
|
6566
6685
|
return { ...state, updatedAt: (/* @__PURE__ */ new Date()).toISOString() };
|
|
6567
6686
|
}
|
|
6568
6687
|
|
|
6569
|
-
export { CLAUDE_CODE_CREDENTIALS_KEY, COMPILE_MANIFEST_FILENAME, CapabilityRegistry, DEFAULT_CAPABILITY_CALL_TIMEOUT_MS, DEFAULT_COALESCE_MS, DEFAULT_FLOW_MUTATE_CONNECTOR_WAIT_MS, MarkdownStreamer, PreInitRingSink, agentDefinitionExists, bootstrapCapabilityRegistry, bootstrapRunnerLogStore, buildAgentResources, buildClientCapabilityHandler, buildConnectorTokenMediator, buildContextSection, buildEnvironmentSection, buildResourcesAvailablePayload, buildStoreSnapshotReplay, builtinCapabilities, capabilityLogInstance, clearPreInitRingSink, clearSession, compileComposition, computeCapabilitySignature, connectorRefreshKind, createAgentSession, createFlowConnectorReadiness, createSessionStimulusBus, defineCapability, deleteSession, dispatchRunnerCapabilityInvocation, emitSystemPromptComposed, ensureGitConfigInclude, executeConnectorMutate, extractClaudeAiOauthExpiresAt, getPreInitRingSink, handleMountResourceRequest, handleResourceRequest, hasNonTerminalFlow, hostOpResumeStimulus, installPreInitRingSink, isTerminalFlowStatus, listSessions, loadAgentManifest, loadCompileManifest, loadCompileManifestFromDir, loadSession, loadSessionById, mcpAuthSecretKey, newSession, pickRepointedManager, planFlowMutate, reconcilePendingDecisions, registerActiveFlow, registerCompositionCapabilities, rejectCapabilityOnApprovalDeny, resetRunnerLogStore, resolveAgentComposition, resolveAgentMixins, resolveBinding, resolveCapabilityCallTimeoutMs, resolveCapabilityResult, resolveComposition, resolveFlowMutateConnectorWaitMs, resolveMixin, runAgentChat, saveSession, setCurrentSession, startAgentServer, stimulusFromMetas, touchSession, validateInputResponse, writeClaudeCodeCredentialsFile };
|
|
6570
|
-
//# sourceMappingURL=chunk-
|
|
6571
|
-
//# sourceMappingURL=chunk-
|
|
6688
|
+
export { CLAUDE_CODE_CREDENTIALS_KEY, COMPILE_MANIFEST_FILENAME, CapabilityRegistry, DEFAULT_CAPABILITY_CALL_TIMEOUT_MS, DEFAULT_COALESCE_MS, DEFAULT_FLOW_MUTATE_CONNECTOR_WAIT_MS, MOUNT_LIST_MAX_DEPTH, MOUNT_LIST_MAX_ENTRIES, MOUNT_READ_DEADLINE_FACTOR, MOUNT_TREE_OP_DEADLINE_FACTOR, MarkdownStreamer, PreInitRingSink, agentDefinitionExists, bootstrapCapabilityRegistry, bootstrapRunnerLogStore, buildAgentResources, buildClientCapabilityHandler, buildConnectorTokenMediator, buildContextSection, buildEnvironmentSection, buildResourcesAvailablePayload, buildStoreSnapshotReplay, builtinCapabilities, capabilityLogInstance, clearPreInitRingSink, clearSession, compileComposition, computeCapabilitySignature, connectorRefreshKind, createAgentSession, createFlowConnectorReadiness, createSessionStimulusBus, defineCapability, deleteSession, dispatchRunnerCapabilityInvocation, emitSystemPromptComposed, ensureGitConfigInclude, executeConnectorMutate, extractClaudeAiOauthExpiresAt, getPreInitRingSink, handleMountResourceRequest, handleResourceRequest, hasNonTerminalFlow, hostOpResumeStimulus, installPreInitRingSink, isTerminalFlowStatus, listSessions, loadAgentManifest, loadCompileManifest, loadCompileManifestFromDir, loadSession, loadSessionById, mcpAuthSecretKey, newSession, pickRepointedManager, planFlowMutate, reconcilePendingDecisions, registerActiveFlow, registerCompositionCapabilities, rejectCapabilityOnApprovalDeny, resetRunnerLogStore, resolveAgentComposition, resolveAgentMixins, resolveBinding, resolveCapabilityCallTimeoutMs, resolveCapabilityResult, resolveComposition, resolveFlowMutateConnectorWaitMs, resolveMixin, runAgentChat, saveSession, setCurrentSession, startAgentServer, stimulusFromMetas, touchSession, validateInputResponse, writeClaudeCodeCredentialsFile };
|
|
6689
|
+
//# sourceMappingURL=chunk-WZPADAE7.js.map
|
|
6690
|
+
//# sourceMappingURL=chunk-WZPADAE7.js.map
|