@vellumai/plugin-api 0.9.1-staging.1 → 0.10.0-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 +291 -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;
@@ -3754,6 +3934,14 @@ export declare interface ToolContext {
3754
3934
  * `executeSubagentSpawn` in tools/subagent/spawn.ts.
3755
3935
  */
3756
3936
  overrideProfile?: string;
3937
+ /**
3938
+ * The LLM call site of the turn currently executing this tool (`mainAgent`,
3939
+ * `heartbeatAgent`, scheduled work, etc.). `subagent_spawn` reads it to
3940
+ * default a spawned subagent's inference profile to the profile the invoking
3941
+ * turn resolved to, so subagents match whatever agent invoked them rather
3942
+ * than always falling back to the static `subagentSpawn` call-site default.
3943
+ */
3944
+ invokingCallSite?: LLMCallSite;
3757
3945
  /**
3758
3946
  * Canonical principal ID of the actor on whose behalf this tool invocation
3759
3947
  * is running. Sourced from `conversation.trustContext.guardianPrincipalId`.
@@ -3773,6 +3961,12 @@ export declare interface ToolContext {
3773
3961
  */
3774
3962
  export declare type ToolDefinition = z.infer<typeof ToolDefinitionSchema>;
3775
3963
 
3964
+ declare interface ToolDefinition_2 {
3965
+ name: string;
3966
+ description: string;
3967
+ input_schema: object;
3968
+ }
3969
+
3776
3970
  /**
3777
3971
  * Schema describing the shape of a {@link ToolDefinition}. All fields are
3778
3972
  * optional — loaders fill documented defaults for omitted fields via
@@ -4118,6 +4312,7 @@ declare const ToolResultEventSchema: z.ZodObject<{
4118
4312
  brave: "brave";
4119
4313
  perplexity: "perplexity";
4120
4314
  tavily: "tavily";
4315
+ firecrawl: "firecrawl";
4121
4316
  }>;
4122
4317
  resultCount: z.ZodNumber;
4123
4318
  durationMs: z.ZodNumber;
@@ -4136,6 +4331,10 @@ declare const ToolResultEventSchema: z.ZodObject<{
4136
4331
  webFetch: z.ZodOptional<z.ZodObject<{
4137
4332
  url: z.ZodString;
4138
4333
  finalUrl: z.ZodString;
4334
+ provider: z.ZodOptional<z.ZodEnum<{
4335
+ default: "default";
4336
+ firecrawl: "firecrawl";
4337
+ }>>;
4139
4338
  status: z.ZodNumber;
4140
4339
  contentType: z.ZodOptional<z.ZodString>;
4141
4340
  byteCount: z.ZodNumber;
@@ -4233,11 +4432,15 @@ declare const TraceEventSchema: z.ZodObject<{
4233
4432
  * - `'trusted_contact'`: The sender is an active contact with a channel
4234
4433
  * (not the guardian). Trusted contacts can invoke tools but require
4235
4434
  * guardian approval for sensitive operations.
4435
+ * - `'unverified_contact'`: The sender matches a contact channel whose
4436
+ * status is `pending` or `unverified` — known to the guardian but not yet
4437
+ * verified. Treated identically to `trusted_contact` for every downstream
4438
+ * capability/tool/approval decision; the distinction is admission-only.
4236
4439
  * - `'unknown'`: The sender has no contact record, no identity could be
4237
- * established, or the sender is an inactive/revoked contact. Unknown
4440
+ * established, or the sender is a blocked/revoked contact. Unknown
4238
4441
  * actors are fail-closed with no escalation path.
4239
4442
  */
4240
- declare type TrustClass = "guardian" | "trusted_contact" | "unknown";
4443
+ declare type TrustClass = "guardian" | "trusted_contact" | "unverified_contact" | "unknown";
4241
4444
 
4242
4445
  declare type TurnProfileAutoRoutedEvent = z.infer<typeof TurnProfileAutoRoutedEventSchema>;
4243
4446
 
@@ -4560,6 +4763,8 @@ declare interface VercelApiConfigResponse {
4560
4763
  declare interface WebFetchMetadata {
4561
4764
  url: string;
4562
4765
  finalUrl: string;
4766
+ /** Provider that served the fetch. Defaults to the built-in fetcher. */
4767
+ provider?: WebFetchProviderId;
4563
4768
  status: number;
4564
4769
  contentType?: string;
4565
4770
  byteCount: number;
@@ -4575,6 +4780,9 @@ declare interface WebFetchMetadata {
4575
4780
  mayRequireJavaScript?: boolean;
4576
4781
  }
4577
4782
 
4783
+ /** Provider that backed a `web_fetch` call. `default` is the built-in fetcher. */
4784
+ declare type WebFetchProviderId = "default" | "firecrawl";
4785
+
4578
4786
  declare interface WebSearchMetadata {
4579
4787
  query: string;
4580
4788
  provider: WebSearchProviderId;
@@ -4585,7 +4793,7 @@ declare interface WebSearchMetadata {
4585
4793
  errorMessage?: string;
4586
4794
  }
4587
4795
 
4588
- declare type WebSearchProviderId = "anthropic-native" | "brave" | "perplexity" | "tavily";
4796
+ declare type WebSearchProviderId = "anthropic-native" | "brave" | "perplexity" | "tavily" | "firecrawl";
4589
4797
 
4590
4798
  declare interface WebSearchResultItem {
4591
4799
  rank: number;
@@ -4612,6 +4820,13 @@ export declare interface WebSearchToolResultContent {
4612
4820
  declare interface WorkflowCompleted {
4613
4821
  type: "workflow_completed";
4614
4822
  runId: string;
4823
+ /**
4824
+ * Originating conversation id, when launched from one; lets `broadcastMessage`
4825
+ * auto-scope + seq-stamp the event to that conversation's SSE stream. Omitted
4826
+ * for a conversationless run (e.g. a scheduled workflow), which broadcasts
4827
+ * unscoped for raw SSE listeners and the DB record.
4828
+ */
4829
+ conversationId?: string;
4615
4830
  status: WorkflowRunStatus;
4616
4831
  agentsSpawned: number;
4617
4832
  inputTokens: number;
@@ -4620,6 +4835,49 @@ declare interface WorkflowCompleted {
4620
4835
  summary?: string;
4621
4836
  }
4622
4837
 
4838
+ /**
4839
+ * A leaf agent within a workflow run has finished. `seq` matches the
4840
+ * corresponding `workflow_leaf_started` event.
4841
+ */
4842
+ declare interface WorkflowLeafFinished {
4843
+ type: "workflow_leaf_finished";
4844
+ runId: string;
4845
+ /**
4846
+ * Originating conversation id; lets `broadcastMessage` auto-scope +
4847
+ * seq-stamp the event to the conversation's SSE stream.
4848
+ */
4849
+ conversationId: string;
4850
+ seq: number;
4851
+ status: "completed" | "failed";
4852
+ /** Leaf label, for client display. */
4853
+ label?: string;
4854
+ inputTokens?: number;
4855
+ outputTokens?: number;
4856
+ /** Short summary of the leaf's result, for client display. */
4857
+ resultSummary?: string;
4858
+ }
4859
+
4860
+ /**
4861
+ * A leaf agent within a workflow run has started. `seq` orders leaves within
4862
+ * the run for stable client-side tree placement.
4863
+ */
4864
+ declare interface WorkflowLeafStarted {
4865
+ type: "workflow_leaf_started";
4866
+ runId: string;
4867
+ /**
4868
+ * Originating conversation id; lets `broadcastMessage` auto-scope +
4869
+ * seq-stamp the event to the conversation's SSE stream.
4870
+ */
4871
+ conversationId: string;
4872
+ seq: number;
4873
+ /** Leaf label, for client display. */
4874
+ label?: string;
4875
+ /** Phase the leaf belongs to, when the workflow declares phases. */
4876
+ phase?: string;
4877
+ /** Short summary of the leaf's prompt, for client display. */
4878
+ promptSummary?: string;
4879
+ }
4880
+
4623
4881
  /**
4624
4882
  * Progress push for an in-flight workflow run. Maps the engine's
4625
4883
  * `onProgress` (`phase`/`log`) callback plus the current usage snapshot into a
@@ -4629,6 +4887,13 @@ declare interface WorkflowCompleted {
4629
4887
  declare interface WorkflowProgress {
4630
4888
  type: "workflow_progress";
4631
4889
  runId: string;
4890
+ /**
4891
+ * Originating conversation id, when launched from one; lets `broadcastMessage`
4892
+ * auto-scope + seq-stamp the event to that conversation's SSE stream. Omitted
4893
+ * for a conversationless run (e.g. a scheduled workflow), which broadcasts
4894
+ * unscoped for raw SSE listeners and the DB record.
4895
+ */
4896
+ conversationId?: string;
4632
4897
  /** Latest phase title, when this emission came from a `phase(...)` call. */
4633
4898
  phase?: string;
4634
4899
  /** Run label (the workflow's `meta.name`), for client display. */
@@ -4656,7 +4921,27 @@ declare interface WorkflowProgress {
4656
4921
  */
4657
4922
  declare type WorkflowRunStatus = "running" | "completed" | "failed" | "aborted" | "cap_exceeded" | "interrupted";
4658
4923
 
4659
- declare type _WorkflowsServerMessages = WorkflowProgress | WorkflowCompleted;
4924
+ declare type _WorkflowsServerMessages = WorkflowProgress | WorkflowCompleted | WorkflowStarted | WorkflowLeafStarted | WorkflowLeafFinished;
4925
+
4926
+ /**
4927
+ * A workflow run has started. Emitted once at launch, before any leaf events.
4928
+ */
4929
+ declare interface WorkflowStarted {
4930
+ type: "workflow_started";
4931
+ runId: string;
4932
+ /**
4933
+ * Originating conversation id; lets `broadcastMessage` auto-scope +
4934
+ * seq-stamp the event to the conversation's SSE stream.
4935
+ */
4936
+ conversationId: string;
4937
+ /**
4938
+ * Tool-use id of the `skill_execute` block that launched this run, for
4939
+ * anchoring the inline workflow card to the exact spawn tool call.
4940
+ */
4941
+ toolUseId?: string;
4942
+ /** Run label (the workflow's `meta.name`), for client display. */
4943
+ label?: string;
4944
+ }
4660
4945
 
4661
4946
  declare interface WorkItemApprovePermissionsResponse {
4662
4947
  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.2",
4
4
  "description": "Public TypeScript authoring contract for Vellum assistant plugins.",
5
5
  "license": "MIT",
6
6
  "type": "module",