oh-my-opencode 4.11.1 → 4.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/skills/codex-qa/scripts/lib/app-server-client.mjs +132 -82
- package/.agents/skills/codex-qa/scripts/lib/app-server-client.test.js +48 -0
- package/.agents/skills/opencode-qa/scripts/serve-wake-split-probe.sh +361 -84
- package/.agents/skills/work-with-pr/SKILL.md +19 -5
- package/.opencode/skills/work-with-pr/SKILL.md +19 -5
- package/dist/agents/types.d.ts +7 -6
- package/dist/cli/index.js +438 -306
- package/dist/cli-node/index.js +438 -306
- package/dist/features/background-agent/parent-wake-flush-runner.d.ts +1 -0
- package/dist/features/background-agent/parent-wake-history-state.d.ts +1 -0
- package/dist/features/background-agent/parent-wake-session-history.d.ts +1 -47
- package/dist/features/background-agent/parent-wake-session-message.d.ts +47 -0
- package/dist/index.js +245 -69
- package/dist/plugin/tool-execute-before.d.ts +2 -0
- package/dist/plugin-handlers/plugin-components-loader.d.ts +1 -0
- package/dist/skills/ulw-plan/SKILL.md +2 -1
- package/dist/skills/ulw-plan/references/full-workflow.md +1 -1
- package/dist/skills/ulw-plan/references/intent-clear.md +2 -2
- package/dist/tools/delegate-task/sync-session-poller.d.ts +1 -2
- package/dist/tools/delegate-task/sync-session-turns.d.ts +3 -0
- package/dist/tui.js +16 -7
- package/package.json +13 -13
- package/packages/omo-codex/plugin/.codex-plugin/plugin.json +22 -2
- package/packages/omo-codex/plugin/components/bootstrap/dist/cli.js +25 -9
- package/packages/omo-codex/plugin/components/bootstrap/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/bootstrap/package.json +1 -1
- package/packages/omo-codex/plugin/components/codegraph/dist/cli.js +10 -3
- package/packages/omo-codex/plugin/components/codegraph/dist/serve.js +9 -2
- package/packages/omo-codex/plugin/components/codegraph/package.json +1 -1
- package/packages/omo-codex/plugin/components/codegraph/src/serve.ts +7 -2
- package/packages/omo-codex/plugin/components/codegraph/src/session-start-worker.ts +2 -1
- package/packages/omo-codex/plugin/components/codegraph/test/hook.test.ts +9 -9
- package/packages/omo-codex/plugin/components/codegraph/test/provisioned-node-guard.test.ts +94 -0
- package/packages/omo-codex/plugin/components/codegraph/test/serve-node-support.test.ts +33 -0
- package/packages/omo-codex/plugin/components/comment-checker/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/comment-checker/package.json +1 -1
- package/packages/omo-codex/plugin/components/comment-checker/test/package-smoke.test.ts +2 -71
- package/packages/omo-codex/plugin/components/git-bash/hooks/hooks.json +2 -2
- package/packages/omo-codex/plugin/components/git-bash/package.json +1 -1
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/package.json +1 -1
- package/packages/omo-codex/plugin/components/lsp/hooks/hooks.json +2 -2
- package/packages/omo-codex/plugin/components/lsp/package.json +2 -2
- package/packages/omo-codex/plugin/components/lsp/test/package-smoke.test.ts +26 -104
- package/packages/omo-codex/plugin/components/rules/hooks/hooks.json +4 -4
- package/packages/omo-codex/plugin/components/rules/package.json +1 -1
- package/packages/omo-codex/plugin/components/rules/test/package-smoke.test.ts +12 -92
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/cli.js +157 -234
- package/packages/omo-codex/plugin/components/start-work-continuation/hooks/hooks.json +2 -2
- package/packages/omo-codex/plugin/components/start-work-continuation/package.json +1 -2
- package/packages/omo-codex/plugin/components/start-work-continuation/src/boulder-reader.ts +227 -15
- package/packages/omo-codex/plugin/components/start-work-continuation/test/boulder-reader.test.ts +62 -2
- package/packages/omo-codex/plugin/components/start-work-continuation/test/cli.test.ts +34 -3
- package/packages/omo-codex/plugin/components/teammode/skills/teammode/SKILL.md +139 -0
- package/packages/omo-codex/plugin/components/teammode/skills/teammode/scripts/team-guide.mjs +111 -0
- package/packages/omo-codex/plugin/components/teammode/skills/teammode/scripts/team-state.mjs +250 -0
- package/packages/omo-codex/plugin/components/teammode/skills/teammode/scripts/team.mjs +220 -0
- package/packages/omo-codex/plugin/components/telemetry/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/telemetry/package.json +1 -1
- package/packages/omo-codex/plugin/components/test-support/package-smoke-fixture.ts +158 -0
- package/packages/omo-codex/plugin/components/ultrawork/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/package.json +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/SKILL.md +2 -1
- package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/agents/openai.yaml +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/references/full-workflow.md +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/references/intent-clear.md +2 -2
- package/packages/omo-codex/plugin/components/ultrawork/test/package-smoke.test.ts +76 -49
- package/packages/omo-codex/plugin/components/ulw-loop/hooks/hooks.json +2 -2
- package/packages/omo-codex/plugin/components/ulw-loop/package.json +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/agents/openai.yaml +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/test/package-smoke.test.ts +1 -1
- package/packages/omo-codex/plugin/hooks/post-compact-resetting-git-bash-mcp-reminder.json +17 -0
- package/packages/omo-codex/plugin/hooks/post-compact-resetting-lsp-diagnostics-cache.json +17 -0
- package/packages/omo-codex/plugin/hooks/post-compact-resetting-project-rule-cache.json +17 -0
- package/packages/omo-codex/plugin/hooks/post-tool-use-checking-comments.json +17 -0
- package/packages/omo-codex/plugin/hooks/post-tool-use-checking-lsp-diagnostics.json +17 -0
- package/packages/omo-codex/plugin/hooks/post-tool-use-matching-project-rules.json +17 -0
- package/packages/omo-codex/plugin/hooks/pre-tool-use-enforcing-unlimited-goal-budget.json +17 -0
- package/packages/omo-codex/plugin/hooks/pre-tool-use-recommending-git-bash-mcp.json +17 -0
- package/packages/omo-codex/plugin/hooks/session-start-checking-auto-update.json +17 -0
- package/packages/omo-codex/plugin/hooks/session-start-checking-bootstrap-provisioning.json +17 -0
- package/packages/omo-codex/plugin/hooks/session-start-checking-codegraph-bootstrap.json +16 -0
- package/packages/omo-codex/plugin/hooks/session-start-loading-project-rules.json +16 -0
- package/packages/omo-codex/plugin/hooks/session-start-recording-session-telemetry.json +16 -0
- package/packages/omo-codex/plugin/hooks/stop-checking-start-work-continuation.json +16 -0
- package/packages/omo-codex/plugin/hooks/subagent-stop-checking-start-work-continuation.json +16 -0
- package/packages/omo-codex/plugin/hooks/subagent-stop-verifying-lazycodex-executor-evidence.json +17 -0
- package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ultrawork-trigger.json +16 -0
- package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ulw-loop-steering.json +16 -0
- package/packages/omo-codex/plugin/hooks/user-prompt-submit-loading-project-rules.json +16 -0
- package/packages/omo-codex/plugin/package-lock.json +12 -22
- package/packages/omo-codex/plugin/package.json +1 -1
- package/packages/omo-codex/plugin/scripts/hook-status-message.mjs +14 -11
- package/packages/omo-codex/plugin/scripts/sync-hook-status-messages.mjs +15 -4
- package/packages/omo-codex/plugin/scripts/sync-skills.mjs +37 -0
- package/packages/omo-codex/plugin/skills/ast-grep/agents/openai.yaml +2 -0
- package/packages/omo-codex/plugin/skills/comment-checker/agents/openai.yaml +2 -0
- package/packages/omo-codex/plugin/skills/debugging/agents/openai.yaml +2 -0
- package/packages/omo-codex/plugin/skills/frontend/agents/openai.yaml +2 -0
- package/packages/omo-codex/plugin/skills/git-master/agents/openai.yaml +1 -1
- package/packages/omo-codex/plugin/skills/init-deep/agents/openai.yaml +2 -0
- package/packages/omo-codex/plugin/skills/lcx-contribute-bug-fix/agents/openai.yaml +1 -1
- package/packages/omo-codex/plugin/skills/lcx-doctor/agents/openai.yaml +1 -1
- package/packages/omo-codex/plugin/skills/lcx-report-bug/agents/openai.yaml +1 -1
- package/packages/omo-codex/plugin/skills/lsp/agents/openai.yaml +2 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/agents/openai.yaml +2 -0
- package/packages/omo-codex/plugin/skills/programming/agents/openai.yaml +2 -0
- package/packages/omo-codex/plugin/skills/refactor/agents/openai.yaml +2 -0
- package/packages/omo-codex/plugin/skills/remove-ai-slops/agents/openai.yaml +2 -0
- package/packages/omo-codex/plugin/skills/review-work/agents/openai.yaml +2 -0
- package/packages/omo-codex/plugin/skills/rules/agents/openai.yaml +2 -0
- package/packages/omo-codex/plugin/skills/start-work/agents/openai.yaml +2 -0
- package/packages/omo-codex/plugin/skills/teammode/SKILL.md +139 -0
- package/packages/omo-codex/plugin/skills/teammode/agents/openai.yaml +2 -0
- package/packages/omo-codex/plugin/skills/teammode/scripts/team-guide.mjs +111 -0
- package/packages/omo-codex/plugin/skills/teammode/scripts/team-state.mjs +250 -0
- package/packages/omo-codex/plugin/skills/teammode/scripts/team.mjs +220 -0
- package/packages/omo-codex/plugin/skills/ultraresearch/agents/openai.yaml +2 -0
- package/packages/omo-codex/plugin/skills/ulw-loop/agents/openai.yaml +1 -1
- package/packages/omo-codex/plugin/skills/ulw-plan/SKILL.md +2 -1
- package/packages/omo-codex/plugin/skills/ulw-plan/agents/openai.yaml +1 -1
- package/packages/omo-codex/plugin/skills/ulw-plan/references/full-workflow.md +1 -1
- package/packages/omo-codex/plugin/skills/ulw-plan/references/intent-clear.md +2 -2
- package/packages/omo-codex/plugin/skills/visual-qa/agents/openai.yaml +2 -0
- package/packages/omo-codex/plugin/test/aggregate-hooks.test.mjs +34 -33
- package/packages/omo-codex/plugin/test/aggregate-manifest.test.mjs +5 -2
- package/packages/omo-codex/plugin/test/aggregate-plugin-fixture.mjs +13 -0
- package/packages/omo-codex/plugin/test/bootstrap-binlinks.test.mjs +1 -1
- package/packages/omo-codex/plugin/test/bootstrap-hooks.test.mjs +14 -6
- package/packages/omo-codex/plugin/test/bootstrap-ps-guard.test.mjs +7 -3
- package/packages/omo-codex/plugin/test/component-bundled-cli.test.mjs +3 -3
- package/packages/omo-codex/plugin/test/display-metadata.test.mjs +83 -0
- package/packages/omo-codex/plugin/test/hook-status-message.test.mjs +30 -19
- package/packages/omo-codex/plugin/test/lcx-bug-skills.test.mjs +3 -3
- package/packages/omo-codex/plugin/test/sync-hook-status-messages.test.mjs +6 -6
- package/packages/omo-codex/plugin/test/sync-skills-test-support.mjs +2 -0
- package/packages/omo-codex/plugin/test/sync-skills.test.mjs +9 -4
- package/packages/omo-codex/plugin/test/teammode-safety-fixture.mjs +88 -0
- package/packages/omo-codex/plugin/test/teammode-safety.test.mjs +240 -0
- package/packages/omo-codex/scripts/install-dist/install-local.mjs +385 -206
- package/packages/omo-codex/scripts/install-hook-targets.test.mjs +93 -0
- package/packages/omo-codex/scripts/install-lazycodex-version-stamp.test.mjs +2 -2
- package/packages/omo-codex/scripts/install-local-bun-global-update.test.mjs +63 -0
- package/packages/omo-codex/scripts/install-local-entrypoint.test.mjs +109 -1
- package/packages/omo-codex/scripts/install-local.mjs +1 -0
- package/packages/shared-skills/skills/ulw-plan/SKILL.md +2 -1
- package/packages/shared-skills/skills/ulw-plan/references/full-workflow.md +1 -1
- package/packages/shared-skills/skills/ulw-plan/references/intent-clear.md +2 -2
- package/packages/omo-codex/plugin/hooks/hooks.json +0 -214
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.
|
|
2149
|
+
version: "4.12.0",
|
|
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",
|
|
@@ -2316,18 +2316,18 @@ var init_package = __esm(() => {
|
|
|
2316
2316
|
typescript: "^6.0.3"
|
|
2317
2317
|
},
|
|
2318
2318
|
optionalDependencies: {
|
|
2319
|
-
"oh-my-opencode-darwin-arm64": "4.
|
|
2320
|
-
"oh-my-opencode-darwin-x64": "4.
|
|
2321
|
-
"oh-my-opencode-darwin-x64-baseline": "4.
|
|
2322
|
-
"oh-my-opencode-linux-arm64": "4.
|
|
2323
|
-
"oh-my-opencode-linux-arm64-musl": "4.
|
|
2324
|
-
"oh-my-opencode-linux-x64": "4.
|
|
2325
|
-
"oh-my-opencode-linux-x64-baseline": "4.
|
|
2326
|
-
"oh-my-opencode-linux-x64-musl": "4.
|
|
2327
|
-
"oh-my-opencode-linux-x64-musl-baseline": "4.
|
|
2328
|
-
"oh-my-opencode-windows-arm64": "4.
|
|
2329
|
-
"oh-my-opencode-windows-x64": "4.
|
|
2330
|
-
"oh-my-opencode-windows-x64-baseline": "4.
|
|
2319
|
+
"oh-my-opencode-darwin-arm64": "4.12.0",
|
|
2320
|
+
"oh-my-opencode-darwin-x64": "4.12.0",
|
|
2321
|
+
"oh-my-opencode-darwin-x64-baseline": "4.12.0",
|
|
2322
|
+
"oh-my-opencode-linux-arm64": "4.12.0",
|
|
2323
|
+
"oh-my-opencode-linux-arm64-musl": "4.12.0",
|
|
2324
|
+
"oh-my-opencode-linux-x64": "4.12.0",
|
|
2325
|
+
"oh-my-opencode-linux-x64-baseline": "4.12.0",
|
|
2326
|
+
"oh-my-opencode-linux-x64-musl": "4.12.0",
|
|
2327
|
+
"oh-my-opencode-linux-x64-musl-baseline": "4.12.0",
|
|
2328
|
+
"oh-my-opencode-windows-arm64": "4.12.0",
|
|
2329
|
+
"oh-my-opencode-windows-x64": "4.12.0",
|
|
2330
|
+
"oh-my-opencode-windows-x64-baseline": "4.12.0"
|
|
2331
2331
|
},
|
|
2332
2332
|
overrides: {
|
|
2333
2333
|
hono: "^4.12.18",
|
|
@@ -56796,7 +56796,7 @@ async function probe(registration) {
|
|
|
56796
56796
|
registration.available = false;
|
|
56797
56797
|
return false;
|
|
56798
56798
|
}
|
|
56799
|
-
const probeUrl = new URL("/
|
|
56799
|
+
const probeUrl = new URL("/global/health", registration.serverUrl);
|
|
56800
56800
|
const authHeader = getServerBasicAuthHeader();
|
|
56801
56801
|
const headers = authHeader ? { Authorization: authHeader } : {};
|
|
56802
56802
|
try {
|
|
@@ -56830,12 +56830,17 @@ async function probe(registration) {
|
|
|
56830
56830
|
return false;
|
|
56831
56831
|
}
|
|
56832
56832
|
}
|
|
56833
|
-
function
|
|
56834
|
-
|
|
56833
|
+
function getFreshProbeAvailability(registration) {
|
|
56834
|
+
const available = registration.available;
|
|
56835
|
+
if (available === undefined || Date.now() - registration.probeTimestamp >= PROBE_TTL_MS) {
|
|
56836
|
+
return;
|
|
56837
|
+
}
|
|
56838
|
+
return available;
|
|
56835
56839
|
}
|
|
56836
56840
|
async function resolveAvailability(registration) {
|
|
56837
|
-
|
|
56838
|
-
|
|
56841
|
+
const freshAvailability = getFreshProbeAvailability(registration);
|
|
56842
|
+
if (freshAvailability !== undefined) {
|
|
56843
|
+
return freshAvailability;
|
|
56839
56844
|
}
|
|
56840
56845
|
if (!registration.inFlightProbe) {
|
|
56841
56846
|
registration.inFlightProbe = probe(registration).finally(() => {
|
|
@@ -56870,10 +56875,11 @@ function tryResolveDispatchClientSync2(client3, sessionID) {
|
|
|
56870
56875
|
if (!registration.serverUrl) {
|
|
56871
56876
|
return { client: client3, route: "in-process", reason: "unavailable" };
|
|
56872
56877
|
}
|
|
56873
|
-
|
|
56878
|
+
const freshAvailability = getFreshProbeAvailability(registration);
|
|
56879
|
+
if (freshAvailability === undefined) {
|
|
56874
56880
|
return;
|
|
56875
56881
|
}
|
|
56876
|
-
if (!
|
|
56882
|
+
if (!freshAvailability) {
|
|
56877
56883
|
return { client: client3, route: "in-process", reason: "unavailable" };
|
|
56878
56884
|
}
|
|
56879
56885
|
const resolvedLiveClient = getOrBuildLiveClient(registration);
|
|
@@ -56888,6 +56894,9 @@ async function resolveDispatchClient2(client3, sessionID) {
|
|
|
56888
56894
|
return syncResult;
|
|
56889
56895
|
}
|
|
56890
56896
|
const registration = registrations.get(client3);
|
|
56897
|
+
if (!registration) {
|
|
56898
|
+
return { client: client3, route: "in-process", reason: "identity" };
|
|
56899
|
+
}
|
|
56891
56900
|
const isAvailable = await resolveAvailability(registration);
|
|
56892
56901
|
if (!isAvailable) {
|
|
56893
56902
|
return { client: client3, route: "in-process", reason: "unavailable" };
|
|
@@ -58938,20 +58947,20 @@ var init_config_manager = __esm(() => {
|
|
|
58938
58947
|
|
|
58939
58948
|
// packages/telemetry-core/src/activity-state.ts
|
|
58940
58949
|
import { existsSync as existsSync27, mkdirSync as mkdirSync8, readFileSync as readFileSync13 } from "node:fs";
|
|
58941
|
-
import { basename as basename9, join as
|
|
58950
|
+
import { basename as basename9, join as join48 } from "node:path";
|
|
58942
58951
|
function resolveTelemetryStateDir(product, options = {}) {
|
|
58943
58952
|
const dataDir = resolveXdgDataDir(product.cacheDirName, {
|
|
58944
58953
|
env: options.env,
|
|
58945
58954
|
osProvider: options.osProvider
|
|
58946
58955
|
});
|
|
58947
|
-
const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined :
|
|
58956
|
+
const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined : join48(options.env.XDG_DATA_HOME, product.cacheDirName);
|
|
58948
58957
|
if (dataDir === xdgStateDir || xdgStateDir === undefined && basename9(dataDir) === product.cacheDirName) {
|
|
58949
58958
|
return dataDir;
|
|
58950
58959
|
}
|
|
58951
|
-
return
|
|
58960
|
+
return join48(dataDir, product.cacheDirName);
|
|
58952
58961
|
}
|
|
58953
58962
|
function getTelemetryActivityStateFilePath(stateDir) {
|
|
58954
|
-
return
|
|
58963
|
+
return join48(stateDir, POSTHOG_ACTIVITY_STATE_FILE);
|
|
58955
58964
|
}
|
|
58956
58965
|
function getDailyActiveCaptureState(input) {
|
|
58957
58966
|
const state = readPostHogActivityState(input.stateDir, input.diagnostics);
|
|
@@ -59022,9 +59031,9 @@ var DEFAULT_POSTHOG_HOST = "https://us.i.posthog.com", DEFAULT_POSTHOG_API_KEY =
|
|
|
59022
59031
|
|
|
59023
59032
|
// packages/telemetry-core/src/diagnostics.ts
|
|
59024
59033
|
import { appendFileSync as appendFileSync2, existsSync as existsSync28, mkdirSync as mkdirSync9, readFileSync as readFileSync14 } from "node:fs";
|
|
59025
|
-
import { join as
|
|
59034
|
+
import { join as join49 } from "node:path";
|
|
59026
59035
|
function getTelemetryDiagnosticsFilePath(diagnosticsDir) {
|
|
59027
|
-
return
|
|
59036
|
+
return join49(diagnosticsDir, DIAGNOSTICS_FILE_NAME);
|
|
59028
59037
|
}
|
|
59029
59038
|
function writeTelemetryDiagnostic(input, options) {
|
|
59030
59039
|
const now = options.now ?? new Date;
|
|
@@ -59190,7 +59199,7 @@ function getTelemetryDistinctId(machineIdPrefix, osProvider = getDefaultTelemetr
|
|
|
59190
59199
|
var init_machine_id = () => {};
|
|
59191
59200
|
|
|
59192
59201
|
// node_modules/.bun/posthog-node@5.35.12/node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
|
|
59193
|
-
import { dirname as dirname15, posix as posix2, sep as
|
|
59202
|
+
import { dirname as dirname15, posix as posix2, sep as sep7 } from "path";
|
|
59194
59203
|
function createModulerModifier() {
|
|
59195
59204
|
const getModuleFromFileName = createGetModuleFromFilename();
|
|
59196
59205
|
return async (frames) => {
|
|
@@ -59199,7 +59208,7 @@ function createModulerModifier() {
|
|
|
59199
59208
|
return frames;
|
|
59200
59209
|
};
|
|
59201
59210
|
}
|
|
59202
|
-
function createGetModuleFromFilename(basePath = process.argv[1] ? dirname15(process.argv[1]) : process.cwd(), isWindows =
|
|
59211
|
+
function createGetModuleFromFilename(basePath = process.argv[1] ? dirname15(process.argv[1]) : process.cwd(), isWindows = sep7 === "\\") {
|
|
59203
59212
|
const normalizedBase = isWindows ? normalizeWindowsPath(basePath) : basePath;
|
|
59204
59213
|
return (filename) => {
|
|
59205
59214
|
if (!filename)
|
|
@@ -62220,9 +62229,9 @@ var init_context_lines_node = __esm(() => {
|
|
|
62220
62229
|
});
|
|
62221
62230
|
|
|
62222
62231
|
// node_modules/.bun/posthog-node@5.35.12/node_modules/posthog-node/dist/extensions/error-tracking/modifiers/relative-path.node.mjs
|
|
62223
|
-
import { isAbsolute as isAbsolute7, relative as relative5, sep as
|
|
62232
|
+
import { isAbsolute as isAbsolute7, relative as relative5, sep as sep8 } from "path";
|
|
62224
62233
|
function createRelativePathModifier(basePath = process.cwd()) {
|
|
62225
|
-
const isWindows =
|
|
62234
|
+
const isWindows = sep8 === "\\";
|
|
62226
62235
|
const toUnix = (p) => isWindows ? p.replace(/\\/g, "/") : p;
|
|
62227
62236
|
const normalizedBase = toUnix(basePath);
|
|
62228
62237
|
return async (frames) => {
|
|
@@ -64749,7 +64758,7 @@ var package_default2;
|
|
|
64749
64758
|
var init_package2 = __esm(() => {
|
|
64750
64759
|
package_default2 = {
|
|
64751
64760
|
name: "@oh-my-opencode/omo-codex",
|
|
64752
|
-
version: "4.
|
|
64761
|
+
version: "4.12.0",
|
|
64753
64762
|
type: "module",
|
|
64754
64763
|
private: true,
|
|
64755
64764
|
description: "Codex harness adapter for oh-my-openagent. Vendored Codex plugin namespace (omo) + TypeScript installer + telemetry.",
|
|
@@ -65719,7 +65728,7 @@ var init_update_toasts = __esm(() => {
|
|
|
65719
65728
|
|
|
65720
65729
|
// packages/omo-opencode/src/hooks/auto-update-checker/hook/background-update-check.ts
|
|
65721
65730
|
import { existsSync as existsSync47 } from "node:fs";
|
|
65722
|
-
import { dirname as dirname23, join as
|
|
65731
|
+
import { dirname as dirname23, join as join65 } from "node:path";
|
|
65723
65732
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
65724
65733
|
function defaultGetModuleHostingWorkspace() {
|
|
65725
65734
|
try {
|
|
@@ -65873,7 +65882,7 @@ var init_background_update_check = __esm(() => {
|
|
|
65873
65882
|
init_update_toasts();
|
|
65874
65883
|
defaultDeps4 = {
|
|
65875
65884
|
existsSync: existsSync47,
|
|
65876
|
-
join:
|
|
65885
|
+
join: join65,
|
|
65877
65886
|
runBunInstallWithDetails,
|
|
65878
65887
|
log: log2,
|
|
65879
65888
|
getOpenCodeCacheDir,
|
|
@@ -66475,7 +66484,7 @@ function getUnsupportedOpenCodeVersionMessage(openCodeVersion) {
|
|
|
66475
66484
|
}
|
|
66476
66485
|
|
|
66477
66486
|
// packages/omo-codex/src/install/install-codex.ts
|
|
66478
|
-
import { join as
|
|
66487
|
+
import { join as join50, resolve as resolve14 } from "node:path";
|
|
66479
66488
|
import { existsSync as existsSync29 } from "node:fs";
|
|
66480
66489
|
import { homedir as homedir6 } from "node:os";
|
|
66481
66490
|
|
|
@@ -66839,8 +66848,8 @@ async function existingNonSymlink(path7) {
|
|
|
66839
66848
|
}
|
|
66840
66849
|
}
|
|
66841
66850
|
// packages/omo-codex/src/install/codex-cache-install.ts
|
|
66842
|
-
import { cp as cp2, mkdir as mkdir3, readFile as
|
|
66843
|
-
import { basename as basename6, dirname as dirname11, join as
|
|
66851
|
+
import { cp as cp2, mkdir as mkdir3, readFile as readFile7, rename, rm as rm3 } from "node:fs/promises";
|
|
66852
|
+
import { basename as basename6, dirname as dirname11, join as join31, sep as sep5 } from "node:path";
|
|
66844
66853
|
|
|
66845
66854
|
// packages/omo-codex/src/install/codex-cache-bundled-mcps.ts
|
|
66846
66855
|
import { cp, mkdir as mkdir2, readFile as readFile3, stat as stat2 } from "node:fs/promises";
|
|
@@ -67178,13 +67187,83 @@ async function rewriteCachedManifestRoot(pluginRoot, fromRoot, toRoot) {
|
|
|
67178
67187
|
`);
|
|
67179
67188
|
}
|
|
67180
67189
|
|
|
67190
|
+
// packages/omo-codex/src/install/codex-hook-targets.ts
|
|
67191
|
+
import { readFile as readFile6 } from "node:fs/promises";
|
|
67192
|
+
import { join as join30, sep as sep4 } from "node:path";
|
|
67193
|
+
var PLUGIN_ROOT_TARGET_PATTERN = /\$\{PLUGIN_ROOT\}[\\/]+([^"']+)/g;
|
|
67194
|
+
async function findMissingHookCommandTargets(pluginRoot) {
|
|
67195
|
+
const commands = [];
|
|
67196
|
+
for (const manifestPath of await hookManifestPaths(pluginRoot)) {
|
|
67197
|
+
if (!await fileExistsStrict(manifestPath))
|
|
67198
|
+
continue;
|
|
67199
|
+
const parsed = JSON.parse(await readFile6(manifestPath, "utf8"));
|
|
67200
|
+
collectCommands(parsed, commands);
|
|
67201
|
+
}
|
|
67202
|
+
const missing = [];
|
|
67203
|
+
const seen = new Set;
|
|
67204
|
+
for (const command of commands) {
|
|
67205
|
+
for (const match of command.matchAll(PLUGIN_ROOT_TARGET_PATTERN)) {
|
|
67206
|
+
const targetSuffix = match[1];
|
|
67207
|
+
if (targetSuffix === undefined)
|
|
67208
|
+
continue;
|
|
67209
|
+
const target = join30(pluginRoot, ...targetSuffix.split(/[\\/]+/));
|
|
67210
|
+
if (seen.has(target))
|
|
67211
|
+
continue;
|
|
67212
|
+
seen.add(target);
|
|
67213
|
+
if (!await fileExistsStrict(target))
|
|
67214
|
+
missing.push(target);
|
|
67215
|
+
}
|
|
67216
|
+
}
|
|
67217
|
+
return missing;
|
|
67218
|
+
}
|
|
67219
|
+
async function hookManifestPaths(pluginRoot) {
|
|
67220
|
+
const pluginManifestPath = join30(pluginRoot, ".codex-plugin", "plugin.json");
|
|
67221
|
+
if (!await fileExistsStrict(pluginManifestPath))
|
|
67222
|
+
return [join30(pluginRoot, "hooks", "hooks.json")];
|
|
67223
|
+
const parsed = JSON.parse(await readFile6(pluginManifestPath, "utf8"));
|
|
67224
|
+
if (!isPlainRecord3(parsed))
|
|
67225
|
+
return [];
|
|
67226
|
+
if (typeof parsed.hooks === "string" && parsed.hooks.trim() !== "") {
|
|
67227
|
+
return [join30(pluginRoot, stripDotSlash(parsed.hooks))];
|
|
67228
|
+
}
|
|
67229
|
+
if (Array.isArray(parsed.hooks)) {
|
|
67230
|
+
return parsed.hooks.filter((hookPath) => typeof hookPath === "string" && hookPath.trim() !== "").map((hookPath) => join30(pluginRoot, stripDotSlash(hookPath)));
|
|
67231
|
+
}
|
|
67232
|
+
return [];
|
|
67233
|
+
}
|
|
67234
|
+
function stripDotSlash(path7) {
|
|
67235
|
+
return path7.startsWith("./") ? path7.slice(2) : path7;
|
|
67236
|
+
}
|
|
67237
|
+
async function assertHookCommandTargets(pluginRoot) {
|
|
67238
|
+
const missing = await findMissingHookCommandTargets(pluginRoot);
|
|
67239
|
+
if (missing.length === 0)
|
|
67240
|
+
return;
|
|
67241
|
+
const relativeMissing = missing.map((path7) => path7.split(`${pluginRoot}${sep4}`).join("").split(sep4).join("/"));
|
|
67242
|
+
throw new Error(`Plugin payload is missing ${missing.length} hook command target(s) referenced by hooks.json: ${relativeMissing.join(", ")}. ` + "The previous plugin cache was left untouched; this payload was not activated.");
|
|
67243
|
+
}
|
|
67244
|
+
function collectCommands(value, commands) {
|
|
67245
|
+
if (Array.isArray(value)) {
|
|
67246
|
+
for (const entry of value)
|
|
67247
|
+
collectCommands(entry, commands);
|
|
67248
|
+
return;
|
|
67249
|
+
}
|
|
67250
|
+
if (!isPlainRecord3(value))
|
|
67251
|
+
return;
|
|
67252
|
+
if (value["type"] === "command" && typeof value["command"] === "string")
|
|
67253
|
+
commands.push(value["command"]);
|
|
67254
|
+
if (value["type"] === "command" && typeof value["commandWindows"] === "string")
|
|
67255
|
+
commands.push(value["commandWindows"]);
|
|
67256
|
+
for (const entry of Object.values(value))
|
|
67257
|
+
collectCommands(entry, commands);
|
|
67258
|
+
}
|
|
67259
|
+
|
|
67181
67260
|
// packages/omo-codex/src/install/codex-cache-install.ts
|
|
67182
67261
|
async function installCachedPlugin(input) {
|
|
67183
67262
|
if (input.buildSource !== false) {
|
|
67184
67263
|
await maybeRunNpmInstall(input.sourcePath, input.runCommand);
|
|
67185
67264
|
await maybeRunNpmBuild(input.sourcePath, input.runCommand);
|
|
67186
67265
|
}
|
|
67187
|
-
const targetPath =
|
|
67266
|
+
const targetPath = join31(input.codexHome, "plugins", "cache", input.marketplaceName, input.name, input.version);
|
|
67188
67267
|
const tempPath = createTempSiblingPath(targetPath);
|
|
67189
67268
|
await rm3(tempPath, { recursive: true, force: true });
|
|
67190
67269
|
try {
|
|
@@ -67194,6 +67273,7 @@ async function installCachedPlugin(input) {
|
|
|
67194
67273
|
await maybeRunNpmInstall(tempPath, input.runCommand, ["ci", "--omit=dev"]);
|
|
67195
67274
|
await rewriteCachedMcpManifest(tempPath, input.sourcePath);
|
|
67196
67275
|
await rewriteCachedManifestRoot(tempPath, tempPath, targetPath);
|
|
67276
|
+
await assertHookCommandTargets(tempPath);
|
|
67197
67277
|
await promoteDirectory(tempPath, targetPath, input.renameDirectory ?? rename);
|
|
67198
67278
|
} catch (error) {
|
|
67199
67279
|
await rm3(tempPath, { recursive: true, force: true });
|
|
@@ -67202,14 +67282,14 @@ async function installCachedPlugin(input) {
|
|
|
67202
67282
|
return { name: input.name, version: input.version, path: targetPath };
|
|
67203
67283
|
}
|
|
67204
67284
|
async function maybeRunNpmInstall(cwd, runCommand, args = ["install"]) {
|
|
67205
|
-
if (!await fileExistsStrict(
|
|
67285
|
+
if (!await fileExistsStrict(join31(cwd, "package.json")))
|
|
67206
67286
|
return;
|
|
67207
67287
|
await runCommand("npm", args, { cwd });
|
|
67208
67288
|
}
|
|
67209
67289
|
async function maybeRunNpmBuild(cwd, runCommand) {
|
|
67210
|
-
if (!await fileExistsStrict(
|
|
67290
|
+
if (!await fileExistsStrict(join31(cwd, "package.json")))
|
|
67211
67291
|
return;
|
|
67212
|
-
const packageJson = JSON.parse(await
|
|
67292
|
+
const packageJson = JSON.parse(await readFile7(join31(cwd, "package.json"), "utf8"));
|
|
67213
67293
|
if (!isPlainRecord3(packageJson))
|
|
67214
67294
|
return;
|
|
67215
67295
|
const scripts = packageJson.scripts;
|
|
@@ -67218,10 +67298,10 @@ async function maybeRunNpmBuild(cwd, runCommand) {
|
|
|
67218
67298
|
await runCommand("npm", ["run", "build"], { cwd });
|
|
67219
67299
|
}
|
|
67220
67300
|
function createTempSiblingPath(targetPath) {
|
|
67221
|
-
return
|
|
67301
|
+
return join31(dirname11(targetPath), `.tmp-${basename6(targetPath)}-${process.pid}-${Date.now()}`);
|
|
67222
67302
|
}
|
|
67223
67303
|
function createBackupSiblingPath(targetPath) {
|
|
67224
|
-
return
|
|
67304
|
+
return join31(dirname11(targetPath), `.backup-${basename6(targetPath)}-${process.pid}-${Date.now()}`);
|
|
67225
67305
|
}
|
|
67226
67306
|
async function copyDirectory(sourcePath, targetPath) {
|
|
67227
67307
|
await mkdir3(dirname11(targetPath), { recursive: true });
|
|
@@ -67252,17 +67332,17 @@ async function restoreBackupDirectory(backupPath, targetPath, renameDirectory) {
|
|
|
67252
67332
|
await renameDirectory(backupPath, targetPath);
|
|
67253
67333
|
}
|
|
67254
67334
|
function shouldCopyPluginPath(path7, root) {
|
|
67255
|
-
const relative5 = path7 === root ? "" : path7.slice(root.length +
|
|
67335
|
+
const relative5 = path7 === root ? "" : path7.slice(root.length + sep5.length);
|
|
67256
67336
|
if (relative5 === "")
|
|
67257
67337
|
return true;
|
|
67258
|
-
const parts = relative5.split(
|
|
67338
|
+
const parts = relative5.split(sep5);
|
|
67259
67339
|
return !parts.some((part) => part === ".git" || part === "node_modules");
|
|
67260
67340
|
}
|
|
67261
67341
|
// packages/omo-codex/src/install/codex-cache-prune.ts
|
|
67262
67342
|
import { lstat as lstat4, readdir as readdir3, rm as rm4, stat as stat3 } from "node:fs/promises";
|
|
67263
|
-
import { join as
|
|
67343
|
+
import { join as join32 } from "node:path";
|
|
67264
67344
|
async function pruneMarketplaceCache(input) {
|
|
67265
|
-
const cacheRoot =
|
|
67345
|
+
const cacheRoot = join32(input.codexHome, "plugins", "cache", input.marketplaceName);
|
|
67266
67346
|
if (!await fileExistsStrict(cacheRoot))
|
|
67267
67347
|
return;
|
|
67268
67348
|
const keep = new Set(input.keepPluginNames);
|
|
@@ -67270,15 +67350,15 @@ async function pruneMarketplaceCache(input) {
|
|
|
67270
67350
|
for (const entry of entries) {
|
|
67271
67351
|
if (!entry.isDirectory() || keep.has(entry.name))
|
|
67272
67352
|
continue;
|
|
67273
|
-
await rm4(
|
|
67353
|
+
await rm4(join32(cacheRoot, entry.name), { recursive: true, force: true });
|
|
67274
67354
|
}
|
|
67275
67355
|
}
|
|
67276
67356
|
async function pruneMarketplacePluginCaches(input) {
|
|
67277
|
-
const cacheRoot =
|
|
67357
|
+
const cacheRoot = join32(input.codexHome, "plugins", "cache", input.marketplaceName);
|
|
67278
67358
|
if (!await fileExistsStrict(cacheRoot))
|
|
67279
67359
|
return;
|
|
67280
67360
|
for (const pluginName of input.pluginNames) {
|
|
67281
|
-
await rm4(
|
|
67361
|
+
await rm4(join32(cacheRoot, pluginName), { recursive: true, force: true });
|
|
67282
67362
|
}
|
|
67283
67363
|
const remainingEntries = await readCacheEntryNames(cacheRoot);
|
|
67284
67364
|
if (remainingEntries.length === 0) {
|
|
@@ -67325,11 +67405,11 @@ async function isBrokenCacheSymlink(path7) {
|
|
|
67325
67405
|
}
|
|
67326
67406
|
// packages/omo-codex/src/install/codex-cached-marketplace-manifest.ts
|
|
67327
67407
|
import { mkdir as mkdir4, writeFile as writeFile4 } from "node:fs/promises";
|
|
67328
|
-
import { join as
|
|
67408
|
+
import { join as join33 } from "node:path";
|
|
67329
67409
|
async function writeCachedMarketplaceManifest(input) {
|
|
67330
|
-
const marketplaceDir =
|
|
67410
|
+
const marketplaceDir = join33(input.marketplaceRoot, ".agents", "plugins");
|
|
67331
67411
|
await mkdir4(marketplaceDir, { recursive: true });
|
|
67332
|
-
await writeFile4(
|
|
67412
|
+
await writeFile4(join33(marketplaceDir, "marketplace.json"), `${JSON.stringify({
|
|
67333
67413
|
name: input.marketplaceName,
|
|
67334
67414
|
plugins: input.plugins.map((plugin) => ({
|
|
67335
67415
|
name: plugin.name,
|
|
@@ -67341,8 +67421,8 @@ async function writeCachedMarketplaceManifest(input) {
|
|
|
67341
67421
|
|
|
67342
67422
|
// packages/omo-codex/src/install/codex-package-layout.ts
|
|
67343
67423
|
import { existsSync as existsSync26 } from "node:fs";
|
|
67344
|
-
import { readFile as
|
|
67345
|
-
import { join as
|
|
67424
|
+
import { readFile as readFile8 } from "node:fs/promises";
|
|
67425
|
+
import { join as join34 } from "node:path";
|
|
67346
67426
|
var PACKAGED_CODEX_INSTALLER_NAMES = new Set([
|
|
67347
67427
|
"@code-yeongyu/lazycodex",
|
|
67348
67428
|
"@code-yeongyu/lazycodex-ai",
|
|
@@ -67352,19 +67432,19 @@ var PACKAGED_CODEX_INSTALLER_NAMES = new Set([
|
|
|
67352
67432
|
"oh-my-openagent"
|
|
67353
67433
|
]);
|
|
67354
67434
|
async function shouldBuildSourcePackages(repoRoot) {
|
|
67355
|
-
if (existsSync26(
|
|
67435
|
+
if (existsSync26(join34(repoRoot, "packages", "omo-opencode", "src", "index.ts")))
|
|
67356
67436
|
return true;
|
|
67357
|
-
const packageJsonPath =
|
|
67437
|
+
const packageJsonPath = join34(repoRoot, "package.json");
|
|
67358
67438
|
if (!existsSync26(packageJsonPath))
|
|
67359
67439
|
return true;
|
|
67360
|
-
const packageJson = JSON.parse(await
|
|
67440
|
+
const packageJson = JSON.parse(await readFile8(packageJsonPath, "utf8"));
|
|
67361
67441
|
if (!isPlainRecord3(packageJson) || typeof packageJson.name !== "string")
|
|
67362
67442
|
return true;
|
|
67363
67443
|
return !PACKAGED_CODEX_INSTALLER_NAMES.has(packageJson.name);
|
|
67364
67444
|
}
|
|
67365
67445
|
|
|
67366
67446
|
// packages/omo-codex/src/install/codex-config-toml.ts
|
|
67367
|
-
import { mkdir as mkdir5, readFile as
|
|
67447
|
+
import { mkdir as mkdir5, readFile as readFile10 } from "node:fs/promises";
|
|
67368
67448
|
import { dirname as dirname13 } from "node:path";
|
|
67369
67449
|
|
|
67370
67450
|
// packages/omo-codex/src/install/toml-section-editor.ts
|
|
@@ -67552,12 +67632,12 @@ function tomlKeySegment(value) {
|
|
|
67552
67632
|
|
|
67553
67633
|
// packages/omo-codex/src/install/codex-config-atomic-write.ts
|
|
67554
67634
|
import { lstat as lstat5, readlink as readlink3, realpath, rename as rename2, unlink, writeFile as writeFile5 } from "node:fs/promises";
|
|
67555
|
-
import { basename as basename7, dirname as dirname12, isAbsolute as isAbsolute6, join as
|
|
67635
|
+
import { basename as basename7, dirname as dirname12, isAbsolute as isAbsolute6, join as join35, resolve as resolve11 } from "node:path";
|
|
67556
67636
|
var RENAME_RETRY_DELAYS_MS = [10, 25, 50];
|
|
67557
67637
|
var RETRIABLE_RENAME_CODES = new Set(["EPERM", "EBUSY"]);
|
|
67558
67638
|
async function writeFileAtomic(targetPath, data) {
|
|
67559
67639
|
const writeTarget = await resolveSymlinkTarget(targetPath);
|
|
67560
|
-
const temporaryPath =
|
|
67640
|
+
const temporaryPath = join35(dirname12(writeTarget), `.tmp-${basename7(writeTarget)}-${process.pid}-${Date.now()}`);
|
|
67561
67641
|
await writeFile5(temporaryPath, data);
|
|
67562
67642
|
try {
|
|
67563
67643
|
await renameWithRetry(temporaryPath, writeTarget);
|
|
@@ -67827,8 +67907,8 @@ function isRootSetting(line, key) {
|
|
|
67827
67907
|
}
|
|
67828
67908
|
|
|
67829
67909
|
// packages/omo-codex/src/install/codex-model-catalog.ts
|
|
67830
|
-
import { readFile as
|
|
67831
|
-
import { join as
|
|
67910
|
+
import { readFile as readFile9 } from "node:fs/promises";
|
|
67911
|
+
import { join as join36 } from "node:path";
|
|
67832
67912
|
var FALLBACK_CODEX_MODEL_CATALOG = {
|
|
67833
67913
|
current: {
|
|
67834
67914
|
model: "gpt-5.5",
|
|
@@ -67847,9 +67927,9 @@ var FALLBACK_CODEX_MODEL_CATALOG = {
|
|
|
67847
67927
|
]
|
|
67848
67928
|
};
|
|
67849
67929
|
async function readCodexModelCatalog(codexPackageRoot) {
|
|
67850
|
-
const catalogPath =
|
|
67930
|
+
const catalogPath = join36(codexPackageRoot, "plugin", "model-catalog.json");
|
|
67851
67931
|
try {
|
|
67852
|
-
const parsed = JSON.parse(await
|
|
67932
|
+
const parsed = JSON.parse(await readFile9(catalogPath, "utf8"));
|
|
67853
67933
|
return parseCodexModelCatalog(parsed) ?? FALLBACK_CODEX_MODEL_CATALOG;
|
|
67854
67934
|
} catch (error) {
|
|
67855
67935
|
if (error instanceof Error)
|
|
@@ -67930,7 +68010,7 @@ async function updateCodexConfig(input) {
|
|
|
67930
68010
|
await mkdir5(dirname13(input.configPath), { recursive: true });
|
|
67931
68011
|
let config = "";
|
|
67932
68012
|
if (await exists(input.configPath))
|
|
67933
|
-
config = await
|
|
68013
|
+
config = await readFile10(input.configPath, "utf8");
|
|
67934
68014
|
const pluginSet = new Set(input.pluginNames);
|
|
67935
68015
|
for (const legacyMarketplaceName of legacyMarketplaceNames(input.marketplaceName)) {
|
|
67936
68016
|
config = removeMarketplaceBlock(config, legacyMarketplaceName);
|
|
@@ -67966,7 +68046,7 @@ async function updateCodexConfig(input) {
|
|
|
67966
68046
|
}
|
|
67967
68047
|
async function exists(path7) {
|
|
67968
68048
|
try {
|
|
67969
|
-
await
|
|
68049
|
+
await readFile10(path7, "utf8");
|
|
67970
68050
|
return true;
|
|
67971
68051
|
} catch (error) {
|
|
67972
68052
|
if (error instanceof Error)
|
|
@@ -67977,8 +68057,8 @@ async function exists(path7) {
|
|
|
67977
68057
|
|
|
67978
68058
|
// packages/omo-codex/src/install/codex-hook-trust.ts
|
|
67979
68059
|
import { createHash as createHash2 } from "node:crypto";
|
|
67980
|
-
import { readFile as
|
|
67981
|
-
import { join as
|
|
68060
|
+
import { readFile as readFile11 } from "node:fs/promises";
|
|
68061
|
+
import { join as join37 } from "node:path";
|
|
67982
68062
|
var EVENT_LABELS = new Map([
|
|
67983
68063
|
["PreToolUse", "pre_tool_use"],
|
|
67984
68064
|
["PermissionRequest", "permission_request"],
|
|
@@ -67992,21 +68072,37 @@ var EVENT_LABELS = new Map([
|
|
|
67992
68072
|
["Stop", "stop"]
|
|
67993
68073
|
]);
|
|
67994
68074
|
async function trustedHookStatesForPlugin(input) {
|
|
67995
|
-
const manifestPath =
|
|
68075
|
+
const manifestPath = join37(input.pluginRoot, ".codex-plugin", "plugin.json");
|
|
67996
68076
|
if (!await exists2(manifestPath))
|
|
67997
68077
|
return [];
|
|
67998
|
-
const manifest = JSON.parse(await
|
|
67999
|
-
if (!isPlainRecord3(manifest)
|
|
68000
|
-
return [];
|
|
68001
|
-
const hooksPath = join36(input.pluginRoot, manifest.hooks);
|
|
68002
|
-
if (!await exists2(hooksPath))
|
|
68078
|
+
const manifest = JSON.parse(await readFile11(manifestPath, "utf8"));
|
|
68079
|
+
if (!isPlainRecord3(manifest))
|
|
68003
68080
|
return [];
|
|
68004
|
-
const
|
|
68005
|
-
|
|
68081
|
+
const states = [];
|
|
68082
|
+
for (const hookPath of hookManifestPaths2(manifest.hooks)) {
|
|
68083
|
+
const hooksPath = join37(input.pluginRoot, hookPath);
|
|
68084
|
+
if (!await exists2(hooksPath))
|
|
68085
|
+
continue;
|
|
68086
|
+
const parsed = JSON.parse(await readFile11(hooksPath, "utf8"));
|
|
68087
|
+
if (!isPlainRecord3(parsed) || !isPlainRecord3(parsed.hooks))
|
|
68088
|
+
continue;
|
|
68089
|
+
states.push(...trustedHookStatesForHooksFile({
|
|
68090
|
+
keySource: `${input.pluginName}@${input.marketplaceName}:${hookPath}`,
|
|
68091
|
+
hooks: parsed.hooks
|
|
68092
|
+
}));
|
|
68093
|
+
}
|
|
68094
|
+
return states;
|
|
68095
|
+
}
|
|
68096
|
+
function hookManifestPaths2(value) {
|
|
68097
|
+
if (typeof value === "string" && value.trim() !== "")
|
|
68098
|
+
return [stripDotSlash2(value)];
|
|
68099
|
+
if (!Array.isArray(value))
|
|
68006
68100
|
return [];
|
|
68007
|
-
|
|
68101
|
+
return value.filter((item) => typeof item === "string" && item.trim() !== "").map(stripDotSlash2);
|
|
68102
|
+
}
|
|
68103
|
+
function trustedHookStatesForHooksFile(input) {
|
|
68008
68104
|
const states = [];
|
|
68009
|
-
for (const [eventName, groups] of Object.entries(
|
|
68105
|
+
for (const [eventName, groups] of Object.entries(input.hooks)) {
|
|
68010
68106
|
if (!Array.isArray(groups))
|
|
68011
68107
|
continue;
|
|
68012
68108
|
const eventLabel = EVENT_LABELS.get(eventName);
|
|
@@ -68022,7 +68118,7 @@ async function trustedHookStatesForPlugin(input) {
|
|
|
68022
68118
|
continue;
|
|
68023
68119
|
if (typeof handler.command !== "string" || handler.command.trim() === "")
|
|
68024
68120
|
continue;
|
|
68025
|
-
const key = `${keySource}:${eventLabel}:${groupIndex}:${handlerIndex}`;
|
|
68121
|
+
const key = `${input.keySource}:${eventLabel}:${groupIndex}:${handlerIndex}`;
|
|
68026
68122
|
states.push({ key, trustedHash: commandHookHash(eventLabel, group.matcher, handler) });
|
|
68027
68123
|
}
|
|
68028
68124
|
}
|
|
@@ -68056,12 +68152,12 @@ function canonicalJson(value) {
|
|
|
68056
68152
|
}
|
|
68057
68153
|
return result;
|
|
68058
68154
|
}
|
|
68059
|
-
function
|
|
68155
|
+
function stripDotSlash2(value) {
|
|
68060
68156
|
return value.startsWith("./") ? value.slice(2) : value;
|
|
68061
68157
|
}
|
|
68062
68158
|
async function exists2(path7) {
|
|
68063
68159
|
try {
|
|
68064
|
-
await
|
|
68160
|
+
await readFile11(path7, "utf8");
|
|
68065
68161
|
return true;
|
|
68066
68162
|
} catch (error) {
|
|
68067
68163
|
if (error instanceof Error)
|
|
@@ -68113,12 +68209,12 @@ function toCodexResolution(resolution) {
|
|
|
68113
68209
|
}
|
|
68114
68210
|
|
|
68115
68211
|
// packages/omo-codex/src/install/link-cached-plugin-agents.ts
|
|
68116
|
-
import { copyFile, lstat as lstat7, mkdir as mkdir6, readFile as
|
|
68117
|
-
import { basename as basename8, join as
|
|
68212
|
+
import { copyFile, lstat as lstat7, mkdir as mkdir6, readFile as readFile13, readdir as readdir4, rm as rm6, writeFile as writeFile6 } from "node:fs/promises";
|
|
68213
|
+
import { basename as basename8, join as join39 } from "node:path";
|
|
68118
68214
|
|
|
68119
68215
|
// packages/omo-codex/src/install/retired-managed-agent-purge.ts
|
|
68120
|
-
import { lstat as lstat6, readFile as
|
|
68121
|
-
import { join as
|
|
68216
|
+
import { lstat as lstat6, readFile as readFile12, rm as rm5 } from "node:fs/promises";
|
|
68217
|
+
import { join as join38 } from "node:path";
|
|
68122
68218
|
var RETIRED_MANAGED_AGENT_FILES = [
|
|
68123
68219
|
{
|
|
68124
68220
|
fileName: "codex-ultrawork-reviewer.toml",
|
|
@@ -68130,11 +68226,11 @@ var RETIRED_MANAGED_AGENT_FILES = [
|
|
|
68130
68226
|
}
|
|
68131
68227
|
];
|
|
68132
68228
|
async function purgeRetiredManagedAgentFiles(input) {
|
|
68133
|
-
const agentsDir =
|
|
68229
|
+
const agentsDir = join38(input.codexHome, "agents");
|
|
68134
68230
|
if (!await exists3(agentsDir))
|
|
68135
68231
|
return;
|
|
68136
68232
|
for (const retiredAgent of RETIRED_MANAGED_AGENT_FILES) {
|
|
68137
|
-
const agentPath =
|
|
68233
|
+
const agentPath = join38(agentsDir, retiredAgent.fileName);
|
|
68138
68234
|
if (!await exists3(agentPath))
|
|
68139
68235
|
continue;
|
|
68140
68236
|
const agentStat = await lstat6(agentPath);
|
|
@@ -68151,7 +68247,7 @@ function hasRequiredMarkers(content, markers) {
|
|
|
68151
68247
|
}
|
|
68152
68248
|
async function readTextIfExists(path7) {
|
|
68153
68249
|
try {
|
|
68154
|
-
return await
|
|
68250
|
+
return await readFile12(path7, "utf8");
|
|
68155
68251
|
} catch (error) {
|
|
68156
68252
|
if (nodeErrorCode(error) === "ENOENT")
|
|
68157
68253
|
return null;
|
|
@@ -68177,7 +68273,7 @@ function nodeErrorCode(error) {
|
|
|
68177
68273
|
// packages/omo-codex/src/install/link-cached-plugin-agents.ts
|
|
68178
68274
|
var MANIFEST_FILE = ".installed-agents.json";
|
|
68179
68275
|
async function capturePreservedAgentReasoning(input) {
|
|
68180
|
-
const agentsDir =
|
|
68276
|
+
const agentsDir = join39(input.codexHome, "agents");
|
|
68181
68277
|
if (!await exists4(agentsDir))
|
|
68182
68278
|
return new Map;
|
|
68183
68279
|
const preserved = new Map;
|
|
@@ -68185,7 +68281,7 @@ async function capturePreservedAgentReasoning(input) {
|
|
|
68185
68281
|
for (const entry of agentEntries) {
|
|
68186
68282
|
if (!entry.name.endsWith(".toml"))
|
|
68187
68283
|
continue;
|
|
68188
|
-
const content = await readTextIfExists2(
|
|
68284
|
+
const content = await readTextIfExists2(join39(agentsDir, entry.name));
|
|
68189
68285
|
if (content === null)
|
|
68190
68286
|
continue;
|
|
68191
68287
|
const effort = extractReasoningEffort(content);
|
|
@@ -68195,7 +68291,7 @@ async function capturePreservedAgentReasoning(input) {
|
|
|
68195
68291
|
return preserved;
|
|
68196
68292
|
}
|
|
68197
68293
|
async function capturePreservedAgentServiceTier(input) {
|
|
68198
|
-
const agentsDir =
|
|
68294
|
+
const agentsDir = join39(input.codexHome, "agents");
|
|
68199
68295
|
if (!await exists4(agentsDir))
|
|
68200
68296
|
return new Map;
|
|
68201
68297
|
const preserved = new Map;
|
|
@@ -68203,7 +68299,7 @@ async function capturePreservedAgentServiceTier(input) {
|
|
|
68203
68299
|
for (const entry of agentEntries) {
|
|
68204
68300
|
if (!entry.name.endsWith(".toml"))
|
|
68205
68301
|
continue;
|
|
68206
|
-
const content = await readTextIfExists2(
|
|
68302
|
+
const content = await readTextIfExists2(join39(agentsDir, entry.name));
|
|
68207
68303
|
if (content === null)
|
|
68208
68304
|
continue;
|
|
68209
68305
|
preserved.set(agentNameFromToml(entry.name), extractServiceTier(content));
|
|
@@ -68217,13 +68313,13 @@ async function linkCachedPluginAgents(input) {
|
|
|
68217
68313
|
await writeManifest(input.pluginRoot, []);
|
|
68218
68314
|
return [];
|
|
68219
68315
|
}
|
|
68220
|
-
const agentsDir =
|
|
68316
|
+
const agentsDir = join39(input.codexHome, "agents");
|
|
68221
68317
|
await mkdir6(agentsDir, { recursive: true });
|
|
68222
68318
|
const linked = [];
|
|
68223
68319
|
for (const agentPath of bundledAgents) {
|
|
68224
68320
|
const agentFileName = basename8(agentPath);
|
|
68225
68321
|
const agentName = agentNameFromToml(agentFileName);
|
|
68226
|
-
const linkPath =
|
|
68322
|
+
const linkPath = join39(agentsDir, agentFileName);
|
|
68227
68323
|
await replaceWithCopy(linkPath, agentPath);
|
|
68228
68324
|
await restorePreservedReasoning({
|
|
68229
68325
|
agentName,
|
|
@@ -68244,7 +68340,7 @@ async function linkCachedPluginAgents(input) {
|
|
|
68244
68340
|
async function restorePreservedServiceTier(input) {
|
|
68245
68341
|
if (!input.preserved)
|
|
68246
68342
|
return;
|
|
68247
|
-
const content = await
|
|
68343
|
+
const content = await readFile13(input.linkPath, "utf8");
|
|
68248
68344
|
if (extractServiceTier(content) === input.value)
|
|
68249
68345
|
return;
|
|
68250
68346
|
const replacement = replaceServiceTier(content, input.value);
|
|
@@ -68253,7 +68349,7 @@ async function restorePreservedServiceTier(input) {
|
|
|
68253
68349
|
await writeFile6(input.linkPath, replacement.content);
|
|
68254
68350
|
}
|
|
68255
68351
|
async function discoverBundledAgents(pluginRoot) {
|
|
68256
|
-
const componentsRoot =
|
|
68352
|
+
const componentsRoot = join39(pluginRoot, "components");
|
|
68257
68353
|
if (!await exists4(componentsRoot))
|
|
68258
68354
|
return [];
|
|
68259
68355
|
const componentEntries = await readdir4(componentsRoot, { withFileTypes: true });
|
|
@@ -68261,14 +68357,14 @@ async function discoverBundledAgents(pluginRoot) {
|
|
|
68261
68357
|
for (const entry of componentEntries) {
|
|
68262
68358
|
if (!entry.isDirectory())
|
|
68263
68359
|
continue;
|
|
68264
|
-
const agentsRoot =
|
|
68360
|
+
const agentsRoot = join39(componentsRoot, entry.name, "agents");
|
|
68265
68361
|
if (!await exists4(agentsRoot))
|
|
68266
68362
|
continue;
|
|
68267
68363
|
const agentEntries = await readdir4(agentsRoot, { withFileTypes: true });
|
|
68268
68364
|
for (const file2 of agentEntries) {
|
|
68269
68365
|
if (!file2.isFile() || !file2.name.endsWith(".toml"))
|
|
68270
68366
|
continue;
|
|
68271
|
-
agents.push(
|
|
68367
|
+
agents.push(join39(agentsRoot, file2.name));
|
|
68272
68368
|
}
|
|
68273
68369
|
}
|
|
68274
68370
|
agents.sort();
|
|
@@ -68288,7 +68384,7 @@ async function prepareReplacement(linkPath) {
|
|
|
68288
68384
|
await rm6(linkPath, { force: true });
|
|
68289
68385
|
}
|
|
68290
68386
|
async function writeManifest(pluginRoot, agentPaths) {
|
|
68291
|
-
const manifestPath =
|
|
68387
|
+
const manifestPath = join39(pluginRoot, MANIFEST_FILE);
|
|
68292
68388
|
const payload = { agents: [...agentPaths].sort() };
|
|
68293
68389
|
await writeFile6(manifestPath, `${JSON.stringify(payload, null, "\t")}
|
|
68294
68390
|
`);
|
|
@@ -68296,7 +68392,7 @@ async function writeManifest(pluginRoot, agentPaths) {
|
|
|
68296
68392
|
async function restorePreservedReasoning(input) {
|
|
68297
68393
|
if (input.value === undefined)
|
|
68298
68394
|
return;
|
|
68299
|
-
const content = await
|
|
68395
|
+
const content = await readFile13(input.target, "utf8");
|
|
68300
68396
|
const bundledEffort = extractReasoningEffort(content);
|
|
68301
68397
|
if (bundledEffort === input.value)
|
|
68302
68398
|
return;
|
|
@@ -68307,7 +68403,7 @@ async function restorePreservedReasoning(input) {
|
|
|
68307
68403
|
}
|
|
68308
68404
|
async function readTextIfExists2(path7) {
|
|
68309
68405
|
try {
|
|
68310
|
-
return await
|
|
68406
|
+
return await readFile13(path7, "utf8");
|
|
68311
68407
|
} catch (error) {
|
|
68312
68408
|
if (nodeErrorCode2(error) === "ENOENT")
|
|
68313
68409
|
return null;
|
|
@@ -68415,12 +68511,12 @@ function nodeErrorCode2(error) {
|
|
|
68415
68511
|
}
|
|
68416
68512
|
|
|
68417
68513
|
// packages/omo-codex/src/install/codex-marketplace.ts
|
|
68418
|
-
import { readFile as
|
|
68419
|
-
import { join as
|
|
68514
|
+
import { readFile as readFile14 } from "node:fs/promises";
|
|
68515
|
+
import { join as join40 } from "node:path";
|
|
68420
68516
|
var DEFAULT_MARKETPLACE_PATH = "packages/omo-codex/marketplace.json";
|
|
68421
68517
|
async function readMarketplace(repoRoot, options) {
|
|
68422
|
-
const marketplacePath = options?.marketplacePath ??
|
|
68423
|
-
const raw = await
|
|
68518
|
+
const marketplacePath = options?.marketplacePath ?? join40(repoRoot, DEFAULT_MARKETPLACE_PATH);
|
|
68519
|
+
const raw = await readFile14(marketplacePath, "utf8");
|
|
68424
68520
|
const parsed = JSON.parse(raw);
|
|
68425
68521
|
if (!isPlainRecord3(parsed))
|
|
68426
68522
|
throw new Error("marketplace.json must be an object");
|
|
@@ -68438,10 +68534,10 @@ async function readMarketplace(repoRoot, options) {
|
|
|
68438
68534
|
function resolvePluginSource(repoRoot, plugin, options) {
|
|
68439
68535
|
const sourcePath = localSourcePath(options?.pathOverride ?? plugin.source);
|
|
68440
68536
|
const relativePath = sourcePath.slice(2);
|
|
68441
|
-
return
|
|
68537
|
+
return join40(repoRoot, ...relativePath.split(/[\\/]/));
|
|
68442
68538
|
}
|
|
68443
68539
|
async function readPluginManifest(pluginRoot) {
|
|
68444
|
-
const raw = await
|
|
68540
|
+
const raw = await readFile14(join40(pluginRoot, ".codex-plugin", "plugin.json"), "utf8");
|
|
68445
68541
|
const parsed = JSON.parse(raw);
|
|
68446
68542
|
if (!isPlainRecord3(parsed))
|
|
68447
68543
|
throw new Error(`${pluginRoot} plugin.json must be an object`);
|
|
@@ -68451,15 +68547,27 @@ async function readPluginManifest(pluginRoot) {
|
|
|
68451
68547
|
if (parsed.version !== undefined && (typeof parsed.version !== "string" || parsed.version.trim() === "")) {
|
|
68452
68548
|
throw new Error(`${pluginRoot} plugin.json version must be a non-empty string`);
|
|
68453
68549
|
}
|
|
68454
|
-
if (parsed.hooks !== undefined && (
|
|
68455
|
-
throw new Error(`${pluginRoot} plugin.json hooks must be a non-empty string`);
|
|
68550
|
+
if (parsed.hooks !== undefined && !isPluginHooksManifestValue(parsed.hooks)) {
|
|
68551
|
+
throw new Error(`${pluginRoot} plugin.json hooks must be a non-empty string or string array`);
|
|
68456
68552
|
}
|
|
68457
68553
|
return {
|
|
68458
68554
|
name: parsed.name,
|
|
68459
68555
|
version: typeof parsed.version === "string" ? parsed.version.trim() : undefined,
|
|
68460
|
-
hooks:
|
|
68556
|
+
hooks: normalizePluginHooksManifestValue(parsed.hooks)
|
|
68461
68557
|
};
|
|
68462
68558
|
}
|
|
68559
|
+
function isPluginHooksManifestValue(value) {
|
|
68560
|
+
if (typeof value === "string")
|
|
68561
|
+
return value.trim() !== "";
|
|
68562
|
+
return Array.isArray(value) && value.every((item) => typeof item === "string" && item.trim() !== "");
|
|
68563
|
+
}
|
|
68564
|
+
function normalizePluginHooksManifestValue(value) {
|
|
68565
|
+
if (typeof value === "string")
|
|
68566
|
+
return value.trim();
|
|
68567
|
+
if (Array.isArray(value))
|
|
68568
|
+
return value.map((item) => item.trim());
|
|
68569
|
+
return;
|
|
68570
|
+
}
|
|
68463
68571
|
function validatePathSegment(value, label) {
|
|
68464
68572
|
if (!/^[A-Za-z0-9._+-]+$/.test(value)) {
|
|
68465
68573
|
throw new Error(`${label} contains unsupported characters: ${value}`);
|
|
@@ -68511,7 +68619,7 @@ function validateLocalSourcePath(path7) {
|
|
|
68511
68619
|
|
|
68512
68620
|
// packages/omo-codex/src/install/codex-marketplace-snapshot.ts
|
|
68513
68621
|
import { cp as cp3, mkdir as mkdir7, rename as rename3, rm as rm7, writeFile as writeFile7 } from "node:fs/promises";
|
|
68514
|
-
import { join as
|
|
68622
|
+
import { join as join41, sep as sep6 } from "node:path";
|
|
68515
68623
|
var INSTALLED_MARKETPLACES_DIR = ".tmp/marketplaces";
|
|
68516
68624
|
async function writeInstalledMarketplaceSnapshot(input) {
|
|
68517
68625
|
const marketplaceRoot = installedMarketplaceRoot(input.codexHome, input.marketplace.name);
|
|
@@ -68524,21 +68632,21 @@ async function writeInstalledMarketplaceSnapshot(input) {
|
|
|
68524
68632
|
return snapshotPlugins;
|
|
68525
68633
|
}
|
|
68526
68634
|
function installedMarketplaceRoot(codexHome, marketplaceName) {
|
|
68527
|
-
return
|
|
68635
|
+
return join41(codexHome, INSTALLED_MARKETPLACES_DIR, marketplaceName);
|
|
68528
68636
|
}
|
|
68529
68637
|
async function writeMarketplaceManifest(marketplaceRoot, marketplace) {
|
|
68530
|
-
const manifestDir =
|
|
68638
|
+
const manifestDir = join41(marketplaceRoot, ".agents", "plugins");
|
|
68531
68639
|
await mkdir7(manifestDir, { recursive: true });
|
|
68532
|
-
const tempPath =
|
|
68640
|
+
const tempPath = join41(manifestDir, `.marketplace-${process.pid}-${Date.now()}.json.tmp`);
|
|
68533
68641
|
await writeFile7(tempPath, `${JSON.stringify(marketplace, null, "\t")}
|
|
68534
68642
|
`);
|
|
68535
|
-
await rename3(tempPath,
|
|
68643
|
+
await rename3(tempPath, join41(manifestDir, "marketplace.json"));
|
|
68536
68644
|
}
|
|
68537
68645
|
async function writeSnapshotPlugin(marketplaceRoot, plugin) {
|
|
68538
|
-
const pluginsDir =
|
|
68646
|
+
const pluginsDir = join41(marketplaceRoot, "plugins");
|
|
68539
68647
|
await mkdir7(pluginsDir, { recursive: true });
|
|
68540
|
-
const targetPath =
|
|
68541
|
-
const tempPath =
|
|
68648
|
+
const targetPath = join41(pluginsDir, plugin.name);
|
|
68649
|
+
const tempPath = join41(pluginsDir, `.tmp-${plugin.name}-${process.pid}-${Date.now()}`);
|
|
68542
68650
|
await rm7(tempPath, { recursive: true, force: true });
|
|
68543
68651
|
await cp3(plugin.sourcePath, tempPath, {
|
|
68544
68652
|
recursive: true,
|
|
@@ -68551,19 +68659,19 @@ async function writeSnapshotPlugin(marketplaceRoot, plugin) {
|
|
|
68551
68659
|
return { name: plugin.name, path: targetPath };
|
|
68552
68660
|
}
|
|
68553
68661
|
function shouldCopyMarketplaceSourcePath(path7, root) {
|
|
68554
|
-
const relative5 = path7 === root ? "" : path7.slice(root.length +
|
|
68662
|
+
const relative5 = path7 === root ? "" : path7.slice(root.length + sep6.length);
|
|
68555
68663
|
if (relative5 === "")
|
|
68556
68664
|
return true;
|
|
68557
|
-
const parts = relative5.split(
|
|
68665
|
+
const parts = relative5.split(sep6);
|
|
68558
68666
|
return !parts.some((part) => part === ".git" || part === "node_modules");
|
|
68559
68667
|
}
|
|
68560
68668
|
|
|
68561
68669
|
// packages/omo-codex/src/install/lazycodex-version-stamp.ts
|
|
68562
|
-
import { readdir as readdir5, readFile as
|
|
68563
|
-
import { join as
|
|
68670
|
+
import { readdir as readdir5, readFile as readFile15, writeFile as writeFile8 } from "node:fs/promises";
|
|
68671
|
+
import { join as join42 } from "node:path";
|
|
68564
68672
|
async function readDistributionManifest(repoRoot) {
|
|
68565
68673
|
try {
|
|
68566
|
-
const parsed = JSON.parse(await
|
|
68674
|
+
const parsed = JSON.parse(await readFile15(join42(repoRoot, "package.json"), "utf8"));
|
|
68567
68675
|
if (!isPlainRecord3(parsed) || typeof parsed.version !== "string" || parsed.version.trim().length === 0)
|
|
68568
68676
|
return;
|
|
68569
68677
|
return {
|
|
@@ -68583,15 +68691,19 @@ function resolveLazyCodexPluginVersion(input) {
|
|
|
68583
68691
|
return input.manifestVersion ?? "local";
|
|
68584
68692
|
}
|
|
68585
68693
|
async function stampLazyCodexPluginVersion(input) {
|
|
68586
|
-
|
|
68587
|
-
await
|
|
68588
|
-
await
|
|
68694
|
+
const manifestPath = join42(input.pluginRoot, ".codex-plugin", "plugin.json");
|
|
68695
|
+
const hookPaths = await readPluginHookPaths(manifestPath);
|
|
68696
|
+
await stampJsonVersion(manifestPath, input.version);
|
|
68697
|
+
await stampJsonVersion(join42(input.pluginRoot, "package.json"), input.version);
|
|
68698
|
+
for (const hookPath of hookPaths) {
|
|
68699
|
+
await stampHookStatusMessages(join42(input.pluginRoot, hookPath), input.version);
|
|
68700
|
+
}
|
|
68589
68701
|
await stampComponentVersions(input);
|
|
68590
68702
|
}
|
|
68591
68703
|
async function writeLazyCodexInstallSnapshot(input) {
|
|
68592
68704
|
if (input.distributionManifest === undefined)
|
|
68593
68705
|
return;
|
|
68594
|
-
await writeFile8(
|
|
68706
|
+
await writeFile8(join42(input.pluginRoot, "lazycodex-install.json"), `${JSON.stringify({
|
|
68595
68707
|
packageName: input.distributionManifest.name,
|
|
68596
68708
|
version: input.distributionManifest.version
|
|
68597
68709
|
}, null, "\t")}
|
|
@@ -68599,7 +68711,7 @@ async function writeLazyCodexInstallSnapshot(input) {
|
|
|
68599
68711
|
}
|
|
68600
68712
|
async function stampJsonVersion(path7, version) {
|
|
68601
68713
|
try {
|
|
68602
|
-
const parsed = JSON.parse(await
|
|
68714
|
+
const parsed = JSON.parse(await readFile15(path7, "utf8"));
|
|
68603
68715
|
if (!isPlainRecord3(parsed))
|
|
68604
68716
|
return;
|
|
68605
68717
|
parsed.version = version;
|
|
@@ -68611,9 +68723,29 @@ async function stampJsonVersion(path7, version) {
|
|
|
68611
68723
|
throw error;
|
|
68612
68724
|
}
|
|
68613
68725
|
}
|
|
68726
|
+
async function readPluginHookPaths(manifestPath) {
|
|
68727
|
+
try {
|
|
68728
|
+
const parsed = JSON.parse(await readFile15(manifestPath, "utf8"));
|
|
68729
|
+
if (!isPlainRecord3(parsed))
|
|
68730
|
+
return [];
|
|
68731
|
+
if (typeof parsed.hooks === "string" && parsed.hooks.trim().length > 0)
|
|
68732
|
+
return [stripDotSlash3(parsed.hooks)];
|
|
68733
|
+
if (Array.isArray(parsed.hooks)) {
|
|
68734
|
+
return parsed.hooks.filter((hookPath) => typeof hookPath === "string" && hookPath.trim().length > 0).map(stripDotSlash3);
|
|
68735
|
+
}
|
|
68736
|
+
return [];
|
|
68737
|
+
} catch (error) {
|
|
68738
|
+
if (error instanceof Error)
|
|
68739
|
+
return [];
|
|
68740
|
+
throw error;
|
|
68741
|
+
}
|
|
68742
|
+
}
|
|
68743
|
+
function stripDotSlash3(path7) {
|
|
68744
|
+
return path7.startsWith("./") ? path7.slice(2) : path7;
|
|
68745
|
+
}
|
|
68614
68746
|
async function stampHookStatusMessages(path7, version) {
|
|
68615
68747
|
try {
|
|
68616
|
-
const parsed = JSON.parse(await
|
|
68748
|
+
const parsed = JSON.parse(await readFile15(path7, "utf8"));
|
|
68617
68749
|
if (!isPlainRecord3(parsed))
|
|
68618
68750
|
return;
|
|
68619
68751
|
stampHookGroups(parsed.hooks, version);
|
|
@@ -68628,16 +68760,16 @@ async function stampHookStatusMessages(path7, version) {
|
|
|
68628
68760
|
async function stampComponentVersions(input) {
|
|
68629
68761
|
let entries;
|
|
68630
68762
|
try {
|
|
68631
|
-
entries = await readdir5(
|
|
68763
|
+
entries = await readdir5(join42(input.pluginRoot, "components"));
|
|
68632
68764
|
} catch (error) {
|
|
68633
68765
|
if (error instanceof Error)
|
|
68634
68766
|
return;
|
|
68635
68767
|
throw error;
|
|
68636
68768
|
}
|
|
68637
68769
|
for (const entry of entries) {
|
|
68638
|
-
const componentRoot =
|
|
68639
|
-
await stampJsonVersion(
|
|
68640
|
-
await stampHookStatusMessages(
|
|
68770
|
+
const componentRoot = join42(input.pluginRoot, "components", entry);
|
|
68771
|
+
await stampJsonVersion(join42(componentRoot, "package.json"), input.version);
|
|
68772
|
+
await stampHookStatusMessages(join42(componentRoot, "hooks", "hooks.json"), input.version);
|
|
68641
68773
|
}
|
|
68642
68774
|
}
|
|
68643
68775
|
function stampHookGroups(hooks, version) {
|
|
@@ -68658,7 +68790,7 @@ function stampHookGroups(hooks, version) {
|
|
|
68658
68790
|
function stampHookStatusMessage(hook, version) {
|
|
68659
68791
|
if (!isPlainRecord3(hook) || typeof hook.statusMessage !== "string")
|
|
68660
68792
|
return;
|
|
68661
|
-
hook.statusMessage = hook.statusMessage.replace(/^LazyCodex\([^)]+\)
|
|
68793
|
+
hook.statusMessage = hook.statusMessage.replace(/^LazyCodex\([^)]+\):\s*/, "(OmO) ");
|
|
68662
68794
|
}
|
|
68663
68795
|
|
|
68664
68796
|
// packages/omo-codex/src/install/codex-process.ts
|
|
@@ -68690,8 +68822,8 @@ var defaultRunCommand = async (command, args, options) => {
|
|
|
68690
68822
|
};
|
|
68691
68823
|
|
|
68692
68824
|
// packages/omo-codex/src/install/codex-project-local-cleanup.ts
|
|
68693
|
-
import { copyFile as copyFile2, lstat as lstat8, readFile as
|
|
68694
|
-
import { dirname as dirname14, join as
|
|
68825
|
+
import { copyFile as copyFile2, lstat as lstat8, readFile as readFile16, writeFile as writeFile9 } from "node:fs/promises";
|
|
68826
|
+
import { dirname as dirname14, join as join43, resolve as resolve12 } from "node:path";
|
|
68695
68827
|
var LEGACY_AGENT_CONFLICT_KEYS = ["max_threads"];
|
|
68696
68828
|
var PROJECT_LOCAL_ARTIFACT_PATHS = [
|
|
68697
68829
|
".codex/hooks.json",
|
|
@@ -68710,7 +68842,7 @@ async function repairNearestProjectLocalCodexArtifacts(input) {
|
|
|
68710
68842
|
const artifacts = await collectProjectLocalArtifacts(project.artifactRoots);
|
|
68711
68843
|
const configs = [];
|
|
68712
68844
|
for (const configPath of project.configPaths) {
|
|
68713
|
-
const original = await
|
|
68845
|
+
const original = await readFile16(configPath, "utf8");
|
|
68714
68846
|
const repair = repairProjectLocalCodexConfigText(original);
|
|
68715
68847
|
if (!repair.changed) {
|
|
68716
68848
|
configs.push({
|
|
@@ -68794,17 +68926,17 @@ async function findProjectLocalCodexConfigs(startDirectory, codexHome) {
|
|
|
68794
68926
|
if (startDirectoryStat !== null && !startDirectoryStat.isDirectory()) {
|
|
68795
68927
|
throw new ProjectLocalCleanupStartDirectoryError(startDirectory);
|
|
68796
68928
|
}
|
|
68797
|
-
const codexHomeConfigPath = codexHome === undefined ? null :
|
|
68929
|
+
const codexHomeConfigPath = codexHome === undefined ? null : join43(resolve12(codexHome), "config.toml");
|
|
68798
68930
|
let current = resolve12(startDirectory);
|
|
68799
68931
|
const configPathsFromCwd = [];
|
|
68800
68932
|
while (true) {
|
|
68801
|
-
const configPath =
|
|
68933
|
+
const configPath = join43(current, ".codex", "config.toml");
|
|
68802
68934
|
if (await isRegularProjectLocalConfig(current, configPath)) {
|
|
68803
68935
|
if (codexHomeConfigPath === null || resolve12(configPath) !== codexHomeConfigPath) {
|
|
68804
68936
|
configPathsFromCwd.push(configPath);
|
|
68805
68937
|
}
|
|
68806
68938
|
}
|
|
68807
|
-
if (await exists5(
|
|
68939
|
+
if (await exists5(join43(current, ".git"))) {
|
|
68808
68940
|
return configPathsFromCwd.length === 0 ? null : {
|
|
68809
68941
|
projectRoot: current,
|
|
68810
68942
|
configPaths: [...configPathsFromCwd].reverse(),
|
|
@@ -68824,7 +68956,7 @@ async function findProjectLocalCodexConfigs(startDirectory, codexHome) {
|
|
|
68824
68956
|
}
|
|
68825
68957
|
}
|
|
68826
68958
|
async function isRegularProjectLocalConfig(directory, configPath) {
|
|
68827
|
-
const codexDirStat = await maybeLstat(
|
|
68959
|
+
const codexDirStat = await maybeLstat(join43(directory, ".codex"));
|
|
68828
68960
|
if (codexDirStat === null || !codexDirStat.isDirectory() || codexDirStat.isSymbolicLink())
|
|
68829
68961
|
return false;
|
|
68830
68962
|
const configStat = await maybeLstat(configPath);
|
|
@@ -68844,7 +68976,7 @@ async function collectProjectLocalArtifacts(projectRoots) {
|
|
|
68844
68976
|
const seenPaths = new Set;
|
|
68845
68977
|
for (const projectRoot of projectRoots) {
|
|
68846
68978
|
for (const relativePath of PROJECT_LOCAL_ARTIFACT_PATHS) {
|
|
68847
|
-
const artifactPath =
|
|
68979
|
+
const artifactPath = join43(projectRoot, relativePath);
|
|
68848
68980
|
if (seenPaths.has(artifactPath))
|
|
68849
68981
|
continue;
|
|
68850
68982
|
const entryStat = await maybeLstat(artifactPath);
|
|
@@ -68919,13 +69051,13 @@ function formatUnknownError(error) {
|
|
|
68919
69051
|
}
|
|
68920
69052
|
|
|
68921
69053
|
// packages/omo-codex/src/install/lsp-daemon-reaper.ts
|
|
68922
|
-
import { readFile as
|
|
69054
|
+
import { readFile as readFile17, readdir as readdir6, rm as rm8 } from "node:fs/promises";
|
|
68923
69055
|
import { connect } from "node:net";
|
|
68924
|
-
import { join as
|
|
69056
|
+
import { join as join44 } from "node:path";
|
|
68925
69057
|
async function reapLspDaemons(codexHome, deps = {}) {
|
|
68926
69058
|
const killProcess = deps.killProcess ?? sendSigterm;
|
|
68927
69059
|
const isDaemonLive = deps.isDaemonLive ?? probeSocketLive;
|
|
68928
|
-
const daemonRoot =
|
|
69060
|
+
const daemonRoot = join44(codexHome, "codex-lsp", "daemon");
|
|
68929
69061
|
const reaped = [];
|
|
68930
69062
|
let entries;
|
|
68931
69063
|
try {
|
|
@@ -68934,9 +69066,9 @@ async function reapLspDaemons(codexHome, deps = {}) {
|
|
|
68934
69066
|
return reaped;
|
|
68935
69067
|
}
|
|
68936
69068
|
for (const entry of entries) {
|
|
68937
|
-
const versionDir =
|
|
68938
|
-
const pid = await readPidFile(
|
|
68939
|
-
const socketPath = await readEndpointFile(
|
|
69069
|
+
const versionDir = join44(daemonRoot, entry);
|
|
69070
|
+
const pid = await readPidFile(join44(versionDir, "daemon.pid"));
|
|
69071
|
+
const socketPath = await readEndpointFile(join44(versionDir, "daemon.endpoint"));
|
|
68940
69072
|
if (pid !== null && socketPath !== null && await isDaemonLive(socketPath) && killProcess(pid)) {
|
|
68941
69073
|
reaped.push(pid);
|
|
68942
69074
|
}
|
|
@@ -68946,7 +69078,7 @@ async function reapLspDaemons(codexHome, deps = {}) {
|
|
|
68946
69078
|
}
|
|
68947
69079
|
async function readEndpointFile(path7) {
|
|
68948
69080
|
try {
|
|
68949
|
-
const content = (await
|
|
69081
|
+
const content = (await readFile17(path7, "utf8")).trim();
|
|
68950
69082
|
return content.length > 0 ? content : null;
|
|
68951
69083
|
} catch {
|
|
68952
69084
|
return null;
|
|
@@ -68954,7 +69086,7 @@ async function readEndpointFile(path7) {
|
|
|
68954
69086
|
}
|
|
68955
69087
|
async function readPidFile(path7) {
|
|
68956
69088
|
try {
|
|
68957
|
-
const pid = Number.parseInt((await
|
|
69089
|
+
const pid = Number.parseInt((await readFile17(path7, "utf8")).trim(), 10);
|
|
68958
69090
|
return Number.isInteger(pid) && pid > 0 ? pid : null;
|
|
68959
69091
|
} catch {
|
|
68960
69092
|
return null;
|
|
@@ -68990,7 +69122,7 @@ function sendSigterm(pid) {
|
|
|
68990
69122
|
|
|
68991
69123
|
// packages/omo-codex/src/install/codex-installer-bin-dir.ts
|
|
68992
69124
|
import { homedir as homedir5 } from "node:os";
|
|
68993
|
-
import { join as
|
|
69125
|
+
import { join as join45, resolve as resolve13 } from "node:path";
|
|
68994
69126
|
function resolveCodexInstallerBinDir(input) {
|
|
68995
69127
|
const explicitBinDir = input.binDir ?? input.env?.CODEX_LOCAL_BIN_DIR;
|
|
68996
69128
|
if (explicitBinDir !== undefined && explicitBinDir.trim().length > 0)
|
|
@@ -68999,15 +69131,15 @@ function resolveCodexInstallerBinDir(input) {
|
|
|
68999
69131
|
const defaultCodexHome = resolve13(homeDir, ".codex");
|
|
69000
69132
|
const resolvedCodexHome = resolve13(input.codexHome);
|
|
69001
69133
|
if (resolvedCodexHome !== defaultCodexHome)
|
|
69002
|
-
return
|
|
69134
|
+
return join45(resolvedCodexHome, "bin");
|
|
69003
69135
|
return resolve13(homeDir, ".local", "bin");
|
|
69004
69136
|
}
|
|
69005
69137
|
|
|
69006
69138
|
// packages/omo-codex/src/install/omo-sot-migration.ts
|
|
69007
|
-
import { join as
|
|
69139
|
+
import { join as join46 } from "node:path";
|
|
69008
69140
|
async function seedAndMigrateOmoSot(input) {
|
|
69009
69141
|
const commandEnv = { ...input.env };
|
|
69010
|
-
const scriptPath =
|
|
69142
|
+
const scriptPath = join46(input.repoRoot, "packages", "omo-codex", "plugin", "scripts", "migrate-omo-sot.mjs");
|
|
69011
69143
|
try {
|
|
69012
69144
|
await input.runCommand(process.execPath, [scriptPath, "--seed"], {
|
|
69013
69145
|
cwd: input.repoRoot,
|
|
@@ -69022,7 +69154,7 @@ async function seedAndMigrateOmoSot(input) {
|
|
|
69022
69154
|
|
|
69023
69155
|
// packages/omo-codex/src/install/install-ast-grep-sg.ts
|
|
69024
69156
|
init_src();
|
|
69025
|
-
import { join as
|
|
69157
|
+
import { join as join47 } from "node:path";
|
|
69026
69158
|
function describeResult(result) {
|
|
69027
69159
|
if (result.kind === "succeeded")
|
|
69028
69160
|
return null;
|
|
@@ -69036,7 +69168,7 @@ async function installAstGrepForCodex(options) {
|
|
|
69036
69168
|
return;
|
|
69037
69169
|
const platform = options.platform ?? process.platform;
|
|
69038
69170
|
const targetDir = astGrepRuntimeDir(options.codexHome, platform, options.arch ?? process.arch);
|
|
69039
|
-
const skillDir =
|
|
69171
|
+
const skillDir = join47(plugin.path, "skills", "ast-grep");
|
|
69040
69172
|
const installer = options.installer ?? runAstGrepSkillInstall;
|
|
69041
69173
|
try {
|
|
69042
69174
|
const result = await installer({ platform, skillDir, targetDir });
|
|
@@ -69069,7 +69201,7 @@ async function runCodexInstaller(options = {}) {
|
|
|
69069
69201
|
const env3 = options.env ?? process.env;
|
|
69070
69202
|
const platform = options.platform ?? process.platform;
|
|
69071
69203
|
const repoRoot = resolve14(options.repoRoot ?? findRepoRoot({ importerDir: import.meta.dir, env: env3 }));
|
|
69072
|
-
const codexHome = resolve14(options.codexHome ?? env3.CODEX_HOME ??
|
|
69204
|
+
const codexHome = resolve14(options.codexHome ?? env3.CODEX_HOME ?? join50(homedir6(), ".codex"));
|
|
69073
69205
|
const projectDirectory = resolve14(options.projectDirectory ?? env3.OMO_CODEX_PROJECT ?? process.cwd());
|
|
69074
69206
|
const binDir = resolveCodexInstallerBinDir({ binDir: options.binDir, codexHome, env: env3 });
|
|
69075
69207
|
const runCommand = options.runCommand ?? defaultRunCommand;
|
|
@@ -69087,9 +69219,9 @@ async function runCodexInstaller(options = {}) {
|
|
|
69087
69219
|
if (!gitBashResolution.found) {
|
|
69088
69220
|
throw new Error(gitBashResolution.installHint);
|
|
69089
69221
|
}
|
|
69090
|
-
const codexPackageRoot =
|
|
69222
|
+
const codexPackageRoot = join50(repoRoot, "packages", "omo-codex");
|
|
69091
69223
|
const marketplace = await readMarketplace(repoRoot, {
|
|
69092
|
-
marketplacePath:
|
|
69224
|
+
marketplacePath: join50(codexPackageRoot, "marketplace.json")
|
|
69093
69225
|
});
|
|
69094
69226
|
const distributionManifest = await readDistributionManifest(repoRoot);
|
|
69095
69227
|
const installed = [];
|
|
@@ -69131,7 +69263,7 @@ async function runCodexInstaller(options = {}) {
|
|
|
69131
69263
|
if (runtimeLink !== null)
|
|
69132
69264
|
log4(`Linked ${runtimeLink.name} -> ${runtimeLink.target}`);
|
|
69133
69265
|
else
|
|
69134
|
-
log4(`Warning: skipped the omo runtime wrapper because ${
|
|
69266
|
+
log4(`Warning: skipped the omo runtime wrapper because ${join50(repoRoot, "dist", "cli", "index.js")} is missing; omo sparkshell/ulw-loop commands will be unavailable until a package shipping dist/cli is installed`);
|
|
69135
69267
|
}
|
|
69136
69268
|
pluginSources.push({ name: entry.name, sourcePath });
|
|
69137
69269
|
installed.push(plugin);
|
|
@@ -69184,13 +69316,13 @@ async function runCodexInstaller(options = {}) {
|
|
|
69184
69316
|
});
|
|
69185
69317
|
}
|
|
69186
69318
|
await reapLspDaemons(codexHome).catch(() => []);
|
|
69187
|
-
const marketplaceRoot =
|
|
69319
|
+
const marketplaceRoot = join50(codexHome, "plugins", "cache", marketplace.name);
|
|
69188
69320
|
await writeCachedMarketplaceManifest({
|
|
69189
69321
|
marketplaceName: marketplace.name,
|
|
69190
69322
|
marketplaceRoot,
|
|
69191
69323
|
plugins: installed
|
|
69192
69324
|
});
|
|
69193
|
-
const configPath =
|
|
69325
|
+
const configPath = join50(codexHome, "config.toml");
|
|
69194
69326
|
await updateCodexConfig({
|
|
69195
69327
|
configPath,
|
|
69196
69328
|
repoRoot: codexPackageRoot,
|
|
@@ -69249,7 +69381,7 @@ function findRepoRootFromImporter(importerDir) {
|
|
|
69249
69381
|
for (let depth = 0;depth <= 7; depth += 1) {
|
|
69250
69382
|
if (isRepoRootWithCodexPlugin(current))
|
|
69251
69383
|
return current;
|
|
69252
|
-
for (const wrapperPackageRoot of [
|
|
69384
|
+
for (const wrapperPackageRoot of [join50(current, "node_modules", "oh-my-openagent"), join50(current, "oh-my-openagent")]) {
|
|
69253
69385
|
if (isRepoRootWithCodexPlugin(wrapperPackageRoot))
|
|
69254
69386
|
return wrapperPackageRoot;
|
|
69255
69387
|
}
|
|
@@ -69267,7 +69399,7 @@ function findRepoRoot(input) {
|
|
|
69267
69399
|
return findRepoRootFromImporter(input.importerDir);
|
|
69268
69400
|
}
|
|
69269
69401
|
function isRepoRootWithCodexPlugin(repoRoot) {
|
|
69270
|
-
return existsSync29(
|
|
69402
|
+
return existsSync29(join50(repoRoot, "packages", "omo-codex", "plugin", ".codex-plugin", "plugin.json"));
|
|
69271
69403
|
}
|
|
69272
69404
|
function codexMarketplaceSource(marketplaceRoot) {
|
|
69273
69405
|
return { sourceType: "local", source: marketplaceRoot };
|
|
@@ -69402,12 +69534,12 @@ function defaultRunCommand2(command, args) {
|
|
|
69402
69534
|
});
|
|
69403
69535
|
}
|
|
69404
69536
|
// packages/omo-codex/src/install/codex-cleanup.ts
|
|
69405
|
-
import { lstat as lstat10, readFile as
|
|
69537
|
+
import { lstat as lstat10, readFile as readFile19, readdir as readdir7, rm as rm9, rmdir } from "node:fs/promises";
|
|
69406
69538
|
import { homedir as homedir8 } from "node:os";
|
|
69407
|
-
import { isAbsolute as isAbsolute8, join as
|
|
69539
|
+
import { isAbsolute as isAbsolute8, join as join51, relative as relative6, resolve as resolve15 } from "node:path";
|
|
69408
69540
|
|
|
69409
69541
|
// packages/omo-codex/src/install/codex-cleanup-config.ts
|
|
69410
|
-
import { lstat as lstat9, mkdir as mkdir8, readFile as
|
|
69542
|
+
import { lstat as lstat9, mkdir as mkdir8, readFile as readFile18, writeFile as writeFile10 } from "node:fs/promises";
|
|
69411
69543
|
import { dirname as dirname16 } from "node:path";
|
|
69412
69544
|
var MANAGED_MARKETPLACES = ["sisyphuslabs", "lazycodex", "code-yeongyu-codex-plugins"];
|
|
69413
69545
|
var LEGACY_MANAGED_CODEX_AGENT_NAMES_TO_PURGE2 = ["codex-ultrawork-reviewer"];
|
|
@@ -69437,7 +69569,7 @@ function cleanupCodexLightConfigText(config) {
|
|
|
69437
69569
|
async function cleanupCodexConfig(configPath, now) {
|
|
69438
69570
|
if (!await configExists(configPath))
|
|
69439
69571
|
return { changed: false };
|
|
69440
|
-
const original = await
|
|
69572
|
+
const original = await readFile18(configPath, "utf8");
|
|
69441
69573
|
const next = cleanupCodexLightConfigText(original);
|
|
69442
69574
|
if (next === original)
|
|
69443
69575
|
return { changed: false };
|
|
@@ -69569,8 +69701,8 @@ function nodeErrorCode4(error) {
|
|
|
69569
69701
|
var INSTALLED_AGENTS_MANIFEST = ".installed-agents.json";
|
|
69570
69702
|
async function cleanupCodexLight(input = {}) {
|
|
69571
69703
|
const env3 = input.env ?? process.env;
|
|
69572
|
-
const codexHome = resolve15(input.codexHome ?? env3.CODEX_HOME ??
|
|
69573
|
-
const configPath =
|
|
69704
|
+
const codexHome = resolve15(input.codexHome ?? env3.CODEX_HOME ?? join51(homedir8(), ".codex"));
|
|
69705
|
+
const configPath = join51(codexHome, "config.toml");
|
|
69574
69706
|
const agentPaths = await collectInstalledAgentPaths(codexHome, configPath);
|
|
69575
69707
|
const configCleanup = await cleanupCodexConfig(configPath, input.now);
|
|
69576
69708
|
const agentCleanup = await removeManifestListedAgentLinks(codexHome, agentPaths);
|
|
@@ -69606,17 +69738,17 @@ async function cleanupCodexLight(input = {}) {
|
|
|
69606
69738
|
}
|
|
69607
69739
|
function managedGlobalStatePaths(codexHome) {
|
|
69608
69740
|
return [
|
|
69609
|
-
|
|
69610
|
-
|
|
69611
|
-
|
|
69612
|
-
|
|
69613
|
-
|
|
69741
|
+
join51(codexHome, "plugins", "cache", "sisyphuslabs"),
|
|
69742
|
+
join51(codexHome, ".tmp", "marketplaces", "sisyphuslabs"),
|
|
69743
|
+
join51(codexHome, "runtime", "ast-grep"),
|
|
69744
|
+
join51(codexHome, "runtime", "node"),
|
|
69745
|
+
join51(codexHome, "plugins", "data", "omo-sisyphuslabs", "bootstrap")
|
|
69614
69746
|
];
|
|
69615
69747
|
}
|
|
69616
69748
|
var BOOTSTRAP_DATA_GLOB_MAX_DEPTH = 5;
|
|
69617
69749
|
async function collectBootstrapDataDirsByGlob(codexHome) {
|
|
69618
69750
|
const results = [];
|
|
69619
|
-
await walkForManagedBootstrapDirs(
|
|
69751
|
+
await walkForManagedBootstrapDirs(join51(codexHome, "plugins"), 0, results);
|
|
69620
69752
|
return results;
|
|
69621
69753
|
}
|
|
69622
69754
|
async function walkForManagedBootstrapDirs(directory, depth, results) {
|
|
@@ -69628,9 +69760,9 @@ async function walkForManagedBootstrapDirs(directory, depth, results) {
|
|
|
69628
69760
|
for (const entry of entries) {
|
|
69629
69761
|
if (!entry.isDirectory())
|
|
69630
69762
|
continue;
|
|
69631
|
-
const childPath =
|
|
69763
|
+
const childPath = join51(directory, entry.name);
|
|
69632
69764
|
if (isManagedBootstrapOwnerName(entry.name)) {
|
|
69633
|
-
const bootstrapDir =
|
|
69765
|
+
const bootstrapDir = join51(childPath, "bootstrap");
|
|
69634
69766
|
if (await exists6(bootstrapDir))
|
|
69635
69767
|
results.push(bootstrapDir);
|
|
69636
69768
|
continue;
|
|
@@ -69659,19 +69791,19 @@ async function attemptRemove(path7) {
|
|
|
69659
69791
|
}
|
|
69660
69792
|
async function pruneEmptyRuntimeDirBestEffort(codexHome) {
|
|
69661
69793
|
try {
|
|
69662
|
-
await rmdir(
|
|
69794
|
+
await rmdir(join51(codexHome, "runtime"));
|
|
69663
69795
|
} catch {}
|
|
69664
69796
|
}
|
|
69665
69797
|
async function collectInstalledAgentPaths(codexHome, configPath) {
|
|
69666
69798
|
const manifestPaths = [
|
|
69667
|
-
|
|
69799
|
+
join51(codexHome, ".tmp", "marketplaces", "sisyphuslabs", "plugins", "omo", INSTALLED_AGENTS_MANIFEST)
|
|
69668
69800
|
];
|
|
69669
|
-
const versionRoot =
|
|
69801
|
+
const versionRoot = join51(codexHome, "plugins", "cache", "sisyphuslabs", "omo");
|
|
69670
69802
|
if (await exists6(versionRoot)) {
|
|
69671
69803
|
const entries = await readdir7(versionRoot, { withFileTypes: true });
|
|
69672
69804
|
for (const entry of entries) {
|
|
69673
69805
|
if (entry.isDirectory())
|
|
69674
|
-
manifestPaths.push(
|
|
69806
|
+
manifestPaths.push(join51(versionRoot, entry.name, INSTALLED_AGENTS_MANIFEST));
|
|
69675
69807
|
}
|
|
69676
69808
|
}
|
|
69677
69809
|
const paths = new Set;
|
|
@@ -69688,19 +69820,19 @@ async function collectInstalledAgentPaths(codexHome, configPath) {
|
|
|
69688
69820
|
async function readManagedAgentPathsFromConfig(codexHome, configPath) {
|
|
69689
69821
|
if (!await exists6(configPath))
|
|
69690
69822
|
return [];
|
|
69691
|
-
const config = await
|
|
69692
|
-
return MANAGED_CODEX_AGENT_NAMES2.filter((agentName) => config.includes(`config_file = ${JSON.stringify(`./agents/${agentName}.toml`)}`)).map((agentName) =>
|
|
69823
|
+
const config = await readFile19(configPath, "utf8");
|
|
69824
|
+
return MANAGED_CODEX_AGENT_NAMES2.filter((agentName) => config.includes(`config_file = ${JSON.stringify(`./agents/${agentName}.toml`)}`)).map((agentName) => join51(codexHome, "agents", `${agentName}.toml`));
|
|
69693
69825
|
}
|
|
69694
69826
|
async function readInstalledAgentManifest(manifestPath) {
|
|
69695
69827
|
if (!await exists6(manifestPath))
|
|
69696
69828
|
return [];
|
|
69697
|
-
const parsed = JSON.parse(await
|
|
69829
|
+
const parsed = JSON.parse(await readFile19(manifestPath, "utf8"));
|
|
69698
69830
|
if (!isPlainRecord3(parsed) || !Array.isArray(parsed.agents))
|
|
69699
69831
|
return [];
|
|
69700
69832
|
return parsed.agents.filter((path7) => typeof path7 === "string");
|
|
69701
69833
|
}
|
|
69702
69834
|
async function removeManifestListedAgentLinks(codexHome, paths) {
|
|
69703
|
-
const agentsDir =
|
|
69835
|
+
const agentsDir = join51(codexHome, "agents");
|
|
69704
69836
|
const removed = [];
|
|
69705
69837
|
const skipped = [];
|
|
69706
69838
|
for (const path7 of paths) {
|
|
@@ -69784,19 +69916,19 @@ init_provider_availability();
|
|
|
69784
69916
|
|
|
69785
69917
|
// packages/omo-opencode/src/cli/config-manager/add-tui-plugin-to-tui-config.ts
|
|
69786
69918
|
import { existsSync as existsSync32, mkdirSync as mkdirSync10, readFileSync as readFileSync16 } from "node:fs";
|
|
69787
|
-
import { join as
|
|
69919
|
+
import { join as join53 } from "node:path";
|
|
69788
69920
|
|
|
69789
69921
|
// packages/omo-opencode/src/cli/doctor/checks/tui-plugin-config.ts
|
|
69790
69922
|
init_shared();
|
|
69791
69923
|
import { existsSync as existsSync31, readFileSync as readFileSync15 } from "node:fs";
|
|
69792
|
-
import { join as
|
|
69924
|
+
import { join as join52 } from "node:path";
|
|
69793
69925
|
var TUI_SUBPATH = "tui";
|
|
69794
69926
|
var TUI_EXPORT_SUBPATH = `./${TUI_SUBPATH}`;
|
|
69795
69927
|
function fileEntryPackageJsonPath(entry) {
|
|
69796
69928
|
let path7 = entry.slice("file:".length);
|
|
69797
69929
|
if (path7.startsWith("//"))
|
|
69798
69930
|
path7 = path7.slice(2);
|
|
69799
|
-
return
|
|
69931
|
+
return join52(path7, "package.json");
|
|
69800
69932
|
}
|
|
69801
69933
|
function packageJsonExportsTui(pkgJsonPath) {
|
|
69802
69934
|
if (!existsSync31(pkgJsonPath))
|
|
@@ -69834,7 +69966,7 @@ function packageExportsTuiForServerEntry(entry) {
|
|
|
69834
69966
|
const packageName = packageNameFromServerEntry(entry);
|
|
69835
69967
|
if (packageName === null)
|
|
69836
69968
|
return null;
|
|
69837
|
-
return packageJsonExportsTui(
|
|
69969
|
+
return packageJsonExportsTui(join52(getOpenCodeConfigDir({ binary: "opencode" }), "node_modules", packageName, "package.json"));
|
|
69838
69970
|
}
|
|
69839
69971
|
function isOurFilePluginEntry(entry) {
|
|
69840
69972
|
if (!entry.startsWith("file:"))
|
|
@@ -69907,7 +70039,7 @@ function detectServerPluginRegistration() {
|
|
|
69907
70039
|
}
|
|
69908
70040
|
}
|
|
69909
70041
|
function detectTuiPluginRegistration() {
|
|
69910
|
-
const tuiJsonPath =
|
|
70042
|
+
const tuiJsonPath = join52(getOpenCodeConfigDir({ binary: "opencode" }), "tui.json");
|
|
69911
70043
|
if (!existsSync31(tuiJsonPath)) {
|
|
69912
70044
|
return {
|
|
69913
70045
|
registered: false,
|
|
@@ -70063,10 +70195,10 @@ function readConfig(path7) {
|
|
|
70063
70195
|
return null;
|
|
70064
70196
|
}
|
|
70065
70197
|
function readServerConfig(configDir) {
|
|
70066
|
-
const jsoncPath =
|
|
70198
|
+
const jsoncPath = join53(configDir, "opencode.jsonc");
|
|
70067
70199
|
if (existsSync32(jsoncPath))
|
|
70068
70200
|
return readConfig(jsoncPath);
|
|
70069
|
-
const jsonPath =
|
|
70201
|
+
const jsonPath = join53(configDir, "opencode.json");
|
|
70070
70202
|
if (existsSync32(jsonPath))
|
|
70071
70203
|
return readConfig(jsonPath);
|
|
70072
70204
|
return null;
|
|
@@ -70108,7 +70240,7 @@ function ensureTuiPluginEntry(opts = {}) {
|
|
|
70108
70240
|
if (!desiredEntry) {
|
|
70109
70241
|
return { changed: false, reason: "no-server-entry" };
|
|
70110
70242
|
}
|
|
70111
|
-
const tuiJsonPath =
|
|
70243
|
+
const tuiJsonPath = join53(configDir, "tui.json");
|
|
70112
70244
|
const { config, malformed } = readTuiConfig(tuiJsonPath);
|
|
70113
70245
|
if (malformed) {
|
|
70114
70246
|
return { changed: false, reason: "malformed" };
|
|
@@ -70124,7 +70256,7 @@ function ensureTuiPluginEntry(opts = {}) {
|
|
|
70124
70256
|
|
|
70125
70257
|
// packages/omo-opencode/src/cli/install-ast-grep-sg.ts
|
|
70126
70258
|
import { homedir as homedir9 } from "node:os";
|
|
70127
|
-
import { join as
|
|
70259
|
+
import { join as join54 } from "node:path";
|
|
70128
70260
|
|
|
70129
70261
|
// packages/shared-skills/index.mjs
|
|
70130
70262
|
import { fileURLToPath } from "node:url";
|
|
@@ -70143,9 +70275,9 @@ function describeResult2(result) {
|
|
|
70143
70275
|
}
|
|
70144
70276
|
async function installAstGrepForOpenCode(options = {}) {
|
|
70145
70277
|
const platform = options.platform ?? process.platform;
|
|
70146
|
-
const baseDir =
|
|
70278
|
+
const baseDir = join54(options.homeDir ?? homedir9(), ".omo");
|
|
70147
70279
|
const targetDir = astGrepRuntimeDir(baseDir, platform, options.arch ?? process.arch);
|
|
70148
|
-
const skillDir =
|
|
70280
|
+
const skillDir = join54(options.sharedSkillsRoot ?? sharedSkillsRootPath(), "ast-grep");
|
|
70149
70281
|
const installer = options.installer ?? runAstGrepSkillInstall;
|
|
70150
70282
|
try {
|
|
70151
70283
|
const result = await installer({ platform, skillDir, targetDir });
|
|
@@ -88591,9 +88723,9 @@ function readCurrentTopLevelTask(planPath) {
|
|
|
88591
88723
|
}
|
|
88592
88724
|
// packages/boulder-state/src/storage/path.ts
|
|
88593
88725
|
import { existsSync as existsSync36 } from "node:fs";
|
|
88594
|
-
import { isAbsolute as isAbsolute9, join as
|
|
88726
|
+
import { isAbsolute as isAbsolute9, join as join56, relative as relative7, resolve as resolve16 } from "node:path";
|
|
88595
88727
|
function getBoulderFilePath(directory) {
|
|
88596
|
-
return
|
|
88728
|
+
return join56(directory, BOULDER_DIR, BOULDER_FILE);
|
|
88597
88729
|
}
|
|
88598
88730
|
function resolveTrackedPath(baseDirectory, trackedPath) {
|
|
88599
88731
|
return isAbsolute9(trackedPath) ? resolve16(trackedPath) : resolve16(baseDirectory, trackedPath);
|
|
@@ -88822,9 +88954,9 @@ init_state();
|
|
|
88822
88954
|
var CONTINUATION_MARKER_DIR = ".omo/run-continuation";
|
|
88823
88955
|
// packages/omo-opencode/src/features/run-continuation-state/storage.ts
|
|
88824
88956
|
import { existsSync as existsSync39, mkdirSync as mkdirSync11, readFileSync as readFileSync21, rmSync as rmSync2, writeFileSync as writeFileSync6 } from "node:fs";
|
|
88825
|
-
import { join as
|
|
88957
|
+
import { join as join57 } from "node:path";
|
|
88826
88958
|
function getMarkerPath(directory, sessionID) {
|
|
88827
|
-
return
|
|
88959
|
+
return join57(directory, CONTINUATION_MARKER_DIR, `${sessionID}.json`);
|
|
88828
88960
|
}
|
|
88829
88961
|
function readContinuationMarker(directory, sessionID) {
|
|
88830
88962
|
const markerPath = getMarkerPath(directory, sessionID);
|
|
@@ -88897,7 +89029,7 @@ async function isSessionInBoulderLineage(input) {
|
|
|
88897
89029
|
init_shared();
|
|
88898
89030
|
init_compaction_marker();
|
|
88899
89031
|
import { readFileSync as readFileSync22, readdirSync as readdirSync6 } from "node:fs";
|
|
88900
|
-
import { join as
|
|
89032
|
+
import { join as join58 } from "node:path";
|
|
88901
89033
|
var defaultSessionLastAgentDeps = {
|
|
88902
89034
|
getMessageDir,
|
|
88903
89035
|
isSqliteBackend,
|
|
@@ -88957,7 +89089,7 @@ async function getLastAgentFromSession(sessionID, client3, deps = {}) {
|
|
|
88957
89089
|
try {
|
|
88958
89090
|
const messages = readdirSync6(messageDir).filter((fileName) => fileName.endsWith(".json")).map((fileName) => {
|
|
88959
89091
|
try {
|
|
88960
|
-
const content = readFileSync22(
|
|
89092
|
+
const content = readFileSync22(join58(messageDir, fileName), "utf-8");
|
|
88961
89093
|
const parsed = JSON.parse(content);
|
|
88962
89094
|
return {
|
|
88963
89095
|
fileName,
|
|
@@ -89001,7 +89133,7 @@ init_agent_display_names();
|
|
|
89001
89133
|
// packages/omo-opencode/src/hooks/ralph-loop/storage.ts
|
|
89002
89134
|
init_frontmatter2();
|
|
89003
89135
|
import { existsSync as existsSync40, readFileSync as readFileSync23, writeFileSync as writeFileSync7, unlinkSync as unlinkSync5, mkdirSync as mkdirSync12 } from "node:fs";
|
|
89004
|
-
import { dirname as dirname19, join as
|
|
89136
|
+
import { dirname as dirname19, join as join59 } from "node:path";
|
|
89005
89137
|
|
|
89006
89138
|
// packages/omo-opencode/src/hooks/ralph-loop/constants.ts
|
|
89007
89139
|
var DEFAULT_STATE_FILE = ".omo/ralph-loop.local.md";
|
|
@@ -89010,7 +89142,7 @@ var DEFAULT_COMPLETION_PROMISE = "DONE";
|
|
|
89010
89142
|
|
|
89011
89143
|
// packages/omo-opencode/src/hooks/ralph-loop/storage.ts
|
|
89012
89144
|
function getStateFilePath(directory, customPath) {
|
|
89013
|
-
return customPath ?
|
|
89145
|
+
return customPath ? join59(directory, customPath) : join59(directory, DEFAULT_STATE_FILE);
|
|
89014
89146
|
}
|
|
89015
89147
|
function readState(directory, customPath) {
|
|
89016
89148
|
const filePath = getStateFilePath(directory, customPath);
|
|
@@ -90123,7 +90255,7 @@ init_extract_semver();
|
|
|
90123
90255
|
init_bun_which_shim();
|
|
90124
90256
|
import { existsSync as existsSync48, accessSync as accessSync4, constants as constants9 } from "node:fs";
|
|
90125
90257
|
import { homedir as homedir13 } from "node:os";
|
|
90126
|
-
import { join as
|
|
90258
|
+
import { join as join66 } from "node:path";
|
|
90127
90259
|
|
|
90128
90260
|
// packages/omo-opencode/src/cli/doctor/framework/spawn-with-timeout.ts
|
|
90129
90261
|
init_spawn_with_windows_hide();
|
|
@@ -90215,17 +90347,17 @@ function getDesktopAppPaths(platform) {
|
|
|
90215
90347
|
case "darwin":
|
|
90216
90348
|
return [
|
|
90217
90349
|
"/Applications/OpenCode.app/Contents/MacOS/OpenCode",
|
|
90218
|
-
|
|
90350
|
+
join66(home, "Applications", "OpenCode.app", "Contents", "MacOS", "OpenCode")
|
|
90219
90351
|
];
|
|
90220
90352
|
case "win32": {
|
|
90221
90353
|
const programFiles = process.env.ProgramFiles;
|
|
90222
90354
|
const localAppData = process.env.LOCALAPPDATA;
|
|
90223
90355
|
const paths = [];
|
|
90224
90356
|
if (programFiles) {
|
|
90225
|
-
paths.push(
|
|
90357
|
+
paths.push(join66(programFiles, "OpenCode", "OpenCode.exe"));
|
|
90226
90358
|
}
|
|
90227
90359
|
if (localAppData) {
|
|
90228
|
-
paths.push(
|
|
90360
|
+
paths.push(join66(localAppData, "OpenCode", "OpenCode.exe"));
|
|
90229
90361
|
}
|
|
90230
90362
|
return paths;
|
|
90231
90363
|
}
|
|
@@ -90233,8 +90365,8 @@ function getDesktopAppPaths(platform) {
|
|
|
90233
90365
|
return [
|
|
90234
90366
|
"/usr/bin/opencode",
|
|
90235
90367
|
"/usr/lib/opencode/opencode",
|
|
90236
|
-
|
|
90237
|
-
|
|
90368
|
+
join66(home, "Applications", "opencode-desktop-linux-x86_64.AppImage"),
|
|
90369
|
+
join66(home, "Applications", "opencode-desktop-linux-aarch64.AppImage")
|
|
90238
90370
|
];
|
|
90239
90371
|
default:
|
|
90240
90372
|
return [];
|
|
@@ -90266,7 +90398,7 @@ async function findOpenCodeBinary(platform = process.platform, checkExists = exi
|
|
|
90266
90398
|
const candidates = getCommandCandidates2(platform);
|
|
90267
90399
|
for (const entry of pathEnv.split(delimiter3).filter(Boolean)) {
|
|
90268
90400
|
for (const command of candidates) {
|
|
90269
|
-
const fullPath =
|
|
90401
|
+
const fullPath = join66(entry, command);
|
|
90270
90402
|
if (checkExists(fullPath) && isExecutable2(fullPath)) {
|
|
90271
90403
|
return { binary: command, path: fullPath };
|
|
90272
90404
|
}
|
|
@@ -90408,22 +90540,22 @@ init_package_json_locator();
|
|
|
90408
90540
|
import { existsSync as existsSync50, readFileSync as readFileSync32, readdirSync as readdirSync8 } from "node:fs";
|
|
90409
90541
|
import { createRequire as createRequire3 } from "node:module";
|
|
90410
90542
|
import { homedir as homedir14 } from "node:os";
|
|
90411
|
-
import { join as
|
|
90543
|
+
import { join as join67 } from "node:path";
|
|
90412
90544
|
import { fileURLToPath as fileURLToPath5 } from "node:url";
|
|
90413
90545
|
init_shared();
|
|
90414
90546
|
function getPlatformDefaultCacheDir(platform = process.platform) {
|
|
90415
90547
|
if (platform === "darwin")
|
|
90416
|
-
return
|
|
90548
|
+
return join67(homedir14(), "Library", "Caches");
|
|
90417
90549
|
if (platform === "win32")
|
|
90418
|
-
return process.env.LOCALAPPDATA ??
|
|
90419
|
-
return
|
|
90550
|
+
return process.env.LOCALAPPDATA ?? join67(homedir14(), "AppData", "Local");
|
|
90551
|
+
return join67(homedir14(), ".cache");
|
|
90420
90552
|
}
|
|
90421
90553
|
function resolveOpenCodeCacheDir() {
|
|
90422
90554
|
const xdgCacheHome = process.env.XDG_CACHE_HOME;
|
|
90423
90555
|
if (xdgCacheHome)
|
|
90424
|
-
return
|
|
90556
|
+
return join67(xdgCacheHome, "opencode");
|
|
90425
90557
|
const fromShared = getOpenCodeCacheDir();
|
|
90426
|
-
const platformDefault =
|
|
90558
|
+
const platformDefault = join67(getPlatformDefaultCacheDir(), "opencode");
|
|
90427
90559
|
if (existsSync50(fromShared) || !existsSync50(platformDefault))
|
|
90428
90560
|
return fromShared;
|
|
90429
90561
|
return platformDefault;
|
|
@@ -90455,11 +90587,11 @@ function normalizeVersion(value) {
|
|
|
90455
90587
|
function createPackageCandidates(rootDir) {
|
|
90456
90588
|
return ACCEPTED_PACKAGE_NAMES.map((packageName) => ({
|
|
90457
90589
|
packageName,
|
|
90458
|
-
installedPackagePath:
|
|
90590
|
+
installedPackagePath: join67(rootDir, "node_modules", packageName, "package.json")
|
|
90459
90591
|
}));
|
|
90460
90592
|
}
|
|
90461
90593
|
function createTaggedInstallCandidates(rootDir) {
|
|
90462
|
-
const packagesDir =
|
|
90594
|
+
const packagesDir = join67(rootDir, "packages");
|
|
90463
90595
|
if (!existsSync50(packagesDir))
|
|
90464
90596
|
return [];
|
|
90465
90597
|
const candidates = [];
|
|
@@ -90467,14 +90599,14 @@ function createTaggedInstallCandidates(rootDir) {
|
|
|
90467
90599
|
const packageName = ACCEPTED_PACKAGE_NAMES.find((name) => entryName.startsWith(`${name}@`));
|
|
90468
90600
|
if (packageName === undefined)
|
|
90469
90601
|
continue;
|
|
90470
|
-
const installDir =
|
|
90602
|
+
const installDir = join67(packagesDir, entryName);
|
|
90471
90603
|
candidates.push({
|
|
90472
90604
|
cacheDir: installDir,
|
|
90473
|
-
cachePackagePath:
|
|
90605
|
+
cachePackagePath: join67(installDir, "package.json"),
|
|
90474
90606
|
packageCandidates: [
|
|
90475
90607
|
{
|
|
90476
90608
|
packageName,
|
|
90477
|
-
installedPackagePath:
|
|
90609
|
+
installedPackagePath: join67(installDir, "node_modules", packageName, "package.json")
|
|
90478
90610
|
}
|
|
90479
90611
|
]
|
|
90480
90612
|
});
|
|
@@ -90519,13 +90651,13 @@ function getLoadedPluginVersion() {
|
|
|
90519
90651
|
const candidates = [
|
|
90520
90652
|
{
|
|
90521
90653
|
cacheDir: configDir,
|
|
90522
|
-
cachePackagePath:
|
|
90654
|
+
cachePackagePath: join67(configDir, "package.json"),
|
|
90523
90655
|
packageCandidates: createPackageCandidates(configDir)
|
|
90524
90656
|
},
|
|
90525
90657
|
...createTaggedInstallCandidates(configDir),
|
|
90526
90658
|
{
|
|
90527
90659
|
cacheDir,
|
|
90528
|
-
cachePackagePath:
|
|
90660
|
+
cachePackagePath: join67(cacheDir, "package.json"),
|
|
90529
90661
|
packageCandidates: createPackageCandidates(cacheDir)
|
|
90530
90662
|
},
|
|
90531
90663
|
...createTaggedInstallCandidates(cacheDir)
|
|
@@ -90828,18 +90960,18 @@ function validatePluginConfig(directory) {
|
|
|
90828
90960
|
init_shared();
|
|
90829
90961
|
import { existsSync as existsSync52, readFileSync as readFileSync35 } from "node:fs";
|
|
90830
90962
|
import { homedir as homedir16 } from "node:os";
|
|
90831
|
-
import { join as
|
|
90963
|
+
import { join as join68 } from "node:path";
|
|
90832
90964
|
function getUserConfigDir2() {
|
|
90833
90965
|
const xdgConfig = process.env.XDG_CONFIG_HOME;
|
|
90834
90966
|
if (xdgConfig)
|
|
90835
|
-
return
|
|
90836
|
-
return
|
|
90967
|
+
return join68(xdgConfig, "opencode");
|
|
90968
|
+
return join68(homedir16(), ".config", "opencode");
|
|
90837
90969
|
}
|
|
90838
90970
|
function loadCustomProviderNames() {
|
|
90839
90971
|
const configDir = getUserConfigDir2();
|
|
90840
90972
|
const candidatePaths = [
|
|
90841
|
-
|
|
90842
|
-
|
|
90973
|
+
join68(configDir, "opencode.json"),
|
|
90974
|
+
join68(configDir, "opencode.jsonc")
|
|
90843
90975
|
];
|
|
90844
90976
|
for (const configPath of candidatePaths) {
|
|
90845
90977
|
if (!existsSync52(configPath))
|
|
@@ -90860,7 +90992,7 @@ function loadCustomProviderNames() {
|
|
|
90860
90992
|
return [];
|
|
90861
90993
|
}
|
|
90862
90994
|
function loadAvailableModelsFromCache() {
|
|
90863
|
-
const cacheFile =
|
|
90995
|
+
const cacheFile = join68(getOpenCodeCacheDir(), "models.json");
|
|
90864
90996
|
const customProviders = loadCustomProviderNames();
|
|
90865
90997
|
if (!existsSync52(cacheFile)) {
|
|
90866
90998
|
if (customProviders.length > 0) {
|
|
@@ -90897,8 +91029,8 @@ init_model_capabilities2();
|
|
|
90897
91029
|
init_shared();
|
|
90898
91030
|
init_plugin_identity();
|
|
90899
91031
|
import { readFileSync as readFileSync36 } from "node:fs";
|
|
90900
|
-
import { join as
|
|
90901
|
-
var PROJECT_CONFIG_DIR =
|
|
91032
|
+
import { join as join69 } from "node:path";
|
|
91033
|
+
var PROJECT_CONFIG_DIR = join69(process.cwd(), ".opencode");
|
|
90902
91034
|
function loadOmoConfig() {
|
|
90903
91035
|
const projectDetected = detectPluginConfigFile(PROJECT_CONFIG_DIR, {
|
|
90904
91036
|
basenames: [CONFIG_BASENAME],
|
|
@@ -90936,7 +91068,7 @@ function loadOmoConfig() {
|
|
|
90936
91068
|
|
|
90937
91069
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-details.ts
|
|
90938
91070
|
init_shared();
|
|
90939
|
-
import { join as
|
|
91071
|
+
import { join as join70 } from "node:path";
|
|
90940
91072
|
|
|
90941
91073
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-variant.ts
|
|
90942
91074
|
function formatModelWithVariant(model, variant) {
|
|
@@ -90978,7 +91110,7 @@ function formatCapabilityResolutionLabel(mode) {
|
|
|
90978
91110
|
}
|
|
90979
91111
|
function buildModelResolutionDetails(options) {
|
|
90980
91112
|
const details = [];
|
|
90981
|
-
const cacheFile =
|
|
91113
|
+
const cacheFile = join70(getOpenCodeCacheDir(), "models.json");
|
|
90982
91114
|
details.push("═══ Available Models (from cache) ═══");
|
|
90983
91115
|
details.push("");
|
|
90984
91116
|
if (options.available.cacheExists) {
|
|
@@ -91257,25 +91389,25 @@ init_src();
|
|
|
91257
91389
|
import { existsSync as existsSync53 } from "node:fs";
|
|
91258
91390
|
import { createRequire as createRequire4 } from "node:module";
|
|
91259
91391
|
import { homedir as homedir18 } from "node:os";
|
|
91260
|
-
import { dirname as dirname25, join as
|
|
91392
|
+
import { dirname as dirname25, join as join72 } from "node:path";
|
|
91261
91393
|
|
|
91262
91394
|
// packages/omo-opencode/src/hooks/comment-checker/downloader.ts
|
|
91263
|
-
import { join as
|
|
91395
|
+
import { join as join71 } from "path";
|
|
91264
91396
|
import { homedir as homedir17, tmpdir as tmpdir3 } from "os";
|
|
91265
91397
|
init_binary_downloader();
|
|
91266
91398
|
init_logger2();
|
|
91267
91399
|
init_plugin_identity();
|
|
91268
91400
|
var DEBUG = process.env.COMMENT_CHECKER_DEBUG === "1";
|
|
91269
|
-
var DEBUG_FILE =
|
|
91401
|
+
var DEBUG_FILE = join71(tmpdir3(), "comment-checker-debug.log");
|
|
91270
91402
|
function getCacheDir2() {
|
|
91271
91403
|
if (process.platform === "win32") {
|
|
91272
91404
|
const localAppData = process.env.LOCALAPPDATA || process.env.APPDATA;
|
|
91273
|
-
const base2 = localAppData ||
|
|
91274
|
-
return
|
|
91405
|
+
const base2 = localAppData || join71(homedir17(), "AppData", "Local");
|
|
91406
|
+
return join71(base2, CACHE_DIR_NAME, "bin");
|
|
91275
91407
|
}
|
|
91276
91408
|
const xdgCache = process.env.XDG_CACHE_HOME;
|
|
91277
|
-
const base = xdgCache ||
|
|
91278
|
-
return
|
|
91409
|
+
const base = xdgCache || join71(homedir17(), ".cache");
|
|
91410
|
+
return join71(base, CACHE_DIR_NAME, "bin");
|
|
91279
91411
|
}
|
|
91280
91412
|
function getBinaryName() {
|
|
91281
91413
|
return process.platform === "win32" ? "comment-checker.exe" : "comment-checker";
|
|
@@ -91325,7 +91457,7 @@ async function getBinaryVersion(binary) {
|
|
|
91325
91457
|
}
|
|
91326
91458
|
}
|
|
91327
91459
|
async function checkAstGrepCli() {
|
|
91328
|
-
const runtimeDir = astGrepRuntimeDir(
|
|
91460
|
+
const runtimeDir = astGrepRuntimeDir(join72(homedir18(), ".omo"));
|
|
91329
91461
|
const sgPath = findSgBinarySync({ runtimeDir });
|
|
91330
91462
|
if (sgPath === null) {
|
|
91331
91463
|
return {
|
|
@@ -91355,10 +91487,10 @@ function findCommentCheckerPackageBinary(baseDirOverride, resolvePackageJsonPath
|
|
|
91355
91487
|
const platformKey = `${process.platform}-${process.arch === "x64" ? "x64" : process.arch}`;
|
|
91356
91488
|
try {
|
|
91357
91489
|
const packageDir = baseDirOverride ?? dirname25(resolvePackageJsonPath());
|
|
91358
|
-
const vendorPath =
|
|
91490
|
+
const vendorPath = join72(packageDir, "vendor", platformKey, binaryName);
|
|
91359
91491
|
if (existsSync53(vendorPath))
|
|
91360
91492
|
return vendorPath;
|
|
91361
|
-
const binPath =
|
|
91493
|
+
const binPath = join72(packageDir, "bin", binaryName);
|
|
91362
91494
|
if (existsSync53(binPath))
|
|
91363
91495
|
return binPath;
|
|
91364
91496
|
} catch (error51) {
|
|
@@ -91504,7 +91636,7 @@ async function getGhCliInfo(dependencies = {}) {
|
|
|
91504
91636
|
|
|
91505
91637
|
// packages/omo-opencode/src/cli/doctor/checks/tools-lsp.ts
|
|
91506
91638
|
import { readFileSync as readFileSync37 } from "node:fs";
|
|
91507
|
-
import { join as
|
|
91639
|
+
import { join as join73 } from "node:path";
|
|
91508
91640
|
|
|
91509
91641
|
// packages/omo-opencode/src/mcp/lsp.ts
|
|
91510
91642
|
import { existsSync as existsSync54 } from "node:fs";
|
|
@@ -91711,7 +91843,7 @@ function readOmoConfig(configDirectory) {
|
|
|
91711
91843
|
}
|
|
91712
91844
|
function isLspMcpDisabled(options) {
|
|
91713
91845
|
const userConfigDirectory = options.configDirectory ?? getOpenCodeConfigDir({ binary: "opencode" });
|
|
91714
|
-
const projectConfigDirectory =
|
|
91846
|
+
const projectConfigDirectory = join73(options.cwd ?? process.cwd(), ".opencode");
|
|
91715
91847
|
const userConfig = readOmoConfig(userConfigDirectory);
|
|
91716
91848
|
const projectConfig = readOmoConfig(projectConfigDirectory);
|
|
91717
91849
|
const disabledMcps = new Set([
|
|
@@ -91732,13 +91864,13 @@ function getInstalledLspServers(options = {}) {
|
|
|
91732
91864
|
init_shared();
|
|
91733
91865
|
import { existsSync as existsSync55, readFileSync as readFileSync38 } from "node:fs";
|
|
91734
91866
|
import { homedir as homedir19 } from "node:os";
|
|
91735
|
-
import { join as
|
|
91867
|
+
import { join as join74 } from "node:path";
|
|
91736
91868
|
var BUILTIN_MCP_SERVERS = ["websearch", "context7", "grep_app", "lsp"];
|
|
91737
91869
|
function getMcpConfigPaths() {
|
|
91738
91870
|
return [
|
|
91739
|
-
|
|
91740
|
-
|
|
91741
|
-
|
|
91871
|
+
join74(homedir19(), ".claude", ".mcp.json"),
|
|
91872
|
+
join74(process.cwd(), ".mcp.json"),
|
|
91873
|
+
join74(process.cwd(), ".claude", ".mcp.json")
|
|
91742
91874
|
];
|
|
91743
91875
|
}
|
|
91744
91876
|
function loadUserMcpConfig() {
|
|
@@ -91983,9 +92115,9 @@ async function pathExists(dir) {
|
|
|
91983
92115
|
// packages/omo-opencode/src/cli/doctor/checks/codex.ts
|
|
91984
92116
|
init_src();
|
|
91985
92117
|
import { existsSync as existsSync56 } from "node:fs";
|
|
91986
|
-
import { lstat as lstat11, readdir as readdir8, readFile as
|
|
92118
|
+
import { lstat as lstat11, readdir as readdir8, readFile as readFile20 } from "node:fs/promises";
|
|
91987
92119
|
import { homedir as homedir21 } from "node:os";
|
|
91988
|
-
import { basename as basename12, join as
|
|
92120
|
+
import { basename as basename12, join as join75, resolve as resolve19 } from "node:path";
|
|
91989
92121
|
// packages/omo-opencode/package.json
|
|
91990
92122
|
var package_default3 = {
|
|
91991
92123
|
name: "@oh-my-opencode/omo-opencode",
|
|
@@ -92041,13 +92173,13 @@ var CODEX_BIN_NAMES = [
|
|
|
92041
92173
|
"omo-git-bash-hook"
|
|
92042
92174
|
];
|
|
92043
92175
|
async function gatherCodexSummary(deps = {}) {
|
|
92044
|
-
const codexHome = resolve19(deps.codexHome ?? process.env.CODEX_HOME ??
|
|
92176
|
+
const codexHome = resolve19(deps.codexHome ?? process.env.CODEX_HOME ?? join75(homedir21(), ".codex"));
|
|
92045
92177
|
const binDir = resolveCodexInstallerBinDir({ binDir: deps.binDir, codexHome, env: process.env });
|
|
92046
92178
|
const detection = await (deps.detectCodexInstallation ?? detectCodexInstallation)();
|
|
92047
92179
|
const pluginRoot = await resolveInstalledPluginRoot(codexHome);
|
|
92048
|
-
const manifest = pluginRoot === null ? null : await readJson(
|
|
92049
|
-
const installSnapshot = pluginRoot === null ? null : await readJson(
|
|
92050
|
-
const configPath =
|
|
92180
|
+
const manifest = pluginRoot === null ? null : await readJson(join75(pluginRoot, ".codex-plugin", "plugin.json"));
|
|
92181
|
+
const installSnapshot = pluginRoot === null ? null : await readJson(join75(pluginRoot, "lazycodex-install.json"));
|
|
92182
|
+
const configPath = join75(codexHome, "config.toml");
|
|
92051
92183
|
const pluginVersion = stringField(manifest, "version");
|
|
92052
92184
|
return {
|
|
92053
92185
|
codexPath: detection.found && "path" in detection ? detection.path : null,
|
|
@@ -92103,7 +92235,7 @@ function buildCodexIssues(summary) {
|
|
|
92103
92235
|
if (summary.pluginRoot === null) {
|
|
92104
92236
|
issues.push({
|
|
92105
92237
|
title: "OMO Codex plugin is not installed",
|
|
92106
|
-
description: `Expected cached plugin at ${
|
|
92238
|
+
description: `Expected cached plugin at ${join75("plugins", "cache", MARKETPLACE_NAME, PLUGIN_NAME2, DEFAULT_PLUGIN_VERSION)} under CODEX_HOME.`,
|
|
92107
92239
|
fix: "Run: npx lazycodex-ai install",
|
|
92108
92240
|
severity: "error",
|
|
92109
92241
|
affects: ["plugin loading"]
|
|
@@ -92156,18 +92288,18 @@ function buildCodexIssues(summary) {
|
|
|
92156
92288
|
return issues;
|
|
92157
92289
|
}
|
|
92158
92290
|
async function resolveInstalledPluginRoot(codexHome) {
|
|
92159
|
-
const pluginRoot =
|
|
92291
|
+
const pluginRoot = join75(codexHome, "plugins", "cache", MARKETPLACE_NAME, PLUGIN_NAME2);
|
|
92160
92292
|
if (!existsSync56(pluginRoot))
|
|
92161
92293
|
return null;
|
|
92162
92294
|
const versions2 = await readdir8(pluginRoot, { withFileTypes: true });
|
|
92163
92295
|
const candidates = versions2.filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort(compareVersionsDescending);
|
|
92164
|
-
return candidates.length === 0 ? null :
|
|
92296
|
+
return candidates.length === 0 ? null : join75(pluginRoot, candidates[0] ?? DEFAULT_PLUGIN_VERSION);
|
|
92165
92297
|
}
|
|
92166
92298
|
async function readCodexConfigSummary(configPath) {
|
|
92167
92299
|
if (!existsSync56(configPath)) {
|
|
92168
92300
|
return { exists: false, marketplaceConfigured: false, pluginEnabled: false, pluginsFeatureEnabled: false, pluginHooksFeatureEnabled: false };
|
|
92169
92301
|
}
|
|
92170
|
-
const content = await
|
|
92302
|
+
const content = await readFile20(configPath, "utf8");
|
|
92171
92303
|
return {
|
|
92172
92304
|
exists: true,
|
|
92173
92305
|
marketplaceConfigured: content.includes("[marketplaces.sisyphuslabs]"),
|
|
@@ -92179,13 +92311,13 @@ async function readCodexConfigSummary(configPath) {
|
|
|
92179
92311
|
async function readLinkedBins(binDir) {
|
|
92180
92312
|
const linked = [];
|
|
92181
92313
|
for (const name of CODEX_BIN_NAMES) {
|
|
92182
|
-
if (await pathExists2(
|
|
92314
|
+
if (await pathExists2(join75(binDir, process.platform === "win32" ? `${name}.cmd` : name)))
|
|
92183
92315
|
linked.push(name);
|
|
92184
92316
|
}
|
|
92185
92317
|
return linked;
|
|
92186
92318
|
}
|
|
92187
92319
|
async function readLinkedAgents(codexHome) {
|
|
92188
|
-
const agentsDir =
|
|
92320
|
+
const agentsDir = join75(codexHome, "agents");
|
|
92189
92321
|
if (!existsSync56(agentsDir))
|
|
92190
92322
|
return [];
|
|
92191
92323
|
const entries = await readdir8(agentsDir, { withFileTypes: true });
|
|
@@ -92193,7 +92325,7 @@ async function readLinkedAgents(codexHome) {
|
|
|
92193
92325
|
}
|
|
92194
92326
|
async function readJson(path16) {
|
|
92195
92327
|
try {
|
|
92196
|
-
const parsed = JSON.parse(await
|
|
92328
|
+
const parsed = JSON.parse(await readFile20(path16, "utf8"));
|
|
92197
92329
|
return isPlainRecord(parsed) ? parsed : null;
|
|
92198
92330
|
} catch (error51) {
|
|
92199
92331
|
if (error51 instanceof Error)
|
|
@@ -92243,9 +92375,9 @@ async function pathExists2(path16) {
|
|
|
92243
92375
|
|
|
92244
92376
|
// packages/omo-opencode/src/cli/doctor/checks/codex-components.ts
|
|
92245
92377
|
init_src();
|
|
92246
|
-
import { readdir as readdir9, readFile as
|
|
92378
|
+
import { readdir as readdir9, readFile as readFile21, stat as stat4 } from "node:fs/promises";
|
|
92247
92379
|
import { homedir as homedir22 } from "node:os";
|
|
92248
|
-
import { dirname as dirname27, join as
|
|
92380
|
+
import { dirname as dirname27, join as join76, relative as relative9, resolve as resolve20, sep as sep9 } from "node:path";
|
|
92249
92381
|
var CODEX_COMPONENTS_CHECK_ID = "codex-components";
|
|
92250
92382
|
var CODEX_COMPONENTS_CHECK_NAME = "codex-components";
|
|
92251
92383
|
var PLUGIN_DATA_DIR_NAME = "omo-sisyphuslabs";
|
|
@@ -92255,7 +92387,7 @@ async function checkCodexComponents(deps = {}) {
|
|
|
92255
92387
|
const env3 = deps.env ?? process.env;
|
|
92256
92388
|
const platform = deps.platform ?? process.platform;
|
|
92257
92389
|
const arch = deps.arch ?? process.arch;
|
|
92258
|
-
const codexHome = resolve20(deps.codexHome ?? env3["CODEX_HOME"] ??
|
|
92390
|
+
const codexHome = resolve20(deps.codexHome ?? env3["CODEX_HOME"] ?? join76(homedir22(), ".codex"));
|
|
92259
92391
|
const summary = await gatherCodexSummary({ ...deps, codexHome });
|
|
92260
92392
|
if (summary.pluginRoot === null) {
|
|
92261
92393
|
return {
|
|
@@ -92280,7 +92412,7 @@ async function checkCodexComponents(deps = {}) {
|
|
|
92280
92412
|
});
|
|
92281
92413
|
}
|
|
92282
92414
|
const runtimeSgDir = runtimeSgDirectory(codexHome, platform, arch);
|
|
92283
|
-
const runtimeSgPath =
|
|
92415
|
+
const runtimeSgPath = join76(runtimeSgDir, sgBinaryName(platform));
|
|
92284
92416
|
const sg = findSgBinarySync({
|
|
92285
92417
|
arch,
|
|
92286
92418
|
env: env3,
|
|
@@ -92364,7 +92496,7 @@ function recordBrokenTarget(broken, classified, origin) {
|
|
|
92364
92496
|
async function classifyBundleTarget(bundleRoot, baseRoot, relativePath, allowEscape) {
|
|
92365
92497
|
const targetPath = resolve20(baseRoot, relativePath);
|
|
92366
92498
|
const bundleRootPath = resolve20(bundleRoot);
|
|
92367
|
-
const bundleRootPrefix = bundleRootPath.endsWith(
|
|
92499
|
+
const bundleRootPrefix = bundleRootPath.endsWith(sep9) ? bundleRootPath : `${bundleRootPath}${sep9}`;
|
|
92368
92500
|
if (targetPath !== bundleRootPath && !targetPath.startsWith(bundleRootPrefix)) {
|
|
92369
92501
|
if (allowEscape)
|
|
92370
92502
|
return null;
|
|
@@ -92379,7 +92511,7 @@ async function classifyBundleTarget(bundleRoot, baseRoot, relativePath, allowEsc
|
|
|
92379
92511
|
}
|
|
92380
92512
|
async function findHookManifestPaths(root) {
|
|
92381
92513
|
const paths2 = await findManifestPaths(root, "hooks.json");
|
|
92382
|
-
return paths2.filter((path16) => dirname27(path16).endsWith(`${
|
|
92514
|
+
return paths2.filter((path16) => dirname27(path16).endsWith(`${sep9}hooks`));
|
|
92383
92515
|
}
|
|
92384
92516
|
async function findManifestPaths(root, manifestName) {
|
|
92385
92517
|
let entries;
|
|
@@ -92392,7 +92524,7 @@ async function findManifestPaths(root, manifestName) {
|
|
|
92392
92524
|
for (const entry of entries) {
|
|
92393
92525
|
if (entry.name === "node_modules" || entry.name === ".git")
|
|
92394
92526
|
continue;
|
|
92395
|
-
const entryPath =
|
|
92527
|
+
const entryPath = join76(root, entry.name);
|
|
92396
92528
|
if (entry.isDirectory()) {
|
|
92397
92529
|
paths2.push(...await findManifestPaths(entryPath, manifestName));
|
|
92398
92530
|
continue;
|
|
@@ -92435,18 +92567,18 @@ function isPluginRuntimePathArg(arg) {
|
|
|
92435
92567
|
return (arg.startsWith("./") || arg.startsWith("../")) && arg.endsWith("/dist/cli.js");
|
|
92436
92568
|
}
|
|
92437
92569
|
function runtimeSgDirectory(codexHome, platform, arch) {
|
|
92438
|
-
return
|
|
92570
|
+
return join76(codexHome, "runtime", "ast-grep", runtimeSlug(platform, arch));
|
|
92439
92571
|
}
|
|
92440
92572
|
function describeSgSource(sgPath, env3, runtimeSgDir, platform) {
|
|
92441
92573
|
const override = env3[SG_PATH_ENV_KEY]?.trim();
|
|
92442
92574
|
if (override !== undefined && override.length > 0 && sgPath === override)
|
|
92443
92575
|
return `env override ${SG_PATH_ENV_KEY}`;
|
|
92444
|
-
if (sgPath ===
|
|
92576
|
+
if (sgPath === join76(runtimeSgDir, sgBinaryName(platform)))
|
|
92445
92577
|
return "runtime dir";
|
|
92446
92578
|
return "PATH";
|
|
92447
92579
|
}
|
|
92448
92580
|
async function readBootstrapStateSummary(codexHome) {
|
|
92449
|
-
const statePath =
|
|
92581
|
+
const statePath = join76(codexHome, "plugins", "data", PLUGIN_DATA_DIR_NAME, "bootstrap", "state.json");
|
|
92450
92582
|
const raw = await readJson2(statePath);
|
|
92451
92583
|
if (raw === null)
|
|
92452
92584
|
return null;
|
|
@@ -92495,7 +92627,7 @@ function degradedDetailLines(entries) {
|
|
|
92495
92627
|
}
|
|
92496
92628
|
async function readJson2(path16) {
|
|
92497
92629
|
try {
|
|
92498
|
-
const parsed = JSON.parse(await
|
|
92630
|
+
const parsed = JSON.parse(await readFile21(path16, "utf8"));
|
|
92499
92631
|
return isRecord5(parsed) ? parsed : null;
|
|
92500
92632
|
} catch (error51) {
|
|
92501
92633
|
if (error51 instanceof Error)
|
|
@@ -92523,17 +92655,17 @@ function isRecord5(value) {
|
|
|
92523
92655
|
|
|
92524
92656
|
// packages/omo-opencode/src/cli/doctor/checks/codex-runtime-wrapper.ts
|
|
92525
92657
|
import { existsSync as existsSync57 } from "node:fs";
|
|
92526
|
-
import { readFile as
|
|
92658
|
+
import { readFile as readFile22 } from "node:fs/promises";
|
|
92527
92659
|
import { homedir as homedir23 } from "node:os";
|
|
92528
|
-
import { join as
|
|
92660
|
+
import { join as join77, resolve as resolve21 } from "node:path";
|
|
92529
92661
|
var RUNTIME_WRAPPER_MARKER2 = "OMO_GENERATED_RUNTIME_WRAPPER";
|
|
92530
92662
|
var CHECK_NAME = "codex-runtime-wrapper";
|
|
92531
92663
|
var REINSTALL_COMMAND = "npx --yes lazycodex-ai@latest install --no-tui";
|
|
92532
92664
|
async function checkCodexRuntimeWrapper(deps = {}) {
|
|
92533
|
-
const codexHome = resolve21(deps.codexHome ?? process.env.CODEX_HOME ??
|
|
92665
|
+
const codexHome = resolve21(deps.codexHome ?? process.env.CODEX_HOME ?? join77(homedir23(), ".codex"));
|
|
92534
92666
|
const binDir = resolveCodexInstallerBinDir({ binDir: deps.binDir, codexHome, env: process.env });
|
|
92535
92667
|
const platform = deps.platform ?? process.platform;
|
|
92536
|
-
const wrapperPath =
|
|
92668
|
+
const wrapperPath = join77(binDir, platform === "win32" ? "omo.cmd" : "omo");
|
|
92537
92669
|
const wrapper = await readRuntimeWrapper(wrapperPath);
|
|
92538
92670
|
const issues = [];
|
|
92539
92671
|
if (wrapper?.includes(RUNTIME_WRAPPER_MARKER2) === true) {
|
|
@@ -92558,7 +92690,7 @@ async function checkCodexRuntimeWrapper(deps = {}) {
|
|
|
92558
92690
|
}
|
|
92559
92691
|
async function readRuntimeWrapper(path16) {
|
|
92560
92692
|
try {
|
|
92561
|
-
return await
|
|
92693
|
+
return await readFile22(path16, "utf8");
|
|
92562
92694
|
} catch (error51) {
|
|
92563
92695
|
if (error51 instanceof Error)
|
|
92564
92696
|
return null;
|
|
@@ -93038,12 +93170,12 @@ import {
|
|
|
93038
93170
|
unlinkSync as unlinkSync8,
|
|
93039
93171
|
writeFileSync as writeFileSync11
|
|
93040
93172
|
} from "node:fs";
|
|
93041
|
-
import { basename as basename13, dirname as dirname28, join as
|
|
93173
|
+
import { basename as basename13, dirname as dirname28, join as join80 } from "node:path";
|
|
93042
93174
|
|
|
93043
93175
|
// packages/mcp-client-core/src/config-dir.ts
|
|
93044
93176
|
import { existsSync as existsSync58, realpathSync as realpathSync8 } from "node:fs";
|
|
93045
93177
|
import { homedir as homedir24 } from "node:os";
|
|
93046
|
-
import { join as
|
|
93178
|
+
import { join as join78, resolve as resolve22 } from "node:path";
|
|
93047
93179
|
function resolveConfigPath2(pathValue) {
|
|
93048
93180
|
const resolvedPath = resolve22(pathValue);
|
|
93049
93181
|
if (!existsSync58(resolvedPath))
|
|
@@ -93061,13 +93193,13 @@ function getOpenCodeCliConfigDir(env3 = process.env) {
|
|
|
93061
93193
|
if (customConfigDir) {
|
|
93062
93194
|
return resolveConfigPath2(customConfigDir);
|
|
93063
93195
|
}
|
|
93064
|
-
const xdgConfigDir = env3["XDG_CONFIG_HOME"]?.trim() ||
|
|
93065
|
-
return resolveConfigPath2(
|
|
93196
|
+
const xdgConfigDir = env3["XDG_CONFIG_HOME"]?.trim() || join78(homedir24(), ".config");
|
|
93197
|
+
return resolveConfigPath2(join78(xdgConfigDir, "opencode"));
|
|
93066
93198
|
}
|
|
93067
93199
|
|
|
93068
93200
|
// packages/mcp-client-core/src/mcp-oauth/storage-index.ts
|
|
93069
93201
|
import { chmodSync as chmodSync3, existsSync as existsSync59, readFileSync as readFileSync40, renameSync as renameSync6, writeFileSync as writeFileSync10 } from "node:fs";
|
|
93070
|
-
import { join as
|
|
93202
|
+
import { join as join79 } from "node:path";
|
|
93071
93203
|
var INDEX_FILE_NAME = "index.json";
|
|
93072
93204
|
function isTokenIndex(value) {
|
|
93073
93205
|
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
@@ -93075,7 +93207,7 @@ function isTokenIndex(value) {
|
|
|
93075
93207
|
return Object.values(value).every((entry) => typeof entry === "string");
|
|
93076
93208
|
}
|
|
93077
93209
|
function getIndexPath(storageDir) {
|
|
93078
|
-
return
|
|
93210
|
+
return join79(storageDir, INDEX_FILE_NAME);
|
|
93079
93211
|
}
|
|
93080
93212
|
function readTokenIndex(storageDir) {
|
|
93081
93213
|
const indexPath = getIndexPath(storageDir);
|
|
@@ -93119,16 +93251,16 @@ function deleteTokenIndexEntry(storageDir, hash2) {
|
|
|
93119
93251
|
var STORAGE_DIR_NAME = "mcp-oauth";
|
|
93120
93252
|
var LEGACY_STORAGE_FILE_NAME = "mcp-oauth.json";
|
|
93121
93253
|
function getMcpOauthStorageDir() {
|
|
93122
|
-
return
|
|
93254
|
+
return join80(getOpenCodeCliConfigDir(), STORAGE_DIR_NAME);
|
|
93123
93255
|
}
|
|
93124
93256
|
function getMcpOauthServerHash(serverHost, resource) {
|
|
93125
93257
|
return createHash4("sha256").update(buildKey(serverHost, resource)).digest("hex").slice(0, 32);
|
|
93126
93258
|
}
|
|
93127
93259
|
function getMcpOauthStoragePath(serverHost, resource) {
|
|
93128
|
-
return
|
|
93260
|
+
return join80(getMcpOauthStorageDir(), `${getMcpOauthServerHash(serverHost, resource)}.json`);
|
|
93129
93261
|
}
|
|
93130
93262
|
function getLegacyStoragePath() {
|
|
93131
|
-
return
|
|
93263
|
+
return join80(getOpenCodeCliConfigDir(), LEGACY_STORAGE_FILE_NAME);
|
|
93132
93264
|
}
|
|
93133
93265
|
function normalizeHost2(serverHost) {
|
|
93134
93266
|
let host = serverHost.trim();
|
|
@@ -93307,7 +93439,7 @@ function listTokensByHost(serverHost) {
|
|
|
93307
93439
|
for (const [hash2, indexedKey] of Object.entries(index)) {
|
|
93308
93440
|
if (!indexedKey.startsWith(prefix))
|
|
93309
93441
|
continue;
|
|
93310
|
-
const indexedToken = readTokenFile(
|
|
93442
|
+
const indexedToken = readTokenFile(join80(getMcpOauthStorageDir(), `${hash2}.json`));
|
|
93311
93443
|
if (indexedToken)
|
|
93312
93444
|
result[indexedKey] = indexedToken;
|
|
93313
93445
|
}
|
|
@@ -93322,7 +93454,7 @@ function listAllTokens() {
|
|
|
93322
93454
|
for (const entry of readdirSync9(dir, { withFileTypes: true })) {
|
|
93323
93455
|
if (!entry.isFile() || !entry.name.endsWith(".json") || entry.name === "index.json")
|
|
93324
93456
|
continue;
|
|
93325
|
-
const token = readTokenFile(
|
|
93457
|
+
const token = readTokenFile(join80(dir, entry.name));
|
|
93326
93458
|
const hash2 = basename13(entry.name, ".json");
|
|
93327
93459
|
if (token)
|
|
93328
93460
|
result[index[hash2] ?? hash2] = token;
|
|
@@ -94143,7 +94275,7 @@ import { isAbsolute as isAbsolute10, resolve as resolve23 } from "node:path";
|
|
|
94143
94275
|
init_src();
|
|
94144
94276
|
import { existsSync as existsSync63 } from "node:fs";
|
|
94145
94277
|
import { homedir as homedir26 } from "node:os";
|
|
94146
|
-
import { join as
|
|
94278
|
+
import { join as join81 } from "node:path";
|
|
94147
94279
|
|
|
94148
94280
|
// packages/omo-opencode/src/cli/sparkshell-appserver-websocket.ts
|
|
94149
94281
|
import { randomBytes as randomBytes3 } from "node:crypto";
|
|
@@ -94304,8 +94436,8 @@ function resolveAppServerSocketPath(env3) {
|
|
|
94304
94436
|
if (explicit) {
|
|
94305
94437
|
return explicit;
|
|
94306
94438
|
}
|
|
94307
|
-
const codexHome = env3["CODEX_HOME"]?.trim() ||
|
|
94308
|
-
return
|
|
94439
|
+
const codexHome = env3["CODEX_HOME"]?.trim() || join81(homedir26(), ".codex");
|
|
94440
|
+
return join81(codexHome, "app-server-control", "app-server-control.sock");
|
|
94309
94441
|
}
|
|
94310
94442
|
function resolveAppServerTimeoutMs(env3) {
|
|
94311
94443
|
const parsed = Number.parseInt(env3["OMO_SPARKSHELL_APP_SERVER_TIMEOUT_MS"]?.trim() ?? "", 10);
|
|
@@ -94877,7 +95009,7 @@ function isLowSurrogate(codeUnit) {
|
|
|
94877
95009
|
init_src();
|
|
94878
95010
|
import { existsSync as existsSync64, readdirSync as readdirSync10, readFileSync as readFileSync42 } from "node:fs";
|
|
94879
95011
|
import { homedir as homedir27 } from "node:os";
|
|
94880
|
-
import { join as
|
|
95012
|
+
import { join as join82 } from "node:path";
|
|
94881
95013
|
var SPARKSHELL_SESSION_CONTEXT_ENV = "OMO_SPARKSHELL_SESSION_CONTEXT";
|
|
94882
95014
|
var SPARKSHELL_SESSION_ID_ENV = "OMO_SPARKSHELL_SESSION_ID";
|
|
94883
95015
|
var CODEX_THREAD_ID_ENV = "CODEX_THREAD_ID";
|
|
@@ -94893,8 +95025,8 @@ function findRolloutPath(sessionId, env3, deps = {}) {
|
|
|
94893
95025
|
const fileExists = deps.fileExists ?? existsSync64;
|
|
94894
95026
|
const listDirectory = deps.listDirectory ?? ((path16) => readdirSync10(path16));
|
|
94895
95027
|
const homeDirectory = deps.homeDirectory ?? homedir27;
|
|
94896
|
-
const codexHome = env3["CODEX_HOME"]?.trim() ||
|
|
94897
|
-
const roots = [
|
|
95028
|
+
const codexHome = env3["CODEX_HOME"]?.trim() || join82(homeDirectory(), ".codex");
|
|
95029
|
+
const roots = [join82(codexHome, "sessions"), join82(codexHome, "archived_sessions")];
|
|
94898
95030
|
const fileSuffix = `-${sessionId}.jsonl`;
|
|
94899
95031
|
const scanDay = (dayDir) => {
|
|
94900
95032
|
if (!fileExists(dayDir)) {
|
|
@@ -94902,14 +95034,14 @@ function findRolloutPath(sessionId, env3, deps = {}) {
|
|
|
94902
95034
|
}
|
|
94903
95035
|
for (const name of listSafely(listDirectory, dayDir)) {
|
|
94904
95036
|
if (name.startsWith("rollout-") && name.endsWith(fileSuffix)) {
|
|
94905
|
-
return
|
|
95037
|
+
return join82(dayDir, name);
|
|
94906
95038
|
}
|
|
94907
95039
|
}
|
|
94908
95040
|
return null;
|
|
94909
95041
|
};
|
|
94910
95042
|
for (const dayDir of uuidV7DayDirCandidates(sessionId)) {
|
|
94911
95043
|
for (const root of roots) {
|
|
94912
|
-
const found = scanDay(
|
|
95044
|
+
const found = scanDay(join82(root, dayDir));
|
|
94913
95045
|
if (found) {
|
|
94914
95046
|
return found;
|
|
94915
95047
|
}
|
|
@@ -94920,9 +95052,9 @@ function findRolloutPath(sessionId, env3, deps = {}) {
|
|
|
94920
95052
|
continue;
|
|
94921
95053
|
}
|
|
94922
95054
|
for (const year of numericNamesDescending(listSafely(listDirectory, root))) {
|
|
94923
|
-
for (const month of numericNamesDescending(listSafely(listDirectory,
|
|
94924
|
-
for (const day of numericNamesDescending(listSafely(listDirectory,
|
|
94925
|
-
const found = scanDay(
|
|
95055
|
+
for (const month of numericNamesDescending(listSafely(listDirectory, join82(root, year)))) {
|
|
95056
|
+
for (const day of numericNamesDescending(listSafely(listDirectory, join82(root, year, month)))) {
|
|
95057
|
+
const found = scanDay(join82(root, year, month, day));
|
|
94926
95058
|
if (found) {
|
|
94927
95059
|
return found;
|
|
94928
95060
|
}
|
|
@@ -95082,7 +95214,7 @@ function uuidV7DayDirCandidates(sessionId) {
|
|
|
95082
95214
|
const candidates = [];
|
|
95083
95215
|
for (const offsetDays of [0, 1, -1]) {
|
|
95084
95216
|
const date5 = new Date(ms + offsetDays * DAY_MS);
|
|
95085
|
-
candidates.push(
|
|
95217
|
+
candidates.push(join82(String(date5.getFullYear()), pad2(date5.getMonth() + 1), pad2(date5.getDate())));
|
|
95086
95218
|
}
|
|
95087
95219
|
return candidates;
|
|
95088
95220
|
}
|
|
@@ -95123,7 +95255,7 @@ function isFalsy2(value) {
|
|
|
95123
95255
|
import { spawnSync as spawnSync3 } from "node:child_process";
|
|
95124
95256
|
import { mkdtempSync, readFileSync as readFileSync43, rmSync as rmSync4 } from "node:fs";
|
|
95125
95257
|
import { tmpdir as tmpdir4 } from "node:os";
|
|
95126
|
-
import { join as
|
|
95258
|
+
import { join as join83 } from "node:path";
|
|
95127
95259
|
var SPARKSHELL_SPARK_ENV = "OMO_SPARKSHELL_SPARK";
|
|
95128
95260
|
var SPARKSHELL_SPARK_MODEL_ENV = "OMO_SPARKSHELL_SPARK_MODEL";
|
|
95129
95261
|
var SPARKSHELL_SPARK_TIMEOUT_ENV = "OMO_SPARKSHELL_SPARK_TIMEOUT_MS";
|
|
@@ -95197,8 +95329,8 @@ function buildSparkExecArgs(env3, lastMessagePath) {
|
|
|
95197
95329
|
function createDefaultSparkSummarizer(env3, cwd) {
|
|
95198
95330
|
return (request) => {
|
|
95199
95331
|
const binary = env3[SPARKSHELL_SPARK_BIN_ENV]?.trim() || "codex";
|
|
95200
|
-
const tempDir = mkdtempSync(
|
|
95201
|
-
const lastMessagePath =
|
|
95332
|
+
const tempDir = mkdtempSync(join83(tmpdir4(), "omo-sparkshell-spark-"));
|
|
95333
|
+
const lastMessagePath = join83(tempDir, "last-message.txt");
|
|
95202
95334
|
try {
|
|
95203
95335
|
const result = spawnSync3(binary, [...buildSparkExecArgs(env3, lastMessagePath)], {
|
|
95204
95336
|
cwd,
|