oh-my-codex 0.1.1
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/README.md +269 -0
- package/bin/omx.js +25 -0
- package/dist/agents/definitions.d.ts +22 -0
- package/dist/agents/definitions.d.ts.map +1 -0
- package/dist/agents/definitions.js +235 -0
- package/dist/agents/definitions.js.map +1 -0
- package/dist/cli/doctor.d.ts +11 -0
- package/dist/cli/doctor.d.ts.map +1 -0
- package/dist/cli/doctor.js +157 -0
- package/dist/cli/doctor.js.map +1 -0
- package/dist/cli/index.d.ts +6 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +266 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/setup.d.ts +12 -0
- package/dist/cli/setup.d.ts.map +1 -0
- package/dist/cli/setup.js +175 -0
- package/dist/cli/setup.js.map +1 -0
- package/dist/cli/version.d.ts +2 -0
- package/dist/cli/version.d.ts.map +1 -0
- package/dist/cli/version.js +17 -0
- package/dist/cli/version.js.map +1 -0
- package/dist/config/generator.d.ts +14 -0
- package/dist/config/generator.d.ts.map +1 -0
- package/dist/config/generator.js +106 -0
- package/dist/config/generator.js.map +1 -0
- package/dist/hooks/__tests__/agents-overlay.test.d.ts +8 -0
- package/dist/hooks/__tests__/agents-overlay.test.d.ts.map +1 -0
- package/dist/hooks/__tests__/agents-overlay.test.js +148 -0
- package/dist/hooks/__tests__/agents-overlay.test.js.map +1 -0
- package/dist/hooks/agents-overlay.d.ts +34 -0
- package/dist/hooks/agents-overlay.d.ts.map +1 -0
- package/dist/hooks/agents-overlay.js +265 -0
- package/dist/hooks/agents-overlay.js.map +1 -0
- package/dist/hooks/emulator.d.ts +44 -0
- package/dist/hooks/emulator.d.ts.map +1 -0
- package/dist/hooks/emulator.js +108 -0
- package/dist/hooks/emulator.js.map +1 -0
- package/dist/hooks/keyword-detector.d.ts +27 -0
- package/dist/hooks/keyword-detector.d.ts.map +1 -0
- package/dist/hooks/keyword-detector.js +63 -0
- package/dist/hooks/keyword-detector.js.map +1 -0
- package/dist/hooks/session.d.ts +38 -0
- package/dist/hooks/session.d.ts.map +1 -0
- package/dist/hooks/session.js +135 -0
- package/dist/hooks/session.js.map +1 -0
- package/dist/hud/colors.d.ts +26 -0
- package/dist/hud/colors.d.ts.map +1 -0
- package/dist/hud/colors.js +71 -0
- package/dist/hud/colors.js.map +1 -0
- package/dist/hud/index.d.ts +12 -0
- package/dist/hud/index.d.ts.map +1 -0
- package/dist/hud/index.js +107 -0
- package/dist/hud/index.js.map +1 -0
- package/dist/hud/render.d.ts +9 -0
- package/dist/hud/render.d.ts.map +1 -0
- package/dist/hud/render.js +192 -0
- package/dist/hud/render.js.map +1 -0
- package/dist/hud/state.d.ts +21 -0
- package/dist/hud/state.d.ts.map +1 -0
- package/dist/hud/state.js +101 -0
- package/dist/hud/state.js.map +1 -0
- package/dist/hud/types.d.ts +87 -0
- package/dist/hud/types.d.ts.map +1 -0
- package/dist/hud/types.js +8 -0
- package/dist/hud/types.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp/code-intel-server.d.ts +7 -0
- package/dist/mcp/code-intel-server.d.ts.map +1 -0
- package/dist/mcp/code-intel-server.js +567 -0
- package/dist/mcp/code-intel-server.js.map +1 -0
- package/dist/mcp/memory-server.d.ts +7 -0
- package/dist/mcp/memory-server.d.ts.map +1 -0
- package/dist/mcp/memory-server.js +359 -0
- package/dist/mcp/memory-server.js.map +1 -0
- package/dist/mcp/state-server.d.ts +7 -0
- package/dist/mcp/state-server.d.ts.map +1 -0
- package/dist/mcp/state-server.js +181 -0
- package/dist/mcp/state-server.js.map +1 -0
- package/dist/mcp/trace-server.d.ts +7 -0
- package/dist/mcp/trace-server.d.ts.map +1 -0
- package/dist/mcp/trace-server.js +205 -0
- package/dist/mcp/trace-server.js.map +1 -0
- package/dist/modes/base.d.ts +50 -0
- package/dist/modes/base.d.ts.map +1 -0
- package/dist/modes/base.js +140 -0
- package/dist/modes/base.js.map +1 -0
- package/dist/notifications/notifier.d.ts +30 -0
- package/dist/notifications/notifier.d.ts.map +1 -0
- package/dist/notifications/notifier.js +124 -0
- package/dist/notifications/notifier.js.map +1 -0
- package/dist/team/orchestrator.d.ts +54 -0
- package/dist/team/orchestrator.d.ts.map +1 -0
- package/dist/team/orchestrator.js +106 -0
- package/dist/team/orchestrator.js.map +1 -0
- package/dist/utils/package.d.ts +9 -0
- package/dist/utils/package.d.ts.map +1 -0
- package/dist/utils/package.js +31 -0
- package/dist/utils/package.js.map +1 -0
- package/dist/utils/paths.d.ts +27 -0
- package/dist/utils/paths.d.ts.map +1 -0
- package/dist/utils/paths.js +60 -0
- package/dist/utils/paths.js.map +1 -0
- package/dist/verification/verifier.d.ts +32 -0
- package/dist/verification/verifier.d.ts.map +1 -0
- package/dist/verification/verifier.js +81 -0
- package/dist/verification/verifier.js.map +1 -0
- package/package.json +54 -0
- package/prompts/analyst.md +110 -0
- package/prompts/api-reviewer.md +98 -0
- package/prompts/architect.md +109 -0
- package/prompts/build-fixer.md +89 -0
- package/prompts/code-reviewer.md +105 -0
- package/prompts/critic.md +87 -0
- package/prompts/debugger.md +93 -0
- package/prompts/deep-executor.md +112 -0
- package/prompts/dependency-expert.md +99 -0
- package/prompts/designer.md +103 -0
- package/prompts/executor.md +99 -0
- package/prompts/explore.md +112 -0
- package/prompts/git-master.md +92 -0
- package/prompts/information-architect.md +267 -0
- package/prompts/performance-reviewer.md +94 -0
- package/prompts/planner.md +116 -0
- package/prompts/product-analyst.md +299 -0
- package/prompts/product-manager.md +255 -0
- package/prompts/qa-tester.md +98 -0
- package/prompts/quality-reviewer.md +105 -0
- package/prompts/quality-strategist.md +227 -0
- package/prompts/researcher.md +96 -0
- package/prompts/scientist.md +92 -0
- package/prompts/security-reviewer.md +125 -0
- package/prompts/style-reviewer.md +87 -0
- package/prompts/test-engineer.md +103 -0
- package/prompts/ux-researcher.md +282 -0
- package/prompts/verifier.md +95 -0
- package/prompts/vision.md +75 -0
- package/prompts/writer.md +86 -0
- package/scripts/notify-hook.js +237 -0
- package/skills/analyze/SKILL.md +93 -0
- package/skills/autopilot/SKILL.md +175 -0
- package/skills/build-fix/SKILL.md +123 -0
- package/skills/cancel/SKILL.md +387 -0
- package/skills/code-review/SKILL.md +208 -0
- package/skills/configure-discord/SKILL.md +256 -0
- package/skills/configure-telegram/SKILL.md +232 -0
- package/skills/deepinit/SKILL.md +320 -0
- package/skills/deepsearch/SKILL.md +38 -0
- package/skills/doctor/SKILL.md +193 -0
- package/skills/ecomode/SKILL.md +114 -0
- package/skills/frontend-ui-ux/SKILL.md +34 -0
- package/skills/git-master/SKILL.md +29 -0
- package/skills/help/SKILL.md +192 -0
- package/skills/hud/SKILL.md +97 -0
- package/skills/learn-about-omx/SKILL.md +37 -0
- package/skills/learner/SKILL.md +135 -0
- package/skills/note/SKILL.md +62 -0
- package/skills/omx-setup/SKILL.md +1147 -0
- package/skills/pipeline/SKILL.md +407 -0
- package/skills/plan/SKILL.md +223 -0
- package/skills/project-session-manager/SKILL.md +560 -0
- package/skills/psm/SKILL.md +20 -0
- package/skills/ralph/SKILL.md +197 -0
- package/skills/ralph-init/SKILL.md +38 -0
- package/skills/ralplan/SKILL.md +34 -0
- package/skills/release/SKILL.md +83 -0
- package/skills/research/SKILL.md +510 -0
- package/skills/review/SKILL.md +30 -0
- package/skills/security-review/SKILL.md +284 -0
- package/skills/skill/SKILL.md +837 -0
- package/skills/swarm/SKILL.md +25 -0
- package/skills/tdd/SKILL.md +106 -0
- package/skills/team/SKILL.md +860 -0
- package/skills/trace/SKILL.md +33 -0
- package/skills/ultrapilot/SKILL.md +632 -0
- package/skills/ultraqa/SKILL.md +130 -0
- package/skills/ultrawork/SKILL.md +143 -0
- package/skills/writer-memory/SKILL.md +443 -0
- package/templates/AGENTS.md +326 -0
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AGENTS.md Runtime Overlay for oh-my-codex
|
|
3
|
+
*
|
|
4
|
+
* Dynamically injects session-specific context into AGENTS.md before Codex
|
|
5
|
+
* launches, then strips it after session ends. Uses marker-bounded sections
|
|
6
|
+
* for idempotent apply/strip cycles.
|
|
7
|
+
*
|
|
8
|
+
* Injected context:
|
|
9
|
+
* - Active mode state (ralph iteration, autopilot phase, etc.)
|
|
10
|
+
* - Priority notepad content
|
|
11
|
+
* - Project memory summary (tech stack, conventions, directives)
|
|
12
|
+
* - Compaction survival instructions
|
|
13
|
+
* - Session metadata
|
|
14
|
+
*/
|
|
15
|
+
import { readFile, writeFile, mkdir, rm } from 'fs/promises';
|
|
16
|
+
import { join } from 'path';
|
|
17
|
+
import { existsSync } from 'fs';
|
|
18
|
+
import { omxStateDir, omxNotepadPath, omxProjectMemoryPath } from '../utils/paths.js';
|
|
19
|
+
const START_MARKER = '<!-- OMX:RUNTIME:START -->';
|
|
20
|
+
const END_MARKER = '<!-- OMX:RUNTIME:END -->';
|
|
21
|
+
const MAX_OVERLAY_SIZE = 2000;
|
|
22
|
+
// ── Lock helpers ─────────────────────────────────────────────────────────────
|
|
23
|
+
function lockPath(cwd) {
|
|
24
|
+
return join(cwd, '.omx', 'state', 'agents-md.lock');
|
|
25
|
+
}
|
|
26
|
+
async function acquireLock(cwd, timeoutMs = 5000) {
|
|
27
|
+
const lock = lockPath(cwd);
|
|
28
|
+
// Ensure parent directory exists
|
|
29
|
+
const { dirname } = await import('path');
|
|
30
|
+
await mkdir(dirname(lock), { recursive: true });
|
|
31
|
+
const start = Date.now();
|
|
32
|
+
while (Date.now() - start < timeoutMs) {
|
|
33
|
+
try {
|
|
34
|
+
await mkdir(lock, { recursive: false });
|
|
35
|
+
// Write owner metadata for stale detection
|
|
36
|
+
const ownerFile = join(lock, 'owner.json');
|
|
37
|
+
await writeFile(ownerFile, JSON.stringify({ pid: process.pid, ts: Date.now() }));
|
|
38
|
+
return; // Lock acquired
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
// Lock exists - check if owner is dead
|
|
42
|
+
try {
|
|
43
|
+
const ownerFile = join(lock, 'owner.json');
|
|
44
|
+
const ownerData = JSON.parse(await readFile(ownerFile, 'utf-8'));
|
|
45
|
+
try {
|
|
46
|
+
process.kill(ownerData.pid, 0);
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
// Owner PID is dead, safe to reap
|
|
50
|
+
await rm(lock, { recursive: true, force: true }).catch(() => { });
|
|
51
|
+
continue; // Retry acquire immediately
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
catch { /* no owner file or parse error, wait */ }
|
|
55
|
+
await new Promise(r => setTimeout(r, 100));
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
// Timeout: do NOT silently proceed - throw so caller knows lock failed
|
|
59
|
+
throw new Error('Failed to acquire AGENTS.md lock within timeout');
|
|
60
|
+
}
|
|
61
|
+
async function releaseLock(cwd) {
|
|
62
|
+
try {
|
|
63
|
+
await rm(lockPath(cwd), { recursive: true, force: true });
|
|
64
|
+
}
|
|
65
|
+
catch { /* ignore */ }
|
|
66
|
+
}
|
|
67
|
+
async function withAgentsMdLock(cwd, fn) {
|
|
68
|
+
await acquireLock(cwd);
|
|
69
|
+
try {
|
|
70
|
+
return await fn();
|
|
71
|
+
}
|
|
72
|
+
finally {
|
|
73
|
+
await releaseLock(cwd);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
// ── Truncation helpers ───────────────────────────────────────────────────────
|
|
77
|
+
function truncate(text, maxLen) {
|
|
78
|
+
if (text.length <= maxLen)
|
|
79
|
+
return text;
|
|
80
|
+
return text.slice(0, maxLen - 3) + '...';
|
|
81
|
+
}
|
|
82
|
+
async function readActiveModes(cwd) {
|
|
83
|
+
const stateDir = omxStateDir(cwd);
|
|
84
|
+
if (!existsSync(stateDir))
|
|
85
|
+
return '';
|
|
86
|
+
const { readdir } = await import('fs/promises');
|
|
87
|
+
const files = await readdir(stateDir);
|
|
88
|
+
const modes = [];
|
|
89
|
+
for (const f of files) {
|
|
90
|
+
if (!f.endsWith('-state.json') || f === 'session.json')
|
|
91
|
+
continue;
|
|
92
|
+
try {
|
|
93
|
+
const data = JSON.parse(await readFile(join(stateDir, f), 'utf-8'));
|
|
94
|
+
if (data.active) {
|
|
95
|
+
const mode = f.replace('-state.json', '');
|
|
96
|
+
const details = [];
|
|
97
|
+
if (data.iteration !== undefined)
|
|
98
|
+
details.push(`iteration ${data.iteration}/${data.max_iterations || '?'}`);
|
|
99
|
+
if (data.current_phase)
|
|
100
|
+
details.push(`phase: ${data.current_phase}`);
|
|
101
|
+
modes.push(`- ${mode}: ${details.join(', ') || 'active'}`);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
catch { /* skip malformed */ }
|
|
105
|
+
}
|
|
106
|
+
return modes.length > 0 ? modes.join('\n') : '';
|
|
107
|
+
}
|
|
108
|
+
async function readNotepadPriority(cwd) {
|
|
109
|
+
const notePath = omxNotepadPath(cwd);
|
|
110
|
+
if (!existsSync(notePath))
|
|
111
|
+
return '';
|
|
112
|
+
try {
|
|
113
|
+
const content = await readFile(notePath, 'utf-8');
|
|
114
|
+
const header = '## PRIORITY';
|
|
115
|
+
const idx = content.indexOf(header);
|
|
116
|
+
if (idx < 0)
|
|
117
|
+
return '';
|
|
118
|
+
const nextHeader = content.indexOf('\n## ', idx + header.length);
|
|
119
|
+
const section = nextHeader < 0
|
|
120
|
+
? content.slice(idx + header.length).trim()
|
|
121
|
+
: content.slice(idx + header.length, nextHeader).trim();
|
|
122
|
+
return section || '';
|
|
123
|
+
}
|
|
124
|
+
catch {
|
|
125
|
+
return '';
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
async function readProjectMemorySummary(cwd) {
|
|
129
|
+
const memPath = omxProjectMemoryPath(cwd);
|
|
130
|
+
if (!existsSync(memPath))
|
|
131
|
+
return '';
|
|
132
|
+
try {
|
|
133
|
+
const data = JSON.parse(await readFile(memPath, 'utf-8'));
|
|
134
|
+
const parts = [];
|
|
135
|
+
if (data.techStack)
|
|
136
|
+
parts.push(`- Stack: ${data.techStack}`);
|
|
137
|
+
if (data.conventions)
|
|
138
|
+
parts.push(`- Conventions: ${data.conventions}`);
|
|
139
|
+
if (data.build)
|
|
140
|
+
parts.push(`- Build: ${data.build}`);
|
|
141
|
+
if (data.directives && Array.isArray(data.directives)) {
|
|
142
|
+
const highPriority = data.directives.filter((d) => d.priority === 'high');
|
|
143
|
+
for (const d of highPriority.slice(0, 3)) {
|
|
144
|
+
parts.push(`- Directive: ${d.directive}`);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
return parts.join('\n');
|
|
148
|
+
}
|
|
149
|
+
catch {
|
|
150
|
+
return '';
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
function getCompactionInstructions() {
|
|
154
|
+
return [
|
|
155
|
+
'Before context compaction, preserve critical state:',
|
|
156
|
+
'1. Write progress checkpoint via state_write MCP tool',
|
|
157
|
+
'2. Save key decisions to notepad via notepad_write_working',
|
|
158
|
+
'3. If context is >80% full, proactively checkpoint state',
|
|
159
|
+
].join('\n');
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Generate the overlay content to inject into AGENTS.md.
|
|
163
|
+
* Total output is capped at MAX_OVERLAY_SIZE chars.
|
|
164
|
+
*/
|
|
165
|
+
export async function generateOverlay(cwd, sessionId) {
|
|
166
|
+
const [activeModes, notepadPriority, projectMemory] = await Promise.all([
|
|
167
|
+
readActiveModes(cwd),
|
|
168
|
+
readNotepadPriority(cwd),
|
|
169
|
+
readProjectMemorySummary(cwd),
|
|
170
|
+
]);
|
|
171
|
+
// Build sections with priority-ordered truncation
|
|
172
|
+
const sections = [];
|
|
173
|
+
// Session metadata (max 200 chars)
|
|
174
|
+
const sessionMeta = `**Session:** ${sessionId || 'unknown'} | ${new Date().toISOString()}`;
|
|
175
|
+
sections.push(truncate(sessionMeta, 200));
|
|
176
|
+
// Active modes (max 300 chars)
|
|
177
|
+
if (activeModes) {
|
|
178
|
+
sections.push(`**Active Modes:**\n${truncate(activeModes, 280)}`);
|
|
179
|
+
}
|
|
180
|
+
// Priority notepad (max 300 chars)
|
|
181
|
+
if (notepadPriority) {
|
|
182
|
+
sections.push(`**Priority Notes:**\n${truncate(notepadPriority, 280)}`);
|
|
183
|
+
}
|
|
184
|
+
// Project memory (max 500 chars)
|
|
185
|
+
if (projectMemory) {
|
|
186
|
+
sections.push(`**Project Context:**\n${truncate(projectMemory, 480)}`);
|
|
187
|
+
}
|
|
188
|
+
// Compaction protocol (max 400 chars)
|
|
189
|
+
sections.push(`**Compaction Protocol:**\n${truncate(getCompactionInstructions(), 380)}`);
|
|
190
|
+
// Compose final overlay
|
|
191
|
+
let body = sections.join('\n\n');
|
|
192
|
+
// Ensure total fits within cap (markers + body)
|
|
193
|
+
const markerOverhead = START_MARKER.length + END_MARKER.length + 30; // newlines
|
|
194
|
+
const maxBody = MAX_OVERLAY_SIZE - markerOverhead;
|
|
195
|
+
if (body.length > maxBody) {
|
|
196
|
+
body = body.slice(0, maxBody - 3) + '...';
|
|
197
|
+
}
|
|
198
|
+
return `${START_MARKER}\n<session_context>\n${body}\n</session_context>\n${END_MARKER}`;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Apply overlay to AGENTS.md. Strips any existing overlay first (idempotent).
|
|
202
|
+
* Uses file locking to prevent concurrent access corruption.
|
|
203
|
+
*/
|
|
204
|
+
export async function applyOverlay(agentsMdPath, overlay, cwd) {
|
|
205
|
+
const dir = cwd || join(agentsMdPath, '..');
|
|
206
|
+
await withAgentsMdLock(dir, async () => {
|
|
207
|
+
let content = '';
|
|
208
|
+
if (existsSync(agentsMdPath)) {
|
|
209
|
+
content = await readFile(agentsMdPath, 'utf-8');
|
|
210
|
+
}
|
|
211
|
+
// Strip existing overlay
|
|
212
|
+
content = stripOverlayContent(content);
|
|
213
|
+
// Append new overlay
|
|
214
|
+
content = content.trimEnd() + '\n\n' + overlay + '\n';
|
|
215
|
+
await writeFile(agentsMdPath, content);
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Strip overlay from AGENTS.md, restoring it to clean state.
|
|
220
|
+
* Uses file locking to prevent concurrent access corruption.
|
|
221
|
+
*/
|
|
222
|
+
export async function stripOverlay(agentsMdPath, cwd) {
|
|
223
|
+
if (!existsSync(agentsMdPath))
|
|
224
|
+
return;
|
|
225
|
+
const dir = cwd || join(agentsMdPath, '..');
|
|
226
|
+
await withAgentsMdLock(dir, async () => {
|
|
227
|
+
const content = await readFile(agentsMdPath, 'utf-8');
|
|
228
|
+
const stripped = stripOverlayContent(content);
|
|
229
|
+
if (stripped !== content) {
|
|
230
|
+
await writeFile(agentsMdPath, stripped);
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Remove overlay markers and content from a string (pure function).
|
|
236
|
+
*/
|
|
237
|
+
function stripOverlayContent(content) {
|
|
238
|
+
// Strip all marker-bounded segments (handles multiple overlays from corruption)
|
|
239
|
+
let result = content;
|
|
240
|
+
let iterations = 0;
|
|
241
|
+
const MAX_STRIP_ITERATIONS = 5; // Safety bound
|
|
242
|
+
while (iterations < MAX_STRIP_ITERATIONS) {
|
|
243
|
+
const startIdx = result.indexOf(START_MARKER);
|
|
244
|
+
if (startIdx < 0)
|
|
245
|
+
break;
|
|
246
|
+
const endIdx = result.indexOf(END_MARKER, startIdx);
|
|
247
|
+
if (endIdx < 0) {
|
|
248
|
+
// Malformed: remove from start marker to end of file
|
|
249
|
+
result = result.slice(0, startIdx).trimEnd() + '\n';
|
|
250
|
+
break;
|
|
251
|
+
}
|
|
252
|
+
const before = result.slice(0, startIdx).trimEnd();
|
|
253
|
+
const after = result.slice(endIdx + END_MARKER.length).trimStart();
|
|
254
|
+
result = after ? before + '\n' + after : before + '\n';
|
|
255
|
+
iterations++;
|
|
256
|
+
}
|
|
257
|
+
return result;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Check if AGENTS.md currently has an overlay applied.
|
|
261
|
+
*/
|
|
262
|
+
export function hasOverlay(content) {
|
|
263
|
+
return content.includes(START_MARKER) && content.includes(END_MARKER);
|
|
264
|
+
}
|
|
265
|
+
//# sourceMappingURL=agents-overlay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agents-overlay.js","sourceRoot":"","sources":["../../src/hooks/agents-overlay.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAEtF,MAAM,YAAY,GAAG,4BAA4B,CAAC;AAClD,MAAM,UAAU,GAAG,0BAA0B,CAAC;AAC9C,MAAM,gBAAgB,GAAG,IAAI,CAAC;AAE9B,gFAAgF;AAEhF,SAAS,QAAQ,CAAC,GAAW;IAC3B,OAAO,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,CAAC,CAAC;AACtD,CAAC;AAED,KAAK,UAAU,WAAW,CAAC,GAAW,EAAE,YAAoB,IAAI;IAC9D,MAAM,IAAI,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;IAC3B,iCAAiC;IACjC,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,CAAC;IACzC,MAAM,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAEhD,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IACzB,OAAO,IAAI,CA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,CAAC;YAAE,MAAM;QAExB,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;QACpD,IAAI,MAAM,GAAG,CAAC,EAAE,CAAC;YACf,qDAAqD;YACrD,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC;YACpD,MAAM;QACR,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,OAAO,EAAE,CAAC;QACnD,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,CAAC;QACnE,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,MAAM,GAAG,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,MAAM,GAAG,IAAI,CAAC;QACvD,UAAU,EAAE,CAAC;IACf,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,OAAe;IACxC,OAAO,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;AACxE,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook Emulation Layer for oh-my-codex
|
|
3
|
+
*
|
|
4
|
+
* Since Codex CLI's hooks are limited (AfterAgent + AfterToolUse only, fire-and-forget),
|
|
5
|
+
* we emulate the full OMC hook pipeline through alternative mechanisms:
|
|
6
|
+
*
|
|
7
|
+
* 1. SessionStart -> AGENTS.md (native Codex CLI, no hook needed)
|
|
8
|
+
* 2. PreToolUse -> AGENTS.md instructions (inline guidance, no hook needed)
|
|
9
|
+
* 3. PostToolUse -> notify config (fire-and-forget, no context injection)
|
|
10
|
+
* 4. UserPromptSubmit -> AGENTS.md keyword detection instructions
|
|
11
|
+
* 5. SubagentStart/Stop -> Codex CLI collab system (native tracking)
|
|
12
|
+
* 6. PreCompact -> Not available (Codex manages compaction internally)
|
|
13
|
+
* 7. Stop -> notify config (can detect turn completion)
|
|
14
|
+
*
|
|
15
|
+
* For features that require context injection (keyword detection triggering
|
|
16
|
+
* skill loading), we rely on the AGENTS.md orchestration brain to instruct
|
|
17
|
+
* the model to self-invoke skills when it detects keywords.
|
|
18
|
+
*
|
|
19
|
+
* This is the key architectural difference from OMC:
|
|
20
|
+
* - OMC: External hook detects keyword -> injects skill prompt via system-reminder
|
|
21
|
+
* - OMX: AGENTS.md instructs model -> model self-detects keyword -> model loads skill
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* Hook event types (for compatibility with OMC concepts)
|
|
25
|
+
*/
|
|
26
|
+
export type HookEvent = 'SessionStart' | 'PreToolUse' | 'PostToolUse' | 'UserPromptSubmit' | 'SubagentStart' | 'SubagentStop' | 'PreCompact' | 'Stop' | 'SessionEnd';
|
|
27
|
+
/**
|
|
28
|
+
* Mapping of OMC hook capabilities to OMX equivalents
|
|
29
|
+
*/
|
|
30
|
+
export declare const HOOK_MAPPING: Record<HookEvent, {
|
|
31
|
+
mechanism: string;
|
|
32
|
+
capability: 'full' | 'partial' | 'none';
|
|
33
|
+
notes: string;
|
|
34
|
+
}>;
|
|
35
|
+
/**
|
|
36
|
+
* Keyword detection configuration (embedded in AGENTS.md)
|
|
37
|
+
* Instead of external hook detection, the model is instructed to self-detect
|
|
38
|
+
*/
|
|
39
|
+
export declare const KEYWORD_TRIGGERS: Record<string, string>;
|
|
40
|
+
/**
|
|
41
|
+
* Generate the keyword detection section for AGENTS.md
|
|
42
|
+
*/
|
|
43
|
+
export declare function generateKeywordDetectionSection(): string;
|
|
44
|
+
//# sourceMappingURL=emulator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emulator.d.ts","sourceRoot":"","sources":["../../src/hooks/emulator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH;;GAEG;AACH,MAAM,MAAM,SAAS,GACjB,cAAc,GACd,YAAY,GACZ,aAAa,GACb,kBAAkB,GAClB,eAAe,GACf,cAAc,GACd,YAAY,GACZ,MAAM,GACN,YAAY,CAAC;AAEjB;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,SAAS,EAAE;IAC3C,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAAC;IACxC,KAAK,EAAE,MAAM,CAAC;CACf,CA8CA,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAanD,CAAC;AAEF;;GAEG;AACH,wBAAgB,+BAA+B,IAAI,MAAM,CAcxD"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook Emulation Layer for oh-my-codex
|
|
3
|
+
*
|
|
4
|
+
* Since Codex CLI's hooks are limited (AfterAgent + AfterToolUse only, fire-and-forget),
|
|
5
|
+
* we emulate the full OMC hook pipeline through alternative mechanisms:
|
|
6
|
+
*
|
|
7
|
+
* 1. SessionStart -> AGENTS.md (native Codex CLI, no hook needed)
|
|
8
|
+
* 2. PreToolUse -> AGENTS.md instructions (inline guidance, no hook needed)
|
|
9
|
+
* 3. PostToolUse -> notify config (fire-and-forget, no context injection)
|
|
10
|
+
* 4. UserPromptSubmit -> AGENTS.md keyword detection instructions
|
|
11
|
+
* 5. SubagentStart/Stop -> Codex CLI collab system (native tracking)
|
|
12
|
+
* 6. PreCompact -> Not available (Codex manages compaction internally)
|
|
13
|
+
* 7. Stop -> notify config (can detect turn completion)
|
|
14
|
+
*
|
|
15
|
+
* For features that require context injection (keyword detection triggering
|
|
16
|
+
* skill loading), we rely on the AGENTS.md orchestration brain to instruct
|
|
17
|
+
* the model to self-invoke skills when it detects keywords.
|
|
18
|
+
*
|
|
19
|
+
* This is the key architectural difference from OMC:
|
|
20
|
+
* - OMC: External hook detects keyword -> injects skill prompt via system-reminder
|
|
21
|
+
* - OMX: AGENTS.md instructs model -> model self-detects keyword -> model loads skill
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* Mapping of OMC hook capabilities to OMX equivalents
|
|
25
|
+
*/
|
|
26
|
+
export const HOOK_MAPPING = {
|
|
27
|
+
SessionStart: {
|
|
28
|
+
mechanism: 'AGENTS.md native loading + runtime overlay',
|
|
29
|
+
capability: 'full',
|
|
30
|
+
notes: 'Codex CLI reads AGENTS.md at start; omx preLaunch injects dynamic overlay (modes, notepad, memory, compaction protocol)',
|
|
31
|
+
},
|
|
32
|
+
PreToolUse: {
|
|
33
|
+
mechanism: 'AGENTS.md inline guidance',
|
|
34
|
+
capability: 'partial',
|
|
35
|
+
notes: 'No pre-tool interception, but AGENTS.md can instruct model behavior before tool use',
|
|
36
|
+
},
|
|
37
|
+
PostToolUse: {
|
|
38
|
+
mechanism: 'notify config (fire-and-forget)',
|
|
39
|
+
capability: 'partial',
|
|
40
|
+
notes: 'Can log and update state, but cannot inject context back into conversation',
|
|
41
|
+
},
|
|
42
|
+
UserPromptSubmit: {
|
|
43
|
+
mechanism: 'AGENTS.md self-detection instructions',
|
|
44
|
+
capability: 'partial',
|
|
45
|
+
notes: 'Model detects keywords via AGENTS.md instructions instead of external hook',
|
|
46
|
+
},
|
|
47
|
+
SubagentStart: {
|
|
48
|
+
mechanism: 'Codex CLI collab system',
|
|
49
|
+
capability: 'full',
|
|
50
|
+
notes: 'Native sub-agent lifecycle tracking via collab feature',
|
|
51
|
+
},
|
|
52
|
+
SubagentStop: {
|
|
53
|
+
mechanism: 'Codex CLI collab system',
|
|
54
|
+
capability: 'full',
|
|
55
|
+
notes: 'Native sub-agent lifecycle tracking via collab feature',
|
|
56
|
+
},
|
|
57
|
+
PreCompact: {
|
|
58
|
+
mechanism: 'AGENTS.md overlay compaction protocol',
|
|
59
|
+
capability: 'partial',
|
|
60
|
+
notes: 'Overlay includes compaction survival instructions; no event interception but model is instructed to checkpoint state',
|
|
61
|
+
},
|
|
62
|
+
Stop: {
|
|
63
|
+
mechanism: 'notify config + postLaunch cleanup',
|
|
64
|
+
capability: 'full',
|
|
65
|
+
notes: 'notify fires on agent-turn-complete; postLaunch strips overlay and archives session on exit',
|
|
66
|
+
},
|
|
67
|
+
SessionEnd: {
|
|
68
|
+
mechanism: 'omx postLaunch lifecycle phase',
|
|
69
|
+
capability: 'partial',
|
|
70
|
+
notes: 'postLaunch runs after Codex exits: strips overlay, archives session, cancels active modes',
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Keyword detection configuration (embedded in AGENTS.md)
|
|
75
|
+
* Instead of external hook detection, the model is instructed to self-detect
|
|
76
|
+
*/
|
|
77
|
+
export const KEYWORD_TRIGGERS = {
|
|
78
|
+
'autopilot': 'Activate autopilot skill for autonomous execution',
|
|
79
|
+
'ralph': 'Activate ralph persistence loop with verification',
|
|
80
|
+
'ultrawork': 'Activate ultrawork parallel execution mode',
|
|
81
|
+
'ulw': 'Activate ultrawork parallel execution mode',
|
|
82
|
+
'ecomode': 'Activate ecomode for token-efficient execution',
|
|
83
|
+
'eco': 'Activate ecomode for token-efficient execution',
|
|
84
|
+
'plan': 'Activate planning skill',
|
|
85
|
+
'ralplan': 'Activate consensus planning (planner + architect + critic)',
|
|
86
|
+
'team': 'Activate coordinated team mode',
|
|
87
|
+
'pipeline': 'Activate sequential pipeline mode',
|
|
88
|
+
'research': 'Activate parallel research mode',
|
|
89
|
+
'cancel': 'Cancel active execution modes',
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* Generate the keyword detection section for AGENTS.md
|
|
93
|
+
*/
|
|
94
|
+
export function generateKeywordDetectionSection() {
|
|
95
|
+
const lines = Object.entries(KEYWORD_TRIGGERS)
|
|
96
|
+
.map(([keyword, action]) => `- When user says "${keyword}": ${action}`)
|
|
97
|
+
.join('\n');
|
|
98
|
+
return `
|
|
99
|
+
<keyword_detection>
|
|
100
|
+
When you see these keywords in user messages, activate the corresponding skill:
|
|
101
|
+
${lines}
|
|
102
|
+
|
|
103
|
+
To activate a skill, use the corresponding slash command or invoke the skill directly.
|
|
104
|
+
If a keyword is detected, announce the activation to the user before proceeding.
|
|
105
|
+
</keyword_detection>
|
|
106
|
+
`;
|
|
107
|
+
}
|
|
108
|
+
//# sourceMappingURL=emulator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emulator.js","sourceRoot":"","sources":["../../src/hooks/emulator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAgBH;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAIpB;IACH,YAAY,EAAE;QACZ,SAAS,EAAE,4CAA4C;QACvD,UAAU,EAAE,MAAM;QAClB,KAAK,EAAE,yHAAyH;KACjI;IACD,UAAU,EAAE;QACV,SAAS,EAAE,2BAA2B;QACtC,UAAU,EAAE,SAAS;QACrB,KAAK,EAAE,qFAAqF;KAC7F;IACD,WAAW,EAAE;QACX,SAAS,EAAE,iCAAiC;QAC5C,UAAU,EAAE,SAAS;QACrB,KAAK,EAAE,4EAA4E;KACpF;IACD,gBAAgB,EAAE;QAChB,SAAS,EAAE,uCAAuC;QAClD,UAAU,EAAE,SAAS;QACrB,KAAK,EAAE,4EAA4E;KACpF;IACD,aAAa,EAAE;QACb,SAAS,EAAE,yBAAyB;QACpC,UAAU,EAAE,MAAM;QAClB,KAAK,EAAE,wDAAwD;KAChE;IACD,YAAY,EAAE;QACZ,SAAS,EAAE,yBAAyB;QACpC,UAAU,EAAE,MAAM;QAClB,KAAK,EAAE,wDAAwD;KAChE;IACD,UAAU,EAAE;QACV,SAAS,EAAE,uCAAuC;QAClD,UAAU,EAAE,SAAS;QACrB,KAAK,EAAE,sHAAsH;KAC9H;IACD,IAAI,EAAE;QACJ,SAAS,EAAE,oCAAoC;QAC/C,UAAU,EAAE,MAAM;QAClB,KAAK,EAAE,6FAA6F;KACrG;IACD,UAAU,EAAE;QACV,SAAS,EAAE,gCAAgC;QAC3C,UAAU,EAAE,SAAS;QACrB,KAAK,EAAE,2FAA2F;KACnG;CACF,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAA2B;IACtD,WAAW,EAAE,mDAAmD;IAChE,OAAO,EAAE,mDAAmD;IAC5D,WAAW,EAAE,4CAA4C;IACzD,KAAK,EAAE,4CAA4C;IACnD,SAAS,EAAE,gDAAgD;IAC3D,KAAK,EAAE,gDAAgD;IACvD,MAAM,EAAE,yBAAyB;IACjC,SAAS,EAAE,4DAA4D;IACvE,MAAM,EAAE,gCAAgC;IACxC,UAAU,EAAE,mCAAmC;IAC/C,UAAU,EAAE,iCAAiC;IAC7C,QAAQ,EAAE,+BAA+B;CAC1C,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,+BAA+B;IAC7C,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,gBAAgB,CAAC;SAC3C,GAAG,CAAC,CAAC,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,qBAAqB,OAAO,MAAM,MAAM,EAAE,CAAC;SACtE,IAAI,CAAC,IAAI,CAAC,CAAC;IAEd,OAAO;;;EAGP,KAAK;;;;;CAKN,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Keyword Detection Engine
|
|
3
|
+
*
|
|
4
|
+
* In OMC, this runs as a UserPromptSubmit hook that detects magic keywords
|
|
5
|
+
* and injects skill prompts via system-reminder.
|
|
6
|
+
*
|
|
7
|
+
* In OMX, this logic is embedded in the AGENTS.md orchestration brain,
|
|
8
|
+
* and can also be used by the notify hook for state tracking.
|
|
9
|
+
*
|
|
10
|
+
* When Codex CLI adds pre-hook support, this module can be promoted
|
|
11
|
+
* to an external hook handler.
|
|
12
|
+
*/
|
|
13
|
+
export interface KeywordMatch {
|
|
14
|
+
keyword: string;
|
|
15
|
+
skill: string;
|
|
16
|
+
priority: number;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Detect keywords in user input text
|
|
20
|
+
* Returns matching skills sorted by priority (highest first)
|
|
21
|
+
*/
|
|
22
|
+
export declare function detectKeywords(text: string): KeywordMatch[];
|
|
23
|
+
/**
|
|
24
|
+
* Get the highest-priority keyword match
|
|
25
|
+
*/
|
|
26
|
+
export declare function detectPrimaryKeyword(text: string): KeywordMatch | null;
|
|
27
|
+
//# sourceMappingURL=keyword-detector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keyword-detector.d.ts","sourceRoot":"","sources":["../../src/hooks/keyword-detector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB;AAgCD;;;GAGG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,EAAE,CAe3D;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,GAAG,IAAI,CAGtE"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Keyword Detection Engine
|
|
3
|
+
*
|
|
4
|
+
* In OMC, this runs as a UserPromptSubmit hook that detects magic keywords
|
|
5
|
+
* and injects skill prompts via system-reminder.
|
|
6
|
+
*
|
|
7
|
+
* In OMX, this logic is embedded in the AGENTS.md orchestration brain,
|
|
8
|
+
* and can also be used by the notify hook for state tracking.
|
|
9
|
+
*
|
|
10
|
+
* When Codex CLI adds pre-hook support, this module can be promoted
|
|
11
|
+
* to an external hook handler.
|
|
12
|
+
*/
|
|
13
|
+
const KEYWORD_MAP = [
|
|
14
|
+
// Execution modes
|
|
15
|
+
{ pattern: /\bautopilot\b/i, skill: 'autopilot', priority: 10 },
|
|
16
|
+
{ pattern: /\bralph\b/i, skill: 'ralph', priority: 10 },
|
|
17
|
+
{ pattern: /\bultrawork\b|\bulw\b/i, skill: 'ultrawork', priority: 10 },
|
|
18
|
+
{ pattern: /\becomode\b|\beco\b/i, skill: 'ecomode', priority: 10 },
|
|
19
|
+
{ pattern: /\bultrapilot\b/i, skill: 'ultrapilot', priority: 10 },
|
|
20
|
+
// Planning
|
|
21
|
+
{ pattern: /\bralplan\b/i, skill: 'ralplan', priority: 9 },
|
|
22
|
+
{ pattern: /\bplan\s+(?:this|the)\b/i, skill: 'plan', priority: 8 },
|
|
23
|
+
// Coordination
|
|
24
|
+
{ pattern: /\bteam\b.*\bagent/i, skill: 'team', priority: 8 },
|
|
25
|
+
{ pattern: /\bpipeline\b/i, skill: 'pipeline', priority: 8 },
|
|
26
|
+
{ pattern: /\bresearch\b/i, skill: 'research', priority: 7 },
|
|
27
|
+
// Shortcuts
|
|
28
|
+
{ pattern: /\banalyze\b|\bdebug\b|\binvestigate\b/i, skill: 'analyze', priority: 6 },
|
|
29
|
+
{ pattern: /\bdeepsearch\b|\bsearch.*codebase\b/i, skill: 'deepsearch', priority: 6 },
|
|
30
|
+
{ pattern: /\btdd\b|\btest.first\b/i, skill: 'tdd', priority: 6 },
|
|
31
|
+
{ pattern: /\bfix.build\b|\btype.errors?\b/i, skill: 'build-fix', priority: 6 },
|
|
32
|
+
{ pattern: /\breview.code\b|\bcode.review\b/i, skill: 'code-review', priority: 6 },
|
|
33
|
+
{ pattern: /\bsecurity.review\b/i, skill: 'security-review', priority: 6 },
|
|
34
|
+
{ pattern: /\bdeepinit\b/i, skill: 'deepinit', priority: 6 },
|
|
35
|
+
// Utilities
|
|
36
|
+
{ pattern: /\bcancel\b.*\b(?:mode|all)\b/i, skill: 'cancel', priority: 5 },
|
|
37
|
+
];
|
|
38
|
+
/**
|
|
39
|
+
* Detect keywords in user input text
|
|
40
|
+
* Returns matching skills sorted by priority (highest first)
|
|
41
|
+
*/
|
|
42
|
+
export function detectKeywords(text) {
|
|
43
|
+
const matches = [];
|
|
44
|
+
for (const { pattern, skill, priority } of KEYWORD_MAP) {
|
|
45
|
+
const match = text.match(pattern);
|
|
46
|
+
if (match) {
|
|
47
|
+
matches.push({
|
|
48
|
+
keyword: match[0],
|
|
49
|
+
skill,
|
|
50
|
+
priority,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return matches.sort((a, b) => b.priority - a.priority);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Get the highest-priority keyword match
|
|
58
|
+
*/
|
|
59
|
+
export function detectPrimaryKeyword(text) {
|
|
60
|
+
const matches = detectKeywords(text);
|
|
61
|
+
return matches.length > 0 ? matches[0] : null;
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=keyword-detector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keyword-detector.js","sourceRoot":"","sources":["../../src/hooks/keyword-detector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAQH,MAAM,WAAW,GAAgE;IAC/E,kBAAkB;IAClB,EAAE,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,EAAE,EAAE;IAC/D,EAAE,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE;IACvD,EAAE,OAAO,EAAE,wBAAwB,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,EAAE,EAAE;IACvE,EAAE,OAAO,EAAE,sBAAsB,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,EAAE;IACnE,EAAE,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,EAAE,EAAE;IAEjE,WAAW;IACX,EAAE,OAAO,EAAE,cAA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,GAAmB,EAAE,CAAC;IAEnC,KAAK,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,WAAW,EAAE,CAAC;QACvD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAClC,IAAI,KAAK,EAAE,CAAC;YACV,OAAO,CAAC,IAAI,CAAC;gBACX,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;gBACjB,KAAK;gBACL,QAAQ;aACT,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC;AACzD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,IAAY;IAC/C,MAAM,OAAO,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;IACrC,OAAO,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAChD,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session Lifecycle Manager for oh-my-codex
|
|
3
|
+
*
|
|
4
|
+
* Tracks session start/end, detects stale sessions from crashed launches,
|
|
5
|
+
* and provides structured logging for session events.
|
|
6
|
+
*/
|
|
7
|
+
export interface SessionState {
|
|
8
|
+
session_id: string;
|
|
9
|
+
started_at: string;
|
|
10
|
+
cwd: string;
|
|
11
|
+
pid: number;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Reset session-scoped HUD/metrics files at launch so stale values do not leak
|
|
15
|
+
* into a new Codex session.
|
|
16
|
+
*/
|
|
17
|
+
export declare function resetSessionMetrics(cwd: string): Promise<void>;
|
|
18
|
+
/**
|
|
19
|
+
* Read current session state. Returns null if no session file exists.
|
|
20
|
+
*/
|
|
21
|
+
export declare function readSessionState(cwd: string): Promise<SessionState | null>;
|
|
22
|
+
/**
|
|
23
|
+
* Check if a session is stale (PID dead or started >2h ago).
|
|
24
|
+
*/
|
|
25
|
+
export declare function isSessionStale(state: SessionState): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Write session start state.
|
|
28
|
+
*/
|
|
29
|
+
export declare function writeSessionStart(cwd: string, sessionId: string): Promise<void>;
|
|
30
|
+
/**
|
|
31
|
+
* Write session end: archive to history, delete session.json.
|
|
32
|
+
*/
|
|
33
|
+
export declare function writeSessionEnd(cwd: string, sessionId: string): Promise<void>;
|
|
34
|
+
/**
|
|
35
|
+
* Append a structured JSONL entry to the daily log file.
|
|
36
|
+
*/
|
|
37
|
+
export declare function appendToLog(cwd: string, entry: Record<string, unknown>): Promise<void>;
|
|
38
|
+
//# sourceMappingURL=session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/hooks/session.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;CACb;AAeD;;;GAGG;AACH,wBAAsB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAuBpE;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAUhF;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAS3D;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAkBrF;AAED;;GAEG;AACH,wBAAsB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA4BnF;AAED;;GAEG;AACH,wBAAsB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAS5F"}
|