import { type SortieDogsPluginOptions } from "./config.js"; import { type ContinuationClient } from "./continuation.js"; import { type ToolExecuteBeforeInput, type ToolExecuteBeforeOutput } from "./gate.js"; import { type OpenCodeChatMessageHook, type OpenCodeModelAvailabilityClient } from "./model-routing-hook.js"; import { type SessionMessageReader } from "./task-result-repair.js"; import type { RunMetricsClient } from "./run-metrics.js"; import type { RuntimeBridge } from "./runtime-bridge.js"; export declare const PARALLEL_COMMIT_ARTIFACT_CAPABILITY = "sortie_create_parallel_commit_artifact"; export interface OpenCodePluginInput { directory: string; worktree?: string; /** Optional host-injected lifecycle observation window; production callers use the core default. */ childLifecycleCheckWaitMs?: number; /** Installed-profile adapter only; never supplied by a model or project configuration. */ runtimeBridge?: RuntimeBridge; /** The host SDK client. Absent in hosts that construct the plugin without one. */ client?: SessionMessageReader & RunMetricsClient & ContinuationClient & OpenCodeModelAvailabilityClient & { app?: { log?: (request: { body: { service: string; level: "debug" | "info" | "error" | "warn"; message: string; extra?: Record; }; query?: { directory?: string; }; }) => unknown; }; tui?: { showToast?: (request: { body: { title: string; message: string; variant: "warning"; duration: number; }; }) => Promise; }; }; [key: string]: unknown; } export interface OpenCodeEvent { type: string; properties?: Record; } export interface OpenCodeHooks { event?: (input: { event: OpenCodeEvent; }) => Promise; "permission.ask"?: (input: { permission: string; patterns: string[]; sessionID?: string; }, output: { status: "ask" | "deny" | "allow"; }) => Promise; "tool.execute.before"?: (input: ToolExecuteBeforeInput, output: ToolExecuteBeforeOutput) => Promise; "tool.execute.after"?: (input: TaskToolExecuteAfterInput, output: TaskResultRepairOutput) => Promise; "chat.message"?: OpenCodeChatMessageHook; "experimental.chat.system.transform"?: (input: { sessionID: string; }, output: { system?: string[]; model?: unknown; }) => Promise; /** Continuation observes the coordinator's completed final text to honour its fallback markers. */ "experimental.text.complete"?: (input: { sessionID: string; messageID?: string; partID?: string; }, output: { text: string; }) => Promise; /** Continuation replaces the compaction prompt so batch state survives the rollover. */ "experimental.session.compacting"?: (input: { sessionID: string; }, output: { context?: string[]; prompt?: string; }) => Promise; /** Continuation owns the resume, so the host must not auto-continue the same session too. */ "experimental.compaction.autocontinue"?: (input: { sessionID: string; overflow?: boolean; }, output: { enabled: boolean; }) => Promise; tool?: Record; } export type OpenCodePlugin = (input: OpenCodePluginInput, options?: SortieDogsPluginOptions | Record) => Promise; export type HandoffDenialReason = "configuration-unavailable" | "path-invalid" | "input-unavailable" | "schema-invalid" | "contract-invalid"; export type FreshSessionReason = "child-lineage" | "asset-contract-skew"; export type FreshSessionAction = "open-fresh-root" | "install-assets-then-open-fresh-root" | "restart-host-after-install"; export type FreshSessionResult = Readonly<{ status: "redispatch-queued"; reason: FreshSessionReason; source_session_id: string; retry_same_session: false; }> | Readonly<{ status: "redispatched"; reason: FreshSessionReason; source_session_id: string; target_session_id: string; retry_same_session: false; }> | Readonly<{ status: "user-action-required"; reason: FreshSessionReason; action: FreshSessionAction; retry_same_session: false; }>; export declare class FreshSessionRequiredError extends Error { readonly result: FreshSessionResult; readonly code = "SORTIE_FRESH_SESSION_REQUIRED"; constructor(result: FreshSessionResult, options?: ErrorOptions); } export declare class HandoffDeniedError extends Error { readonly reason: HandoffDenialReason; readonly defects: readonly string[]; constructor(reason: HandoffDenialReason, path: string, options?: ErrorOptions & { defects?: readonly string[]; }); } interface TaskToolExecuteAfterInput { readonly tool: string; readonly sessionID?: string; readonly callID?: string; readonly args?: unknown; } interface TaskResultRepairOutput { output?: unknown; metadata?: unknown; [key: string]: unknown; } interface OpenCodeToolDefinition { description: string; args: Record; execute(args: Record, context: { sessionID: string; agent?: string; }): Promise; } export declare function isExplicitTaskHandoff(text: string): boolean; /** Named OpenCode plugin export. Importing the package has no side effects; invoking it installs active gates. */ export declare const SortieDogsPlugin: OpenCodePlugin; export type { SortieDogsPluginOptions } from "./config.js"; export { InvalidModelTargetError, ModelRoutingDeniedError } from "./model-routing-hook.js";