claude-code-infinite 1.0.33 → 1.0.34

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.
Files changed (87) hide show
  1. package/README.md +9 -2
  2. package/dist/cli-main.js +18 -9
  3. package/dist/cli-main.js.map +1 -1
  4. package/dist/hooks.d.ts +20 -0
  5. package/dist/hooks.d.ts.map +1 -1
  6. package/dist/hooks.js +34 -4
  7. package/dist/hooks.js.map +1 -1
  8. package/dist/host-session.d.ts +12 -0
  9. package/dist/host-session.d.ts.map +1 -0
  10. package/dist/host-session.js +12 -0
  11. package/dist/host-session.js.map +1 -0
  12. package/dist/image-refs.d.ts +24 -2
  13. package/dist/image-refs.d.ts.map +1 -1
  14. package/dist/image-refs.js +67 -20
  15. package/dist/image-refs.js.map +1 -1
  16. package/dist/index-wait-413.d.ts +26 -0
  17. package/dist/index-wait-413.d.ts.map +1 -0
  18. package/dist/index-wait-413.js +113 -0
  19. package/dist/index-wait-413.js.map +1 -0
  20. package/dist/memtree-finder.d.ts +70 -6
  21. package/dist/memtree-finder.d.ts.map +1 -1
  22. package/dist/memtree-finder.js +150 -20
  23. package/dist/memtree-finder.js.map +1 -1
  24. package/dist/memtree-handover.d.ts +13 -0
  25. package/dist/memtree-handover.d.ts.map +1 -0
  26. package/dist/memtree-handover.js +231 -0
  27. package/dist/memtree-handover.js.map +1 -0
  28. package/dist/memtree-mcp-config.d.ts +2 -2
  29. package/dist/memtree-mcp-config.d.ts.map +1 -1
  30. package/dist/memtree-mcp-config.js +8 -5
  31. package/dist/memtree-mcp-config.js.map +1 -1
  32. package/dist/memtree-mcp.d.ts +182 -2
  33. package/dist/memtree-mcp.d.ts.map +1 -1
  34. package/dist/memtree-mcp.js +357 -38
  35. package/dist/memtree-mcp.js.map +1 -1
  36. package/dist/memtree-newest.d.ts +21 -3
  37. package/dist/memtree-newest.d.ts.map +1 -1
  38. package/dist/memtree-newest.js +43 -11
  39. package/dist/memtree-newest.js.map +1 -1
  40. package/dist/memtree-times.d.ts +33 -0
  41. package/dist/memtree-times.d.ts.map +1 -1
  42. package/dist/memtree-times.js +77 -0
  43. package/dist/memtree-times.js.map +1 -1
  44. package/dist/memtree-tools.d.ts +19 -5
  45. package/dist/memtree-tools.d.ts.map +1 -1
  46. package/dist/memtree-tools.js +97 -23
  47. package/dist/memtree-tools.js.map +1 -1
  48. package/dist/memtree.d.ts +23 -0
  49. package/dist/memtree.d.ts.map +1 -1
  50. package/dist/memtree.js +78 -4
  51. package/dist/memtree.js.map +1 -1
  52. package/dist/network-failure.d.ts +28 -0
  53. package/dist/network-failure.d.ts.map +1 -0
  54. package/dist/network-failure.js +67 -0
  55. package/dist/network-failure.js.map +1 -0
  56. package/dist/prefix-store.d.ts +4 -0
  57. package/dist/prefix-store.d.ts.map +1 -1
  58. package/dist/prefix-store.js +8 -4
  59. package/dist/prefix-store.js.map +1 -1
  60. package/dist/project-trees.d.ts +15 -7
  61. package/dist/project-trees.d.ts.map +1 -1
  62. package/dist/project-trees.js +20 -9
  63. package/dist/project-trees.js.map +1 -1
  64. package/dist/proxy.d.ts +69 -1
  65. package/dist/proxy.d.ts.map +1 -1
  66. package/dist/proxy.js +467 -39
  67. package/dist/proxy.js.map +1 -1
  68. package/dist/reqlog.d.ts +24 -0
  69. package/dist/reqlog.d.ts.map +1 -1
  70. package/dist/reqlog.js.map +1 -1
  71. package/dist/resume-guidance.d.ts +9 -3
  72. package/dist/resume-guidance.d.ts.map +1 -1
  73. package/dist/resume-guidance.js +9 -3
  74. package/dist/resume-guidance.js.map +1 -1
  75. package/dist/route-fallback.d.ts +77 -11
  76. package/dist/route-fallback.d.ts.map +1 -1
  77. package/dist/route-fallback.js +157 -33
  78. package/dist/route-fallback.js.map +1 -1
  79. package/dist/route-identity.d.ts +6 -2
  80. package/dist/route-identity.d.ts.map +1 -1
  81. package/dist/route-identity.js +209 -16
  82. package/dist/route-identity.js.map +1 -1
  83. package/dist/subagent-hint.d.ts +28 -0
  84. package/dist/subagent-hint.d.ts.map +1 -1
  85. package/dist/subagent-hint.js +37 -0
  86. package/dist/subagent-hint.js.map +1 -1
  87. package/package.json +1 -1
package/dist/reqlog.d.ts CHANGED
@@ -134,6 +134,18 @@ export interface MessagesRecord {
134
134
  * its page). If the request then cannot fit, the refusal waits for indexing.
135
135
  */
136
136
  indexBehind?: true;
