import { z } from "zod"; import type { AuditEvent } from "./audit.js"; import { type ApprovalId, type GrantId } from "./ids.js"; import { type ApprovalRequest, type MintGrantInput } from "./grants.js"; import type { Principal } from "./principal.js"; import type { RunContext } from "./run-context.js"; import type { ToolCall, ToolDescriptor } from "./tools.js"; /** 05-guard §1 — what `status()` answers about how this deployment is guarded, * and the one field of `GET /status` a surface acts on (the no-policy notice). * Here rather than inline on `Guard.status()` so the door, the guard and the * client all name the same four values. */ export type GuardPosture = "unconfigured" | "rules" | "judge" | "rules+judge"; /** 01-core §6. `"org"` (build contract §9.10) is the org-admin policy layer's * strictness clamp: it appears on `ask` and `block` only, because org policy * TIGHTENS and never loosens — no run is ever decided BY it. `"frozen"` is the * guard's emergency stop, and blocks only: it refuses rather than parking, * because there is nothing for anyone to answer. */ export type GuardDecision = { action: "run"; decidedBy: "grant" | "rule" | "judge" | "default"; grantId?: GrantId; } | { action: "ask"; approval: ApprovalRequest; decidedBy: "confirmEach" | "rule" | "judge" | "breaker" | "default" | "org"; } | { action: "block"; reason: string; decidedBy: "rule" | "judge" | "breaker" | "denied" | "org" | "frozen"; }; /** 01-core §6 */ export declare const guardDecisionSchema: z.ZodDiscriminatedUnion<"action", [z.ZodObject<{ action: z.ZodLiteral<"run">; decidedBy: z.ZodEnum<["grant", "rule", "judge", "default"]>; grantId: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ action: z.ZodLiteral<"run">; decidedBy: z.ZodEnum<["grant", "rule", "judge", "default"]>; grantId: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ action: z.ZodLiteral<"run">; decidedBy: z.ZodEnum<["grant", "rule", "judge", "default"]>; grantId: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>, z.ZodObject<{ action: z.ZodLiteral<"ask">; approval: z.ZodObject<{ id: z.ZodString; call: z.ZodObject<{ id: z.ZodString; tool: z.ZodString; args: z.ZodType<{}, z.ZodTypeDef, {}>; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ id: z.ZodString; tool: z.ZodString; args: z.ZodType<{}, z.ZodTypeDef, {}>; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ id: z.ZodString; tool: z.ZodString; args: z.ZodType<{}, z.ZodTypeDef, {}>; }, z.ZodTypeAny, "passthrough">>; descriptor: z.ZodObject<{ name: z.ZodString; description: z.ZodString; inputSchema: z.ZodRecord; outputSchema: z.ZodOptional>; risk: z.ZodEnum<["read", "write", "destructive", "ungraded"]>; confirmEach: z.ZodOptional; title: z.ZodOptional; toolkit: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ name: z.ZodString; description: z.ZodString; inputSchema: z.ZodRecord; outputSchema: z.ZodOptional>; risk: z.ZodEnum<["read", "write", "destructive", "ungraded"]>; confirmEach: z.ZodOptional; title: z.ZodOptional; toolkit: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ name: z.ZodString; description: z.ZodString; inputSchema: z.ZodRecord; outputSchema: z.ZodOptional>; risk: z.ZodEnum<["read", "write", "destructive", "ungraded"]>; confirmEach: z.ZodOptional; title: z.ZodOptional; toolkit: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>; inputPreview: z.ZodString; powers: z.ZodOptional>; invalidatedGrant: z.ZodOptional, z.objectInputType<{ id: z.ZodString; grantedAt: z.ZodString; }, z.ZodTypeAny, "passthrough">>>; ctx: z.ZodObject<{ principal: z.ZodObject<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>; venue: z.ZodEnum<["chat", "app", "automation", "mcp"]>; presence: z.ZodEnum<["present", "away"]>; sessionId: z.ZodOptional; turnId: z.ZodOptional; agent: z.ZodOptional; appId: z.ZodOptional; trigger: z.ZodOptional; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ runId: z.ZodString; kind: z.ZodEnum<["schedule", "host-event", "external"]>; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ runId: z.ZodString; kind: z.ZodEnum<["schedule", "host-event", "external"]>; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>>; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ principal: z.ZodObject<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>; venue: z.ZodEnum<["chat", "app", "automation", "mcp"]>; presence: z.ZodEnum<["present", "away"]>; sessionId: z.ZodOptional; turnId: z.ZodOptional; agent: z.ZodOptional; appId: z.ZodOptional; trigger: z.ZodOptional; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ runId: z.ZodString; kind: z.ZodEnum<["schedule", "host-event", "external"]>; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ runId: z.ZodString; kind: z.ZodEnum<["schedule", "host-event", "external"]>; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>>; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ principal: z.ZodObject<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>; venue: z.ZodEnum<["chat", "app", "automation", "mcp"]>; presence: z.ZodEnum<["present", "away"]>; sessionId: z.ZodOptional; turnId: z.ZodOptional; agent: z.ZodOptional; appId: z.ZodOptional; trigger: z.ZodOptional; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ runId: z.ZodString; kind: z.ZodEnum<["schedule", "host-event", "external"]>; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ runId: z.ZodString; kind: z.ZodEnum<["schedule", "host-event", "external"]>; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>>; }, z.ZodTypeAny, "passthrough">>; createdAt: z.ZodString; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ id: z.ZodString; call: z.ZodObject<{ id: z.ZodString; tool: z.ZodString; args: z.ZodType<{}, z.ZodTypeDef, {}>; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ id: z.ZodString; tool: z.ZodString; args: z.ZodType<{}, z.ZodTypeDef, {}>; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ id: z.ZodString; tool: z.ZodString; args: z.ZodType<{}, z.ZodTypeDef, {}>; }, z.ZodTypeAny, "passthrough">>; descriptor: z.ZodObject<{ name: z.ZodString; description: z.ZodString; inputSchema: z.ZodRecord; outputSchema: z.ZodOptional>; risk: z.ZodEnum<["read", "write", "destructive", "ungraded"]>; confirmEach: z.ZodOptional; title: z.ZodOptional; toolkit: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ name: z.ZodString; description: z.ZodString; inputSchema: z.ZodRecord; outputSchema: z.ZodOptional>; risk: z.ZodEnum<["read", "write", "destructive", "ungraded"]>; confirmEach: z.ZodOptional; title: z.ZodOptional; toolkit: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ name: z.ZodString; description: z.ZodString; inputSchema: z.ZodRecord; outputSchema: z.ZodOptional>; risk: z.ZodEnum<["read", "write", "destructive", "ungraded"]>; confirmEach: z.ZodOptional; title: z.ZodOptional; toolkit: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>; inputPreview: z.ZodString; powers: z.ZodOptional>; invalidatedGrant: z.ZodOptional, z.objectInputType<{ id: z.ZodString; grantedAt: z.ZodString; }, z.ZodTypeAny, "passthrough">>>; ctx: z.ZodObject<{ principal: z.ZodObject<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>; venue: z.ZodEnum<["chat", "app", "automation", "mcp"]>; presence: z.ZodEnum<["present", "away"]>; sessionId: z.ZodOptional; turnId: z.ZodOptional; agent: z.ZodOptional; appId: z.ZodOptional; trigger: z.ZodOptional; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ runId: z.ZodString; kind: z.ZodEnum<["schedule", "host-event", "external"]>; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ runId: z.ZodString; kind: z.ZodEnum<["schedule", "host-event", "external"]>; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>>; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ principal: z.ZodObject<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>; venue: z.ZodEnum<["chat", "app", "automation", "mcp"]>; presence: z.ZodEnum<["present", "away"]>; sessionId: z.ZodOptional; turnId: z.ZodOptional; agent: z.ZodOptional; appId: z.ZodOptional; trigger: z.ZodOptional; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ runId: z.ZodString; kind: z.ZodEnum<["schedule", "host-event", "external"]>; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ runId: z.ZodString; kind: z.ZodEnum<["schedule", "host-event", "external"]>; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>>; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ principal: z.ZodObject<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>; venue: z.ZodEnum<["chat", "app", "automation", "mcp"]>; presence: z.ZodEnum<["present", "away"]>; sessionId: z.ZodOptional; turnId: z.ZodOptional; agent: z.ZodOptional; appId: z.ZodOptional; trigger: z.ZodOptional; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ runId: z.ZodString; kind: z.ZodEnum<["schedule", "host-event", "external"]>; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ runId: z.ZodString; kind: z.ZodEnum<["schedule", "host-event", "external"]>; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>>; }, z.ZodTypeAny, "passthrough">>; createdAt: z.ZodString; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ id: z.ZodString; call: z.ZodObject<{ id: z.ZodString; tool: z.ZodString; args: z.ZodType<{}, z.ZodTypeDef, {}>; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ id: z.ZodString; tool: z.ZodString; args: z.ZodType<{}, z.ZodTypeDef, {}>; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ id: z.ZodString; tool: z.ZodString; args: z.ZodType<{}, z.ZodTypeDef, {}>; }, z.ZodTypeAny, "passthrough">>; descriptor: z.ZodObject<{ name: z.ZodString; description: z.ZodString; inputSchema: z.ZodRecord; outputSchema: z.ZodOptional>; risk: z.ZodEnum<["read", "write", "destructive", "ungraded"]>; confirmEach: z.ZodOptional; title: z.ZodOptional; toolkit: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ name: z.ZodString; description: z.ZodString; inputSchema: z.ZodRecord; outputSchema: z.ZodOptional>; risk: z.ZodEnum<["read", "write", "destructive", "ungraded"]>; confirmEach: z.ZodOptional; title: z.ZodOptional; toolkit: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ name: z.ZodString; description: z.ZodString; inputSchema: z.ZodRecord; outputSchema: z.ZodOptional>; risk: z.ZodEnum<["read", "write", "destructive", "ungraded"]>; confirmEach: z.ZodOptional; title: z.ZodOptional; toolkit: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>; inputPreview: z.ZodString; powers: z.ZodOptional>; invalidatedGrant: z.ZodOptional, z.objectInputType<{ id: z.ZodString; grantedAt: z.ZodString; }, z.ZodTypeAny, "passthrough">>>; ctx: z.ZodObject<{ principal: z.ZodObject<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>; venue: z.ZodEnum<["chat", "app", "automation", "mcp"]>; presence: z.ZodEnum<["present", "away"]>; sessionId: z.ZodOptional; turnId: z.ZodOptional; agent: z.ZodOptional; appId: z.ZodOptional; trigger: z.ZodOptional; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ runId: z.ZodString; kind: z.ZodEnum<["schedule", "host-event", "external"]>; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ runId: z.ZodString; kind: z.ZodEnum<["schedule", "host-event", "external"]>; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>>; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ principal: z.ZodObject<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>; venue: z.ZodEnum<["chat", "app", "automation", "mcp"]>; presence: z.ZodEnum<["present", "away"]>; sessionId: z.ZodOptional; turnId: z.ZodOptional; agent: z.ZodOptional; appId: z.ZodOptional; trigger: z.ZodOptional; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ runId: z.ZodString; kind: z.ZodEnum<["schedule", "host-event", "external"]>; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ runId: z.ZodString; kind: z.ZodEnum<["schedule", "host-event", "external"]>; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>>; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ principal: z.ZodObject<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>; venue: z.ZodEnum<["chat", "app", "automation", "mcp"]>; presence: z.ZodEnum<["present", "away"]>; sessionId: z.ZodOptional; turnId: z.ZodOptional; agent: z.ZodOptional; appId: z.ZodOptional; trigger: z.ZodOptional; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ runId: z.ZodString; kind: z.ZodEnum<["schedule", "host-event", "external"]>; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ runId: z.ZodString; kind: z.ZodEnum<["schedule", "host-event", "external"]>; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>>; }, z.ZodTypeAny, "passthrough">>; createdAt: z.ZodString; }, z.ZodTypeAny, "passthrough">>; decidedBy: z.ZodEnum<["confirmEach", "rule", "judge", "breaker", "default", "org"]>; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ action: z.ZodLiteral<"ask">; approval: z.ZodObject<{ id: z.ZodString; call: z.ZodObject<{ id: z.ZodString; tool: z.ZodString; args: z.ZodType<{}, z.ZodTypeDef, {}>; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ id: z.ZodString; tool: z.ZodString; args: z.ZodType<{}, z.ZodTypeDef, {}>; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ id: z.ZodString; tool: z.ZodString; args: z.ZodType<{}, z.ZodTypeDef, {}>; }, z.ZodTypeAny, "passthrough">>; descriptor: z.ZodObject<{ name: z.ZodString; description: z.ZodString; inputSchema: z.ZodRecord; outputSchema: z.ZodOptional>; risk: z.ZodEnum<["read", "write", "destructive", "ungraded"]>; confirmEach: z.ZodOptional; title: z.ZodOptional; toolkit: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ name: z.ZodString; description: z.ZodString; inputSchema: z.ZodRecord; outputSchema: z.ZodOptional>; risk: z.ZodEnum<["read", "write", "destructive", "ungraded"]>; confirmEach: z.ZodOptional; title: z.ZodOptional; toolkit: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ name: z.ZodString; description: z.ZodString; inputSchema: z.ZodRecord; outputSchema: z.ZodOptional>; risk: z.ZodEnum<["read", "write", "destructive", "ungraded"]>; confirmEach: z.ZodOptional; title: z.ZodOptional; toolkit: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>; inputPreview: z.ZodString; powers: z.ZodOptional>; invalidatedGrant: z.ZodOptional, z.objectInputType<{ id: z.ZodString; grantedAt: z.ZodString; }, z.ZodTypeAny, "passthrough">>>; ctx: z.ZodObject<{ principal: z.ZodObject<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>; venue: z.ZodEnum<["chat", "app", "automation", "mcp"]>; presence: z.ZodEnum<["present", "away"]>; sessionId: z.ZodOptional; turnId: z.ZodOptional; agent: z.ZodOptional; appId: z.ZodOptional; trigger: z.ZodOptional; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ runId: z.ZodString; kind: z.ZodEnum<["schedule", "host-event", "external"]>; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ runId: z.ZodString; kind: z.ZodEnum<["schedule", "host-event", "external"]>; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>>; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ principal: z.ZodObject<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>; venue: z.ZodEnum<["chat", "app", "automation", "mcp"]>; presence: z.ZodEnum<["present", "away"]>; sessionId: z.ZodOptional; turnId: z.ZodOptional; agent: z.ZodOptional; appId: z.ZodOptional; trigger: z.ZodOptional; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ runId: z.ZodString; kind: z.ZodEnum<["schedule", "host-event", "external"]>; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ runId: z.ZodString; kind: z.ZodEnum<["schedule", "host-event", "external"]>; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>>; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ principal: z.ZodObject<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>; venue: z.ZodEnum<["chat", "app", "automation", "mcp"]>; presence: z.ZodEnum<["present", "away"]>; sessionId: z.ZodOptional; turnId: z.ZodOptional; agent: z.ZodOptional; appId: z.ZodOptional; trigger: z.ZodOptional; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ runId: z.ZodString; kind: z.ZodEnum<["schedule", "host-event", "external"]>; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ runId: z.ZodString; kind: z.ZodEnum<["schedule", "host-event", "external"]>; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>>; }, z.ZodTypeAny, "passthrough">>; createdAt: z.ZodString; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ id: z.ZodString; call: z.ZodObject<{ id: z.ZodString; tool: z.ZodString; args: z.ZodType<{}, z.ZodTypeDef, {}>; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ id: z.ZodString; tool: z.ZodString; args: z.ZodType<{}, z.ZodTypeDef, {}>; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ id: z.ZodString; tool: z.ZodString; args: z.ZodType<{}, z.ZodTypeDef, {}>; }, z.ZodTypeAny, "passthrough">>; descriptor: z.ZodObject<{ name: z.ZodString; description: z.ZodString; inputSchema: z.ZodRecord; outputSchema: z.ZodOptional>; risk: z.ZodEnum<["read", "write", "destructive", "ungraded"]>; confirmEach: z.ZodOptional; title: z.ZodOptional; toolkit: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ name: z.ZodString; description: z.ZodString; inputSchema: z.ZodRecord; outputSchema: z.ZodOptional>; risk: z.ZodEnum<["read", "write", "destructive", "ungraded"]>; confirmEach: z.ZodOptional; title: z.ZodOptional; toolkit: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ name: z.ZodString; description: z.ZodString; inputSchema: z.ZodRecord; outputSchema: z.ZodOptional>; risk: z.ZodEnum<["read", "write", "destructive", "ungraded"]>; confirmEach: z.ZodOptional; title: z.ZodOptional; toolkit: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>; inputPreview: z.ZodString; powers: z.ZodOptional>; invalidatedGrant: z.ZodOptional, z.objectInputType<{ id: z.ZodString; grantedAt: z.ZodString; }, z.ZodTypeAny, "passthrough">>>; ctx: z.ZodObject<{ principal: z.ZodObject<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>; venue: z.ZodEnum<["chat", "app", "automation", "mcp"]>; presence: z.ZodEnum<["present", "away"]>; sessionId: z.ZodOptional; turnId: z.ZodOptional; agent: z.ZodOptional; appId: z.ZodOptional; trigger: z.ZodOptional; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ runId: z.ZodString; kind: z.ZodEnum<["schedule", "host-event", "external"]>; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ runId: z.ZodString; kind: z.ZodEnum<["schedule", "host-event", "external"]>; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>>; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ principal: z.ZodObject<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>; venue: z.ZodEnum<["chat", "app", "automation", "mcp"]>; presence: z.ZodEnum<["present", "away"]>; sessionId: z.ZodOptional; turnId: z.ZodOptional; agent: z.ZodOptional; appId: z.ZodOptional; trigger: z.ZodOptional; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ runId: z.ZodString; kind: z.ZodEnum<["schedule", "host-event", "external"]>; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ runId: z.ZodString; kind: z.ZodEnum<["schedule", "host-event", "external"]>; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>>; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ principal: z.ZodObject<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>; venue: z.ZodEnum<["chat", "app", "automation", "mcp"]>; presence: z.ZodEnum<["present", "away"]>; sessionId: z.ZodOptional; turnId: z.ZodOptional; agent: z.ZodOptional; appId: z.ZodOptional; trigger: z.ZodOptional; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ runId: z.ZodString; kind: z.ZodEnum<["schedule", "host-event", "external"]>; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ runId: z.ZodString; kind: z.ZodEnum<["schedule", "host-event", "external"]>; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>>; }, z.ZodTypeAny, "passthrough">>; createdAt: z.ZodString; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ id: z.ZodString; call: z.ZodObject<{ id: z.ZodString; tool: z.ZodString; args: z.ZodType<{}, z.ZodTypeDef, {}>; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ id: z.ZodString; tool: z.ZodString; args: z.ZodType<{}, z.ZodTypeDef, {}>; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ id: z.ZodString; tool: z.ZodString; args: z.ZodType<{}, z.ZodTypeDef, {}>; }, z.ZodTypeAny, "passthrough">>; descriptor: z.ZodObject<{ name: z.ZodString; description: z.ZodString; inputSchema: z.ZodRecord; outputSchema: z.ZodOptional>; risk: z.ZodEnum<["read", "write", "destructive", "ungraded"]>; confirmEach: z.ZodOptional; title: z.ZodOptional; toolkit: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ name: z.ZodString; description: z.ZodString; inputSchema: z.ZodRecord; outputSchema: z.ZodOptional>; risk: z.ZodEnum<["read", "write", "destructive", "ungraded"]>; confirmEach: z.ZodOptional; title: z.ZodOptional; toolkit: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ name: z.ZodString; description: z.ZodString; inputSchema: z.ZodRecord; outputSchema: z.ZodOptional>; risk: z.ZodEnum<["read", "write", "destructive", "ungraded"]>; confirmEach: z.ZodOptional; title: z.ZodOptional; toolkit: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>; inputPreview: z.ZodString; powers: z.ZodOptional>; invalidatedGrant: z.ZodOptional, z.objectInputType<{ id: z.ZodString; grantedAt: z.ZodString; }, z.ZodTypeAny, "passthrough">>>; ctx: z.ZodObject<{ principal: z.ZodObject<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>; venue: z.ZodEnum<["chat", "app", "automation", "mcp"]>; presence: z.ZodEnum<["present", "away"]>; sessionId: z.ZodOptional; turnId: z.ZodOptional; agent: z.ZodOptional; appId: z.ZodOptional; trigger: z.ZodOptional; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ runId: z.ZodString; kind: z.ZodEnum<["schedule", "host-event", "external"]>; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ runId: z.ZodString; kind: z.ZodEnum<["schedule", "host-event", "external"]>; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>>; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ principal: z.ZodObject<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>; venue: z.ZodEnum<["chat", "app", "automation", "mcp"]>; presence: z.ZodEnum<["present", "away"]>; sessionId: z.ZodOptional; turnId: z.ZodOptional; agent: z.ZodOptional; appId: z.ZodOptional; trigger: z.ZodOptional; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ runId: z.ZodString; kind: z.ZodEnum<["schedule", "host-event", "external"]>; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ runId: z.ZodString; kind: z.ZodEnum<["schedule", "host-event", "external"]>; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>>; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ principal: z.ZodObject<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>; venue: z.ZodEnum<["chat", "app", "automation", "mcp"]>; presence: z.ZodEnum<["present", "away"]>; sessionId: z.ZodOptional; turnId: z.ZodOptional; agent: z.ZodOptional; appId: z.ZodOptional; trigger: z.ZodOptional; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ runId: z.ZodString; kind: z.ZodEnum<["schedule", "host-event", "external"]>; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ runId: z.ZodString; kind: z.ZodEnum<["schedule", "host-event", "external"]>; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>>; }, z.ZodTypeAny, "passthrough">>; createdAt: z.ZodString; }, z.ZodTypeAny, "passthrough">>; decidedBy: z.ZodEnum<["confirmEach", "rule", "judge", "breaker", "default", "org"]>; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ action: z.ZodLiteral<"ask">; approval: z.ZodObject<{ id: z.ZodString; call: z.ZodObject<{ id: z.ZodString; tool: z.ZodString; args: z.ZodType<{}, z.ZodTypeDef, {}>; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ id: z.ZodString; tool: z.ZodString; args: z.ZodType<{}, z.ZodTypeDef, {}>; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ id: z.ZodString; tool: z.ZodString; args: z.ZodType<{}, z.ZodTypeDef, {}>; }, z.ZodTypeAny, "passthrough">>; descriptor: z.ZodObject<{ name: z.ZodString; description: z.ZodString; inputSchema: z.ZodRecord; outputSchema: z.ZodOptional>; risk: z.ZodEnum<["read", "write", "destructive", "ungraded"]>; confirmEach: z.ZodOptional; title: z.ZodOptional; toolkit: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ name: z.ZodString; description: z.ZodString; inputSchema: z.ZodRecord; outputSchema: z.ZodOptional>; risk: z.ZodEnum<["read", "write", "destructive", "ungraded"]>; confirmEach: z.ZodOptional; title: z.ZodOptional; toolkit: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ name: z.ZodString; description: z.ZodString; inputSchema: z.ZodRecord; outputSchema: z.ZodOptional>; risk: z.ZodEnum<["read", "write", "destructive", "ungraded"]>; confirmEach: z.ZodOptional; title: z.ZodOptional; toolkit: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>; inputPreview: z.ZodString; powers: z.ZodOptional>; invalidatedGrant: z.ZodOptional, z.objectInputType<{ id: z.ZodString; grantedAt: z.ZodString; }, z.ZodTypeAny, "passthrough">>>; ctx: z.ZodObject<{ principal: z.ZodObject<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>; venue: z.ZodEnum<["chat", "app", "automation", "mcp"]>; presence: z.ZodEnum<["present", "away"]>; sessionId: z.ZodOptional; turnId: z.ZodOptional; agent: z.ZodOptional; appId: z.ZodOptional; trigger: z.ZodOptional; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ runId: z.ZodString; kind: z.ZodEnum<["schedule", "host-event", "external"]>; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ runId: z.ZodString; kind: z.ZodEnum<["schedule", "host-event", "external"]>; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>>; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ principal: z.ZodObject<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>; venue: z.ZodEnum<["chat", "app", "automation", "mcp"]>; presence: z.ZodEnum<["present", "away"]>; sessionId: z.ZodOptional; turnId: z.ZodOptional; agent: z.ZodOptional; appId: z.ZodOptional; trigger: z.ZodOptional; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ runId: z.ZodString; kind: z.ZodEnum<["schedule", "host-event", "external"]>; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ runId: z.ZodString; kind: z.ZodEnum<["schedule", "host-event", "external"]>; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>>; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ principal: z.ZodObject<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>; venue: z.ZodEnum<["chat", "app", "automation", "mcp"]>; presence: z.ZodEnum<["present", "away"]>; sessionId: z.ZodOptional; turnId: z.ZodOptional; agent: z.ZodOptional; appId: z.ZodOptional; trigger: z.ZodOptional; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ runId: z.ZodString; kind: z.ZodEnum<["schedule", "host-event", "external"]>; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ runId: z.ZodString; kind: z.ZodEnum<["schedule", "host-event", "external"]>; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>>; }, z.ZodTypeAny, "passthrough">>; createdAt: z.ZodString; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ id: z.ZodString; call: z.ZodObject<{ id: z.ZodString; tool: z.ZodString; args: z.ZodType<{}, z.ZodTypeDef, {}>; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ id: z.ZodString; tool: z.ZodString; args: z.ZodType<{}, z.ZodTypeDef, {}>; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ id: z.ZodString; tool: z.ZodString; args: z.ZodType<{}, z.ZodTypeDef, {}>; }, z.ZodTypeAny, "passthrough">>; descriptor: z.ZodObject<{ name: z.ZodString; description: z.ZodString; inputSchema: z.ZodRecord; outputSchema: z.ZodOptional>; risk: z.ZodEnum<["read", "write", "destructive", "ungraded"]>; confirmEach: z.ZodOptional; title: z.ZodOptional; toolkit: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ name: z.ZodString; description: z.ZodString; inputSchema: z.ZodRecord; outputSchema: z.ZodOptional>; risk: z.ZodEnum<["read", "write", "destructive", "ungraded"]>; confirmEach: z.ZodOptional; title: z.ZodOptional; toolkit: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ name: z.ZodString; description: z.ZodString; inputSchema: z.ZodRecord; outputSchema: z.ZodOptional>; risk: z.ZodEnum<["read", "write", "destructive", "ungraded"]>; confirmEach: z.ZodOptional; title: z.ZodOptional; toolkit: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>; inputPreview: z.ZodString; powers: z.ZodOptional>; invalidatedGrant: z.ZodOptional, z.objectInputType<{ id: z.ZodString; grantedAt: z.ZodString; }, z.ZodTypeAny, "passthrough">>>; ctx: z.ZodObject<{ principal: z.ZodObject<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>; venue: z.ZodEnum<["chat", "app", "automation", "mcp"]>; presence: z.ZodEnum<["present", "away"]>; sessionId: z.ZodOptional; turnId: z.ZodOptional; agent: z.ZodOptional; appId: z.ZodOptional; trigger: z.ZodOptional; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ runId: z.ZodString; kind: z.ZodEnum<["schedule", "host-event", "external"]>; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ runId: z.ZodString; kind: z.ZodEnum<["schedule", "host-event", "external"]>; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>>; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ principal: z.ZodObject<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>; venue: z.ZodEnum<["chat", "app", "automation", "mcp"]>; presence: z.ZodEnum<["present", "away"]>; sessionId: z.ZodOptional; turnId: z.ZodOptional; agent: z.ZodOptional; appId: z.ZodOptional; trigger: z.ZodOptional; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ runId: z.ZodString; kind: z.ZodEnum<["schedule", "host-event", "external"]>; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ runId: z.ZodString; kind: z.ZodEnum<["schedule", "host-event", "external"]>; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>>; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ principal: z.ZodObject<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>; venue: z.ZodEnum<["chat", "app", "automation", "mcp"]>; presence: z.ZodEnum<["present", "away"]>; sessionId: z.ZodOptional; turnId: z.ZodOptional; agent: z.ZodOptional; appId: z.ZodOptional; trigger: z.ZodOptional; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ runId: z.ZodString; kind: z.ZodEnum<["schedule", "host-event", "external"]>; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ runId: z.ZodString; kind: z.ZodEnum<["schedule", "host-event", "external"]>; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>>; }, z.ZodTypeAny, "passthrough">>; createdAt: z.ZodString; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ id: z.ZodString; call: z.ZodObject<{ id: z.ZodString; tool: z.ZodString; args: z.ZodType<{}, z.ZodTypeDef, {}>; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ id: z.ZodString; tool: z.ZodString; args: z.ZodType<{}, z.ZodTypeDef, {}>; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ id: z.ZodString; tool: z.ZodString; args: z.ZodType<{}, z.ZodTypeDef, {}>; }, z.ZodTypeAny, "passthrough">>; descriptor: z.ZodObject<{ name: z.ZodString; description: z.ZodString; inputSchema: z.ZodRecord; outputSchema: z.ZodOptional>; risk: z.ZodEnum<["read", "write", "destructive", "ungraded"]>; confirmEach: z.ZodOptional; title: z.ZodOptional; toolkit: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ name: z.ZodString; description: z.ZodString; inputSchema: z.ZodRecord; outputSchema: z.ZodOptional>; risk: z.ZodEnum<["read", "write", "destructive", "ungraded"]>; confirmEach: z.ZodOptional; title: z.ZodOptional; toolkit: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ name: z.ZodString; description: z.ZodString; inputSchema: z.ZodRecord; outputSchema: z.ZodOptional>; risk: z.ZodEnum<["read", "write", "destructive", "ungraded"]>; confirmEach: z.ZodOptional; title: z.ZodOptional; toolkit: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>; inputPreview: z.ZodString; powers: z.ZodOptional>; invalidatedGrant: z.ZodOptional, z.objectInputType<{ id: z.ZodString; grantedAt: z.ZodString; }, z.ZodTypeAny, "passthrough">>>; ctx: z.ZodObject<{ principal: z.ZodObject<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>; venue: z.ZodEnum<["chat", "app", "automation", "mcp"]>; presence: z.ZodEnum<["present", "away"]>; sessionId: z.ZodOptional; turnId: z.ZodOptional; agent: z.ZodOptional; appId: z.ZodOptional; trigger: z.ZodOptional; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ runId: z.ZodString; kind: z.ZodEnum<["schedule", "host-event", "external"]>; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ runId: z.ZodString; kind: z.ZodEnum<["schedule", "host-event", "external"]>; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>>; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ principal: z.ZodObject<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>; venue: z.ZodEnum<["chat", "app", "automation", "mcp"]>; presence: z.ZodEnum<["present", "away"]>; sessionId: z.ZodOptional; turnId: z.ZodOptional; agent: z.ZodOptional; appId: z.ZodOptional; trigger: z.ZodOptional; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ runId: z.ZodString; kind: z.ZodEnum<["schedule", "host-event", "external"]>; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ runId: z.ZodString; kind: z.ZodEnum<["schedule", "host-event", "external"]>; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>>; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ principal: z.ZodObject<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ kind: z.ZodEnum<["user", "org"]>; subject: z.ZodString; display: z.ZodOptional; ephemeral: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>; venue: z.ZodEnum<["chat", "app", "automation", "mcp"]>; presence: z.ZodEnum<["present", "away"]>; sessionId: z.ZodOptional; turnId: z.ZodOptional; agent: z.ZodOptional; appId: z.ZodOptional; trigger: z.ZodOptional; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ runId: z.ZodString; kind: z.ZodEnum<["schedule", "host-event", "external"]>; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ runId: z.ZodString; kind: z.ZodEnum<["schedule", "host-event", "external"]>; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>>; }, z.ZodTypeAny, "passthrough">>; createdAt: z.ZodString; }, z.ZodTypeAny, "passthrough">>; decidedBy: z.ZodEnum<["confirmEach", "rule", "judge", "breaker", "default", "org"]>; }, z.ZodTypeAny, "passthrough">>, z.ZodObject<{ action: z.ZodLiteral<"block">; reason: z.ZodString; decidedBy: z.ZodEnum<["rule", "judge", "breaker", "denied", "org", "frozen"]>; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ action: z.ZodLiteral<"block">; reason: z.ZodString; decidedBy: z.ZodEnum<["rule", "judge", "breaker", "denied", "org", "frozen"]>; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ action: z.ZodLiteral<"block">; reason: z.ZodString; decidedBy: z.ZodEnum<["rule", "judge", "breaker", "denied", "org", "frozen"]>; }, z.ZodTypeAny, "passthrough">>]>; /** Agents spec (existing-package changes) — the minimal seam a runtime * requires of its guard. `check` is the law: every tool call passes through * it and comes back run / ask / block. Audit reporting and the * approval-decision subscription are optional, feature-detected extras. * `Guard` below extends it, so every full guard (the guard package's * VendoGuard included) already satisfies it. */ export interface GuardLike { check(call: ToolCall, descriptor: ToolDescriptor, ctx: RunContext): Promise; report?(event: AuditEvent): Promise; onApprovalDecision?(cb: (id: ApprovalId, approved: boolean) => void): () => void; /** The park-side mirror of `onApprovalDecision`: fires when a check parks an * approval, with the persisted request. Optional — required on the guard * package's VendoGuard — because existing implementations predate it; * callers feature-detect. */ onApprovalRequested?(cb: (request: ApprovalRequest) => void): () => void; } /** 01-core §6 — `GuardLike`'s seam plus `directions`, with the two optional * members a full guard must actually have narrowed to required. `check` and * `onApprovalRequested` are inherited verbatim. */ export interface Guard extends GuardLike { report(event: AuditEvent): Promise; directions(ctx: RunContext): Promise; onApprovalDecision(cb: (id: ApprovalId, approved: boolean) => void): () => void; /** AGENT-6 (wave 5, optional — 01 §6 amendment parked): resolve approvals * the conversation abandoned (a fresh user turn superseded an undecided * ask). Implementations deny them — subject-scoped to `ctx.principal`, * idempotent, never minting a grant — so the pending queue tracks the * thread instead of accreting forever. Callers feature-detect. */ abandonApprovals?(ids: ApprovalId[], ctx: RunContext): Promise; /** Spend an approval's single use WITHOUT replaying its call (optional — 05 §2 * amendment). A yes is normally spent by the call it authorized, but the * automations engine spends one by arming the app-bound standing grant its * consent moment asked for (07 §3), and that spend has to contend with the * replay and with `approvals.revoke` on the SAME one-time transition — * otherwise a take-back and a grant mint can both "win". Answers what the * caller got: `spent` (go ahead), `already-spent` (someone else did), or * `taken-back` (the person revoked it — grant nothing). Callers * feature-detect; a guard that omits it is used exactly as before. */ spendApproval?(id: ApprovalId, principal: Principal): Promise<"spent" | "already-spent" | "taken-back">; /** Mint the grant a decided approval turns into (optional — same * feature-detected shape as `spendApproval`). The guard's own decide path * mints through this, and so does the automations engine's consent moment, * so there is ONE implementation of what a remembered yes becomes rather * than one per caller. A guard that omits it leaves the caller writing the * row itself, from the same `buildGrant`. */ mintGrant?(input: MintGrantInput): Promise; /** genqa defect 1 (double-count) — a preview of `check()`'s verdict for a * caller that is about to make (or ask the AI SDK to make) the REAL, * dispatching call itself moments later for the SAME logical call: a * "run" verdict here never spends the write-budget/call-rate breakers, * because the follow-up call does. An "ask"/"block" verdict parks/audits * exactly as `check()` does — for those outcomes this IS the only * evaluation that ever runs (the agent bridge's `needsApproval` hook is * the one caller today; packages/agent tools.ts). Callers feature-detect; * a guard that omits it is used exactly as `check()` always was. */ previewCheck?(call: ToolCall, descriptor: ToolDescriptor, ctx: RunContext): Promise; /** * What the host POLICY alone says about this call — its ordered rules, then * `policy.code`, then the guard's own default posture — with NO grant lookup, * no judge, no breaker spend, no parked approval, and no audit row. Nothing * about asking it changes any state, which is what separates it from * `previewCheck`: an "ask" there PARKS a real approval, so it cannot be used * to ask a hypothetical question. * * ONE caller (07 §3): the automations engine asking, about the AUTHORING call * that armed an automation, "was a person actually asked about this?". A call * the policy would ASK about can only have reached the engine by being * approved — the guard does not let an unanswered ask through — and that yes is * what licenses minting the automation's standing powers on the spot instead of * asking again per tool. A call the policy RUNS was never put to anybody, so * nothing may be minted off it. * * The judge is deliberately NOT consulted: it is a per-call judgment with a * model behind it, and the question here is about the host's stated posture, not * about one call's circumstances. * * Callers feature-detect. A guard without it is read as "nobody was asked", * which is the conservative answer — the powers fall back to being captured as * pending asks, exactly as they were before this existed. */ policyOutcome?(call: ToolCall, descriptor: ToolDescriptor, ctx: RunContext): Promise; }