@cluesmith/codev 3.3.3 → 3.3.5

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 (244) hide show
  1. package/dashboard-dist/assets/index-BuflRUi6.js +220 -0
  2. package/dashboard-dist/assets/index-BuflRUi6.js.map +1 -0
  3. package/dashboard-dist/assets/index-r3bZzLmX.css +32 -0
  4. package/dashboard-dist/index.html +2 -2
  5. package/dist/agent-farm/cli.d.ts.map +1 -1
  6. package/dist/agent-farm/cli.js +48 -0
  7. package/dist/agent-farm/cli.js.map +1 -1
  8. package/dist/agent-farm/commands/ide.d.ts +20 -0
  9. package/dist/agent-farm/commands/ide.d.ts.map +1 -0
  10. package/dist/agent-farm/commands/ide.js +138 -0
  11. package/dist/agent-farm/commands/ide.js.map +1 -0
  12. package/dist/agent-farm/commands/inbox.d.ts.map +1 -1
  13. package/dist/agent-farm/commands/inbox.js +15 -3
  14. package/dist/agent-farm/commands/inbox.js.map +1 -1
  15. package/dist/agent-farm/commands/send.d.ts +3 -2
  16. package/dist/agent-farm/commands/send.d.ts.map +1 -1
  17. package/dist/agent-farm/commands/send.js +40 -6
  18. package/dist/agent-farm/commands/send.js.map +1 -1
  19. package/dist/agent-farm/commands/spawn-worktree.d.ts.map +1 -1
  20. package/dist/agent-farm/commands/spawn-worktree.js +28 -9
  21. package/dist/agent-farm/commands/spawn-worktree.js.map +1 -1
  22. package/dist/agent-farm/commands/tower.d.ts +21 -9
  23. package/dist/agent-farm/commands/tower.d.ts.map +1 -1
  24. package/dist/agent-farm/commands/tower.js +90 -30
  25. package/dist/agent-farm/commands/tower.js.map +1 -1
  26. package/dist/agent-farm/db/tower-owner.d.ts +168 -0
  27. package/dist/agent-farm/db/tower-owner.d.ts.map +1 -0
  28. package/dist/agent-farm/db/tower-owner.js +369 -0
  29. package/dist/agent-farm/db/tower-owner.js.map +1 -0
  30. package/dist/agent-farm/db/types.d.ts +30 -5
  31. package/dist/agent-farm/db/types.d.ts.map +1 -1
  32. package/dist/agent-farm/db/types.js.map +1 -1
  33. package/dist/agent-farm/lib/ide-record.d.ts +65 -0
  34. package/dist/agent-farm/lib/ide-record.d.ts.map +1 -0
  35. package/dist/agent-farm/lib/ide-record.js +118 -0
  36. package/dist/agent-farm/lib/ide-record.js.map +1 -0
  37. package/dist/agent-farm/lib/tunnel-client.d.ts +22 -0
  38. package/dist/agent-farm/lib/tunnel-client.d.ts.map +1 -1
  39. package/dist/agent-farm/lib/tunnel-client.js +53 -5
  40. package/dist/agent-farm/lib/tunnel-client.js.map +1 -1
  41. package/dist/agent-farm/servers/decisions/file.d.ts +50 -0
  42. package/dist/agent-farm/servers/decisions/file.d.ts.map +1 -0
  43. package/dist/agent-farm/servers/decisions/file.js +146 -0
  44. package/dist/agent-farm/servers/decisions/file.js.map +1 -0
  45. package/dist/agent-farm/servers/decisions/grammar.d.ts +36 -0
  46. package/dist/agent-farm/servers/decisions/grammar.d.ts.map +1 -0
  47. package/dist/agent-farm/servers/decisions/grammar.js +109 -0
  48. package/dist/agent-farm/servers/decisions/grammar.js.map +1 -0
  49. package/dist/agent-farm/servers/decisions/notice.d.ts +11 -0
  50. package/dist/agent-farm/servers/decisions/notice.d.ts.map +1 -0
  51. package/dist/agent-farm/servers/decisions/notice.js +18 -0
  52. package/dist/agent-farm/servers/decisions/notice.js.map +1 -0
  53. package/dist/agent-farm/servers/decisions/parse.d.ts +36 -0
  54. package/dist/agent-farm/servers/decisions/parse.d.ts.map +1 -0
  55. package/dist/agent-farm/servers/decisions/parse.js +308 -0
  56. package/dist/agent-farm/servers/decisions/parse.js.map +1 -0
  57. package/dist/agent-farm/servers/decisions/routes.d.ts +17 -0
  58. package/dist/agent-farm/servers/decisions/routes.d.ts.map +1 -0
  59. package/dist/agent-farm/servers/decisions/routes.js +160 -0
  60. package/dist/agent-farm/servers/decisions/routes.js.map +1 -0
  61. package/dist/agent-farm/servers/decisions/splice.d.ts +26 -0
  62. package/dist/agent-farm/servers/decisions/splice.d.ts.map +1 -0
  63. package/dist/agent-farm/servers/decisions/splice.js +120 -0
  64. package/dist/agent-farm/servers/decisions/splice.js.map +1 -0
  65. package/dist/agent-farm/servers/decisions/stamp.d.ts +4 -0
  66. package/dist/agent-farm/servers/decisions/stamp.d.ts.map +1 -0
  67. package/dist/agent-farm/servers/decisions/stamp.js +171 -0
  68. package/dist/agent-farm/servers/decisions/stamp.js.map +1 -0
  69. package/dist/agent-farm/servers/gate-profiles.d.ts +23 -2
  70. package/dist/agent-farm/servers/gate-profiles.d.ts.map +1 -1
  71. package/dist/agent-farm/servers/gate-profiles.js +43 -2
  72. package/dist/agent-farm/servers/gate-profiles.js.map +1 -1
  73. package/dist/agent-farm/servers/ide-forward.d.ts +62 -0
  74. package/dist/agent-farm/servers/ide-forward.d.ts.map +1 -0
  75. package/dist/agent-farm/servers/ide-forward.js +274 -0
  76. package/dist/agent-farm/servers/ide-forward.js.map +1 -0
  77. package/dist/agent-farm/servers/ide-server.d.ts +68 -0
  78. package/dist/agent-farm/servers/ide-server.d.ts.map +1 -0
  79. package/dist/agent-farm/servers/ide-server.js +281 -0
  80. package/dist/agent-farm/servers/ide-server.js.map +1 -0
  81. package/dist/agent-farm/servers/mailbox-delivery.d.ts +213 -4
  82. package/dist/agent-farm/servers/mailbox-delivery.d.ts.map +1 -1
  83. package/dist/agent-farm/servers/mailbox-delivery.js +489 -68
  84. package/dist/agent-farm/servers/mailbox-delivery.js.map +1 -1
  85. package/dist/agent-farm/servers/mailbox-wiring.d.ts +18 -4
  86. package/dist/agent-farm/servers/mailbox-wiring.d.ts.map +1 -1
  87. package/dist/agent-farm/servers/mailbox-wiring.js +94 -21
  88. package/dist/agent-farm/servers/mailbox-wiring.js.map +1 -1
  89. package/dist/agent-farm/servers/message-write.d.ts +138 -11
  90. package/dist/agent-farm/servers/message-write.d.ts.map +1 -1
  91. package/dist/agent-farm/servers/message-write.js +144 -35
  92. package/dist/agent-farm/servers/message-write.js.map +1 -1
  93. package/dist/agent-farm/servers/overview.d.ts +32 -15
  94. package/dist/agent-farm/servers/overview.d.ts.map +1 -1
  95. package/dist/agent-farm/servers/overview.js +181 -103
  96. package/dist/agent-farm/servers/overview.js.map +1 -1
  97. package/dist/agent-farm/servers/render-gate.d.ts +53 -0
  98. package/dist/agent-farm/servers/render-gate.d.ts.map +1 -1
  99. package/dist/agent-farm/servers/render-gate.js +135 -24
  100. package/dist/agent-farm/servers/render-gate.js.map +1 -1
  101. package/dist/agent-farm/servers/session-submit.d.ts +7 -4
  102. package/dist/agent-farm/servers/session-submit.d.ts.map +1 -1
  103. package/dist/agent-farm/servers/session-submit.js +7 -4
  104. package/dist/agent-farm/servers/session-submit.js.map +1 -1
  105. package/dist/agent-farm/servers/tower-cron.d.ts.map +1 -1
  106. package/dist/agent-farm/servers/tower-cron.js +4 -1
  107. package/dist/agent-farm/servers/tower-cron.js.map +1 -1
  108. package/dist/agent-farm/servers/tower-instances.d.ts.map +1 -1
  109. package/dist/agent-farm/servers/tower-instances.js +6 -7
  110. package/dist/agent-farm/servers/tower-instances.js.map +1 -1
  111. package/dist/agent-farm/servers/tower-routes.d.ts.map +1 -1
  112. package/dist/agent-farm/servers/tower-routes.js +116 -18
  113. package/dist/agent-farm/servers/tower-routes.js.map +1 -1
  114. package/dist/agent-farm/servers/tower-server.js +64 -7
  115. package/dist/agent-farm/servers/tower-server.js.map +1 -1
  116. package/dist/agent-farm/servers/tower-terminals.d.ts.map +1 -1
  117. package/dist/agent-farm/servers/tower-terminals.js +53 -8
  118. package/dist/agent-farm/servers/tower-terminals.js.map +1 -1
  119. package/dist/agent-farm/servers/tower-websocket.d.ts.map +1 -1
  120. package/dist/agent-farm/servers/tower-websocket.js +18 -1
  121. package/dist/agent-farm/servers/tower-websocket.js.map +1 -1
  122. package/dist/agent-farm/utils/message-format.d.ts +8 -0
  123. package/dist/agent-farm/utils/message-format.d.ts.map +1 -1
  124. package/dist/agent-farm/utils/message-format.js +21 -6
  125. package/dist/agent-farm/utils/message-format.js.map +1 -1
  126. package/dist/agent-farm/utils/port.d.ts +22 -0
  127. package/dist/agent-farm/utils/port.d.ts.map +1 -0
  128. package/dist/agent-farm/utils/port.js +35 -0
  129. package/dist/agent-farm/utils/port.js.map +1 -0
  130. package/dist/agent-farm/utils/server-utils.d.ts +26 -0
  131. package/dist/agent-farm/utils/server-utils.d.ts.map +1 -1
  132. package/dist/agent-farm/utils/server-utils.js +36 -0
  133. package/dist/agent-farm/utils/server-utils.js.map +1 -1
  134. package/dist/cli.js +2 -2
  135. package/dist/cli.js.map +1 -1
  136. package/dist/commands/consult/index.d.ts +20 -1
  137. package/dist/commands/consult/index.d.ts.map +1 -1
  138. package/dist/commands/consult/index.js +117 -3
  139. package/dist/commands/consult/index.js.map +1 -1
  140. package/dist/commands/consult/tree-tripwire.d.ts +177 -0
  141. package/dist/commands/consult/tree-tripwire.d.ts.map +1 -0
  142. package/dist/commands/consult/tree-tripwire.js +356 -0
  143. package/dist/commands/consult/tree-tripwire.js.map +1 -0
  144. package/dist/commands/doctor.d.ts +69 -0
  145. package/dist/commands/doctor.d.ts.map +1 -1
  146. package/dist/commands/doctor.js +163 -0
  147. package/dist/commands/doctor.js.map +1 -1
  148. package/dist/commands/generate-image.d.ts +5 -0
  149. package/dist/commands/generate-image.d.ts.map +1 -1
  150. package/dist/commands/generate-image.js +225 -4
  151. package/dist/commands/generate-image.js.map +1 -1
  152. package/dist/commands/porch/checks.d.ts +7 -1
  153. package/dist/commands/porch/checks.d.ts.map +1 -1
  154. package/dist/commands/porch/checks.js +77 -14
  155. package/dist/commands/porch/checks.js.map +1 -1
  156. package/dist/commands/porch/index.d.ts +38 -1
  157. package/dist/commands/porch/index.d.ts.map +1 -1
  158. package/dist/commands/porch/index.js +79 -43
  159. package/dist/commands/porch/index.js.map +1 -1
  160. package/dist/commands/porch/protocol.d.ts +4 -3
  161. package/dist/commands/porch/protocol.d.ts.map +1 -1
  162. package/dist/commands/porch/protocol.js +32 -5
  163. package/dist/commands/porch/protocol.js.map +1 -1
  164. package/dist/commands/porch/types.d.ts +2 -0
  165. package/dist/commands/porch/types.d.ts.map +1 -1
  166. package/dist/lib/agent-env.d.ts +95 -0
  167. package/dist/lib/agent-env.d.ts.map +1 -0
  168. package/dist/lib/agent-env.js +137 -0
  169. package/dist/lib/agent-env.js.map +1 -0
  170. package/dist/lib/config.d.ts +8 -0
  171. package/dist/lib/config.d.ts.map +1 -1
  172. package/dist/lib/config.js.map +1 -1
  173. package/dist/lib/forge-contracts.d.ts +10 -0
  174. package/dist/lib/forge-contracts.d.ts.map +1 -1
  175. package/dist/lib/forge-contracts.js.map +1 -1
  176. package/dist/lib/forge-rate-limit.d.ts +45 -0
  177. package/dist/lib/forge-rate-limit.d.ts.map +1 -0
  178. package/dist/lib/forge-rate-limit.js +89 -0
  179. package/dist/lib/forge-rate-limit.js.map +1 -0
  180. package/dist/lib/forge.d.ts +28 -0
  181. package/dist/lib/forge.d.ts.map +1 -1
  182. package/dist/lib/forge.js +63 -10
  183. package/dist/lib/forge.js.map +1 -1
  184. package/dist/lib/github.d.ts +13 -1
  185. package/dist/lib/github.d.ts.map +1 -1
  186. package/dist/lib/github.js +58 -15
  187. package/dist/lib/github.js.map +1 -1
  188. package/dist/lib/test-env.d.ts +17 -0
  189. package/dist/lib/test-env.d.ts.map +1 -1
  190. package/dist/lib/test-env.js +20 -0
  191. package/dist/lib/test-env.js.map +1 -1
  192. package/dist/terminal/pty-session.d.ts +122 -4
  193. package/dist/terminal/pty-session.d.ts.map +1 -1
  194. package/dist/terminal/pty-session.js +142 -7
  195. package/dist/terminal/pty-session.js.map +1 -1
  196. package/dist/terminal/session-manager.d.ts +23 -2
  197. package/dist/terminal/session-manager.d.ts.map +1 -1
  198. package/dist/terminal/session-manager.js +115 -36
  199. package/dist/terminal/session-manager.js.map +1 -1
  200. package/dist/terminal/session-screen.d.ts +34 -5
  201. package/dist/terminal/session-screen.d.ts.map +1 -1
  202. package/dist/terminal/session-screen.js +52 -6
  203. package/dist/terminal/session-screen.js.map +1 -1
  204. package/dist/terminal/terminal-replies.d.ts +102 -0
  205. package/dist/terminal/terminal-replies.d.ts.map +1 -0
  206. package/dist/terminal/terminal-replies.js +181 -0
  207. package/dist/terminal/terminal-replies.js.map +1 -0
  208. package/package.json +4 -4
  209. package/scripts/forge/github/pr-list.sh +6 -2
  210. package/scripts/forge/github/pr-search.sh +4 -2
  211. package/scripts/forge/gitlab/issue-search.sh +1 -0
  212. package/scripts/forge/gitlab/pr-search.sh +35 -2
  213. package/scripts/forge/linear/auth-status.sh +1 -0
  214. package/scripts/forge/linear/issue-comment.sh +1 -0
  215. package/scripts/forge/linear/issue-list.sh +1 -0
  216. package/scripts/forge/linear/issue-search.sh +1 -0
  217. package/scripts/forge/linear/issue-view.sh +1 -0
  218. package/scripts/forge/linear/recently-closed.sh +1 -0
  219. package/scripts/forge/linear/user-identity.sh +1 -0
  220. package/skeleton/.claude/skills/afx/SKILL.md +15 -0
  221. package/skeleton/.claude/skills/arch-init/SKILL.md +56 -9
  222. package/skeleton/.claude/skills/arch-save/SKILL.md +100 -9
  223. package/skeleton/.claude/skills/consult/SKILL.md +9 -0
  224. package/skeleton/.claude/skills/generate-image/SKILL.md +19 -2
  225. package/skeleton/.claude/skills/porch/SKILL.md +18 -0
  226. package/skeleton/.codex/skills/afx/SKILL.md +15 -0
  227. package/skeleton/.codex/skills/arch-init/SKILL.md +56 -9
  228. package/skeleton/.codex/skills/arch-save/SKILL.md +100 -9
  229. package/skeleton/.codex/skills/consult/SKILL.md +9 -0
  230. package/skeleton/.codex/skills/generate-image/SKILL.md +19 -2
  231. package/skeleton/.codex/skills/porch/SKILL.md +18 -0
  232. package/skeleton/protocol-schema.json +6 -0
  233. package/skeleton/protocols/maintain/protocol.md +5 -0
  234. package/skeleton/protocols/pir/prompts/review.md +0 -1
  235. package/skeleton/protocols/protocol-schema.json +6 -0
  236. package/skeleton/resources/commands/agent-farm.md +71 -2
  237. package/skeleton/resources/commands/consult.md +9 -2
  238. package/skeleton/roles/consultant.md +32 -0
  239. package/skeleton/templates/AGENTS.md +1 -1
  240. package/skeleton/templates/CLAUDE.md +1 -1
  241. package/skeleton/templates/cheatsheet.md +1 -1
  242. package/dashboard-dist/assets/index-CUIjS_Vb.js +0 -199
  243. package/dashboard-dist/assets/index-CUIjS_Vb.js.map +0 -1
  244. package/dashboard-dist/assets/index-DnYLy5C_.css +0 -32