137
+ /**
138
+ * MemTree answered 413 because its index is still catching up (index-wait-413.ts):
139
+ * the seconds of indexing it said were left (the latest), how many compress calls got
140
+ * that answer, and how long the request was held between them; `ended` when a later
141
+ * ask was answered otherwise.
142
+ */
143
+ indexWait?: {
144
+ secondsLeft: number;
145
+ asks: number;
146
+ heldMs: number;
147
+ ended?: true;
148
+ };
137
149
  /** Body bytes actually sent to Anthropic (after notice strip / compression). */
138
150
  forwardedBytes?: number;
139
151
  /** forwardedBytes/4 — rough chars→tokens proxy, not a tokenizer count. */
@@ -234,6 +246,8 @@ export interface MessagesRecord {
234
246
  * because this history no longer validates against it.
235
247
  */
236
248
  storedPrefix?: "adopted" | "discarded";
249
+ /** For a discarded prefix: the first covered message that no longer matched. */
250
+ storedPrefixMissAt?: number;
237
251
  /**
238
252
  * Stable-prefix (edge) compaction: the budget the turn was measured
239
253
  * against, the size estimate, and, when it compacted, why. Recorded on
@@ -283,6 +297,11 @@ export interface MessagesRecord {
283
297
  paused?: true;
284
298
  /** MemTree refused the key (401, or 403 with its detail): the refusal said so, outside the strike episode. */
285
299
  keyInvalid?: true;
300
+ /**
301
+ * MemTree's latest call could not connect ("internet": Anthropic's latest forward
302
+ * could not either): a retryable refusal saying so, outside the strike episode.
303
+ */
304
+ unreachable?: "memtree" | "internet";
286
305
  };
287
306
  /** Searchable flag explaining a forward above the advisory compression budget. */
