oh-my-opencode 5.0.0-beta.34 → 5.0.0-beta.36
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 +48341 -48541
- package/dist/cli-node/index.js +49016 -49216
- 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 -13718
- 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-execute/SKILL.md +9 -9
- package/dist/skills/ulw-plan/SKILL.md +0 -1
- package/dist/tui.js +44809 -44883
- package/package.json +16 -21
- 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/hook-status-message.mjs +0 -1
- 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-execute/SKILL.md +11 -19
- 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/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-config-git-bash.test.mjs +0 -23
- package/packages/omo-codex/scripts/install-dist/install-local.mjs +227 -435
- 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-execute/SKILL.md +9 -9
- 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:ae83d990d7e2bae415b73b27016dc7e736e0c869d980f63ac84aa67f8a285034
|
|
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.36",
|
|
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 {
|
|
@@ -9670,14 +9477,14 @@ async function installCachedPlugin(input) {
|
|
|
9670
9477
|
return { name: input.name, version: input.version, path: targetPath };
|
|
9671
9478
|
}
|
|
9672
9479
|
async function maybeRunNpmInstall(cwd, runCommand, env, args = ["install"]) {
|
|
9673
|
-
if (!await fileExistsStrict(
|
|
9480
|
+
if (!await fileExistsStrict(join10(cwd, "package.json")))
|
|
9674
9481
|
return;
|
|
9675
9482
|
await runCommand("npm", args, { cwd, env });
|
|
9676
9483
|
}
|
|
9677
9484
|
async function maybeRunNpmBuild(cwd, runCommand, env) {
|
|
9678
|
-
if (!await fileExistsStrict(
|
|
9485
|
+
if (!await fileExistsStrict(join10(cwd, "package.json")))
|
|
9679
9486
|
return;
|
|
9680
|
-
const packageJson = JSON.parse(await readFile8(
|
|
9487
|
+
const packageJson = JSON.parse(await readFile8(join10(cwd, "package.json"), "utf8"));
|
|
9681
9488
|
if (!isPlainRecord(packageJson))
|
|
9682
9489
|
return;
|
|
9683
9490
|
const scripts = packageJson.scripts;
|
|
@@ -9686,9 +9493,9 @@ async function maybeRunNpmBuild(cwd, runCommand, env) {
|
|
|
9686
9493
|
await runCommand("npm", ["run", "build"], { cwd, env });
|
|
9687
9494
|
}
|
|
9688
9495
|
async function maybeRunNpmSyncSkills(cwd, runCommand, env) {
|
|
9689
|
-
if (!await fileExistsStrict(
|
|
9496
|
+
if (!await fileExistsStrict(join10(cwd, "package.json")))
|
|
9690
9497
|
return;
|
|
9691
|
-
const packageJson = JSON.parse(await readFile8(
|
|
9498
|
+
const packageJson = JSON.parse(await readFile8(join10(cwd, "package.json"), "utf8"));
|
|
9692
9499
|
if (!isPlainRecord(packageJson))
|
|
9693
9500
|
return;
|
|
9694
9501
|
const scripts = packageJson.scripts;
|
|
@@ -9700,13 +9507,13 @@ function sanitizeNpmInstallEnv(env) {
|
|
|
9700
9507
|
return Object.fromEntries(Object.entries(env).filter(([key]) => key.toLowerCase() !== "npm_config_allow_scripts"));
|
|
9701
9508
|
}
|
|
9702
9509
|
function createTempSiblingPath(targetPath) {
|
|
9703
|
-
return
|
|
9510
|
+
return join10(dirname4(targetPath), `.tmp-${basename2(targetPath)}-${process.pid}-${Date.now()}`);
|
|
9704
9511
|
}
|
|
9705
9512
|
function createBackupSiblingPath(targetPath) {
|
|
9706
|
-
return
|
|
9513
|
+
return join10(dirname4(targetPath), `.backup-${basename2(targetPath)}-${process.pid}-${Date.now()}`);
|
|
9707
9514
|
}
|
|
9708
9515
|
async function copyDirectory(sourcePath, targetPath) {
|
|
9709
|
-
await mkdir3(
|
|
9516
|
+
await mkdir3(dirname4(targetPath), { recursive: true });
|
|
9710
9517
|
await cp2(sourcePath, targetPath, { recursive: true, filter: (source) => shouldCopyPluginPath(source, sourcePath) });
|
|
9711
9518
|
}
|
|
9712
9519
|
async function promoteDirectory(tempPath, targetPath, renameDirectory) {
|
|
@@ -9751,18 +9558,18 @@ var removedSparkshellPromptSurfaceFiles = new Set(["directive.md", "plugin.json"
|
|
|
9751
9558
|
var removedSparkshellTextFilePattern = /\.(?:json|md|toml|ya?ml)$/i;
|
|
9752
9559
|
async function assertNoRemovedSparkshellPromptReferences(pluginRoot) {
|
|
9753
9560
|
for (const filePath of await listRemovedSparkshellPromptSurfaceFiles(pluginRoot, "")) {
|
|
9754
|
-
const content = await readFile8(
|
|
9561
|
+
const content = await readFile8(join10(pluginRoot, filePath), "utf8");
|
|
9755
9562
|
if (!removedSparkshellReferencePattern.test(content))
|
|
9756
9563
|
continue;
|
|
9757
9564
|
throw new Error(`removed sparkshell reference found in Codex plugin prompt surface: ${filePath}`);
|
|
9758
9565
|
}
|
|
9759
9566
|
}
|
|
9760
9567
|
async function listRemovedSparkshellPromptSurfaceFiles(pluginRoot, relativeDirectory) {
|
|
9761
|
-
const directory = relativeDirectory === "" ? pluginRoot :
|
|
9568
|
+
const directory = relativeDirectory === "" ? pluginRoot : join10(pluginRoot, relativeDirectory);
|
|
9762
9569
|
const entries = await readdir4(directory, { withFileTypes: true });
|
|
9763
9570
|
const files = [];
|
|
9764
9571
|
for (const entry of entries) {
|
|
9765
|
-
const relativePath = relativeDirectory === "" ? entry.name :
|
|
9572
|
+
const relativePath = relativeDirectory === "" ? entry.name : join10(relativeDirectory, entry.name);
|
|
9766
9573
|
if (entry.isDirectory()) {
|
|
9767
9574
|
if (shouldDescendIntoRemovedSparkshellPromptSurface(relativePath)) {
|
|
9768
9575
|
files.push(...await listRemovedSparkshellPromptSurfaceFiles(pluginRoot, relativePath));
|
|
@@ -9802,43 +9609,43 @@ async function copyRootRuntimeDists(input) {
|
|
|
9802
9609
|
if (repoRoot === null)
|
|
9803
9610
|
return;
|
|
9804
9611
|
for (const runtimePath of ["dist/cli", "dist/cli-node"]) {
|
|
9805
|
-
const sourcePath =
|
|
9806
|
-
if (!await fileExistsStrict(
|
|
9612
|
+
const sourcePath = join10(repoRoot, runtimePath);
|
|
9613
|
+
if (!await fileExistsStrict(join10(sourcePath, "index.js")))
|
|
9807
9614
|
continue;
|
|
9808
|
-
await mkdir3(
|
|
9809
|
-
await cp2(sourcePath,
|
|
9615
|
+
await mkdir3(dirname4(join10(input.pluginRoot, runtimePath)), { recursive: true });
|
|
9616
|
+
await cp2(sourcePath, join10(input.pluginRoot, runtimePath), { recursive: true });
|
|
9810
9617
|
}
|
|
9811
9618
|
}
|
|
9812
|
-
var canonicalPromptRelativePaths = [
|
|
9619
|
+
var canonicalPromptRelativePaths = [join10("packages", "prompts-core", "prompts", "ultrawork", "codex.md")];
|
|
9813
9620
|
async function copyCanonicalPromptSources(input) {
|
|
9814
9621
|
const repoRoot = repoRootForCodexPluginSource(input.sourcePath);
|
|
9815
9622
|
if (repoRoot === null)
|
|
9816
9623
|
return;
|
|
9817
9624
|
for (const relativePath of canonicalPromptRelativePaths) {
|
|
9818
|
-
const sourceFile =
|
|
9625
|
+
const sourceFile = join10(repoRoot, relativePath);
|
|
9819
9626
|
if (!await fileExistsStrict(sourceFile))
|
|
9820
9627
|
continue;
|
|
9821
|
-
const targetFile =
|
|
9822
|
-
await mkdir3(
|
|
9628
|
+
const targetFile = join10(input.pluginRoot, relativePath);
|
|
9629
|
+
await mkdir3(dirname4(targetFile), { recursive: true });
|
|
9823
9630
|
await cp2(sourceFile, targetFile);
|
|
9824
9631
|
}
|
|
9825
9632
|
}
|
|
9826
9633
|
function repoRootForCodexPluginSource(sourcePath) {
|
|
9827
|
-
const codexPackageRoot =
|
|
9828
|
-
const packagesRoot =
|
|
9829
|
-
if (
|
|
9634
|
+
const codexPackageRoot = dirname4(sourcePath);
|
|
9635
|
+
const packagesRoot = dirname4(codexPackageRoot);
|
|
9636
|
+
if (basename2(sourcePath) !== "plugin")
|
|
9830
9637
|
return null;
|
|
9831
|
-
if (
|
|
9638
|
+
if (basename2(codexPackageRoot) !== "omo-codex")
|
|
9832
9639
|
return null;
|
|
9833
|
-
if (
|
|
9640
|
+
if (basename2(packagesRoot) !== "packages")
|
|
9834
9641
|
return null;
|
|
9835
|
-
return
|
|
9642
|
+
return dirname4(packagesRoot);
|
|
9836
9643
|
}
|
|
9837
9644
|
// packages/omo-codex/src/install/codex-cache-prune.ts
|
|
9838
9645
|
import { lstat as lstat5, readdir as readdir5, rm as rm5, stat as stat4 } from "node:fs/promises";
|
|
9839
|
-
import { join as
|
|
9646
|
+
import { join as join11 } from "node:path";
|
|
9840
9647
|
async function pruneMarketplaceCache(input) {
|
|
9841
|
-
const cacheRoot =
|
|
9648
|
+
const cacheRoot = join11(input.codexHome, "plugins", "cache", input.marketplaceName);
|
|
9842
9649
|
if (!await fileExistsStrict(cacheRoot))
|
|
9843
9650
|
return;
|
|
9844
9651
|
const keep = new Set(input.keepPluginNames);
|
|
@@ -9846,15 +9653,15 @@ async function pruneMarketplaceCache(input) {
|
|
|
9846
9653
|
for (const entry of entries) {
|
|
9847
9654
|
if (!entry.isDirectory() || keep.has(entry.name))
|
|
9848
9655
|
continue;
|
|
9849
|
-
await rm5(
|
|
9656
|
+
await rm5(join11(cacheRoot, entry.name), { recursive: true, force: true });
|
|
9850
9657
|
}
|
|
9851
9658
|
}
|
|
9852
9659
|
async function pruneMarketplacePluginCaches(input) {
|
|
9853
|
-
const cacheRoot =
|
|
9660
|
+
const cacheRoot = join11(input.codexHome, "plugins", "cache", input.marketplaceName);
|
|
9854
9661
|
if (!await fileExistsStrict(cacheRoot))
|
|
9855
9662
|
return;
|
|
9856
9663
|
for (const pluginName of input.pluginNames) {
|
|
9857
|
-
await rm5(
|
|
9664
|
+
await rm5(join11(cacheRoot, pluginName), { recursive: true, force: true });
|
|
9858
9665
|
}
|
|
9859
9666
|
const remainingEntries = await readCacheEntryNames(cacheRoot);
|
|
9860
9667
|
if (remainingEntries.length === 0) {
|
|
@@ -9901,17 +9708,17 @@ async function isBrokenCacheSymlink(path) {
|
|
|
9901
9708
|
}
|
|
9902
9709
|
// packages/omo-codex/src/install/codex-cached-marketplace-manifest.ts
|
|
9903
9710
|
import { mkdir as mkdir4, rename as rename2, rm as rm6, stat as stat5, writeFile as writeFile4 } from "node:fs/promises";
|
|
9904
|
-
import { join as
|
|
9711
|
+
import { join as join12 } from "node:path";
|
|
9905
9712
|
async function writeCachedMarketplaceManifest(input) {
|
|
9906
|
-
const marketplaceDir =
|
|
9713
|
+
const marketplaceDir = join12(input.marketplaceRoot, ".agents", "plugins");
|
|
9907
9714
|
await mkdir4(marketplaceDir, { recursive: true });
|
|
9908
9715
|
for (const plugin of input.plugins) {
|
|
9909
|
-
const pluginPath =
|
|
9716
|
+
const pluginPath = join12(input.marketplaceRoot, plugin.name, plugin.version);
|
|
9910
9717
|
if (!await isDirectory2(pluginPath))
|
|
9911
9718
|
throw new Error(`Cannot write cached marketplace manifest: ${pluginPath} does not exist`);
|
|
9912
9719
|
}
|
|
9913
|
-
const manifestPath =
|
|
9914
|
-
const tempPath =
|
|
9720
|
+
const manifestPath = join12(marketplaceDir, "marketplace.json");
|
|
9721
|
+
const tempPath = join12(marketplaceDir, `.marketplace.json.tmp-${process.pid}-${Date.now()}`);
|
|
9915
9722
|
try {
|
|
9916
9723
|
await writeFile4(tempPath, `${JSON.stringify({
|
|
9917
9724
|
name: input.marketplaceName,
|
|
@@ -9938,9 +9745,9 @@ async function isDirectory2(path) {
|
|
|
9938
9745
|
}
|
|
9939
9746
|
|
|
9940
9747
|
// packages/omo-codex/src/install/codex-package-layout.ts
|
|
9941
|
-
import { existsSync as
|
|
9748
|
+
import { existsSync as existsSync2 } from "node:fs";
|
|
9942
9749
|
import { readFile as readFile9 } from "node:fs/promises";
|
|
9943
|
-
import { join as
|
|
9750
|
+
import { join as join13 } from "node:path";
|
|
9944
9751
|
var PACKAGED_CODEX_INSTALLER_NAMES = new Set([
|
|
9945
9752
|
"@code-yeongyu/lazycodex",
|
|
9946
9753
|
"@code-yeongyu/lazycodex-ai",
|
|
@@ -9950,10 +9757,10 @@ var PACKAGED_CODEX_INSTALLER_NAMES = new Set([
|
|
|
9950
9757
|
"oh-my-openagent"
|
|
9951
9758
|
]);
|
|
9952
9759
|
async function shouldBuildSourcePackages(repoRoot) {
|
|
9953
|
-
if (
|
|
9760
|
+
if (existsSync2(join13(repoRoot, "packages", "omo-opencode", "src", "index.ts")))
|
|
9954
9761
|
return true;
|
|
9955
|
-
const packageJsonPath =
|
|
9956
|
-
if (!
|
|
9762
|
+
const packageJsonPath = join13(repoRoot, "package.json");
|
|
9763
|
+
if (!existsSync2(packageJsonPath))
|
|
9957
9764
|
return true;
|
|
9958
9765
|
const packageJson = JSON.parse(await readFile9(packageJsonPath, "utf8"));
|
|
9959
9766
|
if (!isPlainRecord(packageJson) || typeof packageJson.name !== "string")
|
|
@@ -9963,7 +9770,7 @@ async function shouldBuildSourcePackages(repoRoot) {
|
|
|
9963
9770
|
|
|
9964
9771
|
// packages/omo-codex/src/install/codex-config-toml.ts
|
|
9965
9772
|
import { mkdir as mkdir5, readFile as readFile11 } from "node:fs/promises";
|
|
9966
|
-
import { dirname as
|
|
9773
|
+
import { dirname as dirname7 } from "node:path";
|
|
9967
9774
|
|
|
9968
9775
|
// packages/omo-codex/src/install/toml-section-editor.ts
|
|
9969
9776
|
function findTomlSection(config, header) {
|
|
@@ -10178,10 +9985,10 @@ function scanTomlMultilineLine(line, currentQuote) {
|
|
|
10178
9985
|
}
|
|
10179
9986
|
if (char === "#")
|
|
10180
9987
|
break;
|
|
10181
|
-
const
|
|
10182
|
-
if (
|
|
10183
|
-
const closingIndex = findTomlMultilineDelimiter(line,
|
|
10184
|
-
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 };
|
|
10185
9992
|
}
|
|
10186
9993
|
if (char === '"' || char === "'")
|
|
10187
9994
|
quote = char;
|
|
@@ -10189,12 +9996,12 @@ function scanTomlMultilineLine(line, currentQuote) {
|
|
|
10189
9996
|
}
|
|
10190
9997
|
return { wasInside: false, nextQuote: null };
|
|
10191
9998
|
}
|
|
10192
|
-
function findTomlMultilineDelimiter(line,
|
|
10193
|
-
let index = line.indexOf(
|
|
9999
|
+
function findTomlMultilineDelimiter(line, delimiter, startIndex) {
|
|
10000
|
+
let index = line.indexOf(delimiter, startIndex);
|
|
10194
10001
|
while (index !== -1) {
|
|
10195
|
-
if (
|
|
10002
|
+
if (delimiter === "'''" || countPrecedingBackslashes(line, index) % 2 === 0)
|
|
10196
10003
|
return index;
|
|
10197
|
-
index = line.indexOf(
|
|
10004
|
+
index = line.indexOf(delimiter, index + 1);
|
|
10198
10005
|
}
|
|
10199
10006
|
return -1;
|
|
10200
10007
|
}
|
|
@@ -10545,12 +10352,12 @@ function tomlKeySegment(value) {
|
|
|
10545
10352
|
|
|
10546
10353
|
// packages/omo-codex/src/install/codex-config-atomic-write.ts
|
|
10547
10354
|
import { lstat as lstat6, readlink as readlink4, realpath, rename as rename3, unlink, writeFile as writeFile5 } from "node:fs/promises";
|
|
10548
|
-
import { basename as
|
|
10355
|
+
import { basename as basename3, dirname as dirname5, isAbsolute as isAbsolute5, join as join14, resolve as resolve6 } from "node:path";
|
|
10549
10356
|
var RENAME_RETRY_DELAYS_MS = [10, 25, 50];
|
|
10550
10357
|
var RETRIABLE_RENAME_CODES = new Set(["EPERM", "EBUSY"]);
|
|
10551
10358
|
async function writeFileAtomic(targetPath, data) {
|
|
10552
10359
|
const writeTarget = await resolveSymlinkTarget(targetPath);
|
|
10553
|
-
const temporaryPath =
|
|
10360
|
+
const temporaryPath = join14(dirname5(writeTarget), `.tmp-${basename3(writeTarget)}-${process.pid}-${Date.now()}`);
|
|
10554
10361
|
await writeFile5(temporaryPath, data);
|
|
10555
10362
|
try {
|
|
10556
10363
|
await renameWithRetry(temporaryPath, writeTarget);
|
|
@@ -10579,7 +10386,7 @@ async function resolveSymlinkTarget(targetPath) {
|
|
|
10579
10386
|
if (!(error instanceof Error))
|
|
10580
10387
|
throw error;
|
|
10581
10388
|
const linkValue = await readlink4(targetPath);
|
|
10582
|
-
return isAbsolute5(linkValue) ? linkValue : resolve6(
|
|
10389
|
+
return isAbsolute5(linkValue) ? linkValue : resolve6(dirname5(targetPath), linkValue);
|
|
10583
10390
|
}
|
|
10584
10391
|
}
|
|
10585
10392
|
async function renameWithRetry(fromPath, toPath) {
|
|
@@ -10839,11 +10646,9 @@ enabled = true
|
|
|
10839
10646
|
function ensureOmoBuiltinMcpPolicies(config, input) {
|
|
10840
10647
|
if (input.marketplaceName !== "sisyphuslabs" || !input.pluginNames.includes("omo"))
|
|
10841
10648
|
return config;
|
|
10842
|
-
const codegraphEnabled = input.codegraphMcpEnabled ?? true;
|
|
10843
10649
|
const gitBashEnabled = (input.platform ?? process.platform) === "win32" && input.gitBashEnabled === true;
|
|
10844
10650
|
let nextConfig = removeStaleContext7PlaceholderMcp(config);
|
|
10845
10651
|
nextConfig = ensurePluginMcpEnabled(nextConfig, "omo@sisyphuslabs", "context7", true);
|
|
10846
|
-
nextConfig = ensurePluginMcpEnabled(nextConfig, "omo@sisyphuslabs", "codegraph", codegraphEnabled);
|
|
10847
10652
|
nextConfig = ensurePluginMcpEnabled(nextConfig, "omo@sisyphuslabs", "git_bash", gitBashEnabled);
|
|
10848
10653
|
return nextConfig;
|
|
10849
10654
|
}
|
|
@@ -11055,7 +10860,7 @@ function isRootSetting(line, key) {
|
|
|
11055
10860
|
|
|
11056
10861
|
// packages/omo-codex/src/install/codex-model-catalog.ts
|
|
11057
10862
|
import { readFile as readFile10 } from "node:fs/promises";
|
|
11058
|
-
import { join as
|
|
10863
|
+
import { join as join15 } from "node:path";
|
|
11059
10864
|
var FALLBACK_CODEX_MODEL_CATALOG = {
|
|
11060
10865
|
current: {
|
|
11061
10866
|
model: "gpt-5.6-sol",
|
|
@@ -11080,7 +10885,7 @@ var FALLBACK_CODEX_MODEL_CATALOG = {
|
|
|
11080
10885
|
]
|
|
11081
10886
|
};
|
|
11082
10887
|
async function readCodexModelCatalog(codexPackageRoot) {
|
|
11083
|
-
const catalogPath =
|
|
10888
|
+
const catalogPath = join15(codexPackageRoot, "plugin", "model-catalog.json");
|
|
11084
10889
|
try {
|
|
11085
10890
|
const parsed = JSON.parse(await readFile10(catalogPath, "utf8"));
|
|
11086
10891
|
return parseCodexModelCatalog(parsed) ?? FALLBACK_CODEX_MODEL_CATALOG;
|
|
@@ -11164,7 +10969,7 @@ function isRootSetting2(line, key) {
|
|
|
11164
10969
|
|
|
11165
10970
|
// packages/omo-codex/src/install/codex-multi-agent-v2-config.ts
|
|
11166
10971
|
import { readFileSync } from "node:fs";
|
|
11167
|
-
import { dirname as
|
|
10972
|
+
import { dirname as dirname6, isAbsolute as isAbsolute6, join as join16 } from "node:path";
|
|
11168
10973
|
var CODEX_AGENTS_HEADER = "agents";
|
|
11169
10974
|
var CODEX_MULTI_AGENT_V2_HEADER = "features.multi_agent_v2";
|
|
11170
10975
|
var CODEX_MULTI_AGENT_V2_THREAD_LIMIT_KEY = `${CODEX_MULTI_AGENT_V2_HEADER}.max_concurrent_threads_per_session`;
|
|
@@ -11201,8 +11006,8 @@ function resolveCodexMultiAgentVersion(config, configPath) {
|
|
|
11201
11006
|
}
|
|
11202
11007
|
function resolveCatalogPath(configuredPath, configPath) {
|
|
11203
11008
|
if (configuredPath === null)
|
|
11204
|
-
return
|
|
11205
|
-
return isAbsolute6(configuredPath) ? configuredPath :
|
|
11009
|
+
return join16(dirname6(configPath), "models_cache.json");
|
|
11010
|
+
return isAbsolute6(configuredPath) ? configuredPath : join16(dirname6(configPath), configuredPath);
|
|
11206
11011
|
}
|
|
11207
11012
|
function readCatalogMultiAgentVersion(model, cachePath) {
|
|
11208
11013
|
let raw;
|
|
@@ -11306,7 +11111,7 @@ function readBooleanSetting(sectionText, key) {
|
|
|
11306
11111
|
|
|
11307
11112
|
// packages/omo-codex/src/install/codex-config-toml.ts
|
|
11308
11113
|
async function updateCodexConfig(input) {
|
|
11309
|
-
await mkdir5(
|
|
11114
|
+
await mkdir5(dirname7(input.configPath), { recursive: true });
|
|
11310
11115
|
let config;
|
|
11311
11116
|
try {
|
|
11312
11117
|
config = await readFile11(input.configPath, "utf8");
|
|
@@ -11357,7 +11162,7 @@ function isMissingFileError(error) {
|
|
|
11357
11162
|
// packages/omo-codex/src/install/codex-hook-trust.ts
|
|
11358
11163
|
import { createHash } from "node:crypto";
|
|
11359
11164
|
import { readFile as readFile12 } from "node:fs/promises";
|
|
11360
|
-
import { join as
|
|
11165
|
+
import { join as join17 } from "node:path";
|
|
11361
11166
|
var EVENT_LABELS = new Map([
|
|
11362
11167
|
["PreToolUse", "pre_tool_use"],
|
|
11363
11168
|
["PermissionRequest", "permission_request"],
|
|
@@ -11371,7 +11176,7 @@ var EVENT_LABELS = new Map([
|
|
|
11371
11176
|
["Stop", "stop"]
|
|
11372
11177
|
]);
|
|
11373
11178
|
async function trustedHookStatesForPlugin(input) {
|
|
11374
|
-
const manifestPath =
|
|
11179
|
+
const manifestPath = join17(input.pluginRoot, ".codex-plugin", "plugin.json");
|
|
11375
11180
|
if (!await exists(manifestPath))
|
|
11376
11181
|
return [];
|
|
11377
11182
|
const manifest = JSON.parse(await readFile12(manifestPath, "utf8"));
|
|
@@ -11379,7 +11184,7 @@ async function trustedHookStatesForPlugin(input) {
|
|
|
11379
11184
|
return [];
|
|
11380
11185
|
const states = [];
|
|
11381
11186
|
for (const hookPath of hookManifestPaths2(manifest.hooks)) {
|
|
11382
|
-
const hooksPath =
|
|
11187
|
+
const hooksPath = join17(input.pluginRoot, hookPath);
|
|
11383
11188
|
if (!await exists(hooksPath))
|
|
11384
11189
|
continue;
|
|
11385
11190
|
const parsed = JSON.parse(await readFile12(hooksPath, "utf8"));
|
|
@@ -11505,11 +11310,11 @@ function toCodexResolution(resolution) {
|
|
|
11505
11310
|
|
|
11506
11311
|
// packages/omo-codex/src/install/link-cached-plugin-agents.ts
|
|
11507
11312
|
import { copyFile, lstat as lstat9, mkdir as mkdir6, readdir as readdir7, rm as rm8, writeFile as writeFile7 } from "node:fs/promises";
|
|
11508
|
-
import { basename as
|
|
11313
|
+
import { basename as basename4, join as join20 } from "node:path";
|
|
11509
11314
|
|
|
11510
11315
|
// packages/omo-codex/src/install/preserved-agent-settings.ts
|
|
11511
11316
|
import { lstat as lstat7, readFile as readFile13, readdir as readdir6, writeFile as writeFile6 } from "node:fs/promises";
|
|
11512
|
-
import { join as
|
|
11317
|
+
import { join as join18 } from "node:path";
|
|
11513
11318
|
|
|
11514
11319
|
// packages/omo-codex/src/install/managed-agent-reasoning-defaults.ts
|
|
11515
11320
|
var MANAGED_REASONING_DEFAULT_UPGRADES = new Map([
|
|
@@ -11644,7 +11449,7 @@ function resolveManagedAgentReasoning(input) {
|
|
|
11644
11449
|
|
|
11645
11450
|
// packages/omo-codex/src/install/preserved-agent-settings.ts
|
|
11646
11451
|
async function capturePreservedAgentReasoning(input) {
|
|
11647
|
-
const agentsDir =
|
|
11452
|
+
const agentsDir = join18(input.codexHome, "agents");
|
|
11648
11453
|
if (!await exists2(agentsDir))
|
|
11649
11454
|
return new Map;
|
|
11650
11455
|
const preserved = new Map;
|
|
@@ -11652,7 +11457,7 @@ async function capturePreservedAgentReasoning(input) {
|
|
|
11652
11457
|
for (const entry of agentEntries) {
|
|
11653
11458
|
if (!entry.name.endsWith(".toml"))
|
|
11654
11459
|
continue;
|
|
11655
|
-
const content = await readTextIfExists(
|
|
11460
|
+
const content = await readTextIfExists(join18(agentsDir, entry.name));
|
|
11656
11461
|
if (content === null)
|
|
11657
11462
|
continue;
|
|
11658
11463
|
const effort = extractReasoningEffort(content);
|
|
@@ -11666,7 +11471,7 @@ async function capturePreservedAgentReasoning(input) {
|
|
|
11666
11471
|
return preserved;
|
|
11667
11472
|
}
|
|
11668
11473
|
async function capturePreservedAgentServiceTier(input) {
|
|
11669
|
-
const agentsDir =
|
|
11474
|
+
const agentsDir = join18(input.codexHome, "agents");
|
|
11670
11475
|
if (!await exists2(agentsDir))
|
|
11671
11476
|
return new Map;
|
|
11672
11477
|
const preserved = new Map;
|
|
@@ -11674,7 +11479,7 @@ async function capturePreservedAgentServiceTier(input) {
|
|
|
11674
11479
|
for (const entry of agentEntries) {
|
|
11675
11480
|
if (!entry.name.endsWith(".toml"))
|
|
11676
11481
|
continue;
|
|
11677
|
-
const content = await readTextIfExists(
|
|
11482
|
+
const content = await readTextIfExists(join18(agentsDir, entry.name));
|
|
11678
11483
|
if (content === null)
|
|
11679
11484
|
continue;
|
|
11680
11485
|
preserved.set(agentNameFromToml(entry.name), extractServiceTier(content));
|
|
@@ -11808,7 +11613,7 @@ function nodeErrorCode(error) {
|
|
|
11808
11613
|
|
|
11809
11614
|
// packages/omo-codex/src/install/retired-managed-agent-purge.ts
|
|
11810
11615
|
import { lstat as lstat8, readFile as readFile14, rm as rm7 } from "node:fs/promises";
|
|
11811
|
-
import { join as
|
|
11616
|
+
import { join as join19 } from "node:path";
|
|
11812
11617
|
var RETIRED_MANAGED_AGENT_FILES = [
|
|
11813
11618
|
{
|
|
11814
11619
|
fileName: "codex-ultrawork-reviewer.toml",
|
|
@@ -11820,11 +11625,11 @@ var RETIRED_MANAGED_AGENT_FILES = [
|
|
|
11820
11625
|
}
|
|
11821
11626
|
];
|
|
11822
11627
|
async function purgeRetiredManagedAgentFiles(input) {
|
|
11823
|
-
const agentsDir =
|
|
11628
|
+
const agentsDir = join19(input.codexHome, "agents");
|
|
11824
11629
|
if (!await exists3(agentsDir))
|
|
11825
11630
|
return;
|
|
11826
11631
|
for (const retiredAgent of RETIRED_MANAGED_AGENT_FILES) {
|
|
11827
|
-
const agentPath =
|
|
11632
|
+
const agentPath = join19(agentsDir, retiredAgent.fileName);
|
|
11828
11633
|
if (!await exists3(agentPath))
|
|
11829
11634
|
continue;
|
|
11830
11635
|
const agentStat = await lstat8(agentPath);
|
|
@@ -11873,13 +11678,13 @@ async function linkCachedPluginAgents(input) {
|
|
|
11873
11678
|
await writeManifest(input.pluginRoot, []);
|
|
11874
11679
|
return [];
|
|
11875
11680
|
}
|
|
11876
|
-
const agentsDir =
|
|
11681
|
+
const agentsDir = join20(input.codexHome, "agents");
|
|
11877
11682
|
await mkdir6(agentsDir, { recursive: true });
|
|
11878
11683
|
const linked = [];
|
|
11879
11684
|
for (const agentPath of bundledAgents) {
|
|
11880
|
-
const agentFileName =
|
|
11685
|
+
const agentFileName = basename4(agentPath);
|
|
11881
11686
|
const agentName = agentNameFromToml2(agentFileName);
|
|
11882
|
-
const linkPath =
|
|
11687
|
+
const linkPath = join20(agentsDir, agentFileName);
|
|
11883
11688
|
await replaceWithCopy(linkPath, agentPath);
|
|
11884
11689
|
await restorePreservedReasoning({
|
|
11885
11690
|
agentName,
|
|
@@ -11898,7 +11703,7 @@ async function linkCachedPluginAgents(input) {
|
|
|
11898
11703
|
return linked;
|
|
11899
11704
|
}
|
|
11900
11705
|
async function discoverBundledAgents(pluginRoot) {
|
|
11901
|
-
const componentsRoot =
|
|
11706
|
+
const componentsRoot = join20(pluginRoot, "components");
|
|
11902
11707
|
if (!await exists4(componentsRoot))
|
|
11903
11708
|
return [];
|
|
11904
11709
|
const componentEntries = await readdir7(componentsRoot, { withFileTypes: true });
|
|
@@ -11906,14 +11711,14 @@ async function discoverBundledAgents(pluginRoot) {
|
|
|
11906
11711
|
for (const entry of componentEntries) {
|
|
11907
11712
|
if (!entry.isDirectory())
|
|
11908
11713
|
continue;
|
|
11909
|
-
const agentsRoot =
|
|
11714
|
+
const agentsRoot = join20(componentsRoot, entry.name, "agents");
|
|
11910
11715
|
if (!await exists4(agentsRoot))
|
|
11911
11716
|
continue;
|
|
11912
11717
|
const agentEntries = await readdir7(agentsRoot, { withFileTypes: true });
|
|
11913
11718
|
for (const file of agentEntries) {
|
|
11914
11719
|
if (!file.isFile() || !file.name.endsWith(".toml"))
|
|
11915
11720
|
continue;
|
|
11916
|
-
agents.push(
|
|
11721
|
+
agents.push(join20(agentsRoot, file.name));
|
|
11917
11722
|
}
|
|
11918
11723
|
}
|
|
11919
11724
|
agents.sort();
|
|
@@ -11933,7 +11738,7 @@ async function prepareReplacement(linkPath) {
|
|
|
11933
11738
|
await rm8(linkPath, { force: true });
|
|
11934
11739
|
}
|
|
11935
11740
|
async function writeManifest(pluginRoot, agentPaths) {
|
|
11936
|
-
const manifestPath =
|
|
11741
|
+
const manifestPath = join20(pluginRoot, MANIFEST_FILE);
|
|
11937
11742
|
const payload = { agents: [...agentPaths].sort() };
|
|
11938
11743
|
await writeFile7(manifestPath, `${JSON.stringify(payload, null, "\t")}
|
|
11939
11744
|
`);
|
|
@@ -11959,10 +11764,10 @@ function nodeErrorCode3(error) {
|
|
|
11959
11764
|
|
|
11960
11765
|
// packages/omo-codex/src/install/codex-marketplace.ts
|
|
11961
11766
|
import { readFile as readFile15 } from "node:fs/promises";
|
|
11962
|
-
import { join as
|
|
11767
|
+
import { join as join21 } from "node:path";
|
|
11963
11768
|
var DEFAULT_MARKETPLACE_PATH = "packages/omo-codex/marketplace.json";
|
|
11964
11769
|
async function readMarketplace(repoRoot, options) {
|
|
11965
|
-
const marketplacePath = options?.marketplacePath ??
|
|
11770
|
+
const marketplacePath = options?.marketplacePath ?? join21(repoRoot, DEFAULT_MARKETPLACE_PATH);
|
|
11966
11771
|
const raw = await readFile15(marketplacePath, "utf8");
|
|
11967
11772
|
const parsed = JSON.parse(raw);
|
|
11968
11773
|
if (!isPlainRecord(parsed))
|
|
@@ -11981,10 +11786,10 @@ async function readMarketplace(repoRoot, options) {
|
|
|
11981
11786
|
function resolvePluginSource(repoRoot, plugin, options) {
|
|
11982
11787
|
const sourcePath = localSourcePath(options?.pathOverride ?? plugin.source);
|
|
11983
11788
|
const relativePath = sourcePath.slice(2);
|
|
11984
|
-
return
|
|
11789
|
+
return join21(repoRoot, ...relativePath.split(/[\\/]/));
|
|
11985
11790
|
}
|
|
11986
11791
|
async function readPluginManifest(pluginRoot) {
|
|
11987
|
-
const raw = await readFile15(
|
|
11792
|
+
const raw = await readFile15(join21(pluginRoot, ".codex-plugin", "plugin.json"), "utf8");
|
|
11988
11793
|
const parsed = JSON.parse(raw);
|
|
11989
11794
|
if (!isPlainRecord(parsed))
|
|
11990
11795
|
throw new Error(`${pluginRoot} plugin.json must be an object`);
|
|
@@ -12066,7 +11871,7 @@ function validateLocalSourcePath(path) {
|
|
|
12066
11871
|
|
|
12067
11872
|
// packages/omo-codex/src/install/codex-marketplace-snapshot.ts
|
|
12068
11873
|
import { cp as cp3, mkdir as mkdir7, rename as rename4, rm as rm9, writeFile as writeFile8 } from "node:fs/promises";
|
|
12069
|
-
import { join as
|
|
11874
|
+
import { join as join22, sep as sep6 } from "node:path";
|
|
12070
11875
|
var INSTALLED_MARKETPLACES_DIR = ".tmp/marketplaces";
|
|
12071
11876
|
async function writeInstalledMarketplaceSnapshot(input) {
|
|
12072
11877
|
const marketplaceRoot = installedMarketplaceRoot(input.codexHome, input.marketplace.name);
|
|
@@ -12079,21 +11884,21 @@ async function writeInstalledMarketplaceSnapshot(input) {
|
|
|
12079
11884
|
return snapshotPlugins;
|
|
12080
11885
|
}
|
|
12081
11886
|
function installedMarketplaceRoot(codexHome, marketplaceName) {
|
|
12082
|
-
return
|
|
11887
|
+
return join22(codexHome, INSTALLED_MARKETPLACES_DIR, marketplaceName);
|
|
12083
11888
|
}
|
|
12084
11889
|
async function writeMarketplaceManifest(marketplaceRoot, marketplace) {
|
|
12085
|
-
const manifestDir =
|
|
11890
|
+
const manifestDir = join22(marketplaceRoot, ".agents", "plugins");
|
|
12086
11891
|
await mkdir7(manifestDir, { recursive: true });
|
|
12087
|
-
const tempPath =
|
|
11892
|
+
const tempPath = join22(manifestDir, `.marketplace-${process.pid}-${Date.now()}.json.tmp`);
|
|
12088
11893
|
await writeFile8(tempPath, `${JSON.stringify(marketplace, null, "\t")}
|
|
12089
11894
|
`);
|
|
12090
|
-
await rename4(tempPath,
|
|
11895
|
+
await rename4(tempPath, join22(manifestDir, "marketplace.json"));
|
|
12091
11896
|
}
|
|
12092
11897
|
async function writeSnapshotPlugin(marketplaceRoot, plugin) {
|
|
12093
|
-
const pluginsDir =
|
|
11898
|
+
const pluginsDir = join22(marketplaceRoot, "plugins");
|
|
12094
11899
|
await mkdir7(pluginsDir, { recursive: true });
|
|
12095
|
-
const targetPath =
|
|
12096
|
-
const tempPath =
|
|
11900
|
+
const targetPath = join22(pluginsDir, plugin.name);
|
|
11901
|
+
const tempPath = join22(pluginsDir, `.tmp-${plugin.name}-${process.pid}-${Date.now()}`);
|
|
12097
11902
|
await rm9(tempPath, { recursive: true, force: true });
|
|
12098
11903
|
await cp3(plugin.sourcePath, tempPath, {
|
|
12099
11904
|
recursive: true,
|
|
@@ -12115,10 +11920,10 @@ function shouldCopyMarketplaceSourcePath(path, root) {
|
|
|
12115
11920
|
|
|
12116
11921
|
// packages/omo-codex/src/install/lazycodex-version-stamp.ts
|
|
12117
11922
|
import { readdir as readdir8, readFile as readFile16, writeFile as writeFile9 } from "node:fs/promises";
|
|
12118
|
-
import { join as
|
|
11923
|
+
import { join as join23 } from "node:path";
|
|
12119
11924
|
async function readDistributionManifest(repoRoot) {
|
|
12120
11925
|
try {
|
|
12121
|
-
const parsed = JSON.parse(await readFile16(
|
|
11926
|
+
const parsed = JSON.parse(await readFile16(join23(repoRoot, "package.json"), "utf8"));
|
|
12122
11927
|
if (!isPlainRecord(parsed) || typeof parsed.version !== "string" || parsed.version.trim().length === 0)
|
|
12123
11928
|
return;
|
|
12124
11929
|
return {
|
|
@@ -12142,19 +11947,19 @@ function resolveLazyCodexPluginVersion(input) {
|
|
|
12142
11947
|
return input.manifestVersion ?? "local";
|
|
12143
11948
|
}
|
|
12144
11949
|
async function stampLazyCodexPluginVersion(input) {
|
|
12145
|
-
const manifestPath =
|
|
11950
|
+
const manifestPath = join23(input.pluginRoot, ".codex-plugin", "plugin.json");
|
|
12146
11951
|
const hookPaths = await readPluginHookPaths(manifestPath);
|
|
12147
11952
|
await stampJsonVersion(manifestPath, input.version);
|
|
12148
|
-
await stampJsonVersion(
|
|
11953
|
+
await stampJsonVersion(join23(input.pluginRoot, "package.json"), input.version);
|
|
12149
11954
|
for (const hookPath of hookPaths) {
|
|
12150
|
-
await stampHookStatusMessages(
|
|
11955
|
+
await stampHookStatusMessages(join23(input.pluginRoot, hookPath), input.version);
|
|
12151
11956
|
}
|
|
12152
11957
|
await stampComponentVersions(input);
|
|
12153
11958
|
}
|
|
12154
11959
|
async function writeLazyCodexInstallSnapshot(input) {
|
|
12155
11960
|
if (input.distributionManifest === undefined)
|
|
12156
11961
|
return;
|
|
12157
|
-
await writeFile9(
|
|
11962
|
+
await writeFile9(join23(input.pluginRoot, "lazycodex-install.json"), `${JSON.stringify({
|
|
12158
11963
|
packageName: input.distributionManifest.name,
|
|
12159
11964
|
version: input.distributionManifest.version
|
|
12160
11965
|
}, null, "\t")}
|
|
@@ -12211,16 +12016,16 @@ async function stampHookStatusMessages(path, version) {
|
|
|
12211
12016
|
async function stampComponentVersions(input) {
|
|
12212
12017
|
let entries;
|
|
12213
12018
|
try {
|
|
12214
|
-
entries = await readdir8(
|
|
12019
|
+
entries = await readdir8(join23(input.pluginRoot, "components"));
|
|
12215
12020
|
} catch (error) {
|
|
12216
12021
|
if (error instanceof Error)
|
|
12217
12022
|
return;
|
|
12218
12023
|
throw error;
|
|
12219
12024
|
}
|
|
12220
12025
|
for (const entry of entries) {
|
|
12221
|
-
const componentRoot =
|
|
12222
|
-
await stampJsonVersion(
|
|
12223
|
-
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);
|
|
12224
12029
|
}
|
|
12225
12030
|
}
|
|
12226
12031
|
function stampHookGroups(hooks, version) {
|
|
@@ -12250,7 +12055,7 @@ function normalizeHookStatusVersion(version) {
|
|
|
12250
12055
|
|
|
12251
12056
|
// packages/omo-codex/src/install/codex-project-local-cleanup.ts
|
|
12252
12057
|
import { copyFile as copyFile2, lstat as lstat10, readFile as readFile17, writeFile as writeFile10 } from "node:fs/promises";
|
|
12253
|
-
import { dirname as
|
|
12058
|
+
import { dirname as dirname8, join as join24, resolve as resolve7 } from "node:path";
|
|
12254
12059
|
var LEGACY_AGENT_CONFLICT_KEYS = ["max_threads"];
|
|
12255
12060
|
var PROJECT_LOCAL_ARTIFACT_PATHS = [
|
|
12256
12061
|
".codex/hooks.json",
|
|
@@ -12353,37 +12158,37 @@ async function findProjectLocalCodexConfigs(startDirectory, codexHome) {
|
|
|
12353
12158
|
if (startDirectoryStat !== null && !startDirectoryStat.isDirectory()) {
|
|
12354
12159
|
throw new ProjectLocalCleanupStartDirectoryError(startDirectory);
|
|
12355
12160
|
}
|
|
12356
|
-
const codexHomeConfigPath = codexHome === undefined ? null :
|
|
12161
|
+
const codexHomeConfigPath = codexHome === undefined ? null : join24(resolve7(codexHome), "config.toml");
|
|
12357
12162
|
let current = resolve7(startDirectory);
|
|
12358
12163
|
const configPathsFromCwd = [];
|
|
12359
12164
|
while (true) {
|
|
12360
|
-
const configPath =
|
|
12165
|
+
const configPath = join24(current, ".codex", "config.toml");
|
|
12361
12166
|
if (await isRegularProjectLocalConfig(current, configPath)) {
|
|
12362
12167
|
if (codexHomeConfigPath === null || resolve7(configPath) !== codexHomeConfigPath) {
|
|
12363
12168
|
configPathsFromCwd.push(configPath);
|
|
12364
12169
|
}
|
|
12365
12170
|
}
|
|
12366
|
-
if (await exists5(
|
|
12171
|
+
if (await exists5(join24(current, ".git"))) {
|
|
12367
12172
|
return configPathsFromCwd.length === 0 ? null : {
|
|
12368
12173
|
projectRoot: current,
|
|
12369
12174
|
configPaths: [...configPathsFromCwd].reverse(),
|
|
12370
12175
|
artifactRoots: artifactRootsForConfigPaths(configPathsFromCwd)
|
|
12371
12176
|
};
|
|
12372
12177
|
}
|
|
12373
|
-
const parent =
|
|
12178
|
+
const parent = dirname8(current);
|
|
12374
12179
|
if (parent === current) {
|
|
12375
12180
|
const nearestConfigPath = configPathsFromCwd[0];
|
|
12376
12181
|
return nearestConfigPath === undefined ? null : {
|
|
12377
|
-
projectRoot:
|
|
12182
|
+
projectRoot: dirname8(dirname8(nearestConfigPath)),
|
|
12378
12183
|
configPaths: [nearestConfigPath],
|
|
12379
|
-
artifactRoots: [
|
|
12184
|
+
artifactRoots: [dirname8(dirname8(nearestConfigPath))]
|
|
12380
12185
|
};
|
|
12381
12186
|
}
|
|
12382
12187
|
current = parent;
|
|
12383
12188
|
}
|
|
12384
12189
|
}
|
|
12385
12190
|
async function isRegularProjectLocalConfig(directory, configPath) {
|
|
12386
|
-
const codexDirStat = await maybeLstat(
|
|
12191
|
+
const codexDirStat = await maybeLstat(join24(directory, ".codex"));
|
|
12387
12192
|
if (codexDirStat === null || !codexDirStat.isDirectory() || codexDirStat.isSymbolicLink())
|
|
12388
12193
|
return false;
|
|
12389
12194
|
const configStat = await maybeLstat(configPath);
|
|
@@ -12392,7 +12197,7 @@ async function isRegularProjectLocalConfig(directory, configPath) {
|
|
|
12392
12197
|
function artifactRootsForConfigPaths(configPaths) {
|
|
12393
12198
|
const roots = [];
|
|
12394
12199
|
for (const configPath of configPaths) {
|
|
12395
|
-
const root =
|
|
12200
|
+
const root = dirname8(dirname8(configPath));
|
|
12396
12201
|
if (!roots.includes(root))
|
|
12397
12202
|
roots.push(root);
|
|
12398
12203
|
}
|
|
@@ -12403,7 +12208,7 @@ async function collectProjectLocalArtifacts(projectRoots) {
|
|
|
12403
12208
|
const seenPaths = new Set;
|
|
12404
12209
|
for (const projectRoot of projectRoots) {
|
|
12405
12210
|
for (const relativePath of PROJECT_LOCAL_ARTIFACT_PATHS) {
|
|
12406
|
-
const artifactPath =
|
|
12211
|
+
const artifactPath = join24(projectRoot, relativePath);
|
|
12407
12212
|
if (seenPaths.has(artifactPath))
|
|
12408
12213
|
continue;
|
|
12409
12214
|
const entryStat = await maybeLstat(artifactPath);
|
|
@@ -12481,13 +12286,13 @@ function formatUnknownError(error) {
|
|
|
12481
12286
|
import { createHash as createHash2 } from "node:crypto";
|
|
12482
12287
|
import { lstat as lstat11, readFile as readFile19, readdir as readdir10, rm as rm10 } from "node:fs/promises";
|
|
12483
12288
|
import { tmpdir } from "node:os";
|
|
12484
|
-
import { join as
|
|
12289
|
+
import { join as join25, posix } from "node:path";
|
|
12485
12290
|
|
|
12486
12291
|
// packages/omo-codex/src/install/lsp-daemon-reaper-attestation.ts
|
|
12487
12292
|
import { execFile } from "node:child_process";
|
|
12488
12293
|
import { readFile as readFile18, readdir as readdir9, readlink as readlink5 } from "node:fs/promises";
|
|
12489
12294
|
import { connect } from "node:net";
|
|
12490
|
-
import { basename as
|
|
12295
|
+
import { basename as basename5 } from "node:path";
|
|
12491
12296
|
var PROBE_TIMEOUT_MS = 500;
|
|
12492
12297
|
async function probeLegacyJsonRpcEndpoint(endpoint, timeoutMs = PROBE_TIMEOUT_MS) {
|
|
12493
12298
|
return await new Promise((resolve8) => {
|
|
@@ -12619,14 +12424,14 @@ function splitCmdline(buffer) {
|
|
|
12619
12424
|
function isNodeCliDaemonArgv(argv) {
|
|
12620
12425
|
if (argv.length < 2 || !argv.includes("daemon"))
|
|
12621
12426
|
return false;
|
|
12622
|
-
const executable =
|
|
12427
|
+
const executable = basename5(argv[0] ?? "");
|
|
12623
12428
|
if (!/^node(?:\.exe)?$/i.test(executable))
|
|
12624
12429
|
return false;
|
|
12625
12430
|
return argv.some((value) => value === "cli.js" || value.endsWith("/cli.js") || value.endsWith("\\cli.js"));
|
|
12626
12431
|
}
|
|
12627
12432
|
function lsofShowsUnixEndpoint(output, pid, endpoint) {
|
|
12628
12433
|
const lines = output.split(/\r?\n/).filter((line) => line.length > 0);
|
|
12629
|
-
const endpointName =
|
|
12434
|
+
const endpointName = basename5(endpoint);
|
|
12630
12435
|
return lines.includes(`p${pid}`) && lines.some((line) => line === `n${endpoint}` || line === `n${endpointName}`);
|
|
12631
12436
|
}
|
|
12632
12437
|
function isNodeCliDaemonCommand(command) {
|
|
@@ -12654,7 +12459,7 @@ async function readBinary(readFileImpl, path) {
|
|
|
12654
12459
|
var LEGACY_EXIT_WAIT_TIMEOUT_MS = 5000;
|
|
12655
12460
|
var LEGACY_VERSION_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._+-]{0,127}$/;
|
|
12656
12461
|
async function reapLspDaemons(codexHome, deps = {}) {
|
|
12657
|
-
const daemonRoot =
|
|
12462
|
+
const daemonRoot = join25(codexHome, "codex-lsp", "daemon");
|
|
12658
12463
|
const platform = deps.platform ?? process.platform;
|
|
12659
12464
|
const tmpDir = deps.tmpDir ?? tmpdir();
|
|
12660
12465
|
const probe = deps.probeLegacyJsonRpc ?? probeLegacyJsonRpcEndpoint;
|
|
@@ -12664,7 +12469,7 @@ async function reapLspDaemons(codexHome, deps = {}) {
|
|
|
12664
12469
|
const entries = await readdir10(daemonRoot, { withFileTypes: true }).catch(() => []);
|
|
12665
12470
|
const results = [];
|
|
12666
12471
|
for (const entry of [...entries].sort((left, right) => left.name.localeCompare(right.name))) {
|
|
12667
|
-
const versionPath =
|
|
12472
|
+
const versionPath = join25(daemonRoot, entry.name);
|
|
12668
12473
|
const parsedVersion = parseVersionEntry(entry.name);
|
|
12669
12474
|
if (parsedVersion === null || !entry.isDirectory()) {
|
|
12670
12475
|
await removeVersionDir(versionPath);
|
|
@@ -12712,7 +12517,7 @@ function parseVersionEntry(entryName) {
|
|
|
12712
12517
|
return LEGACY_VERSION_PATTERN.test(version) ? version : null;
|
|
12713
12518
|
}
|
|
12714
12519
|
async function readLegacyMetadata(input) {
|
|
12715
|
-
const pidText = await readRegularTrimmedFile(
|
|
12520
|
+
const pidText = await readRegularTrimmedFile(join25(input.versionPath, "daemon.pid"));
|
|
12716
12521
|
if (pidText === "non_regular")
|
|
12717
12522
|
return { kind: "remove", reason: "removed non-regular legacy daemon metadata" };
|
|
12718
12523
|
if (pidText === null)
|
|
@@ -12720,7 +12525,7 @@ async function readLegacyMetadata(input) {
|
|
|
12720
12525
|
const pid = Number.parseInt(pidText, 10);
|
|
12721
12526
|
if (!Number.isInteger(pid) || pid <= 0)
|
|
12722
12527
|
return { kind: "remove", reason: "removed malformed legacy daemon metadata" };
|
|
12723
|
-
const endpointText = await readRegularTrimmedFile(
|
|
12528
|
+
const endpointText = await readRegularTrimmedFile(join25(input.versionPath, "daemon.endpoint"));
|
|
12724
12529
|
if (endpointText === "non_regular")
|
|
12725
12530
|
return { kind: "remove", reason: "removed non-regular legacy daemon metadata" };
|
|
12726
12531
|
if (endpointText === null)
|
|
@@ -12799,7 +12604,7 @@ function processIsRunning(pid) {
|
|
|
12799
12604
|
|
|
12800
12605
|
// packages/omo-codex/src/install/codex-installer-bin-dir.ts
|
|
12801
12606
|
import { homedir } from "node:os";
|
|
12802
|
-
import { join as
|
|
12607
|
+
import { join as join26, resolve as resolve8 } from "node:path";
|
|
12803
12608
|
function resolveCodexInstallerBinDir(input) {
|
|
12804
12609
|
const explicitBinDir = input.binDir ?? input.env?.CODEX_LOCAL_BIN_DIR;
|
|
12805
12610
|
if (explicitBinDir !== undefined && explicitBinDir.trim().length > 0)
|
|
@@ -12808,22 +12613,22 @@ function resolveCodexInstallerBinDir(input) {
|
|
|
12808
12613
|
const defaultCodexHome = resolve8(homeDir, ".codex");
|
|
12809
12614
|
const resolvedCodexHome = resolve8(input.codexHome);
|
|
12810
12615
|
if (resolvedCodexHome !== defaultCodexHome)
|
|
12811
|
-
return
|
|
12616
|
+
return join26(resolvedCodexHome, "bin");
|
|
12812
12617
|
return resolve8(homeDir, ".local", "bin");
|
|
12813
12618
|
}
|
|
12814
12619
|
|
|
12815
12620
|
// packages/omo-codex/src/install/codex-installed-bin-dir.ts
|
|
12816
12621
|
import { readFile as readFile20, readdir as readdir11, writeFile as writeFile11 } from "node:fs/promises";
|
|
12817
|
-
import { join as
|
|
12622
|
+
import { join as join27 } from "node:path";
|
|
12818
12623
|
var INSTALLED_BIN_DIR_MANIFEST = ".installed-bin-dir.json";
|
|
12819
12624
|
async function writeInstalledCodexBinDir(input) {
|
|
12820
|
-
await writeFile11(
|
|
12625
|
+
await writeFile11(join27(input.pluginRoot, INSTALLED_BIN_DIR_MANIFEST), `${JSON.stringify({ binDir: input.binDir }, null, 2)}
|
|
12821
12626
|
`);
|
|
12822
12627
|
}
|
|
12823
12628
|
|
|
12824
12629
|
// packages/omo-codex/src/install/codex-git-bash-hooks.ts
|
|
12825
12630
|
import { readFile as readFile21, writeFile as writeFile12 } from "node:fs/promises";
|
|
12826
|
-
import { join as
|
|
12631
|
+
import { join as join28 } from "node:path";
|
|
12827
12632
|
var WINDOWS_ONLY_GIT_BASH_HOOKS = new Set([
|
|
12828
12633
|
"./hooks/pre-tool-use-recommending-git-bash-mcp.json",
|
|
12829
12634
|
"./hooks/post-compact-resetting-git-bash-mcp-reminder.json"
|
|
@@ -12831,7 +12636,7 @@ var WINDOWS_ONLY_GIT_BASH_HOOKS = new Set([
|
|
|
12831
12636
|
async function removeGitBashHooksOffWindows(input) {
|
|
12832
12637
|
if (input.platform === "win32")
|
|
12833
12638
|
return;
|
|
12834
|
-
const manifestPath =
|
|
12639
|
+
const manifestPath = join28(input.pluginRoot, ".codex-plugin", "plugin.json");
|
|
12835
12640
|
const parsed = JSON.parse(await readFile21(manifestPath, "utf8"));
|
|
12836
12641
|
if (!isPlainRecord(parsed) || !Array.isArray(parsed.hooks))
|
|
12837
12642
|
return;
|
|
@@ -12843,10 +12648,10 @@ async function removeGitBashHooksOffWindows(input) {
|
|
|
12843
12648
|
}
|
|
12844
12649
|
|
|
12845
12650
|
// packages/omo-codex/src/install/omo-sot-migration.ts
|
|
12846
|
-
import { join as
|
|
12651
|
+
import { join as join29 } from "node:path";
|
|
12847
12652
|
async function seedAndMigrateOmoSot(input) {
|
|
12848
12653
|
const commandEnv = { ...input.env };
|
|
12849
|
-
const scriptPath =
|
|
12654
|
+
const scriptPath = join29(input.repoRoot, "packages", "omo-codex", "plugin", "scripts", "migrate-omo-sot.mjs");
|
|
12850
12655
|
try {
|
|
12851
12656
|
await input.runCommand(process.execPath, [scriptPath, "--seed"], {
|
|
12852
12657
|
cwd: input.repoRoot,
|
|
@@ -12860,12 +12665,12 @@ async function seedAndMigrateOmoSot(input) {
|
|
|
12860
12665
|
}
|
|
12861
12666
|
|
|
12862
12667
|
// packages/omo-codex/src/install/install-ast-grep-sg.ts
|
|
12863
|
-
import { join as
|
|
12668
|
+
import { join as join31 } from "node:path";
|
|
12864
12669
|
|
|
12865
12670
|
// packages/utils/src/ast-grep/install-script.ts
|
|
12866
12671
|
import { spawn as spawn2 } from "node:child_process";
|
|
12867
|
-
import { existsSync as
|
|
12868
|
-
import { join as
|
|
12672
|
+
import { existsSync as existsSync3 } from "node:fs";
|
|
12673
|
+
import { join as join30 } from "node:path";
|
|
12869
12674
|
|
|
12870
12675
|
// packages/utils/src/ast-grep/sg-manifest.ts
|
|
12871
12676
|
function normalizeRuntimePlatform(platform = process.platform) {
|
|
@@ -12887,7 +12692,7 @@ var AST_GREP_BIN_DIR_ENV_KEY = "OMO_AST_GREP_BIN_DIR";
|
|
|
12887
12692
|
var KILL_GRACE_MS = 1000;
|
|
12888
12693
|
var AST_GREP_INSTALL_TIMEOUT_MS = 30000;
|
|
12889
12694
|
function astGrepRuntimeDir(baseDir, platform = process.platform, arch = process.arch) {
|
|
12890
|
-
return
|
|
12695
|
+
return join30(baseDir, "runtime", "ast-grep", runtimeSlug(platform, arch));
|
|
12891
12696
|
}
|
|
12892
12697
|
function isMissingExecutable(error) {
|
|
12893
12698
|
if (!("code" in error))
|
|
@@ -12925,7 +12730,7 @@ function defaultSpawnProcess(command, args, options) {
|
|
|
12925
12730
|
};
|
|
12926
12731
|
}
|
|
12927
12732
|
function scriptPathForPlatform(skillDir, platform) {
|
|
12928
|
-
return
|
|
12733
|
+
return join30(skillDir, platform === "win32" ? "install.ps1" : "install.sh");
|
|
12929
12734
|
}
|
|
12930
12735
|
function invocationsForPlatform(scriptPath, platform) {
|
|
12931
12736
|
if (platform !== "win32")
|
|
@@ -12967,7 +12772,7 @@ function failedReason(outcome) {
|
|
|
12967
12772
|
}
|
|
12968
12773
|
async function runAstGrepSkillInstall(options) {
|
|
12969
12774
|
const platform = options.platform ?? process.platform;
|
|
12970
|
-
const fileExists = options.fileExists ??
|
|
12775
|
+
const fileExists = options.fileExists ?? existsSync3;
|
|
12971
12776
|
const scriptPath = scriptPathForPlatform(options.skillDir, platform);
|
|
12972
12777
|
if (!fileExists(scriptPath))
|
|
12973
12778
|
return { kind: "skipped", reason: `missing ${scriptPath}` };
|
|
@@ -13011,7 +12816,7 @@ async function installAstGrepForCodex(options) {
|
|
|
13011
12816
|
return;
|
|
13012
12817
|
const platform = options.platform ?? process.platform;
|
|
13013
12818
|
const targetDir = astGrepRuntimeDir(options.codexHome, platform, options.arch ?? process.arch);
|
|
13014
|
-
const skillDir =
|
|
12819
|
+
const skillDir = join31(plugin.path, "skills", "ast-grep");
|
|
13015
12820
|
const installer = options.installer ?? runAstGrepSkillInstall;
|
|
13016
12821
|
try {
|
|
13017
12822
|
const result = await installer({ platform, skillDir, targetDir });
|
|
@@ -13044,7 +12849,7 @@ async function runCodexInstaller(options = {}) {
|
|
|
13044
12849
|
const env2 = options.env ?? process.env;
|
|
13045
12850
|
const platform = options.platform ?? process.platform;
|
|
13046
12851
|
const repoRoot = resolve9(options.repoRoot ?? findRepoRoot({ importerDir: import.meta.dir, env: env2 }));
|
|
13047
|
-
const codexHome = resolve9(options.codexHome ?? env2.CODEX_HOME ??
|
|
12852
|
+
const codexHome = resolve9(options.codexHome ?? env2.CODEX_HOME ?? join34(homedir2(), ".codex"));
|
|
13048
12853
|
const projectDirectory = resolve9(options.projectDirectory ?? env2.OMO_CODEX_PROJECT ?? process.cwd());
|
|
13049
12854
|
const binDir = resolveCodexInstallerBinDir({ binDir: options.binDir, codexHome, env: env2 });
|
|
13050
12855
|
const runCommand = options.runCommand ?? defaultRunCommand;
|
|
@@ -13061,9 +12866,9 @@ async function runCodexInstaller(options = {}) {
|
|
|
13061
12866
|
if (!gitBashResolution.found) {
|
|
13062
12867
|
throw new Error(gitBashResolution.installHint);
|
|
13063
12868
|
}
|
|
13064
|
-
const codexPackageRoot =
|
|
12869
|
+
const codexPackageRoot = join34(repoRoot, "packages", "omo-codex");
|
|
13065
12870
|
const marketplace = await readMarketplace(repoRoot, {
|
|
13066
|
-
marketplacePath:
|
|
12871
|
+
marketplacePath: join34(codexPackageRoot, "marketplace.json")
|
|
13067
12872
|
});
|
|
13068
12873
|
const distributionManifest = await readDistributionManifest(repoRoot);
|
|
13069
12874
|
const installed = [];
|
|
@@ -13109,7 +12914,7 @@ async function runCodexInstaller(options = {}) {
|
|
|
13109
12914
|
if (runtimeLink !== null)
|
|
13110
12915
|
log(`Linked ${runtimeLink.name} -> ${runtimeLink.target}`);
|
|
13111
12916
|
else
|
|
13112
|
-
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`);
|
|
13113
12918
|
}
|
|
13114
12919
|
pluginSources.push({ name: entry.name, sourcePath });
|
|
13115
12920
|
installed.push(plugin);
|
|
@@ -13172,13 +12977,13 @@ async function runCodexInstaller(options = {}) {
|
|
|
13172
12977
|
continue;
|
|
13173
12978
|
log(`Warning: deferred legacy Codex LSP daemon cleanup for v${cleanup.version}: ${cleanup.reason}`);
|
|
13174
12979
|
}
|
|
13175
|
-
const marketplaceRoot =
|
|
12980
|
+
const marketplaceRoot = join34(codexHome, "plugins", "cache", marketplace.name);
|
|
13176
12981
|
await writeCachedMarketplaceManifest({
|
|
13177
12982
|
marketplaceName: marketplace.name,
|
|
13178
12983
|
marketplaceRoot,
|
|
13179
12984
|
plugins: installed
|
|
13180
12985
|
});
|
|
13181
|
-
const configPath =
|
|
12986
|
+
const configPath = join34(codexHome, "config.toml");
|
|
13182
12987
|
await updateCodexConfig({
|
|
13183
12988
|
configPath,
|
|
13184
12989
|
repoRoot: codexPackageRoot,
|
|
@@ -13186,7 +12991,6 @@ async function runCodexInstaller(options = {}) {
|
|
|
13186
12991
|
marketplaceSource: codexMarketplaceSource(marketplaceRoot),
|
|
13187
12992
|
pluginNames: marketplace.plugins.map((plugin) => plugin.name),
|
|
13188
12993
|
platform,
|
|
13189
|
-
codegraphMcpEnabled: options.codegraphMcpEnabled ?? resolveCodegraphNodeSupport({ env: env2 }).supported,
|
|
13190
12994
|
gitBashEnabled: platform === "win32" && gitBashResolution.found,
|
|
13191
12995
|
trustedHookStates,
|
|
13192
12996
|
agentConfigs: [...agentConfigs.values()].sort((left, right) => left.name.localeCompare(right.name)),
|
|
@@ -13239,7 +13043,7 @@ function findRepoRootFromImporter(importerDir) {
|
|
|
13239
13043
|
for (let depth = 0;depth <= 7; depth += 1) {
|
|
13240
13044
|
if (isRepoRootWithCodexPlugin(current))
|
|
13241
13045
|
return current;
|
|
13242
|
-
for (const wrapperPackageRoot of [
|
|
13046
|
+
for (const wrapperPackageRoot of [join34(current, "node_modules", "oh-my-openagent"), join34(current, "oh-my-openagent")]) {
|
|
13243
13047
|
if (isRepoRootWithCodexPlugin(wrapperPackageRoot))
|
|
13244
13048
|
return wrapperPackageRoot;
|
|
13245
13049
|
}
|
|
@@ -13257,7 +13061,7 @@ function findRepoRoot(input) {
|
|
|
13257
13061
|
return findRepoRootFromImporter(input.importerDir);
|
|
13258
13062
|
}
|
|
13259
13063
|
function isRepoRootWithCodexPlugin(repoRoot) {
|
|
13260
|
-
return
|
|
13064
|
+
return existsSync6(join34(repoRoot, "packages", "omo-codex", "plugin", ".codex-plugin", "plugin.json"));
|
|
13261
13065
|
}
|
|
13262
13066
|
function codexMarketplaceSource(marketplaceRoot) {
|
|
13263
13067
|
return { sourceType: "local", source: marketplaceRoot };
|
|
@@ -13568,14 +13372,14 @@ function shellQuote(value) {
|
|
|
13568
13372
|
}
|
|
13569
13373
|
|
|
13570
13374
|
// packages/omo-codex/src/install/lazycodex-manual-update.ts
|
|
13571
|
-
import { spawn as spawn3, spawnSync as
|
|
13375
|
+
import { spawn as spawn3, spawnSync as spawnSync2 } from "node:child_process";
|
|
13572
13376
|
import { readFileSync as readFileSync4 } from "node:fs";
|
|
13573
|
-
import { dirname as
|
|
13377
|
+
import { dirname as dirname11, join as join36 } from "node:path";
|
|
13574
13378
|
import { createInterface as createInterface2 } from "node:readline/promises";
|
|
13575
13379
|
import { fileURLToPath } from "node:url";
|
|
13576
13380
|
|
|
13577
13381
|
// packages/omo-codex/src/install/lazycodex-bun-global-paths.ts
|
|
13578
|
-
import { join as
|
|
13382
|
+
import { join as join35 } from "node:path";
|
|
13579
13383
|
function isBunGlobalEntrypointPath(invokedPath, env2) {
|
|
13580
13384
|
if (typeof invokedPath !== "string" || invokedPath.trim().length === 0)
|
|
13581
13385
|
return false;
|
|
@@ -13586,8 +13390,8 @@ function resolveBunGlobalRoots(env2) {
|
|
|
13586
13390
|
const bunInstallRoot = env2.BUN_INSTALL?.trim();
|
|
13587
13391
|
const homeRoot = env2.HOME?.trim();
|
|
13588
13392
|
return [
|
|
13589
|
-
...bunInstallRoot ? [
|
|
13590
|
-
...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")] : []
|
|
13591
13395
|
].map(normalizePathForPrefix);
|
|
13592
13396
|
}
|
|
13593
13397
|
function normalizePathForPrefix(path2) {
|
|
@@ -13679,13 +13483,13 @@ function resolveArgs(env2) {
|
|
|
13679
13483
|
function resolveCurrentVersion(env2) {
|
|
13680
13484
|
if (env2.LAZYCODEX_CURRENT_VERSION?.trim())
|
|
13681
13485
|
return env2.LAZYCODEX_CURRENT_VERSION.trim();
|
|
13682
|
-
const pluginRoot =
|
|
13683
|
-
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"));
|
|
13684
13488
|
}
|
|
13685
13489
|
function resolveLatestVersion(env2) {
|
|
13686
13490
|
if (env2.LAZYCODEX_LATEST_VERSION?.trim())
|
|
13687
13491
|
return env2.LAZYCODEX_LATEST_VERSION.trim();
|
|
13688
|
-
const result =
|
|
13492
|
+
const result = spawnSync2("npm", ["view", "lazycodex-ai", "version", "--silent"], {
|
|
13689
13493
|
encoding: "utf8",
|
|
13690
13494
|
stdio: ["ignore", "pipe", "ignore"]
|
|
13691
13495
|
});
|
|
@@ -13713,7 +13517,7 @@ ${trustCommand}`);
|
|
|
13713
13517
|
${trustCommand}`);
|
|
13714
13518
|
}
|
|
13715
13519
|
function resolveKnownBunGlobalUntrustedPackages(env2) {
|
|
13716
|
-
const result =
|
|
13520
|
+
const result = spawnSync2(BUN_UPDATE_COMMAND, BUN_GLOBAL_UNTRUSTED_ARGS, {
|
|
13717
13521
|
encoding: "utf8",
|
|
13718
13522
|
env: env2,
|
|
13719
13523
|
stdio: ["ignore", "pipe", "ignore"]
|
|
@@ -13796,7 +13600,7 @@ function compareVersions(left, right) {
|
|
|
13796
13600
|
function resolveInstalledVersionPath(env2, pluginRoot) {
|
|
13797
13601
|
if (env2.LAZYCODEX_INSTALLED_VERSION_FILE?.trim())
|
|
13798
13602
|
return env2.LAZYCODEX_INSTALLED_VERSION_FILE.trim();
|
|
13799
|
-
return
|
|
13603
|
+
return join36(pluginRoot, INSTALLED_VERSION_FILE);
|
|
13800
13604
|
}
|
|
13801
13605
|
function readVersionManifest(path2) {
|
|
13802
13606
|
try {
|
|
@@ -13813,17 +13617,16 @@ function readVersionManifest(path2) {
|
|
|
13813
13617
|
}
|
|
13814
13618
|
// packages/omo-codex/src/install/codex-git-bash-mcp-env.ts
|
|
13815
13619
|
import { readFile as readFile22, writeFile as writeFile13 } from "node:fs/promises";
|
|
13816
|
-
import { join as
|
|
13620
|
+
import { join as join37 } from "node:path";
|
|
13817
13621
|
var GIT_BASH_ENV_KEY2 = "OMO_CODEX_GIT_BASH_PATH";
|
|
13818
|
-
var CODEGRAPH_RELATIVE_ARGS2 = new Set(["components/codegraph/dist/serve.js", "./components/codegraph/dist/serve.js"]);
|
|
13819
13622
|
async function stampGitBashMcpEnv(input) {
|
|
13820
|
-
const manifestPath =
|
|
13623
|
+
const manifestPath = join37(input.pluginRoot, ".mcp.json");
|
|
13821
13624
|
if (!await fileExistsStrict(manifestPath))
|
|
13822
13625
|
return false;
|
|
13823
13626
|
const parsed = JSON.parse(await readFile22(manifestPath, "utf8"));
|
|
13824
13627
|
if (!isPlainRecord(parsed) || !isPlainRecord(parsed["mcpServers"]))
|
|
13825
13628
|
return false;
|
|
13826
|
-
let changed =
|
|
13629
|
+
let changed = false;
|
|
13827
13630
|
if (input.platform === "win32") {
|
|
13828
13631
|
const rawOverride = input.env?.[GIT_BASH_ENV_KEY2];
|
|
13829
13632
|
const override = typeof rawOverride === "string" ? rawOverride.trim() : "";
|
|
@@ -13842,24 +13645,13 @@ async function stampGitBashMcpEnv(input) {
|
|
|
13842
13645
|
`);
|
|
13843
13646
|
return true;
|
|
13844
13647
|
}
|
|
13845
|
-
function stampCodegraphMcpPath(mcpServers, pluginRoot) {
|
|
13846
|
-
const codegraphServer = mcpServers["codegraph"];
|
|
13847
|
-
if (!isPlainRecord(codegraphServer) || !Array.isArray(codegraphServer["args"]))
|
|
13848
|
-
return false;
|
|
13849
|
-
const args = codegraphServer["args"];
|
|
13850
|
-
const entrypoint = args[0];
|
|
13851
|
-
if (typeof entrypoint !== "string" || !CODEGRAPH_RELATIVE_ARGS2.has(entrypoint))
|
|
13852
|
-
return false;
|
|
13853
|
-
codegraphServer["args"] = [join39(pluginRoot, "components", "codegraph", "dist", "serve.js"), ...args.slice(1)];
|
|
13854
|
-
return true;
|
|
13855
|
-
}
|
|
13856
13648
|
|
|
13857
13649
|
// packages/omo-codex/src/install/install-local-cli.ts
|
|
13858
13650
|
async function installMarketplaceLocally(options = {}) {
|
|
13859
13651
|
return runCodexInstaller(options);
|
|
13860
13652
|
}
|
|
13861
13653
|
function resolveDefaultRepoRootForEntrypoint(entrypointPath) {
|
|
13862
|
-
return resolve10(
|
|
13654
|
+
return resolve10(dirname12(entrypointPath), "..", "..", "..");
|
|
13863
13655
|
}
|
|
13864
13656
|
function resolveDefaultRepoRoot() {
|
|
13865
13657
|
return resolveDefaultRepoRootForEntrypoint(fileURLToPath2(import.meta.url));
|
|
@@ -13875,7 +13667,7 @@ async function runLazyCodexInstallLocalCli(input) {
|
|
|
13875
13667
|
return 0;
|
|
13876
13668
|
}
|
|
13877
13669
|
if (parsed.kind === "version") {
|
|
13878
|
-
const packageJson = JSON.parse(await readFile23(
|
|
13670
|
+
const packageJson = JSON.parse(await readFile23(join38(input.defaultRepoRoot, "package.json"), "utf8"));
|
|
13879
13671
|
const version2 = typeof packageJson.version === "string" ? packageJson.version : "unknown";
|
|
13880
13672
|
input.log(`lazycodex-ai ${version2}`);
|
|
13881
13673
|
return 0;
|