import { WorkflowManager as EngineWorkflowManager } from "@automatalabs/workflow-engine"; import type { AcpEventName, AcpRunnerEventMap } from "@automatalabs/acp-agents"; import type { ExecOptions, WorkflowDir, WorkflowManagerOptions } from "@automatalabs/workflow-engine"; import type { AgentRunner, RunEvent, WorkflowRunResult } from "@automatalabs/shared-types"; import { type ScriptBackendApproval } from "./script-backends.js"; export { projectWorkflowAgentActivity, workflowAgentEventSource, type WorkflowAgentEventSink, type WorkflowAgentEventSource, } from "./agent-event-source.js"; export { runWorkflow, parseWorkflowScript, hashCheckpointInputs, resolveAgentTimeoutMs, resolveWorkflowRunLimits, redactText, truncateUtf8, AGENT_PROGRESS_HEARTBEAT_MS, AGENT_PROGRESS_MIN_INTERVAL_MS, CALL_PATH_FORMAT, CALL_INPUTS_FORMAT, CHECKPOINT_INPUTS_FORMAT, RESUME_FALLBACK_REASONS, RESUME_DISABLED_REASONS, RESUME_CALL_LIVE_REASONS, RESUME_CALL_FAILED_REASONS, } from "@automatalabs/workflow-engine"; export { runIsolation, createReplayRunner, type RunIsolationSdkOptions } from "./isolation.js"; export type { RunIsolationOptions, IsolationRunResult, ReplayRunnerOptions, ResolvedIsolationTarget, IsolationTarget, ReplayRunner, ReplayObservation, ReplayReport, ReplayCallReport, ReplayDivergenceEvent, CheckpointCallContext, WorkflowCallRecord, WorkflowRecordedError, } from "./isolation.js"; export { openWorkflowDir, type WorkflowDir, type WorkflowDirEntry, type OpenWorkflowDirOptions, } from "@automatalabs/workflow-engine"; export { validateWorkflowScript, fabricateFromSchema, formatValidateReport, MOCK_TOKENS_PER_AGENT, ORDERED_THOUGHT_LEVEL_ENUMERATION_MODEL_LIMIT, } from "./validate.js"; export type { MockAnswerJson, MockAnswerRule, MockAnswers, MockAnswerSequence, UnusedMockAnswer, ValidateWorkflowOptions, ValidateWorkflowReport, ValidateHarnessOptions, ValidatedAgentCall, ValidatedCheckpoint, ValidatedMockAnswerRule, ValidatedMockAnswers, ValidatedMockAnswerUse, } from "./validate.js"; export { probeHarnessConfig, formatHarnessConfigReport } from "./config.js"; export type { ProbeHarnessConfigOptions, HarnessConfigReport } from "./config.js"; export type { WorkflowRunOptions, WorkflowRunLimitOptions, WorkflowAgentAttemptControl, WorkflowAgentCallCancellation, AgentOptions, ExecOptions, WorkflowManagerOptions, CheckpointOptions, WorkflowRunResult, WorkflowSnapshot, WorkflowPathOptions, RunPersistence, RunPersistenceOptions, PersistedRunState, PersistedAgentState, PersistedResumeFormat, PersistedResumeCandidate, PersistedResumeCallBlocker, PersistedCheckpointInjection, PersistedResumeSeed, PersistedRunLineageTombstone, PreparedResume, WorkflowLogTail, WorkflowRunCallStatus, WorkflowRunInspectionOptions, WorkflowRunLimits, WorkflowRunStatus, WorkflowRunStatusTruncation, WorkflowRunFallback, WorkflowCheckpointSource, WorkflowCheckpointTaken, ResumePolicy, WorkflowResumeStrategy, WorkflowResumeMatch, WorkflowResumeFallbackReason, WorkflowResumeDisabledReason, WorkflowResumeCallLiveReason, WorkflowResumeCallFailedReason, WorkflowResumeSafety, WorkflowCallReplayProvenance, WorkflowResumeCallDecision, WorkflowResumeReport, WorkflowReplayOperationalOption, WorkflowReplayOperationalChange, WorkflowReplayProvenanceField, WorkflowReplayProvenanceChange, WorkflowReplayFirstNonReplay, WorkflowReplayEligibility, WorkflowAgentActivity, WorkflowAgentActivityBase, } from "@automatalabs/workflow-engine"; export { AGENTPRISM_PERSISTENCE_ROOT_ENV, WORKFLOW_PROJECTS_SUBDIR, workflowHomeDir, workflowProjectKey, workflowProjectPaths, WorkflowError, WorkflowErrorCode, isWorkflowError, isProviderUsageLimit, isAuthRequired, } from "@automatalabs/workflow-engine"; export { withRunEvents, RunEventLogError, RUN_EVENT_READ_LIMIT_DEFAULT, RUN_EVENT_READ_LIMIT_MAX, RUN_EVENT_MAX_RECORD_BYTES, } from "@automatalabs/workflow-engine"; export type { RunEventPersistence, RunEventStream, AppendRunEventInput, ReadRunEventsOptions, ReadRunEventsResult, WatchRunEventsOptions, RunEventLogErrorCode, } from "@automatalabs/workflow-engine"; export { createAcpRunner, AcpAgentRunner, InteractiveSession, selectBackend, ClaudeBackend, CodexBackend, CustomAcpBackend, AGENT_METHODS, CLIENT_METHODS, AGENT_METHOD_COVERAGE, CLIENT_METHOD_COVERAGE, ACP_AUTH_REQUIRED_ERROR_CODE, clientCapabilitiesFor, adaptPromptContent, resolveBackendRegistry, BACKENDS_ENV, toJsonSchema, toStrictJsonSchema, } from "@automatalabs/acp-agents"; export type { AcpPoolOptions, AcpRunnerOptions, AuthenticateOptions, AuthMethodsOptions, DisableProviderOptions, DeleteSessionOptions, InteractiveSessionOptions, InteractiveTurn, SteeringOutcome, ListProvidersOptions, ListSessionsOptions, LogoutOptions, ProbeConfigOptionsOptions, ProbedConfigOptions, ReattachSessionOptions, SetProviderOptions, BackendRegistry, CustomBackendConfig, RegisteredBackend, ClientCapabilityOptions, ClientHandlers, FsHandlers, McpHandlers, TerminalHandlers, AcpSessionContext, NegotiatedCapabilities, PermissionResolver, AgentAuthCapabilities, AgentRequestMethod, AgentRequestParamsByMethod, AgentRequestResponsesByMethod, AuthCapabilities, AuthenticateRequest, AuthenticateResponse, AuthMethod, AuthMethodAgent, AuthMethodId, AuthMethodTerminal, ConnectMcpRequest, ConnectMcpResponse, DeleteSessionRequest, DeleteSessionResponse, DisableProviderRequest, DisableProviderResponse, DisconnectMcpRequest, DisconnectMcpResponse, ListProvidersRequest, ListProvidersResponse, ListSessionsRequest, ListSessionsResponse, LlmProtocol, LoadSessionRequest, LoadSessionResponse, LogoutCapabilities, LogoutRequest, LogoutResponse, McpConnectionId, McpServerAcp, McpServerAcpId, MessageMcpNotification, MessageMcpRequest, MessageMcpResponse, ProviderCurrentConfig, ProviderId, ProviderInfo, ProvidersCapabilities, ResumeSessionRequest, ResumeSessionResponse, SetProviderRequest, SetProviderResponse, AgentNotificationMethod, AgentNotificationParamsByMethod, CompleteElicitationNotification, CreateElicitationRequest, CreateElicitationResponse, ElicitationAcceptAction, ElicitationCapabilities, ElicitationContentValue, ElicitationFormCapabilities, ElicitationFormMode, ElicitationId, ElicitationPropertySchema, ElicitationRequestScope, ElicitationResolver, ElicitationSchema, ElicitationSchemaType, ElicitationSessionScope, ElicitationUrlCapabilities, ElicitationUrlMode, SessionMode, SessionModeState, SessionConfigOption, SessionInfo, SendRequestOptions, AgentMethodCoverage, ClientMethodCoverage, } from "@automatalabs/acp-agents"; export type { AuthResolver, AuthContext, AuthResolution, AuthMethodDescriptor, CompleteAuthOptions, AuthOutcome, AuthController, AuthStatusSnapshot, AuthCapableRunner, ProviderCapableRunner, } from "@automatalabs/acp-agents"; export type { ProviderUsageLimitContext, AuthErrorContext, CheckpointContext, } from "@automatalabs/shared-types"; export { TypedEventEmitter } from "@automatalabs/acp-agents"; export type { AcpRunnerEventMap, AcpEventName, AcpEventListener, AcpEventContext, AcpSessionUpdate, AcpUpdateKind, AcpElicitationCompleteEvent, AcpElicitationEvent, AcpElicitationPendingEvent, AcpPermissionPendingEvent, AcpPermissionEvent, AcpRawMessageEvent, AcpSteeringEvent, AcpBackendErrorEvent, } from "@automatalabs/acp-agents"; export type { AgentRunner, McpAcpServerConfig, McpServerConfig, RunOptions, AgentResult, AgentUsage, } from "@automatalabs/shared-types"; export type { AgentSessionRecord, AgentSessionRef, JournalCallMetadata, JournalEntry, WorkflowBackendConfig, WorkflowMeta, } from "@automatalabs/shared-types"; export { RUN_EVENT_LOG_VERSION } from "@automatalabs/shared-types"; export type { RunEvent, EngineRunEvent, EngineRunEventName, EngineRunEventPayloadMap, PersistableEngineRunEvent, PersistedRunEvent, RunEventLogRecord, RunEventValueProjection, RunEventErrorProjection, RunEventCheckpointProjection, PersistedRunAgentEndPayload, RunAgentProgressEvent, RunAgentProgressPayload, RunAgentTranscriptEvent, RunAgentTranscriptPayload, } from "@automatalabs/shared-types"; type ContextProperty = Key extends keyof T ? T[Key] : never; type OptionalContextProperty = Key extends keyof T ? T[Key] : undefined; /** The manager unwraps the runner catch-all into its concrete sessionUpdate discriminant. */ export type WorkflowAgentEventName = Exclude; /** * Envelope map over the runner's whole public event-name type. The manager-emitted map below * picks only names the bridge actually publishes; retaining the full map preserves the existing * AgentEventPayload<"session_update"> type argument for source compatibility. */ type WorkflowAgentEventEnvelopeMap = { [Name in AcpEventName]: { name: Name; event: AcpRunnerEventMap[Name]; backendId: ContextProperty; } & ("sessionId" extends keyof AcpRunnerEventMap[Name] ? { sessionId: ContextProperty; } : { sessionId?: undefined; }) & { label?: OptionalContextProperty; runId?: OptionalContextProperty; scope?: OptionalContextProperty; callIndex?: OptionalContextProperty; }; }; export type WorkflowAgentEventPayloadMap = Pick; export type WorkflowAgentEventPayload = WorkflowAgentEventPayloadMap[Name]; export type WorkflowAgentEvent = { [Name in WorkflowAgentEventName]: { type: "agentEvent"; } & WorkflowAgentEventPayload; }[WorkflowAgentEventName]; export type WorkflowRunEvent = RunEvent; /** * Compatibility alias retained with its pre-contract generic constraint and default. The * "session_update" member is type-only: the manager did not emit it before this contract and * still does not. New exact consumers use WorkflowAgentEventPayload/WorkflowAgentEvent. */ export type AgentEventPayload = WorkflowAgentEventEnvelopeMap[Name]; export interface WorkflowManager { addListener(eventName: "agentEvent", listener: (payload: WorkflowAgentEventPayload) => void): this; on(eventName: "agentEvent", listener: (payload: WorkflowAgentEventPayload) => void): this; once(eventName: "agentEvent", listener: (payload: WorkflowAgentEventPayload) => void): this; removeListener(eventName: "agentEvent", listener: (payload: WorkflowAgentEventPayload) => void): this; off(eventName: "agentEvent", listener: (payload: WorkflowAgentEventPayload) => void): this; emit(eventName: "agentEvent", payload: WorkflowAgentEventPayload): boolean; addListener(eventName: string | symbol, listener: (...args: any[]) => void): this; on(eventName: string | symbol, listener: (...args: any[]) => void): this; once(eventName: string | symbol, listener: (...args: any[]) => void): this; removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this; off(eventName: string | symbol, listener: (...args: any[]) => void): this; emit(eventName: string | symbol, ...args: any[]): boolean; } /** * Stateful workflow manager exported by the SDK facade. It is the workflow-engine manager plus * ONE composition-root bridge for ACP-capable runners: when the injected AgentRunner also exposes * the acp-agents `.on(name, listener)` bus, the manager forwards that live stream as `agentEvent`. * * The engine package stays backend-agnostic; this facade already owns the ACP default runner and * ACP event types, so the bridge belongs here. Forwarding is OBSERVABILITY ONLY: manager * `agentEvent` listeners are isolated from each other and from the run, and `dispose()` removes * only the manager's runner subscriptions (runner process ownership stays with the caller). */ export declare class WorkflowManager extends EngineWorkflowManager { private readonly acpBridges; constructor(options?: WorkflowManagerOptions); startInBackground(script: string, args?: unknown, exec?: ExecOptions): { runId: string; promise: Promise; }; runSync(script: string, args?: unknown, exec?: ExecOptions): Promise; resumeInBackground(runId: string, exec?: ExecOptions): Promise<{ accepted: false; promise?: undefined; } | { accepted: true; promise: Promise; }>; resume(runId: string, exec?: ExecOptions): Promise; /** Detach manager-owned ACP event subscriptions. The manager does NOT dispose the runner: the * caller may share one runner across managers or own its process lifetime explicitly. */ dispose(): void; /** Node-style alias for hosts that tear down managers through close hooks. */ close(): void; private acquireAcpRunnerBridge; } /** * Approval policy for SCRIPT-DECLARED custom ACP backends (`meta.backends`). Script backends * spawn arbitrary commands on this machine, so they are INERT unless the embedder approves * them: `true` approves everything the script declares; a callback is asked per backend (and * a single decline aborts the run — a declined backend would otherwise silently reroute its * agent() calls to the default backend). Omitted/false + a script that declares backends => * runDynamicWorkflow THROWS with guidance rather than running a script whose declared * dependencies were dropped. */ export type { ScriptBackendApproval } from "./script-backends.js"; /** Options for {@link runDynamicWorkflow}. */ export interface RunDynamicWorkflowOptions { /** * The agent backend (the frozen AgentRunner seam) to drive this run. The seam is * injectable: pass a custom runner to swap the backend (or to stub it in tests). * Omitted => defaults to the ACP backend via `createAcpRunner()`. */ runner?: AgentRunner; /** * Base working directory for the run (e.g. the project root): every subagent ACP session * runs here (unless the agent sets its own `cwd` or worktree isolation), worktrees branch * from it, and agentType definitions are scanned from it. Omitted => `process.cwd()`. */ cwd?: string; /** The `args` value handed to the workflow script's vm-realm `args` global. */ args?: unknown; /** Per-execution options forwarded to `WorkflowManager.runSync` (timeouts, signal, …). */ exec?: ExecOptions; /** Approval policy for script-declared `meta.backends` (see {@link ScriptBackendApproval}). */ allowScriptBackends?: ScriptBackendApproval; /** * A workflow directory view (or dir path(s) to open one over) serving saved workflows * by name. When set, the first argument may be a workflow NAME instead of a script * (resolver first, verbatim-script fallback — the engine's own nested-workflow rule), * and nested `workflow("")` calls resolve from the same view (it is wired into * the run's `loadSavedWorkflow`). */ workflows?: string | string[] | WorkflowDir; } /** * Run a dynamic workflow script to a TERMINAL result, with the AgentRunner seam * defaulted to the ACP backend. * * Thin convenience over the engine: it constructs a one-off `WorkflowManager` whose * injected `agent` is `opts.runner ?? createAcpRunner()` and delegates to its * `runSync(script, args, exec)`, which always resolves to a terminal * `WorkflowRunResult` (status `completed | paused | failed | aborted`) — never throwing * for an ordinary pause/fail — so the caller can read `result.status` directly. */ export declare function runDynamicWorkflow(script: string, opts?: RunDynamicWorkflowOptions): Promise; //# sourceMappingURL=index.d.ts.map