import type { ApprovalDecision, ApprovalGrant, ApprovalRequest, ApprovalResponse, CheckpointCreateOptions, CheckpointRestoreOptions, CheckpointResult, FabricEvent, FabricPrincipal, JsonObject, ModelMessage, ModelUsage, PromptOptions, SandboxBackend, ShellOptions, ShellResult, ToolCall, ToolCallResult } from "@fabric-harness/sdk"; export type TemporalRunStatus = "queued" | "running" | "waiting_for_approval" | "completed" | "failed" | "cancelled"; export interface SnapshotRef { id: string; backend: string; path?: string; uri?: string; metadata?: JsonObject; } export interface ActivityIdempotency { /** Stable operation ID generated by workflow and reused across activity retries. */ idempotencyKey: string; /** Optional entry ID when the operation should append exactly once to SessionStore. */ entryId?: string; /** Optional tool-call ID when the operation maps to a model tool call. */ toolCallId?: string; } export interface ActivityTimeoutPolicy { scheduleToCloseMs: number; startToCloseMs: number; heartbeatMs?: number; } export interface TemporalActivityTimeouts { appendSessionEntry: ActivityTimeoutPolicy; appendSessionEvent: ActivityTimeoutPolicy; loadSession: ActivityTimeoutPolicy; buildContext: ActivityTimeoutPolicy; modelGenerate: ActivityTimeoutPolicy; executeTool: ActivityTimeoutPolicy; checkpoint: ActivityTimeoutPolicy; compactSession: ActivityTimeoutPolicy; resolveSecret: ActivityTimeoutPolicy; } export declare const DEFAULT_TEMPORAL_ACTIVITY_TIMEOUTS: TemporalActivityTimeouts; export interface ApprovalSignal { approvalId: string; decision: ApprovalDecision; reason?: string; actor?: string; metadata?: JsonObject; } export interface PendingApprovalState { approvalId: string; sessionId: string; subject: string; requestedAt: string; timeoutAt?: string; response?: ApprovalSignal; } export interface TemporalSessionWorkflowInput { sessionId: string; agentId?: string; workspaceRoot?: string; sandboxBackend?: SandboxBackend; metadata?: JsonObject; } export interface PromptWorkflowInput { sessionId: string; promptId: string; text: string; /** Deterministic, JSON-serializable prompt controls consumed by the workflow. */ options?: Pick; idempotency?: ActivityIdempotency; } export interface TaskWorkflowInput extends PromptWorkflowInput { taskId: string; } export interface PromptWorkflowResult { sessionId: string; promptId: string; status: Extract; result?: unknown; error?: string; usage?: ModelUsage; } export interface SessionRuntimePromptInput { text: string; options?: PromptOptions; } export interface SessionRuntimeTaskInput extends SessionRuntimePromptInput { taskId?: string; } export interface SessionRuntimeCheckpointCreateInput { options: CheckpointCreateOptions | string; } export interface SessionRuntimeCheckpointRestoreInput { options: CheckpointRestoreOptions | string; } export interface SessionRuntimeShellInput { command: string; options?: ShellOptions; } export interface SessionRuntimeApprovalInput { request: ApprovalRequest; timeoutMs?: number; } export interface SessionRuntime { prompt(input: SessionRuntimePromptInput): Promise; task(input: SessionRuntimeTaskInput): Promise; checkpointCreate(input: SessionRuntimeCheckpointCreateInput): Promise; checkpointRestore(input: SessionRuntimeCheckpointRestoreInput): Promise; shell(input: SessionRuntimeShellInput): Promise; approvalRequest(input: SessionRuntimeApprovalInput): Promise; } export interface ModelGenerateActivityInput { sessionId: string; promptId: string; messages: ModelMessage[]; model?: string; idempotency: ActivityIdempotency; } export interface ModelGenerateActivityResult { message?: ModelMessage; toolCalls?: ToolCall[]; usage?: ModelUsage; } export interface ToolApprovalRequest { approvalId: string; toolCallId: string; inputDigest: string; executingPrincipal: FabricPrincipal; createdAt: string; ttlSeconds?: number; reason: string; subject: string; kind: "tool" | "command"; risk?: "low" | "medium" | "high"; matchedPattern?: string; envKeys?: string[]; affectedPaths?: string[]; tool?: string; command?: string; input?: JsonObject[string]; timeoutMs?: number; } export interface ExecuteToolActivityInput { sessionId: string; promptId: string; call: ToolCall; approval?: ApprovalGrant; idempotency: ActivityIdempotency; } export interface ExecuteToolActivityResult { result: ToolCallResult; approvalRequest?: ToolApprovalRequest; } export interface TemporalWorkflowQueryState { sessionId: string; status: TemporalRunStatus; pendingApprovals: PendingApprovalState[]; lastEvent?: FabricEvent; } export type TemporalIntegrationMode = "mock" | "temporal"; export type TemporalPromptWorkflowMode = "coarse" | "hybrid"; export interface TemporalTlsConfig { enabled?: boolean; serverNameOverride?: string; serverRootCACertificate?: string; serverRootCACertificatePath?: string; clientCert?: string; clientKey?: string; clientCertPath?: string; clientKeyPath?: string; } export interface TemporalConnectionConfig { address?: string; namespace?: string; taskQueue?: string; workflowIdPrefix?: string; promptWorkflowMode?: TemporalPromptWorkflowMode; apiKey?: string; apiKeyEnv?: string; tls?: TemporalTlsConfig; } export interface TemporalRuntimeOptions extends TemporalConnectionConfig { mode?: TemporalIntegrationMode; activityTimeouts?: Partial; } export interface TemporalWorkerOptions extends TemporalRuntimeOptions { address?: string; workflowsPath?: string; activities?: unknown; /** Start worker.run() immediately. Defaults to true. */ autoRun?: boolean; } export interface TemporalClientOptions extends TemporalRuntimeOptions { address?: string; } export interface TemporalSignalClient { signalApproval(sessionId: string, signal: ApprovalSignal): Promise; signalWorkflowApproval(workflowId: string, signal: ApprovalSignal): Promise; describeSession(sessionId: string): Promise; } //# sourceMappingURL=types.d.ts.map