oh-my-codex 0.19.0 → 0.20.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 +8 -1
- package/crates/omx-api/src/lib.rs +3 -3
- package/crates/omx-api/tests/cli.rs +4 -4
- package/crates/omx-explore/src/main.rs +4 -4
- package/crates/omx-sparkshell/src/codex_bridge.rs +2 -2
- package/dist/agents/__tests__/definitions.test.js +3 -3
- package/dist/agents/__tests__/definitions.test.js.map +1 -1
- package/dist/agents/__tests__/native-config.test.js +71 -42
- package/dist/agents/__tests__/native-config.test.js.map +1 -1
- package/dist/agents/definitions.d.ts +1 -1
- package/dist/agents/definitions.d.ts.map +1 -1
- package/dist/agents/definitions.js +3 -3
- package/dist/agents/definitions.js.map +1 -1
- package/dist/agents/native-config.d.ts +2 -2
- package/dist/agents/native-config.d.ts.map +1 -1
- package/dist/agents/native-config.js +7 -5
- package/dist/agents/native-config.js.map +1 -1
- package/dist/autopilot/__tests__/planner-routing.test.js +19 -12
- package/dist/autopilot/__tests__/planner-routing.test.js.map +1 -1
- package/dist/autopilot/__tests__/ralplan-gate.test.js +151 -0
- package/dist/autopilot/__tests__/ralplan-gate.test.js.map +1 -1
- package/dist/autopilot/planner-routing.d.ts.map +1 -1
- package/dist/autopilot/planner-routing.js +4 -2
- package/dist/autopilot/planner-routing.js.map +1 -1
- package/dist/autopilot/ralplan-gate.d.ts +1 -0
- package/dist/autopilot/ralplan-gate.d.ts.map +1 -1
- package/dist/autopilot/ralplan-gate.js +38 -2
- package/dist/autopilot/ralplan-gate.js.map +1 -1
- package/dist/autoresearch/runtime.d.ts +2 -0
- package/dist/autoresearch/runtime.d.ts.map +1 -1
- package/dist/autoresearch/runtime.js +8 -0
- package/dist/autoresearch/runtime.js.map +1 -1
- package/dist/capabilities/__tests__/lockfile.test.d.ts +2 -0
- package/dist/capabilities/__tests__/lockfile.test.d.ts.map +1 -0
- package/dist/capabilities/__tests__/lockfile.test.js +115 -0
- package/dist/capabilities/__tests__/lockfile.test.js.map +1 -0
- package/dist/capabilities/lockfile.d.ts +102 -0
- package/dist/capabilities/lockfile.d.ts.map +1 -0
- package/dist/capabilities/lockfile.js +334 -0
- package/dist/capabilities/lockfile.js.map +1 -0
- package/dist/cli/__tests__/agents.test.js +5 -5
- package/dist/cli/__tests__/agents.test.js.map +1 -1
- package/dist/cli/__tests__/capabilities.test.d.ts +2 -0
- package/dist/cli/__tests__/capabilities.test.d.ts.map +1 -0
- package/dist/cli/__tests__/capabilities.test.js +135 -0
- package/dist/cli/__tests__/capabilities.test.js.map +1 -0
- package/dist/cli/__tests__/codex-plugin-layout.test.js +237 -6
- package/dist/cli/__tests__/codex-plugin-layout.test.js.map +1 -1
- package/dist/cli/__tests__/doctor-context-window-warning.test.js +9 -9
- package/dist/cli/__tests__/doctor-context-window-warning.test.js.map +1 -1
- package/dist/cli/__tests__/doctor-invalid-config.test.js +1 -1
- package/dist/cli/__tests__/doctor-spark-routing.test.js +22 -6
- package/dist/cli/__tests__/doctor-spark-routing.test.js.map +1 -1
- package/dist/cli/__tests__/index.test.js +53 -18
- package/dist/cli/__tests__/index.test.js.map +1 -1
- package/dist/cli/__tests__/mission.test.d.ts +2 -0
- package/dist/cli/__tests__/mission.test.d.ts.map +1 -0
- package/dist/cli/__tests__/mission.test.js +239 -0
- package/dist/cli/__tests__/mission.test.js.map +1 -0
- package/dist/cli/__tests__/plugin-marketplace-idempotent.test.js +3 -3
- package/dist/cli/__tests__/plugin-marketplace-idempotent.test.js.map +1 -1
- package/dist/cli/__tests__/resume.test.js +95 -6
- package/dist/cli/__tests__/resume.test.js.map +1 -1
- package/dist/cli/__tests__/session-scoped-runtime.test.js +67 -0
- package/dist/cli/__tests__/session-scoped-runtime.test.js.map +1 -1
- package/dist/cli/__tests__/setup-install-mode.test.js +46 -18
- package/dist/cli/__tests__/setup-install-mode.test.js.map +1 -1
- package/dist/cli/__tests__/setup-prompts-overwrite.test.js +3 -3
- package/dist/cli/__tests__/setup-refresh.test.js +29 -7
- package/dist/cli/__tests__/setup-refresh.test.js.map +1 -1
- package/dist/cli/__tests__/ultragoal.test.js +1 -1
- package/dist/cli/__tests__/uninstall.test.js +4 -4
- package/dist/cli/__tests__/uninstall.test.js.map +1 -1
- package/dist/cli/agents.js +1 -1
- package/dist/cli/agents.js.map +1 -1
- package/dist/cli/capabilities.d.ts +3 -0
- package/dist/cli/capabilities.d.ts.map +1 -0
- package/dist/cli/capabilities.js +118 -0
- package/dist/cli/capabilities.js.map +1 -0
- package/dist/cli/doctor.d.ts +1 -1
- package/dist/cli/doctor.d.ts.map +1 -1
- package/dist/cli/doctor.js +9 -4
- package/dist/cli/doctor.js.map +1 -1
- package/dist/cli/index.d.ts +7 -4
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +107 -23
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/mission.d.ts +36 -0
- package/dist/cli/mission.d.ts.map +1 -0
- package/dist/cli/mission.js +443 -0
- package/dist/cli/mission.js.map +1 -0
- package/dist/cli/plugin-marketplace.d.ts +1 -0
- package/dist/cli/plugin-marketplace.d.ts.map +1 -1
- package/dist/cli/plugin-marketplace.js +31 -0
- package/dist/cli/plugin-marketplace.js.map +1 -1
- package/dist/cli/setup.d.ts.map +1 -1
- package/dist/cli/setup.js +7 -4
- package/dist/cli/setup.js.map +1 -1
- package/dist/config/__tests__/generator-idempotent.test.js +23 -23
- package/dist/config/__tests__/generator-idempotent.test.js.map +1 -1
- package/dist/config/__tests__/generator-notify.test.js +9 -9
- package/dist/config/__tests__/generator-notify.test.js.map +1 -1
- package/dist/config/__tests__/models.test.js +51 -26
- package/dist/config/__tests__/models.test.js.map +1 -1
- package/dist/config/generator.d.ts +1 -1
- package/dist/config/generator.d.ts.map +1 -1
- package/dist/config/models.d.ts +16 -6
- package/dist/config/models.d.ts.map +1 -1
- package/dist/config/models.js +19 -8
- package/dist/config/models.js.map +1 -1
- package/dist/hooks/__tests__/keyword-detector.test.js +12 -4
- package/dist/hooks/__tests__/keyword-detector.test.js.map +1 -1
- package/dist/hooks/__tests__/notify-hook-auto-nudge.test.js +1 -1
- package/dist/hooks/__tests__/prometheus-strict-contract.test.js +2 -2
- package/dist/hooks/__tests__/prometheus-strict-contract.test.js.map +1 -1
- package/dist/hooks/__tests__/tmux-hook-engine.test.js +2 -2
- package/dist/hud/__tests__/state.test.js +31 -6
- package/dist/hud/__tests__/state.test.js.map +1 -1
- package/dist/hud/state.d.ts.map +1 -1
- package/dist/hud/state.js +7 -3
- package/dist/hud/state.js.map +1 -1
- package/dist/leader/__tests__/contract.test.js +108 -1
- package/dist/leader/__tests__/contract.test.js.map +1 -1
- package/dist/leader/contract.d.ts +26 -0
- package/dist/leader/contract.d.ts.map +1 -1
- package/dist/leader/contract.js +170 -0
- package/dist/leader/contract.js.map +1 -1
- package/dist/mcp/__tests__/state-paths.test.js +32 -1
- package/dist/mcp/__tests__/state-paths.test.js.map +1 -1
- package/dist/mcp/state-paths.d.ts +4 -0
- package/dist/mcp/state-paths.d.ts.map +1 -1
- package/dist/mcp/state-paths.js +6 -15
- package/dist/mcp/state-paths.js.map +1 -1
- package/dist/modes/base.d.ts +1 -1
- package/dist/modes/base.d.ts.map +1 -1
- package/dist/pipeline/__tests__/stages.test.js +27 -1
- package/dist/pipeline/__tests__/stages.test.js.map +1 -1
- package/dist/pipeline/stages/ralplan.d.ts +2 -1
- package/dist/pipeline/stages/ralplan.d.ts.map +1 -1
- package/dist/pipeline/stages/ralplan.js +1 -0
- package/dist/pipeline/stages/ralplan.js.map +1 -1
- package/dist/pipeline/stages/ultragoal.d.ts +5 -1
- package/dist/pipeline/stages/ultragoal.d.ts.map +1 -1
- package/dist/pipeline/stages/ultragoal.js +14 -4
- package/dist/pipeline/stages/ultragoal.js.map +1 -1
- package/dist/ralplan/__tests__/consensus-gate.test.js +193 -0
- package/dist/ralplan/__tests__/consensus-gate.test.js.map +1 -1
- package/dist/ralplan/__tests__/runtime.test.js +132 -0
- package/dist/ralplan/__tests__/runtime.test.js.map +1 -1
- package/dist/ralplan/consensus-gate.js +24 -3
- package/dist/ralplan/consensus-gate.js.map +1 -1
- package/dist/ralplan/runtime.d.ts +17 -0
- package/dist/ralplan/runtime.d.ts.map +1 -1
- package/dist/ralplan/runtime.js +97 -1
- package/dist/ralplan/runtime.js.map +1 -1
- package/dist/scripts/__tests__/codex-native-hook.test.js +762 -20
- 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 +306 -22
- package/dist/scripts/codex-native-hook.js.map +1 -1
- package/dist/scripts/generate-catalog-docs.js +1 -0
- package/dist/scripts/generate-catalog-docs.js.map +1 -1
- package/dist/state/__tests__/operations.test.js +737 -0
- package/dist/state/__tests__/operations.test.js.map +1 -1
- package/dist/state/__tests__/skill-active.test.js +59 -0
- package/dist/state/__tests__/skill-active.test.js.map +1 -1
- package/dist/state/__tests__/workflow-transition.test.js +14 -0
- package/dist/state/__tests__/workflow-transition.test.js.map +1 -1
- package/dist/state/operations.d.ts.map +1 -1
- package/dist/state/operations.js +80 -17
- package/dist/state/operations.js.map +1 -1
- package/dist/state/skill-active.js +3 -3
- package/dist/state/skill-active.js.map +1 -1
- package/dist/state/terminal-normalization.d.ts +8 -0
- package/dist/state/terminal-normalization.d.ts.map +1 -0
- package/dist/state/terminal-normalization.js +127 -0
- package/dist/state/terminal-normalization.js.map +1 -0
- package/dist/state/workflow-transition-reconcile.d.ts.map +1 -1
- package/dist/state/workflow-transition-reconcile.js +3 -1
- package/dist/state/workflow-transition-reconcile.js.map +1 -1
- package/dist/team/__tests__/delegation-policy.test.js +2 -2
- package/dist/team/__tests__/delegation-policy.test.js.map +1 -1
- package/dist/team/__tests__/model-contract.test.js +25 -25
- package/dist/team/__tests__/model-contract.test.js.map +1 -1
- package/dist/team/__tests__/runtime.test.js +28 -28
- package/dist/team/__tests__/runtime.test.js.map +1 -1
- package/dist/team/__tests__/scaling.test.js +7 -7
- package/dist/team/__tests__/scaling.test.js.map +1 -1
- package/dist/team/__tests__/tmux-claude-workers-demo.test.js +5 -5
- package/dist/team/__tests__/tmux-claude-workers-demo.test.js.map +1 -1
- package/dist/team/__tests__/tmux-session.test.js +12 -12
- package/dist/team/__tests__/tmux-session.test.js.map +1 -1
- package/dist/team/__tests__/worker-bootstrap.test.js +57 -9
- package/dist/team/__tests__/worker-bootstrap.test.js.map +1 -1
- package/dist/team/__tests__/worker-runtime-identity.test.js +3 -3
- package/dist/team/__tests__/worker-runtime-identity.test.js.map +1 -1
- package/dist/team/model-contract.d.ts +1 -1
- package/dist/team/model-contract.d.ts.map +1 -1
- package/dist/team/runtime.d.ts.map +1 -1
- package/dist/team/runtime.js +11 -0
- package/dist/team/runtime.js.map +1 -1
- package/dist/team/worker-bootstrap.d.ts +2 -0
- package/dist/team/worker-bootstrap.d.ts.map +1 -1
- package/dist/team/worker-bootstrap.js +6 -1
- package/dist/team/worker-bootstrap.js.map +1 -1
- package/dist/ultragoal/__tests__/artifacts.test.js +82 -5
- package/dist/ultragoal/__tests__/artifacts.test.js.map +1 -1
- package/dist/ultragoal/artifacts.d.ts +5 -1
- package/dist/ultragoal/artifacts.d.ts.map +1 -1
- package/dist/ultragoal/artifacts.js +111 -14
- package/dist/ultragoal/artifacts.js.map +1 -1
- package/dist/utils/__tests__/agents-model-table.test.js +7 -7
- package/dist/utils/__tests__/agents-model-table.test.js.map +1 -1
- package/dist/utils/__tests__/worktree-tool-context.test.d.ts +2 -0
- package/dist/utils/__tests__/worktree-tool-context.test.d.ts.map +1 -0
- package/dist/utils/__tests__/worktree-tool-context.test.js +118 -0
- package/dist/utils/__tests__/worktree-tool-context.test.js.map +1 -0
- package/dist/utils/worktree-tool-context.d.ts +25 -0
- package/dist/utils/worktree-tool-context.d.ts.map +1 -0
- package/dist/utils/worktree-tool-context.js +116 -0
- package/dist/utils/worktree-tool-context.js.map +1 -0
- package/package.json +1 -1
- package/plugins/oh-my-codex/.codex-plugin/plugin.json +1 -1
- package/plugins/oh-my-codex/hooks/codex-native-hook.mjs +96 -10
- package/plugins/oh-my-codex/skills/ai-slop-cleaner/SKILL.md +1 -1
- package/plugins/oh-my-codex/skills/code-review/SKILL.md +1 -1
- package/plugins/oh-my-codex/skills/omx-setup/SKILL.md +5 -5
- package/plugins/oh-my-codex/skills/prometheus-strict/SKILL.md +3 -3
- package/plugins/oh-my-codex/skills/ralplan/SKILL.md +1 -1
- package/plugins/oh-my-codex/skills/team/SKILL.md +1 -1
- package/plugins/oh-my-codex/skills/ultrawork/references/agent-tiers.md +2 -2
- package/prompts/prometheus-strict-metis.md +1 -1
- package/skills/ai-slop-cleaner/SKILL.md +1 -1
- package/skills/code-review/SKILL.md +1 -1
- package/skills/ecomode/references/agent-tiers.md +1 -1
- package/skills/omx-setup/SKILL.md +5 -5
- package/skills/prometheus-strict/SKILL.md +3 -3
- package/skills/ralplan/SKILL.md +1 -1
- package/skills/team/SKILL.md +1 -1
- package/skills/ultrawork/references/agent-tiers.md +2 -2
- package/src/scripts/__tests__/codex-native-hook.test.ts +824 -7
- package/src/scripts/codex-native-hook.ts +347 -20
- package/src/scripts/generate-catalog-docs.ts +1 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { describe, it } from 'node:test';
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
import { execFileSync } from 'node:child_process';
|
|
4
|
+
import { mkdir, mkdtemp, rm, writeFile } from 'node:fs/promises';
|
|
5
|
+
import { basename, join } from 'node:path';
|
|
6
|
+
import { tmpdir } from 'node:os';
|
|
7
|
+
import { renderCodeGraphInstructions, resolveWorktreeToolContext, worktreeToolContextEnv, } from '../worktree-tool-context.js';
|
|
8
|
+
async function initRepo() {
|
|
9
|
+
const cwd = await mkdtemp(join(tmpdir(), 'omx-codegraph-context-'));
|
|
10
|
+
execFileSync('git', ['init'], { cwd, stdio: 'ignore' });
|
|
11
|
+
execFileSync('git', ['config', 'user.email', 'test@example.com'], { cwd, stdio: 'ignore' });
|
|
12
|
+
execFileSync('git', ['config', 'user.name', 'Test User'], { cwd, stdio: 'ignore' });
|
|
13
|
+
await writeFile(join(cwd, 'README.md'), 'hello\n', 'utf-8');
|
|
14
|
+
execFileSync('git', ['add', 'README.md'], { cwd, stdio: 'ignore' });
|
|
15
|
+
execFileSync('git', ['commit', '-m', 'init'], { cwd, stdio: 'ignore' });
|
|
16
|
+
return cwd;
|
|
17
|
+
}
|
|
18
|
+
async function writeCodeGraphDb(projectPath) {
|
|
19
|
+
await mkdir(join(projectPath, '.codegraph'), { recursive: true });
|
|
20
|
+
await writeFile(join(projectPath, '.codegraph', 'codegraph.db'), 'fixture\n', 'utf-8');
|
|
21
|
+
}
|
|
22
|
+
function addWorktree(repo, path, branch) {
|
|
23
|
+
execFileSync('git', ['worktree', 'add', '-b', branch, path, 'HEAD'], { cwd: repo, stdio: 'ignore' });
|
|
24
|
+
}
|
|
25
|
+
function siblingWorktreePath(repo, name) {
|
|
26
|
+
return join(repo, '..', `${basename(repo)}-${name}`);
|
|
27
|
+
}
|
|
28
|
+
describe('resolveWorktreeToolContext', () => {
|
|
29
|
+
it('uses sibling launch worktree with shared leader CodeGraph in auto mode', async () => {
|
|
30
|
+
const repo = await initRepo();
|
|
31
|
+
try {
|
|
32
|
+
await writeCodeGraphDb(repo);
|
|
33
|
+
const worktree = siblingWorktreePath(repo, 'sibling-launch');
|
|
34
|
+
addWorktree(repo, worktree, 'feat/sibling-launch');
|
|
35
|
+
const context = resolveWorktreeToolContext({ cwd: worktree, scope: 'launch', repoRoot: repo, worktreeRoot: worktree, env: {} });
|
|
36
|
+
assert.equal(context.repoRoot, repo);
|
|
37
|
+
assert.equal(context.worktreeRoot, worktree);
|
|
38
|
+
assert.equal(context.codeGraphMode, 'shared');
|
|
39
|
+
assert.equal(context.codeGraphProjectPath, repo);
|
|
40
|
+
assert.equal(worktreeToolContextEnv(context).OMX_WORKTREE_SCOPE, 'launch');
|
|
41
|
+
assert.match(renderCodeGraphInstructions(context), /shared leader index/);
|
|
42
|
+
assert.match(renderCodeGraphInstructions(context), /not branch-accurate for worktree-only changes/);
|
|
43
|
+
}
|
|
44
|
+
finally {
|
|
45
|
+
await rm(repo, { recursive: true, force: true });
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
it('uses nested team leader CodeGraph as shared context', async () => {
|
|
49
|
+
const repo = await initRepo();
|
|
50
|
+
try {
|
|
51
|
+
const leaderWorktree = join(repo, '.omx', 'team', 'parent', 'worktrees', 'worker-1');
|
|
52
|
+
addWorktree(repo, leaderWorktree, 'parent/worker-1');
|
|
53
|
+
await writeCodeGraphDb(leaderWorktree);
|
|
54
|
+
const nestedWorker = join(repo, '.omx', 'team', 'nested', 'worktrees', 'worker-1');
|
|
55
|
+
addWorktree(repo, nestedWorker, 'nested/worker-1');
|
|
56
|
+
const context = resolveWorktreeToolContext({
|
|
57
|
+
cwd: nestedWorker,
|
|
58
|
+
scope: 'team',
|
|
59
|
+
repoRoot: leaderWorktree,
|
|
60
|
+
worktreeRoot: nestedWorker,
|
|
61
|
+
env: {},
|
|
62
|
+
});
|
|
63
|
+
assert.equal(context.codeGraphMode, 'shared');
|
|
64
|
+
assert.equal(context.codeGraphProjectPath, leaderWorktree);
|
|
65
|
+
assert.equal(worktreeToolContextEnv(context).OMX_REPO_ROOT, leaderWorktree);
|
|
66
|
+
}
|
|
67
|
+
finally {
|
|
68
|
+
await rm(repo, { recursive: true, force: true });
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
it('prefers worktree-local CodeGraph over shared leader CodeGraph', async () => {
|
|
72
|
+
const repo = await initRepo();
|
|
73
|
+
try {
|
|
74
|
+
await writeCodeGraphDb(repo);
|
|
75
|
+
const worktree = siblingWorktreePath(repo, 'local-precedence');
|
|
76
|
+
addWorktree(repo, worktree, 'feat/local-precedence');
|
|
77
|
+
await writeCodeGraphDb(worktree);
|
|
78
|
+
const context = resolveWorktreeToolContext({ cwd: worktree, scope: 'team', repoRoot: repo, worktreeRoot: worktree, env: {} });
|
|
79
|
+
assert.equal(context.codeGraphMode, 'local');
|
|
80
|
+
assert.equal(context.codeGraphProjectPath, worktree);
|
|
81
|
+
assert.doesNotMatch(renderCodeGraphInstructions(context), /not branch-accurate/);
|
|
82
|
+
}
|
|
83
|
+
finally {
|
|
84
|
+
await rm(repo, { recursive: true, force: true });
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
it('turns auto mode off when no CodeGraph database exists', async () => {
|
|
88
|
+
const repo = await initRepo();
|
|
89
|
+
try {
|
|
90
|
+
const worktree = siblingWorktreePath(repo, 'no-codegraph');
|
|
91
|
+
addWorktree(repo, worktree, 'feat/no-codegraph');
|
|
92
|
+
const context = resolveWorktreeToolContext({ cwd: worktree, scope: 'launch', repoRoot: repo, worktreeRoot: worktree, env: {} });
|
|
93
|
+
assert.equal(context.codeGraphMode, 'off');
|
|
94
|
+
assert.equal(context.codeGraphProjectPath, '');
|
|
95
|
+
assert.equal(renderCodeGraphInstructions(context), '');
|
|
96
|
+
}
|
|
97
|
+
finally {
|
|
98
|
+
await rm(repo, { recursive: true, force: true });
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
it('honors explicit shared local auto and off modes', async () => {
|
|
102
|
+
const repo = await initRepo();
|
|
103
|
+
try {
|
|
104
|
+
await writeCodeGraphDb(repo);
|
|
105
|
+
const worktree = siblingWorktreePath(repo, 'explicit-modes');
|
|
106
|
+
addWorktree(repo, worktree, 'feat/explicit-modes');
|
|
107
|
+
assert.equal(resolveWorktreeToolContext({ cwd: worktree, scope: 'launch', repoRoot: repo, worktreeRoot: worktree, env: { OMX_CODEGRAPH_MODE: 'shared' } }).codeGraphMode, 'shared');
|
|
108
|
+
assert.equal(resolveWorktreeToolContext({ cwd: worktree, scope: 'launch', repoRoot: repo, worktreeRoot: worktree, env: { OMX_CODEGRAPH_MODE: 'local' } }).codeGraphMode, 'local');
|
|
109
|
+
assert.equal(resolveWorktreeToolContext({ cwd: worktree, scope: 'launch', repoRoot: repo, worktreeRoot: worktree, env: { OMX_CODEGRAPH_MODE: 'auto' } }).codeGraphMode, 'shared');
|
|
110
|
+
assert.equal(resolveWorktreeToolContext({ cwd: worktree, scope: 'launch', repoRoot: repo, worktreeRoot: worktree, env: { OMX_CODEGRAPH_MODE: 'off' } }).codeGraphMode, 'off');
|
|
111
|
+
assert.equal(resolveWorktreeToolContext({ cwd: worktree, scope: 'launch', repoRoot: repo, worktreeRoot: worktree, env: { OMX_CODEGRAPH_MODE: 'shared', OMX_CODEGRAPH_REQUESTED_MODE: 'auto' } }).codeGraphMode, 'shared');
|
|
112
|
+
}
|
|
113
|
+
finally {
|
|
114
|
+
await rm(repo, { recursive: true, force: true });
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
//# sourceMappingURL=worktree-tool-context.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worktree-tool-context.test.js","sourceRoot":"","sources":["../../../src/utils/__tests__/worktree-tool-context.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EACL,2BAA2B,EAC3B,0BAA0B,EAC1B,sBAAsB,GACvB,MAAM,6BAA6B,CAAC;AAErC,KAAK,UAAU,QAAQ;IACrB,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,wBAAwB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 'autoresearch' | 'repo';
|
|
2
|
+
export type RequestedCodeGraphMode = 'auto' | 'shared' | 'local' | 'off';
|
|
3
|
+
export type ResolvedCodeGraphMode = 'shared' | 'local' | 'off';
|
|
4
|
+
export interface WorktreeToolContext {
|
|
5
|
+
repoRoot: string;
|
|
6
|
+
worktreeRoot: string;
|
|
7
|
+
gitCommonDir: string;
|
|
8
|
+
worktreeScope: WorktreeToolScope;
|
|
9
|
+
codeGraphMode: ResolvedCodeGraphMode;
|
|
10
|
+
codeGraphProjectPath: string;
|
|
11
|
+
codeGraphDbPath: string;
|
|
12
|
+
codeGraphSource: 'worktree-local' | 'leader-shared' | 'none';
|
|
13
|
+
requestedCodeGraphMode: RequestedCodeGraphMode;
|
|
14
|
+
}
|
|
15
|
+
export interface ResolveWorktreeToolContextOptions {
|
|
16
|
+
cwd: string;
|
|
17
|
+
scope: WorktreeToolScope;
|
|
18
|
+
repoRoot?: string | null;
|
|
19
|
+
worktreeRoot?: string | null;
|
|
20
|
+
env?: NodeJS.ProcessEnv;
|
|
21
|
+
}
|
|
22
|
+
export declare function resolveWorktreeToolContext(options: ResolveWorktreeToolContextOptions): WorktreeToolContext;
|
|
23
|
+
export declare function worktreeToolContextEnv(context: WorktreeToolContext): Record<string, string>;
|
|
24
|
+
export declare function renderCodeGraphInstructions(context: WorktreeToolContext): string;
|
|
25
|
+
//# sourceMappingURL=worktree-tool-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worktree-tool-context.d.ts","sourceRoot":"","sources":["../../src/utils/worktree-tool-context.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,MAAM,GAAG,cAAc,GAAG,MAAM,CAAC;AAC5E,MAAM,MAAM,sBAAsB,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,KAAK,CAAC;AACzE,MAAM,MAAM,qBAAqB,GAAG,QAAQ,GAAG,OAAO,GAAG,KAAK,CAAC;AAE/D,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,iBAAiB,CAAC;IACjC,aAAa,EAAE,qBAAqB,CAAC;IACrC,oBAAoB,EAAE,MAAM,CAAC;IAC7B,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,gBAAgB,GAAG,eAAe,GAAG,MAAM,CAAC;IAC7D,sBAAsB,EAAE,sBAAsB,CAAC;CAChD;AAED,MAAM,WAAW,iCAAiC;IAChD,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,iBAAiB,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;CACzB;AAmCD,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,iCAAiC,GAAG,mBAAmB,CAmD1G;AAED,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,mBAAmB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAU3F;AAED,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,mBAAmB,GAAG,MAAM,CAgBhF"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { spawnSync } from 'node:child_process';
|
|
2
|
+
import { existsSync } from 'node:fs';
|
|
3
|
+
import { join, resolve } from 'node:path';
|
|
4
|
+
function readGit(cwd, args) {
|
|
5
|
+
const result = spawnSync('git', args, {
|
|
6
|
+
cwd,
|
|
7
|
+
encoding: 'utf-8',
|
|
8
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
9
|
+
windowsHide: true,
|
|
10
|
+
});
|
|
11
|
+
if (result.status !== 0)
|
|
12
|
+
return null;
|
|
13
|
+
const value = (result.stdout || '').trim();
|
|
14
|
+
return value || null;
|
|
15
|
+
}
|
|
16
|
+
function resolveGitRoot(cwd) {
|
|
17
|
+
const value = readGit(cwd, ['rev-parse', '--show-toplevel']);
|
|
18
|
+
return value ? resolve(value) : null;
|
|
19
|
+
}
|
|
20
|
+
function resolveGitCommonDir(cwd, fallbackRoot) {
|
|
21
|
+
const value = readGit(cwd, ['rev-parse', '--git-common-dir']);
|
|
22
|
+
return value ? resolve(cwd, value) : join(fallbackRoot, '.git');
|
|
23
|
+
}
|
|
24
|
+
function normalizeRequestedCodeGraphMode(env) {
|
|
25
|
+
const raw = String(env.OMX_CODEGRAPH_REQUESTED_MODE ?? env.OMX_CODEGRAPH_MODE ?? 'auto').trim().toLowerCase();
|
|
26
|
+
if (raw === '' || raw === 'auto')
|
|
27
|
+
return 'auto';
|
|
28
|
+
if (raw === 'shared' || raw === 'local' || raw === 'off')
|
|
29
|
+
return raw;
|
|
30
|
+
return 'auto';
|
|
31
|
+
}
|
|
32
|
+
function resolveCodeGraphDbPath(projectPath) {
|
|
33
|
+
return join(projectPath, '.codegraph', 'codegraph.db');
|
|
34
|
+
}
|
|
35
|
+
export function resolveWorktreeToolContext(options) {
|
|
36
|
+
const env = options.env ?? process.env;
|
|
37
|
+
const worktreeRoot = resolve(options.worktreeRoot?.trim() || resolveGitRoot(options.cwd) || options.cwd);
|
|
38
|
+
const repoRoot = resolve(options.repoRoot?.trim() || resolveGitRoot(options.cwd) || worktreeRoot);
|
|
39
|
+
const gitCommonDir = resolveGitCommonDir(worktreeRoot, repoRoot);
|
|
40
|
+
const requestedCodeGraphMode = normalizeRequestedCodeGraphMode(env);
|
|
41
|
+
const localDbPath = resolveCodeGraphDbPath(worktreeRoot);
|
|
42
|
+
const sharedDbPath = resolveCodeGraphDbPath(repoRoot);
|
|
43
|
+
const hasLocalDb = existsSync(localDbPath);
|
|
44
|
+
const hasSharedDb = existsSync(sharedDbPath);
|
|
45
|
+
let codeGraphMode = 'off';
|
|
46
|
+
let codeGraphProjectPath = '';
|
|
47
|
+
let codeGraphDbPath = '';
|
|
48
|
+
let codeGraphSource = 'none';
|
|
49
|
+
if (requestedCodeGraphMode === 'local') {
|
|
50
|
+
codeGraphMode = 'local';
|
|
51
|
+
codeGraphProjectPath = worktreeRoot;
|
|
52
|
+
codeGraphDbPath = localDbPath;
|
|
53
|
+
codeGraphSource = 'worktree-local';
|
|
54
|
+
}
|
|
55
|
+
else if (requestedCodeGraphMode === 'shared') {
|
|
56
|
+
codeGraphMode = 'shared';
|
|
57
|
+
codeGraphProjectPath = repoRoot;
|
|
58
|
+
codeGraphDbPath = sharedDbPath;
|
|
59
|
+
codeGraphSource = 'leader-shared';
|
|
60
|
+
}
|
|
61
|
+
else if (requestedCodeGraphMode === 'auto') {
|
|
62
|
+
if (hasLocalDb) {
|
|
63
|
+
codeGraphMode = 'local';
|
|
64
|
+
codeGraphProjectPath = worktreeRoot;
|
|
65
|
+
codeGraphDbPath = localDbPath;
|
|
66
|
+
codeGraphSource = 'worktree-local';
|
|
67
|
+
}
|
|
68
|
+
else if (hasSharedDb) {
|
|
69
|
+
codeGraphMode = 'shared';
|
|
70
|
+
codeGraphProjectPath = repoRoot;
|
|
71
|
+
codeGraphDbPath = sharedDbPath;
|
|
72
|
+
codeGraphSource = 'leader-shared';
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return {
|
|
76
|
+
repoRoot,
|
|
77
|
+
worktreeRoot,
|
|
78
|
+
gitCommonDir,
|
|
79
|
+
worktreeScope: options.scope,
|
|
80
|
+
codeGraphMode,
|
|
81
|
+
codeGraphProjectPath,
|
|
82
|
+
codeGraphDbPath,
|
|
83
|
+
codeGraphSource,
|
|
84
|
+
requestedCodeGraphMode,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
export function worktreeToolContextEnv(context) {
|
|
88
|
+
return {
|
|
89
|
+
OMX_REPO_ROOT: context.repoRoot,
|
|
90
|
+
OMX_WORKTREE_ROOT: context.worktreeRoot,
|
|
91
|
+
OMX_GIT_COMMON_DIR: context.gitCommonDir,
|
|
92
|
+
OMX_WORKTREE_SCOPE: context.worktreeScope,
|
|
93
|
+
OMX_CODEGRAPH_MODE: context.codeGraphMode,
|
|
94
|
+
OMX_CODEGRAPH_PROJECT_PATH: context.codeGraphProjectPath,
|
|
95
|
+
OMX_CODEGRAPH_REQUESTED_MODE: context.requestedCodeGraphMode,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
export function renderCodeGraphInstructions(context) {
|
|
99
|
+
if (context.codeGraphMode === 'off')
|
|
100
|
+
return '';
|
|
101
|
+
const modeLine = context.codeGraphMode === 'local'
|
|
102
|
+
? `- Mode: local worktree index (${context.codeGraphProjectPath})`
|
|
103
|
+
: `- Mode: shared leader index (${context.codeGraphProjectPath})`;
|
|
104
|
+
const warning = context.codeGraphMode === 'shared'
|
|
105
|
+
? '\n- Warning: the shared leader CodeGraph index is not branch-accurate for worktree-only changes; verify changed files directly in this worktree.'
|
|
106
|
+
: '';
|
|
107
|
+
return [
|
|
108
|
+
'## CodeGraph',
|
|
109
|
+
modeLine,
|
|
110
|
+
`- Project path: ${context.codeGraphProjectPath}`,
|
|
111
|
+
`- Database: ${context.codeGraphDbPath || '(not found yet)'}`,
|
|
112
|
+
'- OMX does not install CodeGraph, auto-index worktrees, or copy/symlink `.codegraph` for this run.',
|
|
113
|
+
warning.trim(),
|
|
114
|
+
].filter(Boolean).join('\n');
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=worktree-tool-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worktree-tool-context.js","sourceRoot":"","sources":["../../src/utils/worktree-tool-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA0B1C,SAAS,OAAO,CAAC,GAAW,EAAE,IAAc;IAC1C,MAAM,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IAC/C,MAAM,QAAQ,GAAG,OAAO,CAAC,aAAa,KAAK,OAAO;QAChD,CAAC,CAAC,iCAAiC,OAAO,CAAC,oBAAoB,GAAG;QAClE,CAAC,CAAC,gCAAgC,OAAO,CAAC,oBAAoB,GAAG,CAAC;IACpE,MAAM,OAAO,GAAG,OAAO,CAAC,aAAa,KAAK,QAAQ;QAChD,CAAC,CAAC,kJAAkJ;QACpJ,CAAC,CAAC,EAAE,CAAC;IACP,OAAO;QACL,cAAc;QACd,QAAQ;QACR,mBAAmB,OAAO,CAAC,oBAAoB,EAAE;QACjD,eAAe,OAAO,CAAC,eAAe,IAAI,iBAAiB,EAAE;QAC7D,oGAAoG;QACpG,OAAO,CAAC,IAAI,EAAE;KACf,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC/B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { spawn } from 'node:child_process';
|
|
3
3
|
import { extname } from 'node:path';
|
|
4
|
-
import { existsSync, readFileSync, realpathSync } from 'node:fs';
|
|
4
|
+
import { existsSync, mkdirSync, readFileSync, realpathSync, writeFileSync } from 'node:fs';
|
|
5
5
|
import { dirname, join, resolve } from 'node:path';
|
|
6
6
|
import { fileURLToPath } from 'node:url';
|
|
7
7
|
|
|
@@ -131,20 +131,82 @@ function detectCompactHookInput(input) {
|
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
-
|
|
134
|
+
function parseHookPayload(input) {
|
|
135
|
+
try {
|
|
136
|
+
const parsed = JSON.parse(input.toString('utf8'));
|
|
137
|
+
return parsed && typeof parsed === 'object' && !Array.isArray(parsed) ? parsed : {};
|
|
138
|
+
} catch {
|
|
139
|
+
return {};
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function sanitizeLaunchId(value) {
|
|
144
|
+
return String(value ?? '').trim().replace(/[^a-zA-Z0-9._-]/g, '_').slice(0, 128);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function resolveLaunchClaimPath(payload, launchId) {
|
|
148
|
+
const cwd = typeof payload.cwd === 'string' && payload.cwd.trim() ? payload.cwd : process.cwd();
|
|
149
|
+
const stateRoot = typeof process.env.OMX_ROOT === 'string' && process.env.OMX_ROOT.trim()
|
|
150
|
+
? process.env.OMX_ROOT.trim()
|
|
151
|
+
: join(cwd, '.omx');
|
|
152
|
+
return join(stateRoot, 'state', 'plugin-hook-launches', `${sanitizeLaunchId(launchId)}.json`);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
function hookPayloadSessionId(input, payload) {
|
|
156
|
+
const parsedSessionId = typeof payload.session_id === 'string' ? payload.session_id.trim() : '';
|
|
157
|
+
if (parsedSessionId) return parsedSessionId;
|
|
158
|
+
return extractTopLevelStringField(input.toString('utf8'), ['session_id', 'sessionId'])?.trim() ?? '';
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
function isOmxLauncherSession(input, payload) {
|
|
162
|
+
const launchId = process.env.OMX_CODEX_LAUNCH_ID?.trim();
|
|
163
|
+
const entryPath = process.env.OMX_ENTRY_PATH?.trim();
|
|
164
|
+
const sessionId = hookPayloadSessionId(input, payload);
|
|
165
|
+
if (!launchId || !entryPath || !sessionId) return false;
|
|
166
|
+
|
|
167
|
+
const claimPath = resolveLaunchClaimPath(payload, launchId);
|
|
168
|
+
|
|
169
|
+
try {
|
|
170
|
+
if (existsSync(claimPath)) {
|
|
171
|
+
const claimed = JSON.parse(readFileSync(claimPath, 'utf8'));
|
|
172
|
+
return claimed?.sessionId === sessionId;
|
|
173
|
+
}
|
|
174
|
+
mkdirSync(dirname(claimPath), { recursive: true });
|
|
175
|
+
writeFileSync(claimPath, `${JSON.stringify({ sessionId })}\n`, { encoding: 'utf8', mode: 0o600 });
|
|
176
|
+
return true;
|
|
177
|
+
} catch {
|
|
178
|
+
return false;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
function writePlainCodexNoop(isStop) {
|
|
183
|
+
if (isStop) process.stdout.write('{}\n');
|
|
184
|
+
process.exitCode = 0;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
async function readBoundedStdin({ drainOversized = false } = {}) {
|
|
135
188
|
const chunks = [];
|
|
136
189
|
let totalBytes = 0;
|
|
190
|
+
let storedBytes = 0;
|
|
191
|
+
let oversized = false;
|
|
137
192
|
for await (const rawChunk of process.stdin) {
|
|
138
193
|
const chunk = Buffer.isBuffer(rawChunk) ? rawChunk : Buffer.from(rawChunk);
|
|
139
194
|
totalBytes += chunk.length;
|
|
140
|
-
|
|
141
|
-
|
|
195
|
+
|
|
196
|
+
if (oversized) continue;
|
|
197
|
+
|
|
198
|
+
const remaining = MAX_WRAPPER_STDIN_BYTES - storedBytes;
|
|
199
|
+
if (chunk.length > remaining) {
|
|
142
200
|
if (remaining > 0) chunks.push(chunk.subarray(0, remaining));
|
|
143
|
-
|
|
201
|
+
storedBytes += Math.max(remaining, 0);
|
|
202
|
+
oversized = true;
|
|
203
|
+
if (!drainOversized) return { input: Buffer.concat(chunks), oversized: true, totalBytes };
|
|
204
|
+
continue;
|
|
144
205
|
}
|
|
145
206
|
chunks.push(chunk);
|
|
207
|
+
storedBytes += chunk.length;
|
|
146
208
|
}
|
|
147
|
-
return { input: Buffer.concat(chunks), oversized
|
|
209
|
+
return { input: Buffer.concat(chunks), oversized, totalBytes };
|
|
148
210
|
}
|
|
149
211
|
|
|
150
212
|
function stopFallbackOutput(stopReason, detail) {
|
|
@@ -326,9 +388,7 @@ function hasActiveAutopilotStateForOversizedStop(input) {
|
|
|
326
388
|
}
|
|
327
389
|
|
|
328
390
|
|
|
329
|
-
function
|
|
330
|
-
const text = String(raw ?? '').trim();
|
|
331
|
-
if (!text) return null;
|
|
391
|
+
function parseJsonObjectCandidate(text) {
|
|
332
392
|
try {
|
|
333
393
|
const parsed = JSON.parse(text);
|
|
334
394
|
if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) return null;
|
|
@@ -338,11 +398,37 @@ function parseSingleJsonObjectOutput(raw) {
|
|
|
338
398
|
}
|
|
339
399
|
}
|
|
340
400
|
|
|
401
|
+
function isJsonObjectFragmentLine(text) {
|
|
402
|
+
return text.startsWith('{') || text.endsWith('}') || /^"[^"]+"\s*:/.test(text);
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
function parseSingleJsonObjectOutput(raw) {
|
|
406
|
+
const text = String(raw ?? '').trim();
|
|
407
|
+
if (!text) return null;
|
|
408
|
+
const direct = parseJsonObjectCandidate(text);
|
|
409
|
+
if (direct) return direct;
|
|
410
|
+
|
|
411
|
+
const lines = text.split(/\r?\n/).map((line) => line.trim()).filter(Boolean);
|
|
412
|
+
const lastLine = lines.at(-1);
|
|
413
|
+
if (!lastLine || !lastLine.startsWith('{') || !lastLine.endsWith('}')) return null;
|
|
414
|
+
for (const line of lines.slice(0, -1)) {
|
|
415
|
+
if (parseJsonObjectCandidate(line) || isJsonObjectFragmentLine(line)) return null;
|
|
416
|
+
}
|
|
417
|
+
return parseJsonObjectCandidate(lastLine);
|
|
418
|
+
}
|
|
419
|
+
|
|
341
420
|
async function main() {
|
|
342
|
-
const { input, oversized, totalBytes } = await readBoundedStdin();
|
|
421
|
+
const { input, oversized, totalBytes } = await readBoundedStdin({ drainOversized: true });
|
|
422
|
+
const payload = parseHookPayload(input);
|
|
423
|
+
const launchedByOmx = isOmxLauncherSession(input, payload);
|
|
343
424
|
const isStop = detectStopHookInput(input);
|
|
344
425
|
const isCompact = detectCompactHookInput(input);
|
|
345
426
|
|
|
427
|
+
if (!launchedByOmx) {
|
|
428
|
+
writePlainCodexNoop(isStop);
|
|
429
|
+
return;
|
|
430
|
+
}
|
|
431
|
+
|
|
346
432
|
if (oversized) {
|
|
347
433
|
const message = `plugin hook stdin exceeded ${MAX_WRAPPER_STDIN_BYTES} bytes before launcher delegation; totalBytes>${totalBytes}`;
|
|
348
434
|
if (isStop) {
|
|
@@ -15,7 +15,7 @@ Use this skill when:
|
|
|
15
15
|
- Follow-up implementation left duplicate code, dead code, weak boundaries, missing tests, fallback-like code, or unnecessary wrapper layers
|
|
16
16
|
- You need a disciplined cleanup workflow without broad rewrites
|
|
17
17
|
|
|
18
|
-
## GPT-5.
|
|
18
|
+
## GPT-5.6 Guidance Alignment
|
|
19
19
|
|
|
20
20
|
- Keep outputs concise and evidence-dense unless risk or the user requests more detail.
|
|
21
21
|
- Treat newer user instructions as local workflow updates without discarding earlier non-conflicting constraints.
|
|
@@ -15,7 +15,7 @@ This skill activates when:
|
|
|
15
15
|
- After implementing a major feature
|
|
16
16
|
- User wants quality assessment
|
|
17
17
|
|
|
18
|
-
## GPT-5.
|
|
18
|
+
## GPT-5.6 Guidance Alignment
|
|
19
19
|
|
|
20
20
|
- Default to outcome-first progress and completion reporting: state the target result, evidence, validation status, and stop condition before adding process detail.
|
|
21
21
|
- Treat newer user task updates as local overrides for the active workflow branch while preserving earlier non-conflicting constraints.
|
|
@@ -35,11 +35,11 @@ Supported setup flags (current implementation):
|
|
|
35
35
|
- if a TTY user has persisted setup preferences, `omx setup` first summarizes the recorded choices and asks whether to **keep**, **review/change**, or **reset** them
|
|
36
36
|
- else interactive prompt on TTY (default `user`)
|
|
37
37
|
- else default `user` (safe for CI/tests)
|
|
38
|
-
2.
|
|
38
|
+
2. Resolve setup install mode:
|
|
39
39
|
- explicit `--plugin`, `--legacy`, or `--install-mode legacy|plugin`, if present
|
|
40
40
|
- persisted install mode in `./.omx/setup-scope.json`, if present and the TTY review decision is `keep`
|
|
41
|
-
- else discovered installed plugin cache under `${CODEX_HOME:-~/.codex}/plugins/cache/**/.codex-plugin/plugin.json` with `name: oh-my-codex` makes `plugin` the default
|
|
42
|
-
- else interactive prompt on TTY (`legacy` by default, or `plugin` when a plugin cache is discovered)
|
|
41
|
+
- else discovered installed plugin cache under `${CODEX_HOME:-~/.codex}/plugins/cache/**/.codex-plugin/plugin.json` with `name: oh-my-codex` makes `plugin` the default for both `user` and `project` scope, so project setup does not duplicate plugin-provided skills/hooks with legacy `.codex/skills` and `.codex/hooks.json`
|
|
42
|
+
- else in `user` scope, interactive prompt on TTY (`legacy` by default, or `plugin` when a plugin cache is discovered)
|
|
43
43
|
- else default `legacy` unless a plugin cache is discovered
|
|
44
44
|
3. Create directories and persist effective scope/install mode
|
|
45
45
|
4. In legacy mode, install prompts/native agents/skills and merge full config.toml. In plugin mode, archive/remove legacy OMX-managed prompts/skills, refresh installable native agent TOMLs for `agent_type` routing, clean up stale generated non-installable native agents, and keep native Codex hooks installed.
|
|
@@ -51,7 +51,7 @@ Supported setup flags (current implementation):
|
|
|
51
51
|
|
|
52
52
|
- `omx setup` prompts for scope when no scope is provided and stdin/stdout are TTY. If `./.omx/setup-scope.json` already exists, setup now summarizes the saved choices first and asks whether to keep them, review/change them, or reset and behave like a fresh setup run.
|
|
53
53
|
- Non-interactive setup never blocks for this review prompt: it keeps deterministic CLI/persisted/default behavior for CI and scripted installs.
|
|
54
|
-
- In `user` scope, `omx setup` also prompts for skill delivery mode when no prior install mode is kept; installed plugin cache discovery makes plugin mode the default prompt/non-interactive choice.
|
|
54
|
+
- In `user` scope, `omx setup` also prompts for skill delivery mode when no prior install mode is kept; installed plugin cache discovery makes plugin mode the default prompt/non-interactive choice. In `project` scope, installed plugin cache discovery selects plugin mode non-interactively to avoid overlapping project legacy skills/hooks with plugin-provided surfaces.
|
|
55
55
|
- Local project orchestration file is `./AGENTS.md` (project root).
|
|
56
56
|
- If `AGENTS.md` exists and neither `--force` nor `--merge-agents` is used, interactive TTY runs ask whether to overwrite. Non-interactive runs preserve the file.
|
|
57
57
|
- Use `--merge-agents` to keep existing project guidance while allowing setup to refresh OMX-managed AGENTS sections and the generated model capability table idempotently.
|
|
@@ -73,7 +73,7 @@ Use this map when reconciling setup behavior or debugging a confusing install:
|
|
|
73
73
|
|
|
74
74
|
| Surface | Owner | Notes |
|
|
75
75
|
| --- | --- | --- |
|
|
76
|
-
| `./.omx/setup-scope.json` | `omx setup` | Persists setup scope and
|
|
76
|
+
| `./.omx/setup-scope.json` | `omx setup` | Persists setup scope and install mode when needed. TTY reruns summarize it and offer keep/review/reset. |
|
|
77
77
|
| `~/.codex/config.toml` / `./.codex/config.toml` | `omx setup` generated blocks + user edits | Setup refreshes OMX-managed blocks while preserving supported manual content; setup-owned runtime feature flags include `multi_agent`, `child_agents_md`, the Codex hook feature flag (`hooks` or legacy `codex_hooks`), and `goals`. |
|
|
78
78
|
| `~/.codex/hooks.json` / `./.codex/hooks.json` | `omx setup` shared ownership | Setup owns OMX native hook wrappers and preserves user-owned hooks. |
|
|
79
79
|
| prompts, skills, native agents | `omx setup` or Codex plugin delivery | Legacy mode installs local files; plugin mode relies on plugin discovery for bundled skills, archives/removes legacy OMX-managed prompt/skill copies, and refreshes setup-owned native agent TOMLs for `agent_type` routing while cleaning up stale generated/non-installable native agents. |
|
|
@@ -42,7 +42,7 @@ OMX already has `$plan`, `$ralplan`, and `$deep-interview`. Prometheus Strict ex
|
|
|
42
42
|
- Ask high-leverage questions as a batched round when the answers materially change scope, safety, or validation. Reserve one-at-a-time questioning only for dependent question chains where the next question depends on the previous answer.
|
|
43
43
|
- If a safe assumption is available, state it and continue.
|
|
44
44
|
- Use repository reads when needed to make paths, tests, and handoff commands concrete.
|
|
45
|
-
- During Metis planning, run pre-question research fan-out for every non-trivial intent unless the task is trivial, the cited spec is self-contained, or cached evidence already covers the same surface; use `explore` for repo facts and the exact cheap `gpt-5.
|
|
45
|
+
- During Metis planning, run pre-question research fan-out for every non-trivial intent unless the task is trivial, the cited spec is self-contained, or cached evidence already covers the same surface; use `explore` for repo facts and the exact cheap `gpt-5.6-terra` `researcher` lane for external docs / OSS references before asking the user. Prometheus Strict may fan out up to `2 explore + 4 researcher` agents per round so breadth comes from more citation-focused mini researchers while Metis/Momus/Oracle keep stronger judgment roles.
|
|
46
46
|
- Recommend `$team` only when Oracle identifies independent, bounded, verifiable lanes.
|
|
47
47
|
|
|
48
48
|
### Structured Question Surface
|
|
@@ -93,7 +93,7 @@ If the prompt contains destructive, credential-gated, external-production, or ma
|
|
|
93
93
|
|
|
94
94
|
Use `prometheus-strict-metis` as the interview voice. When native subagents are available, invoke the dedicated agent; otherwise run the same role in-context without editing files.
|
|
95
95
|
|
|
96
|
-
Metis discovers success criteria, non-goals, evidence versus assumptions, required artifacts, likely execution lanes, and missing decisions. Before the first user-facing question batch, Metis must actively fan out repo/external research per intent: `explore` maps local surfaces and exact `gpt-5.
|
|
96
|
+
Metis discovers success criteria, non-goals, evidence versus assumptions, required artifacts, likely execution lanes, and missing decisions. Before the first user-facing question batch, Metis must actively fan out repo/external research per intent: `explore` maps local surfaces and exact `gpt-5.6-terra` `researcher` lanes gather official/upstream or OSS-reference evidence. Research-heavy intents use more cheap researchers rather than downgrading Metis/Momus/Oracle judgment.
|
|
97
97
|
|
|
98
98
|
Run the interview as a bounded loop:
|
|
99
99
|
|
|
@@ -148,7 +148,7 @@ $team <N>:executor "execute the approved Ultragoal story in parallel lanes" # o
|
|
|
148
148
|
|
|
149
149
|
<Tool_Usage>
|
|
150
150
|
- Use read-only repository inspection to verify referenced files, commands, and existing conventions.
|
|
151
|
-
- Treat Metis research fan-out as part of planning, not execution: dispatch `explore` / exact `gpt-5.
|
|
151
|
+
- Treat Metis research fan-out as part of planning, not execution: dispatch `explore` / exact `gpt-5.6-terra` `researcher` evidence-gathering before question generation for non-trivial intents, then re-prefill and ask only surviving CRITICAL gaps.
|
|
152
152
|
- Use `prometheus-strict-metis`, `prometheus-strict-momus`, and `prometheus-strict-oracle` sequentially; do not fan out implementation work from this skill.
|
|
153
153
|
- Use `$ultragoal` only as the recommended execution handoff after the plan is ready.
|
|
154
154
|
- Use `$team` only when parallel lanes are independent and verifiable.
|
|
@@ -30,7 +30,7 @@ $ralplan --interactive "task description"
|
|
|
30
30
|
|
|
31
31
|
## Behavior
|
|
32
32
|
|
|
33
|
-
## GPT-5.
|
|
33
|
+
## GPT-5.6 Guidance Alignment
|
|
34
34
|
|
|
35
35
|
Use the shared workflow guidance pattern: outcome-first framing, concise visible updates for multi-step planning, local overrides for the active workflow branch, evidence-backed planning and validation expectations, explicit stop rules, right-sized implementation/PRD shape, and automatic continuation for safe reversible steps. Ask only for material, destructive, credentialed, external-production, or preference-dependent branches.
|
|
36
36
|
|
|
@@ -17,7 +17,7 @@ This skill is operationally sensitive. Treat it as an operator workflow, not a g
|
|
|
17
17
|
|
|
18
18
|
## What This Skill Must Do
|
|
19
19
|
|
|
20
|
-
## GPT-5.
|
|
20
|
+
## GPT-5.6 Guidance Alignment
|
|
21
21
|
|
|
22
22
|
Use the shared workflow guidance pattern: outcome-first framing, concise visible updates for multi-step work, local overrides for the active workflow branch, validation proportional to risk, explicit stop rules, and automatic continuation for safe reversible steps. Ask only for material, destructive, credentialed, external-production, or preference-dependent branches.
|
|
23
23
|
|
|
@@ -47,8 +47,8 @@ Use role to choose responsibility, tier to choose depth, and posture to choose o
|
|
|
47
47
|
- Prioritizes intent classification, delegation, verification, and architectural judgment.
|
|
48
48
|
- Typical roles: `planner`, `analyst`, `architect`, `critic`, `code-reviewer`.
|
|
49
49
|
- Ralplan keeps `planner` and `architect` in this posture; `planner`
|
|
50
|
-
uses exact `gpt-5.
|
|
51
|
-
`gpt-5.
|
|
50
|
+
uses exact `gpt-5.6-sol` with medium reasoning, `architect` uses exact
|
|
51
|
+
`gpt-5.6-sol` with xhigh reasoning, and the `critic` consensus gate stays
|
|
52
52
|
on the frontier lane.
|
|
53
53
|
|
|
54
54
|
- `deep-worker`:
|
|
@@ -103,7 +103,7 @@ Optional ADDITIONAL dispatch on top of the mandatory minimum (fire when signals
|
|
|
103
103
|
- Multi-module integration surface → extra `explore` to map the cross-module boundary.
|
|
104
104
|
|
|
105
105
|
Fan-out budget and shape:
|
|
106
|
-
- Max **2 explore + 4 researcher** agents per round, all dispatched in parallel via `run_in_background=true` in a single tool block (never sequential). `researcher` is pinned to the exact cheap `gpt-5.
|
|
106
|
+
- Max **2 explore + 4 researcher** agents per round, all dispatched in parallel via `run_in_background=true` in a single tool block (never sequential). `researcher` is pinned to the exact cheap `gpt-5.6-terra` lane, so breadth comes from more citation-focused researchers while Metis/Momus/Oracle keep stronger judgment roles.
|
|
107
107
|
- Each prompt MUST follow the structured format: `[CONTEXT]` (task + current decision + repo path), `[GOAL]` (what the answer unblocks), `[DOWNSTREAM]` (which question or assumption depends on this), `[REQUEST]` (what to find, return format, what to skip). Vague single-line prompts are forbidden. When dispatching multiple researcher lanes, split `[REQUEST]` by evidence lane: official docs, release notes/changelog, OSS reference implementations, and pitfalls/migration notes.
|
|
108
108
|
- Wait for all dispatched agents to complete before generating questions; do not interleave fan-out with user-facing questions.
|
|
109
109
|
|
|
@@ -15,7 +15,7 @@ Use this skill when:
|
|
|
15
15
|
- Follow-up implementation left duplicate code, dead code, weak boundaries, missing tests, fallback-like code, or unnecessary wrapper layers
|
|
16
16
|
- You need a disciplined cleanup workflow without broad rewrites
|
|
17
17
|
|
|
18
|
-
## GPT-5.
|
|
18
|
+
## GPT-5.6 Guidance Alignment
|
|
19
19
|
|
|
20
20
|
- Keep outputs concise and evidence-dense unless risk or the user requests more detail.
|
|
21
21
|
- Treat newer user instructions as local workflow updates without discarding earlier non-conflicting constraints.
|
|
@@ -15,7 +15,7 @@ This skill activates when:
|
|
|
15
15
|
- After implementing a major feature
|
|
16
16
|
- User wants quality assessment
|
|
17
17
|
|
|
18
|
-
## GPT-5.
|
|
18
|
+
## GPT-5.6 Guidance Alignment
|
|
19
19
|
|
|
20
20
|
- Default to outcome-first progress and completion reporting: state the target result, evidence, validation status, and stop condition before adding process detail.
|
|
21
21
|
- Treat newer user task updates as local overrides for the active workflow branch while preserving earlier non-conflicting constraints.
|
|
@@ -47,7 +47,7 @@ Use role to choose responsibility, tier to choose depth, and posture to choose o
|
|
|
47
47
|
- Prioritizes intent classification, delegation, verification, and architectural judgment.
|
|
48
48
|
- Typical roles: `planner`, `analyst`, `architect`, `critic`, `code-reviewer`.
|
|
49
49
|
- Ralplan keeps `planner` and `architect` in this posture but pins them to
|
|
50
|
-
exact `gpt-5.
|
|
50
|
+
exact `gpt-5.6-sol` with role-specific reasoning; the `critic` consensus gate stays
|
|
51
51
|
on the frontier lane.
|
|
52
52
|
|
|
53
53
|
- `deep-worker`:
|