@vellumai/plugin-api 0.8.12-staging.2 → 0.9.0-dev.202606162156.4bad3e5

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 +109 -20
  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
 
@@ -919,9 +920,9 @@ declare interface ContextCompacted {
919
920
  * - `summaryCharCount`: length of the produced summary text.
920
921
  * - `summaryHeaderCount`: number of `## ` section headers in the summary.
921
922
  * - `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.
923
+ * injection tag (e.g. `<memory`, `<turn_context>`, `<workspace>`). The
924
+ * durable summary should be clean prose, so `true` flags an echoed or
925
+ * invented tag worth investigating.
925
926
  */
926
927
  summaryCharCount?: number;
927
928
  summaryHeaderCount?: number;
@@ -1728,7 +1729,7 @@ export declare const HOOKS: {
1728
1729
  readonly SHUTDOWN: "shutdown";
1729
1730
  /** Fires once per user turn, immediately before the agent loop receives `runMessages`. */
1730
1731
  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
+ /** Fires immediately before each provider call. A hook may edit the outbound request (e.g. the system prompt), route the call to a different inference profile, and opt the turn into deferred output streaming. */
1732
1733
  readonly PRE_MODEL_CALL: "pre-model-call";
1733
1734
  /** Fires once per tool result, after the tool returns and before the result is sent to the provider. */
1734
1735
  readonly POST_TOOL_USE: "post-tool-use";
@@ -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
  /**
@@ -2915,8 +2929,9 @@ export declare interface PostToolUseContext {
2915
2929
  * and compaction work can share a conversation), hooks MUST self-gate on
2916
2930
  * {@link callSite} / {@link conversationId} before acting.
2917
2931
  *
2918
- * A hook may edit the outbound request by replacing {@link systemPrompt}, and may
2919
- * opt this turn into deferred output streaming via {@link deferAssistantOutput}.
2932
+ * A hook may edit the outbound request by replacing {@link systemPrompt}, route
2933
+ * the call to a different inference profile via {@link modelProfile}, and opt
2934
+ * this turn into deferred output streaming via {@link deferAssistantOutput}.
2920
2935
  * Mutate the context in place or return a new one; throwing is contained by the
2921
2936
  * loop (the call proceeds with the original request).
2922
2937
  */
@@ -2933,6 +2948,24 @@ export declare interface PreModelCallContext {
2933
2948
  * append a section); the loop sends the resulting value.
2934
2949
  */
2935
2950
  systemPrompt: string | null;
2951
+ /**
2952
+ * Inference profile to route THIS provider call to, named by its key in the
2953
+ * workspace `llm.profiles`. Seeded with the call's already-resolved override
2954
+ * profile, or `null` when none applies. A hook may replace it to select a
2955
+ * different profile per call — the lever a model router uses to map a
2956
+ * classified message onto a profile (model + provider connection + sampling
2957
+ * settings). For the user-facing `mainAgent` call the resolver layers the
2958
+ * named profile at the top of precedence (above the workspace active
2959
+ * profile), so the hook's choice wins; a key with no matching profile falls
2960
+ * through unchanged (no throw). Honored only when {@link callSite} is set.
2961
+ * Set to `null` to apply no override.
2962
+ *
2963
+ * Context-window sizing and overflow recovery for this call are computed from
2964
+ * the profile resolved before the hook runs. Routing a near-budget
2965
+ * conversation to a profile with a smaller context window relies on the loop's
2966
+ * overflow recovery (compact and retry) rather than proactive compaction.
2967
+ */
2968
+ modelProfile: string | null;
2936
2969
  /**
2937
2970
  * Seeded `false`. When a hook sets it `true`, the loop suppresses this turn's
2938
2971
  * live assistant `text_delta` stream; a `post-model-call` hook is then
@@ -3162,7 +3195,7 @@ declare interface SensitiveOutputBinding {
3162
3195
 
3163
3196
  declare type SensitiveOutputKind = "invite_code";
3164
3197
 
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;
3198
+ 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
3199
 
3167
3200
  export declare interface ServerToolUseContent {
3168
3201
  type: "server_tool_use";
@@ -4349,6 +4382,8 @@ declare const UsageUpdateEventSchema: z.ZodObject<{
4349
4382
  conversationId: z.ZodString;
4350
4383
  inputTokens: z.ZodNumber;
4351
4384
  outputTokens: z.ZodNumber;
4385
+ cacheCreationInputTokens: z.ZodOptional<z.ZodNumber>;
4386
+ cacheReadInputTokens: z.ZodOptional<z.ZodNumber>;
4352
4387
  totalInputTokens: z.ZodNumber;
4353
4388
  totalOutputTokens: z.ZodNumber;
4354
4389
  estimatedCost: z.ZodNumber;
@@ -4530,6 +4565,60 @@ export declare interface WebSearchToolResultContent {
4530
4565
  content: unknown;
4531
4566
  }
4532
4567
 
4568
+ /**
4569
+ * Terminal push for a workflow run. Carries the final status, counts, token
4570
+ * usage, and a human-readable result/error summary the originating
4571
+ * conversation also receives via an agent wake.
4572
+ */
4573
+ declare interface WorkflowCompleted {
4574
+ type: "workflow_completed";
4575
+ runId: string;
4576
+ status: WorkflowRunStatus;
4577
+ agentsSpawned: number;
4578
+ inputTokens: number;
4579
+ outputTokens: number;
4580
+ /** Human-readable result-or-error summary. */
4581
+ summary?: string;
4582
+ }
4583
+
4584
+ /**
4585
+ * Progress push for an in-flight workflow run. Maps the engine's
4586
+ * `onProgress` (`phase`/`log`) callback plus the current usage snapshot into a
4587
+ * single wire event. `phase` carries the latest `phase(title)`; `message`
4588
+ * carries the latest `log(msg)`; only one is set per emission.
4589
+ */
4590
+ declare interface WorkflowProgress {
4591
+ type: "workflow_progress";
4592
+ runId: string;
4593
+ /** Latest phase title, when this emission came from a `phase(...)` call. */
4594
+ phase?: string;
4595
+ /** Run label (the workflow's `meta.name`), for client display. */
4596
+ label?: string;
4597
+ /** Live agent count at emission time. */
4598
+ agentsSpawned: number;
4599
+ /** Latest log line, when this emission came from a `log(...)` call. */
4600
+ message?: string;
4601
+ }
4602
+
4603
+ /**
4604
+ * Typed persistence for the workflow orchestration engine.
4605
+ *
4606
+ * Two tables (created by migration 282):
4607
+ *
4608
+ * - `workflow_runs` — one row per orchestration run (a sandboxed script that
4609
+ * spawns parallel leaf agents), tracking lifecycle status and token usage.
4610
+ * - `workflow_journal` — append-only `(run_id, seq)` log of every leaf call
4611
+ * (agent / host function / nested workflow). On resume after a daemon
4612
+ * restart, the engine replays cached results for the unchanged call prefix
4613
+ * instead of re-spawning agents.
4614
+ *
4615
+ * This module is pure persistence — no `workflows` feature-flag logic. Callers
4616
+ * (the engine, a later PR) own gating.
4617
+ */
4618
+ declare type WorkflowRunStatus = "running" | "completed" | "failed" | "aborted" | "cap_exceeded" | "interrupted";
4619
+
4620
+ declare type _WorkflowsServerMessages = WorkflowProgress | WorkflowCompleted;
4621
+
4533
4622
  declare interface WorkItemApprovePermissionsResponse {
4534
4623
  type: "work_item_approve_permissions_response";
4535
4624
  id: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vellumai/plugin-api",
3
- "version": "0.8.12-staging.2",
3
+ "version": "0.9.0-dev.202606162156.4bad3e5",
4
4
  "description": "Public TypeScript authoring contract for Vellum assistant plugins.",
5
5
  "license": "MIT",
6
6
  "type": "module",