oh-my-codex 0.21.48 → 0.22.0
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.
- package/Cargo.lock +6 -6
- package/Cargo.toml +1 -1
- package/README.md +15 -0
- package/crates/omx-mux/src/herdr.rs +481 -0
- package/crates/omx-mux/src/lib.rs +5 -0
- package/dist/cli/__tests__/session-compare.test.d.ts +2 -0
- package/dist/cli/__tests__/session-compare.test.d.ts.map +1 -0
- package/dist/cli/__tests__/session-compare.test.js +183 -0
- package/dist/cli/__tests__/session-compare.test.js.map +1 -0
- package/dist/cli/__tests__/team.test.js +8 -0
- package/dist/cli/__tests__/team.test.js.map +1 -1
- package/dist/cli/session-compare.d.ts +11 -0
- package/dist/cli/session-compare.d.ts.map +1 -0
- package/dist/cli/session-compare.js +172 -0
- package/dist/cli/session-compare.js.map +1 -0
- package/dist/cli/session-search.d.ts.map +1 -1
- package/dist/cli/session-search.js +7 -0
- package/dist/cli/session-search.js.map +1 -1
- package/dist/cli/team.d.ts.map +1 -1
- package/dist/cli/team.js +2 -0
- package/dist/cli/team.js.map +1 -1
- package/dist/config/__tests__/multiplexer.test.d.ts +2 -0
- package/dist/config/__tests__/multiplexer.test.d.ts.map +1 -0
- package/dist/config/__tests__/multiplexer.test.js +118 -0
- package/dist/config/__tests__/multiplexer.test.js.map +1 -0
- package/dist/config/multiplexer.d.ts +29 -0
- package/dist/config/multiplexer.d.ts.map +1 -0
- package/dist/config/multiplexer.js +91 -0
- package/dist/config/multiplexer.js.map +1 -0
- package/dist/scripts/__tests__/codex-native-hook.test.js +281 -1
- package/dist/scripts/__tests__/codex-native-hook.test.js.map +1 -1
- package/dist/scripts/codex-native-hook.d.ts.map +1 -1
- package/dist/scripts/codex-native-hook.js +8 -2
- package/dist/scripts/codex-native-hook.js.map +1 -1
- package/dist/scripts/notify-hook/team-worker-lease.d.ts +15 -0
- package/dist/scripts/notify-hook/team-worker-lease.d.ts.map +1 -0
- package/dist/scripts/notify-hook/team-worker-lease.js +63 -0
- package/dist/scripts/notify-hook/team-worker-lease.js.map +1 -0
- package/dist/scripts/notify-hook/team-worker-posttooluse.d.ts +1 -0
- package/dist/scripts/notify-hook/team-worker-posttooluse.d.ts.map +1 -1
- package/dist/scripts/notify-hook/team-worker-posttooluse.js +16 -5
- package/dist/scripts/notify-hook/team-worker-posttooluse.js.map +1 -1
- package/dist/scripts/notify-hook/team-worker.d.ts +12 -1
- package/dist/scripts/notify-hook/team-worker.d.ts.map +1 -1
- package/dist/scripts/notify-hook/team-worker.js +16 -4
- package/dist/scripts/notify-hook/team-worker.js.map +1 -1
- package/dist/session-history/__tests__/compare.test.d.ts +2 -0
- package/dist/session-history/__tests__/compare.test.d.ts.map +1 -0
- package/dist/session-history/__tests__/compare.test.js +257 -0
- package/dist/session-history/__tests__/compare.test.js.map +1 -0
- package/dist/session-history/compare.d.ts +74 -0
- package/dist/session-history/compare.d.ts.map +1 -0
- package/dist/session-history/compare.js +165 -0
- package/dist/session-history/compare.js.map +1 -0
- package/dist/team/__tests__/api-interop.test.js +3 -3
- package/dist/team/__tests__/cross-rebase-smoke.test.js +263 -31
- package/dist/team/__tests__/cross-rebase-smoke.test.js.map +1 -1
- package/dist/team/__tests__/herdr-session-realherdr.test.d.ts +2 -0
- package/dist/team/__tests__/herdr-session-realherdr.test.d.ts.map +1 -0
- package/dist/team/__tests__/herdr-session-realherdr.test.js +68 -0
- package/dist/team/__tests__/herdr-session-realherdr.test.js.map +1 -0
- package/dist/team/__tests__/herdr-session.test.d.ts +2 -0
- package/dist/team/__tests__/herdr-session.test.d.ts.map +1 -0
- package/dist/team/__tests__/herdr-session.test.js +228 -0
- package/dist/team/__tests__/herdr-session.test.js.map +1 -0
- package/dist/team/__tests__/idle-nudge.test.js +84 -0
- package/dist/team/__tests__/idle-nudge.test.js.map +1 -1
- package/dist/team/__tests__/rebalance-policy.test.js +27 -9
- package/dist/team/__tests__/rebalance-policy.test.js.map +1 -1
- package/dist/team/__tests__/runtime-delivery.test.d.ts +2 -0
- package/dist/team/__tests__/runtime-delivery.test.d.ts.map +1 -0
- package/dist/team/__tests__/runtime-delivery.test.js +570 -0
- package/dist/team/__tests__/runtime-delivery.test.js.map +1 -0
- package/dist/team/__tests__/runtime.test.js +332 -18
- package/dist/team/__tests__/runtime.test.js.map +1 -1
- package/dist/team/__tests__/scaling.test.js +293 -0
- package/dist/team/__tests__/scaling.test.js.map +1 -1
- package/dist/team/__tests__/state-renewal.test.d.ts +2 -0
- package/dist/team/__tests__/state-renewal.test.d.ts.map +1 -0
- package/dist/team/__tests__/state-renewal.test.js +555 -0
- package/dist/team/__tests__/state-renewal.test.js.map +1 -0
- package/dist/team/__tests__/task-lease.test.d.ts +2 -0
- package/dist/team/__tests__/task-lease.test.d.ts.map +1 -0
- package/dist/team/__tests__/task-lease.test.js +179 -0
- package/dist/team/__tests__/task-lease.test.js.map +1 -0
- package/dist/team/__tests__/team-ops-contract.test.js +1 -0
- package/dist/team/__tests__/team-ops-contract.test.js.map +1 -1
- package/dist/team/__tests__/worker-bootstrap.test.js +2 -0
- package/dist/team/__tests__/worker-bootstrap.test.js.map +1 -1
- package/dist/team/api-interop.d.ts +1 -1
- package/dist/team/api-interop.d.ts.map +1 -1
- package/dist/team/api-interop.js +13 -1
- package/dist/team/api-interop.js.map +1 -1
- package/dist/team/goal-workflow.js +1 -1
- package/dist/team/herdr-session.d.ts +234 -0
- package/dist/team/herdr-session.d.ts.map +1 -0
- package/dist/team/herdr-session.js +489 -0
- package/dist/team/herdr-session.js.map +1 -0
- package/dist/team/idle-nudge.d.ts +16 -4
- package/dist/team/idle-nudge.d.ts.map +1 -1
- package/dist/team/idle-nudge.js +51 -19
- package/dist/team/idle-nudge.js.map +1 -1
- package/dist/team/mcp-comm.d.ts +1 -1
- package/dist/team/mcp-comm.d.ts.map +1 -1
- package/dist/team/rebalance-policy.d.ts.map +1 -1
- package/dist/team/rebalance-policy.js +5 -2
- package/dist/team/rebalance-policy.js.map +1 -1
- package/dist/team/runtime.d.ts.map +1 -1
- package/dist/team/runtime.js +356 -81
- package/dist/team/runtime.js.map +1 -1
- package/dist/team/scaling.d.ts.map +1 -1
- package/dist/team/scaling.js +332 -143
- package/dist/team/scaling.js.map +1 -1
- package/dist/team/state/monitor.d.ts +3 -0
- package/dist/team/state/monitor.d.ts.map +1 -1
- package/dist/team/state/monitor.js +3 -0
- package/dist/team/state/monitor.js.map +1 -1
- package/dist/team/state/tasks.d.ts +2 -1
- package/dist/team/state/tasks.d.ts.map +1 -1
- package/dist/team/state/tasks.js +28 -0
- package/dist/team/state/tasks.js.map +1 -1
- package/dist/team/state/types.d.ts +8 -0
- package/dist/team/state/types.d.ts.map +1 -1
- package/dist/team/state/types.js.map +1 -1
- package/dist/team/state.d.ts +14 -2
- package/dist/team/state.d.ts.map +1 -1
- package/dist/team/state.js +29 -5
- package/dist/team/state.js.map +1 -1
- package/dist/team/task-lease.d.ts +4 -0
- package/dist/team/task-lease.d.ts.map +1 -0
- package/dist/team/task-lease.js +74 -0
- package/dist/team/task-lease.js.map +1 -0
- package/dist/team/team-ops.d.ts +2 -1
- package/dist/team/team-ops.d.ts.map +1 -1
- package/dist/team/team-ops.js +1 -0
- package/dist/team/team-ops.js.map +1 -1
- package/dist/team/tmux-session.d.ts +1 -1
- package/dist/team/tmux-session.d.ts.map +1 -1
- package/dist/team/tmux-session.js +10 -2
- package/dist/team/tmux-session.js.map +1 -1
- package/dist/team/worker-bootstrap.d.ts.map +1 -1
- package/dist/team/worker-bootstrap.js +14 -1
- package/dist/team/worker-bootstrap.js.map +1 -1
- package/package.json +1 -1
- package/plugins/oh-my-codex/.codex-plugin/plugin.json +1 -1
- package/plugins/oh-my-codex/skills/worker/SKILL.md +7 -1
- package/skills/worker/SKILL.md +7 -1
- package/src/scripts/__tests__/codex-native-hook.test.ts +279 -0
- package/src/scripts/codex-native-hook.ts +8 -2
- package/src/scripts/notify-hook/team-worker-lease.ts +69 -0
- package/src/scripts/notify-hook/team-worker-posttooluse.ts +16 -4
- package/src/scripts/notify-hook/team-worker.ts +15 -4
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { renewWorkerTaskLease, reportWorkerTaskLeaseLoss } from './team-worker-lease.js';
|
|
1
2
|
import { execFile } from 'child_process';
|
|
2
3
|
import { existsSync } from 'fs';
|
|
3
4
|
import { mkdir, readFile, writeFile } from 'fs/promises';
|
|
@@ -18,6 +19,7 @@ export interface TeamWorkerPostToolUseResult {
|
|
|
18
19
|
handled: boolean;
|
|
19
20
|
status: PostToolUseStatus;
|
|
20
21
|
reason?: string;
|
|
22
|
+
stopMessage?: string;
|
|
21
23
|
teamName?: string;
|
|
22
24
|
workerName?: string;
|
|
23
25
|
stateRoot?: string;
|
|
@@ -397,9 +399,6 @@ export async function handleTeamWorkerPostToolUseSuccess(
|
|
|
397
399
|
): Promise<TeamWorkerPostToolUseResult> {
|
|
398
400
|
try {
|
|
399
401
|
if (readHookEvent(payload) !== 'PostToolUse') return { handled: false, status: 'skipped', reason: 'not_posttooluse', operationKinds: [] };
|
|
400
|
-
if (readToolName(payload) !== 'Bash') return { handled: false, status: 'skipped', reason: 'not_bash', operationKinds: [] };
|
|
401
|
-
if (readExitCode(payload) !== 0) return { handled: false, status: 'skipped', reason: 'nonzero_exit', operationKinds: [] };
|
|
402
|
-
|
|
403
402
|
const parsedWorker = parseTeamWorkerEnv(env.OMX_TEAM_INTERNAL_WORKER ?? env.OMX_TEAM_WORKER);
|
|
404
403
|
if (!parsedWorker) return { handled: false, status: 'skipped', reason: 'missing_worker_env', operationKinds: [] };
|
|
405
404
|
|
|
@@ -423,7 +422,20 @@ export async function handleTeamWorkerPostToolUseSuccess(
|
|
|
423
422
|
}
|
|
424
423
|
|
|
425
424
|
const nowIso = new Date().toISOString();
|
|
426
|
-
|
|
425
|
+
// Best-effort heartbeat telemetry must not bypass authoritative renewal.
|
|
426
|
+
await writeHeartbeat(stateRoot, teamName, workerName, nowIso).catch(() => {});
|
|
427
|
+
const renewal = await renewWorkerTaskLease(stateRoot, teamName, workerName);
|
|
428
|
+
if (renewal && 'terminalHandoff' in renewal) {
|
|
429
|
+
return { handled: true, status: 'skipped', reason: 'terminal_handoff', teamName, workerName, stateRoot, worktreePath, operationKinds: [] };
|
|
430
|
+
}
|
|
431
|
+
if (renewal && !renewal.ok) {
|
|
432
|
+
const stopMessage = await reportWorkerTaskLeaseLoss(stateRoot, teamName, workerName, renewal.error);
|
|
433
|
+
return { handled: true, status: 'skipped', reason: `lease_lost:${renewal.error}`, stopMessage, teamName, workerName, stateRoot, worktreePath, operationKinds: [] };
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
// Tool activity renews the claim; only explicit Bash success authorizes checkpointing.
|
|
437
|
+
if (readToolName(payload) !== 'Bash') return { handled: false, status: 'skipped', reason: 'not_bash', operationKinds: [] };
|
|
438
|
+
if (readExitCode(payload) !== 0) return { handled: false, status: 'skipped', reason: 'nonzero_exit', operationKinds: [] };
|
|
427
439
|
|
|
428
440
|
const config = await readTeamConfig(stateRoot, teamName);
|
|
429
441
|
const leaderArtifactCwd = readLeaderArtifactCwd(config, cwd);
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
* Team worker: heartbeat, idle detection, and leader notification.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { renewWorkerTaskLease, reportWorkerTaskLeaseLoss } from './team-worker-lease.js';
|
|
7
|
+
import { readFile, writeFile, mkdir, appendFile, rename, stat, readdir, rm } from 'fs/promises';
|
|
7
8
|
import { existsSync } from 'fs';
|
|
8
9
|
import { join } from 'path';
|
|
9
10
|
import { resolveWorkerNotifyTeamStateRootPath } from '../../team/state-root.js';
|
|
@@ -342,10 +343,20 @@ export async function updateWorkerHeartbeat(stateDir, teamName, workerName) {
|
|
|
342
343
|
turn_count: turnCount + 1,
|
|
343
344
|
alive: true,
|
|
344
345
|
};
|
|
345
|
-
//
|
|
346
|
+
// Best-effort heartbeat telemetry must not bypass authoritative renewal.
|
|
346
347
|
const tmpPath = heartbeatPath + '.tmp.' + process.pid;
|
|
347
|
-
|
|
348
|
-
|
|
348
|
+
try {
|
|
349
|
+
await writeFile(tmpPath, JSON.stringify(heartbeat, null, 2));
|
|
350
|
+
await rename(tmpPath, heartbeatPath);
|
|
351
|
+
} catch {
|
|
352
|
+
await rm(tmpPath, { force: true }).catch(() => {});
|
|
353
|
+
}
|
|
354
|
+
const renewal = await renewWorkerTaskLease(stateDir, teamName, workerName);
|
|
355
|
+
if (renewal && !renewal.ok) {
|
|
356
|
+
const stopMessage = await reportWorkerTaskLeaseLoss(stateDir, teamName, workerName, renewal.error);
|
|
357
|
+
return { ok: false, error: renewal.error, stopMessage };
|
|
358
|
+
}
|
|
359
|
+
return renewal;
|
|
349
360
|
}
|
|
350
361
|
|
|
351
362
|
export async function maybeNotifyLeaderAllWorkersIdle({ cwd, stateDir, logsDir, parsedTeamWorker }) {
|