export type AgentTickConfig = { server: string; token: string; }; export type QuestionOption = { title: string; description?: string; flags?: string[]; }; export type AskResponse = | { kind: "selection"; selections: string[]; comment?: string } | { kind: "freeform"; text: string }; export type AgentTickChoice = { id: string; label: string; description?: string; kind?: string; flags?: string[]; tags?: string[]; }; export type AgentTickChoiceInteractionMode = "click-to-submit" | "select-then-submit"; export type AgentTickOptionPlacement = "sticky-bottom" | "inline-after-content"; export type AgentTickConfirmBeforeSubmit = "never" | "always"; export type AgentTickPresentation = { choiceInteractionMode: AgentTickChoiceInteractionMode; optionPlacement: AgentTickOptionPlacement; confirmBeforeSubmit: AgentTickConfirmBeforeSubmit; }; export type AgentTickQuestion = { header?: string; question: string; options: Array<{ label: string; description?: string }>; multiSelect: boolean; }; export type AgentTickRequester = { name: string; agentId?: string; host?: string; workingDirectory?: string; projectName?: string; projectId?: string; clientName?: string; }; export type AgentTickSessionMetadata = { title?: string; label?: string; }; export type AgentTickActivitySession = { sessionId?: string; session?: AgentTickSessionMetadata; }; export type CreateApprovalRequestInput = { requester?: AgentTickRequester; sessionId?: string; session?: AgentTickSessionMetadata; requestType: "steering" | "sanction" | "questionnaire" | "steer" | "approval"; title: string; body?: string; choices?: AgentTickChoice[]; questions?: AgentTickQuestion[]; allowFreeformReply?: boolean; command?: string; metadata?: Record; }; export type CreateApprovalRequestResult = { id: string; waiterToken?: string; waiterId?: string; }; export type RequestWaiterStopReason = "responded" | "local_answer" | "agent_cancelled" | "shutdown" | "resolved"; export type AgentTickApprovalResponse = { requestId?: string; choiceId?: string; choiceIds?: string[]; message?: string; status?: string; state?: string; cancelled?: boolean; denied?: boolean; answers?: Record; response?: { choiceId?: string; choiceIds?: string[]; message?: string; answers?: Record; }; terminal?: boolean; }; export type StatusState = "working" | "waiting" | "blocked" | "done" | "failed"; export type ContextUsage = { tokens: number | null; contextWindow: number; percent: number | null; }; export type PrivateStatusUpdatePayload = { version: 1; algorithm: "aes-256-gcm"; nonce: string; ciphertext: string; tag: string; aad?: string; keyEnvelopes: Array<{ deviceKeyId: string; algorithm: "p256-ecdh-hkdf-sha256+aes-256-gcm"; ephemeralPublicKey: string; nonce: string; ciphertext: string; tag: string; }>; }; export type PrivateToolActivityPayload = PrivateStatusUpdatePayload; export type CreateStatusUpdateInput = { threadId?: string; sessionId?: string; session?: AgentTickSessionMetadata; message: string; state: StatusState; nextStep?: string; host?: string; workingDirectory?: string; projectName?: string; clientName?: string; metadata?: Record; contentMode?: "plain" | "private"; encryptedPayload?: PrivateStatusUpdatePayload; privateRecipientVersion?: string; contextUsage?: ContextUsage; }; export type StatusMessageMirrorConfig = { enabled: boolean; contentMode: "private" | "plain"; sendAssistant: "final-only" | "every-message" | "off"; sendUser: boolean; includeToolUseTurns: boolean; includeThinking: boolean; maxBodyChars: number; previewMaxChars: number; collapsedByDefault: boolean; includeContextUsage: boolean; }; export type CreateToolActivityInput = { threadId?: string; sessionId?: string; turnId?: string; toolCallId?: string; toolName: string; state: "started" | "finished"; outcome?: "success" | "failed" | "cancelled"; summary?: string; metadata?: Record; contentMode?: "plain" | "private"; encryptedPayload?: PrivateToolActivityPayload; privateRecipientVersion?: string; startedAt?: string; finishedAt?: string; }; export type ToolActivityVisibility = "off" | "names" | "summaries" | "details"; export type StatusToolActivityConfig = { enabled: boolean; visibility: ToolActivityVisibility; detailContentMode: "private"; maxDetailChars: number; }; export type StatusMessageStrategy = "none" | "task-summary" | string; export type StatusHookConfig = { send: boolean; state: StatusState; message: StatusMessageStrategy; }; export type StatusHeartbeatConfig = { enabled: boolean; intervalMs: number; message: StatusMessageStrategy; }; export type StatusConfig = { enabled: boolean; includeTaskSummary: boolean; taskSummaryMaxChars: number; heartbeat: StatusHeartbeatConfig; hooks: Record; messageMirroring: StatusMessageMirrorConfig; toolActivity: StatusToolActivityConfig; }; export type SanctionPolicy = "allow-by-default" | "approve-by-default"; export type CommandDisclosurePolicy = "never" | "safe-only" | "always"; export type CommandRuleConfig = { enabled: boolean; command?: string; commandRegex?: string; argsRegex?: string; rawRegex?: string; riskClass?: string; reason?: string; }; export type ToolSanctionConfig = { enabled: boolean; parseShell: boolean; allow: Record; deny: Record; }; export type SanctionApprovalConfig = { local: boolean; remote: boolean; timeoutMs: number; discloseCommand: CommandDisclosurePolicy; }; export type SanctionsConfig = { enabled: boolean; policy: SanctionPolicy; tools: Record; approval: SanctionApprovalConfig; }; export type AgentTickExtensionConfig = { status: StatusConfig; sanctions: SanctionsConfig; }; export type ShellCommandUnit = { raw: string; command?: string; args: string[]; argsText: string; envAssignments?: Record; redirections?: string[]; source: "simple" | "pipeline" | "subshell" | "wrapper" | "substitution" | "fallback"; }; export type SanctionMatch = { ruleId?: string; decision: "allow" | "deny" | "default-approval"; riskClass?: string; reason: string; unit: ShellCommandUnit; }; export type SanctionClassification = { needsApproval: boolean; policy: SanctionPolicy; matches: SanctionMatch[]; riskClass?: string; reason?: string; };