oh-my-openagent 5.1.0 → 5.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.js +672 -464
- package/dist/cli-node/index.js +672 -464
- package/dist/index.js +61 -21
- package/dist/skills/browser/runtime/omowright/manifest.json +1 -1
- package/dist/tui.js +55 -18
- package/package.json +14 -14
- package/packages/omo-codex/plugin/.codex-plugin/plugin.json +1 -1
- package/packages/omo-codex/plugin/components/bootstrap/dist/cli.js +315 -154
- 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/bootstrap/src/setup.ts +7 -4
- 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 +2 -2
- 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/teammode/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/teammode/package.json +1 -1
- 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-execute-continuation/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/ulw-execute-continuation/package.json +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/hooks/hooks.json +5 -5
- 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-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/post-tool-use-recording-spawn-admission.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-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-ulw-execute-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-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 +12 -12
- package/packages/omo-codex/plugin/package.json +1 -1
- package/packages/omo-codex/plugin/skills/browser/runtime/omowright/manifest.json +1 -1
- package/packages/omo-codex/scripts/install-dist/install-local.mjs +10441 -10269
- package/packages/shared-skills/skills/browser/runtime/omowright/manifest.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -64,7 +64,7 @@ var package_default;
|
|
|
64
64
|
var init_package = __esm(() => {
|
|
65
65
|
package_default = {
|
|
66
66
|
name: "oh-my-opencode",
|
|
67
|
-
version: "5.1.
|
|
67
|
+
version: "5.1.1",
|
|
68
68
|
description: "The Best AI Agent Harness - Batteries-Included OpenCode Plugin with Multi-Model Orchestration, Parallel Background Agents, and Crafted LSP/AST Tools",
|
|
69
69
|
main: "./dist/index.js",
|
|
70
70
|
types: "dist/index.d.ts",
|
|
@@ -253,7 +253,7 @@ var init_package = __esm(() => {
|
|
|
253
253
|
zod: "^4.6.5"
|
|
254
254
|
},
|
|
255
255
|
devDependencies: {
|
|
256
|
-
"@code-yeongyu/senpi": "2026.9.
|
|
256
|
+
"@code-yeongyu/senpi": "2026.9.29",
|
|
257
257
|
"@oh-my-opencode/agents-md-core": "workspace:*",
|
|
258
258
|
"@oh-my-opencode/ast-grep-mcp": "workspace:*",
|
|
259
259
|
"@oh-my-opencode/boulder-state": "workspace:*",
|
|
@@ -299,18 +299,18 @@ var init_package = __esm(() => {
|
|
|
299
299
|
typescript: "^7.0.2"
|
|
300
300
|
},
|
|
301
301
|
optionalDependencies: {
|
|
302
|
-
"oh-my-opencode-darwin-arm64": "5.1.
|
|
303
|
-
"oh-my-opencode-darwin-x64": "5.1.
|
|
304
|
-
"oh-my-opencode-darwin-x64-baseline": "5.1.
|
|
305
|
-
"oh-my-opencode-linux-arm64": "5.1.
|
|
306
|
-
"oh-my-opencode-linux-arm64-musl": "5.1.
|
|
307
|
-
"oh-my-opencode-linux-x64": "5.1.
|
|
308
|
-
"oh-my-opencode-linux-x64-baseline": "5.1.
|
|
309
|
-
"oh-my-opencode-linux-x64-musl": "5.1.
|
|
310
|
-
"oh-my-opencode-linux-x64-musl-baseline": "5.1.
|
|
311
|
-
"oh-my-opencode-windows-arm64": "5.1.
|
|
312
|
-
"oh-my-opencode-windows-x64": "5.1.
|
|
313
|
-
"oh-my-opencode-windows-x64-baseline": "5.1.
|
|
302
|
+
"oh-my-opencode-darwin-arm64": "5.1.1",
|
|
303
|
+
"oh-my-opencode-darwin-x64": "5.1.1",
|
|
304
|
+
"oh-my-opencode-darwin-x64-baseline": "5.1.1",
|
|
305
|
+
"oh-my-opencode-linux-arm64": "5.1.1",
|
|
306
|
+
"oh-my-opencode-linux-arm64-musl": "5.1.1",
|
|
307
|
+
"oh-my-opencode-linux-x64": "5.1.1",
|
|
308
|
+
"oh-my-opencode-linux-x64-baseline": "5.1.1",
|
|
309
|
+
"oh-my-opencode-linux-x64-musl": "5.1.1",
|
|
310
|
+
"oh-my-opencode-linux-x64-musl-baseline": "5.1.1",
|
|
311
|
+
"oh-my-opencode-windows-arm64": "5.1.1",
|
|
312
|
+
"oh-my-opencode-windows-x64": "5.1.1",
|
|
313
|
+
"oh-my-opencode-windows-x64-baseline": "5.1.1"
|
|
314
314
|
},
|
|
315
315
|
overrides: {
|
|
316
316
|
"@earendil-works/pi-agent-core": "0.84.2",
|
|
@@ -7396,12 +7396,12 @@ var init_category_model_requirements = __esm(() => {
|
|
|
7396
7396
|
},
|
|
7397
7397
|
"deep-low": {
|
|
7398
7398
|
fallbackChain: [
|
|
7399
|
-
{ providers: ["openai", "chatgpt-subscription"], model: "gpt-5.6-sol-fast", variant: "medium" },
|
|
7400
7399
|
{
|
|
7401
7400
|
providers: ["openai", "chatgpt-subscription", "github-copilot", "opencode"],
|
|
7402
7401
|
model: "gpt-5.6-sol",
|
|
7403
7402
|
variant: "medium"
|
|
7404
|
-
}
|
|
7403
|
+
},
|
|
7404
|
+
{ providers: ["openai", "chatgpt-subscription"], model: "gpt-5.6-sol-fast", variant: "medium" }
|
|
7405
7405
|
]
|
|
7406
7406
|
},
|
|
7407
7407
|
"deep-high": {
|
|
@@ -7453,6 +7453,11 @@ var init_category_model_requirements = __esm(() => {
|
|
|
7453
7453
|
},
|
|
7454
7454
|
"unspecified-low": {
|
|
7455
7455
|
fallbackChain: [
|
|
7456
|
+
{
|
|
7457
|
+
providers: ["anthropic", "anthropic-api", "github-copilot", "opencode"],
|
|
7458
|
+
model: "claude-sonnet-5-5",
|
|
7459
|
+
variant: "medium"
|
|
7460
|
+
},
|
|
7456
7461
|
{ providers: ["xiaomi", "opencode-go"], model: "mimo-v2.6-pro", variant: "max" },
|
|
7457
7462
|
{ providers: ["xai", "github-copilot", "opencode-go"], model: "grok-4.7", variant: "xhigh" },
|
|
7458
7463
|
{
|
|
@@ -8389,6 +8394,36 @@ var init_supplemental_entries = __esm(() => {
|
|
|
8389
8394
|
output: 32768
|
|
8390
8395
|
}
|
|
8391
8396
|
},
|
|
8397
|
+
"claude-sonnet-5-5": {
|
|
8398
|
+
id: "claude-sonnet-5-5",
|
|
8399
|
+
family: "claude-sonnet",
|
|
8400
|
+
reasoning: true,
|
|
8401
|
+
temperature: false,
|
|
8402
|
+
toolCall: true,
|
|
8403
|
+
modalities: {
|
|
8404
|
+
input: ["text", "image", "pdf"],
|
|
8405
|
+
output: ["text"]
|
|
8406
|
+
},
|
|
8407
|
+
limit: {
|
|
8408
|
+
context: 1e6,
|
|
8409
|
+
output: 128000
|
|
8410
|
+
}
|
|
8411
|
+
},
|
|
8412
|
+
"anthropic/claude-sonnet-5-5": {
|
|
8413
|
+
id: "anthropic/claude-sonnet-5-5",
|
|
8414
|
+
family: "claude-sonnet",
|
|
8415
|
+
reasoning: true,
|
|
8416
|
+
temperature: false,
|
|
8417
|
+
toolCall: true,
|
|
8418
|
+
modalities: {
|
|
8419
|
+
input: ["text", "image", "pdf"],
|
|
8420
|
+
output: ["text"]
|
|
8421
|
+
},
|
|
8422
|
+
limit: {
|
|
8423
|
+
context: 1e6,
|
|
8424
|
+
output: 128000
|
|
8425
|
+
}
|
|
8426
|
+
},
|
|
8392
8427
|
"grok-4.7": {
|
|
8393
8428
|
id: "grok-4.7",
|
|
8394
8429
|
family: "grok",
|
|
@@ -9434,7 +9469,7 @@ var init_openai_categories = __esm(() => {
|
|
|
9434
9469
|
},
|
|
9435
9470
|
{
|
|
9436
9471
|
name: "deep-low",
|
|
9437
|
-
config: { model: "openai/gpt-5.6-sol
|
|
9472
|
+
config: { model: "openai/gpt-5.6-sol", variant: "medium" },
|
|
9438
9473
|
description: "Default deep lane: one goal, one deliverable, decisions the child can settle from what it reads. **3D graphics, computer/browser use, CAPTCHA, multimodal, backend, logic, and algorithm work is routed here.** Multiple goals fan out as parallel calls.",
|
|
9439
9474
|
callerGuidance: DEEP_LOW_CATEGORY_CALLER_GUIDANCE,
|
|
9440
9475
|
promptAppend: DEEP_LOW_CATEGORY_PROMPT_APPEND,
|
|
@@ -9459,7 +9494,7 @@ var init_openai_categories = __esm(() => {
|
|
|
9459
9494
|
},
|
|
9460
9495
|
{
|
|
9461
9496
|
name: "unspecified-low",
|
|
9462
|
-
config: { model: "
|
|
9497
|
+
config: { model: "anthropic/claude-sonnet-5-5", variant: "medium" },
|
|
9463
9498
|
description: "Tasks that don't fit other categories, low effort required",
|
|
9464
9499
|
callerGuidance: UNSPECIFIED_LOW_CATEGORY_CALLER_GUIDANCE,
|
|
9465
9500
|
promptAppend: UNSPECIFIED_LOW_CATEGORY_PROMPT_APPEND
|
|
@@ -74702,6 +74737,7 @@ var init_task = __esm(() => {
|
|
|
74702
74737
|
process_runner: _enum(["host", "child-process"]).default("host"),
|
|
74703
74738
|
host_engine_policy: _enum(["upgrade", "fallback"]).default("upgrade"),
|
|
74704
74739
|
host_idle_exit_ms: number2().int().positive().optional(),
|
|
74740
|
+
host_shard_prewarm: _enum(["off", "first-turn", "session-start"]).default("first-turn"),
|
|
74705
74741
|
default_concurrency: number2().int().nonnegative().default(5),
|
|
74706
74742
|
global_concurrency: number2().int().nonnegative().default(8),
|
|
74707
74743
|
provider_concurrency: record(string2(), number2().int().nonnegative()).optional(),
|
|
@@ -74751,6 +74787,7 @@ var init_task = __esm(() => {
|
|
|
74751
74787
|
process_runner: _enum(["host", "child-process"]).optional(),
|
|
74752
74788
|
host_engine_policy: _enum(["upgrade", "fallback"]).optional(),
|
|
74753
74789
|
host_idle_exit_ms: number2().int().positive().optional(),
|
|
74790
|
+
host_shard_prewarm: _enum(["off", "first-turn", "session-start"]).optional(),
|
|
74754
74791
|
default_concurrency: number2().int().nonnegative().optional(),
|
|
74755
74792
|
global_concurrency: number2().int().nonnegative().optional(),
|
|
74756
74793
|
provider_concurrency: record(string2(), number2().int().nonnegative()).optional(),
|
|
@@ -79111,9 +79148,9 @@ function extractChannel(version) {
|
|
|
79111
79148
|
|
|
79112
79149
|
// packages/telemetry-core/src/day-claim.ts
|
|
79113
79150
|
import { closeSync as closeSync3, mkdirSync as mkdirSync9, openSync as openSync3, readdirSync as readdirSync8, rmSync as rmSync3 } from "fs";
|
|
79114
|
-
import { join as
|
|
79151
|
+
import { join as join53 } from "path";
|
|
79115
79152
|
function getTelemetryDayClaimFilePath(stateDir, dayUTC) {
|
|
79116
|
-
return
|
|
79153
|
+
return join53(stateDir, `${CLAIM_PREFIX}${dayUTC}${CLAIM_SUFFIX}`);
|
|
79117
79154
|
}
|
|
79118
79155
|
function claimUtcDay(stateDir, dayUTC) {
|
|
79119
79156
|
try {
|
|
@@ -79139,7 +79176,7 @@ function pruneSupersededClaims(stateDir, dayUTC) {
|
|
|
79139
79176
|
if (!entry.startsWith(CLAIM_PREFIX) || !entry.endsWith(CLAIM_SUFFIX))
|
|
79140
79177
|
continue;
|
|
79141
79178
|
try {
|
|
79142
|
-
rmSync3(
|
|
79179
|
+
rmSync3(join53(stateDir, entry), { force: true });
|
|
79143
79180
|
} catch {}
|
|
79144
79181
|
}
|
|
79145
79182
|
}
|
|
@@ -79148,20 +79185,20 @@ var init_day_claim = () => {};
|
|
|
79148
79185
|
|
|
79149
79186
|
// packages/telemetry-core/src/activity-state.ts
|
|
79150
79187
|
import { existsSync as existsSync25, mkdirSync as mkdirSync10, readFileSync as readFileSync12 } from "fs";
|
|
79151
|
-
import { basename as basename9, join as
|
|
79188
|
+
import { basename as basename9, join as join54 } from "path";
|
|
79152
79189
|
function resolveTelemetryStateDir(product, options = {}) {
|
|
79153
79190
|
const dataDir = resolveXdgDataDir(product.cacheDirName, {
|
|
79154
79191
|
env: options.env,
|
|
79155
79192
|
osProvider: options.osProvider
|
|
79156
79193
|
});
|
|
79157
|
-
const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined :
|
|
79194
|
+
const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined : join54(options.env.XDG_DATA_HOME, product.cacheDirName);
|
|
79158
79195
|
if (dataDir === xdgStateDir || xdgStateDir === undefined && basename9(dataDir) === product.cacheDirName) {
|
|
79159
79196
|
return dataDir;
|
|
79160
79197
|
}
|
|
79161
|
-
return
|
|
79198
|
+
return join54(dataDir, product.cacheDirName);
|
|
79162
79199
|
}
|
|
79163
79200
|
function getTelemetryActivityStateFilePath(stateDir) {
|
|
79164
|
-
return
|
|
79201
|
+
return join54(stateDir, POSTHOG_ACTIVITY_STATE_FILE);
|
|
79165
79202
|
}
|
|
79166
79203
|
function getDailyActiveCaptureState(input) {
|
|
79167
79204
|
const dayUTC = getUtcDayString(input.now ?? new Date);
|
|
@@ -79242,9 +79279,9 @@ var DEFAULT_POSTHOG_HOST = "https://us.i.posthog.com", DEFAULT_POSTHOG_API_KEY =
|
|
|
79242
79279
|
|
|
79243
79280
|
// packages/telemetry-core/src/diagnostics.ts
|
|
79244
79281
|
import { appendFileSync as appendFileSync2, existsSync as existsSync26, mkdirSync as mkdirSync11, readFileSync as readFileSync13 } from "fs";
|
|
79245
|
-
import { join as
|
|
79282
|
+
import { join as join55 } from "path";
|
|
79246
79283
|
function getTelemetryDiagnosticsFilePath(diagnosticsDir) {
|
|
79247
|
-
return
|
|
79284
|
+
return join55(diagnosticsDir, DIAGNOSTICS_FILE_NAME);
|
|
79248
79285
|
}
|
|
79249
79286
|
function writeTelemetryDiagnostic(input, options) {
|
|
79250
79287
|
const now = options.now ?? new Date;
|
|
@@ -88987,7 +89024,7 @@ var package_default2;
|
|
|
88987
89024
|
var init_package2 = __esm(() => {
|
|
88988
89025
|
package_default2 = {
|
|
88989
89026
|
name: "@oh-my-opencode/omo-codex",
|
|
88990
|
-
version: "5.1.
|
|
89027
|
+
version: "5.1.1",
|
|
88991
89028
|
type: "module",
|
|
88992
89029
|
private: true,
|
|
88993
89030
|
description: "Codex harness adapter for oh-my-openagent. Vendored Codex plugin namespace (omo) + TypeScript installer + telemetry.",
|
|
@@ -89959,7 +89996,7 @@ var init_update_toasts = __esm(() => {
|
|
|
89959
89996
|
|
|
89960
89997
|
// packages/omo-opencode/src/hooks/auto-update-checker/hook/background-update-check.ts
|
|
89961
89998
|
import { existsSync as existsSync48 } from "fs";
|
|
89962
|
-
import { dirname as dirname32, join as
|
|
89999
|
+
import { dirname as dirname32, join as join79 } from "path";
|
|
89963
90000
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
89964
90001
|
function defaultGetModuleHostingWorkspace() {
|
|
89965
90002
|
try {
|
|
@@ -90119,7 +90156,7 @@ var init_background_update_check = __esm(() => {
|
|
|
90119
90156
|
init_update_toasts();
|
|
90120
90157
|
defaultDeps4 = {
|
|
90121
90158
|
existsSync: existsSync48,
|
|
90122
|
-
join:
|
|
90159
|
+
join: join79,
|
|
90123
90160
|
runBunInstallWithDetails,
|
|
90124
90161
|
log: log2,
|
|
90125
90162
|
getOpenCodeCacheDir,
|
|
@@ -92575,19 +92612,7 @@ function getUnsupportedOpenCodeVersionMessage(openCodeVersion) {
|
|
|
92575
92612
|
}
|
|
92576
92613
|
|
|
92577
92614
|
// packages/omo-codex/src/install/install-codex.ts
|
|
92578
|
-
import { join as
|
|
92579
|
-
|
|
92580
|
-
// packages/omo-codex/src/install/codex-default-role-config.ts
|
|
92581
|
-
init_src4();
|
|
92582
|
-
function readDefaultRoleConfig(options = {}) {
|
|
92583
|
-
const result = loadOmoConfig({ ...options, harness: "codex" });
|
|
92584
|
-
return {
|
|
92585
|
-
enabled: result.config.agents?.default?.disable !== true,
|
|
92586
|
-
warnings: result.diagnostics.map((diagnostic) => diagnostic.message)
|
|
92587
|
-
};
|
|
92588
|
-
}
|
|
92589
|
-
|
|
92590
|
-
// packages/omo-codex/src/install/install-codex.ts
|
|
92615
|
+
import { join as join56, resolve as resolve13 } from "path";
|
|
92591
92616
|
import { existsSync as existsSync27 } from "fs";
|
|
92592
92617
|
import { homedir as homedir6 } from "os";
|
|
92593
92618
|
|
|
@@ -95488,13 +95513,126 @@ function toCodexResolution(resolution) {
|
|
|
95488
95513
|
};
|
|
95489
95514
|
}
|
|
95490
95515
|
|
|
95516
|
+
// packages/omo-codex/src/install/codex-agent-config.ts
|
|
95517
|
+
init_src4();
|
|
95518
|
+
init_reasoning_vocabulary();
|
|
95519
|
+
function readCodexAgentConfig(options = {}) {
|
|
95520
|
+
const result = loadOmoConfig({ ...options, harness: "codex" });
|
|
95521
|
+
const overrides = readAgentOverrides(result);
|
|
95522
|
+
return {
|
|
95523
|
+
defaultRoleEnabled: result.config.agents?.default?.disable !== true,
|
|
95524
|
+
agentOverrides: overrides.agentOverrides,
|
|
95525
|
+
warnings: [...result.diagnostics.map((diagnostic) => diagnostic.message), ...overrides.warnings]
|
|
95526
|
+
};
|
|
95527
|
+
}
|
|
95528
|
+
function unmanagedAgentOverrideWarnings(agentOverrides, managedAgentNames) {
|
|
95529
|
+
return [...agentOverrides.keys()].filter((name) => !managedAgentNames.has(name)).map((name) => `[codex].agents.${name} does not name a LazyCodex-managed agent role; its model override was not applied`);
|
|
95530
|
+
}
|
|
95531
|
+
function readAgentOverrides(result) {
|
|
95532
|
+
let merged = {};
|
|
95533
|
+
for (const layer of result.layers)
|
|
95534
|
+
merged = mergeOmoConfigRecords(merged, layer.config);
|
|
95535
|
+
const profile = result.profile === undefined ? undefined : recordAt2(recordAt2(merged, "profiles"), result.profile);
|
|
95536
|
+
let agents = {};
|
|
95537
|
+
for (const scope of [merged, profile]) {
|
|
95538
|
+
agents = mergeOmoConfigRecords(agents, recordAt2(recordAt2(scope, "[codex]"), "agents") ?? {});
|
|
95539
|
+
}
|
|
95540
|
+
const agentOverrides = new Map;
|
|
95541
|
+
const warnings = [];
|
|
95542
|
+
for (const [name, value] of Object.entries(agents)) {
|
|
95543
|
+
if (name === "default")
|
|
95544
|
+
continue;
|
|
95545
|
+
const parsed = OmoAgentDefSchema.safeParse(value);
|
|
95546
|
+
if (!parsed.success) {
|
|
95547
|
+
warnings.push(`[codex].agents.${name} is invalid and was ignored: ${parsed.error.issues[0]?.message ?? "unknown error"}`);
|
|
95548
|
+
continue;
|
|
95549
|
+
}
|
|
95550
|
+
const override = toCodexAgentOverride(parsed.data.model, parsed.data.reasoning);
|
|
95551
|
+
if (override.model !== undefined || override.reasoningEffort !== undefined)
|
|
95552
|
+
agentOverrides.set(name, override);
|
|
95553
|
+
}
|
|
95554
|
+
return { agentOverrides, warnings };
|
|
95555
|
+
}
|
|
95556
|
+
function toCodexAgentOverride(model, reasoning) {
|
|
95557
|
+
const split = model === undefined ? undefined : splitReasoningSuffix2(model);
|
|
95558
|
+
const effort = codexReasoningEffort(reasoning ?? split?.level);
|
|
95559
|
+
return {
|
|
95560
|
+
...split === undefined || split.base === "" ? {} : { model: split.base },
|
|
95561
|
+
...effort === undefined ? {} : { reasoningEffort: effort }
|
|
95562
|
+
};
|
|
95563
|
+
}
|
|
95564
|
+
function codexReasoningEffort(reasoning) {
|
|
95565
|
+
if (reasoning === undefined || reasoning === "auto")
|
|
95566
|
+
return;
|
|
95567
|
+
return reasoning === "off" ? "none" : reasoning;
|
|
95568
|
+
}
|
|
95569
|
+
function recordAt2(value, key) {
|
|
95570
|
+
if (!isPlainRecord4(value))
|
|
95571
|
+
return;
|
|
95572
|
+
const child = value[key];
|
|
95573
|
+
return isPlainRecord4(child) ? child : undefined;
|
|
95574
|
+
}
|
|
95575
|
+
|
|
95576
|
+
// packages/omo-codex/src/install/codex-marketplace-snapshot.ts
|
|
95577
|
+
import { cp as cp3, mkdir as mkdir6, rename as rename4, rm as rm7, writeFile as writeFile6 } from "fs/promises";
|
|
95578
|
+
import { join as join39, sep as sep6 } from "path";
|
|
95579
|
+
var INSTALLED_MARKETPLACES_DIR = ".tmp/marketplaces";
|
|
95580
|
+
async function writeInstalledMarketplaceSnapshot(input) {
|
|
95581
|
+
const marketplaceRoot = installedMarketplaceRoot(input.codexHome, input.marketplace.name);
|
|
95582
|
+
await mkdir6(marketplaceRoot, { recursive: true });
|
|
95583
|
+
await writeMarketplaceManifest(marketplaceRoot, input.marketplace);
|
|
95584
|
+
const snapshotPlugins = [];
|
|
95585
|
+
for (const plugin of input.plugins) {
|
|
95586
|
+
snapshotPlugins.push(await writeSnapshotPlugin(marketplaceRoot, plugin));
|
|
95587
|
+
}
|
|
95588
|
+
return snapshotPlugins;
|
|
95589
|
+
}
|
|
95590
|
+
function installedMarketplaceRoot(codexHome, marketplaceName) {
|
|
95591
|
+
return join39(codexHome, INSTALLED_MARKETPLACES_DIR, marketplaceName);
|
|
95592
|
+
}
|
|
95593
|
+
async function writeMarketplaceManifest(marketplaceRoot, marketplace) {
|
|
95594
|
+
const manifestDir = join39(marketplaceRoot, ".agents", "plugins");
|
|
95595
|
+
await mkdir6(manifestDir, { recursive: true });
|
|
95596
|
+
const tempPath = join39(manifestDir, `.marketplace-${process.pid}-${Date.now()}.json.tmp`);
|
|
95597
|
+
await writeFile6(tempPath, `${JSON.stringify(marketplace, null, "\t")}
|
|
95598
|
+
`);
|
|
95599
|
+
await rename4(tempPath, join39(manifestDir, "marketplace.json"));
|
|
95600
|
+
}
|
|
95601
|
+
async function writeSnapshotPlugin(marketplaceRoot, plugin) {
|
|
95602
|
+
const pluginsDir = join39(marketplaceRoot, "plugins");
|
|
95603
|
+
await mkdir6(pluginsDir, { recursive: true });
|
|
95604
|
+
const targetPath = join39(pluginsDir, plugin.name);
|
|
95605
|
+
const tempPath = join39(pluginsDir, `.tmp-${plugin.name}-${process.pid}-${Date.now()}`);
|
|
95606
|
+
await rm7(tempPath, { recursive: true, force: true });
|
|
95607
|
+
await cp3(plugin.sourcePath, tempPath, {
|
|
95608
|
+
recursive: true,
|
|
95609
|
+
filter: (source) => shouldCopyMarketplaceSourcePath(source, plugin.sourcePath)
|
|
95610
|
+
});
|
|
95611
|
+
await copyBundledMcpRuntimeDists({ pluginRoot: tempPath, sourceRoot: plugin.sourcePath });
|
|
95612
|
+
await rm7(targetPath, { recursive: true, force: true });
|
|
95613
|
+
await rename4(tempPath, targetPath);
|
|
95614
|
+
await rewriteCachedMcpManifest(targetPath, plugin.sourcePath);
|
|
95615
|
+
return { name: plugin.name, path: targetPath };
|
|
95616
|
+
}
|
|
95617
|
+
function shouldCopyMarketplaceSourcePath(path, root) {
|
|
95618
|
+
const relative = path === root ? "" : path.slice(root.length + sep6.length);
|
|
95619
|
+
if (relative === "")
|
|
95620
|
+
return true;
|
|
95621
|
+
const parts = relative.split(sep6);
|
|
95622
|
+
return !parts.some((part) => part === ".git" || part === "node_modules");
|
|
95623
|
+
}
|
|
95624
|
+
|
|
95491
95625
|
// packages/omo-codex/src/install/link-cached-plugin-agents.ts
|
|
95492
|
-
import { copyFile, lstat as lstat10, mkdir as
|
|
95493
|
-
import { basename as basename7, join as
|
|
95626
|
+
import { copyFile, lstat as lstat10, mkdir as mkdir7, readdir as readdir7, readFile as readFile17, rm as rm11, writeFile as writeFile9 } from "fs/promises";
|
|
95627
|
+
import { basename as basename7, join as join44 } from "path";
|
|
95628
|
+
|
|
95629
|
+
// packages/omo-codex/src/install/agent-model-overrides.ts
|
|
95630
|
+
import { readFile as readFile14, rm as rm8, writeFile as writeFile8 } from "fs/promises";
|
|
95631
|
+
import { join as join41 } from "path";
|
|
95494
95632
|
|
|
95495
95633
|
// packages/omo-codex/src/install/preserved-agent-settings.ts
|
|
95496
|
-
import { lstat as lstat7, readFile as readFile13, readdir as readdir6, writeFile as
|
|
95497
|
-
import { join as
|
|
95634
|
+
import { lstat as lstat7, readFile as readFile13, readdir as readdir6, writeFile as writeFile7 } from "fs/promises";
|
|
95635
|
+
import { join as join40 } from "path";
|
|
95498
95636
|
|
|
95499
95637
|
// packages/omo-codex/src/install/managed-agent-reasoning-defaults.ts
|
|
95500
95638
|
var MANAGED_REASONING_DEFAULT_UPGRADES = new Map([
|
|
@@ -95687,7 +95825,7 @@ function resolveManagedAgentReasoning(input) {
|
|
|
95687
95825
|
|
|
95688
95826
|
// packages/omo-codex/src/install/preserved-agent-settings.ts
|
|
95689
95827
|
async function capturePreservedAgentReasoning(input) {
|
|
95690
|
-
const agentsDir =
|
|
95828
|
+
const agentsDir = join40(input.codexHome, "agents");
|
|
95691
95829
|
if (!await exists2(agentsDir))
|
|
95692
95830
|
return new Map;
|
|
95693
95831
|
const preserved = new Map;
|
|
@@ -95695,7 +95833,7 @@ async function capturePreservedAgentReasoning(input) {
|
|
|
95695
95833
|
for (const entry of agentEntries) {
|
|
95696
95834
|
if (!entry.name.endsWith(".toml"))
|
|
95697
95835
|
continue;
|
|
95698
|
-
const content = await readTextIfExists(
|
|
95836
|
+
const content = await readTextIfExists(join40(agentsDir, entry.name));
|
|
95699
95837
|
if (content === null)
|
|
95700
95838
|
continue;
|
|
95701
95839
|
const effort = extractReasoningEffort(content);
|
|
@@ -95709,7 +95847,7 @@ async function capturePreservedAgentReasoning(input) {
|
|
|
95709
95847
|
return preserved;
|
|
95710
95848
|
}
|
|
95711
95849
|
async function capturePreservedAgentServiceTier(input) {
|
|
95712
|
-
const agentsDir =
|
|
95850
|
+
const agentsDir = join40(input.codexHome, "agents");
|
|
95713
95851
|
if (!await exists2(agentsDir))
|
|
95714
95852
|
return new Map;
|
|
95715
95853
|
const preserved = new Map;
|
|
@@ -95717,7 +95855,7 @@ async function capturePreservedAgentServiceTier(input) {
|
|
|
95717
95855
|
for (const entry of agentEntries) {
|
|
95718
95856
|
if (!entry.name.endsWith(".toml"))
|
|
95719
95857
|
continue;
|
|
95720
|
-
const content = await readTextIfExists(
|
|
95858
|
+
const content = await readTextIfExists(join40(agentsDir, entry.name));
|
|
95721
95859
|
if (content === null)
|
|
95722
95860
|
continue;
|
|
95723
95861
|
preserved.set(agentNameFromToml(entry.name), extractServiceTier(content));
|
|
@@ -95740,7 +95878,7 @@ async function restorePreservedReasoning(input) {
|
|
|
95740
95878
|
const replacement = replaceTopLevelStringSetting(content, "model_reasoning_effort", effort, { insertIfMissing: false });
|
|
95741
95879
|
if (!replacement.replaced)
|
|
95742
95880
|
return;
|
|
95743
|
-
await
|
|
95881
|
+
await writeFile7(input.linkPath, replacement.content);
|
|
95744
95882
|
}
|
|
95745
95883
|
async function restorePreservedServiceTier(input) {
|
|
95746
95884
|
if (!input.preserved)
|
|
@@ -95751,7 +95889,18 @@ async function restorePreservedServiceTier(input) {
|
|
|
95751
95889
|
const replacement = replaceTopLevelStringSetting(content, "service_tier", input.value, { insertIfMissing: true });
|
|
95752
95890
|
if (!replacement.replaced)
|
|
95753
95891
|
return;
|
|
95754
|
-
await
|
|
95892
|
+
await writeFile7(input.linkPath, replacement.content);
|
|
95893
|
+
}
|
|
95894
|
+
async function restorePreservedModel(input) {
|
|
95895
|
+
if (input.value === null)
|
|
95896
|
+
return;
|
|
95897
|
+
const content = await readFile13(input.linkPath, "utf8");
|
|
95898
|
+
if (extractModel(content) === input.value)
|
|
95899
|
+
return;
|
|
95900
|
+
const replacement = replaceTopLevelStringSetting(content, "model", input.value, { insertIfMissing: true });
|
|
95901
|
+
if (!replacement.replaced)
|
|
95902
|
+
return;
|
|
95903
|
+
await writeFile7(input.linkPath, replacement.content);
|
|
95755
95904
|
}
|
|
95756
95905
|
async function readTextIfExists(path) {
|
|
95757
95906
|
try {
|
|
@@ -95849,9 +95998,86 @@ function nodeErrorCode(error) {
|
|
|
95849
95998
|
return typeof error.code === "string" ? error.code : null;
|
|
95850
95999
|
}
|
|
95851
96000
|
|
|
96001
|
+
// packages/omo-codex/src/install/agent-model-overrides.ts
|
|
96002
|
+
var RECEIPT_FILE = ".lazycodex-agent-models.json";
|
|
96003
|
+
async function readAgentModelReceipts(codexHome) {
|
|
96004
|
+
const content = await readTextIfExists(receiptPath(codexHome));
|
|
96005
|
+
if (content === null)
|
|
96006
|
+
return new Map;
|
|
96007
|
+
const parsed = parseJson(content);
|
|
96008
|
+
if (!isPlainRecord4(parsed))
|
|
96009
|
+
return new Map;
|
|
96010
|
+
const receipts = new Map;
|
|
96011
|
+
for (const [name, value] of Object.entries(parsed)) {
|
|
96012
|
+
if (!isPlainRecord4(value))
|
|
96013
|
+
continue;
|
|
96014
|
+
const model = value["model"];
|
|
96015
|
+
const reasoningEffort = value["reasoningEffort"];
|
|
96016
|
+
receipts.set(name, {
|
|
96017
|
+
...typeof model === "string" ? { model } : {},
|
|
96018
|
+
...typeof reasoningEffort === "string" ? { reasoningEffort } : {}
|
|
96019
|
+
});
|
|
96020
|
+
}
|
|
96021
|
+
return receipts;
|
|
96022
|
+
}
|
|
96023
|
+
async function writeAgentModelReceipts(codexHome, receipts) {
|
|
96024
|
+
const path = receiptPath(codexHome);
|
|
96025
|
+
if (receipts.size === 0) {
|
|
96026
|
+
await rm8(path, { force: true });
|
|
96027
|
+
return;
|
|
96028
|
+
}
|
|
96029
|
+
await writeFile8(path, `${JSON.stringify(Object.fromEntries(receipts), null, "\t")}
|
|
96030
|
+
`);
|
|
96031
|
+
}
|
|
96032
|
+
async function applyAgentOverride(input) {
|
|
96033
|
+
if (input.override === undefined)
|
|
96034
|
+
return;
|
|
96035
|
+
let content = await readFile14(input.linkPath, "utf8");
|
|
96036
|
+
if (input.override.model !== undefined) {
|
|
96037
|
+
content = replaceTopLevelStringSetting(content, "model", input.override.model, { insertIfMissing: true }).content;
|
|
96038
|
+
}
|
|
96039
|
+
if (input.override.reasoningEffort !== undefined) {
|
|
96040
|
+
content = replaceTopLevelStringSetting(content, "model_reasoning_effort", input.override.reasoningEffort, {
|
|
96041
|
+
insertIfMissing: true
|
|
96042
|
+
}).content;
|
|
96043
|
+
}
|
|
96044
|
+
await writeFile8(input.linkPath, content);
|
|
96045
|
+
}
|
|
96046
|
+
function receiptPath(codexHome) {
|
|
96047
|
+
return join41(codexHome, "agents", RECEIPT_FILE);
|
|
96048
|
+
}
|
|
96049
|
+
function parseJson(content) {
|
|
96050
|
+
try {
|
|
96051
|
+
return JSON.parse(content);
|
|
96052
|
+
} catch (error) {
|
|
96053
|
+
if (error instanceof SyntaxError)
|
|
96054
|
+
return null;
|
|
96055
|
+
throw error;
|
|
96056
|
+
}
|
|
96057
|
+
}
|
|
96058
|
+
|
|
96059
|
+
// packages/omo-codex/src/install/managed-agent-model-defaults.ts
|
|
96060
|
+
var PREVIOUSLY_BUNDLED_AGENT_MODELS = new Set([
|
|
96061
|
+
"gpt-5.2",
|
|
96062
|
+
"gpt-5.4-mini",
|
|
96063
|
+
"gpt-5.5",
|
|
96064
|
+
"gpt-5.6-luna",
|
|
96065
|
+
"gpt-5.6-luna-fast",
|
|
96066
|
+
"gpt-5.6-sol",
|
|
96067
|
+
"gpt-5.6-terra",
|
|
96068
|
+
"gpt-6-astra"
|
|
96069
|
+
]);
|
|
96070
|
+
function handEditedAgentModel(installedModel, receipt) {
|
|
96071
|
+
if (installedModel === null)
|
|
96072
|
+
return null;
|
|
96073
|
+
if (receipt?.model !== undefined)
|
|
96074
|
+
return installedModel === receipt.model ? null : installedModel;
|
|
96075
|
+
return PREVIOUSLY_BUNDLED_AGENT_MODELS.has(installedModel) ? null : installedModel;
|
|
96076
|
+
}
|
|
96077
|
+
|
|
95852
96078
|
// packages/omo-codex/src/install/retired-managed-agent-purge.ts
|
|
95853
|
-
import { lstat as lstat8, readFile as
|
|
95854
|
-
import { join as
|
|
96079
|
+
import { lstat as lstat8, readFile as readFile15, rm as rm9 } from "fs/promises";
|
|
96080
|
+
import { join as join42 } from "path";
|
|
95855
96081
|
var RETIRED_MANAGED_AGENT_FILES = [
|
|
95856
96082
|
{
|
|
95857
96083
|
fileName: "codex-ultrawork-reviewer.toml",
|
|
@@ -95863,11 +96089,11 @@ var RETIRED_MANAGED_AGENT_FILES = [
|
|
|
95863
96089
|
}
|
|
95864
96090
|
];
|
|
95865
96091
|
async function purgeRetiredManagedAgentFiles(input) {
|
|
95866
|
-
const agentsDir =
|
|
96092
|
+
const agentsDir = join42(input.codexHome, "agents");
|
|
95867
96093
|
if (!await exists3(agentsDir))
|
|
95868
96094
|
return;
|
|
95869
96095
|
for (const retiredAgent of RETIRED_MANAGED_AGENT_FILES) {
|
|
95870
|
-
const agentPath =
|
|
96096
|
+
const agentPath = join42(agentsDir, retiredAgent.fileName);
|
|
95871
96097
|
if (!await exists3(agentPath))
|
|
95872
96098
|
continue;
|
|
95873
96099
|
const agentStat = await lstat8(agentPath);
|
|
@@ -95876,7 +96102,7 @@ async function purgeRetiredManagedAgentFiles(input) {
|
|
|
95876
96102
|
const content = await readTextIfExists2(agentPath);
|
|
95877
96103
|
if (content === null || !hasRequiredMarkers(content, retiredAgent.requiredMarkers))
|
|
95878
96104
|
continue;
|
|
95879
|
-
await
|
|
96105
|
+
await rm9(agentPath, { force: true });
|
|
95880
96106
|
}
|
|
95881
96107
|
}
|
|
95882
96108
|
function hasRequiredMarkers(content, markers) {
|
|
@@ -95884,7 +96110,7 @@ function hasRequiredMarkers(content, markers) {
|
|
|
95884
96110
|
}
|
|
95885
96111
|
async function readTextIfExists2(path) {
|
|
95886
96112
|
try {
|
|
95887
|
-
return await
|
|
96113
|
+
return await readFile15(path, "utf8");
|
|
95888
96114
|
} catch (error) {
|
|
95889
96115
|
if (nodeErrorCode2(error) === "ENOENT")
|
|
95890
96116
|
return null;
|
|
@@ -95909,13 +96135,13 @@ function nodeErrorCode2(error) {
|
|
|
95909
96135
|
|
|
95910
96136
|
// packages/omo-codex/src/install/default-agent-role.ts
|
|
95911
96137
|
import { createHash as createHash3 } from "crypto";
|
|
95912
|
-
import { lstat as lstat9, readFile as
|
|
95913
|
-
import { join as
|
|
96138
|
+
import { lstat as lstat9, readFile as readFile16, rm as rm10 } from "fs/promises";
|
|
96139
|
+
import { join as join43 } from "path";
|
|
95914
96140
|
var REGISTRATION = { name: "default", configFile: "./agents/default.toml" };
|
|
95915
96141
|
async function installDefaultAgentRole(input) {
|
|
95916
|
-
const target =
|
|
95917
|
-
const receipt =
|
|
95918
|
-
const configPath =
|
|
96142
|
+
const target = join43(input.codexHome, "agents", "default.toml");
|
|
96143
|
+
const receipt = join43(input.codexHome, "agents", ".lazycodex-default.sha256");
|
|
96144
|
+
const configPath = join43(input.codexHome, "config.toml");
|
|
95919
96145
|
const config = await readIfPresent(configPath);
|
|
95920
96146
|
const entry = await lstat9(target).catch((error) => {
|
|
95921
96147
|
if (error instanceof Error && "code" in error && error.code === "ENOENT")
|
|
@@ -95938,15 +96164,15 @@ async function installDefaultAgentRole(input) {
|
|
|
95938
96164
|
if (next !== config)
|
|
95939
96165
|
await writeFileAtomic(configPath, next);
|
|
95940
96166
|
}
|
|
95941
|
-
await
|
|
95942
|
-
await
|
|
96167
|
+
await rm10(target);
|
|
96168
|
+
await rm10(receipt);
|
|
95943
96169
|
}
|
|
95944
96170
|
return null;
|
|
95945
96171
|
}
|
|
95946
96172
|
if (foreign || existing !== null && !owned) {
|
|
95947
96173
|
throw new Error("Preserved user-owned agents.default / agents/default.toml. Move it aside to install the LazyCodex fallback, or set [codex].agents.default.disable = true in omo.jsonc. Explicit LazyCodex roles remain required.");
|
|
95948
96174
|
}
|
|
95949
|
-
const worker = await
|
|
96175
|
+
const worker = await readFile16(input.worker.path, "utf8");
|
|
95950
96176
|
const content = worker.replace(/^name\s*=\s*["']lazycodex-worker-medium["']\s*$/m, 'name = "default"');
|
|
95951
96177
|
if (content === worker)
|
|
95952
96178
|
throw new Error("Cannot derive default: medium worker has no matching internal name");
|
|
@@ -95956,7 +96182,7 @@ async function installDefaultAgentRole(input) {
|
|
|
95956
96182
|
}
|
|
95957
96183
|
async function readIfPresent(path) {
|
|
95958
96184
|
try {
|
|
95959
|
-
return await
|
|
96185
|
+
return await readFile16(path, "utf8");
|
|
95960
96186
|
} catch (error) {
|
|
95961
96187
|
if (error instanceof Error && "code" in error && error.code === "ENOENT")
|
|
95962
96188
|
return null;
|
|
@@ -95976,27 +96202,19 @@ async function linkCachedPluginAgents(input) {
|
|
|
95976
96202
|
await writeManifest(input.pluginRoot, []);
|
|
95977
96203
|
return [];
|
|
95978
96204
|
}
|
|
95979
|
-
const agentsDir =
|
|
95980
|
-
await
|
|
96205
|
+
const agentsDir = join44(input.codexHome, "agents");
|
|
96206
|
+
await mkdir7(agentsDir, { recursive: true });
|
|
96207
|
+
const previousReceipts = await readAgentModelReceipts(input.codexHome);
|
|
96208
|
+
const receipts = new Map;
|
|
95981
96209
|
const linked = [];
|
|
95982
96210
|
for (const agentPath of bundledAgents) {
|
|
95983
96211
|
const agentFileName = basename7(agentPath);
|
|
95984
96212
|
const agentName = agentNameFromToml2(agentFileName);
|
|
95985
|
-
const linkPath =
|
|
95986
|
-
await
|
|
95987
|
-
await restorePreservedReasoning({
|
|
95988
|
-
agentName,
|
|
95989
|
-
linkPath,
|
|
95990
|
-
target: agentPath,
|
|
95991
|
-
value: input.preservedReasoning?.get(agentName)
|
|
95992
|
-
});
|
|
95993
|
-
await restorePreservedServiceTier({
|
|
95994
|
-
linkPath,
|
|
95995
|
-
preserved: input.preservedServiceTier?.has(agentName) ?? false,
|
|
95996
|
-
value: input.preservedServiceTier?.get(agentName) ?? null
|
|
95997
|
-
});
|
|
96213
|
+
const linkPath = join44(agentsDir, agentFileName);
|
|
96214
|
+
receipts.set(agentName, await syncAgentFile({ ...input, agentName, agentPath, linkPath, previousReceipt: previousReceipts.get(agentName) }));
|
|
95998
96215
|
linked.push({ name: agentFileName, path: linkPath, target: agentPath });
|
|
95999
96216
|
}
|
|
96217
|
+
await writeAgentModelReceipts(input.codexHome, receipts);
|
|
96000
96218
|
const worker = linked.find((entry) => entry.name === "lazycodex-worker-medium.toml");
|
|
96001
96219
|
if (worker !== undefined) {
|
|
96002
96220
|
const fallback = await installDefaultAgentRole({ codexHome: input.codexHome, worker, enabled: input.defaultRoleEnabled !== false });
|
|
@@ -96006,8 +96224,33 @@ async function linkCachedPluginAgents(input) {
|
|
|
96006
96224
|
await writeManifest(input.pluginRoot, linked.map((entry) => entry.path));
|
|
96007
96225
|
return linked;
|
|
96008
96226
|
}
|
|
96227
|
+
async function syncAgentFile(input) {
|
|
96228
|
+
const installed = await readTextIfExists(input.linkPath);
|
|
96229
|
+
const installedModel = installed === null ? null : extractModel(installed);
|
|
96230
|
+
const preservedReasoning = input.preservedReasoning?.get(input.agentName);
|
|
96231
|
+
const override = input.agentOverrides?.get(input.agentName);
|
|
96232
|
+
await replaceWithCopy(input.linkPath, input.agentPath);
|
|
96233
|
+
await restorePreservedModel({ linkPath: input.linkPath, value: handEditedAgentModel(installedModel, input.previousReceipt) });
|
|
96234
|
+
await restorePreservedReasoning({
|
|
96235
|
+
agentName: input.agentName,
|
|
96236
|
+
linkPath: input.linkPath,
|
|
96237
|
+
target: input.agentPath,
|
|
96238
|
+
value: preservedReasoning?.effort === input.previousReceipt?.reasoningEffort ? undefined : preservedReasoning
|
|
96239
|
+
});
|
|
96240
|
+
await restorePreservedServiceTier({
|
|
96241
|
+
linkPath: input.linkPath,
|
|
96242
|
+
preserved: input.preservedServiceTier?.has(input.agentName) ?? false,
|
|
96243
|
+
value: input.preservedServiceTier?.get(input.agentName) ?? null
|
|
96244
|
+
});
|
|
96245
|
+
await applyAgentOverride({ linkPath: input.linkPath, override });
|
|
96246
|
+
const model = override?.model ?? extractModel(await readFile17(input.agentPath, "utf8"));
|
|
96247
|
+
return {
|
|
96248
|
+
...model === null ? {} : { model },
|
|
96249
|
+
...override?.reasoningEffort === undefined ? {} : { reasoningEffort: override.reasoningEffort }
|
|
96250
|
+
};
|
|
96251
|
+
}
|
|
96009
96252
|
async function discoverBundledAgents(pluginRoot) {
|
|
96010
|
-
const componentsRoot =
|
|
96253
|
+
const componentsRoot = join44(pluginRoot, "components");
|
|
96011
96254
|
if (!await exists4(componentsRoot))
|
|
96012
96255
|
return [];
|
|
96013
96256
|
const componentEntries = await readdir7(componentsRoot, { withFileTypes: true });
|
|
@@ -96015,14 +96258,14 @@ async function discoverBundledAgents(pluginRoot) {
|
|
|
96015
96258
|
for (const entry of componentEntries) {
|
|
96016
96259
|
if (!entry.isDirectory())
|
|
96017
96260
|
continue;
|
|
96018
|
-
const agentsRoot =
|
|
96261
|
+
const agentsRoot = join44(componentsRoot, entry.name, "agents");
|
|
96019
96262
|
if (!await exists4(agentsRoot))
|
|
96020
96263
|
continue;
|
|
96021
96264
|
const agentEntries = await readdir7(agentsRoot, { withFileTypes: true });
|
|
96022
96265
|
for (const file of agentEntries) {
|
|
96023
96266
|
if (!file.isFile() || !file.name.endsWith(".toml"))
|
|
96024
96267
|
continue;
|
|
96025
|
-
agents.push(
|
|
96268
|
+
agents.push(join44(agentsRoot, file.name));
|
|
96026
96269
|
}
|
|
96027
96270
|
}
|
|
96028
96271
|
agents.sort();
|
|
@@ -96039,12 +96282,12 @@ async function prepareReplacement(linkPath) {
|
|
|
96039
96282
|
if (entryStat.isDirectory() && !entryStat.isSymbolicLink()) {
|
|
96040
96283
|
throw new Error(`${linkPath} already exists and is a directory; refusing to replace`);
|
|
96041
96284
|
}
|
|
96042
|
-
await
|
|
96285
|
+
await rm11(linkPath, { force: true });
|
|
96043
96286
|
}
|
|
96044
96287
|
async function writeManifest(pluginRoot, agentPaths) {
|
|
96045
|
-
const manifestPath =
|
|
96288
|
+
const manifestPath = join44(pluginRoot, MANIFEST_FILE);
|
|
96046
96289
|
const payload = { agents: [...agentPaths].sort() };
|
|
96047
|
-
await
|
|
96290
|
+
await writeFile9(manifestPath, `${JSON.stringify(payload, null, "\t")}
|
|
96048
96291
|
`);
|
|
96049
96292
|
}
|
|
96050
96293
|
function agentNameFromToml2(fileName) {
|
|
@@ -96066,13 +96309,59 @@ function nodeErrorCode3(error) {
|
|
|
96066
96309
|
return typeof error.code === "string" ? error.code : null;
|
|
96067
96310
|
}
|
|
96068
96311
|
|
|
96312
|
+
// packages/omo-codex/src/install/install-codex-agents.ts
|
|
96313
|
+
async function linkInstalledPluginAgents(input) {
|
|
96314
|
+
const { codexHome, log } = input;
|
|
96315
|
+
const preservedReasoning = await capturePreservedAgentReasoning({ codexHome });
|
|
96316
|
+
const preservedServiceTier = await capturePreservedAgentServiceTier({ codexHome });
|
|
96317
|
+
const agentSourceRoots = await agentSourceRootsForInstall(input);
|
|
96318
|
+
const omoConfig = readCodexAgentConfig({ cwd: input.projectDirectory, env: input.env });
|
|
96319
|
+
for (const warning of omoConfig.warnings)
|
|
96320
|
+
log(`Warning: ${warning}`);
|
|
96321
|
+
const agentConfigs = new Map;
|
|
96322
|
+
for (const plugin of input.installed) {
|
|
96323
|
+
const agentLinks = await linkCachedPluginAgents({
|
|
96324
|
+
codexHome,
|
|
96325
|
+
pluginRoot: agentSourceRoots.get(plugin.name) ?? plugin.path,
|
|
96326
|
+
platform: input.platform,
|
|
96327
|
+
preservedReasoning,
|
|
96328
|
+
preservedServiceTier,
|
|
96329
|
+
defaultRoleEnabled: omoConfig.defaultRoleEnabled,
|
|
96330
|
+
agentOverrides: omoConfig.agentOverrides
|
|
96331
|
+
});
|
|
96332
|
+
for (const link of agentLinks) {
|
|
96333
|
+
log(`Linked agent ${link.name} -> ${link.target}`);
|
|
96334
|
+
const agentName = agentNameFromToml3(link.name);
|
|
96335
|
+
agentConfigs.set(agentName, { name: agentName, configFile: `./agents/${link.name}` });
|
|
96336
|
+
}
|
|
96337
|
+
}
|
|
96338
|
+
for (const warning of unmanagedAgentOverrideWarnings(omoConfig.agentOverrides, new Set(agentConfigs.keys()))) {
|
|
96339
|
+
log(`Warning: ${warning}`);
|
|
96340
|
+
}
|
|
96341
|
+
return [...agentConfigs.values()].sort((left, right) => left.name.localeCompare(right.name));
|
|
96342
|
+
}
|
|
96343
|
+
async function agentSourceRootsForInstall(input) {
|
|
96344
|
+
if (input.marketplace.name !== "sisyphuslabs") {
|
|
96345
|
+
return new Map(input.installed.map((plugin) => [plugin.name, plugin.path]));
|
|
96346
|
+
}
|
|
96347
|
+
const snapshotPlugins = await writeInstalledMarketplaceSnapshot({
|
|
96348
|
+
codexHome: input.codexHome,
|
|
96349
|
+
marketplace: input.marketplace,
|
|
96350
|
+
plugins: input.pluginSources
|
|
96351
|
+
});
|
|
96352
|
+
return new Map(snapshotPlugins.map((plugin) => [plugin.name, plugin.path]));
|
|
96353
|
+
}
|
|
96354
|
+
function agentNameFromToml3(fileName) {
|
|
96355
|
+
return fileName.endsWith(".toml") ? fileName.slice(0, -".toml".length) : fileName;
|
|
96356
|
+
}
|
|
96357
|
+
|
|
96069
96358
|
// packages/omo-codex/src/install/codex-marketplace.ts
|
|
96070
|
-
import { readFile as
|
|
96071
|
-
import { join as
|
|
96359
|
+
import { readFile as readFile18 } from "fs/promises";
|
|
96360
|
+
import { join as join45 } from "path";
|
|
96072
96361
|
var DEFAULT_MARKETPLACE_PATH = "packages/omo-codex/marketplace.json";
|
|
96073
96362
|
async function readMarketplace(repoRoot, options) {
|
|
96074
|
-
const marketplacePath = options?.marketplacePath ??
|
|
96075
|
-
const raw = await
|
|
96363
|
+
const marketplacePath = options?.marketplacePath ?? join45(repoRoot, DEFAULT_MARKETPLACE_PATH);
|
|
96364
|
+
const raw = await readFile18(marketplacePath, "utf8");
|
|
96076
96365
|
const parsed = JSON.parse(raw);
|
|
96077
96366
|
if (!isPlainRecord4(parsed))
|
|
96078
96367
|
throw new Error("marketplace.json must be an object");
|
|
@@ -96090,10 +96379,10 @@ async function readMarketplace(repoRoot, options) {
|
|
|
96090
96379
|
function resolvePluginSource(repoRoot, plugin, options) {
|
|
96091
96380
|
const sourcePath = localSourcePath(options?.pathOverride ?? plugin.source);
|
|
96092
96381
|
const relativePath = sourcePath.slice(2);
|
|
96093
|
-
return
|
|
96382
|
+
return join45(repoRoot, ...relativePath.split(/[\\/]/));
|
|
96094
96383
|
}
|
|
96095
96384
|
async function readPluginManifest(pluginRoot) {
|
|
96096
|
-
const raw = await
|
|
96385
|
+
const raw = await readFile18(join45(pluginRoot, ".codex-plugin", "plugin.json"), "utf8");
|
|
96097
96386
|
const parsed = JSON.parse(raw);
|
|
96098
96387
|
if (!isPlainRecord4(parsed))
|
|
96099
96388
|
throw new Error(`${pluginRoot} plugin.json must be an object`);
|
|
@@ -96173,61 +96462,12 @@ function validateLocalSourcePath(path) {
|
|
|
96173
96462
|
return path;
|
|
96174
96463
|
}
|
|
96175
96464
|
|
|
96176
|
-
// packages/omo-codex/src/install/codex-marketplace-snapshot.ts
|
|
96177
|
-
import { cp as cp3, mkdir as mkdir7, rename as rename4, rm as rm10, writeFile as writeFile8 } from "fs/promises";
|
|
96178
|
-
import { join as join44, sep as sep6 } from "path";
|
|
96179
|
-
var INSTALLED_MARKETPLACES_DIR = ".tmp/marketplaces";
|
|
96180
|
-
async function writeInstalledMarketplaceSnapshot(input) {
|
|
96181
|
-
const marketplaceRoot = installedMarketplaceRoot(input.codexHome, input.marketplace.name);
|
|
96182
|
-
await mkdir7(marketplaceRoot, { recursive: true });
|
|
96183
|
-
await writeMarketplaceManifest(marketplaceRoot, input.marketplace);
|
|
96184
|
-
const snapshotPlugins = [];
|
|
96185
|
-
for (const plugin of input.plugins) {
|
|
96186
|
-
snapshotPlugins.push(await writeSnapshotPlugin(marketplaceRoot, plugin));
|
|
96187
|
-
}
|
|
96188
|
-
return snapshotPlugins;
|
|
96189
|
-
}
|
|
96190
|
-
function installedMarketplaceRoot(codexHome, marketplaceName) {
|
|
96191
|
-
return join44(codexHome, INSTALLED_MARKETPLACES_DIR, marketplaceName);
|
|
96192
|
-
}
|
|
96193
|
-
async function writeMarketplaceManifest(marketplaceRoot, marketplace) {
|
|
96194
|
-
const manifestDir = join44(marketplaceRoot, ".agents", "plugins");
|
|
96195
|
-
await mkdir7(manifestDir, { recursive: true });
|
|
96196
|
-
const tempPath = join44(manifestDir, `.marketplace-${process.pid}-${Date.now()}.json.tmp`);
|
|
96197
|
-
await writeFile8(tempPath, `${JSON.stringify(marketplace, null, "\t")}
|
|
96198
|
-
`);
|
|
96199
|
-
await rename4(tempPath, join44(manifestDir, "marketplace.json"));
|
|
96200
|
-
}
|
|
96201
|
-
async function writeSnapshotPlugin(marketplaceRoot, plugin) {
|
|
96202
|
-
const pluginsDir = join44(marketplaceRoot, "plugins");
|
|
96203
|
-
await mkdir7(pluginsDir, { recursive: true });
|
|
96204
|
-
const targetPath = join44(pluginsDir, plugin.name);
|
|
96205
|
-
const tempPath = join44(pluginsDir, `.tmp-${plugin.name}-${process.pid}-${Date.now()}`);
|
|
96206
|
-
await rm10(tempPath, { recursive: true, force: true });
|
|
96207
|
-
await cp3(plugin.sourcePath, tempPath, {
|
|
96208
|
-
recursive: true,
|
|
96209
|
-
filter: (source) => shouldCopyMarketplaceSourcePath(source, plugin.sourcePath)
|
|
96210
|
-
});
|
|
96211
|
-
await copyBundledMcpRuntimeDists({ pluginRoot: tempPath, sourceRoot: plugin.sourcePath });
|
|
96212
|
-
await rm10(targetPath, { recursive: true, force: true });
|
|
96213
|
-
await rename4(tempPath, targetPath);
|
|
96214
|
-
await rewriteCachedMcpManifest(targetPath, plugin.sourcePath);
|
|
96215
|
-
return { name: plugin.name, path: targetPath };
|
|
96216
|
-
}
|
|
96217
|
-
function shouldCopyMarketplaceSourcePath(path, root) {
|
|
96218
|
-
const relative = path === root ? "" : path.slice(root.length + sep6.length);
|
|
96219
|
-
if (relative === "")
|
|
96220
|
-
return true;
|
|
96221
|
-
const parts = relative.split(sep6);
|
|
96222
|
-
return !parts.some((part) => part === ".git" || part === "node_modules");
|
|
96223
|
-
}
|
|
96224
|
-
|
|
96225
96465
|
// packages/omo-codex/src/install/lazycodex-version-stamp.ts
|
|
96226
|
-
import { readdir as readdir8, readFile as
|
|
96227
|
-
import { join as
|
|
96466
|
+
import { readdir as readdir8, readFile as readFile19, writeFile as writeFile10 } from "fs/promises";
|
|
96467
|
+
import { join as join46 } from "path";
|
|
96228
96468
|
async function readDistributionManifest(repoRoot) {
|
|
96229
96469
|
try {
|
|
96230
|
-
const parsed = JSON.parse(await
|
|
96470
|
+
const parsed = JSON.parse(await readFile19(join46(repoRoot, "package.json"), "utf8"));
|
|
96231
96471
|
if (!isPlainRecord4(parsed) || typeof parsed.version !== "string" || parsed.version.trim().length === 0)
|
|
96232
96472
|
return;
|
|
96233
96473
|
return {
|
|
@@ -96251,19 +96491,19 @@ function resolveLazyCodexPluginVersion(input) {
|
|
|
96251
96491
|
return input.manifestVersion ?? "local";
|
|
96252
96492
|
}
|
|
96253
96493
|
async function stampLazyCodexPluginVersion(input) {
|
|
96254
|
-
const manifestPath =
|
|
96494
|
+
const manifestPath = join46(input.pluginRoot, ".codex-plugin", "plugin.json");
|
|
96255
96495
|
const hookPaths = await readPluginHookPaths(manifestPath);
|
|
96256
96496
|
await stampJsonVersion(manifestPath, input.version);
|
|
96257
|
-
await stampJsonVersion(
|
|
96497
|
+
await stampJsonVersion(join46(input.pluginRoot, "package.json"), input.version);
|
|
96258
96498
|
for (const hookPath of hookPaths) {
|
|
96259
|
-
await stampHookStatusMessages(
|
|
96499
|
+
await stampHookStatusMessages(join46(input.pluginRoot, hookPath), input.version);
|
|
96260
96500
|
}
|
|
96261
96501
|
await stampComponentVersions(input);
|
|
96262
96502
|
}
|
|
96263
96503
|
async function writeLazyCodexInstallSnapshot(input) {
|
|
96264
96504
|
if (input.distributionManifest === undefined)
|
|
96265
96505
|
return;
|
|
96266
|
-
await
|
|
96506
|
+
await writeFile10(join46(input.pluginRoot, "lazycodex-install.json"), `${JSON.stringify({
|
|
96267
96507
|
packageName: input.distributionManifest.name,
|
|
96268
96508
|
version: input.distributionManifest.version
|
|
96269
96509
|
}, null, "\t")}
|
|
@@ -96271,11 +96511,11 @@ async function writeLazyCodexInstallSnapshot(input) {
|
|
|
96271
96511
|
}
|
|
96272
96512
|
async function stampJsonVersion(path, version) {
|
|
96273
96513
|
try {
|
|
96274
|
-
const parsed = JSON.parse(await
|
|
96514
|
+
const parsed = JSON.parse(await readFile19(path, "utf8"));
|
|
96275
96515
|
if (!isPlainRecord4(parsed))
|
|
96276
96516
|
return;
|
|
96277
96517
|
parsed.version = version;
|
|
96278
|
-
await
|
|
96518
|
+
await writeFile10(path, `${JSON.stringify(parsed, null, "\t")}
|
|
96279
96519
|
`);
|
|
96280
96520
|
} catch (error) {
|
|
96281
96521
|
if (error instanceof Error)
|
|
@@ -96285,7 +96525,7 @@ async function stampJsonVersion(path, version) {
|
|
|
96285
96525
|
}
|
|
96286
96526
|
async function readPluginHookPaths(manifestPath) {
|
|
96287
96527
|
try {
|
|
96288
|
-
const parsed = JSON.parse(await
|
|
96528
|
+
const parsed = JSON.parse(await readFile19(manifestPath, "utf8"));
|
|
96289
96529
|
if (!isPlainRecord4(parsed))
|
|
96290
96530
|
return [];
|
|
96291
96531
|
if (typeof parsed.hooks === "string" && parsed.hooks.trim().length > 0)
|
|
@@ -96305,11 +96545,11 @@ function stripDotSlash3(path) {
|
|
|
96305
96545
|
}
|
|
96306
96546
|
async function stampHookStatusMessages(path, version) {
|
|
96307
96547
|
try {
|
|
96308
|
-
const parsed = JSON.parse(await
|
|
96548
|
+
const parsed = JSON.parse(await readFile19(path, "utf8"));
|
|
96309
96549
|
if (!isPlainRecord4(parsed))
|
|
96310
96550
|
return;
|
|
96311
96551
|
stampHookGroups(parsed.hooks, version);
|
|
96312
|
-
await
|
|
96552
|
+
await writeFile10(path, `${JSON.stringify(parsed, null, "\t")}
|
|
96313
96553
|
`);
|
|
96314
96554
|
} catch (error) {
|
|
96315
96555
|
if (error instanceof Error)
|
|
@@ -96320,16 +96560,16 @@ async function stampHookStatusMessages(path, version) {
|
|
|
96320
96560
|
async function stampComponentVersions(input) {
|
|
96321
96561
|
let entries;
|
|
96322
96562
|
try {
|
|
96323
|
-
entries = await readdir8(
|
|
96563
|
+
entries = await readdir8(join46(input.pluginRoot, "components"));
|
|
96324
96564
|
} catch (error) {
|
|
96325
96565
|
if (error instanceof Error)
|
|
96326
96566
|
return;
|
|
96327
96567
|
throw error;
|
|
96328
96568
|
}
|
|
96329
96569
|
for (const entry of entries) {
|
|
96330
|
-
const componentRoot =
|
|
96331
|
-
await stampJsonVersion(
|
|
96332
|
-
await stampHookStatusMessages(
|
|
96570
|
+
const componentRoot = join46(input.pluginRoot, "components", entry);
|
|
96571
|
+
await stampJsonVersion(join46(componentRoot, "package.json"), input.version);
|
|
96572
|
+
await stampHookStatusMessages(join46(componentRoot, "hooks", "hooks.json"), input.version);
|
|
96333
96573
|
}
|
|
96334
96574
|
}
|
|
96335
96575
|
function stampHookGroups(hooks, version) {
|
|
@@ -96386,8 +96626,8 @@ var defaultRunCommand = async (command, args, options) => {
|
|
|
96386
96626
|
};
|
|
96387
96627
|
|
|
96388
96628
|
// packages/omo-codex/src/install/codex-project-local-cleanup.ts
|
|
96389
|
-
import { copyFile as copyFile2, lstat as lstat11, readFile as
|
|
96390
|
-
import { dirname as dirname17, join as
|
|
96629
|
+
import { copyFile as copyFile2, lstat as lstat11, readFile as readFile20, writeFile as writeFile11 } from "fs/promises";
|
|
96630
|
+
import { dirname as dirname17, join as join47, resolve as resolve11 } from "path";
|
|
96391
96631
|
var LEGACY_AGENT_CONFLICT_KEYS = ["max_threads"];
|
|
96392
96632
|
var PROJECT_LOCAL_ARTIFACT_PATHS = [
|
|
96393
96633
|
".codex/hooks.json",
|
|
@@ -96406,7 +96646,7 @@ async function repairNearestProjectLocalCodexArtifacts(input) {
|
|
|
96406
96646
|
const artifacts = await collectProjectLocalArtifacts(project.artifactRoots);
|
|
96407
96647
|
const configs = [];
|
|
96408
96648
|
for (const configPath of project.configPaths) {
|
|
96409
|
-
const original = await
|
|
96649
|
+
const original = await readFile20(configPath, "utf8");
|
|
96410
96650
|
const repair = repairProjectLocalCodexConfigText(original);
|
|
96411
96651
|
if (!repair.changed) {
|
|
96412
96652
|
configs.push({
|
|
@@ -96419,7 +96659,7 @@ async function repairNearestProjectLocalCodexArtifacts(input) {
|
|
|
96419
96659
|
}
|
|
96420
96660
|
const backupPath = `${configPath}.backup-${formatBackupTimestamp(input.now?.() ?? new Date)}`;
|
|
96421
96661
|
await copyFile2(configPath, backupPath);
|
|
96422
|
-
await
|
|
96662
|
+
await writeFile11(configPath, `${repair.config.trimEnd()}
|
|
96423
96663
|
`);
|
|
96424
96664
|
configs.push({
|
|
96425
96665
|
projectRoot: project.projectRoot,
|
|
@@ -96490,17 +96730,17 @@ async function findProjectLocalCodexConfigs(startDirectory, codexHome) {
|
|
|
96490
96730
|
if (startDirectoryStat !== null && !startDirectoryStat.isDirectory()) {
|
|
96491
96731
|
throw new ProjectLocalCleanupStartDirectoryError(startDirectory);
|
|
96492
96732
|
}
|
|
96493
|
-
const codexHomeConfigPath = codexHome === undefined ? null :
|
|
96733
|
+
const codexHomeConfigPath = codexHome === undefined ? null : join47(resolve11(codexHome), "config.toml");
|
|
96494
96734
|
let current = resolve11(startDirectory);
|
|
96495
96735
|
const configPathsFromCwd = [];
|
|
96496
96736
|
while (true) {
|
|
96497
|
-
const configPath =
|
|
96737
|
+
const configPath = join47(current, ".codex", "config.toml");
|
|
96498
96738
|
if (await isRegularProjectLocalConfig(current, configPath)) {
|
|
96499
96739
|
if (codexHomeConfigPath === null || resolve11(configPath) !== codexHomeConfigPath) {
|
|
96500
96740
|
configPathsFromCwd.push(configPath);
|
|
96501
96741
|
}
|
|
96502
96742
|
}
|
|
96503
|
-
if (await exists5(
|
|
96743
|
+
if (await exists5(join47(current, ".git"))) {
|
|
96504
96744
|
return configPathsFromCwd.length === 0 ? null : {
|
|
96505
96745
|
projectRoot: current,
|
|
96506
96746
|
configPaths: [...configPathsFromCwd].reverse(),
|
|
@@ -96520,7 +96760,7 @@ async function findProjectLocalCodexConfigs(startDirectory, codexHome) {
|
|
|
96520
96760
|
}
|
|
96521
96761
|
}
|
|
96522
96762
|
async function isRegularProjectLocalConfig(directory, configPath) {
|
|
96523
|
-
const codexDirStat = await maybeLstat(
|
|
96763
|
+
const codexDirStat = await maybeLstat(join47(directory, ".codex"));
|
|
96524
96764
|
if (codexDirStat === null || !codexDirStat.isDirectory() || codexDirStat.isSymbolicLink())
|
|
96525
96765
|
return false;
|
|
96526
96766
|
const configStat = await maybeLstat(configPath);
|
|
@@ -96540,7 +96780,7 @@ async function collectProjectLocalArtifacts(projectRoots) {
|
|
|
96540
96780
|
const seenPaths = new Set;
|
|
96541
96781
|
for (const projectRoot of projectRoots) {
|
|
96542
96782
|
for (const relativePath of PROJECT_LOCAL_ARTIFACT_PATHS) {
|
|
96543
|
-
const artifactPath =
|
|
96783
|
+
const artifactPath = join47(projectRoot, relativePath);
|
|
96544
96784
|
if (seenPaths.has(artifactPath))
|
|
96545
96785
|
continue;
|
|
96546
96786
|
const entryStat = await maybeLstat(artifactPath);
|
|
@@ -96616,13 +96856,13 @@ function formatUnknownError(error) {
|
|
|
96616
96856
|
|
|
96617
96857
|
// packages/omo-codex/src/install/lsp-daemon-reaper.ts
|
|
96618
96858
|
import { createHash as createHash4 } from "crypto";
|
|
96619
|
-
import { lstat as lstat12, readFile as
|
|
96859
|
+
import { lstat as lstat12, readFile as readFile22, readdir as readdir10, rm as rm12 } from "fs/promises";
|
|
96620
96860
|
import { tmpdir as tmpdir3 } from "os";
|
|
96621
|
-
import { join as
|
|
96861
|
+
import { join as join48, posix as posix6 } from "path";
|
|
96622
96862
|
|
|
96623
96863
|
// packages/omo-codex/src/install/lsp-daemon-reaper-attestation.ts
|
|
96624
96864
|
import { execFile } from "child_process";
|
|
96625
|
-
import { readFile as
|
|
96865
|
+
import { readFile as readFile21, readdir as readdir9, readlink as readlink5 } from "fs/promises";
|
|
96626
96866
|
import { connect } from "net";
|
|
96627
96867
|
import { basename as basename8 } from "path";
|
|
96628
96868
|
var PROBE_TIMEOUT_MS = 500;
|
|
@@ -96664,7 +96904,7 @@ async function attestLegacyDaemonOwnership(input, deps = {}) {
|
|
|
96664
96904
|
return false;
|
|
96665
96905
|
}
|
|
96666
96906
|
async function attestLinuxOwnership(input, deps) {
|
|
96667
|
-
const readFileImpl = deps.readFile ??
|
|
96907
|
+
const readFileImpl = deps.readFile ?? readFile21;
|
|
96668
96908
|
const readDirImpl = deps.readDir ?? readdir9;
|
|
96669
96909
|
const readLinkImpl = deps.readLink ?? readlink5;
|
|
96670
96910
|
const procNetUnix = await readText(readFileImpl, "/proc/net/unix");
|
|
@@ -96791,7 +97031,7 @@ async function readBinary(readFileImpl, path) {
|
|
|
96791
97031
|
var LEGACY_EXIT_WAIT_TIMEOUT_MS = 5000;
|
|
96792
97032
|
var LEGACY_VERSION_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._+-]{0,127}$/;
|
|
96793
97033
|
async function reapLspDaemons(codexHome, deps = {}) {
|
|
96794
|
-
const daemonRoot =
|
|
97034
|
+
const daemonRoot = join48(codexHome, "codex-lsp", "daemon");
|
|
96795
97035
|
const platform = deps.platform ?? process.platform;
|
|
96796
97036
|
const tmpDir = deps.tmpDir ?? tmpdir3();
|
|
96797
97037
|
const probe = deps.probeLegacyJsonRpc ?? probeLegacyJsonRpcEndpoint;
|
|
@@ -96801,7 +97041,7 @@ async function reapLspDaemons(codexHome, deps = {}) {
|
|
|
96801
97041
|
const entries = await readdir10(daemonRoot, { withFileTypes: true }).catch(() => []);
|
|
96802
97042
|
const results = [];
|
|
96803
97043
|
for (const entry of [...entries].sort((left, right) => left.name.localeCompare(right.name))) {
|
|
96804
|
-
const versionPath =
|
|
97044
|
+
const versionPath = join48(daemonRoot, entry.name);
|
|
96805
97045
|
const parsedVersion = parseVersionEntry(entry.name);
|
|
96806
97046
|
if (parsedVersion === null || !entry.isDirectory()) {
|
|
96807
97047
|
await removeVersionDir(versionPath);
|
|
@@ -96849,7 +97089,7 @@ function parseVersionEntry(entryName) {
|
|
|
96849
97089
|
return LEGACY_VERSION_PATTERN.test(version) ? version : null;
|
|
96850
97090
|
}
|
|
96851
97091
|
async function readLegacyMetadata(input) {
|
|
96852
|
-
const pidText = await readRegularTrimmedFile(
|
|
97092
|
+
const pidText = await readRegularTrimmedFile(join48(input.versionPath, "daemon.pid"));
|
|
96853
97093
|
if (pidText === "non_regular")
|
|
96854
97094
|
return { kind: "remove", reason: "removed non-regular legacy daemon metadata" };
|
|
96855
97095
|
if (pidText === null)
|
|
@@ -96857,7 +97097,7 @@ async function readLegacyMetadata(input) {
|
|
|
96857
97097
|
const pid = Number.parseInt(pidText, 10);
|
|
96858
97098
|
if (!Number.isInteger(pid) || pid <= 0)
|
|
96859
97099
|
return { kind: "remove", reason: "removed malformed legacy daemon metadata" };
|
|
96860
|
-
const endpointText = await readRegularTrimmedFile(
|
|
97100
|
+
const endpointText = await readRegularTrimmedFile(join48(input.versionPath, "daemon.endpoint"));
|
|
96861
97101
|
if (endpointText === "non_regular")
|
|
96862
97102
|
return { kind: "remove", reason: "removed non-regular legacy daemon metadata" };
|
|
96863
97103
|
if (endpointText === null)
|
|
@@ -96889,14 +97129,14 @@ async function readRegularTrimmedFile(path) {
|
|
|
96889
97129
|
return null;
|
|
96890
97130
|
if (!stats.isFile())
|
|
96891
97131
|
return "non_regular";
|
|
96892
|
-
const content = (await
|
|
97132
|
+
const content = (await readFile22(path, "utf8")).trim();
|
|
96893
97133
|
return content.length > 0 ? content : null;
|
|
96894
97134
|
}
|
|
96895
97135
|
function shortDigest(value) {
|
|
96896
97136
|
return createHash4("sha256").update(value).digest("hex").slice(0, 16);
|
|
96897
97137
|
}
|
|
96898
97138
|
async function removeVersionDir(path) {
|
|
96899
|
-
await
|
|
97139
|
+
await rm12(path, { recursive: true, force: true });
|
|
96900
97140
|
}
|
|
96901
97141
|
function removed(version, reason) {
|
|
96902
97142
|
return { version, status: "removed", reason };
|
|
@@ -96936,7 +97176,7 @@ function processIsRunning(pid) {
|
|
|
96936
97176
|
|
|
96937
97177
|
// packages/omo-codex/src/install/codex-installer-bin-dir.ts
|
|
96938
97178
|
import { homedir as homedir5 } from "os";
|
|
96939
|
-
import { join as
|
|
97179
|
+
import { join as join49, resolve as resolve12 } from "path";
|
|
96940
97180
|
function resolveCodexInstallerBinDir(input) {
|
|
96941
97181
|
const explicitBinDir = input.binDir ?? input.env?.CODEX_LOCAL_BIN_DIR;
|
|
96942
97182
|
if (explicitBinDir !== undefined && explicitBinDir.trim().length > 0)
|
|
@@ -96945,16 +97185,16 @@ function resolveCodexInstallerBinDir(input) {
|
|
|
96945
97185
|
const defaultCodexHome = resolve12(homeDir, ".codex");
|
|
96946
97186
|
const resolvedCodexHome = resolve12(input.codexHome);
|
|
96947
97187
|
if (resolvedCodexHome !== defaultCodexHome)
|
|
96948
|
-
return
|
|
97188
|
+
return join49(resolvedCodexHome, "bin");
|
|
96949
97189
|
return resolve12(homeDir, ".local", "bin");
|
|
96950
97190
|
}
|
|
96951
97191
|
|
|
96952
97192
|
// packages/omo-codex/src/install/codex-installed-bin-dir.ts
|
|
96953
|
-
import { readFile as
|
|
96954
|
-
import { join as
|
|
97193
|
+
import { readFile as readFile23, readdir as readdir11, writeFile as writeFile12 } from "fs/promises";
|
|
97194
|
+
import { join as join50 } from "path";
|
|
96955
97195
|
var INSTALLED_BIN_DIR_MANIFEST = ".installed-bin-dir.json";
|
|
96956
97196
|
async function writeInstalledCodexBinDir(input) {
|
|
96957
|
-
await
|
|
97197
|
+
await writeFile12(join50(input.pluginRoot, INSTALLED_BIN_DIR_MANIFEST), `${JSON.stringify({ binDir: input.binDir }, null, 2)}
|
|
96958
97198
|
`);
|
|
96959
97199
|
}
|
|
96960
97200
|
async function readInstalledCodexBinDir(codexHome) {
|
|
@@ -96967,20 +97207,20 @@ async function readInstalledCodexBinDir(codexHome) {
|
|
|
96967
97207
|
}
|
|
96968
97208
|
async function installedBinDirManifestPaths(codexHome) {
|
|
96969
97209
|
const paths = [
|
|
96970
|
-
|
|
97210
|
+
join50(codexHome, ".tmp", "marketplaces", "sisyphuslabs", "plugins", "omo", INSTALLED_BIN_DIR_MANIFEST)
|
|
96971
97211
|
];
|
|
96972
|
-
const versionRoot =
|
|
97212
|
+
const versionRoot = join50(codexHome, "plugins", "cache", "sisyphuslabs", "omo");
|
|
96973
97213
|
const entries = await readdir11(versionRoot, { withFileTypes: true }).catch(() => null);
|
|
96974
97214
|
if (entries !== null) {
|
|
96975
97215
|
for (const entry of entries) {
|
|
96976
97216
|
if (entry.isDirectory())
|
|
96977
|
-
paths.push(
|
|
97217
|
+
paths.push(join50(versionRoot, entry.name, INSTALLED_BIN_DIR_MANIFEST));
|
|
96978
97218
|
}
|
|
96979
97219
|
}
|
|
96980
97220
|
return paths;
|
|
96981
97221
|
}
|
|
96982
97222
|
async function readBinDirFromManifest(manifestPath) {
|
|
96983
|
-
const raw = await
|
|
97223
|
+
const raw = await readFile23(manifestPath, "utf8").catch(() => null);
|
|
96984
97224
|
if (raw === null)
|
|
96985
97225
|
return null;
|
|
96986
97226
|
let parsed;
|
|
@@ -96998,8 +97238,8 @@ async function readBinDirFromManifest(manifestPath) {
|
|
|
96998
97238
|
}
|
|
96999
97239
|
|
|
97000
97240
|
// packages/omo-codex/src/install/codex-git-bash-hooks.ts
|
|
97001
|
-
import { readFile as
|
|
97002
|
-
import { join as
|
|
97241
|
+
import { readFile as readFile24, writeFile as writeFile13 } from "fs/promises";
|
|
97242
|
+
import { join as join51 } from "path";
|
|
97003
97243
|
var WINDOWS_ONLY_GIT_BASH_HOOKS = new Set([
|
|
97004
97244
|
"./hooks/pre-tool-use-recommending-git-bash-mcp.json",
|
|
97005
97245
|
"./hooks/post-compact-resetting-git-bash-mcp-reminder.json"
|
|
@@ -97007,20 +97247,20 @@ var WINDOWS_ONLY_GIT_BASH_HOOKS = new Set([
|
|
|
97007
97247
|
async function removeGitBashHooksOffWindows(input) {
|
|
97008
97248
|
if (input.platform === "win32")
|
|
97009
97249
|
return;
|
|
97010
|
-
const manifestPath =
|
|
97011
|
-
const parsed = JSON.parse(await
|
|
97250
|
+
const manifestPath = join51(input.pluginRoot, ".codex-plugin", "plugin.json");
|
|
97251
|
+
const parsed = JSON.parse(await readFile24(manifestPath, "utf8"));
|
|
97012
97252
|
if (!isPlainRecord4(parsed) || !Array.isArray(parsed.hooks))
|
|
97013
97253
|
return;
|
|
97014
97254
|
const hooks = parsed.hooks.filter((hook) => typeof hook !== "string" || !WINDOWS_ONLY_GIT_BASH_HOOKS.has(hook));
|
|
97015
97255
|
if (hooks.length === parsed.hooks.length)
|
|
97016
97256
|
return;
|
|
97017
|
-
await
|
|
97257
|
+
await writeFile13(manifestPath, `${JSON.stringify({ ...parsed, hooks }, null, "\t")}
|
|
97018
97258
|
`);
|
|
97019
97259
|
}
|
|
97020
97260
|
|
|
97021
97261
|
// packages/omo-codex/src/install/install-ast-grep-sg.ts
|
|
97022
97262
|
init_src();
|
|
97023
|
-
import { join as
|
|
97263
|
+
import { join as join52 } from "path";
|
|
97024
97264
|
function describeResult(result) {
|
|
97025
97265
|
if (result.kind === "succeeded")
|
|
97026
97266
|
return null;
|
|
@@ -97034,7 +97274,7 @@ async function installAstGrepForCodex(options) {
|
|
|
97034
97274
|
return;
|
|
97035
97275
|
const platform = options.platform ?? process.platform;
|
|
97036
97276
|
const targetDir = astGrepRuntimeDir(options.codexHome, platform, options.arch ?? process.arch);
|
|
97037
|
-
const skillDir =
|
|
97277
|
+
const skillDir = join52(plugin.path, "skills", "ast-grep");
|
|
97038
97278
|
const installer = options.installer ?? runAstGrepSkillInstall;
|
|
97039
97279
|
try {
|
|
97040
97280
|
const result = await installer({ platform, skillDir, targetDir });
|
|
@@ -97067,7 +97307,7 @@ async function runCodexInstaller(options = {}) {
|
|
|
97067
97307
|
const env = options.env ?? process.env;
|
|
97068
97308
|
const platform = options.platform ?? process.platform;
|
|
97069
97309
|
const repoRoot = resolve13(options.repoRoot ?? findRepoRoot({ importerDir: import.meta.dir, env }));
|
|
97070
|
-
const codexHome = resolve13(options.codexHome ?? env.CODEX_HOME ??
|
|
97310
|
+
const codexHome = resolve13(options.codexHome ?? env.CODEX_HOME ?? join56(homedir6(), ".codex"));
|
|
97071
97311
|
const projectDirectory = resolve13(options.projectDirectory ?? env.OMO_CODEX_PROJECT ?? process.cwd());
|
|
97072
97312
|
const binDir = resolveCodexInstallerBinDir({ binDir: options.binDir, codexHome, env });
|
|
97073
97313
|
const runCommand = options.runCommand ?? defaultRunCommand;
|
|
@@ -97084,14 +97324,13 @@ async function runCodexInstaller(options = {}) {
|
|
|
97084
97324
|
if (!gitBashResolution.found) {
|
|
97085
97325
|
throw new Error(gitBashResolution.installHint);
|
|
97086
97326
|
}
|
|
97087
|
-
const codexPackageRoot =
|
|
97327
|
+
const codexPackageRoot = join56(repoRoot, "packages", "omo-codex");
|
|
97088
97328
|
const marketplace = await readMarketplace(repoRoot, {
|
|
97089
|
-
marketplacePath:
|
|
97329
|
+
marketplacePath: join56(codexPackageRoot, "marketplace.json")
|
|
97090
97330
|
});
|
|
97091
97331
|
const distributionManifest = await readDistributionManifest(repoRoot);
|
|
97092
97332
|
const installed = [];
|
|
97093
97333
|
const pluginSources = [];
|
|
97094
|
-
const agentConfigs = new Map;
|
|
97095
97334
|
for (const entry of marketplace.plugins) {
|
|
97096
97335
|
const sourcePath = resolvePluginSource(codexPackageRoot, entry, { pathOverride: "./plugin" });
|
|
97097
97336
|
const manifest = await readPluginManifest(sourcePath);
|
|
@@ -97132,7 +97371,7 @@ async function runCodexInstaller(options = {}) {
|
|
|
97132
97371
|
if (runtimeLink !== null)
|
|
97133
97372
|
log(`Linked ${runtimeLink.name} -> ${runtimeLink.target}`);
|
|
97134
97373
|
else
|
|
97135
|
-
log(`Warning: skipped the omo-agent-toolkit runtime wrapper because ${
|
|
97374
|
+
log(`Warning: skipped the omo-agent-toolkit runtime wrapper because ${join56(repoRoot, "dist", "cli", "index.js")} is missing; omo-agent-toolkit ulw-loop commands will be unavailable until a package shipping dist/cli is installed`);
|
|
97136
97375
|
}
|
|
97137
97376
|
pluginSources.push({ name: entry.name, sourcePath });
|
|
97138
97377
|
installed.push(plugin);
|
|
@@ -97144,33 +97383,16 @@ async function runCodexInstaller(options = {}) {
|
|
|
97144
97383
|
log,
|
|
97145
97384
|
platform
|
|
97146
97385
|
});
|
|
97147
|
-
const
|
|
97148
|
-
const preservedServiceTier = await capturePreservedAgentServiceTier({ codexHome });
|
|
97149
|
-
const agentSourceRoots = await agentSourceRootsForInstall({
|
|
97386
|
+
const agentConfigs = await linkInstalledPluginAgents({
|
|
97150
97387
|
codexHome,
|
|
97388
|
+
projectDirectory,
|
|
97389
|
+
env,
|
|
97390
|
+
platform,
|
|
97391
|
+
log,
|
|
97151
97392
|
marketplace,
|
|
97152
97393
|
installed,
|
|
97153
97394
|
pluginSources
|
|
97154
97395
|
});
|
|
97155
|
-
const omoConfig = readDefaultRoleConfig({ cwd: projectDirectory, env });
|
|
97156
|
-
for (const warning of omoConfig.warnings)
|
|
97157
|
-
log(`Warning: ${warning}`);
|
|
97158
|
-
for (const plugin of installed) {
|
|
97159
|
-
const pluginRoot = agentSourceRoots.get(plugin.name) ?? plugin.path;
|
|
97160
|
-
const agentLinks = await linkCachedPluginAgents({
|
|
97161
|
-
codexHome,
|
|
97162
|
-
pluginRoot,
|
|
97163
|
-
platform,
|
|
97164
|
-
preservedReasoning,
|
|
97165
|
-
preservedServiceTier,
|
|
97166
|
-
defaultRoleEnabled: omoConfig.enabled
|
|
97167
|
-
});
|
|
97168
|
-
for (const link of agentLinks) {
|
|
97169
|
-
log(`Linked agent ${link.name} -> ${link.target}`);
|
|
97170
|
-
const agentName = agentNameFromToml3(link.name);
|
|
97171
|
-
agentConfigs.set(agentName, { name: agentName, configFile: `./agents/${link.name}` });
|
|
97172
|
-
}
|
|
97173
|
-
}
|
|
97174
97396
|
const trustedHookStates = (await Promise.all(installed.map((plugin) => trustedHookStatesForPlugin({
|
|
97175
97397
|
marketplaceName: marketplace.name,
|
|
97176
97398
|
platform,
|
|
@@ -97199,13 +97421,13 @@ async function runCodexInstaller(options = {}) {
|
|
|
97199
97421
|
continue;
|
|
97200
97422
|
log(`Warning: deferred legacy Codex LSP daemon cleanup for v${cleanup.version}: ${cleanup.reason}`);
|
|
97201
97423
|
}
|
|
97202
|
-
const marketplaceRoot =
|
|
97424
|
+
const marketplaceRoot = join56(codexHome, "plugins", "cache", marketplace.name);
|
|
97203
97425
|
await writeCachedMarketplaceManifest({
|
|
97204
97426
|
marketplaceName: marketplace.name,
|
|
97205
97427
|
marketplaceRoot,
|
|
97206
97428
|
plugins: installed
|
|
97207
97429
|
});
|
|
97208
|
-
const configPath =
|
|
97430
|
+
const configPath = join56(codexHome, "config.toml");
|
|
97209
97431
|
await updateCodexConfig({
|
|
97210
97432
|
configPath,
|
|
97211
97433
|
repoRoot: codexPackageRoot,
|
|
@@ -97215,7 +97437,7 @@ async function runCodexInstaller(options = {}) {
|
|
|
97215
97437
|
platform,
|
|
97216
97438
|
gitBashEnabled: platform === "win32" && gitBashResolution.found,
|
|
97217
97439
|
trustedHookStates,
|
|
97218
|
-
agentConfigs
|
|
97440
|
+
agentConfigs,
|
|
97219
97441
|
autonomousPermissions: options.autonomousPermissions !== false,
|
|
97220
97442
|
...options.reasoning === undefined ? {} : { reasoning: options.reasoning }
|
|
97221
97443
|
});
|
|
@@ -97242,20 +97464,6 @@ async function runCodexInstaller(options = {}) {
|
|
|
97242
97464
|
projectCleanup
|
|
97243
97465
|
};
|
|
97244
97466
|
}
|
|
97245
|
-
function agentNameFromToml3(fileName) {
|
|
97246
|
-
return fileName.endsWith(".toml") ? fileName.slice(0, -".toml".length) : fileName;
|
|
97247
|
-
}
|
|
97248
|
-
async function agentSourceRootsForInstall(input) {
|
|
97249
|
-
if (input.marketplace.name !== "sisyphuslabs") {
|
|
97250
|
-
return new Map(input.installed.map((plugin) => [plugin.name, plugin.path]));
|
|
97251
|
-
}
|
|
97252
|
-
const snapshotPlugins = await writeInstalledMarketplaceSnapshot({
|
|
97253
|
-
codexHome: input.codexHome,
|
|
97254
|
-
marketplace: input.marketplace,
|
|
97255
|
-
plugins: input.pluginSources
|
|
97256
|
-
});
|
|
97257
|
-
return new Map(snapshotPlugins.map((plugin) => [plugin.name, plugin.path]));
|
|
97258
|
-
}
|
|
97259
97467
|
function legacyCacheMarketplaces(marketplaceName) {
|
|
97260
97468
|
return marketplaceName === "sisyphuslabs" ? SISYPHUS_LEGACY_CACHE_MARKETPLACES : [];
|
|
97261
97469
|
}
|
|
@@ -97264,7 +97472,7 @@ function findRepoRootFromImporter(importerDir) {
|
|
|
97264
97472
|
for (let depth = 0;depth <= 7; depth += 1) {
|
|
97265
97473
|
if (isRepoRootWithCodexPlugin(current))
|
|
97266
97474
|
return current;
|
|
97267
|
-
for (const wrapperPackageRoot of [
|
|
97475
|
+
for (const wrapperPackageRoot of [join56(current, "node_modules", "oh-my-openagent"), join56(current, "oh-my-openagent")]) {
|
|
97268
97476
|
if (isRepoRootWithCodexPlugin(wrapperPackageRoot))
|
|
97269
97477
|
return wrapperPackageRoot;
|
|
97270
97478
|
}
|
|
@@ -97282,7 +97490,7 @@ function findRepoRoot(input) {
|
|
|
97282
97490
|
return findRepoRootFromImporter(input.importerDir);
|
|
97283
97491
|
}
|
|
97284
97492
|
function isRepoRootWithCodexPlugin(repoRoot) {
|
|
97285
|
-
return existsSync27(
|
|
97493
|
+
return existsSync27(join56(repoRoot, "packages", "omo-codex", "plugin", ".codex-plugin", "plugin.json"));
|
|
97286
97494
|
}
|
|
97287
97495
|
function codexMarketplaceSource(marketplaceRoot) {
|
|
97288
97496
|
return { sourceType: "local", source: marketplaceRoot };
|
|
@@ -97417,13 +97625,13 @@ function defaultRunCommand2(command, args) {
|
|
|
97417
97625
|
});
|
|
97418
97626
|
}
|
|
97419
97627
|
// packages/omo-codex/src/install/codex-cleanup.ts
|
|
97420
|
-
import { lstat as lstat15, readFile as
|
|
97628
|
+
import { lstat as lstat15, readFile as readFile27, readdir as readdir13, rm as rm14, rmdir } from "fs/promises";
|
|
97421
97629
|
import { homedir as homedir8 } from "os";
|
|
97422
|
-
import { isAbsolute as isAbsolute11, join as
|
|
97630
|
+
import { isAbsolute as isAbsolute11, join as join59, relative as relative6, resolve as resolve16 } from "path";
|
|
97423
97631
|
|
|
97424
97632
|
// packages/omo-codex/src/install/codex-cleanup-bins.ts
|
|
97425
|
-
import { lstat as lstat13, readFile as
|
|
97426
|
-
import { dirname as dirname19, isAbsolute as isAbsolute9, join as
|
|
97633
|
+
import { lstat as lstat13, readFile as readFile25, readdir as readdir12, readlink as readlink6, rm as rm13 } from "fs/promises";
|
|
97634
|
+
import { dirname as dirname19, isAbsolute as isAbsolute9, join as join57, resolve as resolve14 } from "path";
|
|
97427
97635
|
var ROOT_RUNTIME_BIN_NAME = "omo";
|
|
97428
97636
|
var MANAGED_CODEX_BIN_NAMES = new Set([
|
|
97429
97637
|
ROOT_RUNTIME_BIN_NAME,
|
|
@@ -97453,9 +97661,9 @@ async function removeManagedCodexBins(binDir, platform) {
|
|
|
97453
97661
|
const binName = managedBinNameForEntry2(entry.name, platform);
|
|
97454
97662
|
if (binName === null || !MANAGED_CODEX_BIN_NAMES.has(binName))
|
|
97455
97663
|
continue;
|
|
97456
|
-
const linkPath =
|
|
97664
|
+
const linkPath = join57(binDir, entry.name);
|
|
97457
97665
|
if (await isManagedCodexBin(linkPath, platform, binName)) {
|
|
97458
|
-
await
|
|
97666
|
+
await rm13(linkPath, { force: true });
|
|
97459
97667
|
removed.push(linkPath);
|
|
97460
97668
|
}
|
|
97461
97669
|
}
|
|
@@ -97484,12 +97692,12 @@ async function isManagedCodexBin(linkPath, platform, binName) {
|
|
|
97484
97692
|
}
|
|
97485
97693
|
if (!entryStat.isFile())
|
|
97486
97694
|
return false;
|
|
97487
|
-
const content = await
|
|
97695
|
+
const content = await readFile25(linkPath, "utf8");
|
|
97488
97696
|
return content.includes(RUNTIME_WRAPPER_MARKER) || content.includes(COMMAND_SHIM_MARKER);
|
|
97489
97697
|
}
|
|
97490
97698
|
|
|
97491
97699
|
// packages/omo-codex/src/install/codex-cleanup-config.ts
|
|
97492
|
-
import { lstat as lstat14, mkdir as mkdir8, readFile as
|
|
97700
|
+
import { lstat as lstat14, mkdir as mkdir8, readFile as readFile26, writeFile as writeFile14 } from "fs/promises";
|
|
97493
97701
|
import { dirname as dirname20 } from "path";
|
|
97494
97702
|
var MANAGED_MARKETPLACES = ["sisyphuslabs", "lazycodex", "code-yeongyu-codex-plugins"];
|
|
97495
97703
|
var LEGACY_MANAGED_CODEX_AGENT_NAMES_TO_PURGE2 = ["codex-ultrawork-reviewer"];
|
|
@@ -97522,14 +97730,14 @@ function cleanupCodexLightConfigText(config) {
|
|
|
97522
97730
|
async function cleanupCodexConfig(configPath, now) {
|
|
97523
97731
|
if (!await configExists(configPath))
|
|
97524
97732
|
return { changed: false };
|
|
97525
|
-
const original = await
|
|
97733
|
+
const original = await readFile26(configPath, "utf8");
|
|
97526
97734
|
const next = cleanupCodexLightConfigText(original);
|
|
97527
97735
|
if (next === original)
|
|
97528
97736
|
return { changed: false };
|
|
97529
97737
|
const backupPath = `${configPath}.backup-${formatBackupTimestamp2(now?.() ?? new Date)}`;
|
|
97530
97738
|
await mkdir8(dirname20(configPath), { recursive: true });
|
|
97531
|
-
await
|
|
97532
|
-
await
|
|
97739
|
+
await writeFile14(backupPath, original);
|
|
97740
|
+
await writeFile14(configPath, `${next.trimEnd()}
|
|
97533
97741
|
`);
|
|
97534
97742
|
return { changed: true, backupPath };
|
|
97535
97743
|
}
|
|
@@ -97606,7 +97814,7 @@ function nodeErrorCode5(error) {
|
|
|
97606
97814
|
}
|
|
97607
97815
|
|
|
97608
97816
|
// packages/omo-codex/src/install/codex-cleanup-safety.ts
|
|
97609
|
-
import { dirname as dirname21, isAbsolute as isAbsolute10, join as
|
|
97817
|
+
import { dirname as dirname21, isAbsolute as isAbsolute10, join as join58, relative as relative5, resolve as resolve15 } from "path";
|
|
97610
97818
|
function codexHomeResolvesToFilesystemRoot(codexHome) {
|
|
97611
97819
|
const resolved = resolve15(codexHome);
|
|
97612
97820
|
return dirname21(resolved) === resolved;
|
|
@@ -97623,11 +97831,11 @@ function validateManagedCleanupTarget(input) {
|
|
|
97623
97831
|
if (target === codexHome)
|
|
97624
97832
|
return skipped(input.path, "outside managed Codex cleanup scope");
|
|
97625
97833
|
const exactManagedRoots = new Set([
|
|
97626
|
-
resolve15(
|
|
97627
|
-
resolve15(
|
|
97628
|
-
resolve15(
|
|
97629
|
-
resolve15(
|
|
97630
|
-
resolve15(
|
|
97834
|
+
resolve15(join58(codexHome, "plugins", "cache", "sisyphuslabs")),
|
|
97835
|
+
resolve15(join58(codexHome, ".tmp", "marketplaces", "sisyphuslabs")),
|
|
97836
|
+
resolve15(join58(codexHome, "runtime", "ast-grep")),
|
|
97837
|
+
resolve15(join58(codexHome, "runtime", "node")),
|
|
97838
|
+
resolve15(join58(codexHome, "plugins", "data", "omo-sisyphuslabs", "bootstrap"))
|
|
97631
97839
|
]);
|
|
97632
97840
|
if (exactManagedRoots.has(target))
|
|
97633
97841
|
return null;
|
|
@@ -97657,8 +97865,8 @@ function skipped(path, reason) {
|
|
|
97657
97865
|
var INSTALLED_AGENTS_MANIFEST = ".installed-agents.json";
|
|
97658
97866
|
async function cleanupCodexLight(input = {}) {
|
|
97659
97867
|
const env = input.env ?? process.env;
|
|
97660
|
-
const codexHome = resolve16(input.codexHome ?? env.CODEX_HOME ??
|
|
97661
|
-
const configPath =
|
|
97868
|
+
const codexHome = resolve16(input.codexHome ?? env.CODEX_HOME ?? join59(homedir8(), ".codex"));
|
|
97869
|
+
const configPath = join59(codexHome, "config.toml");
|
|
97662
97870
|
const installedBinDir = await readInstalledCodexBinDir(codexHome);
|
|
97663
97871
|
const agentPaths = await collectInstalledAgentPaths(codexHome, configPath);
|
|
97664
97872
|
const configCleanup = await cleanupCodexConfig(configPath, input.now);
|
|
@@ -97712,17 +97920,17 @@ function firstConfiguredPath(...values) {
|
|
|
97712
97920
|
}
|
|
97713
97921
|
function managedGlobalStatePaths(codexHome) {
|
|
97714
97922
|
return [
|
|
97715
|
-
|
|
97716
|
-
|
|
97717
|
-
|
|
97718
|
-
|
|
97719
|
-
|
|
97923
|
+
join59(codexHome, "plugins", "cache", "sisyphuslabs"),
|
|
97924
|
+
join59(codexHome, ".tmp", "marketplaces", "sisyphuslabs"),
|
|
97925
|
+
join59(codexHome, "runtime", "ast-grep"),
|
|
97926
|
+
join59(codexHome, "runtime", "node"),
|
|
97927
|
+
join59(codexHome, "plugins", "data", "omo-sisyphuslabs", "bootstrap")
|
|
97720
97928
|
];
|
|
97721
97929
|
}
|
|
97722
97930
|
var BOOTSTRAP_DATA_GLOB_MAX_DEPTH = 5;
|
|
97723
97931
|
async function collectBootstrapDataDirsByGlob(codexHome) {
|
|
97724
97932
|
const results = [];
|
|
97725
|
-
await walkForManagedBootstrapDirs(
|
|
97933
|
+
await walkForManagedBootstrapDirs(join59(codexHome, "plugins"), 0, results);
|
|
97726
97934
|
return results;
|
|
97727
97935
|
}
|
|
97728
97936
|
async function walkForManagedBootstrapDirs(directory, depth, results) {
|
|
@@ -97734,9 +97942,9 @@ async function walkForManagedBootstrapDirs(directory, depth, results) {
|
|
|
97734
97942
|
for (const entry of entries) {
|
|
97735
97943
|
if (!entry.isDirectory())
|
|
97736
97944
|
continue;
|
|
97737
|
-
const childPath =
|
|
97945
|
+
const childPath = join59(directory, entry.name);
|
|
97738
97946
|
if (isManagedBootstrapOwnerName(entry.name)) {
|
|
97739
|
-
const bootstrapDir =
|
|
97947
|
+
const bootstrapDir = join59(childPath, "bootstrap");
|
|
97740
97948
|
if (await exists6(bootstrapDir))
|
|
97741
97949
|
results.push(bootstrapDir);
|
|
97742
97950
|
continue;
|
|
@@ -97762,7 +97970,7 @@ async function attemptRemove(path) {
|
|
|
97762
97970
|
try {
|
|
97763
97971
|
if (await lstat15(path).catch(() => null) === null)
|
|
97764
97972
|
return false;
|
|
97765
|
-
await
|
|
97973
|
+
await rm14(path, { recursive: true, force: true });
|
|
97766
97974
|
return true;
|
|
97767
97975
|
} catch {
|
|
97768
97976
|
return false;
|
|
@@ -97770,7 +97978,7 @@ async function attemptRemove(path) {
|
|
|
97770
97978
|
}
|
|
97771
97979
|
async function pruneEmptyRuntimeDirBestEffort(codexHome) {
|
|
97772
97980
|
try {
|
|
97773
|
-
await rmdir(
|
|
97981
|
+
await rmdir(join59(codexHome, "runtime"));
|
|
97774
97982
|
} catch (error) {
|
|
97775
97983
|
if (isExpectedRuntimePruneFailure(error))
|
|
97776
97984
|
return;
|
|
@@ -97782,14 +97990,14 @@ function isExpectedRuntimePruneFailure(error) {
|
|
|
97782
97990
|
}
|
|
97783
97991
|
async function collectInstalledAgentPaths(codexHome, configPath) {
|
|
97784
97992
|
const manifestPaths = [
|
|
97785
|
-
|
|
97993
|
+
join59(codexHome, ".tmp", "marketplaces", "sisyphuslabs", "plugins", "omo", INSTALLED_AGENTS_MANIFEST)
|
|
97786
97994
|
];
|
|
97787
|
-
const versionRoot =
|
|
97995
|
+
const versionRoot = join59(codexHome, "plugins", "cache", "sisyphuslabs", "omo");
|
|
97788
97996
|
if (await exists6(versionRoot)) {
|
|
97789
97997
|
const entries = await readdir13(versionRoot, { withFileTypes: true });
|
|
97790
97998
|
for (const entry of entries) {
|
|
97791
97999
|
if (entry.isDirectory())
|
|
97792
|
-
manifestPaths.push(
|
|
98000
|
+
manifestPaths.push(join59(versionRoot, entry.name, INSTALLED_AGENTS_MANIFEST));
|
|
97793
98001
|
}
|
|
97794
98002
|
}
|
|
97795
98003
|
const paths = new Set;
|
|
@@ -97806,19 +98014,19 @@ async function collectInstalledAgentPaths(codexHome, configPath) {
|
|
|
97806
98014
|
async function readManagedAgentPathsFromConfig(codexHome, configPath) {
|
|
97807
98015
|
if (!await exists6(configPath))
|
|
97808
98016
|
return [];
|
|
97809
|
-
const config = await
|
|
97810
|
-
return MANAGED_CODEX_AGENT_NAMES2.filter((agentName) => config.includes(`config_file = ${JSON.stringify(`./agents/${agentName}.toml`)}`)).map((agentName) =>
|
|
98017
|
+
const config = await readFile27(configPath, "utf8");
|
|
98018
|
+
return MANAGED_CODEX_AGENT_NAMES2.filter((agentName) => config.includes(`config_file = ${JSON.stringify(`./agents/${agentName}.toml`)}`)).map((agentName) => join59(codexHome, "agents", `${agentName}.toml`));
|
|
97811
98019
|
}
|
|
97812
98020
|
async function readInstalledAgentManifest(manifestPath) {
|
|
97813
98021
|
if (!await exists6(manifestPath))
|
|
97814
98022
|
return [];
|
|
97815
|
-
const parsed = JSON.parse(await
|
|
98023
|
+
const parsed = JSON.parse(await readFile27(manifestPath, "utf8"));
|
|
97816
98024
|
if (!isPlainRecord4(parsed) || !Array.isArray(parsed.agents))
|
|
97817
98025
|
return [];
|
|
97818
98026
|
return parsed.agents.filter((path) => typeof path === "string");
|
|
97819
98027
|
}
|
|
97820
98028
|
async function removeManifestListedAgentLinks(codexHome, paths) {
|
|
97821
|
-
const agentsDir =
|
|
98029
|
+
const agentsDir = join59(codexHome, "agents");
|
|
97822
98030
|
const removed = [];
|
|
97823
98031
|
const skipped = [];
|
|
97824
98032
|
for (const path of paths) {
|
|
@@ -97833,7 +98041,7 @@ async function removeManifestListedAgentLinks(codexHome, paths) {
|
|
|
97833
98041
|
skipped.push(path);
|
|
97834
98042
|
continue;
|
|
97835
98043
|
}
|
|
97836
|
-
await
|
|
98044
|
+
await rm14(path, { force: true });
|
|
97837
98045
|
removed.push(path);
|
|
97838
98046
|
}
|
|
97839
98047
|
return { removed, skipped };
|
|
@@ -97870,14 +98078,14 @@ function nodeErrorCode6(error) {
|
|
|
97870
98078
|
import { execFile as execFile3 } from "child_process";
|
|
97871
98079
|
import { existsSync as existsSync31 } from "fs";
|
|
97872
98080
|
import { homedir as homedir11 } from "os";
|
|
97873
|
-
import { dirname as dirname25, join as
|
|
98081
|
+
import { dirname as dirname25, join as join64, resolve as resolve20 } from "path";
|
|
97874
98082
|
import { fileURLToPath } from "url";
|
|
97875
98083
|
import { promisify as promisify2 } from "util";
|
|
97876
98084
|
|
|
97877
98085
|
// packages/omo-senpi/src/components/agent-home/resolve-agent-home.ts
|
|
97878
98086
|
import { existsSync as existsSync29 } from "fs";
|
|
97879
98087
|
import { homedir as homedir9 } from "os";
|
|
97880
|
-
import { join as
|
|
98088
|
+
import { join as join60, resolve as resolve17 } from "path";
|
|
97881
98089
|
var AGENT_DIR_ENV_NAMES = [
|
|
97882
98090
|
"OMO_CODING_AGENT_DIR",
|
|
97883
98091
|
"SENPI_CODING_AGENT_DIR",
|
|
@@ -97891,25 +98099,25 @@ function resolveAgentHome(options) {
|
|
|
97891
98099
|
if (configured)
|
|
97892
98100
|
return resolve17(configured);
|
|
97893
98101
|
}
|
|
97894
|
-
const brandedHome =
|
|
97895
|
-
const canonical =
|
|
97896
|
-
if (exists(
|
|
98102
|
+
const brandedHome = join60(homeDir, ".omo");
|
|
98103
|
+
const canonical = join60(brandedHome, "agent");
|
|
98104
|
+
if (exists(join60(canonical, AGENT_HOME_SENTINEL)))
|
|
97897
98105
|
return canonical;
|
|
97898
|
-
if (exists(
|
|
98106
|
+
if (exists(join60(brandedHome, AGENT_HOME_SENTINEL)))
|
|
97899
98107
|
return brandedHome;
|
|
97900
|
-
return
|
|
98108
|
+
return join60(homeDir, ".senpi", "agent");
|
|
97901
98109
|
}
|
|
97902
98110
|
|
|
97903
98111
|
// packages/omo-senpi/src/install/local-launcher.ts
|
|
97904
98112
|
import { chmodSync as chmodSync3, existsSync as existsSync30, mkdirSync as mkdirSync12, readFileSync as readFileSync14, rmSync as rmSync4, writeFileSync as writeFileSync7 } from "fs";
|
|
97905
98113
|
import { homedir as homedir10 } from "os";
|
|
97906
|
-
import { dirname as dirname22, join as
|
|
98114
|
+
import { dirname as dirname22, join as join61, resolve as resolve18 } from "path";
|
|
97907
98115
|
var MARKER = "omo-local-launcher";
|
|
97908
98116
|
function localLauncherPath(homeDir = homedir10()) {
|
|
97909
|
-
return
|
|
98117
|
+
return join61(homeDir, ".local", "bin", "omo");
|
|
97910
98118
|
}
|
|
97911
98119
|
function localLauncherCmdPath(homeDir = homedir10()) {
|
|
97912
|
-
return
|
|
98120
|
+
return join61(homeDir, ".local", "bin", "omo.cmd");
|
|
97913
98121
|
}
|
|
97914
98122
|
function releaseChannel(version) {
|
|
97915
98123
|
return version !== undefined && version.includes("-") ? "beta" : "latest";
|
|
@@ -97927,7 +98135,7 @@ function renderLocalLauncher(options) {
|
|
|
97927
98135
|
userAgent: "omo",
|
|
97928
98136
|
originator: "omo",
|
|
97929
98137
|
changelog: {
|
|
97930
|
-
path:
|
|
98138
|
+
path: join61(options.pluginPath, "CHANGELOG.md").replaceAll("\\", "/")
|
|
97931
98139
|
},
|
|
97932
98140
|
update: {
|
|
97933
98141
|
packageName: "omo-ai",
|
|
@@ -97999,8 +98207,8 @@ node "%~dp0omo" %*\r
|
|
|
97999
98207
|
// packages/omo-senpi/src/install/plugin-artifacts.ts
|
|
98000
98208
|
import { createHash as createHash6 } from "crypto";
|
|
98001
98209
|
import { constants as constants9 } from "fs";
|
|
98002
|
-
import { access as access2, readFile as
|
|
98003
|
-
import { dirname as dirname24, join as
|
|
98210
|
+
import { access as access2, readFile as readFile29, stat as stat6 } from "fs/promises";
|
|
98211
|
+
import { dirname as dirname24, join as join63 } from "path";
|
|
98004
98212
|
|
|
98005
98213
|
// packages/memory-core/src/personas/manifest.ts
|
|
98006
98214
|
var PERSONA_ASSET_FILENAMES = {
|
|
@@ -98018,18 +98226,18 @@ var PERSONA_ASSET_FILES = [
|
|
|
98018
98226
|
|
|
98019
98227
|
// packages/omo-senpi/src/install/senpi-settings.ts
|
|
98020
98228
|
import { constants as constants8 } from "fs";
|
|
98021
|
-
import { access, copyFile as copyFile3, mkdir as mkdir9, readFile as
|
|
98022
|
-
import { basename as basename10, dirname as dirname23, join as
|
|
98229
|
+
import { access, copyFile as copyFile3, mkdir as mkdir9, readFile as readFile28, rename as rename5, writeFile as writeFile15 } from "fs/promises";
|
|
98230
|
+
import { basename as basename10, dirname as dirname23, join as join62, resolve as resolve19 } from "path";
|
|
98023
98231
|
var OMO_SENPI_PACKAGE_NAME = "@code-yeongyu/omo-senpi";
|
|
98024
98232
|
var GENERATED_PLUGIN_BASENAME = /^omo-senpi-cli-plugin-[A-Za-z0-9]{6}$/;
|
|
98025
98233
|
var LEGACY_BUILTIN_SHADOW_PACKAGES = [
|
|
98026
|
-
|
|
98027
|
-
|
|
98234
|
+
join62("packages", "pi-goal"),
|
|
98235
|
+
join62("packages", "pi-webfetch")
|
|
98028
98236
|
];
|
|
98029
98237
|
async function readSettings(settingsPath) {
|
|
98030
98238
|
let raw;
|
|
98031
98239
|
try {
|
|
98032
|
-
raw = await
|
|
98240
|
+
raw = await readFile28(settingsPath, "utf8");
|
|
98033
98241
|
} catch (error) {
|
|
98034
98242
|
if (isErrno(error, "ENOENT"))
|
|
98035
98243
|
return {};
|
|
@@ -98076,11 +98284,11 @@ async function writeSettingsAtomically(settingsPath, settings) {
|
|
|
98076
98284
|
if (await fileExists(settingsPath)) {
|
|
98077
98285
|
await copyFile3(settingsPath, backupPath);
|
|
98078
98286
|
} else {
|
|
98079
|
-
await
|
|
98287
|
+
await writeFile15(backupPath, `{}
|
|
98080
98288
|
`, "utf8");
|
|
98081
98289
|
}
|
|
98082
98290
|
const tempPath = `${settingsPath}.${process.pid}.${Date.now()}.tmp`;
|
|
98083
|
-
await
|
|
98291
|
+
await writeFile15(tempPath, `${JSON.stringify(settings, null, 2)}
|
|
98084
98292
|
`, "utf8");
|
|
98085
98293
|
await rename5(tempPath, settingsPath);
|
|
98086
98294
|
return backupPath;
|
|
@@ -98103,7 +98311,7 @@ function isRecord15(value) {
|
|
|
98103
98311
|
async function readPackageName(packagePath) {
|
|
98104
98312
|
let raw;
|
|
98105
98313
|
try {
|
|
98106
|
-
raw = await
|
|
98314
|
+
raw = await readFile28(join62(packagePath, "package.json"), "utf8");
|
|
98107
98315
|
} catch (error) {
|
|
98108
98316
|
if (isErrno(error, "ENOENT") || isErrno(error, "ENOTDIR"))
|
|
98109
98317
|
return;
|
|
@@ -98135,54 +98343,54 @@ function isErrno(error, code) {
|
|
|
98135
98343
|
|
|
98136
98344
|
// packages/omo-senpi/src/install/plugin-artifacts.ts
|
|
98137
98345
|
var REQUIRED_PLUGIN_ARTIFACTS = [
|
|
98138
|
-
|
|
98139
|
-
|
|
98140
|
-
|
|
98141
|
-
|
|
98142
|
-
|
|
98143
|
-
|
|
98144
|
-
...PERSONA_ASSET_FILES.map((filename) =>
|
|
98145
|
-
|
|
98146
|
-
|
|
98147
|
-
|
|
98148
|
-
|
|
98149
|
-
|
|
98150
|
-
|
|
98151
|
-
|
|
98152
|
-
|
|
98153
|
-
|
|
98154
|
-
|
|
98155
|
-
|
|
98156
|
-
|
|
98157
|
-
|
|
98158
|
-
|
|
98159
|
-
|
|
98160
|
-
|
|
98161
|
-
|
|
98162
|
-
|
|
98163
|
-
|
|
98164
|
-
|
|
98165
|
-
|
|
98166
|
-
|
|
98167
|
-
|
|
98168
|
-
|
|
98169
|
-
|
|
98170
|
-
|
|
98171
|
-
|
|
98172
|
-
|
|
98173
|
-
|
|
98174
|
-
|
|
98346
|
+
join63("extensions", "omo.js"),
|
|
98347
|
+
join63("extensions", "omo-task.js"),
|
|
98348
|
+
join63("extensions", "omo-computer-use.js"),
|
|
98349
|
+
join63("extensions", "assets.generated.json"),
|
|
98350
|
+
join63("extensions", "omo-member.js"),
|
|
98351
|
+
join63("extensions", "memory-run-supervisor.mjs"),
|
|
98352
|
+
...PERSONA_ASSET_FILES.map((filename) => join63("extensions", filename)),
|
|
98353
|
+
join63("skills", "ast-grep", "SKILL.md"),
|
|
98354
|
+
join63("skills", "browser", "SKILL.md"),
|
|
98355
|
+
join63("skills", "coding-agent-sessions", "SKILL.md"),
|
|
98356
|
+
join63("skills", "debugging", "SKILL.md"),
|
|
98357
|
+
join63("skills", "frontend", "SKILL.md"),
|
|
98358
|
+
join63("skills", "git-master", "SKILL.md"),
|
|
98359
|
+
join63("skills", "init-deep", "SKILL.md"),
|
|
98360
|
+
join63("skills", "lsp-setup", "SKILL.md"),
|
|
98361
|
+
join63("skills", "programming", "SKILL.md"),
|
|
98362
|
+
join63("skills", "refactor", "SKILL.md"),
|
|
98363
|
+
join63("skills", "remove-ai-slops", "SKILL.md"),
|
|
98364
|
+
join63("skills", "review-work", "SKILL.md"),
|
|
98365
|
+
join63("skills", "ultimate-browsing", "SKILL.md"),
|
|
98366
|
+
join63("skills", "ultrawork", "SKILL.md"),
|
|
98367
|
+
join63("skills", "ulw-execute", "SKILL.md"),
|
|
98368
|
+
join63("skills", "ulw-loop", "SKILL.md"),
|
|
98369
|
+
join63("skills", "ulw-plan", "SKILL.md"),
|
|
98370
|
+
join63("skills", "ulw-research", "SKILL.md"),
|
|
98371
|
+
join63("skills", "visual-qa", "SKILL.md"),
|
|
98372
|
+
join63("skills-conditional", "x-search", "SKILL.md"),
|
|
98373
|
+
join63("runtime", "agent-toolkit-sdk", "sdk.js"),
|
|
98374
|
+
join63("runtime", "ast-grep-mcp", "cli.js"),
|
|
98375
|
+
join63("runtime", "lsp-daemon", "dist", "cli.js"),
|
|
98376
|
+
join63("runtime", "lsp-daemon", "dist", "index.js"),
|
|
98377
|
+
join63("runtime", "lsp-daemon", "dist", "index.d.ts"),
|
|
98378
|
+
join63("runtime", "lsp-daemon", "dist", "daemon-client.js"),
|
|
98379
|
+
join63("runtime", "lsp-daemon", "dist", "daemon-client.d.ts"),
|
|
98380
|
+
join63("runtime", "lsp-daemon", "dist", "package.json"),
|
|
98381
|
+
join63("runtime", "lsp-daemon", "dist", ".omo-runtime-manifest.json"),
|
|
98382
|
+
join63("scripts", "install.mjs"),
|
|
98175
98383
|
"daemon-launch-spec.json"
|
|
98176
98384
|
];
|
|
98177
98385
|
async function ensurePluginArtifacts(context) {
|
|
98178
98386
|
if (context.allowBuild) {
|
|
98179
|
-
await context.runCommand("node", [
|
|
98180
|
-
await context.runCommand("node", [
|
|
98181
|
-
await context.runCommand("node", [
|
|
98182
|
-
await context.runCommand("node", [
|
|
98183
|
-
await context.runCommand("node", [
|
|
98184
|
-
await context.runCommand("node", [
|
|
98185
|
-
await context.runCommand("node", [
|
|
98387
|
+
await context.runCommand("node", [join63(context.pluginPath, "scripts", "build-extension.mjs")], { cwd: context.repoRoot });
|
|
98388
|
+
await context.runCommand("node", [join63("packages", "omo-codex", "plugin", "scripts", "materialize-shared-upstreams.mjs")], { cwd: context.repoRoot });
|
|
98389
|
+
await context.runCommand("node", [join63(context.pluginPath, "scripts", "sync-skills.mjs")], { cwd: context.repoRoot });
|
|
98390
|
+
await context.runCommand("node", [join63(context.pluginPath, "scripts", "build-install.mjs")], { cwd: context.repoRoot });
|
|
98391
|
+
await context.runCommand("node", [join63(context.pluginPath, "scripts", "stage-lsp-daemon-runtime.mjs")], { cwd: context.repoRoot });
|
|
98392
|
+
await context.runCommand("node", [join63(context.pluginPath, "scripts", "stage-ast-grep-mcp-runtime.mjs")], { cwd: context.repoRoot });
|
|
98393
|
+
await context.runCommand("node", [join63(context.pluginPath, "scripts", "stage-x-search-skill.mjs")], { cwd: context.repoRoot });
|
|
98186
98394
|
}
|
|
98187
98395
|
if (await hasMissingPluginArtifact(context.pluginPath)) {
|
|
98188
98396
|
throw new Error(`Packed omo-senpi plugin is missing required runtime artifacts at ${context.pluginPath}`);
|
|
@@ -98191,14 +98399,14 @@ async function ensurePluginArtifacts(context) {
|
|
|
98191
98399
|
}
|
|
98192
98400
|
async function hasMissingPluginArtifact(pluginPath) {
|
|
98193
98401
|
for (const artifact of REQUIRED_PLUGIN_ARTIFACTS) {
|
|
98194
|
-
if (!await fileExists2(
|
|
98402
|
+
if (!await fileExists2(join63(pluginPath, artifact)))
|
|
98195
98403
|
return true;
|
|
98196
98404
|
}
|
|
98197
98405
|
return false;
|
|
98198
98406
|
}
|
|
98199
98407
|
async function verifyAstGrepRuntimeIntegrity(pluginPath, platform) {
|
|
98200
|
-
const runtimeEntry =
|
|
98201
|
-
const manifestPath =
|
|
98408
|
+
const runtimeEntry = join63(pluginPath, "runtime", "ast-grep-mcp", "cli.js");
|
|
98409
|
+
const manifestPath = join63(dirname24(runtimeEntry), "manifest.json");
|
|
98202
98410
|
let runtimeStat;
|
|
98203
98411
|
try {
|
|
98204
98412
|
runtimeStat = await stat6(runtimeEntry);
|
|
@@ -98213,7 +98421,7 @@ async function verifyAstGrepRuntimeIntegrity(pluginPath, platform) {
|
|
|
98213
98421
|
}
|
|
98214
98422
|
let manifest;
|
|
98215
98423
|
try {
|
|
98216
|
-
manifest = JSON.parse(await
|
|
98424
|
+
manifest = JSON.parse(await readFile29(manifestPath, "utf8"));
|
|
98217
98425
|
} catch (error) {
|
|
98218
98426
|
throw astGrepIntegrityError(runtimeEntry, `manifest is unreadable or invalid JSON: ${messageOf(error)}`);
|
|
98219
98427
|
}
|
|
@@ -98222,7 +98430,7 @@ async function verifyAstGrepRuntimeIntegrity(pluginPath, platform) {
|
|
|
98222
98430
|
}
|
|
98223
98431
|
let actualSha256;
|
|
98224
98432
|
try {
|
|
98225
|
-
actualSha256 = createHash6("sha256").update(await
|
|
98433
|
+
actualSha256 = createHash6("sha256").update(await readFile29(runtimeEntry)).digest("hex");
|
|
98226
98434
|
} catch (error) {
|
|
98227
98435
|
throw astGrepIntegrityError(runtimeEntry, `runtime hash could not be computed: ${messageOf(error)}`);
|
|
98228
98436
|
}
|
|
@@ -98273,7 +98481,7 @@ async function runSenpiInstaller(options = {}) {
|
|
|
98273
98481
|
const backupPath = await writeSettingsAtomically(context.settingsPath, settings);
|
|
98274
98482
|
const launcherPath = installLocalLauncher({
|
|
98275
98483
|
pluginPath: context.pluginPath,
|
|
98276
|
-
senpiCliPath:
|
|
98484
|
+
senpiCliPath: join64(context.repoRoot, "packages", "coding-agent", "dist", "cli.js"),
|
|
98277
98485
|
homeDir: context.homeDir
|
|
98278
98486
|
});
|
|
98279
98487
|
return {
|
|
@@ -98293,13 +98501,13 @@ function resolveInstallContext(options) {
|
|
|
98293
98501
|
const repoRoot = resolve20(options.repoRoot ?? (allowBuild ? findRepoRoot2(dirname25(fileURLToPath(import.meta.url))) : dirname25(resolve20(options.pluginPath))));
|
|
98294
98502
|
const homeDir = options.homeDir ?? env.HOME ?? homedir11();
|
|
98295
98503
|
const agentDir = resolve20(options.agentDir ?? resolveAgentHome({ env, homeDir }));
|
|
98296
|
-
const pluginPath = resolve20(options.pluginPath ??
|
|
98504
|
+
const pluginPath = resolve20(options.pluginPath ?? join64(repoRoot, "packages", "omo-senpi", "plugin"));
|
|
98297
98505
|
return {
|
|
98298
98506
|
env,
|
|
98299
98507
|
repoRoot,
|
|
98300
98508
|
agentDir,
|
|
98301
98509
|
homeDir,
|
|
98302
|
-
settingsPath:
|
|
98510
|
+
settingsPath: join64(agentDir, "settings.json"),
|
|
98303
98511
|
pluginPath,
|
|
98304
98512
|
platform: options.platform ?? process.platform,
|
|
98305
98513
|
allowBuild,
|
|
@@ -98316,7 +98524,7 @@ async function defaultRunCommand3(command, args, options) {
|
|
|
98316
98524
|
function findRepoRoot2(importerDir) {
|
|
98317
98525
|
let current = importerDir;
|
|
98318
98526
|
for (let depth = 0;depth <= 7; depth += 1) {
|
|
98319
|
-
if (fileExistsSync(
|
|
98527
|
+
if (fileExistsSync(join64(current, "packages", "omo-senpi", "plugin", "package.json")))
|
|
98320
98528
|
return current;
|
|
98321
98529
|
current = resolve20(current, "..");
|
|
98322
98530
|
}
|
|
@@ -98331,7 +98539,7 @@ async function runNativeDevInstaller(options) {
|
|
|
98331
98539
|
}
|
|
98332
98540
|
// packages/omo-opencode/src/cli/install-native/legacy-omo-bin.ts
|
|
98333
98541
|
import { lstatSync as lstatSync4, readFileSync as readFileSync15, realpathSync as realpathSync8, statSync as statSync4 } from "fs";
|
|
98334
|
-
import { dirname as dirname26, isAbsolute as isAbsolute12, join as
|
|
98542
|
+
import { dirname as dirname26, isAbsolute as isAbsolute12, join as join65, posix as posix9, win32 as win325 } from "path";
|
|
98335
98543
|
var NATIVE_OMO_PACKAGE = "omo-ai";
|
|
98336
98544
|
var LEGACY_OMO_BIN_PACKAGES = ["oh-my-openagent", "oh-my-opencode", "lazycodex"];
|
|
98337
98545
|
var CODEX_LIGHT_WRAPPER_MARKER = "OMO_GENERATED_RUNTIME_WRAPPER";
|
|
@@ -98396,7 +98604,7 @@ function classify(owner) {
|
|
|
98396
98604
|
}
|
|
98397
98605
|
function omoShimPathsIn(directory, isWindows) {
|
|
98398
98606
|
const suffixes = isWindows ? WINDOWS_BIN_SUFFIXES : [""];
|
|
98399
|
-
return suffixes.map((suffix) =>
|
|
98607
|
+
return suffixes.map((suffix) => join65(directory, `${OMO_BIN_NAME}${suffix}`)).filter(pathExists);
|
|
98400
98608
|
}
|
|
98401
98609
|
function pathExists(path) {
|
|
98402
98610
|
try {
|
|
@@ -98431,7 +98639,7 @@ function shimEntryPaths(shim, shimDirectory) {
|
|
|
98431
98639
|
const quoted = match[0];
|
|
98432
98640
|
const relativeToShim = quoted.match(/^(?:%~?dp0%?|\$\{?basedir\}?)[\\/]?(.*)$/)?.[1];
|
|
98433
98641
|
if (relativeToShim !== undefined)
|
|
98434
|
-
paths.push(
|
|
98642
|
+
paths.push(join65(shimDirectory, relativeToShim.replace(/\\/g, "/")));
|
|
98435
98643
|
else if (isAbsolute12(quoted))
|
|
98436
98644
|
paths.push(quoted);
|
|
98437
98645
|
}
|
|
@@ -98452,7 +98660,7 @@ function bunxEntryPaths(binPath) {
|
|
|
98452
98660
|
const end = contents.indexOf('"\x00');
|
|
98453
98661
|
if (end <= 0)
|
|
98454
98662
|
return [];
|
|
98455
|
-
return [
|
|
98663
|
+
return [join65(dirname26(dirname26(binPath)), contents.slice(0, end).replace(/\\/g, "/"))];
|
|
98456
98664
|
}
|
|
98457
98665
|
function codexLightWrapperOwner(shim) {
|
|
98458
98666
|
if (!shim.includes(CODEX_LIGHT_WRAPPER_MARKER))
|
|
@@ -98466,7 +98674,7 @@ function isInsideNodeModules(path) {
|
|
|
98466
98674
|
function ownerOfFile(file) {
|
|
98467
98675
|
let directory = dirname26(file);
|
|
98468
98676
|
for (let depth = 0;depth < OWNER_WALK_UP_LIMIT; depth += 1) {
|
|
98469
|
-
const manifest = readWholeFile(
|
|
98677
|
+
const manifest = readWholeFile(join65(directory, "package.json"));
|
|
98470
98678
|
if (manifest !== null) {
|
|
98471
98679
|
const parsed = parseManifest(manifest);
|
|
98472
98680
|
if (parsed !== null)
|
|
@@ -98764,12 +98972,12 @@ init_provider_availability();
|
|
|
98764
98972
|
|
|
98765
98973
|
// packages/omo-opencode/src/cli/config-manager/add-tui-plugin-to-tui-config.ts
|
|
98766
98974
|
import { existsSync as existsSync33, mkdirSync as mkdirSync13, readFileSync as readFileSync17 } from "fs";
|
|
98767
|
-
import { join as
|
|
98975
|
+
import { join as join67 } from "path";
|
|
98768
98976
|
|
|
98769
98977
|
// packages/omo-opencode/src/cli/doctor/checks/tui-plugin-config.ts
|
|
98770
98978
|
init_shared();
|
|
98771
98979
|
import { existsSync as existsSync32, readFileSync as readFileSync16 } from "fs";
|
|
98772
|
-
import { join as
|
|
98980
|
+
import { join as join66 } from "path";
|
|
98773
98981
|
var TUI_SUBPATH = "tui";
|
|
98774
98982
|
var TUI_EXPORT_SUBPATH = `./${TUI_SUBPATH}`;
|
|
98775
98983
|
function tuiPluginSpecName(entry) {
|
|
@@ -98789,7 +98997,7 @@ function fileEntryPackageJsonPath(entry) {
|
|
|
98789
98997
|
let path = entry.slice("file:".length);
|
|
98790
98998
|
if (path.startsWith("//"))
|
|
98791
98999
|
path = path.slice(2);
|
|
98792
|
-
return
|
|
99000
|
+
return join66(path, "package.json");
|
|
98793
99001
|
}
|
|
98794
99002
|
function packageJsonExportsTui(pkgJsonPath) {
|
|
98795
99003
|
if (!existsSync32(pkgJsonPath))
|
|
@@ -98828,7 +99036,7 @@ function packageExportsTuiForServerEntry(entry) {
|
|
|
98828
99036
|
const packageName = packageNameFromServerEntry(entry);
|
|
98829
99037
|
if (packageName === null)
|
|
98830
99038
|
return null;
|
|
98831
|
-
return packageJsonExportsTui(
|
|
99039
|
+
return packageJsonExportsTui(join66(getOpenCodeConfigDir({ binary: "opencode" }), "node_modules", packageName, "package.json"));
|
|
98832
99040
|
}
|
|
98833
99041
|
function isOurFilePluginEntry(entry) {
|
|
98834
99042
|
if (typeof entry !== "string" || !entry.startsWith("file:"))
|
|
@@ -98915,7 +99123,7 @@ function detectServerPluginRegistration() {
|
|
|
98915
99123
|
}
|
|
98916
99124
|
}
|
|
98917
99125
|
function detectTuiPluginRegistration() {
|
|
98918
|
-
const tuiJsonPath =
|
|
99126
|
+
const tuiJsonPath = join66(getOpenCodeConfigDir({ binary: "opencode" }), "tui.json");
|
|
98919
99127
|
if (!existsSync32(tuiJsonPath)) {
|
|
98920
99128
|
return {
|
|
98921
99129
|
registered: false,
|
|
@@ -99091,10 +99299,10 @@ function readConfig(path) {
|
|
|
99091
99299
|
return null;
|
|
99092
99300
|
}
|
|
99093
99301
|
function readServerConfig(configDir) {
|
|
99094
|
-
const jsoncPath =
|
|
99302
|
+
const jsoncPath = join67(configDir, "opencode.jsonc");
|
|
99095
99303
|
if (existsSync33(jsoncPath))
|
|
99096
99304
|
return readConfig(jsoncPath);
|
|
99097
|
-
const jsonPath =
|
|
99305
|
+
const jsonPath = join67(configDir, "opencode.json");
|
|
99098
99306
|
if (existsSync33(jsonPath))
|
|
99099
99307
|
return readConfig(jsonPath);
|
|
99100
99308
|
return null;
|
|
@@ -99151,7 +99359,7 @@ function ensureTuiPluginEntry(opts = {}) {
|
|
|
99151
99359
|
if (!desiredEntry) {
|
|
99152
99360
|
return { changed: false, reason: "no-server-entry" };
|
|
99153
99361
|
}
|
|
99154
|
-
const tuiJsonPath =
|
|
99362
|
+
const tuiJsonPath = join67(configDir, "tui.json");
|
|
99155
99363
|
const { config, malformed } = readTuiConfig(tuiJsonPath);
|
|
99156
99364
|
if (malformed || pluginFieldInvalid(config)) {
|
|
99157
99365
|
return { changed: false, reason: "malformed" };
|
|
@@ -99172,10 +99380,10 @@ function ensureTuiPluginEntry(opts = {}) {
|
|
|
99172
99380
|
init_shared();
|
|
99173
99381
|
init_config_context();
|
|
99174
99382
|
import { existsSync as existsSync34, readFileSync as readFileSync18 } from "fs";
|
|
99175
|
-
import { join as
|
|
99383
|
+
import { join as join68 } from "path";
|
|
99176
99384
|
function readPluginEntries(configDir) {
|
|
99177
99385
|
for (const name of ["opencode.jsonc", "opencode.json"]) {
|
|
99178
|
-
const configPath =
|
|
99386
|
+
const configPath = join68(configDir, name);
|
|
99179
99387
|
if (!existsSync34(configPath))
|
|
99180
99388
|
continue;
|
|
99181
99389
|
try {
|
|
@@ -99223,7 +99431,7 @@ function refreshOpenCodePluginSandboxes(options = {}) {
|
|
|
99223
99431
|
|
|
99224
99432
|
// packages/omo-opencode/src/cli/install-ast-grep-sg.ts
|
|
99225
99433
|
import { homedir as homedir13 } from "os";
|
|
99226
|
-
import { join as
|
|
99434
|
+
import { join as join69 } from "path";
|
|
99227
99435
|
|
|
99228
99436
|
// packages/shared-skills/index.mjs
|
|
99229
99437
|
import { existsSync as existsSync35 } from "fs";
|
|
@@ -99245,9 +99453,9 @@ function describeResult2(result) {
|
|
|
99245
99453
|
}
|
|
99246
99454
|
async function installAstGrepForOpenCode(options = {}) {
|
|
99247
99455
|
const platform = options.platform ?? process.platform;
|
|
99248
|
-
const baseDir =
|
|
99456
|
+
const baseDir = join69(options.homeDir ?? homedir13(), ".omo");
|
|
99249
99457
|
const targetDir = astGrepRuntimeDir(baseDir, platform, options.arch ?? process.arch);
|
|
99250
|
-
const skillDir =
|
|
99458
|
+
const skillDir = join69(options.sharedSkillsRoot ?? sharedSkillsRootPath(), "ast-grep");
|
|
99251
99459
|
const installer = options.installer ?? runAstGrepSkillInstall;
|
|
99252
99460
|
try {
|
|
99253
99461
|
const result = await installer({ platform, skillDir, targetDir });
|
|
@@ -103610,9 +103818,9 @@ function readCurrentTopLevelTask(planPath) {
|
|
|
103610
103818
|
}
|
|
103611
103819
|
// packages/boulder-state/src/storage/path.ts
|
|
103612
103820
|
import { existsSync as existsSync37 } from "fs";
|
|
103613
|
-
import { isAbsolute as isAbsolute13, join as
|
|
103821
|
+
import { isAbsolute as isAbsolute13, join as join70, relative as relative8, resolve as resolve21 } from "path";
|
|
103614
103822
|
function getBoulderFilePath(directory) {
|
|
103615
|
-
return
|
|
103823
|
+
return join70(directory, BOULDER_DIR, BOULDER_FILE);
|
|
103616
103824
|
}
|
|
103617
103825
|
function resolveTrackedPath(baseDirectory, trackedPath) {
|
|
103618
103826
|
return isAbsolute13(trackedPath) ? resolve21(trackedPath) : resolve21(baseDirectory, trackedPath);
|
|
@@ -103797,9 +104005,9 @@ init_state();
|
|
|
103797
104005
|
var CONTINUATION_MARKER_DIR = ".omo/run-continuation";
|
|
103798
104006
|
// packages/omo-opencode/src/features/run-continuation-state/storage.ts
|
|
103799
104007
|
import { existsSync as existsSync40, mkdirSync as mkdirSync14, readFileSync as readFileSync22, rmSync as rmSync6, writeFileSync as writeFileSync8 } from "fs";
|
|
103800
|
-
import { join as
|
|
104008
|
+
import { join as join71 } from "path";
|
|
103801
104009
|
function getMarkerPath(directory, sessionID) {
|
|
103802
|
-
return
|
|
104010
|
+
return join71(directory, CONTINUATION_MARKER_DIR, `${sessionID}.json`);
|
|
103803
104011
|
}
|
|
103804
104012
|
function readContinuationMarker(directory, sessionID) {
|
|
103805
104013
|
const markerPath = getMarkerPath(directory, sessionID);
|
|
@@ -103872,7 +104080,7 @@ async function isSessionInBoulderLineage(input) {
|
|
|
103872
104080
|
init_shared();
|
|
103873
104081
|
init_compaction_marker();
|
|
103874
104082
|
import { readFileSync as readFileSync23, readdirSync as readdirSync10 } from "fs";
|
|
103875
|
-
import { join as
|
|
104083
|
+
import { join as join72 } from "path";
|
|
103876
104084
|
var defaultSessionLastAgentDeps = {
|
|
103877
104085
|
getMessageDir,
|
|
103878
104086
|
isSqliteBackend,
|
|
@@ -103932,7 +104140,7 @@ async function getLastAgentFromSession(sessionID, client, deps = {}) {
|
|
|
103932
104140
|
try {
|
|
103933
104141
|
const messages = readdirSync10(messageDir).filter((fileName) => fileName.endsWith(".json")).map((fileName) => {
|
|
103934
104142
|
try {
|
|
103935
|
-
const content = readFileSync23(
|
|
104143
|
+
const content = readFileSync23(join72(messageDir, fileName), "utf-8");
|
|
103936
104144
|
const parsed = JSON.parse(content);
|
|
103937
104145
|
return {
|
|
103938
104146
|
fileName,
|
|
@@ -103976,7 +104184,7 @@ init_agent_display_names();
|
|
|
103976
104184
|
// packages/omo-opencode/src/hooks/ralph-loop/storage.ts
|
|
103977
104185
|
init_frontmatter2();
|
|
103978
104186
|
import { existsSync as existsSync41, readFileSync as readFileSync24, writeFileSync as writeFileSync9, unlinkSync as unlinkSync6, mkdirSync as mkdirSync15 } from "fs";
|
|
103979
|
-
import { dirname as dirname28, join as
|
|
104187
|
+
import { dirname as dirname28, join as join73 } from "path";
|
|
103980
104188
|
|
|
103981
104189
|
// packages/omo-opencode/src/hooks/ralph-loop/constants.ts
|
|
103982
104190
|
var DEFAULT_STATE_FILE = ".omo/ralph-loop.local.md";
|
|
@@ -103985,7 +104193,7 @@ var DEFAULT_COMPLETION_PROMISE = "DONE";
|
|
|
103985
104193
|
|
|
103986
104194
|
// packages/omo-opencode/src/hooks/ralph-loop/storage.ts
|
|
103987
104195
|
function getStateFilePath(directory, customPath) {
|
|
103988
|
-
return customPath ?
|
|
104196
|
+
return customPath ? join73(directory, customPath) : join73(directory, DEFAULT_STATE_FILE);
|
|
103989
104197
|
}
|
|
103990
104198
|
function readState(directory, customPath) {
|
|
103991
104199
|
const filePath = getStateFilePath(directory, customPath);
|
|
@@ -105092,7 +105300,7 @@ init_extract_semver();
|
|
|
105092
105300
|
init_bun_which_shim();
|
|
105093
105301
|
import { existsSync as existsSync49, accessSync as accessSync4, constants as constants12 } from "fs";
|
|
105094
105302
|
import { homedir as homedir16 } from "os";
|
|
105095
|
-
import { join as
|
|
105303
|
+
import { join as join80 } from "path";
|
|
105096
105304
|
|
|
105097
105305
|
// packages/omo-opencode/src/cli/doctor/framework/spawn-with-timeout.ts
|
|
105098
105306
|
init_spawn_with_windows_hide();
|
|
@@ -105184,17 +105392,17 @@ function getDesktopAppPaths(platform) {
|
|
|
105184
105392
|
case "darwin":
|
|
105185
105393
|
return [
|
|
105186
105394
|
"/Applications/OpenCode.app/Contents/MacOS/OpenCode",
|
|
105187
|
-
|
|
105395
|
+
join80(home, "Applications", "OpenCode.app", "Contents", "MacOS", "OpenCode")
|
|
105188
105396
|
];
|
|
105189
105397
|
case "win32": {
|
|
105190
105398
|
const programFiles = process.env.ProgramFiles;
|
|
105191
105399
|
const localAppData = process.env.LOCALAPPDATA;
|
|
105192
105400
|
const paths = [];
|
|
105193
105401
|
if (programFiles) {
|
|
105194
|
-
paths.push(
|
|
105402
|
+
paths.push(join80(programFiles, "OpenCode", "OpenCode.exe"));
|
|
105195
105403
|
}
|
|
105196
105404
|
if (localAppData) {
|
|
105197
|
-
paths.push(
|
|
105405
|
+
paths.push(join80(localAppData, "OpenCode", "OpenCode.exe"));
|
|
105198
105406
|
}
|
|
105199
105407
|
return paths;
|
|
105200
105408
|
}
|
|
@@ -105202,8 +105410,8 @@ function getDesktopAppPaths(platform) {
|
|
|
105202
105410
|
return [
|
|
105203
105411
|
"/usr/bin/opencode",
|
|
105204
105412
|
"/usr/lib/opencode/opencode",
|
|
105205
|
-
|
|
105206
|
-
|
|
105413
|
+
join80(home, "Applications", "opencode-desktop-linux-x86_64.AppImage"),
|
|
105414
|
+
join80(home, "Applications", "opencode-desktop-linux-aarch64.AppImage")
|
|
105207
105415
|
];
|
|
105208
105416
|
default:
|
|
105209
105417
|
return [];
|
|
@@ -105235,7 +105443,7 @@ async function findOpenCodeBinary(platform = process.platform, checkExists = exi
|
|
|
105235
105443
|
const candidates = getCommandCandidates2(platform);
|
|
105236
105444
|
for (const entry of pathEnv.split(delimiter).filter(Boolean)) {
|
|
105237
105445
|
for (const command of candidates) {
|
|
105238
|
-
const fullPath =
|
|
105446
|
+
const fullPath = join80(entry, command);
|
|
105239
105447
|
if (checkExists(fullPath) && isExecutable2(fullPath)) {
|
|
105240
105448
|
return { binary: command, path: fullPath };
|
|
105241
105449
|
}
|
|
@@ -105379,22 +105587,22 @@ init_package_json_locator();
|
|
|
105379
105587
|
import { existsSync as existsSync51, readFileSync as readFileSync33, readdirSync as readdirSync12 } from "fs";
|
|
105380
105588
|
import { createRequire } from "module";
|
|
105381
105589
|
import { homedir as homedir17 } from "os";
|
|
105382
|
-
import { join as
|
|
105590
|
+
import { join as join81 } from "path";
|
|
105383
105591
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
105384
105592
|
init_shared();
|
|
105385
105593
|
function getPlatformDefaultCacheDir(platform = process.platform) {
|
|
105386
105594
|
if (platform === "darwin")
|
|
105387
|
-
return
|
|
105595
|
+
return join81(homedir17(), "Library", "Caches");
|
|
105388
105596
|
if (platform === "win32")
|
|
105389
|
-
return process.env.LOCALAPPDATA ??
|
|
105390
|
-
return
|
|
105597
|
+
return process.env.LOCALAPPDATA ?? join81(homedir17(), "AppData", "Local");
|
|
105598
|
+
return join81(homedir17(), ".cache");
|
|
105391
105599
|
}
|
|
105392
105600
|
function resolveOpenCodeCacheDir() {
|
|
105393
105601
|
const xdgCacheHome = process.env.XDG_CACHE_HOME;
|
|
105394
105602
|
if (xdgCacheHome)
|
|
105395
|
-
return
|
|
105603
|
+
return join81(xdgCacheHome, "opencode");
|
|
105396
105604
|
const fromShared = getOpenCodeCacheDir();
|
|
105397
|
-
const platformDefault =
|
|
105605
|
+
const platformDefault = join81(getPlatformDefaultCacheDir(), "opencode");
|
|
105398
105606
|
if (existsSync51(fromShared) || !existsSync51(platformDefault))
|
|
105399
105607
|
return fromShared;
|
|
105400
105608
|
return platformDefault;
|
|
@@ -105426,11 +105634,11 @@ function normalizeVersion(value) {
|
|
|
105426
105634
|
function createPackageCandidates(rootDir) {
|
|
105427
105635
|
return ACCEPTED_PACKAGE_NAMES.map((packageName) => ({
|
|
105428
105636
|
packageName,
|
|
105429
|
-
installedPackagePath:
|
|
105637
|
+
installedPackagePath: join81(rootDir, "node_modules", packageName, "package.json")
|
|
105430
105638
|
}));
|
|
105431
105639
|
}
|
|
105432
105640
|
function createTaggedInstallCandidates(rootDir) {
|
|
105433
|
-
const packagesDir =
|
|
105641
|
+
const packagesDir = join81(rootDir, "packages");
|
|
105434
105642
|
if (!existsSync51(packagesDir))
|
|
105435
105643
|
return [];
|
|
105436
105644
|
const candidates = [];
|
|
@@ -105438,14 +105646,14 @@ function createTaggedInstallCandidates(rootDir) {
|
|
|
105438
105646
|
const packageName = ACCEPTED_PACKAGE_NAMES.find((name) => entryName.startsWith(`${name}@`));
|
|
105439
105647
|
if (packageName === undefined)
|
|
105440
105648
|
continue;
|
|
105441
|
-
const installDir =
|
|
105649
|
+
const installDir = join81(packagesDir, entryName);
|
|
105442
105650
|
candidates.push({
|
|
105443
105651
|
cacheDir: installDir,
|
|
105444
|
-
cachePackagePath:
|
|
105652
|
+
cachePackagePath: join81(installDir, "package.json"),
|
|
105445
105653
|
packageCandidates: [
|
|
105446
105654
|
{
|
|
105447
105655
|
packageName,
|
|
105448
|
-
installedPackagePath:
|
|
105656
|
+
installedPackagePath: join81(installDir, "node_modules", packageName, "package.json")
|
|
105449
105657
|
}
|
|
105450
105658
|
]
|
|
105451
105659
|
});
|
|
@@ -105490,13 +105698,13 @@ function getLoadedPluginVersion() {
|
|
|
105490
105698
|
const candidates = [
|
|
105491
105699
|
{
|
|
105492
105700
|
cacheDir: configDir,
|
|
105493
|
-
cachePackagePath:
|
|
105701
|
+
cachePackagePath: join81(configDir, "package.json"),
|
|
105494
105702
|
packageCandidates: createPackageCandidates(configDir)
|
|
105495
105703
|
},
|
|
105496
105704
|
...createTaggedInstallCandidates(configDir),
|
|
105497
105705
|
{
|
|
105498
105706
|
cacheDir,
|
|
105499
|
-
cachePackagePath:
|
|
105707
|
+
cachePackagePath: join81(cacheDir, "package.json"),
|
|
105500
105708
|
packageCandidates: createPackageCandidates(cacheDir)
|
|
105501
105709
|
},
|
|
105502
105710
|
...createTaggedInstallCandidates(cacheDir)
|
|
@@ -105689,18 +105897,18 @@ async function checkSystem(deps = defaultDeps5) {
|
|
|
105689
105897
|
init_shared();
|
|
105690
105898
|
import { existsSync as existsSync53, readFileSync as readFileSync35 } from "fs";
|
|
105691
105899
|
import { homedir as homedir18 } from "os";
|
|
105692
|
-
import { join as
|
|
105900
|
+
import { join as join82 } from "path";
|
|
105693
105901
|
function getUserConfigDir2() {
|
|
105694
105902
|
const xdgConfig = process.env.XDG_CONFIG_HOME;
|
|
105695
105903
|
if (xdgConfig)
|
|
105696
|
-
return
|
|
105697
|
-
return
|
|
105904
|
+
return join82(xdgConfig, "opencode");
|
|
105905
|
+
return join82(homedir18(), ".config", "opencode");
|
|
105698
105906
|
}
|
|
105699
105907
|
function loadCustomProviderNames() {
|
|
105700
105908
|
const configDir = getUserConfigDir2();
|
|
105701
105909
|
const candidatePaths = [
|
|
105702
|
-
|
|
105703
|
-
|
|
105910
|
+
join82(configDir, "opencode.json"),
|
|
105911
|
+
join82(configDir, "opencode.jsonc")
|
|
105704
105912
|
];
|
|
105705
105913
|
for (const configPath of candidatePaths) {
|
|
105706
105914
|
if (!existsSync53(configPath))
|
|
@@ -105721,7 +105929,7 @@ function loadCustomProviderNames() {
|
|
|
105721
105929
|
return [];
|
|
105722
105930
|
}
|
|
105723
105931
|
function loadAvailableModelsFromCache() {
|
|
105724
|
-
const cacheFile =
|
|
105932
|
+
const cacheFile = join82(getOpenCodeCacheDir(), "models.json");
|
|
105725
105933
|
const customProviders = loadCustomProviderNames();
|
|
105726
105934
|
if (!existsSync53(cacheFile)) {
|
|
105727
105935
|
if (customProviders.length > 0) {
|
|
@@ -105783,7 +105991,7 @@ function loadOmoConfig2() {
|
|
|
105783
105991
|
|
|
105784
105992
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-details.ts
|
|
105785
105993
|
init_shared();
|
|
105786
|
-
import { join as
|
|
105994
|
+
import { join as join83 } from "path";
|
|
105787
105995
|
|
|
105788
105996
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-variant.ts
|
|
105789
105997
|
function formatModelWithVariant(model, variant) {
|
|
@@ -105825,7 +106033,7 @@ function formatCapabilityResolutionLabel(mode) {
|
|
|
105825
106033
|
}
|
|
105826
106034
|
function buildModelResolutionDetails(options) {
|
|
105827
106035
|
const details = [];
|
|
105828
|
-
const cacheFile =
|
|
106036
|
+
const cacheFile = join83(getOpenCodeCacheDir(), "models.json");
|
|
105829
106037
|
details.push("\u2550\u2550\u2550 Available Models (from cache) \u2550\u2550\u2550");
|
|
105830
106038
|
details.push("");
|
|
105831
106039
|
if (options.available.cacheExists) {
|
|
@@ -106166,7 +106374,7 @@ init_src4();
|
|
|
106166
106374
|
init_main();
|
|
106167
106375
|
init_config_migration();
|
|
106168
106376
|
import { existsSync as existsSync54, readFileSync as readFileSync36 } from "fs";
|
|
106169
|
-
import { join as
|
|
106377
|
+
import { join as join84 } from "path";
|
|
106170
106378
|
var CANONICAL_REPLACEMENT = new Map([
|
|
106171
106379
|
["variant", "reasoning"],
|
|
106172
106380
|
["reasoningEffort", "reasoning"],
|
|
@@ -106227,7 +106435,7 @@ function userConfigPaths() {
|
|
|
106227
106435
|
const home = process.env.HOME ?? process.env.USERPROFILE;
|
|
106228
106436
|
if (home === undefined || home.length === 0)
|
|
106229
106437
|
return [];
|
|
106230
|
-
return [
|
|
106438
|
+
return [join84(home, ".omo", "omo.jsonc"), join84(home, ".omo", "omo.json")];
|
|
106231
106439
|
}
|
|
106232
106440
|
async function checkDeprecatedReasoningKeys() {
|
|
106233
106441
|
const issues = [];
|
|
@@ -106253,13 +106461,13 @@ init_src();
|
|
|
106253
106461
|
import { existsSync as existsSync55 } from "fs";
|
|
106254
106462
|
import { createRequire as createRequire2 } from "module";
|
|
106255
106463
|
import { homedir as homedir20 } from "os";
|
|
106256
|
-
import { dirname as dirname33, join as
|
|
106464
|
+
import { dirname as dirname33, join as join88 } from "path";
|
|
106257
106465
|
|
|
106258
106466
|
// packages/omo-opencode/src/hooks/comment-checker/downloader.ts
|
|
106259
|
-
import { join as
|
|
106467
|
+
import { join as join87 } from "path";
|
|
106260
106468
|
import { homedir as homedir19, tmpdir as tmpdir4 } from "os";
|
|
106261
106469
|
// packages/comment-checker-core/src/release.ts
|
|
106262
|
-
import { join as
|
|
106470
|
+
import { join as join85 } from "path";
|
|
106263
106471
|
var COMMENT_CHECKER_RELEASE_VERSION = "0.8.0";
|
|
106264
106472
|
function commentCheckerBinaryName(platform) {
|
|
106265
106473
|
return platform === "win32" ? "comment-checker.exe" : "comment-checker";
|
|
@@ -106267,19 +106475,19 @@ function commentCheckerBinaryName(platform) {
|
|
|
106267
106475
|
function commentCheckerCacheDir(input) {
|
|
106268
106476
|
if (input.platform === "win32") {
|
|
106269
106477
|
const localAppData = input.env.LOCALAPPDATA || input.env.APPDATA;
|
|
106270
|
-
const base = localAppData ||
|
|
106271
|
-
return
|
|
106478
|
+
const base = localAppData || join85(input.homedir, "AppData", "Local");
|
|
106479
|
+
return join85(base, input.cacheDirName, "bin");
|
|
106272
106480
|
}
|
|
106273
|
-
const base = input.env.XDG_CACHE_HOME ||
|
|
106274
|
-
return
|
|
106481
|
+
const base = input.env.XDG_CACHE_HOME || join85(input.homedir, ".cache");
|
|
106482
|
+
return join85(base, input.cacheDirName, "bin");
|
|
106275
106483
|
}
|
|
106276
106484
|
// packages/comment-checker-core/src/cached-release.ts
|
|
106277
106485
|
import { readFileSync as readFileSync37, writeFileSync as writeFileSync12 } from "fs";
|
|
106278
|
-
import { join as
|
|
106486
|
+
import { join as join86 } from "path";
|
|
106279
106487
|
var COMMENT_CHECKER_VERSION_MARKER = "comment-checker.version";
|
|
106280
106488
|
function isCachedCommentCheckerCurrent(cacheDir, readFile = (path) => readFileSync37(path, "utf-8")) {
|
|
106281
106489
|
try {
|
|
106282
|
-
return readFile(
|
|
106490
|
+
return readFile(join86(cacheDir, COMMENT_CHECKER_VERSION_MARKER)).trim() === COMMENT_CHECKER_RELEASE_VERSION;
|
|
106283
106491
|
} catch {
|
|
106284
106492
|
return false;
|
|
106285
106493
|
}
|
|
@@ -106289,7 +106497,7 @@ init_binary_downloader();
|
|
|
106289
106497
|
init_logger2();
|
|
106290
106498
|
init_plugin_identity();
|
|
106291
106499
|
var DEBUG = process.env.COMMENT_CHECKER_DEBUG === "1";
|
|
106292
|
-
var DEBUG_FILE =
|
|
106500
|
+
var DEBUG_FILE = join87(tmpdir4(), "comment-checker-debug.log");
|
|
106293
106501
|
function getCacheDir2() {
|
|
106294
106502
|
return commentCheckerCacheDir({
|
|
106295
106503
|
platform: process.platform,
|
|
@@ -106348,7 +106556,7 @@ async function getBinaryVersion(binary) {
|
|
|
106348
106556
|
}
|
|
106349
106557
|
}
|
|
106350
106558
|
async function checkAstGrepCli() {
|
|
106351
|
-
const runtimeDir = astGrepRuntimeDir(
|
|
106559
|
+
const runtimeDir = astGrepRuntimeDir(join88(homedir20(), ".omo"));
|
|
106352
106560
|
const sgPath = findSgBinarySync({ runtimeDir });
|
|
106353
106561
|
if (sgPath === null) {
|
|
106354
106562
|
return {
|
|
@@ -106378,10 +106586,10 @@ function findCommentCheckerPackageBinary(baseDirOverride, resolvePackageJsonPath
|
|
|
106378
106586
|
const platformKey = `${process.platform}-${process.arch === "x64" ? "x64" : process.arch}`;
|
|
106379
106587
|
try {
|
|
106380
106588
|
const packageDir = baseDirOverride ?? dirname33(resolvePackageJsonPath());
|
|
106381
|
-
const vendorPath =
|
|
106589
|
+
const vendorPath = join88(packageDir, "vendor", platformKey, binaryName);
|
|
106382
106590
|
if (existsSync55(vendorPath))
|
|
106383
106591
|
return vendorPath;
|
|
106384
|
-
const binPath =
|
|
106592
|
+
const binPath = join88(packageDir, "bin", binaryName);
|
|
106385
106593
|
if (existsSync55(binPath))
|
|
106386
106594
|
return binPath;
|
|
106387
106595
|
} catch (error) {
|
|
@@ -106757,13 +106965,13 @@ function getInstalledLspServers(options = {}) {
|
|
|
106757
106965
|
init_shared();
|
|
106758
106966
|
import { existsSync as existsSync57, readFileSync as readFileSync39 } from "fs";
|
|
106759
106967
|
import { homedir as homedir21 } from "os";
|
|
106760
|
-
import { join as
|
|
106968
|
+
import { join as join89 } from "path";
|
|
106761
106969
|
var BUILTIN_MCP_SERVERS = ["websearch", "context7", "grep_app", "lsp"];
|
|
106762
106970
|
function getMcpConfigPaths() {
|
|
106763
106971
|
return [
|
|
106764
|
-
|
|
106765
|
-
|
|
106766
|
-
|
|
106972
|
+
join89(homedir21(), ".claude", ".mcp.json"),
|
|
106973
|
+
join89(process.cwd(), ".mcp.json"),
|
|
106974
|
+
join89(process.cwd(), ".claude", ".mcp.json")
|
|
106767
106975
|
];
|
|
106768
106976
|
}
|
|
106769
106977
|
function loadUserMcpConfig() {
|
|
@@ -107043,9 +107251,9 @@ async function pathExists2(dir) {
|
|
|
107043
107251
|
// packages/omo-opencode/src/cli/doctor/checks/codex.ts
|
|
107044
107252
|
init_src();
|
|
107045
107253
|
import { existsSync as existsSync59 } from "fs";
|
|
107046
|
-
import { lstat as lstat16, readdir as readdir14, readFile as
|
|
107254
|
+
import { lstat as lstat16, readdir as readdir14, readFile as readFile30 } from "fs/promises";
|
|
107047
107255
|
import { homedir as homedir23 } from "os";
|
|
107048
|
-
import { basename as basename12, join as
|
|
107256
|
+
import { basename as basename12, join as join90, resolve as resolve24 } from "path";
|
|
107049
107257
|
// packages/omo-opencode/package.json
|
|
107050
107258
|
var package_default3 = {
|
|
107051
107259
|
name: "@oh-my-opencode/omo-opencode",
|
|
@@ -107115,13 +107323,13 @@ var CODEX_BIN_NAMES = [
|
|
|
107115
107323
|
"omo-git-bash-hook"
|
|
107116
107324
|
];
|
|
107117
107325
|
async function gatherCodexSummary(deps = {}) {
|
|
107118
|
-
const codexHome = resolve24(deps.codexHome ?? process.env.CODEX_HOME ??
|
|
107326
|
+
const codexHome = resolve24(deps.codexHome ?? process.env.CODEX_HOME ?? join90(homedir23(), ".codex"));
|
|
107119
107327
|
const binDir = resolveCodexInstallerBinDir({ binDir: deps.binDir, codexHome, env: process.env });
|
|
107120
107328
|
const detection = await (deps.detectCodexInstallation ?? detectCodexInstallation)();
|
|
107121
107329
|
const pluginRoot = await resolveInstalledPluginRoot(codexHome);
|
|
107122
|
-
const manifest = pluginRoot === null ? null : await readJson(
|
|
107123
|
-
const installSnapshot = pluginRoot === null ? null : await readJson(
|
|
107124
|
-
const configPath =
|
|
107330
|
+
const manifest = pluginRoot === null ? null : await readJson(join90(pluginRoot, ".codex-plugin", "plugin.json"));
|
|
107331
|
+
const installSnapshot = pluginRoot === null ? null : await readJson(join90(pluginRoot, "lazycodex-install.json"));
|
|
107332
|
+
const configPath = join90(codexHome, "config.toml");
|
|
107125
107333
|
const pluginVersion = stringField(manifest, "version");
|
|
107126
107334
|
return {
|
|
107127
107335
|
codexPath: detection.found && "path" in detection ? detection.path : null,
|
|
@@ -107178,7 +107386,7 @@ function buildCodexIssues(summary) {
|
|
|
107178
107386
|
if (summary.pluginRoot === null) {
|
|
107179
107387
|
issues.push({
|
|
107180
107388
|
title: "OMO Codex plugin is not installed",
|
|
107181
|
-
description: `Expected cached plugin at ${
|
|
107389
|
+
description: `Expected cached plugin at ${join90("plugins", "cache", MARKETPLACE_NAME, PLUGIN_NAME2, DEFAULT_PLUGIN_VERSION)} under CODEX_HOME.`,
|
|
107182
107390
|
fix: "Run: npx lazycodex-ai install",
|
|
107183
107391
|
severity: "error",
|
|
107184
107392
|
affects: ["plugin loading"]
|
|
@@ -107243,12 +107451,12 @@ function buildCodexIssues(summary) {
|
|
|
107243
107451
|
return issues;
|
|
107244
107452
|
}
|
|
107245
107453
|
async function resolveInstalledPluginRoot(codexHome) {
|
|
107246
|
-
const pluginRoot =
|
|
107454
|
+
const pluginRoot = join90(codexHome, "plugins", "cache", MARKETPLACE_NAME, PLUGIN_NAME2);
|
|
107247
107455
|
if (!existsSync59(pluginRoot))
|
|
107248
107456
|
return null;
|
|
107249
107457
|
const versions = await readdir14(pluginRoot, { withFileTypes: true });
|
|
107250
107458
|
const candidates = versions.filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort(compareVersionsDescending);
|
|
107251
|
-
return candidates.length === 0 ? null :
|
|
107459
|
+
return candidates.length === 0 ? null : join90(pluginRoot, candidates[0] ?? DEFAULT_PLUGIN_VERSION);
|
|
107252
107460
|
}
|
|
107253
107461
|
async function readCodexConfigSummary(configPath) {
|
|
107254
107462
|
if (!existsSync59(configPath)) {
|
|
@@ -107262,7 +107470,7 @@ async function readCodexConfigSummary(configPath) {
|
|
|
107262
107470
|
companionLifecycleHookStateEvents: []
|
|
107263
107471
|
};
|
|
107264
107472
|
}
|
|
107265
|
-
const content = await
|
|
107473
|
+
const content = await readFile30(configPath, "utf8");
|
|
107266
107474
|
return {
|
|
107267
107475
|
exists: true,
|
|
107268
107476
|
marketplaceConfigured: content.includes("[marketplaces.sisyphuslabs]"),
|
|
@@ -107276,13 +107484,13 @@ async function readCodexConfigSummary(configPath) {
|
|
|
107276
107484
|
async function readLinkedBins(binDir) {
|
|
107277
107485
|
const linked = [];
|
|
107278
107486
|
for (const name of CODEX_BIN_NAMES) {
|
|
107279
|
-
if (await pathExists3(
|
|
107487
|
+
if (await pathExists3(join90(binDir, process.platform === "win32" ? `${name}.cmd` : name)))
|
|
107280
107488
|
linked.push(name);
|
|
107281
107489
|
}
|
|
107282
107490
|
return linked;
|
|
107283
107491
|
}
|
|
107284
107492
|
async function readLinkedAgents(codexHome) {
|
|
107285
|
-
const agentsDir =
|
|
107493
|
+
const agentsDir = join90(codexHome, "agents");
|
|
107286
107494
|
if (!existsSync59(agentsDir))
|
|
107287
107495
|
return [];
|
|
107288
107496
|
const entries = await readdir14(agentsDir, { withFileTypes: true });
|
|
@@ -107290,7 +107498,7 @@ async function readLinkedAgents(codexHome) {
|
|
|
107290
107498
|
}
|
|
107291
107499
|
async function readJson(path) {
|
|
107292
107500
|
try {
|
|
107293
|
-
const parsed = JSON.parse(await
|
|
107501
|
+
const parsed = JSON.parse(await readFile30(path, "utf8"));
|
|
107294
107502
|
return isPlainRecord(parsed) ? parsed : null;
|
|
107295
107503
|
} catch (error) {
|
|
107296
107504
|
if (error instanceof Error)
|
|
@@ -107414,9 +107622,9 @@ function resolveLatestVersion(input) {
|
|
|
107414
107622
|
|
|
107415
107623
|
// packages/omo-opencode/src/cli/doctor/checks/codex-components.ts
|
|
107416
107624
|
init_src();
|
|
107417
|
-
import { readdir as readdir15, readFile as
|
|
107625
|
+
import { readdir as readdir15, readFile as readFile31, stat as stat7 } from "fs/promises";
|
|
107418
107626
|
import { homedir as homedir24 } from "os";
|
|
107419
|
-
import { dirname as dirname35, isAbsolute as isAbsolute14, join as
|
|
107627
|
+
import { dirname as dirname35, isAbsolute as isAbsolute14, join as join91, relative as relative9, resolve as resolve25, sep as sep9 } from "path";
|
|
107420
107628
|
var CODEX_COMPONENTS_CHECK_ID = "codex-components";
|
|
107421
107629
|
var CODEX_COMPONENTS_CHECK_NAME = "codex-components";
|
|
107422
107630
|
var PLUGIN_DATA_DIR_NAME = "omo-sisyphuslabs";
|
|
@@ -107426,7 +107634,7 @@ async function checkCodexComponents(deps = {}) {
|
|
|
107426
107634
|
const env = deps.env ?? process.env;
|
|
107427
107635
|
const platform = deps.platform ?? process.platform;
|
|
107428
107636
|
const arch = deps.arch ?? process.arch;
|
|
107429
|
-
const codexHome = resolve25(deps.codexHome ?? env["CODEX_HOME"] ??
|
|
107637
|
+
const codexHome = resolve25(deps.codexHome ?? env["CODEX_HOME"] ?? join91(homedir24(), ".codex"));
|
|
107430
107638
|
const summary = await gatherCodexSummary({ ...deps, codexHome });
|
|
107431
107639
|
if (summary.pluginRoot === null) {
|
|
107432
107640
|
return {
|
|
@@ -107451,7 +107659,7 @@ async function checkCodexComponents(deps = {}) {
|
|
|
107451
107659
|
});
|
|
107452
107660
|
}
|
|
107453
107661
|
const runtimeSgDir = runtimeSgDirectory(codexHome, platform, arch);
|
|
107454
|
-
const runtimeSgPath =
|
|
107662
|
+
const runtimeSgPath = join91(runtimeSgDir, sgBinaryName(platform));
|
|
107455
107663
|
const sg = findSgBinarySync({
|
|
107456
107664
|
arch,
|
|
107457
107665
|
env,
|
|
@@ -107563,7 +107771,7 @@ async function findManifestPaths(root, manifestName) {
|
|
|
107563
107771
|
for (const entry of entries) {
|
|
107564
107772
|
if (entry.name === "node_modules" || entry.name === ".git")
|
|
107565
107773
|
continue;
|
|
107566
|
-
const entryPath =
|
|
107774
|
+
const entryPath = join91(root, entry.name);
|
|
107567
107775
|
if (entry.isDirectory()) {
|
|
107568
107776
|
paths.push(...await findManifestPaths(entryPath, manifestName));
|
|
107569
107777
|
continue;
|
|
@@ -107607,18 +107815,18 @@ function isPluginRuntimePathArg(arg) {
|
|
|
107607
107815
|
return normalized.endsWith(".js") && normalized.includes("/dist/") && (normalized.startsWith("./") || normalized.startsWith("../") || normalized.startsWith("components/") || normalized.startsWith("/") || isAbsolute14(arg));
|
|
107608
107816
|
}
|
|
107609
107817
|
function runtimeSgDirectory(codexHome, platform, arch) {
|
|
107610
|
-
return
|
|
107818
|
+
return join91(codexHome, "runtime", "ast-grep", runtimeSlug(platform, arch));
|
|
107611
107819
|
}
|
|
107612
107820
|
function describeSgSource(sgPath, env, runtimeSgDir, platform) {
|
|
107613
107821
|
const override = env[SG_PATH_ENV_KEY]?.trim();
|
|
107614
107822
|
if (override !== undefined && override.length > 0 && sgPath === override)
|
|
107615
107823
|
return `env override ${SG_PATH_ENV_KEY}`;
|
|
107616
|
-
if (sgPath ===
|
|
107824
|
+
if (sgPath === join91(runtimeSgDir, sgBinaryName(platform)))
|
|
107617
107825
|
return "runtime dir";
|
|
107618
107826
|
return "PATH";
|
|
107619
107827
|
}
|
|
107620
107828
|
async function readBootstrapStateSummary(codexHome) {
|
|
107621
|
-
const statePath =
|
|
107829
|
+
const statePath = join91(codexHome, "plugins", "data", PLUGIN_DATA_DIR_NAME, "bootstrap", "state.json");
|
|
107622
107830
|
const raw = await readJson2(statePath);
|
|
107623
107831
|
if (raw === null)
|
|
107624
107832
|
return null;
|
|
@@ -107667,7 +107875,7 @@ function degradedDetailLines(entries) {
|
|
|
107667
107875
|
}
|
|
107668
107876
|
async function readJson2(path) {
|
|
107669
107877
|
try {
|
|
107670
|
-
const parsed = JSON.parse(await
|
|
107878
|
+
const parsed = JSON.parse(await readFile31(path, "utf8"));
|
|
107671
107879
|
return isRecord18(parsed) ? parsed : null;
|
|
107672
107880
|
} catch (error) {
|
|
107673
107881
|
if (error instanceof Error)
|
|
@@ -107695,18 +107903,18 @@ function isRecord18(value) {
|
|
|
107695
107903
|
|
|
107696
107904
|
// packages/omo-opencode/src/cli/doctor/checks/codex-runtime-wrapper.ts
|
|
107697
107905
|
import { existsSync as existsSync60 } from "fs";
|
|
107698
|
-
import { readFile as
|
|
107906
|
+
import { readFile as readFile32 } from "fs/promises";
|
|
107699
107907
|
import { homedir as homedir25 } from "os";
|
|
107700
|
-
import { join as
|
|
107908
|
+
import { join as join92, resolve as resolve26 } from "path";
|
|
107701
107909
|
var RUNTIME_WRAPPER_MARKER2 = "OMO_GENERATED_RUNTIME_WRAPPER";
|
|
107702
107910
|
var CHECK_NAME = "codex-runtime-wrapper";
|
|
107703
107911
|
var REINSTALL_COMMAND = "npx --yes lazycodex-ai@latest install --no-tui";
|
|
107704
107912
|
async function checkCodexRuntimeWrapper(deps = {}) {
|
|
107705
|
-
const codexHome = resolve26(deps.codexHome ?? process.env.CODEX_HOME ??
|
|
107913
|
+
const codexHome = resolve26(deps.codexHome ?? process.env.CODEX_HOME ?? join92(homedir25(), ".codex"));
|
|
107706
107914
|
const binDir = resolveCodexInstallerBinDir({ binDir: deps.binDir, codexHome, env: process.env });
|
|
107707
107915
|
const platform = deps.platform ?? process.platform;
|
|
107708
|
-
const wrapperPath =
|
|
107709
|
-
const legacyWrapperPath =
|
|
107916
|
+
const wrapperPath = join92(binDir, platform === "win32" ? "omo-agent-toolkit.cmd" : "omo-agent-toolkit");
|
|
107917
|
+
const legacyWrapperPath = join92(binDir, platform === "win32" ? "omo.cmd" : "omo");
|
|
107710
107918
|
const [wrapper, legacyWrapper] = await Promise.all([readRuntimeWrapper(wrapperPath), readRuntimeWrapper(legacyWrapperPath)]);
|
|
107711
107919
|
const issues = [];
|
|
107712
107920
|
if (wrapper?.includes(RUNTIME_WRAPPER_MARKER2) === true) {
|
|
@@ -107740,7 +107948,7 @@ async function checkCodexRuntimeWrapper(deps = {}) {
|
|
|
107740
107948
|
}
|
|
107741
107949
|
async function readRuntimeWrapper(path) {
|
|
107742
107950
|
try {
|
|
107743
|
-
return await
|
|
107951
|
+
return await readFile32(path, "utf8");
|
|
107744
107952
|
} catch (error) {
|
|
107745
107953
|
if (error instanceof Error)
|
|
107746
107954
|
return null;
|
|
@@ -108242,12 +108450,12 @@ import {
|
|
|
108242
108450
|
unlinkSync as unlinkSync9,
|
|
108243
108451
|
writeFileSync as writeFileSync14
|
|
108244
108452
|
} from "fs";
|
|
108245
|
-
import { basename as basename13, dirname as dirname36, join as
|
|
108453
|
+
import { basename as basename13, dirname as dirname36, join as join95 } from "path";
|
|
108246
108454
|
|
|
108247
108455
|
// packages/mcp-client-core/src/config-dir.ts
|
|
108248
108456
|
import { existsSync as existsSync61, realpathSync as realpathSync10 } from "fs";
|
|
108249
108457
|
import { homedir as homedir26 } from "os";
|
|
108250
|
-
import { join as
|
|
108458
|
+
import { join as join93, resolve as resolve27 } from "path";
|
|
108251
108459
|
function resolveConfigPath2(pathValue) {
|
|
108252
108460
|
const resolvedPath = resolve27(pathValue);
|
|
108253
108461
|
if (!existsSync61(resolvedPath))
|
|
@@ -108265,13 +108473,13 @@ function getOpenCodeCliConfigDir(env = process.env) {
|
|
|
108265
108473
|
if (customConfigDir) {
|
|
108266
108474
|
return resolveConfigPath2(customConfigDir);
|
|
108267
108475
|
}
|
|
108268
|
-
const xdgConfigDir = env["XDG_CONFIG_HOME"]?.trim() ||
|
|
108269
|
-
return resolveConfigPath2(
|
|
108476
|
+
const xdgConfigDir = env["XDG_CONFIG_HOME"]?.trim() || join93(homedir26(), ".config");
|
|
108477
|
+
return resolveConfigPath2(join93(xdgConfigDir, "opencode"));
|
|
108270
108478
|
}
|
|
108271
108479
|
|
|
108272
108480
|
// packages/mcp-client-core/src/mcp-oauth/storage-index.ts
|
|
108273
108481
|
import { chmodSync as chmodSync4, existsSync as existsSync62, readFileSync as readFileSync41, renameSync as renameSync7, writeFileSync as writeFileSync13 } from "fs";
|
|
108274
|
-
import { join as
|
|
108482
|
+
import { join as join94 } from "path";
|
|
108275
108483
|
var INDEX_FILE_NAME = "index.json";
|
|
108276
108484
|
function isTokenIndex(value) {
|
|
108277
108485
|
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
@@ -108279,7 +108487,7 @@ function isTokenIndex(value) {
|
|
|
108279
108487
|
return Object.values(value).every((entry) => typeof entry === "string");
|
|
108280
108488
|
}
|
|
108281
108489
|
function getIndexPath(storageDir) {
|
|
108282
|
-
return
|
|
108490
|
+
return join94(storageDir, INDEX_FILE_NAME);
|
|
108283
108491
|
}
|
|
108284
108492
|
function readTokenIndex(storageDir) {
|
|
108285
108493
|
const indexPath = getIndexPath(storageDir);
|
|
@@ -108323,16 +108531,16 @@ function deleteTokenIndexEntry(storageDir, hash) {
|
|
|
108323
108531
|
var STORAGE_DIR_NAME = "mcp-oauth";
|
|
108324
108532
|
var LEGACY_STORAGE_FILE_NAME = "mcp-oauth.json";
|
|
108325
108533
|
function getMcpOauthStorageDir() {
|
|
108326
|
-
return
|
|
108534
|
+
return join95(getOpenCodeCliConfigDir(), STORAGE_DIR_NAME);
|
|
108327
108535
|
}
|
|
108328
108536
|
function getMcpOauthServerHash(serverHost, resource) {
|
|
108329
108537
|
return createHash7("sha256").update(buildKey(serverHost, resource)).digest("hex").slice(0, 32);
|
|
108330
108538
|
}
|
|
108331
108539
|
function getMcpOauthStoragePath(serverHost, resource) {
|
|
108332
|
-
return
|
|
108540
|
+
return join95(getMcpOauthStorageDir(), `${getMcpOauthServerHash(serverHost, resource)}.json`);
|
|
108333
108541
|
}
|
|
108334
108542
|
function getLegacyStoragePath() {
|
|
108335
|
-
return
|
|
108543
|
+
return join95(getOpenCodeCliConfigDir(), LEGACY_STORAGE_FILE_NAME);
|
|
108336
108544
|
}
|
|
108337
108545
|
function normalizeHost2(serverHost) {
|
|
108338
108546
|
let host = serverHost.trim();
|
|
@@ -108511,7 +108719,7 @@ function listTokensByHost(serverHost) {
|
|
|
108511
108719
|
for (const [hash, indexedKey] of Object.entries(index)) {
|
|
108512
108720
|
if (!indexedKey.startsWith(prefix))
|
|
108513
108721
|
continue;
|
|
108514
|
-
const indexedToken = readTokenFile(
|
|
108722
|
+
const indexedToken = readTokenFile(join95(getMcpOauthStorageDir(), `${hash}.json`));
|
|
108515
108723
|
if (indexedToken)
|
|
108516
108724
|
result[indexedKey] = indexedToken;
|
|
108517
108725
|
}
|
|
@@ -108526,7 +108734,7 @@ function listAllTokens() {
|
|
|
108526
108734
|
for (const entry of readdirSync13(dir, { withFileTypes: true })) {
|
|
108527
108735
|
if (!entry.isFile() || !entry.name.endsWith(".json") || entry.name === "index.json")
|
|
108528
108736
|
continue;
|
|
108529
|
-
const token = readTokenFile(
|
|
108737
|
+
const token = readTokenFile(join95(dir, entry.name));
|
|
108530
108738
|
const hash = basename13(entry.name, ".json");
|
|
108531
108739
|
if (token)
|
|
108532
108740
|
result[index[hash] ?? hash] = token;
|