@vellumai/plugin-api 0.11.0 → 0.11.1-staging.2

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 +134 -23
  2. package/index.js +6 -0
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -120,6 +120,7 @@ declare const AssistantConfigSchema: z.ZodObject<{
120
120
  "openai-whisper": "openai-whisper";
121
121
  xai: "xai";
122
122
  }>>;
123
+ language: z.ZodOptional<z.ZodString>;
123
124
  providers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>>>;
124
125
  }, z.core.$strip>>;
125
126
  tts: z.ZodDefault<z.ZodObject<{
@@ -770,8 +771,18 @@ declare const AssistantConfigSchema: z.ZodObject<{
770
771
  anthropic: "anthropic";
771
772
  gemini: "gemini";
772
773
  fireworks: "fireworks";
774
+ together: "together";
775
+ poolside: "poolside";
773
776
  openrouter: "openrouter";
777
+ "vercel-ai-gateway": "vercel-ai-gateway";
778
+ ollama: "ollama";
779
+ "openai-compatible": "openai-compatible";
780
+ litellm: "litellm";
781
+ minimax: "minimax";
782
+ atlascloud: "atlascloud";
783
+ baseten: "baseten";
774
784
  vellum: "vellum";
785
+ chatgpt: "chatgpt";
775
786
  }>;
776
787
  connectionName: z.ZodOptional<z.ZodString>;
777
788
  }, z.core.$strip>>>;
