@vellumai/plugin-api 0.10.11-dev.202607231240.e03ec0b → 0.10.11-dev.202607231425.01b751a

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/app.d.ts +84 -0
  2. package/index.d.ts +67 -216
  3. package/package.json +6 -2
package/app.d.ts ADDED
@@ -0,0 +1,84 @@
1
+ /**
2
+ * Ambient global types for the **app-side** Vellum bridge — `window.vellum`.
3
+ *
4
+ * A Vellum plugin app runs inside a sandboxed iframe, and the host injects a
5
+ * `window.vellum` object into it at load time (see the assistant's
6
+ * `sandbox-bridge` runtime). This file is the type-only counterpart to that
7
+ * injection: it teaches TypeScript the shape of `window.vellum` so an app can
8
+ * call `window.vellum.fetch(...)` without hand-declaring the global in every
9
+ * project.
10
+ *
11
+ * Only `fetch` is typed for now — the surface the vast majority of apps
12
+ * actually use. Other injected members are intentionally left undeclared until
13
+ * there's a concrete need.
14
+ *
15
+ * A plugin app that depends on `@vellumai/plugin-api` pulls this in via a
16
+ * one-line reference (recommended — no runtime import, which apps can't rely
17
+ * on inside the sandbox):
18
+ *
19
+ * ```ts
20
+ * /// <reference types="@vellumai/plugin-api/app" />
21
+ * ```
22
+ *
23
+ * or by adding `"@vellumai/plugin-api/app"` to `compilerOptions.types` in
24
+ * `tsconfig.json`. Either way the app no longer needs its own `vellum.d.ts`.
25
+ *
26
+ * The named types below are also exported, so app code that wants to annotate
27
+ * a variable can `import type { VellumAppBridge } from "@vellumai/plugin-api/app"`.
28
+ */
29
+
30
+ /**
31
+ * Request init accepted by {@link VellumAppBridge.fetch}. A subset of the DOM
32
+ * `RequestInit`: the bridge serializes the request across `postMessage`, so
33
+ * `headers` must be a plain object and `body` a string (not a `Headers`
34
+ * instance, `FormData`, or a stream).
35
+ */
36
+ export interface VellumAppFetchInit {
37
+ /** HTTP method. Defaults to `"GET"`. */
38
+ method?: string;
39
+ /** Request headers as a plain object. */
40
+ headers?: Record<string, string>;
41
+ /** Request body. Already-serialized string payloads only. */
42
+ body?: string | null;
43
+ }
44
+
45
+ /**
46
+ * Response returned by {@link VellumAppBridge.fetch}. A `fetch`-like subset,
47
+ * not a full DOM `Response`: the body is delivered as text across the bridge,
48
+ * so only `json()` and `text()` are available (no `blob()`, `body`, etc.).
49
+ */
50
+ export interface VellumAppFetchResponse {
51
+ /** True when `status` is in the 2xx range. */
52
+ ok: boolean;
53
+ status: number;
54
+ statusText: string;
55
+ /** Response headers as a plain object. */
56
+ headers: Record<string, string>;
57
+ /** Parse the response body as JSON. */
58
+ json(): Promise<unknown>;
59
+ /** Read the response body as text. */
60
+ text(): Promise<string>;
61
+ }
62
+
63
+ /**
64
+ * The `window.vellum` bridge the host injects into a plugin app's sandboxed
65
+ * iframe. Mirrors the runtime built by the assistant's `sandbox-bridge`.
66
+ */
67
+ export interface VellumAppBridge {
68
+ /**
69
+ * Authenticated `fetch` to the app's own custom routes under `/v1/x/` (a
70
+ * leading `/x/` is accepted and normalized). Proxied through the host so the
71
+ * assistant's session/auth is attached — use this instead of the bare
72
+ * global `fetch`, which fails from the sandboxed origin.
73
+ */
74
+ fetch(
75
+ path: string,
76
+ options?: VellumAppFetchInit,
77
+ ): Promise<VellumAppFetchResponse>;
78
+ }
79
+
80
+ declare global {
81
+ interface Window {
82
+ vellum: VellumAppBridge;
83
+ }
84
+ }
package/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ /// <reference path="./app.d.ts" />
1
2
  import { z } from 'zod';
