@vellumai/plugin-api 0.8.12 → 0.9.0-staging.1

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 (2) hide show
  1. package/index.d.ts +84 -14
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -463,14 +463,15 @@ declare const AssistantTextDeltaEventSchema: z.ZodObject<{
463
463
  conversationId: z.ZodOptional<z.ZodString>;
464
464
  }, z.core.$strip>;
465
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
- }
466
+ declare type AssistantThinkingDeltaEvent = z.infer<typeof AssistantThinkingDeltaEventSchema>;
467
+
468
+ declare const AssistantThinkingDeltaEventSchema: z.ZodObject<{
469
+ type: z.ZodLiteral<"assistant_thinking_delta">;
470
+ thinking: z.ZodString;
471
+ messageId: z.ZodOptional<z.ZodString>;
472
+ conversationId: z.ZodOptional<z.ZodString>;
473
+ timestampMs: z.ZodOptional<z.ZodNumber>;
474
+ }, z.core.$strip>;
474
475
 
475
476
  declare type AssistantTurnStartEvent = z.infer<typeof AssistantTurnStartEventSchema>;
476
477
 
@@ -2162,6 +2163,7 @@ declare const LLMCallSiteEnum: z.ZodEnum<{
2162
2163
  trustRuleSuggestion: "trustRuleSuggestion";
2163
2164
  homeGreeting: "homeGreeting";
2164
2165
  homeSuggestedPrompts: "homeSuggestedPrompts";
2166
+ workflowLeaf: "workflowLeaf";
2165
2167
  }>;
2166
2168
 
2167
2169
  /**
@@ -2420,7 +2422,7 @@ declare const MessageRequestCompleteEventSchema: z.ZodObject<{
2420
2422
  runStillActive: z.ZodOptional<z.ZodBoolean>;
2421
2423
  }, z.core.$strip>;
2422
2424
 
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;
2425
+ declare type _MessagesServerMessages = UserMessageEchoEvent | AssistantTurnStartEvent | AssistantTextDeltaEvent | AssistantThinkingDeltaEvent | ToolUseStartEvent | ToolUsePreviewStartEvent | ToolOutputChunkEvent | ToolInputDelta | ToolResultEvent | ConfirmationRequestEvent | SecretRequestEvent | QuestionRequestEvent | MessageCompleteEvent | ErrorEvent_2 | MessageQueuedEvent | MessageDequeuedEvent | MessageRequestCompleteEvent | MessageQueuedDeletedEvent | MessageSteered | SuggestionResponse | TraceEvent | ConfirmationStateChanged | AssistantActivityStateEvent | TurnProfileAutoRoutedEvent | ConversationInferenceProfileUpdated | InteractionResolvedEvent;
2424
2426
 
2425
2427
  declare interface MessageSteered {
2426
2428
  type: "message_steered";
@@ -2768,8 +2770,11 @@ export declare interface PostCompactContext {
2768
2770
  * the hook's result as the persisted and streamed message), and
2769
2771
  * {@link stopReason} carries the provider's stop reason. Fires once per model
2770
2772
  * 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
+ * `tool_use`). A hook should leave blocks it does not own untouched, but it
2774
+ * may **append a `tool_use` block** to invoke a tool as if the model had
2775
+ * called it — the loop executes whatever the finalized content carries (see
2776
+ * {@link content}). This is the supported way for a plugin to drive a tool
2777
+ * (e.g. render a surface via `ui_show`) deterministically after a turn.
2773
2778
  * - **Provider rejection.** The call threw before any reply existed.
2774
2779
  * {@link error} holds the rejection, {@link content} is empty, and
2775
2780
  * {@link stopReason} is `null`. A hook that recognizes the rejection may
@@ -2793,8 +2798,17 @@ export declare interface PostModelCallContext {
2793
2798
  /** The call site this message serves — `"mainAgent"` for the user-facing reply; `null` when untagged. */
2794
2799
  readonly callSite: LLMCallSite | null;
2795
2800
  /**
2796
- * The finalized message content. Mutable transform the text blocks and leave
2797
- * `tool_use` (and other non-text blocks) intact. Empty on a provider rejection.
2801
+ * The finalized message content. Mutable, and the source of truth for both
2802
+ * persistence and execution: the loop derives the turn's executable tool
2803
+ * calls from this array *after* the hook chain runs. A hook may transform the
2804
+ * text blocks, **append a `tool_use` block** to invoke a tool as if the model
2805
+ * had called it (executed through the normal tool path — trust rules apply,
2806
+ * and its result/surface is appended after any already-streamed text without
2807
+ * discarding it), or drop a `tool_use` block to suppress a call. The host
2808
+ * assigns an id to any appended `tool_use` block whose `id` is empty or
2809
+ * collides. Empty on a provider rejection. Appended `tool_use` blocks are
2810
+ * dropped on a truncated (max-tokens) turn, which short-circuits before the
2811
+ * executor runs and so cannot pair a tool call with a result.
2798
2812
  */
