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-node/index.js
CHANGED
|
@@ -2146,7 +2146,7 @@ var package_default;
|
|
|
2146
2146
|
var init_package = __esm(() => {
|
|
2147
2147
|
package_default = {
|
|
2148
2148
|
name: "oh-my-opencode",
|
|
2149
|
-
version: "4.
|
|
2149
|
+
version: "4.12.1",
|
|
2150
2150
|
description: "The Best AI Agent Harness - Batteries-Included OpenCode Plugin with Multi-Model Orchestration, Parallel Background Agents, and Crafted LSP/AST Tools",
|
|
2151
2151
|
main: "./dist/index.js",
|
|
2152
2152
|
types: "dist/index.d.ts",
|
|
@@ -2316,18 +2316,18 @@ var init_package = __esm(() => {
|
|
|
2316
2316
|
typescript: "^6.0.3"
|
|
2317
2317
|
},
|
|
2318
2318
|
optionalDependencies: {
|
|
2319
|
-
"oh-my-opencode-darwin-arm64": "4.
|
|
2320
|
-
"oh-my-opencode-darwin-x64": "4.
|
|
2321
|
-
"oh-my-opencode-darwin-x64-baseline": "4.
|
|
2322
|
-
"oh-my-opencode-linux-arm64": "4.
|
|
2323
|
-
"oh-my-opencode-linux-arm64-musl": "4.
|
|
2324
|
-
"oh-my-opencode-linux-x64": "4.
|
|
2325
|
-
"oh-my-opencode-linux-x64-baseline": "4.
|
|
2326
|
-
"oh-my-opencode-linux-x64-musl": "4.
|
|
2327
|
-
"oh-my-opencode-linux-x64-musl-baseline": "4.
|
|
2328
|
-
"oh-my-opencode-windows-arm64": "4.
|
|
2329
|
-
"oh-my-opencode-windows-x64": "4.
|
|
2330
|
-
"oh-my-opencode-windows-x64-baseline": "4.
|
|
2319
|
+
"oh-my-opencode-darwin-arm64": "4.12.1",
|
|
2320
|
+
"oh-my-opencode-darwin-x64": "4.12.1",
|
|
2321
|
+
"oh-my-opencode-darwin-x64-baseline": "4.12.1",
|
|
2322
|
+
"oh-my-opencode-linux-arm64": "4.12.1",
|
|
2323
|
+
"oh-my-opencode-linux-arm64-musl": "4.12.1",
|
|
2324
|
+
"oh-my-opencode-linux-x64": "4.12.1",
|
|
2325
|
+
"oh-my-opencode-linux-x64-baseline": "4.12.1",
|
|
2326
|
+
"oh-my-opencode-linux-x64-musl": "4.12.1",
|
|
2327
|
+
"oh-my-opencode-linux-x64-musl-baseline": "4.12.1",
|
|
2328
|
+
"oh-my-opencode-windows-arm64": "4.12.1",
|
|
2329
|
+
"oh-my-opencode-windows-x64": "4.12.1",
|
|
2330
|
+
"oh-my-opencode-windows-x64-baseline": "4.12.1"
|
|
2331
2331
|
},
|
|
2332
2332
|
overrides: {
|
|
2333
2333
|
hono: "^4.12.18",
|
|
@@ -7371,6 +7371,14 @@ var init_classify_path_environment = () => {};
|
|
|
7371
7371
|
|
|
7372
7372
|
// packages/utils/src/codegraph/env.ts
|
|
7373
7373
|
var init_env = () => {};
|
|
7374
|
+
|
|
7375
|
+
// packages/utils/src/codegraph/workspace.ts
|
|
7376
|
+
var init_workspace = () => {};
|
|
7377
|
+
|
|
7378
|
+
// packages/utils/src/codegraph/guidance.ts
|
|
7379
|
+
var init_guidance = __esm(() => {
|
|
7380
|
+
init_workspace();
|
|
7381
|
+
});
|
|
7374
7382
|
// packages/utils/src/codegraph/manifest.ts
|
|
7375
7383
|
var init_manifest = () => {};
|
|
7376
7384
|
|
|
@@ -7391,12 +7399,10 @@ var init_resolve2 = __esm(() => {
|
|
|
7391
7399
|
requireFromHere = createRequire2(import.meta.url);
|
|
7392
7400
|
});
|
|
7393
7401
|
|
|
7394
|
-
// packages/utils/src/codegraph/workspace.ts
|
|
7395
|
-
var init_workspace = () => {};
|
|
7396
|
-
|
|
7397
7402
|
// packages/utils/src/codegraph/index.ts
|
|
7398
7403
|
var init_codegraph = __esm(() => {
|
|
7399
7404
|
init_env();
|
|
7405
|
+
init_guidance();
|
|
7400
7406
|
init_provision();
|
|
7401
7407
|
init_resolve2();
|
|
7402
7408
|
init_workspace();
|
|
@@ -56796,7 +56802,7 @@ async function probe(registration) {
|
|
|
56796
56802
|
registration.available = false;
|
|
56797
56803
|
return false;
|
|
56798
56804
|
}
|
|
56799
|
-
const probeUrl = new URL("/
|
|
56805
|
+
const probeUrl = new URL("/global/health", registration.serverUrl);
|
|
56800
56806
|
const authHeader = getServerBasicAuthHeader();
|
|
56801
56807
|
const headers = authHeader ? { Authorization: authHeader } : {};
|
|
56802
56808
|
try {
|
|
@@ -56830,12 +56836,17 @@ async function probe(registration) {
|
|
|
56830
56836
|
return false;
|
|
56831
56837
|
}
|
|
56832
56838
|
}
|
|
56833
|
-
function
|
|
56834
|
-
|
|
56839
|
+
function getFreshProbeAvailability(registration) {
|
|
56840
|
+
const available = registration.available;
|
|
56841
|
+
if (available === undefined || Date.now() - registration.probeTimestamp >= PROBE_TTL_MS) {
|
|
56842
|
+
return;
|
|
56843
|
+
}
|
|
56844
|
+
return available;
|
|
56835
56845
|
}
|
|
56836
56846
|
async function resolveAvailability(registration) {
|
|
56837
|
-
|
|
56838
|
-
|
|
56847
|
+
const freshAvailability = getFreshProbeAvailability(registration);
|
|
56848
|
+
if (freshAvailability !== undefined) {
|
|
56849
|
+
return freshAvailability;
|
|
56839
56850
|
}
|
|
56840
56851
|
if (!registration.inFlightProbe) {
|
|
56841
56852
|
registration.inFlightProbe = probe(registration).finally(() => {
|
|
@@ -56870,10 +56881,11 @@ function tryResolveDispatchClientSync2(client3, sessionID) {
|
|
|
56870
56881
|
if (!registration.serverUrl) {
|
|
56871
56882
|
return { client: client3, route: "in-process", reason: "unavailable" };
|
|
56872
56883
|
}
|
|
56873
|
-
|
|
56884
|
+
const freshAvailability = getFreshProbeAvailability(registration);
|
|
56885
|
+
if (freshAvailability === undefined) {
|
|
56874
56886
|
return;
|
|
56875
56887
|
}
|
|
56876
|
-
if (!
|
|
56888
|
+
if (!freshAvailability) {
|
|
56877
56889
|
return { client: client3, route: "in-process", reason: "unavailable" };
|
|
56878
56890
|
}
|
|
56879
56891
|
const resolvedLiveClient = getOrBuildLiveClient(registration);
|
|
@@ -56888,6 +56900,9 @@ async function resolveDispatchClient2(client3, sessionID) {
|
|
|
56888
56900
|
return syncResult;
|
|
56889
56901
|
}
|
|
56890
56902
|
const registration = registrations.get(client3);
|
|
56903
|
+
if (!registration) {
|
|
56904
|
+
return { client: client3, route: "in-process", reason: "identity" };
|
|
56905
|
+
}
|
|
56891
56906
|
const isAvailable = await resolveAvailability(registration);
|
|
56892
56907
|
if (!isAvailable) {
|
|
56893
56908
|
return { client: client3, route: "in-process", reason: "unavailable" };
|
|
@@ -58938,20 +58953,20 @@ var init_config_manager = __esm(() => {
|
|
|
58938
58953
|
|
|
58939
58954
|
// packages/telemetry-core/src/activity-state.ts
|
|
58940
58955
|
import { existsSync as existsSync27, mkdirSync as mkdirSync8, readFileSync as readFileSync13 } from "node:fs";
|
|
58941
|
-
import { basename as basename9, join as
|
|
58956
|
+
import { basename as basename9, join as join48 } from "node:path";
|
|
58942
58957
|
function resolveTelemetryStateDir(product, options = {}) {
|
|
58943
58958
|
const dataDir = resolveXdgDataDir(product.cacheDirName, {
|
|
58944
58959
|
env: options.env,
|
|
58945
58960
|
osProvider: options.osProvider
|
|
58946
58961
|
});
|
|
58947
|
-
const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined :
|
|
58962
|
+
const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined : join48(options.env.XDG_DATA_HOME, product.cacheDirName);
|
|
58948
58963
|
if (dataDir === xdgStateDir || xdgStateDir === undefined && basename9(dataDir) === product.cacheDirName) {
|
|
58949
58964
|
return dataDir;
|
|
58950
58965
|
}
|
|
58951
|
-
return
|
|
58966
|
+
return join48(dataDir, product.cacheDirName);
|
|
58952
58967
|
}
|
|
58953
58968
|
function getTelemetryActivityStateFilePath(stateDir) {
|
|
58954
|
-
return
|
|
58969
|
+
return join48(stateDir, POSTHOG_ACTIVITY_STATE_FILE);
|
|
58955
58970
|
}
|
|
58956
58971
|
function getDailyActiveCaptureState(input) {
|
|
58957
58972
|
const state = readPostHogActivityState(input.stateDir, input.diagnostics);
|
|
@@ -59022,9 +59037,9 @@ var DEFAULT_POSTHOG_HOST = "https://us.i.posthog.com", DEFAULT_POSTHOG_API_KEY =
|
|
|
59022
59037
|
|
|
59023
59038
|
// packages/telemetry-core/src/diagnostics.ts
|
|
59024
59039
|
import { appendFileSync as appendFileSync2, existsSync as existsSync28, mkdirSync as mkdirSync9, readFileSync as readFileSync14 } from "node:fs";
|
|
59025
|
-
import { join as
|
|
59040
|
+
import { join as join49 } from "node:path";
|
|
59026
59041
|
function getTelemetryDiagnosticsFilePath(diagnosticsDir) {
|
|
59027
|
-
return
|
|
59042
|
+
return join49(diagnosticsDir, DIAGNOSTICS_FILE_NAME);
|
|
59028
59043
|
}
|
|
59029
59044
|
function writeTelemetryDiagnostic(input, options) {
|
|
59030
59045
|
const now = options.now ?? new Date;
|
|
@@ -59190,7 +59205,7 @@ function getTelemetryDistinctId(machineIdPrefix, osProvider = getDefaultTelemetr
|
|
|
59190
59205
|
var init_machine_id = () => {};
|
|
59191
59206
|
|
|
59192
59207
|
// node_modules/.bun/posthog-node@5.35.12/node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
|
|
59193
|
-
import { dirname as dirname15, posix as posix2, sep as
|
|
59208
|
+
import { dirname as dirname15, posix as posix2, sep as sep7 } from "path";
|
|
59194
59209
|
function createModulerModifier() {
|
|
59195
59210
|
const getModuleFromFileName = createGetModuleFromFilename();
|
|
59196
59211
|
return async (frames) => {
|
|
@@ -59199,7 +59214,7 @@ function createModulerModifier() {
|
|
|
59199
59214
|
return frames;
|
|
59200
59215
|
};
|
|
59201
59216
|
}
|
|
59202
|
-
function createGetModuleFromFilename(basePath = process.argv[1] ? dirname15(process.argv[1]) : process.cwd(), isWindows =
|
|
59217
|
+
function createGetModuleFromFilename(basePath = process.argv[1] ? dirname15(process.argv[1]) : process.cwd(), isWindows = sep7 === "\\") {
|
|
59203
59218
|
const normalizedBase = isWindows ? normalizeWindowsPath(basePath) : basePath;
|
|
59204
59219
|
return (filename) => {
|
|
59205
59220
|
if (!filename)
|
|
@@ -62220,9 +62235,9 @@ var init_context_lines_node = __esm(() => {
|
|
|
62220
62235
|
});
|
|
62221
62236
|
|
|
62222
62237
|
// node_modules/.bun/posthog-node@5.35.12/node_modules/posthog-node/dist/extensions/error-tracking/modifiers/relative-path.node.mjs
|
|
62223
|
-
import { isAbsolute as isAbsolute7, relative as relative5, sep as
|
|
62238
|
+
import { isAbsolute as isAbsolute7, relative as relative5, sep as sep8 } from "path";
|
|
62224
62239
|
function createRelativePathModifier(basePath = process.cwd()) {
|
|
62225
|
-
const isWindows =
|
|
62240
|
+
const isWindows = sep8 === "\\";
|
|
62226
62241
|
const toUnix = (p) => isWindows ? p.replace(/\\/g, "/") : p;
|
|
62227
62242
|
const normalizedBase = toUnix(basePath);
|
|
62228
62243
|
return async (frames) => {
|
|
@@ -64749,7 +64764,7 @@ var package_default2;
|
|
|
64749
64764
|
var init_package2 = __esm(() => {
|
|
64750
64765
|
package_default2 = {
|
|
64751
64766
|
name: "@oh-my-opencode/omo-codex",
|
|
64752
|
-
version: "4.
|
|
64767
|
+
version: "4.12.1",
|
|
64753
64768
|
type: "module",
|
|
64754
64769
|
private: true,
|
|
64755
64770
|
description: "Codex harness adapter for oh-my-openagent. Vendored Codex plugin namespace (omo) + TypeScript installer + telemetry.",
|
|
@@ -65719,7 +65734,7 @@ var init_update_toasts = __esm(() => {
|
|
|
65719
65734
|
|
|
65720
65735
|
// packages/omo-opencode/src/hooks/auto-update-checker/hook/background-update-check.ts
|
|
65721
65736
|
import { existsSync as existsSync47 } from "node:fs";
|
|
65722
|
-
import { dirname as dirname23, join as
|
|
65737
|
+
import { dirname as dirname23, join as join65 } from "node:path";
|
|
65723
65738
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
65724
65739
|
function defaultGetModuleHostingWorkspace() {
|
|
65725
65740
|
try {
|
|
@@ -65873,7 +65888,7 @@ var init_background_update_check = __esm(() => {
|
|
|
65873
65888
|
init_update_toasts();
|
|
65874
65889
|
defaultDeps4 = {
|
|
65875
65890
|
existsSync: existsSync47,
|
|
65876
|
-
join:
|
|
65891
|
+
join: join65,
|
|
65877
65892
|
runBunInstallWithDetails,
|
|
65878
65893
|
log: log2,
|
|
65879
65894
|
getOpenCodeCacheDir,
|
|
@@ -66475,7 +66490,7 @@ function getUnsupportedOpenCodeVersionMessage(openCodeVersion) {
|
|
|
66475
66490
|
}
|
|
66476
66491
|
|
|
66477
66492
|
// packages/omo-codex/src/install/install-codex.ts
|
|
66478
|
-
import { join as
|
|
66493
|
+
import { join as join50, resolve as resolve14 } from "node:path";
|
|
66479
66494
|
import { existsSync as existsSync29 } from "node:fs";
|
|
66480
66495
|
import { homedir as homedir6 } from "node:os";
|
|
66481
66496
|
|
|
@@ -66839,8 +66854,8 @@ async function existingNonSymlink(path7) {
|
|
|
66839
66854
|
}
|
|
66840
66855
|
}
|
|
66841
66856
|
// packages/omo-codex/src/install/codex-cache-install.ts
|
|
66842
|
-
import { cp as cp2, mkdir as mkdir3, readFile as
|
|
66843
|
-
import { basename as basename6, dirname as dirname11, join as
|
|
66857
|
+
import { cp as cp2, mkdir as mkdir3, readFile as readFile7, rename, rm as rm3 } from "node:fs/promises";
|
|
66858
|
+
import { basename as basename6, dirname as dirname11, join as join31, sep as sep5 } from "node:path";
|
|
66844
66859
|
|
|
66845
66860
|
// packages/omo-codex/src/install/codex-cache-bundled-mcps.ts
|
|
66846
66861
|
import { cp, mkdir as mkdir2, readFile as readFile3, stat as stat2 } from "node:fs/promises";
|
|
@@ -67178,13 +67193,83 @@ async function rewriteCachedManifestRoot(pluginRoot, fromRoot, toRoot) {
|
|
|
67178
67193
|
`);
|
|
67179
67194
|
}
|
|
67180
67195
|
|
|
67196
|
+
// packages/omo-codex/src/install/codex-hook-targets.ts
|
|
67197
|
+
import { readFile as readFile6 } from "node:fs/promises";
|
|
67198
|
+
import { join as join30, sep as sep4 } from "node:path";
|
|
67199
|
+
var PLUGIN_ROOT_TARGET_PATTERN = /\$\{PLUGIN_ROOT\}[\\/]+([^"']+)/g;
|
|
67200
|
+
async function findMissingHookCommandTargets(pluginRoot) {
|
|
67201
|
+
const commands = [];
|
|
67202
|
+
for (const manifestPath of await hookManifestPaths(pluginRoot)) {
|
|
67203
|
+
if (!await fileExistsStrict(manifestPath))
|
|
67204
|
+
continue;
|
|
67205
|
+
const parsed = JSON.parse(await readFile6(manifestPath, "utf8"));
|
|
67206
|
+
collectCommands(parsed, commands);
|
|
67207
|
+
}
|
|
67208
|
+
const missing = [];
|
|
67209
|
+
const seen = new Set;
|
|
67210
|
+
for (const command of commands) {
|
|
67211
|
+
for (const match of command.matchAll(PLUGIN_ROOT_TARGET_PATTERN)) {
|
|
67212
|
+
const targetSuffix = match[1];
|
|
67213
|
+
if (targetSuffix === undefined)
|
|
67214
|
+
continue;
|
|
67215
|
+
const target = join30(pluginRoot, ...targetSuffix.split(/[\\/]+/));
|
|
67216
|
+
if (seen.has(target))
|
|
67217
|
+
continue;
|
|
67218
|
+
seen.add(target);
|
|
67219
|
+
if (!await fileExistsStrict(target))
|
|
67220
|
+
missing.push(target);
|
|
67221
|
+
}
|
|
67222
|
+
}
|
|
67223
|
+
return missing;
|
|
67224
|
+
}
|
|
67225
|
+
async function hookManifestPaths(pluginRoot) {
|
|
67226
|
+
const pluginManifestPath = join30(pluginRoot, ".codex-plugin", "plugin.json");
|
|
67227
|
+
if (!await fileExistsStrict(pluginManifestPath))
|
|
67228
|
+
return [join30(pluginRoot, "hooks", "hooks.json")];
|
|
67229
|
+
const parsed = JSON.parse(await readFile6(pluginManifestPath, "utf8"));
|
|
67230
|
+
if (!isPlainRecord3(parsed))
|
|
67231
|
+
return [];
|
|
67232
|
+
if (typeof parsed.hooks === "string" && parsed.hooks.trim() !== "") {
|
|
67233
|
+
return [join30(pluginRoot, stripDotSlash(parsed.hooks))];
|
|
67234
|
+
}
|
|
67235
|
+
if (Array.isArray(parsed.hooks)) {
|
|
67236
|
+
return parsed.hooks.filter((hookPath) => typeof hookPath === "string" && hookPath.trim() !== "").map((hookPath) => join30(pluginRoot, stripDotSlash(hookPath)));
|
|
67237
|
+
}
|
|
67238
|
+
return [];
|
|
67239
|
+
}
|
|
67240
|
+
function stripDotSlash(path7) {
|
|
67241
|
+
return path7.startsWith("./") ? path7.slice(2) : path7;
|
|
67242
|
+
}
|
|
67243
|
+
async function assertHookCommandTargets(pluginRoot) {
|
|
67244
|
+
const missing = await findMissingHookCommandTargets(pluginRoot);
|
|
67245
|
+
if (missing.length === 0)
|
|
67246
|
+
return;
|
|
67247
|
+
const relativeMissing = missing.map((path7) => path7.split(`${pluginRoot}${sep4}`).join("").split(sep4).join("/"));
|
|
67248
|
+
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.");
|
|
67249
|
+
}
|
|
67250
|
+
function collectCommands(value, commands) {
|
|
67251
|
+
if (Array.isArray(value)) {
|
|
67252
|
+
for (const entry of value)
|
|
67253
|
+
collectCommands(entry, commands);
|
|
67254
|
+
return;
|
|
67255
|
+
}
|
|
67256
|
+
if (!isPlainRecord3(value))
|
|
67257
|
+
return;
|
|
67258
|
+
if (value["type"] === "command" && typeof value["command"] === "string")
|
|
67259
|
+
commands.push(value["command"]);
|
|
67260
|
+
if (value["type"] === "command" && typeof value["commandWindows"] === "string")
|
|
67261
|
+
commands.push(value["commandWindows"]);
|
|
67262
|
+
for (const entry of Object.values(value))
|
|
67263
|
+
collectCommands(entry, commands);
|
|
67264
|
+
}
|
|
67265
|
+
|
|
67181
67266
|
// packages/omo-codex/src/install/codex-cache-install.ts
|
|
67182
67267
|
async function installCachedPlugin(input) {
|
|
67183
67268
|
if (input.buildSource !== false) {
|
|
67184
67269
|
await maybeRunNpmInstall(input.sourcePath, input.runCommand);
|
|
67185
67270
|
await maybeRunNpmBuild(input.sourcePath, input.runCommand);
|
|
67186
67271
|
}
|
|
67187
|
-
const targetPath =
|
|
67272
|
+
const targetPath = join31(input.codexHome, "plugins", "cache", input.marketplaceName, input.name, input.version);
|
|
67188
67273
|
const tempPath = createTempSiblingPath(targetPath);
|
|
67189
67274
|
await rm3(tempPath, { recursive: true, force: true });
|
|
67190
67275
|
try {
|
|
@@ -67192,8 +67277,11 @@ async function installCachedPlugin(input) {
|
|
|
67192
67277
|
await rewriteCachedPackageLocalFileDependencies(tempPath, input.sourcePath);
|
|
67193
67278
|
await copyBundledMcpRuntimeDists({ pluginRoot: tempPath, sourceRoot: input.sourcePath });
|
|
67194
67279
|
await maybeRunNpmInstall(tempPath, input.runCommand, ["ci", "--omit=dev"]);
|
|
67280
|
+
if (input.buildSource === false)
|
|
67281
|
+
await maybeRunNpmSyncSkills(tempPath, input.runCommand);
|
|
67195
67282
|
await rewriteCachedMcpManifest(tempPath, input.sourcePath);
|
|
67196
67283
|
await rewriteCachedManifestRoot(tempPath, tempPath, targetPath);
|
|
67284
|
+
await assertHookCommandTargets(tempPath);
|
|
67197
67285
|
await promoteDirectory(tempPath, targetPath, input.renameDirectory ?? rename);
|
|
67198
67286
|
} catch (error) {
|
|
67199
67287
|
await rm3(tempPath, { recursive: true, force: true });
|
|
@@ -67202,14 +67290,14 @@ async function installCachedPlugin(input) {
|
|
|
67202
67290
|
return { name: input.name, version: input.version, path: targetPath };
|
|
67203
67291
|
}
|
|
67204
67292
|
async function maybeRunNpmInstall(cwd, runCommand, args = ["install"]) {
|
|
67205
|
-
if (!await fileExistsStrict(
|
|
67293
|
+
if (!await fileExistsStrict(join31(cwd, "package.json")))
|
|
67206
67294
|
return;
|
|
67207
67295
|
await runCommand("npm", args, { cwd });
|
|
67208
67296
|
}
|
|
67209
67297
|
async function maybeRunNpmBuild(cwd, runCommand) {
|
|
67210
|
-
if (!await fileExistsStrict(
|
|
67298
|
+
if (!await fileExistsStrict(join31(cwd, "package.json")))
|
|
67211
67299
|
return;
|
|
67212
|
-
const packageJson = JSON.parse(await
|
|
67300
|
+
const packageJson = JSON.parse(await readFile7(join31(cwd, "package.json"), "utf8"));
|
|
67213
67301
|
if (!isPlainRecord3(packageJson))
|
|
67214
67302
|
return;
|
|
67215
67303
|
const scripts = packageJson.scripts;
|
|
@@ -67217,11 +67305,22 @@ async function maybeRunNpmBuild(cwd, runCommand) {
|
|
|
67217
67305
|
return;
|
|
67218
67306
|
await runCommand("npm", ["run", "build"], { cwd });
|
|
67219
67307
|
}
|
|
67308
|
+
async function maybeRunNpmSyncSkills(cwd, runCommand) {
|
|
67309
|
+
if (!await fileExistsStrict(join31(cwd, "package.json")))
|
|
67310
|
+
return;
|
|
67311
|
+
const packageJson = JSON.parse(await readFile7(join31(cwd, "package.json"), "utf8"));
|
|
67312
|
+
if (!isPlainRecord3(packageJson))
|
|
67313
|
+
return;
|
|
67314
|
+
const scripts = packageJson.scripts;
|
|
67315
|
+
if (!isPlainRecord3(scripts) || typeof scripts["sync:skills"] !== "string")
|
|
67316
|
+
return;
|
|
67317
|
+
await runCommand("npm", ["run", "sync:skills"], { cwd });
|
|
67318
|
+
}
|
|
67220
67319
|
function createTempSiblingPath(targetPath) {
|
|
67221
|
-
return
|
|
67320
|
+
return join31(dirname11(targetPath), `.tmp-${basename6(targetPath)}-${process.pid}-${Date.now()}`);
|
|
67222
67321
|
}
|
|
67223
67322
|
function createBackupSiblingPath(targetPath) {
|
|
67224
|
-
return
|
|
67323
|
+
return join31(dirname11(targetPath), `.backup-${basename6(targetPath)}-${process.pid}-${Date.now()}`);
|
|
67225
67324
|
}
|
|
67226
67325
|
async function copyDirectory(sourcePath, targetPath) {
|
|
67227
67326
|
await mkdir3(dirname11(targetPath), { recursive: true });
|
|
@@ -67252,17 +67351,17 @@ async function restoreBackupDirectory(backupPath, targetPath, renameDirectory) {
|
|
|
67252
67351
|
await renameDirectory(backupPath, targetPath);
|
|
67253
67352
|
}
|
|
67254
67353
|
function shouldCopyPluginPath(path7, root) {
|
|
67255
|
-
const relative5 = path7 === root ? "" : path7.slice(root.length +
|
|
67354
|
+
const relative5 = path7 === root ? "" : path7.slice(root.length + sep5.length);
|
|
67256
67355
|
if (relative5 === "")
|
|
67257
67356
|
return true;
|
|
67258
|
-
const parts = relative5.split(
|
|
67357
|
+
const parts = relative5.split(sep5);
|
|
67259
67358
|
return !parts.some((part) => part === ".git" || part === "node_modules");
|
|
67260
67359
|
}
|
|
67261
67360
|
// packages/omo-codex/src/install/codex-cache-prune.ts
|
|
67262
67361
|
import { lstat as lstat4, readdir as readdir3, rm as rm4, stat as stat3 } from "node:fs/promises";
|
|
67263
|
-
import { join as
|
|
67362
|
+
import { join as join32 } from "node:path";
|
|
67264
67363
|
async function pruneMarketplaceCache(input) {
|
|
67265
|
-
const cacheRoot =
|
|
67364
|
+
const cacheRoot = join32(input.codexHome, "plugins", "cache", input.marketplaceName);
|
|
67266
67365
|
if (!await fileExistsStrict(cacheRoot))
|
|
67267
67366
|
return;
|
|
67268
67367
|
const keep = new Set(input.keepPluginNames);
|
|
@@ -67270,15 +67369,15 @@ async function pruneMarketplaceCache(input) {
|
|
|
67270
67369
|
for (const entry of entries) {
|
|
67271
67370
|
if (!entry.isDirectory() || keep.has(entry.name))
|
|
67272
67371
|
continue;
|
|
67273
|
-
await rm4(
|
|
67372
|
+
await rm4(join32(cacheRoot, entry.name), { recursive: true, force: true });
|
|
67274
67373
|
}
|
|
67275
67374
|
}
|
|
67276
67375
|
async function pruneMarketplacePluginCaches(input) {
|
|
67277
|
-
const cacheRoot =
|
|
67376
|
+
const cacheRoot = join32(input.codexHome, "plugins", "cache", input.marketplaceName);
|
|
67278
67377
|
if (!await fileExistsStrict(cacheRoot))
|
|
67279
67378
|
return;
|
|
67280
67379
|
for (const pluginName of input.pluginNames) {
|
|
67281
|
-
await rm4(
|
|
67380
|
+
await rm4(join32(cacheRoot, pluginName), { recursive: true, force: true });
|
|
67282
67381
|
}
|
|
67283
67382
|
const remainingEntries = await readCacheEntryNames(cacheRoot);
|
|
67284
67383
|
if (remainingEntries.length === 0) {
|
|
@@ -67325,11 +67424,11 @@ async function isBrokenCacheSymlink(path7) {
|
|
|
67325
67424
|
}
|
|
67326
67425
|
// packages/omo-codex/src/install/codex-cached-marketplace-manifest.ts
|
|
67327
67426
|
import { mkdir as mkdir4, writeFile as writeFile4 } from "node:fs/promises";
|
|
67328
|
-
import { join as
|
|
67427
|
+
import { join as join33 } from "node:path";
|
|
67329
67428
|
async function writeCachedMarketplaceManifest(input) {
|
|
67330
|
-
const marketplaceDir =
|
|
67429
|
+
const marketplaceDir = join33(input.marketplaceRoot, ".agents", "plugins");
|
|
67331
67430
|
await mkdir4(marketplaceDir, { recursive: true });
|
|
67332
|
-
await writeFile4(
|
|
67431
|
+
await writeFile4(join33(marketplaceDir, "marketplace.json"), `${JSON.stringify({
|
|
67333
67432
|
name: input.marketplaceName,
|
|
67334
67433
|
plugins: input.plugins.map((plugin) => ({
|
|
67335
67434
|
name: plugin.name,
|
|
@@ -67341,8 +67440,8 @@ async function writeCachedMarketplaceManifest(input) {
|
|
|
67341
67440
|
|
|
67342
67441
|
// packages/omo-codex/src/install/codex-package-layout.ts
|
|
67343
67442
|
import { existsSync as existsSync26 } from "node:fs";
|
|
67344
|
-
import { readFile as
|
|
67345
|
-
import { join as
|
|
67443
|
+
import { readFile as readFile8 } from "node:fs/promises";
|
|
67444
|
+
import { join as join34 } from "node:path";
|
|
67346
67445
|
var PACKAGED_CODEX_INSTALLER_NAMES = new Set([
|
|
67347
67446
|
"@code-yeongyu/lazycodex",
|
|
67348
67447
|
"@code-yeongyu/lazycodex-ai",
|
|
@@ -67352,19 +67451,19 @@ var PACKAGED_CODEX_INSTALLER_NAMES = new Set([
|
|
|
67352
67451
|
"oh-my-openagent"
|
|
67353
67452
|
]);
|
|
67354
67453
|
async function shouldBuildSourcePackages(repoRoot) {
|
|
67355
|
-
if (existsSync26(
|
|
67454
|
+
if (existsSync26(join34(repoRoot, "packages", "omo-opencode", "src", "index.ts")))
|
|
67356
67455
|
return true;
|
|
67357
|
-
const packageJsonPath =
|
|
67456
|
+
const packageJsonPath = join34(repoRoot, "package.json");
|
|
67358
67457
|
if (!existsSync26(packageJsonPath))
|
|
67359
67458
|
return true;
|
|
67360
|
-
const packageJson = JSON.parse(await
|
|
67459
|
+
const packageJson = JSON.parse(await readFile8(packageJsonPath, "utf8"));
|
|
67361
67460
|
if (!isPlainRecord3(packageJson) || typeof packageJson.name !== "string")
|
|
67362
67461
|
return true;
|
|
67363
67462
|
return !PACKAGED_CODEX_INSTALLER_NAMES.has(packageJson.name);
|
|
67364
67463
|
}
|
|
67365
67464
|
|
|
67366
67465
|
// packages/omo-codex/src/install/codex-config-toml.ts
|
|
67367
|
-
import { mkdir as mkdir5, readFile as
|
|
67466
|
+
import { mkdir as mkdir5, readFile as readFile10 } from "node:fs/promises";
|
|
67368
67467
|
import { dirname as dirname13 } from "node:path";
|
|
67369
67468
|
|
|
67370
67469
|
// packages/omo-codex/src/install/toml-section-editor.ts
|
|
@@ -67552,12 +67651,12 @@ function tomlKeySegment(value) {
|
|
|
67552
67651
|
|
|
67553
67652
|
// packages/omo-codex/src/install/codex-config-atomic-write.ts
|
|
67554
67653
|
import { lstat as lstat5, readlink as readlink3, realpath, rename as rename2, unlink, writeFile as writeFile5 } from "node:fs/promises";
|
|
67555
|
-
import { basename as basename7, dirname as dirname12, isAbsolute as isAbsolute6, join as
|
|
67654
|
+
import { basename as basename7, dirname as dirname12, isAbsolute as isAbsolute6, join as join35, resolve as resolve11 } from "node:path";
|
|
67556
67655
|
var RENAME_RETRY_DELAYS_MS = [10, 25, 50];
|
|
67557
67656
|
var RETRIABLE_RENAME_CODES = new Set(["EPERM", "EBUSY"]);
|
|
67558
67657
|
async function writeFileAtomic(targetPath, data) {
|
|
67559
67658
|
const writeTarget = await resolveSymlinkTarget(targetPath);
|
|
67560
|
-
const temporaryPath =
|
|
67659
|
+
const temporaryPath = join35(dirname12(writeTarget), `.tmp-${basename7(writeTarget)}-${process.pid}-${Date.now()}`);
|
|
67561
67660
|
await writeFile5(temporaryPath, data);
|
|
67562
67661
|
try {
|
|
67563
67662
|
await renameWithRetry(temporaryPath, writeTarget);
|
|
@@ -67827,8 +67926,8 @@ function isRootSetting(line, key) {
|
|
|
67827
67926
|
}
|
|
67828
67927
|
|
|
67829
67928
|
// packages/omo-codex/src/install/codex-model-catalog.ts
|
|
67830
|
-
import { readFile as
|
|
67831
|
-
import { join as
|
|
67929
|
+
import { readFile as readFile9 } from "node:fs/promises";
|
|
67930
|
+
import { join as join36 } from "node:path";
|
|
67832
67931
|
var FALLBACK_CODEX_MODEL_CATALOG = {
|
|
67833
67932
|
current: {
|
|
67834
67933
|
model: "gpt-5.5",
|
|
@@ -67847,9 +67946,9 @@ var FALLBACK_CODEX_MODEL_CATALOG = {
|
|
|
67847
67946
|
]
|
|
67848
67947
|
};
|
|
67849
67948
|
async function readCodexModelCatalog(codexPackageRoot) {
|
|
67850
|
-
const catalogPath =
|
|
67949
|
+
const catalogPath = join36(codexPackageRoot, "plugin", "model-catalog.json");
|
|
67851
67950
|
try {
|
|
67852
|
-
const parsed = JSON.parse(await
|
|
67951
|
+
const parsed = JSON.parse(await readFile9(catalogPath, "utf8"));
|
|
67853
67952
|
return parseCodexModelCatalog(parsed) ?? FALLBACK_CODEX_MODEL_CATALOG;
|
|
67854
67953
|
} catch (error) {
|
|
67855
67954
|
if (error instanceof Error)
|
|
@@ -67930,7 +68029,7 @@ async function updateCodexConfig(input) {
|
|
|
67930
68029
|
await mkdir5(dirname13(input.configPath), { recursive: true });
|
|
67931
68030
|
let config = "";
|
|
67932
68031
|
if (await exists(input.configPath))
|
|
67933
|
-
config = await
|
|
68032
|
+
config = await readFile10(input.configPath, "utf8");
|
|
67934
68033
|
const pluginSet = new Set(input.pluginNames);
|
|
67935
68034
|
for (const legacyMarketplaceName of legacyMarketplaceNames(input.marketplaceName)) {
|
|
67936
68035
|
config = removeMarketplaceBlock(config, legacyMarketplaceName);
|
|
@@ -67966,7 +68065,7 @@ async function updateCodexConfig(input) {
|
|
|
67966
68065
|
}
|
|
67967
68066
|
async function exists(path7) {
|
|
67968
68067
|
try {
|
|
67969
|
-
await
|
|
68068
|
+
await readFile10(path7, "utf8");
|
|
67970
68069
|
return true;
|
|
67971
68070
|
} catch (error) {
|
|
67972
68071
|
if (error instanceof Error)
|
|
@@ -67977,8 +68076,8 @@ async function exists(path7) {
|
|
|
67977
68076
|
|
|
67978
68077
|
// packages/omo-codex/src/install/codex-hook-trust.ts
|
|
67979
68078
|
import { createHash as createHash2 } from "node:crypto";
|
|
67980
|
-
import { readFile as
|
|
67981
|
-
import { join as
|
|
68079
|
+
import { readFile as readFile11 } from "node:fs/promises";
|
|
68080
|
+
import { join as join37 } from "node:path";
|
|
67982
68081
|
var EVENT_LABELS = new Map([
|
|
67983
68082
|
["PreToolUse", "pre_tool_use"],
|
|
67984
68083
|
["PermissionRequest", "permission_request"],
|
|
@@ -67992,21 +68091,37 @@ var EVENT_LABELS = new Map([
|
|
|
67992
68091
|
["Stop", "stop"]
|
|
67993
68092
|
]);
|
|
67994
68093
|
async function trustedHookStatesForPlugin(input) {
|
|
67995
|
-
const manifestPath =
|
|
68094
|
+
const manifestPath = join37(input.pluginRoot, ".codex-plugin", "plugin.json");
|
|
67996
68095
|
if (!await exists2(manifestPath))
|
|
67997
68096
|
return [];
|
|
67998
|
-
const manifest = JSON.parse(await
|
|
67999
|
-
if (!isPlainRecord3(manifest)
|
|
68000
|
-
return [];
|
|
68001
|
-
const hooksPath = join36(input.pluginRoot, manifest.hooks);
|
|
68002
|
-
if (!await exists2(hooksPath))
|
|
68097
|
+
const manifest = JSON.parse(await readFile11(manifestPath, "utf8"));
|
|
68098
|
+
if (!isPlainRecord3(manifest))
|
|
68003
68099
|
return [];
|
|
68004
|
-
const
|
|
68005
|
-
|
|
68100
|
+
const states = [];
|
|
68101
|
+
for (const hookPath of hookManifestPaths2(manifest.hooks)) {
|
|
68102
|
+
const hooksPath = join37(input.pluginRoot, hookPath);
|
|
68103
|
+
if (!await exists2(hooksPath))
|
|
68104
|
+
continue;
|
|
68105
|
+
const parsed = JSON.parse(await readFile11(hooksPath, "utf8"));
|
|
68106
|
+
if (!isPlainRecord3(parsed) || !isPlainRecord3(parsed.hooks))
|
|
68107
|
+
continue;
|
|
68108
|
+
states.push(...trustedHookStatesForHooksFile({
|
|
68109
|
+
keySource: `${input.pluginName}@${input.marketplaceName}:${hookPath}`,
|
|
68110
|
+
hooks: parsed.hooks
|
|
68111
|
+
}));
|
|
68112
|
+
}
|
|
68113
|
+
return states;
|
|
68114
|
+
}
|
|
68115
|
+
function hookManifestPaths2(value) {
|
|
68116
|
+
if (typeof value === "string" && value.trim() !== "")
|
|
68117
|
+
return [stripDotSlash2(value)];
|
|
68118
|
+
if (!Array.isArray(value))
|
|
68006
68119
|
return [];
|
|
68007
|
-
|
|
68120
|
+
return value.filter((item) => typeof item === "string" && item.trim() !== "").map(stripDotSlash2);
|
|
68121
|
+
}
|
|
68122
|
+
function trustedHookStatesForHooksFile(input) {
|
|
68008
68123
|
const states = [];
|
|
68009
|
-
for (const [eventName, groups] of Object.entries(
|
|
68124
|
+
for (const [eventName, groups] of Object.entries(input.hooks)) {
|
|
68010
68125
|
if (!Array.isArray(groups))
|
|
68011
68126
|
continue;
|
|
68012
68127
|
const eventLabel = EVENT_LABELS.get(eventName);
|
|
@@ -68022,7 +68137,7 @@ async function trustedHookStatesForPlugin(input) {
|
|
|
68022
68137
|
continue;
|
|
68023
68138
|
if (typeof handler.command !== "string" || handler.command.trim() === "")
|
|
68024
68139
|
continue;
|
|
68025
|
-
const key = `${keySource}:${eventLabel}:${groupIndex}:${handlerIndex}`;
|
|
68140
|
+
const key = `${input.keySource}:${eventLabel}:${groupIndex}:${handlerIndex}`;
|
|
68026
68141
|
states.push({ key, trustedHash: commandHookHash(eventLabel, group.matcher, handler) });
|
|
68027
68142
|
}
|
|
68028
68143
|
}
|
|
@@ -68056,12 +68171,12 @@ function canonicalJson(value) {
|
|
|
68056
68171
|
}
|
|
68057
68172
|
return result;
|
|
68058
68173
|
}
|
|
68059
|
-
function
|
|
68174
|
+
function stripDotSlash2(value) {
|
|
68060
68175
|
return value.startsWith("./") ? value.slice(2) : value;
|
|
68061
68176
|
}
|
|
68062
68177
|
async function exists2(path7) {
|
|
68063
68178
|
try {
|
|
68064
|
-
await
|
|
68179
|
+
await readFile11(path7, "utf8");
|
|
68065
68180
|
return true;
|
|
68066
68181
|
} catch (error) {
|
|
68067
68182
|
if (error instanceof Error)
|
|
@@ -68113,12 +68228,12 @@ function toCodexResolution(resolution) {
|
|
|
68113
68228
|
}
|
|
68114
68229
|
|
|
68115
68230
|
// packages/omo-codex/src/install/link-cached-plugin-agents.ts
|
|
68116
|
-
import { copyFile, lstat as lstat7, mkdir as mkdir6, readFile as
|
|
68117
|
-
import { basename as basename8, join as
|
|
68231
|
+
import { copyFile, lstat as lstat7, mkdir as mkdir6, readFile as readFile13, readdir as readdir4, rm as rm6, writeFile as writeFile6 } from "node:fs/promises";
|
|
68232
|
+
import { basename as basename8, join as join39 } from "node:path";
|
|
68118
68233
|
|
|
68119
68234
|
// packages/omo-codex/src/install/retired-managed-agent-purge.ts
|
|
68120
|
-
import { lstat as lstat6, readFile as
|
|
68121
|
-
import { join as
|
|
68235
|
+
import { lstat as lstat6, readFile as readFile12, rm as rm5 } from "node:fs/promises";
|
|
68236
|
+
import { join as join38 } from "node:path";
|
|
68122
68237
|
var RETIRED_MANAGED_AGENT_FILES = [
|
|
68123
68238
|
{
|
|
68124
68239
|
fileName: "codex-ultrawork-reviewer.toml",
|
|
@@ -68130,11 +68245,11 @@ var RETIRED_MANAGED_AGENT_FILES = [
|
|
|
68130
68245
|
}
|
|
68131
68246
|
];
|
|
68132
68247
|
async function purgeRetiredManagedAgentFiles(input) {
|
|
68133
|
-
const agentsDir =
|
|
68248
|
+
const agentsDir = join38(input.codexHome, "agents");
|
|
68134
68249
|
if (!await exists3(agentsDir))
|
|
68135
68250
|
return;
|
|
68136
68251
|
for (const retiredAgent of RETIRED_MANAGED_AGENT_FILES) {
|
|
68137
|
-
const agentPath =
|
|
68252
|
+
const agentPath = join38(agentsDir, retiredAgent.fileName);
|
|
68138
68253
|
if (!await exists3(agentPath))
|
|
68139
68254
|
continue;
|
|
68140
68255
|
const agentStat = await lstat6(agentPath);
|
|
@@ -68151,7 +68266,7 @@ function hasRequiredMarkers(content, markers) {
|
|
|
68151
68266
|
}
|
|
68152
68267
|
async function readTextIfExists(path7) {
|
|
68153
68268
|
try {
|
|
68154
|
-
return await
|
|
68269
|
+
return await readFile12(path7, "utf8");
|
|
68155
68270
|
} catch (error) {
|
|
68156
68271
|
if (nodeErrorCode(error) === "ENOENT")
|
|
68157
68272
|
return null;
|
|
@@ -68177,7 +68292,7 @@ function nodeErrorCode(error) {
|
|
|
68177
68292
|
// packages/omo-codex/src/install/link-cached-plugin-agents.ts
|
|
68178
68293
|
var MANIFEST_FILE = ".installed-agents.json";
|
|
68179
68294
|
async function capturePreservedAgentReasoning(input) {
|
|
68180
|
-
const agentsDir =
|
|
68295
|
+
const agentsDir = join39(input.codexHome, "agents");
|
|
68181
68296
|
if (!await exists4(agentsDir))
|
|
68182
68297
|
return new Map;
|
|
68183
68298
|
const preserved = new Map;
|
|
@@ -68185,7 +68300,7 @@ async function capturePreservedAgentReasoning(input) {
|
|
|
68185
68300
|
for (const entry of agentEntries) {
|
|
68186
68301
|
if (!entry.name.endsWith(".toml"))
|
|
68187
68302
|
continue;
|
|
68188
|
-
const content = await readTextIfExists2(
|
|
68303
|
+
const content = await readTextIfExists2(join39(agentsDir, entry.name));
|
|
68189
68304
|
if (content === null)
|
|
68190
68305
|
continue;
|
|
68191
68306
|
const effort = extractReasoningEffort(content);
|
|
@@ -68195,7 +68310,7 @@ async function capturePreservedAgentReasoning(input) {
|
|
|
68195
68310
|
return preserved;
|
|
68196
68311
|
}
|
|
68197
68312
|
async function capturePreservedAgentServiceTier(input) {
|
|
68198
|
-
const agentsDir =
|
|
68313
|
+
const agentsDir = join39(input.codexHome, "agents");
|
|
68199
68314
|
if (!await exists4(agentsDir))
|
|
68200
68315
|
return new Map;
|
|
68201
68316
|
const preserved = new Map;
|
|
@@ -68203,7 +68318,7 @@ async function capturePreservedAgentServiceTier(input) {
|
|
|
68203
68318
|
for (const entry of agentEntries) {
|
|
68204
68319
|
if (!entry.name.endsWith(".toml"))
|
|
68205
68320
|
continue;
|
|
68206
|
-
const content = await readTextIfExists2(
|
|
68321
|
+
const content = await readTextIfExists2(join39(agentsDir, entry.name));
|
|
68207
68322
|
if (content === null)
|
|
68208
68323
|
continue;
|
|
68209
68324
|
preserved.set(agentNameFromToml(entry.name), extractServiceTier(content));
|
|
@@ -68217,13 +68332,13 @@ async function linkCachedPluginAgents(input) {
|
|
|
68217
68332
|
await writeManifest(input.pluginRoot, []);
|
|
68218
68333
|
return [];
|
|
68219
68334
|
}
|
|
68220
|
-
const agentsDir =
|
|
68335
|
+
const agentsDir = join39(input.codexHome, "agents");
|
|
68221
68336
|
await mkdir6(agentsDir, { recursive: true });
|
|
68222
68337
|
const linked = [];
|
|
68223
68338
|
for (const agentPath of bundledAgents) {
|
|
68224
68339
|
const agentFileName = basename8(agentPath);
|
|
68225
68340
|
const agentName = agentNameFromToml(agentFileName);
|
|
68226
|
-
const linkPath =
|
|
68341
|
+
const linkPath = join39(agentsDir, agentFileName);
|
|
68227
68342
|
await replaceWithCopy(linkPath, agentPath);
|
|
68228
68343
|
await restorePreservedReasoning({
|
|
68229
68344
|
agentName,
|
|
@@ -68244,7 +68359,7 @@ async function linkCachedPluginAgents(input) {
|
|
|
68244
68359
|
async function restorePreservedServiceTier(input) {
|
|
68245
68360
|
if (!input.preserved)
|
|
68246
68361
|
return;
|
|
68247
|
-
const content = await
|
|
68362
|
+
const content = await readFile13(input.linkPath, "utf8");
|
|
68248
68363
|
if (extractServiceTier(content) === input.value)
|
|
68249
68364
|
return;
|
|
68250
68365
|
const replacement = replaceServiceTier(content, input.value);
|
|
@@ -68253,7 +68368,7 @@ async function restorePreservedServiceTier(input) {
|
|
|
68253
68368
|
await writeFile6(input.linkPath, replacement.content);
|
|
68254
68369
|
}
|
|
68255
68370
|
async function discoverBundledAgents(pluginRoot) {
|
|
68256
|
-
const componentsRoot =
|
|
68371
|
+
const componentsRoot = join39(pluginRoot, "components");
|
|
68257
68372
|
if (!await exists4(componentsRoot))
|
|
68258
68373
|
return [];
|
|
68259
68374
|
const componentEntries = await readdir4(componentsRoot, { withFileTypes: true });
|
|
@@ -68261,14 +68376,14 @@ async function discoverBundledAgents(pluginRoot) {
|
|
|
68261
68376
|
for (const entry of componentEntries) {
|
|
68262
68377
|
if (!entry.isDirectory())
|
|
68263
68378
|
continue;
|
|
68264
|
-
const agentsRoot =
|
|
68379
|
+
const agentsRoot = join39(componentsRoot, entry.name, "agents");
|
|
68265
68380
|
if (!await exists4(agentsRoot))
|
|
68266
68381
|
continue;
|
|
68267
68382
|
const agentEntries = await readdir4(agentsRoot, { withFileTypes: true });
|
|
68268
68383
|
for (const file2 of agentEntries) {
|
|
68269
68384
|
if (!file2.isFile() || !file2.name.endsWith(".toml"))
|
|
68270
68385
|
continue;
|
|
68271
|
-
agents.push(
|
|
68386
|
+
agents.push(join39(agentsRoot, file2.name));
|
|
68272
68387
|
}
|
|
68273
68388
|
}
|
|
68274
68389
|
agents.sort();
|
|
@@ -68288,7 +68403,7 @@ async function prepareReplacement(linkPath) {
|
|
|
68288
68403
|
await rm6(linkPath, { force: true });
|
|
68289
68404
|
}
|
|
68290
68405
|
async function writeManifest(pluginRoot, agentPaths) {
|
|
68291
|
-
const manifestPath =
|
|
68406
|
+
const manifestPath = join39(pluginRoot, MANIFEST_FILE);
|
|
68292
68407
|
const payload = { agents: [...agentPaths].sort() };
|
|
68293
68408
|
await writeFile6(manifestPath, `${JSON.stringify(payload, null, "\t")}
|
|
68294
68409
|
`);
|
|
@@ -68296,7 +68411,7 @@ async function writeManifest(pluginRoot, agentPaths) {
|
|
|
68296
68411
|
async function restorePreservedReasoning(input) {
|
|
68297
68412
|
if (input.value === undefined)
|
|
68298
68413
|
return;
|
|
68299
|
-
const content = await
|
|
68414
|
+
const content = await readFile13(input.target, "utf8");
|
|
68300
68415
|
const bundledEffort = extractReasoningEffort(content);
|
|
68301
68416
|
if (bundledEffort === input.value)
|
|
68302
68417
|
return;
|
|
@@ -68307,7 +68422,7 @@ async function restorePreservedReasoning(input) {
|
|
|
68307
68422
|
}
|
|
68308
68423
|
async function readTextIfExists2(path7) {
|
|
68309
68424
|
try {
|
|
68310
|
-
return await
|
|
68425
|
+
return await readFile13(path7, "utf8");
|
|
68311
68426
|
} catch (error) {
|
|
68312
68427
|
if (nodeErrorCode2(error) === "ENOENT")
|
|
68313
68428
|
return null;
|
|
@@ -68415,12 +68530,12 @@ function nodeErrorCode2(error) {
|
|
|
68415
68530
|
}
|
|
68416
68531
|
|
|
68417
68532
|
// packages/omo-codex/src/install/codex-marketplace.ts
|
|
68418
|
-
import { readFile as
|
|
68419
|
-
import { join as
|
|
68533
|
+
import { readFile as readFile14 } from "node:fs/promises";
|
|
68534
|
+
import { join as join40 } from "node:path";
|
|
68420
68535
|
var DEFAULT_MARKETPLACE_PATH = "packages/omo-codex/marketplace.json";
|
|
68421
68536
|
async function readMarketplace(repoRoot, options) {
|
|
68422
|
-
const marketplacePath = options?.marketplacePath ??
|
|
68423
|
-
const raw = await
|
|
68537
|
+
const marketplacePath = options?.marketplacePath ?? join40(repoRoot, DEFAULT_MARKETPLACE_PATH);
|
|
68538
|
+
const raw = await readFile14(marketplacePath, "utf8");
|
|
68424
68539
|
const parsed = JSON.parse(raw);
|
|
68425
68540
|
if (!isPlainRecord3(parsed))
|
|
68426
68541
|
throw new Error("marketplace.json must be an object");
|
|
@@ -68438,10 +68553,10 @@ async function readMarketplace(repoRoot, options) {
|
|
|
68438
68553
|
function resolvePluginSource(repoRoot, plugin, options) {
|
|
68439
68554
|
const sourcePath = localSourcePath(options?.pathOverride ?? plugin.source);
|
|
68440
68555
|
const relativePath = sourcePath.slice(2);
|
|
68441
|
-
return
|
|
68556
|
+
return join40(repoRoot, ...relativePath.split(/[\\/]/));
|
|
68442
68557
|
}
|
|
68443
68558
|
async function readPluginManifest(pluginRoot) {
|
|
68444
|
-
const raw = await
|
|
68559
|
+
const raw = await readFile14(join40(pluginRoot, ".codex-plugin", "plugin.json"), "utf8");
|
|
68445
68560
|
const parsed = JSON.parse(raw);
|
|
68446
68561
|
if (!isPlainRecord3(parsed))
|
|
68447
68562
|
throw new Error(`${pluginRoot} plugin.json must be an object`);
|
|
@@ -68451,15 +68566,27 @@ async function readPluginManifest(pluginRoot) {
|
|
|
68451
68566
|
if (parsed.version !== undefined && (typeof parsed.version !== "string" || parsed.version.trim() === "")) {
|
|
68452
68567
|
throw new Error(`${pluginRoot} plugin.json version must be a non-empty string`);
|
|
68453
68568
|
}
|
|
68454
|
-
if (parsed.hooks !== undefined && (
|
|
68455
|
-
throw new Error(`${pluginRoot} plugin.json hooks must be a non-empty string`);
|
|
68569
|
+
if (parsed.hooks !== undefined && !isPluginHooksManifestValue(parsed.hooks)) {
|
|
68570
|
+
throw new Error(`${pluginRoot} plugin.json hooks must be a non-empty string or string array`);
|
|
68456
68571
|
}
|
|
68457
68572
|
return {
|
|
68458
68573
|
name: parsed.name,
|
|
68459
68574
|
version: typeof parsed.version === "string" ? parsed.version.trim() : undefined,
|
|
68460
|
-
hooks:
|
|
68575
|
+
hooks: normalizePluginHooksManifestValue(parsed.hooks)
|
|
68461
68576
|
};
|
|
68462
68577
|
}
|
|
68578
|
+
function isPluginHooksManifestValue(value) {
|
|
68579
|
+
if (typeof value === "string")
|
|
68580
|
+
return value.trim() !== "";
|
|
68581
|
+
return Array.isArray(value) && value.every((item) => typeof item === "string" && item.trim() !== "");
|
|
68582
|
+
}
|
|
68583
|
+
function normalizePluginHooksManifestValue(value) {
|
|
68584
|
+
if (typeof value === "string")
|
|
68585
|
+
return value.trim();
|
|
68586
|
+
if (Array.isArray(value))
|
|
68587
|
+
return value.map((item) => item.trim());
|
|
68588
|
+
return;
|
|
68589
|
+
}
|
|
68463
68590
|
function validatePathSegment(value, label) {
|
|
68464
68591
|
if (!/^[A-Za-z0-9._+-]+$/.test(value)) {
|
|
68465
68592
|
throw new Error(`${label} contains unsupported characters: ${value}`);
|
|
@@ -68511,7 +68638,7 @@ function validateLocalSourcePath(path7) {
|
|
|
68511
68638
|
|
|
68512
68639
|
// packages/omo-codex/src/install/codex-marketplace-snapshot.ts
|
|
68513
68640
|
import { cp as cp3, mkdir as mkdir7, rename as rename3, rm as rm7, writeFile as writeFile7 } from "node:fs/promises";
|
|
68514
|
-
import { join as
|
|
68641
|
+
import { join as join41, sep as sep6 } from "node:path";
|
|
68515
68642
|
var INSTALLED_MARKETPLACES_DIR = ".tmp/marketplaces";
|
|
68516
68643
|
async function writeInstalledMarketplaceSnapshot(input) {
|
|
68517
68644
|
const marketplaceRoot = installedMarketplaceRoot(input.codexHome, input.marketplace.name);
|
|
@@ -68524,21 +68651,21 @@ async function writeInstalledMarketplaceSnapshot(input) {
|
|
|
68524
68651
|
return snapshotPlugins;
|
|
68525
68652
|
}
|
|
68526
68653
|
function installedMarketplaceRoot(codexHome, marketplaceName) {
|
|
68527
|
-
return
|
|
68654
|
+
return join41(codexHome, INSTALLED_MARKETPLACES_DIR, marketplaceName);
|
|
68528
68655
|
}
|
|
68529
68656
|
async function writeMarketplaceManifest(marketplaceRoot, marketplace) {
|
|
68530
|
-
const manifestDir =
|
|
68657
|
+
const manifestDir = join41(marketplaceRoot, ".agents", "plugins");
|
|
68531
68658
|
await mkdir7(manifestDir, { recursive: true });
|
|
68532
|
-
const tempPath =
|
|
68659
|
+
const tempPath = join41(manifestDir, `.marketplace-${process.pid}-${Date.now()}.json.tmp`);
|
|
68533
68660
|
await writeFile7(tempPath, `${JSON.stringify(marketplace, null, "\t")}
|
|
68534
68661
|
`);
|
|
68535
|
-
await rename3(tempPath,
|
|
68662
|
+
await rename3(tempPath, join41(manifestDir, "marketplace.json"));
|
|
68536
68663
|
}
|
|
68537
68664
|
async function writeSnapshotPlugin(marketplaceRoot, plugin) {
|
|
68538
|
-
const pluginsDir =
|
|
68665
|
+
const pluginsDir = join41(marketplaceRoot, "plugins");
|
|
68539
68666
|
await mkdir7(pluginsDir, { recursive: true });
|
|
68540
|
-
const targetPath =
|
|
68541
|
-
const tempPath =
|
|
68667
|
+
const targetPath = join41(pluginsDir, plugin.name);
|
|
68668
|
+
const tempPath = join41(pluginsDir, `.tmp-${plugin.name}-${process.pid}-${Date.now()}`);
|
|
68542
68669
|
await rm7(tempPath, { recursive: true, force: true });
|
|
68543
68670
|
await cp3(plugin.sourcePath, tempPath, {
|
|
68544
68671
|
recursive: true,
|
|
@@ -68551,19 +68678,19 @@ async function writeSnapshotPlugin(marketplaceRoot, plugin) {
|
|
|
68551
68678
|
return { name: plugin.name, path: targetPath };
|
|
68552
68679
|
}
|
|
68553
68680
|
function shouldCopyMarketplaceSourcePath(path7, root) {
|
|
68554
|
-
const relative5 = path7 === root ? "" : path7.slice(root.length +
|
|
68681
|
+
const relative5 = path7 === root ? "" : path7.slice(root.length + sep6.length);
|
|
68555
68682
|
if (relative5 === "")
|
|
68556
68683
|
return true;
|
|
68557
|
-
const parts = relative5.split(
|
|
68684
|
+
const parts = relative5.split(sep6);
|
|
68558
68685
|
return !parts.some((part) => part === ".git" || part === "node_modules");
|
|
68559
68686
|
}
|
|
68560
68687
|
|
|
68561
68688
|
// packages/omo-codex/src/install/lazycodex-version-stamp.ts
|
|
68562
|
-
import { readdir as readdir5, readFile as
|
|
68563
|
-
import { join as
|
|
68689
|
+
import { readdir as readdir5, readFile as readFile15, writeFile as writeFile8 } from "node:fs/promises";
|
|
68690
|
+
import { join as join42 } from "node:path";
|
|
68564
68691
|
async function readDistributionManifest(repoRoot) {
|
|
68565
68692
|
try {
|
|
68566
|
-
const parsed = JSON.parse(await
|
|
68693
|
+
const parsed = JSON.parse(await readFile15(join42(repoRoot, "package.json"), "utf8"));
|
|
68567
68694
|
if (!isPlainRecord3(parsed) || typeof parsed.version !== "string" || parsed.version.trim().length === 0)
|
|
68568
68695
|
return;
|
|
68569
68696
|
return {
|
|
@@ -68583,15 +68710,19 @@ function resolveLazyCodexPluginVersion(input) {
|
|
|
68583
68710
|
return input.manifestVersion ?? "local";
|
|
68584
68711
|
}
|
|
68585
68712
|
async function stampLazyCodexPluginVersion(input) {
|
|
68586
|
-
|
|
68587
|
-
await
|
|
68588
|
-
await
|
|
68713
|
+
const manifestPath = join42(input.pluginRoot, ".codex-plugin", "plugin.json");
|
|
68714
|
+
const hookPaths = await readPluginHookPaths(manifestPath);
|
|
68715
|
+
await stampJsonVersion(manifestPath, input.version);
|
|
68716
|
+
await stampJsonVersion(join42(input.pluginRoot, "package.json"), input.version);
|
|
68717
|
+
for (const hookPath of hookPaths) {
|
|
68718
|
+
await stampHookStatusMessages(join42(input.pluginRoot, hookPath), input.version);
|
|
68719
|
+
}
|
|
68589
68720
|
await stampComponentVersions(input);
|
|
68590
68721
|
}
|
|
68591
68722
|
async function writeLazyCodexInstallSnapshot(input) {
|
|
68592
68723
|
if (input.distributionManifest === undefined)
|
|
68593
68724
|
return;
|
|
68594
|
-
await writeFile8(
|
|
68725
|
+
await writeFile8(join42(input.pluginRoot, "lazycodex-install.json"), `${JSON.stringify({
|
|
68595
68726
|
packageName: input.distributionManifest.name,
|
|
68596
68727
|
version: input.distributionManifest.version
|
|
68597
68728
|
}, null, "\t")}
|
|
@@ -68599,7 +68730,7 @@ async function writeLazyCodexInstallSnapshot(input) {
|
|
|
68599
68730
|
}
|
|
68600
68731
|
async function stampJsonVersion(path7, version) {
|
|
68601
68732
|
try {
|
|
68602
|
-
const parsed = JSON.parse(await
|
|
68733
|
+
const parsed = JSON.parse(await readFile15(path7, "utf8"));
|
|
68603
68734
|
if (!isPlainRecord3(parsed))
|
|
68604
68735
|
return;
|
|
68605
68736
|
parsed.version = version;
|
|
@@ -68611,9 +68742,29 @@ async function stampJsonVersion(path7, version) {
|
|
|
68611
68742
|
throw error;
|
|
68612
68743
|
}
|
|
68613
68744
|
}
|
|
68745
|
+
async function readPluginHookPaths(manifestPath) {
|
|
68746
|
+
try {
|
|
68747
|
+
const parsed = JSON.parse(await readFile15(manifestPath, "utf8"));
|
|
68748
|
+
if (!isPlainRecord3(parsed))
|
|
68749
|
+
return [];
|
|
68750
|
+
if (typeof parsed.hooks === "string" && parsed.hooks.trim().length > 0)
|
|
68751
|
+
return [stripDotSlash3(parsed.hooks)];
|
|
68752
|
+
if (Array.isArray(parsed.hooks)) {
|
|
68753
|
+
return parsed.hooks.filter((hookPath) => typeof hookPath === "string" && hookPath.trim().length > 0).map(stripDotSlash3);
|
|
68754
|
+
}
|
|
68755
|
+
return [];
|
|
68756
|
+
} catch (error) {
|
|
68757
|
+
if (error instanceof Error)
|
|
68758
|
+
return [];
|
|
68759
|
+
throw error;
|
|
68760
|
+
}
|
|
68761
|
+
}
|
|
68762
|
+
function stripDotSlash3(path7) {
|
|
68763
|
+
return path7.startsWith("./") ? path7.slice(2) : path7;
|
|
68764
|
+
}
|
|
68614
68765
|
async function stampHookStatusMessages(path7, version) {
|
|
68615
68766
|
try {
|
|
68616
|
-
const parsed = JSON.parse(await
|
|
68767
|
+
const parsed = JSON.parse(await readFile15(path7, "utf8"));
|
|
68617
68768
|
if (!isPlainRecord3(parsed))
|
|
68618
68769
|
return;
|
|
68619
68770
|
stampHookGroups(parsed.hooks, version);
|
|
@@ -68628,16 +68779,16 @@ async function stampHookStatusMessages(path7, version) {
|
|
|
68628
68779
|
async function stampComponentVersions(input) {
|
|
68629
68780
|
let entries;
|
|
68630
68781
|
try {
|
|
68631
|
-
entries = await readdir5(
|
|
68782
|
+
entries = await readdir5(join42(input.pluginRoot, "components"));
|
|
68632
68783
|
} catch (error) {
|
|
68633
68784
|
if (error instanceof Error)
|
|
68634
68785
|
return;
|
|
68635
68786
|
throw error;
|
|
68636
68787
|
}
|
|
68637
68788
|
for (const entry of entries) {
|
|
68638
|
-
const componentRoot =
|
|
68639
|
-
await stampJsonVersion(
|
|
68640
|
-
await stampHookStatusMessages(
|
|
68789
|
+
const componentRoot = join42(input.pluginRoot, "components", entry);
|
|
68790
|
+
await stampJsonVersion(join42(componentRoot, "package.json"), input.version);
|
|
68791
|
+
await stampHookStatusMessages(join42(componentRoot, "hooks", "hooks.json"), input.version);
|
|
68641
68792
|
}
|
|
68642
68793
|
}
|
|
68643
68794
|
function stampHookGroups(hooks, version) {
|
|
@@ -68658,7 +68809,7 @@ function stampHookGroups(hooks, version) {
|
|
|
68658
68809
|
function stampHookStatusMessage(hook, version) {
|
|
68659
68810
|
if (!isPlainRecord3(hook) || typeof hook.statusMessage !== "string")
|
|
68660
68811
|
return;
|
|
68661
|
-
hook.statusMessage = hook.statusMessage.replace(/^LazyCodex\([^)]+\)
|
|
68812
|
+
hook.statusMessage = hook.statusMessage.replace(/^LazyCodex\([^)]+\):\s*/, "(OmO) ");
|
|
68662
68813
|
}
|
|
68663
68814
|
|
|
68664
68815
|
// packages/omo-codex/src/install/codex-process.ts
|
|
@@ -68690,8 +68841,8 @@ var defaultRunCommand = async (command, args, options) => {
|
|
|
68690
68841
|
};
|
|
68691
68842
|
|
|
68692
68843
|
// packages/omo-codex/src/install/codex-project-local-cleanup.ts
|
|
68693
|
-
import { copyFile as copyFile2, lstat as lstat8, readFile as
|
|
68694
|
-
import { dirname as dirname14, join as
|
|
68844
|
+
import { copyFile as copyFile2, lstat as lstat8, readFile as readFile16, writeFile as writeFile9 } from "node:fs/promises";
|
|
68845
|
+
import { dirname as dirname14, join as join43, resolve as resolve12 } from "node:path";
|
|
68695
68846
|
var LEGACY_AGENT_CONFLICT_KEYS = ["max_threads"];
|
|
68696
68847
|
var PROJECT_LOCAL_ARTIFACT_PATHS = [
|
|
68697
68848
|
".codex/hooks.json",
|
|
@@ -68710,7 +68861,7 @@ async function repairNearestProjectLocalCodexArtifacts(input) {
|
|
|
68710
68861
|
const artifacts = await collectProjectLocalArtifacts(project.artifactRoots);
|
|
68711
68862
|
const configs = [];
|
|
68712
68863
|
for (const configPath of project.configPaths) {
|
|
68713
|
-
const original = await
|
|
68864
|
+
const original = await readFile16(configPath, "utf8");
|
|
68714
68865
|
const repair = repairProjectLocalCodexConfigText(original);
|
|
68715
68866
|
if (!repair.changed) {
|
|
68716
68867
|
configs.push({
|
|
@@ -68794,17 +68945,17 @@ async function findProjectLocalCodexConfigs(startDirectory, codexHome) {
|
|
|
68794
68945
|
if (startDirectoryStat !== null && !startDirectoryStat.isDirectory()) {
|
|
68795
68946
|
throw new ProjectLocalCleanupStartDirectoryError(startDirectory);
|
|
68796
68947
|
}
|
|
68797
|
-
const codexHomeConfigPath = codexHome === undefined ? null :
|
|
68948
|
+
const codexHomeConfigPath = codexHome === undefined ? null : join43(resolve12(codexHome), "config.toml");
|
|
68798
68949
|
let current = resolve12(startDirectory);
|
|
68799
68950
|
const configPathsFromCwd = [];
|
|
68800
68951
|
while (true) {
|
|
68801
|
-
const configPath =
|
|
68952
|
+
const configPath = join43(current, ".codex", "config.toml");
|
|
68802
68953
|
if (await isRegularProjectLocalConfig(current, configPath)) {
|
|
68803
68954
|
if (codexHomeConfigPath === null || resolve12(configPath) !== codexHomeConfigPath) {
|
|
68804
68955
|
configPathsFromCwd.push(configPath);
|
|
68805
68956
|
}
|
|
68806
68957
|
}
|
|
68807
|
-
if (await exists5(
|
|
68958
|
+
if (await exists5(join43(current, ".git"))) {
|
|
68808
68959
|
return configPathsFromCwd.length === 0 ? null : {
|
|
68809
68960
|
projectRoot: current,
|
|
68810
68961
|
configPaths: [...configPathsFromCwd].reverse(),
|
|
@@ -68824,7 +68975,7 @@ async function findProjectLocalCodexConfigs(startDirectory, codexHome) {
|
|
|
68824
68975
|
}
|
|
68825
68976
|
}
|
|
68826
68977
|
async function isRegularProjectLocalConfig(directory, configPath) {
|
|
68827
|
-
const codexDirStat = await maybeLstat(
|
|
68978
|
+
const codexDirStat = await maybeLstat(join43(directory, ".codex"));
|
|
68828
68979
|
if (codexDirStat === null || !codexDirStat.isDirectory() || codexDirStat.isSymbolicLink())
|
|
68829
68980
|
return false;
|
|
68830
68981
|
const configStat = await maybeLstat(configPath);
|
|
@@ -68844,7 +68995,7 @@ async function collectProjectLocalArtifacts(projectRoots) {
|
|
|
68844
68995
|
const seenPaths = new Set;
|
|
68845
68996
|
for (const projectRoot of projectRoots) {
|
|
68846
68997
|
for (const relativePath of PROJECT_LOCAL_ARTIFACT_PATHS) {
|
|
68847
|
-
const artifactPath =
|
|
68998
|
+
const artifactPath = join43(projectRoot, relativePath);
|
|
68848
68999
|
if (seenPaths.has(artifactPath))
|
|
68849
69000
|
continue;
|
|
68850
69001
|
const entryStat = await maybeLstat(artifactPath);
|
|
@@ -68919,13 +69070,13 @@ function formatUnknownError(error) {
|
|
|
68919
69070
|
}
|
|
68920
69071
|
|
|
68921
69072
|
// packages/omo-codex/src/install/lsp-daemon-reaper.ts
|
|
68922
|
-
import { readFile as
|
|
69073
|
+
import { readFile as readFile17, readdir as readdir6, rm as rm8 } from "node:fs/promises";
|
|
68923
69074
|
import { connect } from "node:net";
|
|
68924
|
-
import { join as
|
|
69075
|
+
import { join as join44 } from "node:path";
|
|
68925
69076
|
async function reapLspDaemons(codexHome, deps = {}) {
|
|
68926
69077
|
const killProcess = deps.killProcess ?? sendSigterm;
|
|
68927
69078
|
const isDaemonLive = deps.isDaemonLive ?? probeSocketLive;
|
|
68928
|
-
const daemonRoot =
|
|
69079
|
+
const daemonRoot = join44(codexHome, "codex-lsp", "daemon");
|
|
68929
69080
|
const reaped = [];
|
|
68930
69081
|
let entries;
|
|
68931
69082
|
try {
|
|
@@ -68934,9 +69085,9 @@ async function reapLspDaemons(codexHome, deps = {}) {
|
|
|
68934
69085
|
return reaped;
|
|
68935
69086
|
}
|
|
68936
69087
|
for (const entry of entries) {
|
|
68937
|
-
const versionDir =
|
|
68938
|
-
const pid = await readPidFile(
|
|
68939
|
-
const socketPath = await readEndpointFile(
|
|
69088
|
+
const versionDir = join44(daemonRoot, entry);
|
|
69089
|
+
const pid = await readPidFile(join44(versionDir, "daemon.pid"));
|
|
69090
|
+
const socketPath = await readEndpointFile(join44(versionDir, "daemon.endpoint"));
|
|
68940
69091
|
if (pid !== null && socketPath !== null && await isDaemonLive(socketPath) && killProcess(pid)) {
|
|
68941
69092
|
reaped.push(pid);
|
|
68942
69093
|
}
|
|
@@ -68946,7 +69097,7 @@ async function reapLspDaemons(codexHome, deps = {}) {
|
|
|
68946
69097
|
}
|
|
68947
69098
|
async function readEndpointFile(path7) {
|
|
68948
69099
|
try {
|
|
68949
|
-
const content = (await
|
|
69100
|
+
const content = (await readFile17(path7, "utf8")).trim();
|
|
68950
69101
|
return content.length > 0 ? content : null;
|
|
68951
69102
|
} catch {
|
|
68952
69103
|
return null;
|
|
@@ -68954,7 +69105,7 @@ async function readEndpointFile(path7) {
|
|
|
68954
69105
|
}
|
|
68955
69106
|
async function readPidFile(path7) {
|
|
68956
69107
|
try {
|
|
68957
|
-
const pid = Number.parseInt((await
|
|
69108
|
+
const pid = Number.parseInt((await readFile17(path7, "utf8")).trim(), 10);
|
|
68958
69109
|
return Number.isInteger(pid) && pid > 0 ? pid : null;
|
|
68959
69110
|
} catch {
|
|
68960
69111
|
return null;
|
|
@@ -68990,7 +69141,7 @@ function sendSigterm(pid) {
|
|
|
68990
69141
|
|
|
68991
69142
|
// packages/omo-codex/src/install/codex-installer-bin-dir.ts
|
|
68992
69143
|
import { homedir as homedir5 } from "node:os";
|
|
68993
|
-
import { join as
|
|
69144
|
+
import { join as join45, resolve as resolve13 } from "node:path";
|
|
68994
69145
|
function resolveCodexInstallerBinDir(input) {
|
|
68995
69146
|
const explicitBinDir = input.binDir ?? input.env?.CODEX_LOCAL_BIN_DIR;
|
|
68996
69147
|
if (explicitBinDir !== undefined && explicitBinDir.trim().length > 0)
|
|
@@ -68999,15 +69150,15 @@ function resolveCodexInstallerBinDir(input) {
|
|
|
68999
69150
|
const defaultCodexHome = resolve13(homeDir, ".codex");
|
|
69000
69151
|
const resolvedCodexHome = resolve13(input.codexHome);
|
|
69001
69152
|
if (resolvedCodexHome !== defaultCodexHome)
|
|
69002
|
-
return
|
|
69153
|
+
return join45(resolvedCodexHome, "bin");
|
|
69003
69154
|
return resolve13(homeDir, ".local", "bin");
|
|
69004
69155
|
}
|
|
69005
69156
|
|
|
69006
69157
|
// packages/omo-codex/src/install/omo-sot-migration.ts
|
|
69007
|
-
import { join as
|
|
69158
|
+
import { join as join46 } from "node:path";
|
|
69008
69159
|
async function seedAndMigrateOmoSot(input) {
|
|
69009
69160
|
const commandEnv = { ...input.env };
|
|
69010
|
-
const scriptPath =
|
|
69161
|
+
const scriptPath = join46(input.repoRoot, "packages", "omo-codex", "plugin", "scripts", "migrate-omo-sot.mjs");
|
|
69011
69162
|
try {
|
|
69012
69163
|
await input.runCommand(process.execPath, [scriptPath, "--seed"], {
|
|
69013
69164
|
cwd: input.repoRoot,
|
|
@@ -69022,7 +69173,7 @@ async function seedAndMigrateOmoSot(input) {
|
|
|
69022
69173
|
|
|
69023
69174
|
// packages/omo-codex/src/install/install-ast-grep-sg.ts
|
|
69024
69175
|
init_src();
|
|
69025
|
-
import { join as
|
|
69176
|
+
import { join as join47 } from "node:path";
|
|
69026
69177
|
function describeResult(result) {
|
|
69027
69178
|
if (result.kind === "succeeded")
|
|
69028
69179
|
return null;
|
|
@@ -69036,7 +69187,7 @@ async function installAstGrepForCodex(options) {
|
|
|
69036
69187
|
return;
|
|
69037
69188
|
const platform = options.platform ?? process.platform;
|
|
69038
69189
|
const targetDir = astGrepRuntimeDir(options.codexHome, platform, options.arch ?? process.arch);
|
|
69039
|
-
const skillDir =
|
|
69190
|
+
const skillDir = join47(plugin.path, "skills", "ast-grep");
|
|
69040
69191
|
const installer = options.installer ?? runAstGrepSkillInstall;
|
|
69041
69192
|
try {
|
|
69042
69193
|
const result = await installer({ platform, skillDir, targetDir });
|
|
@@ -69069,7 +69220,7 @@ async function runCodexInstaller(options = {}) {
|
|
|
69069
69220
|
const env3 = options.env ?? process.env;
|
|
69070
69221
|
const platform = options.platform ?? process.platform;
|
|
69071
69222
|
const repoRoot = resolve14(options.repoRoot ?? findRepoRoot({ importerDir: import.meta.dir, env: env3 }));
|
|
69072
|
-
const codexHome = resolve14(options.codexHome ?? env3.CODEX_HOME ??
|
|
69223
|
+
const codexHome = resolve14(options.codexHome ?? env3.CODEX_HOME ?? join50(homedir6(), ".codex"));
|
|
69073
69224
|
const projectDirectory = resolve14(options.projectDirectory ?? env3.OMO_CODEX_PROJECT ?? process.cwd());
|
|
69074
69225
|
const binDir = resolveCodexInstallerBinDir({ binDir: options.binDir, codexHome, env: env3 });
|
|
69075
69226
|
const runCommand = options.runCommand ?? defaultRunCommand;
|
|
@@ -69087,9 +69238,9 @@ async function runCodexInstaller(options = {}) {
|
|
|
69087
69238
|
if (!gitBashResolution.found) {
|
|
69088
69239
|
throw new Error(gitBashResolution.installHint);
|
|
69089
69240
|
}
|
|
69090
|
-
const codexPackageRoot =
|
|
69241
|
+
const codexPackageRoot = join50(repoRoot, "packages", "omo-codex");
|
|
69091
69242
|
const marketplace = await readMarketplace(repoRoot, {
|
|
69092
|
-
marketplacePath:
|
|
69243
|
+
marketplacePath: join50(codexPackageRoot, "marketplace.json")
|
|
69093
69244
|
});
|
|
69094
69245
|
const distributionManifest = await readDistributionManifest(repoRoot);
|
|
69095
69246
|
const installed = [];
|
|
@@ -69131,7 +69282,7 @@ async function runCodexInstaller(options = {}) {
|
|
|
69131
69282
|
if (runtimeLink !== null)
|
|
69132
69283
|
log4(`Linked ${runtimeLink.name} -> ${runtimeLink.target}`);
|
|
69133
69284
|
else
|
|
69134
|
-
log4(`Warning: skipped the omo runtime wrapper because ${
|
|
69285
|
+
log4(`Warning: skipped the omo runtime wrapper because ${join50(repoRoot, "dist", "cli", "index.js")} is missing; omo sparkshell/ulw-loop commands will be unavailable until a package shipping dist/cli is installed`);
|
|
69135
69286
|
}
|
|
69136
69287
|
pluginSources.push({ name: entry.name, sourcePath });
|
|
69137
69288
|
installed.push(plugin);
|
|
@@ -69184,13 +69335,13 @@ async function runCodexInstaller(options = {}) {
|
|
|
69184
69335
|
});
|
|
69185
69336
|
}
|
|
69186
69337
|
await reapLspDaemons(codexHome).catch(() => []);
|
|
69187
|
-
const marketplaceRoot =
|
|
69338
|
+
const marketplaceRoot = join50(codexHome, "plugins", "cache", marketplace.name);
|
|
69188
69339
|
await writeCachedMarketplaceManifest({
|
|
69189
69340
|
marketplaceName: marketplace.name,
|
|
69190
69341
|
marketplaceRoot,
|
|
69191
69342
|
plugins: installed
|
|
69192
69343
|
});
|
|
69193
|
-
const configPath =
|
|
69344
|
+
const configPath = join50(codexHome, "config.toml");
|
|
69194
69345
|
await updateCodexConfig({
|
|
69195
69346
|
configPath,
|
|
69196
69347
|
repoRoot: codexPackageRoot,
|
|
@@ -69249,7 +69400,7 @@ function findRepoRootFromImporter(importerDir) {
|
|
|
69249
69400
|
for (let depth = 0;depth <= 7; depth += 1) {
|
|
69250
69401
|
if (isRepoRootWithCodexPlugin(current))
|
|
69251
69402
|
return current;
|
|
69252
|
-
for (const wrapperPackageRoot of [
|
|
69403
|
+
for (const wrapperPackageRoot of [join50(current, "node_modules", "oh-my-openagent"), join50(current, "oh-my-openagent")]) {
|
|
69253
69404
|
if (isRepoRootWithCodexPlugin(wrapperPackageRoot))
|
|
69254
69405
|
return wrapperPackageRoot;
|
|
69255
69406
|
}
|
|
@@ -69267,7 +69418,7 @@ function findRepoRoot(input) {
|
|
|
69267
69418
|
return findRepoRootFromImporter(input.importerDir);
|
|
69268
69419
|
}
|
|
69269
69420
|
function isRepoRootWithCodexPlugin(repoRoot) {
|
|
69270
|
-
return existsSync29(
|
|
69421
|
+
return existsSync29(join50(repoRoot, "packages", "omo-codex", "plugin", ".codex-plugin", "plugin.json"));
|
|
69271
69422
|
}
|
|
69272
69423
|
function codexMarketplaceSource(marketplaceRoot) {
|
|
69273
69424
|
return { sourceType: "local", source: marketplaceRoot };
|
|
@@ -69402,12 +69553,12 @@ function defaultRunCommand2(command, args) {
|
|
|
69402
69553
|
});
|
|
69403
69554
|
}
|
|
69404
69555
|
// packages/omo-codex/src/install/codex-cleanup.ts
|
|
69405
|
-
import { lstat as lstat10, readFile as
|
|
69556
|
+
import { lstat as lstat10, readFile as readFile19, readdir as readdir7, rm as rm9, rmdir } from "node:fs/promises";
|
|
69406
69557
|
import { homedir as homedir8 } from "node:os";
|
|
69407
|
-
import { isAbsolute as isAbsolute8, join as
|
|
69558
|
+
import { isAbsolute as isAbsolute8, join as join51, relative as relative6, resolve as resolve15 } from "node:path";
|
|
69408
69559
|
|
|
69409
69560
|
// packages/omo-codex/src/install/codex-cleanup-config.ts
|
|
69410
|
-
import { lstat as lstat9, mkdir as mkdir8, readFile as
|
|
69561
|
+
import { lstat as lstat9, mkdir as mkdir8, readFile as readFile18, writeFile as writeFile10 } from "node:fs/promises";
|
|
69411
69562
|
import { dirname as dirname16 } from "node:path";
|
|
69412
69563
|
var MANAGED_MARKETPLACES = ["sisyphuslabs", "lazycodex", "code-yeongyu-codex-plugins"];
|
|
69413
69564
|
var LEGACY_MANAGED_CODEX_AGENT_NAMES_TO_PURGE2 = ["codex-ultrawork-reviewer"];
|
|
@@ -69437,7 +69588,7 @@ function cleanupCodexLightConfigText(config) {
|
|
|
69437
69588
|
async function cleanupCodexConfig(configPath, now) {
|
|
69438
69589
|
if (!await configExists(configPath))
|
|
69439
69590
|
return { changed: false };
|
|
69440
|
-
const original = await
|
|
69591
|
+
const original = await readFile18(configPath, "utf8");
|
|
69441
69592
|
const next = cleanupCodexLightConfigText(original);
|
|
69442
69593
|
if (next === original)
|
|
69443
69594
|
return { changed: false };
|
|
@@ -69569,8 +69720,8 @@ function nodeErrorCode4(error) {
|
|
|
69569
69720
|
var INSTALLED_AGENTS_MANIFEST = ".installed-agents.json";
|
|
69570
69721
|
async function cleanupCodexLight(input = {}) {
|
|
69571
69722
|
const env3 = input.env ?? process.env;
|
|
69572
|
-
const codexHome = resolve15(input.codexHome ?? env3.CODEX_HOME ??
|
|
69573
|
-
const configPath =
|
|
69723
|
+
const codexHome = resolve15(input.codexHome ?? env3.CODEX_HOME ?? join51(homedir8(), ".codex"));
|
|
69724
|
+
const configPath = join51(codexHome, "config.toml");
|
|
69574
69725
|
const agentPaths = await collectInstalledAgentPaths(codexHome, configPath);
|
|
69575
69726
|
const configCleanup = await cleanupCodexConfig(configPath, input.now);
|
|
69576
69727
|
const agentCleanup = await removeManifestListedAgentLinks(codexHome, agentPaths);
|
|
@@ -69606,17 +69757,17 @@ async function cleanupCodexLight(input = {}) {
|
|
|
69606
69757
|
}
|
|
69607
69758
|
function managedGlobalStatePaths(codexHome) {
|
|
69608
69759
|
return [
|
|
69609
|
-
|
|
69610
|
-
|
|
69611
|
-
|
|
69612
|
-
|
|
69613
|
-
|
|
69760
|
+
join51(codexHome, "plugins", "cache", "sisyphuslabs"),
|
|
69761
|
+
join51(codexHome, ".tmp", "marketplaces", "sisyphuslabs"),
|
|
69762
|
+
join51(codexHome, "runtime", "ast-grep"),
|
|
69763
|
+
join51(codexHome, "runtime", "node"),
|
|
69764
|
+
join51(codexHome, "plugins", "data", "omo-sisyphuslabs", "bootstrap")
|
|
69614
69765
|
];
|
|
69615
69766
|
}
|
|
69616
69767
|
var BOOTSTRAP_DATA_GLOB_MAX_DEPTH = 5;
|
|
69617
69768
|
async function collectBootstrapDataDirsByGlob(codexHome) {
|
|
69618
69769
|
const results = [];
|
|
69619
|
-
await walkForManagedBootstrapDirs(
|
|
69770
|
+
await walkForManagedBootstrapDirs(join51(codexHome, "plugins"), 0, results);
|
|
69620
69771
|
return results;
|
|
69621
69772
|
}
|
|
69622
69773
|
async function walkForManagedBootstrapDirs(directory, depth, results) {
|
|
@@ -69628,9 +69779,9 @@ async function walkForManagedBootstrapDirs(directory, depth, results) {
|
|
|
69628
69779
|
for (const entry of entries) {
|
|
69629
69780
|
if (!entry.isDirectory())
|
|
69630
69781
|
continue;
|
|
69631
|
-
const childPath =
|
|
69782
|
+
const childPath = join51(directory, entry.name);
|
|
69632
69783
|
if (isManagedBootstrapOwnerName(entry.name)) {
|
|
69633
|
-
const bootstrapDir =
|
|
69784
|
+
const bootstrapDir = join51(childPath, "bootstrap");
|
|
69634
69785
|
if (await exists6(bootstrapDir))
|
|
69635
69786
|
results.push(bootstrapDir);
|
|
69636
69787
|
continue;
|
|
@@ -69659,19 +69810,19 @@ async function attemptRemove(path7) {
|
|
|
69659
69810
|
}
|
|
69660
69811
|
async function pruneEmptyRuntimeDirBestEffort(codexHome) {
|
|
69661
69812
|
try {
|
|
69662
|
-
await rmdir(
|
|
69813
|
+
await rmdir(join51(codexHome, "runtime"));
|
|
69663
69814
|
} catch {}
|
|
69664
69815
|
}
|
|
69665
69816
|
async function collectInstalledAgentPaths(codexHome, configPath) {
|
|
69666
69817
|
const manifestPaths = [
|
|
69667
|
-
|
|
69818
|
+
join51(codexHome, ".tmp", "marketplaces", "sisyphuslabs", "plugins", "omo", INSTALLED_AGENTS_MANIFEST)
|
|
69668
69819
|
];
|
|
69669
|
-
const versionRoot =
|
|
69820
|
+
const versionRoot = join51(codexHome, "plugins", "cache", "sisyphuslabs", "omo");
|
|
69670
69821
|
if (await exists6(versionRoot)) {
|
|
69671
69822
|
const entries = await readdir7(versionRoot, { withFileTypes: true });
|
|
69672
69823
|
for (const entry of entries) {
|
|
69673
69824
|
if (entry.isDirectory())
|
|
69674
|
-
manifestPaths.push(
|
|
69825
|
+
manifestPaths.push(join51(versionRoot, entry.name, INSTALLED_AGENTS_MANIFEST));
|
|
69675
69826
|
}
|
|
69676
69827
|
}
|
|
69677
69828
|
const paths = new Set;
|
|
@@ -69688,19 +69839,19 @@ async function collectInstalledAgentPaths(codexHome, configPath) {
|
|
|
69688
69839
|
async function readManagedAgentPathsFromConfig(codexHome, configPath) {
|
|
69689
69840
|
if (!await exists6(configPath))
|
|
69690
69841
|
return [];
|
|
69691
|
-
const config = await
|
|
69692
|
-
return MANAGED_CODEX_AGENT_NAMES2.filter((agentName) => config.includes(`config_file = ${JSON.stringify(`./agents/${agentName}.toml`)}`)).map((agentName) =>
|
|
69842
|
+
const config = await readFile19(configPath, "utf8");
|
|
69843
|
+
return MANAGED_CODEX_AGENT_NAMES2.filter((agentName) => config.includes(`config_file = ${JSON.stringify(`./agents/${agentName}.toml`)}`)).map((agentName) => join51(codexHome, "agents", `${agentName}.toml`));
|
|
69693
69844
|
}
|
|
69694
69845
|
async function readInstalledAgentManifest(manifestPath) {
|
|
69695
69846
|
if (!await exists6(manifestPath))
|
|
69696
69847
|
return [];
|
|
69697
|
-
const parsed = JSON.parse(await
|
|
69848
|
+
const parsed = JSON.parse(await readFile19(manifestPath, "utf8"));
|
|
69698
69849
|
if (!isPlainRecord3(parsed) || !Array.isArray(parsed.agents))
|
|
69699
69850
|
return [];
|
|
69700
69851
|
return parsed.agents.filter((path7) => typeof path7 === "string");
|
|
69701
69852
|
}
|
|
69702
69853
|
async function removeManifestListedAgentLinks(codexHome, paths) {
|
|
69703
|
-
const agentsDir =
|
|
69854
|
+
const agentsDir = join51(codexHome, "agents");
|
|
69704
69855
|
const removed = [];
|
|
69705
69856
|
const skipped = [];
|
|
69706
69857
|
for (const path7 of paths) {
|
|
@@ -69784,19 +69935,19 @@ init_provider_availability();
|
|
|
69784
69935
|
|
|
69785
69936
|
// packages/omo-opencode/src/cli/config-manager/add-tui-plugin-to-tui-config.ts
|
|
69786
69937
|
import { existsSync as existsSync32, mkdirSync as mkdirSync10, readFileSync as readFileSync16 } from "node:fs";
|
|
69787
|
-
import { join as
|
|
69938
|
+
import { join as join53 } from "node:path";
|
|
69788
69939
|
|
|
69789
69940
|
// packages/omo-opencode/src/cli/doctor/checks/tui-plugin-config.ts
|
|
69790
69941
|
init_shared();
|
|
69791
69942
|
import { existsSync as existsSync31, readFileSync as readFileSync15 } from "node:fs";
|
|
69792
|
-
import { join as
|
|
69943
|
+
import { join as join52 } from "node:path";
|
|
69793
69944
|
var TUI_SUBPATH = "tui";
|
|
69794
69945
|
var TUI_EXPORT_SUBPATH = `./${TUI_SUBPATH}`;
|
|
69795
69946
|
function fileEntryPackageJsonPath(entry) {
|
|
69796
69947
|
let path7 = entry.slice("file:".length);
|
|
69797
69948
|
if (path7.startsWith("//"))
|
|
69798
69949
|
path7 = path7.slice(2);
|
|
69799
|
-
return
|
|
69950
|
+
return join52(path7, "package.json");
|
|
69800
69951
|
}
|
|
69801
69952
|
function packageJsonExportsTui(pkgJsonPath) {
|
|
69802
69953
|
if (!existsSync31(pkgJsonPath))
|
|
@@ -69834,7 +69985,7 @@ function packageExportsTuiForServerEntry(entry) {
|
|
|
69834
69985
|
const packageName = packageNameFromServerEntry(entry);
|
|
69835
69986
|
if (packageName === null)
|
|
69836
69987
|
return null;
|
|
69837
|
-
return packageJsonExportsTui(
|
|
69988
|
+
return packageJsonExportsTui(join52(getOpenCodeConfigDir({ binary: "opencode" }), "node_modules", packageName, "package.json"));
|
|
69838
69989
|
}
|
|
69839
69990
|
function isOurFilePluginEntry(entry) {
|
|
69840
69991
|
if (!entry.startsWith("file:"))
|
|
@@ -69907,7 +70058,7 @@ function detectServerPluginRegistration() {
|
|
|
69907
70058
|
}
|
|
69908
70059
|
}
|
|
69909
70060
|
function detectTuiPluginRegistration() {
|
|
69910
|
-
const tuiJsonPath =
|
|
70061
|
+
const tuiJsonPath = join52(getOpenCodeConfigDir({ binary: "opencode" }), "tui.json");
|
|
69911
70062
|
if (!existsSync31(tuiJsonPath)) {
|
|
69912
70063
|
return {
|
|
69913
70064
|
registered: false,
|
|
@@ -70063,10 +70214,10 @@ function readConfig(path7) {
|
|
|
70063
70214
|
return null;
|
|
70064
70215
|
}
|
|
70065
70216
|
function readServerConfig(configDir) {
|
|
70066
|
-
const jsoncPath =
|
|
70217
|
+
const jsoncPath = join53(configDir, "opencode.jsonc");
|
|
70067
70218
|
if (existsSync32(jsoncPath))
|
|
70068
70219
|
return readConfig(jsoncPath);
|
|
70069
|
-
const jsonPath =
|
|
70220
|
+
const jsonPath = join53(configDir, "opencode.json");
|
|
70070
70221
|
if (existsSync32(jsonPath))
|
|
70071
70222
|
return readConfig(jsonPath);
|
|
70072
70223
|
return null;
|
|
@@ -70108,7 +70259,7 @@ function ensureTuiPluginEntry(opts = {}) {
|
|
|
70108
70259
|
if (!desiredEntry) {
|
|
70109
70260
|
return { changed: false, reason: "no-server-entry" };
|
|
70110
70261
|
}
|
|
70111
|
-
const tuiJsonPath =
|
|
70262
|
+
const tuiJsonPath = join53(configDir, "tui.json");
|
|
70112
70263
|
const { config, malformed } = readTuiConfig(tuiJsonPath);
|
|
70113
70264
|
if (malformed) {
|
|
70114
70265
|
return { changed: false, reason: "malformed" };
|
|
@@ -70124,7 +70275,7 @@ function ensureTuiPluginEntry(opts = {}) {
|
|
|
70124
70275
|
|
|
70125
70276
|
// packages/omo-opencode/src/cli/install-ast-grep-sg.ts
|
|
70126
70277
|
import { homedir as homedir9 } from "node:os";
|
|
70127
|
-
import { join as
|
|
70278
|
+
import { join as join54 } from "node:path";
|
|
70128
70279
|
|
|
70129
70280
|
// packages/shared-skills/index.mjs
|
|
70130
70281
|
import { fileURLToPath } from "node:url";
|
|
@@ -70143,9 +70294,9 @@ function describeResult2(result) {
|
|
|
70143
70294
|
}
|
|
70144
70295
|
async function installAstGrepForOpenCode(options = {}) {
|
|
70145
70296
|
const platform = options.platform ?? process.platform;
|
|
70146
|
-
const baseDir =
|
|
70297
|
+
const baseDir = join54(options.homeDir ?? homedir9(), ".omo");
|
|
70147
70298
|
const targetDir = astGrepRuntimeDir(baseDir, platform, options.arch ?? process.arch);
|
|
70148
|
-
const skillDir =
|
|
70299
|
+
const skillDir = join54(options.sharedSkillsRoot ?? sharedSkillsRootPath(), "ast-grep");
|
|
70149
70300
|
const installer = options.installer ?? runAstGrepSkillInstall;
|
|
70150
70301
|
try {
|
|
70151
70302
|
const result = await installer({ platform, skillDir, targetDir });
|
|
@@ -88591,9 +88742,9 @@ function readCurrentTopLevelTask(planPath) {
|
|
|
88591
88742
|
}
|
|
88592
88743
|
// packages/boulder-state/src/storage/path.ts
|
|
88593
88744
|
import { existsSync as existsSync36 } from "node:fs";
|
|
88594
|
-
import { isAbsolute as isAbsolute9, join as
|
|
88745
|
+
import { isAbsolute as isAbsolute9, join as join56, relative as relative7, resolve as resolve16 } from "node:path";
|
|
88595
88746
|
function getBoulderFilePath(directory) {
|
|
88596
|
-
return
|
|
88747
|
+
return join56(directory, BOULDER_DIR, BOULDER_FILE);
|
|
88597
88748
|
}
|
|
88598
88749
|
function resolveTrackedPath(baseDirectory, trackedPath) {
|
|
88599
88750
|
return isAbsolute9(trackedPath) ? resolve16(trackedPath) : resolve16(baseDirectory, trackedPath);
|
|
@@ -88822,9 +88973,9 @@ init_state();
|
|
|
88822
88973
|
var CONTINUATION_MARKER_DIR = ".omo/run-continuation";
|
|
88823
88974
|
// packages/omo-opencode/src/features/run-continuation-state/storage.ts
|
|
88824
88975
|
import { existsSync as existsSync39, mkdirSync as mkdirSync11, readFileSync as readFileSync21, rmSync as rmSync2, writeFileSync as writeFileSync6 } from "node:fs";
|
|
88825
|
-
import { join as
|
|
88976
|
+
import { join as join57 } from "node:path";
|
|
88826
88977
|
function getMarkerPath(directory, sessionID) {
|
|
88827
|
-
return
|
|
88978
|
+
return join57(directory, CONTINUATION_MARKER_DIR, `${sessionID}.json`);
|
|
88828
88979
|
}
|
|
88829
88980
|
function readContinuationMarker(directory, sessionID) {
|
|
88830
88981
|
const markerPath = getMarkerPath(directory, sessionID);
|
|
@@ -88897,7 +89048,7 @@ async function isSessionInBoulderLineage(input) {
|
|
|
88897
89048
|
init_shared();
|
|
88898
89049
|
init_compaction_marker();
|
|
88899
89050
|
import { readFileSync as readFileSync22, readdirSync as readdirSync6 } from "node:fs";
|
|
88900
|
-
import { join as
|
|
89051
|
+
import { join as join58 } from "node:path";
|
|
88901
89052
|
var defaultSessionLastAgentDeps = {
|
|
88902
89053
|
getMessageDir,
|
|
88903
89054
|
isSqliteBackend,
|
|
@@ -88957,7 +89108,7 @@ async function getLastAgentFromSession(sessionID, client3, deps = {}) {
|
|
|
88957
89108
|
try {
|
|
88958
89109
|
const messages = readdirSync6(messageDir).filter((fileName) => fileName.endsWith(".json")).map((fileName) => {
|
|
88959
89110
|
try {
|
|
88960
|
-
const content = readFileSync22(
|
|
89111
|
+
const content = readFileSync22(join58(messageDir, fileName), "utf-8");
|
|
88961
89112
|
const parsed = JSON.parse(content);
|
|
88962
89113
|
return {
|
|
88963
89114
|
fileName,
|
|
@@ -89001,7 +89152,7 @@ init_agent_display_names();
|
|
|
89001
89152
|
// packages/omo-opencode/src/hooks/ralph-loop/storage.ts
|
|
89002
89153
|
init_frontmatter2();
|
|
89003
89154
|
import { existsSync as existsSync40, readFileSync as readFileSync23, writeFileSync as writeFileSync7, unlinkSync as unlinkSync5, mkdirSync as mkdirSync12 } from "node:fs";
|
|
89004
|
-
import { dirname as dirname19, join as
|
|
89155
|
+
import { dirname as dirname19, join as join59 } from "node:path";
|
|
89005
89156
|
|
|
89006
89157
|
// packages/omo-opencode/src/hooks/ralph-loop/constants.ts
|
|
89007
89158
|
var DEFAULT_STATE_FILE = ".omo/ralph-loop.local.md";
|
|
@@ -89010,7 +89161,7 @@ var DEFAULT_COMPLETION_PROMISE = "DONE";
|
|
|
89010
89161
|
|
|
89011
89162
|
// packages/omo-opencode/src/hooks/ralph-loop/storage.ts
|
|
89012
89163
|
function getStateFilePath(directory, customPath) {
|
|
89013
|
-
return customPath ?
|
|
89164
|
+
return customPath ? join59(directory, customPath) : join59(directory, DEFAULT_STATE_FILE);
|
|
89014
89165
|
}
|
|
89015
89166
|
function readState(directory, customPath) {
|
|
89016
89167
|
const filePath = getStateFilePath(directory, customPath);
|
|
@@ -90123,7 +90274,7 @@ init_extract_semver();
|
|
|
90123
90274
|
init_bun_which_shim();
|
|
90124
90275
|
import { existsSync as existsSync48, accessSync as accessSync4, constants as constants9 } from "node:fs";
|
|
90125
90276
|
import { homedir as homedir13 } from "node:os";
|
|
90126
|
-
import { join as
|
|
90277
|
+
import { join as join66 } from "node:path";
|
|
90127
90278
|
|
|
90128
90279
|
// packages/omo-opencode/src/cli/doctor/framework/spawn-with-timeout.ts
|
|
90129
90280
|
init_spawn_with_windows_hide();
|
|
@@ -90215,17 +90366,17 @@ function getDesktopAppPaths(platform) {
|
|
|
90215
90366
|
case "darwin":
|
|
90216
90367
|
return [
|
|
90217
90368
|
"/Applications/OpenCode.app/Contents/MacOS/OpenCode",
|
|
90218
|
-
|
|
90369
|
+
join66(home, "Applications", "OpenCode.app", "Contents", "MacOS", "OpenCode")
|
|
90219
90370
|
];
|
|
90220
90371
|
case "win32": {
|
|
90221
90372
|
const programFiles = process.env.ProgramFiles;
|
|
90222
90373
|
const localAppData = process.env.LOCALAPPDATA;
|
|
90223
90374
|
const paths = [];
|
|
90224
90375
|
if (programFiles) {
|
|
90225
|
-
paths.push(
|
|
90376
|
+
paths.push(join66(programFiles, "OpenCode", "OpenCode.exe"));
|
|
90226
90377
|
}
|
|
90227
90378
|
if (localAppData) {
|
|
90228
|
-
paths.push(
|
|
90379
|
+
paths.push(join66(localAppData, "OpenCode", "OpenCode.exe"));
|
|
90229
90380
|
}
|
|
90230
90381
|
return paths;
|
|
90231
90382
|
}
|
|
@@ -90233,8 +90384,8 @@ function getDesktopAppPaths(platform) {
|
|
|
90233
90384
|
return [
|
|
90234
90385
|
"/usr/bin/opencode",
|
|
90235
90386
|
"/usr/lib/opencode/opencode",
|
|
90236
|
-
|
|
90237
|
-
|
|
90387
|
+
join66(home, "Applications", "opencode-desktop-linux-x86_64.AppImage"),
|
|
90388
|
+
join66(home, "Applications", "opencode-desktop-linux-aarch64.AppImage")
|
|
90238
90389
|
];
|
|
90239
90390
|
default:
|
|
90240
90391
|
return [];
|
|
@@ -90266,7 +90417,7 @@ async function findOpenCodeBinary(platform = process.platform, checkExists = exi
|
|
|
90266
90417
|
const candidates = getCommandCandidates2(platform);
|
|
90267
90418
|
for (const entry of pathEnv.split(delimiter3).filter(Boolean)) {
|
|
90268
90419
|
for (const command of candidates) {
|
|
90269
|
-
const fullPath =
|
|
90420
|
+
const fullPath = join66(entry, command);
|
|
90270
90421
|
if (checkExists(fullPath) && isExecutable2(fullPath)) {
|
|
90271
90422
|
return { binary: command, path: fullPath };
|
|
90272
90423
|
}
|
|
@@ -90408,22 +90559,22 @@ init_package_json_locator();
|
|
|
90408
90559
|
import { existsSync as existsSync50, readFileSync as readFileSync32, readdirSync as readdirSync8 } from "node:fs";
|
|
90409
90560
|
import { createRequire as createRequire3 } from "node:module";
|
|
90410
90561
|
import { homedir as homedir14 } from "node:os";
|
|
90411
|
-
import { join as
|
|
90562
|
+
import { join as join67 } from "node:path";
|
|
90412
90563
|
import { fileURLToPath as fileURLToPath5 } from "node:url";
|
|
90413
90564
|
init_shared();
|
|
90414
90565
|
function getPlatformDefaultCacheDir(platform = process.platform) {
|
|
90415
90566
|
if (platform === "darwin")
|
|
90416
|
-
return
|
|
90567
|
+
return join67(homedir14(), "Library", "Caches");
|
|
90417
90568
|
if (platform === "win32")
|
|
90418
|
-
return process.env.LOCALAPPDATA ??
|
|
90419
|
-
return
|
|
90569
|
+
return process.env.LOCALAPPDATA ?? join67(homedir14(), "AppData", "Local");
|
|
90570
|
+
return join67(homedir14(), ".cache");
|
|
90420
90571
|
}
|
|
90421
90572
|
function resolveOpenCodeCacheDir() {
|
|
90422
90573
|
const xdgCacheHome = process.env.XDG_CACHE_HOME;
|
|
90423
90574
|
if (xdgCacheHome)
|
|
90424
|
-
return
|
|
90575
|
+
return join67(xdgCacheHome, "opencode");
|
|
90425
90576
|
const fromShared = getOpenCodeCacheDir();
|
|
90426
|
-
const platformDefault =
|
|
90577
|
+
const platformDefault = join67(getPlatformDefaultCacheDir(), "opencode");
|
|
90427
90578
|
if (existsSync50(fromShared) || !existsSync50(platformDefault))
|
|
90428
90579
|
return fromShared;
|
|
90429
90580
|
return platformDefault;
|
|
@@ -90455,11 +90606,11 @@ function normalizeVersion(value) {
|
|
|
90455
90606
|
function createPackageCandidates(rootDir) {
|
|
90456
90607
|
return ACCEPTED_PACKAGE_NAMES.map((packageName) => ({
|
|
90457
90608
|
packageName,
|
|
90458
|
-
installedPackagePath:
|
|
90609
|
+
installedPackagePath: join67(rootDir, "node_modules", packageName, "package.json")
|
|
90459
90610
|
}));
|
|
90460
90611
|
}
|
|
90461
90612
|
function createTaggedInstallCandidates(rootDir) {
|
|
90462
|
-
const packagesDir =
|
|
90613
|
+
const packagesDir = join67(rootDir, "packages");
|
|
90463
90614
|
if (!existsSync50(packagesDir))
|
|
90464
90615
|
return [];
|
|
90465
90616
|
const candidates = [];
|
|
@@ -90467,14 +90618,14 @@ function createTaggedInstallCandidates(rootDir) {
|
|
|
90467
90618
|
const packageName = ACCEPTED_PACKAGE_NAMES.find((name) => entryName.startsWith(`${name}@`));
|
|
90468
90619
|
if (packageName === undefined)
|
|
90469
90620
|
continue;
|
|
90470
|
-
const installDir =
|
|
90621
|
+
const installDir = join67(packagesDir, entryName);
|
|
90471
90622
|
candidates.push({
|
|
90472
90623
|
cacheDir: installDir,
|
|
90473
|
-
cachePackagePath:
|
|
90624
|
+
cachePackagePath: join67(installDir, "package.json"),
|
|
90474
90625
|
packageCandidates: [
|
|
90475
90626
|
{
|
|
90476
90627
|
packageName,
|
|
90477
|
-
installedPackagePath:
|
|
90628
|
+
installedPackagePath: join67(installDir, "node_modules", packageName, "package.json")
|
|
90478
90629
|
}
|
|
90479
90630
|
]
|
|
90480
90631
|
});
|
|
@@ -90519,13 +90670,13 @@ function getLoadedPluginVersion() {
|
|
|
90519
90670
|
const candidates = [
|
|
90520
90671
|
{
|
|
90521
90672
|
cacheDir: configDir,
|
|
90522
|
-
cachePackagePath:
|
|
90673
|
+
cachePackagePath: join67(configDir, "package.json"),
|
|
90523
90674
|
packageCandidates: createPackageCandidates(configDir)
|
|
90524
90675
|
},
|
|
90525
90676
|
...createTaggedInstallCandidates(configDir),
|
|
90526
90677
|
{
|
|
90527
90678
|
cacheDir,
|
|
90528
|
-
cachePackagePath:
|
|
90679
|
+
cachePackagePath: join67(cacheDir, "package.json"),
|
|
90529
90680
|
packageCandidates: createPackageCandidates(cacheDir)
|
|
90530
90681
|
},
|
|
90531
90682
|
...createTaggedInstallCandidates(cacheDir)
|
|
@@ -90828,18 +90979,18 @@ function validatePluginConfig(directory) {
|
|
|
90828
90979
|
init_shared();
|
|
90829
90980
|
import { existsSync as existsSync52, readFileSync as readFileSync35 } from "node:fs";
|
|
90830
90981
|
import { homedir as homedir16 } from "node:os";
|
|
90831
|
-
import { join as
|
|
90982
|
+
import { join as join68 } from "node:path";
|
|
90832
90983
|
function getUserConfigDir2() {
|
|
90833
90984
|
const xdgConfig = process.env.XDG_CONFIG_HOME;
|
|
90834
90985
|
if (xdgConfig)
|
|
90835
|
-
return
|
|
90836
|
-
return
|
|
90986
|
+
return join68(xdgConfig, "opencode");
|
|
90987
|
+
return join68(homedir16(), ".config", "opencode");
|
|
90837
90988
|
}
|
|
90838
90989
|
function loadCustomProviderNames() {
|
|
90839
90990
|
const configDir = getUserConfigDir2();
|
|
90840
90991
|
const candidatePaths = [
|
|
90841
|
-
|
|
90842
|
-
|
|
90992
|
+
join68(configDir, "opencode.json"),
|
|
90993
|
+
join68(configDir, "opencode.jsonc")
|
|
90843
90994
|
];
|
|
90844
90995
|
for (const configPath of candidatePaths) {
|
|
90845
90996
|
if (!existsSync52(configPath))
|
|
@@ -90860,7 +91011,7 @@ function loadCustomProviderNames() {
|
|
|
90860
91011
|
return [];
|
|
90861
91012
|
}
|
|
90862
91013
|
function loadAvailableModelsFromCache() {
|
|
90863
|
-
const cacheFile =
|
|
91014
|
+
const cacheFile = join68(getOpenCodeCacheDir(), "models.json");
|
|
90864
91015
|
const customProviders = loadCustomProviderNames();
|
|
90865
91016
|
if (!existsSync52(cacheFile)) {
|
|
90866
91017
|
if (customProviders.length > 0) {
|
|
@@ -90897,8 +91048,8 @@ init_model_capabilities2();
|
|
|
90897
91048
|
init_shared();
|
|
90898
91049
|
init_plugin_identity();
|
|
90899
91050
|
import { readFileSync as readFileSync36 } from "node:fs";
|
|
90900
|
-
import { join as
|
|
90901
|
-
var PROJECT_CONFIG_DIR =
|
|
91051
|
+
import { join as join69 } from "node:path";
|
|
91052
|
+
var PROJECT_CONFIG_DIR = join69(process.cwd(), ".opencode");
|
|
90902
91053
|
function loadOmoConfig() {
|
|
90903
91054
|
const projectDetected = detectPluginConfigFile(PROJECT_CONFIG_DIR, {
|
|
90904
91055
|
basenames: [CONFIG_BASENAME],
|
|
@@ -90936,7 +91087,7 @@ function loadOmoConfig() {
|
|
|
90936
91087
|
|
|
90937
91088
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-details.ts
|
|
90938
91089
|
init_shared();
|
|
90939
|
-
import { join as
|
|
91090
|
+
import { join as join70 } from "node:path";
|
|
90940
91091
|
|
|
90941
91092
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-variant.ts
|
|
90942
91093
|
function formatModelWithVariant(model, variant) {
|
|
@@ -90978,7 +91129,7 @@ function formatCapabilityResolutionLabel(mode) {
|
|
|
90978
91129
|
}
|
|
90979
91130
|
function buildModelResolutionDetails(options) {
|
|
90980
91131
|
const details = [];
|
|
90981
|
-
const cacheFile =
|
|
91132
|
+
const cacheFile = join70(getOpenCodeCacheDir(), "models.json");
|
|
90982
91133
|
details.push("═══ Available Models (from cache) ═══");
|
|
90983
91134
|
details.push("");
|
|
90984
91135
|
if (options.available.cacheExists) {
|
|
@@ -91257,25 +91408,25 @@ init_src();
|
|
|
91257
91408
|
import { existsSync as existsSync53 } from "node:fs";
|
|
91258
91409
|
import { createRequire as createRequire4 } from "node:module";
|
|
91259
91410
|
import { homedir as homedir18 } from "node:os";
|
|
91260
|
-
import { dirname as dirname25, join as
|
|
91411
|
+
import { dirname as dirname25, join as join72 } from "node:path";
|
|
91261
91412
|
|
|
91262
91413
|
// packages/omo-opencode/src/hooks/comment-checker/downloader.ts
|
|
91263
|
-
import { join as
|
|
91414
|
+
import { join as join71 } from "path";
|
|
91264
91415
|
import { homedir as homedir17, tmpdir as tmpdir3 } from "os";
|
|
91265
91416
|
init_binary_downloader();
|
|
91266
91417
|
init_logger2();
|
|
91267
91418
|
init_plugin_identity();
|
|
91268
91419
|
var DEBUG = process.env.COMMENT_CHECKER_DEBUG === "1";
|
|
91269
|
-
var DEBUG_FILE =
|
|
91420
|
+
var DEBUG_FILE = join71(tmpdir3(), "comment-checker-debug.log");
|
|
91270
91421
|
function getCacheDir2() {
|
|
91271
91422
|
if (process.platform === "win32") {
|
|
91272
91423
|
const localAppData = process.env.LOCALAPPDATA || process.env.APPDATA;
|
|
91273
|
-
const base2 = localAppData ||
|
|
91274
|
-
return
|
|
91424
|
+
const base2 = localAppData || join71(homedir17(), "AppData", "Local");
|
|
91425
|
+
return join71(base2, CACHE_DIR_NAME, "bin");
|
|
91275
91426
|
}
|
|
91276
91427
|
const xdgCache = process.env.XDG_CACHE_HOME;
|
|
91277
|
-
const base = xdgCache ||
|
|
91278
|
-
return
|
|
91428
|
+
const base = xdgCache || join71(homedir17(), ".cache");
|
|
91429
|
+
return join71(base, CACHE_DIR_NAME, "bin");
|
|
91279
91430
|
}
|
|
91280
91431
|
function getBinaryName() {
|
|
91281
91432
|
return process.platform === "win32" ? "comment-checker.exe" : "comment-checker";
|
|
@@ -91325,7 +91476,7 @@ async function getBinaryVersion(binary) {
|
|
|
91325
91476
|
}
|
|
91326
91477
|
}
|
|
91327
91478
|
async function checkAstGrepCli() {
|
|
91328
|
-
const runtimeDir = astGrepRuntimeDir(
|
|
91479
|
+
const runtimeDir = astGrepRuntimeDir(join72(homedir18(), ".omo"));
|
|
91329
91480
|
const sgPath = findSgBinarySync({ runtimeDir });
|
|
91330
91481
|
if (sgPath === null) {
|
|
91331
91482
|
return {
|
|
@@ -91355,10 +91506,10 @@ function findCommentCheckerPackageBinary(baseDirOverride, resolvePackageJsonPath
|
|
|
91355
91506
|
const platformKey = `${process.platform}-${process.arch === "x64" ? "x64" : process.arch}`;
|
|
91356
91507
|
try {
|
|
91357
91508
|
const packageDir = baseDirOverride ?? dirname25(resolvePackageJsonPath());
|
|
91358
|
-
const vendorPath =
|
|
91509
|
+
const vendorPath = join72(packageDir, "vendor", platformKey, binaryName);
|
|
91359
91510
|
if (existsSync53(vendorPath))
|
|
91360
91511
|
return vendorPath;
|
|
91361
|
-
const binPath =
|
|
91512
|
+
const binPath = join72(packageDir, "bin", binaryName);
|
|
91362
91513
|
if (existsSync53(binPath))
|
|
91363
91514
|
return binPath;
|
|
91364
91515
|
} catch (error51) {
|
|
@@ -91504,7 +91655,7 @@ async function getGhCliInfo(dependencies = {}) {
|
|
|
91504
91655
|
|
|
91505
91656
|
// packages/omo-opencode/src/cli/doctor/checks/tools-lsp.ts
|
|
91506
91657
|
import { readFileSync as readFileSync37 } from "node:fs";
|
|
91507
|
-
import { join as
|
|
91658
|
+
import { join as join73 } from "node:path";
|
|
91508
91659
|
|
|
91509
91660
|
// packages/omo-opencode/src/mcp/lsp.ts
|
|
91510
91661
|
import { existsSync as existsSync54 } from "node:fs";
|
|
@@ -91711,7 +91862,7 @@ function readOmoConfig(configDirectory) {
|
|
|
91711
91862
|
}
|
|
91712
91863
|
function isLspMcpDisabled(options) {
|
|
91713
91864
|
const userConfigDirectory = options.configDirectory ?? getOpenCodeConfigDir({ binary: "opencode" });
|
|
91714
|
-
const projectConfigDirectory =
|
|
91865
|
+
const projectConfigDirectory = join73(options.cwd ?? process.cwd(), ".opencode");
|
|
91715
91866
|
const userConfig = readOmoConfig(userConfigDirectory);
|
|
91716
91867
|
const projectConfig = readOmoConfig(projectConfigDirectory);
|
|
91717
91868
|
const disabledMcps = new Set([
|
|
@@ -91732,13 +91883,13 @@ function getInstalledLspServers(options = {}) {
|
|
|
91732
91883
|
init_shared();
|
|
91733
91884
|
import { existsSync as existsSync55, readFileSync as readFileSync38 } from "node:fs";
|
|
91734
91885
|
import { homedir as homedir19 } from "node:os";
|
|
91735
|
-
import { join as
|
|
91886
|
+
import { join as join74 } from "node:path";
|
|
91736
91887
|
var BUILTIN_MCP_SERVERS = ["websearch", "context7", "grep_app", "lsp"];
|
|
91737
91888
|
function getMcpConfigPaths() {
|
|
91738
91889
|
return [
|
|
91739
|
-
|
|
91740
|
-
|
|
91741
|
-
|
|
91890
|
+
join74(homedir19(), ".claude", ".mcp.json"),
|
|
91891
|
+
join74(process.cwd(), ".mcp.json"),
|
|
91892
|
+
join74(process.cwd(), ".claude", ".mcp.json")
|
|
91742
91893
|
];
|
|
91743
91894
|
}
|
|
91744
91895
|
function loadUserMcpConfig() {
|
|
@@ -91983,9 +92134,9 @@ async function pathExists(dir) {
|
|
|
91983
92134
|
// packages/omo-opencode/src/cli/doctor/checks/codex.ts
|
|
91984
92135
|
init_src();
|
|
91985
92136
|
import { existsSync as existsSync56 } from "node:fs";
|
|
91986
|
-
import { lstat as lstat11, readdir as readdir8, readFile as
|
|
92137
|
+
import { lstat as lstat11, readdir as readdir8, readFile as readFile20 } from "node:fs/promises";
|
|
91987
92138
|
import { homedir as homedir21 } from "node:os";
|
|
91988
|
-
import { basename as basename12, join as
|
|
92139
|
+
import { basename as basename12, join as join75, resolve as resolve19 } from "node:path";
|
|
91989
92140
|
// packages/omo-opencode/package.json
|
|
91990
92141
|
var package_default3 = {
|
|
91991
92142
|
name: "@oh-my-opencode/omo-opencode",
|
|
@@ -92041,13 +92192,13 @@ var CODEX_BIN_NAMES = [
|
|
|
92041
92192
|
"omo-git-bash-hook"
|
|
92042
92193
|
];
|
|
92043
92194
|
async function gatherCodexSummary(deps = {}) {
|
|
92044
|
-
const codexHome = resolve19(deps.codexHome ?? process.env.CODEX_HOME ??
|
|
92195
|
+
const codexHome = resolve19(deps.codexHome ?? process.env.CODEX_HOME ?? join75(homedir21(), ".codex"));
|
|
92045
92196
|
const binDir = resolveCodexInstallerBinDir({ binDir: deps.binDir, codexHome, env: process.env });
|
|
92046
92197
|
const detection = await (deps.detectCodexInstallation ?? detectCodexInstallation)();
|
|
92047
92198
|
const pluginRoot = await resolveInstalledPluginRoot(codexHome);
|
|
92048
|
-
const manifest = pluginRoot === null ? null : await readJson(
|
|
92049
|
-
const installSnapshot = pluginRoot === null ? null : await readJson(
|
|
92050
|
-
const configPath =
|
|
92199
|
+
const manifest = pluginRoot === null ? null : await readJson(join75(pluginRoot, ".codex-plugin", "plugin.json"));
|
|
92200
|
+
const installSnapshot = pluginRoot === null ? null : await readJson(join75(pluginRoot, "lazycodex-install.json"));
|
|
92201
|
+
const configPath = join75(codexHome, "config.toml");
|
|
92051
92202
|
const pluginVersion = stringField(manifest, "version");
|
|
92052
92203
|
return {
|
|
92053
92204
|
codexPath: detection.found && "path" in detection ? detection.path : null,
|
|
@@ -92103,7 +92254,7 @@ function buildCodexIssues(summary) {
|
|
|
92103
92254
|
if (summary.pluginRoot === null) {
|
|
92104
92255
|
issues.push({
|
|
92105
92256
|
title: "OMO Codex plugin is not installed",
|
|
92106
|
-
description: `Expected cached plugin at ${
|
|
92257
|
+
description: `Expected cached plugin at ${join75("plugins", "cache", MARKETPLACE_NAME, PLUGIN_NAME2, DEFAULT_PLUGIN_VERSION)} under CODEX_HOME.`,
|
|
92107
92258
|
fix: "Run: npx lazycodex-ai install",
|
|
92108
92259
|
severity: "error",
|
|
92109
92260
|
affects: ["plugin loading"]
|
|
@@ -92156,18 +92307,18 @@ function buildCodexIssues(summary) {
|
|
|
92156
92307
|
return issues;
|
|
92157
92308
|
}
|
|
92158
92309
|
async function resolveInstalledPluginRoot(codexHome) {
|
|
92159
|
-
const pluginRoot =
|
|
92310
|
+
const pluginRoot = join75(codexHome, "plugins", "cache", MARKETPLACE_NAME, PLUGIN_NAME2);
|
|
92160
92311
|
if (!existsSync56(pluginRoot))
|
|
92161
92312
|
return null;
|
|
92162
92313
|
const versions2 = await readdir8(pluginRoot, { withFileTypes: true });
|
|
92163
92314
|
const candidates = versions2.filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort(compareVersionsDescending);
|
|
92164
|
-
return candidates.length === 0 ? null :
|
|
92315
|
+
return candidates.length === 0 ? null : join75(pluginRoot, candidates[0] ?? DEFAULT_PLUGIN_VERSION);
|
|
92165
92316
|
}
|
|
92166
92317
|
async function readCodexConfigSummary(configPath) {
|
|
92167
92318
|
if (!existsSync56(configPath)) {
|
|
92168
92319
|
return { exists: false, marketplaceConfigured: false, pluginEnabled: false, pluginsFeatureEnabled: false, pluginHooksFeatureEnabled: false };
|
|
92169
92320
|
}
|
|
92170
|
-
const content = await
|
|
92321
|
+
const content = await readFile20(configPath, "utf8");
|
|
92171
92322
|
return {
|
|
92172
92323
|
exists: true,
|
|
92173
92324
|
marketplaceConfigured: content.includes("[marketplaces.sisyphuslabs]"),
|
|
@@ -92179,13 +92330,13 @@ async function readCodexConfigSummary(configPath) {
|
|
|
92179
92330
|
async function readLinkedBins(binDir) {
|
|
92180
92331
|
const linked = [];
|
|
92181
92332
|
for (const name of CODEX_BIN_NAMES) {
|
|
92182
|
-
if (await pathExists2(
|
|
92333
|
+
if (await pathExists2(join75(binDir, process.platform === "win32" ? `${name}.cmd` : name)))
|
|
92183
92334
|
linked.push(name);
|
|
92184
92335
|
}
|
|
92185
92336
|
return linked;
|
|
92186
92337
|
}
|
|
92187
92338
|
async function readLinkedAgents(codexHome) {
|
|
92188
|
-
const agentsDir =
|
|
92339
|
+
const agentsDir = join75(codexHome, "agents");
|
|
92189
92340
|
if (!existsSync56(agentsDir))
|
|
92190
92341
|
return [];
|
|
92191
92342
|
const entries = await readdir8(agentsDir, { withFileTypes: true });
|
|
@@ -92193,7 +92344,7 @@ async function readLinkedAgents(codexHome) {
|
|
|
92193
92344
|
}
|
|
92194
92345
|
async function readJson(path16) {
|
|
92195
92346
|
try {
|
|
92196
|
-
const parsed = JSON.parse(await
|
|
92347
|
+
const parsed = JSON.parse(await readFile20(path16, "utf8"));
|
|
92197
92348
|
return isPlainRecord(parsed) ? parsed : null;
|
|
92198
92349
|
} catch (error51) {
|
|
92199
92350
|
if (error51 instanceof Error)
|
|
@@ -92243,9 +92394,9 @@ async function pathExists2(path16) {
|
|
|
92243
92394
|
|
|
92244
92395
|
// packages/omo-opencode/src/cli/doctor/checks/codex-components.ts
|
|
92245
92396
|
init_src();
|
|
92246
|
-
import { readdir as readdir9, readFile as
|
|
92397
|
+
import { readdir as readdir9, readFile as readFile21, stat as stat4 } from "node:fs/promises";
|
|
92247
92398
|
import { homedir as homedir22 } from "node:os";
|
|
92248
|
-
import { dirname as dirname27, join as
|
|
92399
|
+
import { dirname as dirname27, join as join76, relative as relative9, resolve as resolve20, sep as sep9 } from "node:path";
|
|
92249
92400
|
var CODEX_COMPONENTS_CHECK_ID = "codex-components";
|
|
92250
92401
|
var CODEX_COMPONENTS_CHECK_NAME = "codex-components";
|
|
92251
92402
|
var PLUGIN_DATA_DIR_NAME = "omo-sisyphuslabs";
|
|
@@ -92255,7 +92406,7 @@ async function checkCodexComponents(deps = {}) {
|
|
|
92255
92406
|
const env3 = deps.env ?? process.env;
|
|
92256
92407
|
const platform = deps.platform ?? process.platform;
|
|
92257
92408
|
const arch = deps.arch ?? process.arch;
|
|
92258
|
-
const codexHome = resolve20(deps.codexHome ?? env3["CODEX_HOME"] ??
|
|
92409
|
+
const codexHome = resolve20(deps.codexHome ?? env3["CODEX_HOME"] ?? join76(homedir22(), ".codex"));
|
|
92259
92410
|
const summary = await gatherCodexSummary({ ...deps, codexHome });
|
|
92260
92411
|
if (summary.pluginRoot === null) {
|
|
92261
92412
|
return {
|
|
@@ -92280,7 +92431,7 @@ async function checkCodexComponents(deps = {}) {
|
|
|
92280
92431
|
});
|
|
92281
92432
|
}
|
|
92282
92433
|
const runtimeSgDir = runtimeSgDirectory(codexHome, platform, arch);
|
|
92283
|
-
const runtimeSgPath =
|
|
92434
|
+
const runtimeSgPath = join76(runtimeSgDir, sgBinaryName(platform));
|
|
92284
92435
|
const sg = findSgBinarySync({
|
|
92285
92436
|
arch,
|
|
92286
92437
|
env: env3,
|
|
@@ -92364,7 +92515,7 @@ function recordBrokenTarget(broken, classified, origin) {
|
|
|
92364
92515
|
async function classifyBundleTarget(bundleRoot, baseRoot, relativePath, allowEscape) {
|
|
92365
92516
|
const targetPath = resolve20(baseRoot, relativePath);
|
|
92366
92517
|
const bundleRootPath = resolve20(bundleRoot);
|
|
92367
|
-
const bundleRootPrefix = bundleRootPath.endsWith(
|
|
92518
|
+
const bundleRootPrefix = bundleRootPath.endsWith(sep9) ? bundleRootPath : `${bundleRootPath}${sep9}`;
|
|
92368
92519
|
if (targetPath !== bundleRootPath && !targetPath.startsWith(bundleRootPrefix)) {
|
|
92369
92520
|
if (allowEscape)
|
|
92370
92521
|
return null;
|
|
@@ -92379,7 +92530,7 @@ async function classifyBundleTarget(bundleRoot, baseRoot, relativePath, allowEsc
|
|
|
92379
92530
|
}
|
|
92380
92531
|
async function findHookManifestPaths(root) {
|
|
92381
92532
|
const paths2 = await findManifestPaths(root, "hooks.json");
|
|
92382
|
-
return paths2.filter((path16) => dirname27(path16).endsWith(`${
|
|
92533
|
+
return paths2.filter((path16) => dirname27(path16).endsWith(`${sep9}hooks`));
|
|
92383
92534
|
}
|
|
92384
92535
|
async function findManifestPaths(root, manifestName) {
|
|
92385
92536
|
let entries;
|
|
@@ -92392,7 +92543,7 @@ async function findManifestPaths(root, manifestName) {
|
|
|
92392
92543
|
for (const entry of entries) {
|
|
92393
92544
|
if (entry.name === "node_modules" || entry.name === ".git")
|
|
92394
92545
|
continue;
|
|
92395
|
-
const entryPath =
|
|
92546
|
+
const entryPath = join76(root, entry.name);
|
|
92396
92547
|
if (entry.isDirectory()) {
|
|
92397
92548
|
paths2.push(...await findManifestPaths(entryPath, manifestName));
|
|
92398
92549
|
continue;
|
|
@@ -92435,18 +92586,18 @@ function isPluginRuntimePathArg(arg) {
|
|
|
92435
92586
|
return (arg.startsWith("./") || arg.startsWith("../")) && arg.endsWith("/dist/cli.js");
|
|
92436
92587
|
}
|
|
92437
92588
|
function runtimeSgDirectory(codexHome, platform, arch) {
|
|
92438
|
-
return
|
|
92589
|
+
return join76(codexHome, "runtime", "ast-grep", runtimeSlug(platform, arch));
|
|
92439
92590
|
}
|
|
92440
92591
|
function describeSgSource(sgPath, env3, runtimeSgDir, platform) {
|
|
92441
92592
|
const override = env3[SG_PATH_ENV_KEY]?.trim();
|
|
92442
92593
|
if (override !== undefined && override.length > 0 && sgPath === override)
|
|
92443
92594
|
return `env override ${SG_PATH_ENV_KEY}`;
|
|
92444
|
-
if (sgPath ===
|
|
92595
|
+
if (sgPath === join76(runtimeSgDir, sgBinaryName(platform)))
|
|
92445
92596
|
return "runtime dir";
|
|
92446
92597
|
return "PATH";
|
|
92447
92598
|
}
|
|
92448
92599
|
async function readBootstrapStateSummary(codexHome) {
|
|
92449
|
-
const statePath =
|
|
92600
|
+
const statePath = join76(codexHome, "plugins", "data", PLUGIN_DATA_DIR_NAME, "bootstrap", "state.json");
|
|
92450
92601
|
const raw = await readJson2(statePath);
|
|
92451
92602
|
if (raw === null)
|
|
92452
92603
|
return null;
|
|
@@ -92495,7 +92646,7 @@ function degradedDetailLines(entries) {
|
|
|
92495
92646
|
}
|
|
92496
92647
|
async function readJson2(path16) {
|
|
92497
92648
|
try {
|
|
92498
|
-
const parsed = JSON.parse(await
|
|
92649
|
+
const parsed = JSON.parse(await readFile21(path16, "utf8"));
|
|
92499
92650
|
return isRecord5(parsed) ? parsed : null;
|
|
92500
92651
|
} catch (error51) {
|
|
92501
92652
|
if (error51 instanceof Error)
|
|
@@ -92523,17 +92674,17 @@ function isRecord5(value) {
|
|
|
92523
92674
|
|
|
92524
92675
|
// packages/omo-opencode/src/cli/doctor/checks/codex-runtime-wrapper.ts
|
|
92525
92676
|
import { existsSync as existsSync57 } from "node:fs";
|
|
92526
|
-
import { readFile as
|
|
92677
|
+
import { readFile as readFile22 } from "node:fs/promises";
|
|
92527
92678
|
import { homedir as homedir23 } from "node:os";
|
|
92528
|
-
import { join as
|
|
92679
|
+
import { join as join77, resolve as resolve21 } from "node:path";
|
|
92529
92680
|
var RUNTIME_WRAPPER_MARKER2 = "OMO_GENERATED_RUNTIME_WRAPPER";
|
|
92530
92681
|
var CHECK_NAME = "codex-runtime-wrapper";
|
|
92531
92682
|
var REINSTALL_COMMAND = "npx --yes lazycodex-ai@latest install --no-tui";
|
|
92532
92683
|
async function checkCodexRuntimeWrapper(deps = {}) {
|
|
92533
|
-
const codexHome = resolve21(deps.codexHome ?? process.env.CODEX_HOME ??
|
|
92684
|
+
const codexHome = resolve21(deps.codexHome ?? process.env.CODEX_HOME ?? join77(homedir23(), ".codex"));
|
|
92534
92685
|
const binDir = resolveCodexInstallerBinDir({ binDir: deps.binDir, codexHome, env: process.env });
|
|
92535
92686
|
const platform = deps.platform ?? process.platform;
|
|
92536
|
-
const wrapperPath =
|
|
92687
|
+
const wrapperPath = join77(binDir, platform === "win32" ? "omo.cmd" : "omo");
|
|
92537
92688
|
const wrapper = await readRuntimeWrapper(wrapperPath);
|
|
92538
92689
|
const issues = [];
|
|
92539
92690
|
if (wrapper?.includes(RUNTIME_WRAPPER_MARKER2) === true) {
|
|
@@ -92558,7 +92709,7 @@ async function checkCodexRuntimeWrapper(deps = {}) {
|
|
|
92558
92709
|
}
|
|
92559
92710
|
async function readRuntimeWrapper(path16) {
|
|
92560
92711
|
try {
|
|
92561
|
-
return await
|
|
92712
|
+
return await readFile22(path16, "utf8");
|
|
92562
92713
|
} catch (error51) {
|
|
92563
92714
|
if (error51 instanceof Error)
|
|
92564
92715
|
return null;
|
|
@@ -93038,12 +93189,12 @@ import {
|
|
|
93038
93189
|
unlinkSync as unlinkSync8,
|
|
93039
93190
|
writeFileSync as writeFileSync11
|
|
93040
93191
|
} from "node:fs";
|
|
93041
|
-
import { basename as basename13, dirname as dirname28, join as
|
|
93192
|
+
import { basename as basename13, dirname as dirname28, join as join80 } from "node:path";
|
|
93042
93193
|
|
|
93043
93194
|
// packages/mcp-client-core/src/config-dir.ts
|
|
93044
93195
|
import { existsSync as existsSync58, realpathSync as realpathSync8 } from "node:fs";
|
|
93045
93196
|
import { homedir as homedir24 } from "node:os";
|
|
93046
|
-
import { join as
|
|
93197
|
+
import { join as join78, resolve as resolve22 } from "node:path";
|
|
93047
93198
|
function resolveConfigPath2(pathValue) {
|
|
93048
93199
|
const resolvedPath = resolve22(pathValue);
|
|
93049
93200
|
if (!existsSync58(resolvedPath))
|
|
@@ -93061,13 +93212,13 @@ function getOpenCodeCliConfigDir(env3 = process.env) {
|
|
|
93061
93212
|
if (customConfigDir) {
|
|
93062
93213
|
return resolveConfigPath2(customConfigDir);
|
|
93063
93214
|
}
|
|
93064
|
-
const xdgConfigDir = env3["XDG_CONFIG_HOME"]?.trim() ||
|
|
93065
|
-
return resolveConfigPath2(
|
|
93215
|
+
const xdgConfigDir = env3["XDG_CONFIG_HOME"]?.trim() || join78(homedir24(), ".config");
|
|
93216
|
+
return resolveConfigPath2(join78(xdgConfigDir, "opencode"));
|
|
93066
93217
|
}
|
|
93067
93218
|
|
|
93068
93219
|
// packages/mcp-client-core/src/mcp-oauth/storage-index.ts
|
|
93069
93220
|
import { chmodSync as chmodSync3, existsSync as existsSync59, readFileSync as readFileSync40, renameSync as renameSync6, writeFileSync as writeFileSync10 } from "node:fs";
|
|
93070
|
-
import { join as
|
|
93221
|
+
import { join as join79 } from "node:path";
|
|
93071
93222
|
var INDEX_FILE_NAME = "index.json";
|
|
93072
93223
|
function isTokenIndex(value) {
|
|
93073
93224
|
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
@@ -93075,7 +93226,7 @@ function isTokenIndex(value) {
|
|
|
93075
93226
|
return Object.values(value).every((entry) => typeof entry === "string");
|
|
93076
93227
|
}
|
|
93077
93228
|
function getIndexPath(storageDir) {
|
|
93078
|
-
return
|
|
93229
|
+
return join79(storageDir, INDEX_FILE_NAME);
|
|
93079
93230
|
}
|
|
93080
93231
|
function readTokenIndex(storageDir) {
|
|
93081
93232
|
const indexPath = getIndexPath(storageDir);
|
|
@@ -93119,16 +93270,16 @@ function deleteTokenIndexEntry(storageDir, hash2) {
|
|
|
93119
93270
|
var STORAGE_DIR_NAME = "mcp-oauth";
|
|
93120
93271
|
var LEGACY_STORAGE_FILE_NAME = "mcp-oauth.json";
|
|
93121
93272
|
function getMcpOauthStorageDir() {
|
|
93122
|
-
return
|
|
93273
|
+
return join80(getOpenCodeCliConfigDir(), STORAGE_DIR_NAME);
|
|
93123
93274
|
}
|
|
93124
93275
|
function getMcpOauthServerHash(serverHost, resource) {
|
|
93125
93276
|
return createHash4("sha256").update(buildKey(serverHost, resource)).digest("hex").slice(0, 32);
|
|
93126
93277
|
}
|
|
93127
93278
|
function getMcpOauthStoragePath(serverHost, resource) {
|
|
93128
|
-
return
|
|
93279
|
+
return join80(getMcpOauthStorageDir(), `${getMcpOauthServerHash(serverHost, resource)}.json`);
|
|
93129
93280
|
}
|
|
93130
93281
|
function getLegacyStoragePath() {
|
|
93131
|
-
return
|
|
93282
|
+
return join80(getOpenCodeCliConfigDir(), LEGACY_STORAGE_FILE_NAME);
|
|
93132
93283
|
}
|
|
93133
93284
|
function normalizeHost2(serverHost) {
|
|
93134
93285
|
let host = serverHost.trim();
|
|
@@ -93307,7 +93458,7 @@ function listTokensByHost(serverHost) {
|
|
|
93307
93458
|
for (const [hash2, indexedKey] of Object.entries(index)) {
|
|
93308
93459
|
if (!indexedKey.startsWith(prefix))
|
|
93309
93460
|
continue;
|
|
93310
|
-
const indexedToken = readTokenFile(
|
|
93461
|
+
const indexedToken = readTokenFile(join80(getMcpOauthStorageDir(), `${hash2}.json`));
|
|
93311
93462
|
if (indexedToken)
|
|
93312
93463
|
result[indexedKey] = indexedToken;
|
|
93313
93464
|
}
|
|
@@ -93322,7 +93473,7 @@ function listAllTokens() {
|
|
|
93322
93473
|
for (const entry of readdirSync9(dir, { withFileTypes: true })) {
|
|
93323
93474
|
if (!entry.isFile() || !entry.name.endsWith(".json") || entry.name === "index.json")
|
|
93324
93475
|
continue;
|
|
93325
|
-
const token = readTokenFile(
|
|
93476
|
+
const token = readTokenFile(join80(dir, entry.name));
|
|
93326
93477
|
const hash2 = basename13(entry.name, ".json");
|
|
93327
93478
|
if (token)
|
|
93328
93479
|
result[index[hash2] ?? hash2] = token;
|
|
@@ -94143,7 +94294,7 @@ import { isAbsolute as isAbsolute10, resolve as resolve23 } from "node:path";
|
|
|
94143
94294
|
init_src();
|
|
94144
94295
|
import { existsSync as existsSync63 } from "node:fs";
|
|
94145
94296
|
import { homedir as homedir26 } from "node:os";
|
|
94146
|
-
import { join as
|
|
94297
|
+
import { join as join81 } from "node:path";
|
|
94147
94298
|
|
|
94148
94299
|
// packages/omo-opencode/src/cli/sparkshell-appserver-websocket.ts
|
|
94149
94300
|
import { randomBytes as randomBytes3 } from "node:crypto";
|
|
@@ -94304,8 +94455,8 @@ function resolveAppServerSocketPath(env3) {
|
|
|
94304
94455
|
if (explicit) {
|
|
94305
94456
|
return explicit;
|
|
94306
94457
|
}
|
|
94307
|
-
const codexHome = env3["CODEX_HOME"]?.trim() ||
|
|
94308
|
-
return
|
|
94458
|
+
const codexHome = env3["CODEX_HOME"]?.trim() || join81(homedir26(), ".codex");
|
|
94459
|
+
return join81(codexHome, "app-server-control", "app-server-control.sock");
|
|
94309
94460
|
}
|
|
94310
94461
|
function resolveAppServerTimeoutMs(env3) {
|
|
94311
94462
|
const parsed = Number.parseInt(env3["OMO_SPARKSHELL_APP_SERVER_TIMEOUT_MS"]?.trim() ?? "", 10);
|
|
@@ -94877,7 +95028,7 @@ function isLowSurrogate(codeUnit) {
|
|
|
94877
95028
|
init_src();
|
|
94878
95029
|
import { existsSync as existsSync64, readdirSync as readdirSync10, readFileSync as readFileSync42 } from "node:fs";
|
|
94879
95030
|
import { homedir as homedir27 } from "node:os";
|
|
94880
|
-
import { join as
|
|
95031
|
+
import { join as join82 } from "node:path";
|
|
94881
95032
|
var SPARKSHELL_SESSION_CONTEXT_ENV = "OMO_SPARKSHELL_SESSION_CONTEXT";
|
|
94882
95033
|
var SPARKSHELL_SESSION_ID_ENV = "OMO_SPARKSHELL_SESSION_ID";
|
|
94883
95034
|
var CODEX_THREAD_ID_ENV = "CODEX_THREAD_ID";
|
|
@@ -94893,8 +95044,8 @@ function findRolloutPath(sessionId, env3, deps = {}) {
|
|
|
94893
95044
|
const fileExists = deps.fileExists ?? existsSync64;
|
|
94894
95045
|
const listDirectory = deps.listDirectory ?? ((path16) => readdirSync10(path16));
|
|
94895
95046
|
const homeDirectory = deps.homeDirectory ?? homedir27;
|
|
94896
|
-
const codexHome = env3["CODEX_HOME"]?.trim() ||
|
|
94897
|
-
const roots = [
|
|
95047
|
+
const codexHome = env3["CODEX_HOME"]?.trim() || join82(homeDirectory(), ".codex");
|
|
95048
|
+
const roots = [join82(codexHome, "sessions"), join82(codexHome, "archived_sessions")];
|
|
94898
95049
|
const fileSuffix = `-${sessionId}.jsonl`;
|
|
94899
95050
|
const scanDay = (dayDir) => {
|
|
94900
95051
|
if (!fileExists(dayDir)) {
|
|
@@ -94902,14 +95053,14 @@ function findRolloutPath(sessionId, env3, deps = {}) {
|
|
|
94902
95053
|
}
|
|
94903
95054
|
for (const name of listSafely(listDirectory, dayDir)) {
|
|
94904
95055
|
if (name.startsWith("rollout-") && name.endsWith(fileSuffix)) {
|
|
94905
|
-
return
|
|
95056
|
+
return join82(dayDir, name);
|
|
94906
95057
|
}
|
|
94907
95058
|
}
|
|
94908
95059
|
return null;
|
|
94909
95060
|
};
|
|
94910
95061
|
for (const dayDir of uuidV7DayDirCandidates(sessionId)) {
|
|
94911
95062
|
for (const root of roots) {
|
|
94912
|
-
const found = scanDay(
|
|
95063
|
+
const found = scanDay(join82(root, dayDir));
|
|
94913
95064
|
if (found) {
|
|
94914
95065
|
return found;
|
|
94915
95066
|
}
|
|
@@ -94920,9 +95071,9 @@ function findRolloutPath(sessionId, env3, deps = {}) {
|
|
|
94920
95071
|
continue;
|
|
94921
95072
|
}
|
|
94922
95073
|
for (const year of numericNamesDescending(listSafely(listDirectory, root))) {
|
|
94923
|
-
for (const month of numericNamesDescending(listSafely(listDirectory,
|
|
94924
|
-
for (const day of numericNamesDescending(listSafely(listDirectory,
|
|
94925
|
-
const found = scanDay(
|
|
95074
|
+
for (const month of numericNamesDescending(listSafely(listDirectory, join82(root, year)))) {
|
|
95075
|
+
for (const day of numericNamesDescending(listSafely(listDirectory, join82(root, year, month)))) {
|
|
95076
|
+
const found = scanDay(join82(root, year, month, day));
|
|
94926
95077
|
if (found) {
|
|
94927
95078
|
return found;
|
|
94928
95079
|
}
|
|
@@ -95082,7 +95233,7 @@ function uuidV7DayDirCandidates(sessionId) {
|
|
|
95082
95233
|
const candidates = [];
|
|
95083
95234
|
for (const offsetDays of [0, 1, -1]) {
|
|
95084
95235
|
const date5 = new Date(ms + offsetDays * DAY_MS);
|
|
95085
|
-
candidates.push(
|
|
95236
|
+
candidates.push(join82(String(date5.getFullYear()), pad2(date5.getMonth() + 1), pad2(date5.getDate())));
|
|
95086
95237
|
}
|
|
95087
95238
|
return candidates;
|
|
95088
95239
|
}
|
|
@@ -95123,7 +95274,7 @@ function isFalsy2(value) {
|
|
|
95123
95274
|
import { spawnSync as spawnSync3 } from "node:child_process";
|
|
95124
95275
|
import { mkdtempSync, readFileSync as readFileSync43, rmSync as rmSync4 } from "node:fs";
|
|
95125
95276
|
import { tmpdir as tmpdir4 } from "node:os";
|
|
95126
|
-
import { join as
|
|
95277
|
+
import { join as join83 } from "node:path";
|
|
95127
95278
|
var SPARKSHELL_SPARK_ENV = "OMO_SPARKSHELL_SPARK";
|
|
95128
95279
|
var SPARKSHELL_SPARK_MODEL_ENV = "OMO_SPARKSHELL_SPARK_MODEL";
|
|
95129
95280
|
var SPARKSHELL_SPARK_TIMEOUT_ENV = "OMO_SPARKSHELL_SPARK_TIMEOUT_MS";
|
|
@@ -95197,8 +95348,8 @@ function buildSparkExecArgs(env3, lastMessagePath) {
|
|
|
95197
95348
|
function createDefaultSparkSummarizer(env3, cwd) {
|
|
95198
95349
|
return (request) => {
|
|
95199
95350
|
const binary = env3[SPARKSHELL_SPARK_BIN_ENV]?.trim() || "codex";
|
|
95200
|
-
const tempDir = mkdtempSync(
|
|
95201
|
-
const lastMessagePath =
|
|
95351
|
+
const tempDir = mkdtempSync(join83(tmpdir4(), "omo-sparkshell-spark-"));
|
|
95352
|
+
const lastMessagePath = join83(tempDir, "last-message.txt");
|
|
95202
95353
|
try {
|
|
95203
95354
|
const result = spawnSync3(binary, [...buildSparkExecArgs(env3, lastMessagePath)], {
|
|
95204
95355
|
cwd,
|