@gajae-code/coding-agent 0.12.0 → 0.12.2

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 (247) hide show
  1. package/CHANGELOG.md +111 -0
  2. package/dist/types/async/job-manager.d.ts +17 -3
  3. package/dist/types/config/settings-schema.d.ts +56 -2
  4. package/dist/types/exa/mcp-client.d.ts +10 -1
  5. package/dist/types/exec/bash-executor.d.ts +45 -12
  6. package/dist/types/extensibility/extensions/types.d.ts +16 -2
  7. package/dist/types/extensibility/gjc-plugins/index.d.ts +12 -2
  8. package/dist/types/extensibility/gjc-plugins/installer.d.ts +63 -7
  9. package/dist/types/extensibility/gjc-plugins/lifecycle-reconciliation.d.ts +55 -0
  10. package/dist/types/extensibility/gjc-plugins/lifecycle.d.ts +64 -0
  11. package/dist/types/extensibility/gjc-plugins/runtime-quarantine.d.ts +67 -0
  12. package/dist/types/extensibility/gjc-plugins/session-validation.d.ts +3 -1
  13. package/dist/types/extensibility/gjc-plugins/types.d.ts +124 -0
  14. package/dist/types/gjc-runtime/launch-tmux.d.ts +1 -0
  15. package/dist/types/gjc-runtime/ralplan-review-conflicts.d.ts +114 -0
  16. package/dist/types/gjc-runtime/ralplan-runtime.d.ts +23 -3
  17. package/dist/types/gjc-runtime/team-launch.d.ts +1 -1
  18. package/dist/types/gjc-runtime/team-runtime.d.ts +25 -0
  19. package/dist/types/gjc-runtime/team-worker-heartbeat.d.ts +43 -0
  20. package/dist/types/gjc-runtime/tmux-owner-isolation.d.ts +10 -0
  21. package/dist/types/gjc-runtime/ultragoal-runtime.d.ts +37 -80
  22. package/dist/types/modes/acp/acp-agent.d.ts +2 -19
  23. package/dist/types/modes/components/gjc-bundle-settings.d.ts +34 -0
  24. package/dist/types/modes/components/irc-sidebar.d.ts +16 -0
  25. package/dist/types/modes/components/notifications-settings-editor.d.ts +1 -0
  26. package/dist/types/modes/components/session-observer-overlay.d.ts +18 -0
  27. package/dist/types/modes/components/settings-selector.d.ts +9 -0
  28. package/dist/types/modes/components/status-line/gh.d.ts +5 -0
  29. package/dist/types/modes/components/transcript-viewer-overlay.d.ts +18 -1
  30. package/dist/types/modes/controllers/command-controller.d.ts +1 -1
  31. package/dist/types/modes/controllers/event-controller.d.ts +1 -1
  32. package/dist/types/modes/controllers/extension-ui-controller.d.ts +2 -1
  33. package/dist/types/modes/controllers/selector-controller.d.ts +1 -1
  34. package/dist/types/modes/interactive-mode.d.ts +9 -0
  35. package/dist/types/modes/theme/theme.d.ts +3 -1
  36. package/dist/types/modes/types.d.ts +32 -0
  37. package/dist/types/reminders/star-reminder.d.ts +3 -13
  38. package/dist/types/runtime-mcp/manager.d.ts +1 -0
  39. package/dist/types/sdk/acp/adapter.d.ts +3 -1
  40. package/dist/types/sdk/broker/transport.d.ts +2 -0
  41. package/dist/types/sdk/bus/attachment-registry.d.ts +1 -0
  42. package/dist/types/sdk/bus/chat-daemon-control.d.ts +5 -1
  43. package/dist/types/sdk/bus/config.d.ts +6 -2
  44. package/dist/types/sdk/bus/index.d.ts +29 -0
  45. package/dist/types/sdk/bus/kind-aware-reconciliation.d.ts +8 -1
  46. package/dist/types/sdk/bus/lifecycle-control-runtime.d.ts +4 -0
  47. package/dist/types/sdk/bus/reconciliation-store.d.ts +7 -3
  48. package/dist/types/sdk/bus/rich-draft.d.ts +1 -0
  49. package/dist/types/sdk/bus/rich-render.d.ts +2 -0
  50. package/dist/types/sdk/bus/telegram-adoption-intent.d.ts +165 -0
  51. package/dist/types/sdk/bus/telegram-cli.d.ts +12 -0
  52. package/dist/types/sdk/bus/telegram-daemon-contract.d.ts +12 -4
  53. package/dist/types/sdk/bus/telegram-daemon.d.ts +25 -1
  54. package/dist/types/sdk/bus/telegram-reference.d.ts +11 -1
  55. package/dist/types/sdk/bus/threaded-render.d.ts +3 -2
  56. package/dist/types/sdk/bus/topic-registry.d.ts +11 -1
  57. package/dist/types/sdk/host/query/revision-store.d.ts +2 -0
  58. package/dist/types/sdk/host/reverse-leases.d.ts +1 -1
  59. package/dist/types/sdk/prompt-status.d.ts +23 -3
  60. package/dist/types/sdk/session.d.ts +6 -0
  61. package/dist/types/session/agent-session.d.ts +40 -2
  62. package/dist/types/session/artifacts.d.ts +8 -0
  63. package/dist/types/session/blob-store.d.ts +57 -4
  64. package/dist/types/session/internal/managed-session-storage.d.ts +30 -4
  65. package/dist/types/session/session-manager.d.ts +23 -6
  66. package/dist/types/session/session-storage.d.ts +4 -0
  67. package/dist/types/session/streaming-output.d.ts +36 -7
  68. package/dist/types/setup/credential-import.d.ts +12 -0
  69. package/dist/types/skill-state/active-state.d.ts +12 -0
  70. package/dist/types/skill-state/workflow-hud.d.ts +6 -0
  71. package/dist/types/task/executor.d.ts +3 -2
  72. package/dist/types/task/index.d.ts +7 -1
  73. package/dist/types/task/output-manager.d.ts +1 -0
  74. package/dist/types/task/provider-retry-status.d.ts +8 -0
  75. package/dist/types/task/receipt.d.ts +9 -1
  76. package/dist/types/task/types.d.ts +23 -0
  77. package/dist/types/tools/ask-answer-registry.d.ts +2 -2
  78. package/dist/types/tools/bash-interactive.d.ts +4 -1
  79. package/dist/types/tools/bash.d.ts +3 -1
  80. package/dist/types/tools/image-gen.d.ts +4 -0
  81. package/dist/types/tools/index.d.ts +6 -0
  82. package/dist/types/tools/output-meta.d.ts +23 -2
  83. package/dist/types/tools/path-utils.d.ts +1 -0
  84. package/dist/types/tools/read.d.ts +0 -6
  85. package/dist/types/tools/review.d.ts +5 -7
  86. package/dist/types/tools/subagent.d.ts +2 -0
  87. package/dist/types/utils/gh.d.ts +13 -0
  88. package/dist/types/utils/image-resize.d.ts +1 -0
  89. package/dist/types/web/search/providers/kimi.d.ts +2 -0
  90. package/dist/types/web/search/providers/searxng.d.ts +7 -0
  91. package/dist/types/web/search/providers/xai.d.ts +2 -0
  92. package/package.json +10 -8
  93. package/scripts/acp-conformance-agent.ts +218 -0
  94. package/scripts/capture-gjc-bundle-settings.ts +306 -0
  95. package/scripts/dogfood-ralplan-review-conflicts.ts +272 -0
  96. package/scripts/generate-sdk-operation-inventory.ts +5 -0
  97. package/scripts/resident-memory-bench.ts +1341 -0
  98. package/scripts/run-acp-conformance.ts +290 -0
  99. package/src/async/job-manager.ts +99 -39
  100. package/src/cli/fast-help.ts +1 -1
  101. package/src/cli/plugin-cli.ts +176 -18
  102. package/src/commands/team.ts +19 -1
  103. package/src/config/file-lock.ts +11 -2
  104. package/src/config/settings-schema.ts +53 -2
  105. package/src/coordinator-mcp/question-gate-codec.ts +1 -1
  106. package/src/coordinator-mcp/server.ts +5 -12
  107. package/src/debug/index.ts +42 -17
  108. package/src/defaults/gjc/skills/deep-interview/SKILL.md +1 -0
  109. package/src/defaults/gjc/skills/ralplan/SKILL.md +25 -20
  110. package/src/defaults/gjc/skills/team/SKILL.md +2 -0
  111. package/src/defaults/gjc/skills/ultragoal/SKILL.md +39 -26
  112. package/src/defaults/gjc/skills/ultragoal/validation-batch-contracts.md +12 -0
  113. package/src/defaults/gjc-defaults.ts +4 -4
  114. package/src/exa/mcp-client.ts +12 -3
  115. package/src/exec/bash-executor.ts +144 -27
  116. package/src/extensibility/extensions/runner.ts +15 -0
  117. package/src/extensibility/extensions/types.ts +18 -1
  118. package/src/extensibility/gjc-plugins/constrained-hooks.ts +8 -2
  119. package/src/extensibility/gjc-plugins/index.ts +19 -2
  120. package/src/extensibility/gjc-plugins/installer.ts +189 -50
  121. package/src/extensibility/gjc-plugins/lifecycle-reconciliation.ts +199 -0
  122. package/src/extensibility/gjc-plugins/lifecycle.ts +626 -0
  123. package/src/extensibility/gjc-plugins/observability.ts +3 -3
  124. package/src/extensibility/gjc-plugins/prompt-appendix.ts +5 -1
  125. package/src/extensibility/gjc-plugins/runtime-adapters.ts +12 -2
  126. package/src/extensibility/gjc-plugins/runtime-quarantine.ts +121 -0
  127. package/src/extensibility/gjc-plugins/schema.ts +84 -12
  128. package/src/extensibility/gjc-plugins/session-validation.ts +9 -3
  129. package/src/extensibility/gjc-plugins/types.ts +141 -0
  130. package/src/extensibility/gjc-plugins/validation.ts +9 -0
  131. package/src/gjc-runtime/launch-tmux.ts +25 -6
  132. package/src/gjc-runtime/launch-worktree.ts +103 -1
  133. package/src/gjc-runtime/ledger-event-renderer.ts +1 -0
  134. package/src/gjc-runtime/managed-owner-admission.ts +1 -1
  135. package/src/gjc-runtime/ralplan-review-conflicts.ts +472 -0
  136. package/src/gjc-runtime/ralplan-runtime.ts +491 -27
  137. package/src/gjc-runtime/team-launch.ts +8 -0
  138. package/src/gjc-runtime/team-runtime.ts +140 -32
  139. package/src/gjc-runtime/team-worker-heartbeat.ts +149 -0
  140. package/src/gjc-runtime/tmux-owner-isolation.ts +10 -0
  141. package/src/gjc-runtime/tmux-sessions.ts +58 -13
  142. package/src/gjc-runtime/ultragoal-evidence.ts +6 -74
  143. package/src/gjc-runtime/ultragoal-runtime.ts +635 -612
  144. package/src/gjc-runtime/workflow-manifest.generated.json +37 -99
  145. package/src/gjc-runtime/workflow-manifest.ts +21 -70
  146. package/src/internal-urls/docs-index.generated.ts +16 -16
  147. package/src/modes/DESIGN.md +104 -0
  148. package/src/modes/acp/acp-agent.ts +298 -186
  149. package/src/modes/components/gjc-bundle-settings.ts +508 -0
  150. package/src/modes/components/irc-sidebar.ts +30 -1
  151. package/src/modes/components/notifications-settings-editor.ts +12 -1
  152. package/src/modes/components/oauth-selector.ts +68 -30
  153. package/src/modes/components/session-observer-overlay.ts +305 -86
  154. package/src/modes/components/settings-selector.ts +56 -5
  155. package/src/modes/components/status-line/gh.ts +16 -0
  156. package/src/modes/components/tool-status-header.ts +3 -15
  157. package/src/modes/components/transcript-viewer-overlay.ts +99 -24
  158. package/src/modes/controllers/command-controller.ts +42 -34
  159. package/src/modes/controllers/event-controller.ts +27 -16
  160. package/src/modes/controllers/extension-ui-controller.ts +193 -34
  161. package/src/modes/controllers/selector-controller.ts +160 -22
  162. package/src/modes/interactive-mode.ts +189 -62
  163. package/src/modes/jobs-observer.ts +1 -1
  164. package/src/modes/runtime-init.ts +3 -0
  165. package/src/modes/theme/theme.ts +11 -9
  166. package/src/modes/types.ts +88 -0
  167. package/src/prompts/agent-fragments/ralplan-persistence.md +4 -3
  168. package/src/prompts/system/eager-todo.md +8 -4
  169. package/src/prompts/system/system-prompt.md +11 -4
  170. package/src/prompts/tools/bash.md +5 -5
  171. package/src/prompts/tools/search-tool-bm25.md +5 -0
  172. package/src/prompts/tools/task.md +1 -1
  173. package/src/reminders/star-reminder.ts +4 -42
  174. package/src/runtime-mcp/manager.ts +19 -4
  175. package/src/sdk/acp/adapter.ts +22 -6
  176. package/src/sdk/broker/lifecycle.ts +18 -13
  177. package/src/sdk/broker/transport.ts +35 -3
  178. package/src/sdk/bus/attachment-registry.ts +5 -1
  179. package/src/sdk/bus/chat-daemon-cli.ts +4 -39
  180. package/src/sdk/bus/chat-daemon-control.ts +7 -3
  181. package/src/sdk/bus/config.ts +18 -2
  182. package/src/sdk/bus/index.ts +661 -126
  183. package/src/sdk/bus/kind-aware-reconciliation.ts +148 -73
  184. package/src/sdk/bus/lifecycle-commands.ts +4 -1
  185. package/src/sdk/bus/lifecycle-control-runtime.ts +403 -88
  186. package/src/sdk/bus/reconciliation-store.ts +95 -16
  187. package/src/sdk/bus/rich-draft.ts +1 -1
  188. package/src/sdk/bus/rich-render.ts +2 -2
  189. package/src/sdk/bus/telegram-adoption-intent.ts +574 -0
  190. package/src/sdk/bus/telegram-cli.ts +33 -8
  191. package/src/sdk/bus/telegram-daemon-cli.ts +1 -0
  192. package/src/sdk/bus/telegram-daemon-contract.ts +12 -4
  193. package/src/sdk/bus/telegram-daemon.ts +916 -23
  194. package/src/sdk/bus/telegram-reference.ts +40 -3
  195. package/src/sdk/bus/threaded-render.ts +48 -3
  196. package/src/sdk/bus/topic-registry.ts +20 -0
  197. package/src/sdk/host/query/revision-store.ts +36 -2
  198. package/src/sdk/host/reverse-leases.ts +44 -7
  199. package/src/sdk/prompt-status.ts +16 -3
  200. package/src/sdk/protocol/operation-inventory.generated.json +33 -0
  201. package/src/sdk/session.ts +89 -9
  202. package/src/session/agent-session.ts +844 -173
  203. package/src/session/artifacts.ts +22 -0
  204. package/src/session/auth-broker-config.ts +10 -3
  205. package/src/session/blob-store.ts +915 -24
  206. package/src/session/internal/managed-session-scope.ts +200 -111
  207. package/src/session/internal/managed-session-storage.ts +492 -62
  208. package/src/session/session-manager.ts +1614 -435
  209. package/src/session/session-storage.ts +38 -45
  210. package/src/session/streaming-output.ts +238 -68
  211. package/src/setup/credential-import.ts +75 -13
  212. package/src/skill-state/active-state.ts +32 -0
  213. package/src/skill-state/workflow-hud.ts +17 -0
  214. package/src/skill-state/workflow-mutation-guard.ts +496 -2
  215. package/src/task/executor.ts +122 -39
  216. package/src/task/index.ts +280 -45
  217. package/src/task/output-manager.ts +24 -14
  218. package/src/task/provider-retry-status.ts +16 -0
  219. package/src/task/receipt.ts +34 -8
  220. package/src/task/render.ts +6 -2
  221. package/src/task/types.ts +108 -0
  222. package/src/tools/ask-answer-registry.ts +12 -6
  223. package/src/tools/ask.ts +86 -55
  224. package/src/tools/ast-edit.ts +1 -0
  225. package/src/tools/ast-grep.ts +1 -0
  226. package/src/tools/bash-interactive.ts +8 -3
  227. package/src/tools/bash.ts +503 -60
  228. package/src/tools/find.ts +1 -0
  229. package/src/tools/image-gen.ts +29 -5
  230. package/src/tools/index.ts +6 -0
  231. package/src/tools/output-meta.ts +108 -14
  232. package/src/tools/path-utils.ts +3 -2
  233. package/src/tools/read.ts +18 -0
  234. package/src/tools/review.ts +5 -7
  235. package/src/tools/search.ts +1 -0
  236. package/src/tools/subagent-render.ts +6 -2
  237. package/src/tools/subagent.ts +6 -0
  238. package/src/tools/telegram-send.ts +6 -3
  239. package/src/utils/gh.ts +39 -0
  240. package/src/utils/image-resize.ts +3 -0
  241. package/src/web/search/providers/anthropic.ts +4 -4
  242. package/src/web/search/providers/kimi.ts +15 -5
  243. package/src/web/search/providers/searxng.ts +47 -4
  244. package/src/web/search/providers/xai.ts +7 -2
  245. package/dist/types/gjc-runtime/ultragoal-pipeline.d.ts +0 -23
  246. package/src/defaults/gjc/skills/ultragoal/pipeline-validation-contracts.md +0 -30
  247. package/src/gjc-runtime/ultragoal-pipeline.ts +0 -306
