oh-my-opencode 5.0.0-beta.79 → 5.0.0-beta.80
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/command/remove-deadcode.md +1 -1
- package/.agents/skills/hyperplan/SKILL.md +5 -5
- package/.agents/skills/remove-deadcode/SKILL.md +1 -1
- package/.agents/skills/security-research/SKILL.md +4 -4
- package/dist/cli/index.js +499 -336
- package/dist/cli-node/index.js +499 -336
- package/dist/config-migration/category-deep-split.d.ts +3 -0
- package/dist/config-migration/migration-plans.d.ts +1 -0
- package/dist/features/builtin-commands/templates/hyperplan.d.ts +1 -1
- package/dist/features/builtin-commands/templates/refactor-sections/team-mode-addendum.d.ts +1 -1
- package/dist/features/builtin-commands/templates/remove-ai-slops.d.ts +1 -1
- package/dist/index.js +282 -123
- package/dist/plugin-config/omo-config-chain.d.ts +1 -0
- package/dist/skills/debugging/references/methodology/02-investigate.md +5 -5
- package/dist/skills/refactor/SKILL.md +2 -2
- package/dist/skills/remove-ai-slops/SKILL.md +4 -4
- package/dist/skills/ulw-execute/SKILL.md +3 -2
- package/dist/skills/ulw-plan/references/full-workflow.md +1 -1
- package/dist/skills/ulw-research/SKILL.md +2 -2
- package/dist/tools/delegate-task/openai-categories.d.ts +6 -4
- package/dist/tui.js +146 -71
- package/package.json +14 -14
- package/packages/omo-codex/plugin/.codex-plugin/plugin.json +1 -1
- package/packages/omo-codex/plugin/components/bootstrap/dist/cli.js +77 -8
- 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/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/dist/cli.js +63 -17
- package/packages/omo-codex/plugin/components/telemetry/dist/posthog.js +63 -17
- 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/ultrawork/skills/ulw-plan/references/full-workflow.md +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/dist/checkpoint-template.js +3 -3
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli.js +14 -6
- package/packages/omo-codex/plugin/components/ulw-loop/dist/codex-goal-instruction.js +2 -2
- package/packages/omo-codex/plugin/components/ulw-loop/dist/surface.js +9 -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/components/ulw-loop/src/checkpoint-template.ts +3 -3
- package/packages/omo-codex/plugin/components/ulw-loop/src/codex-goal-instruction.ts +2 -2
- package/packages/omo-codex/plugin/components/ulw-loop/src/surface.ts +9 -1
- package/packages/omo-codex/plugin/components/ulw-loop/test/checkpoint-template.test.ts +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/test/codex-goal-instruction.test.ts +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/test/sdk-contract.test.ts +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/debugging/references/methodology/02-investigate.md +5 -5
- package/packages/omo-codex/plugin/skills/refactor/SKILL.md +2 -2
- package/packages/omo-codex/plugin/skills/remove-ai-slops/SKILL.md +4 -4
- package/packages/omo-codex/plugin/skills/ulw-execute/SKILL.md +3 -2
- package/packages/omo-codex/plugin/skills/ulw-plan/references/full-workflow.md +1 -1
- package/packages/omo-codex/plugin/skills/ulw-research/SKILL.md +2 -2
- package/packages/omo-codex/scripts/install-dist/install-local.mjs +167 -51
- package/packages/shared-skills/skills/debugging/references/methodology/02-investigate.md +5 -5
- package/packages/shared-skills/skills/refactor/SKILL.md +2 -2
- package/packages/shared-skills/skills/remove-ai-slops/SKILL.md +4 -4
- package/packages/shared-skills/skills/ulw-execute/SKILL.md +3 -2
- package/packages/shared-skills/skills/ulw-plan/references/full-workflow.md +1 -1
- package/packages/shared-skills/skills/ulw-research/SKILL.md +2 -2
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.0.0-beta.
|
|
68
|
+
version: "5.0.0-beta.80",
|
|
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",
|
|
@@ -247,7 +247,7 @@ var init_package = __esm(() => {
|
|
|
247
247
|
zod: "^4.4.3"
|
|
248
248
|
},
|
|
249
249
|
devDependencies: {
|
|
250
|
-
"@code-yeongyu/senpi": "2026.9.
|
|
250
|
+
"@code-yeongyu/senpi": "2026.9.20",
|
|
251
251
|
"@oh-my-opencode/agents-md-core": "workspace:*",
|
|
252
252
|
"@oh-my-opencode/ast-grep-mcp": "workspace:*",
|
|
253
253
|
"@oh-my-opencode/boulder-state": "workspace:*",
|
|
@@ -286,18 +286,18 @@ var init_package = __esm(() => {
|
|
|
286
286
|
typescript: "^7.0.2"
|
|
287
287
|
},
|
|
288
288
|
optionalDependencies: {
|
|
289
|
-
"oh-my-opencode-darwin-arm64": "5.0.0-beta.
|
|
290
|
-
"oh-my-opencode-darwin-x64": "5.0.0-beta.
|
|
291
|
-
"oh-my-opencode-darwin-x64-baseline": "5.0.0-beta.
|
|
292
|
-
"oh-my-opencode-linux-arm64": "5.0.0-beta.
|
|
293
|
-
"oh-my-opencode-linux-arm64-musl": "5.0.0-beta.
|
|
294
|
-
"oh-my-opencode-linux-x64": "5.0.0-beta.
|
|
295
|
-
"oh-my-opencode-linux-x64-baseline": "5.0.0-beta.
|
|
296
|
-
"oh-my-opencode-linux-x64-musl": "5.0.0-beta.
|
|
297
|
-
"oh-my-opencode-linux-x64-musl-baseline": "5.0.0-beta.
|
|
298
|
-
"oh-my-opencode-windows-arm64": "5.0.0-beta.
|
|
299
|
-
"oh-my-opencode-windows-x64": "5.0.0-beta.
|
|
300
|
-
"oh-my-opencode-windows-x64-baseline": "5.0.0-beta.
|
|
289
|
+
"oh-my-opencode-darwin-arm64": "5.0.0-beta.80",
|
|
290
|
+
"oh-my-opencode-darwin-x64": "5.0.0-beta.80",
|
|
291
|
+
"oh-my-opencode-darwin-x64-baseline": "5.0.0-beta.80",
|
|
292
|
+
"oh-my-opencode-linux-arm64": "5.0.0-beta.80",
|
|
293
|
+
"oh-my-opencode-linux-arm64-musl": "5.0.0-beta.80",
|
|
294
|
+
"oh-my-opencode-linux-x64": "5.0.0-beta.80",
|
|
295
|
+
"oh-my-opencode-linux-x64-baseline": "5.0.0-beta.80",
|
|
296
|
+
"oh-my-opencode-linux-x64-musl": "5.0.0-beta.80",
|
|
297
|
+
"oh-my-opencode-linux-x64-musl-baseline": "5.0.0-beta.80",
|
|
298
|
+
"oh-my-opencode-windows-arm64": "5.0.0-beta.80",
|
|
299
|
+
"oh-my-opencode-windows-x64": "5.0.0-beta.80",
|
|
300
|
+
"oh-my-opencode-windows-x64-baseline": "5.0.0-beta.80"
|
|
301
301
|
},
|
|
302
302
|
overrides: {
|
|
303
303
|
"@earendil-works/pi-agent-core": "0.84.2",
|
|
@@ -7244,13 +7244,8 @@ var init_category_model_requirements = __esm(() => {
|
|
|
7244
7244
|
{ providers: ["openai", "openai-codex", "opencode"], model: "gpt-5.6-sol", variant: "max" }
|
|
7245
7245
|
]
|
|
7246
7246
|
},
|
|
7247
|
-
deep: {
|
|
7247
|
+
"deep-low": {
|
|
7248
7248
|
fallbackChain: [
|
|
7249
|
-
{
|
|
7250
|
-
providers: ["openai", "openai-codex", "github-copilot", "opencode"],
|
|
7251
|
-
model: "gpt-6-astra",
|
|
7252
|
-
variant: "high"
|
|
7253
|
-
},
|
|
7254
7249
|
{
|
|
7255
7250
|
providers: ["openai", "openai-codex", "github-copilot", "opencode"],
|
|
7256
7251
|
model: "gpt-5.6-sol",
|
|
@@ -7258,6 +7253,15 @@ var init_category_model_requirements = __esm(() => {
|
|
|
7258
7253
|
}
|
|
7259
7254
|
]
|
|
7260
7255
|
},
|
|
7256
|
+
"deep-high": {
|
|
7257
|
+
fallbackChain: [
|
|
7258
|
+
{
|
|
7259
|
+
providers: ["openai", "openai-codex", "github-copilot", "opencode"],
|
|
7260
|
+
model: "gpt-6-astra",
|
|
7261
|
+
variant: "high"
|
|
7262
|
+
}
|
|
7263
|
+
]
|
|
7264
|
+
},
|
|
7261
7265
|
artistry: {
|
|
7262
7266
|
fallbackChain: [
|
|
7263
7267
|
{
|
|
@@ -7344,12 +7348,17 @@ var init_category_model_requirements = __esm(() => {
|
|
|
7344
7348
|
{
|
|
7345
7349
|
providers: ["anthropic", "anthropic-api", "github-copilot", "opencode"],
|
|
7346
7350
|
model: "claude-fable-5-1",
|
|
7347
|
-
variant: "
|
|
7351
|
+
variant: "low"
|
|
7348
7352
|
},
|
|
7349
7353
|
{
|
|
7350
7354
|
providers: ["kimi-for-coding", "moonshotai", "opencode-go", "opencode"],
|
|
7351
7355
|
model: "kimi-k3",
|
|
7352
|
-
variant: "
|
|
7356
|
+
variant: "low"
|
|
7357
|
+
},
|
|
7358
|
+
{
|
|
7359
|
+
providers: ["anthropic", "anthropic-api", "github-copilot", "opencode"],
|
|
7360
|
+
model: "claude-opus-4-6",
|
|
7361
|
+
variant: "low"
|
|
7353
7362
|
}
|
|
7354
7363
|
]
|
|
7355
7364
|
}
|
|
@@ -8992,7 +9001,7 @@ var init_kimi_categories = __esm(() => {
|
|
|
8992
9001
|
KIMI_CATEGORIES = [
|
|
8993
9002
|
{
|
|
8994
9003
|
name: "writing",
|
|
8995
|
-
config: { model: "anthropic/claude-fable-5-1", variant: "
|
|
9004
|
+
config: { model: "anthropic/claude-fable-5-1", variant: "low" },
|
|
8996
9005
|
description: "Documentation, prose, technical writing",
|
|
8997
9006
|
promptAppend: WRITING_CATEGORY_PROMPT_APPEND
|
|
8998
9007
|
}
|
|
@@ -9018,20 +9027,20 @@ function isGpt6Model(model) {
|
|
|
9018
9027
|
var init_types = () => {};
|
|
9019
9028
|
|
|
9020
9029
|
// packages/omo-opencode/src/tools/delegate-task/openai-categories.ts
|
|
9030
|
+
function isGptDeepLaneModel(model) {
|
|
9031
|
+
return model !== undefined && (isGpt6Model(model) || isGpt5_5Model(model) || isGpt5_6Model(model));
|
|
9032
|
+
}
|
|
9021
9033
|
function resolveUltrabrainCategoryPromptAppend(model) {
|
|
9022
9034
|
if (model && isGpt6Model(model)) {
|
|
9023
9035
|
return ULTRABRAIN_CATEGORY_PROMPT_APPEND_GPT_6_ASTRA;
|
|
9024
9036
|
}
|
|
9025
9037
|
return ULTRABRAIN_CATEGORY_PROMPT_APPEND;
|
|
9026
9038
|
}
|
|
9027
|
-
function
|
|
9028
|
-
|
|
9029
|
-
|
|
9030
|
-
|
|
9031
|
-
|
|
9032
|
-
return DEEP_CATEGORY_PROMPT_APPEND_GPT_5_5;
|
|
9033
|
-
}
|
|
9034
|
-
return DEEP_CATEGORY_PROMPT_APPEND;
|
|
9039
|
+
function resolveDeepLowCategoryPromptAppend(model) {
|
|
9040
|
+
return isGptDeepLaneModel(model) ? DEEP_LOW_CATEGORY_PROMPT_APPEND_GPT : DEEP_LOW_CATEGORY_PROMPT_APPEND;
|
|
9041
|
+
}
|
|
9042
|
+
function resolveDeepHighCategoryPromptAppend(model) {
|
|
9043
|
+
return isGptDeepLaneModel(model) ? DEEP_HIGH_CATEGORY_PROMPT_APPEND_GPT : DEEP_HIGH_CATEGORY_PROMPT_APPEND;
|
|
9035
9044
|
}
|
|
9036
9045
|
function resolveUnspecifiedHighCategoryPromptAppend(model) {
|
|
9037
9046
|
if (model && isGpt6Model(model)) {
|
|
@@ -9050,14 +9059,23 @@ Success means:
|
|
|
9050
9059
|
- one decision-complete recommendation, actionable without a follow-up question.
|
|
9051
9060
|
|
|
9052
9061
|
Whatever that check leaves unsettled goes in the answer as an open question with what would settle it. When the goal bundles independent problems, solve the one the others depend on and return the rest as separately delegable items.
|
|
9053
|
-
</Category_Context>`,
|
|
9054
|
-
The orchestrator routed this task here
|
|
9055
|
-
|
|
9056
|
-
**MUST USE \`deep\` FOR 3D GRAPHICS, COMPUTER USE, BROWSER USE, BACKEND, LOGIC, ALGORITHMS, CAPTCHA SOLVING, AND MULTIMODAL WORK.**
|
|
9062
|
+
</Category_Context>`, DEEP_HIGH_CATEGORY_PROMPT_APPEND_GPT = `<Category_Context name="deep-high">
|
|
9063
|
+
The orchestrator routed this task here because a decision in it cannot be settled from evidence alone: a trade-off, a contract other code depends on, a mechanism with no pattern to copy, or correctness that has to be argued. One goal, one deliverable, and the time to earn it. The exploration budget is generous: read every file involved, trace callers and dependencies in both directions, and fan out explore and librarian subagents in parallel for the questions a single read wave cannot answer, until you can explain the full mechanism you are about to change; an edit made before that point is the failure this category exists to prevent.
|
|
9057
9064
|
|
|
9058
9065
|
The goal is the authorization. Choose how to reach it yourself, and when it lists numbered steps or phases, deliver all of them in this turn as one task; a proposal, a plan awaiting approval, a simplified version, or a proof of concept is unfinished work. When the steps turn out to be independent problems sharing no reasoning, do the one the goal centers on and return the others as separately delegable items with what you learned. A question ends your turn and hands the task back unfinished, so decide from context, record each assumption in the final message, and stop early only for a blocker you cannot route around: a missing secret, a decision only the user can make, or three materially different attempts that all failed.
|
|
9059
9066
|
|
|
9060
|
-
Fix the cause: trace at least two levels above the symptom before settling, and prefer the change that makes the failure impossible over the guard that hides it. Depth means understanding the mechanism, so the diff stays as small as the fix allows; on greenfield work choose strong defaults and finish something you would hand to a senior engineer. Close with the delivered change, the evidence that it works, and the assumptions you made.
|
|
9067
|
+
Fix the cause: trace at least two levels above the symptom before settling, and prefer the change that makes the failure impossible over the guard that hides it. Depth means understanding the mechanism, so the diff stays as small as the fix allows; on greenfield work choose strong defaults and finish something you would hand to a senior engineer. Close with the delivered change, the evidence that it works, the decision you settled with the alternative you rejected, and the assumptions you made.
|
|
9068
|
+
</Category_Context>`, DEEP_LOW_CATEGORY_PROMPT_APPEND_GPT = `<Category_Context name="deep-low">
|
|
9069
|
+
The orchestrator routed this task here as the default deep lane: one goal, one deliverable, decisions that the code, tests, and history can settle. Read until you can explain the mechanism you are about to change, including its callers, then act; fan out explore and librarian subagents when one read wave cannot answer a question.
|
|
9070
|
+
|
|
9071
|
+
Success means:
|
|
9072
|
+
- every step or phase the goal lists is delivered in this turn as one task; a plan awaiting approval, a simplified version, or a proof of concept is unfinished work;
|
|
9073
|
+
- the change removes the cause you traced, at least two levels above the symptom, with the diff as small as that fix allows;
|
|
9074
|
+
- the final message reports the change, the evidence that it works, and each assumption you decided from context, because a question ends your turn and returns the task unfinished.
|
|
9075
|
+
|
|
9076
|
+
Escalation is a complete result. When the correct choice turns out to depend on a trade-off the brief does not settle, on a contract other packages rely on, or on an argument about invariants you cannot verify by running something, stop before editing and return \`ESCALATE: deep-high\` as the first line, followed by what you read, the decision you could not settle, and the options you saw. A confident guess through that decision costs more than the escalation.
|
|
9077
|
+
|
|
9078
|
+
Stop the moment the success criteria hold; work past them is a defect. Stop early only for a blocker you cannot route around: a missing secret, a decision only the user can make, or three materially different attempts that all failed.
|
|
9061
9079
|
</Category_Context>`, UNSPECIFIED_HIGH_CATEGORY_PROMPT_APPEND_GPT_6_ASTRA = `<Category_Context name="unspecified-high">
|
|
9062
9080
|
The orchestrator routed this task here because it spans systems or modules and fits no specialist category, so breadth of consideration is what this category buys. Before committing to an approach, survey the whole surface the change touches: every caller and consumer of what you will modify, sibling modules that implement the same pattern, the tests, docs, schemas, config, scripts, and CI that encode the current behavior, and the history of the area (git log and blame) for the reasons it is shaped this way. Fan out explore and librarian subagents in parallel when that surface is wider than one read wave covers.
|
|
9063
9081
|
|
|
@@ -9082,49 +9100,24 @@ Response format:
|
|
|
9082
9100
|
- Bottom line (2-3 sentences)
|
|
9083
9101
|
- Action plan (numbered steps)
|
|
9084
9102
|
- Risks and mitigations (if relevant)
|
|
9085
|
-
</Category_Context>`,
|
|
9086
|
-
You are working on GOAL-ORIENTED AUTONOMOUS
|
|
9087
|
-
|
|
9088
|
-
You are NOT an interactive assistant. You are an autonomous problem-solver.
|
|
9089
|
-
|
|
9090
|
-
**MUST USE \`deep\` FOR 3D GRAPHICS, COMPUTER USE, BROWSER USE, BACKEND, LOGIC, ALGORITHMS, CAPTCHA SOLVING, AND MULTIMODAL WORK.**
|
|
9091
|
-
|
|
9092
|
-
BEFORE making ANY changes:
|
|
9093
|
-
1. Silently explore the codebase extensively (5-15 minutes of reading is normal)
|
|
9094
|
-
2. Read related files, trace dependencies, understand the full context
|
|
9095
|
-
3. Build a complete mental model of the problem space
|
|
9096
|
-
4. Do not ask clarifying questions - the goal is already defined
|
|
9097
|
-
|
|
9098
|
-
You receive a GOAL. When the goal includes numbered steps or phases, treat them as one atomic task broken into sub-steps, not as separate independent tasks. Figure out HOW to achieve it yourself. Thorough research before any action.
|
|
9099
|
-
|
|
9100
|
-
Sub-steps of ONE goal = execute all steps as phases of one atomic task.
|
|
9101
|
-
Genuinely independent tasks = flag and refuse, require separate delegations.
|
|
9102
|
-
|
|
9103
|
-
Approach: explore extensively, understand deeply, then act decisively. Prefer comprehensive solutions over quick patches. If the goal is unclear, make reasonable assumptions and proceed.
|
|
9104
|
-
|
|
9105
|
-
Minimal status updates. Focus on results, not play-by-play. Report completion with summary of changes.
|
|
9106
|
-
</Category_Context>`, DEEP_CATEGORY_PROMPT_APPEND_GPT_5_5 = `<Category_Context name="deep">
|
|
9107
|
-
You are operating in DEEP mode. This is the category reserved for goal-oriented autonomous work on hairy problems that reward thorough exploration and comprehensive solutions.
|
|
9108
|
-
|
|
9109
|
-
**MUST USE \`deep\` FOR 3D GRAPHICS, COMPUTER USE, BROWSER USE, BACKEND, LOGIC, ALGORITHMS, CAPTCHA SOLVING, AND MULTIMODAL WORK.**
|
|
9110
|
-
|
|
9111
|
-
The orchestrator chose this category because the task benefits from depth over speed. You should feel empowered to spend the time needed: five to fifteen minutes of silent exploration before the first edit is normal and correct. Rushing to implementation on a deep task is a failure mode, not a feature.
|
|
9103
|
+
</Category_Context>`, DEEP_LOW_CATEGORY_PROMPT_APPEND = `<Category_Context name="deep-low">
|
|
9104
|
+
You are working on a GOAL-ORIENTED AUTONOMOUS task: one goal, one deliverable, decisions the codebase can settle.
|
|
9112
9105
|
|
|
9113
|
-
|
|
9106
|
+
Before any change, read the files involved and trace their dependencies until you can explain the mechanism you are about to modify. The goal is already defined: do not ask clarifying questions; make reasonable assumptions, record them in the final message, and proceed.
|
|
9114
9107
|
|
|
9115
|
-
|
|
9108
|
+
When the goal lists numbered steps or phases, execute all of them in this turn as one atomic task. Genuinely independent tasks bundled into one goal: flag them and do only the one the goal centers on.
|
|
9116
9109
|
|
|
9117
|
-
|
|
9110
|
+
Escalation is a complete result. When the correct choice depends on a trade-off the brief does not settle, a contract other packages rely on, or an argument about invariants you cannot verify by running something, stop before editing and return \`ESCALATE: deep-high\` as the first line, followed by what you read, the decision you could not settle, and the options you saw.
|
|
9118
9111
|
|
|
9119
|
-
|
|
9112
|
+
Prefer the fix that removes the cause over the patch that hides the symptom. Report completion with the changes made and the evidence they work.
|
|
9113
|
+
</Category_Context>`, DEEP_HIGH_CATEGORY_PROMPT_APPEND = `<Category_Context name="deep-high">
|
|
9114
|
+
You are working on a GOAL-ORIENTED AUTONOMOUS task that was escalated here because a decision in it cannot be settled from evidence alone: a trade-off, a contract other code depends on, a mechanism with no pattern to copy, or correctness that has to be argued.
|
|
9120
9115
|
|
|
9121
|
-
|
|
9116
|
+
Before any change, read the files involved and trace their dependencies until you can explain the mechanism you are about to modify. The goal is already defined: do not ask clarifying questions; make reasonable assumptions, record them in the final message, and proceed.
|
|
9122
9117
|
|
|
9123
|
-
|
|
9118
|
+
When the goal lists numbered steps or phases, execute all of them in this turn as one atomic task. Genuinely independent tasks bundled into one goal: flag them and do only the one the goal centers on.
|
|
9124
9119
|
|
|
9125
|
-
|
|
9126
|
-
|
|
9127
|
-
**Status cadence: sparse.** The user is not on the other side of this conversation; the orchestrator is, and they will synthesize your progress. Send commentary only at meaningful phase transitions (starting exploration, starting implementation, starting verification, hitting a genuine blocker). Do not narrate every tool call; silence during focused work is expected.
|
|
9120
|
+
Prefer the fix that removes the cause over the patch that hides the symptom. Report completion with the changes made, the evidence they work, and the decision you settled with the alternative you rejected.
|
|
9128
9121
|
</Category_Context>`, QUICK_CATEGORY_PROMPT_APPEND = `<Category_Context>
|
|
9129
9122
|
You are working on SMALL / QUICK tasks.
|
|
9130
9123
|
|
|
@@ -9143,10 +9136,9 @@ You are working on tasks that don't fit specific categories but require moderate
|
|
|
9143
9136
|
</Category_Context>`, UNSPECIFIED_LOW_CATEGORY_CALLER_GUIDANCE = `<Selection_Gate>Use only when no specialist category fits, effort is moderate, and scope stays within a few files/modules. Prefer any matching specialist category.</Selection_Gate>
|
|
9144
9137
|
<Caller_Warning>Provide explicit must-do steps, forbidden scope, and concrete success criteria.</Caller_Warning>`, UNSPECIFIED_HIGH_CATEGORY_PROMPT_APPEND = `<Category_Context>
|
|
9145
9138
|
You are working on tasks that don't fit specific categories but require substantial effort.
|
|
9146
|
-
</Category_Context>`, UNSPECIFIED_HIGH_CATEGORY_CALLER_GUIDANCE = `<Selection_Gate>Use only when no specialist category fits and substantial effort spans systems/modules with broad impact. Use unspecified-low for contained moderate work.</Selection_Gate>`,
|
|
9139
|
+
</Category_Context>`, UNSPECIFIED_HIGH_CATEGORY_CALLER_GUIDANCE = `<Selection_Gate>Use only when no specialist category fits and substantial effort spans systems/modules with broad impact. Use unspecified-low for contained moderate work.</Selection_Gate>`, DEEP_LOW_CATEGORY_CALLER_GUIDANCE = `<Selection_Gate>Route here when one subsystem plus its callers holds the mechanism and the evidence, once read, leaves one right answer. Wide but mechanical work belongs here or in a quick batch. When unsure, choose deep-low: a misrouted child returns \`ESCALATE: deep-high\` after one cheap attempt; re-spawn the same brief as deep-high with its findings.</Selection_Gate>`, DEEP_HIGH_CATEGORY_CALLER_GUIDANCE = `<Selection_Gate>Route here only when you can name the decision evidence cannot settle: a trade-off with no single right answer, a contract change crossing a package or process boundary, a mechanism with no in-repo pattern to copy, or correctness argued from invariants rather than observed in a test. Wide scope with easy decisions is deep-low or unspecified-high; reasoning as the deliverable is ultrabrain.</Selection_Gate>`, DEEP_LOW_GATE_MODEL = "gpt-5.6-sol", DEEP_HIGH_GATE_MODEL = "gpt-6-astra", OPENAI_CATEGORIES;
|
|
9147
9140
|
var init_openai_categories = __esm(() => {
|
|
9148
9141
|
init_types();
|
|
9149
|
-
GPT_FLAGSHIP_GATE_MODELS = ["gpt-6-astra", "gpt-5.6-sol"];
|
|
9150
9142
|
OPENAI_CATEGORIES = [
|
|
9151
9143
|
{
|
|
9152
9144
|
name: "ultrabrain",
|
|
@@ -9156,12 +9148,22 @@ var init_openai_categories = __esm(() => {
|
|
|
9156
9148
|
resolvePromptAppend: resolveUltrabrainCategoryPromptAppend
|
|
9157
9149
|
},
|
|
9158
9150
|
{
|
|
9159
|
-
name: "deep",
|
|
9151
|
+
name: "deep-low",
|
|
9152
|
+
config: { model: "openai/gpt-5.6-sol", variant: "medium" },
|
|
9153
|
+
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.",
|
|
9154
|
+
callerGuidance: DEEP_LOW_CATEGORY_CALLER_GUIDANCE,
|
|
9155
|
+
promptAppend: DEEP_LOW_CATEGORY_PROMPT_APPEND,
|
|
9156
|
+
resolvePromptAppend: resolveDeepLowCategoryPromptAppend,
|
|
9157
|
+
requiresModel: DEEP_LOW_GATE_MODEL
|
|
9158
|
+
},
|
|
9159
|
+
{
|
|
9160
|
+
name: "deep-high",
|
|
9160
9161
|
config: { model: "openai/gpt-6-astra", variant: "high" },
|
|
9161
|
-
description: "
|
|
9162
|
-
|
|
9163
|
-
|
|
9164
|
-
|
|
9162
|
+
description: "Escalation deep lane: a goal whose central decision cannot be settled from evidence alone. Same one-goal, one-deliverable contract as deep-low.",
|
|
9163
|
+
callerGuidance: DEEP_HIGH_CATEGORY_CALLER_GUIDANCE,
|
|
9164
|
+
promptAppend: DEEP_HIGH_CATEGORY_PROMPT_APPEND,
|
|
9165
|
+
resolvePromptAppend: resolveDeepHighCategoryPromptAppend,
|
|
9166
|
+
requiresModel: DEEP_HIGH_GATE_MODEL
|
|
9165
9167
|
},
|
|
9166
9168
|
{
|
|
9167
9169
|
name: "quick",
|
|
@@ -73248,6 +73250,68 @@ var init_config = __esm(() => {
|
|
|
73248
73250
|
}).strict();
|
|
73249
73251
|
});
|
|
73250
73252
|
|
|
73253
|
+
// packages/omo-config-core/src/schema/legacy-category-names.ts
|
|
73254
|
+
function canonicalCategoryName(name) {
|
|
73255
|
+
return Object.hasOwn(LEGACY_CATEGORY_NAME_ALIASES, name) ? LEGACY_CATEGORY_NAME_ALIASES[name] : name;
|
|
73256
|
+
}
|
|
73257
|
+
function isRecord9(value) {
|
|
73258
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
73259
|
+
}
|
|
73260
|
+
function joinPath(path, segment) {
|
|
73261
|
+
return [...path, segment].join(".");
|
|
73262
|
+
}
|
|
73263
|
+
function canonicalizeCategoriesRecord(categories, path, renames) {
|
|
73264
|
+
const result = {};
|
|
73265
|
+
for (const [name, definition] of Object.entries(categories)) {
|
|
73266
|
+
const canonical = canonicalCategoryName(name);
|
|
73267
|
+
if (canonical === name) {
|
|
73268
|
+
result[name] = definition;
|
|
73269
|
+
continue;
|
|
73270
|
+
}
|
|
73271
|
+
const dropped = Object.hasOwn(categories, canonical);
|
|
73272
|
+
renames.push({ canonical, dropped, legacy: name, path: joinPath(path, name) });
|
|
73273
|
+
if (!dropped)
|
|
73274
|
+
result[canonical] = definition;
|
|
73275
|
+
}
|
|
73276
|
+
return result;
|
|
73277
|
+
}
|
|
73278
|
+
function canonicalizeValue(value, path, renames) {
|
|
73279
|
+
if (Array.isArray(value)) {
|
|
73280
|
+
return value.map((entry, index) => canonicalizeValue(entry, [...path, String(index)], renames));
|
|
73281
|
+
}
|
|
73282
|
+
if (!isRecord9(value))
|
|
73283
|
+
return value;
|
|
73284
|
+
const result = {};
|
|
73285
|
+
for (const [key, entry] of Object.entries(value)) {
|
|
73286
|
+
if (key === "categories" && isRecord9(entry)) {
|
|
73287
|
+
result[key] = canonicalizeCategoriesRecord(entry, [...path, key], renames);
|
|
73288
|
+
continue;
|
|
73289
|
+
}
|
|
73290
|
+
if (key === "category" && typeof entry === "string") {
|
|
73291
|
+
const canonical = canonicalCategoryName(entry);
|
|
73292
|
+
if (canonical !== entry) {
|
|
73293
|
+
renames.push({ canonical, dropped: false, legacy: entry, path: joinPath(path, key) });
|
|
73294
|
+
}
|
|
73295
|
+
result[key] = canonical;
|
|
73296
|
+
continue;
|
|
73297
|
+
}
|
|
73298
|
+
result[key] = canonicalizeValue(entry, [...path, key], renames);
|
|
73299
|
+
}
|
|
73300
|
+
return result;
|
|
73301
|
+
}
|
|
73302
|
+
function canonicalizeLegacyCategoryNames(document) {
|
|
73303
|
+
const renames = [];
|
|
73304
|
+
const canonicalized = isRecord9(document) ? canonicalizeValue(document, [], renames) : {};
|
|
73305
|
+
return { document: canonicalized, renames };
|
|
73306
|
+
}
|
|
73307
|
+
function hasLegacyCategoryNames(document) {
|
|
73308
|
+
return canonicalizeLegacyCategoryNames(document).renames.length > 0;
|
|
73309
|
+
}
|
|
73310
|
+
var LEGACY_CATEGORY_NAME_ALIASES;
|
|
73311
|
+
var init_legacy_category_names = __esm(() => {
|
|
73312
|
+
LEGACY_CATEGORY_NAME_ALIASES = { deep: "deep-low" };
|
|
73313
|
+
});
|
|
73314
|
+
|
|
73251
73315
|
// packages/omo-config-core/src/schema/index.ts
|
|
73252
73316
|
var init_schema = __esm(() => {
|
|
73253
73317
|
init_agent();
|
|
@@ -73257,6 +73321,7 @@ var init_schema = __esm(() => {
|
|
|
73257
73321
|
init_format_on_mutation();
|
|
73258
73322
|
init_git_master();
|
|
73259
73323
|
init_harness();
|
|
73324
|
+
init_legacy_category_names();
|
|
73260
73325
|
init_memory();
|
|
73261
73326
|
init_model_catalog();
|
|
73262
73327
|
init_model_profile();
|
|
@@ -73516,21 +73581,21 @@ function hasUnsafeUnrecognizedKey(issues) {
|
|
|
73516
73581
|
function hasTamperedPrototype(value) {
|
|
73517
73582
|
if (Array.isArray(value))
|
|
73518
73583
|
return value.some((entry) => hasTamperedPrototype(entry));
|
|
73519
|
-
if (!
|
|
73584
|
+
if (!isRecord10(value))
|
|
73520
73585
|
return false;
|
|
73521
73586
|
const prototype = Object.getPrototypeOf(value);
|
|
73522
73587
|
if (prototype !== Object.prototype && prototype !== null)
|
|
73523
73588
|
return true;
|
|
73524
73589
|
return Object.values(value).some((entry) => hasTamperedPrototype(entry));
|
|
73525
73590
|
}
|
|
73526
|
-
function
|
|
73591
|
+
function isRecord10(value) {
|
|
73527
73592
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
73528
73593
|
}
|
|
73529
73594
|
function containerAt(record, path) {
|
|
73530
73595
|
let container = record;
|
|
73531
73596
|
for (const segment of path) {
|
|
73532
73597
|
const next = container[segment];
|
|
73533
|
-
if (!
|
|
73598
|
+
if (!isRecord10(next))
|
|
73534
73599
|
return null;
|
|
73535
73600
|
container = next;
|
|
73536
73601
|
}
|
|
@@ -73632,6 +73697,15 @@ function readConfigSource(path, scope, fileSystem) {
|
|
|
73632
73697
|
value: parsedRecord
|
|
73633
73698
|
};
|
|
73634
73699
|
}
|
|
73700
|
+
function legacyCategoryDiagnostic(path, renames) {
|
|
73701
|
+
const detail = renames.map((rename) => rename.dropped ? `${rename.path} ignored because ${rename.canonical} is also configured` : `${rename.path} renamed to ${rename.canonical}`).join(", ");
|
|
73702
|
+
return {
|
|
73703
|
+
kind: "deprecated-keys",
|
|
73704
|
+
message: `Deprecated category name in ${path}: ${detail}. Rename it; the alias is removed in a future release.`,
|
|
73705
|
+
path,
|
|
73706
|
+
issuePaths: renames.map((rename) => rename.path)
|
|
73707
|
+
};
|
|
73708
|
+
}
|
|
73635
73709
|
function loadOmoConfig(options = {}) {
|
|
73636
73710
|
const fileSystem = options.fileSystem ?? DEFAULT_READ_FILE_SYSTEM;
|
|
73637
73711
|
const cwd = options.cwd ?? process.cwd();
|
|
@@ -73650,8 +73724,12 @@ function loadOmoConfig(options = {}) {
|
|
|
73650
73724
|
if (loaded.diagnostic !== undefined)
|
|
73651
73725
|
diagnostics.push(loaded.diagnostic);
|
|
73652
73726
|
if (loaded.value !== undefined) {
|
|
73653
|
-
|
|
73654
|
-
|
|
73727
|
+
const canonicalized = canonicalizeLegacyCategoryNames(loaded.value);
|
|
73728
|
+
if (canonicalized.renames.length > 0) {
|
|
73729
|
+
diagnostics.push(legacyCategoryDiagnostic(candidate.path, canonicalized.renames));
|
|
73730
|
+
}
|
|
73731
|
+
layers.push({ config: canonicalized.document, source: loaded.source });
|
|
73732
|
+
merged = mergeOmoConfigRecords(merged, canonicalized.document);
|
|
73655
73733
|
}
|
|
73656
73734
|
}
|
|
73657
73735
|
const requestedProfile = resolveOmoProfileName({
|
|
@@ -74737,6 +74815,9 @@ function executePlan(input) {
|
|
|
74737
74815
|
const existingSources = plan.sources.filter((source) => fileSystem.existsSync(source.path));
|
|
74738
74816
|
const target = targetDocument(plan.targetPath, fileSystem);
|
|
74739
74817
|
const replaceTarget = plan.mode === "replace-target";
|
|
74818
|
+
if (plan.shouldRun !== undefined && !plan.shouldRun(target)) {
|
|
74819
|
+
return { diagnostics: [], journalResumed, status: "skipped" };
|
|
74820
|
+
}
|
|
74740
74821
|
if (!shouldRunMigration({
|
|
74741
74822
|
legacySourcesExist: replaceTarget ? fileSystem.existsSync(plan.targetPath) : existingSources.length > 0,
|
|
74742
74823
|
migrationId: plan.id,
|
|
@@ -76325,6 +76406,19 @@ var init_reasoning_unification = __esm(() => {
|
|
|
76325
76406
|
init_record_values();
|
|
76326
76407
|
});
|
|
76327
76408
|
|
|
76409
|
+
// packages/omo-opencode/src/config-migration/category-deep-split.ts
|
|
76410
|
+
function transformCategoryDeepSplit(document) {
|
|
76411
|
+
const { document: canonicalized, renames } = canonicalizeLegacyCategoryNames(document);
|
|
76412
|
+
return {
|
|
76413
|
+
diagnostics: renames.map((rename) => rename.dropped ? `${rename.path} removed: ${rename.canonical} is already configured` : `${rename.path} renamed to ${rename.canonical}`),
|
|
76414
|
+
document: canonicalized
|
|
76415
|
+
};
|
|
76416
|
+
}
|
|
76417
|
+
var CATEGORY_DEEP_SPLIT_MIGRATION_ID = "2026-09-category-deep-split";
|
|
76418
|
+
var init_category_deep_split = __esm(() => {
|
|
76419
|
+
init_src4();
|
|
76420
|
+
});
|
|
76421
|
+
|
|
76328
76422
|
// packages/omo-opencode/src/config-migration/migration-plans.ts
|
|
76329
76423
|
function backupTimestamp(value) {
|
|
76330
76424
|
return value ?? new Date().toISOString().replace(/[:.]/g, "-");
|
|
@@ -76391,6 +76485,18 @@ function reasoningPlan(targetPath) {
|
|
|
76391
76485
|
transform: inspect
|
|
76392
76486
|
};
|
|
76393
76487
|
}
|
|
76488
|
+
function categoryDeepSplitPlan(targetPath) {
|
|
76489
|
+
const inspect = (sources) => transformCategoryDeepSplit(sources[0]?.value);
|
|
76490
|
+
return {
|
|
76491
|
+
id: CATEGORY_DEEP_SPLIT_MIGRATION_ID,
|
|
76492
|
+
inspect,
|
|
76493
|
+
mode: "replace-target",
|
|
76494
|
+
shouldRun: hasLegacyCategoryNames,
|
|
76495
|
+
sources: [],
|
|
76496
|
+
targetPath,
|
|
76497
|
+
transform: inspect
|
|
76498
|
+
};
|
|
76499
|
+
}
|
|
76394
76500
|
function existingOmoConfigPath(directory, options) {
|
|
76395
76501
|
const fileSystem = discoveryFileSystem(options);
|
|
76396
76502
|
for (const fileName of ["omo.jsonc", "omo.json"]) {
|
|
@@ -76450,7 +76556,12 @@ function createLegacyConfigMigrationPlans(options) {
|
|
|
76450
76556
|
}
|
|
76451
76557
|
for (const plan of legacyPlans)
|
|
76452
76558
|
addReasoningTarget(plan.targetPath);
|
|
76453
|
-
|
|
76559
|
+
const inPlaceTargets = [...reasoningTargets.values()];
|
|
76560
|
+
return [
|
|
76561
|
+
...legacyPlans,
|
|
76562
|
+
...inPlaceTargets.map(reasoningPlan),
|
|
76563
|
+
...inPlaceTargets.map(categoryDeepSplitPlan)
|
|
76564
|
+
];
|
|
76454
76565
|
}
|
|
76455
76566
|
var init_migration_plans = __esm(() => {
|
|
76456
76567
|
init_discovery2();
|
|
@@ -76459,6 +76570,8 @@ var init_migration_plans = __esm(() => {
|
|
|
76459
76570
|
init_transform_config_jsonc();
|
|
76460
76571
|
init_transform_opencode();
|
|
76461
76572
|
init_reasoning_unification();
|
|
76573
|
+
init_category_deep_split();
|
|
76574
|
+
init_src4();
|
|
76462
76575
|
});
|
|
76463
76576
|
|
|
76464
76577
|
// packages/omo-opencode/src/config-migration/migration-executor.ts
|
|
@@ -77032,37 +77145,82 @@ var init_config_manager = __esm(() => {
|
|
|
77032
77145
|
init_backup_config();
|
|
77033
77146
|
});
|
|
77034
77147
|
|
|
77148
|
+
// packages/telemetry-core/src/day-claim.ts
|
|
77149
|
+
import { closeSync as closeSync3, mkdirSync as mkdirSync8, openSync as openSync3, readdirSync as readdirSync7, rmSync as rmSync2 } from "node:fs";
|
|
77150
|
+
import { join as join51 } from "node:path";
|
|
77151
|
+
function getTelemetryDayClaimFilePath(stateDir, dayUTC) {
|
|
77152
|
+
return join51(stateDir, `${CLAIM_PREFIX}${dayUTC}${CLAIM_SUFFIX}`);
|
|
77153
|
+
}
|
|
77154
|
+
function claimUtcDay(stateDir, dayUTC) {
|
|
77155
|
+
try {
|
|
77156
|
+
mkdirSync8(stateDir, { recursive: true });
|
|
77157
|
+
closeSync3(openSync3(getTelemetryDayClaimFilePath(stateDir, dayUTC), "wx"));
|
|
77158
|
+
} catch (error) {
|
|
77159
|
+
return error.code === "EEXIST" ? "already-claimed" : "unavailable";
|
|
77160
|
+
}
|
|
77161
|
+
pruneSupersededClaims(stateDir, dayUTC);
|
|
77162
|
+
return "claimed";
|
|
77163
|
+
}
|
|
77164
|
+
function pruneSupersededClaims(stateDir, dayUTC) {
|
|
77165
|
+
const currentClaim = `${CLAIM_PREFIX}${dayUTC}${CLAIM_SUFFIX}`;
|
|
77166
|
+
let entries;
|
|
77167
|
+
try {
|
|
77168
|
+
entries = readdirSync7(stateDir);
|
|
77169
|
+
} catch {
|
|
77170
|
+
return;
|
|
77171
|
+
}
|
|
77172
|
+
for (const entry of entries) {
|
|
77173
|
+
if (entry === currentClaim)
|
|
77174
|
+
continue;
|
|
77175
|
+
if (!entry.startsWith(CLAIM_PREFIX) || !entry.endsWith(CLAIM_SUFFIX))
|
|
77176
|
+
continue;
|
|
77177
|
+
try {
|
|
77178
|
+
rmSync2(join51(stateDir, entry), { force: true });
|
|
77179
|
+
} catch {}
|
|
77180
|
+
}
|
|
77181
|
+
}
|
|
77182
|
+
var CLAIM_PREFIX = "daily-active.", CLAIM_SUFFIX = ".claim";
|
|
77183
|
+
var init_day_claim = () => {};
|
|
77184
|
+
|
|
77035
77185
|
// packages/telemetry-core/src/activity-state.ts
|
|
77036
|
-
import { existsSync as existsSync24, mkdirSync as
|
|
77037
|
-
import { basename as basename8, join as
|
|
77186
|
+
import { existsSync as existsSync24, mkdirSync as mkdirSync9, readFileSync as readFileSync11 } from "node:fs";
|
|
77187
|
+
import { basename as basename8, join as join52 } from "node:path";
|
|
77038
77188
|
function resolveTelemetryStateDir(product, options = {}) {
|
|
77039
77189
|
const dataDir = resolveXdgDataDir(product.cacheDirName, {
|
|
77040
77190
|
env: options.env,
|
|
77041
77191
|
osProvider: options.osProvider
|
|
77042
77192
|
});
|
|
77043
|
-
const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined :
|
|
77193
|
+
const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined : join52(options.env.XDG_DATA_HOME, product.cacheDirName);
|
|
77044
77194
|
if (dataDir === xdgStateDir || xdgStateDir === undefined && basename8(dataDir) === product.cacheDirName) {
|
|
77045
77195
|
return dataDir;
|
|
77046
77196
|
}
|
|
77047
|
-
return
|
|
77197
|
+
return join52(dataDir, product.cacheDirName);
|
|
77048
77198
|
}
|
|
77049
77199
|
function getTelemetryActivityStateFilePath(stateDir) {
|
|
77050
|
-
return
|
|
77200
|
+
return join52(stateDir, POSTHOG_ACTIVITY_STATE_FILE);
|
|
77051
77201
|
}
|
|
77052
77202
|
function getDailyActiveCaptureState(input) {
|
|
77053
|
-
const state = readPostHogActivityState(input.stateDir, input.diagnostics);
|
|
77054
77203
|
const dayUTC = getUtcDayString(input.now ?? new Date);
|
|
77055
|
-
|
|
77056
|
-
|
|
77204
|
+
if (capturedDaysByStateDir.get(input.stateDir) === dayUTC) {
|
|
77205
|
+
return { dayUTC, captureDaily: false };
|
|
77206
|
+
}
|
|
77207
|
+
const state = readPostHogActivityState(input.stateDir, input.diagnostics);
|
|
77208
|
+
if (state.lastActiveDayUTC === dayUTC) {
|
|
77209
|
+
capturedDaysByStateDir.set(input.stateDir, dayUTC);
|
|
77210
|
+
return { dayUTC, captureDaily: false };
|
|
77211
|
+
}
|
|
77212
|
+
const claim = claimUtcDay(input.stateDir, dayUTC);
|
|
77213
|
+
capturedDaysByStateDir.set(input.stateDir, dayUTC);
|
|
77214
|
+
if (claim === "already-claimed") {
|
|
77215
|
+
return { dayUTC, captureDaily: false };
|
|
77216
|
+
}
|
|
77217
|
+
if (claim === "claimed") {
|
|
77057
77218
|
writePostHogActivityState(input.stateDir, {
|
|
77058
77219
|
...state,
|
|
77059
77220
|
lastActiveDayUTC: dayUTC
|
|
77060
77221
|
}, input.diagnostics);
|
|
77061
77222
|
}
|
|
77062
|
-
return {
|
|
77063
|
-
dayUTC,
|
|
77064
|
-
captureDaily
|
|
77065
|
-
};
|
|
77223
|
+
return { dayUTC, captureDaily: true };
|
|
77066
77224
|
}
|
|
77067
77225
|
function getUtcDayString(date) {
|
|
77068
77226
|
return date.toISOString().slice(0, 10);
|
|
@@ -77095,7 +77253,7 @@ function readPostHogActivityState(stateDir, diagnostics) {
|
|
|
77095
77253
|
function writePostHogActivityState(stateDir, nextState, diagnostics) {
|
|
77096
77254
|
const stateFilePath = getTelemetryActivityStateFilePath(stateDir);
|
|
77097
77255
|
try {
|
|
77098
|
-
|
|
77256
|
+
mkdirSync9(stateDir, { recursive: true });
|
|
77099
77257
|
writeFileAtomically(stateFilePath, `${JSON.stringify(nextState, null, 2)}
|
|
77100
77258
|
`);
|
|
77101
77259
|
} catch (error) {
|
|
@@ -77107,26 +77265,28 @@ function writePostHogActivityState(stateDir, nextState, diagnostics) {
|
|
|
77107
77265
|
});
|
|
77108
77266
|
}
|
|
77109
77267
|
}
|
|
77110
|
-
var POSTHOG_ACTIVITY_STATE_FILE = "posthog-activity.json";
|
|
77268
|
+
var POSTHOG_ACTIVITY_STATE_FILE = "posthog-activity.json", capturedDaysByStateDir;
|
|
77111
77269
|
var init_activity_state = __esm(() => {
|
|
77112
77270
|
init_atomic_write();
|
|
77113
77271
|
init_xdg_data_dir();
|
|
77272
|
+
init_day_claim();
|
|
77273
|
+
capturedDaysByStateDir = new Map;
|
|
77114
77274
|
});
|
|
77115
77275
|
|
|
77116
77276
|
// packages/telemetry-core/src/constants.ts
|
|
77117
77277
|
var DEFAULT_POSTHOG_HOST = "https://us.i.posthog.com", DEFAULT_POSTHOG_API_KEY = "phc_CFJhj5HyvA62QPhvyaUCtaq23aUfznnijg5VaaGkNk74", UNCONFIGURED_POSTHOG_API_KEY = "phc_REPLACE_ME_OMO_NATIVE";
|
|
77118
77278
|
|
|
77119
77279
|
// packages/telemetry-core/src/diagnostics.ts
|
|
77120
|
-
import { appendFileSync as appendFileSync2, existsSync as existsSync25, mkdirSync as
|
|
77121
|
-
import { join as
|
|
77280
|
+
import { appendFileSync as appendFileSync2, existsSync as existsSync25, mkdirSync as mkdirSync10, readFileSync as readFileSync12 } from "node:fs";
|
|
77281
|
+
import { join as join53 } from "node:path";
|
|
77122
77282
|
function getTelemetryDiagnosticsFilePath(diagnosticsDir) {
|
|
77123
|
-
return
|
|
77283
|
+
return join53(diagnosticsDir, DIAGNOSTICS_FILE_NAME);
|
|
77124
77284
|
}
|
|
77125
77285
|
function writeTelemetryDiagnostic(input, options) {
|
|
77126
77286
|
const now = options.now ?? new Date;
|
|
77127
77287
|
try {
|
|
77128
77288
|
cleanupTelemetryDiagnostics({ diagnosticsDir: options.diagnosticsDir, now });
|
|
77129
|
-
|
|
77289
|
+
mkdirSync10(options.diagnosticsDir, { recursive: true });
|
|
77130
77290
|
appendFileSync2(getTelemetryDiagnosticsFilePath(options.diagnosticsDir), `${JSON.stringify(toDiagnosticRecord(input, now))}
|
|
77131
77291
|
`, "utf-8");
|
|
77132
77292
|
} catch (error) {
|
|
@@ -77195,7 +77355,7 @@ function shouldRetainLine(line, cutoffMs) {
|
|
|
77195
77355
|
function parseDiagnosticLine(line) {
|
|
77196
77356
|
try {
|
|
77197
77357
|
const parsed = JSON.parse(line);
|
|
77198
|
-
if (!
|
|
77358
|
+
if (!isRecord12(parsed)) {
|
|
77199
77359
|
return null;
|
|
77200
77360
|
}
|
|
77201
77361
|
return parsed;
|
|
@@ -77206,7 +77366,7 @@ function parseDiagnosticLine(line) {
|
|
|
77206
77366
|
throw error;
|
|
77207
77367
|
}
|
|
77208
77368
|
}
|
|
77209
|
-
function
|
|
77369
|
+
function isRecord12(value) {
|
|
77210
77370
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
77211
77371
|
}
|
|
77212
77372
|
function trimToMaxBytes(lines) {
|
|
@@ -82580,7 +82740,7 @@ function coerceBool(value) {
|
|
|
82580
82740
|
function coerceString(value) {
|
|
82581
82741
|
return typeof value == "string" ? value : undefined;
|
|
82582
82742
|
}
|
|
82583
|
-
function
|
|
82743
|
+
function isRecord13(value) {
|
|
82584
82744
|
return typeof value == "object" && value !== null && !Array.isArray(value);
|
|
82585
82745
|
}
|
|
82586
82746
|
function toRfc3339(timestamp) {
|
|
@@ -82602,7 +82762,7 @@ function relocateInto(properties, key, value) {
|
|
|
82602
82762
|
properties[key] = value;
|
|
82603
82763
|
}
|
|
82604
82764
|
function buildV1Event(message) {
|
|
82605
|
-
const sourceProperties =
|
|
82765
|
+
const sourceProperties = isRecord13(message.properties) ? message.properties : {};
|
|
82606
82766
|
const properties = {
|
|
82607
82767
|
...sourceProperties
|
|
82608
82768
|
};
|
|
@@ -84632,7 +84792,7 @@ var package_default2;
|
|
|
84632
84792
|
var init_package2 = __esm(() => {
|
|
84633
84793
|
package_default2 = {
|
|
84634
84794
|
name: "@oh-my-opencode/omo-codex",
|
|
84635
|
-
version: "5.0.0-beta.
|
|
84795
|
+
version: "5.0.0-beta.80",
|
|
84636
84796
|
type: "module",
|
|
84637
84797
|
private: true,
|
|
84638
84798
|
description: "Codex harness adapter for oh-my-openagent. Vendored Codex plugin namespace (omo) + TypeScript installer + telemetry.",
|
|
@@ -85504,7 +85664,7 @@ var init_update_toasts = __esm(() => {
|
|
|
85504
85664
|
|
|
85505
85665
|
// packages/omo-opencode/src/hooks/auto-update-checker/hook/background-update-check.ts
|
|
85506
85666
|
import { existsSync as existsSync46 } from "node:fs";
|
|
85507
|
-
import { dirname as dirname30, join as
|
|
85667
|
+
import { dirname as dirname30, join as join75 } from "node:path";
|
|
85508
85668
|
import { fileURLToPath as fileURLToPath5 } from "node:url";
|
|
85509
85669
|
function defaultGetModuleHostingWorkspace() {
|
|
85510
85670
|
try {
|
|
@@ -85658,7 +85818,7 @@ var init_background_update_check = __esm(() => {
|
|
|
85658
85818
|
init_update_toasts();
|
|
85659
85819
|
defaultDeps4 = {
|
|
85660
85820
|
existsSync: existsSync46,
|
|
85661
|
-
join:
|
|
85821
|
+
join: join75,
|
|
85662
85822
|
runBunInstallWithDetails,
|
|
85663
85823
|
log: log2,
|
|
85664
85824
|
getOpenCodeCacheDir,
|
|
@@ -88080,7 +88240,7 @@ function getUnsupportedOpenCodeVersionMessage(openCodeVersion) {
|
|
|
88080
88240
|
}
|
|
88081
88241
|
|
|
88082
88242
|
// packages/omo-codex/src/install/install-codex.ts
|
|
88083
|
-
import { join as
|
|
88243
|
+
import { join as join54, resolve as resolve12 } from "node:path";
|
|
88084
88244
|
|
|
88085
88245
|
// packages/omo-codex/src/install/codex-default-role-config.ts
|
|
88086
88246
|
init_src4();
|
|
@@ -90699,10 +90859,10 @@ function readCatalogMultiAgentVersion(model, cachePath) {
|
|
|
90699
90859
|
} catch {
|
|
90700
90860
|
return null;
|
|
90701
90861
|
}
|
|
90702
|
-
if (!
|
|
90862
|
+
if (!isRecord11(cache) || !Array.isArray(cache.models))
|
|
90703
90863
|
return null;
|
|
90704
90864
|
for (const entry of cache.models) {
|
|
90705
|
-
if (!
|
|
90865
|
+
if (!isRecord11(entry))
|
|
90706
90866
|
continue;
|
|
90707
90867
|
if (entry.slug !== model && entry.id !== model)
|
|
90708
90868
|
continue;
|
|
@@ -90727,7 +90887,7 @@ function readRootModelCatalogPath(config) {
|
|
|
90727
90887
|
const single = config.match(/^\s*model_catalog_json\s*=\s*'([^']+)'/m);
|
|
90728
90888
|
return single?.[1] ?? null;
|
|
90729
90889
|
}
|
|
90730
|
-
function
|
|
90890
|
+
function isRecord11(value) {
|
|
90731
90891
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
90732
90892
|
}
|
|
90733
90893
|
function removeFeatureFlagSetting(config, featureName) {
|
|
@@ -92572,7 +92732,7 @@ async function runCodexInstaller(options = {}) {
|
|
|
92572
92732
|
const env = options.env ?? process.env;
|
|
92573
92733
|
const platform = options.platform ?? process.platform;
|
|
92574
92734
|
const repoRoot = resolve12(options.repoRoot ?? findRepoRoot({ importerDir: import.meta.dir, env }));
|
|
92575
|
-
const codexHome = resolve12(options.codexHome ?? env.CODEX_HOME ??
|
|
92735
|
+
const codexHome = resolve12(options.codexHome ?? env.CODEX_HOME ?? join54(homedir6(), ".codex"));
|
|
92576
92736
|
const projectDirectory = resolve12(options.projectDirectory ?? env.OMO_CODEX_PROJECT ?? process.cwd());
|
|
92577
92737
|
const binDir = resolveCodexInstallerBinDir({ binDir: options.binDir, codexHome, env });
|
|
92578
92738
|
const runCommand = options.runCommand ?? defaultRunCommand;
|
|
@@ -92589,9 +92749,9 @@ async function runCodexInstaller(options = {}) {
|
|
|
92589
92749
|
if (!gitBashResolution.found) {
|
|
92590
92750
|
throw new Error(gitBashResolution.installHint);
|
|
92591
92751
|
}
|
|
92592
|
-
const codexPackageRoot =
|
|
92752
|
+
const codexPackageRoot = join54(repoRoot, "packages", "omo-codex");
|
|
92593
92753
|
const marketplace = await readMarketplace(repoRoot, {
|
|
92594
|
-
marketplacePath:
|
|
92754
|
+
marketplacePath: join54(codexPackageRoot, "marketplace.json")
|
|
92595
92755
|
});
|
|
92596
92756
|
const distributionManifest = await readDistributionManifest(repoRoot);
|
|
92597
92757
|
const installed = [];
|
|
@@ -92637,7 +92797,7 @@ async function runCodexInstaller(options = {}) {
|
|
|
92637
92797
|
if (runtimeLink !== null)
|
|
92638
92798
|
log(`Linked ${runtimeLink.name} -> ${runtimeLink.target}`);
|
|
92639
92799
|
else
|
|
92640
|
-
log(`Warning: skipped the omo-agent-toolkit runtime wrapper because ${
|
|
92800
|
+
log(`Warning: skipped the omo-agent-toolkit runtime wrapper because ${join54(repoRoot, "dist", "cli", "index.js")} is missing; omo-agent-toolkit ulw-loop commands will be unavailable until a package shipping dist/cli is installed`);
|
|
92641
92801
|
}
|
|
92642
92802
|
pluginSources.push({ name: entry.name, sourcePath });
|
|
92643
92803
|
installed.push(plugin);
|
|
@@ -92704,13 +92864,13 @@ async function runCodexInstaller(options = {}) {
|
|
|
92704
92864
|
continue;
|
|
92705
92865
|
log(`Warning: deferred legacy Codex LSP daemon cleanup for v${cleanup.version}: ${cleanup.reason}`);
|
|
92706
92866
|
}
|
|
92707
|
-
const marketplaceRoot =
|
|
92867
|
+
const marketplaceRoot = join54(codexHome, "plugins", "cache", marketplace.name);
|
|
92708
92868
|
await writeCachedMarketplaceManifest({
|
|
92709
92869
|
marketplaceName: marketplace.name,
|
|
92710
92870
|
marketplaceRoot,
|
|
92711
92871
|
plugins: installed
|
|
92712
92872
|
});
|
|
92713
|
-
const configPath =
|
|
92873
|
+
const configPath = join54(codexHome, "config.toml");
|
|
92714
92874
|
await updateCodexConfig({
|
|
92715
92875
|
configPath,
|
|
92716
92876
|
repoRoot: codexPackageRoot,
|
|
@@ -92769,7 +92929,7 @@ function findRepoRootFromImporter(importerDir) {
|
|
|
92769
92929
|
for (let depth = 0;depth <= 7; depth += 1) {
|
|
92770
92930
|
if (isRepoRootWithCodexPlugin(current))
|
|
92771
92931
|
return current;
|
|
92772
|
-
for (const wrapperPackageRoot of [
|
|
92932
|
+
for (const wrapperPackageRoot of [join54(current, "node_modules", "oh-my-openagent"), join54(current, "oh-my-openagent")]) {
|
|
92773
92933
|
if (isRepoRootWithCodexPlugin(wrapperPackageRoot))
|
|
92774
92934
|
return wrapperPackageRoot;
|
|
92775
92935
|
}
|
|
@@ -92787,7 +92947,7 @@ function findRepoRoot(input) {
|
|
|
92787
92947
|
return findRepoRootFromImporter(input.importerDir);
|
|
92788
92948
|
}
|
|
92789
92949
|
function isRepoRootWithCodexPlugin(repoRoot) {
|
|
92790
|
-
return existsSync26(
|
|
92950
|
+
return existsSync26(join54(repoRoot, "packages", "omo-codex", "plugin", ".codex-plugin", "plugin.json"));
|
|
92791
92951
|
}
|
|
92792
92952
|
function codexMarketplaceSource(marketplaceRoot) {
|
|
92793
92953
|
return { sourceType: "local", source: marketplaceRoot };
|
|
@@ -92924,11 +93084,11 @@ function defaultRunCommand2(command, args) {
|
|
|
92924
93084
|
// packages/omo-codex/src/install/codex-cleanup.ts
|
|
92925
93085
|
import { lstat as lstat15, readFile as readFile25, readdir as readdir13, rm as rm13, rmdir } from "node:fs/promises";
|
|
92926
93086
|
import { homedir as homedir8 } from "node:os";
|
|
92927
|
-
import { isAbsolute as isAbsolute11, join as
|
|
93087
|
+
import { isAbsolute as isAbsolute11, join as join57, relative as relative6, resolve as resolve15 } from "node:path";
|
|
92928
93088
|
|
|
92929
93089
|
// packages/omo-codex/src/install/codex-cleanup-bins.ts
|
|
92930
93090
|
import { lstat as lstat13, readFile as readFile23, readdir as readdir12, readlink as readlink6, rm as rm12 } from "node:fs/promises";
|
|
92931
|
-
import { dirname as dirname18, isAbsolute as isAbsolute9, join as
|
|
93091
|
+
import { dirname as dirname18, isAbsolute as isAbsolute9, join as join55, resolve as resolve13 } from "node:path";
|
|
92932
93092
|
var ROOT_RUNTIME_BIN_NAME = "omo";
|
|
92933
93093
|
var MANAGED_CODEX_BIN_NAMES = new Set([
|
|
92934
93094
|
ROOT_RUNTIME_BIN_NAME,
|
|
@@ -92958,7 +93118,7 @@ async function removeManagedCodexBins(binDir, platform) {
|
|
|
92958
93118
|
const binName = managedBinNameForEntry2(entry.name, platform);
|
|
92959
93119
|
if (binName === null || !MANAGED_CODEX_BIN_NAMES.has(binName))
|
|
92960
93120
|
continue;
|
|
92961
|
-
const linkPath =
|
|
93121
|
+
const linkPath = join55(binDir, entry.name);
|
|
92962
93122
|
if (await isManagedCodexBin(linkPath, platform, binName)) {
|
|
92963
93123
|
await rm12(linkPath, { force: true });
|
|
92964
93124
|
removed.push(linkPath);
|
|
@@ -93111,7 +93271,7 @@ function nodeErrorCode5(error) {
|
|
|
93111
93271
|
}
|
|
93112
93272
|
|
|
93113
93273
|
// packages/omo-codex/src/install/codex-cleanup-safety.ts
|
|
93114
|
-
import { dirname as dirname20, isAbsolute as isAbsolute10, join as
|
|
93274
|
+
import { dirname as dirname20, isAbsolute as isAbsolute10, join as join56, relative as relative5, resolve as resolve14 } from "node:path";
|
|
93115
93275
|
function codexHomeResolvesToFilesystemRoot(codexHome) {
|
|
93116
93276
|
const resolved = resolve14(codexHome);
|
|
93117
93277
|
return dirname20(resolved) === resolved;
|
|
@@ -93128,11 +93288,11 @@ function validateManagedCleanupTarget(input) {
|
|
|
93128
93288
|
if (target === codexHome)
|
|
93129
93289
|
return skipped(input.path, "outside managed Codex cleanup scope");
|
|
93130
93290
|
const exactManagedRoots = new Set([
|
|
93131
|
-
resolve14(
|
|
93132
|
-
resolve14(
|
|
93133
|
-
resolve14(
|
|
93134
|
-
resolve14(
|
|
93135
|
-
resolve14(
|
|
93291
|
+
resolve14(join56(codexHome, "plugins", "cache", "sisyphuslabs")),
|
|
93292
|
+
resolve14(join56(codexHome, ".tmp", "marketplaces", "sisyphuslabs")),
|
|
93293
|
+
resolve14(join56(codexHome, "runtime", "ast-grep")),
|
|
93294
|
+
resolve14(join56(codexHome, "runtime", "node")),
|
|
93295
|
+
resolve14(join56(codexHome, "plugins", "data", "omo-sisyphuslabs", "bootstrap"))
|
|
93136
93296
|
]);
|
|
93137
93297
|
if (exactManagedRoots.has(target))
|
|
93138
93298
|
return null;
|
|
@@ -93162,8 +93322,8 @@ function skipped(path, reason) {
|
|
|
93162
93322
|
var INSTALLED_AGENTS_MANIFEST = ".installed-agents.json";
|
|
93163
93323
|
async function cleanupCodexLight(input = {}) {
|
|
93164
93324
|
const env = input.env ?? process.env;
|
|
93165
|
-
const codexHome = resolve15(input.codexHome ?? env.CODEX_HOME ??
|
|
93166
|
-
const configPath =
|
|
93325
|
+
const codexHome = resolve15(input.codexHome ?? env.CODEX_HOME ?? join57(homedir8(), ".codex"));
|
|
93326
|
+
const configPath = join57(codexHome, "config.toml");
|
|
93167
93327
|
const installedBinDir = await readInstalledCodexBinDir(codexHome);
|
|
93168
93328
|
const agentPaths = await collectInstalledAgentPaths(codexHome, configPath);
|
|
93169
93329
|
const configCleanup = await cleanupCodexConfig(configPath, input.now);
|
|
@@ -93217,17 +93377,17 @@ function firstConfiguredPath(...values) {
|
|
|
93217
93377
|
}
|
|
93218
93378
|
function managedGlobalStatePaths(codexHome) {
|
|
93219
93379
|
return [
|
|
93220
|
-
|
|
93221
|
-
|
|
93222
|
-
|
|
93223
|
-
|
|
93224
|
-
|
|
93380
|
+
join57(codexHome, "plugins", "cache", "sisyphuslabs"),
|
|
93381
|
+
join57(codexHome, ".tmp", "marketplaces", "sisyphuslabs"),
|
|
93382
|
+
join57(codexHome, "runtime", "ast-grep"),
|
|
93383
|
+
join57(codexHome, "runtime", "node"),
|
|
93384
|
+
join57(codexHome, "plugins", "data", "omo-sisyphuslabs", "bootstrap")
|
|
93225
93385
|
];
|
|
93226
93386
|
}
|
|
93227
93387
|
var BOOTSTRAP_DATA_GLOB_MAX_DEPTH = 5;
|
|
93228
93388
|
async function collectBootstrapDataDirsByGlob(codexHome) {
|
|
93229
93389
|
const results = [];
|
|
93230
|
-
await walkForManagedBootstrapDirs(
|
|
93390
|
+
await walkForManagedBootstrapDirs(join57(codexHome, "plugins"), 0, results);
|
|
93231
93391
|
return results;
|
|
93232
93392
|
}
|
|
93233
93393
|
async function walkForManagedBootstrapDirs(directory, depth, results) {
|
|
@@ -93239,9 +93399,9 @@ async function walkForManagedBootstrapDirs(directory, depth, results) {
|
|
|
93239
93399
|
for (const entry of entries) {
|
|
93240
93400
|
if (!entry.isDirectory())
|
|
93241
93401
|
continue;
|
|
93242
|
-
const childPath =
|
|
93402
|
+
const childPath = join57(directory, entry.name);
|
|
93243
93403
|
if (isManagedBootstrapOwnerName(entry.name)) {
|
|
93244
|
-
const bootstrapDir =
|
|
93404
|
+
const bootstrapDir = join57(childPath, "bootstrap");
|
|
93245
93405
|
if (await exists6(bootstrapDir))
|
|
93246
93406
|
results.push(bootstrapDir);
|
|
93247
93407
|
continue;
|
|
@@ -93275,7 +93435,7 @@ async function attemptRemove(path) {
|
|
|
93275
93435
|
}
|
|
93276
93436
|
async function pruneEmptyRuntimeDirBestEffort(codexHome) {
|
|
93277
93437
|
try {
|
|
93278
|
-
await rmdir(
|
|
93438
|
+
await rmdir(join57(codexHome, "runtime"));
|
|
93279
93439
|
} catch (error) {
|
|
93280
93440
|
if (isExpectedRuntimePruneFailure(error))
|
|
93281
93441
|
return;
|
|
@@ -93287,14 +93447,14 @@ function isExpectedRuntimePruneFailure(error) {
|
|
|
93287
93447
|
}
|
|
93288
93448
|
async function collectInstalledAgentPaths(codexHome, configPath) {
|
|
93289
93449
|
const manifestPaths = [
|
|
93290
|
-
|
|
93450
|
+
join57(codexHome, ".tmp", "marketplaces", "sisyphuslabs", "plugins", "omo", INSTALLED_AGENTS_MANIFEST)
|
|
93291
93451
|
];
|
|
93292
|
-
const versionRoot =
|
|
93452
|
+
const versionRoot = join57(codexHome, "plugins", "cache", "sisyphuslabs", "omo");
|
|
93293
93453
|
if (await exists6(versionRoot)) {
|
|
93294
93454
|
const entries = await readdir13(versionRoot, { withFileTypes: true });
|
|
93295
93455
|
for (const entry of entries) {
|
|
93296
93456
|
if (entry.isDirectory())
|
|
93297
|
-
manifestPaths.push(
|
|
93457
|
+
manifestPaths.push(join57(versionRoot, entry.name, INSTALLED_AGENTS_MANIFEST));
|
|
93298
93458
|
}
|
|
93299
93459
|
}
|
|
93300
93460
|
const paths = new Set;
|
|
@@ -93312,7 +93472,7 @@ async function readManagedAgentPathsFromConfig(codexHome, configPath) {
|
|
|
93312
93472
|
if (!await exists6(configPath))
|
|
93313
93473
|
return [];
|
|
93314
93474
|
const config = await readFile25(configPath, "utf8");
|
|
93315
|
-
return MANAGED_CODEX_AGENT_NAMES2.filter((agentName) => config.includes(`config_file = ${JSON.stringify(`./agents/${agentName}.toml`)}`)).map((agentName) =>
|
|
93475
|
+
return MANAGED_CODEX_AGENT_NAMES2.filter((agentName) => config.includes(`config_file = ${JSON.stringify(`./agents/${agentName}.toml`)}`)).map((agentName) => join57(codexHome, "agents", `${agentName}.toml`));
|
|
93316
93476
|
}
|
|
93317
93477
|
async function readInstalledAgentManifest(manifestPath) {
|
|
93318
93478
|
if (!await exists6(manifestPath))
|
|
@@ -93323,7 +93483,7 @@ async function readInstalledAgentManifest(manifestPath) {
|
|
|
93323
93483
|
return parsed.agents.filter((path) => typeof path === "string");
|
|
93324
93484
|
}
|
|
93325
93485
|
async function removeManifestListedAgentLinks(codexHome, paths) {
|
|
93326
|
-
const agentsDir =
|
|
93486
|
+
const agentsDir = join57(codexHome, "agents");
|
|
93327
93487
|
const removed = [];
|
|
93328
93488
|
const skipped = [];
|
|
93329
93489
|
for (const path of paths) {
|
|
@@ -93375,14 +93535,14 @@ function nodeErrorCode6(error) {
|
|
|
93375
93535
|
import { execFile as execFile3 } from "node:child_process";
|
|
93376
93536
|
import { existsSync as existsSync30 } from "node:fs";
|
|
93377
93537
|
import { homedir as homedir11 } from "node:os";
|
|
93378
|
-
import { dirname as dirname24, join as
|
|
93538
|
+
import { dirname as dirname24, join as join62, resolve as resolve19 } from "node:path";
|
|
93379
93539
|
import { fileURLToPath } from "node:url";
|
|
93380
93540
|
import { promisify as promisify2 } from "node:util";
|
|
93381
93541
|
|
|
93382
93542
|
// packages/omo-senpi/src/components/agent-home/resolve-agent-home.ts
|
|
93383
93543
|
import { existsSync as existsSync28 } from "node:fs";
|
|
93384
93544
|
import { homedir as homedir9 } from "node:os";
|
|
93385
|
-
import { join as
|
|
93545
|
+
import { join as join58, resolve as resolve16 } from "node:path";
|
|
93386
93546
|
var AGENT_DIR_ENV_NAMES = [
|
|
93387
93547
|
"OMO_CODING_AGENT_DIR",
|
|
93388
93548
|
"SENPI_CODING_AGENT_DIR",
|
|
@@ -93396,25 +93556,25 @@ function resolveAgentHome(options) {
|
|
|
93396
93556
|
if (configured)
|
|
93397
93557
|
return resolve16(configured);
|
|
93398
93558
|
}
|
|
93399
|
-
const brandedHome =
|
|
93400
|
-
const canonical =
|
|
93401
|
-
if (exists(
|
|
93559
|
+
const brandedHome = join58(homeDir, ".omo");
|
|
93560
|
+
const canonical = join58(brandedHome, "agent");
|
|
93561
|
+
if (exists(join58(canonical, AGENT_HOME_SENTINEL)))
|
|
93402
93562
|
return canonical;
|
|
93403
|
-
if (exists(
|
|
93563
|
+
if (exists(join58(brandedHome, AGENT_HOME_SENTINEL)))
|
|
93404
93564
|
return brandedHome;
|
|
93405
|
-
return
|
|
93565
|
+
return join58(homeDir, ".senpi", "agent");
|
|
93406
93566
|
}
|
|
93407
93567
|
|
|
93408
93568
|
// packages/omo-senpi/src/install/local-launcher.ts
|
|
93409
|
-
import { chmodSync as chmodSync3, existsSync as existsSync29, mkdirSync as
|
|
93569
|
+
import { chmodSync as chmodSync3, existsSync as existsSync29, mkdirSync as mkdirSync11, readFileSync as readFileSync13, rmSync as rmSync3, writeFileSync as writeFileSync6 } from "node:fs";
|
|
93410
93570
|
import { homedir as homedir10 } from "node:os";
|
|
93411
|
-
import { dirname as dirname21, join as
|
|
93571
|
+
import { dirname as dirname21, join as join59, resolve as resolve17 } from "node:path";
|
|
93412
93572
|
var MARKER = "omo-local-launcher";
|
|
93413
93573
|
function localLauncherPath(homeDir = homedir10()) {
|
|
93414
|
-
return
|
|
93574
|
+
return join59(homeDir, ".local", "bin", "omo");
|
|
93415
93575
|
}
|
|
93416
93576
|
function localLauncherCmdPath(homeDir = homedir10()) {
|
|
93417
|
-
return
|
|
93577
|
+
return join59(homeDir, ".local", "bin", "omo.cmd");
|
|
93418
93578
|
}
|
|
93419
93579
|
function renderLocalLauncher(options) {
|
|
93420
93580
|
const brand = {
|
|
@@ -93427,7 +93587,7 @@ function renderLocalLauncher(options) {
|
|
|
93427
93587
|
userAgent: "omo",
|
|
93428
93588
|
originator: "omo",
|
|
93429
93589
|
changelog: {
|
|
93430
|
-
path:
|
|
93590
|
+
path: join59(options.pluginPath, "CHANGELOG.md").replaceAll("\\", "/")
|
|
93431
93591
|
},
|
|
93432
93592
|
update: {
|
|
93433
93593
|
packageName: "omo-ai",
|
|
@@ -93465,6 +93625,9 @@ if (selfUpdate) {
|
|
|
93465
93625
|
console.log("omo is updated via npm: npm i -g omo-ai@beta")
|
|
93466
93626
|
process.exit(0)
|
|
93467
93627
|
}
|
|
93628
|
+
// windowsHide-exempt: this is the interactive foreground CLI, spawned with inherited stdio.
|
|
93629
|
+
// CREATE_NO_WINDOW would suppress the console a console-less launch needs to render the TUI,
|
|
93630
|
+
// so the launcher keeps the user's console instead of hiding it (#8501).
|
|
93468
93631
|
const child = spawn(process.execPath, [cli, "--extension", plugin, ...process.argv.slice(2)], {
|
|
93469
93632
|
env,
|
|
93470
93633
|
stdio: "inherit",
|
|
@@ -93482,7 +93645,7 @@ function installLocalLauncher(options) {
|
|
|
93482
93645
|
const path = localLauncherPath(options.homeDir);
|
|
93483
93646
|
if (existsSync29(path) && !readFileSync13(path, "utf8").includes(MARKER))
|
|
93484
93647
|
return;
|
|
93485
|
-
|
|
93648
|
+
mkdirSync11(dirname21(path), { recursive: true });
|
|
93486
93649
|
writeFileSync6(path, renderLocalLauncher(options));
|
|
93487
93650
|
chmodSync3(path, 493);
|
|
93488
93651
|
if ((options.platform ?? process.platform) === "win32") {
|
|
@@ -93497,7 +93660,7 @@ node "%~dp0omo" %*\r
|
|
|
93497
93660
|
import { createHash as createHash6 } from "node:crypto";
|
|
93498
93661
|
import { constants as constants9 } from "node:fs";
|
|
93499
93662
|
import { access as access2, readFile as readFile27, stat as stat6 } from "node:fs/promises";
|
|
93500
|
-
import { dirname as dirname23, join as
|
|
93663
|
+
import { dirname as dirname23, join as join61 } from "node:path";
|
|
93501
93664
|
|
|
93502
93665
|
// packages/memory-core/src/personas/manifest.ts
|
|
93503
93666
|
var PERSONA_ASSET_FILENAMES = {
|
|
@@ -93516,12 +93679,12 @@ var PERSONA_ASSET_FILES = [
|
|
|
93516
93679
|
// packages/omo-senpi/src/install/senpi-settings.ts
|
|
93517
93680
|
import { constants as constants8 } from "node:fs";
|
|
93518
93681
|
import { access, copyFile as copyFile3, mkdir as mkdir9, readFile as readFile26, rename as rename5, writeFile as writeFile14 } from "node:fs/promises";
|
|
93519
|
-
import { basename as basename9, dirname as dirname22, join as
|
|
93682
|
+
import { basename as basename9, dirname as dirname22, join as join60, resolve as resolve18 } from "node:path";
|
|
93520
93683
|
var OMO_SENPI_PACKAGE_NAME = "@code-yeongyu/omo-senpi";
|
|
93521
93684
|
var GENERATED_PLUGIN_BASENAME = /^omo-senpi-cli-plugin-[A-Za-z0-9]{6}$/;
|
|
93522
93685
|
var LEGACY_BUILTIN_SHADOW_PACKAGES = [
|
|
93523
|
-
|
|
93524
|
-
|
|
93686
|
+
join60("packages", "pi-goal"),
|
|
93687
|
+
join60("packages", "pi-webfetch")
|
|
93525
93688
|
];
|
|
93526
93689
|
async function readSettings(settingsPath) {
|
|
93527
93690
|
let raw;
|
|
@@ -93533,7 +93696,7 @@ async function readSettings(settingsPath) {
|
|
|
93533
93696
|
throw error;
|
|
93534
93697
|
}
|
|
93535
93698
|
const parsed = JSON.parse(raw);
|
|
93536
|
-
if (!
|
|
93699
|
+
if (!isRecord14(parsed))
|
|
93537
93700
|
throw new Error(`${settingsPath} must contain a JSON object`);
|
|
93538
93701
|
return parsed;
|
|
93539
93702
|
}
|
|
@@ -93594,13 +93757,13 @@ async function nextBackupPath(settingsPath) {
|
|
|
93594
93757
|
function timestampForBackup() {
|
|
93595
93758
|
return new Date().toISOString().replace(/[-:.]/g, "");
|
|
93596
93759
|
}
|
|
93597
|
-
function
|
|
93760
|
+
function isRecord14(value) {
|
|
93598
93761
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
93599
93762
|
}
|
|
93600
93763
|
async function readPackageName(packagePath) {
|
|
93601
93764
|
let raw;
|
|
93602
93765
|
try {
|
|
93603
|
-
raw = await readFile26(
|
|
93766
|
+
raw = await readFile26(join60(packagePath, "package.json"), "utf8");
|
|
93604
93767
|
} catch (error) {
|
|
93605
93768
|
if (isErrno(error, "ENOENT") || isErrno(error, "ENOTDIR"))
|
|
93606
93769
|
return;
|
|
@@ -93614,7 +93777,7 @@ async function readPackageName(packagePath) {
|
|
|
93614
93777
|
return;
|
|
93615
93778
|
throw error;
|
|
93616
93779
|
}
|
|
93617
|
-
return
|
|
93780
|
+
return isRecord14(parsed) && typeof parsed.name === "string" ? parsed.name : undefined;
|
|
93618
93781
|
}
|
|
93619
93782
|
async function fileExists(path) {
|
|
93620
93783
|
try {
|
|
@@ -93632,51 +93795,51 @@ function isErrno(error, code) {
|
|
|
93632
93795
|
|
|
93633
93796
|
// packages/omo-senpi/src/install/plugin-artifacts.ts
|
|
93634
93797
|
var REQUIRED_PLUGIN_ARTIFACTS = [
|
|
93635
|
-
|
|
93636
|
-
|
|
93637
|
-
|
|
93638
|
-
|
|
93639
|
-
...PERSONA_ASSET_FILES.map((filename) =>
|
|
93640
|
-
|
|
93641
|
-
|
|
93642
|
-
|
|
93643
|
-
|
|
93644
|
-
|
|
93645
|
-
|
|
93646
|
-
|
|
93647
|
-
|
|
93648
|
-
|
|
93649
|
-
|
|
93650
|
-
|
|
93651
|
-
|
|
93652
|
-
|
|
93653
|
-
|
|
93654
|
-
|
|
93655
|
-
|
|
93656
|
-
|
|
93657
|
-
|
|
93658
|
-
|
|
93659
|
-
|
|
93660
|
-
|
|
93661
|
-
|
|
93662
|
-
|
|
93663
|
-
|
|
93664
|
-
|
|
93665
|
-
|
|
93666
|
-
|
|
93667
|
-
|
|
93668
|
-
|
|
93798
|
+
join61("extensions", "omo.js"),
|
|
93799
|
+
join61("extensions", "omo-task.js"),
|
|
93800
|
+
join61("extensions", "omo-member.js"),
|
|
93801
|
+
join61("extensions", "memory-run-supervisor.mjs"),
|
|
93802
|
+
...PERSONA_ASSET_FILES.map((filename) => join61("extensions", filename)),
|
|
93803
|
+
join61("skills", "ast-grep", "SKILL.md"),
|
|
93804
|
+
join61("skills", "coding-agent-sessions", "SKILL.md"),
|
|
93805
|
+
join61("skills", "debugging", "SKILL.md"),
|
|
93806
|
+
join61("skills", "frontend", "SKILL.md"),
|
|
93807
|
+
join61("skills", "git-master", "SKILL.md"),
|
|
93808
|
+
join61("skills", "init-deep", "SKILL.md"),
|
|
93809
|
+
join61("skills", "lsp-setup", "SKILL.md"),
|
|
93810
|
+
join61("skills", "programming", "SKILL.md"),
|
|
93811
|
+
join61("skills", "refactor", "SKILL.md"),
|
|
93812
|
+
join61("skills", "remove-ai-slops", "SKILL.md"),
|
|
93813
|
+
join61("skills", "review-work", "SKILL.md"),
|
|
93814
|
+
join61("skills", "ultimate-browsing", "SKILL.md"),
|
|
93815
|
+
join61("skills", "ultrawork", "SKILL.md"),
|
|
93816
|
+
join61("skills", "ulw-execute", "SKILL.md"),
|
|
93817
|
+
join61("skills", "ulw-loop", "SKILL.md"),
|
|
93818
|
+
join61("skills", "ulw-plan", "SKILL.md"),
|
|
93819
|
+
join61("skills", "ulw-research", "SKILL.md"),
|
|
93820
|
+
join61("skills", "visual-qa", "SKILL.md"),
|
|
93821
|
+
join61("skills-conditional", "x-search", "SKILL.md"),
|
|
93822
|
+
join61("runtime", "agent-toolkit-sdk", "sdk.js"),
|
|
93823
|
+
join61("runtime", "ast-grep-mcp", "cli.js"),
|
|
93824
|
+
join61("runtime", "lsp-daemon", "dist", "cli.js"),
|
|
93825
|
+
join61("runtime", "lsp-daemon", "dist", "index.js"),
|
|
93826
|
+
join61("runtime", "lsp-daemon", "dist", "index.d.ts"),
|
|
93827
|
+
join61("runtime", "lsp-daemon", "dist", "daemon-client.js"),
|
|
93828
|
+
join61("runtime", "lsp-daemon", "dist", "daemon-client.d.ts"),
|
|
93829
|
+
join61("runtime", "lsp-daemon", "dist", "package.json"),
|
|
93830
|
+
join61("runtime", "lsp-daemon", "dist", ".omo-runtime-manifest.json"),
|
|
93831
|
+
join61("scripts", "install.mjs"),
|
|
93669
93832
|
"daemon-launch-spec.json"
|
|
93670
93833
|
];
|
|
93671
93834
|
async function ensurePluginArtifacts(context) {
|
|
93672
93835
|
if (context.allowBuild) {
|
|
93673
|
-
await context.runCommand("node", [
|
|
93674
|
-
await context.runCommand("node", [
|
|
93675
|
-
await context.runCommand("node", [
|
|
93676
|
-
await context.runCommand("node", [
|
|
93677
|
-
await context.runCommand("node", [
|
|
93678
|
-
await context.runCommand("node", [
|
|
93679
|
-
await context.runCommand("node", [
|
|
93836
|
+
await context.runCommand("node", [join61(context.pluginPath, "scripts", "build-extension.mjs")], { cwd: context.repoRoot });
|
|
93837
|
+
await context.runCommand("node", [join61("packages", "omo-codex", "plugin", "scripts", "materialize-shared-upstreams.mjs")], { cwd: context.repoRoot });
|
|
93838
|
+
await context.runCommand("node", [join61(context.pluginPath, "scripts", "sync-skills.mjs")], { cwd: context.repoRoot });
|
|
93839
|
+
await context.runCommand("node", [join61(context.pluginPath, "scripts", "build-install.mjs")], { cwd: context.repoRoot });
|
|
93840
|
+
await context.runCommand("node", [join61(context.pluginPath, "scripts", "stage-lsp-daemon-runtime.mjs")], { cwd: context.repoRoot });
|
|
93841
|
+
await context.runCommand("node", [join61(context.pluginPath, "scripts", "stage-ast-grep-mcp-runtime.mjs")], { cwd: context.repoRoot });
|
|
93842
|
+
await context.runCommand("node", [join61(context.pluginPath, "scripts", "stage-x-search-skill.mjs")], { cwd: context.repoRoot });
|
|
93680
93843
|
}
|
|
93681
93844
|
if (await hasMissingPluginArtifact(context.pluginPath)) {
|
|
93682
93845
|
throw new Error(`Packed omo-senpi plugin is missing required runtime artifacts at ${context.pluginPath}`);
|
|
@@ -93685,14 +93848,14 @@ async function ensurePluginArtifacts(context) {
|
|
|
93685
93848
|
}
|
|
93686
93849
|
async function hasMissingPluginArtifact(pluginPath) {
|
|
93687
93850
|
for (const artifact of REQUIRED_PLUGIN_ARTIFACTS) {
|
|
93688
|
-
if (!await fileExists2(
|
|
93851
|
+
if (!await fileExists2(join61(pluginPath, artifact)))
|
|
93689
93852
|
return true;
|
|
93690
93853
|
}
|
|
93691
93854
|
return false;
|
|
93692
93855
|
}
|
|
93693
93856
|
async function verifyAstGrepRuntimeIntegrity(pluginPath, platform) {
|
|
93694
|
-
const runtimeEntry =
|
|
93695
|
-
const manifestPath =
|
|
93857
|
+
const runtimeEntry = join61(pluginPath, "runtime", "ast-grep-mcp", "cli.js");
|
|
93858
|
+
const manifestPath = join61(dirname23(runtimeEntry), "manifest.json");
|
|
93696
93859
|
let runtimeStat;
|
|
93697
93860
|
try {
|
|
93698
93861
|
runtimeStat = await stat6(runtimeEntry);
|
|
@@ -93729,7 +93892,7 @@ async function verifyAstGrepRuntimeIntegrity(pluginPath, platform) {
|
|
|
93729
93892
|
}
|
|
93730
93893
|
}
|
|
93731
93894
|
function isAstGrepRuntimeManifest(value) {
|
|
93732
|
-
if (!
|
|
93895
|
+
if (!isRecord14(value))
|
|
93733
93896
|
return false;
|
|
93734
93897
|
return typeof value.sha256 === "string" && /^[a-f0-9]{64}$/.test(value.sha256) && typeof value.mode === "number" && Number.isInteger(value.mode) && typeof value.stagedAtUtc === "string" && !Number.isNaN(Date.parse(value.stagedAtUtc));
|
|
93735
93898
|
}
|
|
@@ -93767,7 +93930,7 @@ async function runSenpiInstaller(options = {}) {
|
|
|
93767
93930
|
const backupPath = await writeSettingsAtomically(context.settingsPath, settings);
|
|
93768
93931
|
const launcherPath = installLocalLauncher({
|
|
93769
93932
|
pluginPath: context.pluginPath,
|
|
93770
|
-
senpiCliPath:
|
|
93933
|
+
senpiCliPath: join62(context.repoRoot, "packages", "coding-agent", "dist", "cli.js"),
|
|
93771
93934
|
homeDir: context.homeDir
|
|
93772
93935
|
});
|
|
93773
93936
|
return {
|
|
@@ -93787,13 +93950,13 @@ function resolveInstallContext(options) {
|
|
|
93787
93950
|
const repoRoot = resolve19(options.repoRoot ?? (allowBuild ? findRepoRoot2(dirname24(fileURLToPath(import.meta.url))) : dirname24(resolve19(options.pluginPath))));
|
|
93788
93951
|
const homeDir = options.homeDir ?? env.HOME ?? homedir11();
|
|
93789
93952
|
const agentDir = resolve19(options.agentDir ?? resolveAgentHome({ env, homeDir }));
|
|
93790
|
-
const pluginPath = resolve19(options.pluginPath ??
|
|
93953
|
+
const pluginPath = resolve19(options.pluginPath ?? join62(repoRoot, "packages", "omo-senpi", "plugin"));
|
|
93791
93954
|
return {
|
|
93792
93955
|
env,
|
|
93793
93956
|
repoRoot,
|
|
93794
93957
|
agentDir,
|
|
93795
93958
|
homeDir,
|
|
93796
|
-
settingsPath:
|
|
93959
|
+
settingsPath: join62(agentDir, "settings.json"),
|
|
93797
93960
|
pluginPath,
|
|
93798
93961
|
platform: options.platform ?? process.platform,
|
|
93799
93962
|
allowBuild,
|
|
@@ -93810,7 +93973,7 @@ async function defaultRunCommand3(command, args, options) {
|
|
|
93810
93973
|
function findRepoRoot2(importerDir) {
|
|
93811
93974
|
let current = importerDir;
|
|
93812
93975
|
for (let depth = 0;depth <= 7; depth += 1) {
|
|
93813
|
-
if (fileExistsSync(
|
|
93976
|
+
if (fileExistsSync(join62(current, "packages", "omo-senpi", "plugin", "package.json")))
|
|
93814
93977
|
return current;
|
|
93815
93978
|
current = resolve19(current, "..");
|
|
93816
93979
|
}
|
|
@@ -93853,20 +94016,20 @@ async function starGitHubRepositories(platform = "both", runCommand = runGitHubS
|
|
|
93853
94016
|
init_provider_availability();
|
|
93854
94017
|
|
|
93855
94018
|
// packages/omo-opencode/src/cli/config-manager/add-tui-plugin-to-tui-config.ts
|
|
93856
|
-
import { existsSync as existsSync32, mkdirSync as
|
|
93857
|
-
import { join as
|
|
94019
|
+
import { existsSync as existsSync32, mkdirSync as mkdirSync12, readFileSync as readFileSync15 } from "node:fs";
|
|
94020
|
+
import { join as join64 } from "node:path";
|
|
93858
94021
|
|
|
93859
94022
|
// packages/omo-opencode/src/cli/doctor/checks/tui-plugin-config.ts
|
|
93860
94023
|
init_shared();
|
|
93861
94024
|
import { existsSync as existsSync31, readFileSync as readFileSync14 } from "node:fs";
|
|
93862
|
-
import { join as
|
|
94025
|
+
import { join as join63 } from "node:path";
|
|
93863
94026
|
var TUI_SUBPATH = "tui";
|
|
93864
94027
|
var TUI_EXPORT_SUBPATH = `./${TUI_SUBPATH}`;
|
|
93865
94028
|
function fileEntryPackageJsonPath(entry) {
|
|
93866
94029
|
let path = entry.slice("file:".length);
|
|
93867
94030
|
if (path.startsWith("//"))
|
|
93868
94031
|
path = path.slice(2);
|
|
93869
|
-
return
|
|
94032
|
+
return join63(path, "package.json");
|
|
93870
94033
|
}
|
|
93871
94034
|
function packageJsonExportsTui(pkgJsonPath) {
|
|
93872
94035
|
if (!existsSync31(pkgJsonPath))
|
|
@@ -93904,7 +94067,7 @@ function packageExportsTuiForServerEntry(entry) {
|
|
|
93904
94067
|
const packageName = packageNameFromServerEntry(entry);
|
|
93905
94068
|
if (packageName === null)
|
|
93906
94069
|
return null;
|
|
93907
|
-
return packageJsonExportsTui(
|
|
94070
|
+
return packageJsonExportsTui(join63(getOpenCodeConfigDir({ binary: "opencode" }), "node_modules", packageName, "package.json"));
|
|
93908
94071
|
}
|
|
93909
94072
|
function isOurFilePluginEntry(entry) {
|
|
93910
94073
|
if (typeof entry !== "string" || !entry.startsWith("file:"))
|
|
@@ -93969,7 +94132,7 @@ function detectServerPluginRegistration() {
|
|
|
93969
94132
|
}
|
|
93970
94133
|
}
|
|
93971
94134
|
function detectTuiPluginRegistration() {
|
|
93972
|
-
const tuiJsonPath =
|
|
94135
|
+
const tuiJsonPath = join63(getOpenCodeConfigDir({ binary: "opencode" }), "tui.json");
|
|
93973
94136
|
if (!existsSync31(tuiJsonPath)) {
|
|
93974
94137
|
return {
|
|
93975
94138
|
registered: false,
|
|
@@ -94125,10 +94288,10 @@ function readConfig(path) {
|
|
|
94125
94288
|
return null;
|
|
94126
94289
|
}
|
|
94127
94290
|
function readServerConfig(configDir) {
|
|
94128
|
-
const jsoncPath =
|
|
94291
|
+
const jsoncPath = join64(configDir, "opencode.jsonc");
|
|
94129
94292
|
if (existsSync32(jsoncPath))
|
|
94130
94293
|
return readConfig(jsoncPath);
|
|
94131
|
-
const jsonPath =
|
|
94294
|
+
const jsonPath = join64(configDir, "opencode.json");
|
|
94132
94295
|
if (existsSync32(jsonPath))
|
|
94133
94296
|
return readConfig(jsonPath);
|
|
94134
94297
|
return null;
|
|
@@ -94170,7 +94333,7 @@ function ensureTuiPluginEntry(opts = {}) {
|
|
|
94170
94333
|
if (!desiredEntry) {
|
|
94171
94334
|
return { changed: false, reason: "no-server-entry" };
|
|
94172
94335
|
}
|
|
94173
|
-
const tuiJsonPath =
|
|
94336
|
+
const tuiJsonPath = join64(configDir, "tui.json");
|
|
94174
94337
|
const { config, malformed } = readTuiConfig(tuiJsonPath);
|
|
94175
94338
|
if (malformed) {
|
|
94176
94339
|
return { changed: false, reason: "malformed" };
|
|
@@ -94179,14 +94342,14 @@ function ensureTuiPluginEntry(opts = {}) {
|
|
|
94179
94342
|
if (plugins.includes(desiredEntry)) {
|
|
94180
94343
|
return { changed: false, reason: "already-present" };
|
|
94181
94344
|
}
|
|
94182
|
-
|
|
94345
|
+
mkdirSync12(configDir, { recursive: true });
|
|
94183
94346
|
writeFileAtomically2(tuiJsonPath, formatConfig({ ...config, plugin: [...plugins, desiredEntry] }));
|
|
94184
94347
|
return { changed: true, reason: "added" };
|
|
94185
94348
|
}
|
|
94186
94349
|
|
|
94187
94350
|
// packages/omo-opencode/src/cli/install-ast-grep-sg.ts
|
|
94188
94351
|
import { homedir as homedir12 } from "node:os";
|
|
94189
|
-
import { join as
|
|
94352
|
+
import { join as join65 } from "node:path";
|
|
94190
94353
|
|
|
94191
94354
|
// packages/shared-skills/index.mjs
|
|
94192
94355
|
import { existsSync as existsSync33 } from "node:fs";
|
|
@@ -94208,9 +94371,9 @@ function describeResult2(result) {
|
|
|
94208
94371
|
}
|
|
94209
94372
|
async function installAstGrepForOpenCode(options = {}) {
|
|
94210
94373
|
const platform = options.platform ?? process.platform;
|
|
94211
|
-
const baseDir =
|
|
94374
|
+
const baseDir = join65(options.homeDir ?? homedir12(), ".omo");
|
|
94212
94375
|
const targetDir = astGrepRuntimeDir(baseDir, platform, options.arch ?? process.arch);
|
|
94213
|
-
const skillDir =
|
|
94376
|
+
const skillDir = join65(options.sharedSkillsRoot ?? sharedSkillsRootPath(), "ast-grep");
|
|
94214
94377
|
const installer = options.installer ?? runAstGrepSkillInstall;
|
|
94215
94378
|
try {
|
|
94216
94379
|
const result = await installer({ platform, skillDir, targetDir });
|
|
@@ -97750,7 +97913,7 @@ function migrateRalphLoopConfig(config) {
|
|
|
97750
97913
|
function validatePluginConfig(directory, environment = process.env) {
|
|
97751
97914
|
const chain = loadOmoOpenCodeConfigChain(directory, environment);
|
|
97752
97915
|
const views = chain.views.map((view) => parseConfigView(view.path, view.config));
|
|
97753
|
-
const chainMessages = chain.diagnostics.map((diagnostic) => `${shortPath(diagnostic.path)}: ${diagnostic.message}`);
|
|
97916
|
+
const chainMessages = chain.diagnostics.filter((diagnostic) => diagnostic.kind !== "deprecated-keys").map((diagnostic) => `${shortPath(diagnostic.path)}: ${diagnostic.message}`);
|
|
97754
97917
|
const messages = [...chainMessages, ...views.flatMap((view) => view.messages)];
|
|
97755
97918
|
const firstFailingView = views.find((view) => view.messages.length > 0);
|
|
97756
97919
|
const firstView = views[0];
|
|
@@ -98431,9 +98594,9 @@ function readCurrentTopLevelTask(planPath) {
|
|
|
98431
98594
|
}
|
|
98432
98595
|
// packages/boulder-state/src/storage/path.ts
|
|
98433
98596
|
import { existsSync as existsSync35 } from "node:fs";
|
|
98434
|
-
import { isAbsolute as isAbsolute12, join as
|
|
98597
|
+
import { isAbsolute as isAbsolute12, join as join66, relative as relative8, resolve as resolve20 } from "node:path";
|
|
98435
98598
|
function getBoulderFilePath(directory) {
|
|
98436
|
-
return
|
|
98599
|
+
return join66(directory, BOULDER_DIR, BOULDER_FILE);
|
|
98437
98600
|
}
|
|
98438
98601
|
function resolveTrackedPath(baseDirectory, trackedPath) {
|
|
98439
98602
|
return isAbsolute12(trackedPath) ? resolve20(trackedPath) : resolve20(baseDirectory, trackedPath);
|
|
@@ -98457,7 +98620,7 @@ function resolveBoulderPlanPathForWork(directory, work) {
|
|
|
98457
98620
|
return resolveBoulderPlanPath(directory, work);
|
|
98458
98621
|
}
|
|
98459
98622
|
// packages/boulder-state/src/storage/plan-progress.ts
|
|
98460
|
-
import { existsSync as existsSync36, readFileSync as readFileSync17, readdirSync as
|
|
98623
|
+
import { existsSync as existsSync36, readFileSync as readFileSync17, readdirSync as readdirSync8, statSync as statSync4 } from "node:fs";
|
|
98461
98624
|
function getPlanProgress(planPath) {
|
|
98462
98625
|
if (!existsSync36(planPath)) {
|
|
98463
98626
|
return { total: 0, completed: 0, isComplete: false };
|
|
@@ -98617,10 +98780,10 @@ init_state();
|
|
|
98617
98780
|
// packages/omo-opencode/src/features/run-continuation-state/constants.ts
|
|
98618
98781
|
var CONTINUATION_MARKER_DIR = ".omo/run-continuation";
|
|
98619
98782
|
// packages/omo-opencode/src/features/run-continuation-state/storage.ts
|
|
98620
|
-
import { existsSync as existsSync38, mkdirSync as
|
|
98621
|
-
import { join as
|
|
98783
|
+
import { existsSync as existsSync38, mkdirSync as mkdirSync13, readFileSync as readFileSync19, rmSync as rmSync4, writeFileSync as writeFileSync7 } from "node:fs";
|
|
98784
|
+
import { join as join67 } from "node:path";
|
|
98622
98785
|
function getMarkerPath(directory, sessionID) {
|
|
98623
|
-
return
|
|
98786
|
+
return join67(directory, CONTINUATION_MARKER_DIR, `${sessionID}.json`);
|
|
98624
98787
|
}
|
|
98625
98788
|
function readContinuationMarker(directory, sessionID) {
|
|
98626
98789
|
const markerPath = getMarkerPath(directory, sessionID);
|
|
@@ -98692,8 +98855,8 @@ async function isSessionInBoulderLineage(input) {
|
|
|
98692
98855
|
// packages/omo-opencode/src/hooks/atlas/session-last-agent.ts
|
|
98693
98856
|
init_shared();
|
|
98694
98857
|
init_compaction_marker();
|
|
98695
|
-
import { readFileSync as readFileSync20, readdirSync as
|
|
98696
|
-
import { join as
|
|
98858
|
+
import { readFileSync as readFileSync20, readdirSync as readdirSync9 } from "node:fs";
|
|
98859
|
+
import { join as join68 } from "node:path";
|
|
98697
98860
|
var defaultSessionLastAgentDeps = {
|
|
98698
98861
|
getMessageDir,
|
|
98699
98862
|
isSqliteBackend,
|
|
@@ -98751,9 +98914,9 @@ async function getLastAgentFromSession(sessionID, client, deps = {}) {
|
|
|
98751
98914
|
if (!messageDir)
|
|
98752
98915
|
return null;
|
|
98753
98916
|
try {
|
|
98754
|
-
const messages =
|
|
98917
|
+
const messages = readdirSync9(messageDir).filter((fileName) => fileName.endsWith(".json")).map((fileName) => {
|
|
98755
98918
|
try {
|
|
98756
|
-
const content = readFileSync20(
|
|
98919
|
+
const content = readFileSync20(join68(messageDir, fileName), "utf-8");
|
|
98757
98920
|
const parsed = JSON.parse(content);
|
|
98758
98921
|
return {
|
|
98759
98922
|
fileName,
|
|
@@ -98796,8 +98959,8 @@ init_agent_display_names();
|
|
|
98796
98959
|
|
|
98797
98960
|
// packages/omo-opencode/src/hooks/ralph-loop/storage.ts
|
|
98798
98961
|
init_frontmatter2();
|
|
98799
|
-
import { existsSync as existsSync39, readFileSync as readFileSync21, writeFileSync as writeFileSync8, unlinkSync as unlinkSync6, mkdirSync as
|
|
98800
|
-
import { dirname as dirname26, join as
|
|
98962
|
+
import { existsSync as existsSync39, readFileSync as readFileSync21, writeFileSync as writeFileSync8, unlinkSync as unlinkSync6, mkdirSync as mkdirSync14 } from "node:fs";
|
|
98963
|
+
import { dirname as dirname26, join as join69 } from "node:path";
|
|
98801
98964
|
|
|
98802
98965
|
// packages/omo-opencode/src/hooks/ralph-loop/constants.ts
|
|
98803
98966
|
var DEFAULT_STATE_FILE = ".omo/ralph-loop.local.md";
|
|
@@ -98806,7 +98969,7 @@ var DEFAULT_COMPLETION_PROMISE = "DONE";
|
|
|
98806
98969
|
|
|
98807
98970
|
// packages/omo-opencode/src/hooks/ralph-loop/storage.ts
|
|
98808
98971
|
function getStateFilePath(directory, customPath) {
|
|
98809
|
-
return customPath ?
|
|
98972
|
+
return customPath ? join69(directory, customPath) : join69(directory, DEFAULT_STATE_FILE);
|
|
98810
98973
|
}
|
|
98811
98974
|
function readState(directory, customPath) {
|
|
98812
98975
|
const filePath = getStateFilePath(directory, customPath);
|
|
@@ -99913,7 +100076,7 @@ init_extract_semver();
|
|
|
99913
100076
|
init_bun_which_shim();
|
|
99914
100077
|
import { existsSync as existsSync47, accessSync as accessSync4, constants as constants12 } from "node:fs";
|
|
99915
100078
|
import { homedir as homedir15 } from "node:os";
|
|
99916
|
-
import { join as
|
|
100079
|
+
import { join as join76 } from "node:path";
|
|
99917
100080
|
|
|
99918
100081
|
// packages/omo-opencode/src/cli/doctor/framework/spawn-with-timeout.ts
|
|
99919
100082
|
init_spawn_with_windows_hide();
|
|
@@ -100005,17 +100168,17 @@ function getDesktopAppPaths(platform) {
|
|
|
100005
100168
|
case "darwin":
|
|
100006
100169
|
return [
|
|
100007
100170
|
"/Applications/OpenCode.app/Contents/MacOS/OpenCode",
|
|
100008
|
-
|
|
100171
|
+
join76(home, "Applications", "OpenCode.app", "Contents", "MacOS", "OpenCode")
|
|
100009
100172
|
];
|
|
100010
100173
|
case "win32": {
|
|
100011
100174
|
const programFiles = process.env.ProgramFiles;
|
|
100012
100175
|
const localAppData = process.env.LOCALAPPDATA;
|
|
100013
100176
|
const paths = [];
|
|
100014
100177
|
if (programFiles) {
|
|
100015
|
-
paths.push(
|
|
100178
|
+
paths.push(join76(programFiles, "OpenCode", "OpenCode.exe"));
|
|
100016
100179
|
}
|
|
100017
100180
|
if (localAppData) {
|
|
100018
|
-
paths.push(
|
|
100181
|
+
paths.push(join76(localAppData, "OpenCode", "OpenCode.exe"));
|
|
100019
100182
|
}
|
|
100020
100183
|
return paths;
|
|
100021
100184
|
}
|
|
@@ -100023,8 +100186,8 @@ function getDesktopAppPaths(platform) {
|
|
|
100023
100186
|
return [
|
|
100024
100187
|
"/usr/bin/opencode",
|
|
100025
100188
|
"/usr/lib/opencode/opencode",
|
|
100026
|
-
|
|
100027
|
-
|
|
100189
|
+
join76(home, "Applications", "opencode-desktop-linux-x86_64.AppImage"),
|
|
100190
|
+
join76(home, "Applications", "opencode-desktop-linux-aarch64.AppImage")
|
|
100028
100191
|
];
|
|
100029
100192
|
default:
|
|
100030
100193
|
return [];
|
|
@@ -100056,7 +100219,7 @@ async function findOpenCodeBinary(platform = process.platform, checkExists = exi
|
|
|
100056
100219
|
const candidates = getCommandCandidates2(platform);
|
|
100057
100220
|
for (const entry of pathEnv.split(delimiter).filter(Boolean)) {
|
|
100058
100221
|
for (const command of candidates) {
|
|
100059
|
-
const fullPath =
|
|
100222
|
+
const fullPath = join76(entry, command);
|
|
100060
100223
|
if (checkExists(fullPath) && isExecutable2(fullPath)) {
|
|
100061
100224
|
return { binary: command, path: fullPath };
|
|
100062
100225
|
}
|
|
@@ -100197,25 +100360,25 @@ init_file_utils2();
|
|
|
100197
100360
|
init_checker();
|
|
100198
100361
|
init_auto_update_checker();
|
|
100199
100362
|
init_package_json_locator();
|
|
100200
|
-
import { existsSync as existsSync49, readFileSync as readFileSync30, readdirSync as
|
|
100363
|
+
import { existsSync as existsSync49, readFileSync as readFileSync30, readdirSync as readdirSync11 } from "node:fs";
|
|
100201
100364
|
import { createRequire as createRequire2 } from "node:module";
|
|
100202
100365
|
import { homedir as homedir16 } from "node:os";
|
|
100203
|
-
import { join as
|
|
100366
|
+
import { join as join77 } from "node:path";
|
|
100204
100367
|
import { fileURLToPath as fileURLToPath6 } from "node:url";
|
|
100205
100368
|
init_shared();
|
|
100206
100369
|
function getPlatformDefaultCacheDir(platform = process.platform) {
|
|
100207
100370
|
if (platform === "darwin")
|
|
100208
|
-
return
|
|
100371
|
+
return join77(homedir16(), "Library", "Caches");
|
|
100209
100372
|
if (platform === "win32")
|
|
100210
|
-
return process.env.LOCALAPPDATA ??
|
|
100211
|
-
return
|
|
100373
|
+
return process.env.LOCALAPPDATA ?? join77(homedir16(), "AppData", "Local");
|
|
100374
|
+
return join77(homedir16(), ".cache");
|
|
100212
100375
|
}
|
|
100213
100376
|
function resolveOpenCodeCacheDir() {
|
|
100214
100377
|
const xdgCacheHome = process.env.XDG_CACHE_HOME;
|
|
100215
100378
|
if (xdgCacheHome)
|
|
100216
|
-
return
|
|
100379
|
+
return join77(xdgCacheHome, "opencode");
|
|
100217
100380
|
const fromShared = getOpenCodeCacheDir();
|
|
100218
|
-
const platformDefault =
|
|
100381
|
+
const platformDefault = join77(getPlatformDefaultCacheDir(), "opencode");
|
|
100219
100382
|
if (existsSync49(fromShared) || !existsSync49(platformDefault))
|
|
100220
100383
|
return fromShared;
|
|
100221
100384
|
return platformDefault;
|
|
@@ -100247,26 +100410,26 @@ function normalizeVersion(value) {
|
|
|
100247
100410
|
function createPackageCandidates(rootDir) {
|
|
100248
100411
|
return ACCEPTED_PACKAGE_NAMES.map((packageName) => ({
|
|
100249
100412
|
packageName,
|
|
100250
|
-
installedPackagePath:
|
|
100413
|
+
installedPackagePath: join77(rootDir, "node_modules", packageName, "package.json")
|
|
100251
100414
|
}));
|
|
100252
100415
|
}
|
|
100253
100416
|
function createTaggedInstallCandidates(rootDir) {
|
|
100254
|
-
const packagesDir =
|
|
100417
|
+
const packagesDir = join77(rootDir, "packages");
|
|
100255
100418
|
if (!existsSync49(packagesDir))
|
|
100256
100419
|
return [];
|
|
100257
100420
|
const candidates = [];
|
|
100258
|
-
for (const entryName of
|
|
100421
|
+
for (const entryName of readdirSync11(packagesDir).sort()) {
|
|
100259
100422
|
const packageName = ACCEPTED_PACKAGE_NAMES.find((name) => entryName.startsWith(`${name}@`));
|
|
100260
100423
|
if (packageName === undefined)
|
|
100261
100424
|
continue;
|
|
100262
|
-
const installDir =
|
|
100425
|
+
const installDir = join77(packagesDir, entryName);
|
|
100263
100426
|
candidates.push({
|
|
100264
100427
|
cacheDir: installDir,
|
|
100265
|
-
cachePackagePath:
|
|
100428
|
+
cachePackagePath: join77(installDir, "package.json"),
|
|
100266
100429
|
packageCandidates: [
|
|
100267
100430
|
{
|
|
100268
100431
|
packageName,
|
|
100269
|
-
installedPackagePath:
|
|
100432
|
+
installedPackagePath: join77(installDir, "node_modules", packageName, "package.json")
|
|
100270
100433
|
}
|
|
100271
100434
|
]
|
|
100272
100435
|
});
|
|
@@ -100311,13 +100474,13 @@ function getLoadedPluginVersion() {
|
|
|
100311
100474
|
const candidates = [
|
|
100312
100475
|
{
|
|
100313
100476
|
cacheDir: configDir,
|
|
100314
|
-
cachePackagePath:
|
|
100477
|
+
cachePackagePath: join77(configDir, "package.json"),
|
|
100315
100478
|
packageCandidates: createPackageCandidates(configDir)
|
|
100316
100479
|
},
|
|
100317
100480
|
...createTaggedInstallCandidates(configDir),
|
|
100318
100481
|
{
|
|
100319
100482
|
cacheDir,
|
|
100320
|
-
cachePackagePath:
|
|
100483
|
+
cachePackagePath: join77(cacheDir, "package.json"),
|
|
100321
100484
|
packageCandidates: createPackageCandidates(cacheDir)
|
|
100322
100485
|
},
|
|
100323
100486
|
...createTaggedInstallCandidates(cacheDir)
|
|
@@ -100510,18 +100673,18 @@ async function checkSystem(deps = defaultDeps5) {
|
|
|
100510
100673
|
init_shared();
|
|
100511
100674
|
import { existsSync as existsSync51, readFileSync as readFileSync32 } from "node:fs";
|
|
100512
100675
|
import { homedir as homedir17 } from "node:os";
|
|
100513
|
-
import { join as
|
|
100676
|
+
import { join as join78 } from "node:path";
|
|
100514
100677
|
function getUserConfigDir2() {
|
|
100515
100678
|
const xdgConfig = process.env.XDG_CONFIG_HOME;
|
|
100516
100679
|
if (xdgConfig)
|
|
100517
|
-
return
|
|
100518
|
-
return
|
|
100680
|
+
return join78(xdgConfig, "opencode");
|
|
100681
|
+
return join78(homedir17(), ".config", "opencode");
|
|
100519
100682
|
}
|
|
100520
100683
|
function loadCustomProviderNames() {
|
|
100521
100684
|
const configDir = getUserConfigDir2();
|
|
100522
100685
|
const candidatePaths = [
|
|
100523
|
-
|
|
100524
|
-
|
|
100686
|
+
join78(configDir, "opencode.json"),
|
|
100687
|
+
join78(configDir, "opencode.jsonc")
|
|
100525
100688
|
];
|
|
100526
100689
|
for (const configPath of candidatePaths) {
|
|
100527
100690
|
if (!existsSync51(configPath))
|
|
@@ -100542,7 +100705,7 @@ function loadCustomProviderNames() {
|
|
|
100542
100705
|
return [];
|
|
100543
100706
|
}
|
|
100544
100707
|
function loadAvailableModelsFromCache() {
|
|
100545
|
-
const cacheFile =
|
|
100708
|
+
const cacheFile = join78(getOpenCodeCacheDir(), "models.json");
|
|
100546
100709
|
const customProviders = loadCustomProviderNames();
|
|
100547
100710
|
if (!existsSync51(cacheFile)) {
|
|
100548
100711
|
if (customProviders.length > 0) {
|
|
@@ -100604,7 +100767,7 @@ function loadOmoConfig2() {
|
|
|
100604
100767
|
|
|
100605
100768
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-details.ts
|
|
100606
100769
|
init_shared();
|
|
100607
|
-
import { join as
|
|
100770
|
+
import { join as join79 } from "node:path";
|
|
100608
100771
|
|
|
100609
100772
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-variant.ts
|
|
100610
100773
|
function formatModelWithVariant(model, variant) {
|
|
@@ -100646,7 +100809,7 @@ function formatCapabilityResolutionLabel(mode) {
|
|
|
100646
100809
|
}
|
|
100647
100810
|
function buildModelResolutionDetails(options) {
|
|
100648
100811
|
const details = [];
|
|
100649
|
-
const cacheFile =
|
|
100812
|
+
const cacheFile = join79(getOpenCodeCacheDir(), "models.json");
|
|
100650
100813
|
details.push("═══ Available Models (from cache) ═══");
|
|
100651
100814
|
details.push("");
|
|
100652
100815
|
if (options.available.cacheExists) {
|
|
@@ -100987,7 +101150,7 @@ init_src4();
|
|
|
100987
101150
|
init_main();
|
|
100988
101151
|
init_config_migration();
|
|
100989
101152
|
import { existsSync as existsSync52, readFileSync as readFileSync33 } from "node:fs";
|
|
100990
|
-
import { join as
|
|
101153
|
+
import { join as join80 } from "node:path";
|
|
100991
101154
|
var CANONICAL_REPLACEMENT = new Map([
|
|
100992
101155
|
["variant", "reasoning"],
|
|
100993
101156
|
["reasoningEffort", "reasoning"],
|
|
@@ -100998,14 +101161,14 @@ var CANONICAL_REPLACEMENT = new Map([
|
|
|
100998
101161
|
var MIGRATE_SUFFIX = ", or run: oh-my-openagent config migrate";
|
|
100999
101162
|
var TUNING_CONTAINERS = new Set(["agents", "categories", "models"]);
|
|
101000
101163
|
var PASSTHROUGH_CONTAINERS = new Set(["provider_options", "providerOptions"]);
|
|
101001
|
-
function
|
|
101164
|
+
function isRecord15(value) {
|
|
101002
101165
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
101003
101166
|
}
|
|
101004
101167
|
function isHarnessBlock(key) {
|
|
101005
101168
|
return key.startsWith("[") && key.endsWith("]");
|
|
101006
101169
|
}
|
|
101007
101170
|
function collectIssues(configPath, value, prefix, fixSuffix) {
|
|
101008
|
-
if (!
|
|
101171
|
+
if (!isRecord15(value))
|
|
101009
101172
|
return [];
|
|
101010
101173
|
const issues = [];
|
|
101011
101174
|
for (const [key, child] of Object.entries(value)) {
|
|
@@ -101021,7 +101184,7 @@ function collectIssues(configPath, value, prefix, fixSuffix) {
|
|
|
101021
101184
|
});
|
|
101022
101185
|
continue;
|
|
101023
101186
|
}
|
|
101024
|
-
if (!
|
|
101187
|
+
if (!isRecord15(child))
|
|
101025
101188
|
continue;
|
|
101026
101189
|
if (PASSTHROUGH_CONTAINERS.has(key))
|
|
101027
101190
|
continue;
|
|
@@ -101040,7 +101203,7 @@ function collectIssues(configPath, value, prefix, fixSuffix) {
|
|
|
101040
101203
|
return issues;
|
|
101041
101204
|
}
|
|
101042
101205
|
function migrateFixSuffix(parsed) {
|
|
101043
|
-
if (
|
|
101206
|
+
if (isRecord15(parsed) && hasMigrationMarker(parsed, REASONING_UNIFICATION_MIGRATION_ID))
|
|
101044
101207
|
return "";
|
|
101045
101208
|
return MIGRATE_SUFFIX;
|
|
101046
101209
|
}
|
|
@@ -101048,7 +101211,7 @@ function userConfigPaths() {
|
|
|
101048
101211
|
const home = process.env.HOME ?? process.env.USERPROFILE;
|
|
101049
101212
|
if (home === undefined || home.length === 0)
|
|
101050
101213
|
return [];
|
|
101051
|
-
return [
|
|
101214
|
+
return [join80(home, ".omo", "omo.jsonc"), join80(home, ".omo", "omo.json")];
|
|
101052
101215
|
}
|
|
101053
101216
|
async function checkDeprecatedReasoningKeys() {
|
|
101054
101217
|
const issues = [];
|
|
@@ -101074,25 +101237,25 @@ init_src();
|
|
|
101074
101237
|
import { existsSync as existsSync53 } from "node:fs";
|
|
101075
101238
|
import { createRequire as createRequire3 } from "node:module";
|
|
101076
101239
|
import { homedir as homedir19 } from "node:os";
|
|
101077
|
-
import { dirname as dirname31, join as
|
|
101240
|
+
import { dirname as dirname31, join as join82 } from "node:path";
|
|
101078
101241
|
|
|
101079
101242
|
// packages/omo-opencode/src/hooks/comment-checker/downloader.ts
|
|
101080
101243
|
init_binary_downloader();
|
|
101081
101244
|
init_logger2();
|
|
101082
101245
|
init_plugin_identity();
|
|
101083
|
-
import { join as
|
|
101246
|
+
import { join as join81 } from "path";
|
|
101084
101247
|
import { homedir as homedir18, tmpdir as tmpdir4 } from "os";
|
|
101085
101248
|
var DEBUG = process.env.COMMENT_CHECKER_DEBUG === "1";
|
|
101086
|
-
var DEBUG_FILE =
|
|
101249
|
+
var DEBUG_FILE = join81(tmpdir4(), "comment-checker-debug.log");
|
|
101087
101250
|
function getCacheDir2() {
|
|
101088
101251
|
if (process.platform === "win32") {
|
|
101089
101252
|
const localAppData = process.env.LOCALAPPDATA || process.env.APPDATA;
|
|
101090
|
-
const base = localAppData ||
|
|
101091
|
-
return
|
|
101253
|
+
const base = localAppData || join81(homedir18(), "AppData", "Local");
|
|
101254
|
+
return join81(base, CACHE_DIR_NAME, "bin");
|
|
101092
101255
|
}
|
|
101093
101256
|
const xdgCache = process.env.XDG_CACHE_HOME;
|
|
101094
|
-
const base = xdgCache ||
|
|
101095
|
-
return
|
|
101257
|
+
const base = xdgCache || join81(homedir18(), ".cache");
|
|
101258
|
+
return join81(base, CACHE_DIR_NAME, "bin");
|
|
101096
101259
|
}
|
|
101097
101260
|
function getBinaryName() {
|
|
101098
101261
|
return process.platform === "win32" ? "comment-checker.exe" : "comment-checker";
|
|
@@ -101142,7 +101305,7 @@ async function getBinaryVersion(binary) {
|
|
|
101142
101305
|
}
|
|
101143
101306
|
}
|
|
101144
101307
|
async function checkAstGrepCli() {
|
|
101145
|
-
const runtimeDir = astGrepRuntimeDir(
|
|
101308
|
+
const runtimeDir = astGrepRuntimeDir(join82(homedir19(), ".omo"));
|
|
101146
101309
|
const sgPath = findSgBinarySync({ runtimeDir });
|
|
101147
101310
|
if (sgPath === null) {
|
|
101148
101311
|
return {
|
|
@@ -101172,10 +101335,10 @@ function findCommentCheckerPackageBinary(baseDirOverride, resolvePackageJsonPath
|
|
|
101172
101335
|
const platformKey = `${process.platform}-${process.arch === "x64" ? "x64" : process.arch}`;
|
|
101173
101336
|
try {
|
|
101174
101337
|
const packageDir = baseDirOverride ?? dirname31(resolvePackageJsonPath());
|
|
101175
|
-
const vendorPath =
|
|
101338
|
+
const vendorPath = join82(packageDir, "vendor", platformKey, binaryName);
|
|
101176
101339
|
if (existsSync53(vendorPath))
|
|
101177
101340
|
return vendorPath;
|
|
101178
|
-
const binPath =
|
|
101341
|
+
const binPath = join82(packageDir, "bin", binaryName);
|
|
101179
101342
|
if (existsSync53(binPath))
|
|
101180
101343
|
return binPath;
|
|
101181
101344
|
} catch (error) {
|
|
@@ -101551,13 +101714,13 @@ function getInstalledLspServers(options = {}) {
|
|
|
101551
101714
|
init_shared();
|
|
101552
101715
|
import { existsSync as existsSync55, readFileSync as readFileSync35 } from "node:fs";
|
|
101553
101716
|
import { homedir as homedir20 } from "node:os";
|
|
101554
|
-
import { join as
|
|
101717
|
+
import { join as join83 } from "node:path";
|
|
101555
101718
|
var BUILTIN_MCP_SERVERS = ["websearch", "context7", "grep_app", "lsp"];
|
|
101556
101719
|
function getMcpConfigPaths() {
|
|
101557
101720
|
return [
|
|
101558
|
-
|
|
101559
|
-
|
|
101560
|
-
|
|
101721
|
+
join83(homedir20(), ".claude", ".mcp.json"),
|
|
101722
|
+
join83(process.cwd(), ".mcp.json"),
|
|
101723
|
+
join83(process.cwd(), ".claude", ".mcp.json")
|
|
101561
101724
|
];
|
|
101562
101725
|
}
|
|
101563
101726
|
function loadUserMcpConfig() {
|
|
@@ -101839,7 +102002,7 @@ init_src();
|
|
|
101839
102002
|
import { existsSync as existsSync57 } from "node:fs";
|
|
101840
102003
|
import { lstat as lstat16, readdir as readdir14, readFile as readFile28 } from "node:fs/promises";
|
|
101841
102004
|
import { homedir as homedir22 } from "node:os";
|
|
101842
|
-
import { basename as basename11, join as
|
|
102005
|
+
import { basename as basename11, join as join84, resolve as resolve23 } from "node:path";
|
|
101843
102006
|
// packages/omo-opencode/package.json
|
|
101844
102007
|
var package_default3 = {
|
|
101845
102008
|
name: "@oh-my-opencode/omo-opencode",
|
|
@@ -101905,13 +102068,13 @@ var CODEX_BIN_NAMES = [
|
|
|
101905
102068
|
"omo-git-bash-hook"
|
|
101906
102069
|
];
|
|
101907
102070
|
async function gatherCodexSummary(deps = {}) {
|
|
101908
|
-
const codexHome = resolve23(deps.codexHome ?? process.env.CODEX_HOME ??
|
|
102071
|
+
const codexHome = resolve23(deps.codexHome ?? process.env.CODEX_HOME ?? join84(homedir22(), ".codex"));
|
|
101909
102072
|
const binDir = resolveCodexInstallerBinDir({ binDir: deps.binDir, codexHome, env: process.env });
|
|
101910
102073
|
const detection = await (deps.detectCodexInstallation ?? detectCodexInstallation)();
|
|
101911
102074
|
const pluginRoot = await resolveInstalledPluginRoot(codexHome);
|
|
101912
|
-
const manifest = pluginRoot === null ? null : await readJson(
|
|
101913
|
-
const installSnapshot = pluginRoot === null ? null : await readJson(
|
|
101914
|
-
const configPath =
|
|
102075
|
+
const manifest = pluginRoot === null ? null : await readJson(join84(pluginRoot, ".codex-plugin", "plugin.json"));
|
|
102076
|
+
const installSnapshot = pluginRoot === null ? null : await readJson(join84(pluginRoot, "lazycodex-install.json"));
|
|
102077
|
+
const configPath = join84(codexHome, "config.toml");
|
|
101915
102078
|
const pluginVersion = stringField(manifest, "version");
|
|
101916
102079
|
return {
|
|
101917
102080
|
codexPath: detection.found && "path" in detection ? detection.path : null,
|
|
@@ -101968,7 +102131,7 @@ function buildCodexIssues(summary) {
|
|
|
101968
102131
|
if (summary.pluginRoot === null) {
|
|
101969
102132
|
issues.push({
|
|
101970
102133
|
title: "OMO Codex plugin is not installed",
|
|
101971
|
-
description: `Expected cached plugin at ${
|
|
102134
|
+
description: `Expected cached plugin at ${join84("plugins", "cache", MARKETPLACE_NAME, PLUGIN_NAME2, DEFAULT_PLUGIN_VERSION)} under CODEX_HOME.`,
|
|
101972
102135
|
fix: "Run: npx lazycodex-ai install",
|
|
101973
102136
|
severity: "error",
|
|
101974
102137
|
affects: ["plugin loading"]
|
|
@@ -102033,12 +102196,12 @@ function buildCodexIssues(summary) {
|
|
|
102033
102196
|
return issues;
|
|
102034
102197
|
}
|
|
102035
102198
|
async function resolveInstalledPluginRoot(codexHome) {
|
|
102036
|
-
const pluginRoot =
|
|
102199
|
+
const pluginRoot = join84(codexHome, "plugins", "cache", MARKETPLACE_NAME, PLUGIN_NAME2);
|
|
102037
102200
|
if (!existsSync57(pluginRoot))
|
|
102038
102201
|
return null;
|
|
102039
102202
|
const versions = await readdir14(pluginRoot, { withFileTypes: true });
|
|
102040
102203
|
const candidates = versions.filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort(compareVersionsDescending);
|
|
102041
|
-
return candidates.length === 0 ? null :
|
|
102204
|
+
return candidates.length === 0 ? null : join84(pluginRoot, candidates[0] ?? DEFAULT_PLUGIN_VERSION);
|
|
102042
102205
|
}
|
|
102043
102206
|
async function readCodexConfigSummary(configPath) {
|
|
102044
102207
|
if (!existsSync57(configPath)) {
|
|
@@ -102066,13 +102229,13 @@ async function readCodexConfigSummary(configPath) {
|
|
|
102066
102229
|
async function readLinkedBins(binDir) {
|
|
102067
102230
|
const linked = [];
|
|
102068
102231
|
for (const name of CODEX_BIN_NAMES) {
|
|
102069
|
-
if (await pathExists2(
|
|
102232
|
+
if (await pathExists2(join84(binDir, process.platform === "win32" ? `${name}.cmd` : name)))
|
|
102070
102233
|
linked.push(name);
|
|
102071
102234
|
}
|
|
102072
102235
|
return linked;
|
|
102073
102236
|
}
|
|
102074
102237
|
async function readLinkedAgents(codexHome) {
|
|
102075
|
-
const agentsDir =
|
|
102238
|
+
const agentsDir = join84(codexHome, "agents");
|
|
102076
102239
|
if (!existsSync57(agentsDir))
|
|
102077
102240
|
return [];
|
|
102078
102241
|
const entries = await readdir14(agentsDir, { withFileTypes: true });
|
|
@@ -102206,7 +102369,7 @@ function resolveLatestVersion(input) {
|
|
|
102206
102369
|
init_src();
|
|
102207
102370
|
import { readdir as readdir15, readFile as readFile29, stat as stat7 } from "node:fs/promises";
|
|
102208
102371
|
import { homedir as homedir23 } from "node:os";
|
|
102209
|
-
import { dirname as dirname33, isAbsolute as isAbsolute13, join as
|
|
102372
|
+
import { dirname as dirname33, isAbsolute as isAbsolute13, join as join85, relative as relative9, resolve as resolve24, sep as sep9 } from "node:path";
|
|
102210
102373
|
var CODEX_COMPONENTS_CHECK_ID = "codex-components";
|
|
102211
102374
|
var CODEX_COMPONENTS_CHECK_NAME = "codex-components";
|
|
102212
102375
|
var PLUGIN_DATA_DIR_NAME = "omo-sisyphuslabs";
|
|
@@ -102216,7 +102379,7 @@ async function checkCodexComponents(deps = {}) {
|
|
|
102216
102379
|
const env = deps.env ?? process.env;
|
|
102217
102380
|
const platform = deps.platform ?? process.platform;
|
|
102218
102381
|
const arch = deps.arch ?? process.arch;
|
|
102219
|
-
const codexHome = resolve24(deps.codexHome ?? env["CODEX_HOME"] ??
|
|
102382
|
+
const codexHome = resolve24(deps.codexHome ?? env["CODEX_HOME"] ?? join85(homedir23(), ".codex"));
|
|
102220
102383
|
const summary = await gatherCodexSummary({ ...deps, codexHome });
|
|
102221
102384
|
if (summary.pluginRoot === null) {
|
|
102222
102385
|
return {
|
|
@@ -102241,7 +102404,7 @@ async function checkCodexComponents(deps = {}) {
|
|
|
102241
102404
|
});
|
|
102242
102405
|
}
|
|
102243
102406
|
const runtimeSgDir = runtimeSgDirectory(codexHome, platform, arch);
|
|
102244
|
-
const runtimeSgPath =
|
|
102407
|
+
const runtimeSgPath = join85(runtimeSgDir, sgBinaryName(platform));
|
|
102245
102408
|
const sg = findSgBinarySync({
|
|
102246
102409
|
arch,
|
|
102247
102410
|
env,
|
|
@@ -102278,12 +102441,12 @@ async function auditBundleTargets(pluginRoot) {
|
|
|
102278
102441
|
let referencedCount = 0;
|
|
102279
102442
|
for (const manifestPath of await findManifestPaths(pluginRoot, ".mcp.json")) {
|
|
102280
102443
|
const manifest = await readJson2(manifestPath);
|
|
102281
|
-
if (manifest === null || !
|
|
102444
|
+
if (manifest === null || !isRecord16(manifest["mcpServers"]))
|
|
102282
102445
|
continue;
|
|
102283
102446
|
const manifestRoot = dirname33(manifestPath);
|
|
102284
102447
|
const isRootManifest = resolve24(manifestRoot) === resolve24(pluginRoot);
|
|
102285
102448
|
for (const server of Object.values(manifest["mcpServers"])) {
|
|
102286
|
-
if (!
|
|
102449
|
+
if (!isRecord16(server) || !Array.isArray(server["args"]))
|
|
102287
102450
|
continue;
|
|
102288
102451
|
for (const arg of server["args"]) {
|
|
102289
102452
|
if (typeof arg !== "string" || !isPluginRuntimePathArg(arg))
|
|
@@ -102353,7 +102516,7 @@ async function findManifestPaths(root, manifestName) {
|
|
|
102353
102516
|
for (const entry of entries) {
|
|
102354
102517
|
if (entry.name === "node_modules" || entry.name === ".git")
|
|
102355
102518
|
continue;
|
|
102356
|
-
const entryPath =
|
|
102519
|
+
const entryPath = join85(root, entry.name);
|
|
102357
102520
|
if (entry.isDirectory()) {
|
|
102358
102521
|
paths.push(...await findManifestPaths(entryPath, manifestName));
|
|
102359
102522
|
continue;
|
|
@@ -102369,7 +102532,7 @@ function collectHookCommands(value, commands) {
|
|
|
102369
102532
|
collectHookCommands(item, commands);
|
|
102370
102533
|
return;
|
|
102371
102534
|
}
|
|
102372
|
-
if (!
|
|
102535
|
+
if (!isRecord16(value))
|
|
102373
102536
|
return;
|
|
102374
102537
|
if (value["type"] === "command") {
|
|
102375
102538
|
if (typeof value["command"] === "string")
|
|
@@ -102397,18 +102560,18 @@ function isPluginRuntimePathArg(arg) {
|
|
|
102397
102560
|
return normalized.endsWith(".js") && normalized.includes("/dist/") && (normalized.startsWith("./") || normalized.startsWith("../") || normalized.startsWith("components/") || normalized.startsWith("/") || isAbsolute13(arg));
|
|
102398
102561
|
}
|
|
102399
102562
|
function runtimeSgDirectory(codexHome, platform, arch) {
|
|
102400
|
-
return
|
|
102563
|
+
return join85(codexHome, "runtime", "ast-grep", runtimeSlug(platform, arch));
|
|
102401
102564
|
}
|
|
102402
102565
|
function describeSgSource(sgPath, env, runtimeSgDir, platform) {
|
|
102403
102566
|
const override = env[SG_PATH_ENV_KEY]?.trim();
|
|
102404
102567
|
if (override !== undefined && override.length > 0 && sgPath === override)
|
|
102405
102568
|
return `env override ${SG_PATH_ENV_KEY}`;
|
|
102406
|
-
if (sgPath ===
|
|
102569
|
+
if (sgPath === join85(runtimeSgDir, sgBinaryName(platform)))
|
|
102407
102570
|
return "runtime dir";
|
|
102408
102571
|
return "PATH";
|
|
102409
102572
|
}
|
|
102410
102573
|
async function readBootstrapStateSummary(codexHome) {
|
|
102411
|
-
const statePath =
|
|
102574
|
+
const statePath = join85(codexHome, "plugins", "data", PLUGIN_DATA_DIR_NAME, "bootstrap", "state.json");
|
|
102412
102575
|
const raw = await readJson2(statePath);
|
|
102413
102576
|
if (raw === null)
|
|
102414
102577
|
return null;
|
|
@@ -102424,7 +102587,7 @@ function parseDegradedEntries(value) {
|
|
|
102424
102587
|
return [];
|
|
102425
102588
|
const entries = [];
|
|
102426
102589
|
for (const item of value) {
|
|
102427
|
-
if (!
|
|
102590
|
+
if (!isRecord16(item))
|
|
102428
102591
|
continue;
|
|
102429
102592
|
if (typeof item["component"] !== "string" || typeof item["reason"] !== "string")
|
|
102430
102593
|
continue;
|
|
@@ -102458,7 +102621,7 @@ function degradedDetailLines(entries) {
|
|
|
102458
102621
|
async function readJson2(path) {
|
|
102459
102622
|
try {
|
|
102460
102623
|
const parsed = JSON.parse(await readFile29(path, "utf8"));
|
|
102461
|
-
return
|
|
102624
|
+
return isRecord16(parsed) ? parsed : null;
|
|
102462
102625
|
} catch (error) {
|
|
102463
102626
|
if (error instanceof Error)
|
|
102464
102627
|
return null;
|
|
@@ -102479,7 +102642,7 @@ function normalizeRelative(root, target) {
|
|
|
102479
102642
|
function normalizePathSeparators(path) {
|
|
102480
102643
|
return path.split("\\").join("/");
|
|
102481
102644
|
}
|
|
102482
|
-
function
|
|
102645
|
+
function isRecord16(value) {
|
|
102483
102646
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
102484
102647
|
}
|
|
102485
102648
|
|
|
@@ -102487,16 +102650,16 @@ function isRecord15(value) {
|
|
|
102487
102650
|
import { existsSync as existsSync58 } from "node:fs";
|
|
102488
102651
|
import { readFile as readFile30 } from "node:fs/promises";
|
|
102489
102652
|
import { homedir as homedir24 } from "node:os";
|
|
102490
|
-
import { join as
|
|
102653
|
+
import { join as join86, resolve as resolve25 } from "node:path";
|
|
102491
102654
|
var RUNTIME_WRAPPER_MARKER2 = "OMO_GENERATED_RUNTIME_WRAPPER";
|
|
102492
102655
|
var CHECK_NAME = "codex-runtime-wrapper";
|
|
102493
102656
|
var REINSTALL_COMMAND = "npx --yes lazycodex-ai@latest install --no-tui";
|
|
102494
102657
|
async function checkCodexRuntimeWrapper(deps = {}) {
|
|
102495
|
-
const codexHome = resolve25(deps.codexHome ?? process.env.CODEX_HOME ??
|
|
102658
|
+
const codexHome = resolve25(deps.codexHome ?? process.env.CODEX_HOME ?? join86(homedir24(), ".codex"));
|
|
102496
102659
|
const binDir = resolveCodexInstallerBinDir({ binDir: deps.binDir, codexHome, env: process.env });
|
|
102497
102660
|
const platform = deps.platform ?? process.platform;
|
|
102498
|
-
const wrapperPath =
|
|
102499
|
-
const legacyWrapperPath =
|
|
102661
|
+
const wrapperPath = join86(binDir, platform === "win32" ? "omo-agent-toolkit.cmd" : "omo-agent-toolkit");
|
|
102662
|
+
const legacyWrapperPath = join86(binDir, platform === "win32" ? "omo.cmd" : "omo");
|
|
102500
102663
|
const [wrapper, legacyWrapper] = await Promise.all([readRuntimeWrapper(wrapperPath), readRuntimeWrapper(legacyWrapperPath)]);
|
|
102501
102664
|
const issues = [];
|
|
102502
102665
|
if (wrapper?.includes(RUNTIME_WRAPPER_MARKER2) === true) {
|
|
@@ -103025,19 +103188,19 @@ import { createHash as createHash7 } from "node:crypto";
|
|
|
103025
103188
|
import {
|
|
103026
103189
|
chmodSync as chmodSync5,
|
|
103027
103190
|
existsSync as existsSync61,
|
|
103028
|
-
mkdirSync as
|
|
103029
|
-
readdirSync as
|
|
103191
|
+
mkdirSync as mkdirSync16,
|
|
103192
|
+
readdirSync as readdirSync12,
|
|
103030
103193
|
readFileSync as readFileSync38,
|
|
103031
103194
|
renameSync as renameSync7,
|
|
103032
103195
|
unlinkSync as unlinkSync9,
|
|
103033
103196
|
writeFileSync as writeFileSync12
|
|
103034
103197
|
} from "node:fs";
|
|
103035
|
-
import { basename as basename12, dirname as dirname34, join as
|
|
103198
|
+
import { basename as basename12, dirname as dirname34, join as join89 } from "node:path";
|
|
103036
103199
|
|
|
103037
103200
|
// packages/mcp-client-core/src/config-dir.ts
|
|
103038
103201
|
import { existsSync as existsSync59, realpathSync as realpathSync8 } from "node:fs";
|
|
103039
103202
|
import { homedir as homedir25 } from "node:os";
|
|
103040
|
-
import { join as
|
|
103203
|
+
import { join as join87, resolve as resolve26 } from "node:path";
|
|
103041
103204
|
function resolveConfigPath2(pathValue) {
|
|
103042
103205
|
const resolvedPath = resolve26(pathValue);
|
|
103043
103206
|
if (!existsSync59(resolvedPath))
|
|
@@ -103055,13 +103218,13 @@ function getOpenCodeCliConfigDir(env = process.env) {
|
|
|
103055
103218
|
if (customConfigDir) {
|
|
103056
103219
|
return resolveConfigPath2(customConfigDir);
|
|
103057
103220
|
}
|
|
103058
|
-
const xdgConfigDir = env["XDG_CONFIG_HOME"]?.trim() ||
|
|
103059
|
-
return resolveConfigPath2(
|
|
103221
|
+
const xdgConfigDir = env["XDG_CONFIG_HOME"]?.trim() || join87(homedir25(), ".config");
|
|
103222
|
+
return resolveConfigPath2(join87(xdgConfigDir, "opencode"));
|
|
103060
103223
|
}
|
|
103061
103224
|
|
|
103062
103225
|
// packages/mcp-client-core/src/mcp-oauth/storage-index.ts
|
|
103063
103226
|
import { chmodSync as chmodSync4, existsSync as existsSync60, readFileSync as readFileSync37, renameSync as renameSync6, writeFileSync as writeFileSync11 } from "node:fs";
|
|
103064
|
-
import { join as
|
|
103227
|
+
import { join as join88 } from "node:path";
|
|
103065
103228
|
var INDEX_FILE_NAME = "index.json";
|
|
103066
103229
|
function isTokenIndex(value) {
|
|
103067
103230
|
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
@@ -103069,7 +103232,7 @@ function isTokenIndex(value) {
|
|
|
103069
103232
|
return Object.values(value).every((entry) => typeof entry === "string");
|
|
103070
103233
|
}
|
|
103071
103234
|
function getIndexPath(storageDir) {
|
|
103072
|
-
return
|
|
103235
|
+
return join88(storageDir, INDEX_FILE_NAME);
|
|
103073
103236
|
}
|
|
103074
103237
|
function readTokenIndex(storageDir) {
|
|
103075
103238
|
const indexPath = getIndexPath(storageDir);
|
|
@@ -103113,16 +103276,16 @@ function deleteTokenIndexEntry(storageDir, hash) {
|
|
|
103113
103276
|
var STORAGE_DIR_NAME = "mcp-oauth";
|
|
103114
103277
|
var LEGACY_STORAGE_FILE_NAME = "mcp-oauth.json";
|
|
103115
103278
|
function getMcpOauthStorageDir() {
|
|
103116
|
-
return
|
|
103279
|
+
return join89(getOpenCodeCliConfigDir(), STORAGE_DIR_NAME);
|
|
103117
103280
|
}
|
|
103118
103281
|
function getMcpOauthServerHash(serverHost, resource) {
|
|
103119
103282
|
return createHash7("sha256").update(buildKey(serverHost, resource)).digest("hex").slice(0, 32);
|
|
103120
103283
|
}
|
|
103121
103284
|
function getMcpOauthStoragePath(serverHost, resource) {
|
|
103122
|
-
return
|
|
103285
|
+
return join89(getMcpOauthStorageDir(), `${getMcpOauthServerHash(serverHost, resource)}.json`);
|
|
103123
103286
|
}
|
|
103124
103287
|
function getLegacyStoragePath() {
|
|
103125
|
-
return
|
|
103288
|
+
return join89(getOpenCodeCliConfigDir(), LEGACY_STORAGE_FILE_NAME);
|
|
103126
103289
|
}
|
|
103127
103290
|
function normalizeHost2(serverHost) {
|
|
103128
103291
|
let host = serverHost.trim();
|
|
@@ -103218,7 +103381,7 @@ function writeTokenFile(filePath, token) {
|
|
|
103218
103381
|
try {
|
|
103219
103382
|
const dir = dirname34(filePath);
|
|
103220
103383
|
if (!existsSync61(dir)) {
|
|
103221
|
-
|
|
103384
|
+
mkdirSync16(dir, { recursive: true });
|
|
103222
103385
|
}
|
|
103223
103386
|
const tempPath = `${filePath}.tmp.${Date.now()}`;
|
|
103224
103387
|
writeFileSync12(tempPath, JSON.stringify(token, null, 2), { encoding: "utf-8", mode: 384 });
|
|
@@ -103301,7 +103464,7 @@ function listTokensByHost(serverHost) {
|
|
|
103301
103464
|
for (const [hash, indexedKey] of Object.entries(index)) {
|
|
103302
103465
|
if (!indexedKey.startsWith(prefix))
|
|
103303
103466
|
continue;
|
|
103304
|
-
const indexedToken = readTokenFile(
|
|
103467
|
+
const indexedToken = readTokenFile(join89(getMcpOauthStorageDir(), `${hash}.json`));
|
|
103305
103468
|
if (indexedToken)
|
|
103306
103469
|
result[indexedKey] = indexedToken;
|
|
103307
103470
|
}
|
|
@@ -103313,10 +103476,10 @@ function listAllTokens() {
|
|
|
103313
103476
|
if (!existsSync61(dir))
|
|
103314
103477
|
return result;
|
|
103315
103478
|
const index = readTokenIndex(dir);
|
|
103316
|
-
for (const entry of
|
|
103479
|
+
for (const entry of readdirSync12(dir, { withFileTypes: true })) {
|
|
103317
103480
|
if (!entry.isFile() || !entry.name.endsWith(".json") || entry.name === "index.json")
|
|
103318
103481
|
continue;
|
|
103319
|
-
const token = readTokenFile(
|
|
103482
|
+
const token = readTokenFile(join89(dir, entry.name));
|
|
103320
103483
|
const hash = basename12(entry.name, ".json");
|
|
103321
103484
|
if (token)
|
|
103322
103485
|
result[index[hash] ?? hash] = token;
|