@combycode/llm-sdk 2.3.0 → 3.0.0
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/CHANGELOG.md +373 -0
- package/MIGRATION.md +130 -0
- package/dist/bus/hook-bus.d.ts +13 -3
- package/dist/bus/hook-map.d.ts +24 -0
- package/dist/catalog/catalog.d.ts +8 -23
- package/dist/helpers/client-resolver.d.ts +21 -2
- package/dist/helpers/count-tokens.d.ts +1 -1
- package/dist/helpers/engine.d.ts +27 -5
- package/dist/index.browser.js +17131 -4291
- package/dist/index.d.ts +1 -1
- package/dist/index.js +17131 -4291
- package/dist/llm/client-config.d.ts +8 -0
- package/dist/llm/client.d.ts +2 -0
- package/dist/llm/providers/anthropic/batch.d.ts +13 -2
- package/dist/llm/providers/anthropic/constants.d.ts +8 -43
- package/dist/llm/providers/anthropic/files.d.ts +13 -2
- package/dist/llm/providers/anthropic/messages.d.ts +18 -1
- package/dist/llm/providers/google/batch.d.ts +14 -1
- package/dist/llm/providers/google/constants.d.ts +6 -15
- package/dist/llm/providers/google/embeddings.d.ts +8 -1
- package/dist/llm/providers/google/files.d.ts +19 -1
- package/dist/llm/providers/google/generate.d.ts +15 -1
- package/dist/llm/providers/google/interactions.d.ts +5 -1
- package/dist/llm/providers/google/media.d.ts +26 -3
- package/dist/llm/providers/openai/batch.d.ts +19 -2
- package/dist/llm/providers/openai/completions.d.ts +13 -1
- package/dist/llm/providers/openai/embeddings.d.ts +13 -1
- package/dist/llm/providers/openai/files.d.ts +13 -2
- package/dist/llm/providers/openai/media.d.ts +21 -1
- package/dist/llm/providers/openai/moderations.d.ts +11 -1
- package/dist/llm/providers/openai/realtime.d.ts +3 -0
- package/dist/llm/providers/openai/responses.d.ts +10 -2
- package/dist/llm/providers/openai/transcription.d.ts +7 -1
- package/dist/llm/providers/openrouter/completions.d.ts +5 -3
- package/dist/llm/providers/openrouter/embeddings.d.ts +3 -0
- package/dist/llm/providers/openrouter/media.d.ts +14 -4
- package/dist/llm/providers/openrouter/responses.d.ts +5 -3
- package/dist/llm/providers/xai/batch.d.ts +13 -2
- package/dist/llm/providers/xai/completions.d.ts +5 -3
- package/dist/llm/providers/xai/files.d.ts +13 -2
- package/dist/llm/providers/xai/media.d.ts +28 -10
- package/dist/llm/providers/xai/responses.d.ts +5 -3
- package/dist/llm/response-shape.d.ts +96 -0
- package/dist/llm/types/provider.d.ts +6 -0
- package/dist/llm/types/request.d.ts +5 -6
- package/dist/llm/wire-multipart.d.ts +26 -0
- package/dist/{wire/transforms.d.ts → llm/wire-transforms.d.ts} +11 -5
- package/dist/plugins/context-measurer/counter/count-api.d.ts +39 -5
- package/dist/plugins/context-measurer/counter/hybrid.d.ts +33 -0
- package/dist/plugins/context-measurer/counter/tiktoken.d.ts +7 -0
- package/dist/plugins/mcp/transport-http.d.ts +13 -7
- package/dist/plugins/mcp/wire-rules.d.ts +21 -0
- package/dist/plugins/retrieval/document-file.d.ts +15 -0
- package/dist/plugins/retrieval/hosted-google.d.ts +8 -3
- package/dist/plugins/retrieval/hosted-openai.d.ts +9 -1
- package/dist/plugins/retrieval/hosted-xai.d.ts +8 -2
- package/dist/wire/chat-specs.d.ts +32 -0
- package/dist/wire/inherit.d.ts +0 -4
- package/dist/wire/interpreter.d.ts +44 -1
- package/dist/wire/mcp-specs.d.ts +13 -0
- package/dist/wire/media-specs.d.ts +20 -0
- package/dist/wire/pins.d.ts +34 -0
- package/dist/wire/registry.d.ts +6 -4
- package/dist/wire/retrieval-specs.d.ts +14 -0
- package/dist/wire/service-specs.d.ts +18 -0
- package/dist/wire/utility-specs.d.ts +10 -0
- package/package.json +4 -1
package/dist/helpers/engine.d.ts
CHANGED
|
@@ -65,6 +65,9 @@ export interface EngineHandle {
|
|
|
65
65
|
* createMediaOutput, complete) read these to wire LLM clients without
|
|
66
66
|
* the caller passing apiKey explicitly. */
|
|
67
67
|
apiKeys: Partial<Record<ProviderName, string>>;
|
|
68
|
+
/** Whether clients built from this engine check response shapes. Read by
|
|
69
|
+
* `createLLM`; see `checkResponseShapes` on the options. */
|
|
70
|
+
checkResponseShapes: boolean;
|
|
68
71
|
/** Build an LLMClient bound to this engine.
|
|
69
72
|
*
|
|
70
73
|
* Exists so lower layers can obtain a client without importing the helpers
|
|
@@ -100,12 +103,31 @@ export interface EngineConfig {
|
|
|
100
103
|
/** Custom low-level fetch transport — forwarded to the NetworkEngine's queue
|
|
101
104
|
* (so retry/rate-limit/hooks still apply). Defaults to globalThis.fetch. */
|
|
102
105
|
fetch?: FetchFn;
|
|
103
|
-
/**
|
|
104
|
-
*
|
|
106
|
+
/** Warn when a provider's response stops looking like the one we learned to
|
|
107
|
+
* read: a field never seen before, a field that was always present and is now
|
|
108
|
+
* absent, or a discriminator carrying a value nothing branches on.
|
|
109
|
+
*
|
|
110
|
+
* OFF by default. It never changes what is parsed — it only emits `onWarning`,
|
|
111
|
+
* so subscribe with `hooks.on('onWarning', …)` and look for codes starting
|
|
112
|
+
* `response_shape_`. Each distinct finding is reported ONCE per client.
|
|
113
|
+
*
|
|
114
|
+
* Worth turning on in staging and in your test suite: response drift is the
|
|
115
|
+
* failure this library gives you the least warning about, because a renamed
|
|
116
|
+
* field still parses — into `undefined`. */
|
|
117
|
+
checkResponseShapes?: boolean;
|
|
118
|
+
/** Catalog wiring. **Defaults to the bundled provider catalogs.**
|
|
119
|
+
*
|
|
120
|
+
* The catalog is what the adapters read per model: which wire spec builds the
|
|
121
|
+
* request, what the model costs, which tokenizer counts it. Starting empty
|
|
122
|
+
* meant every one of those silently fell back — the id-derived spec, an
|
|
123
|
+
* unknown price, an estimated token count — and nothing said so. The data is
|
|
124
|
+
* statically imported either way, so leaving it unloaded saved no bytes.
|
|
125
|
+
*
|
|
126
|
+
* - undefined (default) / `true` / 'defaults' → every bundled catalog.json
|
|
105
127
|
* - existing ModelCatalog instance → use as-is
|
|
106
|
-
* - `{ entries: {...} }` →
|
|
107
|
-
* -
|
|
108
|
-
catalog?: ModelCatalog |
|
|
128
|
+
* - `{ entries: {...} }` → the given entries only
|
|
129
|
+
* - `false` / 'empty' → no entries. Everything falls back; say so on purpose. */
|
|
130
|
+
catalog?: ModelCatalog | boolean | 'defaults' | 'empty' | {
|
|
109
131
|
entries: Record<string, unknown>;
|
|
110
132
|
};
|
|
111
133
|
/** Per-provider API keys. Helpers consult this when no apiKey is passed
|