import type { FabricDynamicGuestDeclarations } from "../protocol.js"; export declare const PI_CORE_COMPATIBILITY_ARGUMENT_TYPE_NAMES: { readonly read: "PiReadCompatibilityArgument"; readonly bash: "PiBashCompatibilityArgument"; readonly powershell: "PiPowerShellCompatibilityArgument"; readonly edit: "PiEditCompatibilityArgument"; readonly write: "PiWriteCompatibilityArgument"; readonly grep: "PiGrepCompatibilityArgument"; readonly find: "PiFindCompatibilityArgument"; readonly ls: "PiLsCompatibilityArgument"; }; export declare const PI_CORE_NUMERIC_FIELDS: { readonly read: readonly ["offset", "limit"]; readonly bash: readonly ["timeout"]; readonly powershell: readonly ["timeout"]; readonly edit: readonly []; readonly write: readonly []; readonly grep: readonly ["context", "limit"]; readonly find: readonly ["limit"]; readonly ls: readonly ["limit"]; }; export declare const GUEST_TYPE_DECLARATIONS = "\n\ntype NativeModelType = \"chat\" | \"image\" | \"classifier\";\ninterface NativeModelInfo { type?: NativeModelType; provider: string; id: string; name: string; api: string; input: (\"text\" | \"image\")[]; contextWindow?: number; [key: string]: unknown }\ntype NativeModelSelector = { provider: string; id: string };\ntype NativeClassifierQuestion =\n | { type: \"choice\"; instructions: string; criteria: Record }\n | { type: \"score\"; instructions: string; criteria: string[] }\n | { type: \"bool\"; instructions: string; criteria: { true: string; false: string } };\ntype NativeClassifierAnswer =\n | { type: \"choice\"; choice: string; probabilities: Record; confidence: number }\n | { type: \"score\"; score: number; confidence: number }\n | { type: \"bool\"; probability: number };\ninterface NativeClassifierContext { state: Record; questions: Record; images?: NativeImageBlock[] }\ninterface NativeModelUsage { input: number; output: number; totalTokens: number; cost: { total: number } }\ninterface NativeClassifierResult { provider: string; model: string; answers: Record; usage?: NativeModelUsage; stopReason: \"stop\" | \"error\" | \"aborted\"; errorMessage?: string }\ntype NativeImageBlock = { type: \"image\"; data: string; mimeType: string };\ntype NativeTextBlock = { type: \"text\"; text: string };\ninterface NativeImagesContext { input: (NativeImageBlock | NativeTextBlock)[] }\ninterface NativeImagesResult { provider: string; model: string; output: (NativeImageBlock | NativeTextBlock)[]; usage?: NativeModelUsage; stopReason: \"stop\" | \"error\" | \"aborted\"; errorMessage?: string }\ninterface FabricNativeModels {\n (): Promise;\n getModelsOfType(type: NativeModelType, provider?: string): Promise;\n getAvailableOfType(type: NativeModelType, provider?: string): Promise;\n getModelOfType(type: NativeModelType, provider: string, id: string): Promise;\n classify(model: NativeModelSelector, context: NativeClassifierContext): Promise;\n generateImages(model: NativeModelSelector, context: NativeImagesContext): Promise;\n}\ninterface NativeToolInfo { name: string; description: string }\ndeclare const ALL_TOOLS: readonly NativeToolInfo[];\ndeclare function searchTools(query: string, options?: { limit?: number; namespace?: string }): Promise;\ndeclare function describeTool(name: string): Promise<(NativeToolInfo & { declaration: string }) | undefined>;\ndeclare function describeNamespace(name: string): Promise<{ name: string; description?: string; instructions?: string; tools: NativeToolInfo[] } | undefined>;\ndeclare const nativeDiscovery: {\n readonly ALL_TOOLS: readonly NativeToolInfo[];\n searchTools(query: string, options?: {limit?: number; namespace?: string}): Promise;\n describeTool(name: string): Promise;\n describeNamespace(name: string): Promise<{name: string; description?: string; instructions?: string; tools: string[]} | undefined>;\n};\ndeclare const models: FabricNativeModels;\ndeclare function store(key: string, value: unknown): void;\ndeclare function load(key: string): T | undefined;\ndeclare function text(value: unknown): void;\ndeclare function image(value: NativeImageBlock | string | { image_url: string | { url: string } }): void;\ndeclare function exit(): never;\n\ntype JsonPrimitive = string | number | boolean | null;\ntype JsonValue = JsonPrimitive | JsonValue[] | { [key: string]: JsonValue };\ntype FabricTransport = \"auto\" | \"process\" | \"tmux\" | \"screen\" | \"localterm\" | \"herdr\" | \"herdr-core\";\ntype FabricAgentRunner = \"pi-durable\" | \"pi\" | \"claude\" | \"veda\" | (string & {});\ntype FabricKernel = \"typescript\" | \"python\";\ntype FabricThinking = \"off\" | \"minimal\" | \"low\" | \"medium\" | \"high\" | \"xhigh\" | \"max\";\ninterface FabricActionEffect {\n kind: \"none\" | \"scoped\" | \"transactional\" | \"emission\";\n resources?: string[];\n ordering?: \"commutative\" | \"ordered\" | \"unknown\";\n}\ninterface FabricAction {\n ref: string;\n provider: string;\n name: string;\n description: string;\n inputSchema: Record;\n outputSchema?: Record;\n risk: \"read\" | \"write\" | \"execute\" | \"network\" | \"agent\";\n namespace?: string;\n effect?: FabricActionEffect;\n}\ninterface FabricAgentRequest {\n /** Omitted/inherit uses caller executor.kernel; concrete choices require Pi with extensions. */\n kernel?: FabricKernel | \"inherit\";\n task: string;\n /** Name of an agent file listed by agents.definitions(); fields passed here win over the file. */\n agent?: string;\n name?: string;\n runner?: FabricAgentRunner;\n transport?: FabricTransport;\n model?: string;\n /** Pi only. \"exact\": select a visible provider/id without aliases or fuzzy matching; strict admission and a partial guard are not final-dispatch enforcement. Later hooks, unknown APIs, providers or extension calls can route data elsewhere. */\n modelMatch?: \"exact\";\n holdQuestions?: true;\n persona?: string;\n thinking?: FabricThinking;\n /** Child thinking bounds; must lie inside this session's bounds. Levels outside are clamped. */\n thinkingBounds?: FabricThinkingBounds;\n tools?: string[];\n timeoutMs?: number;\n extensions?: boolean;\n recursive?: boolean;\n /** Filesystem execution directory; relative paths resolve from the parent agent cwd. */\n cwd?: string;\n worktree?: boolean;\n /** Shell command run in the new worktree before launch. */\n worktreeSetup?: string;\n /** Pi only. branch: fork this conversation (last completed turn); snippet: prefix recent messages. */\n seed?: \"task\" | \"branch\" | \"snippet\";\n seedMessages?: number;\n /** Pi only write confinement; bash needs shell: \"unconfined\". */\n readOnly?: boolean;\n writableRoots?: string[];\n shell?: \"deny\" | \"unconfined\";\n /** Narrow the host-issued scope; omitted inherits it. Refused when this session is unscoped. */\n scope?: { grants: { resource: string; actions: (\"read\" | \"write\" | \"execute\")[] }[] };\n schema?: Record;\n /** Appended to the child's system prompt (Veda receives it as a block); blank is ignored and durable spawn refuses it. */\n systemPrompt?: string;\n /** Pi only. Skills by name from this session: false = none; a list = preload those plus this session's others; inherit: false = only the preloaded ones. */\n skills?: false | string[] | { preload?: string[]; inherit?: boolean };\n prompt?: string;\n instructions?: string;\n timeout_ms?: number;\n residency?: FabricParticipantResidency;\n /** agents.spawn only: return a \"queued\" handle at once; the run starts when a concurrency slot frees. */\n queue?: boolean;\n /** Opt in to session persistence for hook-based observability and external trace ingestion. */\n persistSession?: boolean;\n}\ninterface FabricHandoffCall {\n readonly ref: string;\n}\ninterface FabricHandoffFacts {\n readonly calls: readonly FabricHandoffCall[];\n count(ref?: string | readonly string[]): number;\n}\ntype FabricHandoffPredicate = (facts: Readonly) => boolean;\ninterface FabricHandoffRequest {\n kernel?: FabricKernel | \"inherit\";\n model: string;\n task?: string;\n when?: FabricHandoffPredicate;\n name?: string;\n transport?: FabricTransport;\n thinking?: FabricThinking;\n tools?: string[];\n timeoutMs?: number;\n extensions?: boolean;\n recursive?: boolean;\n schema?: Record;\n prompt?: string;\n instructions?: string;\n timeout_ms?: number;\n}\ninterface FabricHandoffResult {\n scheduled: true;\n status: \"deferred\";\n boundary: \"fabric_exec_end\";\n}\ninterface FabricMainAgentInfo {\n id: string;\n name: \"Main\";\n kind: \"main\";\n status: \"idle\" | \"running\" | \"remote\";\n runner: \"pi\";\n transport: \"host\";\n cwd?: string;\n sessionId?: string;\n model?: string;\n thinking?: string;\n startedAt?: number;\n updatedAt: number;\n pendingMessages: boolean;\n local: boolean;\n}\ninterface FabricPeerInfo {\n id: string;\n name: string;\n kind: \"peer\";\n status: \"idle\" | \"running\";\n runner: \"pi\";\n transport: \"host\";\n cwd: string;\n sessionId: string;\n model?: string;\n thinking?: string;\n startedAt: number;\n updatedAt: number;\n pendingMessages: boolean;\n local: false;\n}\ntype FabricParticipantKind = \"root\" | \"agent\" | \"actor\";\ntype FabricParticipantResidency = \"session\" | \"durable\";\ntype FabricParticipantScope = \"local\" | \"lineage\" | \"project\";\ntype FabricParticipantCapability = \"steer\" | \"followUp\" | \"stop\" | \"ask\" | \"actor-bindings\" | \"attach\" | \"fabric\";\ninterface FabricParticipantInfo {\n format: 1;\n id: string;\n kind: FabricParticipantKind | \"provider\";\n rootId: string;\n ownerHostId: string;\n ownerIdentityId: string;\n ownerIncarnation?: string;\n parentId?: string;\n name: string;\n status: string;\n runner?: FabricAgentRunner;\n provider?: string;\n transport: FabricTransport | \"host\";\n capabilities: FabricParticipantCapability[];\n cwd?: string;\n sessionId?: string;\n model?: string;\n thinking?: string;\n startedAt: number;\n updatedAt: number;\n finishedAt?: number;\n pendingMessages?: boolean;\n currentTool?: string;\n turns?: number;\n toolCalls?: number;\n usage?: { input: number; output: number; cacheRead: number; cacheWrite: number; cost: number };\n actorQueued?: number;\n actorMessages?: number;\n controlProtocol: \"v1\" | \"legacy\";\n residency: FabricParticipantResidency;\n local: boolean;\n stale: boolean;\n}\ntype FabricLifecycleEventType =\n | \"pi.input\"\n | \"pi.agent_start\"\n | \"pi.agent_end\"\n | \"pi.turn_end\"\n | \"pi.agent_settled\"\n | \"pi.tool_error\"\n | \"pi.session_compact\"\n | \"run.completed\"\n | \"run.failed\"\n | \"run.stopped\"\n | \"run.timed_out\"\n | \"run.resumed\"\n | \"run.detached\"\n | \"tokens.usage\"\n | \"component.state\";\ntype FabricLifecycleDelivery = \"steer\" | \"followUp\";\ninterface FabricLifecycleSource {\n id: string;\n name: string;\n kind: FabricParticipantKind;\n rootId: string;\n runner: FabricAgentRunner;\n ownerHostId?: string;\n ownerIdentityId?: string;\n}\ninterface FabricLifecycleEvent {\n version: 1;\n id: string;\n sequence: number;\n event: FabricLifecycleEventType;\n source: FabricLifecycleSource;\n occurredAt: number;\n publishedAt: number;\n runId?: string;\n status?: string;\n data?: unknown;\n}\ninterface FabricLifecycleSubscription {\n format: 1;\n id: string;\n from: string;\n events: FabricLifecycleEventType[];\n to: string;\n delivery: FabricLifecycleDelivery;\n triggerTurn: boolean;\n once: boolean;\n afterSequence: number;\n createdAt: number;\n updatedAt: number;\n createdBy: { id: string; name: string; kind: \"main\" | \"agent\" | \"actor\"; sessionId?: string };\n lastDeliveredAt?: number;\n lastEventId?: string;\n lastError?: string;\n}\ninterface FabricAgentHandle {\n /** Resolved Fabric kernel, absent for non-Fabric runners. */\n kernel?: FabricKernel;\n id: string;\n name: string;\n status: string;\n runner: FabricAgentRunner;\n /** Local execution metadata is absent for hosted participants. */\n transport?: FabricTransport;\n cwd?: string;\n rootId?: string;\n parentId?: string;\n depth?: number;\n generation?: number;\n model?: string;\n thinking?: FabricThinking;\n /** Present only when the requested level was clamped into thinking bounds. */\n requestedThinking?: FabricThinking;\n actorId?: string;\n actorName?: string;\n sessionId?: string;\n runnerSessionId?: string;\n attachCommand?: string;\n branch?: string;\n worktree?: string;\n text?: string;\n value?: unknown;\n error?: string;\n logFile?: string;\n residency?: FabricParticipantResidency;\n}\ninterface FabricRemoteControlResult {\n queued: true;\n messageId: string;\n routed: \"mesh\";\n acknowledged: true;\n}\ninterface FabricAgentResult extends FabricAgentHandle {\n task: string;\n startedAt: number;\n finishedAt?: number;\n turns: number;\n toolCalls: number;\n text: string;\n value?: unknown;\n error?: string;\n usage: { input: number; output: number; cacheRead: number; cacheWrite: number; cost: number };\n pendingMessages?: { steering: string[]; followUp: string[] };\n /** worktree: true runs; worktree stays the path. */\n worktreeResult?: {\n path: string; branch?: string; baseRef?: string; changedFiles: string[];\n diffstat: { files: number; insertions: number; deletions: number }; kept: boolean; diffError?: string;\n };\n}\ninterface FabricModelInfo {\n runner?: FabricAgentRunner;\n provider: string;\n id: string;\n name: string;\n key: string;\n value?: string;\n resolvedModel?: string;\n displayName?: string;\n description?: string;\n supportsEffort?: boolean;\n supportedEffortLevels?: string[];\n supportsAdaptiveThinking?: boolean;\n supportsFastMode?: boolean;\n supportsAutoMode?: boolean;\n}\ninterface FabricLogLine {\n index?: number;\n offset: number;\n raw: string;\n parsed?: unknown;\n}\ninterface FabricAgentLog {\n id: string;\n runDirectory: string;\n logFile: string;\n status?: FabricAgentResult;\n events: FabricLogLine[];\n hasMore: boolean;\n before?: number;\n}\ninterface FabricActorLog {\n actorId: string;\n actorName: string;\n sessionFile: string;\n logDir: string;\n session: FabricLogLine[];\n sessionHasMore: boolean;\n sessionBefore?: number;\n run?: {\n runId: string;\n eventsFile: string;\n status?: FabricAgentResult;\n events: FabricLogLine[];\n hasMore: boolean;\n before?: number;\n };\n retainedRuns: string[];\n}\ninterface FabricCapabilityActionHead {\n key: string;\n parentKey: string;\n ref: string;\n name: string;\n description: string;\n descriptorHash: string;\n risk: \"read\" | \"write\" | \"execute\" | \"network\" | \"agent\";\n namespace?: string;\n effect?: FabricActionEffect;\n}\ninterface FabricCapabilityProviderHead {\n key: string;\n parentKey: string;\n name: string;\n description: string;\n descriptorHash: string;\n actions: FabricCapabilityActionHead[];\n}\ninterface FabricCapabilityCatalog {\n kind: \"pi-fabric.capability-catalog\";\n version: 1;\n root: {\n key: \"capability:fabric\";\n name: \"Fabric capabilities\";\n description: string;\n descriptorHash: string;\n };\n providers: FabricCapabilityProviderHead[];\n totalActions: number;\n indexedActions: number;\n complete: boolean;\n reasons: string[];\n}\ninterface FabricActionListEnvelope {\n kind: \"pi-fabric.action-list\";\n version: 1;\n actions: FabricAction[];\n /** Full visible-action count before paging. */\n total: number;\n /** True when total exceeds the returned page: more actions exist. */\n truncated: boolean;\n limit: number;\n}\ninterface FabricActionSearchBackend {\n requested: \"semantic\";\n used: \"semantic\" | \"lexical\";\n degraded: boolean;\n model?: string;\n usage?: { inputTokens: number; outputTokens: number };\n abstained?: boolean;\n reason?: \"timeout\" | \"rate_limited\" | \"service_unavailable\";\n}\ninterface FabricActionSearchEnvelope {\n kind: \"pi-fabric.action-search\";\n version: 1;\n actions: FabricAction[];\n backend: FabricActionSearchBackend;\n}\ninterface FabricToolsApi {\n [name: string]: any;\n providers(): Promise>;\n catalog(args?: { provider?: string; limit?: number }): Promise;\n /**\n * Capped discovery page: default 100 entries, silently truncated (hard cap\n * 1000). A short result never proves an action is absent \u2014 confirm with\n * search() or pass envelope: true to get totals and a truncated flag.\n */\n list(args?: { provider?: string; namespace?: string; query?: string; limit?: number; envelope?: boolean }): Promise;\n search(args: { query: string; limit?: number; searchMode?: \"lexical\" | \"semantic\" }): Promise;\n describe(args: { ref: string }): Promise;\n call(args: { ref: string; args?: Record }): Promise;\n progress(args: { message: string }): Promise;\n models: FabricNativeModels;\n}\ninterface FabricCapturedToolResult {\n content: Array<{ type: string; text?: string; [key: string]: unknown }>;\n text: string;\n details?: unknown;\n isError: boolean;\n terminate?: boolean;\n source: { path: string; source: string; scope: string; origin: string; baseDir?: string };\n}\ninterface FabricCapturedTool {\n (args?: Record): Promise;\n}\ntype FabricExtensionsApi = Record;\n// A provider another extension registers is a global named after it when\n// the name is free (src/provider-globals.ts). Each call is\n// tools.call({ ref: \".\", args }). Typed actions come from\n// the provider's input schemas (runtime/dynamic-guest-types.ts); actions\n// without usable types keep this loose shape and validate at dispatch.\ninterface FabricProviderGlobal {\n [action: string]: (args?: Record) => Promise;\n}\n// String-primary tools (read/bash/powershell/grep/find/ls) accept a bare string; the\n// runtime proxy coerces it to { : string }. Lets the model write\n// the natural form (pi.bash(\"ls\")) instead of pi.bash({ command: \"ls\" }).\n// Return shapes differ by tool: read/grep/find/ls return their text as a bare\n// string (e.g. const src: string = await pi.read({ path })); shell/edit/write\n// return { ok, output, details } (e.g. const { output } = await pi.bash(...)).\n// Common alias keys (cmd\u2192command, query\u2192pattern, file\u2192path, dir\u2192path) and a\n// flat edit shape ({ path, oldText, newText }) are also accepted; the runtime\n// proxy normalizes them to the canonical form before the host validates args.\n// Bash timeout is measured in seconds; timeoutMs is converted from milliseconds.\n// After executor.shellHangMs the await still resolves ok: true with a still-running\n// notice, pid, and live output path in details; background: true (alias\n// run_in_background) detaches immediately. The process keeps writing that file.\n// timeout bounds the process, not the wait; tasks.wait waits for the result.\n// Extended near-miss repairs: find's name/filename/glob \u2192 pattern, write's\n// data \u2192 content, ls's folder \u2192 path, bash's script \u2192 command; numeric option\n// fields (limit/offset/context/timeout) also accept numeric strings, coerced\n// at runtime (2322 diagnostics are suppressed by the type-checker by design).\n// String-primary tools also take a two-arg (primary, options) form \u2014\n// pi.read(\"index.ts\", { limit: 120 }) merges to { path, ...options } at\n// runtime, the positional string winning the primary field on conflict.\n// shell/edit/write envelopes are proxy-guarded so string-method access\n// (.trim(), .split(), iteration) fails with an actionable TypeError pointing\n// at .output instead of QuickJS's context-free \"not a function\" \u2014 property-\n// miss (2339) checks are suppressed by design, so the runtime gives the hint.\ntype PiPathArgument = {\n path?: string;\n file?: string;\n absolutePath?: string;\n file_path?: string;\n filePath?: string;\n filepath?: string;\n pathname?: string;\n target_file?: string;\n targetFile?: string;\n absolute_path?: string;\n fileAbsolutePath?: string;\n};\ntype PiOptionalPathArgument = {\n path?: string;\n file?: string;\n absolutePath?: string;\n file_path?: string;\n filePath?: string;\n filepath?: string;\n pathname?: string;\n target_file?: string;\n targetFile?: string;\n absolute_path?: string;\n fileAbsolutePath?: string;\n dir?: string;\n folder?: string;\n directory?: string;\n directoryPath?: string;\n};\ntype PiOldTextArgument = {\n oldText?: string;\n old?: string;\n old_string?: string;\n oldString?: string;\n old_str?: string;\n oldStr?: string;\n from?: string;\n old_value?: string;\n old_text?: string;\n oldContent?: string;\n old_content?: string;\n};\ntype PiNewTextArgument = {\n newText?: string;\n new?: string;\n replacement?: string;\n new_string?: string;\n newString?: string;\n new_str?: string;\n newStr?: string;\n to?: string;\n new_value?: string;\n new_text?: string;\n newContent?: string;\n new_content?: string;\n};\ntype PiEditOperation = PiOldTextArgument & PiNewTextArgument & { all?: boolean };\ntype PiCommandArgument = { command?: string; cmd?: string; shell?: string; cmdline?: string; script?: string; commandLine?: string };\ntype PiContentArgument = { content?: string; contents?: string; body?: string; text?: string; data?: string; fileContent?: string };\ntype PiGrepPatternArgument = { pattern?: string; query?: string; regex?: string; search?: string; q?: string; expression?: string; text?: string };\ntype PiFindPatternArgument = { pattern?: string; query?: string; regex?: string; search?: string; name?: string; filename?: string; glob?: string; expression?: string; include?: string };\n// Two-arg (primary, options) bags for the string-primary tools. Only option\n// aliases belong here (max/start/ctx/ic/...), never primary-field aliases \u2014\n// the primary field comes from the positional string.\ntype PiReadOptions = { offset?: number; limit?: number; start?: number; max?: number };\n// cwd is honored per call by the pi provider, which binds the command to a\n// shell definition rooted there; relative paths resolve from the session cwd.\n// The alias spellings mirror the shell entries in __piArgAliases: the\n// runtime repairs them, so the checker has to accept the same spellings or a\n// repairable call is rejected before it ever reaches the sandbox.\ntype PiShellOptions = {\n timeout?: number; timeoutMs?: number; settle?: boolean;\n background?: boolean; run_in_background?: boolean;\n description?: string;\n /** Opt-in line events; implies background. ui never wakes the model; wake may start an owning-agent turn. */\n monitor?: { delivery: \"ui\" | \"wake\"; timeoutMs?: number; intervalMs?: number; match?: string };\n cwd?: string; workdir?: string; directory?: string; workingDirectory?: string;\n};\ntype PiBashOptions = PiShellOptions & {\n /** Owned by an external jev-fabric store (macOS/Linux): keeps running if Pi exits and reattaches on resume. Implies background. */\n durable?: boolean;\n /** Durable only: on exit publish {kind ?? \"task.completed\", data:{taskId, exitCode, description?}}. */\n notify?: { topic: string; kind?: string };\n};\ntype PiPowerShellOptions = PiShellOptions;\ntype PiGrepOptions = { path?: string; glob?: string; globPattern?: string; ignoreCase?: boolean; ic?: boolean; caseInsensitive?: boolean; literal?: boolean; context?: number; ctx?: number; limit?: number; max?: number };\ntype PiFindOptions = { path?: string; limit?: number; max?: number };\ntype PiLsOptions = { limit?: number; max?: number };\ntype PiReadArgument = string | (PiPathArgument & PiReadOptions);\ntype PiBashArgument = string | (PiCommandArgument & PiBashOptions);\ntype PiPowerShellArgument = string | (PiCommandArgument & PiPowerShellOptions);\ntype PiEditFlatArgument = PiPathArgument & PiOldTextArgument & PiNewTextArgument & { all?: boolean };\ntype PiEditArgument = PiPathArgument & ({ edits: PiEditOperation[]; all?: boolean } | PiEditFlatArgument);\ntype PiWriteArgument = string | (PiPathArgument & PiContentArgument);\ntype PiGrepArgument = string | (PiGrepPatternArgument & PiGrepOptions);\ntype PiFindArgument = string | (PiFindPatternArgument & PiFindOptions);\ntype PiLsArgument = string | (PiOptionalPathArgument & PiLsOptions);\ntype PiNumericString = T extends number ? T | string : T;\ntype PiNumericStringOptions = { [K in keyof T]: PiNumericString };\ntype PiReadCompatibilityArgument = string | (PiPathArgument & PiNumericStringOptions);\ntype PiBashCompatibilityArgument = string | (PiCommandArgument & PiNumericStringOptions);\ntype PiPowerShellCompatibilityArgument = string | (PiCommandArgument & PiNumericStringOptions);\ntype PiEditCompatibilityArgument = PiEditFlatArgument;\ntype PiWriteCompatibilityArgument = PiWriteArgument;\ntype PiGrepCompatibilityArgument = string | (PiGrepPatternArgument & PiNumericStringOptions);\ntype PiFindCompatibilityArgument = string | (PiFindPatternArgument & PiNumericStringOptions);\ntype PiLsCompatibilityArgument = string | (PiOptionalPathArgument & PiNumericStringOptions);\ninterface PiToolsApi {\n read(args: PiReadArgument, options?: PiReadOptions): Promise;\n bash(args: PiBashArgument, options?: PiBashOptions): Promise<{ ok: true; output: string; details: unknown } | { ok: false; output: string; details: null; exitCode: number; error: string }>;\n powershell(args: PiPowerShellArgument, options?: PiPowerShellOptions): Promise<{ ok: true; output: string; details: unknown } | { ok: false; output: string; details: null; exitCode: number; error: string }>;\n edit(args: PiEditArgument): Promise<{ ok: true; output: string; details: unknown }>;\n edit(path: string, oldText: string, newText: string): Promise<{ ok: true; output: string; details: unknown }>;\n write(args: PiWriteArgument): Promise<{ ok: true; output: string; details: unknown }>;\n write(path: string, content: string): Promise<{ ok: true; output: string; details: unknown }>;\n grep(args: PiGrepArgument): Promise;\n grep(pattern: string, path?: string | PiGrepOptions, limit?: number): Promise;\n find(args: PiFindArgument): Promise;\n find(pattern: string, path?: string | PiFindOptions, limit?: number): Promise;\n ls(args?: PiLsArgument, options?: PiLsOptions): Promise;\n}\ntype FabricActorHostEvent =\n | \"resources_discover\"\n | \"session_start\"\n | \"session_info_changed\"\n | \"session_before_switch\"\n | \"session_before_fork\"\n | \"session_before_compact\"\n | \"session_compact\"\n | \"session_shutdown\"\n | \"session_before_tree\"\n | \"session_tree\"\n | \"input\"\n | \"before_agent_start\"\n | \"agent_start\"\n | \"agent_end\"\n | \"agent_settled\"\n | \"turn_start\"\n | \"turn_end\"\n | \"message_start\"\n | \"message_update\"\n | \"message_end\"\n | \"context\"\n | \"before_provider_headers\"\n | \"before_provider_request\"\n | \"after_provider_response\"\n | \"tool_execution_start\"\n | \"tool_call\"\n | \"tool_execution_update\"\n | \"tool_result\"\n | \"tool_execution_end\"\n | \"model_select\"\n | \"thinking_level_select\"\n | \"user_bash\"\n | \"tool_error\";\ntype FabricActorDelivery = \"mailbox\" | \"steer\" | \"followUp\" | \"nextTurn\";\ninterface FabricActorHostMediaDescriptor {\n readonly type: \"image\";\n readonly mediaIndex: number;\n readonly mimeType: string;\n}\ninterface FabricActorHostSignal {\n readonly payload: unknown;\n readonly media?: readonly FabricActorHostMediaDescriptor[];\n readonly idle: boolean;\n readonly observedAt: number;\n}\ntype FabricActorActivation =\n | { readonly kind: \"hostEvent\"; readonly id: string; readonly source: string; readonly sequence: number; readonly createdAt: number; readonly event: FabricActorHostEvent; readonly mainRevision: number; readonly taskRevision: number; readonly signal?: FabricActorHostSignal }\n | { readonly kind: \"direct\"; readonly id: string; readonly source: string; readonly sequence: number; readonly createdAt: number }\n | { readonly kind: \"mesh\"; readonly id: string; readonly source: string; readonly sequence: number; readonly createdAt: number; readonly topic: string };\ninterface FabricActorValidityFacts {\n readonly activation: Readonly;\n readonly current: Readonly<{ latestActivationSequence: number; mainRevision: number; taskRevision: number; idle: boolean; now: number }>;\n}\ntype FabricActorValidityDecision = boolean | { valid: boolean; reason?: string };\ntype FabricActorBindingScope = \"session\" | \"project\";\ninterface FabricActorRunBinding { model?: string; thinking?: FabricThinking }\ntype FabricActorValidWhile = (facts: Readonly) => FabricActorValidityDecision;\ninterface FabricActorRequestBase {\n /** Fixed at creation; ask/tell cannot change language. Global templates resolve inheritance on import. */\n kernel?: FabricKernel | \"inherit\";\n scope?: \"session\" | \"project\" | \"global\";\n name: string;\n instructions: string;\n events?: FabricActorHostEvent[];\n topics?: string[];\n responseMode?: \"text\" | \"directive\";\n coalesce?: boolean;\n runner?: FabricAgentRunner;\n model?: string;\n thinking?: FabricThinking;\n tools?: string[];\n transport?: FabricTransport;\n timeoutMs?: number;\n timeout_ms?: number;\n extensions?: boolean;\n requires?: Array;\n validWhile?: FabricActorValidWhile;\n residency?: FabricParticipantResidency;\n}\ntype FabricActorRequest = FabricActorRequestBase & (\n | { delivery?: \"mailbox\"; triggerTurn?: false }\n | { delivery: \"nextTurn\"; triggerTurn?: false }\n | { delivery: \"steer\" | \"followUp\"; triggerTurn: boolean }\n);\ntype FabricGlobalActorTemplate = FabricActorRequest & { id: string; createdAt: number; updatedAt: number };\ninterface FabricActorInfo {\n kernel?: FabricKernel;\n pythonRuntime?: \"cpython\" | \"monty\";\n id: string;\n scope: \"session\" | \"project\";\n name: string;\n status: \"idle\" | \"queued\" | \"running\" | \"stopped\";\n runner: FabricAgentRunner;\n events: FabricActorHostEvent[];\n topics: string[];\n delivery: FabricActorDelivery;\n responseMode: \"text\" | \"directive\";\n triggerTurn: boolean;\n coalesce: boolean;\n model?: string;\n thinking?: FabricThinking;\n binding?: FabricActorRunBinding & { scope: \"session\"; sessionId: string; updatedAt?: number };\n projectDefaults?: FabricActorRunBinding & { scope: \"project\" };\n tools?: string[];\n timeoutMs?: number;\n extensions?: boolean;\n requirements?: Array<{ ref: string; optional?: boolean }>;\n capabilityDigest?: string;\n missingCapabilities?: string[];\n validWhile?: { version: 1; source: string };\n residency: FabricParticipantResidency;\n queued: number;\n messages: number;\n createdAt: number;\n updatedAt: number;\n lastRunId?: string;\n lastError?: string;\n sessionFile?: string;\n logDir?: string;\n}\ninterface FabricModelSwitchRequest {\n /** provider/id, a models.aliases name, or a search term; resolution tries aliases first, then exact matches, then the closest fuzzy match (recency from pi-model-sort breaks ties) against authenticated models. */\n model: string;\n /** Optional provider filter applied before matching (e.g. \"anthropic\"). */\n provider?: string;\n}\ninterface FabricModelSwitchResult {\n switched: boolean;\n /** Active model as provider/id after the call (unchanged when reason is \"already-active\"). */\n model: string;\n name?: string;\n /** Previously active provider/id when known. Absent for already-active results. */\n previous?: string;\n /** Set when the selector resolved through a configured models.aliases name. */\n alias?: string;\n /** How the selector resolved: the alias name, or one of closest/recent/latest for inexact picks. Absent for exact provider/id or bare-id matches. */\n via?: string;\n reason?: \"already-active\";\n}\ninterface FabricActorMessage {\n id: string;\n actorId: string;\n actorName: string;\n direction: \"in\" | \"out\";\n source: string;\n createdAt: number;\n text?: string;\n data?: unknown;\n action?: \"silent\" | \"message\" | \"stop\";\n runId?: string;\n error?: string;\n stale?: boolean;\n reason?: string;\n}\n// agentId/agent_id spellings repair to id during agent arg normalization.\ntype FabricAgentTargetArgs = { id: string; agentId?: string; agent_id?: string };\ninterface FabricAgentDefinition {\n name: string;\n description: string;\n path: string;\n scope: \"user\" | \"project\";\n /** Path of the lower-precedence file with the same name that this one replaces. */\n shadows?: string;\n /** One entry per ignored field. */\n warnings: string[];\n /** Set when the file cannot be used; name is then the file name without .md. */\n error?: string;\n}\ninterface FabricAgentsApi {\n run(args: FabricAgentRequest): Promise;\n /** Hosted capability only; resumes a paused direct child without exposing its checkpoint. */\n resume(args: FabricAgentTargetArgs & { task?: string }): Promise;\n handoff(args: FabricHandoffRequest): Promise;\n spawn(args: FabricAgentRequest): Promise;\n /** Observe local operational progress, not transcripts. Stop the returned handle with tasks.stop. */\n observe(args: {\n id: string;\n delivery: \"ui\" | \"wake\";\n events?: Array<\"progress\" | \"blocked\" | \"quiet\" | \"terminal\">;\n timeoutMs?: number;\n intervalMs?: number;\n quietAfterMs?: number;\n description?: string;\n }): Promise<{ task: { id: string; status: string; observes: { kind: \"participant\"; id: string } } }>;\n wait(args: FabricAgentTargetArgs): Promise;\n /** Alias for wait. */\n join(args: FabricAgentTargetArgs): Promise;\n status(args: FabricAgentTargetArgs): Promise;\n list(args?: { scope?: FabricParticipantScope }): Promise>;\n members(args?: { scope?: FabricParticipantScope; kinds?: FabricParticipantKind[]; includeStale?: boolean }): Promise;\n /** lineage mirrors PI_FABRIC_LINEAGE in child workers. */\n self(): Promise;\n main(): Promise;\n sessions(): Promise;\n peers(): Promise;\n /** Root sessions no longer live, newest first. Never part of live discovery. */\n departed(args?: { limit?: number }): Promise>;\n /** Named agent files that agents.run and agents.spawn accept in agent. */\n definitions(): Promise;\n subscribe(args: {\n from: string;\n events: FabricLifecycleEventType[];\n to?: string;\n delivery: FabricLifecycleDelivery;\n triggerTurn: boolean;\n once?: boolean;\n }): Promise;\n subscriptions(args?: { from?: string; to?: string }): Promise;\n unsubscribe(args: FabricAgentTargetArgs): Promise<{ removed: boolean }>;\n /** With model, only entries whose key equals it exactly (no aliases or fuzzy matching); unknown keys give []. */\n models(args?: { runner?: FabricAgentRunner; refresh?: boolean; model?: string }): Promise;\n stop(args: FabricAgentTargetArgs): Promise;\n cleanup(args: FabricAgentTargetArgs & { deleteBranch?: boolean; delete_branch?: boolean }): Promise<{ cleaned: boolean }>;\n /** Park an idle hosted run of this session; the runner must declare the sleep capability. */\n sleep(args: { id: string }): Promise<{ id: string; requested: \"sleep\" }>;\n /** Resume a hosted run that agents.sleep parked. */\n wake(args: { id: string }): Promise<{ id: string; requested: \"wake\" }>;\n create(args: FabricActorRequest): Promise;\n setModel(args: { id: string; model?: string; scope?: FabricActorBindingScope }): Promise;\n switchModel(args: FabricModelSwitchRequest): Promise;\n setThinking(args: { id: string; thinking?: FabricThinking; scope?: FabricActorBindingScope }): Promise;\n setTools(args: { id: string; tools: string[]; scope?: \"project\" | \"global\" }): Promise;\n setEvents(args: { id: string; events: FabricActorHostEvent[] }): Promise;\n setDeliveryPolicy(args: {\n id: string;\n delivery: FabricActorDelivery;\n triggerTurn: boolean;\n scope?: \"project\" | \"global\";\n }): Promise;\n setInstructions(args: {\n id: string;\n instructions: string;\n scope?: \"project\" | \"global\";\n }): Promise;\n ask(args: { id: string; message: string; data?: unknown; model?: string; thinking?: FabricThinking }): Promise;\n tell(args: { id: string; message: string; data?: unknown; model?: string; thinking?: FabricThinking }): Promise<{ queued: true; messageId: string }>;\n steer(args: { id: string; message: string; data?: unknown; triggerTurn?: boolean }): Promise<{ queued: true; messageId: string; routed?: \"local\" | \"main\" | \"mesh\"; acknowledged?: boolean }>;\n followUp(args: { id: string; message: string; data?: unknown; triggerTurn?: boolean }): Promise<{ queued: true; messageId: string; routed?: \"local\" | \"main\" | \"mesh\"; acknowledged?: boolean }>;\n setSteeringMode(args: { id: string; mode: \"all\" | \"one-at-a-time\" }): Promise<{ queued: true; messageId: string }>;\n setFollowUpMode(args: { id: string; mode: \"all\" | \"one-at-a-time\" }): Promise<{ queued: true; messageId: string }>;\n /** Advisory compaction of a running Pi-runner child at its next safe turn boundary. */\n compact(args: { id: string; instructions?: string }): Promise<{ queued: true; messageId: string }>;\n actorStatus(args: FabricAgentTargetArgs): Promise;\n /** Live actors in this Fabric session by default; scope \"global\" lists the project-independent templates. */\n actors(args?: { scope?: \"project\" }): Promise;\n actors(args: { scope: \"global\" }): Promise;\n messages(args: { id: string; limit?: number }): Promise;\n remove(args: { id: string }): Promise<{ removed: boolean }>;\n /** Drop an actor's mailbox history without stopping the actor. */\n clearMessages(args: { id: string }): Promise;\n /** Stamp a global template into the current project as a fresh live actor with no inherited history. */\n \"import\"(args: { id?: string; name?: string; as?: string }): Promise;\n /** Export a live project actor's definition to the global registry as a project-independent template. */\n \"export\"(args: { id: string; overwrite?: boolean }): Promise;\n log(args: {\n id: string;\n type?: \"session\" | \"run\" | \"all\";\n lines?: number;\n before?: number;\n runId?: string;\n }): Promise;\n}\ninterface FabricMcpResult {\n text: string;\n content: unknown[];\n structuredContent: unknown;\n}\ninterface FabricMcpTool {\n (args?: Record): Promise;\n}\ninterface FabricMcpServer {\n [tool: string]: FabricMcpTool;\n}\n// Management verbs stay members of mcp even when the declare line below is\n// replaced by generated per-server declarations (see the dynamic option on\n// guestTypeDeclarations), so generated surfaces intersect with this type\n// rather than re-declaring them.\ninterface FabricMcpManagement {\n servers(): Promise>;\n reload(): Promise<{ servers: string[] }>;\n register(args: {\n name: string;\n description?: string;\n command?: string;\n args?: string[];\n cwd?: string;\n baseUrl?: string;\n headers?: Record;\n env?: Record;\n overwrite?: boolean;\n }): Promise<{ registered: string }>;\n call(args: { server: string; tool: string; args?: Record }): Promise;\n}\n// Loose static surface: any server/tool name compiles and argument shapes are\n// enforced at dispatch by the registry. With descriptor data available the\n// execution service replaces the declare-const-mcp line below with a\n// schema-typed rendering of the live cache (runtime/dynamic-guest-types.ts).\ntype FabricMcpApi = Record & FabricMcpManagement;\ninterface FabricCouncilRunOptions extends FabricAgentRequest {\n roles: string[];\n}\ninterface FabricCouncilApi {\n run(args: FabricCouncilRunOptions & { synthesize?: true }): Promise;\n run(args: FabricCouncilRunOptions & { synthesize: false }): Promise;\n}\ninterface FabricMeshIdentity {\n id: string;\n name: string;\n kind: \"main\" | \"actor\" | \"agent\";\n sessionId?: string;\n}\ninterface FabricMeshEvent {\n id: string;\n sequence: number;\n topic: string;\n kind: string;\n from: FabricMeshIdentity;\n to?: string;\n text?: string;\n data?: unknown;\n createdAt: number;\n /** External grant post: untrusted data. */\n origin?: \"external\"; untrusted?: true; grantId?: string;\n scheduled?: { dueAt: number; key?: string };\n /** Host-stamped publisher authority: unscoped \"host\" or a scope principal. */\n sender?: { authority: \"host\" } | { authority: \"scope\"; principalId: string; digest: string };\n}\ntype FabricMeshSchedule = Omit & { key?: string; dueAt: number };\ninterface FabricMeshGrant { grantId: string; topic: string; kind?: string; createdAt: number; expiresAt: number; uses: number; maxUses: number; createdBy: FabricMeshIdentity }\ninterface FabricMeshStateEntry {\n key: string;\n value: T;\n version: number;\n updatedAt: number;\n updatedBy: FabricMeshIdentity;\n}\ninterface FabricMeshApi {\n self(): Promise;\n publish(args: { topic: string; kind?: string; to?: string; text?: string; data?: unknown; message?: string; body?: string }): Promise;\n /** Schedules instead: notBefore (epoch ms/ISO) or afterMs, \u2264366 days; key replaces. */\n publish(args: { topic: string; kind?: string; to?: string; text?: string; data?: unknown; notBefore?: number | string; afterMs?: number; key?: string }): Promise;\n scheduled(args?: { topic?: string; limit?: number }): Promise;\n unschedule(args: { key: string }): Promise<{ removed: boolean }>;\n /** External post token, shown once. ttlMs 1 min..30 days; uses 1..10000, default 1. */\n grant(args: { topic: string; ttlMs: number; uses?: number; kind?: string }): Promise;\n revoke(args: { grantId: string }): Promise<{ revoked: boolean }>;\n grants(): Promise;\n read(args?: { after?: number; topic?: string; to?: string; limit?: number; max?: number }): Promise;\n members(args?: { scope?: FabricParticipantScope; kinds?: FabricParticipantKind[]; includeStale?: boolean; limit?: number; max?: number; include_stale?: boolean }): Promise;\n get(args: { key: string }): Promise | null>;\n list(args?: { prefix?: string; limit?: number; max?: number }): Promise>>;\n put(args: { key: string; value: T; ifVersion?: number; if_version?: number; version?: number }): Promise>;\n delete(args: { key: string; ifVersion?: number; if_version?: number; version?: number }): Promise<{ deleted: boolean; version?: number }>;\n}\n// Stable-provider argument bags declare the canonical keys plus the\n// near-miss spellings repaired during argument normalization\n// (providers/arg-normalization.ts and each provider's per-action table). The\n// registry's prepare stage repairs aliases before schema validation, so a\n// call spelled with an alias typechecks instead of tripping the\n// excess-property check; the canonical key wins on conflict, and anything\n// else fails additionalProperties:false validation with the offending\n// property path named. Keep these spillover fields in sync with the provider\n// normalization tables.\ntype FabricMemoryBranches = \"active\" | \"all\";\ntype FabricMemoryQueryMode = \"literal\" | \"phrase\" | \"regex\";\ntype FabricMemoryQueryMatch = \"all\" | \"any\";\ninterface FabricMemoryEntryRange {\n first: number;\n last: number;\n}\ninterface FabricMemoryRecallArgs {\n source?: string;\n query?: string;\n queryMode?: FabricMemoryQueryMode;\n queryMatch?: FabricMemoryQueryMatch;\n expectedSourceHash?: string;\n expectedLineageFingerprint?: string;\n branches?: FabricMemoryBranches;\n scope?: string;\n offset?: number;\n pageSize?: number;\n snippetChars?: number;\n role?: string;\n tool?: string;\n ref?: string;\n provider?: string;\n action?: string;\n outcome?: \"succeeded\" | \"failed\" | \"aborted\" | \"timed_out\";\n since?: number;\n until?: number;\n entryRange?: FabricMemoryEntryRange;\n q?: string;\n limit?: number;\n max?: number;\n page_size?: number;\n snippet_chars?: number;\n query_mode?: FabricMemoryQueryMode;\n query_match?: FabricMemoryQueryMatch;\n entry_range?: FabricMemoryEntryRange;\n}\ninterface FabricMemoryExpandArgs {\n source?: string;\n session: string;\n expectedSourceHash?: string;\n expectedLineageFingerprint?: string;\n branches?: FabricMemoryBranches;\n indices?: number[];\n entryIds?: string[];\n operationAddresses?: string[];\n entryRange?: FabricMemoryEntryRange;\n before?: number;\n after?: number;\n entryOffset?: number;\n textOffset?: number;\n maxChars?: number;\n maxEntries?: number;\n id?: string;\n file?: string;\n path?: string;\n session_id?: string;\n index?: number;\n entry_ids?: string[];\n operation_addresses?: string[];\n entry_range?: FabricMemoryEntryRange;\n entry_offset?: number;\n text_offset?: number;\n max_chars?: number;\n max_entries?: number;\n}\ninterface FabricMemoryCall {\n ref: Ref;\n args: Args;\n}\ninterface FabricMemoryRecallEntryHit {\n kind: \"entry\";\n sessionId: string;\n tier: \"hot\" | \"cold\";\n index: number;\n entryId: string | null;\n parentId: string | null;\n operationAddress: string | null;\n type: string;\n role: string | null;\n tool: string | null;\n ref: string | null;\n provider: string | null;\n action: string | null;\n timestamp: number | null;\n isError: boolean;\n outcome?: \"succeeded\" | \"failed\" | \"aborted\" | \"timed_out\";\n score: number;\n snippet: string;\n truncated: boolean;\n follow: FabricMemoryCall<\"memory.expand\", FabricMemoryExpandArgs>;\n}\ninterface FabricMemoryRecallSessionHit {\n kind: \"session\";\n sessionId: string;\n tier: \"cold\";\n cwd: string;\n lastTimestamp: number | null;\n score: number;\n matchedTerms: number;\n matchedStructuralEntries: number;\n follow: FabricMemoryCall<\"memory.recall\", FabricMemoryRecallArgs>;\n}\ntype FabricMemoryRecallHit = FabricMemoryRecallEntryHit | FabricMemoryRecallSessionHit;\ninterface FabricMemoryError {\n code: string;\n message: string;\n [key: string]: unknown;\n}\ninterface FabricMemoryCoverage {\n complete: boolean;\n indexedSessions: number;\n eligibleSessions: number;\n staleSessions: number;\n incompleteSessions: number;\n reasons: string[];\n error?: FabricMemoryError;\n}\ninterface FabricMemoryRecallResult {\n total: number;\n hits: FabricMemoryRecallHit[];\n next: FabricMemoryCall<\"memory.recall\", FabricMemoryRecallArgs> | null;\n coverage: FabricMemoryCoverage;\n error?: FabricMemoryError;\n}\ninterface FabricMemoryExpandedEntry {\n index: number;\n entryId: string | null;\n parentId: string | null;\n type: string | null;\n role: string | null;\n timestamp: number | null;\n isError: boolean;\n anchor?: boolean;\n text: string;\n textRange: { start: number; end: number; total: number; complete: boolean };\n parentEntryId?: string | null;\n operationAddress?: string | null;\n tool?: string | null;\n ref?: string | null;\n provider?: string | null;\n action?: string | null;\n outcome?: \"succeeded\" | \"failed\" | \"aborted\" | \"timed_out\";\n filesTouched?: Array;\n operation?: unknown;\n branchFact?: unknown;\n structuredTruncated?: boolean;\n factAddress?: string | null;\n carrierEntryId?: string | null;\n carrierParentId?: string | null;\n carrierFromId?: string | null;\n}\ninterface FabricMemoryExpandResult {\n session?: string;\n sourceHash?: string;\n branches?: FabricMemoryBranches;\n lineageFingerprint?: string;\n entryCount?: number;\n entries: FabricMemoryExpandedEntry[];\n next?: FabricMemoryCall<\"memory.expand\", FabricMemoryExpandArgs> | null;\n error?: FabricMemoryError;\n}\ninterface FabricMemoryWalkResult {\n visited: number;\n stopped: boolean;\n error?: FabricMemoryError;\n}\ninterface FabricMemorySessionInfo {\n id: string;\n file: string;\n cwd: string;\n mtime: number;\n entryCount: number;\n tier: \"hot\" | \"cold\";\n branches: FabricMemoryBranches;\n lineageFingerprint: string | null;\n}\ninterface FabricMemoryApi {\n recall(args?: FabricMemoryRecallArgs): Promise;\n expand(args: FabricMemoryExpandArgs): Promise;\n walk(\n args: FabricMemoryExpandArgs,\n visitor: (\n entry: FabricMemoryExpandedEntry,\n index: number,\n ) => boolean | void | Promise,\n ): Promise;\n sessions(args?: {\n source?: string;\n scope?: string;\n branches?: FabricMemoryBranches;\n limit?: number;\n max?: number;\n }): Promise<{\n scope?: string;\n branches?: FabricMemoryBranches;\n sessions?: FabricMemorySessionInfo[];\n error?: FabricMemoryError;\n }>;\n}\ninterface FabricStateTransitionArgs {\n label: string;\n from?: string;\n to: string;\n summary: string;\n evidence?: string[];\n tags?: string[];\n kind?: \"state\" | \"representation\";\n complexity?: { files: string[] };\n force?: boolean;\n name?: string;\n description?: string;\n}\ninterface FabricStateComplexityFile {\n file: string;\n supported: boolean;\n language?: string;\n current?: number;\n recorded?: number;\n delta?: number;\n recordedDelta?: number;\n}\ninterface FabricStateVerificationResult {\n certified: boolean;\n violated: boolean;\n certificationStatus: \"certified\" | \"failed\";\n results: unknown[];\n failures: unknown[];\n certificate?: unknown;\n reportingError?: string;\n evidenceDigest: string;\n resultDigest: string;\n binding?: Record;\n observed?: { commit?: string; dirty?: boolean };\n requestedBy?: \"program\" | \"host\";\n}\ninterface FabricStateApi {\n transition(args: FabricStateTransitionArgs): Promise<{ event: FabricMeshEvent; head: unknown }>;\n get(): Promise<{\n head: unknown | null;\n goal: { check: string; description?: string } | null;\n complexity: { files: number; decisionPoints: number; lastNetDelta: number };\n certification: { current: unknown | null; recent: unknown[] };\n recentLabels: string[];\n }>;\n history(args?: { label?: string; limit?: number; includeArchived?: boolean; name?: string; max?: number }): Promise<{\n transitions: unknown[];\n labels: string[];\n certifications: unknown[];\n }>;\n complexity(args?: { files?: string[]; paths?: string[] }): Promise<{ files: FabricStateComplexityFile[]; netDelta: number }>;\n verify(args?: { labels?: string[]; includeArchived?: boolean; timeoutMs?: number; label?: string; binding?: Record }): Promise;\n goal(args: { check: string; description?: string; command?: string; cmd?: string; predicate?: string }): Promise>;\n checkGoal(args?: { timeoutMs?: number }): Promise<{\n passed: boolean;\n output: string;\n exitCode: number | null;\n error?: string;\n }>;\n}\ntype FabricSchemaEvidence =\n | { kind: \"file_exists\"; path: string }\n | { kind: \"file_absent\"; path: string }\n | { kind: \"file_contains\"; path: string; literal: string }\n | { kind: \"file_sha256\"; path: string; sha256: string }\n | { kind: \"trusted_command\"; name: string };\ntype FabricSchemaFileOperation =\n | { kind: \"write\"; path: string; content: string; expected: { absent: true } | { sha256: string } }\n | { kind: \"edit\"; path: string; oldText: string; newText: string; expectedSha256: string }\n | { kind: \"delete\"; path: string; expectedSha256: string };\ninterface FabricSchemaEvidenceResult {\n evidence: FabricSchemaEvidence;\n status: \"confirmed\" | \"nonconfirmed\" | \"error\";\n detail: string;\n exitCode?: number | null;\n output?: string;\n observedSha256?: string;\n}\ninterface FabricSchemaStatus {\n mode: \"off\" | \"audit\" | \"enforce\";\n certificateTtlMs: number;\n maxFiles: number;\n maxBytes: number;\n trustedCommands: string[];\n generation: number;\n lastOutcome: \"committed\" | \"rolled_back\" | \"quarantined\" | null;\n hypotheses: Array<{\n id: string;\n label: string;\n status: string;\n generation: number;\n updatedAt: number;\n }>;\n}\ninterface FabricSchemaVerificationResult {\n verified: boolean;\n hypothesisId: string;\n certificate?: string;\n issuedAt?: number;\n expiresAt?: number;\n reason?: string;\n results: FabricSchemaEvidenceResult[];\n}\ninterface FabricSchemaCommitResult {\n outcome: \"committed\" | \"rolled_back\" | \"quarantined\";\n transactionId: string;\n generation?: number;\n paths?: string[];\n postconditions?: FabricSchemaEvidenceResult[];\n complexityReductionCertified?: boolean;\n stateTransition?: unknown;\n error?: string;\n rollbackError?: string;\n}\ninterface FabricSchemaApi {\n status(): Promise;\n hypothesize(args: {\n label: string;\n summary: string;\n evidence: FabricSchemaEvidence[];\n complexityReduction?: boolean;\n name?: string;\n description?: string;\n complexity_reduction?: boolean;\n }): Promise<{\n hypothesisId: string;\n status: string;\n state: unknown;\n fingerprint: string;\n generation: number;\n }>;\n verify(args: { hypothesisId: string; id?: string; hypothesis_id?: string }): Promise;\n commit(args: {\n hypothesisId: string;\n certificate: string;\n operations: FabricSchemaFileOperation[];\n postconditions: FabricSchemaEvidence[];\n id?: string;\n hypothesis_id?: string;\n }): Promise;\n abort(args: { hypothesisId: string; certificate?: string; id?: string; hypothesis_id?: string }): Promise<{\n aborted: true;\n hypothesisId: string;\n }>;\n}\ninterface FabricCompactPendingIntent {\n reason?: string;\n instructions?: string;\n preserve?: string[];\n /** Queued after the compaction commits as a labelled Fabric message. */\n seed?: string;\n requestedBy: string;\n requestedAt: number;\n}\ntype FabricCompactionOwner = \"fabric\" | \"pi\" | \"external\" | \"none\";\n/** The extension holding the compaction owner claim; compact.* routes to it. */\ninterface FabricCompactionClaimRef {\n name: string;\n version: string;\n}\ninterface FabricCompactLastCommit {\n at: number;\n requestedBy: string;\n status: \"committed\" | \"cancelled\" | \"failed\";\n summary?: string;\n tokensBefore?: number;\n estimatedTokensAfter?: number;\n error?: string;\n seeded?: true;\n}\ntype FabricComponentState = \"waiting\" | \"loading\" | \"active\" | \"unloading\" | \"failed\" | \"quarantined\" | \"disposed\";\ninterface FabricComponentEffectInfo {\n label: string;\n kind: \"none\" | \"scoped\" | \"transactional\" | \"emission\";\n resources: string[];\n ordering: \"commutative\" | \"ordered\" | \"unknown\";\n}\ninterface FabricComponentEffectConflict {\n withComponent: string;\n resources: string[];\n reason: \"shared_resource\" | \"unknown_resource\";\n}\ninterface FabricComponentInfo {\n id: string;\n component: string;\n parentId?: string;\n state: FabricComponentState;\n guarantee: \"managed\" | \"revertible\";\n requirements: string[];\n provisions: string[];\n missing: string[];\n optionalMissing: string[];\n effects?: FabricComponentEffectInfo[];\n effectConflicts?: FabricComponentEffectConflict[];\n targetDigest?: string;\n error?: string;\n cleanupErrors?: string[];\n revision: number;\n createdAt: number;\n updatedAt: number;\n}\ninterface FabricComponentEntry {\n id: string;\n component: string;\n config?: unknown;\n disabled?: boolean;\n}\ninterface FabricComponentDefinitionInfo {\n name: string;\n description?: string;\n revision: number;\n configSchema?: Record;\n requirements: string[];\n provisions: string[];\n}\ninterface FabricComponentConfigSource {\n scope: \"global\" | \"project\";\n path: string;\n trusted: boolean;\n present: boolean;\n selected: boolean;\n}\ninterface FabricComponentConfigurationInfo {\n sources: FabricComponentConfigSource[];\n warnings: string[];\n sessionOverrides: string[];\n removalPolicy: \"drain\";\n error?: string;\n}\ninterface FabricComponentChangeRequest {\n scope?: \"session\" | \"global\" | \"project\";\n entries?: FabricComponentEntry[];\n remove?: string[];\n reset?: string[];\n}\ninterface FabricComponentChangePlan {\n revision: string;\n request: Required;\n changes: Array<{ id: string; operation: \"add\" | \"replace\" | \"remove\"; component: string; requirements: string[]; provisions: string[] }>;\n warnings: string[];\n sources: FabricComponentConfigSource[];\n}\ninterface FabricComponentsApi {\n list(): Promise<{\n definitions: FabricComponentDefinitionInfo[];\n components: FabricComponentInfo[];\n configuration: FabricComponentConfigurationInfo;\n }>;\n describe(args: { component: string }): Promise;\n plan(args: FabricComponentChangeRequest): Promise;\n apply(args: FabricComponentChangeRequest & { expectedRevision: string }): Promise<{ components: FabricComponentInfo[]; configuration: FabricComponentConfigurationInfo; scope: \"session\" | \"global\" | \"project\" }>;\n reconcile(): Promise<{ components: FabricComponentInfo[]; configuration: FabricComponentConfigurationInfo }>;\n status(args: { id: string }): Promise;\n graph(): Promise<{\n components: FabricComponentInfo[];\n edges: Array<{ from: string; to: string; ref: string; kind?: \"dependency\" | \"ownership\" }>;\n cycles: string[][];\n }>;\n reload(args?: { id?: string }): Promise<{ components: FabricComponentInfo[] }>;\n}\n\ninterface FabricCacheHoldOptions {\n target?: \"self\" | \"main\";\n durationMs: number;\n /** Currently unsupported: requesting this bound rejects acquisition. */\n maxRefreshes?: number;\n /** Currently unsupported: requesting this bound rejects acquisition. */\n maxCostUsd?: number;\n}\ninterface FabricCacheLease {\n id: string; scope: \"session\" | \"component\"; sessionId: string; model: string; expiresAt: number;\n}\ntype FabricCacheHoldResult = ({ status: \"held\" } & FabricCacheLease)\n | { status: \"unsupported\" | \"unavailable\"; reason: string };\ninterface FabricCacheSample {\n entryId: string; observedAt: number; input: number; cacheRead: number; cacheWrite: number;\n output: number; totalInput: number; cacheReadShare: number; reportedCostUsd: number | null;\n}\ninterface FabricCacheObservation {\n lastRequest: FabricCacheSample | null; lastRefresh: FabricCacheSample | null;\n maintenance: { requests: number; tokens: number; reportedCostUsd: number; unknownCostRequests: number; unknownTokenRequests: number };\n window: { entries: number; limit: number; truncated: boolean; stoppedAt: string | null };\n}\ninterface FabricCacheStatus {\n target: \"self\"; sessionId: string; model: string | null; supported: boolean; reason: string | null;\n limits: { durationMs: true; maxRefreshes: false; maxCostUsd: false };\n leases: FabricCacheLease[]; scheduled: null; cleanupError: string | null; observation: FabricCacheObservation;\n}\ninterface FabricCacheApi {\n status(args?: { target?: \"self\" | \"main\" }): Promise;\n hold(args: FabricCacheHoldOptions): Promise;\n release(args: { id: string }): Promise<{ released: boolean; cleanupError: string | null }>;\n}\n\ninterface FabricThinkingBounds { min?: FabricThinking; max?: FabricThinking }\ninterface FabricThinkingOverride {\n level: FabricThinking;\n scope: \"turn\" | \"turns\" | \"session\";\n remainingTurns?: number;\n reason?: string;\n setAt: number;\n}\ninterface FabricThinkingStatus {\n level: FabricThinking;\n available: FabricThinking[];\n bounds: { min: FabricThinking; max: FabricThinking };\n baseline: FabricThinking;\n override?: FabricThinkingOverride;\n}\ninterface FabricThinkingApi {\n status(): Promise;\n set(args: { level: FabricThinking; scope?: \"turn\" | \"turns\" | \"session\"; turns?: number; reason?: string }): Promise;\n reset(): Promise;\n}\n\ninterface FabricDecision {\n id: string; kind: \"approval\" | \"question\" | \"escalation\"; title: string; body?: string;\n options?: Array<{ id: string; label: string }>; input: \"text\" | \"confirm\" | \"select\" | \"editor\";\n raisedBy: { participantId: string; runId?: string; sessionId?: string };\n holder: string; createdAt: number; deadline?: number; onExpire: \"cancel\" | \"default\" | \"escalate\"; defaultOptionId?: string;\n escalation?: { chain: string[]; hop: number; hopTimeoutMs: number; onFinal: \"cancel\" | \"default\" };\n history?: Array<{ holder: string; until: number; reason: \"expired\" | \"escalated\"; text?: string; by?: string }>;\n status: \"open\" | \"answered\" | \"expired\" | \"cancelled\";\n answer?: { optionId?: string; text?: string; answeredBy: string; via: string; at: number };\n}\ninterface FabricDecisionsApi {\n raise(args: { title: string; kind?: FabricDecision[\"kind\"]; body?: string; options?: Array<{ id: string; label: string }>; input?: FabricDecision[\"input\"]; holder?: string; deadline?: number; timeoutMs?: number; onExpire?: \"cancel\" | \"default\" | \"escalate\"; defaultOptionId?: string; escalation?: { chain?: string[]; hopTimeoutMs?: number; onFinal?: \"cancel\" | \"default\" } }): Promise<{ id: string }>;\n wait(args: { id: string; timeoutMs?: number }): Promise;\n list(args?: { status?: FabricDecision[\"status\"]; holder?: string; limit?: number }): Promise;\n answer(args: { id: string; optionId?: string; text?: string }): Promise;\n escalate(args: { id: string; reason?: string }): Promise;\n cancel(args: { id: string }): Promise;\n}\n\ntype FabricProgramStatus = \"candidate\" | \"promoted\" | \"retired\";\ninterface FabricProgramSummary {\n /** name@digest12 */\n ref: string; name: string; digest: string; kind: \"fabric\" | \"jev\"; kernel?: \"typescript\" | \"python\";\n description?: string; createdAt: number; status: FabricProgramStatus;\n}\ninterface FabricProgramRecord extends FabricProgramSummary {\n version: 1; code?: string; jevProgram?: Record; inputSchema?: Record; trial?: unknown;\n}\ninterface FabricProgramsApi {\n /** Always saved as a candidate; identical content returns the same ref. */\n save(args: { name: string; kind?: \"fabric\" | \"jev\"; kernel?: \"typescript\" | \"python\"; code?: string; jevProgram?: Record; description?: string; inputSchema?: Record }): Promise<{ ref: string; digest: string }>;\n list(args?: { name?: string; status?: FabricProgramStatus }): Promise;\n /** ref: name (latest promoted, else latest candidate), name@= 12>, or a full digest. */\n get(args: { ref: string }): Promise;\n /** Runs nested with this program's capabilities; args.input becomes the saved program's input global. */\n run(args: { ref: string; input?: unknown; requirePromoted?: boolean }): Promise;\n}\n\ninterface FabricCompactApi {\n request(args?: {\n reason?: string;\n instructions?: string;\n preserve?: string[];\n requestedBy?: string;\n /** Queued after the compaction commits as a labelled Fabric message that starts a turn; a prompt submitted during the compaction runs first. */\n seed?: string;\n instruction?: string;\n requested_by?: string;\n }): Promise<{\n requested: true;\n intent: FabricCompactPendingIntent;\n /** Present under a compaction owner claim: the request went to this owner. */\n claim?: FabricCompactionClaimRef;\n result?: unknown;\n }>;\n status(): Promise<{\n pending?: FabricCompactPendingIntent;\n last?: FabricCompactLastCommit;\n lastAuto?: { at: number; trigger: \"headroom\" | \"tokens\" | \"ratio\"; committed: boolean };\n owner: FabricCompactionOwner;\n outputReserveTokens: number;\n claim?: FabricCompactionClaimRef & { branchSummary: boolean; actions: string[] };\n ownerStatus?: unknown;\n }>;\n /** Read-only context pressure; never compacts. */\n pressure(): Promise<{\n tokens: number | null;\n contextWindow: number | null;\n fraction: number | null;\n headroomTokens: number | null;\n band: \"ok\" | \"warn\" | \"urgent\" | \"unknown\";\n outputReserveTokens: number;\n thresholdFraction?: number;\n thresholdTokens?: number;\n owner: FabricCompactionOwner;\n claim?: FabricCompactionClaimRef;\n /** The claimed owner's own stage and thresholds. */\n ownerPressure?: { stage: string; thresholds?: Record };\n }>;\n /** Persistent carry-forward focus rendered in every Fabric summary until cleared; no args reads. Under a claim the owner keeps it. */\n carry(args?: { items?: string[]; add?: string[]; remove?: string[]; clear?: boolean }): Promise<{ items: string[]; claim?: FabricCompactionClaimRef }>;\n /** Under a claim, says which was cancelled: Fabric's own pending request, the owner's, or both. */\n cancel(): Promise<{\n cancelled: true;\n claim?: FabricCompactionClaimRef;\n fabricIntentCleared?: boolean;\n ownerCancelled?: boolean;\n result?: unknown;\n }>;\n}\n\ninterface FabricPrewalkFileIdentityStatus {\n path: string;\n loadedSha256: string;\n diskSha256: string;\n stale: boolean;\n}\ninterface FabricPrewalkApi {\n /** Only when Fabric's armed advisory or checkpoint requests an executor handoff plan.\n * Not a task planner, checklist, or acceptance-ledger store; unavailable otherwise. */\n plan(args: {\n outcome: string;\n steps: string[];\n verification: string[];\n risks: string;\n }): Promise<{ recorded: true; readiness: \"ready\"; plan: string }>;\n status(): Promise<{\n state: \"idle\" | \"armed\" | \"handing_off\" | \"continuation_pending\";\n planRequired: boolean;\n planReady: boolean;\n planPrompts: number;\n claimedReadiness: \"planned\" | \"disabled\" | \"unplanned\" | null;\n runtime?: {\n entry: FabricPrewalkFileIdentityStatus | null;\n lazyRuntime: FabricPrewalkFileIdentityStatus | null;\n };\n }>;\n}\n\ninterface FabricWorkflowAgentOptions extends Omit {\n label?: string;\n}\ntype FabricActivityStatus = \"pending\" | \"running\" | \"completed\" | \"failed\" | \"blocked\" | \"stopped\";\ntype FabricActivityKind = \"agent\" | \"actor\" | \"tool\" | \"extension\" | \"mcp\" | \"mesh\" | \"task\" | \"custom\";\ninterface FabricWorkflowDisplay {\n name?: string;\n description?: string;\n}\ninterface FabricWorkflowPhaseOptions {\n id?: string;\n description?: string;\n total?: number;\n}\ninterface FabricWorkflowPhaseInput extends FabricWorkflowPhaseOptions {\n name: string;\n}\ninterface FabricWorkflowItem {\n /** Stable id, 1-128 chars of [A-Za-z0-9._:/-]; omitted ids become item- per invocation. */\n id?: string;\n label: string;\n status?: FabricActivityStatus;\n phase?: string;\n detail?: string;\n kind?: FabricActivityKind;\n current?: string;\n total?: number;\n completed?: number;\n data?: unknown;\n /** Plain JSON object (<= 2 KiB) carried only on the host pi-fabric:workflow-item:v1 event. */\n meta?: Record;\n}\ninterface FabricWorkflowApi {\n agent(prompt: string, options?: FabricWorkflowAgentOptions): Promise;\n parallel(items: T[], mapper: (item: T, index: number) => Promise | R, concurrency?: number | { concurrency?: number }): Promise;\n parallel(thunks: Array<() => Promise | T>, concurrency?: number | { concurrency?: number }): Promise;\n pipeline(items: T[], ...stages: Array<(value: unknown, original: T, index: number) => Promise | unknown>): Promise;\n configure(display: FabricWorkflowDisplay): Promise;\n phase(name: string, options?: FabricWorkflowPhaseOptions): Promise<{ name: string; index: number; id?: string }>;\n phase(input: FabricWorkflowPhaseInput): Promise<{ name: string; index: number; id?: string }>;\n item(item: FabricWorkflowItem): Promise;\n event(event: { message: string; level?: \"info\" | \"success\" | \"warning\" | \"error\"; data?: unknown }): Promise;\n log(...values: unknown[]): void;\n budget: { total: number; spent(): number; remaining(): number };\n}\ndeclare const tools: FabricToolsApi;\ndeclare const nativeTools: Record) => Promise>;\ndeclare const fabric: { readonly tools: FabricToolsApi };\ndeclare const pi: PiToolsApi;\ndeclare const extensions: FabricExtensionsApi;\ndeclare const agents: FabricAgentsApi;\ndeclare const mesh: FabricMeshApi;\ndeclare const mcp: FabricMcpApi;\ndeclare const memory: FabricMemoryApi;\ndeclare const state: FabricStateApi;\ndeclare const schema: FabricSchemaApi;\ndeclare const components: FabricComponentsApi;\ndeclare const compact: FabricCompactApi;\ndeclare const cache: FabricCacheApi;\ndeclare const thinking: FabricThinkingApi;\ndeclare const decisions: FabricDecisionsApi;\ndeclare const programs: FabricProgramsApi;\ndeclare const prewalk: FabricPrewalkApi;\n\ntype FabricJevJson = null | boolean | number | string | FabricJevJson[] | { [key: string]: FabricJevJson };\ntype FabricJevDescription = string | FabricJevJson[] | { [key: string]: FabricJevJson };\ntype FabricJevQuestion =\n | { type: \"noul\"; instructions: FabricJevDescription; criteria?: { true?: FabricJevDescription; false?: FabricJevDescription } }\n | { type: \"choice\"; instructions: FabricJevDescription; criteria: Record }\n | { type: \"score\"; instructions: FabricJevDescription; criteria: FabricJevDescription[] };\ntype FabricJevAnswer = Q extends { type: \"noul\" }\n ? { type: \"noul\"; noul: number }\n : Q extends { type: \"choice\"; criteria: infer C }\n ? { type: \"choice\"; choice: Extract; confidence: number; probabilities: Record, number> }\n : { type: \"score\"; score: number; confidence: number; probabilities: Record; legend: Record };\ninterface FabricJevProgram {\n name: string;\n code: string;\n inputSchema: Record;\n outputSchema: Record;\n requires: string[];\n limits?: { timeoutMs?: number; maxEvaluations?: number; maxToolCalls?: number; maxTokens?: number };\n}\ntype FabricJevHostEventName = \"input\" | \"turn_end\" | \"tool_error\" | \"agent_end\" | \"agent_settled\";\ninterface FabricJevObserve {\n events: FabricJevHostEventName[];\n include?: Array<\"inputText\" | \"assistantText\" | \"toolResults\">;\n maxChars?: number; queueSize?: number; maxEventAgeMs?: number;\n delivery?: \"steer\" | \"followUp\"; triggerTurn?: boolean; maxAdvice?: number;\n}\ninterface FabricJevHostEvent {\n id: string; sequence: number; event: FabricJevHostEventName; source: \"main\";\n sessionId: string; revision: number; at: number; payload: FabricJevJson; truncated: boolean;\n}\ninterface FabricJevObservationStats {\n events: FabricJevHostEventName[]; received: number; consumed: number; dropped: number; queued: number;\n adviceDelivered: number; adviceSuppressed: number;\n}\ninterface FabricJevAdviceResult {\n delivered: boolean;\n reason?: \"disabled\" | \"stale\" | \"duplicate\" | \"budget\" | \"feedback\" | \"delivery_failed\";\n}\ninterface FabricJevRun {\n id: string; name: string; state: \"running\" | \"completed\" | \"failed\" | \"cancelled\" | \"timed_out\";\n background: boolean; startedAt: number; endedAt?: number; result?: T; error?: string;\n evaluations: number; toolCalls: number; usage: { input_tokens: number | null; output_tokens: number | null };\n events: Array<{ sequence: number; at: number; value: FabricJevJson }>; nextSequence: number; logs: string[];\n observation?: FabricJevObservationStats;\n}\ntype DecisionJSON = FabricJevJson;\ntype DecisionDescription = FabricJevDescription;\ntype DecisionAPI = \"system-one\" | \"cloudflare\" | \"openai-decisions\" | \"vercel-evaluate\" | \"llama-cpp\" | \"llama-system-one\" | \"anthropic\" | \"google\";\ntype DecisionQuestion = Exclude | { type: \"boolean\" | \"bool\" | \"noul\" | \"predicate\"; instructions: DecisionDescription; criteria?: { true?: DecisionDescription; false?: DecisionDescription } }\n | { type: \"box\"; instructions: DecisionDescription };\ninterface DecisionTarget {\n provider: string; api?: DecisionAPI; model?: string; endpoint?: string;\n allowLocal?: boolean; allowGenerated?: boolean; providerOptions?: Record; temperature?: number;\n}\ninterface DecisionProfiles { version: 1; defaultProfile?: string; profiles: Record }\ninterface DecisionRequest extends Partial {\n profile?: string; state: DecisionDescription; questions: Record;\n images?: { type?: \"image\"; data: string; mimeType: \"image/png\" | \"image/jpeg\" | \"image/webp\" | \"image/gif\"; ref?: string }[];\n}\ntype DecisionImageSupport = \"supported\" | \"unsupported\" | \"model-dependent\";\ninterface DecisionResolution {\n target: DecisionTarget & { api: DecisionAPI; model: string; endpoint: string; allowLocal: boolean; allowGenerated: boolean };\n credential: { env: string; resolved: false }; imageSupport: DecisionImageSupport; generated: boolean; profile?: string;\n}\ninterface DecisionProvider { provider: string; api: DecisionAPI | \"\"; defaultModel: string; endpoint: string; credentialEnv: string; imageSupport: DecisionImageSupport; generated: boolean }\ntype DecisionAnswer = { type: \"boolean\"; probability: number }\n | { type: \"choice\"; choice: string; probabilities?: Record; confidence?: number }\n | { type: \"score\"; score: number; probabilities?: Record; confidence?: number; legend?: Record }\n | { type: \"box\"; box: { top: number; bottom: number; left: number; right: number }; confidence?: number }\n | { type: \"refusal\"; [field: string]: unknown };\ninterface DecisionResult {\n status: \"ok\" | \"error\"; provider: string; api: DecisionAPI; model: string; answers: Record;\n usage: { input_tokens: number | null; output_tokens: number | null };\n provenance?: { kind: \"native\" | \"generated\" | \"token-logprobs\"; [field: string]: unknown };\n raw?: DecisionJSON; rawJson?: string; rawText?: string; rawComplete?: boolean; httpStatus?: number;\n error?: { code: number; message: string } | null; budget: { exhausted: boolean; reason: string };\n}\ninterface DecisionModel {\n model: { provider: string; id: string }; name: string; api: string; target?: DecisionTarget;\n supported: boolean; imageSupport: DecisionImageSupport; generated: boolean; logits: boolean;\n credentials: { configured: boolean; verified: false };\n}\ninterface FabricJevApi {\n decide(request: DecisionRequest): Promise;\n resolveDecision(args: { request: DecisionRequest }): Promise;\n decisionProviders(): Promise;\n models(): Promise;\n evaluate>(args: {\n state: string | FabricJevJson[] | { [key: string]: FabricJevJson }; questions: Q; model?: string;\n }): Promise<{ model: string; answers: { [K in keyof Q]: FabricJevAnswer }; usage: { input_tokens: number; output_tokens: number } }>;\n run(args: { program: FabricJevProgram; input: FabricJevJson }): Promise>;\n spawn(args: { program: FabricJevProgram; input: FabricJevJson; observe?: FabricJevObserve }): Promise;\n status(args?: { id?: never; after?: never }): Promise<{ credentials: { configured: boolean; source: \"pi\" | \"environment\" | \"command\" | \"missing\"; verified: boolean }; model: string; runs: Array<{ id: string; name: string; state: string; background: boolean; startedAt: number; evaluations: number; toolCalls: number; observation?: FabricJevObservationStats }> }>;\n status(args: { id: string; after?: number }): Promise>;\n wait(args: { id: string }): Promise>;\n /** Alias for wait. */\n join(args: { id: string }): Promise>;\n advise(args: { id: string; eventId: string; message: string }): Promise;\n stop(args: { id: string }): Promise;\n}\ndeclare const jev: FabricJevApi;\n\ndeclare const council: FabricCouncilApi;\ndeclare const workflow: FabricWorkflowApi;\ndeclare function agent(prompt: string, options?: FabricWorkflowAgentOptions): Promise;\ndeclare function parallel(items: T[], mapper: (item: T, index: number) => Promise | R, concurrency?: number | { concurrency?: number }): Promise;\ndeclare function parallel(thunks: Array<() => Promise | T>, concurrency?: number | { concurrency?: number }): Promise;\ndeclare function pipeline(items: T[], ...stages: Array<(value: unknown, original: T, index: number) => Promise | unknown>): Promise;\ndeclare function phase(name: string, options?: FabricWorkflowPhaseOptions): Promise<{ name: string; index: number; id?: string }>;\ndeclare function phase(input: FabricWorkflowPhaseInput): Promise<{ name: string; index: number; id?: string }>;\ndeclare function log(...values: unknown[]): void;\ndeclare const budget: FabricWorkflowApi[\"budget\"];\ntype FabricRlmRequest = Omit & { runner?: \"pi\" | \"pi-durable\" };\ndeclare const rlm: { query(args: FabricRlmRequest): Promise };\ninterface FabricConsole {\n log(...args: unknown[]): void;\n info(...args: unknown[]): void;\n warn(...args: unknown[]): void;\n error(...args: unknown[]): void;\n}\ndeclare const console: FabricConsole;\ndeclare const \u03C0: Readonly>;\n// Process runtimes only: node/bun children bridge native-module imports;\n// quickjs has no module loader and rejects __fabricImport at runtime.\ndeclare function __fabricImport(specifier: string): Promise;\ndeclare function print(...args: unknown[]): void;\ndeclare function setTimeout(handler: (...args: any[]) => void, timeout?: number): number;\ndeclare function clearTimeout(handle: number): void;\ndeclare function setInterval(handler: (...args: any[]) => void, timeout?: number): number;\ndeclare function clearInterval(handle: number): void;\n// Process runtimes only: the bun-process child binds the host's real Bun\n// module namespace as __bun; undefined under node-process and quickjs.\ndeclare const __bun: any;\n"; export interface FabricGuestDeclarationOptions { /** Global names to omit (for example providers disabled by configuration). */ excludeGlobals?: readonly string[]; /** * Pre-rendered replacement blocks from buildDynamicGuestDeclarations(). * Applied only when the loose anchor line is still present — excluded * globals (or orchestration-only mode, for extensions) keep nothing to * replace, and missing/undefined sections keep the loose surface. The * `providers` block is appended: it declares new globals only. */ dynamic?: FabricDynamicGuestDeclarations; /** * Additive overloads for the current captured exact-name core overrides. * The block is applied only to the full-code `pi` declaration. */ coreOverrides?: string; } export declare const guestTypeDeclarations: (fullCodeMode: boolean, options?: FabricGuestDeclarationOptions) => string; //# sourceMappingURL=guest-types.d.ts.map