@@ -1402,6 +1413,7 @@ declare const AssistantEventEnvelopeSchema: z.ZodObject<{
1402
1413
  requestId: z.ZodString;
1403
1414
  channel: z.ZodOptional<z.ZodString>;
1404
1415
  placeholder: z.ZodOptional<z.ZodString>;
1416
+ defaultValue: z.ZodOptional<z.ZodString>;
1405
1417
  label: z.ZodOptional<z.ZodString>;
1406
1418
  description: z.ZodOptional<z.ZodString>;
1407
1419
  role: z.ZodOptional<z.ZodString>;
@@ -1889,20 +1901,29 @@ declare const AssistantEventEnvelopeSchema: z.ZodObject<{
1889
1901
  type: z.ZodLiteral<"message_dequeued">;
1890
1902
  conversationId: z.ZodString;
1891
1903
  requestId: z.ZodString;
1904
+ clientMessageId: z.ZodOptional<z.ZodString>;
1892
1905
  }, z.core.$strip>, z.ZodObject<{
1893
1906
  type: z.ZodLiteral<"message_queued">;
1894
1907
  conversationId: z.ZodString;
1895
1908
  requestId: z.ZodString;
1896
1909
  position: z.ZodNumber;
1910
+ clientMessageId: z.ZodOptional<z.ZodString>;
1897
1911
  }, z.core.$strip>, z.ZodObject<{
1898
1912
  type: z.ZodLiteral<"message_queued_deleted">;
1899
1913
  conversationId: z.ZodString;
1900
1914
  requestId: z.ZodString;
1915
+ clientMessageId: z.ZodOptional<z.ZodString>;
1901
1916
  }, z.core.$strip>, z.ZodObject<{
1902
1917
  type: z.ZodLiteral<"message_request_complete">;
1903
1918
  conversationId: z.ZodString;
1904
1919
  requestId: z.ZodString;
1905
1920
  runStillActive: z.ZodOptional<z.ZodBoolean>;
1921
+ }, z.core.$strip>, z.ZodObject<{
1922
+ type: z.ZodLiteral<"message_requeued">;
1923
+ conversationId: z.ZodString;
1924
+ requestId: z.ZodString;
1925
+ position: z.ZodNumber;
1926
+ clientMessageId: z.ZodOptional<z.ZodString>;
1906
1927
  }, z.core.$strip>, z.ZodObject<{
1907
1928
  type: z.ZodLiteral<"message_steered">;
1908
1929
  conversationId: z.ZodString;
@@ -2181,6 +2202,7 @@ declare const AssistantEventEnvelopeSchema: z.ZodObject<{
2181
2202
  brave: "brave";
2182
2203
  perplexity: "perplexity";
2183
2204
  tavily: "tavily";
2205
+ keenable: "keenable";
2184
2206
  firecrawl: "firecrawl";
2185
2207
  }>;
2186
2208
  resultCount: z.ZodNumber;
@@ -2762,6 +2784,7 @@ declare const AssistantEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
2762
2784
  requestId: z.ZodString;
2763
2785
  channel: z.ZodOptional<z.ZodString>;
2764
2786
  placeholder: z.ZodOptional<z.ZodString>;
2787
+ defaultValue: z.ZodOptional<z.ZodString>;
2765
2788
  label: z.ZodOptional<z.ZodString>;
2766
2789
  description: z.ZodOptional<z.ZodString>;
2767
2790
  role: z.ZodOptional<z.ZodString>;
@@ -3249,20 +3272,29 @@ declare const AssistantEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
3249
3272
  type: z.ZodLiteral<"message_dequeued">;
3250
3273
  conversationId: z.ZodString;
3251
3274
  requestId: z.ZodString;
3275
+ clientMessageId: z.ZodOptional<z.ZodString>;
3252
3276
  }, z.core.$strip>, z.ZodObject<{
3253
3277
  type: z.ZodLiteral<"message_queued">;
3254
3278
  conversationId: z.ZodString;
3255
3279
  requestId: z.ZodString;
3256
3280
  position: z.ZodNumber;
3281
+ clientMessageId: z.ZodOptional<z.ZodString>;
3257
3282
  }, z.core.$strip>, z.ZodObject<{
3258
3283
  type: z.ZodLiteral<"message_queued_deleted">;
3259
3284
  conversationId: z.ZodString;
3260
3285
  requestId: z.ZodString;
3286
+ clientMessageId: z.ZodOptional<z.ZodString>;
3261
3287
  }, z.core.$strip>, z.ZodObject<{
3262
3288
  type: z.ZodLiteral<"message_request_complete">;
3263
3289
  conversationId: z.ZodString;
3264
3290
  requestId: z.ZodString;
3265
3291
  runStillActive: z.ZodOptional<z.ZodBoolean>;
3292
+ }, z.core.$strip>, z.ZodObject<{
3293
+ type: z.ZodLiteral<"message_requeued">;
3294
+ conversationId: z.ZodString;
3295
+ requestId: z.ZodString;
3296
+ position: z.ZodNumber;
3297
+ clientMessageId: z.ZodOptional<z.ZodString>;
3266
3298
  }, z.core.$strip>, z.ZodObject<{
3267
3299
  type: z.ZodLiteral<"message_steered">;
3268
3300
  conversationId: z.ZodString;
@@ -3541,6 +3573,7 @@ declare const AssistantEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
3541
3573
  brave: "brave";
3542
3574
  perplexity: "perplexity";
3543
3575
  tavily: "tavily";
3576
+ keenable: "keenable";
3544
3577
  firecrawl: "firecrawl";
3545
3578
  }>;
3546
3579
  resultCount: z.ZodNumber;
@@ -3735,7 +3768,7 @@ export declare interface AssistantEventSubscription {
3735
3768
  readonly connectionId: string;
3736
3769
  }
3737
3770
 
3738
- declare interface AudioEmbeddingInput {
3771
+ export declare interface AudioEmbeddingInput {
3739
3772
  type: "audio";
3740
3773
  data: Buffer;
3741
3774
  mimeType: string;
@@ -4047,28 +4080,30 @@ declare type DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Om
4047
4080
  */
4048
4081
  export declare function doesSupportVision(modelOrProfile: ModelProfileInfo | string): boolean;
4049
4082
 
4083
+ /**
4084
+ * Embed an input and return the raw dense vector (provider, model, and
4085
+ * dimensions included), with no persistence.
4086
+ */
4087
+ export declare function embed(input: EmbeddingInput): Promise<EmbedResult>;
4088
+
4050
4089
  /** Embed a target and upsert its vector into the vector store. */
4051
4090
  export declare function embedAndUpsert(targetType: EmbeddingTargetType, targetId: string, input: EmbeddingInput, extraPayload?: Record<string, unknown>): Promise<void>;
4052
4091
 
4053
4092
  declare function embedAndUpsert_2(config: AssistantConfig, targetType: "segment" | "item" | "summary" | "media" | "graph_node" | "pkb_file", targetId: string, input: EmbeddingInput, extraPayload?: Record<string, unknown>): Promise<void>;
4054
4093
 
4055
4094
  /** Accepts raw strings as shorthand for text inputs. */
4056
- declare type EmbeddingInput = string | MultimodalEmbeddingInput;
4095
+ export declare type EmbeddingInput = string | MultimodalEmbeddingInput;
4057
4096
 
4058
- /**
4059
- * Plugin-facing facade over the embeddings subsystem: self-contained
4060
- * operations that resolve the live workspace config internally, so callers
4061
- * (plugins importing via `@vellumai/plugin-api`) hold no host config.
4062
- *
4063
- * The operations are loaded via dynamic `import()` inside each wrapper so
4064
- * that importing this module — which every `@vellumai/plugin-api` consumer
4065
- * does transitively — does not eagerly pull the embed/vector import graph
4066
- * (`job-utils`, `embedding-backend`). An eager pull would force those
4067
- * modules' named exports to resolve at instantiation, which breaks the
4068
- * intentional partial module mocks in tests.
4069
- */
4070
4097
  declare type EmbeddingTargetType = Parameters<embedAndUpsert_2>[1];
4071
4098
 
4099
+ /** A computed embedding with the provider/model that produced it. */
4100
+ export declare interface EmbedResult {
4101
+ vector: number[];
4102
+ provider: string;
4103
+ model: string;
4104
+ dimensions: number;
4105
+ }
4106
+
4072
4107
  export declare function extractTextFromStoredMessageContent(raw: string | ContentBlock[]): string;
4073
4108
 
4074
4109
  export declare interface FileContent {
@@ -4086,6 +4121,12 @@ export declare interface FileContent {
4086
4121
  _attachmentId?: string;
4087
4122
  }
4088
4123
 
4124
+ /**
4125
+ * Generate the sparse (lexical) vector for a text using the host's shared
4126
+ * encoder. Pure and local: no backend call, no persistence.
4127
+ */
4128
+ export declare function generateSparseEmbedding(text: string): Promise<SparseEmbedding>;
4129
+
4089
4130
  /** Read the assistant's name from IDENTITY.md for personalized responses. */
4090
4131
  export declare function getAssistantName(): string | null;
4091
4132
 
@@ -4108,6 +4149,9 @@ export declare function getConversation(id: string): Promise<ConversationRow | n
4108
4149
  */
4109
4150
  export declare function getConversationDirPath(id: string, createdAtMs: number): Promise<string>;
4110
4151
 
4152
+ /** Fetch one document from the calling plugin's index, or null. */
4153
+ export declare function getDocument(documentId: string): Promise<IndexedDocument | null>;
4154
+
4111
4155
  /** All messages of a conversation in insertion order. */
4112
4156
  export declare function getMessages(conversationId: string): Promise<MessageRow[]>;
4113
4157
 
@@ -4254,12 +4298,57 @@ export declare interface ImageContent {
4254
4298
  source: MediaSource_2;
4255
4299
  }
4256
4300
 
4257
- declare interface ImageEmbeddingInput {
4301
+ export declare interface ImageEmbeddingInput {
4258
4302
  type: "image";
4259
4303
  data: Buffer;
4260
4304
  mimeType: string;
4261
4305
  }
4262
4306
 
4307
+ /**
4308
+ * Embed and upsert a document into the calling plugin's private index (not
4309
+ * agent recall). Returns the document id. Pass `opts.documentId` to overwrite
4310
+ * an existing document in place.
4311
+ */
4312
+ export declare function indexDocument(input: EmbeddingInput, opts?: IndexDocumentOptions): Promise<IndexDocumentResult>;
4313
+
4314
+ export declare interface IndexDocumentOptions {
4315
+ /**
4316
+ * Reuse a caller-owned id to upsert a document in place (the update path:
4317
+ * same id, overwrite). Omit to have the host mint a fresh document id.
4318
+ */
4319
+ documentId?: string;
4320
+ /**
4321
+ * Opaque provenance carried with the document (e.g. `{ rowId, fileId }`).
4322
+ * Round-tripped verbatim on query/get; never interpreted by the host.
4323
+ */
4324
+ metadata?: Record<string, unknown>;
4325
+ /** Override the stored creation timestamp (defaults to now). */
4326
+ createdAt?: number;
4327
+ }
4328
+
4329
+ export declare interface IndexDocumentResult {
4330
+ documentId: string;
4331
+ provider: string;
4332
+ model: string;
4333
+ dimensions: number;
4334
+ }
4335
+
4336
+ export declare interface IndexedDocument {
4337
+ documentId: string;
4338
+ text: string;
4339
+ modality: "text" | "image" | "audio" | "video";
4340
+ metadata?: Record<string, unknown>;
4341
+ createdAt: number;
4342
+ }
4343
+
4344
+ export declare interface IndexHit {
4345
+ documentId: string;
4346
+ score: number;
4347
+ text: string;
4348
+ modality: "text" | "image" | "audio" | "video";
4349
+ metadata?: Record<string, unknown>;
4350
+ }
4351
+
4263
4352
  /**
4264
4353
  * Context passed to `Plugin.init()` during bootstrap. Carries the resolved
4265
4354
  * config, a pino-compatible logger scoped to the plugin, a per-plugin
@@ -4840,7 +4929,7 @@ export declare interface ModelProfileInfo {
4840
4929
  readonly isMix: boolean;
4841
4930
  }
4842
4931
 
4843
- declare type MultimodalEmbeddingInput = TextEmbeddingInput | ImageEmbeddingInput | AudioEmbeddingInput | VideoEmbeddingInput;
4932
+ export declare type MultimodalEmbeddingInput = TextEmbeddingInput | ImageEmbeddingInput | AudioEmbeddingInput | VideoEmbeddingInput;
4844
4933
 
4845
4934
  /**
4846
4935
  * Open a streaming transcription session against the configured STT provider
@@ -5392,6 +5481,16 @@ export declare function quarantineRefusedExchanges(messages: Message[]): {
5392
5481
  droppedExchanges: number;
5393
5482
  };
5394
5483
 
5484
+ /** Hybrid semantic search over the calling plugin's index only. */
5485
+ export declare function queryIndex(query: EmbeddingInput, opts?: QueryIndexOptions): Promise<IndexHit[]>;
5486
+
5487
+ export declare interface QueryIndexOptions {
5488
+ /** Max hits to return. Defaults to 10. */
5489
+ limit?: number;
5490
+ /** Per-branch prefetch depth for the hybrid fusion. */
5491
+ prefetchLimit?: number;
5492
+ }
5493
+
5395
5494
  export declare interface RedactedThinkingContent {
5396
5495
  type: "redacted_thinking";
5397
5496
  data: string;
@@ -5410,6 +5509,9 @@ export declare interface RedactedThinkingContent {
5410
5509
  */
5411
5510
  export declare const REFUSAL_FALLBACK_TEXT = "Sorry \u2014 I wasn't able to generate a response to that. Please try rephrasing or asking in a different way.";
5412
5511
 
5512
+ /** Remove one document from the calling plugin's index. */
5513
+ export declare function removeDocument(documentId: string): Promise<void>;
5514
+
5413
5515
  declare type ResolutionFallbackReason = "missing" | "disabled" | "incomplete";
5414
5516
 
5415
5517
  /**
@@ -5446,7 +5548,9 @@ declare type ResolutionFallbackReason = "missing" | "disabled" | "incomplete";
5446
5548
  * sits at the top of the chain for every call site.
5447
5549
  *
5448
5550
  * Profile names are resolved against the effective profile catalog
5449
- * (code-defined defaults + workspace `llm.profiles`; see `getEffectiveProfile`).
5551
+ * (code-defined defaults + workspace `llm.profiles`), with default profile
5552
+ * keys resolved through `llm.defaultProvider`'s column of the intent ×
5553
+ * provider matrix (see `resolveDefaultProfileForProvider`).
5450
5554
  * A "mix" profile is expanded to one of its arms by a seeded weighted pick (see
5451
5555
  * `resolveProfileFragment` and `opts.selectionSeed`), uniformly wherever a name
5452
5556
  * is dereferenced. Missing references silently fall through (no throw) so the
@@ -5905,12 +6009,19 @@ declare interface SkillInstallMeta {
5905
6009
  * - `workspace`: user-authored skill living in a conversation's working dir.
5906
6010
  * - `extra`: third-party directory roots passed via `loadSkillCatalog`'s
5907
6011
  * `extraDirs` argument (primarily for tests).
5908
- * - `plugin`: shipped on disk inside an installed plugin at
5909
- * `<workspaceDir>/plugins/<name>/skills/<id>/SKILL.md`, attributed back to
5910
- * the owning plugin via its `owner` descriptor.
6012
+ * - `plugin`: shipped on disk inside a plugin: an installed one at
6013
+ * `<workspaceDir>/plugins/<name>/skills/<id>/SKILL.md`, or an in-process
6014
+ * default at `plugins/defaults/<dir>/skills/<id>/SKILL.md`, attributed back
6015
+ * to the owning plugin via its `owner` descriptor.
5911
6016
  */
5912
6017
  declare type SkillSource = "bundled" | "managed" | "workspace" | "extra" | "plugin";
5913
6018
 
6019
+ /** Sparse vector representation: parallel arrays of term indices and weights. */
6020
+ export declare interface SparseEmbedding {
6021
+ indices: number[];
6022
+ values: number[];
6023
+ }
6024
+
5914
6025
  /**
5915
6026
  * The full `stop` context a hook receives — the dispatching call site's
5916
6027
  * {@link StopInputContext} plus the pipeline-stamped {@link BaseHookContext}
@@ -6209,7 +6320,7 @@ export declare interface TextContent {
6209
6320
  text: string;
6210
6321
  }
6211
6322
 
6212
- declare interface TextEmbeddingInput {
6323
+ export declare interface TextEmbeddingInput {
6213
6324
  type: "text";
6214
6325
  text: string;
6215
6326
  }
@@ -6872,7 +6983,7 @@ declare interface UserPromptSubmitInputContext {
6872
6983
  latestMessages: Message[];
6873
6984
  }
6874
6985
 
6875
- declare interface VideoEmbeddingInput {
6986
+ export declare interface VideoEmbeddingInput {
6876
6987
  type: "video";
6877
6988
  data: Buffer;
6878
6989
  mimeType: string;
@@ -6911,7 +7022,7 @@ declare interface WebSearchMetadata {
6911
7022
  errorMessage?: string;
6912
7023
  }
6913
7024
 
6914
- declare type WebSearchProviderId = "anthropic-native" | "brave" | "perplexity" | "tavily" | "firecrawl";
7025
+ declare type WebSearchProviderId = "anthropic-native" | "brave" | "perplexity" | "tavily" | "keenable" | "firecrawl";
6915
7026
 
6916
7027
  declare interface WebSearchResultItem {
6917
7028
  rank: number;
package/index.js CHANGED
@@ -13,16 +13,20 @@ export const buildMessageExcerpt = api.buildMessageExcerpt;
13
13
  export const createLiveVoiceConnection = api.createLiveVoiceConnection;
14
14
  export const deleteConversation = api.deleteConversation;
15
15
  export const doesSupportVision = api.doesSupportVision;
16
+ export const embed = api.embed;
16
17
  export const embedAndUpsert = api.embedAndUpsert;
17
18
  export const extractTextFromStoredMessageContent = api.extractTextFromStoredMessageContent;
19
+ export const generateSparseEmbedding = api.generateSparseEmbedding;
18
20
  export const getAssistantName = api.getAssistantName;
19
21
  export const getConfiguredProvider = api.getConfiguredProvider;
20
22
  export const getConversation = api.getConversation;
21
23
  export const getConversationDirPath = api.getConversationDirPath;
24
+ export const getDocument = api.getDocument;
22
25
  export const getMessages = api.getMessages;
23
26
  export const getModelProfiles = api.getModelProfiles;
24
27
  export const getWorkspaceDir = api.getWorkspaceDir;
25
28
  export const hasLexicalTokens = api.hasLexicalTokens;
29
+ export const indexDocument = api.indexDocument;
26
30
  export const isConversationProcessing = api.isConversationProcessing;
27
31
  export const isMaxTokensStopReason = api.isMaxTokensStopReason;
28
32
  export const isToolResultMessage = api.isToolResultMessage;
@@ -35,6 +39,8 @@ export const openTranscriptionSession = api.openTranscriptionSession;
35
39
  export const parseMessageMetadata = api.parseMessageMetadata;
36
40
  export const publishEvent = api.publishEvent;
37
41
  export const quarantineRefusedExchanges = api.quarantineRefusedExchanges;
42
+ export const queryIndex = api.queryIndex;
43
+ export const removeDocument = api.removeDocument;
38
44
  export const resolveCredential = api.resolveCredential;
39
45
  export const resolveMediaSourceData = api.resolveMediaSourceData;
40
46
  export const resolveUserName = api.resolveUserName;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vellumai/plugin-api",
3
- "version": "0.11.0",
3
+ "version": "0.11.1-staging.2",
4
4
  "description": "Public TypeScript authoring contract for Vellum assistant plugins.",
5
5
  "license": "MIT",
6
6
  "type": "module",