oh-my-codex 0.21.45 → 0.21.47
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 -1
- package/dist/agents/__tests__/native-config.test.js +18 -7
- package/dist/agents/__tests__/native-config.test.js.map +1 -1
- package/dist/agents/native-config.js +5 -5
- package/dist/agents/native-config.js.map +1 -1
- package/dist/config/quality-gates.d.ts +5 -3
- package/dist/config/quality-gates.d.ts.map +1 -1
- package/dist/config/quality-gates.js +4 -2
- package/dist/config/quality-gates.js.map +1 -1
- package/dist/hooks/__tests__/skill-guidance-contract.test.js +43 -0
- package/dist/hooks/__tests__/skill-guidance-contract.test.js.map +1 -1
- package/dist/team/__tests__/tmux-session.test.js +127 -3
- package/dist/team/__tests__/tmux-session.test.js.map +1 -1
- package/dist/team/tmux-session.d.ts +2 -1
- package/dist/team/tmux-session.d.ts.map +1 -1
- package/dist/team/tmux-session.js +42 -13
- package/dist/team/tmux-session.js.map +1 -1
- package/package.json +1 -1
- package/plugins/oh-my-codex/.codex-plugin/plugin.json +2 -2
- package/plugins/oh-my-codex/skills/doctor/SKILL.md +49 -30
- package/prompts/git-master.md +15 -14
- package/skills/doctor/SKILL.md +49 -30
|
@@ -7,7 +7,7 @@ import { PassThrough } from 'node:stream';
|
|
|
7
7
|
import { chmod, mkdir, mkdtemp, readFile, rm, symlink, writeFile } from 'fs/promises';
|
|
8
8
|
import { dirname, join } from 'path';
|
|
9
9
|
import { tmpdir } from 'os';
|
|
10
|
-
import { buildClientAttachedReconcileHookName, assertTeamWorkerCliBinaryAvailable, buildWorkerProcessLaunchSpec, buildReconcileHudResizeArgs, buildRegisterClientAttachedReconcileArgs, buildRegisterResizeHookArgs, buildResizeHookName, buildResizeHookTarget, buildScheduleDelayedHudResizeArgs, buildUnregisterClientAttachedReconcileArgs, buildUnregisterResizeHookArgs, buildWorkerStartupCommand, trustWorkerMiseConfigIfAvailable, writeWorkerStartupScriptCommand, shouldSourceTeamWorkerShellRc, buildHudPaneTarget, chooseTeamLeaderPaneId, createTeamSession, CreateTeamSessionPartialError, enableMouseScrolling, isMsysOrGitBash, isNativeWindows, isTmuxAvailable, isWorkerPaneOpen, restoreStandaloneHudPane, finalizeRestoredHudCleanupDebtSync, reconcileRestoredHudCleanupDebtSync, translatePathForMsys, isWsl2, isWorkerAlive, killWorker, getWorkerPanePid, killWorkerByPaneId, killWorkerByPaneIdAsync, teardownWorkerPanes, listTeamSessions, destroyTeamSession, queryDetachedTeamSession, requestDetachedTeamSessionDestroy, resolveTeamWorkerCli, resolveTeamWorkerLaunchMode, resolveWorkerCliForSend, resolveTeamWorkerCliPlan, buildWorkerSubmitPlan, sanitizeTeamName, shouldAttemptAdaptiveRetry, sendToWorker, sendToWorkerStdin, sleepFractionalSeconds, translateWorkerLaunchArgsForCli, waitForWorkerReady, waitForWorkerReadyAsync, paneIsBootstrapping, parseSplitWindowPaneId, bindSplitWindowReceiptFormat, classifyWorkerStartupInjectSafety, checkWorkerStartupInjectSafety, dismissTrustPromptIfPresent, evaluateStartupDirectTriggerSafetyCapture, classifyCodexBypassMdmIncompatibility, mitigateCopyModeUnderlineArtifacts, listPaneIds, } from '../tmux-session.js';
|
|
10
|
+
import { buildClientAttachedReconcileHookName, assertTeamWorkerCliBinaryAvailable, buildWorkerProcessLaunchSpec, buildReconcileHudResizeArgs, buildRegisterClientAttachedReconcileArgs, buildRegisterResizeHookArgs, buildResizeHookName, buildResizeHookTarget, buildScheduleDelayedHudResizeArgs, buildUnregisterClientAttachedReconcileArgs, buildUnregisterResizeHookArgs, buildWorkerStartupCommand, trustWorkerMiseConfigIfAvailable, writeWorkerStartupScriptCommand, shouldSourceTeamWorkerShellRc, buildHudPaneTarget, chooseTeamLeaderPaneId, createTeamSession, CreateTeamSessionPartialError, enableMouseScrolling, isMsysOrGitBash, isNativeWindows, isTmuxAvailable, isWorkerPaneOpen, restoreStandaloneHudPane, finalizeRestoredHudCleanupDebtSync, reconcileRestoredHudCleanupDebtSync, translatePathForMsys, isWsl2, isWorkerAlive, killWorker, getWorkerPanePid, killWorkerByPaneId, killWorkerByPaneIdAsync, teardownWorkerPanes, listTeamSessions, destroyTeamSession, queryDetachedTeamSession, requestDetachedTeamSessionDestroy, resolveTeamWorkerCli, resolveTeamWorkerLaunchMode, resolveWorkerCliForSend, resolveTeamWorkerCliPlan, buildWorkerSubmitPlan, sanitizeTeamName, shouldAttemptAdaptiveRetry, sendToWorker, sendToWorkerStdin, sleepFractionalSeconds, translateWorkerLaunchArgsForCli, waitForWorkerReady, waitForWorkerReadyAsync, paneIsBootstrapping, parseSplitWindowPaneId, bindSplitReceiptToPaneCommand, bindSplitWindowReceiptFormat, classifyWorkerStartupInjectSafety, checkWorkerStartupInjectSafety, dismissTrustPromptIfPresent, evaluateStartupDirectTriggerSafetyCapture, classifyCodexBypassMdmIncompatibility, mitigateCopyModeUnderlineArtifacts, listPaneIds, } from '../tmux-session.js';
|
|
11
11
|
import { HUD_RESIZE_RECONCILE_DELAY_SECONDS, HUD_TMUX_TEAM_HEIGHT_LINES } from '../../hud/constants.js';
|
|
12
12
|
import * as tmuxSessionModule from '../tmux-session.js';
|
|
13
13
|
import { OMX_ENTRY_PATH_ENV, OMX_STARTUP_CWD_ENV } from '../../utils/paths.js';
|
|
@@ -2759,8 +2759,8 @@ describe('buildWorkerStartupCommand', () => {
|
|
|
2759
2759
|
process.env.OMX_BYPASS_DEFAULT_SYSTEM_PROMPT = '0';
|
|
2760
2760
|
try {
|
|
2761
2761
|
const cmd = withMockedExistsSync((candidate) => candidate === '/opt/custom/fish', () => buildWorkerStartupCommand('alpha', 1, [], process.cwd()));
|
|
2762
|
-
assert.match(cmd,
|
|
2763
|
-
assert.doesNotMatch(cmd,
|
|
2762
|
+
assert.match(cmd, /\/bin\/sh\b/, 'must launch workers through /bin/sh when no supported shells exist');
|
|
2763
|
+
assert.doesNotMatch(cmd, /\/bin\/sh -lc\b/);
|
|
2764
2764
|
assert.doesNotMatch(cmd, /\.zshrc|\.bashrc/, 'must not source zsh/bash rc files for /bin/sh fallback');
|
|
2765
2765
|
}
|
|
2766
2766
|
finally {
|
|
@@ -2774,6 +2774,81 @@ describe('buildWorkerStartupCommand', () => {
|
|
|
2774
2774
|
delete process.env.OMX_BYPASS_DEFAULT_SYSTEM_PROMPT;
|
|
2775
2775
|
}
|
|
2776
2776
|
});
|
|
2777
|
+
it('embeds receipt in PowerShell script before encoding (when on native Windows) or appends to POSIX', () => {
|
|
2778
|
+
const receipt = 'omx_source_test_receipt';
|
|
2779
|
+
const prevShell = process.env.SHELL;
|
|
2780
|
+
const prevBypass = process.env.OMX_BYPASS_DEFAULT_SYSTEM_PROMPT;
|
|
2781
|
+
process.env.OMX_BYPASS_DEFAULT_SYSTEM_PROMPT = '0';
|
|
2782
|
+
try {
|
|
2783
|
+
// buildWorkerStartupCommand should either:
|
|
2784
|
+
// - On Windows: embed receipt in the PowerShell script before encoding
|
|
2785
|
+
// - On POSIX: append receipt as shell comment
|
|
2786
|
+
const cmdWithReceipt = buildWorkerStartupCommand('alpha', 1, [], process.cwd(), {}, undefined, undefined, undefined, receipt);
|
|
2787
|
+
if (cmdWithReceipt.includes('-EncodedCommand')) {
|
|
2788
|
+
// Windows PowerShell case: Verify receipt is in the encoded command
|
|
2789
|
+
const match = cmdWithReceipt.match(/-EncodedCommand\s+([A-Za-z0-9+/=]+)/);
|
|
2790
|
+
assert(match, 'Should have encoded command with receipt');
|
|
2791
|
+
const decoded = Buffer.from(match[1], 'base64').toString('utf16le');
|
|
2792
|
+
assert(decoded.includes(`# ${receipt}`), 'Decoded script should contain receipt');
|
|
2793
|
+
// Verify the invocation line (exec ...) is not inside the comment
|
|
2794
|
+
const lines = decoded.split(';');
|
|
2795
|
+
const commentLineIndex = lines.findIndex((line) => line.includes(`# ${receipt}`));
|
|
2796
|
+
assert(commentLineIndex >= 0, 'Should find receipt comment line');
|
|
2797
|
+
const invocationLineIndex = lines.findIndex((line) => line.includes('&'));
|
|
2798
|
+
assert(invocationLineIndex >= 0, 'Should find invocation line with &');
|
|
2799
|
+
assert(invocationLineIndex < commentLineIndex || lines[commentLineIndex]?.includes('&') === false, 'Invocation must not be inside comment');
|
|
2800
|
+
}
|
|
2801
|
+
else {
|
|
2802
|
+
// POSIX case: Verify receipt is appended
|
|
2803
|
+
assert(cmdWithReceipt.includes(`# ${receipt}`), 'Receipt should be appended as comment in POSIX command');
|
|
2804
|
+
}
|
|
2805
|
+
}
|
|
2806
|
+
finally {
|
|
2807
|
+
if (typeof prevShell === 'string')
|
|
2808
|
+
process.env.SHELL = prevShell;
|
|
2809
|
+
else
|
|
2810
|
+
delete process.env.SHELL;
|
|
2811
|
+
if (typeof prevBypass === 'string')
|
|
2812
|
+
process.env.OMX_BYPASS_DEFAULT_SYSTEM_PROMPT = prevBypass;
|
|
2813
|
+
else
|
|
2814
|
+
delete process.env.OMX_BYPASS_DEFAULT_SYSTEM_PROMPT;
|
|
2815
|
+
}
|
|
2816
|
+
});
|
|
2817
|
+
it('appends receipt to POSIX worker startup commands without modifying the inner command', () => {
|
|
2818
|
+
const receipt = 'omx_source_posix_receipt';
|
|
2819
|
+
const prevBypass = process.env.OMX_BYPASS_DEFAULT_SYSTEM_PROMPT;
|
|
2820
|
+
const prevShell = process.env.SHELL;
|
|
2821
|
+
process.env.SHELL = '/bin/bash';
|
|
2822
|
+
process.env.OMX_BYPASS_DEFAULT_SYSTEM_PROMPT = '0';
|
|
2823
|
+
try {
|
|
2824
|
+
const cmdNoReceipt = buildWorkerStartupCommand('alpha', 1, [], process.cwd());
|
|
2825
|
+
const cmdWithReceipt = buildWorkerStartupCommand('alpha', 1, [], process.cwd(), {}, undefined, undefined, undefined, receipt);
|
|
2826
|
+
// If it's a PowerShell command (Windows), receipt should be embedded in the script
|
|
2827
|
+
// If it's a POSIX command (Unix/macOS), receipt should be appended
|
|
2828
|
+
assert(cmdWithReceipt.includes(receipt), 'Receipt must be present in command');
|
|
2829
|
+
if (cmdWithReceipt.includes('-EncodedCommand')) {
|
|
2830
|
+
// PowerShell case
|
|
2831
|
+
const match = cmdWithReceipt.match(/-EncodedCommand\s+([A-Za-z0-9+/=]+)/);
|
|
2832
|
+
assert(match, 'Should extract encoded command');
|
|
2833
|
+
const decoded = Buffer.from(match[1], 'base64').toString('utf16le');
|
|
2834
|
+
assert(decoded.includes(receipt), 'Decoded script should contain receipt');
|
|
2835
|
+
}
|
|
2836
|
+
else {
|
|
2837
|
+
// POSIX case: verify receipt is appended as comment
|
|
2838
|
+
assert(cmdWithReceipt.includes(`# ${receipt}`), 'Receipt should be appended as comment to POSIX command');
|
|
2839
|
+
}
|
|
2840
|
+
}
|
|
2841
|
+
finally {
|
|
2842
|
+
if (typeof prevBypass === 'string')
|
|
2843
|
+
process.env.OMX_BYPASS_DEFAULT_SYSTEM_PROMPT = prevBypass;
|
|
2844
|
+
else
|
|
2845
|
+
delete process.env.OMX_BYPASS_DEFAULT_SYSTEM_PROMPT;
|
|
2846
|
+
if (typeof prevShell === 'string')
|
|
2847
|
+
process.env.SHELL = prevShell;
|
|
2848
|
+
else
|
|
2849
|
+
delete process.env.SHELL;
|
|
2850
|
+
}
|
|
2851
|
+
});
|
|
2777
2852
|
});
|
|
2778
2853
|
describe('team worker CLI helpers', () => {
|
|
2779
2854
|
it('resolveTeamWorkerCli auto-detects claude models', () => {
|
|
@@ -4469,6 +4544,55 @@ describe('createTeamSession tmux instance tagging', () => {
|
|
|
4469
4544
|
assert.throws(() => bindSplitWindowReceiptFormat(effect, invalidReceipt), /tmux_source_transaction_receipt_invalid/);
|
|
4470
4545
|
}
|
|
4471
4546
|
});
|
|
4547
|
+
it('embeds receipt in PowerShell script before encoding and appends to POSIX commands', () => {
|
|
4548
|
+
const receipt = 'omx_source_receipt_example';
|
|
4549
|
+
// PowerShell commands from buildWorkerStartupCommand have receipt embedded in the script,
|
|
4550
|
+
// but bindSplitReceiptToPaneCommand will append " # receipt" as plaintext (for fallback detection).
|
|
4551
|
+
const scriptWithReceipt = `$ErrorActionPreference = 'Stop'; # ${receipt}`;
|
|
4552
|
+
const encodedReceipt = Buffer.from(scriptWithReceipt, 'utf16le').toString('base64');
|
|
4553
|
+
const powershellCommand = `powershell.exe -NoLogo -NoProfile -ExecutionPolicy Bypass -EncodedCommand ${encodedReceipt}`;
|
|
4554
|
+
// PowerShell commands don't have plaintext receipt, so it gets appended
|
|
4555
|
+
const result = bindSplitReceiptToPaneCommand(powershellCommand, receipt);
|
|
4556
|
+
assert.equal(result, `${powershellCommand} # ${receipt}`, 'PowerShell command should have receipt appended as plaintext for detection');
|
|
4557
|
+
// POSIX shell commands should have receipt appended as a comment
|
|
4558
|
+
const bashCommand = '/bin/bash -c "worker_command"';
|
|
4559
|
+
assert.equal(bindSplitReceiptToPaneCommand(bashCommand, receipt), `${bashCommand} # ${receipt}`, 'Bash command should have receipt appended as comment');
|
|
4560
|
+
// Plain command should have receipt appended
|
|
4561
|
+
const plainCommand = 'worker_process';
|
|
4562
|
+
assert.equal(bindSplitReceiptToPaneCommand(plainCommand, receipt), `${plainCommand} # ${receipt}`, 'Plain command should have receipt appended as comment');
|
|
4563
|
+
// Test POSIX command containing the literal text '-EncodedCommand' in its content
|
|
4564
|
+
// This should NOT be misparsed; receipt should just be appended
|
|
4565
|
+
const posixWithEncodedCommandText = 'echo "Usage: -EncodedCommand option for PowerShell"';
|
|
4566
|
+
const resultWithEncodedText = bindSplitReceiptToPaneCommand(posixWithEncodedCommandText, receipt);
|
|
4567
|
+
assert.equal(resultWithEncodedText, `${posixWithEncodedCommandText} # ${receipt}`, 'POSIX command with -EncodedCommand text should get receipt appended like any other POSIX command');
|
|
4568
|
+
});
|
|
4569
|
+
it('detects receipt in both POSIX shell comments and PowerShell encoded commands for fallback reconciliation', () => {
|
|
4570
|
+
const receipt = 'omx_source_test_fallback';
|
|
4571
|
+
// Test POSIX shell case: receipt in command as comment
|
|
4572
|
+
const posixCommand = `/bin/bash -c "worker" # ${receipt}`;
|
|
4573
|
+
assert(posixCommand.includes(receipt), 'POSIX command should contain receipt');
|
|
4574
|
+
// Test PowerShell case: receipt should be detectable inside the decoded script
|
|
4575
|
+
const scriptWithReceipt = `# ${receipt}\n$ErrorActionPreference = 'Stop'`;
|
|
4576
|
+
const encodedWithReceipt = Buffer.from(scriptWithReceipt, 'utf16le').toString('base64');
|
|
4577
|
+
const powerShellCommand = `powershell.exe -NoLogo -NoProfile -ExecutionPolicy Bypass -EncodedCommand ${encodedWithReceipt}`;
|
|
4578
|
+
// Extract and verify the receipt is in the decoded script
|
|
4579
|
+
const psMatch = powerShellCommand.match(/EncodedCommand\s+([A-Za-z0-9+/=]+)/);
|
|
4580
|
+
assert(psMatch, 'Should extract encoded command');
|
|
4581
|
+
const psDecoded = Buffer.from(psMatch[1], 'base64').toString('utf16le');
|
|
4582
|
+
assert(psDecoded.includes(receipt), 'Decoded PS command should contain receipt');
|
|
4583
|
+
// Verify that panes WITHOUT receipts would not match (prevents false reconciliation)
|
|
4584
|
+
const noReceiptCommand = '/bin/bash -c "worker"';
|
|
4585
|
+
assert(!noReceiptCommand.includes(receipt), 'Pane without receipt should not match');
|
|
4586
|
+
// PowerShell command without receipt
|
|
4587
|
+
const scriptNoReceipt = '$ErrorActionPreference = "Stop"';
|
|
4588
|
+
const encodedNoReceipt = Buffer.from(scriptNoReceipt, 'utf16le').toString('base64');
|
|
4589
|
+
const psNoReceiptCommand = `powershell.exe -EncodedCommand ${encodedNoReceipt}`;
|
|
4590
|
+
const psNoReceiptMatch = psNoReceiptCommand.match(/EncodedCommand\s+([A-Za-z0-9+/=]+)/);
|
|
4591
|
+
if (psNoReceiptMatch) {
|
|
4592
|
+
const psNoReceiptDecoded = Buffer.from(psNoReceiptMatch[1], 'base64').toString('utf16le');
|
|
4593
|
+
assert(!psNoReceiptDecoded.includes(receipt), 'PS pane without receipt should not match');
|
|
4594
|
+
}
|
|
4595
|
+
});
|
|
4472
4596
|
it('fails closed on multi-row worker and HUD split-window output', async () => {
|
|
4473
4597
|
const prevTmux = process.env.TMUX;
|
|
4474
4598
|
const prevTmuxPane = process.env.TMUX_PANE;
|