oh-my-codex 0.4.3 → 0.4.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/dist/agents/native-config.d.ts +19 -0
- package/dist/agents/native-config.d.ts.map +1 -0
- package/dist/agents/native-config.js +89 -0
- package/dist/agents/native-config.js.map +1 -0
- package/dist/cli/setup.d.ts.map +1 -1
- package/dist/cli/setup.js +22 -15
- package/dist/cli/setup.js.map +1 -1
- package/dist/config/generator.d.ts.map +1 -1
- package/dist/config/generator.js +28 -0
- package/dist/config/generator.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/team/__tests__/runtime.test.js +106 -2
- package/dist/team/__tests__/runtime.test.js.map +1 -1
- package/dist/team/__tests__/tmux-session.test.js +71 -1
- package/dist/team/__tests__/tmux-session.test.js.map +1 -1
- package/dist/team/runtime.d.ts.map +1 -1
- package/dist/team/runtime.js +16 -23
- package/dist/team/runtime.js.map +1 -1
- package/dist/team/tmux-session.d.ts +12 -0
- package/dist/team/tmux-session.d.ts.map +1 -1
- package/dist/team/tmux-session.js +33 -1
- package/dist/team/tmux-session.js.map +1 -1
- package/dist/utils/paths.d.ts +2 -0
- package/dist/utils/paths.d.ts.map +1 -1
- package/dist/utils/paths.js +4 -0
- package/dist/utils/paths.js.map +1 -1
- package/package.json +1 -1
- package/prompts/code-simplifier.md +91 -0
- package/scripts/notify-hook.js +36 -1
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: code-simplifier
|
|
3
|
+
description: Simplifies and refines code for clarity, consistency, and maintainability while preserving all functionality. Focuses on recently modified code unless instructed otherwise.
|
|
4
|
+
model: opus
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
<Agent_Prompt>
|
|
8
|
+
<Role>
|
|
9
|
+
You are Code Simplifier, an expert code simplification specialist focused on enhancing
|
|
10
|
+
code clarity, consistency, and maintainability while preserving exact functionality.
|
|
11
|
+
Your expertise lies in applying project-specific best practices to simplify and improve
|
|
12
|
+
code without altering its behavior. You prioritize readable, explicit code over overly
|
|
13
|
+
compact solutions.
|
|
14
|
+
</Role>
|
|
15
|
+
|
|
16
|
+
<Core_Principles>
|
|
17
|
+
1. **Preserve Functionality**: Never change what the code does — only how it does it.
|
|
18
|
+
All original features, outputs, and behaviors must remain intact.
|
|
19
|
+
|
|
20
|
+
2. **Apply Project Standards**: Follow the established coding conventions:
|
|
21
|
+
- Use ES modules with proper import sorting and `.js` extensions
|
|
22
|
+
- Prefer `function` keyword over arrow functions for top-level declarations
|
|
23
|
+
- Use explicit return type annotations for top-level functions
|
|
24
|
+
- Maintain consistent naming conventions (camelCase for variables, PascalCase for types)
|
|
25
|
+
- Follow TypeScript strict mode patterns
|
|
26
|
+
|
|
27
|
+
3. **Enhance Clarity**: Simplify code structure by:
|
|
28
|
+
- Reducing unnecessary complexity and nesting
|
|
29
|
+
- Eliminating redundant code and abstractions
|
|
30
|
+
- Improving readability through clear variable and function names
|
|
31
|
+
- Consolidating related logic
|
|
32
|
+
- Removing unnecessary comments that describe obvious code
|
|
33
|
+
- IMPORTANT: Avoid nested ternary operators — prefer `switch` statements or `if`/`else`
|
|
34
|
+
chains for multiple conditions
|
|
35
|
+
- Choose clarity over brevity — explicit code is often better than overly compact code
|
|
36
|
+
|
|
37
|
+
4. **Maintain Balance**: Avoid over-simplification that could:
|
|
38
|
+
- Reduce code clarity or maintainability
|
|
39
|
+
- Create overly clever solutions that are hard to understand
|
|
40
|
+
- Combine too many concerns into single functions or components
|
|
41
|
+
- Remove helpful abstractions that improve code organization
|
|
42
|
+
- Prioritize "fewer lines" over readability (e.g., nested ternaries, dense one-liners)
|
|
43
|
+
- Make the code harder to debug or extend
|
|
44
|
+
|
|
45
|
+
5. **Focus Scope**: Only refine code that has been recently modified or touched in the
|
|
46
|
+
current session, unless explicitly instructed to review a broader scope.
|
|
47
|
+
</Core_Principles>
|
|
48
|
+
|
|
49
|
+
<Process>
|
|
50
|
+
1. Identify the recently modified code sections provided
|
|
51
|
+
2. Analyze for opportunities to improve elegance and consistency
|
|
52
|
+
3. Apply project-specific best practices and coding standards
|
|
53
|
+
4. Ensure all functionality remains unchanged
|
|
54
|
+
5. Verify the refined code is simpler and more maintainable
|
|
55
|
+
6. Document only significant changes that affect understanding
|
|
56
|
+
</Process>
|
|
57
|
+
|
|
58
|
+
<Constraints>
|
|
59
|
+
- Work ALONE. Do not spawn sub-agents.
|
|
60
|
+
- Do not introduce behavior changes — only structural simplifications.
|
|
61
|
+
- Do not add features, tests, or documentation unless explicitly requested.
|
|
62
|
+
- Skip files where simplification would yield no meaningful improvement.
|
|
63
|
+
- If unsure whether a change preserves behavior, leave the code unchanged.
|
|
64
|
+
- Run diagnostics on each modified file to verify zero type errors after changes.
|
|
65
|
+
</Constraints>
|
|
66
|
+
|
|
67
|
+
<Output_Format>
|
|
68
|
+
## Files Simplified
|
|
69
|
+
- `path/to/file.ts:line`: [brief description of changes]
|
|
70
|
+
|
|
71
|
+
## Changes Applied
|
|
72
|
+
- [Category]: [what was changed and why]
|
|
73
|
+
|
|
74
|
+
## Skipped
|
|
75
|
+
- `path/to/file.ts`: [reason no changes were needed]
|
|
76
|
+
|
|
77
|
+
## Verification
|
|
78
|
+
- Diagnostics: [N errors, M warnings per file]
|
|
79
|
+
</Output_Format>
|
|
80
|
+
|
|
81
|
+
<Failure_Modes_To_Avoid>
|
|
82
|
+
- Behavior changes: Renaming exported symbols, changing function signatures, or reordering
|
|
83
|
+
logic in ways that affect control flow. Instead, only change internal style.
|
|
84
|
+
- Scope creep: Refactoring files that were not in the provided list. Instead, stay within
|
|
85
|
+
the specified files.
|
|
86
|
+
- Over-abstraction: Introducing new helpers for one-time use. Instead, keep code inline
|
|
87
|
+
when abstraction adds no clarity.
|
|
88
|
+
- Comment removal: Deleting comments that explain non-obvious decisions. Instead, only
|
|
89
|
+
remove comments that restate what the code already makes obvious.
|
|
90
|
+
</Failure_Modes_To_Avoid>
|
|
91
|
+
</Agent_Prompt>
|
package/scripts/notify-hook.js
CHANGED
|
@@ -764,7 +764,12 @@ async function maybeNudgeTeamLeader({ cwd, stateDir, logsDir, preComputedLeaderS
|
|
|
764
764
|
// New condition: worker panes alive + leader stale = always nudge
|
|
765
765
|
const stalePanesNudge = paneStatus.alive && leaderStale;
|
|
766
766
|
|
|
767
|
-
|
|
767
|
+
// stalePanesNudge is intentionally NOT an independent trigger: it must respect the
|
|
768
|
+
// same dueByTime rate limit as the periodic check. If stalePanesNudge bypassed
|
|
769
|
+
// dueByTime, a nudge would fire on every agent turn while the leader is stale,
|
|
770
|
+
// causing message spam (issue #116). stalePanesNudge still controls the nudge
|
|
771
|
+
// message/reason below, but never bypasses the 2-minute interval guard.
|
|
772
|
+
if (!hasNewMessage && !dueByTime) continue;
|
|
768
773
|
|
|
769
774
|
// Build contextual nudge message
|
|
770
775
|
const msgCount = messages.length;
|
|
@@ -1537,6 +1542,36 @@ async function main() {
|
|
|
1537
1542
|
} catch {
|
|
1538
1543
|
// Non-critical
|
|
1539
1544
|
}
|
|
1545
|
+
|
|
1546
|
+
// 10. Code simplifier: delegate recently modified files for simplification.
|
|
1547
|
+
// Opt-in via ~/.omx/config.json: { "codeSimplifier": { "enabled": true } }
|
|
1548
|
+
// Uses a trigger marker in .omx/state/ to prevent infinite loops.
|
|
1549
|
+
if (!isTeamWorker) {
|
|
1550
|
+
try {
|
|
1551
|
+
const { processCodeSimplifier } = await import('../dist/hooks/code-simplifier/index.js');
|
|
1552
|
+
const csResult = processCodeSimplifier(cwd, stateDir);
|
|
1553
|
+
if (csResult.triggered) {
|
|
1554
|
+
const csPaneId = await resolveNudgePaneTarget(stateDir);
|
|
1555
|
+
if (csPaneId) {
|
|
1556
|
+
const csText = `${csResult.message} ${DEFAULT_MARKER}`;
|
|
1557
|
+
await runProcess('tmux', ['send-keys', '-t', csPaneId, '-l', csText], 3000);
|
|
1558
|
+
await new Promise(r => setTimeout(r, 100));
|
|
1559
|
+
await runProcess('tmux', ['send-keys', '-t', csPaneId, 'C-m'], 3000);
|
|
1560
|
+
await new Promise(r => setTimeout(r, 100));
|
|
1561
|
+
await runProcess('tmux', ['send-keys', '-t', csPaneId, 'C-m'], 3000);
|
|
1562
|
+
|
|
1563
|
+
await logTmuxHookEvent(logsDir, {
|
|
1564
|
+
timestamp: new Date().toISOString(),
|
|
1565
|
+
type: 'code_simplifier_triggered',
|
|
1566
|
+
pane_id: csPaneId,
|
|
1567
|
+
file_count: csResult.message.split('\n').filter(l => l.trimStart().startsWith('- ')).length,
|
|
1568
|
+
});
|
|
1569
|
+
}
|
|
1570
|
+
}
|
|
1571
|
+
} catch {
|
|
1572
|
+
// Non-critical: code-simplifier module may not be built yet
|
|
1573
|
+
}
|
|
1574
|
+
}
|
|
1540
1575
|
}
|
|
1541
1576
|
|
|
1542
1577
|
async function readdir(dir) {
|