@vellumai/plugin-api 0.8.12-dev.202606151838.c96914b → 0.8.12-dev.202606152157.b1ba560

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 +16 -4
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -2770,8 +2770,11 @@ export declare interface PostCompactContext {
2770
2770
  * the hook's result as the persisted and streamed message), and
2771
2771
  * {@link stopReason} carries the provider's stop reason. Fires once per model
2772
2772
  * call, including tool-bearing turns (a reply can carry both text and
2773
- * `tool_use`), so a hook should transform only the blocks it owns and leave
2774
- * 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.
2775
2778
  * - **Provider rejection.** The call threw before any reply existed.
2776
2779
  * {@link error} holds the rejection, {@link content} is empty, and
2777
2780
  * {@link stopReason} is `null`. A hook that recognizes the rejection may
@@ -2795,8 +2798,17 @@ export declare interface PostModelCallContext {
2795
2798
  /** The call site this message serves — `"mainAgent"` for the user-facing reply; `null` when untagged. */
2796
2799
  readonly callSite: LLMCallSite | null;
2797
2800
  /**
2798
- * The finalized message content. Mutable transform the text blocks and leave
2799
- * `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.
2800
2812
  */
2801
2813
  content: ContentBlock[];
2802
2814
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vellumai/plugin-api",
3
- "version": "0.8.12-dev.202606151838.c96914b",
3
+ "version": "0.8.12-dev.202606152157.b1ba560",
4
4
  "description": "Public TypeScript authoring contract for Vellum assistant plugins.",
5
5
  "license": "MIT",
6
6
  "type": "module",