@@ -7,16 +7,17 @@
7
7
  * {@link AuthCredential} payloads that go straight into the store.
8
8
  *
9
9
  * Sources:
10
- * - Claude Code: `~/.claude/.credentials.json` (Linux/WSL/Windows native),
11
- * the macOS Keychain (`Claude Code-credentials`), and env vars.
12
- * - Codex CLI: `~/.codex/auth.json` (OAuth `tokens` block or stored
13
- * `OPENAI_API_KEY`), and env vars.
10
+ * - Claude Code: `$CLAUDE_CONFIG_DIR/.credentials.json` (defaults to
11
+ * `~/.claude/.credentials.json`) on Linux/WSL/Windows native, the macOS
12
+ * Keychain (`Claude Code-credentials`), and env vars.
13
+ * - Codex CLI: `$CODEX_HOME/auth.json` (defaults to `~/.codex/auth.json`;
14
+ * OAuth `tokens` block or stored `OPENAI_API_KEY`), and env vars.
14
15
  */
15
16
  import * as fs from "node:fs/promises";
16
17
  import * as os from "node:os";
17
18
  import * as path from "node:path";
18
19
  import type { AuthCredential, OAuthCredential } from "@gajae-code/ai";
19
- import { isEnoent } from "@gajae-code/utils";
20
+ import { $credentialEnv, isEnoent } from "@gajae-code/utils";
20
21
  import { redactSecret } from "./provider-onboarding";
