fix(jcode): address CodeRabbit review on #22539

- Windows posted no payload at all: the shared builder reads `payload@-` from
  stdin, which the gate has already drained and observer hooks never receive, so
  every Windows event was dropped. Write the env var to a temp file and pipe it.
- The daemon pre-warm never fired for daemon-host spawns, which is the default
  local path; it now runs there too, and from the final env so the daemon gets the
  hook port and token.
- A failed runtime-dir mkdir took down every local terminal, jcode or not.
- removeJcodeManagedHooks matched the raw line, so a user hook whose comment
  mentioned the managed script was deleted; matching on Windows never worked.
- A managed entry left by a copied home or a platform switch is now repointed
  instead of being reported as user-owned forever.
- The OSC colour skip only checked launchAgent, so a command- or telemetry-named
  jcode pane still leaked the reply into its composer.
- `['hooks']` and a commented scalar are recognised, instead of appending a
  second [hooks] table that makes jcode reject the whole config.
- A failed tool's error is marked as tool output rather than agent prose.
- The vault keeps a session's stored name, counts its tokens, and skips
  background_task and [Scheduled task] turns.

Co-authored-by: czzczz <chanzrz_zbf@foxmail.com>
This commit is contained in:
Neil
2026-10-03 01:49:40 -07:00
committed by Neil
co-authored by czzczz
parent 888e3c4003
commit a7b9358c47
12 changed files with 275 additions and 40 deletions
+12 -1
View File
@@ -39,14 +39,25 @@ export function buildJcodeRuntimeDirEnv(
* Ensures the per-pane jcode runtime dir exists before a PTY spawn (jcode fails
* fast when it is missing) and returns the env to merge into the spawn env.
* Async so the spawn hot path never blocks on a filesystem syscall.
*
* Why a failure returns undefined rather than throwing: this dir is stamped on
* EVERY local pane, not only jcode ones, so letting an EACCES on a shared
* /tmp/orca-jcode or a read-only TMPDIR propagate would stop a plain shell from
* opening. Without the dir jcode falls back to its own default daemon, which is
* the behaviour Orca had before per-pane isolation.
*/
export async function ensureJcodeRuntimeDir(
paneKey: string,
platform: NodeJS.Platform = process.platform
): Promise<Record<string, string> | undefined> {
const env = buildJcodeRuntimeDirEnv(paneKey, platform)
if (env) {
if (!env) {
return undefined
}
try {
await mkdir(env[JCODE_RUNTIME_DIR_ENV_KEY], { recursive: true })
} catch {
return undefined
}
return env
}