2799
2813
  content: ContentBlock[];
2800
2814
  /**
@@ -3162,7 +3176,7 @@ declare interface SensitiveOutputBinding {
3162
3176
 
3163
3177
  declare type SensitiveOutputKind = "invite_code";
3164
3178
 
3165
- 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;
3179
+ 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 | _WorkflowsServerMessages | DiskPressureStatusChangedEvent | SubagentEvent;
3166
3180
 
3167
3181
  export declare interface ServerToolUseContent {
3168
3182
  type: "server_tool_use";
@@ -4349,6 +4363,8 @@ declare const UsageUpdateEventSchema: z.ZodObject<{
4349
4363
  conversationId: z.ZodString;
4350
4364
  inputTokens: z.ZodNumber;
4351
4365
  outputTokens: z.ZodNumber;
4366
+ cacheCreationInputTokens: z.ZodOptional<z.ZodNumber>;
4367
+ cacheReadInputTokens: z.ZodOptional<z.ZodNumber>;
4352
4368
  totalInputTokens: z.ZodNumber;
4353
4369
  totalOutputTokens: z.ZodNumber;
4354
4370
  estimatedCost: z.ZodNumber;
@@ -4530,6 +4546,60 @@ export declare interface WebSearchToolResultContent {
4530
4546
  content: unknown;
4531
4547
  }
4532
4548
 
4549
+ /**
4550
+ * Terminal push for a workflow run. Carries the final status, counts, token
4551
+ * usage, and a human-readable result/error summary the originating
4552
+ * conversation also receives via an agent wake.
4553
+ */
4554
+ declare interface WorkflowCompleted {
4555
+ type: "workflow_completed";
4556
+ runId: string;
4557
+ status: WorkflowRunStatus;
4558
+ agentsSpawned: number;
4559
+ inputTokens: number;
4560
+ outputTokens: number;
4561
+ /** Human-readable result-or-error summary. */
4562
+ summary?: string;
4563
+ }
4564
+
4565
+ /**
4566
+ * Progress push for an in-flight workflow run. Maps the engine's
4567
+ * `onProgress` (`phase`/`log`) callback plus the current usage snapshot into a
4568
+ * single wire event. `phase` carries the latest `phase(title)`; `message`
4569
+ * carries the latest `log(msg)`; only one is set per emission.
4570
+ */
4571
+ declare interface WorkflowProgress {
4572
+ type: "workflow_progress";
4573
+ runId: string;
4574
+ /** Latest phase title, when this emission came from a `phase(...)` call. */
4575
+ phase?: string;
4576
+ /** Run label (the workflow's `meta.name`), for client display. */
4577
+ label?: string;
4578
+ /** Live agent count at emission time. */
4579
+ agentsSpawned: number;
4580
+ /** Latest log line, when this emission came from a `log(...)` call. */
4581
+ message?: string;
4582
+ }
4583
+
4584
+ /**
4585
+ * Typed persistence for the workflow orchestration engine.
4586
+ *
4587
+ * Two tables (created by migration 282):
4588
+ *
4589
+ * - `workflow_runs` — one row per orchestration run (a sandboxed script that
4590
+ * spawns parallel leaf agents), tracking lifecycle status and token usage.
4591
+ * - `workflow_journal` — append-only `(run_id, seq)` log of every leaf call
4592
+ * (agent / host function / nested workflow). On resume after a daemon
4593
+ * restart, the engine replays cached results for the unchanged call prefix
4594
+ * instead of re-spawning agents.
4595
+ *
4596
+ * This module is pure persistence — no `workflows` feature-flag logic. Callers
4597
+ * (the engine, a later PR) own gating.
4598
+ */
4599
+ declare type WorkflowRunStatus = "running" | "completed" | "failed" | "aborted" | "cap_exceeded" | "interrupted";
4600
+
4601
+ declare type _WorkflowsServerMessages = WorkflowProgress | WorkflowCompleted;
4602
+
4533
4603
  declare interface WorkItemApprovePermissionsResponse {
4534
4604
  type: "work_item_approve_permissions_response";
4535
4605
  id: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vellumai/plugin-api",
3
- "version": "0.8.12",
3
+ "version": "0.9.0-staging.1",
4
4
  "description": "Public TypeScript authoring contract for Vellum assistant plugins.",
5
5
  "license": "MIT",
6
6
  "type": "module",