oh-my-opencode 4.16.2 → 4.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/command/omomomo.md +1 -1
- package/.agents/skills/hyperplan/SKILL.md +3 -3
- package/.agents/skills/omomomo/SKILL.md +1 -1
- package/.agents/skills/pre-publish-review/SKILL.md +3 -0
- package/.opencode/command/omomomo.md +1 -1
- package/.opencode/skills/hyperplan/SKILL.md +3 -3
- package/.opencode/skills/pre-publish-review/SKILL.md +3 -0
- package/README.ja.md +4 -4
- package/README.ko.md +4 -4
- package/README.md +4 -4
- package/README.ru.md +4 -4
- package/README.zh-cn.md +4 -4
- package/dist/agents/hephaestus/agent.d.ts +1 -1
- package/dist/agents/hephaestus/gpt-5-6.d.ts +2 -0
- package/dist/agents/momus-gpt-5-6.d.ts +1 -0
- package/dist/agents/types.d.ts +2 -0
- package/dist/cli/index.js +947 -567
- package/dist/cli-node/index.js +947 -567
- package/dist/features/background-agent/error-classifier.d.ts +5 -0
- package/dist/features/builtin-commands/templates/refactor-sections/intro-and-analysis.d.ts +1 -1
- package/dist/features/builtin-commands/templates/remove-ai-slops.d.ts +1 -1
- package/dist/features/team-mode/test-support/async-test-helpers.d.ts +2 -2
- package/dist/index.js +523 -81
- package/dist/plugin/chat-message/types.d.ts +4 -0
- package/dist/plugin/command-execute-before.d.ts +1 -0
- package/dist/plugin/stop-continuation.d.ts +17 -0
- package/dist/shared/live-server-route.d.ts +1 -1
- package/dist/skills/remove-ai-slops/SKILL.md +2 -2
- package/dist/skills/review-work/SKILL.md +1 -1
- package/dist/skills/start-work/SKILL.md +5 -2
- package/dist/skills/ulw-plan/references/full-workflow.md +1 -1
- package/dist/skills/ulw-plan/scripts/scaffold-plan.mjs +2 -2
- package/dist/skills/ulw-research/SKILL.md +2 -2
- package/dist/skills/visual-qa/SKILL.md +1 -1
- package/dist/tui.js +195 -41
- package/package.json +15 -14
- package/packages/git-bash-mcp/package.json +27 -0
- package/packages/omo-codex/plugin/.codex-plugin/plugin.json +3 -1
- package/packages/omo-codex/plugin/components/bootstrap/dist/cli.js +465 -248
- package/packages/omo-codex/plugin/components/bootstrap/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/bootstrap/package.json +1 -1
- package/packages/omo-codex/plugin/components/codegraph/package.json +1 -1
- package/packages/omo-codex/plugin/components/comment-checker/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/comment-checker/package.json +1 -1
- package/packages/omo-codex/plugin/components/git-bash/hooks/hooks.json +2 -2
- package/packages/omo-codex/plugin/components/git-bash/package.json +1 -1
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/AGENTS.md +2 -2
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/dist/cli.js +6 -2
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/dist/codex-hook.js +6 -2
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/hooks/hooks.json +2 -2
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/package.json +1 -1
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/src/codex-hook.ts +6 -2
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/test/cli.test.ts +1 -1
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/test/codex-hook.test.ts +67 -2
- package/packages/omo-codex/plugin/components/lsp/hooks/hooks.json +2 -2
- package/packages/omo-codex/plugin/components/lsp/package.json +1 -1
- package/packages/omo-codex/plugin/components/lsp/test/package-smoke.test.ts +0 -13
- package/packages/omo-codex/plugin/components/rules/bundled-rules/hephaestus/gpt-5.6.md +93 -0
- package/packages/omo-codex/plugin/components/rules/dist/cli.js +43 -24
- package/packages/omo-codex/plugin/components/rules/hooks/hooks.json +4 -4
- package/packages/omo-codex/plugin/components/rules/package.json +1 -1
- package/packages/omo-codex/plugin/components/rules/src/codex-hook.ts +2 -1
- package/packages/omo-codex/plugin/components/rules/src/dynamic-target-fingerprints.ts +15 -6
- package/packages/omo-codex/plugin/components/rules/src/rules-engine-factory.ts +7 -2
- package/packages/omo-codex/plugin/components/rules/src/static-injection.ts +2 -2
- package/packages/omo-codex/plugin/components/rules/test/codex-hook.test.ts +32 -0
- package/packages/omo-codex/plugin/components/rules/test/hephaestus-model-variant.test.ts +106 -0
- package/packages/omo-codex/plugin/components/start-work-continuation/hooks/hooks.json +2 -2
- package/packages/omo-codex/plugin/components/start-work-continuation/package.json +1 -1
- package/packages/omo-codex/plugin/components/start-work-continuation/test/codex-hook.test.ts +1 -79
- package/packages/omo-codex/plugin/components/teammode/AGENTS.md +12 -9
- package/packages/omo-codex/plugin/components/teammode/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/teammode/package.json +1 -1
- package/packages/omo-codex/plugin/components/teammode/skills/teammode/SKILL.md +136 -76
- package/packages/omo-codex/plugin/components/teammode/skills/teammode/scripts/team-guide.mjs +94 -23
- package/packages/omo-codex/plugin/components/teammode/skills/teammode/scripts/team-state.mjs +94 -14
- package/packages/omo-codex/plugin/components/teammode/skills/teammode/scripts/team-transport.mjs +55 -0
- package/packages/omo-codex/plugin/components/teammode/skills/teammode/scripts/team.mjs +72 -18
- package/packages/omo-codex/plugin/components/teammode/test/thread-title-hook.test.ts +23 -0
- package/packages/omo-codex/plugin/components/telemetry/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/telemetry/package.json +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/agents/explorer.toml +23 -40
- package/packages/omo-codex/plugin/components/ultrawork/agents/lazycodex-clone-fidelity-reviewer.toml +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/agents/lazycodex-code-reviewer.toml +3 -3
- package/packages/omo-codex/plugin/components/ultrawork/agents/lazycodex-gate-reviewer.toml +7 -7
- package/packages/omo-codex/plugin/components/ultrawork/agents/lazycodex-qa-executor.toml +5 -5
- package/packages/omo-codex/plugin/components/ultrawork/agents/lazycodex-worker-high.toml +26 -0
- package/packages/omo-codex/plugin/components/ultrawork/agents/{lazycodex-executor.toml → lazycodex-worker-low.toml} +7 -5
- package/packages/omo-codex/plugin/components/ultrawork/agents/lazycodex-worker-medium.toml +26 -0
- package/packages/omo-codex/plugin/components/ultrawork/agents/librarian.toml +20 -48
- package/packages/omo-codex/plugin/components/ultrawork/agents/metis.toml +17 -29
- package/packages/omo-codex/plugin/components/ultrawork/agents/momus.toml +20 -50
- package/packages/omo-codex/plugin/components/ultrawork/agents/plan.toml +22 -43
- package/packages/omo-codex/plugin/components/ultrawork/directive.md +55 -28
- package/packages/omo-codex/plugin/components/ultrawork/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/package.json +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/skills/ultrawork/SKILL.md +55 -28
- package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/references/full-workflow.md +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/scripts/scaffold-plan.mjs +2 -2
- package/packages/omo-codex/plugin/components/ultrawork/test/codex-hook.test.ts +22 -0
- package/packages/omo-codex/plugin/components/ultrawork/test/package-smoke.test.ts +0 -68
- package/packages/omo-codex/plugin/components/ulw-loop/AGENTS.md +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/CHANGELOG.md +2 -0
- package/packages/omo-codex/plugin/components/ulw-loop/README.md +3 -1
- package/packages/omo-codex/plugin/components/ulw-loop/directive.md +55 -28
- package/packages/omo-codex/plugin/components/ulw-loop/dist/checkpoint.js +6 -1
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-subcommands.d.ts +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-subcommands.js +13 -2
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli.js +405 -25
- package/packages/omo-codex/plugin/components/ulw-loop/dist/codex-goal-instruction.js +12 -1
- package/packages/omo-codex/plugin/components/ulw-loop/dist/domain-types.d.ts +4 -2
- package/packages/omo-codex/plugin/components/ulw-loop/dist/paths.d.ts +7 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/paths.js +16 -1
- package/packages/omo-codex/plugin/components/ulw-loop/dist/plan-crud.js +1 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate-verdicts.d.ts +6 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate-verdicts.js +20 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate.d.ts +1 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate.js +12 -9
- package/packages/omo-codex/plugin/components/ulw-loop/dist/spawn-guard.d.ts +3 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/spawn-guard.js +148 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/stop-resume-hook.d.ts +2 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/stop-resume-hook.js +209 -0
- package/packages/omo-codex/plugin/components/ulw-loop/hooks/hooks.json +25 -2
- package/packages/omo-codex/plugin/components/ulw-loop/package.json +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/SKILL.md +14 -15
- package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/references/full-workflow.md +29 -27
- package/packages/omo-codex/plugin/components/ulw-loop/src/checkpoint.ts +6 -1
- package/packages/omo-codex/plugin/components/ulw-loop/src/cli-subcommands.ts +14 -3
- package/packages/omo-codex/plugin/components/ulw-loop/src/cli.ts +10 -0
- package/packages/omo-codex/plugin/components/ulw-loop/src/codex-goal-instruction.ts +12 -1
- package/packages/omo-codex/plugin/components/ulw-loop/src/domain-types.ts +4 -2
- package/packages/omo-codex/plugin/components/ulw-loop/src/paths.ts +27 -1
- package/packages/omo-codex/plugin/components/ulw-loop/src/plan-crud.ts +1 -0
- package/packages/omo-codex/plugin/components/ulw-loop/src/quality-gate-verdicts.ts +23 -0
- package/packages/omo-codex/plugin/components/ulw-loop/src/quality-gate.ts +16 -9
- package/packages/omo-codex/plugin/components/ulw-loop/src/spawn-guard.ts +138 -0
- package/packages/omo-codex/plugin/components/ulw-loop/src/stop-resume-hook.ts +208 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/cli-create-goals.test.ts +12 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/cli-entrypoint.test.ts +4 -1
- package/packages/omo-codex/plugin/components/ulw-loop/test/codex-goal-instruction.test.ts +8 -35
- package/packages/omo-codex/plugin/components/ulw-loop/test/fixtures/quality-gate-builder.ts +24 -13
- package/packages/omo-codex/plugin/components/ulw-loop/test/package-smoke.test.ts +5 -2
- package/packages/omo-codex/plugin/components/ulw-loop/test/paths.test.ts +43 -8
- package/packages/omo-codex/plugin/components/ulw-loop/test/quality-gate.test.ts +55 -2
- package/packages/omo-codex/plugin/components/ulw-loop/test/spawn-guard.test.ts +228 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/stop-resume-hook.test.ts +193 -0
- package/packages/omo-codex/plugin/hooks/post-compact-resetting-git-bash-mcp-reminder.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-compact-resetting-lsp-diagnostics-cache.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-compact-resetting-project-rule-cache.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-checking-codegraph-init-guidance.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-checking-comments.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-checking-lsp-diagnostics.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-checking-thread-title-hygiene.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-matching-project-rules.json +1 -1
- package/packages/omo-codex/plugin/hooks/pre-tool-use-enforcing-unlimited-goal-budget.json +1 -1
- package/packages/omo-codex/plugin/hooks/pre-tool-use-guarding-ulw-loop-spawns.json +18 -0
- package/packages/omo-codex/plugin/hooks/pre-tool-use-recommending-git-bash-mcp.json +1 -1
- package/packages/omo-codex/plugin/hooks/session-start-checking-auto-update.json +1 -1
- package/packages/omo-codex/plugin/hooks/session-start-checking-bootstrap-provisioning.json +1 -1
- package/packages/omo-codex/plugin/hooks/session-start-checking-codegraph-bootstrap.json +1 -1
- package/packages/omo-codex/plugin/hooks/session-start-loading-project-rules.json +1 -1
- package/packages/omo-codex/plugin/hooks/session-start-recording-session-telemetry.json +1 -1
- package/packages/omo-codex/plugin/hooks/stop-checking-start-work-continuation.json +1 -1
- package/packages/omo-codex/plugin/hooks/stop-checking-ulw-loop-resume.json +17 -0
- package/packages/omo-codex/plugin/hooks/subagent-stop-checking-start-work-continuation.json +1 -1
- package/packages/omo-codex/plugin/hooks/subagent-stop-verifying-lazycodex-executor-evidence.json +2 -2
- package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ultrawork-trigger.json +1 -1
- package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ulw-loop-steering.json +1 -1
- package/packages/omo-codex/plugin/hooks/user-prompt-submit-loading-project-rules.json +1 -1
- package/packages/omo-codex/plugin/model-catalog.json +16 -7
- package/packages/omo-codex/plugin/package-lock.json +13 -13
- package/packages/omo-codex/plugin/package.json +1 -1
- package/packages/omo-codex/plugin/scripts/auto-update.mjs +9 -2
- package/packages/omo-codex/plugin/scripts/entry-guard.mjs +26 -0
- package/packages/omo-codex/plugin/scripts/materialize-shared-upstreams.mjs +3 -1
- package/packages/omo-codex/plugin/scripts/migrate-codex-config/catalog.mjs +16 -7
- package/packages/omo-codex/plugin/scripts/migrate-codex-config/multi-agent-v2-guard.mjs +39 -4
- package/packages/omo-codex/plugin/scripts/migrate-codex-config/subagent-limit-guard.mjs +24 -4
- package/packages/omo-codex/plugin/scripts/migrate-codex-config.mjs +3 -3
- package/packages/omo-codex/plugin/scripts/migrate-omo-sot.mjs +2 -2
- package/packages/omo-codex/plugin/scripts/sync-hook-status-messages.mjs +2 -2
- package/packages/omo-codex/plugin/scripts/sync-skills.mjs +14 -6
- package/packages/omo-codex/plugin/scripts/sync-version.mjs +4 -2
- package/packages/omo-codex/plugin/skills/init-deep/SKILL.md +3 -3
- package/packages/omo-codex/plugin/skills/refactor/SKILL.md +3 -3
- package/packages/omo-codex/plugin/skills/remove-ai-slops/SKILL.md +5 -5
- package/packages/omo-codex/plugin/skills/review-work/SKILL.md +9 -3
- package/packages/omo-codex/plugin/skills/start-work/SKILL.md +6 -3
- package/packages/omo-codex/plugin/skills/teammode/SKILL.md +136 -76
- package/packages/omo-codex/plugin/skills/teammode/scripts/team-guide.mjs +94 -23
- package/packages/omo-codex/plugin/skills/teammode/scripts/team-state.mjs +94 -14
- package/packages/omo-codex/plugin/skills/teammode/scripts/team-transport.mjs +55 -0
- package/packages/omo-codex/plugin/skills/teammode/scripts/team.mjs +72 -18
- package/packages/omo-codex/plugin/skills/ultrawork/SKILL.md +55 -28
- package/packages/omo-codex/plugin/skills/ulw-loop/SKILL.md +14 -15
- package/packages/omo-codex/plugin/skills/ulw-loop/references/full-workflow.md +29 -27
- package/packages/omo-codex/plugin/skills/ulw-plan/references/full-workflow.md +1 -1
- package/packages/omo-codex/plugin/skills/ulw-plan/scripts/scaffold-plan.mjs +2 -2
- package/packages/omo-codex/plugin/skills/ulw-research/SKILL.md +4 -4
- package/packages/omo-codex/plugin/skills/visual-qa/SKILL.md +4 -4
- package/packages/omo-codex/plugin/test/aggregate-agents.test.mjs +116 -10
- package/packages/omo-codex/plugin/test/aggregate-hooks.test.mjs +23 -2
- package/packages/omo-codex/plugin/test/aggregate-manifest.test.mjs +1 -1
- package/packages/omo-codex/plugin/test/aggregate-model-catalog.test.mjs +4 -4
- package/packages/omo-codex/plugin/test/aggregate-skills.test.mjs +4 -2
- package/packages/omo-codex/plugin/test/auto-update-restart-notice.test.mjs +33 -0
- package/packages/omo-codex/plugin/test/auto-update.test.mjs +4 -4
- package/packages/omo-codex/plugin/test/component-hook-contract-cases.mjs +2 -2
- package/packages/omo-codex/plugin/test/lcx-bug-skills.test.mjs +4 -101
- package/packages/omo-codex/plugin/test/migrate-codex-config.test.mjs +160 -23
- package/packages/omo-codex/plugin/test/multi-agent-v2-regression.test.mjs +71 -0
- package/packages/omo-codex/plugin/test/subagent-limit-migration.test.mjs +32 -0
- package/packages/omo-codex/plugin/test/sync-skills-orchestration.test.mjs +20 -2
- package/packages/omo-codex/plugin/test/sync-skills-test-support.mjs +1 -1
- package/packages/omo-codex/plugin/test/sync-skills.test.mjs +4 -2
- package/packages/omo-codex/plugin/test/teammode-transport.test.mjs +345 -0
- package/packages/omo-codex/plugin/test/ulw-plan-skill-contract.test.mjs +9 -40
- package/packages/omo-codex/plugin/test/ulw-research-skill-contract.test.mjs +4 -277
- package/packages/omo-codex/scripts/install-config-reasoning.test.mjs +5 -5
- package/packages/omo-codex/scripts/install-config.test.mjs +22 -3
- package/packages/omo-codex/scripts/install-dist/install-local.mjs +508 -286
- package/packages/omo-codex/scripts/install-generated-bundle.test.mjs +111 -1
- package/packages/shared-skills/skills/remove-ai-slops/SKILL.md +2 -2
- package/packages/shared-skills/skills/review-work/SKILL.md +1 -1
- package/packages/shared-skills/skills/start-work/SKILL.md +5 -2
- package/packages/shared-skills/skills/ulw-plan/references/full-workflow.md +1 -1
- package/packages/shared-skills/skills/ulw-plan/scripts/scaffold-plan.mjs +2 -2
- package/packages/shared-skills/skills/ulw-research/SKILL.md +2 -2
- package/packages/shared-skills/skills/visual-qa/SKILL.md +1 -1
- package/dist/skills/visual-qa/scripts/skill-prompt-contract.test.ts +0 -296
- package/packages/omo-codex/plugin/components/ulw-loop/test/skill-contract.test.ts +0 -70
- package/packages/omo-codex/plugin/test/ulw-research-epistemic-contract.test.mjs +0 -98
- package/packages/shared-skills/skills/visual-qa/scripts/skill-prompt-contract.test.ts +0 -296
- /package/packages/omo-codex/plugin/components/rules/bundled-rules/{hephaestus.md → hephaestus/gpt-5.5.md} +0 -0
|
@@ -95,21 +95,21 @@ var init_atomic_write = __esm(() => {
|
|
|
95
95
|
});
|
|
96
96
|
|
|
97
97
|
// packages/telemetry-core/src/activity-state.ts
|
|
98
|
-
import { existsSync as existsSync5, mkdirSync as mkdirSync2, readFileSync } from "node:fs";
|
|
99
|
-
import { basename as basename6, join as
|
|
98
|
+
import { existsSync as existsSync5, mkdirSync as mkdirSync2, readFileSync as readFileSync2 } from "node:fs";
|
|
99
|
+
import { basename as basename6, join as join33 } from "node:path";
|
|
100
100
|
function resolveTelemetryStateDir(product, options = {}) {
|
|
101
101
|
const dataDir = resolveXdgDataDir(product.cacheDirName, {
|
|
102
102
|
env: options.env,
|
|
103
103
|
osProvider: options.osProvider
|
|
104
104
|
});
|
|
105
|
-
const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined :
|
|
105
|
+
const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined : join33(options.env.XDG_DATA_HOME, product.cacheDirName);
|
|
106
106
|
if (dataDir === xdgStateDir || xdgStateDir === undefined && basename6(dataDir) === product.cacheDirName) {
|
|
107
107
|
return dataDir;
|
|
108
108
|
}
|
|
109
|
-
return
|
|
109
|
+
return join33(dataDir, product.cacheDirName);
|
|
110
110
|
}
|
|
111
111
|
function getTelemetryActivityStateFilePath(stateDir) {
|
|
112
|
-
return
|
|
112
|
+
return join33(stateDir, POSTHOG_ACTIVITY_STATE_FILE);
|
|
113
113
|
}
|
|
114
114
|
function getDailyActiveCaptureState(input) {
|
|
115
115
|
const state = readPostHogActivityState(input.stateDir, input.diagnostics);
|
|
@@ -138,7 +138,7 @@ function readPostHogActivityState(stateDir, diagnostics) {
|
|
|
138
138
|
return {};
|
|
139
139
|
}
|
|
140
140
|
try {
|
|
141
|
-
const stateContent =
|
|
141
|
+
const stateContent = readFileSync2(stateFilePath, "utf-8");
|
|
142
142
|
const stateJson = JSON.parse(stateContent);
|
|
143
143
|
if (!isPostHogActivityState(stateJson)) {
|
|
144
144
|
return {};
|
|
@@ -179,10 +179,10 @@ var init_activity_state = __esm(() => {
|
|
|
179
179
|
var DEFAULT_POSTHOG_HOST = "https://us.i.posthog.com", DEFAULT_POSTHOG_API_KEY = "phc_CFJhj5HyvA62QPhvyaUCtaq23aUfznnijg5VaaGkNk74";
|
|
180
180
|
|
|
181
181
|
// packages/telemetry-core/src/diagnostics.ts
|
|
182
|
-
import { appendFileSync, existsSync as existsSync6, mkdirSync as mkdirSync3, readFileSync as
|
|
183
|
-
import { join as
|
|
182
|
+
import { appendFileSync, existsSync as existsSync6, mkdirSync as mkdirSync3, readFileSync as readFileSync3 } from "node:fs";
|
|
183
|
+
import { join as join34 } from "node:path";
|
|
184
184
|
function getTelemetryDiagnosticsFilePath(diagnosticsDir) {
|
|
185
|
-
return
|
|
185
|
+
return join34(diagnosticsDir, DIAGNOSTICS_FILE_NAME);
|
|
186
186
|
}
|
|
187
187
|
function writeTelemetryDiagnostic(input, options) {
|
|
188
188
|
const now = options.now ?? new Date;
|
|
@@ -205,7 +205,7 @@ function cleanupTelemetryDiagnostics(options) {
|
|
|
205
205
|
}
|
|
206
206
|
try {
|
|
207
207
|
const cutoffMs = (options.now ?? new Date).getTime() - DIAGNOSTICS_RETENTION_MS;
|
|
208
|
-
const retainedLines = trimToMaxBytes(
|
|
208
|
+
const retainedLines = trimToMaxBytes(readFileSync3(diagnosticsFilePath, "utf-8").split(`
|
|
209
209
|
`).filter((line) => shouldRetainLine(line, cutoffMs)));
|
|
210
210
|
writeFileAtomically(diagnosticsFilePath, retainedLines.length === 0 ? "" : `${retainedLines.join(`
|
|
211
211
|
`)}
|
|
@@ -257,7 +257,7 @@ function shouldRetainLine(line, cutoffMs) {
|
|
|
257
257
|
function parseDiagnosticLine(line) {
|
|
258
258
|
try {
|
|
259
259
|
const parsed = JSON.parse(line);
|
|
260
|
-
if (!
|
|
260
|
+
if (!isRecord2(parsed)) {
|
|
261
261
|
return null;
|
|
262
262
|
}
|
|
263
263
|
return parsed;
|
|
@@ -268,7 +268,7 @@ function parseDiagnosticLine(line) {
|
|
|
268
268
|
throw error;
|
|
269
269
|
}
|
|
270
270
|
}
|
|
271
|
-
function
|
|
271
|
+
function isRecord2(value) {
|
|
272
272
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
273
273
|
}
|
|
274
274
|
function trimToMaxBytes(lines) {
|
|
@@ -348,7 +348,7 @@ function getTelemetryDistinctId(machineIdPrefix, osProvider = getDefaultTelemetr
|
|
|
348
348
|
var init_machine_id = () => {};
|
|
349
349
|
|
|
350
350
|
// node_modules/.bun/posthog-node@5.35.12/node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
|
|
351
|
-
import { dirname as
|
|
351
|
+
import { dirname as dirname10, posix, sep as sep7 } from "node:path";
|
|
352
352
|
function createModulerModifier() {
|
|
353
353
|
const getModuleFromFileName = createGetModuleFromFilename();
|
|
354
354
|
return async (frames) => {
|
|
@@ -357,7 +357,7 @@ function createModulerModifier() {
|
|
|
357
357
|
return frames;
|
|
358
358
|
};
|
|
359
359
|
}
|
|
360
|
-
function createGetModuleFromFilename(basePath = process.argv[1] ?
|
|
360
|
+
function createGetModuleFromFilename(basePath = process.argv[1] ? dirname10(process.argv[1]) : process.cwd(), isWindows = sep7 === "\\") {
|
|
361
361
|
const normalizedBase = isWindows ? normalizeWindowsPath(basePath) : basePath;
|
|
362
362
|
return (filename) => {
|
|
363
363
|
if (!filename)
|
|
@@ -3378,7 +3378,7 @@ var init_context_lines_node = __esm(() => {
|
|
|
3378
3378
|
});
|
|
3379
3379
|
|
|
3380
3380
|
// node_modules/.bun/posthog-node@5.35.12/node_modules/posthog-node/dist/extensions/error-tracking/modifiers/relative-path.node.mjs
|
|
3381
|
-
import { isAbsolute as
|
|
3381
|
+
import { isAbsolute as isAbsolute7, relative as relative4, sep as sep8 } from "node:path";
|
|
3382
3382
|
function createRelativePathModifier(basePath = process.cwd()) {
|
|
3383
3383
|
const isWindows = sep8 === "\\";
|
|
3384
3384
|
const toUnix = (p) => isWindows ? p.replace(/\\/g, "/") : p;
|
|
@@ -3386,7 +3386,7 @@ function createRelativePathModifier(basePath = process.cwd()) {
|
|
|
3386
3386
|
return async (frames) => {
|
|
3387
3387
|
for (const frame of frames)
|
|
3388
3388
|
if (!(!frame.filename || frame.filename.startsWith("node:") || frame.filename.startsWith("data:"))) {
|
|
3389
|
-
if (
|
|
3389
|
+
if (isAbsolute7(frame.filename))
|
|
3390
3390
|
frame.filename = toUnix(relative4(normalizedBase, toUnix(frame.filename)));
|
|
3391
3391
|
}
|
|
3392
3392
|
return frames;
|
|
@@ -5903,7 +5903,7 @@ var package_default;
|
|
|
5903
5903
|
var init_package = __esm(() => {
|
|
5904
5904
|
package_default = {
|
|
5905
5905
|
name: "@oh-my-opencode/omo-codex",
|
|
5906
|
-
version: "4.16.
|
|
5906
|
+
version: "4.16.3",
|
|
5907
5907
|
type: "module",
|
|
5908
5908
|
private: true,
|
|
5909
5909
|
description: "Codex harness adapter for oh-my-openagent. Vendored Codex plugin namespace (omo) + TypeScript installer + telemetry.",
|
|
@@ -6123,7 +6123,7 @@ var init_telemetry = __esm(() => {
|
|
|
6123
6123
|
|
|
6124
6124
|
// packages/omo-codex/src/install/install-local-cli.ts
|
|
6125
6125
|
import { readFile as readFile21 } from "node:fs/promises";
|
|
6126
|
-
import { dirname as
|
|
6126
|
+
import { dirname as dirname12, join as join39, resolve as resolve10 } from "node:path";
|
|
6127
6127
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
6128
6128
|
|
|
6129
6129
|
// packages/utils/src/runtime/spawn.ts
|
|
@@ -6456,7 +6456,7 @@ var defaultRunCommand = async (command, args, options) => {
|
|
|
6456
6456
|
};
|
|
6457
6457
|
|
|
6458
6458
|
// packages/omo-codex/src/install/install-codex.ts
|
|
6459
|
-
import { join as
|
|
6459
|
+
import { join as join35, resolve as resolve9 } from "node:path";
|
|
6460
6460
|
import { existsSync as existsSync7 } from "node:fs";
|
|
6461
6461
|
import { homedir as homedir2 } from "node:os";
|
|
6462
6462
|
|
|
@@ -7612,7 +7612,12 @@ function shouldCopyPluginPath(path, root) {
|
|
|
7612
7612
|
if (relative4 === "")
|
|
7613
7613
|
return true;
|
|
7614
7614
|
const parts = relative4.split(sep5);
|
|
7615
|
-
|
|
7615
|
+
if (parts.some((part) => part === ".git" || part === "node_modules"))
|
|
7616
|
+
return false;
|
|
7617
|
+
return !isNestedComponentMcpManifest(parts);
|
|
7618
|
+
}
|
|
7619
|
+
function isNestedComponentMcpManifest(parts) {
|
|
7620
|
+
return parts.length > 1 && parts.at(-1) === ".mcp.json";
|
|
7616
7621
|
}
|
|
7617
7622
|
var removedSparkshellReferencePattern = /\b(?:sparkshell|spark[-_\s]+shell)\b/i;
|
|
7618
7623
|
var removedSparkshellPromptSurfaceDirs = new Set([".codex-plugin", "agents", "bundled-rules", "hooks", "skills"]);
|
|
@@ -7818,7 +7823,7 @@ async function shouldBuildSourcePackages(repoRoot) {
|
|
|
7818
7823
|
|
|
7819
7824
|
// packages/omo-codex/src/install/codex-config-toml.ts
|
|
7820
7825
|
import { mkdir as mkdir5, readFile as readFile11 } from "node:fs/promises";
|
|
7821
|
-
import { dirname as
|
|
7826
|
+
import { dirname as dirname8 } from "node:path";
|
|
7822
7827
|
|
|
7823
7828
|
// packages/omo-codex/src/install/toml-section-editor.ts
|
|
7824
7829
|
function findTomlSection(config, header) {
|
|
@@ -8139,6 +8144,9 @@ function stripTomlLineComment(line) {
|
|
|
8139
8144
|
var LEGACY_MANAGED_CODEX_AGENT_NAMES_TO_PURGE = ["codex-ultrawork-reviewer"];
|
|
8140
8145
|
var CURRENT_MANAGED_CODEX_AGENT_NAMES = [
|
|
8141
8146
|
"explorer",
|
|
8147
|
+
"lazycodex-worker-high",
|
|
8148
|
+
"lazycodex-worker-low",
|
|
8149
|
+
"lazycodex-worker-medium",
|
|
8142
8150
|
"librarian",
|
|
8143
8151
|
"metis",
|
|
8144
8152
|
"momus",
|
|
@@ -8556,12 +8564,18 @@ import { readFile as readFile10 } from "node:fs/promises";
|
|
|
8556
8564
|
import { join as join17 } from "node:path";
|
|
8557
8565
|
var FALLBACK_CODEX_MODEL_CATALOG = {
|
|
8558
8566
|
current: {
|
|
8559
|
-
model: "gpt-5.
|
|
8560
|
-
modelContextWindow:
|
|
8567
|
+
model: "gpt-5.6-sol",
|
|
8568
|
+
modelContextWindow: 372000,
|
|
8561
8569
|
modelReasoningEffort: "high",
|
|
8562
8570
|
planModeReasoningEffort: "xhigh"
|
|
8563
8571
|
},
|
|
8564
8572
|
managedProfiles: [
|
|
8573
|
+
{
|
|
8574
|
+
model: "gpt-5.5",
|
|
8575
|
+
modelContextWindow: 400000,
|
|
8576
|
+
modelReasoningEffort: "high",
|
|
8577
|
+
planModeReasoningEffort: "xhigh"
|
|
8578
|
+
},
|
|
8565
8579
|
{
|
|
8566
8580
|
model: "gpt-5.5",
|
|
8567
8581
|
modelContextWindow: 1e6,
|
|
@@ -8655,30 +8669,87 @@ function isRootSetting2(line, key) {
|
|
|
8655
8669
|
}
|
|
8656
8670
|
|
|
8657
8671
|
// packages/omo-codex/src/install/codex-multi-agent-v2-config.ts
|
|
8672
|
+
import { readFileSync } from "node:fs";
|
|
8673
|
+
import { dirname as dirname7, isAbsolute as isAbsolute6, join as join18 } from "node:path";
|
|
8658
8674
|
var CODEX_AGENTS_HEADER = "agents";
|
|
8659
8675
|
var CODEX_MULTI_AGENT_V2_HEADER = "features.multi_agent_v2";
|
|
8660
8676
|
var CODEX_SUBAGENT_THREAD_LIMIT = 1000;
|
|
8661
|
-
function ensureCodexMultiAgentV2Config(config) {
|
|
8677
|
+
function ensureCodexMultiAgentV2Config(config, options = {}) {
|
|
8662
8678
|
const featureFlag = removeFeatureFlagSetting(config, "multi_agent_v2");
|
|
8663
|
-
const
|
|
8664
|
-
const
|
|
8679
|
+
const v2Preferred = options.multiAgentVersion === "v2";
|
|
8680
|
+
const modelKnown = options.multiAgentVersion != null || readRootModel(featureFlag.config) !== null;
|
|
8681
|
+
const agentsConfig = v2Preferred ? removeAgentsMaxThreads(featureFlag.config) : modelKnown ? ensureAgentsMaxThreads(featureFlag.config) : raiseExistingAgentsMaxThreads(featureFlag.config);
|
|
8665
8682
|
const maxThreadsValue = CODEX_SUBAGENT_THREAD_LIMIT.toString();
|
|
8683
|
+
const preserveDisable = featureFlag.value === false && !v2Preferred;
|
|
8684
|
+
const featureConfig = preserveDisable ? setMultiAgentV2Disable(agentsConfig) : v2Preferred ? removeMultiAgentV2Disable(agentsConfig) : agentsConfig;
|
|
8685
|
+
const section = findTomlSection(featureConfig, CODEX_MULTI_AGENT_V2_HEADER);
|
|
8666
8686
|
if (!section) {
|
|
8667
|
-
const enabledSetting =
|
|
8687
|
+
const enabledSetting = preserveDisable ? `enabled = false
|
|
8668
8688
|
` : "";
|
|
8669
|
-
return appendBlock(
|
|
8689
|
+
return appendBlock(featureConfig, `[${CODEX_MULTI_AGENT_V2_HEADER}]
|
|
8670
8690
|
${enabledSetting}max_concurrent_threads_per_session = ${maxThreadsValue}
|
|
8671
8691
|
`);
|
|
8672
8692
|
}
|
|
8673
|
-
|
|
8674
|
-
|
|
8675
|
-
|
|
8676
|
-
|
|
8677
|
-
|
|
8678
|
-
|
|
8679
|
-
|
|
8693
|
+
return replaceOrInsertSetting(featureConfig, section, "max_concurrent_threads_per_session", maxThreadsValue);
|
|
8694
|
+
}
|
|
8695
|
+
function resolveCodexMultiAgentVersion(config, configPath) {
|
|
8696
|
+
const model = readRootModel(config);
|
|
8697
|
+
if (model === null)
|
|
8698
|
+
return null;
|
|
8699
|
+
const catalogPath = resolveCatalogPath(readRootModelCatalogPath(config), configPath);
|
|
8700
|
+
const catalogVersion = readCatalogMultiAgentVersion(model, catalogPath);
|
|
8701
|
+
if (catalogVersion !== null)
|
|
8702
|
+
return catalogVersion;
|
|
8703
|
+
return /^gpt-5\.6\b/i.test(model) ? "v2" : null;
|
|
8704
|
+
}
|
|
8705
|
+
function resolveCatalogPath(configuredPath, configPath) {
|
|
8706
|
+
if (configuredPath === null)
|
|
8707
|
+
return join18(dirname7(configPath), "models_cache.json");
|
|
8708
|
+
return isAbsolute6(configuredPath) ? configuredPath : join18(dirname7(configPath), configuredPath);
|
|
8709
|
+
}
|
|
8710
|
+
function readCatalogMultiAgentVersion(model, cachePath) {
|
|
8711
|
+
let raw;
|
|
8712
|
+
try {
|
|
8713
|
+
raw = readFileSync(cachePath, "utf8");
|
|
8714
|
+
} catch {
|
|
8715
|
+
return null;
|
|
8716
|
+
}
|
|
8717
|
+
let cache;
|
|
8718
|
+
try {
|
|
8719
|
+
cache = JSON.parse(raw);
|
|
8720
|
+
} catch {
|
|
8721
|
+
return null;
|
|
8680
8722
|
}
|
|
8681
|
-
|
|
8723
|
+
if (!isRecord(cache) || !Array.isArray(cache.models))
|
|
8724
|
+
return null;
|
|
8725
|
+
for (const entry of cache.models) {
|
|
8726
|
+
if (!isRecord(entry))
|
|
8727
|
+
continue;
|
|
8728
|
+
if (entry.slug !== model && entry.id !== model)
|
|
8729
|
+
continue;
|
|
8730
|
+
const version = entry.multi_agent_version;
|
|
8731
|
+
if (version === "v1" || version === "v2")
|
|
8732
|
+
return version;
|
|
8733
|
+
return null;
|
|
8734
|
+
}
|
|
8735
|
+
return null;
|
|
8736
|
+
}
|
|
8737
|
+
function readRootModel(config) {
|
|
8738
|
+
const double = config.match(/^\s*model\s*=\s*"([^"]+)"/m);
|
|
8739
|
+
if (double !== null)
|
|
8740
|
+
return double[1] ?? null;
|
|
8741
|
+
const single = config.match(/^\s*model\s*=\s*'([^']+)'/m);
|
|
8742
|
+
return single?.[1] ?? null;
|
|
8743
|
+
}
|
|
8744
|
+
function readRootModelCatalogPath(config) {
|
|
8745
|
+
const double = config.match(/^\s*model_catalog_json\s*=\s*"([^"]+)"/m);
|
|
8746
|
+
if (double !== null)
|
|
8747
|
+
return double[1] ?? null;
|
|
8748
|
+
const single = config.match(/^\s*model_catalog_json\s*=\s*'([^']+)'/m);
|
|
8749
|
+
return single?.[1] ?? null;
|
|
8750
|
+
}
|
|
8751
|
+
function isRecord(value) {
|
|
8752
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
8682
8753
|
}
|
|
8683
8754
|
function removeFeatureFlagSetting(config, featureName) {
|
|
8684
8755
|
const section = findTomlSection(config, "features");
|
|
@@ -8699,6 +8770,36 @@ max_threads = ${maxThreadsValue}
|
|
|
8699
8770
|
}
|
|
8700
8771
|
return replaceOrInsertSetting(config, section, "max_threads", maxThreadsValue);
|
|
8701
8772
|
}
|
|
8773
|
+
function removeAgentsMaxThreads(config) {
|
|
8774
|
+
const section = findTomlSection(config, CODEX_AGENTS_HEADER);
|
|
8775
|
+
if (!section)
|
|
8776
|
+
return config;
|
|
8777
|
+
if (!/^\s*max_threads\s*=/m.test(section.text))
|
|
8778
|
+
return config;
|
|
8779
|
+
return removeSetting(config, section, "max_threads");
|
|
8780
|
+
}
|
|
8781
|
+
function removeMultiAgentV2Disable(config) {
|
|
8782
|
+
const section = findTomlSection(config, CODEX_MULTI_AGENT_V2_HEADER);
|
|
8783
|
+
if (!section)
|
|
8784
|
+
return config;
|
|
8785
|
+
if (!/^\s*enabled\s*=\s*false(?:\s*#.*)?$/m.test(section.text))
|
|
8786
|
+
return config;
|
|
8787
|
+
return removeSetting(config, section, "enabled");
|
|
8788
|
+
}
|
|
8789
|
+
function setMultiAgentV2Disable(config) {
|
|
8790
|
+
const section = findTomlSection(config, CODEX_MULTI_AGENT_V2_HEADER);
|
|
8791
|
+
if (!section)
|
|
8792
|
+
return config;
|
|
8793
|
+
return replaceOrInsertSetting(config, section, "enabled", "false");
|
|
8794
|
+
}
|
|
8795
|
+
function raiseExistingAgentsMaxThreads(config) {
|
|
8796
|
+
const section = findTomlSection(config, CODEX_AGENTS_HEADER);
|
|
8797
|
+
if (!section)
|
|
8798
|
+
return config;
|
|
8799
|
+
if (!/^\s*max_threads\s*=/m.test(section.text))
|
|
8800
|
+
return config;
|
|
8801
|
+
return replaceOrInsertSetting(config, section, "max_threads", CODEX_SUBAGENT_THREAD_LIMIT.toString());
|
|
8802
|
+
}
|
|
8702
8803
|
function readBooleanSetting(sectionText, key) {
|
|
8703
8804
|
const match = new RegExp(`^\\s*${escapeRegExp(key)}\\s*=\\s*(true|false)\\s*(?:#.*)?$`, "m").exec(sectionText);
|
|
8704
8805
|
if (!match)
|
|
@@ -8708,7 +8809,7 @@ function readBooleanSetting(sectionText, key) {
|
|
|
8708
8809
|
|
|
8709
8810
|
// packages/omo-codex/src/install/codex-config-toml.ts
|
|
8710
8811
|
async function updateCodexConfig(input) {
|
|
8711
|
-
await mkdir5(
|
|
8812
|
+
await mkdir5(dirname8(input.configPath), { recursive: true });
|
|
8712
8813
|
let config;
|
|
8713
8814
|
try {
|
|
8714
8815
|
config = await readFile11(input.configPath, "utf8");
|
|
@@ -8731,7 +8832,9 @@ async function updateCodexConfig(input) {
|
|
|
8731
8832
|
config = ensureFeatureEnabled(config, "multi_agent");
|
|
8732
8833
|
config = removeUnsupportedCodexMultiAgentModeConfig(config);
|
|
8733
8834
|
config = ensureCodexReasoningConfig(config, await readCodexModelCatalog(input.repoRoot));
|
|
8734
|
-
config = ensureCodexMultiAgentV2Config(config
|
|
8835
|
+
config = ensureCodexMultiAgentV2Config(config, {
|
|
8836
|
+
multiAgentVersion: resolveCodexMultiAgentVersion(config, input.configPath)
|
|
8837
|
+
});
|
|
8735
8838
|
if (input.autonomousPermissions === true)
|
|
8736
8839
|
config = ensureAutonomousPermissions(config);
|
|
8737
8840
|
if (!(input.preserveMarketplaceSource === true && hasMarketplaceBlock(config, input.marketplaceName))) {
|
|
@@ -8757,7 +8860,7 @@ function isMissingFileError(error) {
|
|
|
8757
8860
|
// packages/omo-codex/src/install/codex-hook-trust.ts
|
|
8758
8861
|
import { createHash } from "node:crypto";
|
|
8759
8862
|
import { readFile as readFile12 } from "node:fs/promises";
|
|
8760
|
-
import { join as
|
|
8863
|
+
import { join as join19 } from "node:path";
|
|
8761
8864
|
var EVENT_LABELS = new Map([
|
|
8762
8865
|
["PreToolUse", "pre_tool_use"],
|
|
8763
8866
|
["PermissionRequest", "permission_request"],
|
|
@@ -8771,7 +8874,7 @@ var EVENT_LABELS = new Map([
|
|
|
8771
8874
|
["Stop", "stop"]
|
|
8772
8875
|
]);
|
|
8773
8876
|
async function trustedHookStatesForPlugin(input) {
|
|
8774
|
-
const manifestPath =
|
|
8877
|
+
const manifestPath = join19(input.pluginRoot, ".codex-plugin", "plugin.json");
|
|
8775
8878
|
if (!await exists(manifestPath))
|
|
8776
8879
|
return [];
|
|
8777
8880
|
const manifest = JSON.parse(await readFile12(manifestPath, "utf8"));
|
|
@@ -8779,7 +8882,7 @@ async function trustedHookStatesForPlugin(input) {
|
|
|
8779
8882
|
return [];
|
|
8780
8883
|
const states = [];
|
|
8781
8884
|
for (const hookPath of hookManifestPaths2(manifest.hooks)) {
|
|
8782
|
-
const hooksPath =
|
|
8885
|
+
const hooksPath = join19(input.pluginRoot, hookPath);
|
|
8783
8886
|
if (!await exists(hooksPath))
|
|
8784
8887
|
continue;
|
|
8785
8888
|
const parsed = JSON.parse(await readFile12(hooksPath, "utf8"));
|
|
@@ -8904,207 +9007,181 @@ function toCodexResolution(resolution) {
|
|
|
8904
9007
|
}
|
|
8905
9008
|
|
|
8906
9009
|
// packages/omo-codex/src/install/link-cached-plugin-agents.ts
|
|
8907
|
-
import { copyFile, lstat as
|
|
8908
|
-
import { basename as basename5, join as
|
|
9010
|
+
import { copyFile, lstat as lstat9, mkdir as mkdir6, readdir as readdir7, rm as rm8, writeFile as writeFile7 } from "node:fs/promises";
|
|
9011
|
+
import { basename as basename5, join as join22 } from "node:path";
|
|
8909
9012
|
|
|
8910
|
-
// packages/omo-codex/src/install/
|
|
8911
|
-
import { lstat as lstat7, readFile as readFile13,
|
|
8912
|
-
import { join as
|
|
8913
|
-
|
|
8914
|
-
|
|
8915
|
-
|
|
8916
|
-
|
|
8917
|
-
|
|
8918
|
-
|
|
8919
|
-
|
|
9013
|
+
// packages/omo-codex/src/install/preserved-agent-settings.ts
|
|
9014
|
+
import { lstat as lstat7, readFile as readFile13, readdir as readdir6, writeFile as writeFile6 } from "node:fs/promises";
|
|
9015
|
+
import { join as join20 } from "node:path";
|
|
9016
|
+
|
|
9017
|
+
// packages/omo-codex/src/install/managed-agent-reasoning-defaults.ts
|
|
9018
|
+
var MANAGED_REASONING_DEFAULT_UPGRADES = new Map([
|
|
9019
|
+
[
|
|
9020
|
+
"explorer",
|
|
9021
|
+
[
|
|
9022
|
+
{
|
|
9023
|
+
previous: { model: "gpt-5.4-mini", effort: "low" },
|
|
9024
|
+
current: { model: "gpt-5.6-terra", effort: "medium" }
|
|
9025
|
+
},
|
|
9026
|
+
{
|
|
9027
|
+
previous: { model: "gpt-5.6-terra", effort: "medium" },
|
|
9028
|
+
current: { model: "gpt-5.6-luna", effort: "low" }
|
|
9029
|
+
}
|
|
8920
9030
|
]
|
|
9031
|
+
],
|
|
9032
|
+
[
|
|
9033
|
+
"librarian",
|
|
9034
|
+
[
|
|
9035
|
+
{
|
|
9036
|
+
previous: { model: "gpt-5.4-mini", effort: "low" },
|
|
9037
|
+
current: { model: "gpt-5.6-terra", effort: "medium" }
|
|
9038
|
+
},
|
|
9039
|
+
{
|
|
9040
|
+
previous: { model: "gpt-5.6-terra", effort: "medium" },
|
|
9041
|
+
current: { model: "gpt-5.6-luna", effort: "low" }
|
|
9042
|
+
}
|
|
9043
|
+
]
|
|
9044
|
+
],
|
|
9045
|
+
[
|
|
9046
|
+
"momus",
|
|
9047
|
+
[
|
|
9048
|
+
{
|
|
9049
|
+
previous: { model: "gpt-5.5", effort: "xhigh" },
|
|
9050
|
+
current: { model: "gpt-5.6-sol", effort: "ultra" }
|
|
9051
|
+
}
|
|
9052
|
+
]
|
|
9053
|
+
],
|
|
9054
|
+
[
|
|
9055
|
+
"plan",
|
|
9056
|
+
[
|
|
9057
|
+
{
|
|
9058
|
+
previous: { model: "gpt-5.6-sol", effort: "xhigh" },
|
|
9059
|
+
current: { model: "gpt-5.6-sol", effort: "max" }
|
|
9060
|
+
}
|
|
9061
|
+
]
|
|
9062
|
+
],
|
|
9063
|
+
[
|
|
9064
|
+
"lazycodex-worker-medium",
|
|
9065
|
+
[
|
|
9066
|
+
{
|
|
9067
|
+
previous: { model: "gpt-5.6-sol", effort: "high" },
|
|
9068
|
+
current: { model: "gpt-5.6-luna", effort: "max" }
|
|
9069
|
+
}
|
|
9070
|
+
]
|
|
9071
|
+
],
|
|
9072
|
+
[
|
|
9073
|
+
"lazycodex-qa-executor",
|
|
9074
|
+
[
|
|
9075
|
+
{
|
|
9076
|
+
previous: { model: "gpt-5.6-terra", effort: "medium" },
|
|
9077
|
+
current: { model: "gpt-5.6-luna", effort: "high" }
|
|
9078
|
+
}
|
|
9079
|
+
]
|
|
9080
|
+
],
|
|
9081
|
+
[
|
|
9082
|
+
"lazycodex-gate-reviewer",
|
|
9083
|
+
[
|
|
9084
|
+
{
|
|
9085
|
+
previous: { model: "gpt-5.6-sol", effort: "xhigh" },
|
|
9086
|
+
current: { model: "gpt-5.6-sol", effort: "high" }
|
|
9087
|
+
}
|
|
9088
|
+
]
|
|
9089
|
+
]
|
|
9090
|
+
]);
|
|
9091
|
+
function resolveManagedAgentReasoning(input) {
|
|
9092
|
+
const steps = MANAGED_REASONING_DEFAULT_UPGRADES.get(input.agentName);
|
|
9093
|
+
if (steps === undefined)
|
|
9094
|
+
return input.preserved.effort;
|
|
9095
|
+
const latest = steps[steps.length - 1];
|
|
9096
|
+
if (latest === undefined)
|
|
9097
|
+
return input.preserved.effort;
|
|
9098
|
+
if (input.bundledModel !== latest.current.model || input.bundledEffort !== latest.current.effort) {
|
|
9099
|
+
return input.preserved.effort;
|
|
8921
9100
|
}
|
|
8922
|
-
|
|
8923
|
-
|
|
8924
|
-
const agentsDir = join19(input.codexHome, "agents");
|
|
8925
|
-
if (!await exists2(agentsDir))
|
|
8926
|
-
return;
|
|
8927
|
-
for (const retiredAgent of RETIRED_MANAGED_AGENT_FILES) {
|
|
8928
|
-
const agentPath = join19(agentsDir, retiredAgent.fileName);
|
|
8929
|
-
if (!await exists2(agentPath))
|
|
8930
|
-
continue;
|
|
8931
|
-
const agentStat = await lstat7(agentPath);
|
|
8932
|
-
if (agentStat.isDirectory() && !agentStat.isSymbolicLink())
|
|
8933
|
-
continue;
|
|
8934
|
-
const content = await readTextIfExists(agentPath);
|
|
8935
|
-
if (content === null || !hasRequiredMarkers(content, retiredAgent.requiredMarkers))
|
|
8936
|
-
continue;
|
|
8937
|
-
await rm7(agentPath, { force: true });
|
|
8938
|
-
}
|
|
8939
|
-
}
|
|
8940
|
-
function hasRequiredMarkers(content, markers) {
|
|
8941
|
-
return markers.every((marker) => content.includes(marker));
|
|
8942
|
-
}
|
|
8943
|
-
async function readTextIfExists(path) {
|
|
8944
|
-
try {
|
|
8945
|
-
return await readFile13(path, "utf8");
|
|
8946
|
-
} catch (error) {
|
|
8947
|
-
if (nodeErrorCode(error) === "ENOENT")
|
|
8948
|
-
return null;
|
|
8949
|
-
throw error;
|
|
8950
|
-
}
|
|
8951
|
-
}
|
|
8952
|
-
async function exists2(path) {
|
|
8953
|
-
try {
|
|
8954
|
-
await lstat7(path);
|
|
8955
|
-
return true;
|
|
8956
|
-
} catch (error) {
|
|
8957
|
-
if (nodeErrorCode(error) !== "ENOENT")
|
|
8958
|
-
throw error;
|
|
8959
|
-
return false;
|
|
8960
|
-
}
|
|
8961
|
-
}
|
|
8962
|
-
function nodeErrorCode(error) {
|
|
8963
|
-
if (!(error instanceof Error) || !("code" in error))
|
|
8964
|
-
return null;
|
|
8965
|
-
return typeof error.code === "string" ? error.code : null;
|
|
9101
|
+
const preservedMatchesAnyStep = steps.some((step) => input.preserved.model === step.previous.model && input.preserved.effort === step.previous.effort);
|
|
9102
|
+
return preservedMatchesAnyStep ? latest.current.effort : input.preserved.effort;
|
|
8966
9103
|
}
|
|
8967
9104
|
|
|
8968
|
-
// packages/omo-codex/src/install/
|
|
8969
|
-
var MANIFEST_FILE = ".installed-agents.json";
|
|
9105
|
+
// packages/omo-codex/src/install/preserved-agent-settings.ts
|
|
8970
9106
|
async function capturePreservedAgentReasoning(input) {
|
|
8971
9107
|
const agentsDir = join20(input.codexHome, "agents");
|
|
8972
|
-
if (!await
|
|
9108
|
+
if (!await exists2(agentsDir))
|
|
8973
9109
|
return new Map;
|
|
8974
9110
|
const preserved = new Map;
|
|
8975
9111
|
const agentEntries = await readdir6(agentsDir, { withFileTypes: true });
|
|
8976
9112
|
for (const entry of agentEntries) {
|
|
8977
9113
|
if (!entry.name.endsWith(".toml"))
|
|
8978
9114
|
continue;
|
|
8979
|
-
const content = await
|
|
9115
|
+
const content = await readTextIfExists(join20(agentsDir, entry.name));
|
|
8980
9116
|
if (content === null)
|
|
8981
9117
|
continue;
|
|
8982
9118
|
const effort = extractReasoningEffort(content);
|
|
8983
|
-
if (effort !== null)
|
|
8984
|
-
preserved.set(agentNameFromToml(entry.name),
|
|
9119
|
+
if (effort !== null) {
|
|
9120
|
+
preserved.set(agentNameFromToml(entry.name), {
|
|
9121
|
+
model: extractModel(content),
|
|
9122
|
+
effort
|
|
9123
|
+
});
|
|
9124
|
+
}
|
|
8985
9125
|
}
|
|
8986
9126
|
return preserved;
|
|
8987
9127
|
}
|
|
8988
9128
|
async function capturePreservedAgentServiceTier(input) {
|
|
8989
9129
|
const agentsDir = join20(input.codexHome, "agents");
|
|
8990
|
-
if (!await
|
|
9130
|
+
if (!await exists2(agentsDir))
|
|
8991
9131
|
return new Map;
|
|
8992
9132
|
const preserved = new Map;
|
|
8993
9133
|
const agentEntries = await readdir6(agentsDir, { withFileTypes: true });
|
|
8994
9134
|
for (const entry of agentEntries) {
|
|
8995
9135
|
if (!entry.name.endsWith(".toml"))
|
|
8996
9136
|
continue;
|
|
8997
|
-
const content = await
|
|
9137
|
+
const content = await readTextIfExists(join20(agentsDir, entry.name));
|
|
8998
9138
|
if (content === null)
|
|
8999
9139
|
continue;
|
|
9000
9140
|
preserved.set(agentNameFromToml(entry.name), extractServiceTier(content));
|
|
9001
9141
|
}
|
|
9002
9142
|
return preserved;
|
|
9003
9143
|
}
|
|
9004
|
-
async function
|
|
9005
|
-
|
|
9006
|
-
await purgeRetiredManagedAgentFiles({ codexHome: input.codexHome });
|
|
9007
|
-
if (bundledAgents.length === 0) {
|
|
9008
|
-
await writeManifest(input.pluginRoot, []);
|
|
9009
|
-
return [];
|
|
9010
|
-
}
|
|
9011
|
-
const agentsDir = join20(input.codexHome, "agents");
|
|
9012
|
-
await mkdir6(agentsDir, { recursive: true });
|
|
9013
|
-
const linked = [];
|
|
9014
|
-
for (const agentPath of bundledAgents) {
|
|
9015
|
-
const agentFileName = basename5(agentPath);
|
|
9016
|
-
const agentName = agentNameFromToml(agentFileName);
|
|
9017
|
-
const linkPath = join20(agentsDir, agentFileName);
|
|
9018
|
-
await replaceWithCopy(linkPath, agentPath);
|
|
9019
|
-
await restorePreservedReasoning({
|
|
9020
|
-
agentName,
|
|
9021
|
-
linkPath,
|
|
9022
|
-
target: agentPath,
|
|
9023
|
-
value: input.preservedReasoning?.get(agentName)
|
|
9024
|
-
});
|
|
9025
|
-
await restorePreservedServiceTier({
|
|
9026
|
-
linkPath,
|
|
9027
|
-
preserved: input.preservedServiceTier?.has(agentName) ?? false,
|
|
9028
|
-
value: input.preservedServiceTier?.get(agentName) ?? null
|
|
9029
|
-
});
|
|
9030
|
-
linked.push({ name: agentFileName, path: linkPath, target: agentPath });
|
|
9031
|
-
}
|
|
9032
|
-
await writeManifest(input.pluginRoot, linked.map((entry) => entry.path));
|
|
9033
|
-
return linked;
|
|
9034
|
-
}
|
|
9035
|
-
async function restorePreservedServiceTier(input) {
|
|
9036
|
-
if (!input.preserved)
|
|
9144
|
+
async function restorePreservedReasoning(input) {
|
|
9145
|
+
if (input.value === undefined)
|
|
9037
9146
|
return;
|
|
9038
|
-
const content = await
|
|
9039
|
-
|
|
9147
|
+
const content = await readFile13(input.target, "utf8");
|
|
9148
|
+
const bundledEffort = extractReasoningEffort(content);
|
|
9149
|
+
const effort = resolveManagedAgentReasoning({
|
|
9150
|
+
agentName: input.agentName,
|
|
9151
|
+
bundledModel: extractModel(content),
|
|
9152
|
+
bundledEffort,
|
|
9153
|
+
preserved: input.value
|
|
9154
|
+
});
|
|
9155
|
+
if (bundledEffort === effort)
|
|
9040
9156
|
return;
|
|
9041
|
-
const replacement =
|
|
9157
|
+
const replacement = replaceTopLevelStringSetting(content, "model_reasoning_effort", effort, { insertIfMissing: false });
|
|
9042
9158
|
if (!replacement.replaced)
|
|
9043
9159
|
return;
|
|
9044
9160
|
await writeFile6(input.linkPath, replacement.content);
|
|
9045
9161
|
}
|
|
9046
|
-
async function
|
|
9047
|
-
|
|
9048
|
-
if (!await exists3(componentsRoot))
|
|
9049
|
-
return [];
|
|
9050
|
-
const componentEntries = await readdir6(componentsRoot, { withFileTypes: true });
|
|
9051
|
-
const agents = [];
|
|
9052
|
-
for (const entry of componentEntries) {
|
|
9053
|
-
if (!entry.isDirectory())
|
|
9054
|
-
continue;
|
|
9055
|
-
const agentsRoot = join20(componentsRoot, entry.name, "agents");
|
|
9056
|
-
if (!await exists3(agentsRoot))
|
|
9057
|
-
continue;
|
|
9058
|
-
const agentEntries = await readdir6(agentsRoot, { withFileTypes: true });
|
|
9059
|
-
for (const file of agentEntries) {
|
|
9060
|
-
if (!file.isFile() || !file.name.endsWith(".toml"))
|
|
9061
|
-
continue;
|
|
9062
|
-
agents.push(join20(agentsRoot, file.name));
|
|
9063
|
-
}
|
|
9064
|
-
}
|
|
9065
|
-
agents.sort();
|
|
9066
|
-
return agents;
|
|
9067
|
-
}
|
|
9068
|
-
async function replaceWithCopy(linkPath, target) {
|
|
9069
|
-
await prepareReplacement(linkPath);
|
|
9070
|
-
await copyFile(target, linkPath);
|
|
9071
|
-
}
|
|
9072
|
-
async function prepareReplacement(linkPath) {
|
|
9073
|
-
if (!await exists3(linkPath))
|
|
9074
|
-
return;
|
|
9075
|
-
const entryStat = await lstat8(linkPath);
|
|
9076
|
-
if (entryStat.isDirectory() && !entryStat.isSymbolicLink()) {
|
|
9077
|
-
throw new Error(`${linkPath} already exists and is a directory; refusing to replace`);
|
|
9078
|
-
}
|
|
9079
|
-
await rm8(linkPath, { force: true });
|
|
9080
|
-
}
|
|
9081
|
-
async function writeManifest(pluginRoot, agentPaths) {
|
|
9082
|
-
const manifestPath = join20(pluginRoot, MANIFEST_FILE);
|
|
9083
|
-
const payload = { agents: [...agentPaths].sort() };
|
|
9084
|
-
await writeFile6(manifestPath, `${JSON.stringify(payload, null, "\t")}
|
|
9085
|
-
`);
|
|
9086
|
-
}
|
|
9087
|
-
async function restorePreservedReasoning(input) {
|
|
9088
|
-
if (input.value === undefined)
|
|
9162
|
+
async function restorePreservedServiceTier(input) {
|
|
9163
|
+
if (!input.preserved)
|
|
9089
9164
|
return;
|
|
9090
|
-
const content = await
|
|
9091
|
-
|
|
9092
|
-
if (bundledEffort === input.value)
|
|
9165
|
+
const content = await readFile13(input.linkPath, "utf8");
|
|
9166
|
+
if (extractServiceTier(content) === input.value)
|
|
9093
9167
|
return;
|
|
9094
|
-
const replacement =
|
|
9168
|
+
const replacement = replaceTopLevelStringSetting(content, "service_tier", input.value, { insertIfMissing: true });
|
|
9095
9169
|
if (!replacement.replaced)
|
|
9096
9170
|
return;
|
|
9097
9171
|
await writeFile6(input.linkPath, replacement.content);
|
|
9098
9172
|
}
|
|
9099
|
-
async function
|
|
9173
|
+
async function readTextIfExists(path) {
|
|
9100
9174
|
try {
|
|
9101
|
-
return await
|
|
9175
|
+
return await readFile13(path, "utf8");
|
|
9102
9176
|
} catch (error) {
|
|
9103
|
-
if (
|
|
9177
|
+
if (nodeErrorCode(error) === "ENOENT")
|
|
9104
9178
|
return null;
|
|
9105
9179
|
throw error;
|
|
9106
9180
|
}
|
|
9107
9181
|
}
|
|
9182
|
+
function extractModel(content) {
|
|
9183
|
+
return extractTopLevelStringSetting(content, "model");
|
|
9184
|
+
}
|
|
9108
9185
|
function extractReasoningEffort(content) {
|
|
9109
9186
|
return extractTopLevelStringSetting(content, "model_reasoning_effort");
|
|
9110
9187
|
}
|
|
@@ -9124,12 +9201,6 @@ function extractTopLevelStringSetting(content, key) {
|
|
|
9124
9201
|
}
|
|
9125
9202
|
return null;
|
|
9126
9203
|
}
|
|
9127
|
-
function replaceReasoningEffort(content, value) {
|
|
9128
|
-
return replaceTopLevelStringSetting(content, "model_reasoning_effort", value, { insertIfMissing: false });
|
|
9129
|
-
}
|
|
9130
|
-
function replaceServiceTier(content, value) {
|
|
9131
|
-
return replaceTopLevelStringSetting(content, "service_tier", value, { insertIfMissing: true });
|
|
9132
|
-
}
|
|
9133
9204
|
function replaceTopLevelStringSetting(content, key, value, options) {
|
|
9134
9205
|
const lines = content.split(/\n/);
|
|
9135
9206
|
for (let index = 0;index < lines.length; index += 1) {
|
|
@@ -9189,6 +9260,64 @@ function parseJsonString(value) {
|
|
|
9189
9260
|
return null;
|
|
9190
9261
|
}
|
|
9191
9262
|
}
|
|
9263
|
+
async function exists2(path) {
|
|
9264
|
+
try {
|
|
9265
|
+
await lstat7(path);
|
|
9266
|
+
return true;
|
|
9267
|
+
} catch (error) {
|
|
9268
|
+
if (nodeErrorCode(error) !== "ENOENT")
|
|
9269
|
+
throw error;
|
|
9270
|
+
return false;
|
|
9271
|
+
}
|
|
9272
|
+
}
|
|
9273
|
+
function nodeErrorCode(error) {
|
|
9274
|
+
if (!(error instanceof Error) || !("code" in error))
|
|
9275
|
+
return null;
|
|
9276
|
+
return typeof error.code === "string" ? error.code : null;
|
|
9277
|
+
}
|
|
9278
|
+
|
|
9279
|
+
// packages/omo-codex/src/install/retired-managed-agent-purge.ts
|
|
9280
|
+
import { lstat as lstat8, readFile as readFile14, rm as rm7 } from "node:fs/promises";
|
|
9281
|
+
import { join as join21 } from "node:path";
|
|
9282
|
+
var RETIRED_MANAGED_AGENT_FILES = [
|
|
9283
|
+
{
|
|
9284
|
+
fileName: "codex-ultrawork-reviewer.toml",
|
|
9285
|
+
requiredMarkers: [
|
|
9286
|
+
'name = "codex-ultrawork-reviewer"',
|
|
9287
|
+
'description = "Strict ultrawork verification reviewer.',
|
|
9288
|
+
'developer_instructions = """You are the ultrawork verification reviewer.'
|
|
9289
|
+
]
|
|
9290
|
+
}
|
|
9291
|
+
];
|
|
9292
|
+
async function purgeRetiredManagedAgentFiles(input) {
|
|
9293
|
+
const agentsDir = join21(input.codexHome, "agents");
|
|
9294
|
+
if (!await exists3(agentsDir))
|
|
9295
|
+
return;
|
|
9296
|
+
for (const retiredAgent of RETIRED_MANAGED_AGENT_FILES) {
|
|
9297
|
+
const agentPath = join21(agentsDir, retiredAgent.fileName);
|
|
9298
|
+
if (!await exists3(agentPath))
|
|
9299
|
+
continue;
|
|
9300
|
+
const agentStat = await lstat8(agentPath);
|
|
9301
|
+
if (agentStat.isDirectory() && !agentStat.isSymbolicLink())
|
|
9302
|
+
continue;
|
|
9303
|
+
const content = await readTextIfExists2(agentPath);
|
|
9304
|
+
if (content === null || !hasRequiredMarkers(content, retiredAgent.requiredMarkers))
|
|
9305
|
+
continue;
|
|
9306
|
+
await rm7(agentPath, { force: true });
|
|
9307
|
+
}
|
|
9308
|
+
}
|
|
9309
|
+
function hasRequiredMarkers(content, markers) {
|
|
9310
|
+
return markers.every((marker) => content.includes(marker));
|
|
9311
|
+
}
|
|
9312
|
+
async function readTextIfExists2(path) {
|
|
9313
|
+
try {
|
|
9314
|
+
return await readFile14(path, "utf8");
|
|
9315
|
+
} catch (error) {
|
|
9316
|
+
if (nodeErrorCode2(error) === "ENOENT")
|
|
9317
|
+
return null;
|
|
9318
|
+
throw error;
|
|
9319
|
+
}
|
|
9320
|
+
}
|
|
9192
9321
|
async function exists3(path) {
|
|
9193
9322
|
try {
|
|
9194
9323
|
await lstat8(path);
|
|
@@ -9205,12 +9334,105 @@ function nodeErrorCode2(error) {
|
|
|
9205
9334
|
return typeof error.code === "string" ? error.code : null;
|
|
9206
9335
|
}
|
|
9207
9336
|
|
|
9337
|
+
// packages/omo-codex/src/install/link-cached-plugin-agents.ts
|
|
9338
|
+
var MANIFEST_FILE = ".installed-agents.json";
|
|
9339
|
+
async function linkCachedPluginAgents(input) {
|
|
9340
|
+
const bundledAgents = await discoverBundledAgents(input.pluginRoot);
|
|
9341
|
+
await purgeRetiredManagedAgentFiles({ codexHome: input.codexHome });
|
|
9342
|
+
if (bundledAgents.length === 0) {
|
|
9343
|
+
await writeManifest(input.pluginRoot, []);
|
|
9344
|
+
return [];
|
|
9345
|
+
}
|
|
9346
|
+
const agentsDir = join22(input.codexHome, "agents");
|
|
9347
|
+
await mkdir6(agentsDir, { recursive: true });
|
|
9348
|
+
const linked = [];
|
|
9349
|
+
for (const agentPath of bundledAgents) {
|
|
9350
|
+
const agentFileName = basename5(agentPath);
|
|
9351
|
+
const agentName = agentNameFromToml2(agentFileName);
|
|
9352
|
+
const linkPath = join22(agentsDir, agentFileName);
|
|
9353
|
+
await replaceWithCopy(linkPath, agentPath);
|
|
9354
|
+
await restorePreservedReasoning({
|
|
9355
|
+
agentName,
|
|
9356
|
+
linkPath,
|
|
9357
|
+
target: agentPath,
|
|
9358
|
+
value: input.preservedReasoning?.get(agentName)
|
|
9359
|
+
});
|
|
9360
|
+
await restorePreservedServiceTier({
|
|
9361
|
+
linkPath,
|
|
9362
|
+
preserved: input.preservedServiceTier?.has(agentName) ?? false,
|
|
9363
|
+
value: input.preservedServiceTier?.get(agentName) ?? null
|
|
9364
|
+
});
|
|
9365
|
+
linked.push({ name: agentFileName, path: linkPath, target: agentPath });
|
|
9366
|
+
}
|
|
9367
|
+
await writeManifest(input.pluginRoot, linked.map((entry) => entry.path));
|
|
9368
|
+
return linked;
|
|
9369
|
+
}
|
|
9370
|
+
async function discoverBundledAgents(pluginRoot) {
|
|
9371
|
+
const componentsRoot = join22(pluginRoot, "components");
|
|
9372
|
+
if (!await exists4(componentsRoot))
|
|
9373
|
+
return [];
|
|
9374
|
+
const componentEntries = await readdir7(componentsRoot, { withFileTypes: true });
|
|
9375
|
+
const agents = [];
|
|
9376
|
+
for (const entry of componentEntries) {
|
|
9377
|
+
if (!entry.isDirectory())
|
|
9378
|
+
continue;
|
|
9379
|
+
const agentsRoot = join22(componentsRoot, entry.name, "agents");
|
|
9380
|
+
if (!await exists4(agentsRoot))
|
|
9381
|
+
continue;
|
|
9382
|
+
const agentEntries = await readdir7(agentsRoot, { withFileTypes: true });
|
|
9383
|
+
for (const file of agentEntries) {
|
|
9384
|
+
if (!file.isFile() || !file.name.endsWith(".toml"))
|
|
9385
|
+
continue;
|
|
9386
|
+
agents.push(join22(agentsRoot, file.name));
|
|
9387
|
+
}
|
|
9388
|
+
}
|
|
9389
|
+
agents.sort();
|
|
9390
|
+
return agents;
|
|
9391
|
+
}
|
|
9392
|
+
async function replaceWithCopy(linkPath, target) {
|
|
9393
|
+
await prepareReplacement(linkPath);
|
|
9394
|
+
await copyFile(target, linkPath);
|
|
9395
|
+
}
|
|
9396
|
+
async function prepareReplacement(linkPath) {
|
|
9397
|
+
if (!await exists4(linkPath))
|
|
9398
|
+
return;
|
|
9399
|
+
const entryStat = await lstat9(linkPath);
|
|
9400
|
+
if (entryStat.isDirectory() && !entryStat.isSymbolicLink()) {
|
|
9401
|
+
throw new Error(`${linkPath} already exists and is a directory; refusing to replace`);
|
|
9402
|
+
}
|
|
9403
|
+
await rm8(linkPath, { force: true });
|
|
9404
|
+
}
|
|
9405
|
+
async function writeManifest(pluginRoot, agentPaths) {
|
|
9406
|
+
const manifestPath = join22(pluginRoot, MANIFEST_FILE);
|
|
9407
|
+
const payload = { agents: [...agentPaths].sort() };
|
|
9408
|
+
await writeFile7(manifestPath, `${JSON.stringify(payload, null, "\t")}
|
|
9409
|
+
`);
|
|
9410
|
+
}
|
|
9411
|
+
function agentNameFromToml2(fileName) {
|
|
9412
|
+
return fileName.endsWith(".toml") ? fileName.slice(0, -".toml".length) : fileName;
|
|
9413
|
+
}
|
|
9414
|
+
async function exists4(path) {
|
|
9415
|
+
try {
|
|
9416
|
+
await lstat9(path);
|
|
9417
|
+
return true;
|
|
9418
|
+
} catch (error) {
|
|
9419
|
+
if (nodeErrorCode3(error) !== "ENOENT")
|
|
9420
|
+
throw error;
|
|
9421
|
+
return false;
|
|
9422
|
+
}
|
|
9423
|
+
}
|
|
9424
|
+
function nodeErrorCode3(error) {
|
|
9425
|
+
if (!(error instanceof Error) || !("code" in error))
|
|
9426
|
+
return null;
|
|
9427
|
+
return typeof error.code === "string" ? error.code : null;
|
|
9428
|
+
}
|
|
9429
|
+
|
|
9208
9430
|
// packages/omo-codex/src/install/codex-marketplace.ts
|
|
9209
9431
|
import { readFile as readFile15 } from "node:fs/promises";
|
|
9210
|
-
import { join as
|
|
9432
|
+
import { join as join23 } from "node:path";
|
|
9211
9433
|
var DEFAULT_MARKETPLACE_PATH = "packages/omo-codex/marketplace.json";
|
|
9212
9434
|
async function readMarketplace(repoRoot, options) {
|
|
9213
|
-
const marketplacePath = options?.marketplacePath ??
|
|
9435
|
+
const marketplacePath = options?.marketplacePath ?? join23(repoRoot, DEFAULT_MARKETPLACE_PATH);
|
|
9214
9436
|
const raw = await readFile15(marketplacePath, "utf8");
|
|
9215
9437
|
const parsed = JSON.parse(raw);
|
|
9216
9438
|
if (!isPlainRecord(parsed))
|
|
@@ -9229,10 +9451,10 @@ async function readMarketplace(repoRoot, options) {
|
|
|
9229
9451
|
function resolvePluginSource(repoRoot, plugin, options) {
|
|
9230
9452
|
const sourcePath = localSourcePath(options?.pathOverride ?? plugin.source);
|
|
9231
9453
|
const relativePath = sourcePath.slice(2);
|
|
9232
|
-
return
|
|
9454
|
+
return join23(repoRoot, ...relativePath.split(/[\\/]/));
|
|
9233
9455
|
}
|
|
9234
9456
|
async function readPluginManifest(pluginRoot) {
|
|
9235
|
-
const raw = await readFile15(
|
|
9457
|
+
const raw = await readFile15(join23(pluginRoot, ".codex-plugin", "plugin.json"), "utf8");
|
|
9236
9458
|
const parsed = JSON.parse(raw);
|
|
9237
9459
|
if (!isPlainRecord(parsed))
|
|
9238
9460
|
throw new Error(`${pluginRoot} plugin.json must be an object`);
|
|
@@ -9313,8 +9535,8 @@ function validateLocalSourcePath(path) {
|
|
|
9313
9535
|
}
|
|
9314
9536
|
|
|
9315
9537
|
// packages/omo-codex/src/install/codex-marketplace-snapshot.ts
|
|
9316
|
-
import { cp as cp3, mkdir as mkdir7, rename as rename4, rm as rm9, writeFile as
|
|
9317
|
-
import { join as
|
|
9538
|
+
import { cp as cp3, mkdir as mkdir7, rename as rename4, rm as rm9, writeFile as writeFile8 } from "node:fs/promises";
|
|
9539
|
+
import { join as join24, sep as sep6 } from "node:path";
|
|
9318
9540
|
var INSTALLED_MARKETPLACES_DIR = ".tmp/marketplaces";
|
|
9319
9541
|
async function writeInstalledMarketplaceSnapshot(input) {
|
|
9320
9542
|
const marketplaceRoot = installedMarketplaceRoot(input.codexHome, input.marketplace.name);
|
|
@@ -9327,21 +9549,21 @@ async function writeInstalledMarketplaceSnapshot(input) {
|
|
|
9327
9549
|
return snapshotPlugins;
|
|
9328
9550
|
}
|
|
9329
9551
|
function installedMarketplaceRoot(codexHome, marketplaceName) {
|
|
9330
|
-
return
|
|
9552
|
+
return join24(codexHome, INSTALLED_MARKETPLACES_DIR, marketplaceName);
|
|
9331
9553
|
}
|
|
9332
9554
|
async function writeMarketplaceManifest(marketplaceRoot, marketplace) {
|
|
9333
|
-
const manifestDir =
|
|
9555
|
+
const manifestDir = join24(marketplaceRoot, ".agents", "plugins");
|
|
9334
9556
|
await mkdir7(manifestDir, { recursive: true });
|
|
9335
|
-
const tempPath =
|
|
9336
|
-
await
|
|
9557
|
+
const tempPath = join24(manifestDir, `.marketplace-${process.pid}-${Date.now()}.json.tmp`);
|
|
9558
|
+
await writeFile8(tempPath, `${JSON.stringify(marketplace, null, "\t")}
|
|
9337
9559
|
`);
|
|
9338
|
-
await rename4(tempPath,
|
|
9560
|
+
await rename4(tempPath, join24(manifestDir, "marketplace.json"));
|
|
9339
9561
|
}
|
|
9340
9562
|
async function writeSnapshotPlugin(marketplaceRoot, plugin) {
|
|
9341
|
-
const pluginsDir =
|
|
9563
|
+
const pluginsDir = join24(marketplaceRoot, "plugins");
|
|
9342
9564
|
await mkdir7(pluginsDir, { recursive: true });
|
|
9343
|
-
const targetPath =
|
|
9344
|
-
const tempPath =
|
|
9565
|
+
const targetPath = join24(pluginsDir, plugin.name);
|
|
9566
|
+
const tempPath = join24(pluginsDir, `.tmp-${plugin.name}-${process.pid}-${Date.now()}`);
|
|
9345
9567
|
await rm9(tempPath, { recursive: true, force: true });
|
|
9346
9568
|
await cp3(plugin.sourcePath, tempPath, {
|
|
9347
9569
|
recursive: true,
|
|
@@ -9362,11 +9584,11 @@ function shouldCopyMarketplaceSourcePath(path, root) {
|
|
|
9362
9584
|
}
|
|
9363
9585
|
|
|
9364
9586
|
// packages/omo-codex/src/install/lazycodex-version-stamp.ts
|
|
9365
|
-
import { readdir as
|
|
9366
|
-
import { join as
|
|
9587
|
+
import { readdir as readdir8, readFile as readFile16, writeFile as writeFile9 } from "node:fs/promises";
|
|
9588
|
+
import { join as join25 } from "node:path";
|
|
9367
9589
|
async function readDistributionManifest(repoRoot) {
|
|
9368
9590
|
try {
|
|
9369
|
-
const parsed = JSON.parse(await readFile16(
|
|
9591
|
+
const parsed = JSON.parse(await readFile16(join25(repoRoot, "package.json"), "utf8"));
|
|
9370
9592
|
if (!isPlainRecord(parsed) || typeof parsed.version !== "string" || parsed.version.trim().length === 0)
|
|
9371
9593
|
return;
|
|
9372
9594
|
return {
|
|
@@ -9386,19 +9608,19 @@ function resolveLazyCodexPluginVersion(input) {
|
|
|
9386
9608
|
return input.manifestVersion ?? "local";
|
|
9387
9609
|
}
|
|
9388
9610
|
async function stampLazyCodexPluginVersion(input) {
|
|
9389
|
-
const manifestPath =
|
|
9611
|
+
const manifestPath = join25(input.pluginRoot, ".codex-plugin", "plugin.json");
|
|
9390
9612
|
const hookPaths = await readPluginHookPaths(manifestPath);
|
|
9391
9613
|
await stampJsonVersion(manifestPath, input.version);
|
|
9392
|
-
await stampJsonVersion(
|
|
9614
|
+
await stampJsonVersion(join25(input.pluginRoot, "package.json"), input.version);
|
|
9393
9615
|
for (const hookPath of hookPaths) {
|
|
9394
|
-
await stampHookStatusMessages(
|
|
9616
|
+
await stampHookStatusMessages(join25(input.pluginRoot, hookPath), input.version);
|
|
9395
9617
|
}
|
|
9396
9618
|
await stampComponentVersions(input);
|
|
9397
9619
|
}
|
|
9398
9620
|
async function writeLazyCodexInstallSnapshot(input) {
|
|
9399
9621
|
if (input.distributionManifest === undefined)
|
|
9400
9622
|
return;
|
|
9401
|
-
await
|
|
9623
|
+
await writeFile9(join25(input.pluginRoot, "lazycodex-install.json"), `${JSON.stringify({
|
|
9402
9624
|
packageName: input.distributionManifest.name,
|
|
9403
9625
|
version: input.distributionManifest.version
|
|
9404
9626
|
}, null, "\t")}
|
|
@@ -9410,7 +9632,7 @@ async function stampJsonVersion(path, version) {
|
|
|
9410
9632
|
if (!isPlainRecord(parsed))
|
|
9411
9633
|
return;
|
|
9412
9634
|
parsed.version = version;
|
|
9413
|
-
await
|
|
9635
|
+
await writeFile9(path, `${JSON.stringify(parsed, null, "\t")}
|
|
9414
9636
|
`);
|
|
9415
9637
|
} catch (error) {
|
|
9416
9638
|
if (error instanceof Error)
|
|
@@ -9444,7 +9666,7 @@ async function stampHookStatusMessages(path, version) {
|
|
|
9444
9666
|
if (!isPlainRecord(parsed))
|
|
9445
9667
|
return;
|
|
9446
9668
|
stampHookGroups(parsed.hooks, version);
|
|
9447
|
-
await
|
|
9669
|
+
await writeFile9(path, `${JSON.stringify(parsed, null, "\t")}
|
|
9448
9670
|
`);
|
|
9449
9671
|
} catch (error) {
|
|
9450
9672
|
if (error instanceof Error)
|
|
@@ -9455,16 +9677,16 @@ async function stampHookStatusMessages(path, version) {
|
|
|
9455
9677
|
async function stampComponentVersions(input) {
|
|
9456
9678
|
let entries;
|
|
9457
9679
|
try {
|
|
9458
|
-
entries = await
|
|
9680
|
+
entries = await readdir8(join25(input.pluginRoot, "components"));
|
|
9459
9681
|
} catch (error) {
|
|
9460
9682
|
if (error instanceof Error)
|
|
9461
9683
|
return;
|
|
9462
9684
|
throw error;
|
|
9463
9685
|
}
|
|
9464
9686
|
for (const entry of entries) {
|
|
9465
|
-
const componentRoot =
|
|
9466
|
-
await stampJsonVersion(
|
|
9467
|
-
await stampHookStatusMessages(
|
|
9687
|
+
const componentRoot = join25(input.pluginRoot, "components", entry);
|
|
9688
|
+
await stampJsonVersion(join25(componentRoot, "package.json"), input.version);
|
|
9689
|
+
await stampHookStatusMessages(join25(componentRoot, "hooks", "hooks.json"), input.version);
|
|
9468
9690
|
}
|
|
9469
9691
|
}
|
|
9470
9692
|
function stampHookGroups(hooks, version) {
|
|
@@ -9493,8 +9715,8 @@ function normalizeHookStatusVersion(version) {
|
|
|
9493
9715
|
}
|
|
9494
9716
|
|
|
9495
9717
|
// packages/omo-codex/src/install/codex-project-local-cleanup.ts
|
|
9496
|
-
import { copyFile as copyFile2, lstat as
|
|
9497
|
-
import { dirname as
|
|
9718
|
+
import { copyFile as copyFile2, lstat as lstat10, readFile as readFile17, writeFile as writeFile10 } from "node:fs/promises";
|
|
9719
|
+
import { dirname as dirname9, join as join26, resolve as resolve7 } from "node:path";
|
|
9498
9720
|
var LEGACY_AGENT_CONFLICT_KEYS = ["max_threads"];
|
|
9499
9721
|
var PROJECT_LOCAL_ARTIFACT_PATHS = [
|
|
9500
9722
|
".codex/hooks.json",
|
|
@@ -9526,7 +9748,7 @@ async function repairNearestProjectLocalCodexArtifacts(input) {
|
|
|
9526
9748
|
}
|
|
9527
9749
|
const backupPath = `${configPath}.backup-${formatBackupTimestamp(input.now?.() ?? new Date)}`;
|
|
9528
9750
|
await copyFile2(configPath, backupPath);
|
|
9529
|
-
await
|
|
9751
|
+
await writeFile10(configPath, `${repair.config.trimEnd()}
|
|
9530
9752
|
`);
|
|
9531
9753
|
configs.push({
|
|
9532
9754
|
projectRoot: project.projectRoot,
|
|
@@ -9597,37 +9819,37 @@ async function findProjectLocalCodexConfigs(startDirectory, codexHome) {
|
|
|
9597
9819
|
if (startDirectoryStat !== null && !startDirectoryStat.isDirectory()) {
|
|
9598
9820
|
throw new ProjectLocalCleanupStartDirectoryError(startDirectory);
|
|
9599
9821
|
}
|
|
9600
|
-
const codexHomeConfigPath = codexHome === undefined ? null :
|
|
9822
|
+
const codexHomeConfigPath = codexHome === undefined ? null : join26(resolve7(codexHome), "config.toml");
|
|
9601
9823
|
let current = resolve7(startDirectory);
|
|
9602
9824
|
const configPathsFromCwd = [];
|
|
9603
9825
|
while (true) {
|
|
9604
|
-
const configPath =
|
|
9826
|
+
const configPath = join26(current, ".codex", "config.toml");
|
|
9605
9827
|
if (await isRegularProjectLocalConfig(current, configPath)) {
|
|
9606
9828
|
if (codexHomeConfigPath === null || resolve7(configPath) !== codexHomeConfigPath) {
|
|
9607
9829
|
configPathsFromCwd.push(configPath);
|
|
9608
9830
|
}
|
|
9609
9831
|
}
|
|
9610
|
-
if (await
|
|
9832
|
+
if (await exists5(join26(current, ".git"))) {
|
|
9611
9833
|
return configPathsFromCwd.length === 0 ? null : {
|
|
9612
9834
|
projectRoot: current,
|
|
9613
9835
|
configPaths: [...configPathsFromCwd].reverse(),
|
|
9614
9836
|
artifactRoots: artifactRootsForConfigPaths(configPathsFromCwd)
|
|
9615
9837
|
};
|
|
9616
9838
|
}
|
|
9617
|
-
const parent =
|
|
9839
|
+
const parent = dirname9(current);
|
|
9618
9840
|
if (parent === current) {
|
|
9619
9841
|
const nearestConfigPath = configPathsFromCwd[0];
|
|
9620
9842
|
return nearestConfigPath === undefined ? null : {
|
|
9621
|
-
projectRoot:
|
|
9843
|
+
projectRoot: dirname9(dirname9(nearestConfigPath)),
|
|
9622
9844
|
configPaths: [nearestConfigPath],
|
|
9623
|
-
artifactRoots: [
|
|
9845
|
+
artifactRoots: [dirname9(dirname9(nearestConfigPath))]
|
|
9624
9846
|
};
|
|
9625
9847
|
}
|
|
9626
9848
|
current = parent;
|
|
9627
9849
|
}
|
|
9628
9850
|
}
|
|
9629
9851
|
async function isRegularProjectLocalConfig(directory, configPath) {
|
|
9630
|
-
const codexDirStat = await maybeLstat(
|
|
9852
|
+
const codexDirStat = await maybeLstat(join26(directory, ".codex"));
|
|
9631
9853
|
if (codexDirStat === null || !codexDirStat.isDirectory() || codexDirStat.isSymbolicLink())
|
|
9632
9854
|
return false;
|
|
9633
9855
|
const configStat = await maybeLstat(configPath);
|
|
@@ -9636,7 +9858,7 @@ async function isRegularProjectLocalConfig(directory, configPath) {
|
|
|
9636
9858
|
function artifactRootsForConfigPaths(configPaths) {
|
|
9637
9859
|
const roots = [];
|
|
9638
9860
|
for (const configPath of configPaths) {
|
|
9639
|
-
const root =
|
|
9861
|
+
const root = dirname9(dirname9(configPath));
|
|
9640
9862
|
if (!roots.includes(root))
|
|
9641
9863
|
roots.push(root);
|
|
9642
9864
|
}
|
|
@@ -9647,7 +9869,7 @@ async function collectProjectLocalArtifacts(projectRoots) {
|
|
|
9647
9869
|
const seenPaths = new Set;
|
|
9648
9870
|
for (const projectRoot of projectRoots) {
|
|
9649
9871
|
for (const relativePath of PROJECT_LOCAL_ARTIFACT_PATHS) {
|
|
9650
|
-
const artifactPath =
|
|
9872
|
+
const artifactPath = join26(projectRoot, relativePath);
|
|
9651
9873
|
if (seenPaths.has(artifactPath))
|
|
9652
9874
|
continue;
|
|
9653
9875
|
const entryStat = await maybeLstat(artifactPath);
|
|
@@ -9681,17 +9903,17 @@ function formatBackupTimestamp(date) {
|
|
|
9681
9903
|
}
|
|
9682
9904
|
async function maybeLstat(path) {
|
|
9683
9905
|
try {
|
|
9684
|
-
return await
|
|
9906
|
+
return await lstat10(path);
|
|
9685
9907
|
} catch (error) {
|
|
9686
|
-
if (
|
|
9908
|
+
if (nodeErrorCode4(error) === "ENOENT")
|
|
9687
9909
|
return null;
|
|
9688
9910
|
throw error;
|
|
9689
9911
|
}
|
|
9690
9912
|
}
|
|
9691
|
-
async function
|
|
9913
|
+
async function exists5(path) {
|
|
9692
9914
|
return await maybeLstat(path) !== null;
|
|
9693
9915
|
}
|
|
9694
|
-
function
|
|
9916
|
+
function nodeErrorCode4(error) {
|
|
9695
9917
|
if (!(error instanceof Error) || !("code" in error))
|
|
9696
9918
|
return null;
|
|
9697
9919
|
return typeof error.code === "string" ? error.code : null;
|
|
@@ -9722,24 +9944,24 @@ function formatUnknownError(error) {
|
|
|
9722
9944
|
}
|
|
9723
9945
|
|
|
9724
9946
|
// packages/omo-codex/src/install/lsp-daemon-reaper.ts
|
|
9725
|
-
import { readFile as readFile18, readdir as
|
|
9947
|
+
import { readFile as readFile18, readdir as readdir9, rm as rm10 } from "node:fs/promises";
|
|
9726
9948
|
import { connect } from "node:net";
|
|
9727
|
-
import { join as
|
|
9949
|
+
import { join as join27 } from "node:path";
|
|
9728
9950
|
async function reapLspDaemons(codexHome, deps = {}) {
|
|
9729
9951
|
const killProcess = deps.killProcess ?? sendSigterm;
|
|
9730
9952
|
const isDaemonLive = deps.isDaemonLive ?? probeSocketLive;
|
|
9731
|
-
const daemonRoot =
|
|
9953
|
+
const daemonRoot = join27(codexHome, "codex-lsp", "daemon");
|
|
9732
9954
|
const reaped = [];
|
|
9733
9955
|
let entries;
|
|
9734
9956
|
try {
|
|
9735
|
-
entries = await
|
|
9957
|
+
entries = await readdir9(daemonRoot);
|
|
9736
9958
|
} catch {
|
|
9737
9959
|
return reaped;
|
|
9738
9960
|
}
|
|
9739
9961
|
for (const entry of entries) {
|
|
9740
|
-
const versionDir =
|
|
9741
|
-
const pid = await readPidFile(
|
|
9742
|
-
const socketPath = await readEndpointFile(
|
|
9962
|
+
const versionDir = join27(daemonRoot, entry);
|
|
9963
|
+
const pid = await readPidFile(join27(versionDir, "daemon.pid"));
|
|
9964
|
+
const socketPath = await readEndpointFile(join27(versionDir, "daemon.endpoint"));
|
|
9743
9965
|
if (pid !== null && socketPath !== null && await isDaemonLive(socketPath) && killProcess(pid)) {
|
|
9744
9966
|
reaped.push(pid);
|
|
9745
9967
|
}
|
|
@@ -9793,7 +10015,7 @@ function sendSigterm(pid) {
|
|
|
9793
10015
|
|
|
9794
10016
|
// packages/omo-codex/src/install/codex-installer-bin-dir.ts
|
|
9795
10017
|
import { homedir } from "node:os";
|
|
9796
|
-
import { join as
|
|
10018
|
+
import { join as join28, resolve as resolve8 } from "node:path";
|
|
9797
10019
|
function resolveCodexInstallerBinDir(input) {
|
|
9798
10020
|
const explicitBinDir = input.binDir ?? input.env?.CODEX_LOCAL_BIN_DIR;
|
|
9799
10021
|
if (explicitBinDir !== undefined && explicitBinDir.trim().length > 0)
|
|
@@ -9802,13 +10024,13 @@ function resolveCodexInstallerBinDir(input) {
|
|
|
9802
10024
|
const defaultCodexHome = resolve8(homeDir, ".codex");
|
|
9803
10025
|
const resolvedCodexHome = resolve8(input.codexHome);
|
|
9804
10026
|
if (resolvedCodexHome !== defaultCodexHome)
|
|
9805
|
-
return
|
|
10027
|
+
return join28(resolvedCodexHome, "bin");
|
|
9806
10028
|
return resolve8(homeDir, ".local", "bin");
|
|
9807
10029
|
}
|
|
9808
10030
|
|
|
9809
10031
|
// packages/omo-codex/src/install/codex-git-bash-hooks.ts
|
|
9810
|
-
import { readFile as readFile19, writeFile as
|
|
9811
|
-
import { join as
|
|
10032
|
+
import { readFile as readFile19, writeFile as writeFile11 } from "node:fs/promises";
|
|
10033
|
+
import { join as join29 } from "node:path";
|
|
9812
10034
|
var WINDOWS_ONLY_GIT_BASH_HOOKS = new Set([
|
|
9813
10035
|
"./hooks/pre-tool-use-recommending-git-bash-mcp.json",
|
|
9814
10036
|
"./hooks/post-compact-resetting-git-bash-mcp-reminder.json"
|
|
@@ -9816,22 +10038,22 @@ var WINDOWS_ONLY_GIT_BASH_HOOKS = new Set([
|
|
|
9816
10038
|
async function removeGitBashHooksOffWindows(input) {
|
|
9817
10039
|
if (input.platform === "win32")
|
|
9818
10040
|
return;
|
|
9819
|
-
const manifestPath =
|
|
10041
|
+
const manifestPath = join29(input.pluginRoot, ".codex-plugin", "plugin.json");
|
|
9820
10042
|
const parsed = JSON.parse(await readFile19(manifestPath, "utf8"));
|
|
9821
10043
|
if (!isPlainRecord(parsed) || !Array.isArray(parsed.hooks))
|
|
9822
10044
|
return;
|
|
9823
10045
|
const hooks = parsed.hooks.filter((hook) => typeof hook !== "string" || !WINDOWS_ONLY_GIT_BASH_HOOKS.has(hook));
|
|
9824
10046
|
if (hooks.length === parsed.hooks.length)
|
|
9825
10047
|
return;
|
|
9826
|
-
await
|
|
10048
|
+
await writeFile11(manifestPath, `${JSON.stringify({ ...parsed, hooks }, null, "\t")}
|
|
9827
10049
|
`);
|
|
9828
10050
|
}
|
|
9829
10051
|
|
|
9830
10052
|
// packages/omo-codex/src/install/omo-sot-migration.ts
|
|
9831
|
-
import { join as
|
|
10053
|
+
import { join as join30 } from "node:path";
|
|
9832
10054
|
async function seedAndMigrateOmoSot(input) {
|
|
9833
10055
|
const commandEnv = { ...input.env };
|
|
9834
|
-
const scriptPath =
|
|
10056
|
+
const scriptPath = join30(input.repoRoot, "packages", "omo-codex", "plugin", "scripts", "migrate-omo-sot.mjs");
|
|
9835
10057
|
try {
|
|
9836
10058
|
await input.runCommand(process.execPath, [scriptPath, "--seed"], {
|
|
9837
10059
|
cwd: input.repoRoot,
|
|
@@ -9845,7 +10067,7 @@ async function seedAndMigrateOmoSot(input) {
|
|
|
9845
10067
|
}
|
|
9846
10068
|
|
|
9847
10069
|
// packages/omo-codex/src/install/install-ast-grep-sg.ts
|
|
9848
|
-
import { join as
|
|
10070
|
+
import { join as join32 } from "node:path";
|
|
9849
10071
|
|
|
9850
10072
|
// packages/utils/src/ast-grep/sg-manifest.ts
|
|
9851
10073
|
function normalizeRuntimePlatform(platform = process.platform) {
|
|
@@ -9865,11 +10087,11 @@ function runtimeSlug(platform = process.platform, arch = process.arch) {
|
|
|
9865
10087
|
// packages/utils/src/ast-grep/install-script.ts
|
|
9866
10088
|
import { spawn as spawn2 } from "node:child_process";
|
|
9867
10089
|
import { existsSync as existsSync4 } from "node:fs";
|
|
9868
|
-
import { join as
|
|
10090
|
+
import { join as join31 } from "node:path";
|
|
9869
10091
|
var AST_GREP_BIN_DIR_ENV_KEY = "OMO_AST_GREP_BIN_DIR";
|
|
9870
10092
|
var AST_GREP_INSTALL_TIMEOUT_MS = 30000;
|
|
9871
10093
|
function astGrepRuntimeDir(baseDir, platform = process.platform, arch = process.arch) {
|
|
9872
|
-
return
|
|
10094
|
+
return join31(baseDir, "runtime", "ast-grep", runtimeSlug(platform, arch));
|
|
9873
10095
|
}
|
|
9874
10096
|
function isMissingExecutable(error) {
|
|
9875
10097
|
if (!("code" in error))
|
|
@@ -9907,7 +10129,7 @@ function defaultSpawnProcess(command, args, options) {
|
|
|
9907
10129
|
};
|
|
9908
10130
|
}
|
|
9909
10131
|
function scriptPathForPlatform(skillDir, platform) {
|
|
9910
|
-
return
|
|
10132
|
+
return join31(skillDir, platform === "win32" ? "install.ps1" : "install.sh");
|
|
9911
10133
|
}
|
|
9912
10134
|
function invocationsForPlatform(scriptPath, platform) {
|
|
9913
10135
|
if (platform !== "win32")
|
|
@@ -9979,7 +10201,7 @@ async function installAstGrepForCodex(options) {
|
|
|
9979
10201
|
return;
|
|
9980
10202
|
const platform = options.platform ?? process.platform;
|
|
9981
10203
|
const targetDir = astGrepRuntimeDir(options.codexHome, platform, options.arch ?? process.arch);
|
|
9982
|
-
const skillDir =
|
|
10204
|
+
const skillDir = join32(plugin.path, "skills", "ast-grep");
|
|
9983
10205
|
const installer = options.installer ?? runAstGrepSkillInstall;
|
|
9984
10206
|
try {
|
|
9985
10207
|
const result = await installer({ platform, skillDir, targetDir });
|
|
@@ -10012,7 +10234,7 @@ async function runCodexInstaller(options = {}) {
|
|
|
10012
10234
|
const env2 = options.env ?? process.env;
|
|
10013
10235
|
const platform = options.platform ?? process.platform;
|
|
10014
10236
|
const repoRoot = resolve9(options.repoRoot ?? findRepoRoot({ importerDir: import.meta.dir, env: env2 }));
|
|
10015
|
-
const codexHome = resolve9(options.codexHome ?? env2.CODEX_HOME ??
|
|
10237
|
+
const codexHome = resolve9(options.codexHome ?? env2.CODEX_HOME ?? join35(homedir2(), ".codex"));
|
|
10016
10238
|
const projectDirectory = resolve9(options.projectDirectory ?? env2.OMO_CODEX_PROJECT ?? process.cwd());
|
|
10017
10239
|
const binDir = resolveCodexInstallerBinDir({ binDir: options.binDir, codexHome, env: env2 });
|
|
10018
10240
|
const runCommand = options.runCommand ?? defaultRunCommand;
|
|
@@ -10028,9 +10250,9 @@ async function runCodexInstaller(options = {}) {
|
|
|
10028
10250
|
if (!gitBashResolution.found) {
|
|
10029
10251
|
throw new Error(gitBashResolution.installHint);
|
|
10030
10252
|
}
|
|
10031
|
-
const codexPackageRoot =
|
|
10253
|
+
const codexPackageRoot = join35(repoRoot, "packages", "omo-codex");
|
|
10032
10254
|
const marketplace = await readMarketplace(repoRoot, {
|
|
10033
|
-
marketplacePath:
|
|
10255
|
+
marketplacePath: join35(codexPackageRoot, "marketplace.json")
|
|
10034
10256
|
});
|
|
10035
10257
|
const distributionManifest = await readDistributionManifest(repoRoot);
|
|
10036
10258
|
const installed = [];
|
|
@@ -10073,7 +10295,7 @@ async function runCodexInstaller(options = {}) {
|
|
|
10073
10295
|
if (runtimeLink !== null)
|
|
10074
10296
|
log(`Linked ${runtimeLink.name} -> ${runtimeLink.target}`);
|
|
10075
10297
|
else
|
|
10076
|
-
log(`Warning: skipped the omo runtime wrapper because ${
|
|
10298
|
+
log(`Warning: skipped the omo runtime wrapper because ${join35(repoRoot, "dist", "cli", "index.js")} is missing; omo ulw-loop commands will be unavailable until a package shipping dist/cli is installed`);
|
|
10077
10299
|
}
|
|
10078
10300
|
pluginSources.push({ name: entry.name, sourcePath });
|
|
10079
10301
|
installed.push(plugin);
|
|
@@ -10104,7 +10326,7 @@ async function runCodexInstaller(options = {}) {
|
|
|
10104
10326
|
});
|
|
10105
10327
|
for (const link of agentLinks) {
|
|
10106
10328
|
log(`Linked agent ${link.name} -> ${link.target}`);
|
|
10107
|
-
const agentName =
|
|
10329
|
+
const agentName = agentNameFromToml3(link.name);
|
|
10108
10330
|
agentConfigs.set(agentName, { name: agentName, configFile: `./agents/${link.name}` });
|
|
10109
10331
|
}
|
|
10110
10332
|
}
|
|
@@ -10127,13 +10349,13 @@ async function runCodexInstaller(options = {}) {
|
|
|
10127
10349
|
});
|
|
10128
10350
|
}
|
|
10129
10351
|
await reapLspDaemons(codexHome).catch(() => []);
|
|
10130
|
-
const marketplaceRoot =
|
|
10352
|
+
const marketplaceRoot = join35(codexHome, "plugins", "cache", marketplace.name);
|
|
10131
10353
|
await writeCachedMarketplaceManifest({
|
|
10132
10354
|
marketplaceName: marketplace.name,
|
|
10133
10355
|
marketplaceRoot,
|
|
10134
10356
|
plugins: installed
|
|
10135
10357
|
});
|
|
10136
|
-
const configPath =
|
|
10358
|
+
const configPath = join35(codexHome, "config.toml");
|
|
10137
10359
|
await updateCodexConfig({
|
|
10138
10360
|
configPath,
|
|
10139
10361
|
repoRoot: codexPackageRoot,
|
|
@@ -10171,7 +10393,7 @@ async function runCodexInstaller(options = {}) {
|
|
|
10171
10393
|
projectCleanup
|
|
10172
10394
|
};
|
|
10173
10395
|
}
|
|
10174
|
-
function
|
|
10396
|
+
function agentNameFromToml3(fileName) {
|
|
10175
10397
|
return fileName.endsWith(".toml") ? fileName.slice(0, -".toml".length) : fileName;
|
|
10176
10398
|
}
|
|
10177
10399
|
async function agentSourceRootsForInstall(input) {
|
|
@@ -10193,7 +10415,7 @@ function findRepoRootFromImporter(importerDir) {
|
|
|
10193
10415
|
for (let depth = 0;depth <= 7; depth += 1) {
|
|
10194
10416
|
if (isRepoRootWithCodexPlugin(current))
|
|
10195
10417
|
return current;
|
|
10196
|
-
for (const wrapperPackageRoot of [
|
|
10418
|
+
for (const wrapperPackageRoot of [join35(current, "node_modules", "oh-my-openagent"), join35(current, "oh-my-openagent")]) {
|
|
10197
10419
|
if (isRepoRootWithCodexPlugin(wrapperPackageRoot))
|
|
10198
10420
|
return wrapperPackageRoot;
|
|
10199
10421
|
}
|
|
@@ -10211,7 +10433,7 @@ function findRepoRoot(input) {
|
|
|
10211
10433
|
return findRepoRootFromImporter(input.importerDir);
|
|
10212
10434
|
}
|
|
10213
10435
|
function isRepoRootWithCodexPlugin(repoRoot) {
|
|
10214
|
-
return existsSync7(
|
|
10436
|
+
return existsSync7(join35(repoRoot, "packages", "omo-codex", "plugin", ".codex-plugin", "plugin.json"));
|
|
10215
10437
|
}
|
|
10216
10438
|
function codexMarketplaceSource(marketplaceRoot) {
|
|
10217
10439
|
return { sourceType: "local", source: marketplaceRoot };
|
|
@@ -10523,13 +10745,13 @@ function shellQuote(value) {
|
|
|
10523
10745
|
|
|
10524
10746
|
// packages/omo-codex/src/install/lazycodex-manual-update.ts
|
|
10525
10747
|
import { spawn as spawn3, spawnSync as spawnSync3 } from "node:child_process";
|
|
10526
|
-
import { readFileSync as
|
|
10527
|
-
import { dirname as
|
|
10748
|
+
import { readFileSync as readFileSync4 } from "node:fs";
|
|
10749
|
+
import { dirname as dirname11, join as join37 } from "node:path";
|
|
10528
10750
|
import { createInterface as createInterface2 } from "node:readline/promises";
|
|
10529
10751
|
import { fileURLToPath } from "node:url";
|
|
10530
10752
|
|
|
10531
10753
|
// packages/omo-codex/src/install/lazycodex-bun-global-paths.ts
|
|
10532
|
-
import { join as
|
|
10754
|
+
import { join as join36 } from "node:path";
|
|
10533
10755
|
function isBunGlobalEntrypointPath(invokedPath, env2) {
|
|
10534
10756
|
if (typeof invokedPath !== "string" || invokedPath.trim().length === 0)
|
|
10535
10757
|
return false;
|
|
@@ -10540,8 +10762,8 @@ function resolveBunGlobalRoots(env2) {
|
|
|
10540
10762
|
const bunInstallRoot = env2.BUN_INSTALL?.trim();
|
|
10541
10763
|
const homeRoot = env2.HOME?.trim();
|
|
10542
10764
|
return [
|
|
10543
|
-
...bunInstallRoot ? [
|
|
10544
|
-
...homeRoot ? [
|
|
10765
|
+
...bunInstallRoot ? [join36(bunInstallRoot, "bin"), join36(bunInstallRoot, "install", "global", "node_modules")] : [],
|
|
10766
|
+
...homeRoot ? [join36(homeRoot, ".bun", "bin"), join36(homeRoot, ".bun", "install", "global", "node_modules")] : []
|
|
10545
10767
|
].map(normalizePathForPrefix);
|
|
10546
10768
|
}
|
|
10547
10769
|
function normalizePathForPrefix(path2) {
|
|
@@ -10633,8 +10855,8 @@ function resolveArgs(env2) {
|
|
|
10633
10855
|
function resolveCurrentVersion(env2) {
|
|
10634
10856
|
if (env2.LAZYCODEX_CURRENT_VERSION?.trim())
|
|
10635
10857
|
return env2.LAZYCODEX_CURRENT_VERSION.trim();
|
|
10636
|
-
const pluginRoot =
|
|
10637
|
-
return readVersionManifest(resolveInstalledVersionPath(env2, pluginRoot)) ?? readVersionManifest(
|
|
10858
|
+
const pluginRoot = dirname11(dirname11(fileURLToPath(import.meta.url)));
|
|
10859
|
+
return readVersionManifest(resolveInstalledVersionPath(env2, pluginRoot)) ?? readVersionManifest(join37(pluginRoot, "..", "..", "..", "package.json")) ?? readVersionManifest(join37(pluginRoot, ".codex-plugin", "plugin.json"));
|
|
10638
10860
|
}
|
|
10639
10861
|
function resolveLatestVersion(env2) {
|
|
10640
10862
|
if (env2.LAZYCODEX_LATEST_VERSION?.trim())
|
|
@@ -10750,11 +10972,11 @@ function compareVersions(left, right) {
|
|
|
10750
10972
|
function resolveInstalledVersionPath(env2, pluginRoot) {
|
|
10751
10973
|
if (env2.LAZYCODEX_INSTALLED_VERSION_FILE?.trim())
|
|
10752
10974
|
return env2.LAZYCODEX_INSTALLED_VERSION_FILE.trim();
|
|
10753
|
-
return
|
|
10975
|
+
return join37(pluginRoot, INSTALLED_VERSION_FILE);
|
|
10754
10976
|
}
|
|
10755
10977
|
function readVersionManifest(path2) {
|
|
10756
10978
|
try {
|
|
10757
|
-
const parsed = JSON.parse(
|
|
10979
|
+
const parsed = JSON.parse(readFileSync4(path2, "utf8"));
|
|
10758
10980
|
if (typeof parsed === "object" && parsed !== null && "version" in parsed && typeof parsed.version === "string") {
|
|
10759
10981
|
return parsed.version;
|
|
10760
10982
|
}
|
|
@@ -10766,12 +10988,12 @@ function readVersionManifest(path2) {
|
|
|
10766
10988
|
}
|
|
10767
10989
|
}
|
|
10768
10990
|
// packages/omo-codex/src/install/codex-git-bash-mcp-env.ts
|
|
10769
|
-
import { readFile as readFile20, writeFile as
|
|
10770
|
-
import { join as
|
|
10991
|
+
import { readFile as readFile20, writeFile as writeFile12 } from "node:fs/promises";
|
|
10992
|
+
import { join as join38 } from "node:path";
|
|
10771
10993
|
var GIT_BASH_ENV_KEY2 = "OMO_CODEX_GIT_BASH_PATH";
|
|
10772
10994
|
var CODEGRAPH_RELATIVE_ARGS2 = new Set(["components/codegraph/dist/serve.js", "./components/codegraph/dist/serve.js"]);
|
|
10773
10995
|
async function stampGitBashMcpEnv(input) {
|
|
10774
|
-
const manifestPath =
|
|
10996
|
+
const manifestPath = join38(input.pluginRoot, ".mcp.json");
|
|
10775
10997
|
if (!await fileExistsStrict(manifestPath))
|
|
10776
10998
|
return false;
|
|
10777
10999
|
const parsed = JSON.parse(await readFile20(manifestPath, "utf8"));
|
|
@@ -10792,7 +11014,7 @@ async function stampGitBashMcpEnv(input) {
|
|
|
10792
11014
|
}
|
|
10793
11015
|
if (!changed)
|
|
10794
11016
|
return false;
|
|
10795
|
-
await
|
|
11017
|
+
await writeFile12(manifestPath, `${JSON.stringify(parsed, null, "\t")}
|
|
10796
11018
|
`);
|
|
10797
11019
|
return true;
|
|
10798
11020
|
}
|
|
@@ -10804,7 +11026,7 @@ function stampCodegraphMcpPath(mcpServers, pluginRoot) {
|
|
|
10804
11026
|
const entrypoint = args[0];
|
|
10805
11027
|
if (typeof entrypoint !== "string" || !CODEGRAPH_RELATIVE_ARGS2.has(entrypoint))
|
|
10806
11028
|
return false;
|
|
10807
|
-
codegraphServer["args"] = [
|
|
11029
|
+
codegraphServer["args"] = [join38(pluginRoot, "components", "codegraph", "dist", "serve.js"), ...args.slice(1)];
|
|
10808
11030
|
return true;
|
|
10809
11031
|
}
|
|
10810
11032
|
|
|
@@ -10813,7 +11035,7 @@ async function installMarketplaceLocally(options = {}) {
|
|
|
10813
11035
|
return runCodexInstaller(options);
|
|
10814
11036
|
}
|
|
10815
11037
|
function resolveDefaultRepoRootForEntrypoint(entrypointPath) {
|
|
10816
|
-
return resolve10(
|
|
11038
|
+
return resolve10(dirname12(entrypointPath), "..", "..", "..");
|
|
10817
11039
|
}
|
|
10818
11040
|
function resolveDefaultRepoRoot() {
|
|
10819
11041
|
return resolveDefaultRepoRootForEntrypoint(fileURLToPath2(import.meta.url));
|
|
@@ -10825,7 +11047,7 @@ async function runLazyCodexInstallLocalCli(input) {
|
|
|
10825
11047
|
return 0;
|
|
10826
11048
|
}
|
|
10827
11049
|
if (parsed.kind === "version") {
|
|
10828
|
-
const packageJson = JSON.parse(await readFile21(
|
|
11050
|
+
const packageJson = JSON.parse(await readFile21(join39(input.defaultRepoRoot, "package.json"), "utf8"));
|
|
10829
11051
|
const version2 = typeof packageJson.version === "string" ? packageJson.version : "unknown";
|
|
10830
11052
|
input.log(`lazycodex-ai ${version2}`);
|
|
10831
11053
|
return 0;
|