@vellumai/plugin-api 0.9.0-dev.202606171417.d2192ab → 0.9.0-dev.202606171903.06eea08

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 +186 -1
  2. package/index.js +1 -0
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -1470,6 +1470,18 @@ declare const GenerationHandoffEventSchema: z.ZodObject<{
1470
1470
  attachmentWarnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
1471
1471
  }, z.core.$strip>;
1472
1472
 
1473
+ /**
1474
+ * Resolve the configured provider through the registry.
1475
+ * Thin wrapper around `resolveConfiguredProvider()` for callsites
1476
+ * that only need the Provider instance.
1477
+ *
1478
+ * `callSite` is required — see `resolveConfiguredProvider`. Returns `null`
1479
+ * when no providers are available.
1480
+ */
1481
+ export declare function getConfiguredProvider(callSite: LLMCallSite, opts?: {
1482
+ overrideProfile?: string;
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.
@@ -3021,6 +3033,83 @@ declare interface ProcessEntry extends BaseSubscriberEntry {
3021
3033
  type: "process";
3022
3034
  }
3023
3035
 
3036
+ export declare interface Provider {
3037
+ name: string;
3038
+ /**
3039
+ * Provider key used by the local token estimator to select model-family
3040
+ * specific rules (e.g. Anthropic's `width * height / 750` image sizing).
3041
+ * Wrapper providers that route to another provider's API — e.g. OpenRouter
3042
+ * calling Anthropic's Messages endpoint for `anthropic/*` models — override
3043
+ * this so the estimator matches what the upstream API will actually charge.
3044
+ * Falls back to `name` when unset.
3045
+ */
3046
+ tokenEstimationProvider?: string;
3047
+ sendMessage(messages: Message[], options?: SendMessageOptions): Promise<ProviderResponse>;
3048
+ }
3049
+
3050
+ export declare type ProviderEvent = {
3051
+ type: "text_delta";
3052
+ text: string;
3053
+ } | {
3054
+ type: "thinking_delta";
3055
+ thinking: string;
3056
+ } | {
3057
+ type: "tool_use_preview_start";
3058
+ toolUseId: string;
3059
+ toolName: string;
3060
+ } | {
3061
+ type: "input_json_delta";
3062
+ toolName: string;
3063
+ toolUseId: string;
3064
+ accumulatedJson: string;
3065
+ } | {
3066
+ type: "server_tool_start";
3067
+ name: string;
3068
+ toolUseId: string;
3069
+ input: Record<string, unknown>;
3070
+ } | {
3071
+ type: "server_tool_complete";
3072
+ toolUseId: string;
3073
+ isError: boolean;
3074
+ content?: unknown[];
3075
+ /**
3076
+ * Finalized input for the server tool call (e.g. the actual query).
3077
+ * Anthropic streams `server_tool_use` block input via `input_json_delta`
3078
+ * events, so consumers reading the input at `server_tool_start` see `{}`.
3079
+ * The provider accumulates the JSON and surfaces it here once the block
3080
+ * stops, so downstream handlers can build accurate activity metadata.
3081
+ */
3082
+ resolvedInput?: Record<string, unknown>;
3083
+ /**
3084
+ * Provider-specific error code when `isError` is true (e.g. Anthropic's
3085
+ * `max_uses_exceeded`, `query_too_long`). Surfaced so user-facing
3086
+ * messages can be specific instead of a generic "Search failed".
3087
+ */
3088
+ errorCode?: string;
3089
+ /** Optional human-readable error message from the provider. */
3090
+ errorMessage?: string;
3091
+ };
3092
+
3093
+ export declare interface ProviderResponse {
3094
+ content: ContentBlock[];
3095
+ model: string;
3096
+ /** Provider that actually produced this response, which may differ from a wrapper provider name. */
3097
+ actualProvider?: string;
3098
+ usage: {
3099
+ /** Total input tokens (input_tokens + cache_creation + cache_read). */
3100
+ inputTokens: number;
3101
+ outputTokens: number;
3102
+ cacheCreationInputTokens?: number;
3103
+ cacheReadInputTokens?: number;
3104
+ reasoningTokens?: number;
3105
+ };
3106
+ stopReason: string;
3107
+ /** Raw JSON request body sent to the provider (for diagnostics logging). */
3108
+ rawRequest?: unknown;
3109
+ /** Raw JSON response body received from the provider (for diagnostics logging). */
3110
+ rawResponse?: unknown;
3111
+ }
3112
+
3024
3113
  /** Callback for proxy policy decisions requiring user confirmation. Returns true if approved. */
3025
3114
  declare type ProxyApprovalCallback = (request: ProxyApprovalRequest) => Promise<boolean>;
3026
3115
 
@@ -3226,6 +3315,96 @@ declare const SecretRequestEventSchema: z.ZodObject<{
3226
3315
  allowOneTimeSend: z.ZodOptional<z.ZodBoolean>;
3227
3316
  }, z.core.$strip>;
3228
3317
 
3318
+ export declare interface SendMessageConfig {
3319
+ model?: string;
3320
+ /**
3321
+ * LLM call-site identifier. `RetryProvider` resolves
3322
+ * provider/model/maxTokens/effort/speed/verbosity/temperature/thinking/
3323
+ * contextWindow via `resolveCallSiteConfig(callSite, config.llm)`, falling
3324
+ * back to `llm.default` when no callSite-specific entry is present.
3325
+ */
3326
+ callSite?: LLMCallSite;
3327
+ /**
3328
+ * Optional ad-hoc profile override applied per request. When set, the
3329
+ * resolver layers `llm.profiles[overrideProfile]` between the workspace's
3330
+ * `activeProfile` and the call-site's named profile (see
3331
+ * `resolveCallSiteConfig`). Used by per-conversation pinned profiles to
3332
+ * override the workspace default for a single send. Missing profile names
3333
+ * silently fall through.
3334
+ */
3335
+ overrideProfile?: string;
3336
+ /**
3337
+ * When true, the resolver floats `overrideProfile` above the call-site
3338
+ * layers (named site profile + call-site override) for non-main-agent call
3339
+ * sites — see `ResolveCallSiteOpts.forceOverrideProfile`. Used by callers
3340
+ * that must run a background call site under a specific conversation's
3341
+ * inference profile (e.g. fork-based memory retrospectives). A
3342
+ * resolution/routing-time concern only; stripped before any provider wire
3343
+ * request.
3344
+ */
3345
+ forceOverrideProfile?: boolean;
3346
+ /**
3347
+ * Per-conversation seed for deterministic `mix`-profile expansion. The agent
3348
+ * loop sets this to the conversation id so every resolver call this send
3349
+ * triggers — provider/transport selection, wire-param normalization, usage
3350
+ * attribution — picks the same mix constituent, stable across the
3351
+ * conversation's turns and retries. A resolution/routing-time concern only;
3352
+ * stripped before any provider wire request.
3353
+ */
3354
+ selectionSeed?: string;
3355
+ /**
3356
+ * Internal per-request HTTP headers for managed-proxy usage attribution.
3357
+ * Provider clients may pass these through SDK request options only when the
3358
+ * transport is Vellum-managed, and must never include this object in provider
3359
+ * JSON request bodies.
3360
+ */
3361
+ usageAttributionHeaders?: Record<string, string>;
3362
+ /**
3363
+ * Controls local usage-ledger writes for attributed provider calls.
3364
+ * Defaults to `auto`; conversation paths that aggregate usage separately
3365
+ * set `manual` to avoid double-counting.
3366
+ */
3367
+ usageTracking?: "auto" | "manual";
3368
+ effort?: "none" | "low" | "medium" | "high" | "xhigh" | "max";
3369
+ speed?: "standard" | "fast";
3370
+ verbosity?: "low" | "medium" | "high";
3371
+ /**
3372
+ * Wire-format `logit_bias` map (`{ "<tokenId>": bias }`). Set by
3373
+ * `RetryProvider` from a profile's `logitBias` preset and forwarded only on
3374
+ * the OpenAI-compatible (Fireworks) path; other providers ignore it.
3375
+ */
3376
+ logit_bias?: Record<string, number>;
3377
+ /**
3378
+ * When true, the most recent user message's content varies across
3379
+ * otherwise-identical turns (e.g. a per-turn memory block was injected into
3380
+ * it). The provider places the primary long-TTL cache breakpoint on the most
3381
+ * recent *stable* user message instead of the volatile latest one, so the
3382
+ * cached prefix stays reusable across turns. Default false — existing
3383
+ * behavior.
3384
+ */
3385
+ mutableLatestUserMessage?: boolean;
3386
+ /**
3387
+ * When true, the provider sends no prompt-cache breakpoints at all (and
3388
+ * strips any block-level `cache_control` markers callers stamped on
3389
+ * messages). For one-shot call sites whose prompts are unique per call or
3390
+ * whose call cadence exceeds the cache TTL, every breakpoint is a paid
3391
+ * cache write that will never be read — opting out saves the write
3392
+ * premium. Resolved per call site via `resolveCallSiteConfig` (see
3393
+ * `disableCache` in the LLM config schema); a per-call explicit value
3394
+ * wins. Default false — existing behavior.
3395
+ */
3396
+ disableCache?: boolean;
3397
+ [key: string]: unknown;
3398
+ }
3399
+
3400
+ export declare interface SendMessageOptions {
3401
+ tools?: ToolDefinition_2[];
3402
+ systemPrompt?: string;
3403
+ config?: SendMessageConfig;
3404
+ onEvent?: (event: ProviderEvent) => void;
3405
+ signal?: AbortSignal;
3406
+ }
3407
+
3229
3408
  declare interface SensitiveOutputBinding {
3230
3409
  kind: SensitiveOutputKind;
3231
3410
  placeholder: string;
@@ -3773,6 +3952,12 @@ export declare interface ToolContext {
3773
3952
  */
3774
3953
  export declare type ToolDefinition = z.infer<typeof ToolDefinitionSchema>;
3775
3954
 
3955
+ declare interface ToolDefinition_2 {
3956
+ name: string;
3957
+ description: string;
3958
+ input_schema: object;
3959
+ }
3960
+
3776
3961
  /**
3777
3962
  * Schema describing the shape of a {@link ToolDefinition}. All fields are
3778
3963
  * optional — loaders fill documented defaults for omitted fields via
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.0-dev.202606171417.d2192ab",
3
+ "version": "0.9.0-dev.202606171903.06eea08",
4
4
  "description": "Public TypeScript authoring contract for Vellum assistant plugins.",
5
5
  "license": "MIT",
6
6
  "type": "module",