@cleocode/contracts 2026.5.66 → 2026.5.67
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.
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/llm/interfaces.d.ts +476 -0
- package/dist/llm/interfaces.d.ts.map +1 -0
- package/dist/llm/interfaces.js +24 -0
- package/dist/llm/interfaces.js.map +1 -0
- package/dist/llm/normalized-response.d.ts +130 -4
- package/dist/llm/normalized-response.d.ts.map +1 -1
- package/dist/llm/normalized-response.js +2 -0
- package/dist/llm/normalized-response.js.map +1 -1
- package/dist/llm/provider-id.d.ts +47 -0
- package/dist/llm/provider-id.d.ts.map +1 -0
- package/dist/llm/provider-id.js +13 -0
- package/dist/llm/provider-id.js.map +1 -0
- package/dist/llm/provider-profile.d.ts +52 -0
- package/dist/llm/provider-profile.d.ts.map +1 -1
- package/dist/llm/resolved-credential.d.ts +61 -0
- package/dist/llm/resolved-credential.d.ts.map +1 -0
- package/dist/llm/resolved-credential.js +14 -0
- package/dist/llm/resolved-credential.js.map +1 -0
- package/dist/operations/llm.d.ts +14 -2
- package/dist/operations/llm.d.ts.map +1 -1
- package/dist/operations/llm.js.map +1 -1
- package/package.json +2 -2
- package/src/index.ts +21 -0
- package/src/llm/interfaces.ts +538 -0
- package/src/llm/normalized-response.ts +132 -4
- package/src/llm/provider-id.ts +63 -0
- package/src/llm/provider-profile.ts +66 -0
- package/src/llm/resolved-credential.ts +62 -0
- package/src/operations/llm.ts +15 -2
|
@@ -11,9 +11,13 @@
|
|
|
11
11
|
*
|
|
12
12
|
* @module llm/normalized-response
|
|
13
13
|
* @task T9263
|
|
14
|
+
* @task T9282 (W0c — Phase 4 multimodal + stream extensions)
|
|
14
15
|
* @epic T-LLM-CRED-CENTRALIZATION
|
|
16
|
+
* @see ADR-072 §LlmTransport — pure wire level
|
|
15
17
|
*/
|
|
16
18
|
import type { ModelTransport } from '../operations/llm.js';
|
|
19
|
+
import type { NormalizedDelta, TransportContext } from './interfaces.js';
|
|
20
|
+
import type { ApiMode } from './provider-id.js';
|
|
17
21
|
/**
|
|
18
22
|
* Token usage reported by the provider for a single API call.
|
|
19
23
|
*
|
|
@@ -94,17 +98,69 @@ export interface NormalizedResponse {
|
|
|
94
98
|
*/
|
|
95
99
|
raw: unknown;
|
|
96
100
|
}
|
|
101
|
+
/**
|
|
102
|
+
* An image content block for multimodal messages.
|
|
103
|
+
*
|
|
104
|
+
* `source.type` determines how the image data is provided:
|
|
105
|
+
* - `'base64'` — raw image bytes encoded as base64, with `mediaType` identifying
|
|
106
|
+
* the MIME type (e.g. `'image/png'`, `'image/jpeg'`).
|
|
107
|
+
* - `'url'` — a publicly accessible URL; `data` is the URL string and `mediaType`
|
|
108
|
+
* is still populated (sniffed by {@link image-routing.ts} when not supplied by
|
|
109
|
+
* the caller).
|
|
110
|
+
*
|
|
111
|
+
* @see ADR-072 §LlmTransport — pure wire level (W4d image routing)
|
|
112
|
+
*/
|
|
113
|
+
export interface TransportImageBlock {
|
|
114
|
+
/** Discriminant — always `'image'`. */
|
|
115
|
+
readonly type: 'image';
|
|
116
|
+
readonly source: {
|
|
117
|
+
/** How the image data is provided. */
|
|
118
|
+
readonly type: 'base64' | 'url';
|
|
119
|
+
/**
|
|
120
|
+
* Base64-encoded image bytes (when `type === 'base64'`) or a URL string
|
|
121
|
+
* (when `type === 'url'`).
|
|
122
|
+
*/
|
|
123
|
+
readonly data: string;
|
|
124
|
+
/** MIME type, e.g. `'image/png'`, `'image/jpeg'`, `'image/webp'`. */
|
|
125
|
+
readonly mediaType: string;
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* A text content block for multimodal messages.
|
|
130
|
+
*/
|
|
131
|
+
export interface TransportTextBlock {
|
|
132
|
+
/** Discriminant — always `'text'`. */
|
|
133
|
+
readonly type: 'text';
|
|
134
|
+
/** Plain text string. */
|
|
135
|
+
readonly text: string;
|
|
136
|
+
}
|
|
97
137
|
/**
|
|
98
138
|
* A single message in a provider-neutral conversation turn.
|
|
99
139
|
*
|
|
100
140
|
* `toolUseId` is required when `role` is `'tool'` — it identifies which
|
|
101
141
|
* tool call this result resolves, matching {@link NormalizedToolCall.id}.
|
|
142
|
+
*
|
|
143
|
+
* `content` supports both the legacy plain-string form and a multimodal block
|
|
144
|
+
* array. When `content` is a string, the transport treats it as a single text
|
|
145
|
+
* block. When it is an array, each element is either a {@link TransportTextBlock}
|
|
146
|
+
* or a {@link TransportImageBlock} — enabling image routing (W4d) without
|
|
147
|
+
* breaking existing transport consumers that only read the string form.
|
|
102
148
|
*/
|
|
103
149
|
export interface TransportMessage {
|
|
104
150
|
/** Conversation turn role. */
|
|
105
151
|
role: 'user' | 'assistant' | 'tool';
|
|
106
|
-
/**
|
|
107
|
-
|
|
152
|
+
/**
|
|
153
|
+
* Message content.
|
|
154
|
+
*
|
|
155
|
+
* - Plain `string` — backwards-compatible single-text-block form used by
|
|
156
|
+
* all existing transports. Transports that do not support images receive
|
|
157
|
+
* this form only.
|
|
158
|
+
* - `ReadonlyArray<TransportTextBlock | TransportImageBlock>` — multimodal
|
|
159
|
+
* block array enabling image routing (ADR-072 W4d). Transports that do not
|
|
160
|
+
* support images MUST stringify text blocks and drop image blocks (or throw
|
|
161
|
+
* if `imageMode` on the request is `'native'` — see {@link TransportRequest}).
|
|
162
|
+
*/
|
|
163
|
+
readonly content: string | ReadonlyArray<TransportTextBlock | TransportImageBlock>;
|
|
108
164
|
/** Tool-result messages: id of the call this resolves. */
|
|
109
165
|
toolUseId?: string;
|
|
110
166
|
}
|
|
@@ -124,13 +180,16 @@ export interface TransportTool {
|
|
|
124
180
|
inputSchema: Record<string, unknown>;
|
|
125
181
|
}
|
|
126
182
|
/**
|
|
127
|
-
* Request parameters passed to {@link LlmTransport.complete}
|
|
183
|
+
* Request parameters passed to {@link LlmTransport.complete} and
|
|
184
|
+
* {@link LlmTransport.stream}.
|
|
128
185
|
*
|
|
129
186
|
* `temperature` is normalized to the 0.0–1.0 range; each transport clamps it
|
|
130
187
|
* to the provider's supported range before sending.
|
|
131
188
|
*
|
|
132
189
|
* `signal` may be used to abort in-flight requests (passed through to the
|
|
133
190
|
* underlying fetch / SDK call where supported).
|
|
191
|
+
*
|
|
192
|
+
* @see ADR-072 §LlmTransport — pure wire level
|
|
134
193
|
*/
|
|
135
194
|
export interface TransportRequest {
|
|
136
195
|
/** Model identifier — provider-specific (e.g. `'claude-sonnet-4-6'`). */
|
|
@@ -147,6 +206,36 @@ export interface TransportRequest {
|
|
|
147
206
|
temperature?: number;
|
|
148
207
|
/** AbortSignal for request cancellation. */
|
|
149
208
|
signal?: AbortSignal;
|
|
209
|
+
/**
|
|
210
|
+
* Prompt-cache breakpoint injection strategy.
|
|
211
|
+
*
|
|
212
|
+
* - `'system_and_3'` — inject cache breakpoints after the system prompt and
|
|
213
|
+
* after the last 3 user messages (Anthropic extended-caching strategy).
|
|
214
|
+
* - `'prefix_and_2'` — inject at the shared prefix boundary and after the 2
|
|
215
|
+
* most-recent turns (optimised for Gemini cached content).
|
|
216
|
+
* - `null` — no cache injection (default when not set).
|
|
217
|
+
*
|
|
218
|
+
* Transports apply the selected strategy before constructing the SDK request.
|
|
219
|
+
* Unsupported strategies on a given transport are silently ignored.
|
|
220
|
+
*
|
|
221
|
+
* @see ADR-072 §LlmTransport — pure wire level
|
|
222
|
+
*/
|
|
223
|
+
readonly cacheStrategy?: 'system_and_3' | 'prefix_and_2' | null;
|
|
224
|
+
/**
|
|
225
|
+
* Image handling mode for multimodal content blocks in {@link TransportMessage.content}.
|
|
226
|
+
*
|
|
227
|
+
* - `'native'` — send image blocks as-is to the provider's multimodal API.
|
|
228
|
+
* The transport MUST throw if the provider does not support native images.
|
|
229
|
+
* - `'text'` — strip all image blocks; only text blocks are sent. Useful for
|
|
230
|
+
* text-only providers or when images are redundant.
|
|
231
|
+
* - `'auto'` — the transport decides based on provider capability (default).
|
|
232
|
+
* Falls back to `'text'` for providers that do not support native images.
|
|
233
|
+
*
|
|
234
|
+
* Used by the image-routing layer (W4d) to select the per-turn input mode.
|
|
235
|
+
*
|
|
236
|
+
* @see ADR-072 §LlmTransport — pure wire level
|
|
237
|
+
*/
|
|
238
|
+
readonly imageMode?: 'native' | 'text' | 'auto';
|
|
150
239
|
}
|
|
151
240
|
/**
|
|
152
241
|
* Provider transport contract.
|
|
@@ -155,6 +244,15 @@ export interface TransportRequest {
|
|
|
155
244
|
* interface and maps provider-specific API shapes to/from
|
|
156
245
|
* {@link NormalizedResponse}. Role-resolver and executor code works
|
|
157
246
|
* exclusively against this interface so providers are swappable.
|
|
247
|
+
*
|
|
248
|
+
* As of Phase 4 (ADR-072) the interface gains two additional members:
|
|
249
|
+
* - {@link apiMode} — the wire protocol spoken by this transport.
|
|
250
|
+
* - {@link stream} — streaming completion returning {@link NormalizedDelta} chunks.
|
|
251
|
+
*
|
|
252
|
+
* Existing transport implementations MUST add stub implementations of both to
|
|
253
|
+
* maintain compile parity (W0c). Wave 1 migrations replace stubs with real impls.
|
|
254
|
+
*
|
|
255
|
+
* @see ADR-072 §LlmTransport — pure wire level
|
|
158
256
|
*/
|
|
159
257
|
export interface LlmTransport {
|
|
160
258
|
/**
|
|
@@ -162,6 +260,13 @@ export interface LlmTransport {
|
|
|
162
260
|
* can select the correct transport at runtime.
|
|
163
261
|
*/
|
|
164
262
|
readonly provider: ModelTransport;
|
|
263
|
+
/**
|
|
264
|
+
* Wire protocol this transport speaks. Used by the session and executor layers
|
|
265
|
+
* to select correct transports for providers that support multiple protocols.
|
|
266
|
+
*
|
|
267
|
+
* @see ADR-072 §Type lock-in — `ApiMode` closed 4-value union
|
|
268
|
+
*/
|
|
269
|
+
readonly apiMode: ApiMode;
|
|
165
270
|
/**
|
|
166
271
|
* Execute a single completion call and return a normalized response.
|
|
167
272
|
*
|
|
@@ -171,8 +276,29 @@ export interface LlmTransport {
|
|
|
171
276
|
* - Map provider-specific stop reasons to the canonical set where possible.
|
|
172
277
|
*
|
|
173
278
|
* @param request - Provider-neutral request parameters.
|
|
279
|
+
* @param ctx - Contextual metadata (request ID, abort signal, feature flags).
|
|
174
280
|
* @returns A promise that resolves to a {@link NormalizedResponse}.
|
|
175
281
|
*/
|
|
176
|
-
complete(request: TransportRequest): Promise<NormalizedResponse>;
|
|
282
|
+
complete(request: TransportRequest, ctx?: TransportContext): Promise<NormalizedResponse>;
|
|
283
|
+
/**
|
|
284
|
+
* Stream a completion. Each {@link NormalizedDelta} carries incremental text
|
|
285
|
+
* or reasoning content.
|
|
286
|
+
*
|
|
287
|
+
* Implementors MUST run streaming deltas through `StreamingThinkScrubber`
|
|
288
|
+
* before yielding them — reasoning content goes to `delta.reasoning`;
|
|
289
|
+
* visible text goes to `delta.text`. The final delta has a non-null
|
|
290
|
+
* `stopReason` and carries full usage stats in `delta.usage`.
|
|
291
|
+
*
|
|
292
|
+
* W0c transports carry a stub that throws until Wave 1 migration lands:
|
|
293
|
+
* ```ts
|
|
294
|
+
* throw new Error('STUB: W1 migration will implement stream() for <provider>');
|
|
295
|
+
* ```
|
|
296
|
+
*
|
|
297
|
+
* @param request - Provider-neutral request parameters.
|
|
298
|
+
* @param ctx - Contextual metadata (request ID, abort signal, feature flags).
|
|
299
|
+
* @returns An async iterable of normalized delta chunks.
|
|
300
|
+
* @see ADR-072 §LlmTransport — pure wire level
|
|
301
|
+
*/
|
|
302
|
+
stream(request: TransportRequest, ctx: TransportContext): AsyncIterable<NormalizedDelta>;
|
|
177
303
|
}
|
|
178
304
|
//# sourceMappingURL=normalized-response.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalized-response.d.ts","sourceRoot":"","sources":["../../src/llm/normalized-response.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"normalized-response.d.ts","sourceRoot":"","sources":["../../src/llm/normalized-response.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KA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EAAE,CAAC;IACxB,+EAA+E;IAC/E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4CAA4C;IAC5C,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;;;;;;;;;;;;OAaG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,cAAc,GAAG,cAAc,GAAG,IAAI,CAAC;IAChE;;;;;;;;;;;;;OAaG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC;CACjD;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,YAAY;IAC3B;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAClC;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,OAAO,EAAE,gBAAgB,EAAE,GAAG,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACzF;;;;;;;;;;;;;;;;;;OAkBG;IACH,MAAM,CAAC,OAAO,EAAE,gBAAgB,EAAE,GAAG,EAAE,gBAAgB,GAAG,aAAa,CAAC,eAAe,CAAC,CAAC;CAC1F"}
|
|
@@ -11,7 +11,9 @@
|
|
|
11
11
|
*
|
|
12
12
|
* @module llm/normalized-response
|
|
13
13
|
* @task T9263
|
|
14
|
+
* @task T9282 (W0c — Phase 4 multimodal + stream extensions)
|
|
14
15
|
* @epic T-LLM-CRED-CENTRALIZATION
|
|
16
|
+
* @see ADR-072 §LlmTransport — pure wire level
|
|
15
17
|
*/
|
|
16
18
|
export {};
|
|
17
19
|
//# sourceMappingURL=normalized-response.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalized-response.js","sourceRoot":"","sources":["../../src/llm/normalized-response.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"normalized-response.js","sourceRoot":"","sources":["../../src/llm/normalized-response.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provider identity and API protocol types for the unified LLM provider architecture.
|
|
3
|
+
*
|
|
4
|
+
* These types anchor the Phase 4 contract layer (ADR-072). All downstream code
|
|
5
|
+
* that references a provider by name or by wire-protocol uses these types.
|
|
6
|
+
*
|
|
7
|
+
* @module llm/provider-id
|
|
8
|
+
* @task T9281
|
|
9
|
+
* @epic T9261 T-LLM-CRED-CENTRALIZATION
|
|
10
|
+
* @see ADR-072 §Type lock-in
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Canonical wire-level API protocol supported by a provider.
|
|
14
|
+
*
|
|
15
|
+
* Closed 4-value union. Providers that speak multiple protocols (e.g. OpenAI
|
|
16
|
+
* supports both chat_completions and codex_responses) declare separate
|
|
17
|
+
* ProviderProfiles, one per ApiMode.
|
|
18
|
+
*
|
|
19
|
+
* Adding a fifth value is a major breaking change — confirm in ADR-072 before doing so.
|
|
20
|
+
*
|
|
21
|
+
* @see ADR-072 §Type lock-in
|
|
22
|
+
*/
|
|
23
|
+
export type ApiMode = 'chat_completions' | 'anthropic_messages' | 'codex_responses' | 'bedrock_converse';
|
|
24
|
+
/**
|
|
25
|
+
* Fixed set of builtin provider identifiers shipped with CLEO core.
|
|
26
|
+
*
|
|
27
|
+
* Plugin providers registered at runtime may use any non-empty string —
|
|
28
|
+
* see {@link ProviderId}.
|
|
29
|
+
*
|
|
30
|
+
* MIGRATION NOTE: The legacy `ModelTransport` ('anthropic'|'openai'|'gemini'|'moonshot')
|
|
31
|
+
* is re-typed as `Extract<ProviderId, BuiltinProviderId>` for one release cycle
|
|
32
|
+
* (deprecated, then removed).
|
|
33
|
+
*/
|
|
34
|
+
export type BuiltinProviderId = 'anthropic' | 'openai' | 'gemini' | 'moonshot' | 'openrouter' | 'bedrock' | 'deepseek' | 'xai' | 'groq' | 'kimi-code';
|
|
35
|
+
/**
|
|
36
|
+
* Provider identity string.
|
|
37
|
+
*
|
|
38
|
+
* Builtin providers use the fixed literals in {@link BuiltinProviderId}.
|
|
39
|
+
* Plugin providers registered at runtime via `ProviderRegistry` may use any
|
|
40
|
+
* non-empty string. The open string union allows plugins without forcing
|
|
41
|
+
* exhaustive switch checks in transport code (match arms should include a
|
|
42
|
+
* default/unknown branch).
|
|
43
|
+
*
|
|
44
|
+
* @see ADR-072 §Type lock-in
|
|
45
|
+
*/
|
|
46
|
+
export type ProviderId = BuiltinProviderId | (string & Record<never, never>);
|
|
47
|
+
//# sourceMappingURL=provider-id.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider-id.d.ts","sourceRoot":"","sources":["../../src/llm/provider-id.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;;;;;;;;;GAUG;AACH,MAAM,MAAM,OAAO,GACf,kBAAkB,GAClB,oBAAoB,GACpB,iBAAiB,GACjB,kBAAkB,CAAC;AAEvB;;;;;;;;;GASG;AACH,MAAM,MAAM,iBAAiB,GACzB,WAAW,GACX,QAAQ,GACR,QAAQ,GACR,UAAU,GACV,YAAY,GACZ,SAAS,GACT,UAAU,GACV,KAAK,GACL,MAAM,GACN,WAAW,CAAC;AAEhB;;;;;;;;;;GAUG;AACH,MAAM,MAAM,UAAU,GAAG,iBAAiB,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provider identity and API protocol types for the unified LLM provider architecture.
|
|
3
|
+
*
|
|
4
|
+
* These types anchor the Phase 4 contract layer (ADR-072). All downstream code
|
|
5
|
+
* that references a provider by name or by wire-protocol uses these types.
|
|
6
|
+
*
|
|
7
|
+
* @module llm/provider-id
|
|
8
|
+
* @task T9281
|
|
9
|
+
* @epic T9261 T-LLM-CRED-CENTRALIZATION
|
|
10
|
+
* @see ADR-072 §Type lock-in
|
|
11
|
+
*/
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=provider-id.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider-id.js","sourceRoot":"","sources":["../../src/llm/provider-id.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG"}
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* @epic T9261 (T-LLM-CRED-CENTRALIZATION Phase 3)
|
|
11
11
|
*/
|
|
12
12
|
import type { ModelTransport, StoredAuthTypeWire } from '../operations/llm.js';
|
|
13
|
+
import type { TransportMessage, TransportTool } from './normalized-response.js';
|
|
13
14
|
/**
|
|
14
15
|
* Describes a single LLM provider — its auth capabilities, base URL,
|
|
15
16
|
* default model, and optional live model-discovery hook.
|
|
@@ -75,6 +76,57 @@ export interface ProviderProfile {
|
|
|
75
76
|
* @param signal - Optional abort signal for request cancellation.
|
|
76
77
|
*/
|
|
77
78
|
fetchModels?: (apiKey: string, signal?: AbortSignal) => Promise<ReadonlyArray<string> | null>;
|
|
79
|
+
/**
|
|
80
|
+
* Hook: transform messages before they are passed to the SDK.
|
|
81
|
+
*
|
|
82
|
+
* Default behavior (when `undefined`): identity — messages are forwarded
|
|
83
|
+
* unchanged. Providers use this hook for shape conversions such as:
|
|
84
|
+
* - Gemini: hoisting the system message to `systemInstruction`.
|
|
85
|
+
* - Anthropic: injecting an assistant-prefill block for structured output.
|
|
86
|
+
* - OpenAI o-series: merging consecutive same-role messages.
|
|
87
|
+
*
|
|
88
|
+
* Port of Hermes `ProviderProfile.prepare_messages` (Hermes §3.1).
|
|
89
|
+
*
|
|
90
|
+
* @param messages - The transport-level messages prior to provider conversion.
|
|
91
|
+
* @param model - The resolved model identifier.
|
|
92
|
+
* @returns Possibly-modified messages array. Implementations MUST NOT mutate
|
|
93
|
+
* the input array; return a new array if changes are needed.
|
|
94
|
+
*/
|
|
95
|
+
readonly prepareMessages?: (messages: readonly TransportMessage[], model: string) => readonly TransportMessage[];
|
|
96
|
+
/**
|
|
97
|
+
* Hook: contribute provider-specific extra body fields.
|
|
98
|
+
*
|
|
99
|
+
* The returned object is merged into the SDK request's `extra_body`
|
|
100
|
+
* (OpenAI-style) or equivalent provider field. Providers use this for:
|
|
101
|
+
* - Gemini: `thinkingConfig` for extended reasoning budget.
|
|
102
|
+
* - OpenRouter: Pareto router plugin parameters.
|
|
103
|
+
* - Anthropic-via-OpenRouter: fine-grained tool streaming control.
|
|
104
|
+
*
|
|
105
|
+
* Port of Hermes `ProviderProfile.build_extra_body`.
|
|
106
|
+
*
|
|
107
|
+
* @param model - The resolved model identifier.
|
|
108
|
+
* @param messages - The transport-level messages at call time.
|
|
109
|
+
* @param tools - The tool definitions at call time.
|
|
110
|
+
* @returns Object merged into the provider request's `extra_body` field.
|
|
111
|
+
*/
|
|
112
|
+
readonly buildExtraBody?: (model: string, messages: readonly TransportMessage[], tools: readonly TransportTool[]) => Readonly<Record<string, unknown>>;
|
|
113
|
+
/**
|
|
114
|
+
* Hook: contribute provider-specific top-level API kwargs.
|
|
115
|
+
*
|
|
116
|
+
* The returned object is shallow-merged into the SDK call kwargs. Providers
|
|
117
|
+
* use this for top-level fields that do not fit into `extra_body`:
|
|
118
|
+
* - xAI Grok: `x-grok-conv-id` conversation pinning header.
|
|
119
|
+
* - Kimi: `reasoning_effort` top-level reasoning control.
|
|
120
|
+
* - Moonshot: JSON-schema sanitization applied at the request level.
|
|
121
|
+
*
|
|
122
|
+
* Port of Hermes `ProviderProfile.build_api_kwargs_extras`.
|
|
123
|
+
*
|
|
124
|
+
* @param model - The resolved model identifier.
|
|
125
|
+
* @param messages - The transport-level messages at call time.
|
|
126
|
+
* @param tools - The tool definitions at call time.
|
|
127
|
+
* @returns Object shallow-merged into the SDK call kwargs.
|
|
128
|
+
*/
|
|
129
|
+
readonly buildApiKwargsExtras?: (model: string, messages: readonly TransportMessage[], tools: readonly TransportTool[]) => Readonly<Record<string, unknown>>;
|
|
78
130
|
}
|
|
79
131
|
/**
|
|
80
132
|
* Shape that user plugin modules MUST satisfy.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider-profile.d.ts","sourceRoot":"","sources":["../../src/llm/provider-profile.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"provider-profile.d.ts","sourceRoot":"","sources":["../../src/llm/provider-profile.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC/E,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEhF;;;;;;;GAOG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;OAIG;IACH,IAAI,EAAE,cAAc,GAAG,MAAM,CAAC;IAE9B,0EAA0E;IAC1E,WAAW,EAAE,MAAM,CAAC;IAEpB,qDAAqD;IACrD,SAAS,EAAE,aAAa,CAAC,kBAAkB,CAAC,CAAC;IAE7C;;;;OAIG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;;;OAIG;IACH,YAAY,EAAE,MAAM,CAAC;IAErB;;;;OAIG;IACH,OAAO,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAEhC;;;;;OAKG;IACH,cAAc,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAElD;;;;;;;;OAQG;IACH,OAAO,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAEhC;;;;;;;;;OASG;IACH,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC;IAE9F;;;;;;;;;;;;;;;OAeG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,CACzB,QAAQ,EAAE,SAAS,gBAAgB,EAAE,EACrC,KAAK,EAAE,MAAM,KACV,SAAS,gBAAgB,EAAE,CAAC;IAEjC;;;;;;;;;;;;;;;OAeG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,CACxB,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,SAAS,gBAAgB,EAAE,EACrC,KAAK,EAAE,SAAS,aAAa,EAAE,KAC5B,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAEvC;;;;;;;;;;;;;;;OAeG;IACH,QAAQ,CAAC,oBAAoB,CAAC,EAAE,CAC9B,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,SAAS,gBAAgB,EAAE,EACrC,KAAK,EAAE,SAAS,aAAa,EAAE,KAC5B,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACxC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,WAAW,cAAc;IAC7B,uEAAuE;IACvE,QAAQ,EAAE,CAAC,GAAG,EAAE,iBAAiB,KAAK,IAAI,CAAC;CAC5C;AAED;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,uEAAuE;IACvE,gBAAgB,EAAE,CAAC,OAAO,EAAE,eAAe,KAAK,IAAI,CAAC;CACtD"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fully-resolved credential type for the unified LLM provider architecture.
|
|
3
|
+
*
|
|
4
|
+
* This type replaces the partial `CredentialResultWire` at the runtime level.
|
|
5
|
+
* `CredentialResultWire` is retained solely as a wire diagnostic type for
|
|
6
|
+
* `cleo llm whoami` CLI output.
|
|
7
|
+
*
|
|
8
|
+
* @module llm/resolved-credential
|
|
9
|
+
* @task T9281
|
|
10
|
+
* @epic T9261 T-LLM-CRED-CENTRALIZATION
|
|
11
|
+
* @see ADR-072 §Type lock-in
|
|
12
|
+
*/
|
|
13
|
+
import type { ProviderId } from './provider-id.js';
|
|
14
|
+
/**
|
|
15
|
+
* Fully-resolved credential ready for use in a transport constructor.
|
|
16
|
+
*
|
|
17
|
+
* The transport consumes this at construction time and MUST NOT store it
|
|
18
|
+
* beyond initialization. {@link extraHeaders} is merged into SDK
|
|
19
|
+
* defaultHeaders.
|
|
20
|
+
*
|
|
21
|
+
* Replaces the partial `CredentialResultWire` for runtime use.
|
|
22
|
+
* `CredentialResultWire` is retained as a wire diagnostic type for
|
|
23
|
+
* `cleo llm whoami` CLI output only.
|
|
24
|
+
*
|
|
25
|
+
* @see ADR-072 §Type lock-in
|
|
26
|
+
*/
|
|
27
|
+
export interface ResolvedCredential {
|
|
28
|
+
/** Provider this credential targets. */
|
|
29
|
+
readonly provider: ProviderId;
|
|
30
|
+
/** Human-readable store label (e.g. 'personal', 'work'). */
|
|
31
|
+
readonly label: string;
|
|
32
|
+
/**
|
|
33
|
+
* API key, OAuth bearer token, or empty string for aws_sdk auth.
|
|
34
|
+
* NEVER log this field. NEVER include in NormalizedResponse.providerData.
|
|
35
|
+
*/
|
|
36
|
+
readonly token: string;
|
|
37
|
+
/** How the token is presented to the provider. */
|
|
38
|
+
readonly authType: 'api_key' | 'oauth' | 'aws_sdk';
|
|
39
|
+
/**
|
|
40
|
+
* Unix epoch ms at which the token expires. null = never expires.
|
|
41
|
+
* LlmSession checks this before each send() and triggers OAuth refresh
|
|
42
|
+
* when less than 60 seconds remain.
|
|
43
|
+
*/
|
|
44
|
+
readonly expiresAt: number | null;
|
|
45
|
+
/**
|
|
46
|
+
* OAuth refresh token. null for api_key and aws_sdk credentials.
|
|
47
|
+
* LlmSession holds this; the transport never sees it.
|
|
48
|
+
*/
|
|
49
|
+
readonly refreshToken: string | null;
|
|
50
|
+
/**
|
|
51
|
+
* Extra HTTP headers merged into every SDK request from this credential.
|
|
52
|
+
* Typically carries 'Authorization: Bearer ...' for oauth authType,
|
|
53
|
+
* and 'anthropic-beta: ...' when needed.
|
|
54
|
+
*/
|
|
55
|
+
readonly extraHeaders: Readonly<Record<string, string>>;
|
|
56
|
+
/** Base URL override (proxy, on-prem deployment). null = use provider default. */
|
|
57
|
+
readonly baseUrl: string | null;
|
|
58
|
+
/** AWS profile name for Bedrock. null for all other providers. */
|
|
59
|
+
readonly awsProfile: string | null;
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=resolved-credential.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolved-credential.d.ts","sourceRoot":"","sources":["../../src/llm/resolved-credential.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,kBAAkB;IACjC,wCAAwC;IACxC,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAC;IAC9B,4DAA4D;IAC5D,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,kDAAkD;IAClD,QAAQ,CAAC,QAAQ,EAAE,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;IACnD;;;;OAIG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC;;;OAGG;IACH,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC;;;;OAIG;IACH,QAAQ,CAAC,YAAY,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACxD,kFAAkF;IAClF,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,kEAAkE;IAClE,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CACpC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fully-resolved credential type for the unified LLM provider architecture.
|
|
3
|
+
*
|
|
4
|
+
* This type replaces the partial `CredentialResultWire` at the runtime level.
|
|
5
|
+
* `CredentialResultWire` is retained solely as a wire diagnostic type for
|
|
6
|
+
* `cleo llm whoami` CLI output.
|
|
7
|
+
*
|
|
8
|
+
* @module llm/resolved-credential
|
|
9
|
+
* @task T9281
|
|
10
|
+
* @epic T9261 T-LLM-CRED-CENTRALIZATION
|
|
11
|
+
* @see ADR-072 §Type lock-in
|
|
12
|
+
*/
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=resolved-credential.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolved-credential.js","sourceRoot":"","sources":["../../src/llm/resolved-credential.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG"}
|
package/dist/operations/llm.d.ts
CHANGED
|
@@ -8,8 +8,20 @@
|
|
|
8
8
|
* @task T1399 (T1386-W13)
|
|
9
9
|
* @epic T1386
|
|
10
10
|
*/
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
import type { BuiltinProviderId, ProviderId } from '../llm/provider-id.js';
|
|
12
|
+
/**
|
|
13
|
+
* @deprecated since Phase 4 (ADR-072). Use {@link ProviderId} from
|
|
14
|
+
* `@cleocode/contracts/llm/provider-id.js` for new code. This alias remains
|
|
15
|
+
* for one release cycle to ease migration of legacy callers, then is removed.
|
|
16
|
+
*
|
|
17
|
+
* The alias resolves to {@link BuiltinProviderId} — a superset of the previous
|
|
18
|
+
* closed literal union (`'anthropic' | 'openai' | 'gemini' | 'moonshot'`).
|
|
19
|
+
* All existing consumers that pattern-match on the previous four values continue
|
|
20
|
+
* to compile without changes.
|
|
21
|
+
*
|
|
22
|
+
* @see ADR-072 §Type lock-in — ModelTransport deprecation cycle
|
|
23
|
+
*/
|
|
24
|
+
export type ModelTransport = Extract<ProviderId, BuiltinProviderId>;
|
|
13
25
|
/** Cache policy mode for prompt prefix caching. */
|
|
14
26
|
export type PromptCachePolicyMode = 'gemini_cached_content';
|
|
15
27
|
/** Prompt caching policy descriptor. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"llm.d.ts","sourceRoot":"","sources":["../../src/operations/llm.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,
|
|
1
|
+
{"version":3,"file":"llm.d.ts","sourceRoot":"","sources":["../../src/operations/llm.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAE3E;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,CAAC,UAAU,EAAE,iBAAiB,CAAC,CAAC;AAEpE,mDAAmD;AACnD,MAAM,MAAM,qBAAqB,GAAG,uBAAuB,CAAC;AAE5D,wCAAwC;AACxC,MAAM,WAAW,iBAAiB;IAChC,qEAAqE;IACrE,IAAI,EAAE,qBAAqB,CAAC;IAC5B,4DAA4D;IAC5D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,0CAA0C;IAC1C,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,iDAAiD;AACjD,MAAM,WAAW,WAAW;IAC1B,8BAA8B;IAC9B,SAAS,EAAE,cAAc,CAAC;IAC1B,uFAAuF;IACvF,KAAK,EAAE,MAAM,CAAC;IACd,oDAAoD;IACpD,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,6CAA6C;IAC7C,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,4BAA4B;IAC5B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,eAAe,CA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e;IAC9B,wEAAwE;IACxE,OAAO,EAAE,cAAc,EAAE,CAAC;CAC3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"llm.js","sourceRoot":"","sources":["../../src/operations/llm.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;;
|
|
1
|
+
{"version":3,"file":"llm.js","sourceRoot":"","sources":["../../src/operations/llm.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;;AA6iBH,wEAAwE;AACxE,+EAA+E;AAC/E,uEAAuE;AACvE,sDAAsD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cleocode/contracts",
|
|
3
|
-
"version": "2026.5.
|
|
3
|
+
"version": "2026.5.67",
|
|
4
4
|
"description": "Domain types, interfaces, and contracts for the CLEO ecosystem",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"dependencies": {
|
|
91
91
|
"zod": "^4.3.6",
|
|
92
92
|
"zod-to-json-schema": "^3.25.2",
|
|
93
|
-
"@cleocode/lafs": "2026.5.
|
|
93
|
+
"@cleocode/lafs": "2026.5.67"
|
|
94
94
|
},
|
|
95
95
|
"scripts": {
|
|
96
96
|
"build": "tsc -b --force && node scripts/emit-schemas.mjs",
|
package/src/index.ts
CHANGED
|
@@ -428,6 +428,23 @@ export {
|
|
|
428
428
|
} from './lafs.js';
|
|
429
429
|
// === LLM Error Taxonomy (T9270 — Hermes FailoverReason port) ===
|
|
430
430
|
export type { ClassifiedError, FailoverReason } from './llm/failover-reason.js';
|
|
431
|
+
// === Phase 4 Unified Architecture (T9281 / ADR-072) — Session + Executor interfaces ===
|
|
432
|
+
export type {
|
|
433
|
+
AggregatedUsage,
|
|
434
|
+
ExecutionEvent,
|
|
435
|
+
ExecutionRequest,
|
|
436
|
+
ExecutorFactoryOptions,
|
|
437
|
+
LlmExecutor,
|
|
438
|
+
LlmExecutorFactory,
|
|
439
|
+
LlmSession,
|
|
440
|
+
LlmSessionFactory,
|
|
441
|
+
NormalizedDelta,
|
|
442
|
+
RetryPolicy,
|
|
443
|
+
SendOptions,
|
|
444
|
+
SessionFactoryOptions,
|
|
445
|
+
ToolCall,
|
|
446
|
+
TransportContext,
|
|
447
|
+
} from './llm/interfaces.js';
|
|
431
448
|
// === Normalized LLM Transport Types (T9263 — Phase 3 T-LLM-CRED) ===
|
|
432
449
|
// Note: LlmTransport (the interface) is intentionally NOT re-exported at the
|
|
433
450
|
// top level here because `config.ts` already exports `LlmTransport` as a type
|
|
@@ -442,12 +459,16 @@ export type {
|
|
|
442
459
|
TransportRequest,
|
|
443
460
|
TransportTool,
|
|
444
461
|
} from './llm/normalized-response.js';
|
|
462
|
+
// === Phase 4 Unified Architecture (T9281 / ADR-072) — Provider identity ===
|
|
463
|
+
export type { ApiMode, BuiltinProviderId, ProviderId } from './llm/provider-id.js';
|
|
445
464
|
// === Provider Profile + Plugin Contracts (T9262 — Phase 3 T-LLM-CRED) ===
|
|
446
465
|
export type {
|
|
447
466
|
ProviderPlugin,
|
|
448
467
|
ProviderPluginApi,
|
|
449
468
|
ProviderProfile,
|
|
450
469
|
} from './llm/provider-profile.js';
|
|
470
|
+
// === Phase 4 Unified Architecture (T9281 / ADR-072) — Resolved credential ===
|
|
471
|
+
export type { ResolvedCredential } from './llm/resolved-credential.js';
|
|
451
472
|
export type {
|
|
452
473
|
BridgeDecision,
|
|
453
474
|
BridgeLearning,
|