288
307
  overBudgetForward?: {
@@ -491,6 +510,11 @@ export interface MemtreeRecord {
491
510
  requestBytes: number;
492
511
  imagesDropped: number;
493
512
  };
513
+ /**
514
+ * A compress whose body with image bytes was over the limit, sent with this many
515
+ * images as references the server had not listed (image-refs.ts: referenceUnconfirmed).
516
+ */
517
+ unconfirmedImageRefs?: number;
494
518
  /** Aborted because the exit drain ran out of time (diagnostics: exit_index_cut). */
495
519
  exitCut?: boolean;
496
520
  /** With exitCut: the call was the session's final index. */
@@ -1 +1 @@
1
- {"version":3,"file":"reqlog.d.ts","sourceRoot":"","sources":["../src/reqlog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAKH,OAAO,KAAK,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAC9E,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC1E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAKrD,2EAA2E;AAC3E,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE3D;AAED,wBAAgB,cAAc,IAAI,MAAM,CAEvC;AAED,MAAM,MAAM,QAAQ,GAChB,YAAY,GACZ,MAAM;AACR,gFAAgF;GAC9E,aAAa;AACf;;;;GAIG;GACD,aAAa;AACf;;;;;GAKG;GACD,mBAAmB,GACnB,qBAAqB;AACvB;;;;;;GAMG;GACD,iBAAiB,GACjB,eAAe;AACjB;;;;GAIG;GACD,uBAAuB;AACzB,8EAA8E;GAC5E,uBAAuB;AACzB;;;GAGG;GACD,qBAAqB,GACrB,mBAAmB;AACrB;;;GAGG;GACD,kBAAkB;AACpB;;;;GAIG;GACD,aAAa;AACf;;;GAGG;GACD,cAAc;AAChB;;;GAGG;GACD,SAAS,GACT,wBAAwB,GACxB,aAAa,CAAC;AAElB,yEAAyE;AACzE,MAAM,WAAW,WAAW;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,2BAA2B,CAAC,EAAE,MAAM,CAAC;IACrC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,kFAAkF;IAClF,eAAe,CAAC,EAAE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@ -36,7 +36,7 @@
36
36
  */
37
37
  export { RESUME_GUIDANCE_HOOK_SUFFIX } from "./hooks.js";
38
38
  export declare const RESUME_GUIDANCE_PREFIX: string;
39
- export declare const RESUME_GUIDANCE = "ccc: current MemTree guidance (replaces any earlier MemTree instructions in this conversation; its tools are mcp__memtree__*):\n\nThis session runs in Claude Code Infinite, which lets a conversation continue past the model's context window. MemTree indexes the whole conversation as it goes: a tree of summaries from a one-line overview at the root down to leaves, each pointing at the exact transcript lines it summarizes. Indexing runs in the background and trails the newest messages slightly.\n\nUntil the conversation reaches its size budget you see every message verbatim. The tools reach beyond this conversation: when the user refers to earlier work from another session (\"like last time\", \"the fix from yesterday\"), search without tree, or list recent sessions, before asking or re-deriving it.\n\nOnce the conversation reaches the budget, the earlier conversation is replaced by a single memory message: that tree, expanded where it looked relevant to the latest request and collapsed elsewhere. The user's own messages shown there, and everything after the memory message, stay word for word; the rest of the earlier conversation survives only as summaries, which drop exact values, instructions, reasoning and dead ends. The detail is not gone: these tools read it back.\n\nA nearly full context window is therefore expected and fine. Don't recommend /compact, /clear or a fresh session to free context: they discard what MemTree keeps (/ccc:memtree-compact compresses now if the user asks). The exception is a ccc notice that MemTree is paused or off: it is not compressing then, and that advice is the fallback.\n\nSo once you see that memory message: when your work depends on something from earlier in the session (what the user asked for or ruled out, decisions and why they were made, findings, ids and paths, commands, what was tried and failed), search MemTree before re-deriving it from the code or guessing. The code shows what exists; the memory shows what was decided and why. Read the exact lines (read_lines) when precision matters.\n\nsearch with \"tree\": \"current\" looks in this session's MemTree; without tree it searches all of the user's sessions, and list shows those sessions by time and project. Text mode (default, free) matches exact words, ids and paths; vector mode matches meaning: its first page is charged even when the query embedding is cached; cursor continuation is free, including when the embedding must be regenerated. Hits may include an address (<tree>#<node>) and its path from the root. If the address is unavailable, read_lines with the hit\u2019s tree.ref and range reads its exact lines. With an address: read_node {\"node\": address} opens it with its children, and the path's addresses lead to its parent and siblings; read_lines {\"node\": address} reads a leaf's exact lines. Cursors page over live results, not a frozen snapshot. A tree trails its conversation: the newest messages (often how a session ended) are in no tree yet. A text search of one tree also matches them (listed after the tree's hits), list shows how each session ended, and read_lines {\"tail\": true} reads them (with tree for another session's page; large tool calls are shortened, \"full\": true reads them whole).";
39
+ export declare const RESUME_GUIDANCE = "ccc: current MemTree guidance (replaces any earlier MemTree instructions in this conversation; its tools are mcp__memtree__*):\n\nThis session runs in Claude Code Infinite, which lets a conversation continue past the model's context window. MemTree indexes the whole conversation as it goes: a tree of summaries from a one-line overview at the root down to leaves, each pointing at the exact transcript lines it summarizes. Indexing runs in the background and trails the newest messages slightly.\n\nUntil the conversation reaches its size budget you see every message verbatim. The tools reach beyond this conversation: when the user refers to earlier work from another session (\"like last time\", \"the fix from yesterday\"), search without tree, or list recent sessions, before asking or re-deriving it.\n\nOnce the conversation reaches the budget, the earlier conversation is replaced by a single memory message: that tree, expanded where it looked relevant to the latest request and collapsed elsewhere. The user's own messages shown there, and everything after the memory message, stay word for word; the rest of the earlier conversation survives only as summaries, which drop exact values, instructions, reasoning and dead ends. The detail is not gone: these tools read it back.\n\nA nearly full context window is therefore expected and fine. Don't recommend /compact, /clear or a fresh session to free context: they discard what MemTree keeps (/ccc:memtree-compact compresses now if the user asks). The exception is a ccc notice that MemTree is paused or off: it is not compressing then, and that advice is the fallback.\n\nSo once you see that memory message: when your work depends on something from earlier in the session (what the user asked for or ruled out, decisions and why they were made, findings, ids and paths, commands, what was tried and failed), search MemTree before re-deriving it from the code or guessing. The code shows what exists; the memory shows what was decided and why. Read the exact lines (read_lines) when precision matters.\n\nsearch with \"tree\": \"current\" looks in this session's MemTree; without tree it searches all of the user's ccc sessions on any machine (not Codex or plain claude sessions), and list shows those sessions by time and project. Text mode (default) matches exact words, ids and paths; vector mode matches meaning. A search costs $0.0005 either way: its first page is charged even when cached; cursor continuation is free, even if re-embedded, as is a text search of one tree. Hits may include an address (<tree>#<node>) and its path from the root. If the address is unavailable, read_lines with the hit\u2019s tree.ref and range reads its exact lines. With an address: read_node {\"node\": address} opens it with its children, and the path's addresses lead to its parent and siblings; read_lines {\"node\": address} reads a leaf's exact lines. Cursors page over live results, not a frozen snapshot. A tree trails its conversation: the newest messages (often how a session ended) are in no tree yet. A text search of one tree also matches them (listed after the tree's hits), list shows how each session ended, and read_lines {\"tail\": true} reads them (with tree for another session's page; large tool calls are shortened, \"full\": true reads them whole).\n\nTo take over another session's work, call handover with its session id first; user_messages lists only the person's own messages over a time range.\n\nA hand-off or kickoff prompt you write for another agent or machine names this session's id and MemTree link (list marks this session), so that agent can read this work with list, search and read_node.";
40
40
  /**
41
41
  * How Claude Code's transcript holds the server's current instructions: the
42
42
  * JSON string body of the announced block (`## memtree\n…`). The guidance
@@ -51,7 +51,7 @@ export interface ResumeGuidanceStartup {
51
51
  interactive: boolean;
52
52
  /** Unpaid and [c] at the payment gate, or an invalid key: MemTree is off. */
53
53
  memtreeOff: boolean;
54
- /** The memtree tools the session has (bare names); the guidance names them all. */
54
+ /** The memtree tools the session has (bare names); RESUME_GUIDANCE_TOOLS must be among them. */
55
55
  tools: readonly string[];
56
56
  }
57
57
  /** What a SessionStart needs to know about MemTree right now. */
@@ -67,7 +67,7 @@ export interface ResumeGuidanceState {
67
67
  }
68
68
  /**
69
69
  * Whether resumes get the guidance: on for an interactive run with MemTree on
70
- * and every memtree tool, off once ccc could not register the server after all.
70
+ * and the tools it names (RESUME_GUIDANCE_TOOLS), off once ccc could not register the server after all.
71
71
  */
72
72
  export declare class ResumeGuidance {
73
73
  private readonly scanMs;
@@ -88,6 +88,12 @@ export declare class ResumeGuidance {
88
88
  }
89
89
  /** The guidance for a compressed session: new to Claude Code at each resume. */
90
90
  export declare function resumeGuidanceAgain(at: Date): string;
91
+ /**
92
+ * The tools the guidance relies on (search, read_node, read_lines, list). Not every memtree
93
+ * tool: disallowing a later one (user_messages, handover) keeps the guidance, whose embedded
94
+ * instructions still name them (a call then gets Claude Code's permission denial).
95
+ */
96
+ export declare const RESUME_GUIDANCE_TOOLS: readonly ["search", "read_node", "read_lines", "list"];
91
97
  /** The gate for this run, or undefined (see ResumeGuidance). */
92
98
  export declare function resumeGuidanceFor(s: ResumeGuidanceStartup): ResumeGuidance | undefined;
93
99
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"resume-guidance.d.ts","sourceRoot":"","sources":["../src/resume-guidance.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAKH,OAAO,EAAE,2BAA2B,EAAE,MAAM,YAAY,CAAC;AAEzD,eAAO,MAAM,sBAAsB,QAEc,CAAC;AAClD,eAAO,MAAM,eAAe,4rGAA6D,CAAC;AAE1F;;;;;;GAMG;AACH,eAAO,MAAM,6BAA6B,QAE5B,CAAC;AASf,6EAA6E;AAC7E,eAAO,MAAM,iBAAiB,OAAQ,CAAC;AAEvC,MAAM,WAAW,qBAAqB;IACpC,WAAW,EAAE,OAAO,CAAC;IACrB,6EAA6E;IAC7E,UAAU,EAAE,OAAO,CAAC;IACpB,mFAAmF;IACnF,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;CAC1B;AAED,iEAAiE;AACjE,MAAM,WAAW,mBAAmB;IAClC,qEAAqE;IACrE,OAAO,EAAE,MAAM,OAAO,CAAC;IACvB;;;;OAIG;IACH,UAAU,EAAE,MAAM,OAAO,GAAG,SAAS,CAAC;CACvC;AAED;;;GAGG;AACH,qBAAa,cAAc;IAIvB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,GAAG;IAJtB,OAAO,CAAC,QAAQ,CAAS;gBAGN,MAAM,SAAoB,EAC1B,GAAG,GAAE,MAAM,IAAuB;IAGrD,OAAO,IAAI,IAAI;IAIf,IAAI,OAAO,IAAI,OAAO,CAErB;IAED;;;OAGG;IACG,UAAU,CACd,KAAK,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,eAAe,CAAC,E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relay.
36
36
  */
37
37
  import fs from "node:fs";
38
- import { MEMTREE_MCP_INSTRUCTIONS, MEMTREE_TOOL_NAMES } from "./memtree-mcp.js";
38
+ import { MEMTREE_MCP_INSTRUCTIONS } from "./memtree-mcp.js";
39
39
  export { RESUME_GUIDANCE_HOOK_SUFFIX } from "./hooks.js";
40
40
  export const RESUME_GUIDANCE_PREFIX = "ccc: current MemTree guidance (replaces any earlier MemTree instructions in this " +
41
41
  "conversation; its tools are mcp__memtree__*):";
@@ -59,7 +59,7 @@ const SCAN_CHUNK_BYTES = 4 * 1024 * 1024;
59
59
  export const ANNOUNCED_SCAN_MS = 1_000;
60
60
  /**
61
61
  * Whether resumes get the guidance: on for an interactive run with MemTree on
62
- * and every memtree tool, off once ccc could not register the server after all.
62
+ * and the tools it names (RESUME_GUIDANCE_TOOLS), off once ccc could not register the server after all.
63
63
  */
64
64
  export class ResumeGuidance {
65
65
  scanMs;
@@ -106,11 +106,17 @@ export function resumeGuidanceAgain(at) {
106
106
  return `${RESUME_GUIDANCE}\n\n(Given again at the resume of ${at.toISOString()}: ` +
107
107
  "MemTree may have compressed this conversation, so an earlier copy may be out of view.)";
108
108
  }
109
+ /**
110
+ * The tools the guidance relies on (search, read_node, read_lines, list). Not every memtree
111
+ * tool: disallowing a later one (user_messages, handover) keeps the guidance, whose embedded
112
+ * instructions still name them (a call then gets Claude Code's permission denial).
113
+ */
114
+ export const RESUME_GUIDANCE_TOOLS = ["search", "read_node", "read_lines", "list"];
109
115
  /** The gate for this run, or undefined (see ResumeGuidance). */
110
116
  export function resumeGuidanceFor(s) {
111
117
  if (!s.interactive || s.memtreeOff)
112
118
  return undefined;
113
- if (!MEMTREE_TOOL_NAMES.every((tool) => s.tools.includes(tool)))
119
+ if (!RESUME_GUIDANCE_TOOLS.every((tool) => s.tools.includes(tool)))
114
120
  return undefined;
115
121
  return new ResumeGuidance();
116
122
  }
@@ -1 +1 @@
1
- {"version":3,"file":"resume-guidance.js","sourceRoot":"","sources":["../src/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,CAAC;AACH,CAAC;AAED,KAAK,UAAU,aAAa,CAC1B,MAA8B,EAC9B,KAAa,EACb,GAAW,EACX,MAAc;IAEd,IAAI,GAAG,GAAG,KAAK,GAAG,MAAM,CAAC,MAAM;QAAE,OAAO,KAAK,CAAC;IAC9C,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,GAAG,KAAK,CAAC,CAAC;IACzC,MAAM,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACnD,KAAK,IAAI,EAAE,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC;QACnF,IAAI,kBAAkB,CAAC,MAAM,EAAE,EAAE,CAAC;YAAE,OAAO,IAAI,CAAC;IAClD,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,+EAA+E;AAC/E,SAAS,kBAAkB,CAAC,MAAc,EAAE,EAAU;IACpD,MAAM,SAAS,GAAG,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC;IACnD,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,mBAAmB,EAAE,SAAS,CAAC,CAAC;IAC9D,OAAO,MAAM,IAAI,CAAC,IAAI,MAAM,GAAG,EAAE,CAAC;AACpC,CAAC"}
@@ -16,6 +16,14 @@ export interface RouteFallbackError {
16
16
  }
17
17
  /** How long a lane may wait for MemTree to finish indexing before refusing. */
18
18
  export declare const INDEX_WAIT_DEADLINE_MS: number;
19
+ /**
20
+ * The most a lane waits for an index whose time left the server stated (a 413's
21
+ * Retry-After): longer estimates refuse at once, and later ones extend a wait only to here.
22
+ */
23
+ export declare const INDEX_WAIT_MAX_MS: number;
24
+ /** A stated time left is waited for this much longer (estimates run over: 2026-11-09). */
25
+ export declare const INDEX_WAIT_MARGIN_RATIO = 0.5;
26
+ export declare const INDEX_WAIT_MARGIN_MS: number;
19
27
  /** Seconds Claude Code waits between retries while the index catches up. */
20
28
  export declare const INDEX_WAIT_RETRY_AFTER_SECONDS = 30;
21
29
  export declare const FINAL_REFUSAL_MESSAGE: string;
@@ -26,6 +34,8 @@ export interface FallbackFailureContext {
26
34
  * for indexing instead of spending the strike budget.
27
35
  */
28
36
  awaitingIndex?: boolean;
37
+ /** The server's estimate of the indexing left (seconds), when it stated one. */
38
+ indexSecondsLeft?: number;
29
39
  now?: number;
30
40
  }
31
41
  /**
@@ -37,39 +47,95 @@ export interface FallbackFailureContext {
37
47
  */
38
48
  export declare class RouteFallbackFailures {
39
49
  private readonly capacity;
50
+ /** A wait's length when the server stated no time left. */
40
51
  private readonly indexWaitMs;
52
+ private readonly indexWaitMaxMs;
41
53
  private readonly failures;
42
- /** Lane -> when its index wait began (its deadline is fixed from then). */
54
+ /**
55
+ * Lane -> when its index wait began and when it ends; `over` once it ended but the
56
+ * strike table had no room to record the refusal (still refused, never extended).
57
+ */
43
58
  private readonly indexWaits;
44
- constructor(capacity?: number, indexWaitMs?: number);
59
+ /** Lane -> when it was last seen waiting for its index; a delivery does not clear it. */
60
+ private readonly indexWaitSeen;
61
+ constructor(capacity?: number,
62
+ /** A wait's length when the server stated no time left. */
63
+ indexWaitMs?: number, indexWaitMaxMs?: number);
45
64
  fail(lane: string, context?: FallbackFailureContext): RouteFallbackError;
65
+ /**
66
+ * Note MemTree saying the lane's index is still catching up (a held request's 413):
67
+ * starts the lane's wait, or extends it by the stated time left. False once waiting
68
+ * can no longer pay off (the estimate is past the cap, the wait's deadline passed, or
69
+ * the lane was refused), so a held request stops asking and is refused.
70
+ */
71
+ indexWaitOpen(lane: string, secondsLeft: number | undefined, now?: number): boolean;
72
+ /**
73
+ * indexWaitOpen, and when the lane's wait ends: its deadline (Infinity when no slot was
74
+ * free to track it), or undefined once closed.
75
+ */
76
+ indexWaitDeadline(lane: string, secondsLeft: number | undefined, now?: number): number | undefined;
77
+ /** Whether the lane is waiting for its index (a wait started, not yet ended). */
78
+ indexWaiting(lane: string): boolean;
79
+ /** Whether the lane waits for its index now, or did at any time from `since` on. */
80
+ indexWaitSince(lane: string, since: number): boolean;
81
+ /** The time left MemTree last stated for the lane's index wait, if any. */
82
+ indexSecondsLeft(lane: string): number | undefined;
83
+ /** Whether a stated time left is too long to wait for at all (refused at once). */
84
+ hopeless(secondsLeft: number | undefined): boolean;
46
85
  succeeded(lane: string): void;
47
86
  /** The bounded three-strike episode: 503, 503, then 400 until delivery. */
48
87
  private strike;
49
88
  /**
50
- * A 503 while the lane's wait is within its deadline; a 400 once it passes.
51
- * The deadline is fixed when the wait starts and only a delivery clears it:
52
- * an expired wait becomes a terminal strike state, and an active wait is
53
- * never evicted. A lane already refused, or arriving while every wait slot
54
- * is active, gets no wait (undefined) and falls back to the strikes.
89
+ * A 503 while the lane's wait is within its deadline; a 400 once it passes, or at once
90
+ * for a stated time left past the cap. The deadline is set when the wait starts (the
91
+ * stated time plus a margin, else indexWaitMs); a later stated time may extend it up to
92
+ * indexWaitMaxMs from the start, and only a delivery clears it: an expired wait becomes
93
+ * a terminal strike state, and an active wait is never evicted. A lane already refused,
94
+ * or arriving while every wait slot is active, gets no wait (undefined) and falls back
95
+ * to the strikes.
55
96
  */
56
97
  private waitForIndex;
98
+ /**
99
+ * Start or extend the lane's wait: "open" while the index may still land in time,
100
+ * "closed" once it may not (and the lane is refused until a delivery), "untracked"
101
+ * when every wait slot is taken (the strikes decide).
102
+ */
103
+ private track;
104
+ /** Note the lane waiting for its index at `now` (bounded: oldest first out). */
105
+ private seen;
106
+ private trackWait;
107
+ /** When a wait begun at `started` ends, given the time left stated at `now`. */
108
+ private deadline;
57
109
  private indexWaitError;
58
110
  /** Free the slots of waits past their deadline, keeping them refused. */
59
111
  private retireExpiredWaits;
60
112
  /**
61
- * An expired wait's lane moves to the terminal strike state. If the strike
62
- * table is full the wait keeps its slot instead (still expired, still
63
- * refused), so no lane can be re-admitted with a fresh deadline.
113
+ * End the lane's wait in the terminal strike state. If the strike table is full a wait
114
+ * keeps its slot instead, marked over (still refused, never extended), so no lane can
115
+ * be re-admitted with a fresh deadline; with neither, the refusal stands for this
116
+ * request only.
64
117
  */
65
- private retire;
118
+ private close;
66
119
  }
120
+ /**
121
+ * The one-line status a waiting turn shows (Claude Code prints a 503's message on its
122
+ * retry line): how long the server expects, when it said.
123
+ */
124
+ export declare function indexWaitStatus(secondsLeft: number | undefined): string;
125
+ /** "about 1 minute", "about 5 minutes" (whole minutes, rounded up). */
126
+ export declare function timeLeftText(seconds: number): string;
67
127
  /**
68
128
  * The refusal while MemTree is paused (402): only compression could fit the
69
129
  * request, and a retry cannot pay, so it is final at once and outside the
70
130
  * strike episode (attempt 0). Paying lets the very next request compress.
71
131
  */
72
132
  export declare function pausedRefusal(message: string): RouteFallbackError;
133
+ /**
134
+ * The refusal while MemTree can't be reached (network-failure.ts): nothing says the request
135
+ * can't fit, so it is retryable and outside the strike episode (attempt 0). No retry-after:
136
+ * Claude Code backs off as for its own connection errors, giving the network time to return.
137
+ */
138
+ export declare function unreachableRefusal(message: string): RouteFallbackError;
73
139
  /** Refusals of one lane further apart than this start a new streak. */
74
140
  export declare const SLOW_RETRY_WINDOW_MS: number;
75
141
  /** Consecutive refusals in a streak before the "slow to answer" notice. */
@@ -1 +1 @@
1
- {"version":3,"file":"route-fallback.d.ts","sourceRoot":"","sources":["../src/route-fallback.ts"],"names":[],"mappings":"AAGA;;oEAEoE;AACpE,wBAAgB,kBAAkB,CAChC,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,MAAM,EACrB,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAKT;AAED,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,GAAG,GAAG,GAAG,CAAC;IAClB,OAAO,EAAE,M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fitsFallbackBudget(inputTokens, outputTokens, budgetTokens, cont
9
9
  }
10
10
  /** How long a lane may wait for MemTree to finish indexing before refusing. */
11
11
  export const INDEX_WAIT_DEADLINE_MS = 10 * 60_000;
12
+ /**
13
+ * The most a lane waits for an index whose time left the server stated (a 413's
14
+ * Retry-After): longer estimates refuse at once, and later ones extend a wait only to here.
15
+ */
16
+ export const INDEX_WAIT_MAX_MS = 15 * 60_000;
17
+ /** A stated time left is waited for this much longer (estimates run over: 2026-11-09). */
18
+ export const INDEX_WAIT_MARGIN_RATIO = 0.5;
19
+ export const INDEX_WAIT_MARGIN_MS = 2 * 60_000;
12
20
  /** Seconds Claude Code waits between retries while the index catches up. */
13
21
  export const INDEX_WAIT_RETRY_AFTER_SECONDS = 30;
14
22
  export const FINAL_REFUSAL_MESSAGE = "MemTree couldn't fit this request in the model's context window. If MemTree is " +
@@ -25,21 +33,66 @@ export const FINAL_REFUSAL_MESSAGE = "MemTree couldn't fit this request in the m
25
33
  export class RouteFallbackFailures {
26
34
  capacity;
27
35
  indexWaitMs;
36
+ indexWaitMaxMs;
28
37
  failures = new Map();
29
- /** Lane -> when its index wait began (its deadline is fixed from then). */
38
+ /**
39
+ * Lane -> when its index wait began and when it ends; `over` once it ended but the
40
+ * strike table had no room to record the refusal (still refused, never extended).
41
+ */
30
42
  indexWaits = new Map();
31
- constructor(capacity = 128, indexWaitMs = INDEX_WAIT_DEADLINE_MS) {
43
+ /** Lane -> when it was last seen waiting for its index; a delivery does not clear it. */
44
+ indexWaitSeen = new Map();
45
+ constructor(capacity = 128,
46
+ /** A wait's length when the server stated no time left. */
47
+ indexWaitMs = INDEX_WAIT_DEADLINE_MS, indexWaitMaxMs = INDEX_WAIT_MAX_MS) {
32
48
  this.capacity = capacity;
33
49
  this.indexWaitMs = indexWaitMs;
50
+ this.indexWaitMaxMs = indexWaitMaxMs;
34
51
  }
35
52
  fail(lane, context = {}) {
36
53
  if (context.awaitingIndex) {
37
- const waiting = this.waitForIndex(lane, context.now ?? Date.now());
54
+ const waiting = this.waitForIndex(lane, context.now ?? Date.now(), context.indexSecondsLeft);
38
55
  if (waiting)
39
56
  return waiting;
40
57
  }
41
58
  return this.strike(lane);
42
59
  }
60
+ /**
61
+ * Note MemTree saying the lane's index is still catching up (a held request's 413):
62
+ * starts the lane's wait, or extends it by the stated time left. False once waiting
63
+ * can no longer pay off (the estimate is past the cap, the wait's deadline passed, or
64
+ * the lane was refused), so a held request stops asking and is refused.
65
+ */
66
+ indexWaitOpen(lane, secondsLeft, now = Date.now()) {
67
+ return this.track(lane, now, secondsLeft) !== "closed";
68
+ }
69
+ /**
70
+ * indexWaitOpen, and when the lane's wait ends: its deadline (Infinity when no slot was
71
+ * free to track it), or undefined once closed.
72
+ */
73
+ indexWaitDeadline(lane, secondsLeft, now = Date.now()) {
74
+ const state = this.track(lane, now, secondsLeft);
75
+ if (state === "closed")
76
+ return undefined;
77
+ return state === "untracked" ? Infinity : this.indexWaits.get(lane).deadline;
78
+ }
79
+ /** Whether the lane is waiting for its index (a wait started, not yet ended). */
80
+ indexWaiting(lane) {
81
+ const wait = this.indexWaits.get(lane);
82
+ return wait !== undefined && !wait.over;
83
+ }
84
+ /** Whether the lane waits for its index now, or did at any time from `since` on. */
85
+ indexWaitSince(lane, since) {
86
+ return this.indexWaiting(lane) || (this.indexWaitSeen.get(lane) ?? -Infinity) >= since;
87
+ }
88
+ /** The time left MemTree last stated for the lane's index wait, if any. */
89
+ indexSecondsLeft(lane) {
90
+ return this.indexWaits.get(lane)?.secondsLeft;
91
+ }
92
+ /** Whether a stated time left is too long to wait for at all (refused at once). */
93
+ hopeless(secondsLeft) {
94
+ return secondsLeft !== undefined && secondsLeft * 1000 > this.indexWaitMaxMs;
95
+ }
43
96
  succeeded(lane) {
44
97
  this.failures.delete(lane);
45
98
  this.indexWaits.delete(lane);
@@ -57,53 +110,115 @@ export class RouteFallbackFailures {
57
110
  return attempt <= 2 ? retryError(attempt, "1", RETRY_MESSAGE) : refusal(attempt);
58
111
  }
59
112
  /**
60
- * A 503 while the lane's wait is within its deadline; a 400 once it passes.
61
- * The deadline is fixed when the wait starts and only a delivery clears it:
62
- * an expired wait becomes a terminal strike state, and an active wait is
63
- * never evicted. A lane already refused, or arriving while every wait slot
64
- * is active, gets no wait (undefined) and falls back to the strikes.
113
+ * A 503 while the lane's wait is within its deadline; a 400 once it passes, or at once
114
+ * for a stated time left past the cap. The deadline is set when the wait starts (the
115
+ * stated time plus a margin, else indexWaitMs); a later stated time may extend it up to
116
+ * indexWaitMaxMs from the start, and only a delivery clears it: an expired wait becomes
117
+ * a terminal strike state, and an active wait is never evicted. A lane already refused,
118
+ * or arriving while every wait slot is active, gets no wait (undefined) and falls back
119
+ * to the strikes.
65
120
  */
66
- waitForIndex(lane, now) {
121
+ waitForIndex(lane, now, secondsLeft) {
122
+ const state = this.track(lane, now, secondsLeft);
123
+ if (state === "untracked")
124
+ return undefined;
125
+ return state === "open" ? this.indexWaitError(lane, secondsLeft) : refusal(3);
126
+ }
127
+ /**
128
+ * Start or extend the lane's wait: "open" while the index may still land in time,
129
+ * "closed" once it may not (and the lane is refused until a delivery), "untracked"
130
+ * when every wait slot is taken (the strikes decide).
131
+ */
132
+ track(lane, now, secondsLeft) {
133
+ const state = this.trackWait(lane, now, secondsLeft);
134
+ if (state !== "closed")
135
+ this.seen(lane, now);
136
+ return state;
137
+ }
138
+ /** Note the lane waiting for its index at `now` (bounded: oldest first out). */
139
+ seen(lane, now) {
140
+ this.indexWaitSeen.delete(lane);
141
+ this.indexWaitSeen.set(lane, now);
142
+ if (this.indexWaitSeen.size > this.capacity) {
143
+ this.indexWaitSeen.delete(this.indexWaitSeen.keys().next().value);
144
+ }
145
+ }
146
+ trackWait(lane, now, secondsLeft) {
147
+ if ((this.failures.get(lane) ?? 0) >= 3)
148
+ return "closed";
67
149
  const wait = this.indexWaits.get(lane);
150
+ if (wait?.over)
151
+ return "closed";
152
+ if (this.hopeless(secondsLeft))
153
+ return this.close(lane);
68
154
  if (wait === undefined) {
69
- if ((this.failures.get(lane) ?? 0) >= 3)
70
- return undefined;
71
155
  this.retireExpiredWaits(now);
72
156
  if (this.indexWaits.size >= this.capacity)
73
- return undefined;
74
- this.indexWaits.set(lane, now);
75
- return this.indexWaitError(lane);
157
+ return "untracked";
158
+ this.indexWaits.set(lane, { started: now, deadline: this.deadline(now, now, secondsLeft),
159
+ secondsLeft });
160
+ return "open";
76
161
  }
77
- if (now - wait < this.indexWaitMs)
78
- return this.indexWaitError(lane);
79
- this.retire(lane);
80
- return refusal(3);
162
+ if (secondsLeft !== undefined) {
163
+ wait.secondsLeft = secondsLeft;
164
+ wait.deadline = Math.max(wait.deadline, this.deadline(wait.started, now, secondsLeft));
165
+ }
166
+ return now < wait.deadline ? "open" : this.close(lane);
167
+ }
168
+ /** When a wait begun at `started` ends, given the time left stated at `now`. */
169
+ deadline(started, now, secondsLeft) {
170
+ if (secondsLeft === undefined)
171
+ return started + this.indexWaitMs;
172
+ const ms = secondsLeft * 1000;
173
+ return Math.min(started + this.indexWaitMaxMs, now + ms + ms * INDEX_WAIT_MARGIN_RATIO + INDEX_WAIT_MARGIN_MS);
81
174
  }
82
- indexWaitError(lane) {
83
- return retryError(this.failures.get(lane) ?? 0, String(INDEX_WAIT_RETRY_AFTER_SECONDS), INDEX_WAIT_MESSAGE);
175
+ indexWaitError(lane, secondsLeft) {
176
+ const retryAfter = secondsLeft === undefined ? INDEX_WAIT_RETRY_AFTER_SECONDS
177
+ : Math.max(1, Math.min(INDEX_WAIT_RETRY_AFTER_SECONDS, Math.ceil(secondsLeft)));
178
+ return retryError(this.failures.get(lane) ?? 0, String(retryAfter), indexWaitStatus(secondsLeft));
84
179
  }
85
180
  /** Free the slots of waits past their deadline, keeping them refused. */
86
181
  retireExpiredWaits(now) {
87
- for (const [lane, started] of this.indexWaits) {
88
- if (now - started >= this.indexWaitMs)
89
- this.retire(lane);
182
+ for (const [lane, wait] of this.indexWaits) {
183
+ if (now >= wait.deadline)
184
+ this.close(lane);
90
185
  }
91
186
  }
92
187
  /**
93
- * An expired wait's lane moves to the terminal strike state. If the strike
94
- * table is full the wait keeps its slot instead (still expired, still
95
- * refused), so no lane can be re-admitted with a fresh deadline.
188
+ * End the lane's wait in the terminal strike state. If the strike table is full a wait
189
+ * keeps its slot instead, marked over (still refused, never extended), so no lane can
190
+ * be re-admitted with a fresh deadline; with neither, the refusal stands for this
191
+ * request only.
96
192
  */
97
- retire(lane) {
98
- if (!this.failures.has(lane) && this.failures.size >= this.capacity)
99
- return;
100
- this.failures.set(lane, 3);
101
- this.indexWaits.delete(lane);
193
+ close(lane) {
194
+ if (this.failures.has(lane) || this.failures.size < this.capacity) {
195
+ this.failures.set(lane, 3);
196
+ this.indexWaits.delete(lane);
197
+ }
198
+ else {
199
+ const wait = this.indexWaits.get(lane);
200
+ if (wait)
201
+ wait.over = true;
202
+ }
203
+ return "closed";
102
204
  }
103
205
  }
104
206
  const RETRY_MESSAGE = "MemTree could not produce a usable compressed request; retrying within a bounded limit.";
105
- const INDEX_WAIT_MESSAGE = "MemTree is still indexing this conversation, so it does not fit the model's context " +
106
- "window yet; retrying once indexing catches up.";
207
+ /**
208
+ * The one-line status a waiting turn shows (Claude Code prints a 503's message on its
209
+ * retry line): how long the server expects, when it said.
210
+ */
211
+ export function indexWaitStatus(secondsLeft) {
212
+ const left = secondsLeft === undefined ? ""
213
+ : `, ${timeLeftText(secondsLeft)} left by its estimate`;
214
+ return `MemTree is catching up on this session's index${left}. ` +
215
+ "This turn continues on its own once it's ready.";
216
+ }
217
+ /** "about 1 minute", "about 5 minutes" (whole minutes, rounded up). */
218
+ export function timeLeftText(seconds) {
219
+ const minutes = Math.max(1, Math.ceil(seconds / 60));
220
+ return minutes === 1 ? "about 1 minute" : `about ${minutes} minutes`;
221
+ }
107
222
  /**
108
223
  * The refusal while MemTree is paused (402): only compression could fit the
109
224
  * request, and a retry cannot pay, so it is final at once and outside the
@@ -113,6 +228,15 @@ export function pausedRefusal(message) {
113
228
  return { ...refusal(0), body: { type: "error",
114
229
  error: { type: "invalid_request_error", message } } };
115
230
  }
231
+ /**
232
+ * The refusal while MemTree can't be reached (network-failure.ts): nothing says the request
233
+ * can't fit, so it is retryable and outside the strike episode (attempt 0). No retry-after:
234
+ * Claude Code backs off as for its own connection errors, giving the network time to return.
235
+ */
236
+ export function unreachableRefusal(message) {
237
+ return { status: 503, attempt: 0, headers: { "x-should-retry": "true" },
238
+ body: { type: "error", error: { type: "api_error", message } } };
239
+ }
116
240
  function retryError(attempt, retryAfter, message) {
117
241
  return {
118
242
  status: 503,