@@ -0,0 +1,95 @@
1
+ /**
2
+ * Environment sanitation for agent processes Tower spawns (Issue #1219).
3
+ *
4
+ * Claude Code plants session markers — `CLAUDECODE`, `CLAUDE_CODE_CHILD_SESSION`,
5
+ * `CLAUDE_CODE_SESSION_ID`, … — into every subprocess it creates, so a nested
6
+ * `claude` can tell it was launched from inside another session and turn
7
+ * transcript saving off. Tower is a daemon, but it inherits the environment of
8
+ * whoever started it, and starting Tower from inside a Claude session is routine
9
+ * (`afx tower start`, `pnpm -w run local-install`, an architect recovering from a
10
+ * crash). The markers then cascade:
11
+ *
12
+ * claude session → Bash → afx tower start → Tower → shellper → agent claude
13
+ *
14
+ * Every agent Tower spawns believes it is a nested child session, and a session
15
+ * with transcript saving off **cannot be resumed** — which quietly guts the
16
+ * crash-recovery story (#1145, #1149) and only shows up at recovery time, when
17
+ * it is too late.
18
+ *
19
+ * ## Why this strips named families rather than the whole namespace
20
+ *
21
+ * The first version of this module denied `CLAUDE_CODE_*` wholesale and kept a
22
+ * short allowlist, on the theory that a *missed marker* is worse than a missed
23
+ * config var. The CMAP review (codex) rejected that, and checking the shipped
24
+ * `claude` binary settled it: it reads **594** distinct `CLAUDE_CODE_*`
25
+ * variables, and they are overwhelmingly configuration — provider selection
26
+ * (`USE_BEDROCK`, `USE_VERTEX`, `USE_FOUNDRY`, `USE_MANTLE`,
27
+ * `USE_ANTHROPIC_AWS`, `USE_GATEWAY`), the matching `SKIP_*_AUTH` switches,
28
+ * credentials (`OAUTH_TOKEN`, `OAUTH_REFRESH_TOKEN`, `OAUTH_SCOPES`,
29
+ * `CLIENT_CERT`), routing (`API_BASE_URL`, `PROXY_URL`, `HTTPS_PROXY`), and
30
+ * policy (`MANAGED_SETTINGS_PATH`). No hand-maintained allowlist survives that,
31
+ * and dropping any of them is not the harmless failure the original reasoning
32
+ * assumed — it silently routes an agent at the wrong provider, or strips the
33
+ * subscription credential and reroutes CMAP to the metered API (the #985 scar).
34
+ *
35
+ * So the rule is: **strip what is per-session identity, keep everything else.**
36
+ * Identity is a small, stable, nameable set; configuration is not.
37
+ *
38
+ * The cost of that direction is real and worth stating plainly: a marker added
39
+ * upstream that this list has not caught up with will pass through, and nothing
40
+ * here will notice. `codev doctor`'s Tower Environment check is not a backstop
41
+ * for that case — it classifies with this same list, so it is blind to exactly
42
+ * what it would need to catch. Claude Code's own "transcript saving is off"
43
+ * banner is the only real signal, and it is how #1219 was found in the first
44
+ * place. Adding the new name here is the fix when that happens.
45
+ */
46
+ /**
47
+ * Whole families of per-session identity. Every variable Claude Code ships
48
+ * under these prefixes describes *this* session — its id, its socket, its
49
+ * bridge — and inheriting one into a different agent is always wrong.
50
+ */
51
+ export declare const CLAUDE_SESSION_MARKER_PREFIXES: readonly string[];
52
+ /**
53
+ * Individually named session markers that do not fall under a prefix family.
54
+ *
55
+ * `CLAUDECODE` was already being deleted ad hoc at each Tower spawn site; it
56
+ * lives here now so there is one list rather than six copies of one `delete`.
57
+ * `CHILD_SESSION`, `ENTRYPOINT` and `EXECPATH` are the nesting-detection triple
58
+ * that #1219 is actually about.
59
+ *
60
+ * `CLAUDE_PID` sits outside the `CLAUDE_CODE_` namespace but belongs here on the
61
+ * merits: the shipped binary builds its child environment as
62
+ * `{CLAUDECODE:"1", CLAUDE_CODE_SESSION_ID:…, CLAUDE_CODE_CHILD_SESSION:"1",
63
+ * CLAUDE_PID:String(process.pid)}` — one object literal, so it is identity by
64
+ * construction, not by namespace. Nothing reads it for nesting detection; its
65
+ * only reader is the `pkill` guard in the Bash tool's shell prelude, which
66
+ * refuses a pattern matching the Claude CLI's own pid. An inherited stale value
67
+ * points that guard at a dead or unrelated pid, which is its own small bug.
68
+ *
69
+ * `CLAUDE_EFFORT` is planted by that same function and is deliberately NOT here:
70
+ * being planted by Claude Code is not the test — it carries a *setting* (the
71
+ * effort level), not an identity, so it is configuration and passes through.
72
+ */
73
+ export declare const CLAUDE_SESSION_MARKER_NAMES: readonly string[];
74
+ /** Whether `name` is a Claude Code session marker that must not reach an agent. */
75
+ export declare function isClaudeSessionMarker(name: string): boolean;
76
+ /**
77
+ * Codev's own per-session identity: the worktree of the builder a process belongs
78
+ * to (Issue #1783). Exported by `.builder-start.sh`, so every process a builder
79
+ * runs inherits it and `afx send` / `afx whoami` resolve the builder from any
80
+ * cwd. Stripped below for the same reason as the Claude markers: a Tower started
81
+ * from a builder's shell must not hand that builder's identity to every terminal
82
+ * it spawns.
83
+ */
84
+ export declare const BUILDER_WORKTREE_ENV = "CODEV_BUILDER_WORKTREE";
85
+ /**
86
+ * Copy `env` with Claude Code session markers (and the builder identity) removed.
87
+ *
88
+ * Returns a plain `Record<string, string>` — `undefined`-valued entries (which
89
+ * `NodeJS.ProcessEnv` permits and node-pty rejects) are dropped — so callers can
90
+ * hand the result straight to a spawn call.
91
+ */
92
+ export declare function sanitizeAgentEnv(env?: NodeJS.ProcessEnv | Record<string, string>): Record<string, string>;
93
+ /** The session markers present in `env`, for diagnostics (`codev doctor`). */
94
+ export declare function findClaudeSessionMarkers(env?: NodeJS.ProcessEnv | Record<string, string>): string[];
95
+ //# sourceMappingURL=agent-env.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-env.d.ts","sourceRoot":"","sources":["../../src/lib/agent-env.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAEH;;;;GAIG;AACH,eAAO,MAAM,8BAA8B,EAAE,SAAS,MAAM,EAS3D,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,2BAA2B,EAAE,SAAS,MAAM,EAcxD,CAAC;AAIF,mFAAmF;AACnF,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAG3D;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,2BAA2B,CAAC;AAE7D;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,GAAG,GAAE,MAAM,CAAC,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAe,GAC5D,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CASxB;AAED,8EAA8E;AAC9E,wBAAgB,wBAAwB,CACtC,GAAG,GAAE,MAAM,CAAC,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAe,GAC5D,MAAM,EAAE,CAEV"}
@@ -0,0 +1,137 @@
1
+ /**
2
+ * Environment sanitation for agent processes Tower spawns (Issue #1219).
3
+ *
4
+ * Claude Code plants session markers — `CLAUDECODE`, `CLAUDE_CODE_CHILD_SESSION`,
5
+ * `CLAUDE_CODE_SESSION_ID`, … — into every subprocess it creates, so a nested
6
+ * `claude` can tell it was launched from inside another session and turn
7
+ * transcript saving off. Tower is a daemon, but it inherits the environment of
8
+ * whoever started it, and starting Tower from inside a Claude session is routine
9
+ * (`afx tower start`, `pnpm -w run local-install`, an architect recovering from a
10
+ * crash). The markers then cascade:
11
+ *
12
+ * claude session → Bash → afx tower start → Tower → shellper → agent claude
13
+ *
14
+ * Every agent Tower spawns believes it is a nested child session, and a session
15
+ * with transcript saving off **cannot be resumed** — which quietly guts the
16
+ * crash-recovery story (#1145, #1149) and only shows up at recovery time, when
17
+ * it is too late.
18
+ *
19
+ * ## Why this strips named families rather than the whole namespace
20
+ *
21
+ * The first version of this module denied `CLAUDE_CODE_*` wholesale and kept a
22
+ * short allowlist, on the theory that a *missed marker* is worse than a missed
23
+ * config var. The CMAP review (codex) rejected that, and checking the shipped
24
+ * `claude` binary settled it: it reads **594** distinct `CLAUDE_CODE_*`
25
+ * variables, and they are overwhelmingly configuration — provider selection
26
+ * (`USE_BEDROCK`, `USE_VERTEX`, `USE_FOUNDRY`, `USE_MANTLE`,
27
+ * `USE_ANTHROPIC_AWS`, `USE_GATEWAY`), the matching `SKIP_*_AUTH` switches,
28
+ * credentials (`OAUTH_TOKEN`, `OAUTH_REFRESH_TOKEN`, `OAUTH_SCOPES`,
29
+ * `CLIENT_CERT`), routing (`API_BASE_URL`, `PROXY_URL`, `HTTPS_PROXY`), and
30
+ * policy (`MANAGED_SETTINGS_PATH`). No hand-maintained allowlist survives that,
31
+ * and dropping any of them is not the harmless failure the original reasoning
32
+ * assumed — it silently routes an agent at the wrong provider, or strips the
33
+ * subscription credential and reroutes CMAP to the metered API (the #985 scar).
34
+ *
35
+ * So the rule is: **strip what is per-session identity, keep everything else.**
36
+ * Identity is a small, stable, nameable set; configuration is not.
37
+ *
38
+ * The cost of that direction is real and worth stating plainly: a marker added
39
+ * upstream that this list has not caught up with will pass through, and nothing
40
+ * here will notice. `codev doctor`'s Tower Environment check is not a backstop
41
+ * for that case — it classifies with this same list, so it is blind to exactly
42
+ * what it would need to catch. Claude Code's own "transcript saving is off"
43
+ * banner is the only real signal, and it is how #1219 was found in the first
44
+ * place. Adding the new name here is the fix when that happens.
45
+ */
46
+ /**
47
+ * Whole families of per-session identity. Every variable Claude Code ships
48
+ * under these prefixes describes *this* session — its id, its socket, its
49
+ * bridge — and inheriting one into a different agent is always wrong.
50
+ */
51
+ export const CLAUDE_SESSION_MARKER_PREFIXES = [
52
+ // SESSION_ID / _KIND / _LOG / _NAME / _ORIGIN / _ACCESS_TOKEN
53
+ 'CLAUDE_CODE_SESSION_',
54
+ // REMOTE_SESSION_ID / _ORIGIN / _UUID
55
+ 'CLAUDE_CODE_REMOTE_SESSION_',
56
+ // BRIDGE_SESSION_ID / _PROMPT_SHA256 / _OWNER_* / _MCP_CARRIER
57
+ 'CLAUDE_CODE_BRIDGE_',
58
+ // MESSAGING_SOCKET / _TOKEN — a live socket path and its bearer token
59
+ 'CLAUDE_CODE_MESSAGING_',
60
+ ];
61
+ /**
62
+ * Individually named session markers that do not fall under a prefix family.
63
+ *
64
+ * `CLAUDECODE` was already being deleted ad hoc at each Tower spawn site; it
65
+ * lives here now so there is one list rather than six copies of one `delete`.
66
+ * `CHILD_SESSION`, `ENTRYPOINT` and `EXECPATH` are the nesting-detection triple
67
+ * that #1219 is actually about.
68
+ *
69
+ * `CLAUDE_PID` sits outside the `CLAUDE_CODE_` namespace but belongs here on the
70
+ * merits: the shipped binary builds its child environment as
71
+ * `{CLAUDECODE:"1", CLAUDE_CODE_SESSION_ID:…, CLAUDE_CODE_CHILD_SESSION:"1",
72
+ * CLAUDE_PID:String(process.pid)}` — one object literal, so it is identity by
73
+ * construction, not by namespace. Nothing reads it for nesting detection; its
74
+ * only reader is the `pkill` guard in the Bash tool's shell prelude, which
75
+ * refuses a pattern matching the Claude CLI's own pid. An inherited stale value
76
+ * points that guard at a dead or unrelated pid, which is its own small bug.
77
+ *
78
+ * `CLAUDE_EFFORT` is planted by that same function and is deliberately NOT here:
79
+ * being planted by Claude Code is not the test — it carries a *setting* (the
80
+ * effort level), not an identity, so it is configuration and passes through.
81
+ */
82
+ export const CLAUDE_SESSION_MARKER_NAMES = [
83
+ 'CLAUDECODE',
84
+ 'CLAUDE_CODE_CHILD_SESSION',
85
+ // Not in the CLAUDE_CODE_ namespace, but planted by the same object literal
86
+ // as CHILD_SESSION and set to `String(process.pid)` — see the note below.
87
+ 'CLAUDE_PID',
88
+ 'CLAUDE_CODE_ENTRYPOINT',
89
+ 'CLAUDE_CODE_EXECPATH',
90
+ 'CLAUDE_CODE_SSE_PORT',
91
+ 'CLAUDE_CODE_CLOUD_SESSION_ID',
92
+ 'CLAUDE_CODE_RESUME_FROM_SESSION',
93
+ 'CLAUDE_CODE_SPAWN_TIMESTAMP_MS',
94
+ 'CLAUDE_CODE_TRIGGER_ID',
95
+ 'CLAUDE_CODE_WORKER_EPOCH',
96
+ ];
97
+ const MARKER_NAMES = new Set(CLAUDE_SESSION_MARKER_NAMES);
98
+ /** Whether `name` is a Claude Code session marker that must not reach an agent. */
99
+ export function isClaudeSessionMarker(name) {
100
+ if (MARKER_NAMES.has(name))
101
+ return true;
102
+ return CLAUDE_SESSION_MARKER_PREFIXES.some((prefix) => name.startsWith(prefix));
103
+ }
104
+ /**
105
+ * Codev's own per-session identity: the worktree of the builder a process belongs
106
+ * to (Issue #1783). Exported by `.builder-start.sh`, so every process a builder
107
+ * runs inherits it and `afx send` / `afx whoami` resolve the builder from any
108
+ * cwd. Stripped below for the same reason as the Claude markers: a Tower started
109
+ * from a builder's shell must not hand that builder's identity to every terminal
110
+ * it spawns.
111
+ */
112
+ export const BUILDER_WORKTREE_ENV = 'CODEV_BUILDER_WORKTREE';
113
+ /**
114
+ * Copy `env` with Claude Code session markers (and the builder identity) removed.
115
+ *
116
+ * Returns a plain `Record<string, string>` — `undefined`-valued entries (which
117
+ * `NodeJS.ProcessEnv` permits and node-pty rejects) are dropped — so callers can
118
+ * hand the result straight to a spawn call.
119
+ */
120
+ export function sanitizeAgentEnv(env = process.env) {
121
+ const out = {};
122
+ for (const [key, value] of Object.entries(env)) {
123
+ if (value === undefined)
124
+ continue;
125
+ if (isClaudeSessionMarker(key))
126
+ continue;
127
+ if (key === BUILDER_WORKTREE_ENV)
128
+ continue;
129
+ out[key] = value;
130
+ }
131
+ return out;
132
+ }
133
+ /** The session markers present in `env`, for diagnostics (`codev doctor`). */
134
+ export function findClaudeSessionMarkers(env = process.env) {
135
+ return Object.keys(env).filter(isClaudeSessionMarker).sort();
136
+ }
137
+ //# sourceMappingURL=agent-env.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-env.js","sourceRoot":"","sources":["../../src/lib/agent-env.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAsB;IAC/D,8DAA8D;IAC9D,sB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8E;AAC9E,MAAM,UAAU,wBAAwB,CACtC,MAAkD,OAAO,CAAC,GAAG;IAE7D,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC,IAAI,EAAE,CAAC;AAC/D,CAAC"}
@@ -115,6 +115,13 @@ export interface CodevConfig {
115
115
  };
