@skaile/workspaces 0.42.1 → 0.43.1
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 +12 -0
- package/dist/{asset-feeds-UPJJGR3O.js → asset-feeds-3PSV57NT.js} +4 -4
- package/dist/{asset-feeds-UPJJGR3O.js.map → asset-feeds-3PSV57NT.js.map} +1 -1
- package/dist/asset-manager/index.js +4 -4
- package/dist/asset-manager/installer.js +3 -3
- package/dist/asset-manager/renderers.js +2 -2
- package/dist/{chunk-WJ3RP2FS.js → chunk-5FVJXQDP.js} +3 -3
- package/dist/{chunk-WJ3RP2FS.js.map → chunk-5FVJXQDP.js.map} +1 -1
- package/dist/{chunk-7WLJW457.js → chunk-CIEKKLMG.js} +4 -4
- package/dist/{chunk-7WLJW457.js.map → chunk-CIEKKLMG.js.map} +1 -1
- package/dist/{chunk-K5TROTFK.js → chunk-M54RYUXY.js} +4 -4
- package/dist/{chunk-K5TROTFK.js.map → chunk-M54RYUXY.js.map} +1 -1
- package/dist/{chunk-OMAK7GNL.js → chunk-N4FSBCLV.js} +22 -5
- package/dist/chunk-N4FSBCLV.js.map +1 -0
- package/dist/{chunk-SURALYSM.js → chunk-NYMRKIOR.js} +3 -3
- package/dist/{chunk-SURALYSM.js.map → chunk-NYMRKIOR.js.map} +1 -1
- package/dist/{chunk-JZQFZ55W.js → chunk-R4YUZRGF.js} +2 -2
- package/dist/{chunk-JZQFZ55W.js.map → chunk-R4YUZRGF.js.map} +1 -1
- package/dist/{chunk-3CVX7ENC.js → chunk-RGPBEGP2.js} +14 -3
- package/dist/chunk-RGPBEGP2.js.map +1 -0
- package/dist/{chunk-F5Q2RMH4.js → chunk-U2XHHLE3.js} +174 -132
- package/dist/chunk-U2XHHLE3.js.map +1 -0
- package/dist/{chunk-5VMVNQGB.js → chunk-WKZ5R4NP.js} +3 -3
- package/dist/{chunk-5VMVNQGB.js.map → chunk-WKZ5R4NP.js.map} +1 -1
- package/dist/{chunk-4HKLAUHJ.js → chunk-WRDHUTOK.js} +3 -3
- package/dist/{chunk-4HKLAUHJ.js.map → chunk-WRDHUTOK.js.map} +1 -1
- package/dist/{chunk-3SQYLWSD.js → chunk-XUXVH3JK.js} +3 -3
- package/dist/{chunk-3SQYLWSD.js.map → chunk-XUXVH3JK.js.map} +1 -1
- package/dist/cli/index.js +17 -17
- package/dist/connectors/index.js +1 -1
- package/dist/connectors/src/connector-manager.d.ts +21 -4
- package/dist/connectors/src/connector-manager.d.ts.map +1 -1
- package/dist/connectors/src/fleet-health-gate.d.ts +2 -0
- package/dist/connectors/src/fleet-health-gate.d.ts.map +1 -1
- package/dist/connectors/src/fleet-utils.d.ts +10 -0
- package/dist/connectors/src/fleet-utils.d.ts.map +1 -1
- package/dist/connectors/src/mount-placeholder.d.ts +11 -0
- package/dist/connectors/src/mount-placeholder.d.ts.map +1 -1
- package/dist/discovery/index.js +2 -2
- package/dist/{ensure-sources-TZHDV3BF.js → ensure-sources-VQDZB7NT.js} +5 -5
- package/dist/{ensure-sources-TZHDV3BF.js.map → ensure-sources-VQDZB7NT.js.map} +1 -1
- package/dist/factory-assets/connectors/deploy.js +1 -1
- package/dist/factory-assets/connectors/devserver.js +1 -1
- package/dist/factory-assets/connectors/flow/adapter.js +1 -1
- package/dist/factory-assets/connectors/flow/run-flow.js +2 -2
- package/dist/factory-assets/connectors/flow.js +1 -1
- package/dist/factory-assets/connectors/git.js +1 -1
- package/dist/factory-assets/connectors/gmail.js +1 -1
- package/dist/factory-assets/connectors/googledrive.js +1 -1
- package/dist/factory-assets/connectors/local.js +1 -1
- package/dist/factory-assets/connectors/mattermost.js +1 -1
- package/dist/factory-assets/connectors/memory.js +1 -1
- package/dist/factory-assets/connectors/minio.js +1 -1
- package/dist/factory-assets/connectors/postgres.js +1 -1
- package/dist/factory-assets/connectors/s3.js +1 -1
- package/dist/factory-assets/connectors/sharepoint.js +1 -1
- package/dist/factory-assets/connectors/sqlite.js +1 -1
- package/dist/factory-assets/connectors/static-server.js +1 -1
- package/dist/factory-assets/connectors/tunnel.js +1 -1
- package/dist/factory-assets/connectors/webdav.js +1 -1
- package/dist/factory-assets/connectors/xstate-store.js +1 -1
- package/dist/factory-assets/connectors/xstate.js +1 -1
- package/dist/library/index.js +3 -3
- package/dist/{open-library-EV7UCOFU.js → open-library-FHUXOCN7.js} +6 -6
- package/dist/{open-library-EV7UCOFU.js.map → open-library-FHUXOCN7.js.map} +1 -1
- package/dist/runner/index.js +3 -3
- package/dist/runner/src/external-mcp.d.ts.map +1 -1
- package/dist/runner/src/recipe-templating.d.ts +2 -0
- package/dist/runner/src/recipe-templating.d.ts.map +1 -1
- package/dist/sdk/asset-manager.js +4 -4
- package/dist/sdk/index.js +3 -3
- package/dist/sdk/runner.js +3 -3
- package/dist/tui/index.js +3 -3
- package/dist/types/manifests.js +1 -1
- package/dist/types/src/manifests/mcp-server.d.ts +5 -0
- package/dist/types/src/manifests/mcp-server.d.ts.map +1 -1
- package/dist/workspace-plugin/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-3CVX7ENC.js.map +0 -1
- package/dist/chunk-F5Q2RMH4.js.map +0 -1
- package/dist/chunk-OMAK7GNL.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../factory-assets/connectors/flow/run-flow.ts"],"names":["c"],"mappings":";;;;;;;;;;;AAuDA,IAAI,aAAA;AAEJ,eAAe,gBAAA,GAAiC;AAC9C,EAAA,IAAI,eAAe,OAAO,aAAA;AAC1B,EAAA,aAAA,GAAgB,MAAM,OAAO,mBAA2B,CAAA;AACxD,EAAA,OAAO,aAAA;AACT;AAMA,IAAM,0BAAA,GAA6B,CAAA,GAAI,EAAA,GAAK,EAAA,GAAK,GAAA;AA2HjD,eAAsB,QAAQ,IAAA,EAAiC;AAC7D,EAAA,MAAM,MAAA,GAAS,MAAM,gBAAA,EAAiB;AACtC,EAAA,MAAM;AAAA,IACJ,uBAAA;AAAA,IACA,kBAAA;A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I,OAAO,OAAO,KAAA;AAAA,IACpB;AAAA,EACF;AACA,EAAA,OAAO,IAAA;AACT","file":"chunk-4HKLAUHJ.js","sourcesContent":["/**\n * runFlow / resumeFlow — CLI entry helpers for the flow connector.\n *\n * Moved from `runner/src/runner.ts` to `factory-assets/connectors/flow/run-flow.ts`\n * in Phase 3 of the flow-connector extraction (2026-05-08). Behaviour is\n * byte-identical to the previous runner-side implementation; only the log\n * source changes from `runner:flow:<runId>` to `flow-connector:run:<runId>`.\n *\n * The runner re-exports these symbols with a deprecation warning for one\n * release. CLI consumers should switch to\n * `import { runFlow, resumeFlow } from \"@skaile/workspaces/factory-assets/connectors/flow/run-flow\"`.\n *\n * Internal runner helpers (FlowOrchestrator, bootstrapRunnerLogStore,\n * createAgentSession, resolveDriverPaths, session helpers) are loaded lazily\n * via dynamic `await import(\"@skaile/workspaces/runner\")` inside\n * `loadRunnerModule()` below. The lazy load avoids a static package-level\n * cycle (runner → connectors → factory-assets → runner) — the cycle exists at\n * the workspace level but never resolves at module-load time because\n * factory-assets only ever calls `import` from inside an async function body.\n * The string-literal specifier preserves `bun --compile` and tsup static\n * analysis.\n */\n\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport type { AgentEvent } from \"@skaile/workspaces/bridge\";\nimport {\n resolveAgentDir,\n resolveSettings,\n resolveSkWorkspaceConfig,\n} from \"@skaile/workspaces/core\";\nimport { createLogger } from \"@skaile/workspaces/core/logging\";\nimport { parseSkillFrontmatter, validateFlowVersions } from \"@skaile/workspaces/resolver\";\nimport { initTelemetry } from \"@skaile/workspaces/telemetry\";\nimport type { FlowExecution } from \"@skaile/workspaces/types\";\nimport { FlowAdapter } from \"./adapter.js\";\nimport { loadFlow } from \"./engine/index.js\";\nimport {\n buildOrchestratorPrompt,\n renderStimulusPrompt,\n type TurnStimulus,\n} from \"./prompt-fragments.js\";\n\n/**\n * Lazy `import(\"@skaile/workspaces/runner\")` accessor. Cached on first call so\n * subsequent `runFlow` invocations don't re-evaluate the runner module.\n *\n * Dynamic ESM import is used (not `require`) so vitest and other ESM\n * bundlers honour their alias resolution — `require` would side-step the\n * configured aliases and pick up two distinct module instances when run\n * under vitest. The string-literal specifier ensures bun --compile keeps\n * the dependency (per the static-import-or-die rule in\n * connectors/CLAUDE.md).\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nlet _runnerModule: any | undefined;\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nasync function loadRunnerModule(): Promise<any> {\n if (_runnerModule) return _runnerModule;\n _runnerModule = await import(\"@skaile/workspaces/runner\");\n return _runnerModule;\n}\n\n/** Type-only re-export of SessionState so the runner tombstone shim still works. */\nexport type SessionState = import(\"@skaile/workspaces/runner\").SessionState;\n\n/** Maximum agent session duration (4 hours). Configurable via {@link RunOptions.sessionTimeoutMs}. */\nconst DEFAULT_SESSION_TIMEOUT_MS = 4 * 60 * 60 * 1000; // 4 hours\n\n/**\n * Options for {@link runFlow}.\n *\n * Wraps `FlowOrchestrator` with autonomous mode turned on by default so\n * interactive approval/input gates don't block a terminal run.\n *\n * @docLink packages/factory-assets/flow#run-flow\n */\nexport interface RunOptions {\n /** The working directory for the project being orchestrated. */\n projectDir: string;\n /** Absolute path to the `.flow.yaml` or `.flow.json` definition file. */\n flowPath: string;\n /**\n * Directory containing `agent.yaml`, `SOUL.md`, `RULES.md`, `knowledge/`.\n * Resolved from `skaile.yaml` via `resolveAgentDir` when absent.\n */\n agentDir?: string;\n /**\n * Agent driver backend. Defaults to `settings.driver` (`\"omp\"` or `\"claude-sdk\"`).\n */\n driver?: string;\n /**\n * LLM provider override (e.g. `\"anthropic\"`, `\"openrouter\"`).\n * Falls back to `settings.provider` when absent.\n */\n provider?: string;\n /**\n * Model name override. Falls back to `settings.model` when absent.\n */\n model?: string;\n /**\n * Path to a specific `settings.json` to load instead of the default\n * layered resolution chain (project → parent → global → built-in defaults).\n */\n settingsFile?: string;\n /**\n * When `true`, prints the initial flow state without starting the agent\n * and returns immediately.\n */\n dryRun?: boolean;\n /**\n * Per-session timeout in milliseconds. Defaults to\n * {@link DEFAULT_SESSION_TIMEOUT_MS} (4 hours).\n */\n sessionTimeoutMs?: number;\n /** Optional human-readable label shown in the session list. */\n sessionLabel?: string;\n /** Autonomous mode for CLI runs — defaults to true so interactive approval gates are skipped. */\n autonomousMode?: boolean;\n /**\n * Called for each {@link AgentEvent} emitted during the run\n * (e.g. `text`, `tool_call`, `state_changed`).\n */\n onEvent?: (event: AgentEvent) => void;\n /**\n * Called for each diagnostic log line. Defaults to `process.stdout`.\n */\n onLog?: (line: string) => void;\n}\n\n/**\n * Options for resuming an existing CLI session.\n *\n * Reconnects the driver's conversation thread (conversation history is\n * preserved via the stored `driverSessionId`) but restarts flow execution\n * from scratch — flow state is not persisted in CLI mode. For governed,\n * resumable flow runs use a host that persists flow state (e.g. the Skaile\n * platform).\n *\n * @docLink packages/factory-assets/flow#resume-flow\n */\nexport interface ResumeOptions {\n /** The working directory for the project being orchestrated. */\n projectDir: string;\n /**\n * Specific run ID to resume. When absent, the current session pointer\n * at `<projectDir>/.skaile/current` is used.\n */\n sessionId?: string;\n /**\n * Agent definition directory override. Defaults to the directory stored\n * in the session file.\n */\n agentDir?: string;\n /**\n * When `true`, prints the initial flow state without starting the agent\n * and returns immediately.\n */\n dryRun?: boolean;\n /**\n * Per-session timeout in milliseconds. Defaults to\n * {@link DEFAULT_SESSION_TIMEOUT_MS} (4 hours).\n */\n sessionTimeoutMs?: number;\n /**\n * Called for each {@link AgentEvent} emitted during the run.\n */\n onEvent?: RunOptions[\"onEvent\"];\n /**\n * Called for each diagnostic log line. Defaults to `process.stdout`.\n */\n onLog?: RunOptions[\"onLog\"];\n}\n\n// ---------------------------------------------------------------------------\n// Public API\n// ---------------------------------------------------------------------------\n\n/**\n * Start a new flow session from the CLI.\n *\n * Wraps `FlowOrchestrator` with autonomous mode turned on by default so\n * interactive approval/input gates don't block a terminal run. The\n * runner remains idle between turns — for the CLI use case, a single\n * turn should carry the flow to completion in autonomous mode. Non-CLI\n * hosts (Skaile platform, Pichi) use the orchestrator directly via the\n * serve command surface and drive gates through user actions.\n *\n * @docLink packages/factory-assets/flow#run-flow\n */\nexport async function runFlow(opts: RunOptions): Promise<void> {\n const runner = await loadRunnerModule();\n const {\n bootstrapRunnerLogStore,\n createAgentSession,\n createSessionStimulusBus,\n resolveDriverPaths,\n newSession,\n saveSession,\n touchSession,\n } = runner;\n\n const flow = loadFlow(opts.flowPath);\n const agentDir = opts.agentDir ?? resolveAgentDir(opts.projectDir);\n const settings = await resolveSettings(opts.projectDir, {\n driver: opts.driver,\n provider: opts.provider,\n model: opts.model,\n });\n\n const session = newSession({\n flowId: flow.id,\n projectDir: opts.projectDir,\n agentDir,\n driver: settings.driver ?? \"omp\",\n provider: settings.provider,\n model: settings.model,\n label: opts.sessionLabel,\n });\n\n await saveSession(opts.projectDir, session);\n\n // Bootstrap structured logging — registers a process-singleton LogStore.\n // OnLogBridgeSink mirrors entries to opts.onLog when caller provides one,\n // preserving back-compat with CLI hosts that consume plain text lines.\n const wsConfigEarly = resolveSkWorkspaceConfig(opts.projectDir);\n const { dispose: disposeLogStore } = bootstrapRunnerLogStore({\n sessionId: session.runId,\n projectDir: opts.projectDir,\n yamlBlock: (wsConfigEarly as { logging?: unknown }).logging,\n onLog: opts.onLog,\n });\n const flowLog = createLogger({\n kind: \"flow-connector\",\n subkind: \"run\",\n instance: session.runId,\n });\n const log = (line: string) => flowLog.info(line);\n\n try {\n // ── Dry run ────────────────────────────────────────────────────────────\n if (opts.dryRun) {\n const adapter = new FlowAdapter();\n const handle = await adapter.connect(\n {\n id: \"flow\",\n driver: \"flow\",\n access: \"read-only\" as const,\n options: { flow, seed: { runId: session.runId, startedBy: \"cli\" } },\n },\n {}, // flow needs no connect context\n );\n const state = adapter.getExecution(handle);\n const available = Object.values(state.nodes)\n .filter((n) => n.status === \"available\")\n .map((n) => n.id);\n log(`[dry-run] Flow: ${flow.name} (${flow.id})`);\n log(`[dry-run] Available: ${available.join(\", \") || \"(none)\"}`);\n await adapter.disconnect(handle);\n return;\n }\n\n await validatePinnedVersions(flow, opts.projectDir, log);\n\n // ── Telemetry initialization ────────────────────────────────────────────\n const wsConfig = wsConfigEarly;\n const telemetry = await initTelemetry(wsConfig.telemetry);\n const flowTrace = telemetry.startTrace({\n name: `flow:${flow.id}`,\n kind: \"flow_run\",\n attributes: {\n \"skaile.flow.id\": flow.id,\n \"skaile.flow.run_id\": session.runId,\n },\n });\n\n // ── Agent session setup ─────────────────────────────────────────────────\n const driverPaths = resolveDriverPaths(settings);\n const agentSession = await createAgentSession({\n projectDir: opts.projectDir,\n agentDir: session.agentDir,\n driver: session.driver,\n model: session.model,\n provider: session.provider,\n resumeSessionId: session.driverSessionId,\n projectClaudeMd: path.join(opts.projectDir, \"CLAUDE.md\"),\n promptsDir: path.join(opts.projectDir, driverPaths.promptsDir),\n sessionId: session.runId,\n onLog: log,\n telemetry,\n trace: flowTrace,\n wsConfig,\n });\n const { driver } = agentSession;\n const updatedSession = { ...session };\n\n // Track driver session ID so future resumes can reconnect the SDK thread.\n driver.on(\"agent-event\", () => {\n const runtimeSessionId = driver.runtimeSessionId;\n if (!runtimeSessionId || runtimeSessionId === updatedSession.driverSessionId) return;\n updatedSession.driverSessionId = runtimeSessionId;\n void saveSession(opts.projectDir, updatedSession).catch(() => {});\n });\n\n // ── FlowAdapter + stimulus bus ─────────────────────────────────────────\n //\n // Phase 4 of the flow-connector extraction: SessionStimulusBus is the sole\n // turn driver. The legacy FlowOrchestrator + onStateChange subscription\n // are gone — every turn is initiated either by the bus (after an adapter\n // mutation observed via `useBusForStimulus: true`) or by an explicit\n // `bus.signal()` call from this function (the initial flow_started turn).\n //\n // The bus's `driveTurn` callback receives the stimulus paragraph the\n // adapter rendered (not the full orchestrator prompt). It rebuilds the\n // five-section orchestrator prompt around that fragment using\n // `buildOrchestratorPrompt` so the agent sees the same flow context the\n // legacy orchestrator produced.\n const flowConnectorId = \"flow\";\n const turnTimeoutMs = opts.sessionTimeoutMs ?? DEFAULT_SESSION_TIMEOUT_MS;\n\n // Forward declaration so `driveTurn` can read the live execution\n // snapshot. Assigned just below, before the bus can fire.\n let flowAdapterRef: FlowAdapter | null = null;\n let flowHandleRef: import(\"@skaile/workspaces/connectors\").ConnectorHandle | null = null;\n\n const stimulusBus = createSessionStimulusBus({\n driveTurn: async (\n promptFragment: string,\n metas: Array<Record<string, unknown>>,\n ): Promise<void> => {\n // The adapter signal carries `meta.kind` per stimulus. Use that to\n // reconstruct the typed `TurnStimulus`; for compound batches, fall\n // back to `state_changed` (the union element that means \"look at\n // current state and continue\").\n const lastKind = metas[metas.length - 1]?.kind;\n let stimulus: TurnStimulus;\n if (lastKind === \"flow_started\") {\n stimulus = { kind: \"flow_started\" };\n } else if (\n lastKind === \"user_message\" &&\n typeof metas[metas.length - 1]?.text === \"string\"\n ) {\n const meta = metas[metas.length - 1] as Record<string, unknown>;\n stimulus = {\n kind: \"user_message\",\n text: String(meta.text ?? \"\"),\n senderId: String(meta.senderId ?? \"user\"),\n };\n } else {\n stimulus = { kind: \"state_changed\" };\n }\n // The fragment passed in by the bus is the adapter's\n // `renderStimulusPrompt(stim)` joined across coalesced signals.\n // For the initial / explicit-stimulus path, we build the full prompt\n // around the fragment via `buildOrchestratorPrompt`. The fragment is\n // discarded in favour of the structured stimulus to keep the prompt\n // shape stable; the structured form already contains everything the\n // fragment encoded.\n void promptFragment;\n if (!flowAdapterRef || !flowHandleRef) {\n throw new Error(\"driveTurn fired before FlowAdapter was wired\");\n }\n const fullPrompt = buildOrchestratorPrompt(\n flow,\n flowAdapterRef.getExecution(flowHandleRef),\n stimulus,\n );\n await awaitAgentEnd(driver, fullPrompt, opts.onEvent, turnTimeoutMs);\n },\n log: flowLog,\n });\n\n const flowAdapter = new FlowAdapter();\n const flowHandle = await flowAdapter.connect(\n {\n id: flowConnectorId,\n driver: \"flow\",\n access: \"read-write\" as const,\n options: {\n flow,\n seed: {\n runId: session.runId,\n startedBy: \"cli\",\n autonomousMode: opts.autonomousMode ?? true,\n },\n stimulusBus,\n useBusForStimulus: true,\n },\n },\n {}, // flow needs no connect context\n );\n flowAdapterRef = flowAdapter;\n flowHandleRef = flowHandle;\n\n // Forward state_changed events to the caller. The bus computes a\n // turn-kicking stimulus on each adapter mutation; the host-facing\n // event stream still observes the full snapshot via onChange.\n flowAdapter.onStateChange(flowHandle, (state: FlowExecution) => {\n opts.onEvent?.({\n type: \"state_changed\",\n store: `flow:${state.runId}`,\n state: state as unknown as Record<string, unknown>,\n } as unknown as AgentEvent);\n });\n\n // ── Execute ────────────────────────────────────────────────────────────\n flowLog.info(\"starting flow\", {\n flowId: flow.id,\n flowName: flow.name,\n runId: session.runId,\n });\n\n try {\n // Kick the initial flow_started turn explicitly. Subsequent turns are\n // driven by the bus signaling whenever the adapter mutates.\n const initialStimulus: TurnStimulus = { kind: \"flow_started\" };\n await stimulusBus.signal(flowConnectorId, {\n promptFragment: renderStimulusPrompt(initialStimulus),\n meta: { kind: initialStimulus.kind },\n });\n\n const finalState = flowAdapter.getExecution(flowHandle);\n if (finalState.done) {\n flowLog.info(\"flow complete\", { flowId: flow.id, flowName: flow.name });\n } else if (finalState.status === \"failed\") {\n flowLog.error(\"flow failed\", undefined, { flowId: flow.id, flowName: flow.name });\n } else {\n flowLog.warn(\"flow paused after one turn\", {\n flowId: flow.id,\n status: finalState.status,\n note: \"CLI mode does not interact with approval/input gates\",\n });\n }\n } finally {\n driver.kill();\n const lastState = flowAdapter.getExecution(flowHandle);\n await saveSession(\n opts.projectDir,\n touchSession({\n ...updatedSession,\n driverSessionId: driver.runtimeSessionId ?? updatedSession.driverSessionId,\n status: lastState.status === \"complete\" ? \"complete\" : \"paused\",\n }),\n ).catch(() => {});\n await flowAdapter.disconnect(flowHandle).catch(() => {});\n await agentSession.dispose();\n telemetry.endTrace(flowTrace, {\n status: flowAdapter.getExecution(flowHandle).status === \"complete\" ? \"ok\" : \"error\",\n });\n await telemetry.flush().catch(() => {});\n }\n } finally {\n disposeLogStore();\n }\n}\n\n/**\n * Resume an existing session from the CLI.\n *\n * With the Phase 2 turn-based model, flow state is NOT persisted to\n * local session files — only the driver session ID is kept. The CLI\n * can resume the agent's conversation thread, but the flow execution\n * itself starts from scratch because the runner has no durable store\n * for per-run state.\n *\n * For a governed, resumable flow run, use a host that persists flow\n * state (e.g. the Skaile platform). CLI resume is retained as a\n * driver-level convenience only: we load the session, restart the\n * flow, and the SDK will reconnect to the prior conversation thread.\n *\n * @docLink packages/factory-assets/flow#resume-flow\n */\nexport async function resumeFlow(opts: ResumeOptions): Promise<void> {\n const runner = await loadRunnerModule();\n const { loadSession, loadSessionById, bootstrapRunnerLogStore } = runner;\n\n const session = opts.sessionId\n ? await loadSessionById(opts.projectDir, opts.sessionId)\n : await loadSession(opts.projectDir);\n\n if (!session) {\n const hint = opts.sessionId\n ? `session ${opts.sessionId}`\n : `current session in ${opts.projectDir}/.skaile`;\n throw new Error(`No session found (${hint}) — run 'start' first`);\n }\n\n const flowPath = resolveFlowPath(session.flowId, opts.projectDir);\n\n // Bootstrap a transient logger for the resume diagnostics. The inner\n // runFlow() call will register its own LogStore for the new run. Keep\n // OnLogBridgeSink wiring so callers passing onLog still see this line.\n const wsConfigEarly = resolveSkWorkspaceConfig(opts.projectDir);\n const { dispose: disposeLogStore } = bootstrapRunnerLogStore({\n sessionId: session.runId,\n projectDir: opts.projectDir,\n yamlBlock: (wsConfigEarly as { logging?: unknown }).logging,\n onLog: opts.onLog,\n });\n const flowLog = createLogger({\n kind: \"flow-connector\",\n subkind: \"run\",\n instance: session.runId,\n });\n flowLog.info(\"resuming session\", {\n runId: session.runId,\n flowId: session.flowId,\n note: \"CLI mode does not persist flow state — flow restarts from scratch; driver thread resumes\",\n });\n\n try {\n await runFlow({\n projectDir: opts.projectDir,\n flowPath,\n agentDir: opts.agentDir ?? session.agentDir,\n driver: session.driver,\n model: session.model,\n provider: session.provider,\n sessionLabel: session.label,\n dryRun: opts.dryRun,\n sessionTimeoutMs: opts.sessionTimeoutMs,\n onEvent: opts.onEvent,\n onLog: opts.onLog,\n });\n } finally {\n disposeLogStore();\n }\n}\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\nasync function validatePinnedVersions(\n flow: Awaited<ReturnType<typeof loadFlow>>,\n projectDir: string,\n log: (line: string) => void,\n): Promise<void> {\n const pinnedNodes = flow.nodes.filter((n) => n.type === \"skill\" && n.data?.version);\n if (pinnedNodes.length === 0) return;\n\n const skillVersions = new Map<string, string>();\n const aiResourcesDir = findAiResourcesDir(projectDir);\n if (aiResourcesDir) {\n for (const node of pinnedNodes) {\n const skillId = node.data?.skill ?? node.id;\n if (skillVersions.has(skillId)) continue;\n const skillPath = findSkillMd(aiResourcesDir, skillId);\n if (skillPath) {\n const content = fs.readFileSync(skillPath, \"utf-8\");\n const fm = parseSkillFrontmatter(content);\n skillVersions.set(skillId, fm.metadata?.version ?? fm.version ?? \"\");\n }\n }\n }\n\n const versionNodes = pinnedNodes.map((n) => ({\n nodeId: n.id,\n skillId: n.data?.skill ?? n.id,\n requestedVersion: n.data?.version,\n }));\n\n const checks = validateFlowVersions(versionNodes, skillVersions);\n const failures = checks.filter((c) => !c.satisfied);\n if (failures.length > 0) {\n const lines = failures.map(\n (f) => ` ${f.nodeId}: wants ${f.requested}, found ${f.actual || \"(none)\"}`,\n );\n throw new Error(`Skill version mismatch:\\n${lines.join(\"\\n\")}`);\n }\n for (const c of checks.filter((c) => c.satisfied)) {\n log(` Version OK: ${c.skillId} ${c.actual} satisfies ${c.requested}`);\n }\n}\n\nfunction resolveFlowPath(flowId: string, projectDir: string): string {\n const armInstalled = path.join(projectDir, \".skaile\", \"flows\", flowId, `${flowId}.flow.yaml`);\n if (fs.existsSync(armInstalled)) return armInstalled;\n\n const manual = path.join(projectDir, \".skaile\", \"flows\", `${flowId}.flow.yaml`);\n if (fs.existsSync(manual)) return manual;\n\n let dir = projectDir;\n for (let i = 0; i < 6; i++) {\n const aiResources = path.join(dir, \"ai-assets\");\n if (fs.existsSync(aiResources)) {\n for (const domain of fs.readdirSync(aiResources)) {\n const flowsDir = path.join(aiResources, domain, \"flows\");\n const candidate = path.join(flowsDir, `${flowId}.flow.yaml`);\n if (fs.existsSync(candidate)) return candidate;\n const legacy = path.join(flowsDir, `${flowId}.json`);\n if (fs.existsSync(legacy)) return legacy;\n }\n throw new Error(`Flow not found: ${flowId} (searched .skaile/flows/ and ${aiResources})`);\n }\n dir = path.dirname(dir);\n }\n throw new Error(\n `Flow not found: ${flowId} (no .skaile/flows/ entry and could not locate ai-assets from ${projectDir})`,\n );\n}\n\n/** Walk up from projectDir to find ai-assets/ */\nfunction findAiResourcesDir(projectDir: string): string | null {\n let dir = projectDir;\n for (let i = 0; i < 6; i++) {\n const candidate = path.join(dir, \"ai-assets\");\n if (fs.existsSync(candidate)) return candidate;\n const parent = path.dirname(dir);\n if (parent === dir) break;\n dir = parent;\n }\n return null;\n}\n\n/** Find SKILL.md for a given skill ID by walking ai-assets domains */\nfunction findSkillMd(aiResourcesDir: string, skillId: string): string | null {\n for (const domain of fs.readdirSync(aiResourcesDir, { withFileTypes: true })) {\n if (!domain.isDirectory()) continue;\n const skillsDir = path.join(aiResourcesDir, domain.name, \"skills\");\n if (!fs.existsSync(skillsDir)) continue;\n const found = walkForSkill(skillsDir, skillId);\n if (found) return found;\n }\n return null;\n}\n\n// ---------------------------------------------------------------------------\n// Turn-wait helper\n// ---------------------------------------------------------------------------\n\n/**\n * Minimal driver surface needed by the bus's `driveTurn` callback. Mirrors\n * the slice the legacy `FlowOrchestrator` consumed (`prompt` + `on` +\n * `removeAllListeners`) so we can keep the wait helper private to this\n * module without pulling in a runtime dep on `@skaile/workspaces/bridge`.\n */\ninterface TurnDriverSurface {\n prompt(message: string): Promise<void>;\n on(event: \"agent-event\", handler: (event: AgentEvent) => void): void;\n removeAllListeners(event: \"agent-event\"): void;\n}\n\n/**\n * Send a prompt to the driver and resolve when the agent emits\n * `agent_end` (or reject on `error`). Identical contract to the legacy\n * `awaitAgentEnd` helper from `flow-orchestrator.ts`. Phase 4 lifts the\n * helper into `run-flow.ts` because the bus now owns turn driving.\n */\nfunction awaitAgentEnd(\n driver: TurnDriverSurface,\n prompt: string,\n onEvent: ((event: AgentEvent) => void) | undefined,\n timeoutMs: number,\n): Promise<void> {\n return new Promise<void>((resolve, reject) => {\n let settled = false;\n\n const done = (err?: Error) => {\n if (settled) return;\n settled = true;\n clearTimeout(timer);\n driver.removeAllListeners(\"agent-event\");\n if (err) reject(err);\n else resolve();\n };\n\n const timer = setTimeout(\n () => done(new Error(`Flow turn timed out after ${timeoutMs / 1000}s`)),\n timeoutMs,\n );\n\n driver.on(\"agent-event\", (event: AgentEvent) => {\n onEvent?.(event);\n if (event.type === \"agent_end\") done();\n else if (event.type === \"error\") {\n const msg =\n (event as { error?: string; message?: string }).error ??\n (event as { message?: string }).message ??\n \"Agent error\";\n done(new Error(msg));\n }\n });\n\n driver.prompt(prompt).catch(done);\n });\n}\n\nfunction walkForSkill(dir: string, skillId: string): string | null {\n for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {\n if (!entry.isDirectory()) continue;\n const full = path.join(dir, entry.name);\n const skillMd = path.join(full, \"SKILL.md\");\n if (fs.existsSync(skillMd)) {\n if (entry.name === skillId) return skillMd;\n } else {\n const found = walkForSkill(full, skillId);\n if (found) return found;\n }\n }\n return null;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../factory-assets/connectors/flow/run-flow.ts"],"names":["c"],"mappings":";;;;;;;;;;;AAuDA,IAAI,aAAA;AAEJ,eAAe,gBAAA,GAAiC;AAC9C,EAAA,IAAI,eAAe,OAAO,aAAA;AAC1B,EAAA,aAAA,GAAgB,MAAM,OAAO,mBAA2B,CAAA;AACxD,EAAA,OAAO,aAAA;AACT;AAMA,IAAM,0BAAA,GAA6B,CAAA,GAAI,EAAA,GAAK,EAAA,GAAK,GAAA;AA2HjD,eAAsB,QAAQ,IAAA,EAAiC;AAC7D,EAAA,MAAM,MAAA,GA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ACL,MAAA,MAAM,KAAA,GAAQ,YAAA,CAAa,IAAA,EAAM,OAAO,CAAA;AACxC,MAAA,IAAI,OAAO,OAAO,KAAA;AAAA,IACpB;AAAA,EACF;AACA,EAAA,OAAO,IAAA;AACT","file":"chunk-WRDHUTOK.js","sourcesContent":["/**\n * runFlow / resumeFlow — CLI entry helpers for the flow connector.\n *\n * Moved from `runner/src/runner.ts` to `factory-assets/connectors/flow/run-flow.ts`\n * in Phase 3 of the flow-connector extraction (2026-05-08). Behaviour is\n * byte-identical to the previous runner-side implementation; only the log\n * source changes from `runner:flow:<runId>` to `flow-connector:run:<runId>`.\n *\n * The runner re-exports these symbols with a deprecation warning for one\n * release. CLI consumers should switch to\n * `import { runFlow, resumeFlow } from \"@skaile/workspaces/factory-assets/connectors/flow/run-flow\"`.\n *\n * Internal runner helpers (FlowOrchestrator, bootstrapRunnerLogStore,\n * createAgentSession, resolveDriverPaths, session helpers) are loaded lazily\n * via dynamic `await import(\"@skaile/workspaces/runner\")` inside\n * `loadRunnerModule()` below. The lazy load avoids a static package-level\n * cycle (runner → connectors → factory-assets → runner) — the cycle exists at\n * the workspace level but never resolves at module-load time because\n * factory-assets only ever calls `import` from inside an async function body.\n * The string-literal specifier preserves `bun --compile` and tsup static\n * analysis.\n */\n\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport type { AgentEvent } from \"@skaile/workspaces/bridge\";\nimport {\n resolveAgentDir,\n resolveSettings,\n resolveSkWorkspaceConfig,\n} from \"@skaile/workspaces/core\";\nimport { createLogger } from \"@skaile/workspaces/core/logging\";\nimport { parseSkillFrontmatter, validateFlowVersions } from \"@skaile/workspaces/resolver\";\nimport { initTelemetry } from \"@skaile/workspaces/telemetry\";\nimport type { FlowExecution } from \"@skaile/workspaces/types\";\nimport { FlowAdapter } from \"./adapter.js\";\nimport { loadFlow } from \"./engine/index.js\";\nimport {\n buildOrchestratorPrompt,\n renderStimulusPrompt,\n type TurnStimulus,\n} from \"./prompt-fragments.js\";\n\n/**\n * Lazy `import(\"@skaile/workspaces/runner\")` accessor. Cached on first call so\n * subsequent `runFlow` invocations don't re-evaluate the runner module.\n *\n * Dynamic ESM import is used (not `require`) so vitest and other ESM\n * bundlers honour their alias resolution — `require` would side-step the\n * configured aliases and pick up two distinct module instances when run\n * under vitest. The string-literal specifier ensures bun --compile keeps\n * the dependency (per the static-import-or-die rule in\n * connectors/CLAUDE.md).\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nlet _runnerModule: any | undefined;\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nasync function loadRunnerModule(): Promise<any> {\n if (_runnerModule) return _runnerModule;\n _runnerModule = await import(\"@skaile/workspaces/runner\");\n return _runnerModule;\n}\n\n/** Type-only re-export of SessionState so the runner tombstone shim still works. */\nexport type SessionState = import(\"@skaile/workspaces/runner\").SessionState;\n\n/** Maximum agent session duration (4 hours). Configurable via {@link RunOptions.sessionTimeoutMs}. */\nconst DEFAULT_SESSION_TIMEOUT_MS = 4 * 60 * 60 * 1000; // 4 hours\n\n/**\n * Options for {@link runFlow}.\n *\n * Wraps `FlowOrchestrator` with autonomous mode turned on by default so\n * interactive approval/input gates don't block a terminal run.\n *\n * @docLink packages/factory-assets/flow#run-flow\n */\nexport interface RunOptions {\n /** The working directory for the project being orchestrated. */\n projectDir: string;\n /** Absolute path to the `.flow.yaml` or `.flow.json` definition file. */\n flowPath: string;\n /**\n * Directory containing `agent.yaml`, `SOUL.md`, `RULES.md`, `knowledge/`.\n * Resolved from `skaile.yaml` via `resolveAgentDir` when absent.\n */\n agentDir?: string;\n /**\n * Agent driver backend. Defaults to `settings.driver` (`\"omp\"` or `\"claude-sdk\"`).\n */\n driver?: string;\n /**\n * LLM provider override (e.g. `\"anthropic\"`, `\"openrouter\"`).\n * Falls back to `settings.provider` when absent.\n */\n provider?: string;\n /**\n * Model name override. Falls back to `settings.model` when absent.\n */\n model?: string;\n /**\n * Path to a specific `settings.json` to load instead of the default\n * layered resolution chain (project → parent → global → built-in defaults).\n */\n settingsFile?: string;\n /**\n * When `true`, prints the initial flow state without starting the agent\n * and returns immediately.\n */\n dryRun?: boolean;\n /**\n * Per-session timeout in milliseconds. Defaults to\n * {@link DEFAULT_SESSION_TIMEOUT_MS} (4 hours).\n */\n sessionTimeoutMs?: number;\n /** Optional human-readable label shown in the session list. */\n sessionLabel?: string;\n /** Autonomous mode for CLI runs — defaults to true so interactive approval gates are skipped. */\n autonomousMode?: boolean;\n /**\n * Called for each {@link AgentEvent} emitted during the run\n * (e.g. `text`, `tool_call`, `state_changed`).\n */\n onEvent?: (event: AgentEvent) => void;\n /**\n * Called for each diagnostic log line. Defaults to `process.stdout`.\n */\n onLog?: (line: string) => void;\n}\n\n/**\n * Options for resuming an existing CLI session.\n *\n * Reconnects the driver's conversation thread (conversation history is\n * preserved via the stored `driverSessionId`) but restarts flow execution\n * from scratch — flow state is not persisted in CLI mode. For governed,\n * resumable flow runs use a host that persists flow state (e.g. the Skaile\n * platform).\n *\n * @docLink packages/factory-assets/flow#resume-flow\n */\nexport interface ResumeOptions {\n /** The working directory for the project being orchestrated. */\n projectDir: string;\n /**\n * Specific run ID to resume. When absent, the current session pointer\n * at `<projectDir>/.skaile/current` is used.\n */\n sessionId?: string;\n /**\n * Agent definition directory override. Defaults to the directory stored\n * in the session file.\n */\n agentDir?: string;\n /**\n * When `true`, prints the initial flow state without starting the agent\n * and returns immediately.\n */\n dryRun?: boolean;\n /**\n * Per-session timeout in milliseconds. Defaults to\n * {@link DEFAULT_SESSION_TIMEOUT_MS} (4 hours).\n */\n sessionTimeoutMs?: number;\n /**\n * Called for each {@link AgentEvent} emitted during the run.\n */\n onEvent?: RunOptions[\"onEvent\"];\n /**\n * Called for each diagnostic log line. Defaults to `process.stdout`.\n */\n onLog?: RunOptions[\"onLog\"];\n}\n\n// ---------------------------------------------------------------------------\n// Public API\n// ---------------------------------------------------------------------------\n\n/**\n * Start a new flow session from the CLI.\n *\n * Wraps `FlowOrchestrator` with autonomous mode turned on by default so\n * interactive approval/input gates don't block a terminal run. The\n * runner remains idle between turns — for the CLI use case, a single\n * turn should carry the flow to completion in autonomous mode. Non-CLI\n * hosts (Skaile platform, Pichi) use the orchestrator directly via the\n * serve command surface and drive gates through user actions.\n *\n * @docLink packages/factory-assets/flow#run-flow\n */\nexport async function runFlow(opts: RunOptions): Promise<void> {\n const runner = await loadRunnerModule();\n const {\n bootstrapRunnerLogStore,\n createAgentSession,\n createSessionStimulusBus,\n resolveDriverPaths,\n newSession,\n saveSession,\n touchSession,\n } = runner;\n\n const flow = loadFlow(opts.flowPath);\n const agentDir = opts.agentDir ?? resolveAgentDir(opts.projectDir);\n const settings = await resolveSettings(opts.projectDir, {\n driver: opts.driver,\n provider: opts.provider,\n model: opts.model,\n });\n\n const session = newSession({\n flowId: flow.id,\n projectDir: opts.projectDir,\n agentDir,\n driver: settings.driver ?? \"omp\",\n provider: settings.provider,\n model: settings.model,\n label: opts.sessionLabel,\n });\n\n await saveSession(opts.projectDir, session);\n\n // Bootstrap structured logging — registers a process-singleton LogStore.\n // OnLogBridgeSink mirrors entries to opts.onLog when caller provides one,\n // preserving back-compat with CLI hosts that consume plain text lines.\n const wsConfigEarly = resolveSkWorkspaceConfig(opts.projectDir);\n const { dispose: disposeLogStore } = bootstrapRunnerLogStore({\n sessionId: session.runId,\n projectDir: opts.projectDir,\n yamlBlock: (wsConfigEarly as { logging?: unknown }).logging,\n onLog: opts.onLog,\n });\n const flowLog = createLogger({\n kind: \"flow-connector\",\n subkind: \"run\",\n instance: session.runId,\n });\n const log = (line: string) => flowLog.info(line);\n\n try {\n // ── Dry run ────────────────────────────────────────────────────────────\n if (opts.dryRun) {\n const adapter = new FlowAdapter();\n const handle = await adapter.connect(\n {\n id: \"flow\",\n driver: \"flow\",\n access: \"read-only\" as const,\n options: { flow, seed: { runId: session.runId, startedBy: \"cli\" } },\n },\n {}, // flow needs no connect context\n );\n const state = adapter.getExecution(handle);\n const available = Object.values(state.nodes)\n .filter((n) => n.status === \"available\")\n .map((n) => n.id);\n log(`[dry-run] Flow: ${flow.name} (${flow.id})`);\n log(`[dry-run] Available: ${available.join(\", \") || \"(none)\"}`);\n await adapter.disconnect(handle);\n return;\n }\n\n await validatePinnedVersions(flow, opts.projectDir, log);\n\n // ── Telemetry initialization ────────────────────────────────────────────\n const wsConfig = wsConfigEarly;\n const telemetry = await initTelemetry(wsConfig.telemetry);\n const flowTrace = telemetry.startTrace({\n name: `flow:${flow.id}`,\n kind: \"flow_run\",\n attributes: {\n \"skaile.flow.id\": flow.id,\n \"skaile.flow.run_id\": session.runId,\n },\n });\n\n // ── Agent session setup ─────────────────────────────────────────────────\n const driverPaths = resolveDriverPaths(settings);\n const agentSession = await createAgentSession({\n projectDir: opts.projectDir,\n agentDir: session.agentDir,\n driver: session.driver,\n model: session.model,\n provider: session.provider,\n resumeSessionId: session.driverSessionId,\n projectClaudeMd: path.join(opts.projectDir, \"CLAUDE.md\"),\n promptsDir: path.join(opts.projectDir, driverPaths.promptsDir),\n sessionId: session.runId,\n onLog: log,\n telemetry,\n trace: flowTrace,\n wsConfig,\n });\n const { driver } = agentSession;\n const updatedSession = { ...session };\n\n // Track driver session ID so future resumes can reconnect the SDK thread.\n driver.on(\"agent-event\", () => {\n const runtimeSessionId = driver.runtimeSessionId;\n if (!runtimeSessionId || runtimeSessionId === updatedSession.driverSessionId) return;\n updatedSession.driverSessionId = runtimeSessionId;\n void saveSession(opts.projectDir, updatedSession).catch(() => {});\n });\n\n // ── FlowAdapter + stimulus bus ─────────────────────────────────────────\n //\n // Phase 4 of the flow-connector extraction: SessionStimulusBus is the sole\n // turn driver. The legacy FlowOrchestrator + onStateChange subscription\n // are gone — every turn is initiated either by the bus (after an adapter\n // mutation observed via `useBusForStimulus: true`) or by an explicit\n // `bus.signal()` call from this function (the initial flow_started turn).\n //\n // The bus's `driveTurn` callback receives the stimulus paragraph the\n // adapter rendered (not the full orchestrator prompt). It rebuilds the\n // five-section orchestrator prompt around that fragment using\n // `buildOrchestratorPrompt` so the agent sees the same flow context the\n // legacy orchestrator produced.\n const flowConnectorId = \"flow\";\n const turnTimeoutMs = opts.sessionTimeoutMs ?? DEFAULT_SESSION_TIMEOUT_MS;\n\n // Forward declaration so `driveTurn` can read the live execution\n // snapshot. Assigned just below, before the bus can fire.\n let flowAdapterRef: FlowAdapter | null = null;\n let flowHandleRef: import(\"@skaile/workspaces/connectors\").ConnectorHandle | null = null;\n\n const stimulusBus = createSessionStimulusBus({\n driveTurn: async (\n promptFragment: string,\n metas: Array<Record<string, unknown>>,\n ): Promise<void> => {\n // The adapter signal carries `meta.kind` per stimulus. Use that to\n // reconstruct the typed `TurnStimulus`; for compound batches, fall\n // back to `state_changed` (the union element that means \"look at\n // current state and continue\").\n const lastKind = metas[metas.length - 1]?.kind;\n let stimulus: TurnStimulus;\n if (lastKind === \"flow_started\") {\n stimulus = { kind: \"flow_started\" };\n } else if (\n lastKind === \"user_message\" &&\n typeof metas[metas.length - 1]?.text === \"string\"\n ) {\n const meta = metas[metas.length - 1] as Record<string, unknown>;\n stimulus = {\n kind: \"user_message\",\n text: String(meta.text ?? \"\"),\n senderId: String(meta.senderId ?? \"user\"),\n };\n } else {\n stimulus = { kind: \"state_changed\" };\n }\n // The fragment passed in by the bus is the adapter's\n // `renderStimulusPrompt(stim)` joined across coalesced signals.\n // For the initial / explicit-stimulus path, we build the full prompt\n // around the fragment via `buildOrchestratorPrompt`. The fragment is\n // discarded in favour of the structured stimulus to keep the prompt\n // shape stable; the structured form already contains everything the\n // fragment encoded.\n void promptFragment;\n if (!flowAdapterRef || !flowHandleRef) {\n throw new Error(\"driveTurn fired before FlowAdapter was wired\");\n }\n const fullPrompt = buildOrchestratorPrompt(\n flow,\n flowAdapterRef.getExecution(flowHandleRef),\n stimulus,\n );\n await awaitAgentEnd(driver, fullPrompt, opts.onEvent, turnTimeoutMs);\n },\n log: flowLog,\n });\n\n const flowAdapter = new FlowAdapter();\n const flowHandle = await flowAdapter.connect(\n {\n id: flowConnectorId,\n driver: \"flow\",\n access: \"read-write\" as const,\n options: {\n flow,\n seed: {\n runId: session.runId,\n startedBy: \"cli\",\n autonomousMode: opts.autonomousMode ?? true,\n },\n stimulusBus,\n useBusForStimulus: true,\n },\n },\n {}, // flow needs no connect context\n );\n flowAdapterRef = flowAdapter;\n flowHandleRef = flowHandle;\n\n // Forward state_changed events to the caller. The bus computes a\n // turn-kicking stimulus on each adapter mutation; the host-facing\n // event stream still observes the full snapshot via onChange.\n flowAdapter.onStateChange(flowHandle, (state: FlowExecution) => {\n opts.onEvent?.({\n type: \"state_changed\",\n store: `flow:${state.runId}`,\n state: state as unknown as Record<string, unknown>,\n } as unknown as AgentEvent);\n });\n\n // ── Execute ────────────────────────────────────────────────────────────\n flowLog.info(\"starting flow\", {\n flowId: flow.id,\n flowName: flow.name,\n runId: session.runId,\n });\n\n try {\n // Kick the initial flow_started turn explicitly. Subsequent turns are\n // driven by the bus signaling whenever the adapter mutates.\n const initialStimulus: TurnStimulus = { kind: \"flow_started\" };\n await stimulusBus.signal(flowConnectorId, {\n promptFragment: renderStimulusPrompt(initialStimulus),\n meta: { kind: initialStimulus.kind },\n });\n\n const finalState = flowAdapter.getExecution(flowHandle);\n if (finalState.done) {\n flowLog.info(\"flow complete\", { flowId: flow.id, flowName: flow.name });\n } else if (finalState.status === \"failed\") {\n flowLog.error(\"flow failed\", undefined, { flowId: flow.id, flowName: flow.name });\n } else {\n flowLog.warn(\"flow paused after one turn\", {\n flowId: flow.id,\n status: finalState.status,\n note: \"CLI mode does not interact with approval/input gates\",\n });\n }\n } finally {\n driver.kill();\n const lastState = flowAdapter.getExecution(flowHandle);\n await saveSession(\n opts.projectDir,\n touchSession({\n ...updatedSession,\n driverSessionId: driver.runtimeSessionId ?? updatedSession.driverSessionId,\n status: lastState.status === \"complete\" ? \"complete\" : \"paused\",\n }),\n ).catch(() => {});\n await flowAdapter.disconnect(flowHandle).catch(() => {});\n await agentSession.dispose();\n telemetry.endTrace(flowTrace, {\n status: flowAdapter.getExecution(flowHandle).status === \"complete\" ? \"ok\" : \"error\",\n });\n await telemetry.flush().catch(() => {});\n }\n } finally {\n disposeLogStore();\n }\n}\n\n/**\n * Resume an existing session from the CLI.\n *\n * With the Phase 2 turn-based model, flow state is NOT persisted to\n * local session files — only the driver session ID is kept. The CLI\n * can resume the agent's conversation thread, but the flow execution\n * itself starts from scratch because the runner has no durable store\n * for per-run state.\n *\n * For a governed, resumable flow run, use a host that persists flow\n * state (e.g. the Skaile platform). CLI resume is retained as a\n * driver-level convenience only: we load the session, restart the\n * flow, and the SDK will reconnect to the prior conversation thread.\n *\n * @docLink packages/factory-assets/flow#resume-flow\n */\nexport async function resumeFlow(opts: ResumeOptions): Promise<void> {\n const runner = await loadRunnerModule();\n const { loadSession, loadSessionById, bootstrapRunnerLogStore } = runner;\n\n const session = opts.sessionId\n ? await loadSessionById(opts.projectDir, opts.sessionId)\n : await loadSession(opts.projectDir);\n\n if (!session) {\n const hint = opts.sessionId\n ? `session ${opts.sessionId}`\n : `current session in ${opts.projectDir}/.skaile`;\n throw new Error(`No session found (${hint}) — run 'start' first`);\n }\n\n const flowPath = resolveFlowPath(session.flowId, opts.projectDir);\n\n // Bootstrap a transient logger for the resume diagnostics. The inner\n // runFlow() call will register its own LogStore for the new run. Keep\n // OnLogBridgeSink wiring so callers passing onLog still see this line.\n const wsConfigEarly = resolveSkWorkspaceConfig(opts.projectDir);\n const { dispose: disposeLogStore } = bootstrapRunnerLogStore({\n sessionId: session.runId,\n projectDir: opts.projectDir,\n yamlBlock: (wsConfigEarly as { logging?: unknown }).logging,\n onLog: opts.onLog,\n });\n const flowLog = createLogger({\n kind: \"flow-connector\",\n subkind: \"run\",\n instance: session.runId,\n });\n flowLog.info(\"resuming session\", {\n runId: session.runId,\n flowId: session.flowId,\n note: \"CLI mode does not persist flow state — flow restarts from scratch; driver thread resumes\",\n });\n\n try {\n await runFlow({\n projectDir: opts.projectDir,\n flowPath,\n agentDir: opts.agentDir ?? session.agentDir,\n driver: session.driver,\n model: session.model,\n provider: session.provider,\n sessionLabel: session.label,\n dryRun: opts.dryRun,\n sessionTimeoutMs: opts.sessionTimeoutMs,\n onEvent: opts.onEvent,\n onLog: opts.onLog,\n });\n } finally {\n disposeLogStore();\n }\n}\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\nasync function validatePinnedVersions(\n flow: Awaited<ReturnType<typeof loadFlow>>,\n projectDir: string,\n log: (line: string) => void,\n): Promise<void> {\n const pinnedNodes = flow.nodes.filter((n) => n.type === \"skill\" && n.data?.version);\n if (pinnedNodes.length === 0) return;\n\n const skillVersions = new Map<string, string>();\n const aiResourcesDir = findAiResourcesDir(projectDir);\n if (aiResourcesDir) {\n for (const node of pinnedNodes) {\n const skillId = node.data?.skill ?? node.id;\n if (skillVersions.has(skillId)) continue;\n const skillPath = findSkillMd(aiResourcesDir, skillId);\n if (skillPath) {\n const content = fs.readFileSync(skillPath, \"utf-8\");\n const fm = parseSkillFrontmatter(content);\n skillVersions.set(skillId, fm.metadata?.version ?? fm.version ?? \"\");\n }\n }\n }\n\n const versionNodes = pinnedNodes.map((n) => ({\n nodeId: n.id,\n skillId: n.data?.skill ?? n.id,\n requestedVersion: n.data?.version,\n }));\n\n const checks = validateFlowVersions(versionNodes, skillVersions);\n const failures = checks.filter((c) => !c.satisfied);\n if (failures.length > 0) {\n const lines = failures.map(\n (f) => ` ${f.nodeId}: wants ${f.requested}, found ${f.actual || \"(none)\"}`,\n );\n throw new Error(`Skill version mismatch:\\n${lines.join(\"\\n\")}`);\n }\n for (const c of checks.filter((c) => c.satisfied)) {\n log(` Version OK: ${c.skillId} ${c.actual} satisfies ${c.requested}`);\n }\n}\n\nfunction resolveFlowPath(flowId: string, projectDir: string): string {\n const armInstalled = path.join(projectDir, \".skaile\", \"flows\", flowId, `${flowId}.flow.yaml`);\n if (fs.existsSync(armInstalled)) return armInstalled;\n\n const manual = path.join(projectDir, \".skaile\", \"flows\", `${flowId}.flow.yaml`);\n if (fs.existsSync(manual)) return manual;\n\n let dir = projectDir;\n for (let i = 0; i < 6; i++) {\n const aiResources = path.join(dir, \"ai-assets\");\n if (fs.existsSync(aiResources)) {\n for (const domain of fs.readdirSync(aiResources)) {\n const flowsDir = path.join(aiResources, domain, \"flows\");\n const candidate = path.join(flowsDir, `${flowId}.flow.yaml`);\n if (fs.existsSync(candidate)) return candidate;\n const legacy = path.join(flowsDir, `${flowId}.json`);\n if (fs.existsSync(legacy)) return legacy;\n }\n throw new Error(`Flow not found: ${flowId} (searched .skaile/flows/ and ${aiResources})`);\n }\n dir = path.dirname(dir);\n }\n throw new Error(\n `Flow not found: ${flowId} (no .skaile/flows/ entry and could not locate ai-assets from ${projectDir})`,\n );\n}\n\n/** Walk up from projectDir to find ai-assets/ */\nfunction findAiResourcesDir(projectDir: string): string | null {\n let dir = projectDir;\n for (let i = 0; i < 6; i++) {\n const candidate = path.join(dir, \"ai-assets\");\n if (fs.existsSync(candidate)) return candidate;\n const parent = path.dirname(dir);\n if (parent === dir) break;\n dir = parent;\n }\n return null;\n}\n\n/** Find SKILL.md for a given skill ID by walking ai-assets domains */\nfunction findSkillMd(aiResourcesDir: string, skillId: string): string | null {\n for (const domain of fs.readdirSync(aiResourcesDir, { withFileTypes: true })) {\n if (!domain.isDirectory()) continue;\n const skillsDir = path.join(aiResourcesDir, domain.name, \"skills\");\n if (!fs.existsSync(skillsDir)) continue;\n const found = walkForSkill(skillsDir, skillId);\n if (found) return found;\n }\n return null;\n}\n\n// ---------------------------------------------------------------------------\n// Turn-wait helper\n// ---------------------------------------------------------------------------\n\n/**\n * Minimal driver surface needed by the bus's `driveTurn` callback. Mirrors\n * the slice the legacy `FlowOrchestrator` consumed (`prompt` + `on` +\n * `removeAllListeners`) so we can keep the wait helper private to this\n * module without pulling in a runtime dep on `@skaile/workspaces/bridge`.\n */\ninterface TurnDriverSurface {\n prompt(message: string): Promise<void>;\n on(event: \"agent-event\", handler: (event: AgentEvent) => void): void;\n removeAllListeners(event: \"agent-event\"): void;\n}\n\n/**\n * Send a prompt to the driver and resolve when the agent emits\n * `agent_end` (or reject on `error`). Identical contract to the legacy\n * `awaitAgentEnd` helper from `flow-orchestrator.ts`. Phase 4 lifts the\n * helper into `run-flow.ts` because the bus now owns turn driving.\n */\nfunction awaitAgentEnd(\n driver: TurnDriverSurface,\n prompt: string,\n onEvent: ((event: AgentEvent) => void) | undefined,\n timeoutMs: number,\n): Promise<void> {\n return new Promise<void>((resolve, reject) => {\n let settled = false;\n\n const done = (err?: Error) => {\n if (settled) return;\n settled = true;\n clearTimeout(timer);\n driver.removeAllListeners(\"agent-event\");\n if (err) reject(err);\n else resolve();\n };\n\n const timer = setTimeout(\n () => done(new Error(`Flow turn timed out after ${timeoutMs / 1000}s`)),\n timeoutMs,\n );\n\n driver.on(\"agent-event\", (event: AgentEvent) => {\n onEvent?.(event);\n if (event.type === \"agent_end\") done();\n else if (event.type === \"error\") {\n const msg =\n (event as { error?: string; message?: string }).error ??\n (event as { message?: string }).message ??\n \"Agent error\";\n done(new Error(msg));\n }\n });\n\n driver.prompt(prompt).catch(done);\n });\n}\n\nfunction walkForSkill(dir: string, skillId: string): string | null {\n for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {\n if (!entry.isDirectory()) continue;\n const full = path.join(dir, entry.name);\n const skillMd = path.join(full, \"SKILL.md\");\n if (fs.existsSync(skillMd)) {\n if (entry.name === skillId) return skillMd;\n } else {\n const found = walkForSkill(full, skillId);\n if (found) return found;\n }\n }\n return null;\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { normalizeAnthropicModel } from './chunk-
|
|
1
|
+
import { normalizeAnthropicModel } from './chunk-RGPBEGP2.js';
|
|
2
2
|
import { mkdirSync, writeFileSync } from 'fs';
|
|
3
3
|
import { join, dirname, relative } from 'path';
|
|
4
4
|
import { stringify } from 'yaml';
|
|
@@ -208,5 +208,5 @@ function driverTargetSupportsAgents(driverTarget) {
|
|
|
208
208
|
}
|
|
209
209
|
|
|
210
210
|
export { AGENT_RENDERERS, claudeCodeRenderer, codexRenderer, driverTargetSupportsAgents, ompRenderer, renderAgentToFramework };
|
|
211
|
-
//# sourceMappingURL=chunk-
|
|
212
|
-
//# sourceMappingURL=chunk-
|
|
211
|
+
//# sourceMappingURL=chunk-XUXVH3JK.js.map
|
|
212
|
+
//# sourceMappingURL=chunk-XUXVH3JK.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../asset-manager/src/renderers.ts"],"names":["stringifyYaml"],"mappings":";;;;;AAiFA,SAAS,UAAA,CACP,QAAA,EACA,OAAA,EACA,aAAA,EACA,OAAA,EACM;AACN,EAAA,SAAA,CAAU,QAAQ,QAAQ,CAAA,EAAG,EAAE,SAAA,EAAW,MAAM,CAAA;AAChD,EAAA,aAAA,CAAc,QAAA,EAAU,SAAS,OAAO,CAAA;AACxC,EAAA,OAAA,CAAQ,IAAA,CAAK,QAAA,CAAS,aAAA,EAAe,QAAQ,CAAC,CAAA;AAChD;AAmBA,SAAS,kBACP,IAAA,EACA,KAAA,EACA,QACA,WAAA,EACA,YAAA,EACA,oBACA,gBAAA,EACQ;AACR,EAAA,MAAM,QAAkB,EAAC;AAEzB,EAAA,IAAI,IAAA,EAAM,KAAA,CAAM,IAAA,CAAK,IAAA,CAAK,MAAM,CAAA;AAChC,EAAA,KAAA,MAAW,QAAA,IAAY,kBAAA,EAAoB,KAAA,CAAM,IAAA,CAAK,QAAQ,CAAA;AAC9D,EAAA,IAAI,KAAA,QAAa,IAAA,CAAK,CAAA;;AAAA,EAAqB,KAAA,CAAM,IAAA,EAAM,CAAA,CAAE,CAAA;AACzD,EAAA,IAAI,MAAA,QAAc,IAAA,CAAK,CAAA;;AAAA,EAAgB,MAAA,CAAO,IAAA,EAAM,CAAA,CAAE,CAAA;AAEtD,EAAA,IAAI,WAAA,CAAY,SAAS,CAAA,EAAG;AAC1B,IAAA,MAAM,KAAA,GAAQ,CAAC,wBAAA,EAA0B,EAAE,CAAA;AAC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CAAQ,IAAA,CAAK,QAAA,CAAS,aAAA,EAAe,OAAO,CAAC,CAAA;AAC7C,EAAA,OAAO,EAAE,SAAS,QAAA,EAAS;AAC7B;AAKA,IAAM,OAAY,MAAM;AAAC,CAAA;AAalB,SAAS,sBAAA,CACd,KAAA,EACA,YAAA,EACA,GAAA,GAAW,IAAA,EACgC;AAC3C,EAAA,MAAM,QAAA,GAAW,gBAAgB,YAAY,CAAA;AAC7C,EAAA,IAAI,CAAC,QAAA,EAAU;AACb,IAAA,OAAO,EAAE,SAAS,EAAC,EAAG,UAAU,CAAC,CAAA,2BAAA,EAA8B,YAAY,CAAA,CAAA,CAAG,CAAA,EAAE;AAAA,EAClF;AACA,EAAA,MAAM,MAAA,GAAS,SAAS,KAAK,CAAA;AAC7B,EAAA,KAAA,MAAW,KAAK,MAAA,CAAO,OAAA,EAAS,GAAA,CAAI,CAAA,kBAAA,EAAqB,CAAC,CAAA,CAAE,CAAA;AAC5D,EAAA,KAAA,MAAW,KAAK,MAAA,CAAO,QAAA,EAAU,GAAA,CAAI,CAAA,QAAA,EAAW,CAAC,CAAA,CAAE,CAAA;AACnD,EAAA,OAAO,MAAA;AACT;AAUO,IAAM,eAAA,GAAiD;AAAA,EAC5D,aAAA,EAAe,kBAAA;AAAA,EACf,GAAA,EAAK,WAAA;AAAA,EACL,KAAA,EAAO;AACT;AASO,SAAS,2BAA2B,YAAA,EAA+B;AACxE,EAAA,OAAO,YAAA,IAAgB,eAAA;AACzB","file":"chunk-3SQYLWSD.js","sourcesContent":["/**\n * Framework-specific renderers for GitAgent packages.\n *\n * Each renderer transforms a parsed GitAgent package (agent.yaml + SOUL.md + RULES.md)\n * into the native file format that the target agent framework natively reads.\n *\n * Only backends with a full bridge driver (runtime execution) are included:\n * claude-code → .claude/agents/<name>.md (YAML frontmatter + markdown body)\n * omp → .omp/agents/<name>/ (directory with agent.yaml + SOUL.md)\n * codex → .codex/agents/<name>.toml (TOML)\n *\n * Removed (no bridge driver): cursor, roo, github-copilot, gemini, amp.\n * Add them back when a bridge driver is implemented.\n */\n\nimport { mkdirSync, writeFileSync } from \"node:fs\";\nimport { dirname, join, relative } from \"node:path\";\nimport type { AgentManifest } from \"@skaile/workspaces/core\";\nimport { normalizeAnthropicModel } from \"@skaile/workspaces/types/manifests\";\nimport { stringify as stringifyYaml } from \"yaml\";\nimport type { AbilityRef, ContractRef } from \"./fragments.js\";\n\n// ── Types ─────────────────────────────────��───────────────────────────────────\n\nexport type { AgentManifest };\n\n/**\n * All data an {@link AgentRenderer} needs to produce a native agent definition file.\n *\n * @docLink packages/asset-manager/api-reference#renderers\n */\nexport interface AgentRenderInput {\n /** Parsed `agent.yaml` manifest for the GitAgent being rendered. */\n manifest: AgentManifest;\n /** Raw content of `SOUL.md`, or `null` if absent. */\n soul: string | null;\n /** Raw content of `RULES.md`, or `null` if absent. */\n rules: string | null;\n /** Raw content of `DUTIES.md`, or `null` if absent. */\n duties: string | null;\n /** Agent name used as the output filename and frontmatter `name` field. */\n agentName: string;\n /** Resolved absolute path to the framework's agent deploy directory (e.g. `.claude/agents/`). */\n agentDeployDir: string;\n /** Absolute path to the workspace root. */\n workspaceRoot: string;\n /** Resolved ability refs — installed skills referenced in the `## Installed Abilities` section. */\n abilityRefs: AbilityRef[];\n /** Resolved contract refs — installed in the skills dir, listed in the `## Contracts` section. */\n contractRefs: ContractRef[];\n /** Resolved framework fragment markdown blocks (agent-mode, handoff, skill-discovery, etc.). */\n frameworkFragments: string[];\n /** Per-project prompt extension markdown blocks loaded from `skaile.yaml` `agent.prompt-extensions`. */\n promptExtensions: string[];\n}\n\n/**\n * Result returned by every {@link AgentRenderer}.\n *\n * @docLink packages/asset-manager/api-reference#renderers\n */\nexport interface AgentRenderResult {\n /** Paths to files/dirs created, relative to `workspaceRoot`. */\n created: string[];\n /** Non-fatal warnings (e.g. experimental feature notices). */\n warnings: string[];\n}\n\n/**\n * A function that transforms an {@link AgentRenderInput} into framework-native agent definition files.\n *\n * @docLink packages/asset-manager/api-reference#renderers\n */\nexport type AgentRenderer = (input: AgentRenderInput) => AgentRenderResult;\n\n// ── Helpers ───────────────────────────────────────────────────────────────────\n\n/**\n * Write an agent definition file, always overwriting if it already exists.\n * Agents are compiled artifacts — they must reflect the current canonical source.\n */\nfunction writeAgent(\n filePath: string,\n content: string,\n workspaceRoot: string,\n created: string[],\n): void {\n mkdirSync(dirname(filePath), { recursive: true });\n writeFileSync(filePath, content, \"utf-8\");\n created.push(relative(workspaceRoot, filePath));\n}\n\n/**\n * Build the full agent system prompt body baked into the framework-native agent file.\n *\n * This is the sole source of the agent's system prompt body. Agent identity is rendered at install time; the backend reads it natively at runtime.\n * The rendered output ends up in .claude/agents/<name>.md, .omp/agents/<name>/SOUL.md,\n * .codex/agents/<name>.toml and is read natively by the framework on every agent invocation.\n *\n * Composition order:\n * 1. SOUL.md — agent identity and values (inlined verbatim)\n * 2. Framework fragments — agent-mode, handoff, skill-discovery, connector-usage\n * (conditional; see fragments.ts BUILT_IN_FRAGMENTS)\n * 3. ## Constraints — RULES.md behavioral constraints (inlined)\n * 4. ## Duties — DUTIES.md responsibilities (inlined)\n * 5. ## Installed Abilities — skill name + description, listed as slash commands\n * 6. ## Contracts — relative paths to CONTRACT.md in the skills dir\n * 7. Prompt extensions — per-project markdown from skaile.yaml agent.prompt-extensions\n */\nfunction buildMarkdownBody(\n soul: string | null,\n rules: string | null,\n duties: string | null,\n abilityRefs: AbilityRef[],\n contractRefs: ContractRef[],\n frameworkFragments: string[],\n promptExtensions: string[],\n): string {\n const parts: string[] = [];\n\n if (soul) parts.push(soul.trim());\n for (const fragment of frameworkFragments) parts.push(fragment);\n if (rules) parts.push(`## Constraints\\n\\n${rules.trim()}`);\n if (duties) parts.push(`## Duties\\n\\n${duties.trim()}`);\n\n if (abilityRefs.length > 0) {\n const lines = [\"## Installed Abilities\", \"\"];\n for (const a of abilityRefs) lines.push(`- \\`/${a.name}\\` — ${a.description}`);\n parts.push(lines.join(\"\\n\"));\n }\n\n if (contractRefs.length > 0) {\n const lines = [\n \"## Contracts\",\n \"\",\n \"Read the relevant contract before acting on constrained tasks:\",\n \"\",\n ];\n for (const c of contractRefs) lines.push(`- \\`${c.relativePath}\\``);\n parts.push(lines.join(\"\\n\"));\n }\n\n for (const ext of promptExtensions) parts.push(ext);\n\n return `${parts.join(\"\\n\\n\")}\\n`;\n}\n\n/** Escape a string for use as a TOML multi-line basic string (triple-quote). */\nfunction toTomlMultilineString(s: string): string {\n // Replace \"\"\" with \\\\\"\"\" to avoid breaking the TOML literal\n return s.replace(/\"\"\"/g, '\\\\\"\\\\\"\\\\\"');\n}\n\n// ── Claude Code ────────────��──────────────────────────────────────────────────\n// Format: .claude/agents/<name>.md\n// Sub-agent support: automatic (description-based) + @-mention\n// Required frontmatter: name, description\n//\n// Installation → runtime handoff:\n// skaile install (claudeCodeRenderer) creates the .md file from GitAgent source\n// ClaudeSdkDriver.startQuery() passes options.agent = agentName to the SDK query\n// The SDK reads .claude/agents/<agentName>.md to get model, tools, and system prompt\n// This is equivalent to running: claude --agent <agentName>\n\n/**\n * Render a GitAgent to Claude Code's `.claude/agents/<name>.md` format.\n *\n * Writes YAML frontmatter (name, description, model, tools, maxTurns) followed\n * by the enriched system prompt body. Always overwrites to reflect current source.\n *\n * @docLink packages/asset-manager/api-reference#renderers\n */\nexport const claudeCodeRenderer: AgentRenderer = ({\n manifest,\n soul,\n rules,\n duties,\n agentName,\n agentDeployDir,\n workspaceRoot,\n abilityRefs,\n contractRefs,\n frameworkFragments,\n promptExtensions,\n}) => {\n const created: string[] = [];\n const warnings: string[] = [];\n\n const frontmatter: Record<string, unknown> = {\n name: agentName,\n description: manifest.description ?? `${agentName} agent`,\n };\n\n // Model: map to Claude Code's model field. Accepts aliases (sonnet/opus/haiku/inherit)\n // or a full Anthropic ID. Unrecognized values (e.g. legacy `claude-opus-4`) are\n // coerced to the matching family alias so the agent still loads.\n if (manifest.model?.preferred) {\n const raw = manifest.model.preferred;\n const normalized = normalizeAnthropicModel(raw);\n if (normalized !== raw) {\n warnings.push(\n `agent ${agentName}: model \"${raw}\" is not a valid Claude model ID; normalized to alias \"${normalized}\". Update agent.yaml.`,\n );\n }\n frontmatter.model = normalized;\n }\n\n // Tool restrictions\n if (manifest.tools?.allowed?.length) {\n frontmatter.tools = manifest.tools.allowed.join(\", \");\n }\n if (manifest.tools?.denied?.length) {\n frontmatter.disallowedTools = manifest.tools.denied.join(\", \");\n }\n\n // Runtime\n if (manifest.runtime?.max_turns) {\n frontmatter.maxTurns = manifest.runtime.max_turns;\n }\n\n // Metadata pass-through for Claude Code-specific fields\n if (manifest.metadata?.color) frontmatter.color = manifest.metadata.color;\n if (manifest.metadata?.effort) frontmatter.effort = manifest.metadata.effort;\n if (manifest.metadata?.isolation) frontmatter.isolation = manifest.metadata.isolation;\n\n const body = buildMarkdownBody(\n soul,\n rules,\n duties,\n abilityRefs,\n contractRefs,\n frameworkFragments,\n promptExtensions,\n );\n const content = `---\\n${stringifyYaml(frontmatter).trim()}\\n---\\n\\n${body}`;\n const filePath = join(agentDeployDir, `${agentName}.md`);\n writeAgent(filePath, content, workspaceRoot, created);\n\n return { created, warnings };\n};\n\n// ── OpenAI Codex ──────────────────────────────────────────────────────────────\n// Format: .codex/agents/<name>.toml\n// Sub-agent support: explicit user request only (not automatic)\n// Required fields: name, description, developer_instructions\n\n/**\n * Render a GitAgent to OpenAI Codex's `.codex/agents/<name>.toml` format.\n *\n * Produces a TOML file with `name`, `description`, and `developer_instructions`\n * fields. Triple-quoted TOML multi-line strings are escaped to avoid syntax errors.\n *\n * @docLink packages/asset-manager/api-reference#renderers\n */\nexport const codexRenderer: AgentRenderer = ({\n manifest,\n soul,\n rules,\n duties,\n agentName,\n agentDeployDir,\n workspaceRoot,\n abilityRefs,\n contractRefs,\n frameworkFragments,\n promptExtensions,\n}) => {\n const created: string[] = [];\n const warnings: string[] = [];\n\n const instructions = buildMarkdownBody(\n soul,\n rules,\n duties,\n abilityRefs,\n contractRefs,\n frameworkFragments,\n promptExtensions,\n );\n const escaped = toTomlMultilineString(instructions);\n\n const lines: string[] = [\n `name = ${JSON.stringify(agentName)}`,\n `description = ${JSON.stringify(manifest.description ?? `${agentName} agent`)}`,\n `developer_instructions = \"\"\"`,\n escaped.trim(),\n `\"\"\"`,\n ];\n if (manifest.model?.preferred) {\n lines.splice(2, 0, `model = ${JSON.stringify(manifest.model.preferred)}`);\n }\n\n const content = `${lines.join(\"\\n\")}\\n`;\n const filePath = join(agentDeployDir, `${agentName}.toml`);\n writeAgent(filePath, content, workspaceRoot, created);\n\n // Write the full agent identity as markdown for the Codex driver to read at runtime.\n // The driver combines this with the session's dynamic content (resources, context)\n // and passes the result via model_instructions_file.\n const agentMdPath = join(dirname(agentDeployDir), \"skaile-agent.md\");\n writeAgent(agentMdPath, instructions, workspaceRoot, created);\n\n return { created, warnings };\n};\n\n// ── oh-my-pi ─��────────────��────────────────────────────────��─────────────────\n// Format: .omp/agents/<name>/ (directory with agent.yaml + SOUL.md + RULES.md)\n// oh-my-pi reads GitAgent directories natively via PI_CODING_AGENT_DIR.\n// The renderer copies/enriches the source directory rather than flattening to .md.\n//\n// Installation → runtime handoff:\n// skaile install (ompRenderer) creates .omp/agents/<name>/ from GitAgent source\n// OmpDriver._start() sets env.PI_CODING_AGENT_DIR = agentDir in the child process\n// omp reads SOUL.md/RULES.md/knowledge/ from that directory natively on startup\n//\n// Note: REPL mode can bypass the install step — agentDir can point directly to the\n// GitAgent source directory, and omp will read it natively via PI_CODING_AGENT_DIR.\n// The rendered .omp/agents/ copy is only needed when the source is not accessible\n// from the project cwd (e.g. different repo, remote workspace).\n\n/**\n * Render a GitAgent to oh-my-pi's `.omp/agents/<name>/` directory format.\n *\n * Writes `agent.yaml` (with resolved model/tools/delegation) and an enriched\n * `SOUL.md` that includes fragments and extensions. omp reads this directory\n * natively via the `PI_CODING_AGENT_DIR` environment variable.\n *\n * @docLink packages/asset-manager/api-reference#renderers\n */\nexport const ompRenderer: AgentRenderer = ({\n manifest,\n soul,\n rules,\n duties,\n agentName,\n agentDeployDir,\n workspaceRoot,\n abilityRefs,\n contractRefs,\n frameworkFragments,\n promptExtensions,\n}) => {\n const created: string[] = [];\n const warnings: string[] = [];\n\n const destDir = join(agentDeployDir, agentName);\n mkdirSync(destDir, { recursive: true });\n\n // Write agent.yaml with tools resolved\n const agentYaml: Record<string, unknown> = {\n spec_version: manifest.spec_version ?? \"0.1.0\",\n name: manifest.name ?? agentName,\n version: manifest.version ?? \"1.0.0\",\n description: manifest.description ?? `${agentName} agent`,\n };\n // Pass model through verbatim — omp expects provider-prefixed full IDs and does\n // not understand Claude Code aliases (`opus` / `sonnet` / `haiku`). Invalid IDs\n // are caught upstream by `validateAgent` (ModelIdSchema in @skaile/workspaces/types).\n // Do NOT call `normalizeAnthropicModel` here: it would coerce a bad ID into a\n // Claude alias that omp cannot resolve, masking the failure.\n if (manifest.model) agentYaml.model = manifest.model;\n if (manifest.tools) agentYaml.tools = manifest.tools;\n if (manifest.delegation) agentYaml.delegation = manifest.delegation;\n if (manifest.runtime) agentYaml.runtime = manifest.runtime;\n if (manifest.requires?.length) agentYaml.requires = manifest.requires;\n if (manifest.tags?.length) agentYaml.tags = manifest.tags;\n if (manifest.metadata) agentYaml.metadata = manifest.metadata;\n\n writeFileSync(join(destDir, \"agent.yaml\"), stringifyYaml(agentYaml), \"utf-8\");\n\n // Write SOUL.md (enriched with fragments and extensions, like other renderers)\n const enrichedSoul = buildMarkdownBody(\n soul,\n rules,\n duties,\n abilityRefs,\n contractRefs,\n frameworkFragments,\n promptExtensions,\n );\n writeFileSync(join(destDir, \"SOUL.md\"), enrichedSoul, \"utf-8\");\n\n created.push(relative(workspaceRoot, destDir));\n return { created, warnings };\n};\n\n// ── Renderer registry ──────────────────────────────���──────────────────────────\n\nexport type Log = (msg: string) => void;\nconst noop: Log = () => {};\n\n/**\n * Render an agent to framework-native format via the renderer registry.\n *\n * Shared by both the simple deploy path (`deployAsset`) and the enriched scaffold path (agents layer).\n *\n * @param input - Full render input including manifest, SOUL/RULES text, and resolved refs.\n * @param driverTarget - Agent framework ID to look up in {@link AGENT_RENDERERS}.\n * @param log - Optional logger callback for progress messages.\n * @returns Object with `created` file paths and `warnings` list.\n * @docLink packages/asset-manager/api-reference#renderers\n */\nexport function renderAgentToFramework(\n input: AgentRenderInput,\n driverTarget: string,\n log: Log = noop,\n): { created: string[]; warnings: string[] } {\n const renderer = AGENT_RENDERERS[driverTarget];\n if (!renderer) {\n return { created: [], warnings: [`No renderer for framework \"${driverTarget}\"`] };\n }\n const result = renderer(input);\n for (const c of result.created) log(` rendered agent: ${c}`);\n for (const w of result.warnings) log(` warn: ${w}`);\n return result;\n}\n\n/**\n * Registry mapping framework IDs to their {@link AgentRenderer} functions.\n *\n * Only backends with a full bridge driver are registered. Add new entries\n * when a bridge driver is implemented in `workspaces/bridge/src/drivers/`.\n *\n * @docLink packages/asset-manager/api-reference#renderers\n */\nexport const AGENT_RENDERERS: Record<string, AgentRenderer> = {\n \"claude-code\": claudeCodeRenderer,\n omp: ompRenderer,\n codex: codexRenderer,\n};\n\n/**\n * Returns `true` if the given driver target supports file-based sub-agent installation.\n *\n * @param driverTarget - Agent framework ID to check.\n * @returns `true` when `driverTarget` has a registered entry in {@link AGENT_RENDERERS}.\n * @docLink packages/asset-manager/api-reference#renderers\n */\nexport function driverTargetSupportsAgents(driverTarget: string): boolean {\n return driverTarget in AGENT_RENDERERS;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../asset-manager/src/renderers.ts"],"names":["stringifyYaml"],"mappings":";;;;;AAiFA,SAAS,UAAA,CACP,QAAA,EACA,OAAA,EACA,aAAA,EACA,OAAA,EACM;AACN,EAAA,SAAA,CAAU,QAAQ,QAAQ,CAAA,EAAG,EAAE,SAAA,EAAW,MAAM,CAAA;AAChD,EAAA,aAAA,CAAc,QAAA,EAAU,SAAS,OAAO,CAAA;AACxC,EAAA,OAAA,CAAQ,IAAA,CAAK,QAAA,CAAS,aAAA,EAAe,QAAQ,CAAC,C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AW,KAAK,MAAA,CAAO,QAAA,EAAU,GAAA,CAAI,CAAA,QAAA,EAAW,CAAC,CAAA,CAAE,CAAA;AACnD,EAAA,OAAO,MAAA;AACT;AAUO,IAAM,eAAA,GAAiD;AAAA,EAC5D,aAAA,EAAe,kBAAA;AAAA,EACf,GAAA,EAAK,WAAA;AAAA,EACL,KAAA,EAAO;AACT;AASO,SAAS,2BAA2B,YAAA,EAA+B;AACxE,EAAA,OAAO,YAAA,IAAgB,eAAA;AACzB","file":"chunk-XUXVH3JK.js","sourcesContent":["/**\n * Framework-specific renderers for GitAgent packages.\n *\n * Each renderer transforms a parsed GitAgent package (agent.yaml + SOUL.md + RULES.md)\n * into the native file format that the target agent framework natively reads.\n *\n * Only backends with a full bridge driver (runtime execution) are included:\n * claude-code → .claude/agents/<name>.md (YAML frontmatter + markdown body)\n * omp → .omp/agents/<name>/ (directory with agent.yaml + SOUL.md)\n * codex → .codex/agents/<name>.toml (TOML)\n *\n * Removed (no bridge driver): cursor, roo, github-copilot, gemini, amp.\n * Add them back when a bridge driver is implemented.\n */\n\nimport { mkdirSync, writeFileSync } from \"node:fs\";\nimport { dirname, join, relative } from \"node:path\";\nimport type { AgentManifest } from \"@skaile/workspaces/core\";\nimport { normalizeAnthropicModel } from \"@skaile/workspaces/types/manifests\";\nimport { stringify as stringifyYaml } from \"yaml\";\nimport type { AbilityRef, ContractRef } from \"./fragments.js\";\n\n// ── Types ─────────────────────────────────��───────────────────────────────────\n\nexport type { AgentManifest };\n\n/**\n * All data an {@link AgentRenderer} needs to produce a native agent definition file.\n *\n * @docLink packages/asset-manager/api-reference#renderers\n */\nexport interface AgentRenderInput {\n /** Parsed `agent.yaml` manifest for the GitAgent being rendered. */\n manifest: AgentManifest;\n /** Raw content of `SOUL.md`, or `null` if absent. */\n soul: string | null;\n /** Raw content of `RULES.md`, or `null` if absent. */\n rules: string | null;\n /** Raw content of `DUTIES.md`, or `null` if absent. */\n duties: string | null;\n /** Agent name used as the output filename and frontmatter `name` field. */\n agentName: string;\n /** Resolved absolute path to the framework's agent deploy directory (e.g. `.claude/agents/`). */\n agentDeployDir: string;\n /** Absolute path to the workspace root. */\n workspaceRoot: string;\n /** Resolved ability refs — installed skills referenced in the `## Installed Abilities` section. */\n abilityRefs: AbilityRef[];\n /** Resolved contract refs — installed in the skills dir, listed in the `## Contracts` section. */\n contractRefs: ContractRef[];\n /** Resolved framework fragment markdown blocks (agent-mode, handoff, skill-discovery, etc.). */\n frameworkFragments: string[];\n /** Per-project prompt extension markdown blocks loaded from `skaile.yaml` `agent.prompt-extensions`. */\n promptExtensions: string[];\n}\n\n/**\n * Result returned by every {@link AgentRenderer}.\n *\n * @docLink packages/asset-manager/api-reference#renderers\n */\nexport interface AgentRenderResult {\n /** Paths to files/dirs created, relative to `workspaceRoot`. */\n created: string[];\n /** Non-fatal warnings (e.g. experimental feature notices). */\n warnings: string[];\n}\n\n/**\n * A function that transforms an {@link AgentRenderInput} into framework-native agent definition files.\n *\n * @docLink packages/asset-manager/api-reference#renderers\n */\nexport type AgentRenderer = (input: AgentRenderInput) => AgentRenderResult;\n\n// ── Helpers ───────────────────────────────────────────────────────────────────\n\n/**\n * Write an agent definition file, always overwriting if it already exists.\n * Agents are compiled artifacts — they must reflect the current canonical source.\n */\nfunction writeAgent(\n filePath: string,\n content: string,\n workspaceRoot: string,\n created: string[],\n): void {\n mkdirSync(dirname(filePath), { recursive: true });\n writeFileSync(filePath, content, \"utf-8\");\n created.push(relative(workspaceRoot, filePath));\n}\n\n/**\n * Build the full agent system prompt body baked into the framework-native agent file.\n *\n * This is the sole source of the agent's system prompt body. Agent identity is rendered at install time; the backend reads it natively at runtime.\n * The rendered output ends up in .claude/agents/<name>.md, .omp/agents/<name>/SOUL.md,\n * .codex/agents/<name>.toml and is read natively by the framework on every agent invocation.\n *\n * Composition order:\n * 1. SOUL.md — agent identity and values (inlined verbatim)\n * 2. Framework fragments — agent-mode, handoff, skill-discovery, connector-usage\n * (conditional; see fragments.ts BUILT_IN_FRAGMENTS)\n * 3. ## Constraints — RULES.md behavioral constraints (inlined)\n * 4. ## Duties — DUTIES.md responsibilities (inlined)\n * 5. ## Installed Abilities — skill name + description, listed as slash commands\n * 6. ## Contracts — relative paths to CONTRACT.md in the skills dir\n * 7. Prompt extensions — per-project markdown from skaile.yaml agent.prompt-extensions\n */\nfunction buildMarkdownBody(\n soul: string | null,\n rules: string | null,\n duties: string | null,\n abilityRefs: AbilityRef[],\n contractRefs: ContractRef[],\n frameworkFragments: string[],\n promptExtensions: string[],\n): string {\n const parts: string[] = [];\n\n if (soul) parts.push(soul.trim());\n for (const fragment of frameworkFragments) parts.push(fragment);\n if (rules) parts.push(`## Constraints\\n\\n${rules.trim()}`);\n if (duties) parts.push(`## Duties\\n\\n${duties.trim()}`);\n\n if (abilityRefs.length > 0) {\n const lines = [\"## Installed Abilities\", \"\"];\n for (const a of abilityRefs) lines.push(`- \\`/${a.name}\\` — ${a.description}`);\n parts.push(lines.join(\"\\n\"));\n }\n\n if (contractRefs.length > 0) {\n const lines = [\n \"## Contracts\",\n \"\",\n \"Read the relevant contract before acting on constrained tasks:\",\n \"\",\n ];\n for (const c of contractRefs) lines.push(`- \\`${c.relativePath}\\``);\n parts.push(lines.join(\"\\n\"));\n }\n\n for (const ext of promptExtensions) parts.push(ext);\n\n return `${parts.join(\"\\n\\n\")}\\n`;\n}\n\n/** Escape a string for use as a TOML multi-line basic string (triple-quote). */\nfunction toTomlMultilineString(s: string): string {\n // Replace \"\"\" with \\\\\"\"\" to avoid breaking the TOML literal\n return s.replace(/\"\"\"/g, '\\\\\"\\\\\"\\\\\"');\n}\n\n// ── Claude Code ────────────��──────────────────────────────────────────────────\n// Format: .claude/agents/<name>.md\n// Sub-agent support: automatic (description-based) + @-mention\n// Required frontmatter: name, description\n//\n// Installation → runtime handoff:\n// skaile install (claudeCodeRenderer) creates the .md file from GitAgent source\n// ClaudeSdkDriver.startQuery() passes options.agent = agentName to the SDK query\n// The SDK reads .claude/agents/<agentName>.md to get model, tools, and system prompt\n// This is equivalent to running: claude --agent <agentName>\n\n/**\n * Render a GitAgent to Claude Code's `.claude/agents/<name>.md` format.\n *\n * Writes YAML frontmatter (name, description, model, tools, maxTurns) followed\n * by the enriched system prompt body. Always overwrites to reflect current source.\n *\n * @docLink packages/asset-manager/api-reference#renderers\n */\nexport const claudeCodeRenderer: AgentRenderer = ({\n manifest,\n soul,\n rules,\n duties,\n agentName,\n agentDeployDir,\n workspaceRoot,\n abilityRefs,\n contractRefs,\n frameworkFragments,\n promptExtensions,\n}) => {\n const created: string[] = [];\n const warnings: string[] = [];\n\n const frontmatter: Record<string, unknown> = {\n name: agentName,\n description: manifest.description ?? `${agentName} agent`,\n };\n\n // Model: map to Claude Code's model field. Accepts aliases (sonnet/opus/haiku/inherit)\n // or a full Anthropic ID. Unrecognized values (e.g. legacy `claude-opus-4`) are\n // coerced to the matching family alias so the agent still loads.\n if (manifest.model?.preferred) {\n const raw = manifest.model.preferred;\n const normalized = normalizeAnthropicModel(raw);\n if (normalized !== raw) {\n warnings.push(\n `agent ${agentName}: model \"${raw}\" is not a valid Claude model ID; normalized to alias \"${normalized}\". Update agent.yaml.`,\n );\n }\n frontmatter.model = normalized;\n }\n\n // Tool restrictions\n if (manifest.tools?.allowed?.length) {\n frontmatter.tools = manifest.tools.allowed.join(\", \");\n }\n if (manifest.tools?.denied?.length) {\n frontmatter.disallowedTools = manifest.tools.denied.join(\", \");\n }\n\n // Runtime\n if (manifest.runtime?.max_turns) {\n frontmatter.maxTurns = manifest.runtime.max_turns;\n }\n\n // Metadata pass-through for Claude Code-specific fields\n if (manifest.metadata?.color) frontmatter.color = manifest.metadata.color;\n if (manifest.metadata?.effort) frontmatter.effort = manifest.metadata.effort;\n if (manifest.metadata?.isolation) frontmatter.isolation = manifest.metadata.isolation;\n\n const body = buildMarkdownBody(\n soul,\n rules,\n duties,\n abilityRefs,\n contractRefs,\n frameworkFragments,\n promptExtensions,\n );\n const content = `---\\n${stringifyYaml(frontmatter).trim()}\\n---\\n\\n${body}`;\n const filePath = join(agentDeployDir, `${agentName}.md`);\n writeAgent(filePath, content, workspaceRoot, created);\n\n return { created, warnings };\n};\n\n// ── OpenAI Codex ──────────────────────────────────────────────────────────────\n// Format: .codex/agents/<name>.toml\n// Sub-agent support: explicit user request only (not automatic)\n// Required fields: name, description, developer_instructions\n\n/**\n * Render a GitAgent to OpenAI Codex's `.codex/agents/<name>.toml` format.\n *\n * Produces a TOML file with `name`, `description`, and `developer_instructions`\n * fields. Triple-quoted TOML multi-line strings are escaped to avoid syntax errors.\n *\n * @docLink packages/asset-manager/api-reference#renderers\n */\nexport const codexRenderer: AgentRenderer = ({\n manifest,\n soul,\n rules,\n duties,\n agentName,\n agentDeployDir,\n workspaceRoot,\n abilityRefs,\n contractRefs,\n frameworkFragments,\n promptExtensions,\n}) => {\n const created: string[] = [];\n const warnings: string[] = [];\n\n const instructions = buildMarkdownBody(\n soul,\n rules,\n duties,\n abilityRefs,\n contractRefs,\n frameworkFragments,\n promptExtensions,\n );\n const escaped = toTomlMultilineString(instructions);\n\n const lines: string[] = [\n `name = ${JSON.stringify(agentName)}`,\n `description = ${JSON.stringify(manifest.description ?? `${agentName} agent`)}`,\n `developer_instructions = \"\"\"`,\n escaped.trim(),\n `\"\"\"`,\n ];\n if (manifest.model?.preferred) {\n lines.splice(2, 0, `model = ${JSON.stringify(manifest.model.preferred)}`);\n }\n\n const content = `${lines.join(\"\\n\")}\\n`;\n const filePath = join(agentDeployDir, `${agentName}.toml`);\n writeAgent(filePath, content, workspaceRoot, created);\n\n // Write the full agent identity as markdown for the Codex driver to read at runtime.\n // The driver combines this with the session's dynamic content (resources, context)\n // and passes the result via model_instructions_file.\n const agentMdPath = join(dirname(agentDeployDir), \"skaile-agent.md\");\n writeAgent(agentMdPath, instructions, workspaceRoot, created);\n\n return { created, warnings };\n};\n\n// ── oh-my-pi ─��────────────��────────────────────────────────��─────────────────\n// Format: .omp/agents/<name>/ (directory with agent.yaml + SOUL.md + RULES.md)\n// oh-my-pi reads GitAgent directories natively via PI_CODING_AGENT_DIR.\n// The renderer copies/enriches the source directory rather than flattening to .md.\n//\n// Installation → runtime handoff:\n// skaile install (ompRenderer) creates .omp/agents/<name>/ from GitAgent source\n// OmpDriver._start() sets env.PI_CODING_AGENT_DIR = agentDir in the child process\n// omp reads SOUL.md/RULES.md/knowledge/ from that directory natively on startup\n//\n// Note: REPL mode can bypass the install step — agentDir can point directly to the\n// GitAgent source directory, and omp will read it natively via PI_CODING_AGENT_DIR.\n// The rendered .omp/agents/ copy is only needed when the source is not accessible\n// from the project cwd (e.g. different repo, remote workspace).\n\n/**\n * Render a GitAgent to oh-my-pi's `.omp/agents/<name>/` directory format.\n *\n * Writes `agent.yaml` (with resolved model/tools/delegation) and an enriched\n * `SOUL.md` that includes fragments and extensions. omp reads this directory\n * natively via the `PI_CODING_AGENT_DIR` environment variable.\n *\n * @docLink packages/asset-manager/api-reference#renderers\n */\nexport const ompRenderer: AgentRenderer = ({\n manifest,\n soul,\n rules,\n duties,\n agentName,\n agentDeployDir,\n workspaceRoot,\n abilityRefs,\n contractRefs,\n frameworkFragments,\n promptExtensions,\n}) => {\n const created: string[] = [];\n const warnings: string[] = [];\n\n const destDir = join(agentDeployDir, agentName);\n mkdirSync(destDir, { recursive: true });\n\n // Write agent.yaml with tools resolved\n const agentYaml: Record<string, unknown> = {\n spec_version: manifest.spec_version ?? \"0.1.0\",\n name: manifest.name ?? agentName,\n version: manifest.version ?? \"1.0.0\",\n description: manifest.description ?? `${agentName} agent`,\n };\n // Pass model through verbatim — omp expects provider-prefixed full IDs and does\n // not understand Claude Code aliases (`opus` / `sonnet` / `haiku`). Invalid IDs\n // are caught upstream by `validateAgent` (ModelIdSchema in @skaile/workspaces/types).\n // Do NOT call `normalizeAnthropicModel` here: it would coerce a bad ID into a\n // Claude alias that omp cannot resolve, masking the failure.\n if (manifest.model) agentYaml.model = manifest.model;\n if (manifest.tools) agentYaml.tools = manifest.tools;\n if (manifest.delegation) agentYaml.delegation = manifest.delegation;\n if (manifest.runtime) agentYaml.runtime = manifest.runtime;\n if (manifest.requires?.length) agentYaml.requires = manifest.requires;\n if (manifest.tags?.length) agentYaml.tags = manifest.tags;\n if (manifest.metadata) agentYaml.metadata = manifest.metadata;\n\n writeFileSync(join(destDir, \"agent.yaml\"), stringifyYaml(agentYaml), \"utf-8\");\n\n // Write SOUL.md (enriched with fragments and extensions, like other renderers)\n const enrichedSoul = buildMarkdownBody(\n soul,\n rules,\n duties,\n abilityRefs,\n contractRefs,\n frameworkFragments,\n promptExtensions,\n );\n writeFileSync(join(destDir, \"SOUL.md\"), enrichedSoul, \"utf-8\");\n\n created.push(relative(workspaceRoot, destDir));\n return { created, warnings };\n};\n\n// ── Renderer registry ──────────────────────────────���──────────────────────────\n\nexport type Log = (msg: string) => void;\nconst noop: Log = () => {};\n\n/**\n * Render an agent to framework-native format via the renderer registry.\n *\n * Shared by both the simple deploy path (`deployAsset`) and the enriched scaffold path (agents layer).\n *\n * @param input - Full render input including manifest, SOUL/RULES text, and resolved refs.\n * @param driverTarget - Agent framework ID to look up in {@link AGENT_RENDERERS}.\n * @param log - Optional logger callback for progress messages.\n * @returns Object with `created` file paths and `warnings` list.\n * @docLink packages/asset-manager/api-reference#renderers\n */\nexport function renderAgentToFramework(\n input: AgentRenderInput,\n driverTarget: string,\n log: Log = noop,\n): { created: string[]; warnings: string[] } {\n const renderer = AGENT_RENDERERS[driverTarget];\n if (!renderer) {\n return { created: [], warnings: [`No renderer for framework \"${driverTarget}\"`] };\n }\n const result = renderer(input);\n for (const c of result.created) log(` rendered agent: ${c}`);\n for (const w of result.warnings) log(` warn: ${w}`);\n return result;\n}\n\n/**\n * Registry mapping framework IDs to their {@link AgentRenderer} functions.\n *\n * Only backends with a full bridge driver are registered. Add new entries\n * when a bridge driver is implemented in `workspaces/bridge/src/drivers/`.\n *\n * @docLink packages/asset-manager/api-reference#renderers\n */\nexport const AGENT_RENDERERS: Record<string, AgentRenderer> = {\n \"claude-code\": claudeCodeRenderer,\n omp: ompRenderer,\n codex: codexRenderer,\n};\n\n/**\n * Returns `true` if the given driver target supports file-based sub-agent installation.\n *\n * @param driverTarget - Agent framework ID to check.\n * @returns `true` when `driverTarget` has a registered entry in {@link AGENT_RENDERERS}.\n * @docLink packages/asset-manager/api-reference#renderers\n */\nexport function driverTargetSupportsAgents(driverTarget: string): boolean {\n return driverTarget in AGENT_RENDERERS;\n}\n"]}
|
package/dist/cli/index.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { openCatalogSource, openLibraryManager, createFullRegistry, openLibrary } from '../chunk-
|
|
2
|
+
import { openCatalogSource, openLibraryManager, createFullRegistry, openLibrary } from '../chunk-CIEKKLMG.js';
|
|
3
3
|
import { logErr, S, logOk, logInfo, colorRef, logWarn, kindColorPad, kindColor, formatRelativeTime, fitWidth } from '../chunk-GYPA2Q7F.js';
|
|
4
4
|
import { getStoreConfig, storeFetch, saveStoreTokens, clearStoreTokens, isStoreAuthenticated } from '../chunk-2BEDUMTA.js';
|
|
5
5
|
import { AI_RESOURCES, aiResourceRoots } from '../chunk-BXYMGZCI.js';
|
|
6
6
|
import { LocalSecretsProvider } from '../chunk-6BEGKO2Q.js';
|
|
7
|
-
import { resolveLibraryDir, LocalCatalogSource, skaileHomeDir } from '../chunk-
|
|
8
|
-
import '../chunk-
|
|
7
|
+
import { resolveLibraryDir, LocalCatalogSource, skaileHomeDir } from '../chunk-M54RYUXY.js';
|
|
8
|
+
import '../chunk-5FVJXQDP.js';
|
|
9
9
|
import '../chunk-JXT46QFC.js';
|
|
10
10
|
import '../chunk-UKJMQZV6.js';
|
|
11
11
|
import '../chunk-R7FOF242.js';
|
|
12
|
-
import { runFlow, resumeFlow } from '../chunk-
|
|
12
|
+
import { runFlow, resumeFlow } from '../chunk-WRDHUTOK.js';
|
|
13
13
|
import '../chunk-4R6DROGN.js';
|
|
14
14
|
import { validateFlowVersions, parseSkillFrontmatter } from '../chunk-GXC3TYMQ.js';
|
|
15
|
-
import { runAgentChat, loadSessionById, loadSession, listSessions, setCurrentSession, deleteSession, clearSession, loadAgentManifest, compileComposition, MarkdownStreamer, resolveMixin } from '../chunk-
|
|
16
|
-
import { buildClaudePluginFiles } from '../chunk-
|
|
15
|
+
import { runAgentChat, loadSessionById, loadSession, listSessions, setCurrentSession, deleteSession, clearSession, loadAgentManifest, compileComposition, MarkdownStreamer, resolveMixin } from '../chunk-N4FSBCLV.js';
|
|
16
|
+
import { buildClaudePluginFiles } from '../chunk-R4YUZRGF.js';
|
|
17
17
|
import '../chunk-X5YPJV4N.js';
|
|
18
18
|
import '../chunk-O7SG5PC2.js';
|
|
19
19
|
import '../chunk-7QBNJTTQ.js';
|
|
@@ -28,7 +28,7 @@ import '../chunk-BMQKMOQY.js';
|
|
|
28
28
|
import '../chunk-GAH4YRCI.js';
|
|
29
29
|
import '../chunk-OCAQH66V.js';
|
|
30
30
|
import '../chunk-LV2HPH3C.js';
|
|
31
|
-
import '../chunk-
|
|
31
|
+
import '../chunk-U2XHHLE3.js';
|
|
32
32
|
import '../chunk-OVRSNIKJ.js';
|
|
33
33
|
import '../chunk-R4H6EJW5.js';
|
|
34
34
|
import '../chunk-3HUUP3JC.js';
|
|
@@ -36,8 +36,8 @@ import '../chunk-6E6PKKAD.js';
|
|
|
36
36
|
import { loadFlow, loadAllFlows } from '../chunk-X46FY45B.js';
|
|
37
37
|
import '../chunk-DEYYRFQU.js';
|
|
38
38
|
import '../chunk-IFGTRL2I.js';
|
|
39
|
-
import { AssetManager } from '../chunk-
|
|
40
|
-
import '../chunk-
|
|
39
|
+
import { AssetManager } from '../chunk-WKZ5R4NP.js';
|
|
40
|
+
import '../chunk-NYMRKIOR.js';
|
|
41
41
|
import { readLock, resolveSettings, globalSettingsPath, projectSettingsPath, loadSettings, saveSettings, portableSpawn, portableSpawnSync, WorkspaceYamlEditor } from '../chunk-KYQNWFJV.js';
|
|
42
42
|
import { assetSearchDirs, detectDomains } from '../chunk-ZAP2BDHG.js';
|
|
43
43
|
import '../chunk-HVCZLD5Z.js';
|
|
@@ -51,8 +51,8 @@ import { DRIVER_DEFAULTS } from '../chunk-K5GBV4SA.js';
|
|
|
51
51
|
import { openSqlite } from '../chunk-JB35MVBN.js';
|
|
52
52
|
import '../chunk-KTBKW2FI.js';
|
|
53
53
|
import '../chunk-UQ6LFBPZ.js';
|
|
54
|
-
import '../chunk-
|
|
55
|
-
import '../chunk-
|
|
54
|
+
import '../chunk-XUXVH3JK.js';
|
|
55
|
+
import '../chunk-RGPBEGP2.js';
|
|
56
56
|
import '../chunk-CGYEHQOX.js';
|
|
57
57
|
import '../chunk-NSBPE2FW.js';
|
|
58
58
|
import * as fs11 from 'fs';
|
|
@@ -509,7 +509,7 @@ function makeCatalogCommand() {
|
|
|
509
509
|
return catalog;
|
|
510
510
|
}
|
|
511
511
|
async function runLocalCatalogTest(projectDir) {
|
|
512
|
-
const { resolveCatalogSource } = await import('../open-library-
|
|
512
|
+
const { resolveCatalogSource } = await import('../open-library-FHUXOCN7.js');
|
|
513
513
|
let resolved;
|
|
514
514
|
try {
|
|
515
515
|
resolved = await resolveCatalogSource({ projectDir });
|
|
@@ -3011,7 +3011,7 @@ function actOnHeader(row, action3) {
|
|
|
3011
3011
|
return row.type === "domain-header" || row.type === "domain-info";
|
|
3012
3012
|
}
|
|
3013
3013
|
async function loadAssets() {
|
|
3014
|
-
const { gatherAssetFeeds } = await import('../asset-feeds-
|
|
3014
|
+
const { gatherAssetFeeds } = await import('../asset-feeds-3PSV57NT.js');
|
|
3015
3015
|
const { entries, domains, notes } = await gatherAssetFeeds(am, am.projectDir);
|
|
3016
3016
|
if (notes.length > 0) {
|
|
3017
3017
|
state.message = notes.map((n) => `[${n.feed}] ${n.message}`).join(" \u2022 ");
|
|
@@ -3109,7 +3109,7 @@ function reconcileCollapsedSets(rows) {
|
|
|
3109
3109
|
async function loadSourcesAndLibraries() {
|
|
3110
3110
|
try {
|
|
3111
3111
|
const [{ openLibraryManager: openLibraryManager2 }, { skaileHomeDir: skaileHomeDir2 }] = await Promise.all([
|
|
3112
|
-
import('../open-library-
|
|
3112
|
+
import('../open-library-FHUXOCN7.js'),
|
|
3113
3113
|
import('../library/index.js')
|
|
3114
3114
|
]);
|
|
3115
3115
|
const { manager, library, close } = await openLibraryManager2();
|
|
@@ -4262,7 +4262,7 @@ async function runRefInstall(ref, opts) {
|
|
|
4262
4262
|
const spinner5 = p5.spinner();
|
|
4263
4263
|
spinner5.start(`Installing ${ref}`);
|
|
4264
4264
|
try {
|
|
4265
|
-
const { openCatalogSource: openCatalogSource2, openLibrary: openLibrary2 } = await import('../open-library-
|
|
4265
|
+
const { openCatalogSource: openCatalogSource2, openLibrary: openLibrary2 } = await import('../open-library-FHUXOCN7.js');
|
|
4266
4266
|
const catalog = await openCatalogSource2({ projectDir: path12__default.resolve(opts.projectDir) });
|
|
4267
4267
|
if (!supportsInstallManifest(catalog)) {
|
|
4268
4268
|
throw new Error(
|
|
@@ -4294,7 +4294,7 @@ async function runRefInstall(ref, opts) {
|
|
|
4294
4294
|
async function runYamlInstall(opts) {
|
|
4295
4295
|
const projectDir = path12__default.resolve(opts.projectDir);
|
|
4296
4296
|
try {
|
|
4297
|
-
const { ensureSourcesCloned } = await import('../ensure-sources-
|
|
4297
|
+
const { ensureSourcesCloned } = await import('../ensure-sources-VQDZB7NT.js');
|
|
4298
4298
|
const hydrate = ensureSourcesCloned(projectDir, { quiet: true });
|
|
4299
4299
|
if (hydrate.cloned.length > 0) {
|
|
4300
4300
|
logOk(`Cloned source(s): ${hydrate.cloned.join(", ")}`);
|
|
@@ -6848,7 +6848,7 @@ async function bootstrapUserConfig() {
|
|
|
6848
6848
|
}
|
|
6849
6849
|
async function hydrateInitSources(resolved, created) {
|
|
6850
6850
|
try {
|
|
6851
|
-
const { ensureSourcesCloned } = await import('../ensure-sources-
|
|
6851
|
+
const { ensureSourcesCloned } = await import('../ensure-sources-VQDZB7NT.js');
|
|
6852
6852
|
const hydrate = ensureSourcesCloned(resolved, { quiet: true });
|
|
6853
6853
|
for (const n of hydrate.cloned) created.push(`~/.skaile/sources/${n}/`);
|
|
6854
6854
|
if (hydrate.failed.length > 0) {
|
package/dist/connectors/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { AbstractConnector, BUILTIN_CONNECTOR_CATALOG, ConnectorFieldMissingError, ConnectorManager, ConnectorStartupError, DEFAULT_REACTIVE_COOLDOWN_MS, FleetHealthGate, FlowAdapter, LogBuffer, ManagedGitconfigCollisionError, NOT_READY_SENTINEL, PROACTIVE_RCLONE_REFRESH_MARGIN_MS, RoMountPlaceholderBarrier, atomicReplaceCredential, buildConnectorPromptSection, buildSdkConnectorTools, createRcloneTokenRefresh, createWorktree, defaultMountPlaceholderBarrier, defaultSpawn, ensureFleetMounted, findGitRoot, findMissingPackages, getConnector, installNpmPackages, isFleetManaged, isPackageResolvable, listConnectors, listWorktrees, probeFleetHealth, registerBuiltinConnectors, removeMountBlock, renderCredentialHelperScript, tryGetConnector, worktreeRegistry, writeHelperScript, writeMountBlock } from '../chunk-
|
|
1
|
+
export { AbstractConnector, BUILTIN_CONNECTOR_CATALOG, ConnectorFieldMissingError, ConnectorManager, ConnectorStartupError, DEFAULT_REACTIVE_COOLDOWN_MS, FleetHealthGate, FlowAdapter, LogBuffer, ManagedGitconfigCollisionError, NOT_READY_SENTINEL, PROACTIVE_RCLONE_REFRESH_MARGIN_MS, RoMountPlaceholderBarrier, atomicReplaceCredential, buildConnectorPromptSection, buildSdkConnectorTools, createRcloneTokenRefresh, createWorktree, defaultMountPlaceholderBarrier, defaultSpawn, ensureFleetMounted, findGitRoot, findMissingPackages, getConnector, installNpmPackages, isFleetManaged, isPackageResolvable, listConnectors, listWorktrees, probeFleetHealth, registerBuiltinConnectors, removeMountBlock, renderCredentialHelperScript, tryGetConnector, worktreeRegistry, writeHelperScript, writeMountBlock } from '../chunk-U2XHHLE3.js';
|
|
2
2
|
export { renderGoogleDriveConfig, renderOneDriveConfig, renderWebDAVConfig } from '../chunk-OVRSNIKJ.js';
|
|
3
3
|
export { EnvSecretProvider, ForgeSecretProvider, InMemorySecretProvider, LegacyAuthGrammarError, LockedSecretProvider, MountTokenMediatorError, OAuthRequiredError, PreMintedSecretProvider, SecretProviderChain, createCliSecretProviderChain, createForgeSecretProviderChain, deriveSingleMaterializedConnectorDeclaration, fromMaterializedConnectorMd, loadConnectorDeclarations, loadMaterializedConnectorDeclarations, resolveAuth, resolveAuthRef, resolveBackendAuthFor, resolveMountCredential, resolveMountCredentialString } from '../chunk-R4H6EJW5.js';
|
|
4
4
|
export { PortPool, RcloneProcessManager, createFsWatcher, ensureDirMode, fetchAuthoritativeSize } from '../chunk-3HUUP3JC.js';
|
|
@@ -110,6 +110,12 @@ export interface ConnectorManagerOptions {
|
|
|
110
110
|
* (or 0 + manual `reportFleetHealth`) to stay hermetic.
|
|
111
111
|
*/
|
|
112
112
|
fleetHealthPollMs?: number;
|
|
113
|
+
/**
|
|
114
|
+
* Detects host-mount RECOVERY under an opaque placeholder so the local poll can
|
|
115
|
+
* lift the gate edge-triggered. Defaults to the `/proc/self/mounts` reader;
|
|
116
|
+
* tests inject a hermetic stub (the real reader can't be faked in a sandbox).
|
|
117
|
+
*/
|
|
118
|
+
fleetMountRecoveryProbe?: (target: string) => Promise<boolean>;
|
|
113
119
|
}
|
|
114
120
|
/**
|
|
115
121
|
* `ConnectorManager` — manages the full lifecycle of all connectors declared
|
|
@@ -143,6 +149,8 @@ export declare class ConnectorManager {
|
|
|
143
149
|
private fleetHealthTimer?;
|
|
144
150
|
/** Local fleet-health poll interval (ms). 0 disables the local probe. */
|
|
145
151
|
private readonly fleetHealthPollMs;
|
|
152
|
+
/** Host-mount recovery detector under an opaque placeholder (injectable for tests). */
|
|
153
|
+
private readonly fleetMountRecoveryProbe;
|
|
146
154
|
/**
|
|
147
155
|
* @param workspaceDir - Absolute (or relative) working directory. Filesystem-face
|
|
148
156
|
* connectors mount into `<workspaceDir>/.mounts/<id>/` by default.
|
|
@@ -242,13 +250,22 @@ export declare class ConnectorManager {
|
|
|
242
250
|
private preRegisterDeferred;
|
|
243
251
|
/**
|
|
244
252
|
* Start the periodic local fleet-health probe if it is not already running and
|
|
245
|
-
* the poll interval is enabled. Each tick
|
|
246
|
-
*
|
|
247
|
-
*
|
|
248
|
-
* degradation is covered by the platform signal via
|
|
253
|
+
* the poll interval is enabled. Each tick probes every fleet target and feeds
|
|
254
|
+
* the verdict to its gate (hysteresis lives in the gate). The probe catches both
|
|
255
|
+
* directly-detectable failures (EIO / dead bind) AND host-mount recovery while a
|
|
256
|
+
* placeholder is up; silent degradation is covered by the platform signal via
|
|
257
|
+
* `reportFleetHealth`.
|
|
249
258
|
*/
|
|
250
259
|
private ensureFleetHealthPoll;
|
|
251
260
|
private runFleetHealthProbe;
|
|
261
|
+
/**
|
|
262
|
+
* Detect host-mount RECOVERY for an already-gated target so the placeholder lifts
|
|
263
|
+
* edge-triggered (no restart). Over an opaque mask a stat/readdir reads the 0555
|
|
264
|
+
* mask and falsely reads healthy, so recovery is detected via the mount table;
|
|
265
|
+
* non-opaque surfaces hold their current surface until the platform signal lifts.
|
|
266
|
+
* Rationale: `_devlog/notes/2026-06-17-fleet-gate-edge-triggered-recovery.md`.
|
|
267
|
+
*/
|
|
268
|
+
private probeGatedRecovery;
|
|
252
269
|
/**
|
|
253
270
|
* Feed an externally-derived fleet-health verdict for a connector into its gate.
|
|
254
271
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connector-manager.d.ts","sourceRoot":"","sources":["../../../connectors/src/connector-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAG5D,OAAO,KAAK,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAC7E,OAAO,KAAK,EAAE,oBAAoB,EAAU,MAAM,0BAA0B,CAAC;AAG7E,OAAO,KAAK,EAEV,SAAS,EACT,oBAAoB,EACpB,oBAAoB,EAEpB,eAAe,EACf,sBAAsB,EACtB,sBAAsB,EACtB,aAAa,EAEd,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,
|
|
1
|
+
{"version":3,"file":"connector-manager.d.ts","sourceRoot":"","sources":["../../../connectors/src/connector-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAG5D,OAAO,KAAK,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAC7E,OAAO,KAAK,EAAE,oBAAoB,EAAU,MAAM,0BAA0B,CAAC;AAG7E,OAAO,KAAK,EAEV,SAAS,EACT,oBAAoB,EACpB,oBAAoB,EAEpB,eAAe,EACf,sBAAsB,EACtB,sBAAsB,EACtB,aAAa,EAEd,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EACL,KAAK,kBAAkB,EAIxB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAEL,KAAK,uBAAuB,EAC7B,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,uBAAuB,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACjG,OAAO,KAAK,EACV,gBAAgB,EAChB,cAAc,EACd,WAAW,EACX,mBAAmB,EACnB,aAAa,EACb,YAAY,EACZ,WAAW,EACX,UAAU,EACV,WAAW,EACX,YAAY,EACb,MAAM,mBAAmB,CAAC;AAI3B;;GAEG;AACH,UAAU,eAAe;IACvB,SAAS,EAAE,SAAS,CAAC;IACrB,MAAM,EAAE,eAAe,CAAC;IACxB,WAAW,EAAE,oBAAoB,CAAC;IAClC,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B;;;;OAIG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EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;IAmBzF;;;;;OAKG;IACG,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;IA4B9F;;;OAGG;IACH,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,mBAAmB,EAAE;IAOhD;;;OAGG;IACH,UAAU,IAAI,sBAAsB,EAAE;IAStC;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,WAAW,UAAO,GAAG,MAAM;CAUlD"}
|
|
@@ -82,6 +82,8 @@ export declare class FleetHealthGate {
|
|
|
82
82
|
get isGated(): boolean;
|
|
83
83
|
/** The currently-applied surface (test/observability hook). */
|
|
84
84
|
get currentSurface(): Surface;
|
|
85
|
+
/** The mount target this gate guards (recovery-probe lookup). */
|
|
86
|
+
get mountTarget(): string;
|
|
85
87
|
/**
|
|
86
88
|
* Feed one health verdict. Applies hysteresis, then drives the barrier toward
|
|
87
89
|
* the target surface on a change. Resolves once the (possibly no-op)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fleet-health-gate.d.ts","sourceRoot":"","sources":["../../../connectors/src/fleet-health-gate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAEtE,wFAAwF;AACxF,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,IAAI,GAAG,QAAQ,CAAC;AAExD,MAAM,WAAW,sBAAsB;IACrC,uEAAuE;IACvE,kBAAkB,CAAC,EAAE,MAAM,CA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AO,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAmBnD;;;;OAIG;IACH,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAMxB,OAAO,CAAC,OAAO;IAKf,4EAA4E;YAC9D,KAAK;CAmDpB"}
|
|
@@ -54,4 +54,14 @@ export type FleetHealthVerdict = "healthy" | "degraded" | "error";
|
|
|
54
54
|
* verdict here therefore means only "readable", not "has content".
|
|
55
55
|
*/
|
|
56
56
|
export declare function probeFleetHealth(dir: string): Promise<FleetHealthVerdict>;
|
|
57
|
+
/**
|
|
58
|
+
* Detect a live underlying fleet mount at `dir` from the mount table — spots
|
|
59
|
+
* host-mount RECOVERY while an opaque read-only placeholder still masks the target.
|
|
60
|
+
* A stat/readdir reads the 0555 mask and falsely reads healthy, so the recovery
|
|
61
|
+
* edge is a non-tmpfs mount stacked at the mountpoint. `true` = recovered bind
|
|
62
|
+
* present; `false` = only the placeholder tmpfs/nothing, or an unreadable mount
|
|
63
|
+
* table (fail-closed: stay gated).
|
|
64
|
+
* Rationale: `_devlog/notes/2026-06-17-fleet-gate-edge-triggered-recovery.md`.
|
|
65
|
+
*/
|
|
66
|
+
export declare function probeFleetMountTablePresent(dir: string): Promise<boolean>;
|
|
57
67
|
//# sourceMappingURL=fleet-utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fleet-utils.d.ts","sourceRoot":"","sources":["../../../connectors/src/fleet-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;
|
|
1
|
+
{"version":3,"file":"fleet-utils.d.ts","sourceRoot":"","sources":["../../../connectors/src/fleet-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAQ3D;AAED;;;;;;;;;GASG;AACH,wBAAsB,kBAAkB,CACtC,GAAG,EAAE,MAAM,EACX,GAAG,EAAE;IAAE,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;CAAE,EACnD,OAAO,CAAC,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,cAAc,CAAC,EAAE,MAAM,CAAA;CAAE,GACxD,OAAO,CAAC,IAAI,CAAC,CAwBf;AAED;;;;;;;;;GASG;AACH,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,UAAU,GAAG,OAAO,CAAC;AAElE;;;;;;;;;;;;GAYG;AACH,wBAAsB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAS/E;AAED;;;;;;;;GAQG;AACH,wBAAsB,2BAA2B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAoB/E"}
|