@vellumai/plugin-api 0.10.11-dev.202607231339.c736cb7 → 0.10.11-dev.202607231450.b516b22

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 +45 -167
  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;
@@ -1904,14 +1905,13 @@ declare interface ClientEntry extends BaseSubscriberEntry {
1904
1905
  actorPrincipalId?: string;
1905
1906
  }
1906
1907
 
1907
- /** Sent by the daemon to update a client-side setting (e.g. activation key). */
1908
- declare interface ClientSettingsUpdate {
1909
- type: "client_settings_update";
1910
- /** The setting key to update (e.g. "activationKey"). */
1911
- key: string;
1912
- /** The new value for the setting. */
1913
- value: string;
1914
- }
1908
+ declare type ClientSettingsUpdateEvent = z.infer<typeof ClientSettingsUpdateEventSchema>;
1909
+
1910
+ declare const ClientSettingsUpdateEventSchema: z.ZodObject<{
1911
+ type: z.ZodLiteral<"client_settings_update">;
1912
+ key: z.ZodString;
1913
+ value: z.ZodString;
1914
+ }, z.core.$strip>;
1915
1915
 
1916
1916
  declare interface CliOptionHelp {
1917
1917
  /** Commander flag spec, e.g. `"--path <file>"` or `"-l, --limit <n>"`. */
@@ -1964,10 +1964,11 @@ declare const CompactionCircuitOpenEventSchema: z.ZodObject<{
1964
1964
 
1965
1965
  declare type _ComputerUseServerMessages = RecordingStartEvent | RecordingStopEvent | RecordingPauseEvent | RecordingResumeEvent;
1966
1966
 
1967
- /** Sent by the daemon when workspace config.json changes on disk. */
1968
- declare interface ConfigChanged {
1969
- type: "config_changed";
1970
- }
1967
+ declare type ConfigChangedEvent = z.infer<typeof ConfigChangedEventSchema>;
1968
+
1969
+ declare const ConfigChangedEventSchema: z.ZodObject<{
1970
+ type: z.ZodLiteral<"config_changed">;
1971
+ }, z.core.$strip>;
1971
1972
 
1972
1973
  declare type ConfiguredProviderOptions = Pick<ResolveCallSiteOpts, "overrideProfile" | "forceOverrideProfile" | "selectionSeed">;
1973
1974
 
@@ -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,20 +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 ContactsResponse {
2099
- type: "contacts_response";
2100
- success: boolean;
2101
- error?: string;
2102
- contact?: ContactPayload;
2103
- contacts?: ContactPayload[];
2104
- }
2069
+ declare const ContactsChangedEventSchema: z.ZodObject<{
2070
+ type: z.ZodLiteral<"contacts_changed">;
2071
+ }, z.core.$strip>;
2105
2072
 
2106
- declare type _ContactsServerMessages = ContactsResponse | ContactsChanged | ContactRequestEvent;
2073
+ declare type _ContactsServerMessages = ContactsChangedEvent | ContactRequestEvent;
2107
2074
 
2108
2075
  export declare type ContentBlock = TextContent | ThinkingContent | RedactedThinkingContent | ImageContent | FileContent | ToolUseContent | ToolResultContent | ServerToolUseContent | WebSearchToolResultContent;
2109
2076
 
@@ -2545,13 +2512,15 @@ declare const DocumentCommentResolvedEventSchema: z.ZodObject<{
2545
2512
 
2546
2513
  declare type _DocumentCommentsServerMessages = DocumentCommentCreatedEvent | DocumentCommentResolvedEvent | DocumentCommentReopenedEvent | DocumentCommentDeletedEvent;
2547
2514
 
2548
- declare interface DocumentEditorShow {
2549
- type: "document_editor_show";
2550
- conversationId: string;
2551
- surfaceId: string;
2552
- title: string;
2553
- initialContent: string;
2554
- }
2515
+ declare type DocumentEditorShowEvent = z.infer<typeof DocumentEditorShowEventSchema>;
2516
+
2517
+ declare const DocumentEditorShowEventSchema: z.ZodObject<{
2518
+ type: z.ZodLiteral<"document_editor_show">;
2519
+ conversationId: z.ZodString;
2520
+ surfaceId: z.ZodString;
2521
+ title: z.ZodString;
2522
+ initialContent: z.ZodString;
2523
+ }, z.core.$strip>;
2555
2524
 
2556
2525
  declare type DocumentEditorUpdateEvent = z.infer<typeof DocumentEditorUpdateEventSchema>;
2557
2526
 
@@ -2563,31 +2532,6 @@ declare const DocumentEditorUpdateEventSchema: z.ZodObject<{
2563
2532
  mode: z.ZodString;
2564
2533
  }, z.core.$strip>;
2565
2534
 
2566
- declare interface DocumentListResponse {
2567
- type: "document_list_response";
2568
- documents: Array<{
2569
- surfaceId: string;
2570
- conversationId: string;
2571
- title: string;
2572
- wordCount: number;
2573
- createdAt: number;
2574
- updatedAt: number;
2575
- }>;
2576
- }
2577
-
2578
- declare interface DocumentLoadResponse {
2579
- type: "document_load_response";
2580
- surfaceId: string;
2581
- conversationId: string;
2582
- title: string;
2583
- content: string;
2584
- wordCount: number;
2585
- createdAt: number;
2586
- updatedAt: number;
2587
- success: boolean;
2588
- error?: string;
2589
- }
2590
-
2591
2535
  declare type DocumentPreviewSurfaceData = z.infer<typeof DocumentPreviewSurfaceDataSchema>;
2592
2536
 
2593
2537
  declare const DocumentPreviewSurfaceDataSchema: z.ZodObject<{
@@ -2598,14 +2542,7 @@ declare const DocumentPreviewSurfaceDataSchema: z.ZodObject<{
2598
2542
  mimeType: z.ZodCatch<z.ZodOptional<z.ZodString>>;
2599
2543
  }, z.core.$strip>;
2600
2544
 
2601
- declare interface DocumentSaveResponse {
2602
- type: "document_save_response";
2603
- surfaceId: string;
2604
- success: boolean;
2605
- error?: string;
2606
- }
2607
-
2608
- declare type _DocumentsServerMessages = DocumentEditorShow | DocumentEditorUpdateEvent | DocumentSaveResponse | DocumentLoadResponse | DocumentListResponse;
2545
+ declare type _DocumentsServerMessages = DocumentEditorShowEvent | DocumentEditorUpdateEvent;
2609
2546
 
2610
2547
  /**
2611
2548
  * Whether the given model or profile can process image input.
@@ -2789,15 +2726,6 @@ declare const FormSurfaceDataSchema: z.ZodObject<{
2789
2726
  }>>>;
2790
2727
  }, z.core.$strip>;
2791
2728
 
2792
- /** Response to a generate_avatar request indicating success or failure. */
2793
- declare interface GenerateAvatarResponse {
2794
- type: "generate_avatar_response";
2795
- /** Whether the avatar was generated successfully. */
2796
- success: boolean;
2797
- /** Error message when success is false. */
2798
- error?: string;
2799
- }
2800
-
2801
2729
  declare type GenerationCancelledEvent = z.infer<typeof GenerationCancelledEventSchema>;
2802
2730
 
2803
2731
  declare const GenerationCancelledEventSchema: z.ZodObject<{
@@ -2904,67 +2832,6 @@ declare interface GraphNodeSweepResult {
2904
2832
  deleted: number;
2905
2833
  }
2906
2834
 
2907
- declare interface GuardianActionDecisionResponse {
2908
- type: "guardian_action_decision_response";
2909
- applied: boolean;
2910
- reason?: string;
2911
- resolverFailureReason?: string;
2912
- requestId?: string;
2913
- userText?: string;
2914
- /** Resolver reply text for the guardian (e.g. verification code for access requests). */
2915
- replyText?: string;
2916
- }
2917
-
2918
- declare interface GuardianActionsPendingResponse {
2919
- type: "guardian_actions_pending_response";
2920
- conversationId: string;
2921
- prompts: GuardianDecisionPrompt[];
2922
- }
2923
-
2924
- declare type _GuardianActionsServerMessages = GuardianActionsPendingResponse | GuardianActionDecisionResponse;
2925
-
2926
- declare interface GuardianDecisionAction {
2927
- /** Canonical action identifier. */
2928
- action: string;
2929
- /** Human-readable label for the action. */
2930
- label: string;
2931
- /** Short explanation shown in rich-UI legends (Telegram, Slack). */
2932
- description?: string;
2933
- }
2934
-
2935
- /**
2936
- * Shared types and render helpers for guardian decision prompts: the prompt
2937
- * model shown to guardians, the canonical action constants, and the
2938
- * legend/fallback builders used to present them on rich and plain-text channels.
2939
- */
2940
- /** Structured model for prompts shown to guardians. */
2941
- declare interface GuardianDecisionPrompt {
2942
- requestId: string;
2943
- /** Short human-readable code for the request. */
2944
- requestCode: string;
2945
- state: "pending" | "followup_awaiting_choice" | "expired_superseded_with_active_call";
2946
- questionText: string;
2947
- toolName: string | null;
2948
- actions: GuardianDecisionAction[];
2949
- expiresAt: number;
2950
- conversationId: string;
2951
- callSessionId: string | null;
2952
- /**
2953
- * Guardian request kind (e.g. 'tool_approval', 'pending_question').
2954
- * Present when the prompt originates from the guardian request
2955
- * store. Absent for legacy-only prompts.
2956
- */
2957
- kind?: string;
2958
- /** Human-readable preview of the command being approved (e.g. shell command). */
2959
- commandPreview?: string;
2960
- /** Risk level label for the request (e.g. 'low', 'medium', 'high'). */
2961
- riskLevel?: string;
2962
- /** Short activity description for richer prompt display. */
2963
- activityText?: string;
2964
- /** Where the tool will execute — sandbox or host. */
2965
- executionTarget?: "sandbox" | "host";
2966
- }
2967
-
2968
2835
  /** Whether the text tokenizes to at least one lexical search token. */
2969
2836
  export declare function hasLexicalTokens(text: string): Promise<boolean>;
2970
2837
 
@@ -4452,6 +4319,16 @@ declare const OpenPanelEventSchema: z.ZodObject<{
4452
4319
  * `start` / `sendAudio` / `stop`, or `null` when no streaming session can be
4453
4320
  * opened — the provider is unknown, has no streaming adapter, or is missing
4454
4321
  * credentials.
4322
+ *
4323
+ * The STT resolver is imported lazily at call time, mirroring
4324
+ * `runConversationTurn`: plugin-api facades must not statically pull deep
4325
+ * daemon subsystems into the barrel's module graph. The static import here
4326
+ * dragged ~75 provider/STT modules into `plugin-api/index.ts` evaluation,
4327
+ * and in the compiled binary that surfaced as a TDZ `ReferenceError`
4328
+ * ("Cannot access 'openTranscriptionSession' before initialization") when a
4329
+ * plugin touched the binding through the workspace shim. With the lazy
4330
+ * import this module has no static value imports at all, so the barrel
4331
+ * binding initializes trivially and the daemon graph loads on first use.
4455
4332
  */
4456
4333
  export declare function openTranscriptionSession(): Promise<StreamingTranscriber | null>;
4457
4334
 
@@ -5620,7 +5497,7 @@ declare interface SensitiveOutputBinding {
5620
5497
 
5621
5498
  declare type SensitiveOutputKind = "invite_code";
5622
5499
 
5623
- 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 | _NotificationsServerMessages | _UpgradesServerMessages | _AcpServerMessages | _BackgroundToolsServerMessages | _BookmarksServerMessages | _WorkflowsServerMessages | DiskPressureStatusChangedEvent | HookEvent | SubagentEvent;
5500
+ 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;
5624
5501
 
5625
5502
  export declare interface ServerToolUseContent {
5626
5503
  type: "server_tool_use";
@@ -5653,7 +5530,7 @@ declare const ServiceGroupUpdateStartingEventSchema: z.ZodObject<{
5653
5530
  expectedDowntimeSeconds: z.ZodNumber;
5654
5531
  }, z.core.$strip>;
5655
5532
 
5656
- declare type _SettingsServerMessages = ClientSettingsUpdate | AvatarUpdatedEvent | ConfigChanged | SoundsConfigUpdated | GenerateAvatarResponse;
5533
+ declare type _SettingsServerMessages = ClientSettingsUpdateEvent | AvatarUpdatedEvent | ConfigChangedEvent | SoundsConfigUpdatedEvent;
5657
5534
 
5658
5535
  declare interface ShareAppCloudResponse {
5659
5536
  type: "share_app_cloud_response";
@@ -5874,10 +5751,11 @@ declare interface SlimSkillBase {
5874
5751
 
5875
5752
  declare type SlimSkillResponse = VellumSlimSkill | ClawhubSlimSkill | SkillsshSlimSkill | CustomSlimSkill | AssistantMemorySlimSkill;
5876
5753
 
5877
- /** Sent by the daemon when sounds config or sound files change on disk. */
5878
- declare interface SoundsConfigUpdated {
5879
- type: "sounds_config_updated";
5880
- }
5754
+ declare type SoundsConfigUpdatedEvent = z.infer<typeof SoundsConfigUpdatedEventSchema>;
5755
+
5756
+ declare const SoundsConfigUpdatedEventSchema: z.ZodObject<{
5757
+ type: z.ZodLiteral<"sounds_config_updated">;
5758
+ }, z.core.$strip>;
5881
5759
 
5882
5760
  /**
5883
5761
  * The full `stop` context a hook receives — the dispatching call site's
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vellumai/plugin-api",
3
- "version": "0.10.11-dev.202607231339.c736cb7",
3
+ "version": "0.10.11-dev.202607231450.b516b22",
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"