lazycodex-ai 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/package.json +1 -1
- 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-node/index.js
CHANGED
|
@@ -65,7 +65,7 @@ var package_default;
|
|
|
65
65
|
var init_package = __esm(() => {
|
|
66
66
|
package_default = {
|
|
67
67
|
name: "oh-my-opencode",
|
|
68
|
-
version: "5.1.
|
|
68
|
+
version: "5.1.1",
|
|
69
69
|
description: "The Best AI Agent Harness - Batteries-Included OpenCode Plugin with Multi-Model Orchestration, Parallel Background Agents, and Crafted LSP/AST Tools",
|
|
70
70
|
main: "./dist/index.js",
|
|
71
71
|
types: "dist/index.d.ts",
|
|
@@ -254,7 +254,7 @@ var init_package = __esm(() => {
|
|
|
254
254
|
zod: "^4.6.5"
|
|
255
255
|
},
|
|
256
256
|
devDependencies: {
|
|
257
|
-
"@code-yeongyu/senpi": "2026.9.
|
|
257
|
+
"@code-yeongyu/senpi": "2026.9.29",
|
|
258
258
|
"@oh-my-opencode/agents-md-core": "workspace:*",
|
|
259
259
|
"@oh-my-opencode/ast-grep-mcp": "workspace:*",
|
|
260
260
|
"@oh-my-opencode/boulder-state": "workspace:*",
|
|
@@ -300,18 +300,18 @@ var init_package = __esm(() => {
|
|
|
300
300
|
typescript: "^7.0.2"
|
|
301
301
|
},
|
|
302
302
|
optionalDependencies: {
|
|
303
|
-
"oh-my-opencode-darwin-arm64": "5.1.
|
|
304
|
-
"oh-my-opencode-darwin-x64": "5.1.
|
|
305
|
-
"oh-my-opencode-darwin-x64-baseline": "5.1.
|
|
306
|
-
"oh-my-opencode-linux-arm64": "5.1.
|
|
307
|
-
"oh-my-opencode-linux-arm64-musl": "5.1.
|
|
308
|
-
"oh-my-opencode-linux-x64": "5.1.
|
|
309
|
-
"oh-my-opencode-linux-x64-baseline": "5.1.
|
|
310
|
-
"oh-my-opencode-linux-x64-musl": "5.1.
|
|
311
|
-
"oh-my-opencode-linux-x64-musl-baseline": "5.1.
|
|
312
|
-
"oh-my-opencode-windows-arm64": "5.1.
|
|
313
|
-
"oh-my-opencode-windows-x64": "5.1.
|
|
314
|
-
"oh-my-opencode-windows-x64-baseline": "5.1.
|
|
303
|
+
"oh-my-opencode-darwin-arm64": "5.1.1",
|
|
304
|
+
"oh-my-opencode-darwin-x64": "5.1.1",
|
|
305
|
+
"oh-my-opencode-darwin-x64-baseline": "5.1.1",
|
|
306
|
+
"oh-my-opencode-linux-arm64": "5.1.1",
|
|
307
|
+
"oh-my-opencode-linux-arm64-musl": "5.1.1",
|
|
308
|
+
"oh-my-opencode-linux-x64": "5.1.1",
|
|
309
|
+
"oh-my-opencode-linux-x64-baseline": "5.1.1",
|
|
310
|
+
"oh-my-opencode-linux-x64-musl": "5.1.1",
|
|
311
|
+
"oh-my-opencode-linux-x64-musl-baseline": "5.1.1",
|
|
312
|
+
"oh-my-opencode-windows-arm64": "5.1.1",
|
|
313
|
+
"oh-my-opencode-windows-x64": "5.1.1",
|
|
314
|
+
"oh-my-opencode-windows-x64-baseline": "5.1.1"
|
|
315
315
|
},
|
|
316
316
|
overrides: {
|
|
317
317
|
"@earendil-works/pi-agent-core": "0.84.2",
|
|
@@ -7397,12 +7397,12 @@ var init_category_model_requirements = __esm(() => {
|
|
|
7397
7397
|
},
|
|
7398
7398
|
"deep-low": {
|
|
7399
7399
|
fallbackChain: [
|
|
7400
|
-
{ providers: ["openai", "chatgpt-subscription"], model: "gpt-5.6-sol-fast", variant: "medium" },
|
|
7401
7400
|
{
|
|
7402
7401
|
providers: ["openai", "chatgpt-subscription", "github-copilot", "opencode"],
|
|
7403
7402
|
model: "gpt-5.6-sol",
|
|
7404
7403
|
variant: "medium"
|
|
7405
|
-
}
|
|
7404
|
+
},
|
|
7405
|
+
{ providers: ["openai", "chatgpt-subscription"], model: "gpt-5.6-sol-fast", variant: "medium" }
|
|
7406
7406
|
]
|
|
7407
7407
|
},
|
|
7408
7408
|
"deep-high": {
|
|
@@ -7454,6 +7454,11 @@ var init_category_model_requirements = __esm(() => {
|
|
|
7454
7454
|
},
|
|
7455
7455
|
"unspecified-low": {
|
|
7456
7456
|
fallbackChain: [
|
|
7457
|
+
{
|
|
7458
|
+
providers: ["anthropic", "anthropic-api", "github-copilot", "opencode"],
|
|
7459
|
+
model: "claude-sonnet-5-5",
|
|
7460
|
+
variant: "medium"
|
|
7461
|
+
},
|
|
7457
7462
|
{ providers: ["xiaomi", "opencode-go"], model: "mimo-v2.6-pro", variant: "max" },
|
|
7458
7463
|
{ providers: ["xai", "github-copilot", "opencode-go"], model: "grok-4.7", variant: "xhigh" },
|
|
7459
7464
|
{
|
|
@@ -8390,6 +8395,36 @@ var init_supplemental_entries = __esm(() => {
|
|
|
8390
8395
|
output: 32768
|
|
8391
8396
|
}
|
|
8392
8397
|
},
|
|
8398
|
+
"claude-sonnet-5-5": {
|
|
8399
|
+
id: "claude-sonnet-5-5",
|
|
8400
|
+
family: "claude-sonnet",
|
|
8401
|
+
reasoning: true,
|
|
8402
|
+
temperature: false,
|
|
8403
|
+
toolCall: true,
|
|
8404
|
+
modalities: {
|
|
8405
|
+
input: ["text", "image", "pdf"],
|
|
8406
|
+
output: ["text"]
|
|
8407
|
+
},
|
|
8408
|
+
limit: {
|
|
8409
|
+
context: 1e6,
|
|
8410
|
+
output: 128000
|
|
8411
|
+
}
|
|
8412
|
+
},
|
|
8413
|
+
"anthropic/claude-sonnet-5-5": {
|
|
8414
|
+
id: "anthropic/claude-sonnet-5-5",
|
|
8415
|
+
family: "claude-sonnet",
|
|
8416
|
+
reasoning: true,
|
|
8417
|
+
temperature: false,
|
|
8418
|
+
toolCall: true,
|
|
8419
|
+
modalities: {
|
|
8420
|
+
input: ["text", "image", "pdf"],
|
|
8421
|
+
output: ["text"]
|
|
8422
|
+
},
|
|
8423
|
+
limit: {
|
|
8424
|
+
context: 1e6,
|
|
8425
|
+
output: 128000
|
|
8426
|
+
}
|
|
8427
|
+
},
|
|
8393
8428
|
"grok-4.7": {
|
|
8394
8429
|
id: "grok-4.7",
|
|
8395
8430
|
family: "grok",
|
|
@@ -9435,7 +9470,7 @@ var init_openai_categories = __esm(() => {
|
|
|
9435
9470
|
},
|
|
9436
9471
|
{
|
|
9437
9472
|
name: "deep-low",
|
|
9438
|
-
config: { model: "openai/gpt-5.6-sol
|
|
9473
|
+
config: { model: "openai/gpt-5.6-sol", variant: "medium" },
|
|
9439
9474
|
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.",
|
|
9440
9475
|
callerGuidance: DEEP_LOW_CATEGORY_CALLER_GUIDANCE,
|
|
9441
9476
|
promptAppend: DEEP_LOW_CATEGORY_PROMPT_APPEND,
|
|
@@ -9460,7 +9495,7 @@ var init_openai_categories = __esm(() => {
|
|
|
9460
9495
|
},
|
|
9461
9496
|
{
|
|
9462
9497
|
name: "unspecified-low",
|
|
9463
|
-
config: { model: "
|
|
9498
|
+
config: { model: "anthropic/claude-sonnet-5-5", variant: "medium" },
|
|
9464
9499
|
description: "Tasks that don't fit other categories, low effort required",
|
|
9465
9500
|
callerGuidance: UNSPECIFIED_LOW_CATEGORY_CALLER_GUIDANCE,
|
|
9466
9501
|
promptAppend: UNSPECIFIED_LOW_CATEGORY_PROMPT_APPEND
|
|
@@ -74781,6 +74816,7 @@ var init_task = __esm(() => {
|
|
|
74781
74816
|
process_runner: _enum(["host", "child-process"]).default("host"),
|
|
74782
74817
|
host_engine_policy: _enum(["upgrade", "fallback"]).default("upgrade"),
|
|
74783
74818
|
host_idle_exit_ms: number2().int().positive().optional(),
|
|
74819
|
+
host_shard_prewarm: _enum(["off", "first-turn", "session-start"]).default("first-turn"),
|
|
74784
74820
|
default_concurrency: number2().int().nonnegative().default(5),
|
|
74785
74821
|
global_concurrency: number2().int().nonnegative().default(8),
|
|
74786
74822
|
provider_concurrency: record(string2(), number2().int().nonnegative()).optional(),
|
|
@@ -74830,6 +74866,7 @@ var init_task = __esm(() => {
|
|
|
74830
74866
|
process_runner: _enum(["host", "child-process"]).optional(),
|
|
74831
74867
|
host_engine_policy: _enum(["upgrade", "fallback"]).optional(),
|
|
74832
74868
|
host_idle_exit_ms: number2().int().positive().optional(),
|
|
74869
|
+
host_shard_prewarm: _enum(["off", "first-turn", "session-start"]).optional(),
|
|
74833
74870
|
default_concurrency: number2().int().nonnegative().optional(),
|
|
74834
74871
|
global_concurrency: number2().int().nonnegative().optional(),
|
|
74835
74872
|
provider_concurrency: record(string2(), number2().int().nonnegative()).optional(),
|
|
@@ -79190,9 +79227,9 @@ function extractChannel(version) {
|
|
|
79190
79227
|
|
|
79191
79228
|
// packages/telemetry-core/src/day-claim.ts
|
|
79192
79229
|
import { closeSync as closeSync3, mkdirSync as mkdirSync9, openSync as openSync3, readdirSync as readdirSync8, rmSync as rmSync3 } from "node:fs";
|
|
79193
|
-
import { join as
|
|
79230
|
+
import { join as join53 } from "node:path";
|
|
79194
79231
|
function getTelemetryDayClaimFilePath(stateDir, dayUTC) {
|
|
79195
|
-
return
|
|
79232
|
+
return join53(stateDir, `${CLAIM_PREFIX}${dayUTC}${CLAIM_SUFFIX}`);
|
|
79196
79233
|
}
|
|
79197
79234
|
function claimUtcDay(stateDir, dayUTC) {
|
|
79198
79235
|
try {
|
|
@@ -79218,7 +79255,7 @@ function pruneSupersededClaims(stateDir, dayUTC) {
|
|
|
79218
79255
|
if (!entry.startsWith(CLAIM_PREFIX) || !entry.endsWith(CLAIM_SUFFIX))
|
|
79219
79256
|
continue;
|
|
79220
79257
|
try {
|
|
79221
|
-
rmSync3(
|
|
79258
|
+
rmSync3(join53(stateDir, entry), { force: true });
|
|
79222
79259
|
} catch {}
|
|
79223
79260
|
}
|
|
79224
79261
|
}
|
|
@@ -79227,20 +79264,20 @@ var init_day_claim = () => {};
|
|
|
79227
79264
|
|
|
79228
79265
|
// packages/telemetry-core/src/activity-state.ts
|
|
79229
79266
|
import { existsSync as existsSync25, mkdirSync as mkdirSync10, readFileSync as readFileSync12 } from "node:fs";
|
|
79230
|
-
import { basename as basename9, join as
|
|
79267
|
+
import { basename as basename9, join as join54 } from "node:path";
|
|
79231
79268
|
function resolveTelemetryStateDir(product, options = {}) {
|
|
79232
79269
|
const dataDir = resolveXdgDataDir(product.cacheDirName, {
|
|
79233
79270
|
env: options.env,
|
|
79234
79271
|
osProvider: options.osProvider
|
|
79235
79272
|
});
|
|
79236
|
-
const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined :
|
|
79273
|
+
const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined : join54(options.env.XDG_DATA_HOME, product.cacheDirName);
|
|
79237
79274
|
if (dataDir === xdgStateDir || xdgStateDir === undefined && basename9(dataDir) === product.cacheDirName) {
|
|
79238
79275
|
return dataDir;
|
|
79239
79276
|
}
|
|
79240
|
-
return
|
|
79277
|
+
return join54(dataDir, product.cacheDirName);
|
|
79241
79278
|
}
|
|
79242
79279
|
function getTelemetryActivityStateFilePath(stateDir) {
|
|
79243
|
-
return
|
|
79280
|
+
return join54(stateDir, POSTHOG_ACTIVITY_STATE_FILE);
|
|
79244
79281
|
}
|
|
79245
79282
|
function getDailyActiveCaptureState(input) {
|
|
79246
79283
|
const dayUTC = getUtcDayString(input.now ?? new Date);
|
|
@@ -79321,9 +79358,9 @@ var DEFAULT_POSTHOG_HOST = "https://us.i.posthog.com", DEFAULT_POSTHOG_API_KEY =
|
|
|
79321
79358
|
|
|
79322
79359
|
// packages/telemetry-core/src/diagnostics.ts
|
|
79323
79360
|
import { appendFileSync as appendFileSync2, existsSync as existsSync26, mkdirSync as mkdirSync11, readFileSync as readFileSync13 } from "node:fs";
|
|
79324
|
-
import { join as
|
|
79361
|
+
import { join as join55 } from "node:path";
|
|
79325
79362
|
function getTelemetryDiagnosticsFilePath(diagnosticsDir) {
|
|
79326
|
-
return
|
|
79363
|
+
return join55(diagnosticsDir, DIAGNOSTICS_FILE_NAME);
|
|
79327
79364
|
}
|
|
79328
79365
|
function writeTelemetryDiagnostic(input, options) {
|
|
79329
79366
|
const now = options.now ?? new Date;
|
|
@@ -89066,7 +89103,7 @@ var package_default2;
|
|
|
89066
89103
|
var init_package2 = __esm(() => {
|
|
89067
89104
|
package_default2 = {
|
|
89068
89105
|
name: "@oh-my-opencode/omo-codex",
|
|
89069
|
-
version: "5.1.
|
|
89106
|
+
version: "5.1.1",
|
|
89070
89107
|
type: "module",
|
|
89071
89108
|
private: true,
|
|
89072
89109
|
description: "Codex harness adapter for oh-my-openagent. Vendored Codex plugin namespace (omo) + TypeScript installer + telemetry.",
|
|
@@ -90038,7 +90075,7 @@ var init_update_toasts = __esm(() => {
|
|
|
90038
90075
|
|
|
90039
90076
|
// packages/omo-opencode/src/hooks/auto-update-checker/hook/background-update-check.ts
|
|
90040
90077
|
import { existsSync as existsSync48 } from "node:fs";
|
|
90041
|
-
import { dirname as dirname32, join as
|
|
90078
|
+
import { dirname as dirname32, join as join79 } from "node:path";
|
|
90042
90079
|
import { fileURLToPath as fileURLToPath5 } from "node:url";
|
|
90043
90080
|
function defaultGetModuleHostingWorkspace() {
|
|
90044
90081
|
try {
|
|
@@ -90198,7 +90235,7 @@ var init_background_update_check = __esm(() => {
|
|
|
90198
90235
|
init_update_toasts();
|
|
90199
90236
|
defaultDeps4 = {
|
|
90200
90237
|
existsSync: existsSync48,
|
|
90201
|
-
join:
|
|
90238
|
+
join: join79,
|
|
90202
90239
|
runBunInstallWithDetails,
|
|
90203
90240
|
log: log2,
|
|
90204
90241
|
getOpenCodeCacheDir,
|
|
@@ -92654,19 +92691,7 @@ function getUnsupportedOpenCodeVersionMessage(openCodeVersion) {
|
|
|
92654
92691
|
}
|
|
92655
92692
|
|
|
92656
92693
|
// packages/omo-codex/src/install/install-codex.ts
|
|
92657
|
-
import { join as
|
|
92658
|
-
|
|
92659
|
-
// packages/omo-codex/src/install/codex-default-role-config.ts
|
|
92660
|
-
init_src4();
|
|
92661
|
-
function readDefaultRoleConfig(options = {}) {
|
|
92662
|
-
const result = loadOmoConfig({ ...options, harness: "codex" });
|
|
92663
|
-
return {
|
|
92664
|
-
enabled: result.config.agents?.default?.disable !== true,
|
|
92665
|
-
warnings: result.diagnostics.map((diagnostic) => diagnostic.message)
|
|
92666
|
-
};
|
|
92667
|
-
}
|
|
92668
|
-
|
|
92669
|
-
// packages/omo-codex/src/install/install-codex.ts
|
|
92694
|
+
import { join as join56, resolve as resolve13 } from "node:path";
|
|
92670
92695
|
import { existsSync as existsSync27 } from "node:fs";
|
|
92671
92696
|
import { homedir as homedir6 } from "node:os";
|
|
92672
92697
|
|
|
@@ -95567,13 +95592,126 @@ function toCodexResolution(resolution) {
|
|
|
95567
95592
|
};
|
|
95568
95593
|
}
|
|
95569
95594
|
|
|
95595
|
+
// packages/omo-codex/src/install/codex-agent-config.ts
|
|
95596
|
+
init_src4();
|
|
95597
|
+
init_reasoning_vocabulary();
|
|
95598
|
+
function readCodexAgentConfig(options = {}) {
|
|
95599
|
+
const result = loadOmoConfig({ ...options, harness: "codex" });
|
|
95600
|
+
const overrides = readAgentOverrides(result);
|
|
95601
|
+
return {
|
|
95602
|
+
defaultRoleEnabled: result.config.agents?.default?.disable !== true,
|
|
95603
|
+
agentOverrides: overrides.agentOverrides,
|
|
95604
|
+
warnings: [...result.diagnostics.map((diagnostic) => diagnostic.message), ...overrides.warnings]
|
|
95605
|
+
};
|
|
95606
|
+
}
|
|
95607
|
+
function unmanagedAgentOverrideWarnings(agentOverrides, managedAgentNames) {
|
|
95608
|
+
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`);
|
|
95609
|
+
}
|
|
95610
|
+
function readAgentOverrides(result) {
|
|
95611
|
+
let merged = {};
|
|
95612
|
+
for (const layer of result.layers)
|
|
95613
|
+
merged = mergeOmoConfigRecords(merged, layer.config);
|
|
95614
|
+
const profile = result.profile === undefined ? undefined : recordAt2(recordAt2(merged, "profiles"), result.profile);
|
|
95615
|
+
let agents = {};
|
|
95616
|
+
for (const scope of [merged, profile]) {
|
|
95617
|
+
agents = mergeOmoConfigRecords(agents, recordAt2(recordAt2(scope, "[codex]"), "agents") ?? {});
|
|
95618
|
+
}
|
|
95619
|
+
const agentOverrides = new Map;
|
|
95620
|
+
const warnings = [];
|
|
95621
|
+
for (const [name, value] of Object.entries(agents)) {
|
|
95622
|
+
if (name === "default")
|
|
95623
|
+
continue;
|
|
95624
|
+
const parsed = OmoAgentDefSchema.safeParse(value);
|
|
95625
|
+
if (!parsed.success) {
|
|
95626
|
+
warnings.push(`[codex].agents.${name} is invalid and was ignored: ${parsed.error.issues[0]?.message ?? "unknown error"}`);
|
|
95627
|
+
continue;
|
|
95628
|
+
}
|
|
95629
|
+
const override = toCodexAgentOverride(parsed.data.model, parsed.data.reasoning);
|
|
95630
|
+
if (override.model !== undefined || override.reasoningEffort !== undefined)
|
|
95631
|
+
agentOverrides.set(name, override);
|
|
95632
|
+
}
|
|
95633
|
+
return { agentOverrides, warnings };
|
|
95634
|
+
}
|
|
95635
|
+
function toCodexAgentOverride(model, reasoning) {
|
|
95636
|
+
const split = model === undefined ? undefined : splitReasoningSuffix2(model);
|
|
95637
|
+
const effort = codexReasoningEffort(reasoning ?? split?.level);
|
|
95638
|
+
return {
|
|
95639
|
+
...split === undefined || split.base === "" ? {} : { model: split.base },
|
|
95640
|
+
...effort === undefined ? {} : { reasoningEffort: effort }
|
|
95641
|
+
};
|
|
95642
|
+
}
|
|
95643
|
+
function codexReasoningEffort(reasoning) {
|
|
95644
|
+
if (reasoning === undefined || reasoning === "auto")
|
|
95645
|
+
return;
|
|
95646
|
+
return reasoning === "off" ? "none" : reasoning;
|
|
95647
|
+
}
|
|
95648
|
+
function recordAt2(value, key) {
|
|
95649
|
+
if (!isPlainRecord4(value))
|
|
95650
|
+
return;
|
|
95651
|
+
const child = value[key];
|
|
95652
|
+
return isPlainRecord4(child) ? child : undefined;
|
|
95653
|
+
}
|
|
95654
|
+
|
|
95655
|
+
// packages/omo-codex/src/install/codex-marketplace-snapshot.ts
|
|
95656
|
+
import { cp as cp3, mkdir as mkdir6, rename as rename4, rm as rm7, writeFile as writeFile6 } from "node:fs/promises";
|
|
95657
|
+
import { join as join39, sep as sep6 } from "node:path";
|
|
95658
|
+
var INSTALLED_MARKETPLACES_DIR = ".tmp/marketplaces";
|
|
95659
|
+
async function writeInstalledMarketplaceSnapshot(input) {
|
|
95660
|
+
const marketplaceRoot = installedMarketplaceRoot(input.codexHome, input.marketplace.name);
|
|
95661
|
+
await mkdir6(marketplaceRoot, { recursive: true });
|
|
95662
|
+
await writeMarketplaceManifest(marketplaceRoot, input.marketplace);
|
|
95663
|
+
const snapshotPlugins = [];
|
|
95664
|
+
for (const plugin of input.plugins) {
|
|
95665
|
+
snapshotPlugins.push(await writeSnapshotPlugin(marketplaceRoot, plugin));
|
|
95666
|
+
}
|
|
95667
|
+
return snapshotPlugins;
|
|
95668
|
+
}
|
|
95669
|
+
function installedMarketplaceRoot(codexHome, marketplaceName) {
|
|
95670
|
+
return join39(codexHome, INSTALLED_MARKETPLACES_DIR, marketplaceName);
|
|
95671
|
+
}
|
|
95672
|
+
async function writeMarketplaceManifest(marketplaceRoot, marketplace) {
|
|
95673
|
+
const manifestDir = join39(marketplaceRoot, ".agents", "plugins");
|
|
95674
|
+
await mkdir6(manifestDir, { recursive: true });
|
|
95675
|
+
const tempPath = join39(manifestDir, `.marketplace-${process.pid}-${Date.now()}.json.tmp`);
|
|
95676
|
+
await writeFile6(tempPath, `${JSON.stringify(marketplace, null, "\t")}
|
|
95677
|
+
`);
|
|
95678
|
+
await rename4(tempPath, join39(manifestDir, "marketplace.json"));
|
|
95679
|
+
}
|
|
95680
|
+
async function writeSnapshotPlugin(marketplaceRoot, plugin) {
|
|
95681
|
+
const pluginsDir = join39(marketplaceRoot, "plugins");
|
|
95682
|
+
await mkdir6(pluginsDir, { recursive: true });
|
|
95683
|
+
const targetPath = join39(pluginsDir, plugin.name);
|
|
95684
|
+
const tempPath = join39(pluginsDir, `.tmp-${plugin.name}-${process.pid}-${Date.now()}`);
|
|
95685
|
+
await rm7(tempPath, { recursive: true, force: true });
|
|
95686
|
+
await cp3(plugin.sourcePath, tempPath, {
|
|
95687
|
+
recursive: true,
|
|
95688
|
+
filter: (source) => shouldCopyMarketplaceSourcePath(source, plugin.sourcePath)
|
|
95689
|
+
});
|
|
95690
|
+
await copyBundledMcpRuntimeDists({ pluginRoot: tempPath, sourceRoot: plugin.sourcePath });
|
|
95691
|
+
await rm7(targetPath, { recursive: true, force: true });
|
|
95692
|
+
await rename4(tempPath, targetPath);
|
|
95693
|
+
await rewriteCachedMcpManifest(targetPath, plugin.sourcePath);
|
|
95694
|
+
return { name: plugin.name, path: targetPath };
|
|
95695
|
+
}
|
|
95696
|
+
function shouldCopyMarketplaceSourcePath(path, root) {
|
|
95697
|
+
const relative = path === root ? "" : path.slice(root.length + sep6.length);
|
|
95698
|
+
if (relative === "")
|
|
95699
|
+
return true;
|
|
95700
|
+
const parts = relative.split(sep6);
|
|
95701
|
+
return !parts.some((part) => part === ".git" || part === "node_modules");
|
|
95702
|
+
}
|
|
95703
|
+
|
|
95570
95704
|
// packages/omo-codex/src/install/link-cached-plugin-agents.ts
|
|
95571
|
-
import { copyFile, lstat as lstat10, mkdir as
|
|
95572
|
-
import { basename as basename7, join as
|
|
95705
|
+
import { copyFile, lstat as lstat10, mkdir as mkdir7, readdir as readdir7, readFile as readFile17, rm as rm11, writeFile as writeFile9 } from "node:fs/promises";
|
|
95706
|
+
import { basename as basename7, join as join44 } from "node:path";
|
|
95707
|
+
|
|
95708
|
+
// packages/omo-codex/src/install/agent-model-overrides.ts
|
|
95709
|
+
import { readFile as readFile14, rm as rm8, writeFile as writeFile8 } from "node:fs/promises";
|
|
95710
|
+
import { join as join41 } from "node:path";
|
|
95573
95711
|
|
|
95574
95712
|
// packages/omo-codex/src/install/preserved-agent-settings.ts
|
|
95575
|
-
import { lstat as lstat7, readFile as readFile13, readdir as readdir6, writeFile as
|
|
95576
|
-
import { join as
|
|
95713
|
+
import { lstat as lstat7, readFile as readFile13, readdir as readdir6, writeFile as writeFile7 } from "node:fs/promises";
|
|
95714
|
+
import { join as join40 } from "node:path";
|
|
95577
95715
|
|
|
95578
95716
|
// packages/omo-codex/src/install/managed-agent-reasoning-defaults.ts
|
|
95579
95717
|
var MANAGED_REASONING_DEFAULT_UPGRADES = new Map([
|
|
@@ -95766,7 +95904,7 @@ function resolveManagedAgentReasoning(input) {
|
|
|
95766
95904
|
|
|
95767
95905
|
// packages/omo-codex/src/install/preserved-agent-settings.ts
|
|
95768
95906
|
async function capturePreservedAgentReasoning(input) {
|
|
95769
|
-
const agentsDir =
|
|
95907
|
+
const agentsDir = join40(input.codexHome, "agents");
|
|
95770
95908
|
if (!await exists2(agentsDir))
|
|
95771
95909
|
return new Map;
|
|
95772
95910
|
const preserved = new Map;
|
|
@@ -95774,7 +95912,7 @@ async function capturePreservedAgentReasoning(input) {
|
|
|
95774
95912
|
for (const entry of agentEntries) {
|
|
95775
95913
|
if (!entry.name.endsWith(".toml"))
|
|
95776
95914
|
continue;
|
|
95777
|
-
const content = await readTextIfExists(
|
|
95915
|
+
const content = await readTextIfExists(join40(agentsDir, entry.name));
|
|
95778
95916
|
if (content === null)
|
|
95779
95917
|
continue;
|
|
95780
95918
|
const effort = extractReasoningEffort(content);
|
|
@@ -95788,7 +95926,7 @@ async function capturePreservedAgentReasoning(input) {
|
|
|
95788
95926
|
return preserved;
|
|
95789
95927
|
}
|
|
95790
95928
|
async function capturePreservedAgentServiceTier(input) {
|
|
95791
|
-
const agentsDir =
|
|
95929
|
+
const agentsDir = join40(input.codexHome, "agents");
|
|
95792
95930
|
if (!await exists2(agentsDir))
|
|
95793
95931
|
return new Map;
|
|
95794
95932
|
const preserved = new Map;
|
|
@@ -95796,7 +95934,7 @@ async function capturePreservedAgentServiceTier(input) {
|
|
|
95796
95934
|
for (const entry of agentEntries) {
|
|
95797
95935
|
if (!entry.name.endsWith(".toml"))
|
|
95798
95936
|
continue;
|
|
95799
|
-
const content = await readTextIfExists(
|
|
95937
|
+
const content = await readTextIfExists(join40(agentsDir, entry.name));
|
|
95800
95938
|
if (content === null)
|
|
95801
95939
|
continue;
|
|
95802
95940
|
preserved.set(agentNameFromToml(entry.name), extractServiceTier(content));
|
|
@@ -95819,7 +95957,7 @@ async function restorePreservedReasoning(input) {
|
|
|
95819
95957
|
const replacement = replaceTopLevelStringSetting(content, "model_reasoning_effort", effort, { insertIfMissing: false });
|
|
95820
95958
|
if (!replacement.replaced)
|
|
95821
95959
|
return;
|
|
95822
|
-
await
|
|
95960
|
+
await writeFile7(input.linkPath, replacement.content);
|
|
95823
95961
|
}
|
|
95824
95962
|
async function restorePreservedServiceTier(input) {
|
|
95825
95963
|
if (!input.preserved)
|
|
@@ -95830,7 +95968,18 @@ async function restorePreservedServiceTier(input) {
|
|
|
95830
95968
|
const replacement = replaceTopLevelStringSetting(content, "service_tier", input.value, { insertIfMissing: true });
|
|
95831
95969
|
if (!replacement.replaced)
|
|
95832
95970
|
return;
|
|
95833
|
-
await
|
|
95971
|
+
await writeFile7(input.linkPath, replacement.content);
|
|
95972
|
+
}
|
|
95973
|
+
async function restorePreservedModel(input) {
|
|
95974
|
+
if (input.value === null)
|
|
95975
|
+
return;
|
|
95976
|
+
const content = await readFile13(input.linkPath, "utf8");
|
|
95977
|
+
if (extractModel(content) === input.value)
|
|
95978
|
+
return;
|
|
95979
|
+
const replacement = replaceTopLevelStringSetting(content, "model", input.value, { insertIfMissing: true });
|
|
95980
|
+
if (!replacement.replaced)
|
|
95981
|
+
return;
|
|
95982
|
+
await writeFile7(input.linkPath, replacement.content);
|
|
95834
95983
|
}
|
|
95835
95984
|
async function readTextIfExists(path) {
|
|
95836
95985
|
try {
|
|
@@ -95928,9 +96077,86 @@ function nodeErrorCode(error) {
|
|
|
95928
96077
|
return typeof error.code === "string" ? error.code : null;
|
|
95929
96078
|
}
|
|
95930
96079
|
|
|
96080
|
+
// packages/omo-codex/src/install/agent-model-overrides.ts
|
|
96081
|
+
var RECEIPT_FILE = ".lazycodex-agent-models.json";
|
|
96082
|
+
async function readAgentModelReceipts(codexHome) {
|
|
96083
|
+
const content = await readTextIfExists(receiptPath(codexHome));
|
|
96084
|
+
if (content === null)
|
|
96085
|
+
return new Map;
|
|
96086
|
+
const parsed = parseJson(content);
|
|
96087
|
+
if (!isPlainRecord4(parsed))
|
|
96088
|
+
return new Map;
|
|
96089
|
+
const receipts = new Map;
|
|
96090
|
+
for (const [name, value] of Object.entries(parsed)) {
|
|
96091
|
+
if (!isPlainRecord4(value))
|
|
96092
|
+
continue;
|
|
96093
|
+
const model = value["model"];
|
|
96094
|
+
const reasoningEffort = value["reasoningEffort"];
|
|
96095
|
+
receipts.set(name, {
|
|
96096
|
+
...typeof model === "string" ? { model } : {},
|
|
96097
|
+
...typeof reasoningEffort === "string" ? { reasoningEffort } : {}
|
|
96098
|
+
});
|
|
96099
|
+
}
|
|
96100
|
+
return receipts;
|
|
96101
|
+
}
|
|
96102
|
+
async function writeAgentModelReceipts(codexHome, receipts) {
|
|
96103
|
+
const path = receiptPath(codexHome);
|
|
96104
|
+
if (receipts.size === 0) {
|
|
96105
|
+
await rm8(path, { force: true });
|
|
96106
|
+
return;
|
|
96107
|
+
}
|
|
96108
|
+
await writeFile8(path, `${JSON.stringify(Object.fromEntries(receipts), null, "\t")}
|
|
96109
|
+
`);
|
|
96110
|
+
}
|
|
96111
|
+
async function applyAgentOverride(input) {
|
|
96112
|
+
if (input.override === undefined)
|
|
96113
|
+
return;
|
|
96114
|
+
let content = await readFile14(input.linkPath, "utf8");
|
|
96115
|
+
if (input.override.model !== undefined) {
|
|
96116
|
+
content = replaceTopLevelStringSetting(content, "model", input.override.model, { insertIfMissing: true }).content;
|
|
96117
|
+
}
|
|
96118
|
+
if (input.override.reasoningEffort !== undefined) {
|
|
96119
|
+
content = replaceTopLevelStringSetting(content, "model_reasoning_effort", input.override.reasoningEffort, {
|
|
96120
|
+
insertIfMissing: true
|
|
96121
|
+
}).content;
|
|
96122
|
+
}
|
|
96123
|
+
await writeFile8(input.linkPath, content);
|
|
96124
|
+
}
|
|
96125
|
+
function receiptPath(codexHome) {
|
|
96126
|
+
return join41(codexHome, "agents", RECEIPT_FILE);
|
|
96127
|
+
}
|
|
96128
|
+
function parseJson(content) {
|
|
96129
|
+
try {
|
|
96130
|
+
return JSON.parse(content);
|
|
96131
|
+
} catch (error) {
|
|
96132
|
+
if (error instanceof SyntaxError)
|
|
96133
|
+
return null;
|
|
96134
|
+
throw error;
|
|
96135
|
+
}
|
|
96136
|
+
}
|
|
96137
|
+
|
|
96138
|
+
// packages/omo-codex/src/install/managed-agent-model-defaults.ts
|
|
96139
|
+
var PREVIOUSLY_BUNDLED_AGENT_MODELS = new Set([
|
|
96140
|
+
"gpt-5.2",
|
|
96141
|
+
"gpt-5.4-mini",
|
|
96142
|
+
"gpt-5.5",
|
|
96143
|
+
"gpt-5.6-luna",
|
|
96144
|
+
"gpt-5.6-luna-fast",
|
|
96145
|
+
"gpt-5.6-sol",
|
|
96146
|
+
"gpt-5.6-terra",
|
|
96147
|
+
"gpt-6-astra"
|
|
96148
|
+
]);
|
|
96149
|
+
function handEditedAgentModel(installedModel, receipt) {
|
|
96150
|
+
if (installedModel === null)
|
|
96151
|
+
return null;
|
|
96152
|
+
if (receipt?.model !== undefined)
|
|
96153
|
+
return installedModel === receipt.model ? null : installedModel;
|
|
96154
|
+
return PREVIOUSLY_BUNDLED_AGENT_MODELS.has(installedModel) ? null : installedModel;
|
|
96155
|
+
}
|
|
96156
|
+
|
|
95931
96157
|
// packages/omo-codex/src/install/retired-managed-agent-purge.ts
|
|
95932
|
-
import { lstat as lstat8, readFile as
|
|
95933
|
-
import { join as
|
|
96158
|
+
import { lstat as lstat8, readFile as readFile15, rm as rm9 } from "node:fs/promises";
|
|
96159
|
+
import { join as join42 } from "node:path";
|
|
95934
96160
|
var RETIRED_MANAGED_AGENT_FILES = [
|
|
95935
96161
|
{
|
|
95936
96162
|
fileName: "codex-ultrawork-reviewer.toml",
|
|
@@ -95942,11 +96168,11 @@ var RETIRED_MANAGED_AGENT_FILES = [
|
|
|
95942
96168
|
}
|
|
95943
96169
|
];
|
|
95944
96170
|
async function purgeRetiredManagedAgentFiles(input) {
|
|
95945
|
-
const agentsDir =
|
|
96171
|
+
const agentsDir = join42(input.codexHome, "agents");
|
|
95946
96172
|
if (!await exists3(agentsDir))
|
|
95947
96173
|
return;
|
|
95948
96174
|
for (const retiredAgent of RETIRED_MANAGED_AGENT_FILES) {
|
|
95949
|
-
const agentPath =
|
|
96175
|
+
const agentPath = join42(agentsDir, retiredAgent.fileName);
|
|
95950
96176
|
if (!await exists3(agentPath))
|
|
95951
96177
|
continue;
|
|
95952
96178
|
const agentStat = await lstat8(agentPath);
|
|
@@ -95955,7 +96181,7 @@ async function purgeRetiredManagedAgentFiles(input) {
|
|
|
95955
96181
|
const content = await readTextIfExists2(agentPath);
|
|
95956
96182
|
if (content === null || !hasRequiredMarkers(content, retiredAgent.requiredMarkers))
|
|
95957
96183
|
continue;
|
|
95958
|
-
await
|
|
96184
|
+
await rm9(agentPath, { force: true });
|
|
95959
96185
|
}
|
|
95960
96186
|
}
|
|
95961
96187
|
function hasRequiredMarkers(content, markers) {
|
|
@@ -95963,7 +96189,7 @@ function hasRequiredMarkers(content, markers) {
|
|
|
95963
96189
|
}
|
|
95964
96190
|
async function readTextIfExists2(path) {
|
|
95965
96191
|
try {
|
|
95966
|
-
return await
|
|
96192
|
+
return await readFile15(path, "utf8");
|
|
95967
96193
|
} catch (error) {
|
|
95968
96194
|
if (nodeErrorCode2(error) === "ENOENT")
|
|
95969
96195
|
return null;
|
|
@@ -95988,13 +96214,13 @@ function nodeErrorCode2(error) {
|
|
|
95988
96214
|
|
|
95989
96215
|
// packages/omo-codex/src/install/default-agent-role.ts
|
|
95990
96216
|
import { createHash as createHash3 } from "node:crypto";
|
|
95991
|
-
import { lstat as lstat9, readFile as
|
|
95992
|
-
import { join as
|
|
96217
|
+
import { lstat as lstat9, readFile as readFile16, rm as rm10 } from "node:fs/promises";
|
|
96218
|
+
import { join as join43 } from "node:path";
|
|
95993
96219
|
var REGISTRATION = { name: "default", configFile: "./agents/default.toml" };
|
|
95994
96220
|
async function installDefaultAgentRole(input) {
|
|
95995
|
-
const target =
|
|
95996
|
-
const receipt =
|
|
95997
|
-
const configPath =
|
|
96221
|
+
const target = join43(input.codexHome, "agents", "default.toml");
|
|
96222
|
+
const receipt = join43(input.codexHome, "agents", ".lazycodex-default.sha256");
|
|
96223
|
+
const configPath = join43(input.codexHome, "config.toml");
|
|
95998
96224
|
const config = await readIfPresent(configPath);
|
|
95999
96225
|
const entry = await lstat9(target).catch((error) => {
|
|
96000
96226
|
if (error instanceof Error && "code" in error && error.code === "ENOENT")
|
|
@@ -96017,15 +96243,15 @@ async function installDefaultAgentRole(input) {
|
|
|
96017
96243
|
if (next !== config)
|
|
96018
96244
|
await writeFileAtomic(configPath, next);
|
|
96019
96245
|
}
|
|
96020
|
-
await
|
|
96021
|
-
await
|
|
96246
|
+
await rm10(target);
|
|
96247
|
+
await rm10(receipt);
|
|
96022
96248
|
}
|
|
96023
96249
|
return null;
|
|
96024
96250
|
}
|
|
96025
96251
|
if (foreign || existing !== null && !owned) {
|
|
96026
96252
|
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.");
|
|
96027
96253
|
}
|
|
96028
|
-
const worker = await
|
|
96254
|
+
const worker = await readFile16(input.worker.path, "utf8");
|
|
96029
96255
|
const content = worker.replace(/^name\s*=\s*["']lazycodex-worker-medium["']\s*$/m, 'name = "default"');
|
|
96030
96256
|
if (content === worker)
|
|
96031
96257
|
throw new Error("Cannot derive default: medium worker has no matching internal name");
|
|
@@ -96035,7 +96261,7 @@ async function installDefaultAgentRole(input) {
|
|
|
96035
96261
|
}
|
|
96036
96262
|
async function readIfPresent(path) {
|
|
96037
96263
|
try {
|
|
96038
|
-
return await
|
|
96264
|
+
return await readFile16(path, "utf8");
|
|
96039
96265
|
} catch (error) {
|
|
96040
96266
|
if (error instanceof Error && "code" in error && error.code === "ENOENT")
|
|
96041
96267
|
return null;
|
|
@@ -96055,27 +96281,19 @@ async function linkCachedPluginAgents(input) {
|
|
|
96055
96281
|
await writeManifest(input.pluginRoot, []);
|
|
96056
96282
|
return [];
|
|
96057
96283
|
}
|
|
96058
|
-
const agentsDir =
|
|
96059
|
-
await
|
|
96284
|
+
const agentsDir = join44(input.codexHome, "agents");
|
|
96285
|
+
await mkdir7(agentsDir, { recursive: true });
|
|
96286
|
+
const previousReceipts = await readAgentModelReceipts(input.codexHome);
|
|
96287
|
+
const receipts = new Map;
|
|
96060
96288
|
const linked = [];
|
|
96061
96289
|
for (const agentPath of bundledAgents) {
|
|
96062
96290
|
const agentFileName = basename7(agentPath);
|
|
96063
96291
|
const agentName = agentNameFromToml2(agentFileName);
|
|
96064
|
-
const linkPath =
|
|
96065
|
-
await
|
|
96066
|
-
await restorePreservedReasoning({
|
|
96067
|
-
agentName,
|
|
96068
|
-
linkPath,
|
|
96069
|
-
target: agentPath,
|
|
96070
|
-
value: input.preservedReasoning?.get(agentName)
|
|
96071
|
-
});
|
|
96072
|
-
await restorePreservedServiceTier({
|
|
96073
|
-
linkPath,
|
|
96074
|
-
preserved: input.preservedServiceTier?.has(agentName) ?? false,
|
|
96075
|
-
value: input.preservedServiceTier?.get(agentName) ?? null
|
|
96076
|
-
});
|
|
96292
|
+
const linkPath = join44(agentsDir, agentFileName);
|
|
96293
|
+
receipts.set(agentName, await syncAgentFile({ ...input, agentName, agentPath, linkPath, previousReceipt: previousReceipts.get(agentName) }));
|
|
96077
96294
|
linked.push({ name: agentFileName, path: linkPath, target: agentPath });
|
|
96078
96295
|
}
|
|
96296
|
+
await writeAgentModelReceipts(input.codexHome, receipts);
|
|
96079
96297
|
const worker = linked.find((entry) => entry.name === "lazycodex-worker-medium.toml");
|
|
96080
96298
|
if (worker !== undefined) {
|
|
96081
96299
|
const fallback = await installDefaultAgentRole({ codexHome: input.codexHome, worker, enabled: input.defaultRoleEnabled !== false });
|
|
@@ -96085,8 +96303,33 @@ async function linkCachedPluginAgents(input) {
|
|
|
96085
96303
|
await writeManifest(input.pluginRoot, linked.map((entry) => entry.path));
|
|
96086
96304
|
return linked;
|
|
96087
96305
|
}
|
|
96306
|
+
async function syncAgentFile(input) {
|
|
96307
|
+
const installed = await readTextIfExists(input.linkPath);
|
|
96308
|
+
const installedModel = installed === null ? null : extractModel(installed);
|
|
96309
|
+
const preservedReasoning = input.preservedReasoning?.get(input.agentName);
|
|
96310
|
+
const override = input.agentOverrides?.get(input.agentName);
|
|
96311
|
+
await replaceWithCopy(input.linkPath, input.agentPath);
|
|
96312
|
+
await restorePreservedModel({ linkPath: input.linkPath, value: handEditedAgentModel(installedModel, input.previousReceipt) });
|
|
96313
|
+
await restorePreservedReasoning({
|
|
96314
|
+
agentName: input.agentName,
|
|
96315
|
+
linkPath: input.linkPath,
|
|
96316
|
+
target: input.agentPath,
|
|
96317
|
+
value: preservedReasoning?.effort === input.previousReceipt?.reasoningEffort ? undefined : preservedReasoning
|
|
96318
|
+
});
|
|
96319
|
+
await restorePreservedServiceTier({
|
|
96320
|
+
linkPath: input.linkPath,
|
|
96321
|
+
preserved: input.preservedServiceTier?.has(input.agentName) ?? false,
|
|
96322
|
+
value: input.preservedServiceTier?.get(input.agentName) ?? null
|
|
96323
|
+
});
|
|
96324
|
+
await applyAgentOverride({ linkPath: input.linkPath, override });
|
|
96325
|
+
const model = override?.model ?? extractModel(await readFile17(input.agentPath, "utf8"));
|
|
96326
|
+
return {
|
|
96327
|
+
...model === null ? {} : { model },
|
|
96328
|
+
...override?.reasoningEffort === undefined ? {} : { reasoningEffort: override.reasoningEffort }
|
|
96329
|
+
};
|
|
96330
|
+
}
|
|
96088
96331
|
async function discoverBundledAgents(pluginRoot) {
|
|
96089
|
-
const componentsRoot =
|
|
96332
|
+
const componentsRoot = join44(pluginRoot, "components");
|
|
96090
96333
|
if (!await exists4(componentsRoot))
|
|
96091
96334
|
return [];
|
|
96092
96335
|
const componentEntries = await readdir7(componentsRoot, { withFileTypes: true });
|
|
@@ -96094,14 +96337,14 @@ async function discoverBundledAgents(pluginRoot) {
|
|
|
96094
96337
|
for (const entry of componentEntries) {
|
|
96095
96338
|
if (!entry.isDirectory())
|
|
96096
96339
|
continue;
|
|
96097
|
-
const agentsRoot =
|
|
96340
|
+
const agentsRoot = join44(componentsRoot, entry.name, "agents");
|
|
96098
96341
|
if (!await exists4(agentsRoot))
|
|
96099
96342
|
continue;
|
|
96100
96343
|
const agentEntries = await readdir7(agentsRoot, { withFileTypes: true });
|
|
96101
96344
|
for (const file of agentEntries) {
|
|
96102
96345
|
if (!file.isFile() || !file.name.endsWith(".toml"))
|
|
96103
96346
|
continue;
|
|
96104
|
-
agents.push(
|
|
96347
|
+
agents.push(join44(agentsRoot, file.name));
|
|
96105
96348
|
}
|
|
96106
96349
|
}
|
|
96107
96350
|
agents.sort();
|
|
@@ -96118,12 +96361,12 @@ async function prepareReplacement(linkPath) {
|
|
|
96118
96361
|
if (entryStat.isDirectory() && !entryStat.isSymbolicLink()) {
|
|
96119
96362
|
throw new Error(`${linkPath} already exists and is a directory; refusing to replace`);
|
|
96120
96363
|
}
|
|
96121
|
-
await
|
|
96364
|
+
await rm11(linkPath, { force: true });
|
|
96122
96365
|
}
|
|
96123
96366
|
async function writeManifest(pluginRoot, agentPaths) {
|
|
96124
|
-
const manifestPath =
|
|
96367
|
+
const manifestPath = join44(pluginRoot, MANIFEST_FILE);
|
|
96125
96368
|
const payload = { agents: [...agentPaths].sort() };
|
|
96126
|
-
await
|
|
96369
|
+
await writeFile9(manifestPath, `${JSON.stringify(payload, null, "\t")}
|
|
96127
96370
|
`);
|
|
96128
96371
|
}
|
|
96129
96372
|
function agentNameFromToml2(fileName) {
|
|
@@ -96145,13 +96388,59 @@ function nodeErrorCode3(error) {
|
|
|
96145
96388
|
return typeof error.code === "string" ? error.code : null;
|
|
96146
96389
|
}
|
|
96147
96390
|
|
|
96391
|
+
// packages/omo-codex/src/install/install-codex-agents.ts
|
|
96392
|
+
async function linkInstalledPluginAgents(input) {
|
|
96393
|
+
const { codexHome, log } = input;
|
|
96394
|
+
const preservedReasoning = await capturePreservedAgentReasoning({ codexHome });
|
|
96395
|
+
const preservedServiceTier = await capturePreservedAgentServiceTier({ codexHome });
|
|
96396
|
+
const agentSourceRoots = await agentSourceRootsForInstall(input);
|
|
96397
|
+
const omoConfig = readCodexAgentConfig({ cwd: input.projectDirectory, env: input.env });
|
|
96398
|
+
for (const warning of omoConfig.warnings)
|
|
96399
|
+
log(`Warning: ${warning}`);
|
|
96400
|
+
const agentConfigs = new Map;
|
|
96401
|
+
for (const plugin of input.installed) {
|
|
96402
|
+
const agentLinks = await linkCachedPluginAgents({
|
|
96403
|
+
codexHome,
|
|
96404
|
+
pluginRoot: agentSourceRoots.get(plugin.name) ?? plugin.path,
|
|
96405
|
+
platform: input.platform,
|
|
96406
|
+
preservedReasoning,
|
|
96407
|
+
preservedServiceTier,
|
|
96408
|
+
defaultRoleEnabled: omoConfig.defaultRoleEnabled,
|
|
96409
|
+
agentOverrides: omoConfig.agentOverrides
|
|
96410
|
+
});
|
|
96411
|
+
for (const link of agentLinks) {
|
|
96412
|
+
log(`Linked agent ${link.name} -> ${link.target}`);
|
|
96413
|
+
const agentName = agentNameFromToml3(link.name);
|
|
96414
|
+
agentConfigs.set(agentName, { name: agentName, configFile: `./agents/${link.name}` });
|
|
96415
|
+
}
|
|
96416
|
+
}
|
|
96417
|
+
for (const warning of unmanagedAgentOverrideWarnings(omoConfig.agentOverrides, new Set(agentConfigs.keys()))) {
|
|
96418
|
+
log(`Warning: ${warning}`);
|
|
96419
|
+
}
|
|
96420
|
+
return [...agentConfigs.values()].sort((left, right) => left.name.localeCompare(right.name));
|
|
96421
|
+
}
|
|
96422
|
+
async function agentSourceRootsForInstall(input) {
|
|
96423
|
+
if (input.marketplace.name !== "sisyphuslabs") {
|
|
96424
|
+
return new Map(input.installed.map((plugin) => [plugin.name, plugin.path]));
|
|
96425
|
+
}
|
|
96426
|
+
const snapshotPlugins = await writeInstalledMarketplaceSnapshot({
|
|
96427
|
+
codexHome: input.codexHome,
|
|
96428
|
+
marketplace: input.marketplace,
|
|
96429
|
+
plugins: input.pluginSources
|
|
96430
|
+
});
|
|
96431
|
+
return new Map(snapshotPlugins.map((plugin) => [plugin.name, plugin.path]));
|
|
96432
|
+
}
|
|
96433
|
+
function agentNameFromToml3(fileName) {
|
|
96434
|
+
return fileName.endsWith(".toml") ? fileName.slice(0, -".toml".length) : fileName;
|
|
96435
|
+
}
|
|
96436
|
+
|
|
96148
96437
|
// packages/omo-codex/src/install/codex-marketplace.ts
|
|
96149
|
-
import { readFile as
|
|
96150
|
-
import { join as
|
|
96438
|
+
import { readFile as readFile18 } from "node:fs/promises";
|
|
96439
|
+
import { join as join45 } from "node:path";
|
|
96151
96440
|
var DEFAULT_MARKETPLACE_PATH = "packages/omo-codex/marketplace.json";
|
|
96152
96441
|
async function readMarketplace(repoRoot, options) {
|
|
96153
|
-
const marketplacePath = options?.marketplacePath ??
|
|
96154
|
-
const raw = await
|
|
96442
|
+
const marketplacePath = options?.marketplacePath ?? join45(repoRoot, DEFAULT_MARKETPLACE_PATH);
|
|
96443
|
+
const raw = await readFile18(marketplacePath, "utf8");
|
|
96155
96444
|
const parsed = JSON.parse(raw);
|
|
96156
96445
|
if (!isPlainRecord4(parsed))
|
|
96157
96446
|
throw new Error("marketplace.json must be an object");
|
|
@@ -96169,10 +96458,10 @@ async function readMarketplace(repoRoot, options) {
|
|
|
96169
96458
|
function resolvePluginSource(repoRoot, plugin, options) {
|
|
96170
96459
|
const sourcePath = localSourcePath(options?.pathOverride ?? plugin.source);
|
|
96171
96460
|
const relativePath = sourcePath.slice(2);
|
|
96172
|
-
return
|
|
96461
|
+
return join45(repoRoot, ...relativePath.split(/[\\/]/));
|
|
96173
96462
|
}
|
|
96174
96463
|
async function readPluginManifest(pluginRoot) {
|
|
96175
|
-
const raw = await
|
|
96464
|
+
const raw = await readFile18(join45(pluginRoot, ".codex-plugin", "plugin.json"), "utf8");
|
|
96176
96465
|
const parsed = JSON.parse(raw);
|
|
96177
96466
|
if (!isPlainRecord4(parsed))
|
|
96178
96467
|
throw new Error(`${pluginRoot} plugin.json must be an object`);
|
|
@@ -96252,61 +96541,12 @@ function validateLocalSourcePath(path) {
|
|
|
96252
96541
|
return path;
|
|
96253
96542
|
}
|
|
96254
96543
|
|
|
96255
|
-
// packages/omo-codex/src/install/codex-marketplace-snapshot.ts
|
|
96256
|
-
import { cp as cp3, mkdir as mkdir7, rename as rename4, rm as rm10, writeFile as writeFile8 } from "node:fs/promises";
|
|
96257
|
-
import { join as join44, sep as sep6 } from "node:path";
|
|
96258
|
-
var INSTALLED_MARKETPLACES_DIR = ".tmp/marketplaces";
|
|
96259
|
-
async function writeInstalledMarketplaceSnapshot(input) {
|
|
96260
|
-
const marketplaceRoot = installedMarketplaceRoot(input.codexHome, input.marketplace.name);
|
|
96261
|
-
await mkdir7(marketplaceRoot, { recursive: true });
|
|
96262
|
-
await writeMarketplaceManifest(marketplaceRoot, input.marketplace);
|
|
96263
|
-
const snapshotPlugins = [];
|
|
96264
|
-
for (const plugin of input.plugins) {
|
|
96265
|
-
snapshotPlugins.push(await writeSnapshotPlugin(marketplaceRoot, plugin));
|
|
96266
|
-
}
|
|
96267
|
-
return snapshotPlugins;
|
|
96268
|
-
}
|
|
96269
|
-
function installedMarketplaceRoot(codexHome, marketplaceName) {
|
|
96270
|
-
return join44(codexHome, INSTALLED_MARKETPLACES_DIR, marketplaceName);
|
|
96271
|
-
}
|
|
96272
|
-
async function writeMarketplaceManifest(marketplaceRoot, marketplace) {
|
|
96273
|
-
const manifestDir = join44(marketplaceRoot, ".agents", "plugins");
|
|
96274
|
-
await mkdir7(manifestDir, { recursive: true });
|
|
96275
|
-
const tempPath = join44(manifestDir, `.marketplace-${process.pid}-${Date.now()}.json.tmp`);
|
|
96276
|
-
await writeFile8(tempPath, `${JSON.stringify(marketplace, null, "\t")}
|
|
96277
|
-
`);
|
|
96278
|
-
await rename4(tempPath, join44(manifestDir, "marketplace.json"));
|
|
96279
|
-
}
|
|
96280
|
-
async function writeSnapshotPlugin(marketplaceRoot, plugin) {
|
|
96281
|
-
const pluginsDir = join44(marketplaceRoot, "plugins");
|
|
96282
|
-
await mkdir7(pluginsDir, { recursive: true });
|
|
96283
|
-
const targetPath = join44(pluginsDir, plugin.name);
|
|
96284
|
-
const tempPath = join44(pluginsDir, `.tmp-${plugin.name}-${process.pid}-${Date.now()}`);
|
|
96285
|
-
await rm10(tempPath, { recursive: true, force: true });
|
|
96286
|
-
await cp3(plugin.sourcePath, tempPath, {
|
|
96287
|
-
recursive: true,
|
|
96288
|
-
filter: (source) => shouldCopyMarketplaceSourcePath(source, plugin.sourcePath)
|
|
96289
|
-
});
|
|
96290
|
-
await copyBundledMcpRuntimeDists({ pluginRoot: tempPath, sourceRoot: plugin.sourcePath });
|
|
96291
|
-
await rm10(targetPath, { recursive: true, force: true });
|
|
96292
|
-
await rename4(tempPath, targetPath);
|
|
96293
|
-
await rewriteCachedMcpManifest(targetPath, plugin.sourcePath);
|
|
96294
|
-
return { name: plugin.name, path: targetPath };
|
|
96295
|
-
}
|
|
96296
|
-
function shouldCopyMarketplaceSourcePath(path, root) {
|
|
96297
|
-
const relative = path === root ? "" : path.slice(root.length + sep6.length);
|
|
96298
|
-
if (relative === "")
|
|
96299
|
-
return true;
|
|
96300
|
-
const parts = relative.split(sep6);
|
|
96301
|
-
return !parts.some((part) => part === ".git" || part === "node_modules");
|
|
96302
|
-
}
|
|
96303
|
-
|
|
96304
96544
|
// packages/omo-codex/src/install/lazycodex-version-stamp.ts
|
|
96305
|
-
import { readdir as readdir8, readFile as
|
|
96306
|
-
import { join as
|
|
96545
|
+
import { readdir as readdir8, readFile as readFile19, writeFile as writeFile10 } from "node:fs/promises";
|
|
96546
|
+
import { join as join46 } from "node:path";
|
|
96307
96547
|
async function readDistributionManifest(repoRoot) {
|
|
96308
96548
|
try {
|
|
96309
|
-
const parsed = JSON.parse(await
|
|
96549
|
+
const parsed = JSON.parse(await readFile19(join46(repoRoot, "package.json"), "utf8"));
|
|
96310
96550
|
if (!isPlainRecord4(parsed) || typeof parsed.version !== "string" || parsed.version.trim().length === 0)
|
|
96311
96551
|
return;
|
|
96312
96552
|
return {
|
|
@@ -96330,19 +96570,19 @@ function resolveLazyCodexPluginVersion(input) {
|
|
|
96330
96570
|
return input.manifestVersion ?? "local";
|
|
96331
96571
|
}
|
|
96332
96572
|
async function stampLazyCodexPluginVersion(input) {
|
|
96333
|
-
const manifestPath =
|
|
96573
|
+
const manifestPath = join46(input.pluginRoot, ".codex-plugin", "plugin.json");
|
|
96334
96574
|
const hookPaths = await readPluginHookPaths(manifestPath);
|
|
96335
96575
|
await stampJsonVersion(manifestPath, input.version);
|
|
96336
|
-
await stampJsonVersion(
|
|
96576
|
+
await stampJsonVersion(join46(input.pluginRoot, "package.json"), input.version);
|
|
96337
96577
|
for (const hookPath of hookPaths) {
|
|
96338
|
-
await stampHookStatusMessages(
|
|
96578
|
+
await stampHookStatusMessages(join46(input.pluginRoot, hookPath), input.version);
|
|
96339
96579
|
}
|
|
96340
96580
|
await stampComponentVersions(input);
|
|
96341
96581
|
}
|
|
96342
96582
|
async function writeLazyCodexInstallSnapshot(input) {
|
|
96343
96583
|
if (input.distributionManifest === undefined)
|
|
96344
96584
|
return;
|
|
96345
|
-
await
|
|
96585
|
+
await writeFile10(join46(input.pluginRoot, "lazycodex-install.json"), `${JSON.stringify({
|
|
96346
96586
|
packageName: input.distributionManifest.name,
|
|
96347
96587
|
version: input.distributionManifest.version
|
|
96348
96588
|
}, null, "\t")}
|
|
@@ -96350,11 +96590,11 @@ async function writeLazyCodexInstallSnapshot(input) {
|
|
|
96350
96590
|
}
|
|
96351
96591
|
async function stampJsonVersion(path, version) {
|
|
96352
96592
|
try {
|
|
96353
|
-
const parsed = JSON.parse(await
|
|
96593
|
+
const parsed = JSON.parse(await readFile19(path, "utf8"));
|
|
96354
96594
|
if (!isPlainRecord4(parsed))
|
|
96355
96595
|
return;
|
|
96356
96596
|
parsed.version = version;
|
|
96357
|
-
await
|
|
96597
|
+
await writeFile10(path, `${JSON.stringify(parsed, null, "\t")}
|
|
96358
96598
|
`);
|
|
96359
96599
|
} catch (error) {
|
|
96360
96600
|
if (error instanceof Error)
|
|
@@ -96364,7 +96604,7 @@ async function stampJsonVersion(path, version) {
|
|
|
96364
96604
|
}
|
|
96365
96605
|
async function readPluginHookPaths(manifestPath) {
|
|
96366
96606
|
try {
|
|
96367
|
-
const parsed = JSON.parse(await
|
|
96607
|
+
const parsed = JSON.parse(await readFile19(manifestPath, "utf8"));
|
|
96368
96608
|
if (!isPlainRecord4(parsed))
|
|
96369
96609
|
return [];
|
|
96370
96610
|
if (typeof parsed.hooks === "string" && parsed.hooks.trim().length > 0)
|
|
@@ -96384,11 +96624,11 @@ function stripDotSlash3(path) {
|
|
|
96384
96624
|
}
|
|
96385
96625
|
async function stampHookStatusMessages(path, version) {
|
|
96386
96626
|
try {
|
|
96387
|
-
const parsed = JSON.parse(await
|
|
96627
|
+
const parsed = JSON.parse(await readFile19(path, "utf8"));
|
|
96388
96628
|
if (!isPlainRecord4(parsed))
|
|
96389
96629
|
return;
|
|
96390
96630
|
stampHookGroups(parsed.hooks, version);
|
|
96391
|
-
await
|
|
96631
|
+
await writeFile10(path, `${JSON.stringify(parsed, null, "\t")}
|
|
96392
96632
|
`);
|
|
96393
96633
|
} catch (error) {
|
|
96394
96634
|
if (error instanceof Error)
|
|
@@ -96399,16 +96639,16 @@ async function stampHookStatusMessages(path, version) {
|
|
|
96399
96639
|
async function stampComponentVersions(input) {
|
|
96400
96640
|
let entries;
|
|
96401
96641
|
try {
|
|
96402
|
-
entries = await readdir8(
|
|
96642
|
+
entries = await readdir8(join46(input.pluginRoot, "components"));
|
|
96403
96643
|
} catch (error) {
|
|
96404
96644
|
if (error instanceof Error)
|
|
96405
96645
|
return;
|
|
96406
96646
|
throw error;
|
|
96407
96647
|
}
|
|
96408
96648
|
for (const entry of entries) {
|
|
96409
|
-
const componentRoot =
|
|
96410
|
-
await stampJsonVersion(
|
|
96411
|
-
await stampHookStatusMessages(
|
|
96649
|
+
const componentRoot = join46(input.pluginRoot, "components", entry);
|
|
96650
|
+
await stampJsonVersion(join46(componentRoot, "package.json"), input.version);
|
|
96651
|
+
await stampHookStatusMessages(join46(componentRoot, "hooks", "hooks.json"), input.version);
|
|
96412
96652
|
}
|
|
96413
96653
|
}
|
|
96414
96654
|
function stampHookGroups(hooks, version) {
|
|
@@ -96465,8 +96705,8 @@ var defaultRunCommand = async (command, args, options) => {
|
|
|
96465
96705
|
};
|
|
96466
96706
|
|
|
96467
96707
|
// packages/omo-codex/src/install/codex-project-local-cleanup.ts
|
|
96468
|
-
import { copyFile as copyFile2, lstat as lstat11, readFile as
|
|
96469
|
-
import { dirname as dirname17, join as
|
|
96708
|
+
import { copyFile as copyFile2, lstat as lstat11, readFile as readFile20, writeFile as writeFile11 } from "node:fs/promises";
|
|
96709
|
+
import { dirname as dirname17, join as join47, resolve as resolve11 } from "node:path";
|
|
96470
96710
|
var LEGACY_AGENT_CONFLICT_KEYS = ["max_threads"];
|
|
96471
96711
|
var PROJECT_LOCAL_ARTIFACT_PATHS = [
|
|
96472
96712
|
".codex/hooks.json",
|
|
@@ -96485,7 +96725,7 @@ async function repairNearestProjectLocalCodexArtifacts(input) {
|
|
|
96485
96725
|
const artifacts = await collectProjectLocalArtifacts(project.artifactRoots);
|
|
96486
96726
|
const configs = [];
|
|
96487
96727
|
for (const configPath of project.configPaths) {
|
|
96488
|
-
const original = await
|
|
96728
|
+
const original = await readFile20(configPath, "utf8");
|
|
96489
96729
|
const repair = repairProjectLocalCodexConfigText(original);
|
|
96490
96730
|
if (!repair.changed) {
|
|
96491
96731
|
configs.push({
|
|
@@ -96498,7 +96738,7 @@ async function repairNearestProjectLocalCodexArtifacts(input) {
|
|
|
96498
96738
|
}
|
|
96499
96739
|
const backupPath = `${configPath}.backup-${formatBackupTimestamp(input.now?.() ?? new Date)}`;
|
|
96500
96740
|
await copyFile2(configPath, backupPath);
|
|
96501
|
-
await
|
|
96741
|
+
await writeFile11(configPath, `${repair.config.trimEnd()}
|
|
96502
96742
|
`);
|
|
96503
96743
|
configs.push({
|
|
96504
96744
|
projectRoot: project.projectRoot,
|
|
@@ -96569,17 +96809,17 @@ async function findProjectLocalCodexConfigs(startDirectory, codexHome) {
|
|
|
96569
96809
|
if (startDirectoryStat !== null && !startDirectoryStat.isDirectory()) {
|
|
96570
96810
|
throw new ProjectLocalCleanupStartDirectoryError(startDirectory);
|
|
96571
96811
|
}
|
|
96572
|
-
const codexHomeConfigPath = codexHome === undefined ? null :
|
|
96812
|
+
const codexHomeConfigPath = codexHome === undefined ? null : join47(resolve11(codexHome), "config.toml");
|
|
96573
96813
|
let current = resolve11(startDirectory);
|
|
96574
96814
|
const configPathsFromCwd = [];
|
|
96575
96815
|
while (true) {
|
|
96576
|
-
const configPath =
|
|
96816
|
+
const configPath = join47(current, ".codex", "config.toml");
|
|
96577
96817
|
if (await isRegularProjectLocalConfig(current, configPath)) {
|
|
96578
96818
|
if (codexHomeConfigPath === null || resolve11(configPath) !== codexHomeConfigPath) {
|
|
96579
96819
|
configPathsFromCwd.push(configPath);
|
|
96580
96820
|
}
|
|
96581
96821
|
}
|
|
96582
|
-
if (await exists5(
|
|
96822
|
+
if (await exists5(join47(current, ".git"))) {
|
|
96583
96823
|
return configPathsFromCwd.length === 0 ? null : {
|
|
96584
96824
|
projectRoot: current,
|
|
96585
96825
|
configPaths: [...configPathsFromCwd].reverse(),
|
|
@@ -96599,7 +96839,7 @@ async function findProjectLocalCodexConfigs(startDirectory, codexHome) {
|
|
|
96599
96839
|
}
|
|
96600
96840
|
}
|
|
96601
96841
|
async function isRegularProjectLocalConfig(directory, configPath) {
|
|
96602
|
-
const codexDirStat = await maybeLstat(
|
|
96842
|
+
const codexDirStat = await maybeLstat(join47(directory, ".codex"));
|
|
96603
96843
|
if (codexDirStat === null || !codexDirStat.isDirectory() || codexDirStat.isSymbolicLink())
|
|
96604
96844
|
return false;
|
|
96605
96845
|
const configStat = await maybeLstat(configPath);
|
|
@@ -96619,7 +96859,7 @@ async function collectProjectLocalArtifacts(projectRoots) {
|
|
|
96619
96859
|
const seenPaths = new Set;
|
|
96620
96860
|
for (const projectRoot of projectRoots) {
|
|
96621
96861
|
for (const relativePath of PROJECT_LOCAL_ARTIFACT_PATHS) {
|
|
96622
|
-
const artifactPath =
|
|
96862
|
+
const artifactPath = join47(projectRoot, relativePath);
|
|
96623
96863
|
if (seenPaths.has(artifactPath))
|
|
96624
96864
|
continue;
|
|
96625
96865
|
const entryStat = await maybeLstat(artifactPath);
|
|
@@ -96695,13 +96935,13 @@ function formatUnknownError(error) {
|
|
|
96695
96935
|
|
|
96696
96936
|
// packages/omo-codex/src/install/lsp-daemon-reaper.ts
|
|
96697
96937
|
import { createHash as createHash4 } from "node:crypto";
|
|
96698
|
-
import { lstat as lstat12, readFile as
|
|
96938
|
+
import { lstat as lstat12, readFile as readFile22, readdir as readdir10, rm as rm12 } from "node:fs/promises";
|
|
96699
96939
|
import { tmpdir as tmpdir3 } from "node:os";
|
|
96700
|
-
import { join as
|
|
96940
|
+
import { join as join48, posix as posix6 } from "node:path";
|
|
96701
96941
|
|
|
96702
96942
|
// packages/omo-codex/src/install/lsp-daemon-reaper-attestation.ts
|
|
96703
96943
|
import { execFile } from "node:child_process";
|
|
96704
|
-
import { readFile as
|
|
96944
|
+
import { readFile as readFile21, readdir as readdir9, readlink as readlink5 } from "node:fs/promises";
|
|
96705
96945
|
import { connect } from "node:net";
|
|
96706
96946
|
import { basename as basename8 } from "node:path";
|
|
96707
96947
|
var PROBE_TIMEOUT_MS = 500;
|
|
@@ -96743,7 +96983,7 @@ async function attestLegacyDaemonOwnership(input, deps = {}) {
|
|
|
96743
96983
|
return false;
|
|
96744
96984
|
}
|
|
96745
96985
|
async function attestLinuxOwnership(input, deps) {
|
|
96746
|
-
const readFileImpl = deps.readFile ??
|
|
96986
|
+
const readFileImpl = deps.readFile ?? readFile21;
|
|
96747
96987
|
const readDirImpl = deps.readDir ?? readdir9;
|
|
96748
96988
|
const readLinkImpl = deps.readLink ?? readlink5;
|
|
96749
96989
|
const procNetUnix = await readText(readFileImpl, "/proc/net/unix");
|
|
@@ -96870,7 +97110,7 @@ async function readBinary(readFileImpl, path) {
|
|
|
96870
97110
|
var LEGACY_EXIT_WAIT_TIMEOUT_MS = 5000;
|
|
96871
97111
|
var LEGACY_VERSION_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._+-]{0,127}$/;
|
|
96872
97112
|
async function reapLspDaemons(codexHome, deps = {}) {
|
|
96873
|
-
const daemonRoot =
|
|
97113
|
+
const daemonRoot = join48(codexHome, "codex-lsp", "daemon");
|
|
96874
97114
|
const platform = deps.platform ?? process.platform;
|
|
96875
97115
|
const tmpDir = deps.tmpDir ?? tmpdir3();
|
|
96876
97116
|
const probe = deps.probeLegacyJsonRpc ?? probeLegacyJsonRpcEndpoint;
|
|
@@ -96880,7 +97120,7 @@ async function reapLspDaemons(codexHome, deps = {}) {
|
|
|
96880
97120
|
const entries = await readdir10(daemonRoot, { withFileTypes: true }).catch(() => []);
|
|
96881
97121
|
const results = [];
|
|
96882
97122
|
for (const entry of [...entries].sort((left, right) => left.name.localeCompare(right.name))) {
|
|
96883
|
-
const versionPath =
|
|
97123
|
+
const versionPath = join48(daemonRoot, entry.name);
|
|
96884
97124
|
const parsedVersion = parseVersionEntry(entry.name);
|
|
96885
97125
|
if (parsedVersion === null || !entry.isDirectory()) {
|
|
96886
97126
|
await removeVersionDir(versionPath);
|
|
@@ -96928,7 +97168,7 @@ function parseVersionEntry(entryName) {
|
|
|
96928
97168
|
return LEGACY_VERSION_PATTERN.test(version) ? version : null;
|
|
96929
97169
|
}
|
|
96930
97170
|
async function readLegacyMetadata(input) {
|
|
96931
|
-
const pidText = await readRegularTrimmedFile(
|
|
97171
|
+
const pidText = await readRegularTrimmedFile(join48(input.versionPath, "daemon.pid"));
|
|
96932
97172
|
if (pidText === "non_regular")
|
|
96933
97173
|
return { kind: "remove", reason: "removed non-regular legacy daemon metadata" };
|
|
96934
97174
|
if (pidText === null)
|
|
@@ -96936,7 +97176,7 @@ async function readLegacyMetadata(input) {
|
|
|
96936
97176
|
const pid = Number.parseInt(pidText, 10);
|
|
96937
97177
|
if (!Number.isInteger(pid) || pid <= 0)
|
|
96938
97178
|
return { kind: "remove", reason: "removed malformed legacy daemon metadata" };
|
|
96939
|
-
const endpointText = await readRegularTrimmedFile(
|
|
97179
|
+
const endpointText = await readRegularTrimmedFile(join48(input.versionPath, "daemon.endpoint"));
|
|
96940
97180
|
if (endpointText === "non_regular")
|
|
96941
97181
|
return { kind: "remove", reason: "removed non-regular legacy daemon metadata" };
|
|
96942
97182
|
if (endpointText === null)
|
|
@@ -96968,14 +97208,14 @@ async function readRegularTrimmedFile(path) {
|
|
|
96968
97208
|
return null;
|
|
96969
97209
|
if (!stats.isFile())
|
|
96970
97210
|
return "non_regular";
|
|
96971
|
-
const content = (await
|
|
97211
|
+
const content = (await readFile22(path, "utf8")).trim();
|
|
96972
97212
|
return content.length > 0 ? content : null;
|
|
96973
97213
|
}
|
|
96974
97214
|
function shortDigest(value) {
|
|
96975
97215
|
return createHash4("sha256").update(value).digest("hex").slice(0, 16);
|
|
96976
97216
|
}
|
|
96977
97217
|
async function removeVersionDir(path) {
|
|
96978
|
-
await
|
|
97218
|
+
await rm12(path, { recursive: true, force: true });
|
|
96979
97219
|
}
|
|
96980
97220
|
function removed(version, reason) {
|
|
96981
97221
|
return { version, status: "removed", reason };
|
|
@@ -97015,7 +97255,7 @@ function processIsRunning(pid) {
|
|
|
97015
97255
|
|
|
97016
97256
|
// packages/omo-codex/src/install/codex-installer-bin-dir.ts
|
|
97017
97257
|
import { homedir as homedir5 } from "node:os";
|
|
97018
|
-
import { join as
|
|
97258
|
+
import { join as join49, resolve as resolve12 } from "node:path";
|
|
97019
97259
|
function resolveCodexInstallerBinDir(input) {
|
|
97020
97260
|
const explicitBinDir = input.binDir ?? input.env?.CODEX_LOCAL_BIN_DIR;
|
|
97021
97261
|
if (explicitBinDir !== undefined && explicitBinDir.trim().length > 0)
|
|
@@ -97024,16 +97264,16 @@ function resolveCodexInstallerBinDir(input) {
|
|
|
97024
97264
|
const defaultCodexHome = resolve12(homeDir, ".codex");
|
|
97025
97265
|
const resolvedCodexHome = resolve12(input.codexHome);
|
|
97026
97266
|
if (resolvedCodexHome !== defaultCodexHome)
|
|
97027
|
-
return
|
|
97267
|
+
return join49(resolvedCodexHome, "bin");
|
|
97028
97268
|
return resolve12(homeDir, ".local", "bin");
|
|
97029
97269
|
}
|
|
97030
97270
|
|
|
97031
97271
|
// packages/omo-codex/src/install/codex-installed-bin-dir.ts
|
|
97032
|
-
import { readFile as
|
|
97033
|
-
import { join as
|
|
97272
|
+
import { readFile as readFile23, readdir as readdir11, writeFile as writeFile12 } from "node:fs/promises";
|
|
97273
|
+
import { join as join50 } from "node:path";
|
|
97034
97274
|
var INSTALLED_BIN_DIR_MANIFEST = ".installed-bin-dir.json";
|
|
97035
97275
|
async function writeInstalledCodexBinDir(input) {
|
|
97036
|
-
await
|
|
97276
|
+
await writeFile12(join50(input.pluginRoot, INSTALLED_BIN_DIR_MANIFEST), `${JSON.stringify({ binDir: input.binDir }, null, 2)}
|
|
97037
97277
|
`);
|
|
97038
97278
|
}
|
|
97039
97279
|
async function readInstalledCodexBinDir(codexHome) {
|
|
@@ -97046,20 +97286,20 @@ async function readInstalledCodexBinDir(codexHome) {
|
|
|
97046
97286
|
}
|
|
97047
97287
|
async function installedBinDirManifestPaths(codexHome) {
|
|
97048
97288
|
const paths = [
|
|
97049
|
-
|
|
97289
|
+
join50(codexHome, ".tmp", "marketplaces", "sisyphuslabs", "plugins", "omo", INSTALLED_BIN_DIR_MANIFEST)
|
|
97050
97290
|
];
|
|
97051
|
-
const versionRoot =
|
|
97291
|
+
const versionRoot = join50(codexHome, "plugins", "cache", "sisyphuslabs", "omo");
|
|
97052
97292
|
const entries = await readdir11(versionRoot, { withFileTypes: true }).catch(() => null);
|
|
97053
97293
|
if (entries !== null) {
|
|
97054
97294
|
for (const entry of entries) {
|
|
97055
97295
|
if (entry.isDirectory())
|
|
97056
|
-
paths.push(
|
|
97296
|
+
paths.push(join50(versionRoot, entry.name, INSTALLED_BIN_DIR_MANIFEST));
|
|
97057
97297
|
}
|
|
97058
97298
|
}
|
|
97059
97299
|
return paths;
|
|
97060
97300
|
}
|
|
97061
97301
|
async function readBinDirFromManifest(manifestPath) {
|
|
97062
|
-
const raw = await
|
|
97302
|
+
const raw = await readFile23(manifestPath, "utf8").catch(() => null);
|
|
97063
97303
|
if (raw === null)
|
|
97064
97304
|
return null;
|
|
97065
97305
|
let parsed;
|
|
@@ -97077,8 +97317,8 @@ async function readBinDirFromManifest(manifestPath) {
|
|
|
97077
97317
|
}
|
|
97078
97318
|
|
|
97079
97319
|
// packages/omo-codex/src/install/codex-git-bash-hooks.ts
|
|
97080
|
-
import { readFile as
|
|
97081
|
-
import { join as
|
|
97320
|
+
import { readFile as readFile24, writeFile as writeFile13 } from "node:fs/promises";
|
|
97321
|
+
import { join as join51 } from "node:path";
|
|
97082
97322
|
var WINDOWS_ONLY_GIT_BASH_HOOKS = new Set([
|
|
97083
97323
|
"./hooks/pre-tool-use-recommending-git-bash-mcp.json",
|
|
97084
97324
|
"./hooks/post-compact-resetting-git-bash-mcp-reminder.json"
|
|
@@ -97086,20 +97326,20 @@ var WINDOWS_ONLY_GIT_BASH_HOOKS = new Set([
|
|
|
97086
97326
|
async function removeGitBashHooksOffWindows(input) {
|
|
97087
97327
|
if (input.platform === "win32")
|
|
97088
97328
|
return;
|
|
97089
|
-
const manifestPath =
|
|
97090
|
-
const parsed = JSON.parse(await
|
|
97329
|
+
const manifestPath = join51(input.pluginRoot, ".codex-plugin", "plugin.json");
|
|
97330
|
+
const parsed = JSON.parse(await readFile24(manifestPath, "utf8"));
|
|
97091
97331
|
if (!isPlainRecord4(parsed) || !Array.isArray(parsed.hooks))
|
|
97092
97332
|
return;
|
|
97093
97333
|
const hooks = parsed.hooks.filter((hook) => typeof hook !== "string" || !WINDOWS_ONLY_GIT_BASH_HOOKS.has(hook));
|
|
97094
97334
|
if (hooks.length === parsed.hooks.length)
|
|
97095
97335
|
return;
|
|
97096
|
-
await
|
|
97336
|
+
await writeFile13(manifestPath, `${JSON.stringify({ ...parsed, hooks }, null, "\t")}
|
|
97097
97337
|
`);
|
|
97098
97338
|
}
|
|
97099
97339
|
|
|
97100
97340
|
// packages/omo-codex/src/install/install-ast-grep-sg.ts
|
|
97101
97341
|
init_src();
|
|
97102
|
-
import { join as
|
|
97342
|
+
import { join as join52 } from "node:path";
|
|
97103
97343
|
function describeResult(result) {
|
|
97104
97344
|
if (result.kind === "succeeded")
|
|
97105
97345
|
return null;
|
|
@@ -97113,7 +97353,7 @@ async function installAstGrepForCodex(options) {
|
|
|
97113
97353
|
return;
|
|
97114
97354
|
const platform = options.platform ?? process.platform;
|
|
97115
97355
|
const targetDir = astGrepRuntimeDir(options.codexHome, platform, options.arch ?? process.arch);
|
|
97116
|
-
const skillDir =
|
|
97356
|
+
const skillDir = join52(plugin.path, "skills", "ast-grep");
|
|
97117
97357
|
const installer = options.installer ?? runAstGrepSkillInstall;
|
|
97118
97358
|
try {
|
|
97119
97359
|
const result = await installer({ platform, skillDir, targetDir });
|
|
@@ -97146,7 +97386,7 @@ async function runCodexInstaller(options = {}) {
|
|
|
97146
97386
|
const env = options.env ?? process.env;
|
|
97147
97387
|
const platform = options.platform ?? process.platform;
|
|
97148
97388
|
const repoRoot = resolve13(options.repoRoot ?? findRepoRoot({ importerDir: import.meta.dir, env }));
|
|
97149
|
-
const codexHome = resolve13(options.codexHome ?? env.CODEX_HOME ??
|
|
97389
|
+
const codexHome = resolve13(options.codexHome ?? env.CODEX_HOME ?? join56(homedir6(), ".codex"));
|
|
97150
97390
|
const projectDirectory = resolve13(options.projectDirectory ?? env.OMO_CODEX_PROJECT ?? process.cwd());
|
|
97151
97391
|
const binDir = resolveCodexInstallerBinDir({ binDir: options.binDir, codexHome, env });
|
|
97152
97392
|
const runCommand = options.runCommand ?? defaultRunCommand;
|
|
@@ -97163,14 +97403,13 @@ async function runCodexInstaller(options = {}) {
|
|
|
97163
97403
|
if (!gitBashResolution.found) {
|
|
97164
97404
|
throw new Error(gitBashResolution.installHint);
|
|
97165
97405
|
}
|
|
97166
|
-
const codexPackageRoot =
|
|
97406
|
+
const codexPackageRoot = join56(repoRoot, "packages", "omo-codex");
|
|
97167
97407
|
const marketplace = await readMarketplace(repoRoot, {
|
|
97168
|
-
marketplacePath:
|
|
97408
|
+
marketplacePath: join56(codexPackageRoot, "marketplace.json")
|
|
97169
97409
|
});
|
|
97170
97410
|
const distributionManifest = await readDistributionManifest(repoRoot);
|
|
97171
97411
|
const installed = [];
|
|
97172
97412
|
const pluginSources = [];
|
|
97173
|
-
const agentConfigs = new Map;
|
|
97174
97413
|
for (const entry of marketplace.plugins) {
|
|
97175
97414
|
const sourcePath = resolvePluginSource(codexPackageRoot, entry, { pathOverride: "./plugin" });
|
|
97176
97415
|
const manifest = await readPluginManifest(sourcePath);
|
|
@@ -97211,7 +97450,7 @@ async function runCodexInstaller(options = {}) {
|
|
|
97211
97450
|
if (runtimeLink !== null)
|
|
97212
97451
|
log(`Linked ${runtimeLink.name} -> ${runtimeLink.target}`);
|
|
97213
97452
|
else
|
|
97214
|
-
log(`Warning: skipped the omo-agent-toolkit runtime wrapper because ${
|
|
97453
|
+
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`);
|
|
97215
97454
|
}
|
|
97216
97455
|
pluginSources.push({ name: entry.name, sourcePath });
|
|
97217
97456
|
installed.push(plugin);
|
|
@@ -97223,33 +97462,16 @@ async function runCodexInstaller(options = {}) {
|
|
|
97223
97462
|
log,
|
|
97224
97463
|
platform
|
|
97225
97464
|
});
|
|
97226
|
-
const
|
|
97227
|
-
const preservedServiceTier = await capturePreservedAgentServiceTier({ codexHome });
|
|
97228
|
-
const agentSourceRoots = await agentSourceRootsForInstall({
|
|
97465
|
+
const agentConfigs = await linkInstalledPluginAgents({
|
|
97229
97466
|
codexHome,
|
|
97467
|
+
projectDirectory,
|
|
97468
|
+
env,
|
|
97469
|
+
platform,
|
|
97470
|
+
log,
|
|
97230
97471
|
marketplace,
|
|
97231
97472
|
installed,
|
|
97232
97473
|
pluginSources
|
|
97233
97474
|
});
|
|
97234
|
-
const omoConfig = readDefaultRoleConfig({ cwd: projectDirectory, env });
|
|
97235
|
-
for (const warning of omoConfig.warnings)
|
|
97236
|
-
log(`Warning: ${warning}`);
|
|
97237
|
-
for (const plugin of installed) {
|
|
97238
|
-
const pluginRoot = agentSourceRoots.get(plugin.name) ?? plugin.path;
|
|
97239
|
-
const agentLinks = await linkCachedPluginAgents({
|
|
97240
|
-
codexHome,
|
|
97241
|
-
pluginRoot,
|
|
97242
|
-
platform,
|
|
97243
|
-
preservedReasoning,
|
|
97244
|
-
preservedServiceTier,
|
|
97245
|
-
defaultRoleEnabled: omoConfig.enabled
|
|
97246
|
-
});
|
|
97247
|
-
for (const link of agentLinks) {
|
|
97248
|
-
log(`Linked agent ${link.name} -> ${link.target}`);
|
|
97249
|
-
const agentName = agentNameFromToml3(link.name);
|
|
97250
|
-
agentConfigs.set(agentName, { name: agentName, configFile: `./agents/${link.name}` });
|
|
97251
|
-
}
|
|
97252
|
-
}
|
|
97253
97475
|
const trustedHookStates = (await Promise.all(installed.map((plugin) => trustedHookStatesForPlugin({
|
|
97254
97476
|
marketplaceName: marketplace.name,
|
|
97255
97477
|
platform,
|
|
@@ -97278,13 +97500,13 @@ async function runCodexInstaller(options = {}) {
|
|
|
97278
97500
|
continue;
|
|
97279
97501
|
log(`Warning: deferred legacy Codex LSP daemon cleanup for v${cleanup.version}: ${cleanup.reason}`);
|
|
97280
97502
|
}
|
|
97281
|
-
const marketplaceRoot =
|
|
97503
|
+
const marketplaceRoot = join56(codexHome, "plugins", "cache", marketplace.name);
|
|
97282
97504
|
await writeCachedMarketplaceManifest({
|
|
97283
97505
|
marketplaceName: marketplace.name,
|
|
97284
97506
|
marketplaceRoot,
|
|
97285
97507
|
plugins: installed
|
|
97286
97508
|
});
|
|
97287
|
-
const configPath =
|
|
97509
|
+
const configPath = join56(codexHome, "config.toml");
|
|
97288
97510
|
await updateCodexConfig({
|
|
97289
97511
|
configPath,
|
|
97290
97512
|
repoRoot: codexPackageRoot,
|
|
@@ -97294,7 +97516,7 @@ async function runCodexInstaller(options = {}) {
|
|
|
97294
97516
|
platform,
|
|
97295
97517
|
gitBashEnabled: platform === "win32" && gitBashResolution.found,
|
|
97296
97518
|
trustedHookStates,
|
|
97297
|
-
agentConfigs
|
|
97519
|
+
agentConfigs,
|
|
97298
97520
|
autonomousPermissions: options.autonomousPermissions !== false,
|
|
97299
97521
|
...options.reasoning === undefined ? {} : { reasoning: options.reasoning }
|
|
97300
97522
|
});
|
|
@@ -97321,20 +97543,6 @@ async function runCodexInstaller(options = {}) {
|
|
|
97321
97543
|
projectCleanup
|
|
97322
97544
|
};
|
|
97323
97545
|
}
|
|
97324
|
-
function agentNameFromToml3(fileName) {
|
|
97325
|
-
return fileName.endsWith(".toml") ? fileName.slice(0, -".toml".length) : fileName;
|
|
97326
|
-
}
|
|
97327
|
-
async function agentSourceRootsForInstall(input) {
|
|
97328
|
-
if (input.marketplace.name !== "sisyphuslabs") {
|
|
97329
|
-
return new Map(input.installed.map((plugin) => [plugin.name, plugin.path]));
|
|
97330
|
-
}
|
|
97331
|
-
const snapshotPlugins = await writeInstalledMarketplaceSnapshot({
|
|
97332
|
-
codexHome: input.codexHome,
|
|
97333
|
-
marketplace: input.marketplace,
|
|
97334
|
-
plugins: input.pluginSources
|
|
97335
|
-
});
|
|
97336
|
-
return new Map(snapshotPlugins.map((plugin) => [plugin.name, plugin.path]));
|
|
97337
|
-
}
|
|
97338
97546
|
function legacyCacheMarketplaces(marketplaceName) {
|
|
97339
97547
|
return marketplaceName === "sisyphuslabs" ? SISYPHUS_LEGACY_CACHE_MARKETPLACES : [];
|
|
97340
97548
|
}
|
|
@@ -97343,7 +97551,7 @@ function findRepoRootFromImporter(importerDir) {
|
|
|
97343
97551
|
for (let depth = 0;depth <= 7; depth += 1) {
|
|
97344
97552
|
if (isRepoRootWithCodexPlugin(current))
|
|
97345
97553
|
return current;
|
|
97346
|
-
for (const wrapperPackageRoot of [
|
|
97554
|
+
for (const wrapperPackageRoot of [join56(current, "node_modules", "oh-my-openagent"), join56(current, "oh-my-openagent")]) {
|
|
97347
97555
|
if (isRepoRootWithCodexPlugin(wrapperPackageRoot))
|
|
97348
97556
|
return wrapperPackageRoot;
|
|
97349
97557
|
}
|
|
@@ -97361,7 +97569,7 @@ function findRepoRoot(input) {
|
|
|
97361
97569
|
return findRepoRootFromImporter(input.importerDir);
|
|
97362
97570
|
}
|
|
97363
97571
|
function isRepoRootWithCodexPlugin(repoRoot) {
|
|
97364
|
-
return existsSync27(
|
|
97572
|
+
return existsSync27(join56(repoRoot, "packages", "omo-codex", "plugin", ".codex-plugin", "plugin.json"));
|
|
97365
97573
|
}
|
|
97366
97574
|
function codexMarketplaceSource(marketplaceRoot) {
|
|
97367
97575
|
return { sourceType: "local", source: marketplaceRoot };
|
|
@@ -97496,13 +97704,13 @@ function defaultRunCommand2(command, args) {
|
|
|
97496
97704
|
});
|
|
97497
97705
|
}
|
|
97498
97706
|
// packages/omo-codex/src/install/codex-cleanup.ts
|
|
97499
|
-
import { lstat as lstat15, readFile as
|
|
97707
|
+
import { lstat as lstat15, readFile as readFile27, readdir as readdir13, rm as rm14, rmdir } from "node:fs/promises";
|
|
97500
97708
|
import { homedir as homedir8 } from "node:os";
|
|
97501
|
-
import { isAbsolute as isAbsolute11, join as
|
|
97709
|
+
import { isAbsolute as isAbsolute11, join as join59, relative as relative6, resolve as resolve16 } from "node:path";
|
|
97502
97710
|
|
|
97503
97711
|
// packages/omo-codex/src/install/codex-cleanup-bins.ts
|
|
97504
|
-
import { lstat as lstat13, readFile as
|
|
97505
|
-
import { dirname as dirname19, isAbsolute as isAbsolute9, join as
|
|
97712
|
+
import { lstat as lstat13, readFile as readFile25, readdir as readdir12, readlink as readlink6, rm as rm13 } from "node:fs/promises";
|
|
97713
|
+
import { dirname as dirname19, isAbsolute as isAbsolute9, join as join57, resolve as resolve14 } from "node:path";
|
|
97506
97714
|
var ROOT_RUNTIME_BIN_NAME = "omo";
|
|
97507
97715
|
var MANAGED_CODEX_BIN_NAMES = new Set([
|
|
97508
97716
|
ROOT_RUNTIME_BIN_NAME,
|
|
@@ -97532,9 +97740,9 @@ async function removeManagedCodexBins(binDir, platform) {
|
|
|
97532
97740
|
const binName = managedBinNameForEntry2(entry.name, platform);
|
|
97533
97741
|
if (binName === null || !MANAGED_CODEX_BIN_NAMES.has(binName))
|
|
97534
97742
|
continue;
|
|
97535
|
-
const linkPath =
|
|
97743
|
+
const linkPath = join57(binDir, entry.name);
|
|
97536
97744
|
if (await isManagedCodexBin(linkPath, platform, binName)) {
|
|
97537
|
-
await
|
|
97745
|
+
await rm13(linkPath, { force: true });
|
|
97538
97746
|
removed.push(linkPath);
|
|
97539
97747
|
}
|
|
97540
97748
|
}
|
|
@@ -97563,12 +97771,12 @@ async function isManagedCodexBin(linkPath, platform, binName) {
|
|
|
97563
97771
|
}
|
|
97564
97772
|
if (!entryStat.isFile())
|
|
97565
97773
|
return false;
|
|
97566
|
-
const content = await
|
|
97774
|
+
const content = await readFile25(linkPath, "utf8");
|
|
97567
97775
|
return content.includes(RUNTIME_WRAPPER_MARKER) || content.includes(COMMAND_SHIM_MARKER);
|
|
97568
97776
|
}
|
|
97569
97777
|
|
|
97570
97778
|
// packages/omo-codex/src/install/codex-cleanup-config.ts
|
|
97571
|
-
import { lstat as lstat14, mkdir as mkdir8, readFile as
|
|
97779
|
+
import { lstat as lstat14, mkdir as mkdir8, readFile as readFile26, writeFile as writeFile14 } from "node:fs/promises";
|
|
97572
97780
|
import { dirname as dirname20 } from "node:path";
|
|
97573
97781
|
var MANAGED_MARKETPLACES = ["sisyphuslabs", "lazycodex", "code-yeongyu-codex-plugins"];
|
|
97574
97782
|
var LEGACY_MANAGED_CODEX_AGENT_NAMES_TO_PURGE2 = ["codex-ultrawork-reviewer"];
|
|
@@ -97601,14 +97809,14 @@ function cleanupCodexLightConfigText(config) {
|
|
|
97601
97809
|
async function cleanupCodexConfig(configPath, now) {
|
|
97602
97810
|
if (!await configExists(configPath))
|
|
97603
97811
|
return { changed: false };
|
|
97604
|
-
const original = await
|
|
97812
|
+
const original = await readFile26(configPath, "utf8");
|
|
97605
97813
|
const next = cleanupCodexLightConfigText(original);
|
|
97606
97814
|
if (next === original)
|
|
97607
97815
|
return { changed: false };
|
|
97608
97816
|
const backupPath = `${configPath}.backup-${formatBackupTimestamp2(now?.() ?? new Date)}`;
|
|
97609
97817
|
await mkdir8(dirname20(configPath), { recursive: true });
|
|
97610
|
-
await
|
|
97611
|
-
await
|
|
97818
|
+
await writeFile14(backupPath, original);
|
|
97819
|
+
await writeFile14(configPath, `${next.trimEnd()}
|
|
97612
97820
|
`);
|
|
97613
97821
|
return { changed: true, backupPath };
|
|
97614
97822
|
}
|
|
@@ -97685,7 +97893,7 @@ function nodeErrorCode5(error) {
|
|
|
97685
97893
|
}
|
|
97686
97894
|
|
|
97687
97895
|
// packages/omo-codex/src/install/codex-cleanup-safety.ts
|
|
97688
|
-
import { dirname as dirname21, isAbsolute as isAbsolute10, join as
|
|
97896
|
+
import { dirname as dirname21, isAbsolute as isAbsolute10, join as join58, relative as relative5, resolve as resolve15 } from "node:path";
|
|
97689
97897
|
function codexHomeResolvesToFilesystemRoot(codexHome) {
|
|
97690
97898
|
const resolved = resolve15(codexHome);
|
|
97691
97899
|
return dirname21(resolved) === resolved;
|
|
@@ -97702,11 +97910,11 @@ function validateManagedCleanupTarget(input) {
|
|
|
97702
97910
|
if (target === codexHome)
|
|
97703
97911
|
return skipped(input.path, "outside managed Codex cleanup scope");
|
|
97704
97912
|
const exactManagedRoots = new Set([
|
|
97705
|
-
resolve15(
|
|
97706
|
-
resolve15(
|
|
97707
|
-
resolve15(
|
|
97708
|
-
resolve15(
|
|
97709
|
-
resolve15(
|
|
97913
|
+
resolve15(join58(codexHome, "plugins", "cache", "sisyphuslabs")),
|
|
97914
|
+
resolve15(join58(codexHome, ".tmp", "marketplaces", "sisyphuslabs")),
|
|
97915
|
+
resolve15(join58(codexHome, "runtime", "ast-grep")),
|
|
97916
|
+
resolve15(join58(codexHome, "runtime", "node")),
|
|
97917
|
+
resolve15(join58(codexHome, "plugins", "data", "omo-sisyphuslabs", "bootstrap"))
|
|
97710
97918
|
]);
|
|
97711
97919
|
if (exactManagedRoots.has(target))
|
|
97712
97920
|
return null;
|
|
@@ -97736,8 +97944,8 @@ function skipped(path, reason) {
|
|
|
97736
97944
|
var INSTALLED_AGENTS_MANIFEST = ".installed-agents.json";
|
|
97737
97945
|
async function cleanupCodexLight(input = {}) {
|
|
97738
97946
|
const env = input.env ?? process.env;
|
|
97739
|
-
const codexHome = resolve16(input.codexHome ?? env.CODEX_HOME ??
|
|
97740
|
-
const configPath =
|
|
97947
|
+
const codexHome = resolve16(input.codexHome ?? env.CODEX_HOME ?? join59(homedir8(), ".codex"));
|
|
97948
|
+
const configPath = join59(codexHome, "config.toml");
|
|
97741
97949
|
const installedBinDir = await readInstalledCodexBinDir(codexHome);
|
|
97742
97950
|
const agentPaths = await collectInstalledAgentPaths(codexHome, configPath);
|
|
97743
97951
|
const configCleanup = await cleanupCodexConfig(configPath, input.now);
|
|
@@ -97791,17 +97999,17 @@ function firstConfiguredPath(...values) {
|
|
|
97791
97999
|
}
|
|
97792
98000
|
function managedGlobalStatePaths(codexHome) {
|
|
97793
98001
|
return [
|
|
97794
|
-
|
|
97795
|
-
|
|
97796
|
-
|
|
97797
|
-
|
|
97798
|
-
|
|
98002
|
+
join59(codexHome, "plugins", "cache", "sisyphuslabs"),
|
|
98003
|
+
join59(codexHome, ".tmp", "marketplaces", "sisyphuslabs"),
|
|
98004
|
+
join59(codexHome, "runtime", "ast-grep"),
|
|
98005
|
+
join59(codexHome, "runtime", "node"),
|
|
98006
|
+
join59(codexHome, "plugins", "data", "omo-sisyphuslabs", "bootstrap")
|
|
97799
98007
|
];
|
|
97800
98008
|
}
|
|
97801
98009
|
var BOOTSTRAP_DATA_GLOB_MAX_DEPTH = 5;
|
|
97802
98010
|
async function collectBootstrapDataDirsByGlob(codexHome) {
|
|
97803
98011
|
const results = [];
|
|
97804
|
-
await walkForManagedBootstrapDirs(
|
|
98012
|
+
await walkForManagedBootstrapDirs(join59(codexHome, "plugins"), 0, results);
|
|
97805
98013
|
return results;
|
|
97806
98014
|
}
|
|
97807
98015
|
async function walkForManagedBootstrapDirs(directory, depth, results) {
|
|
@@ -97813,9 +98021,9 @@ async function walkForManagedBootstrapDirs(directory, depth, results) {
|
|
|
97813
98021
|
for (const entry of entries) {
|
|
97814
98022
|
if (!entry.isDirectory())
|
|
97815
98023
|
continue;
|
|
97816
|
-
const childPath =
|
|
98024
|
+
const childPath = join59(directory, entry.name);
|
|
97817
98025
|
if (isManagedBootstrapOwnerName(entry.name)) {
|
|
97818
|
-
const bootstrapDir =
|
|
98026
|
+
const bootstrapDir = join59(childPath, "bootstrap");
|
|
97819
98027
|
if (await exists6(bootstrapDir))
|
|
97820
98028
|
results.push(bootstrapDir);
|
|
97821
98029
|
continue;
|
|
@@ -97841,7 +98049,7 @@ async function attemptRemove(path) {
|
|
|
97841
98049
|
try {
|
|
97842
98050
|
if (await lstat15(path).catch(() => null) === null)
|
|
97843
98051
|
return false;
|
|
97844
|
-
await
|
|
98052
|
+
await rm14(path, { recursive: true, force: true });
|
|
97845
98053
|
return true;
|
|
97846
98054
|
} catch {
|
|
97847
98055
|
return false;
|
|
@@ -97849,7 +98057,7 @@ async function attemptRemove(path) {
|
|
|
97849
98057
|
}
|
|
97850
98058
|
async function pruneEmptyRuntimeDirBestEffort(codexHome) {
|
|
97851
98059
|
try {
|
|
97852
|
-
await rmdir(
|
|
98060
|
+
await rmdir(join59(codexHome, "runtime"));
|
|
97853
98061
|
} catch (error) {
|
|
97854
98062
|
if (isExpectedRuntimePruneFailure(error))
|
|
97855
98063
|
return;
|
|
@@ -97861,14 +98069,14 @@ function isExpectedRuntimePruneFailure(error) {
|
|
|
97861
98069
|
}
|
|
97862
98070
|
async function collectInstalledAgentPaths(codexHome, configPath) {
|
|
97863
98071
|
const manifestPaths = [
|
|
97864
|
-
|
|
98072
|
+
join59(codexHome, ".tmp", "marketplaces", "sisyphuslabs", "plugins", "omo", INSTALLED_AGENTS_MANIFEST)
|
|
97865
98073
|
];
|
|
97866
|
-
const versionRoot =
|
|
98074
|
+
const versionRoot = join59(codexHome, "plugins", "cache", "sisyphuslabs", "omo");
|
|
97867
98075
|
if (await exists6(versionRoot)) {
|
|
97868
98076
|
const entries = await readdir13(versionRoot, { withFileTypes: true });
|
|
97869
98077
|
for (const entry of entries) {
|
|
97870
98078
|
if (entry.isDirectory())
|
|
97871
|
-
manifestPaths.push(
|
|
98079
|
+
manifestPaths.push(join59(versionRoot, entry.name, INSTALLED_AGENTS_MANIFEST));
|
|
97872
98080
|
}
|
|
97873
98081
|
}
|
|
97874
98082
|
const paths = new Set;
|
|
@@ -97885,19 +98093,19 @@ async function collectInstalledAgentPaths(codexHome, configPath) {
|
|
|
97885
98093
|
async function readManagedAgentPathsFromConfig(codexHome, configPath) {
|
|
97886
98094
|
if (!await exists6(configPath))
|
|
97887
98095
|
return [];
|
|
97888
|
-
const config = await
|
|
97889
|
-
return MANAGED_CODEX_AGENT_NAMES2.filter((agentName) => config.includes(`config_file = ${JSON.stringify(`./agents/${agentName}.toml`)}`)).map((agentName) =>
|
|
98096
|
+
const config = await readFile27(configPath, "utf8");
|
|
98097
|
+
return MANAGED_CODEX_AGENT_NAMES2.filter((agentName) => config.includes(`config_file = ${JSON.stringify(`./agents/${agentName}.toml`)}`)).map((agentName) => join59(codexHome, "agents", `${agentName}.toml`));
|
|
97890
98098
|
}
|
|
97891
98099
|
async function readInstalledAgentManifest(manifestPath) {
|
|
97892
98100
|
if (!await exists6(manifestPath))
|
|
97893
98101
|
return [];
|
|
97894
|
-
const parsed = JSON.parse(await
|
|
98102
|
+
const parsed = JSON.parse(await readFile27(manifestPath, "utf8"));
|
|
97895
98103
|
if (!isPlainRecord4(parsed) || !Array.isArray(parsed.agents))
|
|
97896
98104
|
return [];
|
|
97897
98105
|
return parsed.agents.filter((path) => typeof path === "string");
|
|
97898
98106
|
}
|
|
97899
98107
|
async function removeManifestListedAgentLinks(codexHome, paths) {
|
|
97900
|
-
const agentsDir =
|
|
98108
|
+
const agentsDir = join59(codexHome, "agents");
|
|
97901
98109
|
const removed = [];
|
|
97902
98110
|
const skipped = [];
|
|
97903
98111
|
for (const path of paths) {
|
|
@@ -97912,7 +98120,7 @@ async function removeManifestListedAgentLinks(codexHome, paths) {
|
|
|
97912
98120
|
skipped.push(path);
|
|
97913
98121
|
continue;
|
|
97914
98122
|
}
|
|
97915
|
-
await
|
|
98123
|
+
await rm14(path, { force: true });
|
|
97916
98124
|
removed.push(path);
|
|
97917
98125
|
}
|
|
97918
98126
|
return { removed, skipped };
|
|
@@ -97949,14 +98157,14 @@ function nodeErrorCode6(error) {
|
|
|
97949
98157
|
import { execFile as execFile3 } from "node:child_process";
|
|
97950
98158
|
import { existsSync as existsSync31 } from "node:fs";
|
|
97951
98159
|
import { homedir as homedir11 } from "node:os";
|
|
97952
|
-
import { dirname as dirname25, join as
|
|
98160
|
+
import { dirname as dirname25, join as join64, resolve as resolve20 } from "node:path";
|
|
97953
98161
|
import { fileURLToPath } from "node:url";
|
|
97954
98162
|
import { promisify as promisify2 } from "node:util";
|
|
97955
98163
|
|
|
97956
98164
|
// packages/omo-senpi/src/components/agent-home/resolve-agent-home.ts
|
|
97957
98165
|
import { existsSync as existsSync29 } from "node:fs";
|
|
97958
98166
|
import { homedir as homedir9 } from "node:os";
|
|
97959
|
-
import { join as
|
|
98167
|
+
import { join as join60, resolve as resolve17 } from "node:path";
|
|
97960
98168
|
var AGENT_DIR_ENV_NAMES = [
|
|
97961
98169
|
"OMO_CODING_AGENT_DIR",
|
|
97962
98170
|
"SENPI_CODING_AGENT_DIR",
|
|
@@ -97970,25 +98178,25 @@ function resolveAgentHome(options) {
|
|
|
97970
98178
|
if (configured)
|
|
97971
98179
|
return resolve17(configured);
|
|
97972
98180
|
}
|
|
97973
|
-
const brandedHome =
|
|
97974
|
-
const canonical =
|
|
97975
|
-
if (exists(
|
|
98181
|
+
const brandedHome = join60(homeDir, ".omo");
|
|
98182
|
+
const canonical = join60(brandedHome, "agent");
|
|
98183
|
+
if (exists(join60(canonical, AGENT_HOME_SENTINEL)))
|
|
97976
98184
|
return canonical;
|
|
97977
|
-
if (exists(
|
|
98185
|
+
if (exists(join60(brandedHome, AGENT_HOME_SENTINEL)))
|
|
97978
98186
|
return brandedHome;
|
|
97979
|
-
return
|
|
98187
|
+
return join60(homeDir, ".senpi", "agent");
|
|
97980
98188
|
}
|
|
97981
98189
|
|
|
97982
98190
|
// packages/omo-senpi/src/install/local-launcher.ts
|
|
97983
98191
|
import { chmodSync as chmodSync3, existsSync as existsSync30, mkdirSync as mkdirSync12, readFileSync as readFileSync14, rmSync as rmSync4, writeFileSync as writeFileSync7 } from "node:fs";
|
|
97984
98192
|
import { homedir as homedir10 } from "node:os";
|
|
97985
|
-
import { dirname as dirname22, join as
|
|
98193
|
+
import { dirname as dirname22, join as join61, resolve as resolve18 } from "node:path";
|
|
97986
98194
|
var MARKER = "omo-local-launcher";
|
|
97987
98195
|
function localLauncherPath(homeDir = homedir10()) {
|
|
97988
|
-
return
|
|
98196
|
+
return join61(homeDir, ".local", "bin", "omo");
|
|
97989
98197
|
}
|
|
97990
98198
|
function localLauncherCmdPath(homeDir = homedir10()) {
|
|
97991
|
-
return
|
|
98199
|
+
return join61(homeDir, ".local", "bin", "omo.cmd");
|
|
97992
98200
|
}
|
|
97993
98201
|
function releaseChannel(version) {
|
|
97994
98202
|
return version !== undefined && version.includes("-") ? "beta" : "latest";
|
|
@@ -98006,7 +98214,7 @@ function renderLocalLauncher(options) {
|
|
|
98006
98214
|
userAgent: "omo",
|
|
98007
98215
|
originator: "omo",
|
|
98008
98216
|
changelog: {
|
|
98009
|
-
path:
|
|
98217
|
+
path: join61(options.pluginPath, "CHANGELOG.md").replaceAll("\\", "/")
|
|
98010
98218
|
},
|
|
98011
98219
|
update: {
|
|
98012
98220
|
packageName: "omo-ai",
|
|
@@ -98078,8 +98286,8 @@ node "%~dp0omo" %*\r
|
|
|
98078
98286
|
// packages/omo-senpi/src/install/plugin-artifacts.ts
|
|
98079
98287
|
import { createHash as createHash6 } from "node:crypto";
|
|
98080
98288
|
import { constants as constants9 } from "node:fs";
|
|
98081
|
-
import { access as access2, readFile as
|
|
98082
|
-
import { dirname as dirname24, join as
|
|
98289
|
+
import { access as access2, readFile as readFile29, stat as stat6 } from "node:fs/promises";
|
|
98290
|
+
import { dirname as dirname24, join as join63 } from "node:path";
|
|
98083
98291
|
|
|
98084
98292
|
// packages/memory-core/src/personas/manifest.ts
|
|
98085
98293
|
var PERSONA_ASSET_FILENAMES = {
|
|
@@ -98097,18 +98305,18 @@ var PERSONA_ASSET_FILES = [
|
|
|
98097
98305
|
|
|
98098
98306
|
// packages/omo-senpi/src/install/senpi-settings.ts
|
|
98099
98307
|
import { constants as constants8 } from "node:fs";
|
|
98100
|
-
import { access, copyFile as copyFile3, mkdir as mkdir9, readFile as
|
|
98101
|
-
import { basename as basename10, dirname as dirname23, join as
|
|
98308
|
+
import { access, copyFile as copyFile3, mkdir as mkdir9, readFile as readFile28, rename as rename5, writeFile as writeFile15 } from "node:fs/promises";
|
|
98309
|
+
import { basename as basename10, dirname as dirname23, join as join62, resolve as resolve19 } from "node:path";
|
|
98102
98310
|
var OMO_SENPI_PACKAGE_NAME = "@code-yeongyu/omo-senpi";
|
|
98103
98311
|
var GENERATED_PLUGIN_BASENAME = /^omo-senpi-cli-plugin-[A-Za-z0-9]{6}$/;
|
|
98104
98312
|
var LEGACY_BUILTIN_SHADOW_PACKAGES = [
|
|
98105
|
-
|
|
98106
|
-
|
|
98313
|
+
join62("packages", "pi-goal"),
|
|
98314
|
+
join62("packages", "pi-webfetch")
|
|
98107
98315
|
];
|
|
98108
98316
|
async function readSettings(settingsPath) {
|
|
98109
98317
|
let raw;
|
|
98110
98318
|
try {
|
|
98111
|
-
raw = await
|
|
98319
|
+
raw = await readFile28(settingsPath, "utf8");
|
|
98112
98320
|
} catch (error) {
|
|
98113
98321
|
if (isErrno(error, "ENOENT"))
|
|
98114
98322
|
return {};
|
|
@@ -98155,11 +98363,11 @@ async function writeSettingsAtomically(settingsPath, settings) {
|
|
|
98155
98363
|
if (await fileExists(settingsPath)) {
|
|
98156
98364
|
await copyFile3(settingsPath, backupPath);
|
|
98157
98365
|
} else {
|
|
98158
|
-
await
|
|
98366
|
+
await writeFile15(backupPath, `{}
|
|
98159
98367
|
`, "utf8");
|
|
98160
98368
|
}
|
|
98161
98369
|
const tempPath = `${settingsPath}.${process.pid}.${Date.now()}.tmp`;
|
|
98162
|
-
await
|
|
98370
|
+
await writeFile15(tempPath, `${JSON.stringify(settings, null, 2)}
|
|
98163
98371
|
`, "utf8");
|
|
98164
98372
|
await rename5(tempPath, settingsPath);
|
|
98165
98373
|
return backupPath;
|
|
@@ -98182,7 +98390,7 @@ function isRecord15(value) {
|
|
|
98182
98390
|
async function readPackageName(packagePath) {
|
|
98183
98391
|
let raw;
|
|
98184
98392
|
try {
|
|
98185
|
-
raw = await
|
|
98393
|
+
raw = await readFile28(join62(packagePath, "package.json"), "utf8");
|
|
98186
98394
|
} catch (error) {
|
|
98187
98395
|
if (isErrno(error, "ENOENT") || isErrno(error, "ENOTDIR"))
|
|
98188
98396
|
return;
|
|
@@ -98214,54 +98422,54 @@ function isErrno(error, code) {
|
|
|
98214
98422
|
|
|
98215
98423
|
// packages/omo-senpi/src/install/plugin-artifacts.ts
|
|
98216
98424
|
var REQUIRED_PLUGIN_ARTIFACTS = [
|
|
98217
|
-
|
|
98218
|
-
|
|
98219
|
-
|
|
98220
|
-
|
|
98221
|
-
|
|
98222
|
-
|
|
98223
|
-
...PERSONA_ASSET_FILES.map((filename) =>
|
|
98224
|
-
|
|
98225
|
-
|
|
98226
|
-
|
|
98227
|
-
|
|
98228
|
-
|
|
98229
|
-
|
|
98230
|
-
|
|
98231
|
-
|
|
98232
|
-
|
|
98233
|
-
|
|
98234
|
-
|
|
98235
|
-
|
|
98236
|
-
|
|
98237
|
-
|
|
98238
|
-
|
|
98239
|
-
|
|
98240
|
-
|
|
98241
|
-
|
|
98242
|
-
|
|
98243
|
-
|
|
98244
|
-
|
|
98245
|
-
|
|
98246
|
-
|
|
98247
|
-
|
|
98248
|
-
|
|
98249
|
-
|
|
98250
|
-
|
|
98251
|
-
|
|
98252
|
-
|
|
98253
|
-
|
|
98425
|
+
join63("extensions", "omo.js"),
|
|
98426
|
+
join63("extensions", "omo-task.js"),
|
|
98427
|
+
join63("extensions", "omo-computer-use.js"),
|
|
98428
|
+
join63("extensions", "assets.generated.json"),
|
|
98429
|
+
join63("extensions", "omo-member.js"),
|
|
98430
|
+
join63("extensions", "memory-run-supervisor.mjs"),
|
|
98431
|
+
...PERSONA_ASSET_FILES.map((filename) => join63("extensions", filename)),
|
|
98432
|
+
join63("skills", "ast-grep", "SKILL.md"),
|
|
98433
|
+
join63("skills", "browser", "SKILL.md"),
|
|
98434
|
+
join63("skills", "coding-agent-sessions", "SKILL.md"),
|
|
98435
|
+
join63("skills", "debugging", "SKILL.md"),
|
|
98436
|
+
join63("skills", "frontend", "SKILL.md"),
|
|
98437
|
+
join63("skills", "git-master", "SKILL.md"),
|
|
98438
|
+
join63("skills", "init-deep", "SKILL.md"),
|
|
98439
|
+
join63("skills", "lsp-setup", "SKILL.md"),
|
|
98440
|
+
join63("skills", "programming", "SKILL.md"),
|
|
98441
|
+
join63("skills", "refactor", "SKILL.md"),
|
|
98442
|
+
join63("skills", "remove-ai-slops", "SKILL.md"),
|
|
98443
|
+
join63("skills", "review-work", "SKILL.md"),
|
|
98444
|
+
join63("skills", "ultimate-browsing", "SKILL.md"),
|
|
98445
|
+
join63("skills", "ultrawork", "SKILL.md"),
|
|
98446
|
+
join63("skills", "ulw-execute", "SKILL.md"),
|
|
98447
|
+
join63("skills", "ulw-loop", "SKILL.md"),
|
|
98448
|
+
join63("skills", "ulw-plan", "SKILL.md"),
|
|
98449
|
+
join63("skills", "ulw-research", "SKILL.md"),
|
|
98450
|
+
join63("skills", "visual-qa", "SKILL.md"),
|
|
98451
|
+
join63("skills-conditional", "x-search", "SKILL.md"),
|
|
98452
|
+
join63("runtime", "agent-toolkit-sdk", "sdk.js"),
|
|
98453
|
+
join63("runtime", "ast-grep-mcp", "cli.js"),
|
|
98454
|
+
join63("runtime", "lsp-daemon", "dist", "cli.js"),
|
|
98455
|
+
join63("runtime", "lsp-daemon", "dist", "index.js"),
|
|
98456
|
+
join63("runtime", "lsp-daemon", "dist", "index.d.ts"),
|
|
98457
|
+
join63("runtime", "lsp-daemon", "dist", "daemon-client.js"),
|
|
98458
|
+
join63("runtime", "lsp-daemon", "dist", "daemon-client.d.ts"),
|
|
98459
|
+
join63("runtime", "lsp-daemon", "dist", "package.json"),
|
|
98460
|
+
join63("runtime", "lsp-daemon", "dist", ".omo-runtime-manifest.json"),
|
|
98461
|
+
join63("scripts", "install.mjs"),
|
|
98254
98462
|
"daemon-launch-spec.json"
|
|
98255
98463
|
];
|
|
98256
98464
|
async function ensurePluginArtifacts(context) {
|
|
98257
98465
|
if (context.allowBuild) {
|
|
98258
|
-
await context.runCommand("node", [
|
|
98259
|
-
await context.runCommand("node", [
|
|
98260
|
-
await context.runCommand("node", [
|
|
98261
|
-
await context.runCommand("node", [
|
|
98262
|
-
await context.runCommand("node", [
|
|
98263
|
-
await context.runCommand("node", [
|
|
98264
|
-
await context.runCommand("node", [
|
|
98466
|
+
await context.runCommand("node", [join63(context.pluginPath, "scripts", "build-extension.mjs")], { cwd: context.repoRoot });
|
|
98467
|
+
await context.runCommand("node", [join63("packages", "omo-codex", "plugin", "scripts", "materialize-shared-upstreams.mjs")], { cwd: context.repoRoot });
|
|
98468
|
+
await context.runCommand("node", [join63(context.pluginPath, "scripts", "sync-skills.mjs")], { cwd: context.repoRoot });
|
|
98469
|
+
await context.runCommand("node", [join63(context.pluginPath, "scripts", "build-install.mjs")], { cwd: context.repoRoot });
|
|
98470
|
+
await context.runCommand("node", [join63(context.pluginPath, "scripts", "stage-lsp-daemon-runtime.mjs")], { cwd: context.repoRoot });
|
|
98471
|
+
await context.runCommand("node", [join63(context.pluginPath, "scripts", "stage-ast-grep-mcp-runtime.mjs")], { cwd: context.repoRoot });
|
|
98472
|
+
await context.runCommand("node", [join63(context.pluginPath, "scripts", "stage-x-search-skill.mjs")], { cwd: context.repoRoot });
|
|
98265
98473
|
}
|
|
98266
98474
|
if (await hasMissingPluginArtifact(context.pluginPath)) {
|
|
98267
98475
|
throw new Error(`Packed omo-senpi plugin is missing required runtime artifacts at ${context.pluginPath}`);
|
|
@@ -98270,14 +98478,14 @@ async function ensurePluginArtifacts(context) {
|
|
|
98270
98478
|
}
|
|
98271
98479
|
async function hasMissingPluginArtifact(pluginPath) {
|
|
98272
98480
|
for (const artifact of REQUIRED_PLUGIN_ARTIFACTS) {
|
|
98273
|
-
if (!await fileExists2(
|
|
98481
|
+
if (!await fileExists2(join63(pluginPath, artifact)))
|
|
98274
98482
|
return true;
|
|
98275
98483
|
}
|
|
98276
98484
|
return false;
|
|
98277
98485
|
}
|
|
98278
98486
|
async function verifyAstGrepRuntimeIntegrity(pluginPath, platform) {
|
|
98279
|
-
const runtimeEntry =
|
|
98280
|
-
const manifestPath =
|
|
98487
|
+
const runtimeEntry = join63(pluginPath, "runtime", "ast-grep-mcp", "cli.js");
|
|
98488
|
+
const manifestPath = join63(dirname24(runtimeEntry), "manifest.json");
|
|
98281
98489
|
let runtimeStat;
|
|
98282
98490
|
try {
|
|
98283
98491
|
runtimeStat = await stat6(runtimeEntry);
|
|
@@ -98292,7 +98500,7 @@ async function verifyAstGrepRuntimeIntegrity(pluginPath, platform) {
|
|
|
98292
98500
|
}
|
|
98293
98501
|
let manifest;
|
|
98294
98502
|
try {
|
|
98295
|
-
manifest = JSON.parse(await
|
|
98503
|
+
manifest = JSON.parse(await readFile29(manifestPath, "utf8"));
|
|
98296
98504
|
} catch (error) {
|
|
98297
98505
|
throw astGrepIntegrityError(runtimeEntry, `manifest is unreadable or invalid JSON: ${messageOf(error)}`);
|
|
98298
98506
|
}
|
|
@@ -98301,7 +98509,7 @@ async function verifyAstGrepRuntimeIntegrity(pluginPath, platform) {
|
|
|
98301
98509
|
}
|
|
98302
98510
|
let actualSha256;
|
|
98303
98511
|
try {
|
|
98304
|
-
actualSha256 = createHash6("sha256").update(await
|
|
98512
|
+
actualSha256 = createHash6("sha256").update(await readFile29(runtimeEntry)).digest("hex");
|
|
98305
98513
|
} catch (error) {
|
|
98306
98514
|
throw astGrepIntegrityError(runtimeEntry, `runtime hash could not be computed: ${messageOf(error)}`);
|
|
98307
98515
|
}
|
|
@@ -98352,7 +98560,7 @@ async function runSenpiInstaller(options = {}) {
|
|
|
98352
98560
|
const backupPath = await writeSettingsAtomically(context.settingsPath, settings);
|
|
98353
98561
|
const launcherPath = installLocalLauncher({
|
|
98354
98562
|
pluginPath: context.pluginPath,
|
|
98355
|
-
senpiCliPath:
|
|
98563
|
+
senpiCliPath: join64(context.repoRoot, "packages", "coding-agent", "dist", "cli.js"),
|
|
98356
98564
|
homeDir: context.homeDir
|
|
98357
98565
|
});
|
|
98358
98566
|
return {
|
|
@@ -98372,13 +98580,13 @@ function resolveInstallContext(options) {
|
|
|
98372
98580
|
const repoRoot = resolve20(options.repoRoot ?? (allowBuild ? findRepoRoot2(dirname25(fileURLToPath(import.meta.url))) : dirname25(resolve20(options.pluginPath))));
|
|
98373
98581
|
const homeDir = options.homeDir ?? env.HOME ?? homedir11();
|
|
98374
98582
|
const agentDir = resolve20(options.agentDir ?? resolveAgentHome({ env, homeDir }));
|
|
98375
|
-
const pluginPath = resolve20(options.pluginPath ??
|
|
98583
|
+
const pluginPath = resolve20(options.pluginPath ?? join64(repoRoot, "packages", "omo-senpi", "plugin"));
|
|
98376
98584
|
return {
|
|
98377
98585
|
env,
|
|
98378
98586
|
repoRoot,
|
|
98379
98587
|
agentDir,
|
|
98380
98588
|
homeDir,
|
|
98381
|
-
settingsPath:
|
|
98589
|
+
settingsPath: join64(agentDir, "settings.json"),
|
|
98382
98590
|
pluginPath,
|
|
98383
98591
|
platform: options.platform ?? process.platform,
|
|
98384
98592
|
allowBuild,
|
|
@@ -98395,7 +98603,7 @@ async function defaultRunCommand3(command, args, options) {
|
|
|
98395
98603
|
function findRepoRoot2(importerDir) {
|
|
98396
98604
|
let current = importerDir;
|
|
98397
98605
|
for (let depth = 0;depth <= 7; depth += 1) {
|
|
98398
|
-
if (fileExistsSync(
|
|
98606
|
+
if (fileExistsSync(join64(current, "packages", "omo-senpi", "plugin", "package.json")))
|
|
98399
98607
|
return current;
|
|
98400
98608
|
current = resolve20(current, "..");
|
|
98401
98609
|
}
|
|
@@ -98410,7 +98618,7 @@ async function runNativeDevInstaller(options) {
|
|
|
98410
98618
|
}
|
|
98411
98619
|
// packages/omo-opencode/src/cli/install-native/legacy-omo-bin.ts
|
|
98412
98620
|
import { lstatSync as lstatSync4, readFileSync as readFileSync15, realpathSync as realpathSync8, statSync as statSync4 } from "node:fs";
|
|
98413
|
-
import { dirname as dirname26, isAbsolute as isAbsolute12, join as
|
|
98621
|
+
import { dirname as dirname26, isAbsolute as isAbsolute12, join as join65, posix as posix9, win32 as win325 } from "node:path";
|
|
98414
98622
|
var NATIVE_OMO_PACKAGE = "omo-ai";
|
|
98415
98623
|
var LEGACY_OMO_BIN_PACKAGES = ["oh-my-openagent", "oh-my-opencode", "lazycodex"];
|
|
98416
98624
|
var CODEX_LIGHT_WRAPPER_MARKER = "OMO_GENERATED_RUNTIME_WRAPPER";
|
|
@@ -98475,7 +98683,7 @@ function classify(owner) {
|
|
|
98475
98683
|
}
|
|
98476
98684
|
function omoShimPathsIn(directory, isWindows) {
|
|
98477
98685
|
const suffixes = isWindows ? WINDOWS_BIN_SUFFIXES : [""];
|
|
98478
|
-
return suffixes.map((suffix) =>
|
|
98686
|
+
return suffixes.map((suffix) => join65(directory, `${OMO_BIN_NAME}${suffix}`)).filter(pathExists);
|
|
98479
98687
|
}
|
|
98480
98688
|
function pathExists(path) {
|
|
98481
98689
|
try {
|
|
@@ -98510,7 +98718,7 @@ function shimEntryPaths(shim, shimDirectory) {
|
|
|
98510
98718
|
const quoted = match[0];
|
|
98511
98719
|
const relativeToShim = quoted.match(/^(?:%~?dp0%?|\$\{?basedir\}?)[\\/]?(.*)$/)?.[1];
|
|
98512
98720
|
if (relativeToShim !== undefined)
|
|
98513
|
-
paths.push(
|
|
98721
|
+
paths.push(join65(shimDirectory, relativeToShim.replace(/\\/g, "/")));
|
|
98514
98722
|
else if (isAbsolute12(quoted))
|
|
98515
98723
|
paths.push(quoted);
|
|
98516
98724
|
}
|
|
@@ -98531,7 +98739,7 @@ function bunxEntryPaths(binPath) {
|
|
|
98531
98739
|
const end = contents.indexOf('"\x00');
|
|
98532
98740
|
if (end <= 0)
|
|
98533
98741
|
return [];
|
|
98534
|
-
return [
|
|
98742
|
+
return [join65(dirname26(dirname26(binPath)), contents.slice(0, end).replace(/\\/g, "/"))];
|
|
98535
98743
|
}
|
|
98536
98744
|
function codexLightWrapperOwner(shim) {
|
|
98537
98745
|
if (!shim.includes(CODEX_LIGHT_WRAPPER_MARKER))
|
|
@@ -98545,7 +98753,7 @@ function isInsideNodeModules(path) {
|
|
|
98545
98753
|
function ownerOfFile(file) {
|
|
98546
98754
|
let directory = dirname26(file);
|
|
98547
98755
|
for (let depth = 0;depth < OWNER_WALK_UP_LIMIT; depth += 1) {
|
|
98548
|
-
const manifest = readWholeFile(
|
|
98756
|
+
const manifest = readWholeFile(join65(directory, "package.json"));
|
|
98549
98757
|
if (manifest !== null) {
|
|
98550
98758
|
const parsed = parseManifest(manifest);
|
|
98551
98759
|
if (parsed !== null)
|
|
@@ -98843,12 +99051,12 @@ init_provider_availability();
|
|
|
98843
99051
|
|
|
98844
99052
|
// packages/omo-opencode/src/cli/config-manager/add-tui-plugin-to-tui-config.ts
|
|
98845
99053
|
import { existsSync as existsSync33, mkdirSync as mkdirSync13, readFileSync as readFileSync17 } from "node:fs";
|
|
98846
|
-
import { join as
|
|
99054
|
+
import { join as join67 } from "node:path";
|
|
98847
99055
|
|
|
98848
99056
|
// packages/omo-opencode/src/cli/doctor/checks/tui-plugin-config.ts
|
|
98849
99057
|
init_shared();
|
|
98850
99058
|
import { existsSync as existsSync32, readFileSync as readFileSync16 } from "node:fs";
|
|
98851
|
-
import { join as
|
|
99059
|
+
import { join as join66 } from "node:path";
|
|
98852
99060
|
var TUI_SUBPATH = "tui";
|
|
98853
99061
|
var TUI_EXPORT_SUBPATH = `./${TUI_SUBPATH}`;
|
|
98854
99062
|
function tuiPluginSpecName(entry) {
|
|
@@ -98868,7 +99076,7 @@ function fileEntryPackageJsonPath(entry) {
|
|
|
98868
99076
|
let path = entry.slice("file:".length);
|
|
98869
99077
|
if (path.startsWith("//"))
|
|
98870
99078
|
path = path.slice(2);
|
|
98871
|
-
return
|
|
99079
|
+
return join66(path, "package.json");
|
|
98872
99080
|
}
|
|
98873
99081
|
function packageJsonExportsTui(pkgJsonPath) {
|
|
98874
99082
|
if (!existsSync32(pkgJsonPath))
|
|
@@ -98907,7 +99115,7 @@ function packageExportsTuiForServerEntry(entry) {
|
|
|
98907
99115
|
const packageName = packageNameFromServerEntry(entry);
|
|
98908
99116
|
if (packageName === null)
|
|
98909
99117
|
return null;
|
|
98910
|
-
return packageJsonExportsTui(
|
|
99118
|
+
return packageJsonExportsTui(join66(getOpenCodeConfigDir({ binary: "opencode" }), "node_modules", packageName, "package.json"));
|
|
98911
99119
|
}
|
|
98912
99120
|
function isOurFilePluginEntry(entry) {
|
|
98913
99121
|
if (typeof entry !== "string" || !entry.startsWith("file:"))
|
|
@@ -98994,7 +99202,7 @@ function detectServerPluginRegistration() {
|
|
|
98994
99202
|
}
|
|
98995
99203
|
}
|
|
98996
99204
|
function detectTuiPluginRegistration() {
|
|
98997
|
-
const tuiJsonPath =
|
|
99205
|
+
const tuiJsonPath = join66(getOpenCodeConfigDir({ binary: "opencode" }), "tui.json");
|
|
98998
99206
|
if (!existsSync32(tuiJsonPath)) {
|
|
98999
99207
|
return {
|
|
99000
99208
|
registered: false,
|
|
@@ -99170,10 +99378,10 @@ function readConfig(path) {
|
|
|
99170
99378
|
return null;
|
|
99171
99379
|
}
|
|
99172
99380
|
function readServerConfig(configDir) {
|
|
99173
|
-
const jsoncPath =
|
|
99381
|
+
const jsoncPath = join67(configDir, "opencode.jsonc");
|
|
99174
99382
|
if (existsSync33(jsoncPath))
|
|
99175
99383
|
return readConfig(jsoncPath);
|
|
99176
|
-
const jsonPath =
|
|
99384
|
+
const jsonPath = join67(configDir, "opencode.json");
|
|
99177
99385
|
if (existsSync33(jsonPath))
|
|
99178
99386
|
return readConfig(jsonPath);
|
|
99179
99387
|
return null;
|
|
@@ -99230,7 +99438,7 @@ function ensureTuiPluginEntry(opts = {}) {
|
|
|
99230
99438
|
if (!desiredEntry) {
|
|
99231
99439
|
return { changed: false, reason: "no-server-entry" };
|
|
99232
99440
|
}
|
|
99233
|
-
const tuiJsonPath =
|
|
99441
|
+
const tuiJsonPath = join67(configDir, "tui.json");
|
|
99234
99442
|
const { config, malformed } = readTuiConfig(tuiJsonPath);
|
|
99235
99443
|
if (malformed || pluginFieldInvalid(config)) {
|
|
99236
99444
|
return { changed: false, reason: "malformed" };
|
|
@@ -99251,10 +99459,10 @@ function ensureTuiPluginEntry(opts = {}) {
|
|
|
99251
99459
|
init_shared();
|
|
99252
99460
|
init_config_context();
|
|
99253
99461
|
import { existsSync as existsSync34, readFileSync as readFileSync18 } from "node:fs";
|
|
99254
|
-
import { join as
|
|
99462
|
+
import { join as join68 } from "node:path";
|
|
99255
99463
|
function readPluginEntries(configDir) {
|
|
99256
99464
|
for (const name of ["opencode.jsonc", "opencode.json"]) {
|
|
99257
|
-
const configPath =
|
|
99465
|
+
const configPath = join68(configDir, name);
|
|
99258
99466
|
if (!existsSync34(configPath))
|
|
99259
99467
|
continue;
|
|
99260
99468
|
try {
|
|
@@ -99302,7 +99510,7 @@ function refreshOpenCodePluginSandboxes(options = {}) {
|
|
|
99302
99510
|
|
|
99303
99511
|
// packages/omo-opencode/src/cli/install-ast-grep-sg.ts
|
|
99304
99512
|
import { homedir as homedir13 } from "node:os";
|
|
99305
|
-
import { join as
|
|
99513
|
+
import { join as join69 } from "node:path";
|
|
99306
99514
|
|
|
99307
99515
|
// packages/shared-skills/index.mjs
|
|
99308
99516
|
import { existsSync as existsSync35 } from "node:fs";
|
|
@@ -99324,9 +99532,9 @@ function describeResult2(result) {
|
|
|
99324
99532
|
}
|
|
99325
99533
|
async function installAstGrepForOpenCode(options = {}) {
|
|
99326
99534
|
const platform = options.platform ?? process.platform;
|
|
99327
|
-
const baseDir =
|
|
99535
|
+
const baseDir = join69(options.homeDir ?? homedir13(), ".omo");
|
|
99328
99536
|
const targetDir = astGrepRuntimeDir(baseDir, platform, options.arch ?? process.arch);
|
|
99329
|
-
const skillDir =
|
|
99537
|
+
const skillDir = join69(options.sharedSkillsRoot ?? sharedSkillsRootPath(), "ast-grep");
|
|
99330
99538
|
const installer = options.installer ?? runAstGrepSkillInstall;
|
|
99331
99539
|
try {
|
|
99332
99540
|
const result = await installer({ platform, skillDir, targetDir });
|
|
@@ -103689,9 +103897,9 @@ function readCurrentTopLevelTask(planPath) {
|
|
|
103689
103897
|
}
|
|
103690
103898
|
// packages/boulder-state/src/storage/path.ts
|
|
103691
103899
|
import { existsSync as existsSync37 } from "node:fs";
|
|
103692
|
-
import { isAbsolute as isAbsolute13, join as
|
|
103900
|
+
import { isAbsolute as isAbsolute13, join as join70, relative as relative8, resolve as resolve21 } from "node:path";
|
|
103693
103901
|
function getBoulderFilePath(directory) {
|
|
103694
|
-
return
|
|
103902
|
+
return join70(directory, BOULDER_DIR, BOULDER_FILE);
|
|
103695
103903
|
}
|
|
103696
103904
|
function resolveTrackedPath(baseDirectory, trackedPath) {
|
|
103697
103905
|
return isAbsolute13(trackedPath) ? resolve21(trackedPath) : resolve21(baseDirectory, trackedPath);
|
|
@@ -103876,9 +104084,9 @@ init_state();
|
|
|
103876
104084
|
var CONTINUATION_MARKER_DIR = ".omo/run-continuation";
|
|
103877
104085
|
// packages/omo-opencode/src/features/run-continuation-state/storage.ts
|
|
103878
104086
|
import { existsSync as existsSync40, mkdirSync as mkdirSync14, readFileSync as readFileSync22, rmSync as rmSync6, writeFileSync as writeFileSync8 } from "node:fs";
|
|
103879
|
-
import { join as
|
|
104087
|
+
import { join as join71 } from "node:path";
|
|
103880
104088
|
function getMarkerPath(directory, sessionID) {
|
|
103881
|
-
return
|
|
104089
|
+
return join71(directory, CONTINUATION_MARKER_DIR, `${sessionID}.json`);
|
|
103882
104090
|
}
|
|
103883
104091
|
function readContinuationMarker(directory, sessionID) {
|
|
103884
104092
|
const markerPath = getMarkerPath(directory, sessionID);
|
|
@@ -103951,7 +104159,7 @@ async function isSessionInBoulderLineage(input) {
|
|
|
103951
104159
|
init_shared();
|
|
103952
104160
|
init_compaction_marker();
|
|
103953
104161
|
import { readFileSync as readFileSync23, readdirSync as readdirSync10 } from "node:fs";
|
|
103954
|
-
import { join as
|
|
104162
|
+
import { join as join72 } from "node:path";
|
|
103955
104163
|
var defaultSessionLastAgentDeps = {
|
|
103956
104164
|
getMessageDir,
|
|
103957
104165
|
isSqliteBackend,
|
|
@@ -104011,7 +104219,7 @@ async function getLastAgentFromSession(sessionID, client, deps = {}) {
|
|
|
104011
104219
|
try {
|
|
104012
104220
|
const messages = readdirSync10(messageDir).filter((fileName) => fileName.endsWith(".json")).map((fileName) => {
|
|
104013
104221
|
try {
|
|
104014
|
-
const content = readFileSync23(
|
|
104222
|
+
const content = readFileSync23(join72(messageDir, fileName), "utf-8");
|
|
104015
104223
|
const parsed = JSON.parse(content);
|
|
104016
104224
|
return {
|
|
104017
104225
|
fileName,
|
|
@@ -104055,7 +104263,7 @@ init_agent_display_names();
|
|
|
104055
104263
|
// packages/omo-opencode/src/hooks/ralph-loop/storage.ts
|
|
104056
104264
|
init_frontmatter2();
|
|
104057
104265
|
import { existsSync as existsSync41, readFileSync as readFileSync24, writeFileSync as writeFileSync9, unlinkSync as unlinkSync6, mkdirSync as mkdirSync15 } from "node:fs";
|
|
104058
|
-
import { dirname as dirname28, join as
|
|
104266
|
+
import { dirname as dirname28, join as join73 } from "node:path";
|
|
104059
104267
|
|
|
104060
104268
|
// packages/omo-opencode/src/hooks/ralph-loop/constants.ts
|
|
104061
104269
|
var DEFAULT_STATE_FILE = ".omo/ralph-loop.local.md";
|
|
@@ -104064,7 +104272,7 @@ var DEFAULT_COMPLETION_PROMISE = "DONE";
|
|
|
104064
104272
|
|
|
104065
104273
|
// packages/omo-opencode/src/hooks/ralph-loop/storage.ts
|
|
104066
104274
|
function getStateFilePath(directory, customPath) {
|
|
104067
|
-
return customPath ?
|
|
104275
|
+
return customPath ? join73(directory, customPath) : join73(directory, DEFAULT_STATE_FILE);
|
|
104068
104276
|
}
|
|
104069
104277
|
function readState(directory, customPath) {
|
|
104070
104278
|
const filePath = getStateFilePath(directory, customPath);
|
|
@@ -105171,7 +105379,7 @@ init_extract_semver();
|
|
|
105171
105379
|
init_bun_which_shim();
|
|
105172
105380
|
import { existsSync as existsSync49, accessSync as accessSync4, constants as constants12 } from "node:fs";
|
|
105173
105381
|
import { homedir as homedir16 } from "node:os";
|
|
105174
|
-
import { join as
|
|
105382
|
+
import { join as join80 } from "node:path";
|
|
105175
105383
|
|
|
105176
105384
|
// packages/omo-opencode/src/cli/doctor/framework/spawn-with-timeout.ts
|
|
105177
105385
|
init_spawn_with_windows_hide();
|
|
@@ -105263,17 +105471,17 @@ function getDesktopAppPaths(platform) {
|
|
|
105263
105471
|
case "darwin":
|
|
105264
105472
|
return [
|
|
105265
105473
|
"/Applications/OpenCode.app/Contents/MacOS/OpenCode",
|
|
105266
|
-
|
|
105474
|
+
join80(home, "Applications", "OpenCode.app", "Contents", "MacOS", "OpenCode")
|
|
105267
105475
|
];
|
|
105268
105476
|
case "win32": {
|
|
105269
105477
|
const programFiles = process.env.ProgramFiles;
|
|
105270
105478
|
const localAppData = process.env.LOCALAPPDATA;
|
|
105271
105479
|
const paths = [];
|
|
105272
105480
|
if (programFiles) {
|
|
105273
|
-
paths.push(
|
|
105481
|
+
paths.push(join80(programFiles, "OpenCode", "OpenCode.exe"));
|
|
105274
105482
|
}
|
|
105275
105483
|
if (localAppData) {
|
|
105276
|
-
paths.push(
|
|
105484
|
+
paths.push(join80(localAppData, "OpenCode", "OpenCode.exe"));
|
|
105277
105485
|
}
|
|
105278
105486
|
return paths;
|
|
105279
105487
|
}
|
|
@@ -105281,8 +105489,8 @@ function getDesktopAppPaths(platform) {
|
|
|
105281
105489
|
return [
|
|
105282
105490
|
"/usr/bin/opencode",
|
|
105283
105491
|
"/usr/lib/opencode/opencode",
|
|
105284
|
-
|
|
105285
|
-
|
|
105492
|
+
join80(home, "Applications", "opencode-desktop-linux-x86_64.AppImage"),
|
|
105493
|
+
join80(home, "Applications", "opencode-desktop-linux-aarch64.AppImage")
|
|
105286
105494
|
];
|
|
105287
105495
|
default:
|
|
105288
105496
|
return [];
|
|
@@ -105314,7 +105522,7 @@ async function findOpenCodeBinary(platform = process.platform, checkExists = exi
|
|
|
105314
105522
|
const candidates = getCommandCandidates2(platform);
|
|
105315
105523
|
for (const entry of pathEnv.split(delimiter).filter(Boolean)) {
|
|
105316
105524
|
for (const command of candidates) {
|
|
105317
|
-
const fullPath =
|
|
105525
|
+
const fullPath = join80(entry, command);
|
|
105318
105526
|
if (checkExists(fullPath) && isExecutable2(fullPath)) {
|
|
105319
105527
|
return { binary: command, path: fullPath };
|
|
105320
105528
|
}
|
|
@@ -105458,22 +105666,22 @@ init_package_json_locator();
|
|
|
105458
105666
|
import { existsSync as existsSync51, readFileSync as readFileSync33, readdirSync as readdirSync12 } from "node:fs";
|
|
105459
105667
|
import { createRequire as createRequire2 } from "node:module";
|
|
105460
105668
|
import { homedir as homedir17 } from "node:os";
|
|
105461
|
-
import { join as
|
|
105669
|
+
import { join as join81 } from "node:path";
|
|
105462
105670
|
import { fileURLToPath as fileURLToPath6 } from "node:url";
|
|
105463
105671
|
init_shared();
|
|
105464
105672
|
function getPlatformDefaultCacheDir(platform = process.platform) {
|
|
105465
105673
|
if (platform === "darwin")
|
|
105466
|
-
return
|
|
105674
|
+
return join81(homedir17(), "Library", "Caches");
|
|
105467
105675
|
if (platform === "win32")
|
|
105468
|
-
return process.env.LOCALAPPDATA ??
|
|
105469
|
-
return
|
|
105676
|
+
return process.env.LOCALAPPDATA ?? join81(homedir17(), "AppData", "Local");
|
|
105677
|
+
return join81(homedir17(), ".cache");
|
|
105470
105678
|
}
|
|
105471
105679
|
function resolveOpenCodeCacheDir() {
|
|
105472
105680
|
const xdgCacheHome = process.env.XDG_CACHE_HOME;
|
|
105473
105681
|
if (xdgCacheHome)
|
|
105474
|
-
return
|
|
105682
|
+
return join81(xdgCacheHome, "opencode");
|
|
105475
105683
|
const fromShared = getOpenCodeCacheDir();
|
|
105476
|
-
const platformDefault =
|
|
105684
|
+
const platformDefault = join81(getPlatformDefaultCacheDir(), "opencode");
|
|
105477
105685
|
if (existsSync51(fromShared) || !existsSync51(platformDefault))
|
|
105478
105686
|
return fromShared;
|
|
105479
105687
|
return platformDefault;
|
|
@@ -105505,11 +105713,11 @@ function normalizeVersion(value) {
|
|
|
105505
105713
|
function createPackageCandidates(rootDir) {
|
|
105506
105714
|
return ACCEPTED_PACKAGE_NAMES.map((packageName) => ({
|
|
105507
105715
|
packageName,
|
|
105508
|
-
installedPackagePath:
|
|
105716
|
+
installedPackagePath: join81(rootDir, "node_modules", packageName, "package.json")
|
|
105509
105717
|
}));
|
|
105510
105718
|
}
|
|
105511
105719
|
function createTaggedInstallCandidates(rootDir) {
|
|
105512
|
-
const packagesDir =
|
|
105720
|
+
const packagesDir = join81(rootDir, "packages");
|
|
105513
105721
|
if (!existsSync51(packagesDir))
|
|
105514
105722
|
return [];
|
|
105515
105723
|
const candidates = [];
|
|
@@ -105517,14 +105725,14 @@ function createTaggedInstallCandidates(rootDir) {
|
|
|
105517
105725
|
const packageName = ACCEPTED_PACKAGE_NAMES.find((name) => entryName.startsWith(`${name}@`));
|
|
105518
105726
|
if (packageName === undefined)
|
|
105519
105727
|
continue;
|
|
105520
|
-
const installDir =
|
|
105728
|
+
const installDir = join81(packagesDir, entryName);
|
|
105521
105729
|
candidates.push({
|
|
105522
105730
|
cacheDir: installDir,
|
|
105523
|
-
cachePackagePath:
|
|
105731
|
+
cachePackagePath: join81(installDir, "package.json"),
|
|
105524
105732
|
packageCandidates: [
|
|
105525
105733
|
{
|
|
105526
105734
|
packageName,
|
|
105527
|
-
installedPackagePath:
|
|
105735
|
+
installedPackagePath: join81(installDir, "node_modules", packageName, "package.json")
|
|
105528
105736
|
}
|
|
105529
105737
|
]
|
|
105530
105738
|
});
|
|
@@ -105569,13 +105777,13 @@ function getLoadedPluginVersion() {
|
|
|
105569
105777
|
const candidates = [
|
|
105570
105778
|
{
|
|
105571
105779
|
cacheDir: configDir,
|
|
105572
|
-
cachePackagePath:
|
|
105780
|
+
cachePackagePath: join81(configDir, "package.json"),
|
|
105573
105781
|
packageCandidates: createPackageCandidates(configDir)
|
|
105574
105782
|
},
|
|
105575
105783
|
...createTaggedInstallCandidates(configDir),
|
|
105576
105784
|
{
|
|
105577
105785
|
cacheDir,
|
|
105578
|
-
cachePackagePath:
|
|
105786
|
+
cachePackagePath: join81(cacheDir, "package.json"),
|
|
105579
105787
|
packageCandidates: createPackageCandidates(cacheDir)
|
|
105580
105788
|
},
|
|
105581
105789
|
...createTaggedInstallCandidates(cacheDir)
|
|
@@ -105768,18 +105976,18 @@ async function checkSystem(deps = defaultDeps5) {
|
|
|
105768
105976
|
init_shared();
|
|
105769
105977
|
import { existsSync as existsSync53, readFileSync as readFileSync35 } from "node:fs";
|
|
105770
105978
|
import { homedir as homedir18 } from "node:os";
|
|
105771
|
-
import { join as
|
|
105979
|
+
import { join as join82 } from "node:path";
|
|
105772
105980
|
function getUserConfigDir2() {
|
|
105773
105981
|
const xdgConfig = process.env.XDG_CONFIG_HOME;
|
|
105774
105982
|
if (xdgConfig)
|
|
105775
|
-
return
|
|
105776
|
-
return
|
|
105983
|
+
return join82(xdgConfig, "opencode");
|
|
105984
|
+
return join82(homedir18(), ".config", "opencode");
|
|
105777
105985
|
}
|
|
105778
105986
|
function loadCustomProviderNames() {
|
|
105779
105987
|
const configDir = getUserConfigDir2();
|
|
105780
105988
|
const candidatePaths = [
|
|
105781
|
-
|
|
105782
|
-
|
|
105989
|
+
join82(configDir, "opencode.json"),
|
|
105990
|
+
join82(configDir, "opencode.jsonc")
|
|
105783
105991
|
];
|
|
105784
105992
|
for (const configPath of candidatePaths) {
|
|
105785
105993
|
if (!existsSync53(configPath))
|
|
@@ -105800,7 +106008,7 @@ function loadCustomProviderNames() {
|
|
|
105800
106008
|
return [];
|
|
105801
106009
|
}
|
|
105802
106010
|
function loadAvailableModelsFromCache() {
|
|
105803
|
-
const cacheFile =
|
|
106011
|
+
const cacheFile = join82(getOpenCodeCacheDir(), "models.json");
|
|
105804
106012
|
const customProviders = loadCustomProviderNames();
|
|
105805
106013
|
if (!existsSync53(cacheFile)) {
|
|
105806
106014
|
if (customProviders.length > 0) {
|
|
@@ -105862,7 +106070,7 @@ function loadOmoConfig2() {
|
|
|
105862
106070
|
|
|
105863
106071
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-details.ts
|
|
105864
106072
|
init_shared();
|
|
105865
|
-
import { join as
|
|
106073
|
+
import { join as join83 } from "node:path";
|
|
105866
106074
|
|
|
105867
106075
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-variant.ts
|
|
105868
106076
|
function formatModelWithVariant(model, variant) {
|
|
@@ -105904,7 +106112,7 @@ function formatCapabilityResolutionLabel(mode) {
|
|
|
105904
106112
|
}
|
|
105905
106113
|
function buildModelResolutionDetails(options) {
|
|
105906
106114
|
const details = [];
|
|
105907
|
-
const cacheFile =
|
|
106115
|
+
const cacheFile = join83(getOpenCodeCacheDir(), "models.json");
|
|
105908
106116
|
details.push("═══ Available Models (from cache) ═══");
|
|
105909
106117
|
details.push("");
|
|
105910
106118
|
if (options.available.cacheExists) {
|
|
@@ -106245,7 +106453,7 @@ init_src4();
|
|
|
106245
106453
|
init_main();
|
|
106246
106454
|
init_config_migration();
|
|
106247
106455
|
import { existsSync as existsSync54, readFileSync as readFileSync36 } from "node:fs";
|
|
106248
|
-
import { join as
|
|
106456
|
+
import { join as join84 } from "node:path";
|
|
106249
106457
|
var CANONICAL_REPLACEMENT = new Map([
|
|
106250
106458
|
["variant", "reasoning"],
|
|
106251
106459
|
["reasoningEffort", "reasoning"],
|
|
@@ -106306,7 +106514,7 @@ function userConfigPaths() {
|
|
|
106306
106514
|
const home = process.env.HOME ?? process.env.USERPROFILE;
|
|
106307
106515
|
if (home === undefined || home.length === 0)
|
|
106308
106516
|
return [];
|
|
106309
|
-
return [
|
|
106517
|
+
return [join84(home, ".omo", "omo.jsonc"), join84(home, ".omo", "omo.json")];
|
|
106310
106518
|
}
|
|
106311
106519
|
async function checkDeprecatedReasoningKeys() {
|
|
106312
106520
|
const issues = [];
|
|
@@ -106332,13 +106540,13 @@ init_src();
|
|
|
106332
106540
|
import { existsSync as existsSync55 } from "node:fs";
|
|
106333
106541
|
import { createRequire as createRequire3 } from "node:module";
|
|
106334
106542
|
import { homedir as homedir20 } from "node:os";
|
|
106335
|
-
import { dirname as dirname33, join as
|
|
106543
|
+
import { dirname as dirname33, join as join88 } from "node:path";
|
|
106336
106544
|
|
|
106337
106545
|
// packages/omo-opencode/src/hooks/comment-checker/downloader.ts
|
|
106338
|
-
import { join as
|
|
106546
|
+
import { join as join87 } from "path";
|
|
106339
106547
|
import { homedir as homedir19, tmpdir as tmpdir4 } from "os";
|
|
106340
106548
|
// packages/comment-checker-core/src/release.ts
|
|
106341
|
-
import { join as
|
|
106549
|
+
import { join as join85 } from "node:path";
|
|
106342
106550
|
var COMMENT_CHECKER_RELEASE_VERSION = "0.8.0";
|
|
106343
106551
|
function commentCheckerBinaryName(platform) {
|
|
106344
106552
|
return platform === "win32" ? "comment-checker.exe" : "comment-checker";
|
|
@@ -106346,19 +106554,19 @@ function commentCheckerBinaryName(platform) {
|
|
|
106346
106554
|
function commentCheckerCacheDir(input) {
|
|
106347
106555
|
if (input.platform === "win32") {
|
|
106348
106556
|
const localAppData = input.env.LOCALAPPDATA || input.env.APPDATA;
|
|
106349
|
-
const base = localAppData ||
|
|
106350
|
-
return
|
|
106557
|
+
const base = localAppData || join85(input.homedir, "AppData", "Local");
|
|
106558
|
+
return join85(base, input.cacheDirName, "bin");
|
|
106351
106559
|
}
|
|
106352
|
-
const base = input.env.XDG_CACHE_HOME ||
|
|
106353
|
-
return
|
|
106560
|
+
const base = input.env.XDG_CACHE_HOME || join85(input.homedir, ".cache");
|
|
106561
|
+
return join85(base, input.cacheDirName, "bin");
|
|
106354
106562
|
}
|
|
106355
106563
|
// packages/comment-checker-core/src/cached-release.ts
|
|
106356
106564
|
import { readFileSync as readFileSync37, writeFileSync as writeFileSync12 } from "node:fs";
|
|
106357
|
-
import { join as
|
|
106565
|
+
import { join as join86 } from "node:path";
|
|
106358
106566
|
var COMMENT_CHECKER_VERSION_MARKER = "comment-checker.version";
|
|
106359
106567
|
function isCachedCommentCheckerCurrent(cacheDir, readFile = (path) => readFileSync37(path, "utf-8")) {
|
|
106360
106568
|
try {
|
|
106361
|
-
return readFile(
|
|
106569
|
+
return readFile(join86(cacheDir, COMMENT_CHECKER_VERSION_MARKER)).trim() === COMMENT_CHECKER_RELEASE_VERSION;
|
|
106362
106570
|
} catch {
|
|
106363
106571
|
return false;
|
|
106364
106572
|
}
|
|
@@ -106368,7 +106576,7 @@ init_binary_downloader();
|
|
|
106368
106576
|
init_logger2();
|
|
106369
106577
|
init_plugin_identity();
|
|
106370
106578
|
var DEBUG = process.env.COMMENT_CHECKER_DEBUG === "1";
|
|
106371
|
-
var DEBUG_FILE =
|
|
106579
|
+
var DEBUG_FILE = join87(tmpdir4(), "comment-checker-debug.log");
|
|
106372
106580
|
function getCacheDir2() {
|
|
106373
106581
|
return commentCheckerCacheDir({
|
|
106374
106582
|
platform: process.platform,
|
|
@@ -106427,7 +106635,7 @@ async function getBinaryVersion(binary) {
|
|
|
106427
106635
|
}
|
|
106428
106636
|
}
|
|
106429
106637
|
async function checkAstGrepCli() {
|
|
106430
|
-
const runtimeDir = astGrepRuntimeDir(
|
|
106638
|
+
const runtimeDir = astGrepRuntimeDir(join88(homedir20(), ".omo"));
|
|
106431
106639
|
const sgPath = findSgBinarySync({ runtimeDir });
|
|
106432
106640
|
if (sgPath === null) {
|
|
106433
106641
|
return {
|
|
@@ -106457,10 +106665,10 @@ function findCommentCheckerPackageBinary(baseDirOverride, resolvePackageJsonPath
|
|
|
106457
106665
|
const platformKey = `${process.platform}-${process.arch === "x64" ? "x64" : process.arch}`;
|
|
106458
106666
|
try {
|
|
106459
106667
|
const packageDir = baseDirOverride ?? dirname33(resolvePackageJsonPath());
|
|
106460
|
-
const vendorPath =
|
|
106668
|
+
const vendorPath = join88(packageDir, "vendor", platformKey, binaryName);
|
|
106461
106669
|
if (existsSync55(vendorPath))
|
|
106462
106670
|
return vendorPath;
|
|
106463
|
-
const binPath =
|
|
106671
|
+
const binPath = join88(packageDir, "bin", binaryName);
|
|
106464
106672
|
if (existsSync55(binPath))
|
|
106465
106673
|
return binPath;
|
|
106466
106674
|
} catch (error) {
|
|
@@ -106836,13 +107044,13 @@ function getInstalledLspServers(options = {}) {
|
|
|
106836
107044
|
init_shared();
|
|
106837
107045
|
import { existsSync as existsSync57, readFileSync as readFileSync39 } from "node:fs";
|
|
106838
107046
|
import { homedir as homedir21 } from "node:os";
|
|
106839
|
-
import { join as
|
|
107047
|
+
import { join as join89 } from "node:path";
|
|
106840
107048
|
var BUILTIN_MCP_SERVERS = ["websearch", "context7", "grep_app", "lsp"];
|
|
106841
107049
|
function getMcpConfigPaths() {
|
|
106842
107050
|
return [
|
|
106843
|
-
|
|
106844
|
-
|
|
106845
|
-
|
|
107051
|
+
join89(homedir21(), ".claude", ".mcp.json"),
|
|
107052
|
+
join89(process.cwd(), ".mcp.json"),
|
|
107053
|
+
join89(process.cwd(), ".claude", ".mcp.json")
|
|
106846
107054
|
];
|
|
106847
107055
|
}
|
|
106848
107056
|
function loadUserMcpConfig() {
|
|
@@ -107122,9 +107330,9 @@ async function pathExists2(dir) {
|
|
|
107122
107330
|
// packages/omo-opencode/src/cli/doctor/checks/codex.ts
|
|
107123
107331
|
init_src();
|
|
107124
107332
|
import { existsSync as existsSync59 } from "node:fs";
|
|
107125
|
-
import { lstat as lstat16, readdir as readdir14, readFile as
|
|
107333
|
+
import { lstat as lstat16, readdir as readdir14, readFile as readFile30 } from "node:fs/promises";
|
|
107126
107334
|
import { homedir as homedir23 } from "node:os";
|
|
107127
|
-
import { basename as basename12, join as
|
|
107335
|
+
import { basename as basename12, join as join90, resolve as resolve24 } from "node:path";
|
|
107128
107336
|
// packages/omo-opencode/package.json
|
|
107129
107337
|
var package_default3 = {
|
|
107130
107338
|
name: "@oh-my-opencode/omo-opencode",
|
|
@@ -107194,13 +107402,13 @@ var CODEX_BIN_NAMES = [
|
|
|
107194
107402
|
"omo-git-bash-hook"
|
|
107195
107403
|
];
|
|
107196
107404
|
async function gatherCodexSummary(deps = {}) {
|
|
107197
|
-
const codexHome = resolve24(deps.codexHome ?? process.env.CODEX_HOME ??
|
|
107405
|
+
const codexHome = resolve24(deps.codexHome ?? process.env.CODEX_HOME ?? join90(homedir23(), ".codex"));
|
|
107198
107406
|
const binDir = resolveCodexInstallerBinDir({ binDir: deps.binDir, codexHome, env: process.env });
|
|
107199
107407
|
const detection = await (deps.detectCodexInstallation ?? detectCodexInstallation)();
|
|
107200
107408
|
const pluginRoot = await resolveInstalledPluginRoot(codexHome);
|
|
107201
|
-
const manifest = pluginRoot === null ? null : await readJson(
|
|
107202
|
-
const installSnapshot = pluginRoot === null ? null : await readJson(
|
|
107203
|
-
const configPath =
|
|
107409
|
+
const manifest = pluginRoot === null ? null : await readJson(join90(pluginRoot, ".codex-plugin", "plugin.json"));
|
|
107410
|
+
const installSnapshot = pluginRoot === null ? null : await readJson(join90(pluginRoot, "lazycodex-install.json"));
|
|
107411
|
+
const configPath = join90(codexHome, "config.toml");
|
|
107204
107412
|
const pluginVersion = stringField(manifest, "version");
|
|
107205
107413
|
return {
|
|
107206
107414
|
codexPath: detection.found && "path" in detection ? detection.path : null,
|
|
@@ -107257,7 +107465,7 @@ function buildCodexIssues(summary) {
|
|
|
107257
107465
|
if (summary.pluginRoot === null) {
|
|
107258
107466
|
issues.push({
|
|
107259
107467
|
title: "OMO Codex plugin is not installed",
|
|
107260
|
-
description: `Expected cached plugin at ${
|
|
107468
|
+
description: `Expected cached plugin at ${join90("plugins", "cache", MARKETPLACE_NAME, PLUGIN_NAME2, DEFAULT_PLUGIN_VERSION)} under CODEX_HOME.`,
|
|
107261
107469
|
fix: "Run: npx lazycodex-ai install",
|
|
107262
107470
|
severity: "error",
|
|
107263
107471
|
affects: ["plugin loading"]
|
|
@@ -107322,12 +107530,12 @@ function buildCodexIssues(summary) {
|
|
|
107322
107530
|
return issues;
|
|
107323
107531
|
}
|
|
107324
107532
|
async function resolveInstalledPluginRoot(codexHome) {
|
|
107325
|
-
const pluginRoot =
|
|
107533
|
+
const pluginRoot = join90(codexHome, "plugins", "cache", MARKETPLACE_NAME, PLUGIN_NAME2);
|
|
107326
107534
|
if (!existsSync59(pluginRoot))
|
|
107327
107535
|
return null;
|
|
107328
107536
|
const versions = await readdir14(pluginRoot, { withFileTypes: true });
|
|
107329
107537
|
const candidates = versions.filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort(compareVersionsDescending);
|
|
107330
|
-
return candidates.length === 0 ? null :
|
|
107538
|
+
return candidates.length === 0 ? null : join90(pluginRoot, candidates[0] ?? DEFAULT_PLUGIN_VERSION);
|
|
107331
107539
|
}
|
|
107332
107540
|
async function readCodexConfigSummary(configPath) {
|
|
107333
107541
|
if (!existsSync59(configPath)) {
|
|
@@ -107341,7 +107549,7 @@ async function readCodexConfigSummary(configPath) {
|
|
|
107341
107549
|
companionLifecycleHookStateEvents: []
|
|
107342
107550
|
};
|
|
107343
107551
|
}
|
|
107344
|
-
const content = await
|
|
107552
|
+
const content = await readFile30(configPath, "utf8");
|
|
107345
107553
|
return {
|
|
107346
107554
|
exists: true,
|
|
107347
107555
|
marketplaceConfigured: content.includes("[marketplaces.sisyphuslabs]"),
|
|
@@ -107355,13 +107563,13 @@ async function readCodexConfigSummary(configPath) {
|
|
|
107355
107563
|
async function readLinkedBins(binDir) {
|
|
107356
107564
|
const linked = [];
|
|
107357
107565
|
for (const name of CODEX_BIN_NAMES) {
|
|
107358
|
-
if (await pathExists3(
|
|
107566
|
+
if (await pathExists3(join90(binDir, process.platform === "win32" ? `${name}.cmd` : name)))
|
|
107359
107567
|
linked.push(name);
|
|
107360
107568
|
}
|
|
107361
107569
|
return linked;
|
|
107362
107570
|
}
|
|
107363
107571
|
async function readLinkedAgents(codexHome) {
|
|
107364
|
-
const agentsDir =
|
|
107572
|
+
const agentsDir = join90(codexHome, "agents");
|
|
107365
107573
|
if (!existsSync59(agentsDir))
|
|
107366
107574
|
return [];
|
|
107367
107575
|
const entries = await readdir14(agentsDir, { withFileTypes: true });
|
|
@@ -107369,7 +107577,7 @@ async function readLinkedAgents(codexHome) {
|
|
|
107369
107577
|
}
|
|
107370
107578
|
async function readJson(path) {
|
|
107371
107579
|
try {
|
|
107372
|
-
const parsed = JSON.parse(await
|
|
107580
|
+
const parsed = JSON.parse(await readFile30(path, "utf8"));
|
|
107373
107581
|
return isPlainRecord(parsed) ? parsed : null;
|
|
107374
107582
|
} catch (error) {
|
|
107375
107583
|
if (error instanceof Error)
|
|
@@ -107493,9 +107701,9 @@ function resolveLatestVersion(input) {
|
|
|
107493
107701
|
|
|
107494
107702
|
// packages/omo-opencode/src/cli/doctor/checks/codex-components.ts
|
|
107495
107703
|
init_src();
|
|
107496
|
-
import { readdir as readdir15, readFile as
|
|
107704
|
+
import { readdir as readdir15, readFile as readFile31, stat as stat7 } from "node:fs/promises";
|
|
107497
107705
|
import { homedir as homedir24 } from "node:os";
|
|
107498
|
-
import { dirname as dirname35, isAbsolute as isAbsolute14, join as
|
|
107706
|
+
import { dirname as dirname35, isAbsolute as isAbsolute14, join as join91, relative as relative9, resolve as resolve25, sep as sep9 } from "node:path";
|
|
107499
107707
|
var CODEX_COMPONENTS_CHECK_ID = "codex-components";
|
|
107500
107708
|
var CODEX_COMPONENTS_CHECK_NAME = "codex-components";
|
|
107501
107709
|
var PLUGIN_DATA_DIR_NAME = "omo-sisyphuslabs";
|
|
@@ -107505,7 +107713,7 @@ async function checkCodexComponents(deps = {}) {
|
|
|
107505
107713
|
const env = deps.env ?? process.env;
|
|
107506
107714
|
const platform = deps.platform ?? process.platform;
|
|
107507
107715
|
const arch = deps.arch ?? process.arch;
|
|
107508
|
-
const codexHome = resolve25(deps.codexHome ?? env["CODEX_HOME"] ??
|
|
107716
|
+
const codexHome = resolve25(deps.codexHome ?? env["CODEX_HOME"] ?? join91(homedir24(), ".codex"));
|
|
107509
107717
|
const summary = await gatherCodexSummary({ ...deps, codexHome });
|
|
107510
107718
|
if (summary.pluginRoot === null) {
|
|
107511
107719
|
return {
|
|
@@ -107530,7 +107738,7 @@ async function checkCodexComponents(deps = {}) {
|
|
|
107530
107738
|
});
|
|
107531
107739
|
}
|
|
107532
107740
|
const runtimeSgDir = runtimeSgDirectory(codexHome, platform, arch);
|
|
107533
|
-
const runtimeSgPath =
|
|
107741
|
+
const runtimeSgPath = join91(runtimeSgDir, sgBinaryName(platform));
|
|
107534
107742
|
const sg = findSgBinarySync({
|
|
107535
107743
|
arch,
|
|
107536
107744
|
env,
|
|
@@ -107642,7 +107850,7 @@ async function findManifestPaths(root, manifestName) {
|
|
|
107642
107850
|
for (const entry of entries) {
|
|
107643
107851
|
if (entry.name === "node_modules" || entry.name === ".git")
|
|
107644
107852
|
continue;
|
|
107645
|
-
const entryPath =
|
|
107853
|
+
const entryPath = join91(root, entry.name);
|
|
107646
107854
|
if (entry.isDirectory()) {
|
|
107647
107855
|
paths.push(...await findManifestPaths(entryPath, manifestName));
|
|
107648
107856
|
continue;
|
|
@@ -107686,18 +107894,18 @@ function isPluginRuntimePathArg(arg) {
|
|
|
107686
107894
|
return normalized.endsWith(".js") && normalized.includes("/dist/") && (normalized.startsWith("./") || normalized.startsWith("../") || normalized.startsWith("components/") || normalized.startsWith("/") || isAbsolute14(arg));
|
|
107687
107895
|
}
|
|
107688
107896
|
function runtimeSgDirectory(codexHome, platform, arch) {
|
|
107689
|
-
return
|
|
107897
|
+
return join91(codexHome, "runtime", "ast-grep", runtimeSlug(platform, arch));
|
|
107690
107898
|
}
|
|
107691
107899
|
function describeSgSource(sgPath, env, runtimeSgDir, platform) {
|
|
107692
107900
|
const override = env[SG_PATH_ENV_KEY]?.trim();
|
|
107693
107901
|
if (override !== undefined && override.length > 0 && sgPath === override)
|
|
107694
107902
|
return `env override ${SG_PATH_ENV_KEY}`;
|
|
107695
|
-
if (sgPath ===
|
|
107903
|
+
if (sgPath === join91(runtimeSgDir, sgBinaryName(platform)))
|
|
107696
107904
|
return "runtime dir";
|
|
107697
107905
|
return "PATH";
|
|
107698
107906
|
}
|
|
107699
107907
|
async function readBootstrapStateSummary(codexHome) {
|
|
107700
|
-
const statePath =
|
|
107908
|
+
const statePath = join91(codexHome, "plugins", "data", PLUGIN_DATA_DIR_NAME, "bootstrap", "state.json");
|
|
107701
107909
|
const raw = await readJson2(statePath);
|
|
107702
107910
|
if (raw === null)
|
|
107703
107911
|
return null;
|
|
@@ -107746,7 +107954,7 @@ function degradedDetailLines(entries) {
|
|
|
107746
107954
|
}
|
|
107747
107955
|
async function readJson2(path) {
|
|
107748
107956
|
try {
|
|
107749
|
-
const parsed = JSON.parse(await
|
|
107957
|
+
const parsed = JSON.parse(await readFile31(path, "utf8"));
|
|
107750
107958
|
return isRecord18(parsed) ? parsed : null;
|
|
107751
107959
|
} catch (error) {
|
|
107752
107960
|
if (error instanceof Error)
|
|
@@ -107774,18 +107982,18 @@ function isRecord18(value) {
|
|
|
107774
107982
|
|
|
107775
107983
|
// packages/omo-opencode/src/cli/doctor/checks/codex-runtime-wrapper.ts
|
|
107776
107984
|
import { existsSync as existsSync60 } from "node:fs";
|
|
107777
|
-
import { readFile as
|
|
107985
|
+
import { readFile as readFile32 } from "node:fs/promises";
|
|
107778
107986
|
import { homedir as homedir25 } from "node:os";
|
|
107779
|
-
import { join as
|
|
107987
|
+
import { join as join92, resolve as resolve26 } from "node:path";
|
|
107780
107988
|
var RUNTIME_WRAPPER_MARKER2 = "OMO_GENERATED_RUNTIME_WRAPPER";
|
|
107781
107989
|
var CHECK_NAME = "codex-runtime-wrapper";
|
|
107782
107990
|
var REINSTALL_COMMAND = "npx --yes lazycodex-ai@latest install --no-tui";
|
|
107783
107991
|
async function checkCodexRuntimeWrapper(deps = {}) {
|
|
107784
|
-
const codexHome = resolve26(deps.codexHome ?? process.env.CODEX_HOME ??
|
|
107992
|
+
const codexHome = resolve26(deps.codexHome ?? process.env.CODEX_HOME ?? join92(homedir25(), ".codex"));
|
|
107785
107993
|
const binDir = resolveCodexInstallerBinDir({ binDir: deps.binDir, codexHome, env: process.env });
|
|
107786
107994
|
const platform = deps.platform ?? process.platform;
|
|
107787
|
-
const wrapperPath =
|
|
107788
|
-
const legacyWrapperPath =
|
|
107995
|
+
const wrapperPath = join92(binDir, platform === "win32" ? "omo-agent-toolkit.cmd" : "omo-agent-toolkit");
|
|
107996
|
+
const legacyWrapperPath = join92(binDir, platform === "win32" ? "omo.cmd" : "omo");
|
|
107789
107997
|
const [wrapper, legacyWrapper] = await Promise.all([readRuntimeWrapper(wrapperPath), readRuntimeWrapper(legacyWrapperPath)]);
|
|
107790
107998
|
const issues = [];
|
|
107791
107999
|
if (wrapper?.includes(RUNTIME_WRAPPER_MARKER2) === true) {
|
|
@@ -107819,7 +108027,7 @@ async function checkCodexRuntimeWrapper(deps = {}) {
|
|
|
107819
108027
|
}
|
|
107820
108028
|
async function readRuntimeWrapper(path) {
|
|
107821
108029
|
try {
|
|
107822
|
-
return await
|
|
108030
|
+
return await readFile32(path, "utf8");
|
|
107823
108031
|
} catch (error) {
|
|
107824
108032
|
if (error instanceof Error)
|
|
107825
108033
|
return null;
|
|
@@ -108321,12 +108529,12 @@ import {
|
|
|
108321
108529
|
unlinkSync as unlinkSync9,
|
|
108322
108530
|
writeFileSync as writeFileSync14
|
|
108323
108531
|
} from "node:fs";
|
|
108324
|
-
import { basename as basename13, dirname as dirname36, join as
|
|
108532
|
+
import { basename as basename13, dirname as dirname36, join as join95 } from "node:path";
|
|
108325
108533
|
|
|
108326
108534
|
// packages/mcp-client-core/src/config-dir.ts
|
|
108327
108535
|
import { existsSync as existsSync61, realpathSync as realpathSync10 } from "node:fs";
|
|
108328
108536
|
import { homedir as homedir26 } from "node:os";
|
|
108329
|
-
import { join as
|
|
108537
|
+
import { join as join93, resolve as resolve27 } from "node:path";
|
|
108330
108538
|
function resolveConfigPath2(pathValue) {
|
|
108331
108539
|
const resolvedPath = resolve27(pathValue);
|
|
108332
108540
|
if (!existsSync61(resolvedPath))
|
|
@@ -108344,13 +108552,13 @@ function getOpenCodeCliConfigDir(env = process.env) {
|
|
|
108344
108552
|
if (customConfigDir) {
|
|
108345
108553
|
return resolveConfigPath2(customConfigDir);
|
|
108346
108554
|
}
|
|
108347
|
-
const xdgConfigDir = env["XDG_CONFIG_HOME"]?.trim() ||
|
|
108348
|
-
return resolveConfigPath2(
|
|
108555
|
+
const xdgConfigDir = env["XDG_CONFIG_HOME"]?.trim() || join93(homedir26(), ".config");
|
|
108556
|
+
return resolveConfigPath2(join93(xdgConfigDir, "opencode"));
|
|
108349
108557
|
}
|
|
108350
108558
|
|
|
108351
108559
|
// packages/mcp-client-core/src/mcp-oauth/storage-index.ts
|
|
108352
108560
|
import { chmodSync as chmodSync4, existsSync as existsSync62, readFileSync as readFileSync41, renameSync as renameSync7, writeFileSync as writeFileSync13 } from "node:fs";
|
|
108353
|
-
import { join as
|
|
108561
|
+
import { join as join94 } from "node:path";
|
|
108354
108562
|
var INDEX_FILE_NAME = "index.json";
|
|
108355
108563
|
function isTokenIndex(value) {
|
|
108356
108564
|
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
@@ -108358,7 +108566,7 @@ function isTokenIndex(value) {
|
|
|
108358
108566
|
return Object.values(value).every((entry) => typeof entry === "string");
|
|
108359
108567
|
}
|
|
108360
108568
|
function getIndexPath(storageDir) {
|
|
108361
|
-
return
|
|
108569
|
+
return join94(storageDir, INDEX_FILE_NAME);
|
|
108362
108570
|
}
|
|
108363
108571
|
function readTokenIndex(storageDir) {
|
|
108364
108572
|
const indexPath = getIndexPath(storageDir);
|
|
@@ -108402,16 +108610,16 @@ function deleteTokenIndexEntry(storageDir, hash) {
|
|
|
108402
108610
|
var STORAGE_DIR_NAME = "mcp-oauth";
|
|
108403
108611
|
var LEGACY_STORAGE_FILE_NAME = "mcp-oauth.json";
|
|
108404
108612
|
function getMcpOauthStorageDir() {
|
|
108405
|
-
return
|
|
108613
|
+
return join95(getOpenCodeCliConfigDir(), STORAGE_DIR_NAME);
|
|
108406
108614
|
}
|
|
108407
108615
|
function getMcpOauthServerHash(serverHost, resource) {
|
|
108408
108616
|
return createHash7("sha256").update(buildKey(serverHost, resource)).digest("hex").slice(0, 32);
|
|
108409
108617
|
}
|
|
108410
108618
|
function getMcpOauthStoragePath(serverHost, resource) {
|
|
108411
|
-
return
|
|
108619
|
+
return join95(getMcpOauthStorageDir(), `${getMcpOauthServerHash(serverHost, resource)}.json`);
|
|
108412
108620
|
}
|
|
108413
108621
|
function getLegacyStoragePath() {
|
|
108414
|
-
return
|
|
108622
|
+
return join95(getOpenCodeCliConfigDir(), LEGACY_STORAGE_FILE_NAME);
|
|
108415
108623
|
}
|
|
108416
108624
|
function normalizeHost2(serverHost) {
|
|
108417
108625
|
let host = serverHost.trim();
|
|
@@ -108590,7 +108798,7 @@ function listTokensByHost(serverHost) {
|
|
|
108590
108798
|
for (const [hash, indexedKey] of Object.entries(index)) {
|
|
108591
108799
|
if (!indexedKey.startsWith(prefix))
|
|
108592
108800
|
continue;
|
|
108593
|
-
const indexedToken = readTokenFile(
|
|
108801
|
+
const indexedToken = readTokenFile(join95(getMcpOauthStorageDir(), `${hash}.json`));
|
|
108594
108802
|
if (indexedToken)
|
|
108595
108803
|
result[indexedKey] = indexedToken;
|
|
108596
108804
|
}
|
|
@@ -108605,7 +108813,7 @@ function listAllTokens() {
|
|
|
108605
108813
|
for (const entry of readdirSync13(dir, { withFileTypes: true })) {
|
|
108606
108814
|
if (!entry.isFile() || !entry.name.endsWith(".json") || entry.name === "index.json")
|
|
108607
108815
|
continue;
|
|
108608
|
-
const token = readTokenFile(
|
|
108816
|
+
const token = readTokenFile(join95(dir, entry.name));
|
|
108609
108817
|
const hash = basename13(entry.name, ".json");
|
|
108610
108818
|
if (token)
|
|
108611
108819
|
result[index[hash] ?? hash] = token;
|