oh-my-opencode 4.12.0 → 4.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.js +36 -17
- package/dist/cli-node/index.js +36 -17
- package/dist/index.js +361 -254
- package/dist/skills/ultraresearch/SKILL.md +11 -2
- package/dist/tools/background-task/constants.d.ts +1 -1
- package/dist/tui.js +9 -3
- package/package.json +13 -13
- package/packages/omo-codex/plugin/.codex-plugin/plugin.json +3 -1
- package/packages/omo-codex/plugin/components/bootstrap/package.json +1 -1
- package/packages/omo-codex/plugin/components/codegraph/dist/cli.js +327 -171
- package/packages/omo-codex/plugin/components/codegraph/dist/serve.js +275 -31
- package/packages/omo-codex/plugin/components/codegraph/package.json +1 -1
- package/packages/omo-codex/plugin/components/codegraph/src/cli.ts +11 -0
- package/packages/omo-codex/plugin/components/codegraph/src/hook-types.ts +12 -0
- package/packages/omo-codex/plugin/components/codegraph/src/hook.ts +34 -0
- package/packages/omo-codex/plugin/components/codegraph/src/serve.ts +40 -3
- package/packages/omo-codex/plugin/components/codegraph/src/session-start-worker.ts +6 -5
- package/packages/omo-codex/plugin/components/codegraph/test/hook.test.ts +49 -87
- package/packages/omo-codex/plugin/components/codegraph/test/provisioned-node-guard.test.ts +1 -1
- package/packages/omo-codex/plugin/components/codegraph/test/serve-provision.test.ts +48 -0
- package/packages/omo-codex/plugin/components/codegraph/test/serve.test.ts +1 -0
- package/packages/omo-codex/plugin/components/codegraph/test/session-start-node-support.test.ts +142 -0
- package/packages/omo-codex/plugin/components/comment-checker/package.json +1 -1
- package/packages/omo-codex/plugin/components/git-bash/package.json +1 -1
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/package.json +1 -1
- package/packages/omo-codex/plugin/components/lsp/package.json +1 -1
- package/packages/omo-codex/plugin/components/rules/package.json +1 -1
- package/packages/omo-codex/plugin/components/start-work-continuation/package.json +1 -1
- package/packages/omo-codex/plugin/components/teammode/dist/cli.js +94 -0
- package/packages/omo-codex/plugin/components/teammode/hooks/hooks.json +17 -0
- package/packages/omo-codex/plugin/components/teammode/package.json +26 -0
- package/packages/omo-codex/plugin/components/teammode/src/cli.ts +12 -0
- package/packages/omo-codex/plugin/components/teammode/src/codex-hook.ts +125 -0
- package/packages/omo-codex/plugin/components/teammode/test/thread-title-hook.test.ts +116 -0
- package/packages/omo-codex/plugin/components/teammode/tsconfig.json +25 -0
- package/packages/omo-codex/plugin/components/telemetry/package.json +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/package.json +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/package.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-checking-codegraph-init-guidance.json +17 -0
- package/packages/omo-codex/plugin/hooks/post-tool-use-checking-thread-title-hygiene.json +17 -0
- package/packages/omo-codex/plugin/hooks/session-start-checking-codegraph-bootstrap.json +1 -1
- package/packages/omo-codex/plugin/package-lock.json +30 -12
- package/packages/omo-codex/plugin/package.json +2 -1
- package/packages/omo-codex/plugin/scripts/hook-status-message.mjs +1 -0
- package/packages/omo-codex/plugin/skills/ultraresearch/SKILL.md +11 -2
- package/packages/omo-codex/plugin/test/aggregate-hooks.test.mjs +36 -0
- package/packages/omo-codex/plugin/test/aggregate-manifest.test.mjs +2 -1
- package/packages/omo-codex/plugin/test/aggregate-plugin-fixture.mjs +1 -1
- package/packages/omo-codex/plugin/test/component-bundled-cli.test.mjs +1 -0
- package/packages/omo-codex/plugin/test/component-hook-contract-cases.mjs +24 -0
- package/packages/omo-codex/plugin/test/hook-status-message.test.mjs +1 -0
- package/packages/omo-codex/plugin/test/ultraresearch-skill-contract.test.mjs +48 -0
- package/packages/omo-codex/scripts/install-dist/install-local.mjs +14 -1
- package/packages/shared-skills/skills/ultraresearch/SKILL.md +11 -2
package/dist/index.js
CHANGED
|
@@ -5798,6 +5798,201 @@ function buildCodegraphEnv(options = {}) {
|
|
|
5798
5798
|
var CODEGRAPH_INSTALL_DIR_ENV = "CODEGRAPH_INSTALL_DIR", CODEGRAPH_NO_DOWNLOAD_ENV = "CODEGRAPH_NO_DOWNLOAD", CODEGRAPH_TELEMETRY_ENV = "CODEGRAPH_TELEMETRY", DO_NOT_TRACK_ENV = "DO_NOT_TRACK";
|
|
5799
5799
|
var init_env = () => {};
|
|
5800
5800
|
|
|
5801
|
+
// packages/utils/src/codegraph/workspace.ts
|
|
5802
|
+
import { createHash as createHash2 } from "crypto";
|
|
5803
|
+
import {
|
|
5804
|
+
appendFileSync as appendFileSync2,
|
|
5805
|
+
existsSync as existsSync5,
|
|
5806
|
+
lstatSync as lstatSync2,
|
|
5807
|
+
mkdirSync as mkdirSync2,
|
|
5808
|
+
readFileSync as readFileSync2,
|
|
5809
|
+
readdirSync,
|
|
5810
|
+
realpathSync as realpathSync3,
|
|
5811
|
+
rmSync,
|
|
5812
|
+
statSync as statSync3,
|
|
5813
|
+
symlinkSync
|
|
5814
|
+
} from "fs";
|
|
5815
|
+
import { homedir as homedir3 } from "os";
|
|
5816
|
+
import { basename as basename3, join as join9, resolve as resolve4 } from "path";
|
|
5817
|
+
function sanitizeBase(value) {
|
|
5818
|
+
const sanitized = value.replace(/[^A-Za-z0-9._-]/g, "-").replace(/-+/g, "-");
|
|
5819
|
+
return sanitized.length > 0 ? sanitized : "workspace";
|
|
5820
|
+
}
|
|
5821
|
+
function codegraphDataRoot(homeDir) {
|
|
5822
|
+
return join9(homeDir, ".omo", "codegraph");
|
|
5823
|
+
}
|
|
5824
|
+
function workspaceStorageName(workspace) {
|
|
5825
|
+
const resolved = resolve4(workspace);
|
|
5826
|
+
const hash = createHash2("sha256").update(resolved).digest("hex").slice(0, 16);
|
|
5827
|
+
return `${sanitizeBase(basename3(resolved))}-${hash}`;
|
|
5828
|
+
}
|
|
5829
|
+
function resolveCodegraphWorkspacePaths(workspace, options = {}) {
|
|
5830
|
+
const resolvedWorkspace = resolve4(workspace);
|
|
5831
|
+
const dataRoot = codegraphDataRoot(options.homeDir ?? homedir3());
|
|
5832
|
+
return {
|
|
5833
|
+
dataDir: join9(dataRoot, "projects", workspaceStorageName(resolvedWorkspace)),
|
|
5834
|
+
dataRoot,
|
|
5835
|
+
projectLink: join9(resolvedWorkspace, ".codegraph")
|
|
5836
|
+
};
|
|
5837
|
+
}
|
|
5838
|
+
function fallbackResult(dataRoot, projectLink, reason) {
|
|
5839
|
+
return { dataDir: projectLink, dataRoot, linked: false, mode: "in-place-fallback", projectLink, reason };
|
|
5840
|
+
}
|
|
5841
|
+
function isSameFilesystem(workspace, dataRoot, override) {
|
|
5842
|
+
if (override !== undefined)
|
|
5843
|
+
return override;
|
|
5844
|
+
return statSync3(workspace).dev === statSync3(dataRoot).dev;
|
|
5845
|
+
}
|
|
5846
|
+
function ensureInPlaceFallback(projectLink) {
|
|
5847
|
+
if (!existsSync5(projectLink))
|
|
5848
|
+
mkdirSync2(projectLink, { recursive: true });
|
|
5849
|
+
}
|
|
5850
|
+
function prepareCodegraphWorkspace(workspace, options = {}) {
|
|
5851
|
+
const resolvedWorkspace = resolve4(workspace);
|
|
5852
|
+
const { dataDir, dataRoot, projectLink } = resolveCodegraphWorkspacePaths(resolvedWorkspace, options);
|
|
5853
|
+
try {
|
|
5854
|
+
mkdirSync2(dataDir, { recursive: true });
|
|
5855
|
+
if (existsSync5(projectLink)) {
|
|
5856
|
+
const linkStat = lstatSync2(projectLink);
|
|
5857
|
+
if (!linkStat.isSymbolicLink()) {
|
|
5858
|
+
return { dataDir: projectLink, dataRoot, linked: false, mode: "in-project", projectLink };
|
|
5859
|
+
}
|
|
5860
|
+
if (realpathSync3(projectLink) === realpathSync3(dataDir)) {
|
|
5861
|
+
return { dataDir, dataRoot, linked: true, mode: "global-linked", projectLink };
|
|
5862
|
+
}
|
|
5863
|
+
return fallbackResult(dataRoot, projectLink, "existing .codegraph symlink points outside OMO store");
|
|
5864
|
+
}
|
|
5865
|
+
if (!isSameFilesystem(resolvedWorkspace, dataRoot, options.sameFilesystem)) {
|
|
5866
|
+
ensureInPlaceFallback(projectLink);
|
|
5867
|
+
return fallbackResult(dataRoot, projectLink, "workspace and OMO store are on different filesystems");
|
|
5868
|
+
}
|
|
5869
|
+
const symlink = options.symlink ?? symlinkSync;
|
|
5870
|
+
symlink(dataDir, projectLink, (options.platform ?? process.platform) === "win32" ? "junction" : "dir");
|
|
5871
|
+
return { dataDir, dataRoot, linked: true, mode: "global-linked", projectLink };
|
|
5872
|
+
} catch (error) {
|
|
5873
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
5874
|
+
try {
|
|
5875
|
+
ensureInPlaceFallback(projectLink);
|
|
5876
|
+
} catch (fallbackError) {
|
|
5877
|
+
return fallbackResult(dataRoot, projectLink, `${reason}; fallback failed: ${String(fallbackError)}`);
|
|
5878
|
+
}
|
|
5879
|
+
return fallbackResult(dataRoot, projectLink, reason);
|
|
5880
|
+
}
|
|
5881
|
+
}
|
|
5882
|
+
function ensureCodegraphGitignored(workspace) {
|
|
5883
|
+
const gitDir = join9(workspace, ".git");
|
|
5884
|
+
if (!existsSync5(gitDir))
|
|
5885
|
+
return false;
|
|
5886
|
+
const excludePath = join9(gitDir, "info", "exclude");
|
|
5887
|
+
try {
|
|
5888
|
+
mkdirSync2(join9(gitDir, "info"), { recursive: true });
|
|
5889
|
+
const existing = existsSync5(excludePath) ? readFileSync2(excludePath, "utf8") : "";
|
|
5890
|
+
if (existing.split(/\r?\n/).includes(".codegraph"))
|
|
5891
|
+
return true;
|
|
5892
|
+
appendFileSync2(excludePath, `${existing.endsWith(`
|
|
5893
|
+
`) || existing.length === 0 ? "" : `
|
|
5894
|
+
`}.codegraph
|
|
5895
|
+
`);
|
|
5896
|
+
return true;
|
|
5897
|
+
} catch (error) {
|
|
5898
|
+
if (error instanceof Error)
|
|
5899
|
+
return false;
|
|
5900
|
+
throw error;
|
|
5901
|
+
}
|
|
5902
|
+
}
|
|
5903
|
+
var init_workspace = () => {};
|
|
5904
|
+
|
|
5905
|
+
// packages/utils/src/codegraph/guidance.ts
|
|
5906
|
+
import { homedir as homedir4 } from "os";
|
|
5907
|
+
function getCodegraphUninitializedProject(input) {
|
|
5908
|
+
const output = textFromUnknown(input.toolOutput);
|
|
5909
|
+
if (!isCodegraphTool(input.toolName))
|
|
5910
|
+
return null;
|
|
5911
|
+
const projectPath = extractProjectPath(output);
|
|
5912
|
+
if (projectPath !== null)
|
|
5913
|
+
return projectPath;
|
|
5914
|
+
if (!looksLikeCodegraphUninitializedOutput(output))
|
|
5915
|
+
return null;
|
|
5916
|
+
return typeof input.cwd === "string" && input.cwd.trim().length > 0 ? input.cwd.trim() : null;
|
|
5917
|
+
}
|
|
5918
|
+
function buildCodegraphInitGuidance(projectPath, options = {}) {
|
|
5919
|
+
const { dataDir, dataRoot, projectLink } = resolveCodegraphWorkspacePaths(projectPath, {
|
|
5920
|
+
homeDir: options.homeDir ?? homedir4()
|
|
5921
|
+
});
|
|
5922
|
+
const displayProjectPath = formatDisplayPath(projectPath);
|
|
5923
|
+
const displayProjectLink = formatDisplayPath(projectLink);
|
|
5924
|
+
const displayDataDir = formatDisplayPath(dataDir);
|
|
5925
|
+
const displayDataRoot = formatDisplayPath(dataRoot);
|
|
5926
|
+
return [
|
|
5927
|
+
"OMO CodeGraph initialization guidance:",
|
|
5928
|
+
"",
|
|
5929
|
+
`CodeGraph is not initialized for ${displayProjectPath}. Initialize it through OMO's global local store instead of leaving a standalone project-local index.`,
|
|
5930
|
+
"",
|
|
5931
|
+
`- Link or create ${displayProjectLink} so it points at ${displayDataDir} under the OMO store ${displayDataRoot}.`,
|
|
5932
|
+
`- Then run \`codegraph init\` from ${displayProjectPath} and retry the CodeGraph tool.`,
|
|
5933
|
+
"- OMO's CodeGraph bootstrap does this automatically on session start; if bootstrap just ran, wait for it to finish and retry."
|
|
5934
|
+
].join(`
|
|
5935
|
+
`);
|
|
5936
|
+
}
|
|
5937
|
+
function buildCodegraphInitGuidanceForToolResult(input, options = {}) {
|
|
5938
|
+
const projectPath = getCodegraphUninitializedProject(input);
|
|
5939
|
+
return projectPath === null ? null : buildCodegraphInitGuidance(projectPath, options);
|
|
5940
|
+
}
|
|
5941
|
+
function extractProjectPath(output) {
|
|
5942
|
+
const normalizedOutput = normalizeCodegraphOutput(output);
|
|
5943
|
+
const uninitializedMatch = normalizedOutput.match(CODEGRAPH_UNINITIALIZED_PATTERN);
|
|
5944
|
+
const uninitializedProject = uninitializedMatch?.[1]?.trim();
|
|
5945
|
+
if (uninitializedProject && uninitializedProject.length > 0)
|
|
5946
|
+
return uninitializedProject;
|
|
5947
|
+
if (!looksLikeCodegraphUninitializedOutput(normalizedOutput))
|
|
5948
|
+
return null;
|
|
5949
|
+
const statusMatch = normalizedOutput.match(CODEGRAPH_STATUS_PROJECT_PATTERN);
|
|
5950
|
+
const statusProject = statusMatch?.[1]?.trim();
|
|
5951
|
+
return statusProject && statusProject.length > 0 ? statusProject : null;
|
|
5952
|
+
}
|
|
5953
|
+
function looksLikeCodegraphUninitializedOutput(output) {
|
|
5954
|
+
const normalizedOutput = normalizeCodegraphOutput(output);
|
|
5955
|
+
if (normalizedOutput.match(CODEGRAPH_UNINITIALIZED_PATTERN) !== null)
|
|
5956
|
+
return true;
|
|
5957
|
+
return CODEGRAPH_STATUS_UNINITIALIZED_PATTERN.test(normalizedOutput) && CODEGRAPH_INIT_HINT_PATTERN.test(normalizedOutput);
|
|
5958
|
+
}
|
|
5959
|
+
function normalizeCodegraphOutput(output) {
|
|
5960
|
+
return output.replace(ANSI_ESCAPE_PATTERN, "");
|
|
5961
|
+
}
|
|
5962
|
+
function isCodegraphTool(toolName) {
|
|
5963
|
+
if (typeof toolName !== "string")
|
|
5964
|
+
return false;
|
|
5965
|
+
return toolName.startsWith("codegraph.") || toolName.startsWith("codegraph_") || toolName.startsWith("mcp__codegraph__");
|
|
5966
|
+
}
|
|
5967
|
+
function formatDisplayPath(value) {
|
|
5968
|
+
return JSON.stringify(value);
|
|
5969
|
+
}
|
|
5970
|
+
function textFromUnknown(value) {
|
|
5971
|
+
if (typeof value === "string")
|
|
5972
|
+
return value;
|
|
5973
|
+
if (typeof value === "number" || typeof value === "boolean" || typeof value === "bigint")
|
|
5974
|
+
return String(value);
|
|
5975
|
+
if (Array.isArray(value))
|
|
5976
|
+
return value.map(textFromUnknown).filter(Boolean).join(`
|
|
5977
|
+
`);
|
|
5978
|
+
if (!isRecord2(value))
|
|
5979
|
+
return "";
|
|
5980
|
+
return Object.entries(value).map(([key, nested]) => `${key}: ${textFromUnknown(nested)}`).filter((line) => line.trim().length > 0).join(`
|
|
5981
|
+
`);
|
|
5982
|
+
}
|
|
5983
|
+
function isRecord2(value) {
|
|
5984
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5985
|
+
}
|
|
5986
|
+
var CODEGRAPH_UNINITIALIZED_PATTERN, ANSI_ESCAPE_PATTERN, CODEGRAPH_STATUS_PROJECT_PATTERN, CODEGRAPH_STATUS_UNINITIALIZED_PATTERN, CODEGRAPH_INIT_HINT_PATTERN;
|
|
5987
|
+
var init_guidance = __esm(() => {
|
|
5988
|
+
init_workspace();
|
|
5989
|
+
CODEGRAPH_UNINITIALIZED_PATTERN = /CodeGraph not initialized in ([\s\S]*?)\.\s*Run ['`]codegraph init['`] in that project first\./i;
|
|
5990
|
+
ANSI_ESCAPE_PATTERN = /\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])/g;
|
|
5991
|
+
CODEGRAPH_STATUS_PROJECT_PATTERN = /^.*?\bProject:\s*(.+?)\s*$/im;
|
|
5992
|
+
CODEGRAPH_STATUS_UNINITIALIZED_PATTERN = /^.*?\bNot initialized\s*$/im;
|
|
5993
|
+
CODEGRAPH_INIT_HINT_PATTERN = /Run\s+["'`]codegraph init["'`]\s+(?:in that project first|to initialize)\.?/i;
|
|
5994
|
+
});
|
|
5995
|
+
|
|
5801
5996
|
// packages/utils/src/codegraph/node-support.ts
|
|
5802
5997
|
function evaluateCodegraphNodeSupport(options = {}) {
|
|
5803
5998
|
const nodeVersion = options.nodeVersion ?? process.versions.node;
|
|
@@ -5860,24 +6055,24 @@ var init_manifest = __esm(() => {
|
|
|
5860
6055
|
});
|
|
5861
6056
|
|
|
5862
6057
|
// packages/utils/src/codegraph/provision.ts
|
|
5863
|
-
import { createHash as
|
|
6058
|
+
import { createHash as createHash3, randomUUID as randomUUID2 } from "crypto";
|
|
5864
6059
|
import { execFile } from "child_process";
|
|
5865
6060
|
import { chmod as chmod2, mkdir as mkdir2, readdir, readFile as readFile2, rename as rename2, rm as rm2, rmdir, stat, writeFile as writeFile3 } from "fs/promises";
|
|
5866
|
-
import { existsSync as
|
|
5867
|
-
import { homedir as
|
|
5868
|
-
import { basename as
|
|
6061
|
+
import { existsSync as existsSync6 } from "fs";
|
|
6062
|
+
import { homedir as homedir5, hostname } from "os";
|
|
6063
|
+
import { basename as basename4, join as join10 } from "path";
|
|
5869
6064
|
import { promisify } from "util";
|
|
5870
6065
|
function platformKey() {
|
|
5871
6066
|
return `${process.platform}-${process.arch}`;
|
|
5872
6067
|
}
|
|
5873
6068
|
function markerPath(installDir, version) {
|
|
5874
|
-
return
|
|
6069
|
+
return join10(installDir, ".provisioned", `codegraph-${version}.json`);
|
|
5875
6070
|
}
|
|
5876
6071
|
function defaultInstallDir() {
|
|
5877
|
-
return
|
|
6072
|
+
return join10(homedir5(), ".omo", "codegraph");
|
|
5878
6073
|
}
|
|
5879
6074
|
function sha2562(bytes) {
|
|
5880
|
-
return
|
|
6075
|
+
return createHash3("sha256").update(bytes).digest("hex");
|
|
5881
6076
|
}
|
|
5882
6077
|
function isErrnoException(error) {
|
|
5883
6078
|
return error instanceof Error && "code" in error;
|
|
@@ -5894,7 +6089,7 @@ async function removeEmptyDirectory(path4) {
|
|
|
5894
6089
|
}
|
|
5895
6090
|
}
|
|
5896
6091
|
function sleep(ms) {
|
|
5897
|
-
return new Promise((
|
|
6092
|
+
return new Promise((resolve5) => setTimeout(resolve5, ms));
|
|
5898
6093
|
}
|
|
5899
6094
|
async function defaultDownloader(asset, timeoutMs = DEFAULT_DOWNLOAD_TIMEOUT_MS2) {
|
|
5900
6095
|
const response = await fetch(asset.url, { signal: AbortSignal.timeout(timeoutMs) });
|
|
@@ -5908,7 +6103,7 @@ function forcedBadChecksumOptions(options) {
|
|
|
5908
6103
|
const key = options.platformKey ?? platformKey();
|
|
5909
6104
|
return {
|
|
5910
6105
|
downloader: async () => new TextEncoder().encode("checksum mismatch"),
|
|
5911
|
-
installDir: options.installDir ??
|
|
6106
|
+
installDir: options.installDir ?? join10(options.lockDir, "codegraph-force-bad-checksum"),
|
|
5912
6107
|
manifest: {
|
|
5913
6108
|
assets: {
|
|
5914
6109
|
[key]: { executableName: process.platform === "win32" ? "codegraph.cmd" : "codegraph", sha256: "0000", url: "memory://bad" }
|
|
@@ -5919,13 +6114,13 @@ function forcedBadChecksumOptions(options) {
|
|
|
5919
6114
|
};
|
|
5920
6115
|
}
|
|
5921
6116
|
async function readMarker(path4) {
|
|
5922
|
-
if (!
|
|
6117
|
+
if (!existsSync6(path4))
|
|
5923
6118
|
return null;
|
|
5924
6119
|
try {
|
|
5925
6120
|
const raw = JSON.parse(await readFile2(path4, "utf8"));
|
|
5926
6121
|
if (typeof raw === "object" && raw !== null && "binPath" in raw) {
|
|
5927
6122
|
const value = raw.binPath;
|
|
5928
|
-
return typeof value === "string" &&
|
|
6123
|
+
return typeof value === "string" && existsSync6(value) ? value : null;
|
|
5929
6124
|
}
|
|
5930
6125
|
return null;
|
|
5931
6126
|
} catch (error) {
|
|
@@ -5936,7 +6131,7 @@ async function readMarker(path4) {
|
|
|
5936
6131
|
}
|
|
5937
6132
|
async function acquireLock(lockPath, waitMs, staleMs) {
|
|
5938
6133
|
const startedAt = Date.now();
|
|
5939
|
-
await mkdir2(
|
|
6134
|
+
await mkdir2(join10(lockPath, ".."), { recursive: true });
|
|
5940
6135
|
while (Date.now() - startedAt <= waitMs) {
|
|
5941
6136
|
try {
|
|
5942
6137
|
await mkdir2(lockPath);
|
|
@@ -5961,44 +6156,44 @@ async function installExtractedBundle(extractDir, installDir, executableName) {
|
|
|
5961
6156
|
const roots = await readdir(extractDir);
|
|
5962
6157
|
if (roots.length !== 1)
|
|
5963
6158
|
throw new Error(`CodeGraph archive should contain one root directory, found ${roots.length}`);
|
|
5964
|
-
const bundleDir =
|
|
6159
|
+
const bundleDir = join10(extractDir, roots[0] ?? "");
|
|
5965
6160
|
const bundleEntries = await readdir(bundleDir);
|
|
5966
6161
|
await mkdir2(installDir, { recursive: true });
|
|
5967
6162
|
for (const entry of bundleEntries) {
|
|
5968
|
-
await rm2(
|
|
5969
|
-
await rename2(
|
|
6163
|
+
await rm2(join10(installDir, entry), { force: true, recursive: true });
|
|
6164
|
+
await rename2(join10(bundleDir, entry), join10(installDir, entry));
|
|
5970
6165
|
}
|
|
5971
|
-
const destination =
|
|
5972
|
-
if (!
|
|
6166
|
+
const destination = join10(installDir, "bin", executableName);
|
|
6167
|
+
if (!existsSync6(destination))
|
|
5973
6168
|
throw new Error(`CodeGraph archive did not contain bin/${executableName}`);
|
|
5974
6169
|
await chmod2(destination, 493);
|
|
5975
6170
|
return destination;
|
|
5976
6171
|
}
|
|
5977
6172
|
async function installAsset(layout) {
|
|
5978
6173
|
const { asset, downloader, installDir, version } = layout;
|
|
5979
|
-
const stagingDir =
|
|
5980
|
-
const archivePath =
|
|
5981
|
-
const extractDir =
|
|
6174
|
+
const stagingDir = join10(installDir, ".staging", randomUUID2());
|
|
6175
|
+
const archivePath = join10(stagingDir, basename4(asset.url));
|
|
6176
|
+
const extractDir = join10(stagingDir, "extract");
|
|
5982
6177
|
try {
|
|
5983
6178
|
await mkdir2(extractDir, { recursive: true });
|
|
5984
6179
|
const bytes = await downloader(asset);
|
|
5985
6180
|
const actualChecksum = sha2562(bytes);
|
|
5986
6181
|
if (actualChecksum !== asset.sha256) {
|
|
5987
|
-
throw new Error(`checksum mismatch for ${
|
|
6182
|
+
throw new Error(`checksum mismatch for ${basename4(asset.url)}: expected ${asset.sha256}, got ${actualChecksum}`);
|
|
5988
6183
|
}
|
|
5989
6184
|
if (!asset.url.endsWith(".tar.gz") && !asset.url.endsWith(".tgz")) {
|
|
5990
|
-
throw new Error(`unsupported CodeGraph archive type for ${
|
|
6185
|
+
throw new Error(`unsupported CodeGraph archive type for ${basename4(asset.url)}`);
|
|
5991
6186
|
}
|
|
5992
6187
|
await writeFile3(archivePath, bytes);
|
|
5993
6188
|
await extractTarGz(archivePath, extractDir);
|
|
5994
6189
|
const destination = await installExtractedBundle(extractDir, installDir, asset.executableName);
|
|
5995
|
-
await mkdir2(
|
|
6190
|
+
await mkdir2(join10(installDir, ".provisioned"), { recursive: true });
|
|
5996
6191
|
await writeFile3(markerPath(installDir, version), `${JSON.stringify({ binPath: destination, version })}
|
|
5997
6192
|
`);
|
|
5998
6193
|
return destination;
|
|
5999
6194
|
} finally {
|
|
6000
6195
|
await rm2(stagingDir, { force: true, recursive: true });
|
|
6001
|
-
await removeEmptyDirectory(
|
|
6196
|
+
await removeEmptyDirectory(join10(installDir, ".staging"));
|
|
6002
6197
|
}
|
|
6003
6198
|
}
|
|
6004
6199
|
async function ensureCodegraphProvisioned(options) {
|
|
@@ -6011,7 +6206,7 @@ async function ensureCodegraphProvisioned(options) {
|
|
|
6011
6206
|
const existing = await readMarker(marker);
|
|
6012
6207
|
if (existing !== null)
|
|
6013
6208
|
return { binPath: existing, provisioned: true };
|
|
6014
|
-
const lockPath =
|
|
6209
|
+
const lockPath = join10(options.lockDir, `codegraph-${hostname()}.lock`);
|
|
6015
6210
|
const release = await acquireLock(lockPath, options.lockWaitMs ?? DEFAULT_LOCK_WAIT_MS, options.lockStaleMs ?? DEFAULT_LOCK_STALE_MS);
|
|
6016
6211
|
if (release === null)
|
|
6017
6212
|
return { error: "timed out waiting for codegraph provisioning lock", provisioned: false };
|
|
@@ -6041,10 +6236,10 @@ var init_provision = __esm(() => {
|
|
|
6041
6236
|
});
|
|
6042
6237
|
|
|
6043
6238
|
// packages/utils/src/codegraph/resolve.ts
|
|
6044
|
-
import { existsSync as
|
|
6045
|
-
import { homedir as
|
|
6239
|
+
import { existsSync as existsSync7 } from "fs";
|
|
6240
|
+
import { homedir as homedir6 } from "os";
|
|
6046
6241
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
6047
|
-
import { basename as
|
|
6242
|
+
import { basename as basename5, dirname as dirname3, join as join11 } from "path";
|
|
6048
6243
|
import { createRequire } from "module";
|
|
6049
6244
|
function defaultRequireResolve(specifier) {
|
|
6050
6245
|
return requireFromHere.resolve(specifier);
|
|
@@ -6070,7 +6265,7 @@ ${result.stderr}`.trim().split(/\s+/)[0];
|
|
|
6070
6265
|
}
|
|
6071
6266
|
}
|
|
6072
6267
|
function isNodeExecutableName(filePath) {
|
|
6073
|
-
const executable =
|
|
6268
|
+
const executable = basename5(filePath).toLowerCase();
|
|
6074
6269
|
return executable === "node" || executable === "node.exe" || /^node\d+(\.exe)?$/.test(executable);
|
|
6075
6270
|
}
|
|
6076
6271
|
function looksLikePath(command) {
|
|
@@ -6109,7 +6304,7 @@ function defaultNodeRuntime(env, fileExists, which2, nodeVersion) {
|
|
|
6109
6304
|
}
|
|
6110
6305
|
function resolveCodegraphNodeRuntime(options = {}) {
|
|
6111
6306
|
const env = options.env ?? process.env;
|
|
6112
|
-
return defaultNodeRuntime(env, options.fileExists ??
|
|
6307
|
+
return defaultNodeRuntime(env, options.fileExists ?? existsSync7, options.which ?? bunWhich, options.nodeVersion ?? defaultNodeVersion);
|
|
6113
6308
|
}
|
|
6114
6309
|
function resolveCodegraphNodeSupport(options = {}) {
|
|
6115
6310
|
const env = options.env ?? process.env;
|
|
@@ -6123,8 +6318,8 @@ function resolveCodegraphNodeSupport(options = {}) {
|
|
|
6123
6318
|
function defaultProvisionedBin(homeDir, fileExists) {
|
|
6124
6319
|
const binaryName = process.platform === "win32" ? "codegraph.cmd" : "codegraph";
|
|
6125
6320
|
const candidates = [
|
|
6126
|
-
|
|
6127
|
-
|
|
6321
|
+
join11(homeDir, ".omo", "codegraph", "bin", binaryName),
|
|
6322
|
+
join11(homeDir, ".omo", "codegraph", "node-servers", "node_modules", ".bin", binaryName)
|
|
6128
6323
|
];
|
|
6129
6324
|
return candidates.find((candidate) => fileExists(candidate)) ?? null;
|
|
6130
6325
|
}
|
|
@@ -6132,7 +6327,7 @@ function resolveBundledShim(requireResolve, fileExists) {
|
|
|
6132
6327
|
try {
|
|
6133
6328
|
const packageJson = requireResolve(`${CODEGRAPH_PACKAGE}/package.json`);
|
|
6134
6329
|
const packageRoot = dirname3(packageJson);
|
|
6135
|
-
const candidates = [
|
|
6330
|
+
const candidates = [join11(packageRoot, "bin", "codegraph.js"), join11(packageRoot, "npm-shim.js")];
|
|
6136
6331
|
return candidates.find((candidate) => fileExists(candidate)) ?? null;
|
|
6137
6332
|
} catch (error) {
|
|
6138
6333
|
if (error instanceof Error)
|
|
@@ -6148,7 +6343,7 @@ function resolveBundledShim(requireResolve, fileExists) {
|
|
|
6148
6343
|
}
|
|
6149
6344
|
function resolveCodegraphCommand(options = {}) {
|
|
6150
6345
|
const env = options.env ?? process.env;
|
|
6151
|
-
const fileExists = options.fileExists ??
|
|
6346
|
+
const fileExists = options.fileExists ?? existsSync7;
|
|
6152
6347
|
const configuredBin = env[CODEGRAPH_ENV_BIN]?.trim() || env[CODEGRAPH_LEGACY_ENV_BIN]?.trim();
|
|
6153
6348
|
if (configuredBin !== undefined && configuredBin.length > 0) {
|
|
6154
6349
|
return { argsPrefix: [], command: configuredBin, exists: fileExists(configuredBin), source: "env" };
|
|
@@ -6160,7 +6355,7 @@ function resolveCodegraphCommand(options = {}) {
|
|
|
6160
6355
|
if (bundled !== null && runtime4 !== null) {
|
|
6161
6356
|
return { argsPrefix: [bundled], command: runtime4, exists: true, source: "bundled" };
|
|
6162
6357
|
}
|
|
6163
|
-
const provisioned = options.provisioned?.() ?? defaultProvisionedBin(options.homeDir ??
|
|
6358
|
+
const provisioned = options.provisioned?.() ?? defaultProvisionedBin(options.homeDir ?? homedir6(), fileExists);
|
|
6164
6359
|
if (provisioned !== null && fileExists(provisioned)) {
|
|
6165
6360
|
return { argsPrefix: [], command: provisioned, exists: true, source: "provisioned" };
|
|
6166
6361
|
}
|
|
@@ -6179,115 +6374,19 @@ var init_resolve2 = __esm(() => {
|
|
|
6179
6374
|
requireFromHere = createRequire(import.meta.url);
|
|
6180
6375
|
});
|
|
6181
6376
|
|
|
6182
|
-
// packages/utils/src/codegraph/workspace.ts
|
|
6183
|
-
import { createHash as createHash3 } from "crypto";
|
|
6184
|
-
import {
|
|
6185
|
-
appendFileSync as appendFileSync2,
|
|
6186
|
-
existsSync as existsSync7,
|
|
6187
|
-
lstatSync as lstatSync2,
|
|
6188
|
-
mkdirSync as mkdirSync2,
|
|
6189
|
-
readFileSync as readFileSync2,
|
|
6190
|
-
readdirSync,
|
|
6191
|
-
realpathSync as realpathSync3,
|
|
6192
|
-
rmSync,
|
|
6193
|
-
statSync as statSync3,
|
|
6194
|
-
symlinkSync
|
|
6195
|
-
} from "fs";
|
|
6196
|
-
import { homedir as homedir5 } from "os";
|
|
6197
|
-
import { basename as basename5, join as join11, resolve as resolve4 } from "path";
|
|
6198
|
-
function sanitizeBase(value) {
|
|
6199
|
-
const sanitized = value.replace(/[^A-Za-z0-9._-]/g, "-").replace(/-+/g, "-");
|
|
6200
|
-
return sanitized.length > 0 ? sanitized : "workspace";
|
|
6201
|
-
}
|
|
6202
|
-
function codegraphDataRoot(homeDir) {
|
|
6203
|
-
return join11(homeDir, ".omo", "codegraph");
|
|
6204
|
-
}
|
|
6205
|
-
function workspaceStorageName(workspace) {
|
|
6206
|
-
const resolved = resolve4(workspace);
|
|
6207
|
-
const hash = createHash3("sha256").update(resolved).digest("hex").slice(0, 16);
|
|
6208
|
-
return `${sanitizeBase(basename5(resolved))}-${hash}`;
|
|
6209
|
-
}
|
|
6210
|
-
function fallbackResult(dataRoot, projectLink, reason) {
|
|
6211
|
-
return { dataDir: projectLink, dataRoot, linked: false, mode: "in-place-fallback", projectLink, reason };
|
|
6212
|
-
}
|
|
6213
|
-
function isSameFilesystem(workspace, dataRoot, override) {
|
|
6214
|
-
if (override !== undefined)
|
|
6215
|
-
return override;
|
|
6216
|
-
return statSync3(workspace).dev === statSync3(dataRoot).dev;
|
|
6217
|
-
}
|
|
6218
|
-
function ensureInPlaceFallback(projectLink) {
|
|
6219
|
-
if (!existsSync7(projectLink))
|
|
6220
|
-
mkdirSync2(projectLink, { recursive: true });
|
|
6221
|
-
}
|
|
6222
|
-
function prepareCodegraphWorkspace(workspace, options = {}) {
|
|
6223
|
-
const resolvedWorkspace = resolve4(workspace);
|
|
6224
|
-
const dataRoot = codegraphDataRoot(options.homeDir ?? homedir5());
|
|
6225
|
-
const dataDir = join11(dataRoot, "projects", workspaceStorageName(resolvedWorkspace));
|
|
6226
|
-
const projectLink = join11(resolvedWorkspace, ".codegraph");
|
|
6227
|
-
try {
|
|
6228
|
-
mkdirSync2(dataDir, { recursive: true });
|
|
6229
|
-
if (existsSync7(projectLink)) {
|
|
6230
|
-
const linkStat = lstatSync2(projectLink);
|
|
6231
|
-
if (!linkStat.isSymbolicLink()) {
|
|
6232
|
-
return { dataDir: projectLink, dataRoot, linked: false, mode: "in-project", projectLink };
|
|
6233
|
-
}
|
|
6234
|
-
if (realpathSync3(projectLink) === realpathSync3(dataDir)) {
|
|
6235
|
-
return { dataDir, dataRoot, linked: true, mode: "global-linked", projectLink };
|
|
6236
|
-
}
|
|
6237
|
-
return fallbackResult(dataRoot, projectLink, "existing .codegraph symlink points outside OMO store");
|
|
6238
|
-
}
|
|
6239
|
-
if (!isSameFilesystem(resolvedWorkspace, dataRoot, options.sameFilesystem)) {
|
|
6240
|
-
ensureInPlaceFallback(projectLink);
|
|
6241
|
-
return fallbackResult(dataRoot, projectLink, "workspace and OMO store are on different filesystems");
|
|
6242
|
-
}
|
|
6243
|
-
const symlink = options.symlink ?? symlinkSync;
|
|
6244
|
-
symlink(dataDir, projectLink, (options.platform ?? process.platform) === "win32" ? "junction" : "dir");
|
|
6245
|
-
return { dataDir, dataRoot, linked: true, mode: "global-linked", projectLink };
|
|
6246
|
-
} catch (error) {
|
|
6247
|
-
const reason = error instanceof Error ? error.message : String(error);
|
|
6248
|
-
try {
|
|
6249
|
-
ensureInPlaceFallback(projectLink);
|
|
6250
|
-
} catch (fallbackError) {
|
|
6251
|
-
return fallbackResult(dataRoot, projectLink, `${reason}; fallback failed: ${String(fallbackError)}`);
|
|
6252
|
-
}
|
|
6253
|
-
return fallbackResult(dataRoot, projectLink, reason);
|
|
6254
|
-
}
|
|
6255
|
-
}
|
|
6256
|
-
function ensureCodegraphGitignored(workspace) {
|
|
6257
|
-
const gitDir = join11(workspace, ".git");
|
|
6258
|
-
if (!existsSync7(gitDir))
|
|
6259
|
-
return false;
|
|
6260
|
-
const excludePath = join11(gitDir, "info", "exclude");
|
|
6261
|
-
try {
|
|
6262
|
-
mkdirSync2(join11(gitDir, "info"), { recursive: true });
|
|
6263
|
-
const existing = existsSync7(excludePath) ? readFileSync2(excludePath, "utf8") : "";
|
|
6264
|
-
if (existing.split(/\r?\n/).includes(".codegraph"))
|
|
6265
|
-
return true;
|
|
6266
|
-
appendFileSync2(excludePath, `${existing.endsWith(`
|
|
6267
|
-
`) || existing.length === 0 ? "" : `
|
|
6268
|
-
`}.codegraph
|
|
6269
|
-
`);
|
|
6270
|
-
return true;
|
|
6271
|
-
} catch (error) {
|
|
6272
|
-
if (error instanceof Error)
|
|
6273
|
-
return false;
|
|
6274
|
-
throw error;
|
|
6275
|
-
}
|
|
6276
|
-
}
|
|
6277
|
-
var init_workspace = () => {};
|
|
6278
|
-
|
|
6279
6377
|
// packages/utils/src/codegraph/index.ts
|
|
6280
6378
|
var init_codegraph = __esm(() => {
|
|
6281
6379
|
init_env();
|
|
6380
|
+
init_guidance();
|
|
6282
6381
|
init_provision();
|
|
6283
6382
|
init_resolve2();
|
|
6284
6383
|
init_workspace();
|
|
6285
6384
|
});
|
|
6286
6385
|
|
|
6287
6386
|
// packages/utils/src/command-executor/home-directory.ts
|
|
6288
|
-
import { homedir as
|
|
6387
|
+
import { homedir as homedir7 } from "os";
|
|
6289
6388
|
function getHomeDirectory() {
|
|
6290
|
-
return process.env.HOME || process.env.USERPROFILE ||
|
|
6389
|
+
return process.env.HOME || process.env.USERPROFILE || homedir7();
|
|
6291
6390
|
}
|
|
6292
6391
|
var init_home_directory = () => {};
|
|
6293
6392
|
|
|
@@ -12779,7 +12878,7 @@ var init_types2 = __esm(() => {
|
|
|
12779
12878
|
|
|
12780
12879
|
// packages/team-core/src/team-registry/paths.ts
|
|
12781
12880
|
import { mkdir as mkdir3, readdir as readdir2, stat as stat2, chmod as chmod3 } from "fs/promises";
|
|
12782
|
-
import { homedir as
|
|
12881
|
+
import { homedir as homedir23 } from "os";
|
|
12783
12882
|
import path14 from "path";
|
|
12784
12883
|
function getTeamDirectory(baseDir, teamName, scope, projectRoot) {
|
|
12785
12884
|
if (scope === "project") {
|
|
@@ -12802,7 +12901,7 @@ function resolveContainedPath2(baseDir, pathSegments) {
|
|
|
12802
12901
|
return resolvedPath;
|
|
12803
12902
|
}
|
|
12804
12903
|
function resolveBaseDir(config) {
|
|
12805
|
-
return config.base_dir ?? path14.join(
|
|
12904
|
+
return config.base_dir ?? path14.join(homedir23(), ".omo");
|
|
12806
12905
|
}
|
|
12807
12906
|
function getTeamSpecPath(baseDir, teamName, scope, projectRoot) {
|
|
12808
12907
|
return path14.join(getTeamDirectory(baseDir, teamName, scope, projectRoot), "config.json");
|
|
@@ -20506,7 +20605,7 @@ init_command_executor();
|
|
|
20506
20605
|
init_src();
|
|
20507
20606
|
// packages/omo-opencode/src/shared/file-reference-resolver.ts
|
|
20508
20607
|
import { existsSync as existsSync10, readFileSync as readFileSync6, statSync as statSync4 } from "fs";
|
|
20509
|
-
import { homedir as
|
|
20608
|
+
import { homedir as homedir8 } from "os";
|
|
20510
20609
|
import { isAbsolute as isAbsolute4, posix, resolve as resolve7, win32 } from "path";
|
|
20511
20610
|
init_logger2();
|
|
20512
20611
|
var FILE_REFERENCE_PATTERN = /@([^\s@]+)/g;
|
|
@@ -20525,7 +20624,7 @@ function expandEnvironmentVariable(match, variableName) {
|
|
|
20525
20624
|
return value;
|
|
20526
20625
|
}
|
|
20527
20626
|
if (variableName === "HOME") {
|
|
20528
|
-
return
|
|
20627
|
+
return homedir8();
|
|
20529
20628
|
}
|
|
20530
20629
|
return match;
|
|
20531
20630
|
}
|
|
@@ -22025,7 +22124,7 @@ function extractRuntimeFallbackAutoRetrySignal(info) {
|
|
|
22025
22124
|
}
|
|
22026
22125
|
// packages/model-core/src/runtime-fallback-error-shape.ts
|
|
22027
22126
|
var DEFAULT_RETRY_ON_ERRORS = [429, 500, 502, 503, 504];
|
|
22028
|
-
function
|
|
22127
|
+
function isRecord3(value) {
|
|
22029
22128
|
return typeof value === "object" && value !== null;
|
|
22030
22129
|
}
|
|
22031
22130
|
function getRecordValue(record, key) {
|
|
@@ -22033,14 +22132,14 @@ function getRecordValue(record, key) {
|
|
|
22033
22132
|
}
|
|
22034
22133
|
function getNestedRecord(record, key) {
|
|
22035
22134
|
const value = getRecordValue(record, key);
|
|
22036
|
-
return
|
|
22135
|
+
return isRecord3(value) ? value : undefined;
|
|
22037
22136
|
}
|
|
22038
22137
|
function getRuntimeFallbackErrorMessage(error) {
|
|
22039
22138
|
if (!error)
|
|
22040
22139
|
return "";
|
|
22041
22140
|
if (typeof error === "string")
|
|
22042
22141
|
return error.toLowerCase();
|
|
22043
|
-
if (!
|
|
22142
|
+
if (!isRecord3(error)) {
|
|
22044
22143
|
try {
|
|
22045
22144
|
return JSON.stringify(error).toLowerCase();
|
|
22046
22145
|
} catch (error2) {
|
|
@@ -22076,7 +22175,7 @@ function getRuntimeFallbackErrorMessage(error) {
|
|
|
22076
22175
|
}
|
|
22077
22176
|
}
|
|
22078
22177
|
function getRuntimeFallbackStatusCode(error, retryOnErrors) {
|
|
22079
|
-
if (
|
|
22178
|
+
if (isRecord3(error)) {
|
|
22080
22179
|
const topLevelStatusCode = getRecordValue(error, "statusCode");
|
|
22081
22180
|
if (typeof topLevelStatusCode === "number")
|
|
22082
22181
|
return topLevelStatusCode;
|
|
@@ -22084,7 +22183,7 @@ function getRuntimeFallbackStatusCode(error, retryOnErrors) {
|
|
|
22084
22183
|
if (typeof topLevelStatus === "number")
|
|
22085
22184
|
return topLevelStatus;
|
|
22086
22185
|
}
|
|
22087
|
-
const root =
|
|
22186
|
+
const root = isRecord3(error) ? error : undefined;
|
|
22088
22187
|
const data = getNestedRecord(root, "data");
|
|
22089
22188
|
const nestedError = getNestedRecord(root, "error");
|
|
22090
22189
|
const cause = getNestedRecord(root, "cause");
|
|
@@ -22103,7 +22202,7 @@ function getRuntimeFallbackStatusCode(error, retryOnErrors) {
|
|
|
22103
22202
|
return;
|
|
22104
22203
|
}
|
|
22105
22204
|
function getRuntimeFallbackErrorName(error) {
|
|
22106
|
-
if (!
|
|
22205
|
+
if (!isRecord3(error))
|
|
22107
22206
|
return;
|
|
22108
22207
|
const data = getNestedRecord(error, "data");
|
|
22109
22208
|
const nestedError = getNestedRecord(error, "error");
|
|
@@ -22118,7 +22217,7 @@ function getRuntimeFallbackErrorName(error) {
|
|
|
22118
22217
|
return;
|
|
22119
22218
|
}
|
|
22120
22219
|
function getRuntimeFallbackRetryableSignal(error) {
|
|
22121
|
-
if (!
|
|
22220
|
+
if (!isRecord3(error))
|
|
22122
22221
|
return;
|
|
22123
22222
|
const data = getNestedRecord(error, "data");
|
|
22124
22223
|
const nestedError = getNestedRecord(error, "error");
|
|
@@ -22324,7 +22423,7 @@ function getBundledModelCapabilitiesSnapshot(snapshotJson) {
|
|
|
22324
22423
|
};
|
|
22325
22424
|
}
|
|
22326
22425
|
// packages/model-core/src/model-capabilities/runtime-model-readers.ts
|
|
22327
|
-
function
|
|
22426
|
+
function isRecord4(value) {
|
|
22328
22427
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
22329
22428
|
}
|
|
22330
22429
|
function readNumber(value) {
|
|
@@ -22342,7 +22441,7 @@ function normalizeVariantKeys(value) {
|
|
|
22342
22441
|
if (arrayVariants) {
|
|
22343
22442
|
return arrayVariants.filter((v) => typeof v === "string").map((variant) => variant.toLowerCase());
|
|
22344
22443
|
}
|
|
22345
|
-
if (!
|
|
22444
|
+
if (!isRecord4(value)) {
|
|
22346
22445
|
return;
|
|
22347
22446
|
}
|
|
22348
22447
|
const variants = Object.keys(value).map((variant) => variant.toLowerCase());
|
|
@@ -22353,7 +22452,7 @@ function readModalityKeys(value) {
|
|
|
22353
22452
|
if (stringArray) {
|
|
22354
22453
|
return stringArray.filter((entry) => typeof entry === "string").map((entry) => entry.toLowerCase());
|
|
22355
22454
|
}
|
|
22356
|
-
if (!
|
|
22455
|
+
if (!isRecord4(value)) {
|
|
22357
22456
|
return;
|
|
22358
22457
|
}
|
|
22359
22458
|
const fromNested = Object.values(value).filter((v) => Array.isArray(v)).flat().filter((item) => typeof item === "string");
|
|
@@ -22364,7 +22463,7 @@ function readModalityKeys(value) {
|
|
|
22364
22463
|
return enabled.length > 0 ? enabled : undefined;
|
|
22365
22464
|
}
|
|
22366
22465
|
function normalizeModalities(value) {
|
|
22367
|
-
if (!
|
|
22466
|
+
if (!isRecord4(value)) {
|
|
22368
22467
|
return;
|
|
22369
22468
|
}
|
|
22370
22469
|
const input = readModalityKeys(value.input);
|
|
@@ -22378,7 +22477,7 @@ function normalizeModalities(value) {
|
|
|
22378
22477
|
};
|
|
22379
22478
|
}
|
|
22380
22479
|
function readRuntimeModelCapabilities(runtimeModel) {
|
|
22381
|
-
return
|
|
22480
|
+
return isRecord4(runtimeModel?.capabilities) ? runtimeModel.capabilities : undefined;
|
|
22382
22481
|
}
|
|
22383
22482
|
function readRuntimeModelBoolean(runtimeModel, keys) {
|
|
22384
22483
|
const runtimeCapabilities = readRuntimeModelCapabilities(runtimeModel);
|
|
@@ -22395,7 +22494,7 @@ function readRuntimeModelBoolean(runtimeModel, keys) {
|
|
|
22395
22494
|
return;
|
|
22396
22495
|
}
|
|
22397
22496
|
function readRuntimeModel(runtimeModel) {
|
|
22398
|
-
return
|
|
22497
|
+
return isRecord4(runtimeModel) ? runtimeModel : undefined;
|
|
22399
22498
|
}
|
|
22400
22499
|
function readRuntimeModelVariants(runtimeModel) {
|
|
22401
22500
|
const rootVariants = normalizeVariantKeys(runtimeModel?.variants);
|
|
@@ -22443,8 +22542,8 @@ function readRuntimeModelToolCallSupport(runtimeModel) {
|
|
|
22443
22542
|
return readRuntimeModelBoolean(runtimeModel, ["toolCall", "tool_call", "toolcall"]);
|
|
22444
22543
|
}
|
|
22445
22544
|
function readRuntimeModelLimitOutput(runtimeModel) {
|
|
22446
|
-
const limit =
|
|
22447
|
-
if (!
|
|
22545
|
+
const limit = isRecord4(runtimeModel?.limit) ? runtimeModel.limit : readRuntimeModelCapabilities(runtimeModel)?.limit;
|
|
22546
|
+
if (!isRecord4(limit)) {
|
|
22448
22547
|
return;
|
|
22449
22548
|
}
|
|
22450
22549
|
const output = readNumber(limit.output);
|
|
@@ -22561,7 +22660,7 @@ function resolveActualContextLimit(providerID, modelID, modelCacheState) {
|
|
|
22561
22660
|
}
|
|
22562
22661
|
// packages/model-core/src/model-capabilities-snapshot.ts
|
|
22563
22662
|
var MODELS_DEV_SOURCE_URL = "https://models.dev/api.json";
|
|
22564
|
-
function
|
|
22663
|
+
function isRecord5(value) {
|
|
22565
22664
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
22566
22665
|
}
|
|
22567
22666
|
function readBoolean(value) {
|
|
@@ -22581,7 +22680,7 @@ function readStringArray2(value) {
|
|
|
22581
22680
|
return result.length > 0 ? result : undefined;
|
|
22582
22681
|
}
|
|
22583
22682
|
function normalizeSnapshotEntry(rawModelID, rawModel) {
|
|
22584
|
-
if (!
|
|
22683
|
+
if (!isRecord5(rawModel)) {
|
|
22585
22684
|
return;
|
|
22586
22685
|
}
|
|
22587
22686
|
const id = readString(rawModel.id) ?? rawModelID;
|
|
@@ -22589,14 +22688,14 @@ function normalizeSnapshotEntry(rawModelID, rawModel) {
|
|
|
22589
22688
|
const reasoning = readBoolean(rawModel.reasoning);
|
|
22590
22689
|
const temperature = readBoolean(rawModel.temperature);
|
|
22591
22690
|
const toolCall = readBoolean(rawModel.tool_call);
|
|
22592
|
-
const rawModalities =
|
|
22691
|
+
const rawModalities = isRecord5(rawModel.modalities) ? rawModel.modalities : undefined;
|
|
22593
22692
|
const modalitiesInput = readStringArray2(rawModalities?.input);
|
|
22594
22693
|
const modalitiesOutput = readStringArray2(rawModalities?.output);
|
|
22595
22694
|
const modalities = modalitiesInput || modalitiesOutput ? {
|
|
22596
22695
|
...modalitiesInput ? { input: modalitiesInput } : {},
|
|
22597
22696
|
...modalitiesOutput ? { output: modalitiesOutput } : {}
|
|
22598
22697
|
} : undefined;
|
|
22599
|
-
const rawLimit =
|
|
22698
|
+
const rawLimit = isRecord5(rawModel.limit) ? rawModel.limit : undefined;
|
|
22600
22699
|
const limitContext = readNumber2(rawLimit?.context);
|
|
22601
22700
|
const limitInput = readNumber2(rawLimit?.input);
|
|
22602
22701
|
const limitOutput = readNumber2(rawLimit?.output);
|
|
@@ -22636,13 +22735,13 @@ function mergeSnapshotEntries(existing, incoming) {
|
|
|
22636
22735
|
}
|
|
22637
22736
|
function buildModelCapabilitiesSnapshotFromModelsDev(raw) {
|
|
22638
22737
|
const models = {};
|
|
22639
|
-
const providers =
|
|
22738
|
+
const providers = isRecord5(raw) ? raw : {};
|
|
22640
22739
|
for (const providerValue of Object.values(providers)) {
|
|
22641
|
-
if (!
|
|
22740
|
+
if (!isRecord5(providerValue)) {
|
|
22642
22741
|
continue;
|
|
22643
22742
|
}
|
|
22644
22743
|
const providerModels = providerValue.models;
|
|
22645
|
-
if (!
|
|
22744
|
+
if (!isRecord5(providerModels)) {
|
|
22646
22745
|
continue;
|
|
22647
22746
|
}
|
|
22648
22747
|
for (const [rawModelID, rawModel] of Object.entries(providerModels)) {
|
|
@@ -23059,14 +23158,14 @@ function addConfigLoadError(error) {
|
|
|
23059
23158
|
configLoadErrors.push(error);
|
|
23060
23159
|
}
|
|
23061
23160
|
// packages/omo-opencode/src/shared/claude-config-dir.ts
|
|
23062
|
-
import { homedir as
|
|
23161
|
+
import { homedir as homedir10 } from "os";
|
|
23063
23162
|
import { join as join14 } from "path";
|
|
23064
23163
|
function getClaudeConfigDir() {
|
|
23065
23164
|
const envConfigDir = process.env.CLAUDE_CONFIG_DIR;
|
|
23066
23165
|
if (envConfigDir) {
|
|
23067
23166
|
return envConfigDir;
|
|
23068
23167
|
}
|
|
23069
|
-
return join14(
|
|
23168
|
+
return join14(homedir10(), ".claude");
|
|
23070
23169
|
}
|
|
23071
23170
|
// packages/omo-opencode/src/shared/jsonc-parser.ts
|
|
23072
23171
|
init_src();
|
|
@@ -23911,7 +24010,7 @@ configureMigrationCategoryDefaults(DEFAULT_CATEGORIES);
|
|
|
23911
24010
|
// packages/omo-opencode/src/shared/opencode-config-dir.ts
|
|
23912
24011
|
init_plugin_identity();
|
|
23913
24012
|
import { existsSync as existsSync11, realpathSync as realpathSync4 } from "fs";
|
|
23914
|
-
import { homedir as
|
|
24013
|
+
import { homedir as homedir11 } from "os";
|
|
23915
24014
|
import { join as join15, posix as posix2, resolve as resolve8, win32 as win322 } from "path";
|
|
23916
24015
|
var TAURI_APP_IDENTIFIER = "ai.opencode.desktop";
|
|
23917
24016
|
var TAURI_APP_IDENTIFIER_DEV = "ai.opencode.desktop.dev";
|
|
@@ -23924,14 +24023,14 @@ function getTauriConfigDir(identifier) {
|
|
|
23924
24023
|
const platform = process.platform;
|
|
23925
24024
|
switch (platform) {
|
|
23926
24025
|
case "darwin":
|
|
23927
|
-
return join15(
|
|
24026
|
+
return join15(homedir11(), "Library", "Application Support", identifier);
|
|
23928
24027
|
case "win32": {
|
|
23929
|
-
const appData = process.env.APPDATA || join15(
|
|
24028
|
+
const appData = process.env.APPDATA || join15(homedir11(), "AppData", "Roaming");
|
|
23930
24029
|
return win322.join(appData, identifier);
|
|
23931
24030
|
}
|
|
23932
24031
|
case "linux":
|
|
23933
24032
|
default: {
|
|
23934
|
-
const xdgConfig = process.env.XDG_CONFIG_HOME || join15(
|
|
24033
|
+
const xdgConfig = process.env.XDG_CONFIG_HOME || join15(homedir11(), ".config");
|
|
23935
24034
|
return join15(xdgConfig, identifier);
|
|
23936
24035
|
}
|
|
23937
24036
|
}
|
|
@@ -23975,7 +24074,7 @@ function getWslLinuxHomeDir(windowsConfigRoot) {
|
|
|
23975
24074
|
function getCliDefaultConfigDir() {
|
|
23976
24075
|
const envXdgConfig = process.env.XDG_CONFIG_HOME?.trim();
|
|
23977
24076
|
const shouldIgnoreWindowsXdg = envXdgConfig !== undefined && envXdgConfig.length > 0 && isWslEnvironment() && isWindowsUserConfigRoot(envXdgConfig);
|
|
23978
|
-
const xdgConfig = shouldIgnoreWindowsXdg ? posix2.join(getWslLinuxHomeDir(envXdgConfig) ?? "/home", ".config") : envXdgConfig || join15(
|
|
24077
|
+
const xdgConfig = shouldIgnoreWindowsXdg ? posix2.join(getWslLinuxHomeDir(envXdgConfig) ?? "/home", ".config") : envXdgConfig || join15(homedir11(), ".config");
|
|
23979
24078
|
const configDir = isWslEnvironment() ? posix2.join(xdgConfig, "opencode") : join15(xdgConfig, "opencode");
|
|
23980
24079
|
return resolveConfigPath(configDir);
|
|
23981
24080
|
}
|
|
@@ -24028,12 +24127,12 @@ function getOpenCodeConfigPaths(options) {
|
|
|
24028
24127
|
};
|
|
24029
24128
|
}
|
|
24030
24129
|
// packages/omo-opencode/src/shared/resolve-agent-definition-paths.ts
|
|
24031
|
-
import { homedir as
|
|
24130
|
+
import { homedir as homedir12 } from "os";
|
|
24032
24131
|
import { isAbsolute as isAbsolute5, join as join16, resolve as resolve9 } from "path";
|
|
24033
24132
|
init_logger2();
|
|
24034
24133
|
function resolveAgentDefinitionPaths(paths, baseDir, containmentDir) {
|
|
24035
24134
|
return paths.flatMap((p) => {
|
|
24036
|
-
const expanded = p.startsWith("~/") ? join16(
|
|
24135
|
+
const expanded = p.startsWith("~/") ? join16(homedir12(), p.slice(2)) : p;
|
|
24037
24136
|
const resolved = isAbsolute5(expanded) ? expanded : resolve9(baseDir, expanded);
|
|
24038
24137
|
if (containmentDir !== null && !isWithinProject(resolved, containmentDir)) {
|
|
24039
24138
|
log2(`agent_definitions path rejected (outside project boundary): ${p} -> ${resolved}`);
|
|
@@ -70666,7 +70765,7 @@ var log4 = logger4.log;
|
|
|
70666
70765
|
var getLogFilePath2 = logger4.getLogFilePath;
|
|
70667
70766
|
|
|
70668
70767
|
// packages/claude-code-compat-core/src/features/claude-code-plugin-loader/scope-filter.ts
|
|
70669
|
-
import { homedir as
|
|
70768
|
+
import { homedir as homedir14 } from "os";
|
|
70670
70769
|
import { join as join29 } from "path";
|
|
70671
70770
|
|
|
70672
70771
|
// packages/claude-code-compat-core/src/shared/contains-path.ts
|
|
@@ -70675,10 +70774,10 @@ init_src();
|
|
|
70675
70774
|
// packages/claude-code-compat-core/src/features/claude-code-plugin-loader/scope-filter.ts
|
|
70676
70775
|
function expandTilde(inputPath) {
|
|
70677
70776
|
if (inputPath === "~") {
|
|
70678
|
-
return
|
|
70777
|
+
return homedir14();
|
|
70679
70778
|
}
|
|
70680
70779
|
if (inputPath.startsWith("~/") || inputPath.startsWith("~\\")) {
|
|
70681
|
-
return join29(
|
|
70780
|
+
return join29(homedir14(), inputPath.slice(2));
|
|
70682
70781
|
}
|
|
70683
70782
|
return inputPath;
|
|
70684
70783
|
}
|
|
@@ -70693,13 +70792,13 @@ function shouldLoadPluginForCwd(installation, cwd = process.cwd()) {
|
|
|
70693
70792
|
}
|
|
70694
70793
|
|
|
70695
70794
|
// packages/claude-code-compat-core/src/features/claude-code-plugin-loader/discovery-paths.ts
|
|
70696
|
-
import { homedir as
|
|
70795
|
+
import { homedir as homedir15 } from "os";
|
|
70697
70796
|
import { join as join30 } from "path";
|
|
70698
70797
|
function getPluginsBaseDir() {
|
|
70699
70798
|
if (process.env.CLAUDE_PLUGINS_HOME) {
|
|
70700
70799
|
return process.env.CLAUDE_PLUGINS_HOME;
|
|
70701
70800
|
}
|
|
70702
|
-
return join30(
|
|
70801
|
+
return join30(homedir15(), ".claude", "plugins");
|
|
70703
70802
|
}
|
|
70704
70803
|
function getInstalledPluginsPath(pluginsBaseDir) {
|
|
70705
70804
|
return join30(pluginsBaseDir ?? getPluginsBaseDir(), "installed_plugins.json");
|
|
@@ -70708,7 +70807,7 @@ function getClaudeSettingsPath() {
|
|
|
70708
70807
|
if (process.env.CLAUDE_SETTINGS_PATH) {
|
|
70709
70808
|
return process.env.CLAUDE_SETTINGS_PATH;
|
|
70710
70809
|
}
|
|
70711
|
-
return join30(
|
|
70810
|
+
return join30(homedir15(), ".claude", "settings.json");
|
|
70712
70811
|
}
|
|
70713
70812
|
|
|
70714
70813
|
// packages/claude-code-compat-core/src/features/claude-code-plugin-loader/installed-plugin-database.ts
|
|
@@ -74183,7 +74282,7 @@ async function runCommentChecker(input, options) {
|
|
|
74183
74282
|
// packages/omo-opencode/src/hooks/comment-checker/downloader.ts
|
|
74184
74283
|
import { existsSync as existsSync37, appendFileSync as appendFileSync3 } from "fs";
|
|
74185
74284
|
import { join as join43 } from "path";
|
|
74186
|
-
import { homedir as
|
|
74285
|
+
import { homedir as homedir16, tmpdir as tmpdir3 } from "os";
|
|
74187
74286
|
import { createRequire as createRequire3 } from "module";
|
|
74188
74287
|
init_logger2();
|
|
74189
74288
|
init_plugin_identity();
|
|
@@ -74207,11 +74306,11 @@ var PLATFORM_MAP = {
|
|
|
74207
74306
|
function getCacheDir2() {
|
|
74208
74307
|
if (process.platform === "win32") {
|
|
74209
74308
|
const localAppData = process.env.LOCALAPPDATA || process.env.APPDATA;
|
|
74210
|
-
const base2 = localAppData || join43(
|
|
74309
|
+
const base2 = localAppData || join43(homedir16(), "AppData", "Local");
|
|
74211
74310
|
return join43(base2, CACHE_DIR_NAME, "bin");
|
|
74212
74311
|
}
|
|
74213
74312
|
const xdgCache = process.env.XDG_CACHE_HOME;
|
|
74214
|
-
const base = xdgCache || join43(
|
|
74313
|
+
const base = xdgCache || join43(homedir16(), ".cache");
|
|
74215
74314
|
return join43(base, CACHE_DIR_NAME, "bin");
|
|
74216
74315
|
}
|
|
74217
74316
|
function getBinaryName() {
|
|
@@ -74823,7 +74922,7 @@ function isSameOrChildPath(childPath, parentPath) {
|
|
|
74823
74922
|
}
|
|
74824
74923
|
// packages/rules-engine/src/finder.ts
|
|
74825
74924
|
import { existsSync as existsSync42, statSync as statSync6 } from "fs";
|
|
74826
|
-
import { homedir as
|
|
74925
|
+
import { homedir as homedir17 } from "os";
|
|
74827
74926
|
import { dirname as dirname13, isAbsolute as isAbsolute9, join as join48, relative as relative8, resolve as resolve14 } from "path";
|
|
74828
74927
|
|
|
74829
74928
|
// packages/rules-engine/src/ordering.ts
|
|
@@ -74922,7 +75021,7 @@ function findRuleFiles(projectRoot, homeDir, currentFile, options, cache) {
|
|
|
74922
75021
|
const seenRealPaths = new Set;
|
|
74923
75022
|
addProjectRuleCandidates(effectiveProjectRoot, startDir, candidates, seenRealPaths, cache);
|
|
74924
75023
|
addProjectSingleFileCandidates(effectiveProjectRoot, candidates, seenRealPaths);
|
|
74925
|
-
addUserRuleCandidates(homeDir ||
|
|
75024
|
+
addUserRuleCandidates(homeDir || homedir17(), skipClaudeUserRules, candidates, seenRealPaths, cache);
|
|
74926
75025
|
const sorted = sortCandidates(candidates);
|
|
74927
75026
|
cache?.set(cacheKey, sorted);
|
|
74928
75027
|
return sorted;
|
|
@@ -80011,7 +80110,7 @@ function createSessionRuleScanCacheStore() {
|
|
|
80011
80110
|
}
|
|
80012
80111
|
|
|
80013
80112
|
// packages/omo-opencode/src/hooks/rules-injector/injection-processor.ts
|
|
80014
|
-
import { homedir as
|
|
80113
|
+
import { homedir as homedir18 } from "os";
|
|
80015
80114
|
// packages/omo-opencode/src/hooks/rules-injector/rule-file-finder.ts
|
|
80016
80115
|
init_logger2();
|
|
80017
80116
|
setSisyphusRuleDeprecationLogger(log2);
|
|
@@ -80157,7 +80256,7 @@ function createRuleInjectionProcessor(deps) {
|
|
|
80157
80256
|
getSessionCache: getSessionCache3,
|
|
80158
80257
|
getSessionRuleScanCache,
|
|
80159
80258
|
ruleFinderOptions,
|
|
80160
|
-
homedir: getHomeDir =
|
|
80259
|
+
homedir: getHomeDir = homedir18,
|
|
80161
80260
|
shouldApplyRule: shouldApplyRuleImpl = shouldApplyRule,
|
|
80162
80261
|
isDuplicateByRealPath: isDuplicateByRealPathImpl = isDuplicateByRealPath,
|
|
80163
80262
|
createContentHash: createContentHashImpl = createContentHash,
|
|
@@ -80683,7 +80782,7 @@ function getCachedVersion(options = {}) {
|
|
|
80683
80782
|
// package.json
|
|
80684
80783
|
var package_default = {
|
|
80685
80784
|
name: "oh-my-opencode",
|
|
80686
|
-
version: "4.12.
|
|
80785
|
+
version: "4.12.1",
|
|
80687
80786
|
description: "The Best AI Agent Harness - Batteries-Included OpenCode Plugin with Multi-Model Orchestration, Parallel Background Agents, and Crafted LSP/AST Tools",
|
|
80688
80787
|
main: "./dist/index.js",
|
|
80689
80788
|
types: "dist/index.d.ts",
|
|
@@ -80853,18 +80952,18 @@ var package_default = {
|
|
|
80853
80952
|
typescript: "^6.0.3"
|
|
80854
80953
|
},
|
|
80855
80954
|
optionalDependencies: {
|
|
80856
|
-
"oh-my-opencode-darwin-arm64": "4.12.
|
|
80857
|
-
"oh-my-opencode-darwin-x64": "4.12.
|
|
80858
|
-
"oh-my-opencode-darwin-x64-baseline": "4.12.
|
|
80859
|
-
"oh-my-opencode-linux-arm64": "4.12.
|
|
80860
|
-
"oh-my-opencode-linux-arm64-musl": "4.12.
|
|
80861
|
-
"oh-my-opencode-linux-x64": "4.12.
|
|
80862
|
-
"oh-my-opencode-linux-x64-baseline": "4.12.
|
|
80863
|
-
"oh-my-opencode-linux-x64-musl": "4.12.
|
|
80864
|
-
"oh-my-opencode-linux-x64-musl-baseline": "4.12.
|
|
80865
|
-
"oh-my-opencode-windows-arm64": "4.12.
|
|
80866
|
-
"oh-my-opencode-windows-x64": "4.12.
|
|
80867
|
-
"oh-my-opencode-windows-x64-baseline": "4.12.
|
|
80955
|
+
"oh-my-opencode-darwin-arm64": "4.12.1",
|
|
80956
|
+
"oh-my-opencode-darwin-x64": "4.12.1",
|
|
80957
|
+
"oh-my-opencode-darwin-x64-baseline": "4.12.1",
|
|
80958
|
+
"oh-my-opencode-linux-arm64": "4.12.1",
|
|
80959
|
+
"oh-my-opencode-linux-arm64-musl": "4.12.1",
|
|
80960
|
+
"oh-my-opencode-linux-x64": "4.12.1",
|
|
80961
|
+
"oh-my-opencode-linux-x64-baseline": "4.12.1",
|
|
80962
|
+
"oh-my-opencode-linux-x64-musl": "4.12.1",
|
|
80963
|
+
"oh-my-opencode-linux-x64-musl-baseline": "4.12.1",
|
|
80964
|
+
"oh-my-opencode-windows-arm64": "4.12.1",
|
|
80965
|
+
"oh-my-opencode-windows-x64": "4.12.1",
|
|
80966
|
+
"oh-my-opencode-windows-x64-baseline": "4.12.1"
|
|
80868
80967
|
},
|
|
80869
80968
|
overrides: {
|
|
80870
80969
|
hono: "^4.12.18",
|
|
@@ -81855,7 +81954,7 @@ v${latestVersion} available. Restart OpenCode to apply.` : "OpenCode is now on S
|
|
|
81855
81954
|
// packages/omo-opencode/src/hooks/codegraph-bootstrap/hook.ts
|
|
81856
81955
|
init_src();
|
|
81857
81956
|
import { existsSync as existsSync65 } from "fs";
|
|
81858
|
-
import { homedir as
|
|
81957
|
+
import { homedir as homedir21 } from "os";
|
|
81859
81958
|
import { join as join75 } from "path";
|
|
81860
81959
|
|
|
81861
81960
|
// packages/omo-opencode/src/hooks/codegraph-bootstrap/command-runner.ts
|
|
@@ -82003,7 +82102,7 @@ function defaultSchedule(task) {
|
|
|
82003
82102
|
timer.unref?.();
|
|
82004
82103
|
}
|
|
82005
82104
|
function defaultInstallDir2() {
|
|
82006
|
-
return join75(
|
|
82105
|
+
return join75(homedir21(), ".omo", "codegraph");
|
|
82007
82106
|
}
|
|
82008
82107
|
function provisionedBinFromInstallDir(installDir) {
|
|
82009
82108
|
if (installDir === undefined)
|
|
@@ -82134,7 +82233,7 @@ function createCodegraphBootstrapHook(ctx, config, depsOverride = {}) {
|
|
|
82134
82233
|
}
|
|
82135
82234
|
// packages/omo-opencode/src/hooks/ast-grep-sg-provision/hook.ts
|
|
82136
82235
|
init_src();
|
|
82137
|
-
import { homedir as
|
|
82236
|
+
import { homedir as homedir22 } from "os";
|
|
82138
82237
|
import { join as join76 } from "path";
|
|
82139
82238
|
var provisionedTargets = new Set;
|
|
82140
82239
|
function defaultSchedule2(task) {
|
|
@@ -82154,7 +82253,7 @@ async function runProvision(targetDir, deps) {
|
|
|
82154
82253
|
}
|
|
82155
82254
|
var defaultDeps5 = {
|
|
82156
82255
|
findSgBinary: findSgBinarySync,
|
|
82157
|
-
homeDir:
|
|
82256
|
+
homeDir: homedir22,
|
|
82158
82257
|
log: log2,
|
|
82159
82258
|
provisionSgBinary,
|
|
82160
82259
|
schedule: defaultSchedule2
|
|
@@ -90356,7 +90455,7 @@ import { dirname as dirname28 } from "path";
|
|
|
90356
90455
|
init_resolve_commands_in_text();
|
|
90357
90456
|
// packages/skills-loader-core/src/features/opencode-skill-loader/loader.ts
|
|
90358
90457
|
import { join as join88 } from "path";
|
|
90359
|
-
import { homedir as
|
|
90458
|
+
import { homedir as homedir26 } from "os";
|
|
90360
90459
|
|
|
90361
90460
|
// packages/shared-skills/index.mjs
|
|
90362
90461
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
@@ -90365,21 +90464,21 @@ function sharedSkillsRootPath() {
|
|
|
90365
90464
|
}
|
|
90366
90465
|
|
|
90367
90466
|
// packages/skills-loader-core/src/shared/claude-config-dir.ts
|
|
90368
|
-
import { homedir as
|
|
90467
|
+
import { homedir as homedir24 } from "os";
|
|
90369
90468
|
import { join as join82 } from "path";
|
|
90370
90469
|
function getClaudeConfigDir2() {
|
|
90371
90470
|
const envConfigDir = process.env.CLAUDE_CONFIG_DIR;
|
|
90372
90471
|
if (envConfigDir) {
|
|
90373
90472
|
return envConfigDir;
|
|
90374
90473
|
}
|
|
90375
|
-
return join82(
|
|
90474
|
+
return join82(homedir24(), ".claude");
|
|
90376
90475
|
}
|
|
90377
90476
|
// packages/skills-loader-core/src/shared/opencode-command-dirs.ts
|
|
90378
90477
|
import { basename as basename13, dirname as dirname24, join as join84 } from "path";
|
|
90379
90478
|
|
|
90380
90479
|
// packages/skills-loader-core/src/shared/opencode-config-dir.ts
|
|
90381
90480
|
import { existsSync as existsSync70, realpathSync as realpathSync11 } from "fs";
|
|
90382
|
-
import { homedir as
|
|
90481
|
+
import { homedir as homedir25 } from "os";
|
|
90383
90482
|
import { join as join83, posix as posix4, resolve as resolve19, win32 as win325 } from "path";
|
|
90384
90483
|
|
|
90385
90484
|
// packages/skills-loader-core/src/shared/plugin-identity.ts
|
|
@@ -90413,14 +90512,14 @@ function getTauriConfigDir2(identifier) {
|
|
|
90413
90512
|
const platform2 = process.platform;
|
|
90414
90513
|
switch (platform2) {
|
|
90415
90514
|
case "darwin":
|
|
90416
|
-
return join83(
|
|
90515
|
+
return join83(homedir25(), "Library", "Application Support", identifier);
|
|
90417
90516
|
case "win32": {
|
|
90418
|
-
const appData = process.env.APPDATA || join83(
|
|
90517
|
+
const appData = process.env.APPDATA || join83(homedir25(), "AppData", "Roaming");
|
|
90419
90518
|
return win325.join(appData, identifier);
|
|
90420
90519
|
}
|
|
90421
90520
|
case "linux":
|
|
90422
90521
|
default: {
|
|
90423
|
-
const xdgConfig = process.env.XDG_CONFIG_HOME || join83(
|
|
90522
|
+
const xdgConfig = process.env.XDG_CONFIG_HOME || join83(homedir25(), ".config");
|
|
90424
90523
|
return join83(xdgConfig, identifier);
|
|
90425
90524
|
}
|
|
90426
90525
|
}
|
|
@@ -90464,7 +90563,7 @@ function getWslLinuxHomeDir2(windowsConfigRoot) {
|
|
|
90464
90563
|
function getCliDefaultConfigDir2() {
|
|
90465
90564
|
const envXdgConfig = process.env.XDG_CONFIG_HOME?.trim();
|
|
90466
90565
|
const shouldIgnoreWindowsXdg = envXdgConfig !== undefined && envXdgConfig.length > 0 && isWslEnvironment2() && isWindowsUserConfigRoot2(envXdgConfig);
|
|
90467
|
-
const xdgConfig = shouldIgnoreWindowsXdg ? posix4.join(getWslLinuxHomeDir2(envXdgConfig) ?? "/home", ".config") : envXdgConfig || join83(
|
|
90566
|
+
const xdgConfig = shouldIgnoreWindowsXdg ? posix4.join(getWslLinuxHomeDir2(envXdgConfig) ?? "/home", ".config") : envXdgConfig || join83(homedir25(), ".config");
|
|
90468
90567
|
const configDir = isWslEnvironment2() ? posix4.join(xdgConfig, "opencode") : join83(xdgConfig, "opencode");
|
|
90469
90568
|
return resolveConfigPath2(configDir);
|
|
90470
90569
|
}
|
|
@@ -91039,7 +91138,7 @@ async function loadProjectAgentsSkills(directory) {
|
|
|
91039
91138
|
const allSkills = await Promise.all(agentsProjectSkillDirs.map((skillsDir) => loadSkillsFromDir({ skillsDir, scope: "project" })));
|
|
91040
91139
|
return skillsToCommandDefinitionRecord(deduplicateSkillsByName(allSkills.flat()));
|
|
91041
91140
|
}
|
|
91042
|
-
async function loadGlobalAgentsSkills(homeDirectory =
|
|
91141
|
+
async function loadGlobalAgentsSkills(homeDirectory = homedir26()) {
|
|
91043
91142
|
const agentsGlobalDir = join88(homeDirectory, ".agents", "skills");
|
|
91044
91143
|
const skills = await loadSkillsFromDir({ skillsDir: agentsGlobalDir, scope: "user" });
|
|
91045
91144
|
return skillsToCommandDefinitionRecord(skills);
|
|
@@ -91137,7 +91236,7 @@ async function discoverProjectAgentsSkills(directory) {
|
|
|
91137
91236
|
const allSkills = await Promise.all(agentsProjectSkillDirs.map((skillsDir) => loadSkillsFromDir({ skillsDir, scope: "project" })));
|
|
91138
91237
|
return deduplicateSkillsByName(allSkills.flat());
|
|
91139
91238
|
}
|
|
91140
|
-
async function discoverGlobalAgentsSkills(homeDirectory =
|
|
91239
|
+
async function discoverGlobalAgentsSkills(homeDirectory = homedir26()) {
|
|
91141
91240
|
const agentsGlobalDir = join88(homeDirectory, ".agents", "skills");
|
|
91142
91241
|
return loadSkillsFromDir({ skillsDir: agentsGlobalDir, scope: "user" });
|
|
91143
91242
|
}
|
|
@@ -91168,14 +91267,14 @@ function builtinToLoadedSkill(builtin) {
|
|
|
91168
91267
|
init_src();
|
|
91169
91268
|
import { existsSync as existsSync72, readFileSync as readFileSync46 } from "fs";
|
|
91170
91269
|
import { dirname as dirname26, isAbsolute as isAbsolute13, resolve as resolve22 } from "path";
|
|
91171
|
-
import { homedir as
|
|
91270
|
+
import { homedir as homedir27 } from "os";
|
|
91172
91271
|
function resolveFilePath5(from, configDir) {
|
|
91173
91272
|
let filePath = from;
|
|
91174
91273
|
if (filePath.startsWith("{file:") && filePath.endsWith("}")) {
|
|
91175
91274
|
filePath = filePath.slice(6, -1);
|
|
91176
91275
|
}
|
|
91177
91276
|
if (filePath.startsWith("~/")) {
|
|
91178
|
-
return resolve22(
|
|
91277
|
+
return resolve22(homedir27(), filePath.slice(2));
|
|
91179
91278
|
}
|
|
91180
91279
|
if (isAbsolute13(filePath)) {
|
|
91181
91280
|
return filePath;
|
|
@@ -94416,7 +94515,7 @@ function isDisabledSkillName(name, disabledSkills) {
|
|
|
94416
94515
|
init_src();
|
|
94417
94516
|
var import_picomatch2 = __toESM(require_picomatch2(), 1);
|
|
94418
94517
|
import * as fs20 from "fs/promises";
|
|
94419
|
-
import { homedir as
|
|
94518
|
+
import { homedir as homedir28 } from "os";
|
|
94420
94519
|
import { dirname as dirname27, extname as extname2, isAbsolute as isAbsolute14, join as join90, relative as relative12 } from "path";
|
|
94421
94520
|
var MAX_RECURSIVE_DEPTH = 10;
|
|
94422
94521
|
function isHttpUrl(path17) {
|
|
@@ -94424,10 +94523,10 @@ function isHttpUrl(path17) {
|
|
|
94424
94523
|
}
|
|
94425
94524
|
function toAbsolutePath(path17, configDir) {
|
|
94426
94525
|
if (path17 === "~") {
|
|
94427
|
-
return
|
|
94526
|
+
return homedir28();
|
|
94428
94527
|
}
|
|
94429
94528
|
if (path17.startsWith("~/")) {
|
|
94430
|
-
return join90(
|
|
94529
|
+
return join90(homedir28(), path17.slice(2));
|
|
94431
94530
|
}
|
|
94432
94531
|
if (isAbsolute14(path17)) {
|
|
94433
94532
|
return path17;
|
|
@@ -100754,7 +100853,7 @@ function buildRetryGuidance(errorInfo) {
|
|
|
100754
100853
|
if (!pattern) {
|
|
100755
100854
|
return `[task ERROR] Fix the error and retry with correct parameters.`;
|
|
100756
100855
|
}
|
|
100757
|
-
let
|
|
100856
|
+
let guidance2 = `
|
|
100758
100857
|
[task CALL FAILED - IMMEDIATE RETRY REQUIRED]
|
|
100759
100858
|
|
|
100760
100859
|
**Error Type**: ${errorInfo.errorType}
|
|
@@ -100762,11 +100861,11 @@ function buildRetryGuidance(errorInfo) {
|
|
|
100762
100861
|
`;
|
|
100763
100862
|
const availableList = extractAvailableList(errorInfo.originalOutput);
|
|
100764
100863
|
if (availableList) {
|
|
100765
|
-
|
|
100864
|
+
guidance2 += `
|
|
100766
100865
|
**Available Options**: ${availableList}
|
|
100767
100866
|
`;
|
|
100768
100867
|
}
|
|
100769
|
-
|
|
100868
|
+
guidance2 += `
|
|
100770
100869
|
**Action**: Retry task NOW with corrected parameters.
|
|
100771
100870
|
|
|
100772
100871
|
Example of CORRECT call:
|
|
@@ -100780,7 +100879,7 @@ function buildRetryGuidance(errorInfo) {
|
|
|
100780
100879
|
)
|
|
100781
100880
|
\`\`\`
|
|
100782
100881
|
`;
|
|
100783
|
-
return
|
|
100882
|
+
return guidance2;
|
|
100784
100883
|
}
|
|
100785
100884
|
// packages/omo-opencode/src/hooks/delegate-task-retry/hook.ts
|
|
100786
100885
|
function createDelegateTaskRetryHook(_ctx) {
|
|
@@ -100792,9 +100891,9 @@ function createDelegateTaskRetryHook(_ctx) {
|
|
|
100792
100891
|
return;
|
|
100793
100892
|
const errorInfo = detectDelegateTaskError(output.output);
|
|
100794
100893
|
if (errorInfo) {
|
|
100795
|
-
const
|
|
100894
|
+
const guidance2 = buildRetryGuidance(errorInfo);
|
|
100796
100895
|
output.output += `
|
|
100797
|
-
${
|
|
100896
|
+
${guidance2}`;
|
|
100798
100897
|
}
|
|
100799
100898
|
}
|
|
100800
100899
|
};
|
|
@@ -110815,18 +110914,18 @@ import { existsSync as existsSync95, readdirSync as readdirSync23 } from "fs";
|
|
|
110815
110914
|
import { join as join108 } from "path";
|
|
110816
110915
|
|
|
110817
110916
|
// packages/claude-code-compat-core/src/shared/claude-config-dir.ts
|
|
110818
|
-
import { homedir as
|
|
110917
|
+
import { homedir as homedir29 } from "os";
|
|
110819
110918
|
import { join as join103 } from "path";
|
|
110820
110919
|
function getClaudeConfigDir3() {
|
|
110821
110920
|
const envConfigDir = process.env.CLAUDE_CONFIG_DIR;
|
|
110822
110921
|
if (envConfigDir) {
|
|
110823
110922
|
return envConfigDir;
|
|
110824
110923
|
}
|
|
110825
|
-
return join103(process.env.HOME || process.env.USERPROFILE ||
|
|
110924
|
+
return join103(process.env.HOME || process.env.USERPROFILE || homedir29(), ".claude");
|
|
110826
110925
|
}
|
|
110827
110926
|
// packages/claude-code-compat-core/src/shared/opencode-config-dir.ts
|
|
110828
110927
|
import { existsSync as existsSync91, realpathSync as realpathSync15 } from "fs";
|
|
110829
|
-
import { homedir as
|
|
110928
|
+
import { homedir as homedir30 } from "os";
|
|
110830
110929
|
import { join as join104, posix as posix7, resolve as resolve33, win32 as win3210 } from "path";
|
|
110831
110930
|
var TAURI_APP_IDENTIFIER3 = "ai.opencode.desktop";
|
|
110832
110931
|
var TAURI_APP_IDENTIFIER_DEV3 = "ai.opencode.desktop.dev";
|
|
@@ -110839,14 +110938,14 @@ function getTauriConfigDir3(identifier) {
|
|
|
110839
110938
|
const platform2 = process.platform;
|
|
110840
110939
|
switch (platform2) {
|
|
110841
110940
|
case "darwin":
|
|
110842
|
-
return join104(
|
|
110941
|
+
return join104(homedir30(), "Library", "Application Support", identifier);
|
|
110843
110942
|
case "win32": {
|
|
110844
|
-
const appData = process.env.APPDATA || join104(
|
|
110943
|
+
const appData = process.env.APPDATA || join104(homedir30(), "AppData", "Roaming");
|
|
110845
110944
|
return win3210.join(appData, identifier);
|
|
110846
110945
|
}
|
|
110847
110946
|
case "linux":
|
|
110848
110947
|
default: {
|
|
110849
|
-
const xdgConfig = process.env.XDG_CONFIG_HOME || join104(
|
|
110948
|
+
const xdgConfig = process.env.XDG_CONFIG_HOME || join104(homedir30(), ".config");
|
|
110850
110949
|
return join104(xdgConfig, identifier);
|
|
110851
110950
|
}
|
|
110852
110951
|
}
|
|
@@ -110890,7 +110989,7 @@ function getWslLinuxHomeDir3(windowsConfigRoot) {
|
|
|
110890
110989
|
function getCliDefaultConfigDir3() {
|
|
110891
110990
|
const envXdgConfig = process.env.XDG_CONFIG_HOME?.trim();
|
|
110892
110991
|
const shouldIgnoreWindowsXdg = envXdgConfig !== undefined && envXdgConfig.length > 0 && isWslEnvironment3() && isWindowsUserConfigRoot3(envXdgConfig);
|
|
110893
|
-
const xdgConfig = shouldIgnoreWindowsXdg ? posix7.join(getWslLinuxHomeDir3(envXdgConfig) ?? "/home", ".config") : envXdgConfig || join104(
|
|
110992
|
+
const xdgConfig = shouldIgnoreWindowsXdg ? posix7.join(getWslLinuxHomeDir3(envXdgConfig) ?? "/home", ".config") : envXdgConfig || join104(homedir30(), ".config");
|
|
110894
110993
|
const configDir = isWslEnvironment3() ? posix7.join(xdgConfig, "opencode") : join104(xdgConfig, "opencode");
|
|
110895
110994
|
return resolveConfigPath3(configDir);
|
|
110896
110995
|
}
|
|
@@ -110935,11 +111034,11 @@ function getOpenCodeConfigDir3(options) {
|
|
|
110935
111034
|
// packages/claude-code-compat-core/src/shared/jsonc-parser.ts
|
|
110936
111035
|
init_src();
|
|
110937
111036
|
// packages/claude-code-compat-core/src/shared/resolve-agent-definition-paths.ts
|
|
110938
|
-
import { homedir as
|
|
111037
|
+
import { homedir as homedir31 } from "os";
|
|
110939
111038
|
import { isAbsolute as isAbsolute18, join as join105, resolve as resolve34 } from "path";
|
|
110940
111039
|
function resolveAgentDefinitionPaths2(paths, baseDir, containmentDir) {
|
|
110941
111040
|
return paths.flatMap((p) => {
|
|
110942
|
-
const expanded = p.startsWith("~/") ? join105(
|
|
111041
|
+
const expanded = p.startsWith("~/") ? join105(homedir31(), p.slice(2)) : p;
|
|
110943
111042
|
const resolved = isAbsolute18(expanded) ? expanded : resolve34(baseDir, expanded);
|
|
110944
111043
|
if (containmentDir !== null && !isWithinProject(resolved, containmentDir)) {
|
|
110945
111044
|
log4(`agent_definitions path rejected (outside project boundary): ${p} -> ${resolved}`);
|
|
@@ -111470,9 +111569,7 @@ Description: ${task.description}
|
|
|
111470
111569
|
Agent: ${task.agent} (subagent)
|
|
111471
111570
|
Status: ${task.status}
|
|
111472
111571
|
|
|
111473
|
-
|
|
111474
|
-
|
|
111475
|
-
Do NOT call background_output now. Wait for <system-reminder> notification first.`;
|
|
111572
|
+
Do NOT call background_output now. Wait for <system-reminder> notification first. The system will deliver the result when the task completes; you do not need to poll for it.`;
|
|
111476
111573
|
} catch (error) {
|
|
111477
111574
|
const message = error instanceof Error ? error.message : String(error);
|
|
111478
111575
|
return `Failed to launch background agent task: ${message}`;
|
|
@@ -113722,9 +113819,7 @@ Agent: ${task.agent}
|
|
|
113722
113819
|
Status: ${task.status}
|
|
113723
113820
|
|
|
113724
113821
|
Agent continues with full previous context preserved.
|
|
113725
|
-
|
|
113726
|
-
|
|
113727
|
-
Do NOT call background_output now. Wait for <system-reminder> notification first.
|
|
113822
|
+
Do NOT call background_output now. Wait for <system-reminder> notification first. The system will deliver the result when the task completes; you do not need to poll for it.
|
|
113728
113823
|
|
|
113729
113824
|
${buildTaskMetadataBlock({
|
|
113730
113825
|
sessionId,
|
|
@@ -114738,9 +114833,7 @@ Description: ${task.description}
|
|
|
114738
114833
|
Agent: ${task.agent}${args.category ? ` (category: ${args.category})` : ""}
|
|
114739
114834
|
Status: ${task.status}
|
|
114740
114835
|
|
|
114741
|
-
|
|
114742
|
-
|
|
114743
|
-
Do NOT call background_output now. Wait for <system-reminder> notification first.${taskMetadataBlock}`;
|
|
114836
|
+
Do NOT call background_output now. Wait for <system-reminder> notification first. The system will deliver the result when the task completes; you do not need to poll for it.${taskMetadataBlock}`;
|
|
114744
114837
|
} catch (error) {
|
|
114745
114838
|
return formatDetailedError(error, {
|
|
114746
114839
|
operation: "Launch background task",
|
|
@@ -125004,7 +125097,7 @@ import { basename as basename22, dirname as dirname39, join as join120 } from "p
|
|
|
125004
125097
|
|
|
125005
125098
|
// packages/mcp-client-core/src/config-dir.ts
|
|
125006
125099
|
import { existsSync as existsSync100, realpathSync as realpathSync17 } from "fs";
|
|
125007
|
-
import { homedir as
|
|
125100
|
+
import { homedir as homedir32 } from "os";
|
|
125008
125101
|
import { join as join118, resolve as resolve36 } from "path";
|
|
125009
125102
|
function resolveConfigPath4(pathValue) {
|
|
125010
125103
|
const resolvedPath = resolve36(pathValue);
|
|
@@ -125023,7 +125116,7 @@ function getOpenCodeCliConfigDir(env2 = process.env) {
|
|
|
125023
125116
|
if (customConfigDir) {
|
|
125024
125117
|
return resolveConfigPath4(customConfigDir);
|
|
125025
125118
|
}
|
|
125026
|
-
const xdgConfigDir = env2["XDG_CONFIG_HOME"]?.trim() || join118(
|
|
125119
|
+
const xdgConfigDir = env2["XDG_CONFIG_HOME"]?.trim() || join118(homedir32(), ".config");
|
|
125027
125120
|
return resolveConfigPath4(join118(xdgConfigDir, "opencode"));
|
|
125028
125121
|
}
|
|
125029
125122
|
|
|
@@ -130576,10 +130669,10 @@ import { dirname as dirname40 } from "path";
|
|
|
130576
130669
|
// packages/omo-opencode/src/features/tui-sidebar/mirror-path.ts
|
|
130577
130670
|
import { createHash as createHash8 } from "crypto";
|
|
130578
130671
|
import { realpathSync as realpathSync18 } from "fs";
|
|
130579
|
-
import { homedir as
|
|
130672
|
+
import { homedir as homedir33 } from "os";
|
|
130580
130673
|
import { join as join121, resolve as resolve37 } from "path";
|
|
130581
130674
|
function mirrorStorageDir() {
|
|
130582
|
-
return join121(process.env.XDG_DATA_HOME ?? join121(
|
|
130675
|
+
return join121(process.env.XDG_DATA_HOME ?? join121(homedir33(), ".local", "share"), "opencode", "storage", "oh-my-openagent", MIRROR_DIR_NAME);
|
|
130583
130676
|
}
|
|
130584
130677
|
function canonicalProjectDir(projectDir) {
|
|
130585
130678
|
try {
|
|
@@ -133454,11 +133547,11 @@ import {
|
|
|
133454
133547
|
|
|
133455
133548
|
// packages/openclaw-core/src/reply-listener-paths.ts
|
|
133456
133549
|
import { existsSync as existsSync103, mkdirSync as mkdirSync22 } from "fs";
|
|
133457
|
-
import { homedir as
|
|
133550
|
+
import { homedir as homedir34 } from "os";
|
|
133458
133551
|
import { join as join123 } from "path";
|
|
133459
133552
|
var REPLY_LISTENER_SECURE_FILE_MODE = 384;
|
|
133460
133553
|
function resolveReplyListenerHomeDir() {
|
|
133461
|
-
return process.env.HOME ?? process.env.USERPROFILE ??
|
|
133554
|
+
return process.env.HOME ?? process.env.USERPROFILE ?? homedir34();
|
|
133462
133555
|
}
|
|
133463
133556
|
function getReplyListenerStateDir() {
|
|
133464
133557
|
return join123(resolveReplyListenerHomeDir(), ".omo", "openclaw", "state");
|
|
@@ -134661,7 +134754,7 @@ async function createRuntimeSkillSourceServer(options, runtimeEnv = runtime6) {
|
|
|
134661
134754
|
// packages/claude-code-compat-core/src/features/claude-code-mcp-loader/loader.ts
|
|
134662
134755
|
import { existsSync as existsSync108, readFileSync as readFileSync75 } from "fs";
|
|
134663
134756
|
import { join as join126 } from "path";
|
|
134664
|
-
import { homedir as
|
|
134757
|
+
import { homedir as homedir35 } from "os";
|
|
134665
134758
|
function getMcpConfigPaths() {
|
|
134666
134759
|
const claudeConfigDir = getClaudeConfigDir3();
|
|
134667
134760
|
const homeDir = getHomeDir();
|
|
@@ -134674,7 +134767,7 @@ function getMcpConfigPaths() {
|
|
|
134674
134767
|
];
|
|
134675
134768
|
}
|
|
134676
134769
|
function getHomeDir() {
|
|
134677
|
-
return process.env.HOME || process.env.USERPROFILE ||
|
|
134770
|
+
return process.env.HOME || process.env.USERPROFILE || homedir35();
|
|
134678
134771
|
}
|
|
134679
134772
|
async function loadMcpConfigFile(filePath) {
|
|
134680
134773
|
if (!existsSync108(filePath)) {
|
|
@@ -141603,14 +141696,14 @@ function createHephaestusAgent(model, availableAgents, availableToolNames, avail
|
|
|
141603
141696
|
createHephaestusAgent.mode = MODE9;
|
|
141604
141697
|
// packages/omo-opencode/src/agents/builtin-agents/resolve-file-uri.ts
|
|
141605
141698
|
import { existsSync as existsSync109, readFileSync as readFileSync76 } from "fs";
|
|
141606
|
-
import { homedir as
|
|
141699
|
+
import { homedir as homedir36 } from "os";
|
|
141607
141700
|
import { isAbsolute as isAbsolute20, join as join127, resolve as resolve38 } from "path";
|
|
141608
141701
|
init_logger2();
|
|
141609
141702
|
var ALLOWED_HOME_SUBDIRS = [
|
|
141610
|
-
join127(
|
|
141611
|
-
join127(
|
|
141612
|
-
join127(
|
|
141613
|
-
join127(
|
|
141703
|
+
join127(homedir36(), ".config", "opencode"),
|
|
141704
|
+
join127(homedir36(), ".config", "oh-my-openagent"),
|
|
141705
|
+
join127(homedir36(), ".omo"),
|
|
141706
|
+
join127(homedir36(), ".opencode")
|
|
141614
141707
|
];
|
|
141615
141708
|
function isWithinAllowedPaths(filePath, projectRoot) {
|
|
141616
141709
|
if (isWithinProject(filePath, projectRoot))
|
|
@@ -141628,7 +141721,7 @@ function resolvePromptAppend(promptAppend, configDir) {
|
|
|
141628
141721
|
let filePath;
|
|
141629
141722
|
try {
|
|
141630
141723
|
const decoded = decodeURIComponent(encoded);
|
|
141631
|
-
const expanded = decoded.startsWith("~/") ? decoded.replace(/^~\//, `${
|
|
141724
|
+
const expanded = decoded.startsWith("~/") ? decoded.replace(/^~\//, `${homedir36()}/`) : decoded;
|
|
141632
141725
|
filePath = isAbsolute20(expanded) ? expanded : resolve38(configDir ?? process.cwd(), expanded);
|
|
141633
141726
|
} catch (error) {
|
|
141634
141727
|
if (!(error instanceof Error)) {
|
|
@@ -149953,6 +150046,7 @@ function createToolDefinitionHandler(args) {
|
|
|
149953
150046
|
}
|
|
149954
150047
|
|
|
149955
150048
|
// packages/omo-opencode/src/plugin/tool-execute-after.ts
|
|
150049
|
+
init_src();
|
|
149956
150050
|
init_logger2();
|
|
149957
150051
|
var VERIFICATION_ATTEMPT_PATTERN = /<ulw_verification_attempt_id>(.*?)<\/ulw_verification_attempt_id>/i;
|
|
149958
150052
|
var METADATA_LINKED_TOOLS = new Set([
|
|
@@ -149978,12 +150072,25 @@ function getPluginDirectory(ctx) {
|
|
|
149978
150072
|
function expectsRecoverableMetadata(tool3) {
|
|
149979
150073
|
return METADATA_LINKED_TOOLS.has(tool3);
|
|
149980
150074
|
}
|
|
150075
|
+
function appendCodegraphInitGuidance(input, output, cwd) {
|
|
150076
|
+
const guidance2 = buildCodegraphInitGuidanceForToolResult({
|
|
150077
|
+
cwd: cwd ?? undefined,
|
|
150078
|
+
toolName: input.tool,
|
|
150079
|
+
toolOutput: output.output
|
|
150080
|
+
});
|
|
150081
|
+
if (guidance2 === null || output.output.includes(guidance2))
|
|
150082
|
+
return;
|
|
150083
|
+
output.output = `${output.output}
|
|
150084
|
+
|
|
150085
|
+
${guidance2}`;
|
|
150086
|
+
}
|
|
149981
150087
|
function createToolExecuteAfterHandler3(args) {
|
|
149982
150088
|
const { ctx, hooks } = args;
|
|
149983
150089
|
const log8 = args.log ?? log2;
|
|
149984
150090
|
return async (input, output) => {
|
|
149985
150091
|
if (!output)
|
|
149986
150092
|
return;
|
|
150093
|
+
appendCodegraphInitGuidance(input, output, getPluginDirectory(ctx));
|
|
149987
150094
|
const hookInput = {
|
|
149988
150095
|
tool: input.tool,
|
|
149989
150096
|
sessionID: input.sessionID,
|
|
@@ -150379,7 +150486,7 @@ function createPluginInterface(args) {
|
|
|
150379
150486
|
|
|
150380
150487
|
// packages/omo-opencode/src/plugin-config/layered-config-loader.ts
|
|
150381
150488
|
import * as fs25 from "fs";
|
|
150382
|
-
import { homedir as
|
|
150489
|
+
import { homedir as homedir37 } from "os";
|
|
150383
150490
|
import * as path27 from "path";
|
|
150384
150491
|
|
|
150385
150492
|
// packages/omo-opencode/src/config/schema/agent-names.ts
|
|
@@ -151221,7 +151328,7 @@ function loadConfigFromPath2(configPath, _ctx) {
|
|
|
151221
151328
|
|
|
151222
151329
|
// packages/omo-opencode/src/plugin-config/layered-config-loader.ts
|
|
151223
151330
|
function resolveHomeDirectory() {
|
|
151224
|
-
return process.env.HOME ?? process.env.USERPROFILE ??
|
|
151331
|
+
return process.env.HOME ?? process.env.USERPROFILE ?? homedir37();
|
|
151225
151332
|
}
|
|
151226
151333
|
function resolveConfigPathAfterLegacyMigration(detectedPath) {
|
|
151227
151334
|
if (!path27.basename(detectedPath).startsWith(LEGACY_CONFIG_BASENAME)) {
|