@namzu/sdk 21.1.0 → 22.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 +173 -0
- package/dist/advisory/executor.d.ts +9 -4
- package/dist/advisory/executor.d.ts.map +1 -1
- package/dist/advisory/executor.js +16 -9
- package/dist/advisory/executor.js.map +1 -1
- package/dist/agents/SupervisorAgent.d.ts.map +1 -1
- package/dist/agents/SupervisorAgent.js +12 -0
- package/dist/agents/SupervisorAgent.js.map +1 -1
- package/dist/constants/limits.d.ts +13 -0
- package/dist/constants/limits.d.ts.map +1 -1
- package/dist/constants/limits.js +14 -2
- package/dist/constants/limits.js.map +1 -1
- package/dist/manager/agent/lifecycle.d.ts +2 -2
- package/dist/manager/run/persistence.d.ts +37 -2
- package/dist/manager/run/persistence.d.ts.map +1 -1
- package/dist/manager/run/persistence.js +48 -7
- package/dist/manager/run/persistence.js.map +1 -1
- package/dist/pricing/catalogue.generated.d.ts +15 -0
- package/dist/pricing/catalogue.generated.d.ts.map +1 -0
- package/dist/pricing/catalogue.generated.js +293 -0
- package/dist/pricing/catalogue.generated.js.map +1 -0
- package/dist/pricing/index.d.ts +46 -0
- package/dist/pricing/index.d.ts.map +1 -0
- package/dist/pricing/index.js +70 -0
- package/dist/pricing/index.js.map +1 -0
- package/dist/public-runtime.d.ts +2 -1
- package/dist/public-runtime.d.ts.map +1 -1
- package/dist/public-runtime.js +6 -1
- package/dist/public-runtime.js.map +1 -1
- package/dist/public-types.d.ts +3 -1
- package/dist/public-types.d.ts.map +1 -1
- package/dist/run/LimitChecker.d.ts +10 -0
- package/dist/run/LimitChecker.d.ts.map +1 -1
- package/dist/run/LimitChecker.js +14 -2
- package/dist/run/LimitChecker.js.map +1 -1
- package/dist/runtime/query/checkpoint.d.ts +23 -2
- package/dist/runtime/query/checkpoint.d.ts.map +1 -1
- package/dist/runtime/query/checkpoint.js +24 -3
- package/dist/runtime/query/checkpoint.js.map +1 -1
- package/dist/runtime/query/guard.d.ts.map +1 -1
- package/dist/runtime/query/guard.js +1 -0
- package/dist/runtime/query/guard.js.map +1 -1
- package/dist/runtime/query/index.d.ts.map +1 -1
- package/dist/runtime/query/index.js +42 -0
- package/dist/runtime/query/index.js.map +1 -1
- package/dist/runtime/query/iteration/index.d.ts +44 -8
- package/dist/runtime/query/iteration/index.d.ts.map +1 -1
- package/dist/runtime/query/iteration/index.js +71 -13
- package/dist/runtime/query/iteration/index.js.map +1 -1
- package/dist/runtime/query/iteration/phases/advisory.d.ts.map +1 -1
- package/dist/runtime/query/iteration/phases/advisory.js +9 -1
- package/dist/runtime/query/iteration/phases/advisory.js.map +1 -1
- package/dist/runtime/query/iteration/phases/compaction.d.ts.map +1 -1
- package/dist/runtime/query/iteration/phases/compaction.js +11 -2
- package/dist/runtime/query/iteration/phases/compaction.js.map +1 -1
- package/dist/store/run/conformance.d.ts.map +1 -1
- package/dist/store/run/conformance.js +8 -2
- package/dist/store/run/conformance.js.map +1 -1
- package/dist/types/agent/supervisor.d.ts +29 -0
- package/dist/types/agent/supervisor.d.ts.map +1 -1
- package/dist/types/common/index.d.ts +38 -2
- package/dist/types/common/index.d.ts.map +1 -1
- package/dist/types/run/stop-reason.d.ts +31 -1
- package/dist/types/run/stop-reason.d.ts.map +1 -1
- package/dist/utils/cost.d.ts +60 -2
- package/dist/utils/cost.d.ts.map +1 -1
- package/dist/utils/cost.js +126 -11
- package/dist/utils/cost.js.map +1 -1
- package/package.json +1 -1
- package/src/advisory/executor.ts +16 -9
- package/src/agents/SupervisorAgent.ts +12 -0
- package/src/constants/limits.ts +14 -2
- package/src/manager/agent/lifecycle.ts +2 -2
- package/src/manager/run/persistence.ts +67 -7
- package/src/pricing/catalogue.generated.ts +308 -0
- package/src/pricing/index.ts +78 -0
- package/src/pricing/rates.source.json +206 -0
- package/src/public-runtime.ts +8 -0
- package/src/public-types.ts +3 -1
- package/src/run/LimitChecker.ts +24 -2
- package/src/runtime/query/checkpoint.ts +24 -3
- package/src/runtime/query/guard.ts +1 -0
- package/src/runtime/query/index.ts +42 -0
- package/src/runtime/query/iteration/index.ts +76 -13
- package/src/runtime/query/iteration/phases/advisory.ts +9 -1
- package/src/runtime/query/iteration/phases/compaction.ts +12 -2
- package/src/store/run/conformance.ts +8 -2
- package/src/types/agent/supervisor.ts +30 -0
- package/src/types/common/index.ts +38 -2
- package/src/types/run/stop-reason.ts +30 -0
- package/src/utils/cost.ts +186 -16
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,178 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 22.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- a06ce07: A supervisor can be held to a schema, like the archetype beside it
|
|
8
|
+
|
|
9
|
+
`ReactiveAgent` has forwarded `structuredOutput` since the field existed.
|
|
10
|
+
`SupervisorAgentConfig` never declared it, and nothing in that file said why —
|
|
11
|
+
in a file where `maxDepth`, `allowDelegation`, `maxToolConcurrency` and
|
|
12
|
+
`siblingFailurePolicy` each carry a paragraph of argument for what they do and
|
|
13
|
+
do not cover. The kernel path is archetype-blind: `drainQuery` registers
|
|
14
|
+
`structured_output` from this config and the iteration loop captures it, so the
|
|
15
|
+
capability was always reachable through the raw kernel entry point and only the
|
|
16
|
+
hop from the surface hosts construct was missing.
|
|
17
|
+
|
|
18
|
+
Two hops were missing, in fact. `SupervisorAgent`'s result literal also did not
|
|
19
|
+
copy `run.structuredOutput`, while `ReactiveAgent`'s does —
|
|
20
|
+
`BaseAgentResult.structuredOutput` names "an archetype's result literal did not
|
|
21
|
+
copy it" as one of the defects it was written to close, and that defect was
|
|
22
|
+
still live in the sibling nobody checked. Wiring only the config would have
|
|
23
|
+
produced a settable field whose answer the host could not read.
|
|
24
|
+
|
|
25
|
+
**What this buys, stated plainly, because it is less than it sounds like.**
|
|
26
|
+
Structured output is terminal and exclusive by policy: `setStructuredOutput`
|
|
27
|
+
overwrites the run's result behind a sticky flag and the run ends on the turn
|
|
28
|
+
that produces the value. So this gives a supervisor a schema-constrained **final
|
|
29
|
+
answer** and nothing more. It does not shape a delegated child's answer — a
|
|
30
|
+
child carries its own config, so a host wanting typed worker results sets the
|
|
31
|
+
schema on the workers. It is not a return type for the fan-out, and it does not
|
|
32
|
+
arrive alongside prose.
|
|
33
|
+
|
|
34
|
+
One consequence a supervisor host in particular should know: because the answer
|
|
35
|
+
decides the run, delegated work still running when it lands is walked away from
|
|
36
|
+
rather than waited for. It is recorded — the run names it on `abandonedTaskIds`
|
|
37
|
+
— but no further turn delivers it. A supervisor that must read every child
|
|
38
|
+
before answering should wait for them and call `structured_output` after.
|
|
39
|
+
|
|
40
|
+
`minor`: additive. `SupervisorAgentConfig.structuredOutput` is optional and
|
|
41
|
+
`SupervisorAgentResult.structuredOutput` was already declared on
|
|
42
|
+
`BaseAgentResult`, so nothing narrows, nothing is renamed, and a supervisor
|
|
43
|
+
configured without a schema runs the path it ran before.
|
|
44
|
+
|
|
45
|
+
### Patch Changes
|
|
46
|
+
|
|
47
|
+
- 2249d89: A structured answer no longer settles a run on top of tool results nobody read
|
|
48
|
+
|
|
49
|
+
`captureStructuredOutput` ended the run on any successful `structured_output`
|
|
50
|
+
result, without regard for how many calls the turn carried. Its neighbour forty
|
|
51
|
+
lines away, `terminalToolOutput`, refuses exactly that situation and writes the
|
|
52
|
+
argument down: "a model that asked for other work meant to see those results".
|
|
53
|
+
|
|
54
|
+
The consequence is worse than a discarded answer, because of the order things
|
|
55
|
+
happen in. The batch executes in `runToolReview` _before_ either of these is
|
|
56
|
+
consulted — so a model that emitted `structured_output` alongside `write`, a
|
|
57
|
+
delegation, or any other call had those calls run, side effects and all, and
|
|
58
|
+
then the run broke out of the loop. The results went into the transcript and no
|
|
59
|
+
model turn ever read them. Work was spent, nothing consumed it, and nothing
|
|
60
|
+
said so.
|
|
61
|
+
|
|
62
|
+
There is a second reason, sharper than the neighbour's. The model produced that
|
|
63
|
+
answer in the same turn as a request for information it did not yet have — it
|
|
64
|
+
would not have asked otherwise — so the answer was under-informed by the model's
|
|
65
|
+
own account, and settling shipped it as final.
|
|
66
|
+
|
|
67
|
+
`structured_output` now settles the run only when it is the only call in its
|
|
68
|
+
turn. Sharing a turn relays: the results already in the transcript go back to
|
|
69
|
+
the model and the next turn produces the answer with them in hand. Refusing to
|
|
70
|
+
_execute_ the batch was the other candidate and was rejected — the defect is not
|
|
71
|
+
that the tools ran, it is that nobody read them.
|
|
72
|
+
|
|
73
|
+
**What you will notice.** A run whose model pairs `structured_output` with
|
|
74
|
+
another call now takes one more turn, and `run.structuredOutput` holds the
|
|
75
|
+
answer formed after those results rather than before them. If your model always
|
|
76
|
+
calls `structured_output` alone, nothing changes. Relays are deliberately _not_
|
|
77
|
+
charged to `structuredOutput.maxRetries`: that budget bounds a model that cannot
|
|
78
|
+
satisfy the schema, and this one did — a run that reads a file per turn while
|
|
79
|
+
optimistically attaching its answer is making progress and must not be reported
|
|
80
|
+
as `structured_output_failed`. `maxIterations` bounds it, as it already bounds
|
|
81
|
+
the same pathology for terminal tools.
|
|
82
|
+
|
|
83
|
+
`patch`: no exported symbol, type, or default changes. A behaviour that was
|
|
84
|
+
losing requested work is corrected.
|
|
85
|
+
|
|
86
|
+
## 22.0.0
|
|
87
|
+
|
|
88
|
+
### Major Changes
|
|
89
|
+
|
|
90
|
+
- a4bcbc9: Runs report what they cost, and a cost limit that cannot be measured is refused
|
|
91
|
+
|
|
92
|
+
Every run reported `$0.00`. `calculateCost` existed and `CostInfo` was carried on
|
|
93
|
+
the run, the step, the checkpoint and the `token_usage_updated` event — but a
|
|
94
|
+
turn was only priced when the host passed `pricing` to `query()`, and no shipped
|
|
95
|
+
surface passed one. The accumulation branch was dead everywhere.
|
|
96
|
+
|
|
97
|
+
`runConfig.costLimitUsd` is enforced against that same total, so a host that set
|
|
98
|
+
a cost cap did not have one, and nothing said so.
|
|
99
|
+
|
|
100
|
+
**`@namzu/sdk` now ships a price catalogue** — `packages/sdk/src/pricing/`, a
|
|
101
|
+
module generated from a reviewed in-tree source table and checked in, so a cost
|
|
102
|
+
number is reproducible from a commit and an offline run still prices correctly.
|
|
103
|
+
Rates are looked up per turn against the driver and model that actually served
|
|
104
|
+
it. No configuration is needed to get a real number.
|
|
105
|
+
|
|
106
|
+
## What every caller sees change
|
|
107
|
+
|
|
108
|
+
**A run that reported zero now reports a real number.** If you compare, store,
|
|
109
|
+
bill from, or assert on `Run.costInfo.totalCost`, the value moves on the same
|
|
110
|
+
inputs. Nothing about your code has to change for this — but nothing warns you
|
|
111
|
+
either, so check anywhere a zero was being relied upon.
|
|
112
|
+
|
|
113
|
+
**A `costLimitUsd` that was inert now enforces, or refuses.** This is the change
|
|
114
|
+
most likely to break a working deployment, and it can do so at two moments:
|
|
115
|
+
|
|
116
|
+
- `query()` throws `invalid_config` at the start of a run when `costLimitUsd` is
|
|
117
|
+
set, no `pricing` is supplied, and the configured model has no rate. Same
|
|
118
|
+
config, same model, previously-completing run — now a startup failure.
|
|
119
|
+
- A run stops with the new `cost_unmeasurable` stop reason when a step or a
|
|
120
|
+
provider-chain member swaps to a model with no rate mid-run.
|
|
121
|
+
|
|
122
|
+
To keep a run working, do one of: pass `pricing` to declare the rate yourself;
|
|
123
|
+
add the model to `packages/sdk/src/pricing/rates.source.json` and regenerate;
|
|
124
|
+
or drop `costLimitUsd` and bound the run with `tokenBudget`, which is always
|
|
125
|
+
measurable. Removing the limit is the honest option if the model cannot be
|
|
126
|
+
priced — a budget you cannot measure was never enforcing anything.
|
|
127
|
+
|
|
128
|
+
## Breaking API changes
|
|
129
|
+
|
|
130
|
+
- **`CostInfo.inputCostPer1M` and `CostInfo.outputCostPer1M` are now optional.**
|
|
131
|
+
Absent means no single rate card describes the total — the run spanned two
|
|
132
|
+
models, or part of it ran at no known rate. Readers that treated these as
|
|
133
|
+
`number` need a `?? ` or a branch. They were previously required and reported
|
|
134
|
+
whichever card was applied last, which was a claim about the whole total that
|
|
135
|
+
was true of only part of it.
|
|
136
|
+
- **`CostInfo` gains a required `unpricedTokens: number`.** Any code that
|
|
137
|
+
constructs a `CostInfo` must supply it. Zero means nothing is unaccounted for.
|
|
138
|
+
This is what lets a consumer tell "this run cost nothing" from "nobody knows
|
|
139
|
+
what this run cost" — previously both were `totalCost: 0`.
|
|
140
|
+
- **`calculateCost` and `accumulateCost` lost their trailing `cacheDiscount`
|
|
141
|
+
parameter.** It defaulted to `0`, no caller in the tree ever passed it, and
|
|
142
|
+
the value it produced was subtracted from the total. `cacheDiscount` is now
|
|
143
|
+
computed from the rate card and _reported_ rather than subtracted — it is what
|
|
144
|
+
the cache reads saved against the full input rate, and the saving is already
|
|
145
|
+
inside `totalCost`. Callers passing a fourth argument get a compile error;
|
|
146
|
+
drop it.
|
|
147
|
+
- **`StopReason` gains `cost_unmeasurable`.** Exhaustive switches over
|
|
148
|
+
`StopReason` will not compile until they handle it.
|
|
149
|
+
- **`RunPersistence.accumulateUsage` and `recordTurnUsage` take a second
|
|
150
|
+
required argument** naming who served the tokens. Required so a call site
|
|
151
|
+
cannot silently misattribute; pass `{ providerId, model }`.
|
|
152
|
+
- **`projectEmergencyToCheckpoint` no longer reports zero cost.** A dump
|
|
153
|
+
preserves a real `tokenUsage` and records no cost, so the projection now
|
|
154
|
+
states that those tokens are unpriced rather than that they were free.
|
|
155
|
+
|
|
156
|
+
## Also fixed
|
|
157
|
+
|
|
158
|
+
- The advisory executor reported `totalCost: 0` for an advisor with no pricing
|
|
159
|
+
table — zero-as-unknown, the same defect one file over. It now reports the
|
|
160
|
+
tokens as unpriced, and falls back to the catalogue before giving up.
|
|
161
|
+
- Cache tokens are priced. The drivers in this repository disagree about whether
|
|
162
|
+
the prompt-token count already contains cache reads (two exclude them, one
|
|
163
|
+
includes them), so that fact is declared per driver in the rate source and the
|
|
164
|
+
arithmetic reads it. Previously cache reads were charged at the full input
|
|
165
|
+
rate or not at all, depending on the driver, and `cacheDiscount` was dead.
|
|
166
|
+
|
|
167
|
+
## `@namzu/anthropic`
|
|
168
|
+
|
|
169
|
+
The driver's offline model menu moves to an exported `OFFLINE_MODEL_CATALOGUE`
|
|
170
|
+
so a test can read it without a client. Two of the three models it offers had no
|
|
171
|
+
rate in the catalogue — a lookup-key mismatch that reads as "cost unknown" and
|
|
172
|
+
that the generator's own regeneration check is structurally blind to. Both rates
|
|
173
|
+
are added and a conformance test now holds the two lists together. No behaviour
|
|
174
|
+
change for callers.
|
|
175
|
+
|
|
3
176
|
## 21.1.0
|
|
4
177
|
|
|
5
178
|
### Minor Changes
|
|
@@ -32,11 +32,16 @@ export declare class AdvisoryExecutor {
|
|
|
32
32
|
private buildContext;
|
|
33
33
|
private truncateMessages;
|
|
34
34
|
/**
|
|
35
|
-
* Cost for one call, from the advisor's own pricing.
|
|
35
|
+
* Cost for one call, from the advisor's own pricing, then the catalogue.
|
|
36
36
|
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
37
|
+
* When neither has a rate this reports the tokens as UNPRICED rather than
|
|
38
|
+
* as a cost of zero. The previous version returned a zero rate card and a
|
|
39
|
+
* zero total, defended on the grounds that a cost CAP over unpriced
|
|
40
|
+
* advisors is refused at construction so nothing enforces against it — true
|
|
41
|
+
* of the cap, and beside the point for the reader. `AdvisoryResult.cost` is
|
|
42
|
+
* reported to the host, and `$0.00` for a call that cost real money is the
|
|
43
|
+
* exact defect this change exists to remove; it does not become acceptable
|
|
44
|
+
* because the number happens to be unenforced.
|
|
40
45
|
*/
|
|
41
46
|
private computeCost;
|
|
42
47
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../src/advisory/executor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../src/advisory/executor.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AACpF,OAAO,KAAK,EAAE,eAAe,E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OnB"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { CHARS_PER_TOKEN } from '../constants/limits.js';
|
|
1
|
+
import { CHARS_PER_TOKEN, ZERO_COST } from '../constants/limits.js';
|
|
2
2
|
import { assembleSystemPrompt } from '../persona/assembler.js';
|
|
3
|
+
import { resolveModelPricing } from '../pricing/index.js';
|
|
3
4
|
import { collect } from '../provider/collect.js';
|
|
4
5
|
import { createSystemMessage, createUserMessage } from '../types/message/index.js';
|
|
5
|
-
import { calculateCost } from '../utils/cost.js';
|
|
6
|
+
import { accumulateUnpricedCost, calculateCost } from '../utils/cost.js';
|
|
6
7
|
import { getRootLogger } from '../utils/logger.js';
|
|
7
8
|
import { ADVISORY_RESPONSE_CONTRACT, parseAdvisoryResponse } from './parse.js';
|
|
8
9
|
/**
|
|
@@ -158,17 +159,23 @@ export class AdvisoryExecutor {
|
|
|
158
159
|
return result;
|
|
159
160
|
}
|
|
160
161
|
/**
|
|
161
|
-
* Cost for one call, from the advisor's own pricing.
|
|
162
|
+
* Cost for one call, from the advisor's own pricing, then the catalogue.
|
|
162
163
|
*
|
|
163
|
-
*
|
|
164
|
-
*
|
|
165
|
-
*
|
|
164
|
+
* When neither has a rate this reports the tokens as UNPRICED rather than
|
|
165
|
+
* as a cost of zero. The previous version returned a zero rate card and a
|
|
166
|
+
* zero total, defended on the grounds that a cost CAP over unpriced
|
|
167
|
+
* advisors is refused at construction so nothing enforces against it — true
|
|
168
|
+
* of the cap, and beside the point for the reader. `AdvisoryResult.cost` is
|
|
169
|
+
* reported to the host, and `$0.00` for a call that cost real money is the
|
|
170
|
+
* exact defect this change exists to remove; it does not become acceptable
|
|
171
|
+
* because the number happens to be unenforced.
|
|
166
172
|
*/
|
|
167
173
|
computeCost(advisor, usage) {
|
|
168
|
-
|
|
169
|
-
|
|
174
|
+
const pricing = advisor.pricing ?? resolveModelPricing(advisor.provider.id, advisor.model);
|
|
175
|
+
if (!pricing) {
|
|
176
|
+
return accumulateUnpricedCost(ZERO_COST, usage);
|
|
170
177
|
}
|
|
171
|
-
return calculateCost(usage,
|
|
178
|
+
return calculateCost(usage, pricing);
|
|
172
179
|
}
|
|
173
180
|
}
|
|
174
181
|
//# sourceMappingURL=executor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../src/advisory/executor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;
|
|
1
|
+
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../src/advisory/executor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AAKhD,OAAO,EAAgB,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAEhG,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AACxE,OAAO,EAAe,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAC/D,OAAO,EAAE,0BAA0B,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAA;AAE9E;;;;;;GAMG;AACH,MAAM,iBAAiB,GAA0D;IAChF,IAAI,EAAE,mIAAmI;IACzI,MAAM,EAAE,SAAS;IACjB,GAAG,EAAE,qHAAqH;CAC1H,CAAA;AAgBD,MAAM,OAAO,gBAAgB;IACX,MAAM,CAAQ;IACd,MAAM,CAA4B;IAEnD,YAAY,MAAe,EAAE,MAAuB;QACnD,IAAI,CAAC,MAAM,GAAG,CAAC,MAAM,IAAI,aAAa,EAAE,CAAC,CAAC,KAAK,CAAC,EAAE,SAAS,EAAE,kBAAkB,EAAE,CAAC,CAAA;QAClF,IAAI,CAAC,MAAM,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CAAC;IAalE;;;;;;;;OAQG;IACG,GAAG,CACR,KAAK,EAAE,UAAU,EACjB,MAAM,EAAE,qBAAqB,EAC7B,QAAQ,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,qBAAqB,CAAC;YAMnB,YAAY;CAoS1B"}
|
|
@@ -296,6 +296,11 @@ export class SupervisorAgent extends AbstractAgent {
|
|
|
296
296
|
// corrected for twice.
|
|
297
297
|
...(config.steering ? { steering: config.steering } : {}),
|
|
298
298
|
...(config.verificationGate ? { verificationGate: config.verificationGate } : {}),
|
|
299
|
+
// The one hop between the config and the tool. `drainQuery`
|
|
300
|
+
// registers `structured_output` from this and the loop
|
|
301
|
+
// captures it, so the kernel never cared which archetype it
|
|
302
|
+
// came from — only `ReactiveAgent` was passing it.
|
|
303
|
+
...(config.structuredOutput ? { structuredOutput: config.structuredOutput } : {}),
|
|
299
304
|
...(config.sandboxProvider ? { sandboxProvider: config.sandboxProvider } : {}),
|
|
300
305
|
// Working-memory / compaction seam (optional; absent => unchanged
|
|
301
306
|
// run path, byte-identical for every existing consumer).
|
|
@@ -317,6 +322,13 @@ export class SupervisorAgent extends AbstractAgent {
|
|
|
317
322
|
durationMs: Date.now() - startTime,
|
|
318
323
|
messages: run.messages,
|
|
319
324
|
result: run.result,
|
|
325
|
+
// `BaseAgentResult.structuredOutput` names "an archetype's result
|
|
326
|
+
// literal did not copy it" as a defect it was written to close.
|
|
327
|
+
// This literal still did not copy it, so the same defect was live
|
|
328
|
+
// in the one archetype nobody checked: the value would have been
|
|
329
|
+
// produced, recorded on the run, serialized into `result`, and
|
|
330
|
+
// absent from the type a supervisor host actually reads.
|
|
331
|
+
structuredOutput: run.structuredOutput,
|
|
320
332
|
lastError: run.lastError,
|
|
321
333
|
taskResults,
|
|
322
334
|
completedTasks,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SupervisorAgent.js","sourceRoot":"","sources":["../../src/agents/SupervisorAgent.ts"],"names":[],"mappings":"AAAA,OAA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A;YAED,MAAM,WAAW,GAAG,OAAO,CAAC,SAAS,EAAE,CAAA;YACvC,MAAM,WAAW,GAAG,qBAAqB,CAAC,WAAW,EAAE,KAAK,CAAC,CAAA;YAE7D,MAAM,cAAc,GAAG,mBAAmB,CAAC,WAAW,CAAC,CAAA;YAEvD,OAAO;gBACN,KAAK,EAAE,GAAG,CAAC,EAAE;gBACb,MAAM,EAAE,GAAG,CAAC,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ;gBAC3D,UAAU,EAAE,GAAG,CAAC,UAAU;gBAC1B,KAAK,EAAE,GAAG,CAAC,UAAU;gBACrB,IAAI,EAAE,GAAG,CAAC,QAAQ;gBAClB,UAAU,EAAE,GAAG,CAAC,gBAAgB;gBAChC,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS;gBAClC,QAAQ,EAAE,GAAG,CAAC,QAAQ;gBACtB,MAAM,EAAE,GAAG,CAAC,MAAM;gBAClB,kEAAkE;gBAClE,gEAAgE;gBAChE,kEAAkE;gBAClE,iEAAiE;gBACjE,+DAA+D;gBAC/D,yDAAyD;gBACzD,gBAAgB,EAAE,GAAG,CAAC,gBAAgB;gBACtC,SAAS,EAAE,GAAG,CAAC,SAAS;gBACxB,WAAW;gBACX,cAAc;gBACd,UAAU,EAAE,WAAW,CAAC,MAAM;aAC9B,CAAA;QACF,CAAC;gBAAS,CAAC;YACV,eAAe,CAAC,KAAK,EAAE,CAAA;QACxB,CAAC;IACF,CAAC;CACD"}
|
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
import type { CostInfo, TokenUsage } from '../types/common/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* The starting value for a run: nothing accumulated, nothing unpriced.
|
|
4
|
+
*
|
|
5
|
+
* Carries NO rate fields, and that is load-bearing rather than tidy. It is what
|
|
6
|
+
* lets {@link import('../utils/cost.js').accumulateCost} tell "fresh" from
|
|
7
|
+
* "already spans two rate cards" without a separate marker: a fresh total has
|
|
8
|
+
* no rates AND no unpriced tokens AND a zero total, and no accumulated one can
|
|
9
|
+
* have all three.
|
|
10
|
+
*
|
|
11
|
+
* It also stops reading as a rate card of zero. `inputCostPer1M: 0` on a run
|
|
12
|
+
* nobody has priced says the model is free, which was exactly the confusion
|
|
13
|
+
* `unpricedTokens` was added to end.
|
|
14
|
+
*/
|
|
2
15
|
export declare const ZERO_COST: CostInfo;
|
|
3
16
|
export declare const CHARS_PER_TOKEN = 4;
|
|
4
17
|
export declare const EMPTY_TOKEN_USAGE: TokenUsage;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"limits.d.ts","sourceRoot":"","sources":["../../src/constants/limits.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAEpE,eAAO,MAAM,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"limits.d.ts","sourceRoot":"","sources":["../../src/constants/limits.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAEpE;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,SAAS,EAAE,QAIvB,CAAA;AAED,eAAO,MAAM,eAAe,IAAI,CAAA;AAEhC,eAAO,MAAM,iBAAiB,EAAE,UAM/B,CAAA"}
|
package/dist/constants/limits.js
CHANGED
|
@@ -1,8 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The starting value for a run: nothing accumulated, nothing unpriced.
|
|
3
|
+
*
|
|
4
|
+
* Carries NO rate fields, and that is load-bearing rather than tidy. It is what
|
|
5
|
+
* lets {@link import('../utils/cost.js').accumulateCost} tell "fresh" from
|
|
6
|
+
* "already spans two rate cards" without a separate marker: a fresh total has
|
|
7
|
+
* no rates AND no unpriced tokens AND a zero total, and no accumulated one can
|
|
8
|
+
* have all three.
|
|
9
|
+
*
|
|
10
|
+
* It also stops reading as a rate card of zero. `inputCostPer1M: 0` on a run
|
|
11
|
+
* nobody has priced says the model is free, which was exactly the confusion
|
|
12
|
+
* `unpricedTokens` was added to end.
|
|
13
|
+
*/
|
|
1
14
|
export const ZERO_COST = {
|
|
2
|
-
inputCostPer1M: 0,
|
|
3
|
-
outputCostPer1M: 0,
|
|
4
15
|
totalCost: 0,
|
|
5
16
|
cacheDiscount: 0,
|
|
17
|
+
unpricedTokens: 0,
|
|
6
18
|
};
|
|
7
19
|
export const CHARS_PER_TOKEN = 4;
|
|
8
20
|
export const EMPTY_TOKEN_USAGE = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"limits.js","sourceRoot":"","sources":["../../src/constants/limits.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,SAAS,GAAa;IAClC,
|
|
1
|
+
{"version":3,"file":"limits.js","sourceRoot":"","sources":["../../src/constants/limits.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,SAAS,GAAa;IAClC,SAAS,EAAE,CAAC;IACZ,aAAa,EAAE,CAAC;IAChB,cAAc,EAAE,CAAC;CACjB,CAAA;AAED,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAA;AAEhC,MAAM,CAAC,MAAM,iBAAiB,GAAe;IAC5C,YAAY,EAAE,CAAC;IACf,gBAAgB,EAAE,CAAC;IACnB,WAAW,EAAE,CAAC;IACd,YAAY,EAAE,CAAC;IACf,gBAAgB,EAAE,CAAC;CACnB,CAAA"}
|
|
@@ -20,8 +20,8 @@ import type { ThreadManager } from '../thread/lifecycle.js';
|
|
|
20
20
|
*
|
|
21
21
|
* Phase 9 Known Delta #5: fields are now unconditional required. The legacy
|
|
22
22
|
* "run without deps" compat branch was removed; every `AgentManager` consumer
|
|
23
|
-
* (SDK internals
|
|
24
|
-
* full set before instantiating. Convention #0 (no workarounds): the
|
|
23
|
+
* (SDK internals and `@namzu/cli`; the list here once also named two packages
|
|
24
|
+
* that do not exist) MUST wire the full set before instantiating. Convention #0 (no workarounds): the
|
|
25
25
|
* partially-wired mode was a migration-window bridge; 0.2.0 closes it.
|
|
26
26
|
*
|
|
27
27
|
* `workspaceRegistry` is required but may be empty — spawns without a
|
|
@@ -7,6 +7,18 @@ import type { EmergencySaveData } from '../../types/run/emergency.js';
|
|
|
7
7
|
import type { Run, RunPersistenceConfig, StepResult, StopReason } from '../../types/run/index.js';
|
|
8
8
|
import type { RunStore } from '../../types/run/store.js';
|
|
9
9
|
import type { ProjectId, ThreadId } from '../../types/session/ids.js';
|
|
10
|
+
/**
|
|
11
|
+
* The pair a rate lookup needs: which driver, running which model.
|
|
12
|
+
*
|
|
13
|
+
* `model` may be absent because a driver can be pointed at whatever the host
|
|
14
|
+
* configured and some report nothing back. Absent resolves to no rate, which
|
|
15
|
+
* is the honest answer, EXCEPT for a driver that bills nothing whatever it
|
|
16
|
+
* runs — see `resolveModelPricing`.
|
|
17
|
+
*/
|
|
18
|
+
export interface PricingSubject {
|
|
19
|
+
readonly providerId: string;
|
|
20
|
+
readonly model: string | undefined;
|
|
21
|
+
}
|
|
10
22
|
export declare class RunPersistence {
|
|
11
23
|
private run;
|
|
12
24
|
private runStore;
|
|
@@ -81,7 +93,18 @@ export declare class RunPersistence {
|
|
|
81
93
|
setLastError(error: string): void;
|
|
82
94
|
incrementIteration(): number;
|
|
83
95
|
pushMessage(message: Message): void;
|
|
84
|
-
|
|
96
|
+
/**
|
|
97
|
+
* Who served the tokens being accumulated, so a rate can be found for them.
|
|
98
|
+
*
|
|
99
|
+
* Both fields are required. The previous signature took usage alone and
|
|
100
|
+
* priced it from one table the run was constructed with, which is why the
|
|
101
|
+
* only way to get a non-zero cost was for a host to pass that table — and
|
|
102
|
+
* no shipped surface did. Naming the subject at every call site is what
|
|
103
|
+
* lets the catalogue answer, and it makes a site that cannot say who served
|
|
104
|
+
* a compile error rather than a silent misattribution.
|
|
105
|
+
*/
|
|
106
|
+
private resolvePricing;
|
|
107
|
+
accumulateUsage(usage: TokenUsage, servedBy: PricingSubject): void;
|
|
85
108
|
/**
|
|
86
109
|
* Accumulate usage from a MAIN-LOOP turn, and remember its prompt size.
|
|
87
110
|
*
|
|
@@ -95,7 +118,7 @@ export declare class RunPersistence {
|
|
|
95
118
|
* plain {@link accumulateUsage} instead: their prompts are not the
|
|
96
119
|
* run's context, and letting them write here would corrupt the signal.
|
|
97
120
|
*/
|
|
98
|
-
recordTurnUsage(usage: TokenUsage): void;
|
|
121
|
+
recordTurnUsage(usage: TokenUsage, servedBy: PricingSubject): void;
|
|
99
122
|
/**
|
|
100
123
|
* Forget the last prompt measurement. Called after compaction: the
|
|
101
124
|
* reading described the context that was just replaced, so leaving it
|
|
@@ -174,6 +197,18 @@ export declare class RunPersistence {
|
|
|
174
197
|
* `steps[].servedBy`.
|
|
175
198
|
*/
|
|
176
199
|
setServingProvider(providerId: string): void;
|
|
200
|
+
/**
|
|
201
|
+
* Who is serving right now, for a side-channel call that has no provenance
|
|
202
|
+
* of its own.
|
|
203
|
+
*
|
|
204
|
+
* The main loop does not use this — it reads `servedBy` off the turn, which
|
|
205
|
+
* is exact. Compaction and the closing summary go through the same wrapped
|
|
206
|
+
* provider without recording who answered, and this is the best available
|
|
207
|
+
* answer for them: the fallback decorator reports the head member's id
|
|
208
|
+
* whoever is actually serving, so asking the provider would hand back the
|
|
209
|
+
* declaration rather than the fact.
|
|
210
|
+
*/
|
|
211
|
+
get servingProviderId(): string;
|
|
177
212
|
clearLastPromptTokens(): void;
|
|
178
213
|
/**
|
|
179
214
|
* Provider-reported size of the most recent main-loop prompt, or
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"persistence.d.ts","sourceRoot":"","sources":["../../../src/manager/run/persistence.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"persistence.d.ts","sourceRoot":"","sources":["../../../src/manager/run/persistence.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,UAAU,EAAwB,MAA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,10 @@
|
|
|
1
1
|
import { AUTO_CONTINUATION_USER_MESSAGE } from '../../constants/continuation.js';
|
|
2
2
|
import { EMPTY_TOKEN_USAGE } from '../../constants/limits.js';
|
|
3
|
+
import { resolveModelPricing } from '../../pricing/index.js';
|
|
3
4
|
import { DiskCheckpointStore } from '../../store/run/checkpoint-disk.js';
|
|
4
5
|
import { RunDiskStore } from '../../store/run/disk.js';
|
|
5
6
|
import { accumulateTokenUsage } from '../../types/common/index.js';
|
|
6
|
-
import { ZERO_COST, accumulateCost } from '../../utils/cost.js';
|
|
7
|
+
import { ZERO_COST, accumulateCost, accumulateUnpricedCost, } from '../../utils/cost.js';
|
|
7
8
|
import { generateEmergencySaveId } from '../../utils/id.js';
|
|
8
9
|
export class RunPersistence {
|
|
9
10
|
run;
|
|
@@ -219,11 +220,37 @@ export class RunPersistence {
|
|
|
219
220
|
pushMessage(message) {
|
|
220
221
|
this.run.messages.push(message);
|
|
221
222
|
}
|
|
222
|
-
|
|
223
|
+
/**
|
|
224
|
+
* Who served the tokens being accumulated, so a rate can be found for them.
|
|
225
|
+
*
|
|
226
|
+
* Both fields are required. The previous signature took usage alone and
|
|
227
|
+
* priced it from one table the run was constructed with, which is why the
|
|
228
|
+
* only way to get a non-zero cost was for a host to pass that table — and
|
|
229
|
+
* no shipped surface did. Naming the subject at every call site is what
|
|
230
|
+
* lets the catalogue answer, and it makes a site that cannot say who served
|
|
231
|
+
* a compile error rather than a silent misattribution.
|
|
232
|
+
*/
|
|
233
|
+
resolvePricing(servedBy) {
|
|
234
|
+
// A host-supplied table wins. It is a deliberate declaration about this
|
|
235
|
+
// run, and `query()` already refuses to accept one alongside a provider
|
|
236
|
+
// chain of more than one member, so it cannot be silently spread across
|
|
237
|
+
// two rate cards here.
|
|
238
|
+
if (this.pricing)
|
|
239
|
+
return this.pricing;
|
|
240
|
+
return resolveModelPricing(servedBy.providerId, servedBy.model);
|
|
241
|
+
}
|
|
242
|
+
accumulateUsage(usage, servedBy) {
|
|
223
243
|
this.run.tokenUsage = accumulateTokenUsage(this.run.tokenUsage, usage);
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
244
|
+
const pricing = this.resolvePricing(servedBy);
|
|
245
|
+
// No rate is not the same as a rate of zero, and the difference is the
|
|
246
|
+
// whole point of this change. Tokens nobody can price are counted as
|
|
247
|
+
// such, so `costInfo.unpricedTokens` distinguishes "this cost nothing"
|
|
248
|
+
// from "nobody knows what this cost" — and so the budget guard can
|
|
249
|
+
// refuse rather than pass a limit it cannot measure.
|
|
250
|
+
this.run.costInfo =
|
|
251
|
+
pricing === undefined
|
|
252
|
+
? accumulateUnpricedCost(this.run.costInfo, usage)
|
|
253
|
+
: accumulateCost(this.run.costInfo, usage, pricing);
|
|
227
254
|
}
|
|
228
255
|
/**
|
|
229
256
|
* Accumulate usage from a MAIN-LOOP turn, and remember its prompt size.
|
|
@@ -238,8 +265,8 @@ export class RunPersistence {
|
|
|
238
265
|
* plain {@link accumulateUsage} instead: their prompts are not the
|
|
239
266
|
* run's context, and letting them write here would corrupt the signal.
|
|
240
267
|
*/
|
|
241
|
-
recordTurnUsage(usage) {
|
|
242
|
-
this.accumulateUsage(usage);
|
|
268
|
+
recordTurnUsage(usage, servedBy) {
|
|
269
|
+
this.accumulateUsage(usage, servedBy);
|
|
243
270
|
this._lastPromptTokens = usage.promptTokens;
|
|
244
271
|
// How much of the history that number covers. The loop pushes the
|
|
245
272
|
// assistant message and its tool results AFTER this call, so without
|
|
@@ -339,6 +366,20 @@ export class RunPersistence {
|
|
|
339
366
|
setServingProvider(providerId) {
|
|
340
367
|
this.run.metadata.servingProvider = providerId;
|
|
341
368
|
}
|
|
369
|
+
/**
|
|
370
|
+
* Who is serving right now, for a side-channel call that has no provenance
|
|
371
|
+
* of its own.
|
|
372
|
+
*
|
|
373
|
+
* The main loop does not use this — it reads `servedBy` off the turn, which
|
|
374
|
+
* is exact. Compaction and the closing summary go through the same wrapped
|
|
375
|
+
* provider without recording who answered, and this is the best available
|
|
376
|
+
* answer for them: the fallback decorator reports the head member's id
|
|
377
|
+
* whoever is actually serving, so asking the provider would hand back the
|
|
378
|
+
* declaration rather than the fact.
|
|
379
|
+
*/
|
|
380
|
+
get servingProviderId() {
|
|
381
|
+
return this.run.metadata.servingProvider ?? this.run.metadata.provider;
|
|
382
|
+
}
|
|
342
383
|
clearLastPromptTokens() {
|
|
343
384
|
this._lastPromptTokens = undefined;
|
|
344
385
|
this._lastPromptMessageCount = undefined;
|