@combycode/llm-sdk 2.0.0 → 2.1.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 +214 -5
- package/dist/agent/context-registry/layers.d.ts +19 -0
- package/dist/agent/lazy-tools.d.ts +85 -0
- package/dist/agent/loop-config.d.ts +9 -0
- package/dist/agent/loop.d.ts +27 -1
- package/dist/agent/types.d.ts +23 -2
- package/dist/bus/hook-map.d.ts +14 -0
- package/dist/helpers/define-tool.d.ts +15 -6
- package/dist/helpers/engine.d.ts +17 -1
- package/dist/helpers/mcp.d.ts +9 -0
- package/dist/helpers/moderate.d.ts +13 -1
- package/dist/helpers/one-shot.d.ts +19 -0
- package/dist/index.browser.js +417 -30
- package/dist/index.d.ts +10 -3
- package/dist/index.js +417 -30
- package/dist/llm/types/schema-utils.d.ts +19 -0
- package/dist/network/engine.d.ts +10 -2
- package/dist/network/queue-state-config.d.ts +10 -2
- package/dist/plugins/cost-collector/collector.d.ts +12 -0
- package/dist/plugins/cost-collector/cost-collector-types.d.ts +8 -0
- package/dist/plugins/mcp/result-cache.d.ts +8 -1
- package/dist/plugins/mcp/tools.d.ts +2 -0
- package/dist/plugins/mcp/types.d.ts +43 -0
- package/package.json +5 -2
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
* LLMClient.complete. Either way the helper destroys its created client
|
|
16
16
|
* before returning so callers don't leak. */
|
|
17
17
|
import type { AgentTool } from '../agent/types';
|
|
18
|
+
import type { CacheConfig } from '../llm/types/request';
|
|
18
19
|
import type { LLMClientConfig } from '../llm/client-config';
|
|
19
20
|
import type { AudioOptions } from '../llm/types/audio';
|
|
20
21
|
import type { ContentPart, Message } from '../llm/types/messages';
|
|
@@ -51,6 +52,12 @@ export interface CompleteOptions {
|
|
|
51
52
|
/** Generation control. */
|
|
52
53
|
maxTokens?: number;
|
|
53
54
|
temperature?: number;
|
|
55
|
+
/** Top-k sampling. Emitted only where the wire accepts it (Anthropic, Google, xAI,
|
|
56
|
+
* OpenRouter) and dropped for OpenAI, which defines no top-k. */
|
|
57
|
+
topK?: number;
|
|
58
|
+
/** Best-effort deterministic sampling. Dropped on Anthropic, which has no seed.
|
|
59
|
+
* Determinism is never guaranteed. */
|
|
60
|
+
seed?: number;
|
|
54
61
|
structured?: {
|
|
55
62
|
schema: Record<string, unknown>;
|
|
56
63
|
name?: string;
|
|
@@ -63,6 +70,13 @@ export interface CompleteOptions {
|
|
|
63
70
|
/** Service tier for this call. Also settable as a `model:tier` suffix (e.g.
|
|
64
71
|
* `anthropic/claude-opus-4.8:priority`); an explicit value here wins. */
|
|
65
72
|
serviceTier?: ServiceTier;
|
|
73
|
+
/** Provider prompt caching: `'auto'`, `'off'`, or which segments to mark
|
|
74
|
+
* (`{ system: true, tools: true }`).
|
|
75
|
+
*
|
|
76
|
+
* It matters most exactly where this helper is convenient — a long system
|
|
77
|
+
* prompt or a large tool block, both of which sit at the front of the request
|
|
78
|
+
* and are the cheapest part to cache. */
|
|
79
|
+
cache?: CacheConfig;
|
|
66
80
|
/** Optional engine to use. Falls back to coreRegistry default. */
|
|
67
81
|
engine?: EngineHandle;
|
|
68
82
|
/** Provider-specific request options (e.g. `{ openrouter: { models: [...] } }`). */
|
|
@@ -83,6 +97,11 @@ export interface CompleteResult<T = unknown> {
|
|
|
83
97
|
* otherwise `undefined`. The generic on `complete<T>(...)` types this. */
|
|
84
98
|
parsed?: T;
|
|
85
99
|
response: CompletionResponse;
|
|
100
|
+
/** In-band provider failure. Some providers report a failed generation IN the
|
|
101
|
+
* response rather than by throwing (OpenAI Responses `status: 'failed'`, Google
|
|
102
|
+
* Interactions likewise), so a caller that only catches sees empty text and no
|
|
103
|
+
* exception — a failure indistinguishable from a successful empty answer. */
|
|
104
|
+
error?: CompletionResponse['error'];
|
|
86
105
|
/** Fetch a hosted-tool output file (from `response.files`): bytes (`Blob`) +
|
|
87
106
|
* `name` / `mimeType` / `size` — bound to the SAME model + key this call used. */
|
|
88
107
|
retrieveFile(file: FileOutput): Promise<RetrievedFile>;
|