@vellumai/plugin-api 0.9.0-staging.2 → 0.9.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 +66 -8
  2. package/index.js +1 -0
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -524,8 +524,7 @@ declare type _BookmarksServerMessages = BookmarkCreated | BookmarkDeleted;
524
524
 
525
525
  /**
526
526
  * Wire-shape representation of a bookmark, joined with the bookmarked
527
- * message and its parent conversation. Mirrors
528
- * `clients/shared/Network/BookmarkSummary.swift` — dates are emitted as
527
+ * message and its parent conversation. Dates are emitted as
529
528
  * unix-millisecond integers, and the message preview is capped to keep
530
529
  * the list payload bounded.
531
530
  */
@@ -920,9 +919,9 @@ declare interface ContextCompacted {
920
919
  * - `summaryCharCount`: length of the produced summary text.
921
920
  * - `summaryHeaderCount`: number of `## ` section headers in the summary.
922
921
  * - `summaryHadMemoryEcho`: `true` if the summary contains any runtime
923
- * injection tag (e.g. `<memory`, `<turn_context>`, `<workspace>`).
924
- * Should always be `false` `true` indicates the compaction strip
925
- * logic failed to remove an injected block from the summarizer input.
922
+ * injection tag (e.g. `<memory`, `<turn_context>`, `<workspace>`). The
923
+ * durable summary should be clean prose, so `true` flags an echoed or
924
+ * invented tag worth investigating.
926
925
  */
927
926
  summaryCharCount?: number;
928
927
  summaryHeaderCount?: number;
@@ -1471,6 +1470,19 @@ declare const GenerationHandoffEventSchema: z.ZodObject<{
1471
1470
  attachmentWarnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
1472
1471
  }, z.core.$strip>;
1473
1472
 
1473
+ /**
1474
+ * List the workspace inference profiles a plugin can route to, in the order the
1475
+ * `/model` picker presents them (`llm.profileOrder` first, then the rest
1476
+ * alphabetically). Disabled profiles are included and flagged via
1477
+ * {@link ModelProfileInfo.isDisabled}; weighted "mix" profiles are included and
1478
+ * flagged via {@link ModelProfileInfo.isMix}, since a mix is itself a valid
1479
+ * routing target (it resolves to one constituent per conversation).
1480
+ *
1481
+ * Reads the live in-memory config, so the result reflects the current profile
1482
+ * set each time it is called.
1483
+ */
1484
+ export declare function getModelProfiles(): ModelProfileInfo[];
1485
+
1474
1486
  /**
1475
1487
  * Retrieve a secret from secure storage. Convenience wrapper over
1476
1488
  * `getSecureKeyResultAsync` that returns only the value.
@@ -1729,7 +1741,7 @@ export declare const HOOKS: {
1729
1741
  readonly SHUTDOWN: "shutdown";
1730
1742
  /** Fires once per user turn, immediately before the agent loop receives `runMessages`. */
1731
1743
  readonly USER_PROMPT_SUBMIT: "user-prompt-submit";
1732
- /** Fires immediately before each provider call. A hook may edit the outbound request (e.g. the system prompt) and opt the turn into deferred output streaming. */
1744
+ /** Fires immediately before each provider call. A hook may edit the outbound request (e.g. the system prompt), route the call to a different inference profile, and opt the turn into deferred output streaming. */
1733
1745
  readonly PRE_MODEL_CALL: "pre-model-call";
1734
1746
  /** Fires once per tool result, after the tool returns and before the result is sent to the provider. */
1735
1747
  readonly POST_TOOL_USE: "post-tool-use";
@@ -2453,6 +2465,33 @@ declare interface ModelInfo {
2453
2465
  }>;
2454
2466
  }
2455
2467
 
