feat: codex app-server integration, token sync fix, typing fix

- Rewrite codex-runner to use `codex app-server` JSON-RPC instead of
  `codex exec`. Supports streaming (item/agentMessage/delta), session
  persistence (thread/start, thread/resume), and mid-turn message
  injection (turn/steer with IPC polling during execution).
- Fix token refresh not syncing to per-group session directories,
  causing 401 errors on running agents.
- Fix typing indicator staying on when codex returns null result
  by always clearing typing on any streaming callback.
- Update README and CLAUDE.md to reflect dual-service architecture,
  host process mode, and codex app-server integration.
This commit is contained in:
Eyejoker
2026-03-13 16:03:08 +09:00
parent 0515edc93d
commit 35277cea0a
6 changed files with 584 additions and 290 deletions

View File

@@ -52,7 +52,10 @@ import {
isSessionCommandAllowed,
} from './session-commands.js';
import { startSchedulerLoop } from './task-scheduler.js';
import { startTokenRefreshLoop, stopTokenRefreshLoop } from './token-refresh.js';
import {
startTokenRefreshLoop,
stopTokenRefreshLoop,
} from './token-refresh.js';
import { Channel, NewMessage, RegisteredGroup } from './types.js';
import { logger } from './logger.js';
@@ -257,10 +260,12 @@ async function processGroupMessages(chatJid: string): Promise<boolean> {
await channel.sendMessage(chatJid, text);
outputSentToUser = true;
}
await channel.setTyping?.(chatJid, false);
resetIdleTimer();
}
// Always clear typing and reset idle timer on any output (including null results)
await channel.setTyping?.(chatJid, false);
resetIdleTimer();
if (result.status === 'success') {
queue.notifyIdle(chatJid);
}