@vellumai/plugin-api 0.11.0-dev.202607310515.26a4155 → 0.11.0-dev.202607311245.e354912

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 +93 -18
  2. package/index.js +6 -0
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -3756,7 +3756,7 @@ export declare interface AssistantEventSubscription {
3756
3756
  readonly connectionId: string;
3757
3757
  }
3758
3758
 
3759
- declare interface AudioEmbeddingInput {
3759
+ export declare interface AudioEmbeddingInput {
3760
3760
  type: "audio";
3761
3761
  data: Buffer;
3762
3762
  mimeType: string;
@@ -4068,28 +4068,30 @@ declare type DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Om
4068
4068
  */
4069
4069
  export declare function doesSupportVision(modelOrProfile: ModelProfileInfo | string): boolean;
4070
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
+
4071
4077
  /** Embed a target and upsert its vector into the vector store. */
4072
4078
  export declare function embedAndUpsert(targetType: EmbeddingTargetType, targetId: string, input: EmbeddingInput, extraPayload?: Record<string, unknown>): Promise<void>;
4073
4079
 
4074
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>;
4075
4081
 
4076
4082
  /** Accepts raw strings as shorthand for text inputs. */
4077
- declare type EmbeddingInput = string | MultimodalEmbeddingInput;
4083
+ export declare type EmbeddingInput = string | MultimodalEmbeddingInput;
4078
4084
 
4079
- /**
4080
- * Plugin-facing facade over the embeddings subsystem: self-contained
4081
- * operations that resolve the live workspace config internally, so callers
4082
- * (plugins importing via `@vellumai/plugin-api`) hold no host config.
4083
- *
4084
- * The operations are loaded via dynamic `import()` inside each wrapper so
4085
- * that importing this module — which every `@vellumai/plugin-api` consumer
4086
- * does transitively — does not eagerly pull the embed/vector import graph
4087
- * (`job-utils`, `embedding-backend`). An eager pull would force those
4088
- * modules' named exports to resolve at instantiation, which breaks the
4089
- * intentional partial module mocks in tests.
4090
- */
4091
4085
  declare type EmbeddingTargetType = Parameters<embedAndUpsert_2>[1];
4092
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
+
4093
4095
  export declare function extractTextFromStoredMessageContent(raw: string | ContentBlock[]): string;
4094
4096
 
4095
4097
  export declare interface FileContent {
@@ -4107,6 +4109,12 @@ export declare interface FileContent {
4107
4109
  _attachmentId?: string;
4108
4110
  }
4109
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
+
4110
4118
  /** Read the assistant's name from IDENTITY.md for personalized responses. */
4111
4119
  export declare function getAssistantName(): string | null;
4112
4120
 
@@ -4129,6 +4137,9 @@ export declare function getConversation(id: string): Promise<ConversationRow | n
4129
4137
  */
4130
4138
  export declare function getConversationDirPath(id: string, createdAtMs: number): Promise<string>;
4131
4139
 
4140
+ /** Fetch one document from the calling plugin's index, or null. */
4141
+ export declare function getDocument(documentId: string): Promise<IndexedDocument | null>;
4142
+
4132
4143
  /** All messages of a conversation in insertion order. */
4133
4144
  export declare function getMessages(conversationId: string): Promise<MessageRow[]>;
4134
4145
 
@@ -4275,12 +4286,57 @@ export declare interface ImageContent {
4275
4286
  source: MediaSource_2;
4276
4287
  }
4277
4288
 
4278
- declare interface ImageEmbeddingInput {
4289
+ export declare interface ImageEmbeddingInput {
4279
4290
  type: "image";
4280
4291
  data: Buffer;
4281
4292
  mimeType: string;
4282
4293
  }
4283
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
+
4284
4340
  /**
4285
4341
  * Context passed to `Plugin.init()` during bootstrap. Carries the resolved
4286
4342
  * config, a pino-compatible logger scoped to the plugin, a per-plugin
@@ -4861,7 +4917,7 @@ export declare interface ModelProfileInfo {
4861
4917
  readonly isMix: boolean;
4862
4918
  }
4863
4919
 
4864
- declare type MultimodalEmbeddingInput = TextEmbeddingInput | ImageEmbeddingInput | AudioEmbeddingInput | VideoEmbeddingInput;
4920
+ export declare type MultimodalEmbeddingInput = TextEmbeddingInput | ImageEmbeddingInput | AudioEmbeddingInput | VideoEmbeddingInput;
4865
4921
 
4866
4922
  /**
4867
4923
  * Open a streaming transcription session against the configured STT provider
@@ -5413,6 +5469,16 @@ export declare function quarantineRefusedExchanges(messages: Message[]): {
5413
5469
  droppedExchanges: number;
5414
5470
  };
5415
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
+
5416
5482
  export declare interface RedactedThinkingContent {
5417
5483
  type: "redacted_thinking";
5418
5484
  data: string;
@@ -5431,6 +5497,9 @@ export declare interface RedactedThinkingContent {
5431
5497
  */
5432
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.";
5433
5499
 
5500
+ /** Remove one document from the calling plugin's index. */
5501
+ export declare function removeDocument(documentId: string): Promise<void>;
5502
+
5434
5503
  declare type ResolutionFallbackReason = "missing" | "disabled" | "incomplete";
5435
5504
 
5436
5505
  /**
@@ -5935,6 +6004,12 @@ declare interface SkillInstallMeta {
5935
6004
  */
5936
6005
  declare type SkillSource = "bundled" | "managed" | "workspace" | "extra" | "plugin";
5937
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
+
5938
6013
  /**
5939
6014
  * The full `stop` context a hook receives — the dispatching call site's
5940
6015
  * {@link StopInputContext} plus the pipeline-stamped {@link BaseHookContext}
@@ -6233,7 +6308,7 @@ export declare interface TextContent {
6233
6308
  text: string;
6234
6309
  }
6235
6310
 
6236
- declare interface TextEmbeddingInput {
6311
+ export declare interface TextEmbeddingInput {
6237
6312
  type: "text";
6238
6313
  text: string;
6239
6314
  }
@@ -6896,7 +6971,7 @@ declare interface UserPromptSubmitInputContext {
6896
6971
  latestMessages: Message[];
6897
6972
  }
6898
6973
 
6899
- declare interface VideoEmbeddingInput {
6974
+ export declare interface VideoEmbeddingInput {
6900
6975
  type: "video";
6901
6976
  data: Buffer;
6902
6977
  mimeType: string;
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-dev.202607310515.26a4155",
3
+ "version": "0.11.0-dev.202607311245.e354912",
4
4
  "description": "Public TypeScript authoring contract for Vellum assistant plugins.",
5
5
  "license": "MIT",
6
6
  "type": "module",