2468
+ /**
2469
+ * A workspace inference profile a plugin can route to. Returned by
2470
+ * {@link getModelProfiles}; {@link key} is the value a `pre-model-call` hook
2471
+ * assigns to `PreModelCallContext.modelProfile` to route a call. A model router
2472
+ * reads this list (typically at `init`) to learn which profiles exist before
2473
+ * mapping a classified message onto one.
2474
+ */
2475
+ export declare interface ModelProfileInfo {
2476
+ /** Profile key in `llm.profiles`; assignable to `PreModelCallContext.modelProfile`. */
2477
+ readonly key: string;
2478
+ /** Human-readable label, falling back to {@link key} when none is set. */
2479
+ readonly label: string;
2480
+ /** Author-supplied description, or `null` when none is set. */
2481
+ readonly description: string | null;
2482
+ /** Whether this is the workspace's active profile. */
2483
+ readonly isActive: boolean;
2484
+ /** Whether the profile is disabled; routing to it is rejected by the resolver. */
2485
+ readonly isDisabled: boolean;
2486
+ /**
2487
+ * Whether this is a weighted "mix" profile — an A/B blend that resolves to one
2488
+ * of its constituent profiles per conversation via a seeded weighted pick.
2489
+ * Routing to its {@link key} is valid; it directs the call into the blend
2490
+ * rather than at a single fixed model.
2491
+ */
2492
+ readonly isMix: boolean;
2493
+ }
2494
+
2456
2495
  declare type NavigateSettingsEvent = z.infer<typeof NavigateSettingsEventSchema>;
2457
2496
 
2458
2497
  declare const NavigateSettingsEventSchema: z.ZodObject<{
@@ -2929,8 +2968,9 @@ export declare interface PostToolUseContext {
2929
2968
  * and compaction work can share a conversation), hooks MUST self-gate on
2930
2969
  * {@link callSite} / {@link conversationId} before acting.
2931
2970
  *
2932
- * A hook may edit the outbound request by replacing {@link systemPrompt}, and may
2933
- * opt this turn into deferred output streaming via {@link deferAssistantOutput}.
2971
+ * A hook may edit the outbound request by replacing {@link systemPrompt}, route
2972
+ * the call to a different inference profile via {@link modelProfile}, and opt
2973
+ * this turn into deferred output streaming via {@link deferAssistantOutput}.
2934
2974
  * Mutate the context in place or return a new one; throwing is contained by the
2935
2975
  * loop (the call proceeds with the original request).
2936
2976
  */
@@ -2947,6 +2987,24 @@ export declare interface PreModelCallContext {
2947
2987
  * append a section); the loop sends the resulting value.
2948
2988
  */
2949
2989
  systemPrompt: string | null;
2990
+ /**
2991
+ * Inference profile to route THIS provider call to, named by its key in the
2992
+ * workspace `llm.profiles`. Seeded with the call's already-resolved override
2993
+ * profile, or `null` when none applies. A hook may replace it to select a
2994
+ * different profile per call — the lever a model router uses to map a
2995
+ * classified message onto a profile (model + provider connection + sampling
2996
+ * settings). For the user-facing `mainAgent` call the resolver layers the
2997
+ * named profile at the top of precedence (above the workspace active
2998
+ * profile), so the hook's choice wins; a key with no matching profile falls
2999
+ * through unchanged (no throw). Honored only when {@link callSite} is set.
3000
+ * Set to `null` to apply no override.
3001
+ *
3002
+ * Context-window sizing and overflow recovery for this call are computed from
3003
+ * the profile resolved before the hook runs. Routing a near-budget
3004
+ * conversation to a profile with a smaller context window relies on the loop's
3005
+ * overflow recovery (compact and retry) rather than proactive compaction.
3006
+ */
3007
+ modelProfile: string | null;
2950
3008
  /**
2951
3009
  * Seeded `false`. When a hook sets it `true`, the loop suppresses this turn's
2952
3010
  * live assistant `text_delta` stream; a `post-model-call` hook is then
package/index.js CHANGED
@@ -3,4 +3,5 @@ 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 getModelProfiles = api.getModelProfiles;
6
7
  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-staging.2",
3
+ "version": "0.9.1-staging.1",
4
4
  "description": "Public TypeScript authoring contract for Vellum assistant plugins.",
5
5
  "license": "MIT",
6
6
  "type": "module",