@namzu/sdk 64.3.0 → 65.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 +24 -0
- package/dist/advisory/executor.d.ts +2 -1
- package/dist/advisory/executor.d.ts.map +1 -1
- package/dist/advisory/executor.js +8 -2
- package/dist/advisory/executor.js.map +1 -1
- package/dist/agents/explore.js +1 -1
- package/dist/agents/explore.js.map +1 -1
- package/dist/agents/plan.js +1 -1
- package/dist/agents/plan.js.map +1 -1
- package/dist/compaction/context-window.d.ts.map +1 -1
- package/dist/compaction/context-window.js +9 -2
- package/dist/compaction/context-window.js.map +1 -1
- package/dist/eval/judge.d.ts.map +1 -1
- package/dist/eval/judge.js +6 -2
- package/dist/eval/judge.js.map +1 -1
- package/dist/manager/agent/lifecycle.d.ts +1 -0
- package/dist/manager/agent/lifecycle.d.ts.map +1 -1
- package/dist/manager/agent/lifecycle.js +20 -6
- package/dist/manager/agent/lifecycle.js.map +1 -1
- package/dist/manager/session/turn-recorder.d.ts.map +1 -1
- package/dist/manager/session/turn-recorder.js +11 -2
- package/dist/manager/session/turn-recorder.js.map +1 -1
- package/dist/prompt/coding-agent-doctrine.d.ts +2 -2
- package/dist/prompt/coding-agent-doctrine.d.ts.map +1 -1
- package/dist/prompt/coding-agent-doctrine.js +39 -38
- package/dist/prompt/coding-agent-doctrine.js.map +1 -1
- package/dist/provider/fallback.d.ts.map +1 -1
- package/dist/provider/fallback.js +4 -3
- package/dist/provider/fallback.js.map +1 -1
- package/dist/provider/idle-timeout.js +1 -1
- package/dist/provider/idle-timeout.js.map +1 -1
- package/dist/provider/instrumentation.js +1 -1
- package/dist/provider/instrumentation.js.map +1 -1
- package/dist/provider/retry.js +1 -1
- package/dist/provider/retry.js.map +1 -1
- package/dist/provider/side-request-reasoning.d.ts +32 -0
- package/dist/provider/side-request-reasoning.d.ts.map +1 -0
- package/dist/provider/side-request-reasoning.js +97 -0
- package/dist/provider/side-request-reasoning.js.map +1 -0
- package/dist/public-runtime.d.ts +3 -1
- package/dist/public-runtime.d.ts.map +1 -1
- package/dist/public-runtime.js +2 -1
- package/dist/public-runtime.js.map +1 -1
- package/dist/runtime/query/auto-review/classifier.d.ts.map +1 -1
- package/dist/runtime/query/auto-review/classifier.js +8 -2
- package/dist/runtime/query/auto-review/classifier.js.map +1 -1
- package/dist/runtime/query/callback-inference.d.ts.map +1 -1
- package/dist/runtime/query/callback-inference.js +14 -3
- package/dist/runtime/query/callback-inference.js.map +1 -1
- package/dist/runtime/query/iteration/index.d.ts +17 -0
- package/dist/runtime/query/iteration/index.d.ts.map +1 -1
- package/dist/runtime/query/iteration/index.js +82 -10
- package/dist/runtime/query/iteration/index.js.map +1 -1
- package/dist/runtime/query/prepare-turn.d.ts.map +1 -1
- package/dist/runtime/query/prepare-turn.js +3 -0
- package/dist/runtime/query/prepare-turn.js.map +1 -1
- package/dist/runtime/query/repeat-call.js +2 -2
- package/dist/runtime/query/repeat-call.js.map +1 -1
- package/dist/runtime/query/turn/stall-monitor.d.ts +47 -2
- package/dist/runtime/query/turn/stall-monitor.d.ts.map +1 -1
- package/dist/runtime/query/turn/stall-monitor.js +72 -4
- package/dist/runtime/query/turn/stall-monitor.js.map +1 -1
- package/dist/turn/evidence-query.d.ts.map +1 -1
- package/dist/turn/evidence-query.js +7 -1
- package/dist/turn/evidence-query.js.map +1 -1
- package/dist/types/common/index.d.ts +14 -0
- package/dist/types/common/index.d.ts.map +1 -1
- package/dist/types/common/index.js +7 -0
- package/dist/types/common/index.js.map +1 -1
- package/dist/types/provider/config.d.ts +6 -0
- package/dist/types/provider/config.d.ts.map +1 -1
- package/dist/types/provider/interface.d.ts +8 -6
- package/dist/types/provider/interface.d.ts.map +1 -1
- package/dist/types/session/prepare-step.d.ts +7 -0
- package/dist/types/session/prepare-step.d.ts.map +1 -1
- package/dist/utils/cost.d.ts +14 -0
- package/dist/utils/cost.d.ts.map +1 -1
- package/dist/utils/cost.js +20 -0
- package/dist/utils/cost.js.map +1 -1
- package/package.json +1 -1
- package/src/advisory/executor.ts +13 -2
- package/src/agents/explore.ts +1 -1
- package/src/agents/plan.ts +1 -1
- package/src/compaction/context-window.ts +9 -2
- package/src/eval/judge.ts +16 -9
- package/src/manager/agent/lifecycle.ts +19 -6
- package/src/manager/session/turn-recorder.ts +12 -1
- package/src/prompt/coding-agent-doctrine.ts +40 -39
- package/src/provider/fallback.ts +4 -3
- package/src/provider/idle-timeout.ts +1 -1
- package/src/provider/instrumentation.ts +1 -1
- package/src/provider/retry.ts +1 -1
- package/src/provider/side-request-reasoning.ts +121 -0
- package/src/public-runtime.ts +7 -0
- package/src/runtime/query/auto-review/classifier.ts +17 -9
- package/src/runtime/query/callback-inference.ts +13 -3
- package/src/runtime/query/iteration/index.ts +93 -12
- package/src/runtime/query/prepare-turn.ts +2 -0
- package/src/runtime/query/repeat-call.ts +2 -2
- package/src/runtime/query/turn/stall-monitor.ts +92 -4
- package/src/turn/evidence-query.ts +8 -1
- package/src/types/common/index.ts +22 -0
- package/src/types/provider/config.ts +6 -0
- package/src/types/provider/interface.ts +8 -6
- package/src/types/session/prepare-step.ts +7 -0
- package/src/utils/cost.ts +24 -0
|
@@ -183,15 +183,17 @@ export interface LLMProvider {
|
|
|
183
183
|
* Whether `model` takes a forced tool choice (`toolChoice: 'required'` or a
|
|
184
184
|
* named function) under the thinking configuration the request will carry.
|
|
185
185
|
*
|
|
186
|
-
* The kernel asks before
|
|
187
|
-
* and when the answer is `
|
|
188
|
-
*
|
|
186
|
+
* The kernel asks before a guard requires a tool call on a step it wants to
|
|
187
|
+
* act, and sends a forced choice only when the answer is `true` and the
|
|
188
|
+
* request does not turn thinking on. Otherwise it keeps the step at low effort
|
|
189
|
+
* and asks the model in words. `effort`
|
|
189
190
|
* is the level the request will carry, for a driver where the level also
|
|
190
191
|
* decides whether thinking is on (a provider that does not need it ignores
|
|
191
192
|
* it). Optional:
|
|
192
|
-
* a provider that does not declare it is
|
|
193
|
-
*
|
|
194
|
-
* forwards it
|
|
193
|
+
* a provider that does not declare it is not sent a guard's forced choice (the
|
|
194
|
+
* words are used). A host's own `toolChoice` is sent as given. A wrapper that
|
|
195
|
+
* rebuilds a provider forwards it; a chain answers `true` only when every
|
|
196
|
+
* member does.
|
|
195
197
|
*/
|
|
196
198
|
acceptsForcedToolChoiceFor?(
|
|
197
199
|
model: string,
|
|
@@ -33,6 +33,13 @@ export interface PreparationTextResult {
|
|
|
33
33
|
readonly text: string
|
|
34
34
|
readonly usage: TokenUsage
|
|
35
35
|
readonly servedBy: StepProvenance
|
|
36
|
+
/**
|
|
37
|
+
* Why the provider stopped. `'length'` means the answer allowance ran out,
|
|
38
|
+
* which on a reasoning model can leave `text` empty or cut off mid-way; a
|
|
39
|
+
* caller that needs complete text treats it as no answer. Absent when the
|
|
40
|
+
* provider reported none.
|
|
41
|
+
*/
|
|
42
|
+
readonly finishReason?: 'stop' | 'tool_calls' | 'length' | 'content_filter'
|
|
36
43
|
}
|
|
37
44
|
|
|
38
45
|
/**
|
package/src/utils/cost.ts
CHANGED
|
@@ -241,6 +241,30 @@ export function accumulateUnpricedCost(current: CostInfo, additionalUsage: Token
|
|
|
241
241
|
}
|
|
242
242
|
}
|
|
243
243
|
|
|
244
|
+
/**
|
|
245
|
+
* Record a call whose cost the provider reported.
|
|
246
|
+
*
|
|
247
|
+
* The vendor's figure is what the account was charged, so it wins over a rate
|
|
248
|
+
* card: a card is an estimate of one model at one list price, while the report
|
|
249
|
+
* already includes the route that served the call, the cache discount and any
|
|
250
|
+
* tier. The rate fields go, as for unpriced tokens: no single card describes
|
|
251
|
+
* a total that holds a reported figure.
|
|
252
|
+
*/
|
|
253
|
+
export function accumulateReportedCost(current: CostInfo, reportedCostUsd: number): CostInfo {
|
|
254
|
+
return {
|
|
255
|
+
totalCost: current.totalCost + reportedCostUsd,
|
|
256
|
+
cacheDiscount: current.cacheDiscount,
|
|
257
|
+
unpricedTokens: current.unpricedTokens,
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/** Whether a usage frame carries a usable vendor-reported cost. */
|
|
262
|
+
export function hasReportedCost(
|
|
263
|
+
usage: TokenUsage,
|
|
264
|
+
): usage is TokenUsage & { reportedCostUsd: number } {
|
|
265
|
+
return Number.isFinite(usage.reportedCostUsd) && (usage.reportedCostUsd as number) >= 0
|
|
266
|
+
}
|
|
267
|
+
|
|
244
268
|
export function formatCost(usd: number): string {
|
|
245
269
|
if (usd === 0) return '$0.00'
|
|
246
270
|
if (usd < 0.01) return `$${usd.toFixed(4)}`
|