import { z } from 'zod'; import { type CapabilityDispatcher, type CapabilityContext } from '../capabilities/runtime/dispatcher.js'; import type { LocalAppService } from './service.js'; export declare const AutomationProposalInputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{ kind: z.ZodLiteral<"create">; definition: z.ZodObject<{ projectId: z.ZodOptional>, z.ZodTransform>>; name: z.ZodString; enabled: z.ZodOptional; action: z.ZodDiscriminatedUnion<[z.ZodObject<{ kind: z.ZodLiteral<"assistant_task">; conversationId: z.ZodString; agentId: z.ZodString; instruction: z.ZodString; locale: z.ZodEnum<{ en: "en"; zh: "zh"; }>; }, z.core.$strict>, z.ZodObject<{ kind: z.ZodLiteral<"routine">; routineId: z.ZodString; version: z.ZodNumber; hash: z.ZodString; }, z.core.$strict>, z.ZodObject<{ kind: z.ZodLiteral<"agent">; agentId: z.ZodOptional>, z.ZodTransform>>; instruction: z.ZodString; mcpSourceId: z.ZodOptional; workingDirectory: z.ZodOptional>, z.ZodTransform>>; model: z.ZodOptional>, z.ZodTransform>>; timeoutSeconds: z.ZodOptional; }, z.core.$strict>, z.ZodObject<{ kind: z.ZodLiteral<"task_command">; taskId: z.ZodString; command: z.ZodDiscriminatedUnion<[z.ZodObject<{ type: z.ZodLiteral<"retry_allocation">; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"move">; phase: z.ZodEnum<{ ready: "ready"; active: "active"; review: "review"; backlog: "backlog"; closed: "closed"; }>; resolution: z.ZodOptional>; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"mark_ready">; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"start">; executor: z.ZodDiscriminatedUnion<[z.ZodObject<{ kind: z.ZodLiteral<"agent">; agentId: z.ZodString; }, z.core.$strip>, z.ZodObject<{ kind: z.ZodLiteral<"human">; actorId: z.ZodString; }, z.core.$strip>, z.ZodObject<{ kind: z.ZodLiteral<"external">; provider: z.ZodString; config: z.ZodUnknown; }, z.core.$strip>], "kind">; scheduleAt: z.ZodOptional; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"request_review">; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"signoff">; resultId: z.ZodString; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"close">; resolution: z.ZodEnum<{ cancelled: "cancelled"; done: "done"; duplicate: "duplicate"; wont_do: "wont_do"; }>; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"reopen">; phase: z.ZodEnum<{ ready: "ready"; active: "active"; review: "review"; backlog: "backlog"; }>; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"add_wait">; wait: z.ZodObject<{ kind: z.ZodEnum<{ approval: "approval"; paused: "paused"; dependency: "dependency"; user_input: "user_input"; external_event: "external_event"; scheduled_time: "scheduled_time"; retry_backoff: "retry_backoff"; }>; reason: z.ZodString; condition: z.ZodDefault>; resumeAt: z.ZodOptional; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"resolve_wait">; waitId: z.ZodString; resolution: z.ZodOptional; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"revise_contract">; contract: z.ZodObject<{ objective: z.ZodString; expectedOutputs: z.ZodArray; acceptanceCriteria: z.ZodArray; constraints: z.ZodArray; approvalRequired: z.ZodArray; assumptions: z.ZodArray; risks: z.ZodArray; outputDestinations: z.ZodArray>; acceptancePolicy: z.ZodDefault>; }, z.core.$strip>; }, z.core.$strip>], "type">; }, z.core.$strict>, z.ZodObject<{ kind: z.ZodLiteral<"system">; capability: z.ZodEnum<{ "home.advisor.refresh": "home.advisor.refresh"; "proactivity.tick": "proactivity.tick"; "proactive.pulse.flush": "proactive.pulse.flush"; "memory.temporal_sweep": "memory.temporal_sweep"; "memory.daily_reconciliation": "memory.daily_reconciliation"; "memory.weekly_knowledge": "memory.weekly_knowledge"; }>; }, z.core.$strict>], "kind">; id: z.ZodOptional>, z.ZodTransform>>; description: z.ZodOptional; delivery: z.ZodDefault>; destinations: z.ZodDefault; }, z.core.$strict>, z.ZodObject<{ key: z.ZodString; kind: z.ZodLiteral<"weixin">; conversationId: z.ZodString; principalId: z.ZodString; }, z.core.$strict>, z.ZodObject<{ key: z.ZodString; kind: z.ZodLiteral<"webhook">; endpoint: z.ZodPipe>; secretId: z.ZodString; }, z.core.$strict>, z.ZodObject<{ key: z.ZodString; kind: z.ZodLiteral<"file">; targetId: z.ZodString; pathTemplate: z.ZodString; }, z.core.$strict>, z.ZodObject<{ key: z.ZodString; kind: z.ZodLiteral<"card">; channelId: z.ZodString; templateId: z.ZodString; }, z.core.$strict>], "kind">>>; }, z.core.$strict>>; safety: z.ZodOptional; }, z.core.$strict>>; conversationMode: z.ZodDefault>; reliability: z.ZodOptional; retryCount: z.ZodOptional; maxConcurrentRuns: z.ZodOptional; disableAfterConsecutiveFailures: z.ZodOptional; }, z.core.$strict>>; trigger: z.ZodUnion; }, z.core.$strict>, z.ZodObject<{ kind: z.ZodLiteral<"schedule">; schedule: z.ZodDiscriminatedUnion<[z.ZodObject<{ kind: z.ZodLiteral<"once">; at: z.ZodString; }, z.core.$strict>, z.ZodObject<{ kind: z.ZodLiteral<"interval">; everyMs: z.ZodNumber; anchorMs: z.ZodOptional; }, z.core.$strict>, z.ZodObject<{ kind: z.ZodLiteral<"cron">; expr: z.ZodString; tz: z.ZodOptional>, z.ZodTransform>>; }, z.core.$strict>], "kind">; }, z.core.$strict>, z.ZodObject<{ kind: z.ZodLiteral<"webhook">; secretId: z.ZodOptional>, z.ZodTransform>>; }, z.core.$strict>, z.ZodObject<{ kind: z.ZodLiteral<"event">; eventType: z.ZodString; source: z.ZodOptional>, z.ZodTransform>>; payloadMatch: z.ZodOptional>>; }, z.core.$strict>], "kind">, z.ZodObject<{ kind: z.ZodLiteral<"schedule">; schedule: z.ZodObject<{ kind: z.ZodLiteral<"once">; afterMs: z.ZodNumber; }, z.core.$strict>; }, z.core.$strict>]>; }, z.core.$strict>; }, z.core.$strict>, z.ZodObject<{ kind: z.ZodLiteral<"update">; id: z.ZodString; expectedRevision: z.ZodNumber; patch: z.ZodObject<{ trigger: z.ZodOptional; }, z.core.$strict>, z.ZodObject<{ kind: z.ZodLiteral<"schedule">; schedule: z.ZodDiscriminatedUnion<[z.ZodObject<{ kind: z.ZodLiteral<"once">; at: z.ZodString; }, z.core.$strict>, z.ZodObject<{ kind: z.ZodLiteral<"interval">; everyMs: z.ZodNumber; anchorMs: z.ZodOptional; }, z.core.$strict>, z.ZodObject<{ kind: z.ZodLiteral<"cron">; expr: z.ZodString; tz: z.ZodOptional>, z.ZodTransform>>; }, z.core.$strict>], "kind">; }, z.core.$strict>, z.ZodObject<{ kind: z.ZodLiteral<"webhook">; secretId: z.ZodOptional>, z.ZodTransform>>; }, z.core.$strict>, z.ZodObject<{ kind: z.ZodLiteral<"event">; eventType: z.ZodString; source: z.ZodOptional>, z.ZodTransform>>; payloadMatch: z.ZodOptional>>; }, z.core.$strict>], "kind">, z.ZodObject<{ kind: z.ZodLiteral<"schedule">; schedule: z.ZodObject<{ kind: z.ZodLiteral<"once">; afterMs: z.ZodNumber; }, z.core.$strict>; }, z.core.$strict>]>>; state: z.ZodOptional; management: z.ZodOptional; projectId: z.ZodOptional>, z.ZodTransform>>>; name: z.ZodOptional; enabled: z.ZodOptional; action: z.ZodOptional; conversationId: z.ZodString; agentId: z.ZodString; instruction: z.ZodString; locale: z.ZodEnum<{ en: "en"; zh: "zh"; }>; }, z.core.$strict>, z.ZodObject<{ kind: z.ZodLiteral<"routine">; routineId: z.ZodString; version: z.ZodNumber; hash: z.ZodString; }, z.core.$strict>, z.ZodObject<{ kind: z.ZodLiteral<"agent">; agentId: z.ZodOptional>, z.ZodTransform>>; instruction: z.ZodString; mcpSourceId: z.ZodOptional; workingDirectory: z.ZodOptional>, z.ZodTransform>>; model: z.ZodOptional>, z.ZodTransform>>; timeoutSeconds: z.ZodOptional; }, z.core.$strict>, z.ZodObject<{ kind: z.ZodLiteral<"task_command">; taskId: z.ZodString; command: z.ZodDiscriminatedUnion<[z.ZodObject<{ type: z.ZodLiteral<"retry_allocation">; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"move">; phase: z.ZodEnum<{ ready: "ready"; active: "active"; review: "review"; backlog: "backlog"; closed: "closed"; }>; resolution: z.ZodOptional>; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"mark_ready">; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"start">; executor: z.ZodDiscriminatedUnion<[z.ZodObject<{ kind: z.ZodLiteral<"agent">; agentId: z.ZodString; }, z.core.$strip>, z.ZodObject<{ kind: z.ZodLiteral<"human">; actorId: z.ZodString; }, z.core.$strip>, z.ZodObject<{ kind: z.ZodLiteral<"external">; provider: z.ZodString; config: z.ZodUnknown; }, z.core.$strip>], "kind">; scheduleAt: z.ZodOptional; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"request_review">; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"signoff">; resultId: z.ZodString; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"close">; resolution: z.ZodEnum<{ cancelled: "cancelled"; done: "done"; duplicate: "duplicate"; wont_do: "wont_do"; }>; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"reopen">; phase: z.ZodEnum<{ ready: "ready"; active: "active"; review: "review"; backlog: "backlog"; }>; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"add_wait">; wait: z.ZodObject<{ kind: z.ZodEnum<{ approval: "approval"; paused: "paused"; dependency: "dependency"; user_input: "user_input"; external_event: "external_event"; scheduled_time: "scheduled_time"; retry_backoff: "retry_backoff"; }>; reason: z.ZodString; condition: z.ZodDefault>; resumeAt: z.ZodOptional; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"resolve_wait">; waitId: z.ZodString; resolution: z.ZodOptional; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"revise_contract">; contract: z.ZodObject<{ objective: z.ZodString; expectedOutputs: z.ZodArray; acceptanceCriteria: z.ZodArray; constraints: z.ZodArray; approvalRequired: z.ZodArray; assumptions: z.ZodArray; risks: z.ZodArray; outputDestinations: z.ZodArray>; acceptancePolicy: z.ZodDefault>; }, z.core.$strip>; }, z.core.$strip>], "type">; }, z.core.$strict>, z.ZodObject<{ kind: z.ZodLiteral<"system">; capability: z.ZodEnum<{ "home.advisor.refresh": "home.advisor.refresh"; "proactivity.tick": "proactivity.tick"; "proactive.pulse.flush": "proactive.pulse.flush"; "memory.temporal_sweep": "memory.temporal_sweep"; "memory.daily_reconciliation": "memory.daily_reconciliation"; "memory.weekly_knowledge": "memory.weekly_knowledge"; }>; }, z.core.$strict>], "kind">>; description: z.ZodOptional>; safety: z.ZodOptional; }, z.core.$strict>>>; reliability: z.ZodOptional; retryCount: z.ZodOptional; maxConcurrentRuns: z.ZodOptional; disableAfterConsecutiveFailures: z.ZodOptional; }, z.core.$strict>>>; conversationMode: z.ZodOptional>; delivery: z.ZodOptional>; destinations: z.ZodDefault; }, z.core.$strict>, z.ZodObject<{ key: z.ZodString; kind: z.ZodLiteral<"weixin">; conversationId: z.ZodString; principalId: z.ZodString; }, z.core.$strict>, z.ZodObject<{ key: z.ZodString; kind: z.ZodLiteral<"webhook">; endpoint: z.ZodPipe>; secretId: z.ZodString; }, z.core.$strict>, z.ZodObject<{ key: z.ZodString; kind: z.ZodLiteral<"file">; targetId: z.ZodString; pathTemplate: z.ZodString; }, z.core.$strict>, z.ZodObject<{ key: z.ZodString; kind: z.ZodLiteral<"card">; channelId: z.ZodString; templateId: z.ZodString; }, z.core.$strict>], "kind">>>; }, z.core.$strict>>>; }, z.core.$strict>; }, z.core.$strict>], "kind">; declare const proposalResult: z.ZodObject<{ id: z.ZodUUID; status: z.ZodEnum<{ pending: "pending"; approved: "approved"; rejected: "rejected"; }>; createdAt: z.ZodNumber; expiresAt: z.ZodNumber; automationId: z.ZodOptional; }, z.core.$strip>; export type AutomationProposal = z.infer & { extensionId: string; manifestDigest: string; grantRevision: string; releaseId: string; digest: string; input: z.infer; decision?: { approve: boolean; enable: boolean; }; }; export declare function proposalDefinition(input: AutomationProposal['input']): { name: string; action: { kind: "assistant_task"; conversationId: string; agentId: string; instruction: string; locale: "en" | "zh"; } | { kind: "routine"; routineId: string; version: number; hash: string; } | { kind: "agent"; instruction: string; agentId?: string | undefined; mcpSourceId?: string | undefined; workingDirectory?: string | undefined; model?: string | undefined; timeoutSeconds?: number | undefined; } | { kind: "task_command"; taskId: string; command: { type: "retry_allocation"; } | { type: "move"; phase: "ready" | "active" | "review" | "backlog" | "closed"; resolution?: "cancelled" | "done" | "duplicate" | "wont_do" | undefined; } | { type: "mark_ready"; } | { type: "start"; executor: { kind: "agent"; agentId: string; } | { kind: "human"; actorId: string; } | { kind: "external"; provider: string; config: unknown; }; scheduleAt?: number | undefined; } | { type: "request_review"; } | { type: "signoff"; resultId: string; } | { type: "close"; resolution: "cancelled" | "done" | "duplicate" | "wont_do"; } | { type: "reopen"; phase: "ready" | "active" | "review" | "backlog"; } | { type: "add_wait"; wait: { kind: "approval" | "paused" | "dependency" | "user_input" | "external_event" | "scheduled_time" | "retry_backoff"; reason: string; condition: Record; resumeAt?: number | undefined; }; } | { type: "resolve_wait"; waitId: string; resolution?: unknown; } | { type: "revise_contract"; contract: { objective: string; expectedOutputs: string[]; acceptanceCriteria: string[]; constraints: string[]; approvalRequired: string[]; assumptions: string[]; risks: string[]; outputDestinations: Record[]; acceptancePolicy: "verified_auto" | "verified_then_review" | "manual"; }; }; } | { kind: "system"; capability: "home.advisor.refresh" | "proactivity.tick" | "proactive.pulse.flush" | "memory.temporal_sweep" | "memory.daily_reconciliation" | "memory.weekly_knowledge"; }; delivery: { notificationPolicy: "none" | "attention" | "all"; destinations: ({ key: string; kind: "gateway_event"; } | { key: string; kind: "weixin"; conversationId: string; principalId: string; } | { key: string; kind: "webhook"; endpoint: string; secretId: string; } | { key: string; kind: "file"; targetId: string; pathTemplate: string; } | { key: string; kind: "card"; channelId: string; templateId: string; })[]; }; trigger: { kind: "manual"; } | { kind: "schedule"; schedule: { kind: "once"; at: string; } | { kind: "interval"; everyMs: number; anchorMs?: number | undefined; } | { kind: "cron"; expr: string; tz?: string | undefined; }; } | { kind: "webhook"; secretId?: string | undefined; } | { kind: "event"; eventType: string; source?: string | undefined; payloadMatch?: Record | undefined; }; conversationMode: "new_session" | "continuous"; projectId?: string | undefined; description?: string | undefined; safety?: { mode: "suggest_only" | "ask_before_apply" | "auto_apply"; } | undefined; reliability?: { executionTimeoutSeconds?: number | undefined; retryCount?: number | undefined; maxConcurrentRuns?: number | undefined; disableAfterConsecutiveFailures?: number | undefined; } | undefined; management?: { owner: string; editable: ("enabled" | "trigger")[]; runnable: boolean; deletable: boolean; } | undefined; id?: string | undefined; enabled?: boolean | undefined; state?: { nextRunAtMs?: number | undefined; runningRunId?: string | undefined; lastRunAtMs?: number | undefined; lastRunStatus?: "queued" | "cancelled" | "failed" | "running" | "succeeded" | "cancelling" | "timeout" | undefined; lastError?: string | undefined; consecutiveFailures?: number | undefined; } | undefined; }; export declare function readAutomationProposal(extensionId: string, id: string): AutomationProposal; export declare function assertProposalCurrent(apps: Pick, proposal: AutomationProposal): void; export declare function registerAutomationProposalCapabilities(dispatcher: CapabilityDispatcher): void; export declare function automationProposalReview(proposal: AutomationProposal): { proposal: AutomationProposal; definition: { name: string; action: { kind: "assistant_task"; conversationId: string; agentId: string; instruction: string; locale: "en" | "zh"; } | { kind: "routine"; routineId: string; version: number; hash: string; } | { kind: "agent"; instruction: string; agentId?: string | undefined; mcpSourceId?: string | undefined; workingDirectory?: string | undefined; model?: string | undefined; timeoutSeconds?: number | undefined; } | { kind: "task_command"; taskId: string; command: { type: "retry_allocation"; } | { type: "move"; phase: "ready" | "active" | "review" | "backlog" | "closed"; resolution?: "cancelled" | "done" | "duplicate" | "wont_do" | undefined; } | { type: "mark_ready"; } | { type: "start"; executor: { kind: "agent"; agentId: string; } | { kind: "human"; actorId: string; } | { kind: "external"; provider: string; config: unknown; }; scheduleAt?: number | undefined; } | { type: "request_review"; } | { type: "signoff"; resultId: string; } | { type: "close"; resolution: "cancelled" | "done" | "duplicate" | "wont_do"; } | { type: "reopen"; phase: "ready" | "active" | "review" | "backlog"; } | { type: "add_wait"; wait: { kind: "approval" | "paused" | "dependency" | "user_input" | "external_event" | "scheduled_time" | "retry_backoff"; reason: string; condition: Record; resumeAt?: number | undefined; }; } | { type: "resolve_wait"; waitId: string; resolution?: unknown; } | { type: "revise_contract"; contract: { objective: string; expectedOutputs: string[]; acceptanceCriteria: string[]; constraints: string[]; approvalRequired: string[]; assumptions: string[]; risks: string[]; outputDestinations: Record[]; acceptancePolicy: "verified_auto" | "verified_then_review" | "manual"; }; }; } | { kind: "system"; capability: "home.advisor.refresh" | "proactivity.tick" | "proactive.pulse.flush" | "memory.temporal_sweep" | "memory.daily_reconciliation" | "memory.weekly_knowledge"; }; delivery: { notificationPolicy: "none" | "attention" | "all"; destinations: ({ key: string; kind: "gateway_event"; } | { key: string; kind: "weixin"; conversationId: string; principalId: string; } | { key: string; kind: "webhook"; endpoint: string; secretId: string; } | { key: string; kind: "file"; targetId: string; pathTemplate: string; } | { key: string; kind: "card"; channelId: string; templateId: string; })[]; }; trigger: { kind: "manual"; } | { kind: "schedule"; schedule: { kind: "once"; at: string; } | { kind: "interval"; everyMs: number; anchorMs?: number | undefined; } | { kind: "cron"; expr: string; tz?: string | undefined; }; } | { kind: "webhook"; secretId?: string | undefined; } | { kind: "event"; eventType: string; source?: string | undefined; payloadMatch?: Record | undefined; }; conversationMode: "new_session" | "continuous"; projectId?: string | undefined; description?: string | undefined; safety?: { mode: "suggest_only" | "ask_before_apply" | "auto_apply"; } | undefined; reliability?: { executionTimeoutSeconds?: number | undefined; retryCount?: number | undefined; maxConcurrentRuns?: number | undefined; disableAfterConsecutiveFailures?: number | undefined; } | undefined; management?: { owner: string; editable: ("enabled" | "trigger")[]; runnable: boolean; deletable: boolean; } | undefined; id?: string | undefined; enabled?: boolean | undefined; state?: { nextRunAtMs?: number | undefined; runningRunId?: string | undefined; lastRunAtMs?: number | undefined; lastRunStatus?: "queued" | "cancelled" | "failed" | "running" | "succeeded" | "cancelling" | "timeout" | undefined; lastError?: string | undefined; consecutiveFailures?: number | undefined; } | undefined; }; simulation: import("../automations/draft/automation-draft.types.js").AutomationSimulation; before: import("../automations/index.js").Automation | null | undefined; }; export declare function resolveAutomationProposal(apps: Pick, dispatcher: CapabilityDispatcher, extensionId: string, id: string, decision: { digest: string; approve: boolean; enable: boolean; }, caller: CapabilityContext): Promise<{ id: string; status: "pending" | "approved" | "rejected"; createdAt: number; expiresAt: number; automationId?: string | undefined; }>; export {};