2
3
 
3
4
  declare type _AcpServerMessages = AcpSessionSpawnedEvent | AcpSessionUpdateEvent | AcpSessionCompletedEvent | AcpSessionErrorEvent | AcpSessionUsageEvent;
@@ -1962,7 +1963,7 @@ declare const CompactionCircuitOpenEventSchema: z.ZodObject<{
1962
1963
  openUntil: z.ZodNumber;
1963
1964
  }, z.core.$strip>;
1964
1965
 
1965
- declare type _ComputerUseServerMessages = RecordingStart | RecordingStop | RecordingPause | RecordingResume;
1966
+ declare type _ComputerUseServerMessages = RecordingStartEvent | RecordingStopEvent | RecordingPauseEvent | RecordingResumeEvent;
1966
1967
 
1967
1968
  /** Sent by the daemon when workspace config.json changes on disk. */
1968
1969
  declare interface ConfigChanged {
@@ -2051,33 +2052,6 @@ declare const ConfirmationSurfaceDataSchema: z.ZodObject<{
2051
2052
  destructive: z.ZodCatch<z.ZodOptional<z.ZodBoolean>>;
2052
2053
  }, z.core.$strip>;
2053
2054
 
2054
- declare interface ContactChannelPayload {
2055
- id: string;
2056
- type: string;
2057
- address: string;
2058
- isPrimary: boolean;
2059
- status: string;
2060
- policy: string;
2061
- verifiedAt?: number;
2062
- verifiedVia?: string;
2063
- lastSeenAt?: number;
2064
- interactionCount?: number;
2065
- lastInteraction?: number;
2066
- revokedReason?: string;
2067
- blockedReason?: string;
2068
- }
2069
-
2070
- declare interface ContactPayload {
2071
- id: string;
2072
- displayName: string;
2073
- role: "guardian" | "contact";
2074
- notes?: string;
2075
- contactType?: string;
2076
- lastInteraction?: number;
2077
- interactionCount: number;
2078
- channels: ContactChannelPayload[];
2079
- }
2080
-
2081
2055
  declare type ContactRequestEvent = z.infer<typeof ContactRequestEventSchema>;
2082
2056
 
2083
2057
  declare const ContactRequestEventSchema: z.ZodObject<{
@@ -2090,51 +2064,13 @@ declare const ContactRequestEventSchema: z.ZodObject<{
2090
2064
  role: z.ZodOptional<z.ZodString>;
2091
2065
  }, z.core.$strip>;
2092
2066
 
2093
- /** Server push lightweight invalidation signal: the contacts table has been mutated, refetch your list. */
2094
- declare interface ContactsChanged {
2095
- type: "contacts_changed";
2096
- }
2067
+ declare type ContactsChangedEvent = z.infer<typeof ContactsChangedEventSchema>;
2097
2068
 
2098
- declare interface ContactsInviteResponse {
2099
- type: "contacts_invite_response";
2100
- success: boolean;
2101
- error?: string;
2102
- /** Single invite (returned on create/revoke). Token field is only present on create. */
2103
- invite?: {
2104
- id: string;
2105
- sourceChannel: string;
2106
- token?: string;
2107
- tokenHash: string;
2108
- maxUses: number;
2109
- useCount: number;
2110
- expiresAt: number | null;
2111
- status: string;
2112
- note?: string;
2113
- createdAt: number;
2114
- };
2115
- /** List of invites (returned on list). */
2116
- invites?: Array<{
2117
- id: string;
2118
- sourceChannel: string;
2119
- tokenHash: string;
2120
- maxUses: number;
2121
- useCount: number;
2122
- expiresAt: number | null;
2123
- status: string;
2124
- note?: string;
2125
- createdAt: number;
2126
- }>;
2127
- }
2128
-
2129
- declare interface ContactsResponse {
2130
- type: "contacts_response";
2131
- success: boolean;
2132
- error?: string;
2133
- contact?: ContactPayload;
2134
- contacts?: ContactPayload[];
2135
- }
2069
+ declare const ContactsChangedEventSchema: z.ZodObject<{
2070
+ type: z.ZodLiteral<"contacts_changed">;
2071
+ }, z.core.$strip>;
2136
2072
 
2137
- declare type _ContactsServerMessages = ContactsResponse | ContactsChanged | ContactRequestEvent;
2073
+ declare type _ContactsServerMessages = ContactsChangedEvent | ContactRequestEvent;
2138
2074
 
2139
2075
  export declare type ContentBlock = TextContent | ThinkingContent | RedactedThinkingContent | ImageContent | FileContent | ToolUseContent | ToolResultContent | ServerToolUseContent | WebSearchToolResultContent;
2140
2076
 
@@ -2484,17 +2420,6 @@ declare interface CustomSlimSkill extends SlimSkillBase {
2484
2420
  */
2485
2421
  export declare function deleteConversation(id: string): Promise<void>;
2486
2422
 
2487
- declare type _DiagnosticsServerMessages = EnvVarsResponse | DictationResponse;
2488
-
2489
- declare interface DictationResponse {
2490
- type: "dictation_response";
2491
- text: string;
2492
- mode: "dictation" | "command" | "action";
2493
- actionPlan?: string;
2494
- resolvedProfileId?: string;
2495
- profileSource?: "request" | "app_mapping" | "default" | "fallback";
2496
- }
2497
-
2498
2423
  declare interface DiffInfo {
2499
2424
  filePath: string;
2500
2425
  oldContent: string;
@@ -2707,11 +2632,6 @@ declare type EmbeddingInput = string | MultimodalEmbeddingInput;
2707
2632
  */
2708
2633
  declare type EmbeddingTargetType = Parameters<embedAndUpsert_2>[1];
2709
2634
 
2710
- declare interface EnvVarsResponse {
2711
- type: "env_vars_response";
2712
- vars: Record<string, string>;
2713
- }
2714
-
2715
2635
  declare type ErrorEvent_2 = z.infer<typeof ErrorEventSchema>;
2716
2636
 
2717
2637
  declare const ErrorEventSchema: z.ZodObject<{
@@ -2951,67 +2871,6 @@ declare interface GraphNodeSweepResult {
2951
2871
  deleted: number;
2952
2872
  }
2953
2873
 
2954
- declare interface GuardianActionDecisionResponse {
2955
- type: "guardian_action_decision_response";
2956
- applied: boolean;
2957
- reason?: string;
2958
- resolverFailureReason?: string;
2959
- requestId?: string;
2960
- userText?: string;
2961
- /** Resolver reply text for the guardian (e.g. verification code for access requests). */
2962
- replyText?: string;
2963
- }
2964
-
2965
- declare interface GuardianActionsPendingResponse {
2966
- type: "guardian_actions_pending_response";
2967
- conversationId: string;
2968
- prompts: GuardianDecisionPrompt[];
2969
- }
2970
-
2971
- declare type _GuardianActionsServerMessages = GuardianActionsPendingResponse | GuardianActionDecisionResponse;
2972
-
2973
- declare interface GuardianDecisionAction {
2974
- /** Canonical action identifier. */
2975
- action: string;
2976
- /** Human-readable label for the action. */
2977
- label: string;
2978
- /** Short explanation shown in rich-UI legends (Telegram, Slack). */
2979
- description?: string;
2980
- }
2981
-
2982
- /**
2983
- * Shared types and render helpers for guardian decision prompts: the prompt
2984
- * model shown to guardians, the canonical action constants, and the
2985
- * legend/fallback builders used to present them on rich and plain-text channels.
2986
- */
2987
- /** Structured model for prompts shown to guardians. */
2988
- declare interface GuardianDecisionPrompt {
2989
- requestId: string;
2990
- /** Short human-readable code for the request. */
2991
- requestCode: string;
2992
- state: "pending" | "followup_awaiting_choice" | "expired_superseded_with_active_call";
2993
- questionText: string;
2994
- toolName: string | null;
2995
- actions: GuardianDecisionAction[];
2996
- expiresAt: number;
2997
- conversationId: string;
2998
- callSessionId: string | null;
2999
- /**
3000
- * Guardian request kind (e.g. 'tool_approval', 'pending_question').
3001
- * Present when the prompt originates from the guardian request
3002
- * store. Absent for legacy-only prompts.
3003
- */
3004
- kind?: string;
3005
- /** Human-readable preview of the command being approved (e.g. shell command). */
3006
- commandPreview?: string;
3007
- /** Risk level label for the request (e.g. 'low', 'medium', 'high'). */
3008
- riskLevel?: string;
3009
- /** Short activity description for richer prompt display. */
3010
- activityText?: string;
3011
- /** Where the tool will execute — sandbox or host. */
3012
- executionTarget?: "sandbox" | "host";
3013
- }
3014
-
3015
2874
  /** Whether the text tokenizes to at least one lexical search token. */
3016
2875
  export declare function hasLexicalTokens(text: string): Promise<boolean>;
3017
2876
 
@@ -3599,8 +3458,6 @@ declare interface ImageEmbeddingInput {
3599
3458
  mimeType: string;
3600
3459
  }
3601
3460
 
3602
- declare type _InboxServerMessages = ContactsInviteResponse;
3603
-
3604
3461
  declare interface IngressConfigResponse {
3605
3462
  type: "ingress_config_response";
3606
3463
  enabled: boolean;
@@ -4401,37 +4258,18 @@ declare const NavigateSettingsEventSchema: z.ZodObject<{
4401
4258
  tab: z.ZodString;
4402
4259
  }, z.core.$strip>;
4403
4260
 
4404
- /** Server push broadcast when a notification creates a new vellum conversation. */
4405
- declare interface NotificationConversationCreated {
4406
- type: "notification_conversation_created";
4407
- conversationId: string;
4408
- title: string;
4409
- sourceEventName: string;
4410
- /**
4411
- * When set, this conversation was created for a guardian-sensitive notification
4412
- * and should only be surfaced by clients bound to this guardian identity.
4413
- */
4414
- targetGuardianPrincipalId?: string;
4415
- /**
4416
- * Conversation group identifier propagated from the signal producer.
4417
- * Clients use this to place the conversation in the correct sidebar folder
4418
- * (e.g. "system:scheduled" for schedule completion threads).
4419
- */
4420
- groupId?: string;
4421
- /**
4422
- * Semantic source of the conversation (e.g. "schedule", "reminder").
4423
- * Allows clients to override the default "notification" source so the
4424
- * conversation is attributed correctly.
4425
- */
4426
- source?: string;
4427
- /**
4428
- * Mirrors `NotificationIntent.silent`. When true the client must not
4429
- * post a fallback OS banner for this conversation — the sidebar entry
4430
- * still appears, but the always-on inbox is the only surfaced channel.
4431
- * Derived from the originating signal's `attentionHints.urgency`.
4432
- */
4433
- silent?: boolean;
4434
- }
4261
+ declare type NotificationConversationCreatedEvent = z.infer<typeof NotificationConversationCreatedEventSchema>;
4262
+
4263
+ declare const NotificationConversationCreatedEventSchema: z.ZodObject<{
4264
+ type: z.ZodLiteral<"notification_conversation_created">;
4265
+ conversationId: z.ZodString;
4266
+ title: z.ZodString;
4267
+ sourceEventName: z.ZodString;
4268
+ targetGuardianPrincipalId: z.ZodOptional<z.ZodString>;
4269
+ groupId: z.ZodOptional<z.ZodString>;
4270
+ source: z.ZodOptional<z.ZodString>;
4271
+ silent: z.ZodOptional<z.ZodBoolean>;
4272
+ }, z.core.$strip>;
4435
4273
 
4436
4274
  declare type NotificationIntentEvent = z.infer<typeof NotificationIntentEventSchema>;
4437
4275
 
@@ -4446,7 +4284,7 @@ declare const NotificationIntentEventSchema: z.ZodObject<{
4446
4284
  silent: z.ZodOptional<z.ZodBoolean>;
4447
4285
  }, z.core.$strip>;
4448
4286
 
4449
- declare type _NotificationsServerMessages = NotificationIntentEvent | NotificationConversationCreated;
4287
+ declare type _NotificationsServerMessages = NotificationIntentEvent | NotificationConversationCreatedEvent;
4450
4288
 
4451
4289
  declare interface OAuthConnectResultResponse {
4452
4290
  type: "oauth_connect_result";
@@ -4520,6 +4358,16 @@ declare const OpenPanelEventSchema: z.ZodObject<{
4520
4358
  * `start` / `sendAudio` / `stop`, or `null` when no streaming session can be
4521
4359
  * opened — the provider is unknown, has no streaming adapter, or is missing
4522
4360
  * credentials.
4361
+ *
4362
+ * The STT resolver is imported lazily at call time, mirroring
4363
+ * `runConversationTurn`: plugin-api facades must not statically pull deep
4364
+ * daemon subsystems into the barrel's module graph. The static import here
4365
+ * dragged ~75 provider/STT modules into `plugin-api/index.ts` evaluation,
4366
+ * and in the compiled binary that surfaced as a TDZ `ReferenceError`
4367
+ * ("Cannot access 'openTranscriptionSession' before initialization") when a
4368
+ * plugin touched the binding through the workspace shim. With the lazy
4369
+ * import this module has no static value imports at all, so the barrel
4370
+ * binding initializes trivially and the daemon graph loads on first use.
4523
4371
  */
4524
4372
  export declare function openTranscriptionSession(): Promise<StreamingTranscriber | null>;
4525
4373
 
@@ -5125,43 +4973,46 @@ declare const QuestionRequestEventSchema: z.ZodObject<{
5125
4973
  toolUseId: z.ZodOptional<z.ZodString>;
5126
4974
  }, z.core.$strip>;
5127
4975
 
5128
- /** Recording options shared across standalone and CU recording flows. */
5129
- declare interface RecordingOptions {
5130
- captureScope?: "display" | "window";
5131
- displayId?: string;
5132
- windowId?: number;
5133
- includeAudio?: boolean;
5134
- includeMicrophone?: boolean;
5135
- promptForSource?: boolean;
5136
- }
4976
+ declare type RecordingPauseEvent = z.infer<typeof RecordingPauseEventSchema>;
5137
4977
 
5138
- /** Server → Client: pause the active recording. */
5139
- declare interface RecordingPause {
5140
- type: "recording_pause";
5141
- recordingId: string;
5142
- }
4978
+ declare const RecordingPauseEventSchema: z.ZodObject<{
4979
+ type: z.ZodLiteral<"recording_pause">;
4980
+ recordingId: z.ZodString;
4981
+ }, z.core.$strip>;
5143
4982
 
5144
- /** Server Client: resume a paused recording. */
5145
- declare interface RecordingResume {
5146
- type: "recording_resume";
5147
- recordingId: string;
5148
- }
4983
+ declare type RecordingResumeEvent = z.infer<typeof RecordingResumeEventSchema>;
5149
4984
 
5150
- /** Server → Client: start a recording. */
5151
- declare interface RecordingStart {
5152
- type: "recording_start";
5153
- recordingId: string;
5154
- attachToConversationId?: string;
5155
- options?: RecordingOptions;
5156
- /** Operation token for restart race hardening — stale completions with mismatched tokens are rejected. */
5157
- operationToken?: string;
5158
- }
4985
+ declare const RecordingResumeEventSchema: z.ZodObject<{
4986
+ type: z.ZodLiteral<"recording_resume">;
4987
+ recordingId: z.ZodString;
4988
+ }, z.core.$strip>;
5159
4989
 
5160
- /** Server Client: stop a recording. */
5161
- declare interface RecordingStop {
5162
- type: "recording_stop";
5163
- recordingId: string;
5164
- }
4990
+ declare type RecordingStartEvent = z.infer<typeof RecordingStartEventSchema>;
4991
+
4992
+ declare const RecordingStartEventSchema: z.ZodObject<{
4993
+ type: z.ZodLiteral<"recording_start">;
4994
+ recordingId: z.ZodString;
4995
+ attachToConversationId: z.ZodOptional<z.ZodString>;
4996
+ options: z.ZodOptional<z.ZodObject<{
4997
+ captureScope: z.ZodOptional<z.ZodEnum<{
4998
+ display: "display";
4999
+ window: "window";
5000
+ }>>;
5001
+ displayId: z.ZodOptional<z.ZodString>;
5002
+ windowId: z.ZodOptional<z.ZodNumber>;
5003
+ includeAudio: z.ZodOptional<z.ZodBoolean>;
5004
+ includeMicrophone: z.ZodOptional<z.ZodBoolean>;
5005
+ promptForSource: z.ZodOptional<z.ZodBoolean>;
5006
+ }, z.core.$strip>>;
5007
+ operationToken: z.ZodOptional<z.ZodString>;
5008
+ }, z.core.$strip>;
5009
+
5010
+ declare type RecordingStopEvent = z.infer<typeof RecordingStopEventSchema>;
5011
+
5012
+ declare const RecordingStopEventSchema: z.ZodObject<{
5013
+ type: z.ZodLiteral<"recording_stop">;
5014
+ recordingId: z.ZodString;
5015
+ }, z.core.$strip>;
5165
5016
 
5166
5017
  export declare interface RedactedThinkingContent {
5167
5018
  type: "redacted_thinking";
@@ -5685,7 +5536,7 @@ declare interface SensitiveOutputBinding {
5685
5536
 
5686
5537
  declare type SensitiveOutputKind = "invite_code";
5687
5538
 
5688
- declare type ServerMessage = _ConversationsServerMessages | _MessagesServerMessages | _SurfacesServerMessages | _SkillsServerMessages | _AppsServerMessages | _IntegrationsServerMessages | _ComputerUseServerMessages | _ContactsServerMessages | _SubagentsServerMessages | _DocumentsServerMessages | _DocumentCommentsServerMessages | _GuardianActionsServerMessages | _SyncInvalidationServerMessages | _HomeServerMessages | _HostAppControlServerMessages | _HostBashServerMessages | _HostBrowserServerMessages | _HostCuServerMessages | _HostFileServerMessages | _HostTransferServerMessages | _HostUiSnapshotServerMessages | _MemoryServerMessages | _WorkspaceServerMessages | _SchedulesServerMessages | _SettingsServerMessages | _DiagnosticsServerMessages | _InboxServerMessages | _NotificationsServerMessages | _UpgradesServerMessages | _AcpServerMessages | _BackgroundToolsServerMessages | _BookmarksServerMessages | _WorkflowsServerMessages | DiskPressureStatusChangedEvent | HookEvent | SubagentEvent;
5539
+ declare type ServerMessage = _ConversationsServerMessages | _MessagesServerMessages | _SurfacesServerMessages | _SkillsServerMessages | _AppsServerMessages | _IntegrationsServerMessages | _ComputerUseServerMessages | _ContactsServerMessages | _SubagentsServerMessages | _DocumentsServerMessages | _DocumentCommentsServerMessages | _SyncInvalidationServerMessages | _HomeServerMessages | _HostAppControlServerMessages | _HostBashServerMessages | _HostBrowserServerMessages | _HostCuServerMessages | _HostFileServerMessages | _HostTransferServerMessages | _HostUiSnapshotServerMessages | _MemoryServerMessages | _WorkspaceServerMessages | _SchedulesServerMessages | _SettingsServerMessages | _NotificationsServerMessages | _UpgradesServerMessages | _AcpServerMessages | _BackgroundToolsServerMessages | _BookmarksServerMessages | _WorkflowsServerMessages | DiskPressureStatusChangedEvent | HookEvent | SubagentEvent;
5689
5540
 
5690
5541
  export declare interface ServerToolUseContent {
5691
5542
  type: "server_tool_use";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vellumai/plugin-api",
3
- "version": "0.10.11-dev.202607231240.e03ec0b",
3
+ "version": "0.10.11-dev.202607231425.01b751a",
4
4
  "description": "Public TypeScript authoring contract for Vellum assistant plugins.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -11,11 +11,15 @@
11
11
  "types": "./index.d.ts",
12
12
  "import": "./index.js",
13
13
  "default": "./index.js"
14
+ },
15
+ "./app": {
16
+ "types": "./app.d.ts"
14
17
  }
15
18
  },
16
19
  "files": [
17
20
  "index.js",
18
- "index.d.ts"
21
+ "index.d.ts",
22
+ "app.d.ts"
19
23
  ],
20
24
  "dependencies": {
21
25
  "zod": "4.3.6"