oh-my-codex 0.18.2 → 0.18.4
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 +1 -0
- package/dist/agents/__tests__/definitions.test.js +9 -0
- package/dist/agents/__tests__/definitions.test.js.map +1 -1
- package/dist/agents/__tests__/native-config.test.js +1 -0
- package/dist/agents/__tests__/native-config.test.js.map +1 -1
- package/dist/agents/definitions.d.ts.map +1 -1
- package/dist/agents/definitions.js +10 -0
- package/dist/agents/definitions.js.map +1 -1
- package/dist/auth/__tests__/config-sessions.test.d.ts +2 -0
- package/dist/auth/__tests__/config-sessions.test.d.ts.map +1 -0
- package/dist/auth/__tests__/config-sessions.test.js +48 -0
- package/dist/auth/__tests__/config-sessions.test.js.map +1 -0
- package/dist/auth/__tests__/quota-rotation.test.d.ts +2 -0
- package/dist/auth/__tests__/quota-rotation.test.d.ts.map +1 -0
- package/dist/auth/__tests__/quota-rotation.test.js +33 -0
- package/dist/auth/__tests__/quota-rotation.test.js.map +1 -0
- package/dist/auth/__tests__/redact.test.d.ts +2 -0
- package/dist/auth/__tests__/redact.test.d.ts.map +1 -0
- package/dist/auth/__tests__/redact.test.js +20 -0
- package/dist/auth/__tests__/redact.test.js.map +1 -0
- package/dist/auth/__tests__/storage.test.d.ts +2 -0
- package/dist/auth/__tests__/storage.test.d.ts.map +1 -0
- package/dist/auth/__tests__/storage.test.js +108 -0
- package/dist/auth/__tests__/storage.test.js.map +1 -0
- package/dist/auth/config.d.ts +9 -0
- package/dist/auth/config.d.ts.map +1 -0
- package/dist/auth/config.js +77 -0
- package/dist/auth/config.js.map +1 -0
- package/dist/auth/hotswap.d.ts +36 -0
- package/dist/auth/hotswap.d.ts.map +1 -0
- package/dist/auth/hotswap.js +159 -0
- package/dist/auth/hotswap.js.map +1 -0
- package/dist/auth/index.d.ts +8 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +8 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/paths.d.ts +12 -0
- package/dist/auth/paths.d.ts.map +1 -0
- package/dist/auth/paths.js +78 -0
- package/dist/auth/paths.js.map +1 -0
- package/dist/auth/quota-detector.d.ts +10 -0
- package/dist/auth/quota-detector.d.ts.map +1 -0
- package/dist/auth/quota-detector.js +40 -0
- package/dist/auth/quota-detector.js.map +1 -0
- package/dist/auth/redact.d.ts +2 -0
- package/dist/auth/redact.d.ts.map +1 -0
- package/dist/auth/redact.js +26 -0
- package/dist/auth/redact.js.map +1 -0
- package/dist/auth/rotation.d.ts +9 -0
- package/dist/auth/rotation.d.ts.map +1 -0
- package/dist/auth/rotation.js +26 -0
- package/dist/auth/rotation.js.map +1 -0
- package/dist/auth/sessions.d.ts +15 -0
- package/dist/auth/sessions.d.ts.map +1 -0
- package/dist/auth/sessions.js +62 -0
- package/dist/auth/sessions.js.map +1 -0
- package/dist/auth/storage.d.ts +27 -0
- package/dist/auth/storage.d.ts.map +1 -0
- package/dist/auth/storage.js +111 -0
- package/dist/auth/storage.js.map +1 -0
- package/dist/cli/__tests__/auth.test.d.ts +2 -0
- package/dist/cli/__tests__/auth.test.d.ts.map +1 -0
- package/dist/cli/__tests__/auth.test.js +168 -0
- package/dist/cli/__tests__/auth.test.js.map +1 -0
- package/dist/cli/__tests__/doctor-warning-copy.test.js +88 -3
- package/dist/cli/__tests__/doctor-warning-copy.test.js.map +1 -1
- package/dist/cli/__tests__/explore.test.js +28 -7
- package/dist/cli/__tests__/explore.test.js.map +1 -1
- package/dist/cli/__tests__/index.test.js +70 -2
- package/dist/cli/__tests__/index.test.js.map +1 -1
- package/dist/cli/__tests__/nested-help-routing.test.js +1 -0
- package/dist/cli/__tests__/nested-help-routing.test.js.map +1 -1
- package/dist/cli/__tests__/setup-agents-overwrite.test.js +30 -1
- package/dist/cli/__tests__/setup-agents-overwrite.test.js.map +1 -1
- package/dist/cli/__tests__/setup-install-mode.test.js +103 -17
- package/dist/cli/__tests__/setup-install-mode.test.js.map +1 -1
- package/dist/cli/__tests__/setup-scope.test.js +1 -1
- package/dist/cli/__tests__/sparkshell-cli.test.js +2 -2
- package/dist/cli/__tests__/sparkshell-cli.test.js.map +1 -1
- package/dist/cli/auth.d.ts +4 -0
- package/dist/cli/auth.d.ts.map +1 -0
- package/dist/cli/auth.js +89 -0
- package/dist/cli/auth.js.map +1 -0
- package/dist/cli/doctor.d.ts.map +1 -1
- package/dist/cli/doctor.js +128 -19
- package/dist/cli/doctor.js.map +1 -1
- package/dist/cli/explore.d.ts +1 -0
- package/dist/cli/explore.d.ts.map +1 -1
- package/dist/cli/explore.js +18 -0
- package/dist/cli/explore.js.map +1 -1
- package/dist/cli/index.d.ts +20 -2
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +114 -10
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/question.d.ts.map +1 -1
- package/dist/cli/question.js +5 -1
- package/dist/cli/question.js.map +1 -1
- package/dist/cli/setup.d.ts.map +1 -1
- package/dist/cli/setup.js +29 -57
- package/dist/cli/setup.js.map +1 -1
- package/dist/config/__tests__/deep-interview.test.d.ts +2 -0
- package/dist/config/__tests__/deep-interview.test.d.ts.map +1 -0
- package/dist/config/__tests__/deep-interview.test.js +239 -0
- package/dist/config/__tests__/deep-interview.test.js.map +1 -0
- package/dist/config/__tests__/generator-idempotent.test.js +128 -5
- package/dist/config/__tests__/generator-idempotent.test.js.map +1 -1
- package/dist/config/deep-interview.d.ts +22 -0
- package/dist/config/deep-interview.d.ts.map +1 -0
- package/dist/config/deep-interview.js +151 -0
- package/dist/config/deep-interview.js.map +1 -0
- package/dist/config/generator.d.ts +13 -4
- package/dist/config/generator.d.ts.map +1 -1
- package/dist/config/generator.js +154 -40
- package/dist/config/generator.js.map +1 -1
- package/dist/hooks/__tests__/agents-overlay.test.js +9 -7
- package/dist/hooks/__tests__/agents-overlay.test.js.map +1 -1
- package/dist/hooks/__tests__/autopilot-skill-contract.test.js +10 -1
- package/dist/hooks/__tests__/autopilot-skill-contract.test.js.map +1 -1
- package/dist/hooks/__tests__/consensus-execution-handoff.test.js +13 -0
- package/dist/hooks/__tests__/consensus-execution-handoff.test.js.map +1 -1
- package/dist/hooks/__tests__/explore-routing.test.js +10 -12
- package/dist/hooks/__tests__/explore-routing.test.js.map +1 -1
- package/dist/hooks/__tests__/explore-sparkshell-guidance-contract.test.js +13 -15
- package/dist/hooks/__tests__/explore-sparkshell-guidance-contract.test.js.map +1 -1
- package/dist/hooks/__tests__/keyword-detector.test.js +301 -0
- package/dist/hooks/__tests__/keyword-detector.test.js.map +1 -1
- package/dist/hooks/__tests__/notify-fallback-watcher.test.js +33 -0
- package/dist/hooks/__tests__/notify-fallback-watcher.test.js.map +1 -1
- package/dist/hooks/__tests__/notify-hook-ralph-resume.test.js +60 -0
- package/dist/hooks/__tests__/notify-hook-ralph-resume.test.js.map +1 -1
- package/dist/hooks/deep-interview-config-instruction.d.ts +3 -0
- package/dist/hooks/deep-interview-config-instruction.d.ts.map +1 -0
- package/dist/hooks/deep-interview-config-instruction.js +47 -0
- package/dist/hooks/deep-interview-config-instruction.js.map +1 -0
- package/dist/hooks/explore-routing.d.ts.map +1 -1
- package/dist/hooks/explore-routing.js +8 -13
- package/dist/hooks/explore-routing.js.map +1 -1
- package/dist/hooks/keyword-detector.d.ts +5 -0
- package/dist/hooks/keyword-detector.d.ts.map +1 -1
- package/dist/hooks/keyword-detector.js +52 -8
- package/dist/hooks/keyword-detector.js.map +1 -1
- package/dist/hud/__tests__/hud-tmux-injection.test.js +19 -14
- package/dist/hud/__tests__/hud-tmux-injection.test.js.map +1 -1
- package/dist/hud/__tests__/reconcile.test.js +117 -9
- package/dist/hud/__tests__/reconcile.test.js.map +1 -1
- package/dist/hud/__tests__/tmux.test.js +103 -1
- package/dist/hud/__tests__/tmux.test.js.map +1 -1
- package/dist/hud/index.d.ts +1 -1
- package/dist/hud/index.d.ts.map +1 -1
- package/dist/hud/index.js +24 -2
- package/dist/hud/index.js.map +1 -1
- package/dist/hud/reconcile.d.ts +1 -1
- package/dist/hud/reconcile.d.ts.map +1 -1
- package/dist/hud/reconcile.js +23 -0
- package/dist/hud/reconcile.js.map +1 -1
- package/dist/hud/tmux.d.ts +7 -0
- package/dist/hud/tmux.d.ts.map +1 -1
- package/dist/hud/tmux.js +46 -9
- package/dist/hud/tmux.js.map +1 -1
- package/dist/question/__tests__/deep-interview.test.js +80 -7
- package/dist/question/__tests__/deep-interview.test.js.map +1 -1
- package/dist/question/__tests__/policy.test.js +83 -9
- package/dist/question/__tests__/policy.test.js.map +1 -1
- package/dist/question/autopilot-wait.d.ts +10 -0
- package/dist/question/autopilot-wait.d.ts.map +1 -0
- package/dist/question/autopilot-wait.js +134 -0
- package/dist/question/autopilot-wait.js.map +1 -0
- package/dist/question/deep-interview.d.ts +2 -0
- package/dist/question/deep-interview.d.ts.map +1 -1
- package/dist/question/deep-interview.js +4 -0
- package/dist/question/deep-interview.js.map +1 -1
- package/dist/question/policy.d.ts +1 -0
- package/dist/question/policy.d.ts.map +1 -1
- package/dist/question/policy.js +19 -0
- package/dist/question/policy.js.map +1 -1
- package/dist/scripts/__tests__/codex-native-hook.test.js +718 -0
- 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 +69 -5
- package/dist/scripts/codex-native-hook.js.map +1 -1
- package/dist/scripts/notify-hook.js +13 -0
- package/dist/scripts/notify-hook.js.map +1 -1
- package/dist/state/__tests__/planning-gate.test.d.ts +2 -0
- package/dist/state/__tests__/planning-gate.test.d.ts.map +1 -0
- package/dist/state/__tests__/planning-gate.test.js +219 -0
- package/dist/state/__tests__/planning-gate.test.js.map +1 -0
- package/dist/state/workflow-transition.d.ts +23 -0
- package/dist/state/workflow-transition.d.ts.map +1 -1
- package/dist/state/workflow-transition.js +63 -0
- package/dist/state/workflow-transition.js.map +1 -1
- package/dist/subagents/__tests__/tracker.test.js +69 -0
- package/dist/subagents/__tests__/tracker.test.js.map +1 -1
- package/dist/subagents/tracker.d.ts +5 -0
- package/dist/subagents/tracker.d.ts.map +1 -1
- package/dist/subagents/tracker.js +16 -0
- package/dist/subagents/tracker.js.map +1 -1
- package/dist/team/__tests__/tmux-session.test.js +86 -0
- package/dist/team/__tests__/tmux-session.test.js.map +1 -1
- package/dist/team/tmux-session.d.ts.map +1 -1
- package/dist/team/tmux-session.js +7 -0
- package/dist/team/tmux-session.js.map +1 -1
- package/dist/ultragoal/__tests__/artifacts.test.js +126 -0
- package/dist/ultragoal/__tests__/artifacts.test.js.map +1 -1
- package/dist/ultragoal/artifacts.d.ts.map +1 -1
- package/dist/ultragoal/artifacts.js +126 -8
- package/dist/ultragoal/artifacts.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/autopilot/SKILL.md +2 -2
- package/plugins/oh-my-codex/skills/deep-interview/SKILL.md +11 -1
- package/plugins/oh-my-codex/skills/omx-setup/SKILL.md +4 -4
- package/plugins/oh-my-codex/skills/plan/SKILL.md +5 -5
- package/plugins/oh-my-codex/skills/ralph/SKILL.md +1 -1
- package/plugins/oh-my-codex/skills/ralplan/SKILL.md +10 -6
- package/prompts/executor.md +1 -1
- package/prompts/explore-harness.md +2 -2
- package/prompts/explore.md +1 -1
- package/prompts/planner.md +1 -1
- package/prompts/scholastic.md +11 -0
- package/prompts/sisyphus-lite.md +1 -1
- package/skills/autopilot/SKILL.md +2 -2
- package/skills/deep-interview/SKILL.md +11 -1
- package/skills/omx-setup/SKILL.md +4 -4
- package/skills/plan/SKILL.md +5 -5
- package/skills/ralph/SKILL.md +1 -1
- package/skills/ralplan/SKILL.md +10 -6
- package/src/scripts/__tests__/codex-native-hook.test.ts +853 -0
- package/src/scripts/codex-native-hook.ts +73 -3
- package/src/scripts/notify-hook.ts +15 -0
- package/templates/AGENTS.md +3 -3
- package/templates/catalog-manifest.json +5 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export type DeepInterviewProfile = 'quick' | 'standard' | 'deep';
|
|
2
|
+
export interface DeepInterviewConfigOptions {
|
|
3
|
+
cwd: string;
|
|
4
|
+
text?: string;
|
|
5
|
+
homeDir?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface DeepInterviewConfigCandidate {
|
|
8
|
+
path: string;
|
|
9
|
+
precedence: 'project-omx' | 'project-root' | 'user';
|
|
10
|
+
}
|
|
11
|
+
export interface DeepInterviewRuntimeConfig {
|
|
12
|
+
profile: DeepInterviewProfile;
|
|
13
|
+
threshold: number;
|
|
14
|
+
maxRounds: number;
|
|
15
|
+
enableChallengeModes: boolean;
|
|
16
|
+
sourcePath: string;
|
|
17
|
+
}
|
|
18
|
+
export declare function parseDeepInterviewProfileFromText(text: string | undefined): DeepInterviewProfile | undefined;
|
|
19
|
+
export declare function getDeepInterviewConfigCandidatePaths(options: Pick<DeepInterviewConfigOptions, 'cwd' | 'homeDir'>): DeepInterviewConfigCandidate[];
|
|
20
|
+
export declare function resolveDeepInterviewRuntimeConfig(options: DeepInterviewConfigOptions): DeepInterviewRuntimeConfig | null;
|
|
21
|
+
export declare function buildDeepInterviewConfigStateFields(config: DeepInterviewRuntimeConfig | null | undefined): Record<string, unknown>;
|
|
22
|
+
//# sourceMappingURL=deep-interview.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deep-interview.d.ts","sourceRoot":"","sources":["../../src/config/deep-interview.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,oBAAoB,GAAG,OAAO,GAAG,UAAU,GAAG,MAAM,CAAC;AAEjE,MAAM,WAAW,0BAA0B;IACzC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,4BAA4B;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,aAAa,GAAG,cAAc,GAAG,MAAM,CAAC;CACrD;AAED,MAAM,WAAW,0BAA0B;IACzC,OAAO,EAAE,oBAAoB,CAAC;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,oBAAoB,EAAE,OAAO,CAAC;IAC9B,UAAU,EAAE,MAAM,CAAC;CACpB;AAsID,wBAAgB,iCAAiC,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,oBAAoB,GAAG,SAAS,CAc5G;AAED,wBAAgB,oCAAoC,CAAC,OAAO,EAAE,IAAI,CAAC,0BAA0B,EAAE,KAAK,GAAG,SAAS,CAAC,GAAG,4BAA4B,EAAE,CAQjJ;AAED,wBAAgB,iCAAiC,CAAC,OAAO,EAAE,0BAA0B,GAAG,0BAA0B,GAAG,IAAI,CAQxH;AAED,wBAAgB,mCAAmC,CACjD,MAAM,EAAE,0BAA0B,GAAG,IAAI,GAAG,SAAS,GACpD,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAmBzB"}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
2
|
+
import { homedir } from 'node:os';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { parse as parseToml } from '@iarna/toml';
|
|
5
|
+
import { findGitLayout } from '../utils/git-layout.js';
|
|
6
|
+
const DEFAULT_PROFILE = 'standard';
|
|
7
|
+
const DEFAULT_ENABLE_CHALLENGE_MODES = true;
|
|
8
|
+
const PROFILE_SPECS = {
|
|
9
|
+
quick: {
|
|
10
|
+
thresholdKey: 'quickThreshold',
|
|
11
|
+
maxRoundsKey: 'quickMaxRounds',
|
|
12
|
+
defaults: { threshold: 0.30, maxRounds: 5 },
|
|
13
|
+
},
|
|
14
|
+
standard: {
|
|
15
|
+
thresholdKey: 'standardThreshold',
|
|
16
|
+
maxRoundsKey: 'standardMaxRounds',
|
|
17
|
+
defaults: { threshold: 0.20, maxRounds: 12 },
|
|
18
|
+
},
|
|
19
|
+
deep: {
|
|
20
|
+
thresholdKey: 'deepThreshold',
|
|
21
|
+
maxRoundsKey: 'deepMaxRounds',
|
|
22
|
+
defaults: { threshold: 0.15, maxRounds: 20 },
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
const DEEP_INTERVIEW_INVOCATION_PATTERN = /(?:^|\s)(?:\$(?:[A-Za-z0-9_-]+:)?deep-interview|deep[-\s]interview)(?=\s|$)/i;
|
|
26
|
+
const PROFILE_FLAG_TOKEN_PATTERN = /^--(quick|standard|deep)$/i;
|
|
27
|
+
function isRecord(value) {
|
|
28
|
+
return Boolean(value && typeof value === 'object' && !Array.isArray(value));
|
|
29
|
+
}
|
|
30
|
+
function normalizeProfile(value) {
|
|
31
|
+
if (typeof value !== 'string')
|
|
32
|
+
return undefined;
|
|
33
|
+
const normalized = value.toLowerCase();
|
|
34
|
+
return normalized === 'quick' || normalized === 'standard' || normalized === 'deep'
|
|
35
|
+
? normalized
|
|
36
|
+
: undefined;
|
|
37
|
+
}
|
|
38
|
+
function normalizeFiniteNumber(value) {
|
|
39
|
+
return typeof value === 'number' && Number.isFinite(value) ? value : undefined;
|
|
40
|
+
}
|
|
41
|
+
function normalizeThreshold(value) {
|
|
42
|
+
const normalized = normalizeFiniteNumber(value);
|
|
43
|
+
return normalized !== undefined && normalized > 0 && normalized <= 1 ? normalized : undefined;
|
|
44
|
+
}
|
|
45
|
+
function normalizeMaxRounds(value) {
|
|
46
|
+
const normalized = normalizeFiniteNumber(value);
|
|
47
|
+
return normalized !== undefined && Number.isInteger(normalized) && normalized > 0 ? normalized : undefined;
|
|
48
|
+
}
|
|
49
|
+
function warnMalformedConfig(configPath, error) {
|
|
50
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
51
|
+
console.warn(`[omx] warning: ignoring malformed deep-interview config at ${configPath}: ${message}`);
|
|
52
|
+
}
|
|
53
|
+
function extractDeepInterviewTable(parsed) {
|
|
54
|
+
if (!isRecord(parsed) || !isRecord(parsed.omx) || !isRecord(parsed.omx.deepInterview))
|
|
55
|
+
return null;
|
|
56
|
+
return parsed.omx.deepInterview;
|
|
57
|
+
}
|
|
58
|
+
function readDeepInterviewConfigTable(configPath) {
|
|
59
|
+
if (!existsSync(configPath))
|
|
60
|
+
return { status: 'missing' };
|
|
61
|
+
try {
|
|
62
|
+
const table = extractDeepInterviewTable(parseToml(readFileSync(configPath, 'utf-8')));
|
|
63
|
+
return table ? { status: 'table', table } : { status: 'no-table' };
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
warnMalformedConfig(configPath, error);
|
|
67
|
+
return { status: 'malformed' };
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
function resolveProfile(table, text) {
|
|
71
|
+
return parseDeepInterviewProfileFromText(text)
|
|
72
|
+
?? normalizeProfile(table.defaultProfile)
|
|
73
|
+
?? DEFAULT_PROFILE;
|
|
74
|
+
}
|
|
75
|
+
function resolveProfileConfig(table, profile) {
|
|
76
|
+
const spec = PROFILE_SPECS[profile];
|
|
77
|
+
return {
|
|
78
|
+
threshold: normalizeThreshold(table[spec.thresholdKey]) ?? spec.defaults.threshold,
|
|
79
|
+
maxRounds: normalizeMaxRounds(table[spec.maxRoundsKey]) ?? spec.defaults.maxRounds,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
function resolveEnableChallengeModes(table) {
|
|
83
|
+
return typeof table.enableChallengeModes === 'boolean'
|
|
84
|
+
? table.enableChallengeModes
|
|
85
|
+
: DEFAULT_ENABLE_CHALLENGE_MODES;
|
|
86
|
+
}
|
|
87
|
+
function buildRuntimeConfig(candidate, table, options) {
|
|
88
|
+
const profile = resolveProfile(table, options.text);
|
|
89
|
+
return {
|
|
90
|
+
profile,
|
|
91
|
+
...resolveProfileConfig(table, profile),
|
|
92
|
+
enableChallengeModes: resolveEnableChallengeModes(table),
|
|
93
|
+
sourcePath: candidate.path,
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
export function parseDeepInterviewProfileFromText(text) {
|
|
97
|
+
const input = text ?? '';
|
|
98
|
+
const invocationMatch = DEEP_INTERVIEW_INVOCATION_PATTERN.exec(input);
|
|
99
|
+
if (!invocationMatch)
|
|
100
|
+
return undefined;
|
|
101
|
+
const afterInvocation = input.slice((invocationMatch.index ?? 0) + invocationMatch[0].length).trimStart();
|
|
102
|
+
for (const token of afterInvocation.split(/\s+/)) {
|
|
103
|
+
if (!token)
|
|
104
|
+
continue;
|
|
105
|
+
if (!token.startsWith('--'))
|
|
106
|
+
return undefined;
|
|
107
|
+
const profile = normalizeProfile(PROFILE_FLAG_TOKEN_PATTERN.exec(token)?.[1]);
|
|
108
|
+
if (profile)
|
|
109
|
+
return profile;
|
|
110
|
+
}
|
|
111
|
+
return undefined;
|
|
112
|
+
}
|
|
113
|
+
export function getDeepInterviewConfigCandidatePaths(options) {
|
|
114
|
+
const home = options.homeDir || homedir();
|
|
115
|
+
const projectRoot = findGitLayout(options.cwd)?.worktreeRoot ?? options.cwd;
|
|
116
|
+
return [
|
|
117
|
+
{ path: join(projectRoot, '.omx', 'config.toml'), precedence: 'project-omx' },
|
|
118
|
+
{ path: join(projectRoot, 'omx.toml'), precedence: 'project-root' },
|
|
119
|
+
{ path: join(home, '.omx', 'config.toml'), precedence: 'user' },
|
|
120
|
+
];
|
|
121
|
+
}
|
|
122
|
+
export function resolveDeepInterviewRuntimeConfig(options) {
|
|
123
|
+
for (const candidate of getDeepInterviewConfigCandidatePaths(options)) {
|
|
124
|
+
const result = readDeepInterviewConfigTable(candidate.path);
|
|
125
|
+
if (result.status === 'malformed' || result.status === 'no-table')
|
|
126
|
+
return null;
|
|
127
|
+
if (result.status === 'table')
|
|
128
|
+
return buildRuntimeConfig(candidate, result.table, options);
|
|
129
|
+
}
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
export function buildDeepInterviewConfigStateFields(config) {
|
|
133
|
+
if (!config)
|
|
134
|
+
return {};
|
|
135
|
+
const deepInterviewConfig = {
|
|
136
|
+
profile: config.profile,
|
|
137
|
+
threshold: config.threshold,
|
|
138
|
+
maxRounds: config.maxRounds,
|
|
139
|
+
enableChallengeModes: config.enableChallengeModes,
|
|
140
|
+
sourcePath: config.sourcePath,
|
|
141
|
+
};
|
|
142
|
+
return {
|
|
143
|
+
deep_interview_config: deepInterviewConfig,
|
|
144
|
+
profile: deepInterviewConfig.profile,
|
|
145
|
+
threshold: deepInterviewConfig.threshold,
|
|
146
|
+
max_rounds: deepInterviewConfig.maxRounds,
|
|
147
|
+
enable_challenge_modes: deepInterviewConfig.enableChallengeModes,
|
|
148
|
+
config_source: deepInterviewConfig.sourcePath,
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
//# sourceMappingURL=deep-interview.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deep-interview.js","sourceRoot":"","sources":["../../src/config/deep-interview.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAiDvD,MAAM,eAAe,GAAyB,UAAU,CAAC;AACzD,MAAM,8BAA8B,GAAG,IAAI,CAAC;AAE5C,MAAM,aAAa,GAA2D;IAC5E,KAAK,EAAE;QACL,YAAY,EAAE,gBAAgB;QAC9B,YAAY,EAAE,gBAAgB;QAC9B,QAAQ,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,EAAE;KAC5C;IACD,QAAQ,EAAE;QACR,YAAY,EAAE,mBAAmB;QACjC,YAAY,EAAE,mBAAmB;QACjC,QAAQ,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,E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IAAI,CAAC,CAAC;QAC5D,IAAI,MAAM,CAAC,MAAM,KAAK,WAAW,IAAI,MAAM,CAAC,MAAM,KAAK,UAAU;YAAE,OAAO,IAAI,CAAC;QAC/E,IAAI,MAAM,CAAC,MAAM,KAAK,OAAO;YAAE,OAAO,kBAAkB,CAAC,SAAS,EAAE,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAC7F,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,mCAAmC,CACjD,MAAqD;IAErD,IAAI,CAAC,MAAM;QAAE,OAAO,EAAE,CAAC;IAEvB,MAAM,mBAAmB,GAAG;QAC1B,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,oBAAoB,EAAE,MAAM,CAAC,oBAAoB;QACjD,UAAU,EAAE,MAAM,CAAC,UAAU;KAC9B,CAAC;IAEF,OAAO;QACL,qBAAqB,EAAE,mBAAmB;QAC1C,OAAO,EAAE,mBAAmB,CAAC,OAAO;QACpC,SAAS,EAAE,mBAAmB,CAAC,SAAS;QACxC,UAAU,EAAE,mBAAmB,CAAC,SAAS;QACzC,sBAAsB,EAAE,mBAAmB,CAAC,oBAAoB;QAChE,aAAa,EAAE,mBAAmB,CAAC,UAAU;KAC9C,CAAC;AACJ,CAAC"}
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import type { UnifiedMcpRegistryServer } from "./mcp-registry.js";
|
|
13
13
|
import { type CodexHookFeatureFlag } from "./codex-feature-flags.js";
|
|
14
|
-
import { type ManagedCodexHookOptions } from "./codex-hooks.js";
|
|
14
|
+
import { type ManagedCodexHookTrustState, type ManagedCodexHookOptions } from "./codex-hooks.js";
|
|
15
15
|
import type { HudPreset } from "../hud/types.js";
|
|
16
16
|
interface MergeOptions {
|
|
17
17
|
includeTui?: boolean;
|
|
@@ -39,7 +39,7 @@ export declare const DEFAULT_SETUP_MODEL_CONTEXT_WINDOW = 250000;
|
|
|
39
39
|
export declare const DEFAULT_SETUP_MODEL_AUTO_COMPACT_TOKEN_LIMIT = 200000;
|
|
40
40
|
export declare function getModelContextRecommendation(model: string): ModelContextRecommendation | null;
|
|
41
41
|
export declare const OMX_DEVELOPER_INSTRUCTIONS = "You have oh-my-codex installed. AGENTS.md is the orchestration brain and main control surface. Follow AGENTS.md for skill/keyword routing, $name workflow invocation, and role-specialized subagents. Use outcome-first, concise progress updates: state the target result, constraints, validation evidence, and stop condition before adding process detail. Native subagents live in .codex/agents and may handle independent parallel subtasks within one Codex session or team pane. Skills load from .codex/skills, not native-agent TOMLs. Treat installed prompts as narrower execution surfaces under AGENTS.md authority.";
|
|
42
|
-
export declare const OMX_PLUGIN_DEVELOPER_INSTRUCTIONS = "You have oh-my-codex installed through Codex plugin mode. AGENTS.md is the orchestration brain and main control surface. Follow AGENTS.md for skill/keyword routing and $name workflow invocation. Registered Codex plugin marketplace surfaces supply OMX workflows
|
|
42
|
+
export declare const OMX_PLUGIN_DEVELOPER_INSTRUCTIONS = "You have oh-my-codex installed through Codex plugin mode. AGENTS.md is the orchestration brain and main control surface. Follow AGENTS.md for skill/keyword routing and $name workflow invocation. Registered Codex plugin marketplace surfaces supply OMX workflows and plugin-scoped companion resources when the plugin is installed; native agent roles are installed as setup-owned Codex agent TOML files in plugin mode so agent_type routing works. User-installed skills may still live under ~/.codex/skills. Use outcome-first, concise progress updates: state the target result, constraints, validation evidence, and stop condition before adding process detail.";
|
|
43
43
|
export declare const STATUS_LINE_PRESETS: Record<HudPreset, readonly string[]>;
|
|
44
44
|
export declare const DEFAULT_STATUS_LINE_PRESET: HudPreset;
|
|
45
45
|
export declare function statusLineForPreset(preset?: HudPreset): string;
|
|
@@ -57,6 +57,12 @@ export declare function stripOmxSeededBehavioralDefaults(config: string): string
|
|
|
57
57
|
* cleanly. Also removes the comment line that precedes them.
|
|
58
58
|
*/
|
|
59
59
|
export declare function stripOmxTopLevelKeys(config: string): string;
|
|
60
|
+
/**
|
|
61
|
+
* Repairs project configs from the 0.18.3 relaunch regression where a
|
|
62
|
+
* project-synced trust block could duplicate setup-owned hook trust tables and
|
|
63
|
+
* make the next runtime CODEX_HOME config.toml invalid before Codex started.
|
|
64
|
+
*/
|
|
65
|
+
export declare function repairProjectScopeTrustStateForLaunch(projectConfig: string, projectHooksPath: string): string;
|
|
60
66
|
/**
|
|
61
67
|
* Project-scope launches mirror the durable project config.toml into an
|
|
62
68
|
* ephemeral runtime CODEX_HOME. Codex writes its workspace-trust ledger and
|
|
@@ -71,7 +77,10 @@ export declare function stripOmxTopLevelKeys(config: string): string;
|
|
|
71
77
|
* ignoring Codex's NUX counters or other ephemeral runtime-only writes.
|
|
72
78
|
*/
|
|
73
79
|
export declare function syncProjectScopeTrustStateFromRuntime(projectConfig: string, runtimeConfig: string, projectHooksPath: string): string;
|
|
74
|
-
|
|
80
|
+
type ManagedCodexHookTrustStateMap = Record<string, ManagedCodexHookTrustState>;
|
|
81
|
+
export declare function stripManagedCodexHookTrustState(config: string, options?: {
|
|
82
|
+
managedTrustState?: ManagedCodexHookTrustStateMap;
|
|
83
|
+
}): string;
|
|
75
84
|
export declare function upsertManagedCodexHookTrustState(config: string, pkgRoot: string, codexHooksFile: string | undefined, options?: ManagedCodexHookOptions): string;
|
|
76
85
|
export declare function upsertPluginModeRuntimeFeatureFlags(config: string, codexHookFeatureFlag?: CodexHookFeatureFlag, options?: {
|
|
77
86
|
pluginScopedHooks?: boolean;
|
|
@@ -110,7 +119,7 @@ export declare function mergeSharedMcpRegistryBlock(config: string, servers: Uni
|
|
|
110
119
|
* Layout:
|
|
111
120
|
* 1. OMX top-level keys (notify, model_reasoning_effort, developer_instructions)
|
|
112
121
|
* 2. [features] with multi_agent + child_agents_md + hooks + goals
|
|
113
|
-
* 3. [shell_environment_policy.set] with defaulted explore-routing opt-
|
|
122
|
+
* 3. [shell_environment_policy.set] with defaulted deprecated explore-routing opt-out
|
|
114
123
|
* 4. … user sections …
|
|
115
124
|
* 5. OMX [table] sections (mcp_servers, tui)
|
|
116
125
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../src/config/generator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAQH,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAML,KAAK,oBAAoB,EAC1B,MAAM,0BAA0B,CAAC;AAKlC,OAAO,EAGL,KAAK,uBAAuB,EAC7B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD,UAAU,YAAY;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,mBAAmB,CAAC,EAAE,uBAAuB,CAAC,UAAU,CAAC,CAAC;IAC1D,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;IAC5C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gBAAgB,CAAC,EAAE,wBAAwB,EAAE,CAAC;IAC9C,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,gBAAgB,CAAC,EAAE,SAAS,CAAC;IAC7B,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,aAAa,CAAC,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IACjC,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,6BAA6B,CAAC,EAAE,OAAO,CAAC;CACzC;AAqBD,MAAM,WAAW,0BAA0B;IACzC,KAAK,EAAE,MAAM,CAAC;IACd,kBAAkB,EAAE,MAAM,CAAC;IAC3B,0BAA0B,EAAE,MAAM,CAAC;CACpC;AAED,eAAO,MAAM,mBAAmB,YAAyB,CAAC;AAC1D,eAAO,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ENT_DEFINITIONS } from "../agents/definitions.js";
|
|
|
17
17
|
import { DEFAULT_FRONTIER_MODEL } from "./models.js";
|
|
18
18
|
import { DEFAULT_CODEX_HOOK_FEATURE_FLAG, CODEX_HOOK_FEATURE_FLAGS, CODEX_PLUGIN_SCOPED_HOOKS_FEATURE_FLAG, formatCodexHookFeatureFlagLine, normalizeCodexHookFeatureFlag, } from "./codex-feature-flags.js";
|
|
19
19
|
import { OMX_FIRST_PARTY_MCP_SERVER_NAMES, getOmxFirstPartySetupMcpServers, } from "./omx-first-party-mcp.js";
|
|
20
|
-
import {
|
|
20
|
+
import { buildManagedCodexHookTrustState, escapeTomlBasicString, } from "./codex-hooks.js";
|
|
21
21
|
function escapeTomlString(value) {
|
|
22
22
|
return value.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
|
|
23
23
|
}
|
|
@@ -48,12 +48,12 @@ export function getModelContextRecommendation(model) {
|
|
|
48
48
|
const OMX_SEEDED_BEHAVIORAL_DEFAULTS_START_MARKER = "# oh-my-codex seeded behavioral defaults (uninstall removes unchanged defaults)";
|
|
49
49
|
const OMX_SEEDED_BEHAVIORAL_DEFAULTS_END_MARKER = "# End oh-my-codex seeded behavioral defaults";
|
|
50
50
|
export const OMX_DEVELOPER_INSTRUCTIONS = "You have oh-my-codex installed. AGENTS.md is the orchestration brain and main control surface. Follow AGENTS.md for skill/keyword routing, $name workflow invocation, and role-specialized subagents. Use outcome-first, concise progress updates: state the target result, constraints, validation evidence, and stop condition before adding process detail. Native subagents live in .codex/agents and may handle independent parallel subtasks within one Codex session or team pane. Skills load from .codex/skills, not native-agent TOMLs. Treat installed prompts as narrower execution surfaces under AGENTS.md authority.";
|
|
51
|
-
export const OMX_PLUGIN_DEVELOPER_INSTRUCTIONS = "You have oh-my-codex installed through Codex plugin mode. AGENTS.md is the orchestration brain and main control surface. Follow AGENTS.md for skill/keyword routing and $name workflow invocation. Registered Codex plugin marketplace surfaces supply OMX workflows
|
|
51
|
+
export const OMX_PLUGIN_DEVELOPER_INSTRUCTIONS = "You have oh-my-codex installed through Codex plugin mode. AGENTS.md is the orchestration brain and main control surface. Follow AGENTS.md for skill/keyword routing and $name workflow invocation. Registered Codex plugin marketplace surfaces supply OMX workflows and plugin-scoped companion resources when the plugin is installed; native agent roles are installed as setup-owned Codex agent TOML files in plugin mode so agent_type routing works. User-installed skills may still live under ~/.codex/skills. Use outcome-first, concise progress updates: state the target result, constraints, validation evidence, and stop condition before adding process detail.";
|
|
52
52
|
const SHARED_MCP_REGISTRY_MARKER = "oh-my-codex (OMX) Shared MCP Registry Sync";
|
|
53
53
|
const SHARED_MCP_REGISTRY_END_MARKER = "# End oh-my-codex shared MCP registry sync";
|
|
54
54
|
const OMX_AGENTS_MAX_THREADS = 6;
|
|
55
55
|
const OMX_AGENTS_MAX_DEPTH = 2;
|
|
56
|
-
const OMX_EXPLORE_ROUTING_DEFAULT = "
|
|
56
|
+
const OMX_EXPLORE_ROUTING_DEFAULT = "0";
|
|
57
57
|
const OMX_EXPLORE_CMD_ENV = "USE_OMX_EXPLORE_CMD";
|
|
58
58
|
const DEFAULT_LAUNCHER_MCP_STARTUP_TIMEOUT_SEC = 15;
|
|
59
59
|
const STATUS_LINE_FOCUSED_FIELDS = [
|
|
@@ -580,6 +580,20 @@ const OMX_HOOK_TRUST_START_MARKER = "# OMX-owned Codex hook trust state";
|
|
|
580
580
|
const OMX_HOOK_TRUST_END_MARKER = "# End OMX-owned Codex hook trust state";
|
|
581
581
|
const OMX_PROJECT_TRUST_START_MARKER = "# OMX-synced Codex project trust state (from runtime CODEX_HOME)";
|
|
582
582
|
const OMX_PROJECT_TRUST_END_MARKER = "# End OMX-synced Codex project trust state";
|
|
583
|
+
function extractMarkerBlockContent(config, startMarker, endMarker) {
|
|
584
|
+
const lines = config.split(/\r?\n/);
|
|
585
|
+
for (let i = 0; i < lines.length; i++) {
|
|
586
|
+
if (lines[i].trim() !== startMarker)
|
|
587
|
+
continue;
|
|
588
|
+
const nextEndIdx = lines.findIndex((line, index) => index > i && line.trim() === endMarker);
|
|
589
|
+
const nextStartIdx = lines.findIndex((line, index) => index > i && line.trim() === startMarker);
|
|
590
|
+
if (nextEndIdx === -1 || (nextStartIdx !== -1 && nextStartIdx < nextEndIdx)) {
|
|
591
|
+
return undefined;
|
|
592
|
+
}
|
|
593
|
+
return lines.slice(i + 1, nextEndIdx).join("\n").trim();
|
|
594
|
+
}
|
|
595
|
+
return undefined;
|
|
596
|
+
}
|
|
583
597
|
function stripMarkerBlock(config, startMarker, endMarker) {
|
|
584
598
|
const lines = config.split(/\r?\n/);
|
|
585
599
|
const kept = [];
|
|
@@ -615,6 +629,33 @@ function safeParseToml(content) {
|
|
|
615
629
|
return undefined;
|
|
616
630
|
}
|
|
617
631
|
}
|
|
632
|
+
function collectProjectHookTrustStateKeys(config) {
|
|
633
|
+
const keys = new Set();
|
|
634
|
+
const parsed = safeParseToml(config);
|
|
635
|
+
const hooksTable = isPlainTomlRecord(parsed) ? parsed.hooks : undefined;
|
|
636
|
+
const hooksState = isPlainTomlRecord(hooksTable) ? hooksTable.state : undefined;
|
|
637
|
+
if (!isPlainTomlRecord(hooksState))
|
|
638
|
+
return keys;
|
|
639
|
+
for (const [key, entry] of Object.entries(hooksState)) {
|
|
640
|
+
if (!isPlainTomlRecord(entry))
|
|
641
|
+
continue;
|
|
642
|
+
keys.add(key);
|
|
643
|
+
}
|
|
644
|
+
return keys;
|
|
645
|
+
}
|
|
646
|
+
/**
|
|
647
|
+
* Repairs project configs from the 0.18.3 relaunch regression where a
|
|
648
|
+
* project-synced trust block could duplicate setup-owned hook trust tables and
|
|
649
|
+
* make the next runtime CODEX_HOME config.toml invalid before Codex started.
|
|
650
|
+
*/
|
|
651
|
+
export function repairProjectScopeTrustStateForLaunch(projectConfig, projectHooksPath) {
|
|
652
|
+
const syncedTrustBlock = extractMarkerBlockContent(projectConfig, OMX_PROJECT_TRUST_START_MARKER, OMX_PROJECT_TRUST_END_MARKER);
|
|
653
|
+
if (!syncedTrustBlock)
|
|
654
|
+
return projectConfig;
|
|
655
|
+
const stripped = stripMarkerBlock(projectConfig, OMX_PROJECT_TRUST_START_MARKER, OMX_PROJECT_TRUST_END_MARKER);
|
|
656
|
+
const repaired = syncProjectScopeTrustStateFromRuntime(stripped, syncedTrustBlock, projectHooksPath);
|
|
657
|
+
return repaired === stripped ? projectConfig : repaired;
|
|
658
|
+
}
|
|
618
659
|
/**
|
|
619
660
|
* Project-scope launches mirror the durable project config.toml into an
|
|
620
661
|
* ephemeral runtime CODEX_HOME. Codex writes its workspace-trust ledger and
|
|
@@ -632,6 +673,8 @@ export function syncProjectScopeTrustStateFromRuntime(projectConfig, runtimeConf
|
|
|
632
673
|
const parsed = safeParseToml(runtimeConfig);
|
|
633
674
|
if (!parsed)
|
|
634
675
|
return projectConfig;
|
|
676
|
+
const stripped = stripMarkerBlock(projectConfig, OMX_PROJECT_TRUST_START_MARKER, OMX_PROJECT_TRUST_END_MARKER);
|
|
677
|
+
const existingHookTrustStateKeys = collectProjectHookTrustStateKeys(stripped);
|
|
635
678
|
const trustBlockLines = [];
|
|
636
679
|
const projectsTable = parsed.projects;
|
|
637
680
|
if (isPlainTomlRecord(projectsTable)) {
|
|
@@ -657,13 +700,14 @@ export function syncProjectScopeTrustStateFromRuntime(projectConfig, runtimeConf
|
|
|
657
700
|
continue;
|
|
658
701
|
if (!stateKey.startsWith(`${projectHooksPath}:`))
|
|
659
702
|
continue;
|
|
703
|
+
if (existingHookTrustStateKeys.has(stateKey))
|
|
704
|
+
continue;
|
|
660
705
|
const trusted = entry.trusted_hash;
|
|
661
706
|
if (typeof trusted !== "string" || trusted.length === 0)
|
|
662
707
|
continue;
|
|
663
708
|
trustBlockLines.push(`[hooks.state."${escapeTomlBasicString(stateKey)}"]`, `trusted_hash = "${escapeTomlBasicString(trusted)}"`, "");
|
|
664
709
|
}
|
|
665
710
|
}
|
|
666
|
-
const stripped = stripMarkerBlock(projectConfig, OMX_PROJECT_TRUST_START_MARKER, OMX_PROJECT_TRUST_END_MARKER);
|
|
667
711
|
if (trustBlockLines.length === 0) {
|
|
668
712
|
return stripped.length === 0 ? "" : `${stripped}\n`;
|
|
669
713
|
}
|
|
@@ -677,59 +721,126 @@ export function syncProjectScopeTrustStateFromRuntime(projectConfig, runtimeConf
|
|
|
677
721
|
return block;
|
|
678
722
|
return `${stripped}\n\n${block}`;
|
|
679
723
|
}
|
|
680
|
-
|
|
724
|
+
function decodeTomlBasicString(raw) {
|
|
725
|
+
try {
|
|
726
|
+
const parsed = TOML.parse(`value = "${raw}"`);
|
|
727
|
+
return typeof parsed.value === "string" ? parsed.value : undefined;
|
|
728
|
+
}
|
|
729
|
+
catch {
|
|
730
|
+
return undefined;
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
function parseHooksStateHeader(line) {
|
|
734
|
+
const match = line.match(/^\s*\[hooks\.state\."((?:\\.|[^"\\])*)"\]\s*(#.*)?$/);
|
|
735
|
+
if (!match)
|
|
736
|
+
return undefined;
|
|
737
|
+
const key = decodeTomlBasicString(match[1] ?? "");
|
|
738
|
+
if (key === undefined)
|
|
739
|
+
return undefined;
|
|
740
|
+
return { key, hasInlineComment: match[2] !== undefined };
|
|
741
|
+
}
|
|
742
|
+
function isTomlTableHeader(line) {
|
|
743
|
+
return /^\s*\[\[?[^\]]+\]?\]\s*(?:#.*)?$/.test(line);
|
|
744
|
+
}
|
|
745
|
+
function isExactlyManagedHookTrustBody(bodyLines, expectedHash) {
|
|
746
|
+
const nonBlank = bodyLines.filter((line) => line.trim().length > 0);
|
|
747
|
+
if (nonBlank.length !== 1)
|
|
748
|
+
return false;
|
|
749
|
+
const expected = expectedHash.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
750
|
+
return new RegExp(`^\\s*trusted_hash\\s*=\\s*"${expected}"\\s*$`).test(nonBlank[0] ?? "");
|
|
751
|
+
}
|
|
752
|
+
function stripProofManagedCodexHookTrustStateTables(config, managedTrustState) {
|
|
753
|
+
if (Object.keys(managedTrustState).length === 0) {
|
|
754
|
+
return { config, preservedConflictKeys: new Set() };
|
|
755
|
+
}
|
|
681
756
|
const lines = config.split(/\r?\n/);
|
|
682
757
|
const kept = [];
|
|
758
|
+
const preservedConflictKeys = new Set();
|
|
683
759
|
for (let i = 0; i < lines.length;) {
|
|
684
|
-
const
|
|
685
|
-
if (
|
|
760
|
+
const header = parseHooksStateHeader(lines[i] ?? "");
|
|
761
|
+
if (!header) {
|
|
686
762
|
kept.push(lines[i]);
|
|
687
763
|
i += 1;
|
|
688
764
|
continue;
|
|
689
765
|
}
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
766
|
+
let tableEnd = lines.length;
|
|
767
|
+
for (let next = i + 1; next < lines.length; next += 1) {
|
|
768
|
+
if (isTomlTableHeader(lines[next] ?? "")) {
|
|
769
|
+
tableEnd = next;
|
|
770
|
+
break;
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
const expectedState = managedTrustState[header.key];
|
|
774
|
+
const removable = expectedState !== undefined &&
|
|
775
|
+
!header.hasInlineComment &&
|
|
776
|
+
isExactlyManagedHookTrustBody(lines.slice(i + 1, tableEnd), expectedState.trusted_hash);
|
|
777
|
+
if (removable) {
|
|
778
|
+
i = tableEnd;
|
|
695
779
|
continue;
|
|
696
780
|
}
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
return kept.join("\n").replace(/\n{3,}/g, "\n\n").trimEnd();
|
|
700
|
-
}
|
|
701
|
-
function managedCodexHookTrustStateHeaders(hookTrustToml) {
|
|
702
|
-
const headers = new Set();
|
|
703
|
-
for (const line of hookTrustToml.split(/\r?\n/)) {
|
|
704
|
-
const trimmed = line.trim();
|
|
705
|
-
if (/^\[hooks\.state\./.test(trimmed)) {
|
|
706
|
-
headers.add(trimmed);
|
|
781
|
+
if (expectedState !== undefined) {
|
|
782
|
+
preservedConflictKeys.add(header.key);
|
|
707
783
|
}
|
|
784
|
+
kept.push(...lines.slice(i, tableEnd));
|
|
785
|
+
i = tableEnd;
|
|
708
786
|
}
|
|
709
|
-
return
|
|
787
|
+
return { config: kept.join("\n"), preservedConflictKeys };
|
|
710
788
|
}
|
|
711
|
-
function
|
|
712
|
-
const managedHeaders = managedCodexHookTrustStateHeaders(hookTrustToml);
|
|
713
|
-
if (managedHeaders.size === 0)
|
|
714
|
-
return config;
|
|
789
|
+
function stripManagedCodexHookTrustStateWithResult(config, options = {}) {
|
|
715
790
|
const lines = config.split(/\r?\n/);
|
|
716
791
|
const kept = [];
|
|
717
792
|
for (let i = 0; i < lines.length;) {
|
|
718
|
-
|
|
793
|
+
const trimmed = lines[i].trim();
|
|
794
|
+
if (trimmed !== OMX_HOOK_TRUST_START_MARKER) {
|
|
719
795
|
kept.push(lines[i]);
|
|
720
796
|
i += 1;
|
|
721
797
|
continue;
|
|
722
798
|
}
|
|
723
|
-
i
|
|
724
|
-
|
|
799
|
+
const nextEndIdx = lines.findIndex((line, index) => index > i && line.trim() === OMX_HOOK_TRUST_END_MARKER);
|
|
800
|
+
const nextStartIdx = lines.findIndex((line, index) => index > i && line.trim() === OMX_HOOK_TRUST_START_MARKER);
|
|
801
|
+
if (nextEndIdx === -1 || (nextStartIdx !== -1 && nextStartIdx < nextEndIdx)) {
|
|
802
|
+
kept.push(lines[i]);
|
|
725
803
|
i += 1;
|
|
804
|
+
continue;
|
|
726
805
|
}
|
|
806
|
+
i = nextEndIdx + 1;
|
|
727
807
|
}
|
|
728
|
-
|
|
808
|
+
const withoutFenced = kept.join("\n");
|
|
809
|
+
const proofStripped = options.managedTrustState
|
|
810
|
+
? stripProofManagedCodexHookTrustStateTables(withoutFenced, options.managedTrustState)
|
|
811
|
+
: { config: withoutFenced, preservedConflictKeys: new Set() };
|
|
812
|
+
return {
|
|
813
|
+
config: proofStripped.config.replace(/\n{3,}/g, "\n\n").trimEnd(),
|
|
814
|
+
preservedConflictKeys: proofStripped.preservedConflictKeys,
|
|
815
|
+
};
|
|
816
|
+
}
|
|
817
|
+
export function stripManagedCodexHookTrustState(config, options = {}) {
|
|
818
|
+
return stripManagedCodexHookTrustStateWithResult(config, options).config;
|
|
819
|
+
}
|
|
820
|
+
function renderManagedCodexHookTrustToml(managedTrustState, excludedKeys = new Set()) {
|
|
821
|
+
return Object.entries(managedTrustState)
|
|
822
|
+
.filter(([key]) => !excludedKeys.has(key))
|
|
823
|
+
.sort(([left], [right]) => left.localeCompare(right))
|
|
824
|
+
.flatMap(([key, hookState]) => [
|
|
825
|
+
`[hooks.state."${escapeTomlBasicString(key)}"]`,
|
|
826
|
+
`trusted_hash = "${escapeTomlBasicString(hookState.trusted_hash)}"`,
|
|
827
|
+
"",
|
|
828
|
+
])
|
|
829
|
+
.join("\n")
|
|
830
|
+
.trimEnd();
|
|
831
|
+
}
|
|
832
|
+
function buildManagedCodexHookTrustStateForConfig(codexHooksFile, pkgRoot, options = {}) {
|
|
833
|
+
if (!codexHooksFile)
|
|
834
|
+
return {};
|
|
835
|
+
return buildManagedCodexHookTrustState(codexHooksFile, pkgRoot, options);
|
|
729
836
|
}
|
|
730
837
|
export function upsertManagedCodexHookTrustState(config, pkgRoot, codexHooksFile, options = {}) {
|
|
731
|
-
const
|
|
732
|
-
const
|
|
838
|
+
const managedTrustState = buildManagedCodexHookTrustStateForConfig(codexHooksFile, pkgRoot, options);
|
|
839
|
+
const strippedResult = stripManagedCodexHookTrustStateWithResult(config, {
|
|
840
|
+
managedTrustState,
|
|
841
|
+
});
|
|
842
|
+
const stripped = strippedResult.config;
|
|
843
|
+
const hookTrustToml = renderManagedCodexHookTrustToml(managedTrustState, strippedResult.preservedConflictKeys);
|
|
733
844
|
if (!hookTrustToml)
|
|
734
845
|
return `${stripped}\n`;
|
|
735
846
|
return [
|
|
@@ -1560,7 +1671,7 @@ export function mergeSharedMcpRegistryBlock(config, servers, sourcePath) {
|
|
|
1560
1671
|
* OMX table-section block (MCP servers, TUI).
|
|
1561
1672
|
* Contains ONLY [table] sections — no bare keys.
|
|
1562
1673
|
*/
|
|
1563
|
-
function getOmxTablesBlock(pkgRoot, includeTui = true, statusLinePreset = DEFAULT_STATUS_LINE_PRESET, codexHooksFile, hookOptions = {}, includeFirstPartyMcp = false) {
|
|
1674
|
+
function getOmxTablesBlock(pkgRoot, includeTui = true, statusLinePreset = DEFAULT_STATUS_LINE_PRESET, codexHooksFile, hookOptions = {}, includeFirstPartyMcp = false, excludedHookTrustStateKeys = new Set()) {
|
|
1564
1675
|
const lines = [
|
|
1565
1676
|
"",
|
|
1566
1677
|
"# ============================================================",
|
|
@@ -1583,7 +1694,7 @@ function getOmxTablesBlock(pkgRoot, includeTui = true, statusLinePreset = DEFAUL
|
|
|
1583
1694
|
}
|
|
1584
1695
|
}
|
|
1585
1696
|
}
|
|
1586
|
-
const hookTrustToml =
|
|
1697
|
+
const hookTrustToml = renderManagedCodexHookTrustToml(buildManagedCodexHookTrustStateForConfig(codexHooksFile, pkgRoot, hookOptions), excludedHookTrustStateKeys);
|
|
1587
1698
|
if (hookTrustToml) {
|
|
1588
1699
|
lines.push("");
|
|
1589
1700
|
lines.push("# OMX-owned Codex hook trust state");
|
|
@@ -1616,7 +1727,7 @@ function getOmxTablesBlock(pkgRoot, includeTui = true, statusLinePreset = DEFAUL
|
|
|
1616
1727
|
* Layout:
|
|
1617
1728
|
* 1. OMX top-level keys (notify, model_reasoning_effort, developer_instructions)
|
|
1618
1729
|
* 2. [features] with multi_agent + child_agents_md + hooks + goals
|
|
1619
|
-
* 3. [shell_environment_policy.set] with defaulted explore-routing opt-
|
|
1730
|
+
* 3. [shell_environment_policy.set] with defaulted deprecated explore-routing opt-out
|
|
1620
1731
|
* 4. … user sections …
|
|
1621
1732
|
* 5. OMX [table] sections (mcp_servers, tui)
|
|
1622
1733
|
*/
|
|
@@ -1649,11 +1760,14 @@ export function buildMergedConfig(existingConfig, pkgRoot, options = {}) {
|
|
|
1649
1760
|
existing = `${`notify = ${formatTomlStringArray(userNotifyToPreserve)}`}\n${existing.trimStart()}`;
|
|
1650
1761
|
}
|
|
1651
1762
|
existing = stripOrphanedManagedNotify(existing, pkgRoot);
|
|
1652
|
-
|
|
1653
|
-
existing = stripUnfencedManagedCodexHookTrustState(existing, buildManagedCodexHookTrustToml(options.codexHooksFile, pkgRoot, {
|
|
1763
|
+
const managedTrustState = buildManagedCodexHookTrustStateForConfig(options.codexHooksFile, pkgRoot, {
|
|
1654
1764
|
codexHomeDir: options.codexHomeDir,
|
|
1655
1765
|
platform: options.hookCommandPlatform,
|
|
1656
|
-
})
|
|
1766
|
+
});
|
|
1767
|
+
const hookTrustStrip = stripManagedCodexHookTrustStateWithResult(existing, {
|
|
1768
|
+
managedTrustState,
|
|
1769
|
+
});
|
|
1770
|
+
existing = hookTrustStrip.config;
|
|
1657
1771
|
if (options.modelOverride) {
|
|
1658
1772
|
existing = stripRootLevelKeys(existing, ["model"]);
|
|
1659
1773
|
}
|
|
@@ -1676,7 +1790,7 @@ export function buildMergedConfig(existingConfig, pkgRoot, options = {}) {
|
|
|
1676
1790
|
const tablesBlock = getOmxTablesBlock(pkgRoot, includeTui && !tuiUpsert.hadExistingTui, statusLinePreset, options.codexHooksFile, {
|
|
1677
1791
|
codexHomeDir: options.codexHomeDir,
|
|
1678
1792
|
platform: options.hookCommandPlatform,
|
|
1679
|
-
}, options.includeFirstPartyMcp === true);
|
|
1793
|
+
}, options.includeFirstPartyMcp === true, hookTrustStrip.preservedConflictKeys);
|
|
1680
1794
|
const sharedRegistryBlock = getSharedMcpRegistryBlock(options.sharedMcpServers ?? [], options.sharedMcpRegistrySource, existing);
|
|
1681
1795
|
let body = existing.trimEnd();
|
|
1682
1796
|
if (sharedRegistryBlock) {
|