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

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 +122 -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,15 +1901,18 @@ 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;
@@ -2181,6 +2196,7 @@ declare const AssistantEventEnvelopeSchema: z.ZodObject<{
2181
2196
  brave: "brave";
2182
2197
  perplexity: "perplexity";
2183
2198
  tavily: "tavily";
2199
+ keenable: "keenable";
2184
2200
  firecrawl: "firecrawl";
2185
2201
  }>;
2186
2202
  resultCount: z.ZodNumber;
@@ -2762,6 +2778,7 @@ declare const AssistantEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
2762
2778
  requestId: z.ZodString;
2763
2779
  channel: z.ZodOptional<z.ZodString>;
2764
2780
  placeholder: z.ZodOptional<z.ZodString>;
2781
+ defaultValue: z.ZodOptional<z.ZodString>;
2765
2782
  label: z.ZodOptional<z.ZodString>;
2766
2783
  description: z.ZodOptional<z.ZodString>;
2767
2784
  role: z.ZodOptional<z.ZodString>;
@@ -3249,15 +3266,18 @@ declare const AssistantEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
3249
3266
  type: z.ZodLiteral<"message_dequeued">;
3250
3267
  conversationId: z.ZodString;
3251
3268
  requestId: z.ZodString;
3269
+ clientMessageId: z.ZodOptional<z.ZodString>;
3252
3270
  }, z.core.$strip>, z.ZodObject<{
3253
3271
  type: z.ZodLiteral<"message_queued">;
3254
3272
  conversationId: z.ZodString;
3255
3273
  requestId: z.ZodString;
3256
3274
  position: z.ZodNumber;
3275
+ clientMessageId: z.ZodOptional<z.ZodString>;
3257
3276
  }, z.core.$strip>, z.ZodObject<{
3258
3277
  type: z.ZodLiteral<"message_queued_deleted">;
3259
3278
  conversationId: z.ZodString;
3260
3279
  requestId: z.ZodString;
3280
+ clientMessageId: z.ZodOptional<z.ZodString>;
3261
3281
  }, z.core.$strip>, z.ZodObject<{
3262
3282
  type: z.ZodLiteral<"message_request_complete">;
3263
3283
  conversationId: z.ZodString;
@@ -3541,6 +3561,7 @@ declare const AssistantEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
3541
3561
  brave: "brave";
3542
3562
  perplexity: "perplexity";
3543
3563
  tavily: "tavily";
3564
+ keenable: "keenable";
3544
3565
  firecrawl: "firecrawl";
3545
3566
  }>;
3546
3567
  resultCount: z.ZodNumber;
@@ -3735,7 +3756,7 @@ export declare interface AssistantEventSubscription {
3735
3756
  readonly connectionId: string;
3736
3757
  }
3737
3758
 
