import type { ProviderOperation } from "./provider-operations.js"; /** Effective page size for registry list(): caller default 100, hard cap 1000. * Exported so guest discovery surfaces slice identically to the registry. */ export declare const fabricActionListLimit: (limit?: number) => number; import type { FabricCapabilityRequirement, FabricComponentProviderLease } from "../components/types.js"; import { type FabricExecutionTraceOperationHandle, type FabricExecutionTraceRecorder } from "../audit/trace.js"; import { type FabricActionDescriptor, type FabricCapabilityCatalog, type FabricCapabilityResolution, type FabricGuestTypeSources, type FabricInvocationActivityUpdate, type FabricInvocationContext, type FabricMediaBlock, type FabricProvider, type FabricProviderListRequest, type FabricScopedProviderResult } from "../protocol.js"; import type { FabricSpeculationReplay, FabricSpeculationRuntime } from "../speculation/types.js"; import type { FabricNestedToolResultProxy } from "./tool-result-proxy.js"; import type { FabricHostPolicy } from "./host-policy.js"; import { type FabricProviderBindingEvent } from "./provider-bindings.js"; export interface ResolvedFabricAction extends FabricActionDescriptor { ref: string; provider: string; } interface FabricEffectConflict { withRef: string; resources: string[]; reason: "shared_resource" | "unknown_resource"; } export interface FabricCallAudit { ref: string; nestedToolCallId: string; startedAt: number; endedAt?: number; success?: boolean; error?: string; resultChars?: number; resultTruncated?: boolean; tool?: string; provider?: string; args?: Record; result?: unknown; media?: FabricMediaBlock[]; mediaNote?: string; preview?: unknown; effectConflicts?: FabricEffectConflict[]; /** Result was pre-launched while the program streamed and served from the speculation store. */ speculated?: boolean; /** Spelled action name that repaired to the canonical one at resolve (e.g. search → recall). */ repairedFrom?: string; /** The provider reported a nested result with Pi's `terminate: true`. In memory only. */ terminate?: true; } export type FabricRegistryActivityEvent = { type: "call_start"; callId: string; ref: string; args: Record; } | { type: "call_update"; callId: string; update: FabricInvocationActivityUpdate; } | { type: "call_args"; callId: string; args: Record; } | { type: "call_end"; callId: string; success: boolean; result?: unknown; preview?: unknown; error?: string; }; export interface FabricCapabilityViewLease extends FabricCapabilityResolution { release(): Promise; } export interface FabricRegistryInvocationContext extends FabricInvocationContext { authorize?(action: ResolvedFabricAction): Promise; approve(action: ResolvedFabricAction, args: Record, /** Effective call lifetime, including runtime deadline and registry/binding revocation. */ signal?: AbortSignal): Promise; audits: FabricCallAudit[]; maxResultChars: number; trace?: FabricExecutionTraceRecorder; traceOperation?: FabricExecutionTraceOperationHandle; observeInvocation?(event: FabricRegistryActivityEvent): void; } /** * Prefix pi-fabric prepends to every nested tool-call id it generates inside a * fabric_exec run (one per pi., mcp., or agents. invocation). Extensions can * detect that a tool_call/tool_result event came from a nested fabric call — * rather than a top-level call the LLM made directly — by checking * `event.toolCallId.startsWith(NESTED_TOOL_CALL_ID_PREFIX)`. The LLM's own * tool-call ids (e.g. openai "call_…", anthropic "toolu_…") never use this * prefix, so the signal is unambiguous. */ export declare const NESTED_TOOL_CALL_ID_PREFIX = "fabric_"; export declare const scoreActionSearch: (query: string, action: { ref: string; name: string; description: string; provider: string; namespace?: string; inputSchema: unknown; }, providerDescription?: string) => number; export declare class ActionRegistry { #private; readonly toolResultProxy?: FabricNestedToolResultProxy | undefined; constructor(toolResultProxy?: FabricNestedToolResultProxy | undefined); /** * Attach the speculative-PTC runtime. Eligibility is re-checked against the * resolved descriptor at launch and replay, so a config/captured-tool change * cannot sneak a side-effecting ref into the store after the fact. */ setSpeculation(runtime: FabricSpeculationRuntime | undefined, eligibility?: (action: ResolvedFabricAction) => boolean): void; register(provider: FabricProvider, options?: { overwrite?: boolean; }): void; mount(provider: FabricProvider, options?: { overwrite?: boolean; staged?: boolean; }): FabricComponentProviderLease; activateProviderBindings(bindingIds: readonly string[]): string[]; subscribeProviderChanges(listener: (event: FabricProviderBindingEvent) => void): () => void; notifyCatalogChanged(provider: string): void; has(name: string): boolean; setUnavailableResolver(resolve: (name: string) => string | undefined): void; /** Host restrictions checked before any provider prepares or runs an action. */ setHostPolicy(policy: FabricHostPolicy | undefined): void; get hostPolicy(): FabricHostPolicy | undefined; markUnavailable(name: string, reason: string): void; unavailableProviders(): Array<{ name: string; reason: string; }>; unregister(name: string, options?: { provider?: FabricProvider; generation?: number | string; keepProviderOpen?: boolean; }): FabricProvider | undefined; providers(context?: FabricInvocationContext): Array<{ name: string; description: string; }>; inspectCapabilities(requirements: readonly (string | FabricCapabilityRequirement)[], context: FabricInvocationContext): Promise; acquireCapabilityView(requirements: readonly (string | FabricCapabilityRequirement)[], context: FabricInvocationContext): Promise; /** * Names of the visible providers that get a program global (see * src/provider-globals.ts): sorted, capped, and never a Fabric global, a * built-in provider, or a language keyword or builtin. A committed view * limits the names to the providers it binds. */ providerGlobals(context?: FabricInvocationContext): string[]; /** * Snapshot the tool schemas backing the dynamic guest surfaces (mcp, * extensions and provider globals) so the type gate can reject * argument-shape mistakes before the sandbox runs. Side-effect-free by * construction: MCP data comes from the provider's cache-warm descriptor * slice (listing would schedule background revalidation), extension data * from the captured-tool catalog, provider-global data from each provider's * own list(). Providers that cannot supply data yet simply contribute no * section, or a loose global, and the loose declarations stand for that * execution. With `code`, a provider's list() runs only when the program * uses its global (`name.` or `name[`); other provider globals stay loose, * so a program never waits on, or triggers, a catalog it does not use. */ guestTypeSources(context: FabricInvocationContext, options?: { code?: string; }): Promise; listDetailed(request: FabricProviderListRequest & { provider?: string; declared?: boolean; }, context: FabricInvocationContext, include?: (action: ResolvedFabricAction) => boolean): Promise<{ actions: ResolvedFabricAction[]; total: number; truncated: boolean; }>; list(request: FabricProviderListRequest & { provider?: string; declared?: boolean; }, context: FabricInvocationContext): Promise; catalog(context: FabricInvocationContext, options?: { provider?: string; limit?: number; includeProvider?: (provider: string) => boolean; }): Promise; search(query: string, context: FabricInvocationContext, limit?: number): Promise; describe(ref: string, context: FabricInvocationContext): Promise; acquireScoped(ref: string, args: Record, context: FabricInvocationContext & Partial>, adopt?: ProviderOperation["adopt"]): Promise; invoke(ref: string, args: Record, context: FabricRegistryInvocationContext): Promise; /** * Prepare + pre-launch a speculative call discovered in a partially * streamed program (see src/speculation). Pure pipeline only: descriptor * resolution, the eligibility gate on the resolved action, argument * preparation, and schema validation. The compiled entropy surface gates * launches too: quarantined refs never pre-launch and overlays validate * prepared arguments, so the store never warms a call the serve path * would reject. authorize/approve/audits are skipped * because the eligibility gate restricts this path to actions that never * prompt, and the real call re-runs the full pipeline on a serve miss. * Side-channel outputs are captured into `replay` so the serve path can * project them into the real audit. */ speculate(ref: string, args: Record, context: FabricInvocationContext, replay: FabricSpeculationReplay): Promise<{ preparedArgs: Record; bindingToken: string; execute(signal: AbortSignal | undefined): Promise; } | undefined>; endInvocation(parentToolCallId: string, timeoutMs?: number, signal?: AbortSignal): Promise; /** Revocation is distinct from rolling withdrawal: pinned old generations may * survive retirement, but revoked bindings admit no further work. */ revokeProvider(name: string): void; providerStatus(): Array<{ name: string; generation: number; state: string; inFlight: number; revoked: boolean; error?: string; }>; close(excludedProviderNames?: Set): Promise; } export {}; //# sourceMappingURL=action-registry.d.ts.map