@vellumai/plugin-api 0.10.4-staging.1 → 0.10.4

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 (3) hide show
  1. package/index.d.ts +109 -17
  2. package/index.js +1 -0
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
 
3
- declare type _AcpServerMessages = AcpSessionSpawned | AcpSessionUpdate | AcpSessionCompleted | AcpSessionError;
3
+ declare type _AcpServerMessages = AcpSessionSpawned | AcpSessionUpdate | AcpSessionCompleted | AcpSessionError | AcpSessionUsage;
4
4
 
5
5
  declare interface AcpSessionCompleted {
6
6
  type: "acp_session_completed";
@@ -19,6 +19,10 @@ declare interface AcpSessionSpawned {
19
19
  acpSessionId: string;
20
20
  agent: string;
21
21
  parentConversationId: string;
22
+ /** Tool-use id of the `acp_spawn` call that spawned this session. */
23
+ parentToolUseId?: string;
24
+ /** Objective text for the spawned session. */
25
+ task?: string;
22
26
  }
23
27
 
24
28
  declare interface AcpSessionUpdate {
@@ -30,6 +34,30 @@ declare interface AcpSessionUpdate {
30
34
  toolTitle?: string;
31
35
  toolKind?: string;
32
36
  toolStatus?: string;
37
+ /** Optional raw input parameters sent to the tool (ACP `rawInput`); shape is tool-specific. */
38
+ rawInput?: unknown;
39
+ /** Optional raw output returned by the tool (ACP `rawOutput`); shape is tool-specific. */
40
+ rawOutput?: unknown;
41
+ /** Files touched by this tool call (for the file-diff affordance). */
42
+ locations?: {
43
+ path: string;
44
+ line?: number;
45
+ }[];
46
+ /** Stable id for the message this chunk belongs to. */
47
+ messageId?: string;
48
+ /** Monotonic ordering hint within the session. */
49
+ seq?: number;
50
+ }
51
+
52
+ declare interface AcpSessionUsage {
53
+ type: "acp_session_usage";
54
+ acpSessionId: string;
55
+ usedTokens: number;
56
+ contextSize: number;
57
+ costAmount?: number;
58
+ costCurrency?: string;
59
+ inputTokens?: number;
60
+ outputTokens?: number;
33
61
  }
34
62
 
35
63
  /**
@@ -448,6 +476,15 @@ declare interface AssistantInboxEscalationResponse {
448
476
  };
449
477
  }
450
478
 
479
+ /**
480
+ * Managed skill authored by the assistant's retrospective. Identical shape to a
481
+ * custom skill — it stays managed/deletable — but carries a distinct origin so
482
+ * the UI badges it as "Assistant's Memory" instead of "Custom".
483
+ */
484
+ declare interface AssistantMemorySlimSkill extends SlimSkillBase {
485
+ origin: "assistant-memory";
486
+ }
487
+
451
488
  declare interface AssistantStatusMessage {
452
489
  type: "assistant_status";
453
490
  version?: string;
@@ -2171,13 +2208,23 @@ declare interface IngressConfigResponse {
2171
2208
  * Context passed to `Plugin.init()` during bootstrap. Carries the resolved
2172
2209
  * config, a pino-compatible logger scoped to the plugin, a per-plugin
2173
2210
  * writable data directory, and the assistant's version metadata.
2211
+ *
2212
+ * For user-installed plugins, config is read from `<pluginDir>/config.json`
2213
+ * and `pluginStorageDir` points at `<pluginDir>/data/`. For first-party
2214
+ * default plugins and standalone workspace hooks, config comes from the
2215
+ * global `config.plugins.<name>` block and `pluginStorageDir` points at
2216
+ * `<workspaceDir>/plugins-data/<name>/`.
2174
2217
  */
2175
2218
  export declare interface InitContext {
2176
2219
  /** Parsed config for this plugin (may be `unknown` until the manifest validates). */
2177
2220
  config: unknown;
2178
2221
  /** Pino-compatible child logger bound to `{ plugin: <name> }`. */
2179
2222
  logger: PluginLogger;
2180
- /** Absolute path to `<workspaceDir>/plugins-data/<plugin>/` (created by bootstrap). */
2223
+ /**
2224
+ * Absolute path to the per-plugin writable data directory. For user plugins
2225
+ * this is `<pluginDir>/data/`; for defaults and workspace hooks it falls back
2226
+ * to `<workspaceDir>/plugins-data/<plugin>/`. Created by bootstrap.
2227
+ */
2181
2228
  pluginStorageDir: string;
2182
2229
  /**
2183
2230
  * Assistant semver. Plugins can compare against this for defensive
@@ -2232,6 +2279,23 @@ declare const INTERFACE_IDS: readonly ["macos", "ios", "cli", "telegram", "phone
2232
2279
 
2233
2280
  declare type InterfaceId = (typeof INTERFACE_IDS)[number];
2234
2281
 
2282
+ /**
2283
+ * Provider stop-reason classification.
2284
+ *
2285
+ * Providers report an output-length cutoff under several normalized
2286
+ * finish-reason strings; {@link isMaxTokensStopReason} folds them into a single
2287
+ * "was this turn truncated at the token cap?" predicate.
2288
+ *
2289
+ * Kept dependency-free so it can be re-exported through `@vellumai/plugin-api`
2290
+ * without pulling the agent loop (its other caller) into the plugin API's
2291
+ * module graph.
2292
+ */
2293
+ /**
2294
+ * Whether a provider stop reason denotes output truncated at the token cap.
2295
+ * Case- and whitespace-insensitive; a `null`/`undefined`/empty reason is false.
2296
+ */
2297
+ export declare function isMaxTokensStopReason(stopReason: string | null | undefined): boolean;
2298
+
2235
2299
  declare interface ListItem {
2236
2300
  id: string;
2237
2301
  title: string;
@@ -2840,13 +2904,10 @@ export declare interface PostCompactContext {
2840
2904
  */
2841
2905
  readonly isNonInteractive: boolean;
2842
2906
  /**
2843
- * Active inference profile key to surface in the re-injected context, or
2844
- * `null` when the profile is unchanged since the one last announced to the
2845
- * model. Mirrors {@link UserPromptSubmitContext.modelProfileKey}: hooks that
2846
- * emit the `model_profile` grounding line resolve the human-readable label
2847
- * from this key rather than receiving the rendered string.
2907
+ * Effective inference profile identity for the model the compacted turn will
2908
+ * keep using. Mirrors {@link UserPromptSubmitContext.modelProfileKey}.
2848
2909
  */
2849
- readonly modelProfileKey: string | null;
2910
+ readonly modelProfileKey: string;
2850
2911
  /**
2851
2912
  * Volume of runtime injection to re-apply. `"full"` restores the complete
2852
2913
  * runtime context; `"minimal"` is the reduced volume overflow recovery's
@@ -3000,9 +3061,28 @@ export declare interface PostToolUseContext {
3000
3061
  * Model id reported by the provider for the assistant turn that issued
3001
3062
  * this tool call (e.g. `claude-opus-4-8`,
3002
3063
  * `accounts/fireworks/models/kimi-k2p6`). Hooks use it to vary coaching by
3003
- * model family — some models need earlier or firmer steering than others.
3064
+ * model family — each plugin owns its own model policy (e.g. which families
3065
+ * need firmer steering) and matches against this string directly.
3004
3066
  */
3005
3067
  readonly model: string;
3068
+ /**
3069
+ * The LLM call site driving this turn — `mainAgent` for a live user-facing
3070
+ * turn, `subagentSpawn` for a subagent, or a background site (e.g.
3071
+ * `heartbeatAgent`, `titleGenerate`). `null` when the run tagged none. A hook
3072
+ * that should only act on a live user-facing turn gates on
3073
+ * `callSite === "mainAgent"`; one that should skip subagents checks
3074
+ * `callSite === "subagentSpawn"`.
3075
+ */
3076
+ readonly callSite: LLMCallSite | null;
3077
+ /**
3078
+ * Whether the connected client can render dynamic UI surfaces this turn —
3079
+ * `true` unless the channel explicitly lacks the capability (SMS, phone,
3080
+ * email, and most chat bridges). A fact about what the model can *do* this
3081
+ * turn, not who is calling: a hook that prompts a surface tool (e.g. the
3082
+ * `ui_show` progress card) gates on this so it does not coach the model
3083
+ * toward a tool the channel filters out of the tool set.
3084
+ */
3085
+ readonly supportsDynamicUi: boolean;
3006
3086
  /**
3007
3087
  * The model's context-window size in tokens. Plugins derive their own
3008
3088
  * character budget from this (e.g. a share of the window) rather than
@@ -3693,7 +3773,7 @@ declare interface SlimSkillBase {
3693
3773
  owner?: OwnerInfo;
3694
3774
  }
3695
3775
 
3696
- declare type SlimSkillResponse = VellumSlimSkill | ClawhubSlimSkill | SkillsshSlimSkill | CustomSlimSkill;
3776
+ declare type SlimSkillResponse = VellumSlimSkill | ClawhubSlimSkill | SkillsshSlimSkill | CustomSlimSkill | AssistantMemorySlimSkill;
3697
3777
 
3698
3778
  /** Sent by the daemon when sounds config or sound files change on disk. */
3699
3779
  declare interface SoundsConfigUpdated {
@@ -4038,6 +4118,17 @@ export declare interface ToolContext {
4038
4118
  * @legacy
4039
4119
  */
4040
4120
  executionChannel?: string;
4121
+ /**
4122
+ * Origin tag of the turn driving this tool invocation (the conversation's
4123
+ * `TitleOrigin`, e.g. "memory_retrospective"). Set for background-job turns
4124
+ * that pass `requestOrigin` to `runBackgroundJob`, and for the
4125
+ * memory-retrospective wake (which pins it via {@link WakeToolContextPin}).
4126
+ * `buildPolicyContext` copies it onto the `PolicyContext` so the permission
4127
+ * checker can scope narrow non-interactive auto-grants (e.g. retrospective
4128
+ * skill authoring) to a specific internal origin. Unset for normal
4129
+ * interactive turns.
4130
+ */
4131
+ requestOrigin?: string;
4041
4132
  /**
4042
4133
  * Voice/call session ID, if the invocation originates from a call. Used for scoped grant consumption.
4043
4134
  * @legacy
@@ -4558,6 +4649,7 @@ declare const ToolUsePreviewStartEventSchema: z.ZodObject<{
4558
4649
  toolName: z.ZodString;
4559
4650
  conversationId: z.ZodOptional<z.ZodString>;
4560
4651
  messageId: z.ZodOptional<z.ZodString>;
4652
+ previewStartedAt: z.ZodOptional<z.ZodNumber>;
4561
4653
  }, z.core.$strip>;
4562
4654
 
4563
4655
  declare type ToolUseStartEvent = z.infer<typeof ToolUseStartEventSchema>;
@@ -4570,6 +4662,7 @@ declare const ToolUseStartEventSchema: z.ZodObject<{
4570
4662
  messageId: z.ZodOptional<z.ZodString>;
4571
4663
  conversationId: z.ZodOptional<z.ZodString>;
4572
4664
  startedAt: z.ZodOptional<z.ZodNumber>;
4665
+ previewStartedAt: z.ZodOptional<z.ZodNumber>;
4573
4666
  }, z.core.$strip>;
4574
4667
 
4575
4668
  declare type TraceEvent = z.infer<typeof TraceEventSchema>;
@@ -4880,14 +4973,13 @@ export declare interface UserPromptSubmitContext {
4880
4973
  */
4881
4974
  readonly requestId: string;
4882
4975
  /**
4883
- * Active inference profile key to surface in this turn's context, or `null`
4884
- * when the profile is unchanged since the one last announced to the model.
4885
- * Hooks that emit the `model_profile` grounding line resolve the
4886
- * human-readable label (and model id) from this key via the workspace LLM
4887
- * config rather than receiving the rendered string — the key is the minimal
4888
- * turn input the message arrays cannot carry.
4976
+ * Effective inference profile identity for the model this turn will use.
4977
+ * Named-profile configs receive a profile key; profileless configs receive
4978
+ * the resolved model id. Hooks that need model capabilities should resolve
4979
+ * them from this value rather than the workspace active profile, because a
4980
+ * conversation can be pinned to a different profile.
4889
4981
  */
4890
- readonly modelProfileKey: string | null;
4982
+ readonly modelProfileKey: string;
4891
4983
  /**
4892
4984
  * Whether the turn has no human present to answer clarification questions
4893
4985
  * (e.g. a scheduled, background, or headless run). Resolved once at turn
package/index.js CHANGED
@@ -6,3 +6,4 @@ export const assistantEventHub = api.assistantEventHub;
6
6
  export const doesSupportVision = api.doesSupportVision;
7
7
  export const getConfiguredProvider = api.getConfiguredProvider;
8
8
  export const getModelProfiles = api.getModelProfiles;
9
+ export const isMaxTokensStopReason = api.isMaxTokensStopReason;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vellumai/plugin-api",
3
- "version": "0.10.4-staging.1",
3
+ "version": "0.10.4",
4
4
  "description": "Public TypeScript authoring contract for Vellum assistant plugins.",
5
5
  "license": "MIT",
6
6
  "type": "module",