oh-my-opencode 5.0.0-beta.33 → 5.0.0-beta.35
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/skills/codex-qa/scripts/lsp-e2e.sh +1 -3
- package/.agents/skills/opencode-qa/scripts/lsp-e2e.sh +1 -1
- package/.agents/skills/tech-debt-audit/SKILL.md +6 -76
- package/README.ja.md +1 -1
- package/README.ko.md +1 -1
- package/README.md +1 -1
- package/README.ru.md +1 -1
- package/README.zh-cn.md +1 -1
- package/THIRD-PARTY-NOTICES.md +27 -99
- package/dist/cli/index.js +48350 -48559
- package/dist/cli-node/index.js +48480 -48689
- package/dist/config/index.d.ts +1 -1
- package/dist/config/schema/hooks.d.ts +0 -1
- package/dist/config/schema/oh-my-opencode-config.d.ts +0 -10
- package/dist/config/schema.d.ts +0 -1
- package/dist/create-hooks.d.ts +0 -1
- package/dist/hooks/index.d.ts +0 -1
- package/dist/index.js +11675 -13742
- package/dist/mcp/index.d.ts +0 -4
- package/dist/mcp/types.d.ts +0 -1
- package/dist/oh-my-opencode.schema.json +1 -45
- package/dist/plugin/hooks/create-core-hooks.d.ts +0 -1
- package/dist/plugin/hooks/create-session-hooks.d.ts +1 -2
- package/dist/shared/omo-process-sweep.d.ts +2 -4
- package/dist/skills/init-deep/SKILL.md +13 -13
- package/dist/skills/ulw-plan/SKILL.md +0 -1
- package/dist/tui.js +44809 -44910
- package/package.json +16 -18
- package/packages/omo-codex/THIRD-PARTY-NOTICES.md +0 -17
- package/packages/omo-codex/plugin/.codex-plugin/plugin.json +1 -3
- package/packages/omo-codex/plugin/.mcp.json +0 -6
- package/packages/omo-codex/plugin/AGENTS.md +5 -5
- package/packages/omo-codex/plugin/README.md +1 -1
- package/packages/omo-codex/plugin/components/bootstrap/dist/cli.js +1 -15
- 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/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/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/package.json +1 -1
- package/packages/omo-codex/plugin/components/lcx/skills/lcx-doctor/SKILL.md +1 -1
- package/packages/omo-codex/plugin/components/lsp/dist/.omo-runtime-manifest.json +2 -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/rules/hooks/hooks.json +4 -4
- package/packages/omo-codex/plugin/components/rules/package.json +1 -1
- 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/test/thread-title-hook.test.ts +1 -1
- 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/dist/cli.js +2 -2
- 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/ulw-plan/SKILL.md +0 -1
- package/packages/omo-codex/plugin/components/ultrawork/src/directive-content.ts +1 -1
- package/packages/omo-codex/plugin/components/ulw-execute-continuation/hooks/hooks.json +2 -2
- package/packages/omo-codex/plugin/components/ulw-execute-continuation/package.json +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/README.md +11 -1
- package/packages/omo-codex/plugin/components/ulw-loop/directive.md +2 -2
- package/packages/omo-codex/plugin/components/ulw-loop/dist/checkpoint-codex-validation.d.ts +12 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/checkpoint-codex-validation.js +45 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/checkpoint-reconciliation.d.ts +1 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/checkpoint-reconciliation.js +5 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/checkpoint-template.js +10 -3
- package/packages/omo-codex/plugin/components/ulw-loop/dist/checkpoint.js +35 -38
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli.js +278 -193
- package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate-aggregate.d.ts +5 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate-aggregate.js +7 -51
- package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate-artifacts.js +39 -22
- package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate-fields.d.ts +13 -1
- package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate-fields.js +64 -8
- package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate-verdicts.js +5 -1
- package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate.js +37 -18
- package/packages/omo-codex/plugin/components/ulw-loop/hooks/hooks.json +4 -4
- package/packages/omo-codex/plugin/components/ulw-loop/package.json +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/references/full-workflow.md +2 -1
- package/packages/omo-codex/plugin/components/ulw-loop/src/checkpoint-codex-validation.ts +81 -0
- package/packages/omo-codex/plugin/components/ulw-loop/src/checkpoint-reconciliation.ts +6 -0
- package/packages/omo-codex/plugin/components/ulw-loop/src/checkpoint-template.ts +10 -3
- package/packages/omo-codex/plugin/components/ulw-loop/src/checkpoint.ts +32 -63
- package/packages/omo-codex/plugin/components/ulw-loop/src/quality-gate-aggregate.ts +7 -53
- package/packages/omo-codex/plugin/components/ulw-loop/src/quality-gate-artifacts.ts +50 -31
- package/packages/omo-codex/plugin/components/ulw-loop/src/quality-gate-fields.ts +67 -14
- package/packages/omo-codex/plugin/components/ulw-loop/src/quality-gate-verdicts.ts +6 -1
- package/packages/omo-codex/plugin/components/ulw-loop/src/quality-gate.ts +36 -17
- package/packages/omo-codex/plugin/components/ulw-loop/test/checkpoint-final.test.ts +26 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/checkpoint-template.test.ts +47 -2
- package/packages/omo-codex/plugin/components/ulw-loop/test/quality-gate-aggregate-basics.test.ts +258 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/quality-gate-cap-and-dedupe.test.ts +22 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/quality-gate-poisoning-cascades.test.ts +97 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/quality-gate-single-report.test.ts +241 -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-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 +1 -1
- 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-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-ulw-execute-continuation.json +1 -1
- package/packages/omo-codex/plugin/hooks/stop-checking-ulw-loop-resume.json +1 -1
- package/packages/omo-codex/plugin/hooks/subagent-stop-checking-ulw-execute-continuation.json +1 -1
- package/packages/omo-codex/plugin/hooks/subagent-stop-verifying-lazycodex-executor-evidence.json +1 -1
- 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/package-lock.json +12 -146
- package/packages/omo-codex/plugin/package.json +1 -2
- package/packages/omo-codex/plugin/scripts/AGENTS.md +0 -1
- package/packages/omo-codex/plugin/scripts/auto-update-plan.mjs +0 -1
- package/packages/omo-codex/plugin/scripts/auto-update.mjs +0 -9
- package/packages/omo-codex/plugin/scripts/canonical-ultrawork-directive.mjs +17 -0
- package/packages/omo-codex/plugin/scripts/hook-status-message.mjs +0 -1
- package/packages/omo-codex/plugin/scripts/sync-skills.mjs +2 -8
- package/packages/omo-codex/plugin/shared/src/config-loader.ts +2 -102
- package/packages/omo-codex/plugin/shared/src/config-migration.ts +0 -1
- package/packages/omo-codex/plugin/shared/test/config-loader.test.ts +41 -130
- package/packages/omo-codex/plugin/skills/init-deep/SKILL.md +13 -13
- package/packages/omo-codex/plugin/skills/lcx-doctor/SKILL.md +1 -1
- package/packages/omo-codex/plugin/skills/ultrawork/SKILL.md +2 -2
- package/packages/omo-codex/plugin/skills/ulw-loop/references/full-workflow.md +2 -1
- package/packages/omo-codex/plugin/skills/ulw-plan/SKILL.md +0 -1
- package/packages/omo-codex/plugin/test/AGENTS.md +2 -2
- package/packages/omo-codex/plugin/test/aggregate-hooks.test.mjs +2 -21
- package/packages/omo-codex/plugin/test/aggregate-manifest.test.mjs +1 -2
- package/packages/omo-codex/plugin/test/aggregate-mcp.test.mjs +2 -7
- package/packages/omo-codex/plugin/test/auto-update.test.mjs +0 -25
- package/packages/omo-codex/plugin/test/bootstrap-setup.test.mjs +0 -31
- package/packages/omo-codex/plugin/test/canonical-ultrawork-directive.test.mjs +53 -0
- package/packages/omo-codex/plugin/test/component-bundled-cli.test.mjs +0 -50
- package/packages/omo-codex/plugin/test/hook-status-message.test.mjs +0 -1
- package/packages/omo-codex/plugin/test/mcp-research-servers.test.mjs +1 -3
- package/packages/omo-codex/scripts/install-cache-copy.test.mjs +27 -1
- package/packages/omo-codex/scripts/install-config-git-bash.test.mjs +0 -23
- package/packages/omo-codex/scripts/install-dist/install-local.mjs +238 -431
- package/packages/omo-codex/scripts/install-git-bash-mcp-env.test.mjs +1 -25
- package/packages/omo-codex/scripts/install-mcp-runtime.test.mjs +0 -36
- package/packages/shared-skills/skills/init-deep/SKILL.md +13 -13
- package/packages/shared-skills/skills/ulw-plan/SKILL.md +0 -1
- package/dist/config/schema/codegraph.d.ts +0 -12
- package/dist/hooks/codegraph-bootstrap/command-runner.d.ts +0 -17
- package/dist/hooks/codegraph-bootstrap/hook.d.ts +0 -35
- package/dist/hooks/codegraph-bootstrap/index.d.ts +0 -1
- package/dist/hooks/codegraph-bootstrap/project-root.d.ts +0 -1
- package/dist/hooks/codegraph-bootstrap/status.d.ts +0 -11
- package/dist/mcp/codegraph.d.ts +0 -16
- package/packages/omo-codex/plugin/components/codegraph/AGENTS.md +0 -58
- package/packages/omo-codex/plugin/components/codegraph/LICENSE +0 -21
- package/packages/omo-codex/plugin/components/codegraph/NODE-RUNTIME-LICENSES.md +0 -2951
- package/packages/omo-codex/plugin/components/codegraph/NOTICE +0 -16
- package/packages/omo-codex/plugin/components/codegraph/dist/cli.js +0 -12326
- package/packages/omo-codex/plugin/components/codegraph/dist/serve.js +0 -9908
- package/packages/omo-codex/plugin/components/codegraph/package.json +0 -33
- package/packages/omo-codex/plugin/components/codegraph/src/cache-gc.ts +0 -29
- package/packages/omo-codex/plugin/components/codegraph/src/cli.ts +0 -79
- package/packages/omo-codex/plugin/components/codegraph/src/hook-input.ts +0 -33
- package/packages/omo-codex/plugin/components/codegraph/src/hook-sweep.ts +0 -25
- package/packages/omo-codex/plugin/components/codegraph/src/hook-types.ts +0 -131
- package/packages/omo-codex/plugin/components/codegraph/src/hook.ts +0 -258
- package/packages/omo-codex/plugin/components/codegraph/src/mcp-bridge.ts +0 -310
- package/packages/omo-codex/plugin/components/codegraph/src/mcp-unavailable.ts +0 -92
- package/packages/omo-codex/plugin/components/codegraph/src/post-tool-use-hook.ts +0 -34
- package/packages/omo-codex/plugin/components/codegraph/src/serve-invocation.ts +0 -29
- package/packages/omo-codex/plugin/components/codegraph/src/serve.ts +0 -263
- package/packages/omo-codex/plugin/components/codegraph/src/session-start-command.ts +0 -106
- package/packages/omo-codex/plugin/components/codegraph/src/session-start-cooldown.ts +0 -145
- package/packages/omo-codex/plugin/components/codegraph/src/session-start-hook-runtime.ts +0 -22
- package/packages/omo-codex/plugin/components/codegraph/src/session-start-lock.ts +0 -139
- package/packages/omo-codex/plugin/components/codegraph/src/session-start-outcome.ts +0 -15
- package/packages/omo-codex/plugin/components/codegraph/src/session-start-paths.ts +0 -32
- package/packages/omo-codex/plugin/components/codegraph/src/session-start-project.ts +0 -109
- package/packages/omo-codex/plugin/components/codegraph/src/session-start-worker-result.ts +0 -148
- package/packages/omo-codex/plugin/components/codegraph/src/session-start-worker.ts +0 -175
- package/packages/omo-codex/plugin/components/codegraph/src/sweep-cli.ts +0 -81
- package/packages/omo-codex/plugin/components/codegraph/test/cache-gc.test.ts +0 -34
- package/packages/omo-codex/plugin/components/codegraph/test/hook-exclusion.test.ts +0 -112
- package/packages/omo-codex/plugin/components/codegraph/test/hook-registration.test.ts +0 -26
- package/packages/omo-codex/plugin/components/codegraph/test/hook-session-start-guard.test.ts +0 -160
- package/packages/omo-codex/plugin/components/codegraph/test/hook-store-upgrade.test.ts +0 -50
- package/packages/omo-codex/plugin/components/codegraph/test/hook-sweep.test.ts +0 -29
- package/packages/omo-codex/plugin/components/codegraph/test/hook.test.ts +0 -320
- package/packages/omo-codex/plugin/components/codegraph/test/mcp-bridge-fixtures.ts +0 -172
- package/packages/omo-codex/plugin/components/codegraph/test/package-runtime.test.ts +0 -91
- package/packages/omo-codex/plugin/components/codegraph/test/provisioned-node-guard.test.ts +0 -100
- package/packages/omo-codex/plugin/components/codegraph/test/serve-built-wrapper.test.ts +0 -76
- package/packages/omo-codex/plugin/components/codegraph/test/serve-mcp-bridge-lifecycle.test.ts +0 -133
- package/packages/omo-codex/plugin/components/codegraph/test/serve-mcp-bridge.test.ts +0 -245
- package/packages/omo-codex/plugin/components/codegraph/test/serve-mcp-facade.test.ts +0 -69
- package/packages/omo-codex/plugin/components/codegraph/test/serve-node-support.test.ts +0 -43
- package/packages/omo-codex/plugin/components/codegraph/test/serve-provision.test.ts +0 -147
- package/packages/omo-codex/plugin/components/codegraph/test/serve-unavailable-idle.test.ts +0 -47
- package/packages/omo-codex/plugin/components/codegraph/test/serve-unavailable.test.ts +0 -175
- package/packages/omo-codex/plugin/components/codegraph/test/serve.test.ts +0 -385
- package/packages/omo-codex/plugin/components/codegraph/test/session-start-node-support.test.ts +0 -206
- package/packages/omo-codex/plugin/components/codegraph/test/session-start-project.test.ts +0 -58
- package/packages/omo-codex/plugin/components/codegraph/test/session-start-state.test.ts +0 -104
- package/packages/omo-codex/plugin/components/codegraph/test/session-start-trust-boundary.test.ts +0 -65
- package/packages/omo-codex/plugin/components/codegraph/test/session-start-worker-availability.test.ts +0 -106
- package/packages/omo-codex/plugin/components/codegraph/test/session-start-worker-cooldown.test.ts +0 -116
- package/packages/omo-codex/plugin/components/codegraph/test/session-start-worker-flow.test.ts +0 -258
- package/packages/omo-codex/plugin/components/codegraph/test/sweep-cli.test.ts +0 -56
- package/packages/omo-codex/plugin/components/codegraph/tsconfig.build.json +0 -13
- package/packages/omo-codex/plugin/components/codegraph/tsconfig.json +0 -25
- package/packages/omo-codex/plugin/components/ulw-loop/test/quality-gate-aggregate.test.ts +0 -101
- package/packages/omo-codex/plugin/hooks/post-tool-use-checking-codegraph-init-guidance.json +0 -18
- package/packages/omo-codex/plugin/hooks/session-start-checking-codegraph-bootstrap.json +0 -17
- package/packages/omo-codex/plugin/scripts/migrate-omo-sot/editor.mjs +0 -125
- package/packages/omo-codex/plugin/scripts/migrate-omo-sot/jsonc.mjs +0 -43
- package/packages/omo-codex/plugin/scripts/migrate-omo-sot/scaffold.mjs +0 -29
- package/packages/omo-codex/plugin/scripts/migrate-omo-sot.mjs +0 -121
- package/packages/omo-codex/plugin/test/component-codegraph-mcp-smoke.test.mjs +0 -76
- package/packages/omo-codex/plugin/test/migrate-omo-sot.test.mjs +0 -179
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// omo-codex-install:
|
|
2
|
+
// omo-codex-install:bf30630dcec48b8664b1acaba5e6a7847f43752f32e969cb18dad06137b3dca6:ffe02dd08d85d4f547671f7a445444994cd3c10860aaf343dbf31551fc4f8136
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __returnValue = (v) => v;
|
|
5
5
|
function __exportSetter(name, newValue) {
|
|
@@ -17,7 +17,7 @@ var __export = (target, all) => {
|
|
|
17
17
|
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
18
18
|
|
|
19
19
|
// packages/utils/src/xdg-data-dir.ts
|
|
20
|
-
import { accessSync
|
|
20
|
+
import { accessSync, constants, mkdirSync } from "node:fs";
|
|
21
21
|
import os from "node:os";
|
|
22
22
|
import path from "node:path";
|
|
23
23
|
function resolveXdgDataDir(appName, options = {}) {
|
|
@@ -29,7 +29,7 @@ function resolveXdgDataDir(appName, options = {}) {
|
|
|
29
29
|
function resolveWritableDirectory(preferredDir, fallbackSuffix, osProvider) {
|
|
30
30
|
try {
|
|
31
31
|
mkdirSync(preferredDir, { recursive: true });
|
|
32
|
-
|
|
32
|
+
accessSync(preferredDir, constants.W_OK);
|
|
33
33
|
return preferredDir;
|
|
34
34
|
} catch (error) {
|
|
35
35
|
if (!(error instanceof Error))
|
|
@@ -52,7 +52,7 @@ import {
|
|
|
52
52
|
writeFileSync
|
|
53
53
|
} from "node:fs";
|
|
54
54
|
import { randomUUID } from "node:crypto";
|
|
55
|
-
import { dirname as
|
|
55
|
+
import { dirname as dirname9 } from "node:path";
|
|
56
56
|
function isToleratedFsyncError(error) {
|
|
57
57
|
if (!(error instanceof Error))
|
|
58
58
|
return false;
|
|
@@ -90,7 +90,7 @@ function writeFileAtomically(filePath, content, options = {}) {
|
|
|
90
90
|
}
|
|
91
91
|
if (platform === "win32")
|
|
92
92
|
return;
|
|
93
|
-
const directoryFileDescriptor = openSync(
|
|
93
|
+
const directoryFileDescriptor = openSync(dirname9(filePath), "r");
|
|
94
94
|
try {
|
|
95
95
|
tolerantFsyncSync(directoryFileDescriptor, fsyncImpl);
|
|
96
96
|
} finally {
|
|
@@ -111,21 +111,21 @@ var init_atomic_write = __esm(() => {
|
|
|
111
111
|
});
|
|
112
112
|
|
|
113
113
|
// packages/telemetry-core/src/activity-state.ts
|
|
114
|
-
import { existsSync as
|
|
115
|
-
import { basename as
|
|
114
|
+
import { existsSync as existsSync4, mkdirSync as mkdirSync2, readFileSync as readFileSync2 } from "node:fs";
|
|
115
|
+
import { basename as basename6, join as join32 } from "node:path";
|
|
116
116
|
function resolveTelemetryStateDir(product, options = {}) {
|
|
117
117
|
const dataDir = resolveXdgDataDir(product.cacheDirName, {
|
|
118
118
|
env: options.env,
|
|
119
119
|
osProvider: options.osProvider
|
|
120
120
|
});
|
|
121
|
-
const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined :
|
|
122
|
-
if (dataDir === xdgStateDir || xdgStateDir === undefined &&
|
|
121
|
+
const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined : join32(options.env.XDG_DATA_HOME, product.cacheDirName);
|
|
122
|
+
if (dataDir === xdgStateDir || xdgStateDir === undefined && basename6(dataDir) === product.cacheDirName) {
|
|
123
123
|
return dataDir;
|
|
124
124
|
}
|
|
125
|
-
return
|
|
125
|
+
return join32(dataDir, product.cacheDirName);
|
|
126
126
|
}
|
|
127
127
|
function getTelemetryActivityStateFilePath(stateDir) {
|
|
128
|
-
return
|
|
128
|
+
return join32(stateDir, POSTHOG_ACTIVITY_STATE_FILE);
|
|
129
129
|
}
|
|
130
130
|
function getDailyActiveCaptureState(input) {
|
|
131
131
|
const state = readPostHogActivityState(input.stateDir, input.diagnostics);
|
|
@@ -150,7 +150,7 @@ function isPostHogActivityState(value) {
|
|
|
150
150
|
}
|
|
151
151
|
function readPostHogActivityState(stateDir, diagnostics) {
|
|
152
152
|
const stateFilePath = getTelemetryActivityStateFilePath(stateDir);
|
|
153
|
-
if (!
|
|
153
|
+
if (!existsSync4(stateFilePath)) {
|
|
154
154
|
return {};
|
|
155
155
|
}
|
|
156
156
|
try {
|
|
@@ -195,10 +195,10 @@ var init_activity_state = __esm(() => {
|
|
|
195
195
|
var DEFAULT_POSTHOG_HOST = "https://us.i.posthog.com", DEFAULT_POSTHOG_API_KEY = "phc_CFJhj5HyvA62QPhvyaUCtaq23aUfznnijg5VaaGkNk74", UNCONFIGURED_POSTHOG_API_KEY = "phc_REPLACE_ME_OMO_NATIVE";
|
|
196
196
|
|
|
197
197
|
// packages/telemetry-core/src/diagnostics.ts
|
|
198
|
-
import { appendFileSync, existsSync as
|
|
199
|
-
import { join as
|
|
198
|
+
import { appendFileSync, existsSync as existsSync5, mkdirSync as mkdirSync3, readFileSync as readFileSync3 } from "node:fs";
|
|
199
|
+
import { join as join33 } from "node:path";
|
|
200
200
|
function getTelemetryDiagnosticsFilePath(diagnosticsDir) {
|
|
201
|
-
return
|
|
201
|
+
return join33(diagnosticsDir, DIAGNOSTICS_FILE_NAME);
|
|
202
202
|
}
|
|
203
203
|
function writeTelemetryDiagnostic(input, options) {
|
|
204
204
|
const now = options.now ?? new Date;
|
|
@@ -216,7 +216,7 @@ function writeTelemetryDiagnostic(input, options) {
|
|
|
216
216
|
}
|
|
217
217
|
function cleanupTelemetryDiagnostics(options) {
|
|
218
218
|
const diagnosticsFilePath = getTelemetryDiagnosticsFilePath(options.diagnosticsDir);
|
|
219
|
-
if (!
|
|
219
|
+
if (!existsSync5(diagnosticsFilePath)) {
|
|
220
220
|
return;
|
|
221
221
|
}
|
|
222
222
|
try {
|
|
@@ -363,7 +363,7 @@ var init_env = __esm(() => {
|
|
|
363
363
|
});
|
|
364
364
|
|
|
365
365
|
// node_modules/.bun/posthog-node@5.51.1/node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
|
|
366
|
-
import { dirname as
|
|
366
|
+
import { dirname as dirname10, posix as posix2, sep as sep7 } from "node:path";
|
|
367
367
|
function createModulerModifier() {
|
|
368
368
|
const getModuleFromFileName = createGetModuleFromFilename();
|
|
369
369
|
return async (frames) => {
|
|
@@ -372,7 +372,7 @@ function createModulerModifier() {
|
|
|
372
372
|
return frames;
|
|
373
373
|
};
|
|
374
374
|
}
|
|
375
|
-
function createGetModuleFromFilename(basePath = process.argv[1] ?
|
|
375
|
+
function createGetModuleFromFilename(basePath = process.argv[1] ? dirname10(process.argv[1]) : process.cwd(), isWindows = sep7 === "\\") {
|
|
376
376
|
const normalizedBase = isWindows ? normalizeWindowsPath(basePath) : basePath;
|
|
377
377
|
return (filename) => {
|
|
378
378
|
if (!filename)
|
|
@@ -4265,7 +4265,7 @@ var init_dist = __esm(() => {
|
|
|
4265
4265
|
});
|
|
4266
4266
|
|
|
4267
4267
|
// node_modules/.bun/posthog-node@5.51.1/node_modules/posthog-node/dist/extensions/error-tracking/modifiers/context-lines.node.mjs
|
|
4268
|
-
import { constants as
|
|
4268
|
+
import { constants as constants2 } from "node:fs";
|
|
4269
4269
|
import { open as promises_open } from "node:fs/promises";
|
|
4270
4270
|
import { isAbsolute as isAbsolute7 } from "node:path";
|
|
4271
4271
|
import { createInterface } from "node:readline";
|
|
@@ -4317,7 +4317,7 @@ async function openRegularSourceFile(path2, openSourceFile, logger2) {
|
|
|
4317
4317
|
let fileHandle;
|
|
4318
4318
|
let isValid = false;
|
|
4319
4319
|
try {
|
|
4320
|
-
fileHandle = await openSourceFile(path2,
|
|
4320
|
+
fileHandle = await openSourceFile(path2, constants2.O_RDONLY | constants2.O_NONBLOCK);
|
|
4321
4321
|
const fileStat = await fileHandle.stat();
|
|
4322
4322
|
if (!fileStat.isFile())
|
|
4323
4323
|
return;
|
|
@@ -7977,7 +7977,7 @@ var package_default;
|
|
|
7977
7977
|
var init_package = __esm(() => {
|
|
7978
7978
|
package_default = {
|
|
7979
7979
|
name: "@oh-my-opencode/omo-codex",
|
|
7980
|
-
version: "5.0.0-beta.
|
|
7980
|
+
version: "5.0.0-beta.35",
|
|
7981
7981
|
type: "module",
|
|
7982
7982
|
private: true,
|
|
7983
7983
|
description: "Codex harness adapter for oh-my-openagent. Vendored Codex plugin namespace (omo) + TypeScript installer + telemetry.",
|
|
@@ -8197,7 +8197,7 @@ var init_telemetry = __esm(() => {
|
|
|
8197
8197
|
|
|
8198
8198
|
// packages/omo-codex/src/install/install-local-cli.ts
|
|
8199
8199
|
import { readFile as readFile23 } from "node:fs/promises";
|
|
8200
|
-
import { dirname as
|
|
8200
|
+
import { dirname as dirname12, join as join38, resolve as resolve10 } from "node:path";
|
|
8201
8201
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
8202
8202
|
|
|
8203
8203
|
// packages/utils/src/runtime/spawn.ts
|
|
@@ -8355,71 +8355,6 @@ function spawn(cmdOrOpts, opts) {
|
|
|
8355
8355
|
return wrapNodeProcess(nodeSpawn(bin, args, createNodeSpawnOptions(options)));
|
|
8356
8356
|
}
|
|
8357
8357
|
|
|
8358
|
-
// packages/utils/src/runtime/which.ts
|
|
8359
|
-
import { accessSync, constants } from "node:fs";
|
|
8360
|
-
import { delimiter, join } from "node:path";
|
|
8361
|
-
var runtime2 = globalThis;
|
|
8362
|
-
function isUnsafeCommandName(commandName) {
|
|
8363
|
-
if (commandName.includes("/") || commandName.includes("\\"))
|
|
8364
|
-
return true;
|
|
8365
|
-
if (commandName === "." || commandName === ".." || commandName.includes(".."))
|
|
8366
|
-
return true;
|
|
8367
|
-
if (/^[a-zA-Z]:/.test(commandName))
|
|
8368
|
-
return true;
|
|
8369
|
-
if (commandName.includes("\x00"))
|
|
8370
|
-
return true;
|
|
8371
|
-
return false;
|
|
8372
|
-
}
|
|
8373
|
-
function isExecutable(filePath) {
|
|
8374
|
-
try {
|
|
8375
|
-
accessSync(filePath, process.platform === "win32" ? constants.F_OK : constants.X_OK);
|
|
8376
|
-
return true;
|
|
8377
|
-
} catch (error) {
|
|
8378
|
-
if (!(error instanceof Error) && Object.prototype.toString.call(error) !== "[object Error]") {
|
|
8379
|
-
throw error;
|
|
8380
|
-
}
|
|
8381
|
-
return false;
|
|
8382
|
-
}
|
|
8383
|
-
}
|
|
8384
|
-
function resolvePathValue() {
|
|
8385
|
-
if (process.platform === "win32")
|
|
8386
|
-
return process.env["Path"] ?? process.env["PATH"];
|
|
8387
|
-
return process.env["PATH"];
|
|
8388
|
-
}
|
|
8389
|
-
function getWindowsCandidates(commandName) {
|
|
8390
|
-
if (process.platform !== "win32")
|
|
8391
|
-
return [commandName];
|
|
8392
|
-
if (/\.[^\\/]+$/.test(commandName))
|
|
8393
|
-
return [commandName];
|
|
8394
|
-
return [commandName, `${commandName}.exe`, `${commandName}.cmd`, `${commandName}.bat`, `${commandName}.com`];
|
|
8395
|
-
}
|
|
8396
|
-
function bunWhich(commandName) {
|
|
8397
|
-
if (!commandName)
|
|
8398
|
-
return null;
|
|
8399
|
-
if (isUnsafeCommandName(commandName))
|
|
8400
|
-
return null;
|
|
8401
|
-
const candidateNames = getWindowsCandidates(commandName);
|
|
8402
|
-
for (const candidateName of candidateNames) {
|
|
8403
|
-
const resolvedPath = runtime2.Bun?.which(candidateName) ?? null;
|
|
8404
|
-
if (resolvedPath !== null)
|
|
8405
|
-
return resolvedPath;
|
|
8406
|
-
}
|
|
8407
|
-
const pathValue = resolvePathValue();
|
|
8408
|
-
if (!pathValue)
|
|
8409
|
-
return null;
|
|
8410
|
-
const pathEntries = pathValue.split(delimiter).filter((pathEntry) => pathEntry.length > 0);
|
|
8411
|
-
if (pathEntries.length === 0)
|
|
8412
|
-
return null;
|
|
8413
|
-
for (const pathEntry of pathEntries) {
|
|
8414
|
-
for (const candidateName of candidateNames) {
|
|
8415
|
-
const candidatePath = join(pathEntry, candidateName);
|
|
8416
|
-
if (isExecutable(candidatePath))
|
|
8417
|
-
return candidatePath;
|
|
8418
|
-
}
|
|
8419
|
-
}
|
|
8420
|
-
return null;
|
|
8421
|
-
}
|
|
8422
|
-
|
|
8423
8358
|
// packages/utils/src/runtime/git-bash.ts
|
|
8424
8359
|
import { execFileSync } from "node:child_process";
|
|
8425
8360
|
import { existsSync } from "node:fs";
|
|
@@ -8530,13 +8465,13 @@ var defaultRunCommand = async (command, args, options) => {
|
|
|
8530
8465
|
};
|
|
8531
8466
|
|
|
8532
8467
|
// packages/omo-codex/src/install/install-codex.ts
|
|
8533
|
-
import { join as
|
|
8534
|
-
import { existsSync as
|
|
8468
|
+
import { join as join34, resolve as resolve9 } from "node:path";
|
|
8469
|
+
import { existsSync as existsSync6 } from "node:fs";
|
|
8535
8470
|
import { homedir as homedir2 } from "node:os";
|
|
8536
8471
|
|
|
8537
8472
|
// packages/omo-codex/src/install/codex-cache-bins.ts
|
|
8538
8473
|
import { chmod, lstat as lstat4, mkdir, readFile as readFile3, readdir as readdir2, readlink as readlink3, rm as rm3, stat as stat2, symlink, writeFile } from "node:fs/promises";
|
|
8539
|
-
import { basename, isAbsolute as isAbsolute2, join as
|
|
8474
|
+
import { basename, isAbsolute as isAbsolute2, join as join4, relative, resolve as resolve2, sep } from "node:path";
|
|
8540
8475
|
|
|
8541
8476
|
// packages/omo-codex/src/install/codex-cache-command-shim.ts
|
|
8542
8477
|
var COMMAND_SHIM_MARKER = ":: generated by oh-my-openagent Codex installer";
|
|
@@ -8581,7 +8516,7 @@ function windowsCommandShim(targetPath) {
|
|
|
8581
8516
|
|
|
8582
8517
|
// packages/omo-codex/src/install/codex-cache-dangling-bins.ts
|
|
8583
8518
|
import { lstat as lstat2, readFile, readdir, readlink, rm, stat } from "node:fs/promises";
|
|
8584
|
-
import { dirname, isAbsolute, join
|
|
8519
|
+
import { dirname, isAbsolute, join, resolve } from "node:path";
|
|
8585
8520
|
|
|
8586
8521
|
// packages/omo-codex/src/install/codex-cache-fs.ts
|
|
8587
8522
|
import { lstat } from "node:fs/promises";
|
|
@@ -8609,7 +8544,7 @@ async function removeDanglingManagedComponentBins(binDir, platform, managedBinNa
|
|
|
8609
8544
|
const binName = managedBinNameForEntry(entry.name, platform);
|
|
8610
8545
|
if (binName === null || !managedBinNames.has(binName))
|
|
8611
8546
|
continue;
|
|
8612
|
-
const linkPath =
|
|
8547
|
+
const linkPath = join(binDir, entry.name);
|
|
8613
8548
|
if (platform === "win32") {
|
|
8614
8549
|
await removeDanglingGeneratedCommandShim(linkPath);
|
|
8615
8550
|
continue;
|
|
@@ -8691,7 +8626,7 @@ function hasOmoCodexPluginPrefix(parts, endExclusive) {
|
|
|
8691
8626
|
|
|
8692
8627
|
// packages/omo-codex/src/install/codex-cache-legacy-bins.ts
|
|
8693
8628
|
import { lstat as lstat3, readFile as readFile2, readlink as readlink2, rm as rm2 } from "node:fs/promises";
|
|
8694
|
-
import { join as
|
|
8629
|
+
import { join as join2 } from "node:path";
|
|
8695
8630
|
var LEGACY_CODEX_COMPONENT_BINS = [
|
|
8696
8631
|
{ name: "omo", component: "ulw-loop" },
|
|
8697
8632
|
{ name: "codex-comment-checker", component: "comment-checker" },
|
|
@@ -8704,7 +8639,7 @@ var LEGACY_CODEX_COMPONENT_BINS = [
|
|
|
8704
8639
|
var LEGACY_CODEX_COMPONENT_BIN_NAMES = LEGACY_CODEX_COMPONENT_BINS.map((entry) => entry.name);
|
|
8705
8640
|
async function removeLegacyCodexComponentBins(binDir, platform) {
|
|
8706
8641
|
for (const entry of LEGACY_CODEX_COMPONENT_BINS) {
|
|
8707
|
-
const linkPath =
|
|
8642
|
+
const linkPath = join2(binDir, platform === "win32" ? `${entry.name}.cmd` : entry.name);
|
|
8708
8643
|
await removeLegacyCodexComponentBin(linkPath, entry.component, platform);
|
|
8709
8644
|
}
|
|
8710
8645
|
}
|
|
@@ -8755,10 +8690,10 @@ function isNodeErrorWithCode2(error) {
|
|
|
8755
8690
|
}
|
|
8756
8691
|
|
|
8757
8692
|
// packages/omo-codex/src/install/codex-cache-runtime-wrapper.ts
|
|
8758
|
-
import { join as
|
|
8693
|
+
import { join as join3 } from "node:path";
|
|
8759
8694
|
var RUNTIME_WRAPPER_MARKER = "OMO_GENERATED_RUNTIME_WRAPPER";
|
|
8760
8695
|
function posixRuntimeWrapper(binName, cliPath, codexHome, binDir, nodeCliPath) {
|
|
8761
|
-
const ulwLoopBin = toPosixPath(
|
|
8696
|
+
const ulwLoopBin = toPosixPath(join3(binDir, "omo-ulw-loop"));
|
|
8762
8697
|
const nodeCli = escapePosixDoubleQuoted(toPosixPath(nodeCliPath));
|
|
8763
8698
|
const escapedCliPath = escapePosixDoubleQuoted(toPosixPath(cliPath));
|
|
8764
8699
|
const escapedCodexHome = escapePosixDoubleQuoted(toPosixPath(codexHome));
|
|
@@ -8805,7 +8740,7 @@ function posixRuntimeWrapper(binName, cliPath, codexHome, binDir, nodeCliPath) {
|
|
|
8805
8740
|
`);
|
|
8806
8741
|
}
|
|
8807
8742
|
function windowsRuntimeWrapper(binName, cliPath, codexHome, binDir, nodeCliPath) {
|
|
8808
|
-
const ulwLoopBin =
|
|
8743
|
+
const ulwLoopBin = join3(binDir, "omo-ulw-loop.cmd");
|
|
8809
8744
|
return [
|
|
8810
8745
|
"@echo off",
|
|
8811
8746
|
`rem ${RUNTIME_WRAPPER_MARKER}`,
|
|
@@ -8874,34 +8809,34 @@ async function removeCachedManagedNpmBinShims(pluginRoot) {
|
|
|
8874
8809
|
const binLinks = await discoverPackageBins(pluginRoot);
|
|
8875
8810
|
if (binLinks.length === 0)
|
|
8876
8811
|
return;
|
|
8877
|
-
const npmBinDir =
|
|
8812
|
+
const npmBinDir = join4(pluginRoot, "node_modules", ".bin");
|
|
8878
8813
|
if (!await isFileSystemEntry2(npmBinDir))
|
|
8879
8814
|
return;
|
|
8880
8815
|
const managedBinNames = new Set(binLinks.map((link) => link.name));
|
|
8881
8816
|
for (const name of managedBinNames) {
|
|
8882
8817
|
for (const suffix of ["", ".cmd", ".ps1"]) {
|
|
8883
|
-
await rm3(
|
|
8818
|
+
await rm3(join4(npmBinDir, `${name}${suffix}`), { force: true });
|
|
8884
8819
|
}
|
|
8885
8820
|
}
|
|
8886
8821
|
}
|
|
8887
8822
|
async function linkRootRuntimeBin(input) {
|
|
8888
|
-
const cliPath =
|
|
8823
|
+
const cliPath = join4(input.repoRoot, "dist", "cli", "index.js");
|
|
8889
8824
|
const platform = input.platform ?? process.platform;
|
|
8890
|
-
const legacyPath =
|
|
8825
|
+
const legacyPath = join4(input.binDir, platform === "win32" ? "omo.cmd" : "omo");
|
|
8891
8826
|
if (!await isFile(cliPath)) {
|
|
8892
8827
|
await removeGeneratedRuntimeWrapper(legacyPath);
|
|
8893
8828
|
return null;
|
|
8894
8829
|
}
|
|
8895
8830
|
const binName = "omo-agent-toolkit";
|
|
8896
|
-
const nodeCliPath =
|
|
8831
|
+
const nodeCliPath = join4(input.repoRoot, "dist", "cli-node", "index.js");
|
|
8897
8832
|
await mkdir(input.binDir, { recursive: true });
|
|
8898
8833
|
if (platform === "win32") {
|
|
8899
|
-
const linkPath2 =
|
|
8834
|
+
const linkPath2 = join4(input.binDir, `${binName}.cmd`);
|
|
8900
8835
|
await replaceRuntimeWrapper(linkPath2, windowsRuntimeWrapper(binName, cliPath, input.codexHome, input.binDir, nodeCliPath));
|
|
8901
8836
|
await removeGeneratedRuntimeWrapper(legacyPath);
|
|
8902
8837
|
return { name: binName, path: linkPath2, target: cliPath };
|
|
8903
8838
|
}
|
|
8904
|
-
const linkPath =
|
|
8839
|
+
const linkPath = join4(input.binDir, binName);
|
|
8905
8840
|
await replaceRuntimeWrapper(linkPath, posixRuntimeWrapper(binName, cliPath, input.codexHome, input.binDir, nodeCliPath));
|
|
8906
8841
|
await chmod(linkPath, 493);
|
|
8907
8842
|
await removeGeneratedRuntimeWrapper(legacyPath);
|
|
@@ -8909,11 +8844,11 @@ async function linkRootRuntimeBin(input) {
|
|
|
8909
8844
|
}
|
|
8910
8845
|
async function linkCachedPluginBin(binDir, link, platform) {
|
|
8911
8846
|
if (platform === "win32") {
|
|
8912
|
-
const linkPath2 =
|
|
8847
|
+
const linkPath2 = join4(binDir, `${link.name}.cmd`);
|
|
8913
8848
|
await replaceCommandShim(linkPath2, link.target);
|
|
8914
8849
|
return linkPath2;
|
|
8915
8850
|
}
|
|
8916
|
-
const linkPath =
|
|
8851
|
+
const linkPath = join4(binDir, link.name);
|
|
8917
8852
|
await replaceSymlink(linkPath, link.target);
|
|
8918
8853
|
return linkPath;
|
|
8919
8854
|
}
|
|
@@ -8944,14 +8879,14 @@ async function discoverPackageBins(root) {
|
|
|
8944
8879
|
async function collectPackageBins(directory, root, links) {
|
|
8945
8880
|
const entries = await readdir2(directory, { withFileTypes: true });
|
|
8946
8881
|
if (entries.some((entry) => entry.isFile() && entry.name === "package.json")) {
|
|
8947
|
-
await appendPackageBinLinks(
|
|
8882
|
+
await appendPackageBinLinks(join4(directory, "package.json"), directory, root, links);
|
|
8948
8883
|
}
|
|
8949
8884
|
for (const entry of entries) {
|
|
8950
8885
|
if (!entry.isDirectory())
|
|
8951
8886
|
continue;
|
|
8952
8887
|
if (entry.name === "node_modules" || entry.name === ".git" || entry.name === "dist")
|
|
8953
8888
|
continue;
|
|
8954
|
-
const childPath =
|
|
8889
|
+
const childPath = join4(directory, entry.name);
|
|
8955
8890
|
if (!childPath.startsWith(root))
|
|
8956
8891
|
continue;
|
|
8957
8892
|
await collectPackageBins(childPath, root, links);
|
|
@@ -9086,11 +9021,11 @@ async function existingNonSymlink(path) {
|
|
|
9086
9021
|
}
|
|
9087
9022
|
// packages/omo-codex/src/install/codex-cache-install.ts
|
|
9088
9023
|
import { cp as cp2, mkdir as mkdir3, readFile as readFile8, readdir as readdir4, rename, rm as rm4 } from "node:fs/promises";
|
|
9089
|
-
import { basename as
|
|
9024
|
+
import { basename as basename2, dirname as dirname4, join as join10, sep as sep5 } from "node:path";
|
|
9090
9025
|
|
|
9091
9026
|
// packages/omo-codex/src/install/codex-cache-bundled-mcps.ts
|
|
9092
9027
|
import { cp, mkdir as mkdir2, readFile as readFile4, stat as stat3 } from "node:fs/promises";
|
|
9093
|
-
import { dirname as dirname2, join as
|
|
9028
|
+
import { dirname as dirname2, join as join5, resolve as resolve3 } from "node:path";
|
|
9094
9029
|
var BUNDLED_MCP_RUNTIMES = [
|
|
9095
9030
|
{
|
|
9096
9031
|
label: "Git Bash MCP",
|
|
@@ -9108,23 +9043,23 @@ var BUNDLED_MCP_RUNTIMES = [
|
|
|
9108
9043
|
}
|
|
9109
9044
|
];
|
|
9110
9045
|
async function copyBundledMcpRuntimeDists(input) {
|
|
9111
|
-
const sourceArgs = await readSourceMcpArgs(
|
|
9112
|
-
for (const
|
|
9113
|
-
if (!sourceArgs.has(
|
|
9046
|
+
const sourceArgs = await readSourceMcpArgs(join5(input.sourceRoot, ".mcp.json"));
|
|
9047
|
+
for (const runtime2 of BUNDLED_MCP_RUNTIMES) {
|
|
9048
|
+
if (!sourceArgs.has(runtime2.sourceArg))
|
|
9114
9049
|
continue;
|
|
9115
|
-
await copyBundledMcpRuntimeDist(input.pluginRoot, input.sourceRoot,
|
|
9050
|
+
await copyBundledMcpRuntimeDist(input.pluginRoot, input.sourceRoot, runtime2);
|
|
9116
9051
|
}
|
|
9117
9052
|
}
|
|
9118
9053
|
function resolveBundledMcpRuntimeArg(pluginRoot, arg) {
|
|
9119
|
-
const
|
|
9120
|
-
return
|
|
9054
|
+
const runtime2 = BUNDLED_MCP_RUNTIMES.find((candidate) => candidate.sourceArg === arg);
|
|
9055
|
+
return runtime2 ? join5(pluginRoot, runtime2.destinationArg) : null;
|
|
9121
9056
|
}
|
|
9122
|
-
async function copyBundledMcpRuntimeDist(pluginRoot, sourceRoot,
|
|
9123
|
-
const sourcePath = resolve3(sourceRoot,
|
|
9057
|
+
async function copyBundledMcpRuntimeDist(pluginRoot, sourceRoot, runtime2) {
|
|
9058
|
+
const sourcePath = resolve3(sourceRoot, runtime2.sourceDistFromPlugin);
|
|
9124
9059
|
if (!await isDirectory(sourcePath)) {
|
|
9125
|
-
throw new Error(`missing built ${
|
|
9060
|
+
throw new Error(`missing built ${runtime2.label} dist at ${sourcePath}`);
|
|
9126
9061
|
}
|
|
9127
|
-
const destinationPath =
|
|
9062
|
+
const destinationPath = join5(pluginRoot, runtime2.destinationDistFromPlugin);
|
|
9128
9063
|
await mkdir2(dirname2(destinationPath), { recursive: true });
|
|
9129
9064
|
await cp(sourcePath, destinationPath, { recursive: true });
|
|
9130
9065
|
}
|
|
@@ -9163,10 +9098,10 @@ async function isDirectory(path) {
|
|
|
9163
9098
|
// packages/omo-codex/src/install/codex-cache-local-dependencies.ts
|
|
9164
9099
|
import { realpathSync } from "node:fs";
|
|
9165
9100
|
import { readFile as readFile5, readdir as readdir3, writeFile as writeFile2 } from "node:fs/promises";
|
|
9166
|
-
import { dirname as dirname3, isAbsolute as isAbsolute4, join as
|
|
9101
|
+
import { dirname as dirname3, isAbsolute as isAbsolute4, join as join7, relative as relative3, resolve as resolve5, sep as sep2 } from "node:path";
|
|
9167
9102
|
|
|
9168
9103
|
// packages/omo-codex/src/install/codex-cache-paths.ts
|
|
9169
|
-
import { isAbsolute as isAbsolute3, join as
|
|
9104
|
+
import { isAbsolute as isAbsolute3, join as join6, relative as relative2, resolve as resolve4 } from "node:path";
|
|
9170
9105
|
function resolveCachedRuntimePath(pluginRoot, sourceRoot, runtimePath) {
|
|
9171
9106
|
const targetPath = resolve4(pluginRoot, runtimePath);
|
|
9172
9107
|
if (isPathInside(targetPath, pluginRoot))
|
|
@@ -9190,7 +9125,7 @@ async function rewriteCachedPackageLocalFileDependencies(pluginRoot, sourceRoot)
|
|
|
9190
9125
|
if (!isPlainRecord(parsed))
|
|
9191
9126
|
continue;
|
|
9192
9127
|
const packageDir = dirname3(packageJsonPath);
|
|
9193
|
-
const sourcePackageDir =
|
|
9128
|
+
const sourcePackageDir = join7(sourceRoot, relative3(pluginRoot, packageDir));
|
|
9194
9129
|
let changed = false;
|
|
9195
9130
|
for (const field of ["dependencies", "optionalDependencies", "peerDependencies"]) {
|
|
9196
9131
|
const dependencies = parsed[field];
|
|
@@ -9231,7 +9166,7 @@ async function rewriteCachedPackageLocalFileDependencies(pluginRoot, sourceRoot)
|
|
|
9231
9166
|
return rewroteAnyPackageJson;
|
|
9232
9167
|
}
|
|
9233
9168
|
async function readPackageLock(pluginRoot) {
|
|
9234
|
-
const path =
|
|
9169
|
+
const path = join7(pluginRoot, "package-lock.json");
|
|
9235
9170
|
try {
|
|
9236
9171
|
const parsed = JSON.parse(await readFile5(path, "utf8"));
|
|
9237
9172
|
return { path, value: isPlainRecord(parsed) ? parsed : null, changed: false };
|
|
@@ -9292,14 +9227,14 @@ function canonicalizeExistingPath(path) {
|
|
|
9292
9227
|
async function collectPackageJsonPaths(directory, root, paths) {
|
|
9293
9228
|
const entries = await readdir3(directory, { withFileTypes: true });
|
|
9294
9229
|
if (entries.some((entry) => entry.isFile() && entry.name === "package.json")) {
|
|
9295
|
-
paths.push(
|
|
9230
|
+
paths.push(join7(directory, "package.json"));
|
|
9296
9231
|
}
|
|
9297
9232
|
for (const entry of entries) {
|
|
9298
9233
|
if (!entry.isDirectory())
|
|
9299
9234
|
continue;
|
|
9300
9235
|
if (entry.name === "node_modules" || entry.name === ".git" || entry.name === "dist")
|
|
9301
9236
|
continue;
|
|
9302
|
-
const childPath =
|
|
9237
|
+
const childPath = join7(directory, entry.name);
|
|
9303
9238
|
if (!isPathInside(childPath, root))
|
|
9304
9239
|
continue;
|
|
9305
9240
|
await collectPackageJsonPaths(childPath, root, paths);
|
|
@@ -9308,127 +9243,10 @@ async function collectPackageJsonPaths(directory, root, paths) {
|
|
|
9308
9243
|
|
|
9309
9244
|
// packages/omo-codex/src/install/codex-cache-mcp-manifest.ts
|
|
9310
9245
|
import { readFile as readFile6, writeFile as writeFile3 } from "node:fs/promises";
|
|
9311
|
-
import { join as
|
|
9312
|
-
|
|
9313
|
-
// packages/utils/src/codegraph/resolve.ts
|
|
9314
|
-
import { existsSync as existsSync2 } from "node:fs";
|
|
9315
|
-
import { spawnSync as spawnSync2 } from "node:child_process";
|
|
9316
|
-
import { basename as basename2, dirname as dirname4, join as join9 } from "node:path";
|
|
9317
|
-
import { createRequire } from "node:module";
|
|
9318
|
-
|
|
9319
|
-
// packages/utils/src/codegraph/node-support.ts
|
|
9320
|
-
var CODEGRAPH_MIN_NODE_MAJOR = 20;
|
|
9321
|
-
var CODEGRAPH_BLOCKED_NODE_MAJOR = 25;
|
|
9322
|
-
var CODEGRAPH_UNSAFE_NODE_ENV = "CODEGRAPH_ALLOW_UNSAFE_NODE";
|
|
9323
|
-
var CODEGRAPH_NODE_BIN_ENV = "CODEGRAPH_NODE_BIN";
|
|
9324
|
-
function evaluateCodegraphNodeSupport(options = {}) {
|
|
9325
|
-
const nodeVersion = options.nodeVersion ?? process.versions.node;
|
|
9326
|
-
const env = options.env ?? process.env;
|
|
9327
|
-
const override = (env[CODEGRAPH_UNSAFE_NODE_ENV]?.trim().length ?? 0) > 0;
|
|
9328
|
-
const major = parseNodeMajor(nodeVersion);
|
|
9329
|
-
if (major >= CODEGRAPH_BLOCKED_NODE_MAJOR) {
|
|
9330
|
-
return { major, override, reason: "too-new", supported: override };
|
|
9331
|
-
}
|
|
9332
|
-
if (major < CODEGRAPH_MIN_NODE_MAJOR) {
|
|
9333
|
-
return { major, override, reason: "too-old", supported: override };
|
|
9334
|
-
}
|
|
9335
|
-
return { major, override, supported: true };
|
|
9336
|
-
}
|
|
9337
|
-
function parseNodeMajor(version) {
|
|
9338
|
-
const normalized = version.startsWith("v") ? version.slice(1) : version;
|
|
9339
|
-
const major = Number.parseInt(normalized.split(".")[0] ?? "", 10);
|
|
9340
|
-
return Number.isNaN(major) ? 0 : major;
|
|
9341
|
-
}
|
|
9342
|
-
|
|
9343
|
-
// packages/utils/src/codegraph/resolve.ts
|
|
9344
|
-
var CODEGRAPH_NODE_CANDIDATES = ["node24", "node22", "node20", "node"];
|
|
9345
|
-
var CODEGRAPH_NODE_PATH_CANDIDATES = [
|
|
9346
|
-
"/opt/homebrew/opt/node@24/bin/node",
|
|
9347
|
-
"/opt/homebrew/opt/node@22/bin/node",
|
|
9348
|
-
"/opt/homebrew/opt/node@20/bin/node",
|
|
9349
|
-
"/usr/local/opt/node@24/bin/node",
|
|
9350
|
-
"/usr/local/opt/node@22/bin/node",
|
|
9351
|
-
"/usr/local/opt/node@20/bin/node"
|
|
9352
|
-
];
|
|
9353
|
-
var requireFromHere = createRequire(import.meta.url);
|
|
9354
|
-
function defaultNodeVersion(nodePath) {
|
|
9355
|
-
if (nodePath === process.execPath && isNodeExecutableName(nodePath))
|
|
9356
|
-
return process.versions.node;
|
|
9357
|
-
try {
|
|
9358
|
-
const result = spawnSync2(nodePath, ["--version"], {
|
|
9359
|
-
encoding: "utf8",
|
|
9360
|
-
timeout: 2000,
|
|
9361
|
-
windowsHide: true
|
|
9362
|
-
});
|
|
9363
|
-
if (result.error !== undefined || result.status !== 0)
|
|
9364
|
-
return null;
|
|
9365
|
-
const version = `${result.stdout}
|
|
9366
|
-
${result.stderr}`.trim().split(/\s+/)[0];
|
|
9367
|
-
return version === undefined || version.length === 0 ? null : version;
|
|
9368
|
-
} catch (error) {
|
|
9369
|
-
if (error instanceof Error)
|
|
9370
|
-
return null;
|
|
9371
|
-
throw error;
|
|
9372
|
-
}
|
|
9373
|
-
}
|
|
9374
|
-
function isNodeExecutableName(filePath) {
|
|
9375
|
-
const executable = basename2(filePath).toLowerCase();
|
|
9376
|
-
return executable === "node" || executable === "node.exe" || /^node\d+(\.exe)?$/.test(executable);
|
|
9377
|
-
}
|
|
9378
|
-
function looksLikePath(command) {
|
|
9379
|
-
return command.includes("/") || command.includes("\\") || /^[a-zA-Z]:/.test(command);
|
|
9380
|
-
}
|
|
9381
|
-
function resolveConfiguredNodeRuntime(configured, fileExists, which) {
|
|
9382
|
-
if (looksLikePath(configured))
|
|
9383
|
-
return fileExists(configured) ? configured : null;
|
|
9384
|
-
return which(configured);
|
|
9385
|
-
}
|
|
9386
|
-
function supportsCodegraphNodeRuntime(nodePath, env, nodeVersion) {
|
|
9387
|
-
const version = nodeVersion(nodePath);
|
|
9388
|
-
if (version === null)
|
|
9389
|
-
return false;
|
|
9390
|
-
return evaluateCodegraphNodeSupport({ env, nodeVersion: version }).supported;
|
|
9391
|
-
}
|
|
9392
|
-
function defaultNodeRuntime(env, fileExists, which, nodeVersion) {
|
|
9393
|
-
const configured = env[CODEGRAPH_NODE_BIN_ENV]?.trim();
|
|
9394
|
-
if (configured !== undefined && configured.length > 0) {
|
|
9395
|
-
const resolved = resolveConfiguredNodeRuntime(configured, fileExists, which);
|
|
9396
|
-
return resolved !== null && supportsCodegraphNodeRuntime(resolved, env, nodeVersion) ? resolved : null;
|
|
9397
|
-
}
|
|
9398
|
-
const candidates = [
|
|
9399
|
-
...isNodeExecutableName(process.execPath) ? [process.execPath] : [],
|
|
9400
|
-
...CODEGRAPH_NODE_CANDIDATES.map((commandName) => which(commandName)).filter((candidate) => candidate !== null),
|
|
9401
|
-
...CODEGRAPH_NODE_PATH_CANDIDATES.filter((candidate) => fileExists(candidate))
|
|
9402
|
-
];
|
|
9403
|
-
const seen = new Set;
|
|
9404
|
-
for (const candidate of candidates) {
|
|
9405
|
-
if (seen.has(candidate))
|
|
9406
|
-
continue;
|
|
9407
|
-
seen.add(candidate);
|
|
9408
|
-
if (supportsCodegraphNodeRuntime(candidate, env, nodeVersion))
|
|
9409
|
-
return candidate;
|
|
9410
|
-
}
|
|
9411
|
-
return null;
|
|
9412
|
-
}
|
|
9413
|
-
function resolveCodegraphNodeRuntime(options = {}) {
|
|
9414
|
-
const env = options.env ?? process.env;
|
|
9415
|
-
return defaultNodeRuntime(env, options.fileExists ?? existsSync2, options.which ?? bunWhich, options.nodeVersion ?? defaultNodeVersion);
|
|
9416
|
-
}
|
|
9417
|
-
function resolveCodegraphNodeSupport(options = {}) {
|
|
9418
|
-
const env = options.env ?? process.env;
|
|
9419
|
-
const nodeVersion = options.nodeVersion ?? defaultNodeVersion;
|
|
9420
|
-
const runtime3 = resolveCodegraphNodeRuntime({ ...options, env, nodeVersion });
|
|
9421
|
-
if (runtime3 === null) {
|
|
9422
|
-
return evaluateCodegraphNodeSupport({ env, nodeVersion: "0.0.0" });
|
|
9423
|
-
}
|
|
9424
|
-
return evaluateCodegraphNodeSupport({ env, nodeVersion: nodeVersion(runtime3) ?? "0.0.0" });
|
|
9425
|
-
}
|
|
9426
|
-
|
|
9427
|
-
// packages/omo-codex/src/install/codex-cache-mcp-manifest.ts
|
|
9428
|
-
var CODEGRAPH_RELATIVE_ARGS = new Set(["components/codegraph/dist/serve.js", "./components/codegraph/dist/serve.js"]);
|
|
9246
|
+
import { join as join8, sep as sep3 } from "node:path";
|
|
9429
9247
|
var CONTEXT7_API_KEY_ENV = "CONTEXT7_API_KEY";
|
|
9430
|
-
async function rewriteCachedMcpManifest(pluginRoot, sourceRoot = pluginRoot
|
|
9431
|
-
const manifestPath =
|
|
9248
|
+
async function rewriteCachedMcpManifest(pluginRoot, sourceRoot = pluginRoot) {
|
|
9249
|
+
const manifestPath = join8(pluginRoot, ".mcp.json");
|
|
9432
9250
|
if (!await fileExistsStrict(manifestPath))
|
|
9433
9251
|
return;
|
|
9434
9252
|
const raw = await readFile6(manifestPath, "utf8");
|
|
@@ -9451,8 +9269,6 @@ async function rewriteCachedMcpManifest(pluginRoot, sourceRoot = pluginRoot, opt
|
|
|
9451
9269
|
const bundledMcpRuntimeArg = resolveBundledMcpRuntimeArg(pluginRoot, arg);
|
|
9452
9270
|
if (bundledMcpRuntimeArg !== null)
|
|
9453
9271
|
return bundledMcpRuntimeArg;
|
|
9454
|
-
if (CODEGRAPH_RELATIVE_ARGS.has(arg))
|
|
9455
|
-
return join10(pluginRoot, "components", "codegraph", "dist", "serve.js");
|
|
9456
9272
|
if (arg.startsWith("./") || arg.startsWith("../"))
|
|
9457
9273
|
return resolveCachedRuntimePath(pluginRoot, sourceRoot, arg);
|
|
9458
9274
|
return arg;
|
|
@@ -9465,15 +9281,6 @@ async function rewriteCachedMcpManifest(pluginRoot, sourceRoot = pluginRoot, opt
|
|
|
9465
9281
|
if (serverName === "context7" && sanitizeContext7Auth(server)) {
|
|
9466
9282
|
changed = true;
|
|
9467
9283
|
}
|
|
9468
|
-
if (!Array.isArray(currentArgs))
|
|
9469
|
-
continue;
|
|
9470
|
-
if (server === parsed.mcpServers.codegraph) {
|
|
9471
|
-
const runtime3 = options.codegraphNodeRuntime?.() ?? resolveCodegraphNodeRuntime();
|
|
9472
|
-
if (runtime3 !== null && server.command === "node") {
|
|
9473
|
-
server.command = runtime3;
|
|
9474
|
-
changed = true;
|
|
9475
|
-
}
|
|
9476
|
-
}
|
|
9477
9284
|
}
|
|
9478
9285
|
if (changed)
|
|
9479
9286
|
await writeFile3(manifestPath, `${JSON.stringify(parsed, null, "\t")}
|
|
@@ -9532,7 +9339,7 @@ function isPlaceholderContext7ApiKey(value) {
|
|
|
9532
9339
|
return normalized.length === 0 || normalized === "your api key";
|
|
9533
9340
|
}
|
|
9534
9341
|
async function rewriteCachedManifestRoot(pluginRoot, fromRoot, toRoot) {
|
|
9535
|
-
const manifestPath =
|
|
9342
|
+
const manifestPath = join8(pluginRoot, ".mcp.json");
|
|
9536
9343
|
if (!await fileExistsStrict(manifestPath))
|
|
9537
9344
|
return;
|
|
9538
9345
|
const raw = await readFile6(manifestPath, "utf8");
|
|
@@ -9568,7 +9375,7 @@ async function rewriteCachedManifestRoot(pluginRoot, fromRoot, toRoot) {
|
|
|
9568
9375
|
|
|
9569
9376
|
// packages/omo-codex/src/install/codex-hook-targets.ts
|
|
9570
9377
|
import { readFile as readFile7 } from "node:fs/promises";
|
|
9571
|
-
import { join as
|
|
9378
|
+
import { join as join9, sep as sep4 } from "node:path";
|
|
9572
9379
|
var PLUGIN_ROOT_TARGET_PATTERN = /\$\{PLUGIN_ROOT\}[\\/]+([^"']+)/g;
|
|
9573
9380
|
async function findMissingHookCommandTargets(pluginRoot) {
|
|
9574
9381
|
const commands = [];
|
|
@@ -9585,7 +9392,7 @@ async function findMissingHookCommandTargets(pluginRoot) {
|
|
|
9585
9392
|
const targetSuffix = match[1];
|
|
9586
9393
|
if (targetSuffix === undefined)
|
|
9587
9394
|
continue;
|
|
9588
|
-
const target =
|
|
9395
|
+
const target = join9(pluginRoot, ...targetSuffix.split(/[\\/]+/));
|
|
9589
9396
|
if (seen.has(target))
|
|
9590
9397
|
continue;
|
|
9591
9398
|
seen.add(target);
|
|
@@ -9596,17 +9403,17 @@ async function findMissingHookCommandTargets(pluginRoot) {
|
|
|
9596
9403
|
return missing;
|
|
9597
9404
|
}
|
|
9598
9405
|
async function hookManifestPaths(pluginRoot) {
|
|
9599
|
-
const pluginManifestPath =
|
|
9406
|
+
const pluginManifestPath = join9(pluginRoot, ".codex-plugin", "plugin.json");
|
|
9600
9407
|
if (!await fileExistsStrict(pluginManifestPath))
|
|
9601
|
-
return [
|
|
9408
|
+
return [join9(pluginRoot, "hooks", "hooks.json")];
|
|
9602
9409
|
const parsed = JSON.parse(await readFile7(pluginManifestPath, "utf8"));
|
|
9603
9410
|
if (!isPlainRecord(parsed))
|
|
9604
9411
|
return [];
|
|
9605
9412
|
if (typeof parsed.hooks === "string" && parsed.hooks.trim() !== "") {
|
|
9606
|
-
return [
|
|
9413
|
+
return [join9(pluginRoot, stripDotSlash(parsed.hooks))];
|
|
9607
9414
|
}
|
|
9608
9415
|
if (Array.isArray(parsed.hooks)) {
|
|
9609
|
-
return parsed.hooks.filter((hookPath) => typeof hookPath === "string" && hookPath.trim() !== "").map((hookPath) =>
|
|
9416
|
+
return parsed.hooks.filter((hookPath) => typeof hookPath === "string" && hookPath.trim() !== "").map((hookPath) => join9(pluginRoot, stripDotSlash(hookPath)));
|
|
9610
9417
|
}
|
|
9611
9418
|
return [];
|
|
9612
9419
|
}
|
|
@@ -9644,7 +9451,7 @@ async function installCachedPlugin(input) {
|
|
|
9644
9451
|
await maybeRunNpmInstall(input.sourcePath, input.runCommand, npmInstallEnv);
|
|
9645
9452
|
await maybeRunNpmBuild(input.sourcePath, input.runCommand, env);
|
|
9646
9453
|
}
|
|
9647
|
-
const targetPath =
|
|
9454
|
+
const targetPath = join10(input.codexHome, "plugins", "cache", input.marketplaceName, input.name, input.version);
|
|
9648
9455
|
const tempPath = createTempSiblingPath(targetPath);
|
|
9649
9456
|
await rm4(tempPath, { recursive: true, force: true });
|
|
9650
9457
|
try {
|
|
@@ -9652,6 +9459,7 @@ async function installCachedPlugin(input) {
|
|
|
9652
9459
|
const rewroteLocalFileDependencies = await rewriteCachedPackageLocalFileDependencies(tempPath, input.sourcePath);
|
|
9653
9460
|
await copyBundledMcpRuntimeDists({ pluginRoot: tempPath, sourceRoot: input.sourcePath });
|
|
9654
9461
|
await copyRootRuntimeDists({ pluginRoot: tempPath, sourcePath: input.sourcePath });
|
|
9462
|
+
await copyCanonicalPromptSources({ pluginRoot: tempPath, sourcePath: input.sourcePath });
|
|
9655
9463
|
const installArgs = rewroteLocalFileDependencies ? ["install", "--omit=dev", "--no-audit", "--no-fund"] : ["ci", "--omit=dev"];
|
|
9656
9464
|
await maybeRunNpmInstall(tempPath, input.runCommand, npmInstallEnv, installArgs);
|
|
9657
9465
|
await removeCachedManagedNpmBinShims(tempPath);
|
|
@@ -9669,14 +9477,14 @@ async function installCachedPlugin(input) {
|
|
|
9669
9477
|
return { name: input.name, version: input.version, path: targetPath };
|
|
9670
9478
|
}
|
|
9671
9479
|
async function maybeRunNpmInstall(cwd, runCommand, env, args = ["install"]) {
|
|
9672
|
-
if (!await fileExistsStrict(
|
|
9480
|
+
if (!await fileExistsStrict(join10(cwd, "package.json")))
|
|
9673
9481
|
return;
|
|
9674
9482
|
await runCommand("npm", args, { cwd, env });
|
|
9675
9483
|
}
|
|
9676
9484
|
async function maybeRunNpmBuild(cwd, runCommand, env) {
|
|
9677
|
-
if (!await fileExistsStrict(
|
|
9485
|
+
if (!await fileExistsStrict(join10(cwd, "package.json")))
|
|
9678
9486
|
return;
|
|
9679
|
-
const packageJson = JSON.parse(await readFile8(
|
|
9487
|
+
const packageJson = JSON.parse(await readFile8(join10(cwd, "package.json"), "utf8"));
|
|
9680
9488
|
if (!isPlainRecord(packageJson))
|
|
9681
9489
|
return;
|
|
9682
9490
|
const scripts = packageJson.scripts;
|
|
@@ -9685,9 +9493,9 @@ async function maybeRunNpmBuild(cwd, runCommand, env) {
|
|
|
9685
9493
|
await runCommand("npm", ["run", "build"], { cwd, env });
|
|
9686
9494
|
}
|
|
9687
9495
|
async function maybeRunNpmSyncSkills(cwd, runCommand, env) {
|
|
9688
|
-
if (!await fileExistsStrict(
|
|
9496
|
+
if (!await fileExistsStrict(join10(cwd, "package.json")))
|
|
9689
9497
|
return;
|
|
9690
|
-
const packageJson = JSON.parse(await readFile8(
|
|
9498
|
+
const packageJson = JSON.parse(await readFile8(join10(cwd, "package.json"), "utf8"));
|
|
9691
9499
|
if (!isPlainRecord(packageJson))
|
|
9692
9500
|
return;
|
|
9693
9501
|
const scripts = packageJson.scripts;
|
|
@@ -9699,13 +9507,13 @@ function sanitizeNpmInstallEnv(env) {
|
|
|
9699
9507
|
return Object.fromEntries(Object.entries(env).filter(([key]) => key.toLowerCase() !== "npm_config_allow_scripts"));
|
|
9700
9508
|
}
|
|
9701
9509
|
function createTempSiblingPath(targetPath) {
|
|
9702
|
-
return
|
|
9510
|
+
return join10(dirname4(targetPath), `.tmp-${basename2(targetPath)}-${process.pid}-${Date.now()}`);
|
|
9703
9511
|
}
|
|
9704
9512
|
function createBackupSiblingPath(targetPath) {
|
|
9705
|
-
return
|
|
9513
|
+
return join10(dirname4(targetPath), `.backup-${basename2(targetPath)}-${process.pid}-${Date.now()}`);
|
|
9706
9514
|
}
|
|
9707
9515
|
async function copyDirectory(sourcePath, targetPath) {
|
|
9708
|
-
await mkdir3(
|
|
9516
|
+
await mkdir3(dirname4(targetPath), { recursive: true });
|
|
9709
9517
|
await cp2(sourcePath, targetPath, { recursive: true, filter: (source) => shouldCopyPluginPath(source, sourcePath) });
|
|
9710
9518
|
}
|
|
9711
9519
|
async function promoteDirectory(tempPath, targetPath, renameDirectory) {
|
|
@@ -9750,18 +9558,18 @@ var removedSparkshellPromptSurfaceFiles = new Set(["directive.md", "plugin.json"
|
|
|
9750
9558
|
var removedSparkshellTextFilePattern = /\.(?:json|md|toml|ya?ml)$/i;
|
|
9751
9559
|
async function assertNoRemovedSparkshellPromptReferences(pluginRoot) {
|
|
9752
9560
|
for (const filePath of await listRemovedSparkshellPromptSurfaceFiles(pluginRoot, "")) {
|
|
9753
|
-
const content = await readFile8(
|
|
9561
|
+
const content = await readFile8(join10(pluginRoot, filePath), "utf8");
|
|
9754
9562
|
if (!removedSparkshellReferencePattern.test(content))
|
|
9755
9563
|
continue;
|
|
9756
9564
|
throw new Error(`removed sparkshell reference found in Codex plugin prompt surface: ${filePath}`);
|
|
9757
9565
|
}
|
|
9758
9566
|
}
|
|
9759
9567
|
async function listRemovedSparkshellPromptSurfaceFiles(pluginRoot, relativeDirectory) {
|
|
9760
|
-
const directory = relativeDirectory === "" ? pluginRoot :
|
|
9568
|
+
const directory = relativeDirectory === "" ? pluginRoot : join10(pluginRoot, relativeDirectory);
|
|
9761
9569
|
const entries = await readdir4(directory, { withFileTypes: true });
|
|
9762
9570
|
const files = [];
|
|
9763
9571
|
for (const entry of entries) {
|
|
9764
|
-
const relativePath = relativeDirectory === "" ? entry.name :
|
|
9572
|
+
const relativePath = relativeDirectory === "" ? entry.name : join10(relativeDirectory, entry.name);
|
|
9765
9573
|
if (entry.isDirectory()) {
|
|
9766
9574
|
if (shouldDescendIntoRemovedSparkshellPromptSurface(relativePath)) {
|
|
9767
9575
|
files.push(...await listRemovedSparkshellPromptSurfaceFiles(pluginRoot, relativePath));
|
|
@@ -9801,29 +9609,43 @@ async function copyRootRuntimeDists(input) {
|
|
|
9801
9609
|
if (repoRoot === null)
|
|
9802
9610
|
return;
|
|
9803
9611
|
for (const runtimePath of ["dist/cli", "dist/cli-node"]) {
|
|
9804
|
-
const sourcePath =
|
|
9805
|
-
if (!await fileExistsStrict(
|
|
9612
|
+
const sourcePath = join10(repoRoot, runtimePath);
|
|
9613
|
+
if (!await fileExistsStrict(join10(sourcePath, "index.js")))
|
|
9614
|
+
continue;
|
|
9615
|
+
await mkdir3(dirname4(join10(input.pluginRoot, runtimePath)), { recursive: true });
|
|
9616
|
+
await cp2(sourcePath, join10(input.pluginRoot, runtimePath), { recursive: true });
|
|
9617
|
+
}
|
|
9618
|
+
}
|
|
9619
|
+
var canonicalPromptRelativePaths = [join10("packages", "prompts-core", "prompts", "ultrawork", "codex.md")];
|
|
9620
|
+
async function copyCanonicalPromptSources(input) {
|
|
9621
|
+
const repoRoot = repoRootForCodexPluginSource(input.sourcePath);
|
|
9622
|
+
if (repoRoot === null)
|
|
9623
|
+
return;
|
|
9624
|
+
for (const relativePath of canonicalPromptRelativePaths) {
|
|
9625
|
+
const sourceFile = join10(repoRoot, relativePath);
|
|
9626
|
+
if (!await fileExistsStrict(sourceFile))
|
|
9806
9627
|
continue;
|
|
9807
|
-
|
|
9808
|
-
await
|
|
9628
|
+
const targetFile = join10(input.pluginRoot, relativePath);
|
|
9629
|
+
await mkdir3(dirname4(targetFile), { recursive: true });
|
|
9630
|
+
await cp2(sourceFile, targetFile);
|
|
9809
9631
|
}
|
|
9810
9632
|
}
|
|
9811
9633
|
function repoRootForCodexPluginSource(sourcePath) {
|
|
9812
|
-
const codexPackageRoot =
|
|
9813
|
-
const packagesRoot =
|
|
9814
|
-
if (
|
|
9634
|
+
const codexPackageRoot = dirname4(sourcePath);
|
|
9635
|
+
const packagesRoot = dirname4(codexPackageRoot);
|
|
9636
|
+
if (basename2(sourcePath) !== "plugin")
|
|
9815
9637
|
return null;
|
|
9816
|
-
if (
|
|
9638
|
+
if (basename2(codexPackageRoot) !== "omo-codex")
|
|
9817
9639
|
return null;
|
|
9818
|
-
if (
|
|
9640
|
+
if (basename2(packagesRoot) !== "packages")
|
|
9819
9641
|
return null;
|
|
9820
|
-
return
|
|
9642
|
+
return dirname4(packagesRoot);
|
|
9821
9643
|
}
|
|
9822
9644
|
// packages/omo-codex/src/install/codex-cache-prune.ts
|
|
9823
9645
|
import { lstat as lstat5, readdir as readdir5, rm as rm5, stat as stat4 } from "node:fs/promises";
|
|
9824
|
-
import { join as
|
|
9646
|
+
import { join as join11 } from "node:path";
|
|
9825
9647
|
async function pruneMarketplaceCache(input) {
|
|
9826
|
-
const cacheRoot =
|
|
9648
|
+
const cacheRoot = join11(input.codexHome, "plugins", "cache", input.marketplaceName);
|
|
9827
9649
|
if (!await fileExistsStrict(cacheRoot))
|
|
9828
9650
|
return;
|
|
9829
9651
|
const keep = new Set(input.keepPluginNames);
|
|
@@ -9831,15 +9653,15 @@ async function pruneMarketplaceCache(input) {
|
|
|
9831
9653
|
for (const entry of entries) {
|
|
9832
9654
|
if (!entry.isDirectory() || keep.has(entry.name))
|
|
9833
9655
|
continue;
|
|
9834
|
-
await rm5(
|
|
9656
|
+
await rm5(join11(cacheRoot, entry.name), { recursive: true, force: true });
|
|
9835
9657
|
}
|
|
9836
9658
|
}
|
|
9837
9659
|
async function pruneMarketplacePluginCaches(input) {
|
|
9838
|
-
const cacheRoot =
|
|
9660
|
+
const cacheRoot = join11(input.codexHome, "plugins", "cache", input.marketplaceName);
|
|
9839
9661
|
if (!await fileExistsStrict(cacheRoot))
|
|
9840
9662
|
return;
|
|
9841
9663
|
for (const pluginName of input.pluginNames) {
|
|
9842
|
-
await rm5(
|
|
9664
|
+
await rm5(join11(cacheRoot, pluginName), { recursive: true, force: true });
|
|
9843
9665
|
}
|
|
9844
9666
|
const remainingEntries = await readCacheEntryNames(cacheRoot);
|
|
9845
9667
|
if (remainingEntries.length === 0) {
|
|
@@ -9886,17 +9708,17 @@ async function isBrokenCacheSymlink(path) {
|
|
|
9886
9708
|
}
|
|
9887
9709
|
// packages/omo-codex/src/install/codex-cached-marketplace-manifest.ts
|
|
9888
9710
|
import { mkdir as mkdir4, rename as rename2, rm as rm6, stat as stat5, writeFile as writeFile4 } from "node:fs/promises";
|
|
9889
|
-
import { join as
|
|
9711
|
+
import { join as join12 } from "node:path";
|
|
9890
9712
|
async function writeCachedMarketplaceManifest(input) {
|
|
9891
|
-
const marketplaceDir =
|
|
9713
|
+
const marketplaceDir = join12(input.marketplaceRoot, ".agents", "plugins");
|
|
9892
9714
|
await mkdir4(marketplaceDir, { recursive: true });
|
|
9893
9715
|
for (const plugin of input.plugins) {
|
|
9894
|
-
const pluginPath =
|
|
9716
|
+
const pluginPath = join12(input.marketplaceRoot, plugin.name, plugin.version);
|
|
9895
9717
|
if (!await isDirectory2(pluginPath))
|
|
9896
9718
|
throw new Error(`Cannot write cached marketplace manifest: ${pluginPath} does not exist`);
|
|
9897
9719
|
}
|
|
9898
|
-
const manifestPath =
|
|
9899
|
-
const tempPath =
|
|
9720
|
+
const manifestPath = join12(marketplaceDir, "marketplace.json");
|
|
9721
|
+
const tempPath = join12(marketplaceDir, `.marketplace.json.tmp-${process.pid}-${Date.now()}`);
|
|
9900
9722
|
try {
|
|
9901
9723
|
await writeFile4(tempPath, `${JSON.stringify({
|
|
9902
9724
|
name: input.marketplaceName,
|
|
@@ -9923,9 +9745,9 @@ async function isDirectory2(path) {
|
|
|
9923
9745
|
}
|
|
9924
9746
|
|
|
9925
9747
|
// packages/omo-codex/src/install/codex-package-layout.ts
|
|
9926
|
-
import { existsSync as
|
|
9748
|
+
import { existsSync as existsSync2 } from "node:fs";
|
|
9927
9749
|
import { readFile as readFile9 } from "node:fs/promises";
|
|
9928
|
-
import { join as
|
|
9750
|
+
import { join as join13 } from "node:path";
|
|
9929
9751
|
var PACKAGED_CODEX_INSTALLER_NAMES = new Set([
|
|
9930
9752
|
"@code-yeongyu/lazycodex",
|
|
9931
9753
|
"@code-yeongyu/lazycodex-ai",
|
|
@@ -9935,10 +9757,10 @@ var PACKAGED_CODEX_INSTALLER_NAMES = new Set([
|
|
|
9935
9757
|
"oh-my-openagent"
|
|
9936
9758
|
]);
|
|
9937
9759
|
async function shouldBuildSourcePackages(repoRoot) {
|
|
9938
|
-
if (
|
|
9760
|
+
if (existsSync2(join13(repoRoot, "packages", "omo-opencode", "src", "index.ts")))
|
|
9939
9761
|
return true;
|
|
9940
|
-
const packageJsonPath =
|
|
9941
|
-
if (!
|
|
9762
|
+
const packageJsonPath = join13(repoRoot, "package.json");
|
|
9763
|
+
if (!existsSync2(packageJsonPath))
|
|
9942
9764
|
return true;
|
|
9943
9765
|
const packageJson = JSON.parse(await readFile9(packageJsonPath, "utf8"));
|
|
9944
9766
|
if (!isPlainRecord(packageJson) || typeof packageJson.name !== "string")
|
|
@@ -9948,7 +9770,7 @@ async function shouldBuildSourcePackages(repoRoot) {
|
|
|
9948
9770
|
|
|
9949
9771
|
// packages/omo-codex/src/install/codex-config-toml.ts
|
|
9950
9772
|
import { mkdir as mkdir5, readFile as readFile11 } from "node:fs/promises";
|
|
9951
|
-
import { dirname as
|
|
9773
|
+
import { dirname as dirname7 } from "node:path";
|
|
9952
9774
|
|
|
9953
9775
|
// packages/omo-codex/src/install/toml-section-editor.ts
|
|
9954
9776
|
function findTomlSection(config, header) {
|
|
@@ -10163,10 +9985,10 @@ function scanTomlMultilineLine(line, currentQuote) {
|
|
|
10163
9985
|
}
|
|
10164
9986
|
if (char === "#")
|
|
10165
9987
|
break;
|
|
10166
|
-
const
|
|
10167
|
-
if (
|
|
10168
|
-
const closingIndex = findTomlMultilineDelimiter(line,
|
|
10169
|
-
return { wasInside: false, nextQuote: closingIndex === -1 ?
|
|
9988
|
+
const delimiter = line.startsWith('"""', index) ? '"""' : line.startsWith("'''", index) ? "'''" : null;
|
|
9989
|
+
if (delimiter) {
|
|
9990
|
+
const closingIndex = findTomlMultilineDelimiter(line, delimiter, index + delimiter.length);
|
|
9991
|
+
return { wasInside: false, nextQuote: closingIndex === -1 ? delimiter : null };
|
|
10170
9992
|
}
|
|
10171
9993
|
if (char === '"' || char === "'")
|
|
10172
9994
|
quote = char;
|
|
@@ -10174,12 +9996,12 @@ function scanTomlMultilineLine(line, currentQuote) {
|
|
|
10174
9996
|
}
|
|
10175
9997
|
return { wasInside: false, nextQuote: null };
|
|
10176
9998
|
}
|
|
10177
|
-
function findTomlMultilineDelimiter(line,
|
|
10178
|
-
let index = line.indexOf(
|
|
9999
|
+
function findTomlMultilineDelimiter(line, delimiter, startIndex) {
|
|
10000
|
+
let index = line.indexOf(delimiter, startIndex);
|
|
10179
10001
|
while (index !== -1) {
|
|
10180
|
-
if (
|
|
10002
|
+
if (delimiter === "'''" || countPrecedingBackslashes(line, index) % 2 === 0)
|
|
10181
10003
|
return index;
|
|
10182
|
-
index = line.indexOf(
|
|
10004
|
+
index = line.indexOf(delimiter, index + 1);
|
|
10183
10005
|
}
|
|
10184
10006
|
return -1;
|
|
10185
10007
|
}
|
|
@@ -10530,12 +10352,12 @@ function tomlKeySegment(value) {
|
|
|
10530
10352
|
|
|
10531
10353
|
// packages/omo-codex/src/install/codex-config-atomic-write.ts
|
|
10532
10354
|
import { lstat as lstat6, readlink as readlink4, realpath, rename as rename3, unlink, writeFile as writeFile5 } from "node:fs/promises";
|
|
10533
|
-
import { basename as
|
|
10355
|
+
import { basename as basename3, dirname as dirname5, isAbsolute as isAbsolute5, join as join14, resolve as resolve6 } from "node:path";
|
|
10534
10356
|
var RENAME_RETRY_DELAYS_MS = [10, 25, 50];
|
|
10535
10357
|
var RETRIABLE_RENAME_CODES = new Set(["EPERM", "EBUSY"]);
|
|
10536
10358
|
async function writeFileAtomic(targetPath, data) {
|
|
10537
10359
|
const writeTarget = await resolveSymlinkTarget(targetPath);
|
|
10538
|
-
const temporaryPath =
|
|
10360
|
+
const temporaryPath = join14(dirname5(writeTarget), `.tmp-${basename3(writeTarget)}-${process.pid}-${Date.now()}`);
|
|
10539
10361
|
await writeFile5(temporaryPath, data);
|
|
10540
10362
|
try {
|
|
10541
10363
|
await renameWithRetry(temporaryPath, writeTarget);
|
|
@@ -10564,7 +10386,7 @@ async function resolveSymlinkTarget(targetPath) {
|
|
|
10564
10386
|
if (!(error instanceof Error))
|
|
10565
10387
|
throw error;
|
|
10566
10388
|
const linkValue = await readlink4(targetPath);
|
|
10567
|
-
return isAbsolute5(linkValue) ? linkValue : resolve6(
|
|
10389
|
+
return isAbsolute5(linkValue) ? linkValue : resolve6(dirname5(targetPath), linkValue);
|
|
10568
10390
|
}
|
|
10569
10391
|
}
|
|
10570
10392
|
async function renameWithRetry(fromPath, toPath) {
|
|
@@ -10824,11 +10646,9 @@ enabled = true
|
|
|
10824
10646
|
function ensureOmoBuiltinMcpPolicies(config, input) {
|
|
10825
10647
|
if (input.marketplaceName !== "sisyphuslabs" || !input.pluginNames.includes("omo"))
|
|
10826
10648
|
return config;
|
|
10827
|
-
const codegraphEnabled = input.codegraphMcpEnabled ?? true;
|
|
10828
10649
|
const gitBashEnabled = (input.platform ?? process.platform) === "win32" && input.gitBashEnabled === true;
|
|
10829
10650
|
let nextConfig = removeStaleContext7PlaceholderMcp(config);
|
|
10830
10651
|
nextConfig = ensurePluginMcpEnabled(nextConfig, "omo@sisyphuslabs", "context7", true);
|
|
10831
|
-
nextConfig = ensurePluginMcpEnabled(nextConfig, "omo@sisyphuslabs", "codegraph", codegraphEnabled);
|
|
10832
10652
|
nextConfig = ensurePluginMcpEnabled(nextConfig, "omo@sisyphuslabs", "git_bash", gitBashEnabled);
|
|
10833
10653
|
return nextConfig;
|
|
10834
10654
|
}
|
|
@@ -11040,7 +10860,7 @@ function isRootSetting(line, key) {
|
|
|
11040
10860
|
|
|
11041
10861
|
// packages/omo-codex/src/install/codex-model-catalog.ts
|
|
11042
10862
|
import { readFile as readFile10 } from "node:fs/promises";
|
|
11043
|
-
import { join as
|
|
10863
|
+
import { join as join15 } from "node:path";
|
|
11044
10864
|
var FALLBACK_CODEX_MODEL_CATALOG = {
|
|
11045
10865
|
current: {
|
|
11046
10866
|
model: "gpt-5.6-sol",
|
|
@@ -11065,7 +10885,7 @@ var FALLBACK_CODEX_MODEL_CATALOG = {
|
|
|
11065
10885
|
]
|
|
11066
10886
|
};
|
|
11067
10887
|
async function readCodexModelCatalog(codexPackageRoot) {
|
|
11068
|
-
const catalogPath =
|
|
10888
|
+
const catalogPath = join15(codexPackageRoot, "plugin", "model-catalog.json");
|
|
11069
10889
|
try {
|
|
11070
10890
|
const parsed = JSON.parse(await readFile10(catalogPath, "utf8"));
|
|
11071
10891
|
return parseCodexModelCatalog(parsed) ?? FALLBACK_CODEX_MODEL_CATALOG;
|
|
@@ -11149,7 +10969,7 @@ function isRootSetting2(line, key) {
|
|
|
11149
10969
|
|
|
11150
10970
|
// packages/omo-codex/src/install/codex-multi-agent-v2-config.ts
|
|
11151
10971
|
import { readFileSync } from "node:fs";
|
|
11152
|
-
import { dirname as
|
|
10972
|
+
import { dirname as dirname6, isAbsolute as isAbsolute6, join as join16 } from "node:path";
|
|
11153
10973
|
var CODEX_AGENTS_HEADER = "agents";
|
|
11154
10974
|
var CODEX_MULTI_AGENT_V2_HEADER = "features.multi_agent_v2";
|
|
11155
10975
|
var CODEX_MULTI_AGENT_V2_THREAD_LIMIT_KEY = `${CODEX_MULTI_AGENT_V2_HEADER}.max_concurrent_threads_per_session`;
|
|
@@ -11186,8 +11006,8 @@ function resolveCodexMultiAgentVersion(config, configPath) {
|
|
|
11186
11006
|
}
|
|
11187
11007
|
function resolveCatalogPath(configuredPath, configPath) {
|
|
11188
11008
|
if (configuredPath === null)
|
|
11189
|
-
return
|
|
11190
|
-
return isAbsolute6(configuredPath) ? configuredPath :
|
|
11009
|
+
return join16(dirname6(configPath), "models_cache.json");
|
|
11010
|
+
return isAbsolute6(configuredPath) ? configuredPath : join16(dirname6(configPath), configuredPath);
|
|
11191
11011
|
}
|
|
11192
11012
|
function readCatalogMultiAgentVersion(model, cachePath) {
|
|
11193
11013
|
let raw;
|
|
@@ -11291,7 +11111,7 @@ function readBooleanSetting(sectionText, key) {
|
|
|
11291
11111
|
|
|
11292
11112
|
// packages/omo-codex/src/install/codex-config-toml.ts
|
|
11293
11113
|
async function updateCodexConfig(input) {
|
|
11294
|
-
await mkdir5(
|
|
11114
|
+
await mkdir5(dirname7(input.configPath), { recursive: true });
|
|
11295
11115
|
let config;
|
|
11296
11116
|
try {
|
|
11297
11117
|
config = await readFile11(input.configPath, "utf8");
|
|
@@ -11342,7 +11162,7 @@ function isMissingFileError(error) {
|
|
|
11342
11162
|
// packages/omo-codex/src/install/codex-hook-trust.ts
|
|
11343
11163
|
import { createHash } from "node:crypto";
|
|
11344
11164
|
import { readFile as readFile12 } from "node:fs/promises";
|
|
11345
|
-
import { join as
|
|
11165
|
+
import { join as join17 } from "node:path";
|
|
11346
11166
|
var EVENT_LABELS = new Map([
|
|
11347
11167
|
["PreToolUse", "pre_tool_use"],
|
|
11348
11168
|
["PermissionRequest", "permission_request"],
|
|
@@ -11356,7 +11176,7 @@ var EVENT_LABELS = new Map([
|
|
|
11356
11176
|
["Stop", "stop"]
|
|
11357
11177
|
]);
|
|
11358
11178
|
async function trustedHookStatesForPlugin(input) {
|
|
11359
|
-
const manifestPath =
|
|
11179
|
+
const manifestPath = join17(input.pluginRoot, ".codex-plugin", "plugin.json");
|
|
11360
11180
|
if (!await exists(manifestPath))
|
|
11361
11181
|
return [];
|
|
11362
11182
|
const manifest = JSON.parse(await readFile12(manifestPath, "utf8"));
|
|
@@ -11364,7 +11184,7 @@ async function trustedHookStatesForPlugin(input) {
|
|
|
11364
11184
|
return [];
|
|
11365
11185
|
const states = [];
|
|
11366
11186
|
for (const hookPath of hookManifestPaths2(manifest.hooks)) {
|
|
11367
|
-
const hooksPath =
|
|
11187
|
+
const hooksPath = join17(input.pluginRoot, hookPath);
|
|
11368
11188
|
if (!await exists(hooksPath))
|
|
11369
11189
|
continue;
|
|
11370
11190
|
const parsed = JSON.parse(await readFile12(hooksPath, "utf8"));
|
|
@@ -11490,11 +11310,11 @@ function toCodexResolution(resolution) {
|
|
|
11490
11310
|
|
|
11491
11311
|
// packages/omo-codex/src/install/link-cached-plugin-agents.ts
|
|
11492
11312
|
import { copyFile, lstat as lstat9, mkdir as mkdir6, readdir as readdir7, rm as rm8, writeFile as writeFile7 } from "node:fs/promises";
|
|
11493
|
-
import { basename as
|
|
11313
|
+
import { basename as basename4, join as join20 } from "node:path";
|
|
11494
11314
|
|
|
11495
11315
|
// packages/omo-codex/src/install/preserved-agent-settings.ts
|
|
11496
11316
|
import { lstat as lstat7, readFile as readFile13, readdir as readdir6, writeFile as writeFile6 } from "node:fs/promises";
|
|
11497
|
-
import { join as
|
|
11317
|
+
import { join as join18 } from "node:path";
|
|
11498
11318
|
|
|
11499
11319
|
// packages/omo-codex/src/install/managed-agent-reasoning-defaults.ts
|
|
11500
11320
|
var MANAGED_REASONING_DEFAULT_UPGRADES = new Map([
|
|
@@ -11629,7 +11449,7 @@ function resolveManagedAgentReasoning(input) {
|
|
|
11629
11449
|
|
|
11630
11450
|
// packages/omo-codex/src/install/preserved-agent-settings.ts
|
|
11631
11451
|
async function capturePreservedAgentReasoning(input) {
|
|
11632
|
-
const agentsDir =
|
|
11452
|
+
const agentsDir = join18(input.codexHome, "agents");
|
|
11633
11453
|
if (!await exists2(agentsDir))
|
|
11634
11454
|
return new Map;
|
|
11635
11455
|
const preserved = new Map;
|
|
@@ -11637,7 +11457,7 @@ async function capturePreservedAgentReasoning(input) {
|
|
|
11637
11457
|
for (const entry of agentEntries) {
|
|
11638
11458
|
if (!entry.name.endsWith(".toml"))
|
|
11639
11459
|
continue;
|
|
11640
|
-
const content = await readTextIfExists(
|
|
11460
|
+
const content = await readTextIfExists(join18(agentsDir, entry.name));
|
|
11641
11461
|
if (content === null)
|
|
11642
11462
|
continue;
|
|
11643
11463
|
const effort = extractReasoningEffort(content);
|
|
@@ -11651,7 +11471,7 @@ async function capturePreservedAgentReasoning(input) {
|
|
|
11651
11471
|
return preserved;
|
|
11652
11472
|
}
|
|
11653
11473
|
async function capturePreservedAgentServiceTier(input) {
|
|
11654
|
-
const agentsDir =
|
|
11474
|
+
const agentsDir = join18(input.codexHome, "agents");
|
|
11655
11475
|
if (!await exists2(agentsDir))
|
|
11656
11476
|
return new Map;
|
|
11657
11477
|
const preserved = new Map;
|
|
@@ -11659,7 +11479,7 @@ async function capturePreservedAgentServiceTier(input) {
|
|
|
11659
11479
|
for (const entry of agentEntries) {
|
|
11660
11480
|
if (!entry.name.endsWith(".toml"))
|
|
11661
11481
|
continue;
|
|
11662
|
-
const content = await readTextIfExists(
|
|
11482
|
+
const content = await readTextIfExists(join18(agentsDir, entry.name));
|
|
11663
11483
|
if (content === null)
|
|
11664
11484
|
continue;
|
|
11665
11485
|
preserved.set(agentNameFromToml(entry.name), extractServiceTier(content));
|
|
@@ -11793,7 +11613,7 @@ function nodeErrorCode(error) {
|
|
|
11793
11613
|
|
|
11794
11614
|
// packages/omo-codex/src/install/retired-managed-agent-purge.ts
|
|
11795
11615
|
import { lstat as lstat8, readFile as readFile14, rm as rm7 } from "node:fs/promises";
|
|
11796
|
-
import { join as
|
|
11616
|
+
import { join as join19 } from "node:path";
|
|
11797
11617
|
var RETIRED_MANAGED_AGENT_FILES = [
|
|
11798
11618
|
{
|
|
11799
11619
|
fileName: "codex-ultrawork-reviewer.toml",
|
|
@@ -11805,11 +11625,11 @@ var RETIRED_MANAGED_AGENT_FILES = [
|
|
|
11805
11625
|
}
|
|
11806
11626
|
];
|
|
11807
11627
|
async function purgeRetiredManagedAgentFiles(input) {
|
|
11808
|
-
const agentsDir =
|
|
11628
|
+
const agentsDir = join19(input.codexHome, "agents");
|
|
11809
11629
|
if (!await exists3(agentsDir))
|
|
11810
11630
|
return;
|
|
11811
11631
|
for (const retiredAgent of RETIRED_MANAGED_AGENT_FILES) {
|
|
11812
|
-
const agentPath =
|
|
11632
|
+
const agentPath = join19(agentsDir, retiredAgent.fileName);
|
|
11813
11633
|
if (!await exists3(agentPath))
|
|
11814
11634
|
continue;
|
|
11815
11635
|
const agentStat = await lstat8(agentPath);
|
|
@@ -11858,13 +11678,13 @@ async function linkCachedPluginAgents(input) {
|
|
|
11858
11678
|
await writeManifest(input.pluginRoot, []);
|
|
11859
11679
|
return [];
|
|
11860
11680
|
}
|
|
11861
|
-
const agentsDir =
|
|
11681
|
+
const agentsDir = join20(input.codexHome, "agents");
|
|
11862
11682
|
await mkdir6(agentsDir, { recursive: true });
|
|
11863
11683
|
const linked = [];
|
|
11864
11684
|
for (const agentPath of bundledAgents) {
|
|
11865
|
-
const agentFileName =
|
|
11685
|
+
const agentFileName = basename4(agentPath);
|
|
11866
11686
|
const agentName = agentNameFromToml2(agentFileName);
|
|
11867
|
-
const linkPath =
|
|
11687
|
+
const linkPath = join20(agentsDir, agentFileName);
|
|
11868
11688
|
await replaceWithCopy(linkPath, agentPath);
|
|
11869
11689
|
await restorePreservedReasoning({
|
|
11870
11690
|
agentName,
|
|
@@ -11883,7 +11703,7 @@ async function linkCachedPluginAgents(input) {
|
|
|
11883
11703
|
return linked;
|
|
11884
11704
|
}
|
|
11885
11705
|
async function discoverBundledAgents(pluginRoot) {
|
|
11886
|
-
const componentsRoot =
|
|
11706
|
+
const componentsRoot = join20(pluginRoot, "components");
|
|
11887
11707
|
if (!await exists4(componentsRoot))
|
|
11888
11708
|
return [];
|
|
11889
11709
|
const componentEntries = await readdir7(componentsRoot, { withFileTypes: true });
|
|
@@ -11891,14 +11711,14 @@ async function discoverBundledAgents(pluginRoot) {
|
|
|
11891
11711
|
for (const entry of componentEntries) {
|
|
11892
11712
|
if (!entry.isDirectory())
|
|
11893
11713
|
continue;
|
|
11894
|
-
const agentsRoot =
|
|
11714
|
+
const agentsRoot = join20(componentsRoot, entry.name, "agents");
|
|
11895
11715
|
if (!await exists4(agentsRoot))
|
|
11896
11716
|
continue;
|
|
11897
11717
|
const agentEntries = await readdir7(agentsRoot, { withFileTypes: true });
|
|
11898
11718
|
for (const file of agentEntries) {
|
|
11899
11719
|
if (!file.isFile() || !file.name.endsWith(".toml"))
|
|
11900
11720
|
continue;
|
|
11901
|
-
agents.push(
|
|
11721
|
+
agents.push(join20(agentsRoot, file.name));
|
|
11902
11722
|
}
|
|
11903
11723
|
}
|
|
11904
11724
|
agents.sort();
|
|
@@ -11918,7 +11738,7 @@ async function prepareReplacement(linkPath) {
|
|
|
11918
11738
|
await rm8(linkPath, { force: true });
|
|
11919
11739
|
}
|
|
11920
11740
|
async function writeManifest(pluginRoot, agentPaths) {
|
|
11921
|
-
const manifestPath =
|
|
11741
|
+
const manifestPath = join20(pluginRoot, MANIFEST_FILE);
|
|
11922
11742
|
const payload = { agents: [...agentPaths].sort() };
|
|
11923
11743
|
await writeFile7(manifestPath, `${JSON.stringify(payload, null, "\t")}
|
|
11924
11744
|
`);
|
|
@@ -11944,10 +11764,10 @@ function nodeErrorCode3(error) {
|
|
|
11944
11764
|
|
|
11945
11765
|
// packages/omo-codex/src/install/codex-marketplace.ts
|
|
11946
11766
|
import { readFile as readFile15 } from "node:fs/promises";
|
|
11947
|
-
import { join as
|
|
11767
|
+
import { join as join21 } from "node:path";
|
|
11948
11768
|
var DEFAULT_MARKETPLACE_PATH = "packages/omo-codex/marketplace.json";
|
|
11949
11769
|
async function readMarketplace(repoRoot, options) {
|
|
11950
|
-
const marketplacePath = options?.marketplacePath ??
|
|
11770
|
+
const marketplacePath = options?.marketplacePath ?? join21(repoRoot, DEFAULT_MARKETPLACE_PATH);
|
|
11951
11771
|
const raw = await readFile15(marketplacePath, "utf8");
|
|
11952
11772
|
const parsed = JSON.parse(raw);
|
|
11953
11773
|
if (!isPlainRecord(parsed))
|
|
@@ -11966,10 +11786,10 @@ async function readMarketplace(repoRoot, options) {
|
|
|
11966
11786
|
function resolvePluginSource(repoRoot, plugin, options) {
|
|
11967
11787
|
const sourcePath = localSourcePath(options?.pathOverride ?? plugin.source);
|
|
11968
11788
|
const relativePath = sourcePath.slice(2);
|
|
11969
|
-
return
|
|
11789
|
+
return join21(repoRoot, ...relativePath.split(/[\\/]/));
|
|
11970
11790
|
}
|
|
11971
11791
|
async function readPluginManifest(pluginRoot) {
|
|
11972
|
-
const raw = await readFile15(
|
|
11792
|
+
const raw = await readFile15(join21(pluginRoot, ".codex-plugin", "plugin.json"), "utf8");
|
|
11973
11793
|
const parsed = JSON.parse(raw);
|
|
11974
11794
|
if (!isPlainRecord(parsed))
|
|
11975
11795
|
throw new Error(`${pluginRoot} plugin.json must be an object`);
|
|
@@ -12051,7 +11871,7 @@ function validateLocalSourcePath(path) {
|
|
|
12051
11871
|
|
|
12052
11872
|
// packages/omo-codex/src/install/codex-marketplace-snapshot.ts
|
|
12053
11873
|
import { cp as cp3, mkdir as mkdir7, rename as rename4, rm as rm9, writeFile as writeFile8 } from "node:fs/promises";
|
|
12054
|
-
import { join as
|
|
11874
|
+
import { join as join22, sep as sep6 } from "node:path";
|
|
12055
11875
|
var INSTALLED_MARKETPLACES_DIR = ".tmp/marketplaces";
|
|
12056
11876
|
async function writeInstalledMarketplaceSnapshot(input) {
|
|
12057
11877
|
const marketplaceRoot = installedMarketplaceRoot(input.codexHome, input.marketplace.name);
|
|
@@ -12064,21 +11884,21 @@ async function writeInstalledMarketplaceSnapshot(input) {
|
|
|
12064
11884
|
return snapshotPlugins;
|
|
12065
11885
|
}
|
|
12066
11886
|
function installedMarketplaceRoot(codexHome, marketplaceName) {
|
|
12067
|
-
return
|
|
11887
|
+
return join22(codexHome, INSTALLED_MARKETPLACES_DIR, marketplaceName);
|
|
12068
11888
|
}
|
|
12069
11889
|
async function writeMarketplaceManifest(marketplaceRoot, marketplace) {
|
|
12070
|
-
const manifestDir =
|
|
11890
|
+
const manifestDir = join22(marketplaceRoot, ".agents", "plugins");
|
|
12071
11891
|
await mkdir7(manifestDir, { recursive: true });
|
|
12072
|
-
const tempPath =
|
|
11892
|
+
const tempPath = join22(manifestDir, `.marketplace-${process.pid}-${Date.now()}.json.tmp`);
|
|
12073
11893
|
await writeFile8(tempPath, `${JSON.stringify(marketplace, null, "\t")}
|
|
12074
11894
|
`);
|
|
12075
|
-
await rename4(tempPath,
|
|
11895
|
+
await rename4(tempPath, join22(manifestDir, "marketplace.json"));
|
|
12076
11896
|
}
|
|
12077
11897
|
async function writeSnapshotPlugin(marketplaceRoot, plugin) {
|
|
12078
|
-
const pluginsDir =
|
|
11898
|
+
const pluginsDir = join22(marketplaceRoot, "plugins");
|
|
12079
11899
|
await mkdir7(pluginsDir, { recursive: true });
|
|
12080
|
-
const targetPath =
|
|
12081
|
-
const tempPath =
|
|
11900
|
+
const targetPath = join22(pluginsDir, plugin.name);
|
|
11901
|
+
const tempPath = join22(pluginsDir, `.tmp-${plugin.name}-${process.pid}-${Date.now()}`);
|
|
12082
11902
|
await rm9(tempPath, { recursive: true, force: true });
|
|
12083
11903
|
await cp3(plugin.sourcePath, tempPath, {
|
|
12084
11904
|
recursive: true,
|
|
@@ -12100,10 +11920,10 @@ function shouldCopyMarketplaceSourcePath(path, root) {
|
|
|
12100
11920
|
|
|
12101
11921
|
// packages/omo-codex/src/install/lazycodex-version-stamp.ts
|
|
12102
11922
|
import { readdir as readdir8, readFile as readFile16, writeFile as writeFile9 } from "node:fs/promises";
|
|
12103
|
-
import { join as
|
|
11923
|
+
import { join as join23 } from "node:path";
|
|
12104
11924
|
async function readDistributionManifest(repoRoot) {
|
|
12105
11925
|
try {
|
|
12106
|
-
const parsed = JSON.parse(await readFile16(
|
|
11926
|
+
const parsed = JSON.parse(await readFile16(join23(repoRoot, "package.json"), "utf8"));
|
|
12107
11927
|
if (!isPlainRecord(parsed) || typeof parsed.version !== "string" || parsed.version.trim().length === 0)
|
|
12108
11928
|
return;
|
|
12109
11929
|
return {
|
|
@@ -12127,19 +11947,19 @@ function resolveLazyCodexPluginVersion(input) {
|
|
|
12127
11947
|
return input.manifestVersion ?? "local";
|
|
12128
11948
|
}
|
|
12129
11949
|
async function stampLazyCodexPluginVersion(input) {
|
|
12130
|
-
const manifestPath =
|
|
11950
|
+
const manifestPath = join23(input.pluginRoot, ".codex-plugin", "plugin.json");
|
|
12131
11951
|
const hookPaths = await readPluginHookPaths(manifestPath);
|
|
12132
11952
|
await stampJsonVersion(manifestPath, input.version);
|
|
12133
|
-
await stampJsonVersion(
|
|
11953
|
+
await stampJsonVersion(join23(input.pluginRoot, "package.json"), input.version);
|
|
12134
11954
|
for (const hookPath of hookPaths) {
|
|
12135
|
-
await stampHookStatusMessages(
|
|
11955
|
+
await stampHookStatusMessages(join23(input.pluginRoot, hookPath), input.version);
|
|
12136
11956
|
}
|
|
12137
11957
|
await stampComponentVersions(input);
|
|
12138
11958
|
}
|
|
12139
11959
|
async function writeLazyCodexInstallSnapshot(input) {
|
|
12140
11960
|
if (input.distributionManifest === undefined)
|
|
12141
11961
|
return;
|
|
12142
|
-
await writeFile9(
|
|
11962
|
+
await writeFile9(join23(input.pluginRoot, "lazycodex-install.json"), `${JSON.stringify({
|
|
12143
11963
|
packageName: input.distributionManifest.name,
|
|
12144
11964
|
version: input.distributionManifest.version
|
|
12145
11965
|
}, null, "\t")}
|
|
@@ -12196,16 +12016,16 @@ async function stampHookStatusMessages(path, version) {
|
|
|
12196
12016
|
async function stampComponentVersions(input) {
|
|
12197
12017
|
let entries;
|
|
12198
12018
|
try {
|
|
12199
|
-
entries = await readdir8(
|
|
12019
|
+
entries = await readdir8(join23(input.pluginRoot, "components"));
|
|
12200
12020
|
} catch (error) {
|
|
12201
12021
|
if (error instanceof Error)
|
|
12202
12022
|
return;
|
|
12203
12023
|
throw error;
|
|
12204
12024
|
}
|
|
12205
12025
|
for (const entry of entries) {
|
|
12206
|
-
const componentRoot =
|
|
12207
|
-
await stampJsonVersion(
|
|
12208
|
-
await stampHookStatusMessages(
|
|
12026
|
+
const componentRoot = join23(input.pluginRoot, "components", entry);
|
|
12027
|
+
await stampJsonVersion(join23(componentRoot, "package.json"), input.version);
|
|
12028
|
+
await stampHookStatusMessages(join23(componentRoot, "hooks", "hooks.json"), input.version);
|
|
12209
12029
|
}
|
|
12210
12030
|
}
|
|
12211
12031
|
function stampHookGroups(hooks, version) {
|
|
@@ -12235,7 +12055,7 @@ function normalizeHookStatusVersion(version) {
|
|
|
12235
12055
|
|
|
12236
12056
|
// packages/omo-codex/src/install/codex-project-local-cleanup.ts
|
|
12237
12057
|
import { copyFile as copyFile2, lstat as lstat10, readFile as readFile17, writeFile as writeFile10 } from "node:fs/promises";
|
|
12238
|
-
import { dirname as
|
|
12058
|
+
import { dirname as dirname8, join as join24, resolve as resolve7 } from "node:path";
|
|
12239
12059
|
var LEGACY_AGENT_CONFLICT_KEYS = ["max_threads"];
|
|
12240
12060
|
var PROJECT_LOCAL_ARTIFACT_PATHS = [
|
|
12241
12061
|
".codex/hooks.json",
|
|
@@ -12338,37 +12158,37 @@ async function findProjectLocalCodexConfigs(startDirectory, codexHome) {
|
|
|
12338
12158
|
if (startDirectoryStat !== null && !startDirectoryStat.isDirectory()) {
|
|
12339
12159
|
throw new ProjectLocalCleanupStartDirectoryError(startDirectory);
|
|
12340
12160
|
}
|
|
12341
|
-
const codexHomeConfigPath = codexHome === undefined ? null :
|
|
12161
|
+
const codexHomeConfigPath = codexHome === undefined ? null : join24(resolve7(codexHome), "config.toml");
|
|
12342
12162
|
let current = resolve7(startDirectory);
|
|
12343
12163
|
const configPathsFromCwd = [];
|
|
12344
12164
|
while (true) {
|
|
12345
|
-
const configPath =
|
|
12165
|
+
const configPath = join24(current, ".codex", "config.toml");
|
|
12346
12166
|
if (await isRegularProjectLocalConfig(current, configPath)) {
|
|
12347
12167
|
if (codexHomeConfigPath === null || resolve7(configPath) !== codexHomeConfigPath) {
|
|
12348
12168
|
configPathsFromCwd.push(configPath);
|
|
12349
12169
|
}
|
|
12350
12170
|
}
|
|
12351
|
-
if (await exists5(
|
|
12171
|
+
if (await exists5(join24(current, ".git"))) {
|
|
12352
12172
|
return configPathsFromCwd.length === 0 ? null : {
|
|
12353
12173
|
projectRoot: current,
|
|
12354
12174
|
configPaths: [...configPathsFromCwd].reverse(),
|
|
12355
12175
|
artifactRoots: artifactRootsForConfigPaths(configPathsFromCwd)
|
|
12356
12176
|
};
|
|
12357
12177
|
}
|
|
12358
|
-
const parent =
|
|
12178
|
+
const parent = dirname8(current);
|
|
12359
12179
|
if (parent === current) {
|
|
12360
12180
|
const nearestConfigPath = configPathsFromCwd[0];
|
|
12361
12181
|
return nearestConfigPath === undefined ? null : {
|
|
12362
|
-
projectRoot:
|
|
12182
|
+
projectRoot: dirname8(dirname8(nearestConfigPath)),
|
|
12363
12183
|
configPaths: [nearestConfigPath],
|
|
12364
|
-
artifactRoots: [
|
|
12184
|
+
artifactRoots: [dirname8(dirname8(nearestConfigPath))]
|
|
12365
12185
|
};
|
|
12366
12186
|
}
|
|
12367
12187
|
current = parent;
|
|
12368
12188
|
}
|
|
12369
12189
|
}
|
|
12370
12190
|
async function isRegularProjectLocalConfig(directory, configPath) {
|
|
12371
|
-
const codexDirStat = await maybeLstat(
|
|
12191
|
+
const codexDirStat = await maybeLstat(join24(directory, ".codex"));
|
|
12372
12192
|
if (codexDirStat === null || !codexDirStat.isDirectory() || codexDirStat.isSymbolicLink())
|
|
12373
12193
|
return false;
|
|
12374
12194
|
const configStat = await maybeLstat(configPath);
|
|
@@ -12377,7 +12197,7 @@ async function isRegularProjectLocalConfig(directory, configPath) {
|
|
|
12377
12197
|
function artifactRootsForConfigPaths(configPaths) {
|
|
12378
12198
|
const roots = [];
|
|
12379
12199
|
for (const configPath of configPaths) {
|
|
12380
|
-
const root =
|
|
12200
|
+
const root = dirname8(dirname8(configPath));
|
|
12381
12201
|
if (!roots.includes(root))
|
|
12382
12202
|
roots.push(root);
|
|
12383
12203
|
}
|
|
@@ -12388,7 +12208,7 @@ async function collectProjectLocalArtifacts(projectRoots) {
|
|
|
12388
12208
|
const seenPaths = new Set;
|
|
12389
12209
|
for (const projectRoot of projectRoots) {
|
|
12390
12210
|
for (const relativePath of PROJECT_LOCAL_ARTIFACT_PATHS) {
|
|
12391
|
-
const artifactPath =
|
|
12211
|
+
const artifactPath = join24(projectRoot, relativePath);
|
|
12392
12212
|
if (seenPaths.has(artifactPath))
|
|
12393
12213
|
continue;
|
|
12394
12214
|
const entryStat = await maybeLstat(artifactPath);
|
|
@@ -12466,13 +12286,13 @@ function formatUnknownError(error) {
|
|
|
12466
12286
|
import { createHash as createHash2 } from "node:crypto";
|
|
12467
12287
|
import { lstat as lstat11, readFile as readFile19, readdir as readdir10, rm as rm10 } from "node:fs/promises";
|
|
12468
12288
|
import { tmpdir } from "node:os";
|
|
12469
|
-
import { join as
|
|
12289
|
+
import { join as join25, posix } from "node:path";
|
|
12470
12290
|
|
|
12471
12291
|
// packages/omo-codex/src/install/lsp-daemon-reaper-attestation.ts
|
|
12472
12292
|
import { execFile } from "node:child_process";
|
|
12473
12293
|
import { readFile as readFile18, readdir as readdir9, readlink as readlink5 } from "node:fs/promises";
|
|
12474
12294
|
import { connect } from "node:net";
|
|
12475
|
-
import { basename as
|
|
12295
|
+
import { basename as basename5 } from "node:path";
|
|
12476
12296
|
var PROBE_TIMEOUT_MS = 500;
|
|
12477
12297
|
async function probeLegacyJsonRpcEndpoint(endpoint, timeoutMs = PROBE_TIMEOUT_MS) {
|
|
12478
12298
|
return await new Promise((resolve8) => {
|
|
@@ -12604,14 +12424,14 @@ function splitCmdline(buffer) {
|
|
|
12604
12424
|
function isNodeCliDaemonArgv(argv) {
|
|
12605
12425
|
if (argv.length < 2 || !argv.includes("daemon"))
|
|
12606
12426
|
return false;
|
|
12607
|
-
const executable =
|
|
12427
|
+
const executable = basename5(argv[0] ?? "");
|
|
12608
12428
|
if (!/^node(?:\.exe)?$/i.test(executable))
|
|
12609
12429
|
return false;
|
|
12610
12430
|
return argv.some((value) => value === "cli.js" || value.endsWith("/cli.js") || value.endsWith("\\cli.js"));
|
|
12611
12431
|
}
|
|
12612
12432
|
function lsofShowsUnixEndpoint(output, pid, endpoint) {
|
|
12613
12433
|
const lines = output.split(/\r?\n/).filter((line) => line.length > 0);
|
|
12614
|
-
const endpointName =
|
|
12434
|
+
const endpointName = basename5(endpoint);
|
|
12615
12435
|
return lines.includes(`p${pid}`) && lines.some((line) => line === `n${endpoint}` || line === `n${endpointName}`);
|
|
12616
12436
|
}
|
|
12617
12437
|
function isNodeCliDaemonCommand(command) {
|
|
@@ -12639,7 +12459,7 @@ async function readBinary(readFileImpl, path) {
|
|
|
12639
12459
|
var LEGACY_EXIT_WAIT_TIMEOUT_MS = 5000;
|
|
12640
12460
|
var LEGACY_VERSION_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._+-]{0,127}$/;
|
|
12641
12461
|
async function reapLspDaemons(codexHome, deps = {}) {
|
|
12642
|
-
const daemonRoot =
|
|
12462
|
+
const daemonRoot = join25(codexHome, "codex-lsp", "daemon");
|
|
12643
12463
|
const platform = deps.platform ?? process.platform;
|
|
12644
12464
|
const tmpDir = deps.tmpDir ?? tmpdir();
|
|
12645
12465
|
const probe = deps.probeLegacyJsonRpc ?? probeLegacyJsonRpcEndpoint;
|
|
@@ -12649,7 +12469,7 @@ async function reapLspDaemons(codexHome, deps = {}) {
|
|
|
12649
12469
|
const entries = await readdir10(daemonRoot, { withFileTypes: true }).catch(() => []);
|
|
12650
12470
|
const results = [];
|
|
12651
12471
|
for (const entry of [...entries].sort((left, right) => left.name.localeCompare(right.name))) {
|
|
12652
|
-
const versionPath =
|
|
12472
|
+
const versionPath = join25(daemonRoot, entry.name);
|
|
12653
12473
|
const parsedVersion = parseVersionEntry(entry.name);
|
|
12654
12474
|
if (parsedVersion === null || !entry.isDirectory()) {
|
|
12655
12475
|
await removeVersionDir(versionPath);
|
|
@@ -12697,7 +12517,7 @@ function parseVersionEntry(entryName) {
|
|
|
12697
12517
|
return LEGACY_VERSION_PATTERN.test(version) ? version : null;
|
|
12698
12518
|
}
|
|
12699
12519
|
async function readLegacyMetadata(input) {
|
|
12700
|
-
const pidText = await readRegularTrimmedFile(
|
|
12520
|
+
const pidText = await readRegularTrimmedFile(join25(input.versionPath, "daemon.pid"));
|
|
12701
12521
|
if (pidText === "non_regular")
|
|
12702
12522
|
return { kind: "remove", reason: "removed non-regular legacy daemon metadata" };
|
|
12703
12523
|
if (pidText === null)
|
|
@@ -12705,7 +12525,7 @@ async function readLegacyMetadata(input) {
|
|
|
12705
12525
|
const pid = Number.parseInt(pidText, 10);
|
|
12706
12526
|
if (!Number.isInteger(pid) || pid <= 0)
|
|
12707
12527
|
return { kind: "remove", reason: "removed malformed legacy daemon metadata" };
|
|
12708
|
-
const endpointText = await readRegularTrimmedFile(
|
|
12528
|
+
const endpointText = await readRegularTrimmedFile(join25(input.versionPath, "daemon.endpoint"));
|
|
12709
12529
|
if (endpointText === "non_regular")
|
|
12710
12530
|
return { kind: "remove", reason: "removed non-regular legacy daemon metadata" };
|
|
12711
12531
|
if (endpointText === null)
|
|
@@ -12784,7 +12604,7 @@ function processIsRunning(pid) {
|
|
|
12784
12604
|
|
|
12785
12605
|
// packages/omo-codex/src/install/codex-installer-bin-dir.ts
|
|
12786
12606
|
import { homedir } from "node:os";
|
|
12787
|
-
import { join as
|
|
12607
|
+
import { join as join26, resolve as resolve8 } from "node:path";
|
|
12788
12608
|
function resolveCodexInstallerBinDir(input) {
|
|
12789
12609
|
const explicitBinDir = input.binDir ?? input.env?.CODEX_LOCAL_BIN_DIR;
|
|
12790
12610
|
if (explicitBinDir !== undefined && explicitBinDir.trim().length > 0)
|
|
@@ -12793,22 +12613,22 @@ function resolveCodexInstallerBinDir(input) {
|
|
|
12793
12613
|
const defaultCodexHome = resolve8(homeDir, ".codex");
|
|
12794
12614
|
const resolvedCodexHome = resolve8(input.codexHome);
|
|
12795
12615
|
if (resolvedCodexHome !== defaultCodexHome)
|
|
12796
|
-
return
|
|
12616
|
+
return join26(resolvedCodexHome, "bin");
|
|
12797
12617
|
return resolve8(homeDir, ".local", "bin");
|
|
12798
12618
|
}
|
|
12799
12619
|
|
|
12800
12620
|
// packages/omo-codex/src/install/codex-installed-bin-dir.ts
|
|
12801
12621
|
import { readFile as readFile20, readdir as readdir11, writeFile as writeFile11 } from "node:fs/promises";
|
|
12802
|
-
import { join as
|
|
12622
|
+
import { join as join27 } from "node:path";
|
|
12803
12623
|
var INSTALLED_BIN_DIR_MANIFEST = ".installed-bin-dir.json";
|
|
12804
12624
|
async function writeInstalledCodexBinDir(input) {
|
|
12805
|
-
await writeFile11(
|
|
12625
|
+
await writeFile11(join27(input.pluginRoot, INSTALLED_BIN_DIR_MANIFEST), `${JSON.stringify({ binDir: input.binDir }, null, 2)}
|
|
12806
12626
|
`);
|
|
12807
12627
|
}
|
|
12808
12628
|
|
|
12809
12629
|
// packages/omo-codex/src/install/codex-git-bash-hooks.ts
|
|
12810
12630
|
import { readFile as readFile21, writeFile as writeFile12 } from "node:fs/promises";
|
|
12811
|
-
import { join as
|
|
12631
|
+
import { join as join28 } from "node:path";
|
|
12812
12632
|
var WINDOWS_ONLY_GIT_BASH_HOOKS = new Set([
|
|
12813
12633
|
"./hooks/pre-tool-use-recommending-git-bash-mcp.json",
|
|
12814
12634
|
"./hooks/post-compact-resetting-git-bash-mcp-reminder.json"
|
|
@@ -12816,7 +12636,7 @@ var WINDOWS_ONLY_GIT_BASH_HOOKS = new Set([
|
|
|
12816
12636
|
async function removeGitBashHooksOffWindows(input) {
|
|
12817
12637
|
if (input.platform === "win32")
|
|
12818
12638
|
return;
|
|
12819
|
-
const manifestPath =
|
|
12639
|
+
const manifestPath = join28(input.pluginRoot, ".codex-plugin", "plugin.json");
|
|
12820
12640
|
const parsed = JSON.parse(await readFile21(manifestPath, "utf8"));
|
|
12821
12641
|
if (!isPlainRecord(parsed) || !Array.isArray(parsed.hooks))
|
|
12822
12642
|
return;
|
|
@@ -12828,10 +12648,10 @@ async function removeGitBashHooksOffWindows(input) {
|
|
|
12828
12648
|
}
|
|
12829
12649
|
|
|
12830
12650
|
// packages/omo-codex/src/install/omo-sot-migration.ts
|
|
12831
|
-
import { join as
|
|
12651
|
+
import { join as join29 } from "node:path";
|
|
12832
12652
|
async function seedAndMigrateOmoSot(input) {
|
|
12833
12653
|
const commandEnv = { ...input.env };
|
|
12834
|
-
const scriptPath =
|
|
12654
|
+
const scriptPath = join29(input.repoRoot, "packages", "omo-codex", "plugin", "scripts", "migrate-omo-sot.mjs");
|
|
12835
12655
|
try {
|
|
12836
12656
|
await input.runCommand(process.execPath, [scriptPath, "--seed"], {
|
|
12837
12657
|
cwd: input.repoRoot,
|
|
@@ -12845,12 +12665,12 @@ async function seedAndMigrateOmoSot(input) {
|
|
|
12845
12665
|
}
|
|
12846
12666
|
|
|
12847
12667
|
// packages/omo-codex/src/install/install-ast-grep-sg.ts
|
|
12848
|
-
import { join as
|
|
12668
|
+
import { join as join31 } from "node:path";
|
|
12849
12669
|
|
|
12850
12670
|
// packages/utils/src/ast-grep/install-script.ts
|
|
12851
12671
|
import { spawn as spawn2 } from "node:child_process";
|
|
12852
|
-
import { existsSync as
|
|
12853
|
-
import { join as
|
|
12672
|
+
import { existsSync as existsSync3 } from "node:fs";
|
|
12673
|
+
import { join as join30 } from "node:path";
|
|
12854
12674
|
|
|
12855
12675
|
// packages/utils/src/ast-grep/sg-manifest.ts
|
|
12856
12676
|
function normalizeRuntimePlatform(platform = process.platform) {
|
|
@@ -12872,7 +12692,7 @@ var AST_GREP_BIN_DIR_ENV_KEY = "OMO_AST_GREP_BIN_DIR";
|
|
|
12872
12692
|
var KILL_GRACE_MS = 1000;
|
|
12873
12693
|
var AST_GREP_INSTALL_TIMEOUT_MS = 30000;
|
|
12874
12694
|
function astGrepRuntimeDir(baseDir, platform = process.platform, arch = process.arch) {
|
|
12875
|
-
return
|
|
12695
|
+
return join30(baseDir, "runtime", "ast-grep", runtimeSlug(platform, arch));
|
|
12876
12696
|
}
|
|
12877
12697
|
function isMissingExecutable(error) {
|
|
12878
12698
|
if (!("code" in error))
|
|
@@ -12910,7 +12730,7 @@ function defaultSpawnProcess(command, args, options) {
|
|
|
12910
12730
|
};
|
|
12911
12731
|
}
|
|
12912
12732
|
function scriptPathForPlatform(skillDir, platform) {
|
|
12913
|
-
return
|
|
12733
|
+
return join30(skillDir, platform === "win32" ? "install.ps1" : "install.sh");
|
|
12914
12734
|
}
|
|
12915
12735
|
function invocationsForPlatform(scriptPath, platform) {
|
|
12916
12736
|
if (platform !== "win32")
|
|
@@ -12952,7 +12772,7 @@ function failedReason(outcome) {
|
|
|
12952
12772
|
}
|
|
12953
12773
|
async function runAstGrepSkillInstall(options) {
|
|
12954
12774
|
const platform = options.platform ?? process.platform;
|
|
12955
|
-
const fileExists = options.fileExists ??
|
|
12775
|
+
const fileExists = options.fileExists ?? existsSync3;
|
|
12956
12776
|
const scriptPath = scriptPathForPlatform(options.skillDir, platform);
|
|
12957
12777
|
if (!fileExists(scriptPath))
|
|
12958
12778
|
return { kind: "skipped", reason: `missing ${scriptPath}` };
|
|
@@ -12996,7 +12816,7 @@ async function installAstGrepForCodex(options) {
|
|
|
12996
12816
|
return;
|
|
12997
12817
|
const platform = options.platform ?? process.platform;
|
|
12998
12818
|
const targetDir = astGrepRuntimeDir(options.codexHome, platform, options.arch ?? process.arch);
|
|
12999
|
-
const skillDir =
|
|
12819
|
+
const skillDir = join31(plugin.path, "skills", "ast-grep");
|
|
13000
12820
|
const installer = options.installer ?? runAstGrepSkillInstall;
|
|
13001
12821
|
try {
|
|
13002
12822
|
const result = await installer({ platform, skillDir, targetDir });
|
|
@@ -13029,7 +12849,7 @@ async function runCodexInstaller(options = {}) {
|
|
|
13029
12849
|
const env2 = options.env ?? process.env;
|
|
13030
12850
|
const platform = options.platform ?? process.platform;
|
|
13031
12851
|
const repoRoot = resolve9(options.repoRoot ?? findRepoRoot({ importerDir: import.meta.dir, env: env2 }));
|
|
13032
|
-
const codexHome = resolve9(options.codexHome ?? env2.CODEX_HOME ??
|
|
12852
|
+
const codexHome = resolve9(options.codexHome ?? env2.CODEX_HOME ?? join34(homedir2(), ".codex"));
|
|
13033
12853
|
const projectDirectory = resolve9(options.projectDirectory ?? env2.OMO_CODEX_PROJECT ?? process.cwd());
|
|
13034
12854
|
const binDir = resolveCodexInstallerBinDir({ binDir: options.binDir, codexHome, env: env2 });
|
|
13035
12855
|
const runCommand = options.runCommand ?? defaultRunCommand;
|
|
@@ -13046,9 +12866,9 @@ async function runCodexInstaller(options = {}) {
|
|
|
13046
12866
|
if (!gitBashResolution.found) {
|
|
13047
12867
|
throw new Error(gitBashResolution.installHint);
|
|
13048
12868
|
}
|
|
13049
|
-
const codexPackageRoot =
|
|
12869
|
+
const codexPackageRoot = join34(repoRoot, "packages", "omo-codex");
|
|
13050
12870
|
const marketplace = await readMarketplace(repoRoot, {
|
|
13051
|
-
marketplacePath:
|
|
12871
|
+
marketplacePath: join34(codexPackageRoot, "marketplace.json")
|
|
13052
12872
|
});
|
|
13053
12873
|
const distributionManifest = await readDistributionManifest(repoRoot);
|
|
13054
12874
|
const installed = [];
|
|
@@ -13094,7 +12914,7 @@ async function runCodexInstaller(options = {}) {
|
|
|
13094
12914
|
if (runtimeLink !== null)
|
|
13095
12915
|
log(`Linked ${runtimeLink.name} -> ${runtimeLink.target}`);
|
|
13096
12916
|
else
|
|
13097
|
-
log(`Warning: skipped the omo-agent-toolkit runtime wrapper because ${
|
|
12917
|
+
log(`Warning: skipped the omo-agent-toolkit runtime wrapper because ${join34(repoRoot, "dist", "cli", "index.js")} is missing; omo-agent-toolkit ulw-loop commands will be unavailable until a package shipping dist/cli is installed`);
|
|
13098
12918
|
}
|
|
13099
12919
|
pluginSources.push({ name: entry.name, sourcePath });
|
|
13100
12920
|
installed.push(plugin);
|
|
@@ -13157,13 +12977,13 @@ async function runCodexInstaller(options = {}) {
|
|
|
13157
12977
|
continue;
|
|
13158
12978
|
log(`Warning: deferred legacy Codex LSP daemon cleanup for v${cleanup.version}: ${cleanup.reason}`);
|
|
13159
12979
|
}
|
|
13160
|
-
const marketplaceRoot =
|
|
12980
|
+
const marketplaceRoot = join34(codexHome, "plugins", "cache", marketplace.name);
|
|
13161
12981
|
await writeCachedMarketplaceManifest({
|
|
13162
12982
|
marketplaceName: marketplace.name,
|
|
13163
12983
|
marketplaceRoot,
|
|
13164
12984
|
plugins: installed
|
|
13165
12985
|
});
|
|
13166
|
-
const configPath =
|
|
12986
|
+
const configPath = join34(codexHome, "config.toml");
|
|
13167
12987
|
await updateCodexConfig({
|
|
13168
12988
|
configPath,
|
|
13169
12989
|
repoRoot: codexPackageRoot,
|
|
@@ -13171,7 +12991,6 @@ async function runCodexInstaller(options = {}) {
|
|
|
13171
12991
|
marketplaceSource: codexMarketplaceSource(marketplaceRoot),
|
|
13172
12992
|
pluginNames: marketplace.plugins.map((plugin) => plugin.name),
|
|
13173
12993
|
platform,
|
|
13174
|
-
codegraphMcpEnabled: options.codegraphMcpEnabled ?? resolveCodegraphNodeSupport({ env: env2 }).supported,
|
|
13175
12994
|
gitBashEnabled: platform === "win32" && gitBashResolution.found,
|
|
13176
12995
|
trustedHookStates,
|
|
13177
12996
|
agentConfigs: [...agentConfigs.values()].sort((left, right) => left.name.localeCompare(right.name)),
|
|
@@ -13224,7 +13043,7 @@ function findRepoRootFromImporter(importerDir) {
|
|
|
13224
13043
|
for (let depth = 0;depth <= 7; depth += 1) {
|
|
13225
13044
|
if (isRepoRootWithCodexPlugin(current))
|
|
13226
13045
|
return current;
|
|
13227
|
-
for (const wrapperPackageRoot of [
|
|
13046
|
+
for (const wrapperPackageRoot of [join34(current, "node_modules", "oh-my-openagent"), join34(current, "oh-my-openagent")]) {
|
|
13228
13047
|
if (isRepoRootWithCodexPlugin(wrapperPackageRoot))
|
|
13229
13048
|
return wrapperPackageRoot;
|
|
13230
13049
|
}
|
|
@@ -13242,7 +13061,7 @@ function findRepoRoot(input) {
|
|
|
13242
13061
|
return findRepoRootFromImporter(input.importerDir);
|
|
13243
13062
|
}
|
|
13244
13063
|
function isRepoRootWithCodexPlugin(repoRoot) {
|
|
13245
|
-
return
|
|
13064
|
+
return existsSync6(join34(repoRoot, "packages", "omo-codex", "plugin", ".codex-plugin", "plugin.json"));
|
|
13246
13065
|
}
|
|
13247
13066
|
function codexMarketplaceSource(marketplaceRoot) {
|
|
13248
13067
|
return { sourceType: "local", source: marketplaceRoot };
|
|
@@ -13553,14 +13372,14 @@ function shellQuote(value) {
|
|
|
13553
13372
|
}
|
|
13554
13373
|
|
|
13555
13374
|
// packages/omo-codex/src/install/lazycodex-manual-update.ts
|
|
13556
|
-
import { spawn as spawn3, spawnSync as
|
|
13375
|
+
import { spawn as spawn3, spawnSync as spawnSync2 } from "node:child_process";
|
|
13557
13376
|
import { readFileSync as readFileSync4 } from "node:fs";
|
|
13558
|
-
import { dirname as
|
|
13377
|
+
import { dirname as dirname11, join as join36 } from "node:path";
|
|
13559
13378
|
import { createInterface as createInterface2 } from "node:readline/promises";
|
|
13560
13379
|
import { fileURLToPath } from "node:url";
|
|
13561
13380
|
|
|
13562
13381
|
// packages/omo-codex/src/install/lazycodex-bun-global-paths.ts
|
|
13563
|
-
import { join as
|
|
13382
|
+
import { join as join35 } from "node:path";
|
|
13564
13383
|
function isBunGlobalEntrypointPath(invokedPath, env2) {
|
|
13565
13384
|
if (typeof invokedPath !== "string" || invokedPath.trim().length === 0)
|
|
13566
13385
|
return false;
|
|
@@ -13571,8 +13390,8 @@ function resolveBunGlobalRoots(env2) {
|
|
|
13571
13390
|
const bunInstallRoot = env2.BUN_INSTALL?.trim();
|
|
13572
13391
|
const homeRoot = env2.HOME?.trim();
|
|
13573
13392
|
return [
|
|
13574
|
-
...bunInstallRoot ? [
|
|
13575
|
-
...homeRoot ? [
|
|
13393
|
+
...bunInstallRoot ? [join35(bunInstallRoot, "bin"), join35(bunInstallRoot, "install", "global", "node_modules")] : [],
|
|
13394
|
+
...homeRoot ? [join35(homeRoot, ".bun", "bin"), join35(homeRoot, ".bun", "install", "global", "node_modules")] : []
|
|
13576
13395
|
].map(normalizePathForPrefix);
|
|
13577
13396
|
}
|
|
13578
13397
|
function normalizePathForPrefix(path2) {
|
|
@@ -13664,13 +13483,13 @@ function resolveArgs(env2) {
|
|
|
13664
13483
|
function resolveCurrentVersion(env2) {
|
|
13665
13484
|
if (env2.LAZYCODEX_CURRENT_VERSION?.trim())
|
|
13666
13485
|
return env2.LAZYCODEX_CURRENT_VERSION.trim();
|
|
13667
|
-
const pluginRoot =
|
|
13668
|
-
return readVersionManifest(resolveInstalledVersionPath(env2, pluginRoot)) ?? readVersionManifest(
|
|
13486
|
+
const pluginRoot = dirname11(dirname11(fileURLToPath(import.meta.url)));
|
|
13487
|
+
return readVersionManifest(resolveInstalledVersionPath(env2, pluginRoot)) ?? readVersionManifest(join36(pluginRoot, "..", "..", "..", "package.json")) ?? readVersionManifest(join36(pluginRoot, ".codex-plugin", "plugin.json"));
|
|
13669
13488
|
}
|
|
13670
13489
|
function resolveLatestVersion(env2) {
|
|
13671
13490
|
if (env2.LAZYCODEX_LATEST_VERSION?.trim())
|
|
13672
13491
|
return env2.LAZYCODEX_LATEST_VERSION.trim();
|
|
13673
|
-
const result =
|
|
13492
|
+
const result = spawnSync2("npm", ["view", "lazycodex-ai", "version", "--silent"], {
|
|
13674
13493
|
encoding: "utf8",
|
|
13675
13494
|
stdio: ["ignore", "pipe", "ignore"]
|
|
13676
13495
|
});
|
|
@@ -13698,7 +13517,7 @@ ${trustCommand}`);
|
|
|
13698
13517
|
${trustCommand}`);
|
|
13699
13518
|
}
|
|
13700
13519
|
function resolveKnownBunGlobalUntrustedPackages(env2) {
|
|
13701
|
-
const result =
|
|
13520
|
+
const result = spawnSync2(BUN_UPDATE_COMMAND, BUN_GLOBAL_UNTRUSTED_ARGS, {
|
|
13702
13521
|
encoding: "utf8",
|
|
13703
13522
|
env: env2,
|
|
13704
13523
|
stdio: ["ignore", "pipe", "ignore"]
|
|
@@ -13781,7 +13600,7 @@ function compareVersions(left, right) {
|
|
|
13781
13600
|
function resolveInstalledVersionPath(env2, pluginRoot) {
|
|
13782
13601
|
if (env2.LAZYCODEX_INSTALLED_VERSION_FILE?.trim())
|
|
13783
13602
|
return env2.LAZYCODEX_INSTALLED_VERSION_FILE.trim();
|
|
13784
|
-
return
|
|
13603
|
+
return join36(pluginRoot, INSTALLED_VERSION_FILE);
|
|
13785
13604
|
}
|
|
13786
13605
|
function readVersionManifest(path2) {
|
|
13787
13606
|
try {
|
|
@@ -13798,17 +13617,16 @@ function readVersionManifest(path2) {
|
|
|
13798
13617
|
}
|
|
13799
13618
|
// packages/omo-codex/src/install/codex-git-bash-mcp-env.ts
|
|
13800
13619
|
import { readFile as readFile22, writeFile as writeFile13 } from "node:fs/promises";
|
|
13801
|
-
import { join as
|
|
13620
|
+
import { join as join37 } from "node:path";
|
|
13802
13621
|
var GIT_BASH_ENV_KEY2 = "OMO_CODEX_GIT_BASH_PATH";
|
|
13803
|
-
var CODEGRAPH_RELATIVE_ARGS2 = new Set(["components/codegraph/dist/serve.js", "./components/codegraph/dist/serve.js"]);
|
|
13804
13622
|
async function stampGitBashMcpEnv(input) {
|
|
13805
|
-
const manifestPath =
|
|
13623
|
+
const manifestPath = join37(input.pluginRoot, ".mcp.json");
|
|
13806
13624
|
if (!await fileExistsStrict(manifestPath))
|
|
13807
13625
|
return false;
|
|
13808
13626
|
const parsed = JSON.parse(await readFile22(manifestPath, "utf8"));
|
|
13809
13627
|
if (!isPlainRecord(parsed) || !isPlainRecord(parsed["mcpServers"]))
|
|
13810
13628
|
return false;
|
|
13811
|
-
let changed =
|
|
13629
|
+
let changed = false;
|
|
13812
13630
|
if (input.platform === "win32") {
|
|
13813
13631
|
const rawOverride = input.env?.[GIT_BASH_ENV_KEY2];
|
|
13814
13632
|
const override = typeof rawOverride === "string" ? rawOverride.trim() : "";
|
|
@@ -13827,24 +13645,13 @@ async function stampGitBashMcpEnv(input) {
|
|
|
13827
13645
|
`);
|
|
13828
13646
|
return true;
|
|
13829
13647
|
}
|
|
13830
|
-
function stampCodegraphMcpPath(mcpServers, pluginRoot) {
|
|
13831
|
-
const codegraphServer = mcpServers["codegraph"];
|
|
13832
|
-
if (!isPlainRecord(codegraphServer) || !Array.isArray(codegraphServer["args"]))
|
|
13833
|
-
return false;
|
|
13834
|
-
const args = codegraphServer["args"];
|
|
13835
|
-
const entrypoint = args[0];
|
|
13836
|
-
if (typeof entrypoint !== "string" || !CODEGRAPH_RELATIVE_ARGS2.has(entrypoint))
|
|
13837
|
-
return false;
|
|
13838
|
-
codegraphServer["args"] = [join39(pluginRoot, "components", "codegraph", "dist", "serve.js"), ...args.slice(1)];
|
|
13839
|
-
return true;
|
|
13840
|
-
}
|
|
13841
13648
|
|
|
13842
13649
|
// packages/omo-codex/src/install/install-local-cli.ts
|
|
13843
13650
|
async function installMarketplaceLocally(options = {}) {
|
|
13844
13651
|
return runCodexInstaller(options);
|
|
13845
13652
|
}
|
|
13846
13653
|
function resolveDefaultRepoRootForEntrypoint(entrypointPath) {
|
|
13847
|
-
return resolve10(
|
|
13654
|
+
return resolve10(dirname12(entrypointPath), "..", "..", "..");
|
|
13848
13655
|
}
|
|
13849
13656
|
function resolveDefaultRepoRoot() {
|
|
13850
13657
|
return resolveDefaultRepoRootForEntrypoint(fileURLToPath2(import.meta.url));
|
|
@@ -13860,7 +13667,7 @@ async function runLazyCodexInstallLocalCli(input) {
|
|
|
13860
13667
|
return 0;
|
|
13861
13668
|
}
|
|
13862
13669
|
if (parsed.kind === "version") {
|
|
13863
|
-
const packageJson = JSON.parse(await readFile23(
|
|
13670
|
+
const packageJson = JSON.parse(await readFile23(join38(input.defaultRepoRoot, "package.json"), "utf8"));
|
|
13864
13671
|
const version2 = typeof packageJson.version === "string" ? packageJson.version : "unknown";
|
|
13865
13672
|
input.log(`lazycodex-ai ${version2}`);
|
|
13866
13673
|
return 0;
|