@vellumai/plugin-api 0.10.11-dev.202607231339.c736cb7 → 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 +17 -101
  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;
@@ -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
 
@@ -2904,67 +2871,6 @@ declare interface GraphNodeSweepResult {
2904
2871
  deleted: number;
2905
2872
  }
2906
2873
 
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
2874
  /** Whether the text tokenizes to at least one lexical search token. */
2969
2875
  export declare function hasLexicalTokens(text: string): Promise<boolean>;
2970
2876
 
@@ -4452,6 +4358,16 @@ declare const OpenPanelEventSchema: z.ZodObject<{
4452
4358
  * `start` / `sendAudio` / `stop`, or `null` when no streaming session can be
4453
4359
  * opened — the provider is unknown, has no streaming adapter, or is missing
4454
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.
4455
4371
  */
4456
4372
  export declare function openTranscriptionSession(): Promise<StreamingTranscriber | null>;
4457
4373
 
@@ -5620,7 +5536,7 @@ declare interface SensitiveOutputBinding {
5620
5536
 
5621
5537
  declare type SensitiveOutputKind = "invite_code";
5622
5538
 
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;
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;
5624
5540
 
5625
5541
  export declare interface ServerToolUseContent {
5626
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.202607231339.c736cb7",
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"