@skaile/workspaces 5.8.0 → 5.9.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 +6 -0
- package/dist/app-sdk/index.js +1 -1
- package/dist/{asset-feeds-EYRZR4K5.js → asset-feeds-XMKKUUK6.js} +4 -4
- package/dist/{asset-feeds-EYRZR4K5.js.map → asset-feeds-XMKKUUK6.js.map} +1 -1
- package/dist/asset-manager/index.js +1 -1
- package/dist/bridge/drivers/claude-sdk.js +161 -8
- package/dist/bridge/drivers/claude-sdk.js.map +1 -1
- package/dist/bridge/drivers/codex.js +4 -2
- package/dist/bridge/drivers/codex.js.map +1 -1
- package/dist/bridge/drivers/continue.js +3 -3
- package/dist/bridge/drivers/echo.js +3 -3
- package/dist/bridge/drivers/gemini.js +5 -5
- package/dist/bridge/drivers/goose.js +3 -3
- package/dist/bridge/drivers/omp.js +6 -4
- package/dist/bridge/drivers/omp.js.map +1 -1
- package/dist/bridge/drivers/opencode.js +3 -3
- package/dist/bridge/drivers/qwen.js +5 -5
- package/dist/bridge/index.js +5 -5
- package/dist/bridge/src/codex/managed-driver.d.ts.map +1 -1
- package/dist/bridge/src/drivers/claude-sdk.d.ts +31 -1
- package/dist/bridge/src/drivers/claude-sdk.d.ts.map +1 -1
- package/dist/bridge/src/drivers/claude-tool-allowlist.d.ts +43 -0
- package/dist/bridge/src/drivers/claude-tool-allowlist.d.ts.map +1 -0
- package/dist/bridge/src/drivers/omp.d.ts.map +1 -1
- package/dist/bridge/src/types.d.ts +20 -1
- package/dist/bridge/src/types.d.ts.map +1 -1
- package/dist/{chunk-GCICGXDD.js → chunk-2H73V6XR.js} +3 -3
- package/dist/{chunk-GCICGXDD.js.map → chunk-2H73V6XR.js.map} +1 -1
- package/dist/{chunk-AWQYXZVG.js → chunk-5NNNV76P.js} +28 -4
- package/dist/chunk-5NNNV76P.js.map +1 -0
- package/dist/{chunk-P23M65LB.js → chunk-7AI3Q5AQ.js} +6 -6
- package/dist/{chunk-P23M65LB.js.map → chunk-7AI3Q5AQ.js.map} +1 -1
- package/dist/{chunk-IONAUNWB.js → chunk-DNZYOKOJ.js} +3 -3
- package/dist/{chunk-IONAUNWB.js.map → chunk-DNZYOKOJ.js.map} +1 -1
- package/dist/{chunk-F3RDEH5U.js → chunk-F4NJDSR7.js} +6 -5
- package/dist/chunk-F4NJDSR7.js.map +1 -0
- package/dist/{chunk-SH5D7U7N.js → chunk-FYXZRVID.js} +3 -3
- package/dist/{chunk-SH5D7U7N.js.map → chunk-FYXZRVID.js.map} +1 -1
- package/dist/{chunk-GXXFLBUQ.js → chunk-GKMZ6THE.js} +6 -6
- package/dist/{chunk-GXXFLBUQ.js.map → chunk-GKMZ6THE.js.map} +1 -1
- package/dist/{chunk-HYDRDNKN.js → chunk-GXLQLPE5.js} +3 -3
- package/dist/{chunk-HYDRDNKN.js.map → chunk-GXLQLPE5.js.map} +1 -1
- package/dist/{chunk-H7QUDDKH.js → chunk-IMKSM5NL.js} +2 -2
- package/dist/{chunk-H7QUDDKH.js.map → chunk-IMKSM5NL.js.map} +1 -1
- package/dist/{chunk-LSXHED6I.js → chunk-IR33D6EP.js} +4 -4
- package/dist/{chunk-LSXHED6I.js.map → chunk-IR33D6EP.js.map} +1 -1
- package/dist/{chunk-PTSGWKHR.js → chunk-J7U3PIOE.js} +3 -3
- package/dist/{chunk-PTSGWKHR.js.map → chunk-J7U3PIOE.js.map} +1 -1
- package/dist/{chunk-F2EKONM7.js → chunk-JZ5EHBPI.js} +3 -3
- package/dist/{chunk-F2EKONM7.js.map → chunk-JZ5EHBPI.js.map} +1 -1
- package/dist/{chunk-OFBIWVCR.js → chunk-K3CVFRVS.js} +3 -3
- package/dist/{chunk-OFBIWVCR.js.map → chunk-K3CVFRVS.js.map} +1 -1
- package/dist/{chunk-LEMHVDET.js → chunk-LAMCXQGA.js} +165 -17
- package/dist/chunk-LAMCXQGA.js.map +1 -0
- package/dist/{chunk-6GRX5L6A.js → chunk-MR5HBOUF.js} +4 -4
- package/dist/{chunk-6GRX5L6A.js.map → chunk-MR5HBOUF.js.map} +1 -1
- package/dist/{chunk-HG34RNTK.js → chunk-P67WJVP4.js} +3 -3
- package/dist/{chunk-HG34RNTK.js.map → chunk-P67WJVP4.js.map} +1 -1
- package/dist/{chunk-QOP6KDFR.js → chunk-QVEKLSEH.js} +6 -6
- package/dist/{chunk-QOP6KDFR.js.map → chunk-QVEKLSEH.js.map} +1 -1
- package/dist/{chunk-NPLPCRW5.js → chunk-SCOT677Q.js} +4 -4
- package/dist/{chunk-NPLPCRW5.js.map → chunk-SCOT677Q.js.map} +1 -1
- package/dist/{chunk-FTJJO3EM.js → chunk-TTRYE6AC.js} +7 -7
- package/dist/{chunk-FTJJO3EM.js.map → chunk-TTRYE6AC.js.map} +1 -1
- package/dist/{chunk-ZKSJMZKD.js → chunk-UM7RIAHO.js} +3 -3
- package/dist/{chunk-ZKSJMZKD.js.map → chunk-UM7RIAHO.js.map} +1 -1
- package/dist/{chunk-BJNUNQAW.js → chunk-UO7WPLDY.js} +3 -3
- package/dist/{chunk-BJNUNQAW.js.map → chunk-UO7WPLDY.js.map} +1 -1
- package/dist/{chunk-CIFS5K6T.js → chunk-VMKMFS2Q.js} +28 -7
- package/dist/chunk-VMKMFS2Q.js.map +1 -0
- package/dist/{chunk-WTQ3TATB.js → chunk-X4BAYGMT.js} +3 -3
- package/dist/{chunk-WTQ3TATB.js.map → chunk-X4BAYGMT.js.map} +1 -1
- package/dist/{chunk-OJ4N4T4H.js → chunk-XDVR7QIT.js} +20 -6
- package/dist/chunk-XDVR7QIT.js.map +1 -0
- package/dist/{chunk-I6NLLJHZ.js → chunk-ZTBAYUDY.js} +2 -2
- package/dist/{chunk-I6NLLJHZ.js.map → chunk-ZTBAYUDY.js.map} +1 -1
- package/dist/cli/index.js +38 -38
- package/dist/client/index.js +1 -1
- package/dist/client/src/client.d.ts +10 -3
- package/dist/client/src/client.d.ts.map +1 -1
- package/dist/connectors/index.js +7 -7
- package/dist/{connectors-O6Y6VESP.js → connectors-C7UQ73BK.js} +10 -10
- package/dist/{connectors-O6Y6VESP.js.map → connectors-C7UQ73BK.js.map} +1 -1
- package/dist/connectors-shared/index.js +2 -2
- package/dist/{ensure-sources-SKLNM4UZ.js → ensure-sources-SRC2DVR5.js} +4 -4
- package/dist/{ensure-sources-SKLNM4UZ.js.map → ensure-sources-SRC2DVR5.js.map} +1 -1
- package/dist/factory-assets/connectors/box.js +7 -7
- package/dist/factory-assets/connectors/deploy.js +7 -7
- package/dist/factory-assets/connectors/devserver.js +7 -7
- package/dist/factory-assets/connectors/flow/adapter.js +7 -7
- package/dist/factory-assets/connectors/flow/run-flow.js +8 -8
- package/dist/factory-assets/connectors/flow.js +7 -7
- package/dist/factory-assets/connectors/git.js +7 -7
- package/dist/factory-assets/connectors/gmail.js +7 -7
- package/dist/factory-assets/connectors/googledrive.js +7 -7
- package/dist/factory-assets/connectors/local.js +7 -7
- package/dist/factory-assets/connectors/mattermost.js +7 -7
- package/dist/factory-assets/connectors/memory.js +7 -7
- package/dist/factory-assets/connectors/minio.js +7 -7
- package/dist/factory-assets/connectors/postgres.js +7 -7
- package/dist/factory-assets/connectors/s3.js +7 -7
- package/dist/factory-assets/connectors/sharepoint.js +7 -7
- package/dist/factory-assets/connectors/sqlite.js +7 -7
- package/dist/factory-assets/connectors/static-server.js +7 -7
- package/dist/factory-assets/connectors/tunnel.js +7 -7
- package/dist/factory-assets/connectors/webdav.js +7 -7
- package/dist/factory-assets/connectors/xstate-store.js +7 -7
- package/dist/factory-assets/connectors/xstate.js +7 -7
- package/dist/{helpers-MWZDRBLD.js → helpers-XAEKCZKT.js} +4 -4
- package/dist/{helpers-MWZDRBLD.js.map → helpers-XAEKCZKT.js.map} +1 -1
- package/dist/{library-publish-PICMDSB2.js → library-publish-VJSWMOLH.js} +7 -7
- package/dist/{library-publish-PICMDSB2.js.map → library-publish-VJSWMOLH.js.map} +1 -1
- package/dist/{open-library-OG457THY.js → open-library-DB2PNL2X.js} +5 -5
- package/dist/{open-library-OG457THY.js.map → open-library-DB2PNL2X.js.map} +1 -1
- package/dist/{project-2GFT5LEZ.js → project-I6NX3NFB.js} +5 -5
- package/dist/{project-2GFT5LEZ.js.map → project-I6NX3NFB.js.map} +1 -1
- package/dist/runner/index.js +12 -12
- package/dist/runner/src/context-usage/compose.d.ts.map +1 -1
- package/dist/runner/src/platform-blocks.d.ts +55 -0
- package/dist/runner/src/platform-blocks.d.ts.map +1 -0
- package/dist/runner/src/serve.d.ts.map +1 -1
- package/dist/runner/src/session-builder.d.ts.map +1 -1
- package/dist/sdk/asset-manager.js +1 -1
- package/dist/sdk/bridge.js +5 -5
- package/dist/sdk/client.js +1 -1
- package/dist/sdk/index.js +13 -13
- package/dist/sdk/runner.js +12 -12
- package/dist/sdk/session.js +2 -2
- package/dist/sdk/types.js +1 -1
- package/dist/session/index.js +2 -2
- package/dist/session/src/dispatcher.d.ts +25 -4
- package/dist/session/src/dispatcher.d.ts.map +1 -1
- package/dist/session/src/index.d.ts +1 -1
- package/dist/session/src/index.d.ts.map +1 -1
- package/dist/{setup-WHMCSIF2.js → setup-B7JUHYJW.js} +10 -10
- package/dist/{setup-WHMCSIF2.js.map → setup-B7JUHYJW.js.map} +1 -1
- package/dist/{source-LKOFTOEK.js → source-PJBMDCKX.js} +6 -6
- package/dist/{source-LKOFTOEK.js.map → source-PJBMDCKX.js.map} +1 -1
- package/dist/{source-manifest-publish-L5J3QXER.js → source-manifest-publish-LLJWXGID.js} +8 -8
- package/dist/{source-manifest-publish-L5J3QXER.js.map → source-manifest-publish-LLJWXGID.js.map} +1 -1
- package/dist/tui/index.js +12 -12
- package/dist/types/index.js +1 -1
- package/dist/types/src/events.d.ts +1 -1
- package/dist/types/src/events.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +2 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/protocol.d.ts +43 -1
- package/dist/types/src/protocol.d.ts.map +1 -1
- package/dist/types/src/version.d.ts +17 -1
- package/dist/types/src/version.d.ts.map +1 -1
- package/dist/workspace-plugin/adapters/mcp.js +9 -9
- package/dist/workspace-plugin/adapters/omp.js +7 -7
- package/dist/workspace-plugin/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-AWQYXZVG.js.map +0 -1
- package/dist/chunk-CIFS5K6T.js.map +0 -1
- package/dist/chunk-F3RDEH5U.js.map +0 -1
- package/dist/chunk-LEMHVDET.js.map +0 -1
- package/dist/chunk-OJ4N4T4H.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 5.9.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#1048](https://github.com/skaile-ai/workspaces/pull/1048) [`dde2065`](https://github.com/skaile-ai/workspaces/commit/dde20655e419552b9a2dc46bfaf26b758e0cc188) Thanks [@peteralbert](https://github.com/peteralbert)! - Typed platform blocks and a per-turn tool allowlist on the `prompt` command (protocol 4.18.0, runtime feature `platformBlocks.v1`). A host can attach `platformBlocks` (`{ kind, id, text, attrs? }`, kinds `platform_notice`, `skaile_research`, `platform_research_complete`) and a `toolAllowlist` to a prompt. The runner renders the blocks in reserved tags (`<PLATFORM_NOTICE>`, `<SKAILE_RESEARCH>`, `<PLATFORM_RESEARCH_COMPLETE>`) at the very start of the turn, each block id once per runner process, and escapes those tag names everywhere else it hands text to the agent (prompt text, a reply, a flow turn), so a message that imitates a platform block reaches the model visibly escaped. A new system-prompt section (`platform-blocks`) tells the agent that only those tags at the start of a turn come from Skaile. With a `toolAllowlist`, the Claude SDK driver lets that turn, and every subagent it starts, call only the listed tools, enforced in a `PreToolUse` hook because the query runs under `bypassPermissions`. A driver that cannot enforce an allowlist (every other built-in), an unknown tool name, or a flow-routed prompt refuses the prompt with a non-fatal `error` (`category: "validation"`) instead of running it unrestricted. `AgentClient.prompt` takes `{ platformBlocks, toolAllowlist }`, and a `SessionDispatcher` `transformPrompt` may return `{ prompt, platformBlocks, toolAllowlist }`. The runner now lists `platformBlocks.v1` in `protocol_info.runtimeFeatures` on every host.
|
|
8
|
+
|
|
3
9
|
## 5.8.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
package/dist/app-sdk/index.js
CHANGED
|
@@ -51,7 +51,7 @@ function libraryEntryOf(asset) {
|
|
|
51
51
|
async function libraryAssets() {
|
|
52
52
|
const notes = [];
|
|
53
53
|
try {
|
|
54
|
-
const { openLibraryManager } = await import('./open-library-
|
|
54
|
+
const { openLibraryManager } = await import('./open-library-DB2PNL2X.js');
|
|
55
55
|
const { getKindRegistry } = await import('./open-registry-ZUZJ7MS7.js');
|
|
56
56
|
const { scanAuthoringLibraries } = await import('./library/index.js');
|
|
57
57
|
const { library: index, close } = await openLibraryManager();
|
|
@@ -85,7 +85,7 @@ async function libraryAssets() {
|
|
|
85
85
|
async function storeAssets(projectDir) {
|
|
86
86
|
const notes = [];
|
|
87
87
|
try {
|
|
88
|
-
const { resolveCatalogSource } = await import('./open-library-
|
|
88
|
+
const { resolveCatalogSource } = await import('./open-library-DB2PNL2X.js');
|
|
89
89
|
const { source, close } = await resolveCatalogSource({ projectDir });
|
|
90
90
|
try {
|
|
91
91
|
const assets = await source.listAssets();
|
|
@@ -164,5 +164,5 @@ async function gatherAssetFeeds(am, projectDir) {
|
|
|
164
164
|
}
|
|
165
165
|
|
|
166
166
|
export { gatherAssetFeeds };
|
|
167
|
-
//# sourceMappingURL=asset-feeds-
|
|
168
|
-
//# sourceMappingURL=asset-feeds-
|
|
167
|
+
//# sourceMappingURL=asset-feeds-XMKKUUK6.js.map
|
|
168
|
+
//# sourceMappingURL=asset-feeds-XMKKUUK6.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../cli/src/asset-feeds.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuEA,SAAS,eAAe,KAAA,EAA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AAAA,MACH,GAAG,IAAA,CAAK,OAAA;AAAA,MACR,GAAG,GAAA,CAAI,SAAA,EAAW,OAAA,CAAQ,OAAO,CAAA;AAAA,MACjC,GAAG,GAAA,CAAI,OAAA,EAAS,KAAA,CAAM,OAAO;AAAA,KAC/B;AAAA,IACA,KAAA,EAAO,CAAC,GAAG,IAAA,CAAK,KAAA,EAAO,GAAG,KAAA,CAAM,KAAA,EAAO,GAAG,OAAA,CAAQ,KAAK;AAAA,GACzD;AACF","file":"asset-feeds-EYRZR4K5.js","sourcesContent":["/**\n * asset-feeds.ts — gather installable assets from every feed the manage TUI\n * surfaces.\n *\n * Four feeds, normalized into `CatalogEntry`:\n * - **Project sources** — `skaile.yaml` `sources:` entries (scanned via\n * `AssetManager.search()`; the new `sources:` field is merged into the\n * legacy repositories map in `AssetManager.loadConfig`).\n * - **Local libraries** — user authoring places from `LocalIndex`, read through\n * `scanAuthoringLibraries` (`@skaile/workspaces/library`): the same scan\n * `library index` / `search --local` use, so publishers and refs match them\n * (per-asset `publisher_overrides` honoured), `dev_paths` assets are left out,\n * and a library that fails to scan becomes one note while the rest stay listed.\n * - **Factory assets** — the bundled first-party `factory-assets` tree\n * (`factoryAssetRoots()`), scanned from disk. Always present; no network.\n * - **Remote store** — the configured catalog source when `catalog.url` is\n * not `local`. Failures are non-fatal — they surface as notes.\n */\n\nimport * as path from \"node:path\";\nimport {\n type AssetKind,\n type CatalogEntry,\n factoryAssetRoots,\n parseRequires,\n scanRepo,\n} from \"@skaile/workspaces/core\";\nimport { getKnownKinds } from \"./open-registry.ts\";\nimport type { DiscoveredAsset } from \"@skaile/workspaces/discovery\";\n\n/** One non-fatal note returned to the caller for surfacing in the UI. */\nexport interface FeedNote {\n feed: \"sources\" | \"libraries\" | \"store\" | \"factory\";\n message: string;\n}\n\n/**\n * Which feed an asset came from. This is the top-level grouping axis in the\n * manage TUI (\"where is this skill coming from?\") and is intentionally distinct\n * from `publisher` (asset-intrinsic identity): the same publisher can legitimately\n * appear under more than one origin (e.g. a github repo you added as a `source`\n * that is also listed in the remote `store`).\n */\nexport type AssetOrigin = \"source\" | \"library\" | \"factory\" | \"store\";\n\n/** A catalog entry tagged with the feed it was gathered from. */\nexport interface OriginEntry {\n origin: AssetOrigin;\n entry: CatalogEntry;\n /**\n * Second-level grouping label for the manage tree. Defaults (when unset) to the\n * entry's `publisher`; the source feed sets it to the source's short repo name\n * so the Sources band groups by source — \"which repo did this come from\" — not\n * by the asset-intrinsic publisher.\n */\n group?: string;\n}\n\nexport interface AssetFeedResult {\n entries: OriginEntry[];\n notes: FeedNote[];\n}\n\n/**\n * Map one discovered library asset to the `CatalogEntry` the manage rows read.\n * `publisher` is the bare per-asset publisher (what `search --local` prints),\n * `source` the manifest path. `repo` is left unset: it only feeds the Sources-tree\n * org grouping. `requires` / `dependencies` come from the manifest the way the\n * scanner fills them — string `requires:` refs parsed to `{kind, name}`, a bundle's\n * string `dependencies:` list verbatim.\n */\nfunction libraryEntryOf(asset: DiscoveredAsset): CatalogEntry {\n const { manifest } = asset;\n const nested = (manifest.metadata as Record<string, unknown> | undefined)?.requires;\n const rawRequires = manifest.requires ?? nested;\n const requireRefs =\n typeof rawRequires === \"string\"\n ? rawRequires\n : Array.isArray(rawRequires)\n ? rawRequires.filter((r): r is string => typeof r === \"string\")\n : undefined;\n const deps = manifest.dependencies;\n return {\n name: asset.name,\n kind: asset.kind as AssetKind,\n description: typeof manifest.description === \"string\" ? manifest.description : \"\",\n source: asset.manifestPath,\n publisher: asset.publisher,\n ...(asset.plugin ? { plugin: asset.plugin } : {}),\n version: asset.version,\n requires: requireRefs === undefined ? [] : parseRequires({ requires: requireRefs }),\n dependencies:\n asset.kind === \"bundle\" && Array.isArray(deps)\n ? deps.filter((d): d is string => typeof d === \"string\" && d.length > 0)\n : [],\n };\n}\n\n/**\n * Pull assets from local libraries (the authoring places under\n * `~/.skaile/libraries/<name>/`, not the `~/.skaile/cache/sources/` cache) through\n * `scanAuthoringLibraries`, grouped under the bare library name\n * (`group: <name>`) so the manage TUI shows a clean `<name>` band — no\n * `library:` prefix (mirrors the source feed). Plugin grouping (`entry.plugin`)\n * comes from `DiscoveredAsset.plugin`. A library whose scan fails becomes one\n * `FeedNote`; the outer `catch` covers only opening the index.\n */\nasync function libraryAssets(): Promise<{\n entries: OriginEntry[];\n notes: FeedNote[];\n}> {\n const notes: FeedNote[] = [];\n try {\n // Lazy: the library subpath pulls in SQLite, which the other feeds never need.\n const { openLibraryManager } = await import(\"./open-library.ts\");\n const { getKindRegistry } = await import(\"./open-registry.ts\");\n const { scanAuthoringLibraries } = await import(\"@skaile/workspaces/library\");\n const { library: index, close } = await openLibraryManager();\n try {\n const entries: OriginEntry[] = [];\n for (const scan of await scanAuthoringLibraries(index, getKindRegistry())) {\n if (scan.error !== undefined) {\n notes.push({ feed: \"libraries\", message: `${scan.library.name}: ${scan.error}` });\n continue;\n }\n for (const asset of scan.assets) {\n entries.push({\n origin: \"library\",\n entry: libraryEntryOf(asset),\n group: scan.library.name,\n });\n }\n }\n return { entries, notes };\n } finally {\n close();\n }\n } catch (err) {\n notes.push({\n feed: \"libraries\",\n message: err instanceof Error ? err.message : String(err),\n });\n return { entries: [], notes };\n }\n}\n\n/**\n * Pull a (best-effort) snapshot of the connected remote store catalog.\n *\n * - Returns no entries when the resolved catalog is local-only or the host\n * is unreachable (the failure becomes a note, not an exception).\n * - Maps `CatalogAsset` → `CatalogEntry`, carrying `publisher`, `repo`, and\n * `category` straight through and using `source = \"store://<id>\"`; per-file\n * `source` paths are not available for remote assets so the canonical ref is\n * a stable placeholder.\n */\nasync function storeAssets(projectDir: string): Promise<{\n entries: CatalogEntry[];\n notes: FeedNote[];\n}> {\n const notes: FeedNote[] = [];\n try {\n const { resolveCatalogSource } = await import(\"./open-library.ts\");\n const { source, close } = await resolveCatalogSource({ projectDir });\n try {\n const assets = await source.listAssets();\n const entries: CatalogEntry[] = assets.map((a) => ({\n name: a.name,\n kind: (a.kind as AssetKind) ?? \"skill\",\n description: a.description ?? \"\",\n source: `store://${a.id}`,\n publisher: a.publisher,\n repo: a.repo,\n plugin: a.plugin,\n category: a.category,\n version: a.version,\n requires: [],\n dependencies: [],\n }));\n return { entries, notes };\n } finally {\n close();\n }\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err);\n // Local-only catalog throws a recognizable message — silence it; absence\n // is the user's choice, not an error.\n if (!/local/i.test(msg)) {\n notes.push({ feed: \"store\", message: msg });\n }\n return { entries: [], notes };\n }\n}\n\n/** The slice of `AssetManager` the source feed needs (kept narrow for tests). */\ninterface AssetManagerLike {\n search: () => Promise<CatalogEntry[]>;\n searchRepoRoots: () => { repoName: string; root: string }[];\n}\n\n/**\n * Project-source feed: leans on `AssetManager.search()`, which merges\n * `skaile.yaml`'s `sources:` field into the repositories map. Plugin grouping\n * (`entry.plugin`) is stamped by the scanner, so entries pass through as-is.\n */\nasync function sourceAssets(am: AssetManagerLike): Promise<OriginEntry[]> {\n // The bundled factory tree is injected into the repositories map as an implicit\n // source, so `am.search()` returns it too. It has its own `factory` origin band,\n // so drop it here — otherwise the same first-party skills list twice under Sources.\n const factoryPrefixes = factoryAssetRoots().map((r) => (r.endsWith(path.sep) ? r : r + path.sep));\n const isFactoryPath = (p: string) =>\n factoryPrefixes.some((fp) => p === fp.slice(0, -1) || p.startsWith(fp));\n\n const all = (await am.search()).filter((e) => !isFactoryPath(e.source));\n const entries: OriginEntry[] = [];\n // Group each source's entries under the source node (its short repo name), not\n // the publisher: under Sources the navigational question is \"which repo did\n // this come from\". Each entry's `source` (absolute manifest path) lives under\n // exactly one declared root, so group by prefix. The cache slug is\n // URL-keyed `github.com/<org>/<repo>` — take the trailing segment.\n for (const { repoName, root } of am.searchRepoRoots()) {\n if (isFactoryPath(root)) continue;\n const prefix = root.endsWith(path.sep) ? root : root + path.sep;\n const owned = all.filter((e) => e.source === root || e.source.startsWith(prefix));\n if (owned.length === 0) continue;\n const sourceName = repoName.split(\"/\").pop() || repoName;\n for (const entry of owned) entries.push({ origin: \"source\", entry, group: sourceName });\n }\n return entries;\n}\n\n/**\n * Factory-asset feed: scan the bundled first-party `factory-assets` tree(s)\n * resolved by `factoryAssetRoots()` (the `SKAILE_FACTORY_ASSETS_DIR` override\n * layer ahead of the bundled tree). Local disk only, no network — the entries are\n * the built-in skills / connectors / bundles that ship with `@skaile/workspaces`.\n * `factoryAssetRoots()` already dedupes, so the env override pointing at the\n * bundled dir collapses to one root.\n */\nasync function factoryAssets(): Promise<{\n entries: CatalogEntry[];\n notes: FeedNote[];\n}> {\n const notes: FeedNote[] = [];\n try {\n const entries: CatalogEntry[] = [];\n for (const root of factoryAssetRoots()) {\n entries.push(...(await scanRepo(root, \"skaile-factory\", { knownKinds: getKnownKinds() })));\n }\n return { entries, notes };\n } catch (err) {\n notes.push({\n feed: \"factory\",\n message: err instanceof Error ? err.message : String(err),\n });\n return { entries: [], notes };\n }\n}\n\n/** Tag a flat entry list with a single origin. */\nfunction tag(origin: AssetOrigin, entries: CatalogEntry[]): OriginEntry[] {\n return entries.map((entry) => ({ origin, entry }));\n}\n\n/**\n * Run all feeds and return a single normalized result.\n *\n * Feeds run in parallel where possible — the store fetch is the slow one\n * (one HTTP call) and is fired alongside the local library walk. The factory\n * scan is local disk only, so it runs inline.\n */\nexport async function gatherAssetFeeds(\n am: AssetManagerLike,\n projectDir: string,\n): Promise<AssetFeedResult> {\n const [libs, store] = await Promise.all([libraryAssets(), storeAssets(projectDir)]);\n const factory = await factoryAssets();\n const src = await sourceAssets(am);\n return {\n entries: [\n ...src,\n ...libs.entries,\n ...tag(\"factory\", factory.entries),\n ...tag(\"store\", store.entries),\n ],\n notes: [...libs.notes, ...store.notes, ...factory.notes],\n };\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../cli/src/asset-feeds.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuEA,SAAS,eAAe,KAAA,EAAsC;AAC5D,EAAA,MAAM,EAAE,UAAS,GAAI,KAAA;AACrB,EAA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,CAAI,SAAA,EAAW,OAAA,CAAQ,OAAO,CAAA;AAAA,MACjC,GAAG,GAAA,CAAI,OAAA,EAAS,KAAA,CAAM,OAAO;AAAA,KAC/B;AAAA,IACA,KAAA,EAAO,CAAC,GAAG,IAAA,CAAK,KAAA,EAAO,GAAG,KAAA,CAAM,KAAA,EAAO,GAAG,OAAA,CAAQ,KAAK;AAAA,GACzD;AACF","file":"asset-feeds-XMKKUUK6.js","sourcesContent":["/**\n * asset-feeds.ts — gather installable assets from every feed the manage TUI\n * surfaces.\n *\n * Four feeds, normalized into `CatalogEntry`:\n * - **Project sources** — `skaile.yaml` `sources:` entries (scanned via\n * `AssetManager.search()`; the new `sources:` field is merged into the\n * legacy repositories map in `AssetManager.loadConfig`).\n * - **Local libraries** — user authoring places from `LocalIndex`, read through\n * `scanAuthoringLibraries` (`@skaile/workspaces/library`): the same scan\n * `library index` / `search --local` use, so publishers and refs match them\n * (per-asset `publisher_overrides` honoured), `dev_paths` assets are left out,\n * and a library that fails to scan becomes one note while the rest stay listed.\n * - **Factory assets** — the bundled first-party `factory-assets` tree\n * (`factoryAssetRoots()`), scanned from disk. Always present; no network.\n * - **Remote store** — the configured catalog source when `catalog.url` is\n * not `local`. Failures are non-fatal — they surface as notes.\n */\n\nimport * as path from \"node:path\";\nimport {\n type AssetKind,\n type CatalogEntry,\n factoryAssetRoots,\n parseRequires,\n scanRepo,\n} from \"@skaile/workspaces/core\";\nimport { getKnownKinds } from \"./open-registry.ts\";\nimport type { DiscoveredAsset } from \"@skaile/workspaces/discovery\";\n\n/** One non-fatal note returned to the caller for surfacing in the UI. */\nexport interface FeedNote {\n feed: \"sources\" | \"libraries\" | \"store\" | \"factory\";\n message: string;\n}\n\n/**\n * Which feed an asset came from. This is the top-level grouping axis in the\n * manage TUI (\"where is this skill coming from?\") and is intentionally distinct\n * from `publisher` (asset-intrinsic identity): the same publisher can legitimately\n * appear under more than one origin (e.g. a github repo you added as a `source`\n * that is also listed in the remote `store`).\n */\nexport type AssetOrigin = \"source\" | \"library\" | \"factory\" | \"store\";\n\n/** A catalog entry tagged with the feed it was gathered from. */\nexport interface OriginEntry {\n origin: AssetOrigin;\n entry: CatalogEntry;\n /**\n * Second-level grouping label for the manage tree. Defaults (when unset) to the\n * entry's `publisher`; the source feed sets it to the source's short repo name\n * so the Sources band groups by source — \"which repo did this come from\" — not\n * by the asset-intrinsic publisher.\n */\n group?: string;\n}\n\nexport interface AssetFeedResult {\n entries: OriginEntry[];\n notes: FeedNote[];\n}\n\n/**\n * Map one discovered library asset to the `CatalogEntry` the manage rows read.\n * `publisher` is the bare per-asset publisher (what `search --local` prints),\n * `source` the manifest path. `repo` is left unset: it only feeds the Sources-tree\n * org grouping. `requires` / `dependencies` come from the manifest the way the\n * scanner fills them — string `requires:` refs parsed to `{kind, name}`, a bundle's\n * string `dependencies:` list verbatim.\n */\nfunction libraryEntryOf(asset: DiscoveredAsset): CatalogEntry {\n const { manifest } = asset;\n const nested = (manifest.metadata as Record<string, unknown> | undefined)?.requires;\n const rawRequires = manifest.requires ?? nested;\n const requireRefs =\n typeof rawRequires === \"string\"\n ? rawRequires\n : Array.isArray(rawRequires)\n ? rawRequires.filter((r): r is string => typeof r === \"string\")\n : undefined;\n const deps = manifest.dependencies;\n return {\n name: asset.name,\n kind: asset.kind as AssetKind,\n description: typeof manifest.description === \"string\" ? manifest.description : \"\",\n source: asset.manifestPath,\n publisher: asset.publisher,\n ...(asset.plugin ? { plugin: asset.plugin } : {}),\n version: asset.version,\n requires: requireRefs === undefined ? [] : parseRequires({ requires: requireRefs }),\n dependencies:\n asset.kind === \"bundle\" && Array.isArray(deps)\n ? deps.filter((d): d is string => typeof d === \"string\" && d.length > 0)\n : [],\n };\n}\n\n/**\n * Pull assets from local libraries (the authoring places under\n * `~/.skaile/libraries/<name>/`, not the `~/.skaile/cache/sources/` cache) through\n * `scanAuthoringLibraries`, grouped under the bare library name\n * (`group: <name>`) so the manage TUI shows a clean `<name>` band — no\n * `library:` prefix (mirrors the source feed). Plugin grouping (`entry.plugin`)\n * comes from `DiscoveredAsset.plugin`. A library whose scan fails becomes one\n * `FeedNote`; the outer `catch` covers only opening the index.\n */\nasync function libraryAssets(): Promise<{\n entries: OriginEntry[];\n notes: FeedNote[];\n}> {\n const notes: FeedNote[] = [];\n try {\n // Lazy: the library subpath pulls in SQLite, which the other feeds never need.\n const { openLibraryManager } = await import(\"./open-library.ts\");\n const { getKindRegistry } = await import(\"./open-registry.ts\");\n const { scanAuthoringLibraries } = await import(\"@skaile/workspaces/library\");\n const { library: index, close } = await openLibraryManager();\n try {\n const entries: OriginEntry[] = [];\n for (const scan of await scanAuthoringLibraries(index, getKindRegistry())) {\n if (scan.error !== undefined) {\n notes.push({ feed: \"libraries\", message: `${scan.library.name}: ${scan.error}` });\n continue;\n }\n for (const asset of scan.assets) {\n entries.push({\n origin: \"library\",\n entry: libraryEntryOf(asset),\n group: scan.library.name,\n });\n }\n }\n return { entries, notes };\n } finally {\n close();\n }\n } catch (err) {\n notes.push({\n feed: \"libraries\",\n message: err instanceof Error ? err.message : String(err),\n });\n return { entries: [], notes };\n }\n}\n\n/**\n * Pull a (best-effort) snapshot of the connected remote store catalog.\n *\n * - Returns no entries when the resolved catalog is local-only or the host\n * is unreachable (the failure becomes a note, not an exception).\n * - Maps `CatalogAsset` → `CatalogEntry`, carrying `publisher`, `repo`, and\n * `category` straight through and using `source = \"store://<id>\"`; per-file\n * `source` paths are not available for remote assets so the canonical ref is\n * a stable placeholder.\n */\nasync function storeAssets(projectDir: string): Promise<{\n entries: CatalogEntry[];\n notes: FeedNote[];\n}> {\n const notes: FeedNote[] = [];\n try {\n const { resolveCatalogSource } = await import(\"./open-library.ts\");\n const { source, close } = await resolveCatalogSource({ projectDir });\n try {\n const assets = await source.listAssets();\n const entries: CatalogEntry[] = assets.map((a) => ({\n name: a.name,\n kind: (a.kind as AssetKind) ?? \"skill\",\n description: a.description ?? \"\",\n source: `store://${a.id}`,\n publisher: a.publisher,\n repo: a.repo,\n plugin: a.plugin,\n category: a.category,\n version: a.version,\n requires: [],\n dependencies: [],\n }));\n return { entries, notes };\n } finally {\n close();\n }\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err);\n // Local-only catalog throws a recognizable message — silence it; absence\n // is the user's choice, not an error.\n if (!/local/i.test(msg)) {\n notes.push({ feed: \"store\", message: msg });\n }\n return { entries: [], notes };\n }\n}\n\n/** The slice of `AssetManager` the source feed needs (kept narrow for tests). */\ninterface AssetManagerLike {\n search: () => Promise<CatalogEntry[]>;\n searchRepoRoots: () => { repoName: string; root: string }[];\n}\n\n/**\n * Project-source feed: leans on `AssetManager.search()`, which merges\n * `skaile.yaml`'s `sources:` field into the repositories map. Plugin grouping\n * (`entry.plugin`) is stamped by the scanner, so entries pass through as-is.\n */\nasync function sourceAssets(am: AssetManagerLike): Promise<OriginEntry[]> {\n // The bundled factory tree is injected into the repositories map as an implicit\n // source, so `am.search()` returns it too. It has its own `factory` origin band,\n // so drop it here — otherwise the same first-party skills list twice under Sources.\n const factoryPrefixes = factoryAssetRoots().map((r) => (r.endsWith(path.sep) ? r : r + path.sep));\n const isFactoryPath = (p: string) =>\n factoryPrefixes.some((fp) => p === fp.slice(0, -1) || p.startsWith(fp));\n\n const all = (await am.search()).filter((e) => !isFactoryPath(e.source));\n const entries: OriginEntry[] = [];\n // Group each source's entries under the source node (its short repo name), not\n // the publisher: under Sources the navigational question is \"which repo did\n // this come from\". Each entry's `source` (absolute manifest path) lives under\n // exactly one declared root, so group by prefix. The cache slug is\n // URL-keyed `github.com/<org>/<repo>` — take the trailing segment.\n for (const { repoName, root } of am.searchRepoRoots()) {\n if (isFactoryPath(root)) continue;\n const prefix = root.endsWith(path.sep) ? root : root + path.sep;\n const owned = all.filter((e) => e.source === root || e.source.startsWith(prefix));\n if (owned.length === 0) continue;\n const sourceName = repoName.split(\"/\").pop() || repoName;\n for (const entry of owned) entries.push({ origin: \"source\", entry, group: sourceName });\n }\n return entries;\n}\n\n/**\n * Factory-asset feed: scan the bundled first-party `factory-assets` tree(s)\n * resolved by `factoryAssetRoots()` (the `SKAILE_FACTORY_ASSETS_DIR` override\n * layer ahead of the bundled tree). Local disk only, no network — the entries are\n * the built-in skills / connectors / bundles that ship with `@skaile/workspaces`.\n * `factoryAssetRoots()` already dedupes, so the env override pointing at the\n * bundled dir collapses to one root.\n */\nasync function factoryAssets(): Promise<{\n entries: CatalogEntry[];\n notes: FeedNote[];\n}> {\n const notes: FeedNote[] = [];\n try {\n const entries: CatalogEntry[] = [];\n for (const root of factoryAssetRoots()) {\n entries.push(...(await scanRepo(root, \"skaile-factory\", { knownKinds: getKnownKinds() })));\n }\n return { entries, notes };\n } catch (err) {\n notes.push({\n feed: \"factory\",\n message: err instanceof Error ? err.message : String(err),\n });\n return { entries: [], notes };\n }\n}\n\n/** Tag a flat entry list with a single origin. */\nfunction tag(origin: AssetOrigin, entries: CatalogEntry[]): OriginEntry[] {\n return entries.map((entry) => ({ origin, entry }));\n}\n\n/**\n * Run all feeds and return a single normalized result.\n *\n * Feeds run in parallel where possible — the store fetch is the slow one\n * (one HTTP call) and is fired alongside the local library walk. The factory\n * scan is local disk only, so it runs inline.\n */\nexport async function gatherAssetFeeds(\n am: AssetManagerLike,\n projectDir: string,\n): Promise<AssetFeedResult> {\n const [libs, store] = await Promise.all([libraryAssets(), storeAssets(projectDir)]);\n const factory = await factoryAssets();\n const src = await sourceAssets(am);\n return {\n entries: [\n ...src,\n ...libs.entries,\n ...tag(\"factory\", factory.entries),\n ...tag(\"store\", store.entries),\n ],\n notes: [...libs.notes, ...store.notes, ...factory.notes],\n };\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { AssetManager, FACTORY_SOURCE_URL, MissingManifestError, installAgentInstances, normalizeRepoUrl, parseCanonicalLockKey, parseRefTolerant, renderMcpServerConfig, softDepName } from '../chunk-
|
|
1
|
+
export { AssetManager, FACTORY_SOURCE_URL, MissingManifestError, installAgentInstances, normalizeRepoUrl, parseCanonicalLockKey, parseRefTolerant, renderMcpServerConfig, softDepName } from '../chunk-IMKSM5NL.js';
|
|
2
2
|
import '../chunk-4MQS7CAF.js';
|
|
3
3
|
import '../chunk-Y7QA2OLD.js';
|
|
4
4
|
import '../chunk-CKQEIY43.js';
|
|
@@ -2,13 +2,13 @@ import { formatDroppedToolsNotice, filterInProcessMcpServerTools, checkToolPrope
|
|
|
2
2
|
import { freshBudget, isFirstAttempt, spend, isSpent, decide, isAvailable } from '../../chunk-IZCR27MU.js';
|
|
3
3
|
import { AskSlots } from '../../chunk-EPBKISS5.js';
|
|
4
4
|
import { scrubPoisonedTranscript, transcriptStoreForRuntime, resolveClaudeConfigDir, claudeEndpointMode, buildClaudeEndpointEnv } from '../../chunk-S53LOR7B.js';
|
|
5
|
-
import { dispatchCapability } from '../../chunk-
|
|
6
|
-
import { fetchProviderModels } from '../../chunk-
|
|
5
|
+
import { dispatchCapability } from '../../chunk-2H73V6XR.js';
|
|
6
|
+
import { fetchProviderModels } from '../../chunk-J7U3PIOE.js';
|
|
7
7
|
import { ReconfigureLedger, AuthError, stripRunnerPrivateEnv, classifyClaudeSdkError, reclassifyAuthAsAccountUnavailable, AccountUnavailableError, isLongContextEntitlementRejection, LONG_CONTEXT_CREDITS_API_ERROR } from '../../chunk-B4X2N7JQ.js';
|
|
8
8
|
import { agentExecRequested, wrapAgentCommand, resolveAgentExec } from '../../chunk-YROR332M.js';
|
|
9
|
-
import { BUILTIN_DRIVER_CATALOG, AgentDriver, getBridgeLogger, entryCredentialValue, registryDriverConfig } from '../../chunk-
|
|
9
|
+
import { BUILTIN_DRIVER_CATALOG, AgentDriver, getBridgeLogger, entryCredentialValue, registryDriverConfig } from '../../chunk-5NNNV76P.js';
|
|
10
10
|
import '../../chunk-6E6PKKAD.js';
|
|
11
|
-
import { withActivityLabelShape } from '../../chunk-
|
|
11
|
+
import { withActivityLabelShape } from '../../chunk-F4NJDSR7.js';
|
|
12
12
|
import '../../chunk-B6GIW55K.js';
|
|
13
13
|
import '../../chunk-36AFURKZ.js';
|
|
14
14
|
import '../../chunk-4GY63JU6.js';
|
|
@@ -164,6 +164,71 @@ function sumBucket(items) {
|
|
|
164
164
|
return { tokens: sumTokens(items), items };
|
|
165
165
|
}
|
|
166
166
|
|
|
167
|
+
// bridge/src/drivers/claude-tool-allowlist.ts
|
|
168
|
+
var CAPABILITY_MCP_SERVER = "skaile-capabilities";
|
|
169
|
+
var CLAUDE_CODE_BUILTIN_TOOLS = /* @__PURE__ */ new Set([
|
|
170
|
+
"Agent",
|
|
171
|
+
"AskUserQuestion",
|
|
172
|
+
"Bash",
|
|
173
|
+
"BashOutput",
|
|
174
|
+
"Edit",
|
|
175
|
+
"EnterPlanMode",
|
|
176
|
+
"ExitPlanMode",
|
|
177
|
+
"Glob",
|
|
178
|
+
"Grep",
|
|
179
|
+
"KillShell",
|
|
180
|
+
"LS",
|
|
181
|
+
"ListMcpResourcesTool",
|
|
182
|
+
"Monitor",
|
|
183
|
+
"MultiEdit",
|
|
184
|
+
"NotebookEdit",
|
|
185
|
+
"NotebookRead",
|
|
186
|
+
"Read",
|
|
187
|
+
"ReadMcpResourceTool",
|
|
188
|
+
"Skill",
|
|
189
|
+
"SlashCommand",
|
|
190
|
+
"Task",
|
|
191
|
+
"TaskOutput",
|
|
192
|
+
"TaskStop",
|
|
193
|
+
"TodoWrite",
|
|
194
|
+
"ToolSearch",
|
|
195
|
+
"WebFetch",
|
|
196
|
+
"WebSearch",
|
|
197
|
+
"Write"
|
|
198
|
+
]);
|
|
199
|
+
function mcpServerOf(name) {
|
|
200
|
+
if (!name.startsWith("mcp__")) return null;
|
|
201
|
+
const rest = name.slice("mcp__".length);
|
|
202
|
+
const sep = rest.indexOf("__");
|
|
203
|
+
if (sep <= 0 || sep + 2 >= rest.length) return null;
|
|
204
|
+
return { server: rest.slice(0, sep), tool: rest.slice(sep + 2) };
|
|
205
|
+
}
|
|
206
|
+
function canonicalToolName(entry, universe) {
|
|
207
|
+
return universe.capabilityNames.includes(entry) ? `mcp__${CAPABILITY_MCP_SERVER}__${entry}` : entry;
|
|
208
|
+
}
|
|
209
|
+
function unknownToolNames(allowlist, universe) {
|
|
210
|
+
const unknown = [];
|
|
211
|
+
for (const entry of allowlist) {
|
|
212
|
+
if (typeof entry !== "string" || !isKnownTool(entry, universe)) unknown.push(String(entry));
|
|
213
|
+
}
|
|
214
|
+
return unknown;
|
|
215
|
+
}
|
|
216
|
+
function isKnownTool(name, universe) {
|
|
217
|
+
if (CLAUDE_CODE_BUILTIN_TOOLS.has(name)) return true;
|
|
218
|
+
if (universe.capabilityNames.includes(name)) return true;
|
|
219
|
+
const mcp = mcpServerOf(name);
|
|
220
|
+
if (!mcp) return false;
|
|
221
|
+
if (mcp.server === CAPABILITY_MCP_SERVER) return universe.capabilityNames.includes(mcp.tool);
|
|
222
|
+
return universe.mcpServerNames.includes(mcp.server);
|
|
223
|
+
}
|
|
224
|
+
function toolAllowSet(allowlist, universe) {
|
|
225
|
+
return new Set(allowlist.map((entry) => canonicalToolName(entry, universe)));
|
|
226
|
+
}
|
|
227
|
+
function toolAllowlistDenial(toolName, allowed) {
|
|
228
|
+
if (!allowed || allowed.has(toolName)) return null;
|
|
229
|
+
return `The tool ${toolName} is not available in this turn. Answer with the tools you have.`;
|
|
230
|
+
}
|
|
231
|
+
|
|
167
232
|
// bridge/src/drivers/sanitize-assistant-text.ts
|
|
168
233
|
var NS = "(?:[a-z][a-z0-9]*:)?";
|
|
169
234
|
var FUNCTION_CALL_BLOCK = new RegExp(
|
|
@@ -582,6 +647,16 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
582
647
|
* the tail so one failed turn cannot wedge later callers.
|
|
583
648
|
*/
|
|
584
649
|
promptTail = Promise.resolve();
|
|
650
|
+
/**
|
|
651
|
+
* Tools the running turn may call, or `null` when it is unrestricted. Set for
|
|
652
|
+
* the whole FIFO slot of a prompt that carried an allowlist, retries included.
|
|
653
|
+
*/
|
|
654
|
+
turnToolAllowlist = null;
|
|
655
|
+
/**
|
|
656
|
+
* Subagents started under a restricted turn keep that turn's allowlist after
|
|
657
|
+
* it ends: a background subagent must not gain tools when its parent turn does.
|
|
658
|
+
*/
|
|
659
|
+
subagentToolAllowlists = /* @__PURE__ */ new Map();
|
|
585
660
|
/** Guards against duplicate agent_end emissions per turn. */
|
|
586
661
|
turnCompleted = false;
|
|
587
662
|
/** Set by {@link kill}: no turn may start or replay on this driver again. */
|
|
@@ -870,10 +945,44 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
870
945
|
* occurs after a container crash that prevented the SDK from flushing its session file.
|
|
871
946
|
*/
|
|
872
947
|
prompt(message) {
|
|
948
|
+
return this.enqueuePrompt(message, null);
|
|
949
|
+
}
|
|
950
|
+
/**
|
|
951
|
+
* Text plus an optional per-turn tool allowlist. An allowlist naming a tool
|
|
952
|
+
* this driver does not recognize is rejected before the turn is queued.
|
|
953
|
+
*/
|
|
954
|
+
promptInput(input) {
|
|
955
|
+
if (input.attachments?.length) return Promise.reject(new Error("Structured input unsupported"));
|
|
956
|
+
if (input.toolAllowlist === void 0) return this.prompt(input.text);
|
|
957
|
+
if (!Array.isArray(input.toolAllowlist))
|
|
958
|
+
return Promise.reject(new Error("toolAllowlist must be an array of tool names"));
|
|
959
|
+
const unknown = this.unknownAllowlistedTools(input.toolAllowlist);
|
|
960
|
+
if (unknown.length > 0)
|
|
961
|
+
return Promise.reject(new Error(`Unknown tool(s) in toolAllowlist: ${unknown.join(", ")}`));
|
|
962
|
+
return this.enqueuePrompt(input.text, toolAllowSet(input.toolAllowlist, this.toolUniverse()));
|
|
963
|
+
}
|
|
964
|
+
get enforcesToolAllowlist() {
|
|
965
|
+
return true;
|
|
966
|
+
}
|
|
967
|
+
unknownAllowlistedTools(allowlist) {
|
|
968
|
+
return unknownToolNames(allowlist, this.toolUniverse());
|
|
969
|
+
}
|
|
970
|
+
toolUniverse() {
|
|
971
|
+
return {
|
|
972
|
+
capabilityNames: this.config.capabilities?.composeTools().map((tool) => tool.name) ?? [],
|
|
973
|
+
mcpServerNames: Object.keys(this.config.mcpServers ?? {})
|
|
974
|
+
};
|
|
975
|
+
}
|
|
976
|
+
enqueuePrompt(message, allowlist) {
|
|
873
977
|
this.supersedePendingQuestion();
|
|
874
|
-
const queuedPrompt = this.promptTail.then(
|
|
875
|
-
|
|
876
|
-
|
|
978
|
+
const queuedPrompt = this.promptTail.then(async () => {
|
|
979
|
+
this.turnToolAllowlist = allowlist;
|
|
980
|
+
try {
|
|
981
|
+
await this.runPrompt(message, freshBudget());
|
|
982
|
+
} finally {
|
|
983
|
+
this.turnToolAllowlist = null;
|
|
984
|
+
}
|
|
985
|
+
});
|
|
877
986
|
this.promptTail = queuedPrompt.then(
|
|
878
987
|
() => void 0,
|
|
879
988
|
() => void 0
|
|
@@ -1636,7 +1745,13 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
1636
1745
|
...this.config.thinking ? { thinking: this.mapThinkingConfig(this.config.thinking) } : {},
|
|
1637
1746
|
// Reasoning effort — passed directly to the SDK
|
|
1638
1747
|
...this.config.effort ? { effort: this.config.effort } : {},
|
|
1639
|
-
|
|
1748
|
+
// The per-turn tool allowlist: hooks fire for every call, subagents'
|
|
1749
|
+
// included, under bypassPermissions, and read the turn's state live.
|
|
1750
|
+
hooks: {
|
|
1751
|
+
PreToolUse: [{ hooks: [this.handlePreToolUse] }],
|
|
1752
|
+
SubagentStart: [{ hooks: [this.handleSubagentStart] }],
|
|
1753
|
+
SubagentStop: [{ hooks: [this.handleSubagentStop] }]
|
|
1754
|
+
},
|
|
1640
1755
|
stderr: onStderr,
|
|
1641
1756
|
// Spawn the CLI ourselves to capture its OS pid for snapshotDescendantPids()
|
|
1642
1757
|
// (Query never exposes it otherwise). This replaces the SDK's own default
|
|
@@ -1762,6 +1877,8 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
1762
1877
|
* `options.canUseTool` by value.
|
|
1763
1878
|
*/
|
|
1764
1879
|
handleCanUseTool = (toolName, input, opts) => {
|
|
1880
|
+
const denial = this.toolAllowlistDenialFor(toolName, opts.agentID);
|
|
1881
|
+
if (denial) return Promise.resolve({ behavior: "deny", message: denial });
|
|
1765
1882
|
if (toolName !== "AskUserQuestion") {
|
|
1766
1883
|
return Promise.resolve({ behavior: "allow", updatedInput: input });
|
|
1767
1884
|
}
|
|
@@ -1789,6 +1906,42 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
1789
1906
|
this.log.debug("paused on AskUserQuestion", { questions: questionTexts.length });
|
|
1790
1907
|
});
|
|
1791
1908
|
};
|
|
1909
|
+
/**
|
|
1910
|
+
* Denial reason when the per-turn allowlist forbids `toolName`, else `null`.
|
|
1911
|
+
* A subagent seen under a restricted turn is bound to that turn's allowlist
|
|
1912
|
+
* for its whole life.
|
|
1913
|
+
*/
|
|
1914
|
+
toolAllowlistDenialFor(toolName, agentId) {
|
|
1915
|
+
if (agentId !== void 0 && this.turnToolAllowlist && !this.subagentToolAllowlists.has(agentId))
|
|
1916
|
+
this.subagentToolAllowlists.set(agentId, this.turnToolAllowlist);
|
|
1917
|
+
const allowed = (agentId !== void 0 ? this.subagentToolAllowlists.get(agentId) : void 0) ?? this.turnToolAllowlist;
|
|
1918
|
+
return toolAllowlistDenial(toolName, allowed);
|
|
1919
|
+
}
|
|
1920
|
+
/** `PreToolUse` hook: deny a call outside the turn's allowlist. */
|
|
1921
|
+
handlePreToolUse = async (input) => {
|
|
1922
|
+
if (input.hook_event_name !== "PreToolUse") return {};
|
|
1923
|
+
const denial = this.toolAllowlistDenialFor(input.tool_name, input.agent_id);
|
|
1924
|
+
if (!denial) return {};
|
|
1925
|
+
this.log.info("tool call refused by the turn's allowlist", { tool: input.tool_name });
|
|
1926
|
+
return {
|
|
1927
|
+
hookSpecificOutput: {
|
|
1928
|
+
hookEventName: "PreToolUse",
|
|
1929
|
+
permissionDecision: "deny",
|
|
1930
|
+
permissionDecisionReason: denial
|
|
1931
|
+
}
|
|
1932
|
+
};
|
|
1933
|
+
};
|
|
1934
|
+
/** `SubagentStart` hook: bind a subagent started under a restricted turn to its allowlist. */
|
|
1935
|
+
handleSubagentStart = async (input) => {
|
|
1936
|
+
if (input.hook_event_name === "SubagentStart" && this.turnToolAllowlist)
|
|
1937
|
+
this.subagentToolAllowlists.set(input.agent_id, this.turnToolAllowlist);
|
|
1938
|
+
return {};
|
|
1939
|
+
};
|
|
1940
|
+
handleSubagentStop = async (input) => {
|
|
1941
|
+
if (input.hook_event_name === "SubagentStop")
|
|
1942
|
+
this.subagentToolAllowlists.delete(input.agent_id);
|
|
1943
|
+
return {};
|
|
1944
|
+
};
|
|
1792
1945
|
supersedePendingQuestion() {
|
|
1793
1946
|
this.denyPendingQuestion(QUESTION_SUPERSEDED_BY_PROMPT);
|
|
1794
1947
|
}
|