@namzu/sdk 21.0.0 → 22.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 +134 -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/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 +6 -1
- package/dist/public-runtime.d.ts.map +1 -1
- package/dist/public-runtime.js +21 -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/run/command-gate.d.ts +107 -0
- package/dist/run/command-gate.d.ts.map +1 -0
- package/dist/run/command-gate.js +157 -0
- package/dist/run/command-gate.js.map +1 -0
- package/dist/run/index.d.ts +6 -0
- package/dist/run/index.d.ts.map +1 -1
- package/dist/run/index.js +3 -0
- package/dist/run/index.js.map +1 -1
- package/dist/run/memory-promoter.d.ts +70 -0
- package/dist/run/memory-promoter.d.ts.map +1 -0
- package/dist/run/memory-promoter.js +117 -0
- package/dist/run/memory-promoter.js.map +1 -0
- package/dist/run/workspace-fingerprint.d.ts +105 -0
- package/dist/run/workspace-fingerprint.d.ts.map +1 -0
- package/dist/run/workspace-fingerprint.js +147 -0
- package/dist/run/workspace-fingerprint.js.map +1 -0
- 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.map +1 -1
- package/dist/runtime/query/iteration/index.js +15 -2
- 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/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/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 +39 -0
- package/src/public-types.ts +3 -1
- package/src/run/LimitChecker.ts +24 -2
- package/src/run/command-gate.ts +234 -0
- package/src/run/index.ts +17 -0
- package/src/run/memory-promoter.ts +155 -0
- package/src/run/workspace-fingerprint.ts +193 -0
- 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 +15 -2
- 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/common/index.ts +38 -2
- package/src/types/run/stop-reason.ts +30 -0
- package/src/utils/cost.ts +186 -16
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A hash of everything a run could have changed in its working tree.
|
|
3
|
+
*
|
|
4
|
+
* It exists to answer one question, asked between two attempts at the same
|
|
5
|
+
* verification: **did anything happen since it last failed?** A verify-then-fix
|
|
6
|
+
* loop that re-runs the build after a turn which edited nothing spends a full
|
|
7
|
+
* command execution to learn what a comparison already knew, and does it once
|
|
8
|
+
* per remaining attempt — so a model that has stopped making progress burns
|
|
9
|
+
* the entire budget confirming the same failure.
|
|
10
|
+
*
|
|
11
|
+
* ## What is hashed, and why each part
|
|
12
|
+
*
|
|
13
|
+
* Three sources, because no one of them is complete:
|
|
14
|
+
*
|
|
15
|
+
* 1. **`git status --porcelain`** — which paths differ from the index at all.
|
|
16
|
+
* Cheap, and it catches additions, deletions and mode changes. On its own
|
|
17
|
+
* it is not enough: editing a tracked file that was ALREADY modified
|
|
18
|
+
* leaves the status output byte-identical.
|
|
19
|
+
* 2. **`git diff --binary HEAD`** — the content of every tracked change.
|
|
20
|
+
* `--binary` so an edit to a file git treats as binary is a real diff
|
|
21
|
+
* rather than the constant line `Binary files … differ`, which would make
|
|
22
|
+
* every edit to such a file invisible.
|
|
23
|
+
* 3. **Untracked file contents**, which no `git diff` covers. A new file is
|
|
24
|
+
* named by `status` but its CONTENT is not, so successive edits to a
|
|
25
|
+
* brand-new file would otherwise look like no change at all.
|
|
26
|
+
*
|
|
27
|
+
* ### Symlinks are recorded as their target, not read through
|
|
28
|
+
*
|
|
29
|
+
* Reading a link follows it, so a link repointed from one file to another
|
|
30
|
+
* with identical contents hashes the same — while the thing the workspace
|
|
31
|
+
* actually resolves has changed. The link's target path is the fact that
|
|
32
|
+
* moved, so that is what goes in.
|
|
33
|
+
*
|
|
34
|
+
* ## Failing open, on the cheap side
|
|
35
|
+
*
|
|
36
|
+
* Every uncertainty returns `null`, meaning *no fingerprint*, and a caller
|
|
37
|
+
* that cannot fingerprint re-runs its command. That is the correct direction:
|
|
38
|
+
* the cost of a wrong `null` is one command execution, and the cost of a
|
|
39
|
+
* wrong MATCH is a verification silently skipped — the loop would report
|
|
40
|
+
* "nothing changed" about a workspace that did change, and the model would be
|
|
41
|
+
* told to edit something it had already edited.
|
|
42
|
+
*
|
|
43
|
+
* So: a non-zero exit from any git invocation, a repository with no commits,
|
|
44
|
+
* a timeout, or output past the size cap all produce `null` rather than a
|
|
45
|
+
* partial hash. A truncated diff that hashed successfully would be the worst
|
|
46
|
+
* outcome available here, because two different workspaces truncated at the
|
|
47
|
+
* same point collide.
|
|
48
|
+
*/
|
|
49
|
+
import type { CommandOptions, CommandResult } from '../types/execution/index.js';
|
|
50
|
+
/** How a fingerprint runs git. Injected so a test needs no repository. */
|
|
51
|
+
export type FingerprintExec = (command: string, args: string[], options?: CommandOptions) => Promise<CommandResult>;
|
|
52
|
+
/**
|
|
53
|
+
* The three filesystem reads an untracked entry needs.
|
|
54
|
+
*
|
|
55
|
+
* Injectable for one specific reason, written down because a seam that
|
|
56
|
+
* exists only for tests is usually a smell: **creating a symlink requires a
|
|
57
|
+
* privilege that is not granted by default on Windows**, so the symlink rule
|
|
58
|
+
* below — the one that says a repointed link changes the fingerprint even
|
|
59
|
+
* when the bytes behind it do not — cannot be exercised on a developer
|
|
60
|
+
* machine without it. A rule that can only be checked on some machines is a
|
|
61
|
+
* rule nobody checks.
|
|
62
|
+
*
|
|
63
|
+
* The default is `node:fs/promises` and every other test uses it against a
|
|
64
|
+
* real repository, so this is not a fixture standing in for production; it is
|
|
65
|
+
* one branch of one function reached without a privilege.
|
|
66
|
+
*/
|
|
67
|
+
export interface FingerprintFs {
|
|
68
|
+
lstat(path: string): Promise<{
|
|
69
|
+
isSymbolicLink(): boolean;
|
|
70
|
+
isFile(): boolean;
|
|
71
|
+
}>;
|
|
72
|
+
readlink(path: string): Promise<string>;
|
|
73
|
+
readFile(path: string): Promise<Buffer>;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Cap on the bytes any single git invocation may produce.
|
|
77
|
+
*
|
|
78
|
+
* Past it the fingerprint is abandoned rather than hashed. A diff big enough
|
|
79
|
+
* to hit this is a diff nobody is going to iterate on anyway, and hashing a
|
|
80
|
+
* clipped one would let two different trees agree.
|
|
81
|
+
*/
|
|
82
|
+
export declare const FINGERPRINT_MAX_BYTES: number;
|
|
83
|
+
/** Default deadline per git invocation. */
|
|
84
|
+
export declare const FINGERPRINT_TIMEOUT_MS = 20000;
|
|
85
|
+
export interface WorkspaceFingerprintOptions {
|
|
86
|
+
/** Repository root, or any directory inside it. */
|
|
87
|
+
readonly cwd: string;
|
|
88
|
+
/** How to run git. */
|
|
89
|
+
readonly exec: FingerprintExec;
|
|
90
|
+
/** Per-invocation deadline. See {@link FINGERPRINT_TIMEOUT_MS}. */
|
|
91
|
+
readonly timeoutMs?: number;
|
|
92
|
+
/** See {@link FINGERPRINT_MAX_BYTES}. */
|
|
93
|
+
readonly maxBytes?: number;
|
|
94
|
+
/** Filesystem reads. See {@link FingerprintFs}. */
|
|
95
|
+
readonly fs?: FingerprintFs;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* A hash of the working tree's uncommitted state, or `null` when it cannot be
|
|
99
|
+
* established.
|
|
100
|
+
*
|
|
101
|
+
* **`null` is never "unchanged".** It means "I cannot tell", and the caller
|
|
102
|
+
* must treat it as a reason to do the work rather than to skip it.
|
|
103
|
+
*/
|
|
104
|
+
export declare function fingerprintWorkspace(options: WorkspaceFingerprintOptions): Promise<string | null>;
|
|
105
|
+
//# sourceMappingURL=workspace-fingerprint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-fingerprint.d.ts","sourceRoot":"","sources":["../../src/run/workspace-fingerprint.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAMH,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAEhF,0EAA0E;AAC1E,MAAM,MAAM,eAAe,GAAG,CAC7B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,CAAC,EAAE,cAAc,KACpB,OAAO,CAAC,aAAa,CAAC,CAAA;AAE3B;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,aAAa;IAC7B,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,cAAc,IAAI,OAAO,CAAC;QAAC,MAAM,IAAI,OAAO,CAAA;KAAE,CAAC,CAAA;IAC9E,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;IACvC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;CACvC;AAID;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,QAAkB,CAAA;AAEpD,2CAA2C;AAC3C,eAAO,MAAM,sBAAsB,QAAS,CAAA;AAE5C,MAAM,WAAW,2BAA2B;IAC3C,mDAAmD;IACnD,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,sBAAsB;IACtB,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAA;IAC9B,mEAAmE;IACnE,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;IAC3B,yCAAyC;IACzC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;IAC1B,mDAAmD;IACnD,QAAQ,CAAC,EAAE,CAAC,EAAE,aAAa,CAAA;CAC3B;AAwBD;;;;;;GAMG;AACH,wBAAsB,oBAAoB,CACzC,OAAO,EAAE,2BAA2B,GAClC,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAmDxB"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A hash of everything a run could have changed in its working tree.
|
|
3
|
+
*
|
|
4
|
+
* It exists to answer one question, asked between two attempts at the same
|
|
5
|
+
* verification: **did anything happen since it last failed?** A verify-then-fix
|
|
6
|
+
* loop that re-runs the build after a turn which edited nothing spends a full
|
|
7
|
+
* command execution to learn what a comparison already knew, and does it once
|
|
8
|
+
* per remaining attempt — so a model that has stopped making progress burns
|
|
9
|
+
* the entire budget confirming the same failure.
|
|
10
|
+
*
|
|
11
|
+
* ## What is hashed, and why each part
|
|
12
|
+
*
|
|
13
|
+
* Three sources, because no one of them is complete:
|
|
14
|
+
*
|
|
15
|
+
* 1. **`git status --porcelain`** — which paths differ from the index at all.
|
|
16
|
+
* Cheap, and it catches additions, deletions and mode changes. On its own
|
|
17
|
+
* it is not enough: editing a tracked file that was ALREADY modified
|
|
18
|
+
* leaves the status output byte-identical.
|
|
19
|
+
* 2. **`git diff --binary HEAD`** — the content of every tracked change.
|
|
20
|
+
* `--binary` so an edit to a file git treats as binary is a real diff
|
|
21
|
+
* rather than the constant line `Binary files … differ`, which would make
|
|
22
|
+
* every edit to such a file invisible.
|
|
23
|
+
* 3. **Untracked file contents**, which no `git diff` covers. A new file is
|
|
24
|
+
* named by `status` but its CONTENT is not, so successive edits to a
|
|
25
|
+
* brand-new file would otherwise look like no change at all.
|
|
26
|
+
*
|
|
27
|
+
* ### Symlinks are recorded as their target, not read through
|
|
28
|
+
*
|
|
29
|
+
* Reading a link follows it, so a link repointed from one file to another
|
|
30
|
+
* with identical contents hashes the same — while the thing the workspace
|
|
31
|
+
* actually resolves has changed. The link's target path is the fact that
|
|
32
|
+
* moved, so that is what goes in.
|
|
33
|
+
*
|
|
34
|
+
* ## Failing open, on the cheap side
|
|
35
|
+
*
|
|
36
|
+
* Every uncertainty returns `null`, meaning *no fingerprint*, and a caller
|
|
37
|
+
* that cannot fingerprint re-runs its command. That is the correct direction:
|
|
38
|
+
* the cost of a wrong `null` is one command execution, and the cost of a
|
|
39
|
+
* wrong MATCH is a verification silently skipped — the loop would report
|
|
40
|
+
* "nothing changed" about a workspace that did change, and the model would be
|
|
41
|
+
* told to edit something it had already edited.
|
|
42
|
+
*
|
|
43
|
+
* So: a non-zero exit from any git invocation, a repository with no commits,
|
|
44
|
+
* a timeout, or output past the size cap all produce `null` rather than a
|
|
45
|
+
* partial hash. A truncated diff that hashed successfully would be the worst
|
|
46
|
+
* outcome available here, because two different workspaces truncated at the
|
|
47
|
+
* same point collide.
|
|
48
|
+
*/
|
|
49
|
+
import { createHash } from 'node:crypto';
|
|
50
|
+
import { lstat, readFile, readlink } from 'node:fs/promises';
|
|
51
|
+
import { join } from 'node:path';
|
|
52
|
+
const NODE_FS = { lstat, readlink, readFile };
|
|
53
|
+
/**
|
|
54
|
+
* Cap on the bytes any single git invocation may produce.
|
|
55
|
+
*
|
|
56
|
+
* Past it the fingerprint is abandoned rather than hashed. A diff big enough
|
|
57
|
+
* to hit this is a diff nobody is going to iterate on anyway, and hashing a
|
|
58
|
+
* clipped one would let two different trees agree.
|
|
59
|
+
*/
|
|
60
|
+
export const FINGERPRINT_MAX_BYTES = 4 * 1024 * 1024;
|
|
61
|
+
/** Default deadline per git invocation. */
|
|
62
|
+
export const FINGERPRINT_TIMEOUT_MS = 20_000;
|
|
63
|
+
/** One untracked path's contribution, or `null` when it could not be read. */
|
|
64
|
+
async function untrackedEntry(cwd, rel, fs) {
|
|
65
|
+
const abs = join(cwd, rel);
|
|
66
|
+
try {
|
|
67
|
+
const stats = await fs.lstat(abs);
|
|
68
|
+
if (stats.isSymbolicLink()) {
|
|
69
|
+
// The TARGET, not what is behind it. Following the link would hash a
|
|
70
|
+
// repointed link to the same value whenever the new target happens
|
|
71
|
+
// to hold the same bytes, and a repoint is a change to the workspace
|
|
72
|
+
// by any reading that matters.
|
|
73
|
+
return `L ${rel}\0${await fs.readlink(abs)}`;
|
|
74
|
+
}
|
|
75
|
+
if (!stats.isFile())
|
|
76
|
+
return `? ${rel}`;
|
|
77
|
+
const body = await fs.readFile(abs);
|
|
78
|
+
return `F ${rel}\0${createHash('sha256').update(body).digest('hex')}`;
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
// Vanished between the listing and the read, or unreadable. Neither is
|
|
82
|
+
// a fingerprint this function may guess at.
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* A hash of the working tree's uncommitted state, or `null` when it cannot be
|
|
88
|
+
* established.
|
|
89
|
+
*
|
|
90
|
+
* **`null` is never "unchanged".** It means "I cannot tell", and the caller
|
|
91
|
+
* must treat it as a reason to do the work rather than to skip it.
|
|
92
|
+
*/
|
|
93
|
+
export async function fingerprintWorkspace(options) {
|
|
94
|
+
const { cwd, exec } = options;
|
|
95
|
+
const timeoutMs = options.timeoutMs ?? FINGERPRINT_TIMEOUT_MS;
|
|
96
|
+
const maxBytes = options.maxBytes ?? FINGERPRINT_MAX_BYTES;
|
|
97
|
+
const fs = options.fs ?? NODE_FS;
|
|
98
|
+
const git = async (args) => {
|
|
99
|
+
let result;
|
|
100
|
+
try {
|
|
101
|
+
result = await exec('git', args, { cwd, timeoutMs });
|
|
102
|
+
}
|
|
103
|
+
catch {
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
// A timeout surfaces here as a non-zero exit, and so does "not a
|
|
107
|
+
// repository" and "no commits yet". All three mean the same thing to
|
|
108
|
+
// this function: it has no basis for a comparison.
|
|
109
|
+
if (result.exitCode !== 0)
|
|
110
|
+
return null;
|
|
111
|
+
if (Buffer.byteLength(result.stdout, 'utf8') > maxBytes)
|
|
112
|
+
return null;
|
|
113
|
+
return result.stdout;
|
|
114
|
+
};
|
|
115
|
+
const status = await git(['status', '--porcelain']);
|
|
116
|
+
if (status === null)
|
|
117
|
+
return null;
|
|
118
|
+
const diff = await git(['diff', '--binary', 'HEAD']);
|
|
119
|
+
if (diff === null)
|
|
120
|
+
return null;
|
|
121
|
+
const untracked = await git(['ls-files', '--others', '--exclude-standard', '-z']);
|
|
122
|
+
if (untracked === null)
|
|
123
|
+
return null;
|
|
124
|
+
const parts = [`status ${status}`, `diff ${diff}`];
|
|
125
|
+
// Split on NUL, which is what `-z` is for: a path may contain a newline,
|
|
126
|
+
// and splitting on one would turn a single strange filename into two
|
|
127
|
+
// ordinary-looking ones.
|
|
128
|
+
//
|
|
129
|
+
// Sorted, because `ls-files` order is not part of any contract and a
|
|
130
|
+
// fingerprint that moved when the listing order did would report a change
|
|
131
|
+
// nobody made.
|
|
132
|
+
for (const rel of untracked.split('\0').filter(Boolean).sort()) {
|
|
133
|
+
const entry = await untrackedEntry(cwd, rel, fs);
|
|
134
|
+
if (entry === null)
|
|
135
|
+
return null;
|
|
136
|
+
parts.push(entry);
|
|
137
|
+
}
|
|
138
|
+
// Length-prefixed rather than delimiter-joined. A diff can contain any
|
|
139
|
+
// byte, so any separator is a separator the content can forge — and two
|
|
140
|
+
// different trees that agreed after forgery would be reported as
|
|
141
|
+
// unchanged, which is the one wrong answer this file is arranged to avoid.
|
|
142
|
+
const hash = createHash('sha256');
|
|
143
|
+
for (const part of parts)
|
|
144
|
+
hash.update(`${Buffer.byteLength(part, 'utf8')}:${part}`);
|
|
145
|
+
return hash.digest('hex');
|
|
146
|
+
}
|
|
147
|
+
//# sourceMappingURL=workspace-fingerprint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-fingerprint.js","sourceRoot":"","sources":["../../src/run/workspace-fingerprint.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAgChC,MAAM,OAAO,GAAkB,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAA;AAE5D;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAA;AAEpD,2CAA2C;AAC3C,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAA;AAe5C,8EAA8E;AAC9E,KAAK,UAAU,cAAc,CAAC,GAAW,EAAE,GAAW,EAAE,EAAiB;IACxE,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;IAC1B,IAAI,CAAC;QACJ,MAAM,KAAK,GAAG,MAAM,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;QACjC,IAAI,KAAK,CAAC,cAAc,EAAE,EAAE,CAAC;YAC5B,qEAAqE;YACrE,mEAAmE;YACnE,qEAAqE;YACrE,+BAA+B;YAC/B,OAAO,KAAK,GAAG,KAAK,MAAM,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAA;QAC7C,CAAC;QACD,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE;YAAE,OAAO,KAAK,GAAG,EAAE,CAAA;QACtC,MAAM,IAAI,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,GA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): Checkpoi
|
|
|
17
17
|
* the same restore path as any other checkpoint.
|
|
18
18
|
*
|
|
19
19
|
* The projection is lossy: `costInfo`, `guardState.elapsedMs` and
|
|
20
|
-
* `toolResultHashes` are not captured at emergency-save time
|
|
21
|
-
* to zero/empty values. The synthetic
|
|
20
|
+
* `toolResultHashes` are not captured at emergency-save time. The synthetic
|
|
22
21
|
* checkpoint id is derived deterministically from the emergency save id so
|
|
23
22
|
* re-projecting the same dump yields the same {@link CheckpointId}.
|
|
24
23
|
*
|
|
24
|
+
* ## The cost projection says "unknown", not "zero"
|
|
25
|
+
*
|
|
26
|
+
* `costInfo` used to default to `{ ...ZERO_COST }` beside a `tokenUsage` the
|
|
27
|
+
* dump preserves faithfully — a run that had spent real money coming back as
|
|
28
|
+
* one that had spent nothing. That is the same lie the price catalogue was
|
|
29
|
+
* added to end, arriving through the restore path instead of the accumulation
|
|
30
|
+
* one, and it took `runConfig.costLimitUsd` back to being enforced against a
|
|
31
|
+
* zero with it.
|
|
32
|
+
*
|
|
33
|
+
* It also broke the accumulator downstream. `accumulateCost` decides whether
|
|
34
|
+
* one rate card describes the whole total by asking whether the total is
|
|
35
|
+
* FRESH — zero cost, zero unpriced tokens, no rates — and `ZERO_COST` is
|
|
36
|
+
* exactly that shape. So the first turn after such a resume adopted its own
|
|
37
|
+
* rate card as covering the pre-crash spend too, and reported a number that
|
|
38
|
+
* was confidently wrong while looking like a measured one.
|
|
39
|
+
*
|
|
40
|
+
* Saying instead that the pre-crash tokens are UNPRICED is the true statement,
|
|
41
|
+
* in the vocabulary {@link CostInfo} already has: nobody knows what they cost,
|
|
42
|
+
* because nothing recorded it. It needs no marker of its own to stay correct,
|
|
43
|
+
* and it is not fresh-shaped, so the accumulator does the right thing without
|
|
44
|
+
* being told about this path at all.
|
|
45
|
+
*
|
|
25
46
|
* See ses_005-deterministic-replay design §2 + §5.2.
|
|
26
47
|
*/
|
|
27
48
|
export declare function projectEmergencyToCheckpoint(dump: EmergencySaveData): IterationCheckpoint;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkpoint.d.ts","sourceRoot":"","sources":["../../../src/runtime/query/checkpoint.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAA;AACpE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAA;AACtE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAA;AAE1E,OAAO,KAAK,EACX,YAAY,EACZ,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,eAAe,EACf,MAAM,2BAA2B,CAAA;AAElC,OAAO,KAAK,EACX,kBAAkB,EAClB,eAAe,EACf,UAAU,EACV,MAAM,qCAAqC,CAAA;AAC5C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAA;AACrE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAKpE;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,EAAE,EAAE,mBAAmB,GAAG,mBAAmB,CAQlF;AAED
|
|
1
|
+
{"version":3,"file":"checkpoint.d.ts","sourceRoot":"","sources":["../../../src/runtime/query/checkpoint.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAA;AACpE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAA;AACtE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAA;AAE1E,OAAO,KAAK,EACX,YAAY,EACZ,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,eAAe,EACf,MAAM,2BAA2B,CAAA;AAElC,OAAO,KAAK,EACX,kBAAkB,EAClB,eAAe,EACf,UAAU,EACV,MAAM,qCAAqC,CAAA;AAC5C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B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AY,EAAE,YAAY,GAAG,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;IAkB7E;;;;;;;OAOG;IACG,MAAM,CACX,YAAY,EAAE,YAAY,EAC1B,QAAQ,EAAE,kBAAkB,GAC1B,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;IAYtC;;;;;;;OAOG;IACG,WAAW,IAAI,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;IAIlD,OAAO,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CAAC,mBAAmB,CAAC;IA4BjE,IAAI,IAAI,OAAO,CAAC,mBAAmB,EAAE,CAAC;IAI5C;;;;;OAKG;IACG,WAAW,IAAI,OAAO,CAAC,mBAAmB,EAAE,CAAC;IAK7C,KAAK,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAW5C,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,GAAG,iBAAiB;CAajF"}
|
|
@@ -22,11 +22,32 @@ export function toCheckpointListEntry(cp) {
|
|
|
22
22
|
* the same restore path as any other checkpoint.
|
|
23
23
|
*
|
|
24
24
|
* The projection is lossy: `costInfo`, `guardState.elapsedMs` and
|
|
25
|
-
* `toolResultHashes` are not captured at emergency-save time
|
|
26
|
-
* to zero/empty values. The synthetic
|
|
25
|
+
* `toolResultHashes` are not captured at emergency-save time. The synthetic
|
|
27
26
|
* checkpoint id is derived deterministically from the emergency save id so
|
|
28
27
|
* re-projecting the same dump yields the same {@link CheckpointId}.
|
|
29
28
|
*
|
|
29
|
+
* ## The cost projection says "unknown", not "zero"
|
|
30
|
+
*
|
|
31
|
+
* `costInfo` used to default to `{ ...ZERO_COST }` beside a `tokenUsage` the
|
|
32
|
+
* dump preserves faithfully — a run that had spent real money coming back as
|
|
33
|
+
* one that had spent nothing. That is the same lie the price catalogue was
|
|
34
|
+
* added to end, arriving through the restore path instead of the accumulation
|
|
35
|
+
* one, and it took `runConfig.costLimitUsd` back to being enforced against a
|
|
36
|
+
* zero with it.
|
|
37
|
+
*
|
|
38
|
+
* It also broke the accumulator downstream. `accumulateCost` decides whether
|
|
39
|
+
* one rate card describes the whole total by asking whether the total is
|
|
40
|
+
* FRESH — zero cost, zero unpriced tokens, no rates — and `ZERO_COST` is
|
|
41
|
+
* exactly that shape. So the first turn after such a resume adopted its own
|
|
42
|
+
* rate card as covering the pre-crash spend too, and reported a number that
|
|
43
|
+
* was confidently wrong while looking like a measured one.
|
|
44
|
+
*
|
|
45
|
+
* Saying instead that the pre-crash tokens are UNPRICED is the true statement,
|
|
46
|
+
* in the vocabulary {@link CostInfo} already has: nobody knows what they cost,
|
|
47
|
+
* because nothing recorded it. It needs no marker of its own to stay correct,
|
|
48
|
+
* and it is not fresh-shaped, so the accumulator does the right thing without
|
|
49
|
+
* being told about this path at all.
|
|
50
|
+
*
|
|
30
51
|
* See ses_005-deterministic-replay design §2 + §5.2.
|
|
31
52
|
*/
|
|
32
53
|
export function projectEmergencyToCheckpoint(dump) {
|
|
@@ -43,7 +64,7 @@ export function projectEmergencyToCheckpoint(dump) {
|
|
|
43
64
|
iteration: dump.currentIteration,
|
|
44
65
|
messages: dump.messages,
|
|
45
66
|
tokenUsage: dump.tokenUsage,
|
|
46
|
-
costInfo: { ...ZERO_COST },
|
|
67
|
+
costInfo: { ...ZERO_COST, unpricedTokens: dump.tokenUsage.totalTokens },
|
|
47
68
|
guardState: {
|
|
48
69
|
iterationCount: dump.currentIteration,
|
|
49
70
|
elapsedMs: Math.max(0, dump.savedAt - dump.startedAt),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkpoint.js","sourceRoot":"","sources":["../../../src/runtime/query/checkpoint.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AAiBxD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAC/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB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AAA;CACxB;AAED,MAAM,WAAW,gBAAgB;IAChC,UAAU,EAAE,OAAO,CAAA;IACnB,aAAa,EAAE,OAAO,CAAA;IACtB,UAAU,CAAC,EAAE,UAAU,CAAA;IACvB,WAAW,EAAE,OAAO,CAAA;CACpB;AAED,qBAAa,gBAAgB;IAC5B,OAAO,CAAC,WAAW,CAAoB;IACvC,OAAO,CAAC,SAAS,CAAQ;gBAEb,MAAM,EAAE,WAAW;IAc/B;;;;;;;OAOG;IACH,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAIvC;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,yBAAyB,IAAI,MAAM;IAKnC,eAAe,CAAC,MAAM,EAAE,cAAc,EAAE,WAAW,EAAE,WAAW,GAAG,gBAAgB;CAoCnF"}
|
|
@@ -57,6 +57,7 @@ export class GuardCoordinator {
|
|
|
57
57
|
aborted: abortSignal.aborted,
|
|
58
58
|
totalTokens: runMgr.tokenUsage.totalTokens,
|
|
59
59
|
totalCost: runMgr.costInfo.totalCost,
|
|
60
|
+
unpricedTokens: runMgr.costInfo.unpricedTokens,
|
|
60
61
|
currentIteration: runMgr.currentIteration,
|
|
61
62
|
startTime: this.startTime,
|
|
62
63
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guard.js","sourceRoot":"","sources":["../../../src/runtime/query/guard.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AA0BjF,MAAM,OAAO,gBAAgB;IACpB,WAAW,CAAoB;IAC/B,SAAS,CAAQ;IAEzB,YAAY,MAAmB;QAC9B,IAAI,CAAC,WAAW,GAAG,gBAAgB,CAClC,MAAM,CAAC,WAAW,EAClB,MAAM,CAAC,SAAS,EAChB,MAAM,CAAC,YAAY,EACnB,MAAM,CAAC,aAAa,CACpB,CAAA;QACD,oEAAoE;QACpE,gEAAgE;QAChE,kEAAkE;QAClE,SAAS;QAC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IACH,kBAAkB,CAAC,EAAE,OAAO,CAAA;CAC5B;AAkFD,wBAAuB,KAAK,CAAC,MAAM,EAAE,WAAW,GAAG,cAAc,CAAC,QAAQ,EAAE,GAAG,CAAC,CAohC/E;AA+BD,wBAAsB,UAAU,CAC/B,MAAM,EAAE,IAAI,CAAC,WAAW,EAAE,eAAe,CAAC,GAAG;IAAE,aAAa,CAAC,EAAE,aAAa,CAAA;CAAE,EAC9E,QAAQ,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,GAAG,CAAC,CAgBd"}
|
|
@@ -7,6 +7,7 @@ import { serializeState as serializeWorkingState } from '../../compaction/serial
|
|
|
7
7
|
import { restoreWorkingState, snapshotWorkingState } from '../../compaction/wire.js';
|
|
8
8
|
import { TOOL_OUTPUT_DIR_NAME } from '../../constants/tools/index.js';
|
|
9
9
|
import { EmergencySaveManager } from '../../manager/run/emergency.js';
|
|
10
|
+
import { resolveModelPricing } from '../../pricing/index.js';
|
|
10
11
|
import { resolveProviderCapabilities } from '../../provider/capabilities.js';
|
|
11
12
|
import { withProviderFallback, } from '../../provider/fallback.js';
|
|
12
13
|
import { withProviderRetry } from '../../provider/retry.js';
|
|
@@ -75,6 +76,46 @@ function assertCostIsAttributable(chain, pricing) {
|
|
|
75
76
|
details: { chainLength: chain.length },
|
|
76
77
|
});
|
|
77
78
|
}
|
|
79
|
+
/**
|
|
80
|
+
* Refuse a budget that cannot be measured.
|
|
81
|
+
*
|
|
82
|
+
* `runConfig.costLimitUsd` is enforced against `costInfo.totalCost`, and that
|
|
83
|
+
* total only moves for tokens something has a rate for. A model no rate card
|
|
84
|
+
* covers therefore produced a limit that could never trip — a host that set a
|
|
85
|
+
* cost cap had no cost cap, and nothing said so. That was every run before the
|
|
86
|
+
* price catalogue existed, which is how it went unnoticed.
|
|
87
|
+
*
|
|
88
|
+
* Refusing at the front is the cheap half of the answer: it costs the caller
|
|
89
|
+
* nothing, fires before any spend, and names both ways out. The other half is
|
|
90
|
+
* the `cost_unmeasurable` stop, for the models this cannot see — a step naming
|
|
91
|
+
* its own, or a chain member declaring one.
|
|
92
|
+
*
|
|
93
|
+
* This is the same shape `advisory/budget.ts` already applies to
|
|
94
|
+
* `AdvisoryBudget.maxCostPerRun`, one layer down, and for the same reason. The
|
|
95
|
+
* run path simply never had it.
|
|
96
|
+
*/
|
|
97
|
+
function assertBudgetIsMeasurable(params) {
|
|
98
|
+
const limit = params.runConfig.costLimitUsd;
|
|
99
|
+
if (limit === undefined || limit <= 0)
|
|
100
|
+
return;
|
|
101
|
+
// A host-supplied table prices whatever it is pointed at, so a caller who
|
|
102
|
+
// brought one has answered the question themselves.
|
|
103
|
+
if (params.pricing !== undefined)
|
|
104
|
+
return;
|
|
105
|
+
const model = params.runConfig.model;
|
|
106
|
+
if (resolveModelPricing(params.provider.id, model) !== undefined)
|
|
107
|
+
return;
|
|
108
|
+
throw new NamzuError({
|
|
109
|
+
code: 'invalid_config',
|
|
110
|
+
message: `runConfig.costLimitUsd is set to ${limit}, but no rate is known for model "${model}" on ` +
|
|
111
|
+
`provider "${params.provider.id}". The limit is enforced against the run's accumulated ` +
|
|
112
|
+
'cost, and tokens with no rate never reach that total — so the budget would read as ' +
|
|
113
|
+
'satisfied for the whole run and stop nothing. Either pass `pricing` to declare the rate ' +
|
|
114
|
+
'yourself, add the model to packages/sdk/src/pricing/rates.source.json, or drop ' +
|
|
115
|
+
'`costLimitUsd` and bound the run with `tokenBudget`, which is measurable here.',
|
|
116
|
+
details: { model, providerId: params.provider.id, costLimitUsd: limit },
|
|
117
|
+
});
|
|
118
|
+
}
|
|
78
119
|
export async function* query(params) {
|
|
79
120
|
// Boot-time filesystem migration (session-hierarchy.md §13.4.1). First
|
|
80
121
|
// call per process per root actually runs; subsequent calls short-circuit
|
|
@@ -106,6 +147,7 @@ export async function* query(params) {
|
|
|
106
147
|
...(params.fallbackProviders ?? []),
|
|
107
148
|
];
|
|
108
149
|
assertCostIsAttributable(chain, params.pricing);
|
|
150
|
+
assertBudgetIsMeasurable(params);
|
|
109
151
|
const withRetry = (provider) => params.retry === false
|
|
110
152
|
? provider
|
|
111
153
|
: withProviderRetry(provider, { config: params.retry, log: getRootLogger() });
|