21
22
 
22
23
  /** gjc provider ids that external credentials map onto. */
@@ -79,6 +80,18 @@ export interface DiscoveryOptions {
79
80
  env?: Record<string, string | undefined>;
80
81
  /** Override the platform (defaults to `process.platform`). */
81
82
  platform?: NodeJS.Platform;
83
+ /**
84
+ * Claude Code config directory holding `.credentials.json`.
85
+ *
86
+ * Defaults to the trusted `CLAUDE_CONFIG_DIR` value, else `<homeDir>/.claude`.
87
+ */
88
+ claudeConfigDir?: string;
89
+ /**
90
+ * Codex CLI home directory holding `auth.json`.
91
+ *
92
+ * Defaults to the trusted `CODEX_HOME` value, else `<homeDir>/.codex`.
93
+ */
94
+ codexHome?: string;
82
95
  /**
83
96
  * Reader for the macOS Keychain `Claude Code-credentials` entry. Defaults to
84
97
  * shelling out to `security`; injected in tests. Returns the raw JSON string,
@@ -206,12 +219,24 @@ function parseClaudeCredentials(
206
219
  };
207
220
  }
208
221
 
222
+ /**
223
+ * A discovery root plus the leak-free label used in redacted summaries.
224
+ *
225
+ * `display` never contains a resolved filesystem path: it is either the
226
+ * home-relative default or the env-var spelling that redirected the lookup.
227
+ */
228
+ interface ResolvedExternalDir {
229
+ dir: string;
230
+ display: string;
231
+ }
232
+
209
233
  async function discoverClaudeCode(
210
- opts: Required<Pick<DiscoveryOptions, "homeDir" | "platform">> & Pick<DiscoveryOptions, "readClaudeKeychain">,
234
+ opts: Required<Pick<DiscoveryOptions, "platform">> &
235
+ Pick<DiscoveryOptions, "readClaudeKeychain"> & { configDir: ResolvedExternalDir },
211
236
  result: CredentialDiscoveryResult,
212
237
  ): Promise<void> {
213
- const filePath = path.join(opts.homeDir, ".claude", ".credentials.json");
214
- const displayPath = `~/.claude/.credentials.json`;
238
+ const filePath = path.join(opts.configDir.dir, ".credentials.json");
239
+ const displayPath = `${opts.configDir.display}/.credentials.json`;
215
240
  let fileRaw: string | null = null;
216
241
  try {
217
242
  fileRaw = await fs.readFile(filePath, "utf-8");
@@ -324,9 +349,9 @@ function parseCodexAuth(raw: string, source: string): ImportableCredential | Ski
324
349
  return { origin: "codex-file", source, reason: "no OAuth tokens or OPENAI_API_KEY present (unsupported shape)" };
325
350
  }
326
351
 
327
- async function discoverCodex(homeDir: string, result: CredentialDiscoveryResult): Promise<void> {
328
- const filePath = path.join(homeDir, ".codex", "auth.json");
329
- const displayPath = "~/.codex/auth.json";
352
+ async function discoverCodex(home: ResolvedExternalDir, result: CredentialDiscoveryResult): Promise<void> {
353
+ const filePath = path.join(home.dir, "auth.json");
354
+ const displayPath = `${home.display}/auth.json`;
330
355
  let raw: string | null = null;
331
356
  try {
332
357
  raw = await fs.readFile(filePath, "utf-8");
@@ -367,6 +392,34 @@ function pushOutcome(result: CredentialDiscoveryResult, outcome: ImportableCrede
367
392
  else result.importable.push(outcome);
368
393
  }
369
394
 
395
+ /**
396
+ * Resolve a discovery root that the external CLI itself relocates through the
397
+ * environment (`CLAUDE_CONFIG_DIR`, `CODEX_HOME`).
398
+ *
399
+ * Both variables are read through `$credentialEnv`, so the caller's project
400
+ * `.env` cannot redirect discovery at a credential file a repository ships —
401
+ * the same boundary provider authentication already uses.
402
+ *
403
+ * Relative values are rejected. Claude Code and Codex resolve them against the
404
+ * process cwd, which for gjc is the user's project directory; honouring that
405
+ * would reintroduce the project-controlled redirect the trust boundary exists
406
+ * to prevent. An explicit `options.env` (tests, embedders) is consulted verbatim
407
+ * instead of the ambient environment.
408
+ */
409
+ function resolveExternalDir(
410
+ name: "CLAUDE_CONFIG_DIR" | "CODEX_HOME",
411
+ envOverride: Record<string, string | undefined> | undefined,
412
+ fallbackDir: string,
413
+ fallbackDisplay: string,
414
+ ): ResolvedExternalDir {
415
+ const raw = envOverride ? envOverride[name] : $credentialEnv(name);
416
+ const trimmed = raw?.trim();
417
+ if (trimmed && path.isAbsolute(trimmed)) {
418
+ return { dir: trimmed, display: `$${name}` };
419
+ }
420
+ return { dir: fallbackDir, display: fallbackDisplay };
421
+ }
422
+
370
423
  /**
371
424
  * Discover Claude Code and Codex CLI credentials across files, the macOS
372
425
  * Keychain, and environment variables. Never throws for individual unreadable or
@@ -376,9 +429,18 @@ export async function discoverExternalCredentials(options: DiscoveryOptions = {}
376
429
  const homeDir = options.homeDir ?? os.homedir();
377
430
  const env = options.env ?? process.env;
378
431
  const platform = options.platform ?? process.platform;
432
+ const claudeConfigDir: ResolvedExternalDir = options.claudeConfigDir
433
+ ? { dir: options.claudeConfigDir, display: "$CLAUDE_CONFIG_DIR" }
434
+ : resolveExternalDir("CLAUDE_CONFIG_DIR", options.env, path.join(homeDir, ".claude"), "~/.claude");
435
+ const codexHome: ResolvedExternalDir = options.codexHome
436
+ ? { dir: options.codexHome, display: "$CODEX_HOME" }
437
+ : resolveExternalDir("CODEX_HOME", options.env, path.join(homeDir, ".codex"), "~/.codex");
379
438
  const result: CredentialDiscoveryResult = { importable: [], skipped: [], environment: [] };
380
- await discoverClaudeCode({ homeDir, platform, readClaudeKeychain: options.readClaudeKeychain }, result);
381
- await discoverCodex(homeDir, result);
439
+ await discoverClaudeCode(
440
+ { configDir: claudeConfigDir, platform, readClaudeKeychain: options.readClaudeKeychain },
441
+ result,
442
+ );
443
+ await discoverCodex(codexHome, result);
382
444
  discoverEnvironment(env, result);
383
445
  return result;
384
446
  }
@@ -302,6 +302,32 @@ export function isCanonicalGjcWorkflowSkill(skill: string): skill is CanonicalGj
302
302
  return (CANONICAL_GJC_WORKFLOW_SKILLS as readonly string[]).includes(skill);
303
303
  }
304
304
 
305
+ /**
306
+ * Nonterminal phases that intentionally await workflow-specific integration
307
+ * rather than a generic synthetic compaction continuation.
308
+ */
309
+ const CONTINUATION_INERT_WORKFLOW_PHASES: Readonly<Partial<Record<CanonicalGjcWorkflowSkill, ReadonlySet<string>>>> = {
310
+ team: new Set(["awaiting_integration"]),
311
+ };
312
+
313
+ /**
314
+ * Continuation inertness for compaction auto-continue, derived from each
315
+ * workflow's manifest contract: manifest-terminal and explicitly inert phases
316
+ * are inert; unknown skills or phases unknown to the skill's manifest are
317
+ * conservatively inert so a synthetic continuation never wakes an unrecognized
318
+ * workflow. Generic Ultragoal `blocked` remains continuation-active because its
319
+ * blocker may be autonomously resolvable; verified human pauses are represented
320
+ * by the inline goal's `paused` status instead.
321
+ */
322
+ export function isWorkflowContinuationInert(skill: string, phase: string): boolean {
323
+ const normalizedPhase = phase.trim().toLowerCase();
324
+ if (!isCanonicalGjcWorkflowSkill(skill)) return true;
325
+ const manifest = getSkillManifest(skill);
326
+ if (manifest.terminalStates.some(terminal => terminal.toLowerCase() === normalizedPhase)) return true;
327
+ if (CONTINUATION_INERT_WORKFLOW_PHASES[skill]?.has(normalizedPhase)) return true;
328
+ return !manifest.states.some(state => state.id.toLowerCase() === normalizedPhase);
329
+ }
330
+
305
331
  export function listActiveSkills(raw: unknown): SkillActiveEntry[] {
306
332
  if (!raw || typeof raw !== "object") return [];
307
333
  const state = raw as SkillActiveState;
@@ -615,6 +641,8 @@ async function mergeVisibleEntries(
615
641
  export type VisibleSkillActiveStateCacheTier = "security" | "hud";
616
642
  export interface ReadVisibleSkillActiveStateOptions {
617
643
  tier?: VisibleSkillActiveStateCacheTier;
644
+ /** Bypass all signature/TTL caches for authorization decisions. */
645
+ bypassCache?: boolean;
618
646
  }
619
647
 
620
648
  interface ActiveStateStatSignature {
@@ -747,6 +775,10 @@ export async function readVisibleSkillActiveState(
747
775
  }
748
776
  const resolvedCwd = path.resolve(cwd);
749
777
  const cacheKey = visibleActiveStateCacheKey(resolvedCwd, resolvedSessionId);
778
+ if (opts?.bypassCache) {
779
+ visibleSkillActiveStateCache.delete(cacheKey);
780
+ return await readVisibleSkillActiveStateUncached(resolvedCwd, resolvedSessionId);
781
+ }
750
782
  const tier = opts?.tier ?? "security";
751
783
  const now = Date.now();
752
784
  const cached = visibleSkillActiveStateCache.get(cacheKey);
@@ -29,6 +29,12 @@ interface RalplanHudState extends WorkflowGateHudState {
29
29
  verdict?: string;
30
30
  latestSummary?: string;
31
31
  pendingApproval?: boolean;
32
+ autoHandoff?: {
33
+ configuredTarget: string;
34
+ effectiveTarget: string;
35
+ degradationReason: string | null;
36
+ };
37
+ planningStuck?: boolean;
32
38
  updatedAt?: string;
33
39
  }
34
40
 
@@ -222,6 +228,16 @@ export function buildRalplanHudSummary(state: RalplanHudState): WorkflowHudSumma
222
228
  }
223
229
  return chip(label, `${passes}/${state.reviewPassBudget}`, priority);
224
230
  };
231
+ const handoffValue = state.autoHandoff
232
+ ? `${state.autoHandoff.configuredTarget}→${state.autoHandoff.effectiveTarget}${
233
+ state.autoHandoff.degradationReason ? `:${state.autoHandoff.degradationReason}` : ""
234
+ }`
235
+ : undefined;
236
+ const handoffSeverity = state.planningStuck
237
+ ? "blocked"
238
+ : state.autoHandoff?.degradationReason
239
+ ? "warning"
240
+ : undefined;
225
241
  return {
226
242
  version: 1,
227
243
  summary: state.latestSummary,
@@ -241,6 +257,7 @@ export function buildRalplanHudSummary(state: RalplanHudState): WorkflowHudSumma
241
257
  reviewPassChip("arch", state.architectPasses, 36),
242
258
  reviewPassChip("crit", state.criticPasses, 38),
243
259
  chip("verdict", verdict, 40, verdictSeverity),
260
+ chip("handoff", handoffValue, 45, handoffSeverity),
244
261
  ]),
245
262
  ...(state.updatedAt ? { updated_at: state.updatedAt } : {}),
246
263
  };