oh-my-opencode 5.0.0-beta.4 → 5.0.0-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.js +496 -377
- package/dist/cli-node/index.js +496 -377
- package/dist/index.js +1136 -1104
- package/dist/skills/coding-agent-sessions/SKILL.md +3 -2
- package/dist/skills/coding-agent-sessions/references/all-platforms.md +1 -1
- package/dist/skills/coding-agent-sessions/references/senpi.md +4 -4
- package/dist/skills/coding-agent-sessions/scripts/agent_sessions/pi_family.py +1 -1
- package/dist/tui.js +20 -1
- package/package.json +15 -14
- package/packages/lsp-core/src/lsp/client-wrapper.test.ts +60 -7
- package/packages/lsp-core/src/lsp/client-wrapper.ts +69 -16
- package/packages/lsp-core/src/lsp/workspace-edit-adversarial.test.ts +20 -1
- package/packages/lsp-core/src/tools/diagnostics.ts +3 -3
- package/packages/lsp-core/src/tools/navigation.ts +4 -2
- package/packages/lsp-core/src/tools/rename.ts +4 -2
- package/packages/lsp-core/src/tools/symbols.ts +1 -1
- package/packages/lsp-daemon/dist/cli.js +83 -29
- package/packages/lsp-daemon/dist/client.js +76 -22
- package/packages/lsp-daemon/dist/index.js +81 -27
- package/packages/lsp-tools-mcp/dist/cli.js +76 -22
- package/packages/lsp-tools-mcp/dist/mcp.js +76 -22
- package/packages/lsp-tools-mcp/dist/tools.js +76 -22
- package/packages/omo-codex/plugin/.codex-plugin/plugin.json +1 -1
- 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 +14 -1
- package/packages/omo-codex/plugin/components/codegraph/dist/serve.js +14 -1
- package/packages/omo-codex/plugin/components/codegraph/package.json +1 -1
- 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/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/dist/.omo-runtime-manifest.json +3 -3
- package/packages/omo-codex/plugin/components/lsp/dist/cli.js +83 -29
- package/packages/omo-codex/plugin/components/lsp/hooks/hooks.json +2 -2
- package/packages/omo-codex/plugin/components/lsp/package.json +1 -1
- 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/start-work-continuation/hooks/hooks.json +2 -2
- package/packages/omo-codex/plugin/components/start-work-continuation/package.json +1 -1
- package/packages/omo-codex/plugin/components/teammode/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/teammode/package.json +1 -1
- package/packages/omo-codex/plugin/components/telemetry/dist/cli.js +24 -12
- package/packages/omo-codex/plugin/components/telemetry/dist/posthog.js +24 -12
- 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/ultrawork/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/package.json +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/hooks/hooks.json +4 -4
- package/packages/omo-codex/plugin/components/ulw-loop/package.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-compact-resetting-git-bash-mcp-reminder.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-compact-resetting-lsp-diagnostics-cache.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-compact-resetting-project-rule-cache.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-checking-codegraph-init-guidance.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-checking-comments.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-checking-lsp-diagnostics.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-checking-thread-title-hygiene.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-matching-project-rules.json +1 -1
- package/packages/omo-codex/plugin/hooks/pre-tool-use-enforcing-unlimited-goal-budget.json +1 -1
- package/packages/omo-codex/plugin/hooks/pre-tool-use-guarding-ulw-loop-spawns.json +1 -1
- package/packages/omo-codex/plugin/hooks/pre-tool-use-recommending-git-bash-mcp.json +1 -1
- package/packages/omo-codex/plugin/hooks/session-start-checking-auto-update.json +1 -1
- package/packages/omo-codex/plugin/hooks/session-start-checking-bootstrap-provisioning.json +1 -1
- package/packages/omo-codex/plugin/hooks/session-start-checking-codegraph-bootstrap.json +1 -1
- package/packages/omo-codex/plugin/hooks/session-start-loading-project-rules.json +1 -1
- package/packages/omo-codex/plugin/hooks/session-start-recording-session-telemetry.json +1 -1
- package/packages/omo-codex/plugin/hooks/stop-checking-start-work-continuation.json +1 -1
- package/packages/omo-codex/plugin/hooks/stop-checking-ulw-loop-resume.json +1 -1
- package/packages/omo-codex/plugin/hooks/subagent-stop-checking-start-work-continuation.json +1 -1
- package/packages/omo-codex/plugin/hooks/subagent-stop-verifying-lazycodex-executor-evidence.json +1 -1
- package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ultrawork-trigger.json +1 -1
- package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ulw-loop-steering.json +1 -1
- package/packages/omo-codex/plugin/hooks/user-prompt-submit-loading-project-rules.json +1 -1
- package/packages/omo-codex/plugin/package-lock.json +13 -13
- package/packages/omo-codex/plugin/package.json +1 -1
- package/packages/omo-codex/plugin/skills/coding-agent-sessions/SKILL.md +3 -2
- package/packages/omo-codex/plugin/skills/coding-agent-sessions/references/all-platforms.md +1 -1
- package/packages/omo-codex/plugin/skills/coding-agent-sessions/references/senpi.md +4 -4
- package/packages/omo-codex/plugin/skills/coding-agent-sessions/scripts/agent_sessions/pi_family.py +1 -1
- package/packages/omo-codex/scripts/install-dist/install-local.mjs +39 -16
- package/packages/shared-skills/skills/coding-agent-sessions/SKILL.md +3 -2
- package/packages/shared-skills/skills/coding-agent-sessions/references/all-platforms.md +1 -1
- package/packages/shared-skills/skills/coding-agent-sessions/references/senpi.md +4 -4
- package/packages/shared-skills/skills/coding-agent-sessions/scripts/agent_sessions/pi_family.py +1 -1
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: "5.0.0-beta.
|
|
2149
|
+
version: "5.0.0-beta.6",
|
|
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",
|
|
@@ -2326,7 +2326,7 @@ var init_package = __esm(() => {
|
|
|
2326
2326
|
zod: "^4.4.3"
|
|
2327
2327
|
},
|
|
2328
2328
|
devDependencies: {
|
|
2329
|
-
"@code-yeongyu/senpi": "2026.8.11",
|
|
2329
|
+
"@code-yeongyu/senpi": "2026.8.11-4",
|
|
2330
2330
|
"@oh-my-opencode/agents-md-core": "workspace:*",
|
|
2331
2331
|
"@oh-my-opencode/ast-grep-mcp": "workspace:*",
|
|
2332
2332
|
"@oh-my-opencode/boulder-state": "workspace:*",
|
|
@@ -2342,6 +2342,7 @@ var init_package = __esm(() => {
|
|
|
2342
2342
|
"@oh-my-opencode/model-core": "workspace:*",
|
|
2343
2343
|
"@oh-my-opencode/omo-codex": "workspace:*",
|
|
2344
2344
|
"@oh-my-opencode/omo-config-core": "workspace:*",
|
|
2345
|
+
"@oh-my-opencode/omo-opencode": "workspace:*",
|
|
2345
2346
|
"@oh-my-opencode/omo-senpi": "workspace:*",
|
|
2346
2347
|
"@oh-my-opencode/openclaw-core": "workspace:*",
|
|
2347
2348
|
"@oh-my-opencode/pi-goal": "workspace:*",
|
|
@@ -2366,18 +2367,18 @@ var init_package = __esm(() => {
|
|
|
2366
2367
|
typescript: "^7.0.2"
|
|
2367
2368
|
},
|
|
2368
2369
|
optionalDependencies: {
|
|
2369
|
-
"oh-my-opencode-darwin-arm64": "5.0.0-beta.
|
|
2370
|
-
"oh-my-opencode-darwin-x64": "5.0.0-beta.
|
|
2371
|
-
"oh-my-opencode-darwin-x64-baseline": "5.0.0-beta.
|
|
2372
|
-
"oh-my-opencode-linux-arm64": "5.0.0-beta.
|
|
2373
|
-
"oh-my-opencode-linux-arm64-musl": "5.0.0-beta.
|
|
2374
|
-
"oh-my-opencode-linux-x64": "5.0.0-beta.
|
|
2375
|
-
"oh-my-opencode-linux-x64-baseline": "5.0.0-beta.
|
|
2376
|
-
"oh-my-opencode-linux-x64-musl": "5.0.0-beta.
|
|
2377
|
-
"oh-my-opencode-linux-x64-musl-baseline": "5.0.0-beta.
|
|
2378
|
-
"oh-my-opencode-windows-arm64": "5.0.0-beta.
|
|
2379
|
-
"oh-my-opencode-windows-x64": "5.0.0-beta.
|
|
2380
|
-
"oh-my-opencode-windows-x64-baseline": "5.0.0-beta.
|
|
2370
|
+
"oh-my-opencode-darwin-arm64": "5.0.0-beta.6",
|
|
2371
|
+
"oh-my-opencode-darwin-x64": "5.0.0-beta.6",
|
|
2372
|
+
"oh-my-opencode-darwin-x64-baseline": "5.0.0-beta.6",
|
|
2373
|
+
"oh-my-opencode-linux-arm64": "5.0.0-beta.6",
|
|
2374
|
+
"oh-my-opencode-linux-arm64-musl": "5.0.0-beta.6",
|
|
2375
|
+
"oh-my-opencode-linux-x64": "5.0.0-beta.6",
|
|
2376
|
+
"oh-my-opencode-linux-x64-baseline": "5.0.0-beta.6",
|
|
2377
|
+
"oh-my-opencode-linux-x64-musl": "5.0.0-beta.6",
|
|
2378
|
+
"oh-my-opencode-linux-x64-musl-baseline": "5.0.0-beta.6",
|
|
2379
|
+
"oh-my-opencode-windows-arm64": "5.0.0-beta.6",
|
|
2380
|
+
"oh-my-opencode-windows-x64": "5.0.0-beta.6",
|
|
2381
|
+
"oh-my-opencode-windows-x64-baseline": "5.0.0-beta.6"
|
|
2381
2382
|
},
|
|
2382
2383
|
overrides: {
|
|
2383
2384
|
"@earendil-works/pi-agent-core": "0.80.3",
|
|
@@ -22628,6 +22629,19 @@ var init_team = __esm(() => {
|
|
|
22628
22629
|
OmoTeamsConfigLayerSchema = record(string2(), OmoTeamSpecLayerSchema);
|
|
22629
22630
|
});
|
|
22630
22631
|
|
|
22632
|
+
// packages/omo-config-core/src/schema/telemetry.ts
|
|
22633
|
+
var OmoTelemetrySettingsShape, OmoTelemetrySettingsLayerSchema, OmoTelemetrySettingsSchema;
|
|
22634
|
+
var init_telemetry = __esm(() => {
|
|
22635
|
+
init_zod();
|
|
22636
|
+
OmoTelemetrySettingsShape = {
|
|
22637
|
+
enabled: boolean2()
|
|
22638
|
+
};
|
|
22639
|
+
OmoTelemetrySettingsLayerSchema = object(OmoTelemetrySettingsShape).partial().strict();
|
|
22640
|
+
OmoTelemetrySettingsSchema = OmoTelemetrySettingsLayerSchema.extend({
|
|
22641
|
+
enabled: boolean2().default(true)
|
|
22642
|
+
}).strict();
|
|
22643
|
+
});
|
|
22644
|
+
|
|
22631
22645
|
// packages/omo-config-core/src/schema/config.ts
|
|
22632
22646
|
var OmoOpenCodeHarnessConfigSchema, OmoTypedHarnessConfigSchema, OmoConfigProfileSchema, OmoConfigSchema, OmoConfigLayerSchema;
|
|
22633
22647
|
var init_config = __esm(() => {
|
|
@@ -22639,6 +22653,7 @@ var init_config = __esm(() => {
|
|
|
22639
22653
|
init_model_catalog();
|
|
22640
22654
|
init_task();
|
|
22641
22655
|
init_team();
|
|
22656
|
+
init_telemetry();
|
|
22642
22657
|
OmoOpenCodeHarnessConfigSchema = record(string2(), unknown());
|
|
22643
22658
|
OmoTypedHarnessConfigSchema = object({
|
|
22644
22659
|
categories: OmoCategoriesConfigSchema.optional(),
|
|
@@ -22647,7 +22662,8 @@ var init_config = __esm(() => {
|
|
|
22647
22662
|
task: OmoTaskSettingsLayerSchema.optional(),
|
|
22648
22663
|
teams: OmoTeamsConfigLayerSchema.optional(),
|
|
22649
22664
|
models: OmoModelCatalogLayerSchema.optional(),
|
|
22650
|
-
memory: OmoMemorySettingsLayerSchema.optional()
|
|
22665
|
+
memory: OmoMemorySettingsLayerSchema.optional(),
|
|
22666
|
+
telemetry: OmoTelemetrySettingsLayerSchema.optional()
|
|
22651
22667
|
}).strict();
|
|
22652
22668
|
OmoConfigProfileSchema = object({
|
|
22653
22669
|
categories: OmoCategoriesConfigSchema.optional(),
|
|
@@ -22657,6 +22673,7 @@ var init_config = __esm(() => {
|
|
|
22657
22673
|
teams: OmoTeamsConfigLayerSchema.optional(),
|
|
22658
22674
|
models: OmoModelCatalogLayerSchema.optional(),
|
|
22659
22675
|
memory: OmoMemorySettingsLayerSchema.optional(),
|
|
22676
|
+
telemetry: OmoTelemetrySettingsLayerSchema.optional(),
|
|
22660
22677
|
"[opencode]": OmoOpenCodeHarnessConfigSchema.optional(),
|
|
22661
22678
|
"[senpi]": OmoTypedHarnessConfigSchema.optional(),
|
|
22662
22679
|
"[codex]": OmoTypedHarnessConfigSchema.optional()
|
|
@@ -22670,6 +22687,7 @@ var init_config = __esm(() => {
|
|
|
22670
22687
|
teams: OmoTeamsConfigSchema.optional(),
|
|
22671
22688
|
models: OmoModelCatalogSchema.optional(),
|
|
22672
22689
|
memory: OmoMemorySettingsSchema.optional(),
|
|
22690
|
+
telemetry: OmoTelemetrySettingsSchema.optional(),
|
|
22673
22691
|
"[opencode]": OmoOpenCodeHarnessConfigSchema.optional(),
|
|
22674
22692
|
"[senpi]": OmoTypedHarnessConfigSchema.optional(),
|
|
22675
22693
|
"[codex]": OmoTypedHarnessConfigSchema.optional(),
|
|
@@ -22686,6 +22704,7 @@ var init_config = __esm(() => {
|
|
|
22686
22704
|
teams: OmoTeamsConfigLayerSchema.optional(),
|
|
22687
22705
|
models: OmoModelCatalogLayerSchema.optional(),
|
|
22688
22706
|
memory: OmoMemorySettingsLayerSchema.optional(),
|
|
22707
|
+
telemetry: OmoTelemetrySettingsLayerSchema.optional(),
|
|
22689
22708
|
"[opencode]": OmoOpenCodeHarnessConfigSchema.optional(),
|
|
22690
22709
|
"[senpi]": OmoTypedHarnessConfigSchema.optional(),
|
|
22691
22710
|
"[codex]": OmoTypedHarnessConfigSchema.optional(),
|
|
@@ -22708,6 +22727,7 @@ var init_schema = __esm(() => {
|
|
|
22708
22727
|
init_model_ref();
|
|
22709
22728
|
init_task();
|
|
22710
22729
|
init_team();
|
|
22730
|
+
init_telemetry();
|
|
22711
22731
|
});
|
|
22712
22732
|
|
|
22713
22733
|
// packages/omo-config-core/src/loader/merge.ts
|
|
@@ -88770,7 +88790,7 @@ var init_activity_state = __esm(() => {
|
|
|
88770
88790
|
});
|
|
88771
88791
|
|
|
88772
88792
|
// packages/telemetry-core/src/constants.ts
|
|
88773
|
-
var DEFAULT_POSTHOG_HOST = "https://us.i.posthog.com", DEFAULT_POSTHOG_API_KEY = "phc_CFJhj5HyvA62QPhvyaUCtaq23aUfznnijg5VaaGkNk74";
|
|
88793
|
+
var DEFAULT_POSTHOG_HOST = "https://us.i.posthog.com", DEFAULT_POSTHOG_API_KEY = "phc_CFJhj5HyvA62QPhvyaUCtaq23aUfznnijg5VaaGkNk74", UNCONFIGURED_POSTHOG_API_KEY = "phc_REPLACE_ME_OMO_NATIVE";
|
|
88774
88794
|
|
|
88775
88795
|
// packages/telemetry-core/src/diagnostics.ts
|
|
88776
88796
|
import { appendFileSync as appendFileSync2, existsSync as existsSync27, mkdirSync as mkdirSync9, readFileSync as readFileSync13 } from "node:fs";
|
|
@@ -88908,6 +88928,9 @@ function shouldDisableTelemetry(input) {
|
|
|
88908
88928
|
const env2 = input.env ?? process.env;
|
|
88909
88929
|
const globalPrefix = input.globalEnvPrefix ?? "OMO";
|
|
88910
88930
|
const prefixes = Array.from(new Set([globalPrefix, input.productEnvPrefix]));
|
|
88931
|
+
if (isDisableFlag(env2["DO_NOT_TRACK"])) {
|
|
88932
|
+
return true;
|
|
88933
|
+
}
|
|
88911
88934
|
for (const prefix of prefixes) {
|
|
88912
88935
|
if (isDisableFlag(env2[`${prefix}_DISABLE_POSTHOG`])) {
|
|
88913
88936
|
return true;
|
|
@@ -88921,6 +88944,13 @@ function shouldDisableTelemetry(input) {
|
|
|
88921
88944
|
function getTelemetryApiKey(env2 = process.env, defaultApiKey = DEFAULT_POSTHOG_API_KEY) {
|
|
88922
88945
|
return env2["POSTHOG_API_KEY"]?.trim() ?? defaultApiKey;
|
|
88923
88946
|
}
|
|
88947
|
+
function isConfiguredTelemetryApiKey(apiKey) {
|
|
88948
|
+
const normalized = apiKey.trim();
|
|
88949
|
+
return normalized.length > 0 && normalized !== UNCONFIGURED_POSTHOG_API_KEY;
|
|
88950
|
+
}
|
|
88951
|
+
function hasTelemetryApiKey(env2, defaultApiKey) {
|
|
88952
|
+
return isConfiguredTelemetryApiKey(getTelemetryApiKey(env2, defaultApiKey));
|
|
88953
|
+
}
|
|
88924
88954
|
function getTelemetryHost(env2 = process.env, defaultHost = DEFAULT_POSTHOG_HOST) {
|
|
88925
88955
|
return env2["POSTHOG_HOST"]?.trim() || defaultHost;
|
|
88926
88956
|
}
|
|
@@ -88930,17 +88960,6 @@ var init_env2 = __esm(() => {
|
|
|
88930
88960
|
SEND_OPT_OUT_VALUES = ["0", "false", "no", "yes"];
|
|
88931
88961
|
});
|
|
88932
88962
|
|
|
88933
|
-
// packages/telemetry-core/src/machine-id.ts
|
|
88934
|
-
import { createHash as createHash4 } from "node:crypto";
|
|
88935
|
-
import os4 from "node:os";
|
|
88936
|
-
function getDefaultTelemetryOsProvider() {
|
|
88937
|
-
return os4;
|
|
88938
|
-
}
|
|
88939
|
-
function getTelemetryDistinctId(machineIdPrefix, osProvider = getDefaultTelemetryOsProvider()) {
|
|
88940
|
-
return createHash4("sha256").update(`${machineIdPrefix}${osProvider.hostname()}`).digest("hex");
|
|
88941
|
-
}
|
|
88942
|
-
var init_machine_id = () => {};
|
|
88943
|
-
|
|
88944
88963
|
// node_modules/.bun/posthog-node@5.35.12/node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
|
|
88945
88964
|
import { dirname as dirname17, posix as posix7, sep as sep7 } from "path";
|
|
88946
88965
|
function createModulerModifier() {
|
|
@@ -94315,6 +94334,17 @@ var init_index_node = __esm(() => {
|
|
|
94315
94334
|
};
|
|
94316
94335
|
});
|
|
94317
94336
|
|
|
94337
|
+
// packages/telemetry-core/src/machine-id.ts
|
|
94338
|
+
import { createHash as createHash4 } from "node:crypto";
|
|
94339
|
+
import os4 from "node:os";
|
|
94340
|
+
function getDefaultTelemetryOsProvider() {
|
|
94341
|
+
return os4;
|
|
94342
|
+
}
|
|
94343
|
+
function getTelemetryDistinctId(machineIdPrefix, osProvider = getDefaultTelemetryOsProvider()) {
|
|
94344
|
+
return createHash4("sha256").update(`${machineIdPrefix}${osProvider.hostname()}`).digest("hex");
|
|
94345
|
+
}
|
|
94346
|
+
var init_machine_id = () => {};
|
|
94347
|
+
|
|
94318
94348
|
// packages/telemetry-core/src/posthog-client.ts
|
|
94319
94349
|
class PostHogTelemetryTransport {
|
|
94320
94350
|
#client;
|
|
@@ -94336,7 +94366,7 @@ function createDefaultPostHogTransport(apiKey, options) {
|
|
|
94336
94366
|
}
|
|
94337
94367
|
function isTelemetryClientEnabled(input) {
|
|
94338
94368
|
const env2 = input.env ?? process.env;
|
|
94339
|
-
return !shouldDisableTelemetry({ env: env2, productEnvPrefix: input.product.productEnvPrefix }) &&
|
|
94369
|
+
return !shouldDisableTelemetry({ env: env2, productEnvPrefix: input.product.productEnvPrefix }) && hasTelemetryApiKey(env2, input.product.defaultApiKey);
|
|
94340
94370
|
}
|
|
94341
94371
|
function createTelemetryClient(input) {
|
|
94342
94372
|
if (!isTelemetryClientEnabled(input)) {
|
|
@@ -94402,7 +94432,8 @@ function createTransport(input) {
|
|
|
94402
94432
|
flushAt: 1,
|
|
94403
94433
|
flushInterval: 0,
|
|
94404
94434
|
host: getTelemetryHost(env2, input.product.defaultHost),
|
|
94405
|
-
disableGeoip: false
|
|
94435
|
+
disableGeoip: input.product.disableGeoip ?? false,
|
|
94436
|
+
...input.product.transportOptions
|
|
94406
94437
|
});
|
|
94407
94438
|
} catch (error51) {
|
|
94408
94439
|
input.diagnostics?.({
|
|
@@ -94479,6 +94510,17 @@ var init_posthog_client = __esm(() => {
|
|
|
94479
94510
|
};
|
|
94480
94511
|
});
|
|
94481
94512
|
|
|
94513
|
+
// packages/telemetry-core/src/events.ts
|
|
94514
|
+
var ALLOWED_DOLLAR_KEYS;
|
|
94515
|
+
var init_events = __esm(() => {
|
|
94516
|
+
ALLOWED_DOLLAR_KEYS = new Set([
|
|
94517
|
+
"$os",
|
|
94518
|
+
"$os_version",
|
|
94519
|
+
"$process_person_profile",
|
|
94520
|
+
"$session_id"
|
|
94521
|
+
]);
|
|
94522
|
+
});
|
|
94523
|
+
|
|
94482
94524
|
// packages/telemetry-core/src/record-daily-active.ts
|
|
94483
94525
|
var init_record_daily_active = () => {};
|
|
94484
94526
|
|
|
@@ -94487,6 +94529,7 @@ var init_src5 = __esm(() => {
|
|
|
94487
94529
|
init_activity_state();
|
|
94488
94530
|
init_diagnostics();
|
|
94489
94531
|
init_env2();
|
|
94532
|
+
init_events();
|
|
94490
94533
|
init_machine_id();
|
|
94491
94534
|
init_posthog_client();
|
|
94492
94535
|
init_record_daily_active();
|
|
@@ -94497,7 +94540,7 @@ var package_default2;
|
|
|
94497
94540
|
var init_package2 = __esm(() => {
|
|
94498
94541
|
package_default2 = {
|
|
94499
94542
|
name: "@oh-my-opencode/omo-codex",
|
|
94500
|
-
version: "5.0.0-beta.
|
|
94543
|
+
version: "5.0.0-beta.6",
|
|
94501
94544
|
type: "module",
|
|
94502
94545
|
private: true,
|
|
94503
94546
|
description: "Codex harness adapter for oh-my-openagent. Vendored Codex plugin namespace (omo) + TypeScript installer + telemetry.",
|
|
@@ -94711,7 +94754,7 @@ __export(exports_telemetry, {
|
|
|
94711
94754
|
__resetOsProviderForTesting: () => __resetOsProviderForTesting,
|
|
94712
94755
|
__resetActivityStateProviderForTesting: () => __resetActivityStateProviderForTesting
|
|
94713
94756
|
});
|
|
94714
|
-
var
|
|
94757
|
+
var init_telemetry2 = __esm(() => {
|
|
94715
94758
|
init_posthog();
|
|
94716
94759
|
});
|
|
94717
94760
|
|
|
@@ -95466,20 +95509,20 @@ var init_update_toasts = __esm(() => {
|
|
|
95466
95509
|
});
|
|
95467
95510
|
|
|
95468
95511
|
// packages/omo-opencode/src/hooks/auto-update-checker/hook/background-update-check.ts
|
|
95469
|
-
import { existsSync as
|
|
95470
|
-
import { dirname as
|
|
95512
|
+
import { existsSync as existsSync47 } from "node:fs";
|
|
95513
|
+
import { dirname as dirname29, join as join74 } from "node:path";
|
|
95471
95514
|
import { fileURLToPath as fileURLToPath5 } from "node:url";
|
|
95472
95515
|
function defaultGetModuleHostingWorkspace() {
|
|
95473
95516
|
try {
|
|
95474
|
-
const currentDir =
|
|
95517
|
+
const currentDir = dirname29(fileURLToPath5(import.meta.url));
|
|
95475
95518
|
const pkgJsonPath = findPackageJsonUp(currentDir);
|
|
95476
95519
|
if (!pkgJsonPath)
|
|
95477
95520
|
return null;
|
|
95478
|
-
const pkgDir =
|
|
95479
|
-
const nodeModulesDir =
|
|
95521
|
+
const pkgDir = dirname29(pkgJsonPath);
|
|
95522
|
+
const nodeModulesDir = dirname29(pkgDir);
|
|
95480
95523
|
if (nodeModulesDir.split(/[\\/]/).pop() !== "node_modules")
|
|
95481
95524
|
return null;
|
|
95482
|
-
return
|
|
95525
|
+
return dirname29(nodeModulesDir);
|
|
95483
95526
|
} catch (error51) {
|
|
95484
95527
|
if (error51 instanceof Error) {
|
|
95485
95528
|
return null;
|
|
@@ -95620,8 +95663,8 @@ var init_background_update_check = __esm(() => {
|
|
|
95620
95663
|
init_package_json_locator();
|
|
95621
95664
|
init_update_toasts();
|
|
95622
95665
|
defaultDeps4 = {
|
|
95623
|
-
existsSync:
|
|
95624
|
-
join:
|
|
95666
|
+
existsSync: existsSync47,
|
|
95667
|
+
join: join74,
|
|
95625
95668
|
runBunInstallWithDetails,
|
|
95626
95669
|
log: log2,
|
|
95627
95670
|
getOpenCodeCacheDir,
|
|
@@ -95784,7 +95827,7 @@ async function showSpinnerToast(ctx, version3, message) {
|
|
|
95784
95827
|
duration: frameInterval + 50
|
|
95785
95828
|
}
|
|
95786
95829
|
}).catch(ignoreToastError);
|
|
95787
|
-
await new Promise((
|
|
95830
|
+
await new Promise((resolve21) => setTimeout(resolve21, frameInterval));
|
|
95788
95831
|
}
|
|
95789
95832
|
}
|
|
95790
95833
|
var SISYPHUS_SPINNER;
|
|
@@ -100576,7 +100619,7 @@ async function installAstGrepForCodex(options) {
|
|
|
100576
100619
|
// packages/omo-codex/src/install/codex-install-telemetry.ts
|
|
100577
100620
|
async function trackCodexInstallTelemetry() {
|
|
100578
100621
|
try {
|
|
100579
|
-
const { createInstallPostHog: createInstallPostHog2, getPostHogDistinctId: getPostHogDistinctId2 } = await Promise.resolve().then(() => (
|
|
100622
|
+
const { createInstallPostHog: createInstallPostHog2, getPostHogDistinctId: getPostHogDistinctId2 } = await Promise.resolve().then(() => (init_telemetry2(), exports_telemetry));
|
|
100580
100623
|
const posthog = createInstallPostHog2();
|
|
100581
100624
|
posthog.trackActive(getPostHogDistinctId2(), "install_completed");
|
|
100582
100625
|
await posthog.shutdown();
|
|
@@ -101397,21 +101440,93 @@ var CODEGRAPH_RELATIVE_ARGS2 = new Set(["components/codegraph/dist/serve.js", ".
|
|
|
101397
101440
|
// packages/omo-senpi/src/install/install-senpi.ts
|
|
101398
101441
|
import { execFile as execFile4 } from "node:child_process";
|
|
101399
101442
|
import { createHash as createHash5 } from "node:crypto";
|
|
101400
|
-
import { constants as constants8, existsSync as
|
|
101443
|
+
import { constants as constants8, existsSync as existsSync31 } from "node:fs";
|
|
101401
101444
|
import { access as access2, readFile as readFile26, stat as stat6 } from "node:fs/promises";
|
|
101402
|
-
import { homedir as
|
|
101403
|
-
import { dirname as
|
|
101445
|
+
import { homedir as homedir10 } from "node:os";
|
|
101446
|
+
import { dirname as dirname23, join as join61, resolve as resolve19 } from "node:path";
|
|
101404
101447
|
import { fileURLToPath } from "node:url";
|
|
101405
101448
|
import { promisify as promisify2 } from "node:util";
|
|
101406
101449
|
|
|
101450
|
+
// packages/omo-senpi/src/install/local-launcher.ts
|
|
101451
|
+
import { chmodSync as chmodSync3, existsSync as existsSync30, mkdirSync as mkdirSync10, readFileSync as readFileSync14, rmSync, writeFileSync as writeFileSync6 } from "node:fs";
|
|
101452
|
+
import { homedir as homedir9 } from "node:os";
|
|
101453
|
+
import { dirname as dirname21, join as join59, resolve as resolve17 } from "node:path";
|
|
101454
|
+
var MARKER = "omo-local-launcher";
|
|
101455
|
+
function localLauncherPath(homeDir = homedir9()) {
|
|
101456
|
+
return join59(homeDir, ".local", "bin", "omo");
|
|
101457
|
+
}
|
|
101458
|
+
function localLauncherCmdPath(homeDir = homedir9()) {
|
|
101459
|
+
return join59(homeDir, ".local", "bin", "omo.cmd");
|
|
101460
|
+
}
|
|
101461
|
+
function renderLocalLauncher(options) {
|
|
101462
|
+
const brand = {
|
|
101463
|
+
name: "omo",
|
|
101464
|
+
displayVersion: options.version ?? "local",
|
|
101465
|
+
configDir: ".omo",
|
|
101466
|
+
flatLayout: true,
|
|
101467
|
+
envPrefix: "OMO",
|
|
101468
|
+
userAgent: "omo",
|
|
101469
|
+
originator: "omo",
|
|
101470
|
+
update: {
|
|
101471
|
+
packageName: "omo-ai",
|
|
101472
|
+
distTag: "beta",
|
|
101473
|
+
command: "npm i -g omo-ai@beta",
|
|
101474
|
+
changelogUrl: "https://github.com/code-yeongyu/oh-my-openagent/releases"
|
|
101475
|
+
}
|
|
101476
|
+
};
|
|
101477
|
+
return `#!/usr/bin/env node
|
|
101478
|
+
// ${MARKER}: generated by the omo-senpi installer. Delete this file to remove the local launcher.
|
|
101479
|
+
import { spawn } from "node:child_process"
|
|
101480
|
+
|
|
101481
|
+
const brand = ${JSON.stringify(brand)}
|
|
101482
|
+
const cli = process.env.OMO_SENPI_CLI_PATH ?? ${JSON.stringify(options.senpiCliPath)}
|
|
101483
|
+
const plugin = process.env.OMO_PLUGIN_ROOT ?? ${JSON.stringify(options.pluginPath)}
|
|
101484
|
+
const env = { ...process.env, SENPI_BRAND: JSON.stringify(brand), OMO_NATIVE: "1" }
|
|
101485
|
+
// Anything resolving the product by name must re-enter through this launcher, never the engine.
|
|
101486
|
+
env.OMO_BIN = process.argv[1]
|
|
101487
|
+
const selfUpdate = process.argv[2] === "update"
|
|
101488
|
+
&& process.argv.slice(3).every((arg) => arg.startsWith("-") || ["self", "senpi", "omo"].includes(arg))
|
|
101489
|
+
&& !process.argv.slice(3).some((arg) => arg === "--extensions" || arg === "--models")
|
|
101490
|
+
if (selfUpdate) {
|
|
101491
|
+
console.log("omo is updated via npm: npm i -g omo-ai@beta")
|
|
101492
|
+
process.exit(0)
|
|
101493
|
+
}
|
|
101494
|
+
const child = spawn(process.execPath, [cli, "--extension", plugin, ...process.argv.slice(2)], {
|
|
101495
|
+
env,
|
|
101496
|
+
stdio: "inherit",
|
|
101497
|
+
})
|
|
101498
|
+
child.on("close", (code, signal) => {
|
|
101499
|
+
if (signal) {
|
|
101500
|
+
process.kill(process.pid, signal)
|
|
101501
|
+
return
|
|
101502
|
+
}
|
|
101503
|
+
process.exitCode = code ?? 1
|
|
101504
|
+
})
|
|
101505
|
+
`;
|
|
101506
|
+
}
|
|
101507
|
+
function installLocalLauncher(options) {
|
|
101508
|
+
const path6 = localLauncherPath(options.homeDir);
|
|
101509
|
+
if (existsSync30(path6) && !readFileSync14(path6, "utf8").includes(MARKER))
|
|
101510
|
+
return;
|
|
101511
|
+
mkdirSync10(dirname21(path6), { recursive: true });
|
|
101512
|
+
writeFileSync6(path6, renderLocalLauncher(options));
|
|
101513
|
+
chmodSync3(path6, 493);
|
|
101514
|
+
if ((options.platform ?? process.platform) === "win32") {
|
|
101515
|
+
writeFileSync6(localLauncherCmdPath(options.homeDir), `@echo off\r
|
|
101516
|
+
node "%~dp0omo" %*\r
|
|
101517
|
+
`);
|
|
101518
|
+
}
|
|
101519
|
+
return path6;
|
|
101520
|
+
}
|
|
101521
|
+
|
|
101407
101522
|
// packages/omo-senpi/src/install/senpi-settings.ts
|
|
101408
101523
|
import { constants as constants7 } from "node:fs";
|
|
101409
101524
|
import { access, copyFile as copyFile3, mkdir as mkdir9, readFile as readFile25, rename as rename5, writeFile as writeFile14 } from "node:fs/promises";
|
|
101410
|
-
import { dirname as
|
|
101525
|
+
import { dirname as dirname22, join as join60, resolve as resolve18 } from "node:path";
|
|
101411
101526
|
var OMO_SENPI_PACKAGE_NAME = "@code-yeongyu/omo-senpi";
|
|
101412
101527
|
var LEGACY_BUILTIN_SHADOW_PACKAGES = [
|
|
101413
|
-
|
|
101414
|
-
|
|
101528
|
+
join60("packages", "pi-goal"),
|
|
101529
|
+
join60("packages", "pi-webfetch")
|
|
101415
101530
|
];
|
|
101416
101531
|
async function readSettings(settingsPath) {
|
|
101417
101532
|
let raw;
|
|
@@ -101440,13 +101555,13 @@ function dedupePackages(packages) {
|
|
|
101440
101555
|
return [...new Set(packages)];
|
|
101441
101556
|
}
|
|
101442
101557
|
function removeLegacyBuiltinShadows(packages, repoRoot, agentDir) {
|
|
101443
|
-
const shadowPaths = new Set(LEGACY_BUILTIN_SHADOW_PACKAGES.map((path6) =>
|
|
101444
|
-
return packages.filter((entry) => !shadowPaths.has(
|
|
101558
|
+
const shadowPaths = new Set(LEGACY_BUILTIN_SHADOW_PACKAGES.map((path6) => resolve18(repoRoot, path6)));
|
|
101559
|
+
return packages.filter((entry) => !shadowPaths.has(resolve18(agentDir, entry)));
|
|
101445
101560
|
}
|
|
101446
101561
|
async function removeSupersededOmoPackages(packages, currentPluginPath, agentDir) {
|
|
101447
|
-
const currentPath =
|
|
101562
|
+
const currentPath = resolve18(currentPluginPath);
|
|
101448
101563
|
const entries = await Promise.all(packages.map(async (entry) => {
|
|
101449
|
-
const packagePath =
|
|
101564
|
+
const packagePath = resolve18(agentDir, entry);
|
|
101450
101565
|
if (packagePath === currentPath)
|
|
101451
101566
|
return currentPath;
|
|
101452
101567
|
return await readPackageName(packagePath) === OMO_SENPI_PACKAGE_NAME ? undefined : entry;
|
|
@@ -101454,7 +101569,7 @@ async function removeSupersededOmoPackages(packages, currentPluginPath, agentDir
|
|
|
101454
101569
|
return entries.filter((entry) => entry !== undefined);
|
|
101455
101570
|
}
|
|
101456
101571
|
async function writeSettingsAtomically(settingsPath, settings) {
|
|
101457
|
-
await mkdir9(
|
|
101572
|
+
await mkdir9(dirname22(settingsPath), { recursive: true });
|
|
101458
101573
|
const backupPath = await nextBackupPath(settingsPath);
|
|
101459
101574
|
if (await fileExists(settingsPath)) {
|
|
101460
101575
|
await copyFile3(settingsPath, backupPath);
|
|
@@ -101486,7 +101601,7 @@ function isRecord10(value) {
|
|
|
101486
101601
|
async function readPackageName(packagePath) {
|
|
101487
101602
|
let raw;
|
|
101488
101603
|
try {
|
|
101489
|
-
raw = await readFile25(
|
|
101604
|
+
raw = await readFile25(join60(packagePath, "package.json"), "utf8");
|
|
101490
101605
|
} catch (error51) {
|
|
101491
101606
|
if (isErrno(error51, "ENOENT") || isErrno(error51, "ENOTDIR"))
|
|
101492
101607
|
return;
|
|
@@ -101512,39 +101627,39 @@ function isErrno(error51, code) {
|
|
|
101512
101627
|
// packages/omo-senpi/src/install/install-senpi.ts
|
|
101513
101628
|
var execFileAsync2 = promisify2(execFile4);
|
|
101514
101629
|
var REQUIRED_PLUGIN_ARTIFACTS = [
|
|
101515
|
-
|
|
101516
|
-
|
|
101517
|
-
|
|
101518
|
-
|
|
101519
|
-
|
|
101520
|
-
|
|
101521
|
-
|
|
101522
|
-
|
|
101523
|
-
|
|
101524
|
-
|
|
101525
|
-
|
|
101526
|
-
|
|
101527
|
-
|
|
101528
|
-
|
|
101529
|
-
|
|
101530
|
-
|
|
101531
|
-
|
|
101532
|
-
|
|
101533
|
-
|
|
101534
|
-
|
|
101535
|
-
|
|
101536
|
-
|
|
101537
|
-
|
|
101538
|
-
|
|
101539
|
-
|
|
101540
|
-
|
|
101541
|
-
|
|
101542
|
-
|
|
101543
|
-
|
|
101544
|
-
|
|
101545
|
-
|
|
101546
|
-
|
|
101547
|
-
|
|
101630
|
+
join61("extensions", "omo.js"),
|
|
101631
|
+
join61("extensions", "reflection-persona.md"),
|
|
101632
|
+
join61("skills", "ast-grep", "SKILL.md"),
|
|
101633
|
+
join61("skills", "coding-agent-sessions", "SKILL.md"),
|
|
101634
|
+
join61("skills", "debugging", "SKILL.md"),
|
|
101635
|
+
join61("skills", "frontend", "SKILL.md"),
|
|
101636
|
+
join61("skills", "git-master", "SKILL.md"),
|
|
101637
|
+
join61("skills", "init-deep", "SKILL.md"),
|
|
101638
|
+
join61("skills", "lsp-setup", "SKILL.md"),
|
|
101639
|
+
join61("skills", "programming", "SKILL.md"),
|
|
101640
|
+
join61("skills", "refactor", "SKILL.md"),
|
|
101641
|
+
join61("skills", "remove-ai-slops", "SKILL.md"),
|
|
101642
|
+
join61("skills", "review-work", "SKILL.md"),
|
|
101643
|
+
join61("skills", "start-work", "SKILL.md"),
|
|
101644
|
+
join61("skills", "ultimate-browsing", "SKILL.md"),
|
|
101645
|
+
join61("skills", "ultrawork", "SKILL.md"),
|
|
101646
|
+
join61("skills", "ulw-loop", "SKILL.md"),
|
|
101647
|
+
join61("skills", "ulw-plan", "SKILL.md"),
|
|
101648
|
+
join61("skills", "ulw-research", "SKILL.md"),
|
|
101649
|
+
join61("skills", "visual-qa", "SKILL.md"),
|
|
101650
|
+
join61("runtime", "ast-grep-mcp", "cli.js"),
|
|
101651
|
+
join61("runtime", "agent-toolkit", "cli.js"),
|
|
101652
|
+
join61("runtime", "agent-toolkit", "ulw-loop", "cli.js"),
|
|
101653
|
+
join61("runtime", "agent-toolkit", "omo-agent-toolkit"),
|
|
101654
|
+
join61("runtime", "agent-toolkit", "omo-agent-toolkit.cmd"),
|
|
101655
|
+
join61("runtime", "lsp-daemon", "dist", "cli.js"),
|
|
101656
|
+
join61("runtime", "lsp-daemon", "dist", "index.js"),
|
|
101657
|
+
join61("runtime", "lsp-daemon", "dist", "index.d.ts"),
|
|
101658
|
+
join61("runtime", "lsp-daemon", "dist", "daemon-client.js"),
|
|
101659
|
+
join61("runtime", "lsp-daemon", "dist", "daemon-client.d.ts"),
|
|
101660
|
+
join61("runtime", "lsp-daemon", "dist", "package.json"),
|
|
101661
|
+
join61("runtime", "lsp-daemon", "dist", ".omo-runtime-manifest.json"),
|
|
101662
|
+
join61("scripts", "install.mjs")
|
|
101548
101663
|
];
|
|
101549
101664
|
async function runSenpiInstaller(options = {}) {
|
|
101550
101665
|
const context = resolveInstallContext(options);
|
|
@@ -101556,6 +101671,10 @@ async function runSenpiInstaller(options = {}) {
|
|
|
101556
101671
|
packages.push(context.pluginPath);
|
|
101557
101672
|
settings.packages = packages;
|
|
101558
101673
|
const backupPath = await writeSettingsAtomically(context.settingsPath, settings);
|
|
101674
|
+
installLocalLauncher({
|
|
101675
|
+
pluginPath: context.pluginPath,
|
|
101676
|
+
senpiCliPath: join61(context.repoRoot, "packages", "coding-agent", "dist", "cli.js")
|
|
101677
|
+
});
|
|
101559
101678
|
return {
|
|
101560
101679
|
ok: true,
|
|
101561
101680
|
action: "install",
|
|
@@ -101569,14 +101688,14 @@ async function runSenpiInstaller(options = {}) {
|
|
|
101569
101688
|
function resolveInstallContext(options) {
|
|
101570
101689
|
const env3 = options.env ?? process.env;
|
|
101571
101690
|
const allowBuild = options.pluginPath === undefined;
|
|
101572
|
-
const repoRoot =
|
|
101573
|
-
const agentDir =
|
|
101574
|
-
const pluginPath =
|
|
101691
|
+
const repoRoot = resolve19(options.repoRoot ?? (allowBuild ? findRepoRoot2(dirname23(fileURLToPath(import.meta.url))) : dirname23(resolve19(options.pluginPath))));
|
|
101692
|
+
const agentDir = resolve19(options.agentDir ?? env3.SENPI_CODING_AGENT_DIR ?? join61(homedir10(), ".senpi", "agent"));
|
|
101693
|
+
const pluginPath = resolve19(options.pluginPath ?? join61(repoRoot, "packages", "omo-senpi", "plugin"));
|
|
101575
101694
|
return {
|
|
101576
101695
|
env: env3,
|
|
101577
101696
|
repoRoot,
|
|
101578
101697
|
agentDir,
|
|
101579
|
-
settingsPath:
|
|
101698
|
+
settingsPath: join61(agentDir, "settings.json"),
|
|
101580
101699
|
pluginPath,
|
|
101581
101700
|
platform: options.platform ?? process.platform,
|
|
101582
101701
|
allowBuild,
|
|
@@ -101585,13 +101704,13 @@ function resolveInstallContext(options) {
|
|
|
101585
101704
|
}
|
|
101586
101705
|
async function ensurePluginArtifacts(context) {
|
|
101587
101706
|
if (context.allowBuild) {
|
|
101588
|
-
await context.runCommand("node", [
|
|
101589
|
-
await context.runCommand("node", [
|
|
101590
|
-
await context.runCommand("node", [
|
|
101591
|
-
await context.runCommand("node", [
|
|
101592
|
-
await context.runCommand("node", [
|
|
101593
|
-
await context.runCommand("node", [
|
|
101594
|
-
await context.runCommand("node", [
|
|
101707
|
+
await context.runCommand("node", [join61(context.pluginPath, "scripts", "build-extension.mjs")], { cwd: context.repoRoot });
|
|
101708
|
+
await context.runCommand("node", [join61("packages", "omo-codex", "plugin", "scripts", "materialize-shared-upstreams.mjs")], { cwd: context.repoRoot });
|
|
101709
|
+
await context.runCommand("node", [join61(context.pluginPath, "scripts", "sync-skills.mjs")], { cwd: context.repoRoot });
|
|
101710
|
+
await context.runCommand("node", [join61(context.pluginPath, "scripts", "build-install.mjs")], { cwd: context.repoRoot });
|
|
101711
|
+
await context.runCommand("node", [join61(context.pluginPath, "scripts", "stage-lsp-daemon-runtime.mjs")], { cwd: context.repoRoot });
|
|
101712
|
+
await context.runCommand("node", [join61(context.pluginPath, "scripts", "stage-ast-grep-mcp-runtime.mjs")], { cwd: context.repoRoot });
|
|
101713
|
+
await context.runCommand("node", [join61(context.pluginPath, "scripts", "stage-agent-toolkit.mjs")], { cwd: context.repoRoot });
|
|
101595
101714
|
}
|
|
101596
101715
|
if (await hasMissingPluginArtifact(context.pluginPath)) {
|
|
101597
101716
|
throw new Error(`Packed omo-senpi plugin is missing required runtime artifacts at ${context.pluginPath}`);
|
|
@@ -101600,14 +101719,14 @@ async function ensurePluginArtifacts(context) {
|
|
|
101600
101719
|
}
|
|
101601
101720
|
async function hasMissingPluginArtifact(pluginPath) {
|
|
101602
101721
|
for (const artifact of REQUIRED_PLUGIN_ARTIFACTS) {
|
|
101603
|
-
if (!await fileExists2(
|
|
101722
|
+
if (!await fileExists2(join61(pluginPath, artifact)))
|
|
101604
101723
|
return true;
|
|
101605
101724
|
}
|
|
101606
101725
|
return false;
|
|
101607
101726
|
}
|
|
101608
101727
|
async function verifyAstGrepRuntimeIntegrity(pluginPath, platform) {
|
|
101609
|
-
const runtimeEntry =
|
|
101610
|
-
const manifestPath =
|
|
101728
|
+
const runtimeEntry = join61(pluginPath, "runtime", "ast-grep-mcp", "cli.js");
|
|
101729
|
+
const manifestPath = join61(dirname23(runtimeEntry), "manifest.json");
|
|
101611
101730
|
let runtimeStat;
|
|
101612
101731
|
try {
|
|
101613
101732
|
runtimeStat = await stat6(runtimeEntry);
|
|
@@ -101664,9 +101783,9 @@ async function defaultRunCommand3(command, args, options) {
|
|
|
101664
101783
|
function findRepoRoot2(importerDir) {
|
|
101665
101784
|
let current = importerDir;
|
|
101666
101785
|
for (let depth = 0;depth <= 7; depth += 1) {
|
|
101667
|
-
if (fileExistsSync(
|
|
101786
|
+
if (fileExistsSync(join61(current, "packages", "omo-senpi", "plugin", "package.json")))
|
|
101668
101787
|
return current;
|
|
101669
|
-
current =
|
|
101788
|
+
current = resolve19(current, "..");
|
|
101670
101789
|
}
|
|
101671
101790
|
throw new Error("Unable to locate packages/omo-senpi/plugin/package.json from installer module");
|
|
101672
101791
|
}
|
|
@@ -101681,7 +101800,7 @@ async function fileExists2(path6) {
|
|
|
101681
101800
|
}
|
|
101682
101801
|
}
|
|
101683
101802
|
function fileExistsSync(path6) {
|
|
101684
|
-
return
|
|
101803
|
+
return existsSync31(path6);
|
|
101685
101804
|
}
|
|
101686
101805
|
function isErrno2(error51, code) {
|
|
101687
101806
|
return error51 instanceof Error && "code" in error51 && error51.code === code;
|
|
@@ -101720,26 +101839,26 @@ async function starGitHubRepositories(platform = "both", runCommand = runGitHubS
|
|
|
101720
101839
|
init_provider_availability();
|
|
101721
101840
|
|
|
101722
101841
|
// packages/omo-opencode/src/cli/config-manager/add-tui-plugin-to-tui-config.ts
|
|
101723
|
-
import { existsSync as
|
|
101724
|
-
import { join as
|
|
101842
|
+
import { existsSync as existsSync33, mkdirSync as mkdirSync11, readFileSync as readFileSync16 } from "node:fs";
|
|
101843
|
+
import { join as join63 } from "node:path";
|
|
101725
101844
|
|
|
101726
101845
|
// packages/omo-opencode/src/cli/doctor/checks/tui-plugin-config.ts
|
|
101727
101846
|
init_shared();
|
|
101728
|
-
import { existsSync as
|
|
101729
|
-
import { join as
|
|
101847
|
+
import { existsSync as existsSync32, readFileSync as readFileSync15 } from "node:fs";
|
|
101848
|
+
import { join as join62 } from "node:path";
|
|
101730
101849
|
var TUI_SUBPATH = "tui";
|
|
101731
101850
|
var TUI_EXPORT_SUBPATH = `./${TUI_SUBPATH}`;
|
|
101732
101851
|
function fileEntryPackageJsonPath(entry) {
|
|
101733
101852
|
let path6 = entry.slice("file:".length);
|
|
101734
101853
|
if (path6.startsWith("//"))
|
|
101735
101854
|
path6 = path6.slice(2);
|
|
101736
|
-
return
|
|
101855
|
+
return join62(path6, "package.json");
|
|
101737
101856
|
}
|
|
101738
101857
|
function packageJsonExportsTui(pkgJsonPath) {
|
|
101739
|
-
if (!
|
|
101858
|
+
if (!existsSync32(pkgJsonPath))
|
|
101740
101859
|
return null;
|
|
101741
101860
|
try {
|
|
101742
|
-
const parsed = JSON.parse(
|
|
101861
|
+
const parsed = JSON.parse(readFileSync15(pkgJsonPath, "utf-8"));
|
|
101743
101862
|
if (parsed.exports === undefined)
|
|
101744
101863
|
return null;
|
|
101745
101864
|
if (typeof parsed.exports === "string")
|
|
@@ -101771,16 +101890,16 @@ function packageExportsTuiForServerEntry(entry) {
|
|
|
101771
101890
|
const packageName = packageNameFromServerEntry(entry);
|
|
101772
101891
|
if (packageName === null)
|
|
101773
101892
|
return null;
|
|
101774
|
-
return packageJsonExportsTui(
|
|
101893
|
+
return packageJsonExportsTui(join62(getOpenCodeConfigDir({ binary: "opencode" }), "node_modules", packageName, "package.json"));
|
|
101775
101894
|
}
|
|
101776
101895
|
function isOurFilePluginEntry(entry) {
|
|
101777
101896
|
if (typeof entry !== "string" || !entry.startsWith("file:"))
|
|
101778
101897
|
return false;
|
|
101779
101898
|
try {
|
|
101780
101899
|
const pkgJsonPath = fileEntryPackageJsonPath(entry);
|
|
101781
|
-
if (!
|
|
101900
|
+
if (!existsSync32(pkgJsonPath))
|
|
101782
101901
|
return false;
|
|
101783
|
-
const parsed = JSON.parse(
|
|
101902
|
+
const parsed = JSON.parse(readFileSync15(pkgJsonPath, "utf-8"));
|
|
101784
101903
|
return typeof parsed.name === "string" && ACCEPTED_PACKAGE_NAMES.includes(parsed.name);
|
|
101785
101904
|
} catch (error51) {
|
|
101786
101905
|
log2("[tui-plugin-config] Failed to inspect file plugin package", {
|
|
@@ -101813,12 +101932,12 @@ function isCanonicalNamedTuiPluginEntry(entry) {
|
|
|
101813
101932
|
}
|
|
101814
101933
|
function detectServerPluginRegistration() {
|
|
101815
101934
|
const paths2 = getOpenCodeConfigPaths({ binary: "opencode", version: null });
|
|
101816
|
-
const configPath =
|
|
101935
|
+
const configPath = existsSync32(paths2.configJsonc) ? paths2.configJsonc : existsSync32(paths2.configJson) ? paths2.configJson : null;
|
|
101817
101936
|
if (!configPath) {
|
|
101818
101937
|
return { registered: false, configPath: null, entry: null, packageExportsTui: null };
|
|
101819
101938
|
}
|
|
101820
101939
|
try {
|
|
101821
|
-
const parsed = parseJsonc(
|
|
101940
|
+
const parsed = parseJsonc(readFileSync15(configPath, "utf-8"));
|
|
101822
101941
|
const plugins = parsed.plugin ?? [];
|
|
101823
101942
|
const serverEntry = plugins.find(isServerPluginEntry);
|
|
101824
101943
|
return {
|
|
@@ -101836,8 +101955,8 @@ function detectServerPluginRegistration() {
|
|
|
101836
101955
|
}
|
|
101837
101956
|
}
|
|
101838
101957
|
function detectTuiPluginRegistration() {
|
|
101839
|
-
const tuiJsonPath =
|
|
101840
|
-
if (!
|
|
101958
|
+
const tuiJsonPath = join62(getOpenCodeConfigDir({ binary: "opencode" }), "tui.json");
|
|
101959
|
+
if (!existsSync32(tuiJsonPath)) {
|
|
101841
101960
|
return {
|
|
101842
101961
|
registered: false,
|
|
101843
101962
|
configPath: tuiJsonPath,
|
|
@@ -101848,7 +101967,7 @@ function detectTuiPluginRegistration() {
|
|
|
101848
101967
|
};
|
|
101849
101968
|
}
|
|
101850
101969
|
try {
|
|
101851
|
-
const parsed = parseJsonc(
|
|
101970
|
+
const parsed = parseJsonc(readFileSync15(tuiJsonPath, "utf-8"));
|
|
101852
101971
|
const plugins = parsed.plugin ?? [];
|
|
101853
101972
|
return {
|
|
101854
101973
|
registered: plugins.some(isTuiPluginEntry),
|
|
@@ -101981,7 +102100,7 @@ init_shared();
|
|
|
101981
102100
|
init_write_file_atomically();
|
|
101982
102101
|
function readConfig(path6) {
|
|
101983
102102
|
try {
|
|
101984
|
-
const parsed = parseJsonc(
|
|
102103
|
+
const parsed = parseJsonc(readFileSync16(path6, "utf-8"));
|
|
101985
102104
|
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
101986
102105
|
return parsed;
|
|
101987
102106
|
}
|
|
@@ -101992,11 +102111,11 @@ function readConfig(path6) {
|
|
|
101992
102111
|
return null;
|
|
101993
102112
|
}
|
|
101994
102113
|
function readServerConfig(configDir) {
|
|
101995
|
-
const jsoncPath =
|
|
101996
|
-
if (
|
|
102114
|
+
const jsoncPath = join63(configDir, "opencode.jsonc");
|
|
102115
|
+
if (existsSync33(jsoncPath))
|
|
101997
102116
|
return readConfig(jsoncPath);
|
|
101998
|
-
const jsonPath =
|
|
101999
|
-
if (
|
|
102117
|
+
const jsonPath = join63(configDir, "opencode.json");
|
|
102118
|
+
if (existsSync33(jsonPath))
|
|
102000
102119
|
return readConfig(jsonPath);
|
|
102001
102120
|
return null;
|
|
102002
102121
|
}
|
|
@@ -102016,7 +102135,7 @@ function desiredTuiEntry(serverEntry) {
|
|
|
102016
102135
|
return null;
|
|
102017
102136
|
}
|
|
102018
102137
|
function readTuiConfig(tuiJsonPath) {
|
|
102019
|
-
if (!
|
|
102138
|
+
if (!existsSync33(tuiJsonPath)) {
|
|
102020
102139
|
return { config: {}, malformed: false };
|
|
102021
102140
|
}
|
|
102022
102141
|
const config3 = readConfig(tuiJsonPath);
|
|
@@ -102037,7 +102156,7 @@ function ensureTuiPluginEntry(opts = {}) {
|
|
|
102037
102156
|
if (!desiredEntry) {
|
|
102038
102157
|
return { changed: false, reason: "no-server-entry" };
|
|
102039
102158
|
}
|
|
102040
|
-
const tuiJsonPath =
|
|
102159
|
+
const tuiJsonPath = join63(configDir, "tui.json");
|
|
102041
102160
|
const { config: config3, malformed } = readTuiConfig(tuiJsonPath);
|
|
102042
102161
|
if (malformed) {
|
|
102043
102162
|
return { changed: false, reason: "malformed" };
|
|
@@ -102046,22 +102165,22 @@ function ensureTuiPluginEntry(opts = {}) {
|
|
|
102046
102165
|
if (plugins.includes(desiredEntry)) {
|
|
102047
102166
|
return { changed: false, reason: "already-present" };
|
|
102048
102167
|
}
|
|
102049
|
-
|
|
102168
|
+
mkdirSync11(configDir, { recursive: true });
|
|
102050
102169
|
writeFileAtomically2(tuiJsonPath, formatConfig({ ...config3, plugin: [...plugins, desiredEntry] }));
|
|
102051
102170
|
return { changed: true, reason: "added" };
|
|
102052
102171
|
}
|
|
102053
102172
|
|
|
102054
102173
|
// packages/omo-opencode/src/cli/install-ast-grep-sg.ts
|
|
102055
|
-
import { homedir as
|
|
102056
|
-
import { join as
|
|
102174
|
+
import { homedir as homedir11 } from "node:os";
|
|
102175
|
+
import { join as join64 } from "node:path";
|
|
102057
102176
|
|
|
102058
102177
|
// packages/shared-skills/index.mjs
|
|
102059
|
-
import { existsSync as
|
|
102178
|
+
import { existsSync as existsSync34 } from "node:fs";
|
|
102060
102179
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
102061
102180
|
var SKILLS_PROBE_SPECIFIERS = ["./skills/", "../skills/", "../../skills/"];
|
|
102062
102181
|
function sharedSkillsRootPath() {
|
|
102063
102182
|
const candidates = SKILLS_PROBE_SPECIFIERS.map((specifier) => fileURLToPath2(new URL(specifier, import.meta.url)));
|
|
102064
|
-
return candidates.find((candidate2) =>
|
|
102183
|
+
return candidates.find((candidate2) => existsSync34(candidate2)) ?? candidates[0];
|
|
102065
102184
|
}
|
|
102066
102185
|
|
|
102067
102186
|
// packages/omo-opencode/src/cli/install-ast-grep-sg.ts
|
|
@@ -102075,9 +102194,9 @@ function describeResult2(result) {
|
|
|
102075
102194
|
}
|
|
102076
102195
|
async function installAstGrepForOpenCode(options = {}) {
|
|
102077
102196
|
const platform = options.platform ?? process.platform;
|
|
102078
|
-
const baseDir =
|
|
102197
|
+
const baseDir = join64(options.homeDir ?? homedir11(), ".omo");
|
|
102079
102198
|
const targetDir = astGrepRuntimeDir(baseDir, platform, options.arch ?? process.arch);
|
|
102080
|
-
const skillDir =
|
|
102199
|
+
const skillDir = join64(options.sharedSkillsRoot ?? sharedSkillsRootPath(), "ast-grep");
|
|
102081
102200
|
const installer = options.installer ?? runAstGrepSkillInstall;
|
|
102082
102201
|
try {
|
|
102083
102202
|
const result = await installer({ platform, skillDir, targetDir });
|
|
@@ -105880,7 +105999,7 @@ var import_picocolors11 = __toESM(require_picocolors(), 1);
|
|
|
105880
105999
|
// packages/omo-opencode/src/cli/run/opencode-binary-resolver.ts
|
|
105881
106000
|
init_bun_which_shim();
|
|
105882
106001
|
init_spawn_with_windows_hide();
|
|
105883
|
-
import { delimiter as delimiter2, dirname as
|
|
106002
|
+
import { delimiter as delimiter2, dirname as dirname24, posix as posix9, win32 as win325 } from "node:path";
|
|
105884
106003
|
var OPENCODE_COMMANDS = ["opencode", "opencode-desktop"];
|
|
105885
106004
|
var WINDOWS_SUFFIXES = ["", ".exe", ".cmd", ".bat", ".ps1"];
|
|
105886
106005
|
function getCommandCandidates(platform) {
|
|
@@ -105938,7 +106057,7 @@ async function findWorkingOpencodeBinary(pathEnv = process.env.PATH, probe2 = ca
|
|
|
105938
106057
|
return null;
|
|
105939
106058
|
}
|
|
105940
106059
|
function buildPathWithBinaryFirst(pathEnv, binaryPath) {
|
|
105941
|
-
const preferredDir =
|
|
106060
|
+
const preferredDir = dirname24(binaryPath);
|
|
105942
106061
|
const existing = (pathEnv ?? "").split(delimiter2).filter((entry) => entry.length > 0 && entry !== preferredDir);
|
|
105943
106062
|
return [preferredDir, ...existing].join(delimiter2);
|
|
105944
106063
|
}
|
|
@@ -106107,7 +106226,7 @@ async function resolveSession(options) {
|
|
|
106107
106226
|
if (attempt < SESSION_CREATE_MAX_RETRIES) {
|
|
106108
106227
|
const delay2 = retryDelayMs * attempt;
|
|
106109
106228
|
console.log(import_picocolors12.default.dim(` Retrying in ${delay2}ms...`));
|
|
106110
|
-
await new Promise((
|
|
106229
|
+
await new Promise((resolve20) => setTimeout(resolve20, delay2));
|
|
106111
106230
|
}
|
|
106112
106231
|
continue;
|
|
106113
106232
|
}
|
|
@@ -106118,7 +106237,7 @@ async function resolveSession(options) {
|
|
|
106118
106237
|
if (attempt < SESSION_CREATE_MAX_RETRIES) {
|
|
106119
106238
|
const delay2 = retryDelayMs * attempt;
|
|
106120
106239
|
console.log(import_picocolors12.default.dim(` Retrying in ${delay2}ms...`));
|
|
106121
|
-
await new Promise((
|
|
106240
|
+
await new Promise((resolve20) => setTimeout(resolve20, delay2));
|
|
106122
106241
|
}
|
|
106123
106242
|
}
|
|
106124
106243
|
throw new Error("Failed to create session after all retries");
|
|
@@ -106516,26 +106635,26 @@ function isClosingFence(line, fence) {
|
|
|
106516
106635
|
return run?.charAt(0) === fence.marker && run.length >= fence.length;
|
|
106517
106636
|
}
|
|
106518
106637
|
// packages/boulder-state/src/top-level-task.ts
|
|
106519
|
-
import { existsSync as
|
|
106638
|
+
import { existsSync as existsSync35, readFileSync as readFileSync17 } from "node:fs";
|
|
106520
106639
|
function readCurrentTopLevelTask(planPath) {
|
|
106521
|
-
if (!
|
|
106640
|
+
if (!existsSync35(planPath)) {
|
|
106522
106641
|
return null;
|
|
106523
106642
|
}
|
|
106524
106643
|
try {
|
|
106525
|
-
const content =
|
|
106644
|
+
const content = readFileSync17(planPath, "utf-8");
|
|
106526
106645
|
return parseCurrentTopLevelTask(content);
|
|
106527
106646
|
} catch {
|
|
106528
106647
|
return null;
|
|
106529
106648
|
}
|
|
106530
106649
|
}
|
|
106531
106650
|
// packages/boulder-state/src/storage/path.ts
|
|
106532
|
-
import { existsSync as
|
|
106533
|
-
import { isAbsolute as isAbsolute11, join as
|
|
106651
|
+
import { existsSync as existsSync36 } from "node:fs";
|
|
106652
|
+
import { isAbsolute as isAbsolute11, join as join65, relative as relative8, resolve as resolve20 } from "node:path";
|
|
106534
106653
|
function getBoulderFilePath(directory) {
|
|
106535
|
-
return
|
|
106654
|
+
return join65(directory, BOULDER_DIR, BOULDER_FILE);
|
|
106536
106655
|
}
|
|
106537
106656
|
function resolveTrackedPath(baseDirectory, trackedPath) {
|
|
106538
|
-
return isAbsolute11(trackedPath) ?
|
|
106657
|
+
return isAbsolute11(trackedPath) ? resolve20(trackedPath) : resolve20(baseDirectory, trackedPath);
|
|
106539
106658
|
}
|
|
106540
106659
|
function resolveBoulderPlanPath(directory, state) {
|
|
106541
106660
|
const absolutePlanPath = resolveTrackedPath(directory, state.active_plan);
|
|
@@ -106543,26 +106662,26 @@ function resolveBoulderPlanPath(directory, state) {
|
|
|
106543
106662
|
if (!worktreePath) {
|
|
106544
106663
|
return absolutePlanPath;
|
|
106545
106664
|
}
|
|
106546
|
-
const absoluteDirectory =
|
|
106665
|
+
const absoluteDirectory = resolve20(directory);
|
|
106547
106666
|
const relativePlanPath = relative8(absoluteDirectory, absolutePlanPath);
|
|
106548
106667
|
if (relativePlanPath.length === 0 || relativePlanPath.startsWith("..") || isAbsolute11(relativePlanPath)) {
|
|
106549
106668
|
return absolutePlanPath;
|
|
106550
106669
|
}
|
|
106551
106670
|
const absoluteWorktreePath = resolveTrackedPath(directory, worktreePath);
|
|
106552
|
-
const worktreePlanPath =
|
|
106553
|
-
return
|
|
106671
|
+
const worktreePlanPath = resolve20(absoluteWorktreePath, relativePlanPath);
|
|
106672
|
+
return existsSync36(worktreePlanPath) ? worktreePlanPath : absolutePlanPath;
|
|
106554
106673
|
}
|
|
106555
106674
|
function resolveBoulderPlanPathForWork(directory, work) {
|
|
106556
106675
|
return resolveBoulderPlanPath(directory, work);
|
|
106557
106676
|
}
|
|
106558
106677
|
// packages/boulder-state/src/storage/plan-progress.ts
|
|
106559
|
-
import { existsSync as
|
|
106678
|
+
import { existsSync as existsSync37, readFileSync as readFileSync18, readdirSync as readdirSync7, statSync as statSync4 } from "node:fs";
|
|
106560
106679
|
function getPlanProgress(planPath) {
|
|
106561
|
-
if (!
|
|
106680
|
+
if (!existsSync37(planPath)) {
|
|
106562
106681
|
return { total: 0, completed: 0, isComplete: false };
|
|
106563
106682
|
}
|
|
106564
106683
|
try {
|
|
106565
|
-
const content =
|
|
106684
|
+
const content = readFileSync18(planPath, "utf-8");
|
|
106566
106685
|
const checklist = parsePlanChecklist(content);
|
|
106567
106686
|
return {
|
|
106568
106687
|
total: checklist.total,
|
|
@@ -106641,14 +106760,14 @@ function selectMirrorWork(state) {
|
|
|
106641
106760
|
return sorted[0] ?? null;
|
|
106642
106761
|
}
|
|
106643
106762
|
// packages/boulder-state/src/storage/read-state.ts
|
|
106644
|
-
import { existsSync as
|
|
106763
|
+
import { existsSync as existsSync38, readFileSync as readFileSync19 } from "node:fs";
|
|
106645
106764
|
function readBoulderState(directory) {
|
|
106646
106765
|
const filePath = getBoulderFilePath(directory);
|
|
106647
|
-
if (!
|
|
106766
|
+
if (!existsSync38(filePath)) {
|
|
106648
106767
|
return null;
|
|
106649
106768
|
}
|
|
106650
106769
|
try {
|
|
106651
|
-
const content =
|
|
106770
|
+
const content = readFileSync19(filePath, "utf-8");
|
|
106652
106771
|
const parsed = JSON.parse(content);
|
|
106653
106772
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed) || Object.keys(parsed).length === 0) {
|
|
106654
106773
|
return null;
|
|
@@ -106714,17 +106833,17 @@ init_state();
|
|
|
106714
106833
|
// packages/omo-opencode/src/features/run-continuation-state/constants.ts
|
|
106715
106834
|
var CONTINUATION_MARKER_DIR = ".omo/run-continuation";
|
|
106716
106835
|
// packages/omo-opencode/src/features/run-continuation-state/storage.ts
|
|
106717
|
-
import { existsSync as
|
|
106718
|
-
import { join as
|
|
106836
|
+
import { existsSync as existsSync39, mkdirSync as mkdirSync12, readFileSync as readFileSync20, rmSync as rmSync2, writeFileSync as writeFileSync7 } from "node:fs";
|
|
106837
|
+
import { join as join66 } from "node:path";
|
|
106719
106838
|
function getMarkerPath(directory, sessionID) {
|
|
106720
|
-
return
|
|
106839
|
+
return join66(directory, CONTINUATION_MARKER_DIR, `${sessionID}.json`);
|
|
106721
106840
|
}
|
|
106722
106841
|
function readContinuationMarker(directory, sessionID) {
|
|
106723
106842
|
const markerPath = getMarkerPath(directory, sessionID);
|
|
106724
|
-
if (!
|
|
106843
|
+
if (!existsSync39(markerPath))
|
|
106725
106844
|
return null;
|
|
106726
106845
|
try {
|
|
106727
|
-
const raw =
|
|
106846
|
+
const raw = readFileSync20(markerPath, "utf-8");
|
|
106728
106847
|
const parsed = JSON.parse(raw);
|
|
106729
106848
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed))
|
|
106730
106849
|
return null;
|
|
@@ -106789,8 +106908,8 @@ async function isSessionInBoulderLineage(input) {
|
|
|
106789
106908
|
// packages/omo-opencode/src/hooks/atlas/session-last-agent.ts
|
|
106790
106909
|
init_shared();
|
|
106791
106910
|
init_compaction_marker();
|
|
106792
|
-
import { readFileSync as
|
|
106793
|
-
import { join as
|
|
106911
|
+
import { readFileSync as readFileSync21, readdirSync as readdirSync8 } from "node:fs";
|
|
106912
|
+
import { join as join67 } from "node:path";
|
|
106794
106913
|
var defaultSessionLastAgentDeps = {
|
|
106795
106914
|
getMessageDir,
|
|
106796
106915
|
isSqliteBackend,
|
|
@@ -106850,7 +106969,7 @@ async function getLastAgentFromSession(sessionID, client3, deps = {}) {
|
|
|
106850
106969
|
try {
|
|
106851
106970
|
const messages = readdirSync8(messageDir).filter((fileName) => fileName.endsWith(".json")).map((fileName) => {
|
|
106852
106971
|
try {
|
|
106853
|
-
const content =
|
|
106972
|
+
const content = readFileSync21(join67(messageDir, fileName), "utf-8");
|
|
106854
106973
|
const parsed = JSON.parse(content);
|
|
106855
106974
|
return {
|
|
106856
106975
|
fileName,
|
|
@@ -106893,8 +107012,8 @@ init_agent_display_names();
|
|
|
106893
107012
|
|
|
106894
107013
|
// packages/omo-opencode/src/hooks/ralph-loop/storage.ts
|
|
106895
107014
|
init_frontmatter2();
|
|
106896
|
-
import { existsSync as
|
|
106897
|
-
import { dirname as
|
|
107015
|
+
import { existsSync as existsSync40, readFileSync as readFileSync22, writeFileSync as writeFileSync8, unlinkSync as unlinkSync6, mkdirSync as mkdirSync13 } from "node:fs";
|
|
107016
|
+
import { dirname as dirname25, join as join68 } from "node:path";
|
|
106898
107017
|
|
|
106899
107018
|
// packages/omo-opencode/src/hooks/ralph-loop/constants.ts
|
|
106900
107019
|
var DEFAULT_STATE_FILE = ".omo/ralph-loop.local.md";
|
|
@@ -106903,15 +107022,15 @@ var DEFAULT_COMPLETION_PROMISE = "DONE";
|
|
|
106903
107022
|
|
|
106904
107023
|
// packages/omo-opencode/src/hooks/ralph-loop/storage.ts
|
|
106905
107024
|
function getStateFilePath(directory, customPath) {
|
|
106906
|
-
return customPath ?
|
|
107025
|
+
return customPath ? join68(directory, customPath) : join68(directory, DEFAULT_STATE_FILE);
|
|
106907
107026
|
}
|
|
106908
107027
|
function readState(directory, customPath) {
|
|
106909
107028
|
const filePath = getStateFilePath(directory, customPath);
|
|
106910
|
-
if (!
|
|
107029
|
+
if (!existsSync40(filePath)) {
|
|
106911
107030
|
return null;
|
|
106912
107031
|
}
|
|
106913
107032
|
try {
|
|
106914
|
-
const content =
|
|
107033
|
+
const content = readFileSync22(filePath, "utf-8");
|
|
106915
107034
|
const { data, body } = parseFrontmatter(content);
|
|
106916
107035
|
const active = data.active;
|
|
106917
107036
|
const iteration = data.iteration;
|
|
@@ -107137,7 +107256,7 @@ async function pollForCompletion(ctx, eventState, abortController, options = {})
|
|
|
107137
107256
|
const secondaryMeaningfulWorkTimeoutMs = options.secondaryMeaningfulWorkTimeoutMs ?? DEFAULT_SECONDARY_MEANINGFUL_WORK_TIMEOUT_MS;
|
|
107138
107257
|
const requireMeaningfulWork = options.requireMeaningfulWork ?? false;
|
|
107139
107258
|
const now = options.now ?? Date.now;
|
|
107140
|
-
const sleep = options.sleep ?? ((ms) => new Promise((
|
|
107259
|
+
const sleep = options.sleep ?? ((ms) => new Promise((resolve21) => setTimeout(resolve21, ms)));
|
|
107141
107260
|
let consecutiveCompleteChecks = 0;
|
|
107142
107261
|
let errorCycleCount = 0;
|
|
107143
107262
|
let firstWorkTimestamp = null;
|
|
@@ -107302,7 +107421,7 @@ function createAbortError() {
|
|
|
107302
107421
|
return error51;
|
|
107303
107422
|
}
|
|
107304
107423
|
function sleep(delayMs) {
|
|
107305
|
-
return new Promise((
|
|
107424
|
+
return new Promise((resolve21) => setTimeout(resolve21, delayMs));
|
|
107306
107425
|
}
|
|
107307
107426
|
function hasPromptStartEvidence(eventState) {
|
|
107308
107427
|
return eventState.mainSessionStarted || eventState.hasReceivedMeaningfulWork || eventState.messageCount > 0 || eventState.currentTool !== null;
|
|
@@ -107677,7 +107796,7 @@ var EVENT_PROCESSOR_SHUTDOWN_TIMEOUT_MS = 2000;
|
|
|
107677
107796
|
async function waitForEventProcessorShutdown(eventProcessor, timeoutMs = EVENT_PROCESSOR_SHUTDOWN_TIMEOUT_MS) {
|
|
107678
107797
|
const completed = await Promise.race([
|
|
107679
107798
|
eventProcessor.then(() => true),
|
|
107680
|
-
new Promise((
|
|
107799
|
+
new Promise((resolve21) => setTimeout(() => resolve21(false), timeoutMs))
|
|
107681
107800
|
]);
|
|
107682
107801
|
}
|
|
107683
107802
|
async function run(options) {
|
|
@@ -107740,10 +107859,10 @@ Interrupted. Shutting down...`));
|
|
|
107740
107859
|
abortController,
|
|
107741
107860
|
verbose: options.verbose ?? false
|
|
107742
107861
|
};
|
|
107743
|
-
const
|
|
107862
|
+
const events2 = await client3.event.subscribe({ query: { directory } });
|
|
107744
107863
|
const eventState = createEventState();
|
|
107745
107864
|
eventState.agentColorsByName = await loadAgentProfileColors(client3);
|
|
107746
|
-
const eventProcessor = processEvents(ctx,
|
|
107865
|
+
const eventProcessor = processEvents(ctx, events2.stream, eventState).catch(() => {});
|
|
107747
107866
|
const promptResult = await dispatchInternalPrompt({
|
|
107748
107867
|
mode: "async",
|
|
107749
107868
|
client: client3,
|
|
@@ -108003,14 +108122,14 @@ async function getLocalVersion(options = {}) {
|
|
|
108003
108122
|
}
|
|
108004
108123
|
}
|
|
108005
108124
|
// packages/omo-opencode/src/cli/doctor/checks/system.ts
|
|
108006
|
-
import { existsSync as
|
|
108125
|
+
import { existsSync as existsSync51, readFileSync as readFileSync32 } from "node:fs";
|
|
108007
108126
|
|
|
108008
108127
|
// packages/omo-opencode/src/cli/doctor/checks/system-binary.ts
|
|
108009
108128
|
init_extract_semver();
|
|
108010
108129
|
init_bun_which_shim();
|
|
108011
|
-
import { existsSync as
|
|
108012
|
-
import { homedir as
|
|
108013
|
-
import { join as
|
|
108130
|
+
import { existsSync as existsSync48, accessSync as accessSync4, constants as constants11 } from "node:fs";
|
|
108131
|
+
import { homedir as homedir14 } from "node:os";
|
|
108132
|
+
import { join as join75 } from "node:path";
|
|
108014
108133
|
|
|
108015
108134
|
// packages/omo-opencode/src/cli/doctor/framework/spawn-with-timeout.ts
|
|
108016
108135
|
init_spawn_with_windows_hide();
|
|
@@ -108049,8 +108168,8 @@ async function spawnWithTimeout(command, options, timeoutMs = DEFAULT_SPAWN_TIME
|
|
|
108049
108168
|
const stdoutPromise = readSpawnStream(proc.stdout);
|
|
108050
108169
|
const stderrPromise = readSpawnStream(proc.stderr);
|
|
108051
108170
|
let timer;
|
|
108052
|
-
const timeoutPromise = new Promise((
|
|
108053
|
-
timer = setTimeout(() =>
|
|
108171
|
+
const timeoutPromise = new Promise((resolve21) => {
|
|
108172
|
+
timer = setTimeout(() => resolve21("timeout"), timeoutMs);
|
|
108054
108173
|
});
|
|
108055
108174
|
const processPromise = (async () => {
|
|
108056
108175
|
await proc.exited;
|
|
@@ -108097,22 +108216,22 @@ function isExecutable2(path12) {
|
|
|
108097
108216
|
}
|
|
108098
108217
|
}
|
|
108099
108218
|
function getDesktopAppPaths(platform) {
|
|
108100
|
-
const home =
|
|
108219
|
+
const home = homedir14();
|
|
108101
108220
|
switch (platform) {
|
|
108102
108221
|
case "darwin":
|
|
108103
108222
|
return [
|
|
108104
108223
|
"/Applications/OpenCode.app/Contents/MacOS/OpenCode",
|
|
108105
|
-
|
|
108224
|
+
join75(home, "Applications", "OpenCode.app", "Contents", "MacOS", "OpenCode")
|
|
108106
108225
|
];
|
|
108107
108226
|
case "win32": {
|
|
108108
108227
|
const programFiles = process.env.ProgramFiles;
|
|
108109
108228
|
const localAppData = process.env.LOCALAPPDATA;
|
|
108110
108229
|
const paths2 = [];
|
|
108111
108230
|
if (programFiles) {
|
|
108112
|
-
paths2.push(
|
|
108231
|
+
paths2.push(join75(programFiles, "OpenCode", "OpenCode.exe"));
|
|
108113
108232
|
}
|
|
108114
108233
|
if (localAppData) {
|
|
108115
|
-
paths2.push(
|
|
108234
|
+
paths2.push(join75(localAppData, "OpenCode", "OpenCode.exe"));
|
|
108116
108235
|
}
|
|
108117
108236
|
return paths2;
|
|
108118
108237
|
}
|
|
@@ -108120,8 +108239,8 @@ function getDesktopAppPaths(platform) {
|
|
|
108120
108239
|
return [
|
|
108121
108240
|
"/usr/bin/opencode",
|
|
108122
108241
|
"/usr/lib/opencode/opencode",
|
|
108123
|
-
|
|
108124
|
-
|
|
108242
|
+
join75(home, "Applications", "opencode-desktop-linux-x86_64.AppImage"),
|
|
108243
|
+
join75(home, "Applications", "opencode-desktop-linux-aarch64.AppImage")
|
|
108125
108244
|
];
|
|
108126
108245
|
default:
|
|
108127
108246
|
return [];
|
|
@@ -108133,7 +108252,7 @@ function buildVersionCommand(binaryPath, platform) {
|
|
|
108133
108252
|
}
|
|
108134
108253
|
return [binaryPath, "--version"];
|
|
108135
108254
|
}
|
|
108136
|
-
function findDesktopBinary(platform = process.platform, checkExists =
|
|
108255
|
+
function findDesktopBinary(platform = process.platform, checkExists = existsSync48) {
|
|
108137
108256
|
for (const desktopPath of getDesktopAppPaths(platform)) {
|
|
108138
108257
|
if (checkExists(desktopPath)) {
|
|
108139
108258
|
return { binary: "opencode", path: desktopPath };
|
|
@@ -108141,7 +108260,7 @@ function findDesktopBinary(platform = process.platform, checkExists = existsSync
|
|
|
108141
108260
|
}
|
|
108142
108261
|
return null;
|
|
108143
108262
|
}
|
|
108144
|
-
async function findOpenCodeBinary(platform = process.platform, checkExists =
|
|
108263
|
+
async function findOpenCodeBinary(platform = process.platform, checkExists = existsSync48) {
|
|
108145
108264
|
for (const binary of OPENCODE_BINARIES2) {
|
|
108146
108265
|
const path12 = bunWhich(binary);
|
|
108147
108266
|
if (path12 && checkExists(path12)) {
|
|
@@ -108153,7 +108272,7 @@ async function findOpenCodeBinary(platform = process.platform, checkExists = exi
|
|
|
108153
108272
|
const candidates = getCommandCandidates2(platform);
|
|
108154
108273
|
for (const entry of pathEnv.split(delimiter3).filter(Boolean)) {
|
|
108155
108274
|
for (const command of candidates) {
|
|
108156
|
-
const fullPath =
|
|
108275
|
+
const fullPath = join75(entry, command);
|
|
108157
108276
|
if (checkExists(fullPath) && isExecutable2(fullPath)) {
|
|
108158
108277
|
return { binary: command, path: fullPath };
|
|
108159
108278
|
}
|
|
@@ -108199,12 +108318,12 @@ function compareVersions3(current, minimum) {
|
|
|
108199
108318
|
|
|
108200
108319
|
// packages/omo-opencode/src/cli/doctor/checks/system-plugin.ts
|
|
108201
108320
|
init_shared();
|
|
108202
|
-
import { existsSync as
|
|
108321
|
+
import { existsSync as existsSync49, readFileSync as readFileSync30 } from "node:fs";
|
|
108203
108322
|
function detectConfigPath() {
|
|
108204
108323
|
const paths2 = getOpenCodeConfigPaths({ binary: "opencode", version: null });
|
|
108205
|
-
if (
|
|
108324
|
+
if (existsSync49(paths2.configJsonc))
|
|
108206
108325
|
return paths2.configJsonc;
|
|
108207
|
-
if (
|
|
108326
|
+
if (existsSync49(paths2.configJson))
|
|
108208
108327
|
return paths2.configJson;
|
|
108209
108328
|
return null;
|
|
108210
108329
|
}
|
|
@@ -108250,7 +108369,7 @@ function getPluginInfo() {
|
|
|
108250
108369
|
};
|
|
108251
108370
|
}
|
|
108252
108371
|
try {
|
|
108253
|
-
const content =
|
|
108372
|
+
const content = readFileSync30(configPath, "utf-8");
|
|
108254
108373
|
const parsedConfig = parseJsonc(content);
|
|
108255
108374
|
const pluginEntry = findPluginEntry2(parsedConfig.plugin ?? []);
|
|
108256
108375
|
if (!pluginEntry) {
|
|
@@ -108292,39 +108411,39 @@ init_file_utils2();
|
|
|
108292
108411
|
init_checker();
|
|
108293
108412
|
init_auto_update_checker();
|
|
108294
108413
|
init_package_json_locator();
|
|
108295
|
-
import { existsSync as
|
|
108414
|
+
import { existsSync as existsSync50, readFileSync as readFileSync31, readdirSync as readdirSync10 } from "node:fs";
|
|
108296
108415
|
import { createRequire as createRequire3 } from "node:module";
|
|
108297
|
-
import { homedir as
|
|
108298
|
-
import { join as
|
|
108416
|
+
import { homedir as homedir15 } from "node:os";
|
|
108417
|
+
import { join as join76 } from "node:path";
|
|
108299
108418
|
import { fileURLToPath as fileURLToPath6 } from "node:url";
|
|
108300
108419
|
init_shared();
|
|
108301
108420
|
function getPlatformDefaultCacheDir(platform = process.platform) {
|
|
108302
108421
|
if (platform === "darwin")
|
|
108303
|
-
return
|
|
108422
|
+
return join76(homedir15(), "Library", "Caches");
|
|
108304
108423
|
if (platform === "win32")
|
|
108305
|
-
return process.env.LOCALAPPDATA ??
|
|
108306
|
-
return
|
|
108424
|
+
return process.env.LOCALAPPDATA ?? join76(homedir15(), "AppData", "Local");
|
|
108425
|
+
return join76(homedir15(), ".cache");
|
|
108307
108426
|
}
|
|
108308
108427
|
function resolveOpenCodeCacheDir() {
|
|
108309
108428
|
const xdgCacheHome = process.env.XDG_CACHE_HOME;
|
|
108310
108429
|
if (xdgCacheHome)
|
|
108311
|
-
return
|
|
108430
|
+
return join76(xdgCacheHome, "opencode");
|
|
108312
108431
|
const fromShared = getOpenCodeCacheDir();
|
|
108313
|
-
const platformDefault =
|
|
108314
|
-
if (
|
|
108432
|
+
const platformDefault = join76(getPlatformDefaultCacheDir(), "opencode");
|
|
108433
|
+
if (existsSync50(fromShared) || !existsSync50(platformDefault))
|
|
108315
108434
|
return fromShared;
|
|
108316
108435
|
return platformDefault;
|
|
108317
108436
|
}
|
|
108318
108437
|
function resolveExistingDir(dirPath) {
|
|
108319
|
-
if (!
|
|
108438
|
+
if (!existsSync50(dirPath))
|
|
108320
108439
|
return dirPath;
|
|
108321
108440
|
return resolveSymlink(dirPath);
|
|
108322
108441
|
}
|
|
108323
108442
|
function readPackageJson(filePath) {
|
|
108324
|
-
if (!
|
|
108443
|
+
if (!existsSync50(filePath))
|
|
108325
108444
|
return null;
|
|
108326
108445
|
try {
|
|
108327
|
-
const content =
|
|
108446
|
+
const content = readFileSync31(filePath, "utf-8");
|
|
108328
108447
|
return parseJsonc(content);
|
|
108329
108448
|
} catch (error51) {
|
|
108330
108449
|
if (!(error51 instanceof Error)) {
|
|
@@ -108342,26 +108461,26 @@ function normalizeVersion(value) {
|
|
|
108342
108461
|
function createPackageCandidates(rootDir) {
|
|
108343
108462
|
return ACCEPTED_PACKAGE_NAMES.map((packageName) => ({
|
|
108344
108463
|
packageName,
|
|
108345
|
-
installedPackagePath:
|
|
108464
|
+
installedPackagePath: join76(rootDir, "node_modules", packageName, "package.json")
|
|
108346
108465
|
}));
|
|
108347
108466
|
}
|
|
108348
108467
|
function createTaggedInstallCandidates(rootDir) {
|
|
108349
|
-
const packagesDir =
|
|
108350
|
-
if (!
|
|
108468
|
+
const packagesDir = join76(rootDir, "packages");
|
|
108469
|
+
if (!existsSync50(packagesDir))
|
|
108351
108470
|
return [];
|
|
108352
108471
|
const candidates = [];
|
|
108353
108472
|
for (const entryName of readdirSync10(packagesDir).sort()) {
|
|
108354
108473
|
const packageName = ACCEPTED_PACKAGE_NAMES.find((name) => entryName.startsWith(`${name}@`));
|
|
108355
108474
|
if (packageName === undefined)
|
|
108356
108475
|
continue;
|
|
108357
|
-
const installDir =
|
|
108476
|
+
const installDir = join76(packagesDir, entryName);
|
|
108358
108477
|
candidates.push({
|
|
108359
108478
|
cacheDir: installDir,
|
|
108360
|
-
cachePackagePath:
|
|
108479
|
+
cachePackagePath: join76(installDir, "package.json"),
|
|
108361
108480
|
packageCandidates: [
|
|
108362
108481
|
{
|
|
108363
108482
|
packageName,
|
|
108364
|
-
installedPackagePath:
|
|
108483
|
+
installedPackagePath: join76(installDir, "node_modules", packageName, "package.json")
|
|
108365
108484
|
}
|
|
108366
108485
|
]
|
|
108367
108486
|
});
|
|
@@ -108369,7 +108488,7 @@ function createTaggedInstallCandidates(rootDir) {
|
|
|
108369
108488
|
return candidates;
|
|
108370
108489
|
}
|
|
108371
108490
|
function selectInstalledPackage(candidate2) {
|
|
108372
|
-
return candidate2.packageCandidates.find((packageCandidate) =>
|
|
108491
|
+
return candidate2.packageCandidates.find((packageCandidate) => existsSync50(packageCandidate.installedPackagePath)) ?? candidate2.packageCandidates[0];
|
|
108373
108492
|
}
|
|
108374
108493
|
function getExpectedVersion(cachePackage, packageName) {
|
|
108375
108494
|
return normalizeVersion(cachePackage?.dependencies?.[packageName]) ?? normalizeVersion(cachePackage?.dependencies?.[PACKAGE_NAME]);
|
|
@@ -108380,7 +108499,7 @@ function resolveInstalledPackageJsonPath() {
|
|
|
108380
108499
|
for (const packageName of ACCEPTED_PACKAGE_NAMES) {
|
|
108381
108500
|
try {
|
|
108382
108501
|
const packageJsonPath = require2.resolve(`${packageName}/package.json`);
|
|
108383
|
-
if (
|
|
108502
|
+
if (existsSync50(packageJsonPath)) {
|
|
108384
108503
|
return { packageName, packageJsonPath };
|
|
108385
108504
|
}
|
|
108386
108505
|
} catch {
|
|
@@ -108406,22 +108525,22 @@ function getLoadedPluginVersion() {
|
|
|
108406
108525
|
const candidates = [
|
|
108407
108526
|
{
|
|
108408
108527
|
cacheDir: configDir,
|
|
108409
|
-
cachePackagePath:
|
|
108528
|
+
cachePackagePath: join76(configDir, "package.json"),
|
|
108410
108529
|
packageCandidates: createPackageCandidates(configDir)
|
|
108411
108530
|
},
|
|
108412
108531
|
...createTaggedInstallCandidates(configDir),
|
|
108413
108532
|
{
|
|
108414
108533
|
cacheDir,
|
|
108415
|
-
cachePackagePath:
|
|
108534
|
+
cachePackagePath: join76(cacheDir, "package.json"),
|
|
108416
108535
|
packageCandidates: createPackageCandidates(cacheDir)
|
|
108417
108536
|
},
|
|
108418
108537
|
...createTaggedInstallCandidates(cacheDir)
|
|
108419
108538
|
];
|
|
108420
|
-
const selectedCandidate = candidates.find((candidate2) => candidate2.packageCandidates.some((packageCandidate) =>
|
|
108539
|
+
const selectedCandidate = candidates.find((candidate2) => candidate2.packageCandidates.some((packageCandidate) => existsSync50(packageCandidate.installedPackagePath))) ?? candidates[0];
|
|
108421
108540
|
const { cacheDir: selectedDir, cachePackagePath } = selectedCandidate;
|
|
108422
108541
|
const selectedPackage = selectInstalledPackage(selectedCandidate);
|
|
108423
108542
|
const candidateInstalledPath = selectedPackage.installedPackagePath;
|
|
108424
|
-
const candidateExists =
|
|
108543
|
+
const candidateExists = existsSync50(candidateInstalledPath);
|
|
108425
108544
|
const resolvedFallback = candidateExists ? null : resolveInstalledPackageJsonPath();
|
|
108426
108545
|
const installedPackagePath = resolvedFallback?.packageJsonPath ?? candidateInstalledPath;
|
|
108427
108546
|
const resolvedPackageName = resolvedFallback?.packageName ?? selectedPackage.packageName;
|
|
@@ -108457,8 +108576,8 @@ var defaultDeps6 = {
|
|
|
108457
108576
|
getLoadedPluginVersion,
|
|
108458
108577
|
getLatestPluginVersion,
|
|
108459
108578
|
getSuggestedInstallTag,
|
|
108460
|
-
configExists:
|
|
108461
|
-
readConfigFile: (path12) =>
|
|
108579
|
+
configExists: existsSync51,
|
|
108580
|
+
readConfigFile: (path12) => readFileSync32(path12, "utf-8"),
|
|
108462
108581
|
parseConfigContent: (content) => parseJsonc(content)
|
|
108463
108582
|
};
|
|
108464
108583
|
var BUN_POSTINSTALL_HELPER_PACKAGE_NAME = "@code-yeongyu/comment-checker";
|
|
@@ -108603,26 +108722,26 @@ async function checkSystem(deps = defaultDeps6) {
|
|
|
108603
108722
|
|
|
108604
108723
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-cache.ts
|
|
108605
108724
|
init_shared();
|
|
108606
|
-
import { existsSync as
|
|
108607
|
-
import { homedir as
|
|
108608
|
-
import { join as
|
|
108725
|
+
import { existsSync as existsSync52, readFileSync as readFileSync33 } from "node:fs";
|
|
108726
|
+
import { homedir as homedir16 } from "node:os";
|
|
108727
|
+
import { join as join77 } from "node:path";
|
|
108609
108728
|
function getUserConfigDir2() {
|
|
108610
108729
|
const xdgConfig = process.env.XDG_CONFIG_HOME;
|
|
108611
108730
|
if (xdgConfig)
|
|
108612
|
-
return
|
|
108613
|
-
return
|
|
108731
|
+
return join77(xdgConfig, "opencode");
|
|
108732
|
+
return join77(homedir16(), ".config", "opencode");
|
|
108614
108733
|
}
|
|
108615
108734
|
function loadCustomProviderNames() {
|
|
108616
108735
|
const configDir = getUserConfigDir2();
|
|
108617
108736
|
const candidatePaths = [
|
|
108618
|
-
|
|
108619
|
-
|
|
108737
|
+
join77(configDir, "opencode.json"),
|
|
108738
|
+
join77(configDir, "opencode.jsonc")
|
|
108620
108739
|
];
|
|
108621
108740
|
for (const configPath of candidatePaths) {
|
|
108622
|
-
if (!
|
|
108741
|
+
if (!existsSync52(configPath))
|
|
108623
108742
|
continue;
|
|
108624
108743
|
try {
|
|
108625
|
-
const content =
|
|
108744
|
+
const content = readFileSync33(configPath, "utf-8");
|
|
108626
108745
|
const data = parseJsonc(content);
|
|
108627
108746
|
if (data?.provider && typeof data.provider === "object") {
|
|
108628
108747
|
return Object.keys(data.provider);
|
|
@@ -108637,16 +108756,16 @@ function loadCustomProviderNames() {
|
|
|
108637
108756
|
return [];
|
|
108638
108757
|
}
|
|
108639
108758
|
function loadAvailableModelsFromCache() {
|
|
108640
|
-
const cacheFile =
|
|
108759
|
+
const cacheFile = join77(getOpenCodeCacheDir(), "models.json");
|
|
108641
108760
|
const customProviders = loadCustomProviderNames();
|
|
108642
|
-
if (!
|
|
108761
|
+
if (!existsSync52(cacheFile)) {
|
|
108643
108762
|
if (customProviders.length > 0) {
|
|
108644
108763
|
return { providers: customProviders, modelCount: 0, cacheExists: true };
|
|
108645
108764
|
}
|
|
108646
108765
|
return { providers: [], modelCount: 0, cacheExists: false };
|
|
108647
108766
|
}
|
|
108648
108767
|
try {
|
|
108649
|
-
const content =
|
|
108768
|
+
const content = readFileSync33(cacheFile, "utf-8");
|
|
108650
108769
|
const data = parseJsonc(content);
|
|
108651
108770
|
const cacheProviders = Object.keys(data);
|
|
108652
108771
|
let modelCount = 0;
|
|
@@ -108699,7 +108818,7 @@ function loadOmoConfig2() {
|
|
|
108699
108818
|
|
|
108700
108819
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-details.ts
|
|
108701
108820
|
init_shared();
|
|
108702
|
-
import { join as
|
|
108821
|
+
import { join as join78 } from "node:path";
|
|
108703
108822
|
|
|
108704
108823
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-variant.ts
|
|
108705
108824
|
function formatModelWithVariant(model, variant) {
|
|
@@ -108741,7 +108860,7 @@ function formatCapabilityResolutionLabel(mode) {
|
|
|
108741
108860
|
}
|
|
108742
108861
|
function buildModelResolutionDetails(options) {
|
|
108743
108862
|
const details = [];
|
|
108744
|
-
const cacheFile =
|
|
108863
|
+
const cacheFile = join78(getOpenCodeCacheDir(), "models.json");
|
|
108745
108864
|
details.push("═══ Available Models (from cache) ═══");
|
|
108746
108865
|
details.push("");
|
|
108747
108866
|
if (options.available.cacheExists) {
|
|
@@ -109050,8 +109169,8 @@ async function checkConfig() {
|
|
|
109050
109169
|
|
|
109051
109170
|
// packages/omo-opencode/src/cli/doctor/checks/deprecated-reasoning-keys.ts
|
|
109052
109171
|
init_main();
|
|
109053
|
-
import { existsSync as
|
|
109054
|
-
import { join as
|
|
109172
|
+
import { existsSync as existsSync53, readFileSync as readFileSync34 } from "node:fs";
|
|
109173
|
+
import { join as join79 } from "node:path";
|
|
109055
109174
|
var CANONICAL_REPLACEMENT = new Map([
|
|
109056
109175
|
["variant", "reasoning"],
|
|
109057
109176
|
["reasoningEffort", "reasoning"],
|
|
@@ -109106,16 +109225,16 @@ function userConfigPaths() {
|
|
|
109106
109225
|
const home = process.env.HOME ?? process.env.USERPROFILE;
|
|
109107
109226
|
if (home === undefined || home.length === 0)
|
|
109108
109227
|
return [];
|
|
109109
|
-
return [
|
|
109228
|
+
return [join79(home, ".omo", "omo.jsonc"), join79(home, ".omo", "omo.json")];
|
|
109110
109229
|
}
|
|
109111
109230
|
async function checkDeprecatedReasoningKeys() {
|
|
109112
109231
|
const issues = [];
|
|
109113
109232
|
const scanned = [];
|
|
109114
109233
|
for (const configPath of userConfigPaths()) {
|
|
109115
|
-
if (!
|
|
109234
|
+
if (!existsSync53(configPath))
|
|
109116
109235
|
continue;
|
|
109117
109236
|
scanned.push(configPath);
|
|
109118
|
-
const parsed = parse2(
|
|
109237
|
+
const parsed = parse2(readFileSync34(configPath, "utf-8"));
|
|
109119
109238
|
issues.push(...collectIssues(configPath, parsed, ""));
|
|
109120
109239
|
}
|
|
109121
109240
|
return {
|
|
@@ -109129,28 +109248,28 @@ async function checkDeprecatedReasoningKeys() {
|
|
|
109129
109248
|
|
|
109130
109249
|
// packages/omo-opencode/src/cli/doctor/checks/dependencies.ts
|
|
109131
109250
|
init_src2();
|
|
109132
|
-
import { existsSync as
|
|
109251
|
+
import { existsSync as existsSync54 } from "node:fs";
|
|
109133
109252
|
import { createRequire as createRequire4 } from "node:module";
|
|
109134
|
-
import { homedir as
|
|
109135
|
-
import { dirname as
|
|
109253
|
+
import { homedir as homedir18 } from "node:os";
|
|
109254
|
+
import { dirname as dirname30, join as join81 } from "node:path";
|
|
109136
109255
|
|
|
109137
109256
|
// packages/omo-opencode/src/hooks/comment-checker/downloader.ts
|
|
109138
|
-
import { join as
|
|
109139
|
-
import { homedir as
|
|
109257
|
+
import { join as join80 } from "path";
|
|
109258
|
+
import { homedir as homedir17, tmpdir as tmpdir4 } from "os";
|
|
109140
109259
|
init_binary_downloader();
|
|
109141
109260
|
init_logger2();
|
|
109142
109261
|
init_plugin_identity();
|
|
109143
109262
|
var DEBUG = process.env.COMMENT_CHECKER_DEBUG === "1";
|
|
109144
|
-
var DEBUG_FILE =
|
|
109263
|
+
var DEBUG_FILE = join80(tmpdir4(), "comment-checker-debug.log");
|
|
109145
109264
|
function getCacheDir2() {
|
|
109146
109265
|
if (process.platform === "win32") {
|
|
109147
109266
|
const localAppData = process.env.LOCALAPPDATA || process.env.APPDATA;
|
|
109148
|
-
const base2 = localAppData ||
|
|
109149
|
-
return
|
|
109267
|
+
const base2 = localAppData || join80(homedir17(), "AppData", "Local");
|
|
109268
|
+
return join80(base2, CACHE_DIR_NAME, "bin");
|
|
109150
109269
|
}
|
|
109151
109270
|
const xdgCache = process.env.XDG_CACHE_HOME;
|
|
109152
|
-
const base = xdgCache ||
|
|
109153
|
-
return
|
|
109271
|
+
const base = xdgCache || join80(homedir17(), ".cache");
|
|
109272
|
+
return join80(base, CACHE_DIR_NAME, "bin");
|
|
109154
109273
|
}
|
|
109155
109274
|
function getBinaryName() {
|
|
109156
109275
|
return process.platform === "win32" ? "comment-checker.exe" : "comment-checker";
|
|
@@ -109200,7 +109319,7 @@ async function getBinaryVersion(binary) {
|
|
|
109200
109319
|
}
|
|
109201
109320
|
}
|
|
109202
109321
|
async function checkAstGrepCli() {
|
|
109203
|
-
const runtimeDir = astGrepRuntimeDir(
|
|
109322
|
+
const runtimeDir = astGrepRuntimeDir(join81(homedir18(), ".omo"));
|
|
109204
109323
|
const sgPath = findSgBinarySync({ runtimeDir });
|
|
109205
109324
|
if (sgPath === null) {
|
|
109206
109325
|
return {
|
|
@@ -109229,12 +109348,12 @@ function findCommentCheckerPackageBinary(baseDirOverride, resolvePackageJsonPath
|
|
|
109229
109348
|
const binaryName = process.platform === "win32" ? "comment-checker.exe" : "comment-checker";
|
|
109230
109349
|
const platformKey = `${process.platform}-${process.arch === "x64" ? "x64" : process.arch}`;
|
|
109231
109350
|
try {
|
|
109232
|
-
const packageDir = baseDirOverride ??
|
|
109233
|
-
const vendorPath =
|
|
109234
|
-
if (
|
|
109351
|
+
const packageDir = baseDirOverride ?? dirname30(resolvePackageJsonPath());
|
|
109352
|
+
const vendorPath = join81(packageDir, "vendor", platformKey, binaryName);
|
|
109353
|
+
if (existsSync54(vendorPath))
|
|
109235
109354
|
return vendorPath;
|
|
109236
|
-
const binPath =
|
|
109237
|
-
if (
|
|
109355
|
+
const binPath = join81(packageDir, "bin", binaryName);
|
|
109356
|
+
if (existsSync54(binPath))
|
|
109238
109357
|
return binPath;
|
|
109239
109358
|
} catch (error51) {
|
|
109240
109359
|
if (!(error51 instanceof Error) && !isModuleResolutionFailure(error51))
|
|
@@ -109380,8 +109499,8 @@ async function getGhCliInfo(dependencies = {}) {
|
|
|
109380
109499
|
// packages/omo-opencode/src/mcp/lsp.ts
|
|
109381
109500
|
init_zod();
|
|
109382
109501
|
init_opencode_config_dir();
|
|
109383
|
-
import { existsSync as
|
|
109384
|
-
import { delimiter as delimiter3, dirname as
|
|
109502
|
+
import { existsSync as existsSync55, readFileSync as readFileSync35 } from "node:fs";
|
|
109503
|
+
import { delimiter as delimiter3, dirname as dirname31, resolve as resolve22 } from "node:path";
|
|
109385
109504
|
import { fileURLToPath as fileURLToPath7 } from "node:url";
|
|
109386
109505
|
|
|
109387
109506
|
// packages/omo-opencode/src/mcp/cli-suffix.ts
|
|
@@ -109428,7 +109547,7 @@ function resolveRuntimeExecutable(commandName, options = {}) {
|
|
|
109428
109547
|
}
|
|
109429
109548
|
|
|
109430
109549
|
// packages/omo-opencode/src/mcp/shared/ancestor-cli-resolver.ts
|
|
109431
|
-
import { resolve as
|
|
109550
|
+
import { resolve as resolve21 } from "node:path";
|
|
109432
109551
|
function resolveJavaScriptRuntime(resolveExecutable) {
|
|
109433
109552
|
const node = resolveExecutable("node");
|
|
109434
109553
|
return node.available ? node : resolveExecutable("bun");
|
|
@@ -109436,9 +109555,9 @@ function resolveJavaScriptRuntime(resolveExecutable) {
|
|
|
109436
109555
|
function createAncestorCliCandidates(options) {
|
|
109437
109556
|
const candidates = [];
|
|
109438
109557
|
const seenPaths = new Set;
|
|
109439
|
-
let currentDirectory =
|
|
109558
|
+
let currentDirectory = resolve21(options.startDirectory);
|
|
109440
109559
|
while (true) {
|
|
109441
|
-
const distCliPath =
|
|
109560
|
+
const distCliPath = resolve21(currentDirectory, options.packageRel, options.distCliRel);
|
|
109442
109561
|
if (!seenPaths.has(distCliPath)) {
|
|
109443
109562
|
const runtime5 = resolveJavaScriptRuntime(options.resolveExecutable);
|
|
109444
109563
|
seenPaths.add(distCliPath);
|
|
@@ -109450,7 +109569,7 @@ function createAncestorCliCandidates(options) {
|
|
|
109450
109569
|
runtimeAvailable: runtime5.available
|
|
109451
109570
|
});
|
|
109452
109571
|
}
|
|
109453
|
-
const sourceCliPath =
|
|
109572
|
+
const sourceCliPath = resolve21(currentDirectory, options.packageRel, options.sourceCliRel);
|
|
109454
109573
|
if (!seenPaths.has(sourceCliPath)) {
|
|
109455
109574
|
const runtime5 = options.resolveExecutable("bun");
|
|
109456
109575
|
const sourceCandidateAvailable = options.isSourceCandidateAvailable?.({
|
|
@@ -109467,7 +109586,7 @@ function createAncestorCliCandidates(options) {
|
|
|
109467
109586
|
runtimeAvailable: runtime5.available
|
|
109468
109587
|
});
|
|
109469
109588
|
}
|
|
109470
|
-
const parentDirectory =
|
|
109589
|
+
const parentDirectory = resolve21(currentDirectory, "..");
|
|
109471
109590
|
if (parentDirectory === currentDirectory)
|
|
109472
109591
|
return candidates;
|
|
109473
109592
|
currentDirectory = parentDirectory;
|
|
@@ -109512,7 +109631,7 @@ var LSP_BOOTSTRAP_SCRIPT = [
|
|
|
109512
109631
|
].join(";");
|
|
109513
109632
|
function getModuleDirectory(moduleUrl) {
|
|
109514
109633
|
try {
|
|
109515
|
-
return
|
|
109634
|
+
return dirname31(fileURLToPath7(moduleUrl));
|
|
109516
109635
|
} catch (error51) {
|
|
109517
109636
|
if (!(error51 instanceof Error))
|
|
109518
109637
|
throw error51;
|
|
@@ -109520,11 +109639,11 @@ function getModuleDirectory(moduleUrl) {
|
|
|
109520
109639
|
}
|
|
109521
109640
|
}
|
|
109522
109641
|
function findBootstrapRoot(candidates, pathExists) {
|
|
109523
|
-
return candidates.find((candidate2) => pathExists(
|
|
109642
|
+
return candidates.find((candidate2) => pathExists(resolve22(candidate2.root, "package.json")))?.root ?? process.cwd();
|
|
109524
109643
|
}
|
|
109525
109644
|
function readDaemonPackageVersion(root) {
|
|
109526
109645
|
try {
|
|
109527
|
-
const packageJson = JSON.parse(
|
|
109646
|
+
const packageJson = JSON.parse(readFileSync35(resolve22(root, PACKAGE_REL, "package.json"), "utf-8"));
|
|
109528
109647
|
return DaemonPackageSchema.parse(packageJson).version;
|
|
109529
109648
|
} catch (error51) {
|
|
109530
109649
|
if (!(error51 instanceof Error))
|
|
@@ -109536,17 +109655,17 @@ function createBootstrapCandidate(root, pathExists, resolveExecutable) {
|
|
|
109536
109655
|
const runtime5 = resolveJavaScriptRuntime(resolveExecutable);
|
|
109537
109656
|
const bun = resolveExecutable("bun");
|
|
109538
109657
|
const npm = resolveExecutable("npm");
|
|
109539
|
-
const packageManifestPath =
|
|
109658
|
+
const packageManifestPath = resolve22(root, PACKAGE_REL, "package.json");
|
|
109540
109659
|
return {
|
|
109541
109660
|
command: [runtime5.command, "-e", LSP_BOOTSTRAP_SCRIPT, root, npm.command, bun.command],
|
|
109542
109661
|
root,
|
|
109543
|
-
path:
|
|
109662
|
+
path: resolve22(root, PACKAGE_REL, DIST_CLI_REL),
|
|
109544
109663
|
exists: runtime5.available && npm.available && pathExists(packageManifestPath),
|
|
109545
109664
|
runtimeAvailable: runtime5.available
|
|
109546
109665
|
};
|
|
109547
109666
|
}
|
|
109548
109667
|
function resolveLspCommand(options = {}) {
|
|
109549
|
-
const pathExists = options.exists ??
|
|
109668
|
+
const pathExists = options.exists ?? existsSync55;
|
|
109550
109669
|
const resolveExecutable = options.resolveExecutable ?? resolveRuntimeExecutable;
|
|
109551
109670
|
const moduleDirectory = getModuleDirectory(options.moduleUrl ?? import.meta.url);
|
|
109552
109671
|
const candidates = moduleDirectory ? createAncestorCliCandidates({
|
|
@@ -109556,7 +109675,7 @@ function resolveLspCommand(options = {}) {
|
|
|
109556
109675
|
sourceCliRel: SOURCE_CLI_REL,
|
|
109557
109676
|
pathExists,
|
|
109558
109677
|
resolveExecutable,
|
|
109559
|
-
isSourceCandidateAvailable: ({ root }) => pathExists(
|
|
109678
|
+
isSourceCandidateAvailable: ({ root }) => pathExists(resolve22(root, LSP_TOOLS_PACKAGE_REL, DIST_CLI_REL)) && readDaemonPackageVersion(root) !== null
|
|
109560
109679
|
}) : [];
|
|
109561
109680
|
const distCandidate = candidates.find((candidate2) => hasCliSuffix(candidate2.path, DIST_CLI_REL) && candidate2.exists);
|
|
109562
109681
|
if (distCandidate) {
|
|
@@ -109570,7 +109689,7 @@ function resolveLspCommand(options = {}) {
|
|
|
109570
109689
|
}
|
|
109571
109690
|
function createLspMcpConfig(options = {}) {
|
|
109572
109691
|
const resolvedCommand = resolveLspCommand(options);
|
|
109573
|
-
const cwd =
|
|
109692
|
+
const cwd = resolve22(options.cwd ?? process.cwd());
|
|
109574
109693
|
const configDir = getOpenCodeConfigDir({ binary: "opencode" });
|
|
109575
109694
|
const sourceVersion = hasCliSuffix(resolvedCommand.path, SOURCE_CLI_REL) ? readDaemonPackageVersion(resolvedCommand.root) : null;
|
|
109576
109695
|
return {
|
|
@@ -109579,9 +109698,9 @@ function createLspMcpConfig(options = {}) {
|
|
|
109579
109698
|
enabled: resolvedCommand.exists,
|
|
109580
109699
|
cwd,
|
|
109581
109700
|
environment: {
|
|
109582
|
-
LSP_TOOLS_MCP_PROJECT_CONFIG: PROJECT_LSP_CONFIGS.map((configPath) =>
|
|
109583
|
-
LSP_TOOLS_MCP_USER_CONFIG:
|
|
109584
|
-
LSP_TOOLS_MCP_INSTALL_DECISIONS:
|
|
109701
|
+
LSP_TOOLS_MCP_PROJECT_CONFIG: PROJECT_LSP_CONFIGS.map((configPath) => resolve22(cwd, configPath)).join(delimiter3),
|
|
109702
|
+
LSP_TOOLS_MCP_USER_CONFIG: resolve22(configDir, "lsp.json"),
|
|
109703
|
+
LSP_TOOLS_MCP_INSTALL_DECISIONS: resolve22(configDir, "lsp-install-decisions.json"),
|
|
109585
109704
|
...sourceVersion ? {
|
|
109586
109705
|
[OMO_LSP_DAEMON_CLI]: resolvedCommand.path,
|
|
109587
109706
|
[OMO_LSP_DAEMON_VERSION]: sourceVersion
|
|
@@ -109606,24 +109725,24 @@ function getInstalledLspServers(options = {}) {
|
|
|
109606
109725
|
|
|
109607
109726
|
// packages/omo-opencode/src/cli/doctor/checks/tools-mcp.ts
|
|
109608
109727
|
init_shared();
|
|
109609
|
-
import { existsSync as
|
|
109610
|
-
import { homedir as
|
|
109611
|
-
import { join as
|
|
109728
|
+
import { existsSync as existsSync56, readFileSync as readFileSync36 } from "node:fs";
|
|
109729
|
+
import { homedir as homedir19 } from "node:os";
|
|
109730
|
+
import { join as join82 } from "node:path";
|
|
109612
109731
|
var BUILTIN_MCP_SERVERS = ["websearch", "context7", "grep_app", "lsp"];
|
|
109613
109732
|
function getMcpConfigPaths() {
|
|
109614
109733
|
return [
|
|
109615
|
-
|
|
109616
|
-
|
|
109617
|
-
|
|
109734
|
+
join82(homedir19(), ".claude", ".mcp.json"),
|
|
109735
|
+
join82(process.cwd(), ".mcp.json"),
|
|
109736
|
+
join82(process.cwd(), ".claude", ".mcp.json")
|
|
109618
109737
|
];
|
|
109619
109738
|
}
|
|
109620
109739
|
function loadUserMcpConfig() {
|
|
109621
109740
|
const servers = {};
|
|
109622
109741
|
for (const configPath of getMcpConfigPaths()) {
|
|
109623
|
-
if (!
|
|
109742
|
+
if (!existsSync56(configPath))
|
|
109624
109743
|
continue;
|
|
109625
109744
|
try {
|
|
109626
|
-
const content =
|
|
109745
|
+
const content = readFileSync36(configPath, "utf-8");
|
|
109627
109746
|
const config4 = parseJsonc(content);
|
|
109628
109747
|
if (config4.mcpServers) {
|
|
109629
109748
|
Object.assign(servers, config4.mcpServers);
|
|
@@ -109758,17 +109877,17 @@ async function checkTools() {
|
|
|
109758
109877
|
|
|
109759
109878
|
// packages/omo-opencode/src/cli/doctor/checks/telemetry.ts
|
|
109760
109879
|
init_src5();
|
|
109761
|
-
import { existsSync as
|
|
109880
|
+
import { existsSync as existsSync57, readFileSync as readFileSync37 } from "node:fs";
|
|
109762
109881
|
function isTelemetryState(value) {
|
|
109763
109882
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
109764
109883
|
}
|
|
109765
109884
|
function readLastActiveDay(stateFilePath) {
|
|
109766
|
-
if (!
|
|
109885
|
+
if (!existsSync57(stateFilePath)) {
|
|
109767
109886
|
return "never";
|
|
109768
109887
|
}
|
|
109769
109888
|
let parsed;
|
|
109770
109889
|
try {
|
|
109771
|
-
parsed = JSON.parse(
|
|
109890
|
+
parsed = JSON.parse(readFileSync37(stateFilePath, "utf-8"));
|
|
109772
109891
|
} catch (error51) {
|
|
109773
109892
|
if (error51 instanceof Error) {
|
|
109774
109893
|
return "unreadable";
|
|
@@ -109826,17 +109945,17 @@ async function probeBinary(cmd, args, spawnImpl) {
|
|
|
109826
109945
|
}
|
|
109827
109946
|
|
|
109828
109947
|
// packages/team-core/src/team-registry/paths.ts
|
|
109829
|
-
import { homedir as
|
|
109948
|
+
import { homedir as homedir20 } from "node:os";
|
|
109830
109949
|
import path12 from "node:path";
|
|
109831
109950
|
function resolveBaseDir(config4) {
|
|
109832
|
-
return expandHomeDirectory(config4.base_dir ?? path12.join(
|
|
109951
|
+
return expandHomeDirectory(config4.base_dir ?? path12.join(homedir20(), ".omo"));
|
|
109833
109952
|
}
|
|
109834
109953
|
function expandHomeDirectory(directoryPath3) {
|
|
109835
109954
|
if (directoryPath3 === "~") {
|
|
109836
|
-
return
|
|
109955
|
+
return homedir20();
|
|
109837
109956
|
}
|
|
109838
109957
|
if (directoryPath3.startsWith("~/") || directoryPath3.startsWith("~\\")) {
|
|
109839
|
-
return path12.join(
|
|
109958
|
+
return path12.join(homedir20(), directoryPath3.slice(2));
|
|
109840
109959
|
}
|
|
109841
109960
|
return directoryPath3;
|
|
109842
109961
|
}
|
|
@@ -109893,10 +110012,10 @@ async function pathExists(dir) {
|
|
|
109893
110012
|
|
|
109894
110013
|
// packages/omo-opencode/src/cli/doctor/checks/codex.ts
|
|
109895
110014
|
init_src2();
|
|
109896
|
-
import { existsSync as
|
|
110015
|
+
import { existsSync as existsSync58 } from "node:fs";
|
|
109897
110016
|
import { lstat as lstat15, readdir as readdir14, readFile as readFile27 } from "node:fs/promises";
|
|
109898
|
-
import { homedir as
|
|
109899
|
-
import { basename as basename11, join as
|
|
110017
|
+
import { homedir as homedir21 } from "node:os";
|
|
110018
|
+
import { basename as basename11, join as join83, resolve as resolve23 } from "node:path";
|
|
109900
110019
|
// packages/omo-opencode/package.json
|
|
109901
110020
|
var package_default3 = {
|
|
109902
110021
|
name: "@oh-my-opencode/omo-opencode",
|
|
@@ -109961,13 +110080,13 @@ var CODEX_BIN_NAMES = [
|
|
|
109961
110080
|
"omo-git-bash-hook"
|
|
109962
110081
|
];
|
|
109963
110082
|
async function gatherCodexSummary(deps = {}) {
|
|
109964
|
-
const codexHome =
|
|
110083
|
+
const codexHome = resolve23(deps.codexHome ?? process.env.CODEX_HOME ?? join83(homedir21(), ".codex"));
|
|
109965
110084
|
const binDir = resolveCodexInstallerBinDir({ binDir: deps.binDir, codexHome, env: process.env });
|
|
109966
110085
|
const detection = await (deps.detectCodexInstallation ?? detectCodexInstallation)();
|
|
109967
110086
|
const pluginRoot = await resolveInstalledPluginRoot(codexHome);
|
|
109968
|
-
const manifest2 = pluginRoot === null ? null : await readJson(
|
|
109969
|
-
const installSnapshot = pluginRoot === null ? null : await readJson(
|
|
109970
|
-
const configPath =
|
|
110087
|
+
const manifest2 = pluginRoot === null ? null : await readJson(join83(pluginRoot, ".codex-plugin", "plugin.json"));
|
|
110088
|
+
const installSnapshot = pluginRoot === null ? null : await readJson(join83(pluginRoot, "lazycodex-install.json"));
|
|
110089
|
+
const configPath = join83(codexHome, "config.toml");
|
|
109971
110090
|
const pluginVersion = stringField(manifest2, "version");
|
|
109972
110091
|
return {
|
|
109973
110092
|
codexPath: detection.found && "path" in detection ? detection.path : null,
|
|
@@ -110024,7 +110143,7 @@ function buildCodexIssues(summary) {
|
|
|
110024
110143
|
if (summary.pluginRoot === null) {
|
|
110025
110144
|
issues.push({
|
|
110026
110145
|
title: "OMO Codex plugin is not installed",
|
|
110027
|
-
description: `Expected cached plugin at ${
|
|
110146
|
+
description: `Expected cached plugin at ${join83("plugins", "cache", MARKETPLACE_NAME, PLUGIN_NAME2, DEFAULT_PLUGIN_VERSION)} under CODEX_HOME.`,
|
|
110028
110147
|
fix: "Run: npx lazycodex-ai install",
|
|
110029
110148
|
severity: "error",
|
|
110030
110149
|
affects: ["plugin loading"]
|
|
@@ -110089,15 +110208,15 @@ function buildCodexIssues(summary) {
|
|
|
110089
110208
|
return issues;
|
|
110090
110209
|
}
|
|
110091
110210
|
async function resolveInstalledPluginRoot(codexHome) {
|
|
110092
|
-
const pluginRoot =
|
|
110093
|
-
if (!
|
|
110211
|
+
const pluginRoot = join83(codexHome, "plugins", "cache", MARKETPLACE_NAME, PLUGIN_NAME2);
|
|
110212
|
+
if (!existsSync58(pluginRoot))
|
|
110094
110213
|
return null;
|
|
110095
110214
|
const versions2 = await readdir14(pluginRoot, { withFileTypes: true });
|
|
110096
110215
|
const candidates = versions2.filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort(compareVersionsDescending);
|
|
110097
|
-
return candidates.length === 0 ? null :
|
|
110216
|
+
return candidates.length === 0 ? null : join83(pluginRoot, candidates[0] ?? DEFAULT_PLUGIN_VERSION);
|
|
110098
110217
|
}
|
|
110099
110218
|
async function readCodexConfigSummary(configPath) {
|
|
110100
|
-
if (!
|
|
110219
|
+
if (!existsSync58(configPath)) {
|
|
110101
110220
|
return {
|
|
110102
110221
|
exists: false,
|
|
110103
110222
|
marketplaceConfigured: false,
|
|
@@ -110122,14 +110241,14 @@ async function readCodexConfigSummary(configPath) {
|
|
|
110122
110241
|
async function readLinkedBins(binDir) {
|
|
110123
110242
|
const linked = [];
|
|
110124
110243
|
for (const name of CODEX_BIN_NAMES) {
|
|
110125
|
-
if (await pathExists2(
|
|
110244
|
+
if (await pathExists2(join83(binDir, process.platform === "win32" ? `${name}.cmd` : name)))
|
|
110126
110245
|
linked.push(name);
|
|
110127
110246
|
}
|
|
110128
110247
|
return linked;
|
|
110129
110248
|
}
|
|
110130
110249
|
async function readLinkedAgents(codexHome) {
|
|
110131
|
-
const agentsDir =
|
|
110132
|
-
if (!
|
|
110250
|
+
const agentsDir = join83(codexHome, "agents");
|
|
110251
|
+
if (!existsSync58(agentsDir))
|
|
110133
110252
|
return [];
|
|
110134
110253
|
const entries = await readdir14(agentsDir, { withFileTypes: true });
|
|
110135
110254
|
return entries.filter((entry) => entry.isFile() || entry.isSymbolicLink()).map((entry) => basename11(entry.name, ".toml")).sort();
|
|
@@ -110175,16 +110294,16 @@ function formatCompanionPluginStatus(config4) {
|
|
|
110175
110294
|
return "none";
|
|
110176
110295
|
}
|
|
110177
110296
|
function readCompanionLifecycleHookStateEvents(content) {
|
|
110178
|
-
const
|
|
110297
|
+
const events2 = new Set;
|
|
110179
110298
|
for (const section of splitTomlSections(content)) {
|
|
110180
110299
|
if (section.header === null)
|
|
110181
110300
|
continue;
|
|
110182
110301
|
const key = parseHookStateHeaderKey(section.header);
|
|
110183
110302
|
const event = key === null ? null : companionLifecycleEventFromHookStateKey(key);
|
|
110184
110303
|
if (event !== null)
|
|
110185
|
-
|
|
110304
|
+
events2.add(event);
|
|
110186
110305
|
}
|
|
110187
|
-
return [...
|
|
110306
|
+
return [...events2].sort(compareCompanionLifecycleEvents);
|
|
110188
110307
|
}
|
|
110189
110308
|
function companionLifecycleEventFromHookStateKey(key) {
|
|
110190
110309
|
if (!key.startsWith(`${COMPANION_PLUGIN_KEY}:`))
|
|
@@ -110198,8 +110317,8 @@ function compareCompanionLifecycleEvents(left, right) {
|
|
|
110198
110317
|
function companionLifecycleEventOrder(event) {
|
|
110199
110318
|
return event === "session_start" ? 0 : event === "stop" ? 1 : 2;
|
|
110200
110319
|
}
|
|
110201
|
-
function formatCompanionLifecycleEvents(
|
|
110202
|
-
return
|
|
110320
|
+
function formatCompanionLifecycleEvents(events2) {
|
|
110321
|
+
return events2.map(formatCompanionLifecycleEvent).join(", ");
|
|
110203
110322
|
}
|
|
110204
110323
|
function formatCompanionLifecycleEvent(event) {
|
|
110205
110324
|
switch (event) {
|
|
@@ -110243,8 +110362,8 @@ async function pathExists2(path14) {
|
|
|
110243
110362
|
// packages/omo-opencode/src/cli/doctor/checks/codex-components.ts
|
|
110244
110363
|
init_src2();
|
|
110245
110364
|
import { readdir as readdir15, readFile as readFile28, stat as stat7 } from "node:fs/promises";
|
|
110246
|
-
import { homedir as
|
|
110247
|
-
import { dirname as
|
|
110365
|
+
import { homedir as homedir22 } from "node:os";
|
|
110366
|
+
import { dirname as dirname32, isAbsolute as isAbsolute12, join as join84, relative as relative9, resolve as resolve24, sep as sep9 } from "node:path";
|
|
110248
110367
|
var CODEX_COMPONENTS_CHECK_ID = "codex-components";
|
|
110249
110368
|
var CODEX_COMPONENTS_CHECK_NAME = "codex-components";
|
|
110250
110369
|
var PLUGIN_DATA_DIR_NAME = "omo-sisyphuslabs";
|
|
@@ -110254,7 +110373,7 @@ async function checkCodexComponents(deps = {}) {
|
|
|
110254
110373
|
const env3 = deps.env ?? process.env;
|
|
110255
110374
|
const platform = deps.platform ?? process.platform;
|
|
110256
110375
|
const arch = deps.arch ?? process.arch;
|
|
110257
|
-
const codexHome =
|
|
110376
|
+
const codexHome = resolve24(deps.codexHome ?? env3["CODEX_HOME"] ?? join84(homedir22(), ".codex"));
|
|
110258
110377
|
const summary = await gatherCodexSummary({ ...deps, codexHome });
|
|
110259
110378
|
if (summary.pluginRoot === null) {
|
|
110260
110379
|
return {
|
|
@@ -110279,7 +110398,7 @@ async function checkCodexComponents(deps = {}) {
|
|
|
110279
110398
|
});
|
|
110280
110399
|
}
|
|
110281
110400
|
const runtimeSgDir = runtimeSgDirectory(codexHome, platform, arch);
|
|
110282
|
-
const runtimeSgPath =
|
|
110401
|
+
const runtimeSgPath = join84(runtimeSgDir, sgBinaryName(platform));
|
|
110283
110402
|
const sg = findSgBinarySync({
|
|
110284
110403
|
arch,
|
|
110285
110404
|
env: env3,
|
|
@@ -110318,8 +110437,8 @@ async function auditBundleTargets(pluginRoot) {
|
|
|
110318
110437
|
const manifest2 = await readJson2(manifestPath);
|
|
110319
110438
|
if (manifest2 === null || !isRecord12(manifest2["mcpServers"]))
|
|
110320
110439
|
continue;
|
|
110321
|
-
const manifestRoot =
|
|
110322
|
-
const isRootManifest =
|
|
110440
|
+
const manifestRoot = dirname32(manifestPath);
|
|
110441
|
+
const isRootManifest = resolve24(manifestRoot) === resolve24(pluginRoot);
|
|
110323
110442
|
for (const server2 of Object.values(manifest2["mcpServers"])) {
|
|
110324
110443
|
if (!isRecord12(server2) || !Array.isArray(server2["args"]))
|
|
110325
110444
|
continue;
|
|
@@ -110339,7 +110458,7 @@ async function auditBundleTargets(pluginRoot) {
|
|
|
110339
110458
|
continue;
|
|
110340
110459
|
const commands2 = [];
|
|
110341
110460
|
collectHookCommands(manifest2, commands2);
|
|
110342
|
-
const hookPluginRoot =
|
|
110461
|
+
const hookPluginRoot = dirname32(dirname32(hookManifestPath));
|
|
110343
110462
|
for (const command of commands2) {
|
|
110344
110463
|
for (const relativePath of extractPluginRootPaths(command)) {
|
|
110345
110464
|
referencedCount += 1;
|
|
@@ -110361,8 +110480,8 @@ function recordBrokenTarget(broken, classified, origin) {
|
|
|
110361
110480
|
broken.push(entry);
|
|
110362
110481
|
}
|
|
110363
110482
|
async function classifyBundleTarget(bundleRoot, baseRoot, relativePath, allowEscape) {
|
|
110364
|
-
const targetPath =
|
|
110365
|
-
const bundleRootPath =
|
|
110483
|
+
const targetPath = resolve24(baseRoot, relativePath);
|
|
110484
|
+
const bundleRootPath = resolve24(bundleRoot);
|
|
110366
110485
|
const bundleRootPrefix = bundleRootPath.endsWith(sep9) ? bundleRootPath : `${bundleRootPath}${sep9}`;
|
|
110367
110486
|
if (targetPath !== bundleRootPath && !targetPath.startsWith(bundleRootPrefix)) {
|
|
110368
110487
|
if (allowEscape)
|
|
@@ -110378,7 +110497,7 @@ async function classifyBundleTarget(bundleRoot, baseRoot, relativePath, allowEsc
|
|
|
110378
110497
|
}
|
|
110379
110498
|
async function findHookManifestPaths(root) {
|
|
110380
110499
|
const paths3 = await findManifestPaths(root, "hooks.json");
|
|
110381
|
-
return paths3.filter((path14) =>
|
|
110500
|
+
return paths3.filter((path14) => dirname32(path14).endsWith(`${sep9}hooks`));
|
|
110382
110501
|
}
|
|
110383
110502
|
async function findManifestPaths(root, manifestName) {
|
|
110384
110503
|
let entries;
|
|
@@ -110391,7 +110510,7 @@ async function findManifestPaths(root, manifestName) {
|
|
|
110391
110510
|
for (const entry of entries) {
|
|
110392
110511
|
if (entry.name === "node_modules" || entry.name === ".git")
|
|
110393
110512
|
continue;
|
|
110394
|
-
const entryPath =
|
|
110513
|
+
const entryPath = join84(root, entry.name);
|
|
110395
110514
|
if (entry.isDirectory()) {
|
|
110396
110515
|
paths3.push(...await findManifestPaths(entryPath, manifestName));
|
|
110397
110516
|
continue;
|
|
@@ -110435,18 +110554,18 @@ function isPluginRuntimePathArg(arg) {
|
|
|
110435
110554
|
return normalized.endsWith(".js") && normalized.includes("/dist/") && (normalized.startsWith("./") || normalized.startsWith("../") || normalized.startsWith("components/") || normalized.startsWith("/") || isAbsolute12(arg));
|
|
110436
110555
|
}
|
|
110437
110556
|
function runtimeSgDirectory(codexHome, platform, arch) {
|
|
110438
|
-
return
|
|
110557
|
+
return join84(codexHome, "runtime", "ast-grep", runtimeSlug(platform, arch));
|
|
110439
110558
|
}
|
|
110440
110559
|
function describeSgSource(sgPath, env3, runtimeSgDir, platform) {
|
|
110441
110560
|
const override = env3[SG_PATH_ENV_KEY]?.trim();
|
|
110442
110561
|
if (override !== undefined && override.length > 0 && sgPath === override)
|
|
110443
110562
|
return `env override ${SG_PATH_ENV_KEY}`;
|
|
110444
|
-
if (sgPath ===
|
|
110563
|
+
if (sgPath === join84(runtimeSgDir, sgBinaryName(platform)))
|
|
110445
110564
|
return "runtime dir";
|
|
110446
110565
|
return "PATH";
|
|
110447
110566
|
}
|
|
110448
110567
|
async function readBootstrapStateSummary(codexHome) {
|
|
110449
|
-
const statePath =
|
|
110568
|
+
const statePath = join84(codexHome, "plugins", "data", PLUGIN_DATA_DIR_NAME, "bootstrap", "state.json");
|
|
110450
110569
|
const raw = await readJson2(statePath);
|
|
110451
110570
|
if (raw === null)
|
|
110452
110571
|
return null;
|
|
@@ -110522,24 +110641,24 @@ function isRecord12(value) {
|
|
|
110522
110641
|
}
|
|
110523
110642
|
|
|
110524
110643
|
// packages/omo-opencode/src/cli/doctor/checks/codex-runtime-wrapper.ts
|
|
110525
|
-
import { existsSync as
|
|
110644
|
+
import { existsSync as existsSync59 } from "node:fs";
|
|
110526
110645
|
import { readFile as readFile29 } from "node:fs/promises";
|
|
110527
|
-
import { homedir as
|
|
110528
|
-
import { join as
|
|
110646
|
+
import { homedir as homedir23 } from "node:os";
|
|
110647
|
+
import { join as join85, resolve as resolve25 } from "node:path";
|
|
110529
110648
|
var RUNTIME_WRAPPER_MARKER2 = "OMO_GENERATED_RUNTIME_WRAPPER";
|
|
110530
110649
|
var CHECK_NAME = "codex-runtime-wrapper";
|
|
110531
110650
|
var REINSTALL_COMMAND = "npx --yes lazycodex-ai@latest install --no-tui";
|
|
110532
110651
|
async function checkCodexRuntimeWrapper(deps = {}) {
|
|
110533
|
-
const codexHome =
|
|
110652
|
+
const codexHome = resolve25(deps.codexHome ?? process.env.CODEX_HOME ?? join85(homedir23(), ".codex"));
|
|
110534
110653
|
const binDir = resolveCodexInstallerBinDir({ binDir: deps.binDir, codexHome, env: process.env });
|
|
110535
110654
|
const platform = deps.platform ?? process.platform;
|
|
110536
|
-
const wrapperPath =
|
|
110537
|
-
const legacyWrapperPath =
|
|
110655
|
+
const wrapperPath = join85(binDir, platform === "win32" ? "omo-agent-toolkit.cmd" : "omo-agent-toolkit");
|
|
110656
|
+
const legacyWrapperPath = join85(binDir, platform === "win32" ? "omo.cmd" : "omo");
|
|
110538
110657
|
const [wrapper, legacyWrapper] = await Promise.all([readRuntimeWrapper(wrapperPath), readRuntimeWrapper(legacyWrapperPath)]);
|
|
110539
110658
|
const issues = [];
|
|
110540
110659
|
if (wrapper?.includes(RUNTIME_WRAPPER_MARKER2) === true) {
|
|
110541
110660
|
const targetPath = parseRuntimeTargetPath(wrapper);
|
|
110542
|
-
if (targetPath !== null && !
|
|
110661
|
+
if (targetPath !== null && !existsSync59(targetPath)) {
|
|
110543
110662
|
issues.push({
|
|
110544
110663
|
title: "omo-agent-toolkit runtime wrapper target is missing",
|
|
110545
110664
|
description: `Generated omo-agent-toolkit runtime wrapper at ${wrapperPath} points to missing target ${targetPath}.`,
|
|
@@ -111053,24 +111172,24 @@ Doctor failed unexpectedly: ${message}`];
|
|
|
111053
111172
|
// packages/mcp-client-core/src/mcp-oauth/storage.ts
|
|
111054
111173
|
import { createHash as createHash6 } from "node:crypto";
|
|
111055
111174
|
import {
|
|
111056
|
-
chmodSync as
|
|
111057
|
-
existsSync as
|
|
111058
|
-
mkdirSync as
|
|
111175
|
+
chmodSync as chmodSync5,
|
|
111176
|
+
existsSync as existsSync62,
|
|
111177
|
+
mkdirSync as mkdirSync15,
|
|
111059
111178
|
readdirSync as readdirSync11,
|
|
111060
|
-
readFileSync as
|
|
111179
|
+
readFileSync as readFileSync39,
|
|
111061
111180
|
renameSync as renameSync7,
|
|
111062
111181
|
unlinkSync as unlinkSync9,
|
|
111063
|
-
writeFileSync as
|
|
111182
|
+
writeFileSync as writeFileSync12
|
|
111064
111183
|
} from "node:fs";
|
|
111065
|
-
import { basename as basename12, dirname as
|
|
111184
|
+
import { basename as basename12, dirname as dirname33, join as join88 } from "node:path";
|
|
111066
111185
|
|
|
111067
111186
|
// packages/mcp-client-core/src/config-dir.ts
|
|
111068
|
-
import { existsSync as
|
|
111069
|
-
import { homedir as
|
|
111070
|
-
import { join as
|
|
111187
|
+
import { existsSync as existsSync60, realpathSync as realpathSync8 } from "node:fs";
|
|
111188
|
+
import { homedir as homedir24 } from "node:os";
|
|
111189
|
+
import { join as join86, resolve as resolve26 } from "node:path";
|
|
111071
111190
|
function resolveConfigPath2(pathValue) {
|
|
111072
|
-
const resolvedPath =
|
|
111073
|
-
if (!
|
|
111191
|
+
const resolvedPath = resolve26(pathValue);
|
|
111192
|
+
if (!existsSync60(resolvedPath))
|
|
111074
111193
|
return resolvedPath;
|
|
111075
111194
|
try {
|
|
111076
111195
|
return realpathSync8(resolvedPath);
|
|
@@ -111085,13 +111204,13 @@ function getOpenCodeCliConfigDir(env3 = process.env) {
|
|
|
111085
111204
|
if (customConfigDir) {
|
|
111086
111205
|
return resolveConfigPath2(customConfigDir);
|
|
111087
111206
|
}
|
|
111088
|
-
const xdgConfigDir = env3["XDG_CONFIG_HOME"]?.trim() ||
|
|
111089
|
-
return resolveConfigPath2(
|
|
111207
|
+
const xdgConfigDir = env3["XDG_CONFIG_HOME"]?.trim() || join86(homedir24(), ".config");
|
|
111208
|
+
return resolveConfigPath2(join86(xdgConfigDir, "opencode"));
|
|
111090
111209
|
}
|
|
111091
111210
|
|
|
111092
111211
|
// packages/mcp-client-core/src/mcp-oauth/storage-index.ts
|
|
111093
|
-
import { chmodSync as
|
|
111094
|
-
import { join as
|
|
111212
|
+
import { chmodSync as chmodSync4, existsSync as existsSync61, readFileSync as readFileSync38, renameSync as renameSync6, writeFileSync as writeFileSync11 } from "node:fs";
|
|
111213
|
+
import { join as join87 } from "node:path";
|
|
111095
111214
|
var INDEX_FILE_NAME = "index.json";
|
|
111096
111215
|
function isTokenIndex(value) {
|
|
111097
111216
|
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
@@ -111099,14 +111218,14 @@ function isTokenIndex(value) {
|
|
|
111099
111218
|
return Object.values(value).every((entry) => typeof entry === "string");
|
|
111100
111219
|
}
|
|
111101
111220
|
function getIndexPath(storageDir) {
|
|
111102
|
-
return
|
|
111221
|
+
return join87(storageDir, INDEX_FILE_NAME);
|
|
111103
111222
|
}
|
|
111104
111223
|
function readTokenIndex(storageDir) {
|
|
111105
111224
|
const indexPath = getIndexPath(storageDir);
|
|
111106
|
-
if (!
|
|
111225
|
+
if (!existsSync61(indexPath))
|
|
111107
111226
|
return {};
|
|
111108
111227
|
try {
|
|
111109
|
-
const parsed = JSON.parse(
|
|
111228
|
+
const parsed = JSON.parse(readFileSync38(indexPath, "utf-8"));
|
|
111110
111229
|
return isTokenIndex(parsed) ? parsed : {};
|
|
111111
111230
|
} catch (readError) {
|
|
111112
111231
|
if (!(readError instanceof Error))
|
|
@@ -111118,8 +111237,8 @@ function writeTokenIndex(storageDir, index) {
|
|
|
111118
111237
|
try {
|
|
111119
111238
|
const indexPath = getIndexPath(storageDir);
|
|
111120
111239
|
const tempPath = `${indexPath}.tmp.${Date.now()}`;
|
|
111121
|
-
|
|
111122
|
-
|
|
111240
|
+
writeFileSync11(tempPath, JSON.stringify(index, null, 2), { encoding: "utf-8", mode: 384 });
|
|
111241
|
+
chmodSync4(tempPath, 384);
|
|
111123
111242
|
renameSync6(tempPath, indexPath);
|
|
111124
111243
|
return true;
|
|
111125
111244
|
} catch (writeError) {
|
|
@@ -111143,16 +111262,16 @@ function deleteTokenIndexEntry(storageDir, hash2) {
|
|
|
111143
111262
|
var STORAGE_DIR_NAME = "mcp-oauth";
|
|
111144
111263
|
var LEGACY_STORAGE_FILE_NAME = "mcp-oauth.json";
|
|
111145
111264
|
function getMcpOauthStorageDir() {
|
|
111146
|
-
return
|
|
111265
|
+
return join88(getOpenCodeCliConfigDir(), STORAGE_DIR_NAME);
|
|
111147
111266
|
}
|
|
111148
111267
|
function getMcpOauthServerHash(serverHost, resource) {
|
|
111149
111268
|
return createHash6("sha256").update(buildKey(serverHost, resource)).digest("hex").slice(0, 32);
|
|
111150
111269
|
}
|
|
111151
111270
|
function getMcpOauthStoragePath(serverHost, resource) {
|
|
111152
|
-
return
|
|
111271
|
+
return join88(getMcpOauthStorageDir(), `${getMcpOauthServerHash(serverHost, resource)}.json`);
|
|
111153
111272
|
}
|
|
111154
111273
|
function getLegacyStoragePath() {
|
|
111155
|
-
return
|
|
111274
|
+
return join88(getOpenCodeCliConfigDir(), LEGACY_STORAGE_FILE_NAME);
|
|
111156
111275
|
}
|
|
111157
111276
|
function normalizeHost2(serverHost) {
|
|
111158
111277
|
let host = serverHost.trim();
|
|
@@ -111213,10 +111332,10 @@ function isOAuthTokenData(value) {
|
|
|
111213
111332
|
return clientSecret === undefined || typeof clientSecret === "string";
|
|
111214
111333
|
}
|
|
111215
111334
|
function readTokenFile(filePath) {
|
|
111216
|
-
if (!
|
|
111335
|
+
if (!existsSync62(filePath))
|
|
111217
111336
|
return null;
|
|
111218
111337
|
try {
|
|
111219
|
-
const parsed = JSON.parse(
|
|
111338
|
+
const parsed = JSON.parse(readFileSync39(filePath, "utf-8"));
|
|
111220
111339
|
return isOAuthTokenData(parsed) ? parsed : null;
|
|
111221
111340
|
} catch (readError) {
|
|
111222
111341
|
if (!(readError instanceof Error))
|
|
@@ -111226,10 +111345,10 @@ function readTokenFile(filePath) {
|
|
|
111226
111345
|
}
|
|
111227
111346
|
function readLegacyStore() {
|
|
111228
111347
|
const filePath = getLegacyStoragePath();
|
|
111229
|
-
if (!
|
|
111348
|
+
if (!existsSync62(filePath))
|
|
111230
111349
|
return null;
|
|
111231
111350
|
try {
|
|
111232
|
-
const parsed = JSON.parse(
|
|
111351
|
+
const parsed = JSON.parse(readFileSync39(filePath, "utf-8"));
|
|
111233
111352
|
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed))
|
|
111234
111353
|
return null;
|
|
111235
111354
|
const result = {};
|
|
@@ -111246,13 +111365,13 @@ function readLegacyStore() {
|
|
|
111246
111365
|
}
|
|
111247
111366
|
function writeTokenFile(filePath, token) {
|
|
111248
111367
|
try {
|
|
111249
|
-
const dir =
|
|
111250
|
-
if (!
|
|
111251
|
-
|
|
111368
|
+
const dir = dirname33(filePath);
|
|
111369
|
+
if (!existsSync62(dir)) {
|
|
111370
|
+
mkdirSync15(dir, { recursive: true });
|
|
111252
111371
|
}
|
|
111253
111372
|
const tempPath = `${filePath}.tmp.${Date.now()}`;
|
|
111254
|
-
|
|
111255
|
-
|
|
111373
|
+
writeFileSync12(tempPath, JSON.stringify(token, null, 2), { encoding: "utf-8", mode: 384 });
|
|
111374
|
+
chmodSync5(tempPath, 384);
|
|
111256
111375
|
renameSync7(tempPath, filePath);
|
|
111257
111376
|
return true;
|
|
111258
111377
|
} catch (writeError) {
|
|
@@ -111271,7 +111390,7 @@ function saveToken(serverHost, resource, token) {
|
|
|
111271
111390
|
}
|
|
111272
111391
|
function deleteToken(serverHost, resource) {
|
|
111273
111392
|
const filePath = getMcpOauthStoragePath(serverHost, resource);
|
|
111274
|
-
if (!
|
|
111393
|
+
if (!existsSync62(filePath))
|
|
111275
111394
|
return deleteLegacyToken(serverHost, resource);
|
|
111276
111395
|
try {
|
|
111277
111396
|
unlinkSync9(filePath);
|
|
@@ -111293,7 +111412,7 @@ function deleteLegacyToken(serverHost, resource) {
|
|
|
111293
111412
|
if (Object.keys(store2).length === 0) {
|
|
111294
111413
|
try {
|
|
111295
111414
|
const filePath = getLegacyStoragePath();
|
|
111296
|
-
if (
|
|
111415
|
+
if (existsSync62(filePath))
|
|
111297
111416
|
unlinkSync9(filePath);
|
|
111298
111417
|
return true;
|
|
111299
111418
|
} catch (deleteError) {
|
|
@@ -111307,8 +111426,8 @@ function deleteLegacyToken(serverHost, resource) {
|
|
|
111307
111426
|
function writeLegacyStore(store2) {
|
|
111308
111427
|
try {
|
|
111309
111428
|
const filePath = getLegacyStoragePath();
|
|
111310
|
-
|
|
111311
|
-
|
|
111429
|
+
writeFileSync12(filePath, JSON.stringify(store2, null, 2), { encoding: "utf-8", mode: 384 });
|
|
111430
|
+
chmodSync5(filePath, 384);
|
|
111312
111431
|
return true;
|
|
111313
111432
|
} catch (writeError) {
|
|
111314
111433
|
if (!(writeError instanceof Error))
|
|
@@ -111331,7 +111450,7 @@ function listTokensByHost(serverHost) {
|
|
|
111331
111450
|
for (const [hash2, indexedKey] of Object.entries(index)) {
|
|
111332
111451
|
if (!indexedKey.startsWith(prefix))
|
|
111333
111452
|
continue;
|
|
111334
|
-
const indexedToken = readTokenFile(
|
|
111453
|
+
const indexedToken = readTokenFile(join88(getMcpOauthStorageDir(), `${hash2}.json`));
|
|
111335
111454
|
if (indexedToken)
|
|
111336
111455
|
result[indexedKey] = indexedToken;
|
|
111337
111456
|
}
|
|
@@ -111340,13 +111459,13 @@ function listTokensByHost(serverHost) {
|
|
|
111340
111459
|
function listAllTokens() {
|
|
111341
111460
|
const result = { ...readLegacyStore() ?? {} };
|
|
111342
111461
|
const dir = getMcpOauthStorageDir();
|
|
111343
|
-
if (!
|
|
111462
|
+
if (!existsSync62(dir))
|
|
111344
111463
|
return result;
|
|
111345
111464
|
const index = readTokenIndex(dir);
|
|
111346
111465
|
for (const entry of readdirSync11(dir, { withFileTypes: true })) {
|
|
111347
111466
|
if (!entry.isFile() || !entry.name.endsWith(".json") || entry.name === "index.json")
|
|
111348
111467
|
continue;
|
|
111349
|
-
const token = readTokenFile(
|
|
111468
|
+
const token = readTokenFile(join88(dir, entry.name));
|
|
111350
111469
|
const hash2 = basename12(entry.name, ".json");
|
|
111351
111470
|
if (token)
|
|
111352
111471
|
result[index[hash2] ?? hash2] = token;
|
|
@@ -111546,7 +111665,7 @@ function buildAuthorizationUrl(authorizationEndpoint, options) {
|
|
|
111546
111665
|
}
|
|
111547
111666
|
var CALLBACK_TIMEOUT_MS = 5 * 60 * 1000;
|
|
111548
111667
|
function startCallbackServer(port) {
|
|
111549
|
-
return new Promise((
|
|
111668
|
+
return new Promise((resolve27, reject) => {
|
|
111550
111669
|
let timeoutId;
|
|
111551
111670
|
const server2 = createServer2((request, response) => {
|
|
111552
111671
|
clearTimeout(timeoutId);
|
|
@@ -111572,7 +111691,7 @@ function startCallbackServer(port) {
|
|
|
111572
111691
|
response.writeHead(200, { "content-type": "text/html" });
|
|
111573
111692
|
response.end("<html><body><h1>Authorization successful. You can close this tab.</h1></body></html>");
|
|
111574
111693
|
server2.close();
|
|
111575
|
-
|
|
111694
|
+
resolve27({ code, state: state2 });
|
|
111576
111695
|
});
|
|
111577
111696
|
timeoutId = setTimeout(() => {
|
|
111578
111697
|
server2.close();
|
|
@@ -111912,7 +112031,7 @@ function createMcpOAuthCommand() {
|
|
|
111912
112031
|
}
|
|
111913
112032
|
|
|
111914
112033
|
// packages/omo-opencode/src/cli/boulder/boulder.ts
|
|
111915
|
-
import { existsSync as
|
|
112034
|
+
import { existsSync as existsSync63 } from "node:fs";
|
|
111916
112035
|
|
|
111917
112036
|
// packages/omo-opencode/src/cli/boulder/formatter.ts
|
|
111918
112037
|
var import_picocolors22 = __toESM(require_picocolors(), 1);
|
|
@@ -112049,10 +112168,10 @@ async function boulder(options) {
|
|
|
112049
112168
|
const boulderFilePath = getBoulderFilePath(directory);
|
|
112050
112169
|
const state2 = readBoulderState(directory);
|
|
112051
112170
|
if (!state2) {
|
|
112052
|
-
const message =
|
|
112171
|
+
const message = existsSync63(boulderFilePath) ? formatReadErrorMessage(options.json) : formatNoBoulderMessage(options.json);
|
|
112053
112172
|
process.stderr.write(`${message}
|
|
112054
112173
|
`);
|
|
112055
|
-
return
|
|
112174
|
+
return existsSync63(boulderFilePath) ? 2 : 1;
|
|
112056
112175
|
}
|
|
112057
112176
|
const works = getBoulderWorks(state2);
|
|
112058
112177
|
const filteredWorks = options.workId ? works.filter((work) => work.work_id === options.workId) : works;
|
|
@@ -112070,12 +112189,12 @@ async function boulder(options) {
|
|
|
112070
112189
|
}
|
|
112071
112190
|
// packages/omo-opencode/src/cli/codex-ulw-loop.ts
|
|
112072
112191
|
import { spawn as spawn5 } from "node:child_process";
|
|
112073
|
-
import { existsSync as
|
|
112074
|
-
import { homedir as
|
|
112192
|
+
import { existsSync as existsSync64, readFileSync as readFileSync40, realpathSync as realpathSync9 } from "node:fs";
|
|
112193
|
+
import { homedir as homedir25 } from "node:os";
|
|
112075
112194
|
var ULW_LOOP_DELEGATION_SENTINEL = "OMO_ULW_LOOP_DELEGATED";
|
|
112076
112195
|
function resolveCodexUlwLoopCommand(input = {}) {
|
|
112077
112196
|
const env3 = input.env ?? process.env;
|
|
112078
|
-
const homeDir = input.homeDir ??
|
|
112197
|
+
const homeDir = input.homeDir ?? homedir25();
|
|
112079
112198
|
const localComponentBin = resolveLocalUlwLoopBin(env3, homeDir);
|
|
112080
112199
|
if (localComponentBin !== null)
|
|
112081
112200
|
return { executable: localComponentBin, argsPrefix: [] };
|
|
@@ -112098,29 +112217,29 @@ async function codexUlwLoop(args) {
|
|
|
112098
112217
|
console.error("Codex ulw-loop is not installed. Run: npx lazycodex-ai@latest install --no-tui");
|
|
112099
112218
|
return 1;
|
|
112100
112219
|
}
|
|
112101
|
-
const { promise: promise2, resolve:
|
|
112220
|
+
const { promise: promise2, resolve: resolve27 } = Promise.withResolvers();
|
|
112102
112221
|
const child = spawn5(command.executable, [...command.argsPrefix, ...args], {
|
|
112103
112222
|
stdio: "inherit",
|
|
112104
112223
|
env: { ...process.env, [ULW_LOOP_DELEGATION_SENTINEL]: "1" }
|
|
112105
112224
|
});
|
|
112106
112225
|
child.on("error", (error51) => {
|
|
112107
112226
|
console.error(error51.message);
|
|
112108
|
-
|
|
112227
|
+
resolve27(1);
|
|
112109
112228
|
});
|
|
112110
|
-
child.on("close", (code) =>
|
|
112229
|
+
child.on("close", (code) => resolve27(code ?? 1));
|
|
112111
112230
|
return promise2;
|
|
112112
112231
|
}
|
|
112113
112232
|
function resolveLocalUlwLoopBin(env3, homeDir) {
|
|
112114
112233
|
const candidates = resolveCodexComponentBinCandidates({ executableName: "omo-ulw-loop", env: env3, homeDir });
|
|
112115
|
-
return candidates.find((candidate2) =>
|
|
112234
|
+
return candidates.find((candidate2) => existsSync64(candidate2)) ?? null;
|
|
112116
112235
|
}
|
|
112117
112236
|
function resolveLegacyLocalOmoBin(env3, homeDir, currentExecutablePaths) {
|
|
112118
112237
|
const candidates = resolveCodexComponentBinCandidates({ executableName: "omo", env: env3, homeDir });
|
|
112119
|
-
return candidates.find((candidate2) =>
|
|
112238
|
+
return candidates.find((candidate2) => existsSync64(candidate2) && !isCurrentExecutable(candidate2, currentExecutablePaths) && !isGeneratedRuntimeWrapper(candidate2)) ?? null;
|
|
112120
112239
|
}
|
|
112121
112240
|
function isGeneratedRuntimeWrapper(candidate2) {
|
|
112122
112241
|
try {
|
|
112123
|
-
return
|
|
112242
|
+
return readFileSync40(candidate2, "utf8").includes(RUNTIME_WRAPPER_MARKER);
|
|
112124
112243
|
} catch (error51) {
|
|
112125
112244
|
if (error51 instanceof Error)
|
|
112126
112245
|
return false;
|