@vellumai/plugin-api 0.9.1-staging.1 → 0.10.0-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 +283 -6
  2. package/index.js +1 -0
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -808,7 +808,6 @@ declare interface ContactChannelPayload {
808
808
  type: string;
809
809
  address: string;
810
810
  isPrimary: boolean;
811
- externalUserId?: string;
812
811
  status: string;
813
812
  policy: string;
814
813
  verifiedAt?: number;
@@ -1470,6 +1469,19 @@ declare const GenerationHandoffEventSchema: z.ZodObject<{
1470
1469
  attachmentWarnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
1471
1470
  }, z.core.$strip>;
1472
1471
 
1472
+ /**
1473
+ * Resolve the configured provider through the registry.
1474
+ * Thin wrapper around `resolveConfiguredProvider()` for callsites
1475
+ * that only need the Provider instance.
1476
+ *
1477
+ * `callSite` is required — see `resolveConfiguredProvider`. Returns `null`
1478
+ * when no providers are available.
1479
+ */
1480
+ export declare function getConfiguredProvider(callSite: LLMCallSite, opts?: {
1481
+ overrideProfile?: string;
1482
+ forceOverrideProfile?: boolean;
1483
+ }): Promise<Provider | null>;
1484
+
1473
1485
  /**
1474
1486
  * List the workspace inference profiles a plugin can route to, in the order the
1475
1487
  * `/model` picker presents them (`llm.profileOrder` first, then the rest
@@ -2124,7 +2136,7 @@ declare interface ListSurfaceData {
2124
2136
  selectionMode: "single" | "multiple" | "none";
2125
2137
  }
2126
2138
 
2127
- declare type LLMCallSite = z.infer<typeof LLMCallSiteEnum>;
2139
+ export declare type LLMCallSite = z.infer<typeof LLMCallSiteEnum>;
2128
2140
 
2129
2141
  /**
2130
2142
  * The complete set of LLM call-site identifiers the assistant emits.
@@ -2172,6 +2184,7 @@ declare const LLMCallSiteEnum: z.ZodEnum<{
2172
2184
  meetConsentMonitor: "meetConsentMonitor";
2173
2185
  meetChatOpportunity: "meetChatOpportunity";
2174
2186
  inference: "inference";
2187
+ advisor: "advisor";
2175
2188
  trustRuleSuggestion: "trustRuleSuggestion";
2176
2189
  homeGreeting: "homeGreeting";
2177
2190
  homeSuggestedPrompts: "homeSuggestedPrompts";
@@ -3021,6 +3034,83 @@ declare interface ProcessEntry extends BaseSubscriberEntry {
3021
3034
  type: "process";
3022
3035
  }
3023
3036
 
3037
+ export declare interface Provider {
3038
+ name: string;
3039
+ /**
3040
+ * Provider key used by the local token estimator to select model-family
3041
+ * specific rules (e.g. Anthropic's `width * height / 750` image sizing).
3042
+ * Wrapper providers that route to another provider's API — e.g. OpenRouter
3043
+ * calling Anthropic's Messages endpoint for `anthropic/*` models — override
3044
+ * this so the estimator matches what the upstream API will actually charge.
3045
+ * Falls back to `name` when unset.
3046
+ */
3047
+ tokenEstimationProvider?: string;
3048
+ sendMessage(messages: Message[], options?: SendMessageOptions): Promise<ProviderResponse>;
3049
+ }
3050
+
3051
+ export declare type ProviderEvent = {
3052
+ type: "text_delta";
3053
+ text: string;
3054
+ } | {
3055
+ type: "thinking_delta";
3056
+ thinking: string;
3057
+ } | {
3058
+ type: "tool_use_preview_start";
3059
+ toolUseId: string;
3060
+ toolName: string;
3061
+ } | {
3062
+ type: "input_json_delta";
3063
+ toolName: string;
3064
+ toolUseId: string;
3065
+ accumulatedJson: string;
3066
+ } | {
3067
+ type: "server_tool_start";
3068
+ name: string;
3069
+ toolUseId: string;
3070
+ input: Record<string, unknown>;
3071
+ } | {
3072
+ type: "server_tool_complete";
3073
+ toolUseId: string;
3074
+ isError: boolean;
3075
+ content?: unknown[];
3076
+ /**
3077
+ * Finalized input for the server tool call (e.g. the actual query).
3078
+ * Anthropic streams `server_tool_use` block input via `input_json_delta`
3079
+ * events, so consumers reading the input at `server_tool_start` see `{}`.
3080
+ * The provider accumulates the JSON and surfaces it here once the block
3081
+ * stops, so downstream handlers can build accurate activity metadata.
3082
+ */
3083
+ resolvedInput?: Record<string, unknown>;
3084
+ /**
3085
+ * Provider-specific error code when `isError` is true (e.g. Anthropic's
3086
+ * `max_uses_exceeded`, `query_too_long`). Surfaced so user-facing
3087
+ * messages can be specific instead of a generic "Search failed".
3088
+ */
3089
+ errorCode?: string;
3090
+ /** Optional human-readable error message from the provider. */
3091
+ errorMessage?: string;
3092
+ };
3093
+
3094
+ export declare interface ProviderResponse {
3095
+ content: ContentBlock[];
3096
+ model: string;
3097
+ /** Provider that actually produced this response, which may differ from a wrapper provider name. */
3098
+ actualProvider?: string;
3099
+ usage: {
3100
+ /** Total input tokens (input_tokens + cache_creation + cache_read). */
3101
+ inputTokens: number;
3102
+ outputTokens: number;
3103
+ cacheCreationInputTokens?: number;
3104
+ cacheReadInputTokens?: number;
3105
+ reasoningTokens?: number;
3106
+ };
3107
+ stopReason: string;
3108
+ /** Raw JSON request body sent to the provider (for diagnostics logging). */
3109
+ rawRequest?: unknown;
3110
+ /** Raw JSON response body received from the provider (for diagnostics logging). */
3111
+ rawResponse?: unknown;
3112
+ }
3113
+
3024
3114
  /** Callback for proxy policy decisions requiring user confirmation. Returns true if approved. */
