@vellumai/plugin-api 0.10.5-dev.202607031734.f263495 → 0.10.5-dev.202607031834.d3e3143

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 +107 -55
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -533,6 +533,30 @@ declare interface BaseAssistantEvent<TMessage = unknown> {
533
533
  message: TMessage;
534
534
  }
535
535
 
536
+ /**
537
+ * Capabilities shared by every chain-hook context (`user-prompt-submit`,
538
+ * `post-compact`, `post-tool-use`, `stop`, `pre-model-call`,
539
+ * `post-model-call`).
540
+ *
541
+ * Both are stamped onto each hook's draft by the pipeline (`runHook`) before
542
+ * the hook runs, bound to that hook's identity — dispatching call sites
543
+ * construct the `XInputContext` shapes and never supply these.
544
+ */
545
+ declare interface BaseHookContext {
546
+ /**
547
+ * Logger bound to the emitting hook — pre-tagged with the hook name and
548
+ * owning plugin (plus `conversationId` / `requestId` when the dispatching
549
+ * context carries them), so hook log lines are attributed without manual
550
+ * tagging.
551
+ */
552
+ readonly logger: PluginLogger;
553
+ /**
554
+ * Per-hook `hook_event` emitter, bound to this hook's owner — see
555
+ * {@link HookBroadcast}.
556
+ */
557
+ readonly broadcast: HookBroadcast;
558
+ }
559
+
536
560
  declare interface BaseSubscriberEntry {
537
561
  filter: AssistantEventFilter;
538
562
  callback: AssistantEventCallback;
@@ -1827,6 +1851,20 @@ declare const HomeFeedUpdatedEventSchema: z.ZodObject<{
1827
1851
 
1828
1852
  declare type _HomeServerMessages = RelationshipStateUpdatedEvent | HomeFeedUpdatedEvent;
1829
1853
 
1854
+ /**
1855
+ * Emit a `hook_event` to any UI watching the conversation the hook runs in —
1856
+ * e.g. progress while the hook does work the user can feel (memory
1857
+ * selection). The daemon stamps the conversation, the hook name, and the
1858
+ * emitting hook's owner; the hook supplies only `detail`, an arbitrary
1859
+ * JSON-serializable record whose shape it and its client renderer agree on.
1860
+ *
1861
+ * Best-effort and fire-and-forget: it never blocks or fails the turn, and
1862
+ * cannot emit any other event type or target another conversation — the emit
1863
+ * surface is bound to the turn. Contexts without a `conversationId` emit an
1864
+ * unscoped `hook_event`.
1865
+ */
1866
+ declare type HookBroadcast = (detail: Record<string, unknown>) => void;
1867
+
1830
1868
  declare type HookEvent = z.infer<typeof HookEventSchema>;
1831
1869
 
1832
1870
  declare const HookEventSchema: z.ZodObject<{
@@ -1862,6 +1900,7 @@ declare const HookEventSchema: z.ZodObject<{
1862
1900
  * - `init` — {@link InitContext}
1863
1901
  * - `shutdown` — {@link ShutdownContext}
1864
1902
  * - `user-prompt-submit` — {@link UserPromptSubmitContext}
1903
+ * - `post-compact` — {@link PostCompactContext}
1865
1904
  * - `pre-model-call` — {@link PreModelCallContext}
1866
1905
  * - `post-tool-use` — {@link PostToolUseContext}
1867
1906
  * - `stop` — {@link StopContext}
@@ -2756,6 +2795,14 @@ declare interface PongMessage {
2756
2795
  type: "pong";
2757
2796
  }
2758
2797
 
2798
+ /**
2799
+ * The full `post-compact` context a hook receives — the dispatching call
2800
+ * site's {@link PostCompactInputContext} plus the pipeline-stamped
2801
+ * {@link BaseHookContext} capabilities.
2802
+ */
2803
+ export declare interface PostCompactContext extends PostCompactInputContext, BaseHookContext {
2804
+ }
2805
+
2759
2806
  /**
2760
2807
  * Context passed to the `post-compact` hook. Fires after the agent loop
2761
2808
  * compacts a conversation mid-turn — once the running history has been
@@ -2770,12 +2817,12 @@ declare interface PongMessage {
2770
2817
  * their own injected context the same way.
2771
2818
  *
2772
2819
  * The hook re-injects by mutating `history` in place (or returning a new
2773
- * context with a replacement `history`) — see {@link HookFunction}'s
2820
+ * context with a replacement `history`) — see `HookFunction`'s
2774
2821
  * polymorphic return shape. The agent loop reads the settled `history` back off
2775
2822
  * the context and resumes the turn from it. Multiple plugins' hooks chain in
2776
2823
  * registration order, each seeing the previous plugin's edits.
2777
2824
  */
2778
- export declare interface PostCompactContext {
2825
+ declare interface PostCompactInputContext {
2779
2826
  /**
2780
2827
  * The compacted message history to re-inject onto. Hooks mutate this in
2781
2828
  * place (or return a new context with a replacement) to re-apply context
@@ -2814,6 +2861,28 @@ export declare interface PostCompactContext {
2814
2861
  readonly injectionMode?: "full" | "minimal";
2815
2862
  }
2816
2863
 
2864
+ /**
2865
+ * The full `post-model-call` context a hook receives — the dispatching call
2866
+ * site's {@link PostModelCallInputContext} plus the pipeline-stamped
2867
+ * {@link BaseHookContext} capabilities.
2868
+ */
2869
+ export declare interface PostModelCallContext extends PostModelCallInputContext, BaseHookContext {
2870
+ }
2871
+
2872
+ /**
2873
+ * Binary outcome of the `post-model-call` hook. The agent loop seeds it to
2874
+ * `"stop"` and acts on the value the chain settles on:
2875
+ *
2876
+ * - `"stop"` — accept the model-call outcome. On a finalized reply the loop
2877
+ * keeps the (possibly transformed) message; on a rejection it
2878
+ * surfaces the error. This is the default.
2879
+ * - `"continue"` — re-query the model. The hook is responsible for leaving
2880
+ * {@link PostModelCallContext.messages} as the history the next
2881
+ * iteration should send (append a follow-up turn, or replace
2882
+ * the array with a repaired one).
2883
+ */
2884
+ export declare type PostModelCallDecision = "continue" | "stop";
2885
+
2817
2886
  /**
2818
2887
  * Context passed to the `post-model-call` hook. Fires at every model-call
2819
2888
  * outcome — the seam where the loop reacts to what the provider returned:
@@ -2845,7 +2914,7 @@ export declare interface PostCompactContext {
2845
2914
  * the outcome is treated as `"stop"`). Multiple plugins' hooks chain in
2846
2915
  * registration order — each sees the previous hook's `decision` and mutations.
2847
2916
  */
2848
- export declare interface PostModelCallContext {
2917
+ declare interface PostModelCallInputContext {
2849
2918
  /** Conversation ID the message belongs to. */
2850
2919
  readonly conversationId: string;
2851
2920
  /** The call site this message serves — `"mainAgent"` for the user-facing reply; `null` when untagged. */
@@ -2888,23 +2957,15 @@ export declare interface PostModelCallContext {
2888
2957
  * actionable outcomes (see the interface docstring).
2889
2958
  */
2890
2959
  decision: PostModelCallDecision;
2891
- /** Logger scoped to the current turn (tag structured fields with `{ plugin }`). */
2892
- readonly logger: PluginLogger;
2893
2960
  }
2894
2961
 
2895
2962
  /**
2896
- * Binary outcome of the `post-model-call` hook. The agent loop seeds it to
2897
- * `"stop"` and acts on the value the chain settles on:
2898
- *
2899
- * - `"stop"` — accept the model-call outcome. On a finalized reply the loop
2900
- * keeps the (possibly transformed) message; on a rejection it
2901
- * surfaces the error. This is the default.
2902
- * - `"continue"` — re-query the model. The hook is responsible for leaving
2903
- * {@link PostModelCallContext.messages} as the history the next
2904
- * iteration should send (append a follow-up turn, or replace
2905
- * the array with a repaired one).
2963
+ * The full `post-tool-use` context a hook receives the dispatching call
2964
+ * site's {@link PostToolUseInputContext} plus the pipeline-stamped
2965
+ * {@link BaseHookContext} capabilities.
2906
2966
  */
2907
- export declare type PostModelCallDecision = "continue" | "stop";
2967
+ export declare interface PostToolUseContext extends PostToolUseInputContext, BaseHookContext {
2968
+ }
2908
2969
 
2909
2970
  /**
2910
2971
  * Context passed to the `post-tool-use` hook. Fires once per tool result —
@@ -2914,7 +2975,7 @@ export declare type PostModelCallDecision = "continue" | "stop";
2914
2975
  *
2915
2976
  * The hook may transform the result either by mutating `toolResponse` in
2916
2977
  * place (e.g. reassigning `toolResponse.content`) or by returning a new
2917
- * context with a fresh `toolResponse` — see {@link HookFunction}'s
2978
+ * context with a fresh `toolResponse` — see `HookFunction`'s
2918
2979
  * polymorphic return shape. The daemon threads the final `toolResponse`
2919
2980
  * into the provider-bound history.
2920
2981
  *
@@ -2926,7 +2987,7 @@ export declare type PostModelCallDecision = "continue" | "stop";
2926
2987
  * can swap in a smarter strategy (e.g. a summarizer) or observe results for
2927
2988
  * side effects.
2928
2989
  */
2929
- export declare interface PostToolUseContext {
2990
+ declare interface PostToolUseInputContext {
2930
2991
  /** Conversation ID the tool ran on. */
2931
2992
  readonly conversationId: string;
2932
2993
  /**
@@ -2986,12 +3047,14 @@ export declare interface PostToolUseContext {
2986
3047
  * receiving a precomputed limit.
2987
3048
  */
2988
3049
  readonly maxInputTokens: number;
2989
- /**
2990
- * Logger scoped to the current turn. The same instance is shared by
2991
- * every hook in the chain, so plugins should tag their structured log
2992
- * fields (e.g. `{ plugin: "<name>" }`) for attribution.
2993
- */
2994
- readonly logger: PluginLogger;
3050
+ }
3051
+
3052
+ /**
3053
+ * The full `pre-model-call` context a hook receives — the dispatching call
3054
+ * site's {@link PreModelCallInputContext} plus the pipeline-stamped
3055
+ * {@link BaseHookContext} capabilities.
3056
+ */
3057
+ export declare interface PreModelCallContext extends PreModelCallInputContext, BaseHookContext {
2995
3058
  }
2996
3059
 
2997
3060
  /**
@@ -3007,7 +3070,7 @@ export declare interface PostToolUseContext {
3007
3070
  * Mutate the context in place or return a new one; throwing is contained by the
3008
3071
  * loop (the call proceeds with the original request).
3009
3072
  */
3010
- export declare interface PreModelCallContext {
3073
+ declare interface PreModelCallInputContext {
3011
3074
  /** Conversation ID the call belongs to. */
3012
3075
  readonly conversationId: string;
3013
3076
  /**
@@ -3046,8 +3109,6 @@ export declare interface PreModelCallContext {
3046
3109
  * redaction that needs the full message — instead of leaking the raw stream.
3047
3110
  */
3048
3111
  deferAssistantOutput: boolean;
3049
- /** Logger scoped to the current turn (tag structured fields with `{ plugin }`). */
3050
- readonly logger: PluginLogger;
3051
3112
  }
3052
3113
 
3053
3114
  declare interface ProcessEntry extends BaseSubscriberEntry {
@@ -3697,6 +3758,14 @@ declare interface SoundsConfigUpdated {
3697
3758
  type: "sounds_config_updated";
3698
3759
  }
3699
3760
 
3761
+ /**
3762
+ * The full `stop` context a hook receives — the dispatching call site's
3763
+ * {@link StopInputContext} plus the pipeline-stamped {@link BaseHookContext}
3764
+ * capabilities.
3765
+ */
3766
+ export declare interface StopContext extends StopInputContext, BaseHookContext {
3767
+ }
3768
+
3700
3769
  /**
3701
3770
  * Context passed to the `stop` hook — the loop's definitive terminal hook.
3702
3771
  *
@@ -3717,7 +3786,7 @@ declare interface SoundsConfigUpdated {
3717
3786
  *
3718
3787
  * Multiple plugins' hooks chain in registration order over the same context.
3719
3788
  */
3720
- export declare interface StopContext {
3789
+ declare interface StopInputContext {
3721
3790
  /** Conversation ID the run belongs to. */
3722
3791
  readonly conversationId: string;
3723
3792
  /**
@@ -3740,12 +3809,6 @@ export declare interface StopContext {
3740
3809
  * control transfer that re-enters the loop and so never reaches this hook.
3741
3810
  */
3742
3811
  readonly exitReason: AgentLoopExitReason;
3743
- /**
3744
- * Logger scoped to the current turn. The same instance is shared by
3745
- * every hook in the chain, so plugins should tag their structured log
3746
- * fields (e.g. `{ plugin: "<name>" }`) for attribution.
3747
- */
3748
- readonly logger: PluginLogger;
3749
3812
  }
3750
3813
 
3751
3814
  declare interface SubagentDetailResponse {
@@ -4852,6 +4915,14 @@ declare const UserMessageEchoEventSchema: z.ZodObject<{
4852
4915
  clientMessageId: z.ZodOptional<z.ZodString>;
4853
4916
  }, z.core.$strict>;
4854
4917
 
4918
+ /**
4919
+ * The full `user-prompt-submit` context a hook receives — the dispatching
4920
+ * call site's {@link UserPromptSubmitInputContext} plus the pipeline-stamped
4921
+ * {@link BaseHookContext} capabilities.
4922
+ */
4923
+ export declare interface UserPromptSubmitContext extends UserPromptSubmitInputContext, BaseHookContext {
4924
+ }
4925
+
4855
4926
  /**
4856
4927
  * Context passed to the `user-prompt-submit` hook. Fires once per user
4857
4928
  * turn, after the agent loop has prepared the message list (PKB / NOW /
@@ -4861,7 +4932,7 @@ declare const UserMessageEchoEventSchema: z.ZodObject<{
4861
4932
  *
4862
4933
  * The hook may transform `latestMessages` either by mutating it in place
4863
4934
  * (`push` / `splice` / `length = 0`) or by returning a new context with
4864
- * a fresh `latestMessages` array — see {@link HookFunction}'s polymorphic
4935
+ * a fresh `latestMessages` array — see `HookFunction`'s polymorphic
4865
4936
  * return shape. The daemon threads the final `latestMessages` value into
4866
4937
  * `agentLoop.run()` as the run-messages argument.
4867
4938
  *
@@ -4874,7 +4945,7 @@ declare const UserMessageEchoEventSchema: z.ZodObject<{
4874
4945
  * hook sees the previous plugin's mutations (whether by reassignment or
4875
4946
  * in-place mutation).
4876
4947
  */
4877
- export declare interface UserPromptSubmitContext {
4948
+ declare interface UserPromptSubmitInputContext {
4878
4949
  /** Conversation ID the user prompt was submitted on. */
4879
4950
  readonly conversationId: string;
4880
4951
  /**
@@ -4948,25 +5019,6 @@ export declare interface UserPromptSubmitContext {
4948
5019
  * may mutate this in place or replace it by returning a new context.
4949
5020
  */
4950
5021
  latestMessages: Message[];
4951
- /**
4952
- * Logger scoped to the current turn. The same instance is shared by
4953
- * every hook in the chain, so plugins should tag their structured log
4954
- * fields (e.g. `{ plugin: "<name>" }`) for attribution.
4955
- */
4956
- readonly logger: PluginLogger;
4957
- /**
4958
- * Emit a transient `hook_event` to any UI watching this conversation —
4959
- * e.g. progress while the hook does work the user can feel (memory
4960
- * selection). The daemon stamps the conversation, this hook's name, and
4961
- * the owning plugin; the hook supplies only `detail`, an arbitrary
4962
- * JSON-serializable record whose shape it and its client renderer agree on.
4963
- *
4964
- * Best-effort and fire-and-forget: it never blocks or fails the turn, is
4965
- * not persisted (a client joining mid-turn will not replay it), and cannot
4966
- * emit any other event type or target another conversation — the emit
4967
- * surface is bound to this turn.
4968
- */
4969
- readonly broadcast: (detail: Record<string, unknown>) => void;
4970
5022
  }
4971
5023
 
4972
5024
  declare interface VellumSlimSkill extends SlimSkillBase {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vellumai/plugin-api",
3
- "version": "0.10.5-dev.202607031734.f263495",
3
+ "version": "0.10.5-dev.202607031834.d3e3143",
4
4
  "description": "Public TypeScript authoring contract for Vellum assistant plugins.",
5
5
  "license": "MIT",
6
6
  "type": "module",