import type { Message as A2AMessage } from "../a2a/types.js"; import { type ActionEntry, type AgentActionSurfaceDetails, type AgentActionSurfaceResolution, type AgentLoopUsage } from "../agent/production-agent.js"; import { type ActiveRun } from "../agent/run-manager.js"; import { foldAgentChatRunCompletion } from "../agent/thread-data-builder.js"; import type { AgentChatEvent, AgentChatScope } from "../agent/types.js"; import { type QueuedMessage } from "../chat-threads/store.js"; import { type FrameworkToolGroup } from "../framework-tools.js"; import type { ResolvedKeyReference } from "../secrets/substitution.js"; import { type TrackingMeta } from "../tracking/registry.js"; import { handleSharedThreadRequest, type SharedThreadRouteDependencies } from "./agent-chat/shared-thread.js"; export { handleSharedThreadRequest }; export type { SharedThreadRouteDependencies }; type AgentChatRunTrackingSource = Pick & { isSyntheticTraffic?: boolean; }; export declare function trackAgentChatRunLifecycle(event: "run_started" | "run_finished" | "run_no_reply", threadId: string | undefined, attemptId: string | undefined, userId?: string, properties?: Record, appId?: string, trackingSource?: AgentChatRunTrackingSource): void; /** `run_started` from every agent-chat entry point, keyed to its turn. */ export declare function trackAgentChatRunStarted(threadId: string, runId: string, turnId: string, owner: string | undefined, appId: string | undefined): void; import { buildSelectedA2AReceiverContext, createA2AEngineToolSurface, DEFAULT_DELEGATED_MAX_ITERATIONS, DEFAULT_DELEGATED_MAX_RUN_INPUT_TOKENS, DEFAULT_DELEGATED_MAX_TOOL_RESULT_CHARS, isSelectedA2AReceiver, runA2AAgentLoop, runMCPAgentLoop, assembleA2AFinalResponse, buildPublicAgentA2ASkills } from "./agent-chat/action-filters-a2a.js"; import { _agentChatPromptSectionsForTests } from "./agent-chat/framework-prompts.js"; import { type AgentChatPluginOptions, type NitroPluginDef } from "./agent-chat/plugin-options.js"; import { finalizeClaimedAgentChatProcessRunFailure } from "./agent-chat/process-run-failure.js"; import { loadResourcesForPrompt } from "./agent-chat/prompt-resources.js"; import { isNetlifyRecurringJobsRuntime, resolveRecurringJobsBuildMarker, scheduledTriggerAvailability, shouldDisableRecurringJobsRuntime } from "./agent-chat/recurring-jobs-runtime.js"; import { shouldBlockInProductCodeEditingSurface } from "./agent-chat/request-surface.js"; import { loadRunCodeToolEntries } from "./agent-chat/run-code-tools.js"; export { loadResourcesForPrompt }; export { _agentChatPromptSectionsForTests }; export { buildPublicAgentA2ASkills }; export { assembleA2AFinalResponse }; export declare function buildLeanSystemPrompt(input: { basePrompt: string; resources: string; additionalFramework?: string; cacheSplit?: string; extra?: string; modelOverlay?: string; runtimeContext?: string; }): string; export type { AgentChatPluginOptions }; export { runA2AAgentLoop }; export { runMCPAgentLoop }; export { createA2AEngineToolSurface }; export { buildSelectedA2AReceiverContext, isSelectedA2AReceiver }; export { DEFAULT_DELEGATED_MAX_ITERATIONS, DEFAULT_DELEGATED_MAX_RUN_INPUT_TOKENS, DEFAULT_DELEGATED_MAX_TOOL_RESULT_CHARS, }; export { shouldBlockInProductCodeEditingSurface }; export { loadRunCodeToolEntries }; export { isNetlifyRecurringJobsRuntime }; export { resolveRecurringJobsBuildMarker }; export { scheduledTriggerAvailability }; export { shouldDisableRecurringJobsRuntime }; export { finalizeClaimedAgentChatProcessRunFailure }; export declare function runPostAgentTurnAutosave(callback: AgentChatPluginOptions["onAgentTurnComplete"] | undefined, scope: AgentChatScope | null | undefined, run: ActiveRun): Promise; export declare function runPostAgentRunComplete(callback: AgentChatPluginOptions["onAgentRunComplete"] | undefined, scope: AgentChatScope | null | undefined, run: ActiveRun, outcome?: { turnContinues: boolean; }): Promise; export declare function runPreAgentTurnAutosave(callback: AgentChatPluginOptions["onAgentTurnStart"] | undefined, scope: AgentChatScope | null | undefined, run: Pick): Promise; export { foldAgentChatRunCompletion }; export declare function assertAgentChatRunProjectionUpdated(updated: boolean, threadId: string, runId: string): void; export declare function runAgentChatRunCompletionHooksAfterProjection(persistProjection: () => Promise, runCompletionHooks: () => Promise): Promise; /** * The model this mount runs with, when the caller does not pass one per request. * * The plugin option is the top layer because it is per-mount; `agent.model` * (`AGENT_MODEL`) is the declared layer below it, so a deployment can pin a * model without editing app source. Read through here rather than off * `options` directly — every raw `options?.model` site is a place the declared * field silently does nothing. */ export declare function resolveConfiguredAgentModel(options?: Pick): string | undefined; export declare function resolveInteractiveAgentRunOptions(options?: Pick): { runSoftTimeoutMs: number | undefined; runNoProgressTimeoutMs: number | undefined; durableBackgroundRuns: boolean | undefined; }; export declare function parseQueuedMessageForThread(value: unknown, threadId: string): QueuedMessage | null; export declare function createSerializedA2ATaskStatusWriter(taskId: string, writeStatus?: (taskId: string, message: A2AMessage) => Promise, onError?: (error: unknown) => void): { enqueue: (message: A2AMessage) => void; flush: () => Promise; }; export declare function runA2AAgentLoopWithRunManager(runOptions: Parameters[0], pluginOptions: Pick, timeoutOptions: Parameters[2], delegatedOptions?: Parameters[3], taskSignal?: AbortSignal): Promise>>; export declare function runA2AWithUsageLedger(run: Promise, input: { usage: AgentLoopUsage; ownerEmail: string; orgId: string | null; appId?: string; taskId: string; processingAttemptId?: string; persistUsage?: (record: import("../usage/store.js").UsageRecord) => Promise; }): Promise; export declare function resolveA2ARecoverableArtifactSecret(orgId?: string | null | undefined): Promise; export declare function buildLeanRunPolicyPrompt(codeEditingSurfaceRestriction: string, prodCodeExecPromptNote: string): string; export declare function filterPromptActionsToSurface(actions: Record, allowedActionNames?: readonly string[]): Record; /** Keep late-bound sandbox and data-program bridges on the current request's * authorized registry instead of the plugin's process-wide action catalog. */ export declare function filterRuntimeActionsToSurface(actions: Record): Record; /** Remove framework guidance for tools that the request surface does not * expose. The default framework prompt is line-oriented, so dropping the * affected instruction keeps unrelated behavioral guidance intact without * teaching the model names it cannot call. */ export declare function filterFrameworkPromptToSurface(prompt: string, actions: Record, allowedActionNames?: readonly string[]): string; export declare function resolveProductionCodeExecutionForActionSurface(mode: "off" | "sandboxed" | "trusted", hasRequestScopedSurface: boolean): "off" | "sandboxed" | "trusted"; export declare function resolveObservabilityReviewSummaryActionSurface(details: AgentActionSurfaceDetails, resolveHostSurface?: (details: AgentActionSurfaceDetails) => AgentActionSurfaceResolution | Promise): Promise; /** * Abort reasons that mean a human asked to stop, so `/runs/:id/abort` escalates * to a turn-wide abort. Watchdog reasons (`no_progress`, `auto_stuck_retry`) * stay single-run: they end a chunk the client believes is dead and must not * kill a server-side continuation chain that is still making progress. */ export declare const USER_STOP_ABORT_REASONS: Set; /** * Pick the URL allowlist to enforce for a `${keys.NAME}` reference used by * the agent fetch tool. * * SECURITY (audit 05 H2 alignment): the allowlist check must stay * consistent with the scope a key actually resolved at (see the * `getKeyAllowlist` docstring in secrets/substitution.ts). Since the fetch * tool now resolves keys via `resolveKeyReferencesWithRequestScopes` — which * cascades user → org → workspace scope — a plain user-scope-only allowlist * lookup would silently miss an allowlist configured on the org/workspace * row that actually supplied the value. When `resolvedKeys` reports which * scope a key resolved at, look up the allowlist there; only fall back to * the legacy user-scope lookup for a key the resolver didn't report (should * not normally happen — every key the cascade resolves reports a ref). */ export declare function resolveFetchToolKeyAllowlist(keyName: string, resolvedKeys: ResolvedKeyReference[] | undefined, owner: string, deps: { getKeyAllowlist: (name: string, scope: "user", scopeId: string) => Promise; getResolvedKeyAllowlist: (ref: ResolvedKeyReference) => Promise; }): Promise; export declare function resolveHostedBuilderHandoff(browserTools: Record, canToggle: boolean): Record; /** Setup CTAs that must be callable on the very first request. * * Both are recovery actions: the agent should answer "use Builder.io for me" * or a failed upload by rendering the inline card, not by spending a turn in * `tool-search` first. `connect-builder` is registered in every registry that * receives `browserTools`, local dev included, so naming it only through the * hosted-only handoff left local dev advertising "Use Builder.io" in the * UI while the agent was never told the tool existed. Names the registry does * not have are dropped by `filterInitialEngineTools`, so listing both here is * safe for lean registries. */ export declare function resolveConnectSetupInitialToolNames(browserTools: Record): string[]; export declare function resolveAgentCheckpointPaths(cwd: string, changedPaths: readonly string[], events: readonly { event: AgentChatEvent; }[]): Map; export declare function disabledGroupsForA2APrompt(disabledGroups: ReadonlySet, a2aAgentDelegationEnabled: boolean): ReadonlySet; export declare function createAgentChatPlugin(options?: AgentChatPluginOptions): NitroPluginDef; /** * Default agent chat plugin with no template-specific actions. * In dev mode, provides file system, bash, and database tools. * In production, provides only the default system prompt. */ export declare const defaultAgentChatPlugin: NitroPluginDef;