oh-my-opencode 4.11.1 → 4.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.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 +460 -309
- package/dist/cli-node/index.js +460 -309
- 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 +593 -310
- package/dist/plugin/tool-execute-before.d.ts +2 -0
- package/dist/plugin-handlers/plugin-components-loader.d.ts +1 -0
- package/dist/skills/ultraresearch/SKILL.md +11 -2
- 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/background-task/constants.d.ts +1 -1
- 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 +25 -10
- package/package.json +13 -13
- package/packages/omo-codex/plugin/.codex-plugin/plugin.json +24 -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 +336 -173
- package/packages/omo-codex/plugin/components/codegraph/dist/serve.js +284 -33
- package/packages/omo-codex/plugin/components/codegraph/package.json +1 -1
- package/packages/omo-codex/plugin/components/codegraph/src/cli.ts +11 -0
- package/packages/omo-codex/plugin/components/codegraph/src/hook-types.ts +12 -0
- package/packages/omo-codex/plugin/components/codegraph/src/hook.ts +34 -0
- package/packages/omo-codex/plugin/components/codegraph/src/serve.ts +47 -5
- package/packages/omo-codex/plugin/components/codegraph/src/session-start-worker.ts +7 -5
- package/packages/omo-codex/plugin/components/codegraph/test/hook.test.ts +58 -96
- 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/codegraph/test/serve-provision.test.ts +48 -0
- package/packages/omo-codex/plugin/components/codegraph/test/serve.test.ts +1 -0
- package/packages/omo-codex/plugin/components/codegraph/test/session-start-node-support.test.ts +142 -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/dist/cli.js +94 -0
- package/packages/omo-codex/plugin/components/teammode/hooks/hooks.json +17 -0
- package/packages/omo-codex/plugin/components/teammode/package.json +26 -0
- 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/teammode/src/cli.ts +12 -0
- package/packages/omo-codex/plugin/components/teammode/src/codex-hook.ts +125 -0
- package/packages/omo-codex/plugin/components/teammode/test/thread-title-hook.test.ts +116 -0
- package/packages/omo-codex/plugin/components/teammode/tsconfig.json +25 -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-codegraph-init-guidance.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-checking-thread-title-hygiene.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 +30 -22
- package/packages/omo-codex/plugin/package.json +2 -1
- package/packages/omo-codex/plugin/scripts/hook-status-message.mjs +15 -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/SKILL.md +11 -2
- 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 +70 -33
- package/packages/omo-codex/plugin/test/aggregate-manifest.test.mjs +6 -2
- package/packages/omo-codex/plugin/test/aggregate-plugin-fixture.mjs +14 -1
- 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 +4 -3
- package/packages/omo-codex/plugin/test/component-hook-contract-cases.mjs +24 -0
- package/packages/omo-codex/plugin/test/display-metadata.test.mjs +83 -0
- package/packages/omo-codex/plugin/test/hook-status-message.test.mjs +31 -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/plugin/test/ultraresearch-skill-contract.test.mjs +48 -0
- package/packages/omo-codex/scripts/install-dist/install-local.mjs +398 -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/ultraresearch/SKILL.md +11 -2
- 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.1",
|
|
2149
2149
|
description: "The Best AI Agent Harness - Batteries-Included OpenCode Plugin with Multi-Model Orchestration, Parallel Background Agents, and Crafted LSP/AST Tools",
|
|
2150
2150
|
main: "./dist/index.js",
|
|
2151
2151
|
types: "dist/index.d.ts",
|
|
@@ -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.1",
|
|
2319
|
+
"oh-my-opencode-darwin-x64": "4.12.1",
|
|
2320
|
+
"oh-my-opencode-darwin-x64-baseline": "4.12.1",
|
|
2321
|
+
"oh-my-opencode-linux-arm64": "4.12.1",
|
|
2322
|
+
"oh-my-opencode-linux-arm64-musl": "4.12.1",
|
|
2323
|
+
"oh-my-opencode-linux-x64": "4.12.1",
|
|
2324
|
+
"oh-my-opencode-linux-x64-baseline": "4.12.1",
|
|
2325
|
+
"oh-my-opencode-linux-x64-musl": "4.12.1",
|
|
2326
|
+
"oh-my-opencode-linux-x64-musl-baseline": "4.12.1",
|
|
2327
|
+
"oh-my-opencode-windows-arm64": "4.12.1",
|
|
2328
|
+
"oh-my-opencode-windows-x64": "4.12.1",
|
|
2329
|
+
"oh-my-opencode-windows-x64-baseline": "4.12.1"
|
|
2330
2330
|
},
|
|
2331
2331
|
overrides: {
|
|
2332
2332
|
hono: "^4.12.18",
|
|
@@ -7370,6 +7370,14 @@ var init_classify_path_environment = () => {};
|
|
|
7370
7370
|
|
|
7371
7371
|
// packages/utils/src/codegraph/env.ts
|
|
7372
7372
|
var init_env = () => {};
|
|
7373
|
+
|
|
7374
|
+
// packages/utils/src/codegraph/workspace.ts
|
|
7375
|
+
var init_workspace = () => {};
|
|
7376
|
+
|
|
7377
|
+
// packages/utils/src/codegraph/guidance.ts
|
|
7378
|
+
var init_guidance = __esm(() => {
|
|
7379
|
+
init_workspace();
|
|
7380
|
+
});
|
|
7373
7381
|
// packages/utils/src/codegraph/manifest.ts
|
|
7374
7382
|
var init_manifest = () => {};
|
|
7375
7383
|
|
|
@@ -7390,12 +7398,10 @@ var init_resolve2 = __esm(() => {
|
|
|
7390
7398
|
requireFromHere = createRequire(import.meta.url);
|
|
7391
7399
|
});
|
|
7392
7400
|
|
|
7393
|
-
// packages/utils/src/codegraph/workspace.ts
|
|
7394
|
-
var init_workspace = () => {};
|
|
7395
|
-
|
|
7396
7401
|
// packages/utils/src/codegraph/index.ts
|
|
7397
7402
|
var init_codegraph = __esm(() => {
|
|
7398
7403
|
init_env();
|
|
7404
|
+
init_guidance();
|
|
7399
7405
|
init_provision();
|
|
7400
7406
|
init_resolve2();
|
|
7401
7407
|
init_workspace();
|
|
@@ -56795,7 +56801,7 @@ async function probe(registration) {
|
|
|
56795
56801
|
registration.available = false;
|
|
56796
56802
|
return false;
|
|
56797
56803
|
}
|
|
56798
|
-
const probeUrl = new URL("/
|
|
56804
|
+
const probeUrl = new URL("/global/health", registration.serverUrl);
|
|
56799
56805
|
const authHeader = getServerBasicAuthHeader();
|
|
56800
56806
|
const headers = authHeader ? { Authorization: authHeader } : {};
|
|
56801
56807
|
try {
|
|
@@ -56829,12 +56835,17 @@ async function probe(registration) {
|
|
|
56829
56835
|
return false;
|
|
56830
56836
|
}
|
|
56831
56837
|
}
|
|
56832
|
-
function
|
|
56833
|
-
|
|
56838
|
+
function getFreshProbeAvailability(registration) {
|
|
56839
|
+
const available = registration.available;
|
|
56840
|
+
if (available === undefined || Date.now() - registration.probeTimestamp >= PROBE_TTL_MS) {
|
|
56841
|
+
return;
|
|
56842
|
+
}
|
|
56843
|
+
return available;
|
|
56834
56844
|
}
|
|
56835
56845
|
async function resolveAvailability(registration) {
|
|
56836
|
-
|
|
56837
|
-
|
|
56846
|
+
const freshAvailability = getFreshProbeAvailability(registration);
|
|
56847
|
+
if (freshAvailability !== undefined) {
|
|
56848
|
+
return freshAvailability;
|
|
56838
56849
|
}
|
|
56839
56850
|
if (!registration.inFlightProbe) {
|
|
56840
56851
|
registration.inFlightProbe = probe(registration).finally(() => {
|
|
@@ -56869,10 +56880,11 @@ function tryResolveDispatchClientSync2(client3, sessionID) {
|
|
|
56869
56880
|
if (!registration.serverUrl) {
|
|
56870
56881
|
return { client: client3, route: "in-process", reason: "unavailable" };
|
|
56871
56882
|
}
|
|
56872
|
-
|
|
56883
|
+
const freshAvailability = getFreshProbeAvailability(registration);
|
|
56884
|
+
if (freshAvailability === undefined) {
|
|
56873
56885
|
return;
|
|
56874
56886
|
}
|
|
56875
|
-
if (!
|
|
56887
|
+
if (!freshAvailability) {
|
|
56876
56888
|
return { client: client3, route: "in-process", reason: "unavailable" };
|
|
56877
56889
|
}
|
|
56878
56890
|
const resolvedLiveClient = getOrBuildLiveClient(registration);
|
|
@@ -56887,6 +56899,9 @@ async function resolveDispatchClient2(client3, sessionID) {
|
|
|
56887
56899
|
return syncResult;
|
|
56888
56900
|
}
|
|
56889
56901
|
const registration = registrations.get(client3);
|
|
56902
|
+
if (!registration) {
|
|
56903
|
+
return { client: client3, route: "in-process", reason: "identity" };
|
|
56904
|
+
}
|
|
56890
56905
|
const isAvailable = await resolveAvailability(registration);
|
|
56891
56906
|
if (!isAvailable) {
|
|
56892
56907
|
return { client: client3, route: "in-process", reason: "unavailable" };
|
|
@@ -58882,20 +58897,20 @@ var init_config_manager = __esm(() => {
|
|
|
58882
58897
|
|
|
58883
58898
|
// packages/telemetry-core/src/activity-state.ts
|
|
58884
58899
|
import { existsSync as existsSync27, mkdirSync as mkdirSync8, readFileSync as readFileSync13 } from "fs";
|
|
58885
|
-
import { basename as basename9, join as
|
|
58900
|
+
import { basename as basename9, join as join48 } from "path";
|
|
58886
58901
|
function resolveTelemetryStateDir(product, options = {}) {
|
|
58887
58902
|
const dataDir = resolveXdgDataDir(product.cacheDirName, {
|
|
58888
58903
|
env: options.env,
|
|
58889
58904
|
osProvider: options.osProvider
|
|
58890
58905
|
});
|
|
58891
|
-
const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined :
|
|
58906
|
+
const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined : join48(options.env.XDG_DATA_HOME, product.cacheDirName);
|
|
58892
58907
|
if (dataDir === xdgStateDir || xdgStateDir === undefined && basename9(dataDir) === product.cacheDirName) {
|
|
58893
58908
|
return dataDir;
|
|
58894
58909
|
}
|
|
58895
|
-
return
|
|
58910
|
+
return join48(dataDir, product.cacheDirName);
|
|
58896
58911
|
}
|
|
58897
58912
|
function getTelemetryActivityStateFilePath(stateDir) {
|
|
58898
|
-
return
|
|
58913
|
+
return join48(stateDir, POSTHOG_ACTIVITY_STATE_FILE);
|
|
58899
58914
|
}
|
|
58900
58915
|
function getDailyActiveCaptureState(input) {
|
|
58901
58916
|
const state = readPostHogActivityState(input.stateDir, input.diagnostics);
|
|
@@ -58966,9 +58981,9 @@ var DEFAULT_POSTHOG_HOST = "https://us.i.posthog.com", DEFAULT_POSTHOG_API_KEY =
|
|
|
58966
58981
|
|
|
58967
58982
|
// packages/telemetry-core/src/diagnostics.ts
|
|
58968
58983
|
import { appendFileSync as appendFileSync2, existsSync as existsSync28, mkdirSync as mkdirSync9, readFileSync as readFileSync14 } from "fs";
|
|
58969
|
-
import { join as
|
|
58984
|
+
import { join as join49 } from "path";
|
|
58970
58985
|
function getTelemetryDiagnosticsFilePath(diagnosticsDir) {
|
|
58971
|
-
return
|
|
58986
|
+
return join49(diagnosticsDir, DIAGNOSTICS_FILE_NAME);
|
|
58972
58987
|
}
|
|
58973
58988
|
function writeTelemetryDiagnostic(input, options) {
|
|
58974
58989
|
const now = options.now ?? new Date;
|
|
@@ -59134,7 +59149,7 @@ function getTelemetryDistinctId(machineIdPrefix, osProvider = getDefaultTelemetr
|
|
|
59134
59149
|
var init_machine_id = () => {};
|
|
59135
59150
|
|
|
59136
59151
|
// 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
|
|
59152
|
+
import { dirname as dirname15, posix as posix2, sep as sep7 } from "path";
|
|
59138
59153
|
function createModulerModifier() {
|
|
59139
59154
|
const getModuleFromFileName = createGetModuleFromFilename();
|
|
59140
59155
|
return async (frames) => {
|
|
@@ -59143,7 +59158,7 @@ function createModulerModifier() {
|
|
|
59143
59158
|
return frames;
|
|
59144
59159
|
};
|
|
59145
59160
|
}
|
|
59146
|
-
function createGetModuleFromFilename(basePath = process.argv[1] ? dirname15(process.argv[1]) : process.cwd(), isWindows =
|
|
59161
|
+
function createGetModuleFromFilename(basePath = process.argv[1] ? dirname15(process.argv[1]) : process.cwd(), isWindows = sep7 === "\\") {
|
|
59147
59162
|
const normalizedBase = isWindows ? normalizeWindowsPath(basePath) : basePath;
|
|
59148
59163
|
return (filename) => {
|
|
59149
59164
|
if (!filename)
|
|
@@ -62164,9 +62179,9 @@ var init_context_lines_node = __esm(() => {
|
|
|
62164
62179
|
});
|
|
62165
62180
|
|
|
62166
62181
|
// 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
|
|
62182
|
+
import { isAbsolute as isAbsolute7, relative as relative5, sep as sep8 } from "path";
|
|
62168
62183
|
function createRelativePathModifier(basePath = process.cwd()) {
|
|
62169
|
-
const isWindows =
|
|
62184
|
+
const isWindows = sep8 === "\\";
|
|
62170
62185
|
const toUnix = (p) => isWindows ? p.replace(/\\/g, "/") : p;
|
|
62171
62186
|
const normalizedBase = toUnix(basePath);
|
|
62172
62187
|
return async (frames) => {
|
|
@@ -64693,7 +64708,7 @@ var package_default2;
|
|
|
64693
64708
|
var init_package2 = __esm(() => {
|
|
64694
64709
|
package_default2 = {
|
|
64695
64710
|
name: "@oh-my-opencode/omo-codex",
|
|
64696
|
-
version: "4.
|
|
64711
|
+
version: "4.12.1",
|
|
64697
64712
|
type: "module",
|
|
64698
64713
|
private: true,
|
|
64699
64714
|
description: "Codex harness adapter for oh-my-openagent. Vendored Codex plugin namespace (omo) + TypeScript installer + telemetry.",
|
|
@@ -65663,7 +65678,7 @@ var init_update_toasts = __esm(() => {
|
|
|
65663
65678
|
|
|
65664
65679
|
// packages/omo-opencode/src/hooks/auto-update-checker/hook/background-update-check.ts
|
|
65665
65680
|
import { existsSync as existsSync47 } from "fs";
|
|
65666
|
-
import { dirname as dirname23, join as
|
|
65681
|
+
import { dirname as dirname23, join as join65 } from "path";
|
|
65667
65682
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
65668
65683
|
function defaultGetModuleHostingWorkspace() {
|
|
65669
65684
|
try {
|
|
@@ -65817,7 +65832,7 @@ var init_background_update_check = __esm(() => {
|
|
|
65817
65832
|
init_update_toasts();
|
|
65818
65833
|
defaultDeps4 = {
|
|
65819
65834
|
existsSync: existsSync47,
|
|
65820
|
-
join:
|
|
65835
|
+
join: join65,
|
|
65821
65836
|
runBunInstallWithDetails,
|
|
65822
65837
|
log: log2,
|
|
65823
65838
|
getOpenCodeCacheDir,
|
|
@@ -66419,7 +66434,7 @@ function getUnsupportedOpenCodeVersionMessage(openCodeVersion) {
|
|
|
66419
66434
|
}
|
|
66420
66435
|
|
|
66421
66436
|
// packages/omo-codex/src/install/install-codex.ts
|
|
66422
|
-
import { join as
|
|
66437
|
+
import { join as join50, resolve as resolve14 } from "path";
|
|
66423
66438
|
import { existsSync as existsSync29 } from "fs";
|
|
66424
66439
|
import { homedir as homedir6 } from "os";
|
|
66425
66440
|
|
|
@@ -66783,8 +66798,8 @@ async function existingNonSymlink(path7) {
|
|
|
66783
66798
|
}
|
|
66784
66799
|
}
|
|
66785
66800
|
// 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
|
|
66801
|
+
import { cp as cp2, mkdir as mkdir3, readFile as readFile7, rename, rm as rm3 } from "fs/promises";
|
|
66802
|
+
import { basename as basename6, dirname as dirname11, join as join31, sep as sep5 } from "path";
|
|
66788
66803
|
|
|
66789
66804
|
// packages/omo-codex/src/install/codex-cache-bundled-mcps.ts
|
|
66790
66805
|
import { cp, mkdir as mkdir2, readFile as readFile3, stat as stat2 } from "fs/promises";
|
|
@@ -67122,13 +67137,83 @@ async function rewriteCachedManifestRoot(pluginRoot, fromRoot, toRoot) {
|
|
|
67122
67137
|
`);
|
|
67123
67138
|
}
|
|
67124
67139
|
|
|
67140
|
+
// packages/omo-codex/src/install/codex-hook-targets.ts
|
|
67141
|
+
import { readFile as readFile6 } from "fs/promises";
|
|
67142
|
+
import { join as join30, sep as sep4 } from "path";
|
|
67143
|
+
var PLUGIN_ROOT_TARGET_PATTERN = /\$\{PLUGIN_ROOT\}[\\/]+([^"']+)/g;
|
|
67144
|
+
async function findMissingHookCommandTargets(pluginRoot) {
|
|
67145
|
+
const commands = [];
|
|
67146
|
+
for (const manifestPath of await hookManifestPaths(pluginRoot)) {
|
|
67147
|
+
if (!await fileExistsStrict(manifestPath))
|
|
67148
|
+
continue;
|
|
67149
|
+
const parsed = JSON.parse(await readFile6(manifestPath, "utf8"));
|
|
67150
|
+
collectCommands(parsed, commands);
|
|
67151
|
+
}
|
|
67152
|
+
const missing = [];
|
|
67153
|
+
const seen = new Set;
|
|
67154
|
+
for (const command of commands) {
|
|
67155
|
+
for (const match of command.matchAll(PLUGIN_ROOT_TARGET_PATTERN)) {
|
|
67156
|
+
const targetSuffix = match[1];
|
|
67157
|
+
if (targetSuffix === undefined)
|
|
67158
|
+
continue;
|
|
67159
|
+
const target = join30(pluginRoot, ...targetSuffix.split(/[\\/]+/));
|
|
67160
|
+
if (seen.has(target))
|
|
67161
|
+
continue;
|
|
67162
|
+
seen.add(target);
|
|
67163
|
+
if (!await fileExistsStrict(target))
|
|
67164
|
+
missing.push(target);
|
|
67165
|
+
}
|
|
67166
|
+
}
|
|
67167
|
+
return missing;
|
|
67168
|
+
}
|
|
67169
|
+
async function hookManifestPaths(pluginRoot) {
|
|
67170
|
+
const pluginManifestPath = join30(pluginRoot, ".codex-plugin", "plugin.json");
|
|
67171
|
+
if (!await fileExistsStrict(pluginManifestPath))
|
|
67172
|
+
return [join30(pluginRoot, "hooks", "hooks.json")];
|
|
67173
|
+
const parsed = JSON.parse(await readFile6(pluginManifestPath, "utf8"));
|
|
67174
|
+
if (!isPlainRecord3(parsed))
|
|
67175
|
+
return [];
|
|
67176
|
+
if (typeof parsed.hooks === "string" && parsed.hooks.trim() !== "") {
|
|
67177
|
+
return [join30(pluginRoot, stripDotSlash(parsed.hooks))];
|
|
67178
|
+
}
|
|
67179
|
+
if (Array.isArray(parsed.hooks)) {
|
|
67180
|
+
return parsed.hooks.filter((hookPath) => typeof hookPath === "string" && hookPath.trim() !== "").map((hookPath) => join30(pluginRoot, stripDotSlash(hookPath)));
|
|
67181
|
+
}
|
|
67182
|
+
return [];
|
|
67183
|
+
}
|
|
67184
|
+
function stripDotSlash(path7) {
|
|
67185
|
+
return path7.startsWith("./") ? path7.slice(2) : path7;
|
|
67186
|
+
}
|
|
67187
|
+
async function assertHookCommandTargets(pluginRoot) {
|
|
67188
|
+
const missing = await findMissingHookCommandTargets(pluginRoot);
|
|
67189
|
+
if (missing.length === 0)
|
|
67190
|
+
return;
|
|
67191
|
+
const relativeMissing = missing.map((path7) => path7.split(`${pluginRoot}${sep4}`).join("").split(sep4).join("/"));
|
|
67192
|
+
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.");
|
|
67193
|
+
}
|
|
67194
|
+
function collectCommands(value, commands) {
|
|
67195
|
+
if (Array.isArray(value)) {
|
|
67196
|
+
for (const entry of value)
|
|
67197
|
+
collectCommands(entry, commands);
|
|
67198
|
+
return;
|
|
67199
|
+
}
|
|
67200
|
+
if (!isPlainRecord3(value))
|
|
67201
|
+
return;
|
|
67202
|
+
if (value["type"] === "command" && typeof value["command"] === "string")
|
|
67203
|
+
commands.push(value["command"]);
|
|
67204
|
+
if (value["type"] === "command" && typeof value["commandWindows"] === "string")
|
|
67205
|
+
commands.push(value["commandWindows"]);
|
|
67206
|
+
for (const entry of Object.values(value))
|
|
67207
|
+
collectCommands(entry, commands);
|
|
67208
|
+
}
|
|
67209
|
+
|
|
67125
67210
|
// packages/omo-codex/src/install/codex-cache-install.ts
|
|
67126
67211
|
async function installCachedPlugin(input) {
|
|
67127
67212
|
if (input.buildSource !== false) {
|
|
67128
67213
|
await maybeRunNpmInstall(input.sourcePath, input.runCommand);
|
|
67129
67214
|
await maybeRunNpmBuild(input.sourcePath, input.runCommand);
|
|
67130
67215
|
}
|
|
67131
|
-
const targetPath =
|
|
67216
|
+
const targetPath = join31(input.codexHome, "plugins", "cache", input.marketplaceName, input.name, input.version);
|
|
67132
67217
|
const tempPath = createTempSiblingPath(targetPath);
|
|
67133
67218
|
await rm3(tempPath, { recursive: true, force: true });
|
|
67134
67219
|
try {
|
|
@@ -67136,8 +67221,11 @@ async function installCachedPlugin(input) {
|
|
|
67136
67221
|
await rewriteCachedPackageLocalFileDependencies(tempPath, input.sourcePath);
|
|
67137
67222
|
await copyBundledMcpRuntimeDists({ pluginRoot: tempPath, sourceRoot: input.sourcePath });
|
|
67138
67223
|
await maybeRunNpmInstall(tempPath, input.runCommand, ["ci", "--omit=dev"]);
|
|
67224
|
+
if (input.buildSource === false)
|
|
67225
|
+
await maybeRunNpmSyncSkills(tempPath, input.runCommand);
|
|
67139
67226
|
await rewriteCachedMcpManifest(tempPath, input.sourcePath);
|
|
67140
67227
|
await rewriteCachedManifestRoot(tempPath, tempPath, targetPath);
|
|
67228
|
+
await assertHookCommandTargets(tempPath);
|
|
67141
67229
|
await promoteDirectory(tempPath, targetPath, input.renameDirectory ?? rename);
|
|
67142
67230
|
} catch (error) {
|
|
67143
67231
|
await rm3(tempPath, { recursive: true, force: true });
|
|
@@ -67146,14 +67234,14 @@ async function installCachedPlugin(input) {
|
|
|
67146
67234
|
return { name: input.name, version: input.version, path: targetPath };
|
|
67147
67235
|
}
|
|
67148
67236
|
async function maybeRunNpmInstall(cwd, runCommand, args = ["install"]) {
|
|
67149
|
-
if (!await fileExistsStrict(
|
|
67237
|
+
if (!await fileExistsStrict(join31(cwd, "package.json")))
|
|
67150
67238
|
return;
|
|
67151
67239
|
await runCommand("npm", args, { cwd });
|
|
67152
67240
|
}
|
|
67153
67241
|
async function maybeRunNpmBuild(cwd, runCommand) {
|
|
67154
|
-
if (!await fileExistsStrict(
|
|
67242
|
+
if (!await fileExistsStrict(join31(cwd, "package.json")))
|
|
67155
67243
|
return;
|
|
67156
|
-
const packageJson = JSON.parse(await
|
|
67244
|
+
const packageJson = JSON.parse(await readFile7(join31(cwd, "package.json"), "utf8"));
|
|
67157
67245
|
if (!isPlainRecord3(packageJson))
|
|
67158
67246
|
return;
|
|
67159
67247
|
const scripts = packageJson.scripts;
|
|
@@ -67161,11 +67249,22 @@ async function maybeRunNpmBuild(cwd, runCommand) {
|
|
|
67161
67249
|
return;
|
|
67162
67250
|
await runCommand("npm", ["run", "build"], { cwd });
|
|
67163
67251
|
}
|
|
67252
|
+
async function maybeRunNpmSyncSkills(cwd, runCommand) {
|
|
67253
|
+
if (!await fileExistsStrict(join31(cwd, "package.json")))
|
|
67254
|
+
return;
|
|
67255
|
+
const packageJson = JSON.parse(await readFile7(join31(cwd, "package.json"), "utf8"));
|
|
67256
|
+
if (!isPlainRecord3(packageJson))
|
|
67257
|
+
return;
|
|
67258
|
+
const scripts = packageJson.scripts;
|
|
67259
|
+
if (!isPlainRecord3(scripts) || typeof scripts["sync:skills"] !== "string")
|
|
67260
|
+
return;
|
|
67261
|
+
await runCommand("npm", ["run", "sync:skills"], { cwd });
|
|
67262
|
+
}
|
|
67164
67263
|
function createTempSiblingPath(targetPath) {
|
|
67165
|
-
return
|
|
67264
|
+
return join31(dirname11(targetPath), `.tmp-${basename6(targetPath)}-${process.pid}-${Date.now()}`);
|
|
67166
67265
|
}
|
|
67167
67266
|
function createBackupSiblingPath(targetPath) {
|
|
67168
|
-
return
|
|
67267
|
+
return join31(dirname11(targetPath), `.backup-${basename6(targetPath)}-${process.pid}-${Date.now()}`);
|
|
67169
67268
|
}
|
|
67170
67269
|
async function copyDirectory(sourcePath, targetPath) {
|
|
67171
67270
|
await mkdir3(dirname11(targetPath), { recursive: true });
|
|
@@ -67196,17 +67295,17 @@ async function restoreBackupDirectory(backupPath, targetPath, renameDirectory) {
|
|
|
67196
67295
|
await renameDirectory(backupPath, targetPath);
|
|
67197
67296
|
}
|
|
67198
67297
|
function shouldCopyPluginPath(path7, root) {
|
|
67199
|
-
const relative5 = path7 === root ? "" : path7.slice(root.length +
|
|
67298
|
+
const relative5 = path7 === root ? "" : path7.slice(root.length + sep5.length);
|
|
67200
67299
|
if (relative5 === "")
|
|
67201
67300
|
return true;
|
|
67202
|
-
const parts = relative5.split(
|
|
67301
|
+
const parts = relative5.split(sep5);
|
|
67203
67302
|
return !parts.some((part) => part === ".git" || part === "node_modules");
|
|
67204
67303
|
}
|
|
67205
67304
|
// packages/omo-codex/src/install/codex-cache-prune.ts
|
|
67206
67305
|
import { lstat as lstat4, readdir as readdir3, rm as rm4, stat as stat3 } from "fs/promises";
|
|
67207
|
-
import { join as
|
|
67306
|
+
import { join as join32 } from "path";
|
|
67208
67307
|
async function pruneMarketplaceCache(input) {
|
|
67209
|
-
const cacheRoot =
|
|
67308
|
+
const cacheRoot = join32(input.codexHome, "plugins", "cache", input.marketplaceName);
|
|
67210
67309
|
if (!await fileExistsStrict(cacheRoot))
|
|
67211
67310
|
return;
|
|
67212
67311
|
const keep = new Set(input.keepPluginNames);
|
|
@@ -67214,15 +67313,15 @@ async function pruneMarketplaceCache(input) {
|
|
|
67214
67313
|
for (const entry of entries) {
|
|
67215
67314
|
if (!entry.isDirectory() || keep.has(entry.name))
|
|
67216
67315
|
continue;
|
|
67217
|
-
await rm4(
|
|
67316
|
+
await rm4(join32(cacheRoot, entry.name), { recursive: true, force: true });
|
|
67218
67317
|
}
|
|
67219
67318
|
}
|
|
67220
67319
|
async function pruneMarketplacePluginCaches(input) {
|
|
67221
|
-
const cacheRoot =
|
|
67320
|
+
const cacheRoot = join32(input.codexHome, "plugins", "cache", input.marketplaceName);
|
|
67222
67321
|
if (!await fileExistsStrict(cacheRoot))
|
|
67223
67322
|
return;
|
|
67224
67323
|
for (const pluginName of input.pluginNames) {
|
|
67225
|
-
await rm4(
|
|
67324
|
+
await rm4(join32(cacheRoot, pluginName), { recursive: true, force: true });
|
|
67226
67325
|
}
|
|
67227
67326
|
const remainingEntries = await readCacheEntryNames(cacheRoot);
|
|
67228
67327
|
if (remainingEntries.length === 0) {
|
|
@@ -67269,11 +67368,11 @@ async function isBrokenCacheSymlink(path7) {
|
|
|
67269
67368
|
}
|
|
67270
67369
|
// packages/omo-codex/src/install/codex-cached-marketplace-manifest.ts
|
|
67271
67370
|
import { mkdir as mkdir4, writeFile as writeFile4 } from "fs/promises";
|
|
67272
|
-
import { join as
|
|
67371
|
+
import { join as join33 } from "path";
|
|
67273
67372
|
async function writeCachedMarketplaceManifest(input) {
|
|
67274
|
-
const marketplaceDir =
|
|
67373
|
+
const marketplaceDir = join33(input.marketplaceRoot, ".agents", "plugins");
|
|
67275
67374
|
await mkdir4(marketplaceDir, { recursive: true });
|
|
67276
|
-
await writeFile4(
|
|
67375
|
+
await writeFile4(join33(marketplaceDir, "marketplace.json"), `${JSON.stringify({
|
|
67277
67376
|
name: input.marketplaceName,
|
|
67278
67377
|
plugins: input.plugins.map((plugin) => ({
|
|
67279
67378
|
name: plugin.name,
|
|
@@ -67285,8 +67384,8 @@ async function writeCachedMarketplaceManifest(input) {
|
|
|
67285
67384
|
|
|
67286
67385
|
// packages/omo-codex/src/install/codex-package-layout.ts
|
|
67287
67386
|
import { existsSync as existsSync26 } from "fs";
|
|
67288
|
-
import { readFile as
|
|
67289
|
-
import { join as
|
|
67387
|
+
import { readFile as readFile8 } from "fs/promises";
|
|
67388
|
+
import { join as join34 } from "path";
|
|
67290
67389
|
var PACKAGED_CODEX_INSTALLER_NAMES = new Set([
|
|
67291
67390
|
"@code-yeongyu/lazycodex",
|
|
67292
67391
|
"@code-yeongyu/lazycodex-ai",
|
|
@@ -67296,19 +67395,19 @@ var PACKAGED_CODEX_INSTALLER_NAMES = new Set([
|
|
|
67296
67395
|
"oh-my-openagent"
|
|
67297
67396
|
]);
|
|
67298
67397
|
async function shouldBuildSourcePackages(repoRoot) {
|
|
67299
|
-
if (existsSync26(
|
|
67398
|
+
if (existsSync26(join34(repoRoot, "packages", "omo-opencode", "src", "index.ts")))
|
|
67300
67399
|
return true;
|
|
67301
|
-
const packageJsonPath =
|
|
67400
|
+
const packageJsonPath = join34(repoRoot, "package.json");
|
|
67302
67401
|
if (!existsSync26(packageJsonPath))
|
|
67303
67402
|
return true;
|
|
67304
|
-
const packageJson = JSON.parse(await
|
|
67403
|
+
const packageJson = JSON.parse(await readFile8(packageJsonPath, "utf8"));
|
|
67305
67404
|
if (!isPlainRecord3(packageJson) || typeof packageJson.name !== "string")
|
|
67306
67405
|
return true;
|
|
67307
67406
|
return !PACKAGED_CODEX_INSTALLER_NAMES.has(packageJson.name);
|
|
67308
67407
|
}
|
|
67309
67408
|
|
|
67310
67409
|
// packages/omo-codex/src/install/codex-config-toml.ts
|
|
67311
|
-
import { mkdir as mkdir5, readFile as
|
|
67410
|
+
import { mkdir as mkdir5, readFile as readFile10 } from "fs/promises";
|
|
67312
67411
|
import { dirname as dirname13 } from "path";
|
|
67313
67412
|
|
|
67314
67413
|
// packages/omo-codex/src/install/toml-section-editor.ts
|
|
@@ -67496,12 +67595,12 @@ function tomlKeySegment(value) {
|
|
|
67496
67595
|
|
|
67497
67596
|
// packages/omo-codex/src/install/codex-config-atomic-write.ts
|
|
67498
67597
|
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
|
|
67598
|
+
import { basename as basename7, dirname as dirname12, isAbsolute as isAbsolute6, join as join35, resolve as resolve11 } from "path";
|
|
67500
67599
|
var RENAME_RETRY_DELAYS_MS = [10, 25, 50];
|
|
67501
67600
|
var RETRIABLE_RENAME_CODES = new Set(["EPERM", "EBUSY"]);
|
|
67502
67601
|
async function writeFileAtomic(targetPath, data) {
|
|
67503
67602
|
const writeTarget = await resolveSymlinkTarget(targetPath);
|
|
67504
|
-
const temporaryPath =
|
|
67603
|
+
const temporaryPath = join35(dirname12(writeTarget), `.tmp-${basename7(writeTarget)}-${process.pid}-${Date.now()}`);
|
|
67505
67604
|
await writeFile5(temporaryPath, data);
|
|
67506
67605
|
try {
|
|
67507
67606
|
await renameWithRetry(temporaryPath, writeTarget);
|
|
@@ -67771,8 +67870,8 @@ function isRootSetting(line, key) {
|
|
|
67771
67870
|
}
|
|
67772
67871
|
|
|
67773
67872
|
// packages/omo-codex/src/install/codex-model-catalog.ts
|
|
67774
|
-
import { readFile as
|
|
67775
|
-
import { join as
|
|
67873
|
+
import { readFile as readFile9 } from "fs/promises";
|
|
67874
|
+
import { join as join36 } from "path";
|
|
67776
67875
|
var FALLBACK_CODEX_MODEL_CATALOG = {
|
|
67777
67876
|
current: {
|
|
67778
67877
|
model: "gpt-5.5",
|
|
@@ -67791,9 +67890,9 @@ var FALLBACK_CODEX_MODEL_CATALOG = {
|
|
|
67791
67890
|
]
|
|
67792
67891
|
};
|
|
67793
67892
|
async function readCodexModelCatalog(codexPackageRoot) {
|
|
67794
|
-
const catalogPath =
|
|
67893
|
+
const catalogPath = join36(codexPackageRoot, "plugin", "model-catalog.json");
|
|
67795
67894
|
try {
|
|
67796
|
-
const parsed = JSON.parse(await
|
|
67895
|
+
const parsed = JSON.parse(await readFile9(catalogPath, "utf8"));
|
|
67797
67896
|
return parseCodexModelCatalog(parsed) ?? FALLBACK_CODEX_MODEL_CATALOG;
|
|
67798
67897
|
} catch (error) {
|
|
67799
67898
|
if (error instanceof Error)
|
|
@@ -67874,7 +67973,7 @@ async function updateCodexConfig(input) {
|
|
|
67874
67973
|
await mkdir5(dirname13(input.configPath), { recursive: true });
|
|
67875
67974
|
let config = "";
|
|
67876
67975
|
if (await exists(input.configPath))
|
|
67877
|
-
config = await
|
|
67976
|
+
config = await readFile10(input.configPath, "utf8");
|
|
67878
67977
|
const pluginSet = new Set(input.pluginNames);
|
|
67879
67978
|
for (const legacyMarketplaceName of legacyMarketplaceNames(input.marketplaceName)) {
|
|
67880
67979
|
config = removeMarketplaceBlock(config, legacyMarketplaceName);
|
|
@@ -67910,7 +68009,7 @@ async function updateCodexConfig(input) {
|
|
|
67910
68009
|
}
|
|
67911
68010
|
async function exists(path7) {
|
|
67912
68011
|
try {
|
|
67913
|
-
await
|
|
68012
|
+
await readFile10(path7, "utf8");
|
|
67914
68013
|
return true;
|
|
67915
68014
|
} catch (error) {
|
|
67916
68015
|
if (error instanceof Error)
|
|
@@ -67921,8 +68020,8 @@ async function exists(path7) {
|
|
|
67921
68020
|
|
|
67922
68021
|
// packages/omo-codex/src/install/codex-hook-trust.ts
|
|
67923
68022
|
import { createHash as createHash2 } from "crypto";
|
|
67924
|
-
import { readFile as
|
|
67925
|
-
import { join as
|
|
68023
|
+
import { readFile as readFile11 } from "fs/promises";
|
|
68024
|
+
import { join as join37 } from "path";
|
|
67926
68025
|
var EVENT_LABELS = new Map([
|
|
67927
68026
|
["PreToolUse", "pre_tool_use"],
|
|
67928
68027
|
["PermissionRequest", "permission_request"],
|
|
@@ -67936,21 +68035,37 @@ var EVENT_LABELS = new Map([
|
|
|
67936
68035
|
["Stop", "stop"]
|
|
67937
68036
|
]);
|
|
67938
68037
|
async function trustedHookStatesForPlugin(input) {
|
|
67939
|
-
const manifestPath =
|
|
68038
|
+
const manifestPath = join37(input.pluginRoot, ".codex-plugin", "plugin.json");
|
|
67940
68039
|
if (!await exists2(manifestPath))
|
|
67941
68040
|
return [];
|
|
67942
|
-
const manifest = JSON.parse(await
|
|
67943
|
-
if (!isPlainRecord3(manifest)
|
|
68041
|
+
const manifest = JSON.parse(await readFile11(manifestPath, "utf8"));
|
|
68042
|
+
if (!isPlainRecord3(manifest))
|
|
67944
68043
|
return [];
|
|
67945
|
-
const
|
|
67946
|
-
|
|
67947
|
-
|
|
67948
|
-
|
|
67949
|
-
|
|
68044
|
+
const states = [];
|
|
68045
|
+
for (const hookPath of hookManifestPaths2(manifest.hooks)) {
|
|
68046
|
+
const hooksPath = join37(input.pluginRoot, hookPath);
|
|
68047
|
+
if (!await exists2(hooksPath))
|
|
68048
|
+
continue;
|
|
68049
|
+
const parsed = JSON.parse(await readFile11(hooksPath, "utf8"));
|
|
68050
|
+
if (!isPlainRecord3(parsed) || !isPlainRecord3(parsed.hooks))
|
|
68051
|
+
continue;
|
|
68052
|
+
states.push(...trustedHookStatesForHooksFile({
|
|
68053
|
+
keySource: `${input.pluginName}@${input.marketplaceName}:${hookPath}`,
|
|
68054
|
+
hooks: parsed.hooks
|
|
68055
|
+
}));
|
|
68056
|
+
}
|
|
68057
|
+
return states;
|
|
68058
|
+
}
|
|
68059
|
+
function hookManifestPaths2(value) {
|
|
68060
|
+
if (typeof value === "string" && value.trim() !== "")
|
|
68061
|
+
return [stripDotSlash2(value)];
|
|
68062
|
+
if (!Array.isArray(value))
|
|
67950
68063
|
return [];
|
|
67951
|
-
|
|
68064
|
+
return value.filter((item) => typeof item === "string" && item.trim() !== "").map(stripDotSlash2);
|
|
68065
|
+
}
|
|
68066
|
+
function trustedHookStatesForHooksFile(input) {
|
|
67952
68067
|
const states = [];
|
|
67953
|
-
for (const [eventName, groups] of Object.entries(
|
|
68068
|
+
for (const [eventName, groups] of Object.entries(input.hooks)) {
|
|
67954
68069
|
if (!Array.isArray(groups))
|
|
67955
68070
|
continue;
|
|
67956
68071
|
const eventLabel = EVENT_LABELS.get(eventName);
|
|
@@ -67966,7 +68081,7 @@ async function trustedHookStatesForPlugin(input) {
|
|
|
67966
68081
|
continue;
|
|
67967
68082
|
if (typeof handler.command !== "string" || handler.command.trim() === "")
|
|
67968
68083
|
continue;
|
|
67969
|
-
const key = `${keySource}:${eventLabel}:${groupIndex}:${handlerIndex}`;
|
|
68084
|
+
const key = `${input.keySource}:${eventLabel}:${groupIndex}:${handlerIndex}`;
|
|
67970
68085
|
states.push({ key, trustedHash: commandHookHash(eventLabel, group.matcher, handler) });
|
|
67971
68086
|
}
|
|
67972
68087
|
}
|
|
@@ -68000,12 +68115,12 @@ function canonicalJson(value) {
|
|
|
68000
68115
|
}
|
|
68001
68116
|
return result;
|
|
68002
68117
|
}
|
|
68003
|
-
function
|
|
68118
|
+
function stripDotSlash2(value) {
|
|
68004
68119
|
return value.startsWith("./") ? value.slice(2) : value;
|
|
68005
68120
|
}
|
|
68006
68121
|
async function exists2(path7) {
|
|
68007
68122
|
try {
|
|
68008
|
-
await
|
|
68123
|
+
await readFile11(path7, "utf8");
|
|
68009
68124
|
return true;
|
|
68010
68125
|
} catch (error) {
|
|
68011
68126
|
if (error instanceof Error)
|
|
@@ -68057,12 +68172,12 @@ function toCodexResolution(resolution) {
|
|
|
68057
68172
|
}
|
|
68058
68173
|
|
|
68059
68174
|
// 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
|
|
68175
|
+
import { copyFile, lstat as lstat7, mkdir as mkdir6, readFile as readFile13, readdir as readdir4, rm as rm6, writeFile as writeFile6 } from "fs/promises";
|
|
68176
|
+
import { basename as basename8, join as join39 } from "path";
|
|
68062
68177
|
|
|
68063
68178
|
// packages/omo-codex/src/install/retired-managed-agent-purge.ts
|
|
68064
|
-
import { lstat as lstat6, readFile as
|
|
68065
|
-
import { join as
|
|
68179
|
+
import { lstat as lstat6, readFile as readFile12, rm as rm5 } from "fs/promises";
|
|
68180
|
+
import { join as join38 } from "path";
|
|
68066
68181
|
var RETIRED_MANAGED_AGENT_FILES = [
|
|
68067
68182
|
{
|
|
68068
68183
|
fileName: "codex-ultrawork-reviewer.toml",
|
|
@@ -68074,11 +68189,11 @@ var RETIRED_MANAGED_AGENT_FILES = [
|
|
|
68074
68189
|
}
|
|
68075
68190
|
];
|
|
68076
68191
|
async function purgeRetiredManagedAgentFiles(input) {
|
|
68077
|
-
const agentsDir =
|
|
68192
|
+
const agentsDir = join38(input.codexHome, "agents");
|
|
68078
68193
|
if (!await exists3(agentsDir))
|
|
68079
68194
|
return;
|
|
68080
68195
|
for (const retiredAgent of RETIRED_MANAGED_AGENT_FILES) {
|
|
68081
|
-
const agentPath =
|
|
68196
|
+
const agentPath = join38(agentsDir, retiredAgent.fileName);
|
|
68082
68197
|
if (!await exists3(agentPath))
|
|
68083
68198
|
continue;
|
|
68084
68199
|
const agentStat = await lstat6(agentPath);
|
|
@@ -68095,7 +68210,7 @@ function hasRequiredMarkers(content, markers) {
|
|
|
68095
68210
|
}
|
|
68096
68211
|
async function readTextIfExists(path7) {
|
|
68097
68212
|
try {
|
|
68098
|
-
return await
|
|
68213
|
+
return await readFile12(path7, "utf8");
|
|
68099
68214
|
} catch (error) {
|
|
68100
68215
|
if (nodeErrorCode(error) === "ENOENT")
|
|
68101
68216
|
return null;
|
|
@@ -68121,7 +68236,7 @@ function nodeErrorCode(error) {
|
|
|
68121
68236
|
// packages/omo-codex/src/install/link-cached-plugin-agents.ts
|
|
68122
68237
|
var MANIFEST_FILE = ".installed-agents.json";
|
|
68123
68238
|
async function capturePreservedAgentReasoning(input) {
|
|
68124
|
-
const agentsDir =
|
|
68239
|
+
const agentsDir = join39(input.codexHome, "agents");
|
|
68125
68240
|
if (!await exists4(agentsDir))
|
|
68126
68241
|
return new Map;
|
|
68127
68242
|
const preserved = new Map;
|
|
@@ -68129,7 +68244,7 @@ async function capturePreservedAgentReasoning(input) {
|
|
|
68129
68244
|
for (const entry of agentEntries) {
|
|
68130
68245
|
if (!entry.name.endsWith(".toml"))
|
|
68131
68246
|
continue;
|
|
68132
|
-
const content = await readTextIfExists2(
|
|
68247
|
+
const content = await readTextIfExists2(join39(agentsDir, entry.name));
|
|
68133
68248
|
if (content === null)
|
|
68134
68249
|
continue;
|
|
68135
68250
|
const effort = extractReasoningEffort(content);
|
|
@@ -68139,7 +68254,7 @@ async function capturePreservedAgentReasoning(input) {
|
|
|
68139
68254
|
return preserved;
|
|
68140
68255
|
}
|
|
68141
68256
|
async function capturePreservedAgentServiceTier(input) {
|
|
68142
|
-
const agentsDir =
|
|
68257
|
+
const agentsDir = join39(input.codexHome, "agents");
|
|
68143
68258
|
if (!await exists4(agentsDir))
|
|
68144
68259
|
return new Map;
|
|
68145
68260
|
const preserved = new Map;
|
|
@@ -68147,7 +68262,7 @@ async function capturePreservedAgentServiceTier(input) {
|
|
|
68147
68262
|
for (const entry of agentEntries) {
|
|
68148
68263
|
if (!entry.name.endsWith(".toml"))
|
|
68149
68264
|
continue;
|
|
68150
|
-
const content = await readTextIfExists2(
|
|
68265
|
+
const content = await readTextIfExists2(join39(agentsDir, entry.name));
|
|
68151
68266
|
if (content === null)
|
|
68152
68267
|
continue;
|
|
68153
68268
|
preserved.set(agentNameFromToml(entry.name), extractServiceTier(content));
|
|
@@ -68161,13 +68276,13 @@ async function linkCachedPluginAgents(input) {
|
|
|
68161
68276
|
await writeManifest(input.pluginRoot, []);
|
|
68162
68277
|
return [];
|
|
68163
68278
|
}
|
|
68164
|
-
const agentsDir =
|
|
68279
|
+
const agentsDir = join39(input.codexHome, "agents");
|
|
68165
68280
|
await mkdir6(agentsDir, { recursive: true });
|
|
68166
68281
|
const linked = [];
|
|
68167
68282
|
for (const agentPath of bundledAgents) {
|
|
68168
68283
|
const agentFileName = basename8(agentPath);
|
|
68169
68284
|
const agentName = agentNameFromToml(agentFileName);
|
|
68170
|
-
const linkPath =
|
|
68285
|
+
const linkPath = join39(agentsDir, agentFileName);
|
|
68171
68286
|
await replaceWithCopy(linkPath, agentPath);
|
|
68172
68287
|
await restorePreservedReasoning({
|
|
68173
68288
|
agentName,
|
|
@@ -68188,7 +68303,7 @@ async function linkCachedPluginAgents(input) {
|
|
|
68188
68303
|
async function restorePreservedServiceTier(input) {
|
|
68189
68304
|
if (!input.preserved)
|
|
68190
68305
|
return;
|
|
68191
|
-
const content = await
|
|
68306
|
+
const content = await readFile13(input.linkPath, "utf8");
|
|
68192
68307
|
if (extractServiceTier(content) === input.value)
|
|
68193
68308
|
return;
|
|
68194
68309
|
const replacement = replaceServiceTier(content, input.value);
|
|
@@ -68197,7 +68312,7 @@ async function restorePreservedServiceTier(input) {
|
|
|
68197
68312
|
await writeFile6(input.linkPath, replacement.content);
|
|
68198
68313
|
}
|
|
68199
68314
|
async function discoverBundledAgents(pluginRoot) {
|
|
68200
|
-
const componentsRoot =
|
|
68315
|
+
const componentsRoot = join39(pluginRoot, "components");
|
|
68201
68316
|
if (!await exists4(componentsRoot))
|
|
68202
68317
|
return [];
|
|
68203
68318
|
const componentEntries = await readdir4(componentsRoot, { withFileTypes: true });
|
|
@@ -68205,14 +68320,14 @@ async function discoverBundledAgents(pluginRoot) {
|
|
|
68205
68320
|
for (const entry of componentEntries) {
|
|
68206
68321
|
if (!entry.isDirectory())
|
|
68207
68322
|
continue;
|
|
68208
|
-
const agentsRoot =
|
|
68323
|
+
const agentsRoot = join39(componentsRoot, entry.name, "agents");
|
|
68209
68324
|
if (!await exists4(agentsRoot))
|
|
68210
68325
|
continue;
|
|
68211
68326
|
const agentEntries = await readdir4(agentsRoot, { withFileTypes: true });
|
|
68212
68327
|
for (const file2 of agentEntries) {
|
|
68213
68328
|
if (!file2.isFile() || !file2.name.endsWith(".toml"))
|
|
68214
68329
|
continue;
|
|
68215
|
-
agents.push(
|
|
68330
|
+
agents.push(join39(agentsRoot, file2.name));
|
|
68216
68331
|
}
|
|
68217
68332
|
}
|
|
68218
68333
|
agents.sort();
|
|
@@ -68232,7 +68347,7 @@ async function prepareReplacement(linkPath) {
|
|
|
68232
68347
|
await rm6(linkPath, { force: true });
|
|
68233
68348
|
}
|
|
68234
68349
|
async function writeManifest(pluginRoot, agentPaths) {
|
|
68235
|
-
const manifestPath =
|
|
68350
|
+
const manifestPath = join39(pluginRoot, MANIFEST_FILE);
|
|
68236
68351
|
const payload = { agents: [...agentPaths].sort() };
|
|
68237
68352
|
await writeFile6(manifestPath, `${JSON.stringify(payload, null, "\t")}
|
|
68238
68353
|
`);
|
|
@@ -68240,7 +68355,7 @@ async function writeManifest(pluginRoot, agentPaths) {
|
|
|
68240
68355
|
async function restorePreservedReasoning(input) {
|
|
68241
68356
|
if (input.value === undefined)
|
|
68242
68357
|
return;
|
|
68243
|
-
const content = await
|
|
68358
|
+
const content = await readFile13(input.target, "utf8");
|
|
68244
68359
|
const bundledEffort = extractReasoningEffort(content);
|
|
68245
68360
|
if (bundledEffort === input.value)
|
|
68246
68361
|
return;
|
|
@@ -68251,7 +68366,7 @@ async function restorePreservedReasoning(input) {
|
|
|
68251
68366
|
}
|
|
68252
68367
|
async function readTextIfExists2(path7) {
|
|
68253
68368
|
try {
|
|
68254
|
-
return await
|
|
68369
|
+
return await readFile13(path7, "utf8");
|
|
68255
68370
|
} catch (error) {
|
|
68256
68371
|
if (nodeErrorCode2(error) === "ENOENT")
|
|
68257
68372
|
return null;
|
|
@@ -68359,12 +68474,12 @@ function nodeErrorCode2(error) {
|
|
|
68359
68474
|
}
|
|
68360
68475
|
|
|
68361
68476
|
// packages/omo-codex/src/install/codex-marketplace.ts
|
|
68362
|
-
import { readFile as
|
|
68363
|
-
import { join as
|
|
68477
|
+
import { readFile as readFile14 } from "fs/promises";
|
|
68478
|
+
import { join as join40 } from "path";
|
|
68364
68479
|
var DEFAULT_MARKETPLACE_PATH = "packages/omo-codex/marketplace.json";
|
|
68365
68480
|
async function readMarketplace(repoRoot, options) {
|
|
68366
|
-
const marketplacePath = options?.marketplacePath ??
|
|
68367
|
-
const raw = await
|
|
68481
|
+
const marketplacePath = options?.marketplacePath ?? join40(repoRoot, DEFAULT_MARKETPLACE_PATH);
|
|
68482
|
+
const raw = await readFile14(marketplacePath, "utf8");
|
|
68368
68483
|
const parsed = JSON.parse(raw);
|
|
68369
68484
|
if (!isPlainRecord3(parsed))
|
|
68370
68485
|
throw new Error("marketplace.json must be an object");
|
|
@@ -68382,10 +68497,10 @@ async function readMarketplace(repoRoot, options) {
|
|
|
68382
68497
|
function resolvePluginSource(repoRoot, plugin, options) {
|
|
68383
68498
|
const sourcePath = localSourcePath(options?.pathOverride ?? plugin.source);
|
|
68384
68499
|
const relativePath = sourcePath.slice(2);
|
|
68385
|
-
return
|
|
68500
|
+
return join40(repoRoot, ...relativePath.split(/[\\/]/));
|
|
68386
68501
|
}
|
|
68387
68502
|
async function readPluginManifest(pluginRoot) {
|
|
68388
|
-
const raw = await
|
|
68503
|
+
const raw = await readFile14(join40(pluginRoot, ".codex-plugin", "plugin.json"), "utf8");
|
|
68389
68504
|
const parsed = JSON.parse(raw);
|
|
68390
68505
|
if (!isPlainRecord3(parsed))
|
|
68391
68506
|
throw new Error(`${pluginRoot} plugin.json must be an object`);
|
|
@@ -68395,15 +68510,27 @@ async function readPluginManifest(pluginRoot) {
|
|
|
68395
68510
|
if (parsed.version !== undefined && (typeof parsed.version !== "string" || parsed.version.trim() === "")) {
|
|
68396
68511
|
throw new Error(`${pluginRoot} plugin.json version must be a non-empty string`);
|
|
68397
68512
|
}
|
|
68398
|
-
if (parsed.hooks !== undefined && (
|
|
68399
|
-
throw new Error(`${pluginRoot} plugin.json hooks must be a non-empty string`);
|
|
68513
|
+
if (parsed.hooks !== undefined && !isPluginHooksManifestValue(parsed.hooks)) {
|
|
68514
|
+
throw new Error(`${pluginRoot} plugin.json hooks must be a non-empty string or string array`);
|
|
68400
68515
|
}
|
|
68401
68516
|
return {
|
|
68402
68517
|
name: parsed.name,
|
|
68403
68518
|
version: typeof parsed.version === "string" ? parsed.version.trim() : undefined,
|
|
68404
|
-
hooks:
|
|
68519
|
+
hooks: normalizePluginHooksManifestValue(parsed.hooks)
|
|
68405
68520
|
};
|
|
68406
68521
|
}
|
|
68522
|
+
function isPluginHooksManifestValue(value) {
|
|
68523
|
+
if (typeof value === "string")
|
|
68524
|
+
return value.trim() !== "";
|
|
68525
|
+
return Array.isArray(value) && value.every((item) => typeof item === "string" && item.trim() !== "");
|
|
68526
|
+
}
|
|
68527
|
+
function normalizePluginHooksManifestValue(value) {
|
|
68528
|
+
if (typeof value === "string")
|
|
68529
|
+
return value.trim();
|
|
68530
|
+
if (Array.isArray(value))
|
|
68531
|
+
return value.map((item) => item.trim());
|
|
68532
|
+
return;
|
|
68533
|
+
}
|
|
68407
68534
|
function validatePathSegment(value, label) {
|
|
68408
68535
|
if (!/^[A-Za-z0-9._+-]+$/.test(value)) {
|
|
68409
68536
|
throw new Error(`${label} contains unsupported characters: ${value}`);
|
|
@@ -68455,7 +68582,7 @@ function validateLocalSourcePath(path7) {
|
|
|
68455
68582
|
|
|
68456
68583
|
// packages/omo-codex/src/install/codex-marketplace-snapshot.ts
|
|
68457
68584
|
import { cp as cp3, mkdir as mkdir7, rename as rename3, rm as rm7, writeFile as writeFile7 } from "fs/promises";
|
|
68458
|
-
import { join as
|
|
68585
|
+
import { join as join41, sep as sep6 } from "path";
|
|
68459
68586
|
var INSTALLED_MARKETPLACES_DIR = ".tmp/marketplaces";
|
|
68460
68587
|
async function writeInstalledMarketplaceSnapshot(input) {
|
|
68461
68588
|
const marketplaceRoot = installedMarketplaceRoot(input.codexHome, input.marketplace.name);
|
|
@@ -68468,21 +68595,21 @@ async function writeInstalledMarketplaceSnapshot(input) {
|
|
|
68468
68595
|
return snapshotPlugins;
|
|
68469
68596
|
}
|
|
68470
68597
|
function installedMarketplaceRoot(codexHome, marketplaceName) {
|
|
68471
|
-
return
|
|
68598
|
+
return join41(codexHome, INSTALLED_MARKETPLACES_DIR, marketplaceName);
|
|
68472
68599
|
}
|
|
68473
68600
|
async function writeMarketplaceManifest(marketplaceRoot, marketplace) {
|
|
68474
|
-
const manifestDir =
|
|
68601
|
+
const manifestDir = join41(marketplaceRoot, ".agents", "plugins");
|
|
68475
68602
|
await mkdir7(manifestDir, { recursive: true });
|
|
68476
|
-
const tempPath =
|
|
68603
|
+
const tempPath = join41(manifestDir, `.marketplace-${process.pid}-${Date.now()}.json.tmp`);
|
|
68477
68604
|
await writeFile7(tempPath, `${JSON.stringify(marketplace, null, "\t")}
|
|
68478
68605
|
`);
|
|
68479
|
-
await rename3(tempPath,
|
|
68606
|
+
await rename3(tempPath, join41(manifestDir, "marketplace.json"));
|
|
68480
68607
|
}
|
|
68481
68608
|
async function writeSnapshotPlugin(marketplaceRoot, plugin) {
|
|
68482
|
-
const pluginsDir =
|
|
68609
|
+
const pluginsDir = join41(marketplaceRoot, "plugins");
|
|
68483
68610
|
await mkdir7(pluginsDir, { recursive: true });
|
|
68484
|
-
const targetPath =
|
|
68485
|
-
const tempPath =
|
|
68611
|
+
const targetPath = join41(pluginsDir, plugin.name);
|
|
68612
|
+
const tempPath = join41(pluginsDir, `.tmp-${plugin.name}-${process.pid}-${Date.now()}`);
|
|
68486
68613
|
await rm7(tempPath, { recursive: true, force: true });
|
|
68487
68614
|
await cp3(plugin.sourcePath, tempPath, {
|
|
68488
68615
|
recursive: true,
|
|
@@ -68495,19 +68622,19 @@ async function writeSnapshotPlugin(marketplaceRoot, plugin) {
|
|
|
68495
68622
|
return { name: plugin.name, path: targetPath };
|
|
68496
68623
|
}
|
|
68497
68624
|
function shouldCopyMarketplaceSourcePath(path7, root) {
|
|
68498
|
-
const relative5 = path7 === root ? "" : path7.slice(root.length +
|
|
68625
|
+
const relative5 = path7 === root ? "" : path7.slice(root.length + sep6.length);
|
|
68499
68626
|
if (relative5 === "")
|
|
68500
68627
|
return true;
|
|
68501
|
-
const parts = relative5.split(
|
|
68628
|
+
const parts = relative5.split(sep6);
|
|
68502
68629
|
return !parts.some((part) => part === ".git" || part === "node_modules");
|
|
68503
68630
|
}
|
|
68504
68631
|
|
|
68505
68632
|
// packages/omo-codex/src/install/lazycodex-version-stamp.ts
|
|
68506
|
-
import { readdir as readdir5, readFile as
|
|
68507
|
-
import { join as
|
|
68633
|
+
import { readdir as readdir5, readFile as readFile15, writeFile as writeFile8 } from "fs/promises";
|
|
68634
|
+
import { join as join42 } from "path";
|
|
68508
68635
|
async function readDistributionManifest(repoRoot) {
|
|
68509
68636
|
try {
|
|
68510
|
-
const parsed = JSON.parse(await
|
|
68637
|
+
const parsed = JSON.parse(await readFile15(join42(repoRoot, "package.json"), "utf8"));
|
|
68511
68638
|
if (!isPlainRecord3(parsed) || typeof parsed.version !== "string" || parsed.version.trim().length === 0)
|
|
68512
68639
|
return;
|
|
68513
68640
|
return {
|
|
@@ -68527,15 +68654,19 @@ function resolveLazyCodexPluginVersion(input) {
|
|
|
68527
68654
|
return input.manifestVersion ?? "local";
|
|
68528
68655
|
}
|
|
68529
68656
|
async function stampLazyCodexPluginVersion(input) {
|
|
68530
|
-
|
|
68531
|
-
await
|
|
68532
|
-
await
|
|
68657
|
+
const manifestPath = join42(input.pluginRoot, ".codex-plugin", "plugin.json");
|
|
68658
|
+
const hookPaths = await readPluginHookPaths(manifestPath);
|
|
68659
|
+
await stampJsonVersion(manifestPath, input.version);
|
|
68660
|
+
await stampJsonVersion(join42(input.pluginRoot, "package.json"), input.version);
|
|
68661
|
+
for (const hookPath of hookPaths) {
|
|
68662
|
+
await stampHookStatusMessages(join42(input.pluginRoot, hookPath), input.version);
|
|
68663
|
+
}
|
|
68533
68664
|
await stampComponentVersions(input);
|
|
68534
68665
|
}
|
|
68535
68666
|
async function writeLazyCodexInstallSnapshot(input) {
|
|
68536
68667
|
if (input.distributionManifest === undefined)
|
|
68537
68668
|
return;
|
|
68538
|
-
await writeFile8(
|
|
68669
|
+
await writeFile8(join42(input.pluginRoot, "lazycodex-install.json"), `${JSON.stringify({
|
|
68539
68670
|
packageName: input.distributionManifest.name,
|
|
68540
68671
|
version: input.distributionManifest.version
|
|
68541
68672
|
}, null, "\t")}
|
|
@@ -68543,7 +68674,7 @@ async function writeLazyCodexInstallSnapshot(input) {
|
|
|
68543
68674
|
}
|
|
68544
68675
|
async function stampJsonVersion(path7, version) {
|
|
68545
68676
|
try {
|
|
68546
|
-
const parsed = JSON.parse(await
|
|
68677
|
+
const parsed = JSON.parse(await readFile15(path7, "utf8"));
|
|
68547
68678
|
if (!isPlainRecord3(parsed))
|
|
68548
68679
|
return;
|
|
68549
68680
|
parsed.version = version;
|
|
@@ -68555,9 +68686,29 @@ async function stampJsonVersion(path7, version) {
|
|
|
68555
68686
|
throw error;
|
|
68556
68687
|
}
|
|
68557
68688
|
}
|
|
68689
|
+
async function readPluginHookPaths(manifestPath) {
|
|
68690
|
+
try {
|
|
68691
|
+
const parsed = JSON.parse(await readFile15(manifestPath, "utf8"));
|
|
68692
|
+
if (!isPlainRecord3(parsed))
|
|
68693
|
+
return [];
|
|
68694
|
+
if (typeof parsed.hooks === "string" && parsed.hooks.trim().length > 0)
|
|
68695
|
+
return [stripDotSlash3(parsed.hooks)];
|
|
68696
|
+
if (Array.isArray(parsed.hooks)) {
|
|
68697
|
+
return parsed.hooks.filter((hookPath) => typeof hookPath === "string" && hookPath.trim().length > 0).map(stripDotSlash3);
|
|
68698
|
+
}
|
|
68699
|
+
return [];
|
|
68700
|
+
} catch (error) {
|
|
68701
|
+
if (error instanceof Error)
|
|
68702
|
+
return [];
|
|
68703
|
+
throw error;
|
|
68704
|
+
}
|
|
68705
|
+
}
|
|
68706
|
+
function stripDotSlash3(path7) {
|
|
68707
|
+
return path7.startsWith("./") ? path7.slice(2) : path7;
|
|
68708
|
+
}
|
|
68558
68709
|
async function stampHookStatusMessages(path7, version) {
|
|
68559
68710
|
try {
|
|
68560
|
-
const parsed = JSON.parse(await
|
|
68711
|
+
const parsed = JSON.parse(await readFile15(path7, "utf8"));
|
|
68561
68712
|
if (!isPlainRecord3(parsed))
|
|
68562
68713
|
return;
|
|
68563
68714
|
stampHookGroups(parsed.hooks, version);
|
|
@@ -68572,16 +68723,16 @@ async function stampHookStatusMessages(path7, version) {
|
|
|
68572
68723
|
async function stampComponentVersions(input) {
|
|
68573
68724
|
let entries;
|
|
68574
68725
|
try {
|
|
68575
|
-
entries = await readdir5(
|
|
68726
|
+
entries = await readdir5(join42(input.pluginRoot, "components"));
|
|
68576
68727
|
} catch (error) {
|
|
68577
68728
|
if (error instanceof Error)
|
|
68578
68729
|
return;
|
|
68579
68730
|
throw error;
|
|
68580
68731
|
}
|
|
68581
68732
|
for (const entry of entries) {
|
|
68582
|
-
const componentRoot =
|
|
68583
|
-
await stampJsonVersion(
|
|
68584
|
-
await stampHookStatusMessages(
|
|
68733
|
+
const componentRoot = join42(input.pluginRoot, "components", entry);
|
|
68734
|
+
await stampJsonVersion(join42(componentRoot, "package.json"), input.version);
|
|
68735
|
+
await stampHookStatusMessages(join42(componentRoot, "hooks", "hooks.json"), input.version);
|
|
68585
68736
|
}
|
|
68586
68737
|
}
|
|
68587
68738
|
function stampHookGroups(hooks, version) {
|
|
@@ -68602,7 +68753,7 @@ function stampHookGroups(hooks, version) {
|
|
|
68602
68753
|
function stampHookStatusMessage(hook, version) {
|
|
68603
68754
|
if (!isPlainRecord3(hook) || typeof hook.statusMessage !== "string")
|
|
68604
68755
|
return;
|
|
68605
|
-
hook.statusMessage = hook.statusMessage.replace(/^LazyCodex\([^)]+\)
|
|
68756
|
+
hook.statusMessage = hook.statusMessage.replace(/^LazyCodex\([^)]+\):\s*/, "(OmO) ");
|
|
68606
68757
|
}
|
|
68607
68758
|
|
|
68608
68759
|
// packages/omo-codex/src/install/codex-process.ts
|
|
@@ -68634,8 +68785,8 @@ var defaultRunCommand = async (command, args, options) => {
|
|
|
68634
68785
|
};
|
|
68635
68786
|
|
|
68636
68787
|
// 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
|
|
68788
|
+
import { copyFile as copyFile2, lstat as lstat8, readFile as readFile16, writeFile as writeFile9 } from "fs/promises";
|
|
68789
|
+
import { dirname as dirname14, join as join43, resolve as resolve12 } from "path";
|
|
68639
68790
|
var LEGACY_AGENT_CONFLICT_KEYS = ["max_threads"];
|
|
68640
68791
|
var PROJECT_LOCAL_ARTIFACT_PATHS = [
|
|
68641
68792
|
".codex/hooks.json",
|
|
@@ -68654,7 +68805,7 @@ async function repairNearestProjectLocalCodexArtifacts(input) {
|
|
|
68654
68805
|
const artifacts = await collectProjectLocalArtifacts(project.artifactRoots);
|
|
68655
68806
|
const configs = [];
|
|
68656
68807
|
for (const configPath of project.configPaths) {
|
|
68657
|
-
const original = await
|
|
68808
|
+
const original = await readFile16(configPath, "utf8");
|
|
68658
68809
|
const repair = repairProjectLocalCodexConfigText(original);
|
|
68659
68810
|
if (!repair.changed) {
|
|
68660
68811
|
configs.push({
|
|
@@ -68738,17 +68889,17 @@ async function findProjectLocalCodexConfigs(startDirectory, codexHome) {
|
|
|
68738
68889
|
if (startDirectoryStat !== null && !startDirectoryStat.isDirectory()) {
|
|
68739
68890
|
throw new ProjectLocalCleanupStartDirectoryError(startDirectory);
|
|
68740
68891
|
}
|
|
68741
|
-
const codexHomeConfigPath = codexHome === undefined ? null :
|
|
68892
|
+
const codexHomeConfigPath = codexHome === undefined ? null : join43(resolve12(codexHome), "config.toml");
|
|
68742
68893
|
let current = resolve12(startDirectory);
|
|
68743
68894
|
const configPathsFromCwd = [];
|
|
68744
68895
|
while (true) {
|
|
68745
|
-
const configPath =
|
|
68896
|
+
const configPath = join43(current, ".codex", "config.toml");
|
|
68746
68897
|
if (await isRegularProjectLocalConfig(current, configPath)) {
|
|
68747
68898
|
if (codexHomeConfigPath === null || resolve12(configPath) !== codexHomeConfigPath) {
|
|
68748
68899
|
configPathsFromCwd.push(configPath);
|
|
68749
68900
|
}
|
|
68750
68901
|
}
|
|
68751
|
-
if (await exists5(
|
|
68902
|
+
if (await exists5(join43(current, ".git"))) {
|
|
68752
68903
|
return configPathsFromCwd.length === 0 ? null : {
|
|
68753
68904
|
projectRoot: current,
|
|
68754
68905
|
configPaths: [...configPathsFromCwd].reverse(),
|
|
@@ -68768,7 +68919,7 @@ async function findProjectLocalCodexConfigs(startDirectory, codexHome) {
|
|
|
68768
68919
|
}
|
|
68769
68920
|
}
|
|
68770
68921
|
async function isRegularProjectLocalConfig(directory, configPath) {
|
|
68771
|
-
const codexDirStat = await maybeLstat(
|
|
68922
|
+
const codexDirStat = await maybeLstat(join43(directory, ".codex"));
|
|
68772
68923
|
if (codexDirStat === null || !codexDirStat.isDirectory() || codexDirStat.isSymbolicLink())
|
|
68773
68924
|
return false;
|
|
68774
68925
|
const configStat = await maybeLstat(configPath);
|
|
@@ -68788,7 +68939,7 @@ async function collectProjectLocalArtifacts(projectRoots) {
|
|
|
68788
68939
|
const seenPaths = new Set;
|
|
68789
68940
|
for (const projectRoot of projectRoots) {
|
|
68790
68941
|
for (const relativePath of PROJECT_LOCAL_ARTIFACT_PATHS) {
|
|
68791
|
-
const artifactPath =
|
|
68942
|
+
const artifactPath = join43(projectRoot, relativePath);
|
|
68792
68943
|
if (seenPaths.has(artifactPath))
|
|
68793
68944
|
continue;
|
|
68794
68945
|
const entryStat = await maybeLstat(artifactPath);
|
|
@@ -68863,13 +69014,13 @@ function formatUnknownError(error) {
|
|
|
68863
69014
|
}
|
|
68864
69015
|
|
|
68865
69016
|
// packages/omo-codex/src/install/lsp-daemon-reaper.ts
|
|
68866
|
-
import { readFile as
|
|
69017
|
+
import { readFile as readFile17, readdir as readdir6, rm as rm8 } from "fs/promises";
|
|
68867
69018
|
import { connect } from "net";
|
|
68868
|
-
import { join as
|
|
69019
|
+
import { join as join44 } from "path";
|
|
68869
69020
|
async function reapLspDaemons(codexHome, deps = {}) {
|
|
68870
69021
|
const killProcess = deps.killProcess ?? sendSigterm;
|
|
68871
69022
|
const isDaemonLive = deps.isDaemonLive ?? probeSocketLive;
|
|
68872
|
-
const daemonRoot =
|
|
69023
|
+
const daemonRoot = join44(codexHome, "codex-lsp", "daemon");
|
|
68873
69024
|
const reaped = [];
|
|
68874
69025
|
let entries;
|
|
68875
69026
|
try {
|
|
@@ -68878,9 +69029,9 @@ async function reapLspDaemons(codexHome, deps = {}) {
|
|
|
68878
69029
|
return reaped;
|
|
68879
69030
|
}
|
|
68880
69031
|
for (const entry of entries) {
|
|
68881
|
-
const versionDir =
|
|
68882
|
-
const pid = await readPidFile(
|
|
68883
|
-
const socketPath = await readEndpointFile(
|
|
69032
|
+
const versionDir = join44(daemonRoot, entry);
|
|
69033
|
+
const pid = await readPidFile(join44(versionDir, "daemon.pid"));
|
|
69034
|
+
const socketPath = await readEndpointFile(join44(versionDir, "daemon.endpoint"));
|
|
68884
69035
|
if (pid !== null && socketPath !== null && await isDaemonLive(socketPath) && killProcess(pid)) {
|
|
68885
69036
|
reaped.push(pid);
|
|
68886
69037
|
}
|
|
@@ -68890,7 +69041,7 @@ async function reapLspDaemons(codexHome, deps = {}) {
|
|
|
68890
69041
|
}
|
|
68891
69042
|
async function readEndpointFile(path7) {
|
|
68892
69043
|
try {
|
|
68893
|
-
const content = (await
|
|
69044
|
+
const content = (await readFile17(path7, "utf8")).trim();
|
|
68894
69045
|
return content.length > 0 ? content : null;
|
|
68895
69046
|
} catch {
|
|
68896
69047
|
return null;
|
|
@@ -68898,7 +69049,7 @@ async function readEndpointFile(path7) {
|
|
|
68898
69049
|
}
|
|
68899
69050
|
async function readPidFile(path7) {
|
|
68900
69051
|
try {
|
|
68901
|
-
const pid = Number.parseInt((await
|
|
69052
|
+
const pid = Number.parseInt((await readFile17(path7, "utf8")).trim(), 10);
|
|
68902
69053
|
return Number.isInteger(pid) && pid > 0 ? pid : null;
|
|
68903
69054
|
} catch {
|
|
68904
69055
|
return null;
|
|
@@ -68934,7 +69085,7 @@ function sendSigterm(pid) {
|
|
|
68934
69085
|
|
|
68935
69086
|
// packages/omo-codex/src/install/codex-installer-bin-dir.ts
|
|
68936
69087
|
import { homedir as homedir5 } from "os";
|
|
68937
|
-
import { join as
|
|
69088
|
+
import { join as join45, resolve as resolve13 } from "path";
|
|
68938
69089
|
function resolveCodexInstallerBinDir(input) {
|
|
68939
69090
|
const explicitBinDir = input.binDir ?? input.env?.CODEX_LOCAL_BIN_DIR;
|
|
68940
69091
|
if (explicitBinDir !== undefined && explicitBinDir.trim().length > 0)
|
|
@@ -68943,15 +69094,15 @@ function resolveCodexInstallerBinDir(input) {
|
|
|
68943
69094
|
const defaultCodexHome = resolve13(homeDir, ".codex");
|
|
68944
69095
|
const resolvedCodexHome = resolve13(input.codexHome);
|
|
68945
69096
|
if (resolvedCodexHome !== defaultCodexHome)
|
|
68946
|
-
return
|
|
69097
|
+
return join45(resolvedCodexHome, "bin");
|
|
68947
69098
|
return resolve13(homeDir, ".local", "bin");
|
|
68948
69099
|
}
|
|
68949
69100
|
|
|
68950
69101
|
// packages/omo-codex/src/install/omo-sot-migration.ts
|
|
68951
|
-
import { join as
|
|
69102
|
+
import { join as join46 } from "path";
|
|
68952
69103
|
async function seedAndMigrateOmoSot(input) {
|
|
68953
69104
|
const commandEnv = { ...input.env };
|
|
68954
|
-
const scriptPath =
|
|
69105
|
+
const scriptPath = join46(input.repoRoot, "packages", "omo-codex", "plugin", "scripts", "migrate-omo-sot.mjs");
|
|
68955
69106
|
try {
|
|
68956
69107
|
await input.runCommand(process.execPath, [scriptPath, "--seed"], {
|
|
68957
69108
|
cwd: input.repoRoot,
|
|
@@ -68966,7 +69117,7 @@ async function seedAndMigrateOmoSot(input) {
|
|
|
68966
69117
|
|
|
68967
69118
|
// packages/omo-codex/src/install/install-ast-grep-sg.ts
|
|
68968
69119
|
init_src();
|
|
68969
|
-
import { join as
|
|
69120
|
+
import { join as join47 } from "path";
|
|
68970
69121
|
function describeResult(result) {
|
|
68971
69122
|
if (result.kind === "succeeded")
|
|
68972
69123
|
return null;
|
|
@@ -68980,7 +69131,7 @@ async function installAstGrepForCodex(options) {
|
|
|
68980
69131
|
return;
|
|
68981
69132
|
const platform = options.platform ?? process.platform;
|
|
68982
69133
|
const targetDir = astGrepRuntimeDir(options.codexHome, platform, options.arch ?? process.arch);
|
|
68983
|
-
const skillDir =
|
|
69134
|
+
const skillDir = join47(plugin.path, "skills", "ast-grep");
|
|
68984
69135
|
const installer = options.installer ?? runAstGrepSkillInstall;
|
|
68985
69136
|
try {
|
|
68986
69137
|
const result = await installer({ platform, skillDir, targetDir });
|
|
@@ -69013,7 +69164,7 @@ async function runCodexInstaller(options = {}) {
|
|
|
69013
69164
|
const env3 = options.env ?? process.env;
|
|
69014
69165
|
const platform = options.platform ?? process.platform;
|
|
69015
69166
|
const repoRoot = resolve14(options.repoRoot ?? findRepoRoot({ importerDir: import.meta.dir, env: env3 }));
|
|
69016
|
-
const codexHome = resolve14(options.codexHome ?? env3.CODEX_HOME ??
|
|
69167
|
+
const codexHome = resolve14(options.codexHome ?? env3.CODEX_HOME ?? join50(homedir6(), ".codex"));
|
|
69017
69168
|
const projectDirectory = resolve14(options.projectDirectory ?? env3.OMO_CODEX_PROJECT ?? process.cwd());
|
|
69018
69169
|
const binDir = resolveCodexInstallerBinDir({ binDir: options.binDir, codexHome, env: env3 });
|
|
69019
69170
|
const runCommand = options.runCommand ?? defaultRunCommand;
|
|
@@ -69031,9 +69182,9 @@ async function runCodexInstaller(options = {}) {
|
|
|
69031
69182
|
if (!gitBashResolution.found) {
|
|
69032
69183
|
throw new Error(gitBashResolution.installHint);
|
|
69033
69184
|
}
|
|
69034
|
-
const codexPackageRoot =
|
|
69185
|
+
const codexPackageRoot = join50(repoRoot, "packages", "omo-codex");
|
|
69035
69186
|
const marketplace = await readMarketplace(repoRoot, {
|
|
69036
|
-
marketplacePath:
|
|
69187
|
+
marketplacePath: join50(codexPackageRoot, "marketplace.json")
|
|
69037
69188
|
});
|
|
69038
69189
|
const distributionManifest = await readDistributionManifest(repoRoot);
|
|
69039
69190
|
const installed = [];
|
|
@@ -69075,7 +69226,7 @@ async function runCodexInstaller(options = {}) {
|
|
|
69075
69226
|
if (runtimeLink !== null)
|
|
69076
69227
|
log4(`Linked ${runtimeLink.name} -> ${runtimeLink.target}`);
|
|
69077
69228
|
else
|
|
69078
|
-
log4(`Warning: skipped the omo runtime wrapper because ${
|
|
69229
|
+
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
69230
|
}
|
|
69080
69231
|
pluginSources.push({ name: entry.name, sourcePath });
|
|
69081
69232
|
installed.push(plugin);
|
|
@@ -69128,13 +69279,13 @@ async function runCodexInstaller(options = {}) {
|
|
|
69128
69279
|
});
|
|
69129
69280
|
}
|
|
69130
69281
|
await reapLspDaemons(codexHome).catch(() => []);
|
|
69131
|
-
const marketplaceRoot =
|
|
69282
|
+
const marketplaceRoot = join50(codexHome, "plugins", "cache", marketplace.name);
|
|
69132
69283
|
await writeCachedMarketplaceManifest({
|
|
69133
69284
|
marketplaceName: marketplace.name,
|
|
69134
69285
|
marketplaceRoot,
|
|
69135
69286
|
plugins: installed
|
|
69136
69287
|
});
|
|
69137
|
-
const configPath =
|
|
69288
|
+
const configPath = join50(codexHome, "config.toml");
|
|
69138
69289
|
await updateCodexConfig({
|
|
69139
69290
|
configPath,
|
|
69140
69291
|
repoRoot: codexPackageRoot,
|
|
@@ -69193,7 +69344,7 @@ function findRepoRootFromImporter(importerDir) {
|
|
|
69193
69344
|
for (let depth = 0;depth <= 7; depth += 1) {
|
|
69194
69345
|
if (isRepoRootWithCodexPlugin(current))
|
|
69195
69346
|
return current;
|
|
69196
|
-
for (const wrapperPackageRoot of [
|
|
69347
|
+
for (const wrapperPackageRoot of [join50(current, "node_modules", "oh-my-openagent"), join50(current, "oh-my-openagent")]) {
|
|
69197
69348
|
if (isRepoRootWithCodexPlugin(wrapperPackageRoot))
|
|
69198
69349
|
return wrapperPackageRoot;
|
|
69199
69350
|
}
|
|
@@ -69211,7 +69362,7 @@ function findRepoRoot(input) {
|
|
|
69211
69362
|
return findRepoRootFromImporter(input.importerDir);
|
|
69212
69363
|
}
|
|
69213
69364
|
function isRepoRootWithCodexPlugin(repoRoot) {
|
|
69214
|
-
return existsSync29(
|
|
69365
|
+
return existsSync29(join50(repoRoot, "packages", "omo-codex", "plugin", ".codex-plugin", "plugin.json"));
|
|
69215
69366
|
}
|
|
69216
69367
|
function codexMarketplaceSource(marketplaceRoot) {
|
|
69217
69368
|
return { sourceType: "local", source: marketplaceRoot };
|
|
@@ -69346,12 +69497,12 @@ function defaultRunCommand2(command, args) {
|
|
|
69346
69497
|
});
|
|
69347
69498
|
}
|
|
69348
69499
|
// packages/omo-codex/src/install/codex-cleanup.ts
|
|
69349
|
-
import { lstat as lstat10, readFile as
|
|
69500
|
+
import { lstat as lstat10, readFile as readFile19, readdir as readdir7, rm as rm9, rmdir } from "fs/promises";
|
|
69350
69501
|
import { homedir as homedir8 } from "os";
|
|
69351
|
-
import { isAbsolute as isAbsolute8, join as
|
|
69502
|
+
import { isAbsolute as isAbsolute8, join as join51, relative as relative6, resolve as resolve15 } from "path";
|
|
69352
69503
|
|
|
69353
69504
|
// packages/omo-codex/src/install/codex-cleanup-config.ts
|
|
69354
|
-
import { lstat as lstat9, mkdir as mkdir8, readFile as
|
|
69505
|
+
import { lstat as lstat9, mkdir as mkdir8, readFile as readFile18, writeFile as writeFile10 } from "fs/promises";
|
|
69355
69506
|
import { dirname as dirname16 } from "path";
|
|
69356
69507
|
var MANAGED_MARKETPLACES = ["sisyphuslabs", "lazycodex", "code-yeongyu-codex-plugins"];
|
|
69357
69508
|
var LEGACY_MANAGED_CODEX_AGENT_NAMES_TO_PURGE2 = ["codex-ultrawork-reviewer"];
|
|
@@ -69381,7 +69532,7 @@ function cleanupCodexLightConfigText(config) {
|
|
|
69381
69532
|
async function cleanupCodexConfig(configPath, now) {
|
|
69382
69533
|
if (!await configExists(configPath))
|
|
69383
69534
|
return { changed: false };
|
|
69384
|
-
const original = await
|
|
69535
|
+
const original = await readFile18(configPath, "utf8");
|
|
69385
69536
|
const next = cleanupCodexLightConfigText(original);
|
|
69386
69537
|
if (next === original)
|
|
69387
69538
|
return { changed: false };
|
|
@@ -69513,8 +69664,8 @@ function nodeErrorCode4(error) {
|
|
|
69513
69664
|
var INSTALLED_AGENTS_MANIFEST = ".installed-agents.json";
|
|
69514
69665
|
async function cleanupCodexLight(input = {}) {
|
|
69515
69666
|
const env3 = input.env ?? process.env;
|
|
69516
|
-
const codexHome = resolve15(input.codexHome ?? env3.CODEX_HOME ??
|
|
69517
|
-
const configPath =
|
|
69667
|
+
const codexHome = resolve15(input.codexHome ?? env3.CODEX_HOME ?? join51(homedir8(), ".codex"));
|
|
69668
|
+
const configPath = join51(codexHome, "config.toml");
|
|
69518
69669
|
const agentPaths = await collectInstalledAgentPaths(codexHome, configPath);
|
|
69519
69670
|
const configCleanup = await cleanupCodexConfig(configPath, input.now);
|
|
69520
69671
|
const agentCleanup = await removeManifestListedAgentLinks(codexHome, agentPaths);
|
|
@@ -69550,17 +69701,17 @@ async function cleanupCodexLight(input = {}) {
|
|
|
69550
69701
|
}
|
|
69551
69702
|
function managedGlobalStatePaths(codexHome) {
|
|
69552
69703
|
return [
|
|
69553
|
-
|
|
69554
|
-
|
|
69555
|
-
|
|
69556
|
-
|
|
69557
|
-
|
|
69704
|
+
join51(codexHome, "plugins", "cache", "sisyphuslabs"),
|
|
69705
|
+
join51(codexHome, ".tmp", "marketplaces", "sisyphuslabs"),
|
|
69706
|
+
join51(codexHome, "runtime", "ast-grep"),
|
|
69707
|
+
join51(codexHome, "runtime", "node"),
|
|
69708
|
+
join51(codexHome, "plugins", "data", "omo-sisyphuslabs", "bootstrap")
|
|
69558
69709
|
];
|
|
69559
69710
|
}
|
|
69560
69711
|
var BOOTSTRAP_DATA_GLOB_MAX_DEPTH = 5;
|
|
69561
69712
|
async function collectBootstrapDataDirsByGlob(codexHome) {
|
|
69562
69713
|
const results = [];
|
|
69563
|
-
await walkForManagedBootstrapDirs(
|
|
69714
|
+
await walkForManagedBootstrapDirs(join51(codexHome, "plugins"), 0, results);
|
|
69564
69715
|
return results;
|
|
69565
69716
|
}
|
|
69566
69717
|
async function walkForManagedBootstrapDirs(directory, depth, results) {
|
|
@@ -69572,9 +69723,9 @@ async function walkForManagedBootstrapDirs(directory, depth, results) {
|
|
|
69572
69723
|
for (const entry of entries) {
|
|
69573
69724
|
if (!entry.isDirectory())
|
|
69574
69725
|
continue;
|
|
69575
|
-
const childPath =
|
|
69726
|
+
const childPath = join51(directory, entry.name);
|
|
69576
69727
|
if (isManagedBootstrapOwnerName(entry.name)) {
|
|
69577
|
-
const bootstrapDir =
|
|
69728
|
+
const bootstrapDir = join51(childPath, "bootstrap");
|
|
69578
69729
|
if (await exists6(bootstrapDir))
|
|
69579
69730
|
results.push(bootstrapDir);
|
|
69580
69731
|
continue;
|
|
@@ -69603,19 +69754,19 @@ async function attemptRemove(path7) {
|
|
|
69603
69754
|
}
|
|
69604
69755
|
async function pruneEmptyRuntimeDirBestEffort(codexHome) {
|
|
69605
69756
|
try {
|
|
69606
|
-
await rmdir(
|
|
69757
|
+
await rmdir(join51(codexHome, "runtime"));
|
|
69607
69758
|
} catch {}
|
|
69608
69759
|
}
|
|
69609
69760
|
async function collectInstalledAgentPaths(codexHome, configPath) {
|
|
69610
69761
|
const manifestPaths = [
|
|
69611
|
-
|
|
69762
|
+
join51(codexHome, ".tmp", "marketplaces", "sisyphuslabs", "plugins", "omo", INSTALLED_AGENTS_MANIFEST)
|
|
69612
69763
|
];
|
|
69613
|
-
const versionRoot =
|
|
69764
|
+
const versionRoot = join51(codexHome, "plugins", "cache", "sisyphuslabs", "omo");
|
|
69614
69765
|
if (await exists6(versionRoot)) {
|
|
69615
69766
|
const entries = await readdir7(versionRoot, { withFileTypes: true });
|
|
69616
69767
|
for (const entry of entries) {
|
|
69617
69768
|
if (entry.isDirectory())
|
|
69618
|
-
manifestPaths.push(
|
|
69769
|
+
manifestPaths.push(join51(versionRoot, entry.name, INSTALLED_AGENTS_MANIFEST));
|
|
69619
69770
|
}
|
|
69620
69771
|
}
|
|
69621
69772
|
const paths = new Set;
|
|
@@ -69632,19 +69783,19 @@ async function collectInstalledAgentPaths(codexHome, configPath) {
|
|
|
69632
69783
|
async function readManagedAgentPathsFromConfig(codexHome, configPath) {
|
|
69633
69784
|
if (!await exists6(configPath))
|
|
69634
69785
|
return [];
|
|
69635
|
-
const config = await
|
|
69636
|
-
return MANAGED_CODEX_AGENT_NAMES2.filter((agentName) => config.includes(`config_file = ${JSON.stringify(`./agents/${agentName}.toml`)}`)).map((agentName) =>
|
|
69786
|
+
const config = await readFile19(configPath, "utf8");
|
|
69787
|
+
return MANAGED_CODEX_AGENT_NAMES2.filter((agentName) => config.includes(`config_file = ${JSON.stringify(`./agents/${agentName}.toml`)}`)).map((agentName) => join51(codexHome, "agents", `${agentName}.toml`));
|
|
69637
69788
|
}
|
|
69638
69789
|
async function readInstalledAgentManifest(manifestPath) {
|
|
69639
69790
|
if (!await exists6(manifestPath))
|
|
69640
69791
|
return [];
|
|
69641
|
-
const parsed = JSON.parse(await
|
|
69792
|
+
const parsed = JSON.parse(await readFile19(manifestPath, "utf8"));
|
|
69642
69793
|
if (!isPlainRecord3(parsed) || !Array.isArray(parsed.agents))
|
|
69643
69794
|
return [];
|
|
69644
69795
|
return parsed.agents.filter((path7) => typeof path7 === "string");
|
|
69645
69796
|
}
|
|
69646
69797
|
async function removeManifestListedAgentLinks(codexHome, paths) {
|
|
69647
|
-
const agentsDir =
|
|
69798
|
+
const agentsDir = join51(codexHome, "agents");
|
|
69648
69799
|
const removed = [];
|
|
69649
69800
|
const skipped = [];
|
|
69650
69801
|
for (const path7 of paths) {
|
|
@@ -69728,19 +69879,19 @@ init_provider_availability();
|
|
|
69728
69879
|
|
|
69729
69880
|
// packages/omo-opencode/src/cli/config-manager/add-tui-plugin-to-tui-config.ts
|
|
69730
69881
|
import { existsSync as existsSync32, mkdirSync as mkdirSync10, readFileSync as readFileSync16 } from "fs";
|
|
69731
|
-
import { join as
|
|
69882
|
+
import { join as join53 } from "path";
|
|
69732
69883
|
|
|
69733
69884
|
// packages/omo-opencode/src/cli/doctor/checks/tui-plugin-config.ts
|
|
69734
69885
|
init_shared();
|
|
69735
69886
|
import { existsSync as existsSync31, readFileSync as readFileSync15 } from "fs";
|
|
69736
|
-
import { join as
|
|
69887
|
+
import { join as join52 } from "path";
|
|
69737
69888
|
var TUI_SUBPATH = "tui";
|
|
69738
69889
|
var TUI_EXPORT_SUBPATH = `./${TUI_SUBPATH}`;
|
|
69739
69890
|
function fileEntryPackageJsonPath(entry) {
|
|
69740
69891
|
let path7 = entry.slice("file:".length);
|
|
69741
69892
|
if (path7.startsWith("//"))
|
|
69742
69893
|
path7 = path7.slice(2);
|
|
69743
|
-
return
|
|
69894
|
+
return join52(path7, "package.json");
|
|
69744
69895
|
}
|
|
69745
69896
|
function packageJsonExportsTui(pkgJsonPath) {
|
|
69746
69897
|
if (!existsSync31(pkgJsonPath))
|
|
@@ -69778,7 +69929,7 @@ function packageExportsTuiForServerEntry(entry) {
|
|
|
69778
69929
|
const packageName = packageNameFromServerEntry(entry);
|
|
69779
69930
|
if (packageName === null)
|
|
69780
69931
|
return null;
|
|
69781
|
-
return packageJsonExportsTui(
|
|
69932
|
+
return packageJsonExportsTui(join52(getOpenCodeConfigDir({ binary: "opencode" }), "node_modules", packageName, "package.json"));
|
|
69782
69933
|
}
|
|
69783
69934
|
function isOurFilePluginEntry(entry) {
|
|
69784
69935
|
if (!entry.startsWith("file:"))
|
|
@@ -69851,7 +70002,7 @@ function detectServerPluginRegistration() {
|
|
|
69851
70002
|
}
|
|
69852
70003
|
}
|
|
69853
70004
|
function detectTuiPluginRegistration() {
|
|
69854
|
-
const tuiJsonPath =
|
|
70005
|
+
const tuiJsonPath = join52(getOpenCodeConfigDir({ binary: "opencode" }), "tui.json");
|
|
69855
70006
|
if (!existsSync31(tuiJsonPath)) {
|
|
69856
70007
|
return {
|
|
69857
70008
|
registered: false,
|
|
@@ -70007,10 +70158,10 @@ function readConfig(path7) {
|
|
|
70007
70158
|
return null;
|
|
70008
70159
|
}
|
|
70009
70160
|
function readServerConfig(configDir) {
|
|
70010
|
-
const jsoncPath =
|
|
70161
|
+
const jsoncPath = join53(configDir, "opencode.jsonc");
|
|
70011
70162
|
if (existsSync32(jsoncPath))
|
|
70012
70163
|
return readConfig(jsoncPath);
|
|
70013
|
-
const jsonPath =
|
|
70164
|
+
const jsonPath = join53(configDir, "opencode.json");
|
|
70014
70165
|
if (existsSync32(jsonPath))
|
|
70015
70166
|
return readConfig(jsonPath);
|
|
70016
70167
|
return null;
|
|
@@ -70052,7 +70203,7 @@ function ensureTuiPluginEntry(opts = {}) {
|
|
|
70052
70203
|
if (!desiredEntry) {
|
|
70053
70204
|
return { changed: false, reason: "no-server-entry" };
|
|
70054
70205
|
}
|
|
70055
|
-
const tuiJsonPath =
|
|
70206
|
+
const tuiJsonPath = join53(configDir, "tui.json");
|
|
70056
70207
|
const { config, malformed } = readTuiConfig(tuiJsonPath);
|
|
70057
70208
|
if (malformed) {
|
|
70058
70209
|
return { changed: false, reason: "malformed" };
|
|
@@ -70068,7 +70219,7 @@ function ensureTuiPluginEntry(opts = {}) {
|
|
|
70068
70219
|
|
|
70069
70220
|
// packages/omo-opencode/src/cli/install-ast-grep-sg.ts
|
|
70070
70221
|
import { homedir as homedir9 } from "os";
|
|
70071
|
-
import { join as
|
|
70222
|
+
import { join as join54 } from "path";
|
|
70072
70223
|
|
|
70073
70224
|
// packages/shared-skills/index.mjs
|
|
70074
70225
|
import { fileURLToPath } from "url";
|
|
@@ -70087,9 +70238,9 @@ function describeResult2(result) {
|
|
|
70087
70238
|
}
|
|
70088
70239
|
async function installAstGrepForOpenCode(options = {}) {
|
|
70089
70240
|
const platform = options.platform ?? process.platform;
|
|
70090
|
-
const baseDir =
|
|
70241
|
+
const baseDir = join54(options.homeDir ?? homedir9(), ".omo");
|
|
70091
70242
|
const targetDir = astGrepRuntimeDir(baseDir, platform, options.arch ?? process.arch);
|
|
70092
|
-
const skillDir =
|
|
70243
|
+
const skillDir = join54(options.sharedSkillsRoot ?? sharedSkillsRootPath(), "ast-grep");
|
|
70093
70244
|
const installer = options.installer ?? runAstGrepSkillInstall;
|
|
70094
70245
|
try {
|
|
70095
70246
|
const result = await installer({ platform, skillDir, targetDir });
|
|
@@ -88535,9 +88686,9 @@ function readCurrentTopLevelTask(planPath) {
|
|
|
88535
88686
|
}
|
|
88536
88687
|
// packages/boulder-state/src/storage/path.ts
|
|
88537
88688
|
import { existsSync as existsSync36 } from "fs";
|
|
88538
|
-
import { isAbsolute as isAbsolute9, join as
|
|
88689
|
+
import { isAbsolute as isAbsolute9, join as join56, relative as relative7, resolve as resolve16 } from "path";
|
|
88539
88690
|
function getBoulderFilePath(directory) {
|
|
88540
|
-
return
|
|
88691
|
+
return join56(directory, BOULDER_DIR, BOULDER_FILE);
|
|
88541
88692
|
}
|
|
88542
88693
|
function resolveTrackedPath(baseDirectory, trackedPath) {
|
|
88543
88694
|
return isAbsolute9(trackedPath) ? resolve16(trackedPath) : resolve16(baseDirectory, trackedPath);
|
|
@@ -88766,9 +88917,9 @@ init_state();
|
|
|
88766
88917
|
var CONTINUATION_MARKER_DIR = ".omo/run-continuation";
|
|
88767
88918
|
// packages/omo-opencode/src/features/run-continuation-state/storage.ts
|
|
88768
88919
|
import { existsSync as existsSync39, mkdirSync as mkdirSync11, readFileSync as readFileSync21, rmSync as rmSync2, writeFileSync as writeFileSync6 } from "fs";
|
|
88769
|
-
import { join as
|
|
88920
|
+
import { join as join57 } from "path";
|
|
88770
88921
|
function getMarkerPath(directory, sessionID) {
|
|
88771
|
-
return
|
|
88922
|
+
return join57(directory, CONTINUATION_MARKER_DIR, `${sessionID}.json`);
|
|
88772
88923
|
}
|
|
88773
88924
|
function readContinuationMarker(directory, sessionID) {
|
|
88774
88925
|
const markerPath = getMarkerPath(directory, sessionID);
|
|
@@ -88841,7 +88992,7 @@ async function isSessionInBoulderLineage(input) {
|
|
|
88841
88992
|
init_shared();
|
|
88842
88993
|
init_compaction_marker();
|
|
88843
88994
|
import { readFileSync as readFileSync22, readdirSync as readdirSync6 } from "fs";
|
|
88844
|
-
import { join as
|
|
88995
|
+
import { join as join58 } from "path";
|
|
88845
88996
|
var defaultSessionLastAgentDeps = {
|
|
88846
88997
|
getMessageDir,
|
|
88847
88998
|
isSqliteBackend,
|
|
@@ -88901,7 +89052,7 @@ async function getLastAgentFromSession(sessionID, client3, deps = {}) {
|
|
|
88901
89052
|
try {
|
|
88902
89053
|
const messages = readdirSync6(messageDir).filter((fileName) => fileName.endsWith(".json")).map((fileName) => {
|
|
88903
89054
|
try {
|
|
88904
|
-
const content = readFileSync22(
|
|
89055
|
+
const content = readFileSync22(join58(messageDir, fileName), "utf-8");
|
|
88905
89056
|
const parsed = JSON.parse(content);
|
|
88906
89057
|
return {
|
|
88907
89058
|
fileName,
|
|
@@ -88945,7 +89096,7 @@ init_agent_display_names();
|
|
|
88945
89096
|
// packages/omo-opencode/src/hooks/ralph-loop/storage.ts
|
|
88946
89097
|
init_frontmatter2();
|
|
88947
89098
|
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
|
|
89099
|
+
import { dirname as dirname19, join as join59 } from "path";
|
|
88949
89100
|
|
|
88950
89101
|
// packages/omo-opencode/src/hooks/ralph-loop/constants.ts
|
|
88951
89102
|
var DEFAULT_STATE_FILE = ".omo/ralph-loop.local.md";
|
|
@@ -88954,7 +89105,7 @@ var DEFAULT_COMPLETION_PROMISE = "DONE";
|
|
|
88954
89105
|
|
|
88955
89106
|
// packages/omo-opencode/src/hooks/ralph-loop/storage.ts
|
|
88956
89107
|
function getStateFilePath(directory, customPath) {
|
|
88957
|
-
return customPath ?
|
|
89108
|
+
return customPath ? join59(directory, customPath) : join59(directory, DEFAULT_STATE_FILE);
|
|
88958
89109
|
}
|
|
88959
89110
|
function readState(directory, customPath) {
|
|
88960
89111
|
const filePath = getStateFilePath(directory, customPath);
|
|
@@ -90067,7 +90218,7 @@ init_extract_semver();
|
|
|
90067
90218
|
init_bun_which_shim();
|
|
90068
90219
|
import { existsSync as existsSync48, accessSync as accessSync4, constants as constants9 } from "fs";
|
|
90069
90220
|
import { homedir as homedir13 } from "os";
|
|
90070
|
-
import { join as
|
|
90221
|
+
import { join as join66 } from "path";
|
|
90071
90222
|
|
|
90072
90223
|
// packages/omo-opencode/src/cli/doctor/framework/spawn-with-timeout.ts
|
|
90073
90224
|
init_spawn_with_windows_hide();
|
|
@@ -90159,17 +90310,17 @@ function getDesktopAppPaths(platform) {
|
|
|
90159
90310
|
case "darwin":
|
|
90160
90311
|
return [
|
|
90161
90312
|
"/Applications/OpenCode.app/Contents/MacOS/OpenCode",
|
|
90162
|
-
|
|
90313
|
+
join66(home, "Applications", "OpenCode.app", "Contents", "MacOS", "OpenCode")
|
|
90163
90314
|
];
|
|
90164
90315
|
case "win32": {
|
|
90165
90316
|
const programFiles = process.env.ProgramFiles;
|
|
90166
90317
|
const localAppData = process.env.LOCALAPPDATA;
|
|
90167
90318
|
const paths = [];
|
|
90168
90319
|
if (programFiles) {
|
|
90169
|
-
paths.push(
|
|
90320
|
+
paths.push(join66(programFiles, "OpenCode", "OpenCode.exe"));
|
|
90170
90321
|
}
|
|
90171
90322
|
if (localAppData) {
|
|
90172
|
-
paths.push(
|
|
90323
|
+
paths.push(join66(localAppData, "OpenCode", "OpenCode.exe"));
|
|
90173
90324
|
}
|
|
90174
90325
|
return paths;
|
|
90175
90326
|
}
|
|
@@ -90177,8 +90328,8 @@ function getDesktopAppPaths(platform) {
|
|
|
90177
90328
|
return [
|
|
90178
90329
|
"/usr/bin/opencode",
|
|
90179
90330
|
"/usr/lib/opencode/opencode",
|
|
90180
|
-
|
|
90181
|
-
|
|
90331
|
+
join66(home, "Applications", "opencode-desktop-linux-x86_64.AppImage"),
|
|
90332
|
+
join66(home, "Applications", "opencode-desktop-linux-aarch64.AppImage")
|
|
90182
90333
|
];
|
|
90183
90334
|
default:
|
|
90184
90335
|
return [];
|
|
@@ -90210,7 +90361,7 @@ async function findOpenCodeBinary(platform = process.platform, checkExists = exi
|
|
|
90210
90361
|
const candidates = getCommandCandidates2(platform);
|
|
90211
90362
|
for (const entry of pathEnv.split(delimiter3).filter(Boolean)) {
|
|
90212
90363
|
for (const command of candidates) {
|
|
90213
|
-
const fullPath =
|
|
90364
|
+
const fullPath = join66(entry, command);
|
|
90214
90365
|
if (checkExists(fullPath) && isExecutable2(fullPath)) {
|
|
90215
90366
|
return { binary: command, path: fullPath };
|
|
90216
90367
|
}
|
|
@@ -90352,22 +90503,22 @@ init_package_json_locator();
|
|
|
90352
90503
|
import { existsSync as existsSync50, readFileSync as readFileSync32, readdirSync as readdirSync8 } from "fs";
|
|
90353
90504
|
import { createRequire as createRequire2 } from "module";
|
|
90354
90505
|
import { homedir as homedir14 } from "os";
|
|
90355
|
-
import { join as
|
|
90506
|
+
import { join as join67 } from "path";
|
|
90356
90507
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
90357
90508
|
init_shared();
|
|
90358
90509
|
function getPlatformDefaultCacheDir(platform = process.platform) {
|
|
90359
90510
|
if (platform === "darwin")
|
|
90360
|
-
return
|
|
90511
|
+
return join67(homedir14(), "Library", "Caches");
|
|
90361
90512
|
if (platform === "win32")
|
|
90362
|
-
return process.env.LOCALAPPDATA ??
|
|
90363
|
-
return
|
|
90513
|
+
return process.env.LOCALAPPDATA ?? join67(homedir14(), "AppData", "Local");
|
|
90514
|
+
return join67(homedir14(), ".cache");
|
|
90364
90515
|
}
|
|
90365
90516
|
function resolveOpenCodeCacheDir() {
|
|
90366
90517
|
const xdgCacheHome = process.env.XDG_CACHE_HOME;
|
|
90367
90518
|
if (xdgCacheHome)
|
|
90368
|
-
return
|
|
90519
|
+
return join67(xdgCacheHome, "opencode");
|
|
90369
90520
|
const fromShared = getOpenCodeCacheDir();
|
|
90370
|
-
const platformDefault =
|
|
90521
|
+
const platformDefault = join67(getPlatformDefaultCacheDir(), "opencode");
|
|
90371
90522
|
if (existsSync50(fromShared) || !existsSync50(platformDefault))
|
|
90372
90523
|
return fromShared;
|
|
90373
90524
|
return platformDefault;
|
|
@@ -90399,11 +90550,11 @@ function normalizeVersion(value) {
|
|
|
90399
90550
|
function createPackageCandidates(rootDir) {
|
|
90400
90551
|
return ACCEPTED_PACKAGE_NAMES.map((packageName) => ({
|
|
90401
90552
|
packageName,
|
|
90402
|
-
installedPackagePath:
|
|
90553
|
+
installedPackagePath: join67(rootDir, "node_modules", packageName, "package.json")
|
|
90403
90554
|
}));
|
|
90404
90555
|
}
|
|
90405
90556
|
function createTaggedInstallCandidates(rootDir) {
|
|
90406
|
-
const packagesDir =
|
|
90557
|
+
const packagesDir = join67(rootDir, "packages");
|
|
90407
90558
|
if (!existsSync50(packagesDir))
|
|
90408
90559
|
return [];
|
|
90409
90560
|
const candidates = [];
|
|
@@ -90411,14 +90562,14 @@ function createTaggedInstallCandidates(rootDir) {
|
|
|
90411
90562
|
const packageName = ACCEPTED_PACKAGE_NAMES.find((name) => entryName.startsWith(`${name}@`));
|
|
90412
90563
|
if (packageName === undefined)
|
|
90413
90564
|
continue;
|
|
90414
|
-
const installDir =
|
|
90565
|
+
const installDir = join67(packagesDir, entryName);
|
|
90415
90566
|
candidates.push({
|
|
90416
90567
|
cacheDir: installDir,
|
|
90417
|
-
cachePackagePath:
|
|
90568
|
+
cachePackagePath: join67(installDir, "package.json"),
|
|
90418
90569
|
packageCandidates: [
|
|
90419
90570
|
{
|
|
90420
90571
|
packageName,
|
|
90421
|
-
installedPackagePath:
|
|
90572
|
+
installedPackagePath: join67(installDir, "node_modules", packageName, "package.json")
|
|
90422
90573
|
}
|
|
90423
90574
|
]
|
|
90424
90575
|
});
|
|
@@ -90463,13 +90614,13 @@ function getLoadedPluginVersion() {
|
|
|
90463
90614
|
const candidates = [
|
|
90464
90615
|
{
|
|
90465
90616
|
cacheDir: configDir,
|
|
90466
|
-
cachePackagePath:
|
|
90617
|
+
cachePackagePath: join67(configDir, "package.json"),
|
|
90467
90618
|
packageCandidates: createPackageCandidates(configDir)
|
|
90468
90619
|
},
|
|
90469
90620
|
...createTaggedInstallCandidates(configDir),
|
|
90470
90621
|
{
|
|
90471
90622
|
cacheDir,
|
|
90472
|
-
cachePackagePath:
|
|
90623
|
+
cachePackagePath: join67(cacheDir, "package.json"),
|
|
90473
90624
|
packageCandidates: createPackageCandidates(cacheDir)
|
|
90474
90625
|
},
|
|
90475
90626
|
...createTaggedInstallCandidates(cacheDir)
|
|
@@ -90772,18 +90923,18 @@ function validatePluginConfig(directory) {
|
|
|
90772
90923
|
init_shared();
|
|
90773
90924
|
import { existsSync as existsSync52, readFileSync as readFileSync35 } from "fs";
|
|
90774
90925
|
import { homedir as homedir16 } from "os";
|
|
90775
|
-
import { join as
|
|
90926
|
+
import { join as join68 } from "path";
|
|
90776
90927
|
function getUserConfigDir2() {
|
|
90777
90928
|
const xdgConfig = process.env.XDG_CONFIG_HOME;
|
|
90778
90929
|
if (xdgConfig)
|
|
90779
|
-
return
|
|
90780
|
-
return
|
|
90930
|
+
return join68(xdgConfig, "opencode");
|
|
90931
|
+
return join68(homedir16(), ".config", "opencode");
|
|
90781
90932
|
}
|
|
90782
90933
|
function loadCustomProviderNames() {
|
|
90783
90934
|
const configDir = getUserConfigDir2();
|
|
90784
90935
|
const candidatePaths = [
|
|
90785
|
-
|
|
90786
|
-
|
|
90936
|
+
join68(configDir, "opencode.json"),
|
|
90937
|
+
join68(configDir, "opencode.jsonc")
|
|
90787
90938
|
];
|
|
90788
90939
|
for (const configPath of candidatePaths) {
|
|
90789
90940
|
if (!existsSync52(configPath))
|
|
@@ -90804,7 +90955,7 @@ function loadCustomProviderNames() {
|
|
|
90804
90955
|
return [];
|
|
90805
90956
|
}
|
|
90806
90957
|
function loadAvailableModelsFromCache() {
|
|
90807
|
-
const cacheFile =
|
|
90958
|
+
const cacheFile = join68(getOpenCodeCacheDir(), "models.json");
|
|
90808
90959
|
const customProviders = loadCustomProviderNames();
|
|
90809
90960
|
if (!existsSync52(cacheFile)) {
|
|
90810
90961
|
if (customProviders.length > 0) {
|
|
@@ -90841,8 +90992,8 @@ init_model_capabilities2();
|
|
|
90841
90992
|
init_shared();
|
|
90842
90993
|
init_plugin_identity();
|
|
90843
90994
|
import { readFileSync as readFileSync36 } from "fs";
|
|
90844
|
-
import { join as
|
|
90845
|
-
var PROJECT_CONFIG_DIR =
|
|
90995
|
+
import { join as join69 } from "path";
|
|
90996
|
+
var PROJECT_CONFIG_DIR = join69(process.cwd(), ".opencode");
|
|
90846
90997
|
function loadOmoConfig() {
|
|
90847
90998
|
const projectDetected = detectPluginConfigFile(PROJECT_CONFIG_DIR, {
|
|
90848
90999
|
basenames: [CONFIG_BASENAME],
|
|
@@ -90880,7 +91031,7 @@ function loadOmoConfig() {
|
|
|
90880
91031
|
|
|
90881
91032
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-details.ts
|
|
90882
91033
|
init_shared();
|
|
90883
|
-
import { join as
|
|
91034
|
+
import { join as join70 } from "path";
|
|
90884
91035
|
|
|
90885
91036
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-variant.ts
|
|
90886
91037
|
function formatModelWithVariant(model, variant) {
|
|
@@ -90922,7 +91073,7 @@ function formatCapabilityResolutionLabel(mode) {
|
|
|
90922
91073
|
}
|
|
90923
91074
|
function buildModelResolutionDetails(options) {
|
|
90924
91075
|
const details = [];
|
|
90925
|
-
const cacheFile =
|
|
91076
|
+
const cacheFile = join70(getOpenCodeCacheDir(), "models.json");
|
|
90926
91077
|
details.push("\u2550\u2550\u2550 Available Models (from cache) \u2550\u2550\u2550");
|
|
90927
91078
|
details.push("");
|
|
90928
91079
|
if (options.available.cacheExists) {
|
|
@@ -91201,25 +91352,25 @@ init_src();
|
|
|
91201
91352
|
import { existsSync as existsSync53 } from "fs";
|
|
91202
91353
|
import { createRequire as createRequire3 } from "module";
|
|
91203
91354
|
import { homedir as homedir18 } from "os";
|
|
91204
|
-
import { dirname as dirname25, join as
|
|
91355
|
+
import { dirname as dirname25, join as join72 } from "path";
|
|
91205
91356
|
|
|
91206
91357
|
// packages/omo-opencode/src/hooks/comment-checker/downloader.ts
|
|
91207
|
-
import { join as
|
|
91358
|
+
import { join as join71 } from "path";
|
|
91208
91359
|
import { homedir as homedir17, tmpdir as tmpdir3 } from "os";
|
|
91209
91360
|
init_binary_downloader();
|
|
91210
91361
|
init_logger2();
|
|
91211
91362
|
init_plugin_identity();
|
|
91212
91363
|
var DEBUG = process.env.COMMENT_CHECKER_DEBUG === "1";
|
|
91213
|
-
var DEBUG_FILE =
|
|
91364
|
+
var DEBUG_FILE = join71(tmpdir3(), "comment-checker-debug.log");
|
|
91214
91365
|
function getCacheDir2() {
|
|
91215
91366
|
if (process.platform === "win32") {
|
|
91216
91367
|
const localAppData = process.env.LOCALAPPDATA || process.env.APPDATA;
|
|
91217
|
-
const base2 = localAppData ||
|
|
91218
|
-
return
|
|
91368
|
+
const base2 = localAppData || join71(homedir17(), "AppData", "Local");
|
|
91369
|
+
return join71(base2, CACHE_DIR_NAME, "bin");
|
|
91219
91370
|
}
|
|
91220
91371
|
const xdgCache = process.env.XDG_CACHE_HOME;
|
|
91221
|
-
const base = xdgCache ||
|
|
91222
|
-
return
|
|
91372
|
+
const base = xdgCache || join71(homedir17(), ".cache");
|
|
91373
|
+
return join71(base, CACHE_DIR_NAME, "bin");
|
|
91223
91374
|
}
|
|
91224
91375
|
function getBinaryName() {
|
|
91225
91376
|
return process.platform === "win32" ? "comment-checker.exe" : "comment-checker";
|
|
@@ -91269,7 +91420,7 @@ async function getBinaryVersion(binary) {
|
|
|
91269
91420
|
}
|
|
91270
91421
|
}
|
|
91271
91422
|
async function checkAstGrepCli() {
|
|
91272
|
-
const runtimeDir = astGrepRuntimeDir(
|
|
91423
|
+
const runtimeDir = astGrepRuntimeDir(join72(homedir18(), ".omo"));
|
|
91273
91424
|
const sgPath = findSgBinarySync({ runtimeDir });
|
|
91274
91425
|
if (sgPath === null) {
|
|
91275
91426
|
return {
|
|
@@ -91299,10 +91450,10 @@ function findCommentCheckerPackageBinary(baseDirOverride, resolvePackageJsonPath
|
|
|
91299
91450
|
const platformKey = `${process.platform}-${process.arch === "x64" ? "x64" : process.arch}`;
|
|
91300
91451
|
try {
|
|
91301
91452
|
const packageDir = baseDirOverride ?? dirname25(resolvePackageJsonPath());
|
|
91302
|
-
const vendorPath =
|
|
91453
|
+
const vendorPath = join72(packageDir, "vendor", platformKey, binaryName);
|
|
91303
91454
|
if (existsSync53(vendorPath))
|
|
91304
91455
|
return vendorPath;
|
|
91305
|
-
const binPath =
|
|
91456
|
+
const binPath = join72(packageDir, "bin", binaryName);
|
|
91306
91457
|
if (existsSync53(binPath))
|
|
91307
91458
|
return binPath;
|
|
91308
91459
|
} catch (error51) {
|
|
@@ -91448,7 +91599,7 @@ async function getGhCliInfo(dependencies = {}) {
|
|
|
91448
91599
|
|
|
91449
91600
|
// packages/omo-opencode/src/cli/doctor/checks/tools-lsp.ts
|
|
91450
91601
|
import { readFileSync as readFileSync37 } from "fs";
|
|
91451
|
-
import { join as
|
|
91602
|
+
import { join as join73 } from "path";
|
|
91452
91603
|
|
|
91453
91604
|
// packages/omo-opencode/src/mcp/lsp.ts
|
|
91454
91605
|
import { existsSync as existsSync54 } from "fs";
|
|
@@ -91655,7 +91806,7 @@ function readOmoConfig(configDirectory) {
|
|
|
91655
91806
|
}
|
|
91656
91807
|
function isLspMcpDisabled(options) {
|
|
91657
91808
|
const userConfigDirectory = options.configDirectory ?? getOpenCodeConfigDir({ binary: "opencode" });
|
|
91658
|
-
const projectConfigDirectory =
|
|
91809
|
+
const projectConfigDirectory = join73(options.cwd ?? process.cwd(), ".opencode");
|
|
91659
91810
|
const userConfig = readOmoConfig(userConfigDirectory);
|
|
91660
91811
|
const projectConfig = readOmoConfig(projectConfigDirectory);
|
|
91661
91812
|
const disabledMcps = new Set([
|
|
@@ -91676,13 +91827,13 @@ function getInstalledLspServers(options = {}) {
|
|
|
91676
91827
|
init_shared();
|
|
91677
91828
|
import { existsSync as existsSync55, readFileSync as readFileSync38 } from "fs";
|
|
91678
91829
|
import { homedir as homedir19 } from "os";
|
|
91679
|
-
import { join as
|
|
91830
|
+
import { join as join74 } from "path";
|
|
91680
91831
|
var BUILTIN_MCP_SERVERS = ["websearch", "context7", "grep_app", "lsp"];
|
|
91681
91832
|
function getMcpConfigPaths() {
|
|
91682
91833
|
return [
|
|
91683
|
-
|
|
91684
|
-
|
|
91685
|
-
|
|
91834
|
+
join74(homedir19(), ".claude", ".mcp.json"),
|
|
91835
|
+
join74(process.cwd(), ".mcp.json"),
|
|
91836
|
+
join74(process.cwd(), ".claude", ".mcp.json")
|
|
91686
91837
|
];
|
|
91687
91838
|
}
|
|
91688
91839
|
function loadUserMcpConfig() {
|
|
@@ -91927,9 +92078,9 @@ async function pathExists(dir) {
|
|
|
91927
92078
|
// packages/omo-opencode/src/cli/doctor/checks/codex.ts
|
|
91928
92079
|
init_src();
|
|
91929
92080
|
import { existsSync as existsSync56 } from "fs";
|
|
91930
|
-
import { lstat as lstat11, readdir as readdir8, readFile as
|
|
92081
|
+
import { lstat as lstat11, readdir as readdir8, readFile as readFile20 } from "fs/promises";
|
|
91931
92082
|
import { homedir as homedir21 } from "os";
|
|
91932
|
-
import { basename as basename12, join as
|
|
92083
|
+
import { basename as basename12, join as join75, resolve as resolve19 } from "path";
|
|
91933
92084
|
// packages/omo-opencode/package.json
|
|
91934
92085
|
var package_default3 = {
|
|
91935
92086
|
name: "@oh-my-opencode/omo-opencode",
|
|
@@ -91985,13 +92136,13 @@ var CODEX_BIN_NAMES = [
|
|
|
91985
92136
|
"omo-git-bash-hook"
|
|
91986
92137
|
];
|
|
91987
92138
|
async function gatherCodexSummary(deps = {}) {
|
|
91988
|
-
const codexHome = resolve19(deps.codexHome ?? process.env.CODEX_HOME ??
|
|
92139
|
+
const codexHome = resolve19(deps.codexHome ?? process.env.CODEX_HOME ?? join75(homedir21(), ".codex"));
|
|
91989
92140
|
const binDir = resolveCodexInstallerBinDir({ binDir: deps.binDir, codexHome, env: process.env });
|
|
91990
92141
|
const detection = await (deps.detectCodexInstallation ?? detectCodexInstallation)();
|
|
91991
92142
|
const pluginRoot = await resolveInstalledPluginRoot(codexHome);
|
|
91992
|
-
const manifest = pluginRoot === null ? null : await readJson(
|
|
91993
|
-
const installSnapshot = pluginRoot === null ? null : await readJson(
|
|
91994
|
-
const configPath =
|
|
92143
|
+
const manifest = pluginRoot === null ? null : await readJson(join75(pluginRoot, ".codex-plugin", "plugin.json"));
|
|
92144
|
+
const installSnapshot = pluginRoot === null ? null : await readJson(join75(pluginRoot, "lazycodex-install.json"));
|
|
92145
|
+
const configPath = join75(codexHome, "config.toml");
|
|
91995
92146
|
const pluginVersion = stringField(manifest, "version");
|
|
91996
92147
|
return {
|
|
91997
92148
|
codexPath: detection.found && "path" in detection ? detection.path : null,
|
|
@@ -92047,7 +92198,7 @@ function buildCodexIssues(summary) {
|
|
|
92047
92198
|
if (summary.pluginRoot === null) {
|
|
92048
92199
|
issues.push({
|
|
92049
92200
|
title: "OMO Codex plugin is not installed",
|
|
92050
|
-
description: `Expected cached plugin at ${
|
|
92201
|
+
description: `Expected cached plugin at ${join75("plugins", "cache", MARKETPLACE_NAME, PLUGIN_NAME2, DEFAULT_PLUGIN_VERSION)} under CODEX_HOME.`,
|
|
92051
92202
|
fix: "Run: npx lazycodex-ai install",
|
|
92052
92203
|
severity: "error",
|
|
92053
92204
|
affects: ["plugin loading"]
|
|
@@ -92100,18 +92251,18 @@ function buildCodexIssues(summary) {
|
|
|
92100
92251
|
return issues;
|
|
92101
92252
|
}
|
|
92102
92253
|
async function resolveInstalledPluginRoot(codexHome) {
|
|
92103
|
-
const pluginRoot =
|
|
92254
|
+
const pluginRoot = join75(codexHome, "plugins", "cache", MARKETPLACE_NAME, PLUGIN_NAME2);
|
|
92104
92255
|
if (!existsSync56(pluginRoot))
|
|
92105
92256
|
return null;
|
|
92106
92257
|
const versions2 = await readdir8(pluginRoot, { withFileTypes: true });
|
|
92107
92258
|
const candidates = versions2.filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort(compareVersionsDescending);
|
|
92108
|
-
return candidates.length === 0 ? null :
|
|
92259
|
+
return candidates.length === 0 ? null : join75(pluginRoot, candidates[0] ?? DEFAULT_PLUGIN_VERSION);
|
|
92109
92260
|
}
|
|
92110
92261
|
async function readCodexConfigSummary(configPath) {
|
|
92111
92262
|
if (!existsSync56(configPath)) {
|
|
92112
92263
|
return { exists: false, marketplaceConfigured: false, pluginEnabled: false, pluginsFeatureEnabled: false, pluginHooksFeatureEnabled: false };
|
|
92113
92264
|
}
|
|
92114
|
-
const content = await
|
|
92265
|
+
const content = await readFile20(configPath, "utf8");
|
|
92115
92266
|
return {
|
|
92116
92267
|
exists: true,
|
|
92117
92268
|
marketplaceConfigured: content.includes("[marketplaces.sisyphuslabs]"),
|
|
@@ -92123,13 +92274,13 @@ async function readCodexConfigSummary(configPath) {
|
|
|
92123
92274
|
async function readLinkedBins(binDir) {
|
|
92124
92275
|
const linked = [];
|
|
92125
92276
|
for (const name of CODEX_BIN_NAMES) {
|
|
92126
|
-
if (await pathExists2(
|
|
92277
|
+
if (await pathExists2(join75(binDir, process.platform === "win32" ? `${name}.cmd` : name)))
|
|
92127
92278
|
linked.push(name);
|
|
92128
92279
|
}
|
|
92129
92280
|
return linked;
|
|
92130
92281
|
}
|
|
92131
92282
|
async function readLinkedAgents(codexHome) {
|
|
92132
|
-
const agentsDir =
|
|
92283
|
+
const agentsDir = join75(codexHome, "agents");
|
|
92133
92284
|
if (!existsSync56(agentsDir))
|
|
92134
92285
|
return [];
|
|
92135
92286
|
const entries = await readdir8(agentsDir, { withFileTypes: true });
|
|
@@ -92137,7 +92288,7 @@ async function readLinkedAgents(codexHome) {
|
|
|
92137
92288
|
}
|
|
92138
92289
|
async function readJson(path16) {
|
|
92139
92290
|
try {
|
|
92140
|
-
const parsed = JSON.parse(await
|
|
92291
|
+
const parsed = JSON.parse(await readFile20(path16, "utf8"));
|
|
92141
92292
|
return isPlainRecord(parsed) ? parsed : null;
|
|
92142
92293
|
} catch (error51) {
|
|
92143
92294
|
if (error51 instanceof Error)
|
|
@@ -92187,9 +92338,9 @@ async function pathExists2(path16) {
|
|
|
92187
92338
|
|
|
92188
92339
|
// packages/omo-opencode/src/cli/doctor/checks/codex-components.ts
|
|
92189
92340
|
init_src();
|
|
92190
|
-
import { readdir as readdir9, readFile as
|
|
92341
|
+
import { readdir as readdir9, readFile as readFile21, stat as stat4 } from "fs/promises";
|
|
92191
92342
|
import { homedir as homedir22 } from "os";
|
|
92192
|
-
import { dirname as dirname27, join as
|
|
92343
|
+
import { dirname as dirname27, join as join76, relative as relative9, resolve as resolve20, sep as sep9 } from "path";
|
|
92193
92344
|
var CODEX_COMPONENTS_CHECK_ID = "codex-components";
|
|
92194
92345
|
var CODEX_COMPONENTS_CHECK_NAME = "codex-components";
|
|
92195
92346
|
var PLUGIN_DATA_DIR_NAME = "omo-sisyphuslabs";
|
|
@@ -92199,7 +92350,7 @@ async function checkCodexComponents(deps = {}) {
|
|
|
92199
92350
|
const env3 = deps.env ?? process.env;
|
|
92200
92351
|
const platform = deps.platform ?? process.platform;
|
|
92201
92352
|
const arch = deps.arch ?? process.arch;
|
|
92202
|
-
const codexHome = resolve20(deps.codexHome ?? env3["CODEX_HOME"] ??
|
|
92353
|
+
const codexHome = resolve20(deps.codexHome ?? env3["CODEX_HOME"] ?? join76(homedir22(), ".codex"));
|
|
92203
92354
|
const summary = await gatherCodexSummary({ ...deps, codexHome });
|
|
92204
92355
|
if (summary.pluginRoot === null) {
|
|
92205
92356
|
return {
|
|
@@ -92224,7 +92375,7 @@ async function checkCodexComponents(deps = {}) {
|
|
|
92224
92375
|
});
|
|
92225
92376
|
}
|
|
92226
92377
|
const runtimeSgDir = runtimeSgDirectory(codexHome, platform, arch);
|
|
92227
|
-
const runtimeSgPath =
|
|
92378
|
+
const runtimeSgPath = join76(runtimeSgDir, sgBinaryName(platform));
|
|
92228
92379
|
const sg = findSgBinarySync({
|
|
92229
92380
|
arch,
|
|
92230
92381
|
env: env3,
|
|
@@ -92308,7 +92459,7 @@ function recordBrokenTarget(broken, classified, origin) {
|
|
|
92308
92459
|
async function classifyBundleTarget(bundleRoot, baseRoot, relativePath, allowEscape) {
|
|
92309
92460
|
const targetPath = resolve20(baseRoot, relativePath);
|
|
92310
92461
|
const bundleRootPath = resolve20(bundleRoot);
|
|
92311
|
-
const bundleRootPrefix = bundleRootPath.endsWith(
|
|
92462
|
+
const bundleRootPrefix = bundleRootPath.endsWith(sep9) ? bundleRootPath : `${bundleRootPath}${sep9}`;
|
|
92312
92463
|
if (targetPath !== bundleRootPath && !targetPath.startsWith(bundleRootPrefix)) {
|
|
92313
92464
|
if (allowEscape)
|
|
92314
92465
|
return null;
|
|
@@ -92323,7 +92474,7 @@ async function classifyBundleTarget(bundleRoot, baseRoot, relativePath, allowEsc
|
|
|
92323
92474
|
}
|
|
92324
92475
|
async function findHookManifestPaths(root) {
|
|
92325
92476
|
const paths2 = await findManifestPaths(root, "hooks.json");
|
|
92326
|
-
return paths2.filter((path16) => dirname27(path16).endsWith(`${
|
|
92477
|
+
return paths2.filter((path16) => dirname27(path16).endsWith(`${sep9}hooks`));
|
|
92327
92478
|
}
|
|
92328
92479
|
async function findManifestPaths(root, manifestName) {
|
|
92329
92480
|
let entries;
|
|
@@ -92336,7 +92487,7 @@ async function findManifestPaths(root, manifestName) {
|
|
|
92336
92487
|
for (const entry of entries) {
|
|
92337
92488
|
if (entry.name === "node_modules" || entry.name === ".git")
|
|
92338
92489
|
continue;
|
|
92339
|
-
const entryPath =
|
|
92490
|
+
const entryPath = join76(root, entry.name);
|
|
92340
92491
|
if (entry.isDirectory()) {
|
|
92341
92492
|
paths2.push(...await findManifestPaths(entryPath, manifestName));
|
|
92342
92493
|
continue;
|
|
@@ -92379,18 +92530,18 @@ function isPluginRuntimePathArg(arg) {
|
|
|
92379
92530
|
return (arg.startsWith("./") || arg.startsWith("../")) && arg.endsWith("/dist/cli.js");
|
|
92380
92531
|
}
|
|
92381
92532
|
function runtimeSgDirectory(codexHome, platform, arch) {
|
|
92382
|
-
return
|
|
92533
|
+
return join76(codexHome, "runtime", "ast-grep", runtimeSlug(platform, arch));
|
|
92383
92534
|
}
|
|
92384
92535
|
function describeSgSource(sgPath, env3, runtimeSgDir, platform) {
|
|
92385
92536
|
const override = env3[SG_PATH_ENV_KEY]?.trim();
|
|
92386
92537
|
if (override !== undefined && override.length > 0 && sgPath === override)
|
|
92387
92538
|
return `env override ${SG_PATH_ENV_KEY}`;
|
|
92388
|
-
if (sgPath ===
|
|
92539
|
+
if (sgPath === join76(runtimeSgDir, sgBinaryName(platform)))
|
|
92389
92540
|
return "runtime dir";
|
|
92390
92541
|
return "PATH";
|
|
92391
92542
|
}
|
|
92392
92543
|
async function readBootstrapStateSummary(codexHome) {
|
|
92393
|
-
const statePath =
|
|
92544
|
+
const statePath = join76(codexHome, "plugins", "data", PLUGIN_DATA_DIR_NAME, "bootstrap", "state.json");
|
|
92394
92545
|
const raw = await readJson2(statePath);
|
|
92395
92546
|
if (raw === null)
|
|
92396
92547
|
return null;
|
|
@@ -92439,7 +92590,7 @@ function degradedDetailLines(entries) {
|
|
|
92439
92590
|
}
|
|
92440
92591
|
async function readJson2(path16) {
|
|
92441
92592
|
try {
|
|
92442
|
-
const parsed = JSON.parse(await
|
|
92593
|
+
const parsed = JSON.parse(await readFile21(path16, "utf8"));
|
|
92443
92594
|
return isRecord5(parsed) ? parsed : null;
|
|
92444
92595
|
} catch (error51) {
|
|
92445
92596
|
if (error51 instanceof Error)
|
|
@@ -92467,17 +92618,17 @@ function isRecord5(value) {
|
|
|
92467
92618
|
|
|
92468
92619
|
// packages/omo-opencode/src/cli/doctor/checks/codex-runtime-wrapper.ts
|
|
92469
92620
|
import { existsSync as existsSync57 } from "fs";
|
|
92470
|
-
import { readFile as
|
|
92621
|
+
import { readFile as readFile22 } from "fs/promises";
|
|
92471
92622
|
import { homedir as homedir23 } from "os";
|
|
92472
|
-
import { join as
|
|
92623
|
+
import { join as join77, resolve as resolve21 } from "path";
|
|
92473
92624
|
var RUNTIME_WRAPPER_MARKER2 = "OMO_GENERATED_RUNTIME_WRAPPER";
|
|
92474
92625
|
var CHECK_NAME = "codex-runtime-wrapper";
|
|
92475
92626
|
var REINSTALL_COMMAND = "npx --yes lazycodex-ai@latest install --no-tui";
|
|
92476
92627
|
async function checkCodexRuntimeWrapper(deps = {}) {
|
|
92477
|
-
const codexHome = resolve21(deps.codexHome ?? process.env.CODEX_HOME ??
|
|
92628
|
+
const codexHome = resolve21(deps.codexHome ?? process.env.CODEX_HOME ?? join77(homedir23(), ".codex"));
|
|
92478
92629
|
const binDir = resolveCodexInstallerBinDir({ binDir: deps.binDir, codexHome, env: process.env });
|
|
92479
92630
|
const platform = deps.platform ?? process.platform;
|
|
92480
|
-
const wrapperPath =
|
|
92631
|
+
const wrapperPath = join77(binDir, platform === "win32" ? "omo.cmd" : "omo");
|
|
92481
92632
|
const wrapper = await readRuntimeWrapper(wrapperPath);
|
|
92482
92633
|
const issues = [];
|
|
92483
92634
|
if (wrapper?.includes(RUNTIME_WRAPPER_MARKER2) === true) {
|
|
@@ -92502,7 +92653,7 @@ async function checkCodexRuntimeWrapper(deps = {}) {
|
|
|
92502
92653
|
}
|
|
92503
92654
|
async function readRuntimeWrapper(path16) {
|
|
92504
92655
|
try {
|
|
92505
|
-
return await
|
|
92656
|
+
return await readFile22(path16, "utf8");
|
|
92506
92657
|
} catch (error51) {
|
|
92507
92658
|
if (error51 instanceof Error)
|
|
92508
92659
|
return null;
|
|
@@ -92982,12 +93133,12 @@ import {
|
|
|
92982
93133
|
unlinkSync as unlinkSync8,
|
|
92983
93134
|
writeFileSync as writeFileSync11
|
|
92984
93135
|
} from "fs";
|
|
92985
|
-
import { basename as basename13, dirname as dirname28, join as
|
|
93136
|
+
import { basename as basename13, dirname as dirname28, join as join80 } from "path";
|
|
92986
93137
|
|
|
92987
93138
|
// packages/mcp-client-core/src/config-dir.ts
|
|
92988
93139
|
import { existsSync as existsSync58, realpathSync as realpathSync8 } from "fs";
|
|
92989
93140
|
import { homedir as homedir24 } from "os";
|
|
92990
|
-
import { join as
|
|
93141
|
+
import { join as join78, resolve as resolve22 } from "path";
|
|
92991
93142
|
function resolveConfigPath2(pathValue) {
|
|
92992
93143
|
const resolvedPath = resolve22(pathValue);
|
|
92993
93144
|
if (!existsSync58(resolvedPath))
|
|
@@ -93005,13 +93156,13 @@ function getOpenCodeCliConfigDir(env3 = process.env) {
|
|
|
93005
93156
|
if (customConfigDir) {
|
|
93006
93157
|
return resolveConfigPath2(customConfigDir);
|
|
93007
93158
|
}
|
|
93008
|
-
const xdgConfigDir = env3["XDG_CONFIG_HOME"]?.trim() ||
|
|
93009
|
-
return resolveConfigPath2(
|
|
93159
|
+
const xdgConfigDir = env3["XDG_CONFIG_HOME"]?.trim() || join78(homedir24(), ".config");
|
|
93160
|
+
return resolveConfigPath2(join78(xdgConfigDir, "opencode"));
|
|
93010
93161
|
}
|
|
93011
93162
|
|
|
93012
93163
|
// packages/mcp-client-core/src/mcp-oauth/storage-index.ts
|
|
93013
93164
|
import { chmodSync as chmodSync3, existsSync as existsSync59, readFileSync as readFileSync40, renameSync as renameSync6, writeFileSync as writeFileSync10 } from "fs";
|
|
93014
|
-
import { join as
|
|
93165
|
+
import { join as join79 } from "path";
|
|
93015
93166
|
var INDEX_FILE_NAME = "index.json";
|
|
93016
93167
|
function isTokenIndex(value) {
|
|
93017
93168
|
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
@@ -93019,7 +93170,7 @@ function isTokenIndex(value) {
|
|
|
93019
93170
|
return Object.values(value).every((entry) => typeof entry === "string");
|
|
93020
93171
|
}
|
|
93021
93172
|
function getIndexPath(storageDir) {
|
|
93022
|
-
return
|
|
93173
|
+
return join79(storageDir, INDEX_FILE_NAME);
|
|
93023
93174
|
}
|
|
93024
93175
|
function readTokenIndex(storageDir) {
|
|
93025
93176
|
const indexPath = getIndexPath(storageDir);
|
|
@@ -93063,16 +93214,16 @@ function deleteTokenIndexEntry(storageDir, hash2) {
|
|
|
93063
93214
|
var STORAGE_DIR_NAME = "mcp-oauth";
|
|
93064
93215
|
var LEGACY_STORAGE_FILE_NAME = "mcp-oauth.json";
|
|
93065
93216
|
function getMcpOauthStorageDir() {
|
|
93066
|
-
return
|
|
93217
|
+
return join80(getOpenCodeCliConfigDir(), STORAGE_DIR_NAME);
|
|
93067
93218
|
}
|
|
93068
93219
|
function getMcpOauthServerHash(serverHost, resource) {
|
|
93069
93220
|
return createHash4("sha256").update(buildKey(serverHost, resource)).digest("hex").slice(0, 32);
|
|
93070
93221
|
}
|
|
93071
93222
|
function getMcpOauthStoragePath(serverHost, resource) {
|
|
93072
|
-
return
|
|
93223
|
+
return join80(getMcpOauthStorageDir(), `${getMcpOauthServerHash(serverHost, resource)}.json`);
|
|
93073
93224
|
}
|
|
93074
93225
|
function getLegacyStoragePath() {
|
|
93075
|
-
return
|
|
93226
|
+
return join80(getOpenCodeCliConfigDir(), LEGACY_STORAGE_FILE_NAME);
|
|
93076
93227
|
}
|
|
93077
93228
|
function normalizeHost2(serverHost) {
|
|
93078
93229
|
let host = serverHost.trim();
|
|
@@ -93251,7 +93402,7 @@ function listTokensByHost(serverHost) {
|
|
|
93251
93402
|
for (const [hash2, indexedKey] of Object.entries(index)) {
|
|
93252
93403
|
if (!indexedKey.startsWith(prefix))
|
|
93253
93404
|
continue;
|
|
93254
|
-
const indexedToken = readTokenFile(
|
|
93405
|
+
const indexedToken = readTokenFile(join80(getMcpOauthStorageDir(), `${hash2}.json`));
|
|
93255
93406
|
if (indexedToken)
|
|
93256
93407
|
result[indexedKey] = indexedToken;
|
|
93257
93408
|
}
|
|
@@ -93266,7 +93417,7 @@ function listAllTokens() {
|
|
|
93266
93417
|
for (const entry of readdirSync9(dir, { withFileTypes: true })) {
|
|
93267
93418
|
if (!entry.isFile() || !entry.name.endsWith(".json") || entry.name === "index.json")
|
|
93268
93419
|
continue;
|
|
93269
|
-
const token = readTokenFile(
|
|
93420
|
+
const token = readTokenFile(join80(dir, entry.name));
|
|
93270
93421
|
const hash2 = basename13(entry.name, ".json");
|
|
93271
93422
|
if (token)
|
|
93272
93423
|
result[index[hash2] ?? hash2] = token;
|
|
@@ -94087,7 +94238,7 @@ import { isAbsolute as isAbsolute10, resolve as resolve23 } from "path";
|
|
|
94087
94238
|
init_src();
|
|
94088
94239
|
import { existsSync as existsSync63 } from "fs";
|
|
94089
94240
|
import { homedir as homedir26 } from "os";
|
|
94090
|
-
import { join as
|
|
94241
|
+
import { join as join81 } from "path";
|
|
94091
94242
|
|
|
94092
94243
|
// packages/omo-opencode/src/cli/sparkshell-appserver-websocket.ts
|
|
94093
94244
|
import { randomBytes as randomBytes3 } from "crypto";
|
|
@@ -94248,8 +94399,8 @@ function resolveAppServerSocketPath(env3) {
|
|
|
94248
94399
|
if (explicit) {
|
|
94249
94400
|
return explicit;
|
|
94250
94401
|
}
|
|
94251
|
-
const codexHome = env3["CODEX_HOME"]?.trim() ||
|
|
94252
|
-
return
|
|
94402
|
+
const codexHome = env3["CODEX_HOME"]?.trim() || join81(homedir26(), ".codex");
|
|
94403
|
+
return join81(codexHome, "app-server-control", "app-server-control.sock");
|
|
94253
94404
|
}
|
|
94254
94405
|
function resolveAppServerTimeoutMs(env3) {
|
|
94255
94406
|
const parsed = Number.parseInt(env3["OMO_SPARKSHELL_APP_SERVER_TIMEOUT_MS"]?.trim() ?? "", 10);
|
|
@@ -94821,7 +94972,7 @@ function isLowSurrogate(codeUnit) {
|
|
|
94821
94972
|
init_src();
|
|
94822
94973
|
import { existsSync as existsSync64, readdirSync as readdirSync10, readFileSync as readFileSync42 } from "fs";
|
|
94823
94974
|
import { homedir as homedir27 } from "os";
|
|
94824
|
-
import { join as
|
|
94975
|
+
import { join as join82 } from "path";
|
|
94825
94976
|
var SPARKSHELL_SESSION_CONTEXT_ENV = "OMO_SPARKSHELL_SESSION_CONTEXT";
|
|
94826
94977
|
var SPARKSHELL_SESSION_ID_ENV = "OMO_SPARKSHELL_SESSION_ID";
|
|
94827
94978
|
var CODEX_THREAD_ID_ENV = "CODEX_THREAD_ID";
|
|
@@ -94837,8 +94988,8 @@ function findRolloutPath(sessionId, env3, deps = {}) {
|
|
|
94837
94988
|
const fileExists = deps.fileExists ?? existsSync64;
|
|
94838
94989
|
const listDirectory = deps.listDirectory ?? ((path16) => readdirSync10(path16));
|
|
94839
94990
|
const homeDirectory = deps.homeDirectory ?? homedir27;
|
|
94840
|
-
const codexHome = env3["CODEX_HOME"]?.trim() ||
|
|
94841
|
-
const roots = [
|
|
94991
|
+
const codexHome = env3["CODEX_HOME"]?.trim() || join82(homeDirectory(), ".codex");
|
|
94992
|
+
const roots = [join82(codexHome, "sessions"), join82(codexHome, "archived_sessions")];
|
|
94842
94993
|
const fileSuffix = `-${sessionId}.jsonl`;
|
|
94843
94994
|
const scanDay = (dayDir) => {
|
|
94844
94995
|
if (!fileExists(dayDir)) {
|
|
@@ -94846,14 +94997,14 @@ function findRolloutPath(sessionId, env3, deps = {}) {
|
|
|
94846
94997
|
}
|
|
94847
94998
|
for (const name of listSafely(listDirectory, dayDir)) {
|
|
94848
94999
|
if (name.startsWith("rollout-") && name.endsWith(fileSuffix)) {
|
|
94849
|
-
return
|
|
95000
|
+
return join82(dayDir, name);
|
|
94850
95001
|
}
|
|
94851
95002
|
}
|
|
94852
95003
|
return null;
|
|
94853
95004
|
};
|
|
94854
95005
|
for (const dayDir of uuidV7DayDirCandidates(sessionId)) {
|
|
94855
95006
|
for (const root of roots) {
|
|
94856
|
-
const found = scanDay(
|
|
95007
|
+
const found = scanDay(join82(root, dayDir));
|
|
94857
95008
|
if (found) {
|
|
94858
95009
|
return found;
|
|
94859
95010
|
}
|
|
@@ -94864,9 +95015,9 @@ function findRolloutPath(sessionId, env3, deps = {}) {
|
|
|
94864
95015
|
continue;
|
|
94865
95016
|
}
|
|
94866
95017
|
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(
|
|
95018
|
+
for (const month of numericNamesDescending(listSafely(listDirectory, join82(root, year)))) {
|
|
95019
|
+
for (const day of numericNamesDescending(listSafely(listDirectory, join82(root, year, month)))) {
|
|
95020
|
+
const found = scanDay(join82(root, year, month, day));
|
|
94870
95021
|
if (found) {
|
|
94871
95022
|
return found;
|
|
94872
95023
|
}
|
|
@@ -95026,7 +95177,7 @@ function uuidV7DayDirCandidates(sessionId) {
|
|
|
95026
95177
|
const candidates = [];
|
|
95027
95178
|
for (const offsetDays of [0, 1, -1]) {
|
|
95028
95179
|
const date5 = new Date(ms + offsetDays * DAY_MS);
|
|
95029
|
-
candidates.push(
|
|
95180
|
+
candidates.push(join82(String(date5.getFullYear()), pad2(date5.getMonth() + 1), pad2(date5.getDate())));
|
|
95030
95181
|
}
|
|
95031
95182
|
return candidates;
|
|
95032
95183
|
}
|
|
@@ -95067,7 +95218,7 @@ function isFalsy2(value) {
|
|
|
95067
95218
|
import { spawnSync as spawnSync3 } from "child_process";
|
|
95068
95219
|
import { mkdtempSync, readFileSync as readFileSync43, rmSync as rmSync4 } from "fs";
|
|
95069
95220
|
import { tmpdir as tmpdir4 } from "os";
|
|
95070
|
-
import { join as
|
|
95221
|
+
import { join as join83 } from "path";
|
|
95071
95222
|
var SPARKSHELL_SPARK_ENV = "OMO_SPARKSHELL_SPARK";
|
|
95072
95223
|
var SPARKSHELL_SPARK_MODEL_ENV = "OMO_SPARKSHELL_SPARK_MODEL";
|
|
95073
95224
|
var SPARKSHELL_SPARK_TIMEOUT_ENV = "OMO_SPARKSHELL_SPARK_TIMEOUT_MS";
|
|
@@ -95141,8 +95292,8 @@ function buildSparkExecArgs(env3, lastMessagePath) {
|
|
|
95141
95292
|
function createDefaultSparkSummarizer(env3, cwd) {
|
|
95142
95293
|
return (request) => {
|
|
95143
95294
|
const binary = env3[SPARKSHELL_SPARK_BIN_ENV]?.trim() || "codex";
|
|
95144
|
-
const tempDir = mkdtempSync(
|
|
95145
|
-
const lastMessagePath =
|
|
95295
|
+
const tempDir = mkdtempSync(join83(tmpdir4(), "omo-sparkshell-spark-"));
|
|
95296
|
+
const lastMessagePath = join83(tempDir, "last-message.txt");
|
|
95146
95297
|
try {
|
|
95147
95298
|
const result = spawnSync3(binary, [...buildSparkExecArgs(env3, lastMessagePath)], {
|
|
95148
95299
|
cwd,
|