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/index.js
CHANGED
|
@@ -64,7 +64,7 @@ var package_default;
|
|
|
64
64
|
var init_package = __esm(() => {
|
|
65
65
|
package_default = {
|
|
66
66
|
name: "oh-my-opencode",
|
|
67
|
-
version: "5.0.0-beta.
|
|
67
|
+
version: "5.0.0-beta.80",
|
|
68
68
|
description: "The Best AI Agent Harness - Batteries-Included OpenCode Plugin with Multi-Model Orchestration, Parallel Background Agents, and Crafted LSP/AST Tools",
|
|
69
69
|
main: "./dist/index.js",
|
|
70
70
|
types: "dist/index.d.ts",
|
|
@@ -246,7 +246,7 @@ var init_package = __esm(() => {
|
|
|
246
246
|
zod: "^4.4.3"
|
|
247
247
|
},
|
|
248
248
|
devDependencies: {
|
|
249
|
-
"@code-yeongyu/senpi": "2026.9.
|
|
249
|
+
"@code-yeongyu/senpi": "2026.9.20",
|
|
250
250
|
"@oh-my-opencode/agents-md-core": "workspace:*",
|
|
251
251
|
"@oh-my-opencode/ast-grep-mcp": "workspace:*",
|
|
252
252
|
"@oh-my-opencode/boulder-state": "workspace:*",
|
|
@@ -285,18 +285,18 @@ var init_package = __esm(() => {
|
|
|
285
285
|
typescript: "^7.0.2"
|
|
286
286
|
},
|
|
287
287
|
optionalDependencies: {
|
|
288
|
-
"oh-my-opencode-darwin-arm64": "5.0.0-beta.
|
|
289
|
-
"oh-my-opencode-darwin-x64": "5.0.0-beta.
|
|
290
|
-
"oh-my-opencode-darwin-x64-baseline": "5.0.0-beta.
|
|
291
|
-
"oh-my-opencode-linux-arm64": "5.0.0-beta.
|
|
292
|
-
"oh-my-opencode-linux-arm64-musl": "5.0.0-beta.
|
|
293
|
-
"oh-my-opencode-linux-x64": "5.0.0-beta.
|
|
294
|
-
"oh-my-opencode-linux-x64-baseline": "5.0.0-beta.
|
|
295
|
-
"oh-my-opencode-linux-x64-musl": "5.0.0-beta.
|
|
296
|
-
"oh-my-opencode-linux-x64-musl-baseline": "5.0.0-beta.
|
|
297
|
-
"oh-my-opencode-windows-arm64": "5.0.0-beta.
|
|
298
|
-
"oh-my-opencode-windows-x64": "5.0.0-beta.
|
|
299
|
-
"oh-my-opencode-windows-x64-baseline": "5.0.0-beta.
|
|
288
|
+
"oh-my-opencode-darwin-arm64": "5.0.0-beta.80",
|
|
289
|
+
"oh-my-opencode-darwin-x64": "5.0.0-beta.80",
|
|
290
|
+
"oh-my-opencode-darwin-x64-baseline": "5.0.0-beta.80",
|
|
291
|
+
"oh-my-opencode-linux-arm64": "5.0.0-beta.80",
|
|
292
|
+
"oh-my-opencode-linux-arm64-musl": "5.0.0-beta.80",
|
|
293
|
+
"oh-my-opencode-linux-x64": "5.0.0-beta.80",
|
|
294
|
+
"oh-my-opencode-linux-x64-baseline": "5.0.0-beta.80",
|
|
295
|
+
"oh-my-opencode-linux-x64-musl": "5.0.0-beta.80",
|
|
296
|
+
"oh-my-opencode-linux-x64-musl-baseline": "5.0.0-beta.80",
|
|
297
|
+
"oh-my-opencode-windows-arm64": "5.0.0-beta.80",
|
|
298
|
+
"oh-my-opencode-windows-x64": "5.0.0-beta.80",
|
|
299
|
+
"oh-my-opencode-windows-x64-baseline": "5.0.0-beta.80"
|
|
300
300
|
},
|
|
301
301
|
overrides: {
|
|
302
302
|
"@earendil-works/pi-agent-core": "0.84.2",
|
|
@@ -7243,13 +7243,8 @@ var init_category_model_requirements = __esm(() => {
|
|
|
7243
7243
|
{ providers: ["openai", "openai-codex", "opencode"], model: "gpt-5.6-sol", variant: "max" }
|
|
7244
7244
|
]
|
|
7245
7245
|
},
|
|
7246
|
-
deep: {
|
|
7246
|
+
"deep-low": {
|
|
7247
7247
|
fallbackChain: [
|
|
7248
|
-
{
|
|
7249
|
-
providers: ["openai", "openai-codex", "github-copilot", "opencode"],
|
|
7250
|
-
model: "gpt-6-astra",
|
|
7251
|
-
variant: "high"
|
|
7252
|
-
},
|
|
7253
7248
|
{
|
|
7254
7249
|
providers: ["openai", "openai-codex", "github-copilot", "opencode"],
|
|
7255
7250
|
model: "gpt-5.6-sol",
|
|
@@ -7257,6 +7252,15 @@ var init_category_model_requirements = __esm(() => {
|
|
|
7257
7252
|
}
|
|
7258
7253
|
]
|
|
7259
7254
|
},
|
|
7255
|
+
"deep-high": {
|
|
7256
|
+
fallbackChain: [
|
|
7257
|
+
{
|
|
7258
|
+
providers: ["openai", "openai-codex", "github-copilot", "opencode"],
|
|
7259
|
+
model: "gpt-6-astra",
|
|
7260
|
+
variant: "high"
|
|
7261
|
+
}
|
|
7262
|
+
]
|
|
7263
|
+
},
|
|
7260
7264
|
artistry: {
|
|
7261
7265
|
fallbackChain: [
|
|
7262
7266
|
{
|
|
@@ -7343,12 +7347,17 @@ var init_category_model_requirements = __esm(() => {
|
|
|
7343
7347
|
{
|
|
7344
7348
|
providers: ["anthropic", "anthropic-api", "github-copilot", "opencode"],
|
|
7345
7349
|
model: "claude-fable-5-1",
|
|
7346
|
-
variant: "
|
|
7350
|
+
variant: "low"
|
|
7347
7351
|
},
|
|
7348
7352
|
{
|
|
7349
7353
|
providers: ["kimi-for-coding", "moonshotai", "opencode-go", "opencode"],
|
|
7350
7354
|
model: "kimi-k3",
|
|
7351
|
-
variant: "
|
|
7355
|
+
variant: "low"
|
|
7356
|
+
},
|
|
7357
|
+
{
|
|
7358
|
+
providers: ["anthropic", "anthropic-api", "github-copilot", "opencode"],
|
|
7359
|
+
model: "claude-opus-4-6",
|
|
7360
|
+
variant: "low"
|
|
7352
7361
|
}
|
|
7353
7362
|
]
|
|
7354
7363
|
}
|
|
@@ -8991,7 +9000,7 @@ var init_kimi_categories = __esm(() => {
|
|
|
8991
9000
|
KIMI_CATEGORIES = [
|
|
8992
9001
|
{
|
|
8993
9002
|
name: "writing",
|
|
8994
|
-
config: { model: "anthropic/claude-fable-5-1", variant: "
|
|
9003
|
+
config: { model: "anthropic/claude-fable-5-1", variant: "low" },
|
|
8995
9004
|
description: "Documentation, prose, technical writing",
|
|
8996
9005
|
promptAppend: WRITING_CATEGORY_PROMPT_APPEND
|
|
8997
9006
|
}
|
|
@@ -9017,20 +9026,20 @@ function isGpt6Model(model) {
|
|
|
9017
9026
|
var init_types = () => {};
|
|
9018
9027
|
|
|
9019
9028
|
// packages/omo-opencode/src/tools/delegate-task/openai-categories.ts
|
|
9029
|
+
function isGptDeepLaneModel(model) {
|
|
9030
|
+
return model !== undefined && (isGpt6Model(model) || isGpt5_5Model(model) || isGpt5_6Model(model));
|
|
9031
|
+
}
|
|
9020
9032
|
function resolveUltrabrainCategoryPromptAppend(model) {
|
|
9021
9033
|
if (model && isGpt6Model(model)) {
|
|
9022
9034
|
return ULTRABRAIN_CATEGORY_PROMPT_APPEND_GPT_6_ASTRA;
|
|
9023
9035
|
}
|
|
9024
9036
|
return ULTRABRAIN_CATEGORY_PROMPT_APPEND;
|
|
9025
9037
|
}
|
|
9026
|
-
function
|
|
9027
|
-
|
|
9028
|
-
|
|
9029
|
-
|
|
9030
|
-
|
|
9031
|
-
return DEEP_CATEGORY_PROMPT_APPEND_GPT_5_5;
|
|
9032
|
-
}
|
|
9033
|
-
return DEEP_CATEGORY_PROMPT_APPEND;
|
|
9038
|
+
function resolveDeepLowCategoryPromptAppend(model) {
|
|
9039
|
+
return isGptDeepLaneModel(model) ? DEEP_LOW_CATEGORY_PROMPT_APPEND_GPT : DEEP_LOW_CATEGORY_PROMPT_APPEND;
|
|
9040
|
+
}
|
|
9041
|
+
function resolveDeepHighCategoryPromptAppend(model) {
|
|
9042
|
+
return isGptDeepLaneModel(model) ? DEEP_HIGH_CATEGORY_PROMPT_APPEND_GPT : DEEP_HIGH_CATEGORY_PROMPT_APPEND;
|
|
9034
9043
|
}
|
|
9035
9044
|
function resolveUnspecifiedHighCategoryPromptAppend(model) {
|
|
9036
9045
|
if (model && isGpt6Model(model)) {
|
|
@@ -9049,14 +9058,23 @@ Success means:
|
|
|
9049
9058
|
- one decision-complete recommendation, actionable without a follow-up question.
|
|
9050
9059
|
|
|
9051
9060
|
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.
|
|
9052
|
-
</Category_Context>`,
|
|
9053
|
-
The orchestrator routed this task here
|
|
9054
|
-
|
|
9055
|
-
**MUST USE \`deep\` FOR 3D GRAPHICS, COMPUTER USE, BROWSER USE, BACKEND, LOGIC, ALGORITHMS, CAPTCHA SOLVING, AND MULTIMODAL WORK.**
|
|
9061
|
+
</Category_Context>`, DEEP_HIGH_CATEGORY_PROMPT_APPEND_GPT = `<Category_Context name="deep-high">
|
|
9062
|
+
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.
|
|
9056
9063
|
|
|
9057
9064
|
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.
|
|
9058
9065
|
|
|
9059
|
-
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.
|
|
9066
|
+
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.
|
|
9067
|
+
</Category_Context>`, DEEP_LOW_CATEGORY_PROMPT_APPEND_GPT = `<Category_Context name="deep-low">
|
|
9068
|
+
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.
|
|
9069
|
+
|
|
9070
|
+
Success means:
|
|
9071
|
+
- 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;
|
|
9072
|
+
- the change removes the cause you traced, at least two levels above the symptom, with the diff as small as that fix allows;
|
|
9073
|
+
- 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.
|
|
9074
|
+
|
|
9075
|
+
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.
|
|
9076
|
+
|
|
9077
|
+
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.
|
|
9060
9078
|
</Category_Context>`, UNSPECIFIED_HIGH_CATEGORY_PROMPT_APPEND_GPT_6_ASTRA = `<Category_Context name="unspecified-high">
|
|
9061
9079
|
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.
|
|
9062
9080
|
|
|
@@ -9081,49 +9099,24 @@ Response format:
|
|
|
9081
9099
|
- Bottom line (2-3 sentences)
|
|
9082
9100
|
- Action plan (numbered steps)
|
|
9083
9101
|
- Risks and mitigations (if relevant)
|
|
9084
|
-
</Category_Context>`,
|
|
9085
|
-
You are working on GOAL-ORIENTED AUTONOMOUS
|
|
9086
|
-
|
|
9087
|
-
You are NOT an interactive assistant. You are an autonomous problem-solver.
|
|
9088
|
-
|
|
9089
|
-
**MUST USE \`deep\` FOR 3D GRAPHICS, COMPUTER USE, BROWSER USE, BACKEND, LOGIC, ALGORITHMS, CAPTCHA SOLVING, AND MULTIMODAL WORK.**
|
|
9090
|
-
|
|
9091
|
-
BEFORE making ANY changes:
|
|
9092
|
-
1. Silently explore the codebase extensively (5-15 minutes of reading is normal)
|
|
9093
|
-
2. Read related files, trace dependencies, understand the full context
|
|
9094
|
-
3. Build a complete mental model of the problem space
|
|
9095
|
-
4. Do not ask clarifying questions - the goal is already defined
|
|
9096
|
-
|
|
9097
|
-
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.
|
|
9098
|
-
|
|
9099
|
-
Sub-steps of ONE goal = execute all steps as phases of one atomic task.
|
|
9100
|
-
Genuinely independent tasks = flag and refuse, require separate delegations.
|
|
9101
|
-
|
|
9102
|
-
Approach: explore extensively, understand deeply, then act decisively. Prefer comprehensive solutions over quick patches. If the goal is unclear, make reasonable assumptions and proceed.
|
|
9103
|
-
|
|
9104
|
-
Minimal status updates. Focus on results, not play-by-play. Report completion with summary of changes.
|
|
9105
|
-
</Category_Context>`, DEEP_CATEGORY_PROMPT_APPEND_GPT_5_5 = `<Category_Context name="deep">
|
|
9106
|
-
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.
|
|
9107
|
-
|
|
9108
|
-
**MUST USE \`deep\` FOR 3D GRAPHICS, COMPUTER USE, BROWSER USE, BACKEND, LOGIC, ALGORITHMS, CAPTCHA SOLVING, AND MULTIMODAL WORK.**
|
|
9109
|
-
|
|
9110
|
-
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.
|
|
9102
|
+
</Category_Context>`, DEEP_LOW_CATEGORY_PROMPT_APPEND = `<Category_Context name="deep-low">
|
|
9103
|
+
You are working on a GOAL-ORIENTED AUTONOMOUS task: one goal, one deliverable, decisions the codebase can settle.
|
|
9111
9104
|
|
|
9112
|
-
|
|
9105
|
+
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.
|
|
9113
9106
|
|
|
9114
|
-
|
|
9107
|
+
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.
|
|
9115
9108
|
|
|
9116
|
-
|
|
9109
|
+
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.
|
|
9117
9110
|
|
|
9118
|
-
|
|
9111
|
+
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.
|
|
9112
|
+
</Category_Context>`, DEEP_HIGH_CATEGORY_PROMPT_APPEND = `<Category_Context name="deep-high">
|
|
9113
|
+
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.
|
|
9119
9114
|
|
|
9120
|
-
|
|
9115
|
+
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.
|
|
9121
9116
|
|
|
9122
|
-
|
|
9117
|
+
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.
|
|
9123
9118
|
|
|
9124
|
-
|
|
9125
|
-
|
|
9126
|
-
**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.
|
|
9119
|
+
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.
|
|
9127
9120
|
</Category_Context>`, QUICK_CATEGORY_PROMPT_APPEND = `<Category_Context>
|
|
9128
9121
|
You are working on SMALL / QUICK tasks.
|
|
9129
9122
|
|
|
@@ -9142,10 +9135,9 @@ You are working on tasks that don't fit specific categories but require moderate
|
|
|
9142
9135
|
</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>
|
|
9143
9136
|
<Caller_Warning>Provide explicit must-do steps, forbidden scope, and concrete success criteria.</Caller_Warning>`, UNSPECIFIED_HIGH_CATEGORY_PROMPT_APPEND = `<Category_Context>
|
|
9144
9137
|
You are working on tasks that don't fit specific categories but require substantial effort.
|
|
9145
|
-
</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>`,
|
|
9138
|
+
</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;
|
|
9146
9139
|
var init_openai_categories = __esm(() => {
|
|
9147
9140
|
init_types();
|
|
9148
|
-
GPT_FLAGSHIP_GATE_MODELS = ["gpt-6-astra", "gpt-5.6-sol"];
|
|
9149
9141
|
OPENAI_CATEGORIES = [
|
|
9150
9142
|
{
|
|
9151
9143
|
name: "ultrabrain",
|
|
@@ -9155,12 +9147,22 @@ var init_openai_categories = __esm(() => {
|
|
|
9155
9147
|
resolvePromptAppend: resolveUltrabrainCategoryPromptAppend
|
|
9156
9148
|
},
|
|
9157
9149
|
{
|
|
9158
|
-
name: "deep",
|
|
9150
|
+
name: "deep-low",
|
|
9151
|
+
config: { model: "openai/gpt-5.6-sol", variant: "medium" },
|
|
9152
|
+
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.",
|
|
9153
|
+
callerGuidance: DEEP_LOW_CATEGORY_CALLER_GUIDANCE,
|
|
9154
|
+
promptAppend: DEEP_LOW_CATEGORY_PROMPT_APPEND,
|
|
9155
|
+
resolvePromptAppend: resolveDeepLowCategoryPromptAppend,
|
|
9156
|
+
requiresModel: DEEP_LOW_GATE_MODEL
|
|
9157
|
+
},
|
|
9158
|
+
{
|
|
9159
|
+
name: "deep-high",
|
|
9159
9160
|
config: { model: "openai/gpt-6-astra", variant: "high" },
|
|
9160
|
-
description: "
|
|
9161
|
-
|
|
9162
|
-
|
|
9163
|
-
|
|
9161
|
+
description: "Escalation deep lane: a goal whose central decision cannot be settled from evidence alone. Same one-goal, one-deliverable contract as deep-low.",
|
|
9162
|
+
callerGuidance: DEEP_HIGH_CATEGORY_CALLER_GUIDANCE,
|
|
9163
|
+
promptAppend: DEEP_HIGH_CATEGORY_PROMPT_APPEND,
|
|
9164
|
+
resolvePromptAppend: resolveDeepHighCategoryPromptAppend,
|
|
9165
|
+
requiresModel: DEEP_HIGH_GATE_MODEL
|
|
9164
9166
|
},
|
|
9165
9167
|
{
|
|
9166
9168
|
name: "quick",
|
|
@@ -73169,6 +73171,68 @@ var init_config = __esm(() => {
|
|
|
73169
73171
|
}).strict();
|
|
73170
73172
|
});
|
|
73171
73173
|
|
|
73174
|
+
// packages/omo-config-core/src/schema/legacy-category-names.ts
|
|
73175
|
+
function canonicalCategoryName(name) {
|
|
73176
|
+
return Object.hasOwn(LEGACY_CATEGORY_NAME_ALIASES, name) ? LEGACY_CATEGORY_NAME_ALIASES[name] : name;
|
|
73177
|
+
}
|
|
73178
|
+
function isRecord9(value) {
|
|
73179
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
73180
|
+
}
|
|
73181
|
+
function joinPath(path, segment) {
|
|
73182
|
+
return [...path, segment].join(".");
|
|
73183
|
+
}
|
|
73184
|
+
function canonicalizeCategoriesRecord(categories, path, renames) {
|
|
73185
|
+
const result = {};
|
|
73186
|
+
for (const [name, definition] of Object.entries(categories)) {
|
|
73187
|
+
const canonical = canonicalCategoryName(name);
|
|
73188
|
+
if (canonical === name) {
|
|
73189
|
+
result[name] = definition;
|
|
73190
|
+
continue;
|
|
73191
|
+
}
|
|
73192
|
+
const dropped = Object.hasOwn(categories, canonical);
|
|
73193
|
+
renames.push({ canonical, dropped, legacy: name, path: joinPath(path, name) });
|
|
73194
|
+
if (!dropped)
|
|
73195
|
+
result[canonical] = definition;
|
|
73196
|
+
}
|
|
73197
|
+
return result;
|
|
73198
|
+
}
|
|
73199
|
+
function canonicalizeValue(value, path, renames) {
|
|
73200
|
+
if (Array.isArray(value)) {
|
|
73201
|
+
return value.map((entry, index) => canonicalizeValue(entry, [...path, String(index)], renames));
|
|
73202
|
+
}
|
|
73203
|
+
if (!isRecord9(value))
|
|
73204
|
+
return value;
|
|
73205
|
+
const result = {};
|
|
73206
|
+
for (const [key, entry] of Object.entries(value)) {
|
|
73207
|
+
if (key === "categories" && isRecord9(entry)) {
|
|
73208
|
+
result[key] = canonicalizeCategoriesRecord(entry, [...path, key], renames);
|
|
73209
|
+
continue;
|
|
73210
|
+
}
|
|
73211
|
+
if (key === "category" && typeof entry === "string") {
|
|
73212
|
+
const canonical = canonicalCategoryName(entry);
|
|
73213
|
+
if (canonical !== entry) {
|
|
73214
|
+
renames.push({ canonical, dropped: false, legacy: entry, path: joinPath(path, key) });
|
|
73215
|
+
}
|
|
73216
|
+
result[key] = canonical;
|
|
73217
|
+
continue;
|
|
73218
|
+
}
|
|
73219
|
+
result[key] = canonicalizeValue(entry, [...path, key], renames);
|
|
73220
|
+
}
|
|
73221
|
+
return result;
|
|
73222
|
+
}
|
|
73223
|
+
function canonicalizeLegacyCategoryNames(document) {
|
|
73224
|
+
const renames = [];
|
|
73225
|
+
const canonicalized = isRecord9(document) ? canonicalizeValue(document, [], renames) : {};
|
|
73226
|
+
return { document: canonicalized, renames };
|
|
73227
|
+
}
|
|
73228
|
+
function hasLegacyCategoryNames(document) {
|
|
73229
|
+
return canonicalizeLegacyCategoryNames(document).renames.length > 0;
|
|
73230
|
+
}
|
|
73231
|
+
var LEGACY_CATEGORY_NAME_ALIASES;
|
|
73232
|
+
var init_legacy_category_names = __esm(() => {
|
|
73233
|
+
LEGACY_CATEGORY_NAME_ALIASES = { deep: "deep-low" };
|
|
73234
|
+
});
|
|
73235
|
+
|
|
73172
73236
|
// packages/omo-config-core/src/schema/index.ts
|
|
73173
73237
|
var init_schema = __esm(() => {
|
|
73174
73238
|
init_agent();
|
|
@@ -73178,6 +73242,7 @@ var init_schema = __esm(() => {
|
|
|
73178
73242
|
init_format_on_mutation();
|
|
73179
73243
|
init_git_master();
|
|
73180
73244
|
init_harness();
|
|
73245
|
+
init_legacy_category_names();
|
|
73181
73246
|
init_memory();
|
|
73182
73247
|
init_model_catalog();
|
|
73183
73248
|
init_model_profile();
|
|
@@ -73437,21 +73502,21 @@ function hasUnsafeUnrecognizedKey(issues) {
|
|
|
73437
73502
|
function hasTamperedPrototype(value) {
|
|
73438
73503
|
if (Array.isArray(value))
|
|
73439
73504
|
return value.some((entry) => hasTamperedPrototype(entry));
|
|
73440
|
-
if (!
|
|
73505
|
+
if (!isRecord10(value))
|
|
73441
73506
|
return false;
|
|
73442
73507
|
const prototype = Object.getPrototypeOf(value);
|
|
73443
73508
|
if (prototype !== Object.prototype && prototype !== null)
|
|
73444
73509
|
return true;
|
|
73445
73510
|
return Object.values(value).some((entry) => hasTamperedPrototype(entry));
|
|
73446
73511
|
}
|
|
73447
|
-
function
|
|
73512
|
+
function isRecord10(value) {
|
|
73448
73513
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
73449
73514
|
}
|
|
73450
73515
|
function containerAt(record, path) {
|
|
73451
73516
|
let container = record;
|
|
73452
73517
|
for (const segment of path) {
|
|
73453
73518
|
const next = container[segment];
|
|
73454
|
-
if (!
|
|
73519
|
+
if (!isRecord10(next))
|
|
73455
73520
|
return null;
|
|
73456
73521
|
container = next;
|
|
73457
73522
|
}
|
|
@@ -73553,6 +73618,15 @@ function readConfigSource(path, scope, fileSystem) {
|
|
|
73553
73618
|
value: parsedRecord
|
|
73554
73619
|
};
|
|
73555
73620
|
}
|
|
73621
|
+
function legacyCategoryDiagnostic(path, renames) {
|
|
73622
|
+
const detail = renames.map((rename) => rename.dropped ? `${rename.path} ignored because ${rename.canonical} is also configured` : `${rename.path} renamed to ${rename.canonical}`).join(", ");
|
|
73623
|
+
return {
|
|
73624
|
+
kind: "deprecated-keys",
|
|
73625
|
+
message: `Deprecated category name in ${path}: ${detail}. Rename it; the alias is removed in a future release.`,
|
|
73626
|
+
path,
|
|
73627
|
+
issuePaths: renames.map((rename) => rename.path)
|
|
73628
|
+
};
|
|
73629
|
+
}
|
|
73556
73630
|
function loadOmoConfig(options = {}) {
|
|
73557
73631
|
const fileSystem = options.fileSystem ?? DEFAULT_READ_FILE_SYSTEM;
|
|
73558
73632
|
const cwd = options.cwd ?? process.cwd();
|
|
@@ -73571,8 +73645,12 @@ function loadOmoConfig(options = {}) {
|
|
|
73571
73645
|
if (loaded.diagnostic !== undefined)
|
|
73572
73646
|
diagnostics.push(loaded.diagnostic);
|
|
73573
73647
|
if (loaded.value !== undefined) {
|
|
73574
|
-
|
|
73575
|
-
|
|
73648
|
+
const canonicalized = canonicalizeLegacyCategoryNames(loaded.value);
|
|
73649
|
+
if (canonicalized.renames.length > 0) {
|
|
73650
|
+
diagnostics.push(legacyCategoryDiagnostic(candidate.path, canonicalized.renames));
|
|
73651
|
+
}
|
|
73652
|
+
layers.push({ config: canonicalized.document, source: loaded.source });
|
|
73653
|
+
merged = mergeOmoConfigRecords(merged, canonicalized.document);
|
|
73576
73654
|
}
|
|
73577
73655
|
}
|
|
73578
73656
|
const requestedProfile = resolveOmoProfileName({
|
|
@@ -74658,6 +74736,9 @@ function executePlan(input) {
|
|
|
74658
74736
|
const existingSources = plan.sources.filter((source) => fileSystem.existsSync(source.path));
|
|
74659
74737
|
const target = targetDocument(plan.targetPath, fileSystem);
|
|
74660
74738
|
const replaceTarget = plan.mode === "replace-target";
|
|
74739
|
+
if (plan.shouldRun !== undefined && !plan.shouldRun(target)) {
|
|
74740
|
+
return { diagnostics: [], journalResumed, status: "skipped" };
|
|
74741
|
+
}
|
|
74661
74742
|
if (!shouldRunMigration({
|
|
74662
74743
|
legacySourcesExist: replaceTarget ? fileSystem.existsSync(plan.targetPath) : existingSources.length > 0,
|
|
74663
74744
|
migrationId: plan.id,
|
|
@@ -76246,6 +76327,19 @@ var init_reasoning_unification = __esm(() => {
|
|
|
76246
76327
|
init_record_values();
|
|
76247
76328
|
});
|
|
76248
76329
|
|
|
76330
|
+
// packages/omo-opencode/src/config-migration/category-deep-split.ts
|
|
76331
|
+
function transformCategoryDeepSplit(document) {
|
|
76332
|
+
const { document: canonicalized, renames } = canonicalizeLegacyCategoryNames(document);
|
|
76333
|
+
return {
|
|
76334
|
+
diagnostics: renames.map((rename) => rename.dropped ? `${rename.path} removed: ${rename.canonical} is already configured` : `${rename.path} renamed to ${rename.canonical}`),
|
|
76335
|
+
document: canonicalized
|
|
76336
|
+
};
|
|
76337
|
+
}
|
|
76338
|
+
var CATEGORY_DEEP_SPLIT_MIGRATION_ID = "2026-09-category-deep-split";
|
|
76339
|
+
var init_category_deep_split = __esm(() => {
|
|
76340
|
+
init_src4();
|
|
76341
|
+
});
|
|
76342
|
+
|
|
76249
76343
|
// packages/omo-opencode/src/config-migration/migration-plans.ts
|
|
76250
76344
|
function backupTimestamp(value) {
|
|
76251
76345
|
return value ?? new Date().toISOString().replace(/[:.]/g, "-");
|
|
@@ -76312,6 +76406,18 @@ function reasoningPlan(targetPath) {
|
|
|
76312
76406
|
transform: inspect
|
|
76313
76407
|
};
|
|
76314
76408
|
}
|
|
76409
|
+
function categoryDeepSplitPlan(targetPath) {
|
|
76410
|
+
const inspect = (sources) => transformCategoryDeepSplit(sources[0]?.value);
|
|
76411
|
+
return {
|
|
76412
|
+
id: CATEGORY_DEEP_SPLIT_MIGRATION_ID,
|
|
76413
|
+
inspect,
|
|
76414
|
+
mode: "replace-target",
|
|
76415
|
+
shouldRun: hasLegacyCategoryNames,
|
|
76416
|
+
sources: [],
|
|
76417
|
+
targetPath,
|
|
76418
|
+
transform: inspect
|
|
76419
|
+
};
|
|
76420
|
+
}
|
|
76315
76421
|
function existingOmoConfigPath(directory, options) {
|
|
76316
76422
|
const fileSystem = discoveryFileSystem(options);
|
|
76317
76423
|
for (const fileName of ["omo.jsonc", "omo.json"]) {
|
|
@@ -76371,7 +76477,12 @@ function createLegacyConfigMigrationPlans(options) {
|
|
|
76371
76477
|
}
|
|
76372
76478
|
for (const plan of legacyPlans)
|
|
76373
76479
|
addReasoningTarget(plan.targetPath);
|
|
76374
|
-
|
|
76480
|
+
const inPlaceTargets = [...reasoningTargets.values()];
|
|
76481
|
+
return [
|
|
76482
|
+
...legacyPlans,
|
|
76483
|
+
...inPlaceTargets.map(reasoningPlan),
|
|
76484
|
+
...inPlaceTargets.map(categoryDeepSplitPlan)
|
|
76485
|
+
];
|
|
76375
76486
|
}
|
|
76376
76487
|
var init_migration_plans = __esm(() => {
|
|
76377
76488
|
init_discovery2();
|
|
@@ -76380,6 +76491,8 @@ var init_migration_plans = __esm(() => {
|
|
|
76380
76491
|
init_transform_config_jsonc();
|
|
76381
76492
|
init_transform_opencode();
|
|
76382
76493
|
init_reasoning_unification();
|
|
76494
|
+
init_category_deep_split();
|
|
76495
|
+
init_src4();
|
|
76383
76496
|
});
|
|
76384
76497
|
|
|
76385
76498
|
// packages/omo-opencode/src/config-migration/migration-executor.ts
|
|
@@ -76953,37 +77066,82 @@ var init_config_manager = __esm(() => {
|
|
|
76953
77066
|
init_backup_config();
|
|
76954
77067
|
});
|
|
76955
77068
|
|
|
77069
|
+
// packages/telemetry-core/src/day-claim.ts
|
|
77070
|
+
import { closeSync as closeSync3, mkdirSync as mkdirSync8, openSync as openSync3, readdirSync as readdirSync7, rmSync as rmSync2 } from "fs";
|
|
77071
|
+
import { join as join51 } from "path";
|
|
77072
|
+
function getTelemetryDayClaimFilePath(stateDir, dayUTC) {
|
|
77073
|
+
return join51(stateDir, `${CLAIM_PREFIX}${dayUTC}${CLAIM_SUFFIX}`);
|
|
77074
|
+
}
|
|
77075
|
+
function claimUtcDay(stateDir, dayUTC) {
|
|
77076
|
+
try {
|
|
77077
|
+
mkdirSync8(stateDir, { recursive: true });
|
|
77078
|
+
closeSync3(openSync3(getTelemetryDayClaimFilePath(stateDir, dayUTC), "wx"));
|
|
77079
|
+
} catch (error) {
|
|
77080
|
+
return error.code === "EEXIST" ? "already-claimed" : "unavailable";
|
|
77081
|
+
}
|
|
77082
|
+
pruneSupersededClaims(stateDir, dayUTC);
|
|
77083
|
+
return "claimed";
|
|
77084
|
+
}
|
|
77085
|
+
function pruneSupersededClaims(stateDir, dayUTC) {
|
|
77086
|
+
const currentClaim = `${CLAIM_PREFIX}${dayUTC}${CLAIM_SUFFIX}`;
|
|
77087
|
+
let entries;
|
|
77088
|
+
try {
|
|
77089
|
+
entries = readdirSync7(stateDir);
|
|
77090
|
+
} catch {
|
|
77091
|
+
return;
|
|
77092
|
+
}
|
|
77093
|
+
for (const entry of entries) {
|
|
77094
|
+
if (entry === currentClaim)
|
|
77095
|
+
continue;
|
|
77096
|
+
if (!entry.startsWith(CLAIM_PREFIX) || !entry.endsWith(CLAIM_SUFFIX))
|
|
77097
|
+
continue;
|
|
77098
|
+
try {
|
|
77099
|
+
rmSync2(join51(stateDir, entry), { force: true });
|
|
77100
|
+
} catch {}
|
|
77101
|
+
}
|
|
77102
|
+
}
|
|
77103
|
+
var CLAIM_PREFIX = "daily-active.", CLAIM_SUFFIX = ".claim";
|
|
77104
|
+
var init_day_claim = () => {};
|
|
77105
|
+
|
|
76956
77106
|
// packages/telemetry-core/src/activity-state.ts
|
|
76957
|
-
import { existsSync as existsSync24, mkdirSync as
|
|
76958
|
-
import { basename as basename8, join as
|
|
77107
|
+
import { existsSync as existsSync24, mkdirSync as mkdirSync9, readFileSync as readFileSync11 } from "fs";
|
|
77108
|
+
import { basename as basename8, join as join52 } from "path";
|
|
76959
77109
|
function resolveTelemetryStateDir(product, options = {}) {
|
|
76960
77110
|
const dataDir = resolveXdgDataDir(product.cacheDirName, {
|
|
76961
77111
|
env: options.env,
|
|
76962
77112
|
osProvider: options.osProvider
|
|
76963
77113
|
});
|
|
76964
|
-
const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined :
|
|
77114
|
+
const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined : join52(options.env.XDG_DATA_HOME, product.cacheDirName);
|
|
76965
77115
|
if (dataDir === xdgStateDir || xdgStateDir === undefined && basename8(dataDir) === product.cacheDirName) {
|
|
76966
77116
|
return dataDir;
|
|
76967
77117
|
}
|
|
76968
|
-
return
|
|
77118
|
+
return join52(dataDir, product.cacheDirName);
|
|
76969
77119
|
}
|
|
76970
77120
|
function getTelemetryActivityStateFilePath(stateDir) {
|
|
76971
|
-
return
|
|
77121
|
+
return join52(stateDir, POSTHOG_ACTIVITY_STATE_FILE);
|
|
76972
77122
|
}
|
|
76973
77123
|
function getDailyActiveCaptureState(input) {
|
|
76974
|
-
const state = readPostHogActivityState(input.stateDir, input.diagnostics);
|
|
76975
77124
|
const dayUTC = getUtcDayString(input.now ?? new Date);
|
|
76976
|
-
|
|
76977
|
-
|
|
77125
|
+
if (capturedDaysByStateDir.get(input.stateDir) === dayUTC) {
|
|
77126
|
+
return { dayUTC, captureDaily: false };
|
|
77127
|
+
}
|
|
77128
|
+
const state = readPostHogActivityState(input.stateDir, input.diagnostics);
|
|
77129
|
+
if (state.lastActiveDayUTC === dayUTC) {
|
|
77130
|
+
capturedDaysByStateDir.set(input.stateDir, dayUTC);
|
|
77131
|
+
return { dayUTC, captureDaily: false };
|
|
77132
|
+
}
|
|
77133
|
+
const claim = claimUtcDay(input.stateDir, dayUTC);
|
|
77134
|
+
capturedDaysByStateDir.set(input.stateDir, dayUTC);
|
|
77135
|
+
if (claim === "already-claimed") {
|
|
77136
|
+
return { dayUTC, captureDaily: false };
|
|
77137
|
+
}
|
|
77138
|
+
if (claim === "claimed") {
|
|
76978
77139
|
writePostHogActivityState(input.stateDir, {
|
|
76979
77140
|
...state,
|
|
76980
77141
|
lastActiveDayUTC: dayUTC
|
|
76981
77142
|
}, input.diagnostics);
|
|
76982
77143
|
}
|
|
76983
|
-
return {
|
|
76984
|
-
dayUTC,
|
|
76985
|
-
captureDaily
|
|
76986
|
-
};
|
|
77144
|
+
return { dayUTC, captureDaily: true };
|
|
76987
77145
|
}
|
|
76988
77146
|
function getUtcDayString(date) {
|
|
76989
77147
|
return date.toISOString().slice(0, 10);
|
|
@@ -77016,7 +77174,7 @@ function readPostHogActivityState(stateDir, diagnostics) {
|
|
|
77016
77174
|
function writePostHogActivityState(stateDir, nextState, diagnostics) {
|
|
77017
77175
|
const stateFilePath = getTelemetryActivityStateFilePath(stateDir);
|
|
77018
77176
|
try {
|
|
77019
|
-
|
|
77177
|
+
mkdirSync9(stateDir, { recursive: true });
|
|
77020
77178
|
writeFileAtomically(stateFilePath, `${JSON.stringify(nextState, null, 2)}
|
|
77021
77179
|
`);
|
|
77022
77180
|
} catch (error) {
|
|
@@ -77028,26 +77186,28 @@ function writePostHogActivityState(stateDir, nextState, diagnostics) {
|
|
|
77028
77186
|
});
|
|
77029
77187
|
}
|
|
77030
77188
|
}
|
|
77031
|
-
var POSTHOG_ACTIVITY_STATE_FILE = "posthog-activity.json";
|
|
77189
|
+
var POSTHOG_ACTIVITY_STATE_FILE = "posthog-activity.json", capturedDaysByStateDir;
|
|
77032
77190
|
var init_activity_state = __esm(() => {
|
|
77033
77191
|
init_atomic_write();
|
|
77034
77192
|
init_xdg_data_dir();
|
|
77193
|
+
init_day_claim();
|
|
77194
|
+
capturedDaysByStateDir = new Map;
|
|
77035
77195
|
});
|
|
77036
77196
|
|
|
77037
77197
|
// packages/telemetry-core/src/constants.ts
|
|
77038
77198
|
var DEFAULT_POSTHOG_HOST = "https://us.i.posthog.com", DEFAULT_POSTHOG_API_KEY = "phc_CFJhj5HyvA62QPhvyaUCtaq23aUfznnijg5VaaGkNk74", UNCONFIGURED_POSTHOG_API_KEY = "phc_REPLACE_ME_OMO_NATIVE";
|
|
77039
77199
|
|
|
77040
77200
|
// packages/telemetry-core/src/diagnostics.ts
|
|
77041
|
-
import { appendFileSync as appendFileSync2, existsSync as existsSync25, mkdirSync as
|
|
77042
|
-
import { join as
|
|
77201
|
+
import { appendFileSync as appendFileSync2, existsSync as existsSync25, mkdirSync as mkdirSync10, readFileSync as readFileSync12 } from "fs";
|
|
77202
|
+
import { join as join53 } from "path";
|
|
77043
77203
|
function getTelemetryDiagnosticsFilePath(diagnosticsDir) {
|
|
77044
|
-
return
|
|
77204
|
+
return join53(diagnosticsDir, DIAGNOSTICS_FILE_NAME);
|
|
77045
77205
|
}
|
|
77046
77206
|
function writeTelemetryDiagnostic(input, options) {
|
|
77047
77207
|
const now = options.now ?? new Date;
|
|
77048
77208
|
try {
|
|
77049
77209
|
cleanupTelemetryDiagnostics({ diagnosticsDir: options.diagnosticsDir, now });
|
|
77050
|
-
|
|
77210
|
+
mkdirSync10(options.diagnosticsDir, { recursive: true });
|
|
77051
77211
|
appendFileSync2(getTelemetryDiagnosticsFilePath(options.diagnosticsDir), `${JSON.stringify(toDiagnosticRecord(input, now))}
|
|
77052
77212
|
`, "utf-8");
|
|
77053
77213
|
} catch (error) {
|
|
@@ -77116,7 +77276,7 @@ function shouldRetainLine(line, cutoffMs) {
|
|
|
77116
77276
|
function parseDiagnosticLine(line) {
|
|
77117
77277
|
try {
|
|
77118
77278
|
const parsed = JSON.parse(line);
|
|
77119
|
-
if (!
|
|
77279
|
+
if (!isRecord12(parsed)) {
|
|
77120
77280
|
return null;
|
|
77121
77281
|
}
|
|
77122
77282
|
return parsed;
|
|
@@ -77127,7 +77287,7 @@ function parseDiagnosticLine(line) {
|
|
|
77127
77287
|
throw error;
|
|
77128
77288
|
}
|
|
77129
77289
|
}
|
|
77130
|
-
function
|
|
77290
|
+
function isRecord12(value) {
|
|
77131
77291
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
77132
77292
|
}
|
|
77133
77293
|
function trimToMaxBytes(lines) {
|
|
@@ -82501,7 +82661,7 @@ function coerceBool(value) {
|
|
|
82501
82661
|
function coerceString(value) {
|
|
82502
82662
|
return typeof value == "string" ? value : undefined;
|
|
82503
82663
|
}
|
|
82504
|
-
function
|
|
82664
|
+
function isRecord13(value) {
|
|
82505
82665
|
return typeof value == "object" && value !== null && !Array.isArray(value);
|
|
82506
82666
|
}
|
|
82507
82667
|
function toRfc3339(timestamp) {
|
|
@@ -82523,7 +82683,7 @@ function relocateInto(properties, key, value) {
|
|
|
82523
82683
|
properties[key] = value;
|
|
82524
82684
|
}
|
|
82525
82685
|
function buildV1Event(message) {
|
|
82526
|
-
const sourceProperties =
|
|
82686
|
+
const sourceProperties = isRecord13(message.properties) ? message.properties : {};
|
|
82527
82687
|
const properties = {
|
|
82528
82688
|
...sourceProperties
|
|
82529
82689
|
};
|
|
@@ -84553,7 +84713,7 @@ var package_default2;
|
|
|
84553
84713
|
var init_package2 = __esm(() => {
|
|
84554
84714
|
package_default2 = {
|
|
84555
84715
|
name: "@oh-my-opencode/omo-codex",
|
|
84556
|
-
version: "5.0.0-beta.
|
|
84716
|
+
version: "5.0.0-beta.80",
|
|
84557
84717
|
type: "module",
|
|
84558
84718
|
private: true,
|
|
84559
84719
|
description: "Codex harness adapter for oh-my-openagent. Vendored Codex plugin namespace (omo) + TypeScript installer + telemetry.",
|
|
@@ -85425,7 +85585,7 @@ var init_update_toasts = __esm(() => {
|
|
|
85425
85585
|
|
|
85426
85586
|
// packages/omo-opencode/src/hooks/auto-update-checker/hook/background-update-check.ts
|
|
85427
85587
|
import { existsSync as existsSync46 } from "fs";
|
|
85428
|
-
import { dirname as dirname30, join as
|
|
85588
|
+
import { dirname as dirname30, join as join75 } from "path";
|
|
85429
85589
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
85430
85590
|
function defaultGetModuleHostingWorkspace() {
|
|
85431
85591
|
try {
|
|
@@ -85579,7 +85739,7 @@ var init_background_update_check = __esm(() => {
|
|
|
85579
85739
|
init_update_toasts();
|
|
85580
85740
|
defaultDeps4 = {
|
|
85581
85741
|
existsSync: existsSync46,
|
|
85582
|
-
join:
|
|
85742
|
+
join: join75,
|
|
85583
85743
|
runBunInstallWithDetails,
|
|
85584
85744
|
log: log2,
|
|
85585
85745
|
getOpenCodeCacheDir,
|
|
@@ -88001,7 +88161,7 @@ function getUnsupportedOpenCodeVersionMessage(openCodeVersion) {
|
|
|
88001
88161
|
}
|
|
88002
88162
|
|
|
88003
88163
|
// packages/omo-codex/src/install/install-codex.ts
|
|
88004
|
-
import { join as
|
|
88164
|
+
import { join as join54, resolve as resolve12 } from "path";
|
|
88005
88165
|
|
|
88006
88166
|
// packages/omo-codex/src/install/codex-default-role-config.ts
|
|
88007
88167
|
init_src4();
|
|
@@ -90620,10 +90780,10 @@ function readCatalogMultiAgentVersion(model, cachePath) {
|
|
|
90620
90780
|
} catch {
|
|
90621
90781
|
return null;
|
|
90622
90782
|
}
|
|
90623
|
-
if (!
|
|
90783
|
+
if (!isRecord11(cache) || !Array.isArray(cache.models))
|
|
90624
90784
|
return null;
|
|
90625
90785
|
for (const entry of cache.models) {
|
|
90626
|
-
if (!
|
|
90786
|
+
if (!isRecord11(entry))
|
|
90627
90787
|
continue;
|
|
90628
90788
|
if (entry.slug !== model && entry.id !== model)
|
|
90629
90789
|
continue;
|
|
@@ -90648,7 +90808,7 @@ function readRootModelCatalogPath(config) {
|
|
|
90648
90808
|
const single = config.match(/^\s*model_catalog_json\s*=\s*'([^']+)'/m);
|
|
90649
90809
|
return single?.[1] ?? null;
|
|
90650
90810
|
}
|
|
90651
|
-
function
|
|
90811
|
+
function isRecord11(value) {
|
|
90652
90812
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
90653
90813
|
}
|
|
90654
90814
|
function removeFeatureFlagSetting(config, featureName) {
|
|
@@ -92493,7 +92653,7 @@ async function runCodexInstaller(options = {}) {
|
|
|
92493
92653
|
const env = options.env ?? process.env;
|
|
92494
92654
|
const platform = options.platform ?? process.platform;
|
|
92495
92655
|
const repoRoot = resolve12(options.repoRoot ?? findRepoRoot({ importerDir: import.meta.dir, env }));
|
|
92496
|
-
const codexHome = resolve12(options.codexHome ?? env.CODEX_HOME ??
|
|
92656
|
+
const codexHome = resolve12(options.codexHome ?? env.CODEX_HOME ?? join54(homedir6(), ".codex"));
|
|
92497
92657
|
const projectDirectory = resolve12(options.projectDirectory ?? env.OMO_CODEX_PROJECT ?? process.cwd());
|
|
92498
92658
|
const binDir = resolveCodexInstallerBinDir({ binDir: options.binDir, codexHome, env });
|
|
92499
92659
|
const runCommand = options.runCommand ?? defaultRunCommand;
|
|
@@ -92510,9 +92670,9 @@ async function runCodexInstaller(options = {}) {
|
|
|
92510
92670
|
if (!gitBashResolution.found) {
|
|
92511
92671
|
throw new Error(gitBashResolution.installHint);
|
|
92512
92672
|
}
|
|
92513
|
-
const codexPackageRoot =
|
|
92673
|
+
const codexPackageRoot = join54(repoRoot, "packages", "omo-codex");
|
|
92514
92674
|
const marketplace = await readMarketplace(repoRoot, {
|
|
92515
|
-
marketplacePath:
|
|
92675
|
+
marketplacePath: join54(codexPackageRoot, "marketplace.json")
|
|
92516
92676
|
});
|
|
92517
92677
|
const distributionManifest = await readDistributionManifest(repoRoot);
|
|
92518
92678
|
const installed = [];
|
|
@@ -92558,7 +92718,7 @@ async function runCodexInstaller(options = {}) {
|
|
|
92558
92718
|
if (runtimeLink !== null)
|
|
92559
92719
|
log(`Linked ${runtimeLink.name} -> ${runtimeLink.target}`);
|
|
92560
92720
|
else
|
|
92561
|
-
log(`Warning: skipped the omo-agent-toolkit runtime wrapper because ${
|
|
92721
|
+
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`);
|
|
92562
92722
|
}
|
|
92563
92723
|
pluginSources.push({ name: entry.name, sourcePath });
|
|
92564
92724
|
installed.push(plugin);
|
|
@@ -92625,13 +92785,13 @@ async function runCodexInstaller(options = {}) {
|
|
|
92625
92785
|
continue;
|
|
92626
92786
|
log(`Warning: deferred legacy Codex LSP daemon cleanup for v${cleanup.version}: ${cleanup.reason}`);
|
|
92627
92787
|
}
|
|
92628
|
-
const marketplaceRoot =
|
|
92788
|
+
const marketplaceRoot = join54(codexHome, "plugins", "cache", marketplace.name);
|
|
92629
92789
|
await writeCachedMarketplaceManifest({
|
|
92630
92790
|
marketplaceName: marketplace.name,
|
|
92631
92791
|
marketplaceRoot,
|
|
92632
92792
|
plugins: installed
|
|
92633
92793
|
});
|
|
92634
|
-
const configPath =
|
|
92794
|
+
const configPath = join54(codexHome, "config.toml");
|
|
92635
92795
|
await updateCodexConfig({
|
|
92636
92796
|
configPath,
|
|
92637
92797
|
repoRoot: codexPackageRoot,
|
|
@@ -92690,7 +92850,7 @@ function findRepoRootFromImporter(importerDir) {
|
|
|
92690
92850
|
for (let depth = 0;depth <= 7; depth += 1) {
|
|
92691
92851
|
if (isRepoRootWithCodexPlugin(current))
|
|
92692
92852
|
return current;
|
|
92693
|
-
for (const wrapperPackageRoot of [
|
|
92853
|
+
for (const wrapperPackageRoot of [join54(current, "node_modules", "oh-my-openagent"), join54(current, "oh-my-openagent")]) {
|
|
92694
92854
|
if (isRepoRootWithCodexPlugin(wrapperPackageRoot))
|
|
92695
92855
|
return wrapperPackageRoot;
|
|
92696
92856
|
}
|
|
@@ -92708,7 +92868,7 @@ function findRepoRoot(input) {
|
|
|
92708
92868
|
return findRepoRootFromImporter(input.importerDir);
|
|
92709
92869
|
}
|
|
92710
92870
|
function isRepoRootWithCodexPlugin(repoRoot) {
|
|
92711
|
-
return existsSync26(
|
|
92871
|
+
return existsSync26(join54(repoRoot, "packages", "omo-codex", "plugin", ".codex-plugin", "plugin.json"));
|
|
92712
92872
|
}
|
|
92713
92873
|
function codexMarketplaceSource(marketplaceRoot) {
|
|
92714
92874
|
return { sourceType: "local", source: marketplaceRoot };
|
|
@@ -92845,11 +93005,11 @@ function defaultRunCommand2(command, args) {
|
|
|
92845
93005
|
// packages/omo-codex/src/install/codex-cleanup.ts
|
|
92846
93006
|
import { lstat as lstat15, readFile as readFile25, readdir as readdir13, rm as rm13, rmdir } from "fs/promises";
|
|
92847
93007
|
import { homedir as homedir8 } from "os";
|
|
92848
|
-
import { isAbsolute as isAbsolute11, join as
|
|
93008
|
+
import { isAbsolute as isAbsolute11, join as join57, relative as relative6, resolve as resolve15 } from "path";
|
|
92849
93009
|
|
|
92850
93010
|
// packages/omo-codex/src/install/codex-cleanup-bins.ts
|
|
92851
93011
|
import { lstat as lstat13, readFile as readFile23, readdir as readdir12, readlink as readlink6, rm as rm12 } from "fs/promises";
|
|
92852
|
-
import { dirname as dirname18, isAbsolute as isAbsolute9, join as
|
|
93012
|
+
import { dirname as dirname18, isAbsolute as isAbsolute9, join as join55, resolve as resolve13 } from "path";
|
|
92853
93013
|
var ROOT_RUNTIME_BIN_NAME = "omo";
|
|
92854
93014
|
var MANAGED_CODEX_BIN_NAMES = new Set([
|
|
92855
93015
|
ROOT_RUNTIME_BIN_NAME,
|
|
@@ -92879,7 +93039,7 @@ async function removeManagedCodexBins(binDir, platform) {
|
|
|
92879
93039
|
const binName = managedBinNameForEntry2(entry.name, platform);
|
|
92880
93040
|
if (binName === null || !MANAGED_CODEX_BIN_NAMES.has(binName))
|
|
92881
93041
|
continue;
|
|
92882
|
-
const linkPath =
|
|
93042
|
+
const linkPath = join55(binDir, entry.name);
|
|
92883
93043
|
if (await isManagedCodexBin(linkPath, platform, binName)) {
|
|
92884
93044
|
await rm12(linkPath, { force: true });
|
|
92885
93045
|
removed.push(linkPath);
|
|
@@ -93032,7 +93192,7 @@ function nodeErrorCode5(error) {
|
|
|
93032
93192
|
}
|
|
93033
93193
|
|
|
93034
93194
|
// packages/omo-codex/src/install/codex-cleanup-safety.ts
|
|
93035
|
-
import { dirname as dirname20, isAbsolute as isAbsolute10, join as
|
|
93195
|
+
import { dirname as dirname20, isAbsolute as isAbsolute10, join as join56, relative as relative5, resolve as resolve14 } from "path";
|
|
93036
93196
|
function codexHomeResolvesToFilesystemRoot(codexHome) {
|
|
93037
93197
|
const resolved = resolve14(codexHome);
|
|
93038
93198
|
return dirname20(resolved) === resolved;
|
|
@@ -93049,11 +93209,11 @@ function validateManagedCleanupTarget(input) {
|
|
|
93049
93209
|
if (target === codexHome)
|
|
93050
93210
|
return skipped(input.path, "outside managed Codex cleanup scope");
|
|
93051
93211
|
const exactManagedRoots = new Set([
|
|
93052
|
-
resolve14(
|
|
93053
|
-
resolve14(
|
|
93054
|
-
resolve14(
|
|
93055
|
-
resolve14(
|
|
93056
|
-
resolve14(
|
|
93212
|
+
resolve14(join56(codexHome, "plugins", "cache", "sisyphuslabs")),
|
|
93213
|
+
resolve14(join56(codexHome, ".tmp", "marketplaces", "sisyphuslabs")),
|
|
93214
|
+
resolve14(join56(codexHome, "runtime", "ast-grep")),
|
|
93215
|
+
resolve14(join56(codexHome, "runtime", "node")),
|
|
93216
|
+
resolve14(join56(codexHome, "plugins", "data", "omo-sisyphuslabs", "bootstrap"))
|
|
93057
93217
|
]);
|
|
93058
93218
|
if (exactManagedRoots.has(target))
|
|
93059
93219
|
return null;
|
|
@@ -93083,8 +93243,8 @@ function skipped(path, reason) {
|
|
|
93083
93243
|
var INSTALLED_AGENTS_MANIFEST = ".installed-agents.json";
|
|
93084
93244
|
async function cleanupCodexLight(input = {}) {
|
|
93085
93245
|
const env = input.env ?? process.env;
|
|
93086
|
-
const codexHome = resolve15(input.codexHome ?? env.CODEX_HOME ??
|
|
93087
|
-
const configPath =
|
|
93246
|
+
const codexHome = resolve15(input.codexHome ?? env.CODEX_HOME ?? join57(homedir8(), ".codex"));
|
|
93247
|
+
const configPath = join57(codexHome, "config.toml");
|
|
93088
93248
|
const installedBinDir = await readInstalledCodexBinDir(codexHome);
|
|
93089
93249
|
const agentPaths = await collectInstalledAgentPaths(codexHome, configPath);
|
|
93090
93250
|
const configCleanup = await cleanupCodexConfig(configPath, input.now);
|
|
@@ -93138,17 +93298,17 @@ function firstConfiguredPath(...values) {
|
|
|
93138
93298
|
}
|
|
93139
93299
|
function managedGlobalStatePaths(codexHome) {
|
|
93140
93300
|
return [
|
|
93141
|
-
|
|
93142
|
-
|
|
93143
|
-
|
|
93144
|
-
|
|
93145
|
-
|
|
93301
|
+
join57(codexHome, "plugins", "cache", "sisyphuslabs"),
|
|
93302
|
+
join57(codexHome, ".tmp", "marketplaces", "sisyphuslabs"),
|
|
93303
|
+
join57(codexHome, "runtime", "ast-grep"),
|
|
93304
|
+
join57(codexHome, "runtime", "node"),
|
|
93305
|
+
join57(codexHome, "plugins", "data", "omo-sisyphuslabs", "bootstrap")
|
|
93146
93306
|
];
|
|
93147
93307
|
}
|
|
93148
93308
|
var BOOTSTRAP_DATA_GLOB_MAX_DEPTH = 5;
|
|
93149
93309
|
async function collectBootstrapDataDirsByGlob(codexHome) {
|
|
93150
93310
|
const results = [];
|
|
93151
|
-
await walkForManagedBootstrapDirs(
|
|
93311
|
+
await walkForManagedBootstrapDirs(join57(codexHome, "plugins"), 0, results);
|
|
93152
93312
|
return results;
|
|
93153
93313
|
}
|
|
93154
93314
|
async function walkForManagedBootstrapDirs(directory, depth, results) {
|
|
@@ -93160,9 +93320,9 @@ async function walkForManagedBootstrapDirs(directory, depth, results) {
|
|
|
93160
93320
|
for (const entry of entries) {
|
|
93161
93321
|
if (!entry.isDirectory())
|
|
93162
93322
|
continue;
|
|
93163
|
-
const childPath =
|
|
93323
|
+
const childPath = join57(directory, entry.name);
|
|
93164
93324
|
if (isManagedBootstrapOwnerName(entry.name)) {
|
|
93165
|
-
const bootstrapDir =
|
|
93325
|
+
const bootstrapDir = join57(childPath, "bootstrap");
|
|
93166
93326
|
if (await exists6(bootstrapDir))
|
|
93167
93327
|
results.push(bootstrapDir);
|
|
93168
93328
|
continue;
|
|
@@ -93196,7 +93356,7 @@ async function attemptRemove(path) {
|
|
|
93196
93356
|
}
|
|
93197
93357
|
async function pruneEmptyRuntimeDirBestEffort(codexHome) {
|
|
93198
93358
|
try {
|
|
93199
|
-
await rmdir(
|
|
93359
|
+
await rmdir(join57(codexHome, "runtime"));
|
|
93200
93360
|
} catch (error) {
|
|
93201
93361
|
if (isExpectedRuntimePruneFailure(error))
|
|
93202
93362
|
return;
|
|
@@ -93208,14 +93368,14 @@ function isExpectedRuntimePruneFailure(error) {
|
|
|
93208
93368
|
}
|
|
93209
93369
|
async function collectInstalledAgentPaths(codexHome, configPath) {
|
|
93210
93370
|
const manifestPaths = [
|
|
93211
|
-
|
|
93371
|
+
join57(codexHome, ".tmp", "marketplaces", "sisyphuslabs", "plugins", "omo", INSTALLED_AGENTS_MANIFEST)
|
|
93212
93372
|
];
|
|
93213
|
-
const versionRoot =
|
|
93373
|
+
const versionRoot = join57(codexHome, "plugins", "cache", "sisyphuslabs", "omo");
|
|
93214
93374
|
if (await exists6(versionRoot)) {
|
|
93215
93375
|
const entries = await readdir13(versionRoot, { withFileTypes: true });
|
|
93216
93376
|
for (const entry of entries) {
|
|
93217
93377
|
if (entry.isDirectory())
|
|
93218
|
-
manifestPaths.push(
|
|
93378
|
+
manifestPaths.push(join57(versionRoot, entry.name, INSTALLED_AGENTS_MANIFEST));
|
|
93219
93379
|
}
|
|
93220
93380
|
}
|
|
93221
93381
|
const paths = new Set;
|
|
@@ -93233,7 +93393,7 @@ async function readManagedAgentPathsFromConfig(codexHome, configPath) {
|
|
|
93233
93393
|
if (!await exists6(configPath))
|
|
93234
93394
|
return [];
|
|
93235
93395
|
const config = await readFile25(configPath, "utf8");
|
|
93236
|
-
return MANAGED_CODEX_AGENT_NAMES2.filter((agentName) => config.includes(`config_file = ${JSON.stringify(`./agents/${agentName}.toml`)}`)).map((agentName) =>
|
|
93396
|
+
return MANAGED_CODEX_AGENT_NAMES2.filter((agentName) => config.includes(`config_file = ${JSON.stringify(`./agents/${agentName}.toml`)}`)).map((agentName) => join57(codexHome, "agents", `${agentName}.toml`));
|
|
93237
93397
|
}
|
|
93238
93398
|
async function readInstalledAgentManifest(manifestPath) {
|
|
93239
93399
|
if (!await exists6(manifestPath))
|
|
@@ -93244,7 +93404,7 @@ async function readInstalledAgentManifest(manifestPath) {
|
|
|
93244
93404
|
return parsed.agents.filter((path) => typeof path === "string");
|
|
93245
93405
|
}
|
|
93246
93406
|
async function removeManifestListedAgentLinks(codexHome, paths) {
|
|
93247
|
-
const agentsDir =
|
|
93407
|
+
const agentsDir = join57(codexHome, "agents");
|
|
93248
93408
|
const removed = [];
|
|
93249
93409
|
const skipped = [];
|
|
93250
93410
|
for (const path of paths) {
|
|
@@ -93296,14 +93456,14 @@ function nodeErrorCode6(error) {
|
|
|
93296
93456
|
import { execFile as execFile3 } from "child_process";
|
|
93297
93457
|
import { existsSync as existsSync30 } from "fs";
|
|
93298
93458
|
import { homedir as homedir11 } from "os";
|
|
93299
|
-
import { dirname as dirname24, join as
|
|
93459
|
+
import { dirname as dirname24, join as join62, resolve as resolve19 } from "path";
|
|
93300
93460
|
import { fileURLToPath } from "url";
|
|
93301
93461
|
import { promisify as promisify2 } from "util";
|
|
93302
93462
|
|
|
93303
93463
|
// packages/omo-senpi/src/components/agent-home/resolve-agent-home.ts
|
|
93304
93464
|
import { existsSync as existsSync28 } from "fs";
|
|
93305
93465
|
import { homedir as homedir9 } from "os";
|
|
93306
|
-
import { join as
|
|
93466
|
+
import { join as join58, resolve as resolve16 } from "path";
|
|
93307
93467
|
var AGENT_DIR_ENV_NAMES = [
|
|
93308
93468
|
"OMO_CODING_AGENT_DIR",
|
|
93309
93469
|
"SENPI_CODING_AGENT_DIR",
|
|
@@ -93317,25 +93477,25 @@ function resolveAgentHome(options) {
|
|
|
93317
93477
|
if (configured)
|
|
93318
93478
|
return resolve16(configured);
|
|
93319
93479
|
}
|
|
93320
|
-
const brandedHome =
|
|
93321
|
-
const canonical =
|
|
93322
|
-
if (exists(
|
|
93480
|
+
const brandedHome = join58(homeDir, ".omo");
|
|
93481
|
+
const canonical = join58(brandedHome, "agent");
|
|
93482
|
+
if (exists(join58(canonical, AGENT_HOME_SENTINEL)))
|
|
93323
93483
|
return canonical;
|
|
93324
|
-
if (exists(
|
|
93484
|
+
if (exists(join58(brandedHome, AGENT_HOME_SENTINEL)))
|
|
93325
93485
|
return brandedHome;
|
|
93326
|
-
return
|
|
93486
|
+
return join58(homeDir, ".senpi", "agent");
|
|
93327
93487
|
}
|
|
93328
93488
|
|
|
93329
93489
|
// packages/omo-senpi/src/install/local-launcher.ts
|
|
93330
|
-
import { chmodSync as chmodSync3, existsSync as existsSync29, mkdirSync as
|
|
93490
|
+
import { chmodSync as chmodSync3, existsSync as existsSync29, mkdirSync as mkdirSync11, readFileSync as readFileSync13, rmSync as rmSync3, writeFileSync as writeFileSync6 } from "fs";
|
|
93331
93491
|
import { homedir as homedir10 } from "os";
|
|
93332
|
-
import { dirname as dirname21, join as
|
|
93492
|
+
import { dirname as dirname21, join as join59, resolve as resolve17 } from "path";
|
|
93333
93493
|
var MARKER = "omo-local-launcher";
|
|
93334
93494
|
function localLauncherPath(homeDir = homedir10()) {
|
|
93335
|
-
return
|
|
93495
|
+
return join59(homeDir, ".local", "bin", "omo");
|
|
93336
93496
|
}
|
|
93337
93497
|
function localLauncherCmdPath(homeDir = homedir10()) {
|
|
93338
|
-
return
|
|
93498
|
+
return join59(homeDir, ".local", "bin", "omo.cmd");
|
|
93339
93499
|
}
|
|
93340
93500
|
function renderLocalLauncher(options) {
|
|
93341
93501
|
const brand = {
|
|
@@ -93348,7 +93508,7 @@ function renderLocalLauncher(options) {
|
|
|
93348
93508
|
userAgent: "omo",
|
|
93349
93509
|
originator: "omo",
|
|
93350
93510
|
changelog: {
|
|
93351
|
-
path:
|
|
93511
|
+
path: join59(options.pluginPath, "CHANGELOG.md").replaceAll("\\", "/")
|
|
93352
93512
|
},
|
|
93353
93513
|
update: {
|
|
93354
93514
|
packageName: "omo-ai",
|
|
@@ -93386,6 +93546,9 @@ if (selfUpdate) {
|
|
|
93386
93546
|
console.log("omo is updated via npm: npm i -g omo-ai@beta")
|
|
93387
93547
|
process.exit(0)
|
|
93388
93548
|
}
|
|
93549
|
+
// windowsHide-exempt: this is the interactive foreground CLI, spawned with inherited stdio.
|
|
93550
|
+
// CREATE_NO_WINDOW would suppress the console a console-less launch needs to render the TUI,
|
|
93551
|
+
// so the launcher keeps the user's console instead of hiding it (#8501).
|
|
93389
93552
|
const child = spawn(process.execPath, [cli, "--extension", plugin, ...process.argv.slice(2)], {
|
|
93390
93553
|
env,
|
|
93391
93554
|
stdio: "inherit",
|
|
@@ -93403,7 +93566,7 @@ function installLocalLauncher(options) {
|
|
|
93403
93566
|
const path = localLauncherPath(options.homeDir);
|
|
93404
93567
|
if (existsSync29(path) && !readFileSync13(path, "utf8").includes(MARKER))
|
|
93405
93568
|
return;
|
|
93406
|
-
|
|
93569
|
+
mkdirSync11(dirname21(path), { recursive: true });
|
|
93407
93570
|
writeFileSync6(path, renderLocalLauncher(options));
|
|
93408
93571
|
chmodSync3(path, 493);
|
|
93409
93572
|
if ((options.platform ?? process.platform) === "win32") {
|
|
@@ -93418,7 +93581,7 @@ node "%~dp0omo" %*\r
|
|
|
93418
93581
|
import { createHash as createHash6 } from "crypto";
|
|
93419
93582
|
import { constants as constants9 } from "fs";
|
|
93420
93583
|
import { access as access2, readFile as readFile27, stat as stat6 } from "fs/promises";
|
|
93421
|
-
import { dirname as dirname23, join as
|
|
93584
|
+
import { dirname as dirname23, join as join61 } from "path";
|
|
93422
93585
|
|
|
93423
93586
|
// packages/memory-core/src/personas/manifest.ts
|
|
93424
93587
|
var PERSONA_ASSET_FILENAMES = {
|
|
@@ -93437,12 +93600,12 @@ var PERSONA_ASSET_FILES = [
|
|
|
93437
93600
|
// packages/omo-senpi/src/install/senpi-settings.ts
|
|
93438
93601
|
import { constants as constants8 } from "fs";
|
|
93439
93602
|
import { access, copyFile as copyFile3, mkdir as mkdir9, readFile as readFile26, rename as rename5, writeFile as writeFile14 } from "fs/promises";
|
|
93440
|
-
import { basename as basename9, dirname as dirname22, join as
|
|
93603
|
+
import { basename as basename9, dirname as dirname22, join as join60, resolve as resolve18 } from "path";
|
|
93441
93604
|
var OMO_SENPI_PACKAGE_NAME = "@code-yeongyu/omo-senpi";
|
|
93442
93605
|
var GENERATED_PLUGIN_BASENAME = /^omo-senpi-cli-plugin-[A-Za-z0-9]{6}$/;
|
|
93443
93606
|
var LEGACY_BUILTIN_SHADOW_PACKAGES = [
|
|
93444
|
-
|
|
93445
|
-
|
|
93607
|
+
join60("packages", "pi-goal"),
|
|
93608
|
+
join60("packages", "pi-webfetch")
|
|
93446
93609
|
];
|
|
93447
93610
|
async function readSettings(settingsPath) {
|
|
93448
93611
|
let raw;
|
|
@@ -93454,7 +93617,7 @@ async function readSettings(settingsPath) {
|
|
|
93454
93617
|
throw error;
|
|
93455
93618
|
}
|
|
93456
93619
|
const parsed = JSON.parse(raw);
|
|
93457
|
-
if (!
|
|
93620
|
+
if (!isRecord14(parsed))
|
|
93458
93621
|
throw new Error(`${settingsPath} must contain a JSON object`);
|
|
93459
93622
|
return parsed;
|
|
93460
93623
|
}
|
|
@@ -93515,13 +93678,13 @@ async function nextBackupPath(settingsPath) {
|
|
|
93515
93678
|
function timestampForBackup() {
|
|
93516
93679
|
return new Date().toISOString().replace(/[-:.]/g, "");
|
|
93517
93680
|
}
|
|
93518
|
-
function
|
|
93681
|
+
function isRecord14(value) {
|
|
93519
93682
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
93520
93683
|
}
|
|
93521
93684
|
async function readPackageName(packagePath) {
|
|
93522
93685
|
let raw;
|
|
93523
93686
|
try {
|
|
93524
|
-
raw = await readFile26(
|
|
93687
|
+
raw = await readFile26(join60(packagePath, "package.json"), "utf8");
|
|
93525
93688
|
} catch (error) {
|
|
93526
93689
|
if (isErrno(error, "ENOENT") || isErrno(error, "ENOTDIR"))
|
|
93527
93690
|
return;
|
|
@@ -93535,7 +93698,7 @@ async function readPackageName(packagePath) {
|
|
|
93535
93698
|
return;
|
|
93536
93699
|
throw error;
|
|
93537
93700
|
}
|
|
93538
|
-
return
|
|
93701
|
+
return isRecord14(parsed) && typeof parsed.name === "string" ? parsed.name : undefined;
|
|
93539
93702
|
}
|
|
93540
93703
|
async function fileExists(path) {
|
|
93541
93704
|
try {
|
|
@@ -93553,51 +93716,51 @@ function isErrno(error, code) {
|
|
|
93553
93716
|
|
|
93554
93717
|
// packages/omo-senpi/src/install/plugin-artifacts.ts
|
|
93555
93718
|
var REQUIRED_PLUGIN_ARTIFACTS = [
|
|
93556
|
-
|
|
93557
|
-
|
|
93558
|
-
|
|
93559
|
-
|
|
93560
|
-
...PERSONA_ASSET_FILES.map((filename) =>
|
|
93561
|
-
|
|
93562
|
-
|
|
93563
|
-
|
|
93564
|
-
|
|
93565
|
-
|
|
93566
|
-
|
|
93567
|
-
|
|
93568
|
-
|
|
93569
|
-
|
|
93570
|
-
|
|
93571
|
-
|
|
93572
|
-
|
|
93573
|
-
|
|
93574
|
-
|
|
93575
|
-
|
|
93576
|
-
|
|
93577
|
-
|
|
93578
|
-
|
|
93579
|
-
|
|
93580
|
-
|
|
93581
|
-
|
|
93582
|
-
|
|
93583
|
-
|
|
93584
|
-
|
|
93585
|
-
|
|
93586
|
-
|
|
93587
|
-
|
|
93588
|
-
|
|
93589
|
-
|
|
93719
|
+
join61("extensions", "omo.js"),
|
|
93720
|
+
join61("extensions", "omo-task.js"),
|
|
93721
|
+
join61("extensions", "omo-member.js"),
|
|
93722
|
+
join61("extensions", "memory-run-supervisor.mjs"),
|
|
93723
|
+
...PERSONA_ASSET_FILES.map((filename) => join61("extensions", filename)),
|
|
93724
|
+
join61("skills", "ast-grep", "SKILL.md"),
|
|
93725
|
+
join61("skills", "coding-agent-sessions", "SKILL.md"),
|
|
93726
|
+
join61("skills", "debugging", "SKILL.md"),
|
|
93727
|
+
join61("skills", "frontend", "SKILL.md"),
|
|
93728
|
+
join61("skills", "git-master", "SKILL.md"),
|
|
93729
|
+
join61("skills", "init-deep", "SKILL.md"),
|
|
93730
|
+
join61("skills", "lsp-setup", "SKILL.md"),
|
|
93731
|
+
join61("skills", "programming", "SKILL.md"),
|
|
93732
|
+
join61("skills", "refactor", "SKILL.md"),
|
|
93733
|
+
join61("skills", "remove-ai-slops", "SKILL.md"),
|
|
93734
|
+
join61("skills", "review-work", "SKILL.md"),
|
|
93735
|
+
join61("skills", "ultimate-browsing", "SKILL.md"),
|
|
93736
|
+
join61("skills", "ultrawork", "SKILL.md"),
|
|
93737
|
+
join61("skills", "ulw-execute", "SKILL.md"),
|
|
93738
|
+
join61("skills", "ulw-loop", "SKILL.md"),
|
|
93739
|
+
join61("skills", "ulw-plan", "SKILL.md"),
|
|
93740
|
+
join61("skills", "ulw-research", "SKILL.md"),
|
|
93741
|
+
join61("skills", "visual-qa", "SKILL.md"),
|
|
93742
|
+
join61("skills-conditional", "x-search", "SKILL.md"),
|
|
93743
|
+
join61("runtime", "agent-toolkit-sdk", "sdk.js"),
|
|
93744
|
+
join61("runtime", "ast-grep-mcp", "cli.js"),
|
|
93745
|
+
join61("runtime", "lsp-daemon", "dist", "cli.js"),
|
|
93746
|
+
join61("runtime", "lsp-daemon", "dist", "index.js"),
|
|
93747
|
+
join61("runtime", "lsp-daemon", "dist", "index.d.ts"),
|
|
93748
|
+
join61("runtime", "lsp-daemon", "dist", "daemon-client.js"),
|
|
93749
|
+
join61("runtime", "lsp-daemon", "dist", "daemon-client.d.ts"),
|
|
93750
|
+
join61("runtime", "lsp-daemon", "dist", "package.json"),
|
|
93751
|
+
join61("runtime", "lsp-daemon", "dist", ".omo-runtime-manifest.json"),
|
|
93752
|
+
join61("scripts", "install.mjs"),
|
|
93590
93753
|
"daemon-launch-spec.json"
|
|
93591
93754
|
];
|
|
93592
93755
|
async function ensurePluginArtifacts(context) {
|
|
93593
93756
|
if (context.allowBuild) {
|
|
93594
|
-
await context.runCommand("node", [
|
|
93595
|
-
await context.runCommand("node", [
|
|
93596
|
-
await context.runCommand("node", [
|
|
93597
|
-
await context.runCommand("node", [
|
|
93598
|
-
await context.runCommand("node", [
|
|
93599
|
-
await context.runCommand("node", [
|
|
93600
|
-
await context.runCommand("node", [
|
|
93757
|
+
await context.runCommand("node", [join61(context.pluginPath, "scripts", "build-extension.mjs")], { cwd: context.repoRoot });
|
|
93758
|
+
await context.runCommand("node", [join61("packages", "omo-codex", "plugin", "scripts", "materialize-shared-upstreams.mjs")], { cwd: context.repoRoot });
|
|
93759
|
+
await context.runCommand("node", [join61(context.pluginPath, "scripts", "sync-skills.mjs")], { cwd: context.repoRoot });
|
|
93760
|
+
await context.runCommand("node", [join61(context.pluginPath, "scripts", "build-install.mjs")], { cwd: context.repoRoot });
|
|
93761
|
+
await context.runCommand("node", [join61(context.pluginPath, "scripts", "stage-lsp-daemon-runtime.mjs")], { cwd: context.repoRoot });
|
|
93762
|
+
await context.runCommand("node", [join61(context.pluginPath, "scripts", "stage-ast-grep-mcp-runtime.mjs")], { cwd: context.repoRoot });
|
|
93763
|
+
await context.runCommand("node", [join61(context.pluginPath, "scripts", "stage-x-search-skill.mjs")], { cwd: context.repoRoot });
|
|
93601
93764
|
}
|
|
93602
93765
|
if (await hasMissingPluginArtifact(context.pluginPath)) {
|
|
93603
93766
|
throw new Error(`Packed omo-senpi plugin is missing required runtime artifacts at ${context.pluginPath}`);
|
|
@@ -93606,14 +93769,14 @@ async function ensurePluginArtifacts(context) {
|
|
|
93606
93769
|
}
|
|
93607
93770
|
async function hasMissingPluginArtifact(pluginPath) {
|
|
93608
93771
|
for (const artifact of REQUIRED_PLUGIN_ARTIFACTS) {
|
|
93609
|
-
if (!await fileExists2(
|
|
93772
|
+
if (!await fileExists2(join61(pluginPath, artifact)))
|
|
93610
93773
|
return true;
|
|
93611
93774
|
}
|
|
93612
93775
|
return false;
|
|
93613
93776
|
}
|
|
93614
93777
|
async function verifyAstGrepRuntimeIntegrity(pluginPath, platform) {
|
|
93615
|
-
const runtimeEntry =
|
|
93616
|
-
const manifestPath =
|
|
93778
|
+
const runtimeEntry = join61(pluginPath, "runtime", "ast-grep-mcp", "cli.js");
|
|
93779
|
+
const manifestPath = join61(dirname23(runtimeEntry), "manifest.json");
|
|
93617
93780
|
let runtimeStat;
|
|
93618
93781
|
try {
|
|
93619
93782
|
runtimeStat = await stat6(runtimeEntry);
|
|
@@ -93650,7 +93813,7 @@ async function verifyAstGrepRuntimeIntegrity(pluginPath, platform) {
|
|
|
93650
93813
|
}
|
|
93651
93814
|
}
|
|
93652
93815
|
function isAstGrepRuntimeManifest(value) {
|
|
93653
|
-
if (!
|
|
93816
|
+
if (!isRecord14(value))
|
|
93654
93817
|
return false;
|
|
93655
93818
|
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));
|
|
93656
93819
|
}
|
|
@@ -93688,7 +93851,7 @@ async function runSenpiInstaller(options = {}) {
|
|
|
93688
93851
|
const backupPath = await writeSettingsAtomically(context.settingsPath, settings);
|
|
93689
93852
|
const launcherPath = installLocalLauncher({
|
|
93690
93853
|
pluginPath: context.pluginPath,
|
|
93691
|
-
senpiCliPath:
|
|
93854
|
+
senpiCliPath: join62(context.repoRoot, "packages", "coding-agent", "dist", "cli.js"),
|
|
93692
93855
|
homeDir: context.homeDir
|
|
93693
93856
|
});
|
|
93694
93857
|
return {
|
|
@@ -93708,13 +93871,13 @@ function resolveInstallContext(options) {
|
|
|
93708
93871
|
const repoRoot = resolve19(options.repoRoot ?? (allowBuild ? findRepoRoot2(dirname24(fileURLToPath(import.meta.url))) : dirname24(resolve19(options.pluginPath))));
|
|
93709
93872
|
const homeDir = options.homeDir ?? env.HOME ?? homedir11();
|
|
93710
93873
|
const agentDir = resolve19(options.agentDir ?? resolveAgentHome({ env, homeDir }));
|
|
93711
|
-
const pluginPath = resolve19(options.pluginPath ??
|
|
93874
|
+
const pluginPath = resolve19(options.pluginPath ?? join62(repoRoot, "packages", "omo-senpi", "plugin"));
|
|
93712
93875
|
return {
|
|
93713
93876
|
env,
|
|
93714
93877
|
repoRoot,
|
|
93715
93878
|
agentDir,
|
|
93716
93879
|
homeDir,
|
|
93717
|
-
settingsPath:
|
|
93880
|
+
settingsPath: join62(agentDir, "settings.json"),
|
|
93718
93881
|
pluginPath,
|
|
93719
93882
|
platform: options.platform ?? process.platform,
|
|
93720
93883
|
allowBuild,
|
|
@@ -93731,7 +93894,7 @@ async function defaultRunCommand3(command, args, options) {
|
|
|
93731
93894
|
function findRepoRoot2(importerDir) {
|
|
93732
93895
|
let current = importerDir;
|
|
93733
93896
|
for (let depth = 0;depth <= 7; depth += 1) {
|
|
93734
|
-
if (fileExistsSync(
|
|
93897
|
+
if (fileExistsSync(join62(current, "packages", "omo-senpi", "plugin", "package.json")))
|
|
93735
93898
|
return current;
|
|
93736
93899
|
current = resolve19(current, "..");
|
|
93737
93900
|
}
|
|
@@ -93774,20 +93937,20 @@ async function starGitHubRepositories(platform = "both", runCommand = runGitHubS
|
|
|
93774
93937
|
init_provider_availability();
|
|
93775
93938
|
|
|
93776
93939
|
// packages/omo-opencode/src/cli/config-manager/add-tui-plugin-to-tui-config.ts
|
|
93777
|
-
import { existsSync as existsSync32, mkdirSync as
|
|
93778
|
-
import { join as
|
|
93940
|
+
import { existsSync as existsSync32, mkdirSync as mkdirSync12, readFileSync as readFileSync15 } from "fs";
|
|
93941
|
+
import { join as join64 } from "path";
|
|
93779
93942
|
|
|
93780
93943
|
// packages/omo-opencode/src/cli/doctor/checks/tui-plugin-config.ts
|
|
93781
93944
|
init_shared();
|
|
93782
93945
|
import { existsSync as existsSync31, readFileSync as readFileSync14 } from "fs";
|
|
93783
|
-
import { join as
|
|
93946
|
+
import { join as join63 } from "path";
|
|
93784
93947
|
var TUI_SUBPATH = "tui";
|
|
93785
93948
|
var TUI_EXPORT_SUBPATH = `./${TUI_SUBPATH}`;
|
|
93786
93949
|
function fileEntryPackageJsonPath(entry) {
|
|
93787
93950
|
let path = entry.slice("file:".length);
|
|
93788
93951
|
if (path.startsWith("//"))
|
|
93789
93952
|
path = path.slice(2);
|
|
93790
|
-
return
|
|
93953
|
+
return join63(path, "package.json");
|
|
93791
93954
|
}
|
|
93792
93955
|
function packageJsonExportsTui(pkgJsonPath) {
|
|
93793
93956
|
if (!existsSync31(pkgJsonPath))
|
|
@@ -93825,7 +93988,7 @@ function packageExportsTuiForServerEntry(entry) {
|
|
|
93825
93988
|
const packageName = packageNameFromServerEntry(entry);
|
|
93826
93989
|
if (packageName === null)
|
|
93827
93990
|
return null;
|
|
93828
|
-
return packageJsonExportsTui(
|
|
93991
|
+
return packageJsonExportsTui(join63(getOpenCodeConfigDir({ binary: "opencode" }), "node_modules", packageName, "package.json"));
|
|
93829
93992
|
}
|
|
93830
93993
|
function isOurFilePluginEntry(entry) {
|
|
93831
93994
|
if (typeof entry !== "string" || !entry.startsWith("file:"))
|
|
@@ -93890,7 +94053,7 @@ function detectServerPluginRegistration() {
|
|
|
93890
94053
|
}
|
|
93891
94054
|
}
|
|
93892
94055
|
function detectTuiPluginRegistration() {
|
|
93893
|
-
const tuiJsonPath =
|
|
94056
|
+
const tuiJsonPath = join63(getOpenCodeConfigDir({ binary: "opencode" }), "tui.json");
|
|
93894
94057
|
if (!existsSync31(tuiJsonPath)) {
|
|
93895
94058
|
return {
|
|
93896
94059
|
registered: false,
|
|
@@ -94046,10 +94209,10 @@ function readConfig(path) {
|
|
|
94046
94209
|
return null;
|
|
94047
94210
|
}
|
|
94048
94211
|
function readServerConfig(configDir) {
|
|
94049
|
-
const jsoncPath =
|
|
94212
|
+
const jsoncPath = join64(configDir, "opencode.jsonc");
|
|
94050
94213
|
if (existsSync32(jsoncPath))
|
|
94051
94214
|
return readConfig(jsoncPath);
|
|
94052
|
-
const jsonPath =
|
|
94215
|
+
const jsonPath = join64(configDir, "opencode.json");
|
|
94053
94216
|
if (existsSync32(jsonPath))
|
|
94054
94217
|
return readConfig(jsonPath);
|
|
94055
94218
|
return null;
|
|
@@ -94091,7 +94254,7 @@ function ensureTuiPluginEntry(opts = {}) {
|
|
|
94091
94254
|
if (!desiredEntry) {
|
|
94092
94255
|
return { changed: false, reason: "no-server-entry" };
|
|
94093
94256
|
}
|
|
94094
|
-
const tuiJsonPath =
|
|
94257
|
+
const tuiJsonPath = join64(configDir, "tui.json");
|
|
94095
94258
|
const { config, malformed } = readTuiConfig(tuiJsonPath);
|
|
94096
94259
|
if (malformed) {
|
|
94097
94260
|
return { changed: false, reason: "malformed" };
|
|
@@ -94100,14 +94263,14 @@ function ensureTuiPluginEntry(opts = {}) {
|
|
|
94100
94263
|
if (plugins.includes(desiredEntry)) {
|
|
94101
94264
|
return { changed: false, reason: "already-present" };
|
|
94102
94265
|
}
|
|
94103
|
-
|
|
94266
|
+
mkdirSync12(configDir, { recursive: true });
|
|
94104
94267
|
writeFileAtomically2(tuiJsonPath, formatConfig({ ...config, plugin: [...plugins, desiredEntry] }));
|
|
94105
94268
|
return { changed: true, reason: "added" };
|
|
94106
94269
|
}
|
|
94107
94270
|
|
|
94108
94271
|
// packages/omo-opencode/src/cli/install-ast-grep-sg.ts
|
|
94109
94272
|
import { homedir as homedir12 } from "os";
|
|
94110
|
-
import { join as
|
|
94273
|
+
import { join as join65 } from "path";
|
|
94111
94274
|
|
|
94112
94275
|
// packages/shared-skills/index.mjs
|
|
94113
94276
|
import { existsSync as existsSync33 } from "fs";
|
|
@@ -94129,9 +94292,9 @@ function describeResult2(result) {
|
|
|
94129
94292
|
}
|
|
94130
94293
|
async function installAstGrepForOpenCode(options = {}) {
|
|
94131
94294
|
const platform = options.platform ?? process.platform;
|
|
94132
|
-
const baseDir =
|
|
94295
|
+
const baseDir = join65(options.homeDir ?? homedir12(), ".omo");
|
|
94133
94296
|
const targetDir = astGrepRuntimeDir(baseDir, platform, options.arch ?? process.arch);
|
|
94134
|
-
const skillDir =
|
|
94297
|
+
const skillDir = join65(options.sharedSkillsRoot ?? sharedSkillsRootPath(), "ast-grep");
|
|
94135
94298
|
const installer = options.installer ?? runAstGrepSkillInstall;
|
|
94136
94299
|
try {
|
|
94137
94300
|
const result = await installer({ platform, skillDir, targetDir });
|
|
@@ -97671,7 +97834,7 @@ function migrateRalphLoopConfig(config) {
|
|
|
97671
97834
|
function validatePluginConfig(directory, environment = process.env) {
|
|
97672
97835
|
const chain = loadOmoOpenCodeConfigChain(directory, environment);
|
|
97673
97836
|
const views = chain.views.map((view) => parseConfigView(view.path, view.config));
|
|
97674
|
-
const chainMessages = chain.diagnostics.map((diagnostic) => `${shortPath(diagnostic.path)}: ${diagnostic.message}`);
|
|
97837
|
+
const chainMessages = chain.diagnostics.filter((diagnostic) => diagnostic.kind !== "deprecated-keys").map((diagnostic) => `${shortPath(diagnostic.path)}: ${diagnostic.message}`);
|
|
97675
97838
|
const messages = [...chainMessages, ...views.flatMap((view) => view.messages)];
|
|
97676
97839
|
const firstFailingView = views.find((view) => view.messages.length > 0);
|
|
97677
97840
|
const firstView = views[0];
|
|
@@ -98352,9 +98515,9 @@ function readCurrentTopLevelTask(planPath) {
|
|
|
98352
98515
|
}
|
|
98353
98516
|
// packages/boulder-state/src/storage/path.ts
|
|
98354
98517
|
import { existsSync as existsSync35 } from "fs";
|
|
98355
|
-
import { isAbsolute as isAbsolute12, join as
|
|
98518
|
+
import { isAbsolute as isAbsolute12, join as join66, relative as relative8, resolve as resolve20 } from "path";
|
|
98356
98519
|
function getBoulderFilePath(directory) {
|
|
98357
|
-
return
|
|
98520
|
+
return join66(directory, BOULDER_DIR, BOULDER_FILE);
|
|
98358
98521
|
}
|
|
98359
98522
|
function resolveTrackedPath(baseDirectory, trackedPath) {
|
|
98360
98523
|
return isAbsolute12(trackedPath) ? resolve20(trackedPath) : resolve20(baseDirectory, trackedPath);
|
|
@@ -98378,7 +98541,7 @@ function resolveBoulderPlanPathForWork(directory, work) {
|
|
|
98378
98541
|
return resolveBoulderPlanPath(directory, work);
|
|
98379
98542
|
}
|
|
98380
98543
|
// packages/boulder-state/src/storage/plan-progress.ts
|
|
98381
|
-
import { existsSync as existsSync36, readFileSync as readFileSync17, readdirSync as
|
|
98544
|
+
import { existsSync as existsSync36, readFileSync as readFileSync17, readdirSync as readdirSync8, statSync as statSync4 } from "fs";
|
|
98382
98545
|
function getPlanProgress(planPath) {
|
|
98383
98546
|
if (!existsSync36(planPath)) {
|
|
98384
98547
|
return { total: 0, completed: 0, isComplete: false };
|
|
@@ -98538,10 +98701,10 @@ init_state();
|
|
|
98538
98701
|
// packages/omo-opencode/src/features/run-continuation-state/constants.ts
|
|
98539
98702
|
var CONTINUATION_MARKER_DIR = ".omo/run-continuation";
|
|
98540
98703
|
// packages/omo-opencode/src/features/run-continuation-state/storage.ts
|
|
98541
|
-
import { existsSync as existsSync38, mkdirSync as
|
|
98542
|
-
import { join as
|
|
98704
|
+
import { existsSync as existsSync38, mkdirSync as mkdirSync13, readFileSync as readFileSync19, rmSync as rmSync4, writeFileSync as writeFileSync7 } from "fs";
|
|
98705
|
+
import { join as join67 } from "path";
|
|
98543
98706
|
function getMarkerPath(directory, sessionID) {
|
|
98544
|
-
return
|
|
98707
|
+
return join67(directory, CONTINUATION_MARKER_DIR, `${sessionID}.json`);
|
|
98545
98708
|
}
|
|
98546
98709
|
function readContinuationMarker(directory, sessionID) {
|
|
98547
98710
|
const markerPath = getMarkerPath(directory, sessionID);
|
|
@@ -98613,8 +98776,8 @@ async function isSessionInBoulderLineage(input) {
|
|
|
98613
98776
|
// packages/omo-opencode/src/hooks/atlas/session-last-agent.ts
|
|
98614
98777
|
init_shared();
|
|
98615
98778
|
init_compaction_marker();
|
|
98616
|
-
import { readFileSync as readFileSync20, readdirSync as
|
|
98617
|
-
import { join as
|
|
98779
|
+
import { readFileSync as readFileSync20, readdirSync as readdirSync9 } from "fs";
|
|
98780
|
+
import { join as join68 } from "path";
|
|
98618
98781
|
var defaultSessionLastAgentDeps = {
|
|
98619
98782
|
getMessageDir,
|
|
98620
98783
|
isSqliteBackend,
|
|
@@ -98672,9 +98835,9 @@ async function getLastAgentFromSession(sessionID, client, deps = {}) {
|
|
|
98672
98835
|
if (!messageDir)
|
|
98673
98836
|
return null;
|
|
98674
98837
|
try {
|
|
98675
|
-
const messages =
|
|
98838
|
+
const messages = readdirSync9(messageDir).filter((fileName) => fileName.endsWith(".json")).map((fileName) => {
|
|
98676
98839
|
try {
|
|
98677
|
-
const content = readFileSync20(
|
|
98840
|
+
const content = readFileSync20(join68(messageDir, fileName), "utf-8");
|
|
98678
98841
|
const parsed = JSON.parse(content);
|
|
98679
98842
|
return {
|
|
98680
98843
|
fileName,
|
|
@@ -98717,8 +98880,8 @@ init_agent_display_names();
|
|
|
98717
98880
|
|
|
98718
98881
|
// packages/omo-opencode/src/hooks/ralph-loop/storage.ts
|
|
98719
98882
|
init_frontmatter2();
|
|
98720
|
-
import { existsSync as existsSync39, readFileSync as readFileSync21, writeFileSync as writeFileSync8, unlinkSync as unlinkSync6, mkdirSync as
|
|
98721
|
-
import { dirname as dirname26, join as
|
|
98883
|
+
import { existsSync as existsSync39, readFileSync as readFileSync21, writeFileSync as writeFileSync8, unlinkSync as unlinkSync6, mkdirSync as mkdirSync14 } from "fs";
|
|
98884
|
+
import { dirname as dirname26, join as join69 } from "path";
|
|
98722
98885
|
|
|
98723
98886
|
// packages/omo-opencode/src/hooks/ralph-loop/constants.ts
|
|
98724
98887
|
var DEFAULT_STATE_FILE = ".omo/ralph-loop.local.md";
|
|
@@ -98727,7 +98890,7 @@ var DEFAULT_COMPLETION_PROMISE = "DONE";
|
|
|
98727
98890
|
|
|
98728
98891
|
// packages/omo-opencode/src/hooks/ralph-loop/storage.ts
|
|
98729
98892
|
function getStateFilePath(directory, customPath) {
|
|
98730
|
-
return customPath ?
|
|
98893
|
+
return customPath ? join69(directory, customPath) : join69(directory, DEFAULT_STATE_FILE);
|
|
98731
98894
|
}
|
|
98732
98895
|
function readState(directory, customPath) {
|
|
98733
98896
|
const filePath = getStateFilePath(directory, customPath);
|
|
@@ -99834,7 +99997,7 @@ init_extract_semver();
|
|
|
99834
99997
|
init_bun_which_shim();
|
|
99835
99998
|
import { existsSync as existsSync47, accessSync as accessSync4, constants as constants12 } from "fs";
|
|
99836
99999
|
import { homedir as homedir15 } from "os";
|
|
99837
|
-
import { join as
|
|
100000
|
+
import { join as join76 } from "path";
|
|
99838
100001
|
|
|
99839
100002
|
// packages/omo-opencode/src/cli/doctor/framework/spawn-with-timeout.ts
|
|
99840
100003
|
init_spawn_with_windows_hide();
|
|
@@ -99926,17 +100089,17 @@ function getDesktopAppPaths(platform) {
|
|
|
99926
100089
|
case "darwin":
|
|
99927
100090
|
return [
|
|
99928
100091
|
"/Applications/OpenCode.app/Contents/MacOS/OpenCode",
|
|
99929
|
-
|
|
100092
|
+
join76(home, "Applications", "OpenCode.app", "Contents", "MacOS", "OpenCode")
|
|
99930
100093
|
];
|
|
99931
100094
|
case "win32": {
|
|
99932
100095
|
const programFiles = process.env.ProgramFiles;
|
|
99933
100096
|
const localAppData = process.env.LOCALAPPDATA;
|
|
99934
100097
|
const paths = [];
|
|
99935
100098
|
if (programFiles) {
|
|
99936
|
-
paths.push(
|
|
100099
|
+
paths.push(join76(programFiles, "OpenCode", "OpenCode.exe"));
|
|
99937
100100
|
}
|
|
99938
100101
|
if (localAppData) {
|
|
99939
|
-
paths.push(
|
|
100102
|
+
paths.push(join76(localAppData, "OpenCode", "OpenCode.exe"));
|
|
99940
100103
|
}
|
|
99941
100104
|
return paths;
|
|
99942
100105
|
}
|
|
@@ -99944,8 +100107,8 @@ function getDesktopAppPaths(platform) {
|
|
|
99944
100107
|
return [
|
|
99945
100108
|
"/usr/bin/opencode",
|
|
99946
100109
|
"/usr/lib/opencode/opencode",
|
|
99947
|
-
|
|
99948
|
-
|
|
100110
|
+
join76(home, "Applications", "opencode-desktop-linux-x86_64.AppImage"),
|
|
100111
|
+
join76(home, "Applications", "opencode-desktop-linux-aarch64.AppImage")
|
|
99949
100112
|
];
|
|
99950
100113
|
default:
|
|
99951
100114
|
return [];
|
|
@@ -99977,7 +100140,7 @@ async function findOpenCodeBinary(platform = process.platform, checkExists = exi
|
|
|
99977
100140
|
const candidates = getCommandCandidates2(platform);
|
|
99978
100141
|
for (const entry of pathEnv.split(delimiter).filter(Boolean)) {
|
|
99979
100142
|
for (const command of candidates) {
|
|
99980
|
-
const fullPath =
|
|
100143
|
+
const fullPath = join76(entry, command);
|
|
99981
100144
|
if (checkExists(fullPath) && isExecutable2(fullPath)) {
|
|
99982
100145
|
return { binary: command, path: fullPath };
|
|
99983
100146
|
}
|
|
@@ -100118,25 +100281,25 @@ init_file_utils2();
|
|
|
100118
100281
|
init_checker();
|
|
100119
100282
|
init_auto_update_checker();
|
|
100120
100283
|
init_package_json_locator();
|
|
100121
|
-
import { existsSync as existsSync49, readFileSync as readFileSync30, readdirSync as
|
|
100284
|
+
import { existsSync as existsSync49, readFileSync as readFileSync30, readdirSync as readdirSync11 } from "fs";
|
|
100122
100285
|
import { createRequire } from "module";
|
|
100123
100286
|
import { homedir as homedir16 } from "os";
|
|
100124
|
-
import { join as
|
|
100287
|
+
import { join as join77 } from "path";
|
|
100125
100288
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
100126
100289
|
init_shared();
|
|
100127
100290
|
function getPlatformDefaultCacheDir(platform = process.platform) {
|
|
100128
100291
|
if (platform === "darwin")
|
|
100129
|
-
return
|
|
100292
|
+
return join77(homedir16(), "Library", "Caches");
|
|
100130
100293
|
if (platform === "win32")
|
|
100131
|
-
return process.env.LOCALAPPDATA ??
|
|
100132
|
-
return
|
|
100294
|
+
return process.env.LOCALAPPDATA ?? join77(homedir16(), "AppData", "Local");
|
|
100295
|
+
return join77(homedir16(), ".cache");
|
|
100133
100296
|
}
|
|
100134
100297
|
function resolveOpenCodeCacheDir() {
|
|
100135
100298
|
const xdgCacheHome = process.env.XDG_CACHE_HOME;
|
|
100136
100299
|
if (xdgCacheHome)
|
|
100137
|
-
return
|
|
100300
|
+
return join77(xdgCacheHome, "opencode");
|
|
100138
100301
|
const fromShared = getOpenCodeCacheDir();
|
|
100139
|
-
const platformDefault =
|
|
100302
|
+
const platformDefault = join77(getPlatformDefaultCacheDir(), "opencode");
|
|
100140
100303
|
if (existsSync49(fromShared) || !existsSync49(platformDefault))
|
|
100141
100304
|
return fromShared;
|
|
100142
100305
|
return platformDefault;
|
|
@@ -100168,26 +100331,26 @@ function normalizeVersion(value) {
|
|
|
100168
100331
|
function createPackageCandidates(rootDir) {
|
|
100169
100332
|
return ACCEPTED_PACKAGE_NAMES.map((packageName) => ({
|
|
100170
100333
|
packageName,
|
|
100171
|
-
installedPackagePath:
|
|
100334
|
+
installedPackagePath: join77(rootDir, "node_modules", packageName, "package.json")
|
|
100172
100335
|
}));
|
|
100173
100336
|
}
|
|
100174
100337
|
function createTaggedInstallCandidates(rootDir) {
|
|
100175
|
-
const packagesDir =
|
|
100338
|
+
const packagesDir = join77(rootDir, "packages");
|
|
100176
100339
|
if (!existsSync49(packagesDir))
|
|
100177
100340
|
return [];
|
|
100178
100341
|
const candidates = [];
|
|
100179
|
-
for (const entryName of
|
|
100342
|
+
for (const entryName of readdirSync11(packagesDir).sort()) {
|
|
100180
100343
|
const packageName = ACCEPTED_PACKAGE_NAMES.find((name) => entryName.startsWith(`${name}@`));
|
|
100181
100344
|
if (packageName === undefined)
|
|
100182
100345
|
continue;
|
|
100183
|
-
const installDir =
|
|
100346
|
+
const installDir = join77(packagesDir, entryName);
|
|
100184
100347
|
candidates.push({
|
|
100185
100348
|
cacheDir: installDir,
|
|
100186
|
-
cachePackagePath:
|
|
100349
|
+
cachePackagePath: join77(installDir, "package.json"),
|
|
100187
100350
|
packageCandidates: [
|
|
100188
100351
|
{
|
|
100189
100352
|
packageName,
|
|
100190
|
-
installedPackagePath:
|
|
100353
|
+
installedPackagePath: join77(installDir, "node_modules", packageName, "package.json")
|
|
100191
100354
|
}
|
|
100192
100355
|
]
|
|
100193
100356
|
});
|
|
@@ -100232,13 +100395,13 @@ function getLoadedPluginVersion() {
|
|
|
100232
100395
|
const candidates = [
|
|
100233
100396
|
{
|
|
100234
100397
|
cacheDir: configDir,
|
|
100235
|
-
cachePackagePath:
|
|
100398
|
+
cachePackagePath: join77(configDir, "package.json"),
|
|
100236
100399
|
packageCandidates: createPackageCandidates(configDir)
|
|
100237
100400
|
},
|
|
100238
100401
|
...createTaggedInstallCandidates(configDir),
|
|
100239
100402
|
{
|
|
100240
100403
|
cacheDir,
|
|
100241
|
-
cachePackagePath:
|
|
100404
|
+
cachePackagePath: join77(cacheDir, "package.json"),
|
|
100242
100405
|
packageCandidates: createPackageCandidates(cacheDir)
|
|
100243
100406
|
},
|
|
100244
100407
|
...createTaggedInstallCandidates(cacheDir)
|
|
@@ -100431,18 +100594,18 @@ async function checkSystem(deps = defaultDeps5) {
|
|
|
100431
100594
|
init_shared();
|
|
100432
100595
|
import { existsSync as existsSync51, readFileSync as readFileSync32 } from "fs";
|
|
100433
100596
|
import { homedir as homedir17 } from "os";
|
|
100434
|
-
import { join as
|
|
100597
|
+
import { join as join78 } from "path";
|
|
100435
100598
|
function getUserConfigDir2() {
|
|
100436
100599
|
const xdgConfig = process.env.XDG_CONFIG_HOME;
|
|
100437
100600
|
if (xdgConfig)
|
|
100438
|
-
return
|
|
100439
|
-
return
|
|
100601
|
+
return join78(xdgConfig, "opencode");
|
|
100602
|
+
return join78(homedir17(), ".config", "opencode");
|
|
100440
100603
|
}
|
|
100441
100604
|
function loadCustomProviderNames() {
|
|
100442
100605
|
const configDir = getUserConfigDir2();
|
|
100443
100606
|
const candidatePaths = [
|
|
100444
|
-
|
|
100445
|
-
|
|
100607
|
+
join78(configDir, "opencode.json"),
|
|
100608
|
+
join78(configDir, "opencode.jsonc")
|
|
100446
100609
|
];
|
|
100447
100610
|
for (const configPath of candidatePaths) {
|
|
100448
100611
|
if (!existsSync51(configPath))
|
|
@@ -100463,7 +100626,7 @@ function loadCustomProviderNames() {
|
|
|
100463
100626
|
return [];
|
|
100464
100627
|
}
|
|
100465
100628
|
function loadAvailableModelsFromCache() {
|
|
100466
|
-
const cacheFile =
|
|
100629
|
+
const cacheFile = join78(getOpenCodeCacheDir(), "models.json");
|
|
100467
100630
|
const customProviders = loadCustomProviderNames();
|
|
100468
100631
|
if (!existsSync51(cacheFile)) {
|
|
100469
100632
|
if (customProviders.length > 0) {
|
|
@@ -100525,7 +100688,7 @@ function loadOmoConfig2() {
|
|
|
100525
100688
|
|
|
100526
100689
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-details.ts
|
|
100527
100690
|
init_shared();
|
|
100528
|
-
import { join as
|
|
100691
|
+
import { join as join79 } from "path";
|
|
100529
100692
|
|
|
100530
100693
|
// packages/omo-opencode/src/cli/doctor/checks/model-resolution-variant.ts
|
|
100531
100694
|
function formatModelWithVariant(model, variant) {
|
|
@@ -100567,7 +100730,7 @@ function formatCapabilityResolutionLabel(mode) {
|
|
|
100567
100730
|
}
|
|
100568
100731
|
function buildModelResolutionDetails(options) {
|
|
100569
100732
|
const details = [];
|
|
100570
|
-
const cacheFile =
|
|
100733
|
+
const cacheFile = join79(getOpenCodeCacheDir(), "models.json");
|
|
100571
100734
|
details.push("\u2550\u2550\u2550 Available Models (from cache) \u2550\u2550\u2550");
|
|
100572
100735
|
details.push("");
|
|
100573
100736
|
if (options.available.cacheExists) {
|
|
@@ -100908,7 +101071,7 @@ init_src4();
|
|
|
100908
101071
|
init_main();
|
|
100909
101072
|
init_config_migration();
|
|
100910
101073
|
import { existsSync as existsSync52, readFileSync as readFileSync33 } from "fs";
|
|
100911
|
-
import { join as
|
|
101074
|
+
import { join as join80 } from "path";
|
|
100912
101075
|
var CANONICAL_REPLACEMENT = new Map([
|
|
100913
101076
|
["variant", "reasoning"],
|
|
100914
101077
|
["reasoningEffort", "reasoning"],
|
|
@@ -100919,14 +101082,14 @@ var CANONICAL_REPLACEMENT = new Map([
|
|
|
100919
101082
|
var MIGRATE_SUFFIX = ", or run: oh-my-openagent config migrate";
|
|
100920
101083
|
var TUNING_CONTAINERS = new Set(["agents", "categories", "models"]);
|
|
100921
101084
|
var PASSTHROUGH_CONTAINERS = new Set(["provider_options", "providerOptions"]);
|
|
100922
|
-
function
|
|
101085
|
+
function isRecord15(value) {
|
|
100923
101086
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
100924
101087
|
}
|
|
100925
101088
|
function isHarnessBlock(key) {
|
|
100926
101089
|
return key.startsWith("[") && key.endsWith("]");
|
|
100927
101090
|
}
|
|
100928
101091
|
function collectIssues(configPath, value, prefix, fixSuffix) {
|
|
100929
|
-
if (!
|
|
101092
|
+
if (!isRecord15(value))
|
|
100930
101093
|
return [];
|
|
100931
101094
|
const issues = [];
|
|
100932
101095
|
for (const [key, child] of Object.entries(value)) {
|
|
@@ -100942,7 +101105,7 @@ function collectIssues(configPath, value, prefix, fixSuffix) {
|
|
|
100942
101105
|
});
|
|
100943
101106
|
continue;
|
|
100944
101107
|
}
|
|
100945
|
-
if (!
|
|
101108
|
+
if (!isRecord15(child))
|
|
100946
101109
|
continue;
|
|
100947
101110
|
if (PASSTHROUGH_CONTAINERS.has(key))
|
|
100948
101111
|
continue;
|
|
@@ -100961,7 +101124,7 @@ function collectIssues(configPath, value, prefix, fixSuffix) {
|
|
|
100961
101124
|
return issues;
|
|
100962
101125
|
}
|
|
100963
101126
|
function migrateFixSuffix(parsed) {
|
|
100964
|
-
if (
|
|
101127
|
+
if (isRecord15(parsed) && hasMigrationMarker(parsed, REASONING_UNIFICATION_MIGRATION_ID))
|
|
100965
101128
|
return "";
|
|
100966
101129
|
return MIGRATE_SUFFIX;
|
|
100967
101130
|
}
|
|
@@ -100969,7 +101132,7 @@ function userConfigPaths() {
|
|
|
100969
101132
|
const home = process.env.HOME ?? process.env.USERPROFILE;
|
|
100970
101133
|
if (home === undefined || home.length === 0)
|
|
100971
101134
|
return [];
|
|
100972
|
-
return [
|
|
101135
|
+
return [join80(home, ".omo", "omo.jsonc"), join80(home, ".omo", "omo.json")];
|
|
100973
101136
|
}
|
|
100974
101137
|
async function checkDeprecatedReasoningKeys() {
|
|
100975
101138
|
const issues = [];
|
|
@@ -100995,25 +101158,25 @@ init_src();
|
|
|
100995
101158
|
import { existsSync as existsSync53 } from "fs";
|
|
100996
101159
|
import { createRequire as createRequire2 } from "module";
|
|
100997
101160
|
import { homedir as homedir19 } from "os";
|
|
100998
|
-
import { dirname as dirname31, join as
|
|
101161
|
+
import { dirname as dirname31, join as join82 } from "path";
|
|
100999
101162
|
|
|
101000
101163
|
// packages/omo-opencode/src/hooks/comment-checker/downloader.ts
|
|
101001
101164
|
init_binary_downloader();
|
|
101002
101165
|
init_logger2();
|
|
101003
101166
|
init_plugin_identity();
|
|
101004
|
-
import { join as
|
|
101167
|
+
import { join as join81 } from "path";
|
|
101005
101168
|
import { homedir as homedir18, tmpdir as tmpdir4 } from "os";
|
|
101006
101169
|
var DEBUG = process.env.COMMENT_CHECKER_DEBUG === "1";
|
|
101007
|
-
var DEBUG_FILE =
|
|
101170
|
+
var DEBUG_FILE = join81(tmpdir4(), "comment-checker-debug.log");
|
|
101008
101171
|
function getCacheDir2() {
|
|
101009
101172
|
if (process.platform === "win32") {
|
|
101010
101173
|
const localAppData = process.env.LOCALAPPDATA || process.env.APPDATA;
|
|
101011
|
-
const base = localAppData ||
|
|
101012
|
-
return
|
|
101174
|
+
const base = localAppData || join81(homedir18(), "AppData", "Local");
|
|
101175
|
+
return join81(base, CACHE_DIR_NAME, "bin");
|
|
101013
101176
|
}
|
|
101014
101177
|
const xdgCache = process.env.XDG_CACHE_HOME;
|
|
101015
|
-
const base = xdgCache ||
|
|
101016
|
-
return
|
|
101178
|
+
const base = xdgCache || join81(homedir18(), ".cache");
|
|
101179
|
+
return join81(base, CACHE_DIR_NAME, "bin");
|
|
101017
101180
|
}
|
|
101018
101181
|
function getBinaryName() {
|
|
101019
101182
|
return process.platform === "win32" ? "comment-checker.exe" : "comment-checker";
|
|
@@ -101063,7 +101226,7 @@ async function getBinaryVersion(binary) {
|
|
|
101063
101226
|
}
|
|
101064
101227
|
}
|
|
101065
101228
|
async function checkAstGrepCli() {
|
|
101066
|
-
const runtimeDir = astGrepRuntimeDir(
|
|
101229
|
+
const runtimeDir = astGrepRuntimeDir(join82(homedir19(), ".omo"));
|
|
101067
101230
|
const sgPath = findSgBinarySync({ runtimeDir });
|
|
101068
101231
|
if (sgPath === null) {
|
|
101069
101232
|
return {
|
|
@@ -101093,10 +101256,10 @@ function findCommentCheckerPackageBinary(baseDirOverride, resolvePackageJsonPath
|
|
|
101093
101256
|
const platformKey = `${process.platform}-${process.arch === "x64" ? "x64" : process.arch}`;
|
|
101094
101257
|
try {
|
|
101095
101258
|
const packageDir = baseDirOverride ?? dirname31(resolvePackageJsonPath());
|
|
101096
|
-
const vendorPath =
|
|
101259
|
+
const vendorPath = join82(packageDir, "vendor", platformKey, binaryName);
|
|
101097
101260
|
if (existsSync53(vendorPath))
|
|
101098
101261
|
return vendorPath;
|
|
101099
|
-
const binPath =
|
|
101262
|
+
const binPath = join82(packageDir, "bin", binaryName);
|
|
101100
101263
|
if (existsSync53(binPath))
|
|
101101
101264
|
return binPath;
|
|
101102
101265
|
} catch (error) {
|
|
@@ -101472,13 +101635,13 @@ function getInstalledLspServers(options = {}) {
|
|
|
101472
101635
|
init_shared();
|
|
101473
101636
|
import { existsSync as existsSync55, readFileSync as readFileSync35 } from "fs";
|
|
101474
101637
|
import { homedir as homedir20 } from "os";
|
|
101475
|
-
import { join as
|
|
101638
|
+
import { join as join83 } from "path";
|
|
101476
101639
|
var BUILTIN_MCP_SERVERS = ["websearch", "context7", "grep_app", "lsp"];
|
|
101477
101640
|
function getMcpConfigPaths() {
|
|
101478
101641
|
return [
|
|
101479
|
-
|
|
101480
|
-
|
|
101481
|
-
|
|
101642
|
+
join83(homedir20(), ".claude", ".mcp.json"),
|
|
101643
|
+
join83(process.cwd(), ".mcp.json"),
|
|
101644
|
+
join83(process.cwd(), ".claude", ".mcp.json")
|
|
101482
101645
|
];
|
|
101483
101646
|
}
|
|
101484
101647
|
function loadUserMcpConfig() {
|
|
@@ -101760,7 +101923,7 @@ init_src();
|
|
|
101760
101923
|
import { existsSync as existsSync57 } from "fs";
|
|
101761
101924
|
import { lstat as lstat16, readdir as readdir14, readFile as readFile28 } from "fs/promises";
|
|
101762
101925
|
import { homedir as homedir22 } from "os";
|
|
101763
|
-
import { basename as basename11, join as
|
|
101926
|
+
import { basename as basename11, join as join84, resolve as resolve23 } from "path";
|
|
101764
101927
|
// packages/omo-opencode/package.json
|
|
101765
101928
|
var package_default3 = {
|
|
101766
101929
|
name: "@oh-my-opencode/omo-opencode",
|
|
@@ -101826,13 +101989,13 @@ var CODEX_BIN_NAMES = [
|
|
|
101826
101989
|
"omo-git-bash-hook"
|
|
101827
101990
|
];
|
|
101828
101991
|
async function gatherCodexSummary(deps = {}) {
|
|
101829
|
-
const codexHome = resolve23(deps.codexHome ?? process.env.CODEX_HOME ??
|
|
101992
|
+
const codexHome = resolve23(deps.codexHome ?? process.env.CODEX_HOME ?? join84(homedir22(), ".codex"));
|
|
101830
101993
|
const binDir = resolveCodexInstallerBinDir({ binDir: deps.binDir, codexHome, env: process.env });
|
|
101831
101994
|
const detection = await (deps.detectCodexInstallation ?? detectCodexInstallation)();
|
|
101832
101995
|
const pluginRoot = await resolveInstalledPluginRoot(codexHome);
|
|
101833
|
-
const manifest = pluginRoot === null ? null : await readJson(
|
|
101834
|
-
const installSnapshot = pluginRoot === null ? null : await readJson(
|
|
101835
|
-
const configPath =
|
|
101996
|
+
const manifest = pluginRoot === null ? null : await readJson(join84(pluginRoot, ".codex-plugin", "plugin.json"));
|
|
101997
|
+
const installSnapshot = pluginRoot === null ? null : await readJson(join84(pluginRoot, "lazycodex-install.json"));
|
|
101998
|
+
const configPath = join84(codexHome, "config.toml");
|
|
101836
101999
|
const pluginVersion = stringField(manifest, "version");
|
|
101837
102000
|
return {
|
|
101838
102001
|
codexPath: detection.found && "path" in detection ? detection.path : null,
|
|
@@ -101889,7 +102052,7 @@ function buildCodexIssues(summary) {
|
|
|
101889
102052
|
if (summary.pluginRoot === null) {
|
|
101890
102053
|
issues.push({
|
|
101891
102054
|
title: "OMO Codex plugin is not installed",
|
|
101892
|
-
description: `Expected cached plugin at ${
|
|
102055
|
+
description: `Expected cached plugin at ${join84("plugins", "cache", MARKETPLACE_NAME, PLUGIN_NAME2, DEFAULT_PLUGIN_VERSION)} under CODEX_HOME.`,
|
|
101893
102056
|
fix: "Run: npx lazycodex-ai install",
|
|
101894
102057
|
severity: "error",
|
|
101895
102058
|
affects: ["plugin loading"]
|
|
@@ -101954,12 +102117,12 @@ function buildCodexIssues(summary) {
|
|
|
101954
102117
|
return issues;
|
|
101955
102118
|
}
|
|
101956
102119
|
async function resolveInstalledPluginRoot(codexHome) {
|
|
101957
|
-
const pluginRoot =
|
|
102120
|
+
const pluginRoot = join84(codexHome, "plugins", "cache", MARKETPLACE_NAME, PLUGIN_NAME2);
|
|
101958
102121
|
if (!existsSync57(pluginRoot))
|
|
101959
102122
|
return null;
|
|
101960
102123
|
const versions = await readdir14(pluginRoot, { withFileTypes: true });
|
|
101961
102124
|
const candidates = versions.filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort(compareVersionsDescending);
|
|
101962
|
-
return candidates.length === 0 ? null :
|
|
102125
|
+
return candidates.length === 0 ? null : join84(pluginRoot, candidates[0] ?? DEFAULT_PLUGIN_VERSION);
|
|
101963
102126
|
}
|
|
101964
102127
|
async function readCodexConfigSummary(configPath) {
|
|
101965
102128
|
if (!existsSync57(configPath)) {
|
|
@@ -101987,13 +102150,13 @@ async function readCodexConfigSummary(configPath) {
|
|
|
101987
102150
|
async function readLinkedBins(binDir) {
|
|
101988
102151
|
const linked = [];
|
|
101989
102152
|
for (const name of CODEX_BIN_NAMES) {
|
|
101990
|
-
if (await pathExists2(
|
|
102153
|
+
if (await pathExists2(join84(binDir, process.platform === "win32" ? `${name}.cmd` : name)))
|
|
101991
102154
|
linked.push(name);
|
|
101992
102155
|
}
|
|
101993
102156
|
return linked;
|
|
101994
102157
|
}
|
|
101995
102158
|
async function readLinkedAgents(codexHome) {
|
|
101996
|
-
const agentsDir =
|
|
102159
|
+
const agentsDir = join84(codexHome, "agents");
|
|
101997
102160
|
if (!existsSync57(agentsDir))
|
|
101998
102161
|
return [];
|
|
101999
102162
|
const entries = await readdir14(agentsDir, { withFileTypes: true });
|
|
@@ -102127,7 +102290,7 @@ function resolveLatestVersion(input) {
|
|
|
102127
102290
|
init_src();
|
|
102128
102291
|
import { readdir as readdir15, readFile as readFile29, stat as stat7 } from "fs/promises";
|
|
102129
102292
|
import { homedir as homedir23 } from "os";
|
|
102130
|
-
import { dirname as dirname33, isAbsolute as isAbsolute13, join as
|
|
102293
|
+
import { dirname as dirname33, isAbsolute as isAbsolute13, join as join85, relative as relative9, resolve as resolve24, sep as sep9 } from "path";
|
|
102131
102294
|
var CODEX_COMPONENTS_CHECK_ID = "codex-components";
|
|
102132
102295
|
var CODEX_COMPONENTS_CHECK_NAME = "codex-components";
|
|
102133
102296
|
var PLUGIN_DATA_DIR_NAME = "omo-sisyphuslabs";
|
|
@@ -102137,7 +102300,7 @@ async function checkCodexComponents(deps = {}) {
|
|
|
102137
102300
|
const env = deps.env ?? process.env;
|
|
102138
102301
|
const platform = deps.platform ?? process.platform;
|
|
102139
102302
|
const arch = deps.arch ?? process.arch;
|
|
102140
|
-
const codexHome = resolve24(deps.codexHome ?? env["CODEX_HOME"] ??
|
|
102303
|
+
const codexHome = resolve24(deps.codexHome ?? env["CODEX_HOME"] ?? join85(homedir23(), ".codex"));
|
|
102141
102304
|
const summary = await gatherCodexSummary({ ...deps, codexHome });
|
|
102142
102305
|
if (summary.pluginRoot === null) {
|
|
102143
102306
|
return {
|
|
@@ -102162,7 +102325,7 @@ async function checkCodexComponents(deps = {}) {
|
|
|
102162
102325
|
});
|
|
102163
102326
|
}
|
|
102164
102327
|
const runtimeSgDir = runtimeSgDirectory(codexHome, platform, arch);
|
|
102165
|
-
const runtimeSgPath =
|
|
102328
|
+
const runtimeSgPath = join85(runtimeSgDir, sgBinaryName(platform));
|
|
102166
102329
|
const sg = findSgBinarySync({
|
|
102167
102330
|
arch,
|
|
102168
102331
|
env,
|
|
@@ -102199,12 +102362,12 @@ async function auditBundleTargets(pluginRoot) {
|
|
|
102199
102362
|
let referencedCount = 0;
|
|
102200
102363
|
for (const manifestPath of await findManifestPaths(pluginRoot, ".mcp.json")) {
|
|
102201
102364
|
const manifest = await readJson2(manifestPath);
|
|
102202
|
-
if (manifest === null || !
|
|
102365
|
+
if (manifest === null || !isRecord16(manifest["mcpServers"]))
|
|
102203
102366
|
continue;
|
|
102204
102367
|
const manifestRoot = dirname33(manifestPath);
|
|
102205
102368
|
const isRootManifest = resolve24(manifestRoot) === resolve24(pluginRoot);
|
|
102206
102369
|
for (const server of Object.values(manifest["mcpServers"])) {
|
|
102207
|
-
if (!
|
|
102370
|
+
if (!isRecord16(server) || !Array.isArray(server["args"]))
|
|
102208
102371
|
continue;
|
|
102209
102372
|
for (const arg of server["args"]) {
|
|
102210
102373
|
if (typeof arg !== "string" || !isPluginRuntimePathArg(arg))
|
|
@@ -102274,7 +102437,7 @@ async function findManifestPaths(root, manifestName) {
|
|
|
102274
102437
|
for (const entry of entries) {
|
|
102275
102438
|
if (entry.name === "node_modules" || entry.name === ".git")
|
|
102276
102439
|
continue;
|
|
102277
|
-
const entryPath =
|
|
102440
|
+
const entryPath = join85(root, entry.name);
|
|
102278
102441
|
if (entry.isDirectory()) {
|
|
102279
102442
|
paths.push(...await findManifestPaths(entryPath, manifestName));
|
|
102280
102443
|
continue;
|
|
@@ -102290,7 +102453,7 @@ function collectHookCommands(value, commands) {
|
|
|
102290
102453
|
collectHookCommands(item, commands);
|
|
102291
102454
|
return;
|
|
102292
102455
|
}
|
|
102293
|
-
if (!
|
|
102456
|
+
if (!isRecord16(value))
|
|
102294
102457
|
return;
|
|
102295
102458
|
if (value["type"] === "command") {
|
|
102296
102459
|
if (typeof value["command"] === "string")
|
|
@@ -102318,18 +102481,18 @@ function isPluginRuntimePathArg(arg) {
|
|
|
102318
102481
|
return normalized.endsWith(".js") && normalized.includes("/dist/") && (normalized.startsWith("./") || normalized.startsWith("../") || normalized.startsWith("components/") || normalized.startsWith("/") || isAbsolute13(arg));
|
|
102319
102482
|
}
|
|
102320
102483
|
function runtimeSgDirectory(codexHome, platform, arch) {
|
|
102321
|
-
return
|
|
102484
|
+
return join85(codexHome, "runtime", "ast-grep", runtimeSlug(platform, arch));
|
|
102322
102485
|
}
|
|
102323
102486
|
function describeSgSource(sgPath, env, runtimeSgDir, platform) {
|
|
102324
102487
|
const override = env[SG_PATH_ENV_KEY]?.trim();
|
|
102325
102488
|
if (override !== undefined && override.length > 0 && sgPath === override)
|
|
102326
102489
|
return `env override ${SG_PATH_ENV_KEY}`;
|
|
102327
|
-
if (sgPath ===
|
|
102490
|
+
if (sgPath === join85(runtimeSgDir, sgBinaryName(platform)))
|
|
102328
102491
|
return "runtime dir";
|
|
102329
102492
|
return "PATH";
|
|
102330
102493
|
}
|
|
102331
102494
|
async function readBootstrapStateSummary(codexHome) {
|
|
102332
|
-
const statePath =
|
|
102495
|
+
const statePath = join85(codexHome, "plugins", "data", PLUGIN_DATA_DIR_NAME, "bootstrap", "state.json");
|
|
102333
102496
|
const raw = await readJson2(statePath);
|
|
102334
102497
|
if (raw === null)
|
|
102335
102498
|
return null;
|
|
@@ -102345,7 +102508,7 @@ function parseDegradedEntries(value) {
|
|
|
102345
102508
|
return [];
|
|
102346
102509
|
const entries = [];
|
|
102347
102510
|
for (const item of value) {
|
|
102348
|
-
if (!
|
|
102511
|
+
if (!isRecord16(item))
|
|
102349
102512
|
continue;
|
|
102350
102513
|
if (typeof item["component"] !== "string" || typeof item["reason"] !== "string")
|
|
102351
102514
|
continue;
|
|
@@ -102379,7 +102542,7 @@ function degradedDetailLines(entries) {
|
|
|
102379
102542
|
async function readJson2(path) {
|
|
102380
102543
|
try {
|
|
102381
102544
|
const parsed = JSON.parse(await readFile29(path, "utf8"));
|
|
102382
|
-
return
|
|
102545
|
+
return isRecord16(parsed) ? parsed : null;
|
|
102383
102546
|
} catch (error) {
|
|
102384
102547
|
if (error instanceof Error)
|
|
102385
102548
|
return null;
|
|
@@ -102400,7 +102563,7 @@ function normalizeRelative(root, target) {
|
|
|
102400
102563
|
function normalizePathSeparators(path) {
|
|
102401
102564
|
return path.split("\\").join("/");
|
|
102402
102565
|
}
|
|
102403
|
-
function
|
|
102566
|
+
function isRecord16(value) {
|
|
102404
102567
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
102405
102568
|
}
|
|
102406
102569
|
|
|
@@ -102408,16 +102571,16 @@ function isRecord15(value) {
|
|
|
102408
102571
|
import { existsSync as existsSync58 } from "fs";
|
|
102409
102572
|
import { readFile as readFile30 } from "fs/promises";
|
|
102410
102573
|
import { homedir as homedir24 } from "os";
|
|
102411
|
-
import { join as
|
|
102574
|
+
import { join as join86, resolve as resolve25 } from "path";
|
|
102412
102575
|
var RUNTIME_WRAPPER_MARKER2 = "OMO_GENERATED_RUNTIME_WRAPPER";
|
|
102413
102576
|
var CHECK_NAME = "codex-runtime-wrapper";
|
|
102414
102577
|
var REINSTALL_COMMAND = "npx --yes lazycodex-ai@latest install --no-tui";
|
|
102415
102578
|
async function checkCodexRuntimeWrapper(deps = {}) {
|
|
102416
|
-
const codexHome = resolve25(deps.codexHome ?? process.env.CODEX_HOME ??
|
|
102579
|
+
const codexHome = resolve25(deps.codexHome ?? process.env.CODEX_HOME ?? join86(homedir24(), ".codex"));
|
|
102417
102580
|
const binDir = resolveCodexInstallerBinDir({ binDir: deps.binDir, codexHome, env: process.env });
|
|
102418
102581
|
const platform = deps.platform ?? process.platform;
|
|
102419
|
-
const wrapperPath =
|
|
102420
|
-
const legacyWrapperPath =
|
|
102582
|
+
const wrapperPath = join86(binDir, platform === "win32" ? "omo-agent-toolkit.cmd" : "omo-agent-toolkit");
|
|
102583
|
+
const legacyWrapperPath = join86(binDir, platform === "win32" ? "omo.cmd" : "omo");
|
|
102421
102584
|
const [wrapper, legacyWrapper] = await Promise.all([readRuntimeWrapper(wrapperPath), readRuntimeWrapper(legacyWrapperPath)]);
|
|
102422
102585
|
const issues = [];
|
|
102423
102586
|
if (wrapper?.includes(RUNTIME_WRAPPER_MARKER2) === true) {
|
|
@@ -102946,19 +103109,19 @@ import { createHash as createHash7 } from "crypto";
|
|
|
102946
103109
|
import {
|
|
102947
103110
|
chmodSync as chmodSync5,
|
|
102948
103111
|
existsSync as existsSync61,
|
|
102949
|
-
mkdirSync as
|
|
102950
|
-
readdirSync as
|
|
103112
|
+
mkdirSync as mkdirSync16,
|
|
103113
|
+
readdirSync as readdirSync12,
|
|
102951
103114
|
readFileSync as readFileSync38,
|
|
102952
103115
|
renameSync as renameSync7,
|
|
102953
103116
|
unlinkSync as unlinkSync9,
|
|
102954
103117
|
writeFileSync as writeFileSync12
|
|
102955
103118
|
} from "fs";
|
|
102956
|
-
import { basename as basename12, dirname as dirname34, join as
|
|
103119
|
+
import { basename as basename12, dirname as dirname34, join as join89 } from "path";
|
|
102957
103120
|
|
|
102958
103121
|
// packages/mcp-client-core/src/config-dir.ts
|
|
102959
103122
|
import { existsSync as existsSync59, realpathSync as realpathSync8 } from "fs";
|
|
102960
103123
|
import { homedir as homedir25 } from "os";
|
|
102961
|
-
import { join as
|
|
103124
|
+
import { join as join87, resolve as resolve26 } from "path";
|
|
102962
103125
|
function resolveConfigPath2(pathValue) {
|
|
102963
103126
|
const resolvedPath = resolve26(pathValue);
|
|
102964
103127
|
if (!existsSync59(resolvedPath))
|
|
@@ -102976,13 +103139,13 @@ function getOpenCodeCliConfigDir(env = process.env) {
|
|
|
102976
103139
|
if (customConfigDir) {
|
|
102977
103140
|
return resolveConfigPath2(customConfigDir);
|
|
102978
103141
|
}
|
|
102979
|
-
const xdgConfigDir = env["XDG_CONFIG_HOME"]?.trim() ||
|
|
102980
|
-
return resolveConfigPath2(
|
|
103142
|
+
const xdgConfigDir = env["XDG_CONFIG_HOME"]?.trim() || join87(homedir25(), ".config");
|
|
103143
|
+
return resolveConfigPath2(join87(xdgConfigDir, "opencode"));
|
|
102981
103144
|
}
|
|
102982
103145
|
|
|
102983
103146
|
// packages/mcp-client-core/src/mcp-oauth/storage-index.ts
|
|
102984
103147
|
import { chmodSync as chmodSync4, existsSync as existsSync60, readFileSync as readFileSync37, renameSync as renameSync6, writeFileSync as writeFileSync11 } from "fs";
|
|
102985
|
-
import { join as
|
|
103148
|
+
import { join as join88 } from "path";
|
|
102986
103149
|
var INDEX_FILE_NAME = "index.json";
|
|
102987
103150
|
function isTokenIndex(value) {
|
|
102988
103151
|
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
@@ -102990,7 +103153,7 @@ function isTokenIndex(value) {
|
|
|
102990
103153
|
return Object.values(value).every((entry) => typeof entry === "string");
|
|
102991
103154
|
}
|
|
102992
103155
|
function getIndexPath(storageDir) {
|
|
102993
|
-
return
|
|
103156
|
+
return join88(storageDir, INDEX_FILE_NAME);
|
|
102994
103157
|
}
|
|
102995
103158
|
function readTokenIndex(storageDir) {
|
|
102996
103159
|
const indexPath = getIndexPath(storageDir);
|
|
@@ -103034,16 +103197,16 @@ function deleteTokenIndexEntry(storageDir, hash) {
|
|
|
103034
103197
|
var STORAGE_DIR_NAME = "mcp-oauth";
|
|
103035
103198
|
var LEGACY_STORAGE_FILE_NAME = "mcp-oauth.json";
|
|
103036
103199
|
function getMcpOauthStorageDir() {
|
|
103037
|
-
return
|
|
103200
|
+
return join89(getOpenCodeCliConfigDir(), STORAGE_DIR_NAME);
|
|
103038
103201
|
}
|
|
103039
103202
|
function getMcpOauthServerHash(serverHost, resource) {
|
|
103040
103203
|
return createHash7("sha256").update(buildKey(serverHost, resource)).digest("hex").slice(0, 32);
|
|
103041
103204
|
}
|
|
103042
103205
|
function getMcpOauthStoragePath(serverHost, resource) {
|
|
103043
|
-
return
|
|
103206
|
+
return join89(getMcpOauthStorageDir(), `${getMcpOauthServerHash(serverHost, resource)}.json`);
|
|
103044
103207
|
}
|
|
103045
103208
|
function getLegacyStoragePath() {
|
|
103046
|
-
return
|
|
103209
|
+
return join89(getOpenCodeCliConfigDir(), LEGACY_STORAGE_FILE_NAME);
|
|
103047
103210
|
}
|
|
103048
103211
|
function normalizeHost2(serverHost) {
|
|
103049
103212
|
let host = serverHost.trim();
|
|
@@ -103139,7 +103302,7 @@ function writeTokenFile(filePath, token) {
|
|
|
103139
103302
|
try {
|
|
103140
103303
|
const dir = dirname34(filePath);
|
|
103141
103304
|
if (!existsSync61(dir)) {
|
|
103142
|
-
|
|
103305
|
+
mkdirSync16(dir, { recursive: true });
|
|
103143
103306
|
}
|
|
103144
103307
|
const tempPath = `${filePath}.tmp.${Date.now()}`;
|
|
103145
103308
|
writeFileSync12(tempPath, JSON.stringify(token, null, 2), { encoding: "utf-8", mode: 384 });
|
|
@@ -103222,7 +103385,7 @@ function listTokensByHost(serverHost) {
|
|
|
103222
103385
|
for (const [hash, indexedKey] of Object.entries(index)) {
|
|
103223
103386
|
if (!indexedKey.startsWith(prefix))
|
|
103224
103387
|
continue;
|
|
103225
|
-
const indexedToken = readTokenFile(
|
|
103388
|
+
const indexedToken = readTokenFile(join89(getMcpOauthStorageDir(), `${hash}.json`));
|
|
103226
103389
|
if (indexedToken)
|
|
103227
103390
|
result[indexedKey] = indexedToken;
|
|
103228
103391
|
}
|
|
@@ -103234,10 +103397,10 @@ function listAllTokens() {
|
|
|
103234
103397
|
if (!existsSync61(dir))
|
|
103235
103398
|
return result;
|
|
103236
103399
|
const index = readTokenIndex(dir);
|
|
103237
|
-
for (const entry of
|
|
103400
|
+
for (const entry of readdirSync12(dir, { withFileTypes: true })) {
|
|
103238
103401
|
if (!entry.isFile() || !entry.name.endsWith(".json") || entry.name === "index.json")
|
|
103239
103402
|
continue;
|
|
103240
|
-
const token = readTokenFile(
|
|
103403
|
+
const token = readTokenFile(join89(dir, entry.name));
|
|
103241
103404
|
const hash = basename12(entry.name, ".json");
|
|
103242
103405
|
if (token)
|
|
103243
103406
|
result[index[hash] ?? hash] = token;
|