oh-my-opencode 4.14.2 → 4.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.js +644 -530
- package/dist/cli-node/index.js +644 -530
- package/dist/index.js +13 -13
- package/dist/skills/frontend/ATTRIBUTION.md +10 -2
- package/dist/skills/frontend/SKILL.md +7 -3
- package/dist/skills/frontend/references/design/README.md +11 -34
- package/dist/skills/frontend/references/design/clone-from-url.md +65 -0
- package/dist/skills/frontend/references/designpowers/EVIDENCE.md +10 -2
- package/dist/skills/frontend/references/designpowers/UPSTREAM.md +1 -1
- package/dist/skills/programming/SKILL.md +5 -3
- package/dist/skills/remove-ai-slops/SKILL.md +34 -15
- package/dist/skills/visual-qa/SKILL.md +11 -0
- package/dist/skills/visual-qa/scripts/skill-prompt-contract.test.ts +42 -0
- package/package.json +13 -13
- package/packages/omo-codex/plugin/.codex-plugin/plugin.json +1 -1
- package/packages/omo-codex/plugin/components/bootstrap/dist/cli.js +194 -102
- package/packages/omo-codex/plugin/components/bootstrap/package.json +1 -1
- package/packages/omo-codex/plugin/components/codegraph/package.json +1 -1
- package/packages/omo-codex/plugin/components/comment-checker/package.json +1 -1
- package/packages/omo-codex/plugin/components/git-bash/package.json +1 -1
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/package.json +1 -1
- package/packages/omo-codex/plugin/components/lsp/package.json +1 -1
- package/packages/omo-codex/plugin/components/rules/package.json +1 -1
- package/packages/omo-codex/plugin/components/start-work-continuation/package.json +1 -1
- package/packages/omo-codex/plugin/components/teammode/package.json +1 -1
- package/packages/omo-codex/plugin/components/telemetry/package.json +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/package.json +1 -1
- 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 +1 -1
- package/packages/omo-codex/plugin/package-lock.json +13 -13
- package/packages/omo-codex/plugin/package.json +1 -1
- package/packages/omo-codex/plugin/scripts/auto-update-plan.mjs +147 -2
- package/packages/omo-codex/plugin/scripts/auto-update-release-notes.mjs +33 -0
- package/packages/omo-codex/plugin/scripts/auto-update.mjs +48 -10
- package/packages/omo-codex/plugin/scripts/sync-skills.mjs +18 -0
- package/packages/omo-codex/plugin/skills/frontend/ATTRIBUTION.md +10 -2
- package/packages/omo-codex/plugin/skills/frontend/SKILL.md +7 -3
- package/packages/omo-codex/plugin/skills/frontend/references/design/README.md +11 -34
- package/packages/omo-codex/plugin/skills/frontend/references/design/clone-from-url.md +65 -0
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/EVIDENCE.md +10 -2
- package/packages/omo-codex/plugin/skills/frontend/references/designpowers/UPSTREAM.md +1 -1
- package/packages/omo-codex/plugin/skills/programming/SKILL.md +5 -3
- package/packages/omo-codex/plugin/skills/remove-ai-slops/SKILL.md +34 -15
- package/packages/omo-codex/plugin/skills/ulw-loop/references/full-workflow.md +1 -1
- package/packages/omo-codex/plugin/skills/ulw-research/SKILL.md +3 -3
- package/packages/omo-codex/plugin/skills/visual-qa/SKILL.md +11 -0
- package/packages/omo-codex/plugin/test/auto-update-release-notes.test.mjs +32 -0
- package/packages/omo-codex/plugin/test/auto-update.test.mjs +153 -3
- package/packages/omo-codex/plugin/test/sync-skills-test-support.mjs +18 -1
- package/packages/omo-codex/plugin/test/sync-skills.test.mjs +39 -10
- package/packages/omo-codex/plugin/test/ulw-research-skill-contract.test.mjs +19 -1
- package/packages/omo-codex/scripts/install-dist/install-local.mjs +444 -330
- package/packages/shared-skills/skills/frontend/ATTRIBUTION.md +10 -2
- package/packages/shared-skills/skills/frontend/SKILL.md +7 -3
- package/packages/shared-skills/skills/frontend/references/design/README.md +11 -34
- package/packages/shared-skills/skills/frontend/references/design/clone-from-url.md +65 -0
- package/packages/shared-skills/skills/frontend/references/designpowers/EVIDENCE.md +10 -2
- package/packages/shared-skills/skills/frontend/references/designpowers/UPSTREAM.md +1 -1
- package/packages/shared-skills/skills/programming/SKILL.md +5 -3
- package/packages/shared-skills/skills/remove-ai-slops/SKILL.md +34 -15
- package/packages/shared-skills/skills/visual-qa/SKILL.md +11 -0
- package/packages/shared-skills/skills/visual-qa/scripts/skill-prompt-contract.test.ts +42 -0
- package/packages/omo-codex/plugin/skills/ultraresearch/SKILL.md +0 -10
- package/packages/omo-codex/plugin/skills/ultraresearch/agents/openai.yaml +0 -2
- /package/dist/skills/frontend/references/designpowers/vendor/skills/accessible-content/{SKILL.md → reference.md} +0 -0
- /package/dist/skills/frontend/references/designpowers/vendor/skills/adaptive-interfaces/{SKILL.md → reference.md} +0 -0
- /package/dist/skills/frontend/references/designpowers/vendor/skills/cognitive-accessibility/{SKILL.md → reference.md} +0 -0
- /package/dist/skills/frontend/references/designpowers/vendor/skills/design-debate/{SKILL.md → reference.md} +0 -0
- /package/dist/skills/frontend/references/designpowers/vendor/skills/design-debt-tracker/{SKILL.md → reference.md} +0 -0
- /package/dist/skills/frontend/references/designpowers/vendor/skills/design-handoff/{SKILL.md → reference.md} +0 -0
- /package/dist/skills/frontend/references/designpowers/vendor/skills/design-md/{SKILL.md → reference.md} +0 -0
- /package/dist/skills/frontend/references/designpowers/vendor/skills/design-retrospective/{SKILL.md → reference.md} +0 -0
- /package/dist/skills/frontend/references/designpowers/vendor/skills/design-review/{SKILL.md → reference.md} +0 -0
- /package/dist/skills/frontend/references/designpowers/vendor/skills/design-system-alignment/{SKILL.md → reference.md} +0 -0
- /package/dist/skills/frontend/references/designpowers/vendor/skills/designpowers-critique/{SKILL.md → reference.md} +0 -0
- /package/dist/skills/frontend/references/designpowers/vendor/skills/heuristic-evaluation/{SKILL.md → reference.md} +0 -0
- /package/dist/skills/frontend/references/designpowers/vendor/skills/inclusive-personas/{SKILL.md → reference.md} +0 -0
- /package/dist/skills/frontend/references/designpowers/vendor/skills/inspiration-scouting/{SKILL.md → reference.md} +0 -0
- /package/dist/skills/frontend/references/designpowers/vendor/skills/interaction-design/{SKILL.md → reference.md} +0 -0
- /package/dist/skills/frontend/references/designpowers/vendor/skills/motion-choreography/{SKILL.md → reference.md} +0 -0
- /package/dist/skills/frontend/references/designpowers/vendor/skills/research-planning/{SKILL.md → reference.md} +0 -0
- /package/dist/skills/frontend/references/designpowers/vendor/skills/responsive-patterns/{SKILL.md → reference.md} +0 -0
- /package/dist/skills/frontend/references/designpowers/vendor/skills/synthetic-user-testing/{SKILL.md → reference.md} +0 -0
- /package/dist/skills/frontend/references/designpowers/vendor/skills/taste-feedback/{SKILL.md → reference.md} +0 -0
- /package/dist/skills/frontend/references/designpowers/vendor/skills/taste-report/{SKILL.md → reference.md} +0 -0
- /package/dist/skills/frontend/references/designpowers/vendor/skills/token-architecture/{SKILL.md → reference.md} +0 -0
- /package/dist/skills/frontend/references/designpowers/vendor/skills/ui-composition/{SKILL.md → reference.md} +0 -0
- /package/dist/skills/frontend/references/designpowers/vendor/skills/usability-testing/{SKILL.md → reference.md} +0 -0
- /package/dist/skills/frontend/references/designpowers/vendor/skills/verification-before-shipping/{SKILL.md → reference.md} +0 -0
- /package/dist/skills/frontend/references/designpowers/vendor/skills/voice-and-tone/{SKILL.md → reference.md} +0 -0
- /package/dist/skills/frontend/references/designpowers/vendor/skills/writing-design-plans/{SKILL.md → reference.md} +0 -0
- /package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/accessible-content/{SKILL.md → reference.md} +0 -0
- /package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/adaptive-interfaces/{SKILL.md → reference.md} +0 -0
- /package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/cognitive-accessibility/{SKILL.md → reference.md} +0 -0
- /package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/design-debate/{SKILL.md → reference.md} +0 -0
- /package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/design-debt-tracker/{SKILL.md → reference.md} +0 -0
- /package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/design-handoff/{SKILL.md → reference.md} +0 -0
- /package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/design-md/{SKILL.md → reference.md} +0 -0
- /package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/design-retrospective/{SKILL.md → reference.md} +0 -0
- /package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/design-review/{SKILL.md → reference.md} +0 -0
- /package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/design-system-alignment/{SKILL.md → reference.md} +0 -0
- /package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/designpowers-critique/{SKILL.md → reference.md} +0 -0
- /package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/heuristic-evaluation/{SKILL.md → reference.md} +0 -0
- /package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/inclusive-personas/{SKILL.md → reference.md} +0 -0
- /package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/inspiration-scouting/{SKILL.md → reference.md} +0 -0
- /package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/interaction-design/{SKILL.md → reference.md} +0 -0
- /package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/motion-choreography/{SKILL.md → reference.md} +0 -0
- /package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/research-planning/{SKILL.md → reference.md} +0 -0
- /package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/responsive-patterns/{SKILL.md → reference.md} +0 -0
- /package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/synthetic-user-testing/{SKILL.md → reference.md} +0 -0
- /package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/taste-feedback/{SKILL.md → reference.md} +0 -0
- /package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/taste-report/{SKILL.md → reference.md} +0 -0
- /package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/token-architecture/{SKILL.md → reference.md} +0 -0
- /package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/ui-composition/{SKILL.md → reference.md} +0 -0
- /package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/usability-testing/{SKILL.md → reference.md} +0 -0
- /package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/verification-before-shipping/{SKILL.md → reference.md} +0 -0
- /package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/voice-and-tone/{SKILL.md → reference.md} +0 -0
- /package/packages/omo-codex/plugin/skills/frontend/references/designpowers/vendor/skills/writing-design-plans/{SKILL.md → reference.md} +0 -0
- /package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/accessible-content/{SKILL.md → reference.md} +0 -0
- /package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/adaptive-interfaces/{SKILL.md → reference.md} +0 -0
- /package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/cognitive-accessibility/{SKILL.md → reference.md} +0 -0
- /package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/design-debate/{SKILL.md → reference.md} +0 -0
- /package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/design-debt-tracker/{SKILL.md → reference.md} +0 -0
- /package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/design-handoff/{SKILL.md → reference.md} +0 -0
- /package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/design-md/{SKILL.md → reference.md} +0 -0
- /package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/design-retrospective/{SKILL.md → reference.md} +0 -0
- /package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/design-review/{SKILL.md → reference.md} +0 -0
- /package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/design-system-alignment/{SKILL.md → reference.md} +0 -0
- /package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/designpowers-critique/{SKILL.md → reference.md} +0 -0
- /package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/heuristic-evaluation/{SKILL.md → reference.md} +0 -0
- /package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/inclusive-personas/{SKILL.md → reference.md} +0 -0
- /package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/inspiration-scouting/{SKILL.md → reference.md} +0 -0
- /package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/interaction-design/{SKILL.md → reference.md} +0 -0
- /package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/motion-choreography/{SKILL.md → reference.md} +0 -0
- /package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/research-planning/{SKILL.md → reference.md} +0 -0
- /package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/responsive-patterns/{SKILL.md → reference.md} +0 -0
- /package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/synthetic-user-testing/{SKILL.md → reference.md} +0 -0
- /package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/taste-feedback/{SKILL.md → reference.md} +0 -0
- /package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/taste-report/{SKILL.md → reference.md} +0 -0
- /package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/token-architecture/{SKILL.md → reference.md} +0 -0
- /package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/ui-composition/{SKILL.md → reference.md} +0 -0
- /package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/usability-testing/{SKILL.md → reference.md} +0 -0
- /package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/verification-before-shipping/{SKILL.md → reference.md} +0 -0
- /package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/voice-and-tone/{SKILL.md → reference.md} +0 -0
- /package/packages/shared-skills/skills/frontend/references/designpowers/vendor/skills/writing-design-plans/{SKILL.md → reference.md} +0 -0
package/dist/cli/index.js
CHANGED
|
@@ -2145,7 +2145,7 @@ var package_default;
|
|
|
2145
2145
|
var init_package = __esm(() => {
|
|
2146
2146
|
package_default = {
|
|
2147
2147
|
name: "oh-my-opencode",
|
|
2148
|
-
version: "4.
|
|
2148
|
+
version: "4.15.1",
|
|
2149
2149
|
description: "The Best AI Agent Harness - Batteries-Included OpenCode Plugin with Multi-Model Orchestration, Parallel Background Agents, and Crafted LSP/AST Tools",
|
|
2150
2150
|
main: "./dist/index.js",
|
|
2151
2151
|
types: "dist/index.d.ts",
|
|
@@ -2336,18 +2336,18 @@ var init_package = __esm(() => {
|
|
|
2336
2336
|
typescript: "^6.0.3"
|
|
2337
2337
|
},
|
|
2338
2338
|
optionalDependencies: {
|
|
2339
|
-
"oh-my-opencode-darwin-arm64": "4.
|
|
2340
|
-
"oh-my-opencode-darwin-x64": "4.
|
|
2341
|
-
"oh-my-opencode-darwin-x64-baseline": "4.
|
|
2342
|
-
"oh-my-opencode-linux-arm64": "4.
|
|
2343
|
-
"oh-my-opencode-linux-arm64-musl": "4.
|
|
2344
|
-
"oh-my-opencode-linux-x64": "4.
|
|
2345
|
-
"oh-my-opencode-linux-x64-baseline": "4.
|
|
2346
|
-
"oh-my-opencode-linux-x64-musl": "4.
|
|
2347
|
-
"oh-my-opencode-linux-x64-musl-baseline": "4.
|
|
2348
|
-
"oh-my-opencode-windows-arm64": "4.
|
|
2349
|
-
"oh-my-opencode-windows-x64": "4.
|
|
2350
|
-
"oh-my-opencode-windows-x64-baseline": "4.
|
|
2339
|
+
"oh-my-opencode-darwin-arm64": "4.15.1",
|
|
2340
|
+
"oh-my-opencode-darwin-x64": "4.15.1",
|
|
2341
|
+
"oh-my-opencode-darwin-x64-baseline": "4.15.1",
|
|
2342
|
+
"oh-my-opencode-linux-arm64": "4.15.1",
|
|
2343
|
+
"oh-my-opencode-linux-arm64-musl": "4.15.1",
|
|
2344
|
+
"oh-my-opencode-linux-x64": "4.15.1",
|
|
2345
|
+
"oh-my-opencode-linux-x64-baseline": "4.15.1",
|
|
2346
|
+
"oh-my-opencode-linux-x64-musl": "4.15.1",
|
|
2347
|
+
"oh-my-opencode-linux-x64-musl-baseline": "4.15.1",
|
|
2348
|
+
"oh-my-opencode-windows-arm64": "4.15.1",
|
|
2349
|
+
"oh-my-opencode-windows-x64": "4.15.1",
|
|
2350
|
+
"oh-my-opencode-windows-x64-baseline": "4.15.1"
|
|
2351
2351
|
},
|
|
2352
2352
|
overrides: {
|
|
2353
2353
|
hono: "^4.12.18",
|
|
@@ -66826,20 +66826,20 @@ var init_config_manager = __esm(() => {
|
|
|
66826
66826
|
|
|
66827
66827
|
// packages/telemetry-core/src/activity-state.ts
|
|
66828
66828
|
import { existsSync as existsSync28, mkdirSync as mkdirSync8, readFileSync as readFileSync13 } from "fs";
|
|
66829
|
-
import { basename as basename10, join as
|
|
66829
|
+
import { basename as basename10, join as join50 } from "path";
|
|
66830
66830
|
function resolveTelemetryStateDir(product, options = {}) {
|
|
66831
66831
|
const dataDir = resolveXdgDataDir(product.cacheDirName, {
|
|
66832
66832
|
env: options.env,
|
|
66833
66833
|
osProvider: options.osProvider
|
|
66834
66834
|
});
|
|
66835
|
-
const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined :
|
|
66835
|
+
const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined : join50(options.env.XDG_DATA_HOME, product.cacheDirName);
|
|
66836
66836
|
if (dataDir === xdgStateDir || xdgStateDir === undefined && basename10(dataDir) === product.cacheDirName) {
|
|
66837
66837
|
return dataDir;
|
|
66838
66838
|
}
|
|
66839
|
-
return
|
|
66839
|
+
return join50(dataDir, product.cacheDirName);
|
|
66840
66840
|
}
|
|
66841
66841
|
function getTelemetryActivityStateFilePath(stateDir) {
|
|
66842
|
-
return
|
|
66842
|
+
return join50(stateDir, POSTHOG_ACTIVITY_STATE_FILE);
|
|
66843
66843
|
}
|
|
66844
66844
|
function getDailyActiveCaptureState(input) {
|
|
66845
66845
|
const state = readPostHogActivityState(input.stateDir, input.diagnostics);
|
|
@@ -66910,9 +66910,9 @@ var DEFAULT_POSTHOG_HOST = "https://us.i.posthog.com", DEFAULT_POSTHOG_API_KEY =
|
|
|
66910
66910
|
|
|
66911
66911
|
// packages/telemetry-core/src/diagnostics.ts
|
|
66912
66912
|
import { appendFileSync as appendFileSync2, existsSync as existsSync29, mkdirSync as mkdirSync9, readFileSync as readFileSync14 } from "fs";
|
|
66913
|
-
import { join as
|
|
66913
|
+
import { join as join51 } from "path";
|
|
66914
66914
|
function getTelemetryDiagnosticsFilePath(diagnosticsDir) {
|
|
66915
|
-
return
|
|
66915
|
+
return join51(diagnosticsDir, DIAGNOSTICS_FILE_NAME);
|
|
66916
66916
|
}
|
|
66917
66917
|
function writeTelemetryDiagnostic(input, options) {
|
|
66918
66918
|
const now = options.now ?? new Date;
|
|
@@ -67078,7 +67078,7 @@ function getTelemetryDistinctId(machineIdPrefix, osProvider = getDefaultTelemetr
|
|
|
67078
67078
|
var init_machine_id = () => {};
|
|
67079
67079
|
|
|
67080
67080
|
// node_modules/.bun/posthog-node@5.35.12/node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
|
|
67081
|
-
import { dirname as
|
|
67081
|
+
import { dirname as dirname17, posix as posix2, sep as sep7 } from "path";
|
|
67082
67082
|
function createModulerModifier() {
|
|
67083
67083
|
const getModuleFromFileName = createGetModuleFromFilename();
|
|
67084
67084
|
return async (frames) => {
|
|
@@ -67087,7 +67087,7 @@ function createModulerModifier() {
|
|
|
67087
67087
|
return frames;
|
|
67088
67088
|
};
|
|
67089
67089
|
}
|
|
67090
|
-
function createGetModuleFromFilename(basePath = process.argv[1] ?
|
|
67090
|
+
function createGetModuleFromFilename(basePath = process.argv[1] ? dirname17(process.argv[1]) : process.cwd(), isWindows = sep7 === "\\") {
|
|
67091
67091
|
const normalizedBase = isWindows ? normalizeWindowsPath(basePath) : basePath;
|
|
67092
67092
|
return (filename) => {
|
|
67093
67093
|
if (!filename)
|
|
@@ -69927,14 +69927,14 @@ async function addSourceContext(frames) {
|
|
|
69927
69927
|
return frames;
|
|
69928
69928
|
}
|
|
69929
69929
|
function getContextLinesFromFile(path7, ranges, output) {
|
|
69930
|
-
return new Promise((
|
|
69930
|
+
return new Promise((resolve15) => {
|
|
69931
69931
|
const stream = createReadStream(path7);
|
|
69932
69932
|
const lineReaded = createInterface({
|
|
69933
69933
|
input: stream
|
|
69934
69934
|
});
|
|
69935
69935
|
function destroyStreamAndResolve() {
|
|
69936
69936
|
stream.destroy();
|
|
69937
|
-
|
|
69937
|
+
resolve15();
|
|
69938
69938
|
}
|
|
69939
69939
|
let lineNumber = 0;
|
|
69940
69940
|
let currentRangeIndex = 0;
|
|
@@ -70108,7 +70108,7 @@ var init_context_lines_node = __esm(() => {
|
|
|
70108
70108
|
});
|
|
70109
70109
|
|
|
70110
70110
|
// node_modules/.bun/posthog-node@5.35.12/node_modules/posthog-node/dist/extensions/error-tracking/modifiers/relative-path.node.mjs
|
|
70111
|
-
import { isAbsolute as
|
|
70111
|
+
import { isAbsolute as isAbsolute8, relative as relative5, sep as sep8 } from "path";
|
|
70112
70112
|
function createRelativePathModifier(basePath = process.cwd()) {
|
|
70113
70113
|
const isWindows = sep8 === "\\";
|
|
70114
70114
|
const toUnix = (p) => isWindows ? p.replace(/\\/g, "/") : p;
|
|
@@ -70116,7 +70116,7 @@ function createRelativePathModifier(basePath = process.cwd()) {
|
|
|
70116
70116
|
return async (frames) => {
|
|
70117
70117
|
for (const frame of frames)
|
|
70118
70118
|
if (!(!frame.filename || frame.filename.startsWith("node:") || frame.filename.startsWith("data:"))) {
|
|
70119
|
-
if (
|
|
70119
|
+
if (isAbsolute8(frame.filename))
|
|
70120
70120
|
frame.filename = toUnix(relative5(normalizedBase, toUnix(frame.filename)));
|
|
70121
70121
|
}
|
|
70122
70122
|
return frames;
|
|
@@ -71406,9 +71406,9 @@ var init_client3 = __esm(() => {
|
|
|
71406
71406
|
if (this.disabled || this.optedOut)
|
|
71407
71407
|
return;
|
|
71408
71408
|
if (!this._waitUntilCycle) {
|
|
71409
|
-
let
|
|
71409
|
+
let resolve15;
|
|
71410
71410
|
const promise = new Promise((r) => {
|
|
71411
|
-
|
|
71411
|
+
resolve15 = r;
|
|
71412
71412
|
});
|
|
71413
71413
|
try {
|
|
71414
71414
|
waitUntil(promise);
|
|
@@ -71416,7 +71416,7 @@ var init_client3 = __esm(() => {
|
|
|
71416
71416
|
return;
|
|
71417
71417
|
}
|
|
71418
71418
|
this._waitUntilCycle = {
|
|
71419
|
-
resolve:
|
|
71419
|
+
resolve: resolve15,
|
|
71420
71420
|
startedAt: Date.now(),
|
|
71421
71421
|
timer: undefined
|
|
71422
71422
|
};
|
|
@@ -71442,11 +71442,11 @@ var init_client3 = __esm(() => {
|
|
|
71442
71442
|
return cycle?.resolve;
|
|
71443
71443
|
}
|
|
71444
71444
|
async resolveWaitUntilFlush() {
|
|
71445
|
-
const
|
|
71445
|
+
const resolve15 = this._consumeWaitUntilCycle();
|
|
71446
71446
|
try {
|
|
71447
71447
|
await super.flush();
|
|
71448
71448
|
} catch {} finally {
|
|
71449
|
-
|
|
71449
|
+
resolve15?.();
|
|
71450
71450
|
}
|
|
71451
71451
|
}
|
|
71452
71452
|
getPersistedProperty(key) {
|
|
@@ -71546,15 +71546,15 @@ var init_client3 = __esm(() => {
|
|
|
71546
71546
|
return true;
|
|
71547
71547
|
if (this.featureFlagsPoller === undefined)
|
|
71548
71548
|
return false;
|
|
71549
|
-
return new Promise((
|
|
71549
|
+
return new Promise((resolve15) => {
|
|
71550
71550
|
const timeout = setTimeout(() => {
|
|
71551
71551
|
cleanup();
|
|
71552
|
-
|
|
71552
|
+
resolve15(false);
|
|
71553
71553
|
}, timeoutMs);
|
|
71554
71554
|
const cleanup = this._events.on("localEvaluationFlagsLoaded", (count) => {
|
|
71555
71555
|
clearTimeout(timeout);
|
|
71556
71556
|
cleanup();
|
|
71557
|
-
|
|
71557
|
+
resolve15(count > 0);
|
|
71558
71558
|
});
|
|
71559
71559
|
});
|
|
71560
71560
|
}
|
|
@@ -72060,13 +72060,13 @@ var init_client3 = __esm(() => {
|
|
|
72060
72060
|
this.context?.enter(data, options);
|
|
72061
72061
|
}
|
|
72062
72062
|
async _shutdown(shutdownTimeoutMs) {
|
|
72063
|
-
const
|
|
72063
|
+
const resolve15 = this._consumeWaitUntilCycle();
|
|
72064
72064
|
await this.featureFlagsPoller?.stopPoller(shutdownTimeoutMs);
|
|
72065
72065
|
this.errorTracking.shutdown();
|
|
72066
72066
|
try {
|
|
72067
72067
|
return await super._shutdown(shutdownTimeoutMs);
|
|
72068
72068
|
} finally {
|
|
72069
|
-
|
|
72069
|
+
resolve15?.();
|
|
72070
72070
|
}
|
|
72071
72071
|
}
|
|
72072
72072
|
async _requestRemoteConfigPayload(flagKey) {
|
|
@@ -72637,7 +72637,7 @@ var package_default2;
|
|
|
72637
72637
|
var init_package2 = __esm(() => {
|
|
72638
72638
|
package_default2 = {
|
|
72639
72639
|
name: "@oh-my-opencode/omo-codex",
|
|
72640
|
-
version: "4.
|
|
72640
|
+
version: "4.15.1",
|
|
72641
72641
|
type: "module",
|
|
72642
72642
|
private: true,
|
|
72643
72643
|
description: "Codex harness adapter for oh-my-openagent. Vendored Codex plugin namespace (omo) + TypeScript installer + telemetry.",
|
|
@@ -73029,8 +73029,8 @@ import * as fs7 from "fs";
|
|
|
73029
73029
|
import * as path10 from "path";
|
|
73030
73030
|
function findPackageJsonUp(startPath) {
|
|
73031
73031
|
try {
|
|
73032
|
-
const
|
|
73033
|
-
let dir =
|
|
73032
|
+
const stat6 = fs7.statSync(startPath);
|
|
73033
|
+
let dir = stat6.isDirectory() ? startPath : path10.dirname(startPath);
|
|
73034
73034
|
for (let i = 0;i < 10; i++) {
|
|
73035
73035
|
const pkgPath = path10.join(dir, "package.json");
|
|
73036
73036
|
if (fs7.existsSync(pkgPath)) {
|
|
@@ -73607,19 +73607,19 @@ var init_update_toasts = __esm(() => {
|
|
|
73607
73607
|
|
|
73608
73608
|
// packages/omo-opencode/src/hooks/auto-update-checker/hook/background-update-check.ts
|
|
73609
73609
|
import { existsSync as existsSync48 } from "fs";
|
|
73610
|
-
import { dirname as
|
|
73610
|
+
import { dirname as dirname26, join as join68 } from "path";
|
|
73611
73611
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
73612
73612
|
function defaultGetModuleHostingWorkspace() {
|
|
73613
73613
|
try {
|
|
73614
|
-
const currentDir =
|
|
73614
|
+
const currentDir = dirname26(fileURLToPath4(import.meta.url));
|
|
73615
73615
|
const pkgJsonPath = findPackageJsonUp(currentDir);
|
|
73616
73616
|
if (!pkgJsonPath)
|
|
73617
73617
|
return null;
|
|
73618
|
-
const pkgDir =
|
|
73619
|
-
const nodeModulesDir =
|
|
73618
|
+
const pkgDir = dirname26(pkgJsonPath);
|
|
73619
|
+
const nodeModulesDir = dirname26(pkgDir);
|
|
73620
73620
|
if (nodeModulesDir.split(/[\\/]/).pop() !== "node_modules")
|
|
73621
73621
|
return null;
|
|
73622
|
-
return
|
|
73622
|
+
return dirname26(nodeModulesDir);
|
|
73623
73623
|
} catch (error51) {
|
|
73624
73624
|
if (error51 instanceof Error) {
|
|
73625
73625
|
return null;
|
|
@@ -73761,7 +73761,7 @@ var init_background_update_check = __esm(() => {
|
|
|
73761
73761
|
init_update_toasts();
|
|
73762
73762
|
defaultDeps4 = {
|
|
73763
73763
|
existsSync: existsSync48,
|
|
73764
|
-
join:
|
|
73764
|
+
join: join68,
|
|
73765
73765
|
runBunInstallWithDetails,
|
|
73766
73766
|
log: log2,
|
|
73767
73767
|
getOpenCodeCacheDir,
|
|
@@ -73924,7 +73924,7 @@ async function showSpinnerToast(ctx, version3, message) {
|
|
|
73924
73924
|
duration: frameInterval + 50
|
|
73925
73925
|
}
|
|
73926
73926
|
}).catch(ignoreToastError);
|
|
73927
|
-
await new Promise((
|
|
73927
|
+
await new Promise((resolve19) => setTimeout(resolve19, frameInterval));
|
|
73928
73928
|
}
|
|
73929
73929
|
}
|
|
73930
73930
|
var SISYPHUS_SPINNER;
|
|
@@ -74365,13 +74365,13 @@ function getUnsupportedOpenCodeVersionMessage(openCodeVersion) {
|
|
|
74365
74365
|
}
|
|
74366
74366
|
|
|
74367
74367
|
// packages/omo-codex/src/install/install-codex.ts
|
|
74368
|
-
import { join as
|
|
74368
|
+
import { join as join52, resolve as resolve15 } from "path";
|
|
74369
74369
|
import { existsSync as existsSync30 } from "fs";
|
|
74370
74370
|
import { homedir as homedir6 } from "os";
|
|
74371
74371
|
|
|
74372
74372
|
// packages/omo-codex/src/install/codex-cache-bins.ts
|
|
74373
|
-
import { chmod, lstat as
|
|
74374
|
-
import { basename as basename6, isAbsolute as
|
|
74373
|
+
import { chmod, lstat as lstat4, mkdir, readFile as readFile3, readdir as readdir2, readlink as readlink3, rm as rm3, stat as stat2, symlink, writeFile } from "fs/promises";
|
|
74374
|
+
import { basename as basename6, isAbsolute as isAbsolute4, join as join27, relative as relative2, resolve as resolve8, sep } from "path";
|
|
74375
74375
|
|
|
74376
74376
|
// packages/omo-codex/src/install/codex-cache-command-shim.ts
|
|
74377
74377
|
var COMMAND_SHIM_MARKER = ":: generated by oh-my-openagent Codex installer";
|
|
@@ -74414,6 +74414,10 @@ function windowsCommandShim(targetPath) {
|
|
|
74414
74414
|
`);
|
|
74415
74415
|
}
|
|
74416
74416
|
|
|
74417
|
+
// packages/omo-codex/src/install/codex-cache-dangling-bins.ts
|
|
74418
|
+
import { lstat as lstat2, readFile, readdir, readlink, rm, stat } from "fs/promises";
|
|
74419
|
+
import { dirname as dirname10, isAbsolute as isAbsolute3, join as join24, resolve as resolve7 } from "path";
|
|
74420
|
+
|
|
74417
74421
|
// packages/omo-codex/src/install/codex-cache-fs.ts
|
|
74418
74422
|
import { lstat } from "fs/promises";
|
|
74419
74423
|
async function fileExistsStrict(path7) {
|
|
@@ -74433,9 +74437,96 @@ function isNodeErrorWithCode(error) {
|
|
|
74433
74437
|
return typeof error === "object" && error !== null && "code" in error;
|
|
74434
74438
|
}
|
|
74435
74439
|
|
|
74440
|
+
// packages/omo-codex/src/install/codex-cache-dangling-bins.ts
|
|
74441
|
+
async function removeDanglingManagedComponentBins(binDir, platform, managedBinNames) {
|
|
74442
|
+
const entries = await readdir(binDir, { withFileTypes: true });
|
|
74443
|
+
for (const entry of entries) {
|
|
74444
|
+
const binName = managedBinNameForEntry(entry.name, platform);
|
|
74445
|
+
if (binName === null || !managedBinNames.has(binName))
|
|
74446
|
+
continue;
|
|
74447
|
+
const linkPath = join24(binDir, entry.name);
|
|
74448
|
+
if (platform === "win32") {
|
|
74449
|
+
await removeDanglingGeneratedCommandShim(linkPath);
|
|
74450
|
+
continue;
|
|
74451
|
+
}
|
|
74452
|
+
await removeDanglingManagedSymlink(linkPath);
|
|
74453
|
+
}
|
|
74454
|
+
}
|
|
74455
|
+
function managedBinNameForEntry(name, platform) {
|
|
74456
|
+
if (platform === "win32")
|
|
74457
|
+
return name.endsWith(".cmd") ? name.slice(0, -4) : null;
|
|
74458
|
+
return name;
|
|
74459
|
+
}
|
|
74460
|
+
async function removeDanglingManagedSymlink(linkPath) {
|
|
74461
|
+
try {
|
|
74462
|
+
const linkStat = await lstat2(linkPath);
|
|
74463
|
+
if (!linkStat.isSymbolicLink())
|
|
74464
|
+
return;
|
|
74465
|
+
const linkTarget = await readlink(linkPath);
|
|
74466
|
+
const target = isAbsolute3(linkTarget) ? linkTarget : resolve7(dirname10(linkPath), linkTarget);
|
|
74467
|
+
if (!await isFileSystemEntry(target) && isManagedComponentBinTarget(target))
|
|
74468
|
+
await rm(linkPath, { force: true });
|
|
74469
|
+
} catch (error) {
|
|
74470
|
+
if (isNodeErrorWithCode(error) && error.code === "ENOENT")
|
|
74471
|
+
return;
|
|
74472
|
+
throw error;
|
|
74473
|
+
}
|
|
74474
|
+
}
|
|
74475
|
+
async function removeDanglingGeneratedCommandShim(linkPath) {
|
|
74476
|
+
try {
|
|
74477
|
+
const linkStat = await lstat2(linkPath);
|
|
74478
|
+
if (!linkStat.isFile())
|
|
74479
|
+
return;
|
|
74480
|
+
const content = await readFile(linkPath, "utf8");
|
|
74481
|
+
if (!content.includes(COMMAND_SHIM_MARKER))
|
|
74482
|
+
return;
|
|
74483
|
+
const target = extractCommandShimTarget(content);
|
|
74484
|
+
if (target !== null && !await isFileSystemEntry(target) && isManagedComponentBinTarget(target))
|
|
74485
|
+
await rm(linkPath, { force: true });
|
|
74486
|
+
} catch (error) {
|
|
74487
|
+
if (isNodeErrorWithCode(error) && error.code === "ENOENT")
|
|
74488
|
+
return;
|
|
74489
|
+
throw error;
|
|
74490
|
+
}
|
|
74491
|
+
}
|
|
74492
|
+
async function isFileSystemEntry(path7) {
|
|
74493
|
+
try {
|
|
74494
|
+
await stat(path7);
|
|
74495
|
+
return true;
|
|
74496
|
+
} catch (error) {
|
|
74497
|
+
if (isNodeErrorWithCode(error) && error.code === "ENOENT")
|
|
74498
|
+
return false;
|
|
74499
|
+
throw error;
|
|
74500
|
+
}
|
|
74501
|
+
}
|
|
74502
|
+
function extractCommandShimTarget(content) {
|
|
74503
|
+
const match = /"([^"\r\n]+components[\\/][^"\r\n]+[\\/]dist[\\/]cli\.js)" %\*/.exec(content);
|
|
74504
|
+
return match?.[1] ?? null;
|
|
74505
|
+
}
|
|
74506
|
+
function isManagedComponentBinTarget(target) {
|
|
74507
|
+
const parts = target.split(/[\\/]+/);
|
|
74508
|
+
const suffix = parts.slice(-4);
|
|
74509
|
+
return suffix[0] === "components" && suffix[2] === "dist" && suffix[3] === "cli.js" && (hasOmoPluginCachePrefix(parts, parts.length - 4) || hasOmoCodexPluginPrefix(parts, parts.length - 4));
|
|
74510
|
+
}
|
|
74511
|
+
function hasOmoPluginCachePrefix(parts, endExclusive) {
|
|
74512
|
+
for (let index = 0;index < endExclusive - 4; index += 1) {
|
|
74513
|
+
if (parts[index] === "plugins" && parts[index + 1] === "cache" && parts[index + 2] === "sisyphuslabs" && parts[index + 3] === "omo") {
|
|
74514
|
+
return index + 4 < endExclusive;
|
|
74515
|
+
}
|
|
74516
|
+
}
|
|
74517
|
+
return false;
|
|
74518
|
+
}
|
|
74519
|
+
function hasOmoCodexPluginPrefix(parts, endExclusive) {
|
|
74520
|
+
for (let index = 0;index <= endExclusive - 3; index += 1) {
|
|
74521
|
+
if (parts[index] === "packages" && parts[index + 1] === "omo-codex" && parts[index + 2] === "plugin")
|
|
74522
|
+
return true;
|
|
74523
|
+
}
|
|
74524
|
+
return false;
|
|
74525
|
+
}
|
|
74526
|
+
|
|
74436
74527
|
// packages/omo-codex/src/install/codex-cache-legacy-bins.ts
|
|
74437
|
-
import { lstat as
|
|
74438
|
-
import { join as
|
|
74528
|
+
import { lstat as lstat3, readFile as readFile2, readlink as readlink2, rm as rm2 } from "fs/promises";
|
|
74529
|
+
import { join as join25 } from "path";
|
|
74439
74530
|
var LEGACY_CODEX_COMPONENT_BINS = [
|
|
74440
74531
|
{ name: "omo", component: "ulw-loop" },
|
|
74441
74532
|
{ name: "codex-comment-checker", component: "comment-checker" },
|
|
@@ -74447,26 +74538,26 @@ var LEGACY_CODEX_COMPONENT_BINS = [
|
|
|
74447
74538
|
];
|
|
74448
74539
|
async function removeLegacyCodexComponentBins(binDir, platform) {
|
|
74449
74540
|
for (const entry of LEGACY_CODEX_COMPONENT_BINS) {
|
|
74450
|
-
const linkPath =
|
|
74541
|
+
const linkPath = join25(binDir, platform === "win32" ? `${entry.name}.cmd` : entry.name);
|
|
74451
74542
|
await removeLegacyCodexComponentBin(linkPath, entry.component, platform);
|
|
74452
74543
|
}
|
|
74453
74544
|
}
|
|
74454
74545
|
async function removeLegacyCodexComponentBin(linkPath, component, platform) {
|
|
74455
74546
|
try {
|
|
74456
|
-
const
|
|
74547
|
+
const stat2 = await lstat3(linkPath);
|
|
74457
74548
|
if (platform !== "win32") {
|
|
74458
|
-
if (!
|
|
74549
|
+
if (!stat2.isSymbolicLink())
|
|
74459
74550
|
return;
|
|
74460
|
-
const target = await
|
|
74551
|
+
const target = await readlink2(linkPath);
|
|
74461
74552
|
if (isManagedLegacyComponentTarget(target, component))
|
|
74462
|
-
await
|
|
74553
|
+
await rm2(linkPath, { force: true });
|
|
74463
74554
|
return;
|
|
74464
74555
|
}
|
|
74465
|
-
if (!
|
|
74556
|
+
if (!stat2.isFile())
|
|
74466
74557
|
return;
|
|
74467
|
-
const content = await
|
|
74558
|
+
const content = await readFile2(linkPath, "utf8");
|
|
74468
74559
|
if (content.includes(COMMAND_SHIM_MARKER))
|
|
74469
|
-
await
|
|
74560
|
+
await rm2(linkPath, { force: true });
|
|
74470
74561
|
} catch (error) {
|
|
74471
74562
|
if (isNodeErrorWithCode2(error) && error.code === "ENOENT")
|
|
74472
74563
|
return;
|
|
@@ -74477,7 +74568,7 @@ function isManagedLegacyComponentTarget(target, component) {
|
|
|
74477
74568
|
const parts = target.split(/[\\/]+/);
|
|
74478
74569
|
const suffixStart = parts.length - 4;
|
|
74479
74570
|
const suffix = parts.slice(-4);
|
|
74480
|
-
return suffix[0] === "components" && suffix[1] === component && suffix[2] === "dist" && suffix[3] === "cli.js" && (hasPluginCachePrefix(parts, suffixStart) ||
|
|
74571
|
+
return suffix[0] === "components" && suffix[1] === component && suffix[2] === "dist" && suffix[3] === "cli.js" && (hasPluginCachePrefix(parts, suffixStart) || hasOmoCodexPluginPrefix2(parts, suffixStart));
|
|
74481
74572
|
}
|
|
74482
74573
|
function hasPluginCachePrefix(parts, endExclusive) {
|
|
74483
74574
|
for (let index = 0;index < endExclusive - 1; index += 1) {
|
|
@@ -74486,7 +74577,7 @@ function hasPluginCachePrefix(parts, endExclusive) {
|
|
|
74486
74577
|
}
|
|
74487
74578
|
return false;
|
|
74488
74579
|
}
|
|
74489
|
-
function
|
|
74580
|
+
function hasOmoCodexPluginPrefix2(parts, endExclusive) {
|
|
74490
74581
|
for (let index = 0;index <= endExclusive - 3; index += 1) {
|
|
74491
74582
|
if (parts[index] === "packages" && parts[index + 1] === "omo-codex" && parts[index + 2] === "plugin")
|
|
74492
74583
|
return true;
|
|
@@ -74498,10 +74589,10 @@ function isNodeErrorWithCode2(error) {
|
|
|
74498
74589
|
}
|
|
74499
74590
|
|
|
74500
74591
|
// packages/omo-codex/src/install/codex-cache-runtime-wrapper.ts
|
|
74501
|
-
import { join as
|
|
74592
|
+
import { join as join26 } from "path";
|
|
74502
74593
|
var RUNTIME_WRAPPER_MARKER = "OMO_GENERATED_RUNTIME_WRAPPER";
|
|
74503
74594
|
function posixRuntimeWrapper(cliPath, codexHome, binDir, nodeCliPath) {
|
|
74504
|
-
const ulwLoopBin = toPosixPath(
|
|
74595
|
+
const ulwLoopBin = toPosixPath(join26(binDir, "omo-ulw-loop"));
|
|
74505
74596
|
const nodeCli = escapePosixDoubleQuoted(toPosixPath(nodeCliPath));
|
|
74506
74597
|
const escapedCliPath = escapePosixDoubleQuoted(toPosixPath(cliPath));
|
|
74507
74598
|
const escapedCodexHome = escapePosixDoubleQuoted(toPosixPath(codexHome));
|
|
@@ -74546,7 +74637,7 @@ function posixRuntimeWrapper(cliPath, codexHome, binDir, nodeCliPath) {
|
|
|
74546
74637
|
`);
|
|
74547
74638
|
}
|
|
74548
74639
|
function windowsRuntimeWrapper(cliPath, codexHome, binDir, nodeCliPath) {
|
|
74549
|
-
const ulwLoopBin =
|
|
74640
|
+
const ulwLoopBin = join26(binDir, "omo-ulw-loop.cmd");
|
|
74550
74641
|
return [
|
|
74551
74642
|
"@echo off",
|
|
74552
74643
|
`rem ${RUNTIME_WRAPPER_MARKER}`,
|
|
@@ -74594,6 +74685,7 @@ async function linkCachedPluginBins(input) {
|
|
|
74594
74685
|
const platform = input.platform ?? process.platform;
|
|
74595
74686
|
await mkdir(input.binDir, { recursive: true });
|
|
74596
74687
|
await removeLegacyCodexComponentBins(input.binDir, platform);
|
|
74688
|
+
await removeDanglingManagedComponentBins(input.binDir, platform, new Set(binLinks.map((link) => link.name)));
|
|
74597
74689
|
const linked = [];
|
|
74598
74690
|
for (const link of binLinks) {
|
|
74599
74691
|
const linkPath = await linkCachedPluginBin(input.binDir, link, platform);
|
|
@@ -74605,55 +74697,55 @@ async function removeCachedManagedNpmBinShims(pluginRoot) {
|
|
|
74605
74697
|
const binLinks = await discoverPackageBins(pluginRoot);
|
|
74606
74698
|
if (binLinks.length === 0)
|
|
74607
74699
|
return;
|
|
74608
|
-
const npmBinDir =
|
|
74609
|
-
if (!await
|
|
74700
|
+
const npmBinDir = join27(pluginRoot, "node_modules", ".bin");
|
|
74701
|
+
if (!await isFileSystemEntry2(npmBinDir))
|
|
74610
74702
|
return;
|
|
74611
74703
|
const managedBinNames = new Set(binLinks.map((link) => link.name));
|
|
74612
74704
|
for (const name of managedBinNames) {
|
|
74613
74705
|
for (const suffix of ["", ".cmd", ".ps1"]) {
|
|
74614
|
-
await
|
|
74706
|
+
await rm3(join27(npmBinDir, `${name}${suffix}`), { force: true });
|
|
74615
74707
|
}
|
|
74616
74708
|
}
|
|
74617
74709
|
}
|
|
74618
74710
|
async function linkRootRuntimeBin(input) {
|
|
74619
|
-
const cliPath =
|
|
74711
|
+
const cliPath = join27(input.repoRoot, "dist", "cli", "index.js");
|
|
74620
74712
|
if (!await isFile(cliPath))
|
|
74621
74713
|
return null;
|
|
74622
|
-
const nodeCliPath =
|
|
74714
|
+
const nodeCliPath = join27(input.repoRoot, "dist", "cli-node", "index.js");
|
|
74623
74715
|
const platform = input.platform ?? process.platform;
|
|
74624
74716
|
await mkdir(input.binDir, { recursive: true });
|
|
74625
74717
|
if (platform === "win32") {
|
|
74626
|
-
const linkPath2 =
|
|
74718
|
+
const linkPath2 = join27(input.binDir, "omo.cmd");
|
|
74627
74719
|
await replaceRuntimeWrapper(linkPath2, windowsRuntimeWrapper(cliPath, input.codexHome, input.binDir, nodeCliPath));
|
|
74628
74720
|
return { name: "omo", path: linkPath2, target: cliPath };
|
|
74629
74721
|
}
|
|
74630
|
-
const linkPath =
|
|
74722
|
+
const linkPath = join27(input.binDir, "omo");
|
|
74631
74723
|
await replaceRuntimeWrapper(linkPath, posixRuntimeWrapper(cliPath, input.codexHome, input.binDir, nodeCliPath));
|
|
74632
74724
|
await chmod(linkPath, 493);
|
|
74633
74725
|
return { name: "omo", path: linkPath, target: cliPath };
|
|
74634
74726
|
}
|
|
74635
74727
|
async function linkCachedPluginBin(binDir, link, platform) {
|
|
74636
74728
|
if (platform === "win32") {
|
|
74637
|
-
const linkPath2 =
|
|
74729
|
+
const linkPath2 = join27(binDir, `${link.name}.cmd`);
|
|
74638
74730
|
await replaceCommandShim(linkPath2, link.target);
|
|
74639
74731
|
return linkPath2;
|
|
74640
74732
|
}
|
|
74641
|
-
const linkPath =
|
|
74733
|
+
const linkPath = join27(binDir, link.name);
|
|
74642
74734
|
await replaceSymlink(linkPath, link.target);
|
|
74643
74735
|
return linkPath;
|
|
74644
74736
|
}
|
|
74645
74737
|
async function isFile(path7) {
|
|
74646
74738
|
try {
|
|
74647
|
-
return (await
|
|
74739
|
+
return (await stat2(path7)).isFile();
|
|
74648
74740
|
} catch (error) {
|
|
74649
74741
|
if (isNodeErrorWithCode(error) && error.code === "ENOENT")
|
|
74650
74742
|
return false;
|
|
74651
74743
|
throw error;
|
|
74652
74744
|
}
|
|
74653
74745
|
}
|
|
74654
|
-
async function
|
|
74746
|
+
async function isFileSystemEntry2(path7) {
|
|
74655
74747
|
try {
|
|
74656
|
-
await
|
|
74748
|
+
await stat2(path7);
|
|
74657
74749
|
return true;
|
|
74658
74750
|
} catch (error) {
|
|
74659
74751
|
if (isNodeErrorWithCode(error) && error.code === "ENOENT")
|
|
@@ -74667,23 +74759,23 @@ async function discoverPackageBins(root) {
|
|
|
74667
74759
|
return links;
|
|
74668
74760
|
}
|
|
74669
74761
|
async function collectPackageBins(directory, root, links) {
|
|
74670
|
-
const entries = await
|
|
74762
|
+
const entries = await readdir2(directory, { withFileTypes: true });
|
|
74671
74763
|
if (entries.some((entry) => entry.isFile() && entry.name === "package.json")) {
|
|
74672
|
-
await appendPackageBinLinks(
|
|
74764
|
+
await appendPackageBinLinks(join27(directory, "package.json"), directory, root, links);
|
|
74673
74765
|
}
|
|
74674
74766
|
for (const entry of entries) {
|
|
74675
74767
|
if (!entry.isDirectory())
|
|
74676
74768
|
continue;
|
|
74677
74769
|
if (entry.name === "node_modules" || entry.name === ".git" || entry.name === "dist")
|
|
74678
74770
|
continue;
|
|
74679
|
-
const childPath =
|
|
74771
|
+
const childPath = join27(directory, entry.name);
|
|
74680
74772
|
if (!childPath.startsWith(root))
|
|
74681
74773
|
continue;
|
|
74682
74774
|
await collectPackageBins(childPath, root, links);
|
|
74683
74775
|
}
|
|
74684
74776
|
}
|
|
74685
74777
|
async function appendPackageBinLinks(packageJsonPath, packageRoot, root, links) {
|
|
74686
|
-
const packageJson = JSON.parse(await
|
|
74778
|
+
const packageJson = JSON.parse(await readFile3(packageJsonPath, "utf8"));
|
|
74687
74779
|
if (!isPlainRecord3(packageJson))
|
|
74688
74780
|
return;
|
|
74689
74781
|
const packageName = packageJson.name;
|
|
@@ -74718,10 +74810,10 @@ function isReservedNestedBinName(name, packageRoot, root) {
|
|
|
74718
74810
|
function resolvePackageBinTarget(packageRoot, target) {
|
|
74719
74811
|
if (target.includes("\x00"))
|
|
74720
74812
|
throw new Error("Package bin target must stay inside package root");
|
|
74721
|
-
const root =
|
|
74722
|
-
const resolvedTarget =
|
|
74813
|
+
const root = resolve8(packageRoot);
|
|
74814
|
+
const resolvedTarget = resolve8(root, target);
|
|
74723
74815
|
const relativeTarget = relative2(root, resolvedTarget);
|
|
74724
|
-
if (relativeTarget === "" || relativeTarget !== ".." && !relativeTarget.startsWith(`..${sep}`) && !
|
|
74816
|
+
if (relativeTarget === "" || relativeTarget !== ".." && !relativeTarget.startsWith(`..${sep}`) && !isAbsolute4(relativeTarget)) {
|
|
74725
74817
|
return resolvedTarget;
|
|
74726
74818
|
}
|
|
74727
74819
|
throw new Error("Package bin target must stay inside package root");
|
|
@@ -74729,7 +74821,7 @@ function resolvePackageBinTarget(packageRoot, target) {
|
|
|
74729
74821
|
async function replaceSymlink(linkPath, targetPath) {
|
|
74730
74822
|
if (await existingNonSymlink(linkPath))
|
|
74731
74823
|
throw new Error(`${linkPath} already exists and is not a symlink`);
|
|
74732
|
-
await
|
|
74824
|
+
await rm3(linkPath, { force: true });
|
|
74733
74825
|
await symlink(targetPath, linkPath);
|
|
74734
74826
|
}
|
|
74735
74827
|
async function replaceCommandShim(linkPath, targetPath) {
|
|
@@ -74740,17 +74832,17 @@ async function replaceCommandShim(linkPath, targetPath) {
|
|
|
74740
74832
|
async function replaceRuntimeWrapper(linkPath, content) {
|
|
74741
74833
|
if (await existingNonRuntimeWrapper(linkPath))
|
|
74742
74834
|
throw new Error(`${linkPath} already exists and is not a generated OMO runtime wrapper`);
|
|
74743
|
-
await
|
|
74835
|
+
await rm3(linkPath, { force: true });
|
|
74744
74836
|
await writeFile(linkPath, content);
|
|
74745
74837
|
}
|
|
74746
74838
|
async function existingNonRuntimeWrapper(path7) {
|
|
74747
74839
|
try {
|
|
74748
|
-
const
|
|
74749
|
-
if (
|
|
74840
|
+
const stat3 = await lstat4(path7);
|
|
74841
|
+
if (stat3.isSymbolicLink())
|
|
74750
74842
|
return false;
|
|
74751
|
-
if (!
|
|
74843
|
+
if (!stat3.isFile())
|
|
74752
74844
|
return true;
|
|
74753
|
-
const content = await
|
|
74845
|
+
const content = await readFile3(path7, "utf8");
|
|
74754
74846
|
return !content.includes(RUNTIME_WRAPPER_MARKER);
|
|
74755
74847
|
} catch (error) {
|
|
74756
74848
|
if (isNodeErrorWithCode(error) && error.code === "ENOENT")
|
|
@@ -74760,10 +74852,10 @@ async function existingNonRuntimeWrapper(path7) {
|
|
|
74760
74852
|
}
|
|
74761
74853
|
async function existingNonShim(path7) {
|
|
74762
74854
|
try {
|
|
74763
|
-
const
|
|
74764
|
-
if (!
|
|
74855
|
+
const stat3 = await lstat4(path7);
|
|
74856
|
+
if (!stat3.isFile())
|
|
74765
74857
|
return true;
|
|
74766
|
-
const content = await
|
|
74858
|
+
const content = await readFile3(path7, "utf8");
|
|
74767
74859
|
if (content.includes(COMMAND_SHIM_MARKER))
|
|
74768
74860
|
return false;
|
|
74769
74861
|
throw new Error(`${path7} already exists and is not a generated command shim`);
|
|
@@ -74775,10 +74867,10 @@ async function existingNonShim(path7) {
|
|
|
74775
74867
|
}
|
|
74776
74868
|
async function existingNonSymlink(path7) {
|
|
74777
74869
|
try {
|
|
74778
|
-
const
|
|
74779
|
-
if (!
|
|
74870
|
+
const stat3 = await lstat4(path7);
|
|
74871
|
+
if (!stat3.isSymbolicLink())
|
|
74780
74872
|
return true;
|
|
74781
|
-
await
|
|
74873
|
+
await readlink3(path7);
|
|
74782
74874
|
return false;
|
|
74783
74875
|
} catch (error) {
|
|
74784
74876
|
if (isNodeErrorWithCode(error) && error.code === "ENOENT")
|
|
@@ -74787,12 +74879,12 @@ async function existingNonSymlink(path7) {
|
|
|
74787
74879
|
}
|
|
74788
74880
|
}
|
|
74789
74881
|
// packages/omo-codex/src/install/codex-cache-install.ts
|
|
74790
|
-
import { cp as cp2, mkdir as mkdir3, readFile as
|
|
74791
|
-
import { basename as basename7, dirname as
|
|
74882
|
+
import { cp as cp2, mkdir as mkdir3, readFile as readFile8, readdir as readdir4, rename, rm as rm4 } from "fs/promises";
|
|
74883
|
+
import { basename as basename7, dirname as dirname13, join as join33, sep as sep5 } from "path";
|
|
74792
74884
|
|
|
74793
74885
|
// packages/omo-codex/src/install/codex-cache-bundled-mcps.ts
|
|
74794
|
-
import { cp, mkdir as mkdir2, readFile as
|
|
74795
|
-
import { dirname as
|
|
74886
|
+
import { cp, mkdir as mkdir2, readFile as readFile4, stat as stat3 } from "fs/promises";
|
|
74887
|
+
import { dirname as dirname11, join as join28, resolve as resolve9 } from "path";
|
|
74796
74888
|
var BUNDLED_MCP_RUNTIMES = [
|
|
74797
74889
|
{
|
|
74798
74890
|
label: "Git Bash MCP",
|
|
@@ -74810,7 +74902,7 @@ var BUNDLED_MCP_RUNTIMES = [
|
|
|
74810
74902
|
}
|
|
74811
74903
|
];
|
|
74812
74904
|
async function copyBundledMcpRuntimeDists(input) {
|
|
74813
|
-
const sourceArgs = await readSourceMcpArgs(
|
|
74905
|
+
const sourceArgs = await readSourceMcpArgs(join28(input.sourceRoot, ".mcp.json"));
|
|
74814
74906
|
for (const runtime4 of BUNDLED_MCP_RUNTIMES) {
|
|
74815
74907
|
if (!sourceArgs.has(runtime4.sourceArg))
|
|
74816
74908
|
continue;
|
|
@@ -74819,21 +74911,21 @@ async function copyBundledMcpRuntimeDists(input) {
|
|
|
74819
74911
|
}
|
|
74820
74912
|
function resolveBundledMcpRuntimeArg(pluginRoot, arg) {
|
|
74821
74913
|
const runtime4 = BUNDLED_MCP_RUNTIMES.find((candidate) => candidate.sourceArg === arg);
|
|
74822
|
-
return runtime4 ?
|
|
74914
|
+
return runtime4 ? join28(pluginRoot, runtime4.destinationArg) : null;
|
|
74823
74915
|
}
|
|
74824
74916
|
async function copyBundledMcpRuntimeDist(pluginRoot, sourceRoot, runtime4) {
|
|
74825
|
-
const sourcePath =
|
|
74917
|
+
const sourcePath = resolve9(sourceRoot, runtime4.sourceDistFromPlugin);
|
|
74826
74918
|
if (!await isDirectory(sourcePath)) {
|
|
74827
74919
|
throw new Error(`missing built ${runtime4.label} dist at ${sourcePath}`);
|
|
74828
74920
|
}
|
|
74829
|
-
const destinationPath =
|
|
74830
|
-
await mkdir2(
|
|
74921
|
+
const destinationPath = join28(pluginRoot, runtime4.destinationDistFromPlugin);
|
|
74922
|
+
await mkdir2(dirname11(destinationPath), { recursive: true });
|
|
74831
74923
|
await cp(sourcePath, destinationPath, { recursive: true });
|
|
74832
74924
|
}
|
|
74833
74925
|
async function readSourceMcpArgs(path7) {
|
|
74834
74926
|
let parsed;
|
|
74835
74927
|
try {
|
|
74836
|
-
parsed = JSON.parse(await
|
|
74928
|
+
parsed = JSON.parse(await readFile4(path7, "utf8"));
|
|
74837
74929
|
} catch (error) {
|
|
74838
74930
|
if (error instanceof Error)
|
|
74839
74931
|
return new Set;
|
|
@@ -74854,7 +74946,7 @@ async function readSourceMcpArgs(path7) {
|
|
|
74854
74946
|
}
|
|
74855
74947
|
async function isDirectory(path7) {
|
|
74856
74948
|
try {
|
|
74857
|
-
return (await
|
|
74949
|
+
return (await stat3(path7)).isDirectory();
|
|
74858
74950
|
} catch (error) {
|
|
74859
74951
|
if (error instanceof Error)
|
|
74860
74952
|
return false;
|
|
@@ -74864,28 +74956,28 @@ async function isDirectory(path7) {
|
|
|
74864
74956
|
|
|
74865
74957
|
// packages/omo-codex/src/install/codex-cache-local-dependencies.ts
|
|
74866
74958
|
import { realpathSync as realpathSync6 } from "fs";
|
|
74867
|
-
import { readFile as
|
|
74868
|
-
import { dirname as
|
|
74959
|
+
import { readFile as readFile5, readdir as readdir3, writeFile as writeFile2 } from "fs/promises";
|
|
74960
|
+
import { dirname as dirname12, isAbsolute as isAbsolute6, join as join30, relative as relative4, resolve as resolve11, sep as sep2 } from "path";
|
|
74869
74961
|
|
|
74870
74962
|
// packages/omo-codex/src/install/codex-cache-paths.ts
|
|
74871
74963
|
import { existsSync as existsSync26, readdirSync as readdirSync4 } from "fs";
|
|
74872
|
-
import { isAbsolute as
|
|
74964
|
+
import { isAbsolute as isAbsolute5, join as join29, relative as relative3, resolve as resolve10 } from "path";
|
|
74873
74965
|
var DEFAULT_CODEX_MARKETPLACE_NAME = "sisyphuslabs";
|
|
74874
74966
|
var DEFAULT_CODEX_PLUGIN_NAME = "omo";
|
|
74875
74967
|
function resolveDefaultCodexHome(homeDir) {
|
|
74876
|
-
return
|
|
74968
|
+
return join29(homeDir, ".codex");
|
|
74877
74969
|
}
|
|
74878
74970
|
function resolveCodexPluginCacheRoot(codexHome, input = {}) {
|
|
74879
|
-
return
|
|
74971
|
+
return join29(codexHome, "plugins", "cache", input.marketplaceName ?? DEFAULT_CODEX_MARKETPLACE_NAME, input.pluginName ?? DEFAULT_CODEX_PLUGIN_NAME);
|
|
74880
74972
|
}
|
|
74881
74973
|
function resolveCachedCodexComponentCliPath(pluginRoot, componentName) {
|
|
74882
|
-
return
|
|
74974
|
+
return join29(pluginRoot, "components", componentName, "dist", "cli.js");
|
|
74883
74975
|
}
|
|
74884
74976
|
function resolveCodexComponentBinCandidates(input) {
|
|
74885
74977
|
return [
|
|
74886
|
-
input.env.CODEX_LOCAL_BIN_DIR ?
|
|
74887
|
-
|
|
74888
|
-
|
|
74978
|
+
input.env.CODEX_LOCAL_BIN_DIR ? join29(input.env.CODEX_LOCAL_BIN_DIR, input.executableName) : undefined,
|
|
74979
|
+
join29(input.homeDir, ".local", "bin", input.executableName),
|
|
74980
|
+
join29(resolveDefaultCodexHome(input.homeDir), "bin", input.executableName)
|
|
74889
74981
|
].filter((value) => typeof value === "string");
|
|
74890
74982
|
}
|
|
74891
74983
|
function findNewestCachedCodexComponentCli(input) {
|
|
@@ -74894,21 +74986,21 @@ function findNewestCachedCodexComponentCli(input) {
|
|
|
74894
74986
|
return null;
|
|
74895
74987
|
const versions = readdirSync4(versionsRoot, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort(compareVersionNames).reverse();
|
|
74896
74988
|
for (const version of versions) {
|
|
74897
|
-
const candidate = resolveCachedCodexComponentCliPath(
|
|
74989
|
+
const candidate = resolveCachedCodexComponentCliPath(join29(versionsRoot, version), input.componentName);
|
|
74898
74990
|
if (existsSync26(candidate))
|
|
74899
74991
|
return candidate;
|
|
74900
74992
|
}
|
|
74901
74993
|
return null;
|
|
74902
74994
|
}
|
|
74903
74995
|
function resolveCachedRuntimePath(pluginRoot, sourceRoot, runtimePath) {
|
|
74904
|
-
const targetPath =
|
|
74996
|
+
const targetPath = resolve10(pluginRoot, runtimePath);
|
|
74905
74997
|
if (isPathInside(targetPath, pluginRoot))
|
|
74906
74998
|
return targetPath;
|
|
74907
|
-
return
|
|
74999
|
+
return resolve10(sourceRoot, runtimePath);
|
|
74908
75000
|
}
|
|
74909
75001
|
function isPathInside(candidatePath, rootPath) {
|
|
74910
75002
|
const pathFromRoot = relative3(rootPath, candidatePath);
|
|
74911
|
-
return pathFromRoot === "" || !pathFromRoot.startsWith("..") && !
|
|
75003
|
+
return pathFromRoot === "" || !pathFromRoot.startsWith("..") && !isAbsolute5(pathFromRoot);
|
|
74912
75004
|
}
|
|
74913
75005
|
function compareVersionNames(left, right) {
|
|
74914
75006
|
const leftParts = left.split(".").map((part) => Number.parseInt(part, 10));
|
|
@@ -74929,12 +75021,12 @@ async function rewriteCachedPackageLocalFileDependencies(pluginRoot, sourceRoot)
|
|
|
74929
75021
|
await collectPackageJsonPaths(pluginRoot, pluginRoot, packageJsonPaths);
|
|
74930
75022
|
const packageLock = await readPackageLock(pluginRoot);
|
|
74931
75023
|
for (const packageJsonPath of packageJsonPaths) {
|
|
74932
|
-
const raw = await
|
|
75024
|
+
const raw = await readFile5(packageJsonPath, "utf8");
|
|
74933
75025
|
const parsed = JSON.parse(raw);
|
|
74934
75026
|
if (!isPlainRecord3(parsed))
|
|
74935
75027
|
continue;
|
|
74936
|
-
const packageDir =
|
|
74937
|
-
const sourcePackageDir =
|
|
75028
|
+
const packageDir = dirname12(packageJsonPath);
|
|
75029
|
+
const sourcePackageDir = join30(sourceRoot, relative4(pluginRoot, packageDir));
|
|
74938
75030
|
let changed = false;
|
|
74939
75031
|
for (const field of ["dependencies", "optionalDependencies", "peerDependencies"]) {
|
|
74940
75032
|
const dependencies = parsed[field];
|
|
@@ -74944,12 +75036,12 @@ async function rewriteCachedPackageLocalFileDependencies(pluginRoot, sourceRoot)
|
|
|
74944
75036
|
if (typeof specifier !== "string" || !specifier.startsWith("file:"))
|
|
74945
75037
|
continue;
|
|
74946
75038
|
const filePath = specifier.slice("file:".length);
|
|
74947
|
-
if (filePath.length === 0 ||
|
|
75039
|
+
if (filePath.length === 0 || isAbsolute6(filePath))
|
|
74948
75040
|
continue;
|
|
74949
|
-
const targetPath =
|
|
75041
|
+
const targetPath = resolve11(packageDir, filePath);
|
|
74950
75042
|
if (isPathInside(targetPath, pluginRoot))
|
|
74951
75043
|
continue;
|
|
74952
|
-
const sourceTargetPath =
|
|
75044
|
+
const sourceTargetPath = resolve11(sourcePackageDir, filePath);
|
|
74953
75045
|
dependencies[name] = `file:${sourceTargetPath}`;
|
|
74954
75046
|
rewritePackageLockFileDependency({
|
|
74955
75047
|
dependencyName: name,
|
|
@@ -74972,9 +75064,9 @@ async function rewriteCachedPackageLocalFileDependencies(pluginRoot, sourceRoot)
|
|
|
74972
75064
|
`);
|
|
74973
75065
|
}
|
|
74974
75066
|
async function readPackageLock(pluginRoot) {
|
|
74975
|
-
const path7 =
|
|
75067
|
+
const path7 = join30(pluginRoot, "package-lock.json");
|
|
74976
75068
|
try {
|
|
74977
|
-
const parsed = JSON.parse(await
|
|
75069
|
+
const parsed = JSON.parse(await readFile5(path7, "utf8"));
|
|
74978
75070
|
return { path: path7, value: isPlainRecord3(parsed) ? parsed : null, changed: false };
|
|
74979
75071
|
} catch (error) {
|
|
74980
75072
|
if (error instanceof Error && "code" in error && error.code === "ENOENT") {
|
|
@@ -75031,16 +75123,16 @@ function canonicalizeExistingPath(path7) {
|
|
|
75031
75123
|
}
|
|
75032
75124
|
}
|
|
75033
75125
|
async function collectPackageJsonPaths(directory, root, paths) {
|
|
75034
|
-
const entries = await
|
|
75126
|
+
const entries = await readdir3(directory, { withFileTypes: true });
|
|
75035
75127
|
if (entries.some((entry) => entry.isFile() && entry.name === "package.json")) {
|
|
75036
|
-
paths.push(
|
|
75128
|
+
paths.push(join30(directory, "package.json"));
|
|
75037
75129
|
}
|
|
75038
75130
|
for (const entry of entries) {
|
|
75039
75131
|
if (!entry.isDirectory())
|
|
75040
75132
|
continue;
|
|
75041
75133
|
if (entry.name === "node_modules" || entry.name === ".git" || entry.name === "dist")
|
|
75042
75134
|
continue;
|
|
75043
|
-
const childPath =
|
|
75135
|
+
const childPath = join30(directory, entry.name);
|
|
75044
75136
|
if (!isPathInside(childPath, root))
|
|
75045
75137
|
continue;
|
|
75046
75138
|
await collectPackageJsonPaths(childPath, root, paths);
|
|
@@ -75049,15 +75141,15 @@ async function collectPackageJsonPaths(directory, root, paths) {
|
|
|
75049
75141
|
|
|
75050
75142
|
// packages/omo-codex/src/install/codex-cache-mcp-manifest.ts
|
|
75051
75143
|
init_resolve2();
|
|
75052
|
-
import { readFile as
|
|
75053
|
-
import { join as
|
|
75144
|
+
import { readFile as readFile6, writeFile as writeFile3 } from "fs/promises";
|
|
75145
|
+
import { join as join31, sep as sep3 } from "path";
|
|
75054
75146
|
var CODEGRAPH_RELATIVE_ARGS = new Set(["components/codegraph/dist/serve.js", "./components/codegraph/dist/serve.js"]);
|
|
75055
75147
|
var CONTEXT7_API_KEY_ENV = "CONTEXT7_API_KEY";
|
|
75056
75148
|
async function rewriteCachedMcpManifest(pluginRoot, sourceRoot = pluginRoot, options = {}) {
|
|
75057
|
-
const manifestPath =
|
|
75149
|
+
const manifestPath = join31(pluginRoot, ".mcp.json");
|
|
75058
75150
|
if (!await fileExistsStrict(manifestPath))
|
|
75059
75151
|
return;
|
|
75060
|
-
const raw = await
|
|
75152
|
+
const raw = await readFile6(manifestPath, "utf8");
|
|
75061
75153
|
const parsed = JSON.parse(raw);
|
|
75062
75154
|
if (!isPlainRecord3(parsed) || !isPlainRecord3(parsed.mcpServers))
|
|
75063
75155
|
return;
|
|
@@ -75078,7 +75170,7 @@ async function rewriteCachedMcpManifest(pluginRoot, sourceRoot = pluginRoot, opt
|
|
|
75078
75170
|
if (bundledMcpRuntimeArg !== null)
|
|
75079
75171
|
return bundledMcpRuntimeArg;
|
|
75080
75172
|
if (CODEGRAPH_RELATIVE_ARGS.has(arg))
|
|
75081
|
-
return
|
|
75173
|
+
return join31(pluginRoot, "components", "codegraph", "dist", "serve.js");
|
|
75082
75174
|
if (arg.startsWith("./") || arg.startsWith("../"))
|
|
75083
75175
|
return resolveCachedRuntimePath(pluginRoot, sourceRoot, arg);
|
|
75084
75176
|
return arg;
|
|
@@ -75158,10 +75250,10 @@ function isPlaceholderContext7ApiKey(value) {
|
|
|
75158
75250
|
return normalized.length === 0 || normalized === "your api key";
|
|
75159
75251
|
}
|
|
75160
75252
|
async function rewriteCachedManifestRoot(pluginRoot, fromRoot, toRoot) {
|
|
75161
|
-
const manifestPath =
|
|
75253
|
+
const manifestPath = join31(pluginRoot, ".mcp.json");
|
|
75162
75254
|
if (!await fileExistsStrict(manifestPath))
|
|
75163
75255
|
return;
|
|
75164
|
-
const raw = await
|
|
75256
|
+
const raw = await readFile6(manifestPath, "utf8");
|
|
75165
75257
|
const parsed = JSON.parse(raw);
|
|
75166
75258
|
if (!isPlainRecord3(parsed) || !isPlainRecord3(parsed.mcpServers))
|
|
75167
75259
|
return;
|
|
@@ -75193,15 +75285,15 @@ async function rewriteCachedManifestRoot(pluginRoot, fromRoot, toRoot) {
|
|
|
75193
75285
|
}
|
|
75194
75286
|
|
|
75195
75287
|
// packages/omo-codex/src/install/codex-hook-targets.ts
|
|
75196
|
-
import { readFile as
|
|
75197
|
-
import { join as
|
|
75288
|
+
import { readFile as readFile7 } from "fs/promises";
|
|
75289
|
+
import { join as join32, sep as sep4 } from "path";
|
|
75198
75290
|
var PLUGIN_ROOT_TARGET_PATTERN = /\$\{PLUGIN_ROOT\}[\\/]+([^"']+)/g;
|
|
75199
75291
|
async function findMissingHookCommandTargets(pluginRoot) {
|
|
75200
75292
|
const commands = [];
|
|
75201
75293
|
for (const manifestPath of await hookManifestPaths(pluginRoot)) {
|
|
75202
75294
|
if (!await fileExistsStrict(manifestPath))
|
|
75203
75295
|
continue;
|
|
75204
|
-
const parsed = JSON.parse(await
|
|
75296
|
+
const parsed = JSON.parse(await readFile7(manifestPath, "utf8"));
|
|
75205
75297
|
collectCommands(parsed, commands);
|
|
75206
75298
|
}
|
|
75207
75299
|
const missing = [];
|
|
@@ -75211,7 +75303,7 @@ async function findMissingHookCommandTargets(pluginRoot) {
|
|
|
75211
75303
|
const targetSuffix = match[1];
|
|
75212
75304
|
if (targetSuffix === undefined)
|
|
75213
75305
|
continue;
|
|
75214
|
-
const target =
|
|
75306
|
+
const target = join32(pluginRoot, ...targetSuffix.split(/[\\/]+/));
|
|
75215
75307
|
if (seen.has(target))
|
|
75216
75308
|
continue;
|
|
75217
75309
|
seen.add(target);
|
|
@@ -75222,17 +75314,17 @@ async function findMissingHookCommandTargets(pluginRoot) {
|
|
|
75222
75314
|
return missing;
|
|
75223
75315
|
}
|
|
75224
75316
|
async function hookManifestPaths(pluginRoot) {
|
|
75225
|
-
const pluginManifestPath =
|
|
75317
|
+
const pluginManifestPath = join32(pluginRoot, ".codex-plugin", "plugin.json");
|
|
75226
75318
|
if (!await fileExistsStrict(pluginManifestPath))
|
|
75227
|
-
return [
|
|
75228
|
-
const parsed = JSON.parse(await
|
|
75319
|
+
return [join32(pluginRoot, "hooks", "hooks.json")];
|
|
75320
|
+
const parsed = JSON.parse(await readFile7(pluginManifestPath, "utf8"));
|
|
75229
75321
|
if (!isPlainRecord3(parsed))
|
|
75230
75322
|
return [];
|
|
75231
75323
|
if (typeof parsed.hooks === "string" && parsed.hooks.trim() !== "") {
|
|
75232
|
-
return [
|
|
75324
|
+
return [join32(pluginRoot, stripDotSlash(parsed.hooks))];
|
|
75233
75325
|
}
|
|
75234
75326
|
if (Array.isArray(parsed.hooks)) {
|
|
75235
|
-
return parsed.hooks.filter((hookPath) => typeof hookPath === "string" && hookPath.trim() !== "").map((hookPath) =>
|
|
75327
|
+
return parsed.hooks.filter((hookPath) => typeof hookPath === "string" && hookPath.trim() !== "").map((hookPath) => join32(pluginRoot, stripDotSlash(hookPath)));
|
|
75236
75328
|
}
|
|
75237
75329
|
return [];
|
|
75238
75330
|
}
|
|
@@ -75268,9 +75360,9 @@ async function installCachedPlugin(input) {
|
|
|
75268
75360
|
await maybeRunNpmInstall(input.sourcePath, input.runCommand);
|
|
75269
75361
|
await maybeRunNpmBuild(input.sourcePath, input.runCommand);
|
|
75270
75362
|
}
|
|
75271
|
-
const targetPath =
|
|
75363
|
+
const targetPath = join33(input.codexHome, "plugins", "cache", input.marketplaceName, input.name, input.version);
|
|
75272
75364
|
const tempPath = createTempSiblingPath(targetPath);
|
|
75273
|
-
await
|
|
75365
|
+
await rm4(tempPath, { recursive: true, force: true });
|
|
75274
75366
|
try {
|
|
75275
75367
|
await copyDirectory(input.sourcePath, tempPath);
|
|
75276
75368
|
await rewriteCachedPackageLocalFileDependencies(tempPath, input.sourcePath);
|
|
@@ -75286,20 +75378,20 @@ async function installCachedPlugin(input) {
|
|
|
75286
75378
|
await assertHookCommandTargets(tempPath);
|
|
75287
75379
|
await promoteDirectory(tempPath, targetPath, input.renameDirectory ?? rename);
|
|
75288
75380
|
} catch (error) {
|
|
75289
|
-
await
|
|
75381
|
+
await rm4(tempPath, { recursive: true, force: true });
|
|
75290
75382
|
throw error;
|
|
75291
75383
|
}
|
|
75292
75384
|
return { name: input.name, version: input.version, path: targetPath };
|
|
75293
75385
|
}
|
|
75294
75386
|
async function maybeRunNpmInstall(cwd, runCommand, args = ["install"]) {
|
|
75295
|
-
if (!await fileExistsStrict(
|
|
75387
|
+
if (!await fileExistsStrict(join33(cwd, "package.json")))
|
|
75296
75388
|
return;
|
|
75297
75389
|
await runCommand("npm", args, { cwd });
|
|
75298
75390
|
}
|
|
75299
75391
|
async function maybeRunNpmBuild(cwd, runCommand) {
|
|
75300
|
-
if (!await fileExistsStrict(
|
|
75392
|
+
if (!await fileExistsStrict(join33(cwd, "package.json")))
|
|
75301
75393
|
return;
|
|
75302
|
-
const packageJson = JSON.parse(await
|
|
75394
|
+
const packageJson = JSON.parse(await readFile8(join33(cwd, "package.json"), "utf8"));
|
|
75303
75395
|
if (!isPlainRecord3(packageJson))
|
|
75304
75396
|
return;
|
|
75305
75397
|
const scripts = packageJson.scripts;
|
|
@@ -75308,9 +75400,9 @@ async function maybeRunNpmBuild(cwd, runCommand) {
|
|
|
75308
75400
|
await runCommand("npm", ["run", "build"], { cwd });
|
|
75309
75401
|
}
|
|
75310
75402
|
async function maybeRunNpmSyncSkills(cwd, runCommand) {
|
|
75311
|
-
if (!await fileExistsStrict(
|
|
75403
|
+
if (!await fileExistsStrict(join33(cwd, "package.json")))
|
|
75312
75404
|
return;
|
|
75313
|
-
const packageJson = JSON.parse(await
|
|
75405
|
+
const packageJson = JSON.parse(await readFile8(join33(cwd, "package.json"), "utf8"));
|
|
75314
75406
|
if (!isPlainRecord3(packageJson))
|
|
75315
75407
|
return;
|
|
75316
75408
|
const scripts = packageJson.scripts;
|
|
@@ -75319,18 +75411,18 @@ async function maybeRunNpmSyncSkills(cwd, runCommand) {
|
|
|
75319
75411
|
await runCommand("npm", ["run", "sync:skills"], { cwd });
|
|
75320
75412
|
}
|
|
75321
75413
|
function createTempSiblingPath(targetPath) {
|
|
75322
|
-
return
|
|
75414
|
+
return join33(dirname13(targetPath), `.tmp-${basename7(targetPath)}-${process.pid}-${Date.now()}`);
|
|
75323
75415
|
}
|
|
75324
75416
|
function createBackupSiblingPath(targetPath) {
|
|
75325
|
-
return
|
|
75417
|
+
return join33(dirname13(targetPath), `.backup-${basename7(targetPath)}-${process.pid}-${Date.now()}`);
|
|
75326
75418
|
}
|
|
75327
75419
|
async function copyDirectory(sourcePath, targetPath) {
|
|
75328
|
-
await mkdir3(
|
|
75420
|
+
await mkdir3(dirname13(targetPath), { recursive: true });
|
|
75329
75421
|
await cp2(sourcePath, targetPath, { recursive: true, filter: (source) => shouldCopyPluginPath(source, sourcePath) });
|
|
75330
75422
|
}
|
|
75331
75423
|
async function promoteDirectory(tempPath, targetPath, renameDirectory) {
|
|
75332
75424
|
const backupPath = createBackupSiblingPath(targetPath);
|
|
75333
|
-
await
|
|
75425
|
+
await rm4(backupPath, { recursive: true, force: true });
|
|
75334
75426
|
let backupMoved = false;
|
|
75335
75427
|
try {
|
|
75336
75428
|
if (await fileExistsStrict(targetPath)) {
|
|
@@ -75344,12 +75436,12 @@ async function promoteDirectory(tempPath, targetPath, renameDirectory) {
|
|
|
75344
75436
|
throw error;
|
|
75345
75437
|
}
|
|
75346
75438
|
if (backupMoved)
|
|
75347
|
-
await
|
|
75439
|
+
await rm4(backupPath, { recursive: true, force: true });
|
|
75348
75440
|
}
|
|
75349
75441
|
async function restoreBackupDirectory(backupPath, targetPath, renameDirectory) {
|
|
75350
75442
|
if (!await fileExistsStrict(backupPath))
|
|
75351
75443
|
return;
|
|
75352
|
-
await
|
|
75444
|
+
await rm4(targetPath, { recursive: true, force: true });
|
|
75353
75445
|
await renameDirectory(backupPath, targetPath);
|
|
75354
75446
|
}
|
|
75355
75447
|
function shouldCopyPluginPath(path7, root) {
|
|
@@ -75365,18 +75457,18 @@ var removedSparkshellPromptSurfaceFiles = new Set(["directive.md", "plugin.json"
|
|
|
75365
75457
|
var removedSparkshellTextFilePattern = /\.(?:json|md|toml|ya?ml)$/i;
|
|
75366
75458
|
async function assertNoRemovedSparkshellPromptReferences(pluginRoot) {
|
|
75367
75459
|
for (const filePath of await listRemovedSparkshellPromptSurfaceFiles(pluginRoot, "")) {
|
|
75368
|
-
const content = await
|
|
75460
|
+
const content = await readFile8(join33(pluginRoot, filePath), "utf8");
|
|
75369
75461
|
if (!removedSparkshellReferencePattern.test(content))
|
|
75370
75462
|
continue;
|
|
75371
75463
|
throw new Error(`removed sparkshell reference found in Codex plugin prompt surface: ${filePath}`);
|
|
75372
75464
|
}
|
|
75373
75465
|
}
|
|
75374
75466
|
async function listRemovedSparkshellPromptSurfaceFiles(pluginRoot, relativeDirectory) {
|
|
75375
|
-
const directory = relativeDirectory === "" ? pluginRoot :
|
|
75376
|
-
const entries = await
|
|
75467
|
+
const directory = relativeDirectory === "" ? pluginRoot : join33(pluginRoot, relativeDirectory);
|
|
75468
|
+
const entries = await readdir4(directory, { withFileTypes: true });
|
|
75377
75469
|
const files = [];
|
|
75378
75470
|
for (const entry of entries) {
|
|
75379
|
-
const relativePath = relativeDirectory === "" ? entry.name :
|
|
75471
|
+
const relativePath = relativeDirectory === "" ? entry.name : join33(relativeDirectory, entry.name);
|
|
75380
75472
|
if (entry.isDirectory()) {
|
|
75381
75473
|
if (shouldDescendIntoRemovedSparkshellPromptSurface(relativePath)) {
|
|
75382
75474
|
files.push(...await listRemovedSparkshellPromptSurfaceFiles(pluginRoot, relativePath));
|
|
@@ -75416,29 +75508,29 @@ async function copyRootRuntimeDists(input) {
|
|
|
75416
75508
|
if (repoRoot === null)
|
|
75417
75509
|
return;
|
|
75418
75510
|
for (const runtimePath of ["dist/cli", "dist/cli-node"]) {
|
|
75419
|
-
const sourcePath =
|
|
75420
|
-
if (!await fileExistsStrict(
|
|
75511
|
+
const sourcePath = join33(repoRoot, runtimePath);
|
|
75512
|
+
if (!await fileExistsStrict(join33(sourcePath, "index.js")))
|
|
75421
75513
|
continue;
|
|
75422
|
-
await mkdir3(
|
|
75423
|
-
await cp2(sourcePath,
|
|
75514
|
+
await mkdir3(dirname13(join33(input.pluginRoot, runtimePath)), { recursive: true });
|
|
75515
|
+
await cp2(sourcePath, join33(input.pluginRoot, runtimePath), { recursive: true });
|
|
75424
75516
|
}
|
|
75425
75517
|
}
|
|
75426
75518
|
function repoRootForCodexPluginSource(sourcePath) {
|
|
75427
|
-
const codexPackageRoot =
|
|
75428
|
-
const packagesRoot =
|
|
75519
|
+
const codexPackageRoot = dirname13(sourcePath);
|
|
75520
|
+
const packagesRoot = dirname13(codexPackageRoot);
|
|
75429
75521
|
if (basename7(sourcePath) !== "plugin")
|
|
75430
75522
|
return null;
|
|
75431
75523
|
if (basename7(codexPackageRoot) !== "omo-codex")
|
|
75432
75524
|
return null;
|
|
75433
75525
|
if (basename7(packagesRoot) !== "packages")
|
|
75434
75526
|
return null;
|
|
75435
|
-
return
|
|
75527
|
+
return dirname13(packagesRoot);
|
|
75436
75528
|
}
|
|
75437
75529
|
// packages/omo-codex/src/install/codex-cache-prune.ts
|
|
75438
|
-
import { lstat as
|
|
75439
|
-
import { join as
|
|
75530
|
+
import { lstat as lstat5, readdir as readdir5, rm as rm5, stat as stat4 } from "fs/promises";
|
|
75531
|
+
import { join as join34 } from "path";
|
|
75440
75532
|
async function pruneMarketplaceCache(input) {
|
|
75441
|
-
const cacheRoot =
|
|
75533
|
+
const cacheRoot = join34(input.codexHome, "plugins", "cache", input.marketplaceName);
|
|
75442
75534
|
if (!await fileExistsStrict(cacheRoot))
|
|
75443
75535
|
return;
|
|
75444
75536
|
const keep = new Set(input.keepPluginNames);
|
|
@@ -75446,28 +75538,28 @@ async function pruneMarketplaceCache(input) {
|
|
|
75446
75538
|
for (const entry of entries) {
|
|
75447
75539
|
if (!entry.isDirectory() || keep.has(entry.name))
|
|
75448
75540
|
continue;
|
|
75449
|
-
await
|
|
75541
|
+
await rm5(join34(cacheRoot, entry.name), { recursive: true, force: true });
|
|
75450
75542
|
}
|
|
75451
75543
|
}
|
|
75452
75544
|
async function pruneMarketplacePluginCaches(input) {
|
|
75453
|
-
const cacheRoot =
|
|
75545
|
+
const cacheRoot = join34(input.codexHome, "plugins", "cache", input.marketplaceName);
|
|
75454
75546
|
if (!await fileExistsStrict(cacheRoot))
|
|
75455
75547
|
return;
|
|
75456
75548
|
for (const pluginName of input.pluginNames) {
|
|
75457
|
-
await
|
|
75549
|
+
await rm5(join34(cacheRoot, pluginName), { recursive: true, force: true });
|
|
75458
75550
|
}
|
|
75459
75551
|
const remainingEntries = await readCacheEntryNames(cacheRoot);
|
|
75460
75552
|
if (remainingEntries.length === 0) {
|
|
75461
|
-
await
|
|
75553
|
+
await rm5(cacheRoot, { recursive: true, force: true });
|
|
75462
75554
|
}
|
|
75463
75555
|
}
|
|
75464
75556
|
async function readCacheEntries(path7) {
|
|
75465
75557
|
const emptyEntries = [];
|
|
75466
|
-
return readCacheRoot(path7, () =>
|
|
75558
|
+
return readCacheRoot(path7, () => readdir5(path7, { withFileTypes: true }), emptyEntries);
|
|
75467
75559
|
}
|
|
75468
75560
|
async function readCacheEntryNames(path7) {
|
|
75469
75561
|
const emptyNames = [];
|
|
75470
|
-
return readCacheRoot(path7, () =>
|
|
75562
|
+
return readCacheRoot(path7, () => readdir5(path7), emptyNames);
|
|
75471
75563
|
}
|
|
75472
75564
|
async function readCacheRoot(path7, readEntries, fallback) {
|
|
75473
75565
|
try {
|
|
@@ -75482,7 +75574,7 @@ async function readCacheRoot(path7, readEntries, fallback) {
|
|
|
75482
75574
|
}
|
|
75483
75575
|
async function isBrokenCacheSymlink(path7) {
|
|
75484
75576
|
try {
|
|
75485
|
-
const entry = await
|
|
75577
|
+
const entry = await lstat5(path7);
|
|
75486
75578
|
if (!entry.isSymbolicLink())
|
|
75487
75579
|
return false;
|
|
75488
75580
|
} catch (error) {
|
|
@@ -75491,7 +75583,7 @@ async function isBrokenCacheSymlink(path7) {
|
|
|
75491
75583
|
throw error;
|
|
75492
75584
|
}
|
|
75493
75585
|
try {
|
|
75494
|
-
await
|
|
75586
|
+
await stat4(path7);
|
|
75495
75587
|
return false;
|
|
75496
75588
|
} catch (error) {
|
|
75497
75589
|
if (isNodeErrorWithCode(error) && error.code === "ENOENT")
|
|
@@ -75500,25 +75592,47 @@ async function isBrokenCacheSymlink(path7) {
|
|
|
75500
75592
|
}
|
|
75501
75593
|
}
|
|
75502
75594
|
// packages/omo-codex/src/install/codex-cached-marketplace-manifest.ts
|
|
75503
|
-
import { mkdir as mkdir4, writeFile as writeFile4 } from "fs/promises";
|
|
75504
|
-
import { join as
|
|
75595
|
+
import { mkdir as mkdir4, rename as rename2, rm as rm6, stat as stat5, writeFile as writeFile4 } from "fs/promises";
|
|
75596
|
+
import { join as join35 } from "path";
|
|
75505
75597
|
async function writeCachedMarketplaceManifest(input) {
|
|
75506
|
-
const marketplaceDir =
|
|
75598
|
+
const marketplaceDir = join35(input.marketplaceRoot, ".agents", "plugins");
|
|
75507
75599
|
await mkdir4(marketplaceDir, { recursive: true });
|
|
75508
|
-
|
|
75509
|
-
|
|
75510
|
-
|
|
75511
|
-
|
|
75512
|
-
|
|
75513
|
-
|
|
75514
|
-
|
|
75600
|
+
for (const plugin of input.plugins) {
|
|
75601
|
+
const pluginPath = join35(input.marketplaceRoot, plugin.name, plugin.version);
|
|
75602
|
+
if (!await isDirectory2(pluginPath))
|
|
75603
|
+
throw new Error(`Cannot write cached marketplace manifest: ${pluginPath} does not exist`);
|
|
75604
|
+
}
|
|
75605
|
+
const manifestPath = join35(marketplaceDir, "marketplace.json");
|
|
75606
|
+
const tempPath = join35(marketplaceDir, `.marketplace.json.tmp-${process.pid}-${Date.now()}`);
|
|
75607
|
+
try {
|
|
75608
|
+
await writeFile4(tempPath, `${JSON.stringify({
|
|
75609
|
+
name: input.marketplaceName,
|
|
75610
|
+
plugins: input.plugins.map((plugin) => ({
|
|
75611
|
+
name: plugin.name,
|
|
75612
|
+
source: { source: "local", path: `./${plugin.name}/${plugin.version}` }
|
|
75613
|
+
}))
|
|
75614
|
+
}, null, "\t")}
|
|
75515
75615
|
`);
|
|
75616
|
+
await rename2(tempPath, manifestPath);
|
|
75617
|
+
} catch (error) {
|
|
75618
|
+
await rm6(tempPath, { force: true });
|
|
75619
|
+
throw error;
|
|
75620
|
+
}
|
|
75621
|
+
}
|
|
75622
|
+
async function isDirectory2(path7) {
|
|
75623
|
+
try {
|
|
75624
|
+
return (await stat5(path7)).isDirectory();
|
|
75625
|
+
} catch (error) {
|
|
75626
|
+
if (error instanceof Error && "code" in error && error.code === "ENOENT")
|
|
75627
|
+
return false;
|
|
75628
|
+
throw error;
|
|
75629
|
+
}
|
|
75516
75630
|
}
|
|
75517
75631
|
|
|
75518
75632
|
// packages/omo-codex/src/install/codex-package-layout.ts
|
|
75519
75633
|
import { existsSync as existsSync27 } from "fs";
|
|
75520
|
-
import { readFile as
|
|
75521
|
-
import { join as
|
|
75634
|
+
import { readFile as readFile9 } from "fs/promises";
|
|
75635
|
+
import { join as join36 } from "path";
|
|
75522
75636
|
var PACKAGED_CODEX_INSTALLER_NAMES = new Set([
|
|
75523
75637
|
"@code-yeongyu/lazycodex",
|
|
75524
75638
|
"@code-yeongyu/lazycodex-ai",
|
|
@@ -75528,20 +75642,20 @@ var PACKAGED_CODEX_INSTALLER_NAMES = new Set([
|
|
|
75528
75642
|
"oh-my-openagent"
|
|
75529
75643
|
]);
|
|
75530
75644
|
async function shouldBuildSourcePackages(repoRoot) {
|
|
75531
|
-
if (existsSync27(
|
|
75645
|
+
if (existsSync27(join36(repoRoot, "packages", "omo-opencode", "src", "index.ts")))
|
|
75532
75646
|
return true;
|
|
75533
|
-
const packageJsonPath =
|
|
75647
|
+
const packageJsonPath = join36(repoRoot, "package.json");
|
|
75534
75648
|
if (!existsSync27(packageJsonPath))
|
|
75535
75649
|
return true;
|
|
75536
|
-
const packageJson = JSON.parse(await
|
|
75650
|
+
const packageJson = JSON.parse(await readFile9(packageJsonPath, "utf8"));
|
|
75537
75651
|
if (!isPlainRecord3(packageJson) || typeof packageJson.name !== "string")
|
|
75538
75652
|
return true;
|
|
75539
75653
|
return !PACKAGED_CODEX_INSTALLER_NAMES.has(packageJson.name);
|
|
75540
75654
|
}
|
|
75541
75655
|
|
|
75542
75656
|
// packages/omo-codex/src/install/codex-config-toml.ts
|
|
75543
|
-
import { mkdir as mkdir5, readFile as
|
|
75544
|
-
import { dirname as
|
|
75657
|
+
import { mkdir as mkdir5, readFile as readFile11 } from "fs/promises";
|
|
75658
|
+
import { dirname as dirname15 } from "path";
|
|
75545
75659
|
|
|
75546
75660
|
// packages/omo-codex/src/install/toml-section-editor.ts
|
|
75547
75661
|
function findTomlSection(config, header) {
|
|
@@ -75899,13 +76013,13 @@ function tomlKeySegment(value) {
|
|
|
75899
76013
|
}
|
|
75900
76014
|
|
|
75901
76015
|
// packages/omo-codex/src/install/codex-config-atomic-write.ts
|
|
75902
|
-
import { lstat as
|
|
75903
|
-
import { basename as basename8, dirname as
|
|
76016
|
+
import { lstat as lstat6, readlink as readlink4, realpath, rename as rename3, unlink, writeFile as writeFile5 } from "fs/promises";
|
|
76017
|
+
import { basename as basename8, dirname as dirname14, isAbsolute as isAbsolute7, join as join37, resolve as resolve12 } from "path";
|
|
75904
76018
|
var RENAME_RETRY_DELAYS_MS = [10, 25, 50];
|
|
75905
76019
|
var RETRIABLE_RENAME_CODES = new Set(["EPERM", "EBUSY"]);
|
|
75906
76020
|
async function writeFileAtomic(targetPath, data) {
|
|
75907
76021
|
const writeTarget = await resolveSymlinkTarget(targetPath);
|
|
75908
|
-
const temporaryPath =
|
|
76022
|
+
const temporaryPath = join37(dirname14(writeTarget), `.tmp-${basename8(writeTarget)}-${process.pid}-${Date.now()}`);
|
|
75909
76023
|
await writeFile5(temporaryPath, data);
|
|
75910
76024
|
try {
|
|
75911
76025
|
await renameWithRetry(temporaryPath, writeTarget);
|
|
@@ -75920,7 +76034,7 @@ async function writeFileAtomic(targetPath, data) {
|
|
|
75920
76034
|
}
|
|
75921
76035
|
async function resolveSymlinkTarget(targetPath) {
|
|
75922
76036
|
try {
|
|
75923
|
-
const linkStats = await
|
|
76037
|
+
const linkStats = await lstat6(targetPath);
|
|
75924
76038
|
if (!linkStats.isSymbolicLink())
|
|
75925
76039
|
return targetPath;
|
|
75926
76040
|
} catch (error) {
|
|
@@ -75933,14 +76047,14 @@ async function resolveSymlinkTarget(targetPath) {
|
|
|
75933
76047
|
} catch (error) {
|
|
75934
76048
|
if (!(error instanceof Error))
|
|
75935
76049
|
throw error;
|
|
75936
|
-
const linkValue = await
|
|
75937
|
-
return
|
|
76050
|
+
const linkValue = await readlink4(targetPath);
|
|
76051
|
+
return isAbsolute7(linkValue) ? linkValue : resolve12(dirname14(targetPath), linkValue);
|
|
75938
76052
|
}
|
|
75939
76053
|
}
|
|
75940
76054
|
async function renameWithRetry(fromPath, toPath) {
|
|
75941
76055
|
for (let attempt = 0;; attempt += 1) {
|
|
75942
76056
|
try {
|
|
75943
|
-
await
|
|
76057
|
+
await rename3(fromPath, toPath);
|
|
75944
76058
|
return;
|
|
75945
76059
|
} catch (error) {
|
|
75946
76060
|
if (!isRetriableRenameError(error) || attempt >= RENAME_RETRY_DELAYS_MS.length) {
|
|
@@ -76275,8 +76389,8 @@ function isRootSetting(line, key) {
|
|
|
76275
76389
|
}
|
|
76276
76390
|
|
|
76277
76391
|
// packages/omo-codex/src/install/codex-model-catalog.ts
|
|
76278
|
-
import { readFile as
|
|
76279
|
-
import { join as
|
|
76392
|
+
import { readFile as readFile10 } from "fs/promises";
|
|
76393
|
+
import { join as join38 } from "path";
|
|
76280
76394
|
var FALLBACK_CODEX_MODEL_CATALOG = {
|
|
76281
76395
|
current: {
|
|
76282
76396
|
model: "gpt-5.5",
|
|
@@ -76295,9 +76409,9 @@ var FALLBACK_CODEX_MODEL_CATALOG = {
|
|
|
76295
76409
|
]
|
|
76296
76410
|
};
|
|
76297
76411
|
async function readCodexModelCatalog(codexPackageRoot) {
|
|
76298
|
-
const catalogPath =
|
|
76412
|
+
const catalogPath = join38(codexPackageRoot, "plugin", "model-catalog.json");
|
|
76299
76413
|
try {
|
|
76300
|
-
const parsed = JSON.parse(await
|
|
76414
|
+
const parsed = JSON.parse(await readFile10(catalogPath, "utf8"));
|
|
76301
76415
|
return parseCodexModelCatalog(parsed) ?? FALLBACK_CODEX_MODEL_CATALOG;
|
|
76302
76416
|
} catch (error) {
|
|
76303
76417
|
if (error instanceof Error)
|
|
@@ -76431,10 +76545,10 @@ function readBooleanSetting(sectionText, key) {
|
|
|
76431
76545
|
|
|
76432
76546
|
// packages/omo-codex/src/install/codex-config-toml.ts
|
|
76433
76547
|
async function updateCodexConfig(input) {
|
|
76434
|
-
await mkdir5(
|
|
76548
|
+
await mkdir5(dirname15(input.configPath), { recursive: true });
|
|
76435
76549
|
let config = "";
|
|
76436
76550
|
if (await exists(input.configPath))
|
|
76437
|
-
config = await
|
|
76551
|
+
config = await readFile11(input.configPath, "utf8");
|
|
76438
76552
|
const pluginSet = new Set(input.pluginNames);
|
|
76439
76553
|
for (const legacyMarketplaceName of legacyMarketplaceNames(input.marketplaceName)) {
|
|
76440
76554
|
config = removeMarketplaceBlock(config, legacyMarketplaceName);
|
|
@@ -76470,7 +76584,7 @@ async function updateCodexConfig(input) {
|
|
|
76470
76584
|
}
|
|
76471
76585
|
async function exists(path7) {
|
|
76472
76586
|
try {
|
|
76473
|
-
await
|
|
76587
|
+
await readFile11(path7, "utf8");
|
|
76474
76588
|
return true;
|
|
76475
76589
|
} catch (error) {
|
|
76476
76590
|
if (error instanceof Error)
|
|
@@ -76481,8 +76595,8 @@ async function exists(path7) {
|
|
|
76481
76595
|
|
|
76482
76596
|
// packages/omo-codex/src/install/codex-hook-trust.ts
|
|
76483
76597
|
import { createHash as createHash2 } from "crypto";
|
|
76484
|
-
import { readFile as
|
|
76485
|
-
import { join as
|
|
76598
|
+
import { readFile as readFile12 } from "fs/promises";
|
|
76599
|
+
import { join as join39 } from "path";
|
|
76486
76600
|
var EVENT_LABELS = new Map([
|
|
76487
76601
|
["PreToolUse", "pre_tool_use"],
|
|
76488
76602
|
["PermissionRequest", "permission_request"],
|
|
@@ -76496,18 +76610,18 @@ var EVENT_LABELS = new Map([
|
|
|
76496
76610
|
["Stop", "stop"]
|
|
76497
76611
|
]);
|
|
76498
76612
|
async function trustedHookStatesForPlugin(input) {
|
|
76499
|
-
const manifestPath =
|
|
76613
|
+
const manifestPath = join39(input.pluginRoot, ".codex-plugin", "plugin.json");
|
|
76500
76614
|
if (!await exists2(manifestPath))
|
|
76501
76615
|
return [];
|
|
76502
|
-
const manifest = JSON.parse(await
|
|
76616
|
+
const manifest = JSON.parse(await readFile12(manifestPath, "utf8"));
|
|
76503
76617
|
if (!isPlainRecord3(manifest))
|
|
76504
76618
|
return [];
|
|
76505
76619
|
const states = [];
|
|
76506
76620
|
for (const hookPath of hookManifestPaths2(manifest.hooks)) {
|
|
76507
|
-
const hooksPath =
|
|
76621
|
+
const hooksPath = join39(input.pluginRoot, hookPath);
|
|
76508
76622
|
if (!await exists2(hooksPath))
|
|
76509
76623
|
continue;
|
|
76510
|
-
const parsed = JSON.parse(await
|
|
76624
|
+
const parsed = JSON.parse(await readFile12(hooksPath, "utf8"));
|
|
76511
76625
|
if (!isPlainRecord3(parsed) || !isPlainRecord3(parsed.hooks))
|
|
76512
76626
|
continue;
|
|
76513
76627
|
states.push(...trustedHookStatesForHooksFile({
|
|
@@ -76590,7 +76704,7 @@ function stripDotSlash2(value) {
|
|
|
76590
76704
|
}
|
|
76591
76705
|
async function exists2(path7) {
|
|
76592
76706
|
try {
|
|
76593
|
-
await
|
|
76707
|
+
await readFile12(path7, "utf8");
|
|
76594
76708
|
return true;
|
|
76595
76709
|
} catch (error) {
|
|
76596
76710
|
if (error instanceof Error)
|
|
@@ -76605,8 +76719,8 @@ var resolveGitBashForCurrentProcess2 = (input = {}) => {
|
|
|
76605
76719
|
return toCodexResolution(resolveGitBashForCurrentProcess(input));
|
|
76606
76720
|
};
|
|
76607
76721
|
async function prepareGitBashForInstall(input) {
|
|
76608
|
-
const
|
|
76609
|
-
const initialResolution =
|
|
76722
|
+
const resolve13 = input.resolveGitBash ?? (() => resolveGitBashForCurrentProcess2({ platform: input.platform, env: input.env }));
|
|
76723
|
+
const initialResolution = resolve13();
|
|
76610
76724
|
return initialResolution;
|
|
76611
76725
|
}
|
|
76612
76726
|
function toCodexResolution(resolution) {
|
|
@@ -76630,12 +76744,12 @@ function toCodexResolution(resolution) {
|
|
|
76630
76744
|
}
|
|
76631
76745
|
|
|
76632
76746
|
// packages/omo-codex/src/install/link-cached-plugin-agents.ts
|
|
76633
|
-
import { copyFile, lstat as
|
|
76634
|
-
import { basename as basename9, join as
|
|
76747
|
+
import { copyFile, lstat as lstat8, mkdir as mkdir6, readFile as readFile14, readdir as readdir6, rm as rm8, writeFile as writeFile6 } from "fs/promises";
|
|
76748
|
+
import { basename as basename9, join as join41 } from "path";
|
|
76635
76749
|
|
|
76636
76750
|
// packages/omo-codex/src/install/retired-managed-agent-purge.ts
|
|
76637
|
-
import { lstat as
|
|
76638
|
-
import { join as
|
|
76751
|
+
import { lstat as lstat7, readFile as readFile13, rm as rm7 } from "fs/promises";
|
|
76752
|
+
import { join as join40 } from "path";
|
|
76639
76753
|
var RETIRED_MANAGED_AGENT_FILES = [
|
|
76640
76754
|
{
|
|
76641
76755
|
fileName: "codex-ultrawork-reviewer.toml",
|
|
@@ -76647,20 +76761,20 @@ var RETIRED_MANAGED_AGENT_FILES = [
|
|
|
76647
76761
|
}
|
|
76648
76762
|
];
|
|
76649
76763
|
async function purgeRetiredManagedAgentFiles(input) {
|
|
76650
|
-
const agentsDir =
|
|
76764
|
+
const agentsDir = join40(input.codexHome, "agents");
|
|
76651
76765
|
if (!await exists3(agentsDir))
|
|
76652
76766
|
return;
|
|
76653
76767
|
for (const retiredAgent of RETIRED_MANAGED_AGENT_FILES) {
|
|
76654
|
-
const agentPath =
|
|
76768
|
+
const agentPath = join40(agentsDir, retiredAgent.fileName);
|
|
76655
76769
|
if (!await exists3(agentPath))
|
|
76656
76770
|
continue;
|
|
76657
|
-
const agentStat = await
|
|
76771
|
+
const agentStat = await lstat7(agentPath);
|
|
76658
76772
|
if (agentStat.isDirectory() && !agentStat.isSymbolicLink())
|
|
76659
76773
|
continue;
|
|
76660
76774
|
const content = await readTextIfExists(agentPath);
|
|
76661
76775
|
if (content === null || !hasRequiredMarkers(content, retiredAgent.requiredMarkers))
|
|
76662
76776
|
continue;
|
|
76663
|
-
await
|
|
76777
|
+
await rm7(agentPath, { force: true });
|
|
76664
76778
|
}
|
|
76665
76779
|
}
|
|
76666
76780
|
function hasRequiredMarkers(content, markers) {
|
|
@@ -76668,7 +76782,7 @@ function hasRequiredMarkers(content, markers) {
|
|
|
76668
76782
|
}
|
|
76669
76783
|
async function readTextIfExists(path7) {
|
|
76670
76784
|
try {
|
|
76671
|
-
return await
|
|
76785
|
+
return await readFile13(path7, "utf8");
|
|
76672
76786
|
} catch (error) {
|
|
76673
76787
|
if (nodeErrorCode(error) === "ENOENT")
|
|
76674
76788
|
return null;
|
|
@@ -76677,7 +76791,7 @@ async function readTextIfExists(path7) {
|
|
|
76677
76791
|
}
|
|
76678
76792
|
async function exists3(path7) {
|
|
76679
76793
|
try {
|
|
76680
|
-
await
|
|
76794
|
+
await lstat7(path7);
|
|
76681
76795
|
return true;
|
|
76682
76796
|
} catch (error) {
|
|
76683
76797
|
if (nodeErrorCode(error) !== "ENOENT")
|
|
@@ -76694,15 +76808,15 @@ function nodeErrorCode(error) {
|
|
|
76694
76808
|
// packages/omo-codex/src/install/link-cached-plugin-agents.ts
|
|
76695
76809
|
var MANIFEST_FILE = ".installed-agents.json";
|
|
76696
76810
|
async function capturePreservedAgentReasoning(input) {
|
|
76697
|
-
const agentsDir =
|
|
76811
|
+
const agentsDir = join41(input.codexHome, "agents");
|
|
76698
76812
|
if (!await exists4(agentsDir))
|
|
76699
76813
|
return new Map;
|
|
76700
76814
|
const preserved = new Map;
|
|
76701
|
-
const agentEntries = await
|
|
76815
|
+
const agentEntries = await readdir6(agentsDir, { withFileTypes: true });
|
|
76702
76816
|
for (const entry of agentEntries) {
|
|
76703
76817
|
if (!entry.name.endsWith(".toml"))
|
|
76704
76818
|
continue;
|
|
76705
|
-
const content = await readTextIfExists2(
|
|
76819
|
+
const content = await readTextIfExists2(join41(agentsDir, entry.name));
|
|
76706
76820
|
if (content === null)
|
|
76707
76821
|
continue;
|
|
76708
76822
|
const effort = extractReasoningEffort(content);
|
|
@@ -76712,15 +76826,15 @@ async function capturePreservedAgentReasoning(input) {
|
|
|
76712
76826
|
return preserved;
|
|
76713
76827
|
}
|
|
76714
76828
|
async function capturePreservedAgentServiceTier(input) {
|
|
76715
|
-
const agentsDir =
|
|
76829
|
+
const agentsDir = join41(input.codexHome, "agents");
|
|
76716
76830
|
if (!await exists4(agentsDir))
|
|
76717
76831
|
return new Map;
|
|
76718
76832
|
const preserved = new Map;
|
|
76719
|
-
const agentEntries = await
|
|
76833
|
+
const agentEntries = await readdir6(agentsDir, { withFileTypes: true });
|
|
76720
76834
|
for (const entry of agentEntries) {
|
|
76721
76835
|
if (!entry.name.endsWith(".toml"))
|
|
76722
76836
|
continue;
|
|
76723
|
-
const content = await readTextIfExists2(
|
|
76837
|
+
const content = await readTextIfExists2(join41(agentsDir, entry.name));
|
|
76724
76838
|
if (content === null)
|
|
76725
76839
|
continue;
|
|
76726
76840
|
preserved.set(agentNameFromToml(entry.name), extractServiceTier(content));
|
|
@@ -76734,13 +76848,13 @@ async function linkCachedPluginAgents(input) {
|
|
|
76734
76848
|
await writeManifest(input.pluginRoot, []);
|
|
76735
76849
|
return [];
|
|
76736
76850
|
}
|
|
76737
|
-
const agentsDir =
|
|
76851
|
+
const agentsDir = join41(input.codexHome, "agents");
|
|
76738
76852
|
await mkdir6(agentsDir, { recursive: true });
|
|
76739
76853
|
const linked = [];
|
|
76740
76854
|
for (const agentPath of bundledAgents) {
|
|
76741
76855
|
const agentFileName = basename9(agentPath);
|
|
76742
76856
|
const agentName = agentNameFromToml(agentFileName);
|
|
76743
|
-
const linkPath =
|
|
76857
|
+
const linkPath = join41(agentsDir, agentFileName);
|
|
76744
76858
|
await replaceWithCopy(linkPath, agentPath);
|
|
76745
76859
|
await restorePreservedReasoning({
|
|
76746
76860
|
agentName,
|
|
@@ -76761,7 +76875,7 @@ async function linkCachedPluginAgents(input) {
|
|
|
76761
76875
|
async function restorePreservedServiceTier(input) {
|
|
76762
76876
|
if (!input.preserved)
|
|
76763
76877
|
return;
|
|
76764
|
-
const content = await
|
|
76878
|
+
const content = await readFile14(input.linkPath, "utf8");
|
|
76765
76879
|
if (extractServiceTier(content) === input.value)
|
|
76766
76880
|
return;
|
|
76767
76881
|
const replacement = replaceServiceTier(content, input.value);
|
|
@@ -76770,22 +76884,22 @@ async function restorePreservedServiceTier(input) {
|
|
|
76770
76884
|
await writeFile6(input.linkPath, replacement.content);
|
|
76771
76885
|
}
|
|
76772
76886
|
async function discoverBundledAgents(pluginRoot) {
|
|
76773
|
-
const componentsRoot =
|
|
76887
|
+
const componentsRoot = join41(pluginRoot, "components");
|
|
76774
76888
|
if (!await exists4(componentsRoot))
|
|
76775
76889
|
return [];
|
|
76776
|
-
const componentEntries = await
|
|
76890
|
+
const componentEntries = await readdir6(componentsRoot, { withFileTypes: true });
|
|
76777
76891
|
const agents = [];
|
|
76778
76892
|
for (const entry of componentEntries) {
|
|
76779
76893
|
if (!entry.isDirectory())
|
|
76780
76894
|
continue;
|
|
76781
|
-
const agentsRoot =
|
|
76895
|
+
const agentsRoot = join41(componentsRoot, entry.name, "agents");
|
|
76782
76896
|
if (!await exists4(agentsRoot))
|
|
76783
76897
|
continue;
|
|
76784
|
-
const agentEntries = await
|
|
76898
|
+
const agentEntries = await readdir6(agentsRoot, { withFileTypes: true });
|
|
76785
76899
|
for (const file2 of agentEntries) {
|
|
76786
76900
|
if (!file2.isFile() || !file2.name.endsWith(".toml"))
|
|
76787
76901
|
continue;
|
|
76788
|
-
agents.push(
|
|
76902
|
+
agents.push(join41(agentsRoot, file2.name));
|
|
76789
76903
|
}
|
|
76790
76904
|
}
|
|
76791
76905
|
agents.sort();
|
|
@@ -76798,14 +76912,14 @@ async function replaceWithCopy(linkPath, target) {
|
|
|
76798
76912
|
async function prepareReplacement(linkPath) {
|
|
76799
76913
|
if (!await exists4(linkPath))
|
|
76800
76914
|
return;
|
|
76801
|
-
const entryStat = await
|
|
76915
|
+
const entryStat = await lstat8(linkPath);
|
|
76802
76916
|
if (entryStat.isDirectory() && !entryStat.isSymbolicLink()) {
|
|
76803
76917
|
throw new Error(`${linkPath} already exists and is a directory; refusing to replace`);
|
|
76804
76918
|
}
|
|
76805
|
-
await
|
|
76919
|
+
await rm8(linkPath, { force: true });
|
|
76806
76920
|
}
|
|
76807
76921
|
async function writeManifest(pluginRoot, agentPaths) {
|
|
76808
|
-
const manifestPath =
|
|
76922
|
+
const manifestPath = join41(pluginRoot, MANIFEST_FILE);
|
|
76809
76923
|
const payload = { agents: [...agentPaths].sort() };
|
|
76810
76924
|
await writeFile6(manifestPath, `${JSON.stringify(payload, null, "\t")}
|
|
76811
76925
|
`);
|
|
@@ -76813,7 +76927,7 @@ async function writeManifest(pluginRoot, agentPaths) {
|
|
|
76813
76927
|
async function restorePreservedReasoning(input) {
|
|
76814
76928
|
if (input.value === undefined)
|
|
76815
76929
|
return;
|
|
76816
|
-
const content = await
|
|
76930
|
+
const content = await readFile14(input.target, "utf8");
|
|
76817
76931
|
const bundledEffort = extractReasoningEffort(content);
|
|
76818
76932
|
if (bundledEffort === input.value)
|
|
76819
76933
|
return;
|
|
@@ -76824,7 +76938,7 @@ async function restorePreservedReasoning(input) {
|
|
|
76824
76938
|
}
|
|
76825
76939
|
async function readTextIfExists2(path7) {
|
|
76826
76940
|
try {
|
|
76827
|
-
return await
|
|
76941
|
+
return await readFile14(path7, "utf8");
|
|
76828
76942
|
} catch (error) {
|
|
76829
76943
|
if (nodeErrorCode2(error) === "ENOENT")
|
|
76830
76944
|
return null;
|
|
@@ -76917,7 +77031,7 @@ function parseJsonString(value) {
|
|
|
76917
77031
|
}
|
|
76918
77032
|
async function exists4(path7) {
|
|
76919
77033
|
try {
|
|
76920
|
-
await
|
|
77034
|
+
await lstat8(path7);
|
|
76921
77035
|
return true;
|
|
76922
77036
|
} catch (error) {
|
|
76923
77037
|
if (nodeErrorCode2(error) !== "ENOENT")
|
|
@@ -76932,12 +77046,12 @@ function nodeErrorCode2(error) {
|
|
|
76932
77046
|
}
|
|
76933
77047
|
|
|
76934
77048
|
// packages/omo-codex/src/install/codex-marketplace.ts
|
|
76935
|
-
import { readFile as
|
|
76936
|
-
import { join as
|
|
77049
|
+
import { readFile as readFile15 } from "fs/promises";
|
|
77050
|
+
import { join as join42 } from "path";
|
|
76937
77051
|
var DEFAULT_MARKETPLACE_PATH = "packages/omo-codex/marketplace.json";
|
|
76938
77052
|
async function readMarketplace(repoRoot, options) {
|
|
76939
|
-
const marketplacePath = options?.marketplacePath ??
|
|
76940
|
-
const raw = await
|
|
77053
|
+
const marketplacePath = options?.marketplacePath ?? join42(repoRoot, DEFAULT_MARKETPLACE_PATH);
|
|
77054
|
+
const raw = await readFile15(marketplacePath, "utf8");
|
|
76941
77055
|
const parsed = JSON.parse(raw);
|
|
76942
77056
|
if (!isPlainRecord3(parsed))
|
|
76943
77057
|
throw new Error("marketplace.json must be an object");
|
|
@@ -76955,10 +77069,10 @@ async function readMarketplace(repoRoot, options) {
|
|
|
76955
77069
|
function resolvePluginSource(repoRoot, plugin, options) {
|
|
76956
77070
|
const sourcePath = localSourcePath(options?.pathOverride ?? plugin.source);
|
|
76957
77071
|
const relativePath = sourcePath.slice(2);
|
|
76958
|
-
return
|
|
77072
|
+
return join42(repoRoot, ...relativePath.split(/[\\/]/));
|
|
76959
77073
|
}
|
|
76960
77074
|
async function readPluginManifest(pluginRoot) {
|
|
76961
|
-
const raw = await
|
|
77075
|
+
const raw = await readFile15(join42(pluginRoot, ".codex-plugin", "plugin.json"), "utf8");
|
|
76962
77076
|
const parsed = JSON.parse(raw);
|
|
76963
77077
|
if (!isPlainRecord3(parsed))
|
|
76964
77078
|
throw new Error(`${pluginRoot} plugin.json must be an object`);
|
|
@@ -77039,8 +77153,8 @@ function validateLocalSourcePath(path7) {
|
|
|
77039
77153
|
}
|
|
77040
77154
|
|
|
77041
77155
|
// packages/omo-codex/src/install/codex-marketplace-snapshot.ts
|
|
77042
|
-
import { cp as cp3, mkdir as mkdir7, rename as
|
|
77043
|
-
import { join as
|
|
77156
|
+
import { cp as cp3, mkdir as mkdir7, rename as rename4, rm as rm9, writeFile as writeFile7 } from "fs/promises";
|
|
77157
|
+
import { join as join43, sep as sep6 } from "path";
|
|
77044
77158
|
var INSTALLED_MARKETPLACES_DIR = ".tmp/marketplaces";
|
|
77045
77159
|
async function writeInstalledMarketplaceSnapshot(input) {
|
|
77046
77160
|
const marketplaceRoot = installedMarketplaceRoot(input.codexHome, input.marketplace.name);
|
|
@@ -77053,29 +77167,29 @@ async function writeInstalledMarketplaceSnapshot(input) {
|
|
|
77053
77167
|
return snapshotPlugins;
|
|
77054
77168
|
}
|
|
77055
77169
|
function installedMarketplaceRoot(codexHome, marketplaceName) {
|
|
77056
|
-
return
|
|
77170
|
+
return join43(codexHome, INSTALLED_MARKETPLACES_DIR, marketplaceName);
|
|
77057
77171
|
}
|
|
77058
77172
|
async function writeMarketplaceManifest(marketplaceRoot, marketplace) {
|
|
77059
|
-
const manifestDir =
|
|
77173
|
+
const manifestDir = join43(marketplaceRoot, ".agents", "plugins");
|
|
77060
77174
|
await mkdir7(manifestDir, { recursive: true });
|
|
77061
|
-
const tempPath =
|
|
77175
|
+
const tempPath = join43(manifestDir, `.marketplace-${process.pid}-${Date.now()}.json.tmp`);
|
|
77062
77176
|
await writeFile7(tempPath, `${JSON.stringify(marketplace, null, "\t")}
|
|
77063
77177
|
`);
|
|
77064
|
-
await
|
|
77178
|
+
await rename4(tempPath, join43(manifestDir, "marketplace.json"));
|
|
77065
77179
|
}
|
|
77066
77180
|
async function writeSnapshotPlugin(marketplaceRoot, plugin) {
|
|
77067
|
-
const pluginsDir =
|
|
77181
|
+
const pluginsDir = join43(marketplaceRoot, "plugins");
|
|
77068
77182
|
await mkdir7(pluginsDir, { recursive: true });
|
|
77069
|
-
const targetPath =
|
|
77070
|
-
const tempPath =
|
|
77071
|
-
await
|
|
77183
|
+
const targetPath = join43(pluginsDir, plugin.name);
|
|
77184
|
+
const tempPath = join43(pluginsDir, `.tmp-${plugin.name}-${process.pid}-${Date.now()}`);
|
|
77185
|
+
await rm9(tempPath, { recursive: true, force: true });
|
|
77072
77186
|
await cp3(plugin.sourcePath, tempPath, {
|
|
77073
77187
|
recursive: true,
|
|
77074
77188
|
filter: (source) => shouldCopyMarketplaceSourcePath(source, plugin.sourcePath)
|
|
77075
77189
|
});
|
|
77076
77190
|
await copyBundledMcpRuntimeDists({ pluginRoot: tempPath, sourceRoot: plugin.sourcePath });
|
|
77077
|
-
await
|
|
77078
|
-
await
|
|
77191
|
+
await rm9(targetPath, { recursive: true, force: true });
|
|
77192
|
+
await rename4(tempPath, targetPath);
|
|
77079
77193
|
await rewriteCachedMcpManifest(targetPath, plugin.sourcePath);
|
|
77080
77194
|
return { name: plugin.name, path: targetPath };
|
|
77081
77195
|
}
|
|
@@ -77088,11 +77202,11 @@ function shouldCopyMarketplaceSourcePath(path7, root) {
|
|
|
77088
77202
|
}
|
|
77089
77203
|
|
|
77090
77204
|
// packages/omo-codex/src/install/lazycodex-version-stamp.ts
|
|
77091
|
-
import { readdir as
|
|
77092
|
-
import { join as
|
|
77205
|
+
import { readdir as readdir7, readFile as readFile16, writeFile as writeFile8 } from "fs/promises";
|
|
77206
|
+
import { join as join44 } from "path";
|
|
77093
77207
|
async function readDistributionManifest(repoRoot) {
|
|
77094
77208
|
try {
|
|
77095
|
-
const parsed = JSON.parse(await
|
|
77209
|
+
const parsed = JSON.parse(await readFile16(join44(repoRoot, "package.json"), "utf8"));
|
|
77096
77210
|
if (!isPlainRecord3(parsed) || typeof parsed.version !== "string" || parsed.version.trim().length === 0)
|
|
77097
77211
|
return;
|
|
77098
77212
|
return {
|
|
@@ -77112,19 +77226,19 @@ function resolveLazyCodexPluginVersion(input) {
|
|
|
77112
77226
|
return input.manifestVersion ?? "local";
|
|
77113
77227
|
}
|
|
77114
77228
|
async function stampLazyCodexPluginVersion(input) {
|
|
77115
|
-
const manifestPath =
|
|
77229
|
+
const manifestPath = join44(input.pluginRoot, ".codex-plugin", "plugin.json");
|
|
77116
77230
|
const hookPaths = await readPluginHookPaths(manifestPath);
|
|
77117
77231
|
await stampJsonVersion(manifestPath, input.version);
|
|
77118
|
-
await stampJsonVersion(
|
|
77232
|
+
await stampJsonVersion(join44(input.pluginRoot, "package.json"), input.version);
|
|
77119
77233
|
for (const hookPath of hookPaths) {
|
|
77120
|
-
await stampHookStatusMessages(
|
|
77234
|
+
await stampHookStatusMessages(join44(input.pluginRoot, hookPath), input.version);
|
|
77121
77235
|
}
|
|
77122
77236
|
await stampComponentVersions(input);
|
|
77123
77237
|
}
|
|
77124
77238
|
async function writeLazyCodexInstallSnapshot(input) {
|
|
77125
77239
|
if (input.distributionManifest === undefined)
|
|
77126
77240
|
return;
|
|
77127
|
-
await writeFile8(
|
|
77241
|
+
await writeFile8(join44(input.pluginRoot, "lazycodex-install.json"), `${JSON.stringify({
|
|
77128
77242
|
packageName: input.distributionManifest.name,
|
|
77129
77243
|
version: input.distributionManifest.version
|
|
77130
77244
|
}, null, "\t")}
|
|
@@ -77132,7 +77246,7 @@ async function writeLazyCodexInstallSnapshot(input) {
|
|
|
77132
77246
|
}
|
|
77133
77247
|
async function stampJsonVersion(path7, version) {
|
|
77134
77248
|
try {
|
|
77135
|
-
const parsed = JSON.parse(await
|
|
77249
|
+
const parsed = JSON.parse(await readFile16(path7, "utf8"));
|
|
77136
77250
|
if (!isPlainRecord3(parsed))
|
|
77137
77251
|
return;
|
|
77138
77252
|
parsed.version = version;
|
|
@@ -77146,7 +77260,7 @@ async function stampJsonVersion(path7, version) {
|
|
|
77146
77260
|
}
|
|
77147
77261
|
async function readPluginHookPaths(manifestPath) {
|
|
77148
77262
|
try {
|
|
77149
|
-
const parsed = JSON.parse(await
|
|
77263
|
+
const parsed = JSON.parse(await readFile16(manifestPath, "utf8"));
|
|
77150
77264
|
if (!isPlainRecord3(parsed))
|
|
77151
77265
|
return [];
|
|
77152
77266
|
if (typeof parsed.hooks === "string" && parsed.hooks.trim().length > 0)
|
|
@@ -77166,7 +77280,7 @@ function stripDotSlash3(path7) {
|
|
|
77166
77280
|
}
|
|
77167
77281
|
async function stampHookStatusMessages(path7, version) {
|
|
77168
77282
|
try {
|
|
77169
|
-
const parsed = JSON.parse(await
|
|
77283
|
+
const parsed = JSON.parse(await readFile16(path7, "utf8"));
|
|
77170
77284
|
if (!isPlainRecord3(parsed))
|
|
77171
77285
|
return;
|
|
77172
77286
|
stampHookGroups(parsed.hooks, version);
|
|
@@ -77181,16 +77295,16 @@ async function stampHookStatusMessages(path7, version) {
|
|
|
77181
77295
|
async function stampComponentVersions(input) {
|
|
77182
77296
|
let entries;
|
|
77183
77297
|
try {
|
|
77184
|
-
entries = await
|
|
77298
|
+
entries = await readdir7(join44(input.pluginRoot, "components"));
|
|
77185
77299
|
} catch (error) {
|
|
77186
77300
|
if (error instanceof Error)
|
|
77187
77301
|
return;
|
|
77188
77302
|
throw error;
|
|
77189
77303
|
}
|
|
77190
77304
|
for (const entry of entries) {
|
|
77191
|
-
const componentRoot =
|
|
77192
|
-
await stampJsonVersion(
|
|
77193
|
-
await stampHookStatusMessages(
|
|
77305
|
+
const componentRoot = join44(input.pluginRoot, "components", entry);
|
|
77306
|
+
await stampJsonVersion(join44(componentRoot, "package.json"), input.version);
|
|
77307
|
+
await stampHookStatusMessages(join44(componentRoot, "hooks", "hooks.json"), input.version);
|
|
77194
77308
|
}
|
|
77195
77309
|
}
|
|
77196
77310
|
function stampHookGroups(hooks, version) {
|
|
@@ -77243,8 +77357,8 @@ var defaultRunCommand = async (command, args, options) => {
|
|
|
77243
77357
|
};
|
|
77244
77358
|
|
|
77245
77359
|
// packages/omo-codex/src/install/codex-project-local-cleanup.ts
|
|
77246
|
-
import { copyFile as copyFile2, lstat as
|
|
77247
|
-
import { dirname as
|
|
77360
|
+
import { copyFile as copyFile2, lstat as lstat9, readFile as readFile17, writeFile as writeFile9 } from "fs/promises";
|
|
77361
|
+
import { dirname as dirname16, join as join45, resolve as resolve13 } from "path";
|
|
77248
77362
|
var LEGACY_AGENT_CONFLICT_KEYS = ["max_threads"];
|
|
77249
77363
|
var PROJECT_LOCAL_ARTIFACT_PATHS = [
|
|
77250
77364
|
".codex/hooks.json",
|
|
@@ -77263,7 +77377,7 @@ async function repairNearestProjectLocalCodexArtifacts(input) {
|
|
|
77263
77377
|
const artifacts = await collectProjectLocalArtifacts(project.artifactRoots);
|
|
77264
77378
|
const configs = [];
|
|
77265
77379
|
for (const configPath of project.configPaths) {
|
|
77266
|
-
const original = await
|
|
77380
|
+
const original = await readFile17(configPath, "utf8");
|
|
77267
77381
|
const repair = repairProjectLocalCodexConfigText(original);
|
|
77268
77382
|
if (!repair.changed) {
|
|
77269
77383
|
configs.push({
|
|
@@ -77347,37 +77461,37 @@ async function findProjectLocalCodexConfigs(startDirectory, codexHome) {
|
|
|
77347
77461
|
if (startDirectoryStat !== null && !startDirectoryStat.isDirectory()) {
|
|
77348
77462
|
throw new ProjectLocalCleanupStartDirectoryError(startDirectory);
|
|
77349
77463
|
}
|
|
77350
|
-
const codexHomeConfigPath = codexHome === undefined ? null :
|
|
77351
|
-
let current =
|
|
77464
|
+
const codexHomeConfigPath = codexHome === undefined ? null : join45(resolve13(codexHome), "config.toml");
|
|
77465
|
+
let current = resolve13(startDirectory);
|
|
77352
77466
|
const configPathsFromCwd = [];
|
|
77353
77467
|
while (true) {
|
|
77354
|
-
const configPath =
|
|
77468
|
+
const configPath = join45(current, ".codex", "config.toml");
|
|
77355
77469
|
if (await isRegularProjectLocalConfig(current, configPath)) {
|
|
77356
|
-
if (codexHomeConfigPath === null ||
|
|
77470
|
+
if (codexHomeConfigPath === null || resolve13(configPath) !== codexHomeConfigPath) {
|
|
77357
77471
|
configPathsFromCwd.push(configPath);
|
|
77358
77472
|
}
|
|
77359
77473
|
}
|
|
77360
|
-
if (await exists5(
|
|
77474
|
+
if (await exists5(join45(current, ".git"))) {
|
|
77361
77475
|
return configPathsFromCwd.length === 0 ? null : {
|
|
77362
77476
|
projectRoot: current,
|
|
77363
77477
|
configPaths: [...configPathsFromCwd].reverse(),
|
|
77364
77478
|
artifactRoots: artifactRootsForConfigPaths(configPathsFromCwd)
|
|
77365
77479
|
};
|
|
77366
77480
|
}
|
|
77367
|
-
const parent =
|
|
77481
|
+
const parent = dirname16(current);
|
|
77368
77482
|
if (parent === current) {
|
|
77369
77483
|
const nearestConfigPath = configPathsFromCwd[0];
|
|
77370
77484
|
return nearestConfigPath === undefined ? null : {
|
|
77371
|
-
projectRoot:
|
|
77485
|
+
projectRoot: dirname16(dirname16(nearestConfigPath)),
|
|
77372
77486
|
configPaths: [nearestConfigPath],
|
|
77373
|
-
artifactRoots: [
|
|
77487
|
+
artifactRoots: [dirname16(dirname16(nearestConfigPath))]
|
|
77374
77488
|
};
|
|
77375
77489
|
}
|
|
77376
77490
|
current = parent;
|
|
77377
77491
|
}
|
|
77378
77492
|
}
|
|
77379
77493
|
async function isRegularProjectLocalConfig(directory, configPath) {
|
|
77380
|
-
const codexDirStat = await maybeLstat(
|
|
77494
|
+
const codexDirStat = await maybeLstat(join45(directory, ".codex"));
|
|
77381
77495
|
if (codexDirStat === null || !codexDirStat.isDirectory() || codexDirStat.isSymbolicLink())
|
|
77382
77496
|
return false;
|
|
77383
77497
|
const configStat = await maybeLstat(configPath);
|
|
@@ -77386,7 +77500,7 @@ async function isRegularProjectLocalConfig(directory, configPath) {
|
|
|
77386
77500
|
function artifactRootsForConfigPaths(configPaths) {
|
|
77387
77501
|
const roots = [];
|
|
77388
77502
|
for (const configPath of configPaths) {
|
|
77389
|
-
const root =
|
|
77503
|
+
const root = dirname16(dirname16(configPath));
|
|
77390
77504
|
if (!roots.includes(root))
|
|
77391
77505
|
roots.push(root);
|
|
77392
77506
|
}
|
|
@@ -77397,7 +77511,7 @@ async function collectProjectLocalArtifacts(projectRoots) {
|
|
|
77397
77511
|
const seenPaths = new Set;
|
|
77398
77512
|
for (const projectRoot of projectRoots) {
|
|
77399
77513
|
for (const relativePath of PROJECT_LOCAL_ARTIFACT_PATHS) {
|
|
77400
|
-
const artifactPath =
|
|
77514
|
+
const artifactPath = join45(projectRoot, relativePath);
|
|
77401
77515
|
if (seenPaths.has(artifactPath))
|
|
77402
77516
|
continue;
|
|
77403
77517
|
const entryStat = await maybeLstat(artifactPath);
|
|
@@ -77431,7 +77545,7 @@ function formatBackupTimestamp(date) {
|
|
|
77431
77545
|
}
|
|
77432
77546
|
async function maybeLstat(path7) {
|
|
77433
77547
|
try {
|
|
77434
|
-
return await
|
|
77548
|
+
return await lstat9(path7);
|
|
77435
77549
|
} catch (error) {
|
|
77436
77550
|
if (nodeErrorCode3(error) === "ENOENT")
|
|
77437
77551
|
return null;
|
|
@@ -77472,34 +77586,34 @@ function formatUnknownError(error) {
|
|
|
77472
77586
|
}
|
|
77473
77587
|
|
|
77474
77588
|
// packages/omo-codex/src/install/lsp-daemon-reaper.ts
|
|
77475
|
-
import { readFile as
|
|
77589
|
+
import { readFile as readFile18, readdir as readdir8, rm as rm10 } from "fs/promises";
|
|
77476
77590
|
import { connect } from "net";
|
|
77477
|
-
import { join as
|
|
77591
|
+
import { join as join46 } from "path";
|
|
77478
77592
|
async function reapLspDaemons(codexHome, deps = {}) {
|
|
77479
77593
|
const killProcess = deps.killProcess ?? sendSigterm;
|
|
77480
77594
|
const isDaemonLive = deps.isDaemonLive ?? probeSocketLive;
|
|
77481
|
-
const daemonRoot =
|
|
77595
|
+
const daemonRoot = join46(codexHome, "codex-lsp", "daemon");
|
|
77482
77596
|
const reaped = [];
|
|
77483
77597
|
let entries;
|
|
77484
77598
|
try {
|
|
77485
|
-
entries = await
|
|
77599
|
+
entries = await readdir8(daemonRoot);
|
|
77486
77600
|
} catch {
|
|
77487
77601
|
return reaped;
|
|
77488
77602
|
}
|
|
77489
77603
|
for (const entry of entries) {
|
|
77490
|
-
const versionDir =
|
|
77491
|
-
const pid = await readPidFile(
|
|
77492
|
-
const socketPath = await readEndpointFile(
|
|
77604
|
+
const versionDir = join46(daemonRoot, entry);
|
|
77605
|
+
const pid = await readPidFile(join46(versionDir, "daemon.pid"));
|
|
77606
|
+
const socketPath = await readEndpointFile(join46(versionDir, "daemon.endpoint"));
|
|
77493
77607
|
if (pid !== null && socketPath !== null && await isDaemonLive(socketPath) && killProcess(pid)) {
|
|
77494
77608
|
reaped.push(pid);
|
|
77495
77609
|
}
|
|
77496
|
-
await
|
|
77610
|
+
await rm10(versionDir, { recursive: true, force: true });
|
|
77497
77611
|
}
|
|
77498
77612
|
return reaped;
|
|
77499
77613
|
}
|
|
77500
77614
|
async function readEndpointFile(path7) {
|
|
77501
77615
|
try {
|
|
77502
|
-
const content = (await
|
|
77616
|
+
const content = (await readFile18(path7, "utf8")).trim();
|
|
77503
77617
|
return content.length > 0 ? content : null;
|
|
77504
77618
|
} catch {
|
|
77505
77619
|
return null;
|
|
@@ -77507,18 +77621,18 @@ async function readEndpointFile(path7) {
|
|
|
77507
77621
|
}
|
|
77508
77622
|
async function readPidFile(path7) {
|
|
77509
77623
|
try {
|
|
77510
|
-
const pid = Number.parseInt((await
|
|
77624
|
+
const pid = Number.parseInt((await readFile18(path7, "utf8")).trim(), 10);
|
|
77511
77625
|
return Number.isInteger(pid) && pid > 0 ? pid : null;
|
|
77512
77626
|
} catch {
|
|
77513
77627
|
return null;
|
|
77514
77628
|
}
|
|
77515
77629
|
}
|
|
77516
77630
|
function probeSocketLive(socketPath, timeoutMs = 500) {
|
|
77517
|
-
return new Promise((
|
|
77631
|
+
return new Promise((resolve14) => {
|
|
77518
77632
|
const socket = connect(socketPath);
|
|
77519
77633
|
const done = (ok) => {
|
|
77520
77634
|
socket.destroy();
|
|
77521
|
-
|
|
77635
|
+
resolve14(ok);
|
|
77522
77636
|
};
|
|
77523
77637
|
const timer = setTimeout(() => done(false), timeoutMs);
|
|
77524
77638
|
timer.unref();
|
|
@@ -77543,24 +77657,24 @@ function sendSigterm(pid) {
|
|
|
77543
77657
|
|
|
77544
77658
|
// packages/omo-codex/src/install/codex-installer-bin-dir.ts
|
|
77545
77659
|
import { homedir as homedir5 } from "os";
|
|
77546
|
-
import { join as
|
|
77660
|
+
import { join as join47, resolve as resolve14 } from "path";
|
|
77547
77661
|
function resolveCodexInstallerBinDir(input) {
|
|
77548
77662
|
const explicitBinDir = input.binDir ?? input.env?.CODEX_LOCAL_BIN_DIR;
|
|
77549
77663
|
if (explicitBinDir !== undefined && explicitBinDir.trim().length > 0)
|
|
77550
|
-
return
|
|
77664
|
+
return resolve14(explicitBinDir.trim());
|
|
77551
77665
|
const homeDir = input.homeDir ?? homedir5();
|
|
77552
|
-
const defaultCodexHome =
|
|
77553
|
-
const resolvedCodexHome =
|
|
77666
|
+
const defaultCodexHome = resolve14(homeDir, ".codex");
|
|
77667
|
+
const resolvedCodexHome = resolve14(input.codexHome);
|
|
77554
77668
|
if (resolvedCodexHome !== defaultCodexHome)
|
|
77555
|
-
return
|
|
77556
|
-
return
|
|
77669
|
+
return join47(resolvedCodexHome, "bin");
|
|
77670
|
+
return resolve14(homeDir, ".local", "bin");
|
|
77557
77671
|
}
|
|
77558
77672
|
|
|
77559
77673
|
// packages/omo-codex/src/install/omo-sot-migration.ts
|
|
77560
|
-
import { join as
|
|
77674
|
+
import { join as join48 } from "path";
|
|
77561
77675
|
async function seedAndMigrateOmoSot(input) {
|
|
77562
77676
|
const commandEnv = { ...input.env };
|
|
77563
|
-
const scriptPath =
|
|
77677
|
+
const scriptPath = join48(input.repoRoot, "packages", "omo-codex", "plugin", "scripts", "migrate-omo-sot.mjs");
|
|
77564
77678
|
try {
|
|
77565
77679
|
await input.runCommand(process.execPath, [scriptPath, "--seed"], {
|
|
77566
77680
|
cwd: input.repoRoot,
|
|
@@ -77575,7 +77689,7 @@ async function seedAndMigrateOmoSot(input) {
|
|
|
77575
77689
|
|
|
77576
77690
|
// packages/omo-codex/src/install/install-ast-grep-sg.ts
|
|
77577
77691
|
init_src();
|
|
77578
|
-
import { join as
|
|
77692
|
+
import { join as join49 } from "path";
|
|
77579
77693
|
function describeResult(result) {
|
|
77580
77694
|
if (result.kind === "succeeded")
|
|
77581
77695
|
return null;
|
|
@@ -77589,7 +77703,7 @@ async function installAstGrepForCodex(options) {
|
|
|
77589
77703
|
return;
|
|
77590
77704
|
const platform = options.platform ?? process.platform;
|
|
77591
77705
|
const targetDir = astGrepRuntimeDir(options.codexHome, platform, options.arch ?? process.arch);
|
|
77592
|
-
const skillDir =
|
|
77706
|
+
const skillDir = join49(plugin.path, "skills", "ast-grep");
|
|
77593
77707
|
const installer = options.installer ?? runAstGrepSkillInstall;
|
|
77594
77708
|
try {
|
|
77595
77709
|
const result = await installer({ platform, skillDir, targetDir });
|
|
@@ -77622,9 +77736,9 @@ var SISYPHUS_LEGACY_CACHE_MARKETPLACES = ["lazycodex", "code-yeongyu-codex-plugi
|
|
|
77622
77736
|
async function runCodexInstaller(options = {}) {
|
|
77623
77737
|
const env3 = options.env ?? process.env;
|
|
77624
77738
|
const platform = options.platform ?? process.platform;
|
|
77625
|
-
const repoRoot =
|
|
77626
|
-
const codexHome =
|
|
77627
|
-
const projectDirectory =
|
|
77739
|
+
const repoRoot = resolve15(options.repoRoot ?? findRepoRoot({ importerDir: import.meta.dir, env: env3 }));
|
|
77740
|
+
const codexHome = resolve15(options.codexHome ?? env3.CODEX_HOME ?? join52(homedir6(), ".codex"));
|
|
77741
|
+
const projectDirectory = resolve15(options.projectDirectory ?? env3.OMO_CODEX_PROJECT ?? process.cwd());
|
|
77628
77742
|
const binDir = resolveCodexInstallerBinDir({ binDir: options.binDir, codexHome, env: env3 });
|
|
77629
77743
|
const runCommand = options.runCommand ?? defaultRunCommand;
|
|
77630
77744
|
const log4 = options.log ?? (() => {
|
|
@@ -77639,9 +77753,9 @@ async function runCodexInstaller(options = {}) {
|
|
|
77639
77753
|
if (!gitBashResolution.found) {
|
|
77640
77754
|
throw new Error(gitBashResolution.installHint);
|
|
77641
77755
|
}
|
|
77642
|
-
const codexPackageRoot =
|
|
77756
|
+
const codexPackageRoot = join52(repoRoot, "packages", "omo-codex");
|
|
77643
77757
|
const marketplace = await readMarketplace(repoRoot, {
|
|
77644
|
-
marketplacePath:
|
|
77758
|
+
marketplacePath: join52(codexPackageRoot, "marketplace.json")
|
|
77645
77759
|
});
|
|
77646
77760
|
const distributionManifest = await readDistributionManifest(repoRoot);
|
|
77647
77761
|
const installed = [];
|
|
@@ -77683,7 +77797,7 @@ async function runCodexInstaller(options = {}) {
|
|
|
77683
77797
|
if (runtimeLink !== null)
|
|
77684
77798
|
log4(`Linked ${runtimeLink.name} -> ${runtimeLink.target}`);
|
|
77685
77799
|
else
|
|
77686
|
-
log4(`Warning: skipped the omo runtime wrapper because ${
|
|
77800
|
+
log4(`Warning: skipped the omo runtime wrapper because ${join52(repoRoot, "dist", "cli", "index.js")} is missing; omo ulw-loop commands will be unavailable until a package shipping dist/cli is installed`);
|
|
77687
77801
|
}
|
|
77688
77802
|
pluginSources.push({ name: entry.name, sourcePath });
|
|
77689
77803
|
installed.push(plugin);
|
|
@@ -77737,13 +77851,13 @@ async function runCodexInstaller(options = {}) {
|
|
|
77737
77851
|
});
|
|
77738
77852
|
}
|
|
77739
77853
|
await reapLspDaemons(codexHome).catch(() => []);
|
|
77740
|
-
const marketplaceRoot =
|
|
77854
|
+
const marketplaceRoot = join52(codexHome, "plugins", "cache", marketplace.name);
|
|
77741
77855
|
await writeCachedMarketplaceManifest({
|
|
77742
77856
|
marketplaceName: marketplace.name,
|
|
77743
77857
|
marketplaceRoot,
|
|
77744
77858
|
plugins: installed
|
|
77745
77859
|
});
|
|
77746
|
-
const configPath =
|
|
77860
|
+
const configPath = join52(codexHome, "config.toml");
|
|
77747
77861
|
await updateCodexConfig({
|
|
77748
77862
|
configPath,
|
|
77749
77863
|
repoRoot: codexPackageRoot,
|
|
@@ -77803,25 +77917,25 @@ function findRepoRootFromImporter(importerDir) {
|
|
|
77803
77917
|
for (let depth = 0;depth <= 7; depth += 1) {
|
|
77804
77918
|
if (isRepoRootWithCodexPlugin(current))
|
|
77805
77919
|
return current;
|
|
77806
|
-
for (const wrapperPackageRoot of [
|
|
77920
|
+
for (const wrapperPackageRoot of [join52(current, "node_modules", "oh-my-openagent"), join52(current, "oh-my-openagent")]) {
|
|
77807
77921
|
if (isRepoRootWithCodexPlugin(wrapperPackageRoot))
|
|
77808
77922
|
return wrapperPackageRoot;
|
|
77809
77923
|
}
|
|
77810
|
-
current =
|
|
77924
|
+
current = resolve15(current, "..");
|
|
77811
77925
|
}
|
|
77812
77926
|
throw new Error("Unable to locate vendored Codex plugin: expected packages/omo-codex/plugin/.codex-plugin/plugin.json in this package or sibling oh-my-openagent package within 7 parent levels");
|
|
77813
77927
|
}
|
|
77814
77928
|
function findRepoRoot(input) {
|
|
77815
77929
|
const wrapperPackageRoot = input.env?.OMO_WRAPPER_PACKAGE_ROOT;
|
|
77816
77930
|
if (wrapperPackageRoot !== undefined && wrapperPackageRoot.trim().length > 0) {
|
|
77817
|
-
const resolvedWrapperPackageRoot =
|
|
77931
|
+
const resolvedWrapperPackageRoot = resolve15(wrapperPackageRoot);
|
|
77818
77932
|
if (isRepoRootWithCodexPlugin(resolvedWrapperPackageRoot))
|
|
77819
77933
|
return resolvedWrapperPackageRoot;
|
|
77820
77934
|
}
|
|
77821
77935
|
return findRepoRootFromImporter(input.importerDir);
|
|
77822
77936
|
}
|
|
77823
77937
|
function isRepoRootWithCodexPlugin(repoRoot) {
|
|
77824
|
-
return existsSync30(
|
|
77938
|
+
return existsSync30(join52(repoRoot, "packages", "omo-codex", "plugin", ".codex-plugin", "plugin.json"));
|
|
77825
77939
|
}
|
|
77826
77940
|
function codexMarketplaceSource(marketplaceRoot) {
|
|
77827
77941
|
return { sourceType: "local", source: marketplaceRoot };
|
|
@@ -77949,20 +78063,20 @@ function dedupe(values) {
|
|
|
77949
78063
|
return deduped;
|
|
77950
78064
|
}
|
|
77951
78065
|
function defaultRunCommand2(command, args) {
|
|
77952
|
-
return new Promise((
|
|
78066
|
+
return new Promise((resolve16) => {
|
|
77953
78067
|
execFile2(command, [...args], { encoding: "utf8", windowsHide: true }, (error, stdout) => {
|
|
77954
|
-
|
|
78068
|
+
resolve16({ success: error === null, stdout });
|
|
77955
78069
|
});
|
|
77956
78070
|
});
|
|
77957
78071
|
}
|
|
77958
78072
|
// packages/omo-codex/src/install/codex-cleanup.ts
|
|
77959
|
-
import { lstat as
|
|
78073
|
+
import { lstat as lstat11, readFile as readFile20, readdir as readdir9, rm as rm11, rmdir } from "fs/promises";
|
|
77960
78074
|
import { homedir as homedir8 } from "os";
|
|
77961
|
-
import { isAbsolute as
|
|
78075
|
+
import { isAbsolute as isAbsolute10, join as join54, relative as relative7, resolve as resolve17 } from "path";
|
|
77962
78076
|
|
|
77963
78077
|
// packages/omo-codex/src/install/codex-cleanup-config.ts
|
|
77964
|
-
import { lstat as
|
|
77965
|
-
import { dirname as
|
|
78078
|
+
import { lstat as lstat10, mkdir as mkdir8, readFile as readFile19, writeFile as writeFile10 } from "fs/promises";
|
|
78079
|
+
import { dirname as dirname18 } from "path";
|
|
77966
78080
|
var MANAGED_MARKETPLACES = ["sisyphuslabs", "lazycodex", "code-yeongyu-codex-plugins"];
|
|
77967
78081
|
var LEGACY_MANAGED_CODEX_AGENT_NAMES_TO_PURGE2 = ["codex-ultrawork-reviewer"];
|
|
77968
78082
|
var CURRENT_MANAGED_CODEX_AGENT_NAMES2 = [
|
|
@@ -77991,12 +78105,12 @@ function cleanupCodexLightConfigText(config) {
|
|
|
77991
78105
|
async function cleanupCodexConfig(configPath, now) {
|
|
77992
78106
|
if (!await configExists(configPath))
|
|
77993
78107
|
return { changed: false };
|
|
77994
|
-
const original = await
|
|
78108
|
+
const original = await readFile19(configPath, "utf8");
|
|
77995
78109
|
const next = cleanupCodexLightConfigText(original);
|
|
77996
78110
|
if (next === original)
|
|
77997
78111
|
return { changed: false };
|
|
77998
78112
|
const backupPath = `${configPath}.backup-${formatBackupTimestamp2(now?.() ?? new Date)}`;
|
|
77999
|
-
await mkdir8(
|
|
78113
|
+
await mkdir8(dirname18(configPath), { recursive: true });
|
|
78000
78114
|
await writeFile10(backupPath, original);
|
|
78001
78115
|
await writeFile10(configPath, `${next.trimEnd()}
|
|
78002
78116
|
`);
|
|
@@ -78060,7 +78174,7 @@ function formatBackupTimestamp2(date) {
|
|
|
78060
78174
|
}
|
|
78061
78175
|
async function configExists(path7) {
|
|
78062
78176
|
try {
|
|
78063
|
-
await
|
|
78177
|
+
await lstat10(path7);
|
|
78064
78178
|
return true;
|
|
78065
78179
|
} catch (error) {
|
|
78066
78180
|
if (nodeErrorCode4(error) === "ENOENT")
|
|
@@ -78075,24 +78189,24 @@ function nodeErrorCode4(error) {
|
|
|
78075
78189
|
}
|
|
78076
78190
|
|
|
78077
78191
|
// packages/omo-codex/src/install/codex-cleanup-safety.ts
|
|
78078
|
-
import { dirname as
|
|
78192
|
+
import { dirname as dirname19, isAbsolute as isAbsolute9, join as join53, relative as relative6, resolve as resolve16 } from "path";
|
|
78079
78193
|
function validateManagedCleanupTarget(input) {
|
|
78080
|
-
if (!
|
|
78194
|
+
if (!isAbsolute9(input.path))
|
|
78081
78195
|
return skipped(input.path, "outside managed Codex cleanup scope");
|
|
78082
|
-
const codexHome =
|
|
78083
|
-
if (
|
|
78196
|
+
const codexHome = resolve16(input.codexHome);
|
|
78197
|
+
if (dirname19(codexHome) === codexHome)
|
|
78084
78198
|
return skipped(input.path, "Codex home resolves to a filesystem root");
|
|
78085
|
-
const target =
|
|
78199
|
+
const target = resolve16(input.path);
|
|
78086
78200
|
if (!isWithinDirectory(codexHome, target))
|
|
78087
78201
|
return skipped(input.path, "outside managed Codex cleanup scope");
|
|
78088
78202
|
if (target === codexHome)
|
|
78089
78203
|
return skipped(input.path, "outside managed Codex cleanup scope");
|
|
78090
78204
|
const exactManagedRoots = new Set([
|
|
78091
|
-
|
|
78092
|
-
|
|
78093
|
-
|
|
78094
|
-
|
|
78095
|
-
|
|
78205
|
+
resolve16(join53(codexHome, "plugins", "cache", "sisyphuslabs")),
|
|
78206
|
+
resolve16(join53(codexHome, ".tmp", "marketplaces", "sisyphuslabs")),
|
|
78207
|
+
resolve16(join53(codexHome, "runtime", "ast-grep")),
|
|
78208
|
+
resolve16(join53(codexHome, "runtime", "node")),
|
|
78209
|
+
resolve16(join53(codexHome, "plugins", "data", "omo-sisyphuslabs", "bootstrap"))
|
|
78096
78210
|
]);
|
|
78097
78211
|
if (exactManagedRoots.has(target))
|
|
78098
78212
|
return null;
|
|
@@ -78102,7 +78216,7 @@ function validateManagedCleanupTarget(input) {
|
|
|
78102
78216
|
}
|
|
78103
78217
|
function isWithinDirectory(parent, child) {
|
|
78104
78218
|
const relativePath = relative6(parent, child);
|
|
78105
|
-
return relativePath === "" || !relativePath.startsWith("..") && !
|
|
78219
|
+
return relativePath === "" || !relativePath.startsWith("..") && !isAbsolute9(relativePath);
|
|
78106
78220
|
}
|
|
78107
78221
|
function isManagedBootstrapDriftPath(codexHome, target) {
|
|
78108
78222
|
const relativePath = relative6(codexHome, target);
|
|
@@ -78122,8 +78236,8 @@ function skipped(path7, reason) {
|
|
|
78122
78236
|
var INSTALLED_AGENTS_MANIFEST = ".installed-agents.json";
|
|
78123
78237
|
async function cleanupCodexLight(input = {}) {
|
|
78124
78238
|
const env3 = input.env ?? process.env;
|
|
78125
|
-
const codexHome =
|
|
78126
|
-
const configPath =
|
|
78239
|
+
const codexHome = resolve17(input.codexHome ?? env3.CODEX_HOME ?? join54(homedir8(), ".codex"));
|
|
78240
|
+
const configPath = join54(codexHome, "config.toml");
|
|
78127
78241
|
const agentPaths = await collectInstalledAgentPaths(codexHome, configPath);
|
|
78128
78242
|
const configCleanup = await cleanupCodexConfig(configPath, input.now);
|
|
78129
78243
|
const agentCleanup = await removeManifestListedAgentLinks(codexHome, agentPaths);
|
|
@@ -78162,31 +78276,31 @@ async function cleanupCodexLight(input = {}) {
|
|
|
78162
78276
|
}
|
|
78163
78277
|
function managedGlobalStatePaths(codexHome) {
|
|
78164
78278
|
return [
|
|
78165
|
-
|
|
78166
|
-
|
|
78167
|
-
|
|
78168
|
-
|
|
78169
|
-
|
|
78279
|
+
join54(codexHome, "plugins", "cache", "sisyphuslabs"),
|
|
78280
|
+
join54(codexHome, ".tmp", "marketplaces", "sisyphuslabs"),
|
|
78281
|
+
join54(codexHome, "runtime", "ast-grep"),
|
|
78282
|
+
join54(codexHome, "runtime", "node"),
|
|
78283
|
+
join54(codexHome, "plugins", "data", "omo-sisyphuslabs", "bootstrap")
|
|
78170
78284
|
];
|
|
78171
78285
|
}
|
|
78172
78286
|
var BOOTSTRAP_DATA_GLOB_MAX_DEPTH = 5;
|
|
78173
78287
|
async function collectBootstrapDataDirsByGlob(codexHome) {
|
|
78174
78288
|
const results = [];
|
|
78175
|
-
await walkForManagedBootstrapDirs(
|
|
78289
|
+
await walkForManagedBootstrapDirs(join54(codexHome, "plugins"), 0, results);
|
|
78176
78290
|
return results;
|
|
78177
78291
|
}
|
|
78178
78292
|
async function walkForManagedBootstrapDirs(directory, depth, results) {
|
|
78179
78293
|
if (depth > BOOTSTRAP_DATA_GLOB_MAX_DEPTH)
|
|
78180
78294
|
return;
|
|
78181
|
-
const entries = await
|
|
78295
|
+
const entries = await readdir9(directory, { withFileTypes: true }).catch(() => null);
|
|
78182
78296
|
if (entries === null)
|
|
78183
78297
|
return;
|
|
78184
78298
|
for (const entry of entries) {
|
|
78185
78299
|
if (!entry.isDirectory())
|
|
78186
78300
|
continue;
|
|
78187
|
-
const childPath =
|
|
78301
|
+
const childPath = join54(directory, entry.name);
|
|
78188
78302
|
if (isManagedBootstrapOwnerName(entry.name)) {
|
|
78189
|
-
const bootstrapDir =
|
|
78303
|
+
const bootstrapDir = join54(childPath, "bootstrap");
|
|
78190
78304
|
if (await exists6(bootstrapDir))
|
|
78191
78305
|
results.push(bootstrapDir);
|
|
78192
78306
|
continue;
|
|
@@ -78210,9 +78324,9 @@ async function removeManagedPathBestEffort(path7, seams) {
|
|
|
78210
78324
|
}
|
|
78211
78325
|
async function attemptRemove(path7) {
|
|
78212
78326
|
try {
|
|
78213
|
-
if (await
|
|
78327
|
+
if (await lstat11(path7).catch(() => null) === null)
|
|
78214
78328
|
return false;
|
|
78215
|
-
await
|
|
78329
|
+
await rm11(path7, { recursive: true, force: true });
|
|
78216
78330
|
return true;
|
|
78217
78331
|
} catch {
|
|
78218
78332
|
return false;
|
|
@@ -78220,7 +78334,7 @@ async function attemptRemove(path7) {
|
|
|
78220
78334
|
}
|
|
78221
78335
|
async function pruneEmptyRuntimeDirBestEffort(codexHome) {
|
|
78222
78336
|
try {
|
|
78223
|
-
await rmdir(
|
|
78337
|
+
await rmdir(join54(codexHome, "runtime"));
|
|
78224
78338
|
} catch (error) {
|
|
78225
78339
|
if (isExpectedRuntimePruneFailure(error))
|
|
78226
78340
|
return;
|
|
@@ -78232,14 +78346,14 @@ function isExpectedRuntimePruneFailure(error) {
|
|
|
78232
78346
|
}
|
|
78233
78347
|
async function collectInstalledAgentPaths(codexHome, configPath) {
|
|
78234
78348
|
const manifestPaths = [
|
|
78235
|
-
|
|
78349
|
+
join54(codexHome, ".tmp", "marketplaces", "sisyphuslabs", "plugins", "omo", INSTALLED_AGENTS_MANIFEST)
|
|
78236
78350
|
];
|
|
78237
|
-
const versionRoot =
|
|
78351
|
+
const versionRoot = join54(codexHome, "plugins", "cache", "sisyphuslabs", "omo");
|
|
78238
78352
|
if (await exists6(versionRoot)) {
|
|
78239
|
-
const entries = await
|
|
78353
|
+
const entries = await readdir9(versionRoot, { withFileTypes: true });
|
|
78240
78354
|
for (const entry of entries) {
|
|
78241
78355
|
if (entry.isDirectory())
|
|
78242
|
-
manifestPaths.push(
|
|
78356
|
+
manifestPaths.push(join54(versionRoot, entry.name, INSTALLED_AGENTS_MANIFEST));
|
|
78243
78357
|
}
|
|
78244
78358
|
}
|
|
78245
78359
|
const paths = new Set;
|
|
@@ -78256,19 +78370,19 @@ async function collectInstalledAgentPaths(codexHome, configPath) {
|
|
|
78256
78370
|
async function readManagedAgentPathsFromConfig(codexHome, configPath) {
|
|
78257
78371
|
if (!await exists6(configPath))
|
|
78258
78372
|
return [];
|
|
78259
|
-
const config = await
|
|
78260
|
-
return MANAGED_CODEX_AGENT_NAMES2.filter((agentName) => config.includes(`config_file = ${JSON.stringify(`./agents/${agentName}.toml`)}`)).map((agentName) =>
|
|
78373
|
+
const config = await readFile20(configPath, "utf8");
|
|
78374
|
+
return MANAGED_CODEX_AGENT_NAMES2.filter((agentName) => config.includes(`config_file = ${JSON.stringify(`./agents/${agentName}.toml`)}`)).map((agentName) => join54(codexHome, "agents", `${agentName}.toml`));
|
|
78261
78375
|
}
|
|
78262
78376
|
async function readInstalledAgentManifest(manifestPath) {
|
|
78263
78377
|
if (!await exists6(manifestPath))
|
|
78264
78378
|
return [];
|
|
78265
|
-
const parsed = JSON.parse(await
|
|
78379
|
+
const parsed = JSON.parse(await readFile20(manifestPath, "utf8"));
|
|
78266
78380
|
if (!isPlainRecord3(parsed) || !Array.isArray(parsed.agents))
|
|
78267
78381
|
return [];
|
|
78268
78382
|
return parsed.agents.filter((path7) => typeof path7 === "string");
|
|
78269
78383
|
}
|
|
78270
78384
|
async function removeManifestListedAgentLinks(codexHome, paths) {
|
|
78271
|
-
const agentsDir =
|
|
78385
|
+
const agentsDir = join54(codexHome, "agents");
|
|
78272
78386
|
const removed = [];
|
|
78273
78387
|
const skipped2 = [];
|
|
78274
78388
|
for (const path7 of paths) {
|
|
@@ -78283,16 +78397,16 @@ async function removeManifestListedAgentLinks(codexHome, paths) {
|
|
|
78283
78397
|
skipped2.push(path7);
|
|
78284
78398
|
continue;
|
|
78285
78399
|
}
|
|
78286
|
-
await
|
|
78400
|
+
await rm11(path7, { force: true });
|
|
78287
78401
|
removed.push(path7);
|
|
78288
78402
|
}
|
|
78289
78403
|
return { removed, skipped: skipped2 };
|
|
78290
78404
|
}
|
|
78291
78405
|
function isSafeManagedAgentPath(agentsDir, path7) {
|
|
78292
|
-
if (!
|
|
78406
|
+
if (!isAbsolute10(path7))
|
|
78293
78407
|
return false;
|
|
78294
78408
|
const relativePath = relative7(agentsDir, path7);
|
|
78295
|
-
if (relativePath === "" || relativePath.startsWith("..") ||
|
|
78409
|
+
if (relativePath === "" || relativePath.startsWith("..") || isAbsolute10(relativePath))
|
|
78296
78410
|
return false;
|
|
78297
78411
|
const fileName = relativePath.split(/[\\/]/).pop();
|
|
78298
78412
|
if (fileName === undefined)
|
|
@@ -78304,7 +78418,7 @@ async function exists6(path7) {
|
|
|
78304
78418
|
}
|
|
78305
78419
|
async function maybeLstat2(path7) {
|
|
78306
78420
|
try {
|
|
78307
|
-
return await
|
|
78421
|
+
return await lstat11(path7);
|
|
78308
78422
|
} catch (error) {
|
|
78309
78423
|
if (nodeErrorCode5(error) === "ENOENT")
|
|
78310
78424
|
return null;
|
|
@@ -78352,19 +78466,19 @@ init_provider_availability();
|
|
|
78352
78466
|
|
|
78353
78467
|
// packages/omo-opencode/src/cli/config-manager/add-tui-plugin-to-tui-config.ts
|
|
78354
78468
|
import { existsSync as existsSync33, mkdirSync as mkdirSync10, readFileSync as readFileSync16 } from "fs";
|
|
78355
|
-
import { join as
|
|
78469
|
+
import { join as join56 } from "path";
|
|
78356
78470
|
|
|
78357
78471
|
// packages/omo-opencode/src/cli/doctor/checks/tui-plugin-config.ts
|
|
78358
78472
|
init_shared();
|
|
78359
78473
|
import { existsSync as existsSync32, readFileSync as readFileSync15 } from "fs";
|
|
78360
|
-
import { join as
|
|
78474
|
+
import { join as join55 } from "path";
|
|
78361
78475
|
var TUI_SUBPATH = "tui";
|
|
78362
78476
|
var TUI_EXPORT_SUBPATH = `./${TUI_SUBPATH}`;
|
|
78363
78477
|
function fileEntryPackageJsonPath(entry) {
|
|
78364
78478
|
let path7 = entry.slice("file:".length);
|
|
78365
78479
|
if (path7.startsWith("//"))
|
|
78366
78480
|
path7 = path7.slice(2);
|
|
78367
|
-
return
|
|
78481
|
+
return join55(path7, "package.json");
|
|
78368
78482
|
}
|
|
78369
78483
|
function packageJsonExportsTui(pkgJsonPath) {
|
|
78370
78484
|
if (!existsSync32(pkgJsonPath))
|
|
@@ -78402,7 +78516,7 @@ function packageExportsTuiForServerEntry(entry) {
|
|
|
78402
78516
|
const packageName = packageNameFromServerEntry(entry);
|
|
78403
78517
|
if (packageName === null)
|
|
78404
78518
|
return null;
|
|
78405
|
-
return packageJsonExportsTui(
|
|
78519
|
+
return packageJsonExportsTui(join55(getOpenCodeConfigDir({ binary: "opencode" }), "node_modules", packageName, "package.json"));
|
|
78406
78520
|
}
|
|
78407
78521
|
function isOurFilePluginEntry(entry) {
|
|
78408
78522
|
if (!entry.startsWith("file:"))
|
|
@@ -78475,7 +78589,7 @@ function detectServerPluginRegistration() {
|
|
|
78475
78589
|
}
|
|
78476
78590
|
}
|
|
78477
78591
|
function detectTuiPluginRegistration() {
|
|
78478
|
-
const tuiJsonPath =
|
|
78592
|
+
const tuiJsonPath = join55(getOpenCodeConfigDir({ binary: "opencode" }), "tui.json");
|
|
78479
78593
|
if (!existsSync32(tuiJsonPath)) {
|
|
78480
78594
|
return {
|
|
78481
78595
|
registered: false,
|
|
@@ -78631,10 +78745,10 @@ function readConfig(path7) {
|
|
|
78631
78745
|
return null;
|
|
78632
78746
|
}
|
|
78633
78747
|
function readServerConfig(configDir) {
|
|
78634
|
-
const jsoncPath =
|
|
78748
|
+
const jsoncPath = join56(configDir, "opencode.jsonc");
|
|
78635
78749
|
if (existsSync33(jsoncPath))
|
|
78636
78750
|
return readConfig(jsoncPath);
|
|
78637
|
-
const jsonPath =
|
|
78751
|
+
const jsonPath = join56(configDir, "opencode.json");
|
|
78638
78752
|
if (existsSync33(jsonPath))
|
|
78639
78753
|
return readConfig(jsonPath);
|
|
78640
78754
|
return null;
|
|
@@ -78676,7 +78790,7 @@ function ensureTuiPluginEntry(opts = {}) {
|
|
|
78676
78790
|
if (!desiredEntry) {
|
|
78677
78791
|
return { changed: false, reason: "no-server-entry" };
|
|
78678
78792
|
}
|
|
78679
|
-
const tuiJsonPath =
|
|
78793
|
+
const tuiJsonPath = join56(configDir, "tui.json");
|
|
78680
78794
|
const { config, malformed } = readTuiConfig(tuiJsonPath);
|
|
78681
78795
|
if (malformed) {
|
|
78682
78796
|
return { changed: false, reason: "malformed" };
|
|
@@ -78692,7 +78806,7 @@ function ensureTuiPluginEntry(opts = {}) {
|
|
|
78692
78806
|
|
|
78693
78807
|
// packages/omo-opencode/src/cli/install-ast-grep-sg.ts
|
|
78694
78808
|
import { homedir as homedir9 } from "os";
|
|
78695
|
-
import { join as
|
|
78809
|
+
import { join as join57 } from "path";
|
|
78696
78810
|
|
|
78697
78811
|
// packages/shared-skills/index.mjs
|
|
78698
78812
|
import { fileURLToPath } from "url";
|
|
@@ -78711,9 +78825,9 @@ function describeResult2(result) {
|
|
|
78711
78825
|
}
|
|
78712
78826
|
async function installAstGrepForOpenCode(options = {}) {
|
|
78713
78827
|
const platform = options.platform ?? process.platform;
|
|
78714
|
-
const baseDir =
|
|
78828
|
+
const baseDir = join57(options.homeDir ?? homedir9(), ".omo");
|
|
78715
78829
|
const targetDir = astGrepRuntimeDir(baseDir, platform, options.arch ?? process.arch);
|
|
78716
|
-
const skillDir =
|
|
78830
|
+
const skillDir = join57(options.sharedSkillsRoot ?? sharedSkillsRootPath(), "ast-grep");
|
|
78717
78831
|
const installer = options.installer ?? runAstGrepSkillInstall;
|
|
78718
78832
|
try {
|
|
78719
78833
|
const result = await installer({ platform, skillDir, targetDir });
|
|
@@ -96662,7 +96776,7 @@ var import_picocolors11 = __toESM(require_picocolors(), 1);
|
|
|
96662
96776
|
// packages/omo-opencode/src/cli/run/opencode-binary-resolver.ts
|
|
96663
96777
|
init_bun_which_shim();
|
|
96664
96778
|
init_spawn_with_windows_hide();
|
|
96665
|
-
import { delimiter as delimiter2, dirname as
|
|
96779
|
+
import { delimiter as delimiter2, dirname as dirname21, posix as posix4, win32 as win324 } from "path";
|
|
96666
96780
|
var OPENCODE_COMMANDS = ["opencode", "opencode-desktop"];
|
|
96667
96781
|
var WINDOWS_SUFFIXES = ["", ".exe", ".cmd", ".bat", ".ps1"];
|
|
96668
96782
|
function getCommandCandidates(platform) {
|
|
@@ -96720,7 +96834,7 @@ async function findWorkingOpencodeBinary(pathEnv = process.env.PATH, probe2 = ca
|
|
|
96720
96834
|
return null;
|
|
96721
96835
|
}
|
|
96722
96836
|
function buildPathWithBinaryFirst(pathEnv, binaryPath) {
|
|
96723
|
-
const preferredDir =
|
|
96837
|
+
const preferredDir = dirname21(binaryPath);
|
|
96724
96838
|
const existing = (pathEnv ?? "").split(delimiter2).filter((entry) => entry.length > 0 && entry !== preferredDir);
|
|
96725
96839
|
return [preferredDir, ...existing].join(delimiter2);
|
|
96726
96840
|
}
|
|
@@ -96888,7 +97002,7 @@ async function resolveSession(options) {
|
|
|
96888
97002
|
if (attempt < SESSION_CREATE_MAX_RETRIES) {
|
|
96889
97003
|
const delay2 = SESSION_CREATE_RETRY_DELAY_MS * attempt;
|
|
96890
97004
|
console.log(import_picocolors12.default.dim(` Retrying in ${delay2}ms...`));
|
|
96891
|
-
await new Promise((
|
|
97005
|
+
await new Promise((resolve18) => setTimeout(resolve18, delay2));
|
|
96892
97006
|
}
|
|
96893
97007
|
continue;
|
|
96894
97008
|
}
|
|
@@ -96899,7 +97013,7 @@ async function resolveSession(options) {
|
|
|
96899
97013
|
if (attempt < SESSION_CREATE_MAX_RETRIES) {
|
|
96900
97014
|
const delay2 = SESSION_CREATE_RETRY_DELAY_MS * attempt;
|
|
96901
97015
|
console.log(import_picocolors12.default.dim(` Retrying in ${delay2}ms...`));
|
|
96902
|
-
await new Promise((
|
|
97016
|
+
await new Promise((resolve18) => setTimeout(resolve18, delay2));
|
|
96903
97017
|
}
|
|
96904
97018
|
}
|
|
96905
97019
|
throw new Error("Failed to create session after all retries");
|
|
@@ -97165,12 +97279,12 @@ function readCurrentTopLevelTask(planPath) {
|
|
|
97165
97279
|
}
|
|
97166
97280
|
// packages/boulder-state/src/storage/path.ts
|
|
97167
97281
|
import { existsSync as existsSync37 } from "fs";
|
|
97168
|
-
import { isAbsolute as
|
|
97282
|
+
import { isAbsolute as isAbsolute11, join as join59, relative as relative8, resolve as resolve18 } from "path";
|
|
97169
97283
|
function getBoulderFilePath(directory) {
|
|
97170
|
-
return
|
|
97284
|
+
return join59(directory, BOULDER_DIR, BOULDER_FILE);
|
|
97171
97285
|
}
|
|
97172
97286
|
function resolveTrackedPath(baseDirectory, trackedPath) {
|
|
97173
|
-
return
|
|
97287
|
+
return isAbsolute11(trackedPath) ? resolve18(trackedPath) : resolve18(baseDirectory, trackedPath);
|
|
97174
97288
|
}
|
|
97175
97289
|
function resolveBoulderPlanPath(directory, state) {
|
|
97176
97290
|
const absolutePlanPath = resolveTrackedPath(directory, state.active_plan);
|
|
@@ -97178,13 +97292,13 @@ function resolveBoulderPlanPath(directory, state) {
|
|
|
97178
97292
|
if (!worktreePath) {
|
|
97179
97293
|
return absolutePlanPath;
|
|
97180
97294
|
}
|
|
97181
|
-
const absoluteDirectory =
|
|
97295
|
+
const absoluteDirectory = resolve18(directory);
|
|
97182
97296
|
const relativePlanPath = relative8(absoluteDirectory, absolutePlanPath);
|
|
97183
|
-
if (relativePlanPath.length === 0 || relativePlanPath.startsWith("..") ||
|
|
97297
|
+
if (relativePlanPath.length === 0 || relativePlanPath.startsWith("..") || isAbsolute11(relativePlanPath)) {
|
|
97184
97298
|
return absolutePlanPath;
|
|
97185
97299
|
}
|
|
97186
97300
|
const absoluteWorktreePath = resolveTrackedPath(directory, worktreePath);
|
|
97187
|
-
const worktreePlanPath =
|
|
97301
|
+
const worktreePlanPath = resolve18(absoluteWorktreePath, relativePlanPath);
|
|
97188
97302
|
return existsSync37(worktreePlanPath) ? worktreePlanPath : absolutePlanPath;
|
|
97189
97303
|
}
|
|
97190
97304
|
function resolveBoulderPlanPathForWork(directory, work) {
|
|
@@ -97396,9 +97510,9 @@ init_state();
|
|
|
97396
97510
|
var CONTINUATION_MARKER_DIR = ".omo/run-continuation";
|
|
97397
97511
|
// packages/omo-opencode/src/features/run-continuation-state/storage.ts
|
|
97398
97512
|
import { existsSync as existsSync40, mkdirSync as mkdirSync11, readFileSync as readFileSync21, rmSync as rmSync2, writeFileSync as writeFileSync6 } from "fs";
|
|
97399
|
-
import { join as
|
|
97513
|
+
import { join as join60 } from "path";
|
|
97400
97514
|
function getMarkerPath(directory, sessionID) {
|
|
97401
|
-
return
|
|
97515
|
+
return join60(directory, CONTINUATION_MARKER_DIR, `${sessionID}.json`);
|
|
97402
97516
|
}
|
|
97403
97517
|
function readContinuationMarker(directory, sessionID) {
|
|
97404
97518
|
const markerPath = getMarkerPath(directory, sessionID);
|
|
@@ -97471,7 +97585,7 @@ async function isSessionInBoulderLineage(input) {
|
|
|
97471
97585
|
init_shared();
|
|
97472
97586
|
init_compaction_marker();
|
|
97473
97587
|
import { readFileSync as readFileSync22, readdirSync as readdirSync6 } from "fs";
|
|
97474
|
-
import { join as
|
|
97588
|
+
import { join as join61 } from "path";
|
|
97475
97589
|
var defaultSessionLastAgentDeps = {
|
|
97476
97590
|
getMessageDir,
|
|
97477
97591
|
isSqliteBackend,
|
|
@@ -97531,7 +97645,7 @@ async function getLastAgentFromSession(sessionID, client3, deps = {}) {
|
|
|
97531
97645
|
try {
|
|
97532
97646
|
const messages = readdirSync6(messageDir).filter((fileName) => fileName.endsWith(".json")).map((fileName) => {
|
|
97533
97647
|
try {
|
|
97534
|
-
const content = readFileSync22(
|
|
97648
|
+
const content = readFileSync22(join61(messageDir, fileName), "utf-8");
|
|
97535
97649
|
const parsed = JSON.parse(content);
|
|
97536
97650
|
return {
|
|
97537
97651
|
fileName,
|
|
@@ -97575,7 +97689,7 @@ init_agent_display_names();
|
|
|
97575
97689
|
// packages/omo-opencode/src/hooks/ralph-loop/storage.ts
|
|
97576
97690
|
init_frontmatter2();
|
|
97577
97691
|
import { existsSync as existsSync41, readFileSync as readFileSync23, writeFileSync as writeFileSync7, unlinkSync as unlinkSync5, mkdirSync as mkdirSync12 } from "fs";
|
|
97578
|
-
import { dirname as
|
|
97692
|
+
import { dirname as dirname22, join as join62 } from "path";
|
|
97579
97693
|
|
|
97580
97694
|
// packages/omo-opencode/src/hooks/ralph-loop/constants.ts
|
|
97581
97695
|
var DEFAULT_STATE_FILE = ".omo/ralph-loop.local.md";
|
|
@@ -97584,7 +97698,7 @@ var DEFAULT_COMPLETION_PROMISE = "DONE";
|
|
|
97584
97698
|
|
|
97585
97699
|
// packages/omo-opencode/src/hooks/ralph-loop/storage.ts
|
|
97586
97700
|
function getStateFilePath(directory, customPath) {
|
|
97587
|
-
return customPath ?
|
|
97701
|
+
return customPath ? join62(directory, customPath) : join62(directory, DEFAULT_STATE_FILE);
|
|
97588
97702
|
}
|
|
97589
97703
|
function readState(directory, customPath) {
|
|
97590
97704
|
const filePath = getStateFilePath(directory, customPath);
|
|
@@ -97823,7 +97937,7 @@ async function pollForCompletion(ctx, eventState, abortController, options = {})
|
|
|
97823
97937
|
let secondaryTimeoutChecked = false;
|
|
97824
97938
|
const pollStartTimestamp = Date.now();
|
|
97825
97939
|
while (!abortController.signal.aborted) {
|
|
97826
|
-
await new Promise((
|
|
97940
|
+
await new Promise((resolve19) => setTimeout(resolve19, pollIntervalMs));
|
|
97827
97941
|
if (abortController.signal.aborted) {
|
|
97828
97942
|
return 130;
|
|
97829
97943
|
}
|
|
@@ -97981,7 +98095,7 @@ function createAbortError() {
|
|
|
97981
98095
|
return error51;
|
|
97982
98096
|
}
|
|
97983
98097
|
function sleep(delayMs) {
|
|
97984
|
-
return new Promise((
|
|
98098
|
+
return new Promise((resolve19) => setTimeout(resolve19, delayMs));
|
|
97985
98099
|
}
|
|
97986
98100
|
function hasPromptStartEvidence(eventState) {
|
|
97987
98101
|
return eventState.mainSessionStarted || eventState.hasReceivedMeaningfulWork || eventState.messageCount > 0 || eventState.currentTool !== null;
|
|
@@ -98356,7 +98470,7 @@ var EVENT_PROCESSOR_SHUTDOWN_TIMEOUT_MS = 2000;
|
|
|
98356
98470
|
async function waitForEventProcessorShutdown(eventProcessor, timeoutMs = EVENT_PROCESSOR_SHUTDOWN_TIMEOUT_MS) {
|
|
98357
98471
|
const completed = await Promise.race([
|
|
98358
98472
|
eventProcessor.then(() => true),
|
|
98359
|
-
new Promise((
|
|
98473
|
+
new Promise((resolve19) => setTimeout(() => resolve19(false), timeoutMs))
|
|
98360
98474
|
]);
|
|
98361
98475
|
}
|
|
98362
98476
|
async function run(options) {
|
|
@@ -98666,7 +98780,7 @@ init_extract_semver();
|
|
|
98666
98780
|
init_bun_which_shim();
|
|
98667
98781
|
import { existsSync as existsSync49, accessSync as accessSync4, constants as constants9 } from "fs";
|
|
98668
98782
|
import { homedir as homedir13 } from "os";
|
|
98669
|
-
import { join as
|
|
98783
|
+
import { join as join69 } from "path";
|
|
98670
98784
|
|
|
98671
98785
|
// packages/omo-opencode/src/cli/doctor/framework/spawn-with-timeout.ts
|
|
98672
98786
|
init_spawn_with_windows_hide();
|
|
@@ -98705,8 +98819,8 @@ async function spawnWithTimeout(command, options, timeoutMs = DEFAULT_SPAWN_TIME
|
|
|
98705
98819
|
const stdoutPromise = readSpawnStream(proc.stdout);
|
|
98706
98820
|
const stderrPromise = readSpawnStream(proc.stderr);
|
|
98707
98821
|
let timer;
|
|
98708
|
-
const timeoutPromise = new Promise((
|
|
98709
|
-
timer = setTimeout(() =>
|
|
98822
|
+
const timeoutPromise = new Promise((resolve19) => {
|
|
98823
|
+
timer = setTimeout(() => resolve19("timeout"), timeoutMs);
|
|
98710
98824
|
});
|
|
98711
98825
|
const processPromise = (async () => {
|
|
98712
98826
|
await proc.exited;
|
|
@@ -98758,17 +98872,17 @@ function getDesktopAppPaths(platform) {
|
|
|
98758
98872
|
case "darwin":
|
|
98759
98873
|
return [
|
|
98760
98874
|
"/Applications/OpenCode.app/Contents/MacOS/OpenCode",
|
|
98761
|
-
|
|
98875
|
+
join69(home, "Applications", "OpenCode.app", "Contents", "MacOS", "OpenCode")
|
|
98762
98876
|
];
|
|
98763
98877
|
case "win32": {
|
|
98764
98878
|
const programFiles = process.env.ProgramFiles;
|
|
98765
98879
|
const localAppData = process.env.LOCALAPPDATA;
|
|
98766
98880
|
const paths = [];
|
|
98767
98881
|
if (programFiles) {
|
|
98768
|
-
paths.push(
|
|
98882
|
+
paths.push(join69(programFiles, "OpenCode", "OpenCode.exe"));
|
|
98769
98883
|
}
|
|
98770
98884
|
if (localAppData) {
|
|
98771
|
-
paths.push(
|
|
98885
|
+
paths.push(join69(localAppData, "OpenCode", "OpenCode.exe"));
|
|
98772
98886
|
}
|
|
98773
98887
|
return paths;
|
|
98774
98888
|
}
|
|
@@ -98776,8 +98890,8 @@ function getDesktopAppPaths(platform) {
|
|
|
98776
98890
|
return [
|
|
98777
98891
|
"/usr/bin/opencode",
|
|
98778
98892
|
"/usr/lib/opencode/opencode",
|
|
98779
|
-
|
|
98780
|
-
|
|
98893
|
+
join69(home, "Applications", "opencode-desktop-linux-x86_64.AppImage"),
|
|
98894
|
+
join69(home, "Applications", "opencode-desktop-linux-aarch64.AppImage")
|
|
98781
98895
|
];
|
|
98782
98896
|
default:
|
|
98783
98897
|
return [];
|
|
@@ -98809,7 +98923,7 @@ async function findOpenCodeBinary(platform = process.platform, checkExists = exi
|
|
|
98809
98923
|
const candidates = getCommandCandidates2(platform);
|
|
98810
98924
|
for (const entry of pathEnv.split(delimiter3).filter(Boolean)) {
|
|
98811
98925
|
for (const command of candidates) {
|
|
98812
|
-
const fullPath =
|
|
98926
|
+
const fullPath = join69(entry, command);
|
|
98813
98927
|
if (checkExists(fullPath) && isExecutable2(fullPath)) {
|
|
98814
98928
|
return { binary: command, path: fullPath };
|
|
98815
98929
|
}
|
|
@@ -98951,22 +99065,22 @@ init_package_json_locator();
|
|
|
98951
99065
|
import { existsSync as existsSync51, readFileSync as readFileSync32, readdirSync as readdirSync8 } from "fs";
|
|
98952
99066
|
import { createRequire as createRequire2 } from "module";
|
|
98953
99067
|
import { homedir as homedir14 } from "os";
|
|
98954
|
-
import { join as
|
|
99068
|
+
import { join as join70 } from "path";
|
|
98955
99069
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
98956
99070
|
init_shared();
|
|
98957
99071
|
function getPlatformDefaultCacheDir(platform = process.platform) {
|
|
98958
99072
|
if (platform === "darwin")
|
|
98959
|
-
return
|
|
99073
|
+
return join70(homedir14(), "Library", "Caches");
|
|
98960
99074
|
if (platform === "win32")
|
|
98961
|
-
return process.env.LOCALAPPDATA ??
|
|
98962
|
-
return
|
|
99075
|
+
return process.env.LOCALAPPDATA ?? join70(homedir14(), "AppData", "Local");
|
|
99076
|
+
return join70(homedir14(), ".cache");
|
|
98963
99077
|
}
|
|
98964
99078
|
function resolveOpenCodeCacheDir() {
|
|
98965
99079
|
const xdgCacheHome = process.env.XDG_CACHE_HOME;
|
|
98966
99080
|
if (xdgCacheHome)
|
|
98967
|
-
return
|
|
99081
|
+
return join70(xdgCacheHome, "opencode");
|
|
98968
99082
|
const fromShared = getOpenCodeCacheDir();
|
|
98969
|
-
const platformDefault =
|
|
99083
|
+
const platformDefault = join70(getPlatformDefaultCacheDir(), "opencode");
|
|
98970
99084
|
if (existsSync51(fromShared) || !existsSync51(platformDefault))
|
|
98971
99085
|
return fromShared;
|
|
98972
99086
|
return platformDefault;
|
|
@@ -98998,11 +99112,11 @@ function normalizeVersion(value) {
|
|
|
98998
99112
|
function createPackageCandidates(rootDir) {
|
|
98999
99113
|
return ACCEPTED_PACKAGE_NAMES.map((packageName) => ({
|
|
99000
99114
|
packageName,
|
|
99001
|
-
installedPackagePath:
|
|
99115
|
+
installedPackagePath: join70(rootDir, "node_modules", packageName, "package.json")
|
|
99002
99116
|
}));
|
|
99003
99117
|
}
|
|
99004
99118
|
function createTaggedInstallCandidates(rootDir) {
|
|
99005
|
-
const packagesDir =
|
|
99119
|
+
const packagesDir = join70(rootDir, "packages");
|
|
99006
99120
|
if (!existsSync51(packagesDir))
|
|
99007
99121
|
return [];
|
|
99008
99122
|
const candidates = [];
|
|
@@ -99010,14 +99124,14 @@ function createTaggedInstallCandidates(rootDir) {
|
|
|
99010
99124
|
const packageName = ACCEPTED_PACKAGE_NAMES.find((name) => entryName.startsWith(`${name}@`));
|
|
99011
99125
|
if (packageName === undefined)
|
|
99012
99126
|
continue;
|
|
99013
|
-
const installDir =
|
|
99127
|
+
const installDir = join70(packagesDir, entryName);
|
|
99014
99128
|
candidates.push({
|
|
99015
99129
|
cacheDir: installDir,
|
|
99016
|
-
cachePackagePath:
|
|
99130
|
+
cachePackagePath: join70(installDir, "package.json"),
|
|
99017
99131
|
packageCandidates: [
|
|
99018
99132
|
{
|
|
99019
99133
|
packageName,
|
|
99020
|
-
installedPackagePath:
|
|
99134
|
+
installedPackagePath: join70(installDir, "node_modules", packageName, "package.json")
|
|
99021
99135
|
}
|
|
99022
99136
|
]
|
|
99023
99137
|
});
|
|
@@ -99062,13 +99176,13 @@ function getLoadedPluginVersion() {
|
|
|
99062
99176
|
const candidates = [
|
|
99063
99177
|
{
|
|
99064
99178
|
cacheDir: configDir,
|
|
99065
|
-
cachePackagePath:
|
|
99179
|
+
cachePackagePath: join70(configDir, "package.json"),
|
|
99066
99180
|
packageCandidates: createPackageCandidates(configDir)
|
|
99067
99181
|
},
|
|
99068
99182
|
...createTaggedInstallCandidates(configDir),
|
|
99069
99183
|
{
|
|
99070
99184
|
cacheDir,
|
|
99071
|
-
cachePackagePath:
|
|
99185
|
+
cachePackagePath: join70(cacheDir, "package.json"),
|
|
99072
99186
|
packageCandidates: createPackageCandidates(cacheDir)
|
|
99073
99187
|
},
|
|
99074
99188
|
...createTaggedInstallCandidates(cacheDir)
|
|
@@ -99261,7 +99375,7 @@ async function checkSystem(deps = defaultDeps6) {
|
|
|
99261
99375
|
init_src();
|
|
99262
99376
|
import { readFileSync as readFileSync34 } from "fs";
|
|
99263
99377
|
import { homedir as homedir15 } from "os";
|
|
99264
|
-
import { dirname as
|
|
99378
|
+
import { dirname as dirname27, relative as relative9 } from "path";
|
|
99265
99379
|
init_shared();
|
|
99266
99380
|
init_plugin_identity();
|
|
99267
99381
|
function resolveHomeDirectory2() {
|
|
@@ -99285,7 +99399,7 @@ function discoverProjectLayersNearestFirst(directory) {
|
|
|
99285
99399
|
const stopDirectory = containsPath(homeDirectory, directory) ? homeDirectory : directory;
|
|
99286
99400
|
return findProjectOpencodePluginConfigFiles(directory, stopDirectory).map((configPath) => ({
|
|
99287
99401
|
path: configPath,
|
|
99288
|
-
configDir:
|
|
99402
|
+
configDir: dirname27(configPath)
|
|
99289
99403
|
}));
|
|
99290
99404
|
}
|
|
99291
99405
|
function shortPath(configPath) {
|
|
@@ -99309,7 +99423,7 @@ function parseLayerConfig(configPath) {
|
|
|
99309
99423
|
if (!isPlainRecord(rawConfig)) {
|
|
99310
99424
|
return {
|
|
99311
99425
|
path: configPath,
|
|
99312
|
-
configDir:
|
|
99426
|
+
configDir: dirname27(configPath),
|
|
99313
99427
|
config: null,
|
|
99314
99428
|
messages: [`${shortPath(configPath)}: <root>: Expected object`]
|
|
99315
99429
|
};
|
|
@@ -99317,7 +99431,7 @@ function parseLayerConfig(configPath) {
|
|
|
99317
99431
|
const result = OhMyOpenCodeConfigSchema.safeParse(rawConfig);
|
|
99318
99432
|
return {
|
|
99319
99433
|
path: configPath,
|
|
99320
|
-
configDir:
|
|
99434
|
+
configDir: dirname27(configPath),
|
|
99321
99435
|
config: result.success ? result.data : parseConfigPartially(rawConfig),
|
|
99322
99436
|
messages: schemaMessages(configPath, rawConfig)
|
|
99323
99437
|
};
|
|
@@ -99327,7 +99441,7 @@ function parseLayerConfig(configPath) {
|
|
|
99327
99441
|
}
|
|
99328
99442
|
return {
|
|
99329
99443
|
path: configPath,
|
|
99330
|
-
configDir:
|
|
99444
|
+
configDir: dirname27(configPath),
|
|
99331
99445
|
config: null,
|
|
99332
99446
|
messages: [`${shortPath(configPath)}: ${error51.message}`]
|
|
99333
99447
|
};
|
|
@@ -99375,18 +99489,18 @@ function validatePluginConfig(directory) {
|
|
|
99375
99489
|
init_shared();
|
|
99376
99490
|
import { existsSync as existsSync53, readFileSync as readFileSync35 } from "fs";
|
|
99377
99491
|
import { homedir as homedir16 } from "os";
|
|
99378
|
-
import { join as
|
|
99492
|
+
import { join as join71 } from "path";
|
|
99379
99493
|
function getUserConfigDir2() {
|
|
99380
99494
|
const xdgConfig = process.env.XDG_CONFIG_HOME;
|
|
99381
99495
|
if (xdgConfig)
|
|
99382
|
-
return
|
|
99383
|
-
return
|
|
99496
|
+
return join71(xdgConfig, "opencode");
|
|
99497
|
+
return join71(homedir16(), ".config", "opencode");
|
|
99384
99498
|
}
|
|
99385
99499
|
function loadCustomProviderNames() {
|
|
99386
99500
|
const configDir = getUserConfigDir2();
|
|
99387
99501
|
const candidatePaths = [
|
|
99388
|
-
|
|
99389
|
-
|
|
99502
|
+
join71(configDir, "opencode.json"),
|
|
99503
|
+
join71(configDir, "opencode.jsonc")
|
|
99390
99504
|
];
|
|
99391
99505
|
for (const configPath of candidatePaths) {
|
|
99392
99506
|
if (!existsSync53(configPath))
|
|
@@ -99407,7 +99521,7 @@ function loadCustomProviderNames() {
|
|
|
99407
99521
|
return [];
|
|
99408
99522
|
}
|
|
99409
99523
|
function loadAvailableModelsFromCache() {
|
|
99410
|
-
const cacheFile =
|
|
99524
|
+
const cacheFile = join71(getOpenCodeCacheDir(), "models.json");
|
|
99411
99525
|
const customProviders = loadCustomProviderNames();
|
|
99412
99526
|
if (!existsSync53(cacheFile)) {
|
|
99413
99527
|
if (customProviders.length > 0) {
|
|
@@ -99444,8 +99558,8 @@ init_model_capabilities2();
|
|
|
99444
99558
|
init_shared();
|
|
99445
99559
|
init_plugin_identity();
|
|
99446
99560
|
import { readFileSync as readFileSync36 } from "fs";
|
|
99447
|
-
import { join as
|
|
99448
|
-
var PROJECT_CONFIG_DIR =
|
|
99561
|
+
import { join as join72 } from "path";
|
|
99562
|
+
var PROJECT_CONFIG_DIR = join72(process.cwd(), ".opencode");
|
|
99449
99563
|
function loadOmoConfig() {
|
|
99450
99564
|
const projectDetected = detectPluginConfigFile(PROJECT_CONFIG_DIR, {
|
|
99451
99565
|
basenames: [CONFIG_BASENAME],
|
|
@@ -99483,7 +99597,7 @@ function loadOmoConfig() {
|
|
|
99483
99597
|
|
|
99484
99598
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-details.ts
|
|
99485
99599
|
init_shared();
|
|
99486
|
-
import { join as
|
|
99600
|
+
import { join as join73 } from "path";
|
|
99487
99601
|
|
|
99488
99602
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-variant.ts
|
|
99489
99603
|
function formatModelWithVariant(model, variant) {
|
|
@@ -99525,7 +99639,7 @@ function formatCapabilityResolutionLabel(mode) {
|
|
|
99525
99639
|
}
|
|
99526
99640
|
function buildModelResolutionDetails(options) {
|
|
99527
99641
|
const details = [];
|
|
99528
|
-
const cacheFile =
|
|
99642
|
+
const cacheFile = join73(getOpenCodeCacheDir(), "models.json");
|
|
99529
99643
|
details.push("\u2550\u2550\u2550 Available Models (from cache) \u2550\u2550\u2550");
|
|
99530
99644
|
details.push("");
|
|
99531
99645
|
if (options.available.cacheExists) {
|
|
@@ -99804,25 +99918,25 @@ init_src();
|
|
|
99804
99918
|
import { existsSync as existsSync54 } from "fs";
|
|
99805
99919
|
import { createRequire as createRequire3 } from "module";
|
|
99806
99920
|
import { homedir as homedir18 } from "os";
|
|
99807
|
-
import { dirname as
|
|
99921
|
+
import { dirname as dirname28, join as join75 } from "path";
|
|
99808
99922
|
|
|
99809
99923
|
// packages/omo-opencode/src/hooks/comment-checker/downloader.ts
|
|
99810
|
-
import { join as
|
|
99924
|
+
import { join as join74 } from "path";
|
|
99811
99925
|
import { homedir as homedir17, tmpdir as tmpdir3 } from "os";
|
|
99812
99926
|
init_binary_downloader();
|
|
99813
99927
|
init_logger2();
|
|
99814
99928
|
init_plugin_identity();
|
|
99815
99929
|
var DEBUG = process.env.COMMENT_CHECKER_DEBUG === "1";
|
|
99816
|
-
var DEBUG_FILE =
|
|
99930
|
+
var DEBUG_FILE = join74(tmpdir3(), "comment-checker-debug.log");
|
|
99817
99931
|
function getCacheDir2() {
|
|
99818
99932
|
if (process.platform === "win32") {
|
|
99819
99933
|
const localAppData = process.env.LOCALAPPDATA || process.env.APPDATA;
|
|
99820
|
-
const base2 = localAppData ||
|
|
99821
|
-
return
|
|
99934
|
+
const base2 = localAppData || join74(homedir17(), "AppData", "Local");
|
|
99935
|
+
return join74(base2, CACHE_DIR_NAME, "bin");
|
|
99822
99936
|
}
|
|
99823
99937
|
const xdgCache = process.env.XDG_CACHE_HOME;
|
|
99824
|
-
const base = xdgCache ||
|
|
99825
|
-
return
|
|
99938
|
+
const base = xdgCache || join74(homedir17(), ".cache");
|
|
99939
|
+
return join74(base, CACHE_DIR_NAME, "bin");
|
|
99826
99940
|
}
|
|
99827
99941
|
function getBinaryName() {
|
|
99828
99942
|
return process.platform === "win32" ? "comment-checker.exe" : "comment-checker";
|
|
@@ -99872,7 +99986,7 @@ async function getBinaryVersion(binary) {
|
|
|
99872
99986
|
}
|
|
99873
99987
|
}
|
|
99874
99988
|
async function checkAstGrepCli() {
|
|
99875
|
-
const runtimeDir = astGrepRuntimeDir(
|
|
99989
|
+
const runtimeDir = astGrepRuntimeDir(join75(homedir18(), ".omo"));
|
|
99876
99990
|
const sgPath = findSgBinarySync({ runtimeDir });
|
|
99877
99991
|
if (sgPath === null) {
|
|
99878
99992
|
return {
|
|
@@ -99901,11 +100015,11 @@ function findCommentCheckerPackageBinary(baseDirOverride, resolvePackageJsonPath
|
|
|
99901
100015
|
const binaryName = process.platform === "win32" ? "comment-checker.exe" : "comment-checker";
|
|
99902
100016
|
const platformKey = `${process.platform}-${process.arch === "x64" ? "x64" : process.arch}`;
|
|
99903
100017
|
try {
|
|
99904
|
-
const packageDir = baseDirOverride ??
|
|
99905
|
-
const vendorPath =
|
|
100018
|
+
const packageDir = baseDirOverride ?? dirname28(resolvePackageJsonPath());
|
|
100019
|
+
const vendorPath = join75(packageDir, "vendor", platformKey, binaryName);
|
|
99906
100020
|
if (existsSync54(vendorPath))
|
|
99907
100021
|
return vendorPath;
|
|
99908
|
-
const binPath =
|
|
100022
|
+
const binPath = join75(packageDir, "bin", binaryName);
|
|
99909
100023
|
if (existsSync54(binPath))
|
|
99910
100024
|
return binPath;
|
|
99911
100025
|
} catch (error51) {
|
|
@@ -100051,11 +100165,11 @@ async function getGhCliInfo(dependencies = {}) {
|
|
|
100051
100165
|
|
|
100052
100166
|
// packages/omo-opencode/src/cli/doctor/checks/tools-lsp.ts
|
|
100053
100167
|
import { readFileSync as readFileSync37 } from "fs";
|
|
100054
|
-
import { join as
|
|
100168
|
+
import { join as join76 } from "path";
|
|
100055
100169
|
|
|
100056
100170
|
// packages/omo-opencode/src/mcp/lsp.ts
|
|
100057
100171
|
import { existsSync as existsSync55 } from "fs";
|
|
100058
|
-
import { delimiter as delimiter3, dirname as
|
|
100172
|
+
import { delimiter as delimiter3, dirname as dirname29, resolve as resolve20 } from "path";
|
|
100059
100173
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
100060
100174
|
|
|
100061
100175
|
// packages/omo-opencode/src/mcp/cli-suffix.ts
|
|
@@ -100102,7 +100216,7 @@ function resolveRuntimeExecutable(commandName, options = {}) {
|
|
|
100102
100216
|
}
|
|
100103
100217
|
|
|
100104
100218
|
// packages/omo-opencode/src/mcp/shared/ancestor-cli-resolver.ts
|
|
100105
|
-
import { resolve as
|
|
100219
|
+
import { resolve as resolve19 } from "path";
|
|
100106
100220
|
function resolveJavaScriptRuntime(resolveExecutable) {
|
|
100107
100221
|
const node = resolveExecutable("node");
|
|
100108
100222
|
return node.available ? node : resolveExecutable("bun");
|
|
@@ -100110,9 +100224,9 @@ function resolveJavaScriptRuntime(resolveExecutable) {
|
|
|
100110
100224
|
function createAncestorCliCandidates(options) {
|
|
100111
100225
|
const candidates = [];
|
|
100112
100226
|
const seenPaths = new Set;
|
|
100113
|
-
let currentDirectory =
|
|
100227
|
+
let currentDirectory = resolve19(options.startDirectory);
|
|
100114
100228
|
while (true) {
|
|
100115
|
-
const distCliPath =
|
|
100229
|
+
const distCliPath = resolve19(currentDirectory, options.packageRel, options.distCliRel);
|
|
100116
100230
|
if (!seenPaths.has(distCliPath)) {
|
|
100117
100231
|
const runtime5 = resolveJavaScriptRuntime(options.resolveExecutable);
|
|
100118
100232
|
seenPaths.add(distCliPath);
|
|
@@ -100124,7 +100238,7 @@ function createAncestorCliCandidates(options) {
|
|
|
100124
100238
|
runtimeAvailable: runtime5.available
|
|
100125
100239
|
});
|
|
100126
100240
|
}
|
|
100127
|
-
const sourceCliPath =
|
|
100241
|
+
const sourceCliPath = resolve19(currentDirectory, options.packageRel, options.sourceCliRel);
|
|
100128
100242
|
if (!seenPaths.has(sourceCliPath)) {
|
|
100129
100243
|
const runtime5 = options.resolveExecutable("bun");
|
|
100130
100244
|
const sourceCandidateAvailable = options.isSourceCandidateAvailable?.({
|
|
@@ -100141,7 +100255,7 @@ function createAncestorCliCandidates(options) {
|
|
|
100141
100255
|
runtimeAvailable: runtime5.available
|
|
100142
100256
|
});
|
|
100143
100257
|
}
|
|
100144
|
-
const parentDirectory =
|
|
100258
|
+
const parentDirectory = resolve19(currentDirectory, "..");
|
|
100145
100259
|
if (parentDirectory === currentDirectory)
|
|
100146
100260
|
return candidates;
|
|
100147
100261
|
currentDirectory = parentDirectory;
|
|
@@ -100177,7 +100291,7 @@ var LSP_BOOTSTRAP_SCRIPT = [
|
|
|
100177
100291
|
].join(";");
|
|
100178
100292
|
function getModuleDirectory(moduleUrl) {
|
|
100179
100293
|
try {
|
|
100180
|
-
return
|
|
100294
|
+
return dirname29(fileURLToPath6(moduleUrl));
|
|
100181
100295
|
} catch (error51) {
|
|
100182
100296
|
if (!(error51 instanceof Error))
|
|
100183
100297
|
throw error51;
|
|
@@ -100185,17 +100299,17 @@ function getModuleDirectory(moduleUrl) {
|
|
|
100185
100299
|
}
|
|
100186
100300
|
}
|
|
100187
100301
|
function findBootstrapRoot(candidates, pathExists) {
|
|
100188
|
-
return candidates.find((candidate) => pathExists(
|
|
100302
|
+
return candidates.find((candidate) => pathExists(resolve20(candidate.root, "package.json")))?.root ?? process.cwd();
|
|
100189
100303
|
}
|
|
100190
100304
|
function createBootstrapCandidate(root, pathExists, resolveExecutable) {
|
|
100191
100305
|
const runtime5 = resolveJavaScriptRuntime(resolveExecutable);
|
|
100192
100306
|
const bun = resolveExecutable("bun");
|
|
100193
100307
|
const npm = resolveExecutable("npm");
|
|
100194
|
-
const packageManifestPath =
|
|
100308
|
+
const packageManifestPath = resolve20(root, PACKAGE_REL, "package.json");
|
|
100195
100309
|
return {
|
|
100196
100310
|
command: [runtime5.command, "-e", LSP_BOOTSTRAP_SCRIPT, root, npm.command, bun.command],
|
|
100197
100311
|
root,
|
|
100198
|
-
path:
|
|
100312
|
+
path: resolve20(root, PACKAGE_REL, DIST_CLI_REL),
|
|
100199
100313
|
exists: runtime5.available && npm.available && pathExists(packageManifestPath),
|
|
100200
100314
|
runtimeAvailable: runtime5.available
|
|
100201
100315
|
};
|
|
@@ -100211,7 +100325,7 @@ function resolveLspCommand(options = {}) {
|
|
|
100211
100325
|
sourceCliRel: SOURCE_CLI_REL,
|
|
100212
100326
|
pathExists,
|
|
100213
100327
|
resolveExecutable,
|
|
100214
|
-
isSourceCandidateAvailable: ({ root }) => pathExists(
|
|
100328
|
+
isSourceCandidateAvailable: ({ root }) => pathExists(resolve20(root, LSP_TOOLS_PACKAGE_REL, DIST_CLI_REL))
|
|
100215
100329
|
}) : [];
|
|
100216
100330
|
const distCandidate = candidates.find((candidate) => hasCliSuffix(candidate.path, DIST_CLI_REL) && candidate.exists);
|
|
100217
100331
|
if (distCandidate) {
|
|
@@ -100258,7 +100372,7 @@ function readOmoConfig(configDirectory) {
|
|
|
100258
100372
|
}
|
|
100259
100373
|
function isLspMcpDisabled(options) {
|
|
100260
100374
|
const userConfigDirectory = options.configDirectory ?? getOpenCodeConfigDir({ binary: "opencode" });
|
|
100261
|
-
const projectConfigDirectory =
|
|
100375
|
+
const projectConfigDirectory = join76(options.cwd ?? process.cwd(), ".opencode");
|
|
100262
100376
|
const userConfig = readOmoConfig(userConfigDirectory);
|
|
100263
100377
|
const projectConfig = readOmoConfig(projectConfigDirectory);
|
|
100264
100378
|
const disabledMcps = new Set([
|
|
@@ -100279,13 +100393,13 @@ function getInstalledLspServers(options = {}) {
|
|
|
100279
100393
|
init_shared();
|
|
100280
100394
|
import { existsSync as existsSync56, readFileSync as readFileSync38 } from "fs";
|
|
100281
100395
|
import { homedir as homedir19 } from "os";
|
|
100282
|
-
import { join as
|
|
100396
|
+
import { join as join77 } from "path";
|
|
100283
100397
|
var BUILTIN_MCP_SERVERS = ["websearch", "context7", "grep_app", "lsp"];
|
|
100284
100398
|
function getMcpConfigPaths() {
|
|
100285
100399
|
return [
|
|
100286
|
-
|
|
100287
|
-
|
|
100288
|
-
|
|
100400
|
+
join77(homedir19(), ".claude", ".mcp.json"),
|
|
100401
|
+
join77(process.cwd(), ".mcp.json"),
|
|
100402
|
+
join77(process.cwd(), ".claude", ".mcp.json")
|
|
100289
100403
|
];
|
|
100290
100404
|
}
|
|
100291
100405
|
function loadUserMcpConfig() {
|
|
@@ -100585,9 +100699,9 @@ async function pathExists(dir) {
|
|
|
100585
100699
|
// packages/omo-opencode/src/cli/doctor/checks/codex.ts
|
|
100586
100700
|
init_src();
|
|
100587
100701
|
import { existsSync as existsSync58 } from "fs";
|
|
100588
|
-
import { lstat as
|
|
100702
|
+
import { lstat as lstat12, readdir as readdir10, readFile as readFile21 } from "fs/promises";
|
|
100589
100703
|
import { homedir as homedir21 } from "os";
|
|
100590
|
-
import { basename as basename13, join as
|
|
100704
|
+
import { basename as basename13, join as join78, resolve as resolve21 } from "path";
|
|
100591
100705
|
// packages/omo-opencode/package.json
|
|
100592
100706
|
var package_default3 = {
|
|
100593
100707
|
name: "@oh-my-opencode/omo-opencode",
|
|
@@ -100645,13 +100759,13 @@ var CODEX_BIN_NAMES = [
|
|
|
100645
100759
|
"omo-git-bash-hook"
|
|
100646
100760
|
];
|
|
100647
100761
|
async function gatherCodexSummary(deps = {}) {
|
|
100648
|
-
const codexHome =
|
|
100762
|
+
const codexHome = resolve21(deps.codexHome ?? process.env.CODEX_HOME ?? join78(homedir21(), ".codex"));
|
|
100649
100763
|
const binDir = resolveCodexInstallerBinDir({ binDir: deps.binDir, codexHome, env: process.env });
|
|
100650
100764
|
const detection = await (deps.detectCodexInstallation ?? detectCodexInstallation)();
|
|
100651
100765
|
const pluginRoot = await resolveInstalledPluginRoot(codexHome);
|
|
100652
|
-
const manifest = pluginRoot === null ? null : await readJson(
|
|
100653
|
-
const installSnapshot = pluginRoot === null ? null : await readJson(
|
|
100654
|
-
const configPath =
|
|
100766
|
+
const manifest = pluginRoot === null ? null : await readJson(join78(pluginRoot, ".codex-plugin", "plugin.json"));
|
|
100767
|
+
const installSnapshot = pluginRoot === null ? null : await readJson(join78(pluginRoot, "lazycodex-install.json"));
|
|
100768
|
+
const configPath = join78(codexHome, "config.toml");
|
|
100655
100769
|
const pluginVersion = stringField(manifest, "version");
|
|
100656
100770
|
return {
|
|
100657
100771
|
codexPath: detection.found && "path" in detection ? detection.path : null,
|
|
@@ -100708,7 +100822,7 @@ function buildCodexIssues(summary) {
|
|
|
100708
100822
|
if (summary.pluginRoot === null) {
|
|
100709
100823
|
issues.push({
|
|
100710
100824
|
title: "OMO Codex plugin is not installed",
|
|
100711
|
-
description: `Expected cached plugin at ${
|
|
100825
|
+
description: `Expected cached plugin at ${join78("plugins", "cache", MARKETPLACE_NAME, PLUGIN_NAME2, DEFAULT_PLUGIN_VERSION)} under CODEX_HOME.`,
|
|
100712
100826
|
fix: "Run: npx lazycodex-ai install",
|
|
100713
100827
|
severity: "error",
|
|
100714
100828
|
affects: ["plugin loading"]
|
|
@@ -100773,12 +100887,12 @@ function buildCodexIssues(summary) {
|
|
|
100773
100887
|
return issues;
|
|
100774
100888
|
}
|
|
100775
100889
|
async function resolveInstalledPluginRoot(codexHome) {
|
|
100776
|
-
const pluginRoot =
|
|
100890
|
+
const pluginRoot = join78(codexHome, "plugins", "cache", MARKETPLACE_NAME, PLUGIN_NAME2);
|
|
100777
100891
|
if (!existsSync58(pluginRoot))
|
|
100778
100892
|
return null;
|
|
100779
|
-
const versions2 = await
|
|
100893
|
+
const versions2 = await readdir10(pluginRoot, { withFileTypes: true });
|
|
100780
100894
|
const candidates = versions2.filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort(compareVersionsDescending);
|
|
100781
|
-
return candidates.length === 0 ? null :
|
|
100895
|
+
return candidates.length === 0 ? null : join78(pluginRoot, candidates[0] ?? DEFAULT_PLUGIN_VERSION);
|
|
100782
100896
|
}
|
|
100783
100897
|
async function readCodexConfigSummary(configPath) {
|
|
100784
100898
|
if (!existsSync58(configPath)) {
|
|
@@ -100792,7 +100906,7 @@ async function readCodexConfigSummary(configPath) {
|
|
|
100792
100906
|
companionLifecycleHookStateEvents: []
|
|
100793
100907
|
};
|
|
100794
100908
|
}
|
|
100795
|
-
const content = await
|
|
100909
|
+
const content = await readFile21(configPath, "utf8");
|
|
100796
100910
|
return {
|
|
100797
100911
|
exists: true,
|
|
100798
100912
|
marketplaceConfigured: content.includes("[marketplaces.sisyphuslabs]"),
|
|
@@ -100806,21 +100920,21 @@ async function readCodexConfigSummary(configPath) {
|
|
|
100806
100920
|
async function readLinkedBins(binDir) {
|
|
100807
100921
|
const linked = [];
|
|
100808
100922
|
for (const name of CODEX_BIN_NAMES) {
|
|
100809
|
-
if (await pathExists2(
|
|
100923
|
+
if (await pathExists2(join78(binDir, process.platform === "win32" ? `${name}.cmd` : name)))
|
|
100810
100924
|
linked.push(name);
|
|
100811
100925
|
}
|
|
100812
100926
|
return linked;
|
|
100813
100927
|
}
|
|
100814
100928
|
async function readLinkedAgents(codexHome) {
|
|
100815
|
-
const agentsDir =
|
|
100929
|
+
const agentsDir = join78(codexHome, "agents");
|
|
100816
100930
|
if (!existsSync58(agentsDir))
|
|
100817
100931
|
return [];
|
|
100818
|
-
const entries = await
|
|
100932
|
+
const entries = await readdir10(agentsDir, { withFileTypes: true });
|
|
100819
100933
|
return entries.filter((entry) => entry.isFile() || entry.isSymbolicLink()).map((entry) => basename13(entry.name, ".toml")).sort();
|
|
100820
100934
|
}
|
|
100821
100935
|
async function readJson(path16) {
|
|
100822
100936
|
try {
|
|
100823
|
-
const parsed = JSON.parse(await
|
|
100937
|
+
const parsed = JSON.parse(await readFile21(path16, "utf8"));
|
|
100824
100938
|
return isPlainRecord(parsed) ? parsed : null;
|
|
100825
100939
|
} catch (error51) {
|
|
100826
100940
|
if (error51 instanceof Error)
|
|
@@ -100915,7 +101029,7 @@ function compareVersionsDescending(left, right) {
|
|
|
100915
101029
|
}
|
|
100916
101030
|
async function pathExists2(path16) {
|
|
100917
101031
|
try {
|
|
100918
|
-
await
|
|
101032
|
+
await lstat12(path16);
|
|
100919
101033
|
return true;
|
|
100920
101034
|
} catch (error51) {
|
|
100921
101035
|
if (error51 instanceof Error)
|
|
@@ -100926,9 +101040,9 @@ async function pathExists2(path16) {
|
|
|
100926
101040
|
|
|
100927
101041
|
// packages/omo-opencode/src/cli/doctor/checks/codex-components.ts
|
|
100928
101042
|
init_src();
|
|
100929
|
-
import { readdir as
|
|
101043
|
+
import { readdir as readdir11, readFile as readFile22, stat as stat6 } from "fs/promises";
|
|
100930
101044
|
import { homedir as homedir22 } from "os";
|
|
100931
|
-
import { dirname as
|
|
101045
|
+
import { dirname as dirname30, isAbsolute as isAbsolute12, join as join79, relative as relative10, resolve as resolve22, sep as sep9 } from "path";
|
|
100932
101046
|
var CODEX_COMPONENTS_CHECK_ID = "codex-components";
|
|
100933
101047
|
var CODEX_COMPONENTS_CHECK_NAME = "codex-components";
|
|
100934
101048
|
var PLUGIN_DATA_DIR_NAME = "omo-sisyphuslabs";
|
|
@@ -100938,7 +101052,7 @@ async function checkCodexComponents(deps = {}) {
|
|
|
100938
101052
|
const env3 = deps.env ?? process.env;
|
|
100939
101053
|
const platform = deps.platform ?? process.platform;
|
|
100940
101054
|
const arch = deps.arch ?? process.arch;
|
|
100941
|
-
const codexHome =
|
|
101055
|
+
const codexHome = resolve22(deps.codexHome ?? env3["CODEX_HOME"] ?? join79(homedir22(), ".codex"));
|
|
100942
101056
|
const summary = await gatherCodexSummary({ ...deps, codexHome });
|
|
100943
101057
|
if (summary.pluginRoot === null) {
|
|
100944
101058
|
return {
|
|
@@ -100963,7 +101077,7 @@ async function checkCodexComponents(deps = {}) {
|
|
|
100963
101077
|
});
|
|
100964
101078
|
}
|
|
100965
101079
|
const runtimeSgDir = runtimeSgDirectory(codexHome, platform, arch);
|
|
100966
|
-
const runtimeSgPath =
|
|
101080
|
+
const runtimeSgPath = join79(runtimeSgDir, sgBinaryName(platform));
|
|
100967
101081
|
const sg = findSgBinarySync({
|
|
100968
101082
|
arch,
|
|
100969
101083
|
env: env3,
|
|
@@ -101002,8 +101116,8 @@ async function auditBundleTargets(pluginRoot) {
|
|
|
101002
101116
|
const manifest = await readJson2(manifestPath);
|
|
101003
101117
|
if (manifest === null || !isRecord5(manifest["mcpServers"]))
|
|
101004
101118
|
continue;
|
|
101005
|
-
const manifestRoot =
|
|
101006
|
-
const isRootManifest =
|
|
101119
|
+
const manifestRoot = dirname30(manifestPath);
|
|
101120
|
+
const isRootManifest = resolve22(manifestRoot) === resolve22(pluginRoot);
|
|
101007
101121
|
for (const server2 of Object.values(manifest["mcpServers"])) {
|
|
101008
101122
|
if (!isRecord5(server2) || !Array.isArray(server2["args"]))
|
|
101009
101123
|
continue;
|
|
@@ -101023,7 +101137,7 @@ async function auditBundleTargets(pluginRoot) {
|
|
|
101023
101137
|
continue;
|
|
101024
101138
|
const commands2 = [];
|
|
101025
101139
|
collectHookCommands(manifest, commands2);
|
|
101026
|
-
const hookPluginRoot =
|
|
101140
|
+
const hookPluginRoot = dirname30(dirname30(hookManifestPath));
|
|
101027
101141
|
for (const command of commands2) {
|
|
101028
101142
|
for (const relativePath of extractPluginRootPaths(command)) {
|
|
101029
101143
|
referencedCount += 1;
|
|
@@ -101045,8 +101159,8 @@ function recordBrokenTarget(broken, classified, origin) {
|
|
|
101045
101159
|
broken.push(entry);
|
|
101046
101160
|
}
|
|
101047
101161
|
async function classifyBundleTarget(bundleRoot, baseRoot, relativePath, allowEscape) {
|
|
101048
|
-
const targetPath =
|
|
101049
|
-
const bundleRootPath =
|
|
101162
|
+
const targetPath = resolve22(baseRoot, relativePath);
|
|
101163
|
+
const bundleRootPath = resolve22(bundleRoot);
|
|
101050
101164
|
const bundleRootPrefix = bundleRootPath.endsWith(sep9) ? bundleRootPath : `${bundleRootPath}${sep9}`;
|
|
101051
101165
|
if (targetPath !== bundleRootPath && !targetPath.startsWith(bundleRootPrefix)) {
|
|
101052
101166
|
if (allowEscape)
|
|
@@ -101062,12 +101176,12 @@ async function classifyBundleTarget(bundleRoot, baseRoot, relativePath, allowEsc
|
|
|
101062
101176
|
}
|
|
101063
101177
|
async function findHookManifestPaths(root) {
|
|
101064
101178
|
const paths2 = await findManifestPaths(root, "hooks.json");
|
|
101065
|
-
return paths2.filter((path16) =>
|
|
101179
|
+
return paths2.filter((path16) => dirname30(path16).endsWith(`${sep9}hooks`));
|
|
101066
101180
|
}
|
|
101067
101181
|
async function findManifestPaths(root, manifestName) {
|
|
101068
101182
|
let entries;
|
|
101069
101183
|
try {
|
|
101070
|
-
entries = await
|
|
101184
|
+
entries = await readdir11(root, { withFileTypes: true });
|
|
101071
101185
|
} catch {
|
|
101072
101186
|
return [];
|
|
101073
101187
|
}
|
|
@@ -101075,7 +101189,7 @@ async function findManifestPaths(root, manifestName) {
|
|
|
101075
101189
|
for (const entry of entries) {
|
|
101076
101190
|
if (entry.name === "node_modules" || entry.name === ".git")
|
|
101077
101191
|
continue;
|
|
101078
|
-
const entryPath =
|
|
101192
|
+
const entryPath = join79(root, entry.name);
|
|
101079
101193
|
if (entry.isDirectory()) {
|
|
101080
101194
|
paths2.push(...await findManifestPaths(entryPath, manifestName));
|
|
101081
101195
|
continue;
|
|
@@ -101116,21 +101230,21 @@ function extractPluginRootPaths(command) {
|
|
|
101116
101230
|
}
|
|
101117
101231
|
function isPluginRuntimePathArg(arg) {
|
|
101118
101232
|
const normalized = normalizePathSeparators(arg);
|
|
101119
|
-
return normalized.endsWith(".js") && normalized.includes("/dist/") && (normalized.startsWith("./") || normalized.startsWith("../") || normalized.startsWith("components/") || normalized.startsWith("/") ||
|
|
101233
|
+
return normalized.endsWith(".js") && normalized.includes("/dist/") && (normalized.startsWith("./") || normalized.startsWith("../") || normalized.startsWith("components/") || normalized.startsWith("/") || isAbsolute12(arg));
|
|
101120
101234
|
}
|
|
101121
101235
|
function runtimeSgDirectory(codexHome, platform, arch) {
|
|
101122
|
-
return
|
|
101236
|
+
return join79(codexHome, "runtime", "ast-grep", runtimeSlug(platform, arch));
|
|
101123
101237
|
}
|
|
101124
101238
|
function describeSgSource(sgPath, env3, runtimeSgDir, platform) {
|
|
101125
101239
|
const override = env3[SG_PATH_ENV_KEY]?.trim();
|
|
101126
101240
|
if (override !== undefined && override.length > 0 && sgPath === override)
|
|
101127
101241
|
return `env override ${SG_PATH_ENV_KEY}`;
|
|
101128
|
-
if (sgPath ===
|
|
101242
|
+
if (sgPath === join79(runtimeSgDir, sgBinaryName(platform)))
|
|
101129
101243
|
return "runtime dir";
|
|
101130
101244
|
return "PATH";
|
|
101131
101245
|
}
|
|
101132
101246
|
async function readBootstrapStateSummary(codexHome) {
|
|
101133
|
-
const statePath =
|
|
101247
|
+
const statePath = join79(codexHome, "plugins", "data", PLUGIN_DATA_DIR_NAME, "bootstrap", "state.json");
|
|
101134
101248
|
const raw = await readJson2(statePath);
|
|
101135
101249
|
if (raw === null)
|
|
101136
101250
|
return null;
|
|
@@ -101179,7 +101293,7 @@ function degradedDetailLines(entries) {
|
|
|
101179
101293
|
}
|
|
101180
101294
|
async function readJson2(path16) {
|
|
101181
101295
|
try {
|
|
101182
|
-
const parsed = JSON.parse(await
|
|
101296
|
+
const parsed = JSON.parse(await readFile22(path16, "utf8"));
|
|
101183
101297
|
return isRecord5(parsed) ? parsed : null;
|
|
101184
101298
|
} catch (error51) {
|
|
101185
101299
|
if (error51 instanceof Error)
|
|
@@ -101189,7 +101303,7 @@ async function readJson2(path16) {
|
|
|
101189
101303
|
}
|
|
101190
101304
|
async function fileSize(path16) {
|
|
101191
101305
|
try {
|
|
101192
|
-
const stats = await
|
|
101306
|
+
const stats = await stat6(path16);
|
|
101193
101307
|
return stats.isFile() ? stats.size : undefined;
|
|
101194
101308
|
} catch {
|
|
101195
101309
|
return;
|
|
@@ -101207,17 +101321,17 @@ function isRecord5(value) {
|
|
|
101207
101321
|
|
|
101208
101322
|
// packages/omo-opencode/src/cli/doctor/checks/codex-runtime-wrapper.ts
|
|
101209
101323
|
import { existsSync as existsSync59 } from "fs";
|
|
101210
|
-
import { readFile as
|
|
101324
|
+
import { readFile as readFile23 } from "fs/promises";
|
|
101211
101325
|
import { homedir as homedir23 } from "os";
|
|
101212
|
-
import { join as
|
|
101326
|
+
import { join as join80, resolve as resolve23 } from "path";
|
|
101213
101327
|
var RUNTIME_WRAPPER_MARKER2 = "OMO_GENERATED_RUNTIME_WRAPPER";
|
|
101214
101328
|
var CHECK_NAME = "codex-runtime-wrapper";
|
|
101215
101329
|
var REINSTALL_COMMAND = "npx --yes lazycodex-ai@latest install --no-tui";
|
|
101216
101330
|
async function checkCodexRuntimeWrapper(deps = {}) {
|
|
101217
|
-
const codexHome =
|
|
101331
|
+
const codexHome = resolve23(deps.codexHome ?? process.env.CODEX_HOME ?? join80(homedir23(), ".codex"));
|
|
101218
101332
|
const binDir = resolveCodexInstallerBinDir({ binDir: deps.binDir, codexHome, env: process.env });
|
|
101219
101333
|
const platform = deps.platform ?? process.platform;
|
|
101220
|
-
const wrapperPath =
|
|
101334
|
+
const wrapperPath = join80(binDir, platform === "win32" ? "omo.cmd" : "omo");
|
|
101221
101335
|
const wrapper = await readRuntimeWrapper(wrapperPath);
|
|
101222
101336
|
const issues = [];
|
|
101223
101337
|
if (wrapper?.includes(RUNTIME_WRAPPER_MARKER2) === true) {
|
|
@@ -101242,7 +101356,7 @@ async function checkCodexRuntimeWrapper(deps = {}) {
|
|
|
101242
101356
|
}
|
|
101243
101357
|
async function readRuntimeWrapper(path16) {
|
|
101244
101358
|
try {
|
|
101245
|
-
return await
|
|
101359
|
+
return await readFile23(path16, "utf8");
|
|
101246
101360
|
} catch (error51) {
|
|
101247
101361
|
if (error51 instanceof Error)
|
|
101248
101362
|
return null;
|
|
@@ -101729,14 +101843,14 @@ import {
|
|
|
101729
101843
|
unlinkSync as unlinkSync8,
|
|
101730
101844
|
writeFileSync as writeFileSync11
|
|
101731
101845
|
} from "fs";
|
|
101732
|
-
import { basename as basename14, dirname as
|
|
101846
|
+
import { basename as basename14, dirname as dirname31, join as join83 } from "path";
|
|
101733
101847
|
|
|
101734
101848
|
// packages/mcp-client-core/src/config-dir.ts
|
|
101735
101849
|
import { existsSync as existsSync60, realpathSync as realpathSync8 } from "fs";
|
|
101736
101850
|
import { homedir as homedir24 } from "os";
|
|
101737
|
-
import { join as
|
|
101851
|
+
import { join as join81, resolve as resolve24 } from "path";
|
|
101738
101852
|
function resolveConfigPath2(pathValue) {
|
|
101739
|
-
const resolvedPath =
|
|
101853
|
+
const resolvedPath = resolve24(pathValue);
|
|
101740
101854
|
if (!existsSync60(resolvedPath))
|
|
101741
101855
|
return resolvedPath;
|
|
101742
101856
|
try {
|
|
@@ -101752,13 +101866,13 @@ function getOpenCodeCliConfigDir(env3 = process.env) {
|
|
|
101752
101866
|
if (customConfigDir) {
|
|
101753
101867
|
return resolveConfigPath2(customConfigDir);
|
|
101754
101868
|
}
|
|
101755
|
-
const xdgConfigDir = env3["XDG_CONFIG_HOME"]?.trim() ||
|
|
101756
|
-
return resolveConfigPath2(
|
|
101869
|
+
const xdgConfigDir = env3["XDG_CONFIG_HOME"]?.trim() || join81(homedir24(), ".config");
|
|
101870
|
+
return resolveConfigPath2(join81(xdgConfigDir, "opencode"));
|
|
101757
101871
|
}
|
|
101758
101872
|
|
|
101759
101873
|
// packages/mcp-client-core/src/mcp-oauth/storage-index.ts
|
|
101760
101874
|
import { chmodSync as chmodSync3, existsSync as existsSync61, readFileSync as readFileSync41, renameSync as renameSync6, writeFileSync as writeFileSync10 } from "fs";
|
|
101761
|
-
import { join as
|
|
101875
|
+
import { join as join82 } from "path";
|
|
101762
101876
|
var INDEX_FILE_NAME = "index.json";
|
|
101763
101877
|
function isTokenIndex(value) {
|
|
101764
101878
|
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
@@ -101766,7 +101880,7 @@ function isTokenIndex(value) {
|
|
|
101766
101880
|
return Object.values(value).every((entry) => typeof entry === "string");
|
|
101767
101881
|
}
|
|
101768
101882
|
function getIndexPath(storageDir) {
|
|
101769
|
-
return
|
|
101883
|
+
return join82(storageDir, INDEX_FILE_NAME);
|
|
101770
101884
|
}
|
|
101771
101885
|
function readTokenIndex(storageDir) {
|
|
101772
101886
|
const indexPath = getIndexPath(storageDir);
|
|
@@ -101810,16 +101924,16 @@ function deleteTokenIndexEntry(storageDir, hash2) {
|
|
|
101810
101924
|
var STORAGE_DIR_NAME = "mcp-oauth";
|
|
101811
101925
|
var LEGACY_STORAGE_FILE_NAME = "mcp-oauth.json";
|
|
101812
101926
|
function getMcpOauthStorageDir() {
|
|
101813
|
-
return
|
|
101927
|
+
return join83(getOpenCodeCliConfigDir(), STORAGE_DIR_NAME);
|
|
101814
101928
|
}
|
|
101815
101929
|
function getMcpOauthServerHash(serverHost, resource) {
|
|
101816
101930
|
return createHash4("sha256").update(buildKey(serverHost, resource)).digest("hex").slice(0, 32);
|
|
101817
101931
|
}
|
|
101818
101932
|
function getMcpOauthStoragePath(serverHost, resource) {
|
|
101819
|
-
return
|
|
101933
|
+
return join83(getMcpOauthStorageDir(), `${getMcpOauthServerHash(serverHost, resource)}.json`);
|
|
101820
101934
|
}
|
|
101821
101935
|
function getLegacyStoragePath() {
|
|
101822
|
-
return
|
|
101936
|
+
return join83(getOpenCodeCliConfigDir(), LEGACY_STORAGE_FILE_NAME);
|
|
101823
101937
|
}
|
|
101824
101938
|
function normalizeHost2(serverHost) {
|
|
101825
101939
|
let host = serverHost.trim();
|
|
@@ -101913,7 +102027,7 @@ function readLegacyStore() {
|
|
|
101913
102027
|
}
|
|
101914
102028
|
function writeTokenFile(filePath, token) {
|
|
101915
102029
|
try {
|
|
101916
|
-
const dir =
|
|
102030
|
+
const dir = dirname31(filePath);
|
|
101917
102031
|
if (!existsSync62(dir)) {
|
|
101918
102032
|
mkdirSync14(dir, { recursive: true });
|
|
101919
102033
|
}
|
|
@@ -101998,7 +102112,7 @@ function listTokensByHost(serverHost) {
|
|
|
101998
102112
|
for (const [hash2, indexedKey] of Object.entries(index)) {
|
|
101999
102113
|
if (!indexedKey.startsWith(prefix))
|
|
102000
102114
|
continue;
|
|
102001
|
-
const indexedToken = readTokenFile(
|
|
102115
|
+
const indexedToken = readTokenFile(join83(getMcpOauthStorageDir(), `${hash2}.json`));
|
|
102002
102116
|
if (indexedToken)
|
|
102003
102117
|
result[indexedKey] = indexedToken;
|
|
102004
102118
|
}
|
|
@@ -102013,7 +102127,7 @@ function listAllTokens() {
|
|
|
102013
102127
|
for (const entry of readdirSync9(dir, { withFileTypes: true })) {
|
|
102014
102128
|
if (!entry.isFile() || !entry.name.endsWith(".json") || entry.name === "index.json")
|
|
102015
102129
|
continue;
|
|
102016
|
-
const token = readTokenFile(
|
|
102130
|
+
const token = readTokenFile(join83(dir, entry.name));
|
|
102017
102131
|
const hash2 = basename14(entry.name, ".json");
|
|
102018
102132
|
if (token)
|
|
102019
102133
|
result[index[hash2] ?? hash2] = token;
|
|
@@ -102213,7 +102327,7 @@ function buildAuthorizationUrl(authorizationEndpoint, options) {
|
|
|
102213
102327
|
}
|
|
102214
102328
|
var CALLBACK_TIMEOUT_MS = 5 * 60 * 1000;
|
|
102215
102329
|
function startCallbackServer(port) {
|
|
102216
|
-
return new Promise((
|
|
102330
|
+
return new Promise((resolve25, reject) => {
|
|
102217
102331
|
let timeoutId;
|
|
102218
102332
|
const server2 = createServer2((request, response) => {
|
|
102219
102333
|
clearTimeout(timeoutId);
|
|
@@ -102239,7 +102353,7 @@ function startCallbackServer(port) {
|
|
|
102239
102353
|
response.writeHead(200, { "content-type": "text/html" });
|
|
102240
102354
|
response.end("<html><body><h1>Authorization successful. You can close this tab.</h1></body></html>");
|
|
102241
102355
|
server2.close();
|
|
102242
|
-
|
|
102356
|
+
resolve25({ code, state: state2 });
|
|
102243
102357
|
});
|
|
102244
102358
|
timeoutId = setTimeout(() => {
|
|
102245
102359
|
server2.close();
|
|
@@ -102762,13 +102876,13 @@ async function codexUlwLoop(args) {
|
|
|
102762
102876
|
console.error("Codex ulw-loop is not installed. Run: npx lazycodex-ai@latest install --no-tui");
|
|
102763
102877
|
return 1;
|
|
102764
102878
|
}
|
|
102765
|
-
return new Promise((
|
|
102879
|
+
return new Promise((resolve25) => {
|
|
102766
102880
|
const child = spawn5(command.executable, [...command.argsPrefix, ...args], { stdio: "inherit" });
|
|
102767
102881
|
child.on("error", (error51) => {
|
|
102768
102882
|
console.error(error51.message);
|
|
102769
|
-
|
|
102883
|
+
resolve25(1);
|
|
102770
102884
|
});
|
|
102771
|
-
child.on("close", (code) =>
|
|
102885
|
+
child.on("close", (code) => resolve25(code ?? 1));
|
|
102772
102886
|
});
|
|
102773
102887
|
}
|
|
102774
102888
|
function resolveLocalUlwLoopBin(env3, homeDir) {
|