@vellumai/plugin-api 0.8.10-dev.202606111255.73ec993

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.d.ts +4738 -0
  2. package/index.js +6 -0
  3. package/package.json +31 -0
package/index.d.ts ADDED
@@ -0,0 +1,4738 @@
1
+ import { z } from 'zod';
2
+
3
+ declare type _AcpServerMessages = AcpSessionSpawned | AcpSessionUpdate | AcpSessionCompleted | AcpSessionError;
4
+
5
+ declare interface AcpSessionCompleted {
6
+ type: "acp_session_completed";
7
+ acpSessionId: string;
8
+ stopReason: "end_turn" | "max_tokens" | "max_turn_requests" | "refusal" | "cancelled";
9
+ }
10
+
11
+ declare interface AcpSessionError {
12
+ type: "acp_session_error";
13
+ acpSessionId: string;
14
+ error: string;
15
+ }
16
+
17
+ declare interface AcpSessionSpawned {
18
+ type: "acp_session_spawned";
19
+ acpSessionId: string;
20
+ agent: string;
21
+ parentConversationId: string;
22
+ }
23
+
24
+ declare interface AcpSessionUpdate {
25
+ type: "acp_session_update";
26
+ acpSessionId: string;
27
+ updateType: "agent_message_chunk" | "agent_thought_chunk" | "user_message_chunk" | "tool_call" | "tool_call_update" | "plan";
28
+ content?: string;
29
+ toolCallId?: string;
30
+ toolTitle?: string;
31
+ toolKind?: string;
32
+ toolStatus?: string;
33
+ }
34
+
35
+ /**
36
+ * Why an agent turn reached a terminal state. Supplied to the `stop` hook via
37
+ * {@link StopContext.exitReason} and emitted on the `agent_loop_exit` event,
38
+ * then persisted onto the final `llm_request_logs` row of the turn (rows from
39
+ * intermediate turns keep a NULL reason, which is how downstream tooling and
40
+ * the LLM Context Inspector tell "loop kept going" from "loop is done").
41
+ *
42
+ * Values are stable wire/DB strings — they are written to SQLite and surfaced
43
+ * over the inspector wire format, so renaming any of them is a breaking change.
44
+ */
45
+ export declare type AgentLoopExitReason =
46
+ /** User cancellation observed before the turn's next provider call. */
47
+ "aborted_pre_call"
48
+ /** Assistant message had no tool-use blocks (or no tool executor). */
49
+ | "no_tool_calls"
50
+ /** User cancellation observed while building the tool-results message. */
51
+ | "aborted_post_response"
52
+ /** User cancellation observed mid-tool-execution; completed results kept. */
53
+ | "aborted_during_tools"
54
+ /** A tool result requested handing back to the user. */
55
+ | "yield_to_user"
56
+ /** The orchestrator yielded at a checkpoint to process a queued message. */
57
+ | "checkpoint_handoff"
58
+ /** Context-window recovery exhausted and the turn ended with an error. */
59
+ | "context_too_large"
60
+ /**
61
+ * An auto-compress rerun (post-emergency-compaction, post-tier reducer)
62
+ * still yielded at the mid-loop budget checkpoint — the turn terminated with
63
+ * no further recovery layer to re-enter. A pure observability signal so the
64
+ * silent stall is attributable instead of leaving the exit reason NULL.
65
+ */
66
+ | "budget_yield_unrecovered"
67
+ /** Provider stopped because the configured output-token limit was reached. */
68
+ | "max_tokens_reached"
69
+ /** User cancellation landed after a non-terminal checkpoint yield. */
70
+ | "aborted_after_checkpoint"
71
+ /** User cancellation observed while the catch handler synthesized an error turn. */
72
+ | "aborted_via_error"
73
+ /** An unhandled error ended the turn. */
74
+ | "error";
75
+
76
+ declare interface AllowlistOption {
77
+ label: string;
78
+ description: string;
79
+ pattern: string;
80
+ }
81
+
82
+ declare interface AppDataResponse {
83
+ type: "app_data_response";
84
+ surfaceId: string;
85
+ callId: string;
86
+ success: boolean;
87
+ result?: unknown;
88
+ error?: string;
89
+ }
90
+
91
+ declare interface AppDeleteResponse {
92
+ type: "app_delete_response";
93
+ success: boolean;
94
+ }
95
+
96
+ declare interface AppDiffResponse {
97
+ type: "app_diff_response";
98
+ appId: string;
99
+ diff: string;
100
+ }
101
+
102
+ declare interface AppFileAtVersionResponse {
103
+ type: "app_file_at_version_response";
104
+ appId: string;
105
+ path: string;
106
+ content: string;
107
+ }
108
+
109
+ declare interface AppFilesChanged {
110
+ type: "app_files_changed";
111
+ appId: string;
112
+ }
113
+
114
+ declare interface AppHistoryResponse {
115
+ type: "app_history_response";
116
+ appId: string;
117
+ versions: Array<{
118
+ commitHash: string;
119
+ message: string;
120
+ timestamp: number;
121
+ }>;
122
+ }
123
+
124
+ declare interface AppPreviewResponse {
125
+ type: "app_preview_response";
126
+ appId: string;
127
+ preview?: string;
128
+ }
129
+
130
+ declare interface AppRestoreResponse {
131
+ type: "app_restore_response";
132
+ success: boolean;
133
+ error?: string;
134
+ }
135
+
136
+ declare type ApprovalRequired = z.infer<typeof ApprovalRequiredSchema>;
137
+
138
+ declare const ApprovalRequiredSchema: z.ZodObject<{
139
+ proposal: z.ZodDiscriminatedUnion<[z.ZodObject<{
140
+ type: z.ZodLiteral<"http">;
141
+ credentialHandle: z.ZodString;
142
+ method: z.ZodString;
143
+ url: z.ZodString;
144
+ purpose: z.ZodString;
145
+ allowedUrlPatterns: z.ZodOptional<z.ZodArray<z.ZodString>>;
146
+ }, z.core.$strip>, z.ZodObject<{
147
+ type: z.ZodLiteral<"command">;
148
+ credentialHandle: z.ZodString;
149
+ command: z.ZodString;
150
+ purpose: z.ZodString;
151
+ allowedCommandPatterns: z.ZodOptional<z.ZodArray<z.ZodString>>;
152
+ }, z.core.$strip>], "type">;
153
+ proposalHash: z.ZodString;
154
+ renderedProposal: z.ZodString;
155
+ sessionId: z.ZodString;
156
+ conversationId: z.ZodOptional<z.ZodString>;
157
+ }, z.core.$strip>;
158
+
159
+ declare interface AppsListResponse {
160
+ type: "apps_list_response";
161
+ apps: Array<{
162
+ id: string;
163
+ name: string;
164
+ description?: string;
165
+ icon?: string;
166
+ preview?: string;
167
+ createdAt: number;
168
+ version?: string;
169
+ contentId?: string;
170
+ }>;
171
+ }
172
+
173
+ declare type _AppsServerMessages = AppDataResponse | AppsListResponse | SharedAppsListResponse | AppDeleteResponse | SharedAppDeleteResponse | ForkSharedAppResponse | BundleAppResponse | OpenBundleResponse | SignBundlePayloadRequest | GetSigningIdentityRequest | ShareAppCloudResponse | AppHistoryResponse | AppDiffResponse | AppFileAtVersionResponse | AppRestoreResponse | AppUpdatePreviewResponse | AppPreviewResponse | PublishPageResponse | UnpublishPageResponse | AppFilesChanged;
174
+
175
+ declare interface AppUpdatePreviewResponse {
176
+ type: "app_update_preview_response";
177
+ success: boolean;
178
+ appId: string;
179
+ }
180
+
181
+ declare type AssistantActivityStateEvent = z.infer<typeof AssistantActivityStateEventSchema>;
182
+
183
+ declare const AssistantActivityStateEventSchema: z.ZodObject<{
184
+ type: z.ZodLiteral<"assistant_activity_state">;
185
+ conversationId: z.ZodString;
186
+ activityVersion: z.ZodNumber;
187
+ phase: z.ZodEnum<{
188
+ thinking: "thinking";
189
+ idle: "idle";
190
+ streaming: "streaming";
191
+ tool_running: "tool_running";
192
+ awaiting_confirmation: "awaiting_confirmation";
193
+ }>;
194
+ anchor: z.ZodEnum<{
195
+ assistant_turn: "assistant_turn";
196
+ user_turn: "user_turn";
197
+ global: "global";
198
+ }>;
199
+ reason: z.ZodEnum<{
200
+ thinking_delta: "thinking_delta";
201
+ generation_cancelled: "generation_cancelled";
202
+ message_dequeued: "message_dequeued";
203
+ first_text_delta: "first_text_delta";
204
+ tool_use_start: "tool_use_start";
205
+ preview_start: "preview_start";
206
+ tool_result_received: "tool_result_received";
207
+ confirmation_requested: "confirmation_requested";
208
+ confirmation_resolved: "confirmation_resolved";
209
+ context_compacting: "context_compacting";
210
+ message_complete: "message_complete";
211
+ error_terminal: "error_terminal";
212
+ }>;
213
+ requestId: z.ZodOptional<z.ZodString>;
214
+ statusText: z.ZodOptional<z.ZodString>;
215
+ }, z.core.$strip>;
216
+
217
+ /** Attention state metadata for a conversation's latest assistant message. */
218
+ declare interface AssistantAttention {
219
+ hasUnseenLatestAssistantMessage: boolean;
220
+ latestAssistantMessageAt?: number;
221
+ lastSeenAssistantMessageAt?: number;
222
+ lastSeenConfidence?: string;
223
+ lastSeenSignalType?: string;
224
+ }
225
+
226
+ /** Daemon-side specialization of the generic event envelope. */
227
+ export declare type AssistantEvent = AssistantEvent_2<ServerMessage>;
228
+
229
+ /**
230
+ * Assistant Events -- shared types and SSE framing helpers.
231
+ *
232
+ * This module is intentionally free of imports from `assistant/` or any
233
+ * other repo-local module so it can be consumed by both the daemon and
234
+ * isolated skill processes without circular references.
235
+ *
236
+ * The `AssistantEvent` interface is generic over the `message` payload so
237
+ * the neutral package does not need to know about the daemon-side
238
+ * `ServerMessage` discriminated union. Consumers that want narrower
239
+ * typing can re-export a specialized alias, e.g.:
240
+ *
241
+ * type AssistantEvent = BaseAssistantEvent<ServerMessage>;
242
+ */
243
+ /**
244
+ * A single assistant event wrapping an outbound message payload.
245
+ *
246
+ * Generic over the payload type so the neutral package has zero dependency
247
+ * on daemon-side message schemas. The `TMessage` default of `unknown`
248
+ * keeps the package importable without a type argument when the caller
249
+ * does not care about message narrowing.
250
+ */
251
+ declare interface AssistantEvent_2<TMessage = unknown> {
252
+ /** Globally unique event identifier (UUID). */
253
+ id: string;
254
+ /** Resolved conversation id when available. */
255
+ conversationId?: string;
256
+ /**
257
+ * Monotonic per-conversation sequence number. Assigned by the daemon at
258
+ * publish time for conversation-scoped events; absent for unscoped
259
+ * broadcasts. Clients track the highest observed `seq` per conversation
260
+ * and pass it back on reconnect to request replay of missed events.
261
+ */
262
+ seq?: number;
263
+ /** ISO-8601 timestamp of when the event was emitted. */
264
+ emittedAt: string;
265
+ /** Outbound message payload. */
266
+ message: TMessage;
267
+ }
268
+
269
+ export declare type AssistantEventCallback = (event: AssistantEvent) => void | Promise<void>;
270
+
271
+ /** Filter that determines which events a subscriber receives. */
272
+ export declare type AssistantEventFilter = {
273
+ /** When set, restrict delivery to events for this conversation. */
274
+ conversationId?: string;
275
+ };
276
+
277
+ /**
278
+ * Lightweight pub/sub hub for `AssistantEvent` messages.
279
+ *
280
+ * Filtering is applied at subscription level:
281
+ * - `conversationId`: scoped events match subscribers with same conversationId
282
+ * or no conversationId filter (broadcast to all).
283
+ * - `targetCapability` (on publish): targeted events only reach subscribers
284
+ * whose capabilities include the target. Untargeted events fan out to all.
285
+ *
286
+ * Client connections register as subscribers with metadata and are queryable
287
+ * via `listClients()`, `getMostRecentClientByCapability()`, etc.
288
+ */
289
+ export declare class AssistantEventHub {
290
+ private readonly subscribers;
291
+ private readonly maxSubscribers;
292
+ /** Monotonic source for per-connection ids, scoped to this hub. */
293
+ private connectionCounter;
294
+ constructor(options?: {
295
+ maxSubscribers?: number;
296
+ });
297
+ /**
298
+ * Register a subscriber that will be called for each matching event.
299
+ *
300
+ * **Client deduplication:** When a client subscriber is registered with a
301
+ * `clientId` that already exists, all stale entries for that clientId are
302
+ * disposed first. This prevents subscriber stacking when clients reconnect
303
+ * (e.g. Chrome extension reload, SSE token refresh) before the old
304
+ * connection's abort signal fires.
305
+ *
306
+ * When the subscriber cap (`maxSubscribers`) has been reached, the **oldest**
307
+ * subscriber is evicted to make room: its `onEvict` callback is invoked (so
308
+ * it can close its SSE stream) and its entry is removed from the hub.
309
+ */
310
+ subscribe(subscriber: SubscriberInput): AssistantEventSubscription;
311
+ /**
312
+ * Publish an event to all matching subscribers.
313
+ *
314
+ * Matching rules:
315
+ * - if `excludeClientId` is set, the subscriber with that clientId is
316
+ * skipped regardless of every other rule (self-echo suppression — the
317
+ * client that originated the mutation does not receive its own
318
+ * invalidation back through the hub).
319
+ * - if `targetClientId` is set, deliver only to the subscriber with that
320
+ * clientId, bypassing the conversation-id filter entirely (the web-origin
321
+ * event's conversationId differs from the macOS client's subscribed
322
+ * conversation).
323
+ * - if `filter.conversationId` is set (and `targetClientId` is not), the
324
+ * `event.conversationId` must equal it
325
+ * - if `targetCapability` is set, only subscribers whose capabilities include
326
+ * it receive the event; untargeted events go to all
327
+ * - if `targetInterfaceId` is set, only client subscribers whose
328
+ * `interfaceId` matches receive the event; process subscribers and
329
+ * non-matching clients are skipped. Used to narrow legacy
330
+ * broadcasts (e.g. `conversation_list_invalidated`) to a specific
331
+ * client surface during a migration window.
332
+ *
333
+ * Fanout is isolated: a throwing or rejecting subscriber does not abort
334
+ * delivery to remaining subscribers.
335
+ */
336
+ publish(event: AssistantEvent, options?: {
337
+ targetCapability?: HostProxyCapability;
338
+ targetClientId?: string;
339
+ targetInterfaceId?: InterfaceId;
340
+ /**
341
+ * Skip the subscriber with this `clientId`. Used for self-echo
342
+ * suppression on `sync_changed`: the route handler echoes the
343
+ * originating tab's `X-Vellum-Client-Id` back on the event, and the
344
+ * hub uses it here to avoid re-delivering the invalidation to the
345
+ * tab that already mutated its own optimistic state.
346
+ */
347
+ excludeClientId?: string;
348
+ }): Promise<void>;
349
+ /**
350
+ * Return the active client subscriber with the given clientId, or
351
+ * `undefined` if no such subscriber exists.
352
+ */
353
+ getClientById(clientId: string): ClientEntry | undefined;
354
+ /**
355
+ * Return the verified actor principal id captured at SSE subscription time
356
+ * for the given client, or `undefined` if the client is unknown or
357
+ * connected without a principal (e.g. legacy/service tokens).
358
+ *
359
+ * Used by host proxies to bind cross-client targeted execution to the same
360
+ * authenticated user identity that opened the target client's SSE stream.
361
+ */
362
+ getActorPrincipalIdForClient(clientId: string): string | undefined;
363
+ /**
364
+ * Returns true when at least one active subscriber would receive the given
365
+ * event based on the same conversation matching rules as publish().
366
+ */
367
+ hasSubscribersForEvent(event: Pick<AssistantEvent, "conversationId">): boolean;
368
+ private clientEntries;
369
+ /**
370
+ * Return all active client subscribers, sorted by `lastActiveAt` descending.
371
+ */
372
+ listClients(): ClientEntry[];
373
+ /**
374
+ * Return all client subscribers that support the given capability,
375
+ * sorted by `lastActiveAt` descending.
376
+ */
377
+ listClientsByCapability(capability: HostProxyCapability): ClientEntry[];
378
+ /**
379
+ * Return the most recently active client that supports the given
380
+ * capability, or `undefined` if none exists.
381
+ */
382
+ getMostRecentClientByCapability(capability: HostProxyCapability): ClientEntry | undefined;
383
+ /**
384
+ * Return all client subscribers with the given interface type,
385
+ * sorted by `lastActiveAt` descending.
386
+ */
387
+ listClientsByInterface(interfaceId: InterfaceId): ClientEntry[];
388
+ /**
389
+ * Touch a client subscriber — update `lastActiveAt`. Used by heartbeat.
390
+ */
391
+ touchClient(clientId: string): void;
392
+ /**
393
+ * Force-disconnect a client by disposing all subscribers for the given
394
+ * `clientId`. Returns the number of disposed entries.
395
+ *
396
+ * Used by `assistant clients disconnect <clientId>` to forcibly remove
397
+ * stale or unwanted client connections.
398
+ */
399
+ disposeClient(clientId: string): number;
400
+ /** Number of currently active subscribers (useful for tests and caps). */
401
+ subscriberCount(): number;
402
+ /** Returns true if the hub can accept a subscriber without evicting anyone. */
403
+ hasCapacity(): boolean;
404
+ }
405
+
406
+ /**
407
+ * Singleton hub shared across the entire runtime process.
408
+ *
409
+ * Import and use this in daemon send paths and the SSE route.
410
+ */
411
+ export declare const assistantEventHub: AssistantEventHub;
412
+
413
+ /** Opaque handle returned by `subscribe`. Call `dispose()` to remove the subscription. */
414
+ export declare interface AssistantEventSubscription {
415
+ dispose(): void;
416
+ /** True until `dispose()` has been called. */
417
+ readonly active: boolean;
418
+ /**
419
+ * Per-connection identifier, unique within the hub instance. Distinguishes
420
+ * connections that share a `clientId` (e.g. an old connection and the new
421
+ * one that replaced it on reconnect) so subscribe / dispose / shed log
422
+ * lines can be attributed to a specific connection.
423
+ */
424
+ readonly connectionId: string;
425
+ }
426
+
427
+ declare interface AssistantInboxEscalationResponse {
428
+ type: "assistant_inbox_escalation_response";
429
+ success: boolean;
430
+ error?: string;
431
+ /** List of escalations (returned on list). */
432
+ escalations?: Array<{
433
+ id: string;
434
+ runId: string;
435
+ conversationId: string;
436
+ channel: string;
437
+ requesterExternalUserId: string;
438
+ requesterChatId: string;
439
+ status: string;
440
+ requestSummary?: string;
441
+ createdAt: number;
442
+ }>;
443
+ /** Decision result (returned on decide). */
444
+ decision?: {
445
+ id: string;
446
+ status: string;
447
+ decidedAt: number;
448
+ };
449
+ }
450
+
451
+ declare interface AssistantStatusMessage {
452
+ type: "assistant_status";
453
+ version?: string;
454
+ keyFingerprint?: string;
455
+ }
456
+
457
+ declare type AssistantTextDeltaEvent = z.infer<typeof AssistantTextDeltaEventSchema>;
458
+
459
+ declare const AssistantTextDeltaEventSchema: z.ZodObject<{
460
+ type: z.ZodLiteral<"assistant_text_delta">;
461
+ text: z.ZodString;
462
+ messageId: z.ZodOptional<z.ZodString>;
463
+ conversationId: z.ZodOptional<z.ZodString>;
464
+ }, z.core.$strip>;
465
+
466
+ declare interface AssistantThinkingDelta {
467
+ type: "assistant_thinking_delta";
468
+ thinking: string;
469
+ conversationId?: string;
470
+ /** Database ID of the assistant message this thinking delta belongs to.
471
+ * Same semantics as `AssistantTextDeltaEvent.messageId`. */
472
+ messageId?: string;
473
+ }
474
+
475
+ declare type AssistantTurnStartEvent = z.infer<typeof AssistantTurnStartEventSchema>;
476
+
477
+ declare const AssistantTurnStartEventSchema: z.ZodObject<{
478
+ type: z.ZodLiteral<"assistant_turn_start">;
479
+ messageId: z.ZodString;
480
+ conversationId: z.ZodOptional<z.ZodString>;
481
+ }, z.core.$strip>;
482
+
483
+ declare interface AuthResult {
484
+ type: "auth_result";
485
+ success: boolean;
486
+ message?: string;
487
+ }
488
+
489
+ declare type AvatarUpdatedEvent = z.infer<typeof AvatarUpdatedEventSchema>;
490
+
491
+ declare const AvatarUpdatedEventSchema: z.ZodObject<{
492
+ type: z.ZodLiteral<"avatar_updated">;
493
+ avatarPath: z.ZodString;
494
+ }, z.core.$strip>;
495
+
496
+ declare interface BaseSubscriberEntry {
497
+ filter: AssistantEventFilter;
498
+ callback: AssistantEventCallback;
499
+ active: boolean;
500
+ onEvict: () => void;
501
+ connectedAt: Date;
502
+ lastActiveAt: Date;
503
+ /**
504
+ * Per-connection identifier, unique within the hub instance. Two entries
505
+ * with the same `clientId` (old vs reconnected connection) get distinct
506
+ * connection ids, making them traceable across subscribe / dispose / shed
507
+ * logs.
508
+ */
509
+ connectionId: string;
510
+ }
511
+
512
+ declare interface BookmarkCreated {
513
+ type: "bookmark.created";
514
+ bookmark: BookmarkSummary;
515
+ }
516
+
517
+ declare interface BookmarkDeleted {
518
+ type: "bookmark.deleted";
519
+ messageId: string;
520
+ }
521
+
522
+ declare type _BookmarksServerMessages = BookmarkCreated | BookmarkDeleted;
523
+
524
+ /**
525
+ * Wire-shape representation of a bookmark, joined with the bookmarked
526
+ * message and its parent conversation. Mirrors
527
+ * `clients/shared/Network/BookmarkSummary.swift` — dates are emitted as
528
+ * unix-millisecond integers, and the message preview is capped to keep
529
+ * the list payload bounded.
530
+ */
531
+ declare interface BookmarkSummary {
532
+ id: string;
533
+ messageId: string;
534
+ conversationId: string;
535
+ conversationTitle: string | null;
536
+ messagePreview: string;
537
+ /** "user" | "assistant" — kept as a free-form string so it round-trips raw. */
538
+ messageRole: string;
539
+ /** Unix milliseconds. */
540
+ messageCreatedAt: number;
541
+ /** Unix milliseconds. */
542
+ createdAt: number;
543
+ }
544
+
545
+ declare interface BundleAppResponse {
546
+ type: "bundle_app_response";
547
+ bundlePath: string;
548
+ /** Base64-encoded PNG of the generated app icon, if available. */
549
+ iconImageBase64?: string;
550
+ manifest: {
551
+ format_version: number;
552
+ name: string;
553
+ description?: string;
554
+ icon?: string;
555
+ created_at: string;
556
+ created_by: string;
557
+ entry: string;
558
+ capabilities: string[];
559
+ version?: string;
560
+ content_id?: string;
561
+ };
562
+ }
563
+
564
+ declare interface CardSurfaceData {
565
+ title: string;
566
+ subtitle?: string;
567
+ body: string;
568
+ metadata?: Array<{
569
+ label: string;
570
+ value: string;
571
+ }>;
572
+ /** Optional template name for specialized rendering (e.g. "weather_forecast"). */
573
+ template?: string;
574
+ /** Arbitrary data consumed by the template renderer. Shape depends on template. */
575
+ templateData?: Record<string, unknown>;
576
+ }
577
+
578
+ declare const CHANNEL_IDS: readonly ["telegram", "phone", "vellum", "whatsapp", "slack", "email", "platform", "a2a"];
579
+
580
+ /** Channel binding metadata exposed in conversation list APIs. */
581
+ declare interface ChannelBinding {
582
+ sourceChannel: ChannelId;
583
+ externalChatId: string;
584
+ externalChatName?: string | null;
585
+ externalThreadId?: string | null;
586
+ externalUserId?: string | null;
587
+ displayName?: string | null;
588
+ username?: string | null;
589
+ slackThread?: {
590
+ channelId: string;
591
+ threadTs: string;
592
+ link?: {
593
+ appUrl?: string;
594
+ webUrl?: string;
595
+ };
596
+ };
597
+ slackChannel?: {
598
+ channelId: string;
599
+ name?: string;
600
+ link?: {
601
+ webUrl?: string;
602
+ };
603
+ };
604
+ }
605
+
606
+ declare type ChannelId = (typeof CHANNEL_IDS)[number];
607
+
608
+ declare interface ChannelVerificationSessionResponse {
609
+ type: "channel_verification_session_response";
610
+ success: boolean;
611
+ secret?: string;
612
+ instruction?: string;
613
+ /** Present when action is 'status'. */
614
+ bound?: boolean;
615
+ guardianExternalUserId?: string;
616
+ /** The channel this status pertains to (e.g. "telegram", "phone"). Present when action is 'status'. */
617
+ channel?: ChannelId;
618
+ /** The assistant ID scoped to this status. Present when action is 'status'. */
619
+ assistantId?: string;
620
+ /** The delivery chat ID for the guardian (e.g. Telegram chat ID). Present when action is 'status' and bound is true. */
621
+ guardianDeliveryChatId?: string;
622
+ /** Optional channel username/handle for the bound guardian (for UI display). */
623
+ guardianUsername?: string;
624
+ /** Optional display name for the bound guardian (for UI display). */
625
+ guardianDisplayName?: string;
626
+ /** Whether a pending verification challenge exists for this (assistantId, channel). Used by relay setup to detect active voice verification sessions. */
627
+ hasPendingChallenge?: boolean;
628
+ error?: string;
629
+ /** Human-readable error detail (e.g. for already_bound failures). */
630
+ message?: string;
631
+ /** Conversation ID for outbound verification flows. */
632
+ verificationSessionId?: string;
633
+ /** Epoch ms when the verification session expires. */
634
+ expiresAt?: number;
635
+ /** Epoch ms after which a resend is allowed. */
636
+ nextResendAt?: number;
637
+ /** Number of sends for this session. */
638
+ sendCount?: number;
639
+ /** Telegram deep-link URL for bootstrap (M3 placeholder). */
640
+ telegramBootstrapUrl?: string;
641
+ /** True when the outbound session is still in pending_bootstrap state (Telegram handle flow). Prevents the client from clearing the bootstrap URL during status polling. */
642
+ pendingBootstrap?: boolean;
643
+ }
644
+
645
+ declare interface ChoiceOption {
646
+ id: string;
647
+ title: string;
648
+ description?: string;
649
+ /** Visually highlight this option as the assistant's recommendation. */
650
+ recommended?: boolean;
651
+ /** Optional structured payload returned with this choice. */
652
+ data?: Record<string, unknown>;
653
+ }
654
+
655
+ declare interface ChoiceSurfaceData {
656
+ description?: string;
657
+ options: ChoiceOption[];
658
+ selectionMode?: "single" | "multiple";
659
+ /**
660
+ * When true, clicking an option submits it immediately. Defaults to true for
661
+ * single-select choice surfaces.
662
+ */
663
+ commitOnSelect?: boolean;
664
+ submitLabel?: string;
665
+ }
666
+
667
+ declare interface ClawhubSlimSkill extends SlimSkillBase {
668
+ origin: "clawhub";
669
+ slug: string;
670
+ author: string;
671
+ stars: number;
672
+ installs: number;
673
+ reports: number;
674
+ publishedAt?: string;
675
+ version: string;
676
+ }
677
+
678
+ declare interface ClientEntry extends BaseSubscriberEntry {
679
+ type: "client";
680
+ clientId: string;
681
+ interfaceId: InterfaceId;
682
+ capabilities: HostProxyCapability[];
683
+ machineName?: string;
684
+ /**
685
+ * The verified actor principal id (canonical user identity, parsed from JWT
686
+ * `sub`) of the user that opened this SSE connection, when available.
687
+ *
688
+ * Populated from `AuthContext.actorPrincipalId` at SSE subscription time.
689
+ * Used by host proxies to gate cross-client targeted execution to the same
690
+ * authenticated user identity. May be `undefined` for legacy or
691
+ * service-token connections that have no principal.
692
+ */
693
+ actorPrincipalId?: string;
694
+ }
695
+
696
+ /** Sent by the daemon to update a client-side setting (e.g. activation key). */
697
+ declare interface ClientSettingsUpdate {
698
+ type: "client_settings_update";
699
+ /** The setting key to update (e.g. "activationKey"). */
700
+ key: string;
701
+ /** The new value for the setting. */
702
+ value: string;
703
+ }
704
+
705
+ declare type CompactionCircuitClosedEvent = z.infer<typeof CompactionCircuitClosedEventSchema>;
706
+
707
+ declare const CompactionCircuitClosedEventSchema: z.ZodObject<{
708
+ type: z.ZodLiteral<"compaction_circuit_closed">;
709
+ conversationId: z.ZodString;
710
+ }, z.core.$strip>;
711
+
712
+ declare type CompactionCircuitOpenEvent = z.infer<typeof CompactionCircuitOpenEventSchema>;
713
+
714
+ declare const CompactionCircuitOpenEventSchema: z.ZodObject<{
715
+ type: z.ZodLiteral<"compaction_circuit_open">;
716
+ conversationId: z.ZodString;
717
+ reason: z.ZodLiteral<"3_consecutive_failures">;
718
+ openUntil: z.ZodNumber;
719
+ }, z.core.$strip>;
720
+
721
+ declare type _ComputerUseServerMessages = RecordingStart | RecordingStop | RecordingPause | RecordingResume;
722
+
723
+ /** Sent by the daemon when workspace config.json changes on disk. */
724
+ declare interface ConfigChanged {
725
+ type: "config_changed";
726
+ }
727
+
728
+ declare type ConfirmationRequestEvent = z.infer<typeof ConfirmationRequestEventSchema>;
729
+
730
+ declare const ConfirmationRequestEventSchema: z.ZodObject<{
731
+ type: z.ZodLiteral<"confirmation_request">;
732
+ requestId: z.ZodString;
733
+ toolName: z.ZodString;
734
+ input: z.ZodRecord<z.ZodString, z.ZodUnknown>;
735
+ riskLevel: z.ZodString;
736
+ riskReason: z.ZodOptional<z.ZodString>;
737
+ isContainerized: z.ZodOptional<z.ZodBoolean>;
738
+ executionTarget: z.ZodOptional<z.ZodEnum<{
739
+ sandbox: "sandbox";
740
+ host: "host";
741
+ }>>;
742
+ allowlistOptions: z.ZodArray<z.ZodObject<{
743
+ label: z.ZodString;
744
+ description: z.ZodString;
745
+ pattern: z.ZodString;
746
+ }, z.core.$strip>>;
747
+ scopeOptions: z.ZodArray<z.ZodObject<{
748
+ label: z.ZodString;
749
+ scope: z.ZodString;
750
+ }, z.core.$strip>>;
751
+ directoryScopeOptions: z.ZodOptional<z.ZodArray<z.ZodObject<{
752
+ label: z.ZodString;
753
+ scope: z.ZodString;
754
+ }, z.core.$strip>>>;
755
+ diff: z.ZodOptional<z.ZodObject<{
756
+ filePath: z.ZodString;
757
+ oldContent: z.ZodString;
758
+ newContent: z.ZodString;
759
+ isNewFile: z.ZodBoolean;
760
+ }, z.core.$strip>>;
761
+ conversationId: z.ZodOptional<z.ZodString>;
762
+ persistentDecisionsAllowed: z.ZodOptional<z.ZodBoolean>;
763
+ toolUseId: z.ZodOptional<z.ZodString>;
764
+ acpToolKind: z.ZodOptional<z.ZodString>;
765
+ acpOptions: z.ZodOptional<z.ZodArray<z.ZodObject<{
766
+ optionId: z.ZodString;
767
+ name: z.ZodString;
768
+ kind: z.ZodEnum<{
769
+ allow_once: "allow_once";
770
+ allow_always: "allow_always";
771
+ reject_once: "reject_once";
772
+ reject_always: "reject_always";
773
+ }>;
774
+ }, z.core.$strip>>>;
775
+ }, z.core.$strip>;
776
+
777
+ /**
778
+ * Authoritative per-request confirmation state transition emitted by the daemon.
779
+ *
780
+ * The client must use this event (not local phrase inference) to update
781
+ * confirmation bubble state.
782
+ */
783
+ declare interface ConfirmationStateChanged {
784
+ type: "confirmation_state_changed";
785
+ conversationId: string;
786
+ requestId: string;
787
+ state: "pending" | "approved" | "denied" | "timed_out" | "resolved_stale";
788
+ source: "button" | "inline_nl" | "auto_deny" | "timeout" | "system";
789
+ /** requestId of the user message that triggered this transition. */
790
+ causedByRequestId?: string;
791
+ /** Normalized user text for analytics/debug (e.g. "approve", "deny"). */
792
+ decisionText?: string;
793
+ /** The tool_use block ID this confirmation applies to, for disambiguating parallel tool calls. */
794
+ toolUseId?: string;
795
+ }
796
+
797
+ declare interface ConfirmationSurfaceData {
798
+ message: string;
799
+ detail?: string;
800
+ confirmLabel?: string;
801
+ confirmedLabel?: string;
802
+ cancelLabel?: string;
803
+ destructive?: boolean;
804
+ }
805
+
806
+ declare interface ContactChannelPayload {
807
+ id: string;
808
+ type: string;
809
+ address: string;
810
+ isPrimary: boolean;
811
+ externalUserId?: string;
812
+ status: string;
813
+ policy: string;
814
+ verifiedAt?: number;
815
+ verifiedVia?: string;
816
+ lastSeenAt?: number;
817
+ interactionCount?: number;
818
+ lastInteraction?: number;
819
+ revokedReason?: string;
820
+ blockedReason?: string;
821
+ }
822
+
823
+ declare interface ContactPayload {
824
+ id: string;
825
+ displayName: string;
826
+ role: "guardian" | "contact";
827
+ notes?: string;
828
+ contactType?: string;
829
+ lastInteraction?: number;
830
+ interactionCount: number;
831
+ channels: ContactChannelPayload[];
832
+ }
833
+
834
+ declare type ContactRequestEvent = z.infer<typeof ContactRequestEventSchema>;
835
+
836
+ declare const ContactRequestEventSchema: z.ZodObject<{
837
+ type: z.ZodLiteral<"contact_request">;
838
+ requestId: z.ZodString;
839
+ channel: z.ZodOptional<z.ZodString>;
840
+ placeholder: z.ZodOptional<z.ZodString>;
841
+ label: z.ZodOptional<z.ZodString>;
842
+ description: z.ZodOptional<z.ZodString>;
843
+ role: z.ZodOptional<z.ZodString>;
844
+ }, z.core.$strip>;
845
+
846
+ /** Server push — lightweight invalidation signal: the contacts table has been mutated, refetch your list. */
847
+ declare interface ContactsChanged {
848
+ type: "contacts_changed";
849
+ }
850
+
851
+ declare interface ContactsInviteResponse {
852
+ type: "contacts_invite_response";
853
+ success: boolean;
854
+ error?: string;
855
+ /** Single invite (returned on create/revoke). Token field is only present on create. */
856
+ invite?: {
857
+ id: string;
858
+ sourceChannel: string;
859
+ token?: string;
860
+ tokenHash: string;
861
+ maxUses: number;
862
+ useCount: number;
863
+ expiresAt: number | null;
864
+ status: string;
865
+ note?: string;
866
+ createdAt: number;
867
+ };
868
+ /** List of invites (returned on list). */
869
+ invites?: Array<{
870
+ id: string;
871
+ sourceChannel: string;
872
+ tokenHash: string;
873
+ maxUses: number;
874
+ useCount: number;
875
+ expiresAt: number | null;
876
+ status: string;
877
+ note?: string;
878
+ createdAt: number;
879
+ }>;
880
+ }
881
+
882
+ declare interface ContactsResponse {
883
+ type: "contacts_response";
884
+ success: boolean;
885
+ error?: string;
886
+ contact?: ContactPayload;
887
+ contacts?: ContactPayload[];
888
+ }
889
+
890
+ declare type _ContactsServerMessages = ContactsResponse | ContactsChanged | ContactRequestEvent;
891
+
892
+ export declare type ContentBlock = TextContent | ThinkingContent | RedactedThinkingContent | ImageContent | FileContent | ToolUseContent | ToolResultContent | ServerToolUseContent | WebSearchToolResultContent;
893
+
894
+ /**
895
+ * Emitted after a compaction turn completes (both auto-compaction and
896
+ * `/compact`). Carries the fresh `estimatedInputTokens` so clients can refresh
897
+ * the context-window indicator without waiting for the next `usage_update`.
898
+ *
899
+ * Scoped per-conversation — see `CompactionCircuitOpenEvent` doc for why.
900
+ */
901
+ declare interface ContextCompacted {
902
+ type: "context_compacted";
903
+ conversationId: string;
904
+ previousEstimatedInputTokens: number;
905
+ estimatedInputTokens: number;
906
+ maxInputTokens: number;
907
+ thresholdTokens: number;
908
+ compactedMessages: number;
909
+ summaryCalls: number;
910
+ summaryInputTokens: number;
911
+ summaryOutputTokens: number;
912
+ summaryModel: string;
913
+ /**
914
+ * Quality signals for the generated summary. Emitted for every
915
+ * compaction (including truncation-only paths where the summary text
916
+ * is unchanged from the prior pass). Consumers can use these to detect
917
+ * regressions without needing to read the summary text itself.
918
+ *
919
+ * - `summaryCharCount`: length of the produced summary text.
920
+ * - `summaryHeaderCount`: number of `## ` section headers in the summary.
921
+ * - `summaryHadMemoryEcho`: `true` if the summary contains any runtime
922
+ * injection tag (e.g. `<memory`, `<turn_context>`, `<workspace>`).
923
+ * Should always be `false` — `true` indicates the compaction strip
924
+ * logic failed to remove an injected block from the summarizer input.
925
+ */
926
+ summaryCharCount?: number;
927
+ summaryHeaderCount?: number;
928
+ summaryHadMemoryEcho?: boolean;
929
+ }
930
+
931
+ declare type ConversationErrorEvent = z.infer<typeof ConversationErrorEventSchema>;
932
+
933
+ declare const ConversationErrorEventSchema: z.ZodObject<{
934
+ type: z.ZodLiteral<"conversation_error">;
935
+ conversationId: z.ZodString;
936
+ code: z.ZodEnum<{
937
+ PROVIDER_NETWORK: "PROVIDER_NETWORK";
938
+ PROVIDER_RATE_LIMIT: "PROVIDER_RATE_LIMIT";
939
+ MANAGED_USAGE_LIMIT: "MANAGED_USAGE_LIMIT";
940
+ PROVIDER_OVERLOADED: "PROVIDER_OVERLOADED";
941
+ PROVIDER_API: "PROVIDER_API";
942
+ IMAGE_TOO_LARGE: "IMAGE_TOO_LARGE";
943
+ PROVIDER_BILLING: "PROVIDER_BILLING";
944
+ PROVIDER_ORDERING: "PROVIDER_ORDERING";
945
+ PROVIDER_WEB_SEARCH: "PROVIDER_WEB_SEARCH";
946
+ PROVIDER_NOT_CONFIGURED: "PROVIDER_NOT_CONFIGURED";
947
+ PROVIDER_INVALID_KEY: "PROVIDER_INVALID_KEY";
948
+ MANAGED_KEY_INVALID: "MANAGED_KEY_INVALID";
949
+ CONTEXT_TOO_LARGE: "CONTEXT_TOO_LARGE";
950
+ BUDGET_YIELD_UNRECOVERED: "BUDGET_YIELD_UNRECOVERED";
951
+ MAX_TOKENS_REACHED: "MAX_TOKENS_REACHED";
952
+ CONVERSATION_ABORTED: "CONVERSATION_ABORTED";
953
+ CONVERSATION_PROCESSING_FAILED: "CONVERSATION_PROCESSING_FAILED";
954
+ DISK_SPACE_CRITICAL: "DISK_SPACE_CRITICAL";
955
+ REGENERATE_FAILED: "REGENERATE_FAILED";
956
+ UNKNOWN: "UNKNOWN";
957
+ }>;
958
+ userMessage: z.ZodString;
959
+ retryable: z.ZodBoolean;
960
+ debugDetails: z.ZodOptional<z.ZodString>;
961
+ errorCategory: z.ZodOptional<z.ZodString>;
962
+ connectionName: z.ZodOptional<z.ZodString>;
963
+ profileName: z.ZodOptional<z.ZodString>;
964
+ }, z.core.$strip>;
965
+
966
+ declare interface ConversationForkParent {
967
+ conversationId: string;
968
+ messageId: string;
969
+ title: string;
970
+ }
971
+
972
+ /**
973
+ * Broadcast to clients when a conversation's inference-profile override
974
+ * changes. `profile` is the profile name (a key in `llm.profiles`) or
975
+ * `null` when the override is cleared and the conversation falls back to
976
+ * the workspace `llm.activeProfile` resolution.
977
+ */
978
+ declare interface ConversationInferenceProfileUpdated {
979
+ type: "conversation_inference_profile_updated";
980
+ conversationId: string;
981
+ profile: string | null;
982
+ sessionId?: string | null;
983
+ expiresAt?: number | null;
984
+ }
985
+
986
+ declare interface ConversationInfo {
987
+ type: "conversation_info";
988
+ conversationId: string;
989
+ title: string;
990
+ correlationId?: string;
991
+ conversationType?: ConversationType;
992
+ /**
993
+ * Per-conversation override for the LLM inference profile. `undefined`
994
+ * means the conversation inherits the workspace `llm.activeProfile`.
995
+ */
996
+ inferenceProfile?: string;
997
+ }
998
+
999
+ declare type ConversationListInvalidatedEvent = z.infer<typeof ConversationListInvalidatedEventSchema>;
1000
+
1001
+ declare const ConversationListInvalidatedEventSchema: z.ZodObject<{
1002
+ type: z.ZodLiteral<"conversation_list_invalidated">;
1003
+ reason: z.ZodEnum<{
1004
+ deleted: "deleted";
1005
+ created: "created";
1006
+ renamed: "renamed";
1007
+ reordered: "reordered";
1008
+ seen_changed: "seen_changed";
1009
+ }>;
1010
+ }, z.core.$strip>;
1011
+
1012
+ declare interface ConversationListResponse {
1013
+ type: "conversation_list_response";
1014
+ conversations: Array<{
1015
+ id: string;
1016
+ title: string;
1017
+ createdAt?: number;
1018
+ updatedAt: number;
1019
+ conversationType?: ConversationType;
1020
+ source?: string;
1021
+ scheduleJobId?: string;
1022
+ channelBinding?: ChannelBinding;
1023
+ conversationOriginChannel?: ChannelId;
1024
+ conversationOriginInterface?: InterfaceId;
1025
+ assistantAttention?: AssistantAttention;
1026
+ displayOrder?: number;
1027
+ isPinned?: boolean;
1028
+ forkParent?: ConversationForkParent;
1029
+ /**
1030
+ * Per-conversation override for the LLM inference profile. Omitted when
1031
+ * the conversation inherits the workspace `llm.activeProfile`.
1032
+ */
1033
+ inferenceProfile?: string;
1034
+ }>;
1035
+ /** Whether more conversations exist beyond the returned page. */
1036
+ hasMore?: boolean;
1037
+ }
1038
+
1039
+ declare interface ConversationsClearResponse {
1040
+ type: "conversations_clear_response";
1041
+ cleared: number;
1042
+ }
1043
+
1044
+ declare interface ConversationSearchMatchingMessage {
1045
+ messageId: string;
1046
+ role: string;
1047
+ /** Plain-text excerpt around the match, truncated to ~200 chars. */
1048
+ excerpt: string;
1049
+ createdAt: number;
1050
+ }
1051
+
1052
+ declare interface ConversationSearchResponse {
1053
+ type: "conversation_search_response";
1054
+ query: string;
1055
+ results: ConversationSearchResultItem[];
1056
+ }
1057
+
1058
+ declare interface ConversationSearchResultItem {
1059
+ conversationId: string;
1060
+ conversationTitle: string | null;
1061
+ conversationUpdatedAt: number;
1062
+ matchingMessages: ConversationSearchMatchingMessage[];
1063
+ }
1064
+
1065
+ declare type _ConversationsServerMessages = AuthResult | PongMessage | AssistantStatusMessage | GenerationCancelledEvent | GenerationHandoffEvent | ModelInfo | HistoryResponse | UndoComplete | UsageUpdateEvent | UsageProgress | UsageResponse | ContextCompacted | CompactionCircuitOpenEvent | CompactionCircuitClosedEvent | ConversationErrorEvent | ConversationInfo | ConversationTitleUpdatedEvent | ConversationListResponse | ConversationsClearResponse | ConversationSearchResponse | MessageContentResponse | ConversationListInvalidatedEvent | ScheduleConversationCreated | OpenConversation;
1066
+
1067
+ declare type ConversationTitleUpdatedEvent = z.infer<typeof ConversationTitleUpdatedEventSchema>;
1068
+
1069
+ declare const ConversationTitleUpdatedEventSchema: z.ZodObject<{
1070
+ type: z.ZodLiteral<"conversation_title_updated">;
1071
+ conversationId: z.ZodString;
1072
+ title: z.ZodString;
1073
+ }, z.core.$strip>;
1074
+
1075
+ declare type ConversationType = "standard" | "background" | "scheduled";
1076
+
1077
+ declare interface CopyBlockSurfaceData {
1078
+ text: string;
1079
+ label?: string;
1080
+ language?: string;
1081
+ }
1082
+
1083
+ declare interface CustomSlimSkill extends SlimSkillBase {
1084
+ origin: "custom";
1085
+ }
1086
+
1087
+ declare type _DiagnosticsServerMessages = EnvVarsResponse | DictationResponse;
1088
+
1089
+ declare interface DictationResponse {
1090
+ type: "dictation_response";
1091
+ text: string;
1092
+ mode: "dictation" | "command" | "action";
1093
+ actionPlan?: string;
1094
+ resolvedProfileId?: string;
1095
+ profileSource?: "request" | "app_mapping" | "default" | "fallback";
1096
+ }
1097
+
1098
+ declare interface DiffInfo {
1099
+ filePath: string;
1100
+ oldContent: string;
1101
+ newContent: string;
1102
+ isNewFile: boolean;
1103
+ }
1104
+
1105
+ declare type DiskPressureStatusChangedEvent = z.infer<typeof DiskPressureStatusChangedEventSchema>;
1106
+
1107
+ declare const DiskPressureStatusChangedEventSchema: z.ZodObject<{
1108
+ type: z.ZodLiteral<"disk_pressure_status_changed">;
1109
+ status: z.ZodObject<{
1110
+ enabled: z.ZodBoolean;
1111
+ state: z.ZodEnum<{
1112
+ ok: "ok";
1113
+ unknown: "unknown";
1114
+ disabled: "disabled";
1115
+ warning: "warning";
1116
+ critical: "critical";
1117
+ }>;
1118
+ locked: z.ZodBoolean;
1119
+ acknowledged: z.ZodBoolean;
1120
+ overrideActive: z.ZodBoolean;
1121
+ effectivelyLocked: z.ZodBoolean;
1122
+ lockId: z.ZodNullable<z.ZodString>;
1123
+ usagePercent: z.ZodNullable<z.ZodNumber>;
1124
+ thresholdPercent: z.ZodNumber;
1125
+ path: z.ZodNullable<z.ZodString>;
1126
+ lastCheckedAt: z.ZodNullable<z.ZodString>;
1127
+ blockedCapabilities: z.ZodArray<z.ZodEnum<{
1128
+ "agent-turns": "agent-turns";
1129
+ "background-work": "background-work";
1130
+ "remote-ingress": "remote-ingress";
1131
+ }>>;
1132
+ error: z.ZodNullable<z.ZodString>;
1133
+ }, z.core.$strip>;
1134
+ }, z.core.$strip>;
1135
+
1136
+ /** Distributive Omit that preserves union discrimination. */
1137
+ declare type DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never;
1138
+
1139
+ declare type DocumentCommentCreatedEvent = z.infer<typeof DocumentCommentCreatedEventSchema>;
1140
+
1141
+ declare const DocumentCommentCreatedEventSchema: z.ZodObject<{
1142
+ type: z.ZodLiteral<"document_comment_created">;
1143
+ conversationId: z.ZodString;
1144
+ surfaceId: z.ZodString;
1145
+ comment: z.ZodObject<{
1146
+ id: z.ZodString;
1147
+ surfaceId: z.ZodString;
1148
+ author: z.ZodString;
1149
+ content: z.ZodString;
1150
+ anchorStart: z.ZodOptional<z.ZodNumber>;
1151
+ anchorEnd: z.ZodOptional<z.ZodNumber>;
1152
+ anchorText: z.ZodOptional<z.ZodString>;
1153
+ parentCommentId: z.ZodOptional<z.ZodString>;
1154
+ status: z.ZodString;
1155
+ createdAt: z.ZodNumber;
1156
+ updatedAt: z.ZodNumber;
1157
+ }, z.core.$strip>;
1158
+ }, z.core.$strip>;
1159
+
1160
+ declare type DocumentCommentDeletedEvent = z.infer<typeof DocumentCommentDeletedEventSchema>;
1161
+
1162
+ declare const DocumentCommentDeletedEventSchema: z.ZodObject<{
1163
+ type: z.ZodLiteral<"document_comment_deleted">;
1164
+ conversationId: z.ZodString;
1165
+ surfaceId: z.ZodString;
1166
+ commentId: z.ZodString;
1167
+ }, z.core.$strip>;
1168
+
1169
+ declare type DocumentCommentReopenedEvent = z.infer<typeof DocumentCommentReopenedEventSchema>;
1170
+
1171
+ declare const DocumentCommentReopenedEventSchema: z.ZodObject<{
1172
+ type: z.ZodLiteral<"document_comment_reopened">;
1173
+ conversationId: z.ZodString;
1174
+ surfaceId: z.ZodString;
1175
+ commentId: z.ZodString;
1176
+ }, z.core.$strip>;
1177
+
1178
+ declare type DocumentCommentResolvedEvent = z.infer<typeof DocumentCommentResolvedEventSchema>;
1179
+
1180
+ declare const DocumentCommentResolvedEventSchema: z.ZodObject<{
1181
+ type: z.ZodLiteral<"document_comment_resolved">;
1182
+ conversationId: z.ZodString;
1183
+ surfaceId: z.ZodString;
1184
+ commentId: z.ZodString;
1185
+ resolvedBy: z.ZodString;
1186
+ }, z.core.$strip>;
1187
+
1188
+ declare type _DocumentCommentsServerMessages = DocumentCommentCreatedEvent | DocumentCommentResolvedEvent | DocumentCommentReopenedEvent | DocumentCommentDeletedEvent;
1189
+
1190
+ declare interface DocumentEditorShow {
1191
+ type: "document_editor_show";
1192
+ conversationId: string;
1193
+ surfaceId: string;
1194
+ title: string;
1195
+ initialContent: string;
1196
+ }
1197
+
1198
+ declare type DocumentEditorUpdateEvent = z.infer<typeof DocumentEditorUpdateEventSchema>;
1199
+
1200
+ declare const DocumentEditorUpdateEventSchema: z.ZodObject<{
1201
+ type: z.ZodLiteral<"document_editor_update">;
1202
+ conversationId: z.ZodString;
1203
+ surfaceId: z.ZodString;
1204
+ markdown: z.ZodString;
1205
+ mode: z.ZodString;
1206
+ }, z.core.$strip>;
1207
+
1208
+ declare interface DocumentListResponse {
1209
+ type: "document_list_response";
1210
+ documents: Array<{
1211
+ surfaceId: string;
1212
+ conversationId: string;
1213
+ title: string;
1214
+ wordCount: number;
1215
+ createdAt: number;
1216
+ updatedAt: number;
1217
+ }>;
1218
+ }
1219
+
1220
+ declare interface DocumentLoadResponse {
1221
+ type: "document_load_response";
1222
+ surfaceId: string;
1223
+ conversationId: string;
1224
+ title: string;
1225
+ content: string;
1226
+ wordCount: number;
1227
+ createdAt: number;
1228
+ updatedAt: number;
1229
+ success: boolean;
1230
+ error?: string;
1231
+ }
1232
+
1233
+ declare interface DocumentPreviewSurfaceData {
1234
+ title: string;
1235
+ surfaceId: string;
1236
+ subtitle?: string;
1237
+ }
1238
+
1239
+ declare interface DocumentSaveResponse {
1240
+ type: "document_save_response";
1241
+ surfaceId: string;
1242
+ success: boolean;
1243
+ error?: string;
1244
+ }
1245
+
1246
+ declare type _DocumentsServerMessages = DocumentEditorShow | DocumentEditorUpdateEvent | DocumentSaveResponse | DocumentLoadResponse | DocumentListResponse;
1247
+
1248
+ declare interface DynamicPagePreview {
1249
+ title: string;
1250
+ subtitle?: string;
1251
+ description?: string;
1252
+ icon?: string;
1253
+ metrics?: Array<{
1254
+ label: string;
1255
+ value: string;
1256
+ }>;
1257
+ context?: "app_create" | "general";
1258
+ previewImage?: string;
1259
+ }
1260
+
1261
+ declare interface DynamicPageSurfaceData {
1262
+ html: string;
1263
+ width?: number;
1264
+ height?: number;
1265
+ appId?: string;
1266
+ /** Filesystem directory name for this app (may differ from `appId`). */
1267
+ dirName?: string;
1268
+ reloadGeneration?: number;
1269
+ status?: string;
1270
+ preview?: DynamicPagePreview;
1271
+ }
1272
+
1273
+ declare interface EnvVarsResponse {
1274
+ type: "env_vars_response";
1275
+ vars: Record<string, string>;
1276
+ }
1277
+
1278
+ declare type ErrorCategory = "permission_denied" | "auth" | "tool_failure" | "unexpected";
1279
+
1280
+ declare type ErrorEvent_2 = z.infer<typeof ErrorEventSchema>;
1281
+
1282
+ declare const ErrorEventSchema: z.ZodObject<{
1283
+ type: z.ZodLiteral<"error">;
1284
+ message: z.ZodString;
1285
+ code: z.ZodOptional<z.ZodString>;
1286
+ category: z.ZodOptional<z.ZodString>;
1287
+ errorCategory: z.ZodOptional<z.ZodString>;
1288
+ requestId: z.ZodOptional<z.ZodString>;
1289
+ conversationId: z.ZodOptional<z.ZodString>;
1290
+ }, z.core.$strip>;
1291
+
1292
+ /**
1293
+ * Tool-related type declarations shared between the daemon and any
1294
+ * skill-side package that needs to describe tools, permission risk, or tool
1295
+ * execution results on the wire.
1296
+ *
1297
+ * Pure type-level declarations only (+ the `RiskLevel` enum, which is a value
1298
+ * but is safely cross-package). No runtime helpers live here — the assistant
1299
+ * keeps all behavior functions in `assistant/src/tools/` and re-exports the
1300
+ * types from this file.
1301
+ *
1302
+ * Heavy daemon-internal references (CES client, host-proxy classes, trust
1303
+ * classifications, interface IDs, content blocks, CES `ApprovalRequired`)
1304
+ * are held as opaque `unknown` / broadened-`string` placeholders on this
1305
+ * side so the contracts package never reaches into the assistant or the
1306
+ * service-contracts runtime. The assistant redeclares `Tool`, `ToolContext`,
1307
+ * `ToolExecutionResult`, `ToolExecutedEvent`, `ToolLifecycleEvent`,
1308
+ * `ToolLifecycleEventHandler`, and `ProxyToolResolver` in
1309
+ * `assistant/src/tools/types.ts` with the concrete types in place, so
1310
+ * existing call sites keep their full type information. The two sides are
1311
+ * structurally independent — no inheritance, no intersection — which
1312
+ * avoids TypeScript's contravariance mismatches on lifecycle-event
1313
+ * handlers.
1314
+ */
1315
+ declare type ExecutionTarget = "sandbox" | "host";
1316
+
1317
+ /**
1318
+ * Telemetry fields stamped centrally by the executor's `emitLifecycleEvent`
1319
+ * on terminal (executed/error) lifecycle events.
1320
+ */
1321
+ declare interface ExecutorTelemetryStamp {
1322
+ /**
1323
+ * Model attribution snapshot for the conversation at invocation time.
1324
+ * Copied from {@link ToolContext.attribution} by the executor; `null` when
1325
+ * resolution failed or no attribution was available.
1326
+ */
1327
+ attribution?: UsageAttributionSnapshot | null;
1328
+ /**
1329
+ * Serialized byte size of the RAW tool input, stamped by the executor
1330
+ * before sensitive-field sanitization rewrites `input`. Only the size
1331
+ * leaves the device, never the payload.
1332
+ */
1333
+ inputBytes?: number | null;
1334
+ /**
1335
+ * Byte size of the RAW tool result content, stamped by the executor
1336
+ * before sensitive-output extraction rewrites `result.content`. Only
1337
+ * stamped on `executed` events: error events carry no executor-side
1338
+ * result — the audit listener sizes the error string it builds itself,
1339
+ * which never goes through sanitization, so it is already raw. Only the
1340
+ * size leaves the device, never the payload.
1341
+ */
1342
+ resultBytes?: number | null;
1343
+ }
1344
+
1345
+ export declare interface FileContent {
1346
+ type: "file";
1347
+ source: {
1348
+ type: "base64";
1349
+ media_type: string;
1350
+ data: string;
1351
+ filename: string;
1352
+ };
1353
+ extracted_text?: string;
1354
+ /**
1355
+ * Internal id linking this block to a row in the attachments table.
1356
+ * Set when the file block originates from a persisted user-message
1357
+ * attachment so downstream consumers (DB joins, inline-chip
1358
+ * positioning) can correlate the block back to its attachment id.
1359
+ * Stripped by `daemon/handlers/shared.ts` before sending to the
1360
+ * model.
1361
+ */
1362
+ _attachmentId?: string;
1363
+ }
1364
+
1365
+ declare interface FileUploadSurfaceData {
1366
+ prompt: string;
1367
+ acceptedTypes?: string[];
1368
+ maxFiles?: number;
1369
+ maxSizeBytes?: number;
1370
+ }
1371
+
1372
+ declare interface FilingConfigResponse {
1373
+ type: "filing_config_response";
1374
+ enabled: boolean;
1375
+ intervalMs: number;
1376
+ activeHoursStart: number | null;
1377
+ activeHoursEnd: number | null;
1378
+ nextRunAt: number | null;
1379
+ lastRunAt: number | null;
1380
+ success: boolean;
1381
+ error?: string;
1382
+ }
1383
+
1384
+ declare interface FilingRunNowResponse {
1385
+ type: "filing_run_now_response";
1386
+ success: boolean;
1387
+ ran: boolean;
1388
+ error?: string;
1389
+ }
1390
+
1391
+ declare interface ForkSharedAppResponse {
1392
+ type: "fork_shared_app_response";
1393
+ success: boolean;
1394
+ appId?: string;
1395
+ name?: string;
1396
+ error?: string;
1397
+ }
1398
+
1399
+ declare interface FormField {
1400
+ id: string;
1401
+ type: "text" | "textarea" | "select" | "toggle" | "number" | "password";
1402
+ label: string;
1403
+ placeholder?: string;
1404
+ required?: boolean;
1405
+ defaultValue?: string | number | boolean;
1406
+ options?: Array<{
1407
+ label: string;
1408
+ value: string;
1409
+ }>;
1410
+ }
1411
+
1412
+ declare interface FormPage {
1413
+ id: string;
1414
+ title: string;
1415
+ description?: string;
1416
+ fields: FormField[];
1417
+ }
1418
+
1419
+ declare interface FormSurfaceData {
1420
+ description?: string;
1421
+ fields: FormField[];
1422
+ submitLabel?: string;
1423
+ pages?: FormPage[];
1424
+ pageLabels?: {
1425
+ next?: string;
1426
+ back?: string;
1427
+ submit?: string;
1428
+ };
1429
+ }
1430
+
1431
+ /** Response to a generate_avatar request indicating success or failure. */
1432
+ declare interface GenerateAvatarResponse {
1433
+ type: "generate_avatar_response";
1434
+ /** Whether the avatar was generated successfully. */
1435
+ success: boolean;
1436
+ /** Error message when success is false. */
1437
+ error?: string;
1438
+ }
1439
+
1440
+ declare type GenerationCancelledEvent = z.infer<typeof GenerationCancelledEventSchema>;
1441
+
1442
+ declare const GenerationCancelledEventSchema: z.ZodObject<{
1443
+ type: z.ZodLiteral<"generation_cancelled">;
1444
+ conversationId: z.ZodOptional<z.ZodString>;
1445
+ }, z.core.$strip>;
1446
+
1447
+ declare type GenerationHandoffEvent = z.infer<typeof GenerationHandoffEventSchema>;
1448
+
1449
+ declare const GenerationHandoffEventSchema: z.ZodObject<{
1450
+ type: z.ZodLiteral<"generation_handoff">;
1451
+ conversationId: z.ZodOptional<z.ZodString>;
1452
+ requestId: z.ZodOptional<z.ZodString>;
1453
+ queuedCount: z.ZodNumber;
1454
+ messageId: z.ZodOptional<z.ZodString>;
1455
+ attachments: z.ZodOptional<z.ZodArray<z.ZodObject<{
1456
+ id: z.ZodOptional<z.ZodString>;
1457
+ filename: z.ZodString;
1458
+ mimeType: z.ZodString;
1459
+ data: z.ZodString;
1460
+ sourceType: z.ZodOptional<z.ZodEnum<{
1461
+ host_file: "host_file";
1462
+ sandbox_file: "sandbox_file";
1463
+ tool_block: "tool_block";
1464
+ }>>;
1465
+ sizeBytes: z.ZodOptional<z.ZodNumber>;
1466
+ thumbnailData: z.ZodOptional<z.ZodString>;
1467
+ fileBacked: z.ZodOptional<z.ZodBoolean>;
1468
+ filePath: z.ZodOptional<z.ZodString>;
1469
+ }, z.core.$strip>>>;
1470
+ attachmentWarnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
1471
+ }, z.core.$strip>;
1472
+
1473
+ /**
1474
+ * Retrieve a secret from secure storage. Convenience wrapper over
1475
+ * `getSecureKeyResultAsync` that returns only the value.
1476
+ */
1477
+ export declare function getSecureKeyAsync(account: string): Promise<string | undefined>;
1478
+
1479
+ declare interface GetSigningIdentityRequest {
1480
+ type: "get_signing_identity";
1481
+ requestId: string;
1482
+ }
1483
+
1484
+ declare interface GuardianActionDecisionResponse {
1485
+ type: "guardian_action_decision_response";
1486
+ applied: boolean;
1487
+ reason?: string;
1488
+ resolverFailureReason?: string;
1489
+ requestId?: string;
1490
+ userText?: string;
1491
+ /** Resolver reply text for the guardian (e.g. verification code for access requests). */
1492
+ replyText?: string;
1493
+ }
1494
+
1495
+ declare interface GuardianActionsPendingResponse {
1496
+ type: "guardian_actions_pending_response";
1497
+ conversationId: string;
1498
+ prompts: GuardianDecisionPrompt[];
1499
+ }
1500
+
1501
+ declare type _GuardianActionsServerMessages = GuardianActionsPendingResponse | GuardianActionDecisionResponse;
1502
+
1503
+ declare interface GuardianDecisionAction {
1504
+ /** Canonical action identifier. */
1505
+ action: string;
1506
+ /** Human-readable label for the action. */
1507
+ label: string;
1508
+ /** Short explanation shown in rich-UI legends (Telegram, Slack). */
1509
+ description?: string;
1510
+ }
1511
+
1512
+ /**
1513
+ * Shared types for the guardian decision primitive.
1514
+ *
1515
+ * All decision entrypoints (callback buttons, conversational engine, legacy
1516
+ * parser, requester self-cancel) use these types to route through the
1517
+ * unified `applyGuardianDecision` primitive.
1518
+ */
1519
+ /** Structured model for prompts shown to guardians. */
1520
+ declare interface GuardianDecisionPrompt {
1521
+ requestId: string;
1522
+ /** Short human-readable code for the request. */
1523
+ requestCode: string;
1524
+ state: "pending" | "followup_awaiting_choice" | "expired_superseded_with_active_call";
1525
+ questionText: string;
1526
+ toolName: string | null;
1527
+ actions: GuardianDecisionAction[];
1528
+ expiresAt: number;
1529
+ conversationId: string;
1530
+ callSessionId: string | null;
1531
+ /**
1532
+ * Canonical request kind (e.g. 'tool_approval', 'pending_question').
1533
+ * Present when the prompt originates from the canonical guardian request
1534
+ * store. Absent for legacy-only prompts.
1535
+ */
1536
+ kind?: string;
1537
+ /** Human-readable preview of the command being approved (e.g. shell command). */
1538
+ commandPreview?: string;
1539
+ /** Risk level label for the request (e.g. 'low', 'medium', 'high'). */
1540
+ riskLevel?: string;
1541
+ /** Short activity description for richer prompt display. */
1542
+ activityText?: string;
1543
+ /** Where the tool will execute — sandbox or host. */
1544
+ executionTarget?: "sandbox" | "host";
1545
+ }
1546
+
1547
+ declare interface HeartbeatAlert {
1548
+ type: "heartbeat_alert";
1549
+ title: string;
1550
+ body: string;
1551
+ }
1552
+
1553
+ declare interface HeartbeatChecklistResponse {
1554
+ type: "heartbeat_checklist_response";
1555
+ content: string;
1556
+ isDefault: boolean;
1557
+ }
1558
+
1559
+ declare interface HeartbeatChecklistWriteResponse {
1560
+ type: "heartbeat_checklist_write_response";
1561
+ success: boolean;
1562
+ error?: string;
1563
+ }
1564
+
1565
+ declare interface HeartbeatConfigResponse {
1566
+ type: "heartbeat_config_response";
1567
+ enabled: boolean;
1568
+ intervalMs: number;
1569
+ activeHoursStart: number | null;
1570
+ activeHoursEnd: number | null;
1571
+ nextRunAt: number | null;
1572
+ lastRunAt: number | null;
1573
+ success: boolean;
1574
+ error?: string;
1575
+ }
1576
+
1577
+ /** Server push — broadcast when a heartbeat creates a conversation. */
1578
+ declare interface HeartbeatConversationCreated {
1579
+ type: "heartbeat_conversation_created";
1580
+ conversationId: string;
1581
+ title: string;
1582
+ }
1583
+
1584
+ declare interface HeartbeatRunNowResponse {
1585
+ type: "heartbeat_run_now_response";
1586
+ success: boolean;
1587
+ error?: string;
1588
+ }
1589
+
1590
+ declare interface HeartbeatRunsListResponse {
1591
+ type: "heartbeat_runs_list_response";
1592
+ runs: Array<{
1593
+ id: string;
1594
+ scheduledFor: number;
1595
+ startedAt: number | null;
1596
+ finishedAt: number | null;
1597
+ durationMs: number | null;
1598
+ status: string;
1599
+ skipReason: string | null;
1600
+ error: string | null;
1601
+ conversationId: string | null;
1602
+ createdAt: number;
1603
+ }>;
1604
+ }
1605
+
1606
+ declare interface HistoryResponse {
1607
+ type: "history_response";
1608
+ conversationId: string;
1609
+ messages: Array<{
1610
+ /** Database ID used by clients for the rendered message. */
1611
+ id?: string;
1612
+ role: string;
1613
+ text: string;
1614
+ timestamp: number;
1615
+ toolCalls?: HistoryResponseToolCall[];
1616
+ /** True when tool_use blocks appeared before any text block in the original content. */
1617
+ toolCallsBeforeText?: boolean;
1618
+ attachments?: UserMessageAttachment[];
1619
+ /** Text segments split by tool-call boundaries. Preserves interleaving order. */
1620
+ textSegments?: string[];
1621
+ /** Content block ordering using "text:N", "tool:N", "surface:N" encoding. */
1622
+ contentOrder?: string[];
1623
+ /** UI surfaces (widgets) embedded in the message. */
1624
+ surfaces?: HistoryResponseSurface[];
1625
+ /** Present when this message is a subagent lifecycle notification (running/completed/failed/aborted). */
1626
+ subagentNotification?: {
1627
+ subagentId: string;
1628
+ label: string;
1629
+ status: "running" | "completed" | "failed" | "aborted";
1630
+ error?: string;
1631
+ conversationId?: string;
1632
+ objective?: string;
1633
+ };
1634
+ /** True when text or tool result content was truncated due to maxTextChars/maxToolResultChars. */
1635
+ wasTruncated?: boolean;
1636
+ }>;
1637
+ /** Whether older messages exist beyond the returned page. */
1638
+ hasMore: boolean;
1639
+ /** Timestamp of the oldest message in the response (client uses as next pagination cursor). */
1640
+ oldestTimestamp?: number;
1641
+ /** ID of the oldest message in the response (tie-breaker for same-millisecond cursors). */
1642
+ oldestMessageId?: string;
1643
+ }
1644
+
1645
+ declare interface HistoryResponseSurface {
1646
+ surfaceId: string;
1647
+ surfaceType: string;
1648
+ title?: string;
1649
+ data: Record<string, unknown>;
1650
+ actions?: Array<{
1651
+ id: string;
1652
+ label: string;
1653
+ style?: string;
1654
+ data?: Record<string, unknown>;
1655
+ }>;
1656
+ display?: string;
1657
+ /** True when the surface was completed (e.g. form submitted, action taken). */
1658
+ completed?: boolean;
1659
+ /** Human-readable summary shown in the completion chip. */
1660
+ completionSummary?: string;
1661
+ }
1662
+
1663
+ declare interface HistoryResponseToolCall {
1664
+ name: string;
1665
+ input: Record<string, unknown>;
1666
+ result?: string;
1667
+ isError?: boolean;
1668
+ /** Base64-encoded image data from tool contentBlocks (e.g. browser_screenshot). @deprecated Use imageDataList. */
1669
+ imageData?: string;
1670
+ /** Base64-encoded image data from tool contentBlocks (e.g. browser_screenshot, image generation). */
1671
+ imageDataList?: string[];
1672
+ /** Unix ms when the tool started executing. */
1673
+ startedAt?: number;
1674
+ /** Unix ms when the tool completed. */
1675
+ completedAt?: number;
1676
+ /** Confirmation decision for this tool call: "approved" | "denied" | "timed_out". */
1677
+ confirmationDecision?: string;
1678
+ /** Friendly label for the confirmation (e.g. "Edit File", "Run Command"). */
1679
+ confirmationLabel?: string;
1680
+ /** Risk level at the time of invocation ("low" | "medium" | "high" | "unknown"). */
1681
+ riskLevel?: string;
1682
+ /** Human-readable reason for the risk classification. */
1683
+ riskReason?: string;
1684
+ /**
1685
+ * @deprecated Use `approvalMode` and `approvalReason` instead.
1686
+ * Kept for backward compatibility during the migration window.
1687
+ */
1688
+ autoApproved?: boolean;
1689
+ /** How the approval decision was reached: prompted, auto, blocked, or unknown (legacy). */
1690
+ approvalMode?: string;
1691
+ /** Why the approval decision was reached (stable enum for client display). */
1692
+ approvalReason?: string;
1693
+ /** Snapshot of the auto-approve threshold at execution time. */
1694
+ riskThreshold?: string;
1695
+ }
1696
+
1697
+ declare type HomeFeedUpdatedEvent = z.infer<typeof HomeFeedUpdatedEventSchema>;
1698
+
1699
+ declare const HomeFeedUpdatedEventSchema: z.ZodObject<{
1700
+ type: z.ZodLiteral<"home_feed_updated">;
1701
+ updatedAt: z.ZodString;
1702
+ newItemCount: z.ZodNumber;
1703
+ }, z.core.$strip>;
1704
+
1705
+ declare type _HomeServerMessages = RelationshipStateUpdatedEvent | HomeFeedUpdatedEvent;
1706
+
1707
+ /** Union of every hook name declared in {@link HOOKS}. */
1708
+ export declare type HookName = (typeof HOOKS)[keyof typeof HOOKS];
1709
+
1710
+ /**
1711
+ * Public hook-name constants.
1712
+ *
1713
+ * Plugin authors reference hooks by name in two places: the keys on
1714
+ * `Plugin.hooks` and the daemon's `runHook(name, ctx)` call sites.
1715
+ * Centralizing the string literals here keeps the typo surface minimal
1716
+ * and lets call sites import a typed constant instead of repeating a
1717
+ * free-form string.
1718
+ *
1719
+ * New hooks land here as additional `HOOKS.*` entries. The runtime
1720
+ * `runHook(name, ctx)` accepts any string (so test fixtures and
1721
+ * forward-compat hooks can still chain through), but call sites in
1722
+ * first-party code should always reach for a `HOOKS.*` constant.
1723
+ */
1724
+ export declare const HOOKS: {
1725
+ /** Plugin bootstrap. Fires once when the daemon loads the plugin. */
1726
+ readonly INIT: "init";
1727
+ /** Plugin teardown. Fires once when the daemon unloads the plugin. */
1728
+ readonly SHUTDOWN: "shutdown";
1729
+ /** Fires once per user turn, immediately before the agent loop receives `runMessages`. */
1730
+ readonly USER_PROMPT_SUBMIT: "user-prompt-submit";
1731
+ /** Fires immediately before each provider call. A hook may edit the outbound request (e.g. the system prompt) and opt the turn into deferred output streaming. */
1732
+ readonly PRE_MODEL_CALL: "pre-model-call";
1733
+ /** Fires once per tool result, after the tool returns and before the result is sent to the provider. */
1734
+ readonly POST_TOOL_USE: "post-tool-use";
1735
+ /** Fires once per run when the loop has committed to ending — the definitive terminal hook for teardown. Cannot continue the loop; reports how the turn ended via `exitReason`. */
1736
+ readonly STOP: "stop";
1737
+ /** Fires at every model-call outcome (finalized reply or provider rejection), before the message is persisted/streamed-final. A hook may transform the content and owns the continue/retry decision. */
1738
+ readonly POST_MODEL_CALL: "post-model-call";
1739
+ /** Fires after the loop successfully compacts a conversation mid-turn. */
1740
+ readonly POST_COMPACT: "post-compact";
1741
+ };
1742
+
1743
+ declare interface HostAppControlCancel {
1744
+ type: "host_app_control_cancel";
1745
+ requestId: string;
1746
+ conversationId: string;
1747
+ }
1748
+
1749
+ declare interface HostAppControlClickInput {
1750
+ tool: "click";
1751
+ app: string;
1752
+ x: number;
1753
+ y: number;
1754
+ button?: "left" | "right" | "middle";
1755
+ double?: boolean;
1756
+ }
1757
+
1758
+ declare interface HostAppControlComboInput {
1759
+ tool: "combo";
1760
+ app: string;
1761
+ /** Sequence of keys pressed simultaneously, e.g. ["cmd", "shift", "4"]. */
1762
+ keys: string[];
1763
+ /** Hold duration in milliseconds. */
1764
+ duration_ms?: number;
1765
+ }
1766
+
1767
+ declare interface HostAppControlDragInput {
1768
+ tool: "drag";
1769
+ app: string;
1770
+ from_x: number;
1771
+ from_y: number;
1772
+ to_x: number;
1773
+ to_y: number;
1774
+ button?: "left" | "right" | "middle";
1775
+ }
1776
+
1777
+ /** Inputs accepted by the nine app-control tool variants. */
1778
+ declare type HostAppControlInput = HostAppControlStartInput | HostAppControlObserveInput | HostAppControlPressInput | HostAppControlComboInput | HostAppControlSequenceInput | HostAppControlTypeInput | HostAppControlClickInput | HostAppControlDragInput | HostAppControlStopInput;
1779
+
1780
+ declare interface HostAppControlObserveInput {
1781
+ tool: "observe";
1782
+ app: string;
1783
+ /**
1784
+ * Milliseconds to wait between receiving the request and capturing the
1785
+ * window. Lets the target app process pending input and the WindowServer
1786
+ * composite a fresh frame. When omitted, the client uses its default
1787
+ * (~200ms, sized for emulator-class apps at 60fps). Pass `0` for static
1788
+ * UIs to make `observe` snappier; raise it for slow-feedback apps.
1789
+ */
1790
+ settle_ms?: number;
1791
+ }
1792
+
1793
+ declare interface HostAppControlPressInput {
1794
+ tool: "press";
1795
+ app: string;
1796
+ /** Single key identifier, e.g. "return", "a", "f12". */
1797
+ key: string;
1798
+ /** Modifier list, e.g. ["cmd", "shift"]. */
1799
+ modifiers?: string[];
1800
+ /** Hold duration in milliseconds. */
1801
+ duration_ms?: number;
1802
+ }
1803
+
1804
+ declare interface HostAppControlRequest {
1805
+ type: "host_app_control_request";
1806
+ requestId: string;
1807
+ conversationId: string;
1808
+ toolName: string;
1809
+ input: HostAppControlInput;
1810
+ }
1811
+
1812
+ declare interface HostAppControlSequenceInput {
1813
+ tool: "sequence";
1814
+ app: string;
1815
+ /** Ordered list of single-key presses to execute serially. */
1816
+ steps: HostAppControlSequenceStep[];
1817
+ }
1818
+
1819
+ /** A single step inside a sequence: one key press with optional modifiers, hold duration, and post-press gap. */
1820
+ declare interface HostAppControlSequenceStep {
1821
+ /** Single key identifier, e.g. "right", "a", "return". */
1822
+ key: string;
1823
+ /** Modifier list, e.g. ["cmd", "shift"]. Omit for no modifiers. */
1824
+ modifiers?: string[];
1825
+ /** Hold duration for this key in milliseconds. */
1826
+ duration_ms?: number;
1827
+ /** Pause after this step before starting the next, in milliseconds. */
1828
+ gap_ms?: number;
1829
+ }
1830
+
1831
+ declare type _HostAppControlServerMessages = HostAppControlRequest | HostAppControlCancel;
1832
+
1833
+ declare interface HostAppControlStartInput {
1834
+ tool: "start";
1835
+ /** Bundle ID (preferred) or process name. */
1836
+ app: string;
1837
+ /** Optional command-line arguments to launch the app with. */
1838
+ args?: string[];
1839
+ }
1840
+
1841
+ declare interface HostAppControlStopInput {
1842
+ tool: "stop";
1843
+ /** Optional — when omitted the proxy stops whichever app currently holds the session. */
1844
+ app?: string;
1845
+ /** Free-form reason, surfaced for logging. */
1846
+ reason?: string;
1847
+ }
1848
+
1849
+ declare interface HostAppControlTypeInput {
1850
+ tool: "type";
1851
+ app: string;
1852
+ text: string;
1853
+ }
1854
+
1855
+ declare interface HostBashCancelRequest {
1856
+ type: "host_bash_cancel";
1857
+ requestId: string;
1858
+ conversationId: string;
1859
+ /** When set, route this cancel only to the client that owns the request. */
1860
+ targetClientId?: string;
1861
+ }
1862
+
1863
+ declare interface HostBashRequest {
1864
+ type: "host_bash_request";
1865
+ requestId: string;
1866
+ conversationId: string;
1867
+ command: string;
1868
+ working_dir?: string;
1869
+ timeout_seconds?: number;
1870
+ /** Extra environment variables to inject into the subprocess (e.g. VELLUM_UNTRUSTED_SHELL). */
1871
+ env?: Record<string, string>;
1872
+ /** When set, route this request only to the client with this ID. */
1873
+ targetClientId?: string;
1874
+ }
1875
+
1876
+ declare type _HostBashServerMessages = HostBashRequest | HostBashCancelRequest;
1877
+
1878
+ declare interface HostBrowserCancelRequest {
1879
+ type: "host_browser_cancel";
1880
+ requestId: string;
1881
+ }
1882
+
1883
+ declare interface HostBrowserRequest {
1884
+ type: "host_browser_request";
1885
+ requestId: string;
1886
+ conversationId: string;
1887
+ /** CDP method name, e.g. "Page.navigate", "Runtime.evaluate", "Accessibility.getFullAXTree". */
1888
+ cdpMethod: string;
1889
+ /** Opaque JSON params object forwarded verbatim to CDP. */
1890
+ cdpParams?: Record<string, unknown>;
1891
+ /** Optional CDP target/session ID; omitted = "most-recently-active tab". */
1892
+ cdpSessionId?: string;
1893
+ /** Client-side timeout hint; defaults to 30s in the proxy. */
1894
+ timeout_seconds?: number;
1895
+ }
1896
+
1897
+ declare type _HostBrowserServerMessages = HostBrowserRequest | HostBrowserCancelRequest;
1898
+
1899
+ declare interface HostCuCancelRequest {
1900
+ type: "host_cu_cancel";
1901
+ requestId: string;
1902
+ conversationId: string;
1903
+ targetClientId?: string;
1904
+ }
1905
+
1906
+ declare interface HostCuRequest {
1907
+ type: "host_cu_request";
1908
+ requestId: string;
1909
+ conversationId: string;
1910
+ targetClientId?: string;
1911
+ toolName: string;
1912
+ input: Record<string, unknown>;
1913
+ stepNumber: number;
1914
+ reasoning?: string;
1915
+ }
1916
+
1917
+ declare type _HostCuServerMessages = HostCuRequest | HostCuCancelRequest;
1918
+
1919
+ declare interface HostFileCancelRequest {
1920
+ type: "host_file_cancel";
1921
+ requestId: string;
1922
+ conversationId: string;
1923
+ targetClientId?: string;
1924
+ }
1925
+
1926
+ declare interface HostFileEditRequest {
1927
+ type: "host_file_request";
1928
+ requestId: string;
1929
+ conversationId: string;
1930
+ targetClientId?: string;
1931
+ operation: "edit";
1932
+ path: string;
1933
+ old_string: string;
1934
+ new_string: string;
1935
+ replace_all?: boolean;
1936
+ }
1937
+
1938
+ declare interface HostFileReadRequest {
1939
+ type: "host_file_request";
1940
+ requestId: string;
1941
+ conversationId: string;
1942
+ targetClientId?: string;
1943
+ operation: "read";
1944
+ path: string;
1945
+ offset?: number;
1946
+ limit?: number;
1947
+ }
1948
+
1949
+ declare type HostFileRequest = HostFileReadRequest | HostFileWriteRequest | HostFileEditRequest;
1950
+
1951
+ declare type _HostFileServerMessages = HostFileRequest | HostFileCancelRequest;
1952
+
1953
+ declare interface HostFileWriteRequest {
1954
+ type: "host_file_request";
1955
+ requestId: string;
1956
+ conversationId: string;
1957
+ targetClientId?: string;
1958
+ operation: "write";
1959
+ path: string;
1960
+ content: string;
1961
+ }
1962
+
1963
+ /**
1964
+ * Host proxy capabilities that an interface can support. The macOS client
1965
+ * supports all five; the chrome-extension interface only supports
1966
+ * host_browser (via the Chrome DevTools Protocol proxy).
1967
+ */
1968
+ declare type HostProxyCapability = "host_bash" | "host_file" | "host_cu" | "host_browser" | "host_app_control";
1969
+
1970
+ declare interface HostTransferCancelRequest {
1971
+ type: "host_transfer_cancel";
1972
+ requestId: string;
1973
+ conversationId: string;
1974
+ targetClientId?: string;
1975
+ }
1976
+
1977
+ declare type HostTransferRequest = HostTransferToHostRequest | HostTransferToSandboxRequest;
1978
+
1979
+ declare type _HostTransferServerMessages = HostTransferRequest | HostTransferCancelRequest;
1980
+
1981
+ declare interface HostTransferToHostRequest {
1982
+ type: "host_transfer_request";
1983
+ requestId: string;
1984
+ conversationId: string;
1985
+ targetClientId?: string;
1986
+ direction: "to_host";
1987
+ transferId: string;
1988
+ destPath: string;
1989
+ sizeBytes: number;
1990
+ sha256: string;
1991
+ overwrite: boolean;
1992
+ }
1993
+
1994
+ declare interface HostTransferToSandboxRequest {
1995
+ type: "host_transfer_request";
1996
+ requestId: string;
1997
+ conversationId: string;
1998
+ targetClientId?: string;
1999
+ direction: "to_sandbox";
2000
+ transferId: string;
2001
+ sourcePath: string;
2002
+ }
2003
+
2004
+ declare type IdentityChangedEvent = z.infer<typeof IdentityChangedEventSchema>;
2005
+
2006
+ declare const IdentityChangedEventSchema: z.ZodObject<{
2007
+ type: z.ZodLiteral<"identity_changed">;
2008
+ name: z.ZodString;
2009
+ role: z.ZodString;
2010
+ personality: z.ZodString;
2011
+ emoji: z.ZodString;
2012
+ home: z.ZodString;
2013
+ }, z.core.$strip>;
2014
+
2015
+ declare interface IdentityGetResponse {
2016
+ type: "identity_get_response";
2017
+ /** Whether an IDENTITY.md file was found. When false, all fields are empty defaults. */
2018
+ found: boolean;
2019
+ name: string;
2020
+ role: string;
2021
+ personality: string;
2022
+ emoji: string;
2023
+ home: string;
2024
+ version?: string;
2025
+ assistantId?: string;
2026
+ createdAt?: string;
2027
+ originSystem?: string;
2028
+ }
2029
+
2030
+ export declare interface ImageContent {
2031
+ type: "image";
2032
+ source: {
2033
+ type: "base64";
2034
+ media_type: string;
2035
+ data: string;
2036
+ };
2037
+ }
2038
+
2039
+ declare type _InboxServerMessages = ContactsInviteResponse | AssistantInboxEscalationResponse;
2040
+
2041
+ declare interface IngressConfigResponse {
2042
+ type: "ingress_config_response";
2043
+ enabled: boolean;
2044
+ publicBaseUrl: string;
2045
+ /** Read-only gateway target computed from GATEWAY_PORT env var (default 7830) + loopback host. */
2046
+ localGatewayTarget: string;
2047
+ /**
2048
+ * When true, this assistant uses platform-managed callback routing.
2049
+ * Webhook delivery is handled by the platform — no local tunnel or
2050
+ * ngrok setup is needed. `publicBaseUrl` reflects the platform callback URL.
2051
+ */
2052
+ managedCallbacks?: boolean;
2053
+ success: boolean;
2054
+ error?: string;
2055
+ }
2056
+
2057
+ declare interface IntegrationConnectResult {
2058
+ type: "integration_connect_result";
2059
+ integrationId: string;
2060
+ success: boolean;
2061
+ accountInfo?: string | null;
2062
+ error?: string | null;
2063
+ setupRequired?: boolean;
2064
+ setupHint?: string;
2065
+ }
2066
+
2067
+ declare interface IntegrationListResponse {
2068
+ type: "integration_list_response";
2069
+ integrations: Array<{
2070
+ id: string;
2071
+ connected: boolean;
2072
+ accountInfo?: string | null;
2073
+ connectedAt?: number | null;
2074
+ lastUsed?: number | null;
2075
+ error?: string | null;
2076
+ }>;
2077
+ }
2078
+
2079
+ declare type _IntegrationsServerMessages = SlackWebhookConfigResponse | IngressConfigResponse | PlatformConfigResponse | VercelApiConfigResponse | TelegramConfigResponse | ChannelVerificationSessionResponse | IntegrationListResponse | IntegrationConnectResult | OAuthConnectResultResponse | OpenUrlEvent | NavigateSettingsEvent | ShowPlatformLogin | PlatformDisconnected;
2080
+
2081
+ declare type InteractionResolvedEvent = z.infer<typeof InteractionResolvedEventSchema>;
2082
+
2083
+ declare const InteractionResolvedEventSchema: z.ZodObject<{
2084
+ type: z.ZodLiteral<"interaction_resolved">;
2085
+ requestId: z.ZodString;
2086
+ conversationId: z.ZodString;
2087
+ state: z.ZodEnum<{
2088
+ approved: "approved";
2089
+ cancelled: "cancelled";
2090
+ rejected: "rejected";
2091
+ answered: "answered";
2092
+ superseded: "superseded";
2093
+ }>;
2094
+ kind: z.ZodString;
2095
+ }, z.core.$strip>;
2096
+
2097
+ declare const INTERFACE_IDS: readonly ["macos", "ios", "cli", "telegram", "phone", "web", "whatsapp", "slack", "email", "chrome-extension", "a2a"];
2098
+
2099
+ declare type InterfaceId = (typeof INTERFACE_IDS)[number];
2100
+
2101
+ declare interface ListItem {
2102
+ id: string;
2103
+ title: string;
2104
+ subtitle?: string;
2105
+ icon?: string;
2106
+ selected?: boolean;
2107
+ }
2108
+
2109
+ declare interface ListSurfaceData {
2110
+ items: ListItem[];
2111
+ selectionMode: "single" | "multiple" | "none";
2112
+ }
2113
+
2114
+ declare type LLMCallSite = z.infer<typeof LLMCallSiteEnum>;
2115
+
2116
+ /**
2117
+ * The complete set of LLM call-site identifiers the assistant emits.
2118
+ *
2119
+ * Each ID corresponds to a logical place in the codebase that produces an LLM
2120
+ * request. Adding or removing a call site is a config-schema change — keep
2121
+ * this list in sync with the resolver and registry (introduced in PR 2).
2122
+ */
2123
+ declare const LLMCallSiteEnum: z.ZodEnum<{
2124
+ mainAgent: "mainAgent";
2125
+ subagentSpawn: "subagentSpawn";
2126
+ heartbeatAgent: "heartbeatAgent";
2127
+ filingAgent: "filingAgent";
2128
+ compactionAgent: "compactionAgent";
2129
+ analyzeConversation: "analyzeConversation";
2130
+ callAgent: "callAgent";
2131
+ memoryExtraction: "memoryExtraction";
2132
+ memoryConsolidation: "memoryConsolidation";
2133
+ memoryRetrieval: "memoryRetrieval";
2134
+ memoryV2Migration: "memoryV2Migration";
2135
+ memoryV2Sweep: "memoryV2Sweep";
2136
+ memoryRouter: "memoryRouter";
2137
+ memoryV3SelectL2: "memoryV3SelectL2";
2138
+ memoryV2Consolidation: "memoryV2Consolidation";
2139
+ memoryRetrospective: "memoryRetrospective";
2140
+ recall: "recall";
2141
+ narrativeRefinement: "narrativeRefinement";
2142
+ patternScan: "patternScan";
2143
+ conversationSummarization: "conversationSummarization";
2144
+ conversationStarters: "conversationStarters";
2145
+ replySuggestion: "replySuggestion";
2146
+ conversationTitle: "conversationTitle";
2147
+ commitMessage: "commitMessage";
2148
+ identityIntro: "identityIntro";
2149
+ emptyStateGreeting: "emptyStateGreeting";
2150
+ notificationDecision: "notificationDecision";
2151
+ preferenceExtraction: "preferenceExtraction";
2152
+ guardianQuestionCopy: "guardianQuestionCopy";
2153
+ approvalCopy: "approvalCopy";
2154
+ approvalConversation: "approvalConversation";
2155
+ interactionClassifier: "interactionClassifier";
2156
+ styleAnalyzer: "styleAnalyzer";
2157
+ inviteInstructionGenerator: "inviteInstructionGenerator";
2158
+ skillCategoryInference: "skillCategoryInference";
2159
+ meetConsentMonitor: "meetConsentMonitor";
2160
+ meetChatOpportunity: "meetChatOpportunity";
2161
+ inference: "inference";
2162
+ trustRuleSuggestion: "trustRuleSuggestion";
2163
+ homeGreeting: "homeGreeting";
2164
+ homeSuggestedPrompts: "homeSuggestedPrompts";
2165
+ }>;
2166
+
2167
+ /**
2168
+ * The assistant successfully posted a chat message into the meeting via
2169
+ * the bot's `/send_chat` endpoint. Emitted once per successful send so
2170
+ * SSE-subscribed clients can render the outbound chat without waiting for
2171
+ * the bot to echo it back through the transcript/chat stream.
2172
+ */
2173
+ declare interface MeetChatSent {
2174
+ type: "meet.chat_sent";
2175
+ meetingId: string;
2176
+ /** The text that was posted into the meeting's chat. */
2177
+ text: string;
2178
+ }
2179
+
2180
+ /** The bot hit a non-recoverable error (container crash, join failure, etc.). */
2181
+ declare interface MeetError {
2182
+ type: "meet.error";
2183
+ meetingId: string;
2184
+ /** Human-readable error detail. */
2185
+ detail: string;
2186
+ }
2187
+
2188
+ /** The bot has successfully joined and is live in the meeting. */
2189
+ declare interface MeetJoined {
2190
+ type: "meet.joined";
2191
+ meetingId: string;
2192
+ }
2193
+
2194
+ /** The bot has started attempting to join a meeting. */
2195
+ declare interface MeetJoining {
2196
+ type: "meet.joining";
2197
+ meetingId: string;
2198
+ /** The Meet URL the bot was asked to join. */
2199
+ url: string;
2200
+ }
2201
+
2202
+ /** The bot has left the meeting. */
2203
+ declare interface MeetLeft {
2204
+ type: "meet.left";
2205
+ meetingId: string;
2206
+ /** Free-form reason passed to `leave()` (e.g. "user-requested", "timeout"). */
2207
+ reason: string;
2208
+ }
2209
+
2210
+ /**
2211
+ * Meet — server → client push messages for live meeting state.
2212
+ *
2213
+ * Emitted by the assistant daemon as the Meet-bot progresses through its
2214
+ * lifecycle (joining → joined → left) and as in-meeting state changes
2215
+ * (participants, active speaker, transcript chunks).
2216
+ *
2217
+ * Keep payloads small and client-actionable: these events power the
2218
+ * macOS "In meeting" status panel and the conversation bridge's live
2219
+ * transcript feed. A client that missed an event can always refetch
2220
+ * authoritative state from the daemon's HTTP routes.
2221
+ */
2222
+ /** A single participant in a meeting. Shape mirrors the wire-level type. */
2223
+ declare interface MeetParticipant {
2224
+ /** Stable participant identifier (provider-specific). */
2225
+ id: string;
2226
+ /** Display name of the participant. */
2227
+ name: string;
2228
+ /** Whether the participant is the meeting host. */
2229
+ isHost?: boolean;
2230
+ /** Whether the participant is the bot itself. */
2231
+ isSelf?: boolean;
2232
+ }
2233
+
2234
+ /** Participants joined and/or left the meeting since the last snapshot. */
2235
+ declare interface MeetParticipantChanged {
2236
+ type: "meet.participant_changed";
2237
+ meetingId: string;
2238
+ /** Participants who joined since the last snapshot. */
2239
+ joined: MeetParticipant[];
2240
+ /** Participants who left since the last snapshot. */
2241
+ left: MeetParticipant[];
2242
+ }
2243
+
2244
+ declare type _MeetServerMessages = MeetJoining | MeetJoined | MeetParticipantChanged | MeetSpeakerChanged | MeetTranscriptChunk | MeetLeft | MeetChatSent | MeetError | MeetSpeakingStarted | MeetSpeakingEnded;
2245
+
2246
+ /** The active speaker in the meeting changed. */
2247
+ declare interface MeetSpeakerChanged {
2248
+ type: "meet.speaker_changed";
2249
+ meetingId: string;
2250
+ /** Stable speaker identifier for the new active speaker. */
2251
+ speakerId: string;
2252
+ /** Display name of the new active speaker. */
2253
+ speakerName: string;
2254
+ }
2255
+
2256
+ /**
2257
+ * The assistant has finished (or cancelled) a TTS playback stream. Fired
2258
+ * after the bot-side playback request settles — whether normally, via an
2259
+ * explicit cancel, or due to an upstream error.
2260
+ */
2261
+ declare interface MeetSpeakingEnded {
2262
+ type: "meet.speaking_ended";
2263
+ meetingId: string;
2264
+ /** Opaque stream identifier — matches `meet.speaking_started.streamId`. */
2265
+ streamId: string;
2266
+ /** Why the stream ended: natural completion, caller-initiated cancel, or an upstream error. */
2267
+ reason: "completed" | "cancelled" | "error";
2268
+ }
2269
+
2270
+ /**
2271
+ * The assistant has begun speaking into the meeting via the TTS bridge. Fired
2272
+ * once per {@link MeetSessionManager.speak} invocation immediately before the
2273
+ * synthesis stream starts flowing to the bot's `/play_audio` endpoint. Useful
2274
+ * for clients that want to render a "speaking …" indicator.
2275
+ */
2276
+ declare interface MeetSpeakingStarted {
2277
+ type: "meet.speaking_started";
2278
+ meetingId: string;
2279
+ /** Opaque stream identifier — matches `meet.speaking_ended.streamId`. */
2280
+ streamId: string;
2281
+ }
2282
+
2283
+ /**
2284
+ * A finalized chunk of transcribed speech. Interim chunks are filtered
2285
+ * out before publication so clients only render stable text.
2286
+ */
2287
+ declare interface MeetTranscriptChunk {
2288
+ type: "meet.transcript_chunk";
2289
+ meetingId: string;
2290
+ /** The transcribed text. */
2291
+ text: string;
2292
+ /** Human-readable speaker label, if the ASR provided one. */
2293
+ speakerLabel?: string;
2294
+ /** Stable speaker identifier across the meeting, if available. */
2295
+ speakerId?: string;
2296
+ /** ASR confidence in [0, 1], if available. */
2297
+ confidence?: number;
2298
+ }
2299
+
2300
+ declare interface MemoryRecalled {
2301
+ type: "memory_recalled";
2302
+ provider: string;
2303
+ model: string;
2304
+ degradation?: MemoryRecalledDegradation;
2305
+ semanticHits: number;
2306
+ tier1Count: number;
2307
+ tier2Count: number;
2308
+ hybridSearchLatencyMs: number;
2309
+ sparseVectorUsed: boolean;
2310
+ mergedCount: number;
2311
+ selectedCount: number;
2312
+ injectedTokens: number;
2313
+ latencyMs: number;
2314
+ topCandidates: MemoryRecalledCandidateDebug[];
2315
+ }
2316
+
2317
+ declare interface MemoryRecalledCandidateDebug {
2318
+ key: string;
2319
+ type: string;
2320
+ kind: string;
2321
+ finalScore: number;
2322
+ semantic: number;
2323
+ recency: number;
2324
+ }
2325
+
2326
+ declare interface MemoryRecalledDegradation {
2327
+ semanticUnavailable: boolean;
2328
+ reason: string;
2329
+ fallbackSources: string[];
2330
+ }
2331
+
2332
+ declare type _MemoryServerMessages = MemoryRecalled | MemoryStatus;
2333
+
2334
+ declare interface MemoryStatus {
2335
+ type: "memory_status";
2336
+ enabled: boolean;
2337
+ degraded: boolean;
2338
+ degradation?: MemoryRecalledDegradation;
2339
+ reason?: string;
2340
+ provider?: string;
2341
+ model?: string;
2342
+ }
2343
+
2344
+ export declare interface Message {
2345
+ role: "user" | "assistant";
2346
+ content: ContentBlock[];
2347
+ }
2348
+
2349
+ declare type MessageCompleteEvent = z.infer<typeof MessageCompleteEventSchema>;
2350
+
2351
+ declare const MessageCompleteEventSchema: z.ZodObject<{
2352
+ type: z.ZodLiteral<"message_complete">;
2353
+ messageId: z.ZodOptional<z.ZodString>;
2354
+ conversationId: z.ZodOptional<z.ZodString>;
2355
+ source: z.ZodOptional<z.ZodEnum<{
2356
+ main: "main";
2357
+ aux: "aux";
2358
+ }>>;
2359
+ attachments: z.ZodOptional<z.ZodArray<z.ZodObject<{
2360
+ id: z.ZodOptional<z.ZodString>;
2361
+ filename: z.ZodString;
2362
+ mimeType: z.ZodString;
2363
+ data: z.ZodString;
2364
+ sourceType: z.ZodOptional<z.ZodEnum<{
2365
+ host_file: "host_file";
2366
+ sandbox_file: "sandbox_file";
2367
+ tool_block: "tool_block";
2368
+ }>>;
2369
+ sizeBytes: z.ZodOptional<z.ZodNumber>;
2370
+ thumbnailData: z.ZodOptional<z.ZodString>;
2371
+ fileBacked: z.ZodOptional<z.ZodBoolean>;
2372
+ filePath: z.ZodOptional<z.ZodString>;
2373
+ }, z.core.$strip>>>;
2374
+ attachmentWarnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
2375
+ }, z.core.$strip>;
2376
+
2377
+ declare interface MessageContentResponse {
2378
+ type: "message_content_response";
2379
+ conversationId: string;
2380
+ messageId: string;
2381
+ text?: string;
2382
+ toolCalls?: Array<{
2383
+ name: string;
2384
+ result?: string;
2385
+ input?: Record<string, unknown>;
2386
+ }>;
2387
+ }
2388
+
2389
+ declare type MessageDequeuedEvent = z.infer<typeof MessageDequeuedEventSchema>;
2390
+
2391
+ declare const MessageDequeuedEventSchema: z.ZodObject<{
2392
+ type: z.ZodLiteral<"message_dequeued">;
2393
+ conversationId: z.ZodString;
2394
+ requestId: z.ZodString;
2395
+ }, z.core.$strip>;
2396
+
2397
+ declare type MessageQueuedDeletedEvent = z.infer<typeof MessageQueuedDeletedEventSchema>;
2398
+
2399
+ declare const MessageQueuedDeletedEventSchema: z.ZodObject<{
2400
+ type: z.ZodLiteral<"message_queued_deleted">;
2401
+ conversationId: z.ZodString;
2402
+ requestId: z.ZodString;
2403
+ }, z.core.$strip>;
2404
+
2405
+ declare type MessageQueuedEvent = z.infer<typeof MessageQueuedEventSchema>;
2406
+
2407
+ declare const MessageQueuedEventSchema: z.ZodObject<{
2408
+ type: z.ZodLiteral<"message_queued">;
2409
+ conversationId: z.ZodString;
2410
+ requestId: z.ZodString;
2411
+ position: z.ZodNumber;
2412
+ }, z.core.$strip>;
2413
+
2414
+ declare type MessageRequestCompleteEvent = z.infer<typeof MessageRequestCompleteEventSchema>;
2415
+
2416
+ declare const MessageRequestCompleteEventSchema: z.ZodObject<{
2417
+ type: z.ZodLiteral<"message_request_complete">;
2418
+ conversationId: z.ZodString;
2419
+ requestId: z.ZodString;
2420
+ runStillActive: z.ZodOptional<z.ZodBoolean>;
2421
+ }, z.core.$strip>;
2422
+
2423
+ declare type _MessagesServerMessages = UserMessageEchoEvent | AssistantTurnStartEvent | AssistantTextDeltaEvent | AssistantThinkingDelta | ToolUseStartEvent | ToolUsePreviewStartEvent | ToolOutputChunkEvent | ToolInputDelta | ToolResultEvent | ConfirmationRequestEvent | SecretRequestEvent | QuestionRequestEvent | MessageCompleteEvent | ErrorEvent_2 | MessageQueuedEvent | MessageDequeuedEvent | MessageRequestCompleteEvent | MessageQueuedDeletedEvent | MessageSteered | SuggestionResponse | TraceEvent | ConfirmationStateChanged | AssistantActivityStateEvent | TurnProfileAutoRoutedEvent | ConversationInferenceProfileUpdated | InteractionResolvedEvent;
2424
+
2425
+ declare interface MessageSteered {
2426
+ type: "message_steered";
2427
+ conversationId: string;
2428
+ requestId: string;
2429
+ }
2430
+
2431
+ declare interface ModelInfo {
2432
+ type: "model_info";
2433
+ conversationId?: string;
2434
+ model: string;
2435
+ provider: string;
2436
+ configuredProviders?: string[];
2437
+ availableModels?: Array<{
2438
+ id: string;
2439
+ displayName: string;
2440
+ }>;
2441
+ allProviders?: Array<{
2442
+ id: string;
2443
+ displayName: string;
2444
+ models: Array<{
2445
+ id: string;
2446
+ displayName: string;
2447
+ }>;
2448
+ defaultModel: string;
2449
+ apiKeyUrl?: string;
2450
+ apiKeyPlaceholder?: string;
2451
+ }>;
2452
+ }
2453
+
2454
+ declare type NavigateSettingsEvent = z.infer<typeof NavigateSettingsEventSchema>;
2455
+
2456
+ declare const NavigateSettingsEventSchema: z.ZodObject<{
2457
+ type: z.ZodLiteral<"navigate_settings">;
2458
+ tab: z.ZodString;
2459
+ }, z.core.$strip>;
2460
+
2461
+ /** Server push — broadcast when a notification creates a new vellum conversation. */
2462
+ declare interface NotificationConversationCreated {
2463
+ type: "notification_conversation_created";
2464
+ conversationId: string;
2465
+ title: string;
2466
+ sourceEventName: string;
2467
+ /**
2468
+ * When set, this conversation was created for a guardian-sensitive notification
2469
+ * and should only be surfaced by clients bound to this guardian identity.
2470
+ */
2471
+ targetGuardianPrincipalId?: string;
2472
+ /**
2473
+ * Conversation group identifier propagated from the signal producer.
2474
+ * Clients use this to place the conversation in the correct sidebar folder
2475
+ * (e.g. "system:scheduled" for schedule completion threads).
2476
+ */
2477
+ groupId?: string;
2478
+ /**
2479
+ * Semantic source of the conversation (e.g. "schedule", "reminder").
2480
+ * Allows clients to override the default "notification" source so the
2481
+ * conversation is attributed correctly.
2482
+ */
2483
+ source?: string;
2484
+ /**
2485
+ * Mirrors `NotificationIntent.silent`. When true the client must not
2486
+ * post a fallback OS banner for this conversation — the sidebar entry
2487
+ * still appears, but the always-on inbox is the only surfaced channel.
2488
+ * Derived from the originating signal's `attentionHints.urgency`.
2489
+ */
2490
+ silent?: boolean;
2491
+ }
2492
+
2493
+ declare type NotificationIntentEvent = z.infer<typeof NotificationIntentEventSchema>;
2494
+
2495
+ declare const NotificationIntentEventSchema: z.ZodObject<{
2496
+ type: z.ZodLiteral<"notification_intent">;
2497
+ sourceEventName: z.ZodString;
2498
+ title: z.ZodString;
2499
+ body: z.ZodString;
2500
+ deliveryId: z.ZodOptional<z.ZodString>;
2501
+ deepLinkMetadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2502
+ targetGuardianPrincipalId: z.ZodOptional<z.ZodString>;
2503
+ silent: z.ZodOptional<z.ZodBoolean>;
2504
+ }, z.core.$strip>;
2505
+
2506
+ declare type _NotificationsServerMessages = NotificationIntentEvent | NotificationConversationCreated;
2507
+
2508
+ declare interface OAuthConnectResultResponse {
2509
+ type: "oauth_connect_result";
2510
+ success: boolean;
2511
+ service?: string;
2512
+ grantedScopes?: string[];
2513
+ accountInfo?: string;
2514
+ error?: string;
2515
+ }
2516
+
2517
+ declare interface OAuthConnectSurfaceData {
2518
+ /** OAuth provider key from the managed provider catalog, e.g. "google". */
2519
+ providerKey: string;
2520
+ /** Optional display label. The client falls back to the provider catalog. */
2521
+ displayName?: string;
2522
+ /** Optional helper text. The client falls back to the provider catalog. */
2523
+ description?: string;
2524
+ /** Optional provider logo URL. The client falls back to the provider catalog. */
2525
+ logoUrl?: string | null;
2526
+ }
2527
+
2528
+ declare interface OpenBundleResponse {
2529
+ type: "open_bundle_response";
2530
+ manifest: {
2531
+ format_version: number;
2532
+ name: string;
2533
+ description?: string;
2534
+ icon?: string;
2535
+ created_at: string;
2536
+ created_by: string;
2537
+ entry: string;
2538
+ capabilities: string[];
2539
+ };
2540
+ scanResult: {
2541
+ passed: boolean;
2542
+ blocked: string[];
2543
+ warnings: string[];
2544
+ };
2545
+ signatureResult: {
2546
+ trustTier: "verified" | "signed" | "unsigned" | "tampered";
2547
+ signerKeyId?: string;
2548
+ signerDisplayName?: string;
2549
+ signerAccount?: string;
2550
+ };
2551
+ bundleSizeBytes: number;
2552
+ }
2553
+
2554
+ /**
2555
+ * Server push — instructs the client to open and focus a conversation. If
2556
+ * the conversation isn't already present in the client's sidebar list (e.g.
2557
+ * it was just created via `POST /v1/conversations`), the client should stub
2558
+ * a sidebar entry using the provided `title` before navigating.
2559
+ */
2560
+ declare interface OpenConversation {
2561
+ type: "open_conversation";
2562
+ conversationId: string;
2563
+ /** Optional conversation title; supplied when the client may not yet have the conversation in its list. */
2564
+ title?: string;
2565
+ /** Optional message ID to scroll to after focus. */
2566
+ anchorMessageId?: string;
2567
+ /** When `false`, the client should register the conversation in its sidebar (so it's visible and navigable) but must NOT switch focus to it. Omitting the field defaults to `true` for backward compatibility with existing single-target 'jump to conversation' callers. */
2568
+ focus?: boolean;
2569
+ }
2570
+
2571
+ declare type OpenUrlEvent = z.infer<typeof OpenUrlEventSchema>;
2572
+
2573
+ declare const OpenUrlEventSchema: z.ZodObject<{
2574
+ type: z.ZodLiteral<"open_url">;
2575
+ url: z.ZodString;
2576
+ title: z.ZodOptional<z.ZodString>;
2577
+ conversationId: z.ZodOptional<z.ZodString>;
2578
+ }, z.core.$strip>;
2579
+
2580
+ /**
2581
+ * Identifies which extension owns a tool (skill / plugin / MCP server).
2582
+ * Tracked by the tool registry keyed by tool name, not stored on the `Tool`
2583
+ * object itself — query via {@link ../tools/registry.getToolOwner}.
2584
+ */
2585
+ declare interface OwnerInfo {
2586
+ kind: OwnerKind;
2587
+ /** ID of the owning extension (skill id / plugin name / MCP server id / workspace path). */
2588
+ id: string;
2589
+ }
2590
+
2591
+ /** The kind of extension that owns a tool. Core tools have no owner. */
2592
+ declare type OwnerKind = "skill" | "mcp" | "plugin" | "workspace";
2593
+
2594
+ declare interface PartnerAudit {
2595
+ risk: RiskLevel_2;
2596
+ alerts?: number;
2597
+ score?: number;
2598
+ analyzedAt: string;
2599
+ }
2600
+
2601
+ declare interface PlatformConfigResponse {
2602
+ type: "platform_config_response";
2603
+ baseUrl: string;
2604
+ success: boolean;
2605
+ error?: string;
2606
+ }
2607
+
2608
+ declare interface PlatformDisconnected {
2609
+ type: "platform_disconnected";
2610
+ }
2611
+
2612
+ /**
2613
+ * A plugin lifecycle hook. Receives a per-lifecycle context shape and may
2614
+ * either mutate `ctx` in place (returning `void`) or return a *partial*
2615
+ * context whose fields are merged onto the threaded context — only the keys
2616
+ * it returns are overwritten, every other field is preserved. Returning a
2617
+ * partial lets a hook edit just the subset of fields it cares about without
2618
+ * having to re-specify the rest. The merged context is threaded to the next
2619
+ * hook in the chain (e.g. `user-prompt-submit`).
2620
+ *
2621
+ * Because an omitted key means "keep the existing value", every field on a
2622
+ * context shape is required (no `?`-optional or `| undefined` members): a
2623
+ * present key always carries a concrete value, so "absent from the returned
2624
+ * partial" is never ambiguous with "explicitly cleared". Fields that can be
2625
+ * empty model that with `| null`, not `| undefined`.
2626
+ *
2627
+ * Each known hook key has a documented context shape:
2628
+ * - `init` — {@link PluginInitContext}
2629
+ * - `shutdown` — {@link PluginShutdownContext}
2630
+ * - `user-prompt-submit` — {@link UserPromptSubmitContext}
2631
+ * - `pre-model-call` — {@link PreModelCallContext}
2632
+ * - `post-tool-use` — {@link PostToolUseContext}
2633
+ * - `stop` — {@link StopContext}
2634
+ * - `post-model-call` — {@link PostModelCallContext}
2635
+ */
2636
+ export declare type PluginHookFn<TCtx = unknown> = (ctx: TCtx) => Promise<Partial<TCtx> | void>;
2637
+
2638
+ /**
2639
+ * Context passed to `Plugin.init()` during bootstrap. Carries resolved
2640
+ * config/credentials, a pino-compatible logger scoped to the plugin, a
2641
+ * per-plugin writable data directory, and the assistant's version metadata.
2642
+ */
2643
+ export declare interface PluginInitContext {
2644
+ /** Parsed config for this plugin (may be `unknown` until the manifest validates). */
2645
+ config: unknown;
2646
+ /** Resolved credential values keyed by the entries of `manifest.requiresCredential`. */
2647
+ credentials: Record<string, string>;
2648
+ /** Pino-compatible child logger bound to `{ plugin: <name> }`. */
2649
+ logger: PluginLogger;
2650
+ /** Absolute path to `<workspaceDir>/plugins-data/<plugin>/` (created by bootstrap). */
2651
+ pluginStorageDir: string;
2652
+ /**
2653
+ * Assistant semver. Plugins can compare against this for defensive
2654
+ * runtime checks — but the canonical compat contract is the host
2655
+ * version against the plugin's `peerDependencies["@vellumai/plugin-api"]`
2656
+ * semver range, enforced at load time by the external-plugin loader.
2657
+ */
2658
+ assistantVersion: string;
2659
+ }
2660
+
2661
+ /**
2662
+ * Minimal pino-compatible logger surface handed to plugin hooks. The host
2663
+ * supplies a pino child logger bound to `{ plugin: <name> }`; this
2664
+ * interface intentionally captures only the two call shapes plugin code
2665
+ * needs (structured object + optional message), so the public surface
2666
+ * doesn't take a dependency on pino's full type machinery.
2667
+ *
2668
+ * Each method accepts a structured-fields object followed by an optional
2669
+ * message string. Plugin authors that need pino's wider API (`child()`,
2670
+ * `level`, etc.) can cast to their own narrower interface in plugin code
2671
+ * — but the canonical contract here covers the 99% case.
2672
+ */
2673
+ export declare interface PluginLogger {
2674
+ info(obj: Record<string, unknown>, msg?: string): void;
2675
+ warn(obj: Record<string, unknown>, msg?: string): void;
2676
+ error(obj: Record<string, unknown>, msg?: string): void;
2677
+ debug(obj: Record<string, unknown>, msg?: string): void;
2678
+ }
2679
+
2680
+ /**
2681
+ * Context passed to the `shutdown` hook during daemon teardown. Kept
2682
+ * intentionally narrower than {@link PluginInitContext} — most teardown
2683
+ * paths only need to know which assistant version they're shutting
2684
+ * down against (e.g. for version-conditional cleanup of state files
2685
+ * written by a previous boot).
2686
+ *
2687
+ * Additional fields may be added as concrete plugin needs surface; the
2688
+ * `assistantVersion` field mirrors the init context's so plugins that
2689
+ * stash a version stamp at init can compare against the same name on
2690
+ * tear-down without keeping their own copy.
2691
+ */
2692
+ export declare interface PluginShutdownContext {
2693
+ /** Assistant semver for compatibility checks inside the plugin. */
2694
+ assistantVersion: string;
2695
+ }
2696
+
2697
+ declare interface PongMessage {
2698
+ type: "pong";
2699
+ }
2700
+
2701
+ /**
2702
+ * Context passed to the `post-compact` hook. Fires after the agent loop
2703
+ * compacts a conversation mid-turn — once the running history has been
2704
+ * summarized down to fit the context window, and before the turn resumes.
2705
+ *
2706
+ * Compaction strips the turn's runtime injections (scratchpad, retrieved
2707
+ * memory, workspace context, transcript snapshots) along with the raw messages
2708
+ * it summarizes. This hook's job is to re-apply whatever injected context must
2709
+ * survive onto the freshly compacted history before the next provider call.
2710
+ * The default memory-retrieval plugin contributes a hook here that re-injects
2711
+ * its memory blocks and re-tracks the memory graph; user hooks can re-apply
2712
+ * their own injected context the same way.
2713
+ *
2714
+ * The hook re-injects by mutating `history` in place (or returning a new
2715
+ * context with a replacement `history`) — see {@link PluginHookFn}'s
2716
+ * polymorphic return shape. The agent loop reads the settled `history` back off
2717
+ * the context and resumes the turn from it. Multiple plugins' hooks chain in
2718
+ * registration order, each seeing the previous plugin's edits.
2719
+ */
2720
+ export declare interface PostCompactContext {
2721
+ /**
2722
+ * The compacted message history to re-inject onto. Hooks mutate this in
2723
+ * place (or return a new context with a replacement) to re-apply context
2724
+ * that compaction stripped; the loop resumes the turn from the settled
2725
+ * value.
2726
+ */
2727
+ history: Message[];
2728
+ /**
2729
+ * Stable ID for the request that drives this turn. Hooks that perform
2730
+ * runtime injection forward it onto the injector turn context so the
2731
+ * re-applied blocks are attributed to the originating request; it is fixed
2732
+ * for the turn and cannot be recovered from the message history.
2733
+ */
2734
+ readonly requestId: string;
2735
+ /** Conversation ID the turn being compacted is scoped to. */
2736
+ readonly conversationId: string;
2737
+ /**
2738
+ * Whether the turn has no human present to answer clarification questions
2739
+ * (e.g. a scheduled, background, or headless run). Mirrors the field of the
2740
+ * same name on {@link UserPromptSubmitContext}: resolved once at turn start
2741
+ * so re-injection reflects the turn's interactivity rather than mutable
2742
+ * client-presence state that can flip mid-turn.
2743
+ */
2744
+ readonly isNonInteractive: boolean;
2745
+ /**
2746
+ * Active inference profile key to surface in the re-injected context, or
2747
+ * `null` when the profile is unchanged since the one last announced to the
2748
+ * model. Mirrors {@link UserPromptSubmitContext.modelProfileKey}: hooks that
2749
+ * emit the `model_profile` grounding line resolve the human-readable label
2750
+ * from this key rather than receiving the rendered string.
2751
+ */
2752
+ readonly modelProfileKey: string | null;
2753
+ /**
2754
+ * Volume of runtime injection to re-apply. `"full"` restores the complete
2755
+ * runtime context; `"minimal"` is the reduced volume overflow recovery's
2756
+ * injection-downgrade rung selects to keep the re-injected prompt small.
2757
+ * Defaults to `"full"` when omitted.
2758
+ */
2759
+ readonly injectionMode?: "full" | "minimal";
2760
+ }
2761
+
2762
+ /**
2763
+ * Context passed to the `post-model-call` hook. Fires at every model-call
2764
+ * outcome — the seam where the loop reacts to what the provider returned:
2765
+ *
2766
+ * - **Finalized reply.** The provider returned a message. {@link error} is
2767
+ * absent, {@link content} holds the reply's blocks (mutable — the loop adopts
2768
+ * the hook's result as the persisted and streamed message), and
2769
+ * {@link stopReason} carries the provider's stop reason. Fires once per model
2770
+ * call, including tool-bearing turns (a reply can carry both text and
2771
+ * `tool_use`), so a hook should transform only the blocks it owns and leave
2772
+ * others — notably `tool_use` — intact.
2773
+ * - **Provider rejection.** The call threw before any reply existed.
2774
+ * {@link error} holds the rejection, {@link content} is empty, and
2775
+ * {@link stopReason} is `null`. A hook that recognizes the rejection may
2776
+ * repair {@link messages} and set {@link decision} to `"continue"` to retry;
2777
+ * hooks that only act on a real reply must guard on {@link error} and return
2778
+ * early.
2779
+ *
2780
+ * The retry decision is honored only at actionable outcomes — a no-tool reply
2781
+ * or a `mainAgent` rejection — and is ignored on tool-bearing turns (the loop
2782
+ * already runs the tools) and non-`mainAgent` call sites. Runs for every
2783
+ * finalized message regardless of call site; hooks MUST self-gate on
2784
+ * {@link callSite} / {@link conversationId}. Mutate in place or return a new
2785
+ * context; throwing is contained by the loop (the original content is kept and
2786
+ * the outcome is treated as `"stop"`). Multiple plugins' hooks chain in
2787
+ * registration order — each sees the previous hook's `decision` and mutations.
2788
+ */
2789
+ export declare interface PostModelCallContext {
2790
+ /** Conversation ID the message belongs to. */
2791
+ readonly conversationId: string;
2792
+ /** The call site this message serves — `"mainAgent"` for the user-facing reply; `null` when untagged. */
2793
+ readonly callSite: LLMCallSite | null;
2794
+ /**
2795
+ * The finalized message content. Mutable — transform the text blocks and leave
2796
+ * `tool_use` (and other non-text blocks) intact. Empty on a provider rejection.
2797
+ */
2798
+ content: ContentBlock[];
2799
+ /**
2800
+ * Full conversation history: the inbound conversation followed by every
2801
+ * message produced this run. A hook that sets {@link decision} to
2802
+ * `"continue"` leaves this as the history the next iteration should send — a
2803
+ * finalized-reply hook appends its follow-up turn (e.g. a nudge `user`
2804
+ * message); a rejection-recovery hook replaces the array with a repaired one.
2805
+ */
2806
+ messages: Message[];
2807
+ /** Provider-reported stop reason for the turn; `null` when not reported. */
2808
+ readonly stopReason: string | null;
2809
+ /**
2810
+ * The provider rejection that ended the call, on a rejection outcome. Absent
2811
+ * on a finalized reply. A hook that recovers from a specific rejection class
2812
+ * inspects this and may repair {@link messages} and set {@link decision} to
2813
+ * `"continue"`; hooks that only act on a real reply must return early when it
2814
+ * is present.
2815
+ */
2816
+ readonly error?: Error;
2817
+ /**
2818
+ * Seeded to `"stop"`. A hook sets it to `"continue"` to force another loop
2819
+ * iteration; later hooks in the chain may override it. Honored only at
2820
+ * actionable outcomes (see the interface docstring).
2821
+ */
2822
+ decision: PostModelCallDecision;
2823
+ /** Logger scoped to the current turn (tag structured fields with `{ plugin }`). */
2824
+ readonly logger: PluginLogger;
2825
+ }
2826
+
2827
+ /**
2828
+ * Binary outcome of the `post-model-call` hook. The agent loop seeds it to
2829
+ * `"stop"` and acts on the value the chain settles on:
2830
+ *
2831
+ * - `"stop"` — accept the model-call outcome. On a finalized reply the loop
2832
+ * keeps the (possibly transformed) message; on a rejection it
2833
+ * surfaces the error. This is the default.
2834
+ * - `"continue"` — re-query the model. The hook is responsible for leaving
2835
+ * {@link PostModelCallContext.messages} as the history the next
2836
+ * iteration should send (append a follow-up turn, or replace
2837
+ * the array with a repaired one).
2838
+ */
2839
+ export declare type PostModelCallDecision = "continue" | "stop";
2840
+
2841
+ /**
2842
+ * Context passed to the `post-tool-use` hook. Fires once per tool result —
2843
+ * after the tool returns and before the result is appended to the message
2844
+ * history sent to the provider. With several tools dispatched in a single
2845
+ * turn, the hook fires once per result, in tool-use order.
2846
+ *
2847
+ * The hook may transform the result either by mutating `toolResponse` in
2848
+ * place (e.g. reassigning `toolResponse.content`) or by returning a new
2849
+ * context with a fresh `toolResponse` — see {@link PluginHookFn}'s
2850
+ * polymorphic return shape. The daemon threads the final `toolResponse`
2851
+ * into the provider-bound history.
2852
+ *
2853
+ * Multiple plugins' hooks chain in registration order — each plugin's hook
2854
+ * sees the previous plugin's mutations. The default tool-result-truncate
2855
+ * plugin contributes a hook here that tail-drops oversized output to fit the
2856
+ * model's context window; the default tool-error plugin sets
2857
+ * {@link additionalContext} with retry coaching for failed results. User hooks
2858
+ * can swap in a smarter strategy (e.g. a summarizer) or observe results for
2859
+ * side effects.
2860
+ */
2861
+ export declare interface PostToolUseContext {
2862
+ /** Conversation ID the tool ran on. */
2863
+ readonly conversationId: string;
2864
+ /**
2865
+ * The tool result block. Plugins may mutate its `content` in place or
2866
+ * replace the block by returning a new context.
2867
+ */
2868
+ toolResponse: ToolResultContent;
2869
+ /**
2870
+ * Conversation history up to and including the assistant turn that issued
2871
+ * this tool call. The current result is not in it yet — it lives in
2872
+ * {@link toolResponse}. A hook reasoning about prior tool outcomes (e.g.
2873
+ * how many times a tool has failed in a row) derives that from the history
2874
+ * content rather than a precomputed counter, so the signal survives mid-run
2875
+ * compaction rewriting the array. Read-only: hooks transform the result via
2876
+ * {@link toolResponse}, not by mutating history.
2877
+ */
2878
+ readonly messages: ReadonlyArray<Message>;
2879
+ /**
2880
+ * Extra guidance for the model that is not part of the tool's output. A hook
2881
+ * sets this to surface provider-only context — e.g. retry coaching for a
2882
+ * failed result — and the daemon appends it to the provider-bound history as
2883
+ * a separate block *after* emitting the tool_result, so it reaches the model
2884
+ * without polluting the client-facing or persisted tool output. Mirrors
2885
+ * Claude Code's PostToolUse `hookSpecificOutput.additionalContext` and the
2886
+ * singular of Codex's `additional_contexts`. `null` means no extra context.
2887
+ */
2888
+ additionalContext: string | null;
2889
+ /**
2890
+ * The model's context-window size in tokens. Plugins derive their own
2891
+ * character budget from this (e.g. a share of the window) rather than
2892
+ * receiving a precomputed limit.
2893
+ */
2894
+ readonly maxInputTokens: number;
2895
+ /**
2896
+ * Logger scoped to the current turn. The same instance is shared by
2897
+ * every hook in the chain, so plugins should tag their structured log
2898
+ * fields (e.g. `{ plugin: "<name>" }`) for attribution.
2899
+ */
2900
+ readonly logger: PluginLogger;
2901
+ }
2902
+
2903
+ /**
2904
+ * Context passed to the `pre-model-call` hook. Fires immediately before each
2905
+ * provider call — once per model call within a turn, including tool-result
2906
+ * follow-up calls. Because it runs for every provider call (background, subagent,
2907
+ * and compaction work can share a conversation), hooks MUST self-gate on
2908
+ * {@link callSite} / {@link conversationId} before acting.
2909
+ *
2910
+ * A hook may edit the outbound request by replacing {@link systemPrompt}, and may
2911
+ * opt this turn into deferred output streaming via {@link deferAssistantOutput}.
2912
+ * Mutate the context in place or return a new one; throwing is contained by the
2913
+ * loop (the call proceeds with the original request).
2914
+ */
2915
+ export declare interface PreModelCallContext {
2916
+ /** Conversation ID the call belongs to. */
2917
+ readonly conversationId: string;
2918
+ /**
2919
+ * The call site this provider call serves — `"mainAgent"` for the user-facing
2920
+ * reply, or a background/utility site. `null` for call sites that don't tag one.
2921
+ */
2922
+ readonly callSite: LLMCallSite | null;
2923
+ /**
2924
+ * The system prompt about to be sent. A hook may replace it (e.g. strip or
2925
+ * append a section); the loop sends the resulting value.
2926
+ */
2927
+ systemPrompt: string | null;
2928
+ /**
2929
+ * Seeded `false`. When a hook sets it `true`, the loop suppresses this turn's
2930
+ * live assistant `text_delta` stream; a `post-model-call` hook is then
2931
+ * expected to produce the text the client sees (emitted once, after the reply
2932
+ * is finalized). Lets a plugin replace streamed output wholesale — e.g.
2933
+ * redaction that needs the full message — instead of leaking the raw stream.
2934
+ */
2935
+ deferAssistantOutput: boolean;
2936
+ /** Logger scoped to the current turn (tag structured fields with `{ plugin }`). */
2937
+ readonly logger: PluginLogger;
2938
+ }
2939
+
2940
+ declare interface ProcessEntry extends BaseSubscriberEntry {
2941
+ type: "process";
2942
+ }
2943
+
2944
+ /** Callback for proxy policy decisions requiring user confirmation. Returns true if approved. */
2945
+ declare type ProxyApprovalCallback = (request: ProxyApprovalRequest) => Promise<boolean>;
2946
+
2947
+ /** Approval request from the outbound proxy when a policy decision requires user confirmation. */
2948
+ declare interface ProxyApprovalRequest {
2949
+ decision: {
2950
+ kind: "ask_missing_credential" | "ask_unauthenticated";
2951
+ target: {
2952
+ hostname: string;
2953
+ port: number | null;
2954
+ path: string;
2955
+ scheme: "http" | "https";
2956
+ };
2957
+ /** Present when kind is "ask_missing_credential". */
2958
+ matchingPatterns?: string[];
2959
+ };
2960
+ sessionId: string;
2961
+ /** HTTP method (plain HTTP only; undefined for HTTPS CONNECT tunnels). */
2962
+ method?: string;
2963
+ /** Curated non-sensitive headers (plain HTTP only). */
2964
+ requestHeaders?: Record<string, string>;
2965
+ }
2966
+
2967
+ declare type ProxyToolResolver = (toolName: string, input: Record<string, unknown>) => Promise<ToolExecutionResult>;
2968
+
2969
+ declare interface PublishPageResponse {
2970
+ type: "publish_page_response";
2971
+ success: boolean;
2972
+ publicUrl?: string;
2973
+ deploymentId?: string;
2974
+ error?: string;
2975
+ errorCode?: string;
2976
+ }
2977
+
2978
+ declare type QuestionRequestEvent = z.infer<typeof QuestionRequestEventSchema>;
2979
+
2980
+ declare const QuestionRequestEventSchema: z.ZodObject<{
2981
+ type: z.ZodLiteral<"question_request">;
2982
+ requestId: z.ZodString;
2983
+ questions: z.ZodArray<z.ZodObject<{
2984
+ id: z.ZodString;
2985
+ question: z.ZodString;
2986
+ description: z.ZodOptional<z.ZodString>;
2987
+ options: z.ZodArray<z.ZodObject<{
2988
+ id: z.ZodString;
2989
+ label: z.ZodString;
2990
+ description: z.ZodOptional<z.ZodString>;
2991
+ }, z.core.$strip>>;
2992
+ freeTextPlaceholder: z.ZodOptional<z.ZodString>;
2993
+ }, z.core.$strip>>;
2994
+ question: z.ZodString;
2995
+ description: z.ZodOptional<z.ZodString>;
2996
+ options: z.ZodArray<z.ZodObject<{
2997
+ id: z.ZodString;
2998
+ label: z.ZodString;
2999
+ description: z.ZodOptional<z.ZodString>;
3000
+ }, z.core.$strip>>;
3001
+ freeTextPlaceholder: z.ZodOptional<z.ZodString>;
3002
+ conversationId: z.ZodOptional<z.ZodString>;
3003
+ toolUseId: z.ZodOptional<z.ZodString>;
3004
+ }, z.core.$strip>;
3005
+
3006
+ /** Recording options shared across standalone and CU recording flows. */
3007
+ declare interface RecordingOptions {
3008
+ captureScope?: "display" | "window";
3009
+ displayId?: string;
3010
+ windowId?: number;
3011
+ includeAudio?: boolean;
3012
+ includeMicrophone?: boolean;
3013
+ promptForSource?: boolean;
3014
+ }
3015
+
3016
+ /** Server → Client: pause the active recording. */
3017
+ declare interface RecordingPause {
3018
+ type: "recording_pause";
3019
+ recordingId: string;
3020
+ }
3021
+
3022
+ /** Server → Client: resume a paused recording. */
3023
+ declare interface RecordingResume {
3024
+ type: "recording_resume";
3025
+ recordingId: string;
3026
+ }
3027
+
3028
+ /** Server → Client: start a recording. */
3029
+ declare interface RecordingStart {
3030
+ type: "recording_start";
3031
+ recordingId: string;
3032
+ attachToConversationId?: string;
3033
+ options?: RecordingOptions;
3034
+ /** Operation token for restart race hardening — stale completions with mismatched tokens are rejected. */
3035
+ operationToken?: string;
3036
+ }
3037
+
3038
+ /** Server → Client: stop a recording. */
3039
+ declare interface RecordingStop {
3040
+ type: "recording_stop";
3041
+ recordingId: string;
3042
+ }
3043
+
3044
+ export declare interface RedactedThinkingContent {
3045
+ type: "redacted_thinking";
3046
+ data: string;
3047
+ }
3048
+
3049
+ declare type RelationshipStateUpdatedEvent = z.infer<typeof RelationshipStateUpdatedEventSchema>;
3050
+
3051
+ declare const RelationshipStateUpdatedEventSchema: z.ZodObject<{
3052
+ type: z.ZodLiteral<"relationship_state_updated">;
3053
+ updatedAt: z.ZodString;
3054
+ }, z.core.$strip>;
3055
+
3056
+ export declare enum RiskLevel {
3057
+ Low = "low",
3058
+ Medium = "medium",
3059
+ High = "high"
3060
+ }
3061
+
3062
+ /**
3063
+ * Audit types for SkillSSH partner security analysis.
3064
+ *
3065
+ * Extracted as a leaf module so daemon message types can reference
3066
+ * PartnerAudit without pulling in the full skillssh-registry module
3067
+ * (which transitively imports cli/program and the entire CLI graph).
3068
+ */
3069
+ declare type RiskLevel_2 = "safe" | "low" | "medium" | "high" | "critical" | "unknown";
3070
+
3071
+ /**
3072
+ * Emitted when the compaction circuit breaker trips. After three consecutive
3073
+ * summary-LLM failures (with local fallback covering each), auto-compaction is
3074
+ * suspended until `openUntil` to avoid repeatedly hammering a broken provider.
3075
+ * User-initiated compaction (`/compact`, `force: true`) bypasses the breaker.
3076
+ *
3077
+ * `conversationId` scopes the event so clients can ignore breaker trips from
3078
+ * other conversations — `EventStreamClient` broadcasts every parsed server
3079
+ * message to all subscribers, so without this field a breaker trip in one
3080
+ * conversation would set the "auto-compaction paused" banner on every open
3081
+ * `ChatViewModel`.
3082
+ */
3083
+ /** Server push — broadcast when a schedule creates a conversation. */
3084
+ declare interface ScheduleConversationCreated {
3085
+ type: "schedule_conversation_created";
3086
+ conversationId: string;
3087
+ scheduleJobId: string;
3088
+ title: string;
3089
+ }
3090
+
3091
+ declare interface SchedulesListResponse {
3092
+ type: "schedules_list_response";
3093
+ schedules: Array<{
3094
+ id: string;
3095
+ name: string;
3096
+ enabled: boolean;
3097
+ syntax: string;
3098
+ expression: string | null;
3099
+ cronExpression: string | null;
3100
+ timezone: string | null;
3101
+ message: string;
3102
+ nextRunAt: number;
3103
+ lastRunAt: number | null;
3104
+ lastStatus: string | null;
3105
+ description: string;
3106
+ cadenceDescription: string;
3107
+ mode: string;
3108
+ status: string;
3109
+ routingIntent: string;
3110
+ reuseConversation: boolean;
3111
+ wakeConversationId: string | null;
3112
+ isOneShot: boolean;
3113
+ }>;
3114
+ }
3115
+
3116
+ declare type _SchedulesServerMessages = SchedulesListResponse | HeartbeatAlert | HeartbeatConversationCreated | HeartbeatConfigResponse | HeartbeatRunsListResponse | HeartbeatRunNowResponse | HeartbeatChecklistResponse | HeartbeatChecklistWriteResponse | FilingConfigResponse | FilingRunNowResponse;
3117
+
3118
+ declare interface ScopeOption {
3119
+ label: string;
3120
+ scope: string;
3121
+ }
3122
+
3123
+ declare type SecretDelivery = "store" | "transient_send";
3124
+
3125
+ declare interface SecretPromptResult {
3126
+ value: string | null;
3127
+ delivery: SecretDelivery;
3128
+ /** When set, the prompt could not be delivered and the value is null due to a delivery failure (not user cancellation). */
3129
+ error?: "unsupported_channel";
3130
+ }
3131
+
3132
+ declare type SecretRequestEvent = z.infer<typeof SecretRequestEventSchema>;
3133
+
3134
+ declare const SecretRequestEventSchema: z.ZodObject<{
3135
+ type: z.ZodLiteral<"secret_request">;
3136
+ requestId: z.ZodString;
3137
+ service: z.ZodString;
3138
+ field: z.ZodString;
3139
+ label: z.ZodString;
3140
+ description: z.ZodOptional<z.ZodString>;
3141
+ placeholder: z.ZodOptional<z.ZodString>;
3142
+ conversationId: z.ZodOptional<z.ZodString>;
3143
+ purpose: z.ZodOptional<z.ZodString>;
3144
+ allowedTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
3145
+ allowedDomains: z.ZodOptional<z.ZodArray<z.ZodString>>;
3146
+ allowOneTimeSend: z.ZodOptional<z.ZodBoolean>;
3147
+ }, z.core.$strip>;
3148
+
3149
+ declare interface SensitiveOutputBinding {
3150
+ kind: SensitiveOutputKind;
3151
+ placeholder: string;
3152
+ value: string;
3153
+ }
3154
+
3155
+ declare type SensitiveOutputKind = "invite_code";
3156
+
3157
+ declare type ServerMessage = _ConversationsServerMessages | _MessagesServerMessages | _SurfacesServerMessages | _SkillsServerMessages | _AppsServerMessages | _IntegrationsServerMessages | _ComputerUseServerMessages | _ContactsServerMessages | _WorkItemsServerMessages | _SubagentsServerMessages | _DocumentsServerMessages | _DocumentCommentsServerMessages | _GuardianActionsServerMessages | _SyncInvalidationServerMessages | _HomeServerMessages | _HostAppControlServerMessages | _HostBashServerMessages | _HostBrowserServerMessages | _HostCuServerMessages | _HostFileServerMessages | _HostTransferServerMessages | _MeetServerMessages | _MemoryServerMessages | _WorkspaceServerMessages | _SchedulesServerMessages | _SettingsServerMessages | _DiagnosticsServerMessages | _InboxServerMessages | _NotificationsServerMessages | _UpgradesServerMessages | _AcpServerMessages | _BookmarksServerMessages | DiskPressureStatusChangedEvent | SubagentEvent;
3158
+
3159
+ export declare interface ServerToolUseContent {
3160
+ type: "server_tool_use";
3161
+ id: string;
3162
+ name: string;
3163
+ input: Record<string, unknown>;
3164
+ }
3165
+
3166
+ /** Broadcast to connected clients when a service group update has completed. */
3167
+ declare interface ServiceGroupUpdateComplete {
3168
+ type: "service_group_update_complete";
3169
+ /** The version that was installed (may differ from target if rolled back). */
3170
+ installedVersion: string;
3171
+ /** Whether the update succeeded or rolled back. */
3172
+ success: boolean;
3173
+ /** If rolled back, the version reverted to. */
3174
+ rolledBackToVersion?: string;
3175
+ }
3176
+
3177
+ /** Broadcast to connected clients with a progress update during an upgrade or rollback. */
3178
+ declare interface ServiceGroupUpdateProgress {
3179
+ type: "service_group_update_progress";
3180
+ /** A short, user-friendly status message describing what's happening right now. */
3181
+ statusMessage: string;
3182
+ }
3183
+
3184
+ /** Broadcast to connected clients when a service group update is about to begin. */
3185
+ declare interface ServiceGroupUpdateStarting {
3186
+ type: "service_group_update_starting";
3187
+ /** The version being upgraded to. */
3188
+ targetVersion: string;
3189
+ /** Estimated seconds of downtime. */
3190
+ expectedDowntimeSeconds: number;
3191
+ }
3192
+
3193
+ declare type _SettingsServerMessages = ClientSettingsUpdate | AvatarUpdatedEvent | ConfigChanged | SoundsConfigUpdated | GenerateAvatarResponse;
3194
+
3195
+ declare interface ShareAppCloudResponse {
3196
+ type: "share_app_cloud_response";
3197
+ success: boolean;
3198
+ shareToken?: string;
3199
+ shareUrl?: string;
3200
+ error?: string;
3201
+ }
3202
+
3203
+ declare interface SharedAppDeleteResponse {
3204
+ type: "shared_app_delete_response";
3205
+ success: boolean;
3206
+ }
3207
+
3208
+ declare interface SharedAppsListResponse {
3209
+ type: "shared_apps_list_response";
3210
+ apps: Array<{
3211
+ uuid: string;
3212
+ name: string;
3213
+ description?: string;
3214
+ icon?: string;
3215
+ preview?: string;
3216
+ entry: string;
3217
+ trustTier: string;
3218
+ signerDisplayName?: string;
3219
+ bundleSizeBytes: number;
3220
+ installedAt: string;
3221
+ version?: string;
3222
+ contentId?: string;
3223
+ updateAvailable?: boolean;
3224
+ }>;
3225
+ }
3226
+
3227
+ declare interface ShowPlatformLogin {
3228
+ type: "show_platform_login";
3229
+ }
3230
+
3231
+ declare interface SignBundlePayloadRequest {
3232
+ type: "sign_bundle_payload";
3233
+ requestId: string;
3234
+ payload: string;
3235
+ }
3236
+
3237
+ declare interface SkillBodyResponse {
3238
+ type: "skill_detail_response";
3239
+ skillId: string;
3240
+ body: string;
3241
+ icon?: string;
3242
+ error?: string;
3243
+ }
3244
+
3245
+ declare interface SkillsDraftResponse {
3246
+ type: "skills_draft_response";
3247
+ success: boolean;
3248
+ draft?: {
3249
+ skillId: string;
3250
+ name: string;
3251
+ description: string;
3252
+ emoji?: string;
3253
+ bodyMarkdown: string;
3254
+ };
3255
+ warnings?: string[];
3256
+ error?: string;
3257
+ }
3258
+
3259
+ declare interface SkillsInspectResponse {
3260
+ type: "skills_inspect_response";
3261
+ slug: string;
3262
+ data?: {
3263
+ skill: {
3264
+ slug: string;
3265
+ displayName: string;
3266
+ summary: string;
3267
+ };
3268
+ owner?: {
3269
+ handle: string;
3270
+ displayName: string;
3271
+ image?: string;
3272
+ } | null;
3273
+ stats?: {
3274
+ stars: number;
3275
+ installs: number;
3276
+ downloads: number;
3277
+ versions: number;
3278
+ } | null;
3279
+ createdAt?: number | null;
3280
+ updatedAt?: number | null;
3281
+ latestVersion?: {
3282
+ version: string;
3283
+ changelog?: string;
3284
+ } | null;
3285
+ files?: Array<{
3286
+ path: string;
3287
+ size: number;
3288
+ contentType?: string;
3289
+ }> | null;
3290
+ skillMdContent?: string | null;
3291
+ };
3292
+ error?: string;
3293
+ }
3294
+
3295
+ declare interface SkillsListResponse {
3296
+ type: "skills_list_response";
3297
+ skills: SlimSkillResponse[];
3298
+ }
3299
+
3300
+ declare type _SkillsServerMessages = SkillsListResponse | SkillBodyResponse | SkillStateChanged | SkillsInspectResponse | SkillsDraftResponse;
3301
+
3302
+ declare interface SkillsshSlimSkill extends SlimSkillBase {
3303
+ origin: "skillssh";
3304
+ slug: string;
3305
+ sourceRepo: string;
3306
+ installs: number;
3307
+ audit?: Record<string, PartnerAudit>;
3308
+ }
3309
+
3310
+ declare interface SkillStateChanged {
3311
+ type: "skills_state_changed";
3312
+ name: string;
3313
+ state: "enabled" | "disabled" | "installed" | "uninstalled";
3314
+ }
3315
+
3316
+ declare interface SlackWebhookConfigResponse {
3317
+ type: "slack_webhook_config_response";
3318
+ webhookUrl?: string;
3319
+ success: boolean;
3320
+ error?: string;
3321
+ }
3322
+
3323
+ /** Fields shared by all skill origins. */
3324
+ declare interface SlimSkillBase {
3325
+ id: string;
3326
+ name: string;
3327
+ description: string;
3328
+ icon?: string;
3329
+ emoji?: string;
3330
+ kind: "bundled" | "installed" | "catalog";
3331
+ status: "enabled" | "disabled" | "available";
3332
+ category: string;
3333
+ /**
3334
+ * Extension that ships this skill, reusing the tool registry's
3335
+ * {@link OwnerInfo} model. Set for plugin-resident skills as
3336
+ * `{ kind: "plugin", id: <plugin dir name> }` so clients can attribute
3337
+ * them to the owning plugin instead of collapsing to their `kind`/`origin`.
3338
+ */
3339
+ owner?: OwnerInfo;
3340
+ }
3341
+
3342
+ declare type SlimSkillResponse = VellumSlimSkill | ClawhubSlimSkill | SkillsshSlimSkill | CustomSlimSkill;
3343
+
3344
+ /** Sent by the daemon when sounds config or sound files change on disk. */
3345
+ declare interface SoundsConfigUpdated {
3346
+ type: "sounds_config_updated";
3347
+ }
3348
+
3349
+ /**
3350
+ * Context passed to the `stop` hook — the loop's definitive terminal hook.
3351
+ *
3352
+ * It fires exactly once per run, after the loop has committed to ending and
3353
+ * will not run another iteration this run. Unlike `post-model-call` (which owns
3354
+ * the model-call-outcome retry decision), `stop` cannot continue the loop: by
3355
+ * the time it runs the turn's outcome is settled. That guarantee makes it the
3356
+ * home for teardown — a hook can release per-turn resources or clear per-turn
3357
+ * state knowing nothing will re-enter the loop this run.
3358
+ *
3359
+ * It fires on every terminal exit: a no-tool reply, a max-tokens stop, a
3360
+ * yield-to-user, an exhausted context-overflow recovery, a user abort, or an
3361
+ * unhandled error. It also fires on a `checkpoint_handoff`, which ends the run
3362
+ * for teardown purposes even though the orchestrator resumes the conversation
3363
+ * in a fresh run. {@link exitReason} reports which one and {@link error}
3364
+ * carries the rejection when the turn ended on one, so a hook that should act
3365
+ * only on a particular ending guards on {@link exitReason}.
3366
+ *
3367
+ * Multiple plugins' hooks chain in registration order over the same context.
3368
+ */
3369
+ export declare interface StopContext {
3370
+ /** Conversation ID the run belongs to. */
3371
+ readonly conversationId: string;
3372
+ /**
3373
+ * Full conversation history at the terminal stop — the inbound conversation
3374
+ * followed by every message produced this run. Provided for inspection;
3375
+ * mutating it has no effect, since the loop will not run again this turn.
3376
+ */
3377
+ readonly messages: ReadonlyArray<Message>;
3378
+ /**
3379
+ * The provider rejection that ended the turn, when it ended on one (e.g. an
3380
+ * unrecoverable error after recovery hooks declined to retry). Absent on a
3381
+ * clean stop.
3382
+ */
3383
+ readonly error?: Error;
3384
+ /**
3385
+ * Which terminal state the turn reached. A `checkpoint_handoff` fires this
3386
+ * hook for teardown — the run pauses so the orchestrator can drain a queued
3387
+ * message — but is not emitted as an `agent_loop_exit`, since the
3388
+ * conversation resumes in a fresh run. `aborted_after_checkpoint` is a
3389
+ * control transfer that re-enters the loop and so never reaches this hook.
3390
+ */
3391
+ readonly exitReason: AgentLoopExitReason;
3392
+ /**
3393
+ * Logger scoped to the current turn. The same instance is shared by
3394
+ * every hook in the chain, so plugins should tag their structured log
3395
+ * fields (e.g. `{ plugin: "<name>" }`) for attribution.
3396
+ */
3397
+ readonly logger: PluginLogger;
3398
+ }
3399
+
3400
+ declare interface SubagentDetailResponse {
3401
+ type: "subagent_detail_response";
3402
+ subagentId: string;
3403
+ objective?: string;
3404
+ usage?: UsageStats;
3405
+ events: Array<{
3406
+ type: string;
3407
+ content: string;
3408
+ toolName?: string;
3409
+ isError?: boolean;
3410
+ messageId?: string;
3411
+ }>;
3412
+ }
3413
+
3414
+ /** Wraps any ServerMessage emitted by a subagent conversation for routing to the client. */
3415
+ declare interface SubagentEvent {
3416
+ type: "subagent_event";
3417
+ subagentId: string;
3418
+ conversationId: string;
3419
+ event: ServerMessage;
3420
+ }
3421
+
3422
+ declare interface SubagentSpawned {
3423
+ type: "subagent_spawned";
3424
+ subagentId: string;
3425
+ parentConversationId: string;
3426
+ label: string;
3427
+ objective: string;
3428
+ isFork?: boolean;
3429
+ /**
3430
+ * Tool-use id of the `skill_execute` call that spawned this subagent. Lets
3431
+ * the client anchor the inline subagent card to the exact spawn tool call,
3432
+ * independent of the (reconcile-volatile) parent message id.
3433
+ */
3434
+ parentToolUseId?: string;
3435
+ }
3436
+
3437
+ declare type _SubagentsServerMessages = SubagentSpawned | SubagentStatusChanged | SubagentDetailResponse;
3438
+
3439
+ declare type SubagentStatus = "pending" | "running" | "awaiting_input" | "completed" | "failed" | "aborted";
3440
+
3441
+ declare interface SubagentStatusChanged {
3442
+ type: "subagent_status_changed";
3443
+ subagentId: string;
3444
+ status: SubagentStatus;
3445
+ error?: string;
3446
+ usage?: UsageStats;
3447
+ }
3448
+
3449
+ declare type SubscriberEntry = ClientEntry | ProcessEntry;
3450
+
3451
+ /** Input shape for `subscribe()` — hub fills `active`, `connectedAt`, `lastActiveAt`, `connectionId` and defaults `filter`/`onEvict`. */
3452
+ declare type SubscriberInput = DistributiveOmit<SubscriberEntry, "active" | "connectedAt" | "lastActiveAt" | "filter" | "onEvict" | "connectionId"> & {
3453
+ filter?: AssistantEventFilter;
3454
+ onEvict?: () => void;
3455
+ };
3456
+
3457
+ declare interface SuggestionResponse {
3458
+ type: "suggestion_response";
3459
+ requestId: string;
3460
+ suggestion: string | null;
3461
+ source: "llm" | "none";
3462
+ }
3463
+
3464
+ declare interface SurfaceAction {
3465
+ id: string;
3466
+ label: string;
3467
+ style?: "primary" | "secondary" | "destructive";
3468
+ /** Optional data payload returned to the daemon when this action is clicked. */
3469
+ data?: Record<string, unknown>;
3470
+ }
3471
+
3472
+ declare type SurfaceData = CardSurfaceData | ChoiceSurfaceData | CopyBlockSurfaceData | OAuthConnectSurfaceData | FormSurfaceData | ListSurfaceData | TableSurfaceData | ConfirmationSurfaceData | DynamicPageSurfaceData | FileUploadSurfaceData | DocumentPreviewSurfaceData | WorkResultSurfaceData;
3473
+
3474
+ declare type _SurfacesServerMessages = UiSurfaceShow | UiSurfaceUpdate | UiSurfaceDismiss | UiSurfaceComplete | UiSurfaceUndoResult;
3475
+
3476
+ declare type SyncChangedEvent = z.infer<typeof SyncChangedEventSchema>;
3477
+
3478
+ declare const SyncChangedEventSchema: z.ZodObject<{
3479
+ type: z.ZodLiteral<"sync_changed">;
3480
+ tags: z.ZodArray<z.ZodString>;
3481
+ originClientId: z.ZodOptional<z.ZodString>;
3482
+ }, z.core.$strip>;
3483
+
3484
+ declare type _SyncInvalidationServerMessages = SyncChangedEvent;
3485
+
3486
+ declare interface TableCellValue {
3487
+ text: string;
3488
+ icon?: string;
3489
+ iconColor?: string;
3490
+ }
3491
+
3492
+ declare interface TableColumn {
3493
+ id: string;
3494
+ label: string;
3495
+ width?: number;
3496
+ }
3497
+
3498
+ declare interface TableRow {
3499
+ id: string;
3500
+ cells: Record<string, string | TableCellValue>;
3501
+ selectable?: boolean;
3502
+ selected?: boolean;
3503
+ }
3504
+
3505
+ declare interface TableSurfaceData {
3506
+ columns: TableColumn[];
3507
+ rows: TableRow[];
3508
+ selectionMode?: "none" | "single" | "multiple";
3509
+ caption?: string;
3510
+ }
3511
+
3512
+ /** Server push — broadcast when a task run creates a conversation. */
3513
+ declare interface TaskRunConversationCreated {
3514
+ type: "task_run_conversation_created";
3515
+ conversationId: string;
3516
+ workItemId: string;
3517
+ title: string;
3518
+ }
3519
+
3520
+ /** Server push — lightweight invalidation signal: the task queue has been mutated, refetch your list. */
3521
+ declare interface TasksChanged {
3522
+ type: "tasks_changed";
3523
+ }
3524
+
3525
+ declare interface TelegramConfigResponse {
3526
+ type: "telegram_config_response";
3527
+ success: boolean;
3528
+ hasBotToken: boolean;
3529
+ botId?: string;
3530
+ botUsername?: string;
3531
+ connected: boolean;
3532
+ hasWebhookSecret: boolean;
3533
+ lastError?: string;
3534
+ error?: string;
3535
+ /** Names of bot commands that were registered (present after set_commands or setup). */
3536
+ commandsRegistered?: string[];
3537
+ /** Non-fatal warning (e.g. commands registration failed during setup but token was configured). */
3538
+ warning?: string;
3539
+ }
3540
+
3541
+ export declare interface TextContent {
3542
+ type: "text";
3543
+ text: string;
3544
+ }
3545
+
3546
+ export declare interface ThinkingContent {
3547
+ type: "thinking";
3548
+ thinking: string;
3549
+ signature: string;
3550
+ }
3551
+
3552
+ /** Discriminated container so future tools can add their own metadata. */
3553
+ declare interface ToolActivityMetadata {
3554
+ webSearch?: WebSearchMetadata;
3555
+ webFetch?: WebFetchMetadata;
3556
+ }
3557
+
3558
+ export declare interface ToolContext {
3559
+ /** Identifier of the conversation this tool invocation belongs to. */
3560
+ conversationId: string;
3561
+ /** Working directory the daemon was launched from. */
3562
+ workingDir: string;
3563
+ /** Per-turn request id for cross-component log correlation. */
3564
+ requestId?: string;
3565
+ /** Cooperative cancellation signal for long-running tools. Tools should check `signal.aborted` periodically (or forward `signal` to fetch / child-process options). */
3566
+ signal?: AbortSignal;
3567
+ /** Optional incremental-output callback for streaming tools. Streaming tools should fall back to returning the full result in `content` when this is absent. */
3568
+ onOutput?: (chunk: string) => void;
3569
+ /** Logical assistant scope for multi-assistant routing. */
3570
+ assistantId?: string;
3571
+ /** When set, the tool execution is part of a task run. Used to retrieve ephemeral permission rules. */
3572
+ taskRunId?: string;
3573
+ /**
3574
+ * Model attribution snapshot for the conversation at invocation time
3575
+ * (provider/model/profile that issued this tool call). Used by tool
3576
+ * telemetry; never sent to the tool itself.
3577
+ */
3578
+ attribution?: UsageAttributionSnapshot | null;
3579
+ /** Optional callback for tool lifecycle events (start/prompt/deny/execute/error). */
3580
+ onToolLifecycleEvent?: ToolLifecycleEventHandler;
3581
+ /** Optional resolver for proxy tools - delegates execution to an external client. */
3582
+ proxyToolResolver?: ProxyToolResolver;
3583
+ /** When set, only tools in this set may execute. Tools outside the set are blocked with an error. */
3584
+ allowedToolNames?: Set<string>;
3585
+ /** True when this turn is restricted to storage cleanup-safe tools. */
3586
+ diskPressureCleanupModeActive?: boolean;
3587
+ /** Prompt the user for a secret value via native SecureField UI. */
3588
+ requestSecret?: (params: {
3589
+ service: string;
3590
+ field: string;
3591
+ label: string;
3592
+ description?: string;
3593
+ placeholder?: string;
3594
+ purpose?: string;
3595
+ allowedTools?: string[];
3596
+ allowedDomains?: string[];
3597
+ }) => Promise<SecretPromptResult>;
3598
+ /** Optional callback to send a message to the connected client (e.g. open_url). */
3599
+ sendToClient?: (msg: {
3600
+ type: string;
3601
+ [key: string]: unknown;
3602
+ }) => void;
3603
+ /** True when an interactive client is connected (not just a no-op callback). */
3604
+ isInteractive?: boolean;
3605
+ /** When true, tools with side effects should always prompt for confirmation. */
3606
+ forcePromptSideEffects?: boolean;
3607
+ /**
3608
+ * When true, the tool requires a fresh interactive approval for every
3609
+ * invocation - no cached grants, temporary overrides, persistent
3610
+ * "Always Allow" rules, or non-interactive auto-approve shortcuts may
3611
+ * bypass the prompt. This flag is independently sufficient: it
3612
+ * promotes allow → prompt decisions on its own and suppresses
3613
+ * temporary override options in the prompt UI. Used by
3614
+ * `manage_secure_command_tool` to ensure a human reviews each secure
3615
+ * bundle installation.
3616
+ */
3617
+ requireFreshApproval?: boolean;
3618
+ /** Approval callback for proxy policy decisions that require user confirmation. */
3619
+ proxyApprovalCallback?: ProxyApprovalCallback;
3620
+ /** Optional principal identifier propagated to sub-tool confirmation flows. */
3621
+ principal?: string;
3622
+ /**
3623
+ * Trust classification of the actor who initiated this tool invocation.
3624
+ * Determines permission level: guardians self-approve, trusted contacts
3625
+ * may escalate to guardian for approval, unknown actors are fail-closed.
3626
+ * See {@link TrustClass} in actor-trust-resolver.ts for value semantics.
3627
+ */
3628
+ trustClass: TrustClass;
3629
+ /** Channel through which the tool invocation originates (e.g. 'telegram', 'phone'). Used for scoped grant consumption. */
3630
+ executionChannel?: string;
3631
+ /** Voice/call session ID, if the invocation originates from a call. Used for scoped grant consumption. */
3632
+ callSessionId?: string;
3633
+ /** True when the tool invocation was triggered by a user clicking a surface action button (not a regular message). */
3634
+ triggeredBySurfaceAction?: boolean;
3635
+ /** True when the user explicitly approved this tool invocation via the interactive permission prompt (not auto-approved by trust rules or temporary overrides). */
3636
+ approvedViaPrompt?: boolean;
3637
+ /**
3638
+ * True when the invocation is inside a scheduled task run whose
3639
+ * `required_tools` array pre-authorized this tool at task-creation time.
3640
+ * Tools that normally require a surface-action click (e.g. bulk archive,
3641
+ * unsubscribe) may treat this as equivalent consent, since the user
3642
+ * already reviewed the tool list when the task was saved.
3643
+ */
3644
+ batchAuthorizedByTask?: boolean;
3645
+ /** External user ID of the requester (non-guardian actor). Used for scoped grant consumption. */
3646
+ requesterExternalUserId?: string;
3647
+ /** Chat ID of the requester (non-guardian actor). Used for tool grant request escalation notifications. */
3648
+ requesterChatId?: string;
3649
+ /** Human-readable identifier for the requester (e.g., @username). */
3650
+ requesterIdentifier?: string;
3651
+ /** Preferred display name for the requester. */
3652
+ requesterDisplayName?: string;
3653
+ /** Slack channel ID for channel-scoped permission enforcement. When set, tools are checked against the channel's permission profile. */
3654
+ channelPermissionChannelId?: string;
3655
+ /** The tool_use block ID from the LLM response, used to correlate confirmation prompts with specific tool invocations. */
3656
+ toolUseId?: string;
3657
+ /** True when the assistant is running as a platform-managed remote instance. Used to auto-approve sandboxed bash tools. */
3658
+ isPlatformHosted?: boolean;
3659
+ /**
3660
+ * The interface ID of the connected client driving the current turn (e.g.
3661
+ * "macos", "chrome-extension"). Browser backend policy uses this to decide
3662
+ * transport preference — for example, macOS-originated turns prefer the
3663
+ * user's real Chrome session via the paired extension before falling back
3664
+ * to cdp-inspect or local Playwright.
3665
+ */
3666
+ transportInterface?: InterfaceId;
3667
+ /**
3668
+ * The per-turn inference-profile override the agent loop is currently
3669
+ * running under, propagated through tool context so subagent-spawn tools
3670
+ * can forward it when spawning nested subagents. Without this, sub-subagent
3671
+ * spawns silently lose inheritance because their own conversation row never
3672
+ * has `inferenceProfile` set — the override only flows through the
3673
+ * in-memory `SubagentConfig.overrideProfile` chain. See
3674
+ * `executeSubagentSpawn` in tools/subagent/spawn.ts.
3675
+ */
3676
+ overrideProfile?: string;
3677
+ /**
3678
+ * Canonical principal ID of the actor on whose behalf this tool invocation
3679
+ * is running. Sourced from `conversation.trustContext.guardianPrincipalId`.
3680
+ * Used by host proxies to bind cross-client targeted execution to the same
3681
+ * authenticated user identity. May be undefined for legacy/internal flows
3682
+ * with no resolved actor identity.
3683
+ */
3684
+ sourceActorPrincipalId?: string;
3685
+ }
3686
+
3687
+ /**
3688
+ * Author-facing tool spec — re-exported from `@vellumai/plugin-api`.
3689
+ * Loaders fill documented defaults for omitted fields via `finalizeTool`
3690
+ * in `tool-defaults.ts`. The type is a direct `z.infer` of
3691
+ * {@link ToolDefinitionSchema} — both `input_schema` and `execute` are
3692
+ * typed correctly by the schema itself, no overlay needed.
3693
+ */
3694
+ export declare type ToolDefinition = z.infer<typeof ToolDefinitionSchema>;
3695
+
3696
+ /**
3697
+ * Schema describing the shape of a {@link ToolDefinition}. All fields are
3698
+ * optional — loaders fill documented defaults for omitted fields via
3699
+ * `finalizeTool` in `tool-defaults.ts`. The IPC layer parses incoming
3700
+ * skill tools against this same schema and re-finalizes them locally,
3701
+ * so author shape and wire shape are one schema.
3702
+ *
3703
+ * `input_schema` is `z.custom<object>(...)` rather than
3704
+ * `z.record(z.string(), z.unknown())` so that authors can assign a typed
3705
+ * JSON-schema literal (`{ type: "object", properties: { ... } }`)
3706
+ * without `as Record<...>` gymnastics. The custom check still rejects
3707
+ * `null`, primitives, and arrays at runtime.
3708
+ *
3709
+ * `execute` is `z.custom<(input, context) => Promise<ToolExecutionResult>>()`
3710
+ * for the same reason — the wire path drops closures (they can't cross
3711
+ * IPC) and `finalizeTool` synthesizes a no-op error closure on arrival.
3712
+ * The custom shape gives `ToolDefinition.execute` a fully-typed
3713
+ * signature via `z.infer` without an overlay type.
3714
+ *
3715
+ * Result: `ToolDefinition = z.infer<typeof ToolDefinitionSchema>` —
3716
+ * one declaration, both `input_schema` and `execute` typed correctly.
3717
+ */
3718
+ declare const ToolDefinitionSchema: z.ZodObject<{
3719
+ name: z.ZodOptional<z.ZodString>;
3720
+ description: z.ZodOptional<z.ZodString>;
3721
+ input_schema: z.ZodOptional<z.ZodCustom<object, object>>;
3722
+ defaultRiskLevel: z.ZodOptional<z.ZodEnum<typeof RiskLevel>>;
3723
+ category: z.ZodOptional<z.ZodString>;
3724
+ executionTarget: z.ZodOptional<z.ZodEnum<{
3725
+ sandbox: "sandbox";
3726
+ host: "host";
3727
+ }>>;
3728
+ execute: z.ZodOptional<z.ZodCustom<(input: Record<string, unknown>, context: ToolContext) => Promise<ToolExecutionResult>, (input: Record<string, unknown>, context: ToolContext) => Promise<ToolExecutionResult>>>;
3729
+ }, z.core.$strip>;
3730
+
3731
+ /**
3732
+ * `ToolExecutedEvent` carries a `result: ToolExecutionResult` field, so
3733
+ * the assistant re-declares it here to reference the assistant-side
3734
+ * `ToolExecutionResult` (which narrows `contentBlocks` to `ContentBlock[]`
3735
+ * and `cesApprovalRequired` to `ApprovalRequired`).
3736
+ */
3737
+ declare interface ToolExecutedEvent extends ExecutorTelemetryStamp {
3738
+ type: "executed";
3739
+ toolName: string;
3740
+ input: Record<string, unknown>;
3741
+ workingDir: string;
3742
+ conversationId: string;
3743
+ requestId?: string;
3744
+ executionTarget?: ExecutionTarget;
3745
+ riskLevel: string;
3746
+ /** ID of the trust rule that matched this invocation (if any). */
3747
+ matchedTrustRuleId?: string;
3748
+ /** How the approval decision was reached. Copied from PermissionDecision for analytics consumers. */
3749
+ approvalMode?: string;
3750
+ /** Why the approval decision was reached (stable enum). Copied from PermissionDecision for analytics consumers. */
3751
+ approvalReason?: string;
3752
+ decision: string;
3753
+ durationMs: number;
3754
+ result: ToolExecutionResult;
3755
+ }
3756
+
3757
+ /**
3758
+ * Extends the contracts declaration with the assistant-side telemetry
3759
+ * fields stamped centrally by the executor's `emitLifecycleEvent`.
3760
+ */
3761
+ declare interface ToolExecutionErrorEvent extends ToolExecutionErrorEvent_2, ExecutorTelemetryStamp {
3762
+ }
3763
+
3764
+ declare interface ToolExecutionErrorEvent_2 extends ToolLifecycleEventBase {
3765
+ type: "error";
3766
+ riskLevel: string;
3767
+ /** ID of the trust rule that matched this invocation (if any). */
3768
+ matchedTrustRuleId?: string;
3769
+ decision: string;
3770
+ durationMs: number;
3771
+ errorMessage: string;
3772
+ isExpected: boolean;
3773
+ /** Classifies the error for downstream consumers (audit, alerting, monitoring). */
3774
+ errorCategory: ErrorCategory;
3775
+ errorName?: string;
3776
+ errorStack?: string;
3777
+ }
3778
+
3779
+ export declare interface ToolExecutionResult {
3780
+ /** Textual result shown to the model in the tool-result block. Empty string is valid. */
3781
+ content: string;
3782
+ /** When true, the agent loop treats `content` as an error and may surface it / retry. */
3783
+ isError: boolean;
3784
+ /** Optional short status message for client display (e.g. `"truncated"`, `"timed out"`). */
3785
+ status?: string;
3786
+ /**
3787
+ * When true, the agent loop should yield control back to the user after
3788
+ * returning this result — tool results are pushed to history and the loop
3789
+ * breaks without another LLM call. Two callers set this: interactive
3790
+ * surfaces (tables with action buttons, file uploads) that force-stop the
3791
+ * loop so the LLM cannot bypass the "wait for user action" instruction,
3792
+ * and tools like `remember` that expose a `finish_turn` parameter letting
3793
+ * the LLM voluntarily end its turn.
3794
+ */
3795
+ yieldToUser?: boolean;
3796
+ diff?: DiffInfo;
3797
+ /** Optional rich content blocks (e.g. images) to include alongside text in the tool result. */
3798
+ contentBlocks?: ContentBlock[];
3799
+ /**
3800
+ * Runtime-internal sensitive output bindings (placeholder -> real value).
3801
+ * Populated by the executor when tool output contains
3802
+ * `<vellum-sensitive-output>` directives. The agent loop merges these
3803
+ * into a per-run substitution map for deterministic post-generation
3804
+ * replacement. MUST NOT be emitted in client-facing events or logs.
3805
+ */
3806
+ sensitiveBindings?: SensitiveOutputBinding[];
3807
+ /** Risk level from the classifier (populated during permission check). */
3808
+ riskLevel?: string;
3809
+ /** Human-readable reason for the risk classification. */
3810
+ riskReason?: string;
3811
+ /** ID of the trust rule that matched this invocation (if any). */
3812
+ matchedTrustRuleId?: string;
3813
+ /** How the decision was reached: prompted, auto, blocked, or unknown (legacy). */
3814
+ approvalMode?: string;
3815
+ /** Why the decision was reached (stable enum for client display). */
3816
+ approvalReason?: string;
3817
+ /** Snapshot of the auto-approve threshold at the time of execution. */
3818
+ riskThreshold?: string;
3819
+ /** Whether the daemon is running in a containerized (Docker) environment. */
3820
+ isContainerized?: boolean;
3821
+ /**
3822
+ * Display-only ladder of scope option labels for the rule editor
3823
+ * (narrowest to broadest). The `pattern` field here is a regex-style
3824
+ * descriptor used internally by the daemon and is NOT a valid trust
3825
+ * rule pattern. Use `riskAllowlistOptions` for the pattern that gets
3826
+ * saved as a trust rule.
3827
+ */
3828
+ riskScopeOptions?: Array<{
3829
+ pattern: string;
3830
+ label: string;
3831
+ }>;
3832
+ /**
3833
+ * Allowlist options for the rule editor save path (narrowest to
3834
+ * broadest). Each `pattern` is a Minimatch-glob compatible string
3835
+ * (e.g. raw command for exact match, `action:<program>` for command
3836
+ * wildcards) — what the gateway actually matches against. Mirrors
3837
+ * the `allowlistOptions` field on `ConfirmationRequest` SSE events.
3838
+ */
3839
+ riskAllowlistOptions?: Array<{
3840
+ label: string;
3841
+ description: string;
3842
+ pattern: string;
3843
+ }>;
3844
+ /** Directory scope ladder for the rule editor (narrowest to broadest). */
3845
+ riskDirectoryScopeOptions?: Array<{
3846
+ scope: string;
3847
+ label: string;
3848
+ }>;
3849
+ /**
3850
+ * When present, indicates that a CES tool returned an `approval_required`
3851
+ * response. The executor uses the approval bridge to prompt the guardian,
3852
+ * commit the grant decision to CES, and retry the original tool invocation
3853
+ * with the granted grantId. CES tools populate this field rather than
3854
+ * returning a textual error so the executor can intercept and handle the
3855
+ * approval flow transparently.
3856
+ */
3857
+ cesApprovalRequired?: ApprovalRequired;
3858
+ /** Structured activity metadata for client rendering (web search, web fetch, etc).
3859
+ * Populated by daemon-internal tools; plugins must not set this. */
3860
+ activityMetadata?: ToolActivityMetadata;
3861
+ }
3862
+
3863
+ declare interface ToolExecutionStartEvent extends ToolLifecycleEventBase {
3864
+ type: "start";
3865
+ startedAtMs: number;
3866
+ }
3867
+
3868
+ declare interface ToolInputDelta {
3869
+ type: "tool_input_delta";
3870
+ toolName: string;
3871
+ content: string;
3872
+ conversationId?: string;
3873
+ /** The tool_use block ID for client-side correlation. */
3874
+ toolUseId?: string;
3875
+ /** Database ID of the assistant message that owns this tool_use block.
3876
+ * Same semantics as `AssistantTextDeltaEvent.messageId`. */
3877
+ messageId?: string;
3878
+ }
3879
+
3880
+ declare interface ToolInputSchema {
3881
+ type: "object";
3882
+ properties?: Record<string, {
3883
+ type?: string;
3884
+ description?: string;
3885
+ enum?: string[];
3886
+ [key: string]: unknown;
3887
+ }>;
3888
+ required?: string[];
3889
+ }
3890
+
3891
+ declare type ToolLifecycleEvent = ToolExecutionStartEvent | ToolPermissionPromptEvent | ToolPermissionDeniedEvent | ToolExecutedEvent | ToolExecutionErrorEvent;
3892
+
3893
+ declare interface ToolLifecycleEventBase {
3894
+ toolName: string;
3895
+ input: Record<string, unknown>;
3896
+ workingDir: string;
3897
+ conversationId: string;
3898
+ requestId?: string;
3899
+ executionTarget?: ExecutionTarget;
3900
+ }
3901
+
3902
+ declare type ToolLifecycleEventHandler = (event: ToolLifecycleEvent) => void | Promise<void>;
3903
+
3904
+ declare interface ToolNamesListResponse {
3905
+ type: "tool_names_list_response";
3906
+ /** Sorted list of all registered tool names. */
3907
+ names: string[];
3908
+ /** Input schemas keyed by tool name. */
3909
+ schemas?: Record<string, ToolInputSchema>;
3910
+ }
3911
+
3912
+ declare type ToolOutputChunkEvent = z.infer<typeof ToolOutputChunkEventSchema>;
3913
+
3914
+ declare const ToolOutputChunkEventSchema: z.ZodObject<{
3915
+ type: z.ZodLiteral<"tool_output_chunk">;
3916
+ chunk: z.ZodString;
3917
+ conversationId: z.ZodOptional<z.ZodString>;
3918
+ toolUseId: z.ZodOptional<z.ZodString>;
3919
+ subType: z.ZodOptional<z.ZodEnum<{
3920
+ status: "status";
3921
+ tool_start: "tool_start";
3922
+ tool_complete: "tool_complete";
3923
+ }>>;
3924
+ subToolName: z.ZodOptional<z.ZodString>;
3925
+ subToolInput: z.ZodOptional<z.ZodString>;
3926
+ subToolIsError: z.ZodOptional<z.ZodBoolean>;
3927
+ subToolId: z.ZodOptional<z.ZodString>;
3928
+ messageId: z.ZodOptional<z.ZodString>;
3929
+ }, z.core.$strip>;
3930
+
3931
+ declare interface ToolPermissionDeniedEvent extends ToolLifecycleEventBase {
3932
+ type: "permission_denied";
3933
+ riskLevel: string;
3934
+ /** Classifier-provided reason explaining why the risk level was assigned (bash/host_bash only). */
3935
+ riskReason?: string;
3936
+ /** ID of the trust rule that matched this invocation (if any). */
3937
+ matchedTrustRuleId?: string;
3938
+ decision: "deny" | "always_deny";
3939
+ reason: string;
3940
+ durationMs: number;
3941
+ }
3942
+
3943
+ declare interface ToolPermissionPromptEvent extends ToolLifecycleEventBase {
3944
+ type: "permission_prompt";
3945
+ riskLevel: string;
3946
+ /** Classifier-provided reason explaining why the risk level was assigned (bash/host_bash only). */
3947
+ riskReason?: string;
3948
+ reason: string;
3949
+ allowlistOptions: AllowlistOption[];
3950
+ scopeOptions: ScopeOption[];
3951
+ diff?: DiffInfo;
3952
+ persistentDecisionsAllowed?: boolean;
3953
+ }
3954
+
3955
+ declare interface ToolPermissionSimulateResponse {
3956
+ type: "tool_permission_simulate_response";
3957
+ success: boolean;
3958
+ /** The simulated permission decision. */
3959
+ decision?: "allow" | "deny" | "prompt";
3960
+ /** Risk level of the simulated tool invocation. */
3961
+ riskLevel?: string;
3962
+ /** Human-readable reason for the decision. */
3963
+ reason?: string;
3964
+ /** When decision is 'prompt', the data needed to render a ToolConfirmationBubble. */
3965
+ promptPayload?: {
3966
+ allowlistOptions: Array<{
3967
+ label: string;
3968
+ description: string;
3969
+ pattern: string;
3970
+ }>;
3971
+ scopeOptions: Array<{
3972
+ label: string;
3973
+ scope: string;
3974
+ }>;
3975
+ persistentDecisionsAllowed: boolean;
3976
+ };
3977
+ /** Resolved execution target for the tool. */
3978
+ executionTarget?: "host" | "sandbox";
3979
+ /** ID of the trust rule that matched (if any). */
3980
+ matchedTrustRuleId?: string;
3981
+ /** Error message when success is false. */
3982
+ error?: string;
3983
+ }
3984
+
3985
+ export declare interface ToolResultContent {
3986
+ type: "tool_result";
3987
+ tool_use_id: string;
3988
+ content: string;
3989
+ is_error?: boolean;
3990
+ /** Rich content blocks (e.g. images) to include alongside text in the tool result. */
3991
+ contentBlocks?: ContentBlock[];
3992
+ }
3993
+
3994
+ declare type ToolResultEvent = z.infer<typeof ToolResultEventSchema>;
3995
+
3996
+ declare const ToolResultEventSchema: z.ZodObject<{
3997
+ type: z.ZodLiteral<"tool_result">;
3998
+ toolName: z.ZodString;
3999
+ result: z.ZodString;
4000
+ isError: z.ZodOptional<z.ZodBoolean>;
4001
+ diff: z.ZodOptional<z.ZodObject<{
4002
+ filePath: z.ZodString;
4003
+ oldContent: z.ZodString;
4004
+ newContent: z.ZodString;
4005
+ isNewFile: z.ZodBoolean;
4006
+ }, z.core.$strip>>;
4007
+ status: z.ZodOptional<z.ZodString>;
4008
+ conversationId: z.ZodOptional<z.ZodString>;
4009
+ imageData: z.ZodOptional<z.ZodString>;
4010
+ imageDataList: z.ZodOptional<z.ZodArray<z.ZodString>>;
4011
+ toolUseId: z.ZodOptional<z.ZodString>;
4012
+ messageId: z.ZodOptional<z.ZodString>;
4013
+ riskLevel: z.ZodOptional<z.ZodString>;
4014
+ riskReason: z.ZodOptional<z.ZodString>;
4015
+ matchedTrustRuleId: z.ZodOptional<z.ZodString>;
4016
+ isContainerized: z.ZodOptional<z.ZodBoolean>;
4017
+ riskScopeOptions: z.ZodOptional<z.ZodArray<z.ZodObject<{
4018
+ pattern: z.ZodString;
4019
+ label: z.ZodString;
4020
+ }, z.core.$strip>>>;
4021
+ riskAllowlistOptions: z.ZodOptional<z.ZodArray<z.ZodObject<{
4022
+ label: z.ZodString;
4023
+ description: z.ZodString;
4024
+ pattern: z.ZodString;
4025
+ }, z.core.$strip>>>;
4026
+ riskDirectoryScopeOptions: z.ZodOptional<z.ZodArray<z.ZodObject<{
4027
+ label: z.ZodString;
4028
+ scope: z.ZodString;
4029
+ }, z.core.$strip>>>;
4030
+ approvalMode: z.ZodOptional<z.ZodString>;
4031
+ approvalReason: z.ZodOptional<z.ZodString>;
4032
+ riskThreshold: z.ZodOptional<z.ZodString>;
4033
+ activityMetadata: z.ZodOptional<z.ZodObject<{
4034
+ webSearch: z.ZodOptional<z.ZodObject<{
4035
+ query: z.ZodString;
4036
+ provider: z.ZodEnum<{
4037
+ "anthropic-native": "anthropic-native";
4038
+ brave: "brave";
4039
+ perplexity: "perplexity";
4040
+ tavily: "tavily";
4041
+ }>;
4042
+ resultCount: z.ZodNumber;
4043
+ durationMs: z.ZodNumber;
4044
+ results: z.ZodArray<z.ZodObject<{
4045
+ rank: z.ZodNumber;
4046
+ title: z.ZodString;
4047
+ url: z.ZodString;
4048
+ domain: z.ZodString;
4049
+ faviconUrl: z.ZodOptional<z.ZodString>;
4050
+ snippet: z.ZodOptional<z.ZodString>;
4051
+ age: z.ZodOptional<z.ZodString>;
4052
+ score: z.ZodOptional<z.ZodNumber>;
4053
+ }, z.core.$strip>>;
4054
+ errorMessage: z.ZodOptional<z.ZodString>;
4055
+ }, z.core.$strip>>;
4056
+ webFetch: z.ZodOptional<z.ZodObject<{
4057
+ url: z.ZodString;
4058
+ finalUrl: z.ZodString;
4059
+ status: z.ZodNumber;
4060
+ contentType: z.ZodOptional<z.ZodString>;
4061
+ byteCount: z.ZodNumber;
4062
+ charCount: z.ZodNumber;
4063
+ truncated: z.ZodBoolean;
4064
+ title: z.ZodOptional<z.ZodString>;
4065
+ domain: z.ZodString;
4066
+ faviconUrl: z.ZodOptional<z.ZodString>;
4067
+ redirectCount: z.ZodNumber;
4068
+ durationMs: z.ZodNumber;
4069
+ errorMessage: z.ZodOptional<z.ZodString>;
4070
+ mayRequireJavaScript: z.ZodOptional<z.ZodBoolean>;
4071
+ }, z.core.$strip>>;
4072
+ }, z.core.$strip>>;
4073
+ completedAt: z.ZodOptional<z.ZodNumber>;
4074
+ }, z.core.$strip>;
4075
+
4076
+ export declare interface ToolUseContent {
4077
+ type: "tool_use";
4078
+ id: string;
4079
+ name: string;
4080
+ input: Record<string, unknown>;
4081
+ providerMetadata?: {
4082
+ gemini?: {
4083
+ thoughtSignature?: string;
4084
+ };
4085
+ };
4086
+ }
4087
+
4088
+ declare type ToolUsePreviewStartEvent = z.infer<typeof ToolUsePreviewStartEventSchema>;
4089
+
4090
+ declare const ToolUsePreviewStartEventSchema: z.ZodObject<{
4091
+ type: z.ZodLiteral<"tool_use_preview_start">;
4092
+ toolUseId: z.ZodString;
4093
+ toolName: z.ZodString;
4094
+ conversationId: z.ZodOptional<z.ZodString>;
4095
+ messageId: z.ZodOptional<z.ZodString>;
4096
+ }, z.core.$strip>;
4097
+
4098
+ declare type ToolUseStartEvent = z.infer<typeof ToolUseStartEventSchema>;
4099
+
4100
+ declare const ToolUseStartEventSchema: z.ZodObject<{
4101
+ type: z.ZodLiteral<"tool_use_start">;
4102
+ toolName: z.ZodString;
4103
+ input: z.ZodRecord<z.ZodString, z.ZodUnknown>;
4104
+ toolUseId: z.ZodOptional<z.ZodString>;
4105
+ messageId: z.ZodOptional<z.ZodString>;
4106
+ conversationId: z.ZodOptional<z.ZodString>;
4107
+ startedAt: z.ZodOptional<z.ZodNumber>;
4108
+ }, z.core.$strip>;
4109
+
4110
+ declare type TraceEvent = z.infer<typeof TraceEventSchema>;
4111
+
4112
+ declare const TraceEventSchema: z.ZodObject<{
4113
+ type: z.ZodLiteral<"trace_event">;
4114
+ eventId: z.ZodString;
4115
+ conversationId: z.ZodString;
4116
+ requestId: z.ZodOptional<z.ZodString>;
4117
+ timestampMs: z.ZodNumber;
4118
+ sequence: z.ZodNumber;
4119
+ kind: z.ZodEnum<{
4120
+ generation_cancelled: "generation_cancelled";
4121
+ generation_handoff: "generation_handoff";
4122
+ message_complete: "message_complete";
4123
+ request_received: "request_received";
4124
+ request_queued: "request_queued";
4125
+ request_dequeued: "request_dequeued";
4126
+ llm_call_started: "llm_call_started";
4127
+ llm_call_finished: "llm_call_finished";
4128
+ assistant_message: "assistant_message";
4129
+ tool_started: "tool_started";
4130
+ tool_permission_requested: "tool_permission_requested";
4131
+ tool_permission_decided: "tool_permission_decided";
4132
+ tool_finished: "tool_finished";
4133
+ tool_failed: "tool_failed";
4134
+ request_error: "request_error";
4135
+ tool_profiling_summary: "tool_profiling_summary";
4136
+ }>;
4137
+ status: z.ZodOptional<z.ZodEnum<{
4138
+ error: "error";
4139
+ info: "info";
4140
+ success: "success";
4141
+ warning: "warning";
4142
+ }>>;
4143
+ summary: z.ZodString;
4144
+ attributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>>;
4145
+ }, z.core.$strip>;
4146
+
4147
+ /**
4148
+ * Trust classification for an inbound actor.
4149
+ *
4150
+ * - `'guardian'`: The sender matches the active guardian binding for this
4151
+ * (assistant, channel). Guardians have full control-plane access and
4152
+ * self-approve tool invocations.
4153
+ * - `'trusted_contact'`: The sender is an active contact with a channel
4154
+ * (not the guardian). Trusted contacts can invoke tools but require
4155
+ * guardian approval for sensitive operations.
4156
+ * - `'unknown'`: The sender has no contact record, no identity could be
4157
+ * established, or the sender is an inactive/revoked contact. Unknown
4158
+ * actors are fail-closed with no escalation path.
4159
+ */
4160
+ declare type TrustClass = "guardian" | "trusted_contact" | "unknown";
4161
+
4162
+ declare type TurnProfileAutoRoutedEvent = z.infer<typeof TurnProfileAutoRoutedEventSchema>;
4163
+
4164
+ declare const TurnProfileAutoRoutedEventSchema: z.ZodObject<{
4165
+ type: z.ZodLiteral<"turn_profile_auto_routed">;
4166
+ conversationId: z.ZodString;
4167
+ profile: z.ZodString;
4168
+ profileLabel: z.ZodString;
4169
+ }, z.core.$strip>;
4170
+
4171
+ declare interface UiSurfaceComplete {
4172
+ type: "ui_surface_complete";
4173
+ conversationId: string;
4174
+ surfaceId: string;
4175
+ summary: string;
4176
+ submittedData?: Record<string, unknown>;
4177
+ }
4178
+
4179
+ declare interface UiSurfaceDismiss {
4180
+ type: "ui_surface_dismiss";
4181
+ conversationId: string;
4182
+ surfaceId: string;
4183
+ }
4184
+
4185
+ declare type UiSurfaceShow = UiSurfaceShowCard | UiSurfaceShowChoice | UiSurfaceShowCopyBlock | UiSurfaceShowOAuthConnect | UiSurfaceShowForm | UiSurfaceShowList | UiSurfaceShowTable | UiSurfaceShowConfirmation | UiSurfaceShowDynamicPage | UiSurfaceShowFileUpload | UiSurfaceShowDocumentPreview | UiSurfaceShowWorkResult;
4186
+
4187
+ /** Common fields shared by all UiSurfaceShow variants. */
4188
+ declare interface UiSurfaceShowBase {
4189
+ type: "ui_surface_show";
4190
+ conversationId: string;
4191
+ surfaceId: string;
4192
+ title?: string;
4193
+ actions?: SurfaceAction[];
4194
+ display?: "inline" | "panel";
4195
+ /** The message ID that this surface belongs to (for history loading). */
4196
+ messageId?: string;
4197
+ /** When `true`, clicking an action does not dismiss the surface — the client keeps the card visible and only marks the clicked `actionId` as spent so siblings remain clickable. */
4198
+ persistent?: boolean;
4199
+ /** Id of the tool call that produced this surface (the `ui_show` proxy tool). Lets the client gate app previews on the tool result's arrival rather than whole-turn streaming state. */
4200
+ toolCallId?: string;
4201
+ }
4202
+
4203
+ declare interface UiSurfaceShowCard extends UiSurfaceShowBase {
4204
+ surfaceType: "card";
4205
+ data: CardSurfaceData;
4206
+ }
4207
+
4208
+ declare interface UiSurfaceShowChoice extends UiSurfaceShowBase {
4209
+ surfaceType: "choice";
4210
+ data: ChoiceSurfaceData;
4211
+ }
4212
+
4213
+ declare interface UiSurfaceShowConfirmation extends UiSurfaceShowBase {
4214
+ surfaceType: "confirmation";
4215
+ data: ConfirmationSurfaceData;
4216
+ }
4217
+
4218
+ declare interface UiSurfaceShowCopyBlock extends UiSurfaceShowBase {
4219
+ surfaceType: "copy_block";
4220
+ data: CopyBlockSurfaceData;
4221
+ }
4222
+
4223
+ declare interface UiSurfaceShowDocumentPreview extends UiSurfaceShowBase {
4224
+ surfaceType: "document_preview";
4225
+ data: DocumentPreviewSurfaceData;
4226
+ }
4227
+
4228
+ declare interface UiSurfaceShowDynamicPage extends UiSurfaceShowBase {
4229
+ surfaceType: "dynamic_page";
4230
+ data: DynamicPageSurfaceData;
4231
+ }
4232
+
4233
+ declare interface UiSurfaceShowFileUpload extends UiSurfaceShowBase {
4234
+ surfaceType: "file_upload";
4235
+ data: FileUploadSurfaceData;
4236
+ }
4237
+
4238
+ declare interface UiSurfaceShowForm extends UiSurfaceShowBase {
4239
+ surfaceType: "form";
4240
+ data: FormSurfaceData;
4241
+ }
4242
+
4243
+ declare interface UiSurfaceShowList extends UiSurfaceShowBase {
4244
+ surfaceType: "list";
4245
+ data: ListSurfaceData;
4246
+ }
4247
+
4248
+ declare interface UiSurfaceShowOAuthConnect extends UiSurfaceShowBase {
4249
+ surfaceType: "oauth_connect";
4250
+ data: OAuthConnectSurfaceData;
4251
+ }
4252
+
4253
+ declare interface UiSurfaceShowTable extends UiSurfaceShowBase {
4254
+ surfaceType: "table";
4255
+ data: TableSurfaceData;
4256
+ }
4257
+
4258
+ declare interface UiSurfaceShowWorkResult extends UiSurfaceShowBase {
4259
+ surfaceType: "work_result";
4260
+ data: WorkResultSurfaceData;
4261
+ }
4262
+
4263
+ declare interface UiSurfaceUndoResult {
4264
+ type: "ui_surface_undo_result";
4265
+ conversationId: string;
4266
+ surfaceId: string;
4267
+ success: boolean;
4268
+ /** Number of remaining undo entries after this undo. */
4269
+ remainingUndos: number;
4270
+ }
4271
+
4272
+ declare interface UiSurfaceUpdate {
4273
+ type: "ui_surface_update";
4274
+ conversationId: string;
4275
+ surfaceId: string;
4276
+ data: Partial<SurfaceData>;
4277
+ }
4278
+
4279
+ declare interface UndoComplete {
4280
+ type: "undo_complete";
4281
+ removedCount: number;
4282
+ conversationId?: string;
4283
+ }
4284
+
4285
+ declare interface UnpublishPageResponse {
4286
+ type: "unpublish_page_response";
4287
+ success: boolean;
4288
+ error?: string;
4289
+ }
4290
+
4291
+ declare type _UpgradesServerMessages = ServiceGroupUpdateStarting | ServiceGroupUpdateProgress | ServiceGroupUpdateComplete;
4292
+
4293
+ declare type UsageAttributionProfileSource = "call_site" | "conversation" | "active" | "default" | "unknown";
4294
+
4295
+ declare interface UsageAttributionSnapshot {
4296
+ callSite: LLMCallSite | null;
4297
+ activeProfile: string | null;
4298
+ overrideProfile: string | null;
4299
+ callSiteProfile: string | null;
4300
+ appliedProfile: string | null;
4301
+ profileSource: UsageAttributionProfileSource;
4302
+ resolvedProvider: string;
4303
+ resolvedModel: string;
4304
+ /**
4305
+ * When `appliedProfile` is a mix profile, the constituent arm chosen for
4306
+ * this request; null otherwise. Lets A/B analysis attribute usage to the
4307
+ * specific arm (mix name lives in `appliedProfile`).
4308
+ */
4309
+ resolvedMixArm: string | null;
4310
+ }
4311
+
4312
+ /**
4313
+ * Emitted after each LLM call with per-call token deltas and estimated cost.
4314
+ * Clients accumulate these additively for live-updating usage metrics.
4315
+ * This is a UI-only hint — it does not persist to DB or affect billing.
4316
+ */
4317
+ declare interface UsageProgress {
4318
+ type: "usage_progress";
4319
+ conversationId: string;
4320
+ inputTokens: number;
4321
+ outputTokens: number;
4322
+ estimatedCost: number;
4323
+ model: string;
4324
+ }
4325
+
4326
+ declare interface UsageResponse {
4327
+ type: "usage_response";
4328
+ totalInputTokens: number;
4329
+ totalOutputTokens: number;
4330
+ estimatedCost: number;
4331
+ model: string;
4332
+ }
4333
+
4334
+ declare interface UsageStats {
4335
+ inputTokens: number;
4336
+ outputTokens: number;
4337
+ estimatedCost: number;
4338
+ }
4339
+
4340
+ declare type UsageUpdateEvent = z.infer<typeof UsageUpdateEventSchema>;
4341
+
4342
+ declare const UsageUpdateEventSchema: z.ZodObject<{
4343
+ type: z.ZodLiteral<"usage_update">;
4344
+ conversationId: z.ZodString;
4345
+ inputTokens: z.ZodNumber;
4346
+ outputTokens: z.ZodNumber;
4347
+ totalInputTokens: z.ZodNumber;
4348
+ totalOutputTokens: z.ZodNumber;
4349
+ estimatedCost: z.ZodNumber;
4350
+ model: z.ZodString;
4351
+ contextWindowTokens: z.ZodOptional<z.ZodNumber>;
4352
+ contextWindowMaxTokens: z.ZodOptional<z.ZodNumber>;
4353
+ }, z.core.$strip>;
4354
+
4355
+ declare interface UserMessageAttachment {
4356
+ id?: string;
4357
+ filename: string;
4358
+ mimeType: string;
4359
+ data: string;
4360
+ /** Origin of the attachment on the daemon side, when known. */
4361
+ sourceType?: "sandbox_file" | "host_file" | "tool_block";
4362
+ extractedText?: string;
4363
+ /** Original file size in bytes. Present when data was omitted from history_response to reduce payload size. */
4364
+ sizeBytes?: number;
4365
+ /** Base64-encoded JPEG thumbnail. Generated server-side for video attachments. */
4366
+ thumbnailData?: string;
4367
+ /** Absolute path to the local file on disk. Present for file-backed attachments (e.g. recordings). */
4368
+ filePath?: string;
4369
+ /** True when the attachment is file-backed and clients should hydrate via the /content endpoint. */
4370
+ fileBacked?: boolean;
4371
+ }
4372
+
4373
+ declare type UserMessageEchoEvent = z.infer<typeof UserMessageEchoEventSchema>;
4374
+
4375
+ declare const UserMessageEchoEventSchema: z.ZodObject<{
4376
+ type: z.ZodLiteral<"user_message_echo">;
4377
+ text: z.ZodString;
4378
+ conversationId: z.ZodOptional<z.ZodString>;
4379
+ messageId: z.ZodOptional<z.ZodString>;
4380
+ requestId: z.ZodOptional<z.ZodString>;
4381
+ clientMessageId: z.ZodOptional<z.ZodString>;
4382
+ }, z.core.$strict>;
4383
+
4384
+ /**
4385
+ * Context passed to the `user-prompt-submit` hook. Fires once per user
4386
+ * turn, after the agent loop has prepared the message list (PKB / NOW /
4387
+ * memory-graph injections, overflow reduction all already applied) and
4388
+ * immediately before the messages are handed to the agent loop's tool/LLM
4389
+ * iteration.
4390
+ *
4391
+ * The hook may transform `latestMessages` either by mutating it in place
4392
+ * (`push` / `splice` / `length = 0`) or by returning a new context with
4393
+ * a fresh `latestMessages` array — see {@link PluginHookFn}'s polymorphic
4394
+ * return shape. The daemon threads the final `latestMessages` value into
4395
+ * `agentLoop.run()` as the run-messages argument.
4396
+ *
4397
+ * `originalMessages` is the user's original message list, frozen for the
4398
+ * hook. Plugins should treat it as a stable reference point if they need
4399
+ * to recover from earlier transformations or compare against the pristine
4400
+ * state.
4401
+ *
4402
+ * Multiple plugins' hooks chain in registration order — each plugin's
4403
+ * hook sees the previous plugin's mutations (whether by reassignment or
4404
+ * in-place mutation).
4405
+ */
4406
+ export declare interface UserPromptSubmitContext {
4407
+ /** Conversation ID the user prompt was submitted on. */
4408
+ readonly conversationId: string;
4409
+ /**
4410
+ * Persisted ID of the user message that triggered this turn. Hooks that
4411
+ * attach turn-scoped metadata to the originating message (e.g. recording an
4412
+ * injected memory block so it survives a conversation reload) key off this
4413
+ * row id rather than the in-memory message arrays, whose entries carry no id.
4414
+ */
4415
+ readonly userMessageId: string;
4416
+ /**
4417
+ * Stable ID for the request that drives this turn. Hooks that perform
4418
+ * runtime injection forward it onto the injector turn context so the
4419
+ * assembled blocks are attributed to the originating request; it is fixed
4420
+ * for the turn and cannot be recovered from the message arrays.
4421
+ */
4422
+ readonly requestId: string;
4423
+ /**
4424
+ * Active inference profile key to surface in this turn's context, or `null`
4425
+ * when the profile is unchanged since the one last announced to the model.
4426
+ * Hooks that emit the `model_profile` grounding line resolve the
4427
+ * human-readable label (and model id) from this key via the workspace LLM
4428
+ * config rather than receiving the rendered string — the key is the minimal
4429
+ * turn input the message arrays cannot carry.
4430
+ */
4431
+ readonly modelProfileKey: string | null;
4432
+ /**
4433
+ * Whether the turn has no human present to answer clarification questions
4434
+ * (e.g. a scheduled, background, or headless run). Resolved once at turn
4435
+ * start from the run's interactivity option, falling back to live client
4436
+ * presence — a single value the hook reads rather than re-deriving from
4437
+ * mutable conversation state that can flip mid-turn. Hooks that assemble the
4438
+ * turn's runtime injections forward it so the assembled context reflects the
4439
+ * turn's interactivity.
4440
+ */
4441
+ readonly isNonInteractive: boolean;
4442
+ /**
4443
+ * The text of the user prompt that triggered this turn — the resolved
4444
+ * user message (after slash-command expansion), independent of any
4445
+ * internal rewriting applied to the message that flows into the model.
4446
+ * Mirrors the `prompt` field Claude Code / Codex pass to their
4447
+ * `UserPromptSubmit` hooks, so hooks that key off the submitted text
4448
+ * (e.g. title generation) read it directly rather than reconstructing
4449
+ * it from the message arrays.
4450
+ */
4451
+ readonly prompt: string;
4452
+ /**
4453
+ * The user's original message list, immutable for the hook. Plugins
4454
+ * may snapshot or compare against this but MUST NOT mutate it.
4455
+ */
4456
+ readonly originalMessages: ReadonlyArray<Message>;
4457
+ /**
4458
+ * The working message list that flows into `agentLoop.run`. Plugins
4459
+ * may mutate this in place or replace it by returning a new context.
4460
+ */
4461
+ latestMessages: Message[];
4462
+ /**
4463
+ * Logger scoped to the current turn. The same instance is shared by
4464
+ * every hook in the chain, so plugins should tag their structured log
4465
+ * fields (e.g. `{ plugin: "<name>" }`) for attribution.
4466
+ */
4467
+ readonly logger: PluginLogger;
4468
+ }
4469
+
4470
+ declare interface VellumSlimSkill extends SlimSkillBase {
4471
+ origin: "vellum";
4472
+ }
4473
+
4474
+ declare interface VercelApiConfigResponse {
4475
+ type: "vercel_api_config_response";
4476
+ hasToken: boolean;
4477
+ success: boolean;
4478
+ error?: string;
4479
+ }
4480
+
4481
+ declare interface WebFetchMetadata {
4482
+ url: string;
4483
+ finalUrl: string;
4484
+ status: number;
4485
+ contentType?: string;
4486
+ byteCount: number;
4487
+ charCount: number;
4488
+ truncated: boolean;
4489
+ title?: string;
4490
+ domain: string;
4491
+ faviconUrl?: string;
4492
+ redirectCount: number;
4493
+ durationMs: number;
4494
+ errorMessage?: string;
4495
+ /** Set when extracted text is dramatically smaller than raw HTML — likely a JS-rendered SPA whose meaningful content the static fetcher missed. */
4496
+ mayRequireJavaScript?: boolean;
4497
+ }
4498
+
4499
+ declare interface WebSearchMetadata {
4500
+ query: string;
4501
+ provider: WebSearchProviderId;
4502
+ resultCount: number;
4503
+ durationMs: number;
4504
+ results: WebSearchResultItem[];
4505
+ /** Present when search itself failed; results[] will be empty. */
4506
+ errorMessage?: string;
4507
+ }
4508
+
4509
+ declare type WebSearchProviderId = "anthropic-native" | "brave" | "perplexity" | "tavily";
4510
+
4511
+ declare interface WebSearchResultItem {
4512
+ rank: number;
4513
+ title: string;
4514
+ url: string;
4515
+ domain: string;
4516
+ faviconUrl?: string;
4517
+ snippet?: string;
4518
+ age?: string;
4519
+ score?: number;
4520
+ }
4521
+
4522
+ export declare interface WebSearchToolResultContent {
4523
+ type: "web_search_tool_result";
4524
+ tool_use_id: string;
4525
+ content: unknown;
4526
+ }
4527
+
4528
+ declare interface WorkItemApprovePermissionsResponse {
4529
+ type: "work_item_approve_permissions_response";
4530
+ id: string;
4531
+ success: boolean;
4532
+ error?: string;
4533
+ }
4534
+
4535
+ declare interface WorkItemCancelResponse {
4536
+ type: "work_item_cancel_response";
4537
+ id: string;
4538
+ success: boolean;
4539
+ error?: string;
4540
+ }
4541
+
4542
+ declare interface WorkItemDeleteResponse {
4543
+ type: "work_item_delete_response";
4544
+ id: string;
4545
+ success: boolean;
4546
+ }
4547
+
4548
+ declare interface WorkItemGetResponse {
4549
+ type: "work_item_get_response";
4550
+ item: {
4551
+ id: string;
4552
+ taskId: string;
4553
+ title: string;
4554
+ notes: string | null;
4555
+ status: string;
4556
+ priorityTier: number;
4557
+ sortIndex: number | null;
4558
+ lastRunId: string | null;
4559
+ lastRunConversationId: string | null;
4560
+ lastRunStatus: string | null;
4561
+ sourceType: string | null;
4562
+ sourceId: string | null;
4563
+ createdAt: number;
4564
+ updatedAt: number;
4565
+ } | null;
4566
+ }
4567
+
4568
+ declare interface WorkItemOutputResponse {
4569
+ type: "work_item_output_response";
4570
+ id: string;
4571
+ success: boolean;
4572
+ error?: string;
4573
+ output?: {
4574
+ title: string;
4575
+ status: string;
4576
+ runId: string | null;
4577
+ conversationId: string | null;
4578
+ completedAt: number | null;
4579
+ summary: string;
4580
+ highlights: string[];
4581
+ };
4582
+ }
4583
+
4584
+ declare interface WorkItemPreflightResponse {
4585
+ type: "work_item_preflight_response";
4586
+ id: string;
4587
+ success: boolean;
4588
+ error?: string;
4589
+ permissions?: {
4590
+ tool: string;
4591
+ description: string;
4592
+ riskLevel: "low" | "medium" | "high";
4593
+ currentDecision: "allow" | "deny" | "prompt";
4594
+ }[];
4595
+ }
4596
+
4597
+ declare type WorkItemRunTaskErrorCode = "not_found" | "already_running" | "invalid_status" | "no_task" | "permission_required";
4598
+
4599
+ declare interface WorkItemRunTaskResponse {
4600
+ type: "work_item_run_task_response";
4601
+ id: string;
4602
+ lastRunId: string;
4603
+ success: boolean;
4604
+ error?: string;
4605
+ /** Structured error code so the client can deterministically re-enable buttons or show contextual UI. */
4606
+ errorCode?: WorkItemRunTaskErrorCode;
4607
+ }
4608
+
4609
+ declare interface WorkItemsListResponse {
4610
+ type: "work_items_list_response";
4611
+ items: Array<{
4612
+ id: string;
4613
+ taskId: string;
4614
+ title: string;
4615
+ notes: string | null;
4616
+ status: string;
4617
+ priorityTier: number;
4618
+ sortIndex: number | null;
4619
+ lastRunId: string | null;
4620
+ lastRunConversationId: string | null;
4621
+ lastRunStatus: string | null;
4622
+ sourceType: string | null;
4623
+ sourceId: string | null;
4624
+ createdAt: number;
4625
+ updatedAt: number;
4626
+ }>;
4627
+ }
4628
+
4629
+ declare type _WorkItemsServerMessages = WorkItemsListResponse | WorkItemGetResponse | WorkItemUpdateResponse | WorkItemDeleteResponse | WorkItemRunTaskResponse | WorkItemOutputResponse | WorkItemPreflightResponse | WorkItemApprovePermissionsResponse | WorkItemCancelResponse | WorkItemStatusChanged | TaskRunConversationCreated | TasksChanged;
4630
+
4631
+ /** Server push — broadcast when a work item status changes (e.g. running -> awaiting_review). */
4632
+ declare interface WorkItemStatusChanged {
4633
+ type: "work_item_status_changed";
4634
+ item: {
4635
+ id: string;
4636
+ taskId: string;
4637
+ title: string;
4638
+ status: string;
4639
+ lastRunId: string | null;
4640
+ lastRunConversationId: string | null;
4641
+ lastRunStatus: string | null;
4642
+ updatedAt: number;
4643
+ };
4644
+ }
4645
+
4646
+ declare interface WorkItemUpdateResponse {
4647
+ type: "work_item_update_response";
4648
+ item: {
4649
+ id: string;
4650
+ taskId: string;
4651
+ title: string;
4652
+ notes: string | null;
4653
+ status: string;
4654
+ priorityTier: number;
4655
+ sortIndex: number | null;
4656
+ lastRunId: string | null;
4657
+ lastRunConversationId: string | null;
4658
+ lastRunStatus: string | null;
4659
+ sourceType: string | null;
4660
+ sourceId: string | null;
4661
+ createdAt: number;
4662
+ updatedAt: number;
4663
+ } | null;
4664
+ }
4665
+
4666
+ declare interface WorkResultDiff {
4667
+ label?: string;
4668
+ before?: string;
4669
+ after?: string;
4670
+ }
4671
+
4672
+ declare interface WorkResultItem {
4673
+ id?: string;
4674
+ title: string;
4675
+ description?: string;
4676
+ status?: string;
4677
+ tone?: WorkResultTone;
4678
+ metadata?: WorkResultMetadata[];
4679
+ href?: string;
4680
+ }
4681
+
4682
+ declare interface WorkResultMetadata {
4683
+ label: string;
4684
+ value: string | number;
4685
+ }
4686
+
4687
+ declare interface WorkResultMetric {
4688
+ label: string;
4689
+ value: string | number;
4690
+ detail?: string;
4691
+ tone?: WorkResultTone;
4692
+ }
4693
+
4694
+ declare interface WorkResultSection {
4695
+ id?: string;
4696
+ title: string;
4697
+ description?: string;
4698
+ type?: WorkResultSectionType;
4699
+ items?: WorkResultItem[];
4700
+ diffs?: WorkResultDiff[];
4701
+ }
4702
+
4703
+ declare type WorkResultSectionType = "items" | "timeline" | "diff" | "artifacts" | "warnings";
4704
+
4705
+ declare type WorkResultStatus = "completed" | "partial" | "failed" | "in_progress";
4706
+
4707
+ declare interface WorkResultSurfaceData {
4708
+ eyebrow?: string;
4709
+ status?: WorkResultStatus;
4710
+ summary?: string;
4711
+ metrics?: WorkResultMetric[];
4712
+ sections?: WorkResultSection[];
4713
+ }
4714
+
4715
+ declare type WorkResultTone = "neutral" | "positive" | "warning" | "negative";
4716
+
4717
+ declare interface WorkspaceFileReadResponse {
4718
+ type: "workspace_file_read_response";
4719
+ path: string;
4720
+ content: string | null;
4721
+ error?: string;
4722
+ }
4723
+
4724
+ declare interface WorkspaceFilesListResponse {
4725
+ type: "workspace_files_list_response";
4726
+ files: Array<{
4727
+ /** Relative path within the workspace (e.g. "IDENTITY.md", "skills/my-skill"). */
4728
+ path: string;
4729
+ /** Display name (e.g. "IDENTITY.md"). */
4730
+ name: string;
4731
+ /** Whether the file/directory exists. */
4732
+ exists: boolean;
4733
+ }>;
4734
+ }
4735
+
4736
+ declare type _WorkspaceServerMessages = WorkspaceFilesListResponse | WorkspaceFileReadResponse | IdentityGetResponse | ToolPermissionSimulateResponse | ToolNamesListResponse | IdentityChangedEvent;
4737
+
4738
+ export { }