3738
- declare interface AudioEmbeddingInput {
3759
+ export declare interface AudioEmbeddingInput {
3739
3760
  type: "audio";
3740
3761
  data: Buffer;
3741
3762
  mimeType: string;
@@ -4047,28 +4068,30 @@ declare type DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Om
4047
4068
  */
4048
4069
  export declare function doesSupportVision(modelOrProfile: ModelProfileInfo | string): boolean;
4049
4070
 
4071
+ /**
4072
+ * Embed an input and return the raw dense vector (provider, model, and
4073
+ * dimensions included), with no persistence.
4074
+ */
4075
+ export declare function embed(input: EmbeddingInput): Promise<EmbedResult>;
4076
+
4050
4077
  /** Embed a target and upsert its vector into the vector store. */
4051
4078
  export declare function embedAndUpsert(targetType: EmbeddingTargetType, targetId: string, input: EmbeddingInput, extraPayload?: Record<string, unknown>): Promise<void>;
4052
4079
 
4053
4080
  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
4081
 
4055
4082
  /** Accepts raw strings as shorthand for text inputs. */
4056
- declare type EmbeddingInput = string | MultimodalEmbeddingInput;
4083
+ export declare type EmbeddingInput = string | MultimodalEmbeddingInput;
4057
4084
 
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
4085
  declare type EmbeddingTargetType = Parameters<embedAndUpsert_2>[1];
4071
4086
 
4087
+ /** A computed embedding with the provider/model that produced it. */
4088
+ export declare interface EmbedResult {
4089
+ vector: number[];
4090
+ provider: string;
4091
+ model: string;
4092
+ dimensions: number;
4093
+ }
4094
+
4072
4095
  export declare function extractTextFromStoredMessageContent(raw: string | ContentBlock[]): string;
4073
4096
 
4074
4097
  export declare interface FileContent {
@@ -4086,6 +4109,12 @@ export declare interface FileContent {
4086
4109
  _attachmentId?: string;
4087
4110
  }
4088
4111
 
4112
+ /**
4113
+ * Generate the sparse (lexical) vector for a text using the host's shared
4114
+ * encoder. Pure and local: no backend call, no persistence.
4115
+ */
4116
+ export declare function generateSparseEmbedding(text: string): Promise<SparseEmbedding>;
4117
+
4089
4118
  /** Read the assistant's name from IDENTITY.md for personalized responses. */
4090
4119
  export declare function getAssistantName(): string | null;
4091
4120
 
@@ -4108,6 +4137,9 @@ export declare function getConversation(id: string): Promise<ConversationRow | n
4108
4137
  */
4109
4138
  export declare function getConversationDirPath(id: string, createdAtMs: number): Promise<string>;
4110
4139
 
4140
+ /** Fetch one document from the calling plugin's index, or null. */
4141
+ export declare function getDocument(documentId: string): Promise<IndexedDocument | null>;
4142
+
4111
4143
  /** All messages of a conversation in insertion order. */
4112
4144
  export declare function getMessages(conversationId: string): Promise<MessageRow[]>;
4113
4145
 
@@ -4254,12 +4286,57 @@ export declare interface ImageContent {
4254
4286
  source: MediaSource_2;
4255
4287
  }
4256
4288
 
4257
- declare interface ImageEmbeddingInput {
4289
+ export declare interface ImageEmbeddingInput {
4258
4290
  type: "image";
4259
4291
  data: Buffer;
4260
4292
  mimeType: string;
4261
4293
  }
4262
4294
 
4295
+ /**
4296
+ * Embed and upsert a document into the calling plugin's private index (not
4297
+ * agent recall). Returns the document id. Pass `opts.documentId` to overwrite
4298
+ * an existing document in place.
4299
+ */
4300
+ export declare function indexDocument(input: EmbeddingInput, opts?: IndexDocumentOptions): Promise<IndexDocumentResult>;
4301
+
4302
+ export declare interface IndexDocumentOptions {
4303
+ /**
4304
+ * Reuse a caller-owned id to upsert a document in place (the update path:
4305
+ * same id, overwrite). Omit to have the host mint a fresh document id.
4306
+ */
4307
+ documentId?: string;
4308
+ /**
4309
+ * Opaque provenance carried with the document (e.g. `{ rowId, fileId }`).
4310
+ * Round-tripped verbatim on query/get; never interpreted by the host.
4311
+ */
4312
+ metadata?: Record<string, unknown>;
4313
+ /** Override the stored creation timestamp (defaults to now). */
4314
+ createdAt?: number;
4315
+ }
4316
+
4317
+ export declare interface IndexDocumentResult {
4318
+ documentId: string;
4319
+ provider: string;
4320
+ model: string;
4321
+ dimensions: number;
4322
+ }
4323
+
4324
+ export declare interface IndexedDocument {
4325
+ documentId: string;
4326
+ text: string;
4327
+ modality: "text" | "image" | "audio" | "video";
4328
+ metadata?: Record<string, unknown>;
4329
+ createdAt: number;
4330
+ }
4331
+
4332
+ export declare interface IndexHit {
4333
+ documentId: string;
4334
+ score: number;
4335
+ text: string;
4336
+ modality: "text" | "image" | "audio" | "video";
4337
+ metadata?: Record<string, unknown>;
4338
+ }
4339
+
4263
4340
  /**
4264
4341
  * Context passed to `Plugin.init()` during bootstrap. Carries the resolved
4265
4342
  * config, a pino-compatible logger scoped to the plugin, a per-plugin
@@ -4840,7 +4917,7 @@ export declare interface ModelProfileInfo {
4840
4917
  readonly isMix: boolean;
4841
4918
  }
4842
4919
 
4843
- declare type MultimodalEmbeddingInput = TextEmbeddingInput | ImageEmbeddingInput | AudioEmbeddingInput | VideoEmbeddingInput;
4920
+ export declare type MultimodalEmbeddingInput = TextEmbeddingInput | ImageEmbeddingInput | AudioEmbeddingInput | VideoEmbeddingInput;
4844
4921
 
4845
4922
  /**
4846
4923
  * Open a streaming transcription session against the configured STT provider
@@ -5392,6 +5469,16 @@ export declare function quarantineRefusedExchanges(messages: Message[]): {
5392
5469
  droppedExchanges: number;
5393
5470
  };
5394
5471
 
5472
+ /** Hybrid semantic search over the calling plugin's index only. */
5473
+ export declare function queryIndex(query: EmbeddingInput, opts?: QueryIndexOptions): Promise<IndexHit[]>;
5474
+
5475
+ export declare interface QueryIndexOptions {
5476
+ /** Max hits to return. Defaults to 10. */
5477
+ limit?: number;
5478
+ /** Per-branch prefetch depth for the hybrid fusion. */
5479
+ prefetchLimit?: number;
5480
+ }
5481
+
5395
5482
  export declare interface RedactedThinkingContent {
5396
5483
  type: "redacted_thinking";
5397
5484
  data: string;
@@ -5410,6 +5497,9 @@ export declare interface RedactedThinkingContent {
5410
5497
  */
5411
5498
  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
5499
 
5500
+ /** Remove one document from the calling plugin's index. */
5501
+ export declare function removeDocument(documentId: string): Promise<void>;
5502
+
5413
5503
  declare type ResolutionFallbackReason = "missing" | "disabled" | "incomplete";
5414
5504
 
5415
5505
  /**
@@ -5446,7 +5536,9 @@ declare type ResolutionFallbackReason = "missing" | "disabled" | "incomplete";
5446
5536
  * sits at the top of the chain for every call site.
5447
5537
  *
5448
5538
  * Profile names are resolved against the effective profile catalog
5449
- * (code-defined defaults + workspace `llm.profiles`; see `getEffectiveProfile`).
5539
+ * (code-defined defaults + workspace `llm.profiles`), with default profile
5540
+ * keys resolved through `llm.defaultProvider`'s column of the intent ×
5541
+ * provider matrix (see `resolveDefaultProfileForProvider`).
5450
5542
  * A "mix" profile is expanded to one of its arms by a seeded weighted pick (see
5451
5543
  * `resolveProfileFragment` and `opts.selectionSeed`), uniformly wherever a name
5452
5544
  * is dereferenced. Missing references silently fall through (no throw) so the
@@ -5905,12 +5997,19 @@ declare interface SkillInstallMeta {
5905
5997
  * - `workspace`: user-authored skill living in a conversation's working dir.
5906
5998
  * - `extra`: third-party directory roots passed via `loadSkillCatalog`'s
5907
5999
  * `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.
6000
+ * - `plugin`: shipped on disk inside a plugin: an installed one at
6001
+ * `<workspaceDir>/plugins/<name>/skills/<id>/SKILL.md`, or an in-process
6002
+ * default at `plugins/defaults/<dir>/skills/<id>/SKILL.md`, attributed back
6003
+ * to the owning plugin via its `owner` descriptor.
5911
6004
  */
5912
6005
  declare type SkillSource = "bundled" | "managed" | "workspace" | "extra" | "plugin";
5913
6006
 
6007
+ /** Sparse vector representation: parallel arrays of term indices and weights. */
6008
+ export declare interface SparseEmbedding {
6009
+ indices: number[];
6010
+ values: number[];
6011
+ }
6012
+
5914
6013
  /**
5915
6014
  * The full `stop` context a hook receives — the dispatching call site's
5916
6015
  * {@link StopInputContext} plus the pipeline-stamped {@link BaseHookContext}
@@ -6209,7 +6308,7 @@ export declare interface TextContent {
6209
6308
  text: string;
6210
6309
  }
6211
6310
 
6212
- declare interface TextEmbeddingInput {
6311
+ export declare interface TextEmbeddingInput {
6213
6312
  type: "text";
6214
6313
  text: string;
6215
6314
  }
@@ -6872,7 +6971,7 @@ declare interface UserPromptSubmitInputContext {
6872
6971
  latestMessages: Message[];
6873
6972
  }
6874
6973
 
6875
- declare interface VideoEmbeddingInput {
6974
+ export declare interface VideoEmbeddingInput {
6876
6975
  type: "video";
6877
6976
  data: Buffer;
6878
6977
  mimeType: string;
@@ -6911,7 +7010,7 @@ declare interface WebSearchMetadata {
6911
7010
  errorMessage?: string;
6912
7011
  }
6913
7012
 
6914
- declare type WebSearchProviderId = "anthropic-native" | "brave" | "perplexity" | "tavily" | "firecrawl";
7013
+ declare type WebSearchProviderId = "anthropic-native" | "brave" | "perplexity" | "tavily" | "keenable" | "firecrawl";
6915
7014
 
6916
7015
  declare interface WebSearchResultItem {
6917
7016
  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.1",
4
4
  "description": "Public TypeScript authoring contract for Vellum assistant plugins.",
5
5
  "license": "MIT",
6
6
  "type": "module",