oh-my-opencode 4.18.1 → 4.18.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/skills/codex-qa/scripts/lsp-e2e.sh +39 -16
- package/.agents/skills/opencode-qa/scripts/lsp-e2e.sh +111 -28
- package/bin/AGENTS.md +33 -0
- package/dist/cli/index.js +57 -18
- package/dist/cli-node/index.js +57 -18
- package/dist/hooks/anthropic-context-window-limit-recovery/empty-content-recovery-sdk.d.ts +6 -0
- package/dist/hooks/category-skill-reminder/hook.d.ts +9 -1
- package/dist/hooks/comment-checker/hook.d.ts +8 -1
- package/dist/hooks/todo-continuation-enforcer/types.d.ts +3 -0
- package/dist/index.js +560 -333
- package/dist/plugin/messages-transform.d.ts +1 -0
- package/dist/plugin-handlers/prometheus-agent-config-builder.d.ts +2 -0
- package/dist/tui.js +43 -4
- package/package.json +13 -13
- package/packages/git-bash-mcp/dist/cli.js +81 -19
- package/packages/lsp-core/src/lsp/client-diagnostics-freshness.integration.test.ts +4 -4
- package/packages/lsp-core/src/lsp/directory-diagnostics.test.ts +118 -1
- package/packages/lsp-core/src/lsp/directory-diagnostics.ts +1 -1
- package/packages/lsp-daemon/dist/cli.js +262 -63
- package/packages/lsp-daemon/dist/client.js +194 -50
- package/packages/lsp-daemon/dist/daemon-client.d.ts +2 -2
- package/packages/lsp-daemon/dist/daemon-client.js +26 -2
- package/packages/lsp-daemon/dist/ensure-daemon.d.ts +5 -4
- package/packages/lsp-daemon/dist/ensure-daemon.js +79 -18
- package/packages/lsp-daemon/dist/index.js +262 -63
- package/packages/lsp-daemon/dist/proxy.d.ts +2 -0
- package/packages/lsp-daemon/dist/proxy.js +79 -23
- package/packages/lsp-tools-mcp/dist/cli.js +82 -20
- package/packages/lsp-tools-mcp/dist/mcp.js +82 -20
- package/packages/lsp-tools-mcp/dist/tools.js +1 -1
- package/packages/omo-codex/plugin/.codex-plugin/plugin.json +1 -1
- package/packages/omo-codex/plugin/.mcp.json +2 -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/codegraph/dist/cli.js +100 -28
- package/packages/omo-codex/plugin/components/codegraph/dist/serve.js +100 -28
- package/packages/omo-codex/plugin/components/codegraph/package.json +1 -1
- package/packages/omo-codex/plugin/components/codegraph/src/mcp-bridge.ts +21 -9
- package/packages/omo-codex/plugin/components/codegraph/test/mcp-bridge-fixtures.ts +35 -0
- package/packages/omo-codex/plugin/components/codegraph/test/serve-mcp-bridge-lifecycle.test.ts +69 -0
- package/packages/omo-codex/plugin/components/codegraph/test/serve-mcp-bridge.test.ts +57 -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/.mcp.json +2 -1
- package/packages/omo-codex/plugin/components/lsp/dist/.omo-runtime-manifest.json +3 -3
- package/packages/omo-codex/plugin/components/lsp/dist/cli.js +113 -31
- 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/lsp/test/package-smoke.test.ts +1 -0
- package/packages/omo-codex/plugin/components/rules/bundled-rules/hephaestus/gpt-5.5.md +1 -1
- package/packages/omo-codex/plugin/components/rules/bundled-rules/hephaestus/gpt-5.6.md +5 -3
- 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/start-work-continuation/README.md +2 -2
- package/packages/omo-codex/plugin/components/start-work-continuation/directive.md +3 -3
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/cli.js +2 -2
- package/packages/omo-codex/plugin/components/start-work-continuation/hooks/hooks.json +2 -2
- package/packages/omo-codex/plugin/components/start-work-continuation/package.json +1 -1
- package/packages/omo-codex/plugin/components/start-work-continuation/src/boulder-reader.ts +1 -1
- package/packages/omo-codex/plugin/components/start-work-continuation/src/codex-hook.ts +1 -1
- package/packages/omo-codex/plugin/components/start-work-continuation/test/boulder-reader.test.ts +15 -1
- package/packages/omo-codex/plugin/components/start-work-continuation/test/codex-hook.test.ts +20 -0
- 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/directive.md +50 -33
- package/packages/omo-codex/plugin/components/ultrawork/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/package.json +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/skills/ultrawork/SKILL.md +50 -33
- package/packages/omo-codex/plugin/components/ulw-loop/directive.md +50 -33
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli.js +3 -3
- package/packages/omo-codex/plugin/components/ulw-loop/dist/stop-resume-hook.js +5 -6
- package/packages/omo-codex/plugin/components/ulw-loop/hooks/hooks.json +4 -4
- package/packages/omo-codex/plugin/components/ulw-loop/package.json +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/references/full-workflow.md +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/src/stop-resume-hook.ts +5 -6
- package/packages/omo-codex/plugin/components/ulw-loop/test/stop-resume-hook.test.ts +2 -2
- 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-codegraph-init-guidance.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/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-checking-codegraph-bootstrap.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-start-work-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-checking-start-work-continuation.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 +13 -13
- package/packages/omo-codex/plugin/package.json +1 -1
- package/packages/omo-codex/plugin/scripts/sync-skills.mjs +10 -2
- package/packages/omo-codex/plugin/skills/review-work/SKILL.md +7 -0
- package/packages/omo-codex/plugin/skills/start-work/SKILL.md +3 -2
- package/packages/omo-codex/plugin/skills/ultrawork/SKILL.md +50 -33
- package/packages/omo-codex/plugin/skills/ulw-loop/references/full-workflow.md +1 -1
- package/packages/omo-codex/plugin/test/mcp-research-servers.test.mjs +1 -0
- package/packages/omo-codex/plugin/test/sync-skills-orchestration.test.mjs +7 -0
- package/packages/omo-codex/plugin/test/sync-skills-test-support.mjs +35 -4
- package/packages/omo-codex/scripts/install-dist/install-local.mjs +1 -1
package/dist/index.js
CHANGED
|
@@ -9046,10 +9046,10 @@ async function runTmuxCommandOnce(tmuxPath, args, timeoutMs) {
|
|
|
9046
9046
|
try {
|
|
9047
9047
|
const exitCodeOrTimeout = timeoutMs === undefined ? await subprocess.exited : await Promise.race([
|
|
9048
9048
|
subprocess.exited,
|
|
9049
|
-
new Promise((
|
|
9049
|
+
new Promise((resolve10) => {
|
|
9050
9050
|
timeoutId = setTimeout(() => {
|
|
9051
9051
|
abortController.abort();
|
|
9052
|
-
|
|
9052
|
+
resolve10("timeout");
|
|
9053
9053
|
}, timeoutMs);
|
|
9054
9054
|
})
|
|
9055
9055
|
]);
|
|
@@ -9109,7 +9109,7 @@ function getCurrentPaneId() {
|
|
|
9109
9109
|
|
|
9110
9110
|
// packages/tmux-core/src/tmux-utils/server-health.ts
|
|
9111
9111
|
function delay(milliseconds) {
|
|
9112
|
-
return new Promise((
|
|
9112
|
+
return new Promise((resolve10) => setTimeout(resolve10, milliseconds));
|
|
9113
9113
|
}
|
|
9114
9114
|
function markServerRunningInProcess() {
|
|
9115
9115
|
globalThis[SERVER_RUNNING_KEY] = true;
|
|
@@ -9309,7 +9309,7 @@ var init_pane_spawn = __esm(() => {
|
|
|
9309
9309
|
|
|
9310
9310
|
// packages/tmux-core/src/tmux-utils/pane-close.ts
|
|
9311
9311
|
function delay2(milliseconds) {
|
|
9312
|
-
return new Promise((
|
|
9312
|
+
return new Promise((resolve10) => setTimeout(resolve10, milliseconds));
|
|
9313
9313
|
}
|
|
9314
9314
|
async function closeTmuxPane(paneId) {
|
|
9315
9315
|
const [{ isInsideTmux: isInsideTmux2 }, { runTmuxCommand: runTmuxCommand2 }] = await Promise.all([
|
|
@@ -10141,7 +10141,7 @@ __export(exports_pane_close, {
|
|
|
10141
10141
|
closeTmuxPane: () => closeTmuxPane2
|
|
10142
10142
|
});
|
|
10143
10143
|
function delay3(milliseconds) {
|
|
10144
|
-
return new Promise((
|
|
10144
|
+
return new Promise((resolve10) => setTimeout(resolve10, milliseconds));
|
|
10145
10145
|
}
|
|
10146
10146
|
async function closeTmuxPane2(paneId) {
|
|
10147
10147
|
const [{ log: log4 }, { isInsideTmux: isInsideTmux2 }, { getTmuxPath: getTmuxPath2 }, { runTmuxCommand: runTmuxCommand2 }] = await Promise.all([
|
|
@@ -10594,12 +10594,12 @@ var require_isexe = __commonJS((exports, module) => {
|
|
|
10594
10594
|
if (typeof Promise !== "function") {
|
|
10595
10595
|
throw new TypeError("callback not provided");
|
|
10596
10596
|
}
|
|
10597
|
-
return new Promise(function(
|
|
10597
|
+
return new Promise(function(resolve10, reject) {
|
|
10598
10598
|
isexe(path8, options || {}, function(er, is) {
|
|
10599
10599
|
if (er) {
|
|
10600
10600
|
reject(er);
|
|
10601
10601
|
} else {
|
|
10602
|
-
|
|
10602
|
+
resolve10(is);
|
|
10603
10603
|
}
|
|
10604
10604
|
});
|
|
10605
10605
|
});
|
|
@@ -10661,27 +10661,27 @@ var require_which = __commonJS((exports, module) => {
|
|
|
10661
10661
|
opt = {};
|
|
10662
10662
|
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
|
10663
10663
|
const found = [];
|
|
10664
|
-
const step = (i) => new Promise((
|
|
10664
|
+
const step = (i) => new Promise((resolve10, reject) => {
|
|
10665
10665
|
if (i === pathEnv.length)
|
|
10666
|
-
return opt.all && found.length ?
|
|
10666
|
+
return opt.all && found.length ? resolve10(found) : reject(getNotFoundError(cmd));
|
|
10667
10667
|
const ppRaw = pathEnv[i];
|
|
10668
10668
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
10669
10669
|
const pCmd = path8.join(pathPart, cmd);
|
|
10670
10670
|
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
10671
|
-
|
|
10671
|
+
resolve10(subStep(p, i, 0));
|
|
10672
10672
|
});
|
|
10673
|
-
const subStep = (p, i, ii) => new Promise((
|
|
10673
|
+
const subStep = (p, i, ii) => new Promise((resolve10, reject) => {
|
|
10674
10674
|
if (ii === pathExt.length)
|
|
10675
|
-
return
|
|
10675
|
+
return resolve10(step(i + 1));
|
|
10676
10676
|
const ext = pathExt[ii];
|
|
10677
10677
|
isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
|
|
10678
10678
|
if (!er && is) {
|
|
10679
10679
|
if (opt.all)
|
|
10680
10680
|
found.push(p + ext);
|
|
10681
10681
|
else
|
|
10682
|
-
return
|
|
10682
|
+
return resolve10(p + ext);
|
|
10683
10683
|
}
|
|
10684
|
-
return
|
|
10684
|
+
return resolve10(subStep(p, i, ii + 1));
|
|
10685
10685
|
});
|
|
10686
10686
|
});
|
|
10687
10687
|
return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
|
|
@@ -13005,7 +13005,7 @@ var init_types2 = __esm(() => {
|
|
|
13005
13005
|
|
|
13006
13006
|
// packages/team-core/src/team-registry/paths.ts
|
|
13007
13007
|
import { mkdir as mkdir3, readdir as readdir2, stat as stat2, chmod as chmod3 } from "fs/promises";
|
|
13008
|
-
import { homedir as
|
|
13008
|
+
import { homedir as homedir22 } from "os";
|
|
13009
13009
|
import path14 from "path";
|
|
13010
13010
|
function getTeamDirectory(baseDir, teamName, scope, projectRoot) {
|
|
13011
13011
|
if (scope === "project") {
|
|
@@ -13028,14 +13028,14 @@ function resolveContainedPath2(baseDir, pathSegments) {
|
|
|
13028
13028
|
return resolvedPath;
|
|
13029
13029
|
}
|
|
13030
13030
|
function resolveBaseDir(config) {
|
|
13031
|
-
return expandHomeDirectory(config.base_dir ?? path14.join(
|
|
13031
|
+
return expandHomeDirectory(config.base_dir ?? path14.join(homedir22(), ".omo"));
|
|
13032
13032
|
}
|
|
13033
13033
|
function expandHomeDirectory(directoryPath) {
|
|
13034
13034
|
if (directoryPath === "~") {
|
|
13035
|
-
return
|
|
13035
|
+
return homedir22();
|
|
13036
13036
|
}
|
|
13037
13037
|
if (directoryPath.startsWith("~/") || directoryPath.startsWith("~\\")) {
|
|
13038
|
-
return path14.join(
|
|
13038
|
+
return path14.join(homedir22(), directoryPath.slice(2));
|
|
13039
13039
|
}
|
|
13040
13040
|
return directoryPath;
|
|
13041
13041
|
}
|
|
@@ -13187,8 +13187,8 @@ import { randomUUID as randomUUID5 } from "crypto";
|
|
|
13187
13187
|
import { access as access3, open, readFile as readFile4, rename as rename3, rm as rm3, unlink as unlink2 } from "fs/promises";
|
|
13188
13188
|
import { dirname as dirname24 } from "path";
|
|
13189
13189
|
function delay4(ms) {
|
|
13190
|
-
return new Promise((
|
|
13191
|
-
setTimeout(
|
|
13190
|
+
return new Promise((resolve19) => {
|
|
13191
|
+
setTimeout(resolve19, ms);
|
|
13192
13192
|
});
|
|
13193
13193
|
}
|
|
13194
13194
|
function buildOwnerContent(ownerTag) {
|
|
@@ -16591,7 +16591,7 @@ var require_compile = __commonJS((exports) => {
|
|
|
16591
16591
|
const schOrFunc = root.refs[ref];
|
|
16592
16592
|
if (schOrFunc)
|
|
16593
16593
|
return schOrFunc;
|
|
16594
|
-
let _sch =
|
|
16594
|
+
let _sch = resolve35.call(this, root, ref);
|
|
16595
16595
|
if (_sch === undefined) {
|
|
16596
16596
|
const schema = (_a = root.localRefs) === null || _a === undefined ? undefined : _a[ref];
|
|
16597
16597
|
const { schemaId } = this.opts;
|
|
@@ -16618,7 +16618,7 @@ var require_compile = __commonJS((exports) => {
|
|
|
16618
16618
|
function sameSchemaEnv(s1, s2) {
|
|
16619
16619
|
return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId;
|
|
16620
16620
|
}
|
|
16621
|
-
function
|
|
16621
|
+
function resolve35(root, ref) {
|
|
16622
16622
|
let sch;
|
|
16623
16623
|
while (typeof (sch = this.refs[ref]) == "string")
|
|
16624
16624
|
ref = sch;
|
|
@@ -17204,7 +17204,7 @@ var require_fast_uri = __commonJS((exports, module) => {
|
|
|
17204
17204
|
}
|
|
17205
17205
|
return uri;
|
|
17206
17206
|
}
|
|
17207
|
-
function
|
|
17207
|
+
function resolve35(baseURI, relativeURI, options) {
|
|
17208
17208
|
const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
|
|
17209
17209
|
const resolved = resolveComponent(parse3(baseURI, schemelessOptions), parse3(relativeURI, schemelessOptions), schemelessOptions, true);
|
|
17210
17210
|
schemelessOptions.skipEscape = true;
|
|
@@ -17463,7 +17463,7 @@ var require_fast_uri = __commonJS((exports, module) => {
|
|
|
17463
17463
|
var fastUri = {
|
|
17464
17464
|
SCHEMES,
|
|
17465
17465
|
normalize: normalize4,
|
|
17466
|
-
resolve:
|
|
17466
|
+
resolve: resolve35,
|
|
17467
17467
|
resolveComponent,
|
|
17468
17468
|
equal,
|
|
17469
17469
|
serialize,
|
|
@@ -20867,7 +20867,7 @@ function resolveFilePath(filePath, cwd) {
|
|
|
20867
20867
|
}
|
|
20868
20868
|
function readFileContent(resolvedPath) {
|
|
20869
20869
|
if (!existsSync11(resolvedPath)) {
|
|
20870
|
-
return
|
|
20870
|
+
return null;
|
|
20871
20871
|
}
|
|
20872
20872
|
const stat2 = statSync4(resolvedPath);
|
|
20873
20873
|
if (stat2.isDirectory()) {
|
|
@@ -20897,13 +20897,16 @@ async function resolveFileReferencesInText(text, cwd = process.cwd(), depth = 0,
|
|
|
20897
20897
|
continue;
|
|
20898
20898
|
}
|
|
20899
20899
|
const content = readFileContent(resolvedPath);
|
|
20900
|
+
if (content === null) {
|
|
20901
|
+
continue;
|
|
20902
|
+
}
|
|
20900
20903
|
replacements.set(match.fullMatch, content);
|
|
20901
20904
|
}
|
|
20902
20905
|
let resolved = text;
|
|
20903
20906
|
for (const [pattern, replacement] of replacements.entries()) {
|
|
20904
20907
|
resolved = resolved.replaceAll(pattern, replacement);
|
|
20905
20908
|
}
|
|
20906
|
-
if (findFileReferences(resolved).length > 0 && depth + 1 < maxDepth) {
|
|
20909
|
+
if (replacements.size > 0 && findFileReferences(resolved).length > 0 && depth + 1 < maxDepth) {
|
|
20907
20910
|
return resolveFileReferencesInText(resolved, cwd, depth + 1, maxDepth);
|
|
20908
20911
|
}
|
|
20909
20912
|
return resolved;
|
|
@@ -20941,7 +20944,7 @@ var AGENT_MODEL_REQUIREMENTS = {
|
|
|
20941
20944
|
hephaestus: {
|
|
20942
20945
|
fallbackChain: [
|
|
20943
20946
|
{
|
|
20944
|
-
providers: ["openai", "vercel"],
|
|
20947
|
+
providers: ["openai", "github-copilot", "vercel"],
|
|
20945
20948
|
model: "gpt-5.6-sol",
|
|
20946
20949
|
variant: "high"
|
|
20947
20950
|
},
|
|
@@ -21052,6 +21055,11 @@ var AGENT_MODEL_REQUIREMENTS = {
|
|
|
21052
21055
|
model: "gpt-5.6-sol",
|
|
21053
21056
|
variant: "xhigh"
|
|
21054
21057
|
},
|
|
21058
|
+
{
|
|
21059
|
+
providers: ["github-copilot"],
|
|
21060
|
+
model: "gpt-5.6-sol",
|
|
21061
|
+
variant: "high"
|
|
21062
|
+
},
|
|
21055
21063
|
{
|
|
21056
21064
|
providers: ["openai", "github-copilot", "opencode", "vercel"],
|
|
21057
21065
|
model: "gpt-5.5",
|
|
@@ -21126,6 +21134,11 @@ var CATEGORY_MODEL_REQUIREMENTS = {
|
|
|
21126
21134
|
model: "gpt-5.6-sol",
|
|
21127
21135
|
variant: "xhigh"
|
|
21128
21136
|
},
|
|
21137
|
+
{
|
|
21138
|
+
providers: ["github-copilot"],
|
|
21139
|
+
model: "gpt-5.6-sol",
|
|
21140
|
+
variant: "high"
|
|
21141
|
+
},
|
|
21129
21142
|
{
|
|
21130
21143
|
providers: ["openai", "opencode", "vercel"],
|
|
21131
21144
|
model: "gpt-5.5",
|
|
@@ -21152,7 +21165,12 @@ var CATEGORY_MODEL_REQUIREMENTS = {
|
|
|
21152
21165
|
variant: "xhigh"
|
|
21153
21166
|
},
|
|
21154
21167
|
{
|
|
21155
|
-
providers: ["
|
|
21168
|
+
providers: ["github-copilot"],
|
|
21169
|
+
model: "gpt-5.6-terra",
|
|
21170
|
+
variant: "high"
|
|
21171
|
+
},
|
|
21172
|
+
{
|
|
21173
|
+
providers: ["openai", "github-copilot", "vercel"],
|
|
21156
21174
|
model: "gpt-5.6-sol",
|
|
21157
21175
|
variant: "high"
|
|
21158
21176
|
},
|
|
@@ -21219,6 +21237,11 @@ var CATEGORY_MODEL_REQUIREMENTS = {
|
|
|
21219
21237
|
model: "gpt-5.6-luna",
|
|
21220
21238
|
variant: "xhigh"
|
|
21221
21239
|
},
|
|
21240
|
+
{
|
|
21241
|
+
providers: ["github-copilot"],
|
|
21242
|
+
model: "gpt-5.6-luna",
|
|
21243
|
+
variant: "high"
|
|
21244
|
+
},
|
|
21222
21245
|
{
|
|
21223
21246
|
providers: ["anthropic", "github-copilot", "opencode", "vercel"],
|
|
21224
21247
|
model: "claude-sonnet-4-6"
|
|
@@ -21381,6 +21404,14 @@ var EXACT_ALIAS_RULES = [
|
|
|
21381
21404
|
];
|
|
21382
21405
|
var EXACT_ALIAS_RULES_BY_MODEL = new Map(EXACT_ALIAS_RULES.map((rule) => [rule.aliasModelID, rule]));
|
|
21383
21406
|
var PATTERN_ALIAS_RULES = [
|
|
21407
|
+
{
|
|
21408
|
+
ruleID: "openai-gpt-5.6-fast-service-tier-alias",
|
|
21409
|
+
description: "Normalizes OpenCode's OpenAI GPT-5.6 fast service-tier IDs to canonical snapshot IDs.",
|
|
21410
|
+
providerIDs: ["openai"],
|
|
21411
|
+
allowedSubproviderHosts: ["vercel"],
|
|
21412
|
+
match: (normalizedModelID) => /^gpt-5\.6-(?:sol|terra|luna)-fast$/.test(normalizedModelID),
|
|
21413
|
+
canonicalize: (normalizedModelID) => normalizedModelID.slice(0, -"-fast".length)
|
|
21414
|
+
},
|
|
21384
21415
|
{
|
|
21385
21416
|
ruleID: "claude-thinking-legacy-alias",
|
|
21386
21417
|
description: "Normalizes the legacy claude-opus-4-7-thinking id to the canonical snapshot ID.",
|
|
@@ -21404,9 +21435,12 @@ function stripProviderPrefixForAliasLookup(normalizedModelID) {
|
|
|
21404
21435
|
}
|
|
21405
21436
|
return normalizedModelID.slice(slashIndex + 1);
|
|
21406
21437
|
}
|
|
21407
|
-
function resolveModelIDAlias(modelID) {
|
|
21438
|
+
function resolveModelIDAlias(modelID, providerID) {
|
|
21408
21439
|
const requestedModelID = normalizeLookupModelID(modelID);
|
|
21409
21440
|
const aliasLookupModelID = stripProviderPrefixForAliasLookup(requestedModelID);
|
|
21441
|
+
const normalizedProviderID = providerID ? normalizeLookupModelID(providerID) : undefined;
|
|
21442
|
+
const providerPrefixEnd = requestedModelID.indexOf("/");
|
|
21443
|
+
const embeddedProviderID = providerPrefixEnd > 0 ? requestedModelID.slice(0, providerPrefixEnd) : undefined;
|
|
21410
21444
|
const exactRule = EXACT_ALIAS_RULES_BY_MODEL.get(aliasLookupModelID);
|
|
21411
21445
|
if (exactRule) {
|
|
21412
21446
|
return {
|
|
@@ -21417,6 +21451,13 @@ function resolveModelIDAlias(modelID) {
|
|
|
21417
21451
|
};
|
|
21418
21452
|
}
|
|
21419
21453
|
for (const rule of PATTERN_ALIAS_RULES) {
|
|
21454
|
+
if (rule.providerIDs) {
|
|
21455
|
+
const matchesProviderID = normalizedProviderID !== undefined && rule.providerIDs.includes(normalizedProviderID);
|
|
21456
|
+
const matchesEmbeddedProviderID = normalizedProviderID !== undefined && rule.allowedSubproviderHosts?.includes(normalizedProviderID) === true && embeddedProviderID !== undefined && rule.providerIDs.includes(embeddedProviderID);
|
|
21457
|
+
if (!matchesProviderID && !matchesEmbeddedProviderID) {
|
|
21458
|
+
continue;
|
|
21459
|
+
}
|
|
21460
|
+
}
|
|
21420
21461
|
if (!rule.match(aliasLookupModelID)) {
|
|
21421
21462
|
continue;
|
|
21422
21463
|
}
|
|
@@ -21922,21 +21963,25 @@ function resolveModelPipeline(request, providerCache = {
|
|
|
21922
21963
|
} else {
|
|
21923
21964
|
for (const entry of fallbackChain) {
|
|
21924
21965
|
for (const provider of entry.providers) {
|
|
21925
|
-
const
|
|
21926
|
-
const
|
|
21927
|
-
|
|
21928
|
-
|
|
21929
|
-
|
|
21930
|
-
|
|
21931
|
-
|
|
21932
|
-
|
|
21933
|
-
|
|
21934
|
-
|
|
21935
|
-
|
|
21936
|
-
|
|
21937
|
-
|
|
21938
|
-
|
|
21939
|
-
|
|
21966
|
+
const transformedModelId = deps.transformModelForProvider(provider, entry.model);
|
|
21967
|
+
const candidateModelIds = transformedModelId === entry.model ? [entry.model] : [entry.model, transformedModelId];
|
|
21968
|
+
for (const modelID of candidateModelIds) {
|
|
21969
|
+
const fullModel = `${provider}/${modelID}`;
|
|
21970
|
+
const match = deps.fuzzyMatchModel(fullModel, availableModels, [provider]);
|
|
21971
|
+
if (match) {
|
|
21972
|
+
log3("Model resolved via fallback chain (availability confirmed)", {
|
|
21973
|
+
provider,
|
|
21974
|
+
model: entry.model,
|
|
21975
|
+
match,
|
|
21976
|
+
variant: entry.variant
|
|
21977
|
+
});
|
|
21978
|
+
return {
|
|
21979
|
+
model: match,
|
|
21980
|
+
provenance: "provider-fallback",
|
|
21981
|
+
variant: entry.variant,
|
|
21982
|
+
attempted
|
|
21983
|
+
};
|
|
21984
|
+
}
|
|
21940
21985
|
}
|
|
21941
21986
|
}
|
|
21942
21987
|
}
|
|
@@ -22855,7 +22900,7 @@ function getProviderOverride(providerID, modelID) {
|
|
|
22855
22900
|
return GITHUB_COPILOT_GPT5_MODEL.test(normalizeLookupModelID2(modelID)) ? GITHUB_COPILOT_GPT5_OVERRIDE : undefined;
|
|
22856
22901
|
}
|
|
22857
22902
|
function getModelCapabilities(input) {
|
|
22858
|
-
const canonicalization = resolveModelIDAlias(input.modelID);
|
|
22903
|
+
const canonicalization = resolveModelIDAlias(input.modelID, input.providerID);
|
|
22859
22904
|
const override = getOverride(input.modelID);
|
|
22860
22905
|
const providerOverride = getProviderOverride(input.providerID, canonicalization.canonicalModelID);
|
|
22861
22906
|
const runtimeModel = readRuntimeModel(input.runtimeModel ?? input.providerCache?.findProviderModelMetadata(input.providerID, input.modelID));
|
|
@@ -24611,34 +24656,18 @@ function migrateAgentConfig(config) {
|
|
|
24611
24656
|
}
|
|
24612
24657
|
// packages/omo-opencode/src/shared/load-opencode-plugins.ts
|
|
24613
24658
|
import * as fs6 from "fs";
|
|
24614
|
-
import * as os4 from "os";
|
|
24615
24659
|
import * as path6 from "path";
|
|
24616
24660
|
var opencodePluginsCache = new Map;
|
|
24617
|
-
function getWindowsAppdataDir() {
|
|
24618
|
-
return process.env.APPDATA || null;
|
|
24619
|
-
}
|
|
24620
24661
|
function getConfigPaths(directory) {
|
|
24621
|
-
const
|
|
24622
|
-
|
|
24662
|
+
const configDirs = getOpenCodeConfigDirs({ binary: "opencode" });
|
|
24663
|
+
return [
|
|
24623
24664
|
path6.join(directory, ".opencode", "opencode.json"),
|
|
24624
24665
|
path6.join(directory, ".opencode", "opencode.jsonc"),
|
|
24625
|
-
|
|
24626
|
-
|
|
24666
|
+
...configDirs.flatMap((dir) => [
|
|
24667
|
+
path6.join(dir, "opencode.json"),
|
|
24668
|
+
path6.join(dir, "opencode.jsonc")
|
|
24669
|
+
])
|
|
24627
24670
|
];
|
|
24628
|
-
const customConfigDir = process.env.OPENCODE_CONFIG_DIR?.trim();
|
|
24629
|
-
if (customConfigDir) {
|
|
24630
|
-
const resolvedCustomConfigDir = path6.resolve(customConfigDir);
|
|
24631
|
-
paths.push(path6.join(resolvedCustomConfigDir, "opencode.json"));
|
|
24632
|
-
paths.push(path6.join(resolvedCustomConfigDir, "opencode.jsonc"));
|
|
24633
|
-
}
|
|
24634
|
-
if (process.platform === "win32") {
|
|
24635
|
-
const appdataDir = getWindowsAppdataDir();
|
|
24636
|
-
if (appdataDir) {
|
|
24637
|
-
paths.push(path6.join(appdataDir, "opencode", "opencode.json"));
|
|
24638
|
-
paths.push(path6.join(appdataDir, "opencode", "opencode.jsonc"));
|
|
24639
|
-
}
|
|
24640
|
-
}
|
|
24641
|
-
return Array.from(new Set(paths));
|
|
24642
24671
|
}
|
|
24643
24672
|
function loadOpencodePlugins(directory) {
|
|
24644
24673
|
const cachedPluginEntries = opencodePluginsCache.get(directory);
|
|
@@ -76477,7 +76506,7 @@ init_route_resolver();
|
|
|
76477
76506
|
// node_modules/.bun/@opencode-ai+sdk@1.15.13/node_modules/@opencode-ai/sdk/dist/gen/core/serverSentEvents.gen.js
|
|
76478
76507
|
var createSseClient = ({ onSseError, onSseEvent, responseTransformer, responseValidator, sseDefaultRetryDelay, sseMaxRetryAttempts, sseMaxRetryDelay, sseSleepFn, url, ...options }) => {
|
|
76479
76508
|
let lastEventId;
|
|
76480
|
-
const sleep2 = sseSleepFn ?? ((ms) => new Promise((
|
|
76509
|
+
const sleep2 = sseSleepFn ?? ((ms) => new Promise((resolve10) => setTimeout(resolve10, ms)));
|
|
76481
76510
|
const createStream = async function* () {
|
|
76482
76511
|
let retryDelay = sseDefaultRetryDelay ?? 3000;
|
|
76483
76512
|
let attempt = 0;
|
|
@@ -78674,11 +78703,11 @@ function getOpenCodeCommandDirs(options) {
|
|
|
78674
78703
|
// packages/omo-opencode/src/shared/project-discovery-dirs.ts
|
|
78675
78704
|
import { execFileSync as execFileSync3 } from "child_process";
|
|
78676
78705
|
import { existsSync as existsSync21, realpathSync as realpathSync7 } from "fs";
|
|
78677
|
-
import { dirname as dirname7, join as join30, resolve as
|
|
78706
|
+
import { dirname as dirname7, join as join30, resolve as resolve10, win32 as win323 } from "path";
|
|
78678
78707
|
init_plugin_identity();
|
|
78679
78708
|
var worktreePathCache = new Map;
|
|
78680
78709
|
function normalizePath2(path8) {
|
|
78681
|
-
const resolvedPath = process.platform !== "win32" && win323.isAbsolute(path8) ? path8 :
|
|
78710
|
+
const resolvedPath = process.platform !== "win32" && win323.isAbsolute(path8) ? path8 : resolve10(path8);
|
|
78682
78711
|
if (!existsSync21(resolvedPath)) {
|
|
78683
78712
|
return resolvedPath;
|
|
78684
78713
|
}
|
|
@@ -78746,7 +78775,7 @@ function findAncestorDirectories(startDirectory, targetPaths, stopDirectory) {
|
|
|
78746
78775
|
}
|
|
78747
78776
|
}
|
|
78748
78777
|
function detectWorktreePath(directory) {
|
|
78749
|
-
const resolvedDirectory =
|
|
78778
|
+
const resolvedDirectory = resolve10(directory);
|
|
78750
78779
|
const cacheKey = pathKey(normalizePath2(resolvedDirectory));
|
|
78751
78780
|
if (worktreePathCache.has(cacheKey)) {
|
|
78752
78781
|
return worktreePathCache.get(cacheKey);
|
|
@@ -78879,7 +78908,7 @@ var log4 = logger4.log;
|
|
|
78879
78908
|
var getLogFilePath2 = logger4.getLogFilePath;
|
|
78880
78909
|
|
|
78881
78910
|
// packages/claude-code-compat-core/src/features/claude-code-plugin-loader/scope-filter.ts
|
|
78882
|
-
import { homedir as
|
|
78911
|
+
import { homedir as homedir13 } from "os";
|
|
78883
78912
|
import { join as join31 } from "path";
|
|
78884
78913
|
|
|
78885
78914
|
// packages/claude-code-compat-core/src/shared/contains-path.ts
|
|
@@ -78888,10 +78917,10 @@ init_src();
|
|
|
78888
78917
|
// packages/claude-code-compat-core/src/features/claude-code-plugin-loader/scope-filter.ts
|
|
78889
78918
|
function expandTilde(inputPath) {
|
|
78890
78919
|
if (inputPath === "~") {
|
|
78891
|
-
return
|
|
78920
|
+
return homedir13();
|
|
78892
78921
|
}
|
|
78893
78922
|
if (inputPath.startsWith("~/") || inputPath.startsWith("~\\")) {
|
|
78894
|
-
return join31(
|
|
78923
|
+
return join31(homedir13(), inputPath.slice(2));
|
|
78895
78924
|
}
|
|
78896
78925
|
return inputPath;
|
|
78897
78926
|
}
|
|
@@ -78906,13 +78935,13 @@ function shouldLoadPluginForCwd(installation, cwd = process.cwd()) {
|
|
|
78906
78935
|
}
|
|
78907
78936
|
|
|
78908
78937
|
// packages/claude-code-compat-core/src/features/claude-code-plugin-loader/discovery-paths.ts
|
|
78909
|
-
import { homedir as
|
|
78938
|
+
import { homedir as homedir14 } from "os";
|
|
78910
78939
|
import { join as join32 } from "path";
|
|
78911
78940
|
function getPluginsBaseDir() {
|
|
78912
78941
|
if (process.env.CLAUDE_PLUGINS_HOME) {
|
|
78913
78942
|
return process.env.CLAUDE_PLUGINS_HOME;
|
|
78914
78943
|
}
|
|
78915
|
-
return join32(
|
|
78944
|
+
return join32(homedir14(), ".claude", "plugins");
|
|
78916
78945
|
}
|
|
78917
78946
|
function getInstalledPluginsPath(pluginsBaseDir) {
|
|
78918
78947
|
return join32(pluginsBaseDir ?? getPluginsBaseDir(), "installed_plugins.json");
|
|
@@ -78921,7 +78950,7 @@ function getClaudeSettingsPath() {
|
|
|
78921
78950
|
if (process.env.CLAUDE_SETTINGS_PATH) {
|
|
78922
78951
|
return process.env.CLAUDE_SETTINGS_PATH;
|
|
78923
78952
|
}
|
|
78924
|
-
return join32(
|
|
78953
|
+
return join32(homedir14(), ".claude", "settings.json");
|
|
78925
78954
|
}
|
|
78926
78955
|
|
|
78927
78956
|
// packages/claude-code-compat-core/src/features/claude-code-plugin-loader/installed-plugin-database.ts
|
|
@@ -79335,7 +79364,7 @@ import { existsSync as existsSync28, readdirSync as readdirSync7, readFileSync a
|
|
|
79335
79364
|
import { join as join37 } from "path";
|
|
79336
79365
|
|
|
79337
79366
|
// packages/utils/src/skill-path-resolver.ts
|
|
79338
|
-
import { isAbsolute as isAbsolute6, posix as posix3, relative as relative4, resolve as
|
|
79367
|
+
import { isAbsolute as isAbsolute6, posix as posix3, relative as relative4, resolve as resolve11, win32 as win324 } from "path";
|
|
79339
79368
|
function toDisplayPath(path8) {
|
|
79340
79369
|
return path8.replaceAll("\\", "/");
|
|
79341
79370
|
}
|
|
@@ -79374,7 +79403,7 @@ function resolveSkillPathReferences(content, basePath) {
|
|
|
79374
79403
|
}
|
|
79375
79404
|
return relativePath.endsWith("/") && !resolvedPath2.endsWith("/") ? `${resolvedPath2}/` : resolvedPath2;
|
|
79376
79405
|
}
|
|
79377
|
-
const resolvedPath =
|
|
79406
|
+
const resolvedPath = resolve11(normalizedBase, relativePath);
|
|
79378
79407
|
const relativePathFromBase = relative4(normalizedBase, resolvedPath);
|
|
79379
79408
|
if (relativePathFromBase.startsWith("..") || isAbsolute6(relativePathFromBase)) {
|
|
79380
79409
|
return match;
|
|
@@ -80546,6 +80575,13 @@ ${todoList}`;
|
|
|
80546
80575
|
log2(`[${HOOK_NAME}] Skipped injection: session was cancelled before prompt`, { sessionID });
|
|
80547
80576
|
return;
|
|
80548
80577
|
}
|
|
80578
|
+
if (injectionState?.continuationBlockReason) {
|
|
80579
|
+
log2(`[${HOOK_NAME}] Skipped injection: continuation paused at turn boundary`, {
|
|
80580
|
+
sessionID,
|
|
80581
|
+
reason: injectionState.continuationBlockReason
|
|
80582
|
+
});
|
|
80583
|
+
return;
|
|
80584
|
+
}
|
|
80549
80585
|
if (injectionState) {
|
|
80550
80586
|
injectionState.inFlight = true;
|
|
80551
80587
|
}
|
|
@@ -80585,6 +80621,9 @@ ${todoList}`;
|
|
|
80585
80621
|
injectionState.inFlight = false;
|
|
80586
80622
|
injectionState.lastInjectedAt = Date.now();
|
|
80587
80623
|
injectionState.awaitingPostInjectionProgressCheck = true;
|
|
80624
|
+
injectionState.continuationResponseObserved = false;
|
|
80625
|
+
injectionState.continuationBlockReason = undefined;
|
|
80626
|
+
injectionState.pendingUserMessageID = undefined;
|
|
80588
80627
|
injectionState.consecutiveFailures = 0;
|
|
80589
80628
|
}
|
|
80590
80629
|
return;
|
|
@@ -80603,6 +80642,9 @@ ${todoList}`;
|
|
|
80603
80642
|
injectionState.inFlight = false;
|
|
80604
80643
|
injectionState.lastInjectedAt = Date.now();
|
|
80605
80644
|
injectionState.awaitingPostInjectionProgressCheck = true;
|
|
80645
|
+
injectionState.continuationResponseObserved = false;
|
|
80646
|
+
injectionState.continuationBlockReason = undefined;
|
|
80647
|
+
injectionState.pendingUserMessageID = undefined;
|
|
80606
80648
|
injectionState.consecutiveFailures = 0;
|
|
80607
80649
|
}
|
|
80608
80650
|
} catch (error) {
|
|
@@ -80930,6 +80972,14 @@ async function handleSessionIdle(args) {
|
|
|
80930
80972
|
return;
|
|
80931
80973
|
}
|
|
80932
80974
|
const progressUpdate = sessionStateStore.trackContinuationProgress(sessionID, incompleteCount, todos);
|
|
80975
|
+
if (state2.continuationBlockReason) {
|
|
80976
|
+
log2(`[${HOOK_NAME}] Skipped: continuation paused at turn boundary`, {
|
|
80977
|
+
sessionID,
|
|
80978
|
+
reason: state2.continuationBlockReason,
|
|
80979
|
+
hasProgressed: progressUpdate.hasProgressed
|
|
80980
|
+
});
|
|
80981
|
+
return;
|
|
80982
|
+
}
|
|
80933
80983
|
if (shouldStopForStagnation({ sessionID, incompleteCount, progressUpdate })) {
|
|
80934
80984
|
return;
|
|
80935
80985
|
}
|
|
@@ -80968,6 +81018,39 @@ function resolveEventParts(properties) {
|
|
|
80968
81018
|
function hasInternalSystemDirective(parts) {
|
|
80969
81019
|
return (parts ?? []).some((part) => part.type === "text" && typeof part.text === "string" && isSystemDirective(part.text));
|
|
80970
81020
|
}
|
|
81021
|
+
function hasAcceptedContinuationLifecycle(state2) {
|
|
81022
|
+
return state2.awaitingPostInjectionProgressCheck === true || state2.continuationResponseObserved === true || state2.continuationBlockReason === "directive-response";
|
|
81023
|
+
}
|
|
81024
|
+
function markContinuationResponseObserved(state2) {
|
|
81025
|
+
if (state2?.awaitingPostInjectionProgressCheck === true) {
|
|
81026
|
+
state2.continuationResponseObserved = true;
|
|
81027
|
+
}
|
|
81028
|
+
}
|
|
81029
|
+
function pauseForGenuineUserInterruption(args) {
|
|
81030
|
+
const { state: state2, sessionID, sessionStateStore } = args;
|
|
81031
|
+
state2.continuationBlockReason = "user-interruption";
|
|
81032
|
+
state2.continuationResponseObserved = false;
|
|
81033
|
+
state2.pendingUserMessageID = undefined;
|
|
81034
|
+
state2.abortDetectedAt = undefined;
|
|
81035
|
+
state2.wasCancelled = false;
|
|
81036
|
+
state2.tokenLimitDetected = false;
|
|
81037
|
+
sessionStateStore.cancelCountdown(sessionID);
|
|
81038
|
+
log2(`[${HOOK_NAME}] Paused continuation after genuine user interruption`, { sessionID });
|
|
81039
|
+
}
|
|
81040
|
+
function resolveUpdatedPart(properties) {
|
|
81041
|
+
const part = properties?.part;
|
|
81042
|
+
if (!isEventPart(part)) {
|
|
81043
|
+
return;
|
|
81044
|
+
}
|
|
81045
|
+
const messageID = part.messageID;
|
|
81046
|
+
if (messageID !== undefined && typeof messageID !== "string") {
|
|
81047
|
+
return;
|
|
81048
|
+
}
|
|
81049
|
+
return {
|
|
81050
|
+
...part,
|
|
81051
|
+
...messageID ? { messageID } : {}
|
|
81052
|
+
};
|
|
81053
|
+
}
|
|
80971
81054
|
function handleNonIdleEvent(args) {
|
|
80972
81055
|
const { eventType, properties, sessionStateStore } = args;
|
|
80973
81056
|
if (eventType === "message.updated") {
|
|
@@ -80988,6 +81071,19 @@ function handleNonIdleEvent(args) {
|
|
|
80988
81071
|
return;
|
|
80989
81072
|
}
|
|
80990
81073
|
const state2 = sessionStateStore.getExistingState(sessionID);
|
|
81074
|
+
const messageID = typeof info?.id === "string" ? info.id : undefined;
|
|
81075
|
+
if (parts === undefined && state2 && hasAcceptedContinuationLifecycle(state2) && messageID) {
|
|
81076
|
+
state2.pendingUserMessageID = messageID;
|
|
81077
|
+
log2(`[${HOOK_NAME}] Deferred user interruption classification until message part`, {
|
|
81078
|
+
sessionID,
|
|
81079
|
+
messageID
|
|
81080
|
+
});
|
|
81081
|
+
return;
|
|
81082
|
+
}
|
|
81083
|
+
if (state2 && hasAcceptedContinuationLifecycle(state2)) {
|
|
81084
|
+
pauseForGenuineUserInterruption({ state: state2, sessionID, sessionStateStore });
|
|
81085
|
+
return;
|
|
81086
|
+
}
|
|
80991
81087
|
if (state2?.countdownStartedAt) {
|
|
80992
81088
|
const elapsed = Date.now() - state2.countdownStartedAt;
|
|
80993
81089
|
if (elapsed < COUNTDOWN_GRACE_PERIOD_MS) {
|
|
@@ -81006,6 +81102,7 @@ function handleNonIdleEvent(args) {
|
|
|
81006
81102
|
if (role === "assistant") {
|
|
81007
81103
|
const state2 = sessionStateStore.getExistingState(sessionID);
|
|
81008
81104
|
if (state2) {
|
|
81105
|
+
markContinuationResponseObserved(state2);
|
|
81009
81106
|
state2.abortDetectedAt = undefined;
|
|
81010
81107
|
state2.wasCancelled = false;
|
|
81011
81108
|
}
|
|
@@ -81019,6 +81116,27 @@ function handleNonIdleEvent(args) {
|
|
|
81019
81116
|
if (targetSessionID) {
|
|
81020
81117
|
const state2 = sessionStateStore.getExistingState(targetSessionID);
|
|
81021
81118
|
if (state2) {
|
|
81119
|
+
const part = resolveUpdatedPart(properties);
|
|
81120
|
+
if (part?.messageID && part.messageID === state2.pendingUserMessageID) {
|
|
81121
|
+
state2.pendingUserMessageID = undefined;
|
|
81122
|
+
if (isSyntheticOrInternalOnlyTextParts([part])) {
|
|
81123
|
+
log2(`[${HOOK_NAME}] Ignoring synthetic/internal split user message`, {
|
|
81124
|
+
sessionID: targetSessionID,
|
|
81125
|
+
messageID: part.messageID
|
|
81126
|
+
});
|
|
81127
|
+
} else if (hasAcceptedContinuationLifecycle(state2)) {
|
|
81128
|
+
pauseForGenuineUserInterruption({
|
|
81129
|
+
state: state2,
|
|
81130
|
+
sessionID: targetSessionID,
|
|
81131
|
+
sessionStateStore
|
|
81132
|
+
});
|
|
81133
|
+
}
|
|
81134
|
+
return;
|
|
81135
|
+
}
|
|
81136
|
+
const info = properties?.info;
|
|
81137
|
+
if (info?.role === "assistant") {
|
|
81138
|
+
markContinuationResponseObserved(state2);
|
|
81139
|
+
}
|
|
81022
81140
|
state2.abortDetectedAt = undefined;
|
|
81023
81141
|
}
|
|
81024
81142
|
sessionStateStore.cancelCountdown(targetSessionID);
|
|
@@ -81030,6 +81148,10 @@ function handleNonIdleEvent(args) {
|
|
|
81030
81148
|
if (sessionID) {
|
|
81031
81149
|
const state2 = sessionStateStore.getExistingState(sessionID);
|
|
81032
81150
|
if (state2) {
|
|
81151
|
+
const info = properties?.info;
|
|
81152
|
+
if (info?.role === "assistant") {
|
|
81153
|
+
markContinuationResponseObserved(state2);
|
|
81154
|
+
}
|
|
81033
81155
|
state2.abortDetectedAt = undefined;
|
|
81034
81156
|
state2.wasCancelled = false;
|
|
81035
81157
|
}
|
|
@@ -81042,6 +81164,7 @@ function handleNonIdleEvent(args) {
|
|
|
81042
81164
|
if (sessionID) {
|
|
81043
81165
|
const state2 = sessionStateStore.getExistingState(sessionID);
|
|
81044
81166
|
if (state2) {
|
|
81167
|
+
markContinuationResponseObserved(state2);
|
|
81045
81168
|
state2.abortDetectedAt = undefined;
|
|
81046
81169
|
state2.wasCancelled = false;
|
|
81047
81170
|
}
|
|
@@ -81115,6 +81238,9 @@ function createTodoContinuationHandler(args) {
|
|
|
81115
81238
|
state2.lastIncompleteCount = undefined;
|
|
81116
81239
|
state2.lastInjectedAt = undefined;
|
|
81117
81240
|
state2.awaitingPostInjectionProgressCheck = false;
|
|
81241
|
+
state2.continuationResponseObserved = false;
|
|
81242
|
+
state2.continuationBlockReason = undefined;
|
|
81243
|
+
state2.pendingUserMessageID = undefined;
|
|
81118
81244
|
state2.stagnationCount = 0;
|
|
81119
81245
|
state2.consecutiveFailures = 0;
|
|
81120
81246
|
shouldCancelCountdown = true;
|
|
@@ -81261,6 +81387,9 @@ function createSessionStateStore() {
|
|
|
81261
81387
|
if (hasProgressed) {
|
|
81262
81388
|
state2.stagnationCount = 0;
|
|
81263
81389
|
state2.awaitingPostInjectionProgressCheck = false;
|
|
81390
|
+
state2.continuationResponseObserved = false;
|
|
81391
|
+
state2.continuationBlockReason = undefined;
|
|
81392
|
+
state2.pendingUserMessageID = undefined;
|
|
81264
81393
|
return {
|
|
81265
81394
|
previousIncompleteCount,
|
|
81266
81395
|
previousStagnationCount,
|
|
@@ -81279,6 +81408,11 @@ function createSessionStateStore() {
|
|
|
81279
81408
|
};
|
|
81280
81409
|
}
|
|
81281
81410
|
state2.awaitingPostInjectionProgressCheck = false;
|
|
81411
|
+
if (state2.continuationResponseObserved === true && state2.continuationBlockReason !== "user-interruption") {
|
|
81412
|
+
state2.continuationBlockReason = "directive-response";
|
|
81413
|
+
}
|
|
81414
|
+
state2.continuationResponseObserved = false;
|
|
81415
|
+
state2.pendingUserMessageID = undefined;
|
|
81282
81416
|
state2.stagnationCount += 1;
|
|
81283
81417
|
return {
|
|
81284
81418
|
previousIncompleteCount,
|
|
@@ -81297,6 +81431,9 @@ function createSessionStateStore() {
|
|
|
81297
81431
|
state2.lastIncompleteCount = undefined;
|
|
81298
81432
|
state2.stagnationCount = 0;
|
|
81299
81433
|
state2.awaitingPostInjectionProgressCheck = false;
|
|
81434
|
+
state2.continuationResponseObserved = false;
|
|
81435
|
+
state2.continuationBlockReason = undefined;
|
|
81436
|
+
state2.pendingUserMessageID = undefined;
|
|
81300
81437
|
state2.allTodosCompletedAt = undefined;
|
|
81301
81438
|
trackedSession.lastCompletedCount = undefined;
|
|
81302
81439
|
trackedSession.lastTodoSnapshot = undefined;
|
|
@@ -82358,13 +82495,13 @@ async function runCommentChecker(input, options) {
|
|
|
82358
82495
|
process3.stdin.end();
|
|
82359
82496
|
let timeoutId = null;
|
|
82360
82497
|
let graceId = null;
|
|
82361
|
-
const timeoutPromise = new Promise((
|
|
82498
|
+
const timeoutPromise = new Promise((resolve12) => {
|
|
82362
82499
|
timeoutId = setTimer(() => {
|
|
82363
82500
|
killProcessSafely(process3, "SIGTERM");
|
|
82364
82501
|
graceId = setTimer(() => {
|
|
82365
82502
|
killProcessSafely(process3, "SIGKILL");
|
|
82366
82503
|
}, killGraceMs);
|
|
82367
|
-
|
|
82504
|
+
resolve12("timeout");
|
|
82368
82505
|
}, timeoutMs);
|
|
82369
82506
|
});
|
|
82370
82507
|
try {
|
|
@@ -82401,7 +82538,7 @@ async function runCommentChecker(input, options) {
|
|
|
82401
82538
|
// packages/omo-opencode/src/hooks/comment-checker/downloader.ts
|
|
82402
82539
|
import { existsSync as existsSync38, appendFileSync as appendFileSync3 } from "fs";
|
|
82403
82540
|
import { join as join45 } from "path";
|
|
82404
|
-
import { homedir as
|
|
82541
|
+
import { homedir as homedir15, tmpdir as tmpdir3 } from "os";
|
|
82405
82542
|
import { createRequire as createRequire3 } from "module";
|
|
82406
82543
|
init_logger2();
|
|
82407
82544
|
init_plugin_identity();
|
|
@@ -82425,11 +82562,11 @@ var PLATFORM_MAP = {
|
|
|
82425
82562
|
function getCacheDir2() {
|
|
82426
82563
|
if (process.platform === "win32") {
|
|
82427
82564
|
const localAppData = process.env.LOCALAPPDATA || process.env.APPDATA;
|
|
82428
|
-
const base2 = localAppData || join45(
|
|
82565
|
+
const base2 = localAppData || join45(homedir15(), "AppData", "Local");
|
|
82429
82566
|
return join45(base2, CACHE_DIR_NAME, "bin");
|
|
82430
82567
|
}
|
|
82431
82568
|
const xdgCache = process.env.XDG_CACHE_HOME;
|
|
82432
|
-
const base = xdgCache || join45(
|
|
82569
|
+
const base = xdgCache || join45(homedir15(), ".cache");
|
|
82433
82570
|
return join45(base, CACHE_DIR_NAME, "bin");
|
|
82434
82571
|
}
|
|
82435
82572
|
function getBinaryName() {
|
|
@@ -82463,8 +82600,8 @@ async function downloadCommentChecker() {
|
|
|
82463
82600
|
return binaryPath;
|
|
82464
82601
|
}
|
|
82465
82602
|
const version = getPackageVersion();
|
|
82466
|
-
const { os:
|
|
82467
|
-
const assetName = `comment-checker_v${version}_${
|
|
82603
|
+
const { os: os4, arch, ext } = platformInfo;
|
|
82604
|
+
const assetName = `comment-checker_v${version}_${os4}_${arch}.${ext}`;
|
|
82468
82605
|
const downloadUrl = `https://github.com/${REPO}/releases/download/v${version}/${assetName}`;
|
|
82469
82606
|
debugLog(`Downloading from: ${downloadUrl}`);
|
|
82470
82607
|
log2(`[${PUBLISHED_PACKAGE_NAME}] Downloading comment-checker binary...`);
|
|
@@ -82784,13 +82921,20 @@ function debugLog3(...args) {
|
|
|
82784
82921
|
fs9.appendFileSync(DEBUG_FILE3, msg);
|
|
82785
82922
|
}
|
|
82786
82923
|
}
|
|
82787
|
-
function createCommentCheckerHooks(config) {
|
|
82924
|
+
function createCommentCheckerHooks(config, cliRunner) {
|
|
82925
|
+
const runner3 = cliRunner ?? {
|
|
82926
|
+
initializeCommentCheckerCli,
|
|
82927
|
+
getCommentCheckerCliPathPromise,
|
|
82928
|
+
isCliPathUsable,
|
|
82929
|
+
processWithCli,
|
|
82930
|
+
processApplyPatchEditsWithCli
|
|
82931
|
+
};
|
|
82788
82932
|
debugLog3("createCommentCheckerHooks called", { config });
|
|
82789
82933
|
return {
|
|
82790
82934
|
"tool.execute.before": async (input, output) => {
|
|
82791
82935
|
ensureCommentCheckerInitialization(() => {
|
|
82792
82936
|
startPendingCallCleanup();
|
|
82793
|
-
initializeCommentCheckerCli(debugLog3);
|
|
82937
|
+
runner3.initializeCommentCheckerCli(debugLog3);
|
|
82794
82938
|
});
|
|
82795
82939
|
debugLog3("tool.execute.before:", {
|
|
82796
82940
|
tool: input.tool,
|
|
@@ -82844,13 +82988,13 @@ function createCommentCheckerHooks(config) {
|
|
|
82844
82988
|
return;
|
|
82845
82989
|
}
|
|
82846
82990
|
try {
|
|
82847
|
-
const cliPath = await getCommentCheckerCliPathPromise();
|
|
82848
|
-
if (!isCliPathUsable(cliPath)) {
|
|
82991
|
+
const cliPath = await runner3.getCommentCheckerCliPathPromise();
|
|
82992
|
+
if (!runner3.isCliPathUsable(cliPath)) {
|
|
82849
82993
|
debugLog3("CLI not available, skipping comment check");
|
|
82850
82994
|
return;
|
|
82851
82995
|
}
|
|
82852
82996
|
debugLog3("using CLI for apply_patch:", cliPath);
|
|
82853
|
-
await processApplyPatchEditsWithCli(input.sessionID, edits, output, cliPath, config?.custom_prompt, debugLog3);
|
|
82997
|
+
await runner3.processApplyPatchEditsWithCli(input.sessionID, edits, output, cliPath, config?.custom_prompt, debugLog3);
|
|
82854
82998
|
} catch (err) {
|
|
82855
82999
|
debugLog3("apply_patch comment check failed:", err);
|
|
82856
83000
|
}
|
|
@@ -82863,13 +83007,13 @@ function createCommentCheckerHooks(config) {
|
|
|
82863
83007
|
}
|
|
82864
83008
|
debugLog3("processing pendingCall:", pendingCall);
|
|
82865
83009
|
try {
|
|
82866
|
-
const cliPath = await getCommentCheckerCliPathPromise();
|
|
82867
|
-
if (!isCliPathUsable(cliPath)) {
|
|
83010
|
+
const cliPath = await runner3.getCommentCheckerCliPathPromise();
|
|
83011
|
+
if (!runner3.isCliPathUsable(cliPath)) {
|
|
82868
83012
|
debugLog3("CLI not available, skipping comment check");
|
|
82869
83013
|
return;
|
|
82870
83014
|
}
|
|
82871
83015
|
debugLog3("using CLI:", cliPath);
|
|
82872
|
-
await processWithCli(input, pendingCall, output, cliPath, config?.custom_prompt, debugLog3);
|
|
83016
|
+
await runner3.processWithCli(input, pendingCall, output, cliPath, config?.custom_prompt, debugLog3);
|
|
82873
83017
|
} catch (err) {
|
|
82874
83018
|
debugLog3("tool.execute.after failed:", err);
|
|
82875
83019
|
}
|
|
@@ -82950,7 +83094,7 @@ function createAgentsMdCache() {
|
|
|
82950
83094
|
}
|
|
82951
83095
|
// packages/rules-engine/src/agents-md.ts
|
|
82952
83096
|
import { existsSync as existsSync41, realpathSync as realpathSync8, statSync as statSync5 } from "fs";
|
|
82953
|
-
import { dirname as dirname11, isAbsolute as isAbsolute7, join as join48, relative as relative6, resolve as
|
|
83097
|
+
import { dirname as dirname11, isAbsolute as isAbsolute7, join as join48, relative as relative6, resolve as resolve12 } from "path";
|
|
82954
83098
|
|
|
82955
83099
|
// packages/rules-engine/src/constants.ts
|
|
82956
83100
|
var PROJECT_MARKERS = [".git", "pyproject.toml", "package.json", "Cargo.toml", "go.mod", ".venv"];
|
|
@@ -83019,7 +83163,7 @@ function canonicalizePath(path8) {
|
|
|
83019
83163
|
return realpathSync8(path8);
|
|
83020
83164
|
} catch (error) {
|
|
83021
83165
|
if (error instanceof Error)
|
|
83022
|
-
return
|
|
83166
|
+
return resolve12(path8);
|
|
83023
83167
|
throw error;
|
|
83024
83168
|
}
|
|
83025
83169
|
}
|
|
@@ -83041,8 +83185,8 @@ function isSameOrChildPath(childPath, parentPath) {
|
|
|
83041
83185
|
}
|
|
83042
83186
|
// packages/rules-engine/src/finder.ts
|
|
83043
83187
|
import { existsSync as existsSync43, statSync as statSync6 } from "fs";
|
|
83044
|
-
import { homedir as
|
|
83045
|
-
import { dirname as dirname13, isAbsolute as isAbsolute9, join as join50, relative as relative8, resolve as
|
|
83188
|
+
import { homedir as homedir16 } from "os";
|
|
83189
|
+
import { dirname as dirname13, isAbsolute as isAbsolute9, join as join50, relative as relative8, resolve as resolve13 } from "path";
|
|
83046
83190
|
|
|
83047
83191
|
// packages/rules-engine/src/ordering.ts
|
|
83048
83192
|
function sortCandidates(candidates) {
|
|
@@ -83129,7 +83273,7 @@ function setSisyphusRuleDeprecationLogger(logger6) {
|
|
|
83129
83273
|
logSisyphusRuleDeprecation = logger6;
|
|
83130
83274
|
}
|
|
83131
83275
|
function findRuleFiles(projectRoot, homeDir, currentFile, options, cache) {
|
|
83132
|
-
const startDir = dirname13(
|
|
83276
|
+
const startDir = dirname13(resolve13(currentFile));
|
|
83133
83277
|
const skipClaudeUserRules = options?.skipClaudeUserRules ?? false;
|
|
83134
83278
|
const effectiveProjectRoot = resolveEffectiveProjectRoot(projectRoot, options?.workspaceDirectory, startDir);
|
|
83135
83279
|
const cacheKey = [projectRoot ?? "", effectiveProjectRoot, startDir, skipClaudeUserRules ? "1" : "0"].join("\x00");
|
|
@@ -83140,7 +83284,7 @@ function findRuleFiles(projectRoot, homeDir, currentFile, options, cache) {
|
|
|
83140
83284
|
const seenRealPaths = new Set;
|
|
83141
83285
|
addProjectRuleCandidates(effectiveProjectRoot, startDir, candidates, seenRealPaths, cache);
|
|
83142
83286
|
addProjectSingleFileCandidates(effectiveProjectRoot, candidates, seenRealPaths);
|
|
83143
|
-
addUserRuleCandidates(homeDir ||
|
|
83287
|
+
addUserRuleCandidates(homeDir || homedir16(), skipClaudeUserRules, candidates, seenRealPaths, cache);
|
|
83144
83288
|
const sorted = sortCandidates(candidates);
|
|
83145
83289
|
cache?.set(cacheKey, sorted);
|
|
83146
83290
|
return sorted;
|
|
@@ -83150,7 +83294,7 @@ function resolveEffectiveProjectRoot(projectRoot, workspaceDirectory, startDir)
|
|
|
83150
83294
|
return projectRoot;
|
|
83151
83295
|
if (!workspaceDirectory)
|
|
83152
83296
|
return startDir;
|
|
83153
|
-
const workspaceRoot =
|
|
83297
|
+
const workspaceRoot = resolve13(workspaceDirectory);
|
|
83154
83298
|
return isSameOrChildPath2(startDir, workspaceRoot) ? workspaceRoot : startDir;
|
|
83155
83299
|
}
|
|
83156
83300
|
function addProjectRuleCandidates(projectRoot, startDir, candidates, seenRealPaths, cache) {
|
|
@@ -83398,11 +83542,11 @@ var TRUNCATION_NOTICE_PREFIX = `
|
|
|
83398
83542
|
var TRUNCATION_NOTICE_SUFFIX = "]";
|
|
83399
83543
|
// packages/agents-md-core/src/finder.ts
|
|
83400
83544
|
import { realpathSync as realpathSync10 } from "fs";
|
|
83401
|
-
import { isAbsolute as isAbsolute10, relative as relative10, resolve as
|
|
83545
|
+
import { isAbsolute as isAbsolute10, relative as relative10, resolve as resolve14 } from "path";
|
|
83402
83546
|
function resolveFilePath2(rootDirectory, path8) {
|
|
83403
83547
|
if (!path8)
|
|
83404
83548
|
return null;
|
|
83405
|
-
const resolved = isAbsolute10(path8) ? path8 :
|
|
83549
|
+
const resolved = isAbsolute10(path8) ? path8 : resolve14(rootDirectory, path8);
|
|
83406
83550
|
const canonicalRoot = canonicalizePath2(rootDirectory);
|
|
83407
83551
|
const canonicalResolved = canonicalizePath2(resolved);
|
|
83408
83552
|
return isSameOrChildPath3(canonicalResolved, canonicalRoot) ? canonicalResolved : null;
|
|
@@ -83412,7 +83556,7 @@ function canonicalizePath2(path8) {
|
|
|
83412
83556
|
return realpathSync10(path8);
|
|
83413
83557
|
} catch (error) {
|
|
83414
83558
|
if (error instanceof Error) {
|
|
83415
|
-
return
|
|
83559
|
+
return resolve14(path8);
|
|
83416
83560
|
}
|
|
83417
83561
|
throw error;
|
|
83418
83562
|
}
|
|
@@ -83592,7 +83736,7 @@ import { dirname as dirname17 } from "path";
|
|
|
83592
83736
|
|
|
83593
83737
|
// packages/omo-opencode/src/hooks/directory-readme-injector/finder.ts
|
|
83594
83738
|
import { access as access2 } from "fs/promises";
|
|
83595
|
-
import { dirname as dirname16, isAbsolute as isAbsolute11, join as join55, resolve as
|
|
83739
|
+
import { dirname as dirname16, isAbsolute as isAbsolute11, join as join55, resolve as resolve15 } from "path";
|
|
83596
83740
|
|
|
83597
83741
|
// packages/omo-opencode/src/hooks/directory-readme-injector/constants.ts
|
|
83598
83742
|
import { join as join54 } from "path";
|
|
@@ -83605,7 +83749,7 @@ function resolveFilePath3(rootDirectory, path8) {
|
|
|
83605
83749
|
return null;
|
|
83606
83750
|
if (isAbsolute11(path8))
|
|
83607
83751
|
return path8;
|
|
83608
|
-
return
|
|
83752
|
+
return resolve15(rootDirectory, path8);
|
|
83609
83753
|
}
|
|
83610
83754
|
async function findReadmeMdUp(input) {
|
|
83611
83755
|
const found = [];
|
|
@@ -84919,18 +85063,23 @@ async function findEmptyMessageByIndexFromSDK(client3, sessionID, targetIndex) {
|
|
|
84919
85063
|
return null;
|
|
84920
85064
|
}
|
|
84921
85065
|
}
|
|
84922
|
-
|
|
85066
|
+
var defaultStorage = {
|
|
85067
|
+
replaceEmptyTextPartsAsync,
|
|
85068
|
+
findMessagesWithEmptyTextPartsFromSDK,
|
|
85069
|
+
injectTextPartAsync
|
|
85070
|
+
};
|
|
85071
|
+
async function fixEmptyMessagesWithSDK(params, storage2 = defaultStorage) {
|
|
84923
85072
|
let fixed = false;
|
|
84924
85073
|
const fixedMessageIds = [];
|
|
84925
85074
|
if (params.messageIndex !== undefined) {
|
|
84926
85075
|
const targetMessageId = await findEmptyMessageByIndexFromSDK(params.client, params.sessionID, params.messageIndex);
|
|
84927
85076
|
if (targetMessageId) {
|
|
84928
|
-
const replaced = await replaceEmptyTextPartsAsync(params.client, params.sessionID, targetMessageId, params.placeholderText);
|
|
85077
|
+
const replaced = await storage2.replaceEmptyTextPartsAsync(params.client, params.sessionID, targetMessageId, params.placeholderText);
|
|
84929
85078
|
if (replaced) {
|
|
84930
85079
|
fixed = true;
|
|
84931
85080
|
fixedMessageIds.push(targetMessageId);
|
|
84932
85081
|
} else {
|
|
84933
|
-
const injected = await injectTextPartAsync(params.client, params.sessionID, targetMessageId, params.placeholderText);
|
|
85082
|
+
const injected = await storage2.injectTextPartAsync(params.client, params.sessionID, targetMessageId, params.placeholderText);
|
|
84934
85083
|
if (injected) {
|
|
84935
85084
|
fixed = true;
|
|
84936
85085
|
fixedMessageIds.push(targetMessageId);
|
|
@@ -84942,19 +85091,19 @@ async function fixEmptyMessagesWithSDK(params) {
|
|
|
84942
85091
|
return { fixed, fixedMessageIds, scannedEmptyCount: 0 };
|
|
84943
85092
|
}
|
|
84944
85093
|
const emptyMessageIds = await findEmptyMessagesFromSDK(params.client, params.sessionID);
|
|
84945
|
-
const emptyTextPartIds = await findMessagesWithEmptyTextPartsFromSDK(params.client, params.sessionID);
|
|
85094
|
+
const emptyTextPartIds = await storage2.findMessagesWithEmptyTextPartsFromSDK(params.client, params.sessionID);
|
|
84946
85095
|
const additionalIds = emptyTextPartIds.filter((id) => !emptyMessageIds.includes(id));
|
|
84947
85096
|
const allTargetIds = [...emptyMessageIds, ...additionalIds];
|
|
84948
85097
|
if (allTargetIds.length === 0) {
|
|
84949
85098
|
return { fixed: false, fixedMessageIds: [], scannedEmptyCount: 0 };
|
|
84950
85099
|
}
|
|
84951
85100
|
for (const messageID of allTargetIds) {
|
|
84952
|
-
const replaced = await replaceEmptyTextPartsAsync(params.client, params.sessionID, messageID, params.placeholderText);
|
|
85101
|
+
const replaced = await storage2.replaceEmptyTextPartsAsync(params.client, params.sessionID, messageID, params.placeholderText);
|
|
84953
85102
|
if (replaced) {
|
|
84954
85103
|
fixed = true;
|
|
84955
85104
|
fixedMessageIds.push(messageID);
|
|
84956
85105
|
} else {
|
|
84957
|
-
const injected = await injectTextPartAsync(params.client, params.sessionID, messageID, params.placeholderText);
|
|
85106
|
+
const injected = await storage2.injectTextPartAsync(params.client, params.sessionID, messageID, params.placeholderText);
|
|
84958
85107
|
if (injected) {
|
|
84959
85108
|
fixed = true;
|
|
84960
85109
|
fixedMessageIds.push(messageID);
|
|
@@ -86604,14 +86753,14 @@ import { existsSync as existsSync54 } from "fs";
|
|
|
86604
86753
|
import { join as join64 } from "path";
|
|
86605
86754
|
var CONFIG_CACHE_TTL_MS2 = 30000;
|
|
86606
86755
|
var configCache2 = new Map;
|
|
86607
|
-
function
|
|
86608
|
-
return
|
|
86756
|
+
function getUserConfigPaths() {
|
|
86757
|
+
return getOpenCodeConfigDirs({ binary: "opencode" }).map((dir) => join64(dir, "opencode-cc-plugin.json"));
|
|
86609
86758
|
}
|
|
86610
86759
|
function getProjectConfigPath() {
|
|
86611
86760
|
return join64(process.cwd(), ".opencode", "opencode-cc-plugin.json");
|
|
86612
86761
|
}
|
|
86613
86762
|
function getCacheKey2() {
|
|
86614
|
-
return `${process.cwd()}::${
|
|
86763
|
+
return `${process.cwd()}::${getUserConfigPaths().join("|")}`;
|
|
86615
86764
|
}
|
|
86616
86765
|
function getCachedConfig2(cacheKey) {
|
|
86617
86766
|
const cachedEntry = configCache2.get(cacheKey);
|
|
@@ -86666,16 +86815,26 @@ async function loadPluginExtendedConfig() {
|
|
|
86666
86815
|
if (cachedConfig) {
|
|
86667
86816
|
return cachedConfig;
|
|
86668
86817
|
}
|
|
86669
|
-
const
|
|
86818
|
+
const userPaths = [...getUserConfigPaths()].reverse();
|
|
86819
|
+
let mergedDisabledHooks = {};
|
|
86820
|
+
for (const userPath of userPaths) {
|
|
86821
|
+
const userConfig = await loadConfigFromPath(userPath);
|
|
86822
|
+
if (userConfig?.disabledHooks) {
|
|
86823
|
+
mergedDisabledHooks = mergeDisabledHooks(mergedDisabledHooks, userConfig.disabledHooks);
|
|
86824
|
+
}
|
|
86825
|
+
}
|
|
86670
86826
|
const projectConfig = await loadConfigFromPath(getProjectConfigPath());
|
|
86827
|
+
if (projectConfig?.disabledHooks) {
|
|
86828
|
+
mergedDisabledHooks = mergeDisabledHooks(mergedDisabledHooks, projectConfig.disabledHooks);
|
|
86829
|
+
}
|
|
86671
86830
|
const merged = {
|
|
86672
|
-
disabledHooks:
|
|
86831
|
+
disabledHooks: mergedDisabledHooks
|
|
86673
86832
|
};
|
|
86674
|
-
if (
|
|
86833
|
+
if (Object.keys(mergedDisabledHooks).length > 0 || projectConfig) {
|
|
86675
86834
|
log2("Plugin extended config loaded", {
|
|
86676
|
-
|
|
86835
|
+
userConfigPaths: getUserConfigPaths(),
|
|
86677
86836
|
projectConfigExists: projectConfig !== null,
|
|
86678
|
-
mergedDisabledHooks
|
|
86837
|
+
mergedDisabledHooks
|
|
86679
86838
|
});
|
|
86680
86839
|
}
|
|
86681
86840
|
configCache2.set(cacheKey, {
|
|
@@ -88114,12 +88273,12 @@ function readCurrentTopLevelTask(planPath) {
|
|
|
88114
88273
|
}
|
|
88115
88274
|
// packages/boulder-state/src/storage/path.ts
|
|
88116
88275
|
import { existsSync as existsSync57 } from "fs";
|
|
88117
|
-
import { isAbsolute as isAbsolute12, join as join67, relative as relative11, resolve as
|
|
88276
|
+
import { isAbsolute as isAbsolute12, join as join67, relative as relative11, resolve as resolve16 } from "path";
|
|
88118
88277
|
function getBoulderFilePath(directory) {
|
|
88119
88278
|
return join67(directory, BOULDER_DIR, BOULDER_FILE);
|
|
88120
88279
|
}
|
|
88121
88280
|
function resolveTrackedPath(baseDirectory, trackedPath) {
|
|
88122
|
-
return isAbsolute12(trackedPath) ?
|
|
88281
|
+
return isAbsolute12(trackedPath) ? resolve16(trackedPath) : resolve16(baseDirectory, trackedPath);
|
|
88123
88282
|
}
|
|
88124
88283
|
function resolveBoulderPlanPath(directory, state3) {
|
|
88125
88284
|
const absolutePlanPath = resolveTrackedPath(directory, state3.active_plan);
|
|
@@ -88127,13 +88286,13 @@ function resolveBoulderPlanPath(directory, state3) {
|
|
|
88127
88286
|
if (!worktreePath) {
|
|
88128
88287
|
return absolutePlanPath;
|
|
88129
88288
|
}
|
|
88130
|
-
const absoluteDirectory =
|
|
88289
|
+
const absoluteDirectory = resolve16(directory);
|
|
88131
88290
|
const relativePlanPath = relative11(absoluteDirectory, absolutePlanPath);
|
|
88132
88291
|
if (relativePlanPath.length === 0 || relativePlanPath.startsWith("..") || isAbsolute12(relativePlanPath)) {
|
|
88133
88292
|
return absolutePlanPath;
|
|
88134
88293
|
}
|
|
88135
88294
|
const absoluteWorktreePath = resolveTrackedPath(directory, worktreePath);
|
|
88136
|
-
const worktreePlanPath =
|
|
88295
|
+
const worktreePlanPath = resolve16(absoluteWorktreePath, relativePlanPath);
|
|
88137
88296
|
return existsSync57(worktreePlanPath) ? worktreePlanPath : absolutePlanPath;
|
|
88138
88297
|
}
|
|
88139
88298
|
function resolveBoulderPlanPathForWork(directory, work) {
|
|
@@ -89001,7 +89160,7 @@ function createSessionRuleScanCacheStore() {
|
|
|
89001
89160
|
}
|
|
89002
89161
|
|
|
89003
89162
|
// packages/omo-opencode/src/hooks/rules-injector/injection-processor.ts
|
|
89004
|
-
import { homedir as
|
|
89163
|
+
import { homedir as homedir17 } from "os";
|
|
89005
89164
|
// packages/omo-opencode/src/hooks/rules-injector/rule-file-finder.ts
|
|
89006
89165
|
init_logger2();
|
|
89007
89166
|
setSisyphusRuleDeprecationLogger(log2);
|
|
@@ -89107,13 +89266,13 @@ function setParsedRuleCacheEntry(realPath, entry) {
|
|
|
89107
89266
|
}
|
|
89108
89267
|
|
|
89109
89268
|
// packages/omo-opencode/src/hooks/rules-injector/path-resolution.ts
|
|
89110
|
-
import { resolve as
|
|
89269
|
+
import { resolve as resolve17 } from "path";
|
|
89111
89270
|
function resolveFilePath4(workspaceDirectory, path8) {
|
|
89112
89271
|
if (!path8)
|
|
89113
89272
|
return null;
|
|
89114
89273
|
if (path8.startsWith("/"))
|
|
89115
89274
|
return path8;
|
|
89116
|
-
return
|
|
89275
|
+
return resolve17(workspaceDirectory, path8);
|
|
89117
89276
|
}
|
|
89118
89277
|
|
|
89119
89278
|
// packages/omo-opencode/src/hooks/rules-injector/rule-match-reason.ts
|
|
@@ -89147,7 +89306,7 @@ function createRuleInjectionProcessor(deps) {
|
|
|
89147
89306
|
getSessionCache: getSessionCache3,
|
|
89148
89307
|
getSessionRuleScanCache,
|
|
89149
89308
|
ruleFinderOptions,
|
|
89150
|
-
homedir: getHomeDir =
|
|
89309
|
+
homedir: getHomeDir = homedir17,
|
|
89151
89310
|
shouldApplyRule: shouldApplyRuleImpl = shouldApplyRule,
|
|
89152
89311
|
isDuplicateByRealPath: isDuplicateByRealPathImpl = isDuplicateByRealPath,
|
|
89153
89312
|
createContentHash: createContentHashImpl = createContentHash,
|
|
@@ -89434,7 +89593,7 @@ import { fileURLToPath as fileURLToPath2 } from "url";
|
|
|
89434
89593
|
|
|
89435
89594
|
// packages/omo-opencode/src/hooks/auto-update-checker/constants.ts
|
|
89436
89595
|
import * as path8 from "path";
|
|
89437
|
-
import * as
|
|
89596
|
+
import * as os4 from "os";
|
|
89438
89597
|
init_plugin_identity();
|
|
89439
89598
|
var PACKAGE_NAME = PUBLISHED_PACKAGE_NAME;
|
|
89440
89599
|
var ACCEPTED_PACKAGE_NAMES2 = ACCEPTED_PACKAGE_NAMES;
|
|
@@ -89443,10 +89602,10 @@ var NPM_FETCH_TIMEOUT = 5000;
|
|
|
89443
89602
|
var CACHE_ROOT_DIR = getOpenCodeCacheDir();
|
|
89444
89603
|
var CACHE_DIR = path8.join(CACHE_ROOT_DIR, "packages");
|
|
89445
89604
|
var VERSION_FILE = path8.join(CACHE_ROOT_DIR, "version");
|
|
89446
|
-
function
|
|
89605
|
+
function getWindowsAppdataDir() {
|
|
89447
89606
|
if (process.platform !== "win32")
|
|
89448
89607
|
return null;
|
|
89449
|
-
return process.env.APPDATA ?? path8.join(
|
|
89608
|
+
return process.env.APPDATA ?? path8.join(os4.homedir(), "AppData", "Roaming");
|
|
89450
89609
|
}
|
|
89451
89610
|
function getUserConfigDir() {
|
|
89452
89611
|
return getOpenCodeConfigDir({ binary: "opencode" });
|
|
@@ -89461,7 +89620,7 @@ var INSTALLED_PACKAGE_JSON = path8.join(CACHE_DIR, "node_modules", PACKAGE_NAME,
|
|
|
89461
89620
|
var INSTALLED_PACKAGE_JSON_CANDIDATES = ACCEPTED_PACKAGE_NAMES2.map((name) => path8.join(CACHE_DIR, "node_modules", name, "package.json"));
|
|
89462
89621
|
|
|
89463
89622
|
// packages/omo-opencode/src/hooks/auto-update-checker/checker/config-paths.ts
|
|
89464
|
-
import * as
|
|
89623
|
+
import * as os5 from "os";
|
|
89465
89624
|
import * as path9 from "path";
|
|
89466
89625
|
function getConfigPaths2(directory) {
|
|
89467
89626
|
const userConfigDir = getUserConfigDir();
|
|
@@ -89472,8 +89631,8 @@ function getConfigPaths2(directory) {
|
|
|
89472
89631
|
getUserOpencodeConfigJsonc()
|
|
89473
89632
|
];
|
|
89474
89633
|
if (process.platform === "win32") {
|
|
89475
|
-
const crossPlatformDir = path9.join(
|
|
89476
|
-
const appdataDir =
|
|
89634
|
+
const crossPlatformDir = path9.join(os5.homedir(), ".config");
|
|
89635
|
+
const appdataDir = getWindowsAppdataDir();
|
|
89477
89636
|
if (appdataDir) {
|
|
89478
89637
|
const alternateDir = userConfigDir === crossPlatformDir ? appdataDir : crossPlatformDir;
|
|
89479
89638
|
const alternateConfig = path9.join(alternateDir, "opencode", "opencode.json");
|
|
@@ -89673,7 +89832,7 @@ function getCachedVersion(options = {}) {
|
|
|
89673
89832
|
// package.json
|
|
89674
89833
|
var package_default = {
|
|
89675
89834
|
name: "oh-my-opencode",
|
|
89676
|
-
version: "4.18.
|
|
89835
|
+
version: "4.18.2",
|
|
89677
89836
|
description: "The Best AI Agent Harness - Batteries-Included OpenCode Plugin with Multi-Model Orchestration, Parallel Background Agents, and Crafted LSP/AST Tools",
|
|
89678
89837
|
main: "./dist/index.js",
|
|
89679
89838
|
types: "dist/index.d.ts",
|
|
@@ -89885,18 +90044,18 @@ var package_default = {
|
|
|
89885
90044
|
typescript: "^6.0.3"
|
|
89886
90045
|
},
|
|
89887
90046
|
optionalDependencies: {
|
|
89888
|
-
"oh-my-opencode-darwin-arm64": "4.18.
|
|
89889
|
-
"oh-my-opencode-darwin-x64": "4.18.
|
|
89890
|
-
"oh-my-opencode-darwin-x64-baseline": "4.18.
|
|
89891
|
-
"oh-my-opencode-linux-arm64": "4.18.
|
|
89892
|
-
"oh-my-opencode-linux-arm64-musl": "4.18.
|
|
89893
|
-
"oh-my-opencode-linux-x64": "4.18.
|
|
89894
|
-
"oh-my-opencode-linux-x64-baseline": "4.18.
|
|
89895
|
-
"oh-my-opencode-linux-x64-musl": "4.18.
|
|
89896
|
-
"oh-my-opencode-linux-x64-musl-baseline": "4.18.
|
|
89897
|
-
"oh-my-opencode-windows-arm64": "4.18.
|
|
89898
|
-
"oh-my-opencode-windows-x64": "4.18.
|
|
89899
|
-
"oh-my-opencode-windows-x64-baseline": "4.18.
|
|
90047
|
+
"oh-my-opencode-darwin-arm64": "4.18.2",
|
|
90048
|
+
"oh-my-opencode-darwin-x64": "4.18.2",
|
|
90049
|
+
"oh-my-opencode-darwin-x64-baseline": "4.18.2",
|
|
90050
|
+
"oh-my-opencode-linux-arm64": "4.18.2",
|
|
90051
|
+
"oh-my-opencode-linux-arm64-musl": "4.18.2",
|
|
90052
|
+
"oh-my-opencode-linux-x64": "4.18.2",
|
|
90053
|
+
"oh-my-opencode-linux-x64-baseline": "4.18.2",
|
|
90054
|
+
"oh-my-opencode-linux-x64-musl": "4.18.2",
|
|
90055
|
+
"oh-my-opencode-linux-x64-musl-baseline": "4.18.2",
|
|
90056
|
+
"oh-my-opencode-windows-arm64": "4.18.2",
|
|
90057
|
+
"oh-my-opencode-windows-x64": "4.18.2",
|
|
90058
|
+
"oh-my-opencode-windows-x64-baseline": "4.18.2"
|
|
89900
90059
|
},
|
|
89901
90060
|
overrides: {
|
|
89902
90061
|
"@earendil-works/pi-agent-core": "0.80.3",
|
|
@@ -90193,8 +90352,8 @@ function toReadableStream2(stream) {
|
|
|
90193
90352
|
function wrapNodeProcess2(proc) {
|
|
90194
90353
|
let resolveExited;
|
|
90195
90354
|
let exitCode = null;
|
|
90196
|
-
const exited = new Promise((
|
|
90197
|
-
resolveExited =
|
|
90355
|
+
const exited = new Promise((resolve18, reject) => {
|
|
90356
|
+
resolveExited = resolve18;
|
|
90198
90357
|
proc.on("error", (error) => {
|
|
90199
90358
|
if (exitCode === null) {
|
|
90200
90359
|
exitCode = 1;
|
|
@@ -90293,8 +90452,8 @@ async function runBunInstallWithDetails(options) {
|
|
|
90293
90452
|
});
|
|
90294
90453
|
const outputPromise = Promise.all([readProcessOutput(proc.stdout), readProcessOutput(proc.stderr)]).then(([stdout, stderr]) => ({ stdout, stderr }));
|
|
90295
90454
|
let timeoutId;
|
|
90296
|
-
const timeoutPromise = new Promise((
|
|
90297
|
-
timeoutId = setTimeout(() =>
|
|
90455
|
+
const timeoutPromise = new Promise((resolve18) => {
|
|
90456
|
+
timeoutId = setTimeout(() => resolve18("timeout"), BUN_INSTALL_TIMEOUT_MS);
|
|
90298
90457
|
});
|
|
90299
90458
|
const exitPromise = proc.exited.then(() => "completed");
|
|
90300
90459
|
const result = await Promise.race([exitPromise, timeoutPromise]);
|
|
@@ -90788,7 +90947,7 @@ async function showSpinnerToast(ctx, version, message) {
|
|
|
90788
90947
|
duration: frameInterval + 50
|
|
90789
90948
|
}
|
|
90790
90949
|
}).catch(ignoreToastError);
|
|
90791
|
-
await new Promise((
|
|
90950
|
+
await new Promise((resolve18) => setTimeout(resolve18, frameInterval));
|
|
90792
90951
|
}
|
|
90793
90952
|
}
|
|
90794
90953
|
|
|
@@ -90888,7 +91047,7 @@ v${latestVersion} available. Restart OpenCode to apply.` : "OpenCode is now on S
|
|
|
90888
91047
|
// packages/omo-opencode/src/hooks/codegraph-bootstrap/hook.ts
|
|
90889
91048
|
init_src();
|
|
90890
91049
|
import { existsSync as existsSync71 } from "fs";
|
|
90891
|
-
import { homedir as
|
|
91050
|
+
import { homedir as homedir20 } from "os";
|
|
90892
91051
|
import { join as join80 } from "path";
|
|
90893
91052
|
|
|
90894
91053
|
// packages/omo-opencode/src/hooks/codegraph-bootstrap/command-runner.ts
|
|
@@ -90911,7 +91070,7 @@ function resolveExitCode(error) {
|
|
|
90911
91070
|
async function runCodegraphCommand(projectRoot, command, args, options) {
|
|
90912
91071
|
const { execFile: execFile3 } = await import("child_process");
|
|
90913
91072
|
const invocation = resolveCodegraphCommandInvocation(command, args);
|
|
90914
|
-
return new Promise((
|
|
91073
|
+
return new Promise((resolve18) => {
|
|
90915
91074
|
execFile3(invocation.command, [...invocation.args], {
|
|
90916
91075
|
cwd: projectRoot,
|
|
90917
91076
|
encoding: "utf8",
|
|
@@ -90921,10 +91080,10 @@ async function runCodegraphCommand(projectRoot, command, args, options) {
|
|
|
90921
91080
|
windowsHide: true
|
|
90922
91081
|
}, (error, stdout, stderr) => {
|
|
90923
91082
|
if (error === null) {
|
|
90924
|
-
|
|
91083
|
+
resolve18({ exitCode: 0, stderr: toOutputText(stderr), stdout: toOutputText(stdout), timedOut: false });
|
|
90925
91084
|
return;
|
|
90926
91085
|
}
|
|
90927
|
-
|
|
91086
|
+
resolve18({
|
|
90928
91087
|
exitCode: resolveExitCode(error),
|
|
90929
91088
|
stderr: toOutputText(stderr),
|
|
90930
91089
|
stdout: toOutputText(stdout),
|
|
@@ -90946,7 +91105,7 @@ function resolveCodegraphCommandInvocation(command, args, platform2 = process.pl
|
|
|
90946
91105
|
|
|
90947
91106
|
// packages/omo-opencode/src/hooks/codegraph-bootstrap/project-root.ts
|
|
90948
91107
|
init_src();
|
|
90949
|
-
import { resolve as
|
|
91108
|
+
import { resolve as resolve18 } from "path";
|
|
90950
91109
|
var PROJECT_ROOT_KEYS = ["directory", "worktree", "cwd", "projectRoot", "projectPath"];
|
|
90951
91110
|
function readStringField(record, key) {
|
|
90952
91111
|
const value = record[key];
|
|
@@ -90979,8 +91138,8 @@ function readRecordRoot(record) {
|
|
|
90979
91138
|
}
|
|
90980
91139
|
function resolveCodegraphProjectRoot(properties, fallbackDirectory) {
|
|
90981
91140
|
if (!isRecord(properties))
|
|
90982
|
-
return
|
|
90983
|
-
return
|
|
91141
|
+
return resolve18(fallbackDirectory);
|
|
91142
|
+
return resolve18(readRecordRoot(properties) ?? fallbackDirectory);
|
|
90984
91143
|
}
|
|
90985
91144
|
|
|
90986
91145
|
// packages/omo-opencode/src/hooks/codegraph-bootstrap/status.ts
|
|
@@ -91042,7 +91201,7 @@ function defaultSchedule(task) {
|
|
|
91042
91201
|
timer.unref?.();
|
|
91043
91202
|
}
|
|
91044
91203
|
function defaultInstallDir2() {
|
|
91045
|
-
return join80(
|
|
91204
|
+
return join80(homedir20(), ".omo", "codegraph");
|
|
91046
91205
|
}
|
|
91047
91206
|
function provisionedBinFromInstallDir(installDir) {
|
|
91048
91207
|
if (installDir === undefined)
|
|
@@ -91181,7 +91340,7 @@ function createCodegraphBootstrapHook(ctx, config, depsOverride = {}) {
|
|
|
91181
91340
|
}
|
|
91182
91341
|
// packages/omo-opencode/src/hooks/ast-grep-sg-provision/hook.ts
|
|
91183
91342
|
init_src();
|
|
91184
|
-
import { homedir as
|
|
91343
|
+
import { homedir as homedir21 } from "os";
|
|
91185
91344
|
import { join as join81 } from "path";
|
|
91186
91345
|
var provisionedTargets = new Set;
|
|
91187
91346
|
function defaultSchedule2(task) {
|
|
@@ -91201,7 +91360,7 @@ async function runProvision(targetDir, deps) {
|
|
|
91201
91360
|
}
|
|
91202
91361
|
var defaultDeps5 = {
|
|
91203
91362
|
findSgBinary: findSgBinarySync,
|
|
91204
|
-
homeDir:
|
|
91363
|
+
homeDir: homedir21,
|
|
91205
91364
|
log: log2,
|
|
91206
91365
|
provisionSgBinary,
|
|
91207
91366
|
schedule: defaultSchedule2
|
|
@@ -97113,6 +97272,27 @@ var DELEGATION_TOOLS = new Set([
|
|
|
97113
97272
|
"task",
|
|
97114
97273
|
"call_omo_agent"
|
|
97115
97274
|
]);
|
|
97275
|
+
function findLatestReminderTarget(messages, sessionStates) {
|
|
97276
|
+
for (let messageIndex = messages.length - 1;messageIndex >= 0; messageIndex -= 1) {
|
|
97277
|
+
const message = messages[messageIndex];
|
|
97278
|
+
if (message?.info.role !== "user")
|
|
97279
|
+
continue;
|
|
97280
|
+
const sessionID = message.info.sessionID;
|
|
97281
|
+
const messageID = message.info.id;
|
|
97282
|
+
if (typeof sessionID !== "string" || typeof messageID !== "string")
|
|
97283
|
+
continue;
|
|
97284
|
+
const state3 = sessionStates.get(sessionID);
|
|
97285
|
+
if (!state3?.reminderPending || state3.reminderShown || state3.delegationUsed)
|
|
97286
|
+
continue;
|
|
97287
|
+
for (let partIndex = message.parts.length - 1;partIndex >= 0; partIndex -= 1) {
|
|
97288
|
+
const part = message.parts[partIndex];
|
|
97289
|
+
if (part && isRealUserTextPart(part)) {
|
|
97290
|
+
return { message, messageID, sessionID, state: state3, textPartIndex: partIndex };
|
|
97291
|
+
}
|
|
97292
|
+
}
|
|
97293
|
+
}
|
|
97294
|
+
return;
|
|
97295
|
+
}
|
|
97116
97296
|
function createCategorySkillReminderHook(_ctx, availableSkills = []) {
|
|
97117
97297
|
const sessionStates = new Map;
|
|
97118
97298
|
const reminderMessage = buildReminderMessage(availableSkills);
|
|
@@ -97120,6 +97300,7 @@ function createCategorySkillReminderHook(_ctx, availableSkills = []) {
|
|
|
97120
97300
|
if (!sessionStates.has(sessionID)) {
|
|
97121
97301
|
sessionStates.set(sessionID, {
|
|
97122
97302
|
delegationUsed: false,
|
|
97303
|
+
reminderPending: false,
|
|
97123
97304
|
reminderShown: false,
|
|
97124
97305
|
toolCallCount: 0
|
|
97125
97306
|
});
|
|
@@ -97133,7 +97314,7 @@ function createCategorySkillReminderHook(_ctx, availableSkills = []) {
|
|
|
97133
97314
|
const agentKey = getAgentConfigKey(agent);
|
|
97134
97315
|
return TARGET_AGENTS.has(agentKey) || agentKey.includes("sisyphus") || agentKey.includes("atlas");
|
|
97135
97316
|
}
|
|
97136
|
-
const toolExecuteAfter = async (input,
|
|
97317
|
+
const toolExecuteAfter = async (input, _output) => {
|
|
97137
97318
|
const { tool, sessionID } = input;
|
|
97138
97319
|
const toolLower = tool.toLowerCase();
|
|
97139
97320
|
if (!isTargetAgent(sessionID, input.agent)) {
|
|
@@ -97142,6 +97323,7 @@ function createCategorySkillReminderHook(_ctx, availableSkills = []) {
|
|
|
97142
97323
|
const state3 = getOrCreateState2(sessionID);
|
|
97143
97324
|
if (DELEGATION_TOOLS.has(toolLower)) {
|
|
97144
97325
|
state3.delegationUsed = true;
|
|
97326
|
+
state3.reminderPending = false;
|
|
97145
97327
|
log2("[category-skill-reminder] Delegation tool used", { sessionID, tool });
|
|
97146
97328
|
return;
|
|
97147
97329
|
}
|
|
@@ -97149,15 +97331,32 @@ function createCategorySkillReminderHook(_ctx, availableSkills = []) {
|
|
|
97149
97331
|
return;
|
|
97150
97332
|
}
|
|
97151
97333
|
state3.toolCallCount++;
|
|
97152
|
-
if (state3.toolCallCount >= 3 && !state3.delegationUsed && !state3.reminderShown) {
|
|
97153
|
-
|
|
97154
|
-
|
|
97155
|
-
log2("[category-skill-reminder] Reminder injected", {
|
|
97334
|
+
if (state3.toolCallCount >= 3 && !state3.delegationUsed && !state3.reminderPending && !state3.reminderShown) {
|
|
97335
|
+
state3.reminderPending = true;
|
|
97336
|
+
log2("[category-skill-reminder] Reminder queued", {
|
|
97156
97337
|
sessionID,
|
|
97157
97338
|
toolCallCount: state3.toolCallCount
|
|
97158
97339
|
});
|
|
97159
97340
|
}
|
|
97160
97341
|
};
|
|
97342
|
+
const messagesTransform = async (_input, output) => {
|
|
97343
|
+
const target = findLatestReminderTarget(output.messages, sessionStates);
|
|
97344
|
+
if (!target)
|
|
97345
|
+
return;
|
|
97346
|
+
target.message.parts.splice(target.textPartIndex, 0, {
|
|
97347
|
+
id: `prt_category_skill_reminder_${target.messageID}`,
|
|
97348
|
+
sessionID: target.sessionID,
|
|
97349
|
+
messageID: target.messageID,
|
|
97350
|
+
type: "text",
|
|
97351
|
+
text: reminderMessage,
|
|
97352
|
+
synthetic: true
|
|
97353
|
+
});
|
|
97354
|
+
target.state.reminderPending = false;
|
|
97355
|
+
target.state.reminderShown = true;
|
|
97356
|
+
log2("[category-skill-reminder] Reminder injected", {
|
|
97357
|
+
sessionID: target.sessionID
|
|
97358
|
+
});
|
|
97359
|
+
};
|
|
97161
97360
|
const eventHandler = async ({ event }) => {
|
|
97162
97361
|
const props = event.properties;
|
|
97163
97362
|
if (event.type === "session.deleted") {
|
|
@@ -97169,6 +97368,7 @@ function createCategorySkillReminderHook(_ctx, availableSkills = []) {
|
|
|
97169
97368
|
};
|
|
97170
97369
|
return {
|
|
97171
97370
|
"tool.execute.after": toolExecuteAfter,
|
|
97371
|
+
"experimental.chat.messages.transform": messagesTransform,
|
|
97172
97372
|
event: eventHandler
|
|
97173
97373
|
};
|
|
97174
97374
|
}
|
|
@@ -97375,7 +97575,7 @@ async function withTimeout(promise, timeoutMs) {
|
|
|
97375
97575
|
var USER_MESSAGE_IN_PROGRESS_WINDOW_MS = 2000;
|
|
97376
97576
|
var RAPID_IDLE_DEDUP_MS = 500;
|
|
97377
97577
|
function sleep2(ms) {
|
|
97378
|
-
return ms > 0 ? new Promise((
|
|
97578
|
+
return ms > 0 ? new Promise((resolve19) => setTimeout(resolve19, ms)) : Promise.resolve();
|
|
97379
97579
|
}
|
|
97380
97580
|
function hasActiveBackgroundTasks(backgroundManager, sessionID) {
|
|
97381
97581
|
return backgroundManager ? backgroundManager.getTasksByParentSession(sessionID).some((task) => task.status === "pending" || task.status === "running") : false;
|
|
@@ -99415,8 +99615,8 @@ import { basename as basename14, dirname as dirname26, join as join89 } from "pa
|
|
|
99415
99615
|
|
|
99416
99616
|
// packages/skills-loader-core/src/shared/opencode-config-dir.ts
|
|
99417
99617
|
import { existsSync as existsSync76, realpathSync as realpathSync12 } from "fs";
|
|
99418
|
-
import { homedir as
|
|
99419
|
-
import { join as join88, posix as posix4, resolve as
|
|
99618
|
+
import { homedir as homedir23 } from "os";
|
|
99619
|
+
import { join as join88, posix as posix4, resolve as resolve19, win32 as win325 } from "path";
|
|
99420
99620
|
|
|
99421
99621
|
// packages/skills-loader-core/src/shared/plugin-identity.ts
|
|
99422
99622
|
init_src();
|
|
@@ -99449,14 +99649,14 @@ function getTauriConfigDir2(identifier) {
|
|
|
99449
99649
|
const platform2 = process.platform;
|
|
99450
99650
|
switch (platform2) {
|
|
99451
99651
|
case "darwin":
|
|
99452
|
-
return join88(
|
|
99652
|
+
return join88(homedir23(), "Library", "Application Support", identifier);
|
|
99453
99653
|
case "win32": {
|
|
99454
|
-
const appData = process.env.APPDATA || join88(
|
|
99654
|
+
const appData = process.env.APPDATA || join88(homedir23(), "AppData", "Roaming");
|
|
99455
99655
|
return win325.join(appData, identifier);
|
|
99456
99656
|
}
|
|
99457
99657
|
case "linux":
|
|
99458
99658
|
default: {
|
|
99459
|
-
const xdgConfig = process.env.XDG_CONFIG_HOME || join88(
|
|
99659
|
+
const xdgConfig = process.env.XDG_CONFIG_HOME || join88(homedir23(), ".config");
|
|
99460
99660
|
return join88(xdgConfig, identifier);
|
|
99461
99661
|
}
|
|
99462
99662
|
}
|
|
@@ -99465,7 +99665,7 @@ function resolveConfigPath2(pathValue) {
|
|
|
99465
99665
|
if (isWslEnvironment2() && pathValue.startsWith("/")) {
|
|
99466
99666
|
return posix4.normalize(pathValue);
|
|
99467
99667
|
}
|
|
99468
|
-
const resolvedPath =
|
|
99668
|
+
const resolvedPath = resolve19(pathValue);
|
|
99469
99669
|
if (!existsSync76(resolvedPath))
|
|
99470
99670
|
return resolvedPath;
|
|
99471
99671
|
try {
|
|
@@ -99500,7 +99700,7 @@ function getWslLinuxHomeDir2(windowsConfigRoot) {
|
|
|
99500
99700
|
function getCliDefaultConfigDir2() {
|
|
99501
99701
|
const envXdgConfig = process.env.XDG_CONFIG_HOME?.trim();
|
|
99502
99702
|
const shouldIgnoreWindowsXdg = envXdgConfig !== undefined && envXdgConfig.length > 0 && isWslEnvironment2() && isWindowsUserConfigRoot2(envXdgConfig);
|
|
99503
|
-
const xdgConfig = shouldIgnoreWindowsXdg ? posix4.join(getWslLinuxHomeDir2(envXdgConfig) ?? "/home", ".config") : envXdgConfig || join88(
|
|
99703
|
+
const xdgConfig = shouldIgnoreWindowsXdg ? posix4.join(getWslLinuxHomeDir2(envXdgConfig) ?? "/home", ".config") : envXdgConfig || join88(homedir23(), ".config");
|
|
99504
99704
|
const configDir = isWslEnvironment2() ? posix4.join(xdgConfig, "opencode") : join88(xdgConfig, "opencode");
|
|
99505
99705
|
return resolveConfigPath2(configDir);
|
|
99506
99706
|
}
|
|
@@ -99567,10 +99767,10 @@ function getOpenCodeSkillDirs(options) {
|
|
|
99567
99767
|
// packages/skills-loader-core/src/shared/project-discovery-dirs.ts
|
|
99568
99768
|
import { execFileSync as execFileSync4 } from "child_process";
|
|
99569
99769
|
import { existsSync as existsSync77, realpathSync as realpathSync13 } from "fs";
|
|
99570
|
-
import { dirname as dirname27, join as join90, resolve as
|
|
99770
|
+
import { dirname as dirname27, join as join90, resolve as resolve20, win32 as win326 } from "path";
|
|
99571
99771
|
var worktreePathCache2 = new Map;
|
|
99572
99772
|
function normalizePath4(path17) {
|
|
99573
|
-
const resolvedPath = process.platform !== "win32" && win326.isAbsolute(path17) ? path17 :
|
|
99773
|
+
const resolvedPath = process.platform !== "win32" && win326.isAbsolute(path17) ? path17 : resolve20(path17);
|
|
99574
99774
|
if (!existsSync77(resolvedPath)) {
|
|
99575
99775
|
return resolvedPath;
|
|
99576
99776
|
}
|
|
@@ -99625,7 +99825,7 @@ function findAncestorDirectories2(startDirectory, targetPaths, stopDirectory) {
|
|
|
99625
99825
|
}
|
|
99626
99826
|
}
|
|
99627
99827
|
function detectWorktreePath2(directory) {
|
|
99628
|
-
const resolvedDirectory =
|
|
99828
|
+
const resolvedDirectory = resolve20(directory);
|
|
99629
99829
|
const cacheKey = pathKey2(normalizePath4(resolvedDirectory));
|
|
99630
99830
|
if (worktreePathCache2.has(cacheKey)) {
|
|
99631
99831
|
return worktreePathCache2.get(cacheKey);
|
|
@@ -100157,21 +100357,21 @@ function builtinToLoadedSkill(builtin) {
|
|
|
100157
100357
|
// packages/skills-loader-core/src/features/opencode-skill-loader/merger/config-skill-entry-loader.ts
|
|
100158
100358
|
init_src();
|
|
100159
100359
|
import { existsSync as existsSync79, readFileSync as readFileSync50 } from "fs";
|
|
100160
|
-
import { dirname as dirname28, isAbsolute as isAbsolute13, resolve as
|
|
100161
|
-
import { homedir as
|
|
100360
|
+
import { dirname as dirname28, isAbsolute as isAbsolute13, resolve as resolve21 } from "path";
|
|
100361
|
+
import { homedir as homedir24 } from "os";
|
|
100162
100362
|
function resolveFilePath5(from, configDir) {
|
|
100163
100363
|
let filePath = from;
|
|
100164
100364
|
if (filePath.startsWith("{file:") && filePath.endsWith("}")) {
|
|
100165
100365
|
filePath = filePath.slice(6, -1);
|
|
100166
100366
|
}
|
|
100167
100367
|
if (filePath.startsWith("~/")) {
|
|
100168
|
-
return
|
|
100368
|
+
return resolve21(homedir24(), filePath.slice(2));
|
|
100169
100369
|
}
|
|
100170
100370
|
if (isAbsolute13(filePath)) {
|
|
100171
100371
|
return filePath;
|
|
100172
100372
|
}
|
|
100173
100373
|
const baseDir = configDir || process.cwd();
|
|
100174
|
-
return
|
|
100374
|
+
return resolve21(baseDir, filePath);
|
|
100175
100375
|
}
|
|
100176
100376
|
function loadSkillFromFile(filePath) {
|
|
100177
100377
|
try {
|
|
@@ -103409,7 +103609,7 @@ function isDisabledSkillName(name, disabledSkills) {
|
|
|
103409
103609
|
init_src();
|
|
103410
103610
|
var import_picomatch2 = __toESM(require_picomatch2(), 1);
|
|
103411
103611
|
import * as fs20 from "fs/promises";
|
|
103412
|
-
import { homedir as
|
|
103612
|
+
import { homedir as homedir25 } from "os";
|
|
103413
103613
|
import { dirname as dirname30, extname as extname2, isAbsolute as isAbsolute14, join as join97, relative as relative12 } from "path";
|
|
103414
103614
|
var MAX_RECURSIVE_DEPTH = 10;
|
|
103415
103615
|
function isHttpUrl(path17) {
|
|
@@ -103417,10 +103617,10 @@ function isHttpUrl(path17) {
|
|
|
103417
103617
|
}
|
|
103418
103618
|
function toAbsolutePath(path17, configDir) {
|
|
103419
103619
|
if (path17 === "~") {
|
|
103420
|
-
return
|
|
103620
|
+
return homedir25();
|
|
103421
103621
|
}
|
|
103422
103622
|
if (path17.startsWith("~/")) {
|
|
103423
|
-
return join97(
|
|
103623
|
+
return join97(homedir25(), path17.slice(2));
|
|
103424
103624
|
}
|
|
103425
103625
|
if (isAbsolute14(path17)) {
|
|
103426
103626
|
return path17;
|
|
@@ -103508,12 +103708,14 @@ init_src();
|
|
|
103508
103708
|
import * as fs21 from "fs";
|
|
103509
103709
|
import * as path17 from "path";
|
|
103510
103710
|
function getConfigPaths3(directory) {
|
|
103511
|
-
const
|
|
103711
|
+
const globalConfigDirs = getOpenCodeConfigDirs2({ binary: "opencode" });
|
|
103512
103712
|
return [
|
|
103513
103713
|
path17.join(directory, ".opencode", "opencode.json"),
|
|
103514
103714
|
path17.join(directory, ".opencode", "opencode.jsonc"),
|
|
103515
|
-
|
|
103516
|
-
|
|
103715
|
+
...globalConfigDirs.flatMap((dir) => [
|
|
103716
|
+
path17.join(dir, "opencode.json"),
|
|
103717
|
+
path17.join(dir, "opencode.jsonc")
|
|
103718
|
+
])
|
|
103517
103719
|
];
|
|
103518
103720
|
}
|
|
103519
103721
|
function toStringArray(value) {
|
|
@@ -105720,9 +105922,9 @@ function isPrometheusAgent(agentName) {
|
|
|
105720
105922
|
}
|
|
105721
105923
|
|
|
105722
105924
|
// packages/omo-opencode/src/hooks/prometheus-md-only/path-policy.ts
|
|
105723
|
-
import { relative as relative13, resolve as
|
|
105925
|
+
import { relative as relative13, resolve as resolve22, isAbsolute as isAbsolute15 } from "path";
|
|
105724
105926
|
function isAllowedFile(filePath, workspaceRoot) {
|
|
105725
|
-
const resolved =
|
|
105927
|
+
const resolved = resolve22(workspaceRoot, filePath);
|
|
105726
105928
|
const rel = relative13(workspaceRoot, resolved);
|
|
105727
105929
|
if (rel.startsWith("..") || isAbsolute15(rel)) {
|
|
105728
105930
|
return false;
|
|
@@ -105873,9 +106075,9 @@ init_logger2();
|
|
|
105873
106075
|
// packages/omo-opencode/src/hooks/start-work/worktree-detector.ts
|
|
105874
106076
|
import { execFileSync as execFileSync5 } from "child_process";
|
|
105875
106077
|
import { existsSync as existsSync82, realpathSync as realpathSync14 } from "fs";
|
|
105876
|
-
import { resolve as
|
|
106078
|
+
import { resolve as resolve23, win32 as win327 } from "path";
|
|
105877
106079
|
function normalizePath5(path18) {
|
|
105878
|
-
const resolvedPath = process.platform !== "win32" && win327.isAbsolute(path18) ? path18 :
|
|
106080
|
+
const resolvedPath = process.platform !== "win32" && win327.isAbsolute(path18) ? path18 : resolve23(path18);
|
|
105879
106081
|
if (!existsSync82(resolvedPath)) {
|
|
105880
106082
|
return resolvedPath;
|
|
105881
106083
|
}
|
|
@@ -107766,7 +107968,7 @@ async function validateSubagentSessionId(input) {
|
|
|
107766
107968
|
}
|
|
107767
107969
|
|
|
107768
107970
|
// packages/omo-opencode/src/hooks/atlas/tool-execute-after-direct-work.ts
|
|
107769
|
-
import { resolve as
|
|
107971
|
+
import { resolve as resolve24 } from "path";
|
|
107770
107972
|
init_logger2();
|
|
107771
107973
|
|
|
107772
107974
|
// packages/omo-opencode/src/hooks/atlas/omo-path.ts
|
|
@@ -107876,7 +108078,7 @@ async function handleDirectWorkToolAfter(input) {
|
|
|
107876
108078
|
const sessionWork = getWorkForSession(ctx.directory, toolInput.sessionID);
|
|
107877
108079
|
if (sessionWork) {
|
|
107878
108080
|
const planPath = resolveBoulderPlanPathForWork(ctx.directory, sessionWork);
|
|
107879
|
-
if (
|
|
108081
|
+
if (resolve24(filePath) === resolve24(planPath) && planSnapshot !== undefined) {
|
|
107880
108082
|
const beforeCheckedKeys = parseCheckedTopLevelTaskKeys(planSnapshot);
|
|
107881
108083
|
const afterCheckedKeys = readCheckedTaskKeysFromPlan(planPath);
|
|
107882
108084
|
for (const taskKey of afterCheckedKeys) {
|
|
@@ -108625,7 +108827,7 @@ function createToolExecuteAfterHandler2(input) {
|
|
|
108625
108827
|
// packages/omo-opencode/src/hooks/atlas/tool-execute-before.ts
|
|
108626
108828
|
init_logger2();
|
|
108627
108829
|
import { existsSync as existsSync85, readFileSync as readFileSync58 } from "fs";
|
|
108628
|
-
import { resolve as
|
|
108830
|
+
import { resolve as resolve25 } from "path";
|
|
108629
108831
|
var TASK_SECTION_HEADER_PATTERN = /^##\s*1\.\s*TASK\s*$/i;
|
|
108630
108832
|
var TODO_TASK_LINE_PATTERN = /^(?:[-*]\s*\[\s*\]\s*)?(\d+)\.\s+(.+)$/;
|
|
108631
108833
|
var FINAL_WAVE_TASK_LINE_PATTERN = /^(?:[-*]\s*\[\s*\]\s*)?(F\d+)\.\s+(.+)$/i;
|
|
@@ -108683,7 +108885,7 @@ function createToolExecuteBeforeHandler2(input) {
|
|
|
108683
108885
|
const sessionWork = sessionID ? getWorkForSession(ctx.directory, sessionID) : null;
|
|
108684
108886
|
const state3 = sessionWork ? null : readBoulderState(ctx.directory);
|
|
108685
108887
|
const planPath = sessionWork ? resolveBoulderPlanPathForWork(ctx.directory, sessionWork) : state3 ? resolveBoulderPlanPath(ctx.directory, state3) : null;
|
|
108686
|
-
if (planPath &&
|
|
108888
|
+
if (planPath && resolve25(filePath) === resolve25(planPath) && pendingPlanSnapshots) {
|
|
108687
108889
|
try {
|
|
108688
108890
|
if (existsSync85(planPath)) {
|
|
108689
108891
|
pendingPlanSnapshots.set(toolInput.callID, readFileSync58(planPath, "utf-8"));
|
|
@@ -109055,9 +109257,10 @@ function resolveModelForDelegateTask(input, deps) {
|
|
|
109055
109257
|
}
|
|
109056
109258
|
}
|
|
109057
109259
|
} else {
|
|
109058
|
-
for (const entry of fallbackChain) {
|
|
109260
|
+
for (const [entryIndex, entry] of fallbackChain.entries()) {
|
|
109059
109261
|
for (const provider of entry.providers) {
|
|
109060
|
-
const
|
|
109262
|
+
const transformedModelId = transformModelForProvider(provider, entry.model);
|
|
109263
|
+
const fullModel = `${provider}/${transformedModelId}`;
|
|
109061
109264
|
const match = fuzzyMatchModel(fullModel, new Set(input.availableModels), [provider]);
|
|
109062
109265
|
if (match) {
|
|
109063
109266
|
if (explicitHighModel && entry.variant === "high" && match === explicitHighBaseModel) {
|
|
@@ -109066,7 +109269,12 @@ function resolveModelForDelegateTask(input, deps) {
|
|
|
109066
109269
|
return { model: match, variant: entry.variant, fallbackEntry: entry, matchedFallback: true };
|
|
109067
109270
|
}
|
|
109068
109271
|
}
|
|
109069
|
-
const
|
|
109272
|
+
const laterRungProviders = new Set(fallbackChain.slice(entryIndex + 1).filter((candidate) => candidate.model === entry.model).flatMap((candidate) => candidate.providers));
|
|
109273
|
+
const crossProviderCandidates = new Set([...input.availableModels].filter((model) => {
|
|
109274
|
+
const [provider] = model.split("/");
|
|
109275
|
+
return provider !== undefined && !laterRungProviders.has(provider);
|
|
109276
|
+
}));
|
|
109277
|
+
const crossProviderMatch = fuzzyMatchModel(entry.model, crossProviderCandidates);
|
|
109070
109278
|
if (crossProviderMatch) {
|
|
109071
109279
|
if (explicitHighModel && entry.variant === "high" && crossProviderMatch === explicitHighBaseModel) {
|
|
109072
109280
|
return { model: explicitHighModel, fallbackEntry: entry, matchedFallback: true };
|
|
@@ -111281,10 +111489,19 @@ function getRawFallbackModelsForSession(sessionID, agent, pluginConfig) {
|
|
|
111281
111489
|
}
|
|
111282
111490
|
return;
|
|
111283
111491
|
};
|
|
111492
|
+
const shouldInheritPlanFallback = pluginConfig.sisyphus_agent?.disabled !== true && pluginConfig.sisyphus_agent?.planner_enabled !== false && pluginConfig.sisyphus_agent?.replace_plan !== false;
|
|
111493
|
+
const tryGetPrometheusFallbackForPlan = (agentName) => {
|
|
111494
|
+
if (agentName.toLowerCase() !== "plan" || !shouldInheritPlanFallback)
|
|
111495
|
+
return;
|
|
111496
|
+
return tryGetFallbackFromAgent("prometheus");
|
|
111497
|
+
};
|
|
111284
111498
|
if (agent) {
|
|
111285
111499
|
const result = tryGetFallbackFromAgent(agent);
|
|
111286
111500
|
if (result)
|
|
111287
111501
|
return result;
|
|
111502
|
+
const planFallback = tryGetPrometheusFallbackForPlan(agent);
|
|
111503
|
+
if (planFallback)
|
|
111504
|
+
return planFallback;
|
|
111288
111505
|
}
|
|
111289
111506
|
const sessionAgentMatch = sessionID.match(agentPattern);
|
|
111290
111507
|
if (sessionAgentMatch) {
|
|
@@ -111292,6 +111509,9 @@ function getRawFallbackModelsForSession(sessionID, agent, pluginConfig) {
|
|
|
111292
111509
|
const result = tryGetFallbackFromAgent(detectedAgent);
|
|
111293
111510
|
if (result)
|
|
111294
111511
|
return result;
|
|
111512
|
+
const planFallback = tryGetPrometheusFallbackForPlan(detectedAgent);
|
|
111513
|
+
if (planFallback)
|
|
111514
|
+
return planFallback;
|
|
111295
111515
|
}
|
|
111296
111516
|
log2(`[${HOOK_NAME11}] No category/agent fallback models resolved for session`, { sessionID, agent });
|
|
111297
111517
|
return;
|
|
@@ -112584,7 +112804,7 @@ function createRuntimeFallbackHook(ctx, options, factoryOverrides = {}) {
|
|
|
112584
112804
|
}
|
|
112585
112805
|
// packages/omo-opencode/src/hooks/write-existing-file-guard/hook.ts
|
|
112586
112806
|
import { existsSync as existsSync87, realpathSync as realpathSync15 } from "fs";
|
|
112587
|
-
import { basename as basename17, dirname as dirname32, isAbsolute as isAbsolute16, join as join101, normalize as normalize2, relative as relative14, resolve as
|
|
112807
|
+
import { basename as basename17, dirname as dirname32, isAbsolute as isAbsolute16, join as join101, normalize as normalize2, relative as relative14, resolve as resolve26 } from "path";
|
|
112588
112808
|
|
|
112589
112809
|
// packages/omo-opencode/src/hooks/write-existing-file-guard/tool-execute-before-handler.ts
|
|
112590
112810
|
import { existsSync as existsSync86 } from "fs";
|
|
@@ -112756,7 +112976,7 @@ function getPathFromArgs(args) {
|
|
|
112756
112976
|
return args?.filePath ?? args?.path ?? args?.file_path;
|
|
112757
112977
|
}
|
|
112758
112978
|
function resolveInputPath(ctx, inputPath) {
|
|
112759
|
-
return normalize2(isAbsolute16(inputPath) ? inputPath :
|
|
112979
|
+
return normalize2(isAbsolute16(inputPath) ? inputPath : resolve26(ctx.directory, inputPath));
|
|
112760
112980
|
}
|
|
112761
112981
|
function isPathInsideDirectory(pathToCheck, directory) {
|
|
112762
112982
|
const relativePath = relative14(directory, pathToCheck);
|
|
@@ -115744,7 +115964,7 @@ function createNotepadWriteGuardHook() {
|
|
|
115744
115964
|
}
|
|
115745
115965
|
// packages/omo-opencode/src/hooks/plan-format-validator/hook.ts
|
|
115746
115966
|
import { existsSync as existsSync89, readFileSync as readFileSync60 } from "fs";
|
|
115747
|
-
import { resolve as
|
|
115967
|
+
import { resolve as resolve27 } from "path";
|
|
115748
115968
|
init_logger2();
|
|
115749
115969
|
var WRITE_TOOLS = new Set(["Write", "Edit", "write", "edit"]);
|
|
115750
115970
|
var CHECKBOX_PATTERN = /^[-*]\s*\[[ xX]\]/m;
|
|
@@ -115826,7 +116046,7 @@ function createPlanFormatValidatorHook(_ctx) {
|
|
|
115826
116046
|
return;
|
|
115827
116047
|
if (!isPlanFilePath(filePath))
|
|
115828
116048
|
return;
|
|
115829
|
-
const resolvedPath =
|
|
116049
|
+
const resolvedPath = resolve27(_ctx.directory, filePath);
|
|
115830
116050
|
if (!existsSync89(resolvedPath))
|
|
115831
116051
|
return;
|
|
115832
116052
|
const content = readFileSync60(resolvedPath, "utf-8");
|
|
@@ -115928,7 +116148,7 @@ function createMonitorStatusInjectorHook(monitorManager, config) {
|
|
|
115928
116148
|
};
|
|
115929
116149
|
}
|
|
115930
116150
|
// packages/omo-opencode/src/tools/grep/tools.ts
|
|
115931
|
-
import { resolve as
|
|
116151
|
+
import { resolve as resolve28 } from "path";
|
|
115932
116152
|
|
|
115933
116153
|
// node_modules/.bun/@opencode-ai+plugin@1.15.13+8002cb46da36e070/node_modules/@opencode-ai/plugin/dist/tool.js
|
|
115934
116154
|
import { z as z3 } from "zod";
|
|
@@ -116175,10 +116395,10 @@ class Semaphore {
|
|
|
116175
116395
|
this.running++;
|
|
116176
116396
|
return;
|
|
116177
116397
|
}
|
|
116178
|
-
return new Promise((
|
|
116398
|
+
return new Promise((resolve28) => {
|
|
116179
116399
|
this.queue.push(() => {
|
|
116180
116400
|
this.running++;
|
|
116181
|
-
|
|
116401
|
+
resolve28();
|
|
116182
116402
|
});
|
|
116183
116403
|
});
|
|
116184
116404
|
}
|
|
@@ -116493,7 +116713,7 @@ function createGrepTools(ctx) {
|
|
|
116493
116713
|
const globs = args.include ? [args.include] : undefined;
|
|
116494
116714
|
const runtimeCtx = context;
|
|
116495
116715
|
const dir = typeof runtimeCtx.directory === "string" ? runtimeCtx.directory : ctx.directory;
|
|
116496
|
-
const searchPath = args.path ?
|
|
116716
|
+
const searchPath = args.path ? resolve28(dir, args.path) : dir;
|
|
116497
116717
|
const paths = [searchPath];
|
|
116498
116718
|
const outputMode = args.output_mode ?? "files_with_matches";
|
|
116499
116719
|
const headLimit = args.head_limit ?? 0;
|
|
@@ -116524,11 +116744,11 @@ function createGrepTools(ctx) {
|
|
|
116524
116744
|
return { grep };
|
|
116525
116745
|
}
|
|
116526
116746
|
// packages/omo-opencode/src/tools/glob/tools.ts
|
|
116527
|
-
import { resolve as
|
|
116747
|
+
import { resolve as resolve30 } from "path";
|
|
116528
116748
|
|
|
116529
116749
|
// packages/omo-opencode/src/tools/glob/cli.ts
|
|
116530
116750
|
init_bun_spawn_shim();
|
|
116531
|
-
import { resolve as
|
|
116751
|
+
import { resolve as resolve29 } from "path";
|
|
116532
116752
|
|
|
116533
116753
|
// packages/omo-opencode/src/tools/glob/constants.ts
|
|
116534
116754
|
var DEFAULT_TIMEOUT_MS3 = 60000;
|
|
@@ -116656,7 +116876,7 @@ async function runRgFilesInternal(options, resolvedCli, processSpawner = spawn)
|
|
|
116656
116876
|
}
|
|
116657
116877
|
let filePath;
|
|
116658
116878
|
if (isRg) {
|
|
116659
|
-
filePath = cwd ?
|
|
116879
|
+
filePath = cwd ? resolve29(cwd, line) : line;
|
|
116660
116880
|
} else if (isWindows2) {
|
|
116661
116881
|
filePath = line.trim();
|
|
116662
116882
|
} else {
|
|
@@ -116716,7 +116936,7 @@ function createGlobTools(ctx) {
|
|
|
116716
116936
|
const cli = await resolveGrepCliWithAutoInstall();
|
|
116717
116937
|
const runtimeCtx = context;
|
|
116718
116938
|
const dir = typeof runtimeCtx.directory === "string" ? runtimeCtx.directory : ctx.directory;
|
|
116719
|
-
const searchPath = args.path ?
|
|
116939
|
+
const searchPath = args.path ? resolve30(dir, args.path) : dir;
|
|
116720
116940
|
const result = await runRgFiles({
|
|
116721
116941
|
pattern: args.pattern,
|
|
116722
116942
|
paths: [searchPath]
|
|
@@ -118592,7 +118812,7 @@ init_logger2();
|
|
|
118592
118812
|
|
|
118593
118813
|
// packages/omo-opencode/src/tools/background-task/delay.ts
|
|
118594
118814
|
function delay5(ms) {
|
|
118595
|
-
return new Promise((
|
|
118815
|
+
return new Promise((resolve31) => setTimeout(resolve31, ms));
|
|
118596
118816
|
}
|
|
118597
118817
|
// packages/omo-opencode/src/tools/background-task/create-background-output.ts
|
|
118598
118818
|
init_logger2();
|
|
@@ -119438,19 +119658,19 @@ import { existsSync as existsSync97, readdirSync as readdirSync23 } from "fs";
|
|
|
119438
119658
|
import { join as join112 } from "path";
|
|
119439
119659
|
|
|
119440
119660
|
// packages/claude-code-compat-core/src/shared/claude-config-dir.ts
|
|
119441
|
-
import { homedir as
|
|
119661
|
+
import { homedir as homedir26 } from "os";
|
|
119442
119662
|
import { join as join107 } from "path";
|
|
119443
119663
|
function getClaudeConfigDir3() {
|
|
119444
119664
|
const envConfigDir = process.env.CLAUDE_CONFIG_DIR;
|
|
119445
119665
|
if (envConfigDir) {
|
|
119446
119666
|
return envConfigDir;
|
|
119447
119667
|
}
|
|
119448
|
-
return join107(process.env.HOME || process.env.USERPROFILE ||
|
|
119668
|
+
return join107(process.env.HOME || process.env.USERPROFILE || homedir26(), ".claude");
|
|
119449
119669
|
}
|
|
119450
119670
|
// packages/claude-code-compat-core/src/shared/opencode-config-dir.ts
|
|
119451
119671
|
import { existsSync as existsSync93, realpathSync as realpathSync16 } from "fs";
|
|
119452
|
-
import { homedir as
|
|
119453
|
-
import { join as join108, posix as posix6, resolve as
|
|
119672
|
+
import { homedir as homedir27 } from "os";
|
|
119673
|
+
import { join as join108, posix as posix6, resolve as resolve31, win32 as win329 } from "path";
|
|
119454
119674
|
var TAURI_APP_IDENTIFIER3 = "ai.opencode.desktop";
|
|
119455
119675
|
var TAURI_APP_IDENTIFIER_DEV3 = "ai.opencode.desktop.dev";
|
|
119456
119676
|
function isDevBuild3(version) {
|
|
@@ -119462,14 +119682,14 @@ function getTauriConfigDir3(identifier) {
|
|
|
119462
119682
|
const platform2 = process.platform;
|
|
119463
119683
|
switch (platform2) {
|
|
119464
119684
|
case "darwin":
|
|
119465
|
-
return join108(
|
|
119685
|
+
return join108(homedir27(), "Library", "Application Support", identifier);
|
|
119466
119686
|
case "win32": {
|
|
119467
|
-
const appData = process.env.APPDATA || join108(
|
|
119687
|
+
const appData = process.env.APPDATA || join108(homedir27(), "AppData", "Roaming");
|
|
119468
119688
|
return win329.join(appData, identifier);
|
|
119469
119689
|
}
|
|
119470
119690
|
case "linux":
|
|
119471
119691
|
default: {
|
|
119472
|
-
const xdgConfig = process.env.XDG_CONFIG_HOME || join108(
|
|
119692
|
+
const xdgConfig = process.env.XDG_CONFIG_HOME || join108(homedir27(), ".config");
|
|
119473
119693
|
return join108(xdgConfig, identifier);
|
|
119474
119694
|
}
|
|
119475
119695
|
}
|
|
@@ -119478,7 +119698,7 @@ function resolveConfigPath3(pathValue) {
|
|
|
119478
119698
|
if (isWslEnvironment3() && pathValue.startsWith("/")) {
|
|
119479
119699
|
return posix6.normalize(pathValue);
|
|
119480
119700
|
}
|
|
119481
|
-
const resolvedPath =
|
|
119701
|
+
const resolvedPath = resolve31(pathValue);
|
|
119482
119702
|
if (!existsSync93(resolvedPath))
|
|
119483
119703
|
return resolvedPath;
|
|
119484
119704
|
try {
|
|
@@ -119513,7 +119733,7 @@ function getWslLinuxHomeDir3(windowsConfigRoot) {
|
|
|
119513
119733
|
function getCliDefaultConfigDir3() {
|
|
119514
119734
|
const envXdgConfig = process.env.XDG_CONFIG_HOME?.trim();
|
|
119515
119735
|
const shouldIgnoreWindowsXdg = envXdgConfig !== undefined && envXdgConfig.length > 0 && isWslEnvironment3() && isWindowsUserConfigRoot3(envXdgConfig);
|
|
119516
|
-
const xdgConfig = shouldIgnoreWindowsXdg ? posix6.join(getWslLinuxHomeDir3(envXdgConfig) ?? "/home", ".config") : envXdgConfig || join108(
|
|
119736
|
+
const xdgConfig = shouldIgnoreWindowsXdg ? posix6.join(getWslLinuxHomeDir3(envXdgConfig) ?? "/home", ".config") : envXdgConfig || join108(homedir27(), ".config");
|
|
119517
119737
|
const configDir = isWslEnvironment3() ? posix6.join(xdgConfig, "opencode") : join108(xdgConfig, "opencode");
|
|
119518
119738
|
return resolveConfigPath3(configDir);
|
|
119519
119739
|
}
|
|
@@ -119558,12 +119778,12 @@ function getOpenCodeConfigDir3(options) {
|
|
|
119558
119778
|
// packages/claude-code-compat-core/src/shared/jsonc-parser.ts
|
|
119559
119779
|
init_src();
|
|
119560
119780
|
// packages/claude-code-compat-core/src/shared/resolve-agent-definition-paths.ts
|
|
119561
|
-
import { homedir as
|
|
119562
|
-
import { isAbsolute as isAbsolute17, join as join109, resolve as
|
|
119781
|
+
import { homedir as homedir28 } from "os";
|
|
119782
|
+
import { isAbsolute as isAbsolute17, join as join109, resolve as resolve32 } from "path";
|
|
119563
119783
|
function resolveAgentDefinitionPaths2(paths, baseDir, containmentDir) {
|
|
119564
119784
|
return paths.flatMap((p) => {
|
|
119565
|
-
const expanded = p.startsWith("~/") ? join109(
|
|
119566
|
-
const resolved = isAbsolute17(expanded) ? expanded :
|
|
119785
|
+
const expanded = p.startsWith("~/") ? join109(homedir28(), p.slice(2)) : p;
|
|
119786
|
+
const resolved = isAbsolute17(expanded) ? expanded : resolve32(baseDir, expanded);
|
|
119567
119787
|
if (containmentDir !== null && !isWithinProject(resolved, containmentDir)) {
|
|
119568
119788
|
log4(`agent_definitions path rejected (outside project boundary): ${p} -> ${resolved}`);
|
|
119569
119789
|
return [];
|
|
@@ -119614,10 +119834,10 @@ function getOpenCodeCommandDirs2(options) {
|
|
|
119614
119834
|
// packages/claude-code-compat-core/src/shared/project-discovery-dirs.ts
|
|
119615
119835
|
import { execFileSync as execFileSync6 } from "child_process";
|
|
119616
119836
|
import { existsSync as existsSync94, realpathSync as realpathSync17 } from "fs";
|
|
119617
|
-
import { dirname as dirname37, join as join111, resolve as
|
|
119837
|
+
import { dirname as dirname37, join as join111, resolve as resolve33, win32 as win3210 } from "path";
|
|
119618
119838
|
var worktreePathCache3 = new Map;
|
|
119619
119839
|
function normalizePath6(path18) {
|
|
119620
|
-
const resolvedPath = process.platform !== "win32" && win3210.isAbsolute(path18) ? path18 :
|
|
119840
|
+
const resolvedPath = process.platform !== "win32" && win3210.isAbsolute(path18) ? path18 : resolve33(path18);
|
|
119621
119841
|
if (!existsSync94(resolvedPath)) {
|
|
119622
119842
|
return resolvedPath;
|
|
119623
119843
|
}
|
|
@@ -119642,7 +119862,7 @@ function pathKey3(path18) {
|
|
|
119642
119862
|
return process.platform === "win32" ? normalized.toLowerCase() : normalized;
|
|
119643
119863
|
}
|
|
119644
119864
|
function detectWorktreePath4(directory) {
|
|
119645
|
-
const resolvedDirectory =
|
|
119865
|
+
const resolvedDirectory = resolve33(directory);
|
|
119646
119866
|
const cacheKey = pathKey3(normalizePath6(resolvedDirectory));
|
|
119647
119867
|
if (worktreePathCache3.has(cacheKey)) {
|
|
119648
119868
|
return worktreePathCache3.get(cacheKey);
|
|
@@ -119892,14 +120112,15 @@ function loadOpencodeProjectAgents(directory) {
|
|
|
119892
120112
|
import * as fs22 from "fs";
|
|
119893
120113
|
import * as path18 from "path";
|
|
119894
120114
|
function getConfigPaths4(directory) {
|
|
119895
|
-
const
|
|
119896
|
-
|
|
120115
|
+
const globalConfigDirs = getOpenCodeConfigDirs3({ binary: "opencode" });
|
|
120116
|
+
return [
|
|
119897
120117
|
path18.join(directory, ".opencode", "opencode.json"),
|
|
119898
120118
|
path18.join(directory, ".opencode", "opencode.jsonc"),
|
|
119899
|
-
|
|
119900
|
-
|
|
120119
|
+
...globalConfigDirs.flatMap((dir) => [
|
|
120120
|
+
path18.join(dir, "opencode.json"),
|
|
120121
|
+
path18.join(dir, "opencode.jsonc")
|
|
120122
|
+
])
|
|
119901
120123
|
];
|
|
119902
|
-
return paths;
|
|
119903
120124
|
}
|
|
119904
120125
|
function convertInlineAgent(agentData) {
|
|
119905
120126
|
if (!agentData || typeof agentData !== "object") {
|
|
@@ -120079,7 +120300,7 @@ Task ID: ${task.id}`;
|
|
|
120079
120300
|
if (toolContext.abort?.aborted) {
|
|
120080
120301
|
break;
|
|
120081
120302
|
}
|
|
120082
|
-
await new Promise((
|
|
120303
|
+
await new Promise((resolve34) => setTimeout(resolve34, WAIT_FOR_SESSION_INTERVAL_MS));
|
|
120083
120304
|
}
|
|
120084
120305
|
await toolContext.metadata?.({
|
|
120085
120306
|
title: args.description,
|
|
@@ -120159,7 +120380,7 @@ async function waitForCompletion(sessionID, toolContext, ctx) {
|
|
|
120159
120380
|
log2(`[call_omo_agent] Aborted by user`);
|
|
120160
120381
|
throw new Error("Task aborted.");
|
|
120161
120382
|
}
|
|
120162
|
-
await new Promise((
|
|
120383
|
+
await new Promise((resolve34) => setTimeout(resolve34, POLL_INTERVAL_MS));
|
|
120163
120384
|
const statusResult = await ctx.client.session.status();
|
|
120164
120385
|
const allStatuses = normalizeSDKResponse(statusResult, {});
|
|
120165
120386
|
const sessionStatus = allStatuses[sessionID];
|
|
@@ -121362,7 +121583,7 @@ async function waitForLookAtSessionResult(client3, sessionID, options) {
|
|
|
121362
121583
|
sawNonIdleStatus
|
|
121363
121584
|
});
|
|
121364
121585
|
}
|
|
121365
|
-
await new Promise((
|
|
121586
|
+
await new Promise((resolve34) => setTimeout(resolve34, pollInterval));
|
|
121366
121587
|
}
|
|
121367
121588
|
throw new Error(`[look_at] Polling timed out after ${timeout}ms waiting for session ${sessionID} to become idle`);
|
|
121368
121589
|
}
|
|
@@ -123076,7 +123297,7 @@ async function executeUnstableAgentTask(args, ctx, executorCtx, parentContext, a
|
|
|
123076
123297
|
|
|
123077
123298
|
Task ID: ${task.id}`;
|
|
123078
123299
|
}
|
|
123079
|
-
await new Promise((
|
|
123300
|
+
await new Promise((resolve34) => setTimeout(resolve34, timing.WAIT_FOR_SESSION_INTERVAL_MS));
|
|
123080
123301
|
const updated = manager.getTask(task.id);
|
|
123081
123302
|
sessionID = updated?.sessionId;
|
|
123082
123303
|
}
|
|
@@ -123138,7 +123359,7 @@ Session ID: ${sessionID}`;
|
|
|
123138
123359
|
}
|
|
123139
123360
|
const timeoutBudgetMs = syncPollTimeoutMs ?? DEFAULT_SYNC_POLL_TIMEOUT_MS;
|
|
123140
123361
|
const remainingBudgetMs = timeoutBudgetMs - (Date.now() - pollStart);
|
|
123141
|
-
await new Promise((
|
|
123362
|
+
await new Promise((resolve34) => setTimeout(resolve34, Math.min(timingCfg.POLL_INTERVAL_MS, Math.max(1, remainingBudgetMs))));
|
|
123142
123363
|
const statusResult = await client3.session.status();
|
|
123143
123364
|
const allStatuses = normalizeSDKResponse(statusResult, {});
|
|
123144
123365
|
const sessionStatus = allStatuses[sessionID];
|
|
@@ -123277,7 +123498,7 @@ function continueSessionSetup(args) {
|
|
|
123277
123498
|
(async () => {
|
|
123278
123499
|
const waitStart = Date.now();
|
|
123279
123500
|
while (Date.now() - waitStart < args.timing.WAIT_FOR_SESSION_TIMEOUT_MS) {
|
|
123280
|
-
await new Promise((
|
|
123501
|
+
await new Promise((resolve34) => setTimeout(resolve34, args.timing.WAIT_FOR_SESSION_INTERVAL_MS));
|
|
123281
123502
|
const updated = args.manager.getTask(args.taskID);
|
|
123282
123503
|
if (!updated) {
|
|
123283
123504
|
return;
|
|
@@ -123315,7 +123536,7 @@ async function waitForBackgroundSessionStart(args) {
|
|
|
123315
123536
|
args.onAbort();
|
|
123316
123537
|
return;
|
|
123317
123538
|
}
|
|
123318
|
-
await new Promise((
|
|
123539
|
+
await new Promise((resolve34) => setTimeout(resolve34, args.timing.WAIT_FOR_SESSION_INTERVAL_MS));
|
|
123319
123540
|
}
|
|
123320
123541
|
return sessionId;
|
|
123321
123542
|
}
|
|
@@ -127080,9 +127301,9 @@ async function abortWithTimeout(client3, sessionID, timeoutMs = 1e4) {
|
|
|
127080
127301
|
});
|
|
127081
127302
|
return "failed";
|
|
127082
127303
|
}),
|
|
127083
|
-
new Promise((
|
|
127304
|
+
new Promise((resolve34) => {
|
|
127084
127305
|
timeoutHandle = setTimeout(() => {
|
|
127085
|
-
|
|
127306
|
+
resolve34("timed_out");
|
|
127086
127307
|
}, timeoutMs);
|
|
127087
127308
|
})
|
|
127088
127309
|
]);
|
|
@@ -127484,7 +127705,7 @@ class ConcurrencyManager {
|
|
|
127484
127705
|
this.counts.set(key, current + 1);
|
|
127485
127706
|
return;
|
|
127486
127707
|
}
|
|
127487
|
-
return new Promise((
|
|
127708
|
+
return new Promise((resolve34, reject) => {
|
|
127488
127709
|
const queue = this.queues.get(key) ?? [];
|
|
127489
127710
|
const entry = {
|
|
127490
127711
|
taskId,
|
|
@@ -127492,7 +127713,7 @@ class ConcurrencyManager {
|
|
|
127492
127713
|
if (entry.settled)
|
|
127493
127714
|
return;
|
|
127494
127715
|
entry.settled = true;
|
|
127495
|
-
|
|
127716
|
+
resolve34();
|
|
127496
127717
|
},
|
|
127497
127718
|
rawReject: reject,
|
|
127498
127719
|
settled: false
|
|
@@ -132208,10 +132429,10 @@ The task was re-queued on a fallback model after a retryable failure.
|
|
|
132208
132429
|
return this.scheduledFlushSettledCounts.get(sessionID) ?? 0;
|
|
132209
132430
|
}
|
|
132210
132431
|
awaitScheduledFlush(sessionID, sinceCount) {
|
|
132211
|
-
return new Promise((
|
|
132432
|
+
return new Promise((resolve34) => {
|
|
132212
132433
|
const arm = () => {
|
|
132213
132434
|
if ((this.scheduledFlushSettledCounts.get(sessionID) ?? 0) > sinceCount) {
|
|
132214
|
-
|
|
132435
|
+
resolve34();
|
|
132215
132436
|
return;
|
|
132216
132437
|
}
|
|
132217
132438
|
const waiters = this.scheduledFlushSettledWaiters.get(sessionID) ?? [];
|
|
@@ -133318,8 +133539,8 @@ function spawnMonitoredProcess(opts, deps) {
|
|
|
133318
133539
|
let watchdogTimer;
|
|
133319
133540
|
let graceTimer;
|
|
133320
133541
|
let resolvePublicExit = () => {};
|
|
133321
|
-
const publicExit = new Promise((
|
|
133322
|
-
resolvePublicExit =
|
|
133542
|
+
const publicExit = new Promise((resolve34) => {
|
|
133543
|
+
resolvePublicExit = resolve34;
|
|
133323
133544
|
});
|
|
133324
133545
|
function clearWatchdog() {
|
|
133325
133546
|
if (watchdogTimer !== undefined) {
|
|
@@ -133808,10 +134029,10 @@ import { basename as basename22, dirname as dirname41, join as join124 } from "p
|
|
|
133808
134029
|
|
|
133809
134030
|
// packages/mcp-client-core/src/config-dir.ts
|
|
133810
134031
|
import { existsSync as existsSync102, realpathSync as realpathSync18 } from "fs";
|
|
133811
|
-
import { homedir as
|
|
133812
|
-
import { join as join122, resolve as
|
|
134032
|
+
import { homedir as homedir29 } from "os";
|
|
134033
|
+
import { join as join122, resolve as resolve34 } from "path";
|
|
133813
134034
|
function resolveConfigPath4(pathValue) {
|
|
133814
|
-
const resolvedPath =
|
|
134035
|
+
const resolvedPath = resolve34(pathValue);
|
|
133815
134036
|
if (!existsSync102(resolvedPath))
|
|
133816
134037
|
return resolvedPath;
|
|
133817
134038
|
try {
|
|
@@ -133827,7 +134048,7 @@ function getOpenCodeCliConfigDir(env2 = process.env) {
|
|
|
133827
134048
|
if (customConfigDir) {
|
|
133828
134049
|
return resolveConfigPath4(customConfigDir);
|
|
133829
134050
|
}
|
|
133830
|
-
const xdgConfigDir = env2["XDG_CONFIG_HOME"]?.trim() || join122(
|
|
134051
|
+
const xdgConfigDir = env2["XDG_CONFIG_HOME"]?.trim() || join122(homedir29(), ".config");
|
|
133831
134052
|
return resolveConfigPath4(join122(xdgConfigDir, "opencode"));
|
|
133832
134053
|
}
|
|
133833
134054
|
|
|
@@ -134207,7 +134428,7 @@ function buildAuthorizationUrl(authorizationEndpoint, options) {
|
|
|
134207
134428
|
}
|
|
134208
134429
|
var CALLBACK_TIMEOUT_MS = 5 * 60 * 1000;
|
|
134209
134430
|
function startCallbackServer(port) {
|
|
134210
|
-
return new Promise((
|
|
134431
|
+
return new Promise((resolve35, reject) => {
|
|
134211
134432
|
let timeoutId;
|
|
134212
134433
|
const server2 = createServer2((request, response) => {
|
|
134213
134434
|
clearTimeout(timeoutId);
|
|
@@ -134233,7 +134454,7 @@ function startCallbackServer(port) {
|
|
|
134233
134454
|
response.writeHead(200, { "content-type": "text/html" });
|
|
134234
134455
|
response.end("<html><body><h1>Authorization successful. You can close this tab.</h1></body></html>");
|
|
134235
134456
|
server2.close();
|
|
134236
|
-
|
|
134457
|
+
resolve35({ code, state: state3 });
|
|
134237
134458
|
});
|
|
134238
134459
|
timeoutId = setTimeout(() => {
|
|
134239
134460
|
server2.close();
|
|
@@ -136008,7 +136229,7 @@ class Protocol {
|
|
|
136008
136229
|
return;
|
|
136009
136230
|
}
|
|
136010
136231
|
const pollInterval = task2.pollInterval ?? this._options?.defaultTaskPollInterval ?? 1000;
|
|
136011
|
-
await new Promise((
|
|
136232
|
+
await new Promise((resolve35) => setTimeout(resolve35, pollInterval));
|
|
136012
136233
|
options?.signal?.throwIfAborted();
|
|
136013
136234
|
}
|
|
136014
136235
|
} catch (error) {
|
|
@@ -136020,7 +136241,7 @@ class Protocol {
|
|
|
136020
136241
|
}
|
|
136021
136242
|
request(request, resultSchema, options) {
|
|
136022
136243
|
const { relatedRequestId, resumptionToken, onresumptiontoken, task, relatedTask } = options ?? {};
|
|
136023
|
-
return new Promise((
|
|
136244
|
+
return new Promise((resolve35, reject) => {
|
|
136024
136245
|
const earlyReject = (error) => {
|
|
136025
136246
|
reject(error);
|
|
136026
136247
|
};
|
|
@@ -136098,7 +136319,7 @@ class Protocol {
|
|
|
136098
136319
|
if (!parseResult.success) {
|
|
136099
136320
|
reject(parseResult.error);
|
|
136100
136321
|
} else {
|
|
136101
|
-
|
|
136322
|
+
resolve35(parseResult.data);
|
|
136102
136323
|
}
|
|
136103
136324
|
} catch (error) {
|
|
136104
136325
|
reject(error);
|
|
@@ -136289,12 +136510,12 @@ class Protocol {
|
|
|
136289
136510
|
interval = task.pollInterval;
|
|
136290
136511
|
}
|
|
136291
136512
|
} catch {}
|
|
136292
|
-
return new Promise((
|
|
136513
|
+
return new Promise((resolve35, reject) => {
|
|
136293
136514
|
if (signal.aborted) {
|
|
136294
136515
|
reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
|
|
136295
136516
|
return;
|
|
136296
136517
|
}
|
|
136297
|
-
const timeoutId = setTimeout(
|
|
136518
|
+
const timeoutId = setTimeout(resolve35, interval);
|
|
136298
136519
|
signal.addEventListener("abort", () => {
|
|
136299
136520
|
clearTimeout(timeoutId);
|
|
136300
136521
|
reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
|
|
@@ -138823,7 +139044,7 @@ class StdioClientTransport {
|
|
|
138823
139044
|
if (this._process) {
|
|
138824
139045
|
throw new Error("StdioClientTransport already started! If using Client class, note that connect() calls start() automatically.");
|
|
138825
139046
|
}
|
|
138826
|
-
return new Promise((
|
|
139047
|
+
return new Promise((resolve35, reject) => {
|
|
138827
139048
|
this._process = import_cross_spawn2.default(this._serverParams.command, this._serverParams.args ?? [], {
|
|
138828
139049
|
env: {
|
|
138829
139050
|
...getDefaultEnvironment(),
|
|
@@ -138839,7 +139060,7 @@ class StdioClientTransport {
|
|
|
138839
139060
|
this.onerror?.(error);
|
|
138840
139061
|
});
|
|
138841
139062
|
this._process.on("spawn", () => {
|
|
138842
|
-
|
|
139063
|
+
resolve35();
|
|
138843
139064
|
});
|
|
138844
139065
|
this._process.on("close", (_code) => {
|
|
138845
139066
|
this._process = undefined;
|
|
@@ -138886,20 +139107,20 @@ class StdioClientTransport {
|
|
|
138886
139107
|
if (this._process) {
|
|
138887
139108
|
const processToClose = this._process;
|
|
138888
139109
|
this._process = undefined;
|
|
138889
|
-
const closePromise = new Promise((
|
|
139110
|
+
const closePromise = new Promise((resolve35) => {
|
|
138890
139111
|
processToClose.once("close", () => {
|
|
138891
|
-
|
|
139112
|
+
resolve35();
|
|
138892
139113
|
});
|
|
138893
139114
|
});
|
|
138894
139115
|
try {
|
|
138895
139116
|
processToClose.stdin?.end();
|
|
138896
139117
|
} catch {}
|
|
138897
|
-
await Promise.race([closePromise, new Promise((
|
|
139118
|
+
await Promise.race([closePromise, new Promise((resolve35) => setTimeout(resolve35, 2000).unref())]);
|
|
138898
139119
|
if (processToClose.exitCode === null) {
|
|
138899
139120
|
try {
|
|
138900
139121
|
processToClose.kill("SIGTERM");
|
|
138901
139122
|
} catch {}
|
|
138902
|
-
await Promise.race([closePromise, new Promise((
|
|
139123
|
+
await Promise.race([closePromise, new Promise((resolve35) => setTimeout(resolve35, 2000).unref())]);
|
|
138903
139124
|
}
|
|
138904
139125
|
if (processToClose.exitCode === null) {
|
|
138905
139126
|
try {
|
|
@@ -138910,15 +139131,15 @@ class StdioClientTransport {
|
|
|
138910
139131
|
this._readBuffer.clear();
|
|
138911
139132
|
}
|
|
138912
139133
|
send(message) {
|
|
138913
|
-
return new Promise((
|
|
139134
|
+
return new Promise((resolve35) => {
|
|
138914
139135
|
if (!this._process?.stdin) {
|
|
138915
139136
|
throw new Error("Not connected");
|
|
138916
139137
|
}
|
|
138917
139138
|
const json = serializeMessage(message);
|
|
138918
139139
|
if (this._process.stdin.write(json)) {
|
|
138919
|
-
|
|
139140
|
+
resolve35();
|
|
138920
139141
|
} else {
|
|
138921
|
-
this._process.stdin.once("drain",
|
|
139142
|
+
this._process.stdin.once("drain", resolve35);
|
|
138922
139143
|
}
|
|
138923
139144
|
});
|
|
138924
139145
|
}
|
|
@@ -139380,17 +139601,17 @@ import { dirname as dirname42 } from "path";
|
|
|
139380
139601
|
// packages/omo-opencode/src/features/tui-sidebar/mirror-path.ts
|
|
139381
139602
|
import { createHash as createHash8 } from "crypto";
|
|
139382
139603
|
import { realpathSync as realpathSync19 } from "fs";
|
|
139383
|
-
import { homedir as
|
|
139384
|
-
import { join as join125, resolve as
|
|
139604
|
+
import { homedir as homedir30 } from "os";
|
|
139605
|
+
import { join as join125, resolve as resolve35 } from "path";
|
|
139385
139606
|
function mirrorStorageDir() {
|
|
139386
|
-
return join125(process.env.XDG_DATA_HOME ?? join125(
|
|
139607
|
+
return join125(process.env.XDG_DATA_HOME ?? join125(homedir30(), ".local", "share"), "opencode", "storage", "oh-my-openagent", MIRROR_DIR_NAME);
|
|
139387
139608
|
}
|
|
139388
139609
|
function canonicalProjectDir(projectDir) {
|
|
139389
139610
|
try {
|
|
139390
139611
|
return realpathSync19.native(projectDir);
|
|
139391
139612
|
} catch (error) {
|
|
139392
139613
|
if (error instanceof Error) {
|
|
139393
|
-
return
|
|
139614
|
+
return resolve35(projectDir);
|
|
139394
139615
|
}
|
|
139395
139616
|
throw error;
|
|
139396
139617
|
}
|
|
@@ -140665,8 +140886,8 @@ async function waitForSessionReady(params) {
|
|
|
140665
140886
|
} catch (error) {
|
|
140666
140887
|
log2("[tmux-session-manager] session status check error", { error: String(error) });
|
|
140667
140888
|
}
|
|
140668
|
-
await new Promise((
|
|
140669
|
-
setTimeout(
|
|
140889
|
+
await new Promise((resolve36) => {
|
|
140890
|
+
setTimeout(resolve36, SESSION_READY_POLL_INTERVAL_MS);
|
|
140670
140891
|
});
|
|
140671
140892
|
}
|
|
140672
140893
|
log2("[tmux-session-manager] session ready timeout", {
|
|
@@ -142256,11 +142477,11 @@ import {
|
|
|
142256
142477
|
|
|
142257
142478
|
// packages/openclaw-core/src/reply-listener-paths.ts
|
|
142258
142479
|
import { existsSync as existsSync105, mkdirSync as mkdirSync22 } from "fs";
|
|
142259
|
-
import { homedir as
|
|
142480
|
+
import { homedir as homedir31 } from "os";
|
|
142260
142481
|
import { join as join127 } from "path";
|
|
142261
142482
|
var REPLY_LISTENER_SECURE_FILE_MODE = 384;
|
|
142262
142483
|
function resolveReplyListenerHomeDir() {
|
|
142263
|
-
return process.env.HOME ?? process.env.USERPROFILE ??
|
|
142484
|
+
return process.env.HOME ?? process.env.USERPROFILE ?? homedir31();
|
|
142264
142485
|
}
|
|
142265
142486
|
function getReplyListenerStateDir() {
|
|
142266
142487
|
return join127(resolveReplyListenerHomeDir(), ".omo", "openclaw", "state");
|
|
@@ -142785,7 +143006,7 @@ function markReplyListenerStopped(state3, error) {
|
|
|
142785
143006
|
|
|
142786
143007
|
// packages/openclaw-core/src/reply-listener-sleep.ts
|
|
142787
143008
|
function sleep3(ms) {
|
|
142788
|
-
return new Promise((
|
|
143009
|
+
return new Promise((resolve36) => setTimeout(resolve36, ms));
|
|
142789
143010
|
}
|
|
142790
143011
|
|
|
142791
143012
|
// packages/openclaw-core/src/reply-listener-signature.ts
|
|
@@ -143428,11 +143649,11 @@ async function createRuntimeSkillSourceServer(options, runtimeEnv = runtime6) {
|
|
|
143428
143649
|
response.end(error instanceof Error ? error.message : String(error));
|
|
143429
143650
|
}
|
|
143430
143651
|
});
|
|
143431
|
-
await new Promise((
|
|
143652
|
+
await new Promise((resolve36, reject) => {
|
|
143432
143653
|
const onError = (error) => reject(error);
|
|
143433
143654
|
const onListening = () => {
|
|
143434
143655
|
server3.off("error", onError);
|
|
143435
|
-
|
|
143656
|
+
resolve36();
|
|
143436
143657
|
};
|
|
143437
143658
|
server3.once("error", onError);
|
|
143438
143659
|
server3.once("listening", onListening);
|
|
@@ -143463,7 +143684,7 @@ async function createRuntimeSkillSourceServer(options, runtimeEnv = runtime6) {
|
|
|
143463
143684
|
// packages/claude-code-compat-core/src/features/claude-code-mcp-loader/loader.ts
|
|
143464
143685
|
import { existsSync as existsSync110, readFileSync as readFileSync76 } from "fs";
|
|
143465
143686
|
import { join as join130 } from "path";
|
|
143466
|
-
import { homedir as
|
|
143687
|
+
import { homedir as homedir32 } from "os";
|
|
143467
143688
|
function getMcpConfigPaths() {
|
|
143468
143689
|
const claudeConfigDir = getClaudeConfigDir3();
|
|
143469
143690
|
const homeDir = getHomeDir();
|
|
@@ -143476,7 +143697,7 @@ function getMcpConfigPaths() {
|
|
|
143476
143697
|
];
|
|
143477
143698
|
}
|
|
143478
143699
|
function getHomeDir() {
|
|
143479
|
-
return process.env.HOME || process.env.USERPROFILE ||
|
|
143700
|
+
return process.env.HOME || process.env.USERPROFILE || homedir32();
|
|
143480
143701
|
}
|
|
143481
143702
|
async function loadMcpConfigFile(filePath) {
|
|
143482
143703
|
if (!existsSync110(filePath)) {
|
|
@@ -150382,7 +150603,7 @@ Write the final message and stop **only when** Success Criteria are all true. Un
|
|
|
150382
150603
|
function buildGpt55HephaestusPrompt(availableAgents, _availableTools = [], availableSkills = [], availableCategories = [], useTaskSystem = false) {
|
|
150383
150604
|
const taskSystemGuide = buildTaskSystemGuide2(useTaskSystem);
|
|
150384
150605
|
const categorySkillsGuide = buildCategorySkillsDelegationGuide(availableCategories, availableSkills);
|
|
150385
|
-
const delegationTable = buildDelegationTable(availableAgents);
|
|
150606
|
+
const delegationTable = buildDelegationTable(availableAgents.filter((agent) => ["explore", "librarian", "oracle"].includes(agent.name)));
|
|
150386
150607
|
const oracleSection = buildOracleSection(availableAgents);
|
|
150387
150608
|
const frontendGuidance = buildFrontendGuidanceSection(availableCategories);
|
|
150388
150609
|
return HEPHAESTUS_GPT_5_5_TEMPLATE.replace("{{ taskSystemGuide }}", taskSystemGuide).replace("{{ categorySkillsGuide }}", categorySkillsGuide).replace("{{ delegationTable }}", delegationTable).replace("{{ oracleSection }}", oracleSection).replace("{{ frontendGuidance }}", frontendGuidance);
|
|
@@ -150431,6 +150652,8 @@ Once you delegate exploration to background agents, do not search the same thing
|
|
|
150431
150652
|
|
|
150432
150653
|
Independent tool calls run in the same response; serial is the exception and requires a real dependency. Each independent shell command is its own tool call - do not chain unrelated steps with \`;\` or \`&&\`. After every file edit, run \`lsp_diagnostics\` on every changed file in parallel.
|
|
150433
150654
|
|
|
150655
|
+
Waiting is not free: a status poll replays the whole accumulated context through the model. Run a long command (install, build, suite, CI watch) to completion in one call with a timeout sized to the expected wait - or send output to a log file read once on a completion signal - never re-poll the same surface with empty reads or sub-minute waits. If two consecutive checks show no state change, double the wait or switch to a completion signal.
|
|
150656
|
+
|
|
150434
150657
|
# Operating Loop
|
|
150435
150658
|
|
|
150436
150659
|
**Explore -> Plan -> Implement -> Verify -> Manually QA.**
|
|
@@ -150438,7 +150661,7 @@ Independent tool calls run in the same response; serial is the exception and req
|
|
|
150438
150661
|
- **Explore** per Discovery & Retrieval.
|
|
150439
150662
|
- **Plan** with \`update_plan\` for non-trivial work: files to modify, specific changes, dependencies. Skip planning for the easiest 25%; never make single-step plans.
|
|
150440
150663
|
- **Implement** surgically, matching codebase style - naming, indentation, imports, error handling - even when you would write it differently in a greenfield.
|
|
150441
|
-
- **Verify** with the most relevant validation available, in parallel where possible: \`lsp_diagnostics\` on changed files, targeted tests for changed behavior, build for affected packages. If validation cannot run, say why and name the next best check.
|
|
150664
|
+
- **Verify** with the most relevant validation available, in parallel where possible: \`lsp_diagnostics\` on changed files, targeted tests for changed behavior, build for affected packages. If validation cannot run, say why and name the next best check. Re-run a validation command only when its inputs changed since its last green run; one full pass at the end replaces repeated identical reruns.
|
|
150442
150665
|
- **Manually QA** through the artifact's surface, then write the final message.
|
|
150443
150666
|
|
|
150444
150667
|
# Manual QA Gate
|
|
@@ -150545,7 +150768,7 @@ Write the final message and stop only when Success Criteria are all true. Until
|
|
|
150545
150768
|
function buildGpt56HephaestusPrompt(availableAgents, _availableTools = [], availableSkills = [], availableCategories = [], useTaskSystem = false) {
|
|
150546
150769
|
const taskSystemGuide = buildTaskSystemGuide3(useTaskSystem);
|
|
150547
150770
|
const categorySkillsGuide = buildCategorySkillsDelegationGuide(availableCategories, availableSkills);
|
|
150548
|
-
const delegationTable = buildDelegationTable(availableAgents);
|
|
150771
|
+
const delegationTable = buildDelegationTable(availableAgents.filter((agent) => ["explore", "librarian", "oracle"].includes(agent.name)));
|
|
150549
150772
|
const oracleSection = buildOracleSection(availableAgents);
|
|
150550
150773
|
const frontendGuidance = buildFrontendGuidanceSection(availableCategories);
|
|
150551
150774
|
return HEPHAESTUS_GPT_5_6_TEMPLATE.replace("{{ taskSystemGuide }}", taskSystemGuide).replace("{{ categorySkillsGuide }}", categorySkillsGuide).replace("{{ delegationTable }}", delegationTable).replace("{{ oracleSection }}", oracleSection).replace("{{ frontendGuidance }}", frontendGuidance);
|
|
@@ -150649,14 +150872,14 @@ function createHephaestusAgent(model, availableAgents, availableToolNames, avail
|
|
|
150649
150872
|
createHephaestusAgent.mode = MODE9;
|
|
150650
150873
|
// packages/omo-opencode/src/agents/builtin-agents/resolve-file-uri.ts
|
|
150651
150874
|
import { existsSync as existsSync111, readFileSync as readFileSync77 } from "fs";
|
|
150652
|
-
import { homedir as
|
|
150653
|
-
import { isAbsolute as isAbsolute19, join as join131, resolve as
|
|
150875
|
+
import { homedir as homedir33 } from "os";
|
|
150876
|
+
import { isAbsolute as isAbsolute19, join as join131, resolve as resolve36 } from "path";
|
|
150654
150877
|
init_logger2();
|
|
150655
150878
|
var ALLOWED_HOME_SUBDIRS = [
|
|
150656
|
-
join131(
|
|
150657
|
-
join131(
|
|
150658
|
-
join131(
|
|
150659
|
-
join131(
|
|
150879
|
+
join131(homedir33(), ".config", "opencode"),
|
|
150880
|
+
join131(homedir33(), ".config", "oh-my-openagent"),
|
|
150881
|
+
join131(homedir33(), ".omo"),
|
|
150882
|
+
join131(homedir33(), ".opencode")
|
|
150660
150883
|
];
|
|
150661
150884
|
function isWithinAllowedPaths(filePath, projectRoot) {
|
|
150662
150885
|
if (isWithinProject(filePath, projectRoot))
|
|
@@ -150674,8 +150897,8 @@ function resolvePromptAppend(promptAppend, configDir) {
|
|
|
150674
150897
|
let filePath;
|
|
150675
150898
|
try {
|
|
150676
150899
|
const decoded = decodeURIComponent(encoded);
|
|
150677
|
-
const expanded = decoded.startsWith("~/") ? decoded.replace(/^~\//, `${
|
|
150678
|
-
filePath = isAbsolute19(expanded) ? expanded :
|
|
150900
|
+
const expanded = decoded.startsWith("~/") ? decoded.replace(/^~\//, `${homedir33()}/`) : decoded;
|
|
150901
|
+
filePath = isAbsolute19(expanded) ? expanded : resolve36(configDir ?? process.cwd(), expanded);
|
|
150679
150902
|
} catch (error) {
|
|
150680
150903
|
if (!(error instanceof Error)) {
|
|
150681
150904
|
throw error;
|
|
@@ -152783,7 +153006,8 @@ var MODEL_SETTINGS_KEYS = [
|
|
|
152783
153006
|
"thinking",
|
|
152784
153007
|
"reasoningEffort",
|
|
152785
153008
|
"textVerbosity",
|
|
152786
|
-
"providerOptions"
|
|
153009
|
+
"providerOptions",
|
|
153010
|
+
"fallback_models"
|
|
152787
153011
|
];
|
|
152788
153012
|
function buildPlanDemoteConfig(prometheusConfig, planOverride) {
|
|
152789
153013
|
const modelSettings = {};
|
|
@@ -152858,6 +153082,7 @@ async function buildPrometheusAgentConfig(params) {
|
|
|
152858
153082
|
const temperatureToUse = params.pluginPrometheusOverride?.temperature ?? categoryConfig?.temperature;
|
|
152859
153083
|
const topPToUse = params.pluginPrometheusOverride?.top_p ?? categoryConfig?.top_p;
|
|
152860
153084
|
const maxTokensToUse = params.pluginPrometheusOverride?.maxTokens ?? categoryConfig?.maxTokens;
|
|
153085
|
+
const fallbackModelsToUse = params.pluginPrometheusOverride?.fallback_models ?? categoryConfig?.fallback_models;
|
|
152861
153086
|
const base = {
|
|
152862
153087
|
...resolvedModel ? { model: resolvedModel } : {},
|
|
152863
153088
|
...variantToUse ? { variant: variantToUse } : {},
|
|
@@ -152869,6 +153094,7 @@ async function buildPrometheusAgentConfig(params) {
|
|
|
152869
153094
|
...temperatureToUse !== undefined ? { temperature: temperatureToUse } : {},
|
|
152870
153095
|
...topPToUse !== undefined ? { top_p: topPToUse } : {},
|
|
152871
153096
|
...maxTokensToUse !== undefined ? { maxTokens: maxTokensToUse } : {},
|
|
153097
|
+
...fallbackModelsToUse !== undefined ? { fallback_models: fallbackModelsToUse } : {},
|
|
152872
153098
|
...categoryConfig?.tools ? { tools: categoryConfig.tools } : {},
|
|
152873
153099
|
...thinkingToUse ? { thinking: thinkingToUse } : {},
|
|
152874
153100
|
...reasoningEffortToUse !== undefined ? { reasoningEffort: reasoningEffortToUse } : {},
|
|
@@ -153762,7 +153988,7 @@ function createCodegraphMcpConfig(options = {}) {
|
|
|
153762
153988
|
|
|
153763
153989
|
// packages/omo-opencode/src/mcp/lsp.ts
|
|
153764
153990
|
import { existsSync as existsSync113, readFileSync as readFileSync78 } from "fs";
|
|
153765
|
-
import { delimiter as delimiter2, dirname as dirname45, resolve as
|
|
153991
|
+
import { delimiter as delimiter2, dirname as dirname45, resolve as resolve38 } from "path";
|
|
153766
153992
|
import { fileURLToPath as fileURLToPath8 } from "url";
|
|
153767
153993
|
import { z as z11 } from "zod";
|
|
153768
153994
|
|
|
@@ -153775,7 +154001,7 @@ function hasCliSuffix(candidatePath, suffix) {
|
|
|
153775
154001
|
}
|
|
153776
154002
|
|
|
153777
154003
|
// packages/omo-opencode/src/mcp/shared/ancestor-cli-resolver.ts
|
|
153778
|
-
import { resolve as
|
|
154004
|
+
import { resolve as resolve37 } from "path";
|
|
153779
154005
|
function resolveJavaScriptRuntime(resolveExecutable) {
|
|
153780
154006
|
const node = resolveExecutable("node");
|
|
153781
154007
|
return node.available ? node : resolveExecutable("bun");
|
|
@@ -153783,9 +154009,9 @@ function resolveJavaScriptRuntime(resolveExecutable) {
|
|
|
153783
154009
|
function createAncestorCliCandidates(options) {
|
|
153784
154010
|
const candidates = [];
|
|
153785
154011
|
const seenPaths = new Set;
|
|
153786
|
-
let currentDirectory =
|
|
154012
|
+
let currentDirectory = resolve37(options.startDirectory);
|
|
153787
154013
|
while (true) {
|
|
153788
|
-
const distCliPath =
|
|
154014
|
+
const distCliPath = resolve37(currentDirectory, options.packageRel, options.distCliRel);
|
|
153789
154015
|
if (!seenPaths.has(distCliPath)) {
|
|
153790
154016
|
const runtime7 = resolveJavaScriptRuntime(options.resolveExecutable);
|
|
153791
154017
|
seenPaths.add(distCliPath);
|
|
@@ -153797,7 +154023,7 @@ function createAncestorCliCandidates(options) {
|
|
|
153797
154023
|
runtimeAvailable: runtime7.available
|
|
153798
154024
|
});
|
|
153799
154025
|
}
|
|
153800
|
-
const sourceCliPath =
|
|
154026
|
+
const sourceCliPath = resolve37(currentDirectory, options.packageRel, options.sourceCliRel);
|
|
153801
154027
|
if (!seenPaths.has(sourceCliPath)) {
|
|
153802
154028
|
const runtime7 = options.resolveExecutable("bun");
|
|
153803
154029
|
const sourceCandidateAvailable = options.isSourceCandidateAvailable?.({
|
|
@@ -153814,7 +154040,7 @@ function createAncestorCliCandidates(options) {
|
|
|
153814
154040
|
runtimeAvailable: runtime7.available
|
|
153815
154041
|
});
|
|
153816
154042
|
}
|
|
153817
|
-
const parentDirectory =
|
|
154043
|
+
const parentDirectory = resolve37(currentDirectory, "..");
|
|
153818
154044
|
if (parentDirectory === currentDirectory)
|
|
153819
154045
|
return candidates;
|
|
153820
154046
|
currentDirectory = parentDirectory;
|
|
@@ -153867,11 +154093,11 @@ function getModuleDirectory(moduleUrl) {
|
|
|
153867
154093
|
}
|
|
153868
154094
|
}
|
|
153869
154095
|
function findBootstrapRoot(candidates, pathExists) {
|
|
153870
|
-
return candidates.find((candidate) => pathExists(
|
|
154096
|
+
return candidates.find((candidate) => pathExists(resolve38(candidate.root, "package.json")))?.root ?? process.cwd();
|
|
153871
154097
|
}
|
|
153872
154098
|
function readDaemonPackageVersion(root) {
|
|
153873
154099
|
try {
|
|
153874
|
-
const packageJson = JSON.parse(readFileSync78(
|
|
154100
|
+
const packageJson = JSON.parse(readFileSync78(resolve38(root, PACKAGE_REL, "package.json"), "utf-8"));
|
|
153875
154101
|
return DaemonPackageSchema.parse(packageJson).version;
|
|
153876
154102
|
} catch (error) {
|
|
153877
154103
|
if (!(error instanceof Error))
|
|
@@ -153883,11 +154109,11 @@ function createBootstrapCandidate(root, pathExists, resolveExecutable) {
|
|
|
153883
154109
|
const runtime7 = resolveJavaScriptRuntime(resolveExecutable);
|
|
153884
154110
|
const bun = resolveExecutable("bun");
|
|
153885
154111
|
const npm = resolveExecutable("npm");
|
|
153886
|
-
const packageManifestPath =
|
|
154112
|
+
const packageManifestPath = resolve38(root, PACKAGE_REL, "package.json");
|
|
153887
154113
|
return {
|
|
153888
154114
|
command: [runtime7.command, "-e", LSP_BOOTSTRAP_SCRIPT, root, npm.command, bun.command],
|
|
153889
154115
|
root,
|
|
153890
|
-
path:
|
|
154116
|
+
path: resolve38(root, PACKAGE_REL, DIST_CLI_REL),
|
|
153891
154117
|
exists: runtime7.available && npm.available && pathExists(packageManifestPath),
|
|
153892
154118
|
runtimeAvailable: runtime7.available
|
|
153893
154119
|
};
|
|
@@ -153903,7 +154129,7 @@ function resolveLspCommand(options = {}) {
|
|
|
153903
154129
|
sourceCliRel: SOURCE_CLI_REL,
|
|
153904
154130
|
pathExists,
|
|
153905
154131
|
resolveExecutable,
|
|
153906
|
-
isSourceCandidateAvailable: ({ root }) => pathExists(
|
|
154132
|
+
isSourceCandidateAvailable: ({ root }) => pathExists(resolve38(root, LSP_TOOLS_PACKAGE_REL, DIST_CLI_REL)) && readDaemonPackageVersion(root) !== null
|
|
153907
154133
|
}) : [];
|
|
153908
154134
|
const distCandidate = candidates.find((candidate) => hasCliSuffix(candidate.path, DIST_CLI_REL) && candidate.exists);
|
|
153909
154135
|
if (distCandidate) {
|
|
@@ -153917,7 +154143,7 @@ function resolveLspCommand(options = {}) {
|
|
|
153917
154143
|
}
|
|
153918
154144
|
function createLspMcpConfig(options = {}) {
|
|
153919
154145
|
const resolvedCommand = resolveLspCommand(options);
|
|
153920
|
-
const cwd =
|
|
154146
|
+
const cwd = resolve38(options.cwd ?? process.cwd());
|
|
153921
154147
|
const configDir = getOpenCodeConfigDir({ binary: "opencode" });
|
|
153922
154148
|
const sourceVersion = hasCliSuffix(resolvedCommand.path, SOURCE_CLI_REL) ? readDaemonPackageVersion(resolvedCommand.root) : null;
|
|
153923
154149
|
return {
|
|
@@ -153925,9 +154151,9 @@ function createLspMcpConfig(options = {}) {
|
|
|
153925
154151
|
command: resolvedCommand.command,
|
|
153926
154152
|
enabled: resolvedCommand.exists,
|
|
153927
154153
|
environment: {
|
|
153928
|
-
LSP_TOOLS_MCP_PROJECT_CONFIG: PROJECT_LSP_CONFIGS.map((configPath) =>
|
|
153929
|
-
LSP_TOOLS_MCP_USER_CONFIG:
|
|
153930
|
-
LSP_TOOLS_MCP_INSTALL_DECISIONS:
|
|
154154
|
+
LSP_TOOLS_MCP_PROJECT_CONFIG: PROJECT_LSP_CONFIGS.map((configPath) => resolve38(cwd, configPath)).join(delimiter2),
|
|
154155
|
+
LSP_TOOLS_MCP_USER_CONFIG: resolve38(configDir, "lsp.json"),
|
|
154156
|
+
LSP_TOOLS_MCP_INSTALL_DECISIONS: resolve38(configDir, "lsp-install-decisions.json"),
|
|
153931
154157
|
...sourceVersion ? {
|
|
153932
154158
|
[OMO_LSP_DAEMON_CLI]: resolvedCommand.path,
|
|
153933
154159
|
[OMO_LSP_DAEMON_VERSION]: sourceVersion
|
|
@@ -154542,7 +154768,7 @@ function createTeamModeToolsRecord(args) {
|
|
|
154542
154768
|
// node_modules/.bun/@opencode-ai+sdk@1.15.13/node_modules/@opencode-ai/sdk/dist/v2/gen/core/serverSentEvents.gen.js
|
|
154543
154769
|
var createSseClient2 = ({ onRequest, onSseError, onSseEvent, responseTransformer, responseValidator, sseDefaultRetryDelay, sseMaxRetryAttempts, sseMaxRetryDelay, sseSleepFn, url: url2, ...options }) => {
|
|
154544
154770
|
let lastEventId;
|
|
154545
|
-
const sleep4 = sseSleepFn ?? ((ms) => new Promise((
|
|
154771
|
+
const sleep4 = sseSleepFn ?? ((ms) => new Promise((resolve39) => setTimeout(resolve39, ms)));
|
|
154546
154772
|
const createStream = async function* () {
|
|
154547
154773
|
let retryDelay = sseDefaultRetryDelay ?? 3000;
|
|
154548
154774
|
let attempt = 0;
|
|
@@ -158091,7 +158317,7 @@ async function readRuntimeHostSkills(client5) {
|
|
|
158091
158317
|
function createRuntimeSkillsResolver(args) {
|
|
158092
158318
|
const { baseSkills, readRuntimeHostSkills: readHostSkills, buildMergedSkills } = args;
|
|
158093
158319
|
let inflight;
|
|
158094
|
-
const
|
|
158320
|
+
const resolve39 = async () => {
|
|
158095
158321
|
const hostSkills = await readHostSkills();
|
|
158096
158322
|
if (!hostSkills)
|
|
158097
158323
|
return baseSkills;
|
|
@@ -158103,7 +158329,7 @@ function createRuntimeSkillsResolver(args) {
|
|
|
158103
158329
|
};
|
|
158104
158330
|
return () => {
|
|
158105
158331
|
if (!inflight)
|
|
158106
|
-
inflight =
|
|
158332
|
+
inflight = resolve39();
|
|
158107
158333
|
return inflight;
|
|
158108
158334
|
};
|
|
158109
158335
|
}
|
|
@@ -158943,7 +159169,7 @@ async function waitForTaskSessionId(bgMgr, task, deadlineAt) {
|
|
|
158943
159169
|
}
|
|
158944
159170
|
sessionId = updatedTask?.sessionId;
|
|
158945
159171
|
if (!sessionId)
|
|
158946
|
-
await new Promise((
|
|
159172
|
+
await new Promise((resolve39) => setTimeout(resolve39, SESSION_ID_POLL_MS));
|
|
158947
159173
|
}
|
|
158948
159174
|
return sessionId;
|
|
158949
159175
|
}
|
|
@@ -160431,13 +160657,13 @@ function logCaughtDbError(message, metadata, error) {
|
|
|
160431
160657
|
log2(message, { ...metadata, error: String(error) });
|
|
160432
160658
|
}
|
|
160433
160659
|
function nextMicrotask() {
|
|
160434
|
-
return new Promise((
|
|
160435
|
-
queueMicrotask(
|
|
160660
|
+
return new Promise((resolve39) => {
|
|
160661
|
+
queueMicrotask(resolve39);
|
|
160436
160662
|
});
|
|
160437
160663
|
}
|
|
160438
160664
|
function nextTimerTick() {
|
|
160439
|
-
return new Promise((
|
|
160440
|
-
setTimeout(
|
|
160665
|
+
return new Promise((resolve39) => {
|
|
160666
|
+
setTimeout(resolve39, 0);
|
|
160441
160667
|
});
|
|
160442
160668
|
}
|
|
160443
160669
|
function closeDbWithLog(db, message, metadata) {
|
|
@@ -161055,7 +161281,8 @@ var MESSAGES_TRANSFORM_HOOKS = [
|
|
|
161055
161281
|
{ key: "teamModeStatusInjector", name: "teamModeStatusInjector" },
|
|
161056
161282
|
{ key: "teamMailboxInjector", name: "teamMailboxInjector" },
|
|
161057
161283
|
{ key: "toolPairValidator", name: "toolPairValidator" },
|
|
161058
|
-
{ key: "monitorStatusInjector", name: "monitorStatusInjector" }
|
|
161284
|
+
{ key: "monitorStatusInjector", name: "monitorStatusInjector" },
|
|
161285
|
+
{ key: "categorySkillReminder", name: "categorySkillReminder" }
|
|
161059
161286
|
];
|
|
161060
161287
|
function getSessionID2(message) {
|
|
161061
161288
|
return message.info.sessionID;
|
|
@@ -163062,7 +163289,7 @@ function createPluginInterface(args) {
|
|
|
163062
163289
|
|
|
163063
163290
|
// packages/omo-opencode/src/plugin-config/layered-config-loader.ts
|
|
163064
163291
|
import * as fs25 from "fs";
|
|
163065
|
-
import { homedir as
|
|
163292
|
+
import { homedir as homedir34 } from "os";
|
|
163066
163293
|
import * as path27 from "path";
|
|
163067
163294
|
|
|
163068
163295
|
// packages/omo-opencode/src/config/schema/agent-names.ts
|
|
@@ -163907,7 +164134,7 @@ function loadConfigFromPath2(configPath, _ctx) {
|
|
|
163907
164134
|
|
|
163908
164135
|
// packages/omo-opencode/src/plugin-config/layered-config-loader.ts
|
|
163909
164136
|
function resolveHomeDirectory() {
|
|
163910
|
-
return process.env.HOME ?? process.env.USERPROFILE ??
|
|
164137
|
+
return process.env.HOME ?? process.env.USERPROFILE ?? homedir34();
|
|
163911
164138
|
}
|
|
163912
164139
|
function resolveConfigPathAfterLegacyMigration(detectedPath) {
|
|
163913
164140
|
if (!path27.basename(detectedPath).startsWith(LEGACY_CONFIG_BASENAME)) {
|
|
@@ -164308,9 +164535,9 @@ function getTelemetryHost(env2 = process.env, defaultHost = DEFAULT_POSTHOG_HOST
|
|
|
164308
164535
|
|
|
164309
164536
|
// packages/telemetry-core/src/machine-id.ts
|
|
164310
164537
|
import { createHash as createHash9 } from "crypto";
|
|
164311
|
-
import
|
|
164538
|
+
import os6 from "os";
|
|
164312
164539
|
function getDefaultTelemetryOsProvider() {
|
|
164313
|
-
return
|
|
164540
|
+
return os6;
|
|
164314
164541
|
}
|
|
164315
164542
|
function getTelemetryDistinctId(machineIdPrefix, osProvider = getDefaultTelemetryOsProvider()) {
|
|
164316
164543
|
return createHash9("sha256").update(`${machineIdPrefix}${osProvider.hostname()}`).digest("hex");
|
|
@@ -167013,14 +167240,14 @@ async function addSourceContext(frames) {
|
|
|
167013
167240
|
return frames;
|
|
167014
167241
|
}
|
|
167015
167242
|
function getContextLinesFromFile(path28, ranges, output) {
|
|
167016
|
-
return new Promise((
|
|
167243
|
+
return new Promise((resolve39) => {
|
|
167017
167244
|
const stream = createReadStream(path28);
|
|
167018
167245
|
const lineReaded = createInterface({
|
|
167019
167246
|
input: stream
|
|
167020
167247
|
});
|
|
167021
167248
|
function destroyStreamAndResolve() {
|
|
167022
167249
|
stream.destroy();
|
|
167023
|
-
|
|
167250
|
+
resolve39();
|
|
167024
167251
|
}
|
|
167025
167252
|
let lineNumber = 0;
|
|
167026
167253
|
let currentRangeIndex = 0;
|
|
@@ -168471,9 +168698,9 @@ class PostHogBackendClient extends PostHogCoreStateless {
|
|
|
168471
168698
|
if (this.disabled || this.optedOut)
|
|
168472
168699
|
return;
|
|
168473
168700
|
if (!this._waitUntilCycle) {
|
|
168474
|
-
let
|
|
168701
|
+
let resolve39;
|
|
168475
168702
|
const promise2 = new Promise((r) => {
|
|
168476
|
-
|
|
168703
|
+
resolve39 = r;
|
|
168477
168704
|
});
|
|
168478
168705
|
try {
|
|
168479
168706
|
waitUntil(promise2);
|
|
@@ -168481,7 +168708,7 @@ class PostHogBackendClient extends PostHogCoreStateless {
|
|
|
168481
168708
|
return;
|
|
168482
168709
|
}
|
|
168483
168710
|
this._waitUntilCycle = {
|
|
168484
|
-
resolve:
|
|
168711
|
+
resolve: resolve39,
|
|
168485
168712
|
startedAt: Date.now(),
|
|
168486
168713
|
timer: undefined
|
|
168487
168714
|
};
|
|
@@ -168507,11 +168734,11 @@ class PostHogBackendClient extends PostHogCoreStateless {
|
|
|
168507
168734
|
return cycle?.resolve;
|
|
168508
168735
|
}
|
|
168509
168736
|
async resolveWaitUntilFlush() {
|
|
168510
|
-
const
|
|
168737
|
+
const resolve39 = this._consumeWaitUntilCycle();
|
|
168511
168738
|
try {
|
|
168512
168739
|
await super.flush();
|
|
168513
168740
|
} catch {} finally {
|
|
168514
|
-
|
|
168741
|
+
resolve39?.();
|
|
168515
168742
|
}
|
|
168516
168743
|
}
|
|
168517
168744
|
getPersistedProperty(key) {
|
|
@@ -168611,15 +168838,15 @@ class PostHogBackendClient extends PostHogCoreStateless {
|
|
|
168611
168838
|
return true;
|
|
168612
168839
|
if (this.featureFlagsPoller === undefined)
|
|
168613
168840
|
return false;
|
|
168614
|
-
return new Promise((
|
|
168841
|
+
return new Promise((resolve39) => {
|
|
168615
168842
|
const timeout = setTimeout(() => {
|
|
168616
168843
|
cleanup();
|
|
168617
|
-
|
|
168844
|
+
resolve39(false);
|
|
168618
168845
|
}, timeoutMs);
|
|
168619
168846
|
const cleanup = this._events.on("localEvaluationFlagsLoaded", (count) => {
|
|
168620
168847
|
clearTimeout(timeout);
|
|
168621
168848
|
cleanup();
|
|
168622
|
-
|
|
168849
|
+
resolve39(count > 0);
|
|
168623
168850
|
});
|
|
168624
168851
|
});
|
|
168625
168852
|
}
|
|
@@ -169125,13 +169352,13 @@ class PostHogBackendClient extends PostHogCoreStateless {
|
|
|
169125
169352
|
this.context?.enter(data, options);
|
|
169126
169353
|
}
|
|
169127
169354
|
async _shutdown(shutdownTimeoutMs) {
|
|
169128
|
-
const
|
|
169355
|
+
const resolve39 = this._consumeWaitUntilCycle();
|
|
169129
169356
|
await this.featureFlagsPoller?.stopPoller(shutdownTimeoutMs);
|
|
169130
169357
|
this.errorTracking.shutdown();
|
|
169131
169358
|
try {
|
|
169132
169359
|
return await super._shutdown(shutdownTimeoutMs);
|
|
169133
169360
|
} finally {
|
|
169134
|
-
|
|
169361
|
+
resolve39?.();
|
|
169135
169362
|
}
|
|
169136
169363
|
}
|
|
169137
169364
|
async _requestRemoteConfigPayload(flagKey) {
|