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/index.js
CHANGED
|
@@ -2145,7 +2145,7 @@ var package_default;
|
|
|
2145
2145
|
var init_package = __esm(() => {
|
|
2146
2146
|
package_default = {
|
|
2147
2147
|
name: "oh-my-opencode",
|
|
2148
|
-
version: "4.
|
|
2148
|
+
version: "4.12.0",
|
|
2149
2149
|
description: "The Best AI Agent Harness - Batteries-Included OpenCode Plugin with Multi-Model Orchestration, Parallel Background Agents, and Crafted LSP/AST Tools",
|
|
2150
2150
|
main: "./dist/index.js",
|
|
2151
2151
|
types: "dist/index.d.ts",
|
|
@@ -2315,18 +2315,18 @@ var init_package = __esm(() => {
|
|
|
2315
2315
|
typescript: "^6.0.3"
|
|
2316
2316
|
},
|
|
2317
2317
|
optionalDependencies: {
|
|
2318
|
-
"oh-my-opencode-darwin-arm64": "4.
|
|
2319
|
-
"oh-my-opencode-darwin-x64": "4.
|
|
2320
|
-
"oh-my-opencode-darwin-x64-baseline": "4.
|
|
2321
|
-
"oh-my-opencode-linux-arm64": "4.
|
|
2322
|
-
"oh-my-opencode-linux-arm64-musl": "4.
|
|
2323
|
-
"oh-my-opencode-linux-x64": "4.
|
|
2324
|
-
"oh-my-opencode-linux-x64-baseline": "4.
|
|
2325
|
-
"oh-my-opencode-linux-x64-musl": "4.
|
|
2326
|
-
"oh-my-opencode-linux-x64-musl-baseline": "4.
|
|
2327
|
-
"oh-my-opencode-windows-arm64": "4.
|
|
2328
|
-
"oh-my-opencode-windows-x64": "4.
|
|
2329
|
-
"oh-my-opencode-windows-x64-baseline": "4.
|
|
2318
|
+
"oh-my-opencode-darwin-arm64": "4.12.0",
|
|
2319
|
+
"oh-my-opencode-darwin-x64": "4.12.0",
|
|
2320
|
+
"oh-my-opencode-darwin-x64-baseline": "4.12.0",
|
|
2321
|
+
"oh-my-opencode-linux-arm64": "4.12.0",
|
|
2322
|
+
"oh-my-opencode-linux-arm64-musl": "4.12.0",
|
|
2323
|
+
"oh-my-opencode-linux-x64": "4.12.0",
|
|
2324
|
+
"oh-my-opencode-linux-x64-baseline": "4.12.0",
|
|
2325
|
+
"oh-my-opencode-linux-x64-musl": "4.12.0",
|
|
2326
|
+
"oh-my-opencode-linux-x64-musl-baseline": "4.12.0",
|
|
2327
|
+
"oh-my-opencode-windows-arm64": "4.12.0",
|
|
2328
|
+
"oh-my-opencode-windows-x64": "4.12.0",
|
|
2329
|
+
"oh-my-opencode-windows-x64-baseline": "4.12.0"
|
|
2330
2330
|
},
|
|
2331
2331
|
overrides: {
|
|
2332
2332
|
hono: "^4.12.18",
|
|
@@ -56795,7 +56795,7 @@ async function probe(registration) {
|
|
|
56795
56795
|
registration.available = false;
|
|
56796
56796
|
return false;
|
|
56797
56797
|
}
|
|
56798
|
-
const probeUrl = new URL("/
|
|
56798
|
+
const probeUrl = new URL("/global/health", registration.serverUrl);
|
|
56799
56799
|
const authHeader = getServerBasicAuthHeader();
|
|
56800
56800
|
const headers = authHeader ? { Authorization: authHeader } : {};
|
|
56801
56801
|
try {
|
|
@@ -56829,12 +56829,17 @@ async function probe(registration) {
|
|
|
56829
56829
|
return false;
|
|
56830
56830
|
}
|
|
56831
56831
|
}
|
|
56832
|
-
function
|
|
56833
|
-
|
|
56832
|
+
function getFreshProbeAvailability(registration) {
|
|
56833
|
+
const available = registration.available;
|
|
56834
|
+
if (available === undefined || Date.now() - registration.probeTimestamp >= PROBE_TTL_MS) {
|
|
56835
|
+
return;
|
|
56836
|
+
}
|
|
56837
|
+
return available;
|
|
56834
56838
|
}
|
|
56835
56839
|
async function resolveAvailability(registration) {
|
|
56836
|
-
|
|
56837
|
-
|
|
56840
|
+
const freshAvailability = getFreshProbeAvailability(registration);
|
|
56841
|
+
if (freshAvailability !== undefined) {
|
|
56842
|
+
return freshAvailability;
|
|
56838
56843
|
}
|
|
56839
56844
|
if (!registration.inFlightProbe) {
|
|
56840
56845
|
registration.inFlightProbe = probe(registration).finally(() => {
|
|
@@ -56869,10 +56874,11 @@ function tryResolveDispatchClientSync2(client3, sessionID) {
|
|
|
56869
56874
|
if (!registration.serverUrl) {
|
|
56870
56875
|
return { client: client3, route: "in-process", reason: "unavailable" };
|
|
56871
56876
|
}
|
|
56872
|
-
|
|
56877
|
+
const freshAvailability = getFreshProbeAvailability(registration);
|
|
56878
|
+
if (freshAvailability === undefined) {
|
|
56873
56879
|
return;
|
|
56874
56880
|
}
|
|
56875
|
-
if (!
|
|
56881
|
+
if (!freshAvailability) {
|
|
56876
56882
|
return { client: client3, route: "in-process", reason: "unavailable" };
|
|
56877
56883
|
}
|
|
56878
56884
|
const resolvedLiveClient = getOrBuildLiveClient(registration);
|
|
@@ -56887,6 +56893,9 @@ async function resolveDispatchClient2(client3, sessionID) {
|
|
|
56887
56893
|
return syncResult;
|
|
56888
56894
|
}
|
|
56889
56895
|
const registration = registrations.get(client3);
|
|
56896
|
+
if (!registration) {
|
|
56897
|
+
return { client: client3, route: "in-process", reason: "identity" };
|
|
56898
|
+
}
|
|
56890
56899
|
const isAvailable = await resolveAvailability(registration);
|
|
56891
56900
|
if (!isAvailable) {
|
|
56892
56901
|
return { client: client3, route: "in-process", reason: "unavailable" };
|
|
@@ -58882,20 +58891,20 @@ var init_config_manager = __esm(() => {
|
|
|
58882
58891
|
|
|
58883
58892
|
// packages/telemetry-core/src/activity-state.ts
|
|
58884
58893
|
import { existsSync as existsSync27, mkdirSync as mkdirSync8, readFileSync as readFileSync13 } from "fs";
|
|
58885
|
-
import { basename as basename9, join as
|
|
58894
|
+
import { basename as basename9, join as join48 } from "path";
|
|
58886
58895
|
function resolveTelemetryStateDir(product, options = {}) {
|
|
58887
58896
|
const dataDir = resolveXdgDataDir(product.cacheDirName, {
|
|
58888
58897
|
env: options.env,
|
|
58889
58898
|
osProvider: options.osProvider
|
|
58890
58899
|
});
|
|
58891
|
-
const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined :
|
|
58900
|
+
const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined : join48(options.env.XDG_DATA_HOME, product.cacheDirName);
|
|
58892
58901
|
if (dataDir === xdgStateDir || xdgStateDir === undefined && basename9(dataDir) === product.cacheDirName) {
|
|
58893
58902
|
return dataDir;
|
|
58894
58903
|
}
|
|
58895
|
-
return
|
|
58904
|
+
return join48(dataDir, product.cacheDirName);
|
|
58896
58905
|
}
|
|
58897
58906
|
function getTelemetryActivityStateFilePath(stateDir) {
|
|
58898
|
-
return
|
|
58907
|
+
return join48(stateDir, POSTHOG_ACTIVITY_STATE_FILE);
|
|
58899
58908
|
}
|
|
58900
58909
|
function getDailyActiveCaptureState(input) {
|
|
58901
58910
|
const state = readPostHogActivityState(input.stateDir, input.diagnostics);
|
|
@@ -58966,9 +58975,9 @@ var DEFAULT_POSTHOG_HOST = "https://us.i.posthog.com", DEFAULT_POSTHOG_API_KEY =
|
|
|
58966
58975
|
|
|
58967
58976
|
// packages/telemetry-core/src/diagnostics.ts
|
|
58968
58977
|
import { appendFileSync as appendFileSync2, existsSync as existsSync28, mkdirSync as mkdirSync9, readFileSync as readFileSync14 } from "fs";
|
|
58969
|
-
import { join as
|
|
58978
|
+
import { join as join49 } from "path";
|
|
58970
58979
|
function getTelemetryDiagnosticsFilePath(diagnosticsDir) {
|
|
58971
|
-
return
|
|
58980
|
+
return join49(diagnosticsDir, DIAGNOSTICS_FILE_NAME);
|
|
58972
58981
|
}
|
|
58973
58982
|
function writeTelemetryDiagnostic(input, options) {
|
|
58974
58983
|
const now = options.now ?? new Date;
|
|
@@ -59134,7 +59143,7 @@ function getTelemetryDistinctId(machineIdPrefix, osProvider = getDefaultTelemetr
|
|
|
59134
59143
|
var init_machine_id = () => {};
|
|
59135
59144
|
|
|
59136
59145
|
// node_modules/.bun/posthog-node@5.35.12/node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
|
|
59137
|
-
import { dirname as dirname15, posix as posix2, sep as
|
|
59146
|
+
import { dirname as dirname15, posix as posix2, sep as sep7 } from "path";
|
|
59138
59147
|
function createModulerModifier() {
|
|
59139
59148
|
const getModuleFromFileName = createGetModuleFromFilename();
|
|
59140
59149
|
return async (frames) => {
|
|
@@ -59143,7 +59152,7 @@ function createModulerModifier() {
|
|
|
59143
59152
|
return frames;
|
|
59144
59153
|
};
|
|
59145
59154
|
}
|
|
59146
|
-
function createGetModuleFromFilename(basePath = process.argv[1] ? dirname15(process.argv[1]) : process.cwd(), isWindows =
|
|
59155
|
+
function createGetModuleFromFilename(basePath = process.argv[1] ? dirname15(process.argv[1]) : process.cwd(), isWindows = sep7 === "\\") {
|
|
59147
59156
|
const normalizedBase = isWindows ? normalizeWindowsPath(basePath) : basePath;
|
|
59148
59157
|
return (filename) => {
|
|
59149
59158
|
if (!filename)
|
|
@@ -62164,9 +62173,9 @@ var init_context_lines_node = __esm(() => {
|
|
|
62164
62173
|
});
|
|
62165
62174
|
|
|
62166
62175
|
// node_modules/.bun/posthog-node@5.35.12/node_modules/posthog-node/dist/extensions/error-tracking/modifiers/relative-path.node.mjs
|
|
62167
|
-
import { isAbsolute as isAbsolute7, relative as relative5, sep as
|
|
62176
|
+
import { isAbsolute as isAbsolute7, relative as relative5, sep as sep8 } from "path";
|
|
62168
62177
|
function createRelativePathModifier(basePath = process.cwd()) {
|
|
62169
|
-
const isWindows =
|
|
62178
|
+
const isWindows = sep8 === "\\";
|
|
62170
62179
|
const toUnix = (p) => isWindows ? p.replace(/\\/g, "/") : p;
|
|
62171
62180
|
const normalizedBase = toUnix(basePath);
|
|
62172
62181
|
return async (frames) => {
|
|
@@ -64693,7 +64702,7 @@ var package_default2;
|
|
|
64693
64702
|
var init_package2 = __esm(() => {
|
|
64694
64703
|
package_default2 = {
|
|
64695
64704
|
name: "@oh-my-opencode/omo-codex",
|
|
64696
|
-
version: "4.
|
|
64705
|
+
version: "4.12.0",
|
|
64697
64706
|
type: "module",
|
|
64698
64707
|
private: true,
|
|
64699
64708
|
description: "Codex harness adapter for oh-my-openagent. Vendored Codex plugin namespace (omo) + TypeScript installer + telemetry.",
|
|
@@ -65663,7 +65672,7 @@ var init_update_toasts = __esm(() => {
|
|
|
65663
65672
|
|
|
65664
65673
|
// packages/omo-opencode/src/hooks/auto-update-checker/hook/background-update-check.ts
|
|
65665
65674
|
import { existsSync as existsSync47 } from "fs";
|
|
65666
|
-
import { dirname as dirname23, join as
|
|
65675
|
+
import { dirname as dirname23, join as join65 } from "path";
|
|
65667
65676
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
65668
65677
|
function defaultGetModuleHostingWorkspace() {
|
|
65669
65678
|
try {
|
|
@@ -65817,7 +65826,7 @@ var init_background_update_check = __esm(() => {
|
|
|
65817
65826
|
init_update_toasts();
|
|
65818
65827
|
defaultDeps4 = {
|
|
65819
65828
|
existsSync: existsSync47,
|
|
65820
|
-
join:
|
|
65829
|
+
join: join65,
|
|
65821
65830
|
runBunInstallWithDetails,
|
|
65822
65831
|
log: log2,
|
|
65823
65832
|
getOpenCodeCacheDir,
|
|
@@ -66419,7 +66428,7 @@ function getUnsupportedOpenCodeVersionMessage(openCodeVersion) {
|
|
|
66419
66428
|
}
|
|
66420
66429
|
|
|
66421
66430
|
// packages/omo-codex/src/install/install-codex.ts
|
|
66422
|
-
import { join as
|
|
66431
|
+
import { join as join50, resolve as resolve14 } from "path";
|
|
66423
66432
|
import { existsSync as existsSync29 } from "fs";
|
|
66424
66433
|
import { homedir as homedir6 } from "os";
|
|
66425
66434
|
|
|
@@ -66783,8 +66792,8 @@ async function existingNonSymlink(path7) {
|
|
|
66783
66792
|
}
|
|
66784
66793
|
}
|
|
66785
66794
|
// packages/omo-codex/src/install/codex-cache-install.ts
|
|
66786
|
-
import { cp as cp2, mkdir as mkdir3, readFile as
|
|
66787
|
-
import { basename as basename6, dirname as dirname11, join as
|
|
66795
|
+
import { cp as cp2, mkdir as mkdir3, readFile as readFile7, rename, rm as rm3 } from "fs/promises";
|
|
66796
|
+
import { basename as basename6, dirname as dirname11, join as join31, sep as sep5 } from "path";
|
|
66788
66797
|
|
|
66789
66798
|
// packages/omo-codex/src/install/codex-cache-bundled-mcps.ts
|
|
66790
66799
|
import { cp, mkdir as mkdir2, readFile as readFile3, stat as stat2 } from "fs/promises";
|
|
@@ -67122,13 +67131,83 @@ async function rewriteCachedManifestRoot(pluginRoot, fromRoot, toRoot) {
|
|
|
67122
67131
|
`);
|
|
67123
67132
|
}
|
|
67124
67133
|
|
|
67134
|
+
// packages/omo-codex/src/install/codex-hook-targets.ts
|
|
67135
|
+
import { readFile as readFile6 } from "fs/promises";
|
|
67136
|
+
import { join as join30, sep as sep4 } from "path";
|
|
67137
|
+
var PLUGIN_ROOT_TARGET_PATTERN = /\$\{PLUGIN_ROOT\}[\\/]+([^"']+)/g;
|
|
67138
|
+
async function findMissingHookCommandTargets(pluginRoot) {
|
|
67139
|
+
const commands = [];
|
|
67140
|
+
for (const manifestPath of await hookManifestPaths(pluginRoot)) {
|
|
67141
|
+
if (!await fileExistsStrict(manifestPath))
|
|
67142
|
+
continue;
|
|
67143
|
+
const parsed = JSON.parse(await readFile6(manifestPath, "utf8"));
|
|
67144
|
+
collectCommands(parsed, commands);
|
|
67145
|
+
}
|
|
67146
|
+
const missing = [];
|
|
67147
|
+
const seen = new Set;
|
|
67148
|
+
for (const command of commands) {
|
|
67149
|
+
for (const match of command.matchAll(PLUGIN_ROOT_TARGET_PATTERN)) {
|
|
67150
|
+
const targetSuffix = match[1];
|
|
67151
|
+
if (targetSuffix === undefined)
|
|
67152
|
+
continue;
|
|
67153
|
+
const target = join30(pluginRoot, ...targetSuffix.split(/[\\/]+/));
|
|
67154
|
+
if (seen.has(target))
|
|
67155
|
+
continue;
|
|
67156
|
+
seen.add(target);
|
|
67157
|
+
if (!await fileExistsStrict(target))
|
|
67158
|
+
missing.push(target);
|
|
67159
|
+
}
|
|
67160
|
+
}
|
|
67161
|
+
return missing;
|
|
67162
|
+
}
|
|
67163
|
+
async function hookManifestPaths(pluginRoot) {
|
|
67164
|
+
const pluginManifestPath = join30(pluginRoot, ".codex-plugin", "plugin.json");
|
|
67165
|
+
if (!await fileExistsStrict(pluginManifestPath))
|
|
67166
|
+
return [join30(pluginRoot, "hooks", "hooks.json")];
|
|
67167
|
+
const parsed = JSON.parse(await readFile6(pluginManifestPath, "utf8"));
|
|
67168
|
+
if (!isPlainRecord3(parsed))
|
|
67169
|
+
return [];
|
|
67170
|
+
if (typeof parsed.hooks === "string" && parsed.hooks.trim() !== "") {
|
|
67171
|
+
return [join30(pluginRoot, stripDotSlash(parsed.hooks))];
|
|
67172
|
+
}
|
|
67173
|
+
if (Array.isArray(parsed.hooks)) {
|
|
67174
|
+
return parsed.hooks.filter((hookPath) => typeof hookPath === "string" && hookPath.trim() !== "").map((hookPath) => join30(pluginRoot, stripDotSlash(hookPath)));
|
|
67175
|
+
}
|
|
67176
|
+
return [];
|
|
67177
|
+
}
|
|
67178
|
+
function stripDotSlash(path7) {
|
|
67179
|
+
return path7.startsWith("./") ? path7.slice(2) : path7;
|
|
67180
|
+
}
|
|
67181
|
+
async function assertHookCommandTargets(pluginRoot) {
|
|
67182
|
+
const missing = await findMissingHookCommandTargets(pluginRoot);
|
|
67183
|
+
if (missing.length === 0)
|
|
67184
|
+
return;
|
|
67185
|
+
const relativeMissing = missing.map((path7) => path7.split(`${pluginRoot}${sep4}`).join("").split(sep4).join("/"));
|
|
67186
|
+
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.");
|
|
67187
|
+
}
|
|
67188
|
+
function collectCommands(value, commands) {
|
|
67189
|
+
if (Array.isArray(value)) {
|
|
67190
|
+
for (const entry of value)
|
|
67191
|
+
collectCommands(entry, commands);
|
|
67192
|
+
return;
|
|
67193
|
+
}
|
|
67194
|
+
if (!isPlainRecord3(value))
|
|
67195
|
+
return;
|
|
67196
|
+
if (value["type"] === "command" && typeof value["command"] === "string")
|
|
67197
|
+
commands.push(value["command"]);
|
|
67198
|
+
if (value["type"] === "command" && typeof value["commandWindows"] === "string")
|
|
67199
|
+
commands.push(value["commandWindows"]);
|
|
67200
|
+
for (const entry of Object.values(value))
|
|
67201
|
+
collectCommands(entry, commands);
|
|
67202
|
+
}
|
|
67203
|
+
|
|
67125
67204
|
// packages/omo-codex/src/install/codex-cache-install.ts
|
|
67126
67205
|
async function installCachedPlugin(input) {
|
|
67127
67206
|
if (input.buildSource !== false) {
|
|
67128
67207
|
await maybeRunNpmInstall(input.sourcePath, input.runCommand);
|
|
67129
67208
|
await maybeRunNpmBuild(input.sourcePath, input.runCommand);
|
|
67130
67209
|
}
|
|
67131
|
-
const targetPath =
|
|
67210
|
+
const targetPath = join31(input.codexHome, "plugins", "cache", input.marketplaceName, input.name, input.version);
|
|
67132
67211
|
const tempPath = createTempSiblingPath(targetPath);
|
|
67133
67212
|
await rm3(tempPath, { recursive: true, force: true });
|
|
67134
67213
|
try {
|
|
@@ -67138,6 +67217,7 @@ async function installCachedPlugin(input) {
|
|
|
67138
67217
|
await maybeRunNpmInstall(tempPath, input.runCommand, ["ci", "--omit=dev"]);
|
|
67139
67218
|
await rewriteCachedMcpManifest(tempPath, input.sourcePath);
|
|
67140
67219
|
await rewriteCachedManifestRoot(tempPath, tempPath, targetPath);
|
|
67220
|
+
await assertHookCommandTargets(tempPath);
|
|
67141
67221
|
await promoteDirectory(tempPath, targetPath, input.renameDirectory ?? rename);
|
|
67142
67222
|
} catch (error) {
|
|
67143
67223
|
await rm3(tempPath, { recursive: true, force: true });
|
|
@@ -67146,14 +67226,14 @@ async function installCachedPlugin(input) {
|
|
|
67146
67226
|
return { name: input.name, version: input.version, path: targetPath };
|
|
67147
67227
|
}
|
|
67148
67228
|
async function maybeRunNpmInstall(cwd, runCommand, args = ["install"]) {
|
|
67149
|
-
if (!await fileExistsStrict(
|
|
67229
|
+
if (!await fileExistsStrict(join31(cwd, "package.json")))
|
|
67150
67230
|
return;
|
|
67151
67231
|
await runCommand("npm", args, { cwd });
|
|
67152
67232
|
}
|
|
67153
67233
|
async function maybeRunNpmBuild(cwd, runCommand) {
|
|
67154
|
-
if (!await fileExistsStrict(
|
|
67234
|
+
if (!await fileExistsStrict(join31(cwd, "package.json")))
|
|
67155
67235
|
return;
|
|
67156
|
-
const packageJson = JSON.parse(await
|
|
67236
|
+
const packageJson = JSON.parse(await readFile7(join31(cwd, "package.json"), "utf8"));
|
|
67157
67237
|
if (!isPlainRecord3(packageJson))
|
|
67158
67238
|
return;
|
|
67159
67239
|
const scripts = packageJson.scripts;
|
|
@@ -67162,10 +67242,10 @@ async function maybeRunNpmBuild(cwd, runCommand) {
|
|
|
67162
67242
|
await runCommand("npm", ["run", "build"], { cwd });
|
|
67163
67243
|
}
|
|
67164
67244
|
function createTempSiblingPath(targetPath) {
|
|
67165
|
-
return
|
|
67245
|
+
return join31(dirname11(targetPath), `.tmp-${basename6(targetPath)}-${process.pid}-${Date.now()}`);
|
|
67166
67246
|
}
|
|
67167
67247
|
function createBackupSiblingPath(targetPath) {
|
|
67168
|
-
return
|
|
67248
|
+
return join31(dirname11(targetPath), `.backup-${basename6(targetPath)}-${process.pid}-${Date.now()}`);
|
|
67169
67249
|
}
|
|
67170
67250
|
async function copyDirectory(sourcePath, targetPath) {
|
|
67171
67251
|
await mkdir3(dirname11(targetPath), { recursive: true });
|
|
@@ -67196,17 +67276,17 @@ async function restoreBackupDirectory(backupPath, targetPath, renameDirectory) {
|
|
|
67196
67276
|
await renameDirectory(backupPath, targetPath);
|
|
67197
67277
|
}
|
|
67198
67278
|
function shouldCopyPluginPath(path7, root) {
|
|
67199
|
-
const relative5 = path7 === root ? "" : path7.slice(root.length +
|
|
67279
|
+
const relative5 = path7 === root ? "" : path7.slice(root.length + sep5.length);
|
|
67200
67280
|
if (relative5 === "")
|
|
67201
67281
|
return true;
|
|
67202
|
-
const parts = relative5.split(
|
|
67282
|
+
const parts = relative5.split(sep5);
|
|
67203
67283
|
return !parts.some((part) => part === ".git" || part === "node_modules");
|
|
67204
67284
|
}
|
|
67205
67285
|
// packages/omo-codex/src/install/codex-cache-prune.ts
|
|
67206
67286
|
import { lstat as lstat4, readdir as readdir3, rm as rm4, stat as stat3 } from "fs/promises";
|
|
67207
|
-
import { join as
|
|
67287
|
+
import { join as join32 } from "path";
|
|
67208
67288
|
async function pruneMarketplaceCache(input) {
|
|
67209
|
-
const cacheRoot =
|
|
67289
|
+
const cacheRoot = join32(input.codexHome, "plugins", "cache", input.marketplaceName);
|
|
67210
67290
|
if (!await fileExistsStrict(cacheRoot))
|
|
67211
67291
|
return;
|
|
67212
67292
|
const keep = new Set(input.keepPluginNames);
|
|
@@ -67214,15 +67294,15 @@ async function pruneMarketplaceCache(input) {
|
|
|
67214
67294
|
for (const entry of entries) {
|
|
67215
67295
|
if (!entry.isDirectory() || keep.has(entry.name))
|
|
67216
67296
|
continue;
|
|
67217
|
-
await rm4(
|
|
67297
|
+
await rm4(join32(cacheRoot, entry.name), { recursive: true, force: true });
|
|
67218
67298
|
}
|
|
67219
67299
|
}
|
|
67220
67300
|
async function pruneMarketplacePluginCaches(input) {
|
|
67221
|
-
const cacheRoot =
|
|
67301
|
+
const cacheRoot = join32(input.codexHome, "plugins", "cache", input.marketplaceName);
|
|
67222
67302
|
if (!await fileExistsStrict(cacheRoot))
|
|
67223
67303
|
return;
|
|
67224
67304
|
for (const pluginName of input.pluginNames) {
|
|
67225
|
-
await rm4(
|
|
67305
|
+
await rm4(join32(cacheRoot, pluginName), { recursive: true, force: true });
|
|
67226
67306
|
}
|
|
67227
67307
|
const remainingEntries = await readCacheEntryNames(cacheRoot);
|
|
67228
67308
|
if (remainingEntries.length === 0) {
|
|
@@ -67269,11 +67349,11 @@ async function isBrokenCacheSymlink(path7) {
|
|
|
67269
67349
|
}
|
|
67270
67350
|
// packages/omo-codex/src/install/codex-cached-marketplace-manifest.ts
|
|
67271
67351
|
import { mkdir as mkdir4, writeFile as writeFile4 } from "fs/promises";
|
|
67272
|
-
import { join as
|
|
67352
|
+
import { join as join33 } from "path";
|
|
67273
67353
|
async function writeCachedMarketplaceManifest(input) {
|
|
67274
|
-
const marketplaceDir =
|
|
67354
|
+
const marketplaceDir = join33(input.marketplaceRoot, ".agents", "plugins");
|
|
67275
67355
|
await mkdir4(marketplaceDir, { recursive: true });
|
|
67276
|
-
await writeFile4(
|
|
67356
|
+
await writeFile4(join33(marketplaceDir, "marketplace.json"), `${JSON.stringify({
|
|
67277
67357
|
name: input.marketplaceName,
|
|
67278
67358
|
plugins: input.plugins.map((plugin) => ({
|
|
67279
67359
|
name: plugin.name,
|
|
@@ -67285,8 +67365,8 @@ async function writeCachedMarketplaceManifest(input) {
|
|
|
67285
67365
|
|
|
67286
67366
|
// packages/omo-codex/src/install/codex-package-layout.ts
|
|
67287
67367
|
import { existsSync as existsSync26 } from "fs";
|
|
67288
|
-
import { readFile as
|
|
67289
|
-
import { join as
|
|
67368
|
+
import { readFile as readFile8 } from "fs/promises";
|
|
67369
|
+
import { join as join34 } from "path";
|
|
67290
67370
|
var PACKAGED_CODEX_INSTALLER_NAMES = new Set([
|
|
67291
67371
|
"@code-yeongyu/lazycodex",
|
|
67292
67372
|
"@code-yeongyu/lazycodex-ai",
|
|
@@ -67296,19 +67376,19 @@ var PACKAGED_CODEX_INSTALLER_NAMES = new Set([
|
|
|
67296
67376
|
"oh-my-openagent"
|
|
67297
67377
|
]);
|
|
67298
67378
|
async function shouldBuildSourcePackages(repoRoot) {
|
|
67299
|
-
if (existsSync26(
|
|
67379
|
+
if (existsSync26(join34(repoRoot, "packages", "omo-opencode", "src", "index.ts")))
|
|
67300
67380
|
return true;
|
|
67301
|
-
const packageJsonPath =
|
|
67381
|
+
const packageJsonPath = join34(repoRoot, "package.json");
|
|
67302
67382
|
if (!existsSync26(packageJsonPath))
|
|
67303
67383
|
return true;
|
|
67304
|
-
const packageJson = JSON.parse(await
|
|
67384
|
+
const packageJson = JSON.parse(await readFile8(packageJsonPath, "utf8"));
|
|
67305
67385
|
if (!isPlainRecord3(packageJson) || typeof packageJson.name !== "string")
|
|
67306
67386
|
return true;
|
|
67307
67387
|
return !PACKAGED_CODEX_INSTALLER_NAMES.has(packageJson.name);
|
|
67308
67388
|
}
|
|
67309
67389
|
|
|
67310
67390
|
// packages/omo-codex/src/install/codex-config-toml.ts
|
|
67311
|
-
import { mkdir as mkdir5, readFile as
|
|
67391
|
+
import { mkdir as mkdir5, readFile as readFile10 } from "fs/promises";
|
|
67312
67392
|
import { dirname as dirname13 } from "path";
|
|
67313
67393
|
|
|
67314
67394
|
// packages/omo-codex/src/install/toml-section-editor.ts
|
|
@@ -67496,12 +67576,12 @@ function tomlKeySegment(value) {
|
|
|
67496
67576
|
|
|
67497
67577
|
// packages/omo-codex/src/install/codex-config-atomic-write.ts
|
|
67498
67578
|
import { lstat as lstat5, readlink as readlink3, realpath, rename as rename2, unlink, writeFile as writeFile5 } from "fs/promises";
|
|
67499
|
-
import { basename as basename7, dirname as dirname12, isAbsolute as isAbsolute6, join as
|
|
67579
|
+
import { basename as basename7, dirname as dirname12, isAbsolute as isAbsolute6, join as join35, resolve as resolve11 } from "path";
|
|
67500
67580
|
var RENAME_RETRY_DELAYS_MS = [10, 25, 50];
|
|
67501
67581
|
var RETRIABLE_RENAME_CODES = new Set(["EPERM", "EBUSY"]);
|
|
67502
67582
|
async function writeFileAtomic(targetPath, data) {
|
|
67503
67583
|
const writeTarget = await resolveSymlinkTarget(targetPath);
|
|
67504
|
-
const temporaryPath =
|
|
67584
|
+
const temporaryPath = join35(dirname12(writeTarget), `.tmp-${basename7(writeTarget)}-${process.pid}-${Date.now()}`);
|
|
67505
67585
|
await writeFile5(temporaryPath, data);
|
|
67506
67586
|
try {
|
|
67507
67587
|
await renameWithRetry(temporaryPath, writeTarget);
|
|
@@ -67771,8 +67851,8 @@ function isRootSetting(line, key) {
|
|
|
67771
67851
|
}
|
|
67772
67852
|
|
|
67773
67853
|
// packages/omo-codex/src/install/codex-model-catalog.ts
|
|
67774
|
-
import { readFile as
|
|
67775
|
-
import { join as
|
|
67854
|
+
import { readFile as readFile9 } from "fs/promises";
|
|
67855
|
+
import { join as join36 } from "path";
|
|
67776
67856
|
var FALLBACK_CODEX_MODEL_CATALOG = {
|
|
67777
67857
|
current: {
|
|
67778
67858
|
model: "gpt-5.5",
|
|
@@ -67791,9 +67871,9 @@ var FALLBACK_CODEX_MODEL_CATALOG = {
|
|
|
67791
67871
|
]
|
|
67792
67872
|
};
|
|
67793
67873
|
async function readCodexModelCatalog(codexPackageRoot) {
|
|
67794
|
-
const catalogPath =
|
|
67874
|
+
const catalogPath = join36(codexPackageRoot, "plugin", "model-catalog.json");
|
|
67795
67875
|
try {
|
|
67796
|
-
const parsed = JSON.parse(await
|
|
67876
|
+
const parsed = JSON.parse(await readFile9(catalogPath, "utf8"));
|
|
67797
67877
|
return parseCodexModelCatalog(parsed) ?? FALLBACK_CODEX_MODEL_CATALOG;
|
|
67798
67878
|
} catch (error) {
|
|
67799
67879
|
if (error instanceof Error)
|
|
@@ -67874,7 +67954,7 @@ async function updateCodexConfig(input) {
|
|
|
67874
67954
|
await mkdir5(dirname13(input.configPath), { recursive: true });
|
|
67875
67955
|
let config = "";
|
|
67876
67956
|
if (await exists(input.configPath))
|
|
67877
|
-
config = await
|
|
67957
|
+
config = await readFile10(input.configPath, "utf8");
|
|
67878
67958
|
const pluginSet = new Set(input.pluginNames);
|
|
67879
67959
|
for (const legacyMarketplaceName of legacyMarketplaceNames(input.marketplaceName)) {
|
|
67880
67960
|
config = removeMarketplaceBlock(config, legacyMarketplaceName);
|
|
@@ -67910,7 +67990,7 @@ async function updateCodexConfig(input) {
|
|
|
67910
67990
|
}
|
|
67911
67991
|
async function exists(path7) {
|
|
67912
67992
|
try {
|
|
67913
|
-
await
|
|
67993
|
+
await readFile10(path7, "utf8");
|
|
67914
67994
|
return true;
|
|
67915
67995
|
} catch (error) {
|
|
67916
67996
|
if (error instanceof Error)
|
|
@@ -67921,8 +68001,8 @@ async function exists(path7) {
|
|
|
67921
68001
|
|
|
67922
68002
|
// packages/omo-codex/src/install/codex-hook-trust.ts
|
|
67923
68003
|
import { createHash as createHash2 } from "crypto";
|
|
67924
|
-
import { readFile as
|
|
67925
|
-
import { join as
|
|
68004
|
+
import { readFile as readFile11 } from "fs/promises";
|
|
68005
|
+
import { join as join37 } from "path";
|
|
67926
68006
|
var EVENT_LABELS = new Map([
|
|
67927
68007
|
["PreToolUse", "pre_tool_use"],
|
|
67928
68008
|
["PermissionRequest", "permission_request"],
|
|
@@ -67936,21 +68016,37 @@ var EVENT_LABELS = new Map([
|
|
|
67936
68016
|
["Stop", "stop"]
|
|
67937
68017
|
]);
|
|
67938
68018
|
async function trustedHookStatesForPlugin(input) {
|
|
67939
|
-
const manifestPath =
|
|
68019
|
+
const manifestPath = join37(input.pluginRoot, ".codex-plugin", "plugin.json");
|
|
67940
68020
|
if (!await exists2(manifestPath))
|
|
67941
68021
|
return [];
|
|
67942
|
-
const manifest = JSON.parse(await
|
|
67943
|
-
if (!isPlainRecord3(manifest)
|
|
68022
|
+
const manifest = JSON.parse(await readFile11(manifestPath, "utf8"));
|
|
68023
|
+
if (!isPlainRecord3(manifest))
|
|
67944
68024
|
return [];
|
|
67945
|
-
const
|
|
67946
|
-
|
|
67947
|
-
|
|
67948
|
-
|
|
67949
|
-
|
|
68025
|
+
const states = [];
|
|
68026
|
+
for (const hookPath of hookManifestPaths2(manifest.hooks)) {
|
|
68027
|
+
const hooksPath = join37(input.pluginRoot, hookPath);
|
|
68028
|
+
if (!await exists2(hooksPath))
|
|
68029
|
+
continue;
|
|
68030
|
+
const parsed = JSON.parse(await readFile11(hooksPath, "utf8"));
|
|
68031
|
+
if (!isPlainRecord3(parsed) || !isPlainRecord3(parsed.hooks))
|
|
68032
|
+
continue;
|
|
68033
|
+
states.push(...trustedHookStatesForHooksFile({
|
|
68034
|
+
keySource: `${input.pluginName}@${input.marketplaceName}:${hookPath}`,
|
|
68035
|
+
hooks: parsed.hooks
|
|
68036
|
+
}));
|
|
68037
|
+
}
|
|
68038
|
+
return states;
|
|
68039
|
+
}
|
|
68040
|
+
function hookManifestPaths2(value) {
|
|
68041
|
+
if (typeof value === "string" && value.trim() !== "")
|
|
68042
|
+
return [stripDotSlash2(value)];
|
|
68043
|
+
if (!Array.isArray(value))
|
|
67950
68044
|
return [];
|
|
67951
|
-
|
|
68045
|
+
return value.filter((item) => typeof item === "string" && item.trim() !== "").map(stripDotSlash2);
|
|
68046
|
+
}
|
|
68047
|
+
function trustedHookStatesForHooksFile(input) {
|
|
67952
68048
|
const states = [];
|
|
67953
|
-
for (const [eventName, groups] of Object.entries(
|
|
68049
|
+
for (const [eventName, groups] of Object.entries(input.hooks)) {
|
|
67954
68050
|
if (!Array.isArray(groups))
|
|
67955
68051
|
continue;
|
|
67956
68052
|
const eventLabel = EVENT_LABELS.get(eventName);
|
|
@@ -67966,7 +68062,7 @@ async function trustedHookStatesForPlugin(input) {
|
|
|
67966
68062
|
continue;
|
|
67967
68063
|
if (typeof handler.command !== "string" || handler.command.trim() === "")
|
|
67968
68064
|
continue;
|
|
67969
|
-
const key = `${keySource}:${eventLabel}:${groupIndex}:${handlerIndex}`;
|
|
68065
|
+
const key = `${input.keySource}:${eventLabel}:${groupIndex}:${handlerIndex}`;
|
|
67970
68066
|
states.push({ key, trustedHash: commandHookHash(eventLabel, group.matcher, handler) });
|
|
67971
68067
|
}
|
|
67972
68068
|
}
|
|
@@ -68000,12 +68096,12 @@ function canonicalJson(value) {
|
|
|
68000
68096
|
}
|
|
68001
68097
|
return result;
|
|
68002
68098
|
}
|
|
68003
|
-
function
|
|
68099
|
+
function stripDotSlash2(value) {
|
|
68004
68100
|
return value.startsWith("./") ? value.slice(2) : value;
|
|
68005
68101
|
}
|
|
68006
68102
|
async function exists2(path7) {
|
|
68007
68103
|
try {
|
|
68008
|
-
await
|
|
68104
|
+
await readFile11(path7, "utf8");
|
|
68009
68105
|
return true;
|
|
68010
68106
|
} catch (error) {
|
|
68011
68107
|
if (error instanceof Error)
|
|
@@ -68057,12 +68153,12 @@ function toCodexResolution(resolution) {
|
|
|
68057
68153
|
}
|
|
68058
68154
|
|
|
68059
68155
|
// packages/omo-codex/src/install/link-cached-plugin-agents.ts
|
|
68060
|
-
import { copyFile, lstat as lstat7, mkdir as mkdir6, readFile as
|
|
68061
|
-
import { basename as basename8, join as
|
|
68156
|
+
import { copyFile, lstat as lstat7, mkdir as mkdir6, readFile as readFile13, readdir as readdir4, rm as rm6, writeFile as writeFile6 } from "fs/promises";
|
|
68157
|
+
import { basename as basename8, join as join39 } from "path";
|
|
68062
68158
|
|
|
68063
68159
|
// packages/omo-codex/src/install/retired-managed-agent-purge.ts
|
|
68064
|
-
import { lstat as lstat6, readFile as
|
|
68065
|
-
import { join as
|
|
68160
|
+
import { lstat as lstat6, readFile as readFile12, rm as rm5 } from "fs/promises";
|
|
68161
|
+
import { join as join38 } from "path";
|
|
68066
68162
|
var RETIRED_MANAGED_AGENT_FILES = [
|
|
68067
68163
|
{
|
|
68068
68164
|
fileName: "codex-ultrawork-reviewer.toml",
|
|
@@ -68074,11 +68170,11 @@ var RETIRED_MANAGED_AGENT_FILES = [
|
|
|
68074
68170
|
}
|
|
68075
68171
|
];
|
|
68076
68172
|
async function purgeRetiredManagedAgentFiles(input) {
|
|
68077
|
-
const agentsDir =
|
|
68173
|
+
const agentsDir = join38(input.codexHome, "agents");
|
|
68078
68174
|
if (!await exists3(agentsDir))
|
|
68079
68175
|
return;
|
|
68080
68176
|
for (const retiredAgent of RETIRED_MANAGED_AGENT_FILES) {
|
|
68081
|
-
const agentPath =
|
|
68177
|
+
const agentPath = join38(agentsDir, retiredAgent.fileName);
|
|
68082
68178
|
if (!await exists3(agentPath))
|
|
68083
68179
|
continue;
|
|
68084
68180
|
const agentStat = await lstat6(agentPath);
|
|
@@ -68095,7 +68191,7 @@ function hasRequiredMarkers(content, markers) {
|
|
|
68095
68191
|
}
|
|
68096
68192
|
async function readTextIfExists(path7) {
|
|
68097
68193
|
try {
|
|
68098
|
-
return await
|
|
68194
|
+
return await readFile12(path7, "utf8");
|
|
68099
68195
|
} catch (error) {
|
|
68100
68196
|
if (nodeErrorCode(error) === "ENOENT")
|
|
68101
68197
|
return null;
|
|
@@ -68121,7 +68217,7 @@ function nodeErrorCode(error) {
|
|
|
68121
68217
|
// packages/omo-codex/src/install/link-cached-plugin-agents.ts
|
|
68122
68218
|
var MANIFEST_FILE = ".installed-agents.json";
|
|
68123
68219
|
async function capturePreservedAgentReasoning(input) {
|
|
68124
|
-
const agentsDir =
|
|
68220
|
+
const agentsDir = join39(input.codexHome, "agents");
|
|
68125
68221
|
if (!await exists4(agentsDir))
|
|
68126
68222
|
return new Map;
|
|
68127
68223
|
const preserved = new Map;
|
|
@@ -68129,7 +68225,7 @@ async function capturePreservedAgentReasoning(input) {
|
|
|
68129
68225
|
for (const entry of agentEntries) {
|
|
68130
68226
|
if (!entry.name.endsWith(".toml"))
|
|
68131
68227
|
continue;
|
|
68132
|
-
const content = await readTextIfExists2(
|
|
68228
|
+
const content = await readTextIfExists2(join39(agentsDir, entry.name));
|
|
68133
68229
|
if (content === null)
|
|
68134
68230
|
continue;
|
|
68135
68231
|
const effort = extractReasoningEffort(content);
|
|
@@ -68139,7 +68235,7 @@ async function capturePreservedAgentReasoning(input) {
|
|
|
68139
68235
|
return preserved;
|
|
68140
68236
|
}
|
|
68141
68237
|
async function capturePreservedAgentServiceTier(input) {
|
|
68142
|
-
const agentsDir =
|
|
68238
|
+
const agentsDir = join39(input.codexHome, "agents");
|
|
68143
68239
|
if (!await exists4(agentsDir))
|
|
68144
68240
|
return new Map;
|
|
68145
68241
|
const preserved = new Map;
|
|
@@ -68147,7 +68243,7 @@ async function capturePreservedAgentServiceTier(input) {
|
|
|
68147
68243
|
for (const entry of agentEntries) {
|
|
68148
68244
|
if (!entry.name.endsWith(".toml"))
|
|
68149
68245
|
continue;
|
|
68150
|
-
const content = await readTextIfExists2(
|
|
68246
|
+
const content = await readTextIfExists2(join39(agentsDir, entry.name));
|
|
68151
68247
|
if (content === null)
|
|
68152
68248
|
continue;
|
|
68153
68249
|
preserved.set(agentNameFromToml(entry.name), extractServiceTier(content));
|
|
@@ -68161,13 +68257,13 @@ async function linkCachedPluginAgents(input) {
|
|
|
68161
68257
|
await writeManifest(input.pluginRoot, []);
|
|
68162
68258
|
return [];
|
|
68163
68259
|
}
|
|
68164
|
-
const agentsDir =
|
|
68260
|
+
const agentsDir = join39(input.codexHome, "agents");
|
|
68165
68261
|
await mkdir6(agentsDir, { recursive: true });
|
|
68166
68262
|
const linked = [];
|
|
68167
68263
|
for (const agentPath of bundledAgents) {
|
|
68168
68264
|
const agentFileName = basename8(agentPath);
|
|
68169
68265
|
const agentName = agentNameFromToml(agentFileName);
|
|
68170
|
-
const linkPath =
|
|
68266
|
+
const linkPath = join39(agentsDir, agentFileName);
|
|
68171
68267
|
await replaceWithCopy(linkPath, agentPath);
|
|
68172
68268
|
await restorePreservedReasoning({
|
|
68173
68269
|
agentName,
|
|
@@ -68188,7 +68284,7 @@ async function linkCachedPluginAgents(input) {
|
|
|
68188
68284
|
async function restorePreservedServiceTier(input) {
|
|
68189
68285
|
if (!input.preserved)
|
|
68190
68286
|
return;
|
|
68191
|
-
const content = await
|
|
68287
|
+
const content = await readFile13(input.linkPath, "utf8");
|
|
68192
68288
|
if (extractServiceTier(content) === input.value)
|
|
68193
68289
|
return;
|
|
68194
68290
|
const replacement = replaceServiceTier(content, input.value);
|
|
@@ -68197,7 +68293,7 @@ async function restorePreservedServiceTier(input) {
|
|
|
68197
68293
|
await writeFile6(input.linkPath, replacement.content);
|
|
68198
68294
|
}
|
|
68199
68295
|
async function discoverBundledAgents(pluginRoot) {
|
|
68200
|
-
const componentsRoot =
|
|
68296
|
+
const componentsRoot = join39(pluginRoot, "components");
|
|
68201
68297
|
if (!await exists4(componentsRoot))
|
|
68202
68298
|
return [];
|
|
68203
68299
|
const componentEntries = await readdir4(componentsRoot, { withFileTypes: true });
|
|
@@ -68205,14 +68301,14 @@ async function discoverBundledAgents(pluginRoot) {
|
|
|
68205
68301
|
for (const entry of componentEntries) {
|
|
68206
68302
|
if (!entry.isDirectory())
|
|
68207
68303
|
continue;
|
|
68208
|
-
const agentsRoot =
|
|
68304
|
+
const agentsRoot = join39(componentsRoot, entry.name, "agents");
|
|
68209
68305
|
if (!await exists4(agentsRoot))
|
|
68210
68306
|
continue;
|
|
68211
68307
|
const agentEntries = await readdir4(agentsRoot, { withFileTypes: true });
|
|
68212
68308
|
for (const file2 of agentEntries) {
|
|
68213
68309
|
if (!file2.isFile() || !file2.name.endsWith(".toml"))
|
|
68214
68310
|
continue;
|
|
68215
|
-
agents.push(
|
|
68311
|
+
agents.push(join39(agentsRoot, file2.name));
|
|
68216
68312
|
}
|
|
68217
68313
|
}
|
|
68218
68314
|
agents.sort();
|
|
@@ -68232,7 +68328,7 @@ async function prepareReplacement(linkPath) {
|
|
|
68232
68328
|
await rm6(linkPath, { force: true });
|
|
68233
68329
|
}
|
|
68234
68330
|
async function writeManifest(pluginRoot, agentPaths) {
|
|
68235
|
-
const manifestPath =
|
|
68331
|
+
const manifestPath = join39(pluginRoot, MANIFEST_FILE);
|
|
68236
68332
|
const payload = { agents: [...agentPaths].sort() };
|
|
68237
68333
|
await writeFile6(manifestPath, `${JSON.stringify(payload, null, "\t")}
|
|
68238
68334
|
`);
|
|
@@ -68240,7 +68336,7 @@ async function writeManifest(pluginRoot, agentPaths) {
|
|
|
68240
68336
|
async function restorePreservedReasoning(input) {
|
|
68241
68337
|
if (input.value === undefined)
|
|
68242
68338
|
return;
|
|
68243
|
-
const content = await
|
|
68339
|
+
const content = await readFile13(input.target, "utf8");
|
|
68244
68340
|
const bundledEffort = extractReasoningEffort(content);
|
|
68245
68341
|
if (bundledEffort === input.value)
|
|
68246
68342
|
return;
|
|
@@ -68251,7 +68347,7 @@ async function restorePreservedReasoning(input) {
|
|
|
68251
68347
|
}
|
|
68252
68348
|
async function readTextIfExists2(path7) {
|
|
68253
68349
|
try {
|
|
68254
|
-
return await
|
|
68350
|
+
return await readFile13(path7, "utf8");
|
|
68255
68351
|
} catch (error) {
|
|
68256
68352
|
if (nodeErrorCode2(error) === "ENOENT")
|
|
68257
68353
|
return null;
|
|
@@ -68359,12 +68455,12 @@ function nodeErrorCode2(error) {
|
|
|
68359
68455
|
}
|
|
68360
68456
|
|
|
68361
68457
|
// packages/omo-codex/src/install/codex-marketplace.ts
|
|
68362
|
-
import { readFile as
|
|
68363
|
-
import { join as
|
|
68458
|
+
import { readFile as readFile14 } from "fs/promises";
|
|
68459
|
+
import { join as join40 } from "path";
|
|
68364
68460
|
var DEFAULT_MARKETPLACE_PATH = "packages/omo-codex/marketplace.json";
|
|
68365
68461
|
async function readMarketplace(repoRoot, options) {
|
|
68366
|
-
const marketplacePath = options?.marketplacePath ??
|
|
68367
|
-
const raw = await
|
|
68462
|
+
const marketplacePath = options?.marketplacePath ?? join40(repoRoot, DEFAULT_MARKETPLACE_PATH);
|
|
68463
|
+
const raw = await readFile14(marketplacePath, "utf8");
|
|
68368
68464
|
const parsed = JSON.parse(raw);
|
|
68369
68465
|
if (!isPlainRecord3(parsed))
|
|
68370
68466
|
throw new Error("marketplace.json must be an object");
|
|
@@ -68382,10 +68478,10 @@ async function readMarketplace(repoRoot, options) {
|
|
|
68382
68478
|
function resolvePluginSource(repoRoot, plugin, options) {
|
|
68383
68479
|
const sourcePath = localSourcePath(options?.pathOverride ?? plugin.source);
|
|
68384
68480
|
const relativePath = sourcePath.slice(2);
|
|
68385
|
-
return
|
|
68481
|
+
return join40(repoRoot, ...relativePath.split(/[\\/]/));
|
|
68386
68482
|
}
|
|
68387
68483
|
async function readPluginManifest(pluginRoot) {
|
|
68388
|
-
const raw = await
|
|
68484
|
+
const raw = await readFile14(join40(pluginRoot, ".codex-plugin", "plugin.json"), "utf8");
|
|
68389
68485
|
const parsed = JSON.parse(raw);
|
|
68390
68486
|
if (!isPlainRecord3(parsed))
|
|
68391
68487
|
throw new Error(`${pluginRoot} plugin.json must be an object`);
|
|
@@ -68395,15 +68491,27 @@ async function readPluginManifest(pluginRoot) {
|
|
|
68395
68491
|
if (parsed.version !== undefined && (typeof parsed.version !== "string" || parsed.version.trim() === "")) {
|
|
68396
68492
|
throw new Error(`${pluginRoot} plugin.json version must be a non-empty string`);
|
|
68397
68493
|
}
|
|
68398
|
-
if (parsed.hooks !== undefined && (
|
|
68399
|
-
throw new Error(`${pluginRoot} plugin.json hooks must be a non-empty string`);
|
|
68494
|
+
if (parsed.hooks !== undefined && !isPluginHooksManifestValue(parsed.hooks)) {
|
|
68495
|
+
throw new Error(`${pluginRoot} plugin.json hooks must be a non-empty string or string array`);
|
|
68400
68496
|
}
|
|
68401
68497
|
return {
|
|
68402
68498
|
name: parsed.name,
|
|
68403
68499
|
version: typeof parsed.version === "string" ? parsed.version.trim() : undefined,
|
|
68404
|
-
hooks:
|
|
68500
|
+
hooks: normalizePluginHooksManifestValue(parsed.hooks)
|
|
68405
68501
|
};
|
|
68406
68502
|
}
|
|
68503
|
+
function isPluginHooksManifestValue(value) {
|
|
68504
|
+
if (typeof value === "string")
|
|
68505
|
+
return value.trim() !== "";
|
|
68506
|
+
return Array.isArray(value) && value.every((item) => typeof item === "string" && item.trim() !== "");
|
|
68507
|
+
}
|
|
68508
|
+
function normalizePluginHooksManifestValue(value) {
|
|
68509
|
+
if (typeof value === "string")
|
|
68510
|
+
return value.trim();
|
|
68511
|
+
if (Array.isArray(value))
|
|
68512
|
+
return value.map((item) => item.trim());
|
|
68513
|
+
return;
|
|
68514
|
+
}
|
|
68407
68515
|
function validatePathSegment(value, label) {
|
|
68408
68516
|
if (!/^[A-Za-z0-9._+-]+$/.test(value)) {
|
|
68409
68517
|
throw new Error(`${label} contains unsupported characters: ${value}`);
|
|
@@ -68455,7 +68563,7 @@ function validateLocalSourcePath(path7) {
|
|
|
68455
68563
|
|
|
68456
68564
|
// packages/omo-codex/src/install/codex-marketplace-snapshot.ts
|
|
68457
68565
|
import { cp as cp3, mkdir as mkdir7, rename as rename3, rm as rm7, writeFile as writeFile7 } from "fs/promises";
|
|
68458
|
-
import { join as
|
|
68566
|
+
import { join as join41, sep as sep6 } from "path";
|
|
68459
68567
|
var INSTALLED_MARKETPLACES_DIR = ".tmp/marketplaces";
|
|
68460
68568
|
async function writeInstalledMarketplaceSnapshot(input) {
|
|
68461
68569
|
const marketplaceRoot = installedMarketplaceRoot(input.codexHome, input.marketplace.name);
|
|
@@ -68468,21 +68576,21 @@ async function writeInstalledMarketplaceSnapshot(input) {
|
|
|
68468
68576
|
return snapshotPlugins;
|
|
68469
68577
|
}
|
|
68470
68578
|
function installedMarketplaceRoot(codexHome, marketplaceName) {
|
|
68471
|
-
return
|
|
68579
|
+
return join41(codexHome, INSTALLED_MARKETPLACES_DIR, marketplaceName);
|
|
68472
68580
|
}
|
|
68473
68581
|
async function writeMarketplaceManifest(marketplaceRoot, marketplace) {
|
|
68474
|
-
const manifestDir =
|
|
68582
|
+
const manifestDir = join41(marketplaceRoot, ".agents", "plugins");
|
|
68475
68583
|
await mkdir7(manifestDir, { recursive: true });
|
|
68476
|
-
const tempPath =
|
|
68584
|
+
const tempPath = join41(manifestDir, `.marketplace-${process.pid}-${Date.now()}.json.tmp`);
|
|
68477
68585
|
await writeFile7(tempPath, `${JSON.stringify(marketplace, null, "\t")}
|
|
68478
68586
|
`);
|
|
68479
|
-
await rename3(tempPath,
|
|
68587
|
+
await rename3(tempPath, join41(manifestDir, "marketplace.json"));
|
|
68480
68588
|
}
|
|
68481
68589
|
async function writeSnapshotPlugin(marketplaceRoot, plugin) {
|
|
68482
|
-
const pluginsDir =
|
|
68590
|
+
const pluginsDir = join41(marketplaceRoot, "plugins");
|
|
68483
68591
|
await mkdir7(pluginsDir, { recursive: true });
|
|
68484
|
-
const targetPath =
|
|
68485
|
-
const tempPath =
|
|
68592
|
+
const targetPath = join41(pluginsDir, plugin.name);
|
|
68593
|
+
const tempPath = join41(pluginsDir, `.tmp-${plugin.name}-${process.pid}-${Date.now()}`);
|
|
68486
68594
|
await rm7(tempPath, { recursive: true, force: true });
|
|
68487
68595
|
await cp3(plugin.sourcePath, tempPath, {
|
|
68488
68596
|
recursive: true,
|
|
@@ -68495,19 +68603,19 @@ async function writeSnapshotPlugin(marketplaceRoot, plugin) {
|
|
|
68495
68603
|
return { name: plugin.name, path: targetPath };
|
|
68496
68604
|
}
|
|
68497
68605
|
function shouldCopyMarketplaceSourcePath(path7, root) {
|
|
68498
|
-
const relative5 = path7 === root ? "" : path7.slice(root.length +
|
|
68606
|
+
const relative5 = path7 === root ? "" : path7.slice(root.length + sep6.length);
|
|
68499
68607
|
if (relative5 === "")
|
|
68500
68608
|
return true;
|
|
68501
|
-
const parts = relative5.split(
|
|
68609
|
+
const parts = relative5.split(sep6);
|
|
68502
68610
|
return !parts.some((part) => part === ".git" || part === "node_modules");
|
|
68503
68611
|
}
|
|
68504
68612
|
|
|
68505
68613
|
// packages/omo-codex/src/install/lazycodex-version-stamp.ts
|
|
68506
|
-
import { readdir as readdir5, readFile as
|
|
68507
|
-
import { join as
|
|
68614
|
+
import { readdir as readdir5, readFile as readFile15, writeFile as writeFile8 } from "fs/promises";
|
|
68615
|
+
import { join as join42 } from "path";
|
|
68508
68616
|
async function readDistributionManifest(repoRoot) {
|
|
68509
68617
|
try {
|
|
68510
|
-
const parsed = JSON.parse(await
|
|
68618
|
+
const parsed = JSON.parse(await readFile15(join42(repoRoot, "package.json"), "utf8"));
|
|
68511
68619
|
if (!isPlainRecord3(parsed) || typeof parsed.version !== "string" || parsed.version.trim().length === 0)
|
|
68512
68620
|
return;
|
|
68513
68621
|
return {
|
|
@@ -68527,15 +68635,19 @@ function resolveLazyCodexPluginVersion(input) {
|
|
|
68527
68635
|
return input.manifestVersion ?? "local";
|
|
68528
68636
|
}
|
|
68529
68637
|
async function stampLazyCodexPluginVersion(input) {
|
|
68530
|
-
|
|
68531
|
-
await
|
|
68532
|
-
await
|
|
68638
|
+
const manifestPath = join42(input.pluginRoot, ".codex-plugin", "plugin.json");
|
|
68639
|
+
const hookPaths = await readPluginHookPaths(manifestPath);
|
|
68640
|
+
await stampJsonVersion(manifestPath, input.version);
|
|
68641
|
+
await stampJsonVersion(join42(input.pluginRoot, "package.json"), input.version);
|
|
68642
|
+
for (const hookPath of hookPaths) {
|
|
68643
|
+
await stampHookStatusMessages(join42(input.pluginRoot, hookPath), input.version);
|
|
68644
|
+
}
|
|
68533
68645
|
await stampComponentVersions(input);
|
|
68534
68646
|
}
|
|
68535
68647
|
async function writeLazyCodexInstallSnapshot(input) {
|
|
68536
68648
|
if (input.distributionManifest === undefined)
|
|
68537
68649
|
return;
|
|
68538
|
-
await writeFile8(
|
|
68650
|
+
await writeFile8(join42(input.pluginRoot, "lazycodex-install.json"), `${JSON.stringify({
|
|
68539
68651
|
packageName: input.distributionManifest.name,
|
|
68540
68652
|
version: input.distributionManifest.version
|
|
68541
68653
|
}, null, "\t")}
|
|
@@ -68543,7 +68655,7 @@ async function writeLazyCodexInstallSnapshot(input) {
|
|
|
68543
68655
|
}
|
|
68544
68656
|
async function stampJsonVersion(path7, version) {
|
|
68545
68657
|
try {
|
|
68546
|
-
const parsed = JSON.parse(await
|
|
68658
|
+
const parsed = JSON.parse(await readFile15(path7, "utf8"));
|
|
68547
68659
|
if (!isPlainRecord3(parsed))
|
|
68548
68660
|
return;
|
|
68549
68661
|
parsed.version = version;
|
|
@@ -68555,9 +68667,29 @@ async function stampJsonVersion(path7, version) {
|
|
|
68555
68667
|
throw error;
|
|
68556
68668
|
}
|
|
68557
68669
|
}
|
|
68670
|
+
async function readPluginHookPaths(manifestPath) {
|
|
68671
|
+
try {
|
|
68672
|
+
const parsed = JSON.parse(await readFile15(manifestPath, "utf8"));
|
|
68673
|
+
if (!isPlainRecord3(parsed))
|
|
68674
|
+
return [];
|
|
68675
|
+
if (typeof parsed.hooks === "string" && parsed.hooks.trim().length > 0)
|
|
68676
|
+
return [stripDotSlash3(parsed.hooks)];
|
|
68677
|
+
if (Array.isArray(parsed.hooks)) {
|
|
68678
|
+
return parsed.hooks.filter((hookPath) => typeof hookPath === "string" && hookPath.trim().length > 0).map(stripDotSlash3);
|
|
68679
|
+
}
|
|
68680
|
+
return [];
|
|
68681
|
+
} catch (error) {
|
|
68682
|
+
if (error instanceof Error)
|
|
68683
|
+
return [];
|
|
68684
|
+
throw error;
|
|
68685
|
+
}
|
|
68686
|
+
}
|
|
68687
|
+
function stripDotSlash3(path7) {
|
|
68688
|
+
return path7.startsWith("./") ? path7.slice(2) : path7;
|
|
68689
|
+
}
|
|
68558
68690
|
async function stampHookStatusMessages(path7, version) {
|
|
68559
68691
|
try {
|
|
68560
|
-
const parsed = JSON.parse(await
|
|
68692
|
+
const parsed = JSON.parse(await readFile15(path7, "utf8"));
|
|
68561
68693
|
if (!isPlainRecord3(parsed))
|
|
68562
68694
|
return;
|
|
68563
68695
|
stampHookGroups(parsed.hooks, version);
|
|
@@ -68572,16 +68704,16 @@ async function stampHookStatusMessages(path7, version) {
|
|
|
68572
68704
|
async function stampComponentVersions(input) {
|
|
68573
68705
|
let entries;
|
|
68574
68706
|
try {
|
|
68575
|
-
entries = await readdir5(
|
|
68707
|
+
entries = await readdir5(join42(input.pluginRoot, "components"));
|
|
68576
68708
|
} catch (error) {
|
|
68577
68709
|
if (error instanceof Error)
|
|
68578
68710
|
return;
|
|
68579
68711
|
throw error;
|
|
68580
68712
|
}
|
|
68581
68713
|
for (const entry of entries) {
|
|
68582
|
-
const componentRoot =
|
|
68583
|
-
await stampJsonVersion(
|
|
68584
|
-
await stampHookStatusMessages(
|
|
68714
|
+
const componentRoot = join42(input.pluginRoot, "components", entry);
|
|
68715
|
+
await stampJsonVersion(join42(componentRoot, "package.json"), input.version);
|
|
68716
|
+
await stampHookStatusMessages(join42(componentRoot, "hooks", "hooks.json"), input.version);
|
|
68585
68717
|
}
|
|
68586
68718
|
}
|
|
68587
68719
|
function stampHookGroups(hooks, version) {
|
|
@@ -68602,7 +68734,7 @@ function stampHookGroups(hooks, version) {
|
|
|
68602
68734
|
function stampHookStatusMessage(hook, version) {
|
|
68603
68735
|
if (!isPlainRecord3(hook) || typeof hook.statusMessage !== "string")
|
|
68604
68736
|
return;
|
|
68605
|
-
hook.statusMessage = hook.statusMessage.replace(/^LazyCodex\([^)]+\)
|
|
68737
|
+
hook.statusMessage = hook.statusMessage.replace(/^LazyCodex\([^)]+\):\s*/, "(OmO) ");
|
|
68606
68738
|
}
|
|
68607
68739
|
|
|
68608
68740
|
// packages/omo-codex/src/install/codex-process.ts
|
|
@@ -68634,8 +68766,8 @@ var defaultRunCommand = async (command, args, options) => {
|
|
|
68634
68766
|
};
|
|
68635
68767
|
|
|
68636
68768
|
// packages/omo-codex/src/install/codex-project-local-cleanup.ts
|
|
68637
|
-
import { copyFile as copyFile2, lstat as lstat8, readFile as
|
|
68638
|
-
import { dirname as dirname14, join as
|
|
68769
|
+
import { copyFile as copyFile2, lstat as lstat8, readFile as readFile16, writeFile as writeFile9 } from "fs/promises";
|
|
68770
|
+
import { dirname as dirname14, join as join43, resolve as resolve12 } from "path";
|
|
68639
68771
|
var LEGACY_AGENT_CONFLICT_KEYS = ["max_threads"];
|
|
68640
68772
|
var PROJECT_LOCAL_ARTIFACT_PATHS = [
|
|
68641
68773
|
".codex/hooks.json",
|
|
@@ -68654,7 +68786,7 @@ async function repairNearestProjectLocalCodexArtifacts(input) {
|
|
|
68654
68786
|
const artifacts = await collectProjectLocalArtifacts(project.artifactRoots);
|
|
68655
68787
|
const configs = [];
|
|
68656
68788
|
for (const configPath of project.configPaths) {
|
|
68657
|
-
const original = await
|
|
68789
|
+
const original = await readFile16(configPath, "utf8");
|
|
68658
68790
|
const repair = repairProjectLocalCodexConfigText(original);
|
|
68659
68791
|
if (!repair.changed) {
|
|
68660
68792
|
configs.push({
|
|
@@ -68738,17 +68870,17 @@ async function findProjectLocalCodexConfigs(startDirectory, codexHome) {
|
|
|
68738
68870
|
if (startDirectoryStat !== null && !startDirectoryStat.isDirectory()) {
|
|
68739
68871
|
throw new ProjectLocalCleanupStartDirectoryError(startDirectory);
|
|
68740
68872
|
}
|
|
68741
|
-
const codexHomeConfigPath = codexHome === undefined ? null :
|
|
68873
|
+
const codexHomeConfigPath = codexHome === undefined ? null : join43(resolve12(codexHome), "config.toml");
|
|
68742
68874
|
let current = resolve12(startDirectory);
|
|
68743
68875
|
const configPathsFromCwd = [];
|
|
68744
68876
|
while (true) {
|
|
68745
|
-
const configPath =
|
|
68877
|
+
const configPath = join43(current, ".codex", "config.toml");
|
|
68746
68878
|
if (await isRegularProjectLocalConfig(current, configPath)) {
|
|
68747
68879
|
if (codexHomeConfigPath === null || resolve12(configPath) !== codexHomeConfigPath) {
|
|
68748
68880
|
configPathsFromCwd.push(configPath);
|
|
68749
68881
|
}
|
|
68750
68882
|
}
|
|
68751
|
-
if (await exists5(
|
|
68883
|
+
if (await exists5(join43(current, ".git"))) {
|
|
68752
68884
|
return configPathsFromCwd.length === 0 ? null : {
|
|
68753
68885
|
projectRoot: current,
|
|
68754
68886
|
configPaths: [...configPathsFromCwd].reverse(),
|
|
@@ -68768,7 +68900,7 @@ async function findProjectLocalCodexConfigs(startDirectory, codexHome) {
|
|
|
68768
68900
|
}
|
|
68769
68901
|
}
|
|
68770
68902
|
async function isRegularProjectLocalConfig(directory, configPath) {
|
|
68771
|
-
const codexDirStat = await maybeLstat(
|
|
68903
|
+
const codexDirStat = await maybeLstat(join43(directory, ".codex"));
|
|
68772
68904
|
if (codexDirStat === null || !codexDirStat.isDirectory() || codexDirStat.isSymbolicLink())
|
|
68773
68905
|
return false;
|
|
68774
68906
|
const configStat = await maybeLstat(configPath);
|
|
@@ -68788,7 +68920,7 @@ async function collectProjectLocalArtifacts(projectRoots) {
|
|
|
68788
68920
|
const seenPaths = new Set;
|
|
68789
68921
|
for (const projectRoot of projectRoots) {
|
|
68790
68922
|
for (const relativePath of PROJECT_LOCAL_ARTIFACT_PATHS) {
|
|
68791
|
-
const artifactPath =
|
|
68923
|
+
const artifactPath = join43(projectRoot, relativePath);
|
|
68792
68924
|
if (seenPaths.has(artifactPath))
|
|
68793
68925
|
continue;
|
|
68794
68926
|
const entryStat = await maybeLstat(artifactPath);
|
|
@@ -68863,13 +68995,13 @@ function formatUnknownError(error) {
|
|
|
68863
68995
|
}
|
|
68864
68996
|
|
|
68865
68997
|
// packages/omo-codex/src/install/lsp-daemon-reaper.ts
|
|
68866
|
-
import { readFile as
|
|
68998
|
+
import { readFile as readFile17, readdir as readdir6, rm as rm8 } from "fs/promises";
|
|
68867
68999
|
import { connect } from "net";
|
|
68868
|
-
import { join as
|
|
69000
|
+
import { join as join44 } from "path";
|
|
68869
69001
|
async function reapLspDaemons(codexHome, deps = {}) {
|
|
68870
69002
|
const killProcess = deps.killProcess ?? sendSigterm;
|
|
68871
69003
|
const isDaemonLive = deps.isDaemonLive ?? probeSocketLive;
|
|
68872
|
-
const daemonRoot =
|
|
69004
|
+
const daemonRoot = join44(codexHome, "codex-lsp", "daemon");
|
|
68873
69005
|
const reaped = [];
|
|
68874
69006
|
let entries;
|
|
68875
69007
|
try {
|
|
@@ -68878,9 +69010,9 @@ async function reapLspDaemons(codexHome, deps = {}) {
|
|
|
68878
69010
|
return reaped;
|
|
68879
69011
|
}
|
|
68880
69012
|
for (const entry of entries) {
|
|
68881
|
-
const versionDir =
|
|
68882
|
-
const pid = await readPidFile(
|
|
68883
|
-
const socketPath = await readEndpointFile(
|
|
69013
|
+
const versionDir = join44(daemonRoot, entry);
|
|
69014
|
+
const pid = await readPidFile(join44(versionDir, "daemon.pid"));
|
|
69015
|
+
const socketPath = await readEndpointFile(join44(versionDir, "daemon.endpoint"));
|
|
68884
69016
|
if (pid !== null && socketPath !== null && await isDaemonLive(socketPath) && killProcess(pid)) {
|
|
68885
69017
|
reaped.push(pid);
|
|
68886
69018
|
}
|
|
@@ -68890,7 +69022,7 @@ async function reapLspDaemons(codexHome, deps = {}) {
|
|
|
68890
69022
|
}
|
|
68891
69023
|
async function readEndpointFile(path7) {
|
|
68892
69024
|
try {
|
|
68893
|
-
const content = (await
|
|
69025
|
+
const content = (await readFile17(path7, "utf8")).trim();
|
|
68894
69026
|
return content.length > 0 ? content : null;
|
|
68895
69027
|
} catch {
|
|
68896
69028
|
return null;
|
|
@@ -68898,7 +69030,7 @@ async function readEndpointFile(path7) {
|
|
|
68898
69030
|
}
|
|
68899
69031
|
async function readPidFile(path7) {
|
|
68900
69032
|
try {
|
|
68901
|
-
const pid = Number.parseInt((await
|
|
69033
|
+
const pid = Number.parseInt((await readFile17(path7, "utf8")).trim(), 10);
|
|
68902
69034
|
return Number.isInteger(pid) && pid > 0 ? pid : null;
|
|
68903
69035
|
} catch {
|
|
68904
69036
|
return null;
|
|
@@ -68934,7 +69066,7 @@ function sendSigterm(pid) {
|
|
|
68934
69066
|
|
|
68935
69067
|
// packages/omo-codex/src/install/codex-installer-bin-dir.ts
|
|
68936
69068
|
import { homedir as homedir5 } from "os";
|
|
68937
|
-
import { join as
|
|
69069
|
+
import { join as join45, resolve as resolve13 } from "path";
|
|
68938
69070
|
function resolveCodexInstallerBinDir(input) {
|
|
68939
69071
|
const explicitBinDir = input.binDir ?? input.env?.CODEX_LOCAL_BIN_DIR;
|
|
68940
69072
|
if (explicitBinDir !== undefined && explicitBinDir.trim().length > 0)
|
|
@@ -68943,15 +69075,15 @@ function resolveCodexInstallerBinDir(input) {
|
|
|
68943
69075
|
const defaultCodexHome = resolve13(homeDir, ".codex");
|
|
68944
69076
|
const resolvedCodexHome = resolve13(input.codexHome);
|
|
68945
69077
|
if (resolvedCodexHome !== defaultCodexHome)
|
|
68946
|
-
return
|
|
69078
|
+
return join45(resolvedCodexHome, "bin");
|
|
68947
69079
|
return resolve13(homeDir, ".local", "bin");
|
|
68948
69080
|
}
|
|
68949
69081
|
|
|
68950
69082
|
// packages/omo-codex/src/install/omo-sot-migration.ts
|
|
68951
|
-
import { join as
|
|
69083
|
+
import { join as join46 } from "path";
|
|
68952
69084
|
async function seedAndMigrateOmoSot(input) {
|
|
68953
69085
|
const commandEnv = { ...input.env };
|
|
68954
|
-
const scriptPath =
|
|
69086
|
+
const scriptPath = join46(input.repoRoot, "packages", "omo-codex", "plugin", "scripts", "migrate-omo-sot.mjs");
|
|
68955
69087
|
try {
|
|
68956
69088
|
await input.runCommand(process.execPath, [scriptPath, "--seed"], {
|
|
68957
69089
|
cwd: input.repoRoot,
|
|
@@ -68966,7 +69098,7 @@ async function seedAndMigrateOmoSot(input) {
|
|
|
68966
69098
|
|
|
68967
69099
|
// packages/omo-codex/src/install/install-ast-grep-sg.ts
|
|
68968
69100
|
init_src();
|
|
68969
|
-
import { join as
|
|
69101
|
+
import { join as join47 } from "path";
|
|
68970
69102
|
function describeResult(result) {
|
|
68971
69103
|
if (result.kind === "succeeded")
|
|
68972
69104
|
return null;
|
|
@@ -68980,7 +69112,7 @@ async function installAstGrepForCodex(options) {
|
|
|
68980
69112
|
return;
|
|
68981
69113
|
const platform = options.platform ?? process.platform;
|
|
68982
69114
|
const targetDir = astGrepRuntimeDir(options.codexHome, platform, options.arch ?? process.arch);
|
|
68983
|
-
const skillDir =
|
|
69115
|
+
const skillDir = join47(plugin.path, "skills", "ast-grep");
|
|
68984
69116
|
const installer = options.installer ?? runAstGrepSkillInstall;
|
|
68985
69117
|
try {
|
|
68986
69118
|
const result = await installer({ platform, skillDir, targetDir });
|
|
@@ -69013,7 +69145,7 @@ async function runCodexInstaller(options = {}) {
|
|
|
69013
69145
|
const env3 = options.env ?? process.env;
|
|
69014
69146
|
const platform = options.platform ?? process.platform;
|
|
69015
69147
|
const repoRoot = resolve14(options.repoRoot ?? findRepoRoot({ importerDir: import.meta.dir, env: env3 }));
|
|
69016
|
-
const codexHome = resolve14(options.codexHome ?? env3.CODEX_HOME ??
|
|
69148
|
+
const codexHome = resolve14(options.codexHome ?? env3.CODEX_HOME ?? join50(homedir6(), ".codex"));
|
|
69017
69149
|
const projectDirectory = resolve14(options.projectDirectory ?? env3.OMO_CODEX_PROJECT ?? process.cwd());
|
|
69018
69150
|
const binDir = resolveCodexInstallerBinDir({ binDir: options.binDir, codexHome, env: env3 });
|
|
69019
69151
|
const runCommand = options.runCommand ?? defaultRunCommand;
|
|
@@ -69031,9 +69163,9 @@ async function runCodexInstaller(options = {}) {
|
|
|
69031
69163
|
if (!gitBashResolution.found) {
|
|
69032
69164
|
throw new Error(gitBashResolution.installHint);
|
|
69033
69165
|
}
|
|
69034
|
-
const codexPackageRoot =
|
|
69166
|
+
const codexPackageRoot = join50(repoRoot, "packages", "omo-codex");
|
|
69035
69167
|
const marketplace = await readMarketplace(repoRoot, {
|
|
69036
|
-
marketplacePath:
|
|
69168
|
+
marketplacePath: join50(codexPackageRoot, "marketplace.json")
|
|
69037
69169
|
});
|
|
69038
69170
|
const distributionManifest = await readDistributionManifest(repoRoot);
|
|
69039
69171
|
const installed = [];
|
|
@@ -69075,7 +69207,7 @@ async function runCodexInstaller(options = {}) {
|
|
|
69075
69207
|
if (runtimeLink !== null)
|
|
69076
69208
|
log4(`Linked ${runtimeLink.name} -> ${runtimeLink.target}`);
|
|
69077
69209
|
else
|
|
69078
|
-
log4(`Warning: skipped the omo runtime wrapper because ${
|
|
69210
|
+
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`);
|
|
69079
69211
|
}
|
|
69080
69212
|
pluginSources.push({ name: entry.name, sourcePath });
|
|
69081
69213
|
installed.push(plugin);
|
|
@@ -69128,13 +69260,13 @@ async function runCodexInstaller(options = {}) {
|
|
|
69128
69260
|
});
|
|
69129
69261
|
}
|
|
69130
69262
|
await reapLspDaemons(codexHome).catch(() => []);
|
|
69131
|
-
const marketplaceRoot =
|
|
69263
|
+
const marketplaceRoot = join50(codexHome, "plugins", "cache", marketplace.name);
|
|
69132
69264
|
await writeCachedMarketplaceManifest({
|
|
69133
69265
|
marketplaceName: marketplace.name,
|
|
69134
69266
|
marketplaceRoot,
|
|
69135
69267
|
plugins: installed
|
|
69136
69268
|
});
|
|
69137
|
-
const configPath =
|
|
69269
|
+
const configPath = join50(codexHome, "config.toml");
|
|
69138
69270
|
await updateCodexConfig({
|
|
69139
69271
|
configPath,
|
|
69140
69272
|
repoRoot: codexPackageRoot,
|
|
@@ -69193,7 +69325,7 @@ function findRepoRootFromImporter(importerDir) {
|
|
|
69193
69325
|
for (let depth = 0;depth <= 7; depth += 1) {
|
|
69194
69326
|
if (isRepoRootWithCodexPlugin(current))
|
|
69195
69327
|
return current;
|
|
69196
|
-
for (const wrapperPackageRoot of [
|
|
69328
|
+
for (const wrapperPackageRoot of [join50(current, "node_modules", "oh-my-openagent"), join50(current, "oh-my-openagent")]) {
|
|
69197
69329
|
if (isRepoRootWithCodexPlugin(wrapperPackageRoot))
|
|
69198
69330
|
return wrapperPackageRoot;
|
|
69199
69331
|
}
|
|
@@ -69211,7 +69343,7 @@ function findRepoRoot(input) {
|
|
|
69211
69343
|
return findRepoRootFromImporter(input.importerDir);
|
|
69212
69344
|
}
|
|
69213
69345
|
function isRepoRootWithCodexPlugin(repoRoot) {
|
|
69214
|
-
return existsSync29(
|
|
69346
|
+
return existsSync29(join50(repoRoot, "packages", "omo-codex", "plugin", ".codex-plugin", "plugin.json"));
|
|
69215
69347
|
}
|
|
69216
69348
|
function codexMarketplaceSource(marketplaceRoot) {
|
|
69217
69349
|
return { sourceType: "local", source: marketplaceRoot };
|
|
@@ -69346,12 +69478,12 @@ function defaultRunCommand2(command, args) {
|
|
|
69346
69478
|
});
|
|
69347
69479
|
}
|
|
69348
69480
|
// packages/omo-codex/src/install/codex-cleanup.ts
|
|
69349
|
-
import { lstat as lstat10, readFile as
|
|
69481
|
+
import { lstat as lstat10, readFile as readFile19, readdir as readdir7, rm as rm9, rmdir } from "fs/promises";
|
|
69350
69482
|
import { homedir as homedir8 } from "os";
|
|
69351
|
-
import { isAbsolute as isAbsolute8, join as
|
|
69483
|
+
import { isAbsolute as isAbsolute8, join as join51, relative as relative6, resolve as resolve15 } from "path";
|
|
69352
69484
|
|
|
69353
69485
|
// packages/omo-codex/src/install/codex-cleanup-config.ts
|
|
69354
|
-
import { lstat as lstat9, mkdir as mkdir8, readFile as
|
|
69486
|
+
import { lstat as lstat9, mkdir as mkdir8, readFile as readFile18, writeFile as writeFile10 } from "fs/promises";
|
|
69355
69487
|
import { dirname as dirname16 } from "path";
|
|
69356
69488
|
var MANAGED_MARKETPLACES = ["sisyphuslabs", "lazycodex", "code-yeongyu-codex-plugins"];
|
|
69357
69489
|
var LEGACY_MANAGED_CODEX_AGENT_NAMES_TO_PURGE2 = ["codex-ultrawork-reviewer"];
|
|
@@ -69381,7 +69513,7 @@ function cleanupCodexLightConfigText(config) {
|
|
|
69381
69513
|
async function cleanupCodexConfig(configPath, now) {
|
|
69382
69514
|
if (!await configExists(configPath))
|
|
69383
69515
|
return { changed: false };
|
|
69384
|
-
const original = await
|
|
69516
|
+
const original = await readFile18(configPath, "utf8");
|
|
69385
69517
|
const next = cleanupCodexLightConfigText(original);
|
|
69386
69518
|
if (next === original)
|
|
69387
69519
|
return { changed: false };
|
|
@@ -69513,8 +69645,8 @@ function nodeErrorCode4(error) {
|
|
|
69513
69645
|
var INSTALLED_AGENTS_MANIFEST = ".installed-agents.json";
|
|
69514
69646
|
async function cleanupCodexLight(input = {}) {
|
|
69515
69647
|
const env3 = input.env ?? process.env;
|
|
69516
|
-
const codexHome = resolve15(input.codexHome ?? env3.CODEX_HOME ??
|
|
69517
|
-
const configPath =
|
|
69648
|
+
const codexHome = resolve15(input.codexHome ?? env3.CODEX_HOME ?? join51(homedir8(), ".codex"));
|
|
69649
|
+
const configPath = join51(codexHome, "config.toml");
|
|
69518
69650
|
const agentPaths = await collectInstalledAgentPaths(codexHome, configPath);
|
|
69519
69651
|
const configCleanup = await cleanupCodexConfig(configPath, input.now);
|
|
69520
69652
|
const agentCleanup = await removeManifestListedAgentLinks(codexHome, agentPaths);
|
|
@@ -69550,17 +69682,17 @@ async function cleanupCodexLight(input = {}) {
|
|
|
69550
69682
|
}
|
|
69551
69683
|
function managedGlobalStatePaths(codexHome) {
|
|
69552
69684
|
return [
|
|
69553
|
-
|
|
69554
|
-
|
|
69555
|
-
|
|
69556
|
-
|
|
69557
|
-
|
|
69685
|
+
join51(codexHome, "plugins", "cache", "sisyphuslabs"),
|
|
69686
|
+
join51(codexHome, ".tmp", "marketplaces", "sisyphuslabs"),
|
|
69687
|
+
join51(codexHome, "runtime", "ast-grep"),
|
|
69688
|
+
join51(codexHome, "runtime", "node"),
|
|
69689
|
+
join51(codexHome, "plugins", "data", "omo-sisyphuslabs", "bootstrap")
|
|
69558
69690
|
];
|
|
69559
69691
|
}
|
|
69560
69692
|
var BOOTSTRAP_DATA_GLOB_MAX_DEPTH = 5;
|
|
69561
69693
|
async function collectBootstrapDataDirsByGlob(codexHome) {
|
|
69562
69694
|
const results = [];
|
|
69563
|
-
await walkForManagedBootstrapDirs(
|
|
69695
|
+
await walkForManagedBootstrapDirs(join51(codexHome, "plugins"), 0, results);
|
|
69564
69696
|
return results;
|
|
69565
69697
|
}
|
|
69566
69698
|
async function walkForManagedBootstrapDirs(directory, depth, results) {
|
|
@@ -69572,9 +69704,9 @@ async function walkForManagedBootstrapDirs(directory, depth, results) {
|
|
|
69572
69704
|
for (const entry of entries) {
|
|
69573
69705
|
if (!entry.isDirectory())
|
|
69574
69706
|
continue;
|
|
69575
|
-
const childPath =
|
|
69707
|
+
const childPath = join51(directory, entry.name);
|
|
69576
69708
|
if (isManagedBootstrapOwnerName(entry.name)) {
|
|
69577
|
-
const bootstrapDir =
|
|
69709
|
+
const bootstrapDir = join51(childPath, "bootstrap");
|
|
69578
69710
|
if (await exists6(bootstrapDir))
|
|
69579
69711
|
results.push(bootstrapDir);
|
|
69580
69712
|
continue;
|
|
@@ -69603,19 +69735,19 @@ async function attemptRemove(path7) {
|
|
|
69603
69735
|
}
|
|
69604
69736
|
async function pruneEmptyRuntimeDirBestEffort(codexHome) {
|
|
69605
69737
|
try {
|
|
69606
|
-
await rmdir(
|
|
69738
|
+
await rmdir(join51(codexHome, "runtime"));
|
|
69607
69739
|
} catch {}
|
|
69608
69740
|
}
|
|
69609
69741
|
async function collectInstalledAgentPaths(codexHome, configPath) {
|
|
69610
69742
|
const manifestPaths = [
|
|
69611
|
-
|
|
69743
|
+
join51(codexHome, ".tmp", "marketplaces", "sisyphuslabs", "plugins", "omo", INSTALLED_AGENTS_MANIFEST)
|
|
69612
69744
|
];
|
|
69613
|
-
const versionRoot =
|
|
69745
|
+
const versionRoot = join51(codexHome, "plugins", "cache", "sisyphuslabs", "omo");
|
|
69614
69746
|
if (await exists6(versionRoot)) {
|
|
69615
69747
|
const entries = await readdir7(versionRoot, { withFileTypes: true });
|
|
69616
69748
|
for (const entry of entries) {
|
|
69617
69749
|
if (entry.isDirectory())
|
|
69618
|
-
manifestPaths.push(
|
|
69750
|
+
manifestPaths.push(join51(versionRoot, entry.name, INSTALLED_AGENTS_MANIFEST));
|
|
69619
69751
|
}
|
|
69620
69752
|
}
|
|
69621
69753
|
const paths = new Set;
|
|
@@ -69632,19 +69764,19 @@ async function collectInstalledAgentPaths(codexHome, configPath) {
|
|
|
69632
69764
|
async function readManagedAgentPathsFromConfig(codexHome, configPath) {
|
|
69633
69765
|
if (!await exists6(configPath))
|
|
69634
69766
|
return [];
|
|
69635
|
-
const config = await
|
|
69636
|
-
return MANAGED_CODEX_AGENT_NAMES2.filter((agentName) => config.includes(`config_file = ${JSON.stringify(`./agents/${agentName}.toml`)}`)).map((agentName) =>
|
|
69767
|
+
const config = await readFile19(configPath, "utf8");
|
|
69768
|
+
return MANAGED_CODEX_AGENT_NAMES2.filter((agentName) => config.includes(`config_file = ${JSON.stringify(`./agents/${agentName}.toml`)}`)).map((agentName) => join51(codexHome, "agents", `${agentName}.toml`));
|
|
69637
69769
|
}
|
|
69638
69770
|
async function readInstalledAgentManifest(manifestPath) {
|
|
69639
69771
|
if (!await exists6(manifestPath))
|
|
69640
69772
|
return [];
|
|
69641
|
-
const parsed = JSON.parse(await
|
|
69773
|
+
const parsed = JSON.parse(await readFile19(manifestPath, "utf8"));
|
|
69642
69774
|
if (!isPlainRecord3(parsed) || !Array.isArray(parsed.agents))
|
|
69643
69775
|
return [];
|
|
69644
69776
|
return parsed.agents.filter((path7) => typeof path7 === "string");
|
|
69645
69777
|
}
|
|
69646
69778
|
async function removeManifestListedAgentLinks(codexHome, paths) {
|
|
69647
|
-
const agentsDir =
|
|
69779
|
+
const agentsDir = join51(codexHome, "agents");
|
|
69648
69780
|
const removed = [];
|
|
69649
69781
|
const skipped = [];
|
|
69650
69782
|
for (const path7 of paths) {
|
|
@@ -69728,19 +69860,19 @@ init_provider_availability();
|
|
|
69728
69860
|
|
|
69729
69861
|
// packages/omo-opencode/src/cli/config-manager/add-tui-plugin-to-tui-config.ts
|
|
69730
69862
|
import { existsSync as existsSync32, mkdirSync as mkdirSync10, readFileSync as readFileSync16 } from "fs";
|
|
69731
|
-
import { join as
|
|
69863
|
+
import { join as join53 } from "path";
|
|
69732
69864
|
|
|
69733
69865
|
// packages/omo-opencode/src/cli/doctor/checks/tui-plugin-config.ts
|
|
69734
69866
|
init_shared();
|
|
69735
69867
|
import { existsSync as existsSync31, readFileSync as readFileSync15 } from "fs";
|
|
69736
|
-
import { join as
|
|
69868
|
+
import { join as join52 } from "path";
|
|
69737
69869
|
var TUI_SUBPATH = "tui";
|
|
69738
69870
|
var TUI_EXPORT_SUBPATH = `./${TUI_SUBPATH}`;
|
|
69739
69871
|
function fileEntryPackageJsonPath(entry) {
|
|
69740
69872
|
let path7 = entry.slice("file:".length);
|
|
69741
69873
|
if (path7.startsWith("//"))
|
|
69742
69874
|
path7 = path7.slice(2);
|
|
69743
|
-
return
|
|
69875
|
+
return join52(path7, "package.json");
|
|
69744
69876
|
}
|
|
69745
69877
|
function packageJsonExportsTui(pkgJsonPath) {
|
|
69746
69878
|
if (!existsSync31(pkgJsonPath))
|
|
@@ -69778,7 +69910,7 @@ function packageExportsTuiForServerEntry(entry) {
|
|
|
69778
69910
|
const packageName = packageNameFromServerEntry(entry);
|
|
69779
69911
|
if (packageName === null)
|
|
69780
69912
|
return null;
|
|
69781
|
-
return packageJsonExportsTui(
|
|
69913
|
+
return packageJsonExportsTui(join52(getOpenCodeConfigDir({ binary: "opencode" }), "node_modules", packageName, "package.json"));
|
|
69782
69914
|
}
|
|
69783
69915
|
function isOurFilePluginEntry(entry) {
|
|
69784
69916
|
if (!entry.startsWith("file:"))
|
|
@@ -69851,7 +69983,7 @@ function detectServerPluginRegistration() {
|
|
|
69851
69983
|
}
|
|
69852
69984
|
}
|
|
69853
69985
|
function detectTuiPluginRegistration() {
|
|
69854
|
-
const tuiJsonPath =
|
|
69986
|
+
const tuiJsonPath = join52(getOpenCodeConfigDir({ binary: "opencode" }), "tui.json");
|
|
69855
69987
|
if (!existsSync31(tuiJsonPath)) {
|
|
69856
69988
|
return {
|
|
69857
69989
|
registered: false,
|
|
@@ -70007,10 +70139,10 @@ function readConfig(path7) {
|
|
|
70007
70139
|
return null;
|
|
70008
70140
|
}
|
|
70009
70141
|
function readServerConfig(configDir) {
|
|
70010
|
-
const jsoncPath =
|
|
70142
|
+
const jsoncPath = join53(configDir, "opencode.jsonc");
|
|
70011
70143
|
if (existsSync32(jsoncPath))
|
|
70012
70144
|
return readConfig(jsoncPath);
|
|
70013
|
-
const jsonPath =
|
|
70145
|
+
const jsonPath = join53(configDir, "opencode.json");
|
|
70014
70146
|
if (existsSync32(jsonPath))
|
|
70015
70147
|
return readConfig(jsonPath);
|
|
70016
70148
|
return null;
|
|
@@ -70052,7 +70184,7 @@ function ensureTuiPluginEntry(opts = {}) {
|
|
|
70052
70184
|
if (!desiredEntry) {
|
|
70053
70185
|
return { changed: false, reason: "no-server-entry" };
|
|
70054
70186
|
}
|
|
70055
|
-
const tuiJsonPath =
|
|
70187
|
+
const tuiJsonPath = join53(configDir, "tui.json");
|
|
70056
70188
|
const { config, malformed } = readTuiConfig(tuiJsonPath);
|
|
70057
70189
|
if (malformed) {
|
|
70058
70190
|
return { changed: false, reason: "malformed" };
|
|
@@ -70068,7 +70200,7 @@ function ensureTuiPluginEntry(opts = {}) {
|
|
|
70068
70200
|
|
|
70069
70201
|
// packages/omo-opencode/src/cli/install-ast-grep-sg.ts
|
|
70070
70202
|
import { homedir as homedir9 } from "os";
|
|
70071
|
-
import { join as
|
|
70203
|
+
import { join as join54 } from "path";
|
|
70072
70204
|
|
|
70073
70205
|
// packages/shared-skills/index.mjs
|
|
70074
70206
|
import { fileURLToPath } from "url";
|
|
@@ -70087,9 +70219,9 @@ function describeResult2(result) {
|
|
|
70087
70219
|
}
|
|
70088
70220
|
async function installAstGrepForOpenCode(options = {}) {
|
|
70089
70221
|
const platform = options.platform ?? process.platform;
|
|
70090
|
-
const baseDir =
|
|
70222
|
+
const baseDir = join54(options.homeDir ?? homedir9(), ".omo");
|
|
70091
70223
|
const targetDir = astGrepRuntimeDir(baseDir, platform, options.arch ?? process.arch);
|
|
70092
|
-
const skillDir =
|
|
70224
|
+
const skillDir = join54(options.sharedSkillsRoot ?? sharedSkillsRootPath(), "ast-grep");
|
|
70093
70225
|
const installer = options.installer ?? runAstGrepSkillInstall;
|
|
70094
70226
|
try {
|
|
70095
70227
|
const result = await installer({ platform, skillDir, targetDir });
|
|
@@ -88535,9 +88667,9 @@ function readCurrentTopLevelTask(planPath) {
|
|
|
88535
88667
|
}
|
|
88536
88668
|
// packages/boulder-state/src/storage/path.ts
|
|
88537
88669
|
import { existsSync as existsSync36 } from "fs";
|
|
88538
|
-
import { isAbsolute as isAbsolute9, join as
|
|
88670
|
+
import { isAbsolute as isAbsolute9, join as join56, relative as relative7, resolve as resolve16 } from "path";
|
|
88539
88671
|
function getBoulderFilePath(directory) {
|
|
88540
|
-
return
|
|
88672
|
+
return join56(directory, BOULDER_DIR, BOULDER_FILE);
|
|
88541
88673
|
}
|
|
88542
88674
|
function resolveTrackedPath(baseDirectory, trackedPath) {
|
|
88543
88675
|
return isAbsolute9(trackedPath) ? resolve16(trackedPath) : resolve16(baseDirectory, trackedPath);
|
|
@@ -88766,9 +88898,9 @@ init_state();
|
|
|
88766
88898
|
var CONTINUATION_MARKER_DIR = ".omo/run-continuation";
|
|
88767
88899
|
// packages/omo-opencode/src/features/run-continuation-state/storage.ts
|
|
88768
88900
|
import { existsSync as existsSync39, mkdirSync as mkdirSync11, readFileSync as readFileSync21, rmSync as rmSync2, writeFileSync as writeFileSync6 } from "fs";
|
|
88769
|
-
import { join as
|
|
88901
|
+
import { join as join57 } from "path";
|
|
88770
88902
|
function getMarkerPath(directory, sessionID) {
|
|
88771
|
-
return
|
|
88903
|
+
return join57(directory, CONTINUATION_MARKER_DIR, `${sessionID}.json`);
|
|
88772
88904
|
}
|
|
88773
88905
|
function readContinuationMarker(directory, sessionID) {
|
|
88774
88906
|
const markerPath = getMarkerPath(directory, sessionID);
|
|
@@ -88841,7 +88973,7 @@ async function isSessionInBoulderLineage(input) {
|
|
|
88841
88973
|
init_shared();
|
|
88842
88974
|
init_compaction_marker();
|
|
88843
88975
|
import { readFileSync as readFileSync22, readdirSync as readdirSync6 } from "fs";
|
|
88844
|
-
import { join as
|
|
88976
|
+
import { join as join58 } from "path";
|
|
88845
88977
|
var defaultSessionLastAgentDeps = {
|
|
88846
88978
|
getMessageDir,
|
|
88847
88979
|
isSqliteBackend,
|
|
@@ -88901,7 +89033,7 @@ async function getLastAgentFromSession(sessionID, client3, deps = {}) {
|
|
|
88901
89033
|
try {
|
|
88902
89034
|
const messages = readdirSync6(messageDir).filter((fileName) => fileName.endsWith(".json")).map((fileName) => {
|
|
88903
89035
|
try {
|
|
88904
|
-
const content = readFileSync22(
|
|
89036
|
+
const content = readFileSync22(join58(messageDir, fileName), "utf-8");
|
|
88905
89037
|
const parsed = JSON.parse(content);
|
|
88906
89038
|
return {
|
|
88907
89039
|
fileName,
|
|
@@ -88945,7 +89077,7 @@ init_agent_display_names();
|
|
|
88945
89077
|
// packages/omo-opencode/src/hooks/ralph-loop/storage.ts
|
|
88946
89078
|
init_frontmatter2();
|
|
88947
89079
|
import { existsSync as existsSync40, readFileSync as readFileSync23, writeFileSync as writeFileSync7, unlinkSync as unlinkSync5, mkdirSync as mkdirSync12 } from "fs";
|
|
88948
|
-
import { dirname as dirname19, join as
|
|
89080
|
+
import { dirname as dirname19, join as join59 } from "path";
|
|
88949
89081
|
|
|
88950
89082
|
// packages/omo-opencode/src/hooks/ralph-loop/constants.ts
|
|
88951
89083
|
var DEFAULT_STATE_FILE = ".omo/ralph-loop.local.md";
|
|
@@ -88954,7 +89086,7 @@ var DEFAULT_COMPLETION_PROMISE = "DONE";
|
|
|
88954
89086
|
|
|
88955
89087
|
// packages/omo-opencode/src/hooks/ralph-loop/storage.ts
|
|
88956
89088
|
function getStateFilePath(directory, customPath) {
|
|
88957
|
-
return customPath ?
|
|
89089
|
+
return customPath ? join59(directory, customPath) : join59(directory, DEFAULT_STATE_FILE);
|
|
88958
89090
|
}
|
|
88959
89091
|
function readState(directory, customPath) {
|
|
88960
89092
|
const filePath = getStateFilePath(directory, customPath);
|
|
@@ -90067,7 +90199,7 @@ init_extract_semver();
|
|
|
90067
90199
|
init_bun_which_shim();
|
|
90068
90200
|
import { existsSync as existsSync48, accessSync as accessSync4, constants as constants9 } from "fs";
|
|
90069
90201
|
import { homedir as homedir13 } from "os";
|
|
90070
|
-
import { join as
|
|
90202
|
+
import { join as join66 } from "path";
|
|
90071
90203
|
|
|
90072
90204
|
// packages/omo-opencode/src/cli/doctor/framework/spawn-with-timeout.ts
|
|
90073
90205
|
init_spawn_with_windows_hide();
|
|
@@ -90159,17 +90291,17 @@ function getDesktopAppPaths(platform) {
|
|
|
90159
90291
|
case "darwin":
|
|
90160
90292
|
return [
|
|
90161
90293
|
"/Applications/OpenCode.app/Contents/MacOS/OpenCode",
|
|
90162
|
-
|
|
90294
|
+
join66(home, "Applications", "OpenCode.app", "Contents", "MacOS", "OpenCode")
|
|
90163
90295
|
];
|
|
90164
90296
|
case "win32": {
|
|
90165
90297
|
const programFiles = process.env.ProgramFiles;
|
|
90166
90298
|
const localAppData = process.env.LOCALAPPDATA;
|
|
90167
90299
|
const paths = [];
|
|
90168
90300
|
if (programFiles) {
|
|
90169
|
-
paths.push(
|
|
90301
|
+
paths.push(join66(programFiles, "OpenCode", "OpenCode.exe"));
|
|
90170
90302
|
}
|
|
90171
90303
|
if (localAppData) {
|
|
90172
|
-
paths.push(
|
|
90304
|
+
paths.push(join66(localAppData, "OpenCode", "OpenCode.exe"));
|
|
90173
90305
|
}
|
|
90174
90306
|
return paths;
|
|
90175
90307
|
}
|
|
@@ -90177,8 +90309,8 @@ function getDesktopAppPaths(platform) {
|
|
|
90177
90309
|
return [
|
|
90178
90310
|
"/usr/bin/opencode",
|
|
90179
90311
|
"/usr/lib/opencode/opencode",
|
|
90180
|
-
|
|
90181
|
-
|
|
90312
|
+
join66(home, "Applications", "opencode-desktop-linux-x86_64.AppImage"),
|
|
90313
|
+
join66(home, "Applications", "opencode-desktop-linux-aarch64.AppImage")
|
|
90182
90314
|
];
|
|
90183
90315
|
default:
|
|
90184
90316
|
return [];
|
|
@@ -90210,7 +90342,7 @@ async function findOpenCodeBinary(platform = process.platform, checkExists = exi
|
|
|
90210
90342
|
const candidates = getCommandCandidates2(platform);
|
|
90211
90343
|
for (const entry of pathEnv.split(delimiter3).filter(Boolean)) {
|
|
90212
90344
|
for (const command of candidates) {
|
|
90213
|
-
const fullPath =
|
|
90345
|
+
const fullPath = join66(entry, command);
|
|
90214
90346
|
if (checkExists(fullPath) && isExecutable2(fullPath)) {
|
|
90215
90347
|
return { binary: command, path: fullPath };
|
|
90216
90348
|
}
|
|
@@ -90352,22 +90484,22 @@ init_package_json_locator();
|
|
|
90352
90484
|
import { existsSync as existsSync50, readFileSync as readFileSync32, readdirSync as readdirSync8 } from "fs";
|
|
90353
90485
|
import { createRequire as createRequire2 } from "module";
|
|
90354
90486
|
import { homedir as homedir14 } from "os";
|
|
90355
|
-
import { join as
|
|
90487
|
+
import { join as join67 } from "path";
|
|
90356
90488
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
90357
90489
|
init_shared();
|
|
90358
90490
|
function getPlatformDefaultCacheDir(platform = process.platform) {
|
|
90359
90491
|
if (platform === "darwin")
|
|
90360
|
-
return
|
|
90492
|
+
return join67(homedir14(), "Library", "Caches");
|
|
90361
90493
|
if (platform === "win32")
|
|
90362
|
-
return process.env.LOCALAPPDATA ??
|
|
90363
|
-
return
|
|
90494
|
+
return process.env.LOCALAPPDATA ?? join67(homedir14(), "AppData", "Local");
|
|
90495
|
+
return join67(homedir14(), ".cache");
|
|
90364
90496
|
}
|
|
90365
90497
|
function resolveOpenCodeCacheDir() {
|
|
90366
90498
|
const xdgCacheHome = process.env.XDG_CACHE_HOME;
|
|
90367
90499
|
if (xdgCacheHome)
|
|
90368
|
-
return
|
|
90500
|
+
return join67(xdgCacheHome, "opencode");
|
|
90369
90501
|
const fromShared = getOpenCodeCacheDir();
|
|
90370
|
-
const platformDefault =
|
|
90502
|
+
const platformDefault = join67(getPlatformDefaultCacheDir(), "opencode");
|
|
90371
90503
|
if (existsSync50(fromShared) || !existsSync50(platformDefault))
|
|
90372
90504
|
return fromShared;
|
|
90373
90505
|
return platformDefault;
|
|
@@ -90399,11 +90531,11 @@ function normalizeVersion(value) {
|
|
|
90399
90531
|
function createPackageCandidates(rootDir) {
|
|
90400
90532
|
return ACCEPTED_PACKAGE_NAMES.map((packageName) => ({
|
|
90401
90533
|
packageName,
|
|
90402
|
-
installedPackagePath:
|
|
90534
|
+
installedPackagePath: join67(rootDir, "node_modules", packageName, "package.json")
|
|
90403
90535
|
}));
|
|
90404
90536
|
}
|
|
90405
90537
|
function createTaggedInstallCandidates(rootDir) {
|
|
90406
|
-
const packagesDir =
|
|
90538
|
+
const packagesDir = join67(rootDir, "packages");
|
|
90407
90539
|
if (!existsSync50(packagesDir))
|
|
90408
90540
|
return [];
|
|
90409
90541
|
const candidates = [];
|
|
@@ -90411,14 +90543,14 @@ function createTaggedInstallCandidates(rootDir) {
|
|
|
90411
90543
|
const packageName = ACCEPTED_PACKAGE_NAMES.find((name) => entryName.startsWith(`${name}@`));
|
|
90412
90544
|
if (packageName === undefined)
|
|
90413
90545
|
continue;
|
|
90414
|
-
const installDir =
|
|
90546
|
+
const installDir = join67(packagesDir, entryName);
|
|
90415
90547
|
candidates.push({
|
|
90416
90548
|
cacheDir: installDir,
|
|
90417
|
-
cachePackagePath:
|
|
90549
|
+
cachePackagePath: join67(installDir, "package.json"),
|
|
90418
90550
|
packageCandidates: [
|
|
90419
90551
|
{
|
|
90420
90552
|
packageName,
|
|
90421
|
-
installedPackagePath:
|
|
90553
|
+
installedPackagePath: join67(installDir, "node_modules", packageName, "package.json")
|
|
90422
90554
|
}
|
|
90423
90555
|
]
|
|
90424
90556
|
});
|
|
@@ -90463,13 +90595,13 @@ function getLoadedPluginVersion() {
|
|
|
90463
90595
|
const candidates = [
|
|
90464
90596
|
{
|
|
90465
90597
|
cacheDir: configDir,
|
|
90466
|
-
cachePackagePath:
|
|
90598
|
+
cachePackagePath: join67(configDir, "package.json"),
|
|
90467
90599
|
packageCandidates: createPackageCandidates(configDir)
|
|
90468
90600
|
},
|
|
90469
90601
|
...createTaggedInstallCandidates(configDir),
|
|
90470
90602
|
{
|
|
90471
90603
|
cacheDir,
|
|
90472
|
-
cachePackagePath:
|
|
90604
|
+
cachePackagePath: join67(cacheDir, "package.json"),
|
|
90473
90605
|
packageCandidates: createPackageCandidates(cacheDir)
|
|
90474
90606
|
},
|
|
90475
90607
|
...createTaggedInstallCandidates(cacheDir)
|
|
@@ -90772,18 +90904,18 @@ function validatePluginConfig(directory) {
|
|
|
90772
90904
|
init_shared();
|
|
90773
90905
|
import { existsSync as existsSync52, readFileSync as readFileSync35 } from "fs";
|
|
90774
90906
|
import { homedir as homedir16 } from "os";
|
|
90775
|
-
import { join as
|
|
90907
|
+
import { join as join68 } from "path";
|
|
90776
90908
|
function getUserConfigDir2() {
|
|
90777
90909
|
const xdgConfig = process.env.XDG_CONFIG_HOME;
|
|
90778
90910
|
if (xdgConfig)
|
|
90779
|
-
return
|
|
90780
|
-
return
|
|
90911
|
+
return join68(xdgConfig, "opencode");
|
|
90912
|
+
return join68(homedir16(), ".config", "opencode");
|
|
90781
90913
|
}
|
|
90782
90914
|
function loadCustomProviderNames() {
|
|
90783
90915
|
const configDir = getUserConfigDir2();
|
|
90784
90916
|
const candidatePaths = [
|
|
90785
|
-
|
|
90786
|
-
|
|
90917
|
+
join68(configDir, "opencode.json"),
|
|
90918
|
+
join68(configDir, "opencode.jsonc")
|
|
90787
90919
|
];
|
|
90788
90920
|
for (const configPath of candidatePaths) {
|
|
90789
90921
|
if (!existsSync52(configPath))
|
|
@@ -90804,7 +90936,7 @@ function loadCustomProviderNames() {
|
|
|
90804
90936
|
return [];
|
|
90805
90937
|
}
|
|
90806
90938
|
function loadAvailableModelsFromCache() {
|
|
90807
|
-
const cacheFile =
|
|
90939
|
+
const cacheFile = join68(getOpenCodeCacheDir(), "models.json");
|
|
90808
90940
|
const customProviders = loadCustomProviderNames();
|
|
90809
90941
|
if (!existsSync52(cacheFile)) {
|
|
90810
90942
|
if (customProviders.length > 0) {
|
|
@@ -90841,8 +90973,8 @@ init_model_capabilities2();
|
|
|
90841
90973
|
init_shared();
|
|
90842
90974
|
init_plugin_identity();
|
|
90843
90975
|
import { readFileSync as readFileSync36 } from "fs";
|
|
90844
|
-
import { join as
|
|
90845
|
-
var PROJECT_CONFIG_DIR =
|
|
90976
|
+
import { join as join69 } from "path";
|
|
90977
|
+
var PROJECT_CONFIG_DIR = join69(process.cwd(), ".opencode");
|
|
90846
90978
|
function loadOmoConfig() {
|
|
90847
90979
|
const projectDetected = detectPluginConfigFile(PROJECT_CONFIG_DIR, {
|
|
90848
90980
|
basenames: [CONFIG_BASENAME],
|
|
@@ -90880,7 +91012,7 @@ function loadOmoConfig() {
|
|
|
90880
91012
|
|
|
90881
91013
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-details.ts
|
|
90882
91014
|
init_shared();
|
|
90883
|
-
import { join as
|
|
91015
|
+
import { join as join70 } from "path";
|
|
90884
91016
|
|
|
90885
91017
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-variant.ts
|
|
90886
91018
|
function formatModelWithVariant(model, variant) {
|
|
@@ -90922,7 +91054,7 @@ function formatCapabilityResolutionLabel(mode) {
|
|
|
90922
91054
|
}
|
|
90923
91055
|
function buildModelResolutionDetails(options) {
|
|
90924
91056
|
const details = [];
|
|
90925
|
-
const cacheFile =
|
|
91057
|
+
const cacheFile = join70(getOpenCodeCacheDir(), "models.json");
|
|
90926
91058
|
details.push("\u2550\u2550\u2550 Available Models (from cache) \u2550\u2550\u2550");
|
|
90927
91059
|
details.push("");
|
|
90928
91060
|
if (options.available.cacheExists) {
|
|
@@ -91201,25 +91333,25 @@ init_src();
|
|
|
91201
91333
|
import { existsSync as existsSync53 } from "fs";
|
|
91202
91334
|
import { createRequire as createRequire3 } from "module";
|
|
91203
91335
|
import { homedir as homedir18 } from "os";
|
|
91204
|
-
import { dirname as dirname25, join as
|
|
91336
|
+
import { dirname as dirname25, join as join72 } from "path";
|
|
91205
91337
|
|
|
91206
91338
|
// packages/omo-opencode/src/hooks/comment-checker/downloader.ts
|
|
91207
|
-
import { join as
|
|
91339
|
+
import { join as join71 } from "path";
|
|
91208
91340
|
import { homedir as homedir17, tmpdir as tmpdir3 } from "os";
|
|
91209
91341
|
init_binary_downloader();
|
|
91210
91342
|
init_logger2();
|
|
91211
91343
|
init_plugin_identity();
|
|
91212
91344
|
var DEBUG = process.env.COMMENT_CHECKER_DEBUG === "1";
|
|
91213
|
-
var DEBUG_FILE =
|
|
91345
|
+
var DEBUG_FILE = join71(tmpdir3(), "comment-checker-debug.log");
|
|
91214
91346
|
function getCacheDir2() {
|
|
91215
91347
|
if (process.platform === "win32") {
|
|
91216
91348
|
const localAppData = process.env.LOCALAPPDATA || process.env.APPDATA;
|
|
91217
|
-
const base2 = localAppData ||
|
|
91218
|
-
return
|
|
91349
|
+
const base2 = localAppData || join71(homedir17(), "AppData", "Local");
|
|
91350
|
+
return join71(base2, CACHE_DIR_NAME, "bin");
|
|
91219
91351
|
}
|
|
91220
91352
|
const xdgCache = process.env.XDG_CACHE_HOME;
|
|
91221
|
-
const base = xdgCache ||
|
|
91222
|
-
return
|
|
91353
|
+
const base = xdgCache || join71(homedir17(), ".cache");
|
|
91354
|
+
return join71(base, CACHE_DIR_NAME, "bin");
|
|
91223
91355
|
}
|
|
91224
91356
|
function getBinaryName() {
|
|
91225
91357
|
return process.platform === "win32" ? "comment-checker.exe" : "comment-checker";
|
|
@@ -91269,7 +91401,7 @@ async function getBinaryVersion(binary) {
|
|
|
91269
91401
|
}
|
|
91270
91402
|
}
|
|
91271
91403
|
async function checkAstGrepCli() {
|
|
91272
|
-
const runtimeDir = astGrepRuntimeDir(
|
|
91404
|
+
const runtimeDir = astGrepRuntimeDir(join72(homedir18(), ".omo"));
|
|
91273
91405
|
const sgPath = findSgBinarySync({ runtimeDir });
|
|
91274
91406
|
if (sgPath === null) {
|
|
91275
91407
|
return {
|
|
@@ -91299,10 +91431,10 @@ function findCommentCheckerPackageBinary(baseDirOverride, resolvePackageJsonPath
|
|
|
91299
91431
|
const platformKey = `${process.platform}-${process.arch === "x64" ? "x64" : process.arch}`;
|
|
91300
91432
|
try {
|
|
91301
91433
|
const packageDir = baseDirOverride ?? dirname25(resolvePackageJsonPath());
|
|
91302
|
-
const vendorPath =
|
|
91434
|
+
const vendorPath = join72(packageDir, "vendor", platformKey, binaryName);
|
|
91303
91435
|
if (existsSync53(vendorPath))
|
|
91304
91436
|
return vendorPath;
|
|
91305
|
-
const binPath =
|
|
91437
|
+
const binPath = join72(packageDir, "bin", binaryName);
|
|
91306
91438
|
if (existsSync53(binPath))
|
|
91307
91439
|
return binPath;
|
|
91308
91440
|
} catch (error51) {
|
|
@@ -91448,7 +91580,7 @@ async function getGhCliInfo(dependencies = {}) {
|
|
|
91448
91580
|
|
|
91449
91581
|
// packages/omo-opencode/src/cli/doctor/checks/tools-lsp.ts
|
|
91450
91582
|
import { readFileSync as readFileSync37 } from "fs";
|
|
91451
|
-
import { join as
|
|
91583
|
+
import { join as join73 } from "path";
|
|
91452
91584
|
|
|
91453
91585
|
// packages/omo-opencode/src/mcp/lsp.ts
|
|
91454
91586
|
import { existsSync as existsSync54 } from "fs";
|
|
@@ -91655,7 +91787,7 @@ function readOmoConfig(configDirectory) {
|
|
|
91655
91787
|
}
|
|
91656
91788
|
function isLspMcpDisabled(options) {
|
|
91657
91789
|
const userConfigDirectory = options.configDirectory ?? getOpenCodeConfigDir({ binary: "opencode" });
|
|
91658
|
-
const projectConfigDirectory =
|
|
91790
|
+
const projectConfigDirectory = join73(options.cwd ?? process.cwd(), ".opencode");
|
|
91659
91791
|
const userConfig = readOmoConfig(userConfigDirectory);
|
|
91660
91792
|
const projectConfig = readOmoConfig(projectConfigDirectory);
|
|
91661
91793
|
const disabledMcps = new Set([
|
|
@@ -91676,13 +91808,13 @@ function getInstalledLspServers(options = {}) {
|
|
|
91676
91808
|
init_shared();
|
|
91677
91809
|
import { existsSync as existsSync55, readFileSync as readFileSync38 } from "fs";
|
|
91678
91810
|
import { homedir as homedir19 } from "os";
|
|
91679
|
-
import { join as
|
|
91811
|
+
import { join as join74 } from "path";
|
|
91680
91812
|
var BUILTIN_MCP_SERVERS = ["websearch", "context7", "grep_app", "lsp"];
|
|
91681
91813
|
function getMcpConfigPaths() {
|
|
91682
91814
|
return [
|
|
91683
|
-
|
|
91684
|
-
|
|
91685
|
-
|
|
91815
|
+
join74(homedir19(), ".claude", ".mcp.json"),
|
|
91816
|
+
join74(process.cwd(), ".mcp.json"),
|
|
91817
|
+
join74(process.cwd(), ".claude", ".mcp.json")
|
|
91686
91818
|
];
|
|
91687
91819
|
}
|
|
91688
91820
|
function loadUserMcpConfig() {
|
|
@@ -91927,9 +92059,9 @@ async function pathExists(dir) {
|
|
|
91927
92059
|
// packages/omo-opencode/src/cli/doctor/checks/codex.ts
|
|
91928
92060
|
init_src();
|
|
91929
92061
|
import { existsSync as existsSync56 } from "fs";
|
|
91930
|
-
import { lstat as lstat11, readdir as readdir8, readFile as
|
|
92062
|
+
import { lstat as lstat11, readdir as readdir8, readFile as readFile20 } from "fs/promises";
|
|
91931
92063
|
import { homedir as homedir21 } from "os";
|
|
91932
|
-
import { basename as basename12, join as
|
|
92064
|
+
import { basename as basename12, join as join75, resolve as resolve19 } from "path";
|
|
91933
92065
|
// packages/omo-opencode/package.json
|
|
91934
92066
|
var package_default3 = {
|
|
91935
92067
|
name: "@oh-my-opencode/omo-opencode",
|
|
@@ -91985,13 +92117,13 @@ var CODEX_BIN_NAMES = [
|
|
|
91985
92117
|
"omo-git-bash-hook"
|
|
91986
92118
|
];
|
|
91987
92119
|
async function gatherCodexSummary(deps = {}) {
|
|
91988
|
-
const codexHome = resolve19(deps.codexHome ?? process.env.CODEX_HOME ??
|
|
92120
|
+
const codexHome = resolve19(deps.codexHome ?? process.env.CODEX_HOME ?? join75(homedir21(), ".codex"));
|
|
91989
92121
|
const binDir = resolveCodexInstallerBinDir({ binDir: deps.binDir, codexHome, env: process.env });
|
|
91990
92122
|
const detection = await (deps.detectCodexInstallation ?? detectCodexInstallation)();
|
|
91991
92123
|
const pluginRoot = await resolveInstalledPluginRoot(codexHome);
|
|
91992
|
-
const manifest = pluginRoot === null ? null : await readJson(
|
|
91993
|
-
const installSnapshot = pluginRoot === null ? null : await readJson(
|
|
91994
|
-
const configPath =
|
|
92124
|
+
const manifest = pluginRoot === null ? null : await readJson(join75(pluginRoot, ".codex-plugin", "plugin.json"));
|
|
92125
|
+
const installSnapshot = pluginRoot === null ? null : await readJson(join75(pluginRoot, "lazycodex-install.json"));
|
|
92126
|
+
const configPath = join75(codexHome, "config.toml");
|
|
91995
92127
|
const pluginVersion = stringField(manifest, "version");
|
|
91996
92128
|
return {
|
|
91997
92129
|
codexPath: detection.found && "path" in detection ? detection.path : null,
|
|
@@ -92047,7 +92179,7 @@ function buildCodexIssues(summary) {
|
|
|
92047
92179
|
if (summary.pluginRoot === null) {
|
|
92048
92180
|
issues.push({
|
|
92049
92181
|
title: "OMO Codex plugin is not installed",
|
|
92050
|
-
description: `Expected cached plugin at ${
|
|
92182
|
+
description: `Expected cached plugin at ${join75("plugins", "cache", MARKETPLACE_NAME, PLUGIN_NAME2, DEFAULT_PLUGIN_VERSION)} under CODEX_HOME.`,
|
|
92051
92183
|
fix: "Run: npx lazycodex-ai install",
|
|
92052
92184
|
severity: "error",
|
|
92053
92185
|
affects: ["plugin loading"]
|
|
@@ -92100,18 +92232,18 @@ function buildCodexIssues(summary) {
|
|
|
92100
92232
|
return issues;
|
|
92101
92233
|
}
|
|
92102
92234
|
async function resolveInstalledPluginRoot(codexHome) {
|
|
92103
|
-
const pluginRoot =
|
|
92235
|
+
const pluginRoot = join75(codexHome, "plugins", "cache", MARKETPLACE_NAME, PLUGIN_NAME2);
|
|
92104
92236
|
if (!existsSync56(pluginRoot))
|
|
92105
92237
|
return null;
|
|
92106
92238
|
const versions2 = await readdir8(pluginRoot, { withFileTypes: true });
|
|
92107
92239
|
const candidates = versions2.filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort(compareVersionsDescending);
|
|
92108
|
-
return candidates.length === 0 ? null :
|
|
92240
|
+
return candidates.length === 0 ? null : join75(pluginRoot, candidates[0] ?? DEFAULT_PLUGIN_VERSION);
|
|
92109
92241
|
}
|
|
92110
92242
|
async function readCodexConfigSummary(configPath) {
|
|
92111
92243
|
if (!existsSync56(configPath)) {
|
|
92112
92244
|
return { exists: false, marketplaceConfigured: false, pluginEnabled: false, pluginsFeatureEnabled: false, pluginHooksFeatureEnabled: false };
|
|
92113
92245
|
}
|
|
92114
|
-
const content = await
|
|
92246
|
+
const content = await readFile20(configPath, "utf8");
|
|
92115
92247
|
return {
|
|
92116
92248
|
exists: true,
|
|
92117
92249
|
marketplaceConfigured: content.includes("[marketplaces.sisyphuslabs]"),
|
|
@@ -92123,13 +92255,13 @@ async function readCodexConfigSummary(configPath) {
|
|
|
92123
92255
|
async function readLinkedBins(binDir) {
|
|
92124
92256
|
const linked = [];
|
|
92125
92257
|
for (const name of CODEX_BIN_NAMES) {
|
|
92126
|
-
if (await pathExists2(
|
|
92258
|
+
if (await pathExists2(join75(binDir, process.platform === "win32" ? `${name}.cmd` : name)))
|
|
92127
92259
|
linked.push(name);
|
|
92128
92260
|
}
|
|
92129
92261
|
return linked;
|
|
92130
92262
|
}
|
|
92131
92263
|
async function readLinkedAgents(codexHome) {
|
|
92132
|
-
const agentsDir =
|
|
92264
|
+
const agentsDir = join75(codexHome, "agents");
|
|
92133
92265
|
if (!existsSync56(agentsDir))
|
|
92134
92266
|
return [];
|
|
92135
92267
|
const entries = await readdir8(agentsDir, { withFileTypes: true });
|
|
@@ -92137,7 +92269,7 @@ async function readLinkedAgents(codexHome) {
|
|
|
92137
92269
|
}
|
|
92138
92270
|
async function readJson(path16) {
|
|
92139
92271
|
try {
|
|
92140
|
-
const parsed = JSON.parse(await
|
|
92272
|
+
const parsed = JSON.parse(await readFile20(path16, "utf8"));
|
|
92141
92273
|
return isPlainRecord(parsed) ? parsed : null;
|
|
92142
92274
|
} catch (error51) {
|
|
92143
92275
|
if (error51 instanceof Error)
|
|
@@ -92187,9 +92319,9 @@ async function pathExists2(path16) {
|
|
|
92187
92319
|
|
|
92188
92320
|
// packages/omo-opencode/src/cli/doctor/checks/codex-components.ts
|
|
92189
92321
|
init_src();
|
|
92190
|
-
import { readdir as readdir9, readFile as
|
|
92322
|
+
import { readdir as readdir9, readFile as readFile21, stat as stat4 } from "fs/promises";
|
|
92191
92323
|
import { homedir as homedir22 } from "os";
|
|
92192
|
-
import { dirname as dirname27, join as
|
|
92324
|
+
import { dirname as dirname27, join as join76, relative as relative9, resolve as resolve20, sep as sep9 } from "path";
|
|
92193
92325
|
var CODEX_COMPONENTS_CHECK_ID = "codex-components";
|
|
92194
92326
|
var CODEX_COMPONENTS_CHECK_NAME = "codex-components";
|
|
92195
92327
|
var PLUGIN_DATA_DIR_NAME = "omo-sisyphuslabs";
|
|
@@ -92199,7 +92331,7 @@ async function checkCodexComponents(deps = {}) {
|
|
|
92199
92331
|
const env3 = deps.env ?? process.env;
|
|
92200
92332
|
const platform = deps.platform ?? process.platform;
|
|
92201
92333
|
const arch = deps.arch ?? process.arch;
|
|
92202
|
-
const codexHome = resolve20(deps.codexHome ?? env3["CODEX_HOME"] ??
|
|
92334
|
+
const codexHome = resolve20(deps.codexHome ?? env3["CODEX_HOME"] ?? join76(homedir22(), ".codex"));
|
|
92203
92335
|
const summary = await gatherCodexSummary({ ...deps, codexHome });
|
|
92204
92336
|
if (summary.pluginRoot === null) {
|
|
92205
92337
|
return {
|
|
@@ -92224,7 +92356,7 @@ async function checkCodexComponents(deps = {}) {
|
|
|
92224
92356
|
});
|
|
92225
92357
|
}
|
|
92226
92358
|
const runtimeSgDir = runtimeSgDirectory(codexHome, platform, arch);
|
|
92227
|
-
const runtimeSgPath =
|
|
92359
|
+
const runtimeSgPath = join76(runtimeSgDir, sgBinaryName(platform));
|
|
92228
92360
|
const sg = findSgBinarySync({
|
|
92229
92361
|
arch,
|
|
92230
92362
|
env: env3,
|
|
@@ -92308,7 +92440,7 @@ function recordBrokenTarget(broken, classified, origin) {
|
|
|
92308
92440
|
async function classifyBundleTarget(bundleRoot, baseRoot, relativePath, allowEscape) {
|
|
92309
92441
|
const targetPath = resolve20(baseRoot, relativePath);
|
|
92310
92442
|
const bundleRootPath = resolve20(bundleRoot);
|
|
92311
|
-
const bundleRootPrefix = bundleRootPath.endsWith(
|
|
92443
|
+
const bundleRootPrefix = bundleRootPath.endsWith(sep9) ? bundleRootPath : `${bundleRootPath}${sep9}`;
|
|
92312
92444
|
if (targetPath !== bundleRootPath && !targetPath.startsWith(bundleRootPrefix)) {
|
|
92313
92445
|
if (allowEscape)
|
|
92314
92446
|
return null;
|
|
@@ -92323,7 +92455,7 @@ async function classifyBundleTarget(bundleRoot, baseRoot, relativePath, allowEsc
|
|
|
92323
92455
|
}
|
|
92324
92456
|
async function findHookManifestPaths(root) {
|
|
92325
92457
|
const paths2 = await findManifestPaths(root, "hooks.json");
|
|
92326
|
-
return paths2.filter((path16) => dirname27(path16).endsWith(`${
|
|
92458
|
+
return paths2.filter((path16) => dirname27(path16).endsWith(`${sep9}hooks`));
|
|
92327
92459
|
}
|
|
92328
92460
|
async function findManifestPaths(root, manifestName) {
|
|
92329
92461
|
let entries;
|
|
@@ -92336,7 +92468,7 @@ async function findManifestPaths(root, manifestName) {
|
|
|
92336
92468
|
for (const entry of entries) {
|
|
92337
92469
|
if (entry.name === "node_modules" || entry.name === ".git")
|
|
92338
92470
|
continue;
|
|
92339
|
-
const entryPath =
|
|
92471
|
+
const entryPath = join76(root, entry.name);
|
|
92340
92472
|
if (entry.isDirectory()) {
|
|
92341
92473
|
paths2.push(...await findManifestPaths(entryPath, manifestName));
|
|
92342
92474
|
continue;
|
|
@@ -92379,18 +92511,18 @@ function isPluginRuntimePathArg(arg) {
|
|
|
92379
92511
|
return (arg.startsWith("./") || arg.startsWith("../")) && arg.endsWith("/dist/cli.js");
|
|
92380
92512
|
}
|
|
92381
92513
|
function runtimeSgDirectory(codexHome, platform, arch) {
|
|
92382
|
-
return
|
|
92514
|
+
return join76(codexHome, "runtime", "ast-grep", runtimeSlug(platform, arch));
|
|
92383
92515
|
}
|
|
92384
92516
|
function describeSgSource(sgPath, env3, runtimeSgDir, platform) {
|
|
92385
92517
|
const override = env3[SG_PATH_ENV_KEY]?.trim();
|
|
92386
92518
|
if (override !== undefined && override.length > 0 && sgPath === override)
|
|
92387
92519
|
return `env override ${SG_PATH_ENV_KEY}`;
|
|
92388
|
-
if (sgPath ===
|
|
92520
|
+
if (sgPath === join76(runtimeSgDir, sgBinaryName(platform)))
|
|
92389
92521
|
return "runtime dir";
|
|
92390
92522
|
return "PATH";
|
|
92391
92523
|
}
|
|
92392
92524
|
async function readBootstrapStateSummary(codexHome) {
|
|
92393
|
-
const statePath =
|
|
92525
|
+
const statePath = join76(codexHome, "plugins", "data", PLUGIN_DATA_DIR_NAME, "bootstrap", "state.json");
|
|
92394
92526
|
const raw = await readJson2(statePath);
|
|
92395
92527
|
if (raw === null)
|
|
92396
92528
|
return null;
|
|
@@ -92439,7 +92571,7 @@ function degradedDetailLines(entries) {
|
|
|
92439
92571
|
}
|
|
92440
92572
|
async function readJson2(path16) {
|
|
92441
92573
|
try {
|
|
92442
|
-
const parsed = JSON.parse(await
|
|
92574
|
+
const parsed = JSON.parse(await readFile21(path16, "utf8"));
|
|
92443
92575
|
return isRecord5(parsed) ? parsed : null;
|
|
92444
92576
|
} catch (error51) {
|
|
92445
92577
|
if (error51 instanceof Error)
|
|
@@ -92467,17 +92599,17 @@ function isRecord5(value) {
|
|
|
92467
92599
|
|
|
92468
92600
|
// packages/omo-opencode/src/cli/doctor/checks/codex-runtime-wrapper.ts
|
|
92469
92601
|
import { existsSync as existsSync57 } from "fs";
|
|
92470
|
-
import { readFile as
|
|
92602
|
+
import { readFile as readFile22 } from "fs/promises";
|
|
92471
92603
|
import { homedir as homedir23 } from "os";
|
|
92472
|
-
import { join as
|
|
92604
|
+
import { join as join77, resolve as resolve21 } from "path";
|
|
92473
92605
|
var RUNTIME_WRAPPER_MARKER2 = "OMO_GENERATED_RUNTIME_WRAPPER";
|
|
92474
92606
|
var CHECK_NAME = "codex-runtime-wrapper";
|
|
92475
92607
|
var REINSTALL_COMMAND = "npx --yes lazycodex-ai@latest install --no-tui";
|
|
92476
92608
|
async function checkCodexRuntimeWrapper(deps = {}) {
|
|
92477
|
-
const codexHome = resolve21(deps.codexHome ?? process.env.CODEX_HOME ??
|
|
92609
|
+
const codexHome = resolve21(deps.codexHome ?? process.env.CODEX_HOME ?? join77(homedir23(), ".codex"));
|
|
92478
92610
|
const binDir = resolveCodexInstallerBinDir({ binDir: deps.binDir, codexHome, env: process.env });
|
|
92479
92611
|
const platform = deps.platform ?? process.platform;
|
|
92480
|
-
const wrapperPath =
|
|
92612
|
+
const wrapperPath = join77(binDir, platform === "win32" ? "omo.cmd" : "omo");
|
|
92481
92613
|
const wrapper = await readRuntimeWrapper(wrapperPath);
|
|
92482
92614
|
const issues = [];
|
|
92483
92615
|
if (wrapper?.includes(RUNTIME_WRAPPER_MARKER2) === true) {
|
|
@@ -92502,7 +92634,7 @@ async function checkCodexRuntimeWrapper(deps = {}) {
|
|
|
92502
92634
|
}
|
|
92503
92635
|
async function readRuntimeWrapper(path16) {
|
|
92504
92636
|
try {
|
|
92505
|
-
return await
|
|
92637
|
+
return await readFile22(path16, "utf8");
|
|
92506
92638
|
} catch (error51) {
|
|
92507
92639
|
if (error51 instanceof Error)
|
|
92508
92640
|
return null;
|
|
@@ -92982,12 +93114,12 @@ import {
|
|
|
92982
93114
|
unlinkSync as unlinkSync8,
|
|
92983
93115
|
writeFileSync as writeFileSync11
|
|
92984
93116
|
} from "fs";
|
|
92985
|
-
import { basename as basename13, dirname as dirname28, join as
|
|
93117
|
+
import { basename as basename13, dirname as dirname28, join as join80 } from "path";
|
|
92986
93118
|
|
|
92987
93119
|
// packages/mcp-client-core/src/config-dir.ts
|
|
92988
93120
|
import { existsSync as existsSync58, realpathSync as realpathSync8 } from "fs";
|
|
92989
93121
|
import { homedir as homedir24 } from "os";
|
|
92990
|
-
import { join as
|
|
93122
|
+
import { join as join78, resolve as resolve22 } from "path";
|
|
92991
93123
|
function resolveConfigPath2(pathValue) {
|
|
92992
93124
|
const resolvedPath = resolve22(pathValue);
|
|
92993
93125
|
if (!existsSync58(resolvedPath))
|
|
@@ -93005,13 +93137,13 @@ function getOpenCodeCliConfigDir(env3 = process.env) {
|
|
|
93005
93137
|
if (customConfigDir) {
|
|
93006
93138
|
return resolveConfigPath2(customConfigDir);
|
|
93007
93139
|
}
|
|
93008
|
-
const xdgConfigDir = env3["XDG_CONFIG_HOME"]?.trim() ||
|
|
93009
|
-
return resolveConfigPath2(
|
|
93140
|
+
const xdgConfigDir = env3["XDG_CONFIG_HOME"]?.trim() || join78(homedir24(), ".config");
|
|
93141
|
+
return resolveConfigPath2(join78(xdgConfigDir, "opencode"));
|
|
93010
93142
|
}
|
|
93011
93143
|
|
|
93012
93144
|
// packages/mcp-client-core/src/mcp-oauth/storage-index.ts
|
|
93013
93145
|
import { chmodSync as chmodSync3, existsSync as existsSync59, readFileSync as readFileSync40, renameSync as renameSync6, writeFileSync as writeFileSync10 } from "fs";
|
|
93014
|
-
import { join as
|
|
93146
|
+
import { join as join79 } from "path";
|
|
93015
93147
|
var INDEX_FILE_NAME = "index.json";
|
|
93016
93148
|
function isTokenIndex(value) {
|
|
93017
93149
|
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
@@ -93019,7 +93151,7 @@ function isTokenIndex(value) {
|
|
|
93019
93151
|
return Object.values(value).every((entry) => typeof entry === "string");
|
|
93020
93152
|
}
|
|
93021
93153
|
function getIndexPath(storageDir) {
|
|
93022
|
-
return
|
|
93154
|
+
return join79(storageDir, INDEX_FILE_NAME);
|
|
93023
93155
|
}
|
|
93024
93156
|
function readTokenIndex(storageDir) {
|
|
93025
93157
|
const indexPath = getIndexPath(storageDir);
|
|
@@ -93063,16 +93195,16 @@ function deleteTokenIndexEntry(storageDir, hash2) {
|
|
|
93063
93195
|
var STORAGE_DIR_NAME = "mcp-oauth";
|
|
93064
93196
|
var LEGACY_STORAGE_FILE_NAME = "mcp-oauth.json";
|
|
93065
93197
|
function getMcpOauthStorageDir() {
|
|
93066
|
-
return
|
|
93198
|
+
return join80(getOpenCodeCliConfigDir(), STORAGE_DIR_NAME);
|
|
93067
93199
|
}
|
|
93068
93200
|
function getMcpOauthServerHash(serverHost, resource) {
|
|
93069
93201
|
return createHash4("sha256").update(buildKey(serverHost, resource)).digest("hex").slice(0, 32);
|
|
93070
93202
|
}
|
|
93071
93203
|
function getMcpOauthStoragePath(serverHost, resource) {
|
|
93072
|
-
return
|
|
93204
|
+
return join80(getMcpOauthStorageDir(), `${getMcpOauthServerHash(serverHost, resource)}.json`);
|
|
93073
93205
|
}
|
|
93074
93206
|
function getLegacyStoragePath() {
|
|
93075
|
-
return
|
|
93207
|
+
return join80(getOpenCodeCliConfigDir(), LEGACY_STORAGE_FILE_NAME);
|
|
93076
93208
|
}
|
|
93077
93209
|
function normalizeHost2(serverHost) {
|
|
93078
93210
|
let host = serverHost.trim();
|
|
@@ -93251,7 +93383,7 @@ function listTokensByHost(serverHost) {
|
|
|
93251
93383
|
for (const [hash2, indexedKey] of Object.entries(index)) {
|
|
93252
93384
|
if (!indexedKey.startsWith(prefix))
|
|
93253
93385
|
continue;
|
|
93254
|
-
const indexedToken = readTokenFile(
|
|
93386
|
+
const indexedToken = readTokenFile(join80(getMcpOauthStorageDir(), `${hash2}.json`));
|
|
93255
93387
|
if (indexedToken)
|
|
93256
93388
|
result[indexedKey] = indexedToken;
|
|
93257
93389
|
}
|
|
@@ -93266,7 +93398,7 @@ function listAllTokens() {
|
|
|
93266
93398
|
for (const entry of readdirSync9(dir, { withFileTypes: true })) {
|
|
93267
93399
|
if (!entry.isFile() || !entry.name.endsWith(".json") || entry.name === "index.json")
|
|
93268
93400
|
continue;
|
|
93269
|
-
const token = readTokenFile(
|
|
93401
|
+
const token = readTokenFile(join80(dir, entry.name));
|
|
93270
93402
|
const hash2 = basename13(entry.name, ".json");
|
|
93271
93403
|
if (token)
|
|
93272
93404
|
result[index[hash2] ?? hash2] = token;
|
|
@@ -94087,7 +94219,7 @@ import { isAbsolute as isAbsolute10, resolve as resolve23 } from "path";
|
|
|
94087
94219
|
init_src();
|
|
94088
94220
|
import { existsSync as existsSync63 } from "fs";
|
|
94089
94221
|
import { homedir as homedir26 } from "os";
|
|
94090
|
-
import { join as
|
|
94222
|
+
import { join as join81 } from "path";
|
|
94091
94223
|
|
|
94092
94224
|
// packages/omo-opencode/src/cli/sparkshell-appserver-websocket.ts
|
|
94093
94225
|
import { randomBytes as randomBytes3 } from "crypto";
|
|
@@ -94248,8 +94380,8 @@ function resolveAppServerSocketPath(env3) {
|
|
|
94248
94380
|
if (explicit) {
|
|
94249
94381
|
return explicit;
|
|
94250
94382
|
}
|
|
94251
|
-
const codexHome = env3["CODEX_HOME"]?.trim() ||
|
|
94252
|
-
return
|
|
94383
|
+
const codexHome = env3["CODEX_HOME"]?.trim() || join81(homedir26(), ".codex");
|
|
94384
|
+
return join81(codexHome, "app-server-control", "app-server-control.sock");
|
|
94253
94385
|
}
|
|
94254
94386
|
function resolveAppServerTimeoutMs(env3) {
|
|
94255
94387
|
const parsed = Number.parseInt(env3["OMO_SPARKSHELL_APP_SERVER_TIMEOUT_MS"]?.trim() ?? "", 10);
|
|
@@ -94821,7 +94953,7 @@ function isLowSurrogate(codeUnit) {
|
|
|
94821
94953
|
init_src();
|
|
94822
94954
|
import { existsSync as existsSync64, readdirSync as readdirSync10, readFileSync as readFileSync42 } from "fs";
|
|
94823
94955
|
import { homedir as homedir27 } from "os";
|
|
94824
|
-
import { join as
|
|
94956
|
+
import { join as join82 } from "path";
|
|
94825
94957
|
var SPARKSHELL_SESSION_CONTEXT_ENV = "OMO_SPARKSHELL_SESSION_CONTEXT";
|
|
94826
94958
|
var SPARKSHELL_SESSION_ID_ENV = "OMO_SPARKSHELL_SESSION_ID";
|
|
94827
94959
|
var CODEX_THREAD_ID_ENV = "CODEX_THREAD_ID";
|
|
@@ -94837,8 +94969,8 @@ function findRolloutPath(sessionId, env3, deps = {}) {
|
|
|
94837
94969
|
const fileExists = deps.fileExists ?? existsSync64;
|
|
94838
94970
|
const listDirectory = deps.listDirectory ?? ((path16) => readdirSync10(path16));
|
|
94839
94971
|
const homeDirectory = deps.homeDirectory ?? homedir27;
|
|
94840
|
-
const codexHome = env3["CODEX_HOME"]?.trim() ||
|
|
94841
|
-
const roots = [
|
|
94972
|
+
const codexHome = env3["CODEX_HOME"]?.trim() || join82(homeDirectory(), ".codex");
|
|
94973
|
+
const roots = [join82(codexHome, "sessions"), join82(codexHome, "archived_sessions")];
|
|
94842
94974
|
const fileSuffix = `-${sessionId}.jsonl`;
|
|
94843
94975
|
const scanDay = (dayDir) => {
|
|
94844
94976
|
if (!fileExists(dayDir)) {
|
|
@@ -94846,14 +94978,14 @@ function findRolloutPath(sessionId, env3, deps = {}) {
|
|
|
94846
94978
|
}
|
|
94847
94979
|
for (const name of listSafely(listDirectory, dayDir)) {
|
|
94848
94980
|
if (name.startsWith("rollout-") && name.endsWith(fileSuffix)) {
|
|
94849
|
-
return
|
|
94981
|
+
return join82(dayDir, name);
|
|
94850
94982
|
}
|
|
94851
94983
|
}
|
|
94852
94984
|
return null;
|
|
94853
94985
|
};
|
|
94854
94986
|
for (const dayDir of uuidV7DayDirCandidates(sessionId)) {
|
|
94855
94987
|
for (const root of roots) {
|
|
94856
|
-
const found = scanDay(
|
|
94988
|
+
const found = scanDay(join82(root, dayDir));
|
|
94857
94989
|
if (found) {
|
|
94858
94990
|
return found;
|
|
94859
94991
|
}
|
|
@@ -94864,9 +94996,9 @@ function findRolloutPath(sessionId, env3, deps = {}) {
|
|
|
94864
94996
|
continue;
|
|
94865
94997
|
}
|
|
94866
94998
|
for (const year of numericNamesDescending(listSafely(listDirectory, root))) {
|
|
94867
|
-
for (const month of numericNamesDescending(listSafely(listDirectory,
|
|
94868
|
-
for (const day of numericNamesDescending(listSafely(listDirectory,
|
|
94869
|
-
const found = scanDay(
|
|
94999
|
+
for (const month of numericNamesDescending(listSafely(listDirectory, join82(root, year)))) {
|
|
95000
|
+
for (const day of numericNamesDescending(listSafely(listDirectory, join82(root, year, month)))) {
|
|
95001
|
+
const found = scanDay(join82(root, year, month, day));
|
|
94870
95002
|
if (found) {
|
|
94871
95003
|
return found;
|
|
94872
95004
|
}
|
|
@@ -95026,7 +95158,7 @@ function uuidV7DayDirCandidates(sessionId) {
|
|
|
95026
95158
|
const candidates = [];
|
|
95027
95159
|
for (const offsetDays of [0, 1, -1]) {
|
|
95028
95160
|
const date5 = new Date(ms + offsetDays * DAY_MS);
|
|
95029
|
-
candidates.push(
|
|
95161
|
+
candidates.push(join82(String(date5.getFullYear()), pad2(date5.getMonth() + 1), pad2(date5.getDate())));
|
|
95030
95162
|
}
|
|
95031
95163
|
return candidates;
|
|
95032
95164
|
}
|
|
@@ -95067,7 +95199,7 @@ function isFalsy2(value) {
|
|
|
95067
95199
|
import { spawnSync as spawnSync3 } from "child_process";
|
|
95068
95200
|
import { mkdtempSync, readFileSync as readFileSync43, rmSync as rmSync4 } from "fs";
|
|
95069
95201
|
import { tmpdir as tmpdir4 } from "os";
|
|
95070
|
-
import { join as
|
|
95202
|
+
import { join as join83 } from "path";
|
|
95071
95203
|
var SPARKSHELL_SPARK_ENV = "OMO_SPARKSHELL_SPARK";
|
|
95072
95204
|
var SPARKSHELL_SPARK_MODEL_ENV = "OMO_SPARKSHELL_SPARK_MODEL";
|
|
95073
95205
|
var SPARKSHELL_SPARK_TIMEOUT_ENV = "OMO_SPARKSHELL_SPARK_TIMEOUT_MS";
|
|
@@ -95141,8 +95273,8 @@ function buildSparkExecArgs(env3, lastMessagePath) {
|
|
|
95141
95273
|
function createDefaultSparkSummarizer(env3, cwd) {
|
|
95142
95274
|
return (request) => {
|
|
95143
95275
|
const binary = env3[SPARKSHELL_SPARK_BIN_ENV]?.trim() || "codex";
|
|
95144
|
-
const tempDir = mkdtempSync(
|
|
95145
|
-
const lastMessagePath =
|
|
95276
|
+
const tempDir = mkdtempSync(join83(tmpdir4(), "omo-sparkshell-spark-"));
|
|
95277
|
+
const lastMessagePath = join83(tempDir, "last-message.txt");
|
|
95146
95278
|
try {
|
|
95147
95279
|
const result = spawnSync3(binary, [...buildSparkExecArgs(env3, lastMessagePath)], {
|
|
95148
95280
|
cwd,
|