3025
3115
  declare type ProxyApprovalCallback = (request: ProxyApprovalRequest) => Promise<boolean>;
3026
3116
 
@@ -3226,6 +3316,96 @@ declare const SecretRequestEventSchema: z.ZodObject<{
3226
3316
  allowOneTimeSend: z.ZodOptional<z.ZodBoolean>;
3227
3317
  }, z.core.$strip>;
3228
3318
 
3319
+ export declare interface SendMessageConfig {
3320
+ model?: string;
3321
+ /**
3322
+ * LLM call-site identifier. `RetryProvider` resolves
3323
+ * provider/model/maxTokens/effort/speed/verbosity/temperature/thinking/
3324
+ * contextWindow via `resolveCallSiteConfig(callSite, config.llm)`, falling
3325
+ * back to `llm.default` when no callSite-specific entry is present.
3326
+ */
3327
+ callSite?: LLMCallSite;
3328
+ /**
3329
+ * Optional ad-hoc profile override applied per request. When set, the
3330
+ * resolver layers `llm.profiles[overrideProfile]` between the workspace's
3331
+ * `activeProfile` and the call-site's named profile (see
3332
+ * `resolveCallSiteConfig`). Used by per-conversation pinned profiles to
3333
+ * override the workspace default for a single send. Missing profile names
3334
+ * silently fall through.
3335
+ */
3336
+ overrideProfile?: string;
3337
+ /**
3338
+ * When true, the resolver floats `overrideProfile` above the call-site
3339
+ * layers (named site profile + call-site override) for non-main-agent call
3340
+ * sites — see `ResolveCallSiteOpts.forceOverrideProfile`. Used by callers
3341
+ * that must run a background call site under a specific conversation's
3342
+ * inference profile (e.g. fork-based memory retrospectives). A
3343
+ * resolution/routing-time concern only; stripped before any provider wire
3344
+ * request.
3345
+ */
3346
+ forceOverrideProfile?: boolean;
3347
+ /**
3348
+ * Per-conversation seed for deterministic `mix`-profile expansion. The agent
3349
+ * loop sets this to the conversation id so every resolver call this send
3350
+ * triggers — provider/transport selection, wire-param normalization, usage
3351
+ * attribution — picks the same mix constituent, stable across the
3352
+ * conversation's turns and retries. A resolution/routing-time concern only;
3353
+ * stripped before any provider wire request.
3354
+ */
3355
+ selectionSeed?: string;
3356
+ /**
3357
+ * Internal per-request HTTP headers for managed-proxy usage attribution.
3358
+ * Provider clients may pass these through SDK request options only when the
3359
+ * transport is Vellum-managed, and must never include this object in provider
3360
+ * JSON request bodies.
3361
+ */
3362
+ usageAttributionHeaders?: Record<string, string>;
3363
+ /**
3364
+ * Controls local usage-ledger writes for attributed provider calls.
3365
+ * Defaults to `auto`; conversation paths that aggregate usage separately
3366
+ * set `manual` to avoid double-counting.
3367
+ */
3368
+ usageTracking?: "auto" | "manual";
3369
+ effort?: "none" | "low" | "medium" | "high" | "xhigh" | "max";
3370
+ speed?: "standard" | "fast";
3371
+ verbosity?: "low" | "medium" | "high";
3372
+ /**
3373
+ * Wire-format `logit_bias` map (`{ "<tokenId>": bias }`). Set by
3374
+ * `RetryProvider` from a profile's `logitBias` preset and forwarded only on
3375
+ * the OpenAI-compatible (Fireworks) path; other providers ignore it.
3376
+ */
3377
+ logit_bias?: Record<string, number>;
3378
+ /**
3379
+ * When true, the most recent user message's content varies across
3380
+ * otherwise-identical turns (e.g. a per-turn memory block was injected into
3381
+ * it). The provider places the primary long-TTL cache breakpoint on the most
3382
+ * recent *stable* user message instead of the volatile latest one, so the
3383
+ * cached prefix stays reusable across turns. Default false — existing
3384
+ * behavior.
3385
+ */
3386
+ mutableLatestUserMessage?: boolean;
3387
+ /**
3388
+ * When true, the provider sends no prompt-cache breakpoints at all (and
3389
+ * strips any block-level `cache_control` markers callers stamped on
3390
+ * messages). For one-shot call sites whose prompts are unique per call or
3391
+ * whose call cadence exceeds the cache TTL, every breakpoint is a paid
3392
+ * cache write that will never be read — opting out saves the write
3393
+ * premium. Resolved per call site via `resolveCallSiteConfig` (see
3394
+ * `disableCache` in the LLM config schema); a per-call explicit value
3395
+ * wins. Default false — existing behavior.
3396
+ */
3397
+ disableCache?: boolean;
3398
+ [key: string]: unknown;
3399
+ }
3400
+
3401
+ export declare interface SendMessageOptions {
3402
+ tools?: ToolDefinition_2[];
3403
+ systemPrompt?: string;
3404
+ config?: SendMessageConfig;
3405
+ onEvent?: (event: ProviderEvent) => void;
3406
+ signal?: AbortSignal;
3407
+ }
3408
+
3229
3409
  declare interface SensitiveOutputBinding {
3230
3410
  kind: SensitiveOutputKind;
3231
3411
  placeholder: string;
@@ -3773,6 +3953,12 @@ export declare interface ToolContext {
3773
3953
  */
3774
3954
  export declare type ToolDefinition = z.infer<typeof ToolDefinitionSchema>;
3775
3955
 
3956
+ declare interface ToolDefinition_2 {
3957
+ name: string;
3958
+ description: string;
3959
+ input_schema: object;
3960
+ }
3961
+
3776
3962
  /**
3777
3963
  * Schema describing the shape of a {@link ToolDefinition}. All fields are
3778
3964
  * optional — loaders fill documented defaults for omitted fields via
@@ -4118,6 +4304,7 @@ declare const ToolResultEventSchema: z.ZodObject<{
4118
4304
  brave: "brave";
4119
4305
  perplexity: "perplexity";
4120
4306
  tavily: "tavily";
4307
+ firecrawl: "firecrawl";
4121
4308
  }>;
4122
4309
  resultCount: z.ZodNumber;
4123
4310
  durationMs: z.ZodNumber;
@@ -4136,6 +4323,10 @@ declare const ToolResultEventSchema: z.ZodObject<{
4136
4323
  webFetch: z.ZodOptional<z.ZodObject<{
4137
4324
  url: z.ZodString;
4138
4325
  finalUrl: z.ZodString;
4326
+ provider: z.ZodOptional<z.ZodEnum<{
4327
+ default: "default";
4328
+ firecrawl: "firecrawl";
4329
+ }>>;
4139
4330
  status: z.ZodNumber;
4140
4331
  contentType: z.ZodOptional<z.ZodString>;
4141
4332
  byteCount: z.ZodNumber;
@@ -4233,11 +4424,15 @@ declare const TraceEventSchema: z.ZodObject<{
4233
4424
  * - `'trusted_contact'`: The sender is an active contact with a channel
4234
4425
  * (not the guardian). Trusted contacts can invoke tools but require
4235
4426
  * guardian approval for sensitive operations.
4427
+ * - `'unverified_contact'`: The sender matches a contact channel whose
4428
+ * status is `pending` or `unverified` — known to the guardian but not yet
4429
+ * verified. Treated identically to `trusted_contact` for every downstream
4430
+ * capability/tool/approval decision; the distinction is admission-only.
4236
4431
  * - `'unknown'`: The sender has no contact record, no identity could be
4237
- * established, or the sender is an inactive/revoked contact. Unknown
4432
+ * established, or the sender is a blocked/revoked contact. Unknown
4238
4433
  * actors are fail-closed with no escalation path.
4239
4434
  */
4240
- declare type TrustClass = "guardian" | "trusted_contact" | "unknown";
4435
+ declare type TrustClass = "guardian" | "trusted_contact" | "unverified_contact" | "unknown";
4241
4436
 
4242
4437
  declare type TurnProfileAutoRoutedEvent = z.infer<typeof TurnProfileAutoRoutedEventSchema>;
4243
4438
 
@@ -4560,6 +4755,8 @@ declare interface VercelApiConfigResponse {
4560
4755
  declare interface WebFetchMetadata {
4561
4756
  url: string;
4562
4757
  finalUrl: string;
4758
+ /** Provider that served the fetch. Defaults to the built-in fetcher. */
4759
+ provider?: WebFetchProviderId;
4563
4760
  status: number;
4564
4761
  contentType?: string;
4565
4762
  byteCount: number;
@@ -4575,6 +4772,9 @@ declare interface WebFetchMetadata {
4575
4772
  mayRequireJavaScript?: boolean;
4576
4773
  }
4577
4774
 
4775
+ /** Provider that backed a `web_fetch` call. `default` is the built-in fetcher. */
4776
+ declare type WebFetchProviderId = "default" | "firecrawl";
4777
+
4578
4778
  declare interface WebSearchMetadata {
4579
4779
  query: string;
4580
4780
  provider: WebSearchProviderId;
@@ -4585,7 +4785,7 @@ declare interface WebSearchMetadata {
4585
4785
  errorMessage?: string;
4586
4786
  }
4587
4787
 
4588
- declare type WebSearchProviderId = "anthropic-native" | "brave" | "perplexity" | "tavily";
4788
+ declare type WebSearchProviderId = "anthropic-native" | "brave" | "perplexity" | "tavily" | "firecrawl";
4589
4789
 
4590
4790
  declare interface WebSearchResultItem {
4591
4791
  rank: number;
@@ -4612,6 +4812,13 @@ export declare interface WebSearchToolResultContent {
4612
4812
  declare interface WorkflowCompleted {
4613
4813
  type: "workflow_completed";
4614
4814
  runId: string;
4815
+ /**
4816
+ * Originating conversation id, when launched from one; lets `broadcastMessage`
4817
+ * auto-scope + seq-stamp the event to that conversation's SSE stream. Omitted
4818
+ * for a conversationless run (e.g. a scheduled workflow), which broadcasts
4819
+ * unscoped for raw SSE listeners and the DB record.
4820
+ */
4821
+ conversationId?: string;
4615
4822
  status: WorkflowRunStatus;
4616
4823
  agentsSpawned: number;
4617
4824
  inputTokens: number;
@@ -4620,6 +4827,49 @@ declare interface WorkflowCompleted {
4620
4827
  summary?: string;
4621
4828
  }
4622
4829
 
4830
+ /**
4831
+ * A leaf agent within a workflow run has finished. `seq` matches the
4832
+ * corresponding `workflow_leaf_started` event.
4833
+ */
4834
+ declare interface WorkflowLeafFinished {
4835
+ type: "workflow_leaf_finished";
4836
+ runId: string;
4837
+ /**
4838
+ * Originating conversation id; lets `broadcastMessage` auto-scope +
4839
+ * seq-stamp the event to the conversation's SSE stream.
4840
+ */
4841
+ conversationId: string;
4842
+ seq: number;
4843
+ status: "completed" | "failed";
4844
+ /** Leaf label, for client display. */
4845
+ label?: string;
4846
+ inputTokens?: number;
4847
+ outputTokens?: number;
4848
+ /** Short summary of the leaf's result, for client display. */
4849
+ resultSummary?: string;
4850
+ }
4851
+
4852
+ /**
4853
+ * A leaf agent within a workflow run has started. `seq` orders leaves within
4854
+ * the run for stable client-side tree placement.
4855
+ */
4856
+ declare interface WorkflowLeafStarted {
4857
+ type: "workflow_leaf_started";
4858
+ runId: string;
4859
+ /**
4860
+ * Originating conversation id; lets `broadcastMessage` auto-scope +
4861
+ * seq-stamp the event to the conversation's SSE stream.
4862
+ */
4863
+ conversationId: string;
4864
+ seq: number;
4865
+ /** Leaf label, for client display. */
4866
+ label?: string;
4867
+ /** Phase the leaf belongs to, when the workflow declares phases. */
4868
+ phase?: string;
4869
+ /** Short summary of the leaf's prompt, for client display. */
4870
+ promptSummary?: string;
4871
+ }
4872
+
4623
4873
  /**
4624
4874
  * Progress push for an in-flight workflow run. Maps the engine's
4625
4875
  * `onProgress` (`phase`/`log`) callback plus the current usage snapshot into a
@@ -4629,6 +4879,13 @@ declare interface WorkflowCompleted {
4629
4879
  declare interface WorkflowProgress {
4630
4880
  type: "workflow_progress";
4631
4881
  runId: string;
4882
+ /**
4883
+ * Originating conversation id, when launched from one; lets `broadcastMessage`
4884
+ * auto-scope + seq-stamp the event to that conversation's SSE stream. Omitted
4885
+ * for a conversationless run (e.g. a scheduled workflow), which broadcasts
4886
+ * unscoped for raw SSE listeners and the DB record.
4887
+ */
4888
+ conversationId?: string;
4632
4889
  /** Latest phase title, when this emission came from a `phase(...)` call. */
4633
4890
  phase?: string;
4634
4891
  /** Run label (the workflow's `meta.name`), for client display. */
@@ -4656,7 +4913,27 @@ declare interface WorkflowProgress {
4656
4913
  */
4657
4914
  declare type WorkflowRunStatus = "running" | "completed" | "failed" | "aborted" | "cap_exceeded" | "interrupted";
4658
4915
 
4659
- declare type _WorkflowsServerMessages = WorkflowProgress | WorkflowCompleted;
4916
+ declare type _WorkflowsServerMessages = WorkflowProgress | WorkflowCompleted | WorkflowStarted | WorkflowLeafStarted | WorkflowLeafFinished;
4917
+
4918
+ /**
4919
+ * A workflow run has started. Emitted once at launch, before any leaf events.
4920
+ */
4921
+ declare interface WorkflowStarted {
4922
+ type: "workflow_started";
4923
+ runId: string;
4924
+ /**
4925
+ * Originating conversation id; lets `broadcastMessage` auto-scope +
4926
+ * seq-stamp the event to the conversation's SSE stream.
4927
+ */
4928
+ conversationId: string;
4929
+ /**
4930
+ * Tool-use id of the `skill_execute` block that launched this run, for
4931
+ * anchoring the inline workflow card to the exact spawn tool call.
4932
+ */
4933
+ toolUseId?: string;
4934
+ /** Run label (the workflow's `meta.name`), for client display. */
4935
+ label?: string;
4936
+ }
4660
4937
 
4661
4938
  declare interface WorkItemApprovePermissionsResponse {
4662
4939
  type: "work_item_approve_permissions_response";
package/index.js CHANGED
@@ -3,5 +3,6 @@ const api = globalThis[Symbol.for("vellum.plugin-api")] ?? {};
3
3
  export const HOOKS = api.HOOKS;
4
4
  export const RiskLevel = api.RiskLevel;
5
5
  export const assistantEventHub = api.assistantEventHub;
6
+ export const getConfiguredProvider = api.getConfiguredProvider;
6
7
  export const getModelProfiles = api.getModelProfiles;
7
8
  export const getSecureKeyAsync = api.getSecureKeyAsync;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vellumai/plugin-api",
3
- "version": "0.9.1-staging.1",
3
+ "version": "0.10.0-staging.1",
4
4
  "description": "Public TypeScript authoring contract for Vellum assistant plugins.",
5
5
  "license": "MIT",
6
6
  "type": "module",