@skaile/workspaces 3.16.1 → 3.16.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +47 -0
- package/dist/{asset-feeds-TS76HDGE.js → asset-feeds-FQT6GH24.js} +4 -4
- package/dist/{asset-feeds-TS76HDGE.js.map → asset-feeds-FQT6GH24.js.map} +1 -1
- package/dist/asset-manager/index.js +1 -1
- package/dist/bridge/drivers/claude-sdk.js +39 -1
- package/dist/bridge/drivers/claude-sdk.js.map +1 -1
- package/dist/bridge/drivers/codex.js +1 -1
- package/dist/bridge/drivers/continue.js +2 -2
- package/dist/bridge/drivers/echo.js +3 -3
- package/dist/bridge/drivers/echo.js.map +1 -1
- package/dist/bridge/drivers/gemini.js +3 -3
- package/dist/bridge/drivers/goose.js +2 -2
- package/dist/bridge/drivers/omp.js +1 -1
- package/dist/bridge/drivers/opencode.js +2 -2
- package/dist/bridge/drivers/qwen.js +3 -3
- package/dist/bridge/index.js +2 -2
- package/dist/bridge/src/drivers/claude-sdk.d.ts +12 -0
- package/dist/bridge/src/drivers/claude-sdk.d.ts.map +1 -1
- package/dist/bridge/src/drivers/echo.d.ts.map +1 -1
- package/dist/{chunk-PCDNZROC.js → chunk-CMGYUF5P.js} +6 -6
- package/dist/{chunk-PCDNZROC.js.map → chunk-CMGYUF5P.js.map} +1 -1
- package/dist/{chunk-4J24AU4Q.js → chunk-DUMD4AA2.js} +3 -3
- package/dist/{chunk-4J24AU4Q.js.map → chunk-DUMD4AA2.js.map} +1 -1
- package/dist/{chunk-775OMGVP.js → chunk-EO7IJY3Q.js} +3 -3
- package/dist/{chunk-775OMGVP.js.map → chunk-EO7IJY3Q.js.map} +1 -1
- package/dist/{chunk-VC2MWHRH.js → chunk-EXT2LNST.js} +4 -4
- package/dist/{chunk-VC2MWHRH.js.map → chunk-EXT2LNST.js.map} +1 -1
- package/dist/{chunk-NIUG3MIH.js → chunk-FRER2PEN.js} +2 -2
- package/dist/{chunk-NIUG3MIH.js.map → chunk-FRER2PEN.js.map} +1 -1
- package/dist/{chunk-EVQDXN27.js → chunk-GRVSSAAQ.js} +2 -2
- package/dist/{chunk-EVQDXN27.js.map → chunk-GRVSSAAQ.js.map} +1 -1
- package/dist/{chunk-OEK2ACRR.js → chunk-I3COVVFB.js} +38 -8
- package/dist/chunk-I3COVVFB.js.map +1 -0
- package/dist/{chunk-QA52GQQN.js → chunk-L2UE4YJO.js} +6 -6
- package/dist/{chunk-QA52GQQN.js.map → chunk-L2UE4YJO.js.map} +1 -1
- package/dist/{chunk-OGTS7QJX.js → chunk-NIQPSQFN.js} +4 -4
- package/dist/{chunk-OGTS7QJX.js.map → chunk-NIQPSQFN.js.map} +1 -1
- package/dist/{chunk-5FCBPIOK.js → chunk-PBRMY64S.js} +3 -3
- package/dist/{chunk-5FCBPIOK.js.map → chunk-PBRMY64S.js.map} +1 -1
- package/dist/{chunk-QG6C3XOS.js → chunk-QFYEDM63.js} +3 -3
- package/dist/{chunk-QG6C3XOS.js.map → chunk-QFYEDM63.js.map} +1 -1
- package/dist/{chunk-GP2AYOC2.js → chunk-SWUVULBU.js} +2 -2
- package/dist/{chunk-GP2AYOC2.js.map → chunk-SWUVULBU.js.map} +1 -1
- package/dist/{chunk-6KPCHQP5.js → chunk-VT4MPCRK.js} +3 -3
- package/dist/{chunk-6KPCHQP5.js.map → chunk-VT4MPCRK.js.map} +1 -1
- package/dist/{chunk-U2UNQBXB.js → chunk-X7FJ3ES3.js} +3 -3
- package/dist/{chunk-U2UNQBXB.js.map → chunk-X7FJ3ES3.js.map} +1 -1
- package/dist/cli/index.js +29 -29
- package/dist/connectors/index.js +3 -3
- package/dist/{ensure-sources-I2F6XBDJ.js → ensure-sources-4GBXK6UR.js} +4 -4
- package/dist/{ensure-sources-I2F6XBDJ.js.map → ensure-sources-4GBXK6UR.js.map} +1 -1
- package/dist/factory-assets/connectors/box.js +3 -3
- package/dist/factory-assets/connectors/deploy.js +3 -3
- package/dist/factory-assets/connectors/devserver.js +3 -3
- package/dist/factory-assets/connectors/flow/adapter.js +3 -3
- package/dist/factory-assets/connectors/flow/run-flow.js +4 -4
- package/dist/factory-assets/connectors/flow.js +3 -3
- package/dist/factory-assets/connectors/git.js +3 -3
- package/dist/factory-assets/connectors/gmail.js +3 -3
- package/dist/factory-assets/connectors/googledrive.js +3 -3
- package/dist/factory-assets/connectors/local.js +3 -3
- package/dist/factory-assets/connectors/mattermost.js +3 -3
- package/dist/factory-assets/connectors/memory.js +3 -3
- package/dist/factory-assets/connectors/minio.js +3 -3
- package/dist/factory-assets/connectors/postgres.js +3 -3
- package/dist/factory-assets/connectors/s3.js +3 -3
- package/dist/factory-assets/connectors/sharepoint.js +3 -3
- package/dist/factory-assets/connectors/sqlite.js +3 -3
- package/dist/factory-assets/connectors/static-server.js +3 -3
- package/dist/factory-assets/connectors/tunnel.js +3 -3
- package/dist/factory-assets/connectors/webdav.js +3 -3
- package/dist/factory-assets/connectors/xstate-store.js +3 -3
- package/dist/factory-assets/connectors/xstate.js +3 -3
- package/dist/{helpers-Y66CM6LO.js → helpers-26LW4IXY.js} +4 -4
- package/dist/{helpers-Y66CM6LO.js.map → helpers-26LW4IXY.js.map} +1 -1
- package/dist/{library-publish-SNUOWBUD.js → library-publish-IYGHOPEK.js} +6 -6
- package/dist/{library-publish-SNUOWBUD.js.map → library-publish-IYGHOPEK.js.map} +1 -1
- package/dist/{open-library-IO4TSO2H.js → open-library-HH5LST7Z.js} +5 -5
- package/dist/{open-library-IO4TSO2H.js.map → open-library-HH5LST7Z.js.map} +1 -1
- package/dist/{project-OR524CQ3.js → project-U5QRUCBN.js} +5 -5
- package/dist/{project-OR524CQ3.js.map → project-U5QRUCBN.js.map} +1 -1
- package/dist/runner/index.js +6 -6
- package/dist/runner/src/serve.d.ts.map +1 -1
- package/dist/sdk/asset-manager.js +1 -1
- package/dist/sdk/bridge.js +2 -2
- package/dist/sdk/index.js +6 -6
- package/dist/sdk/runner.js +6 -6
- package/dist/{setup-5OG442AZ.js → setup-XKTBHRWM.js} +4 -4
- package/dist/{setup-5OG442AZ.js.map → setup-XKTBHRWM.js.map} +1 -1
- package/dist/{source-DTV7VK3C.js → source-6PBVTACZ.js} +6 -6
- package/dist/{source-DTV7VK3C.js.map → source-6PBVTACZ.js.map} +1 -1
- package/dist/{source-manifest-publish-HC3K7D63.js → source-manifest-publish-VBVNW7KL.js} +7 -7
- package/dist/{source-manifest-publish-HC3K7D63.js.map → source-manifest-publish-VBVNW7KL.js.map} +1 -1
- package/dist/tui/index.js +6 -6
- package/dist/workspace-plugin/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-OEK2ACRR.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { fetchProviderModels } from '../../chunk-GURXUF2J.js';
|
|
2
2
|
import { classifyGenericErrorMessage } from '../../chunk-GAH4YRCI.js';
|
|
3
|
-
import { BUILTIN_DRIVER_CATALOG, AgentDriver, getBridgeLogger } from '../../chunk-
|
|
3
|
+
import { BUILTIN_DRIVER_CATALOG, AgentDriver, getBridgeLogger } from '../../chunk-FRER2PEN.js';
|
|
4
4
|
import '../../chunk-6E6PKKAD.js';
|
|
5
5
|
import '../../chunk-FTG7CRFD.js';
|
|
6
6
|
import '../../chunk-W4IPN3DD.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { SubprocessCliDriver, mapApiKeysToEnv, extractText, extractCost, extractTokens } from '../../chunk-
|
|
1
|
+
import { SubprocessCliDriver, mapApiKeysToEnv, extractText, extractCost, extractTokens } from '../../chunk-VT4MPCRK.js';
|
|
2
2
|
import '../../chunk-GAH4YRCI.js';
|
|
3
|
-
import { BUILTIN_DRIVER_CATALOG, getBridgeLogger } from '../../chunk-
|
|
3
|
+
import { BUILTIN_DRIVER_CATALOG, getBridgeLogger } from '../../chunk-FRER2PEN.js';
|
|
4
4
|
import '../../chunk-6E6PKKAD.js';
|
|
5
5
|
import '../../chunk-FTG7CRFD.js';
|
|
6
6
|
import '../../chunk-W4IPN3DD.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { dispatchCapability } from '../../chunk-RRVQAE5D.js';
|
|
2
|
-
import { BUILTIN_DRIVER_CATALOG, AgentDriver, getBridgeLogger } from '../../chunk-
|
|
2
|
+
import { BUILTIN_DRIVER_CATALOG, AgentDriver, getBridgeLogger } from '../../chunk-FRER2PEN.js';
|
|
3
3
|
import '../../chunk-6E6PKKAD.js';
|
|
4
4
|
import '../../chunk-FTG7CRFD.js';
|
|
5
5
|
import '../../chunk-W4IPN3DD.js';
|
|
@@ -207,7 +207,7 @@ var EchoDriver = class extends AgentDriver {
|
|
|
207
207
|
await this.runScriptedFlowTurn();
|
|
208
208
|
return;
|
|
209
209
|
}
|
|
210
|
-
const capMatch =
|
|
210
|
+
const capMatch = /^[ \t]*\[test-cap:([\w.\-_]+)\][ \t]*(.*)$/m.exec(message);
|
|
211
211
|
if (capMatch) {
|
|
212
212
|
const name = capMatch[1] ?? "";
|
|
213
213
|
const rawInput = (capMatch[2] ?? "").trim();
|
|
@@ -250,7 +250,7 @@ var EchoDriver = class extends AgentDriver {
|
|
|
250
250
|
}
|
|
251
251
|
try {
|
|
252
252
|
const out = await this.invokeCapabilityForTest(name, input);
|
|
253
|
-
const summary = `echo[test-cap]: invoked ${name} background=${String(out.background)} result=${safeStringify(out.result)}`;
|
|
253
|
+
const summary = `echo[test-cap]: invoked ${name} input=${safeStringify(input)} background=${String(out.background)} result=${safeStringify(out.result)}`;
|
|
254
254
|
events.push(...textAndResult(summary));
|
|
255
255
|
} catch (err) {
|
|
256
256
|
const msg = err instanceof Error ? err.message : String(err);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../bridge/src/drivers/flow-script.ts","../../../bridge/src/drivers/echo.ts"],"names":["events"],"mappings":";;;;;;;;;AA6FA,IAAM,WAAA,uBAAiD,GAAA,CAAI;AAAA,EACzD,kBAAA;AAAA,EACA,eAAA;AAAA,EACA;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AAA,EAAM,OAAA;AAAA,MACN,KAAA,EACE,yHAAA;AAAA,MACF,KAAA,EAAO;AAAA,KACR,CAAA;AAAA,EACH,CAAA,MAAO;AAEL,IAAA,MAAM,OAAA,GACJ,6BAA6B,cAAc,CAAA,2GAAA,CAAA;AAE7C,IAAA,MAAA,CAAO,IAAA,CAAK,GAAG,aAAA,CAAc,OAAO,CAAC,CAAA;AAAA,EACvC;AAEA,EAAA,OAAO,MAAA;AACT;AAMO,IAAM,gBAAA,GAA8C;AAAA,EACzD,EAAA,EAAI,MAAA;AAAA,EACJ,WAAA,EAAa,sBAAA,CAAuB,IAAA,EAAM,IAAA,IAAQ,iBAAA;AAAA,EAClD,UAAA,EAAY,CAAA;AAAA;AAAA,EAEZ,YAAA,EAAgB,CAAA,CAAA,MAAA,CAAoB,MAAM,IAAI,CAAA;AAAA,EAC9C,QAAQ,OAAO,MAAA,EAAQ,IAAA,KAAS,IAAI,WAAW,MAAM,CAAA;AAAA,EACrD,UAAA,EAAY,OAAO,OAAA,KACjB,IAAI,WAAW,EAAE,GAAA,EAAK,OAAA,CAAQ,GAAA,IAAO,SAAA,EAAW,YAAA,EAAc,OAAA,EAAS,EAAE,UAAA;AAC7E","file":"echo.js","sourcesContent":["/**\n * Scripted-flow decision logic for the echo driver.\n *\n * Pure, deterministic policy that maps a live {@link FlowExecution} snapshot\n * (plus an optional per-node script) to the single next flow-adapter mutation\n * the driver should emit this iteration. The echo driver calls this in a loop\n * per turn (see `echo.ts`), executing each returned action against the\n * runner-injected {@link FlowTestDriverHook} until it yields (`null`) or emits\n * a turn-ending action.\n *\n * The policy mirrors what a real LLM orchestrator would do, but without an\n * LLM: it reacts to state each turn, so a host can drive a flow to `complete`,\n * park it at an approval/input gate, and exercise the reject/recover path\n * simply by applying host mutations (`applyApproval`, `applyInput`, …) between\n * turns. No new protocol, no flow-contract change — it only calls the existing\n * FlowAdapter agent-tool operations.\n *\n * @docLink packages/bridge/drivers#scripted-flow\n * @since 3.6.0\n */\n\nimport type { FlowExecution, NodeExecution } from \"@skaile/workspaces/types\";\n\n/**\n * What the scripted driver should do when a node reaches its decision point.\n *\n * - `auto` (default): follow the flow's `autonomousMode` — `complete_node`\n * when autonomous, else `request_approval`. A mandatory approval gate always\n * resolves to `request_approval`, even when autonomous (it cannot be skipped).\n * - `complete`: always `complete_node` (autonomous-style, even if the flow's\n * autonomousMode is false — the adapter allows it only when autonomous, so\n * use with autonomous flows).\n * - `approve`: always `request_approval` (park at an approval gate).\n * - `input`: `request_input` once; after the host applies input, fall back to\n * `auto` behaviour.\n * - `skip`: `skip_node` (optional nodes only).\n * - `fail`: `fail_node`. With `recoverable: false` (default) this is terminal.\n * With `recoverable: true` the node returns to `available`; the driver\n * re-emits the recoverable failure `failCount` times (default 1) and then\n * proceeds as `auto` — it never deadlocks on a recoverable fail.\n */\nexport type OnRun = \"auto\" | \"complete\" | \"approve\" | \"input\" | \"skip\" | \"fail\";\n\n/**\n * What to do when a node returns to `available` after a rejection.\n *\n * - `retry` (default): re-drive it — `start_node` again, then its `onRun`.\n * - `fail`: `fail_node(recoverable: false)` — exercises the terminal path.\n */\nexport type OnReject = \"retry\" | \"fail\";\n\n/** Per-node scripting directive. All fields optional. */\nexport interface FlowNodeDirective {\n onRun?: OnRun;\n onReject?: OnReject;\n /** For `onRun: \"input\"` — the input request shown to the host. */\n input?: { prompt?: string; schema?: unknown };\n /** For `onRun: \"fail\"` — whether the failure is recoverable. Default false. */\n recoverable?: boolean;\n /**\n * For `onRun: \"fail\"` with `recoverable: true` — how many recoverable\n * failures to emit before the node proceeds as `auto`. Default 1. Counted\n * from the node's own `errorHistory`, so the policy stays a pure function of\n * state (no driver-instance bookkeeping) and never deadlocks.\n */\n failCount?: number;\n /** Summary text used for `complete_node` / `request_approval` / failures. */\n summary?: string;\n}\n\n/**\n * A scripted-flow program. Empty (`{}`) means \"canonical policy\": start each\n * available node, then complete (autonomous) or request approval (interactive)\n * — enough to drive the autonomous-complete, approval-gate, and reject/recover\n * scenarios with no per-node scripting at all.\n */\nexport interface FlowScript {\n /** Per-node overrides, keyed by node id. */\n nodes?: Record<string, FlowNodeDirective>;\n /** Fallback directive for any node without its own entry. */\n default?: FlowNodeDirective;\n}\n\n/** A single flow-adapter mutation the driver will execute. */\nexport type FlowAction =\n | { op: \"start_node\"; nodeId: string }\n | { op: \"complete_node\"; nodeId: string; summary: string }\n | { op: \"request_approval\"; nodeId: string; summary: string }\n | { op: \"request_input\"; nodeId: string; prompt: string; schema: string }\n | { op: \"skip_node\"; nodeId: string }\n | { op: \"fail_node\"; nodeId: string; message: string; recoverable: boolean };\n\n/** Ops that end the agent turn (the runner yields until the host acts). */\nconst TURN_ENDING: ReadonlySet<FlowAction[\"op\"]> = new Set([\n \"request_approval\",\n \"request_input\",\n \"fail_node\",\n]);\n\n/** Whether an action ends the turn (driver stops looping after emitting it). */\nexport function isTurnEnding(action: FlowAction): boolean {\n return TURN_ENDING.has(action.op);\n}\n\n/** Map a {@link FlowAction} to the `executeOp` argument bag the adapter expects. */\nexport function actionArgs(action: FlowAction): Record<string, unknown> {\n switch (action.op) {\n case \"start_node\":\n case \"skip_node\":\n return { nodeId: action.nodeId };\n case \"complete_node\":\n return { nodeId: action.nodeId, summary: action.summary };\n case \"request_approval\":\n return { nodeId: action.nodeId, summary: action.summary };\n case \"request_input\":\n return { nodeId: action.nodeId, prompt: action.prompt, schema: action.schema };\n case \"fail_node\":\n return {\n nodeId: action.nodeId,\n message: action.message,\n recoverable: String(action.recoverable),\n };\n }\n}\n\nfunction summaryFor(d: FlowNodeDirective, n: NodeExecution): string {\n return d.summary ?? `Scripted output for ${n.id}`;\n}\n\n/**\n * Decide the single next flow action for the current state, or `null` to yield\n * (nothing to do this iteration — wait for a host mutation).\n *\n * Priority order: resolve approved gates → advance running nodes → start (or\n * skip / terminally-fail) available nodes. Terminal flow states and gates with\n * no decision / input yet yield.\n *\n * Pure — the fail bookkeeping (how many recoverable failures a node has already\n * emitted) is read from the node's own `errorHistory`, so no external counter is\n * needed and a recoverable `fail` directive can never deadlock.\n */\nexport function decideFlowAction(\n state: FlowExecution,\n script: FlowScript,\n mandatoryGates: ReadonlySet<string> = new Set(),\n): FlowAction | null {\n // Terminal flow — never fight a completed/failed/cancelled run.\n if (state.status === \"complete\" || state.status === \"failed\" || state.status === \"cancelled\") {\n return null;\n }\n\n const dir = (id: string): FlowNodeDirective => script.nodes?.[id] ?? script.default ?? {};\n const nodes = Object.values(state.nodes);\n // A mandatory gate can never auto-complete — `auto` resolves to `approve`\n // regardless of autonomousMode so the host can drive it deterministically.\n const canAutoComplete = (id: string): boolean => state.autonomousMode && !mandatoryGates.has(id);\n\n // 1. Approved gate → complete.\n for (const n of nodes) {\n if (n.status === \"awaiting_approval\" && n.approval?.decision === \"approved\") {\n return { op: \"complete_node\", nodeId: n.id, summary: summaryFor(dir(n.id), n) };\n }\n }\n\n // 2. Running node → per directive.\n for (const n of nodes) {\n if (n.status !== \"running\") continue;\n const d = dir(n.id);\n const onRun: OnRun = d.onRun ?? \"auto\";\n const resolved: OnRun =\n onRun === \"auto\" ? (canAutoComplete(n.id) ? \"complete\" : \"approve\") : onRun;\n\n if (resolved === \"complete\") {\n return { op: \"complete_node\", nodeId: n.id, summary: summaryFor(d, n) };\n }\n if (resolved === \"approve\") {\n return { op: \"request_approval\", nodeId: n.id, summary: summaryFor(d, n) };\n }\n if (resolved === \"input\") {\n const lastInput = n.inputHistory[n.inputHistory.length - 1];\n if (lastInput && lastInput.response !== undefined) {\n // Input already provided — proceed as if `auto`.\n return canAutoComplete(n.id)\n ? { op: \"complete_node\", nodeId: n.id, summary: summaryFor(d, n) }\n : { op: \"request_approval\", nodeId: n.id, summary: summaryFor(d, n) };\n }\n return {\n op: \"request_input\",\n nodeId: n.id,\n prompt: d.input?.prompt ?? `Provide input for ${n.id}`,\n schema: JSON.stringify(d.input?.schema ?? { kind: \"text\" }),\n };\n }\n if (resolved === \"fail\") {\n const recoverable = d.recoverable ?? false;\n if (!recoverable) {\n // Terminal fail — the adapter marks node + flow `failed`, so the\n // terminal-status guard above stops any re-fire on later turns.\n return {\n op: \"fail_node\",\n nodeId: n.id,\n message: d.summary ?? `Scripted failure for ${n.id}`,\n recoverable: false,\n };\n }\n // Recoverable fail — emit up to `failCount` times (counting the node's\n // own recorded recoverable errors), then proceed as `auto` so the node\n // is not stranded in a re-drive loop.\n const emitted = n.errorHistory.filter((e) => e.recoverable).length;\n const failCount = Math.max(1, d.failCount ?? 1);\n if (emitted < failCount) {\n return {\n op: \"fail_node\",\n nodeId: n.id,\n message: d.summary ?? `Scripted recoverable failure for ${n.id}`,\n recoverable: true,\n };\n }\n return canAutoComplete(n.id)\n ? { op: \"complete_node\", nodeId: n.id, summary: summaryFor(d, n) }\n : { op: \"request_approval\", nodeId: n.id, summary: summaryFor(d, n) };\n }\n // `skip` while running is illegal; complete instead to avoid a deadlock.\n return { op: \"complete_node\", nodeId: n.id, summary: summaryFor(d, n) };\n }\n\n // 3. Available node → terminally-fail (post-reject), skip, or start.\n for (const n of nodes) {\n if (n.status !== \"available\") continue;\n const d = dir(n.id);\n const lastApproval = n.approvalHistory[n.approvalHistory.length - 1];\n if (lastApproval?.decision === \"rejected\" && d.onReject === \"fail\") {\n return {\n op: \"fail_node\",\n nodeId: n.id,\n message: d.summary ?? `Rejected and not recoverable: ${n.id}`,\n recoverable: false,\n };\n }\n if (d.onRun === \"skip\") {\n return { op: \"skip_node\", nodeId: n.id };\n }\n return { op: \"start_node\", nodeId: n.id };\n }\n\n // 4. Nothing actionable — awaiting_approval (no decision), awaiting_input\n // (no response), or fully drained. Yield.\n return null;\n}\n\n/**\n * Parse a `[test-flow]` sentinel body into a {@link FlowScript}. An empty body\n * yields the canonical (empty) script. Malformed JSON is a hard error so tests\n * fail loudly rather than silently running the wrong policy.\n */\nexport function parseFlowScript(body: string): FlowScript {\n const trimmed = body.trim();\n if (trimmed.length === 0) return {};\n const parsed: unknown = JSON.parse(trimmed);\n if (parsed === null || typeof parsed !== \"object\" || Array.isArray(parsed)) {\n throw new Error(\"flow script must be a JSON object\");\n }\n return parsed as FlowScript;\n}\n","import type { DriverTarget } from \"@skaile/workspaces/plugin-registry\";\nimport type { Logger } from \"@skaile/workspaces/types\";\nimport * as z from \"zod\";\nimport { dispatchCapability } from \"../capability-dispatch.js\";\nimport { getBridgeLogger } from \"../logger.js\";\nimport { BUILTIN_DRIVER_CATALOG } from \"../registry.js\";\nimport {\n type AgentConfig,\n AgentDriver,\n type AgentEvent,\n type BridgeCapabilityTool,\n type DriverInfo,\n} from \"../types.js\";\nimport {\n actionArgs,\n type FlowScript,\n decideFlowAction,\n isTurnEnding,\n parseFlowScript,\n} from \"./flow-script.js\";\n\n/**\n * Echo/mock driver for E2E testing in docker mode.\n *\n * Runs inside a real Docker container with real WebSocket transport and\n * session lifecycle, but generates deterministic keyword-triggered responses\n * instead of calling the Anthropic API. This lets E2E tests exercise the\n * full infrastructure (containers, WebSocket, session management, message\n * persistence) without needing real AI credentials.\n *\n * Keyword triggers match the MockAgentClient in\n * `platform/backend/libs/agent-gateway/src/mock-agent-client.ts` — the\n * same test messages (\"test toolcall\", \"test question\", etc.) produce\n * the same events.\n *\n * Enable by setting `SKAILE_AGENT_DRIVER=echo` in the container env,\n * or by passing `{ driver: 'echo' }` in the runner config.\n *\n * @docLink packages/bridge/drivers#echo-driver\n */\nexport class EchoDriver extends AgentDriver {\n readonly driverInfo: DriverInfo = {\n id: \"echo\",\n name: \"Echo (E2E mock)\",\n modelAgnostic: true,\n supportsInBandAbort: false,\n };\n\n private readonly log: Logger = getBridgeLogger(\"echo\");\n private running = false;\n private readonly config: AgentConfig;\n\n /**\n * Scripted-flow mode state (workspaces#396). Enabled by a `[test-flow]`\n * sentinel chat message; once on, orchestrator-prompt turns are driven\n * deterministically against `config.flowTestDriver`. `null` script ⇒ mode\n * off (default echo behaviour, unchanged).\n */\n private flowScript: FlowScript | null = null;\n\n constructor(config: AgentConfig) {\n super();\n this.config = config;\n }\n\n /**\n * Test surface: returns the tool list the LLM would see for this turn.\n * Composition: the registry hooks (Protocol v2) take precedence; legacy\n * `mcpServers` is not enumerated here (the echo driver never exposed MCP\n * tools to the LLM by name).\n */\n listCapabilityTools(): BridgeCapabilityTool[] {\n return this.config.capabilities?.composeTools() ?? [];\n }\n\n /**\n * Test surface: invoke a registered capability through the dispatch\n * helper. Mirrors what a real driver would do when the LLM produced a\n * tool_use for the given name — applies fire-and-forget, render emission,\n * and fallback text. Returns the structured dispatch result so tests can\n * assert immediate-vs-background resolution.\n */\n async invokeCapabilityForTest(\n name: string,\n input: unknown,\n ): Promise<{ result: unknown; background: boolean }> {\n const hooks = this.config.capabilities;\n if (!hooks) throw new Error(\"EchoDriver: no capability hooks configured\");\n const callId = `echo-cap-${Date.now()}`;\n const out = await dispatchCapability(hooks, callId, name, input, (err) =>\n this.log.warn(\"background capability handler failed\", {\n name,\n error: String(err),\n }),\n );\n return out;\n }\n\n async start(): Promise<void> {\n this.running = true;\n this.log.info(\"driver started\");\n }\n\n async prompt(message: string): Promise<void> {\n if (!this.running) return;\n const content = message.toLowerCase();\n this.log.info(\"received prompt\", { preview: message.slice(0, 80), length: message.length });\n\n // Small delay to simulate real agent processing\n await new Promise((resolve) => setTimeout(resolve, 200));\n\n // Scripted-flow test seam (workspaces#396) — a `[test-flow]` sentinel\n // arms deterministic flow driving for this session and (optionally)\n // carries a JSON script. Format: `[test-flow] {json}`; empty body ⇒\n // canonical policy. Must be handled before the flow-turn branch below.\n //\n // Detection is LINE-anchored, not message-anchored (workspaces#401): hosts\n // decorate user messages (e.g. a prepended `<SESSION_MEMBERS>` block and a\n // wake-restoration preamble), so the sentinel is rarely at the start of the\n // composed prompt. We match `[test-flow]` at the start of ANY line (only\n // leading whitespace allowed), which is decoration-independent yet still\n // impossible to arm from ordinary prose — a line must BEGIN with the exact\n // token. The optional JSON script must sit on that same line.\n const flowMatch = /^[ \\t]*\\[test-flow\\][ \\t]*(.*)$/m.exec(message);\n if (flowMatch) {\n let summary: string;\n try {\n this.flowScript = parseFlowScript(flowMatch[1] ?? \"\");\n summary = \"echo[test-flow]: scripted-flow mode armed\";\n } catch (err) {\n this.flowScript = null;\n summary = `echo[test-flow]: invalid script — ${err instanceof Error ? err.message : String(err)}`;\n this.emit(\"agent-event\", { type: \"error\", error: summary, fatal: false });\n }\n for (const event of textAndResult(summary)) this.emit(\"agent-event\", event);\n this.emit(\"agent-event\", { type: \"agent_end\" });\n return;\n }\n\n // Scripted-flow turn — the runner reassembles the orchestrator prompt on\n // every flow turn; when scripted-flow mode is armed and a flow driver hook\n // is present, drive nodes deterministically instead of echoing text.\n if (this.flowScript && this.config.flowTestDriver && isFlowTurn(message)) {\n await this.runScriptedFlowTurn();\n return;\n }\n\n // Phase 7B test seam — explicit capability invocation keyword. Lets E2E\n // tests drive `dispatchCapability` from a chat prompt without a real LLM.\n // Format: `[test-cap:<name>] {json}`. Anything after the closing bracket\n // is parsed as JSON input; on parse error we fall back to `{}`.\n const capMatch = /^\\s*\\[test-cap:([\\w.\\-_]+)\\]\\s*(.*)$/s.exec(message);\n if (capMatch) {\n const name = capMatch[1] ?? \"\";\n const rawInput = (capMatch[2] ?? \"\").trim();\n let input: unknown = {};\n if (rawInput.length > 0) {\n try {\n input = JSON.parse(rawInput);\n } catch (err) {\n this.log.warn(\"test-cap input was not valid JSON; defaulting to {}\", {\n error: String(err),\n preview: rawInput.slice(0, 80),\n });\n }\n }\n const events = await this.runCapabilityKeyword(name, input);\n for (const event of events) {\n this.emit(\"agent-event\", event);\n await new Promise((resolve) => setTimeout(resolve, 20));\n }\n this.emit(\"agent-event\", { type: \"agent_end\" });\n return;\n }\n\n const events = buildEchoEvents(content, message);\n for (const event of events) {\n this.emit(\"agent-event\", event);\n // Small gap between events to let the transport process each one\n await new Promise((resolve) => setTimeout(resolve, 50));\n }\n // Signal turn completion — the runner waits for this before accepting\n // the next prompt. Without it, the runner stays stuck after the first message.\n this.emit(\"agent-event\", { type: \"agent_end\" });\n }\n\n /**\n * Phase 7B helper — drive a single capability through the dispatcher and\n * surface the structured outcome as a result event the LLM-side test code\n * can assert against. Used exclusively by the `[test-cap:<name>]` prompt\n * keyword above; never wired into normal chat flow.\n */\n private async runCapabilityKeyword(name: string, input: unknown): Promise<AgentEvent[]> {\n const events: AgentEvent[] = [];\n if (!this.config.capabilities) {\n return textAndResult(`echo[test-cap]: no capability hooks configured (skipping ${name})`);\n }\n try {\n const out = await this.invokeCapabilityForTest(name, input);\n const summary = `echo[test-cap]: invoked ${name} background=${String(out.background)} result=${safeStringify(out.result)}`;\n events.push(...textAndResult(summary));\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err);\n events.push({\n type: \"error\",\n error: `echo[test-cap]: ${name} failed: ${msg}`,\n fatal: false,\n });\n events.push(...textAndResult(`echo[test-cap]: ${name} errored (${msg})`));\n }\n return events;\n }\n\n /**\n * Scripted-flow turn (workspaces#396). Reads the live flow state via the\n * runner-injected `flowTestDriver` hook and executes the scripted next\n * action(s) until the policy yields or emits a turn-ending action. Each\n * mutation fires the adapter's `onChange` (→ host `state_changed`) and, when\n * the runner wires the stimulus bus, queues the follow-up turn — so the\n * driver advances one step at a time exactly like a real LLM orchestrator.\n */\n private async runScriptedFlowTurn(): Promise<void> {\n const hook = this.config.flowTestDriver;\n const script = this.flowScript;\n if (!hook || !script) {\n this.emit(\"agent-event\", { type: \"agent_end\" });\n return;\n }\n\n const executed: string[] = [];\n // Hard cap — the policy is monotonic, but never let a bug spin forever.\n const MAX_STEPS = 200;\n for (let i = 0; i < MAX_STEPS; i++) {\n const state = hook.getState();\n if (!state) break;\n const mandatoryGates = new Set(hook.mandatoryGates?.() ?? []);\n const action = decideFlowAction(state, script, mandatoryGates);\n if (!action) break;\n\n this.emit(\"agent-event\", {\n type: \"tool_call\",\n name: action.op,\n tool: { name: action.op },\n input: action.nodeId,\n });\n try {\n await hook.execute(action.op, actionArgs(action));\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err);\n this.log.warn(\"scripted flow op failed\", {\n op: action.op,\n nodeId: action.nodeId,\n error: msg,\n });\n this.emit(\"agent-event\", {\n type: \"error\",\n error: `echo[test-flow]: ${action.op}(${action.nodeId}) failed: ${msg}`,\n fatal: false,\n });\n break;\n }\n this.emit(\"agent-event\", { type: \"tool_execution_end\", toolName: action.op });\n executed.push(`${action.op}(${action.nodeId})`);\n if (isTurnEnding(action)) break;\n }\n\n const summary =\n executed.length > 0\n ? `echo[test-flow]: ${executed.join(\" → \")}`\n : \"echo[test-flow]: no action (yielding to host)\";\n for (const event of textAndResult(summary)) this.emit(\"agent-event\", event);\n this.emit(\"agent-event\", { type: \"agent_end\" });\n }\n\n async abort(): Promise<void> {\n this.log.info(\"abort requested\");\n }\n\n kill(): void {\n this.running = false;\n this.log.info(\"killed\");\n }\n\n async resetSession(): Promise<void> {\n this.log.info(\"session reset\");\n }\n\n get isRunning(): boolean {\n return this.running;\n }\n}\n\n// ---------------------------------------------------------------------------\n// Echo response generation — mirrors MockAgentClient.buildMockEvents\n// ---------------------------------------------------------------------------\n\n/**\n * A flow turn is recognised by the orchestrator prompt's stable header\n * (`buildOrchestratorPrompt` in the flow connector). Detection is header-only —\n * the driver reads live state through the injected hook, never by parsing the\n * prompt body.\n */\nfunction isFlowTurn(message: string): boolean {\n return message.startsWith(\"# Flow Execution Context\");\n}\n\nfunction safeStringify(v: unknown): string {\n try {\n return JSON.stringify(v);\n } catch {\n return String(v);\n }\n}\n\nfunction textAndResult(summary: string): AgentEvent[] {\n return [\n {\n type: \"message_start\",\n message: { role: \"assistant\", content: summary },\n },\n {\n type: \"message_end\",\n message: { role: \"assistant\", content: summary },\n },\n {\n type: \"result\",\n subtype: \"success\",\n summary,\n costUsd: 0,\n },\n ];\n}\n\nfunction buildEchoEvents(content: string, originalPrompt: string): AgentEvent[] {\n const events: AgentEvent[] = [];\n\n if (content.includes(\"test all\")) {\n events.push(\n { type: \"tool_call\", name: \"Read\", tool: { name: \"Read\" }, input: \"prisma/schema.prisma\" },\n { type: \"tool_execution_end\", toolName: \"Read\" },\n {\n type: \"tool_call\",\n name: \"Write\",\n tool: { name: \"Write\" },\n input: \"src/modules/sprint/sprint.service.ts\",\n },\n { type: \"tool_execution_end\", toolName: \"Write\" },\n );\n events.push(\n ...textAndResult(\n \"All operations completed successfully. Created sprint service, updated schema, started dev server, and ran E2E tests.\",\n ),\n );\n } else if (content.includes(\"test toolcall\")) {\n events.push(\n {\n type: \"tool_call\",\n name: \"Read\",\n tool: { name: \"Read\" },\n input: \"platform/prisma/schema.prisma\",\n },\n { type: \"tool_execution_end\", toolName: \"Read\" },\n );\n events.push(\n ...textAndResult(\n \"I've read the schema and found 42 models. The data model looks well-structured.\",\n ),\n );\n } else if (content.includes(\"test question\")) {\n // Emit a message that asks the user a question (the runner normalizer\n // converts this to a `question` AgentEvent for the transport layer)\n events.push(\n ...textAndResult(\n \"The blueprint calls for a relational database. Which engine should I target? \" +\n \"This will affect the Prisma provider, Docker Compose setup, and the connection string.\\n\\n\" +\n \"Options: PostgreSQL, MySQL, SQLite\",\n ),\n );\n } else if (content.includes(\"test error\")) {\n events.push({\n type: \"error\",\n error:\n \"AI provider returned HTTP 429 — rate limit exceeded. The request will be retried automatically in 35 seconds.\",\n fatal: false,\n });\n } else if (content.includes(\"test fatal\")) {\n events.push({\n type: \"error\",\n error:\n \"Session agent was killed by the container runtime (OOM — memory limit 2 GB exceeded). The session cannot continue.\",\n fatal: true,\n });\n } else {\n // Default echo response\n const summary =\n `I received your message: \"${originalPrompt}\". I'm the Skaile AI assistant running in echo mode. ` +\n `This is a deterministic mock response for E2E testing.`;\n events.push(...textAndResult(summary));\n }\n\n return events;\n}\n\n/**\n * `DriverTarget` wrapper for the echo driver. Registered into the plugin\n * registry by `registerBuiltinDrivers()`.\n */\nexport const echoDriverTarget: DriverTarget<AgentConfig> = {\n id: \"echo\",\n displayName: BUILTIN_DRIVER_CATALOG.echo?.name ?? \"Echo (E2E mock)\",\n apiVersion: 1,\n // Drivers take AgentConfig; passthrough — full schema validation is out of scope.\n configSchema: z.custom<AgentConfig>(() => true),\n create: async (config, _ctx) => new EchoDriver(config),\n listModels: async (apiKeys) =>\n new EchoDriver({ cwd: process.cwd(), sessionId: \"model-list\", apiKeys }).listModels(),\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../bridge/src/drivers/flow-script.ts","../../../bridge/src/drivers/echo.ts"],"names":["events"],"mappings":";;;;;;;;;AA6FA,IAAM,WAAA,uBAAiD,GAAA,CAAI;AAAA,EACzD,kBAAA;AAAA,EACA,eAAA;AAAA,EACA;AACF,CAAC,CAAA;AAGM,SAAS,aAAa,MAAA,EAA6B;AACxD,EAAA,OAAO,WAAA,CAAY,GAAA,CAAI,MAAA,CAAO,EAAE,CAAA;AAClC;AAGO,SAAS,WAAW,MAAA,EAA6C;AACtE,EAAA,QAAQ,OAAO,EAAA;AAAI,IACjB,KAAK,YAAA;AAAA,IACL,KAAK,WAAA;AACH,MAAA,OAAO,EAAE,MAAA,EAAQ,MAAA,CAAO,MAAA,EAAO;AAAA,IACjC,KAAK,eAAA;AACH,MAAA,OAAO,EAAE,MAAA,EAAQ,MAAA,CAAO,MAAA,EAAQ,OAAA,EAAS,OAAO,OAAA,EAAQ;AAAA,IAC1D,KAAK,kBAAA;AACH,MAAA,OAAO,EAAE,MAAA,EAAQ,MAAA,CAAO,MAAA,EAAQ,OAAA,EAAS,OAAO,OAAA,EAAQ;AAAA,IAC1D,KAAK,eAAA;AACH,MAAA,OAAO,EAAE,QAAQ,MAAA,CAAO,MAAA,EAAQ,QAAQ,MAAA,CAAO,MAAA,EAAQ,MAAA,EAAQ,MAAA,CAAO,MAAA,EAAO;AAAA,IAC/E,KAAK,WAAA;AACH,MAAA,OAAO;AAAA,QACL,QAAQ,MAAA,CAAO,MAAA;AAAA,QACf,SAAS,MAAA,CAAO,OAAA;AAAA,QAChB,WAAA,EAAa,MAAA,CAAO,MAAA,CAAO,WAAW;AAAA,OACxC;AAAA;AAEN;AAEA,SAAS,UAAA,CAAW,GAAsB,CAAA,EAA0B;A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AA;AAAA,QACD;AAAA;AAGF,KACF;AAAA,EACF,CAAA,MAAA,IAAW,OAAA,CAAQ,QAAA,CAAS,YAAY,CAAA,EAAG;AACzC,IAAA,MAAA,CAAO,IAAA,CAAK;AAAA,MACV,IAAA,EAAM,OAAA;AAAA,MACN,KAAA,EACE,oHAAA;AAAA,MACF,KAAA,EAAO;AAAA,KACR,CAAA;AAAA,EACH,CAAA,MAAA,IAAW,OAAA,CAAQ,QAAA,CAAS,YAAY,CAAA,EAAG;AACzC,IAAA,MAAA,CAAO,IAAA,CAAK;AAAA,MACV,IAAA,EAAM,OAAA;AAAA,MACN,KAAA,EACE,yHAAA;AAAA,MACF,KAAA,EAAO;AAAA,KACR,CAAA;AAAA,EACH,CAAA,MAAO;AAEL,IAAA,MAAM,OAAA,GACJ,6BAA6B,cAAc,CAAA,2GAAA,CAAA;AAE7C,IAAA,MAAA,CAAO,IAAA,CAAK,GAAG,aAAA,CAAc,OAAO,CAAC,CAAA;AAAA,EACvC;AAEA,EAAA,OAAO,MAAA;AACT;AAMO,IAAM,gBAAA,GAA8C;AAAA,EACzD,EAAA,EAAI,MAAA;AAAA,EACJ,WAAA,EAAa,sBAAA,CAAuB,IAAA,EAAM,IAAA,IAAQ,iBAAA;AAAA,EAClD,UAAA,EAAY,CAAA;AAAA;AAAA,EAEZ,YAAA,EAAgB,CAAA,CAAA,MAAA,CAAoB,MAAM,IAAI,CAAA;AAAA,EAC9C,QAAQ,OAAO,MAAA,EAAQ,IAAA,KAAS,IAAI,WAAW,MAAM,CAAA;AAAA,EACrD,UAAA,EAAY,OAAO,OAAA,KACjB,IAAI,WAAW,EAAE,GAAA,EAAK,OAAA,CAAQ,GAAA,IAAO,SAAA,EAAW,YAAA,EAAc,OAAA,EAAS,EAAE,UAAA;AAC7E","file":"echo.js","sourcesContent":["/**\n * Scripted-flow decision logic for the echo driver.\n *\n * Pure, deterministic policy that maps a live {@link FlowExecution} snapshot\n * (plus an optional per-node script) to the single next flow-adapter mutation\n * the driver should emit this iteration. The echo driver calls this in a loop\n * per turn (see `echo.ts`), executing each returned action against the\n * runner-injected {@link FlowTestDriverHook} until it yields (`null`) or emits\n * a turn-ending action.\n *\n * The policy mirrors what a real LLM orchestrator would do, but without an\n * LLM: it reacts to state each turn, so a host can drive a flow to `complete`,\n * park it at an approval/input gate, and exercise the reject/recover path\n * simply by applying host mutations (`applyApproval`, `applyInput`, …) between\n * turns. No new protocol, no flow-contract change — it only calls the existing\n * FlowAdapter agent-tool operations.\n *\n * @docLink packages/bridge/drivers#scripted-flow\n * @since 3.6.0\n */\n\nimport type { FlowExecution, NodeExecution } from \"@skaile/workspaces/types\";\n\n/**\n * What the scripted driver should do when a node reaches its decision point.\n *\n * - `auto` (default): follow the flow's `autonomousMode` — `complete_node`\n * when autonomous, else `request_approval`. A mandatory approval gate always\n * resolves to `request_approval`, even when autonomous (it cannot be skipped).\n * - `complete`: always `complete_node` (autonomous-style, even if the flow's\n * autonomousMode is false — the adapter allows it only when autonomous, so\n * use with autonomous flows).\n * - `approve`: always `request_approval` (park at an approval gate).\n * - `input`: `request_input` once; after the host applies input, fall back to\n * `auto` behaviour.\n * - `skip`: `skip_node` (optional nodes only).\n * - `fail`: `fail_node`. With `recoverable: false` (default) this is terminal.\n * With `recoverable: true` the node returns to `available`; the driver\n * re-emits the recoverable failure `failCount` times (default 1) and then\n * proceeds as `auto` — it never deadlocks on a recoverable fail.\n */\nexport type OnRun = \"auto\" | \"complete\" | \"approve\" | \"input\" | \"skip\" | \"fail\";\n\n/**\n * What to do when a node returns to `available` after a rejection.\n *\n * - `retry` (default): re-drive it — `start_node` again, then its `onRun`.\n * - `fail`: `fail_node(recoverable: false)` — exercises the terminal path.\n */\nexport type OnReject = \"retry\" | \"fail\";\n\n/** Per-node scripting directive. All fields optional. */\nexport interface FlowNodeDirective {\n onRun?: OnRun;\n onReject?: OnReject;\n /** For `onRun: \"input\"` — the input request shown to the host. */\n input?: { prompt?: string; schema?: unknown };\n /** For `onRun: \"fail\"` — whether the failure is recoverable. Default false. */\n recoverable?: boolean;\n /**\n * For `onRun: \"fail\"` with `recoverable: true` — how many recoverable\n * failures to emit before the node proceeds as `auto`. Default 1. Counted\n * from the node's own `errorHistory`, so the policy stays a pure function of\n * state (no driver-instance bookkeeping) and never deadlocks.\n */\n failCount?: number;\n /** Summary text used for `complete_node` / `request_approval` / failures. */\n summary?: string;\n}\n\n/**\n * A scripted-flow program. Empty (`{}`) means \"canonical policy\": start each\n * available node, then complete (autonomous) or request approval (interactive)\n * — enough to drive the autonomous-complete, approval-gate, and reject/recover\n * scenarios with no per-node scripting at all.\n */\nexport interface FlowScript {\n /** Per-node overrides, keyed by node id. */\n nodes?: Record<string, FlowNodeDirective>;\n /** Fallback directive for any node without its own entry. */\n default?: FlowNodeDirective;\n}\n\n/** A single flow-adapter mutation the driver will execute. */\nexport type FlowAction =\n | { op: \"start_node\"; nodeId: string }\n | { op: \"complete_node\"; nodeId: string; summary: string }\n | { op: \"request_approval\"; nodeId: string; summary: string }\n | { op: \"request_input\"; nodeId: string; prompt: string; schema: string }\n | { op: \"skip_node\"; nodeId: string }\n | { op: \"fail_node\"; nodeId: string; message: string; recoverable: boolean };\n\n/** Ops that end the agent turn (the runner yields until the host acts). */\nconst TURN_ENDING: ReadonlySet<FlowAction[\"op\"]> = new Set([\n \"request_approval\",\n \"request_input\",\n \"fail_node\",\n]);\n\n/** Whether an action ends the turn (driver stops looping after emitting it). */\nexport function isTurnEnding(action: FlowAction): boolean {\n return TURN_ENDING.has(action.op);\n}\n\n/** Map a {@link FlowAction} to the `executeOp` argument bag the adapter expects. */\nexport function actionArgs(action: FlowAction): Record<string, unknown> {\n switch (action.op) {\n case \"start_node\":\n case \"skip_node\":\n return { nodeId: action.nodeId };\n case \"complete_node\":\n return { nodeId: action.nodeId, summary: action.summary };\n case \"request_approval\":\n return { nodeId: action.nodeId, summary: action.summary };\n case \"request_input\":\n return { nodeId: action.nodeId, prompt: action.prompt, schema: action.schema };\n case \"fail_node\":\n return {\n nodeId: action.nodeId,\n message: action.message,\n recoverable: String(action.recoverable),\n };\n }\n}\n\nfunction summaryFor(d: FlowNodeDirective, n: NodeExecution): string {\n return d.summary ?? `Scripted output for ${n.id}`;\n}\n\n/**\n * Decide the single next flow action for the current state, or `null` to yield\n * (nothing to do this iteration — wait for a host mutation).\n *\n * Priority order: resolve approved gates → advance running nodes → start (or\n * skip / terminally-fail) available nodes. Terminal flow states and gates with\n * no decision / input yet yield.\n *\n * Pure — the fail bookkeeping (how many recoverable failures a node has already\n * emitted) is read from the node's own `errorHistory`, so no external counter is\n * needed and a recoverable `fail` directive can never deadlock.\n */\nexport function decideFlowAction(\n state: FlowExecution,\n script: FlowScript,\n mandatoryGates: ReadonlySet<string> = new Set(),\n): FlowAction | null {\n // Terminal flow — never fight a completed/failed/cancelled run.\n if (state.status === \"complete\" || state.status === \"failed\" || state.status === \"cancelled\") {\n return null;\n }\n\n const dir = (id: string): FlowNodeDirective => script.nodes?.[id] ?? script.default ?? {};\n const nodes = Object.values(state.nodes);\n // A mandatory gate can never auto-complete — `auto` resolves to `approve`\n // regardless of autonomousMode so the host can drive it deterministically.\n const canAutoComplete = (id: string): boolean => state.autonomousMode && !mandatoryGates.has(id);\n\n // 1. Approved gate → complete.\n for (const n of nodes) {\n if (n.status === \"awaiting_approval\" && n.approval?.decision === \"approved\") {\n return { op: \"complete_node\", nodeId: n.id, summary: summaryFor(dir(n.id), n) };\n }\n }\n\n // 2. Running node → per directive.\n for (const n of nodes) {\n if (n.status !== \"running\") continue;\n const d = dir(n.id);\n const onRun: OnRun = d.onRun ?? \"auto\";\n const resolved: OnRun =\n onRun === \"auto\" ? (canAutoComplete(n.id) ? \"complete\" : \"approve\") : onRun;\n\n if (resolved === \"complete\") {\n return { op: \"complete_node\", nodeId: n.id, summary: summaryFor(d, n) };\n }\n if (resolved === \"approve\") {\n return { op: \"request_approval\", nodeId: n.id, summary: summaryFor(d, n) };\n }\n if (resolved === \"input\") {\n const lastInput = n.inputHistory[n.inputHistory.length - 1];\n if (lastInput && lastInput.response !== undefined) {\n // Input already provided — proceed as if `auto`.\n return canAutoComplete(n.id)\n ? { op: \"complete_node\", nodeId: n.id, summary: summaryFor(d, n) }\n : { op: \"request_approval\", nodeId: n.id, summary: summaryFor(d, n) };\n }\n return {\n op: \"request_input\",\n nodeId: n.id,\n prompt: d.input?.prompt ?? `Provide input for ${n.id}`,\n schema: JSON.stringify(d.input?.schema ?? { kind: \"text\" }),\n };\n }\n if (resolved === \"fail\") {\n const recoverable = d.recoverable ?? false;\n if (!recoverable) {\n // Terminal fail — the adapter marks node + flow `failed`, so the\n // terminal-status guard above stops any re-fire on later turns.\n return {\n op: \"fail_node\",\n nodeId: n.id,\n message: d.summary ?? `Scripted failure for ${n.id}`,\n recoverable: false,\n };\n }\n // Recoverable fail — emit up to `failCount` times (counting the node's\n // own recorded recoverable errors), then proceed as `auto` so the node\n // is not stranded in a re-drive loop.\n const emitted = n.errorHistory.filter((e) => e.recoverable).length;\n const failCount = Math.max(1, d.failCount ?? 1);\n if (emitted < failCount) {\n return {\n op: \"fail_node\",\n nodeId: n.id,\n message: d.summary ?? `Scripted recoverable failure for ${n.id}`,\n recoverable: true,\n };\n }\n return canAutoComplete(n.id)\n ? { op: \"complete_node\", nodeId: n.id, summary: summaryFor(d, n) }\n : { op: \"request_approval\", nodeId: n.id, summary: summaryFor(d, n) };\n }\n // `skip` while running is illegal; complete instead to avoid a deadlock.\n return { op: \"complete_node\", nodeId: n.id, summary: summaryFor(d, n) };\n }\n\n // 3. Available node → terminally-fail (post-reject), skip, or start.\n for (const n of nodes) {\n if (n.status !== \"available\") continue;\n const d = dir(n.id);\n const lastApproval = n.approvalHistory[n.approvalHistory.length - 1];\n if (lastApproval?.decision === \"rejected\" && d.onReject === \"fail\") {\n return {\n op: \"fail_node\",\n nodeId: n.id,\n message: d.summary ?? `Rejected and not recoverable: ${n.id}`,\n recoverable: false,\n };\n }\n if (d.onRun === \"skip\") {\n return { op: \"skip_node\", nodeId: n.id };\n }\n return { op: \"start_node\", nodeId: n.id };\n }\n\n // 4. Nothing actionable — awaiting_approval (no decision), awaiting_input\n // (no response), or fully drained. Yield.\n return null;\n}\n\n/**\n * Parse a `[test-flow]` sentinel body into a {@link FlowScript}. An empty body\n * yields the canonical (empty) script. Malformed JSON is a hard error so tests\n * fail loudly rather than silently running the wrong policy.\n */\nexport function parseFlowScript(body: string): FlowScript {\n const trimmed = body.trim();\n if (trimmed.length === 0) return {};\n const parsed: unknown = JSON.parse(trimmed);\n if (parsed === null || typeof parsed !== \"object\" || Array.isArray(parsed)) {\n throw new Error(\"flow script must be a JSON object\");\n }\n return parsed as FlowScript;\n}\n","import type { DriverTarget } from \"@skaile/workspaces/plugin-registry\";\nimport type { Logger } from \"@skaile/workspaces/types\";\nimport * as z from \"zod\";\nimport { dispatchCapability } from \"../capability-dispatch.js\";\nimport { getBridgeLogger } from \"../logger.js\";\nimport { BUILTIN_DRIVER_CATALOG } from \"../registry.js\";\nimport {\n type AgentConfig,\n AgentDriver,\n type AgentEvent,\n type BridgeCapabilityTool,\n type DriverInfo,\n} from \"../types.js\";\nimport {\n actionArgs,\n type FlowScript,\n decideFlowAction,\n isTurnEnding,\n parseFlowScript,\n} from \"./flow-script.js\";\n\n/**\n * Echo/mock driver for E2E testing in docker mode.\n *\n * Runs inside a real Docker container with real WebSocket transport and\n * session lifecycle, but generates deterministic keyword-triggered responses\n * instead of calling the Anthropic API. This lets E2E tests exercise the\n * full infrastructure (containers, WebSocket, session management, message\n * persistence) without needing real AI credentials.\n *\n * Keyword triggers match the MockAgentClient in\n * `platform/backend/libs/agent-gateway/src/mock-agent-client.ts` — the\n * same test messages (\"test toolcall\", \"test question\", etc.) produce\n * the same events.\n *\n * Enable by setting `SKAILE_AGENT_DRIVER=echo` in the container env,\n * or by passing `{ driver: 'echo' }` in the runner config.\n *\n * @docLink packages/bridge/drivers#echo-driver\n */\nexport class EchoDriver extends AgentDriver {\n readonly driverInfo: DriverInfo = {\n id: \"echo\",\n name: \"Echo (E2E mock)\",\n modelAgnostic: true,\n supportsInBandAbort: false,\n };\n\n private readonly log: Logger = getBridgeLogger(\"echo\");\n private running = false;\n private readonly config: AgentConfig;\n\n /**\n * Scripted-flow mode state (workspaces#396). Enabled by a `[test-flow]`\n * sentinel chat message; once on, orchestrator-prompt turns are driven\n * deterministically against `config.flowTestDriver`. `null` script ⇒ mode\n * off (default echo behaviour, unchanged).\n */\n private flowScript: FlowScript | null = null;\n\n constructor(config: AgentConfig) {\n super();\n this.config = config;\n }\n\n /**\n * Test surface: returns the tool list the LLM would see for this turn.\n * Composition: the registry hooks (Protocol v2) take precedence; legacy\n * `mcpServers` is not enumerated here (the echo driver never exposed MCP\n * tools to the LLM by name).\n */\n listCapabilityTools(): BridgeCapabilityTool[] {\n return this.config.capabilities?.composeTools() ?? [];\n }\n\n /**\n * Test surface: invoke a registered capability through the dispatch\n * helper. Mirrors what a real driver would do when the LLM produced a\n * tool_use for the given name — applies fire-and-forget, render emission,\n * and fallback text. Returns the structured dispatch result so tests can\n * assert immediate-vs-background resolution.\n */\n async invokeCapabilityForTest(\n name: string,\n input: unknown,\n ): Promise<{ result: unknown; background: boolean }> {\n const hooks = this.config.capabilities;\n if (!hooks) throw new Error(\"EchoDriver: no capability hooks configured\");\n const callId = `echo-cap-${Date.now()}`;\n const out = await dispatchCapability(hooks, callId, name, input, (err) =>\n this.log.warn(\"background capability handler failed\", {\n name,\n error: String(err),\n }),\n );\n return out;\n }\n\n async start(): Promise<void> {\n this.running = true;\n this.log.info(\"driver started\");\n }\n\n async prompt(message: string): Promise<void> {\n if (!this.running) return;\n const content = message.toLowerCase();\n this.log.info(\"received prompt\", { preview: message.slice(0, 80), length: message.length });\n\n // Small delay to simulate real agent processing\n await new Promise((resolve) => setTimeout(resolve, 200));\n\n // Scripted-flow test seam (workspaces#396) — a `[test-flow]` sentinel\n // arms deterministic flow driving for this session and (optionally)\n // carries a JSON script. Format: `[test-flow] {json}`; empty body ⇒\n // canonical policy. Must be handled before the flow-turn branch below.\n //\n // Detection is LINE-anchored, not message-anchored (workspaces#401): hosts\n // decorate user messages (e.g. a prepended `<SESSION_MEMBERS>` block and a\n // wake-restoration preamble), so the sentinel is rarely at the start of the\n // composed prompt. We match `[test-flow]` at the start of ANY line (only\n // leading whitespace allowed), which is decoration-independent yet still\n // impossible to arm from ordinary prose — a line must BEGIN with the exact\n // token. The optional JSON script must sit on that same line.\n const flowMatch = /^[ \\t]*\\[test-flow\\][ \\t]*(.*)$/m.exec(message);\n if (flowMatch) {\n let summary: string;\n try {\n this.flowScript = parseFlowScript(flowMatch[1] ?? \"\");\n summary = \"echo[test-flow]: scripted-flow mode armed\";\n } catch (err) {\n this.flowScript = null;\n summary = `echo[test-flow]: invalid script — ${err instanceof Error ? err.message : String(err)}`;\n this.emit(\"agent-event\", { type: \"error\", error: summary, fatal: false });\n }\n for (const event of textAndResult(summary)) this.emit(\"agent-event\", event);\n this.emit(\"agent-event\", { type: \"agent_end\" });\n return;\n }\n\n // Scripted-flow turn — the runner reassembles the orchestrator prompt on\n // every flow turn; when scripted-flow mode is armed and a flow driver hook\n // is present, drive nodes deterministically instead of echoing text.\n if (this.flowScript && this.config.flowTestDriver && isFlowTurn(message)) {\n await this.runScriptedFlowTurn();\n return;\n }\n\n // Phase 7B test seam — explicit capability invocation keyword. Lets E2E\n // tests drive `dispatchCapability` from a chat prompt without a real LLM.\n // Format: `[test-cap:<name>] {json}`, LINE-anchored like `[test-flow]` above\n // because hosts decorate user messages. Both flags are load-bearing and are\n // pinned by tests: no `s` (dotAll swallows the host's closing tag into the\n // JSON body), and `[ \\t]` not `\\s` (`\\s` un-anchors the token from its line).\n const capMatch = /^[ \\t]*\\[test-cap:([\\w.\\-_]+)\\][ \\t]*(.*)$/m.exec(message);\n if (capMatch) {\n const name = capMatch[1] ?? \"\";\n const rawInput = (capMatch[2] ?? \"\").trim();\n let input: unknown = {};\n if (rawInput.length > 0) {\n try {\n input = JSON.parse(rawInput);\n } catch (err) {\n this.log.warn(\"test-cap input was not valid JSON; defaulting to {}\", {\n error: String(err),\n preview: rawInput.slice(0, 80),\n });\n }\n }\n const events = await this.runCapabilityKeyword(name, input);\n for (const event of events) {\n this.emit(\"agent-event\", event);\n await new Promise((resolve) => setTimeout(resolve, 20));\n }\n this.emit(\"agent-event\", { type: \"agent_end\" });\n return;\n }\n\n const events = buildEchoEvents(content, message);\n for (const event of events) {\n this.emit(\"agent-event\", event);\n // Small gap between events to let the transport process each one\n await new Promise((resolve) => setTimeout(resolve, 50));\n }\n // Signal turn completion — the runner waits for this before accepting\n // the next prompt. Without it, the runner stays stuck after the first message.\n this.emit(\"agent-event\", { type: \"agent_end\" });\n }\n\n /**\n * Phase 7B helper — drive a single capability through the dispatcher and\n * surface the structured outcome as a result event the LLM-side test code\n * can assert against. Used exclusively by the `[test-cap:<name>]` prompt\n * keyword above; never wired into normal chat flow.\n */\n private async runCapabilityKeyword(name: string, input: unknown): Promise<AgentEvent[]> {\n const events: AgentEvent[] = [];\n if (!this.config.capabilities) {\n return textAndResult(`echo[test-cap]: no capability hooks configured (skipping ${name})`);\n }\n try {\n const out = await this.invokeCapabilityForTest(name, input);\n const summary = `echo[test-cap]: invoked ${name} input=${safeStringify(input)} background=${String(out.background)} result=${safeStringify(out.result)}`;\n events.push(...textAndResult(summary));\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err);\n events.push({\n type: \"error\",\n error: `echo[test-cap]: ${name} failed: ${msg}`,\n fatal: false,\n });\n events.push(...textAndResult(`echo[test-cap]: ${name} errored (${msg})`));\n }\n return events;\n }\n\n /**\n * Scripted-flow turn (workspaces#396). Reads the live flow state via the\n * runner-injected `flowTestDriver` hook and executes the scripted next\n * action(s) until the policy yields or emits a turn-ending action. Each\n * mutation fires the adapter's `onChange` (→ host `state_changed`) and, when\n * the runner wires the stimulus bus, queues the follow-up turn — so the\n * driver advances one step at a time exactly like a real LLM orchestrator.\n */\n private async runScriptedFlowTurn(): Promise<void> {\n const hook = this.config.flowTestDriver;\n const script = this.flowScript;\n if (!hook || !script) {\n this.emit(\"agent-event\", { type: \"agent_end\" });\n return;\n }\n\n const executed: string[] = [];\n // Hard cap — the policy is monotonic, but never let a bug spin forever.\n const MAX_STEPS = 200;\n for (let i = 0; i < MAX_STEPS; i++) {\n const state = hook.getState();\n if (!state) break;\n const mandatoryGates = new Set(hook.mandatoryGates?.() ?? []);\n const action = decideFlowAction(state, script, mandatoryGates);\n if (!action) break;\n\n this.emit(\"agent-event\", {\n type: \"tool_call\",\n name: action.op,\n tool: { name: action.op },\n input: action.nodeId,\n });\n try {\n await hook.execute(action.op, actionArgs(action));\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err);\n this.log.warn(\"scripted flow op failed\", {\n op: action.op,\n nodeId: action.nodeId,\n error: msg,\n });\n this.emit(\"agent-event\", {\n type: \"error\",\n error: `echo[test-flow]: ${action.op}(${action.nodeId}) failed: ${msg}`,\n fatal: false,\n });\n break;\n }\n this.emit(\"agent-event\", { type: \"tool_execution_end\", toolName: action.op });\n executed.push(`${action.op}(${action.nodeId})`);\n if (isTurnEnding(action)) break;\n }\n\n const summary =\n executed.length > 0\n ? `echo[test-flow]: ${executed.join(\" → \")}`\n : \"echo[test-flow]: no action (yielding to host)\";\n for (const event of textAndResult(summary)) this.emit(\"agent-event\", event);\n this.emit(\"agent-event\", { type: \"agent_end\" });\n }\n\n async abort(): Promise<void> {\n this.log.info(\"abort requested\");\n }\n\n kill(): void {\n this.running = false;\n this.log.info(\"killed\");\n }\n\n async resetSession(): Promise<void> {\n this.log.info(\"session reset\");\n }\n\n get isRunning(): boolean {\n return this.running;\n }\n}\n\n// ---------------------------------------------------------------------------\n// Echo response generation — mirrors MockAgentClient.buildMockEvents\n// ---------------------------------------------------------------------------\n\n/**\n * A flow turn is recognised by the orchestrator prompt's stable header\n * (`buildOrchestratorPrompt` in the flow connector). Detection is header-only —\n * the driver reads live state through the injected hook, never by parsing the\n * prompt body.\n */\nfunction isFlowTurn(message: string): boolean {\n return message.startsWith(\"# Flow Execution Context\");\n}\n\nfunction safeStringify(v: unknown): string {\n try {\n return JSON.stringify(v);\n } catch {\n return String(v);\n }\n}\n\nfunction textAndResult(summary: string): AgentEvent[] {\n return [\n {\n type: \"message_start\",\n message: { role: \"assistant\", content: summary },\n },\n {\n type: \"message_end\",\n message: { role: \"assistant\", content: summary },\n },\n {\n type: \"result\",\n subtype: \"success\",\n summary,\n costUsd: 0,\n },\n ];\n}\n\nfunction buildEchoEvents(content: string, originalPrompt: string): AgentEvent[] {\n const events: AgentEvent[] = [];\n\n if (content.includes(\"test all\")) {\n events.push(\n { type: \"tool_call\", name: \"Read\", tool: { name: \"Read\" }, input: \"prisma/schema.prisma\" },\n { type: \"tool_execution_end\", toolName: \"Read\" },\n {\n type: \"tool_call\",\n name: \"Write\",\n tool: { name: \"Write\" },\n input: \"src/modules/sprint/sprint.service.ts\",\n },\n { type: \"tool_execution_end\", toolName: \"Write\" },\n );\n events.push(\n ...textAndResult(\n \"All operations completed successfully. Created sprint service, updated schema, started dev server, and ran E2E tests.\",\n ),\n );\n } else if (content.includes(\"test toolcall\")) {\n events.push(\n {\n type: \"tool_call\",\n name: \"Read\",\n tool: { name: \"Read\" },\n input: \"platform/prisma/schema.prisma\",\n },\n { type: \"tool_execution_end\", toolName: \"Read\" },\n );\n events.push(\n ...textAndResult(\n \"I've read the schema and found 42 models. The data model looks well-structured.\",\n ),\n );\n } else if (content.includes(\"test question\")) {\n // Emit a message that asks the user a question (the runner normalizer\n // converts this to a `question` AgentEvent for the transport layer)\n events.push(\n ...textAndResult(\n \"The blueprint calls for a relational database. Which engine should I target? \" +\n \"This will affect the Prisma provider, Docker Compose setup, and the connection string.\\n\\n\" +\n \"Options: PostgreSQL, MySQL, SQLite\",\n ),\n );\n } else if (content.includes(\"test error\")) {\n events.push({\n type: \"error\",\n error:\n \"AI provider returned HTTP 429 — rate limit exceeded. The request will be retried automatically in 35 seconds.\",\n fatal: false,\n });\n } else if (content.includes(\"test fatal\")) {\n events.push({\n type: \"error\",\n error:\n \"Session agent was killed by the container runtime (OOM — memory limit 2 GB exceeded). The session cannot continue.\",\n fatal: true,\n });\n } else {\n // Default echo response\n const summary =\n `I received your message: \"${originalPrompt}\". I'm the Skaile AI assistant running in echo mode. ` +\n `This is a deterministic mock response for E2E testing.`;\n events.push(...textAndResult(summary));\n }\n\n return events;\n}\n\n/**\n * `DriverTarget` wrapper for the echo driver. Registered into the plugin\n * registry by `registerBuiltinDrivers()`.\n */\nexport const echoDriverTarget: DriverTarget<AgentConfig> = {\n id: \"echo\",\n displayName: BUILTIN_DRIVER_CATALOG.echo?.name ?? \"Echo (E2E mock)\",\n apiVersion: 1,\n // Drivers take AgentConfig; passthrough — full schema validation is out of scope.\n configSchema: z.custom<AgentConfig>(() => true),\n create: async (config, _ctx) => new EchoDriver(config),\n listModels: async (apiKeys) =>\n new EchoDriver({ cwd: process.cwd(), sessionId: \"model-list\", apiKeys }).listModels(),\n};\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { GeminiDriver, GeminiFamilyDriver, geminiDriverTarget } from '../../chunk-
|
|
2
|
-
import '../../chunk-
|
|
1
|
+
export { GeminiDriver, GeminiFamilyDriver, geminiDriverTarget } from '../../chunk-NIQPSQFN.js';
|
|
2
|
+
import '../../chunk-VT4MPCRK.js';
|
|
3
3
|
import '../../chunk-GURXUF2J.js';
|
|
4
4
|
import '../../chunk-GAH4YRCI.js';
|
|
5
|
-
import '../../chunk-
|
|
5
|
+
import '../../chunk-FRER2PEN.js';
|
|
6
6
|
import '../../chunk-6E6PKKAD.js';
|
|
7
7
|
import '../../chunk-FTG7CRFD.js';
|
|
8
8
|
import '../../chunk-W4IPN3DD.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { SubprocessCliDriver, mapApiKeysToEnv, extractText, extractCost, extractTokens } from '../../chunk-
|
|
1
|
+
import { SubprocessCliDriver, mapApiKeysToEnv, extractText, extractCost, extractTokens } from '../../chunk-VT4MPCRK.js';
|
|
2
2
|
import '../../chunk-GAH4YRCI.js';
|
|
3
|
-
import { BUILTIN_DRIVER_CATALOG, getBridgeLogger } from '../../chunk-
|
|
3
|
+
import { BUILTIN_DRIVER_CATALOG, getBridgeLogger } from '../../chunk-FRER2PEN.js';
|
|
4
4
|
import '../../chunk-6E6PKKAD.js';
|
|
5
5
|
import '../../chunk-FTG7CRFD.js';
|
|
6
6
|
import '../../chunk-W4IPN3DD.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { classifyGenericErrorMessage } from '../../chunk-GAH4YRCI.js';
|
|
2
|
-
import { BUILTIN_DRIVER_CATALOG, AgentDriver, getBridgeLogger } from '../../chunk-
|
|
2
|
+
import { BUILTIN_DRIVER_CATALOG, AgentDriver, getBridgeLogger } from '../../chunk-FRER2PEN.js';
|
|
3
3
|
import '../../chunk-6E6PKKAD.js';
|
|
4
4
|
import '../../chunk-FTG7CRFD.js';
|
|
5
5
|
import '../../chunk-W4IPN3DD.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { SubprocessCliDriver, mapApiKeysToEnv, extractText, extractCost, extractTokens } from '../../chunk-
|
|
1
|
+
import { SubprocessCliDriver, mapApiKeysToEnv, extractText, extractCost, extractTokens } from '../../chunk-VT4MPCRK.js';
|
|
2
2
|
import '../../chunk-GAH4YRCI.js';
|
|
3
|
-
import { BUILTIN_DRIVER_CATALOG, getBridgeLogger } from '../../chunk-
|
|
3
|
+
import { BUILTIN_DRIVER_CATALOG, getBridgeLogger } from '../../chunk-FRER2PEN.js';
|
|
4
4
|
import '../../chunk-6E6PKKAD.js';
|
|
5
5
|
import '../../chunk-FTG7CRFD.js';
|
|
6
6
|
import '../../chunk-W4IPN3DD.js';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { GeminiFamilyDriver } from '../../chunk-
|
|
2
|
-
import '../../chunk-
|
|
1
|
+
import { GeminiFamilyDriver } from '../../chunk-NIQPSQFN.js';
|
|
2
|
+
import '../../chunk-VT4MPCRK.js';
|
|
3
3
|
import { fetchProviderModels } from '../../chunk-GURXUF2J.js';
|
|
4
4
|
import '../../chunk-GAH4YRCI.js';
|
|
5
|
-
import { BUILTIN_DRIVER_CATALOG, getBridgeLogger } from '../../chunk-
|
|
5
|
+
import { BUILTIN_DRIVER_CATALOG, getBridgeLogger } from '../../chunk-FRER2PEN.js';
|
|
6
6
|
import '../../chunk-6E6PKKAD.js';
|
|
7
7
|
import '../../chunk-FTG7CRFD.js';
|
|
8
8
|
import '../../chunk-W4IPN3DD.js';
|
package/dist/bridge/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { BridgeRuntime, EventNormalizer, createRuntime, detectFileChange, detectFileChanges, summarizeToolCall, summarizeToolResult, validateApiKey } from '../chunk-
|
|
1
|
+
export { BridgeRuntime, EventNormalizer, createRuntime, detectFileChange, detectFileChanges, summarizeToolCall, summarizeToolResult, validateApiKey } from '../chunk-PBRMY64S.js';
|
|
2
2
|
export { CLOUD_SECRET_ENV_KEYS, SUPPORTED_CLOUDS, buildClaudeCloudEnv, probeResumeTranscript, resolveClaudeConfigDir } from '../chunk-3NCGSSCU.js';
|
|
3
3
|
export { dispatchCapability, filterRenderCapabilities, renderFallback } from '../chunk-RRVQAE5D.js';
|
|
4
4
|
export { ModelTierResolutionError, PROVIDER_ENDPOINTS, PROVIDER_MODEL_TIERS, STATIC_MODELS, fetchProviderModels, getModels, getStaticModels, resolveModelTier, resolveProviderModelsUrl } from '../chunk-GURXUF2J.js';
|
|
5
5
|
export { AccountUnavailableError, AuthError, classifyClaudeSdkError, reclassifyAuthAsAccountUnavailable } from '../chunk-GAH4YRCI.js';
|
|
6
|
-
export { AgentDriver, BUILTIN_DRIVER_CATALOG, DRIVER_CATALOG, createDriver, getBridgeLogger, listDrivers, listModelsForDriver, registerBuiltinDrivers } from '../chunk-
|
|
6
|
+
export { AgentDriver, BUILTIN_DRIVER_CATALOG, DRIVER_CATALOG, createDriver, getBridgeLogger, listDrivers, listModelsForDriver, registerBuiltinDrivers } from '../chunk-FRER2PEN.js';
|
|
7
7
|
import '../chunk-6E6PKKAD.js';
|
|
8
8
|
import '../chunk-CIPK5JMJ.js';
|
|
9
9
|
import '../chunk-F3HNW354.js';
|
|
@@ -65,6 +65,18 @@ export declare class ClaudeSdkDriver extends AgentDriver {
|
|
|
65
65
|
* ceiling. See {@link armTurnStallWatchdog}.
|
|
66
66
|
*/
|
|
67
67
|
private firstSdkMessageSeen;
|
|
68
|
+
/** When the live query was spawned — the origin for the first-message timing. */
|
|
69
|
+
private queryStartedAt;
|
|
70
|
+
/**
|
|
71
|
+
* One-shot: armed at each spawn, disarmed by the first message of THAT spawn.
|
|
72
|
+
* Deliberately not `firstSdkMessageSeen`, which the stall watchdog resets every
|
|
73
|
+
* turn — a resident query serves turns 2..N without re-spawning, so reusing it
|
|
74
|
+
* would measure from the original spawn and report the idle time between turns
|
|
75
|
+
* as SDK latency.
|
|
76
|
+
*/
|
|
77
|
+
private awaitingFirstMessageOfSpawn;
|
|
78
|
+
/** What the spawn actually resumed, captured before a fallback can clear it. */
|
|
79
|
+
private spawnResumed;
|
|
68
80
|
/**
|
|
69
81
|
* `num_turns` reported by the most recent result message. Feeds
|
|
70
82
|
* {@link shouldRecycleQuery}; reset on every fresh spawn.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude-sdk.d.ts","sourceRoot":"","sources":["../../../../bridge/src/drivers/claude-sdk.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAU,eAAe,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAUpF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAUvE,OAAO,EAAuB,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAEpE,OAAO,EACL,KAAK,WAAW,EAChB,WAAW,EAKX,KAAK,UAAU,EAGf,KAAK,gBAAgB,EAEtB,MAAM,aAAa,CAAC;AA6UrB,6FAA6F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,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAqF5C;;;;;OAKG;YACW,oBAAoB;IAqBlC;;;;;;;OAOG;YACW,mBAAmB;IAqD3B,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5B,IAAI,IAAI,IAAI;IAKN,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAInC,IAAI,SAAS,IAAI,OAAO,CAEvB;CACF;AAiHD;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,YAAY,CAAC,WAAW,CAStD,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { logErr, logOk, colorRef, logInfo, S, logWarn, formatSoftDepHint } from './chunk-
|
|
2
|
-
import { AssetManager } from './chunk-
|
|
1
|
+
import { logErr, logOk, colorRef, logInfo, S, logWarn, formatSoftDepHint } from './chunk-EO7IJY3Q.js';
|
|
2
|
+
import { AssetManager } from './chunk-SWUVULBU.js';
|
|
3
3
|
import { readLock } from './chunk-CIPK5JMJ.js';
|
|
4
4
|
import { SUPPORTED_DRIVER_TARGETS } from './chunk-MENCWIHW.js';
|
|
5
5
|
import { parseAssetRef } from './chunk-GEEW6SY2.js';
|
|
@@ -82,7 +82,7 @@ async function runRefInstall(ref, opts) {
|
|
|
82
82
|
const spinner2 = p.spinner();
|
|
83
83
|
spinner2.start(`Installing ${ref}`);
|
|
84
84
|
try {
|
|
85
|
-
const { openCatalogSource, openLibrary } = await import('./open-library-
|
|
85
|
+
const { openCatalogSource, openLibrary } = await import('./open-library-HH5LST7Z.js');
|
|
86
86
|
const catalog = await openCatalogSource({ projectDir: path.resolve(opts.projectDir) });
|
|
87
87
|
if (!supportsInstallManifest(catalog)) {
|
|
88
88
|
throw new Error(
|
|
@@ -122,7 +122,7 @@ async function runYamlInstall(opts) {
|
|
|
122
122
|
return;
|
|
123
123
|
}
|
|
124
124
|
try {
|
|
125
|
-
const { ensureSourcesCloned } = await import('./ensure-sources-
|
|
125
|
+
const { ensureSourcesCloned } = await import('./ensure-sources-4GBXK6UR.js');
|
|
126
126
|
const hydrate = ensureSourcesCloned(projectDir, { quiet: true });
|
|
127
127
|
if (hydrate.cloned.length > 0) {
|
|
128
128
|
logOk(`Cloned source(s): ${hydrate.cloned.join(", ")}`);
|
|
@@ -288,5 +288,5 @@ function makeCleanCommand() {
|
|
|
288
288
|
}
|
|
289
289
|
|
|
290
290
|
export { makeCheckCommand, makeCleanCommand, makeInstallCommand, reportInstalledSoftDeps, runPointerOnlyInstall, supportsInstallManifest };
|
|
291
|
-
//# sourceMappingURL=chunk-
|
|
292
|
-
//# sourceMappingURL=chunk-
|
|
291
|
+
//# sourceMappingURL=chunk-CMGYUF5P.js.map
|
|
292
|
+
//# sourceMappingURL=chunk-CMGYUF5P.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../cli/src/commands/project.ts"],"names":["spinner","confirm"],"mappings":";;;;;;;;;AAmBA,IAAM,QAAA,GAAW,uEAAA;AAGjB,SAAS,gBAAgB,GAAA,EAAsB;AAC7C,EAAA,IAAI;AACF,IAAA,aAAA,CAAc,GAAG,CAAA;AACjB,IAAA,OAAO,IAAA;AAAA,EACT,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,KAAA;AAAA,EACT;AACF;AAqBO,SAAS,wBAAwB,MAAA,EAAkD;AACxF,EAAA,OACE,OAAQ,QAAgE,kBAAA,KACxE,UAAA;AAEJ;AAwCA,eAAsB,qBAAA,CACpB,KACA,IAAA,EACmC;AACnC,EAAA,IAAI,SAAA;AACJ,EAAA,IAAI;AACF,IAAA,SAAA,GAAY,cAAc,GAAG,CAAA;AAAA,EAC/B,SAAS,CAAA,EAAG;AACV,IAAA,MAAM,IAAI,KAAA;AAAA,MACR,CAAA,qBAAA,EAAwB,GAAG,CAAA,kBAAA,EAAgB,QAAQ,CAAA,EAAA,EAAK,CAAA,YAAa,KAAA,GAAQ,CAAA,CAAE,OAAA,GAAU,MAAA,CAAO,CAAC,CAAC,CAAA;AAAA,KAC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AAE,CAAA;AAAA,MAC/B;AAAA,IACF;AACA,IAAA,IAAI,KAAK,GAAA,EAAK;AACZ,MAAA,OAAA,CAAQ,GAAA,EAAI;AACZ,MAAA,KAAA,CAAM,sBAAsB,CAAA;AAAA,IAC9B;AAAA,EACF,CAAC,CAAA;AACL","file":"chunk-PCDNZROC.js","sourcesContent":["import path from \"node:path\";\nimport * as p from \"@clack/prompts\";\nimport { AssetManager } from \"@skaile/workspaces/asset-manager\";\nimport {\n type DriverTarget,\n parseAssetRef,\n readLock,\n SUPPORTED_DRIVER_TARGETS,\n} from \"@skaile/workspaces/core\";\nimport type { InstallManifest } from \"@skaile/workspaces/types\";\nimport { Command } from \"commander\";\nimport { colorRef, formatSoftDepHint, logErr, logInfo, logOk, logWarn, S } from \"../helpers.ts\";\n\n/**\n * Canonical asset-ref shape accepted by `skaile install <ref>`:\n * `kind:@<publisher>/<name>#<version>` (the `#` version sigil). Validated via\n * `parseAssetRef` so the CLI shares the single canonical grammar; the legacy\n * trailing-`@version` shape is rejected.\n */\nconst REF_HINT = \"kind:@<publisher>/<name>#<version> (e.g. skill:@skaile/use-exa#1.0.0)\";\n\n/** True when `ref` parses as a canonical asset ref. */\nfunction isValidAssetRef(ref: string): boolean {\n try {\n parseAssetRef(ref);\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Minimal catalog-source surface the pointer-only install path needs.\n * `RemoteCatalogSource` satisfies this — narrowing keeps {@link runPointerOnlyInstall}\n * testable with a hand-rolled stub.\n */\nexport interface InstallManifestSource {\n getInstallManifest(ref: string): Promise<InstallManifest>;\n}\n\n/**\n * Capability check: is this catalog source able to serve install manifests?\n *\n * `openCatalogSource` returns a `RemoteCatalogSource | RestCatalogSource`.\n * Only the tRPC-framed `RemoteCatalogSource` implements `getInstallManifest`;\n * the REST-framed `RestCatalogSource` (the default for any catalog URL other\n * than `https://skaile.store`) does not. Calling it unconditionally would be a\n * runtime `TypeError`, so the pointer-only install path must capability-detect\n * first and fail with a clear, actionable message.\n */\nexport function supportsInstallManifest(source: unknown): source is InstallManifestSource {\n return (\n typeof (source as { getInstallManifest?: unknown } | null | undefined)?.getInstallManifest ===\n \"function\"\n );\n}\n\n/**\n * Minimal library surface the pointer-only install path needs.\n * `LocalIndex` satisfies this.\n */\nexport interface InstallLibrary {\n install(manifest: InstallManifest): Promise<{ installPath: string }>;\n}\n\n/**\n * Result of a pointer-only catalog install.\n */\nexport interface PointerOnlyInstallResult {\n /** Absolute path the verified asset bytes were written to. */\n installPath: string;\n /** The pinned upstream commit SHA the asset was fetched at. */\n commitSha: string;\n /** Number of files in the install manifest. */\n fileCount: number;\n}\n\n/**\n * Pointer-only catalog install — the `skaile install <ref>` code path.\n *\n * 1. Resolves the pointer-only {@link InstallManifest} from the Catalog.\n * 2. Hands it to the library, which fetches each file's bytes directly from\n * the upstream repo at the pinned commit, verifies every per-file SHA256\n * plus the composite SHA256, and only then writes the verified files.\n *\n * Both dependencies are injected so the function is unit-testable without a\n * network round-trip. In production the CLI passes a `RemoteCatalogSource`\n * and a `LocalIndex`.\n *\n * @param ref - Asset ref (`<publisher>/<name>@<version>`, optional leading `@`).\n * @param deps - Injected catalog source + library.\n * @returns The install path, pinned commit SHA, and file count.\n * @throws When the ref is malformed, the manifest cannot be resolved, or any\n * hash verification fails. The underlying error message is surfaced as-is.\n */\nexport async function runPointerOnlyInstall(\n ref: string,\n deps: { catalog: InstallManifestSource; library: InstallLibrary },\n): Promise<PointerOnlyInstallResult> {\n let requested: ReturnType<typeof parseAssetRef>;\n try {\n requested = parseAssetRef(ref);\n } catch (e) {\n throw new Error(\n `malformed asset ref '${ref}' — expected ${REF_HINT}: ${e instanceof Error ? e.message : String(e)}`,\n );\n }\n const manifest = await deps.catalog.getInstallManifest(ref);\n // [M1] Identity check: the catalog must not install a different asset than\n // requested. Compare the PARSED refs (kind/publisher/name/pin) so equivalent\n // spellings (optional `kind:`, default `skill`) are treated as the same ref.\n const got = parseAssetRef(manifest.ref);\n if (\n got.kind !== requested.kind ||\n got.publisher !== requested.publisher ||\n got.name !== requested.name ||\n got.pin !== requested.pin\n ) {\n throw new Error(\n `catalog identity mismatch: requested '${ref}' but the catalog returned a manifest for '${manifest.ref}'`,\n );\n }\n const { installPath } = await deps.library.install(manifest);\n return {\n installPath,\n commitSha: manifest.source.commitSha,\n fileCount: manifest.files.length,\n };\n}\n\n/**\n * Creates the `skaile install` command.\n *\n * Two modes, selected by argument shape:\n *\n * - `skaile install` (no positional arg) — reads `skaile.yaml` and deploys all\n * declared assets (and their transitive dependencies) to the configured\n * driver target directory. Supports `--locked` for CI-mode install from a\n * lock file.\n * - `skaile install <publisher>/<name>@<version>` — pointer-only catalog\n * install: resolves the pointer-only install manifest from the configured\n * Catalog, fetches each file's bytes directly from the upstream repo at the\n * pinned commit, verifies every per-file + the composite SHA256, then writes\n * the verified files into the local Library.\n *\n * @returns Configured {@link Command} ready for `program.addCommand()`.\n * @docLink cli/commands/project#make-install-command\n */\nexport function makeInstallCommand(): Command {\n return new Command(\"install\")\n .description(`Install dependencies from skaile.yaml, or a single asset by ref (${REF_HINT})`)\n .argument(\"[ref]\", `Asset ref to install from the Catalog (${REF_HINT})`)\n .option(\"--locked\", \"Install from lock file (CI mode — fails on drift)\")\n .option(\"--project-dir <path>\", \"Project directory\", process.cwd())\n .option(\"--target <agent>\", \"Agent framework\", \"claude-code\")\n .option(\n \"--global\",\n \"Install the global SSOT (~/.skaile/skaile.yaml), fanning out to every global backend\",\n )\n .option(\n \"--backend <ids>\",\n \"Comma-separated global backends to install into (default: all resolved); implies --global\",\n )\n .option(\n \"--link\",\n \"symlink local-path assets instead of copying (dev loop; machine-local, not for committing)\",\n )\n .action(runInstallCommand);\n}\n\n/** Options shape accepted by the `skaile install` command action. */\ninterface InstallCommandOptions {\n locked?: boolean;\n projectDir: string;\n target: string;\n global?: boolean;\n backend?: string;\n link?: boolean;\n}\n\n/**\n * Parse a `--backend a,b` value into validated {@link DriverTarget}s, exiting on\n * an unknown id. Returns `undefined` when the flag is absent (resolve the full\n * global set instead).\n */\nfunction parseBackendFilter(raw: string | undefined): DriverTarget[] | undefined {\n if (!raw) return undefined;\n const ids = raw\n .split(\",\")\n .map((s) => s.trim())\n .filter(Boolean);\n const out: DriverTarget[] = [];\n for (const id of ids) {\n if (!(SUPPORTED_DRIVER_TARGETS as string[]).includes(id)) {\n logErr(`unknown backend '${id}' — expected one of: ${SUPPORTED_DRIVER_TARGETS.join(\", \")}`);\n process.exit(1);\n }\n out.push(id as DriverTarget);\n }\n return out.length > 0 ? out : undefined;\n}\n\n/**\n * `skaile install` action body. Dispatches by argument shape:\n * a positional `ref` selects pointer-only catalog install, otherwise the\n * legacy `skaile.yaml` install path runs.\n */\nasync function runInstallCommand(\n ref: string | undefined,\n opts: InstallCommandOptions,\n): Promise<void> {\n // ── Pointer-only catalog install: `skaile install <ref>` ──────────────\n if (ref !== undefined) {\n await runRefInstall(ref, opts);\n return;\n }\n\n // ── Legacy install: `skaile install` reads skaile.yaml ────────────────\n await runYamlInstall(opts);\n}\n\n/** Pointer-only catalog install path for `skaile install <ref>`. */\nasync function runRefInstall(ref: string, opts: InstallCommandOptions): Promise<void> {\n if (!isValidAssetRef(ref)) {\n logErr(`malformed asset ref '${ref}' — expected ${REF_HINT}`);\n process.exit(1);\n }\n const spinner = p.spinner();\n spinner.start(`Installing ${ref}`);\n try {\n const { openCatalogSource, openLibrary } = await import(\"../open-library.ts\");\n const catalog = await openCatalogSource({ projectDir: path.resolve(opts.projectDir) });\n // [H2] REST-framed catalogs (the default for any catalog URL other\n // than https://skaile.store) cannot serve install manifests. Detect\n // and fail clearly rather than throwing a runtime TypeError.\n if (!supportsInstallManifest(catalog)) {\n throw new Error(\n \"pointer-only install (skaile install <ref>) requires a tRPC-framed Catalog. \" +\n \"The configured catalog uses REST framing, which does not serve install \" +\n \"manifests. Set catalog.url to https://skaile.store, or catalog.framing: trpc, \" +\n \"in ~/.skaile/config.yaml.\",\n );\n }\n const library = await openLibrary();\n try {\n const result = await runPointerOnlyInstall(ref, { catalog, library });\n spinner.stop(\"Done\");\n logOk(`Installed ${colorRef(ref)}`);\n logInfo(`Path: ${S.dim(result.installPath)}`);\n logInfo(`Commit: ${S.dim(result.commitSha)}`);\n logInfo(`Files: ${S.dim(String(result.fileCount))}`);\n logInfo(\n S.dim(`Installed globally (see Path above) — use \\`skaile add ${ref}\\` to deploy into this project.`),\n );\n } finally {\n library.close();\n }\n } catch (err) {\n spinner.stop(\"Failed\");\n const msg = err instanceof Error ? err.message : String(err);\n if (/unreachable/i.test(msg)) {\n logErr(`asset uninstallable — source commit no longer available (${msg})`);\n } else {\n logErr(msg);\n }\n process.exit(1);\n }\n}\n\n/** Legacy install path for bare `skaile install` (reads skaile.yaml). */\nasync function runYamlInstall(opts: InstallCommandOptions): Promise<void> {\n const projectDir = path.resolve(opts.projectDir);\n\n const backends = parseBackendFilter(opts.backend);\n // `--backend` implies `--global`.\n if (opts.global || backends) {\n await runGlobalInstall(opts, backends);\n return;\n }\n\n // Hydrate sources declared in skaile.yaml before resolving assets, so\n // freshly checked-out projects pull their source clones automatically.\n try {\n const { ensureSourcesCloned } = await import(\"../ensure-sources.ts\");\n const hydrate = ensureSourcesCloned(projectDir, { quiet: true });\n if (hydrate.cloned.length > 0) {\n logOk(`Cloned source(s): ${hydrate.cloned.join(\", \")}`);\n }\n if (hydrate.failed.length > 0) {\n logErr(`Failed to clone source(s): ${hydrate.failed.join(\", \")}`);\n }\n } catch (err) {\n logWarn(`source hydration skipped: ${err instanceof Error ? err.message : String(err)}`);\n }\n\n const am = new AssetManager({\n projectDir,\n driverTarget: opts.target as DriverTarget,\n });\n const spinner = p.spinner();\n spinner.start(opts.locked ? \"Installing from lock file\" : \"Installing dependencies\");\n try {\n const result = await am.install({ locked: opts.locked, link: opts.link });\n spinner.stop(\"Done\");\n if (result.deployed.length > 0) {\n for (const d of result.deployed) logOk(d);\n }\n if (result.removed.length > 0) {\n for (const r of result.removed) logWarn(`Removed: ${r}`);\n }\n if (result.deployed.length === 0 && result.removed.length === 0) {\n logInfo(\"Nothing to install (already up to date).\");\n }\n if (result.missing.length > 0) {\n for (const m of result.missing) logErr(`Missing: ${m}`);\n // Partial-miss must fail the process — CI can't otherwise distinguish a\n // clean install from \"half the assets never resolved\".\n process.exitCode = 1;\n }\n if (result.lockWritten) {\n logInfo(`Lock file written: ${S.dim(\"skaile.lock.yaml\")}`);\n }\n // Report-only: surface soft deps the declared assets reference but aren't\n // present. Never a prompt — install is a batch/CI path. Skipped under\n // --locked: that mode is \"restore exactly\", so an `add` nudge would jar.\n if (!opts.locked) await reportInstalledSoftDeps(am);\n } catch (err) {\n spinner.stop(\"Failed\");\n logErr(String(err));\n process.exit(1);\n }\n}\n\n/**\n * Report (never prompt) the body-link soft deps that the declared assets\n * reference but that aren't in the project — the `install` counterpart to the\n * `add`-time soft-dep surface. `install` is a batch/CI path (often non-TTY), so\n * it only ever prints a hint: pulling stays an explicit `skaile add`. Best-effort\n * — `reportSoftDeps` swallows any index failure and returns `[]`.\n */\nexport async function reportInstalledSoftDeps(\n am: Pick<AssetManager, \"listDeclared\" | \"reportSoftDeps\">,\n onHint: (line: string) => void = (l) => logInfo(S.dim(l)),\n): Promise<void> {\n try {\n const declared = (await am.listDeclared()).map((d) => d.ref);\n if (declared.length === 0) return;\n const edges = await am.reportSoftDeps(declared);\n for (const edge of edges) onHint(formatSoftDepHint(edge));\n } catch {\n // Best-effort: a soft-dep report must never fail an install that succeeded.\n }\n}\n\n/**\n * Global cross-backend install: deploy every dep declared in the global SSOT\n * (`~/.skaile/skaile.yaml`) into each resolved global backend's dir under `~`,\n * write the global lock (`~/.skaile/skaile.lock.yaml`), then print per-backend\n * state. `backends` is the `--backend` filter (omit for the full resolved set).\n */\nasync function runGlobalInstall(\n opts: InstallCommandOptions,\n backends: DriverTarget[] | undefined,\n): Promise<void> {\n const am = new AssetManager({\n projectDir: path.resolve(opts.projectDir),\n global: true,\n backends,\n });\n const spinner = p.spinner();\n spinner.start(\"Installing global dependencies\");\n try {\n const result = await am.install({ locked: opts.locked, link: opts.link });\n spinner.stop(\"Done\");\n if (result.deployed.length > 0) for (const d of result.deployed) logOk(d);\n if (result.removed.length > 0) for (const r of result.removed) logWarn(`Removed: ${r}`);\n if (result.deployed.length === 0 && result.removed.length === 0)\n logInfo(\"Nothing to install (already up to date).\");\n if (result.missing.length > 0) {\n for (const m of result.missing) logErr(`Missing: ${m}`);\n process.exitCode = 1;\n }\n if (result.lockWritten) logInfo(`Global lock written: ${S.dim(\"~/.skaile/skaile.lock.yaml\")}`);\n\n // Per-backend reconciliation summary so a partial fan-out is visible.\n const state = am.globalState({});\n const byBackend = new Map<string, number>();\n for (const s of state)\n if (s.state === \"installed\") byBackend.set(s.backend, (byBackend.get(s.backend) ?? 0) + 1);\n for (const [backend, n] of byBackend) logInfo(`${backend}: ${n} installed`);\n } catch (err) {\n spinner.stop(\"Failed\");\n logErr(String(err));\n process.exit(1);\n }\n}\n\n/**\n * Creates the `skaile check` command.\n *\n * Scans all deployed assets for unmet dependency requirements **and** the\n * declared set for deps that resolved into the lock but never materialized, and\n * exits with code 1 if either is found. `doctor()` alone only walks *deployed*\n * assets' `requires`, so a declared dep whose bytes never landed (e.g. a\n * store-sourced `mcp-server`) used to report \"satisfied\" (#462).\n *\n * @returns Configured {@link Command} ready for `program.addCommand()`.\n * @docLink cli/commands/project#make-check-command\n */\nexport function makeCheckCommand(): Command {\n return new Command(\"check\")\n .description(\"Check for unmet requirements\")\n .option(\"--project-dir <path>\", \"Project directory\", process.cwd())\n .action(async (opts) => {\n const am = new AssetManager({ projectDir: path.resolve(opts.projectDir) });\n const issues = await am.doctor();\n // A project with no (or an unreadable) skaile.yaml has no declared set to\n // reconcile — treat it as drift-free so `check` behaves as it always has.\n let drifted: Awaited<ReturnType<typeof am.listDeclared>> = [];\n try {\n drifted = (await am.listDeclared()).filter((d) => d.state === \"drift\");\n } catch {\n // ignored — doctor() below is still authoritative for deployed assets.\n }\n if (issues.length === 0 && drifted.length === 0) {\n logOk(\"All dependencies satisfied.\");\n } else {\n for (const i of issues) {\n logErr(\n `${i.assetKind}:${i.assetName} requires ${i.depKind}:${i.depName} (${i.inRepos ? \"fixable\" : \"not found\"})`,\n );\n }\n for (const d of drifted) {\n logErr(`${d.ref} is declared and locked but not materialized — run \\`skaile install\\``);\n }\n process.exit(1);\n }\n });\n}\n\n/**\n * Creates the `skaile clean` command.\n *\n * Removes all skaile-managed assets tracked in `skaile.lock.yaml` from the\n * workspace. With `--all` also removes history, patches, repos, and the lock\n * file itself. Preserves unmanaged (manually placed) assets.\n *\n * @returns Configured {@link Command} ready for `program.addCommand()`.\n * @docLink cli/commands/project#make-clean-command\n */\nexport function makeCleanCommand(): Command {\n return new Command(\"clean\")\n .description(\"Remove all skaile-managed assets from the workspace\")\n .option(\"--all\", \"Full reset: also remove history, patches, repos, and lock file\")\n .option(\"--dry-run\", \"Show what would be removed without doing it\")\n .option(\"-y, --yes\", \"Skip confirmation prompt\")\n .option(\"--project-dir <path>\", \"Project directory\", process.cwd())\n .option(\"--target <agent>\", \"Agent framework\", \"claude-code\")\n .action(async (opts) => {\n const am = new AssetManager({\n projectDir: path.resolve(opts.projectDir),\n driverTarget: opts.target as DriverTarget,\n });\n\n // Preview: load lock file to show what will be cleaned\n const lock = readLock(path.resolve(opts.projectDir, \"skaile.lock.yaml\"));\n\n if (!lock || Object.keys(lock.assets).length === 0) {\n logInfo(\"Nothing to clean (no skaile-managed assets found).\");\n return;\n }\n\n const assetRefs = Object.keys(lock.assets);\n console.log();\n console.log(` ${S.heading(\"Assets to remove:\")} ${S.dim(`(${assetRefs.length})`)}`);\n for (const ref of assetRefs) {\n console.log(` ${colorRef(ref)}`);\n }\n\n if (opts.all) {\n console.log();\n console.log(` ${S.heading(\"Also removing:\")}`);\n console.log(` ${S.dim(\".skaile/history.yaml\")}`);\n console.log(` ${S.dim(\".skaile/patches/\")}`);\n console.log(` ${S.dim(\"skaile.lock.yaml\")}`);\n }\n\n if (opts.dryRun) {\n console.log();\n logInfo(\"Dry run — no changes made.\");\n return;\n }\n\n if (!opts.yes) {\n const confirm = await p.confirm({ message: \"Proceed?\" });\n if (p.isCancel(confirm) || !confirm) {\n logInfo(\"Cancelled.\");\n return;\n }\n }\n\n const result = am.clean({ all: opts.all });\n\n console.log();\n for (const r of result.removed) {\n logOk(`Removed ${r}`);\n }\n for (const s of result.skipped) {\n logWarn(`Skipped ${s.ref}: ${s.reason}`);\n }\n if (result.unmanaged.length > 0) {\n console.log();\n logInfo(`Kept ${result.unmanaged.length} unmanaged asset(s):`);\n for (const u of result.unmanaged) {\n console.log(` ${S.dim(u)}`);\n }\n }\n if (opts.all) {\n console.log();\n logOk(\"Full reset complete.\");\n }\n });\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../cli/src/commands/project.ts"],"names":["spinner","confirm"],"mappings":";;;;;;;;;AAmBA,IAAM,QAAA,GAAW,uEAAA;AAGjB,SAAS,gBAAgB,GAAA,EAAsB;AAC7C,EAAA,IAAI;AACF,IAAA,aAAA,CAAc,GAAG,CAAA;AACjB,IAAA,OAAO,IAAA;AAAA,EACT,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,KAAA;AAAA,EACT;AACF;AAqBO,SAAS,wBAAwB,MAAA,EAAkD;AACxF,EAAA,OACE,OAAQ,QAAgE,kBAAA,KACxE,UAAA;AAEJ;AAwCA,eAAsB,qBAAA,CACpB,KACA,IAAA,EACmC;AACnC,EAAA,IAAI,SAAA;AACJ,EAAA,IAAI;AACF,IAAA,SAAA,GAAY,cAAc,GAAG,CAAA;AAAA,EAC/B,SAAS,CAAA,EAAG;AACV,IAAA,MAAM,IAAI,KAAA;AAAA,MACR,CAAA,qBAAA,EAAwB,GAAG,CAAA,kBAAA,EAAgB,QAAQ,CAAA,EAAA,EAAK,CAAA,YAAa,KAAA,GAAQ,CAAA,CAAE,OAAA,GAAU,MAAA,CAAO,CAAC,CAAC,CAAA;AAAA,KACpG;AAAA,EACF;AACA,EAAA,MAAM,QAAA,GAAW,MAA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AAI,KAAK,GAAA,EAAK;AACZ,MAAA,OAAA,CAAQ,GAAA,EAAI;AACZ,MAAA,KAAA,CAAM,sBAAsB,CAAA;AAAA,IAC9B;AAAA,EACF,CAAC,CAAA;AACL","file":"chunk-CMGYUF5P.js","sourcesContent":["import path from \"node:path\";\nimport * as p from \"@clack/prompts\";\nimport { AssetManager } from \"@skaile/workspaces/asset-manager\";\nimport {\n type DriverTarget,\n parseAssetRef,\n readLock,\n SUPPORTED_DRIVER_TARGETS,\n} from \"@skaile/workspaces/core\";\nimport type { InstallManifest } from \"@skaile/workspaces/types\";\nimport { Command } from \"commander\";\nimport { colorRef, formatSoftDepHint, logErr, logInfo, logOk, logWarn, S } from \"../helpers.ts\";\n\n/**\n * Canonical asset-ref shape accepted by `skaile install <ref>`:\n * `kind:@<publisher>/<name>#<version>` (the `#` version sigil). Validated via\n * `parseAssetRef` so the CLI shares the single canonical grammar; the legacy\n * trailing-`@version` shape is rejected.\n */\nconst REF_HINT = \"kind:@<publisher>/<name>#<version> (e.g. skill:@skaile/use-exa#1.0.0)\";\n\n/** True when `ref` parses as a canonical asset ref. */\nfunction isValidAssetRef(ref: string): boolean {\n try {\n parseAssetRef(ref);\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Minimal catalog-source surface the pointer-only install path needs.\n * `RemoteCatalogSource` satisfies this — narrowing keeps {@link runPointerOnlyInstall}\n * testable with a hand-rolled stub.\n */\nexport interface InstallManifestSource {\n getInstallManifest(ref: string): Promise<InstallManifest>;\n}\n\n/**\n * Capability check: is this catalog source able to serve install manifests?\n *\n * `openCatalogSource` returns a `RemoteCatalogSource | RestCatalogSource`.\n * Only the tRPC-framed `RemoteCatalogSource` implements `getInstallManifest`;\n * the REST-framed `RestCatalogSource` (the default for any catalog URL other\n * than `https://skaile.store`) does not. Calling it unconditionally would be a\n * runtime `TypeError`, so the pointer-only install path must capability-detect\n * first and fail with a clear, actionable message.\n */\nexport function supportsInstallManifest(source: unknown): source is InstallManifestSource {\n return (\n typeof (source as { getInstallManifest?: unknown } | null | undefined)?.getInstallManifest ===\n \"function\"\n );\n}\n\n/**\n * Minimal library surface the pointer-only install path needs.\n * `LocalIndex` satisfies this.\n */\nexport interface InstallLibrary {\n install(manifest: InstallManifest): Promise<{ installPath: string }>;\n}\n\n/**\n * Result of a pointer-only catalog install.\n */\nexport interface PointerOnlyInstallResult {\n /** Absolute path the verified asset bytes were written to. */\n installPath: string;\n /** The pinned upstream commit SHA the asset was fetched at. */\n commitSha: string;\n /** Number of files in the install manifest. */\n fileCount: number;\n}\n\n/**\n * Pointer-only catalog install — the `skaile install <ref>` code path.\n *\n * 1. Resolves the pointer-only {@link InstallManifest} from the Catalog.\n * 2. Hands it to the library, which fetches each file's bytes directly from\n * the upstream repo at the pinned commit, verifies every per-file SHA256\n * plus the composite SHA256, and only then writes the verified files.\n *\n * Both dependencies are injected so the function is unit-testable without a\n * network round-trip. In production the CLI passes a `RemoteCatalogSource`\n * and a `LocalIndex`.\n *\n * @param ref - Asset ref (`<publisher>/<name>@<version>`, optional leading `@`).\n * @param deps - Injected catalog source + library.\n * @returns The install path, pinned commit SHA, and file count.\n * @throws When the ref is malformed, the manifest cannot be resolved, or any\n * hash verification fails. The underlying error message is surfaced as-is.\n */\nexport async function runPointerOnlyInstall(\n ref: string,\n deps: { catalog: InstallManifestSource; library: InstallLibrary },\n): Promise<PointerOnlyInstallResult> {\n let requested: ReturnType<typeof parseAssetRef>;\n try {\n requested = parseAssetRef(ref);\n } catch (e) {\n throw new Error(\n `malformed asset ref '${ref}' — expected ${REF_HINT}: ${e instanceof Error ? e.message : String(e)}`,\n );\n }\n const manifest = await deps.catalog.getInstallManifest(ref);\n // [M1] Identity check: the catalog must not install a different asset than\n // requested. Compare the PARSED refs (kind/publisher/name/pin) so equivalent\n // spellings (optional `kind:`, default `skill`) are treated as the same ref.\n const got = parseAssetRef(manifest.ref);\n if (\n got.kind !== requested.kind ||\n got.publisher !== requested.publisher ||\n got.name !== requested.name ||\n got.pin !== requested.pin\n ) {\n throw new Error(\n `catalog identity mismatch: requested '${ref}' but the catalog returned a manifest for '${manifest.ref}'`,\n );\n }\n const { installPath } = await deps.library.install(manifest);\n return {\n installPath,\n commitSha: manifest.source.commitSha,\n fileCount: manifest.files.length,\n };\n}\n\n/**\n * Creates the `skaile install` command.\n *\n * Two modes, selected by argument shape:\n *\n * - `skaile install` (no positional arg) — reads `skaile.yaml` and deploys all\n * declared assets (and their transitive dependencies) to the configured\n * driver target directory. Supports `--locked` for CI-mode install from a\n * lock file.\n * - `skaile install <publisher>/<name>@<version>` — pointer-only catalog\n * install: resolves the pointer-only install manifest from the configured\n * Catalog, fetches each file's bytes directly from the upstream repo at the\n * pinned commit, verifies every per-file + the composite SHA256, then writes\n * the verified files into the local Library.\n *\n * @returns Configured {@link Command} ready for `program.addCommand()`.\n * @docLink cli/commands/project#make-install-command\n */\nexport function makeInstallCommand(): Command {\n return new Command(\"install\")\n .description(`Install dependencies from skaile.yaml, or a single asset by ref (${REF_HINT})`)\n .argument(\"[ref]\", `Asset ref to install from the Catalog (${REF_HINT})`)\n .option(\"--locked\", \"Install from lock file (CI mode — fails on drift)\")\n .option(\"--project-dir <path>\", \"Project directory\", process.cwd())\n .option(\"--target <agent>\", \"Agent framework\", \"claude-code\")\n .option(\n \"--global\",\n \"Install the global SSOT (~/.skaile/skaile.yaml), fanning out to every global backend\",\n )\n .option(\n \"--backend <ids>\",\n \"Comma-separated global backends to install into (default: all resolved); implies --global\",\n )\n .option(\n \"--link\",\n \"symlink local-path assets instead of copying (dev loop; machine-local, not for committing)\",\n )\n .action(runInstallCommand);\n}\n\n/** Options shape accepted by the `skaile install` command action. */\ninterface InstallCommandOptions {\n locked?: boolean;\n projectDir: string;\n target: string;\n global?: boolean;\n backend?: string;\n link?: boolean;\n}\n\n/**\n * Parse a `--backend a,b` value into validated {@link DriverTarget}s, exiting on\n * an unknown id. Returns `undefined` when the flag is absent (resolve the full\n * global set instead).\n */\nfunction parseBackendFilter(raw: string | undefined): DriverTarget[] | undefined {\n if (!raw) return undefined;\n const ids = raw\n .split(\",\")\n .map((s) => s.trim())\n .filter(Boolean);\n const out: DriverTarget[] = [];\n for (const id of ids) {\n if (!(SUPPORTED_DRIVER_TARGETS as string[]).includes(id)) {\n logErr(`unknown backend '${id}' — expected one of: ${SUPPORTED_DRIVER_TARGETS.join(\", \")}`);\n process.exit(1);\n }\n out.push(id as DriverTarget);\n }\n return out.length > 0 ? out : undefined;\n}\n\n/**\n * `skaile install` action body. Dispatches by argument shape:\n * a positional `ref` selects pointer-only catalog install, otherwise the\n * legacy `skaile.yaml` install path runs.\n */\nasync function runInstallCommand(\n ref: string | undefined,\n opts: InstallCommandOptions,\n): Promise<void> {\n // ── Pointer-only catalog install: `skaile install <ref>` ──────────────\n if (ref !== undefined) {\n await runRefInstall(ref, opts);\n return;\n }\n\n // ── Legacy install: `skaile install` reads skaile.yaml ────────────────\n await runYamlInstall(opts);\n}\n\n/** Pointer-only catalog install path for `skaile install <ref>`. */\nasync function runRefInstall(ref: string, opts: InstallCommandOptions): Promise<void> {\n if (!isValidAssetRef(ref)) {\n logErr(`malformed asset ref '${ref}' — expected ${REF_HINT}`);\n process.exit(1);\n }\n const spinner = p.spinner();\n spinner.start(`Installing ${ref}`);\n try {\n const { openCatalogSource, openLibrary } = await import(\"../open-library.ts\");\n const catalog = await openCatalogSource({ projectDir: path.resolve(opts.projectDir) });\n // [H2] REST-framed catalogs (the default for any catalog URL other\n // than https://skaile.store) cannot serve install manifests. Detect\n // and fail clearly rather than throwing a runtime TypeError.\n if (!supportsInstallManifest(catalog)) {\n throw new Error(\n \"pointer-only install (skaile install <ref>) requires a tRPC-framed Catalog. \" +\n \"The configured catalog uses REST framing, which does not serve install \" +\n \"manifests. Set catalog.url to https://skaile.store, or catalog.framing: trpc, \" +\n \"in ~/.skaile/config.yaml.\",\n );\n }\n const library = await openLibrary();\n try {\n const result = await runPointerOnlyInstall(ref, { catalog, library });\n spinner.stop(\"Done\");\n logOk(`Installed ${colorRef(ref)}`);\n logInfo(`Path: ${S.dim(result.installPath)}`);\n logInfo(`Commit: ${S.dim(result.commitSha)}`);\n logInfo(`Files: ${S.dim(String(result.fileCount))}`);\n logInfo(\n S.dim(`Installed globally (see Path above) — use \\`skaile add ${ref}\\` to deploy into this project.`),\n );\n } finally {\n library.close();\n }\n } catch (err) {\n spinner.stop(\"Failed\");\n const msg = err instanceof Error ? err.message : String(err);\n if (/unreachable/i.test(msg)) {\n logErr(`asset uninstallable — source commit no longer available (${msg})`);\n } else {\n logErr(msg);\n }\n process.exit(1);\n }\n}\n\n/** Legacy install path for bare `skaile install` (reads skaile.yaml). */\nasync function runYamlInstall(opts: InstallCommandOptions): Promise<void> {\n const projectDir = path.resolve(opts.projectDir);\n\n const backends = parseBackendFilter(opts.backend);\n // `--backend` implies `--global`.\n if (opts.global || backends) {\n await runGlobalInstall(opts, backends);\n return;\n }\n\n // Hydrate sources declared in skaile.yaml before resolving assets, so\n // freshly checked-out projects pull their source clones automatically.\n try {\n const { ensureSourcesCloned } = await import(\"../ensure-sources.ts\");\n const hydrate = ensureSourcesCloned(projectDir, { quiet: true });\n if (hydrate.cloned.length > 0) {\n logOk(`Cloned source(s): ${hydrate.cloned.join(\", \")}`);\n }\n if (hydrate.failed.length > 0) {\n logErr(`Failed to clone source(s): ${hydrate.failed.join(\", \")}`);\n }\n } catch (err) {\n logWarn(`source hydration skipped: ${err instanceof Error ? err.message : String(err)}`);\n }\n\n const am = new AssetManager({\n projectDir,\n driverTarget: opts.target as DriverTarget,\n });\n const spinner = p.spinner();\n spinner.start(opts.locked ? \"Installing from lock file\" : \"Installing dependencies\");\n try {\n const result = await am.install({ locked: opts.locked, link: opts.link });\n spinner.stop(\"Done\");\n if (result.deployed.length > 0) {\n for (const d of result.deployed) logOk(d);\n }\n if (result.removed.length > 0) {\n for (const r of result.removed) logWarn(`Removed: ${r}`);\n }\n if (result.deployed.length === 0 && result.removed.length === 0) {\n logInfo(\"Nothing to install (already up to date).\");\n }\n if (result.missing.length > 0) {\n for (const m of result.missing) logErr(`Missing: ${m}`);\n // Partial-miss must fail the process — CI can't otherwise distinguish a\n // clean install from \"half the assets never resolved\".\n process.exitCode = 1;\n }\n if (result.lockWritten) {\n logInfo(`Lock file written: ${S.dim(\"skaile.lock.yaml\")}`);\n }\n // Report-only: surface soft deps the declared assets reference but aren't\n // present. Never a prompt — install is a batch/CI path. Skipped under\n // --locked: that mode is \"restore exactly\", so an `add` nudge would jar.\n if (!opts.locked) await reportInstalledSoftDeps(am);\n } catch (err) {\n spinner.stop(\"Failed\");\n logErr(String(err));\n process.exit(1);\n }\n}\n\n/**\n * Report (never prompt) the body-link soft deps that the declared assets\n * reference but that aren't in the project — the `install` counterpart to the\n * `add`-time soft-dep surface. `install` is a batch/CI path (often non-TTY), so\n * it only ever prints a hint: pulling stays an explicit `skaile add`. Best-effort\n * — `reportSoftDeps` swallows any index failure and returns `[]`.\n */\nexport async function reportInstalledSoftDeps(\n am: Pick<AssetManager, \"listDeclared\" | \"reportSoftDeps\">,\n onHint: (line: string) => void = (l) => logInfo(S.dim(l)),\n): Promise<void> {\n try {\n const declared = (await am.listDeclared()).map((d) => d.ref);\n if (declared.length === 0) return;\n const edges = await am.reportSoftDeps(declared);\n for (const edge of edges) onHint(formatSoftDepHint(edge));\n } catch {\n // Best-effort: a soft-dep report must never fail an install that succeeded.\n }\n}\n\n/**\n * Global cross-backend install: deploy every dep declared in the global SSOT\n * (`~/.skaile/skaile.yaml`) into each resolved global backend's dir under `~`,\n * write the global lock (`~/.skaile/skaile.lock.yaml`), then print per-backend\n * state. `backends` is the `--backend` filter (omit for the full resolved set).\n */\nasync function runGlobalInstall(\n opts: InstallCommandOptions,\n backends: DriverTarget[] | undefined,\n): Promise<void> {\n const am = new AssetManager({\n projectDir: path.resolve(opts.projectDir),\n global: true,\n backends,\n });\n const spinner = p.spinner();\n spinner.start(\"Installing global dependencies\");\n try {\n const result = await am.install({ locked: opts.locked, link: opts.link });\n spinner.stop(\"Done\");\n if (result.deployed.length > 0) for (const d of result.deployed) logOk(d);\n if (result.removed.length > 0) for (const r of result.removed) logWarn(`Removed: ${r}`);\n if (result.deployed.length === 0 && result.removed.length === 0)\n logInfo(\"Nothing to install (already up to date).\");\n if (result.missing.length > 0) {\n for (const m of result.missing) logErr(`Missing: ${m}`);\n process.exitCode = 1;\n }\n if (result.lockWritten) logInfo(`Global lock written: ${S.dim(\"~/.skaile/skaile.lock.yaml\")}`);\n\n // Per-backend reconciliation summary so a partial fan-out is visible.\n const state = am.globalState({});\n const byBackend = new Map<string, number>();\n for (const s of state)\n if (s.state === \"installed\") byBackend.set(s.backend, (byBackend.get(s.backend) ?? 0) + 1);\n for (const [backend, n] of byBackend) logInfo(`${backend}: ${n} installed`);\n } catch (err) {\n spinner.stop(\"Failed\");\n logErr(String(err));\n process.exit(1);\n }\n}\n\n/**\n * Creates the `skaile check` command.\n *\n * Scans all deployed assets for unmet dependency requirements **and** the\n * declared set for deps that resolved into the lock but never materialized, and\n * exits with code 1 if either is found. `doctor()` alone only walks *deployed*\n * assets' `requires`, so a declared dep whose bytes never landed (e.g. a\n * store-sourced `mcp-server`) used to report \"satisfied\" (#462).\n *\n * @returns Configured {@link Command} ready for `program.addCommand()`.\n * @docLink cli/commands/project#make-check-command\n */\nexport function makeCheckCommand(): Command {\n return new Command(\"check\")\n .description(\"Check for unmet requirements\")\n .option(\"--project-dir <path>\", \"Project directory\", process.cwd())\n .action(async (opts) => {\n const am = new AssetManager({ projectDir: path.resolve(opts.projectDir) });\n const issues = await am.doctor();\n // A project with no (or an unreadable) skaile.yaml has no declared set to\n // reconcile — treat it as drift-free so `check` behaves as it always has.\n let drifted: Awaited<ReturnType<typeof am.listDeclared>> = [];\n try {\n drifted = (await am.listDeclared()).filter((d) => d.state === \"drift\");\n } catch {\n // ignored — doctor() below is still authoritative for deployed assets.\n }\n if (issues.length === 0 && drifted.length === 0) {\n logOk(\"All dependencies satisfied.\");\n } else {\n for (const i of issues) {\n logErr(\n `${i.assetKind}:${i.assetName} requires ${i.depKind}:${i.depName} (${i.inRepos ? \"fixable\" : \"not found\"})`,\n );\n }\n for (const d of drifted) {\n logErr(`${d.ref} is declared and locked but not materialized — run \\`skaile install\\``);\n }\n process.exit(1);\n }\n });\n}\n\n/**\n * Creates the `skaile clean` command.\n *\n * Removes all skaile-managed assets tracked in `skaile.lock.yaml` from the\n * workspace. With `--all` also removes history, patches, repos, and the lock\n * file itself. Preserves unmanaged (manually placed) assets.\n *\n * @returns Configured {@link Command} ready for `program.addCommand()`.\n * @docLink cli/commands/project#make-clean-command\n */\nexport function makeCleanCommand(): Command {\n return new Command(\"clean\")\n .description(\"Remove all skaile-managed assets from the workspace\")\n .option(\"--all\", \"Full reset: also remove history, patches, repos, and lock file\")\n .option(\"--dry-run\", \"Show what would be removed without doing it\")\n .option(\"-y, --yes\", \"Skip confirmation prompt\")\n .option(\"--project-dir <path>\", \"Project directory\", process.cwd())\n .option(\"--target <agent>\", \"Agent framework\", \"claude-code\")\n .action(async (opts) => {\n const am = new AssetManager({\n projectDir: path.resolve(opts.projectDir),\n driverTarget: opts.target as DriverTarget,\n });\n\n // Preview: load lock file to show what will be cleaned\n const lock = readLock(path.resolve(opts.projectDir, \"skaile.lock.yaml\"));\n\n if (!lock || Object.keys(lock.assets).length === 0) {\n logInfo(\"Nothing to clean (no skaile-managed assets found).\");\n return;\n }\n\n const assetRefs = Object.keys(lock.assets);\n console.log();\n console.log(` ${S.heading(\"Assets to remove:\")} ${S.dim(`(${assetRefs.length})`)}`);\n for (const ref of assetRefs) {\n console.log(` ${colorRef(ref)}`);\n }\n\n if (opts.all) {\n console.log();\n console.log(` ${S.heading(\"Also removing:\")}`);\n console.log(` ${S.dim(\".skaile/history.yaml\")}`);\n console.log(` ${S.dim(\".skaile/patches/\")}`);\n console.log(` ${S.dim(\"skaile.lock.yaml\")}`);\n }\n\n if (opts.dryRun) {\n console.log();\n logInfo(\"Dry run — no changes made.\");\n return;\n }\n\n if (!opts.yes) {\n const confirm = await p.confirm({ message: \"Proceed?\" });\n if (p.isCancel(confirm) || !confirm) {\n logInfo(\"Cancelled.\");\n return;\n }\n }\n\n const result = am.clean({ all: opts.all });\n\n console.log();\n for (const r of result.removed) {\n logOk(`Removed ${r}`);\n }\n for (const s of result.skipped) {\n logWarn(`Skipped ${s.ref}: ${s.reason}`);\n }\n if (result.unmanaged.length > 0) {\n console.log();\n logInfo(`Kept ${result.unmanaged.length} unmanaged asset(s):`);\n for (const u of result.unmanaged) {\n console.log(` ${S.dim(u)}`);\n }\n }\n if (opts.all) {\n console.log();\n logOk(\"Full reset complete.\");\n }\n });\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { initTelemetry } from './chunk-4R6DROGN.js';
|
|
2
2
|
import { parseSkillFrontmatter, validateFlowVersions } from './chunk-3XXQPHGL.js';
|
|
3
|
-
import { FlowAdapter, SessionNodeExecutor, SessionSubpromptRunner, SessionInlineSubFlowRunner, driveOrchestratorTurn } from './chunk-
|
|
3
|
+
import { FlowAdapter, SessionNodeExecutor, SessionSubpromptRunner, SessionInlineSubFlowRunner, driveOrchestratorTurn } from './chunk-EXT2LNST.js';
|
|
4
4
|
import { loadFlow, flowLookupRoots, findFlowFileInRoots, FLOW_FILE_EXTENSIONS } from './chunk-BQMRUH7J.js';
|
|
5
5
|
import { renderStimulusPrompt } from './chunk-2D5BYAL6.js';
|
|
6
6
|
import { flowSkillVersionPins } from './chunk-ELPR5XBG.js';
|
|
@@ -521,5 +521,5 @@ function walkForSkill(dir, skillId) {
|
|
|
521
521
|
}
|
|
522
522
|
|
|
523
523
|
export { resolveFlowPath, resumeFlow, runFlow };
|
|
524
|
-
//# sourceMappingURL=chunk-
|
|
525
|
-
//# sourceMappingURL=chunk-
|
|
524
|
+
//# sourceMappingURL=chunk-DUMD4AA2.js.map
|
|
525
|
+
//# sourceMappingURL=chunk-DUMD4AA2.js.map
|