@deepstrike/sdk 0.2.21 → 0.2.23
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/governance.d.ts +21 -0
- package/dist/governance.js +32 -0
- package/dist/harness/harness.d.ts +30 -0
- package/dist/harness/harness.js +40 -20
- package/dist/index.d.ts +2 -2
- package/dist/providers/anthropic.js +102 -15
- package/dist/runtime/runner.d.ts +21 -0
- package/dist/runtime/runner.js +423 -332
- package/dist/types.d.ts +37 -0
- package/package.json +2 -2
package/dist/types.d.ts
CHANGED
|
@@ -84,6 +84,15 @@ export interface UsageEvent extends StreamEvent {
|
|
|
84
84
|
cacheReadInputTokens?: number;
|
|
85
85
|
/** Prompt tokens written to cache this request (billed ~1.25x). Subset of inputTokens. */
|
|
86
86
|
cacheCreationInputTokens?: number;
|
|
87
|
+
/** I1: per-slot pro-rata attribution of `cacheReadInputTokens`. Estimated, not authoritative —
|
|
88
|
+
* Anthropic returns a single cache-read total, so the SDK divides it evenly across the slots
|
|
89
|
+
* that carried a `cache_control` breakpoint on the request. Missing when the provider doesn't
|
|
90
|
+
* honor `cache_control` (OpenAI-family auto-cache) or when no breakpoints were placed. */
|
|
91
|
+
cacheReadInputTokensBySlot?: {
|
|
92
|
+
system?: number;
|
|
93
|
+
tools?: number;
|
|
94
|
+
messages?: number;
|
|
95
|
+
};
|
|
87
96
|
}
|
|
88
97
|
export type ToolChunk = string | {
|
|
89
98
|
type: "text";
|
|
@@ -210,6 +219,34 @@ export interface RetryConfig {
|
|
|
210
219
|
*/
|
|
211
220
|
export type ProviderRunState = Record<string, unknown>;
|
|
212
221
|
export type ProviderProtocol = "anthropic-messages" | "openai-chat" | "openai-responses" | "gemini";
|
|
222
|
+
/**
|
|
223
|
+
* Strategy for placing Anthropic-protocol `cache_control` breakpoints across a request's
|
|
224
|
+
* static prefix (tools + system blocks) and rolling history (messages). Pass via the
|
|
225
|
+
* `extensions.cacheBreakpointStrategy` extension on every provider call; the runner already
|
|
226
|
+
* flows `RuntimeOptions.extensions` through, so setting it once on the runner propagates
|
|
227
|
+
* to every Anthropic-protocol call.
|
|
228
|
+
*
|
|
229
|
+
* Values:
|
|
230
|
+
* - `"default"` — current production behavior: a breakpoint on the last tool (when system
|
|
231
|
+
* is rendered as a string), one on each system block (when system blocks are present),
|
|
232
|
+
* and the rolling message pair (last message + frozen-prefix anchor or last preceding
|
|
233
|
+
* user turn).
|
|
234
|
+
* - `"tools-only"` — breakpoint on the last tool only. System blocks and history go
|
|
235
|
+
* uncached. Useful to isolate the tools-prefix cache contribution.
|
|
236
|
+
* - `"system-only"` — breakpoints on system blocks only. No tool, no history caching.
|
|
237
|
+
* Useful to isolate the system-prefix cache contribution.
|
|
238
|
+
* - `"frozen-prefix"` — breakpoints on the message history only, anchored at
|
|
239
|
+
* `frozenPrefixLen` (the compaction boundary, P1-E). Falls back to the last-message
|
|
240
|
+
* breakpoint when no frozen prefix is set. No tools, no system caching. Useful to
|
|
241
|
+
* stress-test the P1-E deep-anchor design.
|
|
242
|
+
* - `"none"` — no `cache_control` anywhere. The baseline for cache-hit attribution.
|
|
243
|
+
*
|
|
244
|
+
* Strategies that disable some breakpoints still keep the structural shape (e.g. system
|
|
245
|
+
* blocks remain text blocks rather than collapsing into a single string), so the only
|
|
246
|
+
* Δ between variants is which blocks carry `cache_control`. Unrecognised strings fall
|
|
247
|
+
* back to `"default"`.
|
|
248
|
+
*/
|
|
249
|
+
export type CacheBreakpointStrategy = "default" | "tools-only" | "system-only" | "frozen-prefix" | "none";
|
|
213
250
|
export interface ProviderDescriptor {
|
|
214
251
|
provider: string;
|
|
215
252
|
protocol: ProviderProtocol;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepstrike/sdk",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.23",
|
|
4
4
|
"description": "DeepStrike Node.js SDK",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@anthropic-ai/sdk": "^0.99.0",
|
|
23
|
-
"@deepstrike/core": "0.2.
|
|
23
|
+
"@deepstrike/core": "0.2.23",
|
|
24
24
|
"@google/generative-ai": "^0.24.1",
|
|
25
25
|
"openai": "^5.23.2"
|
|
26
26
|
},
|