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/index.js
CHANGED
|
@@ -2145,7 +2145,7 @@ var package_default;
|
|
|
2145
2145
|
var init_package = __esm(() => {
|
|
2146
2146
|
package_default = {
|
|
2147
2147
|
name: "oh-my-opencode",
|
|
2148
|
-
version: "5.0.0-beta.
|
|
2148
|
+
version: "5.0.0-beta.6",
|
|
2149
2149
|
description: "The Best AI Agent Harness - Batteries-Included OpenCode Plugin with Multi-Model Orchestration, Parallel Background Agents, and Crafted LSP/AST Tools",
|
|
2150
2150
|
main: "./dist/index.js",
|
|
2151
2151
|
types: "dist/index.d.ts",
|
|
@@ -2325,7 +2325,7 @@ var init_package = __esm(() => {
|
|
|
2325
2325
|
zod: "^4.4.3"
|
|
2326
2326
|
},
|
|
2327
2327
|
devDependencies: {
|
|
2328
|
-
"@code-yeongyu/senpi": "2026.8.11",
|
|
2328
|
+
"@code-yeongyu/senpi": "2026.8.11-4",
|
|
2329
2329
|
"@oh-my-opencode/agents-md-core": "workspace:*",
|
|
2330
2330
|
"@oh-my-opencode/ast-grep-mcp": "workspace:*",
|
|
2331
2331
|
"@oh-my-opencode/boulder-state": "workspace:*",
|
|
@@ -2341,6 +2341,7 @@ var init_package = __esm(() => {
|
|
|
2341
2341
|
"@oh-my-opencode/model-core": "workspace:*",
|
|
2342
2342
|
"@oh-my-opencode/omo-codex": "workspace:*",
|
|
2343
2343
|
"@oh-my-opencode/omo-config-core": "workspace:*",
|
|
2344
|
+
"@oh-my-opencode/omo-opencode": "workspace:*",
|
|
2344
2345
|
"@oh-my-opencode/omo-senpi": "workspace:*",
|
|
2345
2346
|
"@oh-my-opencode/openclaw-core": "workspace:*",
|
|
2346
2347
|
"@oh-my-opencode/pi-goal": "workspace:*",
|
|
@@ -2365,18 +2366,18 @@ var init_package = __esm(() => {
|
|
|
2365
2366
|
typescript: "^7.0.2"
|
|
2366
2367
|
},
|
|
2367
2368
|
optionalDependencies: {
|
|
2368
|
-
"oh-my-opencode-darwin-arm64": "5.0.0-beta.
|
|
2369
|
-
"oh-my-opencode-darwin-x64": "5.0.0-beta.
|
|
2370
|
-
"oh-my-opencode-darwin-x64-baseline": "5.0.0-beta.
|
|
2371
|
-
"oh-my-opencode-linux-arm64": "5.0.0-beta.
|
|
2372
|
-
"oh-my-opencode-linux-arm64-musl": "5.0.0-beta.
|
|
2373
|
-
"oh-my-opencode-linux-x64": "5.0.0-beta.
|
|
2374
|
-
"oh-my-opencode-linux-x64-baseline": "5.0.0-beta.
|
|
2375
|
-
"oh-my-opencode-linux-x64-musl": "5.0.0-beta.
|
|
2376
|
-
"oh-my-opencode-linux-x64-musl-baseline": "5.0.0-beta.
|
|
2377
|
-
"oh-my-opencode-windows-arm64": "5.0.0-beta.
|
|
2378
|
-
"oh-my-opencode-windows-x64": "5.0.0-beta.
|
|
2379
|
-
"oh-my-opencode-windows-x64-baseline": "5.0.0-beta.
|
|
2369
|
+
"oh-my-opencode-darwin-arm64": "5.0.0-beta.6",
|
|
2370
|
+
"oh-my-opencode-darwin-x64": "5.0.0-beta.6",
|
|
2371
|
+
"oh-my-opencode-darwin-x64-baseline": "5.0.0-beta.6",
|
|
2372
|
+
"oh-my-opencode-linux-arm64": "5.0.0-beta.6",
|
|
2373
|
+
"oh-my-opencode-linux-arm64-musl": "5.0.0-beta.6",
|
|
2374
|
+
"oh-my-opencode-linux-x64": "5.0.0-beta.6",
|
|
2375
|
+
"oh-my-opencode-linux-x64-baseline": "5.0.0-beta.6",
|
|
2376
|
+
"oh-my-opencode-linux-x64-musl": "5.0.0-beta.6",
|
|
2377
|
+
"oh-my-opencode-linux-x64-musl-baseline": "5.0.0-beta.6",
|
|
2378
|
+
"oh-my-opencode-windows-arm64": "5.0.0-beta.6",
|
|
2379
|
+
"oh-my-opencode-windows-x64": "5.0.0-beta.6",
|
|
2380
|
+
"oh-my-opencode-windows-x64-baseline": "5.0.0-beta.6"
|
|
2380
2381
|
},
|
|
2381
2382
|
overrides: {
|
|
2382
2383
|
"@earendil-works/pi-agent-core": "0.80.3",
|
|
@@ -22627,6 +22628,19 @@ var init_team = __esm(() => {
|
|
|
22627
22628
|
OmoTeamsConfigLayerSchema = record(string2(), OmoTeamSpecLayerSchema);
|
|
22628
22629
|
});
|
|
22629
22630
|
|
|
22631
|
+
// packages/omo-config-core/src/schema/telemetry.ts
|
|
22632
|
+
var OmoTelemetrySettingsShape, OmoTelemetrySettingsLayerSchema, OmoTelemetrySettingsSchema;
|
|
22633
|
+
var init_telemetry = __esm(() => {
|
|
22634
|
+
init_zod();
|
|
22635
|
+
OmoTelemetrySettingsShape = {
|
|
22636
|
+
enabled: boolean2()
|
|
22637
|
+
};
|
|
22638
|
+
OmoTelemetrySettingsLayerSchema = object(OmoTelemetrySettingsShape).partial().strict();
|
|
22639
|
+
OmoTelemetrySettingsSchema = OmoTelemetrySettingsLayerSchema.extend({
|
|
22640
|
+
enabled: boolean2().default(true)
|
|
22641
|
+
}).strict();
|
|
22642
|
+
});
|
|
22643
|
+
|
|
22630
22644
|
// packages/omo-config-core/src/schema/config.ts
|
|
22631
22645
|
var OmoOpenCodeHarnessConfigSchema, OmoTypedHarnessConfigSchema, OmoConfigProfileSchema, OmoConfigSchema, OmoConfigLayerSchema;
|
|
22632
22646
|
var init_config = __esm(() => {
|
|
@@ -22638,6 +22652,7 @@ var init_config = __esm(() => {
|
|
|
22638
22652
|
init_model_catalog();
|
|
22639
22653
|
init_task();
|
|
22640
22654
|
init_team();
|
|
22655
|
+
init_telemetry();
|
|
22641
22656
|
OmoOpenCodeHarnessConfigSchema = record(string2(), unknown());
|
|
22642
22657
|
OmoTypedHarnessConfigSchema = object({
|
|
22643
22658
|
categories: OmoCategoriesConfigSchema.optional(),
|
|
@@ -22646,7 +22661,8 @@ var init_config = __esm(() => {
|
|
|
22646
22661
|
task: OmoTaskSettingsLayerSchema.optional(),
|
|
22647
22662
|
teams: OmoTeamsConfigLayerSchema.optional(),
|
|
22648
22663
|
models: OmoModelCatalogLayerSchema.optional(),
|
|
22649
|
-
memory: OmoMemorySettingsLayerSchema.optional()
|
|
22664
|
+
memory: OmoMemorySettingsLayerSchema.optional(),
|
|
22665
|
+
telemetry: OmoTelemetrySettingsLayerSchema.optional()
|
|
22650
22666
|
}).strict();
|
|
22651
22667
|
OmoConfigProfileSchema = object({
|
|
22652
22668
|
categories: OmoCategoriesConfigSchema.optional(),
|
|
@@ -22656,6 +22672,7 @@ var init_config = __esm(() => {
|
|
|
22656
22672
|
teams: OmoTeamsConfigLayerSchema.optional(),
|
|
22657
22673
|
models: OmoModelCatalogLayerSchema.optional(),
|
|
22658
22674
|
memory: OmoMemorySettingsLayerSchema.optional(),
|
|
22675
|
+
telemetry: OmoTelemetrySettingsLayerSchema.optional(),
|
|
22659
22676
|
"[opencode]": OmoOpenCodeHarnessConfigSchema.optional(),
|
|
22660
22677
|
"[senpi]": OmoTypedHarnessConfigSchema.optional(),
|
|
22661
22678
|
"[codex]": OmoTypedHarnessConfigSchema.optional()
|
|
@@ -22669,6 +22686,7 @@ var init_config = __esm(() => {
|
|
|
22669
22686
|
teams: OmoTeamsConfigSchema.optional(),
|
|
22670
22687
|
models: OmoModelCatalogSchema.optional(),
|
|
22671
22688
|
memory: OmoMemorySettingsSchema.optional(),
|
|
22689
|
+
telemetry: OmoTelemetrySettingsSchema.optional(),
|
|
22672
22690
|
"[opencode]": OmoOpenCodeHarnessConfigSchema.optional(),
|
|
22673
22691
|
"[senpi]": OmoTypedHarnessConfigSchema.optional(),
|
|
22674
22692
|
"[codex]": OmoTypedHarnessConfigSchema.optional(),
|
|
@@ -22685,6 +22703,7 @@ var init_config = __esm(() => {
|
|
|
22685
22703
|
teams: OmoTeamsConfigLayerSchema.optional(),
|
|
22686
22704
|
models: OmoModelCatalogLayerSchema.optional(),
|
|
22687
22705
|
memory: OmoMemorySettingsLayerSchema.optional(),
|
|
22706
|
+
telemetry: OmoTelemetrySettingsLayerSchema.optional(),
|
|
22688
22707
|
"[opencode]": OmoOpenCodeHarnessConfigSchema.optional(),
|
|
22689
22708
|
"[senpi]": OmoTypedHarnessConfigSchema.optional(),
|
|
22690
22709
|
"[codex]": OmoTypedHarnessConfigSchema.optional(),
|
|
@@ -22707,6 +22726,7 @@ var init_schema = __esm(() => {
|
|
|
22707
22726
|
init_model_ref();
|
|
22708
22727
|
init_task();
|
|
22709
22728
|
init_team();
|
|
22729
|
+
init_telemetry();
|
|
22710
22730
|
});
|
|
22711
22731
|
|
|
22712
22732
|
// packages/omo-config-core/src/loader/merge.ts
|
|
@@ -88714,7 +88734,7 @@ var init_activity_state = __esm(() => {
|
|
|
88714
88734
|
});
|
|
88715
88735
|
|
|
88716
88736
|
// packages/telemetry-core/src/constants.ts
|
|
88717
|
-
var DEFAULT_POSTHOG_HOST = "https://us.i.posthog.com", DEFAULT_POSTHOG_API_KEY = "phc_CFJhj5HyvA62QPhvyaUCtaq23aUfznnijg5VaaGkNk74";
|
|
88737
|
+
var DEFAULT_POSTHOG_HOST = "https://us.i.posthog.com", DEFAULT_POSTHOG_API_KEY = "phc_CFJhj5HyvA62QPhvyaUCtaq23aUfznnijg5VaaGkNk74", UNCONFIGURED_POSTHOG_API_KEY = "phc_REPLACE_ME_OMO_NATIVE";
|
|
88718
88738
|
|
|
88719
88739
|
// packages/telemetry-core/src/diagnostics.ts
|
|
88720
88740
|
import { appendFileSync as appendFileSync2, existsSync as existsSync27, mkdirSync as mkdirSync9, readFileSync as readFileSync13 } from "fs";
|
|
@@ -88852,6 +88872,9 @@ function shouldDisableTelemetry(input) {
|
|
|
88852
88872
|
const env2 = input.env ?? process.env;
|
|
88853
88873
|
const globalPrefix = input.globalEnvPrefix ?? "OMO";
|
|
88854
88874
|
const prefixes = Array.from(new Set([globalPrefix, input.productEnvPrefix]));
|
|
88875
|
+
if (isDisableFlag(env2["DO_NOT_TRACK"])) {
|
|
88876
|
+
return true;
|
|
88877
|
+
}
|
|
88855
88878
|
for (const prefix of prefixes) {
|
|
88856
88879
|
if (isDisableFlag(env2[`${prefix}_DISABLE_POSTHOG`])) {
|
|
88857
88880
|
return true;
|
|
@@ -88865,6 +88888,13 @@ function shouldDisableTelemetry(input) {
|
|
|
88865
88888
|
function getTelemetryApiKey(env2 = process.env, defaultApiKey = DEFAULT_POSTHOG_API_KEY) {
|
|
88866
88889
|
return env2["POSTHOG_API_KEY"]?.trim() ?? defaultApiKey;
|
|
88867
88890
|
}
|
|
88891
|
+
function isConfiguredTelemetryApiKey(apiKey) {
|
|
88892
|
+
const normalized = apiKey.trim();
|
|
88893
|
+
return normalized.length > 0 && normalized !== UNCONFIGURED_POSTHOG_API_KEY;
|
|
88894
|
+
}
|
|
88895
|
+
function hasTelemetryApiKey(env2, defaultApiKey) {
|
|
88896
|
+
return isConfiguredTelemetryApiKey(getTelemetryApiKey(env2, defaultApiKey));
|
|
88897
|
+
}
|
|
88868
88898
|
function getTelemetryHost(env2 = process.env, defaultHost = DEFAULT_POSTHOG_HOST) {
|
|
88869
88899
|
return env2["POSTHOG_HOST"]?.trim() || defaultHost;
|
|
88870
88900
|
}
|
|
@@ -88874,17 +88904,6 @@ var init_env2 = __esm(() => {
|
|
|
88874
88904
|
SEND_OPT_OUT_VALUES = ["0", "false", "no", "yes"];
|
|
88875
88905
|
});
|
|
88876
88906
|
|
|
88877
|
-
// packages/telemetry-core/src/machine-id.ts
|
|
88878
|
-
import { createHash as createHash4 } from "crypto";
|
|
88879
|
-
import os4 from "os";
|
|
88880
|
-
function getDefaultTelemetryOsProvider() {
|
|
88881
|
-
return os4;
|
|
88882
|
-
}
|
|
88883
|
-
function getTelemetryDistinctId(machineIdPrefix, osProvider = getDefaultTelemetryOsProvider()) {
|
|
88884
|
-
return createHash4("sha256").update(`${machineIdPrefix}${osProvider.hostname()}`).digest("hex");
|
|
88885
|
-
}
|
|
88886
|
-
var init_machine_id = () => {};
|
|
88887
|
-
|
|
88888
88907
|
// node_modules/.bun/posthog-node@5.35.12/node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
|
|
88889
88908
|
import { dirname as dirname17, posix as posix7, sep as sep7 } from "path";
|
|
88890
88909
|
function createModulerModifier() {
|
|
@@ -94259,6 +94278,17 @@ var init_index_node = __esm(() => {
|
|
|
94259
94278
|
};
|
|
94260
94279
|
});
|
|
94261
94280
|
|
|
94281
|
+
// packages/telemetry-core/src/machine-id.ts
|
|
94282
|
+
import { createHash as createHash4 } from "crypto";
|
|
94283
|
+
import os4 from "os";
|
|
94284
|
+
function getDefaultTelemetryOsProvider() {
|
|
94285
|
+
return os4;
|
|
94286
|
+
}
|
|
94287
|
+
function getTelemetryDistinctId(machineIdPrefix, osProvider = getDefaultTelemetryOsProvider()) {
|
|
94288
|
+
return createHash4("sha256").update(`${machineIdPrefix}${osProvider.hostname()}`).digest("hex");
|
|
94289
|
+
}
|
|
94290
|
+
var init_machine_id = () => {};
|
|
94291
|
+
|
|
94262
94292
|
// packages/telemetry-core/src/posthog-client.ts
|
|
94263
94293
|
class PostHogTelemetryTransport {
|
|
94264
94294
|
#client;
|
|
@@ -94280,7 +94310,7 @@ function createDefaultPostHogTransport(apiKey, options) {
|
|
|
94280
94310
|
}
|
|
94281
94311
|
function isTelemetryClientEnabled(input) {
|
|
94282
94312
|
const env2 = input.env ?? process.env;
|
|
94283
|
-
return !shouldDisableTelemetry({ env: env2, productEnvPrefix: input.product.productEnvPrefix }) &&
|
|
94313
|
+
return !shouldDisableTelemetry({ env: env2, productEnvPrefix: input.product.productEnvPrefix }) && hasTelemetryApiKey(env2, input.product.defaultApiKey);
|
|
94284
94314
|
}
|
|
94285
94315
|
function createTelemetryClient(input) {
|
|
94286
94316
|
if (!isTelemetryClientEnabled(input)) {
|
|
@@ -94346,7 +94376,8 @@ function createTransport(input) {
|
|
|
94346
94376
|
flushAt: 1,
|
|
94347
94377
|
flushInterval: 0,
|
|
94348
94378
|
host: getTelemetryHost(env2, input.product.defaultHost),
|
|
94349
|
-
disableGeoip: false
|
|
94379
|
+
disableGeoip: input.product.disableGeoip ?? false,
|
|
94380
|
+
...input.product.transportOptions
|
|
94350
94381
|
});
|
|
94351
94382
|
} catch (error51) {
|
|
94352
94383
|
input.diagnostics?.({
|
|
@@ -94423,6 +94454,17 @@ var init_posthog_client = __esm(() => {
|
|
|
94423
94454
|
};
|
|
94424
94455
|
});
|
|
94425
94456
|
|
|
94457
|
+
// packages/telemetry-core/src/events.ts
|
|
94458
|
+
var ALLOWED_DOLLAR_KEYS;
|
|
94459
|
+
var init_events = __esm(() => {
|
|
94460
|
+
ALLOWED_DOLLAR_KEYS = new Set([
|
|
94461
|
+
"$os",
|
|
94462
|
+
"$os_version",
|
|
94463
|
+
"$process_person_profile",
|
|
94464
|
+
"$session_id"
|
|
94465
|
+
]);
|
|
94466
|
+
});
|
|
94467
|
+
|
|
94426
94468
|
// packages/telemetry-core/src/record-daily-active.ts
|
|
94427
94469
|
var init_record_daily_active = () => {};
|
|
94428
94470
|
|
|
@@ -94431,6 +94473,7 @@ var init_src5 = __esm(() => {
|
|
|
94431
94473
|
init_activity_state();
|
|
94432
94474
|
init_diagnostics();
|
|
94433
94475
|
init_env2();
|
|
94476
|
+
init_events();
|
|
94434
94477
|
init_machine_id();
|
|
94435
94478
|
init_posthog_client();
|
|
94436
94479
|
init_record_daily_active();
|
|
@@ -94441,7 +94484,7 @@ var package_default2;
|
|
|
94441
94484
|
var init_package2 = __esm(() => {
|
|
94442
94485
|
package_default2 = {
|
|
94443
94486
|
name: "@oh-my-opencode/omo-codex",
|
|
94444
|
-
version: "5.0.0-beta.
|
|
94487
|
+
version: "5.0.0-beta.6",
|
|
94445
94488
|
type: "module",
|
|
94446
94489
|
private: true,
|
|
94447
94490
|
description: "Codex harness adapter for oh-my-openagent. Vendored Codex plugin namespace (omo) + TypeScript installer + telemetry.",
|
|
@@ -94655,7 +94698,7 @@ __export(exports_telemetry, {
|
|
|
94655
94698
|
__resetOsProviderForTesting: () => __resetOsProviderForTesting,
|
|
94656
94699
|
__resetActivityStateProviderForTesting: () => __resetActivityStateProviderForTesting
|
|
94657
94700
|
});
|
|
94658
|
-
var
|
|
94701
|
+
var init_telemetry2 = __esm(() => {
|
|
94659
94702
|
init_posthog();
|
|
94660
94703
|
});
|
|
94661
94704
|
|
|
@@ -95410,20 +95453,20 @@ var init_update_toasts = __esm(() => {
|
|
|
95410
95453
|
});
|
|
95411
95454
|
|
|
95412
95455
|
// packages/omo-opencode/src/hooks/auto-update-checker/hook/background-update-check.ts
|
|
95413
|
-
import { existsSync as
|
|
95414
|
-
import { dirname as
|
|
95456
|
+
import { existsSync as existsSync47 } from "fs";
|
|
95457
|
+
import { dirname as dirname29, join as join74 } from "path";
|
|
95415
95458
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
95416
95459
|
function defaultGetModuleHostingWorkspace() {
|
|
95417
95460
|
try {
|
|
95418
|
-
const currentDir =
|
|
95461
|
+
const currentDir = dirname29(fileURLToPath5(import.meta.url));
|
|
95419
95462
|
const pkgJsonPath = findPackageJsonUp(currentDir);
|
|
95420
95463
|
if (!pkgJsonPath)
|
|
95421
95464
|
return null;
|
|
95422
|
-
const pkgDir =
|
|
95423
|
-
const nodeModulesDir =
|
|
95465
|
+
const pkgDir = dirname29(pkgJsonPath);
|
|
95466
|
+
const nodeModulesDir = dirname29(pkgDir);
|
|
95424
95467
|
if (nodeModulesDir.split(/[\\/]/).pop() !== "node_modules")
|
|
95425
95468
|
return null;
|
|
95426
|
-
return
|
|
95469
|
+
return dirname29(nodeModulesDir);
|
|
95427
95470
|
} catch (error51) {
|
|
95428
95471
|
if (error51 instanceof Error) {
|
|
95429
95472
|
return null;
|
|
@@ -95564,8 +95607,8 @@ var init_background_update_check = __esm(() => {
|
|
|
95564
95607
|
init_package_json_locator();
|
|
95565
95608
|
init_update_toasts();
|
|
95566
95609
|
defaultDeps4 = {
|
|
95567
|
-
existsSync:
|
|
95568
|
-
join:
|
|
95610
|
+
existsSync: existsSync47,
|
|
95611
|
+
join: join74,
|
|
95569
95612
|
runBunInstallWithDetails,
|
|
95570
95613
|
log: log2,
|
|
95571
95614
|
getOpenCodeCacheDir,
|
|
@@ -95728,7 +95771,7 @@ async function showSpinnerToast(ctx, version3, message) {
|
|
|
95728
95771
|
duration: frameInterval + 50
|
|
95729
95772
|
}
|
|
95730
95773
|
}).catch(ignoreToastError);
|
|
95731
|
-
await new Promise((
|
|
95774
|
+
await new Promise((resolve21) => setTimeout(resolve21, frameInterval));
|
|
95732
95775
|
}
|
|
95733
95776
|
}
|
|
95734
95777
|
var SISYPHUS_SPINNER;
|
|
@@ -100520,7 +100563,7 @@ async function installAstGrepForCodex(options) {
|
|
|
100520
100563
|
// packages/omo-codex/src/install/codex-install-telemetry.ts
|
|
100521
100564
|
async function trackCodexInstallTelemetry() {
|
|
100522
100565
|
try {
|
|
100523
|
-
const { createInstallPostHog: createInstallPostHog2, getPostHogDistinctId: getPostHogDistinctId2 } = await Promise.resolve().then(() => (
|
|
100566
|
+
const { createInstallPostHog: createInstallPostHog2, getPostHogDistinctId: getPostHogDistinctId2 } = await Promise.resolve().then(() => (init_telemetry2(), exports_telemetry));
|
|
100524
100567
|
const posthog = createInstallPostHog2();
|
|
100525
100568
|
posthog.trackActive(getPostHogDistinctId2(), "install_completed");
|
|
100526
100569
|
await posthog.shutdown();
|
|
@@ -101341,21 +101384,93 @@ var CODEGRAPH_RELATIVE_ARGS2 = new Set(["components/codegraph/dist/serve.js", ".
|
|
|
101341
101384
|
// packages/omo-senpi/src/install/install-senpi.ts
|
|
101342
101385
|
import { execFile as execFile4 } from "child_process";
|
|
101343
101386
|
import { createHash as createHash5 } from "crypto";
|
|
101344
|
-
import { constants as constants8, existsSync as
|
|
101387
|
+
import { constants as constants8, existsSync as existsSync31 } from "fs";
|
|
101345
101388
|
import { access as access2, readFile as readFile26, stat as stat6 } from "fs/promises";
|
|
101346
|
-
import { homedir as
|
|
101347
|
-
import { dirname as
|
|
101389
|
+
import { homedir as homedir10 } from "os";
|
|
101390
|
+
import { dirname as dirname23, join as join61, resolve as resolve19 } from "path";
|
|
101348
101391
|
import { fileURLToPath } from "url";
|
|
101349
101392
|
import { promisify as promisify2 } from "util";
|
|
101350
101393
|
|
|
101394
|
+
// packages/omo-senpi/src/install/local-launcher.ts
|
|
101395
|
+
import { chmodSync as chmodSync3, existsSync as existsSync30, mkdirSync as mkdirSync10, readFileSync as readFileSync14, rmSync, writeFileSync as writeFileSync6 } from "fs";
|
|
101396
|
+
import { homedir as homedir9 } from "os";
|
|
101397
|
+
import { dirname as dirname21, join as join59, resolve as resolve17 } from "path";
|
|
101398
|
+
var MARKER = "omo-local-launcher";
|
|
101399
|
+
function localLauncherPath(homeDir = homedir9()) {
|
|
101400
|
+
return join59(homeDir, ".local", "bin", "omo");
|
|
101401
|
+
}
|
|
101402
|
+
function localLauncherCmdPath(homeDir = homedir9()) {
|
|
101403
|
+
return join59(homeDir, ".local", "bin", "omo.cmd");
|
|
101404
|
+
}
|
|
101405
|
+
function renderLocalLauncher(options) {
|
|
101406
|
+
const brand = {
|
|
101407
|
+
name: "omo",
|
|
101408
|
+
displayVersion: options.version ?? "local",
|
|
101409
|
+
configDir: ".omo",
|
|
101410
|
+
flatLayout: true,
|
|
101411
|
+
envPrefix: "OMO",
|
|
101412
|
+
userAgent: "omo",
|
|
101413
|
+
originator: "omo",
|
|
101414
|
+
update: {
|
|
101415
|
+
packageName: "omo-ai",
|
|
101416
|
+
distTag: "beta",
|
|
101417
|
+
command: "npm i -g omo-ai@beta",
|
|
101418
|
+
changelogUrl: "https://github.com/code-yeongyu/oh-my-openagent/releases"
|
|
101419
|
+
}
|
|
101420
|
+
};
|
|
101421
|
+
return `#!/usr/bin/env node
|
|
101422
|
+
// ${MARKER}: generated by the omo-senpi installer. Delete this file to remove the local launcher.
|
|
101423
|
+
import { spawn } from "node:child_process"
|
|
101424
|
+
|
|
101425
|
+
const brand = ${JSON.stringify(brand)}
|
|
101426
|
+
const cli = process.env.OMO_SENPI_CLI_PATH ?? ${JSON.stringify(options.senpiCliPath)}
|
|
101427
|
+
const plugin = process.env.OMO_PLUGIN_ROOT ?? ${JSON.stringify(options.pluginPath)}
|
|
101428
|
+
const env = { ...process.env, SENPI_BRAND: JSON.stringify(brand), OMO_NATIVE: "1" }
|
|
101429
|
+
// Anything resolving the product by name must re-enter through this launcher, never the engine.
|
|
101430
|
+
env.OMO_BIN = process.argv[1]
|
|
101431
|
+
const selfUpdate = process.argv[2] === "update"
|
|
101432
|
+
&& process.argv.slice(3).every((arg) => arg.startsWith("-") || ["self", "senpi", "omo"].includes(arg))
|
|
101433
|
+
&& !process.argv.slice(3).some((arg) => arg === "--extensions" || arg === "--models")
|
|
101434
|
+
if (selfUpdate) {
|
|
101435
|
+
console.log("omo is updated via npm: npm i -g omo-ai@beta")
|
|
101436
|
+
process.exit(0)
|
|
101437
|
+
}
|
|
101438
|
+
const child = spawn(process.execPath, [cli, "--extension", plugin, ...process.argv.slice(2)], {
|
|
101439
|
+
env,
|
|
101440
|
+
stdio: "inherit",
|
|
101441
|
+
})
|
|
101442
|
+
child.on("close", (code, signal) => {
|
|
101443
|
+
if (signal) {
|
|
101444
|
+
process.kill(process.pid, signal)
|
|
101445
|
+
return
|
|
101446
|
+
}
|
|
101447
|
+
process.exitCode = code ?? 1
|
|
101448
|
+
})
|
|
101449
|
+
`;
|
|
101450
|
+
}
|
|
101451
|
+
function installLocalLauncher(options) {
|
|
101452
|
+
const path6 = localLauncherPath(options.homeDir);
|
|
101453
|
+
if (existsSync30(path6) && !readFileSync14(path6, "utf8").includes(MARKER))
|
|
101454
|
+
return;
|
|
101455
|
+
mkdirSync10(dirname21(path6), { recursive: true });
|
|
101456
|
+
writeFileSync6(path6, renderLocalLauncher(options));
|
|
101457
|
+
chmodSync3(path6, 493);
|
|
101458
|
+
if ((options.platform ?? process.platform) === "win32") {
|
|
101459
|
+
writeFileSync6(localLauncherCmdPath(options.homeDir), `@echo off\r
|
|
101460
|
+
node "%~dp0omo" %*\r
|
|
101461
|
+
`);
|
|
101462
|
+
}
|
|
101463
|
+
return path6;
|
|
101464
|
+
}
|
|
101465
|
+
|
|
101351
101466
|
// packages/omo-senpi/src/install/senpi-settings.ts
|
|
101352
101467
|
import { constants as constants7 } from "fs";
|
|
101353
101468
|
import { access, copyFile as copyFile3, mkdir as mkdir9, readFile as readFile25, rename as rename5, writeFile as writeFile14 } from "fs/promises";
|
|
101354
|
-
import { dirname as
|
|
101469
|
+
import { dirname as dirname22, join as join60, resolve as resolve18 } from "path";
|
|
101355
101470
|
var OMO_SENPI_PACKAGE_NAME = "@code-yeongyu/omo-senpi";
|
|
101356
101471
|
var LEGACY_BUILTIN_SHADOW_PACKAGES = [
|
|
101357
|
-
|
|
101358
|
-
|
|
101472
|
+
join60("packages", "pi-goal"),
|
|
101473
|
+
join60("packages", "pi-webfetch")
|
|
101359
101474
|
];
|
|
101360
101475
|
async function readSettings(settingsPath) {
|
|
101361
101476
|
let raw;
|
|
@@ -101384,13 +101499,13 @@ function dedupePackages(packages) {
|
|
|
101384
101499
|
return [...new Set(packages)];
|
|
101385
101500
|
}
|
|
101386
101501
|
function removeLegacyBuiltinShadows(packages, repoRoot, agentDir) {
|
|
101387
|
-
const shadowPaths = new Set(LEGACY_BUILTIN_SHADOW_PACKAGES.map((path6) =>
|
|
101388
|
-
return packages.filter((entry) => !shadowPaths.has(
|
|
101502
|
+
const shadowPaths = new Set(LEGACY_BUILTIN_SHADOW_PACKAGES.map((path6) => resolve18(repoRoot, path6)));
|
|
101503
|
+
return packages.filter((entry) => !shadowPaths.has(resolve18(agentDir, entry)));
|
|
101389
101504
|
}
|
|
101390
101505
|
async function removeSupersededOmoPackages(packages, currentPluginPath, agentDir) {
|
|
101391
|
-
const currentPath =
|
|
101506
|
+
const currentPath = resolve18(currentPluginPath);
|
|
101392
101507
|
const entries = await Promise.all(packages.map(async (entry) => {
|
|
101393
|
-
const packagePath =
|
|
101508
|
+
const packagePath = resolve18(agentDir, entry);
|
|
101394
101509
|
if (packagePath === currentPath)
|
|
101395
101510
|
return currentPath;
|
|
101396
101511
|
return await readPackageName(packagePath) === OMO_SENPI_PACKAGE_NAME ? undefined : entry;
|
|
@@ -101398,7 +101513,7 @@ async function removeSupersededOmoPackages(packages, currentPluginPath, agentDir
|
|
|
101398
101513
|
return entries.filter((entry) => entry !== undefined);
|
|
101399
101514
|
}
|
|
101400
101515
|
async function writeSettingsAtomically(settingsPath, settings) {
|
|
101401
|
-
await mkdir9(
|
|
101516
|
+
await mkdir9(dirname22(settingsPath), { recursive: true });
|
|
101402
101517
|
const backupPath = await nextBackupPath(settingsPath);
|
|
101403
101518
|
if (await fileExists(settingsPath)) {
|
|
101404
101519
|
await copyFile3(settingsPath, backupPath);
|
|
@@ -101430,7 +101545,7 @@ function isRecord10(value) {
|
|
|
101430
101545
|
async function readPackageName(packagePath) {
|
|
101431
101546
|
let raw;
|
|
101432
101547
|
try {
|
|
101433
|
-
raw = await readFile25(
|
|
101548
|
+
raw = await readFile25(join60(packagePath, "package.json"), "utf8");
|
|
101434
101549
|
} catch (error51) {
|
|
101435
101550
|
if (isErrno(error51, "ENOENT") || isErrno(error51, "ENOTDIR"))
|
|
101436
101551
|
return;
|
|
@@ -101456,39 +101571,39 @@ function isErrno(error51, code) {
|
|
|
101456
101571
|
// packages/omo-senpi/src/install/install-senpi.ts
|
|
101457
101572
|
var execFileAsync2 = promisify2(execFile4);
|
|
101458
101573
|
var REQUIRED_PLUGIN_ARTIFACTS = [
|
|
101459
|
-
|
|
101460
|
-
|
|
101461
|
-
|
|
101462
|
-
|
|
101463
|
-
|
|
101464
|
-
|
|
101465
|
-
|
|
101466
|
-
|
|
101467
|
-
|
|
101468
|
-
|
|
101469
|
-
|
|
101470
|
-
|
|
101471
|
-
|
|
101472
|
-
|
|
101473
|
-
|
|
101474
|
-
|
|
101475
|
-
|
|
101476
|
-
|
|
101477
|
-
|
|
101478
|
-
|
|
101479
|
-
|
|
101480
|
-
|
|
101481
|
-
|
|
101482
|
-
|
|
101483
|
-
|
|
101484
|
-
|
|
101485
|
-
|
|
101486
|
-
|
|
101487
|
-
|
|
101488
|
-
|
|
101489
|
-
|
|
101490
|
-
|
|
101491
|
-
|
|
101574
|
+
join61("extensions", "omo.js"),
|
|
101575
|
+
join61("extensions", "reflection-persona.md"),
|
|
101576
|
+
join61("skills", "ast-grep", "SKILL.md"),
|
|
101577
|
+
join61("skills", "coding-agent-sessions", "SKILL.md"),
|
|
101578
|
+
join61("skills", "debugging", "SKILL.md"),
|
|
101579
|
+
join61("skills", "frontend", "SKILL.md"),
|
|
101580
|
+
join61("skills", "git-master", "SKILL.md"),
|
|
101581
|
+
join61("skills", "init-deep", "SKILL.md"),
|
|
101582
|
+
join61("skills", "lsp-setup", "SKILL.md"),
|
|
101583
|
+
join61("skills", "programming", "SKILL.md"),
|
|
101584
|
+
join61("skills", "refactor", "SKILL.md"),
|
|
101585
|
+
join61("skills", "remove-ai-slops", "SKILL.md"),
|
|
101586
|
+
join61("skills", "review-work", "SKILL.md"),
|
|
101587
|
+
join61("skills", "start-work", "SKILL.md"),
|
|
101588
|
+
join61("skills", "ultimate-browsing", "SKILL.md"),
|
|
101589
|
+
join61("skills", "ultrawork", "SKILL.md"),
|
|
101590
|
+
join61("skills", "ulw-loop", "SKILL.md"),
|
|
101591
|
+
join61("skills", "ulw-plan", "SKILL.md"),
|
|
101592
|
+
join61("skills", "ulw-research", "SKILL.md"),
|
|
101593
|
+
join61("skills", "visual-qa", "SKILL.md"),
|
|
101594
|
+
join61("runtime", "ast-grep-mcp", "cli.js"),
|
|
101595
|
+
join61("runtime", "agent-toolkit", "cli.js"),
|
|
101596
|
+
join61("runtime", "agent-toolkit", "ulw-loop", "cli.js"),
|
|
101597
|
+
join61("runtime", "agent-toolkit", "omo-agent-toolkit"),
|
|
101598
|
+
join61("runtime", "agent-toolkit", "omo-agent-toolkit.cmd"),
|
|
101599
|
+
join61("runtime", "lsp-daemon", "dist", "cli.js"),
|
|
101600
|
+
join61("runtime", "lsp-daemon", "dist", "index.js"),
|
|
101601
|
+
join61("runtime", "lsp-daemon", "dist", "index.d.ts"),
|
|
101602
|
+
join61("runtime", "lsp-daemon", "dist", "daemon-client.js"),
|
|
101603
|
+
join61("runtime", "lsp-daemon", "dist", "daemon-client.d.ts"),
|
|
101604
|
+
join61("runtime", "lsp-daemon", "dist", "package.json"),
|
|
101605
|
+
join61("runtime", "lsp-daemon", "dist", ".omo-runtime-manifest.json"),
|
|
101606
|
+
join61("scripts", "install.mjs")
|
|
101492
101607
|
];
|
|
101493
101608
|
async function runSenpiInstaller(options = {}) {
|
|
101494
101609
|
const context = resolveInstallContext(options);
|
|
@@ -101500,6 +101615,10 @@ async function runSenpiInstaller(options = {}) {
|
|
|
101500
101615
|
packages.push(context.pluginPath);
|
|
101501
101616
|
settings.packages = packages;
|
|
101502
101617
|
const backupPath = await writeSettingsAtomically(context.settingsPath, settings);
|
|
101618
|
+
installLocalLauncher({
|
|
101619
|
+
pluginPath: context.pluginPath,
|
|
101620
|
+
senpiCliPath: join61(context.repoRoot, "packages", "coding-agent", "dist", "cli.js")
|
|
101621
|
+
});
|
|
101503
101622
|
return {
|
|
101504
101623
|
ok: true,
|
|
101505
101624
|
action: "install",
|
|
@@ -101513,14 +101632,14 @@ async function runSenpiInstaller(options = {}) {
|
|
|
101513
101632
|
function resolveInstallContext(options) {
|
|
101514
101633
|
const env3 = options.env ?? process.env;
|
|
101515
101634
|
const allowBuild = options.pluginPath === undefined;
|
|
101516
|
-
const repoRoot =
|
|
101517
|
-
const agentDir =
|
|
101518
|
-
const pluginPath =
|
|
101635
|
+
const repoRoot = resolve19(options.repoRoot ?? (allowBuild ? findRepoRoot2(dirname23(fileURLToPath(import.meta.url))) : dirname23(resolve19(options.pluginPath))));
|
|
101636
|
+
const agentDir = resolve19(options.agentDir ?? env3.SENPI_CODING_AGENT_DIR ?? join61(homedir10(), ".senpi", "agent"));
|
|
101637
|
+
const pluginPath = resolve19(options.pluginPath ?? join61(repoRoot, "packages", "omo-senpi", "plugin"));
|
|
101519
101638
|
return {
|
|
101520
101639
|
env: env3,
|
|
101521
101640
|
repoRoot,
|
|
101522
101641
|
agentDir,
|
|
101523
|
-
settingsPath:
|
|
101642
|
+
settingsPath: join61(agentDir, "settings.json"),
|
|
101524
101643
|
pluginPath,
|
|
101525
101644
|
platform: options.platform ?? process.platform,
|
|
101526
101645
|
allowBuild,
|
|
@@ -101529,13 +101648,13 @@ function resolveInstallContext(options) {
|
|
|
101529
101648
|
}
|
|
101530
101649
|
async function ensurePluginArtifacts(context) {
|
|
101531
101650
|
if (context.allowBuild) {
|
|
101532
|
-
await context.runCommand("node", [
|
|
101533
|
-
await context.runCommand("node", [
|
|
101534
|
-
await context.runCommand("node", [
|
|
101535
|
-
await context.runCommand("node", [
|
|
101536
|
-
await context.runCommand("node", [
|
|
101537
|
-
await context.runCommand("node", [
|
|
101538
|
-
await context.runCommand("node", [
|
|
101651
|
+
await context.runCommand("node", [join61(context.pluginPath, "scripts", "build-extension.mjs")], { cwd: context.repoRoot });
|
|
101652
|
+
await context.runCommand("node", [join61("packages", "omo-codex", "plugin", "scripts", "materialize-shared-upstreams.mjs")], { cwd: context.repoRoot });
|
|
101653
|
+
await context.runCommand("node", [join61(context.pluginPath, "scripts", "sync-skills.mjs")], { cwd: context.repoRoot });
|
|
101654
|
+
await context.runCommand("node", [join61(context.pluginPath, "scripts", "build-install.mjs")], { cwd: context.repoRoot });
|
|
101655
|
+
await context.runCommand("node", [join61(context.pluginPath, "scripts", "stage-lsp-daemon-runtime.mjs")], { cwd: context.repoRoot });
|
|
101656
|
+
await context.runCommand("node", [join61(context.pluginPath, "scripts", "stage-ast-grep-mcp-runtime.mjs")], { cwd: context.repoRoot });
|
|
101657
|
+
await context.runCommand("node", [join61(context.pluginPath, "scripts", "stage-agent-toolkit.mjs")], { cwd: context.repoRoot });
|
|
101539
101658
|
}
|
|
101540
101659
|
if (await hasMissingPluginArtifact(context.pluginPath)) {
|
|
101541
101660
|
throw new Error(`Packed omo-senpi plugin is missing required runtime artifacts at ${context.pluginPath}`);
|
|
@@ -101544,14 +101663,14 @@ async function ensurePluginArtifacts(context) {
|
|
|
101544
101663
|
}
|
|
101545
101664
|
async function hasMissingPluginArtifact(pluginPath) {
|
|
101546
101665
|
for (const artifact of REQUIRED_PLUGIN_ARTIFACTS) {
|
|
101547
|
-
if (!await fileExists2(
|
|
101666
|
+
if (!await fileExists2(join61(pluginPath, artifact)))
|
|
101548
101667
|
return true;
|
|
101549
101668
|
}
|
|
101550
101669
|
return false;
|
|
101551
101670
|
}
|
|
101552
101671
|
async function verifyAstGrepRuntimeIntegrity(pluginPath, platform) {
|
|
101553
|
-
const runtimeEntry =
|
|
101554
|
-
const manifestPath =
|
|
101672
|
+
const runtimeEntry = join61(pluginPath, "runtime", "ast-grep-mcp", "cli.js");
|
|
101673
|
+
const manifestPath = join61(dirname23(runtimeEntry), "manifest.json");
|
|
101555
101674
|
let runtimeStat;
|
|
101556
101675
|
try {
|
|
101557
101676
|
runtimeStat = await stat6(runtimeEntry);
|
|
@@ -101608,9 +101727,9 @@ async function defaultRunCommand3(command, args, options) {
|
|
|
101608
101727
|
function findRepoRoot2(importerDir) {
|
|
101609
101728
|
let current = importerDir;
|
|
101610
101729
|
for (let depth = 0;depth <= 7; depth += 1) {
|
|
101611
|
-
if (fileExistsSync(
|
|
101730
|
+
if (fileExistsSync(join61(current, "packages", "omo-senpi", "plugin", "package.json")))
|
|
101612
101731
|
return current;
|
|
101613
|
-
current =
|
|
101732
|
+
current = resolve19(current, "..");
|
|
101614
101733
|
}
|
|
101615
101734
|
throw new Error("Unable to locate packages/omo-senpi/plugin/package.json from installer module");
|
|
101616
101735
|
}
|
|
@@ -101625,7 +101744,7 @@ async function fileExists2(path6) {
|
|
|
101625
101744
|
}
|
|
101626
101745
|
}
|
|
101627
101746
|
function fileExistsSync(path6) {
|
|
101628
|
-
return
|
|
101747
|
+
return existsSync31(path6);
|
|
101629
101748
|
}
|
|
101630
101749
|
function isErrno2(error51, code) {
|
|
101631
101750
|
return error51 instanceof Error && "code" in error51 && error51.code === code;
|
|
@@ -101664,26 +101783,26 @@ async function starGitHubRepositories(platform = "both", runCommand = runGitHubS
|
|
|
101664
101783
|
init_provider_availability();
|
|
101665
101784
|
|
|
101666
101785
|
// packages/omo-opencode/src/cli/config-manager/add-tui-plugin-to-tui-config.ts
|
|
101667
|
-
import { existsSync as
|
|
101668
|
-
import { join as
|
|
101786
|
+
import { existsSync as existsSync33, mkdirSync as mkdirSync11, readFileSync as readFileSync16 } from "fs";
|
|
101787
|
+
import { join as join63 } from "path";
|
|
101669
101788
|
|
|
101670
101789
|
// packages/omo-opencode/src/cli/doctor/checks/tui-plugin-config.ts
|
|
101671
101790
|
init_shared();
|
|
101672
|
-
import { existsSync as
|
|
101673
|
-
import { join as
|
|
101791
|
+
import { existsSync as existsSync32, readFileSync as readFileSync15 } from "fs";
|
|
101792
|
+
import { join as join62 } from "path";
|
|
101674
101793
|
var TUI_SUBPATH = "tui";
|
|
101675
101794
|
var TUI_EXPORT_SUBPATH = `./${TUI_SUBPATH}`;
|
|
101676
101795
|
function fileEntryPackageJsonPath(entry) {
|
|
101677
101796
|
let path6 = entry.slice("file:".length);
|
|
101678
101797
|
if (path6.startsWith("//"))
|
|
101679
101798
|
path6 = path6.slice(2);
|
|
101680
|
-
return
|
|
101799
|
+
return join62(path6, "package.json");
|
|
101681
101800
|
}
|
|
101682
101801
|
function packageJsonExportsTui(pkgJsonPath) {
|
|
101683
|
-
if (!
|
|
101802
|
+
if (!existsSync32(pkgJsonPath))
|
|
101684
101803
|
return null;
|
|
101685
101804
|
try {
|
|
101686
|
-
const parsed = JSON.parse(
|
|
101805
|
+
const parsed = JSON.parse(readFileSync15(pkgJsonPath, "utf-8"));
|
|
101687
101806
|
if (parsed.exports === undefined)
|
|
101688
101807
|
return null;
|
|
101689
101808
|
if (typeof parsed.exports === "string")
|
|
@@ -101715,16 +101834,16 @@ function packageExportsTuiForServerEntry(entry) {
|
|
|
101715
101834
|
const packageName = packageNameFromServerEntry(entry);
|
|
101716
101835
|
if (packageName === null)
|
|
101717
101836
|
return null;
|
|
101718
|
-
return packageJsonExportsTui(
|
|
101837
|
+
return packageJsonExportsTui(join62(getOpenCodeConfigDir({ binary: "opencode" }), "node_modules", packageName, "package.json"));
|
|
101719
101838
|
}
|
|
101720
101839
|
function isOurFilePluginEntry(entry) {
|
|
101721
101840
|
if (typeof entry !== "string" || !entry.startsWith("file:"))
|
|
101722
101841
|
return false;
|
|
101723
101842
|
try {
|
|
101724
101843
|
const pkgJsonPath = fileEntryPackageJsonPath(entry);
|
|
101725
|
-
if (!
|
|
101844
|
+
if (!existsSync32(pkgJsonPath))
|
|
101726
101845
|
return false;
|
|
101727
|
-
const parsed = JSON.parse(
|
|
101846
|
+
const parsed = JSON.parse(readFileSync15(pkgJsonPath, "utf-8"));
|
|
101728
101847
|
return typeof parsed.name === "string" && ACCEPTED_PACKAGE_NAMES.includes(parsed.name);
|
|
101729
101848
|
} catch (error51) {
|
|
101730
101849
|
log2("[tui-plugin-config] Failed to inspect file plugin package", {
|
|
@@ -101757,12 +101876,12 @@ function isCanonicalNamedTuiPluginEntry(entry) {
|
|
|
101757
101876
|
}
|
|
101758
101877
|
function detectServerPluginRegistration() {
|
|
101759
101878
|
const paths2 = getOpenCodeConfigPaths({ binary: "opencode", version: null });
|
|
101760
|
-
const configPath =
|
|
101879
|
+
const configPath = existsSync32(paths2.configJsonc) ? paths2.configJsonc : existsSync32(paths2.configJson) ? paths2.configJson : null;
|
|
101761
101880
|
if (!configPath) {
|
|
101762
101881
|
return { registered: false, configPath: null, entry: null, packageExportsTui: null };
|
|
101763
101882
|
}
|
|
101764
101883
|
try {
|
|
101765
|
-
const parsed = parseJsonc(
|
|
101884
|
+
const parsed = parseJsonc(readFileSync15(configPath, "utf-8"));
|
|
101766
101885
|
const plugins = parsed.plugin ?? [];
|
|
101767
101886
|
const serverEntry = plugins.find(isServerPluginEntry);
|
|
101768
101887
|
return {
|
|
@@ -101780,8 +101899,8 @@ function detectServerPluginRegistration() {
|
|
|
101780
101899
|
}
|
|
101781
101900
|
}
|
|
101782
101901
|
function detectTuiPluginRegistration() {
|
|
101783
|
-
const tuiJsonPath =
|
|
101784
|
-
if (!
|
|
101902
|
+
const tuiJsonPath = join62(getOpenCodeConfigDir({ binary: "opencode" }), "tui.json");
|
|
101903
|
+
if (!existsSync32(tuiJsonPath)) {
|
|
101785
101904
|
return {
|
|
101786
101905
|
registered: false,
|
|
101787
101906
|
configPath: tuiJsonPath,
|
|
@@ -101792,7 +101911,7 @@ function detectTuiPluginRegistration() {
|
|
|
101792
101911
|
};
|
|
101793
101912
|
}
|
|
101794
101913
|
try {
|
|
101795
|
-
const parsed = parseJsonc(
|
|
101914
|
+
const parsed = parseJsonc(readFileSync15(tuiJsonPath, "utf-8"));
|
|
101796
101915
|
const plugins = parsed.plugin ?? [];
|
|
101797
101916
|
return {
|
|
101798
101917
|
registered: plugins.some(isTuiPluginEntry),
|
|
@@ -101925,7 +102044,7 @@ init_shared();
|
|
|
101925
102044
|
init_write_file_atomically();
|
|
101926
102045
|
function readConfig(path6) {
|
|
101927
102046
|
try {
|
|
101928
|
-
const parsed = parseJsonc(
|
|
102047
|
+
const parsed = parseJsonc(readFileSync16(path6, "utf-8"));
|
|
101929
102048
|
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
101930
102049
|
return parsed;
|
|
101931
102050
|
}
|
|
@@ -101936,11 +102055,11 @@ function readConfig(path6) {
|
|
|
101936
102055
|
return null;
|
|
101937
102056
|
}
|
|
101938
102057
|
function readServerConfig(configDir) {
|
|
101939
|
-
const jsoncPath =
|
|
101940
|
-
if (
|
|
102058
|
+
const jsoncPath = join63(configDir, "opencode.jsonc");
|
|
102059
|
+
if (existsSync33(jsoncPath))
|
|
101941
102060
|
return readConfig(jsoncPath);
|
|
101942
|
-
const jsonPath =
|
|
101943
|
-
if (
|
|
102061
|
+
const jsonPath = join63(configDir, "opencode.json");
|
|
102062
|
+
if (existsSync33(jsonPath))
|
|
101944
102063
|
return readConfig(jsonPath);
|
|
101945
102064
|
return null;
|
|
101946
102065
|
}
|
|
@@ -101960,7 +102079,7 @@ function desiredTuiEntry(serverEntry) {
|
|
|
101960
102079
|
return null;
|
|
101961
102080
|
}
|
|
101962
102081
|
function readTuiConfig(tuiJsonPath) {
|
|
101963
|
-
if (!
|
|
102082
|
+
if (!existsSync33(tuiJsonPath)) {
|
|
101964
102083
|
return { config: {}, malformed: false };
|
|
101965
102084
|
}
|
|
101966
102085
|
const config3 = readConfig(tuiJsonPath);
|
|
@@ -101981,7 +102100,7 @@ function ensureTuiPluginEntry(opts = {}) {
|
|
|
101981
102100
|
if (!desiredEntry) {
|
|
101982
102101
|
return { changed: false, reason: "no-server-entry" };
|
|
101983
102102
|
}
|
|
101984
|
-
const tuiJsonPath =
|
|
102103
|
+
const tuiJsonPath = join63(configDir, "tui.json");
|
|
101985
102104
|
const { config: config3, malformed } = readTuiConfig(tuiJsonPath);
|
|
101986
102105
|
if (malformed) {
|
|
101987
102106
|
return { changed: false, reason: "malformed" };
|
|
@@ -101990,22 +102109,22 @@ function ensureTuiPluginEntry(opts = {}) {
|
|
|
101990
102109
|
if (plugins.includes(desiredEntry)) {
|
|
101991
102110
|
return { changed: false, reason: "already-present" };
|
|
101992
102111
|
}
|
|
101993
|
-
|
|
102112
|
+
mkdirSync11(configDir, { recursive: true });
|
|
101994
102113
|
writeFileAtomically2(tuiJsonPath, formatConfig({ ...config3, plugin: [...plugins, desiredEntry] }));
|
|
101995
102114
|
return { changed: true, reason: "added" };
|
|
101996
102115
|
}
|
|
101997
102116
|
|
|
101998
102117
|
// packages/omo-opencode/src/cli/install-ast-grep-sg.ts
|
|
101999
|
-
import { homedir as
|
|
102000
|
-
import { join as
|
|
102118
|
+
import { homedir as homedir11 } from "os";
|
|
102119
|
+
import { join as join64 } from "path";
|
|
102001
102120
|
|
|
102002
102121
|
// packages/shared-skills/index.mjs
|
|
102003
|
-
import { existsSync as
|
|
102122
|
+
import { existsSync as existsSync34 } from "fs";
|
|
102004
102123
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
102005
102124
|
var SKILLS_PROBE_SPECIFIERS = ["./skills/", "../skills/", "../../skills/"];
|
|
102006
102125
|
function sharedSkillsRootPath() {
|
|
102007
102126
|
const candidates = SKILLS_PROBE_SPECIFIERS.map((specifier) => fileURLToPath2(new URL(specifier, import.meta.url)));
|
|
102008
|
-
return candidates.find((candidate2) =>
|
|
102127
|
+
return candidates.find((candidate2) => existsSync34(candidate2)) ?? candidates[0];
|
|
102009
102128
|
}
|
|
102010
102129
|
|
|
102011
102130
|
// packages/omo-opencode/src/cli/install-ast-grep-sg.ts
|
|
@@ -102019,9 +102138,9 @@ function describeResult2(result) {
|
|
|
102019
102138
|
}
|
|
102020
102139
|
async function installAstGrepForOpenCode(options = {}) {
|
|
102021
102140
|
const platform = options.platform ?? process.platform;
|
|
102022
|
-
const baseDir =
|
|
102141
|
+
const baseDir = join64(options.homeDir ?? homedir11(), ".omo");
|
|
102023
102142
|
const targetDir = astGrepRuntimeDir(baseDir, platform, options.arch ?? process.arch);
|
|
102024
|
-
const skillDir =
|
|
102143
|
+
const skillDir = join64(options.sharedSkillsRoot ?? sharedSkillsRootPath(), "ast-grep");
|
|
102025
102144
|
const installer = options.installer ?? runAstGrepSkillInstall;
|
|
102026
102145
|
try {
|
|
102027
102146
|
const result = await installer({ platform, skillDir, targetDir });
|
|
@@ -105824,7 +105943,7 @@ var import_picocolors11 = __toESM(require_picocolors(), 1);
|
|
|
105824
105943
|
// packages/omo-opencode/src/cli/run/opencode-binary-resolver.ts
|
|
105825
105944
|
init_bun_which_shim();
|
|
105826
105945
|
init_spawn_with_windows_hide();
|
|
105827
|
-
import { delimiter as delimiter2, dirname as
|
|
105946
|
+
import { delimiter as delimiter2, dirname as dirname24, posix as posix9, win32 as win325 } from "path";
|
|
105828
105947
|
var OPENCODE_COMMANDS = ["opencode", "opencode-desktop"];
|
|
105829
105948
|
var WINDOWS_SUFFIXES = ["", ".exe", ".cmd", ".bat", ".ps1"];
|
|
105830
105949
|
function getCommandCandidates(platform) {
|
|
@@ -105882,7 +106001,7 @@ async function findWorkingOpencodeBinary(pathEnv = process.env.PATH, probe2 = ca
|
|
|
105882
106001
|
return null;
|
|
105883
106002
|
}
|
|
105884
106003
|
function buildPathWithBinaryFirst(pathEnv, binaryPath) {
|
|
105885
|
-
const preferredDir =
|
|
106004
|
+
const preferredDir = dirname24(binaryPath);
|
|
105886
106005
|
const existing = (pathEnv ?? "").split(delimiter2).filter((entry) => entry.length > 0 && entry !== preferredDir);
|
|
105887
106006
|
return [preferredDir, ...existing].join(delimiter2);
|
|
105888
106007
|
}
|
|
@@ -106051,7 +106170,7 @@ async function resolveSession(options) {
|
|
|
106051
106170
|
if (attempt < SESSION_CREATE_MAX_RETRIES) {
|
|
106052
106171
|
const delay2 = retryDelayMs * attempt;
|
|
106053
106172
|
console.log(import_picocolors12.default.dim(` Retrying in ${delay2}ms...`));
|
|
106054
|
-
await new Promise((
|
|
106173
|
+
await new Promise((resolve20) => setTimeout(resolve20, delay2));
|
|
106055
106174
|
}
|
|
106056
106175
|
continue;
|
|
106057
106176
|
}
|
|
@@ -106062,7 +106181,7 @@ async function resolveSession(options) {
|
|
|
106062
106181
|
if (attempt < SESSION_CREATE_MAX_RETRIES) {
|
|
106063
106182
|
const delay2 = retryDelayMs * attempt;
|
|
106064
106183
|
console.log(import_picocolors12.default.dim(` Retrying in ${delay2}ms...`));
|
|
106065
|
-
await new Promise((
|
|
106184
|
+
await new Promise((resolve20) => setTimeout(resolve20, delay2));
|
|
106066
106185
|
}
|
|
106067
106186
|
}
|
|
106068
106187
|
throw new Error("Failed to create session after all retries");
|
|
@@ -106460,26 +106579,26 @@ function isClosingFence(line, fence) {
|
|
|
106460
106579
|
return run?.charAt(0) === fence.marker && run.length >= fence.length;
|
|
106461
106580
|
}
|
|
106462
106581
|
// packages/boulder-state/src/top-level-task.ts
|
|
106463
|
-
import { existsSync as
|
|
106582
|
+
import { existsSync as existsSync35, readFileSync as readFileSync17 } from "fs";
|
|
106464
106583
|
function readCurrentTopLevelTask(planPath) {
|
|
106465
|
-
if (!
|
|
106584
|
+
if (!existsSync35(planPath)) {
|
|
106466
106585
|
return null;
|
|
106467
106586
|
}
|
|
106468
106587
|
try {
|
|
106469
|
-
const content =
|
|
106588
|
+
const content = readFileSync17(planPath, "utf-8");
|
|
106470
106589
|
return parseCurrentTopLevelTask(content);
|
|
106471
106590
|
} catch {
|
|
106472
106591
|
return null;
|
|
106473
106592
|
}
|
|
106474
106593
|
}
|
|
106475
106594
|
// packages/boulder-state/src/storage/path.ts
|
|
106476
|
-
import { existsSync as
|
|
106477
|
-
import { isAbsolute as isAbsolute11, join as
|
|
106595
|
+
import { existsSync as existsSync36 } from "fs";
|
|
106596
|
+
import { isAbsolute as isAbsolute11, join as join65, relative as relative8, resolve as resolve20 } from "path";
|
|
106478
106597
|
function getBoulderFilePath(directory) {
|
|
106479
|
-
return
|
|
106598
|
+
return join65(directory, BOULDER_DIR, BOULDER_FILE);
|
|
106480
106599
|
}
|
|
106481
106600
|
function resolveTrackedPath(baseDirectory, trackedPath) {
|
|
106482
|
-
return isAbsolute11(trackedPath) ?
|
|
106601
|
+
return isAbsolute11(trackedPath) ? resolve20(trackedPath) : resolve20(baseDirectory, trackedPath);
|
|
106483
106602
|
}
|
|
106484
106603
|
function resolveBoulderPlanPath(directory, state) {
|
|
106485
106604
|
const absolutePlanPath = resolveTrackedPath(directory, state.active_plan);
|
|
@@ -106487,26 +106606,26 @@ function resolveBoulderPlanPath(directory, state) {
|
|
|
106487
106606
|
if (!worktreePath) {
|
|
106488
106607
|
return absolutePlanPath;
|
|
106489
106608
|
}
|
|
106490
|
-
const absoluteDirectory =
|
|
106609
|
+
const absoluteDirectory = resolve20(directory);
|
|
106491
106610
|
const relativePlanPath = relative8(absoluteDirectory, absolutePlanPath);
|
|
106492
106611
|
if (relativePlanPath.length === 0 || relativePlanPath.startsWith("..") || isAbsolute11(relativePlanPath)) {
|
|
106493
106612
|
return absolutePlanPath;
|
|
106494
106613
|
}
|
|
106495
106614
|
const absoluteWorktreePath = resolveTrackedPath(directory, worktreePath);
|
|
106496
|
-
const worktreePlanPath =
|
|
106497
|
-
return
|
|
106615
|
+
const worktreePlanPath = resolve20(absoluteWorktreePath, relativePlanPath);
|
|
106616
|
+
return existsSync36(worktreePlanPath) ? worktreePlanPath : absolutePlanPath;
|
|
106498
106617
|
}
|
|
106499
106618
|
function resolveBoulderPlanPathForWork(directory, work) {
|
|
106500
106619
|
return resolveBoulderPlanPath(directory, work);
|
|
106501
106620
|
}
|
|
106502
106621
|
// packages/boulder-state/src/storage/plan-progress.ts
|
|
106503
|
-
import { existsSync as
|
|
106622
|
+
import { existsSync as existsSync37, readFileSync as readFileSync18, readdirSync as readdirSync7, statSync as statSync4 } from "fs";
|
|
106504
106623
|
function getPlanProgress(planPath) {
|
|
106505
|
-
if (!
|
|
106624
|
+
if (!existsSync37(planPath)) {
|
|
106506
106625
|
return { total: 0, completed: 0, isComplete: false };
|
|
106507
106626
|
}
|
|
106508
106627
|
try {
|
|
106509
|
-
const content =
|
|
106628
|
+
const content = readFileSync18(planPath, "utf-8");
|
|
106510
106629
|
const checklist = parsePlanChecklist(content);
|
|
106511
106630
|
return {
|
|
106512
106631
|
total: checklist.total,
|
|
@@ -106585,14 +106704,14 @@ function selectMirrorWork(state) {
|
|
|
106585
106704
|
return sorted[0] ?? null;
|
|
106586
106705
|
}
|
|
106587
106706
|
// packages/boulder-state/src/storage/read-state.ts
|
|
106588
|
-
import { existsSync as
|
|
106707
|
+
import { existsSync as existsSync38, readFileSync as readFileSync19 } from "fs";
|
|
106589
106708
|
function readBoulderState(directory) {
|
|
106590
106709
|
const filePath = getBoulderFilePath(directory);
|
|
106591
|
-
if (!
|
|
106710
|
+
if (!existsSync38(filePath)) {
|
|
106592
106711
|
return null;
|
|
106593
106712
|
}
|
|
106594
106713
|
try {
|
|
106595
|
-
const content =
|
|
106714
|
+
const content = readFileSync19(filePath, "utf-8");
|
|
106596
106715
|
const parsed = JSON.parse(content);
|
|
106597
106716
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed) || Object.keys(parsed).length === 0) {
|
|
106598
106717
|
return null;
|
|
@@ -106658,17 +106777,17 @@ init_state();
|
|
|
106658
106777
|
// packages/omo-opencode/src/features/run-continuation-state/constants.ts
|
|
106659
106778
|
var CONTINUATION_MARKER_DIR = ".omo/run-continuation";
|
|
106660
106779
|
// packages/omo-opencode/src/features/run-continuation-state/storage.ts
|
|
106661
|
-
import { existsSync as
|
|
106662
|
-
import { join as
|
|
106780
|
+
import { existsSync as existsSync39, mkdirSync as mkdirSync12, readFileSync as readFileSync20, rmSync as rmSync2, writeFileSync as writeFileSync7 } from "fs";
|
|
106781
|
+
import { join as join66 } from "path";
|
|
106663
106782
|
function getMarkerPath(directory, sessionID) {
|
|
106664
|
-
return
|
|
106783
|
+
return join66(directory, CONTINUATION_MARKER_DIR, `${sessionID}.json`);
|
|
106665
106784
|
}
|
|
106666
106785
|
function readContinuationMarker(directory, sessionID) {
|
|
106667
106786
|
const markerPath = getMarkerPath(directory, sessionID);
|
|
106668
|
-
if (!
|
|
106787
|
+
if (!existsSync39(markerPath))
|
|
106669
106788
|
return null;
|
|
106670
106789
|
try {
|
|
106671
|
-
const raw =
|
|
106790
|
+
const raw = readFileSync20(markerPath, "utf-8");
|
|
106672
106791
|
const parsed = JSON.parse(raw);
|
|
106673
106792
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed))
|
|
106674
106793
|
return null;
|
|
@@ -106733,8 +106852,8 @@ async function isSessionInBoulderLineage(input) {
|
|
|
106733
106852
|
// packages/omo-opencode/src/hooks/atlas/session-last-agent.ts
|
|
106734
106853
|
init_shared();
|
|
106735
106854
|
init_compaction_marker();
|
|
106736
|
-
import { readFileSync as
|
|
106737
|
-
import { join as
|
|
106855
|
+
import { readFileSync as readFileSync21, readdirSync as readdirSync8 } from "fs";
|
|
106856
|
+
import { join as join67 } from "path";
|
|
106738
106857
|
var defaultSessionLastAgentDeps = {
|
|
106739
106858
|
getMessageDir,
|
|
106740
106859
|
isSqliteBackend,
|
|
@@ -106794,7 +106913,7 @@ async function getLastAgentFromSession(sessionID, client3, deps = {}) {
|
|
|
106794
106913
|
try {
|
|
106795
106914
|
const messages = readdirSync8(messageDir).filter((fileName) => fileName.endsWith(".json")).map((fileName) => {
|
|
106796
106915
|
try {
|
|
106797
|
-
const content =
|
|
106916
|
+
const content = readFileSync21(join67(messageDir, fileName), "utf-8");
|
|
106798
106917
|
const parsed = JSON.parse(content);
|
|
106799
106918
|
return {
|
|
106800
106919
|
fileName,
|
|
@@ -106837,8 +106956,8 @@ init_agent_display_names();
|
|
|
106837
106956
|
|
|
106838
106957
|
// packages/omo-opencode/src/hooks/ralph-loop/storage.ts
|
|
106839
106958
|
init_frontmatter2();
|
|
106840
|
-
import { existsSync as
|
|
106841
|
-
import { dirname as
|
|
106959
|
+
import { existsSync as existsSync40, readFileSync as readFileSync22, writeFileSync as writeFileSync8, unlinkSync as unlinkSync6, mkdirSync as mkdirSync13 } from "fs";
|
|
106960
|
+
import { dirname as dirname25, join as join68 } from "path";
|
|
106842
106961
|
|
|
106843
106962
|
// packages/omo-opencode/src/hooks/ralph-loop/constants.ts
|
|
106844
106963
|
var DEFAULT_STATE_FILE = ".omo/ralph-loop.local.md";
|
|
@@ -106847,15 +106966,15 @@ var DEFAULT_COMPLETION_PROMISE = "DONE";
|
|
|
106847
106966
|
|
|
106848
106967
|
// packages/omo-opencode/src/hooks/ralph-loop/storage.ts
|
|
106849
106968
|
function getStateFilePath(directory, customPath) {
|
|
106850
|
-
return customPath ?
|
|
106969
|
+
return customPath ? join68(directory, customPath) : join68(directory, DEFAULT_STATE_FILE);
|
|
106851
106970
|
}
|
|
106852
106971
|
function readState(directory, customPath) {
|
|
106853
106972
|
const filePath = getStateFilePath(directory, customPath);
|
|
106854
|
-
if (!
|
|
106973
|
+
if (!existsSync40(filePath)) {
|
|
106855
106974
|
return null;
|
|
106856
106975
|
}
|
|
106857
106976
|
try {
|
|
106858
|
-
const content =
|
|
106977
|
+
const content = readFileSync22(filePath, "utf-8");
|
|
106859
106978
|
const { data, body } = parseFrontmatter(content);
|
|
106860
106979
|
const active = data.active;
|
|
106861
106980
|
const iteration = data.iteration;
|
|
@@ -107081,7 +107200,7 @@ async function pollForCompletion(ctx, eventState, abortController, options = {})
|
|
|
107081
107200
|
const secondaryMeaningfulWorkTimeoutMs = options.secondaryMeaningfulWorkTimeoutMs ?? DEFAULT_SECONDARY_MEANINGFUL_WORK_TIMEOUT_MS;
|
|
107082
107201
|
const requireMeaningfulWork = options.requireMeaningfulWork ?? false;
|
|
107083
107202
|
const now = options.now ?? Date.now;
|
|
107084
|
-
const sleep = options.sleep ?? ((ms) => new Promise((
|
|
107203
|
+
const sleep = options.sleep ?? ((ms) => new Promise((resolve21) => setTimeout(resolve21, ms)));
|
|
107085
107204
|
let consecutiveCompleteChecks = 0;
|
|
107086
107205
|
let errorCycleCount = 0;
|
|
107087
107206
|
let firstWorkTimestamp = null;
|
|
@@ -107246,7 +107365,7 @@ function createAbortError() {
|
|
|
107246
107365
|
return error51;
|
|
107247
107366
|
}
|
|
107248
107367
|
function sleep(delayMs) {
|
|
107249
|
-
return new Promise((
|
|
107368
|
+
return new Promise((resolve21) => setTimeout(resolve21, delayMs));
|
|
107250
107369
|
}
|
|
107251
107370
|
function hasPromptStartEvidence(eventState) {
|
|
107252
107371
|
return eventState.mainSessionStarted || eventState.hasReceivedMeaningfulWork || eventState.messageCount > 0 || eventState.currentTool !== null;
|
|
@@ -107621,7 +107740,7 @@ var EVENT_PROCESSOR_SHUTDOWN_TIMEOUT_MS = 2000;
|
|
|
107621
107740
|
async function waitForEventProcessorShutdown(eventProcessor, timeoutMs = EVENT_PROCESSOR_SHUTDOWN_TIMEOUT_MS) {
|
|
107622
107741
|
const completed = await Promise.race([
|
|
107623
107742
|
eventProcessor.then(() => true),
|
|
107624
|
-
new Promise((
|
|
107743
|
+
new Promise((resolve21) => setTimeout(() => resolve21(false), timeoutMs))
|
|
107625
107744
|
]);
|
|
107626
107745
|
}
|
|
107627
107746
|
async function run(options) {
|
|
@@ -107684,10 +107803,10 @@ Interrupted. Shutting down...`));
|
|
|
107684
107803
|
abortController,
|
|
107685
107804
|
verbose: options.verbose ?? false
|
|
107686
107805
|
};
|
|
107687
|
-
const
|
|
107806
|
+
const events2 = await client3.event.subscribe({ query: { directory } });
|
|
107688
107807
|
const eventState = createEventState();
|
|
107689
107808
|
eventState.agentColorsByName = await loadAgentProfileColors(client3);
|
|
107690
|
-
const eventProcessor = processEvents(ctx,
|
|
107809
|
+
const eventProcessor = processEvents(ctx, events2.stream, eventState).catch(() => {});
|
|
107691
107810
|
const promptResult = await dispatchInternalPrompt({
|
|
107692
107811
|
mode: "async",
|
|
107693
107812
|
client: client3,
|
|
@@ -107947,14 +108066,14 @@ async function getLocalVersion(options = {}) {
|
|
|
107947
108066
|
}
|
|
107948
108067
|
}
|
|
107949
108068
|
// packages/omo-opencode/src/cli/doctor/checks/system.ts
|
|
107950
|
-
import { existsSync as
|
|
108069
|
+
import { existsSync as existsSync51, readFileSync as readFileSync32 } from "fs";
|
|
107951
108070
|
|
|
107952
108071
|
// packages/omo-opencode/src/cli/doctor/checks/system-binary.ts
|
|
107953
108072
|
init_extract_semver();
|
|
107954
108073
|
init_bun_which_shim();
|
|
107955
|
-
import { existsSync as
|
|
107956
|
-
import { homedir as
|
|
107957
|
-
import { join as
|
|
108074
|
+
import { existsSync as existsSync48, accessSync as accessSync4, constants as constants11 } from "fs";
|
|
108075
|
+
import { homedir as homedir14 } from "os";
|
|
108076
|
+
import { join as join75 } from "path";
|
|
107958
108077
|
|
|
107959
108078
|
// packages/omo-opencode/src/cli/doctor/framework/spawn-with-timeout.ts
|
|
107960
108079
|
init_spawn_with_windows_hide();
|
|
@@ -107993,8 +108112,8 @@ async function spawnWithTimeout(command, options, timeoutMs = DEFAULT_SPAWN_TIME
|
|
|
107993
108112
|
const stdoutPromise = readSpawnStream(proc.stdout);
|
|
107994
108113
|
const stderrPromise = readSpawnStream(proc.stderr);
|
|
107995
108114
|
let timer;
|
|
107996
|
-
const timeoutPromise = new Promise((
|
|
107997
|
-
timer = setTimeout(() =>
|
|
108115
|
+
const timeoutPromise = new Promise((resolve21) => {
|
|
108116
|
+
timer = setTimeout(() => resolve21("timeout"), timeoutMs);
|
|
107998
108117
|
});
|
|
107999
108118
|
const processPromise = (async () => {
|
|
108000
108119
|
await proc.exited;
|
|
@@ -108041,22 +108160,22 @@ function isExecutable2(path12) {
|
|
|
108041
108160
|
}
|
|
108042
108161
|
}
|
|
108043
108162
|
function getDesktopAppPaths(platform) {
|
|
108044
|
-
const home =
|
|
108163
|
+
const home = homedir14();
|
|
108045
108164
|
switch (platform) {
|
|
108046
108165
|
case "darwin":
|
|
108047
108166
|
return [
|
|
108048
108167
|
"/Applications/OpenCode.app/Contents/MacOS/OpenCode",
|
|
108049
|
-
|
|
108168
|
+
join75(home, "Applications", "OpenCode.app", "Contents", "MacOS", "OpenCode")
|
|
108050
108169
|
];
|
|
108051
108170
|
case "win32": {
|
|
108052
108171
|
const programFiles = process.env.ProgramFiles;
|
|
108053
108172
|
const localAppData = process.env.LOCALAPPDATA;
|
|
108054
108173
|
const paths2 = [];
|
|
108055
108174
|
if (programFiles) {
|
|
108056
|
-
paths2.push(
|
|
108175
|
+
paths2.push(join75(programFiles, "OpenCode", "OpenCode.exe"));
|
|
108057
108176
|
}
|
|
108058
108177
|
if (localAppData) {
|
|
108059
|
-
paths2.push(
|
|
108178
|
+
paths2.push(join75(localAppData, "OpenCode", "OpenCode.exe"));
|
|
108060
108179
|
}
|
|
108061
108180
|
return paths2;
|
|
108062
108181
|
}
|
|
@@ -108064,8 +108183,8 @@ function getDesktopAppPaths(platform) {
|
|
|
108064
108183
|
return [
|
|
108065
108184
|
"/usr/bin/opencode",
|
|
108066
108185
|
"/usr/lib/opencode/opencode",
|
|
108067
|
-
|
|
108068
|
-
|
|
108186
|
+
join75(home, "Applications", "opencode-desktop-linux-x86_64.AppImage"),
|
|
108187
|
+
join75(home, "Applications", "opencode-desktop-linux-aarch64.AppImage")
|
|
108069
108188
|
];
|
|
108070
108189
|
default:
|
|
108071
108190
|
return [];
|
|
@@ -108077,7 +108196,7 @@ function buildVersionCommand(binaryPath, platform) {
|
|
|
108077
108196
|
}
|
|
108078
108197
|
return [binaryPath, "--version"];
|
|
108079
108198
|
}
|
|
108080
|
-
function findDesktopBinary(platform = process.platform, checkExists =
|
|
108199
|
+
function findDesktopBinary(platform = process.platform, checkExists = existsSync48) {
|
|
108081
108200
|
for (const desktopPath of getDesktopAppPaths(platform)) {
|
|
108082
108201
|
if (checkExists(desktopPath)) {
|
|
108083
108202
|
return { binary: "opencode", path: desktopPath };
|
|
@@ -108085,7 +108204,7 @@ function findDesktopBinary(platform = process.platform, checkExists = existsSync
|
|
|
108085
108204
|
}
|
|
108086
108205
|
return null;
|
|
108087
108206
|
}
|
|
108088
|
-
async function findOpenCodeBinary(platform = process.platform, checkExists =
|
|
108207
|
+
async function findOpenCodeBinary(platform = process.platform, checkExists = existsSync48) {
|
|
108089
108208
|
for (const binary of OPENCODE_BINARIES2) {
|
|
108090
108209
|
const path12 = bunWhich(binary);
|
|
108091
108210
|
if (path12 && checkExists(path12)) {
|
|
@@ -108097,7 +108216,7 @@ async function findOpenCodeBinary(platform = process.platform, checkExists = exi
|
|
|
108097
108216
|
const candidates = getCommandCandidates2(platform);
|
|
108098
108217
|
for (const entry of pathEnv.split(delimiter3).filter(Boolean)) {
|
|
108099
108218
|
for (const command of candidates) {
|
|
108100
|
-
const fullPath =
|
|
108219
|
+
const fullPath = join75(entry, command);
|
|
108101
108220
|
if (checkExists(fullPath) && isExecutable2(fullPath)) {
|
|
108102
108221
|
return { binary: command, path: fullPath };
|
|
108103
108222
|
}
|
|
@@ -108143,12 +108262,12 @@ function compareVersions3(current, minimum) {
|
|
|
108143
108262
|
|
|
108144
108263
|
// packages/omo-opencode/src/cli/doctor/checks/system-plugin.ts
|
|
108145
108264
|
init_shared();
|
|
108146
|
-
import { existsSync as
|
|
108265
|
+
import { existsSync as existsSync49, readFileSync as readFileSync30 } from "fs";
|
|
108147
108266
|
function detectConfigPath() {
|
|
108148
108267
|
const paths2 = getOpenCodeConfigPaths({ binary: "opencode", version: null });
|
|
108149
|
-
if (
|
|
108268
|
+
if (existsSync49(paths2.configJsonc))
|
|
108150
108269
|
return paths2.configJsonc;
|
|
108151
|
-
if (
|
|
108270
|
+
if (existsSync49(paths2.configJson))
|
|
108152
108271
|
return paths2.configJson;
|
|
108153
108272
|
return null;
|
|
108154
108273
|
}
|
|
@@ -108194,7 +108313,7 @@ function getPluginInfo() {
|
|
|
108194
108313
|
};
|
|
108195
108314
|
}
|
|
108196
108315
|
try {
|
|
108197
|
-
const content =
|
|
108316
|
+
const content = readFileSync30(configPath, "utf-8");
|
|
108198
108317
|
const parsedConfig = parseJsonc(content);
|
|
108199
108318
|
const pluginEntry = findPluginEntry2(parsedConfig.plugin ?? []);
|
|
108200
108319
|
if (!pluginEntry) {
|
|
@@ -108236,39 +108355,39 @@ init_file_utils2();
|
|
|
108236
108355
|
init_checker();
|
|
108237
108356
|
init_auto_update_checker();
|
|
108238
108357
|
init_package_json_locator();
|
|
108239
|
-
import { existsSync as
|
|
108358
|
+
import { existsSync as existsSync50, readFileSync as readFileSync31, readdirSync as readdirSync10 } from "fs";
|
|
108240
108359
|
import { createRequire as createRequire2 } from "module";
|
|
108241
|
-
import { homedir as
|
|
108242
|
-
import { join as
|
|
108360
|
+
import { homedir as homedir15 } from "os";
|
|
108361
|
+
import { join as join76 } from "path";
|
|
108243
108362
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
108244
108363
|
init_shared();
|
|
108245
108364
|
function getPlatformDefaultCacheDir(platform = process.platform) {
|
|
108246
108365
|
if (platform === "darwin")
|
|
108247
|
-
return
|
|
108366
|
+
return join76(homedir15(), "Library", "Caches");
|
|
108248
108367
|
if (platform === "win32")
|
|
108249
|
-
return process.env.LOCALAPPDATA ??
|
|
108250
|
-
return
|
|
108368
|
+
return process.env.LOCALAPPDATA ?? join76(homedir15(), "AppData", "Local");
|
|
108369
|
+
return join76(homedir15(), ".cache");
|
|
108251
108370
|
}
|
|
108252
108371
|
function resolveOpenCodeCacheDir() {
|
|
108253
108372
|
const xdgCacheHome = process.env.XDG_CACHE_HOME;
|
|
108254
108373
|
if (xdgCacheHome)
|
|
108255
|
-
return
|
|
108374
|
+
return join76(xdgCacheHome, "opencode");
|
|
108256
108375
|
const fromShared = getOpenCodeCacheDir();
|
|
108257
|
-
const platformDefault =
|
|
108258
|
-
if (
|
|
108376
|
+
const platformDefault = join76(getPlatformDefaultCacheDir(), "opencode");
|
|
108377
|
+
if (existsSync50(fromShared) || !existsSync50(platformDefault))
|
|
108259
108378
|
return fromShared;
|
|
108260
108379
|
return platformDefault;
|
|
108261
108380
|
}
|
|
108262
108381
|
function resolveExistingDir(dirPath) {
|
|
108263
|
-
if (!
|
|
108382
|
+
if (!existsSync50(dirPath))
|
|
108264
108383
|
return dirPath;
|
|
108265
108384
|
return resolveSymlink(dirPath);
|
|
108266
108385
|
}
|
|
108267
108386
|
function readPackageJson(filePath) {
|
|
108268
|
-
if (!
|
|
108387
|
+
if (!existsSync50(filePath))
|
|
108269
108388
|
return null;
|
|
108270
108389
|
try {
|
|
108271
|
-
const content =
|
|
108390
|
+
const content = readFileSync31(filePath, "utf-8");
|
|
108272
108391
|
return parseJsonc(content);
|
|
108273
108392
|
} catch (error51) {
|
|
108274
108393
|
if (!(error51 instanceof Error)) {
|
|
@@ -108286,26 +108405,26 @@ function normalizeVersion(value) {
|
|
|
108286
108405
|
function createPackageCandidates(rootDir) {
|
|
108287
108406
|
return ACCEPTED_PACKAGE_NAMES.map((packageName) => ({
|
|
108288
108407
|
packageName,
|
|
108289
|
-
installedPackagePath:
|
|
108408
|
+
installedPackagePath: join76(rootDir, "node_modules", packageName, "package.json")
|
|
108290
108409
|
}));
|
|
108291
108410
|
}
|
|
108292
108411
|
function createTaggedInstallCandidates(rootDir) {
|
|
108293
|
-
const packagesDir =
|
|
108294
|
-
if (!
|
|
108412
|
+
const packagesDir = join76(rootDir, "packages");
|
|
108413
|
+
if (!existsSync50(packagesDir))
|
|
108295
108414
|
return [];
|
|
108296
108415
|
const candidates = [];
|
|
108297
108416
|
for (const entryName of readdirSync10(packagesDir).sort()) {
|
|
108298
108417
|
const packageName = ACCEPTED_PACKAGE_NAMES.find((name) => entryName.startsWith(`${name}@`));
|
|
108299
108418
|
if (packageName === undefined)
|
|
108300
108419
|
continue;
|
|
108301
|
-
const installDir =
|
|
108420
|
+
const installDir = join76(packagesDir, entryName);
|
|
108302
108421
|
candidates.push({
|
|
108303
108422
|
cacheDir: installDir,
|
|
108304
|
-
cachePackagePath:
|
|
108423
|
+
cachePackagePath: join76(installDir, "package.json"),
|
|
108305
108424
|
packageCandidates: [
|
|
108306
108425
|
{
|
|
108307
108426
|
packageName,
|
|
108308
|
-
installedPackagePath:
|
|
108427
|
+
installedPackagePath: join76(installDir, "node_modules", packageName, "package.json")
|
|
108309
108428
|
}
|
|
108310
108429
|
]
|
|
108311
108430
|
});
|
|
@@ -108313,7 +108432,7 @@ function createTaggedInstallCandidates(rootDir) {
|
|
|
108313
108432
|
return candidates;
|
|
108314
108433
|
}
|
|
108315
108434
|
function selectInstalledPackage(candidate2) {
|
|
108316
|
-
return candidate2.packageCandidates.find((packageCandidate) =>
|
|
108435
|
+
return candidate2.packageCandidates.find((packageCandidate) => existsSync50(packageCandidate.installedPackagePath)) ?? candidate2.packageCandidates[0];
|
|
108317
108436
|
}
|
|
108318
108437
|
function getExpectedVersion(cachePackage, packageName) {
|
|
108319
108438
|
return normalizeVersion(cachePackage?.dependencies?.[packageName]) ?? normalizeVersion(cachePackage?.dependencies?.[PACKAGE_NAME]);
|
|
@@ -108324,7 +108443,7 @@ function resolveInstalledPackageJsonPath() {
|
|
|
108324
108443
|
for (const packageName of ACCEPTED_PACKAGE_NAMES) {
|
|
108325
108444
|
try {
|
|
108326
108445
|
const packageJsonPath = require2.resolve(`${packageName}/package.json`);
|
|
108327
|
-
if (
|
|
108446
|
+
if (existsSync50(packageJsonPath)) {
|
|
108328
108447
|
return { packageName, packageJsonPath };
|
|
108329
108448
|
}
|
|
108330
108449
|
} catch {
|
|
@@ -108350,22 +108469,22 @@ function getLoadedPluginVersion() {
|
|
|
108350
108469
|
const candidates = [
|
|
108351
108470
|
{
|
|
108352
108471
|
cacheDir: configDir,
|
|
108353
|
-
cachePackagePath:
|
|
108472
|
+
cachePackagePath: join76(configDir, "package.json"),
|
|
108354
108473
|
packageCandidates: createPackageCandidates(configDir)
|
|
108355
108474
|
},
|
|
108356
108475
|
...createTaggedInstallCandidates(configDir),
|
|
108357
108476
|
{
|
|
108358
108477
|
cacheDir,
|
|
108359
|
-
cachePackagePath:
|
|
108478
|
+
cachePackagePath: join76(cacheDir, "package.json"),
|
|
108360
108479
|
packageCandidates: createPackageCandidates(cacheDir)
|
|
108361
108480
|
},
|
|
108362
108481
|
...createTaggedInstallCandidates(cacheDir)
|
|
108363
108482
|
];
|
|
108364
|
-
const selectedCandidate = candidates.find((candidate2) => candidate2.packageCandidates.some((packageCandidate) =>
|
|
108483
|
+
const selectedCandidate = candidates.find((candidate2) => candidate2.packageCandidates.some((packageCandidate) => existsSync50(packageCandidate.installedPackagePath))) ?? candidates[0];
|
|
108365
108484
|
const { cacheDir: selectedDir, cachePackagePath } = selectedCandidate;
|
|
108366
108485
|
const selectedPackage = selectInstalledPackage(selectedCandidate);
|
|
108367
108486
|
const candidateInstalledPath = selectedPackage.installedPackagePath;
|
|
108368
|
-
const candidateExists =
|
|
108487
|
+
const candidateExists = existsSync50(candidateInstalledPath);
|
|
108369
108488
|
const resolvedFallback = candidateExists ? null : resolveInstalledPackageJsonPath();
|
|
108370
108489
|
const installedPackagePath = resolvedFallback?.packageJsonPath ?? candidateInstalledPath;
|
|
108371
108490
|
const resolvedPackageName = resolvedFallback?.packageName ?? selectedPackage.packageName;
|
|
@@ -108401,8 +108520,8 @@ var defaultDeps6 = {
|
|
|
108401
108520
|
getLoadedPluginVersion,
|
|
108402
108521
|
getLatestPluginVersion,
|
|
108403
108522
|
getSuggestedInstallTag,
|
|
108404
|
-
configExists:
|
|
108405
|
-
readConfigFile: (path12) =>
|
|
108523
|
+
configExists: existsSync51,
|
|
108524
|
+
readConfigFile: (path12) => readFileSync32(path12, "utf-8"),
|
|
108406
108525
|
parseConfigContent: (content) => parseJsonc(content)
|
|
108407
108526
|
};
|
|
108408
108527
|
var BUN_POSTINSTALL_HELPER_PACKAGE_NAME = "@code-yeongyu/comment-checker";
|
|
@@ -108547,26 +108666,26 @@ async function checkSystem(deps = defaultDeps6) {
|
|
|
108547
108666
|
|
|
108548
108667
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-cache.ts
|
|
108549
108668
|
init_shared();
|
|
108550
|
-
import { existsSync as
|
|
108551
|
-
import { homedir as
|
|
108552
|
-
import { join as
|
|
108669
|
+
import { existsSync as existsSync52, readFileSync as readFileSync33 } from "fs";
|
|
108670
|
+
import { homedir as homedir16 } from "os";
|
|
108671
|
+
import { join as join77 } from "path";
|
|
108553
108672
|
function getUserConfigDir2() {
|
|
108554
108673
|
const xdgConfig = process.env.XDG_CONFIG_HOME;
|
|
108555
108674
|
if (xdgConfig)
|
|
108556
|
-
return
|
|
108557
|
-
return
|
|
108675
|
+
return join77(xdgConfig, "opencode");
|
|
108676
|
+
return join77(homedir16(), ".config", "opencode");
|
|
108558
108677
|
}
|
|
108559
108678
|
function loadCustomProviderNames() {
|
|
108560
108679
|
const configDir = getUserConfigDir2();
|
|
108561
108680
|
const candidatePaths = [
|
|
108562
|
-
|
|
108563
|
-
|
|
108681
|
+
join77(configDir, "opencode.json"),
|
|
108682
|
+
join77(configDir, "opencode.jsonc")
|
|
108564
108683
|
];
|
|
108565
108684
|
for (const configPath of candidatePaths) {
|
|
108566
|
-
if (!
|
|
108685
|
+
if (!existsSync52(configPath))
|
|
108567
108686
|
continue;
|
|
108568
108687
|
try {
|
|
108569
|
-
const content =
|
|
108688
|
+
const content = readFileSync33(configPath, "utf-8");
|
|
108570
108689
|
const data = parseJsonc(content);
|
|
108571
108690
|
if (data?.provider && typeof data.provider === "object") {
|
|
108572
108691
|
return Object.keys(data.provider);
|
|
@@ -108581,16 +108700,16 @@ function loadCustomProviderNames() {
|
|
|
108581
108700
|
return [];
|
|
108582
108701
|
}
|
|
108583
108702
|
function loadAvailableModelsFromCache() {
|
|
108584
|
-
const cacheFile =
|
|
108703
|
+
const cacheFile = join77(getOpenCodeCacheDir(), "models.json");
|
|
108585
108704
|
const customProviders = loadCustomProviderNames();
|
|
108586
|
-
if (!
|
|
108705
|
+
if (!existsSync52(cacheFile)) {
|
|
108587
108706
|
if (customProviders.length > 0) {
|
|
108588
108707
|
return { providers: customProviders, modelCount: 0, cacheExists: true };
|
|
108589
108708
|
}
|
|
108590
108709
|
return { providers: [], modelCount: 0, cacheExists: false };
|
|
108591
108710
|
}
|
|
108592
108711
|
try {
|
|
108593
|
-
const content =
|
|
108712
|
+
const content = readFileSync33(cacheFile, "utf-8");
|
|
108594
108713
|
const data = parseJsonc(content);
|
|
108595
108714
|
const cacheProviders = Object.keys(data);
|
|
108596
108715
|
let modelCount = 0;
|
|
@@ -108643,7 +108762,7 @@ function loadOmoConfig2() {
|
|
|
108643
108762
|
|
|
108644
108763
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-details.ts
|
|
108645
108764
|
init_shared();
|
|
108646
|
-
import { join as
|
|
108765
|
+
import { join as join78 } from "path";
|
|
108647
108766
|
|
|
108648
108767
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-variant.ts
|
|
108649
108768
|
function formatModelWithVariant(model, variant) {
|
|
@@ -108685,7 +108804,7 @@ function formatCapabilityResolutionLabel(mode) {
|
|
|
108685
108804
|
}
|
|
108686
108805
|
function buildModelResolutionDetails(options) {
|
|
108687
108806
|
const details = [];
|
|
108688
|
-
const cacheFile =
|
|
108807
|
+
const cacheFile = join78(getOpenCodeCacheDir(), "models.json");
|
|
108689
108808
|
details.push("\u2550\u2550\u2550 Available Models (from cache) \u2550\u2550\u2550");
|
|
108690
108809
|
details.push("");
|
|
108691
108810
|
if (options.available.cacheExists) {
|
|
@@ -108994,8 +109113,8 @@ async function checkConfig() {
|
|
|
108994
109113
|
|
|
108995
109114
|
// packages/omo-opencode/src/cli/doctor/checks/deprecated-reasoning-keys.ts
|
|
108996
109115
|
init_main();
|
|
108997
|
-
import { existsSync as
|
|
108998
|
-
import { join as
|
|
109116
|
+
import { existsSync as existsSync53, readFileSync as readFileSync34 } from "fs";
|
|
109117
|
+
import { join as join79 } from "path";
|
|
108999
109118
|
var CANONICAL_REPLACEMENT = new Map([
|
|
109000
109119
|
["variant", "reasoning"],
|
|
109001
109120
|
["reasoningEffort", "reasoning"],
|
|
@@ -109050,16 +109169,16 @@ function userConfigPaths() {
|
|
|
109050
109169
|
const home = process.env.HOME ?? process.env.USERPROFILE;
|
|
109051
109170
|
if (home === undefined || home.length === 0)
|
|
109052
109171
|
return [];
|
|
109053
|
-
return [
|
|
109172
|
+
return [join79(home, ".omo", "omo.jsonc"), join79(home, ".omo", "omo.json")];
|
|
109054
109173
|
}
|
|
109055
109174
|
async function checkDeprecatedReasoningKeys() {
|
|
109056
109175
|
const issues = [];
|
|
109057
109176
|
const scanned = [];
|
|
109058
109177
|
for (const configPath of userConfigPaths()) {
|
|
109059
|
-
if (!
|
|
109178
|
+
if (!existsSync53(configPath))
|
|
109060
109179
|
continue;
|
|
109061
109180
|
scanned.push(configPath);
|
|
109062
|
-
const parsed = parse2(
|
|
109181
|
+
const parsed = parse2(readFileSync34(configPath, "utf-8"));
|
|
109063
109182
|
issues.push(...collectIssues(configPath, parsed, ""));
|
|
109064
109183
|
}
|
|
109065
109184
|
return {
|
|
@@ -109073,28 +109192,28 @@ async function checkDeprecatedReasoningKeys() {
|
|
|
109073
109192
|
|
|
109074
109193
|
// packages/omo-opencode/src/cli/doctor/checks/dependencies.ts
|
|
109075
109194
|
init_src2();
|
|
109076
|
-
import { existsSync as
|
|
109195
|
+
import { existsSync as existsSync54 } from "fs";
|
|
109077
109196
|
import { createRequire as createRequire3 } from "module";
|
|
109078
|
-
import { homedir as
|
|
109079
|
-
import { dirname as
|
|
109197
|
+
import { homedir as homedir18 } from "os";
|
|
109198
|
+
import { dirname as dirname30, join as join81 } from "path";
|
|
109080
109199
|
|
|
109081
109200
|
// packages/omo-opencode/src/hooks/comment-checker/downloader.ts
|
|
109082
|
-
import { join as
|
|
109083
|
-
import { homedir as
|
|
109201
|
+
import { join as join80 } from "path";
|
|
109202
|
+
import { homedir as homedir17, tmpdir as tmpdir4 } from "os";
|
|
109084
109203
|
init_binary_downloader();
|
|
109085
109204
|
init_logger2();
|
|
109086
109205
|
init_plugin_identity();
|
|
109087
109206
|
var DEBUG = process.env.COMMENT_CHECKER_DEBUG === "1";
|
|
109088
|
-
var DEBUG_FILE =
|
|
109207
|
+
var DEBUG_FILE = join80(tmpdir4(), "comment-checker-debug.log");
|
|
109089
109208
|
function getCacheDir2() {
|
|
109090
109209
|
if (process.platform === "win32") {
|
|
109091
109210
|
const localAppData = process.env.LOCALAPPDATA || process.env.APPDATA;
|
|
109092
|
-
const base2 = localAppData ||
|
|
109093
|
-
return
|
|
109211
|
+
const base2 = localAppData || join80(homedir17(), "AppData", "Local");
|
|
109212
|
+
return join80(base2, CACHE_DIR_NAME, "bin");
|
|
109094
109213
|
}
|
|
109095
109214
|
const xdgCache = process.env.XDG_CACHE_HOME;
|
|
109096
|
-
const base = xdgCache ||
|
|
109097
|
-
return
|
|
109215
|
+
const base = xdgCache || join80(homedir17(), ".cache");
|
|
109216
|
+
return join80(base, CACHE_DIR_NAME, "bin");
|
|
109098
109217
|
}
|
|
109099
109218
|
function getBinaryName() {
|
|
109100
109219
|
return process.platform === "win32" ? "comment-checker.exe" : "comment-checker";
|
|
@@ -109144,7 +109263,7 @@ async function getBinaryVersion(binary) {
|
|
|
109144
109263
|
}
|
|
109145
109264
|
}
|
|
109146
109265
|
async function checkAstGrepCli() {
|
|
109147
|
-
const runtimeDir = astGrepRuntimeDir(
|
|
109266
|
+
const runtimeDir = astGrepRuntimeDir(join81(homedir18(), ".omo"));
|
|
109148
109267
|
const sgPath = findSgBinarySync({ runtimeDir });
|
|
109149
109268
|
if (sgPath === null) {
|
|
109150
109269
|
return {
|
|
@@ -109173,12 +109292,12 @@ function findCommentCheckerPackageBinary(baseDirOverride, resolvePackageJsonPath
|
|
|
109173
109292
|
const binaryName = process.platform === "win32" ? "comment-checker.exe" : "comment-checker";
|
|
109174
109293
|
const platformKey = `${process.platform}-${process.arch === "x64" ? "x64" : process.arch}`;
|
|
109175
109294
|
try {
|
|
109176
|
-
const packageDir = baseDirOverride ??
|
|
109177
|
-
const vendorPath =
|
|
109178
|
-
if (
|
|
109295
|
+
const packageDir = baseDirOverride ?? dirname30(resolvePackageJsonPath());
|
|
109296
|
+
const vendorPath = join81(packageDir, "vendor", platformKey, binaryName);
|
|
109297
|
+
if (existsSync54(vendorPath))
|
|
109179
109298
|
return vendorPath;
|
|
109180
|
-
const binPath =
|
|
109181
|
-
if (
|
|
109299
|
+
const binPath = join81(packageDir, "bin", binaryName);
|
|
109300
|
+
if (existsSync54(binPath))
|
|
109182
109301
|
return binPath;
|
|
109183
109302
|
} catch (error51) {
|
|
109184
109303
|
if (!(error51 instanceof Error) && !isModuleResolutionFailure(error51))
|
|
@@ -109324,8 +109443,8 @@ async function getGhCliInfo(dependencies = {}) {
|
|
|
109324
109443
|
// packages/omo-opencode/src/mcp/lsp.ts
|
|
109325
109444
|
init_zod();
|
|
109326
109445
|
init_opencode_config_dir();
|
|
109327
|
-
import { existsSync as
|
|
109328
|
-
import { delimiter as delimiter3, dirname as
|
|
109446
|
+
import { existsSync as existsSync55, readFileSync as readFileSync35 } from "fs";
|
|
109447
|
+
import { delimiter as delimiter3, dirname as dirname31, resolve as resolve22 } from "path";
|
|
109329
109448
|
import { fileURLToPath as fileURLToPath7 } from "url";
|
|
109330
109449
|
|
|
109331
109450
|
// packages/omo-opencode/src/mcp/cli-suffix.ts
|
|
@@ -109372,7 +109491,7 @@ function resolveRuntimeExecutable(commandName, options = {}) {
|
|
|
109372
109491
|
}
|
|
109373
109492
|
|
|
109374
109493
|
// packages/omo-opencode/src/mcp/shared/ancestor-cli-resolver.ts
|
|
109375
|
-
import { resolve as
|
|
109494
|
+
import { resolve as resolve21 } from "path";
|
|
109376
109495
|
function resolveJavaScriptRuntime(resolveExecutable) {
|
|
109377
109496
|
const node = resolveExecutable("node");
|
|
109378
109497
|
return node.available ? node : resolveExecutable("bun");
|
|
@@ -109380,9 +109499,9 @@ function resolveJavaScriptRuntime(resolveExecutable) {
|
|
|
109380
109499
|
function createAncestorCliCandidates(options) {
|
|
109381
109500
|
const candidates = [];
|
|
109382
109501
|
const seenPaths = new Set;
|
|
109383
|
-
let currentDirectory =
|
|
109502
|
+
let currentDirectory = resolve21(options.startDirectory);
|
|
109384
109503
|
while (true) {
|
|
109385
|
-
const distCliPath =
|
|
109504
|
+
const distCliPath = resolve21(currentDirectory, options.packageRel, options.distCliRel);
|
|
109386
109505
|
if (!seenPaths.has(distCliPath)) {
|
|
109387
109506
|
const runtime5 = resolveJavaScriptRuntime(options.resolveExecutable);
|
|
109388
109507
|
seenPaths.add(distCliPath);
|
|
@@ -109394,7 +109513,7 @@ function createAncestorCliCandidates(options) {
|
|
|
109394
109513
|
runtimeAvailable: runtime5.available
|
|
109395
109514
|
});
|
|
109396
109515
|
}
|
|
109397
|
-
const sourceCliPath =
|
|
109516
|
+
const sourceCliPath = resolve21(currentDirectory, options.packageRel, options.sourceCliRel);
|
|
109398
109517
|
if (!seenPaths.has(sourceCliPath)) {
|
|
109399
109518
|
const runtime5 = options.resolveExecutable("bun");
|
|
109400
109519
|
const sourceCandidateAvailable = options.isSourceCandidateAvailable?.({
|
|
@@ -109411,7 +109530,7 @@ function createAncestorCliCandidates(options) {
|
|
|
109411
109530
|
runtimeAvailable: runtime5.available
|
|
109412
109531
|
});
|
|
109413
109532
|
}
|
|
109414
|
-
const parentDirectory =
|
|
109533
|
+
const parentDirectory = resolve21(currentDirectory, "..");
|
|
109415
109534
|
if (parentDirectory === currentDirectory)
|
|
109416
109535
|
return candidates;
|
|
109417
109536
|
currentDirectory = parentDirectory;
|
|
@@ -109456,7 +109575,7 @@ var LSP_BOOTSTRAP_SCRIPT = [
|
|
|
109456
109575
|
].join(";");
|
|
109457
109576
|
function getModuleDirectory(moduleUrl) {
|
|
109458
109577
|
try {
|
|
109459
|
-
return
|
|
109578
|
+
return dirname31(fileURLToPath7(moduleUrl));
|
|
109460
109579
|
} catch (error51) {
|
|
109461
109580
|
if (!(error51 instanceof Error))
|
|
109462
109581
|
throw error51;
|
|
@@ -109464,11 +109583,11 @@ function getModuleDirectory(moduleUrl) {
|
|
|
109464
109583
|
}
|
|
109465
109584
|
}
|
|
109466
109585
|
function findBootstrapRoot(candidates, pathExists) {
|
|
109467
|
-
return candidates.find((candidate2) => pathExists(
|
|
109586
|
+
return candidates.find((candidate2) => pathExists(resolve22(candidate2.root, "package.json")))?.root ?? process.cwd();
|
|
109468
109587
|
}
|
|
109469
109588
|
function readDaemonPackageVersion(root) {
|
|
109470
109589
|
try {
|
|
109471
|
-
const packageJson = JSON.parse(
|
|
109590
|
+
const packageJson = JSON.parse(readFileSync35(resolve22(root, PACKAGE_REL, "package.json"), "utf-8"));
|
|
109472
109591
|
return DaemonPackageSchema.parse(packageJson).version;
|
|
109473
109592
|
} catch (error51) {
|
|
109474
109593
|
if (!(error51 instanceof Error))
|
|
@@ -109480,17 +109599,17 @@ function createBootstrapCandidate(root, pathExists, resolveExecutable) {
|
|
|
109480
109599
|
const runtime5 = resolveJavaScriptRuntime(resolveExecutable);
|
|
109481
109600
|
const bun = resolveExecutable("bun");
|
|
109482
109601
|
const npm = resolveExecutable("npm");
|
|
109483
|
-
const packageManifestPath =
|
|
109602
|
+
const packageManifestPath = resolve22(root, PACKAGE_REL, "package.json");
|
|
109484
109603
|
return {
|
|
109485
109604
|
command: [runtime5.command, "-e", LSP_BOOTSTRAP_SCRIPT, root, npm.command, bun.command],
|
|
109486
109605
|
root,
|
|
109487
|
-
path:
|
|
109606
|
+
path: resolve22(root, PACKAGE_REL, DIST_CLI_REL),
|
|
109488
109607
|
exists: runtime5.available && npm.available && pathExists(packageManifestPath),
|
|
109489
109608
|
runtimeAvailable: runtime5.available
|
|
109490
109609
|
};
|
|
109491
109610
|
}
|
|
109492
109611
|
function resolveLspCommand(options = {}) {
|
|
109493
|
-
const pathExists = options.exists ??
|
|
109612
|
+
const pathExists = options.exists ?? existsSync55;
|
|
109494
109613
|
const resolveExecutable = options.resolveExecutable ?? resolveRuntimeExecutable;
|
|
109495
109614
|
const moduleDirectory = getModuleDirectory(options.moduleUrl ?? import.meta.url);
|
|
109496
109615
|
const candidates = moduleDirectory ? createAncestorCliCandidates({
|
|
@@ -109500,7 +109619,7 @@ function resolveLspCommand(options = {}) {
|
|
|
109500
109619
|
sourceCliRel: SOURCE_CLI_REL,
|
|
109501
109620
|
pathExists,
|
|
109502
109621
|
resolveExecutable,
|
|
109503
|
-
isSourceCandidateAvailable: ({ root }) => pathExists(
|
|
109622
|
+
isSourceCandidateAvailable: ({ root }) => pathExists(resolve22(root, LSP_TOOLS_PACKAGE_REL, DIST_CLI_REL)) && readDaemonPackageVersion(root) !== null
|
|
109504
109623
|
}) : [];
|
|
109505
109624
|
const distCandidate = candidates.find((candidate2) => hasCliSuffix(candidate2.path, DIST_CLI_REL) && candidate2.exists);
|
|
109506
109625
|
if (distCandidate) {
|
|
@@ -109514,7 +109633,7 @@ function resolveLspCommand(options = {}) {
|
|
|
109514
109633
|
}
|
|
109515
109634
|
function createLspMcpConfig(options = {}) {
|
|
109516
109635
|
const resolvedCommand = resolveLspCommand(options);
|
|
109517
|
-
const cwd =
|
|
109636
|
+
const cwd = resolve22(options.cwd ?? process.cwd());
|
|
109518
109637
|
const configDir = getOpenCodeConfigDir({ binary: "opencode" });
|
|
109519
109638
|
const sourceVersion = hasCliSuffix(resolvedCommand.path, SOURCE_CLI_REL) ? readDaemonPackageVersion(resolvedCommand.root) : null;
|
|
109520
109639
|
return {
|
|
@@ -109523,9 +109642,9 @@ function createLspMcpConfig(options = {}) {
|
|
|
109523
109642
|
enabled: resolvedCommand.exists,
|
|
109524
109643
|
cwd,
|
|
109525
109644
|
environment: {
|
|
109526
|
-
LSP_TOOLS_MCP_PROJECT_CONFIG: PROJECT_LSP_CONFIGS.map((configPath) =>
|
|
109527
|
-
LSP_TOOLS_MCP_USER_CONFIG:
|
|
109528
|
-
LSP_TOOLS_MCP_INSTALL_DECISIONS:
|
|
109645
|
+
LSP_TOOLS_MCP_PROJECT_CONFIG: PROJECT_LSP_CONFIGS.map((configPath) => resolve22(cwd, configPath)).join(delimiter3),
|
|
109646
|
+
LSP_TOOLS_MCP_USER_CONFIG: resolve22(configDir, "lsp.json"),
|
|
109647
|
+
LSP_TOOLS_MCP_INSTALL_DECISIONS: resolve22(configDir, "lsp-install-decisions.json"),
|
|
109529
109648
|
...sourceVersion ? {
|
|
109530
109649
|
[OMO_LSP_DAEMON_CLI]: resolvedCommand.path,
|
|
109531
109650
|
[OMO_LSP_DAEMON_VERSION]: sourceVersion
|
|
@@ -109550,24 +109669,24 @@ function getInstalledLspServers(options = {}) {
|
|
|
109550
109669
|
|
|
109551
109670
|
// packages/omo-opencode/src/cli/doctor/checks/tools-mcp.ts
|
|
109552
109671
|
init_shared();
|
|
109553
|
-
import { existsSync as
|
|
109554
|
-
import { homedir as
|
|
109555
|
-
import { join as
|
|
109672
|
+
import { existsSync as existsSync56, readFileSync as readFileSync36 } from "fs";
|
|
109673
|
+
import { homedir as homedir19 } from "os";
|
|
109674
|
+
import { join as join82 } from "path";
|
|
109556
109675
|
var BUILTIN_MCP_SERVERS = ["websearch", "context7", "grep_app", "lsp"];
|
|
109557
109676
|
function getMcpConfigPaths() {
|
|
109558
109677
|
return [
|
|
109559
|
-
|
|
109560
|
-
|
|
109561
|
-
|
|
109678
|
+
join82(homedir19(), ".claude", ".mcp.json"),
|
|
109679
|
+
join82(process.cwd(), ".mcp.json"),
|
|
109680
|
+
join82(process.cwd(), ".claude", ".mcp.json")
|
|
109562
109681
|
];
|
|
109563
109682
|
}
|
|
109564
109683
|
function loadUserMcpConfig() {
|
|
109565
109684
|
const servers = {};
|
|
109566
109685
|
for (const configPath of getMcpConfigPaths()) {
|
|
109567
|
-
if (!
|
|
109686
|
+
if (!existsSync56(configPath))
|
|
109568
109687
|
continue;
|
|
109569
109688
|
try {
|
|
109570
|
-
const content =
|
|
109689
|
+
const content = readFileSync36(configPath, "utf-8");
|
|
109571
109690
|
const config4 = parseJsonc(content);
|
|
109572
109691
|
if (config4.mcpServers) {
|
|
109573
109692
|
Object.assign(servers, config4.mcpServers);
|
|
@@ -109702,17 +109821,17 @@ async function checkTools() {
|
|
|
109702
109821
|
|
|
109703
109822
|
// packages/omo-opencode/src/cli/doctor/checks/telemetry.ts
|
|
109704
109823
|
init_src5();
|
|
109705
|
-
import { existsSync as
|
|
109824
|
+
import { existsSync as existsSync57, readFileSync as readFileSync37 } from "fs";
|
|
109706
109825
|
function isTelemetryState(value) {
|
|
109707
109826
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
109708
109827
|
}
|
|
109709
109828
|
function readLastActiveDay(stateFilePath) {
|
|
109710
|
-
if (!
|
|
109829
|
+
if (!existsSync57(stateFilePath)) {
|
|
109711
109830
|
return "never";
|
|
109712
109831
|
}
|
|
109713
109832
|
let parsed;
|
|
109714
109833
|
try {
|
|
109715
|
-
parsed = JSON.parse(
|
|
109834
|
+
parsed = JSON.parse(readFileSync37(stateFilePath, "utf-8"));
|
|
109716
109835
|
} catch (error51) {
|
|
109717
109836
|
if (error51 instanceof Error) {
|
|
109718
109837
|
return "unreadable";
|
|
@@ -109770,17 +109889,17 @@ async function probeBinary(cmd, args, spawnImpl) {
|
|
|
109770
109889
|
}
|
|
109771
109890
|
|
|
109772
109891
|
// packages/team-core/src/team-registry/paths.ts
|
|
109773
|
-
import { homedir as
|
|
109892
|
+
import { homedir as homedir20 } from "os";
|
|
109774
109893
|
import path12 from "path";
|
|
109775
109894
|
function resolveBaseDir(config4) {
|
|
109776
|
-
return expandHomeDirectory(config4.base_dir ?? path12.join(
|
|
109895
|
+
return expandHomeDirectory(config4.base_dir ?? path12.join(homedir20(), ".omo"));
|
|
109777
109896
|
}
|
|
109778
109897
|
function expandHomeDirectory(directoryPath3) {
|
|
109779
109898
|
if (directoryPath3 === "~") {
|
|
109780
|
-
return
|
|
109899
|
+
return homedir20();
|
|
109781
109900
|
}
|
|
109782
109901
|
if (directoryPath3.startsWith("~/") || directoryPath3.startsWith("~\\")) {
|
|
109783
|
-
return path12.join(
|
|
109902
|
+
return path12.join(homedir20(), directoryPath3.slice(2));
|
|
109784
109903
|
}
|
|
109785
109904
|
return directoryPath3;
|
|
109786
109905
|
}
|
|
@@ -109837,10 +109956,10 @@ async function pathExists(dir) {
|
|
|
109837
109956
|
|
|
109838
109957
|
// packages/omo-opencode/src/cli/doctor/checks/codex.ts
|
|
109839
109958
|
init_src2();
|
|
109840
|
-
import { existsSync as
|
|
109959
|
+
import { existsSync as existsSync58 } from "fs";
|
|
109841
109960
|
import { lstat as lstat15, readdir as readdir14, readFile as readFile27 } from "fs/promises";
|
|
109842
|
-
import { homedir as
|
|
109843
|
-
import { basename as basename11, join as
|
|
109961
|
+
import { homedir as homedir21 } from "os";
|
|
109962
|
+
import { basename as basename11, join as join83, resolve as resolve23 } from "path";
|
|
109844
109963
|
// packages/omo-opencode/package.json
|
|
109845
109964
|
var package_default3 = {
|
|
109846
109965
|
name: "@oh-my-opencode/omo-opencode",
|
|
@@ -109905,13 +110024,13 @@ var CODEX_BIN_NAMES = [
|
|
|
109905
110024
|
"omo-git-bash-hook"
|
|
109906
110025
|
];
|
|
109907
110026
|
async function gatherCodexSummary(deps = {}) {
|
|
109908
|
-
const codexHome =
|
|
110027
|
+
const codexHome = resolve23(deps.codexHome ?? process.env.CODEX_HOME ?? join83(homedir21(), ".codex"));
|
|
109909
110028
|
const binDir = resolveCodexInstallerBinDir({ binDir: deps.binDir, codexHome, env: process.env });
|
|
109910
110029
|
const detection = await (deps.detectCodexInstallation ?? detectCodexInstallation)();
|
|
109911
110030
|
const pluginRoot = await resolveInstalledPluginRoot(codexHome);
|
|
109912
|
-
const manifest2 = pluginRoot === null ? null : await readJson(
|
|
109913
|
-
const installSnapshot = pluginRoot === null ? null : await readJson(
|
|
109914
|
-
const configPath =
|
|
110031
|
+
const manifest2 = pluginRoot === null ? null : await readJson(join83(pluginRoot, ".codex-plugin", "plugin.json"));
|
|
110032
|
+
const installSnapshot = pluginRoot === null ? null : await readJson(join83(pluginRoot, "lazycodex-install.json"));
|
|
110033
|
+
const configPath = join83(codexHome, "config.toml");
|
|
109915
110034
|
const pluginVersion = stringField(manifest2, "version");
|
|
109916
110035
|
return {
|
|
109917
110036
|
codexPath: detection.found && "path" in detection ? detection.path : null,
|
|
@@ -109968,7 +110087,7 @@ function buildCodexIssues(summary) {
|
|
|
109968
110087
|
if (summary.pluginRoot === null) {
|
|
109969
110088
|
issues.push({
|
|
109970
110089
|
title: "OMO Codex plugin is not installed",
|
|
109971
|
-
description: `Expected cached plugin at ${
|
|
110090
|
+
description: `Expected cached plugin at ${join83("plugins", "cache", MARKETPLACE_NAME, PLUGIN_NAME2, DEFAULT_PLUGIN_VERSION)} under CODEX_HOME.`,
|
|
109972
110091
|
fix: "Run: npx lazycodex-ai install",
|
|
109973
110092
|
severity: "error",
|
|
109974
110093
|
affects: ["plugin loading"]
|
|
@@ -110033,15 +110152,15 @@ function buildCodexIssues(summary) {
|
|
|
110033
110152
|
return issues;
|
|
110034
110153
|
}
|
|
110035
110154
|
async function resolveInstalledPluginRoot(codexHome) {
|
|
110036
|
-
const pluginRoot =
|
|
110037
|
-
if (!
|
|
110155
|
+
const pluginRoot = join83(codexHome, "plugins", "cache", MARKETPLACE_NAME, PLUGIN_NAME2);
|
|
110156
|
+
if (!existsSync58(pluginRoot))
|
|
110038
110157
|
return null;
|
|
110039
110158
|
const versions2 = await readdir14(pluginRoot, { withFileTypes: true });
|
|
110040
110159
|
const candidates = versions2.filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort(compareVersionsDescending);
|
|
110041
|
-
return candidates.length === 0 ? null :
|
|
110160
|
+
return candidates.length === 0 ? null : join83(pluginRoot, candidates[0] ?? DEFAULT_PLUGIN_VERSION);
|
|
110042
110161
|
}
|
|
110043
110162
|
async function readCodexConfigSummary(configPath) {
|
|
110044
|
-
if (!
|
|
110163
|
+
if (!existsSync58(configPath)) {
|
|
110045
110164
|
return {
|
|
110046
110165
|
exists: false,
|
|
110047
110166
|
marketplaceConfigured: false,
|
|
@@ -110066,14 +110185,14 @@ async function readCodexConfigSummary(configPath) {
|
|
|
110066
110185
|
async function readLinkedBins(binDir) {
|
|
110067
110186
|
const linked = [];
|
|
110068
110187
|
for (const name of CODEX_BIN_NAMES) {
|
|
110069
|
-
if (await pathExists2(
|
|
110188
|
+
if (await pathExists2(join83(binDir, process.platform === "win32" ? `${name}.cmd` : name)))
|
|
110070
110189
|
linked.push(name);
|
|
110071
110190
|
}
|
|
110072
110191
|
return linked;
|
|
110073
110192
|
}
|
|
110074
110193
|
async function readLinkedAgents(codexHome) {
|
|
110075
|
-
const agentsDir =
|
|
110076
|
-
if (!
|
|
110194
|
+
const agentsDir = join83(codexHome, "agents");
|
|
110195
|
+
if (!existsSync58(agentsDir))
|
|
110077
110196
|
return [];
|
|
110078
110197
|
const entries = await readdir14(agentsDir, { withFileTypes: true });
|
|
110079
110198
|
return entries.filter((entry) => entry.isFile() || entry.isSymbolicLink()).map((entry) => basename11(entry.name, ".toml")).sort();
|
|
@@ -110119,16 +110238,16 @@ function formatCompanionPluginStatus(config4) {
|
|
|
110119
110238
|
return "none";
|
|
110120
110239
|
}
|
|
110121
110240
|
function readCompanionLifecycleHookStateEvents(content) {
|
|
110122
|
-
const
|
|
110241
|
+
const events2 = new Set;
|
|
110123
110242
|
for (const section of splitTomlSections(content)) {
|
|
110124
110243
|
if (section.header === null)
|
|
110125
110244
|
continue;
|
|
110126
110245
|
const key = parseHookStateHeaderKey(section.header);
|
|
110127
110246
|
const event = key === null ? null : companionLifecycleEventFromHookStateKey(key);
|
|
110128
110247
|
if (event !== null)
|
|
110129
|
-
|
|
110248
|
+
events2.add(event);
|
|
110130
110249
|
}
|
|
110131
|
-
return [...
|
|
110250
|
+
return [...events2].sort(compareCompanionLifecycleEvents);
|
|
110132
110251
|
}
|
|
110133
110252
|
function companionLifecycleEventFromHookStateKey(key) {
|
|
110134
110253
|
if (!key.startsWith(`${COMPANION_PLUGIN_KEY}:`))
|
|
@@ -110142,8 +110261,8 @@ function compareCompanionLifecycleEvents(left, right) {
|
|
|
110142
110261
|
function companionLifecycleEventOrder(event) {
|
|
110143
110262
|
return event === "session_start" ? 0 : event === "stop" ? 1 : 2;
|
|
110144
110263
|
}
|
|
110145
|
-
function formatCompanionLifecycleEvents(
|
|
110146
|
-
return
|
|
110264
|
+
function formatCompanionLifecycleEvents(events2) {
|
|
110265
|
+
return events2.map(formatCompanionLifecycleEvent).join(", ");
|
|
110147
110266
|
}
|
|
110148
110267
|
function formatCompanionLifecycleEvent(event) {
|
|
110149
110268
|
switch (event) {
|
|
@@ -110187,8 +110306,8 @@ async function pathExists2(path14) {
|
|
|
110187
110306
|
// packages/omo-opencode/src/cli/doctor/checks/codex-components.ts
|
|
110188
110307
|
init_src2();
|
|
110189
110308
|
import { readdir as readdir15, readFile as readFile28, stat as stat7 } from "fs/promises";
|
|
110190
|
-
import { homedir as
|
|
110191
|
-
import { dirname as
|
|
110309
|
+
import { homedir as homedir22 } from "os";
|
|
110310
|
+
import { dirname as dirname32, isAbsolute as isAbsolute12, join as join84, relative as relative9, resolve as resolve24, sep as sep9 } from "path";
|
|
110192
110311
|
var CODEX_COMPONENTS_CHECK_ID = "codex-components";
|
|
110193
110312
|
var CODEX_COMPONENTS_CHECK_NAME = "codex-components";
|
|
110194
110313
|
var PLUGIN_DATA_DIR_NAME = "omo-sisyphuslabs";
|
|
@@ -110198,7 +110317,7 @@ async function checkCodexComponents(deps = {}) {
|
|
|
110198
110317
|
const env3 = deps.env ?? process.env;
|
|
110199
110318
|
const platform = deps.platform ?? process.platform;
|
|
110200
110319
|
const arch = deps.arch ?? process.arch;
|
|
110201
|
-
const codexHome =
|
|
110320
|
+
const codexHome = resolve24(deps.codexHome ?? env3["CODEX_HOME"] ?? join84(homedir22(), ".codex"));
|
|
110202
110321
|
const summary = await gatherCodexSummary({ ...deps, codexHome });
|
|
110203
110322
|
if (summary.pluginRoot === null) {
|
|
110204
110323
|
return {
|
|
@@ -110223,7 +110342,7 @@ async function checkCodexComponents(deps = {}) {
|
|
|
110223
110342
|
});
|
|
110224
110343
|
}
|
|
110225
110344
|
const runtimeSgDir = runtimeSgDirectory(codexHome, platform, arch);
|
|
110226
|
-
const runtimeSgPath =
|
|
110345
|
+
const runtimeSgPath = join84(runtimeSgDir, sgBinaryName(platform));
|
|
110227
110346
|
const sg = findSgBinarySync({
|
|
110228
110347
|
arch,
|
|
110229
110348
|
env: env3,
|
|
@@ -110262,8 +110381,8 @@ async function auditBundleTargets(pluginRoot) {
|
|
|
110262
110381
|
const manifest2 = await readJson2(manifestPath);
|
|
110263
110382
|
if (manifest2 === null || !isRecord12(manifest2["mcpServers"]))
|
|
110264
110383
|
continue;
|
|
110265
|
-
const manifestRoot =
|
|
110266
|
-
const isRootManifest =
|
|
110384
|
+
const manifestRoot = dirname32(manifestPath);
|
|
110385
|
+
const isRootManifest = resolve24(manifestRoot) === resolve24(pluginRoot);
|
|
110267
110386
|
for (const server2 of Object.values(manifest2["mcpServers"])) {
|
|
110268
110387
|
if (!isRecord12(server2) || !Array.isArray(server2["args"]))
|
|
110269
110388
|
continue;
|
|
@@ -110283,7 +110402,7 @@ async function auditBundleTargets(pluginRoot) {
|
|
|
110283
110402
|
continue;
|
|
110284
110403
|
const commands2 = [];
|
|
110285
110404
|
collectHookCommands(manifest2, commands2);
|
|
110286
|
-
const hookPluginRoot =
|
|
110405
|
+
const hookPluginRoot = dirname32(dirname32(hookManifestPath));
|
|
110287
110406
|
for (const command of commands2) {
|
|
110288
110407
|
for (const relativePath of extractPluginRootPaths(command)) {
|
|
110289
110408
|
referencedCount += 1;
|
|
@@ -110305,8 +110424,8 @@ function recordBrokenTarget(broken, classified, origin) {
|
|
|
110305
110424
|
broken.push(entry);
|
|
110306
110425
|
}
|
|
110307
110426
|
async function classifyBundleTarget(bundleRoot, baseRoot, relativePath, allowEscape) {
|
|
110308
|
-
const targetPath =
|
|
110309
|
-
const bundleRootPath =
|
|
110427
|
+
const targetPath = resolve24(baseRoot, relativePath);
|
|
110428
|
+
const bundleRootPath = resolve24(bundleRoot);
|
|
110310
110429
|
const bundleRootPrefix = bundleRootPath.endsWith(sep9) ? bundleRootPath : `${bundleRootPath}${sep9}`;
|
|
110311
110430
|
if (targetPath !== bundleRootPath && !targetPath.startsWith(bundleRootPrefix)) {
|
|
110312
110431
|
if (allowEscape)
|
|
@@ -110322,7 +110441,7 @@ async function classifyBundleTarget(bundleRoot, baseRoot, relativePath, allowEsc
|
|
|
110322
110441
|
}
|
|
110323
110442
|
async function findHookManifestPaths(root) {
|
|
110324
110443
|
const paths3 = await findManifestPaths(root, "hooks.json");
|
|
110325
|
-
return paths3.filter((path14) =>
|
|
110444
|
+
return paths3.filter((path14) => dirname32(path14).endsWith(`${sep9}hooks`));
|
|
110326
110445
|
}
|
|
110327
110446
|
async function findManifestPaths(root, manifestName) {
|
|
110328
110447
|
let entries;
|
|
@@ -110335,7 +110454,7 @@ async function findManifestPaths(root, manifestName) {
|
|
|
110335
110454
|
for (const entry of entries) {
|
|
110336
110455
|
if (entry.name === "node_modules" || entry.name === ".git")
|
|
110337
110456
|
continue;
|
|
110338
|
-
const entryPath =
|
|
110457
|
+
const entryPath = join84(root, entry.name);
|
|
110339
110458
|
if (entry.isDirectory()) {
|
|
110340
110459
|
paths3.push(...await findManifestPaths(entryPath, manifestName));
|
|
110341
110460
|
continue;
|
|
@@ -110379,18 +110498,18 @@ function isPluginRuntimePathArg(arg) {
|
|
|
110379
110498
|
return normalized.endsWith(".js") && normalized.includes("/dist/") && (normalized.startsWith("./") || normalized.startsWith("../") || normalized.startsWith("components/") || normalized.startsWith("/") || isAbsolute12(arg));
|
|
110380
110499
|
}
|
|
110381
110500
|
function runtimeSgDirectory(codexHome, platform, arch) {
|
|
110382
|
-
return
|
|
110501
|
+
return join84(codexHome, "runtime", "ast-grep", runtimeSlug(platform, arch));
|
|
110383
110502
|
}
|
|
110384
110503
|
function describeSgSource(sgPath, env3, runtimeSgDir, platform) {
|
|
110385
110504
|
const override = env3[SG_PATH_ENV_KEY]?.trim();
|
|
110386
110505
|
if (override !== undefined && override.length > 0 && sgPath === override)
|
|
110387
110506
|
return `env override ${SG_PATH_ENV_KEY}`;
|
|
110388
|
-
if (sgPath ===
|
|
110507
|
+
if (sgPath === join84(runtimeSgDir, sgBinaryName(platform)))
|
|
110389
110508
|
return "runtime dir";
|
|
110390
110509
|
return "PATH";
|
|
110391
110510
|
}
|
|
110392
110511
|
async function readBootstrapStateSummary(codexHome) {
|
|
110393
|
-
const statePath =
|
|
110512
|
+
const statePath = join84(codexHome, "plugins", "data", PLUGIN_DATA_DIR_NAME, "bootstrap", "state.json");
|
|
110394
110513
|
const raw = await readJson2(statePath);
|
|
110395
110514
|
if (raw === null)
|
|
110396
110515
|
return null;
|
|
@@ -110466,24 +110585,24 @@ function isRecord12(value) {
|
|
|
110466
110585
|
}
|
|
110467
110586
|
|
|
110468
110587
|
// packages/omo-opencode/src/cli/doctor/checks/codex-runtime-wrapper.ts
|
|
110469
|
-
import { existsSync as
|
|
110588
|
+
import { existsSync as existsSync59 } from "fs";
|
|
110470
110589
|
import { readFile as readFile29 } from "fs/promises";
|
|
110471
|
-
import { homedir as
|
|
110472
|
-
import { join as
|
|
110590
|
+
import { homedir as homedir23 } from "os";
|
|
110591
|
+
import { join as join85, resolve as resolve25 } from "path";
|
|
110473
110592
|
var RUNTIME_WRAPPER_MARKER2 = "OMO_GENERATED_RUNTIME_WRAPPER";
|
|
110474
110593
|
var CHECK_NAME = "codex-runtime-wrapper";
|
|
110475
110594
|
var REINSTALL_COMMAND = "npx --yes lazycodex-ai@latest install --no-tui";
|
|
110476
110595
|
async function checkCodexRuntimeWrapper(deps = {}) {
|
|
110477
|
-
const codexHome =
|
|
110596
|
+
const codexHome = resolve25(deps.codexHome ?? process.env.CODEX_HOME ?? join85(homedir23(), ".codex"));
|
|
110478
110597
|
const binDir = resolveCodexInstallerBinDir({ binDir: deps.binDir, codexHome, env: process.env });
|
|
110479
110598
|
const platform = deps.platform ?? process.platform;
|
|
110480
|
-
const wrapperPath =
|
|
110481
|
-
const legacyWrapperPath =
|
|
110599
|
+
const wrapperPath = join85(binDir, platform === "win32" ? "omo-agent-toolkit.cmd" : "omo-agent-toolkit");
|
|
110600
|
+
const legacyWrapperPath = join85(binDir, platform === "win32" ? "omo.cmd" : "omo");
|
|
110482
110601
|
const [wrapper, legacyWrapper] = await Promise.all([readRuntimeWrapper(wrapperPath), readRuntimeWrapper(legacyWrapperPath)]);
|
|
110483
110602
|
const issues = [];
|
|
110484
110603
|
if (wrapper?.includes(RUNTIME_WRAPPER_MARKER2) === true) {
|
|
110485
110604
|
const targetPath = parseRuntimeTargetPath(wrapper);
|
|
110486
|
-
if (targetPath !== null && !
|
|
110605
|
+
if (targetPath !== null && !existsSync59(targetPath)) {
|
|
110487
110606
|
issues.push({
|
|
110488
110607
|
title: "omo-agent-toolkit runtime wrapper target is missing",
|
|
110489
110608
|
description: `Generated omo-agent-toolkit runtime wrapper at ${wrapperPath} points to missing target ${targetPath}.`,
|
|
@@ -110997,24 +111116,24 @@ Doctor failed unexpectedly: ${message}`];
|
|
|
110997
111116
|
// packages/mcp-client-core/src/mcp-oauth/storage.ts
|
|
110998
111117
|
import { createHash as createHash6 } from "crypto";
|
|
110999
111118
|
import {
|
|
111000
|
-
chmodSync as
|
|
111001
|
-
existsSync as
|
|
111002
|
-
mkdirSync as
|
|
111119
|
+
chmodSync as chmodSync5,
|
|
111120
|
+
existsSync as existsSync62,
|
|
111121
|
+
mkdirSync as mkdirSync15,
|
|
111003
111122
|
readdirSync as readdirSync11,
|
|
111004
|
-
readFileSync as
|
|
111123
|
+
readFileSync as readFileSync39,
|
|
111005
111124
|
renameSync as renameSync7,
|
|
111006
111125
|
unlinkSync as unlinkSync9,
|
|
111007
|
-
writeFileSync as
|
|
111126
|
+
writeFileSync as writeFileSync12
|
|
111008
111127
|
} from "fs";
|
|
111009
|
-
import { basename as basename12, dirname as
|
|
111128
|
+
import { basename as basename12, dirname as dirname33, join as join88 } from "path";
|
|
111010
111129
|
|
|
111011
111130
|
// packages/mcp-client-core/src/config-dir.ts
|
|
111012
|
-
import { existsSync as
|
|
111013
|
-
import { homedir as
|
|
111014
|
-
import { join as
|
|
111131
|
+
import { existsSync as existsSync60, realpathSync as realpathSync8 } from "fs";
|
|
111132
|
+
import { homedir as homedir24 } from "os";
|
|
111133
|
+
import { join as join86, resolve as resolve26 } from "path";
|
|
111015
111134
|
function resolveConfigPath2(pathValue) {
|
|
111016
|
-
const resolvedPath =
|
|
111017
|
-
if (!
|
|
111135
|
+
const resolvedPath = resolve26(pathValue);
|
|
111136
|
+
if (!existsSync60(resolvedPath))
|
|
111018
111137
|
return resolvedPath;
|
|
111019
111138
|
try {
|
|
111020
111139
|
return realpathSync8(resolvedPath);
|
|
@@ -111029,13 +111148,13 @@ function getOpenCodeCliConfigDir(env3 = process.env) {
|
|
|
111029
111148
|
if (customConfigDir) {
|
|
111030
111149
|
return resolveConfigPath2(customConfigDir);
|
|
111031
111150
|
}
|
|
111032
|
-
const xdgConfigDir = env3["XDG_CONFIG_HOME"]?.trim() ||
|
|
111033
|
-
return resolveConfigPath2(
|
|
111151
|
+
const xdgConfigDir = env3["XDG_CONFIG_HOME"]?.trim() || join86(homedir24(), ".config");
|
|
111152
|
+
return resolveConfigPath2(join86(xdgConfigDir, "opencode"));
|
|
111034
111153
|
}
|
|
111035
111154
|
|
|
111036
111155
|
// packages/mcp-client-core/src/mcp-oauth/storage-index.ts
|
|
111037
|
-
import { chmodSync as
|
|
111038
|
-
import { join as
|
|
111156
|
+
import { chmodSync as chmodSync4, existsSync as existsSync61, readFileSync as readFileSync38, renameSync as renameSync6, writeFileSync as writeFileSync11 } from "fs";
|
|
111157
|
+
import { join as join87 } from "path";
|
|
111039
111158
|
var INDEX_FILE_NAME = "index.json";
|
|
111040
111159
|
function isTokenIndex(value) {
|
|
111041
111160
|
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
@@ -111043,14 +111162,14 @@ function isTokenIndex(value) {
|
|
|
111043
111162
|
return Object.values(value).every((entry) => typeof entry === "string");
|
|
111044
111163
|
}
|
|
111045
111164
|
function getIndexPath(storageDir) {
|
|
111046
|
-
return
|
|
111165
|
+
return join87(storageDir, INDEX_FILE_NAME);
|
|
111047
111166
|
}
|
|
111048
111167
|
function readTokenIndex(storageDir) {
|
|
111049
111168
|
const indexPath = getIndexPath(storageDir);
|
|
111050
|
-
if (!
|
|
111169
|
+
if (!existsSync61(indexPath))
|
|
111051
111170
|
return {};
|
|
111052
111171
|
try {
|
|
111053
|
-
const parsed = JSON.parse(
|
|
111172
|
+
const parsed = JSON.parse(readFileSync38(indexPath, "utf-8"));
|
|
111054
111173
|
return isTokenIndex(parsed) ? parsed : {};
|
|
111055
111174
|
} catch (readError) {
|
|
111056
111175
|
if (!(readError instanceof Error))
|
|
@@ -111062,8 +111181,8 @@ function writeTokenIndex(storageDir, index) {
|
|
|
111062
111181
|
try {
|
|
111063
111182
|
const indexPath = getIndexPath(storageDir);
|
|
111064
111183
|
const tempPath = `${indexPath}.tmp.${Date.now()}`;
|
|
111065
|
-
|
|
111066
|
-
|
|
111184
|
+
writeFileSync11(tempPath, JSON.stringify(index, null, 2), { encoding: "utf-8", mode: 384 });
|
|
111185
|
+
chmodSync4(tempPath, 384);
|
|
111067
111186
|
renameSync6(tempPath, indexPath);
|
|
111068
111187
|
return true;
|
|
111069
111188
|
} catch (writeError) {
|
|
@@ -111087,16 +111206,16 @@ function deleteTokenIndexEntry(storageDir, hash2) {
|
|
|
111087
111206
|
var STORAGE_DIR_NAME = "mcp-oauth";
|
|
111088
111207
|
var LEGACY_STORAGE_FILE_NAME = "mcp-oauth.json";
|
|
111089
111208
|
function getMcpOauthStorageDir() {
|
|
111090
|
-
return
|
|
111209
|
+
return join88(getOpenCodeCliConfigDir(), STORAGE_DIR_NAME);
|
|
111091
111210
|
}
|
|
111092
111211
|
function getMcpOauthServerHash(serverHost, resource) {
|
|
111093
111212
|
return createHash6("sha256").update(buildKey(serverHost, resource)).digest("hex").slice(0, 32);
|
|
111094
111213
|
}
|
|
111095
111214
|
function getMcpOauthStoragePath(serverHost, resource) {
|
|
111096
|
-
return
|
|
111215
|
+
return join88(getMcpOauthStorageDir(), `${getMcpOauthServerHash(serverHost, resource)}.json`);
|
|
111097
111216
|
}
|
|
111098
111217
|
function getLegacyStoragePath() {
|
|
111099
|
-
return
|
|
111218
|
+
return join88(getOpenCodeCliConfigDir(), LEGACY_STORAGE_FILE_NAME);
|
|
111100
111219
|
}
|
|
111101
111220
|
function normalizeHost2(serverHost) {
|
|
111102
111221
|
let host = serverHost.trim();
|
|
@@ -111157,10 +111276,10 @@ function isOAuthTokenData(value) {
|
|
|
111157
111276
|
return clientSecret === undefined || typeof clientSecret === "string";
|
|
111158
111277
|
}
|
|
111159
111278
|
function readTokenFile(filePath) {
|
|
111160
|
-
if (!
|
|
111279
|
+
if (!existsSync62(filePath))
|
|
111161
111280
|
return null;
|
|
111162
111281
|
try {
|
|
111163
|
-
const parsed = JSON.parse(
|
|
111282
|
+
const parsed = JSON.parse(readFileSync39(filePath, "utf-8"));
|
|
111164
111283
|
return isOAuthTokenData(parsed) ? parsed : null;
|
|
111165
111284
|
} catch (readError) {
|
|
111166
111285
|
if (!(readError instanceof Error))
|
|
@@ -111170,10 +111289,10 @@ function readTokenFile(filePath) {
|
|
|
111170
111289
|
}
|
|
111171
111290
|
function readLegacyStore() {
|
|
111172
111291
|
const filePath = getLegacyStoragePath();
|
|
111173
|
-
if (!
|
|
111292
|
+
if (!existsSync62(filePath))
|
|
111174
111293
|
return null;
|
|
111175
111294
|
try {
|
|
111176
|
-
const parsed = JSON.parse(
|
|
111295
|
+
const parsed = JSON.parse(readFileSync39(filePath, "utf-8"));
|
|
111177
111296
|
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed))
|
|
111178
111297
|
return null;
|
|
111179
111298
|
const result = {};
|
|
@@ -111190,13 +111309,13 @@ function readLegacyStore() {
|
|
|
111190
111309
|
}
|
|
111191
111310
|
function writeTokenFile(filePath, token) {
|
|
111192
111311
|
try {
|
|
111193
|
-
const dir =
|
|
111194
|
-
if (!
|
|
111195
|
-
|
|
111312
|
+
const dir = dirname33(filePath);
|
|
111313
|
+
if (!existsSync62(dir)) {
|
|
111314
|
+
mkdirSync15(dir, { recursive: true });
|
|
111196
111315
|
}
|
|
111197
111316
|
const tempPath = `${filePath}.tmp.${Date.now()}`;
|
|
111198
|
-
|
|
111199
|
-
|
|
111317
|
+
writeFileSync12(tempPath, JSON.stringify(token, null, 2), { encoding: "utf-8", mode: 384 });
|
|
111318
|
+
chmodSync5(tempPath, 384);
|
|
111200
111319
|
renameSync7(tempPath, filePath);
|
|
111201
111320
|
return true;
|
|
111202
111321
|
} catch (writeError) {
|
|
@@ -111215,7 +111334,7 @@ function saveToken(serverHost, resource, token) {
|
|
|
111215
111334
|
}
|
|
111216
111335
|
function deleteToken(serverHost, resource) {
|
|
111217
111336
|
const filePath = getMcpOauthStoragePath(serverHost, resource);
|
|
111218
|
-
if (!
|
|
111337
|
+
if (!existsSync62(filePath))
|
|
111219
111338
|
return deleteLegacyToken(serverHost, resource);
|
|
111220
111339
|
try {
|
|
111221
111340
|
unlinkSync9(filePath);
|
|
@@ -111237,7 +111356,7 @@ function deleteLegacyToken(serverHost, resource) {
|
|
|
111237
111356
|
if (Object.keys(store2).length === 0) {
|
|
111238
111357
|
try {
|
|
111239
111358
|
const filePath = getLegacyStoragePath();
|
|
111240
|
-
if (
|
|
111359
|
+
if (existsSync62(filePath))
|
|
111241
111360
|
unlinkSync9(filePath);
|
|
111242
111361
|
return true;
|
|
111243
111362
|
} catch (deleteError) {
|
|
@@ -111251,8 +111370,8 @@ function deleteLegacyToken(serverHost, resource) {
|
|
|
111251
111370
|
function writeLegacyStore(store2) {
|
|
111252
111371
|
try {
|
|
111253
111372
|
const filePath = getLegacyStoragePath();
|
|
111254
|
-
|
|
111255
|
-
|
|
111373
|
+
writeFileSync12(filePath, JSON.stringify(store2, null, 2), { encoding: "utf-8", mode: 384 });
|
|
111374
|
+
chmodSync5(filePath, 384);
|
|
111256
111375
|
return true;
|
|
111257
111376
|
} catch (writeError) {
|
|
111258
111377
|
if (!(writeError instanceof Error))
|
|
@@ -111275,7 +111394,7 @@ function listTokensByHost(serverHost) {
|
|
|
111275
111394
|
for (const [hash2, indexedKey] of Object.entries(index)) {
|
|
111276
111395
|
if (!indexedKey.startsWith(prefix))
|
|
111277
111396
|
continue;
|
|
111278
|
-
const indexedToken = readTokenFile(
|
|
111397
|
+
const indexedToken = readTokenFile(join88(getMcpOauthStorageDir(), `${hash2}.json`));
|
|
111279
111398
|
if (indexedToken)
|
|
111280
111399
|
result[indexedKey] = indexedToken;
|
|
111281
111400
|
}
|
|
@@ -111284,13 +111403,13 @@ function listTokensByHost(serverHost) {
|
|
|
111284
111403
|
function listAllTokens() {
|
|
111285
111404
|
const result = { ...readLegacyStore() ?? {} };
|
|
111286
111405
|
const dir = getMcpOauthStorageDir();
|
|
111287
|
-
if (!
|
|
111406
|
+
if (!existsSync62(dir))
|
|
111288
111407
|
return result;
|
|
111289
111408
|
const index = readTokenIndex(dir);
|
|
111290
111409
|
for (const entry of readdirSync11(dir, { withFileTypes: true })) {
|
|
111291
111410
|
if (!entry.isFile() || !entry.name.endsWith(".json") || entry.name === "index.json")
|
|
111292
111411
|
continue;
|
|
111293
|
-
const token = readTokenFile(
|
|
111412
|
+
const token = readTokenFile(join88(dir, entry.name));
|
|
111294
111413
|
const hash2 = basename12(entry.name, ".json");
|
|
111295
111414
|
if (token)
|
|
111296
111415
|
result[index[hash2] ?? hash2] = token;
|
|
@@ -111490,7 +111609,7 @@ function buildAuthorizationUrl(authorizationEndpoint, options) {
|
|
|
111490
111609
|
}
|
|
111491
111610
|
var CALLBACK_TIMEOUT_MS = 5 * 60 * 1000;
|
|
111492
111611
|
function startCallbackServer(port) {
|
|
111493
|
-
return new Promise((
|
|
111612
|
+
return new Promise((resolve27, reject) => {
|
|
111494
111613
|
let timeoutId;
|
|
111495
111614
|
const server2 = createServer2((request, response) => {
|
|
111496
111615
|
clearTimeout(timeoutId);
|
|
@@ -111516,7 +111635,7 @@ function startCallbackServer(port) {
|
|
|
111516
111635
|
response.writeHead(200, { "content-type": "text/html" });
|
|
111517
111636
|
response.end("<html><body><h1>Authorization successful. You can close this tab.</h1></body></html>");
|
|
111518
111637
|
server2.close();
|
|
111519
|
-
|
|
111638
|
+
resolve27({ code, state: state2 });
|
|
111520
111639
|
});
|
|
111521
111640
|
timeoutId = setTimeout(() => {
|
|
111522
111641
|
server2.close();
|
|
@@ -111856,7 +111975,7 @@ function createMcpOAuthCommand() {
|
|
|
111856
111975
|
}
|
|
111857
111976
|
|
|
111858
111977
|
// packages/omo-opencode/src/cli/boulder/boulder.ts
|
|
111859
|
-
import { existsSync as
|
|
111978
|
+
import { existsSync as existsSync63 } from "fs";
|
|
111860
111979
|
|
|
111861
111980
|
// packages/omo-opencode/src/cli/boulder/formatter.ts
|
|
111862
111981
|
var import_picocolors22 = __toESM(require_picocolors(), 1);
|
|
@@ -111993,10 +112112,10 @@ async function boulder(options) {
|
|
|
111993
112112
|
const boulderFilePath = getBoulderFilePath(directory);
|
|
111994
112113
|
const state2 = readBoulderState(directory);
|
|
111995
112114
|
if (!state2) {
|
|
111996
|
-
const message =
|
|
112115
|
+
const message = existsSync63(boulderFilePath) ? formatReadErrorMessage(options.json) : formatNoBoulderMessage(options.json);
|
|
111997
112116
|
process.stderr.write(`${message}
|
|
111998
112117
|
`);
|
|
111999
|
-
return
|
|
112118
|
+
return existsSync63(boulderFilePath) ? 2 : 1;
|
|
112000
112119
|
}
|
|
112001
112120
|
const works = getBoulderWorks(state2);
|
|
112002
112121
|
const filteredWorks = options.workId ? works.filter((work) => work.work_id === options.workId) : works;
|
|
@@ -112014,12 +112133,12 @@ async function boulder(options) {
|
|
|
112014
112133
|
}
|
|
112015
112134
|
// packages/omo-opencode/src/cli/codex-ulw-loop.ts
|
|
112016
112135
|
import { spawn as spawn5 } from "child_process";
|
|
112017
|
-
import { existsSync as
|
|
112018
|
-
import { homedir as
|
|
112136
|
+
import { existsSync as existsSync64, readFileSync as readFileSync40, realpathSync as realpathSync9 } from "fs";
|
|
112137
|
+
import { homedir as homedir25 } from "os";
|
|
112019
112138
|
var ULW_LOOP_DELEGATION_SENTINEL = "OMO_ULW_LOOP_DELEGATED";
|
|
112020
112139
|
function resolveCodexUlwLoopCommand(input = {}) {
|
|
112021
112140
|
const env3 = input.env ?? process.env;
|
|
112022
|
-
const homeDir = input.homeDir ??
|
|
112141
|
+
const homeDir = input.homeDir ?? homedir25();
|
|
112023
112142
|
const localComponentBin = resolveLocalUlwLoopBin(env3, homeDir);
|
|
112024
112143
|
if (localComponentBin !== null)
|
|
112025
112144
|
return { executable: localComponentBin, argsPrefix: [] };
|
|
@@ -112042,29 +112161,29 @@ async function codexUlwLoop(args) {
|
|
|
112042
112161
|
console.error("Codex ulw-loop is not installed. Run: npx lazycodex-ai@latest install --no-tui");
|
|
112043
112162
|
return 1;
|
|
112044
112163
|
}
|
|
112045
|
-
const { promise: promise2, resolve:
|
|
112164
|
+
const { promise: promise2, resolve: resolve27 } = Promise.withResolvers();
|
|
112046
112165
|
const child = spawn5(command.executable, [...command.argsPrefix, ...args], {
|
|
112047
112166
|
stdio: "inherit",
|
|
112048
112167
|
env: { ...process.env, [ULW_LOOP_DELEGATION_SENTINEL]: "1" }
|
|
112049
112168
|
});
|
|
112050
112169
|
child.on("error", (error51) => {
|
|
112051
112170
|
console.error(error51.message);
|
|
112052
|
-
|
|
112171
|
+
resolve27(1);
|
|
112053
112172
|
});
|
|
112054
|
-
child.on("close", (code) =>
|
|
112173
|
+
child.on("close", (code) => resolve27(code ?? 1));
|
|
112055
112174
|
return promise2;
|
|
112056
112175
|
}
|
|
112057
112176
|
function resolveLocalUlwLoopBin(env3, homeDir) {
|
|
112058
112177
|
const candidates = resolveCodexComponentBinCandidates({ executableName: "omo-ulw-loop", env: env3, homeDir });
|
|
112059
|
-
return candidates.find((candidate2) =>
|
|
112178
|
+
return candidates.find((candidate2) => existsSync64(candidate2)) ?? null;
|
|
112060
112179
|
}
|
|
112061
112180
|
function resolveLegacyLocalOmoBin(env3, homeDir, currentExecutablePaths) {
|
|
112062
112181
|
const candidates = resolveCodexComponentBinCandidates({ executableName: "omo", env: env3, homeDir });
|
|
112063
|
-
return candidates.find((candidate2) =>
|
|
112182
|
+
return candidates.find((candidate2) => existsSync64(candidate2) && !isCurrentExecutable(candidate2, currentExecutablePaths) && !isGeneratedRuntimeWrapper(candidate2)) ?? null;
|
|
112064
112183
|
}
|
|
112065
112184
|
function isGeneratedRuntimeWrapper(candidate2) {
|
|
112066
112185
|
try {
|
|
112067
|
-
return
|
|
112186
|
+
return readFileSync40(candidate2, "utf8").includes(RUNTIME_WRAPPER_MARKER);
|
|
112068
112187
|
} catch (error51) {
|
|
112069
112188
|
if (error51 instanceof Error)
|
|
112070
112189
|
return false;
|