context-doctor 0.46.0 → 0.48.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/README.md +9 -4
- package/dist/ab.d.ts +51 -3
- package/dist/ab.js +71 -28
- package/dist/abclaude.d.ts +167 -0
- package/dist/abclaude.js +511 -0
- package/dist/abstore.d.ts +46 -0
- package/dist/abstore.js +58 -0
- package/dist/autopilot.js +9 -5
- package/dist/blob.js +66 -12
- package/dist/budget.d.ts +8 -2
- package/dist/budget.js +30 -7
- package/dist/ci.js +2 -1
- package/dist/claudeplugin.d.ts +97 -0
- package/dist/claudeplugin.js +142 -0
- package/dist/cli.js +128 -36
- package/dist/compactcost.d.ts +74 -0
- package/dist/compactcost.js +115 -0
- package/dist/cursor.js +2 -0
- package/dist/doctor.js +90 -18
- package/dist/extract.js +4 -3
- package/dist/fanout.d.ts +15 -0
- package/dist/fanout.js +30 -9
- package/dist/firstfix.d.ts +43 -0
- package/dist/firstfix.js +80 -0
- package/dist/fix.d.ts +53 -4
- package/dist/fix.js +101 -13
- package/dist/httpguard.d.ts +13 -0
- package/dist/httpguard.js +22 -0
- package/dist/install.d.ts +21 -9
- package/dist/install.js +213 -40
- package/dist/limits.d.ts +5 -0
- package/dist/limits.js +26 -2
- package/dist/mcp.d.ts +4 -0
- package/dist/mcp.js +142 -97
- package/dist/mcpclient.js +73 -42
- package/dist/missledger.js +5 -3
- package/dist/mod/api.d.ts +8 -2
- package/dist/mod/api.js +2 -2
- package/dist/mod/logic.d.ts +13 -1
- package/dist/mod/logic.js +24 -2
- package/dist/mod/register.d.ts +2 -0
- package/dist/mod/register.js +19 -5
- package/dist/modelids.d.ts +62 -3
- package/dist/modelids.js +156 -8
- package/dist/modelswitch.js +8 -4
- package/dist/modmeasure.js +13 -1
- package/dist/orgrates.d.ts +18 -0
- package/dist/orgrates.js +51 -2
- package/dist/pack.d.ts +13 -0
- package/dist/pack.js +38 -2
- package/dist/preferences.js +2 -1
- package/dist/pricing.d.ts +8 -0
- package/dist/pricing.js +30 -2
- package/dist/progresssummaries.d.ts +148 -0
- package/dist/progresssummaries.js +248 -0
- package/dist/proxy.d.ts +1 -1
- package/dist/proxy.js +1 -1
- package/dist/prune.d.ts +8 -0
- package/dist/prune.js +11 -1
- package/dist/spend.d.ts +34 -0
- package/dist/spend.js +48 -4
- package/dist/subagentmodel.d.ts +12 -0
- package/dist/subagentmodel.js +17 -4
- package/dist/subagentpay.d.ts +8 -0
- package/dist/subagentpay.js +8 -1
- package/dist/toolcwd.d.ts +14 -0
- package/dist/toolcwd.js +17 -0
- package/package.json +6 -3
package/dist/pack.js
CHANGED
|
@@ -21,6 +21,7 @@ import { estimateTokens, formatTokens } from "./tokens.js";
|
|
|
21
21
|
import { EXTRACT_BUDGET_MS, EXTRACTABLE, extractText, extractTextAsync, monotonicNow } from "./extract.js";
|
|
22
22
|
import { claudeDir, claudeJsonPath } from "./claudedir.js";
|
|
23
23
|
import { codexDir } from "./codexdir.js";
|
|
24
|
+
import { toolCwd } from "./toolcwd.js";
|
|
24
25
|
const DEFAULT_BUDGET = 4000;
|
|
25
26
|
const DEFAULT_CHUNK_TOKENS = 400;
|
|
26
27
|
/** Claude's tokenizer produces the most tokens per char; a budget in its terms never overruns another's. */
|
|
@@ -369,7 +370,7 @@ const SAFE_GIT = ["-c", "core.fsmonitor=false"];
|
|
|
369
370
|
/** Files git would consider part of the repository under `dir` (relative to it), or undefined outside git. */
|
|
370
371
|
function gitFiles(dir) {
|
|
371
372
|
try {
|
|
372
|
-
const r = spawnSync("git", [...SAFE_GIT, "-C", dir, "ls-files", "-z", "--cached", "--others", "--exclude-standard"], { encoding: "utf8", maxBuffer: 64 * 1024 * 1024, timeout: 30_000 });
|
|
373
|
+
const r = spawnSync("git", [...SAFE_GIT, "-C", dir, "ls-files", "-z", "--cached", "--others", "--exclude-standard"], { cwd: toolCwd(), encoding: "utf8", maxBuffer: 64 * 1024 * 1024, timeout: 30_000 });
|
|
373
374
|
if (r.status !== 0 || typeof r.stdout !== "string")
|
|
374
375
|
return undefined;
|
|
375
376
|
// --cached lists files deleted from the work tree too; only what exists is read.
|
|
@@ -382,7 +383,7 @@ function gitFiles(dir) {
|
|
|
382
383
|
/** Git ignores something under `dir`: why a folder that has files can list none. */
|
|
383
384
|
function gitIgnoresSome(dir) {
|
|
384
385
|
// --directory names an ignored folder once instead of every file in it.
|
|
385
|
-
const r = spawnSync("git", [...SAFE_GIT, "-C", dir, "ls-files", "-z", "--others", "--ignored", "--exclude-standard", "--directory"], { encoding: "utf8", maxBuffer: 64 * 1024 * 1024, timeout: 30_000 });
|
|
386
|
+
const r = spawnSync("git", [...SAFE_GIT, "-C", dir, "ls-files", "-z", "--others", "--ignored", "--exclude-standard", "--directory"], { cwd: toolCwd(), encoding: "utf8", maxBuffer: 64 * 1024 * 1024, timeout: 30_000 });
|
|
386
387
|
return r.status === 0 && typeof r.stdout === "string" && r.stdout.length > 0;
|
|
387
388
|
}
|
|
388
389
|
/** `inner` is `root` itself or somewhere under it. */
|
|
@@ -404,6 +405,12 @@ const SECRET_NAMES = new Set([
|
|
|
404
405
|
// Windows), Gemini CLI's, Terraform's.
|
|
405
406
|
".credentials.json", "oauth_creds.json", "credentials.tfrc.json",
|
|
406
407
|
]);
|
|
408
|
+
/**
|
|
409
|
+
* Shell histories: every command typed, `export TOKEN=…` and `curl -H
|
|
410
|
+
* "Authorization: …"` among them. Bash, zsh, fish (fish_history) and
|
|
411
|
+
* PowerShell (PSReadLine's ConsoleHost_history.txt).
|
|
412
|
+
*/
|
|
413
|
+
const HISTORY_NAMES = new Set([".bash_history", ".zsh_history", ".zhistory", ".sh_history", "fish_history", "consolehost_history.txt"]);
|
|
407
414
|
/** A file name that holds credentials inside one folder only: Codex's sign-in, Cargo's and RubyGems' tokens. */
|
|
408
415
|
const SECRET_IN_DIR = [
|
|
409
416
|
[".codex", ["auth.json"]],
|
|
@@ -411,6 +418,30 @@ const SECRET_IN_DIR = [
|
|
|
411
418
|
[".gem", ["credentials"]],
|
|
412
419
|
];
|
|
413
420
|
const SECRET_EXT = new Set([".pem", ".key", ".p12", ".pfx", ".keystore", ".jks"]);
|
|
421
|
+
/**
|
|
422
|
+
* Why the MCP server will not open a path a model names. A path the user
|
|
423
|
+
* types on the CLI is theirs to name.
|
|
424
|
+
* - Windows: a network share (\\host\share\…, \\?\UNC\…) or a device or
|
|
425
|
+
* pipe (\\.\…). Opening a share connects to that host over SMB and signs
|
|
426
|
+
* in as the user, handing whoever runs it the user's NTLM hash; a
|
|
427
|
+
* document can ask the model to "pack \\host\share\notes.md".
|
|
428
|
+
* - Windows: an alternate data stream (notes.md:hidden, .env::$DATA). A
|
|
429
|
+
* stream is the same file under a name no refusal here recognises.
|
|
430
|
+
* - macOS: /net/<host>/…, which the automounter mounts from that host on
|
|
431
|
+
* first access.
|
|
432
|
+
*/
|
|
433
|
+
export function remotePathReason(path, platform = process.platform) {
|
|
434
|
+
const p = path.trim();
|
|
435
|
+
if (platform === "win32") {
|
|
436
|
+
if (/^[\\/]{2}/.test(p))
|
|
437
|
+
return "a network share or device path (\\\\host\\share, \\\\.\\…): pack_context reads this computer's own files only";
|
|
438
|
+
if (p.replace(/^[a-zA-Z]:/, "").includes(":"))
|
|
439
|
+
return "an alternate data stream (a name with \":\" after the drive): pack_context reads files by their own names";
|
|
440
|
+
}
|
|
441
|
+
if (platform === "darwin" && /^\/+net(\/|$)/i.test(p))
|
|
442
|
+
return "a /net path, which macOS mounts from another host on access: pack_context reads this computer's own files only";
|
|
443
|
+
return undefined;
|
|
444
|
+
}
|
|
414
445
|
/** Why `path` looks like a secrets file, or undefined when it does not. */
|
|
415
446
|
export function secretFileReason(path) {
|
|
416
447
|
const name = basename(path);
|
|
@@ -419,6 +450,8 @@ export function secretFileReason(path) {
|
|
|
419
450
|
return "an .env file";
|
|
420
451
|
if (SECRET_NAMES.has(lower))
|
|
421
452
|
return `a credentials file (${name})`;
|
|
453
|
+
if (HISTORY_NAMES.has(lower))
|
|
454
|
+
return `a shell history (${name})`;
|
|
422
455
|
if (/^id_(rsa|dsa|ecdsa|ed25519)(_sk)?$/.test(lower) || (/^id_(rsa|dsa|ecdsa|ed25519)/.test(lower) && !lower.endsWith(".pub"))) {
|
|
423
456
|
return "a private SSH key";
|
|
424
457
|
}
|
|
@@ -440,6 +473,9 @@ function sensitiveDirs() {
|
|
|
440
473
|
const home = homedir();
|
|
441
474
|
const dirs = [
|
|
442
475
|
...[".ssh", ".aws", ".gnupg", ".kube", ".docker", ".azure", join(".config", "gcloud"), join(".config", "gh"), join(".config", "github-copilot"), join("Library", "Keychains"), ".password-store"].map((d) => join(home, d)),
|
|
476
|
+
// Package registries' sign-ins in the home folder: Yarn's npmAuthToken, Maven's server passwords.
|
|
477
|
+
// (A project's own .yarnrc.yml rides in the repository and is read.)
|
|
478
|
+
...[".yarnrc.yml", join(".m2", "settings.xml"), join(".m2", "settings-security.xml")].map((f) => join(home, f)),
|
|
443
479
|
// Where CLAUDE_CONFIG_DIR and CODEX_HOME put the agents' sign-ins.
|
|
444
480
|
join(claudeDir(), ".credentials.json"), join(codexDir(), "auth.json"),
|
|
445
481
|
"/etc/shadow", "/etc/gshadow", "/etc/sudoers", "/etc/master.passwd", "/etc/ssh",
|
package/dist/preferences.js
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* edited, so a long chat continues in a new one from a short brief.
|
|
10
10
|
*/
|
|
11
11
|
import { spawnSync } from "node:child_process";
|
|
12
|
+
import { toolCwd } from "./toolcwd.js";
|
|
12
13
|
export const CHAT_PREFERENCES = [
|
|
13
14
|
"Context hygiene: summarize anything long I paste into the points you will use; refer to it by name, never re-quote it,",
|
|
14
15
|
"never inline base64. When I ask about tokens, limits, cost or speed, and once past ~30 turns: if profile_context exists,",
|
|
@@ -27,7 +28,7 @@ export function copyToClipboard(text, platform = process.platform) {
|
|
|
27
28
|
: platform === "win32" ? [["clip", []]]
|
|
28
29
|
: [["wl-copy", []], ["xclip", ["-selection", "clipboard"]], ["xsel", ["--clipboard", "--input"]]];
|
|
29
30
|
for (const [cmd, args] of candidates) {
|
|
30
|
-
const r = spawnSync(cmd, args, { input: text, stdio: ["pipe", "ignore", "ignore"] });
|
|
31
|
+
const r = spawnSync(cmd, args, { cwd: toolCwd(), input: text, stdio: ["pipe", "ignore", "ignore"] });
|
|
31
32
|
if (!r.error && r.status === 0)
|
|
32
33
|
return true;
|
|
33
34
|
}
|
package/dist/pricing.d.ts
CHANGED
|
@@ -43,6 +43,14 @@ export declare const CACHE_WRITE_1H = 2;
|
|
|
43
43
|
*/
|
|
44
44
|
export declare const CACHE_WRITE_OPENAI_30M = 1.25;
|
|
45
45
|
export declare const CACHE_WRITE_OPENAI_12H = 2.5;
|
|
46
|
+
/**
|
|
47
|
+
* A fingerprint of this table and its billing constants. Dollars a ledger
|
|
48
|
+
* keeps per request (the budget's, a session's price) were priced by the
|
|
49
|
+
* table of the context-doctor that read them: under another table (an
|
|
50
|
+
* upgrade that corrected a price, as 0.46 did Fable 5.2's) they are stale
|
|
51
|
+
* and read again, not carried to the period's end.
|
|
52
|
+
*/
|
|
53
|
+
export declare function priceTableKey(): string;
|
|
46
54
|
/** A model's list row, as the page lists it today (no tier, mode or date applied). */
|
|
47
55
|
export declare function pricingFor(model?: string): ModelPricing | undefined;
|
|
48
56
|
/**
|
package/dist/pricing.js
CHANGED
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
* at a family's price, so a new release still gets a number. A model a
|
|
16
16
|
* provider prices only per minute, per image or not at all has no row.
|
|
17
17
|
*/
|
|
18
|
+
import { createHash } from "node:crypto";
|
|
18
19
|
import { orgApplies, orgRates, orgRowFor } from "./orgrates.js";
|
|
19
20
|
/** What a cache write costs per 1M tokens at `mult` times input (its TTL's), or the row's own write rate. */
|
|
20
21
|
export function writePerM(p, mult) {
|
|
@@ -144,12 +145,15 @@ const PRICING = [
|
|
|
144
145
|
// Fast mode (priority processing; Codex records only its thread's
|
|
145
146
|
// `service_tier`, not each request's) and the 10% regional uplift.
|
|
146
147
|
[openai("gpt-6-astra"), ...openaiLong(10, 50, 1)],
|
|
148
|
+
// GPT-6 Astra for Law's price is promotional "at least through December
|
|
149
|
+
// 31, 2026" (read 2026-11-14): no end date to record yet.
|
|
147
150
|
[openai("gpt-6-astra-law"), rate(10, 50, 1)],
|
|
148
151
|
[openai("gpt-6.1-sol"), ...openaiLong(2, 10, 0.1)],
|
|
149
152
|
[openai("gpt-6.1-terra"), ...openaiLong(1, 5, 0.05)],
|
|
150
153
|
[openai("gpt-6-sol"), ...openaiLong(2, 10, 0.2)],
|
|
151
154
|
[openai("gpt-6-luna"), ...openaiLong(0.1, 0.5, 0.01)],
|
|
152
|
-
|
|
155
|
+
// gpt-6-cyber's long-context row ($40 / $150 / $4, read 2026-11-14) is 2x / 1.5x.
|
|
156
|
+
[openai("gpt-6-cyber"), ...openaiLong(20, 100, 2)],
|
|
153
157
|
[openai("gpt-6-rosalind"), ...openaiLong(15, 75, 1.5)],
|
|
154
158
|
[openai("gpt-rosalind-research"), rate(5, 25, 0.5)],
|
|
155
159
|
[openai("gpt-rosalind-discovery"), rate(5, 25, 0.5)],
|
|
@@ -164,6 +168,8 @@ const PRICING = [
|
|
|
164
168
|
[openai("gpt-5.5"), ...openaiLong(5, 30, 0.5)],
|
|
165
169
|
[openai("gpt-5.5-pro"), ...openaiLong(30, 180, 30)],
|
|
166
170
|
[openai("gpt-5.5-cyber"), rate(12.5, 75, 1.25)],
|
|
171
|
+
// The page names it gpt-5.5-cyber-preview now (read 2026-11-14), at the same price.
|
|
172
|
+
[openai("gpt-5.5-cyber-preview"), rate(12.5, 75, 1.25)],
|
|
167
173
|
[openai("gpt-5.4"), ...openaiLong(2.5, 15, 0.25)],
|
|
168
174
|
[openai("gpt-5.4-mini"), rate(0.75, 4.5, 0.075)],
|
|
169
175
|
[openai("gpt-5.4-nano"), rate(0.2, 1.25, 0.02)],
|
|
@@ -183,6 +189,8 @@ const PRICING = [
|
|
|
183
189
|
[openai("o3"), rate(2, 8, 0.5)],
|
|
184
190
|
[openai("o3-pro"), rate(20, 80, 20)],
|
|
185
191
|
[openai("chat-latest"), rate(5, 30, 0.5)],
|
|
192
|
+
// Specialized models, Search (read 2026-11-14); its web search fee is per call, not modelled.
|
|
193
|
+
[openai("gpt-5-search-api"), rate(1.25, 10, 0.125)],
|
|
186
194
|
// Fallbacks for OpenAI ids not on the page (gpt-5-codex, gpt-5.1-codex-max,
|
|
187
195
|
// gpt-4.1-nano, gpt-4-turbo, o1, o3-mini...): older approximate prices.
|
|
188
196
|
[/gpt-5.*(mini|nano)/i, rate(0.25, 2, 0.025), FALLBACK],
|
|
@@ -194,8 +202,13 @@ const PRICING = [
|
|
|
194
202
|
// Google: ai.google.dev/gemini-api/docs/pricing (paid tier, Standard, text),
|
|
195
203
|
// read 2026-11-06; the dates and the Pro tiers read again 2026-11-08.
|
|
196
204
|
// Gemini 4 Argon's $2 / $10 / $0.10 hold "through November 30, 2026";
|
|
197
|
-
// "starting December 1, 2026" it is $4 / $20 / $0.20.
|
|
205
|
+
// "starting December 1, 2026" it is $4 / $20 / $0.20. Read again
|
|
206
|
+
// 2026-11-14: unchanged; Gemini 4 Carbon is new at the same prices and
|
|
207
|
+
// dates, Gemini 4 Hydrogen new at $1.50 / $7.50 / $0.075 with no date.
|
|
208
|
+
// Neither has a long-prompt tier (one 1M-token context).
|
|
209
|
+
[gemini("gemini-4-carbon"), rate(2, 10, 0.1), { changes: "2026-12-01", then: rate(4, 20, 0.2) }],
|
|
198
210
|
[gemini("gemini-4-argon"), rate(2, 10, 0.1), { changes: "2026-12-01", then: rate(4, 20, 0.2) }],
|
|
211
|
+
[gemini("gemini-4-hydrogen"), rate(1.5, 7.5, 0.075)],
|
|
199
212
|
// 3.6 and 3.8 Flash double "starting January 1, 2027" ($1.50 / $7.50 / $0.15).
|
|
200
213
|
[gemini("gemini-3.8-flash"), rate(0.75, 3.75, 0.075), { changes: "2027-01-01", then: rate(1.5, 7.5, 0.15) }],
|
|
201
214
|
[gemini("gemini-3.6-flash"), rate(0.75, 3.75, 0.075), { changes: "2027-01-01", then: rate(1.5, 7.5, 0.15) }],
|
|
@@ -219,6 +232,21 @@ const PRICING = [
|
|
|
219
232
|
[/gemini.*flash/i, rate(0.1, 0.4, 0.025), FALLBACK],
|
|
220
233
|
[/gemini.*pro/i, rate(1.25, 5, 0.31), FALLBACK],
|
|
221
234
|
];
|
|
235
|
+
let tableKey;
|
|
236
|
+
/**
|
|
237
|
+
* A fingerprint of this table and its billing constants. Dollars a ledger
|
|
238
|
+
* keeps per request (the budget's, a session's price) were priced by the
|
|
239
|
+
* table of the context-doctor that read them: under another table (an
|
|
240
|
+
* upgrade that corrected a price, as 0.46 did Fable 5.2's) they are stale
|
|
241
|
+
* and read again, not carried to the period's end.
|
|
242
|
+
*/
|
|
243
|
+
export function priceTableKey() {
|
|
244
|
+
tableKey ??= createHash("sha1")
|
|
245
|
+
.update(JSON.stringify([PRICING.map(([re, p, b]) => [re.source, re.flags, p, b ?? null]), CACHE_WRITE_5M, CACHE_WRITE_1H, CACHE_WRITE_OPENAI_30M, CACHE_WRITE_OPENAI_12H, US_ONLY_MULTIPLIER, WEB_SEARCH_USD]))
|
|
246
|
+
.digest("hex")
|
|
247
|
+
.slice(0, 12);
|
|
248
|
+
return tableKey;
|
|
249
|
+
}
|
|
222
250
|
function row(model) {
|
|
223
251
|
if (!model)
|
|
224
252
|
return undefined;
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Claude Code's subagent progress summaries, estimated: side requests no
|
|
3
|
+
* transcript records. The `progress-summaries` lever of `fix`.
|
|
4
|
+
*
|
|
5
|
+
* While a background subagent runs, Claude Code asks a model every 30
|
|
6
|
+
* seconds for a 3-5 word line about what it is doing (the text on its task
|
|
7
|
+
* row). The request is made with `skipTranscript`, so no transcript row
|
|
8
|
+
* carries it, and Claude Code bills it and counts it in its own cost
|
|
9
|
+
* (anthropics/claude-code#86879 measured 22.7% of one subagent-heavy
|
|
10
|
+
* session's requests). `CLAUDE_CODE_DISABLE_AGENT_PROGRESS_SUMMARIES=1`
|
|
11
|
+
* (2.1.318+, documented in 2.1.323) turns them off, and the requests with
|
|
12
|
+
* them. The summary never enters the agent's context: the work is the same.
|
|
13
|
+
*
|
|
14
|
+
* Read from the 2.1.321 binary (the Desktop app's bundled Claude Code, with
|
|
15
|
+
* `strings`; docs/spend.md has the details):
|
|
16
|
+
* - Who gets them. Only a subagent run in the background (the async
|
|
17
|
+
* runner), and there only when the host asked for them (the SDK's
|
|
18
|
+
* `agentProgressSummaries` option) or the session is interactive (a
|
|
19
|
+
* terminal, `entrypoint: "cli"`) and the fork gate is open (on unless
|
|
20
|
+
* CLAUDE_CODE_FORK_SUBAGENT=0) or coordinator mode is on. A fork launched
|
|
21
|
+
* in the background gets them in every mode. A foreground subagent gets
|
|
22
|
+
* them only when the host asked. Workflow agents never do. The Desktop
|
|
23
|
+
* app's Code tab runs Claude Code through the SDK, so its sessions are
|
|
24
|
+
* not interactive, and its bundle (5.11492) never sets the option: none.
|
|
25
|
+
* - How often. A timer every 30 s from the agent's start; a tick is skipped
|
|
26
|
+
* while the agent's transcript has fewer than 3 messages or has not
|
|
27
|
+
* changed since the last summary; it stops when the agent ends.
|
|
28
|
+
* - What each sends. Either the agent's whole conversation as a one-turn
|
|
29
|
+
* fork on the agent's own model (no cache write, so its prefix is read
|
|
30
|
+
* from the agent's cache), or ("short") at most ~1,500 tokens of notes
|
|
31
|
+
* about its recent steps, with prompt caching off and low effort, on the
|
|
32
|
+
* agent's own model (or Haiku). Which one is served per model from
|
|
33
|
+
* Anthropic's side and is not in any file here; Anthropic said on
|
|
34
|
+
* 2026-11-09 (#86879) that the summaries now "consume 99% less", which is
|
|
35
|
+
* the notes. So both are priced: the notes as the low figure, the whole
|
|
36
|
+
* context as the high one.
|
|
37
|
+
*
|
|
38
|
+
* Estimated per subagent from what its transcript does record: the time of
|
|
39
|
+
* each message (the ticks and whether the transcript changed), each reply's
|
|
40
|
+
* prompt size and model (the context a fork would read, the rates). Each
|
|
41
|
+
* summary's output is #86879's measured mean (65 tokens). Not counted: a
|
|
42
|
+
* tick held while the agent's own request waits on a cold cache (it fires
|
|
43
|
+
* later, not more often), and the thinking a summary may do.
|
|
44
|
+
*/
|
|
45
|
+
import { type Extractor } from "./scan.js";
|
|
46
|
+
/** The variable the lever writes, and the value: Claude Code passes only "1" on to the sessions it starts in the background. */
|
|
47
|
+
export declare const PROGRESS_SUMMARIES_ENV = "CLAUDE_CODE_DISABLE_AGENT_PROGRESS_SUMMARIES";
|
|
48
|
+
export declare const PROGRESS_SUMMARIES_OFF = "1";
|
|
49
|
+
/** The first Claude Code that reads it (its CHANGELOG, 2.1.323: "available since 2.1.318"). */
|
|
50
|
+
export declare const PROGRESS_SUMMARIES_SINCE = "2.1.318";
|
|
51
|
+
/** The summary timer (the binary's default; #86879 and #105981 measured 30-32 s). */
|
|
52
|
+
export declare const SUMMARY_TICK_MS = 30000;
|
|
53
|
+
/** A short summary's prompt: notes capped at 2,000 - 500 tokens, plus its system prompt and instruction. */
|
|
54
|
+
export declare const NOTES_TOKENS = 1850;
|
|
55
|
+
/** A fork summary's own instruction, after the agent's context. */
|
|
56
|
+
export declare const FORK_PROMPT_TOKENS = 150;
|
|
57
|
+
/** Each summary's output: #86879's measured mean (21,966 tokens over 339 summaries). */
|
|
58
|
+
export declare const SUMMARY_OUTPUT_TOKENS = 65;
|
|
59
|
+
/** How Claude Code reads the variable (a boolean: "1", "true", "yes", "on"). */
|
|
60
|
+
export declare const disablesSummaries: (v: unknown) => boolean;
|
|
61
|
+
/**
|
|
62
|
+
* One subagent transcript's timeline: the first row's host and version, the
|
|
63
|
+
* time of each message, and each reply's prompt size and model (once per
|
|
64
|
+
* reply; its output is in the next prompt).
|
|
65
|
+
*/
|
|
66
|
+
export declare const PROGRESS_ROWS: Extractor<{
|
|
67
|
+
head: boolean;
|
|
68
|
+
ids: Record<string, 1>;
|
|
69
|
+
}>;
|
|
70
|
+
/** What a subagent's `.meta.json` says about how it ran (2.1.266+ write requestShape). */
|
|
71
|
+
export interface AgentMeta {
|
|
72
|
+
agentType?: string;
|
|
73
|
+
requestShape?: string;
|
|
74
|
+
isFork?: boolean;
|
|
75
|
+
}
|
|
76
|
+
export declare function readAgentMeta(file: string): AgentMeta | undefined;
|
|
77
|
+
/** Why a subagent gets no summaries, or "yes". */
|
|
78
|
+
export type Eligibility = "yes" | "foreground" | "host" | "workflow" | "unknown" | "fork-gate-off" | "off" | "old";
|
|
79
|
+
/**
|
|
80
|
+
* Whether Claude Code (2.1.321's rules) wrote progress summaries for this
|
|
81
|
+
* agent. `interactive`: whether its host counts as interactive (default: a
|
|
82
|
+
* terminal session, entrypoint "cli").
|
|
83
|
+
*/
|
|
84
|
+
export declare function eligibility(meta: AgentMeta | undefined, entrypoint: string | undefined, opts?: {
|
|
85
|
+
workflow?: boolean;
|
|
86
|
+
forkGateOff?: boolean;
|
|
87
|
+
interactive?: (entrypoint: string | undefined) => boolean;
|
|
88
|
+
}): Eligibility;
|
|
89
|
+
/** One subagent's summaries: how many, and their price both ways. */
|
|
90
|
+
export interface AgentSummaries {
|
|
91
|
+
calls: number;
|
|
92
|
+
notesUsd: number;
|
|
93
|
+
forkUsd: number;
|
|
94
|
+
}
|
|
95
|
+
type Rec = {
|
|
96
|
+
t: "h";
|
|
97
|
+
entrypoint?: string;
|
|
98
|
+
version?: string;
|
|
99
|
+
} | {
|
|
100
|
+
t: "m";
|
|
101
|
+
ts: number;
|
|
102
|
+
} | {
|
|
103
|
+
t: "r";
|
|
104
|
+
ts: number;
|
|
105
|
+
model?: string;
|
|
106
|
+
p: number;
|
|
107
|
+
speed?: string;
|
|
108
|
+
geo?: string;
|
|
109
|
+
};
|
|
110
|
+
/**
|
|
111
|
+
* The ticks a running agent's timer made and the summaries they sent, from
|
|
112
|
+
* its timeline: every 30 s from its first row to its last, a summary when
|
|
113
|
+
* it has 3+ messages and more than at the last summary. Only ticks in
|
|
114
|
+
* [since, until] are counted.
|
|
115
|
+
*/
|
|
116
|
+
export declare function simulateAgent(recs: Rec[], since?: number, until?: number): AgentSummaries;
|
|
117
|
+
export interface ProgressSummaryEstimate {
|
|
118
|
+
/** Subagent transcripts read (workflow agents included). */
|
|
119
|
+
agents: number;
|
|
120
|
+
/** Agents Claude Code wrote summaries for in the window, by the rules above. */
|
|
121
|
+
summarized: number;
|
|
122
|
+
calls: number;
|
|
123
|
+
/** The summaries as short notes (what Anthropic serves since November 2026): the low figure. */
|
|
124
|
+
notesUsd: number;
|
|
125
|
+
/** As a fork of the whole context (before): the high figure. */
|
|
126
|
+
forkUsd: number;
|
|
127
|
+
/** Agents with none, by why. */
|
|
128
|
+
none: Partial<Record<Exclude<Eligibility, "yes">, number>>;
|
|
129
|
+
/** The hosts of the background agents that got none because their host is not interactive. */
|
|
130
|
+
hosts: string[];
|
|
131
|
+
}
|
|
132
|
+
export interface ProgressOptions {
|
|
133
|
+
since?: number;
|
|
134
|
+
until?: number;
|
|
135
|
+
/** CLAUDE_CODE_FORK_SUBAGENT is off: interactive sessions' ordinary background agents got none. */
|
|
136
|
+
forkGateOff?: boolean;
|
|
137
|
+
/** From this time, on Claude Code 2.1.318+, the variable was set (fix's record): none after it. */
|
|
138
|
+
offSince?: number;
|
|
139
|
+
/** Which hosts count as interactive (default: entrypoint "cli"); a measurement can ask "what if all were". */
|
|
140
|
+
interactive?: (entrypoint: string | undefined) => boolean;
|
|
141
|
+
/** Only agents on this Claude Code or newer (what the variable would have stopped: 2.1.318+). */
|
|
142
|
+
minVersion?: string;
|
|
143
|
+
}
|
|
144
|
+
/** The summaries of the subagents in `files` (their `.jsonl` transcripts), estimated. */
|
|
145
|
+
export declare function estimateProgressSummaries(files: string[], opts?: ProgressOptions): ProgressSummaryEstimate;
|
|
146
|
+
/** "the Desktop app", "the SDK or -p": a host as a person knows it. */
|
|
147
|
+
export declare function hostName(entrypoint: string): string;
|
|
148
|
+
export {};
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Claude Code's subagent progress summaries, estimated: side requests no
|
|
3
|
+
* transcript records. The `progress-summaries` lever of `fix`.
|
|
4
|
+
*
|
|
5
|
+
* While a background subagent runs, Claude Code asks a model every 30
|
|
6
|
+
* seconds for a 3-5 word line about what it is doing (the text on its task
|
|
7
|
+
* row). The request is made with `skipTranscript`, so no transcript row
|
|
8
|
+
* carries it, and Claude Code bills it and counts it in its own cost
|
|
9
|
+
* (anthropics/claude-code#86879 measured 22.7% of one subagent-heavy
|
|
10
|
+
* session's requests). `CLAUDE_CODE_DISABLE_AGENT_PROGRESS_SUMMARIES=1`
|
|
11
|
+
* (2.1.318+, documented in 2.1.323) turns them off, and the requests with
|
|
12
|
+
* them. The summary never enters the agent's context: the work is the same.
|
|
13
|
+
*
|
|
14
|
+
* Read from the 2.1.321 binary (the Desktop app's bundled Claude Code, with
|
|
15
|
+
* `strings`; docs/spend.md has the details):
|
|
16
|
+
* - Who gets them. Only a subagent run in the background (the async
|
|
17
|
+
* runner), and there only when the host asked for them (the SDK's
|
|
18
|
+
* `agentProgressSummaries` option) or the session is interactive (a
|
|
19
|
+
* terminal, `entrypoint: "cli"`) and the fork gate is open (on unless
|
|
20
|
+
* CLAUDE_CODE_FORK_SUBAGENT=0) or coordinator mode is on. A fork launched
|
|
21
|
+
* in the background gets them in every mode. A foreground subagent gets
|
|
22
|
+
* them only when the host asked. Workflow agents never do. The Desktop
|
|
23
|
+
* app's Code tab runs Claude Code through the SDK, so its sessions are
|
|
24
|
+
* not interactive, and its bundle (5.11492) never sets the option: none.
|
|
25
|
+
* - How often. A timer every 30 s from the agent's start; a tick is skipped
|
|
26
|
+
* while the agent's transcript has fewer than 3 messages or has not
|
|
27
|
+
* changed since the last summary; it stops when the agent ends.
|
|
28
|
+
* - What each sends. Either the agent's whole conversation as a one-turn
|
|
29
|
+
* fork on the agent's own model (no cache write, so its prefix is read
|
|
30
|
+
* from the agent's cache), or ("short") at most ~1,500 tokens of notes
|
|
31
|
+
* about its recent steps, with prompt caching off and low effort, on the
|
|
32
|
+
* agent's own model (or Haiku). Which one is served per model from
|
|
33
|
+
* Anthropic's side and is not in any file here; Anthropic said on
|
|
34
|
+
* 2026-11-09 (#86879) that the summaries now "consume 99% less", which is
|
|
35
|
+
* the notes. So both are priced: the notes as the low figure, the whole
|
|
36
|
+
* context as the high one.
|
|
37
|
+
*
|
|
38
|
+
* Estimated per subagent from what its transcript does record: the time of
|
|
39
|
+
* each message (the ticks and whether the transcript changed), each reply's
|
|
40
|
+
* prompt size and model (the context a fork would read, the rates). Each
|
|
41
|
+
* summary's output is #86879's measured mean (65 tokens). Not counted: a
|
|
42
|
+
* tick held while the agent's own request waits on a cold cache (it fires
|
|
43
|
+
* later, not more often), and the thinking a summary may do.
|
|
44
|
+
*/
|
|
45
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
46
|
+
import { pick, rowsOf } from "./scan.js";
|
|
47
|
+
import { requestCost } from "./pricing.js";
|
|
48
|
+
import { realModel } from "./tokens.js";
|
|
49
|
+
import { workflowRunOf } from "./subagents.js";
|
|
50
|
+
import { compareVersions } from "./modelswitch.js";
|
|
51
|
+
/** The variable the lever writes, and the value: Claude Code passes only "1" on to the sessions it starts in the background. */
|
|
52
|
+
export const PROGRESS_SUMMARIES_ENV = "CLAUDE_CODE_DISABLE_AGENT_PROGRESS_SUMMARIES";
|
|
53
|
+
export const PROGRESS_SUMMARIES_OFF = "1";
|
|
54
|
+
/** The first Claude Code that reads it (its CHANGELOG, 2.1.323: "available since 2.1.318"). */
|
|
55
|
+
export const PROGRESS_SUMMARIES_SINCE = "2.1.318";
|
|
56
|
+
/** The summary timer (the binary's default; #86879 and #105981 measured 30-32 s). */
|
|
57
|
+
export const SUMMARY_TICK_MS = 30_000;
|
|
58
|
+
/** A short summary's prompt: notes capped at 2,000 - 500 tokens, plus its system prompt and instruction. */
|
|
59
|
+
export const NOTES_TOKENS = 1_850;
|
|
60
|
+
/** A fork summary's own instruction, after the agent's context. */
|
|
61
|
+
export const FORK_PROMPT_TOKENS = 150;
|
|
62
|
+
/** Each summary's output: #86879's measured mean (21,966 tokens over 339 summaries). */
|
|
63
|
+
export const SUMMARY_OUTPUT_TOKENS = 65;
|
|
64
|
+
/** How Claude Code reads the variable (a boolean: "1", "true", "yes", "on"). */
|
|
65
|
+
export const disablesSummaries = (v) => ["1", "true", "yes", "on"].includes(String(v ?? "").trim().toLowerCase());
|
|
66
|
+
/**
|
|
67
|
+
* One subagent transcript's timeline: the first row's host and version, the
|
|
68
|
+
* time of each message, and each reply's prompt size and model (once per
|
|
69
|
+
* reply; its output is in the next prompt).
|
|
70
|
+
*/
|
|
71
|
+
export const PROGRESS_ROWS = {
|
|
72
|
+
id: "progress-summaries.1",
|
|
73
|
+
init: () => ({ head: false, ids: {} }),
|
|
74
|
+
line(raw, row, out, st) {
|
|
75
|
+
if (!raw.includes('"timestamp"'))
|
|
76
|
+
return;
|
|
77
|
+
let e;
|
|
78
|
+
try {
|
|
79
|
+
e = row();
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
if (!e || typeof e !== "object")
|
|
85
|
+
return;
|
|
86
|
+
if (!st.head && (typeof e.entrypoint === "string" || typeof e.version === "string")) {
|
|
87
|
+
st.head = true;
|
|
88
|
+
out.push({ t: "h", ...pick(e, ["entrypoint", "version"]) });
|
|
89
|
+
}
|
|
90
|
+
if (e.type !== "user" && e.type !== "assistant" && e.type !== "attachment")
|
|
91
|
+
return;
|
|
92
|
+
const ts = Date.parse(String(e.timestamp ?? ""));
|
|
93
|
+
if (!Number.isFinite(ts))
|
|
94
|
+
return;
|
|
95
|
+
out.push({ t: "m", ts });
|
|
96
|
+
const m = e.message;
|
|
97
|
+
if (e.type !== "assistant" || !m?.usage)
|
|
98
|
+
return;
|
|
99
|
+
const id = typeof m.id === "string" ? m.id : undefined;
|
|
100
|
+
if (id) {
|
|
101
|
+
if (st.ids[id])
|
|
102
|
+
return;
|
|
103
|
+
st.ids[id] = 1;
|
|
104
|
+
}
|
|
105
|
+
const u = m.usage;
|
|
106
|
+
const n = (v) => (typeof v === "number" && Number.isFinite(v) && v > 0 ? v : 0);
|
|
107
|
+
const prompt = n(u.input_tokens) + n(u.cache_read_input_tokens) + n(u.cache_creation_input_tokens);
|
|
108
|
+
out.push({ t: "r", ts, model: realModel(m.model), p: prompt, ...(u.speed === "fast" ? { speed: "fast" } : {}), ...(u.inference_geo === "us" ? { geo: "us" } : {}) });
|
|
109
|
+
},
|
|
110
|
+
};
|
|
111
|
+
export function readAgentMeta(file) {
|
|
112
|
+
const p = file.replace(/\.jsonl$/, ".meta.json");
|
|
113
|
+
if (!existsSync(p))
|
|
114
|
+
return undefined;
|
|
115
|
+
try {
|
|
116
|
+
const j = JSON.parse(readFileSync(p, "utf8"));
|
|
117
|
+
if (!j || typeof j !== "object")
|
|
118
|
+
return undefined;
|
|
119
|
+
return { ...(typeof j.agentType === "string" ? { agentType: j.agentType } : {}), ...(typeof j.requestShape === "string" ? { requestShape: j.requestShape } : {}), ...(j.isFork === true ? { isFork: true } : {}) };
|
|
120
|
+
}
|
|
121
|
+
catch {
|
|
122
|
+
return undefined;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Whether Claude Code (2.1.321's rules) wrote progress summaries for this
|
|
127
|
+
* agent. `interactive`: whether its host counts as interactive (default: a
|
|
128
|
+
* terminal session, entrypoint "cli").
|
|
129
|
+
*/
|
|
130
|
+
export function eligibility(meta, entrypoint, opts = {}) {
|
|
131
|
+
if (opts.workflow || meta?.agentType === "workflow-subagent")
|
|
132
|
+
return "workflow";
|
|
133
|
+
if (!meta?.requestShape)
|
|
134
|
+
return "unknown";
|
|
135
|
+
if (meta.requestShape !== "background")
|
|
136
|
+
return "foreground";
|
|
137
|
+
if (meta.isFork)
|
|
138
|
+
return "yes";
|
|
139
|
+
const interactive = opts.interactive ?? ((ep) => ep === "cli");
|
|
140
|
+
if (!interactive(entrypoint))
|
|
141
|
+
return "host";
|
|
142
|
+
return opts.forkGateOff ? "fork-gate-off" : "yes";
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* The ticks a running agent's timer made and the summaries they sent, from
|
|
146
|
+
* its timeline: every 30 s from its first row to its last, a summary when
|
|
147
|
+
* it has 3+ messages and more than at the last summary. Only ticks in
|
|
148
|
+
* [since, until] are counted.
|
|
149
|
+
*/
|
|
150
|
+
export function simulateAgent(recs, since = -Infinity, until = Infinity) {
|
|
151
|
+
const msgs = recs.filter((r) => r.t === "m").map((r) => r.ts).sort((a, b) => a - b);
|
|
152
|
+
const replies = recs.filter((r) => r.t === "r").sort((a, b) => a.ts - b.ts);
|
|
153
|
+
const out = { calls: 0, notesUsd: 0, forkUsd: 0 };
|
|
154
|
+
if (msgs.length < 3 || replies.length === 0)
|
|
155
|
+
return out;
|
|
156
|
+
const start = msgs[0];
|
|
157
|
+
const end = msgs[msgs.length - 1];
|
|
158
|
+
let n = 0, last = 0, ri = -1;
|
|
159
|
+
for (let at = start + SUMMARY_TICK_MS; at <= end; at += SUMMARY_TICK_MS) {
|
|
160
|
+
while (n < msgs.length && msgs[n] <= at)
|
|
161
|
+
n++;
|
|
162
|
+
while (ri + 1 < replies.length && replies[ri + 1].ts <= at)
|
|
163
|
+
ri++;
|
|
164
|
+
if (n < 3 || n === last)
|
|
165
|
+
continue;
|
|
166
|
+
last = n;
|
|
167
|
+
if (at < since || at > until)
|
|
168
|
+
continue;
|
|
169
|
+
// The last reply's prompt is cached (the fork reads it); what came after it (its output, the
|
|
170
|
+
// tool results) is new, as far as the next reply's prompt says; before any reply, the first prompt.
|
|
171
|
+
const cur = ri >= 0 ? replies[ri] : undefined;
|
|
172
|
+
const next = replies[ri + 1];
|
|
173
|
+
const ref = cur ?? next;
|
|
174
|
+
const model = ref.model;
|
|
175
|
+
if (!model)
|
|
176
|
+
continue;
|
|
177
|
+
const read = cur ? cur.p : 0;
|
|
178
|
+
const fresh = (next ? Math.max(0, next.p - read) : 0) + FORK_PROMPT_TOKENS;
|
|
179
|
+
const b = { ...(ref.speed ? { speed: ref.speed } : {}), ...(ref.geo ? { inference_geo: ref.geo } : {}) };
|
|
180
|
+
const fork = requestCost(model, { input_tokens: fresh, cache_read_input_tokens: read, cache_creation_input_tokens: 0, output_tokens: SUMMARY_OUTPUT_TOKENS, ...b }, at);
|
|
181
|
+
const notes = requestCost(model, { input_tokens: NOTES_TOKENS, cache_read_input_tokens: 0, cache_creation_input_tokens: 0, output_tokens: SUMMARY_OUTPUT_TOKENS, ...b }, at);
|
|
182
|
+
if (!fork || !notes)
|
|
183
|
+
continue;
|
|
184
|
+
out.calls++;
|
|
185
|
+
out.forkUsd += fork.totalUsd;
|
|
186
|
+
out.notesUsd += notes.totalUsd;
|
|
187
|
+
}
|
|
188
|
+
return out;
|
|
189
|
+
}
|
|
190
|
+
/** The summaries of the subagents in `files` (their `.jsonl` transcripts), estimated. */
|
|
191
|
+
export function estimateProgressSummaries(files, opts = {}) {
|
|
192
|
+
const r = { agents: 0, summarized: 0, calls: 0, notesUsd: 0, forkUsd: 0, none: {}, hosts: [] };
|
|
193
|
+
const hosts = new Set();
|
|
194
|
+
for (const file of files) {
|
|
195
|
+
let recs;
|
|
196
|
+
try {
|
|
197
|
+
recs = rowsOf(file, PROGRESS_ROWS);
|
|
198
|
+
}
|
|
199
|
+
catch {
|
|
200
|
+
continue;
|
|
201
|
+
}
|
|
202
|
+
// An agent that ran outside the window is not one of its agents (its file may be newer: a resumed session).
|
|
203
|
+
if (!recs.some((x) => x.t === "m" && x.ts >= (opts.since ?? -Infinity) && x.ts <= (opts.until ?? Infinity)))
|
|
204
|
+
continue;
|
|
205
|
+
r.agents++;
|
|
206
|
+
const head = recs.find((x) => x.t === "h");
|
|
207
|
+
let why = eligibility(readAgentMeta(file), head?.entrypoint, { workflow: workflowRunOf(file) !== undefined, forkGateOff: opts.forkGateOff, interactive: opts.interactive });
|
|
208
|
+
if (why === "yes" && opts.minVersion && !(head?.version && compareVersions(head.version, opts.minVersion) >= 0))
|
|
209
|
+
why = "old";
|
|
210
|
+
let until = opts.until ?? Infinity;
|
|
211
|
+
// The variable set from offSince on: a Claude Code that reads it wrote none after.
|
|
212
|
+
if (why === "yes" && opts.offSince !== undefined && head?.version && compareVersions(head.version, PROGRESS_SUMMARIES_SINCE) >= 0)
|
|
213
|
+
until = Math.min(until, opts.offSince);
|
|
214
|
+
if (why === "yes") {
|
|
215
|
+
const first = recs.reduce((m, x) => (x.t === "m" && x.ts < m ? x.ts : m), Infinity);
|
|
216
|
+
// An agent that started after the variable was set got none.
|
|
217
|
+
if (first > until)
|
|
218
|
+
why = "off";
|
|
219
|
+
else {
|
|
220
|
+
const s = simulateAgent(recs, opts.since, until);
|
|
221
|
+
// One that ran under 30 s, or outside the window, sent none.
|
|
222
|
+
if (s.calls)
|
|
223
|
+
r.summarized++;
|
|
224
|
+
r.calls += s.calls;
|
|
225
|
+
r.notesUsd += s.notesUsd;
|
|
226
|
+
r.forkUsd += s.forkUsd;
|
|
227
|
+
continue;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
if (why === "host" && head?.entrypoint)
|
|
231
|
+
hosts.add(head.entrypoint);
|
|
232
|
+
r.none[why] = (r.none[why] ?? 0) + 1;
|
|
233
|
+
}
|
|
234
|
+
r.hosts = [...hosts].sort();
|
|
235
|
+
return r;
|
|
236
|
+
}
|
|
237
|
+
/** "the Desktop app", "the SDK or -p": a host as a person knows it. */
|
|
238
|
+
export function hostName(entrypoint) {
|
|
239
|
+
if (entrypoint === "claude-desktop")
|
|
240
|
+
return "the Desktop app";
|
|
241
|
+
if (entrypoint === "claude-vscode")
|
|
242
|
+
return "the VS Code extension";
|
|
243
|
+
if (entrypoint === "sdk-cli")
|
|
244
|
+
return "claude -p";
|
|
245
|
+
if (entrypoint.startsWith("sdk"))
|
|
246
|
+
return "the Agent SDK";
|
|
247
|
+
return entrypoint;
|
|
248
|
+
}
|
package/dist/proxy.d.ts
CHANGED
|
@@ -76,7 +76,7 @@ export interface ProxyOptions extends OptimizeOptions {
|
|
|
76
76
|
/** Default request body cap: far above any real request (a 1M-token context is ~4 MB of JSON, images aside). */
|
|
77
77
|
export declare const DEFAULT_MAX_BODY_BYTES: number;
|
|
78
78
|
/** Reported by /health so `autopilot status` can tell an outdated service from a current one. */
|
|
79
|
-
export declare const PROXY_VERSION = "0.
|
|
79
|
+
export declare const PROXY_VERSION = "0.48.0";
|
|
80
80
|
/**
|
|
81
81
|
* Remove a leading `/t/<token>` from a request path, or return undefined when
|
|
82
82
|
* the prefix is absent or the token differs. The comparison is constant time
|
package/dist/proxy.js
CHANGED
|
@@ -25,7 +25,7 @@ import { makeGuard, refusal } from "./httpguard.js";
|
|
|
25
25
|
/** Default request body cap: far above any real request (a 1M-token context is ~4 MB of JSON, images aside). */
|
|
26
26
|
export const DEFAULT_MAX_BODY_BYTES = 100 * 1024 * 1024;
|
|
27
27
|
/** Reported by /health so `autopilot status` can tell an outdated service from a current one. */
|
|
28
|
-
export const PROXY_VERSION = "0.
|
|
28
|
+
export const PROXY_VERSION = "0.48.0";
|
|
29
29
|
/** Connection-level headers that must not be forwarded. */
|
|
30
30
|
const SKIP_REQUEST_HEADERS = new Set(["host", "content-length", "connection", "transfer-encoding", "accept-encoding", "expect"]);
|
|
31
31
|
const SKIP_RESPONSE_HEADERS = new Set(["content-length", "content-encoding", "transfer-encoding", "connection"]);
|
package/dist/prune.d.ts
CHANGED
|
@@ -85,6 +85,14 @@ export interface PrunePlan {
|
|
|
85
85
|
}
|
|
86
86
|
/** The project's own settings file, where prune writes. */
|
|
87
87
|
export declare function localSettingsPath(cwd: string): string;
|
|
88
|
+
/**
|
|
89
|
+
* CLAUDE_CODE_IGNORE_PERSISTED_TRUST, read as Claude Code reads it (2.1.321:
|
|
90
|
+
* a boolean variable, true for 1, true, yes or on). Set, "no workspace trust
|
|
91
|
+
* record counts in this process" (a self-hosted runner sets it when started
|
|
92
|
+
* with --trust-workspace false): ~/.claude.json's hasTrustDialogAccepted is
|
|
93
|
+
* not read, so a project's own settings approve nothing.
|
|
94
|
+
*/
|
|
95
|
+
export declare function persistedTrustIgnored(env?: NodeJS.ProcessEnv): boolean;
|
|
88
96
|
/**
|
|
89
97
|
* Whether Claude Code would start this project `.mcp.json` server without
|
|
90
98
|
* asking: the user approved it (enabledMcpjsonServers, or
|