oh-my-opencode 4.15.0 → 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 +3 -2
- package/dist/skills/frontend/references/designpowers/EVIDENCE.md +10 -2
- package/dist/skills/frontend/references/designpowers/UPSTREAM.md +1 -1
- 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 +3 -2
- 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/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/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 +3 -2
- 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/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-node/index.js
CHANGED
|
@@ -2146,7 +2146,7 @@ var package_default;
|
|
|
2146
2146
|
var init_package = __esm(() => {
|
|
2147
2147
|
package_default = {
|
|
2148
2148
|
name: "oh-my-opencode",
|
|
2149
|
-
version: "4.15.
|
|
2149
|
+
version: "4.15.1",
|
|
2150
2150
|
description: "The Best AI Agent Harness - Batteries-Included OpenCode Plugin with Multi-Model Orchestration, Parallel Background Agents, and Crafted LSP/AST Tools",
|
|
2151
2151
|
main: "./dist/index.js",
|
|
2152
2152
|
types: "dist/index.d.ts",
|
|
@@ -2337,18 +2337,18 @@ var init_package = __esm(() => {
|
|
|
2337
2337
|
typescript: "^6.0.3"
|
|
2338
2338
|
},
|
|
2339
2339
|
optionalDependencies: {
|
|
2340
|
-
"oh-my-opencode-darwin-arm64": "4.15.
|
|
2341
|
-
"oh-my-opencode-darwin-x64": "4.15.
|
|
2342
|
-
"oh-my-opencode-darwin-x64-baseline": "4.15.
|
|
2343
|
-
"oh-my-opencode-linux-arm64": "4.15.
|
|
2344
|
-
"oh-my-opencode-linux-arm64-musl": "4.15.
|
|
2345
|
-
"oh-my-opencode-linux-x64": "4.15.
|
|
2346
|
-
"oh-my-opencode-linux-x64-baseline": "4.15.
|
|
2347
|
-
"oh-my-opencode-linux-x64-musl": "4.15.
|
|
2348
|
-
"oh-my-opencode-linux-x64-musl-baseline": "4.15.
|
|
2349
|
-
"oh-my-opencode-windows-arm64": "4.15.
|
|
2350
|
-
"oh-my-opencode-windows-x64": "4.15.
|
|
2351
|
-
"oh-my-opencode-windows-x64-baseline": "4.15.
|
|
2340
|
+
"oh-my-opencode-darwin-arm64": "4.15.1",
|
|
2341
|
+
"oh-my-opencode-darwin-x64": "4.15.1",
|
|
2342
|
+
"oh-my-opencode-darwin-x64-baseline": "4.15.1",
|
|
2343
|
+
"oh-my-opencode-linux-arm64": "4.15.1",
|
|
2344
|
+
"oh-my-opencode-linux-arm64-musl": "4.15.1",
|
|
2345
|
+
"oh-my-opencode-linux-x64": "4.15.1",
|
|
2346
|
+
"oh-my-opencode-linux-x64-baseline": "4.15.1",
|
|
2347
|
+
"oh-my-opencode-linux-x64-musl": "4.15.1",
|
|
2348
|
+
"oh-my-opencode-linux-x64-musl-baseline": "4.15.1",
|
|
2349
|
+
"oh-my-opencode-windows-arm64": "4.15.1",
|
|
2350
|
+
"oh-my-opencode-windows-x64": "4.15.1",
|
|
2351
|
+
"oh-my-opencode-windows-x64-baseline": "4.15.1"
|
|
2352
2352
|
},
|
|
2353
2353
|
overrides: {
|
|
2354
2354
|
hono: "^4.12.18",
|
|
@@ -66882,20 +66882,20 @@ var init_config_manager = __esm(() => {
|
|
|
66882
66882
|
|
|
66883
66883
|
// packages/telemetry-core/src/activity-state.ts
|
|
66884
66884
|
import { existsSync as existsSync28, mkdirSync as mkdirSync8, readFileSync as readFileSync13 } from "node:fs";
|
|
66885
|
-
import { basename as basename10, join as
|
|
66885
|
+
import { basename as basename10, join as join50 } from "node:path";
|
|
66886
66886
|
function resolveTelemetryStateDir(product, options = {}) {
|
|
66887
66887
|
const dataDir = resolveXdgDataDir(product.cacheDirName, {
|
|
66888
66888
|
env: options.env,
|
|
66889
66889
|
osProvider: options.osProvider
|
|
66890
66890
|
});
|
|
66891
|
-
const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined :
|
|
66891
|
+
const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined : join50(options.env.XDG_DATA_HOME, product.cacheDirName);
|
|
66892
66892
|
if (dataDir === xdgStateDir || xdgStateDir === undefined && basename10(dataDir) === product.cacheDirName) {
|
|
66893
66893
|
return dataDir;
|
|
66894
66894
|
}
|
|
66895
|
-
return
|
|
66895
|
+
return join50(dataDir, product.cacheDirName);
|
|
66896
66896
|
}
|
|
66897
66897
|
function getTelemetryActivityStateFilePath(stateDir) {
|
|
66898
|
-
return
|
|
66898
|
+
return join50(stateDir, POSTHOG_ACTIVITY_STATE_FILE);
|
|
66899
66899
|
}
|
|
66900
66900
|
function getDailyActiveCaptureState(input) {
|
|
66901
66901
|
const state = readPostHogActivityState(input.stateDir, input.diagnostics);
|
|
@@ -66966,9 +66966,9 @@ var DEFAULT_POSTHOG_HOST = "https://us.i.posthog.com", DEFAULT_POSTHOG_API_KEY =
|
|
|
66966
66966
|
|
|
66967
66967
|
// packages/telemetry-core/src/diagnostics.ts
|
|
66968
66968
|
import { appendFileSync as appendFileSync2, existsSync as existsSync29, mkdirSync as mkdirSync9, readFileSync as readFileSync14 } from "node:fs";
|
|
66969
|
-
import { join as
|
|
66969
|
+
import { join as join51 } from "node:path";
|
|
66970
66970
|
function getTelemetryDiagnosticsFilePath(diagnosticsDir) {
|
|
66971
|
-
return
|
|
66971
|
+
return join51(diagnosticsDir, DIAGNOSTICS_FILE_NAME);
|
|
66972
66972
|
}
|
|
66973
66973
|
function writeTelemetryDiagnostic(input, options) {
|
|
66974
66974
|
const now = options.now ?? new Date;
|
|
@@ -67134,7 +67134,7 @@ function getTelemetryDistinctId(machineIdPrefix, osProvider = getDefaultTelemetr
|
|
|
67134
67134
|
var init_machine_id = () => {};
|
|
67135
67135
|
|
|
67136
67136
|
// node_modules/.bun/posthog-node@5.35.12/node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
|
|
67137
|
-
import { dirname as
|
|
67137
|
+
import { dirname as dirname17, posix as posix2, sep as sep7 } from "path";
|
|
67138
67138
|
function createModulerModifier() {
|
|
67139
67139
|
const getModuleFromFileName = createGetModuleFromFilename();
|
|
67140
67140
|
return async (frames) => {
|
|
@@ -67143,7 +67143,7 @@ function createModulerModifier() {
|
|
|
67143
67143
|
return frames;
|
|
67144
67144
|
};
|
|
67145
67145
|
}
|
|
67146
|
-
function createGetModuleFromFilename(basePath = process.argv[1] ?
|
|
67146
|
+
function createGetModuleFromFilename(basePath = process.argv[1] ? dirname17(process.argv[1]) : process.cwd(), isWindows = sep7 === "\\") {
|
|
67147
67147
|
const normalizedBase = isWindows ? normalizeWindowsPath(basePath) : basePath;
|
|
67148
67148
|
return (filename) => {
|
|
67149
67149
|
if (!filename)
|
|
@@ -69983,14 +69983,14 @@ async function addSourceContext(frames) {
|
|
|
69983
69983
|
return frames;
|
|
69984
69984
|
}
|
|
69985
69985
|
function getContextLinesFromFile(path7, ranges, output) {
|
|
69986
|
-
return new Promise((
|
|
69986
|
+
return new Promise((resolve15) => {
|
|
69987
69987
|
const stream = createReadStream(path7);
|
|
69988
69988
|
const lineReaded = createInterface({
|
|
69989
69989
|
input: stream
|
|
69990
69990
|
});
|
|
69991
69991
|
function destroyStreamAndResolve() {
|
|
69992
69992
|
stream.destroy();
|
|
69993
|
-
|
|
69993
|
+
resolve15();
|
|
69994
69994
|
}
|
|
69995
69995
|
let lineNumber = 0;
|
|
69996
69996
|
let currentRangeIndex = 0;
|
|
@@ -70164,7 +70164,7 @@ var init_context_lines_node = __esm(() => {
|
|
|
70164
70164
|
});
|
|
70165
70165
|
|
|
70166
70166
|
// node_modules/.bun/posthog-node@5.35.12/node_modules/posthog-node/dist/extensions/error-tracking/modifiers/relative-path.node.mjs
|
|
70167
|
-
import { isAbsolute as
|
|
70167
|
+
import { isAbsolute as isAbsolute8, relative as relative5, sep as sep8 } from "path";
|
|
70168
70168
|
function createRelativePathModifier(basePath = process.cwd()) {
|
|
70169
70169
|
const isWindows = sep8 === "\\";
|
|
70170
70170
|
const toUnix = (p) => isWindows ? p.replace(/\\/g, "/") : p;
|
|
@@ -70172,7 +70172,7 @@ function createRelativePathModifier(basePath = process.cwd()) {
|
|
|
70172
70172
|
return async (frames) => {
|
|
70173
70173
|
for (const frame of frames)
|
|
70174
70174
|
if (!(!frame.filename || frame.filename.startsWith("node:") || frame.filename.startsWith("data:"))) {
|
|
70175
|
-
if (
|
|
70175
|
+
if (isAbsolute8(frame.filename))
|
|
70176
70176
|
frame.filename = toUnix(relative5(normalizedBase, toUnix(frame.filename)));
|
|
70177
70177
|
}
|
|
70178
70178
|
return frames;
|
|
@@ -71462,9 +71462,9 @@ var init_client3 = __esm(() => {
|
|
|
71462
71462
|
if (this.disabled || this.optedOut)
|
|
71463
71463
|
return;
|
|
71464
71464
|
if (!this._waitUntilCycle) {
|
|
71465
|
-
let
|
|
71465
|
+
let resolve15;
|
|
71466
71466
|
const promise = new Promise((r) => {
|
|
71467
|
-
|
|
71467
|
+
resolve15 = r;
|
|
71468
71468
|
});
|
|
71469
71469
|
try {
|
|
71470
71470
|
waitUntil(promise);
|
|
@@ -71472,7 +71472,7 @@ var init_client3 = __esm(() => {
|
|
|
71472
71472
|
return;
|
|
71473
71473
|
}
|
|
71474
71474
|
this._waitUntilCycle = {
|
|
71475
|
-
resolve:
|
|
71475
|
+
resolve: resolve15,
|
|
71476
71476
|
startedAt: Date.now(),
|
|
71477
71477
|
timer: undefined
|
|
71478
71478
|
};
|
|
@@ -71498,11 +71498,11 @@ var init_client3 = __esm(() => {
|
|
|
71498
71498
|
return cycle?.resolve;
|
|
71499
71499
|
}
|
|
71500
71500
|
async resolveWaitUntilFlush() {
|
|
71501
|
-
const
|
|
71501
|
+
const resolve15 = this._consumeWaitUntilCycle();
|
|
71502
71502
|
try {
|
|
71503
71503
|
await super.flush();
|
|
71504
71504
|
} catch {} finally {
|
|
71505
|
-
|
|
71505
|
+
resolve15?.();
|
|
71506
71506
|
}
|
|
71507
71507
|
}
|
|
71508
71508
|
getPersistedProperty(key) {
|
|
@@ -71602,15 +71602,15 @@ var init_client3 = __esm(() => {
|
|
|
71602
71602
|
return true;
|
|
71603
71603
|
if (this.featureFlagsPoller === undefined)
|
|
71604
71604
|
return false;
|
|
71605
|
-
return new Promise((
|
|
71605
|
+
return new Promise((resolve15) => {
|
|
71606
71606
|
const timeout = setTimeout(() => {
|
|
71607
71607
|
cleanup();
|
|
71608
|
-
|
|
71608
|
+
resolve15(false);
|
|
71609
71609
|
}, timeoutMs);
|
|
71610
71610
|
const cleanup = this._events.on("localEvaluationFlagsLoaded", (count) => {
|
|
71611
71611
|
clearTimeout(timeout);
|
|
71612
71612
|
cleanup();
|
|
71613
|
-
|
|
71613
|
+
resolve15(count > 0);
|
|
71614
71614
|
});
|
|
71615
71615
|
});
|
|
71616
71616
|
}
|
|
@@ -72116,13 +72116,13 @@ var init_client3 = __esm(() => {
|
|
|
72116
72116
|
this.context?.enter(data, options);
|
|
72117
72117
|
}
|
|
72118
72118
|
async _shutdown(shutdownTimeoutMs) {
|
|
72119
|
-
const
|
|
72119
|
+
const resolve15 = this._consumeWaitUntilCycle();
|
|
72120
72120
|
await this.featureFlagsPoller?.stopPoller(shutdownTimeoutMs);
|
|
72121
72121
|
this.errorTracking.shutdown();
|
|
72122
72122
|
try {
|
|
72123
72123
|
return await super._shutdown(shutdownTimeoutMs);
|
|
72124
72124
|
} finally {
|
|
72125
|
-
|
|
72125
|
+
resolve15?.();
|
|
72126
72126
|
}
|
|
72127
72127
|
}
|
|
72128
72128
|
async _requestRemoteConfigPayload(flagKey) {
|
|
@@ -72693,7 +72693,7 @@ var package_default2;
|
|
|
72693
72693
|
var init_package2 = __esm(() => {
|
|
72694
72694
|
package_default2 = {
|
|
72695
72695
|
name: "@oh-my-opencode/omo-codex",
|
|
72696
|
-
version: "4.15.
|
|
72696
|
+
version: "4.15.1",
|
|
72697
72697
|
type: "module",
|
|
72698
72698
|
private: true,
|
|
72699
72699
|
description: "Codex harness adapter for oh-my-openagent. Vendored Codex plugin namespace (omo) + TypeScript installer + telemetry.",
|
|
@@ -73085,8 +73085,8 @@ import * as fs7 from "node:fs";
|
|
|
73085
73085
|
import * as path10 from "node:path";
|
|
73086
73086
|
function findPackageJsonUp(startPath) {
|
|
73087
73087
|
try {
|
|
73088
|
-
const
|
|
73089
|
-
let dir =
|
|
73088
|
+
const stat6 = fs7.statSync(startPath);
|
|
73089
|
+
let dir = stat6.isDirectory() ? startPath : path10.dirname(startPath);
|
|
73090
73090
|
for (let i = 0;i < 10; i++) {
|
|
73091
73091
|
const pkgPath = path10.join(dir, "package.json");
|
|
73092
73092
|
if (fs7.existsSync(pkgPath)) {
|
|
@@ -73663,19 +73663,19 @@ var init_update_toasts = __esm(() => {
|
|
|
73663
73663
|
|
|
73664
73664
|
// packages/omo-opencode/src/hooks/auto-update-checker/hook/background-update-check.ts
|
|
73665
73665
|
import { existsSync as existsSync48 } from "node:fs";
|
|
73666
|
-
import { dirname as
|
|
73666
|
+
import { dirname as dirname26, join as join68 } from "node:path";
|
|
73667
73667
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
73668
73668
|
function defaultGetModuleHostingWorkspace() {
|
|
73669
73669
|
try {
|
|
73670
|
-
const currentDir =
|
|
73670
|
+
const currentDir = dirname26(fileURLToPath4(import.meta.url));
|
|
73671
73671
|
const pkgJsonPath = findPackageJsonUp(currentDir);
|
|
73672
73672
|
if (!pkgJsonPath)
|
|
73673
73673
|
return null;
|
|
73674
|
-
const pkgDir =
|
|
73675
|
-
const nodeModulesDir =
|
|
73674
|
+
const pkgDir = dirname26(pkgJsonPath);
|
|
73675
|
+
const nodeModulesDir = dirname26(pkgDir);
|
|
73676
73676
|
if (nodeModulesDir.split(/[\\/]/).pop() !== "node_modules")
|
|
73677
73677
|
return null;
|
|
73678
|
-
return
|
|
73678
|
+
return dirname26(nodeModulesDir);
|
|
73679
73679
|
} catch (error51) {
|
|
73680
73680
|
if (error51 instanceof Error) {
|
|
73681
73681
|
return null;
|
|
@@ -73817,7 +73817,7 @@ var init_background_update_check = __esm(() => {
|
|
|
73817
73817
|
init_update_toasts();
|
|
73818
73818
|
defaultDeps4 = {
|
|
73819
73819
|
existsSync: existsSync48,
|
|
73820
|
-
join:
|
|
73820
|
+
join: join68,
|
|
73821
73821
|
runBunInstallWithDetails,
|
|
73822
73822
|
log: log2,
|
|
73823
73823
|
getOpenCodeCacheDir,
|
|
@@ -73980,7 +73980,7 @@ async function showSpinnerToast(ctx, version3, message) {
|
|
|
73980
73980
|
duration: frameInterval + 50
|
|
73981
73981
|
}
|
|
73982
73982
|
}).catch(ignoreToastError);
|
|
73983
|
-
await new Promise((
|
|
73983
|
+
await new Promise((resolve19) => setTimeout(resolve19, frameInterval));
|
|
73984
73984
|
}
|
|
73985
73985
|
}
|
|
73986
73986
|
var SISYPHUS_SPINNER;
|
|
@@ -74421,13 +74421,13 @@ function getUnsupportedOpenCodeVersionMessage(openCodeVersion) {
|
|
|
74421
74421
|
}
|
|
74422
74422
|
|
|
74423
74423
|
// packages/omo-codex/src/install/install-codex.ts
|
|
74424
|
-
import { join as
|
|
74424
|
+
import { join as join52, resolve as resolve15 } from "node:path";
|
|
74425
74425
|
import { existsSync as existsSync30 } from "node:fs";
|
|
74426
74426
|
import { homedir as homedir6 } from "node:os";
|
|
74427
74427
|
|
|
74428
74428
|
// packages/omo-codex/src/install/codex-cache-bins.ts
|
|
74429
|
-
import { chmod, lstat as
|
|
74430
|
-
import { basename as basename6, isAbsolute as
|
|
74429
|
+
import { chmod, lstat as lstat4, mkdir, readFile as readFile3, readdir as readdir2, readlink as readlink3, rm as rm3, stat as stat2, symlink, writeFile } from "node:fs/promises";
|
|
74430
|
+
import { basename as basename6, isAbsolute as isAbsolute4, join as join27, relative as relative2, resolve as resolve8, sep } from "node:path";
|
|
74431
74431
|
|
|
74432
74432
|
// packages/omo-codex/src/install/codex-cache-command-shim.ts
|
|
74433
74433
|
var COMMAND_SHIM_MARKER = ":: generated by oh-my-openagent Codex installer";
|
|
@@ -74470,6 +74470,10 @@ function windowsCommandShim(targetPath) {
|
|
|
74470
74470
|
`);
|
|
74471
74471
|
}
|
|
74472
74472
|
|
|
74473
|
+
// packages/omo-codex/src/install/codex-cache-dangling-bins.ts
|
|
74474
|
+
import { lstat as lstat2, readFile, readdir, readlink, rm, stat } from "node:fs/promises";
|
|
74475
|
+
import { dirname as dirname10, isAbsolute as isAbsolute3, join as join24, resolve as resolve7 } from "node:path";
|
|
74476
|
+
|
|
74473
74477
|
// packages/omo-codex/src/install/codex-cache-fs.ts
|
|
74474
74478
|
import { lstat } from "node:fs/promises";
|
|
74475
74479
|
async function fileExistsStrict(path7) {
|
|
@@ -74489,9 +74493,96 @@ function isNodeErrorWithCode(error) {
|
|
|
74489
74493
|
return typeof error === "object" && error !== null && "code" in error;
|
|
74490
74494
|
}
|
|
74491
74495
|
|
|
74496
|
+
// packages/omo-codex/src/install/codex-cache-dangling-bins.ts
|
|
74497
|
+
async function removeDanglingManagedComponentBins(binDir, platform, managedBinNames) {
|
|
74498
|
+
const entries = await readdir(binDir, { withFileTypes: true });
|
|
74499
|
+
for (const entry of entries) {
|
|
74500
|
+
const binName = managedBinNameForEntry(entry.name, platform);
|
|
74501
|
+
if (binName === null || !managedBinNames.has(binName))
|
|
74502
|
+
continue;
|
|
74503
|
+
const linkPath = join24(binDir, entry.name);
|
|
74504
|
+
if (platform === "win32") {
|
|
74505
|
+
await removeDanglingGeneratedCommandShim(linkPath);
|
|
74506
|
+
continue;
|
|
74507
|
+
}
|
|
74508
|
+
await removeDanglingManagedSymlink(linkPath);
|
|
74509
|
+
}
|
|
74510
|
+
}
|
|
74511
|
+
function managedBinNameForEntry(name, platform) {
|
|
74512
|
+
if (platform === "win32")
|
|
74513
|
+
return name.endsWith(".cmd") ? name.slice(0, -4) : null;
|
|
74514
|
+
return name;
|
|
74515
|
+
}
|
|
74516
|
+
async function removeDanglingManagedSymlink(linkPath) {
|
|
74517
|
+
try {
|
|
74518
|
+
const linkStat = await lstat2(linkPath);
|
|
74519
|
+
if (!linkStat.isSymbolicLink())
|
|
74520
|
+
return;
|
|
74521
|
+
const linkTarget = await readlink(linkPath);
|
|
74522
|
+
const target = isAbsolute3(linkTarget) ? linkTarget : resolve7(dirname10(linkPath), linkTarget);
|
|
74523
|
+
if (!await isFileSystemEntry(target) && isManagedComponentBinTarget(target))
|
|
74524
|
+
await rm(linkPath, { force: true });
|
|
74525
|
+
} catch (error) {
|
|
74526
|
+
if (isNodeErrorWithCode(error) && error.code === "ENOENT")
|
|
74527
|
+
return;
|
|
74528
|
+
throw error;
|
|
74529
|
+
}
|
|
74530
|
+
}
|
|
74531
|
+
async function removeDanglingGeneratedCommandShim(linkPath) {
|
|
74532
|
+
try {
|
|
74533
|
+
const linkStat = await lstat2(linkPath);
|
|
74534
|
+
if (!linkStat.isFile())
|
|
74535
|
+
return;
|
|
74536
|
+
const content = await readFile(linkPath, "utf8");
|
|
74537
|
+
if (!content.includes(COMMAND_SHIM_MARKER))
|
|
74538
|
+
return;
|
|
74539
|
+
const target = extractCommandShimTarget(content);
|
|
74540
|
+
if (target !== null && !await isFileSystemEntry(target) && isManagedComponentBinTarget(target))
|
|
74541
|
+
await rm(linkPath, { force: true });
|
|
74542
|
+
} catch (error) {
|
|
74543
|
+
if (isNodeErrorWithCode(error) && error.code === "ENOENT")
|
|
74544
|
+
return;
|
|
74545
|
+
throw error;
|
|
74546
|
+
}
|
|
74547
|
+
}
|
|
74548
|
+
async function isFileSystemEntry(path7) {
|
|
74549
|
+
try {
|
|
74550
|
+
await stat(path7);
|
|
74551
|
+
return true;
|
|
74552
|
+
} catch (error) {
|
|
74553
|
+
if (isNodeErrorWithCode(error) && error.code === "ENOENT")
|
|
74554
|
+
return false;
|
|
74555
|
+
throw error;
|
|
74556
|
+
}
|
|
74557
|
+
}
|
|
74558
|
+
function extractCommandShimTarget(content) {
|
|
74559
|
+
const match = /"([^"\r\n]+components[\\/][^"\r\n]+[\\/]dist[\\/]cli\.js)" %\*/.exec(content);
|
|
74560
|
+
return match?.[1] ?? null;
|
|
74561
|
+
}
|
|
74562
|
+
function isManagedComponentBinTarget(target) {
|
|
74563
|
+
const parts = target.split(/[\\/]+/);
|
|
74564
|
+
const suffix = parts.slice(-4);
|
|
74565
|
+
return suffix[0] === "components" && suffix[2] === "dist" && suffix[3] === "cli.js" && (hasOmoPluginCachePrefix(parts, parts.length - 4) || hasOmoCodexPluginPrefix(parts, parts.length - 4));
|
|
74566
|
+
}
|
|
74567
|
+
function hasOmoPluginCachePrefix(parts, endExclusive) {
|
|
74568
|
+
for (let index = 0;index < endExclusive - 4; index += 1) {
|
|
74569
|
+
if (parts[index] === "plugins" && parts[index + 1] === "cache" && parts[index + 2] === "sisyphuslabs" && parts[index + 3] === "omo") {
|
|
74570
|
+
return index + 4 < endExclusive;
|
|
74571
|
+
}
|
|
74572
|
+
}
|
|
74573
|
+
return false;
|
|
74574
|
+
}
|
|
74575
|
+
function hasOmoCodexPluginPrefix(parts, endExclusive) {
|
|
74576
|
+
for (let index = 0;index <= endExclusive - 3; index += 1) {
|
|
74577
|
+
if (parts[index] === "packages" && parts[index + 1] === "omo-codex" && parts[index + 2] === "plugin")
|
|
74578
|
+
return true;
|
|
74579
|
+
}
|
|
74580
|
+
return false;
|
|
74581
|
+
}
|
|
74582
|
+
|
|
74492
74583
|
// packages/omo-codex/src/install/codex-cache-legacy-bins.ts
|
|
74493
|
-
import { lstat as
|
|
74494
|
-
import { join as
|
|
74584
|
+
import { lstat as lstat3, readFile as readFile2, readlink as readlink2, rm as rm2 } from "node:fs/promises";
|
|
74585
|
+
import { join as join25 } from "node:path";
|
|
74495
74586
|
var LEGACY_CODEX_COMPONENT_BINS = [
|
|
74496
74587
|
{ name: "omo", component: "ulw-loop" },
|
|
74497
74588
|
{ name: "codex-comment-checker", component: "comment-checker" },
|
|
@@ -74503,26 +74594,26 @@ var LEGACY_CODEX_COMPONENT_BINS = [
|
|
|
74503
74594
|
];
|
|
74504
74595
|
async function removeLegacyCodexComponentBins(binDir, platform) {
|
|
74505
74596
|
for (const entry of LEGACY_CODEX_COMPONENT_BINS) {
|
|
74506
|
-
const linkPath =
|
|
74597
|
+
const linkPath = join25(binDir, platform === "win32" ? `${entry.name}.cmd` : entry.name);
|
|
74507
74598
|
await removeLegacyCodexComponentBin(linkPath, entry.component, platform);
|
|
74508
74599
|
}
|
|
74509
74600
|
}
|
|
74510
74601
|
async function removeLegacyCodexComponentBin(linkPath, component, platform) {
|
|
74511
74602
|
try {
|
|
74512
|
-
const
|
|
74603
|
+
const stat2 = await lstat3(linkPath);
|
|
74513
74604
|
if (platform !== "win32") {
|
|
74514
|
-
if (!
|
|
74605
|
+
if (!stat2.isSymbolicLink())
|
|
74515
74606
|
return;
|
|
74516
|
-
const target = await
|
|
74607
|
+
const target = await readlink2(linkPath);
|
|
74517
74608
|
if (isManagedLegacyComponentTarget(target, component))
|
|
74518
|
-
await
|
|
74609
|
+
await rm2(linkPath, { force: true });
|
|
74519
74610
|
return;
|
|
74520
74611
|
}
|
|
74521
|
-
if (!
|
|
74612
|
+
if (!stat2.isFile())
|
|
74522
74613
|
return;
|
|
74523
|
-
const content = await
|
|
74614
|
+
const content = await readFile2(linkPath, "utf8");
|
|
74524
74615
|
if (content.includes(COMMAND_SHIM_MARKER))
|
|
74525
|
-
await
|
|
74616
|
+
await rm2(linkPath, { force: true });
|
|
74526
74617
|
} catch (error) {
|
|
74527
74618
|
if (isNodeErrorWithCode2(error) && error.code === "ENOENT")
|
|
74528
74619
|
return;
|
|
@@ -74533,7 +74624,7 @@ function isManagedLegacyComponentTarget(target, component) {
|
|
|
74533
74624
|
const parts = target.split(/[\\/]+/);
|
|
74534
74625
|
const suffixStart = parts.length - 4;
|
|
74535
74626
|
const suffix = parts.slice(-4);
|
|
74536
|
-
return suffix[0] === "components" && suffix[1] === component && suffix[2] === "dist" && suffix[3] === "cli.js" && (hasPluginCachePrefix(parts, suffixStart) ||
|
|
74627
|
+
return suffix[0] === "components" && suffix[1] === component && suffix[2] === "dist" && suffix[3] === "cli.js" && (hasPluginCachePrefix(parts, suffixStart) || hasOmoCodexPluginPrefix2(parts, suffixStart));
|
|
74537
74628
|
}
|
|
74538
74629
|
function hasPluginCachePrefix(parts, endExclusive) {
|
|
74539
74630
|
for (let index = 0;index < endExclusive - 1; index += 1) {
|
|
@@ -74542,7 +74633,7 @@ function hasPluginCachePrefix(parts, endExclusive) {
|
|
|
74542
74633
|
}
|
|
74543
74634
|
return false;
|
|
74544
74635
|
}
|
|
74545
|
-
function
|
|
74636
|
+
function hasOmoCodexPluginPrefix2(parts, endExclusive) {
|
|
74546
74637
|
for (let index = 0;index <= endExclusive - 3; index += 1) {
|
|
74547
74638
|
if (parts[index] === "packages" && parts[index + 1] === "omo-codex" && parts[index + 2] === "plugin")
|
|
74548
74639
|
return true;
|
|
@@ -74554,10 +74645,10 @@ function isNodeErrorWithCode2(error) {
|
|
|
74554
74645
|
}
|
|
74555
74646
|
|
|
74556
74647
|
// packages/omo-codex/src/install/codex-cache-runtime-wrapper.ts
|
|
74557
|
-
import { join as
|
|
74648
|
+
import { join as join26 } from "node:path";
|
|
74558
74649
|
var RUNTIME_WRAPPER_MARKER = "OMO_GENERATED_RUNTIME_WRAPPER";
|
|
74559
74650
|
function posixRuntimeWrapper(cliPath, codexHome, binDir, nodeCliPath) {
|
|
74560
|
-
const ulwLoopBin = toPosixPath(
|
|
74651
|
+
const ulwLoopBin = toPosixPath(join26(binDir, "omo-ulw-loop"));
|
|
74561
74652
|
const nodeCli = escapePosixDoubleQuoted(toPosixPath(nodeCliPath));
|
|
74562
74653
|
const escapedCliPath = escapePosixDoubleQuoted(toPosixPath(cliPath));
|
|
74563
74654
|
const escapedCodexHome = escapePosixDoubleQuoted(toPosixPath(codexHome));
|
|
@@ -74602,7 +74693,7 @@ function posixRuntimeWrapper(cliPath, codexHome, binDir, nodeCliPath) {
|
|
|
74602
74693
|
`);
|
|
74603
74694
|
}
|
|
74604
74695
|
function windowsRuntimeWrapper(cliPath, codexHome, binDir, nodeCliPath) {
|
|
74605
|
-
const ulwLoopBin =
|
|
74696
|
+
const ulwLoopBin = join26(binDir, "omo-ulw-loop.cmd");
|
|
74606
74697
|
return [
|
|
74607
74698
|
"@echo off",
|
|
74608
74699
|
`rem ${RUNTIME_WRAPPER_MARKER}`,
|
|
@@ -74650,6 +74741,7 @@ async function linkCachedPluginBins(input) {
|
|
|
74650
74741
|
const platform = input.platform ?? process.platform;
|
|
74651
74742
|
await mkdir(input.binDir, { recursive: true });
|
|
74652
74743
|
await removeLegacyCodexComponentBins(input.binDir, platform);
|
|
74744
|
+
await removeDanglingManagedComponentBins(input.binDir, platform, new Set(binLinks.map((link) => link.name)));
|
|
74653
74745
|
const linked = [];
|
|
74654
74746
|
for (const link of binLinks) {
|
|
74655
74747
|
const linkPath = await linkCachedPluginBin(input.binDir, link, platform);
|
|
@@ -74661,55 +74753,55 @@ async function removeCachedManagedNpmBinShims(pluginRoot) {
|
|
|
74661
74753
|
const binLinks = await discoverPackageBins(pluginRoot);
|
|
74662
74754
|
if (binLinks.length === 0)
|
|
74663
74755
|
return;
|
|
74664
|
-
const npmBinDir =
|
|
74665
|
-
if (!await
|
|
74756
|
+
const npmBinDir = join27(pluginRoot, "node_modules", ".bin");
|
|
74757
|
+
if (!await isFileSystemEntry2(npmBinDir))
|
|
74666
74758
|
return;
|
|
74667
74759
|
const managedBinNames = new Set(binLinks.map((link) => link.name));
|
|
74668
74760
|
for (const name of managedBinNames) {
|
|
74669
74761
|
for (const suffix of ["", ".cmd", ".ps1"]) {
|
|
74670
|
-
await
|
|
74762
|
+
await rm3(join27(npmBinDir, `${name}${suffix}`), { force: true });
|
|
74671
74763
|
}
|
|
74672
74764
|
}
|
|
74673
74765
|
}
|
|
74674
74766
|
async function linkRootRuntimeBin(input) {
|
|
74675
|
-
const cliPath =
|
|
74767
|
+
const cliPath = join27(input.repoRoot, "dist", "cli", "index.js");
|
|
74676
74768
|
if (!await isFile(cliPath))
|
|
74677
74769
|
return null;
|
|
74678
|
-
const nodeCliPath =
|
|
74770
|
+
const nodeCliPath = join27(input.repoRoot, "dist", "cli-node", "index.js");
|
|
74679
74771
|
const platform = input.platform ?? process.platform;
|
|
74680
74772
|
await mkdir(input.binDir, { recursive: true });
|
|
74681
74773
|
if (platform === "win32") {
|
|
74682
|
-
const linkPath2 =
|
|
74774
|
+
const linkPath2 = join27(input.binDir, "omo.cmd");
|
|
74683
74775
|
await replaceRuntimeWrapper(linkPath2, windowsRuntimeWrapper(cliPath, input.codexHome, input.binDir, nodeCliPath));
|
|
74684
74776
|
return { name: "omo", path: linkPath2, target: cliPath };
|
|
74685
74777
|
}
|
|
74686
|
-
const linkPath =
|
|
74778
|
+
const linkPath = join27(input.binDir, "omo");
|
|
74687
74779
|
await replaceRuntimeWrapper(linkPath, posixRuntimeWrapper(cliPath, input.codexHome, input.binDir, nodeCliPath));
|
|
74688
74780
|
await chmod(linkPath, 493);
|
|
74689
74781
|
return { name: "omo", path: linkPath, target: cliPath };
|
|
74690
74782
|
}
|
|
74691
74783
|
async function linkCachedPluginBin(binDir, link, platform) {
|
|
74692
74784
|
if (platform === "win32") {
|
|
74693
|
-
const linkPath2 =
|
|
74785
|
+
const linkPath2 = join27(binDir, `${link.name}.cmd`);
|
|
74694
74786
|
await replaceCommandShim(linkPath2, link.target);
|
|
74695
74787
|
return linkPath2;
|
|
74696
74788
|
}
|
|
74697
|
-
const linkPath =
|
|
74789
|
+
const linkPath = join27(binDir, link.name);
|
|
74698
74790
|
await replaceSymlink(linkPath, link.target);
|
|
74699
74791
|
return linkPath;
|
|
74700
74792
|
}
|
|
74701
74793
|
async function isFile(path7) {
|
|
74702
74794
|
try {
|
|
74703
|
-
return (await
|
|
74795
|
+
return (await stat2(path7)).isFile();
|
|
74704
74796
|
} catch (error) {
|
|
74705
74797
|
if (isNodeErrorWithCode(error) && error.code === "ENOENT")
|
|
74706
74798
|
return false;
|
|
74707
74799
|
throw error;
|
|
74708
74800
|
}
|
|
74709
74801
|
}
|
|
74710
|
-
async function
|
|
74802
|
+
async function isFileSystemEntry2(path7) {
|
|
74711
74803
|
try {
|
|
74712
|
-
await
|
|
74804
|
+
await stat2(path7);
|
|
74713
74805
|
return true;
|
|
74714
74806
|
} catch (error) {
|
|
74715
74807
|
if (isNodeErrorWithCode(error) && error.code === "ENOENT")
|
|
@@ -74723,23 +74815,23 @@ async function discoverPackageBins(root) {
|
|
|
74723
74815
|
return links;
|
|
74724
74816
|
}
|
|
74725
74817
|
async function collectPackageBins(directory, root, links) {
|
|
74726
|
-
const entries = await
|
|
74818
|
+
const entries = await readdir2(directory, { withFileTypes: true });
|
|
74727
74819
|
if (entries.some((entry) => entry.isFile() && entry.name === "package.json")) {
|
|
74728
|
-
await appendPackageBinLinks(
|
|
74820
|
+
await appendPackageBinLinks(join27(directory, "package.json"), directory, root, links);
|
|
74729
74821
|
}
|
|
74730
74822
|
for (const entry of entries) {
|
|
74731
74823
|
if (!entry.isDirectory())
|
|
74732
74824
|
continue;
|
|
74733
74825
|
if (entry.name === "node_modules" || entry.name === ".git" || entry.name === "dist")
|
|
74734
74826
|
continue;
|
|
74735
|
-
const childPath =
|
|
74827
|
+
const childPath = join27(directory, entry.name);
|
|
74736
74828
|
if (!childPath.startsWith(root))
|
|
74737
74829
|
continue;
|
|
74738
74830
|
await collectPackageBins(childPath, root, links);
|
|
74739
74831
|
}
|
|
74740
74832
|
}
|
|
74741
74833
|
async function appendPackageBinLinks(packageJsonPath, packageRoot, root, links) {
|
|
74742
|
-
const packageJson = JSON.parse(await
|
|
74834
|
+
const packageJson = JSON.parse(await readFile3(packageJsonPath, "utf8"));
|
|
74743
74835
|
if (!isPlainRecord3(packageJson))
|
|
74744
74836
|
return;
|
|
74745
74837
|
const packageName = packageJson.name;
|
|
@@ -74774,10 +74866,10 @@ function isReservedNestedBinName(name, packageRoot, root) {
|
|
|
74774
74866
|
function resolvePackageBinTarget(packageRoot, target) {
|
|
74775
74867
|
if (target.includes("\x00"))
|
|
74776
74868
|
throw new Error("Package bin target must stay inside package root");
|
|
74777
|
-
const root =
|
|
74778
|
-
const resolvedTarget =
|
|
74869
|
+
const root = resolve8(packageRoot);
|
|
74870
|
+
const resolvedTarget = resolve8(root, target);
|
|
74779
74871
|
const relativeTarget = relative2(root, resolvedTarget);
|
|
74780
|
-
if (relativeTarget === "" || relativeTarget !== ".." && !relativeTarget.startsWith(`..${sep}`) && !
|
|
74872
|
+
if (relativeTarget === "" || relativeTarget !== ".." && !relativeTarget.startsWith(`..${sep}`) && !isAbsolute4(relativeTarget)) {
|
|
74781
74873
|
return resolvedTarget;
|
|
74782
74874
|
}
|
|
74783
74875
|
throw new Error("Package bin target must stay inside package root");
|
|
@@ -74785,7 +74877,7 @@ function resolvePackageBinTarget(packageRoot, target) {
|
|
|
74785
74877
|
async function replaceSymlink(linkPath, targetPath) {
|
|
74786
74878
|
if (await existingNonSymlink(linkPath))
|
|
74787
74879
|
throw new Error(`${linkPath} already exists and is not a symlink`);
|
|
74788
|
-
await
|
|
74880
|
+
await rm3(linkPath, { force: true });
|
|
74789
74881
|
await symlink(targetPath, linkPath);
|
|
74790
74882
|
}
|
|
74791
74883
|
async function replaceCommandShim(linkPath, targetPath) {
|
|
@@ -74796,17 +74888,17 @@ async function replaceCommandShim(linkPath, targetPath) {
|
|
|
74796
74888
|
async function replaceRuntimeWrapper(linkPath, content) {
|
|
74797
74889
|
if (await existingNonRuntimeWrapper(linkPath))
|
|
74798
74890
|
throw new Error(`${linkPath} already exists and is not a generated OMO runtime wrapper`);
|
|
74799
|
-
await
|
|
74891
|
+
await rm3(linkPath, { force: true });
|
|
74800
74892
|
await writeFile(linkPath, content);
|
|
74801
74893
|
}
|
|
74802
74894
|
async function existingNonRuntimeWrapper(path7) {
|
|
74803
74895
|
try {
|
|
74804
|
-
const
|
|
74805
|
-
if (
|
|
74896
|
+
const stat3 = await lstat4(path7);
|
|
74897
|
+
if (stat3.isSymbolicLink())
|
|
74806
74898
|
return false;
|
|
74807
|
-
if (!
|
|
74899
|
+
if (!stat3.isFile())
|
|
74808
74900
|
return true;
|
|
74809
|
-
const content = await
|
|
74901
|
+
const content = await readFile3(path7, "utf8");
|
|
74810
74902
|
return !content.includes(RUNTIME_WRAPPER_MARKER);
|
|
74811
74903
|
} catch (error) {
|
|
74812
74904
|
if (isNodeErrorWithCode(error) && error.code === "ENOENT")
|
|
@@ -74816,10 +74908,10 @@ async function existingNonRuntimeWrapper(path7) {
|
|
|
74816
74908
|
}
|
|
74817
74909
|
async function existingNonShim(path7) {
|
|
74818
74910
|
try {
|
|
74819
|
-
const
|
|
74820
|
-
if (!
|
|
74911
|
+
const stat3 = await lstat4(path7);
|
|
74912
|
+
if (!stat3.isFile())
|
|
74821
74913
|
return true;
|
|
74822
|
-
const content = await
|
|
74914
|
+
const content = await readFile3(path7, "utf8");
|
|
74823
74915
|
if (content.includes(COMMAND_SHIM_MARKER))
|
|
74824
74916
|
return false;
|
|
74825
74917
|
throw new Error(`${path7} already exists and is not a generated command shim`);
|
|
@@ -74831,10 +74923,10 @@ async function existingNonShim(path7) {
|
|
|
74831
74923
|
}
|
|
74832
74924
|
async function existingNonSymlink(path7) {
|
|
74833
74925
|
try {
|
|
74834
|
-
const
|
|
74835
|
-
if (!
|
|
74926
|
+
const stat3 = await lstat4(path7);
|
|
74927
|
+
if (!stat3.isSymbolicLink())
|
|
74836
74928
|
return true;
|
|
74837
|
-
await
|
|
74929
|
+
await readlink3(path7);
|
|
74838
74930
|
return false;
|
|
74839
74931
|
} catch (error) {
|
|
74840
74932
|
if (isNodeErrorWithCode(error) && error.code === "ENOENT")
|
|
@@ -74843,12 +74935,12 @@ async function existingNonSymlink(path7) {
|
|
|
74843
74935
|
}
|
|
74844
74936
|
}
|
|
74845
74937
|
// packages/omo-codex/src/install/codex-cache-install.ts
|
|
74846
|
-
import { cp as cp2, mkdir as mkdir3, readFile as
|
|
74847
|
-
import { basename as basename7, dirname as
|
|
74938
|
+
import { cp as cp2, mkdir as mkdir3, readFile as readFile8, readdir as readdir4, rename, rm as rm4 } from "node:fs/promises";
|
|
74939
|
+
import { basename as basename7, dirname as dirname13, join as join33, sep as sep5 } from "node:path";
|
|
74848
74940
|
|
|
74849
74941
|
// packages/omo-codex/src/install/codex-cache-bundled-mcps.ts
|
|
74850
|
-
import { cp, mkdir as mkdir2, readFile as
|
|
74851
|
-
import { dirname as
|
|
74942
|
+
import { cp, mkdir as mkdir2, readFile as readFile4, stat as stat3 } from "node:fs/promises";
|
|
74943
|
+
import { dirname as dirname11, join as join28, resolve as resolve9 } from "node:path";
|
|
74852
74944
|
var BUNDLED_MCP_RUNTIMES = [
|
|
74853
74945
|
{
|
|
74854
74946
|
label: "Git Bash MCP",
|
|
@@ -74866,7 +74958,7 @@ var BUNDLED_MCP_RUNTIMES = [
|
|
|
74866
74958
|
}
|
|
74867
74959
|
];
|
|
74868
74960
|
async function copyBundledMcpRuntimeDists(input) {
|
|
74869
|
-
const sourceArgs = await readSourceMcpArgs(
|
|
74961
|
+
const sourceArgs = await readSourceMcpArgs(join28(input.sourceRoot, ".mcp.json"));
|
|
74870
74962
|
for (const runtime4 of BUNDLED_MCP_RUNTIMES) {
|
|
74871
74963
|
if (!sourceArgs.has(runtime4.sourceArg))
|
|
74872
74964
|
continue;
|
|
@@ -74875,21 +74967,21 @@ async function copyBundledMcpRuntimeDists(input) {
|
|
|
74875
74967
|
}
|
|
74876
74968
|
function resolveBundledMcpRuntimeArg(pluginRoot, arg) {
|
|
74877
74969
|
const runtime4 = BUNDLED_MCP_RUNTIMES.find((candidate) => candidate.sourceArg === arg);
|
|
74878
|
-
return runtime4 ?
|
|
74970
|
+
return runtime4 ? join28(pluginRoot, runtime4.destinationArg) : null;
|
|
74879
74971
|
}
|
|
74880
74972
|
async function copyBundledMcpRuntimeDist(pluginRoot, sourceRoot, runtime4) {
|
|
74881
|
-
const sourcePath =
|
|
74973
|
+
const sourcePath = resolve9(sourceRoot, runtime4.sourceDistFromPlugin);
|
|
74882
74974
|
if (!await isDirectory(sourcePath)) {
|
|
74883
74975
|
throw new Error(`missing built ${runtime4.label} dist at ${sourcePath}`);
|
|
74884
74976
|
}
|
|
74885
|
-
const destinationPath =
|
|
74886
|
-
await mkdir2(
|
|
74977
|
+
const destinationPath = join28(pluginRoot, runtime4.destinationDistFromPlugin);
|
|
74978
|
+
await mkdir2(dirname11(destinationPath), { recursive: true });
|
|
74887
74979
|
await cp(sourcePath, destinationPath, { recursive: true });
|
|
74888
74980
|
}
|
|
74889
74981
|
async function readSourceMcpArgs(path7) {
|
|
74890
74982
|
let parsed;
|
|
74891
74983
|
try {
|
|
74892
|
-
parsed = JSON.parse(await
|
|
74984
|
+
parsed = JSON.parse(await readFile4(path7, "utf8"));
|
|
74893
74985
|
} catch (error) {
|
|
74894
74986
|
if (error instanceof Error)
|
|
74895
74987
|
return new Set;
|
|
@@ -74910,7 +75002,7 @@ async function readSourceMcpArgs(path7) {
|
|
|
74910
75002
|
}
|
|
74911
75003
|
async function isDirectory(path7) {
|
|
74912
75004
|
try {
|
|
74913
|
-
return (await
|
|
75005
|
+
return (await stat3(path7)).isDirectory();
|
|
74914
75006
|
} catch (error) {
|
|
74915
75007
|
if (error instanceof Error)
|
|
74916
75008
|
return false;
|
|
@@ -74920,28 +75012,28 @@ async function isDirectory(path7) {
|
|
|
74920
75012
|
|
|
74921
75013
|
// packages/omo-codex/src/install/codex-cache-local-dependencies.ts
|
|
74922
75014
|
import { realpathSync as realpathSync6 } from "node:fs";
|
|
74923
|
-
import { readFile as
|
|
74924
|
-
import { dirname as
|
|
75015
|
+
import { readFile as readFile5, readdir as readdir3, writeFile as writeFile2 } from "node:fs/promises";
|
|
75016
|
+
import { dirname as dirname12, isAbsolute as isAbsolute6, join as join30, relative as relative4, resolve as resolve11, sep as sep2 } from "node:path";
|
|
74925
75017
|
|
|
74926
75018
|
// packages/omo-codex/src/install/codex-cache-paths.ts
|
|
74927
75019
|
import { existsSync as existsSync26, readdirSync as readdirSync4 } from "node:fs";
|
|
74928
|
-
import { isAbsolute as
|
|
75020
|
+
import { isAbsolute as isAbsolute5, join as join29, relative as relative3, resolve as resolve10 } from "node:path";
|
|
74929
75021
|
var DEFAULT_CODEX_MARKETPLACE_NAME = "sisyphuslabs";
|
|
74930
75022
|
var DEFAULT_CODEX_PLUGIN_NAME = "omo";
|
|
74931
75023
|
function resolveDefaultCodexHome(homeDir) {
|
|
74932
|
-
return
|
|
75024
|
+
return join29(homeDir, ".codex");
|
|
74933
75025
|
}
|
|
74934
75026
|
function resolveCodexPluginCacheRoot(codexHome, input = {}) {
|
|
74935
|
-
return
|
|
75027
|
+
return join29(codexHome, "plugins", "cache", input.marketplaceName ?? DEFAULT_CODEX_MARKETPLACE_NAME, input.pluginName ?? DEFAULT_CODEX_PLUGIN_NAME);
|
|
74936
75028
|
}
|
|
74937
75029
|
function resolveCachedCodexComponentCliPath(pluginRoot, componentName) {
|
|
74938
|
-
return
|
|
75030
|
+
return join29(pluginRoot, "components", componentName, "dist", "cli.js");
|
|
74939
75031
|
}
|
|
74940
75032
|
function resolveCodexComponentBinCandidates(input) {
|
|
74941
75033
|
return [
|
|
74942
|
-
input.env.CODEX_LOCAL_BIN_DIR ?
|
|
74943
|
-
|
|
74944
|
-
|
|
75034
|
+
input.env.CODEX_LOCAL_BIN_DIR ? join29(input.env.CODEX_LOCAL_BIN_DIR, input.executableName) : undefined,
|
|
75035
|
+
join29(input.homeDir, ".local", "bin", input.executableName),
|
|
75036
|
+
join29(resolveDefaultCodexHome(input.homeDir), "bin", input.executableName)
|
|
74945
75037
|
].filter((value) => typeof value === "string");
|
|
74946
75038
|
}
|
|
74947
75039
|
function findNewestCachedCodexComponentCli(input) {
|
|
@@ -74950,21 +75042,21 @@ function findNewestCachedCodexComponentCli(input) {
|
|
|
74950
75042
|
return null;
|
|
74951
75043
|
const versions = readdirSync4(versionsRoot, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort(compareVersionNames).reverse();
|
|
74952
75044
|
for (const version of versions) {
|
|
74953
|
-
const candidate = resolveCachedCodexComponentCliPath(
|
|
75045
|
+
const candidate = resolveCachedCodexComponentCliPath(join29(versionsRoot, version), input.componentName);
|
|
74954
75046
|
if (existsSync26(candidate))
|
|
74955
75047
|
return candidate;
|
|
74956
75048
|
}
|
|
74957
75049
|
return null;
|
|
74958
75050
|
}
|
|
74959
75051
|
function resolveCachedRuntimePath(pluginRoot, sourceRoot, runtimePath) {
|
|
74960
|
-
const targetPath =
|
|
75052
|
+
const targetPath = resolve10(pluginRoot, runtimePath);
|
|
74961
75053
|
if (isPathInside(targetPath, pluginRoot))
|
|
74962
75054
|
return targetPath;
|
|
74963
|
-
return
|
|
75055
|
+
return resolve10(sourceRoot, runtimePath);
|
|
74964
75056
|
}
|
|
74965
75057
|
function isPathInside(candidatePath, rootPath) {
|
|
74966
75058
|
const pathFromRoot = relative3(rootPath, candidatePath);
|
|
74967
|
-
return pathFromRoot === "" || !pathFromRoot.startsWith("..") && !
|
|
75059
|
+
return pathFromRoot === "" || !pathFromRoot.startsWith("..") && !isAbsolute5(pathFromRoot);
|
|
74968
75060
|
}
|
|
74969
75061
|
function compareVersionNames(left, right) {
|
|
74970
75062
|
const leftParts = left.split(".").map((part) => Number.parseInt(part, 10));
|
|
@@ -74985,12 +75077,12 @@ async function rewriteCachedPackageLocalFileDependencies(pluginRoot, sourceRoot)
|
|
|
74985
75077
|
await collectPackageJsonPaths(pluginRoot, pluginRoot, packageJsonPaths);
|
|
74986
75078
|
const packageLock = await readPackageLock(pluginRoot);
|
|
74987
75079
|
for (const packageJsonPath of packageJsonPaths) {
|
|
74988
|
-
const raw = await
|
|
75080
|
+
const raw = await readFile5(packageJsonPath, "utf8");
|
|
74989
75081
|
const parsed = JSON.parse(raw);
|
|
74990
75082
|
if (!isPlainRecord3(parsed))
|
|
74991
75083
|
continue;
|
|
74992
|
-
const packageDir =
|
|
74993
|
-
const sourcePackageDir =
|
|
75084
|
+
const packageDir = dirname12(packageJsonPath);
|
|
75085
|
+
const sourcePackageDir = join30(sourceRoot, relative4(pluginRoot, packageDir));
|
|
74994
75086
|
let changed = false;
|
|
74995
75087
|
for (const field of ["dependencies", "optionalDependencies", "peerDependencies"]) {
|
|
74996
75088
|
const dependencies = parsed[field];
|
|
@@ -75000,12 +75092,12 @@ async function rewriteCachedPackageLocalFileDependencies(pluginRoot, sourceRoot)
|
|
|
75000
75092
|
if (typeof specifier !== "string" || !specifier.startsWith("file:"))
|
|
75001
75093
|
continue;
|
|
75002
75094
|
const filePath = specifier.slice("file:".length);
|
|
75003
|
-
if (filePath.length === 0 ||
|
|
75095
|
+
if (filePath.length === 0 || isAbsolute6(filePath))
|
|
75004
75096
|
continue;
|
|
75005
|
-
const targetPath =
|
|
75097
|
+
const targetPath = resolve11(packageDir, filePath);
|
|
75006
75098
|
if (isPathInside(targetPath, pluginRoot))
|
|
75007
75099
|
continue;
|
|
75008
|
-
const sourceTargetPath =
|
|
75100
|
+
const sourceTargetPath = resolve11(sourcePackageDir, filePath);
|
|
75009
75101
|
dependencies[name] = `file:${sourceTargetPath}`;
|
|
75010
75102
|
rewritePackageLockFileDependency({
|
|
75011
75103
|
dependencyName: name,
|
|
@@ -75028,9 +75120,9 @@ async function rewriteCachedPackageLocalFileDependencies(pluginRoot, sourceRoot)
|
|
|
75028
75120
|
`);
|
|
75029
75121
|
}
|
|
75030
75122
|
async function readPackageLock(pluginRoot) {
|
|
75031
|
-
const path7 =
|
|
75123
|
+
const path7 = join30(pluginRoot, "package-lock.json");
|
|
75032
75124
|
try {
|
|
75033
|
-
const parsed = JSON.parse(await
|
|
75125
|
+
const parsed = JSON.parse(await readFile5(path7, "utf8"));
|
|
75034
75126
|
return { path: path7, value: isPlainRecord3(parsed) ? parsed : null, changed: false };
|
|
75035
75127
|
} catch (error) {
|
|
75036
75128
|
if (error instanceof Error && "code" in error && error.code === "ENOENT") {
|
|
@@ -75087,16 +75179,16 @@ function canonicalizeExistingPath(path7) {
|
|
|
75087
75179
|
}
|
|
75088
75180
|
}
|
|
75089
75181
|
async function collectPackageJsonPaths(directory, root, paths) {
|
|
75090
|
-
const entries = await
|
|
75182
|
+
const entries = await readdir3(directory, { withFileTypes: true });
|
|
75091
75183
|
if (entries.some((entry) => entry.isFile() && entry.name === "package.json")) {
|
|
75092
|
-
paths.push(
|
|
75184
|
+
paths.push(join30(directory, "package.json"));
|
|
75093
75185
|
}
|
|
75094
75186
|
for (const entry of entries) {
|
|
75095
75187
|
if (!entry.isDirectory())
|
|
75096
75188
|
continue;
|
|
75097
75189
|
if (entry.name === "node_modules" || entry.name === ".git" || entry.name === "dist")
|
|
75098
75190
|
continue;
|
|
75099
|
-
const childPath =
|
|
75191
|
+
const childPath = join30(directory, entry.name);
|
|
75100
75192
|
if (!isPathInside(childPath, root))
|
|
75101
75193
|
continue;
|
|
75102
75194
|
await collectPackageJsonPaths(childPath, root, paths);
|
|
@@ -75105,15 +75197,15 @@ async function collectPackageJsonPaths(directory, root, paths) {
|
|
|
75105
75197
|
|
|
75106
75198
|
// packages/omo-codex/src/install/codex-cache-mcp-manifest.ts
|
|
75107
75199
|
init_resolve2();
|
|
75108
|
-
import { readFile as
|
|
75109
|
-
import { join as
|
|
75200
|
+
import { readFile as readFile6, writeFile as writeFile3 } from "node:fs/promises";
|
|
75201
|
+
import { join as join31, sep as sep3 } from "node:path";
|
|
75110
75202
|
var CODEGRAPH_RELATIVE_ARGS = new Set(["components/codegraph/dist/serve.js", "./components/codegraph/dist/serve.js"]);
|
|
75111
75203
|
var CONTEXT7_API_KEY_ENV = "CONTEXT7_API_KEY";
|
|
75112
75204
|
async function rewriteCachedMcpManifest(pluginRoot, sourceRoot = pluginRoot, options = {}) {
|
|
75113
|
-
const manifestPath =
|
|
75205
|
+
const manifestPath = join31(pluginRoot, ".mcp.json");
|
|
75114
75206
|
if (!await fileExistsStrict(manifestPath))
|
|
75115
75207
|
return;
|
|
75116
|
-
const raw = await
|
|
75208
|
+
const raw = await readFile6(manifestPath, "utf8");
|
|
75117
75209
|
const parsed = JSON.parse(raw);
|
|
75118
75210
|
if (!isPlainRecord3(parsed) || !isPlainRecord3(parsed.mcpServers))
|
|
75119
75211
|
return;
|
|
@@ -75134,7 +75226,7 @@ async function rewriteCachedMcpManifest(pluginRoot, sourceRoot = pluginRoot, opt
|
|
|
75134
75226
|
if (bundledMcpRuntimeArg !== null)
|
|
75135
75227
|
return bundledMcpRuntimeArg;
|
|
75136
75228
|
if (CODEGRAPH_RELATIVE_ARGS.has(arg))
|
|
75137
|
-
return
|
|
75229
|
+
return join31(pluginRoot, "components", "codegraph", "dist", "serve.js");
|
|
75138
75230
|
if (arg.startsWith("./") || arg.startsWith("../"))
|
|
75139
75231
|
return resolveCachedRuntimePath(pluginRoot, sourceRoot, arg);
|
|
75140
75232
|
return arg;
|
|
@@ -75214,10 +75306,10 @@ function isPlaceholderContext7ApiKey(value) {
|
|
|
75214
75306
|
return normalized.length === 0 || normalized === "your api key";
|
|
75215
75307
|
}
|
|
75216
75308
|
async function rewriteCachedManifestRoot(pluginRoot, fromRoot, toRoot) {
|
|
75217
|
-
const manifestPath =
|
|
75309
|
+
const manifestPath = join31(pluginRoot, ".mcp.json");
|
|
75218
75310
|
if (!await fileExistsStrict(manifestPath))
|
|
75219
75311
|
return;
|
|
75220
|
-
const raw = await
|
|
75312
|
+
const raw = await readFile6(manifestPath, "utf8");
|
|
75221
75313
|
const parsed = JSON.parse(raw);
|
|
75222
75314
|
if (!isPlainRecord3(parsed) || !isPlainRecord3(parsed.mcpServers))
|
|
75223
75315
|
return;
|
|
@@ -75249,15 +75341,15 @@ async function rewriteCachedManifestRoot(pluginRoot, fromRoot, toRoot) {
|
|
|
75249
75341
|
}
|
|
75250
75342
|
|
|
75251
75343
|
// packages/omo-codex/src/install/codex-hook-targets.ts
|
|
75252
|
-
import { readFile as
|
|
75253
|
-
import { join as
|
|
75344
|
+
import { readFile as readFile7 } from "node:fs/promises";
|
|
75345
|
+
import { join as join32, sep as sep4 } from "node:path";
|
|
75254
75346
|
var PLUGIN_ROOT_TARGET_PATTERN = /\$\{PLUGIN_ROOT\}[\\/]+([^"']+)/g;
|
|
75255
75347
|
async function findMissingHookCommandTargets(pluginRoot) {
|
|
75256
75348
|
const commands = [];
|
|
75257
75349
|
for (const manifestPath of await hookManifestPaths(pluginRoot)) {
|
|
75258
75350
|
if (!await fileExistsStrict(manifestPath))
|
|
75259
75351
|
continue;
|
|
75260
|
-
const parsed = JSON.parse(await
|
|
75352
|
+
const parsed = JSON.parse(await readFile7(manifestPath, "utf8"));
|
|
75261
75353
|
collectCommands(parsed, commands);
|
|
75262
75354
|
}
|
|
75263
75355
|
const missing = [];
|
|
@@ -75267,7 +75359,7 @@ async function findMissingHookCommandTargets(pluginRoot) {
|
|
|
75267
75359
|
const targetSuffix = match[1];
|
|
75268
75360
|
if (targetSuffix === undefined)
|
|
75269
75361
|
continue;
|
|
75270
|
-
const target =
|
|
75362
|
+
const target = join32(pluginRoot, ...targetSuffix.split(/[\\/]+/));
|
|
75271
75363
|
if (seen.has(target))
|
|
75272
75364
|
continue;
|
|
75273
75365
|
seen.add(target);
|
|
@@ -75278,17 +75370,17 @@ async function findMissingHookCommandTargets(pluginRoot) {
|
|
|
75278
75370
|
return missing;
|
|
75279
75371
|
}
|
|
75280
75372
|
async function hookManifestPaths(pluginRoot) {
|
|
75281
|
-
const pluginManifestPath =
|
|
75373
|
+
const pluginManifestPath = join32(pluginRoot, ".codex-plugin", "plugin.json");
|
|
75282
75374
|
if (!await fileExistsStrict(pluginManifestPath))
|
|
75283
|
-
return [
|
|
75284
|
-
const parsed = JSON.parse(await
|
|
75375
|
+
return [join32(pluginRoot, "hooks", "hooks.json")];
|
|
75376
|
+
const parsed = JSON.parse(await readFile7(pluginManifestPath, "utf8"));
|
|
75285
75377
|
if (!isPlainRecord3(parsed))
|
|
75286
75378
|
return [];
|
|
75287
75379
|
if (typeof parsed.hooks === "string" && parsed.hooks.trim() !== "") {
|
|
75288
|
-
return [
|
|
75380
|
+
return [join32(pluginRoot, stripDotSlash(parsed.hooks))];
|
|
75289
75381
|
}
|
|
75290
75382
|
if (Array.isArray(parsed.hooks)) {
|
|
75291
|
-
return parsed.hooks.filter((hookPath) => typeof hookPath === "string" && hookPath.trim() !== "").map((hookPath) =>
|
|
75383
|
+
return parsed.hooks.filter((hookPath) => typeof hookPath === "string" && hookPath.trim() !== "").map((hookPath) => join32(pluginRoot, stripDotSlash(hookPath)));
|
|
75292
75384
|
}
|
|
75293
75385
|
return [];
|
|
75294
75386
|
}
|
|
@@ -75324,9 +75416,9 @@ async function installCachedPlugin(input) {
|
|
|
75324
75416
|
await maybeRunNpmInstall(input.sourcePath, input.runCommand);
|
|
75325
75417
|
await maybeRunNpmBuild(input.sourcePath, input.runCommand);
|
|
75326
75418
|
}
|
|
75327
|
-
const targetPath =
|
|
75419
|
+
const targetPath = join33(input.codexHome, "plugins", "cache", input.marketplaceName, input.name, input.version);
|
|
75328
75420
|
const tempPath = createTempSiblingPath(targetPath);
|
|
75329
|
-
await
|
|
75421
|
+
await rm4(tempPath, { recursive: true, force: true });
|
|
75330
75422
|
try {
|
|
75331
75423
|
await copyDirectory(input.sourcePath, tempPath);
|
|
75332
75424
|
await rewriteCachedPackageLocalFileDependencies(tempPath, input.sourcePath);
|
|
@@ -75342,20 +75434,20 @@ async function installCachedPlugin(input) {
|
|
|
75342
75434
|
await assertHookCommandTargets(tempPath);
|
|
75343
75435
|
await promoteDirectory(tempPath, targetPath, input.renameDirectory ?? rename);
|
|
75344
75436
|
} catch (error) {
|
|
75345
|
-
await
|
|
75437
|
+
await rm4(tempPath, { recursive: true, force: true });
|
|
75346
75438
|
throw error;
|
|
75347
75439
|
}
|
|
75348
75440
|
return { name: input.name, version: input.version, path: targetPath };
|
|
75349
75441
|
}
|
|
75350
75442
|
async function maybeRunNpmInstall(cwd, runCommand, args = ["install"]) {
|
|
75351
|
-
if (!await fileExistsStrict(
|
|
75443
|
+
if (!await fileExistsStrict(join33(cwd, "package.json")))
|
|
75352
75444
|
return;
|
|
75353
75445
|
await runCommand("npm", args, { cwd });
|
|
75354
75446
|
}
|
|
75355
75447
|
async function maybeRunNpmBuild(cwd, runCommand) {
|
|
75356
|
-
if (!await fileExistsStrict(
|
|
75448
|
+
if (!await fileExistsStrict(join33(cwd, "package.json")))
|
|
75357
75449
|
return;
|
|
75358
|
-
const packageJson = JSON.parse(await
|
|
75450
|
+
const packageJson = JSON.parse(await readFile8(join33(cwd, "package.json"), "utf8"));
|
|
75359
75451
|
if (!isPlainRecord3(packageJson))
|
|
75360
75452
|
return;
|
|
75361
75453
|
const scripts = packageJson.scripts;
|
|
@@ -75364,9 +75456,9 @@ async function maybeRunNpmBuild(cwd, runCommand) {
|
|
|
75364
75456
|
await runCommand("npm", ["run", "build"], { cwd });
|
|
75365
75457
|
}
|
|
75366
75458
|
async function maybeRunNpmSyncSkills(cwd, runCommand) {
|
|
75367
|
-
if (!await fileExistsStrict(
|
|
75459
|
+
if (!await fileExistsStrict(join33(cwd, "package.json")))
|
|
75368
75460
|
return;
|
|
75369
|
-
const packageJson = JSON.parse(await
|
|
75461
|
+
const packageJson = JSON.parse(await readFile8(join33(cwd, "package.json"), "utf8"));
|
|
75370
75462
|
if (!isPlainRecord3(packageJson))
|
|
75371
75463
|
return;
|
|
75372
75464
|
const scripts = packageJson.scripts;
|
|
@@ -75375,18 +75467,18 @@ async function maybeRunNpmSyncSkills(cwd, runCommand) {
|
|
|
75375
75467
|
await runCommand("npm", ["run", "sync:skills"], { cwd });
|
|
75376
75468
|
}
|
|
75377
75469
|
function createTempSiblingPath(targetPath) {
|
|
75378
|
-
return
|
|
75470
|
+
return join33(dirname13(targetPath), `.tmp-${basename7(targetPath)}-${process.pid}-${Date.now()}`);
|
|
75379
75471
|
}
|
|
75380
75472
|
function createBackupSiblingPath(targetPath) {
|
|
75381
|
-
return
|
|
75473
|
+
return join33(dirname13(targetPath), `.backup-${basename7(targetPath)}-${process.pid}-${Date.now()}`);
|
|
75382
75474
|
}
|
|
75383
75475
|
async function copyDirectory(sourcePath, targetPath) {
|
|
75384
|
-
await mkdir3(
|
|
75476
|
+
await mkdir3(dirname13(targetPath), { recursive: true });
|
|
75385
75477
|
await cp2(sourcePath, targetPath, { recursive: true, filter: (source) => shouldCopyPluginPath(source, sourcePath) });
|
|
75386
75478
|
}
|
|
75387
75479
|
async function promoteDirectory(tempPath, targetPath, renameDirectory) {
|
|
75388
75480
|
const backupPath = createBackupSiblingPath(targetPath);
|
|
75389
|
-
await
|
|
75481
|
+
await rm4(backupPath, { recursive: true, force: true });
|
|
75390
75482
|
let backupMoved = false;
|
|
75391
75483
|
try {
|
|
75392
75484
|
if (await fileExistsStrict(targetPath)) {
|
|
@@ -75400,12 +75492,12 @@ async function promoteDirectory(tempPath, targetPath, renameDirectory) {
|
|
|
75400
75492
|
throw error;
|
|
75401
75493
|
}
|
|
75402
75494
|
if (backupMoved)
|
|
75403
|
-
await
|
|
75495
|
+
await rm4(backupPath, { recursive: true, force: true });
|
|
75404
75496
|
}
|
|
75405
75497
|
async function restoreBackupDirectory(backupPath, targetPath, renameDirectory) {
|
|
75406
75498
|
if (!await fileExistsStrict(backupPath))
|
|
75407
75499
|
return;
|
|
75408
|
-
await
|
|
75500
|
+
await rm4(targetPath, { recursive: true, force: true });
|
|
75409
75501
|
await renameDirectory(backupPath, targetPath);
|
|
75410
75502
|
}
|
|
75411
75503
|
function shouldCopyPluginPath(path7, root) {
|
|
@@ -75421,18 +75513,18 @@ var removedSparkshellPromptSurfaceFiles = new Set(["directive.md", "plugin.json"
|
|
|
75421
75513
|
var removedSparkshellTextFilePattern = /\.(?:json|md|toml|ya?ml)$/i;
|
|
75422
75514
|
async function assertNoRemovedSparkshellPromptReferences(pluginRoot) {
|
|
75423
75515
|
for (const filePath of await listRemovedSparkshellPromptSurfaceFiles(pluginRoot, "")) {
|
|
75424
|
-
const content = await
|
|
75516
|
+
const content = await readFile8(join33(pluginRoot, filePath), "utf8");
|
|
75425
75517
|
if (!removedSparkshellReferencePattern.test(content))
|
|
75426
75518
|
continue;
|
|
75427
75519
|
throw new Error(`removed sparkshell reference found in Codex plugin prompt surface: ${filePath}`);
|
|
75428
75520
|
}
|
|
75429
75521
|
}
|
|
75430
75522
|
async function listRemovedSparkshellPromptSurfaceFiles(pluginRoot, relativeDirectory) {
|
|
75431
|
-
const directory = relativeDirectory === "" ? pluginRoot :
|
|
75432
|
-
const entries = await
|
|
75523
|
+
const directory = relativeDirectory === "" ? pluginRoot : join33(pluginRoot, relativeDirectory);
|
|
75524
|
+
const entries = await readdir4(directory, { withFileTypes: true });
|
|
75433
75525
|
const files = [];
|
|
75434
75526
|
for (const entry of entries) {
|
|
75435
|
-
const relativePath = relativeDirectory === "" ? entry.name :
|
|
75527
|
+
const relativePath = relativeDirectory === "" ? entry.name : join33(relativeDirectory, entry.name);
|
|
75436
75528
|
if (entry.isDirectory()) {
|
|
75437
75529
|
if (shouldDescendIntoRemovedSparkshellPromptSurface(relativePath)) {
|
|
75438
75530
|
files.push(...await listRemovedSparkshellPromptSurfaceFiles(pluginRoot, relativePath));
|
|
@@ -75472,29 +75564,29 @@ async function copyRootRuntimeDists(input) {
|
|
|
75472
75564
|
if (repoRoot === null)
|
|
75473
75565
|
return;
|
|
75474
75566
|
for (const runtimePath of ["dist/cli", "dist/cli-node"]) {
|
|
75475
|
-
const sourcePath =
|
|
75476
|
-
if (!await fileExistsStrict(
|
|
75567
|
+
const sourcePath = join33(repoRoot, runtimePath);
|
|
75568
|
+
if (!await fileExistsStrict(join33(sourcePath, "index.js")))
|
|
75477
75569
|
continue;
|
|
75478
|
-
await mkdir3(
|
|
75479
|
-
await cp2(sourcePath,
|
|
75570
|
+
await mkdir3(dirname13(join33(input.pluginRoot, runtimePath)), { recursive: true });
|
|
75571
|
+
await cp2(sourcePath, join33(input.pluginRoot, runtimePath), { recursive: true });
|
|
75480
75572
|
}
|
|
75481
75573
|
}
|
|
75482
75574
|
function repoRootForCodexPluginSource(sourcePath) {
|
|
75483
|
-
const codexPackageRoot =
|
|
75484
|
-
const packagesRoot =
|
|
75575
|
+
const codexPackageRoot = dirname13(sourcePath);
|
|
75576
|
+
const packagesRoot = dirname13(codexPackageRoot);
|
|
75485
75577
|
if (basename7(sourcePath) !== "plugin")
|
|
75486
75578
|
return null;
|
|
75487
75579
|
if (basename7(codexPackageRoot) !== "omo-codex")
|
|
75488
75580
|
return null;
|
|
75489
75581
|
if (basename7(packagesRoot) !== "packages")
|
|
75490
75582
|
return null;
|
|
75491
|
-
return
|
|
75583
|
+
return dirname13(packagesRoot);
|
|
75492
75584
|
}
|
|
75493
75585
|
// packages/omo-codex/src/install/codex-cache-prune.ts
|
|
75494
|
-
import { lstat as
|
|
75495
|
-
import { join as
|
|
75586
|
+
import { lstat as lstat5, readdir as readdir5, rm as rm5, stat as stat4 } from "node:fs/promises";
|
|
75587
|
+
import { join as join34 } from "node:path";
|
|
75496
75588
|
async function pruneMarketplaceCache(input) {
|
|
75497
|
-
const cacheRoot =
|
|
75589
|
+
const cacheRoot = join34(input.codexHome, "plugins", "cache", input.marketplaceName);
|
|
75498
75590
|
if (!await fileExistsStrict(cacheRoot))
|
|
75499
75591
|
return;
|
|
75500
75592
|
const keep = new Set(input.keepPluginNames);
|
|
@@ -75502,28 +75594,28 @@ async function pruneMarketplaceCache(input) {
|
|
|
75502
75594
|
for (const entry of entries) {
|
|
75503
75595
|
if (!entry.isDirectory() || keep.has(entry.name))
|
|
75504
75596
|
continue;
|
|
75505
|
-
await
|
|
75597
|
+
await rm5(join34(cacheRoot, entry.name), { recursive: true, force: true });
|
|
75506
75598
|
}
|
|
75507
75599
|
}
|
|
75508
75600
|
async function pruneMarketplacePluginCaches(input) {
|
|
75509
|
-
const cacheRoot =
|
|
75601
|
+
const cacheRoot = join34(input.codexHome, "plugins", "cache", input.marketplaceName);
|
|
75510
75602
|
if (!await fileExistsStrict(cacheRoot))
|
|
75511
75603
|
return;
|
|
75512
75604
|
for (const pluginName of input.pluginNames) {
|
|
75513
|
-
await
|
|
75605
|
+
await rm5(join34(cacheRoot, pluginName), { recursive: true, force: true });
|
|
75514
75606
|
}
|
|
75515
75607
|
const remainingEntries = await readCacheEntryNames(cacheRoot);
|
|
75516
75608
|
if (remainingEntries.length === 0) {
|
|
75517
|
-
await
|
|
75609
|
+
await rm5(cacheRoot, { recursive: true, force: true });
|
|
75518
75610
|
}
|
|
75519
75611
|
}
|
|
75520
75612
|
async function readCacheEntries(path7) {
|
|
75521
75613
|
const emptyEntries = [];
|
|
75522
|
-
return readCacheRoot(path7, () =>
|
|
75614
|
+
return readCacheRoot(path7, () => readdir5(path7, { withFileTypes: true }), emptyEntries);
|
|
75523
75615
|
}
|
|
75524
75616
|
async function readCacheEntryNames(path7) {
|
|
75525
75617
|
const emptyNames = [];
|
|
75526
|
-
return readCacheRoot(path7, () =>
|
|
75618
|
+
return readCacheRoot(path7, () => readdir5(path7), emptyNames);
|
|
75527
75619
|
}
|
|
75528
75620
|
async function readCacheRoot(path7, readEntries, fallback) {
|
|
75529
75621
|
try {
|
|
@@ -75538,7 +75630,7 @@ async function readCacheRoot(path7, readEntries, fallback) {
|
|
|
75538
75630
|
}
|
|
75539
75631
|
async function isBrokenCacheSymlink(path7) {
|
|
75540
75632
|
try {
|
|
75541
|
-
const entry = await
|
|
75633
|
+
const entry = await lstat5(path7);
|
|
75542
75634
|
if (!entry.isSymbolicLink())
|
|
75543
75635
|
return false;
|
|
75544
75636
|
} catch (error) {
|
|
@@ -75547,7 +75639,7 @@ async function isBrokenCacheSymlink(path7) {
|
|
|
75547
75639
|
throw error;
|
|
75548
75640
|
}
|
|
75549
75641
|
try {
|
|
75550
|
-
await
|
|
75642
|
+
await stat4(path7);
|
|
75551
75643
|
return false;
|
|
75552
75644
|
} catch (error) {
|
|
75553
75645
|
if (isNodeErrorWithCode(error) && error.code === "ENOENT")
|
|
@@ -75556,25 +75648,47 @@ async function isBrokenCacheSymlink(path7) {
|
|
|
75556
75648
|
}
|
|
75557
75649
|
}
|
|
75558
75650
|
// packages/omo-codex/src/install/codex-cached-marketplace-manifest.ts
|
|
75559
|
-
import { mkdir as mkdir4, writeFile as writeFile4 } from "node:fs/promises";
|
|
75560
|
-
import { join as
|
|
75651
|
+
import { mkdir as mkdir4, rename as rename2, rm as rm6, stat as stat5, writeFile as writeFile4 } from "node:fs/promises";
|
|
75652
|
+
import { join as join35 } from "node:path";
|
|
75561
75653
|
async function writeCachedMarketplaceManifest(input) {
|
|
75562
|
-
const marketplaceDir =
|
|
75654
|
+
const marketplaceDir = join35(input.marketplaceRoot, ".agents", "plugins");
|
|
75563
75655
|
await mkdir4(marketplaceDir, { recursive: true });
|
|
75564
|
-
|
|
75565
|
-
|
|
75566
|
-
|
|
75567
|
-
|
|
75568
|
-
|
|
75569
|
-
|
|
75570
|
-
|
|
75656
|
+
for (const plugin of input.plugins) {
|
|
75657
|
+
const pluginPath = join35(input.marketplaceRoot, plugin.name, plugin.version);
|
|
75658
|
+
if (!await isDirectory2(pluginPath))
|
|
75659
|
+
throw new Error(`Cannot write cached marketplace manifest: ${pluginPath} does not exist`);
|
|
75660
|
+
}
|
|
75661
|
+
const manifestPath = join35(marketplaceDir, "marketplace.json");
|
|
75662
|
+
const tempPath = join35(marketplaceDir, `.marketplace.json.tmp-${process.pid}-${Date.now()}`);
|
|
75663
|
+
try {
|
|
75664
|
+
await writeFile4(tempPath, `${JSON.stringify({
|
|
75665
|
+
name: input.marketplaceName,
|
|
75666
|
+
plugins: input.plugins.map((plugin) => ({
|
|
75667
|
+
name: plugin.name,
|
|
75668
|
+
source: { source: "local", path: `./${plugin.name}/${plugin.version}` }
|
|
75669
|
+
}))
|
|
75670
|
+
}, null, "\t")}
|
|
75571
75671
|
`);
|
|
75672
|
+
await rename2(tempPath, manifestPath);
|
|
75673
|
+
} catch (error) {
|
|
75674
|
+
await rm6(tempPath, { force: true });
|
|
75675
|
+
throw error;
|
|
75676
|
+
}
|
|
75677
|
+
}
|
|
75678
|
+
async function isDirectory2(path7) {
|
|
75679
|
+
try {
|
|
75680
|
+
return (await stat5(path7)).isDirectory();
|
|
75681
|
+
} catch (error) {
|
|
75682
|
+
if (error instanceof Error && "code" in error && error.code === "ENOENT")
|
|
75683
|
+
return false;
|
|
75684
|
+
throw error;
|
|
75685
|
+
}
|
|
75572
75686
|
}
|
|
75573
75687
|
|
|
75574
75688
|
// packages/omo-codex/src/install/codex-package-layout.ts
|
|
75575
75689
|
import { existsSync as existsSync27 } from "node:fs";
|
|
75576
|
-
import { readFile as
|
|
75577
|
-
import { join as
|
|
75690
|
+
import { readFile as readFile9 } from "node:fs/promises";
|
|
75691
|
+
import { join as join36 } from "node:path";
|
|
75578
75692
|
var PACKAGED_CODEX_INSTALLER_NAMES = new Set([
|
|
75579
75693
|
"@code-yeongyu/lazycodex",
|
|
75580
75694
|
"@code-yeongyu/lazycodex-ai",
|
|
@@ -75584,20 +75698,20 @@ var PACKAGED_CODEX_INSTALLER_NAMES = new Set([
|
|
|
75584
75698
|
"oh-my-openagent"
|
|
75585
75699
|
]);
|
|
75586
75700
|
async function shouldBuildSourcePackages(repoRoot) {
|
|
75587
|
-
if (existsSync27(
|
|
75701
|
+
if (existsSync27(join36(repoRoot, "packages", "omo-opencode", "src", "index.ts")))
|
|
75588
75702
|
return true;
|
|
75589
|
-
const packageJsonPath =
|
|
75703
|
+
const packageJsonPath = join36(repoRoot, "package.json");
|
|
75590
75704
|
if (!existsSync27(packageJsonPath))
|
|
75591
75705
|
return true;
|
|
75592
|
-
const packageJson = JSON.parse(await
|
|
75706
|
+
const packageJson = JSON.parse(await readFile9(packageJsonPath, "utf8"));
|
|
75593
75707
|
if (!isPlainRecord3(packageJson) || typeof packageJson.name !== "string")
|
|
75594
75708
|
return true;
|
|
75595
75709
|
return !PACKAGED_CODEX_INSTALLER_NAMES.has(packageJson.name);
|
|
75596
75710
|
}
|
|
75597
75711
|
|
|
75598
75712
|
// packages/omo-codex/src/install/codex-config-toml.ts
|
|
75599
|
-
import { mkdir as mkdir5, readFile as
|
|
75600
|
-
import { dirname as
|
|
75713
|
+
import { mkdir as mkdir5, readFile as readFile11 } from "node:fs/promises";
|
|
75714
|
+
import { dirname as dirname15 } from "node:path";
|
|
75601
75715
|
|
|
75602
75716
|
// packages/omo-codex/src/install/toml-section-editor.ts
|
|
75603
75717
|
function findTomlSection(config, header) {
|
|
@@ -75955,13 +76069,13 @@ function tomlKeySegment(value) {
|
|
|
75955
76069
|
}
|
|
75956
76070
|
|
|
75957
76071
|
// packages/omo-codex/src/install/codex-config-atomic-write.ts
|
|
75958
|
-
import { lstat as
|
|
75959
|
-
import { basename as basename8, dirname as
|
|
76072
|
+
import { lstat as lstat6, readlink as readlink4, realpath, rename as rename3, unlink, writeFile as writeFile5 } from "node:fs/promises";
|
|
76073
|
+
import { basename as basename8, dirname as dirname14, isAbsolute as isAbsolute7, join as join37, resolve as resolve12 } from "node:path";
|
|
75960
76074
|
var RENAME_RETRY_DELAYS_MS = [10, 25, 50];
|
|
75961
76075
|
var RETRIABLE_RENAME_CODES = new Set(["EPERM", "EBUSY"]);
|
|
75962
76076
|
async function writeFileAtomic(targetPath, data) {
|
|
75963
76077
|
const writeTarget = await resolveSymlinkTarget(targetPath);
|
|
75964
|
-
const temporaryPath =
|
|
76078
|
+
const temporaryPath = join37(dirname14(writeTarget), `.tmp-${basename8(writeTarget)}-${process.pid}-${Date.now()}`);
|
|
75965
76079
|
await writeFile5(temporaryPath, data);
|
|
75966
76080
|
try {
|
|
75967
76081
|
await renameWithRetry(temporaryPath, writeTarget);
|
|
@@ -75976,7 +76090,7 @@ async function writeFileAtomic(targetPath, data) {
|
|
|
75976
76090
|
}
|
|
75977
76091
|
async function resolveSymlinkTarget(targetPath) {
|
|
75978
76092
|
try {
|
|
75979
|
-
const linkStats = await
|
|
76093
|
+
const linkStats = await lstat6(targetPath);
|
|
75980
76094
|
if (!linkStats.isSymbolicLink())
|
|
75981
76095
|
return targetPath;
|
|
75982
76096
|
} catch (error) {
|
|
@@ -75989,14 +76103,14 @@ async function resolveSymlinkTarget(targetPath) {
|
|
|
75989
76103
|
} catch (error) {
|
|
75990
76104
|
if (!(error instanceof Error))
|
|
75991
76105
|
throw error;
|
|
75992
|
-
const linkValue = await
|
|
75993
|
-
return
|
|
76106
|
+
const linkValue = await readlink4(targetPath);
|
|
76107
|
+
return isAbsolute7(linkValue) ? linkValue : resolve12(dirname14(targetPath), linkValue);
|
|
75994
76108
|
}
|
|
75995
76109
|
}
|
|
75996
76110
|
async function renameWithRetry(fromPath, toPath) {
|
|
75997
76111
|
for (let attempt = 0;; attempt += 1) {
|
|
75998
76112
|
try {
|
|
75999
|
-
await
|
|
76113
|
+
await rename3(fromPath, toPath);
|
|
76000
76114
|
return;
|
|
76001
76115
|
} catch (error) {
|
|
76002
76116
|
if (!isRetriableRenameError(error) || attempt >= RENAME_RETRY_DELAYS_MS.length) {
|
|
@@ -76331,8 +76445,8 @@ function isRootSetting(line, key) {
|
|
|
76331
76445
|
}
|
|
76332
76446
|
|
|
76333
76447
|
// packages/omo-codex/src/install/codex-model-catalog.ts
|
|
76334
|
-
import { readFile as
|
|
76335
|
-
import { join as
|
|
76448
|
+
import { readFile as readFile10 } from "node:fs/promises";
|
|
76449
|
+
import { join as join38 } from "node:path";
|
|
76336
76450
|
var FALLBACK_CODEX_MODEL_CATALOG = {
|
|
76337
76451
|
current: {
|
|
76338
76452
|
model: "gpt-5.5",
|
|
@@ -76351,9 +76465,9 @@ var FALLBACK_CODEX_MODEL_CATALOG = {
|
|
|
76351
76465
|
]
|
|
76352
76466
|
};
|
|
76353
76467
|
async function readCodexModelCatalog(codexPackageRoot) {
|
|
76354
|
-
const catalogPath =
|
|
76468
|
+
const catalogPath = join38(codexPackageRoot, "plugin", "model-catalog.json");
|
|
76355
76469
|
try {
|
|
76356
|
-
const parsed = JSON.parse(await
|
|
76470
|
+
const parsed = JSON.parse(await readFile10(catalogPath, "utf8"));
|
|
76357
76471
|
return parseCodexModelCatalog(parsed) ?? FALLBACK_CODEX_MODEL_CATALOG;
|
|
76358
76472
|
} catch (error) {
|
|
76359
76473
|
if (error instanceof Error)
|
|
@@ -76487,10 +76601,10 @@ function readBooleanSetting(sectionText, key) {
|
|
|
76487
76601
|
|
|
76488
76602
|
// packages/omo-codex/src/install/codex-config-toml.ts
|
|
76489
76603
|
async function updateCodexConfig(input) {
|
|
76490
|
-
await mkdir5(
|
|
76604
|
+
await mkdir5(dirname15(input.configPath), { recursive: true });
|
|
76491
76605
|
let config = "";
|
|
76492
76606
|
if (await exists(input.configPath))
|
|
76493
|
-
config = await
|
|
76607
|
+
config = await readFile11(input.configPath, "utf8");
|
|
76494
76608
|
const pluginSet = new Set(input.pluginNames);
|
|
76495
76609
|
for (const legacyMarketplaceName of legacyMarketplaceNames(input.marketplaceName)) {
|
|
76496
76610
|
config = removeMarketplaceBlock(config, legacyMarketplaceName);
|
|
@@ -76526,7 +76640,7 @@ async function updateCodexConfig(input) {
|
|
|
76526
76640
|
}
|
|
76527
76641
|
async function exists(path7) {
|
|
76528
76642
|
try {
|
|
76529
|
-
await
|
|
76643
|
+
await readFile11(path7, "utf8");
|
|
76530
76644
|
return true;
|
|
76531
76645
|
} catch (error) {
|
|
76532
76646
|
if (error instanceof Error)
|
|
@@ -76537,8 +76651,8 @@ async function exists(path7) {
|
|
|
76537
76651
|
|
|
76538
76652
|
// packages/omo-codex/src/install/codex-hook-trust.ts
|
|
76539
76653
|
import { createHash as createHash2 } from "node:crypto";
|
|
76540
|
-
import { readFile as
|
|
76541
|
-
import { join as
|
|
76654
|
+
import { readFile as readFile12 } from "node:fs/promises";
|
|
76655
|
+
import { join as join39 } from "node:path";
|
|
76542
76656
|
var EVENT_LABELS = new Map([
|
|
76543
76657
|
["PreToolUse", "pre_tool_use"],
|
|
76544
76658
|
["PermissionRequest", "permission_request"],
|
|
@@ -76552,18 +76666,18 @@ var EVENT_LABELS = new Map([
|
|
|
76552
76666
|
["Stop", "stop"]
|
|
76553
76667
|
]);
|
|
76554
76668
|
async function trustedHookStatesForPlugin(input) {
|
|
76555
|
-
const manifestPath =
|
|
76669
|
+
const manifestPath = join39(input.pluginRoot, ".codex-plugin", "plugin.json");
|
|
76556
76670
|
if (!await exists2(manifestPath))
|
|
76557
76671
|
return [];
|
|
76558
|
-
const manifest = JSON.parse(await
|
|
76672
|
+
const manifest = JSON.parse(await readFile12(manifestPath, "utf8"));
|
|
76559
76673
|
if (!isPlainRecord3(manifest))
|
|
76560
76674
|
return [];
|
|
76561
76675
|
const states = [];
|
|
76562
76676
|
for (const hookPath of hookManifestPaths2(manifest.hooks)) {
|
|
76563
|
-
const hooksPath =
|
|
76677
|
+
const hooksPath = join39(input.pluginRoot, hookPath);
|
|
76564
76678
|
if (!await exists2(hooksPath))
|
|
76565
76679
|
continue;
|
|
76566
|
-
const parsed = JSON.parse(await
|
|
76680
|
+
const parsed = JSON.parse(await readFile12(hooksPath, "utf8"));
|
|
76567
76681
|
if (!isPlainRecord3(parsed) || !isPlainRecord3(parsed.hooks))
|
|
76568
76682
|
continue;
|
|
76569
76683
|
states.push(...trustedHookStatesForHooksFile({
|
|
@@ -76646,7 +76760,7 @@ function stripDotSlash2(value) {
|
|
|
76646
76760
|
}
|
|
76647
76761
|
async function exists2(path7) {
|
|
76648
76762
|
try {
|
|
76649
|
-
await
|
|
76763
|
+
await readFile12(path7, "utf8");
|
|
76650
76764
|
return true;
|
|
76651
76765
|
} catch (error) {
|
|
76652
76766
|
if (error instanceof Error)
|
|
@@ -76661,8 +76775,8 @@ var resolveGitBashForCurrentProcess2 = (input = {}) => {
|
|
|
76661
76775
|
return toCodexResolution(resolveGitBashForCurrentProcess(input));
|
|
76662
76776
|
};
|
|
76663
76777
|
async function prepareGitBashForInstall(input) {
|
|
76664
|
-
const
|
|
76665
|
-
const initialResolution =
|
|
76778
|
+
const resolve13 = input.resolveGitBash ?? (() => resolveGitBashForCurrentProcess2({ platform: input.platform, env: input.env }));
|
|
76779
|
+
const initialResolution = resolve13();
|
|
76666
76780
|
return initialResolution;
|
|
76667
76781
|
}
|
|
76668
76782
|
function toCodexResolution(resolution) {
|
|
@@ -76686,12 +76800,12 @@ function toCodexResolution(resolution) {
|
|
|
76686
76800
|
}
|
|
76687
76801
|
|
|
76688
76802
|
// packages/omo-codex/src/install/link-cached-plugin-agents.ts
|
|
76689
|
-
import { copyFile, lstat as
|
|
76690
|
-
import { basename as basename9, join as
|
|
76803
|
+
import { copyFile, lstat as lstat8, mkdir as mkdir6, readFile as readFile14, readdir as readdir6, rm as rm8, writeFile as writeFile6 } from "node:fs/promises";
|
|
76804
|
+
import { basename as basename9, join as join41 } from "node:path";
|
|
76691
76805
|
|
|
76692
76806
|
// packages/omo-codex/src/install/retired-managed-agent-purge.ts
|
|
76693
|
-
import { lstat as
|
|
76694
|
-
import { join as
|
|
76807
|
+
import { lstat as lstat7, readFile as readFile13, rm as rm7 } from "node:fs/promises";
|
|
76808
|
+
import { join as join40 } from "node:path";
|
|
76695
76809
|
var RETIRED_MANAGED_AGENT_FILES = [
|
|
76696
76810
|
{
|
|
76697
76811
|
fileName: "codex-ultrawork-reviewer.toml",
|
|
@@ -76703,20 +76817,20 @@ var RETIRED_MANAGED_AGENT_FILES = [
|
|
|
76703
76817
|
}
|
|
76704
76818
|
];
|
|
76705
76819
|
async function purgeRetiredManagedAgentFiles(input) {
|
|
76706
|
-
const agentsDir =
|
|
76820
|
+
const agentsDir = join40(input.codexHome, "agents");
|
|
76707
76821
|
if (!await exists3(agentsDir))
|
|
76708
76822
|
return;
|
|
76709
76823
|
for (const retiredAgent of RETIRED_MANAGED_AGENT_FILES) {
|
|
76710
|
-
const agentPath =
|
|
76824
|
+
const agentPath = join40(agentsDir, retiredAgent.fileName);
|
|
76711
76825
|
if (!await exists3(agentPath))
|
|
76712
76826
|
continue;
|
|
76713
|
-
const agentStat = await
|
|
76827
|
+
const agentStat = await lstat7(agentPath);
|
|
76714
76828
|
if (agentStat.isDirectory() && !agentStat.isSymbolicLink())
|
|
76715
76829
|
continue;
|
|
76716
76830
|
const content = await readTextIfExists(agentPath);
|
|
76717
76831
|
if (content === null || !hasRequiredMarkers(content, retiredAgent.requiredMarkers))
|
|
76718
76832
|
continue;
|
|
76719
|
-
await
|
|
76833
|
+
await rm7(agentPath, { force: true });
|
|
76720
76834
|
}
|
|
76721
76835
|
}
|
|
76722
76836
|
function hasRequiredMarkers(content, markers) {
|
|
@@ -76724,7 +76838,7 @@ function hasRequiredMarkers(content, markers) {
|
|
|
76724
76838
|
}
|
|
76725
76839
|
async function readTextIfExists(path7) {
|
|
76726
76840
|
try {
|
|
76727
|
-
return await
|
|
76841
|
+
return await readFile13(path7, "utf8");
|
|
76728
76842
|
} catch (error) {
|
|
76729
76843
|
if (nodeErrorCode(error) === "ENOENT")
|
|
76730
76844
|
return null;
|
|
@@ -76733,7 +76847,7 @@ async function readTextIfExists(path7) {
|
|
|
76733
76847
|
}
|
|
76734
76848
|
async function exists3(path7) {
|
|
76735
76849
|
try {
|
|
76736
|
-
await
|
|
76850
|
+
await lstat7(path7);
|
|
76737
76851
|
return true;
|
|
76738
76852
|
} catch (error) {
|
|
76739
76853
|
if (nodeErrorCode(error) !== "ENOENT")
|
|
@@ -76750,15 +76864,15 @@ function nodeErrorCode(error) {
|
|
|
76750
76864
|
// packages/omo-codex/src/install/link-cached-plugin-agents.ts
|
|
76751
76865
|
var MANIFEST_FILE = ".installed-agents.json";
|
|
76752
76866
|
async function capturePreservedAgentReasoning(input) {
|
|
76753
|
-
const agentsDir =
|
|
76867
|
+
const agentsDir = join41(input.codexHome, "agents");
|
|
76754
76868
|
if (!await exists4(agentsDir))
|
|
76755
76869
|
return new Map;
|
|
76756
76870
|
const preserved = new Map;
|
|
76757
|
-
const agentEntries = await
|
|
76871
|
+
const agentEntries = await readdir6(agentsDir, { withFileTypes: true });
|
|
76758
76872
|
for (const entry of agentEntries) {
|
|
76759
76873
|
if (!entry.name.endsWith(".toml"))
|
|
76760
76874
|
continue;
|
|
76761
|
-
const content = await readTextIfExists2(
|
|
76875
|
+
const content = await readTextIfExists2(join41(agentsDir, entry.name));
|
|
76762
76876
|
if (content === null)
|
|
76763
76877
|
continue;
|
|
76764
76878
|
const effort = extractReasoningEffort(content);
|
|
@@ -76768,15 +76882,15 @@ async function capturePreservedAgentReasoning(input) {
|
|
|
76768
76882
|
return preserved;
|
|
76769
76883
|
}
|
|
76770
76884
|
async function capturePreservedAgentServiceTier(input) {
|
|
76771
|
-
const agentsDir =
|
|
76885
|
+
const agentsDir = join41(input.codexHome, "agents");
|
|
76772
76886
|
if (!await exists4(agentsDir))
|
|
76773
76887
|
return new Map;
|
|
76774
76888
|
const preserved = new Map;
|
|
76775
|
-
const agentEntries = await
|
|
76889
|
+
const agentEntries = await readdir6(agentsDir, { withFileTypes: true });
|
|
76776
76890
|
for (const entry of agentEntries) {
|
|
76777
76891
|
if (!entry.name.endsWith(".toml"))
|
|
76778
76892
|
continue;
|
|
76779
|
-
const content = await readTextIfExists2(
|
|
76893
|
+
const content = await readTextIfExists2(join41(agentsDir, entry.name));
|
|
76780
76894
|
if (content === null)
|
|
76781
76895
|
continue;
|
|
76782
76896
|
preserved.set(agentNameFromToml(entry.name), extractServiceTier(content));
|
|
@@ -76790,13 +76904,13 @@ async function linkCachedPluginAgents(input) {
|
|
|
76790
76904
|
await writeManifest(input.pluginRoot, []);
|
|
76791
76905
|
return [];
|
|
76792
76906
|
}
|
|
76793
|
-
const agentsDir =
|
|
76907
|
+
const agentsDir = join41(input.codexHome, "agents");
|
|
76794
76908
|
await mkdir6(agentsDir, { recursive: true });
|
|
76795
76909
|
const linked = [];
|
|
76796
76910
|
for (const agentPath of bundledAgents) {
|
|
76797
76911
|
const agentFileName = basename9(agentPath);
|
|
76798
76912
|
const agentName = agentNameFromToml(agentFileName);
|
|
76799
|
-
const linkPath =
|
|
76913
|
+
const linkPath = join41(agentsDir, agentFileName);
|
|
76800
76914
|
await replaceWithCopy(linkPath, agentPath);
|
|
76801
76915
|
await restorePreservedReasoning({
|
|
76802
76916
|
agentName,
|
|
@@ -76817,7 +76931,7 @@ async function linkCachedPluginAgents(input) {
|
|
|
76817
76931
|
async function restorePreservedServiceTier(input) {
|
|
76818
76932
|
if (!input.preserved)
|
|
76819
76933
|
return;
|
|
76820
|
-
const content = await
|
|
76934
|
+
const content = await readFile14(input.linkPath, "utf8");
|
|
76821
76935
|
if (extractServiceTier(content) === input.value)
|
|
76822
76936
|
return;
|
|
76823
76937
|
const replacement = replaceServiceTier(content, input.value);
|
|
@@ -76826,22 +76940,22 @@ async function restorePreservedServiceTier(input) {
|
|
|
76826
76940
|
await writeFile6(input.linkPath, replacement.content);
|
|
76827
76941
|
}
|
|
76828
76942
|
async function discoverBundledAgents(pluginRoot) {
|
|
76829
|
-
const componentsRoot =
|
|
76943
|
+
const componentsRoot = join41(pluginRoot, "components");
|
|
76830
76944
|
if (!await exists4(componentsRoot))
|
|
76831
76945
|
return [];
|
|
76832
|
-
const componentEntries = await
|
|
76946
|
+
const componentEntries = await readdir6(componentsRoot, { withFileTypes: true });
|
|
76833
76947
|
const agents = [];
|
|
76834
76948
|
for (const entry of componentEntries) {
|
|
76835
76949
|
if (!entry.isDirectory())
|
|
76836
76950
|
continue;
|
|
76837
|
-
const agentsRoot =
|
|
76951
|
+
const agentsRoot = join41(componentsRoot, entry.name, "agents");
|
|
76838
76952
|
if (!await exists4(agentsRoot))
|
|
76839
76953
|
continue;
|
|
76840
|
-
const agentEntries = await
|
|
76954
|
+
const agentEntries = await readdir6(agentsRoot, { withFileTypes: true });
|
|
76841
76955
|
for (const file2 of agentEntries) {
|
|
76842
76956
|
if (!file2.isFile() || !file2.name.endsWith(".toml"))
|
|
76843
76957
|
continue;
|
|
76844
|
-
agents.push(
|
|
76958
|
+
agents.push(join41(agentsRoot, file2.name));
|
|
76845
76959
|
}
|
|
76846
76960
|
}
|
|
76847
76961
|
agents.sort();
|
|
@@ -76854,14 +76968,14 @@ async function replaceWithCopy(linkPath, target) {
|
|
|
76854
76968
|
async function prepareReplacement(linkPath) {
|
|
76855
76969
|
if (!await exists4(linkPath))
|
|
76856
76970
|
return;
|
|
76857
|
-
const entryStat = await
|
|
76971
|
+
const entryStat = await lstat8(linkPath);
|
|
76858
76972
|
if (entryStat.isDirectory() && !entryStat.isSymbolicLink()) {
|
|
76859
76973
|
throw new Error(`${linkPath} already exists and is a directory; refusing to replace`);
|
|
76860
76974
|
}
|
|
76861
|
-
await
|
|
76975
|
+
await rm8(linkPath, { force: true });
|
|
76862
76976
|
}
|
|
76863
76977
|
async function writeManifest(pluginRoot, agentPaths) {
|
|
76864
|
-
const manifestPath =
|
|
76978
|
+
const manifestPath = join41(pluginRoot, MANIFEST_FILE);
|
|
76865
76979
|
const payload = { agents: [...agentPaths].sort() };
|
|
76866
76980
|
await writeFile6(manifestPath, `${JSON.stringify(payload, null, "\t")}
|
|
76867
76981
|
`);
|
|
@@ -76869,7 +76983,7 @@ async function writeManifest(pluginRoot, agentPaths) {
|
|
|
76869
76983
|
async function restorePreservedReasoning(input) {
|
|
76870
76984
|
if (input.value === undefined)
|
|
76871
76985
|
return;
|
|
76872
|
-
const content = await
|
|
76986
|
+
const content = await readFile14(input.target, "utf8");
|
|
76873
76987
|
const bundledEffort = extractReasoningEffort(content);
|
|
76874
76988
|
if (bundledEffort === input.value)
|
|
76875
76989
|
return;
|
|
@@ -76880,7 +76994,7 @@ async function restorePreservedReasoning(input) {
|
|
|
76880
76994
|
}
|
|
76881
76995
|
async function readTextIfExists2(path7) {
|
|
76882
76996
|
try {
|
|
76883
|
-
return await
|
|
76997
|
+
return await readFile14(path7, "utf8");
|
|
76884
76998
|
} catch (error) {
|
|
76885
76999
|
if (nodeErrorCode2(error) === "ENOENT")
|
|
76886
77000
|
return null;
|
|
@@ -76973,7 +77087,7 @@ function parseJsonString(value) {
|
|
|
76973
77087
|
}
|
|
76974
77088
|
async function exists4(path7) {
|
|
76975
77089
|
try {
|
|
76976
|
-
await
|
|
77090
|
+
await lstat8(path7);
|
|
76977
77091
|
return true;
|
|
76978
77092
|
} catch (error) {
|
|
76979
77093
|
if (nodeErrorCode2(error) !== "ENOENT")
|
|
@@ -76988,12 +77102,12 @@ function nodeErrorCode2(error) {
|
|
|
76988
77102
|
}
|
|
76989
77103
|
|
|
76990
77104
|
// packages/omo-codex/src/install/codex-marketplace.ts
|
|
76991
|
-
import { readFile as
|
|
76992
|
-
import { join as
|
|
77105
|
+
import { readFile as readFile15 } from "node:fs/promises";
|
|
77106
|
+
import { join as join42 } from "node:path";
|
|
76993
77107
|
var DEFAULT_MARKETPLACE_PATH = "packages/omo-codex/marketplace.json";
|
|
76994
77108
|
async function readMarketplace(repoRoot, options) {
|
|
76995
|
-
const marketplacePath = options?.marketplacePath ??
|
|
76996
|
-
const raw = await
|
|
77109
|
+
const marketplacePath = options?.marketplacePath ?? join42(repoRoot, DEFAULT_MARKETPLACE_PATH);
|
|
77110
|
+
const raw = await readFile15(marketplacePath, "utf8");
|
|
76997
77111
|
const parsed = JSON.parse(raw);
|
|
76998
77112
|
if (!isPlainRecord3(parsed))
|
|
76999
77113
|
throw new Error("marketplace.json must be an object");
|
|
@@ -77011,10 +77125,10 @@ async function readMarketplace(repoRoot, options) {
|
|
|
77011
77125
|
function resolvePluginSource(repoRoot, plugin, options) {
|
|
77012
77126
|
const sourcePath = localSourcePath(options?.pathOverride ?? plugin.source);
|
|
77013
77127
|
const relativePath = sourcePath.slice(2);
|
|
77014
|
-
return
|
|
77128
|
+
return join42(repoRoot, ...relativePath.split(/[\\/]/));
|
|
77015
77129
|
}
|
|
77016
77130
|
async function readPluginManifest(pluginRoot) {
|
|
77017
|
-
const raw = await
|
|
77131
|
+
const raw = await readFile15(join42(pluginRoot, ".codex-plugin", "plugin.json"), "utf8");
|
|
77018
77132
|
const parsed = JSON.parse(raw);
|
|
77019
77133
|
if (!isPlainRecord3(parsed))
|
|
77020
77134
|
throw new Error(`${pluginRoot} plugin.json must be an object`);
|
|
@@ -77095,8 +77209,8 @@ function validateLocalSourcePath(path7) {
|
|
|
77095
77209
|
}
|
|
77096
77210
|
|
|
77097
77211
|
// packages/omo-codex/src/install/codex-marketplace-snapshot.ts
|
|
77098
|
-
import { cp as cp3, mkdir as mkdir7, rename as
|
|
77099
|
-
import { join as
|
|
77212
|
+
import { cp as cp3, mkdir as mkdir7, rename as rename4, rm as rm9, writeFile as writeFile7 } from "node:fs/promises";
|
|
77213
|
+
import { join as join43, sep as sep6 } from "node:path";
|
|
77100
77214
|
var INSTALLED_MARKETPLACES_DIR = ".tmp/marketplaces";
|
|
77101
77215
|
async function writeInstalledMarketplaceSnapshot(input) {
|
|
77102
77216
|
const marketplaceRoot = installedMarketplaceRoot(input.codexHome, input.marketplace.name);
|
|
@@ -77109,29 +77223,29 @@ async function writeInstalledMarketplaceSnapshot(input) {
|
|
|
77109
77223
|
return snapshotPlugins;
|
|
77110
77224
|
}
|
|
77111
77225
|
function installedMarketplaceRoot(codexHome, marketplaceName) {
|
|
77112
|
-
return
|
|
77226
|
+
return join43(codexHome, INSTALLED_MARKETPLACES_DIR, marketplaceName);
|
|
77113
77227
|
}
|
|
77114
77228
|
async function writeMarketplaceManifest(marketplaceRoot, marketplace) {
|
|
77115
|
-
const manifestDir =
|
|
77229
|
+
const manifestDir = join43(marketplaceRoot, ".agents", "plugins");
|
|
77116
77230
|
await mkdir7(manifestDir, { recursive: true });
|
|
77117
|
-
const tempPath =
|
|
77231
|
+
const tempPath = join43(manifestDir, `.marketplace-${process.pid}-${Date.now()}.json.tmp`);
|
|
77118
77232
|
await writeFile7(tempPath, `${JSON.stringify(marketplace, null, "\t")}
|
|
77119
77233
|
`);
|
|
77120
|
-
await
|
|
77234
|
+
await rename4(tempPath, join43(manifestDir, "marketplace.json"));
|
|
77121
77235
|
}
|
|
77122
77236
|
async function writeSnapshotPlugin(marketplaceRoot, plugin) {
|
|
77123
|
-
const pluginsDir =
|
|
77237
|
+
const pluginsDir = join43(marketplaceRoot, "plugins");
|
|
77124
77238
|
await mkdir7(pluginsDir, { recursive: true });
|
|
77125
|
-
const targetPath =
|
|
77126
|
-
const tempPath =
|
|
77127
|
-
await
|
|
77239
|
+
const targetPath = join43(pluginsDir, plugin.name);
|
|
77240
|
+
const tempPath = join43(pluginsDir, `.tmp-${plugin.name}-${process.pid}-${Date.now()}`);
|
|
77241
|
+
await rm9(tempPath, { recursive: true, force: true });
|
|
77128
77242
|
await cp3(plugin.sourcePath, tempPath, {
|
|
77129
77243
|
recursive: true,
|
|
77130
77244
|
filter: (source) => shouldCopyMarketplaceSourcePath(source, plugin.sourcePath)
|
|
77131
77245
|
});
|
|
77132
77246
|
await copyBundledMcpRuntimeDists({ pluginRoot: tempPath, sourceRoot: plugin.sourcePath });
|
|
77133
|
-
await
|
|
77134
|
-
await
|
|
77247
|
+
await rm9(targetPath, { recursive: true, force: true });
|
|
77248
|
+
await rename4(tempPath, targetPath);
|
|
77135
77249
|
await rewriteCachedMcpManifest(targetPath, plugin.sourcePath);
|
|
77136
77250
|
return { name: plugin.name, path: targetPath };
|
|
77137
77251
|
}
|
|
@@ -77144,11 +77258,11 @@ function shouldCopyMarketplaceSourcePath(path7, root) {
|
|
|
77144
77258
|
}
|
|
77145
77259
|
|
|
77146
77260
|
// packages/omo-codex/src/install/lazycodex-version-stamp.ts
|
|
77147
|
-
import { readdir as
|
|
77148
|
-
import { join as
|
|
77261
|
+
import { readdir as readdir7, readFile as readFile16, writeFile as writeFile8 } from "node:fs/promises";
|
|
77262
|
+
import { join as join44 } from "node:path";
|
|
77149
77263
|
async function readDistributionManifest(repoRoot) {
|
|
77150
77264
|
try {
|
|
77151
|
-
const parsed = JSON.parse(await
|
|
77265
|
+
const parsed = JSON.parse(await readFile16(join44(repoRoot, "package.json"), "utf8"));
|
|
77152
77266
|
if (!isPlainRecord3(parsed) || typeof parsed.version !== "string" || parsed.version.trim().length === 0)
|
|
77153
77267
|
return;
|
|
77154
77268
|
return {
|
|
@@ -77168,19 +77282,19 @@ function resolveLazyCodexPluginVersion(input) {
|
|
|
77168
77282
|
return input.manifestVersion ?? "local";
|
|
77169
77283
|
}
|
|
77170
77284
|
async function stampLazyCodexPluginVersion(input) {
|
|
77171
|
-
const manifestPath =
|
|
77285
|
+
const manifestPath = join44(input.pluginRoot, ".codex-plugin", "plugin.json");
|
|
77172
77286
|
const hookPaths = await readPluginHookPaths(manifestPath);
|
|
77173
77287
|
await stampJsonVersion(manifestPath, input.version);
|
|
77174
|
-
await stampJsonVersion(
|
|
77288
|
+
await stampJsonVersion(join44(input.pluginRoot, "package.json"), input.version);
|
|
77175
77289
|
for (const hookPath of hookPaths) {
|
|
77176
|
-
await stampHookStatusMessages(
|
|
77290
|
+
await stampHookStatusMessages(join44(input.pluginRoot, hookPath), input.version);
|
|
77177
77291
|
}
|
|
77178
77292
|
await stampComponentVersions(input);
|
|
77179
77293
|
}
|
|
77180
77294
|
async function writeLazyCodexInstallSnapshot(input) {
|
|
77181
77295
|
if (input.distributionManifest === undefined)
|
|
77182
77296
|
return;
|
|
77183
|
-
await writeFile8(
|
|
77297
|
+
await writeFile8(join44(input.pluginRoot, "lazycodex-install.json"), `${JSON.stringify({
|
|
77184
77298
|
packageName: input.distributionManifest.name,
|
|
77185
77299
|
version: input.distributionManifest.version
|
|
77186
77300
|
}, null, "\t")}
|
|
@@ -77188,7 +77302,7 @@ async function writeLazyCodexInstallSnapshot(input) {
|
|
|
77188
77302
|
}
|
|
77189
77303
|
async function stampJsonVersion(path7, version) {
|
|
77190
77304
|
try {
|
|
77191
|
-
const parsed = JSON.parse(await
|
|
77305
|
+
const parsed = JSON.parse(await readFile16(path7, "utf8"));
|
|
77192
77306
|
if (!isPlainRecord3(parsed))
|
|
77193
77307
|
return;
|
|
77194
77308
|
parsed.version = version;
|
|
@@ -77202,7 +77316,7 @@ async function stampJsonVersion(path7, version) {
|
|
|
77202
77316
|
}
|
|
77203
77317
|
async function readPluginHookPaths(manifestPath) {
|
|
77204
77318
|
try {
|
|
77205
|
-
const parsed = JSON.parse(await
|
|
77319
|
+
const parsed = JSON.parse(await readFile16(manifestPath, "utf8"));
|
|
77206
77320
|
if (!isPlainRecord3(parsed))
|
|
77207
77321
|
return [];
|
|
77208
77322
|
if (typeof parsed.hooks === "string" && parsed.hooks.trim().length > 0)
|
|
@@ -77222,7 +77336,7 @@ function stripDotSlash3(path7) {
|
|
|
77222
77336
|
}
|
|
77223
77337
|
async function stampHookStatusMessages(path7, version) {
|
|
77224
77338
|
try {
|
|
77225
|
-
const parsed = JSON.parse(await
|
|
77339
|
+
const parsed = JSON.parse(await readFile16(path7, "utf8"));
|
|
77226
77340
|
if (!isPlainRecord3(parsed))
|
|
77227
77341
|
return;
|
|
77228
77342
|
stampHookGroups(parsed.hooks, version);
|
|
@@ -77237,16 +77351,16 @@ async function stampHookStatusMessages(path7, version) {
|
|
|
77237
77351
|
async function stampComponentVersions(input) {
|
|
77238
77352
|
let entries;
|
|
77239
77353
|
try {
|
|
77240
|
-
entries = await
|
|
77354
|
+
entries = await readdir7(join44(input.pluginRoot, "components"));
|
|
77241
77355
|
} catch (error) {
|
|
77242
77356
|
if (error instanceof Error)
|
|
77243
77357
|
return;
|
|
77244
77358
|
throw error;
|
|
77245
77359
|
}
|
|
77246
77360
|
for (const entry of entries) {
|
|
77247
|
-
const componentRoot =
|
|
77248
|
-
await stampJsonVersion(
|
|
77249
|
-
await stampHookStatusMessages(
|
|
77361
|
+
const componentRoot = join44(input.pluginRoot, "components", entry);
|
|
77362
|
+
await stampJsonVersion(join44(componentRoot, "package.json"), input.version);
|
|
77363
|
+
await stampHookStatusMessages(join44(componentRoot, "hooks", "hooks.json"), input.version);
|
|
77250
77364
|
}
|
|
77251
77365
|
}
|
|
77252
77366
|
function stampHookGroups(hooks, version) {
|
|
@@ -77299,8 +77413,8 @@ var defaultRunCommand = async (command, args, options) => {
|
|
|
77299
77413
|
};
|
|
77300
77414
|
|
|
77301
77415
|
// packages/omo-codex/src/install/codex-project-local-cleanup.ts
|
|
77302
|
-
import { copyFile as copyFile2, lstat as
|
|
77303
|
-
import { dirname as
|
|
77416
|
+
import { copyFile as copyFile2, lstat as lstat9, readFile as readFile17, writeFile as writeFile9 } from "node:fs/promises";
|
|
77417
|
+
import { dirname as dirname16, join as join45, resolve as resolve13 } from "node:path";
|
|
77304
77418
|
var LEGACY_AGENT_CONFLICT_KEYS = ["max_threads"];
|
|
77305
77419
|
var PROJECT_LOCAL_ARTIFACT_PATHS = [
|
|
77306
77420
|
".codex/hooks.json",
|
|
@@ -77319,7 +77433,7 @@ async function repairNearestProjectLocalCodexArtifacts(input) {
|
|
|
77319
77433
|
const artifacts = await collectProjectLocalArtifacts(project.artifactRoots);
|
|
77320
77434
|
const configs = [];
|
|
77321
77435
|
for (const configPath of project.configPaths) {
|
|
77322
|
-
const original = await
|
|
77436
|
+
const original = await readFile17(configPath, "utf8");
|
|
77323
77437
|
const repair = repairProjectLocalCodexConfigText(original);
|
|
77324
77438
|
if (!repair.changed) {
|
|
77325
77439
|
configs.push({
|
|
@@ -77403,37 +77517,37 @@ async function findProjectLocalCodexConfigs(startDirectory, codexHome) {
|
|
|
77403
77517
|
if (startDirectoryStat !== null && !startDirectoryStat.isDirectory()) {
|
|
77404
77518
|
throw new ProjectLocalCleanupStartDirectoryError(startDirectory);
|
|
77405
77519
|
}
|
|
77406
|
-
const codexHomeConfigPath = codexHome === undefined ? null :
|
|
77407
|
-
let current =
|
|
77520
|
+
const codexHomeConfigPath = codexHome === undefined ? null : join45(resolve13(codexHome), "config.toml");
|
|
77521
|
+
let current = resolve13(startDirectory);
|
|
77408
77522
|
const configPathsFromCwd = [];
|
|
77409
77523
|
while (true) {
|
|
77410
|
-
const configPath =
|
|
77524
|
+
const configPath = join45(current, ".codex", "config.toml");
|
|
77411
77525
|
if (await isRegularProjectLocalConfig(current, configPath)) {
|
|
77412
|
-
if (codexHomeConfigPath === null ||
|
|
77526
|
+
if (codexHomeConfigPath === null || resolve13(configPath) !== codexHomeConfigPath) {
|
|
77413
77527
|
configPathsFromCwd.push(configPath);
|
|
77414
77528
|
}
|
|
77415
77529
|
}
|
|
77416
|
-
if (await exists5(
|
|
77530
|
+
if (await exists5(join45(current, ".git"))) {
|
|
77417
77531
|
return configPathsFromCwd.length === 0 ? null : {
|
|
77418
77532
|
projectRoot: current,
|
|
77419
77533
|
configPaths: [...configPathsFromCwd].reverse(),
|
|
77420
77534
|
artifactRoots: artifactRootsForConfigPaths(configPathsFromCwd)
|
|
77421
77535
|
};
|
|
77422
77536
|
}
|
|
77423
|
-
const parent =
|
|
77537
|
+
const parent = dirname16(current);
|
|
77424
77538
|
if (parent === current) {
|
|
77425
77539
|
const nearestConfigPath = configPathsFromCwd[0];
|
|
77426
77540
|
return nearestConfigPath === undefined ? null : {
|
|
77427
|
-
projectRoot:
|
|
77541
|
+
projectRoot: dirname16(dirname16(nearestConfigPath)),
|
|
77428
77542
|
configPaths: [nearestConfigPath],
|
|
77429
|
-
artifactRoots: [
|
|
77543
|
+
artifactRoots: [dirname16(dirname16(nearestConfigPath))]
|
|
77430
77544
|
};
|
|
77431
77545
|
}
|
|
77432
77546
|
current = parent;
|
|
77433
77547
|
}
|
|
77434
77548
|
}
|
|
77435
77549
|
async function isRegularProjectLocalConfig(directory, configPath) {
|
|
77436
|
-
const codexDirStat = await maybeLstat(
|
|
77550
|
+
const codexDirStat = await maybeLstat(join45(directory, ".codex"));
|
|
77437
77551
|
if (codexDirStat === null || !codexDirStat.isDirectory() || codexDirStat.isSymbolicLink())
|
|
77438
77552
|
return false;
|
|
77439
77553
|
const configStat = await maybeLstat(configPath);
|
|
@@ -77442,7 +77556,7 @@ async function isRegularProjectLocalConfig(directory, configPath) {
|
|
|
77442
77556
|
function artifactRootsForConfigPaths(configPaths) {
|
|
77443
77557
|
const roots = [];
|
|
77444
77558
|
for (const configPath of configPaths) {
|
|
77445
|
-
const root =
|
|
77559
|
+
const root = dirname16(dirname16(configPath));
|
|
77446
77560
|
if (!roots.includes(root))
|
|
77447
77561
|
roots.push(root);
|
|
77448
77562
|
}
|
|
@@ -77453,7 +77567,7 @@ async function collectProjectLocalArtifacts(projectRoots) {
|
|
|
77453
77567
|
const seenPaths = new Set;
|
|
77454
77568
|
for (const projectRoot of projectRoots) {
|
|
77455
77569
|
for (const relativePath of PROJECT_LOCAL_ARTIFACT_PATHS) {
|
|
77456
|
-
const artifactPath =
|
|
77570
|
+
const artifactPath = join45(projectRoot, relativePath);
|
|
77457
77571
|
if (seenPaths.has(artifactPath))
|
|
77458
77572
|
continue;
|
|
77459
77573
|
const entryStat = await maybeLstat(artifactPath);
|
|
@@ -77487,7 +77601,7 @@ function formatBackupTimestamp(date) {
|
|
|
77487
77601
|
}
|
|
77488
77602
|
async function maybeLstat(path7) {
|
|
77489
77603
|
try {
|
|
77490
|
-
return await
|
|
77604
|
+
return await lstat9(path7);
|
|
77491
77605
|
} catch (error) {
|
|
77492
77606
|
if (nodeErrorCode3(error) === "ENOENT")
|
|
77493
77607
|
return null;
|
|
@@ -77528,34 +77642,34 @@ function formatUnknownError(error) {
|
|
|
77528
77642
|
}
|
|
77529
77643
|
|
|
77530
77644
|
// packages/omo-codex/src/install/lsp-daemon-reaper.ts
|
|
77531
|
-
import { readFile as
|
|
77645
|
+
import { readFile as readFile18, readdir as readdir8, rm as rm10 } from "node:fs/promises";
|
|
77532
77646
|
import { connect } from "node:net";
|
|
77533
|
-
import { join as
|
|
77647
|
+
import { join as join46 } from "node:path";
|
|
77534
77648
|
async function reapLspDaemons(codexHome, deps = {}) {
|
|
77535
77649
|
const killProcess = deps.killProcess ?? sendSigterm;
|
|
77536
77650
|
const isDaemonLive = deps.isDaemonLive ?? probeSocketLive;
|
|
77537
|
-
const daemonRoot =
|
|
77651
|
+
const daemonRoot = join46(codexHome, "codex-lsp", "daemon");
|
|
77538
77652
|
const reaped = [];
|
|
77539
77653
|
let entries;
|
|
77540
77654
|
try {
|
|
77541
|
-
entries = await
|
|
77655
|
+
entries = await readdir8(daemonRoot);
|
|
77542
77656
|
} catch {
|
|
77543
77657
|
return reaped;
|
|
77544
77658
|
}
|
|
77545
77659
|
for (const entry of entries) {
|
|
77546
|
-
const versionDir =
|
|
77547
|
-
const pid = await readPidFile(
|
|
77548
|
-
const socketPath = await readEndpointFile(
|
|
77660
|
+
const versionDir = join46(daemonRoot, entry);
|
|
77661
|
+
const pid = await readPidFile(join46(versionDir, "daemon.pid"));
|
|
77662
|
+
const socketPath = await readEndpointFile(join46(versionDir, "daemon.endpoint"));
|
|
77549
77663
|
if (pid !== null && socketPath !== null && await isDaemonLive(socketPath) && killProcess(pid)) {
|
|
77550
77664
|
reaped.push(pid);
|
|
77551
77665
|
}
|
|
77552
|
-
await
|
|
77666
|
+
await rm10(versionDir, { recursive: true, force: true });
|
|
77553
77667
|
}
|
|
77554
77668
|
return reaped;
|
|
77555
77669
|
}
|
|
77556
77670
|
async function readEndpointFile(path7) {
|
|
77557
77671
|
try {
|
|
77558
|
-
const content = (await
|
|
77672
|
+
const content = (await readFile18(path7, "utf8")).trim();
|
|
77559
77673
|
return content.length > 0 ? content : null;
|
|
77560
77674
|
} catch {
|
|
77561
77675
|
return null;
|
|
@@ -77563,18 +77677,18 @@ async function readEndpointFile(path7) {
|
|
|
77563
77677
|
}
|
|
77564
77678
|
async function readPidFile(path7) {
|
|
77565
77679
|
try {
|
|
77566
|
-
const pid = Number.parseInt((await
|
|
77680
|
+
const pid = Number.parseInt((await readFile18(path7, "utf8")).trim(), 10);
|
|
77567
77681
|
return Number.isInteger(pid) && pid > 0 ? pid : null;
|
|
77568
77682
|
} catch {
|
|
77569
77683
|
return null;
|
|
77570
77684
|
}
|
|
77571
77685
|
}
|
|
77572
77686
|
function probeSocketLive(socketPath, timeoutMs = 500) {
|
|
77573
|
-
return new Promise((
|
|
77687
|
+
return new Promise((resolve14) => {
|
|
77574
77688
|
const socket = connect(socketPath);
|
|
77575
77689
|
const done = (ok) => {
|
|
77576
77690
|
socket.destroy();
|
|
77577
|
-
|
|
77691
|
+
resolve14(ok);
|
|
77578
77692
|
};
|
|
77579
77693
|
const timer = setTimeout(() => done(false), timeoutMs);
|
|
77580
77694
|
timer.unref();
|
|
@@ -77599,24 +77713,24 @@ function sendSigterm(pid) {
|
|
|
77599
77713
|
|
|
77600
77714
|
// packages/omo-codex/src/install/codex-installer-bin-dir.ts
|
|
77601
77715
|
import { homedir as homedir5 } from "node:os";
|
|
77602
|
-
import { join as
|
|
77716
|
+
import { join as join47, resolve as resolve14 } from "node:path";
|
|
77603
77717
|
function resolveCodexInstallerBinDir(input) {
|
|
77604
77718
|
const explicitBinDir = input.binDir ?? input.env?.CODEX_LOCAL_BIN_DIR;
|
|
77605
77719
|
if (explicitBinDir !== undefined && explicitBinDir.trim().length > 0)
|
|
77606
|
-
return
|
|
77720
|
+
return resolve14(explicitBinDir.trim());
|
|
77607
77721
|
const homeDir = input.homeDir ?? homedir5();
|
|
77608
|
-
const defaultCodexHome =
|
|
77609
|
-
const resolvedCodexHome =
|
|
77722
|
+
const defaultCodexHome = resolve14(homeDir, ".codex");
|
|
77723
|
+
const resolvedCodexHome = resolve14(input.codexHome);
|
|
77610
77724
|
if (resolvedCodexHome !== defaultCodexHome)
|
|
77611
|
-
return
|
|
77612
|
-
return
|
|
77725
|
+
return join47(resolvedCodexHome, "bin");
|
|
77726
|
+
return resolve14(homeDir, ".local", "bin");
|
|
77613
77727
|
}
|
|
77614
77728
|
|
|
77615
77729
|
// packages/omo-codex/src/install/omo-sot-migration.ts
|
|
77616
|
-
import { join as
|
|
77730
|
+
import { join as join48 } from "node:path";
|
|
77617
77731
|
async function seedAndMigrateOmoSot(input) {
|
|
77618
77732
|
const commandEnv = { ...input.env };
|
|
77619
|
-
const scriptPath =
|
|
77733
|
+
const scriptPath = join48(input.repoRoot, "packages", "omo-codex", "plugin", "scripts", "migrate-omo-sot.mjs");
|
|
77620
77734
|
try {
|
|
77621
77735
|
await input.runCommand(process.execPath, [scriptPath, "--seed"], {
|
|
77622
77736
|
cwd: input.repoRoot,
|
|
@@ -77631,7 +77745,7 @@ async function seedAndMigrateOmoSot(input) {
|
|
|
77631
77745
|
|
|
77632
77746
|
// packages/omo-codex/src/install/install-ast-grep-sg.ts
|
|
77633
77747
|
init_src();
|
|
77634
|
-
import { join as
|
|
77748
|
+
import { join as join49 } from "node:path";
|
|
77635
77749
|
function describeResult(result) {
|
|
77636
77750
|
if (result.kind === "succeeded")
|
|
77637
77751
|
return null;
|
|
@@ -77645,7 +77759,7 @@ async function installAstGrepForCodex(options) {
|
|
|
77645
77759
|
return;
|
|
77646
77760
|
const platform = options.platform ?? process.platform;
|
|
77647
77761
|
const targetDir = astGrepRuntimeDir(options.codexHome, platform, options.arch ?? process.arch);
|
|
77648
|
-
const skillDir =
|
|
77762
|
+
const skillDir = join49(plugin.path, "skills", "ast-grep");
|
|
77649
77763
|
const installer = options.installer ?? runAstGrepSkillInstall;
|
|
77650
77764
|
try {
|
|
77651
77765
|
const result = await installer({ platform, skillDir, targetDir });
|
|
@@ -77678,9 +77792,9 @@ var SISYPHUS_LEGACY_CACHE_MARKETPLACES = ["lazycodex", "code-yeongyu-codex-plugi
|
|
|
77678
77792
|
async function runCodexInstaller(options = {}) {
|
|
77679
77793
|
const env3 = options.env ?? process.env;
|
|
77680
77794
|
const platform = options.platform ?? process.platform;
|
|
77681
|
-
const repoRoot =
|
|
77682
|
-
const codexHome =
|
|
77683
|
-
const projectDirectory =
|
|
77795
|
+
const repoRoot = resolve15(options.repoRoot ?? findRepoRoot({ importerDir: import.meta.dir, env: env3 }));
|
|
77796
|
+
const codexHome = resolve15(options.codexHome ?? env3.CODEX_HOME ?? join52(homedir6(), ".codex"));
|
|
77797
|
+
const projectDirectory = resolve15(options.projectDirectory ?? env3.OMO_CODEX_PROJECT ?? process.cwd());
|
|
77684
77798
|
const binDir = resolveCodexInstallerBinDir({ binDir: options.binDir, codexHome, env: env3 });
|
|
77685
77799
|
const runCommand = options.runCommand ?? defaultRunCommand;
|
|
77686
77800
|
const log4 = options.log ?? (() => {
|
|
@@ -77695,9 +77809,9 @@ async function runCodexInstaller(options = {}) {
|
|
|
77695
77809
|
if (!gitBashResolution.found) {
|
|
77696
77810
|
throw new Error(gitBashResolution.installHint);
|
|
77697
77811
|
}
|
|
77698
|
-
const codexPackageRoot =
|
|
77812
|
+
const codexPackageRoot = join52(repoRoot, "packages", "omo-codex");
|
|
77699
77813
|
const marketplace = await readMarketplace(repoRoot, {
|
|
77700
|
-
marketplacePath:
|
|
77814
|
+
marketplacePath: join52(codexPackageRoot, "marketplace.json")
|
|
77701
77815
|
});
|
|
77702
77816
|
const distributionManifest = await readDistributionManifest(repoRoot);
|
|
77703
77817
|
const installed = [];
|
|
@@ -77739,7 +77853,7 @@ async function runCodexInstaller(options = {}) {
|
|
|
77739
77853
|
if (runtimeLink !== null)
|
|
77740
77854
|
log4(`Linked ${runtimeLink.name} -> ${runtimeLink.target}`);
|
|
77741
77855
|
else
|
|
77742
|
-
log4(`Warning: skipped the omo runtime wrapper because ${
|
|
77856
|
+
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`);
|
|
77743
77857
|
}
|
|
77744
77858
|
pluginSources.push({ name: entry.name, sourcePath });
|
|
77745
77859
|
installed.push(plugin);
|
|
@@ -77793,13 +77907,13 @@ async function runCodexInstaller(options = {}) {
|
|
|
77793
77907
|
});
|
|
77794
77908
|
}
|
|
77795
77909
|
await reapLspDaemons(codexHome).catch(() => []);
|
|
77796
|
-
const marketplaceRoot =
|
|
77910
|
+
const marketplaceRoot = join52(codexHome, "plugins", "cache", marketplace.name);
|
|
77797
77911
|
await writeCachedMarketplaceManifest({
|
|
77798
77912
|
marketplaceName: marketplace.name,
|
|
77799
77913
|
marketplaceRoot,
|
|
77800
77914
|
plugins: installed
|
|
77801
77915
|
});
|
|
77802
|
-
const configPath =
|
|
77916
|
+
const configPath = join52(codexHome, "config.toml");
|
|
77803
77917
|
await updateCodexConfig({
|
|
77804
77918
|
configPath,
|
|
77805
77919
|
repoRoot: codexPackageRoot,
|
|
@@ -77859,25 +77973,25 @@ function findRepoRootFromImporter(importerDir) {
|
|
|
77859
77973
|
for (let depth = 0;depth <= 7; depth += 1) {
|
|
77860
77974
|
if (isRepoRootWithCodexPlugin(current))
|
|
77861
77975
|
return current;
|
|
77862
|
-
for (const wrapperPackageRoot of [
|
|
77976
|
+
for (const wrapperPackageRoot of [join52(current, "node_modules", "oh-my-openagent"), join52(current, "oh-my-openagent")]) {
|
|
77863
77977
|
if (isRepoRootWithCodexPlugin(wrapperPackageRoot))
|
|
77864
77978
|
return wrapperPackageRoot;
|
|
77865
77979
|
}
|
|
77866
|
-
current =
|
|
77980
|
+
current = resolve15(current, "..");
|
|
77867
77981
|
}
|
|
77868
77982
|
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");
|
|
77869
77983
|
}
|
|
77870
77984
|
function findRepoRoot(input) {
|
|
77871
77985
|
const wrapperPackageRoot = input.env?.OMO_WRAPPER_PACKAGE_ROOT;
|
|
77872
77986
|
if (wrapperPackageRoot !== undefined && wrapperPackageRoot.trim().length > 0) {
|
|
77873
|
-
const resolvedWrapperPackageRoot =
|
|
77987
|
+
const resolvedWrapperPackageRoot = resolve15(wrapperPackageRoot);
|
|
77874
77988
|
if (isRepoRootWithCodexPlugin(resolvedWrapperPackageRoot))
|
|
77875
77989
|
return resolvedWrapperPackageRoot;
|
|
77876
77990
|
}
|
|
77877
77991
|
return findRepoRootFromImporter(input.importerDir);
|
|
77878
77992
|
}
|
|
77879
77993
|
function isRepoRootWithCodexPlugin(repoRoot) {
|
|
77880
|
-
return existsSync30(
|
|
77994
|
+
return existsSync30(join52(repoRoot, "packages", "omo-codex", "plugin", ".codex-plugin", "plugin.json"));
|
|
77881
77995
|
}
|
|
77882
77996
|
function codexMarketplaceSource(marketplaceRoot) {
|
|
77883
77997
|
return { sourceType: "local", source: marketplaceRoot };
|
|
@@ -78005,20 +78119,20 @@ function dedupe(values) {
|
|
|
78005
78119
|
return deduped;
|
|
78006
78120
|
}
|
|
78007
78121
|
function defaultRunCommand2(command, args) {
|
|
78008
|
-
return new Promise((
|
|
78122
|
+
return new Promise((resolve16) => {
|
|
78009
78123
|
execFile2(command, [...args], { encoding: "utf8", windowsHide: true }, (error, stdout) => {
|
|
78010
|
-
|
|
78124
|
+
resolve16({ success: error === null, stdout });
|
|
78011
78125
|
});
|
|
78012
78126
|
});
|
|
78013
78127
|
}
|
|
78014
78128
|
// packages/omo-codex/src/install/codex-cleanup.ts
|
|
78015
|
-
import { lstat as
|
|
78129
|
+
import { lstat as lstat11, readFile as readFile20, readdir as readdir9, rm as rm11, rmdir } from "node:fs/promises";
|
|
78016
78130
|
import { homedir as homedir8 } from "node:os";
|
|
78017
|
-
import { isAbsolute as
|
|
78131
|
+
import { isAbsolute as isAbsolute10, join as join54, relative as relative7, resolve as resolve17 } from "node:path";
|
|
78018
78132
|
|
|
78019
78133
|
// packages/omo-codex/src/install/codex-cleanup-config.ts
|
|
78020
|
-
import { lstat as
|
|
78021
|
-
import { dirname as
|
|
78134
|
+
import { lstat as lstat10, mkdir as mkdir8, readFile as readFile19, writeFile as writeFile10 } from "node:fs/promises";
|
|
78135
|
+
import { dirname as dirname18 } from "node:path";
|
|
78022
78136
|
var MANAGED_MARKETPLACES = ["sisyphuslabs", "lazycodex", "code-yeongyu-codex-plugins"];
|
|
78023
78137
|
var LEGACY_MANAGED_CODEX_AGENT_NAMES_TO_PURGE2 = ["codex-ultrawork-reviewer"];
|
|
78024
78138
|
var CURRENT_MANAGED_CODEX_AGENT_NAMES2 = [
|
|
@@ -78047,12 +78161,12 @@ function cleanupCodexLightConfigText(config) {
|
|
|
78047
78161
|
async function cleanupCodexConfig(configPath, now) {
|
|
78048
78162
|
if (!await configExists(configPath))
|
|
78049
78163
|
return { changed: false };
|
|
78050
|
-
const original = await
|
|
78164
|
+
const original = await readFile19(configPath, "utf8");
|
|
78051
78165
|
const next = cleanupCodexLightConfigText(original);
|
|
78052
78166
|
if (next === original)
|
|
78053
78167
|
return { changed: false };
|
|
78054
78168
|
const backupPath = `${configPath}.backup-${formatBackupTimestamp2(now?.() ?? new Date)}`;
|
|
78055
|
-
await mkdir8(
|
|
78169
|
+
await mkdir8(dirname18(configPath), { recursive: true });
|
|
78056
78170
|
await writeFile10(backupPath, original);
|
|
78057
78171
|
await writeFile10(configPath, `${next.trimEnd()}
|
|
78058
78172
|
`);
|
|
@@ -78116,7 +78230,7 @@ function formatBackupTimestamp2(date) {
|
|
|
78116
78230
|
}
|
|
78117
78231
|
async function configExists(path7) {
|
|
78118
78232
|
try {
|
|
78119
|
-
await
|
|
78233
|
+
await lstat10(path7);
|
|
78120
78234
|
return true;
|
|
78121
78235
|
} catch (error) {
|
|
78122
78236
|
if (nodeErrorCode4(error) === "ENOENT")
|
|
@@ -78131,24 +78245,24 @@ function nodeErrorCode4(error) {
|
|
|
78131
78245
|
}
|
|
78132
78246
|
|
|
78133
78247
|
// packages/omo-codex/src/install/codex-cleanup-safety.ts
|
|
78134
|
-
import { dirname as
|
|
78248
|
+
import { dirname as dirname19, isAbsolute as isAbsolute9, join as join53, relative as relative6, resolve as resolve16 } from "node:path";
|
|
78135
78249
|
function validateManagedCleanupTarget(input) {
|
|
78136
|
-
if (!
|
|
78250
|
+
if (!isAbsolute9(input.path))
|
|
78137
78251
|
return skipped(input.path, "outside managed Codex cleanup scope");
|
|
78138
|
-
const codexHome =
|
|
78139
|
-
if (
|
|
78252
|
+
const codexHome = resolve16(input.codexHome);
|
|
78253
|
+
if (dirname19(codexHome) === codexHome)
|
|
78140
78254
|
return skipped(input.path, "Codex home resolves to a filesystem root");
|
|
78141
|
-
const target =
|
|
78255
|
+
const target = resolve16(input.path);
|
|
78142
78256
|
if (!isWithinDirectory(codexHome, target))
|
|
78143
78257
|
return skipped(input.path, "outside managed Codex cleanup scope");
|
|
78144
78258
|
if (target === codexHome)
|
|
78145
78259
|
return skipped(input.path, "outside managed Codex cleanup scope");
|
|
78146
78260
|
const exactManagedRoots = new Set([
|
|
78147
|
-
|
|
78148
|
-
|
|
78149
|
-
|
|
78150
|
-
|
|
78151
|
-
|
|
78261
|
+
resolve16(join53(codexHome, "plugins", "cache", "sisyphuslabs")),
|
|
78262
|
+
resolve16(join53(codexHome, ".tmp", "marketplaces", "sisyphuslabs")),
|
|
78263
|
+
resolve16(join53(codexHome, "runtime", "ast-grep")),
|
|
78264
|
+
resolve16(join53(codexHome, "runtime", "node")),
|
|
78265
|
+
resolve16(join53(codexHome, "plugins", "data", "omo-sisyphuslabs", "bootstrap"))
|
|
78152
78266
|
]);
|
|
78153
78267
|
if (exactManagedRoots.has(target))
|
|
78154
78268
|
return null;
|
|
@@ -78158,7 +78272,7 @@ function validateManagedCleanupTarget(input) {
|
|
|
78158
78272
|
}
|
|
78159
78273
|
function isWithinDirectory(parent, child) {
|
|
78160
78274
|
const relativePath = relative6(parent, child);
|
|
78161
|
-
return relativePath === "" || !relativePath.startsWith("..") && !
|
|
78275
|
+
return relativePath === "" || !relativePath.startsWith("..") && !isAbsolute9(relativePath);
|
|
78162
78276
|
}
|
|
78163
78277
|
function isManagedBootstrapDriftPath(codexHome, target) {
|
|
78164
78278
|
const relativePath = relative6(codexHome, target);
|
|
@@ -78178,8 +78292,8 @@ function skipped(path7, reason) {
|
|
|
78178
78292
|
var INSTALLED_AGENTS_MANIFEST = ".installed-agents.json";
|
|
78179
78293
|
async function cleanupCodexLight(input = {}) {
|
|
78180
78294
|
const env3 = input.env ?? process.env;
|
|
78181
|
-
const codexHome =
|
|
78182
|
-
const configPath =
|
|
78295
|
+
const codexHome = resolve17(input.codexHome ?? env3.CODEX_HOME ?? join54(homedir8(), ".codex"));
|
|
78296
|
+
const configPath = join54(codexHome, "config.toml");
|
|
78183
78297
|
const agentPaths = await collectInstalledAgentPaths(codexHome, configPath);
|
|
78184
78298
|
const configCleanup = await cleanupCodexConfig(configPath, input.now);
|
|
78185
78299
|
const agentCleanup = await removeManifestListedAgentLinks(codexHome, agentPaths);
|
|
@@ -78218,31 +78332,31 @@ async function cleanupCodexLight(input = {}) {
|
|
|
78218
78332
|
}
|
|
78219
78333
|
function managedGlobalStatePaths(codexHome) {
|
|
78220
78334
|
return [
|
|
78221
|
-
|
|
78222
|
-
|
|
78223
|
-
|
|
78224
|
-
|
|
78225
|
-
|
|
78335
|
+
join54(codexHome, "plugins", "cache", "sisyphuslabs"),
|
|
78336
|
+
join54(codexHome, ".tmp", "marketplaces", "sisyphuslabs"),
|
|
78337
|
+
join54(codexHome, "runtime", "ast-grep"),
|
|
78338
|
+
join54(codexHome, "runtime", "node"),
|
|
78339
|
+
join54(codexHome, "plugins", "data", "omo-sisyphuslabs", "bootstrap")
|
|
78226
78340
|
];
|
|
78227
78341
|
}
|
|
78228
78342
|
var BOOTSTRAP_DATA_GLOB_MAX_DEPTH = 5;
|
|
78229
78343
|
async function collectBootstrapDataDirsByGlob(codexHome) {
|
|
78230
78344
|
const results = [];
|
|
78231
|
-
await walkForManagedBootstrapDirs(
|
|
78345
|
+
await walkForManagedBootstrapDirs(join54(codexHome, "plugins"), 0, results);
|
|
78232
78346
|
return results;
|
|
78233
78347
|
}
|
|
78234
78348
|
async function walkForManagedBootstrapDirs(directory, depth, results) {
|
|
78235
78349
|
if (depth > BOOTSTRAP_DATA_GLOB_MAX_DEPTH)
|
|
78236
78350
|
return;
|
|
78237
|
-
const entries = await
|
|
78351
|
+
const entries = await readdir9(directory, { withFileTypes: true }).catch(() => null);
|
|
78238
78352
|
if (entries === null)
|
|
78239
78353
|
return;
|
|
78240
78354
|
for (const entry of entries) {
|
|
78241
78355
|
if (!entry.isDirectory())
|
|
78242
78356
|
continue;
|
|
78243
|
-
const childPath =
|
|
78357
|
+
const childPath = join54(directory, entry.name);
|
|
78244
78358
|
if (isManagedBootstrapOwnerName(entry.name)) {
|
|
78245
|
-
const bootstrapDir =
|
|
78359
|
+
const bootstrapDir = join54(childPath, "bootstrap");
|
|
78246
78360
|
if (await exists6(bootstrapDir))
|
|
78247
78361
|
results.push(bootstrapDir);
|
|
78248
78362
|
continue;
|
|
@@ -78266,9 +78380,9 @@ async function removeManagedPathBestEffort(path7, seams) {
|
|
|
78266
78380
|
}
|
|
78267
78381
|
async function attemptRemove(path7) {
|
|
78268
78382
|
try {
|
|
78269
|
-
if (await
|
|
78383
|
+
if (await lstat11(path7).catch(() => null) === null)
|
|
78270
78384
|
return false;
|
|
78271
|
-
await
|
|
78385
|
+
await rm11(path7, { recursive: true, force: true });
|
|
78272
78386
|
return true;
|
|
78273
78387
|
} catch {
|
|
78274
78388
|
return false;
|
|
@@ -78276,7 +78390,7 @@ async function attemptRemove(path7) {
|
|
|
78276
78390
|
}
|
|
78277
78391
|
async function pruneEmptyRuntimeDirBestEffort(codexHome) {
|
|
78278
78392
|
try {
|
|
78279
|
-
await rmdir(
|
|
78393
|
+
await rmdir(join54(codexHome, "runtime"));
|
|
78280
78394
|
} catch (error) {
|
|
78281
78395
|
if (isExpectedRuntimePruneFailure(error))
|
|
78282
78396
|
return;
|
|
@@ -78288,14 +78402,14 @@ function isExpectedRuntimePruneFailure(error) {
|
|
|
78288
78402
|
}
|
|
78289
78403
|
async function collectInstalledAgentPaths(codexHome, configPath) {
|
|
78290
78404
|
const manifestPaths = [
|
|
78291
|
-
|
|
78405
|
+
join54(codexHome, ".tmp", "marketplaces", "sisyphuslabs", "plugins", "omo", INSTALLED_AGENTS_MANIFEST)
|
|
78292
78406
|
];
|
|
78293
|
-
const versionRoot =
|
|
78407
|
+
const versionRoot = join54(codexHome, "plugins", "cache", "sisyphuslabs", "omo");
|
|
78294
78408
|
if (await exists6(versionRoot)) {
|
|
78295
|
-
const entries = await
|
|
78409
|
+
const entries = await readdir9(versionRoot, { withFileTypes: true });
|
|
78296
78410
|
for (const entry of entries) {
|
|
78297
78411
|
if (entry.isDirectory())
|
|
78298
|
-
manifestPaths.push(
|
|
78412
|
+
manifestPaths.push(join54(versionRoot, entry.name, INSTALLED_AGENTS_MANIFEST));
|
|
78299
78413
|
}
|
|
78300
78414
|
}
|
|
78301
78415
|
const paths = new Set;
|
|
@@ -78312,19 +78426,19 @@ async function collectInstalledAgentPaths(codexHome, configPath) {
|
|
|
78312
78426
|
async function readManagedAgentPathsFromConfig(codexHome, configPath) {
|
|
78313
78427
|
if (!await exists6(configPath))
|
|
78314
78428
|
return [];
|
|
78315
|
-
const config = await
|
|
78316
|
-
return MANAGED_CODEX_AGENT_NAMES2.filter((agentName) => config.includes(`config_file = ${JSON.stringify(`./agents/${agentName}.toml`)}`)).map((agentName) =>
|
|
78429
|
+
const config = await readFile20(configPath, "utf8");
|
|
78430
|
+
return MANAGED_CODEX_AGENT_NAMES2.filter((agentName) => config.includes(`config_file = ${JSON.stringify(`./agents/${agentName}.toml`)}`)).map((agentName) => join54(codexHome, "agents", `${agentName}.toml`));
|
|
78317
78431
|
}
|
|
78318
78432
|
async function readInstalledAgentManifest(manifestPath) {
|
|
78319
78433
|
if (!await exists6(manifestPath))
|
|
78320
78434
|
return [];
|
|
78321
|
-
const parsed = JSON.parse(await
|
|
78435
|
+
const parsed = JSON.parse(await readFile20(manifestPath, "utf8"));
|
|
78322
78436
|
if (!isPlainRecord3(parsed) || !Array.isArray(parsed.agents))
|
|
78323
78437
|
return [];
|
|
78324
78438
|
return parsed.agents.filter((path7) => typeof path7 === "string");
|
|
78325
78439
|
}
|
|
78326
78440
|
async function removeManifestListedAgentLinks(codexHome, paths) {
|
|
78327
|
-
const agentsDir =
|
|
78441
|
+
const agentsDir = join54(codexHome, "agents");
|
|
78328
78442
|
const removed = [];
|
|
78329
78443
|
const skipped2 = [];
|
|
78330
78444
|
for (const path7 of paths) {
|
|
@@ -78339,16 +78453,16 @@ async function removeManifestListedAgentLinks(codexHome, paths) {
|
|
|
78339
78453
|
skipped2.push(path7);
|
|
78340
78454
|
continue;
|
|
78341
78455
|
}
|
|
78342
|
-
await
|
|
78456
|
+
await rm11(path7, { force: true });
|
|
78343
78457
|
removed.push(path7);
|
|
78344
78458
|
}
|
|
78345
78459
|
return { removed, skipped: skipped2 };
|
|
78346
78460
|
}
|
|
78347
78461
|
function isSafeManagedAgentPath(agentsDir, path7) {
|
|
78348
|
-
if (!
|
|
78462
|
+
if (!isAbsolute10(path7))
|
|
78349
78463
|
return false;
|
|
78350
78464
|
const relativePath = relative7(agentsDir, path7);
|
|
78351
|
-
if (relativePath === "" || relativePath.startsWith("..") ||
|
|
78465
|
+
if (relativePath === "" || relativePath.startsWith("..") || isAbsolute10(relativePath))
|
|
78352
78466
|
return false;
|
|
78353
78467
|
const fileName = relativePath.split(/[\\/]/).pop();
|
|
78354
78468
|
if (fileName === undefined)
|
|
@@ -78360,7 +78474,7 @@ async function exists6(path7) {
|
|
|
78360
78474
|
}
|
|
78361
78475
|
async function maybeLstat2(path7) {
|
|
78362
78476
|
try {
|
|
78363
|
-
return await
|
|
78477
|
+
return await lstat11(path7);
|
|
78364
78478
|
} catch (error) {
|
|
78365
78479
|
if (nodeErrorCode5(error) === "ENOENT")
|
|
78366
78480
|
return null;
|
|
@@ -78408,19 +78522,19 @@ init_provider_availability();
|
|
|
78408
78522
|
|
|
78409
78523
|
// packages/omo-opencode/src/cli/config-manager/add-tui-plugin-to-tui-config.ts
|
|
78410
78524
|
import { existsSync as existsSync33, mkdirSync as mkdirSync10, readFileSync as readFileSync16 } from "node:fs";
|
|
78411
|
-
import { join as
|
|
78525
|
+
import { join as join56 } from "node:path";
|
|
78412
78526
|
|
|
78413
78527
|
// packages/omo-opencode/src/cli/doctor/checks/tui-plugin-config.ts
|
|
78414
78528
|
init_shared();
|
|
78415
78529
|
import { existsSync as existsSync32, readFileSync as readFileSync15 } from "node:fs";
|
|
78416
|
-
import { join as
|
|
78530
|
+
import { join as join55 } from "node:path";
|
|
78417
78531
|
var TUI_SUBPATH = "tui";
|
|
78418
78532
|
var TUI_EXPORT_SUBPATH = `./${TUI_SUBPATH}`;
|
|
78419
78533
|
function fileEntryPackageJsonPath(entry) {
|
|
78420
78534
|
let path7 = entry.slice("file:".length);
|
|
78421
78535
|
if (path7.startsWith("//"))
|
|
78422
78536
|
path7 = path7.slice(2);
|
|
78423
|
-
return
|
|
78537
|
+
return join55(path7, "package.json");
|
|
78424
78538
|
}
|
|
78425
78539
|
function packageJsonExportsTui(pkgJsonPath) {
|
|
78426
78540
|
if (!existsSync32(pkgJsonPath))
|
|
@@ -78458,7 +78572,7 @@ function packageExportsTuiForServerEntry(entry) {
|
|
|
78458
78572
|
const packageName = packageNameFromServerEntry(entry);
|
|
78459
78573
|
if (packageName === null)
|
|
78460
78574
|
return null;
|
|
78461
|
-
return packageJsonExportsTui(
|
|
78575
|
+
return packageJsonExportsTui(join55(getOpenCodeConfigDir({ binary: "opencode" }), "node_modules", packageName, "package.json"));
|
|
78462
78576
|
}
|
|
78463
78577
|
function isOurFilePluginEntry(entry) {
|
|
78464
78578
|
if (!entry.startsWith("file:"))
|
|
@@ -78531,7 +78645,7 @@ function detectServerPluginRegistration() {
|
|
|
78531
78645
|
}
|
|
78532
78646
|
}
|
|
78533
78647
|
function detectTuiPluginRegistration() {
|
|
78534
|
-
const tuiJsonPath =
|
|
78648
|
+
const tuiJsonPath = join55(getOpenCodeConfigDir({ binary: "opencode" }), "tui.json");
|
|
78535
78649
|
if (!existsSync32(tuiJsonPath)) {
|
|
78536
78650
|
return {
|
|
78537
78651
|
registered: false,
|
|
@@ -78687,10 +78801,10 @@ function readConfig(path7) {
|
|
|
78687
78801
|
return null;
|
|
78688
78802
|
}
|
|
78689
78803
|
function readServerConfig(configDir) {
|
|
78690
|
-
const jsoncPath =
|
|
78804
|
+
const jsoncPath = join56(configDir, "opencode.jsonc");
|
|
78691
78805
|
if (existsSync33(jsoncPath))
|
|
78692
78806
|
return readConfig(jsoncPath);
|
|
78693
|
-
const jsonPath =
|
|
78807
|
+
const jsonPath = join56(configDir, "opencode.json");
|
|
78694
78808
|
if (existsSync33(jsonPath))
|
|
78695
78809
|
return readConfig(jsonPath);
|
|
78696
78810
|
return null;
|
|
@@ -78732,7 +78846,7 @@ function ensureTuiPluginEntry(opts = {}) {
|
|
|
78732
78846
|
if (!desiredEntry) {
|
|
78733
78847
|
return { changed: false, reason: "no-server-entry" };
|
|
78734
78848
|
}
|
|
78735
|
-
const tuiJsonPath =
|
|
78849
|
+
const tuiJsonPath = join56(configDir, "tui.json");
|
|
78736
78850
|
const { config, malformed } = readTuiConfig(tuiJsonPath);
|
|
78737
78851
|
if (malformed) {
|
|
78738
78852
|
return { changed: false, reason: "malformed" };
|
|
@@ -78748,7 +78862,7 @@ function ensureTuiPluginEntry(opts = {}) {
|
|
|
78748
78862
|
|
|
78749
78863
|
// packages/omo-opencode/src/cli/install-ast-grep-sg.ts
|
|
78750
78864
|
import { homedir as homedir9 } from "node:os";
|
|
78751
|
-
import { join as
|
|
78865
|
+
import { join as join57 } from "node:path";
|
|
78752
78866
|
|
|
78753
78867
|
// packages/shared-skills/index.mjs
|
|
78754
78868
|
import { fileURLToPath } from "node:url";
|
|
@@ -78767,9 +78881,9 @@ function describeResult2(result) {
|
|
|
78767
78881
|
}
|
|
78768
78882
|
async function installAstGrepForOpenCode(options = {}) {
|
|
78769
78883
|
const platform = options.platform ?? process.platform;
|
|
78770
|
-
const baseDir =
|
|
78884
|
+
const baseDir = join57(options.homeDir ?? homedir9(), ".omo");
|
|
78771
78885
|
const targetDir = astGrepRuntimeDir(baseDir, platform, options.arch ?? process.arch);
|
|
78772
|
-
const skillDir =
|
|
78886
|
+
const skillDir = join57(options.sharedSkillsRoot ?? sharedSkillsRootPath(), "ast-grep");
|
|
78773
78887
|
const installer = options.installer ?? runAstGrepSkillInstall;
|
|
78774
78888
|
try {
|
|
78775
78889
|
const result = await installer({ platform, skillDir, targetDir });
|
|
@@ -96718,7 +96832,7 @@ var import_picocolors11 = __toESM(require_picocolors(), 1);
|
|
|
96718
96832
|
// packages/omo-opencode/src/cli/run/opencode-binary-resolver.ts
|
|
96719
96833
|
init_bun_which_shim();
|
|
96720
96834
|
init_spawn_with_windows_hide();
|
|
96721
|
-
import { delimiter as delimiter2, dirname as
|
|
96835
|
+
import { delimiter as delimiter2, dirname as dirname21, posix as posix4, win32 as win324 } from "node:path";
|
|
96722
96836
|
var OPENCODE_COMMANDS = ["opencode", "opencode-desktop"];
|
|
96723
96837
|
var WINDOWS_SUFFIXES = ["", ".exe", ".cmd", ".bat", ".ps1"];
|
|
96724
96838
|
function getCommandCandidates(platform) {
|
|
@@ -96776,7 +96890,7 @@ async function findWorkingOpencodeBinary(pathEnv = process.env.PATH, probe2 = ca
|
|
|
96776
96890
|
return null;
|
|
96777
96891
|
}
|
|
96778
96892
|
function buildPathWithBinaryFirst(pathEnv, binaryPath) {
|
|
96779
|
-
const preferredDir =
|
|
96893
|
+
const preferredDir = dirname21(binaryPath);
|
|
96780
96894
|
const existing = (pathEnv ?? "").split(delimiter2).filter((entry) => entry.length > 0 && entry !== preferredDir);
|
|
96781
96895
|
return [preferredDir, ...existing].join(delimiter2);
|
|
96782
96896
|
}
|
|
@@ -96944,7 +97058,7 @@ async function resolveSession(options) {
|
|
|
96944
97058
|
if (attempt < SESSION_CREATE_MAX_RETRIES) {
|
|
96945
97059
|
const delay2 = SESSION_CREATE_RETRY_DELAY_MS * attempt;
|
|
96946
97060
|
console.log(import_picocolors12.default.dim(` Retrying in ${delay2}ms...`));
|
|
96947
|
-
await new Promise((
|
|
97061
|
+
await new Promise((resolve18) => setTimeout(resolve18, delay2));
|
|
96948
97062
|
}
|
|
96949
97063
|
continue;
|
|
96950
97064
|
}
|
|
@@ -96955,7 +97069,7 @@ async function resolveSession(options) {
|
|
|
96955
97069
|
if (attempt < SESSION_CREATE_MAX_RETRIES) {
|
|
96956
97070
|
const delay2 = SESSION_CREATE_RETRY_DELAY_MS * attempt;
|
|
96957
97071
|
console.log(import_picocolors12.default.dim(` Retrying in ${delay2}ms...`));
|
|
96958
|
-
await new Promise((
|
|
97072
|
+
await new Promise((resolve18) => setTimeout(resolve18, delay2));
|
|
96959
97073
|
}
|
|
96960
97074
|
}
|
|
96961
97075
|
throw new Error("Failed to create session after all retries");
|
|
@@ -97221,12 +97335,12 @@ function readCurrentTopLevelTask(planPath) {
|
|
|
97221
97335
|
}
|
|
97222
97336
|
// packages/boulder-state/src/storage/path.ts
|
|
97223
97337
|
import { existsSync as existsSync37 } from "node:fs";
|
|
97224
|
-
import { isAbsolute as
|
|
97338
|
+
import { isAbsolute as isAbsolute11, join as join59, relative as relative8, resolve as resolve18 } from "node:path";
|
|
97225
97339
|
function getBoulderFilePath(directory) {
|
|
97226
|
-
return
|
|
97340
|
+
return join59(directory, BOULDER_DIR, BOULDER_FILE);
|
|
97227
97341
|
}
|
|
97228
97342
|
function resolveTrackedPath(baseDirectory, trackedPath) {
|
|
97229
|
-
return
|
|
97343
|
+
return isAbsolute11(trackedPath) ? resolve18(trackedPath) : resolve18(baseDirectory, trackedPath);
|
|
97230
97344
|
}
|
|
97231
97345
|
function resolveBoulderPlanPath(directory, state) {
|
|
97232
97346
|
const absolutePlanPath = resolveTrackedPath(directory, state.active_plan);
|
|
@@ -97234,13 +97348,13 @@ function resolveBoulderPlanPath(directory, state) {
|
|
|
97234
97348
|
if (!worktreePath) {
|
|
97235
97349
|
return absolutePlanPath;
|
|
97236
97350
|
}
|
|
97237
|
-
const absoluteDirectory =
|
|
97351
|
+
const absoluteDirectory = resolve18(directory);
|
|
97238
97352
|
const relativePlanPath = relative8(absoluteDirectory, absolutePlanPath);
|
|
97239
|
-
if (relativePlanPath.length === 0 || relativePlanPath.startsWith("..") ||
|
|
97353
|
+
if (relativePlanPath.length === 0 || relativePlanPath.startsWith("..") || isAbsolute11(relativePlanPath)) {
|
|
97240
97354
|
return absolutePlanPath;
|
|
97241
97355
|
}
|
|
97242
97356
|
const absoluteWorktreePath = resolveTrackedPath(directory, worktreePath);
|
|
97243
|
-
const worktreePlanPath =
|
|
97357
|
+
const worktreePlanPath = resolve18(absoluteWorktreePath, relativePlanPath);
|
|
97244
97358
|
return existsSync37(worktreePlanPath) ? worktreePlanPath : absolutePlanPath;
|
|
97245
97359
|
}
|
|
97246
97360
|
function resolveBoulderPlanPathForWork(directory, work) {
|
|
@@ -97452,9 +97566,9 @@ init_state();
|
|
|
97452
97566
|
var CONTINUATION_MARKER_DIR = ".omo/run-continuation";
|
|
97453
97567
|
// packages/omo-opencode/src/features/run-continuation-state/storage.ts
|
|
97454
97568
|
import { existsSync as existsSync40, mkdirSync as mkdirSync11, readFileSync as readFileSync21, rmSync as rmSync2, writeFileSync as writeFileSync6 } from "node:fs";
|
|
97455
|
-
import { join as
|
|
97569
|
+
import { join as join60 } from "node:path";
|
|
97456
97570
|
function getMarkerPath(directory, sessionID) {
|
|
97457
|
-
return
|
|
97571
|
+
return join60(directory, CONTINUATION_MARKER_DIR, `${sessionID}.json`);
|
|
97458
97572
|
}
|
|
97459
97573
|
function readContinuationMarker(directory, sessionID) {
|
|
97460
97574
|
const markerPath = getMarkerPath(directory, sessionID);
|
|
@@ -97527,7 +97641,7 @@ async function isSessionInBoulderLineage(input) {
|
|
|
97527
97641
|
init_shared();
|
|
97528
97642
|
init_compaction_marker();
|
|
97529
97643
|
import { readFileSync as readFileSync22, readdirSync as readdirSync6 } from "node:fs";
|
|
97530
|
-
import { join as
|
|
97644
|
+
import { join as join61 } from "node:path";
|
|
97531
97645
|
var defaultSessionLastAgentDeps = {
|
|
97532
97646
|
getMessageDir,
|
|
97533
97647
|
isSqliteBackend,
|
|
@@ -97587,7 +97701,7 @@ async function getLastAgentFromSession(sessionID, client3, deps = {}) {
|
|
|
97587
97701
|
try {
|
|
97588
97702
|
const messages = readdirSync6(messageDir).filter((fileName) => fileName.endsWith(".json")).map((fileName) => {
|
|
97589
97703
|
try {
|
|
97590
|
-
const content = readFileSync22(
|
|
97704
|
+
const content = readFileSync22(join61(messageDir, fileName), "utf-8");
|
|
97591
97705
|
const parsed = JSON.parse(content);
|
|
97592
97706
|
return {
|
|
97593
97707
|
fileName,
|
|
@@ -97631,7 +97745,7 @@ init_agent_display_names();
|
|
|
97631
97745
|
// packages/omo-opencode/src/hooks/ralph-loop/storage.ts
|
|
97632
97746
|
init_frontmatter2();
|
|
97633
97747
|
import { existsSync as existsSync41, readFileSync as readFileSync23, writeFileSync as writeFileSync7, unlinkSync as unlinkSync5, mkdirSync as mkdirSync12 } from "node:fs";
|
|
97634
|
-
import { dirname as
|
|
97748
|
+
import { dirname as dirname22, join as join62 } from "node:path";
|
|
97635
97749
|
|
|
97636
97750
|
// packages/omo-opencode/src/hooks/ralph-loop/constants.ts
|
|
97637
97751
|
var DEFAULT_STATE_FILE = ".omo/ralph-loop.local.md";
|
|
@@ -97640,7 +97754,7 @@ var DEFAULT_COMPLETION_PROMISE = "DONE";
|
|
|
97640
97754
|
|
|
97641
97755
|
// packages/omo-opencode/src/hooks/ralph-loop/storage.ts
|
|
97642
97756
|
function getStateFilePath(directory, customPath) {
|
|
97643
|
-
return customPath ?
|
|
97757
|
+
return customPath ? join62(directory, customPath) : join62(directory, DEFAULT_STATE_FILE);
|
|
97644
97758
|
}
|
|
97645
97759
|
function readState(directory, customPath) {
|
|
97646
97760
|
const filePath = getStateFilePath(directory, customPath);
|
|
@@ -97879,7 +97993,7 @@ async function pollForCompletion(ctx, eventState, abortController, options = {})
|
|
|
97879
97993
|
let secondaryTimeoutChecked = false;
|
|
97880
97994
|
const pollStartTimestamp = Date.now();
|
|
97881
97995
|
while (!abortController.signal.aborted) {
|
|
97882
|
-
await new Promise((
|
|
97996
|
+
await new Promise((resolve19) => setTimeout(resolve19, pollIntervalMs));
|
|
97883
97997
|
if (abortController.signal.aborted) {
|
|
97884
97998
|
return 130;
|
|
97885
97999
|
}
|
|
@@ -98037,7 +98151,7 @@ function createAbortError() {
|
|
|
98037
98151
|
return error51;
|
|
98038
98152
|
}
|
|
98039
98153
|
function sleep(delayMs) {
|
|
98040
|
-
return new Promise((
|
|
98154
|
+
return new Promise((resolve19) => setTimeout(resolve19, delayMs));
|
|
98041
98155
|
}
|
|
98042
98156
|
function hasPromptStartEvidence(eventState) {
|
|
98043
98157
|
return eventState.mainSessionStarted || eventState.hasReceivedMeaningfulWork || eventState.messageCount > 0 || eventState.currentTool !== null;
|
|
@@ -98412,7 +98526,7 @@ var EVENT_PROCESSOR_SHUTDOWN_TIMEOUT_MS = 2000;
|
|
|
98412
98526
|
async function waitForEventProcessorShutdown(eventProcessor, timeoutMs = EVENT_PROCESSOR_SHUTDOWN_TIMEOUT_MS) {
|
|
98413
98527
|
const completed = await Promise.race([
|
|
98414
98528
|
eventProcessor.then(() => true),
|
|
98415
|
-
new Promise((
|
|
98529
|
+
new Promise((resolve19) => setTimeout(() => resolve19(false), timeoutMs))
|
|
98416
98530
|
]);
|
|
98417
98531
|
}
|
|
98418
98532
|
async function run(options) {
|
|
@@ -98722,7 +98836,7 @@ init_extract_semver();
|
|
|
98722
98836
|
init_bun_which_shim();
|
|
98723
98837
|
import { existsSync as existsSync49, accessSync as accessSync4, constants as constants9 } from "node:fs";
|
|
98724
98838
|
import { homedir as homedir13 } from "node:os";
|
|
98725
|
-
import { join as
|
|
98839
|
+
import { join as join69 } from "node:path";
|
|
98726
98840
|
|
|
98727
98841
|
// packages/omo-opencode/src/cli/doctor/framework/spawn-with-timeout.ts
|
|
98728
98842
|
init_spawn_with_windows_hide();
|
|
@@ -98761,8 +98875,8 @@ async function spawnWithTimeout(command, options, timeoutMs = DEFAULT_SPAWN_TIME
|
|
|
98761
98875
|
const stdoutPromise = readSpawnStream(proc.stdout);
|
|
98762
98876
|
const stderrPromise = readSpawnStream(proc.stderr);
|
|
98763
98877
|
let timer;
|
|
98764
|
-
const timeoutPromise = new Promise((
|
|
98765
|
-
timer = setTimeout(() =>
|
|
98878
|
+
const timeoutPromise = new Promise((resolve19) => {
|
|
98879
|
+
timer = setTimeout(() => resolve19("timeout"), timeoutMs);
|
|
98766
98880
|
});
|
|
98767
98881
|
const processPromise = (async () => {
|
|
98768
98882
|
await proc.exited;
|
|
@@ -98814,17 +98928,17 @@ function getDesktopAppPaths(platform) {
|
|
|
98814
98928
|
case "darwin":
|
|
98815
98929
|
return [
|
|
98816
98930
|
"/Applications/OpenCode.app/Contents/MacOS/OpenCode",
|
|
98817
|
-
|
|
98931
|
+
join69(home, "Applications", "OpenCode.app", "Contents", "MacOS", "OpenCode")
|
|
98818
98932
|
];
|
|
98819
98933
|
case "win32": {
|
|
98820
98934
|
const programFiles = process.env.ProgramFiles;
|
|
98821
98935
|
const localAppData = process.env.LOCALAPPDATA;
|
|
98822
98936
|
const paths = [];
|
|
98823
98937
|
if (programFiles) {
|
|
98824
|
-
paths.push(
|
|
98938
|
+
paths.push(join69(programFiles, "OpenCode", "OpenCode.exe"));
|
|
98825
98939
|
}
|
|
98826
98940
|
if (localAppData) {
|
|
98827
|
-
paths.push(
|
|
98941
|
+
paths.push(join69(localAppData, "OpenCode", "OpenCode.exe"));
|
|
98828
98942
|
}
|
|
98829
98943
|
return paths;
|
|
98830
98944
|
}
|
|
@@ -98832,8 +98946,8 @@ function getDesktopAppPaths(platform) {
|
|
|
98832
98946
|
return [
|
|
98833
98947
|
"/usr/bin/opencode",
|
|
98834
98948
|
"/usr/lib/opencode/opencode",
|
|
98835
|
-
|
|
98836
|
-
|
|
98949
|
+
join69(home, "Applications", "opencode-desktop-linux-x86_64.AppImage"),
|
|
98950
|
+
join69(home, "Applications", "opencode-desktop-linux-aarch64.AppImage")
|
|
98837
98951
|
];
|
|
98838
98952
|
default:
|
|
98839
98953
|
return [];
|
|
@@ -98865,7 +98979,7 @@ async function findOpenCodeBinary(platform = process.platform, checkExists = exi
|
|
|
98865
98979
|
const candidates = getCommandCandidates2(platform);
|
|
98866
98980
|
for (const entry of pathEnv.split(delimiter3).filter(Boolean)) {
|
|
98867
98981
|
for (const command of candidates) {
|
|
98868
|
-
const fullPath =
|
|
98982
|
+
const fullPath = join69(entry, command);
|
|
98869
98983
|
if (checkExists(fullPath) && isExecutable2(fullPath)) {
|
|
98870
98984
|
return { binary: command, path: fullPath };
|
|
98871
98985
|
}
|
|
@@ -99007,22 +99121,22 @@ init_package_json_locator();
|
|
|
99007
99121
|
import { existsSync as existsSync51, readFileSync as readFileSync32, readdirSync as readdirSync8 } from "node:fs";
|
|
99008
99122
|
import { createRequire as createRequire3 } from "node:module";
|
|
99009
99123
|
import { homedir as homedir14 } from "node:os";
|
|
99010
|
-
import { join as
|
|
99124
|
+
import { join as join70 } from "node:path";
|
|
99011
99125
|
import { fileURLToPath as fileURLToPath5 } from "node:url";
|
|
99012
99126
|
init_shared();
|
|
99013
99127
|
function getPlatformDefaultCacheDir(platform = process.platform) {
|
|
99014
99128
|
if (platform === "darwin")
|
|
99015
|
-
return
|
|
99129
|
+
return join70(homedir14(), "Library", "Caches");
|
|
99016
99130
|
if (platform === "win32")
|
|
99017
|
-
return process.env.LOCALAPPDATA ??
|
|
99018
|
-
return
|
|
99131
|
+
return process.env.LOCALAPPDATA ?? join70(homedir14(), "AppData", "Local");
|
|
99132
|
+
return join70(homedir14(), ".cache");
|
|
99019
99133
|
}
|
|
99020
99134
|
function resolveOpenCodeCacheDir() {
|
|
99021
99135
|
const xdgCacheHome = process.env.XDG_CACHE_HOME;
|
|
99022
99136
|
if (xdgCacheHome)
|
|
99023
|
-
return
|
|
99137
|
+
return join70(xdgCacheHome, "opencode");
|
|
99024
99138
|
const fromShared = getOpenCodeCacheDir();
|
|
99025
|
-
const platformDefault =
|
|
99139
|
+
const platformDefault = join70(getPlatformDefaultCacheDir(), "opencode");
|
|
99026
99140
|
if (existsSync51(fromShared) || !existsSync51(platformDefault))
|
|
99027
99141
|
return fromShared;
|
|
99028
99142
|
return platformDefault;
|
|
@@ -99054,11 +99168,11 @@ function normalizeVersion(value) {
|
|
|
99054
99168
|
function createPackageCandidates(rootDir) {
|
|
99055
99169
|
return ACCEPTED_PACKAGE_NAMES.map((packageName) => ({
|
|
99056
99170
|
packageName,
|
|
99057
|
-
installedPackagePath:
|
|
99171
|
+
installedPackagePath: join70(rootDir, "node_modules", packageName, "package.json")
|
|
99058
99172
|
}));
|
|
99059
99173
|
}
|
|
99060
99174
|
function createTaggedInstallCandidates(rootDir) {
|
|
99061
|
-
const packagesDir =
|
|
99175
|
+
const packagesDir = join70(rootDir, "packages");
|
|
99062
99176
|
if (!existsSync51(packagesDir))
|
|
99063
99177
|
return [];
|
|
99064
99178
|
const candidates = [];
|
|
@@ -99066,14 +99180,14 @@ function createTaggedInstallCandidates(rootDir) {
|
|
|
99066
99180
|
const packageName = ACCEPTED_PACKAGE_NAMES.find((name) => entryName.startsWith(`${name}@`));
|
|
99067
99181
|
if (packageName === undefined)
|
|
99068
99182
|
continue;
|
|
99069
|
-
const installDir =
|
|
99183
|
+
const installDir = join70(packagesDir, entryName);
|
|
99070
99184
|
candidates.push({
|
|
99071
99185
|
cacheDir: installDir,
|
|
99072
|
-
cachePackagePath:
|
|
99186
|
+
cachePackagePath: join70(installDir, "package.json"),
|
|
99073
99187
|
packageCandidates: [
|
|
99074
99188
|
{
|
|
99075
99189
|
packageName,
|
|
99076
|
-
installedPackagePath:
|
|
99190
|
+
installedPackagePath: join70(installDir, "node_modules", packageName, "package.json")
|
|
99077
99191
|
}
|
|
99078
99192
|
]
|
|
99079
99193
|
});
|
|
@@ -99118,13 +99232,13 @@ function getLoadedPluginVersion() {
|
|
|
99118
99232
|
const candidates = [
|
|
99119
99233
|
{
|
|
99120
99234
|
cacheDir: configDir,
|
|
99121
|
-
cachePackagePath:
|
|
99235
|
+
cachePackagePath: join70(configDir, "package.json"),
|
|
99122
99236
|
packageCandidates: createPackageCandidates(configDir)
|
|
99123
99237
|
},
|
|
99124
99238
|
...createTaggedInstallCandidates(configDir),
|
|
99125
99239
|
{
|
|
99126
99240
|
cacheDir,
|
|
99127
|
-
cachePackagePath:
|
|
99241
|
+
cachePackagePath: join70(cacheDir, "package.json"),
|
|
99128
99242
|
packageCandidates: createPackageCandidates(cacheDir)
|
|
99129
99243
|
},
|
|
99130
99244
|
...createTaggedInstallCandidates(cacheDir)
|
|
@@ -99317,7 +99431,7 @@ async function checkSystem(deps = defaultDeps6) {
|
|
|
99317
99431
|
init_src();
|
|
99318
99432
|
import { readFileSync as readFileSync34 } from "node:fs";
|
|
99319
99433
|
import { homedir as homedir15 } from "node:os";
|
|
99320
|
-
import { dirname as
|
|
99434
|
+
import { dirname as dirname27, relative as relative9 } from "node:path";
|
|
99321
99435
|
init_shared();
|
|
99322
99436
|
init_plugin_identity();
|
|
99323
99437
|
function resolveHomeDirectory2() {
|
|
@@ -99341,7 +99455,7 @@ function discoverProjectLayersNearestFirst(directory) {
|
|
|
99341
99455
|
const stopDirectory = containsPath(homeDirectory, directory) ? homeDirectory : directory;
|
|
99342
99456
|
return findProjectOpencodePluginConfigFiles(directory, stopDirectory).map((configPath) => ({
|
|
99343
99457
|
path: configPath,
|
|
99344
|
-
configDir:
|
|
99458
|
+
configDir: dirname27(configPath)
|
|
99345
99459
|
}));
|
|
99346
99460
|
}
|
|
99347
99461
|
function shortPath(configPath) {
|
|
@@ -99365,7 +99479,7 @@ function parseLayerConfig(configPath) {
|
|
|
99365
99479
|
if (!isPlainRecord(rawConfig)) {
|
|
99366
99480
|
return {
|
|
99367
99481
|
path: configPath,
|
|
99368
|
-
configDir:
|
|
99482
|
+
configDir: dirname27(configPath),
|
|
99369
99483
|
config: null,
|
|
99370
99484
|
messages: [`${shortPath(configPath)}: <root>: Expected object`]
|
|
99371
99485
|
};
|
|
@@ -99373,7 +99487,7 @@ function parseLayerConfig(configPath) {
|
|
|
99373
99487
|
const result = OhMyOpenCodeConfigSchema.safeParse(rawConfig);
|
|
99374
99488
|
return {
|
|
99375
99489
|
path: configPath,
|
|
99376
|
-
configDir:
|
|
99490
|
+
configDir: dirname27(configPath),
|
|
99377
99491
|
config: result.success ? result.data : parseConfigPartially(rawConfig),
|
|
99378
99492
|
messages: schemaMessages(configPath, rawConfig)
|
|
99379
99493
|
};
|
|
@@ -99383,7 +99497,7 @@ function parseLayerConfig(configPath) {
|
|
|
99383
99497
|
}
|
|
99384
99498
|
return {
|
|
99385
99499
|
path: configPath,
|
|
99386
|
-
configDir:
|
|
99500
|
+
configDir: dirname27(configPath),
|
|
99387
99501
|
config: null,
|
|
99388
99502
|
messages: [`${shortPath(configPath)}: ${error51.message}`]
|
|
99389
99503
|
};
|
|
@@ -99431,18 +99545,18 @@ function validatePluginConfig(directory) {
|
|
|
99431
99545
|
init_shared();
|
|
99432
99546
|
import { existsSync as existsSync53, readFileSync as readFileSync35 } from "node:fs";
|
|
99433
99547
|
import { homedir as homedir16 } from "node:os";
|
|
99434
|
-
import { join as
|
|
99548
|
+
import { join as join71 } from "node:path";
|
|
99435
99549
|
function getUserConfigDir2() {
|
|
99436
99550
|
const xdgConfig = process.env.XDG_CONFIG_HOME;
|
|
99437
99551
|
if (xdgConfig)
|
|
99438
|
-
return
|
|
99439
|
-
return
|
|
99552
|
+
return join71(xdgConfig, "opencode");
|
|
99553
|
+
return join71(homedir16(), ".config", "opencode");
|
|
99440
99554
|
}
|
|
99441
99555
|
function loadCustomProviderNames() {
|
|
99442
99556
|
const configDir = getUserConfigDir2();
|
|
99443
99557
|
const candidatePaths = [
|
|
99444
|
-
|
|
99445
|
-
|
|
99558
|
+
join71(configDir, "opencode.json"),
|
|
99559
|
+
join71(configDir, "opencode.jsonc")
|
|
99446
99560
|
];
|
|
99447
99561
|
for (const configPath of candidatePaths) {
|
|
99448
99562
|
if (!existsSync53(configPath))
|
|
@@ -99463,7 +99577,7 @@ function loadCustomProviderNames() {
|
|
|
99463
99577
|
return [];
|
|
99464
99578
|
}
|
|
99465
99579
|
function loadAvailableModelsFromCache() {
|
|
99466
|
-
const cacheFile =
|
|
99580
|
+
const cacheFile = join71(getOpenCodeCacheDir(), "models.json");
|
|
99467
99581
|
const customProviders = loadCustomProviderNames();
|
|
99468
99582
|
if (!existsSync53(cacheFile)) {
|
|
99469
99583
|
if (customProviders.length > 0) {
|
|
@@ -99500,8 +99614,8 @@ init_model_capabilities2();
|
|
|
99500
99614
|
init_shared();
|
|
99501
99615
|
init_plugin_identity();
|
|
99502
99616
|
import { readFileSync as readFileSync36 } from "node:fs";
|
|
99503
|
-
import { join as
|
|
99504
|
-
var PROJECT_CONFIG_DIR =
|
|
99617
|
+
import { join as join72 } from "node:path";
|
|
99618
|
+
var PROJECT_CONFIG_DIR = join72(process.cwd(), ".opencode");
|
|
99505
99619
|
function loadOmoConfig() {
|
|
99506
99620
|
const projectDetected = detectPluginConfigFile(PROJECT_CONFIG_DIR, {
|
|
99507
99621
|
basenames: [CONFIG_BASENAME],
|
|
@@ -99539,7 +99653,7 @@ function loadOmoConfig() {
|
|
|
99539
99653
|
|
|
99540
99654
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-details.ts
|
|
99541
99655
|
init_shared();
|
|
99542
|
-
import { join as
|
|
99656
|
+
import { join as join73 } from "node:path";
|
|
99543
99657
|
|
|
99544
99658
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-variant.ts
|
|
99545
99659
|
function formatModelWithVariant(model, variant) {
|
|
@@ -99581,7 +99695,7 @@ function formatCapabilityResolutionLabel(mode) {
|
|
|
99581
99695
|
}
|
|
99582
99696
|
function buildModelResolutionDetails(options) {
|
|
99583
99697
|
const details = [];
|
|
99584
|
-
const cacheFile =
|
|
99698
|
+
const cacheFile = join73(getOpenCodeCacheDir(), "models.json");
|
|
99585
99699
|
details.push("═══ Available Models (from cache) ═══");
|
|
99586
99700
|
details.push("");
|
|
99587
99701
|
if (options.available.cacheExists) {
|
|
@@ -99860,25 +99974,25 @@ init_src();
|
|
|
99860
99974
|
import { existsSync as existsSync54 } from "node:fs";
|
|
99861
99975
|
import { createRequire as createRequire4 } from "node:module";
|
|
99862
99976
|
import { homedir as homedir18 } from "node:os";
|
|
99863
|
-
import { dirname as
|
|
99977
|
+
import { dirname as dirname28, join as join75 } from "node:path";
|
|
99864
99978
|
|
|
99865
99979
|
// packages/omo-opencode/src/hooks/comment-checker/downloader.ts
|
|
99866
|
-
import { join as
|
|
99980
|
+
import { join as join74 } from "path";
|
|
99867
99981
|
import { homedir as homedir17, tmpdir as tmpdir3 } from "os";
|
|
99868
99982
|
init_binary_downloader();
|
|
99869
99983
|
init_logger2();
|
|
99870
99984
|
init_plugin_identity();
|
|
99871
99985
|
var DEBUG = process.env.COMMENT_CHECKER_DEBUG === "1";
|
|
99872
|
-
var DEBUG_FILE =
|
|
99986
|
+
var DEBUG_FILE = join74(tmpdir3(), "comment-checker-debug.log");
|
|
99873
99987
|
function getCacheDir2() {
|
|
99874
99988
|
if (process.platform === "win32") {
|
|
99875
99989
|
const localAppData = process.env.LOCALAPPDATA || process.env.APPDATA;
|
|
99876
|
-
const base2 = localAppData ||
|
|
99877
|
-
return
|
|
99990
|
+
const base2 = localAppData || join74(homedir17(), "AppData", "Local");
|
|
99991
|
+
return join74(base2, CACHE_DIR_NAME, "bin");
|
|
99878
99992
|
}
|
|
99879
99993
|
const xdgCache = process.env.XDG_CACHE_HOME;
|
|
99880
|
-
const base = xdgCache ||
|
|
99881
|
-
return
|
|
99994
|
+
const base = xdgCache || join74(homedir17(), ".cache");
|
|
99995
|
+
return join74(base, CACHE_DIR_NAME, "bin");
|
|
99882
99996
|
}
|
|
99883
99997
|
function getBinaryName() {
|
|
99884
99998
|
return process.platform === "win32" ? "comment-checker.exe" : "comment-checker";
|
|
@@ -99928,7 +100042,7 @@ async function getBinaryVersion(binary) {
|
|
|
99928
100042
|
}
|
|
99929
100043
|
}
|
|
99930
100044
|
async function checkAstGrepCli() {
|
|
99931
|
-
const runtimeDir = astGrepRuntimeDir(
|
|
100045
|
+
const runtimeDir = astGrepRuntimeDir(join75(homedir18(), ".omo"));
|
|
99932
100046
|
const sgPath = findSgBinarySync({ runtimeDir });
|
|
99933
100047
|
if (sgPath === null) {
|
|
99934
100048
|
return {
|
|
@@ -99957,11 +100071,11 @@ function findCommentCheckerPackageBinary(baseDirOverride, resolvePackageJsonPath
|
|
|
99957
100071
|
const binaryName = process.platform === "win32" ? "comment-checker.exe" : "comment-checker";
|
|
99958
100072
|
const platformKey = `${process.platform}-${process.arch === "x64" ? "x64" : process.arch}`;
|
|
99959
100073
|
try {
|
|
99960
|
-
const packageDir = baseDirOverride ??
|
|
99961
|
-
const vendorPath =
|
|
100074
|
+
const packageDir = baseDirOverride ?? dirname28(resolvePackageJsonPath());
|
|
100075
|
+
const vendorPath = join75(packageDir, "vendor", platformKey, binaryName);
|
|
99962
100076
|
if (existsSync54(vendorPath))
|
|
99963
100077
|
return vendorPath;
|
|
99964
|
-
const binPath =
|
|
100078
|
+
const binPath = join75(packageDir, "bin", binaryName);
|
|
99965
100079
|
if (existsSync54(binPath))
|
|
99966
100080
|
return binPath;
|
|
99967
100081
|
} catch (error51) {
|
|
@@ -100107,11 +100221,11 @@ async function getGhCliInfo(dependencies = {}) {
|
|
|
100107
100221
|
|
|
100108
100222
|
// packages/omo-opencode/src/cli/doctor/checks/tools-lsp.ts
|
|
100109
100223
|
import { readFileSync as readFileSync37 } from "node:fs";
|
|
100110
|
-
import { join as
|
|
100224
|
+
import { join as join76 } from "node:path";
|
|
100111
100225
|
|
|
100112
100226
|
// packages/omo-opencode/src/mcp/lsp.ts
|
|
100113
100227
|
import { existsSync as existsSync55 } from "node:fs";
|
|
100114
|
-
import { delimiter as delimiter3, dirname as
|
|
100228
|
+
import { delimiter as delimiter3, dirname as dirname29, resolve as resolve20 } from "node:path";
|
|
100115
100229
|
import { fileURLToPath as fileURLToPath6 } from "node:url";
|
|
100116
100230
|
|
|
100117
100231
|
// packages/omo-opencode/src/mcp/cli-suffix.ts
|
|
@@ -100158,7 +100272,7 @@ function resolveRuntimeExecutable(commandName, options = {}) {
|
|
|
100158
100272
|
}
|
|
100159
100273
|
|
|
100160
100274
|
// packages/omo-opencode/src/mcp/shared/ancestor-cli-resolver.ts
|
|
100161
|
-
import { resolve as
|
|
100275
|
+
import { resolve as resolve19 } from "node:path";
|
|
100162
100276
|
function resolveJavaScriptRuntime(resolveExecutable) {
|
|
100163
100277
|
const node = resolveExecutable("node");
|
|
100164
100278
|
return node.available ? node : resolveExecutable("bun");
|
|
@@ -100166,9 +100280,9 @@ function resolveJavaScriptRuntime(resolveExecutable) {
|
|
|
100166
100280
|
function createAncestorCliCandidates(options) {
|
|
100167
100281
|
const candidates = [];
|
|
100168
100282
|
const seenPaths = new Set;
|
|
100169
|
-
let currentDirectory =
|
|
100283
|
+
let currentDirectory = resolve19(options.startDirectory);
|
|
100170
100284
|
while (true) {
|
|
100171
|
-
const distCliPath =
|
|
100285
|
+
const distCliPath = resolve19(currentDirectory, options.packageRel, options.distCliRel);
|
|
100172
100286
|
if (!seenPaths.has(distCliPath)) {
|
|
100173
100287
|
const runtime5 = resolveJavaScriptRuntime(options.resolveExecutable);
|
|
100174
100288
|
seenPaths.add(distCliPath);
|
|
@@ -100180,7 +100294,7 @@ function createAncestorCliCandidates(options) {
|
|
|
100180
100294
|
runtimeAvailable: runtime5.available
|
|
100181
100295
|
});
|
|
100182
100296
|
}
|
|
100183
|
-
const sourceCliPath =
|
|
100297
|
+
const sourceCliPath = resolve19(currentDirectory, options.packageRel, options.sourceCliRel);
|
|
100184
100298
|
if (!seenPaths.has(sourceCliPath)) {
|
|
100185
100299
|
const runtime5 = options.resolveExecutable("bun");
|
|
100186
100300
|
const sourceCandidateAvailable = options.isSourceCandidateAvailable?.({
|
|
@@ -100197,7 +100311,7 @@ function createAncestorCliCandidates(options) {
|
|
|
100197
100311
|
runtimeAvailable: runtime5.available
|
|
100198
100312
|
});
|
|
100199
100313
|
}
|
|
100200
|
-
const parentDirectory =
|
|
100314
|
+
const parentDirectory = resolve19(currentDirectory, "..");
|
|
100201
100315
|
if (parentDirectory === currentDirectory)
|
|
100202
100316
|
return candidates;
|
|
100203
100317
|
currentDirectory = parentDirectory;
|
|
@@ -100233,7 +100347,7 @@ var LSP_BOOTSTRAP_SCRIPT = [
|
|
|
100233
100347
|
].join(";");
|
|
100234
100348
|
function getModuleDirectory(moduleUrl) {
|
|
100235
100349
|
try {
|
|
100236
|
-
return
|
|
100350
|
+
return dirname29(fileURLToPath6(moduleUrl));
|
|
100237
100351
|
} catch (error51) {
|
|
100238
100352
|
if (!(error51 instanceof Error))
|
|
100239
100353
|
throw error51;
|
|
@@ -100241,17 +100355,17 @@ function getModuleDirectory(moduleUrl) {
|
|
|
100241
100355
|
}
|
|
100242
100356
|
}
|
|
100243
100357
|
function findBootstrapRoot(candidates, pathExists) {
|
|
100244
|
-
return candidates.find((candidate) => pathExists(
|
|
100358
|
+
return candidates.find((candidate) => pathExists(resolve20(candidate.root, "package.json")))?.root ?? process.cwd();
|
|
100245
100359
|
}
|
|
100246
100360
|
function createBootstrapCandidate(root, pathExists, resolveExecutable) {
|
|
100247
100361
|
const runtime5 = resolveJavaScriptRuntime(resolveExecutable);
|
|
100248
100362
|
const bun = resolveExecutable("bun");
|
|
100249
100363
|
const npm = resolveExecutable("npm");
|
|
100250
|
-
const packageManifestPath =
|
|
100364
|
+
const packageManifestPath = resolve20(root, PACKAGE_REL, "package.json");
|
|
100251
100365
|
return {
|
|
100252
100366
|
command: [runtime5.command, "-e", LSP_BOOTSTRAP_SCRIPT, root, npm.command, bun.command],
|
|
100253
100367
|
root,
|
|
100254
|
-
path:
|
|
100368
|
+
path: resolve20(root, PACKAGE_REL, DIST_CLI_REL),
|
|
100255
100369
|
exists: runtime5.available && npm.available && pathExists(packageManifestPath),
|
|
100256
100370
|
runtimeAvailable: runtime5.available
|
|
100257
100371
|
};
|
|
@@ -100267,7 +100381,7 @@ function resolveLspCommand(options = {}) {
|
|
|
100267
100381
|
sourceCliRel: SOURCE_CLI_REL,
|
|
100268
100382
|
pathExists,
|
|
100269
100383
|
resolveExecutable,
|
|
100270
|
-
isSourceCandidateAvailable: ({ root }) => pathExists(
|
|
100384
|
+
isSourceCandidateAvailable: ({ root }) => pathExists(resolve20(root, LSP_TOOLS_PACKAGE_REL, DIST_CLI_REL))
|
|
100271
100385
|
}) : [];
|
|
100272
100386
|
const distCandidate = candidates.find((candidate) => hasCliSuffix(candidate.path, DIST_CLI_REL) && candidate.exists);
|
|
100273
100387
|
if (distCandidate) {
|
|
@@ -100314,7 +100428,7 @@ function readOmoConfig(configDirectory) {
|
|
|
100314
100428
|
}
|
|
100315
100429
|
function isLspMcpDisabled(options) {
|
|
100316
100430
|
const userConfigDirectory = options.configDirectory ?? getOpenCodeConfigDir({ binary: "opencode" });
|
|
100317
|
-
const projectConfigDirectory =
|
|
100431
|
+
const projectConfigDirectory = join76(options.cwd ?? process.cwd(), ".opencode");
|
|
100318
100432
|
const userConfig = readOmoConfig(userConfigDirectory);
|
|
100319
100433
|
const projectConfig = readOmoConfig(projectConfigDirectory);
|
|
100320
100434
|
const disabledMcps = new Set([
|
|
@@ -100335,13 +100449,13 @@ function getInstalledLspServers(options = {}) {
|
|
|
100335
100449
|
init_shared();
|
|
100336
100450
|
import { existsSync as existsSync56, readFileSync as readFileSync38 } from "node:fs";
|
|
100337
100451
|
import { homedir as homedir19 } from "node:os";
|
|
100338
|
-
import { join as
|
|
100452
|
+
import { join as join77 } from "node:path";
|
|
100339
100453
|
var BUILTIN_MCP_SERVERS = ["websearch", "context7", "grep_app", "lsp"];
|
|
100340
100454
|
function getMcpConfigPaths() {
|
|
100341
100455
|
return [
|
|
100342
|
-
|
|
100343
|
-
|
|
100344
|
-
|
|
100456
|
+
join77(homedir19(), ".claude", ".mcp.json"),
|
|
100457
|
+
join77(process.cwd(), ".mcp.json"),
|
|
100458
|
+
join77(process.cwd(), ".claude", ".mcp.json")
|
|
100345
100459
|
];
|
|
100346
100460
|
}
|
|
100347
100461
|
function loadUserMcpConfig() {
|
|
@@ -100641,9 +100755,9 @@ async function pathExists(dir) {
|
|
|
100641
100755
|
// packages/omo-opencode/src/cli/doctor/checks/codex.ts
|
|
100642
100756
|
init_src();
|
|
100643
100757
|
import { existsSync as existsSync58 } from "node:fs";
|
|
100644
|
-
import { lstat as
|
|
100758
|
+
import { lstat as lstat12, readdir as readdir10, readFile as readFile21 } from "node:fs/promises";
|
|
100645
100759
|
import { homedir as homedir21 } from "node:os";
|
|
100646
|
-
import { basename as basename13, join as
|
|
100760
|
+
import { basename as basename13, join as join78, resolve as resolve21 } from "node:path";
|
|
100647
100761
|
// packages/omo-opencode/package.json
|
|
100648
100762
|
var package_default3 = {
|
|
100649
100763
|
name: "@oh-my-opencode/omo-opencode",
|
|
@@ -100701,13 +100815,13 @@ var CODEX_BIN_NAMES = [
|
|
|
100701
100815
|
"omo-git-bash-hook"
|
|
100702
100816
|
];
|
|
100703
100817
|
async function gatherCodexSummary(deps = {}) {
|
|
100704
|
-
const codexHome =
|
|
100818
|
+
const codexHome = resolve21(deps.codexHome ?? process.env.CODEX_HOME ?? join78(homedir21(), ".codex"));
|
|
100705
100819
|
const binDir = resolveCodexInstallerBinDir({ binDir: deps.binDir, codexHome, env: process.env });
|
|
100706
100820
|
const detection = await (deps.detectCodexInstallation ?? detectCodexInstallation)();
|
|
100707
100821
|
const pluginRoot = await resolveInstalledPluginRoot(codexHome);
|
|
100708
|
-
const manifest = pluginRoot === null ? null : await readJson(
|
|
100709
|
-
const installSnapshot = pluginRoot === null ? null : await readJson(
|
|
100710
|
-
const configPath =
|
|
100822
|
+
const manifest = pluginRoot === null ? null : await readJson(join78(pluginRoot, ".codex-plugin", "plugin.json"));
|
|
100823
|
+
const installSnapshot = pluginRoot === null ? null : await readJson(join78(pluginRoot, "lazycodex-install.json"));
|
|
100824
|
+
const configPath = join78(codexHome, "config.toml");
|
|
100711
100825
|
const pluginVersion = stringField(manifest, "version");
|
|
100712
100826
|
return {
|
|
100713
100827
|
codexPath: detection.found && "path" in detection ? detection.path : null,
|
|
@@ -100764,7 +100878,7 @@ function buildCodexIssues(summary) {
|
|
|
100764
100878
|
if (summary.pluginRoot === null) {
|
|
100765
100879
|
issues.push({
|
|
100766
100880
|
title: "OMO Codex plugin is not installed",
|
|
100767
|
-
description: `Expected cached plugin at ${
|
|
100881
|
+
description: `Expected cached plugin at ${join78("plugins", "cache", MARKETPLACE_NAME, PLUGIN_NAME2, DEFAULT_PLUGIN_VERSION)} under CODEX_HOME.`,
|
|
100768
100882
|
fix: "Run: npx lazycodex-ai install",
|
|
100769
100883
|
severity: "error",
|
|
100770
100884
|
affects: ["plugin loading"]
|
|
@@ -100829,12 +100943,12 @@ function buildCodexIssues(summary) {
|
|
|
100829
100943
|
return issues;
|
|
100830
100944
|
}
|
|
100831
100945
|
async function resolveInstalledPluginRoot(codexHome) {
|
|
100832
|
-
const pluginRoot =
|
|
100946
|
+
const pluginRoot = join78(codexHome, "plugins", "cache", MARKETPLACE_NAME, PLUGIN_NAME2);
|
|
100833
100947
|
if (!existsSync58(pluginRoot))
|
|
100834
100948
|
return null;
|
|
100835
|
-
const versions2 = await
|
|
100949
|
+
const versions2 = await readdir10(pluginRoot, { withFileTypes: true });
|
|
100836
100950
|
const candidates = versions2.filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort(compareVersionsDescending);
|
|
100837
|
-
return candidates.length === 0 ? null :
|
|
100951
|
+
return candidates.length === 0 ? null : join78(pluginRoot, candidates[0] ?? DEFAULT_PLUGIN_VERSION);
|
|
100838
100952
|
}
|
|
100839
100953
|
async function readCodexConfigSummary(configPath) {
|
|
100840
100954
|
if (!existsSync58(configPath)) {
|
|
@@ -100848,7 +100962,7 @@ async function readCodexConfigSummary(configPath) {
|
|
|
100848
100962
|
companionLifecycleHookStateEvents: []
|
|
100849
100963
|
};
|
|
100850
100964
|
}
|
|
100851
|
-
const content = await
|
|
100965
|
+
const content = await readFile21(configPath, "utf8");
|
|
100852
100966
|
return {
|
|
100853
100967
|
exists: true,
|
|
100854
100968
|
marketplaceConfigured: content.includes("[marketplaces.sisyphuslabs]"),
|
|
@@ -100862,21 +100976,21 @@ async function readCodexConfigSummary(configPath) {
|
|
|
100862
100976
|
async function readLinkedBins(binDir) {
|
|
100863
100977
|
const linked = [];
|
|
100864
100978
|
for (const name of CODEX_BIN_NAMES) {
|
|
100865
|
-
if (await pathExists2(
|
|
100979
|
+
if (await pathExists2(join78(binDir, process.platform === "win32" ? `${name}.cmd` : name)))
|
|
100866
100980
|
linked.push(name);
|
|
100867
100981
|
}
|
|
100868
100982
|
return linked;
|
|
100869
100983
|
}
|
|
100870
100984
|
async function readLinkedAgents(codexHome) {
|
|
100871
|
-
const agentsDir =
|
|
100985
|
+
const agentsDir = join78(codexHome, "agents");
|
|
100872
100986
|
if (!existsSync58(agentsDir))
|
|
100873
100987
|
return [];
|
|
100874
|
-
const entries = await
|
|
100988
|
+
const entries = await readdir10(agentsDir, { withFileTypes: true });
|
|
100875
100989
|
return entries.filter((entry) => entry.isFile() || entry.isSymbolicLink()).map((entry) => basename13(entry.name, ".toml")).sort();
|
|
100876
100990
|
}
|
|
100877
100991
|
async function readJson(path16) {
|
|
100878
100992
|
try {
|
|
100879
|
-
const parsed = JSON.parse(await
|
|
100993
|
+
const parsed = JSON.parse(await readFile21(path16, "utf8"));
|
|
100880
100994
|
return isPlainRecord(parsed) ? parsed : null;
|
|
100881
100995
|
} catch (error51) {
|
|
100882
100996
|
if (error51 instanceof Error)
|
|
@@ -100971,7 +101085,7 @@ function compareVersionsDescending(left, right) {
|
|
|
100971
101085
|
}
|
|
100972
101086
|
async function pathExists2(path16) {
|
|
100973
101087
|
try {
|
|
100974
|
-
await
|
|
101088
|
+
await lstat12(path16);
|
|
100975
101089
|
return true;
|
|
100976
101090
|
} catch (error51) {
|
|
100977
101091
|
if (error51 instanceof Error)
|
|
@@ -100982,9 +101096,9 @@ async function pathExists2(path16) {
|
|
|
100982
101096
|
|
|
100983
101097
|
// packages/omo-opencode/src/cli/doctor/checks/codex-components.ts
|
|
100984
101098
|
init_src();
|
|
100985
|
-
import { readdir as
|
|
101099
|
+
import { readdir as readdir11, readFile as readFile22, stat as stat6 } from "node:fs/promises";
|
|
100986
101100
|
import { homedir as homedir22 } from "node:os";
|
|
100987
|
-
import { dirname as
|
|
101101
|
+
import { dirname as dirname30, isAbsolute as isAbsolute12, join as join79, relative as relative10, resolve as resolve22, sep as sep9 } from "node:path";
|
|
100988
101102
|
var CODEX_COMPONENTS_CHECK_ID = "codex-components";
|
|
100989
101103
|
var CODEX_COMPONENTS_CHECK_NAME = "codex-components";
|
|
100990
101104
|
var PLUGIN_DATA_DIR_NAME = "omo-sisyphuslabs";
|
|
@@ -100994,7 +101108,7 @@ async function checkCodexComponents(deps = {}) {
|
|
|
100994
101108
|
const env3 = deps.env ?? process.env;
|
|
100995
101109
|
const platform = deps.platform ?? process.platform;
|
|
100996
101110
|
const arch = deps.arch ?? process.arch;
|
|
100997
|
-
const codexHome =
|
|
101111
|
+
const codexHome = resolve22(deps.codexHome ?? env3["CODEX_HOME"] ?? join79(homedir22(), ".codex"));
|
|
100998
101112
|
const summary = await gatherCodexSummary({ ...deps, codexHome });
|
|
100999
101113
|
if (summary.pluginRoot === null) {
|
|
101000
101114
|
return {
|
|
@@ -101019,7 +101133,7 @@ async function checkCodexComponents(deps = {}) {
|
|
|
101019
101133
|
});
|
|
101020
101134
|
}
|
|
101021
101135
|
const runtimeSgDir = runtimeSgDirectory(codexHome, platform, arch);
|
|
101022
|
-
const runtimeSgPath =
|
|
101136
|
+
const runtimeSgPath = join79(runtimeSgDir, sgBinaryName(platform));
|
|
101023
101137
|
const sg = findSgBinarySync({
|
|
101024
101138
|
arch,
|
|
101025
101139
|
env: env3,
|
|
@@ -101058,8 +101172,8 @@ async function auditBundleTargets(pluginRoot) {
|
|
|
101058
101172
|
const manifest = await readJson2(manifestPath);
|
|
101059
101173
|
if (manifest === null || !isRecord5(manifest["mcpServers"]))
|
|
101060
101174
|
continue;
|
|
101061
|
-
const manifestRoot =
|
|
101062
|
-
const isRootManifest =
|
|
101175
|
+
const manifestRoot = dirname30(manifestPath);
|
|
101176
|
+
const isRootManifest = resolve22(manifestRoot) === resolve22(pluginRoot);
|
|
101063
101177
|
for (const server2 of Object.values(manifest["mcpServers"])) {
|
|
101064
101178
|
if (!isRecord5(server2) || !Array.isArray(server2["args"]))
|
|
101065
101179
|
continue;
|
|
@@ -101079,7 +101193,7 @@ async function auditBundleTargets(pluginRoot) {
|
|
|
101079
101193
|
continue;
|
|
101080
101194
|
const commands2 = [];
|
|
101081
101195
|
collectHookCommands(manifest, commands2);
|
|
101082
|
-
const hookPluginRoot =
|
|
101196
|
+
const hookPluginRoot = dirname30(dirname30(hookManifestPath));
|
|
101083
101197
|
for (const command of commands2) {
|
|
101084
101198
|
for (const relativePath of extractPluginRootPaths(command)) {
|
|
101085
101199
|
referencedCount += 1;
|
|
@@ -101101,8 +101215,8 @@ function recordBrokenTarget(broken, classified, origin) {
|
|
|
101101
101215
|
broken.push(entry);
|
|
101102
101216
|
}
|
|
101103
101217
|
async function classifyBundleTarget(bundleRoot, baseRoot, relativePath, allowEscape) {
|
|
101104
|
-
const targetPath =
|
|
101105
|
-
const bundleRootPath =
|
|
101218
|
+
const targetPath = resolve22(baseRoot, relativePath);
|
|
101219
|
+
const bundleRootPath = resolve22(bundleRoot);
|
|
101106
101220
|
const bundleRootPrefix = bundleRootPath.endsWith(sep9) ? bundleRootPath : `${bundleRootPath}${sep9}`;
|
|
101107
101221
|
if (targetPath !== bundleRootPath && !targetPath.startsWith(bundleRootPrefix)) {
|
|
101108
101222
|
if (allowEscape)
|
|
@@ -101118,12 +101232,12 @@ async function classifyBundleTarget(bundleRoot, baseRoot, relativePath, allowEsc
|
|
|
101118
101232
|
}
|
|
101119
101233
|
async function findHookManifestPaths(root) {
|
|
101120
101234
|
const paths2 = await findManifestPaths(root, "hooks.json");
|
|
101121
|
-
return paths2.filter((path16) =>
|
|
101235
|
+
return paths2.filter((path16) => dirname30(path16).endsWith(`${sep9}hooks`));
|
|
101122
101236
|
}
|
|
101123
101237
|
async function findManifestPaths(root, manifestName) {
|
|
101124
101238
|
let entries;
|
|
101125
101239
|
try {
|
|
101126
|
-
entries = await
|
|
101240
|
+
entries = await readdir11(root, { withFileTypes: true });
|
|
101127
101241
|
} catch {
|
|
101128
101242
|
return [];
|
|
101129
101243
|
}
|
|
@@ -101131,7 +101245,7 @@ async function findManifestPaths(root, manifestName) {
|
|
|
101131
101245
|
for (const entry of entries) {
|
|
101132
101246
|
if (entry.name === "node_modules" || entry.name === ".git")
|
|
101133
101247
|
continue;
|
|
101134
|
-
const entryPath =
|
|
101248
|
+
const entryPath = join79(root, entry.name);
|
|
101135
101249
|
if (entry.isDirectory()) {
|
|
101136
101250
|
paths2.push(...await findManifestPaths(entryPath, manifestName));
|
|
101137
101251
|
continue;
|
|
@@ -101172,21 +101286,21 @@ function extractPluginRootPaths(command) {
|
|
|
101172
101286
|
}
|
|
101173
101287
|
function isPluginRuntimePathArg(arg) {
|
|
101174
101288
|
const normalized = normalizePathSeparators(arg);
|
|
101175
|
-
return normalized.endsWith(".js") && normalized.includes("/dist/") && (normalized.startsWith("./") || normalized.startsWith("../") || normalized.startsWith("components/") || normalized.startsWith("/") ||
|
|
101289
|
+
return normalized.endsWith(".js") && normalized.includes("/dist/") && (normalized.startsWith("./") || normalized.startsWith("../") || normalized.startsWith("components/") || normalized.startsWith("/") || isAbsolute12(arg));
|
|
101176
101290
|
}
|
|
101177
101291
|
function runtimeSgDirectory(codexHome, platform, arch) {
|
|
101178
|
-
return
|
|
101292
|
+
return join79(codexHome, "runtime", "ast-grep", runtimeSlug(platform, arch));
|
|
101179
101293
|
}
|
|
101180
101294
|
function describeSgSource(sgPath, env3, runtimeSgDir, platform) {
|
|
101181
101295
|
const override = env3[SG_PATH_ENV_KEY]?.trim();
|
|
101182
101296
|
if (override !== undefined && override.length > 0 && sgPath === override)
|
|
101183
101297
|
return `env override ${SG_PATH_ENV_KEY}`;
|
|
101184
|
-
if (sgPath ===
|
|
101298
|
+
if (sgPath === join79(runtimeSgDir, sgBinaryName(platform)))
|
|
101185
101299
|
return "runtime dir";
|
|
101186
101300
|
return "PATH";
|
|
101187
101301
|
}
|
|
101188
101302
|
async function readBootstrapStateSummary(codexHome) {
|
|
101189
|
-
const statePath =
|
|
101303
|
+
const statePath = join79(codexHome, "plugins", "data", PLUGIN_DATA_DIR_NAME, "bootstrap", "state.json");
|
|
101190
101304
|
const raw = await readJson2(statePath);
|
|
101191
101305
|
if (raw === null)
|
|
101192
101306
|
return null;
|
|
@@ -101235,7 +101349,7 @@ function degradedDetailLines(entries) {
|
|
|
101235
101349
|
}
|
|
101236
101350
|
async function readJson2(path16) {
|
|
101237
101351
|
try {
|
|
101238
|
-
const parsed = JSON.parse(await
|
|
101352
|
+
const parsed = JSON.parse(await readFile22(path16, "utf8"));
|
|
101239
101353
|
return isRecord5(parsed) ? parsed : null;
|
|
101240
101354
|
} catch (error51) {
|
|
101241
101355
|
if (error51 instanceof Error)
|
|
@@ -101245,7 +101359,7 @@ async function readJson2(path16) {
|
|
|
101245
101359
|
}
|
|
101246
101360
|
async function fileSize(path16) {
|
|
101247
101361
|
try {
|
|
101248
|
-
const stats = await
|
|
101362
|
+
const stats = await stat6(path16);
|
|
101249
101363
|
return stats.isFile() ? stats.size : undefined;
|
|
101250
101364
|
} catch {
|
|
101251
101365
|
return;
|
|
@@ -101263,17 +101377,17 @@ function isRecord5(value) {
|
|
|
101263
101377
|
|
|
101264
101378
|
// packages/omo-opencode/src/cli/doctor/checks/codex-runtime-wrapper.ts
|
|
101265
101379
|
import { existsSync as existsSync59 } from "node:fs";
|
|
101266
|
-
import { readFile as
|
|
101380
|
+
import { readFile as readFile23 } from "node:fs/promises";
|
|
101267
101381
|
import { homedir as homedir23 } from "node:os";
|
|
101268
|
-
import { join as
|
|
101382
|
+
import { join as join80, resolve as resolve23 } from "node:path";
|
|
101269
101383
|
var RUNTIME_WRAPPER_MARKER2 = "OMO_GENERATED_RUNTIME_WRAPPER";
|
|
101270
101384
|
var CHECK_NAME = "codex-runtime-wrapper";
|
|
101271
101385
|
var REINSTALL_COMMAND = "npx --yes lazycodex-ai@latest install --no-tui";
|
|
101272
101386
|
async function checkCodexRuntimeWrapper(deps = {}) {
|
|
101273
|
-
const codexHome =
|
|
101387
|
+
const codexHome = resolve23(deps.codexHome ?? process.env.CODEX_HOME ?? join80(homedir23(), ".codex"));
|
|
101274
101388
|
const binDir = resolveCodexInstallerBinDir({ binDir: deps.binDir, codexHome, env: process.env });
|
|
101275
101389
|
const platform = deps.platform ?? process.platform;
|
|
101276
|
-
const wrapperPath =
|
|
101390
|
+
const wrapperPath = join80(binDir, platform === "win32" ? "omo.cmd" : "omo");
|
|
101277
101391
|
const wrapper = await readRuntimeWrapper(wrapperPath);
|
|
101278
101392
|
const issues = [];
|
|
101279
101393
|
if (wrapper?.includes(RUNTIME_WRAPPER_MARKER2) === true) {
|
|
@@ -101298,7 +101412,7 @@ async function checkCodexRuntimeWrapper(deps = {}) {
|
|
|
101298
101412
|
}
|
|
101299
101413
|
async function readRuntimeWrapper(path16) {
|
|
101300
101414
|
try {
|
|
101301
|
-
return await
|
|
101415
|
+
return await readFile23(path16, "utf8");
|
|
101302
101416
|
} catch (error51) {
|
|
101303
101417
|
if (error51 instanceof Error)
|
|
101304
101418
|
return null;
|
|
@@ -101785,14 +101899,14 @@ import {
|
|
|
101785
101899
|
unlinkSync as unlinkSync8,
|
|
101786
101900
|
writeFileSync as writeFileSync11
|
|
101787
101901
|
} from "node:fs";
|
|
101788
|
-
import { basename as basename14, dirname as
|
|
101902
|
+
import { basename as basename14, dirname as dirname31, join as join83 } from "node:path";
|
|
101789
101903
|
|
|
101790
101904
|
// packages/mcp-client-core/src/config-dir.ts
|
|
101791
101905
|
import { existsSync as existsSync60, realpathSync as realpathSync8 } from "node:fs";
|
|
101792
101906
|
import { homedir as homedir24 } from "node:os";
|
|
101793
|
-
import { join as
|
|
101907
|
+
import { join as join81, resolve as resolve24 } from "node:path";
|
|
101794
101908
|
function resolveConfigPath2(pathValue) {
|
|
101795
|
-
const resolvedPath =
|
|
101909
|
+
const resolvedPath = resolve24(pathValue);
|
|
101796
101910
|
if (!existsSync60(resolvedPath))
|
|
101797
101911
|
return resolvedPath;
|
|
101798
101912
|
try {
|
|
@@ -101808,13 +101922,13 @@ function getOpenCodeCliConfigDir(env3 = process.env) {
|
|
|
101808
101922
|
if (customConfigDir) {
|
|
101809
101923
|
return resolveConfigPath2(customConfigDir);
|
|
101810
101924
|
}
|
|
101811
|
-
const xdgConfigDir = env3["XDG_CONFIG_HOME"]?.trim() ||
|
|
101812
|
-
return resolveConfigPath2(
|
|
101925
|
+
const xdgConfigDir = env3["XDG_CONFIG_HOME"]?.trim() || join81(homedir24(), ".config");
|
|
101926
|
+
return resolveConfigPath2(join81(xdgConfigDir, "opencode"));
|
|
101813
101927
|
}
|
|
101814
101928
|
|
|
101815
101929
|
// packages/mcp-client-core/src/mcp-oauth/storage-index.ts
|
|
101816
101930
|
import { chmodSync as chmodSync3, existsSync as existsSync61, readFileSync as readFileSync41, renameSync as renameSync6, writeFileSync as writeFileSync10 } from "node:fs";
|
|
101817
|
-
import { join as
|
|
101931
|
+
import { join as join82 } from "node:path";
|
|
101818
101932
|
var INDEX_FILE_NAME = "index.json";
|
|
101819
101933
|
function isTokenIndex(value) {
|
|
101820
101934
|
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
@@ -101822,7 +101936,7 @@ function isTokenIndex(value) {
|
|
|
101822
101936
|
return Object.values(value).every((entry) => typeof entry === "string");
|
|
101823
101937
|
}
|
|
101824
101938
|
function getIndexPath(storageDir) {
|
|
101825
|
-
return
|
|
101939
|
+
return join82(storageDir, INDEX_FILE_NAME);
|
|
101826
101940
|
}
|
|
101827
101941
|
function readTokenIndex(storageDir) {
|
|
101828
101942
|
const indexPath = getIndexPath(storageDir);
|
|
@@ -101866,16 +101980,16 @@ function deleteTokenIndexEntry(storageDir, hash2) {
|
|
|
101866
101980
|
var STORAGE_DIR_NAME = "mcp-oauth";
|
|
101867
101981
|
var LEGACY_STORAGE_FILE_NAME = "mcp-oauth.json";
|
|
101868
101982
|
function getMcpOauthStorageDir() {
|
|
101869
|
-
return
|
|
101983
|
+
return join83(getOpenCodeCliConfigDir(), STORAGE_DIR_NAME);
|
|
101870
101984
|
}
|
|
101871
101985
|
function getMcpOauthServerHash(serverHost, resource) {
|
|
101872
101986
|
return createHash4("sha256").update(buildKey(serverHost, resource)).digest("hex").slice(0, 32);
|
|
101873
101987
|
}
|
|
101874
101988
|
function getMcpOauthStoragePath(serverHost, resource) {
|
|
101875
|
-
return
|
|
101989
|
+
return join83(getMcpOauthStorageDir(), `${getMcpOauthServerHash(serverHost, resource)}.json`);
|
|
101876
101990
|
}
|
|
101877
101991
|
function getLegacyStoragePath() {
|
|
101878
|
-
return
|
|
101992
|
+
return join83(getOpenCodeCliConfigDir(), LEGACY_STORAGE_FILE_NAME);
|
|
101879
101993
|
}
|
|
101880
101994
|
function normalizeHost2(serverHost) {
|
|
101881
101995
|
let host = serverHost.trim();
|
|
@@ -101969,7 +102083,7 @@ function readLegacyStore() {
|
|
|
101969
102083
|
}
|
|
101970
102084
|
function writeTokenFile(filePath, token) {
|
|
101971
102085
|
try {
|
|
101972
|
-
const dir =
|
|
102086
|
+
const dir = dirname31(filePath);
|
|
101973
102087
|
if (!existsSync62(dir)) {
|
|
101974
102088
|
mkdirSync14(dir, { recursive: true });
|
|
101975
102089
|
}
|
|
@@ -102054,7 +102168,7 @@ function listTokensByHost(serverHost) {
|
|
|
102054
102168
|
for (const [hash2, indexedKey] of Object.entries(index)) {
|
|
102055
102169
|
if (!indexedKey.startsWith(prefix))
|
|
102056
102170
|
continue;
|
|
102057
|
-
const indexedToken = readTokenFile(
|
|
102171
|
+
const indexedToken = readTokenFile(join83(getMcpOauthStorageDir(), `${hash2}.json`));
|
|
102058
102172
|
if (indexedToken)
|
|
102059
102173
|
result[indexedKey] = indexedToken;
|
|
102060
102174
|
}
|
|
@@ -102069,7 +102183,7 @@ function listAllTokens() {
|
|
|
102069
102183
|
for (const entry of readdirSync9(dir, { withFileTypes: true })) {
|
|
102070
102184
|
if (!entry.isFile() || !entry.name.endsWith(".json") || entry.name === "index.json")
|
|
102071
102185
|
continue;
|
|
102072
|
-
const token = readTokenFile(
|
|
102186
|
+
const token = readTokenFile(join83(dir, entry.name));
|
|
102073
102187
|
const hash2 = basename14(entry.name, ".json");
|
|
102074
102188
|
if (token)
|
|
102075
102189
|
result[index[hash2] ?? hash2] = token;
|
|
@@ -102269,7 +102383,7 @@ function buildAuthorizationUrl(authorizationEndpoint, options) {
|
|
|
102269
102383
|
}
|
|
102270
102384
|
var CALLBACK_TIMEOUT_MS = 5 * 60 * 1000;
|
|
102271
102385
|
function startCallbackServer(port) {
|
|
102272
|
-
return new Promise((
|
|
102386
|
+
return new Promise((resolve25, reject) => {
|
|
102273
102387
|
let timeoutId;
|
|
102274
102388
|
const server2 = createServer2((request, response) => {
|
|
102275
102389
|
clearTimeout(timeoutId);
|
|
@@ -102295,7 +102409,7 @@ function startCallbackServer(port) {
|
|
|
102295
102409
|
response.writeHead(200, { "content-type": "text/html" });
|
|
102296
102410
|
response.end("<html><body><h1>Authorization successful. You can close this tab.</h1></body></html>");
|
|
102297
102411
|
server2.close();
|
|
102298
|
-
|
|
102412
|
+
resolve25({ code, state: state2 });
|
|
102299
102413
|
});
|
|
102300
102414
|
timeoutId = setTimeout(() => {
|
|
102301
102415
|
server2.close();
|
|
@@ -102818,13 +102932,13 @@ async function codexUlwLoop(args) {
|
|
|
102818
102932
|
console.error("Codex ulw-loop is not installed. Run: npx lazycodex-ai@latest install --no-tui");
|
|
102819
102933
|
return 1;
|
|
102820
102934
|
}
|
|
102821
|
-
return new Promise((
|
|
102935
|
+
return new Promise((resolve25) => {
|
|
102822
102936
|
const child = spawn5(command.executable, [...command.argsPrefix, ...args], { stdio: "inherit" });
|
|
102823
102937
|
child.on("error", (error51) => {
|
|
102824
102938
|
console.error(error51.message);
|
|
102825
|
-
|
|
102939
|
+
resolve25(1);
|
|
102826
102940
|
});
|
|
102827
|
-
child.on("close", (code) =>
|
|
102941
|
+
child.on("close", (code) => resolve25(code ?? 1));
|
|
102828
102942
|
});
|
|
102829
102943
|
}
|
|
102830
102944
|
function resolveLocalUlwLoopBin(env3, homeDir) {
|