oh-my-opencode 5.0.0-beta.68 → 5.0.0-beta.70
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/README.ja.md +4 -4
- package/README.ko.md +4 -4
- package/README.md +76 -132
- package/README.ru.md +4 -4
- package/README.zh-cn.md +4 -4
- package/dist/cli/index.js +17 -15
- package/dist/cli-node/index.js +17 -15
- package/dist/features/boulder-state/storage.d.ts +1 -1
- package/dist/index.js +629 -419
- package/package.json +14 -14
- package/packages/omo-codex/plugin/.codex-plugin/plugin.json +1 -1
- package/packages/omo-codex/plugin/components/bootstrap/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/bootstrap/package.json +1 -1
- package/packages/omo-codex/plugin/components/comment-checker/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/comment-checker/package.json +1 -1
- package/packages/omo-codex/plugin/components/git-bash/hooks/hooks.json +2 -2
- package/packages/omo-codex/plugin/components/git-bash/package.json +1 -1
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/package.json +1 -1
- package/packages/omo-codex/plugin/components/lsp/dist/.omo-runtime-manifest.json +2 -2
- package/packages/omo-codex/plugin/components/lsp/hooks/hooks.json +2 -2
- package/packages/omo-codex/plugin/components/lsp/package.json +1 -1
- package/packages/omo-codex/plugin/components/rules/hooks/hooks.json +4 -4
- package/packages/omo-codex/plugin/components/rules/package.json +1 -1
- package/packages/omo-codex/plugin/components/teammode/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/teammode/package.json +1 -1
- package/packages/omo-codex/plugin/components/telemetry/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/telemetry/package.json +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/package.json +1 -1
- package/packages/omo-codex/plugin/components/ulw-execute-continuation/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/ulw-execute-continuation/package.json +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/hooks/hooks.json +5 -5
- package/packages/omo-codex/plugin/components/ulw-loop/package.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-compact-resetting-git-bash-mcp-reminder.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-compact-resetting-lsp-diagnostics-cache.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-compact-resetting-project-rule-cache.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-checking-comments.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-checking-lsp-diagnostics.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-checking-thread-title-hygiene.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-matching-project-rules.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-recording-spawn-admission.json +1 -1
- package/packages/omo-codex/plugin/hooks/pre-tool-use-enforcing-unlimited-goal-budget.json +1 -1
- package/packages/omo-codex/plugin/hooks/pre-tool-use-guarding-ulw-loop-spawns.json +1 -1
- package/packages/omo-codex/plugin/hooks/pre-tool-use-recommending-git-bash-mcp.json +1 -1
- package/packages/omo-codex/plugin/hooks/session-start-checking-auto-update.json +1 -1
- package/packages/omo-codex/plugin/hooks/session-start-checking-bootstrap-provisioning.json +1 -1
- package/packages/omo-codex/plugin/hooks/session-start-loading-project-rules.json +1 -1
- package/packages/omo-codex/plugin/hooks/session-start-recording-session-telemetry.json +1 -1
- package/packages/omo-codex/plugin/hooks/stop-checking-ulw-execute-continuation.json +1 -1
- package/packages/omo-codex/plugin/hooks/stop-checking-ulw-loop-resume.json +1 -1
- package/packages/omo-codex/plugin/hooks/subagent-stop-verifying-lazycodex-executor-evidence.json +1 -1
- package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ultrawork-trigger.json +1 -1
- package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ulw-loop-steering.json +1 -1
- package/packages/omo-codex/plugin/hooks/user-prompt-submit-loading-project-rules.json +1 -1
- package/packages/omo-codex/plugin/package-lock.json +12 -12
- package/packages/omo-codex/plugin/package.json +1 -1
- package/packages/omo-codex/scripts/install-dist/install-local.mjs +2 -2
- package/.agents/skills/work-with-pr-workspace/evals/evals.json +0 -76
- package/.agents/skills/work-with-pr-workspace/iteration-1/benchmark.json +0 -138
- package/.agents/skills/work-with-pr-workspace/iteration-1/benchmark.md +0 -42
- package/.agents/skills/work-with-pr-workspace/iteration-1/eval-1/eval_metadata.json +0 -57
- package/.agents/skills/work-with-pr-workspace/iteration-1/eval-1/with_skill/grading.json +0 -15
- package/.agents/skills/work-with-pr-workspace/iteration-1/eval-1/with_skill/outputs/code-changes.md +0 -454
- package/.agents/skills/work-with-pr-workspace/iteration-1/eval-1/with_skill/outputs/execution-plan.md +0 -136
- package/.agents/skills/work-with-pr-workspace/iteration-1/eval-1/with_skill/outputs/pr-description.md +0 -47
- package/.agents/skills/work-with-pr-workspace/iteration-1/eval-1/with_skill/outputs/verification-strategy.md +0 -163
- package/.agents/skills/work-with-pr-workspace/iteration-1/eval-1/with_skill/timing.json +0 -1
- package/.agents/skills/work-with-pr-workspace/iteration-1/eval-1/without_skill/grading.json +0 -15
- package/.agents/skills/work-with-pr-workspace/iteration-1/eval-1/without_skill/outputs/code-changes.md +0 -615
- package/.agents/skills/work-with-pr-workspace/iteration-1/eval-1/without_skill/outputs/execution-plan.md +0 -99
- package/.agents/skills/work-with-pr-workspace/iteration-1/eval-1/without_skill/outputs/pr-description.md +0 -50
- package/.agents/skills/work-with-pr-workspace/iteration-1/eval-1/without_skill/outputs/verification-strategy.md +0 -111
- package/.agents/skills/work-with-pr-workspace/iteration-1/eval-1/without_skill/timing.json +0 -1
- package/.agents/skills/work-with-pr-workspace/iteration-1/eval-2/eval_metadata.json +0 -37
- package/.agents/skills/work-with-pr-workspace/iteration-1/eval-2/with_skill/grading.json +0 -11
- package/.agents/skills/work-with-pr-workspace/iteration-1/eval-2/with_skill/outputs/code-changes.md +0 -205
- package/.agents/skills/work-with-pr-workspace/iteration-1/eval-2/with_skill/outputs/execution-plan.md +0 -78
- package/.agents/skills/work-with-pr-workspace/iteration-1/eval-2/with_skill/outputs/pr-description.md +0 -42
- package/.agents/skills/work-with-pr-workspace/iteration-1/eval-2/with_skill/outputs/verification-strategy.md +0 -87
- package/.agents/skills/work-with-pr-workspace/iteration-1/eval-2/with_skill/timing.json +0 -1
- package/.agents/skills/work-with-pr-workspace/iteration-1/eval-2/without_skill/grading.json +0 -11
- package/.agents/skills/work-with-pr-workspace/iteration-1/eval-2/without_skill/outputs/code-changes.md +0 -334
- package/.agents/skills/work-with-pr-workspace/iteration-1/eval-2/without_skill/outputs/execution-plan.md +0 -86
- package/.agents/skills/work-with-pr-workspace/iteration-1/eval-2/without_skill/outputs/pr-description.md +0 -23
- package/.agents/skills/work-with-pr-workspace/iteration-1/eval-2/without_skill/outputs/verification-strategy.md +0 -119
- package/.agents/skills/work-with-pr-workspace/iteration-1/eval-2/without_skill/timing.json +0 -1
- package/.agents/skills/work-with-pr-workspace/iteration-1/eval-3/eval_metadata.json +0 -32
- package/.agents/skills/work-with-pr-workspace/iteration-1/eval-3/with_skill/grading.json +0 -10
- package/.agents/skills/work-with-pr-workspace/iteration-1/eval-3/with_skill/outputs/code-changes.md +0 -221
- package/.agents/skills/work-with-pr-workspace/iteration-1/eval-3/with_skill/outputs/execution-plan.md +0 -104
- package/.agents/skills/work-with-pr-workspace/iteration-1/eval-3/with_skill/outputs/pr-description.md +0 -41
- package/.agents/skills/work-with-pr-workspace/iteration-1/eval-3/with_skill/outputs/verification-strategy.md +0 -84
- package/.agents/skills/work-with-pr-workspace/iteration-1/eval-3/with_skill/timing.json +0 -1
- package/.agents/skills/work-with-pr-workspace/iteration-1/eval-3/without_skill/grading.json +0 -10
- package/.agents/skills/work-with-pr-workspace/iteration-1/eval-3/without_skill/outputs/code-changes.md +0 -342
- package/.agents/skills/work-with-pr-workspace/iteration-1/eval-3/without_skill/outputs/execution-plan.md +0 -131
- package/.agents/skills/work-with-pr-workspace/iteration-1/eval-3/without_skill/outputs/pr-description.md +0 -39
- package/.agents/skills/work-with-pr-workspace/iteration-1/eval-3/without_skill/outputs/verification-strategy.md +0 -128
- package/.agents/skills/work-with-pr-workspace/iteration-1/eval-3/without_skill/timing.json +0 -1
- package/.agents/skills/work-with-pr-workspace/iteration-1/eval-4/eval_metadata.json +0 -32
- package/.agents/skills/work-with-pr-workspace/iteration-1/eval-4/with_skill/grading.json +0 -10
- package/.agents/skills/work-with-pr-workspace/iteration-1/eval-4/with_skill/outputs/code-changes.md +0 -143
- package/.agents/skills/work-with-pr-workspace/iteration-1/eval-4/with_skill/outputs/execution-plan.md +0 -82
- package/.agents/skills/work-with-pr-workspace/iteration-1/eval-4/with_skill/outputs/pr-description.md +0 -51
- package/.agents/skills/work-with-pr-workspace/iteration-1/eval-4/with_skill/outputs/verification-strategy.md +0 -69
- package/.agents/skills/work-with-pr-workspace/iteration-1/eval-4/with_skill/timing.json +0 -1
- package/.agents/skills/work-with-pr-workspace/iteration-1/eval-4/without_skill/grading.json +0 -10
- package/.agents/skills/work-with-pr-workspace/iteration-1/eval-4/without_skill/outputs/code-changes.md +0 -252
- package/.agents/skills/work-with-pr-workspace/iteration-1/eval-4/without_skill/outputs/execution-plan.md +0 -83
- package/.agents/skills/work-with-pr-workspace/iteration-1/eval-4/without_skill/outputs/pr-description.md +0 -33
- package/.agents/skills/work-with-pr-workspace/iteration-1/eval-4/without_skill/outputs/verification-strategy.md +0 -101
- package/.agents/skills/work-with-pr-workspace/iteration-1/eval-4/without_skill/timing.json +0 -1
- package/.agents/skills/work-with-pr-workspace/iteration-1/eval-5/eval_metadata.json +0 -32
- package/.agents/skills/work-with-pr-workspace/iteration-1/eval-5/with_skill/grading.json +0 -10
- package/.agents/skills/work-with-pr-workspace/iteration-1/eval-5/with_skill/outputs/code-changes.md +0 -387
- package/.agents/skills/work-with-pr-workspace/iteration-1/eval-5/with_skill/outputs/execution-plan.md +0 -112
- package/.agents/skills/work-with-pr-workspace/iteration-1/eval-5/with_skill/outputs/pr-description.md +0 -51
- package/.agents/skills/work-with-pr-workspace/iteration-1/eval-5/with_skill/outputs/verification-strategy.md +0 -75
- package/.agents/skills/work-with-pr-workspace/iteration-1/eval-5/with_skill/timing.json +0 -1
- package/.agents/skills/work-with-pr-workspace/iteration-1/eval-5/without_skill/grading.json +0 -10
- package/.agents/skills/work-with-pr-workspace/iteration-1/eval-5/without_skill/outputs/code-changes.md +0 -529
- package/.agents/skills/work-with-pr-workspace/iteration-1/eval-5/without_skill/outputs/execution-plan.md +0 -127
- package/.agents/skills/work-with-pr-workspace/iteration-1/eval-5/without_skill/outputs/pr-description.md +0 -42
- package/.agents/skills/work-with-pr-workspace/iteration-1/eval-5/without_skill/outputs/verification-strategy.md +0 -120
- package/.agents/skills/work-with-pr-workspace/iteration-1/eval-5/without_skill/timing.json +0 -1
- package/.agents/skills/work-with-pr-workspace/iteration-1/review.html +0 -1326
- package/.opencode/skills/work-with-pr-workspace/evals/evals.json +0 -76
- package/.opencode/skills/work-with-pr-workspace/iteration-1/benchmark.json +0 -138
- package/.opencode/skills/work-with-pr-workspace/iteration-1/benchmark.md +0 -42
- package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-1/eval_metadata.json +0 -57
- package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-1/with_skill/grading.json +0 -15
- package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-1/with_skill/outputs/code-changes.md +0 -454
- package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-1/with_skill/outputs/execution-plan.md +0 -136
- package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-1/with_skill/outputs/pr-description.md +0 -47
- package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-1/with_skill/outputs/verification-strategy.md +0 -163
- package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-1/with_skill/timing.json +0 -1
- package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-1/without_skill/grading.json +0 -15
- package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-1/without_skill/outputs/code-changes.md +0 -615
- package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-1/without_skill/outputs/execution-plan.md +0 -99
- package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-1/without_skill/outputs/pr-description.md +0 -50
- package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-1/without_skill/outputs/verification-strategy.md +0 -111
- package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-1/without_skill/timing.json +0 -1
- package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-2/eval_metadata.json +0 -37
- package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-2/with_skill/grading.json +0 -11
- package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-2/with_skill/outputs/code-changes.md +0 -205
- package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-2/with_skill/outputs/execution-plan.md +0 -78
- package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-2/with_skill/outputs/pr-description.md +0 -42
- package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-2/with_skill/outputs/verification-strategy.md +0 -87
- package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-2/with_skill/timing.json +0 -1
- package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-2/without_skill/grading.json +0 -11
- package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-2/without_skill/outputs/code-changes.md +0 -334
- package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-2/without_skill/outputs/execution-plan.md +0 -86
- package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-2/without_skill/outputs/pr-description.md +0 -23
- package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-2/without_skill/outputs/verification-strategy.md +0 -119
- package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-2/without_skill/timing.json +0 -1
- package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-3/eval_metadata.json +0 -32
- package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-3/with_skill/grading.json +0 -10
- package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-3/with_skill/outputs/code-changes.md +0 -221
- package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-3/with_skill/outputs/execution-plan.md +0 -104
- package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-3/with_skill/outputs/pr-description.md +0 -41
- package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-3/with_skill/outputs/verification-strategy.md +0 -84
- package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-3/with_skill/timing.json +0 -1
- package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-3/without_skill/grading.json +0 -10
- package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-3/without_skill/outputs/code-changes.md +0 -342
- package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-3/without_skill/outputs/execution-plan.md +0 -131
- package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-3/without_skill/outputs/pr-description.md +0 -39
- package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-3/without_skill/outputs/verification-strategy.md +0 -128
- package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-3/without_skill/timing.json +0 -1
- package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-4/eval_metadata.json +0 -32
- package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-4/with_skill/grading.json +0 -10
- package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-4/with_skill/outputs/code-changes.md +0 -143
- package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-4/with_skill/outputs/execution-plan.md +0 -82
- package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-4/with_skill/outputs/pr-description.md +0 -51
- package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-4/with_skill/outputs/verification-strategy.md +0 -69
- package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-4/with_skill/timing.json +0 -1
- package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-4/without_skill/grading.json +0 -10
- package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-4/without_skill/outputs/code-changes.md +0 -252
- package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-4/without_skill/outputs/execution-plan.md +0 -83
- package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-4/without_skill/outputs/pr-description.md +0 -33
- package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-4/without_skill/outputs/verification-strategy.md +0 -101
- package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-4/without_skill/timing.json +0 -1
- package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-5/eval_metadata.json +0 -32
- package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-5/with_skill/grading.json +0 -10
- package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-5/with_skill/outputs/code-changes.md +0 -387
- package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-5/with_skill/outputs/execution-plan.md +0 -112
- package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-5/with_skill/outputs/pr-description.md +0 -51
- package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-5/with_skill/outputs/verification-strategy.md +0 -75
- package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-5/with_skill/timing.json +0 -1
- package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-5/without_skill/grading.json +0 -10
- package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-5/without_skill/outputs/code-changes.md +0 -529
- package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-5/without_skill/outputs/execution-plan.md +0 -127
- package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-5/without_skill/outputs/pr-description.md +0 -42
- package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-5/without_skill/outputs/verification-strategy.md +0 -120
- package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-5/without_skill/timing.json +0 -1
- package/.opencode/skills/work-with-pr-workspace/iteration-1/review.html +0 -1326
package/dist/index.js
CHANGED
|
@@ -95073,6 +95073,16 @@ function normalizeSessionId(sessionId, platform = "opencode") {
|
|
|
95073
95073
|
}
|
|
95074
95074
|
return `${platform}:${sessionId}`;
|
|
95075
95075
|
}
|
|
95076
|
+
function stripSessionPlatform(sessionId) {
|
|
95077
|
+
return sessionId.replace(SESSION_ID_PREFIX_PATTERN, "");
|
|
95078
|
+
}
|
|
95079
|
+
function restoreDemotedWork(work) {
|
|
95080
|
+
if (work.status !== "paused" || work.stale_since === undefined) {
|
|
95081
|
+
return work;
|
|
95082
|
+
}
|
|
95083
|
+
const { stale_since: _staleSince, ...restored } = work;
|
|
95084
|
+
return { ...restored, status: "active" };
|
|
95085
|
+
}
|
|
95076
95086
|
function nowIsoString() {
|
|
95077
95087
|
return new Date().toISOString();
|
|
95078
95088
|
}
|
|
@@ -95398,15 +95408,16 @@ function selectActiveWork(directory, workId) {
|
|
|
95398
95408
|
return null;
|
|
95399
95409
|
}
|
|
95400
95410
|
const works = getBoulderWorks(state);
|
|
95401
|
-
const
|
|
95402
|
-
if (!
|
|
95411
|
+
const selectedWork = works.find((work) => work.work_id === workId);
|
|
95412
|
+
if (!selectedWork) {
|
|
95403
95413
|
return null;
|
|
95404
95414
|
}
|
|
95415
|
+
const nextWork = restoreDemotedWork(selectedWork);
|
|
95405
95416
|
const nextState = {
|
|
95406
95417
|
...state,
|
|
95407
95418
|
schema_version: 2,
|
|
95408
95419
|
active_work_id: workId,
|
|
95409
|
-
works:
|
|
95420
|
+
works: { ...Object.fromEntries(works.map((work) => [work.work_id, work])), [workId]: nextWork }
|
|
95410
95421
|
};
|
|
95411
95422
|
projectWorkToMirror(nextState, nextWork);
|
|
95412
95423
|
return writeBoulderState(directory, nextState) ? nextState : null;
|
|
@@ -95517,7 +95528,7 @@ function appendSessionIdForWork(directory, workId, sessionId, origin = "direct")
|
|
|
95517
95528
|
return null;
|
|
95518
95529
|
}
|
|
95519
95530
|
const updatedWork = {
|
|
95520
|
-
...targetWork,
|
|
95531
|
+
...restoreDemotedWork(targetWork),
|
|
95521
95532
|
session_ids: targetWork.session_ids.includes(normalizedSessionId) ? [...targetWork.session_ids] : [...targetWork.session_ids, normalizedSessionId],
|
|
95522
95533
|
session_origins: { ...targetWork.session_origins ?? {}, [normalizedSessionId]: origin },
|
|
95523
95534
|
updated_at: nowIsoString()
|
|
@@ -95535,6 +95546,170 @@ function appendSessionIdForWork(directory, workId, sessionId, origin = "direct")
|
|
|
95535
95546
|
}
|
|
95536
95547
|
return writeBoulderState(directory, nextState) ? nextState : null;
|
|
95537
95548
|
}
|
|
95549
|
+
// packages/boulder-state/src/storage/stale-work.ts
|
|
95550
|
+
import { readdirSync as readdirSync19, statSync as statSync9 } from "fs";
|
|
95551
|
+
import { join as join68 } from "path";
|
|
95552
|
+
var DEFAULT_STALE_WORK_THRESHOLD_MS = 6 * 60 * 60 * 1000;
|
|
95553
|
+
var STALE_WORK_THRESHOLD_ENV_KEY = "OMO_BOULDER_STALE_WORK_THRESHOLD_MS";
|
|
95554
|
+
var SESSION_TRANSCRIPT_SUFFIX = ".jsonl";
|
|
95555
|
+
var NO_CHANGES = { demoted: [], written: false };
|
|
95556
|
+
function resolveStaleWorkThresholdMs(env = process.env) {
|
|
95557
|
+
const raw = env[STALE_WORK_THRESHOLD_ENV_KEY]?.trim();
|
|
95558
|
+
if (!raw) {
|
|
95559
|
+
return DEFAULT_STALE_WORK_THRESHOLD_MS;
|
|
95560
|
+
}
|
|
95561
|
+
const parsed = Number(raw);
|
|
95562
|
+
if (!Number.isFinite(parsed) || parsed <= 0) {
|
|
95563
|
+
return DEFAULT_STALE_WORK_THRESHOLD_MS;
|
|
95564
|
+
}
|
|
95565
|
+
return parsed;
|
|
95566
|
+
}
|
|
95567
|
+
function isWorkStale(input) {
|
|
95568
|
+
if (input.lastActivityMs === null) {
|
|
95569
|
+
return true;
|
|
95570
|
+
}
|
|
95571
|
+
return input.nowMs - input.lastActivityMs >= input.thresholdMs;
|
|
95572
|
+
}
|
|
95573
|
+
function reconcileStaleWorks(directory, options = {}) {
|
|
95574
|
+
try {
|
|
95575
|
+
const state = readBoulderState(directory);
|
|
95576
|
+
if (!state) {
|
|
95577
|
+
return NO_CHANGES;
|
|
95578
|
+
}
|
|
95579
|
+
const nowMs = options.now ?? Date.now();
|
|
95580
|
+
const thresholdMs = options.thresholdMs ?? resolveStaleWorkThresholdMs(options.env);
|
|
95581
|
+
const works = getBoulderWorks(state);
|
|
95582
|
+
const staleSince = new Date(nowMs).toISOString();
|
|
95583
|
+
const demoted = [];
|
|
95584
|
+
const demotedWorks = new Map;
|
|
95585
|
+
for (const work of works) {
|
|
95586
|
+
if (work.status !== "active") {
|
|
95587
|
+
continue;
|
|
95588
|
+
}
|
|
95589
|
+
const lastActivityMs = resolveLastActivityMs({
|
|
95590
|
+
work,
|
|
95591
|
+
directory,
|
|
95592
|
+
nowMs,
|
|
95593
|
+
thresholdMs,
|
|
95594
|
+
...options.sessionsDirectory !== undefined ? { sessionsDirectory: options.sessionsDirectory } : {}
|
|
95595
|
+
});
|
|
95596
|
+
if (!isWorkStale({ lastActivityMs, nowMs, thresholdMs })) {
|
|
95597
|
+
continue;
|
|
95598
|
+
}
|
|
95599
|
+
demotedWorks.set(work.work_id, { ...work, status: "paused", stale_since: staleSince });
|
|
95600
|
+
demoted.push({
|
|
95601
|
+
work_id: work.work_id,
|
|
95602
|
+
stale_since: staleSince,
|
|
95603
|
+
last_activity_at: lastActivityMs === null ? null : new Date(lastActivityMs).toISOString()
|
|
95604
|
+
});
|
|
95605
|
+
}
|
|
95606
|
+
if (demoted.length === 0) {
|
|
95607
|
+
return NO_CHANGES;
|
|
95608
|
+
}
|
|
95609
|
+
const nextWorks = Object.fromEntries(works.map((work) => [work.work_id, demotedWorks.get(work.work_id) ?? work]));
|
|
95610
|
+
const activeWorkId = state.active_work_id ?? (works.length === 1 ? works[0]?.work_id : undefined);
|
|
95611
|
+
const nextState = {
|
|
95612
|
+
...state,
|
|
95613
|
+
schema_version: 2,
|
|
95614
|
+
works: nextWorks,
|
|
95615
|
+
...activeWorkId !== undefined ? { active_work_id: activeWorkId } : {}
|
|
95616
|
+
};
|
|
95617
|
+
const mirrorWork = activeWorkId === undefined ? undefined : nextWorks[activeWorkId];
|
|
95618
|
+
if (mirrorWork) {
|
|
95619
|
+
projectWorkToMirror(nextState, mirrorWork);
|
|
95620
|
+
}
|
|
95621
|
+
return writeBoulderState(directory, nextState) ? { demoted, written: true } : NO_CHANGES;
|
|
95622
|
+
} catch {
|
|
95623
|
+
return NO_CHANGES;
|
|
95624
|
+
}
|
|
95625
|
+
}
|
|
95626
|
+
function resolveLastActivityMs(input) {
|
|
95627
|
+
const recordedMs = newestMs([parseIsoToMs(input.work.updated_at), parseIsoToMs(input.work.started_at)]);
|
|
95628
|
+
if (recordedMs !== null && input.nowMs - recordedMs < input.thresholdMs) {
|
|
95629
|
+
return recordedMs;
|
|
95630
|
+
}
|
|
95631
|
+
if (input.sessionsDirectory === undefined) {
|
|
95632
|
+
return recordedMs;
|
|
95633
|
+
}
|
|
95634
|
+
return newestMs([
|
|
95635
|
+
recordedMs,
|
|
95636
|
+
findNewestSessionTranscriptMs({
|
|
95637
|
+
sessionsDirectory: input.sessionsDirectory,
|
|
95638
|
+
sessionIds: input.work.session_ids,
|
|
95639
|
+
sessionCwds: [input.directory, input.work.worktree_path]
|
|
95640
|
+
})
|
|
95641
|
+
]);
|
|
95642
|
+
}
|
|
95643
|
+
function findNewestSessionTranscriptMs(input) {
|
|
95644
|
+
const sessionIds = input.sessionIds.map((sessionId) => stripSessionPlatform(sessionId)).filter((sessionId) => sessionId.length > 0);
|
|
95645
|
+
const needles = input.sessionCwds.filter((cwd) => typeof cwd === "string" && cwd.trim().length > 0).map((cwd) => normalizePathForMatch(cwd));
|
|
95646
|
+
if (sessionIds.length === 0) {
|
|
95647
|
+
return null;
|
|
95648
|
+
}
|
|
95649
|
+
let entries;
|
|
95650
|
+
try {
|
|
95651
|
+
entries = readdirSync19(input.sessionsDirectory, { withFileTypes: true }).map((entry) => ({ name: entry.name, isDirectory: entry.isDirectory(), isFile: entry.isFile() }));
|
|
95652
|
+
} catch {
|
|
95653
|
+
return null;
|
|
95654
|
+
}
|
|
95655
|
+
let newest = null;
|
|
95656
|
+
for (const entry of entries) {
|
|
95657
|
+
if (entry.isFile) {
|
|
95658
|
+
if (isTranscriptOf(entry.name, sessionIds)) {
|
|
95659
|
+
newest = newestMs([newest, mtimeMs(join68(input.sessionsDirectory, entry.name))]);
|
|
95660
|
+
}
|
|
95661
|
+
continue;
|
|
95662
|
+
}
|
|
95663
|
+
if (!entry.isDirectory || !matchesSessionCwd(entry.name, needles)) {
|
|
95664
|
+
continue;
|
|
95665
|
+
}
|
|
95666
|
+
const sessionDirectory = join68(input.sessionsDirectory, entry.name);
|
|
95667
|
+
let fileNames;
|
|
95668
|
+
try {
|
|
95669
|
+
fileNames = readdirSync19(sessionDirectory);
|
|
95670
|
+
} catch {
|
|
95671
|
+
continue;
|
|
95672
|
+
}
|
|
95673
|
+
for (const fileName of fileNames) {
|
|
95674
|
+
if (isTranscriptOf(fileName, sessionIds)) {
|
|
95675
|
+
newest = newestMs([newest, mtimeMs(join68(sessionDirectory, fileName))]);
|
|
95676
|
+
}
|
|
95677
|
+
}
|
|
95678
|
+
}
|
|
95679
|
+
return newest;
|
|
95680
|
+
}
|
|
95681
|
+
function isTranscriptOf(fileName, sessionIds) {
|
|
95682
|
+
if (!fileName.endsWith(SESSION_TRANSCRIPT_SUFFIX)) {
|
|
95683
|
+
return false;
|
|
95684
|
+
}
|
|
95685
|
+
return sessionIds.some((sessionId) => fileName === `${sessionId}${SESSION_TRANSCRIPT_SUFFIX}` || fileName.endsWith(`_${sessionId}${SESSION_TRANSCRIPT_SUFFIX}`));
|
|
95686
|
+
}
|
|
95687
|
+
function matchesSessionCwd(directoryName, needles) {
|
|
95688
|
+
const normalized = normalizePathForMatch(directoryName);
|
|
95689
|
+
return needles.some((needle) => normalized.includes(needle) || needle.includes(normalized));
|
|
95690
|
+
}
|
|
95691
|
+
function normalizePathForMatch(value) {
|
|
95692
|
+
return value.toLowerCase().replace(/[^a-z0-9]+/g, "-");
|
|
95693
|
+
}
|
|
95694
|
+
function mtimeMs(path) {
|
|
95695
|
+
try {
|
|
95696
|
+
return statSync9(path).mtimeMs;
|
|
95697
|
+
} catch {
|
|
95698
|
+
return null;
|
|
95699
|
+
}
|
|
95700
|
+
}
|
|
95701
|
+
function newestMs(values) {
|
|
95702
|
+
let newest = null;
|
|
95703
|
+
for (const value of values) {
|
|
95704
|
+
if (value === null || Number.isNaN(value)) {
|
|
95705
|
+
continue;
|
|
95706
|
+
}
|
|
95707
|
+
if (newest === null || value > newest) {
|
|
95708
|
+
newest = value;
|
|
95709
|
+
}
|
|
95710
|
+
}
|
|
95711
|
+
return newest;
|
|
95712
|
+
}
|
|
95538
95713
|
// packages/boulder-state/src/storage/task.ts
|
|
95539
95714
|
function upsertTaskSessionState(directory, input) {
|
|
95540
95715
|
const stateForWork = readBoulderState(directory);
|
|
@@ -95755,15 +95930,15 @@ import {
|
|
|
95755
95930
|
writeFileSync as writeFileSync13,
|
|
95756
95931
|
unlinkSync as unlinkSync9
|
|
95757
95932
|
} from "fs";
|
|
95758
|
-
import { join as
|
|
95933
|
+
import { join as join70 } from "path";
|
|
95759
95934
|
|
|
95760
95935
|
// packages/omo-opencode/src/hooks/rules-injector/constants.ts
|
|
95761
|
-
import { join as
|
|
95762
|
-
var RULES_INJECTOR_STORAGE =
|
|
95936
|
+
import { join as join69 } from "path";
|
|
95937
|
+
var RULES_INJECTOR_STORAGE = join69(OPENCODE_STORAGE, "rules-injector");
|
|
95763
95938
|
|
|
95764
95939
|
// packages/omo-opencode/src/hooks/rules-injector/storage.ts
|
|
95765
95940
|
function getStoragePath(sessionID) {
|
|
95766
|
-
return
|
|
95941
|
+
return join70(RULES_INJECTOR_STORAGE, `${sessionID}.json`);
|
|
95767
95942
|
}
|
|
95768
95943
|
function loadInjectedRules(sessionID) {
|
|
95769
95944
|
const filePath = getStoragePath(sessionID);
|
|
@@ -95897,7 +96072,7 @@ function matchDecisionCacheKey(projectRoot, resolvedFilePath, realPath, statFing
|
|
|
95897
96072
|
}
|
|
95898
96073
|
|
|
95899
96074
|
// packages/omo-opencode/src/hooks/rules-injector/parsed-rule-cache.ts
|
|
95900
|
-
import { readFileSync as readFileSync35, statSync as
|
|
96075
|
+
import { readFileSync as readFileSync35, statSync as statSync10 } from "fs";
|
|
95901
96076
|
var MAX_PARSED_RULE_CACHE_ENTRIES = 256;
|
|
95902
96077
|
var MAX_PARSED_RULE_CACHE_BODY_BYTES = 64 * 1024;
|
|
95903
96078
|
var parsedRuleCache = new Map;
|
|
@@ -95906,7 +96081,7 @@ function clearParsedRuleCache() {
|
|
|
95906
96081
|
}
|
|
95907
96082
|
function createParsedRuleReader(options) {
|
|
95908
96083
|
const readRuleFileSync = options?.readFileSync ?? readFileSync35;
|
|
95909
|
-
const statRuleSync = options?.statSync ??
|
|
96084
|
+
const statRuleSync = options?.statSync ?? statSync10;
|
|
95910
96085
|
return (filePath, realPath) => {
|
|
95911
96086
|
try {
|
|
95912
96087
|
const stat = statRuleSync(filePath);
|
|
@@ -96515,7 +96690,7 @@ function getCachedVersion(options = {}) {
|
|
|
96515
96690
|
// package.json
|
|
96516
96691
|
var package_default = {
|
|
96517
96692
|
name: "oh-my-opencode",
|
|
96518
|
-
version: "5.0.0-beta.
|
|
96693
|
+
version: "5.0.0-beta.70",
|
|
96519
96694
|
description: "The Best AI Agent Harness - Batteries-Included OpenCode Plugin with Multi-Model Orchestration, Parallel Background Agents, and Crafted LSP/AST Tools",
|
|
96520
96695
|
main: "./dist/index.js",
|
|
96521
96696
|
types: "dist/index.d.ts",
|
|
@@ -96697,7 +96872,7 @@ var package_default = {
|
|
|
96697
96872
|
zod: "^4.4.3"
|
|
96698
96873
|
},
|
|
96699
96874
|
devDependencies: {
|
|
96700
|
-
"@code-yeongyu/senpi": "2026.9.
|
|
96875
|
+
"@code-yeongyu/senpi": "2026.9.17-3",
|
|
96701
96876
|
"@oh-my-opencode/agents-md-core": "workspace:*",
|
|
96702
96877
|
"@oh-my-opencode/ast-grep-mcp": "workspace:*",
|
|
96703
96878
|
"@oh-my-opencode/boulder-state": "workspace:*",
|
|
@@ -96736,18 +96911,18 @@ var package_default = {
|
|
|
96736
96911
|
typescript: "^7.0.2"
|
|
96737
96912
|
},
|
|
96738
96913
|
optionalDependencies: {
|
|
96739
|
-
"oh-my-opencode-darwin-arm64": "5.0.0-beta.
|
|
96740
|
-
"oh-my-opencode-darwin-x64": "5.0.0-beta.
|
|
96741
|
-
"oh-my-opencode-darwin-x64-baseline": "5.0.0-beta.
|
|
96742
|
-
"oh-my-opencode-linux-arm64": "5.0.0-beta.
|
|
96743
|
-
"oh-my-opencode-linux-arm64-musl": "5.0.0-beta.
|
|
96744
|
-
"oh-my-opencode-linux-x64": "5.0.0-beta.
|
|
96745
|
-
"oh-my-opencode-linux-x64-baseline": "5.0.0-beta.
|
|
96746
|
-
"oh-my-opencode-linux-x64-musl": "5.0.0-beta.
|
|
96747
|
-
"oh-my-opencode-linux-x64-musl-baseline": "5.0.0-beta.
|
|
96748
|
-
"oh-my-opencode-windows-arm64": "5.0.0-beta.
|
|
96749
|
-
"oh-my-opencode-windows-x64": "5.0.0-beta.
|
|
96750
|
-
"oh-my-opencode-windows-x64-baseline": "5.0.0-beta.
|
|
96914
|
+
"oh-my-opencode-darwin-arm64": "5.0.0-beta.70",
|
|
96915
|
+
"oh-my-opencode-darwin-x64": "5.0.0-beta.70",
|
|
96916
|
+
"oh-my-opencode-darwin-x64-baseline": "5.0.0-beta.70",
|
|
96917
|
+
"oh-my-opencode-linux-arm64": "5.0.0-beta.70",
|
|
96918
|
+
"oh-my-opencode-linux-arm64-musl": "5.0.0-beta.70",
|
|
96919
|
+
"oh-my-opencode-linux-x64": "5.0.0-beta.70",
|
|
96920
|
+
"oh-my-opencode-linux-x64-baseline": "5.0.0-beta.70",
|
|
96921
|
+
"oh-my-opencode-linux-x64-musl": "5.0.0-beta.70",
|
|
96922
|
+
"oh-my-opencode-linux-x64-musl-baseline": "5.0.0-beta.70",
|
|
96923
|
+
"oh-my-opencode-windows-arm64": "5.0.0-beta.70",
|
|
96924
|
+
"oh-my-opencode-windows-x64": "5.0.0-beta.70",
|
|
96925
|
+
"oh-my-opencode-windows-x64-baseline": "5.0.0-beta.70"
|
|
96751
96926
|
},
|
|
96752
96927
|
overrides: {
|
|
96753
96928
|
"@earendil-works/pi-agent-core": "0.84.2",
|
|
@@ -96927,7 +97102,7 @@ function syncCachePackageJsonToIntent(pluginInfo) {
|
|
|
96927
97102
|
}
|
|
96928
97103
|
// packages/omo-opencode/src/hooks/auto-update-checker/hook/background-update-check.ts
|
|
96929
97104
|
import { existsSync as existsSync66 } from "fs";
|
|
96930
|
-
import { dirname as dirname25, join as
|
|
97105
|
+
import { dirname as dirname25, join as join77 } from "path";
|
|
96931
97106
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
96932
97107
|
// packages/omo-opencode/src/cli/config-manager/add-plugin-to-opencode-config.ts
|
|
96933
97108
|
init_main();
|
|
@@ -96943,10 +97118,10 @@ import { win32 as win326 } from "path";
|
|
|
96943
97118
|
import { win32 as win325 } from "path";
|
|
96944
97119
|
|
|
96945
97120
|
// packages/omo-opencode/src/config-migration/types.ts
|
|
96946
|
-
import { existsSync as existsSync63, readdirSync as
|
|
97121
|
+
import { existsSync as existsSync63, readdirSync as readdirSync20, realpathSync as realpathSync11 } from "fs";
|
|
96947
97122
|
var DEFAULT_DISCOVERY_FILE_SYSTEM = {
|
|
96948
97123
|
existsSync: existsSync63,
|
|
96949
|
-
readdirSync:
|
|
97124
|
+
readdirSync: readdirSync20,
|
|
96950
97125
|
realpathSync: realpathSync11
|
|
96951
97126
|
};
|
|
96952
97127
|
|
|
@@ -97825,12 +98000,12 @@ function spawnWithWindowsHide(command, options) {
|
|
|
97825
98000
|
}
|
|
97826
98001
|
// packages/omo-opencode/src/cli/config-manager/bun-install.ts
|
|
97827
98002
|
import { existsSync as existsSync64 } from "fs";
|
|
97828
|
-
import { join as
|
|
98003
|
+
import { join as join75 } from "path";
|
|
97829
98004
|
init_logger2();
|
|
97830
98005
|
var BUN_INSTALL_TIMEOUT_SECONDS = 60;
|
|
97831
98006
|
var BUN_INSTALL_TIMEOUT_MS = BUN_INSTALL_TIMEOUT_SECONDS * 1000;
|
|
97832
98007
|
function getDefaultWorkspaceDir() {
|
|
97833
|
-
return
|
|
98008
|
+
return join75(getOpenCodeCacheDir(), "packages");
|
|
97834
98009
|
}
|
|
97835
98010
|
function readProcessOutput(stream) {
|
|
97836
98011
|
if (!stream) {
|
|
@@ -98094,7 +98269,7 @@ function getCacheWorkspaceDir(deps) {
|
|
|
98094
98269
|
}
|
|
98095
98270
|
var defaultDeps2 = {
|
|
98096
98271
|
existsSync: existsSync66,
|
|
98097
|
-
join:
|
|
98272
|
+
join: join77,
|
|
98098
98273
|
runBunInstallWithDetails,
|
|
98099
98274
|
log: log2,
|
|
98100
98275
|
getOpenCodeCacheDir,
|
|
@@ -98466,7 +98641,7 @@ v${latestVersion} available. Restart OpenCode to apply.` : "OpenCode is now on S
|
|
|
98466
98641
|
// packages/omo-opencode/src/hooks/ast-grep-sg-provision/hook.ts
|
|
98467
98642
|
init_src();
|
|
98468
98643
|
import { homedir as homedir15 } from "os";
|
|
98469
|
-
import { join as
|
|
98644
|
+
import { join as join78 } from "path";
|
|
98470
98645
|
var provisionedTargets = new Set;
|
|
98471
98646
|
function defaultSchedule(task) {
|
|
98472
98647
|
const timer = setTimeout(() => {
|
|
@@ -98493,7 +98668,7 @@ var defaultDeps4 = {
|
|
|
98493
98668
|
function createAstGrepSgProvisionHook(depsOverride = {}) {
|
|
98494
98669
|
const deps = { ...defaultDeps4, ...depsOverride };
|
|
98495
98670
|
const platform = deps.platform ?? process.platform;
|
|
98496
|
-
const targetDir = astGrepRuntimeDir(
|
|
98671
|
+
const targetDir = astGrepRuntimeDir(join78(deps.homeDir(), ".omo"), platform, deps.arch ?? process.arch);
|
|
98497
98672
|
return {
|
|
98498
98673
|
event(input) {
|
|
98499
98674
|
try {
|
|
@@ -98520,11 +98695,11 @@ import {
|
|
|
98520
98695
|
writeFileSync as writeFileSync16,
|
|
98521
98696
|
unlinkSync as unlinkSync12
|
|
98522
98697
|
} from "fs";
|
|
98523
|
-
import { join as
|
|
98698
|
+
import { join as join80 } from "path";
|
|
98524
98699
|
|
|
98525
98700
|
// packages/omo-opencode/src/hooks/agent-usage-reminder/constants.ts
|
|
98526
|
-
import { join as
|
|
98527
|
-
var AGENT_USAGE_REMINDER_STORAGE =
|
|
98701
|
+
import { join as join79 } from "path";
|
|
98702
|
+
var AGENT_USAGE_REMINDER_STORAGE = join79(OPENCODE_STORAGE, "agent-usage-reminder");
|
|
98528
98703
|
var TARGET_TOOLS = new Set([
|
|
98529
98704
|
"grep",
|
|
98530
98705
|
"safe_grep",
|
|
@@ -98568,7 +98743,7 @@ ALWAYS prefer: Multiple parallel task calls > Direct tool calls
|
|
|
98568
98743
|
|
|
98569
98744
|
// packages/omo-opencode/src/hooks/agent-usage-reminder/storage.ts
|
|
98570
98745
|
function getStoragePath2(sessionID) {
|
|
98571
|
-
return
|
|
98746
|
+
return join80(AGENT_USAGE_REMINDER_STORAGE, `${sessionID}.json`);
|
|
98572
98747
|
}
|
|
98573
98748
|
function loadAgentUsageState(sessionID) {
|
|
98574
98749
|
const filePath = getStoragePath2(sessionID);
|
|
@@ -104019,11 +104194,11 @@ import {
|
|
|
104019
104194
|
writeFileSync as writeFileSync17,
|
|
104020
104195
|
unlinkSync as unlinkSync13
|
|
104021
104196
|
} from "fs";
|
|
104022
|
-
import { join as
|
|
104197
|
+
import { join as join82 } from "path";
|
|
104023
104198
|
|
|
104024
104199
|
// packages/omo-opencode/src/hooks/interactive-bash-session/constants.ts
|
|
104025
|
-
import { join as
|
|
104026
|
-
var INTERACTIVE_BASH_SESSION_STORAGE =
|
|
104200
|
+
import { join as join81 } from "path";
|
|
104201
|
+
var INTERACTIVE_BASH_SESSION_STORAGE = join81(OPENCODE_STORAGE, "interactive-bash-session");
|
|
104027
104202
|
var OMO_SESSION_PREFIX = "omo-";
|
|
104028
104203
|
function buildSessionReminderMessage(sessions) {
|
|
104029
104204
|
if (sessions.length === 0)
|
|
@@ -104035,7 +104210,7 @@ function buildSessionReminderMessage(sessions) {
|
|
|
104035
104210
|
|
|
104036
104211
|
// packages/omo-opencode/src/hooks/interactive-bash-session/storage.ts
|
|
104037
104212
|
function getStoragePath3(sessionID) {
|
|
104038
|
-
return
|
|
104213
|
+
return join82(INTERACTIVE_BASH_SESSION_STORAGE, `${sessionID}.json`);
|
|
104039
104214
|
}
|
|
104040
104215
|
function loadInteractiveBashSessionState(sessionID) {
|
|
104041
104216
|
const filePath = getStoragePath3(sessionID);
|
|
@@ -105255,12 +105430,12 @@ init_logger2();
|
|
|
105255
105430
|
init_logger2();
|
|
105256
105431
|
// packages/omo-opencode/src/hooks/goal/controller.ts
|
|
105257
105432
|
import { mkdirSync as mkdirSync18, writeFileSync as writeFileSync19 } from "fs";
|
|
105258
|
-
import { dirname as dirname27, join as
|
|
105433
|
+
import { dirname as dirname27, join as join84 } from "path";
|
|
105259
105434
|
|
|
105260
105435
|
// packages/omo-opencode/src/hooks/goal/store.ts
|
|
105261
105436
|
import { randomUUID as randomUUID8 } from "crypto";
|
|
105262
105437
|
import { mkdirSync as mkdirSync17, readFileSync as readFileSync45, renameSync as renameSync7, unlinkSync as unlinkSync14, writeFileSync as writeFileSync18 } from "fs";
|
|
105263
|
-
import { join as
|
|
105438
|
+
import { join as join83 } from "path";
|
|
105264
105439
|
|
|
105265
105440
|
// packages/omo-opencode/src/hooks/goal/types.ts
|
|
105266
105441
|
import { z as z52 } from "zod";
|
|
@@ -105298,7 +105473,7 @@ var GoalToolResponseSchema = z52.object({
|
|
|
105298
105473
|
// packages/omo-opencode/src/hooks/goal/store.ts
|
|
105299
105474
|
var STORE_VERSION = 1;
|
|
105300
105475
|
function goalFilePath(ref) {
|
|
105301
|
-
return
|
|
105476
|
+
return join83(ref.baseDir, `${encodeURIComponent(ref.sessionID)}.json`);
|
|
105302
105477
|
}
|
|
105303
105478
|
function ensureGoalStoreDir(baseDir) {
|
|
105304
105479
|
mkdirSync17(baseDir, { recursive: true });
|
|
@@ -105419,9 +105594,9 @@ function validateObjective(objective) {
|
|
|
105419
105594
|
// packages/omo-opencode/src/hooks/goal/controller.ts
|
|
105420
105595
|
function createGoalController(options) {
|
|
105421
105596
|
const { projectDir } = options;
|
|
105422
|
-
const baseDir =
|
|
105597
|
+
const baseDir = join84(projectDir, ".omo", "goal");
|
|
105423
105598
|
const storeRef = (sessionID) => ({ baseDir, sessionID });
|
|
105424
|
-
const tuiMirrorPath = (sessionID) =>
|
|
105599
|
+
const tuiMirrorPath = (sessionID) => join84(projectDir, ".omo", "ulw-loop", sessionID, "goals.json");
|
|
105425
105600
|
const writeTuiMirror = (sessionID, goal) => {
|
|
105426
105601
|
const path = tuiMirrorPath(sessionID);
|
|
105427
105602
|
const snapshot = {
|
|
@@ -105854,7 +106029,7 @@ import { dirname as dirname33 } from "path";
|
|
|
105854
106029
|
init_resolve_commands_in_text();
|
|
105855
106030
|
// packages/skills-loader-core/src/features/opencode-skill-loader/loader.ts
|
|
105856
106031
|
init_src();
|
|
105857
|
-
import { join as
|
|
106032
|
+
import { join as join91 } from "path";
|
|
105858
106033
|
|
|
105859
106034
|
// packages/shared-skills/index.mjs
|
|
105860
106035
|
import { existsSync as existsSync69 } from "fs";
|
|
@@ -105867,21 +106042,21 @@ function sharedSkillsRootPath() {
|
|
|
105867
106042
|
|
|
105868
106043
|
// packages/skills-loader-core/src/shared/claude-config-dir.ts
|
|
105869
106044
|
init_src();
|
|
105870
|
-
import { join as
|
|
106045
|
+
import { join as join85 } from "path";
|
|
105871
106046
|
function getClaudeConfigDir2() {
|
|
105872
106047
|
const envConfigDir = process.env.CLAUDE_CONFIG_DIR;
|
|
105873
106048
|
if (envConfigDir) {
|
|
105874
106049
|
return envConfigDir;
|
|
105875
106050
|
}
|
|
105876
|
-
return
|
|
106051
|
+
return join85(getHomeDirectory(), ".claude");
|
|
105877
106052
|
}
|
|
105878
106053
|
// packages/skills-loader-core/src/shared/opencode-command-dirs.ts
|
|
105879
|
-
import { basename as basename11, dirname as dirname28, join as
|
|
106054
|
+
import { basename as basename11, dirname as dirname28, join as join87 } from "path";
|
|
105880
106055
|
|
|
105881
106056
|
// packages/skills-loader-core/src/shared/opencode-config-dir.ts
|
|
105882
106057
|
import { existsSync as existsSync70, realpathSync as realpathSync12 } from "fs";
|
|
105883
106058
|
import { homedir as homedir17 } from "os";
|
|
105884
|
-
import { join as
|
|
106059
|
+
import { join as join86, posix as posix8, resolve as resolve16, win32 as win327 } from "path";
|
|
105885
106060
|
|
|
105886
106061
|
// packages/skills-loader-core/src/shared/plugin-identity.ts
|
|
105887
106062
|
init_src();
|
|
@@ -105914,15 +106089,15 @@ function getTauriConfigDir2(identifier) {
|
|
|
105914
106089
|
const platform = process.platform;
|
|
105915
106090
|
switch (platform) {
|
|
105916
106091
|
case "darwin":
|
|
105917
|
-
return
|
|
106092
|
+
return join86(homedir17(), "Library", "Application Support", identifier);
|
|
105918
106093
|
case "win32": {
|
|
105919
|
-
const appData = process.env.APPDATA ||
|
|
106094
|
+
const appData = process.env.APPDATA || join86(homedir17(), "AppData", "Roaming");
|
|
105920
106095
|
return win327.join(appData, identifier);
|
|
105921
106096
|
}
|
|
105922
106097
|
case "linux":
|
|
105923
106098
|
default: {
|
|
105924
|
-
const xdgConfig = process.env.XDG_CONFIG_HOME ||
|
|
105925
|
-
return
|
|
106099
|
+
const xdgConfig = process.env.XDG_CONFIG_HOME || join86(homedir17(), ".config");
|
|
106100
|
+
return join86(xdgConfig, identifier);
|
|
105926
106101
|
}
|
|
105927
106102
|
}
|
|
105928
106103
|
}
|
|
@@ -105965,8 +106140,8 @@ function getWslLinuxHomeDir2(windowsConfigRoot) {
|
|
|
105965
106140
|
function getCliDefaultConfigDir2() {
|
|
105966
106141
|
const envXdgConfig = process.env.XDG_CONFIG_HOME?.trim();
|
|
105967
106142
|
const shouldIgnoreWindowsXdg = envXdgConfig !== undefined && envXdgConfig.length > 0 && isWslEnvironment2() && isWindowsUserConfigRoot2(envXdgConfig);
|
|
105968
|
-
const xdgConfig = shouldIgnoreWindowsXdg ? posix8.join(getWslLinuxHomeDir2(envXdgConfig) ?? "/home", ".config") : envXdgConfig ||
|
|
105969
|
-
const configDir = isWslEnvironment2() ? posix8.join(xdgConfig, "opencode") :
|
|
106143
|
+
const xdgConfig = shouldIgnoreWindowsXdg ? posix8.join(getWslLinuxHomeDir2(envXdgConfig) ?? "/home", ".config") : envXdgConfig || join86(homedir17(), ".config");
|
|
106144
|
+
const configDir = isWslEnvironment2() ? posix8.join(xdgConfig, "opencode") : join86(xdgConfig, "opencode");
|
|
105970
106145
|
return resolveConfigPath2(configDir);
|
|
105971
106146
|
}
|
|
105972
106147
|
function getCliCustomConfigDir2() {
|
|
@@ -105999,8 +106174,8 @@ function getOpenCodeConfigDir2(options) {
|
|
|
105999
106174
|
const tauriDir = process.platform === "win32" ? win327.isAbsolute(tauriDirBase) ? win327.normalize(tauriDirBase) : win327.resolve(tauriDirBase) : resolveConfigPath2(tauriDirBase);
|
|
106000
106175
|
if (checkExisting) {
|
|
106001
106176
|
const legacyDir = getCliConfigDir2();
|
|
106002
|
-
const legacyConfig =
|
|
106003
|
-
const legacyConfigC =
|
|
106177
|
+
const legacyConfig = join86(legacyDir, "opencode.json");
|
|
106178
|
+
const legacyConfigC = join86(legacyDir, "opencode.jsonc");
|
|
106004
106179
|
if (existsSync70(legacyConfig) || existsSync70(legacyConfigC)) {
|
|
106005
106180
|
return legacyDir;
|
|
106006
106181
|
}
|
|
@@ -106022,9 +106197,9 @@ function getOpenCodeSkillDirs(options) {
|
|
|
106022
106197
|
...configDirs.flatMap((configDir) => {
|
|
106023
106198
|
const parentConfigDir = getParentOpencodeConfigDir2(configDir);
|
|
106024
106199
|
return [
|
|
106025
|
-
|
|
106026
|
-
|
|
106027
|
-
...parentConfigDir ? [
|
|
106200
|
+
join87(configDir, "skills"),
|
|
106201
|
+
join87(configDir, "skill"),
|
|
106202
|
+
...parentConfigDir ? [join87(parentConfigDir, "skills"), join87(parentConfigDir, "skill")] : []
|
|
106028
106203
|
];
|
|
106029
106204
|
})
|
|
106030
106205
|
]));
|
|
@@ -106032,7 +106207,7 @@ function getOpenCodeSkillDirs(options) {
|
|
|
106032
106207
|
// packages/skills-loader-core/src/shared/project-discovery-dirs.ts
|
|
106033
106208
|
import { execFileSync as execFileSync4 } from "child_process";
|
|
106034
106209
|
import { existsSync as existsSync71, realpathSync as realpathSync13 } from "fs";
|
|
106035
|
-
import { dirname as dirname29, join as
|
|
106210
|
+
import { dirname as dirname29, join as join88, resolve as resolve17, win32 as win328 } from "path";
|
|
106036
106211
|
var worktreePathCache2 = new Map;
|
|
106037
106212
|
function normalizePath4(path) {
|
|
106038
106213
|
const resolvedPath = process.platform !== "win32" && win328.isAbsolute(path) ? path : resolve17(path);
|
|
@@ -106067,7 +106242,7 @@ function findAncestorDirectories2(startDirectory, targetPaths, stopDirectory) {
|
|
|
106067
106242
|
const stopDirectoryKey = resolvedStopDirectory ? pathKey3(resolvedStopDirectory) : undefined;
|
|
106068
106243
|
while (true) {
|
|
106069
106244
|
for (const targetPath of targetPaths) {
|
|
106070
|
-
const candidateDirectory =
|
|
106245
|
+
const candidateDirectory = join88(currentDirectory, ...targetPath);
|
|
106071
106246
|
if (!existsSync71(candidateDirectory)) {
|
|
106072
106247
|
continue;
|
|
106073
106248
|
}
|
|
@@ -106222,7 +106397,7 @@ function deduplicateSkillsByName(skills) {
|
|
|
106222
106397
|
// packages/skills-loader-core/src/features/opencode-skill-loader/skill-directory-loader.ts
|
|
106223
106398
|
init_src();
|
|
106224
106399
|
import * as fs17 from "fs/promises";
|
|
106225
|
-
import { join as
|
|
106400
|
+
import { join as join90 } from "path";
|
|
106226
106401
|
|
|
106227
106402
|
// packages/skills-loader-core/src/features/opencode-skill-loader/loaded-skill-from-path.ts
|
|
106228
106403
|
init_src();
|
|
@@ -106242,7 +106417,7 @@ function parseAllowedTools(allowedTools) {
|
|
|
106242
106417
|
// packages/skills-loader-core/src/features/opencode-skill-loader/skill-mcp-config.ts
|
|
106243
106418
|
init_js_yaml();
|
|
106244
106419
|
import * as fs15 from "fs/promises";
|
|
106245
|
-
import { join as
|
|
106420
|
+
import { join as join89 } from "path";
|
|
106246
106421
|
function parseSkillMcpConfigFromFrontmatter(content) {
|
|
106247
106422
|
const frontmatterMatch = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
|
|
106248
106423
|
if (!frontmatterMatch)
|
|
@@ -106261,7 +106436,7 @@ function parseSkillMcpConfigFromFrontmatter(content) {
|
|
|
106261
106436
|
return;
|
|
106262
106437
|
}
|
|
106263
106438
|
async function loadMcpJsonFromDir(skillDir) {
|
|
106264
|
-
const mcpJsonPath =
|
|
106439
|
+
const mcpJsonPath = join89(skillDir, "mcp.json");
|
|
106265
106440
|
try {
|
|
106266
106441
|
const content = await fs15.readFile(mcpJsonPath, "utf-8");
|
|
106267
106442
|
const parsed = JSON.parse(content);
|
|
@@ -106377,10 +106552,10 @@ async function loadSkillsFromDir(options) {
|
|
|
106377
106552
|
const directories = entries.filter((entry) => !entry.name.startsWith(".") && (entry.isDirectory() || entry.isSymbolicLink()));
|
|
106378
106553
|
const files = entries.filter((entry) => !entry.name.startsWith(".") && !entry.isDirectory() && !entry.isSymbolicLink() && isMarkdownFile(entry));
|
|
106379
106554
|
for (const entry of directories) {
|
|
106380
|
-
const entryPath =
|
|
106555
|
+
const entryPath = join90(options.skillsDir, entry.name);
|
|
106381
106556
|
const resolvedPath = await resolveSymlinkAsync(entryPath);
|
|
106382
106557
|
const dirName = entry.name;
|
|
106383
|
-
const skillMdPath =
|
|
106558
|
+
const skillMdPath = join90(resolvedPath, "SKILL.md");
|
|
106384
106559
|
if (await canAccessFile(skillMdPath)) {
|
|
106385
106560
|
const skill = await loadSkillFromPath({
|
|
106386
106561
|
skillPath: skillMdPath,
|
|
@@ -106394,7 +106569,7 @@ async function loadSkillsFromDir(options) {
|
|
|
106394
106569
|
}
|
|
106395
106570
|
continue;
|
|
106396
106571
|
}
|
|
106397
|
-
const namedSkillMdPath =
|
|
106572
|
+
const namedSkillMdPath = join90(resolvedPath, `${dirName}.md`);
|
|
106398
106573
|
if (await canAccessFile(namedSkillMdPath)) {
|
|
106399
106574
|
const skill = await loadSkillFromPath({
|
|
106400
106575
|
skillPath: namedSkillMdPath,
|
|
@@ -106425,7 +106600,7 @@ async function loadSkillsFromDir(options) {
|
|
|
106425
106600
|
}
|
|
106426
106601
|
}
|
|
106427
106602
|
for (const entry of files) {
|
|
106428
|
-
const entryPath =
|
|
106603
|
+
const entryPath = join90(options.skillsDir, entry.name);
|
|
106429
106604
|
const baseName = inferSkillNameFromFileName(entryPath);
|
|
106430
106605
|
const skill = await loadSkillFromPath({
|
|
106431
106606
|
skillPath: entryPath,
|
|
@@ -106443,7 +106618,7 @@ async function loadSkillsFromDir(options) {
|
|
|
106443
106618
|
|
|
106444
106619
|
// packages/skills-loader-core/src/features/opencode-skill-loader/loader.ts
|
|
106445
106620
|
async function loadUserSkills() {
|
|
106446
|
-
const userSkillsDir =
|
|
106621
|
+
const userSkillsDir = join91(getClaudeConfigDir2(), "skills");
|
|
106447
106622
|
const skills = await loadSkillsFromDir({ skillsDir: userSkillsDir, scope: "user" });
|
|
106448
106623
|
return skillsToCommandDefinitionRecord(skills);
|
|
106449
106624
|
}
|
|
@@ -106468,7 +106643,7 @@ async function loadProjectAgentsSkills(directory) {
|
|
|
106468
106643
|
return skillsToCommandDefinitionRecord(deduplicateSkillsByName(allSkills.flat()));
|
|
106469
106644
|
}
|
|
106470
106645
|
async function loadGlobalAgentsSkills(homeDirectory = getHomeDirectory()) {
|
|
106471
|
-
const agentsGlobalDir =
|
|
106646
|
+
const agentsGlobalDir = join91(homeDirectory, ".agents", "skills");
|
|
106472
106647
|
const skills = await loadSkillsFromDir({ skillsDir: agentsGlobalDir, scope: "user" });
|
|
106473
106648
|
return skillsToCommandDefinitionRecord(skills);
|
|
106474
106649
|
}
|
|
@@ -106523,7 +106698,7 @@ async function discoverSkills(options = {}) {
|
|
|
106523
106698
|
]);
|
|
106524
106699
|
}
|
|
106525
106700
|
async function discoverUserClaudeSkills() {
|
|
106526
|
-
const userSkillsDir =
|
|
106701
|
+
const userSkillsDir = join91(getClaudeConfigDir2(), "skills");
|
|
106527
106702
|
return loadSkillsFromDir({ skillsDir: userSkillsDir, scope: "user" });
|
|
106528
106703
|
}
|
|
106529
106704
|
async function discoverProjectClaudeSkills(directory) {
|
|
@@ -106550,16 +106725,16 @@ async function discoverProjectAgentsSkills(directory) {
|
|
|
106550
106725
|
return deduplicateSkillsByName(allSkills.flat());
|
|
106551
106726
|
}
|
|
106552
106727
|
async function discoverGlobalAgentsSkills(homeDirectory = getHomeDirectory()) {
|
|
106553
|
-
const agentsGlobalDir =
|
|
106728
|
+
const agentsGlobalDir = join91(homeDirectory, ".agents", "skills");
|
|
106554
106729
|
return loadSkillsFromDir({ skillsDir: agentsGlobalDir, scope: "user" });
|
|
106555
106730
|
}
|
|
106556
106731
|
// packages/skills-loader-core/src/features/opencode-skill-loader/merger/builtin-skill-converter.ts
|
|
106557
106732
|
import { existsSync as existsSync72 } from "fs";
|
|
106558
|
-
import { join as
|
|
106733
|
+
import { join as join92 } from "path";
|
|
106559
106734
|
function resolveBuiltinSkillPath(builtin) {
|
|
106560
106735
|
if (builtin.resolvedPath !== undefined)
|
|
106561
106736
|
return builtin.resolvedPath;
|
|
106562
|
-
const sharedSkillPath =
|
|
106737
|
+
const sharedSkillPath = join92(sharedSkillsRootPath(), builtin.name);
|
|
106563
106738
|
return existsSync72(sharedSkillPath) ? sharedSkillPath : undefined;
|
|
106564
106739
|
}
|
|
106565
106740
|
function builtinToLoadedSkill(builtin) {
|
|
@@ -107012,7 +107187,7 @@ playwright-cli close
|
|
|
107012
107187
|
};
|
|
107013
107188
|
// packages/skills-loader-core/src/features/builtin-skills/skill-file-loader.ts
|
|
107014
107189
|
import { readFileSync as readFileSync47 } from "fs";
|
|
107015
|
-
import { join as
|
|
107190
|
+
import { join as join93 } from "path";
|
|
107016
107191
|
init_src();
|
|
107017
107192
|
function createSharedSkillTemplateLoader(readFile = readFileSync47, skillsRootPath = sharedSkillsRootPath()) {
|
|
107018
107193
|
const cache = new Map;
|
|
@@ -107021,7 +107196,7 @@ function createSharedSkillTemplateLoader(readFile = readFileSync47, skillsRootPa
|
|
|
107021
107196
|
if (cached !== undefined)
|
|
107022
107197
|
return cached;
|
|
107023
107198
|
try {
|
|
107024
|
-
const { body } = parseFrontmatter(readFile(
|
|
107199
|
+
const { body } = parseFrontmatter(readFile(join93(skillsRootPath, skillName, "SKILL.md"), "utf8"));
|
|
107025
107200
|
cache.set(skillName, body);
|
|
107026
107201
|
return body;
|
|
107027
107202
|
} catch (error) {
|
|
@@ -108158,7 +108333,7 @@ var gitMasterSkill = {
|
|
|
108158
108333
|
template: GIT_MASTER_TEMPLATE
|
|
108159
108334
|
};
|
|
108160
108335
|
// packages/skills-loader-core/src/features/builtin-skills/skills/dev-browser.ts
|
|
108161
|
-
import { dirname as dirname31, join as
|
|
108336
|
+
import { dirname as dirname31, join as join94 } from "path";
|
|
108162
108337
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
108163
108338
|
var CURRENT_DIR = dirname31(fileURLToPath6(import.meta.url));
|
|
108164
108339
|
var devBrowserSkill = {
|
|
@@ -108378,7 +108553,7 @@ console.log({
|
|
|
108378
108553
|
await client.disconnect();
|
|
108379
108554
|
EOF
|
|
108380
108555
|
\`\`\``,
|
|
108381
|
-
resolvedPath:
|
|
108556
|
+
resolvedPath: join94(CURRENT_DIR, "..", "dev-browser")
|
|
108382
108557
|
};
|
|
108383
108558
|
// packages/skills-loader-core/src/features/builtin-skills/skills/review-work.ts
|
|
108384
108559
|
var reviewWorkSkill = {
|
|
@@ -109320,7 +109495,7 @@ init_src();
|
|
|
109320
109495
|
var import_picomatch2 = __toESM(require_picomatch2(), 1);
|
|
109321
109496
|
import * as fs18 from "fs/promises";
|
|
109322
109497
|
import { homedir as homedir19 } from "os";
|
|
109323
|
-
import { dirname as dirname32, extname, isAbsolute as isAbsolute13, join as
|
|
109498
|
+
import { dirname as dirname32, extname, isAbsolute as isAbsolute13, join as join95, relative as relative13 } from "path";
|
|
109324
109499
|
var MAX_RECURSIVE_DEPTH = 10;
|
|
109325
109500
|
function isHttpUrl(path) {
|
|
109326
109501
|
return path.startsWith("http://") || path.startsWith("https://");
|
|
@@ -109330,12 +109505,12 @@ function toAbsolutePath(path, configDir) {
|
|
|
109330
109505
|
return homedir19();
|
|
109331
109506
|
}
|
|
109332
109507
|
if (path.startsWith("~/")) {
|
|
109333
|
-
return
|
|
109508
|
+
return join95(homedir19(), path.slice(2));
|
|
109334
109509
|
}
|
|
109335
109510
|
if (isAbsolute13(path)) {
|
|
109336
109511
|
return path;
|
|
109337
109512
|
}
|
|
109338
|
-
return
|
|
109513
|
+
return join95(configDir, path);
|
|
109339
109514
|
}
|
|
109340
109515
|
function isMarkdownPath(path) {
|
|
109341
109516
|
return extname(path).toLowerCase() === ".md";
|
|
@@ -109464,8 +109639,8 @@ function readOpencodeConfigSkills(directory) {
|
|
|
109464
109639
|
return { paths, urls };
|
|
109465
109640
|
}
|
|
109466
109641
|
// packages/omo-opencode/src/tools/slashcommand/command-discovery.ts
|
|
109467
|
-
import { existsSync as existsSync75, readdirSync as
|
|
109468
|
-
import { basename as basename13, join as
|
|
109642
|
+
import { existsSync as existsSync75, readdirSync as readdirSync22, readFileSync as readFileSync50, statSync as statSync12 } from "fs";
|
|
109643
|
+
import { basename as basename13, join as join97 } from "path";
|
|
109469
109644
|
init_logger2();
|
|
109470
109645
|
|
|
109471
109646
|
// packages/omo-opencode/src/features/builtin-commands/templates/goal.ts
|
|
@@ -110981,11 +111156,11 @@ var NESTED_COMMAND_SEPARATOR = "/";
|
|
|
110981
111156
|
function discoverCommandsFromDir(commandsDir, scope, prefix = "") {
|
|
110982
111157
|
if (!existsSync75(commandsDir))
|
|
110983
111158
|
return [];
|
|
110984
|
-
if (!
|
|
111159
|
+
if (!statSync12(commandsDir).isDirectory()) {
|
|
110985
111160
|
log2(`[command-discovery] Skipping non-directory path: ${commandsDir}`);
|
|
110986
111161
|
return [];
|
|
110987
111162
|
}
|
|
110988
|
-
const entries =
|
|
111163
|
+
const entries = readdirSync22(commandsDir, { withFileTypes: true });
|
|
110989
111164
|
const commands = [];
|
|
110990
111165
|
for (const entry of entries) {
|
|
110991
111166
|
if (entry.isDirectory()) {
|
|
@@ -110994,12 +111169,12 @@ function discoverCommandsFromDir(commandsDir, scope, prefix = "") {
|
|
|
110994
111169
|
if (entry.name.startsWith("."))
|
|
110995
111170
|
continue;
|
|
110996
111171
|
const nestedPrefix = prefix ? `${prefix}${NESTED_COMMAND_SEPARATOR}${entry.name}` : entry.name;
|
|
110997
|
-
commands.push(...discoverCommandsFromDir(
|
|
111172
|
+
commands.push(...discoverCommandsFromDir(join97(commandsDir, entry.name), scope, nestedPrefix));
|
|
110998
111173
|
continue;
|
|
110999
111174
|
}
|
|
111000
111175
|
if (!isMarkdownFile(entry))
|
|
111001
111176
|
continue;
|
|
111002
|
-
const commandPath =
|
|
111177
|
+
const commandPath = join97(commandsDir, entry.name);
|
|
111003
111178
|
const baseCommandName = basename13(entry.name, ".md");
|
|
111004
111179
|
const commandName = prefix ? `${prefix}${NESTED_COMMAND_SEPARATOR}${baseCommandName}` : baseCommandName;
|
|
111005
111180
|
try {
|
|
@@ -111058,8 +111233,8 @@ function deduplicateCommandInfosByName(commands) {
|
|
|
111058
111233
|
return deduplicatedCommands;
|
|
111059
111234
|
}
|
|
111060
111235
|
function discoverCommandsSync(directory, options) {
|
|
111061
|
-
const userCommandsDir =
|
|
111062
|
-
const projectCommandsDir =
|
|
111236
|
+
const userCommandsDir = join97(getClaudeConfigDir(), "commands");
|
|
111237
|
+
const projectCommandsDir = join97(directory ?? process.cwd(), ".claude", "commands");
|
|
111063
111238
|
const opencodeGlobalDirs = getOpenCodeCommandDirs({ binary: "opencode" });
|
|
111064
111239
|
const opencodeProjectDirs = findProjectOpencodeCommandDirs(directory ?? process.cwd());
|
|
111065
111240
|
const userCommands = discoverCommandsFromDir(userCommandsDir, "user");
|
|
@@ -111757,16 +111932,45 @@ to continue: task(task_id="${taskId}", load_skills=[], run_in_background=true, p
|
|
|
111757
111932
|
"tool.execute.after": toolExecuteAfter
|
|
111758
111933
|
};
|
|
111759
111934
|
}
|
|
111935
|
+
// packages/omo-senpi/src/components/agent-home/resolve-agent-home.ts
|
|
111936
|
+
import { existsSync as existsSync76 } from "fs";
|
|
111937
|
+
import { homedir as homedir20 } from "os";
|
|
111938
|
+
import { join as join98, resolve as resolve20 } from "path";
|
|
111939
|
+
var AGENT_DIR_ENV_NAMES = [
|
|
111940
|
+
"OMO_CODING_AGENT_DIR",
|
|
111941
|
+
"SENPI_CODING_AGENT_DIR",
|
|
111942
|
+
"PI_CODING_AGENT_DIR"
|
|
111943
|
+
];
|
|
111944
|
+
var AGENT_HOME_SENTINEL = "settings.json";
|
|
111945
|
+
function resolveAgentHome(options) {
|
|
111946
|
+
const { env, homeDir = homedir20(), exists = existsSync76 } = options;
|
|
111947
|
+
for (const name of AGENT_DIR_ENV_NAMES) {
|
|
111948
|
+
const configured = env[name]?.trim();
|
|
111949
|
+
if (configured)
|
|
111950
|
+
return resolve20(configured);
|
|
111951
|
+
}
|
|
111952
|
+
const brandedHome = join98(homeDir, ".omo");
|
|
111953
|
+
const canonical = join98(brandedHome, "agent");
|
|
111954
|
+
if (exists(join98(canonical, AGENT_HOME_SENTINEL)))
|
|
111955
|
+
return canonical;
|
|
111956
|
+
if (exists(join98(brandedHome, AGENT_HOME_SENTINEL)))
|
|
111957
|
+
return brandedHome;
|
|
111958
|
+
return join98(homeDir, ".senpi", "agent");
|
|
111959
|
+
}
|
|
111960
|
+
function resolveAgentSessionsDirectory(options) {
|
|
111961
|
+
return join98(resolveAgentHome(options), "sessions");
|
|
111962
|
+
}
|
|
111963
|
+
|
|
111760
111964
|
// packages/omo-opencode/src/hooks/ulw-execute/ulw-execute-hook.ts
|
|
111761
111965
|
init_logger2();
|
|
111762
111966
|
|
|
111763
111967
|
// packages/omo-opencode/src/hooks/ulw-execute/worktree-detector.ts
|
|
111764
111968
|
import { execFileSync as execFileSync5 } from "child_process";
|
|
111765
|
-
import { existsSync as
|
|
111766
|
-
import { resolve as
|
|
111969
|
+
import { existsSync as existsSync77, realpathSync as realpathSync14 } from "fs";
|
|
111970
|
+
import { resolve as resolve21, win32 as win329 } from "path";
|
|
111767
111971
|
function normalizePath5(path) {
|
|
111768
|
-
const resolvedPath = process.platform !== "win32" && win329.isAbsolute(path) ? path :
|
|
111769
|
-
if (!
|
|
111972
|
+
const resolvedPath = process.platform !== "win32" && win329.isAbsolute(path) ? path : resolve21(path);
|
|
111973
|
+
if (!existsSync77(resolvedPath)) {
|
|
111770
111974
|
return resolvedPath;
|
|
111771
111975
|
}
|
|
111772
111976
|
try {
|
|
@@ -111873,7 +112077,7 @@ ${completionInstruction}`;
|
|
|
111873
112077
|
// packages/omo-opencode/src/hooks/ulw-execute/notepad-scaffold.ts
|
|
111874
112078
|
init_logger2();
|
|
111875
112079
|
import { mkdirSync as mkdirSync19, writeFileSync as writeFileSync20 } from "fs";
|
|
111876
|
-
import { join as
|
|
112080
|
+
import { join as join99 } from "path";
|
|
111877
112081
|
var NOTEPAD_FILES = [
|
|
111878
112082
|
"learnings.md",
|
|
111879
112083
|
"decisions.md",
|
|
@@ -111907,14 +112111,14 @@ ${NOTEPAD_FOOTER}
|
|
|
111907
112111
|
}
|
|
111908
112112
|
function ensureNotepadScaffold(params) {
|
|
111909
112113
|
const { directory, planName, timestamp = new Date().toISOString() } = params;
|
|
111910
|
-
const notepadDir =
|
|
112114
|
+
const notepadDir = join99(directory, ".omo", "notepads", planName);
|
|
111911
112115
|
mkdirSync19(notepadDir, { recursive: true });
|
|
111912
112116
|
const created = [];
|
|
111913
112117
|
const skipped = [];
|
|
111914
112118
|
for (const fileName of NOTEPAD_FILES) {
|
|
111915
112119
|
const header = buildHeader(fileName, planName, timestamp);
|
|
111916
112120
|
try {
|
|
111917
|
-
writeFileSync20(
|
|
112121
|
+
writeFileSync20(join99(notepadDir, fileName), header, { flag: "wx" });
|
|
111918
112122
|
created.push(fileName);
|
|
111919
112123
|
} catch (err) {
|
|
111920
112124
|
if (err.code === "EEXIST") {
|
|
@@ -112030,7 +112234,7 @@ Read the plan file and continue from the first unchecked task.`;
|
|
|
112030
112234
|
init_logger2();
|
|
112031
112235
|
|
|
112032
112236
|
// packages/omo-opencode/src/hooks/ulw-execute/plan-selection.ts
|
|
112033
|
-
import { statSync as
|
|
112237
|
+
import { statSync as statSync13 } from "fs";
|
|
112034
112238
|
function normalizePlanLookupValue(value) {
|
|
112035
112239
|
return value.trim().replace(/^["'`]+|["'`]+$/g, "").toLowerCase().replace(/[\s_]+/g, "-").replace(/[^\p{L}\p{N}-]+/gu, "-").replace(/-+/g, "-").replace(/^-+|-+$/g, "");
|
|
112036
112240
|
}
|
|
@@ -112057,7 +112261,7 @@ function pickPreferredIncompletePlan(incompletePlans, preferredPlanPath) {
|
|
|
112057
112261
|
function formatIncompletePlanList(plans, includeModifiedTime) {
|
|
112058
112262
|
return plans.map((planPath, index) => {
|
|
112059
112263
|
const progress = getPlanProgress(planPath);
|
|
112060
|
-
const modified = includeModifiedTime ? ` - Modified: ${new Date(
|
|
112264
|
+
const modified = includeModifiedTime ? ` - Modified: ${new Date(statSync13(planPath).mtimeMs).toISOString()}` : "";
|
|
112061
112265
|
return `${index + 1}. [${getPlanName(planPath)}]${modified} - Progress: ${progress.completed}/${progress.total}`;
|
|
112062
112266
|
}).join(`
|
|
112063
112267
|
`);
|
|
@@ -112576,6 +112780,12 @@ function createUlwExecuteHook(ctx) {
|
|
|
112576
112780
|
if (output.message) {
|
|
112577
112781
|
output.message["agent"] = resolveRegisteredAgentName(activeAgent) ?? activeAgent;
|
|
112578
112782
|
}
|
|
112783
|
+
const reconciled = reconcileStaleWorks(ctx.directory, {
|
|
112784
|
+
sessionsDirectory: resolveAgentSessionsDirectory({ env: process.env, homeDir: resolveHomeDir(process.env) })
|
|
112785
|
+
});
|
|
112786
|
+
if (reconciled.demoted.length > 0) {
|
|
112787
|
+
log2(`[${HOOK_NAME8}] Paused stale works`, { sessionID: input.sessionID, demoted: reconciled.demoted });
|
|
112788
|
+
}
|
|
112579
112789
|
const existingState = readBoulderState(ctx.directory);
|
|
112580
112790
|
const sessionId = normalizeSessionId(input.sessionID, "opencode");
|
|
112581
112791
|
const timestamp = new Date().toISOString();
|
|
@@ -113221,8 +113431,8 @@ async function isSessionInBoulderLineage(input) {
|
|
|
113221
113431
|
}
|
|
113222
113432
|
|
|
113223
113433
|
// packages/omo-opencode/src/hooks/atlas/session-last-agent.ts
|
|
113224
|
-
import { readFileSync as readFileSync51, readdirSync as
|
|
113225
|
-
import { join as
|
|
113434
|
+
import { readFileSync as readFileSync51, readdirSync as readdirSync23 } from "fs";
|
|
113435
|
+
import { join as join100 } from "path";
|
|
113226
113436
|
var defaultSessionLastAgentDeps = {
|
|
113227
113437
|
getMessageDir,
|
|
113228
113438
|
isSqliteBackend,
|
|
@@ -113280,9 +113490,9 @@ async function getLastAgentFromSession(sessionID, client, deps = {}) {
|
|
|
113280
113490
|
if (!messageDir)
|
|
113281
113491
|
return null;
|
|
113282
113492
|
try {
|
|
113283
|
-
const messages =
|
|
113493
|
+
const messages = readdirSync23(messageDir).filter((fileName) => fileName.endsWith(".json")).map((fileName) => {
|
|
113284
113494
|
try {
|
|
113285
|
-
const content = readFileSync51(
|
|
113495
|
+
const content = readFileSync51(join100(messageDir, fileName), "utf-8");
|
|
113286
113496
|
const parsed = JSON.parse(content);
|
|
113287
113497
|
return {
|
|
113288
113498
|
fileName,
|
|
@@ -113954,7 +114164,7 @@ async function validateSubagentSessionId(input) {
|
|
|
113954
114164
|
}
|
|
113955
114165
|
|
|
113956
114166
|
// packages/omo-opencode/src/hooks/atlas/tool-execute-after-direct-work.ts
|
|
113957
|
-
import { resolve as
|
|
114167
|
+
import { resolve as resolve22 } from "path";
|
|
113958
114168
|
init_logger2();
|
|
113959
114169
|
|
|
113960
114170
|
// packages/omo-opencode/src/hooks/atlas/omo-path.ts
|
|
@@ -113963,7 +114173,7 @@ function isOmoPath(filePath) {
|
|
|
113963
114173
|
}
|
|
113964
114174
|
|
|
113965
114175
|
// packages/omo-opencode/src/hooks/atlas/tool-execute-after-plan-tasks.ts
|
|
113966
|
-
import { existsSync as
|
|
114176
|
+
import { existsSync as existsSync78, readFileSync as readFileSync52 } from "fs";
|
|
113967
114177
|
var TODO_HEADING_PATTERN2 = /^##\s+TODOs\b/i;
|
|
113968
114178
|
var FINAL_VERIFICATION_HEADING_PATTERN2 = /^##\s+Final Verification Wave\b/i;
|
|
113969
114179
|
var SECOND_LEVEL_HEADING_PATTERN = /^##\s+/;
|
|
@@ -113971,7 +114181,7 @@ var CHECKED_CHECKBOX_PATTERN = /^(\s*)[-*]\s*\[[xX]\]\s*(.+)$/;
|
|
|
113971
114181
|
var TODO_TASK_PATTERN = /^(\d+)\.\s+(.+)$/;
|
|
113972
114182
|
var FINAL_WAVE_TASK_PATTERN = /^(F\d+)\.\s+(.+)$/i;
|
|
113973
114183
|
function isTrackedTaskChecked(planPath, taskKey) {
|
|
113974
|
-
if (!
|
|
114184
|
+
if (!existsSync78(planPath)) {
|
|
113975
114185
|
return false;
|
|
113976
114186
|
}
|
|
113977
114187
|
const [section, label] = taskKey.split(":");
|
|
@@ -114025,7 +114235,7 @@ function parseCheckedTopLevelTaskKeys(planContent) {
|
|
|
114025
114235
|
return checkedKeys;
|
|
114026
114236
|
}
|
|
114027
114237
|
function readCheckedTaskKeysFromPlan(planPath) {
|
|
114028
|
-
if (!
|
|
114238
|
+
if (!existsSync78(planPath)) {
|
|
114029
114239
|
return new Set;
|
|
114030
114240
|
}
|
|
114031
114241
|
try {
|
|
@@ -114064,7 +114274,7 @@ async function handleDirectWorkToolAfter(input) {
|
|
|
114064
114274
|
const sessionWork = getWorkForSession(ctx.directory, toolInput.sessionID);
|
|
114065
114275
|
if (sessionWork) {
|
|
114066
114276
|
const planPath = resolveBoulderPlanPathForWork(ctx.directory, sessionWork);
|
|
114067
|
-
if (
|
|
114277
|
+
if (resolve22(filePath) === resolve22(planPath) && planSnapshot !== undefined) {
|
|
114068
114278
|
const beforeCheckedKeys = parseCheckedTopLevelTaskKeys(planSnapshot);
|
|
114069
114279
|
const afterCheckedKeys = readCheckedTaskKeysFromPlan(planPath);
|
|
114070
114280
|
for (const taskKey of afterCheckedKeys) {
|
|
@@ -114204,7 +114414,7 @@ async function resolveFallbackTrackedSessionId(input) {
|
|
|
114204
114414
|
}
|
|
114205
114415
|
|
|
114206
114416
|
// packages/omo-opencode/src/hooks/atlas/final-wave-plan-state.ts
|
|
114207
|
-
import { existsSync as
|
|
114417
|
+
import { existsSync as existsSync79, readFileSync as readFileSync53 } from "fs";
|
|
114208
114418
|
var TODO_HEADING_PATTERN3 = /^##\s+TODOs\b/i;
|
|
114209
114419
|
var FINAL_VERIFICATION_HEADING_PATTERN3 = /^##\s+Final Verification Wave\b/i;
|
|
114210
114420
|
var SECOND_LEVEL_HEADING_PATTERN2 = /^##\s+/;
|
|
@@ -114212,7 +114422,7 @@ var UNCHECKED_CHECKBOX_PATTERN = /^\s*[-*]\s*\[\s*\]\s*(.+)$/;
|
|
|
114212
114422
|
var TODO_TASK_PATTERN2 = /^\d+\./;
|
|
114213
114423
|
var FINAL_WAVE_TASK_PATTERN2 = /^F\d+\./i;
|
|
114214
114424
|
function readFinalWavePlanState(planPath) {
|
|
114215
|
-
if (!
|
|
114425
|
+
if (!existsSync79(planPath)) {
|
|
114216
114426
|
return null;
|
|
114217
114427
|
}
|
|
114218
114428
|
try {
|
|
@@ -114821,8 +115031,8 @@ function createToolExecuteAfterHandler2(input) {
|
|
|
114821
115031
|
|
|
114822
115032
|
// packages/omo-opencode/src/hooks/atlas/tool-execute-before.ts
|
|
114823
115033
|
init_logger2();
|
|
114824
|
-
import { existsSync as
|
|
114825
|
-
import { resolve as
|
|
115034
|
+
import { existsSync as existsSync80, readFileSync as readFileSync54 } from "fs";
|
|
115035
|
+
import { resolve as resolve23 } from "path";
|
|
114826
115036
|
var TASK_SECTION_HEADER_PATTERN = /^##\s*1\.\s*TASK\s*$/i;
|
|
114827
115037
|
var TODO_TASK_LINE_PATTERN = /^(?:[-*]\s*\[\s*\]\s*)?(\d+)\.\s+(.+)$/;
|
|
114828
115038
|
var FINAL_WAVE_TASK_LINE_PATTERN = /^(?:[-*]\s*\[\s*\]\s*)?(F\d+)\.\s+(.+)$/i;
|
|
@@ -114883,9 +115093,9 @@ function createToolExecuteBeforeHandler2(input) {
|
|
|
114883
115093
|
const sessionWork = sessionID ? getWorkForSession(ctx.directory, sessionID) : null;
|
|
114884
115094
|
const state = sessionWork ? null : readBoulderState(ctx.directory);
|
|
114885
115095
|
const planPath = sessionWork ? resolveBoulderPlanPathForWork(ctx.directory, sessionWork) : state ? resolveBoulderPlanPath(ctx.directory, state) : null;
|
|
114886
|
-
if (planPath &&
|
|
115096
|
+
if (planPath && resolve23(filePath) === resolve23(planPath) && pendingPlanSnapshots) {
|
|
114887
115097
|
try {
|
|
114888
|
-
if (
|
|
115098
|
+
if (existsSync80(planPath)) {
|
|
114889
115099
|
pendingPlanSnapshots.set(toolInput.callID, readFileSync54(planPath, "utf-8"));
|
|
114890
115100
|
trackPlanSnapshot?.(toolInput.callID, readFileSync54(planPath, "utf-8"));
|
|
114891
115101
|
}
|
|
@@ -118910,11 +119120,11 @@ function createRuntimeFallbackHook(ctx, options, factoryOverrides = {}) {
|
|
|
118910
119120
|
};
|
|
118911
119121
|
}
|
|
118912
119122
|
// packages/omo-opencode/src/hooks/write-existing-file-guard/hook.ts
|
|
118913
|
-
import { existsSync as
|
|
118914
|
-
import { basename as basename14, dirname as dirname34, isAbsolute as isAbsolute15, join as
|
|
119123
|
+
import { existsSync as existsSync82, realpathSync as realpathSync15 } from "fs";
|
|
119124
|
+
import { basename as basename14, dirname as dirname34, isAbsolute as isAbsolute15, join as join101, normalize as normalize2, relative as relative15, resolve as resolve24 } from "path";
|
|
118915
119125
|
|
|
118916
119126
|
// packages/omo-opencode/src/hooks/write-existing-file-guard/tool-execute-before-handler.ts
|
|
118917
|
-
import { existsSync as
|
|
119127
|
+
import { existsSync as existsSync81 } from "fs";
|
|
118918
119128
|
|
|
118919
119129
|
// packages/omo-opencode/src/hooks/write-existing-file-guard/session-read-permissions.ts
|
|
118920
119130
|
function touchSession(sessionLastAccess, sessionID) {
|
|
@@ -119015,7 +119225,7 @@ async function handleWriteExistingFileGuardToolExecuteBefore(params) {
|
|
|
119015
119225
|
return;
|
|
119016
119226
|
}
|
|
119017
119227
|
if (toolName === "read") {
|
|
119018
|
-
if (!
|
|
119228
|
+
if (!existsSync81(resolvedPath) || !input.sessionID) {
|
|
119019
119229
|
return;
|
|
119020
119230
|
}
|
|
119021
119231
|
registerReadPermission({
|
|
@@ -119033,7 +119243,7 @@ async function handleWriteExistingFileGuardToolExecuteBefore(params) {
|
|
|
119033
119243
|
const { overwrite: _, ...rest } = argsRecord;
|
|
119034
119244
|
output.args = rest;
|
|
119035
119245
|
}
|
|
119036
|
-
if (!
|
|
119246
|
+
if (!existsSync81(resolvedPath)) {
|
|
119037
119247
|
return;
|
|
119038
119248
|
}
|
|
119039
119249
|
if (isOmoWorkspacePath(canonicalPath)) {
|
|
@@ -119083,7 +119293,7 @@ function getPathFromArgs(args) {
|
|
|
119083
119293
|
return args?.filePath ?? args?.path ?? args?.file_path;
|
|
119084
119294
|
}
|
|
119085
119295
|
function resolveInputPath(ctx, inputPath) {
|
|
119086
|
-
return normalize2(isAbsolute15(inputPath) ? inputPath :
|
|
119296
|
+
return normalize2(isAbsolute15(inputPath) ? inputPath : resolve24(ctx.directory, inputPath));
|
|
119087
119297
|
}
|
|
119088
119298
|
function isPathInsideDirectory(pathToCheck, directory) {
|
|
119089
119299
|
const relativePath = relative15(directory, pathToCheck);
|
|
@@ -119091,7 +119301,7 @@ function isPathInsideDirectory(pathToCheck, directory) {
|
|
|
119091
119301
|
}
|
|
119092
119302
|
function toCanonicalPath2(absolutePath) {
|
|
119093
119303
|
let canonicalPath = absolutePath;
|
|
119094
|
-
if (
|
|
119304
|
+
if (existsSync82(absolutePath)) {
|
|
119095
119305
|
try {
|
|
119096
119306
|
canonicalPath = realpathSync15.native(absolutePath);
|
|
119097
119307
|
} catch (canonicalPathError) {
|
|
@@ -119099,8 +119309,8 @@ function toCanonicalPath2(absolutePath) {
|
|
|
119099
119309
|
}
|
|
119100
119310
|
} else {
|
|
119101
119311
|
const absoluteDir = dirname34(absolutePath);
|
|
119102
|
-
const resolvedDir =
|
|
119103
|
-
canonicalPath =
|
|
119312
|
+
const resolvedDir = existsSync82(absoluteDir) ? realpathSync15.native(absoluteDir) : absoluteDir;
|
|
119313
|
+
canonicalPath = join101(resolvedDir, basename14(absolutePath));
|
|
119104
119314
|
}
|
|
119105
119315
|
return normalize2(canonicalPath);
|
|
119106
119316
|
}
|
|
@@ -121861,23 +122071,23 @@ init_logger2();
|
|
|
121861
122071
|
init_plugin_identity();
|
|
121862
122072
|
|
|
121863
122073
|
// packages/omo-opencode/src/hooks/legacy-plugin-toast/auto-migrate.ts
|
|
121864
|
-
import { existsSync as
|
|
121865
|
-
import { join as
|
|
122074
|
+
import { existsSync as existsSync83, readFileSync as readFileSync55 } from "fs";
|
|
122075
|
+
import { join as join102 } from "path";
|
|
121866
122076
|
init_plugin_identity();
|
|
121867
122077
|
function detectOpenCodeConfigPath(overrideConfigDir) {
|
|
121868
122078
|
if (overrideConfigDir) {
|
|
121869
|
-
const jsoncPath =
|
|
121870
|
-
const jsonPath =
|
|
121871
|
-
if (
|
|
122079
|
+
const jsoncPath = join102(overrideConfigDir, "opencode.jsonc");
|
|
122080
|
+
const jsonPath = join102(overrideConfigDir, "opencode.json");
|
|
122081
|
+
if (existsSync83(jsoncPath))
|
|
121872
122082
|
return jsoncPath;
|
|
121873
|
-
if (
|
|
122083
|
+
if (existsSync83(jsonPath))
|
|
121874
122084
|
return jsonPath;
|
|
121875
122085
|
return null;
|
|
121876
122086
|
}
|
|
121877
122087
|
const paths = getOpenCodeConfigPaths({ binary: "opencode", version: null });
|
|
121878
|
-
if (
|
|
122088
|
+
if (existsSync83(paths.configJsonc))
|
|
121879
122089
|
return paths.configJsonc;
|
|
121880
|
-
if (
|
|
122090
|
+
if (existsSync83(paths.configJson))
|
|
121881
122091
|
return paths.configJson;
|
|
121882
122092
|
return null;
|
|
121883
122093
|
}
|
|
@@ -122095,8 +122305,8 @@ function createNotepadWriteGuardHook() {
|
|
|
122095
122305
|
};
|
|
122096
122306
|
}
|
|
122097
122307
|
// packages/omo-opencode/src/hooks/plan-format-validator/hook.ts
|
|
122098
|
-
import { existsSync as
|
|
122099
|
-
import { resolve as
|
|
122308
|
+
import { existsSync as existsSync84, readFileSync as readFileSync56, writeFileSync as writeFileSync21 } from "fs";
|
|
122309
|
+
import { resolve as resolve25 } from "path";
|
|
122100
122310
|
init_logger2();
|
|
122101
122311
|
var WRITE_TOOLS = new Set(["Write", "Edit", "write", "edit"]);
|
|
122102
122312
|
var SECTION_BOUNDARY_HEADING = /^#{1,2}(?:[ \t]+|$)/;
|
|
@@ -122292,8 +122502,8 @@ function createPlanFormatValidatorHook(_ctx) {
|
|
|
122292
122502
|
return;
|
|
122293
122503
|
if (!isPlanFilePath(filePath))
|
|
122294
122504
|
return;
|
|
122295
|
-
const resolvedPath =
|
|
122296
|
-
if (!
|
|
122505
|
+
const resolvedPath = resolve25(_ctx.directory, filePath);
|
|
122506
|
+
if (!existsSync84(resolvedPath))
|
|
122297
122507
|
return;
|
|
122298
122508
|
let content = readFileSync56(resolvedPath, "utf-8");
|
|
122299
122509
|
const effort = normalizePlanEffort(content);
|
|
@@ -122402,7 +122612,7 @@ function createMonitorStatusInjectorHook(monitorManager, config) {
|
|
|
122402
122612
|
};
|
|
122403
122613
|
}
|
|
122404
122614
|
// packages/omo-opencode/src/tools/grep/tools.ts
|
|
122405
|
-
import { resolve as
|
|
122615
|
+
import { resolve as resolve26 } from "path";
|
|
122406
122616
|
|
|
122407
122617
|
// node_modules/.bun/@opencode-ai+plugin@1.18.22+5df5880790e6b42e/node_modules/@opencode-ai/plugin/dist/tool.js
|
|
122408
122618
|
import { z as z53 } from "zod";
|
|
@@ -122413,19 +122623,19 @@ tool.schema = z53;
|
|
|
122413
122623
|
|
|
122414
122624
|
// packages/omo-opencode/src/shared/ripgrep-cli.ts
|
|
122415
122625
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
122416
|
-
import { existsSync as
|
|
122417
|
-
import { dirname as dirname35, join as
|
|
122626
|
+
import { existsSync as existsSync86 } from "fs";
|
|
122627
|
+
import { dirname as dirname35, join as join104 } from "path";
|
|
122418
122628
|
|
|
122419
122629
|
// packages/omo-opencode/src/tools/grep/downloader.ts
|
|
122420
|
-
import { existsSync as
|
|
122421
|
-
import { join as
|
|
122630
|
+
import { existsSync as existsSync85, readdirSync as readdirSync24 } from "fs";
|
|
122631
|
+
import { join as join103 } from "path";
|
|
122422
122632
|
init_plugin_identity();
|
|
122423
122633
|
function findFileRecursive(dir, filename) {
|
|
122424
122634
|
try {
|
|
122425
|
-
const entries =
|
|
122635
|
+
const entries = readdirSync24(dir, { withFileTypes: true, recursive: true });
|
|
122426
122636
|
for (const entry of entries) {
|
|
122427
122637
|
if (entry.isFile() && entry.name === filename) {
|
|
122428
|
-
return
|
|
122638
|
+
return join103(entry.parentPath ?? dir, entry.name);
|
|
122429
122639
|
}
|
|
122430
122640
|
}
|
|
122431
122641
|
} catch (error) {
|
|
@@ -122449,11 +122659,11 @@ function getPlatformKey() {
|
|
|
122449
122659
|
}
|
|
122450
122660
|
function getInstallDir() {
|
|
122451
122661
|
const homeDir = process.env.HOME || process.env.USERPROFILE || ".";
|
|
122452
|
-
return
|
|
122662
|
+
return join103(homeDir, ".cache", CACHE_DIR_NAME, "bin");
|
|
122453
122663
|
}
|
|
122454
122664
|
function getRgPath() {
|
|
122455
122665
|
const isWindows = process.platform === "win32";
|
|
122456
|
-
return
|
|
122666
|
+
return join103(getInstallDir(), isWindows ? "rg.exe" : "rg");
|
|
122457
122667
|
}
|
|
122458
122668
|
async function extractTarGz2(archivePath, destDir) {
|
|
122459
122669
|
const platformKey = getPlatformKey();
|
|
@@ -122470,7 +122680,7 @@ async function extractZip2(archivePath, destDir) {
|
|
|
122470
122680
|
const binaryName = process.platform === "win32" ? "rg.exe" : "rg";
|
|
122471
122681
|
const foundPath = findFileRecursive(destDir, binaryName);
|
|
122472
122682
|
if (foundPath) {
|
|
122473
|
-
const destPath =
|
|
122683
|
+
const destPath = join103(destDir, binaryName);
|
|
122474
122684
|
if (foundPath !== destPath) {
|
|
122475
122685
|
const { renameSync } = await import("fs");
|
|
122476
122686
|
renameSync(foundPath, destPath);
|
|
@@ -122485,13 +122695,13 @@ async function downloadAndInstallRipgrep() {
|
|
|
122485
122695
|
}
|
|
122486
122696
|
const installDir = getInstallDir();
|
|
122487
122697
|
const rgPath = getRgPath();
|
|
122488
|
-
if (
|
|
122698
|
+
if (existsSync85(rgPath)) {
|
|
122489
122699
|
return rgPath;
|
|
122490
122700
|
}
|
|
122491
122701
|
ensureCacheDir(installDir);
|
|
122492
122702
|
const filename = `ripgrep-${RG_VERSION}-${config.platform}.${config.extension}`;
|
|
122493
122703
|
const url = `https://github.com/BurntSushi/ripgrep/releases/download/${RG_VERSION}/${filename}`;
|
|
122494
|
-
const archivePath =
|
|
122704
|
+
const archivePath = join103(installDir, filename);
|
|
122495
122705
|
try {
|
|
122496
122706
|
await downloadArchive(url, archivePath);
|
|
122497
122707
|
if (config.extension === "tar.gz") {
|
|
@@ -122500,7 +122710,7 @@ async function downloadAndInstallRipgrep() {
|
|
|
122500
122710
|
await extractZip2(archivePath, installDir);
|
|
122501
122711
|
}
|
|
122502
122712
|
ensureExecutable(rgPath);
|
|
122503
|
-
if (!
|
|
122713
|
+
if (!existsSync85(rgPath)) {
|
|
122504
122714
|
throw new Error("ripgrep binary not found after extraction");
|
|
122505
122715
|
}
|
|
122506
122716
|
return rgPath;
|
|
@@ -122516,7 +122726,7 @@ async function downloadAndInstallRipgrep() {
|
|
|
122516
122726
|
}
|
|
122517
122727
|
function getInstalledRipgrepPath() {
|
|
122518
122728
|
const rgPath = getRgPath();
|
|
122519
|
-
return
|
|
122729
|
+
return existsSync85(rgPath) ? rgPath : null;
|
|
122520
122730
|
}
|
|
122521
122731
|
|
|
122522
122732
|
// packages/omo-opencode/src/shared/ripgrep-cli.ts
|
|
@@ -122556,15 +122766,15 @@ function getOpenCodeBundledRg() {
|
|
|
122556
122766
|
const isWindows = process.platform === "win32";
|
|
122557
122767
|
const rgName = isWindows ? "rg.exe" : "rg";
|
|
122558
122768
|
const candidates = [
|
|
122559
|
-
|
|
122560
|
-
|
|
122561
|
-
|
|
122562
|
-
|
|
122563
|
-
|
|
122564
|
-
|
|
122769
|
+
join104(getOpenCodeCacheDir(), "bin", rgName),
|
|
122770
|
+
join104(getDataDir(), "opencode", "bin", rgName),
|
|
122771
|
+
join104(execDir, rgName),
|
|
122772
|
+
join104(execDir, "bin", rgName),
|
|
122773
|
+
join104(execDir, "..", "bin", rgName),
|
|
122774
|
+
join104(execDir, "..", "libexec", rgName)
|
|
122565
122775
|
];
|
|
122566
122776
|
for (const candidate of candidates) {
|
|
122567
|
-
if (
|
|
122777
|
+
if (existsSync86(candidate)) {
|
|
122568
122778
|
return candidate;
|
|
122569
122779
|
}
|
|
122570
122780
|
}
|
|
@@ -122967,7 +123177,7 @@ function createGrepTools(ctx) {
|
|
|
122967
123177
|
const globs = args.include ? [args.include] : undefined;
|
|
122968
123178
|
const runtimeCtx = context;
|
|
122969
123179
|
const dir = typeof runtimeCtx.directory === "string" ? runtimeCtx.directory : ctx.directory;
|
|
122970
|
-
const searchPath = args.path ?
|
|
123180
|
+
const searchPath = args.path ? resolve26(dir, args.path) : dir;
|
|
122971
123181
|
const paths = [searchPath];
|
|
122972
123182
|
const outputMode = args.output_mode ?? "files_with_matches";
|
|
122973
123183
|
const headLimit = args.head_limit ?? 0;
|
|
@@ -122998,11 +123208,11 @@ function createGrepTools(ctx) {
|
|
|
122998
123208
|
return { grep };
|
|
122999
123209
|
}
|
|
123000
123210
|
// packages/omo-opencode/src/tools/glob/tools.ts
|
|
123001
|
-
import { resolve as
|
|
123211
|
+
import { resolve as resolve28 } from "path";
|
|
123002
123212
|
|
|
123003
123213
|
// packages/omo-opencode/src/tools/glob/cli.ts
|
|
123004
123214
|
init_bun_spawn_shim();
|
|
123005
|
-
import { resolve as
|
|
123215
|
+
import { resolve as resolve27 } from "path";
|
|
123006
123216
|
|
|
123007
123217
|
// packages/omo-opencode/src/tools/glob/constants.ts
|
|
123008
123218
|
var DEFAULT_TIMEOUT_MS3 = 60000;
|
|
@@ -123130,7 +123340,7 @@ async function runRgFilesInternal(options, resolvedCli, processSpawner = spawn)
|
|
|
123130
123340
|
}
|
|
123131
123341
|
let filePath;
|
|
123132
123342
|
if (isRg) {
|
|
123133
|
-
filePath = cwd ?
|
|
123343
|
+
filePath = cwd ? resolve27(cwd, line) : line;
|
|
123134
123344
|
} else if (isWindows) {
|
|
123135
123345
|
filePath = line.trim();
|
|
123136
123346
|
} else {
|
|
@@ -123190,7 +123400,7 @@ function createGlobTools(ctx) {
|
|
|
123190
123400
|
const cli = await resolveGrepCliWithAutoInstall();
|
|
123191
123401
|
const runtimeCtx = context;
|
|
123192
123402
|
const dir = typeof runtimeCtx.directory === "string" ? runtimeCtx.directory : ctx.directory;
|
|
123193
|
-
const searchPath = args.path ?
|
|
123403
|
+
const searchPath = args.path ? resolve28(dir, args.path) : dir;
|
|
123194
123404
|
const result = await runRgFiles({
|
|
123195
123405
|
pattern: args.pattern,
|
|
123196
123406
|
paths: [searchPath]
|
|
@@ -123738,9 +123948,9 @@ function createSkillTool(options) {
|
|
|
123738
123948
|
}
|
|
123739
123949
|
var skill = createSkillTool({ directory: process.cwd() });
|
|
123740
123950
|
// packages/omo-opencode/src/tools/session-manager/constants.ts
|
|
123741
|
-
import { join as
|
|
123742
|
-
var TODO_DIR2 =
|
|
123743
|
-
var TRANSCRIPT_DIR2 =
|
|
123951
|
+
import { join as join105 } from "path";
|
|
123952
|
+
var TODO_DIR2 = join105(getClaudeConfigDir(), "todos");
|
|
123953
|
+
var TRANSCRIPT_DIR2 = join105(getClaudeConfigDir(), "transcripts");
|
|
123744
123954
|
var SESSION_LIST_DESCRIPTION = `List all OpenCode sessions with optional filtering.
|
|
123745
123955
|
|
|
123746
123956
|
Returns a list of available session IDs with metadata including message count, date range, and agents used.
|
|
@@ -123813,9 +124023,9 @@ Has Todos: Yes (12 items, 8 completed)
|
|
|
123813
124023
|
Has Transcript: Yes (234 entries)`;
|
|
123814
124024
|
|
|
123815
124025
|
// packages/omo-opencode/src/tools/session-manager/file-storage.ts
|
|
123816
|
-
import { existsSync as
|
|
124026
|
+
import { existsSync as existsSync87 } from "fs";
|
|
123817
124027
|
import { readdir as readdir6, readFile as readFile8 } from "fs/promises";
|
|
123818
|
-
import { join as
|
|
124028
|
+
import { join as join106 } from "path";
|
|
123819
124029
|
|
|
123820
124030
|
// packages/omo-opencode/src/tools/session-manager/directory-filter.ts
|
|
123821
124031
|
import { normalize as normalize4, parse as parse3, sep as sep3 } from "path";
|
|
@@ -123839,7 +124049,7 @@ function ignoreFileStorageError(error) {
|
|
|
123839
124049
|
throw error;
|
|
123840
124050
|
}
|
|
123841
124051
|
async function getFileMainSessions(directory) {
|
|
123842
|
-
if (!
|
|
124052
|
+
if (!existsSync87(SESSION_STORAGE))
|
|
123843
124053
|
return [];
|
|
123844
124054
|
const sessions = [];
|
|
123845
124055
|
try {
|
|
@@ -123847,13 +124057,13 @@ async function getFileMainSessions(directory) {
|
|
|
123847
124057
|
for (const projectDir of projectDirs) {
|
|
123848
124058
|
if (!projectDir.isDirectory())
|
|
123849
124059
|
continue;
|
|
123850
|
-
const projectPath =
|
|
124060
|
+
const projectPath = join106(SESSION_STORAGE, projectDir.name);
|
|
123851
124061
|
const sessionFiles = await readdir6(projectPath);
|
|
123852
124062
|
for (const file of sessionFiles) {
|
|
123853
124063
|
if (!file.endsWith(".json"))
|
|
123854
124064
|
continue;
|
|
123855
124065
|
try {
|
|
123856
|
-
const content = await readFile8(
|
|
124066
|
+
const content = await readFile8(join106(projectPath, file), "utf-8");
|
|
123857
124067
|
const meta = JSON.parse(content);
|
|
123858
124068
|
if (meta.parentID)
|
|
123859
124069
|
continue;
|
|
@@ -123873,7 +124083,7 @@ async function getFileMainSessions(directory) {
|
|
|
123873
124083
|
return sessions.sort((a, b) => b.time.updated - a.time.updated);
|
|
123874
124084
|
}
|
|
123875
124085
|
async function getFileAllSessions() {
|
|
123876
|
-
if (!
|
|
124086
|
+
if (!existsSync87(MESSAGE_STORAGE))
|
|
123877
124087
|
return [];
|
|
123878
124088
|
const sessions = [];
|
|
123879
124089
|
async function scanDirectory(dir) {
|
|
@@ -123882,7 +124092,7 @@ async function getFileAllSessions() {
|
|
|
123882
124092
|
for (const entry of entries) {
|
|
123883
124093
|
if (!entry.isDirectory())
|
|
123884
124094
|
continue;
|
|
123885
|
-
const sessionPath =
|
|
124095
|
+
const sessionPath = join106(dir, entry.name);
|
|
123886
124096
|
const files = await readdir6(sessionPath);
|
|
123887
124097
|
if (files.some((file) => file.endsWith(".json"))) {
|
|
123888
124098
|
sessions.push(entry.name);
|
|
@@ -123903,7 +124113,7 @@ async function fileSessionExists(sessionID) {
|
|
|
123903
124113
|
}
|
|
123904
124114
|
async function getFileSessionMessages(sessionID) {
|
|
123905
124115
|
const messageDir = getMessageDir(sessionID);
|
|
123906
|
-
if (!messageDir || !
|
|
124116
|
+
if (!messageDir || !existsSync87(messageDir))
|
|
123907
124117
|
return [];
|
|
123908
124118
|
const messages = [];
|
|
123909
124119
|
try {
|
|
@@ -123912,7 +124122,7 @@ async function getFileSessionMessages(sessionID) {
|
|
|
123912
124122
|
if (!file.endsWith(".json"))
|
|
123913
124123
|
continue;
|
|
123914
124124
|
try {
|
|
123915
|
-
const content = await readFile8(
|
|
124125
|
+
const content = await readFile8(join106(messageDir, file), "utf-8");
|
|
123916
124126
|
const meta = JSON.parse(content);
|
|
123917
124127
|
const parts = await readParts2(meta.id);
|
|
123918
124128
|
messages.push({
|
|
@@ -123940,8 +124150,8 @@ async function getFileSessionMessages(sessionID) {
|
|
|
123940
124150
|
});
|
|
123941
124151
|
}
|
|
123942
124152
|
async function readParts2(messageID) {
|
|
123943
|
-
const partDir =
|
|
123944
|
-
if (!
|
|
124153
|
+
const partDir = join106(PART_STORAGE, messageID);
|
|
124154
|
+
if (!existsSync87(partDir))
|
|
123945
124155
|
return [];
|
|
123946
124156
|
const parts = [];
|
|
123947
124157
|
try {
|
|
@@ -123950,7 +124160,7 @@ async function readParts2(messageID) {
|
|
|
123950
124160
|
if (!file.endsWith(".json"))
|
|
123951
124161
|
continue;
|
|
123952
124162
|
try {
|
|
123953
|
-
const content = await readFile8(
|
|
124163
|
+
const content = await readFile8(join106(partDir, file), "utf-8");
|
|
123954
124164
|
parts.push(JSON.parse(content));
|
|
123955
124165
|
} catch (error) {
|
|
123956
124166
|
ignoreFileStorageError(error);
|
|
@@ -123964,14 +124174,14 @@ async function readParts2(messageID) {
|
|
|
123964
124174
|
return parts.sort((a, b) => a.id.localeCompare(b.id));
|
|
123965
124175
|
}
|
|
123966
124176
|
async function getFileSessionTodos(sessionID) {
|
|
123967
|
-
if (!
|
|
124177
|
+
if (!existsSync87(TODO_DIR2))
|
|
123968
124178
|
return [];
|
|
123969
124179
|
try {
|
|
123970
124180
|
const allFiles = await readdir6(TODO_DIR2);
|
|
123971
124181
|
const todoFiles = allFiles.filter((file) => file === `${sessionID}.json`);
|
|
123972
124182
|
for (const file of todoFiles) {
|
|
123973
124183
|
try {
|
|
123974
|
-
const content = await readFile8(
|
|
124184
|
+
const content = await readFile8(join106(TODO_DIR2, file), "utf-8");
|
|
123975
124185
|
const data = JSON.parse(content);
|
|
123976
124186
|
if (!Array.isArray(data))
|
|
123977
124187
|
continue;
|
|
@@ -123993,10 +124203,10 @@ async function getFileSessionTodos(sessionID) {
|
|
|
123993
124203
|
return [];
|
|
123994
124204
|
}
|
|
123995
124205
|
async function getFileSessionTranscript(sessionID) {
|
|
123996
|
-
if (!
|
|
124206
|
+
if (!existsSync87(TRANSCRIPT_DIR2))
|
|
123997
124207
|
return 0;
|
|
123998
|
-
const transcriptFile =
|
|
123999
|
-
if (!
|
|
124208
|
+
const transcriptFile = join106(TRANSCRIPT_DIR2, `${sessionID}.jsonl`);
|
|
124209
|
+
if (!existsSync87(transcriptFile))
|
|
124000
124210
|
return 0;
|
|
124001
124211
|
try {
|
|
124002
124212
|
const content = await readFile8(transcriptFile, "utf-8");
|
|
@@ -125858,23 +126068,23 @@ Other built-in agents, custom agents, and task categories are intentionally not
|
|
|
125858
126068
|
|
|
125859
126069
|
Pass \`session_id=<id>\` to continue previous agent with full context. Nested subagent depth is tracked automatically and blocked past the configured limit. Prompts MUST be in English. Use \`background_output\` for async results.`;
|
|
125860
126070
|
// packages/claude-code-compat-core/src/features/claude-code-agent-loader/loader.ts
|
|
125861
|
-
import { existsSync as
|
|
125862
|
-
import { join as
|
|
126071
|
+
import { existsSync as existsSync92, readdirSync as readdirSync25 } from "fs";
|
|
126072
|
+
import { join as join112 } from "path";
|
|
125863
126073
|
|
|
125864
126074
|
// packages/claude-code-compat-core/src/shared/claude-config-dir.ts
|
|
125865
|
-
import { homedir as
|
|
125866
|
-
import { join as
|
|
126075
|
+
import { homedir as homedir21 } from "os";
|
|
126076
|
+
import { join as join107 } from "path";
|
|
125867
126077
|
function getClaudeConfigDir3() {
|
|
125868
126078
|
const envConfigDir = process.env.CLAUDE_CONFIG_DIR;
|
|
125869
126079
|
if (envConfigDir) {
|
|
125870
126080
|
return envConfigDir;
|
|
125871
126081
|
}
|
|
125872
|
-
return
|
|
126082
|
+
return join107(process.env.HOME || process.env.USERPROFILE || homedir21(), ".claude");
|
|
125873
126083
|
}
|
|
125874
126084
|
// packages/claude-code-compat-core/src/shared/opencode-config-dir.ts
|
|
125875
|
-
import { existsSync as
|
|
125876
|
-
import { homedir as
|
|
125877
|
-
import { join as
|
|
126085
|
+
import { existsSync as existsSync88, realpathSync as realpathSync16 } from "fs";
|
|
126086
|
+
import { homedir as homedir22 } from "os";
|
|
126087
|
+
import { join as join108, posix as posix10, resolve as resolve29, win32 as win3211 } from "path";
|
|
125878
126088
|
var TAURI_APP_IDENTIFIER3 = "ai.opencode.desktop";
|
|
125879
126089
|
var TAURI_APP_IDENTIFIER_DEV3 = "ai.opencode.desktop.dev";
|
|
125880
126090
|
function isDevBuild3(version) {
|
|
@@ -125886,15 +126096,15 @@ function getTauriConfigDir3(identifier) {
|
|
|
125886
126096
|
const platform = process.platform;
|
|
125887
126097
|
switch (platform) {
|
|
125888
126098
|
case "darwin":
|
|
125889
|
-
return
|
|
126099
|
+
return join108(homedir22(), "Library", "Application Support", identifier);
|
|
125890
126100
|
case "win32": {
|
|
125891
|
-
const appData = process.env.APPDATA ||
|
|
126101
|
+
const appData = process.env.APPDATA || join108(homedir22(), "AppData", "Roaming");
|
|
125892
126102
|
return win3211.join(appData, identifier);
|
|
125893
126103
|
}
|
|
125894
126104
|
case "linux":
|
|
125895
126105
|
default: {
|
|
125896
|
-
const xdgConfig = process.env.XDG_CONFIG_HOME ||
|
|
125897
|
-
return
|
|
126106
|
+
const xdgConfig = process.env.XDG_CONFIG_HOME || join108(homedir22(), ".config");
|
|
126107
|
+
return join108(xdgConfig, identifier);
|
|
125898
126108
|
}
|
|
125899
126109
|
}
|
|
125900
126110
|
}
|
|
@@ -125902,8 +126112,8 @@ function resolveConfigPath3(pathValue) {
|
|
|
125902
126112
|
if (isWslEnvironment3() && pathValue.startsWith("/")) {
|
|
125903
126113
|
return posix10.normalize(pathValue);
|
|
125904
126114
|
}
|
|
125905
|
-
const resolvedPath =
|
|
125906
|
-
if (!
|
|
126115
|
+
const resolvedPath = resolve29(pathValue);
|
|
126116
|
+
if (!existsSync88(resolvedPath))
|
|
125907
126117
|
return resolvedPath;
|
|
125908
126118
|
try {
|
|
125909
126119
|
return realpathSync16(resolvedPath);
|
|
@@ -125937,8 +126147,8 @@ function getWslLinuxHomeDir3(windowsConfigRoot) {
|
|
|
125937
126147
|
function getCliDefaultConfigDir3() {
|
|
125938
126148
|
const envXdgConfig = process.env.XDG_CONFIG_HOME?.trim();
|
|
125939
126149
|
const shouldIgnoreWindowsXdg = envXdgConfig !== undefined && envXdgConfig.length > 0 && isWslEnvironment3() && isWindowsUserConfigRoot3(envXdgConfig);
|
|
125940
|
-
const xdgConfig = shouldIgnoreWindowsXdg ? posix10.join(getWslLinuxHomeDir3(envXdgConfig) ?? "/home", ".config") : envXdgConfig ||
|
|
125941
|
-
const configDir = isWslEnvironment3() ? posix10.join(xdgConfig, "opencode") :
|
|
126150
|
+
const xdgConfig = shouldIgnoreWindowsXdg ? posix10.join(getWslLinuxHomeDir3(envXdgConfig) ?? "/home", ".config") : envXdgConfig || join108(homedir22(), ".config");
|
|
126151
|
+
const configDir = isWslEnvironment3() ? posix10.join(xdgConfig, "opencode") : join108(xdgConfig, "opencode");
|
|
125942
126152
|
return resolveConfigPath3(configDir);
|
|
125943
126153
|
}
|
|
125944
126154
|
function getCliCustomConfigDir3() {
|
|
@@ -125971,9 +126181,9 @@ function getOpenCodeConfigDir3(options) {
|
|
|
125971
126181
|
const tauriDir = process.platform === "win32" ? win3211.isAbsolute(tauriDirBase) ? win3211.normalize(tauriDirBase) : win3211.resolve(tauriDirBase) : resolveConfigPath3(tauriDirBase);
|
|
125972
126182
|
if (checkExisting) {
|
|
125973
126183
|
const legacyDir = getCliConfigDir3();
|
|
125974
|
-
const legacyConfig =
|
|
125975
|
-
const legacyConfigC =
|
|
125976
|
-
if (
|
|
126184
|
+
const legacyConfig = join108(legacyDir, "opencode.json");
|
|
126185
|
+
const legacyConfigC = join108(legacyDir, "opencode.jsonc");
|
|
126186
|
+
if (existsSync88(legacyConfig) || existsSync88(legacyConfigC)) {
|
|
125977
126187
|
return legacyDir;
|
|
125978
126188
|
}
|
|
125979
126189
|
}
|
|
@@ -125982,12 +126192,12 @@ function getOpenCodeConfigDir3(options) {
|
|
|
125982
126192
|
// packages/claude-code-compat-core/src/shared/jsonc-parser.ts
|
|
125983
126193
|
init_src();
|
|
125984
126194
|
// packages/claude-code-compat-core/src/shared/resolve-agent-definition-paths.ts
|
|
125985
|
-
import { homedir as
|
|
125986
|
-
import { isAbsolute as isAbsolute16, join as
|
|
126195
|
+
import { homedir as homedir23 } from "os";
|
|
126196
|
+
import { isAbsolute as isAbsolute16, join as join109, resolve as resolve30 } from "path";
|
|
125987
126197
|
function resolveAgentDefinitionPaths(paths, baseDir, containmentDir) {
|
|
125988
126198
|
return paths.flatMap((p) => {
|
|
125989
|
-
const expanded = p.startsWith("~/") ?
|
|
125990
|
-
const resolved = isAbsolute16(expanded) ? expanded :
|
|
126199
|
+
const expanded = p.startsWith("~/") ? join109(homedir23(), p.slice(2)) : p;
|
|
126200
|
+
const resolved = isAbsolute16(expanded) ? expanded : resolve30(baseDir, expanded);
|
|
125991
126201
|
if (containmentDir !== null && !isWithinProject(resolved, containmentDir)) {
|
|
125992
126202
|
log4(`agent_definitions path rejected (outside project boundary): ${p} -> ${resolved}`);
|
|
125993
126203
|
return [];
|
|
@@ -126014,7 +126224,7 @@ var EXCLUDED_DIR_NAMES2 = [
|
|
|
126014
126224
|
];
|
|
126015
126225
|
var EXCLUDED_DIRS3 = Object.freeze(new Set(EXCLUDED_DIR_NAMES2));
|
|
126016
126226
|
// packages/claude-code-compat-core/src/shared/opencode-command-dirs.ts
|
|
126017
|
-
import { basename as basename15, dirname as dirname38, join as
|
|
126227
|
+
import { basename as basename15, dirname as dirname38, join as join110 } from "path";
|
|
126018
126228
|
function getParentOpencodeConfigDir3(configDir) {
|
|
126019
126229
|
const parentDir = dirname38(configDir);
|
|
126020
126230
|
if (basename15(parentDir) !== "profiles") {
|
|
@@ -126028,21 +126238,21 @@ function getOpenCodeCommandDirs2(options) {
|
|
|
126028
126238
|
...configDirs.flatMap((configDir) => {
|
|
126029
126239
|
const parentConfigDir = getParentOpencodeConfigDir3(configDir);
|
|
126030
126240
|
return [
|
|
126031
|
-
|
|
126032
|
-
|
|
126033
|
-
...parentConfigDir ? [
|
|
126241
|
+
join110(configDir, "commands"),
|
|
126242
|
+
join110(configDir, "command"),
|
|
126243
|
+
...parentConfigDir ? [join110(parentConfigDir, "commands"), join110(parentConfigDir, "command")] : []
|
|
126034
126244
|
];
|
|
126035
126245
|
})
|
|
126036
126246
|
]));
|
|
126037
126247
|
}
|
|
126038
126248
|
// packages/claude-code-compat-core/src/shared/project-discovery-dirs.ts
|
|
126039
126249
|
import { execFileSync as execFileSync6 } from "child_process";
|
|
126040
|
-
import { existsSync as
|
|
126041
|
-
import { dirname as dirname39, join as
|
|
126250
|
+
import { existsSync as existsSync89, realpathSync as realpathSync17 } from "fs";
|
|
126251
|
+
import { dirname as dirname39, join as join111, resolve as resolve31, win32 as win3212 } from "path";
|
|
126042
126252
|
var worktreePathCache3 = new Map;
|
|
126043
126253
|
function normalizePath6(path) {
|
|
126044
|
-
const resolvedPath = process.platform !== "win32" && win3212.isAbsolute(path) ? path :
|
|
126045
|
-
if (!
|
|
126254
|
+
const resolvedPath = process.platform !== "win32" && win3212.isAbsolute(path) ? path : resolve31(path);
|
|
126255
|
+
if (!existsSync89(resolvedPath)) {
|
|
126046
126256
|
return resolvedPath;
|
|
126047
126257
|
}
|
|
126048
126258
|
try {
|
|
@@ -126066,7 +126276,7 @@ function pathKey4(path) {
|
|
|
126066
126276
|
return process.platform === "win32" ? normalized.toLowerCase() : normalized;
|
|
126067
126277
|
}
|
|
126068
126278
|
function detectWorktreePath4(directory) {
|
|
126069
|
-
const resolvedDirectory =
|
|
126279
|
+
const resolvedDirectory = resolve31(directory);
|
|
126070
126280
|
const cacheKey = pathKey4(normalizePath6(resolvedDirectory));
|
|
126071
126281
|
if (worktreePathCache3.has(cacheKey)) {
|
|
126072
126282
|
return worktreePathCache3.get(cacheKey);
|
|
@@ -126097,7 +126307,7 @@ function detectWorktreePath4(directory) {
|
|
|
126097
126307
|
function findGitMarkerAncestor(directory) {
|
|
126098
126308
|
let currentDirectory = normalizePath6(directory);
|
|
126099
126309
|
while (true) {
|
|
126100
|
-
if (
|
|
126310
|
+
if (existsSync89(join111(currentDirectory, ".git"))) {
|
|
126101
126311
|
return currentDirectory;
|
|
126102
126312
|
}
|
|
126103
126313
|
const parentDirectory = dirname39(currentDirectory);
|
|
@@ -126115,8 +126325,8 @@ function findAncestorDirectories3(startDirectory, targetPaths, stopDirectory) {
|
|
|
126115
126325
|
const stopDirectoryKey = resolvedStopDirectory ? pathKey4(resolvedStopDirectory) : undefined;
|
|
126116
126326
|
while (true) {
|
|
126117
126327
|
for (const targetPath of targetPaths) {
|
|
126118
|
-
const candidateDirectory =
|
|
126119
|
-
if (!
|
|
126328
|
+
const candidateDirectory = join111(currentDirectory, ...targetPath);
|
|
126329
|
+
if (!existsSync89(candidateDirectory)) {
|
|
126120
126330
|
continue;
|
|
126121
126331
|
}
|
|
126122
126332
|
const normalizedCandidateDirectory = normalizePath6(candidateDirectory);
|
|
@@ -126145,14 +126355,14 @@ function findProjectOpencodeCommandDirs2(startDirectory, stopDirectory) {
|
|
|
126145
126355
|
], detectedStopDirectory);
|
|
126146
126356
|
}
|
|
126147
126357
|
// packages/claude-code-compat-core/src/features/claude-code-agent-loader/agent-definitions-loader.ts
|
|
126148
|
-
import { existsSync as
|
|
126358
|
+
import { existsSync as existsSync91, readFileSync as readFileSync58 } from "fs";
|
|
126149
126359
|
import { basename as basename16, extname as extname3 } from "path";
|
|
126150
126360
|
|
|
126151
126361
|
// packages/claude-code-compat-core/src/features/claude-code-agent-loader/json-agent-loader.ts
|
|
126152
|
-
import { existsSync as
|
|
126362
|
+
import { existsSync as existsSync90, readFileSync as readFileSync57 } from "fs";
|
|
126153
126363
|
function parseJsonAgentFile(filePath, scope) {
|
|
126154
126364
|
try {
|
|
126155
|
-
if (!
|
|
126365
|
+
if (!existsSync90(filePath)) {
|
|
126156
126366
|
return null;
|
|
126157
126367
|
}
|
|
126158
126368
|
const content = readFileSync57(filePath, "utf-8");
|
|
@@ -126193,7 +126403,7 @@ function parseJsonAgentFile(filePath, scope) {
|
|
|
126193
126403
|
// packages/claude-code-compat-core/src/features/claude-code-agent-loader/agent-definitions-loader.ts
|
|
126194
126404
|
function parseMarkdownAgentFile(filePath, scope, anthropicProvider) {
|
|
126195
126405
|
try {
|
|
126196
|
-
if (!
|
|
126406
|
+
if (!existsSync91(filePath)) {
|
|
126197
126407
|
return null;
|
|
126198
126408
|
}
|
|
126199
126409
|
const content = readFileSync58(filePath, "utf-8");
|
|
@@ -126230,7 +126440,7 @@ function parseMarkdownAgentFile(filePath, scope, anthropicProvider) {
|
|
|
126230
126440
|
function loadAgentDefinitions(paths, scope, anthropicProvider) {
|
|
126231
126441
|
const result = Object.create(null);
|
|
126232
126442
|
for (const filePath of paths) {
|
|
126233
|
-
if (!
|
|
126443
|
+
if (!existsSync91(filePath)) {
|
|
126234
126444
|
log4(`[agent-definitions-loader] File not found, skipping: ${filePath}`);
|
|
126235
126445
|
continue;
|
|
126236
126446
|
}
|
|
@@ -126255,15 +126465,15 @@ function loadAgentDefinitions(paths, scope, anthropicProvider) {
|
|
|
126255
126465
|
|
|
126256
126466
|
// packages/claude-code-compat-core/src/features/claude-code-agent-loader/loader.ts
|
|
126257
126467
|
function loadAgentsFromDir(agentsDir, scope, anthropicProvider) {
|
|
126258
|
-
if (!
|
|
126468
|
+
if (!existsSync92(agentsDir)) {
|
|
126259
126469
|
return [];
|
|
126260
126470
|
}
|
|
126261
|
-
const entries =
|
|
126471
|
+
const entries = readdirSync25(agentsDir, { withFileTypes: true });
|
|
126262
126472
|
const agents = [];
|
|
126263
126473
|
for (const entry of entries) {
|
|
126264
126474
|
if (!isMarkdownFile(entry))
|
|
126265
126475
|
continue;
|
|
126266
|
-
const agentPath =
|
|
126476
|
+
const agentPath = join112(agentsDir, entry.name);
|
|
126267
126477
|
const agent = parseMarkdownAgentFile(agentPath, scope, anthropicProvider);
|
|
126268
126478
|
if (agent) {
|
|
126269
126479
|
agents.push(agent);
|
|
@@ -126272,7 +126482,7 @@ function loadAgentsFromDir(agentsDir, scope, anthropicProvider) {
|
|
|
126272
126482
|
return agents;
|
|
126273
126483
|
}
|
|
126274
126484
|
function loadUserAgents(anthropicProvider) {
|
|
126275
|
-
const userAgentsDir =
|
|
126485
|
+
const userAgentsDir = join112(getClaudeConfigDir3(), "agents");
|
|
126276
126486
|
const agents = loadAgentsFromDir(userAgentsDir, "user", anthropicProvider);
|
|
126277
126487
|
const result = Object.create(null);
|
|
126278
126488
|
for (const agent of agents) {
|
|
@@ -126281,7 +126491,7 @@ function loadUserAgents(anthropicProvider) {
|
|
|
126281
126491
|
return result;
|
|
126282
126492
|
}
|
|
126283
126493
|
function loadProjectAgents(directory, anthropicProvider) {
|
|
126284
|
-
const projectAgentsDir =
|
|
126494
|
+
const projectAgentsDir = join112(directory ?? process.cwd(), ".claude", "agents");
|
|
126285
126495
|
const agents = loadAgentsFromDir(projectAgentsDir, "project", anthropicProvider);
|
|
126286
126496
|
const result = Object.create(null);
|
|
126287
126497
|
for (const agent of agents) {
|
|
@@ -126293,7 +126503,7 @@ function loadOpencodeGlobalAgents() {
|
|
|
126293
126503
|
const result = Object.create(null);
|
|
126294
126504
|
const configDirs = getOpenCodeConfigDirs3({ binary: "opencode" });
|
|
126295
126505
|
for (const configDir of configDirs) {
|
|
126296
|
-
const opencodeAgentsDir =
|
|
126506
|
+
const opencodeAgentsDir = join112(configDir, "agents");
|
|
126297
126507
|
const agents = loadAgentsFromDir(opencodeAgentsDir, "opencode");
|
|
126298
126508
|
for (const agent of agents) {
|
|
126299
126509
|
if (!(agent.name in result)) {
|
|
@@ -126304,7 +126514,7 @@ function loadOpencodeGlobalAgents() {
|
|
|
126304
126514
|
return result;
|
|
126305
126515
|
}
|
|
126306
126516
|
function loadOpencodeProjectAgents(directory) {
|
|
126307
|
-
const opencodeProjectDir =
|
|
126517
|
+
const opencodeProjectDir = join112(directory ?? process.cwd(), ".opencode", "agents");
|
|
126308
126518
|
const agents = loadAgentsFromDir(opencodeProjectDir, "opencode-project");
|
|
126309
126519
|
const result = Object.create(null);
|
|
126310
126520
|
for (const agent of agents) {
|
|
@@ -127132,9 +127342,9 @@ import { pathToFileURL } from "url";
|
|
|
127132
127342
|
|
|
127133
127343
|
// packages/omo-opencode/src/tools/look-at/image-converter.ts
|
|
127134
127344
|
import * as childProcess2 from "child_process";
|
|
127135
|
-
import { existsSync as
|
|
127345
|
+
import { existsSync as existsSync94, mkdtempSync, readFileSync as readFileSync60, rmSync as rmSync5, unlinkSync as unlinkSync15, writeFileSync as writeFileSync22 } from "fs";
|
|
127136
127346
|
import { tmpdir as tmpdir7 } from "os";
|
|
127137
|
-
import { dirname as dirname41, join as
|
|
127347
|
+
import { dirname as dirname41, join as join114 } from "path";
|
|
127138
127348
|
var SUPPORTED_FORMATS = new Set([
|
|
127139
127349
|
"image/jpeg",
|
|
127140
127350
|
"image/png",
|
|
@@ -127164,7 +127374,7 @@ var UNSUPPORTED_FORMATS = new Set([
|
|
|
127164
127374
|
var CONVERSION_TIMEOUT_MS = 30000;
|
|
127165
127375
|
function cleanupTemporaryFileAfterFailure(filePath) {
|
|
127166
127376
|
try {
|
|
127167
|
-
if (
|
|
127377
|
+
if (existsSync94(filePath)) {
|
|
127168
127378
|
unlinkSync15(filePath);
|
|
127169
127379
|
}
|
|
127170
127380
|
} catch (cleanupError) {
|
|
@@ -127182,11 +127392,11 @@ function needsConversion(mimeType) {
|
|
|
127182
127392
|
return mimeType.startsWith("image/");
|
|
127183
127393
|
}
|
|
127184
127394
|
function convertImageToJpeg(inputPath, mimeType) {
|
|
127185
|
-
if (!
|
|
127395
|
+
if (!existsSync94(inputPath)) {
|
|
127186
127396
|
throw new Error(`File not found: ${inputPath}`);
|
|
127187
127397
|
}
|
|
127188
|
-
const tempDir = mkdtempSync(
|
|
127189
|
-
const outputPath =
|
|
127398
|
+
const tempDir = mkdtempSync(join114(tmpdir7(), "opencode-img-"));
|
|
127399
|
+
const outputPath = join114(tempDir, "converted.jpg");
|
|
127190
127400
|
log2(`[image-converter] Converting ${mimeType} to JPEG: ${inputPath}`);
|
|
127191
127401
|
try {
|
|
127192
127402
|
if (process.platform === "darwin") {
|
|
@@ -127196,7 +127406,7 @@ function convertImageToJpeg(inputPath, mimeType) {
|
|
|
127196
127406
|
encoding: "utf-8",
|
|
127197
127407
|
timeout: CONVERSION_TIMEOUT_MS
|
|
127198
127408
|
});
|
|
127199
|
-
if (
|
|
127409
|
+
if (existsSync94(outputPath)) {
|
|
127200
127410
|
log2(`[image-converter] Converted using sips: ${outputPath}`);
|
|
127201
127411
|
return outputPath;
|
|
127202
127412
|
}
|
|
@@ -127212,7 +127422,7 @@ function convertImageToJpeg(inputPath, mimeType) {
|
|
|
127212
127422
|
encoding: "utf-8",
|
|
127213
127423
|
timeout: CONVERSION_TIMEOUT_MS
|
|
127214
127424
|
});
|
|
127215
|
-
if (
|
|
127425
|
+
if (existsSync94(outputPath)) {
|
|
127216
127426
|
log2(`[image-converter] Converted using ImageMagick: ${outputPath}`);
|
|
127217
127427
|
return outputPath;
|
|
127218
127428
|
}
|
|
@@ -127236,11 +127446,11 @@ function convertImageToJpeg(inputPath, mimeType) {
|
|
|
127236
127446
|
function cleanupConvertedImage(filePath) {
|
|
127237
127447
|
try {
|
|
127238
127448
|
const tempDirectory = dirname41(filePath);
|
|
127239
|
-
if (
|
|
127449
|
+
if (existsSync94(filePath)) {
|
|
127240
127450
|
unlinkSync15(filePath);
|
|
127241
127451
|
log2(`[image-converter] Cleaned up temporary file: ${filePath}`);
|
|
127242
127452
|
}
|
|
127243
|
-
if (
|
|
127453
|
+
if (existsSync94(tempDirectory)) {
|
|
127244
127454
|
rmSync5(tempDirectory, { recursive: true, force: true });
|
|
127245
127455
|
log2(`[image-converter] Cleaned up temporary directory: ${tempDirectory}`);
|
|
127246
127456
|
}
|
|
@@ -127250,9 +127460,9 @@ function cleanupConvertedImage(filePath) {
|
|
|
127250
127460
|
}
|
|
127251
127461
|
}
|
|
127252
127462
|
function convertBase64ImageToJpeg(base64Data, mimeType) {
|
|
127253
|
-
const tempDir = mkdtempSync(
|
|
127463
|
+
const tempDir = mkdtempSync(join114(tmpdir7(), "opencode-b64-"));
|
|
127254
127464
|
const inputExt = mimeType.split("/")[1] || "bin";
|
|
127255
|
-
const inputPath =
|
|
127465
|
+
const inputPath = join114(tempDir, `input.${inputExt}`);
|
|
127256
127466
|
const tempFiles = [inputPath];
|
|
127257
127467
|
try {
|
|
127258
127468
|
const cleanBase64 = base64Data.replace(/^data:[^;]+;base64,/, "");
|
|
@@ -131522,7 +131732,7 @@ function isExplicitSyncRun(runInBackground) {
|
|
|
131522
131732
|
return runInBackground === false || runInBackground === "false";
|
|
131523
131733
|
}
|
|
131524
131734
|
// packages/omo-opencode/src/tools/task/task-create.ts
|
|
131525
|
-
import { join as
|
|
131735
|
+
import { join as join116 } from "path";
|
|
131526
131736
|
|
|
131527
131737
|
// packages/omo-opencode/src/tools/task/types.ts
|
|
131528
131738
|
import { z as z54 } from "zod";
|
|
@@ -131577,8 +131787,8 @@ var TaskDeleteInputSchema = z54.object({
|
|
|
131577
131787
|
});
|
|
131578
131788
|
|
|
131579
131789
|
// packages/omo-opencode/src/features/claude-tasks/storage.ts
|
|
131580
|
-
import { join as
|
|
131581
|
-
import { existsSync as
|
|
131790
|
+
import { join as join115, dirname as dirname42, basename as basename18, isAbsolute as isAbsolute17 } from "path";
|
|
131791
|
+
import { existsSync as existsSync95, mkdirSync as mkdirSync20, readFileSync as readFileSync62, writeFileSync as writeFileSync23, renameSync as renameSync8, unlinkSync as unlinkSync16, readdirSync as readdirSync26 } from "fs";
|
|
131582
131792
|
import { randomUUID as randomUUID9 } from "crypto";
|
|
131583
131793
|
function ignoreClaudeTaskStorageError(error) {
|
|
131584
131794
|
if (error instanceof Error)
|
|
@@ -131589,11 +131799,11 @@ function getTaskDir(config = {}) {
|
|
|
131589
131799
|
const tasksConfig = config.sisyphus?.tasks;
|
|
131590
131800
|
const storagePath = tasksConfig?.storage_path;
|
|
131591
131801
|
if (storagePath) {
|
|
131592
|
-
return isAbsolute17(storagePath) ? storagePath :
|
|
131802
|
+
return isAbsolute17(storagePath) ? storagePath : join115(process.cwd(), storagePath);
|
|
131593
131803
|
}
|
|
131594
131804
|
const configDir = getOpenCodeConfigDir({ binary: "opencode" });
|
|
131595
131805
|
const listId = resolveTaskListId(config);
|
|
131596
|
-
return
|
|
131806
|
+
return join115(configDir, "tasks", listId);
|
|
131597
131807
|
}
|
|
131598
131808
|
function sanitizePathSegment(value) {
|
|
131599
131809
|
return value.replace(/[^a-zA-Z0-9_-]/g, "-") || "default";
|
|
@@ -131611,13 +131821,13 @@ function resolveTaskListId(config = {}) {
|
|
|
131611
131821
|
return sanitizePathSegment(basename18(process.cwd()));
|
|
131612
131822
|
}
|
|
131613
131823
|
function ensureDir(dirPath) {
|
|
131614
|
-
if (!
|
|
131824
|
+
if (!existsSync95(dirPath)) {
|
|
131615
131825
|
mkdirSync20(dirPath, { recursive: true });
|
|
131616
131826
|
}
|
|
131617
131827
|
}
|
|
131618
131828
|
function readJsonSafe(filePath, schema) {
|
|
131619
131829
|
try {
|
|
131620
|
-
if (!
|
|
131830
|
+
if (!existsSync95(filePath)) {
|
|
131621
131831
|
return null;
|
|
131622
131832
|
}
|
|
131623
131833
|
const content = readFileSync62(filePath, "utf-8");
|
|
@@ -131641,7 +131851,7 @@ function writeJsonAtomic(filePath, data) {
|
|
|
131641
131851
|
renameSync8(tempPath, filePath);
|
|
131642
131852
|
} catch (error) {
|
|
131643
131853
|
try {
|
|
131644
|
-
if (
|
|
131854
|
+
if (existsSync95(tempPath)) {
|
|
131645
131855
|
unlinkSync16(tempPath);
|
|
131646
131856
|
}
|
|
131647
131857
|
} catch (cleanupError) {
|
|
@@ -131672,7 +131882,7 @@ function generateTaskId() {
|
|
|
131672
131882
|
return `T-${randomUUID9()}`;
|
|
131673
131883
|
}
|
|
131674
131884
|
async function acquireLock2(dirPath, options = {}) {
|
|
131675
|
-
const lockPath =
|
|
131885
|
+
const lockPath = join115(dirPath, ".lock");
|
|
131676
131886
|
const lockId = randomUUID9();
|
|
131677
131887
|
const waitTimeoutMs = options.waitTimeoutMs ?? resolveLockWaitTimeoutMs();
|
|
131678
131888
|
const baseRetryDelayMs = options.retryDelayMs ?? DEFAULT_LOCK_RETRY_DELAY_MS;
|
|
@@ -131755,7 +131965,7 @@ async function acquireLock2(dirPath, options = {}) {
|
|
|
131755
131965
|
acquired: true,
|
|
131756
131966
|
release: () => {
|
|
131757
131967
|
try {
|
|
131758
|
-
if (!
|
|
131968
|
+
if (!existsSync95(lockPath))
|
|
131759
131969
|
return;
|
|
131760
131970
|
const lockContent = readFileSync62(lockPath, "utf-8");
|
|
131761
131971
|
const lockData = JSON.parse(lockContent);
|
|
@@ -131923,7 +132133,7 @@ async function handleCreate(args, config, ctx, context) {
|
|
|
131923
132133
|
threadID: context.sessionID
|
|
131924
132134
|
};
|
|
131925
132135
|
validatedTask = TaskObjectSchema.parse(task);
|
|
131926
|
-
writeJsonAtomic(
|
|
132136
|
+
writeJsonAtomic(join116(taskDir, `${taskId}.json`), validatedTask);
|
|
131927
132137
|
} finally {
|
|
131928
132138
|
lock.release();
|
|
131929
132139
|
}
|
|
@@ -131945,7 +132155,7 @@ async function handleCreate(args, config, ctx, context) {
|
|
|
131945
132155
|
}
|
|
131946
132156
|
}
|
|
131947
132157
|
// packages/omo-opencode/src/tools/task/task-get.ts
|
|
131948
|
-
import { join as
|
|
132158
|
+
import { join as join117 } from "path";
|
|
131949
132159
|
var TASK_ID_PATTERN = /^T-[A-Za-z0-9-]+$/;
|
|
131950
132160
|
function parseTaskId(id) {
|
|
131951
132161
|
if (!TASK_ID_PATTERN.test(id))
|
|
@@ -131970,7 +132180,7 @@ Returns null if the task does not exist or the file is invalid.`,
|
|
|
131970
132180
|
return JSON.stringify({ error: "invalid_task_id" });
|
|
131971
132181
|
}
|
|
131972
132182
|
const taskDir = getTaskDir(config);
|
|
131973
|
-
const taskPath =
|
|
132183
|
+
const taskPath = join117(taskDir, `${taskId}.json`);
|
|
131974
132184
|
const task = readJsonSafe(taskPath, TaskObjectSchema);
|
|
131975
132185
|
return JSON.stringify({ task: task ?? null });
|
|
131976
132186
|
} catch (error) {
|
|
@@ -131983,8 +132193,8 @@ Returns null if the task does not exist or the file is invalid.`,
|
|
|
131983
132193
|
});
|
|
131984
132194
|
}
|
|
131985
132195
|
// packages/omo-opencode/src/tools/task/task-list.ts
|
|
131986
|
-
import { join as
|
|
131987
|
-
import { existsSync as
|
|
132196
|
+
import { join as join118 } from "path";
|
|
132197
|
+
import { existsSync as existsSync96, readdirSync as readdirSync27 } from "fs";
|
|
131988
132198
|
function createTaskList(config) {
|
|
131989
132199
|
return tool({
|
|
131990
132200
|
description: `List all active tasks with summary information.
|
|
@@ -131995,16 +132205,16 @@ Returns summary format: id, subject, status, owner, blockedBy (not full descript
|
|
|
131995
132205
|
args: {},
|
|
131996
132206
|
execute: async () => {
|
|
131997
132207
|
const taskDir = getTaskDir(config);
|
|
131998
|
-
if (!
|
|
132208
|
+
if (!existsSync96(taskDir)) {
|
|
131999
132209
|
return JSON.stringify({ tasks: [] });
|
|
132000
132210
|
}
|
|
132001
|
-
const files =
|
|
132211
|
+
const files = readdirSync27(taskDir).filter((f) => f.endsWith(".json") && f.startsWith("T-")).map((f) => f.replace(".json", ""));
|
|
132002
132212
|
if (files.length === 0) {
|
|
132003
132213
|
return JSON.stringify({ tasks: [] });
|
|
132004
132214
|
}
|
|
132005
132215
|
const allTasks = [];
|
|
132006
132216
|
for (const fileId of files) {
|
|
132007
|
-
const task = readJsonSafe(
|
|
132217
|
+
const task = readJsonSafe(join118(taskDir, `${fileId}.json`), TaskObjectSchema);
|
|
132008
132218
|
if (task) {
|
|
132009
132219
|
allTasks.push(task);
|
|
132010
132220
|
}
|
|
@@ -132032,7 +132242,7 @@ Returns summary format: id, subject, status, owner, blockedBy (not full descript
|
|
|
132032
132242
|
});
|
|
132033
132243
|
}
|
|
132034
132244
|
// packages/omo-opencode/src/tools/task/task-update.ts
|
|
132035
|
-
import { join as
|
|
132245
|
+
import { join as join119 } from "path";
|
|
132036
132246
|
var TASK_ID_PATTERN2 = /^T-[A-Za-z0-9-]+$/;
|
|
132037
132247
|
function parseTaskId2(id) {
|
|
132038
132248
|
if (!TASK_ID_PATTERN2.test(id))
|
|
@@ -132119,7 +132329,7 @@ async function handleUpdate(args, config, ctx, context) {
|
|
|
132119
132329
|
}
|
|
132120
132330
|
let updatedTask = null;
|
|
132121
132331
|
try {
|
|
132122
|
-
updatedTask = applyTaskUpdate(
|
|
132332
|
+
updatedTask = applyTaskUpdate(join119(taskDir, `${taskId}.json`), validatedArgs);
|
|
132123
132333
|
} finally {
|
|
132124
132334
|
lock.release();
|
|
132125
132335
|
}
|
|
@@ -133991,7 +134201,7 @@ function createHooks(args) {
|
|
|
133991
134201
|
};
|
|
133992
134202
|
}
|
|
133993
134203
|
// packages/omo-opencode/src/features/background-agent/manager.ts
|
|
133994
|
-
import { join as
|
|
134204
|
+
import { join as join121 } from "path";
|
|
133995
134205
|
|
|
133996
134206
|
// packages/omo-opencode/src/features/background-agent/abort-with-timeout.ts
|
|
133997
134207
|
function getAbortResponseError(response) {
|
|
@@ -134278,8 +134488,8 @@ function writeBackgroundTaskMarker(input) {
|
|
|
134278
134488
|
}
|
|
134279
134489
|
|
|
134280
134490
|
// packages/omo-opencode/src/features/background-agent/compaction-aware-message-resolver.ts
|
|
134281
|
-
import { readdirSync as
|
|
134282
|
-
import { join as
|
|
134491
|
+
import { readdirSync as readdirSync28, readFileSync as readFileSync63 } from "fs";
|
|
134492
|
+
import { join as join120 } from "path";
|
|
134283
134493
|
function hasFullAgentAndModel(message) {
|
|
134284
134494
|
return !!message.agent && !isCompactionAgent(message.agent) && !!message.model?.providerID && !!message.model?.modelID;
|
|
134285
134495
|
}
|
|
@@ -134359,11 +134569,11 @@ function resolvePromptContextFromSessionMessages(messages, sessionID) {
|
|
|
134359
134569
|
}
|
|
134360
134570
|
function findNearestMessageExcludingCompaction(messageDir, sessionID) {
|
|
134361
134571
|
try {
|
|
134362
|
-
const files =
|
|
134572
|
+
const files = readdirSync28(messageDir).filter((name) => name.endsWith(".json")).sort().reverse();
|
|
134363
134573
|
const messages = [];
|
|
134364
134574
|
for (const file of files) {
|
|
134365
134575
|
try {
|
|
134366
|
-
const content = readFileSync63(
|
|
134576
|
+
const content = readFileSync63(join120(messageDir, file), "utf-8");
|
|
134367
134577
|
const parsed = JSON.parse(content);
|
|
134368
134578
|
if (hasCompactionPartInStorage(parsed.id) || isCompactionAgent(parsed.agent)) {
|
|
134369
134579
|
continue;
|
|
@@ -139161,7 +139371,7 @@ The task was re-queued on a fallback model after a retryable failure.
|
|
|
139161
139371
|
parentSessionID: task.parentSessionId
|
|
139162
139372
|
});
|
|
139163
139373
|
}
|
|
139164
|
-
const messageDir =
|
|
139374
|
+
const messageDir = join121(MESSAGE_STORAGE, task.parentSessionId);
|
|
139165
139375
|
const currentMessage = messageDir ? findNearestMessageExcludingCompaction(messageDir, task.parentSessionId) : null;
|
|
139166
139376
|
agent = currentMessage?.agent ?? task.parentAgent;
|
|
139167
139377
|
model = currentMessage?.model?.providerID && currentMessage?.model?.modelID ? { providerID: currentMessage.model.providerID, modelID: currentMessage.model.modelID } : undefined;
|
|
@@ -140840,23 +141050,23 @@ function createMonitorManager(options) {
|
|
|
140840
141050
|
import { createHash as createHash4 } from "crypto";
|
|
140841
141051
|
import {
|
|
140842
141052
|
chmodSync as chmodSync4,
|
|
140843
|
-
existsSync as
|
|
141053
|
+
existsSync as existsSync99,
|
|
140844
141054
|
mkdirSync as mkdirSync21,
|
|
140845
|
-
readdirSync as
|
|
141055
|
+
readdirSync as readdirSync29,
|
|
140846
141056
|
readFileSync as readFileSync65,
|
|
140847
141057
|
renameSync as renameSync10,
|
|
140848
141058
|
unlinkSync as unlinkSync17,
|
|
140849
141059
|
writeFileSync as writeFileSync25
|
|
140850
141060
|
} from "fs";
|
|
140851
|
-
import { basename as basename19, dirname as dirname43, join as
|
|
141061
|
+
import { basename as basename19, dirname as dirname43, join as join124 } from "path";
|
|
140852
141062
|
|
|
140853
141063
|
// packages/mcp-client-core/src/config-dir.ts
|
|
140854
|
-
import { existsSync as
|
|
140855
|
-
import { homedir as
|
|
140856
|
-
import { join as
|
|
141064
|
+
import { existsSync as existsSync97, realpathSync as realpathSync18 } from "fs";
|
|
141065
|
+
import { homedir as homedir24 } from "os";
|
|
141066
|
+
import { join as join122, resolve as resolve32 } from "path";
|
|
140857
141067
|
function resolveConfigPath4(pathValue) {
|
|
140858
|
-
const resolvedPath =
|
|
140859
|
-
if (!
|
|
141068
|
+
const resolvedPath = resolve32(pathValue);
|
|
141069
|
+
if (!existsSync97(resolvedPath))
|
|
140860
141070
|
return resolvedPath;
|
|
140861
141071
|
try {
|
|
140862
141072
|
return realpathSync18(resolvedPath);
|
|
@@ -140871,13 +141081,13 @@ function getOpenCodeCliConfigDir(env = process.env) {
|
|
|
140871
141081
|
if (customConfigDir) {
|
|
140872
141082
|
return resolveConfigPath4(customConfigDir);
|
|
140873
141083
|
}
|
|
140874
|
-
const xdgConfigDir = env["XDG_CONFIG_HOME"]?.trim() ||
|
|
140875
|
-
return resolveConfigPath4(
|
|
141084
|
+
const xdgConfigDir = env["XDG_CONFIG_HOME"]?.trim() || join122(homedir24(), ".config");
|
|
141085
|
+
return resolveConfigPath4(join122(xdgConfigDir, "opencode"));
|
|
140876
141086
|
}
|
|
140877
141087
|
|
|
140878
141088
|
// packages/mcp-client-core/src/mcp-oauth/storage-index.ts
|
|
140879
|
-
import { chmodSync as chmodSync3, existsSync as
|
|
140880
|
-
import { join as
|
|
141089
|
+
import { chmodSync as chmodSync3, existsSync as existsSync98, readFileSync as readFileSync64, renameSync as renameSync9, writeFileSync as writeFileSync24 } from "fs";
|
|
141090
|
+
import { join as join123 } from "path";
|
|
140881
141091
|
var INDEX_FILE_NAME = "index.json";
|
|
140882
141092
|
function isTokenIndex(value) {
|
|
140883
141093
|
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
@@ -140885,11 +141095,11 @@ function isTokenIndex(value) {
|
|
|
140885
141095
|
return Object.values(value).every((entry) => typeof entry === "string");
|
|
140886
141096
|
}
|
|
140887
141097
|
function getIndexPath(storageDir) {
|
|
140888
|
-
return
|
|
141098
|
+
return join123(storageDir, INDEX_FILE_NAME);
|
|
140889
141099
|
}
|
|
140890
141100
|
function readTokenIndex(storageDir) {
|
|
140891
141101
|
const indexPath = getIndexPath(storageDir);
|
|
140892
|
-
if (!
|
|
141102
|
+
if (!existsSync98(indexPath))
|
|
140893
141103
|
return {};
|
|
140894
141104
|
try {
|
|
140895
141105
|
const parsed = JSON.parse(readFileSync64(indexPath, "utf-8"));
|
|
@@ -140922,16 +141132,16 @@ function saveTokenIndexEntry(storageDir, hash, key) {
|
|
|
140922
141132
|
var STORAGE_DIR_NAME = "mcp-oauth";
|
|
140923
141133
|
var LEGACY_STORAGE_FILE_NAME = "mcp-oauth.json";
|
|
140924
141134
|
function getMcpOauthStorageDir() {
|
|
140925
|
-
return
|
|
141135
|
+
return join124(getOpenCodeCliConfigDir(), STORAGE_DIR_NAME);
|
|
140926
141136
|
}
|
|
140927
141137
|
function getMcpOauthServerHash(serverHost, resource) {
|
|
140928
141138
|
return createHash4("sha256").update(buildKey(serverHost, resource)).digest("hex").slice(0, 32);
|
|
140929
141139
|
}
|
|
140930
141140
|
function getMcpOauthStoragePath(serverHost, resource) {
|
|
140931
|
-
return
|
|
141141
|
+
return join124(getMcpOauthStorageDir(), `${getMcpOauthServerHash(serverHost, resource)}.json`);
|
|
140932
141142
|
}
|
|
140933
141143
|
function getLegacyStoragePath() {
|
|
140934
|
-
return
|
|
141144
|
+
return join124(getOpenCodeCliConfigDir(), LEGACY_STORAGE_FILE_NAME);
|
|
140935
141145
|
}
|
|
140936
141146
|
function normalizeHost(serverHost) {
|
|
140937
141147
|
let host = serverHost.trim();
|
|
@@ -140992,7 +141202,7 @@ function isOAuthTokenData(value) {
|
|
|
140992
141202
|
return clientSecret === undefined || typeof clientSecret === "string";
|
|
140993
141203
|
}
|
|
140994
141204
|
function readTokenFile(filePath) {
|
|
140995
|
-
if (!
|
|
141205
|
+
if (!existsSync99(filePath))
|
|
140996
141206
|
return null;
|
|
140997
141207
|
try {
|
|
140998
141208
|
const parsed = JSON.parse(readFileSync65(filePath, "utf-8"));
|
|
@@ -141005,7 +141215,7 @@ function readTokenFile(filePath) {
|
|
|
141005
141215
|
}
|
|
141006
141216
|
function readLegacyStore() {
|
|
141007
141217
|
const filePath = getLegacyStoragePath();
|
|
141008
|
-
if (!
|
|
141218
|
+
if (!existsSync99(filePath))
|
|
141009
141219
|
return null;
|
|
141010
141220
|
try {
|
|
141011
141221
|
const parsed = JSON.parse(readFileSync65(filePath, "utf-8"));
|
|
@@ -141026,7 +141236,7 @@ function readLegacyStore() {
|
|
|
141026
141236
|
function writeTokenFile(filePath, token) {
|
|
141027
141237
|
try {
|
|
141028
141238
|
const dir = dirname43(filePath);
|
|
141029
|
-
if (!
|
|
141239
|
+
if (!existsSync99(dir)) {
|
|
141030
141240
|
mkdirSync21(dir, { recursive: true });
|
|
141031
141241
|
}
|
|
141032
141242
|
const tempPath = `${filePath}.tmp.${Date.now()}`;
|
|
@@ -146514,24 +146724,24 @@ import { dirname as dirname44 } from "path";
|
|
|
146514
146724
|
// packages/omo-opencode/src/features/tui-sidebar/mirror-path.ts
|
|
146515
146725
|
import { createHash as createHash6 } from "crypto";
|
|
146516
146726
|
import { realpathSync as realpathSync19 } from "fs";
|
|
146517
|
-
import { homedir as
|
|
146518
|
-
import { join as
|
|
146727
|
+
import { homedir as homedir25 } from "os";
|
|
146728
|
+
import { join as join125, resolve as resolve33 } from "path";
|
|
146519
146729
|
function mirrorStorageDir() {
|
|
146520
|
-
return
|
|
146730
|
+
return join125(process.env.XDG_DATA_HOME ?? join125(homedir25(), ".local", "share"), "opencode", "storage", "oh-my-openagent", MIRROR_DIR_NAME);
|
|
146521
146731
|
}
|
|
146522
146732
|
function canonicalProjectDir(projectDir) {
|
|
146523
146733
|
try {
|
|
146524
146734
|
return realpathSync19.native(projectDir);
|
|
146525
146735
|
} catch (error) {
|
|
146526
146736
|
if (error instanceof Error) {
|
|
146527
|
-
return
|
|
146737
|
+
return resolve33(projectDir);
|
|
146528
146738
|
}
|
|
146529
146739
|
throw error;
|
|
146530
146740
|
}
|
|
146531
146741
|
}
|
|
146532
146742
|
function mirrorFilePath(projectDir) {
|
|
146533
146743
|
const projectHash = createHash6("sha1").update(canonicalProjectDir(projectDir)).digest("hex").slice(0, 16);
|
|
146534
|
-
return
|
|
146744
|
+
return join125(mirrorStorageDir(), `${projectHash}.json`);
|
|
146535
146745
|
}
|
|
146536
146746
|
|
|
146537
146747
|
// packages/omo-opencode/src/features/tui-sidebar/snapshot-schema.ts
|
|
@@ -146589,8 +146799,8 @@ function writeMirror(projectDir, snapshot) {
|
|
|
146589
146799
|
}
|
|
146590
146800
|
|
|
146591
146801
|
// packages/omo-opencode/src/features/tui-sidebar/loop-reader.ts
|
|
146592
|
-
import { readdirSync as
|
|
146593
|
-
import { join as
|
|
146802
|
+
import { readdirSync as readdirSync30, readFileSync as readFileSync67, statSync as statSync14 } from "fs";
|
|
146803
|
+
import { join as join126 } from "path";
|
|
146594
146804
|
import { z as z59 } from "zod";
|
|
146595
146805
|
var CriterionSchema = z59.object({
|
|
146596
146806
|
status: z59.string()
|
|
@@ -146620,24 +146830,24 @@ function enumerateCandidates(projectDir) {
|
|
|
146620
146830
|
return [...currentLoopCandidates(projectDir), legacyLoopCandidate(projectDir)].filter((candidate) => candidate !== null);
|
|
146621
146831
|
}
|
|
146622
146832
|
function currentLoopCandidates(projectDir) {
|
|
146623
|
-
const loopRoot =
|
|
146833
|
+
const loopRoot = join126(projectDir, ".omo", "ulw-loop");
|
|
146624
146834
|
let entries;
|
|
146625
146835
|
try {
|
|
146626
|
-
entries =
|
|
146836
|
+
entries = readdirSync30(loopRoot, { withFileTypes: true });
|
|
146627
146837
|
} catch (error) {
|
|
146628
146838
|
if (error instanceof Error) {
|
|
146629
146839
|
return [];
|
|
146630
146840
|
}
|
|
146631
146841
|
throw error;
|
|
146632
146842
|
}
|
|
146633
|
-
return entries.filter((entry) => entry.isDirectory()).map((entry) => statCandidate(
|
|
146843
|
+
return entries.filter((entry) => entry.isDirectory()).map((entry) => statCandidate(join126(loopRoot, entry.name, "goals.json"))).filter((candidate) => candidate !== null);
|
|
146634
146844
|
}
|
|
146635
146845
|
function legacyLoopCandidate(projectDir) {
|
|
146636
|
-
return statCandidate(
|
|
146846
|
+
return statCandidate(join126(projectDir, ".omo", "loop", "goals.json"));
|
|
146637
146847
|
}
|
|
146638
146848
|
function statCandidate(path) {
|
|
146639
146849
|
try {
|
|
146640
|
-
return { path, mtimeMs:
|
|
146850
|
+
return { path, mtimeMs: statSync14(path).mtimeMs };
|
|
146641
146851
|
} catch (error) {
|
|
146642
146852
|
if (error instanceof Error) {
|
|
146643
146853
|
return null;
|
|
@@ -149418,39 +149628,39 @@ async function isTmuxAvailableWithDeps(deps) {
|
|
|
149418
149628
|
import {
|
|
149419
149629
|
appendFileSync as appendFileSync6,
|
|
149420
149630
|
chmodSync as chmodSync5,
|
|
149421
|
-
existsSync as
|
|
149631
|
+
existsSync as existsSync101,
|
|
149422
149632
|
renameSync as renameSync11,
|
|
149423
|
-
statSync as
|
|
149633
|
+
statSync as statSync15,
|
|
149424
149634
|
unlinkSync as unlinkSync18,
|
|
149425
149635
|
writeFileSync as writeFileSync26
|
|
149426
149636
|
} from "fs";
|
|
149427
149637
|
|
|
149428
149638
|
// packages/openclaw-core/src/reply-listener-paths.ts
|
|
149429
|
-
import { existsSync as
|
|
149430
|
-
import { homedir as
|
|
149431
|
-
import { join as
|
|
149639
|
+
import { existsSync as existsSync100, mkdirSync as mkdirSync23 } from "fs";
|
|
149640
|
+
import { homedir as homedir26 } from "os";
|
|
149641
|
+
import { join as join127 } from "path";
|
|
149432
149642
|
var REPLY_LISTENER_SECURE_FILE_MODE = 384;
|
|
149433
149643
|
function resolveReplyListenerHomeDir() {
|
|
149434
|
-
return process.env.HOME ?? process.env.USERPROFILE ??
|
|
149644
|
+
return process.env.HOME ?? process.env.USERPROFILE ?? homedir26();
|
|
149435
149645
|
}
|
|
149436
149646
|
function getReplyListenerStateDir() {
|
|
149437
|
-
return
|
|
149647
|
+
return join127(resolveReplyListenerHomeDir(), ".omo", "openclaw", "state");
|
|
149438
149648
|
}
|
|
149439
149649
|
function getReplyListenerPidFilePath() {
|
|
149440
|
-
return
|
|
149650
|
+
return join127(getReplyListenerStateDir(), "reply-listener.pid");
|
|
149441
149651
|
}
|
|
149442
149652
|
function getReplyListenerStateFilePath() {
|
|
149443
|
-
return
|
|
149653
|
+
return join127(getReplyListenerStateDir(), "reply-listener-state.json");
|
|
149444
149654
|
}
|
|
149445
149655
|
function getReplyListenerConfigFilePath() {
|
|
149446
|
-
return
|
|
149656
|
+
return join127(getReplyListenerStateDir(), "reply-listener-config.json");
|
|
149447
149657
|
}
|
|
149448
149658
|
function getReplyListenerLogFilePath() {
|
|
149449
|
-
return
|
|
149659
|
+
return join127(getReplyListenerStateDir(), "reply-listener.log");
|
|
149450
149660
|
}
|
|
149451
149661
|
function ensureReplyListenerStateDir() {
|
|
149452
149662
|
const stateDir = getReplyListenerStateDir();
|
|
149453
|
-
if (!
|
|
149663
|
+
if (!existsSync100(stateDir)) {
|
|
149454
149664
|
mkdirSync23(stateDir, { recursive: true, mode: 448 });
|
|
149455
149665
|
}
|
|
149456
149666
|
}
|
|
@@ -149473,13 +149683,13 @@ function writeSecureReplyListenerFile(filePath, content) {
|
|
|
149473
149683
|
}
|
|
149474
149684
|
function rotateReplyListenerLogIfNeeded(logPath) {
|
|
149475
149685
|
try {
|
|
149476
|
-
if (!
|
|
149686
|
+
if (!existsSync101(logPath))
|
|
149477
149687
|
return;
|
|
149478
|
-
const stats =
|
|
149688
|
+
const stats = statSync15(logPath);
|
|
149479
149689
|
if (stats.size <= MAX_REPLY_LISTENER_LOG_SIZE_BYTES)
|
|
149480
149690
|
return;
|
|
149481
149691
|
const backupPath = `${logPath}.old`;
|
|
149482
|
-
if (
|
|
149692
|
+
if (existsSync101(backupPath)) {
|
|
149483
149693
|
unlinkSync18(backupPath);
|
|
149484
149694
|
}
|
|
149485
149695
|
renameSync11(logPath, backupPath);
|
|
@@ -149506,7 +149716,7 @@ import { constants as constants24, closeSync as closeSync5, openSync as openSync
|
|
|
149506
149716
|
|
|
149507
149717
|
// packages/openclaw-core/src/session-registry-paths.ts
|
|
149508
149718
|
init_src();
|
|
149509
|
-
import { join as
|
|
149719
|
+
import { join as join128 } from "path";
|
|
149510
149720
|
var SECURE_FILE_MODE = 384;
|
|
149511
149721
|
var MAX_AGE_MS = 24 * 60 * 60 * 1000;
|
|
149512
149722
|
var LOCK_TIMEOUT_MS = 2000;
|
|
@@ -149517,16 +149727,16 @@ var cachedRegistryPaths = null;
|
|
|
149517
149727
|
function resolveRegistryPaths() {
|
|
149518
149728
|
if (cachedRegistryPaths !== null)
|
|
149519
149729
|
return cachedRegistryPaths;
|
|
149520
|
-
const openClawStorageDir =
|
|
149730
|
+
const openClawStorageDir = join128(getOpenCodeStorageDir2(), "openclaw");
|
|
149521
149731
|
cachedRegistryPaths = {
|
|
149522
149732
|
openClawStorageDir,
|
|
149523
|
-
registryPath:
|
|
149524
|
-
registryLockPath:
|
|
149733
|
+
registryPath: join128(openClawStorageDir, "reply-session-registry.jsonl"),
|
|
149734
|
+
registryLockPath: join128(openClawStorageDir, "reply-session-registry.lock")
|
|
149525
149735
|
};
|
|
149526
149736
|
return cachedRegistryPaths;
|
|
149527
149737
|
}
|
|
149528
149738
|
function getOpenCodeStorageDir2() {
|
|
149529
|
-
return
|
|
149739
|
+
return join128(resolveXdgDataDir("opencode"), "opencode", "storage");
|
|
149530
149740
|
}
|
|
149531
149741
|
function getRegistryPath() {
|
|
149532
149742
|
return resolveRegistryPaths().registryPath;
|
|
@@ -149536,11 +149746,11 @@ function getRegistryLockPath() {
|
|
|
149536
149746
|
}
|
|
149537
149747
|
|
|
149538
149748
|
// packages/openclaw-core/src/session-registry-lock.ts
|
|
149539
|
-
import { constants as constants23, closeSync as closeSync4, existsSync as
|
|
149749
|
+
import { constants as constants23, closeSync as closeSync4, existsSync as existsSync103, openSync as openSync4, readFileSync as readFileSync69, statSync as statSync16, unlinkSync as unlinkSync19, writeSync } from "fs";
|
|
149540
149750
|
import { randomUUID as randomUUID12 } from "crypto";
|
|
149541
149751
|
|
|
149542
149752
|
// packages/openclaw-core/src/session-registry-storage.ts
|
|
149543
|
-
import { existsSync as
|
|
149753
|
+
import { existsSync as existsSync102, mkdirSync as mkdirSync24, readFileSync as readFileSync68, writeFileSync as writeFileSync27 } from "fs";
|
|
149544
149754
|
import { dirname as dirname45 } from "path";
|
|
149545
149755
|
function isSessionMapping(value) {
|
|
149546
149756
|
if (typeof value !== "object" || value === null)
|
|
@@ -149563,13 +149773,13 @@ function isSessionMapping(value) {
|
|
|
149563
149773
|
}
|
|
149564
149774
|
function ensureRegistryDir() {
|
|
149565
149775
|
const registryDir = dirname45(getRegistryPath());
|
|
149566
|
-
if (!
|
|
149776
|
+
if (!existsSync102(registryDir)) {
|
|
149567
149777
|
mkdirSync24(registryDir, { recursive: true, mode: 448 });
|
|
149568
149778
|
}
|
|
149569
149779
|
}
|
|
149570
149780
|
function readAllMappingsUnsafe() {
|
|
149571
149781
|
const registryPath = getRegistryPath();
|
|
149572
|
-
if (!
|
|
149782
|
+
if (!existsSync102(registryPath))
|
|
149573
149783
|
return [];
|
|
149574
149784
|
try {
|
|
149575
149785
|
const content = readFileSync68(registryPath, "utf-8");
|
|
@@ -149623,7 +149833,7 @@ function isPidAlive2(pid) {
|
|
|
149623
149833
|
function readLockSnapshot() {
|
|
149624
149834
|
try {
|
|
149625
149835
|
const registryLockPath = getRegistryLockPath();
|
|
149626
|
-
if (!
|
|
149836
|
+
if (!existsSync103(registryLockPath))
|
|
149627
149837
|
return null;
|
|
149628
149838
|
const raw = readFileSync69(registryLockPath, "utf-8");
|
|
149629
149839
|
const trimmed = raw.trim();
|
|
@@ -149654,7 +149864,7 @@ function readLockSnapshot() {
|
|
|
149654
149864
|
function removeLockIfUnchanged(snapshot) {
|
|
149655
149865
|
try {
|
|
149656
149866
|
const registryLockPath = getRegistryLockPath();
|
|
149657
|
-
if (!
|
|
149867
|
+
if (!existsSync103(registryLockPath))
|
|
149658
149868
|
return false;
|
|
149659
149869
|
const currentRaw = readFileSync69(registryLockPath, "utf-8");
|
|
149660
149870
|
if (currentRaw !== snapshot.raw)
|
|
@@ -149709,7 +149919,7 @@ function acquireRegistryLock() {
|
|
|
149709
149919
|
if (error.code !== "EEXIST")
|
|
149710
149920
|
throw error;
|
|
149711
149921
|
try {
|
|
149712
|
-
const stats =
|
|
149922
|
+
const stats = statSync16(getRegistryLockPath());
|
|
149713
149923
|
const lockAgeMs = Date.now() - stats.mtimeMs;
|
|
149714
149924
|
if (lockAgeMs > LOCK_STALE_MS) {
|
|
149715
149925
|
const snapshot = readLockSnapshot();
|
|
@@ -149805,7 +150015,7 @@ function removeSession(sessionId) {
|
|
|
149805
150015
|
}
|
|
149806
150016
|
|
|
149807
150017
|
// packages/openclaw-core/src/reply-listener-state.ts
|
|
149808
|
-
import { existsSync as
|
|
150018
|
+
import { existsSync as existsSync104, readFileSync as readFileSync70, unlinkSync as unlinkSync20 } from "fs";
|
|
149809
150019
|
var REPLY_LISTENER_STARTUP_TOKEN_ENV = "OMO_OPENCLAW_REPLY_LISTENER_STARTUP_TOKEN";
|
|
149810
150020
|
function ignoreReplyListenerStateReadError(error) {
|
|
149811
150021
|
if (error instanceof Error)
|
|
@@ -149872,7 +150082,7 @@ function createPendingReplyListenerState(startupToken) {
|
|
|
149872
150082
|
function readReplyListenerDaemonState() {
|
|
149873
150083
|
try {
|
|
149874
150084
|
const stateFilePath = getReplyListenerStateFilePath();
|
|
149875
|
-
if (!
|
|
150085
|
+
if (!existsSync104(stateFilePath))
|
|
149876
150086
|
return null;
|
|
149877
150087
|
return normalizeReplyListenerState(JSON.parse(readFileSync70(stateFilePath, "utf-8")));
|
|
149878
150088
|
} catch (error) {
|
|
@@ -149890,7 +150100,7 @@ function writeReplyListenerDaemonState(state) {
|
|
|
149890
150100
|
function readReplyListenerDaemonConfig() {
|
|
149891
150101
|
try {
|
|
149892
150102
|
const configFilePath = getReplyListenerConfigFilePath();
|
|
149893
|
-
if (!
|
|
150103
|
+
if (!existsSync104(configFilePath))
|
|
149894
150104
|
return null;
|
|
149895
150105
|
return JSON.parse(readFileSync70(configFilePath, "utf-8"));
|
|
149896
150106
|
} catch (error) {
|
|
@@ -149904,7 +150114,7 @@ function writeReplyListenerDaemonConfig(config) {
|
|
|
149904
150114
|
function readReplyListenerPid() {
|
|
149905
150115
|
try {
|
|
149906
150116
|
const pidFilePath = getReplyListenerPidFilePath();
|
|
149907
|
-
if (!
|
|
150117
|
+
if (!existsSync104(pidFilePath))
|
|
149908
150118
|
return null;
|
|
149909
150119
|
const pid = Number.parseInt(readFileSync70(pidFilePath, "utf-8").trim(), 10);
|
|
149910
150120
|
return Number.isNaN(pid) ? null : pid;
|
|
@@ -149918,7 +150128,7 @@ function writeReplyListenerPid(pid) {
|
|
|
149918
150128
|
}
|
|
149919
150129
|
function removeReplyListenerPid() {
|
|
149920
150130
|
const pidFilePath = getReplyListenerPidFilePath();
|
|
149921
|
-
if (
|
|
150131
|
+
if (existsSync104(pidFilePath)) {
|
|
149922
150132
|
unlinkSync20(pidFilePath);
|
|
149923
150133
|
}
|
|
149924
150134
|
}
|
|
@@ -149946,7 +150156,7 @@ function getReplyListenerRuntimeSignature(config) {
|
|
|
149946
150156
|
// packages/openclaw-core/src/reply-listener-poll-loop.ts
|
|
149947
150157
|
var PRUNE_INTERVAL_MS = 60 * 60 * 1000;
|
|
149948
150158
|
// packages/openclaw-core/src/reply-listener-start.ts
|
|
149949
|
-
import { dirname as dirname46, join as
|
|
150159
|
+
import { dirname as dirname46, join as join130 } from "path";
|
|
149950
150160
|
import { fileURLToPath as fileURLToPath7 } from "url";
|
|
149951
150161
|
|
|
149952
150162
|
// packages/openclaw-core/src/reply-listener-spawn.ts
|
|
@@ -149955,7 +150165,7 @@ init_runtime();
|
|
|
149955
150165
|
// packages/openclaw-core/src/reply-listener-process.ts
|
|
149956
150166
|
init_runtime();
|
|
149957
150167
|
import { readFileSync as readFileSync71 } from "fs";
|
|
149958
|
-
import { join as
|
|
150168
|
+
import { join as join129 } from "path";
|
|
149959
150169
|
var REPLY_LISTENER_DAEMON_IDENTITY_MARKER = "--openclaw-reply-listener-daemon";
|
|
149960
150170
|
var REPLY_LISTENER_DAEMON_ENV_ALLOWLIST = [
|
|
149961
150171
|
"PATH",
|
|
@@ -149991,7 +150201,7 @@ var REPLY_LISTENER_DAEMON_ENV_ALLOWLIST = [
|
|
|
149991
150201
|
];
|
|
149992
150202
|
async function windowsProcessCommandLineHasMarker(pid, deps) {
|
|
149993
150203
|
const systemRoot = process.env.SystemRoot ?? process.env.SYSTEMROOT ?? "C:\\Windows";
|
|
149994
|
-
const powershell =
|
|
150204
|
+
const powershell = join129(systemRoot, "System32", "WindowsPowerShell", "v1.0", "powershell.exe");
|
|
149995
150205
|
const processInfo = deps.spawn([
|
|
149996
150206
|
powershell,
|
|
149997
150207
|
"-NoProfile",
|
|
@@ -150208,7 +150418,7 @@ function createStartFailureResult(message, state) {
|
|
|
150208
150418
|
}
|
|
150209
150419
|
function resolveReplyListenerDaemonScript(currentFileUrl) {
|
|
150210
150420
|
const currentFilePath = fileURLToPath7(currentFileUrl);
|
|
150211
|
-
return currentFilePath.endsWith(".ts") ?
|
|
150421
|
+
return currentFilePath.endsWith(".ts") ? join130(dirname46(currentFilePath), "daemon.ts") : join130(dirname46(currentFilePath), "daemon.js");
|
|
150212
150422
|
}
|
|
150213
150423
|
async function startReplyListener(config) {
|
|
150214
150424
|
const normalizedConfig = getNormalizedReplyListenerConfig(config);
|
|
@@ -150631,13 +150841,13 @@ async function createRuntimeSkillSourceServer(options, runtimeEnv = runtime6) {
|
|
|
150631
150841
|
};
|
|
150632
150842
|
}
|
|
150633
150843
|
// packages/claude-code-compat-core/src/features/claude-code-mcp-loader/loader.ts
|
|
150634
|
-
import { existsSync as
|
|
150635
|
-
import { join as
|
|
150636
|
-
import { homedir as
|
|
150844
|
+
import { existsSync as existsSync105, readFileSync as readFileSync72 } from "fs";
|
|
150845
|
+
import { join as join131 } from "path";
|
|
150846
|
+
import { homedir as homedir27 } from "os";
|
|
150637
150847
|
function resolveMcpLoaderContext(options = {}) {
|
|
150638
150848
|
const cwd = options.cwd ?? process.cwd();
|
|
150639
150849
|
const homeDir = options.homeDir ?? getHomeDir();
|
|
150640
|
-
const claudeConfigDir = options.claudeConfigDir ?? (options.homeDir === undefined ? getClaudeConfigDir3() :
|
|
150850
|
+
const claudeConfigDir = options.claudeConfigDir ?? (options.homeDir === undefined ? getClaudeConfigDir3() : join131(homeDir, ".claude"));
|
|
150641
150851
|
return { cwd, homeDir, claudeConfigDir };
|
|
150642
150852
|
}
|
|
150643
150853
|
var mcpLoaderInternals = {
|
|
@@ -150646,17 +150856,17 @@ var mcpLoaderInternals = {
|
|
|
150646
150856
|
function getMcpConfigPaths(context) {
|
|
150647
150857
|
const { claudeConfigDir, homeDir, cwd } = context;
|
|
150648
150858
|
return [
|
|
150649
|
-
{ path:
|
|
150650
|
-
{ path:
|
|
150651
|
-
{ path:
|
|
150652
|
-
{ path:
|
|
150859
|
+
{ path: join131(homeDir, ".claude.json"), scope: "user" },
|
|
150860
|
+
{ path: join131(claudeConfigDir, ".mcp.json"), scope: "user" },
|
|
150861
|
+
{ path: join131(cwd, ".mcp.json"), scope: "project" },
|
|
150862
|
+
{ path: join131(cwd, ".claude", ".mcp.json"), scope: "local" }
|
|
150653
150863
|
];
|
|
150654
150864
|
}
|
|
150655
150865
|
function getHomeDir() {
|
|
150656
|
-
return process.env.HOME || process.env.USERPROFILE ||
|
|
150866
|
+
return process.env.HOME || process.env.USERPROFILE || homedir27();
|
|
150657
150867
|
}
|
|
150658
150868
|
async function loadMcpConfigFile(filePath) {
|
|
150659
|
-
if (!
|
|
150869
|
+
if (!existsSync105(filePath)) {
|
|
150660
150870
|
return null;
|
|
150661
150871
|
}
|
|
150662
150872
|
try {
|
|
@@ -150677,7 +150887,7 @@ function getSystemMcpServerNames(options = {}) {
|
|
|
150677
150887
|
const paths = getMcpConfigPaths(context);
|
|
150678
150888
|
const { cwd } = context;
|
|
150679
150889
|
for (const { path } of paths) {
|
|
150680
|
-
if (!
|
|
150890
|
+
if (!existsSync105(path))
|
|
150681
150891
|
continue;
|
|
150682
150892
|
try {
|
|
150683
150893
|
const content = readFileSync72(path, "utf-8");
|
|
@@ -160166,15 +160376,15 @@ function createHephaestusAgent(model, availableAgents, availableToolNames, avail
|
|
|
160166
160376
|
}
|
|
160167
160377
|
createHephaestusAgent.mode = MODE9;
|
|
160168
160378
|
// packages/omo-opencode/src/agents/builtin-agents/resolve-file-uri.ts
|
|
160169
|
-
import { existsSync as
|
|
160170
|
-
import { homedir as
|
|
160171
|
-
import { isAbsolute as isAbsolute18, join as
|
|
160379
|
+
import { existsSync as existsSync106, readFileSync as readFileSync73 } from "fs";
|
|
160380
|
+
import { homedir as homedir28 } from "os";
|
|
160381
|
+
import { isAbsolute as isAbsolute18, join as join132, resolve as resolve34 } from "path";
|
|
160172
160382
|
init_logger2();
|
|
160173
160383
|
var ALLOWED_HOME_SUBDIRS = [
|
|
160174
|
-
|
|
160175
|
-
|
|
160176
|
-
|
|
160177
|
-
|
|
160384
|
+
join132(homedir28(), ".config", "opencode"),
|
|
160385
|
+
join132(homedir28(), ".config", "oh-my-openagent"),
|
|
160386
|
+
join132(homedir28(), ".omo"),
|
|
160387
|
+
join132(homedir28(), ".opencode")
|
|
160178
160388
|
];
|
|
160179
160389
|
function isWithinAllowedPaths(filePath, projectRoot) {
|
|
160180
160390
|
if (isWithinProject(filePath, projectRoot))
|
|
@@ -160192,8 +160402,8 @@ function resolvePromptAppend(promptAppend, configDir) {
|
|
|
160192
160402
|
let filePath;
|
|
160193
160403
|
try {
|
|
160194
160404
|
const decoded = decodeURIComponent(encoded);
|
|
160195
|
-
const expanded = decoded.startsWith("~/") ? decoded.replace(/^~\//, `${
|
|
160196
|
-
filePath = isAbsolute18(expanded) ? expanded :
|
|
160405
|
+
const expanded = decoded.startsWith("~/") ? decoded.replace(/^~\//, `${homedir28()}/`) : decoded;
|
|
160406
|
+
filePath = isAbsolute18(expanded) ? expanded : resolve34(configDir ?? process.cwd(), expanded);
|
|
160197
160407
|
} catch (error) {
|
|
160198
160408
|
if (!(error instanceof Error)) {
|
|
160199
160409
|
throw error;
|
|
@@ -160210,7 +160420,7 @@ function resolvePromptAppend(promptAppend, configDir) {
|
|
|
160210
160420
|
});
|
|
160211
160421
|
return `[WARNING: Path rejected: ${promptAppend} (resolved outside project root ${projectRoot} and allowed home directories; file:// prompts must reside within the project directory, ~/.config/opencode/, ~/.config/oh-my-openagent/, ~/.omo/, or ~/.opencode/)]`;
|
|
160212
160422
|
}
|
|
160213
|
-
if (!
|
|
160423
|
+
if (!existsSync106(filePath)) {
|
|
160214
160424
|
return `[WARNING: Could not resolve file URI: ${promptAppend}]`;
|
|
160215
160425
|
}
|
|
160216
160426
|
try {
|
|
@@ -162932,7 +163142,7 @@ async function applyAgentConfig(params) {
|
|
|
162932
163142
|
}
|
|
162933
163143
|
// packages/claude-code-compat-core/src/features/claude-code-command-loader/loader.ts
|
|
162934
163144
|
import { promises as fs21 } from "fs";
|
|
162935
|
-
import { join as
|
|
163145
|
+
import { join as join133, basename as basename21 } from "path";
|
|
162936
163146
|
|
|
162937
163147
|
// packages/claude-code-compat-core/src/features/claude-code-command-loader/loader-cache.ts
|
|
162938
163148
|
var commandLoaderCache = new Map;
|
|
@@ -162980,7 +163190,7 @@ async function loadCommandsFromDir(commandsDir, scope, visited = new Set, prefix
|
|
|
162980
163190
|
continue;
|
|
162981
163191
|
if (entry.name.startsWith("."))
|
|
162982
163192
|
continue;
|
|
162983
|
-
const subDirPath =
|
|
163193
|
+
const subDirPath = join133(commandsDir, entry.name);
|
|
162984
163194
|
const subPrefix = prefix ? `${prefix}/${entry.name}` : entry.name;
|
|
162985
163195
|
const subCommands = await loadCommandsFromDir(subDirPath, scope, visited, subPrefix);
|
|
162986
163196
|
commands.push(...subCommands);
|
|
@@ -162988,7 +163198,7 @@ async function loadCommandsFromDir(commandsDir, scope, visited = new Set, prefix
|
|
|
162988
163198
|
}
|
|
162989
163199
|
if (!isMarkdownFile(entry))
|
|
162990
163200
|
continue;
|
|
162991
|
-
const commandPath =
|
|
163201
|
+
const commandPath = join133(commandsDir, entry.name);
|
|
162992
163202
|
const baseCommandName = basename21(entry.name, ".md");
|
|
162993
163203
|
const commandName = prefix ? `${prefix}/${baseCommandName}` : baseCommandName;
|
|
162994
163204
|
try {
|
|
@@ -163051,12 +163261,12 @@ function commandsToRecord(commands) {
|
|
|
163051
163261
|
return result;
|
|
163052
163262
|
}
|
|
163053
163263
|
async function loadUserCommands() {
|
|
163054
|
-
const userCommandsDir =
|
|
163264
|
+
const userCommandsDir = join133(getClaudeConfigDir3(), "commands");
|
|
163055
163265
|
const commands = await loadCommandsFromDir(userCommandsDir, "user");
|
|
163056
163266
|
return commandsToRecord(commands);
|
|
163057
163267
|
}
|
|
163058
163268
|
async function loadProjectCommands(directory) {
|
|
163059
|
-
const projectCommandsDir =
|
|
163269
|
+
const projectCommandsDir = join133(directory ?? process.cwd(), ".claude", "commands");
|
|
163060
163270
|
const commands = await loadCommandsFromDir(projectCommandsDir, "project");
|
|
163061
163271
|
return commandsToRecord(commands);
|
|
163062
163272
|
}
|
|
@@ -163245,8 +163455,8 @@ var grep_app = {
|
|
|
163245
163455
|
};
|
|
163246
163456
|
|
|
163247
163457
|
// packages/omo-opencode/src/mcp/lsp.ts
|
|
163248
|
-
import { existsSync as
|
|
163249
|
-
import { delimiter as delimiter2, dirname as dirname47, resolve as
|
|
163458
|
+
import { existsSync as existsSync107, readFileSync as readFileSync74 } from "fs";
|
|
163459
|
+
import { delimiter as delimiter2, dirname as dirname47, resolve as resolve36 } from "path";
|
|
163250
163460
|
import { fileURLToPath as fileURLToPath8 } from "url";
|
|
163251
163461
|
import { z as z60 } from "zod";
|
|
163252
163462
|
|
|
@@ -163294,7 +163504,7 @@ function resolveRuntimeExecutable(commandName, options = {}) {
|
|
|
163294
163504
|
}
|
|
163295
163505
|
|
|
163296
163506
|
// packages/omo-opencode/src/mcp/shared/ancestor-cli-resolver.ts
|
|
163297
|
-
import { resolve as
|
|
163507
|
+
import { resolve as resolve35 } from "path";
|
|
163298
163508
|
function resolveJavaScriptRuntime(resolveExecutable) {
|
|
163299
163509
|
const node = resolveExecutable("node");
|
|
163300
163510
|
return node.available ? node : resolveExecutable("bun");
|
|
@@ -163302,9 +163512,9 @@ function resolveJavaScriptRuntime(resolveExecutable) {
|
|
|
163302
163512
|
function createAncestorCliCandidates(options) {
|
|
163303
163513
|
const candidates = [];
|
|
163304
163514
|
const seenPaths = new Set;
|
|
163305
|
-
let currentDirectory =
|
|
163515
|
+
let currentDirectory = resolve35(options.startDirectory);
|
|
163306
163516
|
while (true) {
|
|
163307
|
-
const distCliPath =
|
|
163517
|
+
const distCliPath = resolve35(currentDirectory, options.packageRel, options.distCliRel);
|
|
163308
163518
|
if (!seenPaths.has(distCliPath)) {
|
|
163309
163519
|
const runtime = resolveJavaScriptRuntime(options.resolveExecutable);
|
|
163310
163520
|
seenPaths.add(distCliPath);
|
|
@@ -163316,7 +163526,7 @@ function createAncestorCliCandidates(options) {
|
|
|
163316
163526
|
runtimeAvailable: runtime.available
|
|
163317
163527
|
});
|
|
163318
163528
|
}
|
|
163319
|
-
const sourceCliPath =
|
|
163529
|
+
const sourceCliPath = resolve35(currentDirectory, options.packageRel, options.sourceCliRel);
|
|
163320
163530
|
if (!seenPaths.has(sourceCliPath)) {
|
|
163321
163531
|
const runtime = options.resolveExecutable("bun");
|
|
163322
163532
|
const sourceCandidateAvailable = options.isSourceCandidateAvailable?.({
|
|
@@ -163333,7 +163543,7 @@ function createAncestorCliCandidates(options) {
|
|
|
163333
163543
|
runtimeAvailable: runtime.available
|
|
163334
163544
|
});
|
|
163335
163545
|
}
|
|
163336
|
-
const parentDirectory =
|
|
163546
|
+
const parentDirectory = resolve35(currentDirectory, "..");
|
|
163337
163547
|
if (parentDirectory === currentDirectory)
|
|
163338
163548
|
return candidates;
|
|
163339
163549
|
currentDirectory = parentDirectory;
|
|
@@ -163386,11 +163596,11 @@ function getModuleDirectory(moduleUrl) {
|
|
|
163386
163596
|
}
|
|
163387
163597
|
}
|
|
163388
163598
|
function findBootstrapRoot(candidates, pathExists) {
|
|
163389
|
-
return candidates.find((candidate) => pathExists(
|
|
163599
|
+
return candidates.find((candidate) => pathExists(resolve36(candidate.root, "package.json")))?.root ?? process.cwd();
|
|
163390
163600
|
}
|
|
163391
163601
|
function readDaemonPackageVersion(root) {
|
|
163392
163602
|
try {
|
|
163393
|
-
const packageJson = JSON.parse(readFileSync74(
|
|
163603
|
+
const packageJson = JSON.parse(readFileSync74(resolve36(root, PACKAGE_REL, "package.json"), "utf-8"));
|
|
163394
163604
|
return DaemonPackageSchema.parse(packageJson).version;
|
|
163395
163605
|
} catch (error) {
|
|
163396
163606
|
if (!(error instanceof Error))
|
|
@@ -163402,17 +163612,17 @@ function createBootstrapCandidate(root, pathExists, resolveExecutable) {
|
|
|
163402
163612
|
const runtime = resolveJavaScriptRuntime(resolveExecutable);
|
|
163403
163613
|
const bun = resolveExecutable("bun");
|
|
163404
163614
|
const npm = resolveExecutable("npm");
|
|
163405
|
-
const packageManifestPath =
|
|
163615
|
+
const packageManifestPath = resolve36(root, PACKAGE_REL, "package.json");
|
|
163406
163616
|
return {
|
|
163407
163617
|
command: [runtime.command, "-e", LSP_BOOTSTRAP_SCRIPT, root, npm.command, bun.command],
|
|
163408
163618
|
root,
|
|
163409
|
-
path:
|
|
163619
|
+
path: resolve36(root, PACKAGE_REL, DIST_CLI_REL),
|
|
163410
163620
|
exists: runtime.available && npm.available && pathExists(packageManifestPath),
|
|
163411
163621
|
runtimeAvailable: runtime.available
|
|
163412
163622
|
};
|
|
163413
163623
|
}
|
|
163414
163624
|
function resolveLspCommand(options = {}) {
|
|
163415
|
-
const pathExists = options.exists ??
|
|
163625
|
+
const pathExists = options.exists ?? existsSync107;
|
|
163416
163626
|
const resolveExecutable = options.resolveExecutable ?? resolveRuntimeExecutable;
|
|
163417
163627
|
const moduleDirectory = getModuleDirectory(options.moduleUrl ?? import.meta.url);
|
|
163418
163628
|
const candidates = moduleDirectory ? createAncestorCliCandidates({
|
|
@@ -163422,7 +163632,7 @@ function resolveLspCommand(options = {}) {
|
|
|
163422
163632
|
sourceCliRel: SOURCE_CLI_REL,
|
|
163423
163633
|
pathExists,
|
|
163424
163634
|
resolveExecutable,
|
|
163425
|
-
isSourceCandidateAvailable: ({ root }) => pathExists(
|
|
163635
|
+
isSourceCandidateAvailable: ({ root }) => pathExists(resolve36(root, LSP_TOOLS_PACKAGE_REL, DIST_CLI_REL)) && readDaemonPackageVersion(root) !== null
|
|
163426
163636
|
}) : [];
|
|
163427
163637
|
const distCandidate = candidates.find((candidate) => hasCliSuffix(candidate.path, DIST_CLI_REL) && candidate.exists);
|
|
163428
163638
|
if (distCandidate) {
|
|
@@ -163436,7 +163646,7 @@ function resolveLspCommand(options = {}) {
|
|
|
163436
163646
|
}
|
|
163437
163647
|
function createLspMcpConfig(options = {}) {
|
|
163438
163648
|
const resolvedCommand = resolveLspCommand(options);
|
|
163439
|
-
const cwd =
|
|
163649
|
+
const cwd = resolve36(options.cwd ?? process.cwd());
|
|
163440
163650
|
const configDir = getOpenCodeConfigDir({ binary: "opencode" });
|
|
163441
163651
|
const sourceVersion = hasCliSuffix(resolvedCommand.path, SOURCE_CLI_REL) ? readDaemonPackageVersion(resolvedCommand.root) : null;
|
|
163442
163652
|
return {
|
|
@@ -163446,9 +163656,9 @@ function createLspMcpConfig(options = {}) {
|
|
|
163446
163656
|
cwd,
|
|
163447
163657
|
environment: {
|
|
163448
163658
|
LSP_TOOLS_MCP_CWD: cwd,
|
|
163449
|
-
LSP_TOOLS_MCP_PROJECT_CONFIG: PROJECT_LSP_CONFIGS.map((configPath) =>
|
|
163450
|
-
LSP_TOOLS_MCP_USER_CONFIG:
|
|
163451
|
-
LSP_TOOLS_MCP_INSTALL_DECISIONS:
|
|
163659
|
+
LSP_TOOLS_MCP_PROJECT_CONFIG: PROJECT_LSP_CONFIGS.map((configPath) => resolve36(cwd, configPath)).join(delimiter2),
|
|
163660
|
+
LSP_TOOLS_MCP_USER_CONFIG: resolve36(configDir, "lsp.json"),
|
|
163661
|
+
LSP_TOOLS_MCP_INSTALL_DECISIONS: resolve36(configDir, "lsp-install-decisions.json"),
|
|
163452
163662
|
...sourceVersion ? {
|
|
163453
163663
|
[OMO_LSP_DAEMON_CLI]: resolvedCommand.path,
|
|
163454
163664
|
[OMO_LSP_DAEMON_VERSION]: sourceVersion
|
|
@@ -170998,8 +171208,8 @@ function createChatHeadersHandler(args) {
|
|
|
170998
171208
|
}
|
|
170999
171209
|
|
|
171000
171210
|
// packages/omo-opencode/src/plugin/ultrawork-db-model-override.ts
|
|
171001
|
-
import { join as
|
|
171002
|
-
import { existsSync as
|
|
171211
|
+
import { join as join134 } from "path";
|
|
171212
|
+
import { existsSync as existsSync108 } from "fs";
|
|
171003
171213
|
async function importBunSqlite() {
|
|
171004
171214
|
if (typeof globalThis.Bun === "undefined") {
|
|
171005
171215
|
return null;
|
|
@@ -171015,7 +171225,7 @@ async function importBunSqlite() {
|
|
|
171015
171225
|
}
|
|
171016
171226
|
}
|
|
171017
171227
|
function getDbPath() {
|
|
171018
|
-
return
|
|
171228
|
+
return join134(getDataDir(), "opencode", "opencode.db");
|
|
171019
171229
|
}
|
|
171020
171230
|
var MAX_MICROTASK_RETRIES = 10;
|
|
171021
171231
|
function logCaughtDbError(message, metadata, error) {
|
|
@@ -171118,7 +171328,7 @@ async function scheduleDeferredModelOverride(messageId, targetModel, variant) {
|
|
|
171118
171328
|
return;
|
|
171119
171329
|
}
|
|
171120
171330
|
const dbPath = getDbPath();
|
|
171121
|
-
if (!
|
|
171331
|
+
if (!existsSync108(dbPath)) {
|
|
171122
171332
|
log2("[ultrawork-db-override] DB not found, skipping deferred override");
|
|
171123
171333
|
return;
|
|
171124
171334
|
}
|
|
@@ -173947,9 +174157,9 @@ function processKillErrorMeansAlive(error) {
|
|
|
173947
174157
|
}
|
|
173948
174158
|
|
|
173949
174159
|
// packages/utils/src/process-sweep/lsp-daemon-family.ts
|
|
173950
|
-
import { readFileSync as readFileSync75, readdirSync as
|
|
173951
|
-
import { homedir as
|
|
173952
|
-
import { basename as basename23, join as
|
|
174160
|
+
import { readFileSync as readFileSync75, readdirSync as readdirSync31 } from "fs";
|
|
174161
|
+
import { homedir as homedir29 } from "os";
|
|
174162
|
+
import { basename as basename23, join as join135, resolve as resolve37 } from "path";
|
|
173953
174163
|
|
|
173954
174164
|
// packages/utils/src/process-sweep/lsp-daemon-owner-attestation.ts
|
|
173955
174165
|
import { readFile as readFile13 } from "fs/promises";
|
|
@@ -174059,20 +174269,20 @@ var OMO_LSP_DAEMON_DIR_ENV = "OMO_LSP_DAEMON_DIR";
|
|
|
174059
174269
|
var OMO_LSP_DAEMON_VERSION_ENV = "OMO_LSP_DAEMON_VERSION";
|
|
174060
174270
|
function resolveLspDaemonBaseDir(options = {}) {
|
|
174061
174271
|
if (options.lspDaemonDir !== undefined && options.lspDaemonDir.trim().length > 0) {
|
|
174062
|
-
return
|
|
174272
|
+
return resolve37(options.lspDaemonDir);
|
|
174063
174273
|
}
|
|
174064
174274
|
const env = options.env ?? process.env;
|
|
174065
174275
|
const override = env[OMO_LSP_DAEMON_DIR_ENV];
|
|
174066
174276
|
if (override !== undefined && override.trim().length > 0)
|
|
174067
|
-
return
|
|
174068
|
-
const homeDir = options.homeDir ?? env["HOME"] ?? env["USERPROFILE"] ??
|
|
174069
|
-
return
|
|
174277
|
+
return resolve37(override);
|
|
174278
|
+
const homeDir = options.homeDir ?? env["HOME"] ?? env["USERPROFILE"] ?? homedir29();
|
|
174279
|
+
return join135(homeDir, ".omo", "lsp-daemon");
|
|
174070
174280
|
}
|
|
174071
174281
|
var VERSION_ENTRY_PATTERN = /^v([A-Za-z0-9][A-Za-z0-9._+-]{0,127})$/;
|
|
174072
174282
|
function listLspDaemonVersionDirs(baseDir) {
|
|
174073
174283
|
let entries;
|
|
174074
174284
|
try {
|
|
174075
|
-
entries =
|
|
174285
|
+
entries = readdirSync31(baseDir, { withFileTypes: true });
|
|
174076
174286
|
} catch (error) {
|
|
174077
174287
|
if (error instanceof Error)
|
|
174078
174288
|
return [];
|
|
@@ -174085,12 +174295,12 @@ function listLspDaemonVersionDirs(baseDir) {
|
|
|
174085
174295
|
const version = VERSION_ENTRY_PATTERN.exec(entry.name)?.[1];
|
|
174086
174296
|
if (version === undefined)
|
|
174087
174297
|
continue;
|
|
174088
|
-
versions.push({ dir:
|
|
174298
|
+
versions.push({ dir: join135(baseDir, entry.name), version });
|
|
174089
174299
|
}
|
|
174090
174300
|
return versions.sort((left, right) => left.version.localeCompare(right.version));
|
|
174091
174301
|
}
|
|
174092
174302
|
function readLspDaemonOwnerTarget(versionDir) {
|
|
174093
|
-
const ownerPath =
|
|
174303
|
+
const ownerPath = join135(versionDir, "daemon.owner");
|
|
174094
174304
|
let raw;
|
|
174095
174305
|
try {
|
|
174096
174306
|
raw = requireOwnerText(ownerPath);
|
|
@@ -174101,7 +174311,7 @@ function readLspDaemonOwnerTarget(versionDir) {
|
|
|
174101
174311
|
const owner = parseLspDaemonOwner(JSON.parse(raw));
|
|
174102
174312
|
if (owner === null)
|
|
174103
174313
|
return null;
|
|
174104
|
-
return { authPath:
|
|
174314
|
+
return { authPath: join135(versionDir, "daemon.auth"), owner, ownerPath, pid: owner.pid };
|
|
174105
174315
|
} catch {
|
|
174106
174316
|
return null;
|
|
174107
174317
|
}
|
|
@@ -174174,48 +174384,48 @@ function matchLspDaemonProxyCommand(command, roots, platform) {
|
|
|
174174
174384
|
}
|
|
174175
174385
|
|
|
174176
174386
|
// packages/utils/src/process-sweep/roots.ts
|
|
174177
|
-
import { existsSync as
|
|
174178
|
-
import { homedir as
|
|
174179
|
-
import { join as
|
|
174387
|
+
import { existsSync as existsSync109, readdirSync as readdirSync32, realpathSync as realpathSync20 } from "fs";
|
|
174388
|
+
import { homedir as homedir30 } from "os";
|
|
174389
|
+
import { join as join136, resolve as resolve38 } from "path";
|
|
174180
174390
|
function discoverOmoOwnedRoots(options = {}) {
|
|
174181
174391
|
const env = options.env ?? process.env;
|
|
174182
|
-
const homeDir = options.homeDir ?? env["HOME"] ?? env["USERPROFILE"] ??
|
|
174392
|
+
const homeDir = options.homeDir ?? env["HOME"] ?? env["USERPROFILE"] ?? homedir30();
|
|
174183
174393
|
const roots = new Set;
|
|
174184
|
-
addRoot(roots,
|
|
174394
|
+
addRoot(roots, join136(homeDir, ".claude", "omo"));
|
|
174185
174395
|
addRoot(roots, options.pluginRoot);
|
|
174186
174396
|
for (const root of options.extraRoots ?? [])
|
|
174187
174397
|
addRoot(roots, root);
|
|
174188
|
-
for (const root of readCodexPluginCacheRoots(options.codexHome ?? env["CODEX_HOME"] ??
|
|
174398
|
+
for (const root of readCodexPluginCacheRoots(options.codexHome ?? env["CODEX_HOME"] ?? join136(homeDir, ".codex"))) {
|
|
174189
174399
|
addRoot(roots, root);
|
|
174190
174400
|
}
|
|
174191
174401
|
return [...roots];
|
|
174192
174402
|
}
|
|
174193
174403
|
function readCodexPluginCacheRoots(codexHome) {
|
|
174194
|
-
const cacheRoot =
|
|
174195
|
-
if (!
|
|
174404
|
+
const cacheRoot = join136(codexHome, "plugins", "cache");
|
|
174405
|
+
if (!existsSync109(cacheRoot))
|
|
174196
174406
|
return [];
|
|
174197
174407
|
const roots = [];
|
|
174198
174408
|
for (const publisher of safeReadDir(cacheRoot)) {
|
|
174199
174409
|
if (!OMO_CODEX_PLUGIN_CACHE_PUBLISHERS.has(publisher))
|
|
174200
174410
|
continue;
|
|
174201
|
-
const omoRoot =
|
|
174202
|
-
if (!
|
|
174411
|
+
const omoRoot = join136(cacheRoot, publisher, "omo");
|
|
174412
|
+
if (!existsSync109(omoRoot))
|
|
174203
174413
|
continue;
|
|
174204
174414
|
for (const version of safeReadDir(omoRoot))
|
|
174205
|
-
roots.push(
|
|
174415
|
+
roots.push(join136(omoRoot, version));
|
|
174206
174416
|
}
|
|
174207
174417
|
return roots;
|
|
174208
174418
|
}
|
|
174209
174419
|
function addRoot(roots, root) {
|
|
174210
174420
|
if (root === undefined || root.trim().length === 0)
|
|
174211
174421
|
return;
|
|
174212
|
-
const resolved =
|
|
174422
|
+
const resolved = resolve38(root);
|
|
174213
174423
|
roots.add(resolved);
|
|
174214
174424
|
roots.add(realpathIfPossible(resolved));
|
|
174215
174425
|
}
|
|
174216
174426
|
function safeReadDir(path) {
|
|
174217
174427
|
try {
|
|
174218
|
-
return
|
|
174428
|
+
return readdirSync32(path, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name);
|
|
174219
174429
|
} catch (error) {
|
|
174220
174430
|
if (isNonFatalFsError(error))
|
|
174221
174431
|
return [];
|
|
@@ -174227,7 +174437,7 @@ function realpathIfPossible(path) {
|
|
|
174227
174437
|
return realpathSync20(path);
|
|
174228
174438
|
} catch (error) {
|
|
174229
174439
|
if (error instanceof Error)
|
|
174230
|
-
return
|
|
174440
|
+
return resolve38(path);
|
|
174231
174441
|
throw error;
|
|
174232
174442
|
}
|
|
174233
174443
|
}
|
|
@@ -174240,10 +174450,10 @@ function isNonFatalFsError(error) {
|
|
|
174240
174450
|
var OMO_CODEX_PLUGIN_CACHE_PUBLISHERS = new Set(["sisyphuslabs"]);
|
|
174241
174451
|
|
|
174242
174452
|
// packages/utils/src/process-sweep/sweeper.ts
|
|
174243
|
-
import { join as
|
|
174453
|
+
import { join as join137 } from "path";
|
|
174244
174454
|
|
|
174245
174455
|
// packages/utils/src/process-sweep/family-sweeper.ts
|
|
174246
|
-
import { existsSync as
|
|
174456
|
+
import { existsSync as existsSync110, mkdirSync as mkdirSync25, statSync as statSync17, utimesSync, writeFileSync as writeFileSync28 } from "fs";
|
|
174247
174457
|
import { dirname as dirname48 } from "path";
|
|
174248
174458
|
var DEFAULT_GRACE_MS = 2000;
|
|
174249
174459
|
var DEFAULT_THROTTLE_MS = 60 * 60 * 1000;
|
|
@@ -174335,9 +174545,9 @@ async function safelyKill(pid, context) {
|
|
|
174335
174545
|
}
|
|
174336
174546
|
}
|
|
174337
174547
|
function isSweepThrottled(stampFile, nowMs, throttleMs) {
|
|
174338
|
-
if (!
|
|
174548
|
+
if (!existsSync110(stampFile))
|
|
174339
174549
|
return false;
|
|
174340
|
-
return nowMs -
|
|
174550
|
+
return nowMs - statSync17(stampFile).mtimeMs < throttleMs;
|
|
174341
174551
|
}
|
|
174342
174552
|
function writeSweepStamp(stampFile, nowMs) {
|
|
174343
174553
|
mkdirSync25(dirname48(stampFile), { recursive: true });
|
|
@@ -174357,7 +174567,7 @@ function delay6(ms) {
|
|
|
174357
174567
|
// packages/utils/src/process-sweep/sweeper.ts
|
|
174358
174568
|
var LSP_PROXY_SWEEP_STAMP_FILE = "lsp-proxy-sweep.stamp";
|
|
174359
174569
|
async function sweepOrphanedLspDaemonProxies(options = {}) {
|
|
174360
|
-
const stampFile =
|
|
174570
|
+
const stampFile = join137(resolveLspDaemonBaseDir(options), LSP_PROXY_SWEEP_STAMP_FILE);
|
|
174361
174571
|
const ownedRoots = options.ownedRoots ?? discoverOmoOwnedRoots(options);
|
|
174362
174572
|
const result = await runProcessFamilySweep({
|
|
174363
174573
|
familyLabel: "lsp-daemon proxy sweep",
|
|
@@ -174376,7 +174586,7 @@ async function sweepOrphanedLspDaemonProxies(options = {}) {
|
|
|
174376
174586
|
var LSP_DAEMON_SWEEP_STAMP_FILE = "lsp-daemon-sweep.stamp";
|
|
174377
174587
|
async function sweepStaleLspDaemonVersions(options = {}) {
|
|
174378
174588
|
const baseDir = resolveLspDaemonBaseDir(options);
|
|
174379
|
-
const stampFile =
|
|
174589
|
+
const stampFile = join137(baseDir, LSP_DAEMON_SWEEP_STAMP_FILE);
|
|
174380
174590
|
const currentVersion = resolveCurrentLspDaemonVersion(options);
|
|
174381
174591
|
const dryRun = options.dryRun === true;
|
|
174382
174592
|
if (currentVersion === undefined) {
|
|
@@ -174448,22 +174658,22 @@ function defaultPluginRoot() {
|
|
|
174448
174658
|
// packages/telemetry-core/src/activity-state.ts
|
|
174449
174659
|
init_atomic_write();
|
|
174450
174660
|
init_xdg_data_dir();
|
|
174451
|
-
import { existsSync as
|
|
174452
|
-
import { basename as basename24, join as
|
|
174661
|
+
import { existsSync as existsSync111, mkdirSync as mkdirSync26, readFileSync as readFileSync76 } from "fs";
|
|
174662
|
+
import { basename as basename24, join as join138 } from "path";
|
|
174453
174663
|
var POSTHOG_ACTIVITY_STATE_FILE = "posthog-activity.json";
|
|
174454
174664
|
function resolveTelemetryStateDir(product, options = {}) {
|
|
174455
174665
|
const dataDir = resolveXdgDataDir(product.cacheDirName, {
|
|
174456
174666
|
env: options.env,
|
|
174457
174667
|
osProvider: options.osProvider
|
|
174458
174668
|
});
|
|
174459
|
-
const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined :
|
|
174669
|
+
const xdgStateDir = options.env?.XDG_DATA_HOME === undefined ? undefined : join138(options.env.XDG_DATA_HOME, product.cacheDirName);
|
|
174460
174670
|
if (dataDir === xdgStateDir || xdgStateDir === undefined && basename24(dataDir) === product.cacheDirName) {
|
|
174461
174671
|
return dataDir;
|
|
174462
174672
|
}
|
|
174463
|
-
return
|
|
174673
|
+
return join138(dataDir, product.cacheDirName);
|
|
174464
174674
|
}
|
|
174465
174675
|
function getTelemetryActivityStateFilePath(stateDir) {
|
|
174466
|
-
return
|
|
174676
|
+
return join138(stateDir, POSTHOG_ACTIVITY_STATE_FILE);
|
|
174467
174677
|
}
|
|
174468
174678
|
function getDailyActiveCaptureState(input) {
|
|
174469
174679
|
const state = readPostHogActivityState(input.stateDir, input.diagnostics);
|
|
@@ -174488,7 +174698,7 @@ function isPostHogActivityState(value) {
|
|
|
174488
174698
|
}
|
|
174489
174699
|
function readPostHogActivityState(stateDir, diagnostics) {
|
|
174490
174700
|
const stateFilePath = getTelemetryActivityStateFilePath(stateDir);
|
|
174491
|
-
if (!
|
|
174701
|
+
if (!existsSync111(stateFilePath)) {
|
|
174492
174702
|
return {};
|
|
174493
174703
|
}
|
|
174494
174704
|
try {
|