116
116
  dashboard?: {
117
117
  frontend?: 'react' | 'legacy';
118
+ /**
119
+ * The pending-decisions file the Decisions tab views and writes rulings into
120
+ * (Spec 1819), relative to the workspace root. Default
121
+ * `codev/state/pending-decisions.md`. It must resolve — symlinks followed — to a
122
+ * file inside the workspace; anything else is refused.
123
+ */
124
+ decisionsFile?: string;
118
125
  };
119
126
  framework?: {
120
127
  source?: string;
@@ -126,6 +133,7 @@ export interface CodevConfig {
126
133
  export interface CheckOverride {
127
134
  command?: string;
128
135
  cwd?: string;
136
+ timeout_ms?: number;
129
137
  skip?: boolean;
130
138
  }
131
139
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAOH,OAAO,EAKL,KAAK,YAAY,EAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAM9D,MAAM,WAAW,WAAW;IAC1B,KAAK,CAAC,EAAE;QACN,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;QAC9B,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;QAC5B,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;KAC3B,CAAC;IACF,iGAAiG;IACjG,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QACvB,QAAQ,EAAE,MAAM,EAAE,CAAC;Q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AAI,OAAO,GAAG,IAAI,CAAC;QACnB,KAAK,MAAM,GAAG,IAAI,OAAO,EAAE,CAAC;YAC1B,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI,IAAI,CAAC,CAAC,GAAG,IAAK,MAAkC,CAAC,EAAE,CAAC;gBACnG,OAAO,GAAG,KAAK,CAAC;gBAChB,MAAM;YACR,CAAC;YACD,MAAM,GAAI,MAAkC,CAAC,GAAG,CAAC,CAAC;QACpD,CAAC;QACD,IAAI,OAAO;YAAE,KAAK,GAAG,KAAK,CAAC,CAAC,8CAA8C;IAC5E,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB;IAC9B,OAAO,eAAe,CAAC,cAAc,CAAC,CAAC;AACzC,CAAC"}
@@ -146,6 +146,16 @@ export type RecentlyMergedResult = MergedPrItem[];
146
146
  export interface PrSearchItem {
147
147
  number: number;
148
148
  headRefName: string;
149
+ /**
150
+ * PR/MR state, normalized to the GitHub convention: `OPEN` | `MERGED` |
151
+ * `CLOSED`. Because `pr-search` runs `--state all` (#759), consumers that
152
+ * only want open PRs must filter on this — the spawn collision guard ignores
153
+ * non-open results (#1637). Optional: a stale project-local override of
154
+ * `pr-search.sh` may predate this field (and the gitlab script leaves it
155
+ * blank when glab omits it), so consumers treat an absent or empty value as
156
+ * "unknown" rather than assuming a state.
157
+ */
158
+ state?: string;
149
159
  }
150
160
  /** Output of the `pr-search` concept command. */
151
161
  export type PrSearchResult = PrSearchItem[];
@@ -1 +1 @@
1
- {"version":3,"file":"forge-contracts.d.ts","sourceRoot":"","sources":["../../src/lib/forge-contracts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAMH,kDAAkD;AAClD,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd;;;;;;OAMG;IACH,GAA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ACxE,uDAAuD;AAEvD,yEAAyE;AACzE,8DAA8D;AAE9D,gFAAgF;AAChF,2BAA2B;AAC3B,gFAAgF;AAEhF,8EAA8E;AAC9E,+CAA+C;AAE/C,2EAA2E;AAC3E,mEAAmE;AACnE,8CAA8C;AAE9C,8EAA8E;AAC9E,0EAA0E;AAC1E,yCAAyC;AAEzC,gFAAgF;AAChF,gBAAgB;AAChB,gFAAgF;AAEhF,mEAAmE;AACnE,6DAA6D"}
1
+ {"version":3,"file":"forge-contracts.js","sourceRoot":"","sources":["../../src/lib/forge-contracts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;;AAiMH,wEAAwE;AACxE,uDAAuD;AAEvD,yEAAyE;AACzE,8DAA8D;AAE9D,gFAAgF;AAChF,2BAA2B;AAC3B,gFAAgF;AAEhF,8EAA8E;AAC9E,+CAA+C;AAE/C,2EAA2E;AAC3E,mEAAmE;AACnE,8CAA8C;AAE9C,8EAA8E;AAC9E,0EAA0E;AAC1E,yCAAyC;AAEzC,gFAAgF;AAChF,gBAAgB;AAChB,gFAAgF;AAEhF,mEAAmE;AACnE,6DAA6D"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Per-backend rate-limit suspension for forge fetches (#1645).
3
+ *
4
+ * When a backend (`gh`, `glab`, …) reports that its budget is exhausted, every
5
+ * fetch that would spend the same budget is suspended until the reset instant.
6
+ * Importing this module never shells out: the optional reset probe is injected
7
+ * by the caller that wants it (Tower's overview cache).
8
+ */
9
+ export declare function isRateLimitError(text: string): boolean;
10
+ /** The budget a concept spends on its backend, e.g. `gh` or `gh:rest`. */
11
+ export declare function budgetKeyFor(backend: string, concept: string): string;
12
+ /** Result of a reset probe. `remaining === 0` makes the reported reset credible. */
13
+ export interface RateLimitProbeResult {
14
+ remaining: number;
15
+ /** Reset instant, epoch milliseconds. */
16
+ resetAt: number;
17
+ }
18
+ export type RateLimitProbe = (backend: string, cwd: string) => Promise<RateLimitProbeResult | null>;
19
+ export declare const SUSPENSION_FALLBACK_MS: number;
20
+ export declare class ForgeRateLimiter {
21
+ private readonly probe?;
22
+ private readonly suspensions;
23
+ constructor(probe?: RateLimitProbe | undefined);
24
+ /** Read-only: never allocates, so polling it every 2.5 s costs nothing. */
25
+ isSuspended(budget: string, now: number): boolean;
26
+ /** Reset instant (epoch ms) of an active suspension, else null. */
27
+ resetAt(budget: string, now: number): number | null;
28
+ /**
29
+ * Record a failure. Only a rate-limit error suspends, and only the failing
30
+ * budget: a REST failure never suspends the GraphQL bucket. A fresh
31
+ * suspension runs the reset probe at most once; a credible probe result
32
+ * (budget confirmed gone) sets the true reset instant, even if that is
33
+ * earlier than the fallback window.
34
+ */
35
+ noteFailure(budget: string, backend: string, cwd: string, errorText: string, now: number): boolean;
36
+ /**
37
+ * A success clears a suspension only if it was dispatched strictly after the
38
+ * suspension began: a batch dispatched in one tick shares a millisecond with
39
+ * the failure that suspended it, and its successes are not evidence of recovery.
40
+ */
41
+ noteSuccess(budget: string, dispatchedAt: number): void;
42
+ /** Honour a credible probe: the true reset instant wins over the fallback in both directions. */
43
+ private applyProbe;
44
+ }
45
+ //# sourceMappingURL=forge-rate-limit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"forge-rate-limit.d.ts","sourceRoot":"","sources":["../../src/lib/forge-rate-limit.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEtD;AAYD,0EAA0E;AAC1E,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAGrE;AAED,oFAAoF;AACpF,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,yCAAyC;IACzC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAAC;AAOpG,eAAO,MAAM,sBAAsB,QAAc,CAAC;AAElD,qBAAa,gBAAgB;IAGf,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC;IAFnC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAiC;gBAEhC,KAAK,CAAC,EAAE,cAAc,YAAA;IAEnD,2EAA2E;IAC3E,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO;IAKjD,mEAAmE;IACnE,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAKnD;;;;;;OAMG;IACH,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO;IAgBlG;;;;OAIG;IACH,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,IAAI;IAKvD,iGAAiG;IACjG,OAAO,CAAC,UAAU;CAKnB"}
@@ -0,0 +1,89 @@
1
+ /**
2
+ * Per-backend rate-limit suspension for forge fetches (#1645).
3
+ *
4
+ * When a backend (`gh`, `glab`, …) reports that its budget is exhausted, every
5
+ * fetch that would spend the same budget is suspended until the reset instant.
6
+ * Importing this module never shells out: the optional reset probe is injected
7
+ * by the caller that wants it (Tower's overview cache).
8
+ */
9
+ /** GitHub's GraphQL and REST primary-limit messages, and gh's error type. */
10
+ const RATE_LIMIT_PATTERN = /rate limit (?:already )?exceeded|RATE_LIMITED|graphql_rate_limit|secondary rate limit/i;
11
+ export function isRateLimitError(text) {
12
+ return RATE_LIMIT_PATTERN.test(text);
13
+ }
14
+ /**
15
+ * Concepts that spend a budget other than the one the backend's list concepts
16
+ * spend. This is a fact about the backend: on `gh`, `user-identity` is a REST
17
+ * call outside the GraphQL bucket; on Linear every concept is GraphQL on
18
+ * Linear's own budget, so nothing is split out there.
19
+ */
20
+ const OFF_BUDGET_CONCEPTS = {
21
+ gh: new Set(['user-identity', 'auth-status']),
22
+ };
23
+ /** The budget a concept spends on its backend, e.g. `gh` or `gh:rest`. */
24
+ export function budgetKeyFor(backend, concept) {
25
+ const key = backend.toLowerCase();
26
+ return OFF_BUDGET_CONCEPTS[key]?.has(concept) ? `${key}:rest` : key;
27
+ }
28
+ export const SUSPENSION_FALLBACK_MS = 15 * 60_000;
29
+ export class ForgeRateLimiter {
30
+ probe;
31
+ suspensions = new Map();
32
+ constructor(probe) {
33
+ this.probe = probe;
34
+ }
35
+ /** Read-only: never allocates, so polling it every 2.5 s costs nothing. */
36
+ isSuspended(budget, now) {
37
+ const s = this.suspensions.get(budget);
38
+ return s !== undefined && now < s.until;
39
+ }
40
+ /** Reset instant (epoch ms) of an active suspension, else null. */
41
+ resetAt(budget, now) {
42
+ const s = this.suspensions.get(budget);
43
+ return s !== undefined && now < s.until ? s.until : null;
44
+ }
45
+ /**
46
+ * Record a failure. Only a rate-limit error suspends, and only the failing
47
+ * budget: a REST failure never suspends the GraphQL bucket. A fresh
48
+ * suspension runs the reset probe at most once; a credible probe result
49
+ * (budget confirmed gone) sets the true reset instant, even if that is
50
+ * earlier than the fallback window.
51
+ */
52
+ noteFailure(budget, backend, cwd, errorText, now) {
53
+ if (!isRateLimitError(errorText))
54
+ return false;
55
+ const existing = this.suspensions.get(budget);
56
+ if (existing && now < existing.until)
57
+ return true;
58
+ const suspension = { startedAt: now, until: now + SUSPENSION_FALLBACK_MS };
59
+ this.suspensions.set(budget, suspension);
60
+ const probe = this.probe;
61
+ if (probe && backend === 'gh') {
62
+ Promise.resolve()
63
+ .then(() => probe(backend, cwd))
64
+ .then(result => this.applyProbe(budget, suspension, result))
65
+ .catch(() => { });
66
+ }
67
+ return true;
68
+ }
69
+ /**
70
+ * A success clears a suspension only if it was dispatched strictly after the
71
+ * suspension began: a batch dispatched in one tick shares a millisecond with
72
+ * the failure that suspended it, and its successes are not evidence of recovery.
73
+ */
74
+ noteSuccess(budget, dispatchedAt) {
75
+ const s = this.suspensions.get(budget);
76
+ if (s && dispatchedAt > s.startedAt)
77
+ this.suspensions.delete(budget);
78
+ }
79
+ /** Honour a credible probe: the true reset instant wins over the fallback in both directions. */
80
+ applyProbe(budget, suspension, result) {
81
+ if (!result || result.remaining > 0)
82
+ return;
83
+ if (this.suspensions.get(budget) !== suspension)
84
+ return;
85
+ if (result.resetAt > suspension.startedAt)
86
+ suspension.until = result.resetAt;
87
+ }
88
+ }
89
+ //# sourceMappingURL=forge-rate-limit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"forge-rate-limit.js","sourceRoot":"","sources":["../../src/lib/forge-rate-limit.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,6EAA6E;AAC7E,MAAM,kBAAkB,GAAG,wFAAwF,CAAC;AAEpH,MAAM,UAAU,gBAAgB,CAAC,IAAY;IAC3C,OAAO,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACvC,CAAC;AAED;;;;;GAKG;AACH,MAAM,mBAAmB,GAAwC;IAC/D,EAAE,EAAE,IAAI,GAAG,CAAC,CAAC,eAAe,EAAE,aAAa,CAAC,CAAC;CAC9C,CAAC;AAEF,0EAA0E;AAC1E,MAAM,UAAU,YAAY,CAAC,OAAe,EAAE,OAAe;IAC3D,MAAM,GAAG,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAClC,OAAO,mBAAmB,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC;AACtE,CAAC;AAgBD,MAAM,CAAC,MAAM,sBAAsB,GAAG,EAAE,GAAG,MAAM,CAAC;AAElD,MAAM,OAAO,gBAAgB;IAGE;IAFZ,WAAW,GAAG,IAAI,GAAG,EAAsB,CAAC;IAE7D,YAA6B,KAAsB;QAAtB,UAAK,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IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;iBAC3D,KAAK,CAAC,GAAG,EAAE,GAAqD,CAAC,CAAC,CAAC;QACxE,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;OAIG;IACH,WAAW,CAAC,MAAc,EAAE,YAAoB;QAC9C,MAAM,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACvC,IAAI,CAAC,IAAI,YAAY,GAAG,CAAC,CAAC,SAAS;YAAE,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACvE,CAAC;IAED,iGAAiG;IACzF,UAAU,CAAC,MAAc,EAAE,UAAsB,EAAE,MAAmC;QAC5F,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,SAAS,GAAG,CAAC;YAAE,OAAO;QAC5C,IAAI,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,UAAU;YAAE,OAAO;QACxD,IAAI,MAAM,CAAC,OAAO,GAAG,UAAU,CAAC,SAAS;YAAE,UAAU,CAAC,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC;IAC/E,CAAC;CACF"}
@@ -73,6 +73,34 @@ export declare function isConceptDisabled(concept: string, forgeConfig?: ForgeCo
73
73
  * @returns Parsed JSON from stdout, raw string for non-JSON concepts, or null on failure
74
74
  */
75
75
  export declare function executeForgeCommand(concept: string, env?: Record<string, string>, options?: ForgeCommandOptions): Promise<unknown | null>;
76
+ /** Why a forge command produced no data (#1645). `null` on the result means it exited 0. */
77
+ export interface ForgeCommandError {
78
+ message: string;
79
+ stderr: string;
80
+ /** Process exit code; null when the command was disabled, timed out, or config failed to load. */
81
+ exitCode: number | null;
82
+ }
83
+ export interface ForgeCommandResult {
84
+ data: unknown | null;
85
+ error: ForgeCommandError | null;
86
+ }
87
+ /**
88
+ * Like `executeForgeCommand`, but keeps the failure (#1645). Callers that must
89
+ * tell "rate limited" from "CLI missing" need stderr and the exit code; the
90
+ * plain variant collapses every failure to `null`. Never throws — a malformed
91
+ * `.codev/config.json` is reported as an error, not raised into Tower's
92
+ * `unhandledRejection` handler.
93
+ */
94
+ export declare function executeForgeCommandDetailed(concept: string, env?: Record<string, string>, options?: ForgeCommandOptions): Promise<ForgeCommandResult>;
95
+ /**
96
+ * The backend a concept actually spends budget on (#1645): the resolved
97
+ * executable's lowercased basename (`gh`, whether configured as `gh` or
98
+ * `/usr/local/bin/gh`), never the configured provider — a Linear workspace's
99
+ * `pr-list` falls through to the GitHub script and spends GitHub's budget.
100
+ * Generic transports and custom script paths key by provider instead.
101
+ * Returns null when the concept is disabled or unknown.
102
+ */
103
+ export declare function resolveForgeBackend(concept: string, options?: ForgeCommandOptions): string | null;
76
104
  /**
77
105
  * Execute a forge concept command synchronously.
78
106
  *
@@ -1 +1 @@
1
- {"version":3,"file":"forge.d.ts","sourceRoot":"","sources":["../../src/lib/forge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AA8BH,oGAAoG;AACpG,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,GAAG;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEhF,2CAA2C;AAC3C,MAAM,WAAW,mBAAmB;IAClC,+CAA+C;IAC/C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,6FAA6F;IAC7F,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,yEAAyE;IACzE,WAAW,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IACjC,uEAAuE;IACvE,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,6DAA6D;IAC7D,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAiFD,gCAAgC;AAChC,wBAAgB,iBAAiB,IAAI,MAAM,EAAE,CAE5C;AAED,+CAA+C;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