@jacobbd/relay-ai 0.9.2 → 0.9.3

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.
@@ -2,13 +2,36 @@ import { LanguageModel } from 'ai';
2
2
 
3
3
  /** Unconditionally-scoped route id: `${providerId}::${modelId}`. Never bare. */
4
4
  type RelayRouteId = `${string}::${string}`;
5
- type RelayCoreErrorCode = 'INVALID_ROUTE_ID' | 'ROUTE_NOT_FOUND' | 'PROVIDER_DISABLED' | 'CREDENTIAL_UNAVAILABLE' | 'OAUTH_REFRESH_FAILED' | 'UNSUPPORTED_MODEL' | 'UNSUPPORTED_REGISTRY_VERSION' | 'PROVIDER_LOAD_FAILED';
5
+ type RelayCoreErrorCode = 'INVALID_ROUTE_ID' | 'ROUTE_NOT_FOUND' | 'PROVIDER_DISABLED' | 'CREDENTIAL_UNAVAILABLE' | 'OAUTH_REFRESH_FAILED' | 'UNSUPPORTED_MODEL' | 'UNSUPPORTED_REASONING_LEVEL' | 'UNSUPPORTED_REGISTRY_VERSION' | 'PROVIDER_LOAD_FAILED';
6
+ /**
7
+ * Provider-neutral reasoning level. Relay Core translates it into whatever
8
+ * request shape the resolved route's provider actually wants — consumers never
9
+ * write provider-specific `providerOptions` themselves.
10
+ *
11
+ * This union is exactly the vocabulary
12
+ * `listRelayModels()[].capabilities.reasoningLevels` can contain, so a level
13
+ * read off a descriptor is always assignable here. **Routes accept a subset**:
14
+ * always check that descriptor before passing a level, since anything outside a
15
+ * route's own list is rejected with `UNSUPPORTED_REASONING_LEVEL`.
16
+ */
17
+ type RelayReasoningLevel = 'off' | 'none' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh' | 'max';
6
18
  interface CreateRelayModelOptions {
7
19
  /**
8
20
  * Optional sanitized transport diagnostics. Messages contain event types,
9
21
  * field names, counts, and lengths — never credentials, prompts, or bodies.
22
+ *
23
+ * Supported by both Core transports: the generic SDK-provider path and the
24
+ * specialized Cloud Code Assist path.
10
25
  */
11
26
  onDebug?: (message: string) => void;
27
+ /**
28
+ * Reasoning level to apply to every call made with the returned model.
29
+ *
30
+ * Throws `UNSUPPORTED_REASONING_LEVEL` when the route cannot express the
31
+ * requested level, rather than quietly sending a weaker one. A per-call
32
+ * `providerOptions` value passed to `streamText`/`generateText` still wins.
33
+ */
34
+ reasoning?: RelayReasoningLevel;
12
35
  }
13
36
  interface RelayModelDescriptor {
14
37
  routeId: RelayRouteId;
@@ -36,8 +59,13 @@ interface RelayModelDescriptor {
36
59
  /** See `tools` — same permanent-placeholder caveat. */
37
60
  vision: boolean | 'unknown';
38
61
  reasoning: 'none' | 'fixed' | 'adjustable' | 'unknown';
39
- reasoningLevels?: string[];
40
- defaultReasoningLevel?: string;
62
+ /**
63
+ * Exactly the levels this route accepts, when `reasoning === 'adjustable'`.
64
+ * Typed as `RelayReasoningLevel[]` so a value read from here can be passed
65
+ * straight to `CreateRelayModelOptions.reasoning` without a cast.
66
+ */
67
+ reasoningLevels?: RelayReasoningLevel[];
68
+ defaultReasoningLevel?: RelayReasoningLevel;
41
69
  };
42
70
  }
43
71
 
@@ -95,4 +123,4 @@ declare class RelayCoreError extends Error {
95
123
  }
96
124
  declare function isRelayCoreError(err: unknown): err is RelayCoreError;
97
125
 
98
- export { type CreateRelayModelOptions, RelayCoreError, type RelayCoreErrorCode, type RelayModelDescriptor, type RelayRouteId, createRelayModel, isRelayCoreError, listRelayModels, parseRelayRouteId, toRelayRouteId };
126
+ export { type CreateRelayModelOptions, RelayCoreError, type RelayCoreErrorCode, type RelayModelDescriptor, type RelayReasoningLevel, type RelayRouteId, createRelayModel, isRelayCoreError, listRelayModels, parseRelayRouteId, toRelayRouteId };