import { acquireToolHistoryWriter } from "@mono-agent/agent-harness"; import type { AgentHarness, AgentHarnessOptions, AgentHarnessRuntimeOptionsExtension, AgentHarnessRuntimeOptionsInput, AgentHarnessToolHistoryOptions, ConversationHistoryStore } from "@mono-agent/agent-harness"; import type { AgentResponder, MemoryStore } from "@mono-agent/agent-contracts"; import type { MonoAgentConfig } from "@mono-agent/config"; import type { PhoenixExporterConfig, RunExporter } from "@mono-agent/observability"; import type { MonoRuntimeLike, RuntimeExecutionMode, RuntimeModelReference } from "@mono-agent/runtime-adapter"; import type { SandboxEngine } from "@mono-agent/runtime-adapter"; import type { ChannelId } from "./channels.js"; import type { ProcessJobsSettings } from "./process-jobs-config.js"; import { type ProcessJobsProtectionPosture } from "./process-jobs-protection.js"; import { type ProcessJobsRootRegistrySnapshot } from "./process-jobs-root-registry.js"; import type { ProcessJobsServiceHandle } from "./process-jobs-service.js"; export interface ConfiguredAgentRuntimeOptions { readonly config: MonoAgentConfig; /** Canonical agent-root authority. A raw public runtime fails before run() when omitted. */ readonly cwd?: string; readonly model?: RuntimeModelReference; readonly executionMode?: RuntimeExecutionMode; readonly sandboxEngine?: SandboxEngine; } export type ConfiguredAgentSessionEventKind = "acquired" | "released" | "saved" | "evicted" | "isolated" | "cold"; export interface ConfiguredAgentSessionSnapshot { readonly conversationId: string; readonly providerSessionId: string; readonly createdAt: number; readonly lastActivityAt: number; readonly busy: boolean; } export interface ConfiguredAgentSessionEvent { readonly kind: ConfiguredAgentSessionEventKind; readonly conversationId: string; readonly providerSessionId?: string; readonly createdAt?: number; readonly lastActivityAt?: number; readonly busy?: boolean; readonly reason?: string; readonly snapshot?: readonly ConfiguredAgentSessionSnapshot[]; } type ConfiguredAgentSessionEventHandler = (event: ConfiguredAgentSessionEvent) => void | Promise; export interface ConfiguredAgentHarnessOptions { readonly config: MonoAgentConfig; /** * Canonical agent-root authority and plugin-resolution folder. Configured * harnesses/responders retain their historical current-folder default. */ readonly cwd?: string; readonly runtime?: MonoRuntimeLike; readonly model?: RuntimeModelReference; readonly executionMode?: RuntimeExecutionMode; readonly memory?: MemoryStore; readonly historyStore?: ConversationHistoryStore; /** App-owned run-scoped interaction details to add only to replay history. */ readonly turnHistoryEnricher?: AgentHarnessOptions["turnHistoryEnricher"]; /** App-owned issuer for request-scoped project-MCP progress credentials. */ readonly progressCapabilityIssuer?: NonNullable["progressCapabilityIssuer"]; /** App-owned issuer for destination-bound asynchronous continuation claims. */ readonly continuationCapabilityIssuer?: NonNullable["capabilityIssuer"]; readonly createRunId?: AgentHarnessOptions["createRunId"]; readonly now?: AgentHarnessOptions["now"]; readonly runtimeOptions?: AgentHarnessOptions["runtimeOptions"]; readonly sandboxEngine?: SandboxEngine; readonly runtimeOptionsForRequest?: (input: AgentHarnessRuntimeOptionsInput) => AgentHarnessRuntimeOptionsExtension | Promise; /** Best-effort diagnostic when the default MemoryRecall endpoint cannot start. */ readonly onMemoryRecallUnavailable?: (error: unknown) => void; /** Best-effort host diagnostic for post-provider memory write failures. */ readonly onMemoryWarning?: (message: string) => void; /** Best-effort diagnostic for bounded lifecycle-sidecar write failures. */ readonly onToolHistoryWarning?: (message: string) => void; readonly onSessionEvent?: ConfiguredAgentSessionEventHandler; /** * Factory for a runtime bound to a per-request override model (cron/webhook * per-trigger model). Wired by the app so override runtimes share the * configured fallback chain and participate in config-reload disposal. */ readonly runtimeForModel?: AgentHarnessOptions["runtimeForModel"]; /** * Exporter-context fields the factory input cannot supply. Surfaced on the * exported root span so Phoenix traces map back to the running host and its * local artifacts. */ readonly observabilityContext?: { readonly sourceId?: string; readonly sourceLabel?: string; readonly configPath?: string; }; /** Best-effort exporter warnings (timeouts, transport failures). */ readonly exporterWarn?: (warning: { phase: string; message: string; }) => void; /** Injection seam (tests); defaults to createPhoenixRunExporter. */ readonly exporterFactory?: (config: PhoenixExporterConfig) => RunExporter; } export interface ConfiguredAgentResponderOptions extends ConfiguredAgentHarnessOptions { } interface RunArtifactCommitEvent { readonly phase: "started" | "finished"; readonly runId: string; readonly conversationId: string; } type RunArtifactCommitHook = (event: RunArtifactCommitEvent) => void | Promise; interface ConfiguredAgentInternalHooks { /** * App-owned hook invoked after the local JSONL running/terminal summary is * committed. Invocation runs before best-effort exporter work; a returned * promise is not awaited and all hook failures are ignored. */ readonly onRunArtifactCommitted?: RunArtifactCommitHook; /** App-only read decoration around the configured canonical history store. */ readonly wrapHistoryStore?: (store: ConversationHistoryStore) => ConversationHistoryStore; /** * Overrides `runtime.session.rollover` for THIS channel's responder. The app * builds one responder per channel, and a channel whose conversations already * carry an explicit user-owned session boundary (the console's threads) must * not have a second one imposed by the calendar. */ readonly sessionRollover?: MonoAgentConfig["runtime"]["session"]["rollover"]; /** App-published generation and live-controller injection for this channel. */ readonly processJobs?: { readonly registry: ProcessJobsRootRegistrySnapshot; readonly service: ProcessJobsServiceHandle | undefined; readonly channelId: ChannelId | undefined; readonly conversationScheme?: string | undefined; readonly protectionPosture: ProcessJobsProtectionPosture; readonly routesOnlyPiNative?: (metadata: Record | undefined) => boolean; }; /** * App-local bootstrap seam for a configured responder that does not own the * ProcessJobs service (currently `tui --local`). Registration happens only * after this harness acquires the canonical agent-root owner. */ readonly bootstrapProcessJobs?: { readonly settings: ProcessJobsSettings; readonly stateDir?: string; }; } export declare function createConfiguredAgentRuntime(config: MonoAgentConfig): MonoRuntimeLike; export declare function createConfiguredAgentRuntime(options: ConfiguredAgentRuntimeOptions): MonoRuntimeLike; /** @internal App/harness seam; callers are already inside the shared root/request choke point. */ export declare function createConfiguredAgentRuntimeForApp(input: MonoAgentConfig | ConfiguredAgentRuntimeOptions, internal?: { readonly suppressSandboxEngine?: boolean; }): MonoRuntimeLike; export declare function createConfiguredAgentHarness(options: ConfiguredAgentHarnessOptions): Promise; interface LazyConfiguredToolHistoryOptions { readonly root: string; readonly artifactRoot: string; readonly rollover: "none" | "daily" | undefined; readonly onWarning?: (message: string) => void; /** Internal seam for deterministic acquisition-retry tests. */ readonly acquireWriter?: typeof acquireToolHistoryWriter; /** Internal seam for deterministic progressive post-failure backoff tests. */ readonly acquisitionFailureBackoffMs?: number; /** Internal seam for the bounded progressive-backoff ceiling. */ readonly acquisitionFailureBackoffMaxMs?: number; /** Internal monotonic-enough clock seam; production uses wall time. */ readonly now?: () => number; } export declare function lazyConfiguredToolHistory(options: LazyConfiguredToolHistoryOptions): AgentHarnessToolHistoryOptions; export declare function createConfiguredAgentResponder(options: ConfiguredAgentResponderOptions): Promise; /** * @internal Application-composition seam. This is deliberately absent from the * package root so cache bookkeeping does not enlarge the supported harness API. */ export declare function createConfiguredAgentResponderForApp(options: ConfiguredAgentResponderOptions, internalHooks: ConfiguredAgentInternalHooks): Promise; /** @internal Shared only with app-local history decorators; absent from the package root. */ export declare const DEFAULT_HISTORY_MAX_MESSAGES = 64; interface ConfiguredMemoryDependencies { /** Canonical agent-root authority and folder used to resolve optional plugins. */ readonly cwd?: string; /** Managed workers must use the plugin frozen into their app-side runtime closure. */ readonly preferAppPluginInstall?: boolean; readonly logger?: { warn(message: string): void; }; /** * Injection seam for the bujo memory LLM's runtime (tests). This runtime MUST * NOT carry the channel runtime's fallback chain: the agent-runtime fallback * router overrides each run's per-call `model` with the chain's primary entry. */ readonly memoryRuntime?: MonoRuntimeLike; /** Optional app-owned recording context for memory LLM calls. */ readonly observability?: Pick; } export declare function createConfiguredMemory(config: MonoAgentConfig, deps?: ConfiguredMemoryDependencies): Promise; /** @internal App-only unsafe authority; deliberately absent from the package root. */ export declare function createConfiguredMemoryForApp(config: MonoAgentConfig, deps: ConfiguredMemoryDependencies, protectionPosture: ProcessJobsProtectionPosture): Promise; export {}; //# sourceMappingURL=configured-agent.d.ts.map