import { type AgentDriver, type ModelTierOverrides } from "@skaile/workspaces/bridge"; import type { BindingOrigin } from "./contract/expression.js"; import type { FlowNode } from "./engine/types.js"; /** Strict v2 subprompt node admitted by the pure engine. */ export type SubpromptFlowNode = FlowNode & { run: Extract, { kind: "subprompt"; }>; }; /** Resolved execution request for one isolated subprompt call. */ export interface SubpromptExecutorRequest { /** Available strict v2 subprompt node selected by the pure engine. */ node: SubpromptFlowNode; /** * Fully-assembled prompt text — the node's instruction, already interpolated * with resolved bindings, plus a JSON-response directive when the node * declares an output contract. This is the ONLY input the isolated driver * sees: no session conversation, no driver context. */ prompt: string; /** Binding values already resolved at the node boundary — carried for parity with the other executor requests. */ inputs: Record; /** Provenance retained separately from the values sent to the model. */ inputOrigins: Record; /** Cancels the owned driver and its in-flight tool calls when the node stops waiting. */ signal?: AbortSignal; } /** Captured result of one isolated subprompt driver call. */ export interface SubpromptExecutorResult { /** Text scraped from the isolated driver's response, accumulated across its stream. */ text: string; } /** Runtime seam for the subprompt node kind — a runtime-owned, isolated model call. */ export interface SubpromptRunner { /** Executes one available subprompt node on a fresh, isolated driver instance. */ execute(request: SubpromptExecutorRequest): Promise; } /** * Non-secret cloud transport settings, field-identical to bridge's * `AgentConfig.cloudConfig` — kept inline rather than imported so this file's * public option surface doesn't widen with every unrelated `AgentConfig` field. */ export interface SubpromptCloudConfig { region?: string; projectId?: string; resource?: string; baseUrl?: string; } /** Host dependencies for constructing one isolated driver per subprompt call. */ export interface SessionSubpromptRunnerOptions { /** Driver backend id — the same one the session driver was constructed with (e.g. `"claude-sdk"`, `"omp"`). */ driverType: string; /** LLM provider — the same value the session driver was constructed with. */ provider?: string; /** Concrete model id the session driver is using; the fallback for every tier absent a configured override. */ sessionModel?: string; /** Working directory for the isolated driver — the already-materialized session workspace. */ workspaceDir: string; /** Pre-resolved API key forwarded to every isolated instance — the same value the session driver received, never re-resolved here. */ apiKey?: string; /** Cloud transport — the same value the session driver was constructed with. Omit (or `"default"`) for the provider's native API. */ cloud?: string; cloudConfig?: SubpromptCloudConfig; cloudSecrets?: Record; /** Per-tier model overrides for this deployment. Absent means the provider's built-in tiers apply. */ modelTierOverrides?: ModelTierOverrides; /** Authoritative managed-model inventory; a missing requested model is denied before launch. */ availableModels?: readonly string[]; /** * Hard ceiling on one isolated call, defaulting to * {@link DEFAULT_SUBPROMPT_TIMEOUT_MS}. Independent of `control.timeoutSec`, * which is optional and bounds the adapter's *wait* without reaching the * driver this class owns. */ timeoutMs?: number; /** Runtime-owned construction seam for managed drivers that need fresh private state per call. */ createIsolatedDriver?: (model: string | undefined) => Promise<{ driver: AgentDriver; dispose?: () => void | Promise; }>; } /** * Runs subprompt nodes on isolated `AgentDriver` instances constructed the * same way the session driver was — same backend, credentials, and cloud * transport — but with no system prompt, no tools, and no conversation * history. Each call spins a fresh instance and kills it afterward; * isolation comes from the separate instance, not from clearing shared state * (`resetSession()` mutates the shared session and is never used here). * * Credentials reach this class exactly the way they reach the session * driver: the two production wiring sites (`run-flow.ts`, `runner/src/serve.ts`) * pass through the same resolved `provider`/`apiKey`/`cloud*` values they * already computed for `createSessionDriver` — no new resolution path. */ export declare class SessionSubpromptRunner implements SubpromptRunner { private readonly options; constructor(options: SessionSubpromptRunnerOptions); execute(request: SubpromptExecutorRequest): Promise; } /** * Ceiling on one isolated subprompt call. Every other model call in the runtime * is bounded (`turnTimeoutMs`, `FLOW_TURN_TIMEOUT_MS`); `control.timeoutSec` is * optional and has no default, so without this a backend that never emits * `agent_end` — one parked on a tool that awaits a human, say — would hang the * flow's drain permanently rather than failing the node. */ export declare const DEFAULT_SUBPROMPT_TIMEOUT_MS: number; //# sourceMappingURL=subprompt-runner.d.ts.map