@vellumai/plugin-api 0.10.2-dev.202606250916.8422b74 → 0.10.2-dev.202606251257.2eba8a4

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 +181 -90
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -1789,6 +1789,32 @@ declare const HomeFeedUpdatedEventSchema: z.ZodObject<{
1789
1789
 
1790
1790
  declare type _HomeServerMessages = RelationshipStateUpdatedEvent | HomeFeedUpdatedEvent;
1791
1791
 
1792
+ /**
1793
+ * A plugin lifecycle hook. Receives a per-lifecycle context shape and may
1794
+ * either mutate `ctx` in place (returning `void`) or return a *partial*
1795
+ * context whose fields are merged onto the threaded context — only the keys
1796
+ * it returns are overwritten, every other field is preserved. Returning a
1797
+ * partial lets a hook edit just the subset of fields it cares about without
1798
+ * having to re-specify the rest. The merged context is threaded to the next
1799
+ * hook in the chain (e.g. `user-prompt-submit`).
1800
+ *
1801
+ * Because an omitted key means "keep the existing value", every field on a
1802
+ * context shape is required (no `?`-optional or `| undefined` members): a
1803
+ * present key always carries a concrete value, so "absent from the returned
1804
+ * partial" is never ambiguous with "explicitly cleared". Fields that can be
1805
+ * empty model that with `| null`, not `| undefined`.
1806
+ *
1807
+ * Each known hook key has a documented context shape:
1808
+ * - `init` — {@link InitContext}
1809
+ * - `shutdown` — {@link ShutdownContext}
1810
+ * - `user-prompt-submit` — {@link UserPromptSubmitContext}
1811
+ * - `pre-model-call` — {@link PreModelCallContext}
1812
+ * - `post-tool-use` — {@link PostToolUseContext}
1813
+ * - `stop` — {@link StopContext}
1814
+ * - `post-model-call` — {@link PostModelCallContext}
1815
+ */
1816
+ export declare type HookFunction<TCtx = unknown> = (ctx: TCtx) => Promise<Partial<TCtx> | void>;
1817
+
1792
1818
  /** Union of every hook name declared in {@link HOOKS}. */
1793
1819
  export declare type HookName = (typeof HOOKS)[keyof typeof HOOKS];
1794
1820
 
@@ -2139,6 +2165,27 @@ declare interface IngressConfigResponse {
2139
2165
  error?: string;
2140
2166
  }
2141
2167
 
2168
+ /**
2169
+ * Context passed to `Plugin.init()` during bootstrap. Carries the resolved
2170
+ * config, a pino-compatible logger scoped to the plugin, a per-plugin
2171
+ * writable data directory, and the assistant's version metadata.
2172
+ */
2173
+ export declare interface InitContext {
2174
+ /** Parsed config for this plugin (may be `unknown` until the manifest validates). */
2175
+ config: unknown;
2176
+ /** Pino-compatible child logger bound to `{ plugin: <name> }`. */
2177
+ logger: PluginLogger;
2178
+ /** Absolute path to `<workspaceDir>/plugins-data/<plugin>/` (created by bootstrap). */
2179
+ pluginStorageDir: string;
2180
+ /**
2181
+ * Assistant semver. Plugins can compare against this for defensive
2182
+ * runtime checks — but the canonical compat contract is the host
2183
+ * version against the plugin's `peerDependencies["@vellumai/plugin-api"]`
2184
+ * semver range, enforced at load time by the external-plugin loader.
2185
+ */
2186
+ assistantVersion: string;
2187
+ }
2188
+
2142
2189
  declare interface IntegrationConnectResult {
2143
2190
  type: "integration_connect_result";
2144
2191
  integrationId: string;
@@ -2724,53 +2771,6 @@ declare interface PlatformDisconnected {
2724
2771
  type: "platform_disconnected";
2725
2772
  }
2726
2773
 
2727
- /**
2728
- * A plugin lifecycle hook. Receives a per-lifecycle context shape and may
2729
- * either mutate `ctx` in place (returning `void`) or return a *partial*
2730
- * context whose fields are merged onto the threaded context — only the keys
2731
- * it returns are overwritten, every other field is preserved. Returning a
2732
- * partial lets a hook edit just the subset of fields it cares about without
2733
- * having to re-specify the rest. The merged context is threaded to the next
2734
- * hook in the chain (e.g. `user-prompt-submit`).
2735
- *
2736
- * Because an omitted key means "keep the existing value", every field on a
2737
- * context shape is required (no `?`-optional or `| undefined` members): a
2738
- * present key always carries a concrete value, so "absent from the returned
2739
- * partial" is never ambiguous with "explicitly cleared". Fields that can be
2740
- * empty model that with `| null`, not `| undefined`.
2741
- *
2742
- * Each known hook key has a documented context shape:
2743
- * - `init` — {@link PluginInitContext}
2744
- * - `shutdown` — {@link PluginShutdownContext}
2745
- * - `user-prompt-submit` — {@link UserPromptSubmitContext}
2746
- * - `pre-model-call` — {@link PreModelCallContext}
2747
- * - `post-tool-use` — {@link PostToolUseContext}
2748
- * - `stop` — {@link StopContext}
2749
- * - `post-model-call` — {@link PostModelCallContext}
2750
- */
2751
- export declare type PluginHookFn<TCtx = unknown> = (ctx: TCtx) => Promise<Partial<TCtx> | void>;
2752
-
2753
- /**
2754
- * Context passed to `Plugin.init()` during bootstrap. Carries the resolved
2755
- * config, a pino-compatible logger scoped to the plugin, a per-plugin
2756
- * writable data directory, and the assistant's version metadata.
2757
- */
2758
- export declare interface PluginInitContext {
2759
- /** Parsed config for this plugin (may be `unknown` until the manifest validates). */
2760
- config: unknown;
2761
- /** Pino-compatible child logger bound to `{ plugin: <name> }`. */
2762
- logger: PluginLogger;
2763
- /** Absolute path to `<workspaceDir>/plugins-data/<plugin>/` (created by bootstrap). */
2764
- pluginStorageDir: string;
2765
- /**
2766
- * Assistant semver. Plugins can compare against this for defensive
2767
- * runtime checks — but the canonical compat contract is the host
2768
- * version against the plugin's `peerDependencies["@vellumai/plugin-api"]`
2769
- * semver range, enforced at load time by the external-plugin loader.
2770
- */
2771
- assistantVersion: string;
2772
- }
2773
-
2774
2774
  /**
2775
2775
  * Minimal pino-compatible logger surface handed to plugin hooks. The host
2776
2776
  * supplies a pino child logger bound to `{ plugin: <name> }`; this
@@ -2790,23 +2790,6 @@ export declare interface PluginLogger {
2790
2790
  debug(obj: Record<string, unknown>, msg?: string): void;
2791
2791
  }
2792
2792
 
2793
- /**
2794
- * Context passed to the `shutdown` hook during daemon teardown. Kept
2795
- * intentionally narrower than {@link PluginInitContext} — most teardown
2796
- * paths only need to know which assistant version they're shutting
2797
- * down against (e.g. for version-conditional cleanup of state files
2798
- * written by a previous boot).
2799
- *
2800
- * Additional fields may be added as concrete plugin needs surface; the
2801
- * `assistantVersion` field mirrors the init context's so plugins that
2802
- * stash a version stamp at init can compare against the same name on
2803
- * tear-down without keeping their own copy.
2804
- */
2805
- export declare interface PluginShutdownContext {
2806
- /** Assistant semver for compatibility checks inside the plugin. */
2807
- assistantVersion: string;
2808
- }
2809
-
2810
2793
  declare interface PongMessage {
2811
2794
  type: "pong";
2812
2795
  }
@@ -2825,7 +2808,7 @@ declare interface PongMessage {
2825
2808
  * their own injected context the same way.
2826
2809
  *
2827
2810
  * The hook re-injects by mutating `history` in place (or returning a new
2828
- * context with a replacement `history`) — see {@link PluginHookFn}'s
2811
+ * context with a replacement `history`) — see {@link HookFunction}'s
2829
2812
  * polymorphic return shape. The agent loop reads the settled `history` back off
2830
2813
  * the context and resumes the turn from it. Multiple plugins' hooks chain in
2831
2814
  * registration order, each seeing the previous plugin's edits.
@@ -2972,7 +2955,7 @@ export declare type PostModelCallDecision = "continue" | "stop";
2972
2955
  *
2973
2956
  * The hook may transform the result either by mutating `toolResponse` in
2974
2957
  * place (e.g. reassigning `toolResponse.content`) or by returning a new
2975
- * context with a fresh `toolResponse` — see {@link PluginHookFn}'s
2958
+ * context with a fresh `toolResponse` — see {@link HookFunction}'s
2976
2959
  * polymorphic return shape. The daemon threads the final `toolResponse`
2977
2960
  * into the provider-bound history.
2978
2961
  *
@@ -3568,6 +3551,23 @@ declare interface ShowPlatformLogin {
3568
3551
  type: "show_platform_login";
3569
3552
  }
3570
3553
 
3554
+ /**
3555
+ * Context passed to the `shutdown` hook during daemon teardown. Kept
3556
+ * intentionally narrower than {@link InitContext} — most teardown
3557
+ * paths only need to know which assistant version they're shutting
3558
+ * down against (e.g. for version-conditional cleanup of state files
3559
+ * written by a previous boot).
3560
+ *
3561
+ * Additional fields may be added as concrete plugin needs surface; the
3562
+ * `assistantVersion` field mirrors the init context's so plugins that
3563
+ * stash a version stamp at init can compare against the same name on
3564
+ * tear-down without keeping their own copy.
3565
+ */
3566
+ export declare interface ShutdownContext {
3567
+ /** Assistant semver for compatibility checks inside the plugin. */
3568
+ assistantVersion: string;
3569
+ }
3570
+
3571
3571
  declare interface SignBundlePayloadRequest {
3572
3572
  type: "sign_bundle_payload";
3573
3573
  requestId: string;
@@ -3895,6 +3895,26 @@ declare interface ToolActivityMetadata {
3895
3895
  webFetch?: WebFetchMetadata;
3896
3896
  }
3897
3897
 
3898
+ /**
3899
+ * Runtime context passed as the second argument to every tool's `execute`.
3900
+ *
3901
+ * The fields fall into two groups:
3902
+ *
3903
+ * - A small, stable core that we are comfortable exposing to any tool —
3904
+ * including workspace- and plugin-authored tools via `@vellumai/plugin-api`:
3905
+ * `conversationId`, `workingDir`, `requestId`, `signal`, `onOutput`,
3906
+ * `assistantId`, `isInteractive`.
3907
+ * - Everything tagged `@legacy` below: host-internal routing, permission,
3908
+ * trust, requester-identity, proxy, and telemetry metadata that historically
3909
+ * accreted on this single context. These are NOT a surface we want third-party
3910
+ * tools to depend on; we are triaging them post-launch with the goal of
3911
+ * moving them off the public context (or removing them) over time. Grep for
3912
+ * `@legacy` to enumerate the set. Do not add new fields here — extend the
3913
+ * stable core only when a field is genuinely safe and stable to expose.
3914
+ *
3915
+ * The daemon constructs and passes the full object to every tool at runtime; a
3916
+ * tool that only reads the stable core is unaffected by the eventual cleanup.
3917
+ */
3898
3918
  export declare interface ToolContext {
3899
3919
  /** Identifier of the conversation this tool invocation belongs to. */
3900
3920
  conversationId: string;
@@ -3908,23 +3928,44 @@ export declare interface ToolContext {
3908
3928
  onOutput?: (chunk: string) => void;
3909
3929
  /** Logical assistant scope for multi-assistant routing. */
3910
3930
  assistantId?: string;
3911
- /** When set, the tool execution is part of a task run. Used to retrieve ephemeral permission rules. */
3931
+ /** True when an interactive client is connected (not just a no-op callback). */
3932
+ isInteractive?: boolean;
3933
+ /**
3934
+ * When set, the tool execution is part of a task run. Used to retrieve ephemeral permission rules.
3935
+ * @legacy
3936
+ */
3912
3937
  taskRunId?: string;
3913
3938
  /**
3914
3939
  * Model attribution snapshot for the conversation at invocation time
3915
3940
  * (provider/model/profile that issued this tool call). Used by tool
3916
3941
  * telemetry; never sent to the tool itself.
3942
+ * @legacy
3917
3943
  */
3918
3944
  attribution?: UsageAttributionSnapshot | null;
3919
- /** Optional callback for tool lifecycle events (start/prompt/deny/execute/error). */
3945
+ /**
3946
+ * Optional callback for tool lifecycle events (start/prompt/deny/execute/error).
3947
+ * @legacy
3948
+ */
3920
3949
  onToolLifecycleEvent?: ToolLifecycleEventHandler;
3921
- /** Optional resolver for proxy tools - delegates execution to an external client. */
3950
+ /**
3951
+ * Optional resolver for proxy tools - delegates execution to an external client.
3952
+ * @legacy
3953
+ */
3922
3954
  proxyToolResolver?: ProxyToolResolver;
3923
- /** When set, only tools in this set may execute. Tools outside the set are blocked with an error. */
3955
+ /**
3956
+ * When set, only tools in this set may execute. Tools outside the set are blocked with an error.
3957
+ * @legacy
3958
+ */
3924
3959
  allowedToolNames?: Set<string>;
3925
- /** True when this turn is restricted to storage cleanup-safe tools. */
3960
+ /**
3961
+ * True when this turn is restricted to storage cleanup-safe tools.
3962
+ * @legacy
3963
+ */
3926
3964
  diskPressureCleanupModeActive?: boolean;
3927
- /** Prompt the user for a secret value via native SecureField UI. */
3965
+ /**
3966
+ * Prompt the user for a secret value via native SecureField UI.
3967
+ * @legacy
3968
+ */
3928
3969
  requestSecret?: (params: {
3929
3970
  service: string;
3930
3971
  field: string;
@@ -3935,14 +3976,18 @@ export declare interface ToolContext {
3935
3976
  allowedTools?: string[];
3936
3977
  allowedDomains?: string[];
3937
3978
  }) => Promise<SecretPromptResult>;
3938
- /** Optional callback to send a message to the connected client (e.g. open_url). */
3979
+ /**
3980
+ * Optional callback to send a message to the connected client (e.g. open_url).
3981
+ * @legacy
3982
+ */
3939
3983
  sendToClient?: (msg: {
3940
3984
  type: string;
3941
3985
  [key: string]: unknown;
3942
3986
  }) => void;
3943
- /** True when an interactive client is connected (not just a no-op callback). */
3944
- isInteractive?: boolean;
3945
- /** When true, tools with side effects should always prompt for confirmation. */
3987
+ /**
3988
+ * When true, tools with side effects should always prompt for confirmation.
3989
+ * @legacy
3990
+ */
3946
3991
  forcePromptSideEffects?: boolean;
3947
3992
  /**
3948
3993
  * When true, the tool requires a fresh interactive approval for every
@@ -3953,26 +3998,46 @@ export declare interface ToolContext {
3953
3998
  * temporary override options in the prompt UI. Used by
3954
3999
  * `manage_secure_command_tool` to ensure a human reviews each secure
3955
4000
  * bundle installation.
4001
+ * @legacy
3956
4002
  */
3957
4003
  requireFreshApproval?: boolean;
3958
- /** Approval callback for proxy policy decisions that require user confirmation. */
4004
+ /**
4005
+ * Approval callback for proxy policy decisions that require user confirmation.
4006
+ * @legacy
4007
+ */
3959
4008
  proxyApprovalCallback?: ProxyApprovalCallback;
3960
- /** Optional principal identifier propagated to sub-tool confirmation flows. */
4009
+ /**
4010
+ * Optional principal identifier propagated to sub-tool confirmation flows.
4011
+ * @legacy
4012
+ */
3961
4013
  principal?: string;
3962
4014
  /**
3963
4015
  * Trust classification of the actor who initiated this tool invocation.
3964
4016
  * Determines permission level: guardians self-approve, trusted contacts
3965
4017
  * may escalate to guardian for approval, unknown actors are fail-closed.
3966
4018
  * See {@link TrustClass} in actor-trust-resolver.ts for value semantics.
4019
+ * @legacy
3967
4020
  */
3968
4021
  trustClass: TrustClass;
3969
- /** Channel through which the tool invocation originates (e.g. 'telegram', 'phone'). Used for scoped grant consumption. */
4022
+ /**
4023
+ * Channel through which the tool invocation originates (e.g. 'telegram', 'phone'). Used for scoped grant consumption.
4024
+ * @legacy
4025
+ */
3970
4026
  executionChannel?: string;
3971
- /** Voice/call session ID, if the invocation originates from a call. Used for scoped grant consumption. */
4027
+ /**
4028
+ * Voice/call session ID, if the invocation originates from a call. Used for scoped grant consumption.
4029
+ * @legacy
4030
+ */
3972
4031
  callSessionId?: string;
3973
- /** True when the tool invocation was triggered by a user clicking a surface action button (not a regular message). */
4032
+ /**
4033
+ * True when the tool invocation was triggered by a user clicking a surface action button (not a regular message).
4034
+ * @legacy
4035
+ */
3974
4036
  triggeredBySurfaceAction?: boolean;
3975
- /** True when the user explicitly approved this tool invocation via the interactive permission prompt (not auto-approved by trust rules or temporary overrides). */
4037
+ /**
4038
+ * True when the user explicitly approved this tool invocation via the interactive permission prompt (not auto-approved by trust rules or temporary overrides).
4039
+ * @legacy
4040
+ */
3976
4041
  approvedViaPrompt?: boolean;
3977
4042
  /**
3978
4043
  * True when the invocation is inside a scheduled task run whose
@@ -3980,21 +4045,43 @@ export declare interface ToolContext {
3980
4045
  * Tools that normally require a surface-action click (e.g. bulk archive,
3981
4046
  * unsubscribe) may treat this as equivalent consent, since the user
3982
4047
  * already reviewed the tool list when the task was saved.
4048
+ * @legacy
3983
4049
  */
3984
4050
  batchAuthorizedByTask?: boolean;
3985
- /** External user ID of the requester (non-guardian actor). Used for scoped grant consumption. */
4051
+ /**
4052
+ * External user ID of the requester (non-guardian actor). Used for scoped grant consumption.
4053
+ * @legacy
4054
+ */
3986
4055
  requesterExternalUserId?: string;
3987
- /** Chat ID of the requester (non-guardian actor). Used for tool grant request escalation notifications. */
4056
+ /**
4057
+ * Chat ID of the requester (non-guardian actor). Used for tool grant request escalation notifications.
4058
+ * @legacy
4059
+ */
3988
4060
  requesterChatId?: string;
3989
- /** Human-readable identifier for the requester (e.g., @username). */
4061
+ /**
4062
+ * Human-readable identifier for the requester (e.g., @username).
4063
+ * @legacy
4064
+ */
3990
4065
  requesterIdentifier?: string;
3991
- /** Preferred display name for the requester. */
4066
+ /**
4067
+ * Preferred display name for the requester.
4068
+ * @legacy
4069
+ */
3992
4070
  requesterDisplayName?: string;
3993
- /** Slack channel ID for channel-scoped permission enforcement. When set, tools are checked against the channel's permission profile. */
4071
+ /**
4072
+ * Slack channel ID for channel-scoped permission enforcement. When set, tools are checked against the channel's permission profile.
4073
+ * @legacy
4074
+ */
3994
4075
  channelPermissionChannelId?: string;
3995
- /** The tool_use block ID from the LLM response, used to correlate confirmation prompts with specific tool invocations. */
4076
+ /**
4077
+ * The tool_use block ID from the LLM response, used to correlate confirmation prompts with specific tool invocations.
4078
+ * @legacy
4079
+ */
3996
4080
  toolUseId?: string;
3997
- /** True when the assistant is running as a platform-managed remote instance. Used to auto-approve sandboxed bash tools. */
4081
+ /**
4082
+ * True when the assistant is running as a platform-managed remote instance. Used to auto-approve sandboxed bash tools.
4083
+ * @legacy
4084
+ */
3998
4085
  isPlatformHosted?: boolean;
3999
4086
  /**
4000
4087
  * The interface ID of the connected client driving the current turn (e.g.
@@ -4002,6 +4089,7 @@ export declare interface ToolContext {
4002
4089
  * transport preference — for example, macOS-originated turns prefer the
4003
4090
  * user's real Chrome session via the paired extension before falling back
4004
4091
  * to cdp-inspect or local Playwright.
4092
+ * @legacy
4005
4093
  */
4006
4094
  transportInterface?: InterfaceId;
4007
4095
  /**
@@ -4012,6 +4100,7 @@ export declare interface ToolContext {
4012
4100
  * has `inferenceProfile` set — the override only flows through the
4013
4101
  * in-memory `SubagentConfig.overrideProfile` chain. See
4014
4102
  * `executeSubagentSpawn` in tools/subagent/spawn.ts.
4103
+ * @legacy
4015
4104
  */
4016
4105
  overrideProfile?: string;
4017
4106
  /**
@@ -4020,6 +4109,7 @@ export declare interface ToolContext {
4020
4109
  * default a spawned subagent's inference profile to the profile the invoking
4021
4110
  * turn resolved to, so subagents match whatever agent invoked them rather
4022
4111
  * than always falling back to the static `subagentSpawn` call-site default.
4112
+ * @legacy
4023
4113
  */
4024
4114
  invokingCallSite?: LLMCallSite;
4025
4115
  /**
@@ -4028,6 +4118,7 @@ export declare interface ToolContext {
4028
4118
  * Used by host proxies to bind cross-client targeted execution to the same
4029
4119
  * authenticated user identity. May be undefined for legacy/internal flows
4030
4120
  * with no resolved actor identity.
4121
+ * @legacy
4031
4122
  */
4032
4123
  sourceActorPrincipalId?: string;
4033
4124
  }
@@ -4744,7 +4835,7 @@ declare const UserMessageEchoEventSchema: z.ZodObject<{
4744
4835
  *
4745
4836
  * The hook may transform `latestMessages` either by mutating it in place
4746
4837
  * (`push` / `splice` / `length = 0`) or by returning a new context with
4747
- * a fresh `latestMessages` array — see {@link PluginHookFn}'s polymorphic
4838
+ * a fresh `latestMessages` array — see {@link HookFunction}'s polymorphic
4748
4839
  * return shape. The daemon threads the final `latestMessages` value into
4749
4840
  * `agentLoop.run()` as the run-messages argument.
4750
4841
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vellumai/plugin-api",
3
- "version": "0.10.2-dev.202606250916.8422b74",
3
+ "version": "0.10.2-dev.202606251257.2eba8a4",
4
4
  "description": "Public TypeScript authoring contract for Vellum assistant plugins.",
5
5
  "license": "MIT",
6
6
  "type": "module",