oh-my-opencode 3.17.2 → 3.17.4
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 +482 -374
- package/dist/config/schema/agent-definitions.d.ts +3 -0
- package/dist/config/schema/oh-my-opencode-config.d.ts +1 -0
- package/dist/features/background-agent/index.d.ts +2 -0
- package/dist/features/background-agent/wait-for-task-session.d.ts +17 -0
- package/dist/features/claude-code-agent-loader/agent-definitions-loader.d.ts +3 -0
- package/dist/features/claude-code-agent-loader/index.d.ts +3 -0
- package/dist/features/claude-code-agent-loader/json-agent-loader.d.ts +2 -0
- package/dist/features/claude-code-agent-loader/loader.d.ts +2 -0
- package/dist/features/claude-code-agent-loader/opencode-config-agents-reader.d.ts +2 -0
- package/dist/features/claude-code-agent-loader/types.d.ts +9 -1
- package/dist/features/tool-metadata-store/index.d.ts +7 -0
- package/dist/features/tool-metadata-store/publish-tool-metadata.d.ts +9 -0
- package/dist/features/tool-metadata-store/recover-tool-metadata.d.ts +3 -0
- package/dist/features/tool-metadata-store/resolve-tool-call-id.d.ts +6 -0
- package/dist/features/tool-metadata-store/task-metadata-contract.d.ts +10 -0
- package/dist/hooks/keyword-detector/ultrawork/default.d.ts +1 -1
- package/dist/hooks/keyword-detector/ultrawork/gemini.d.ts +1 -1
- package/dist/hooks/keyword-detector/ultrawork/gpt.d.ts +1 -1
- package/dist/hooks/keyword-detector/ultrawork/planner.d.ts +1 -1
- package/dist/index.js +15585 -15141
- package/dist/oh-my-opencode.schema.json +7 -0
- package/dist/shared/agent-tool-restrictions.d.ts +0 -5
- package/dist/shared/index.d.ts +3 -0
- package/dist/shared/opencode-provider-auth.d.ts +3 -0
- package/dist/shared/parse-tools-config.d.ts +6 -0
- package/dist/shared/resolve-agent-definition-paths.d.ts +1 -0
- package/dist/tools/call-omo-agent/agent-resolver.d.ts +17 -0
- package/dist/tools/call-omo-agent/constants.d.ts +1 -1
- package/package.json +12 -12
- package/dist/tools/delegate-task/resolve-call-id.d.ts +0 -2
package/dist/cli/index.js
CHANGED
|
@@ -4915,6 +4915,42 @@ var init_command_executor = __esm(() => {
|
|
|
4915
4915
|
});
|
|
4916
4916
|
|
|
4917
4917
|
// src/shared/contains-path.ts
|
|
4918
|
+
import { existsSync, realpathSync } from "fs";
|
|
4919
|
+
import { basename, dirname, isAbsolute, join, normalize, relative, resolve } from "path";
|
|
4920
|
+
function findNearestExistingAncestor(resolvedPath) {
|
|
4921
|
+
let candidatePath = resolvedPath;
|
|
4922
|
+
while (!existsSync(candidatePath)) {
|
|
4923
|
+
const parentPath = dirname(candidatePath);
|
|
4924
|
+
if (parentPath === candidatePath) {
|
|
4925
|
+
return candidatePath;
|
|
4926
|
+
}
|
|
4927
|
+
candidatePath = parentPath;
|
|
4928
|
+
}
|
|
4929
|
+
return candidatePath;
|
|
4930
|
+
}
|
|
4931
|
+
function toCanonicalPath(pathToNormalize) {
|
|
4932
|
+
const resolvedPath = resolve(pathToNormalize);
|
|
4933
|
+
if (existsSync(resolvedPath)) {
|
|
4934
|
+
try {
|
|
4935
|
+
return normalize(realpathSync.native(resolvedPath));
|
|
4936
|
+
} catch {
|
|
4937
|
+
return normalize(resolvedPath);
|
|
4938
|
+
}
|
|
4939
|
+
}
|
|
4940
|
+
const nearestExistingAncestor = findNearestExistingAncestor(resolvedPath);
|
|
4941
|
+
const canonicalAncestor = existsSync(nearestExistingAncestor) ? realpathSync.native(nearestExistingAncestor) : nearestExistingAncestor;
|
|
4942
|
+
const relativePathFromAncestor = relative(nearestExistingAncestor, resolvedPath);
|
|
4943
|
+
return normalize(join(canonicalAncestor, relativePathFromAncestor || basename(resolvedPath)));
|
|
4944
|
+
}
|
|
4945
|
+
function containsPath(rootPath, candidatePath) {
|
|
4946
|
+
const canonicalRootPath = toCanonicalPath(rootPath);
|
|
4947
|
+
const canonicalCandidatePath = toCanonicalPath(candidatePath);
|
|
4948
|
+
const relativePath = relative(canonicalRootPath, canonicalCandidatePath);
|
|
4949
|
+
return relativePath === "" || !relativePath.startsWith("..") && !isAbsolute(relativePath);
|
|
4950
|
+
}
|
|
4951
|
+
function isWithinProject(candidatePath, projectRoot) {
|
|
4952
|
+
return containsPath(projectRoot, candidatePath);
|
|
4953
|
+
}
|
|
4918
4954
|
var init_contains_path = () => {};
|
|
4919
4955
|
|
|
4920
4956
|
// src/shared/plugin-identity.ts
|
|
@@ -5018,13 +5054,13 @@ var init_pattern_matcher = __esm(() => {
|
|
|
5018
5054
|
regexCache = new Map;
|
|
5019
5055
|
});
|
|
5020
5056
|
// src/shared/file-utils.ts
|
|
5021
|
-
import { lstatSync, realpathSync } from "fs";
|
|
5057
|
+
import { lstatSync, realpathSync as realpathSync2 } from "fs";
|
|
5022
5058
|
function normalizeDarwinRealpath(filePath) {
|
|
5023
5059
|
return filePath.startsWith("/private/var/") ? filePath.slice("/private".length) : filePath;
|
|
5024
5060
|
}
|
|
5025
5061
|
function resolveSymlink(filePath) {
|
|
5026
5062
|
try {
|
|
5027
|
-
return normalizeDarwinRealpath(
|
|
5063
|
+
return normalizeDarwinRealpath(realpathSync2(filePath));
|
|
5028
5064
|
} catch {
|
|
5029
5065
|
return filePath;
|
|
5030
5066
|
}
|
|
@@ -5982,8 +6018,8 @@ var init_main = __esm(() => {
|
|
|
5982
6018
|
});
|
|
5983
6019
|
|
|
5984
6020
|
// src/shared/jsonc-parser.ts
|
|
5985
|
-
import { existsSync, readFileSync } from "fs";
|
|
5986
|
-
import { join as
|
|
6021
|
+
import { existsSync as existsSync2, readFileSync } from "fs";
|
|
6022
|
+
import { join as join4 } from "path";
|
|
5987
6023
|
function stripBom(content) {
|
|
5988
6024
|
return content.charCodeAt(0) === 65279 ? content.slice(1) : content;
|
|
5989
6025
|
}
|
|
@@ -6003,17 +6039,17 @@ function parseJsonc(content) {
|
|
|
6003
6039
|
function detectConfigFile(basePath) {
|
|
6004
6040
|
const jsoncPath = `${basePath}.jsonc`;
|
|
6005
6041
|
const jsonPath = `${basePath}.json`;
|
|
6006
|
-
if (
|
|
6042
|
+
if (existsSync2(jsoncPath)) {
|
|
6007
6043
|
return { format: "jsonc", path: jsoncPath };
|
|
6008
6044
|
}
|
|
6009
|
-
if (
|
|
6045
|
+
if (existsSync2(jsonPath)) {
|
|
6010
6046
|
return { format: "json", path: jsonPath };
|
|
6011
6047
|
}
|
|
6012
6048
|
return { format: "none", path: jsonPath };
|
|
6013
6049
|
}
|
|
6014
6050
|
function detectPluginConfigFile(dir) {
|
|
6015
|
-
const canonicalResult = detectConfigFile(
|
|
6016
|
-
const legacyResult = detectConfigFile(
|
|
6051
|
+
const canonicalResult = detectConfigFile(join4(dir, CONFIG_BASENAME));
|
|
6052
|
+
const legacyResult = detectConfigFile(join4(dir, LEGACY_CONFIG_BASENAME));
|
|
6017
6053
|
if (canonicalResult.format !== "none") {
|
|
6018
6054
|
return {
|
|
6019
6055
|
...canonicalResult,
|
|
@@ -6023,7 +6059,7 @@ function detectPluginConfigFile(dir) {
|
|
|
6023
6059
|
if (legacyResult.format !== "none") {
|
|
6024
6060
|
return legacyResult;
|
|
6025
6061
|
}
|
|
6026
|
-
return { format: "none", path:
|
|
6062
|
+
return { format: "none", path: join4(dir, `${CONFIG_BASENAME}.json`) };
|
|
6027
6063
|
}
|
|
6028
6064
|
var init_jsonc_parser = __esm(() => {
|
|
6029
6065
|
init_main();
|
|
@@ -6335,20 +6371,28 @@ function migrateConfigFile(configPath, rawConfig) {
|
|
|
6335
6371
|
}
|
|
6336
6372
|
}
|
|
6337
6373
|
if (needsWrite) {
|
|
6374
|
+
let finalConfig = JSON.parse(JSON.stringify(copy));
|
|
6375
|
+
const newContent = JSON.stringify(finalConfig, null, 2) + `
|
|
6376
|
+
`;
|
|
6377
|
+
let existingContent;
|
|
6378
|
+
try {
|
|
6379
|
+
existingContent = fs3.readFileSync(configPath, "utf-8");
|
|
6380
|
+
} catch {}
|
|
6381
|
+
const contentChanged = existingContent !== newContent;
|
|
6338
6382
|
const timestamp2 = new Date().toISOString().replace(/[:.]/g, "-");
|
|
6339
6383
|
const backupPath = `${configPath}.bak.${timestamp2}`;
|
|
6340
6384
|
let backupSucceeded = false;
|
|
6341
|
-
|
|
6342
|
-
|
|
6343
|
-
|
|
6344
|
-
|
|
6345
|
-
|
|
6385
|
+
if (contentChanged) {
|
|
6386
|
+
try {
|
|
6387
|
+
fs3.copyFileSync(configPath, backupPath);
|
|
6388
|
+
backupSucceeded = true;
|
|
6389
|
+
} catch {
|
|
6390
|
+
backupSucceeded = false;
|
|
6391
|
+
}
|
|
6346
6392
|
}
|
|
6347
6393
|
let writeSucceeded = false;
|
|
6348
|
-
let finalConfig = JSON.parse(JSON.stringify(copy));
|
|
6349
6394
|
try {
|
|
6350
|
-
writeFileAtomically(configPath,
|
|
6351
|
-
`);
|
|
6395
|
+
writeFileAtomically(configPath, newContent);
|
|
6352
6396
|
writeSucceeded = true;
|
|
6353
6397
|
} catch (err) {
|
|
6354
6398
|
log(`Failed to write migrated config to ${configPath}:`, err);
|
|
@@ -6400,9 +6444,9 @@ var init_migration = __esm(() => {
|
|
|
6400
6444
|
});
|
|
6401
6445
|
|
|
6402
6446
|
// src/shared/opencode-config-dir.ts
|
|
6403
|
-
import { existsSync as
|
|
6447
|
+
import { existsSync as existsSync4, realpathSync as realpathSync3 } from "fs";
|
|
6404
6448
|
import { homedir as homedir2 } from "os";
|
|
6405
|
-
import { join as
|
|
6449
|
+
import { join as join5, resolve as resolve2, win32 } from "path";
|
|
6406
6450
|
function isDevBuild(version) {
|
|
6407
6451
|
if (!version)
|
|
6408
6452
|
return false;
|
|
@@ -6412,24 +6456,24 @@ function getTauriConfigDir(identifier) {
|
|
|
6412
6456
|
const platform = process.platform;
|
|
6413
6457
|
switch (platform) {
|
|
6414
6458
|
case "darwin":
|
|
6415
|
-
return
|
|
6459
|
+
return join5(homedir2(), "Library", "Application Support", identifier);
|
|
6416
6460
|
case "win32": {
|
|
6417
|
-
const appData = process.env.APPDATA ||
|
|
6461
|
+
const appData = process.env.APPDATA || join5(homedir2(), "AppData", "Roaming");
|
|
6418
6462
|
return win32.join(appData, identifier);
|
|
6419
6463
|
}
|
|
6420
6464
|
case "linux":
|
|
6421
6465
|
default: {
|
|
6422
|
-
const xdgConfig = process.env.XDG_CONFIG_HOME ||
|
|
6423
|
-
return
|
|
6466
|
+
const xdgConfig = process.env.XDG_CONFIG_HOME || join5(homedir2(), ".config");
|
|
6467
|
+
return join5(xdgConfig, identifier);
|
|
6424
6468
|
}
|
|
6425
6469
|
}
|
|
6426
6470
|
}
|
|
6427
6471
|
function resolveConfigPath(pathValue) {
|
|
6428
|
-
const resolvedPath =
|
|
6429
|
-
if (!
|
|
6472
|
+
const resolvedPath = resolve2(pathValue);
|
|
6473
|
+
if (!existsSync4(resolvedPath))
|
|
6430
6474
|
return resolvedPath;
|
|
6431
6475
|
try {
|
|
6432
|
-
return
|
|
6476
|
+
return realpathSync3(resolvedPath);
|
|
6433
6477
|
} catch {
|
|
6434
6478
|
return resolvedPath;
|
|
6435
6479
|
}
|
|
@@ -6439,8 +6483,8 @@ function getCliConfigDir() {
|
|
|
6439
6483
|
if (envConfigDir) {
|
|
6440
6484
|
return resolveConfigPath(envConfigDir);
|
|
6441
6485
|
}
|
|
6442
|
-
const xdgConfig = process.env.XDG_CONFIG_HOME ||
|
|
6443
|
-
return resolveConfigPath(
|
|
6486
|
+
const xdgConfig = process.env.XDG_CONFIG_HOME || join5(homedir2(), ".config");
|
|
6487
|
+
return resolveConfigPath(join5(xdgConfig, "opencode"));
|
|
6444
6488
|
}
|
|
6445
6489
|
function getOpenCodeConfigDir(options) {
|
|
6446
6490
|
const { binary: binary2, version, checkExisting = true } = options;
|
|
@@ -6452,9 +6496,9 @@ function getOpenCodeConfigDir(options) {
|
|
|
6452
6496
|
const tauriDir = process.platform === "win32" ? win32.isAbsolute(tauriDirBase) ? win32.normalize(tauriDirBase) : win32.resolve(tauriDirBase) : resolveConfigPath(tauriDirBase);
|
|
6453
6497
|
if (checkExisting) {
|
|
6454
6498
|
const legacyDir = getCliConfigDir();
|
|
6455
|
-
const legacyConfig =
|
|
6456
|
-
const legacyConfigC =
|
|
6457
|
-
if (
|
|
6499
|
+
const legacyConfig = join5(legacyDir, "opencode.json");
|
|
6500
|
+
const legacyConfigC = join5(legacyDir, "opencode.jsonc");
|
|
6501
|
+
if (existsSync4(legacyConfig) || existsSync4(legacyConfigC)) {
|
|
6458
6502
|
return legacyDir;
|
|
6459
6503
|
}
|
|
6460
6504
|
}
|
|
@@ -6464,10 +6508,10 @@ function getOpenCodeConfigPaths(options) {
|
|
|
6464
6508
|
const configDir = getOpenCodeConfigDir(options);
|
|
6465
6509
|
return {
|
|
6466
6510
|
configDir,
|
|
6467
|
-
configJson:
|
|
6468
|
-
configJsonc:
|
|
6469
|
-
packageJson:
|
|
6470
|
-
omoConfig:
|
|
6511
|
+
configJson: join5(configDir, "opencode.json"),
|
|
6512
|
+
configJsonc: join5(configDir, "opencode.jsonc"),
|
|
6513
|
+
packageJson: join5(configDir, "package.json"),
|
|
6514
|
+
omoConfig: join5(configDir, `${CONFIG_BASENAME}.json`)
|
|
6471
6515
|
};
|
|
6472
6516
|
}
|
|
6473
6517
|
var TAURI_APP_IDENTIFIER = "ai.opencode.desktop", TAURI_APP_IDENTIFIER_DEV = "ai.opencode.desktop.dev";
|
|
@@ -6475,6 +6519,25 @@ var init_opencode_config_dir = __esm(() => {
|
|
|
6475
6519
|
init_plugin_identity();
|
|
6476
6520
|
});
|
|
6477
6521
|
|
|
6522
|
+
// src/shared/resolve-agent-definition-paths.ts
|
|
6523
|
+
import { homedir as homedir3 } from "os";
|
|
6524
|
+
import { isAbsolute as isAbsolute2, resolve as resolve3 } from "path";
|
|
6525
|
+
function resolveAgentDefinitionPaths(paths, baseDir, containmentDir) {
|
|
6526
|
+
return paths.flatMap((p) => {
|
|
6527
|
+
const expanded = p.startsWith("~/") ? p.replace(/^~\//, `${homedir3()}/`) : p;
|
|
6528
|
+
const resolved = isAbsolute2(expanded) ? expanded : resolve3(baseDir, expanded);
|
|
6529
|
+
if (containmentDir !== null && !isWithinProject(resolved, containmentDir)) {
|
|
6530
|
+
log(`agent_definitions path rejected (outside project boundary): ${p} -> ${resolved}`);
|
|
6531
|
+
return [];
|
|
6532
|
+
}
|
|
6533
|
+
return [resolved];
|
|
6534
|
+
});
|
|
6535
|
+
}
|
|
6536
|
+
var init_resolve_agent_definition_paths = __esm(() => {
|
|
6537
|
+
init_contains_path();
|
|
6538
|
+
init_logger();
|
|
6539
|
+
});
|
|
6540
|
+
|
|
6478
6541
|
// src/shared/opencode-version.ts
|
|
6479
6542
|
import { execSync } from "child_process";
|
|
6480
6543
|
function parseVersion(version) {
|
|
@@ -6526,8 +6589,8 @@ var init_opencode_version = __esm(() => {
|
|
|
6526
6589
|
});
|
|
6527
6590
|
|
|
6528
6591
|
// src/shared/opencode-storage-detection.ts
|
|
6529
|
-
import { existsSync as
|
|
6530
|
-
import { join as
|
|
6592
|
+
import { existsSync as existsSync5 } from "fs";
|
|
6593
|
+
import { join as join6 } from "path";
|
|
6531
6594
|
function isSqliteBackend() {
|
|
6532
6595
|
if (cachedResult === true)
|
|
6533
6596
|
return true;
|
|
@@ -6535,8 +6598,8 @@ function isSqliteBackend() {
|
|
|
6535
6598
|
return false;
|
|
6536
6599
|
const check = () => {
|
|
6537
6600
|
const versionOk = isOpenCodeVersionAtLeast(OPENCODE_SQLITE_VERSION);
|
|
6538
|
-
const dbPath =
|
|
6539
|
-
return versionOk &&
|
|
6601
|
+
const dbPath = join6(getDataDir(), "opencode", "opencode.db");
|
|
6602
|
+
return versionOk && existsSync5(dbPath);
|
|
6540
6603
|
};
|
|
6541
6604
|
if (cachedResult === FALSE_PENDING_RETRY) {
|
|
6542
6605
|
const result2 = check();
|
|
@@ -6608,17 +6671,94 @@ var init_zip_extractor = __esm(() => {
|
|
|
6608
6671
|
});
|
|
6609
6672
|
|
|
6610
6673
|
// src/shared/binary-downloader.ts
|
|
6611
|
-
import { chmodSync, existsSync as
|
|
6674
|
+
import { chmodSync, existsSync as existsSync6, mkdirSync as mkdirSync3, unlinkSync as unlinkSync2 } from "fs";
|
|
6612
6675
|
import * as path4 from "path";
|
|
6613
6676
|
function getCachedBinaryPath(cacheDir, binaryName) {
|
|
6614
6677
|
const binaryPath = path4.join(cacheDir, binaryName);
|
|
6615
|
-
return
|
|
6678
|
+
return existsSync6(binaryPath) ? binaryPath : null;
|
|
6616
6679
|
}
|
|
6617
6680
|
var init_binary_downloader = __esm(() => {
|
|
6618
6681
|
init_archive_entry_validator();
|
|
6619
6682
|
init_zip_extractor();
|
|
6620
6683
|
});
|
|
6621
6684
|
|
|
6685
|
+
// src/shared/agent-display-names.ts
|
|
6686
|
+
function stripInvisibleAgentCharacters(agentName) {
|
|
6687
|
+
return agentName.replace(INVISIBLE_AGENT_CHARACTERS_REGEX, "");
|
|
6688
|
+
}
|
|
6689
|
+
function stripAgentListSortPrefix(agentName) {
|
|
6690
|
+
return stripInvisibleAgentCharacters(agentName);
|
|
6691
|
+
}
|
|
6692
|
+
function getAgentRuntimeName(configKey) {
|
|
6693
|
+
const displayName = getAgentDisplayName(configKey);
|
|
6694
|
+
const prefix = AGENT_LIST_SORT_PREFIXES[configKey.toLowerCase()];
|
|
6695
|
+
return prefix ? `${prefix}${displayName}` : displayName;
|
|
6696
|
+
}
|
|
6697
|
+
function getAgentDisplayName(configKey) {
|
|
6698
|
+
const exactMatch = AGENT_DISPLAY_NAMES[configKey];
|
|
6699
|
+
if (exactMatch !== undefined)
|
|
6700
|
+
return exactMatch;
|
|
6701
|
+
const lowerKey = configKey.toLowerCase();
|
|
6702
|
+
for (const [k, v] of Object.entries(AGENT_DISPLAY_NAMES)) {
|
|
6703
|
+
if (k.toLowerCase() === lowerKey)
|
|
6704
|
+
return v;
|
|
6705
|
+
}
|
|
6706
|
+
return configKey;
|
|
6707
|
+
}
|
|
6708
|
+
function resolveKnownAgentConfigKey(agentName) {
|
|
6709
|
+
const lower = stripAgentListSortPrefix(agentName).trim().toLowerCase();
|
|
6710
|
+
const reversed = REVERSE_DISPLAY_NAMES[lower];
|
|
6711
|
+
if (reversed !== undefined)
|
|
6712
|
+
return reversed;
|
|
6713
|
+
const legacy = LEGACY_DISPLAY_NAMES[lower];
|
|
6714
|
+
if (legacy !== undefined)
|
|
6715
|
+
return legacy;
|
|
6716
|
+
if (AGENT_DISPLAY_NAMES[lower] !== undefined)
|
|
6717
|
+
return lower;
|
|
6718
|
+
return;
|
|
6719
|
+
}
|
|
6720
|
+
function getAgentConfigKey(agentName) {
|
|
6721
|
+
const lower = stripAgentListSortPrefix(agentName).trim().toLowerCase();
|
|
6722
|
+
return resolveKnownAgentConfigKey(agentName) ?? lower;
|
|
6723
|
+
}
|
|
6724
|
+
var AGENT_DISPLAY_NAMES, AGENT_LIST_SORT_PREFIXES, INVISIBLE_AGENT_CHARACTERS_REGEX, REVERSE_DISPLAY_NAMES, LEGACY_DISPLAY_NAMES;
|
|
6725
|
+
var init_agent_display_names = __esm(() => {
|
|
6726
|
+
AGENT_DISPLAY_NAMES = {
|
|
6727
|
+
sisyphus: "Sisyphus - Ultraworker",
|
|
6728
|
+
hephaestus: "Hephaestus - Deep Agent",
|
|
6729
|
+
prometheus: "Prometheus - Plan Builder",
|
|
6730
|
+
atlas: "Atlas - Plan Executor",
|
|
6731
|
+
"sisyphus-junior": "Sisyphus-Junior",
|
|
6732
|
+
metis: "Metis - Plan Consultant",
|
|
6733
|
+
momus: "Momus - Plan Critic",
|
|
6734
|
+
athena: "Athena - Council",
|
|
6735
|
+
"athena-junior": "Athena-Junior - Council",
|
|
6736
|
+
oracle: "oracle",
|
|
6737
|
+
librarian: "librarian",
|
|
6738
|
+
explore: "explore",
|
|
6739
|
+
"multimodal-looker": "multimodal-looker",
|
|
6740
|
+
"council-member": "council-member"
|
|
6741
|
+
};
|
|
6742
|
+
AGENT_LIST_SORT_PREFIXES = {
|
|
6743
|
+
sisyphus: "\u200B",
|
|
6744
|
+
hephaestus: "\u200B\u200B",
|
|
6745
|
+
prometheus: "\u200B\u200B\u200B",
|
|
6746
|
+
atlas: "\u200B\u200B\u200B\u200B"
|
|
6747
|
+
};
|
|
6748
|
+
INVISIBLE_AGENT_CHARACTERS_REGEX = /[\u200B\u200C\u200D\uFEFF]/g;
|
|
6749
|
+
REVERSE_DISPLAY_NAMES = Object.fromEntries(Object.entries(AGENT_DISPLAY_NAMES).map(([key, displayName]) => [displayName.toLowerCase(), key]));
|
|
6750
|
+
LEGACY_DISPLAY_NAMES = {
|
|
6751
|
+
"sisyphus (ultraworker)": "sisyphus",
|
|
6752
|
+
"hephaestus (deep agent)": "hephaestus",
|
|
6753
|
+
"prometheus (plan builder)": "prometheus",
|
|
6754
|
+
"atlas (plan executor)": "atlas",
|
|
6755
|
+
"metis (plan consultant)": "metis",
|
|
6756
|
+
"momus (plan critic)": "momus",
|
|
6757
|
+
"athena (council)": "athena",
|
|
6758
|
+
"athena-junior (council)": "athena-junior"
|
|
6759
|
+
};
|
|
6760
|
+
});
|
|
6761
|
+
|
|
6622
6762
|
// src/shared/model-requirements.ts
|
|
6623
6763
|
var AGENT_MODEL_REQUIREMENTS, CATEGORY_MODEL_REQUIREMENTS;
|
|
6624
6764
|
var init_model_requirements = __esm(() => {
|
|
@@ -6945,6 +7085,7 @@ var init_model_requirements = __esm(() => {
|
|
|
6945
7085
|
|
|
6946
7086
|
// src/shared/agent-variant.ts
|
|
6947
7087
|
var init_agent_variant = __esm(() => {
|
|
7088
|
+
init_agent_display_names();
|
|
6948
7089
|
init_model_requirements();
|
|
6949
7090
|
});
|
|
6950
7091
|
|
|
@@ -6963,6 +7104,9 @@ function detectShellType() {
|
|
|
6963
7104
|
}
|
|
6964
7105
|
return "unix";
|
|
6965
7106
|
}
|
|
7107
|
+
if (process.env.MSYSTEM) {
|
|
7108
|
+
return "unix";
|
|
7109
|
+
}
|
|
6966
7110
|
if (process.env.PSModulePath) {
|
|
6967
7111
|
return "powershell";
|
|
6968
7112
|
}
|
|
@@ -6973,7 +7117,9 @@ function detectShellType() {
|
|
|
6973
7117
|
var init_system_directive = () => {};
|
|
6974
7118
|
|
|
6975
7119
|
// src/shared/agent-tool-restrictions.ts
|
|
6976
|
-
var init_agent_tool_restrictions = () => {
|
|
7120
|
+
var init_agent_tool_restrictions = __esm(() => {
|
|
7121
|
+
init_agent_display_names();
|
|
7122
|
+
});
|
|
6977
7123
|
|
|
6978
7124
|
// src/shared/model-normalization.ts
|
|
6979
7125
|
function normalizeModelID(modelID) {
|
|
@@ -6981,19 +7127,19 @@ function normalizeModelID(modelID) {
|
|
|
6981
7127
|
}
|
|
6982
7128
|
|
|
6983
7129
|
// src/shared/json-file-cache-store.ts
|
|
6984
|
-
import { existsSync as
|
|
6985
|
-
import { join as
|
|
7130
|
+
import { existsSync as existsSync7, mkdirSync as mkdirSync4, readFileSync as readFileSync4, writeFileSync as writeFileSync2 } from "fs";
|
|
7131
|
+
import { join as join8 } from "path";
|
|
6986
7132
|
function toLogLabel(cacheLabel) {
|
|
6987
7133
|
return cacheLabel.toLowerCase();
|
|
6988
7134
|
}
|
|
6989
7135
|
function createJsonFileCacheStore(options) {
|
|
6990
7136
|
let memoryValue;
|
|
6991
7137
|
function getCacheFilePath() {
|
|
6992
|
-
return
|
|
7138
|
+
return join8(options.getCacheDir(), options.filename);
|
|
6993
7139
|
}
|
|
6994
7140
|
function ensureCacheDir() {
|
|
6995
7141
|
const cacheDir = options.getCacheDir();
|
|
6996
|
-
if (!
|
|
7142
|
+
if (!existsSync7(cacheDir)) {
|
|
6997
7143
|
mkdirSync4(cacheDir, { recursive: true });
|
|
6998
7144
|
}
|
|
6999
7145
|
}
|
|
@@ -7002,13 +7148,13 @@ function createJsonFileCacheStore(options) {
|
|
|
7002
7148
|
return memoryValue;
|
|
7003
7149
|
}
|
|
7004
7150
|
const cacheFile = getCacheFilePath();
|
|
7005
|
-
if (!
|
|
7151
|
+
if (!existsSync7(cacheFile)) {
|
|
7006
7152
|
memoryValue = null;
|
|
7007
7153
|
log(`[${options.logPrefix}] ${options.cacheLabel} file not found`, { cacheFile });
|
|
7008
7154
|
return null;
|
|
7009
7155
|
}
|
|
7010
7156
|
try {
|
|
7011
|
-
const content =
|
|
7157
|
+
const content = readFileSync4(cacheFile, "utf-8");
|
|
7012
7158
|
const value = JSON.parse(content);
|
|
7013
7159
|
memoryValue = value;
|
|
7014
7160
|
log(`[${options.logPrefix}] Read ${toLogLabel(options.cacheLabel)}`, options.describe(value));
|
|
@@ -7022,7 +7168,7 @@ function createJsonFileCacheStore(options) {
|
|
|
7022
7168
|
}
|
|
7023
7169
|
}
|
|
7024
7170
|
function has() {
|
|
7025
|
-
return
|
|
7171
|
+
return existsSync7(getCacheFilePath());
|
|
7026
7172
|
}
|
|
7027
7173
|
function write(value) {
|
|
7028
7174
|
ensureCacheDir();
|
|
@@ -7191,14 +7337,14 @@ var init_connected_providers_cache = __esm(() => {
|
|
|
7191
7337
|
});
|
|
7192
7338
|
|
|
7193
7339
|
// src/shared/model-availability.ts
|
|
7194
|
-
import { existsSync as
|
|
7195
|
-
import { join as
|
|
7340
|
+
import { existsSync as existsSync8, readFileSync as readFileSync5 } from "fs";
|
|
7341
|
+
import { join as join9 } from "path";
|
|
7196
7342
|
function isModelCacheAvailable() {
|
|
7197
7343
|
if (hasProviderModelsCache()) {
|
|
7198
7344
|
return true;
|
|
7199
7345
|
}
|
|
7200
|
-
const cacheFile =
|
|
7201
|
-
return
|
|
7346
|
+
const cacheFile = join9(getOpenCodeCacheDir(), "models.json");
|
|
7347
|
+
return existsSync8(cacheFile);
|
|
7202
7348
|
}
|
|
7203
7349
|
var init_model_availability = __esm(() => {
|
|
7204
7350
|
init_logger();
|
|
@@ -48487,19 +48633,19 @@ var init_constants = __esm(() => {
|
|
|
48487
48633
|
});
|
|
48488
48634
|
|
|
48489
48635
|
// src/shared/opencode-storage-paths.ts
|
|
48490
|
-
import { join as
|
|
48636
|
+
import { join as join10 } from "path";
|
|
48491
48637
|
var OPENCODE_STORAGE, MESSAGE_STORAGE, PART_STORAGE, SESSION_STORAGE;
|
|
48492
48638
|
var init_opencode_storage_paths = __esm(() => {
|
|
48493
48639
|
init_data_path();
|
|
48494
48640
|
OPENCODE_STORAGE = getOpenCodeStorageDir();
|
|
48495
|
-
MESSAGE_STORAGE =
|
|
48496
|
-
PART_STORAGE =
|
|
48497
|
-
SESSION_STORAGE =
|
|
48641
|
+
MESSAGE_STORAGE = join10(OPENCODE_STORAGE, "message");
|
|
48642
|
+
PART_STORAGE = join10(OPENCODE_STORAGE, "part");
|
|
48643
|
+
SESSION_STORAGE = join10(OPENCODE_STORAGE, "session");
|
|
48498
48644
|
});
|
|
48499
48645
|
|
|
48500
48646
|
// src/shared/compaction-marker.ts
|
|
48501
|
-
import { existsSync as
|
|
48502
|
-
import { join as
|
|
48647
|
+
import { existsSync as existsSync9, readdirSync, readFileSync as readFileSync6 } from "fs";
|
|
48648
|
+
import { join as join11 } from "path";
|
|
48503
48649
|
function isCompactionPart(part) {
|
|
48504
48650
|
return typeof part === "object" && part !== null && part.type === "compaction";
|
|
48505
48651
|
}
|
|
@@ -48513,20 +48659,20 @@ function isCompactionMessage(message) {
|
|
|
48513
48659
|
return isCompactionAgent(message.info?.agent ?? message.agent) || hasCompactionPart(message.parts);
|
|
48514
48660
|
}
|
|
48515
48661
|
function getCompactionPartStorageDir(messageID) {
|
|
48516
|
-
return
|
|
48662
|
+
return join11(PART_STORAGE, messageID);
|
|
48517
48663
|
}
|
|
48518
48664
|
function hasCompactionPartInStorage(messageID) {
|
|
48519
48665
|
if (!messageID) {
|
|
48520
48666
|
return false;
|
|
48521
48667
|
}
|
|
48522
48668
|
const partDir = getCompactionPartStorageDir(messageID);
|
|
48523
|
-
if (!
|
|
48669
|
+
if (!existsSync9(partDir)) {
|
|
48524
48670
|
return false;
|
|
48525
48671
|
}
|
|
48526
48672
|
try {
|
|
48527
48673
|
return readdirSync(partDir).filter((fileName) => fileName.endsWith(".json")).some((fileName) => {
|
|
48528
48674
|
try {
|
|
48529
|
-
const content =
|
|
48675
|
+
const content = readFileSync6(join11(partDir, fileName), "utf-8");
|
|
48530
48676
|
return isCompactionPart(JSON.parse(content));
|
|
48531
48677
|
} catch {
|
|
48532
48678
|
return false;
|
|
@@ -48559,23 +48705,23 @@ var init_hook_message_injector = __esm(() => {
|
|
|
48559
48705
|
});
|
|
48560
48706
|
|
|
48561
48707
|
// src/shared/opencode-message-dir.ts
|
|
48562
|
-
import { existsSync as
|
|
48563
|
-
import { join as
|
|
48708
|
+
import { existsSync as existsSync10, readdirSync as readdirSync2 } from "fs";
|
|
48709
|
+
import { join as join12 } from "path";
|
|
48564
48710
|
function getMessageDir(sessionID) {
|
|
48565
48711
|
if (!sessionID.startsWith("ses_"))
|
|
48566
48712
|
return null;
|
|
48567
48713
|
if (/[/\\]|\.\./.test(sessionID))
|
|
48568
48714
|
return null;
|
|
48569
|
-
if (!
|
|
48715
|
+
if (!existsSync10(MESSAGE_STORAGE))
|
|
48570
48716
|
return null;
|
|
48571
|
-
const directPath =
|
|
48572
|
-
if (
|
|
48717
|
+
const directPath = join12(MESSAGE_STORAGE, sessionID);
|
|
48718
|
+
if (existsSync10(directPath)) {
|
|
48573
48719
|
return directPath;
|
|
48574
48720
|
}
|
|
48575
48721
|
try {
|
|
48576
48722
|
for (const dir of readdirSync2(MESSAGE_STORAGE)) {
|
|
48577
|
-
const sessionPath =
|
|
48578
|
-
if (
|
|
48723
|
+
const sessionPath = join12(MESSAGE_STORAGE, dir, sessionID);
|
|
48724
|
+
if (existsSync10(sessionPath)) {
|
|
48579
48725
|
return sessionPath;
|
|
48580
48726
|
}
|
|
48581
48727
|
}
|
|
@@ -48590,72 +48736,6 @@ var init_opencode_message_dir = __esm(() => {
|
|
|
48590
48736
|
init_logger();
|
|
48591
48737
|
});
|
|
48592
48738
|
|
|
48593
|
-
// src/shared/agent-display-names.ts
|
|
48594
|
-
function stripInvisibleAgentCharacters(agentName) {
|
|
48595
|
-
return agentName.replace(INVISIBLE_AGENT_CHARACTERS_REGEX, "");
|
|
48596
|
-
}
|
|
48597
|
-
function stripAgentListSortPrefix(agentName) {
|
|
48598
|
-
return stripInvisibleAgentCharacters(agentName);
|
|
48599
|
-
}
|
|
48600
|
-
function getAgentDisplayName(configKey) {
|
|
48601
|
-
const exactMatch = AGENT_DISPLAY_NAMES[configKey];
|
|
48602
|
-
if (exactMatch !== undefined)
|
|
48603
|
-
return exactMatch;
|
|
48604
|
-
const lowerKey = configKey.toLowerCase();
|
|
48605
|
-
for (const [k, v] of Object.entries(AGENT_DISPLAY_NAMES)) {
|
|
48606
|
-
if (k.toLowerCase() === lowerKey)
|
|
48607
|
-
return v;
|
|
48608
|
-
}
|
|
48609
|
-
return configKey;
|
|
48610
|
-
}
|
|
48611
|
-
function resolveKnownAgentConfigKey(agentName) {
|
|
48612
|
-
const lower = stripAgentListSortPrefix(agentName).trim().toLowerCase();
|
|
48613
|
-
const reversed = REVERSE_DISPLAY_NAMES[lower];
|
|
48614
|
-
if (reversed !== undefined)
|
|
48615
|
-
return reversed;
|
|
48616
|
-
const legacy = LEGACY_DISPLAY_NAMES[lower];
|
|
48617
|
-
if (legacy !== undefined)
|
|
48618
|
-
return legacy;
|
|
48619
|
-
if (AGENT_DISPLAY_NAMES[lower] !== undefined)
|
|
48620
|
-
return lower;
|
|
48621
|
-
return;
|
|
48622
|
-
}
|
|
48623
|
-
function getAgentConfigKey(agentName) {
|
|
48624
|
-
const lower = stripAgentListSortPrefix(agentName).trim().toLowerCase();
|
|
48625
|
-
return resolveKnownAgentConfigKey(agentName) ?? lower;
|
|
48626
|
-
}
|
|
48627
|
-
var AGENT_DISPLAY_NAMES, INVISIBLE_AGENT_CHARACTERS_REGEX, REVERSE_DISPLAY_NAMES, LEGACY_DISPLAY_NAMES;
|
|
48628
|
-
var init_agent_display_names = __esm(() => {
|
|
48629
|
-
AGENT_DISPLAY_NAMES = {
|
|
48630
|
-
sisyphus: "Sisyphus - Ultraworker",
|
|
48631
|
-
hephaestus: "Hephaestus - Deep Agent",
|
|
48632
|
-
prometheus: "Prometheus - Plan Builder",
|
|
48633
|
-
atlas: "Atlas - Plan Executor",
|
|
48634
|
-
"sisyphus-junior": "Sisyphus-Junior",
|
|
48635
|
-
metis: "Metis - Plan Consultant",
|
|
48636
|
-
momus: "Momus - Plan Critic",
|
|
48637
|
-
athena: "Athena - Council",
|
|
48638
|
-
"athena-junior": "Athena-Junior - Council",
|
|
48639
|
-
oracle: "oracle",
|
|
48640
|
-
librarian: "librarian",
|
|
48641
|
-
explore: "explore",
|
|
48642
|
-
"multimodal-looker": "multimodal-looker",
|
|
48643
|
-
"council-member": "council-member"
|
|
48644
|
-
};
|
|
48645
|
-
INVISIBLE_AGENT_CHARACTERS_REGEX = /[\u200B\u200C\u200D\uFEFF]/g;
|
|
48646
|
-
REVERSE_DISPLAY_NAMES = Object.fromEntries(Object.entries(AGENT_DISPLAY_NAMES).map(([key, displayName]) => [displayName.toLowerCase(), key]));
|
|
48647
|
-
LEGACY_DISPLAY_NAMES = {
|
|
48648
|
-
"sisyphus (ultraworker)": "sisyphus",
|
|
48649
|
-
"hephaestus (deep agent)": "hephaestus",
|
|
48650
|
-
"prometheus (plan builder)": "prometheus",
|
|
48651
|
-
"atlas (plan executor)": "atlas",
|
|
48652
|
-
"metis (plan consultant)": "metis",
|
|
48653
|
-
"momus (plan critic)": "momus",
|
|
48654
|
-
"athena (council)": "athena",
|
|
48655
|
-
"athena-junior (council)": "athena-junior"
|
|
48656
|
-
};
|
|
48657
|
-
});
|
|
48658
|
-
|
|
48659
48739
|
// src/shared/session-utils.ts
|
|
48660
48740
|
var init_session_utils = __esm(() => {
|
|
48661
48741
|
init_hook_message_injector();
|
|
@@ -48742,6 +48822,12 @@ var init_model_suggestion_retry = __esm(() => {
|
|
|
48742
48822
|
var init_opencode_server_auth = __esm(() => {
|
|
48743
48823
|
init_logger();
|
|
48744
48824
|
});
|
|
48825
|
+
|
|
48826
|
+
// src/shared/opencode-provider-auth.ts
|
|
48827
|
+
var init_opencode_provider_auth = __esm(() => {
|
|
48828
|
+
init_data_path();
|
|
48829
|
+
init_logger();
|
|
48830
|
+
});
|
|
48745
48831
|
// src/shared/opencode-http-api.ts
|
|
48746
48832
|
var init_opencode_http_api = __esm(() => {
|
|
48747
48833
|
init_opencode_server_auth();
|
|
@@ -48992,6 +49078,7 @@ var init_shared = __esm(() => {
|
|
|
48992
49078
|
init_jsonc_parser();
|
|
48993
49079
|
init_migration();
|
|
48994
49080
|
init_opencode_config_dir();
|
|
49081
|
+
init_resolve_agent_definition_paths();
|
|
48995
49082
|
init_opencode_version();
|
|
48996
49083
|
init_opencode_storage_detection();
|
|
48997
49084
|
init_external_plugin_detector();
|
|
@@ -49016,6 +49103,7 @@ var init_shared = __esm(() => {
|
|
|
49016
49103
|
init_tmux();
|
|
49017
49104
|
init_model_suggestion_retry();
|
|
49018
49105
|
init_opencode_server_auth();
|
|
49106
|
+
init_opencode_provider_auth();
|
|
49019
49107
|
init_opencode_http_api();
|
|
49020
49108
|
init_port_utils();
|
|
49021
49109
|
init_git_worktree();
|
|
@@ -49110,17 +49198,17 @@ var init_plugin_name_with_version = __esm(() => {
|
|
|
49110
49198
|
});
|
|
49111
49199
|
|
|
49112
49200
|
// src/cli/config-manager/backup-config.ts
|
|
49113
|
-
import { copyFileSync as copyFileSync2, existsSync as
|
|
49114
|
-
import { dirname as
|
|
49201
|
+
import { copyFileSync as copyFileSync2, existsSync as existsSync11, mkdirSync as mkdirSync5 } from "fs";
|
|
49202
|
+
import { dirname as dirname3 } from "path";
|
|
49115
49203
|
function backupConfigFile(configPath) {
|
|
49116
|
-
if (!
|
|
49204
|
+
if (!existsSync11(configPath)) {
|
|
49117
49205
|
return { success: true };
|
|
49118
49206
|
}
|
|
49119
49207
|
const timestamp2 = new Date().toISOString().replace(/[:.]/g, "-");
|
|
49120
49208
|
const backupPath = `${configPath}.backup-${timestamp2}`;
|
|
49121
49209
|
try {
|
|
49122
|
-
const dir =
|
|
49123
|
-
if (!
|
|
49210
|
+
const dir = dirname3(backupPath);
|
|
49211
|
+
if (!existsSync11(dir)) {
|
|
49124
49212
|
mkdirSync5(dir, { recursive: true });
|
|
49125
49213
|
}
|
|
49126
49214
|
copyFileSync2(configPath, backupPath);
|
|
@@ -49135,10 +49223,10 @@ function backupConfigFile(configPath) {
|
|
|
49135
49223
|
var init_backup_config = () => {};
|
|
49136
49224
|
|
|
49137
49225
|
// src/cli/config-manager/ensure-config-directory-exists.ts
|
|
49138
|
-
import { existsSync as
|
|
49226
|
+
import { existsSync as existsSync12, mkdirSync as mkdirSync6 } from "fs";
|
|
49139
49227
|
function ensureConfigDirectoryExists() {
|
|
49140
49228
|
const configDir = getConfigDir();
|
|
49141
|
-
if (!
|
|
49229
|
+
if (!existsSync12(configDir)) {
|
|
49142
49230
|
mkdirSync6(configDir, { recursive: true });
|
|
49143
49231
|
}
|
|
49144
49232
|
}
|
|
@@ -49176,14 +49264,14 @@ function formatErrorWithSuggestion(err, context) {
|
|
|
49176
49264
|
}
|
|
49177
49265
|
|
|
49178
49266
|
// src/cli/config-manager/opencode-config-format.ts
|
|
49179
|
-
import { existsSync as
|
|
49267
|
+
import { existsSync as existsSync13 } from "fs";
|
|
49180
49268
|
function detectConfigFormat() {
|
|
49181
49269
|
const configJsonc = getConfigJsonc();
|
|
49182
49270
|
const configJson = getConfigJson();
|
|
49183
|
-
if (
|
|
49271
|
+
if (existsSync13(configJsonc)) {
|
|
49184
49272
|
return { format: "jsonc", path: configJsonc };
|
|
49185
49273
|
}
|
|
49186
|
-
if (
|
|
49274
|
+
if (existsSync13(configJson)) {
|
|
49187
49275
|
return { format: "json", path: configJson };
|
|
49188
49276
|
}
|
|
49189
49277
|
return { format: "none", path: configJson };
|
|
@@ -49193,7 +49281,7 @@ var init_opencode_config_format = __esm(() => {
|
|
|
49193
49281
|
});
|
|
49194
49282
|
|
|
49195
49283
|
// src/cli/config-manager/parse-opencode-config-file.ts
|
|
49196
|
-
import { readFileSync as
|
|
49284
|
+
import { readFileSync as readFileSync7, statSync } from "fs";
|
|
49197
49285
|
function isEmptyOrWhitespace(content) {
|
|
49198
49286
|
return content.trim().length === 0;
|
|
49199
49287
|
}
|
|
@@ -49203,7 +49291,7 @@ function parseOpenCodeConfigFileWithError(path5) {
|
|
|
49203
49291
|
if (stat.size === 0) {
|
|
49204
49292
|
return { config: null, error: `Config file is empty: ${path5}. Delete it or add valid JSON content.` };
|
|
49205
49293
|
}
|
|
49206
|
-
const content =
|
|
49294
|
+
const content = readFileSync7(path5, "utf-8");
|
|
49207
49295
|
if (isEmptyOrWhitespace(content)) {
|
|
49208
49296
|
return { config: null, error: `Config file contains only whitespace: ${path5}. Delete it or add valid JSON content.` };
|
|
49209
49297
|
}
|
|
@@ -49309,7 +49397,7 @@ function extractVersionFromPluginEntry(entry) {
|
|
|
49309
49397
|
}
|
|
49310
49398
|
|
|
49311
49399
|
// src/cli/config-manager/add-plugin-to-opencode-config.ts
|
|
49312
|
-
import { readFileSync as
|
|
49400
|
+
import { readFileSync as readFileSync8, writeFileSync as writeFileSync3 } from "fs";
|
|
49313
49401
|
async function addPluginToOpenCodeConfig(currentVersion) {
|
|
49314
49402
|
try {
|
|
49315
49403
|
ensureConfigDirectoryExists();
|
|
@@ -49366,7 +49454,7 @@ async function addPluginToOpenCodeConfig(currentVersion) {
|
|
|
49366
49454
|
normalizedPlugins.push(pluginEntry);
|
|
49367
49455
|
config.plugin = normalizedPlugins;
|
|
49368
49456
|
if (format2 === "jsonc") {
|
|
49369
|
-
const content =
|
|
49457
|
+
const content = readFileSync8(path5, "utf-8");
|
|
49370
49458
|
const pluginArrayRegex = /((?:"plugin"|plugin)\s*:\s*)\[([\s\S]*?)\]/;
|
|
49371
49459
|
const match = content.match(pluginArrayRegex);
|
|
49372
49460
|
if (match) {
|
|
@@ -49520,7 +49608,7 @@ function transformModelForProvider2(provider, model) {
|
|
|
49520
49608
|
return model.replace(GEMINI_31_PRO_PREVIEW, "gemini-3.1-pro-preview").replace(GEMINI_3_FLASH_PREVIEW, "gemini-3-flash-preview");
|
|
49521
49609
|
}
|
|
49522
49610
|
if (provider === "anthropic") {
|
|
49523
|
-
return
|
|
49611
|
+
return model;
|
|
49524
49612
|
}
|
|
49525
49613
|
return model;
|
|
49526
49614
|
}
|
|
@@ -49722,12 +49810,12 @@ var init_generate_omo_config = __esm(() => {
|
|
|
49722
49810
|
});
|
|
49723
49811
|
|
|
49724
49812
|
// src/shared/migrate-legacy-config-file.ts
|
|
49725
|
-
import { existsSync as
|
|
49726
|
-
import { join as
|
|
49813
|
+
import { existsSync as existsSync14, readFileSync as readFileSync9, renameSync as renameSync2, rmSync } from "fs";
|
|
49814
|
+
import { join as join13, dirname as dirname4, basename as basename2 } from "path";
|
|
49727
49815
|
function buildCanonicalPath(legacyPath) {
|
|
49728
|
-
const dir =
|
|
49729
|
-
const ext =
|
|
49730
|
-
return
|
|
49816
|
+
const dir = dirname4(legacyPath);
|
|
49817
|
+
const ext = basename2(legacyPath).includes(".jsonc") ? ".jsonc" : ".json";
|
|
49818
|
+
return join13(dir, `${CONFIG_BASENAME}${ext}`);
|
|
49731
49819
|
}
|
|
49732
49820
|
function archiveLegacyConfigFile(legacyPath) {
|
|
49733
49821
|
const backupPath = `${legacyPath}.bak`;
|
|
@@ -49759,15 +49847,15 @@ function archiveLegacyConfigFile(legacyPath) {
|
|
|
49759
49847
|
}
|
|
49760
49848
|
}
|
|
49761
49849
|
function migrateLegacyConfigFile(legacyPath) {
|
|
49762
|
-
if (!
|
|
49850
|
+
if (!existsSync14(legacyPath))
|
|
49763
49851
|
return false;
|
|
49764
|
-
if (!
|
|
49852
|
+
if (!basename2(legacyPath).startsWith(LEGACY_CONFIG_BASENAME))
|
|
49765
49853
|
return false;
|
|
49766
49854
|
const canonicalPath = buildCanonicalPath(legacyPath);
|
|
49767
|
-
if (
|
|
49855
|
+
if (existsSync14(canonicalPath))
|
|
49768
49856
|
return false;
|
|
49769
49857
|
try {
|
|
49770
|
-
const content =
|
|
49858
|
+
const content = readFileSync9(legacyPath, "utf-8");
|
|
49771
49859
|
writeFileAtomically(canonicalPath, content);
|
|
49772
49860
|
const archivedLegacyConfig = archiveLegacyConfigFile(legacyPath);
|
|
49773
49861
|
log("[migrateLegacyConfigFile] Migrated legacy config to canonical path", {
|
|
@@ -49805,8 +49893,8 @@ function deepMergeRecord(target, source) {
|
|
|
49805
49893
|
}
|
|
49806
49894
|
|
|
49807
49895
|
// src/cli/config-manager/write-omo-config.ts
|
|
49808
|
-
import { existsSync as
|
|
49809
|
-
import { basename as
|
|
49896
|
+
import { existsSync as existsSync15, readFileSync as readFileSync10, statSync as statSync2, writeFileSync as writeFileSync4 } from "fs";
|
|
49897
|
+
import { basename as basename3, dirname as dirname5, extname, join as join14 } from "path";
|
|
49810
49898
|
function isEmptyOrWhitespace2(content) {
|
|
49811
49899
|
return content.trim().length === 0;
|
|
49812
49900
|
}
|
|
@@ -49821,12 +49909,12 @@ function writeOmoConfig(installConfig) {
|
|
|
49821
49909
|
};
|
|
49822
49910
|
}
|
|
49823
49911
|
const detectedConfigPath = getOmoConfigPath();
|
|
49824
|
-
const canonicalConfigPath =
|
|
49825
|
-
const shouldMigrateLegacyPath =
|
|
49826
|
-
const omoConfigPath = shouldMigrateLegacyPath ? migrateLegacyConfigFile(detectedConfigPath) ||
|
|
49912
|
+
const canonicalConfigPath = join14(dirname5(detectedConfigPath), `${CONFIG_BASENAME}${extname(detectedConfigPath) || ".json"}`);
|
|
49913
|
+
const shouldMigrateLegacyPath = basename3(detectedConfigPath).startsWith(LEGACY_CONFIG_BASENAME);
|
|
49914
|
+
const omoConfigPath = shouldMigrateLegacyPath ? migrateLegacyConfigFile(detectedConfigPath) || existsSync15(canonicalConfigPath) ? canonicalConfigPath : detectedConfigPath : detectedConfigPath;
|
|
49827
49915
|
try {
|
|
49828
49916
|
const newConfig = generateOmoConfig(installConfig);
|
|
49829
|
-
if (
|
|
49917
|
+
if (existsSync15(omoConfigPath)) {
|
|
49830
49918
|
const backupResult = backupConfigFile(omoConfigPath);
|
|
49831
49919
|
if (!backupResult.success) {
|
|
49832
49920
|
return {
|
|
@@ -49837,7 +49925,7 @@ function writeOmoConfig(installConfig) {
|
|
|
49837
49925
|
}
|
|
49838
49926
|
try {
|
|
49839
49927
|
const stat = statSync2(omoConfigPath);
|
|
49840
|
-
const content =
|
|
49928
|
+
const content = readFileSync10(omoConfigPath, "utf-8");
|
|
49841
49929
|
if (stat.size === 0 || isEmptyOrWhitespace2(content)) {
|
|
49842
49930
|
writeFileSync4(omoConfigPath, JSON.stringify(newConfig, null, 2) + `
|
|
49843
49931
|
`);
|
|
@@ -49896,8 +49984,8 @@ function toReadableStream(stream) {
|
|
|
49896
49984
|
function wrapNodeProcess(proc) {
|
|
49897
49985
|
let resolveExited;
|
|
49898
49986
|
let exitCode = null;
|
|
49899
|
-
const exited = new Promise((
|
|
49900
|
-
resolveExited =
|
|
49987
|
+
const exited = new Promise((resolve4) => {
|
|
49988
|
+
resolveExited = resolve4;
|
|
49901
49989
|
});
|
|
49902
49990
|
proc.on("exit", (code) => {
|
|
49903
49991
|
exitCode = code ?? 1;
|
|
@@ -49980,10 +50068,10 @@ var init_opencode_binary = __esm(() => {
|
|
|
49980
50068
|
});
|
|
49981
50069
|
|
|
49982
50070
|
// src/cli/config-manager/detect-current-config.ts
|
|
49983
|
-
import { existsSync as
|
|
50071
|
+
import { existsSync as existsSync16, readFileSync as readFileSync11 } from "fs";
|
|
49984
50072
|
function detectProvidersFromOmoConfig() {
|
|
49985
50073
|
const omoConfigPath = getOmoConfigPath();
|
|
49986
|
-
if (!
|
|
50074
|
+
if (!existsSync16(omoConfigPath)) {
|
|
49987
50075
|
return {
|
|
49988
50076
|
hasOpenAI: true,
|
|
49989
50077
|
hasOpencodeZen: true,
|
|
@@ -49994,7 +50082,7 @@ function detectProvidersFromOmoConfig() {
|
|
|
49994
50082
|
};
|
|
49995
50083
|
}
|
|
49996
50084
|
try {
|
|
49997
|
-
const content =
|
|
50085
|
+
const content = readFileSync11(omoConfigPath, "utf-8");
|
|
49998
50086
|
const omoConfig = parseJsonc(content);
|
|
49999
50087
|
if (!omoConfig || typeof omoConfig !== "object") {
|
|
50000
50088
|
return {
|
|
@@ -50083,10 +50171,10 @@ var init_detect_current_config = __esm(() => {
|
|
|
50083
50171
|
});
|
|
50084
50172
|
|
|
50085
50173
|
// src/cli/config-manager/bun-install.ts
|
|
50086
|
-
import { existsSync as
|
|
50087
|
-
import { join as
|
|
50174
|
+
import { existsSync as existsSync17 } from "fs";
|
|
50175
|
+
import { join as join15 } from "path";
|
|
50088
50176
|
function getDefaultWorkspaceDir() {
|
|
50089
|
-
return
|
|
50177
|
+
return join15(getOpenCodeCacheDir(), "packages");
|
|
50090
50178
|
}
|
|
50091
50179
|
function readProcessOutput(stream) {
|
|
50092
50180
|
if (!stream) {
|
|
@@ -50112,7 +50200,7 @@ async function runBunInstallWithDetails(options) {
|
|
|
50112
50200
|
const outputMode = options?.outputMode ?? "pipe";
|
|
50113
50201
|
const cacheDir = options?.workspaceDir ?? getDefaultWorkspaceDir();
|
|
50114
50202
|
const packageJsonPath = `${cacheDir}/package.json`;
|
|
50115
|
-
if (!
|
|
50203
|
+
if (!existsSync17(packageJsonPath)) {
|
|
50116
50204
|
return {
|
|
50117
50205
|
success: false,
|
|
50118
50206
|
error: `Workspace not initialized: ${packageJsonPath} not found. OpenCode should create this on first run.`
|
|
@@ -50126,8 +50214,8 @@ async function runBunInstallWithDetails(options) {
|
|
|
50126
50214
|
});
|
|
50127
50215
|
const outputPromise = Promise.all([readProcessOutput(proc.stdout), readProcessOutput(proc.stderr)]).then(([stdout, stderr]) => ({ stdout, stderr }));
|
|
50128
50216
|
let timeoutId;
|
|
50129
|
-
const timeoutPromise = new Promise((
|
|
50130
|
-
timeoutId = setTimeout(() =>
|
|
50217
|
+
const timeoutPromise = new Promise((resolve4) => {
|
|
50218
|
+
timeoutId = setTimeout(() => resolve4("timeout"), BUN_INSTALL_TIMEOUT_MS);
|
|
50131
50219
|
});
|
|
50132
50220
|
const exitPromise = proc.exited.then(() => "completed");
|
|
50133
50221
|
const result = await Promise.race([exitPromise, timeoutPromise]);
|
|
@@ -50338,12 +50426,12 @@ var require_isexe = __commonJS((exports2, module) => {
|
|
|
50338
50426
|
if (typeof Promise !== "function") {
|
|
50339
50427
|
throw new TypeError("callback not provided");
|
|
50340
50428
|
}
|
|
50341
|
-
return new Promise(function(
|
|
50429
|
+
return new Promise(function(resolve4, reject) {
|
|
50342
50430
|
isexe(path6, options || {}, function(er, is) {
|
|
50343
50431
|
if (er) {
|
|
50344
50432
|
reject(er);
|
|
50345
50433
|
} else {
|
|
50346
|
-
|
|
50434
|
+
resolve4(is);
|
|
50347
50435
|
}
|
|
50348
50436
|
});
|
|
50349
50437
|
});
|
|
@@ -50405,27 +50493,27 @@ var require_which = __commonJS((exports2, module) => {
|
|
|
50405
50493
|
opt = {};
|
|
50406
50494
|
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
|
50407
50495
|
const found = [];
|
|
50408
|
-
const step = (i2) => new Promise((
|
|
50496
|
+
const step = (i2) => new Promise((resolve4, reject) => {
|
|
50409
50497
|
if (i2 === pathEnv.length)
|
|
50410
|
-
return opt.all && found.length ?
|
|
50498
|
+
return opt.all && found.length ? resolve4(found) : reject(getNotFoundError(cmd));
|
|
50411
50499
|
const ppRaw = pathEnv[i2];
|
|
50412
50500
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
50413
50501
|
const pCmd = path6.join(pathPart, cmd);
|
|
50414
50502
|
const p2 = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
50415
|
-
|
|
50503
|
+
resolve4(subStep(p2, i2, 0));
|
|
50416
50504
|
});
|
|
50417
|
-
const subStep = (p2, i2, ii) => new Promise((
|
|
50505
|
+
const subStep = (p2, i2, ii) => new Promise((resolve4, reject) => {
|
|
50418
50506
|
if (ii === pathExt.length)
|
|
50419
|
-
return
|
|
50507
|
+
return resolve4(step(i2 + 1));
|
|
50420
50508
|
const ext = pathExt[ii];
|
|
50421
50509
|
isexe(p2 + ext, { pathExt: pathExtExe }, (er, is) => {
|
|
50422
50510
|
if (!er && is) {
|
|
50423
50511
|
if (opt.all)
|
|
50424
50512
|
found.push(p2 + ext);
|
|
50425
50513
|
else
|
|
50426
|
-
return
|
|
50514
|
+
return resolve4(p2 + ext);
|
|
50427
50515
|
}
|
|
50428
|
-
return
|
|
50516
|
+
return resolve4(subStep(p2, i2, ii + 1));
|
|
50429
50517
|
});
|
|
50430
50518
|
});
|
|
50431
50519
|
return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
|
|
@@ -51278,8 +51366,8 @@ var init_update_toasts = __esm(() => {
|
|
|
51278
51366
|
});
|
|
51279
51367
|
|
|
51280
51368
|
// src/hooks/auto-update-checker/hook/background-update-check.ts
|
|
51281
|
-
import { existsSync as
|
|
51282
|
-
import { join as
|
|
51369
|
+
import { existsSync as existsSync29 } from "fs";
|
|
51370
|
+
import { join as join28 } from "path";
|
|
51283
51371
|
function getCacheWorkspaceDir(deps) {
|
|
51284
51372
|
return deps.join(deps.getOpenCodeCacheDir(), "packages");
|
|
51285
51373
|
}
|
|
@@ -51397,8 +51485,8 @@ var init_background_update_check = __esm(() => {
|
|
|
51397
51485
|
init_checker();
|
|
51398
51486
|
init_update_toasts();
|
|
51399
51487
|
defaultDeps = {
|
|
51400
|
-
existsSync:
|
|
51401
|
-
join:
|
|
51488
|
+
existsSync: existsSync29,
|
|
51489
|
+
join: join28,
|
|
51402
51490
|
runBunInstallWithDetails,
|
|
51403
51491
|
log,
|
|
51404
51492
|
getOpenCodeCacheDir,
|
|
@@ -51551,7 +51639,7 @@ async function showSpinnerToast(ctx, version3, message) {
|
|
|
51551
51639
|
duration: frameInterval + 50
|
|
51552
51640
|
}
|
|
51553
51641
|
}).catch(() => {});
|
|
51554
|
-
await new Promise((
|
|
51642
|
+
await new Promise((resolve4) => setTimeout(resolve4, frameInterval));
|
|
51555
51643
|
}
|
|
51556
51644
|
}
|
|
51557
51645
|
var SISYPHUS_SPINNER;
|
|
@@ -51691,7 +51779,7 @@ var {
|
|
|
51691
51779
|
// package.json
|
|
51692
51780
|
var package_default = {
|
|
51693
51781
|
name: "oh-my-opencode",
|
|
51694
|
-
version: "3.17.
|
|
51782
|
+
version: "3.17.4",
|
|
51695
51783
|
description: "The Best AI Agent Harness - Batteries-Included OpenCode Plugin with Multi-Model Orchestration, Parallel Background Agents, and Crafted LSP/AST Tools",
|
|
51696
51784
|
main: "./dist/index.js",
|
|
51697
51785
|
types: "dist/index.d.ts",
|
|
@@ -51770,17 +51858,17 @@ var package_default = {
|
|
|
51770
51858
|
typescript: "^5.7.3"
|
|
51771
51859
|
},
|
|
51772
51860
|
optionalDependencies: {
|
|
51773
|
-
"oh-my-opencode-darwin-arm64": "3.17.
|
|
51774
|
-
"oh-my-opencode-darwin-x64": "3.17.
|
|
51775
|
-
"oh-my-opencode-darwin-x64-baseline": "3.17.
|
|
51776
|
-
"oh-my-opencode-linux-arm64": "3.17.
|
|
51777
|
-
"oh-my-opencode-linux-arm64-musl": "3.17.
|
|
51778
|
-
"oh-my-opencode-linux-x64": "3.17.
|
|
51779
|
-
"oh-my-opencode-linux-x64-baseline": "3.17.
|
|
51780
|
-
"oh-my-opencode-linux-x64-musl": "3.17.
|
|
51781
|
-
"oh-my-opencode-linux-x64-musl-baseline": "3.17.
|
|
51782
|
-
"oh-my-opencode-windows-x64": "3.17.
|
|
51783
|
-
"oh-my-opencode-windows-x64-baseline": "3.17.
|
|
51861
|
+
"oh-my-opencode-darwin-arm64": "3.17.4",
|
|
51862
|
+
"oh-my-opencode-darwin-x64": "3.17.4",
|
|
51863
|
+
"oh-my-opencode-darwin-x64-baseline": "3.17.4",
|
|
51864
|
+
"oh-my-opencode-linux-arm64": "3.17.4",
|
|
51865
|
+
"oh-my-opencode-linux-arm64-musl": "3.17.4",
|
|
51866
|
+
"oh-my-opencode-linux-x64": "3.17.4",
|
|
51867
|
+
"oh-my-opencode-linux-x64-baseline": "3.17.4",
|
|
51868
|
+
"oh-my-opencode-linux-x64-musl": "3.17.4",
|
|
51869
|
+
"oh-my-opencode-linux-x64-musl-baseline": "3.17.4",
|
|
51870
|
+
"oh-my-opencode-windows-x64": "3.17.4",
|
|
51871
|
+
"oh-my-opencode-windows-x64-baseline": "3.17.4"
|
|
51784
51872
|
},
|
|
51785
51873
|
overrides: {},
|
|
51786
51874
|
trustedDependencies: [
|
|
@@ -52001,7 +52089,7 @@ import os3 from "os";
|
|
|
52001
52089
|
import { createHash } from "crypto";
|
|
52002
52090
|
|
|
52003
52091
|
// node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
|
|
52004
|
-
import { dirname as
|
|
52092
|
+
import { dirname as dirname6, posix, sep } from "path";
|
|
52005
52093
|
function createModulerModifier() {
|
|
52006
52094
|
const getModuleFromFileName = createGetModuleFromFilename();
|
|
52007
52095
|
return async (frames) => {
|
|
@@ -52010,7 +52098,7 @@ function createModulerModifier() {
|
|
|
52010
52098
|
return frames;
|
|
52011
52099
|
};
|
|
52012
52100
|
}
|
|
52013
|
-
function createGetModuleFromFilename(basePath = process.argv[1] ?
|
|
52101
|
+
function createGetModuleFromFilename(basePath = process.argv[1] ? dirname6(process.argv[1]) : process.cwd(), isWindows = sep === "\\") {
|
|
52014
52102
|
const normalizedBase = isWindows ? normalizeWindowsPath(basePath) : basePath;
|
|
52015
52103
|
return (filename) => {
|
|
52016
52104
|
if (!filename)
|
|
@@ -54349,14 +54437,14 @@ async function addSourceContext(frames) {
|
|
|
54349
54437
|
return frames;
|
|
54350
54438
|
}
|
|
54351
54439
|
function getContextLinesFromFile(path5, ranges, output) {
|
|
54352
|
-
return new Promise((
|
|
54440
|
+
return new Promise((resolve4) => {
|
|
54353
54441
|
const stream = createReadStream(path5);
|
|
54354
54442
|
const lineReaded = createInterface({
|
|
54355
54443
|
input: stream
|
|
54356
54444
|
});
|
|
54357
54445
|
function destroyStreamAndResolve() {
|
|
54358
54446
|
stream.destroy();
|
|
54359
|
-
|
|
54447
|
+
resolve4();
|
|
54360
54448
|
}
|
|
54361
54449
|
let lineNumber = 0;
|
|
54362
54450
|
let currentRangeIndex = 0;
|
|
@@ -55596,9 +55684,9 @@ class PostHogBackendClient extends PostHogCoreStateless {
|
|
|
55596
55684
|
if (this.disabled || this.optedOut)
|
|
55597
55685
|
return;
|
|
55598
55686
|
if (!this._waitUntilCycle) {
|
|
55599
|
-
let
|
|
55687
|
+
let resolve4;
|
|
55600
55688
|
const promise = new Promise((r) => {
|
|
55601
|
-
|
|
55689
|
+
resolve4 = r;
|
|
55602
55690
|
});
|
|
55603
55691
|
try {
|
|
55604
55692
|
waitUntil(promise);
|
|
@@ -55606,7 +55694,7 @@ class PostHogBackendClient extends PostHogCoreStateless {
|
|
|
55606
55694
|
return;
|
|
55607
55695
|
}
|
|
55608
55696
|
this._waitUntilCycle = {
|
|
55609
|
-
resolve:
|
|
55697
|
+
resolve: resolve4,
|
|
55610
55698
|
startedAt: Date.now(),
|
|
55611
55699
|
timer: undefined
|
|
55612
55700
|
};
|
|
@@ -55632,11 +55720,11 @@ class PostHogBackendClient extends PostHogCoreStateless {
|
|
|
55632
55720
|
return cycle?.resolve;
|
|
55633
55721
|
}
|
|
55634
55722
|
async resolveWaitUntilFlush() {
|
|
55635
|
-
const
|
|
55723
|
+
const resolve4 = this._consumeWaitUntilCycle();
|
|
55636
55724
|
try {
|
|
55637
55725
|
await super.flush();
|
|
55638
55726
|
} catch {} finally {
|
|
55639
|
-
|
|
55727
|
+
resolve4?.();
|
|
55640
55728
|
}
|
|
55641
55729
|
}
|
|
55642
55730
|
getPersistedProperty(key) {
|
|
@@ -55736,15 +55824,15 @@ class PostHogBackendClient extends PostHogCoreStateless {
|
|
|
55736
55824
|
return true;
|
|
55737
55825
|
if (this.featureFlagsPoller === undefined)
|
|
55738
55826
|
return false;
|
|
55739
|
-
return new Promise((
|
|
55827
|
+
return new Promise((resolve4) => {
|
|
55740
55828
|
const timeout = setTimeout(() => {
|
|
55741
55829
|
cleanup();
|
|
55742
|
-
|
|
55830
|
+
resolve4(false);
|
|
55743
55831
|
}, timeoutMs);
|
|
55744
55832
|
const cleanup = this._events.on("localEvaluationFlagsLoaded", (count) => {
|
|
55745
55833
|
clearTimeout(timeout);
|
|
55746
55834
|
cleanup();
|
|
55747
|
-
|
|
55835
|
+
resolve4(count > 0);
|
|
55748
55836
|
});
|
|
55749
55837
|
});
|
|
55750
55838
|
}
|
|
@@ -56088,13 +56176,13 @@ class PostHogBackendClient extends PostHogCoreStateless {
|
|
|
56088
56176
|
this.context?.enter(data, options);
|
|
56089
56177
|
}
|
|
56090
56178
|
async _shutdown(shutdownTimeoutMs) {
|
|
56091
|
-
const
|
|
56179
|
+
const resolve4 = this._consumeWaitUntilCycle();
|
|
56092
56180
|
await this.featureFlagsPoller?.stopPoller(shutdownTimeoutMs);
|
|
56093
56181
|
this.errorTracking.shutdown();
|
|
56094
56182
|
try {
|
|
56095
56183
|
return await super._shutdown(shutdownTimeoutMs);
|
|
56096
56184
|
} finally {
|
|
56097
|
-
|
|
56185
|
+
resolve4?.();
|
|
56098
56186
|
}
|
|
56099
56187
|
}
|
|
56100
56188
|
async _requestRemoteConfigPayload(flagKey) {
|
|
@@ -56448,11 +56536,11 @@ init_data_path();
|
|
|
56448
56536
|
init_logger();
|
|
56449
56537
|
init_plugin_identity();
|
|
56450
56538
|
init_write_file_atomically();
|
|
56451
|
-
import { existsSync as
|
|
56452
|
-
import { join as
|
|
56539
|
+
import { existsSync as existsSync18, mkdirSync as mkdirSync7, readFileSync as readFileSync12 } from "fs";
|
|
56540
|
+
import { join as join16 } from "path";
|
|
56453
56541
|
var POSTHOG_ACTIVITY_STATE_FILE = "posthog-activity.json";
|
|
56454
56542
|
function getPostHogActivityStateFilePath() {
|
|
56455
|
-
return
|
|
56543
|
+
return join16(getDataDir(), CACHE_DIR_NAME, POSTHOG_ACTIVITY_STATE_FILE);
|
|
56456
56544
|
}
|
|
56457
56545
|
function getUtcDayString(date) {
|
|
56458
56546
|
return date.toISOString().slice(0, 10);
|
|
@@ -56465,11 +56553,11 @@ function isPostHogActivityState(value) {
|
|
|
56465
56553
|
}
|
|
56466
56554
|
function readPostHogActivityState() {
|
|
56467
56555
|
const stateFilePath = getPostHogActivityStateFilePath();
|
|
56468
|
-
if (!
|
|
56556
|
+
if (!existsSync18(stateFilePath)) {
|
|
56469
56557
|
return {};
|
|
56470
56558
|
}
|
|
56471
56559
|
try {
|
|
56472
|
-
const content =
|
|
56560
|
+
const content = readFileSync12(stateFilePath, "utf-8");
|
|
56473
56561
|
const parsed = JSON.parse(content);
|
|
56474
56562
|
if (!isPostHogActivityState(parsed)) {
|
|
56475
56563
|
return {};
|
|
@@ -56486,7 +56574,7 @@ function readPostHogActivityState() {
|
|
|
56486
56574
|
function writePostHogActivityState(nextState) {
|
|
56487
56575
|
const stateFilePath = getPostHogActivityStateFilePath();
|
|
56488
56576
|
try {
|
|
56489
|
-
mkdirSync7(
|
|
56577
|
+
mkdirSync7(join16(getDataDir(), CACHE_DIR_NAME), { recursive: true });
|
|
56490
56578
|
writeFileAtomically(stateFilePath, `${JSON.stringify(nextState, null, 2)}
|
|
56491
56579
|
`);
|
|
56492
56580
|
} catch (error) {
|
|
@@ -56638,7 +56726,7 @@ function getPostHogDistinctId() {
|
|
|
56638
56726
|
}
|
|
56639
56727
|
function createCliPostHog() {
|
|
56640
56728
|
return createPostHogClient("cli", {
|
|
56641
|
-
enableExceptionAutocapture:
|
|
56729
|
+
enableExceptionAutocapture: false,
|
|
56642
56730
|
flushAt: 1,
|
|
56643
56731
|
flushInterval: 0
|
|
56644
56732
|
});
|
|
@@ -72148,6 +72236,10 @@ var NotificationConfigSchema = exports_external.object({
|
|
|
72148
72236
|
var McpNameSchema = exports_external.enum(["websearch", "context7", "grep_app"]);
|
|
72149
72237
|
var AnyMcpNameSchema = exports_external.string().min(1);
|
|
72150
72238
|
|
|
72239
|
+
// src/config/schema/agent-definitions.ts
|
|
72240
|
+
var AgentDefinitionPathSchema = exports_external.string().min(1);
|
|
72241
|
+
var AgentDefinitionsConfigSchema = exports_external.array(AgentDefinitionPathSchema).optional();
|
|
72242
|
+
|
|
72151
72243
|
// src/config/schema/openclaw.ts
|
|
72152
72244
|
var OpenClawGatewaySchema = exports_external.object({
|
|
72153
72245
|
type: exports_external.enum(["http", "command"]).default("http"),
|
|
@@ -72289,6 +72381,7 @@ var OhMyOpenCodeConfigSchema = exports_external.object({
|
|
|
72289
72381
|
$schema: exports_external.string().optional(),
|
|
72290
72382
|
new_task_system_enabled: exports_external.boolean().optional(),
|
|
72291
72383
|
default_run_agent: exports_external.string().optional(),
|
|
72384
|
+
agent_definitions: AgentDefinitionsConfigSchema,
|
|
72292
72385
|
disabled_mcps: exports_external.array(AnyMcpNameSchema).optional(),
|
|
72293
72386
|
disabled_agents: exports_external.array(exports_external.string()).optional(),
|
|
72294
72387
|
disabled_skills: exports_external.array(BuiltinSkillNameSchema).optional(),
|
|
@@ -72352,7 +72445,8 @@ var PARTIAL_STRING_ARRAY_KEYS = new Set([
|
|
|
72352
72445
|
"disabled_hooks",
|
|
72353
72446
|
"disabled_commands",
|
|
72354
72447
|
"disabled_tools",
|
|
72355
|
-
"mcp_env_allowlist"
|
|
72448
|
+
"mcp_env_allowlist",
|
|
72449
|
+
"agent_definitions"
|
|
72356
72450
|
]);
|
|
72357
72451
|
function parseConfigPartially(rawConfig) {
|
|
72358
72452
|
const fullResult = OhMyOpenCodeConfigSchema.safeParse(rawConfig);
|
|
@@ -72424,6 +72518,12 @@ function mergeConfigs(base, override) {
|
|
|
72424
72518
|
...override,
|
|
72425
72519
|
agents: deepMerge(base.agents, override.agents),
|
|
72426
72520
|
categories: deepMerge(base.categories, override.categories),
|
|
72521
|
+
agent_definitions: [
|
|
72522
|
+
...new Set([
|
|
72523
|
+
...base.agent_definitions ?? [],
|
|
72524
|
+
...override.agent_definitions ?? []
|
|
72525
|
+
])
|
|
72526
|
+
],
|
|
72427
72527
|
disabled_agents: [
|
|
72428
72528
|
...new Set([
|
|
72429
72529
|
...base.disabled_agents ?? [],
|
|
@@ -72504,10 +72604,16 @@ function loadPluginConfig(directory, ctx) {
|
|
|
72504
72604
|
}
|
|
72505
72605
|
const userConfig = loadConfigFromPath(userConfigPath, ctx);
|
|
72506
72606
|
const userGitMasterOverrides = loadExplicitGitMasterOverrides(userConfigPath);
|
|
72607
|
+
if (userConfig?.agent_definitions) {
|
|
72608
|
+
userConfig.agent_definitions = resolveAgentDefinitionPaths(userConfig.agent_definitions, configDir, null);
|
|
72609
|
+
}
|
|
72507
72610
|
let config2 = userConfig ?? OhMyOpenCodeConfigSchema.parse({});
|
|
72508
72611
|
const defaultGitMaster = OhMyOpenCodeConfigSchema.parse({}).git_master;
|
|
72509
72612
|
const projectConfig = loadConfigFromPath(projectConfigPath, ctx);
|
|
72510
72613
|
const projectGitMasterOverrides = loadExplicitGitMasterOverrides(projectConfigPath);
|
|
72614
|
+
if (projectConfig?.agent_definitions) {
|
|
72615
|
+
projectConfig.agent_definitions = resolveAgentDefinitionPaths(projectConfig.agent_definitions, projectBasePath, directory);
|
|
72616
|
+
}
|
|
72511
72617
|
if (projectConfig) {
|
|
72512
72618
|
config2 = mergeConfigs(config2, projectConfig);
|
|
72513
72619
|
}
|
|
@@ -72537,7 +72643,7 @@ function loadPluginConfig(directory, ctx) {
|
|
|
72537
72643
|
// node_modules/@opencode-ai/sdk/dist/gen/core/serverSentEvents.gen.js
|
|
72538
72644
|
var createSseClient = ({ onSseError, onSseEvent, responseTransformer, responseValidator, sseDefaultRetryDelay, sseMaxRetryAttempts, sseMaxRetryDelay, sseSleepFn, url: url2, ...options }) => {
|
|
72539
72645
|
let lastEventId;
|
|
72540
|
-
const sleep = sseSleepFn ?? ((ms) => new Promise((
|
|
72646
|
+
const sleep = sseSleepFn ?? ((ms) => new Promise((resolve4) => setTimeout(resolve4, ms)));
|
|
72541
72647
|
const createStream = async function* () {
|
|
72542
72648
|
let retryDelay = sseDefaultRetryDelay ?? 3000;
|
|
72543
72649
|
let attempt = 0;
|
|
@@ -73972,7 +74078,7 @@ async function createOpencodeServer(options) {
|
|
|
73972
74078
|
}
|
|
73973
74079
|
});
|
|
73974
74080
|
let clear = () => {};
|
|
73975
|
-
const url2 = await new Promise((
|
|
74081
|
+
const url2 = await new Promise((resolve4, reject) => {
|
|
73976
74082
|
const id = setTimeout(() => {
|
|
73977
74083
|
clear();
|
|
73978
74084
|
stop(proc);
|
|
@@ -73998,7 +74104,7 @@ async function createOpencodeServer(options) {
|
|
|
73998
74104
|
}
|
|
73999
74105
|
clearTimeout(id);
|
|
74000
74106
|
resolved = true;
|
|
74001
|
-
|
|
74107
|
+
resolve4(match[1]);
|
|
74002
74108
|
return;
|
|
74003
74109
|
}
|
|
74004
74110
|
}
|
|
@@ -74052,7 +74158,7 @@ var import_picocolors10 = __toESM(require_picocolors(), 1);
|
|
|
74052
74158
|
|
|
74053
74159
|
// src/cli/run/opencode-binary-resolver.ts
|
|
74054
74160
|
init_spawn_with_windows_hide();
|
|
74055
|
-
import { delimiter, dirname as
|
|
74161
|
+
import { delimiter, dirname as dirname8, join as join18 } from "path";
|
|
74056
74162
|
var OPENCODE_COMMANDS = ["opencode", "opencode-desktop"];
|
|
74057
74163
|
var WINDOWS_SUFFIXES = ["", ".exe", ".cmd", ".bat", ".ps1"];
|
|
74058
74164
|
function getCommandCandidates(platform) {
|
|
@@ -74075,7 +74181,7 @@ function collectCandidateBinaryPaths(pathEnv, which = Bun.which, platform = proc
|
|
|
74075
74181
|
}
|
|
74076
74182
|
for (const entry of (pathEnv ?? "").split(delimiter).filter(Boolean)) {
|
|
74077
74183
|
for (const command of commandCandidates) {
|
|
74078
|
-
addCandidate(
|
|
74184
|
+
addCandidate(join18(entry, command));
|
|
74079
74185
|
}
|
|
74080
74186
|
}
|
|
74081
74187
|
return candidates;
|
|
@@ -74102,7 +74208,7 @@ async function findWorkingOpencodeBinary(pathEnv = process.env.PATH, probe = can
|
|
|
74102
74208
|
return null;
|
|
74103
74209
|
}
|
|
74104
74210
|
function buildPathWithBinaryFirst(pathEnv, binaryPath) {
|
|
74105
|
-
const preferredDir =
|
|
74211
|
+
const preferredDir = dirname8(binaryPath);
|
|
74106
74212
|
const existing = (pathEnv ?? "").split(delimiter).filter((entry) => entry.length > 0 && entry !== preferredDir);
|
|
74107
74213
|
return [preferredDir, ...existing].join(delimiter);
|
|
74108
74214
|
}
|
|
@@ -74240,7 +74346,7 @@ async function resolveSession(options) {
|
|
|
74240
74346
|
if (attempt < SESSION_CREATE_MAX_RETRIES) {
|
|
74241
74347
|
const delay = SESSION_CREATE_RETRY_DELAY_MS * attempt;
|
|
74242
74348
|
console.log(import_picocolors11.default.dim(` Retrying in ${delay}ms...`));
|
|
74243
|
-
await new Promise((
|
|
74349
|
+
await new Promise((resolve4) => setTimeout(resolve4, delay));
|
|
74244
74350
|
}
|
|
74245
74351
|
continue;
|
|
74246
74352
|
}
|
|
@@ -74251,7 +74357,7 @@ async function resolveSession(options) {
|
|
|
74251
74357
|
if (attempt < SESSION_CREATE_MAX_RETRIES) {
|
|
74252
74358
|
const delay = SESSION_CREATE_RETRY_DELAY_MS * attempt;
|
|
74253
74359
|
console.log(import_picocolors11.default.dim(` Retrying in ${delay}ms...`));
|
|
74254
|
-
await new Promise((
|
|
74360
|
+
await new Promise((resolve4) => setTimeout(resolve4, delay));
|
|
74255
74361
|
}
|
|
74256
74362
|
}
|
|
74257
74363
|
throw new Error("Failed to create session after all retries");
|
|
@@ -74380,10 +74486,11 @@ var normalizeAgentName = (agent) => {
|
|
|
74380
74486
|
return;
|
|
74381
74487
|
const configKey = getAgentConfigKey(trimmed);
|
|
74382
74488
|
const displayName = getAgentDisplayName(configKey);
|
|
74489
|
+
const runtimeName = getAgentRuntimeName(configKey);
|
|
74383
74490
|
const isKnownAgent = displayName !== configKey;
|
|
74384
74491
|
return {
|
|
74385
74492
|
configKey,
|
|
74386
|
-
resolvedName: isKnownAgent ?
|
|
74493
|
+
resolvedName: isKnownAgent ? runtimeName : trimmed
|
|
74387
74494
|
};
|
|
74388
74495
|
};
|
|
74389
74496
|
var isAgentDisabled = (agentConfigKey, config2) => {
|
|
@@ -74407,18 +74514,19 @@ var resolveRunAgent = (options, pluginConfig, env = process.env) => {
|
|
|
74407
74514
|
const configAgent = normalizeAgentName(pluginConfig.default_run_agent);
|
|
74408
74515
|
const resolved = cliAgent ?? envAgent ?? configAgent ?? {
|
|
74409
74516
|
configKey: DEFAULT_AGENT,
|
|
74410
|
-
resolvedName:
|
|
74517
|
+
resolvedName: getAgentRuntimeName(DEFAULT_AGENT)
|
|
74411
74518
|
};
|
|
74412
74519
|
if (isAgentDisabled(resolved.configKey, pluginConfig)) {
|
|
74413
74520
|
const fallback = pickFallbackAgent(pluginConfig);
|
|
74414
|
-
const
|
|
74521
|
+
const fallbackDisplayName = getAgentDisplayName(fallback);
|
|
74522
|
+
const fallbackRuntimeName = getAgentRuntimeName(fallback);
|
|
74415
74523
|
const fallbackDisabled = isAgentDisabled(fallback, pluginConfig);
|
|
74416
74524
|
if (fallbackDisabled) {
|
|
74417
|
-
console.log(import_picocolors12.default.yellow(`Requested agent "${resolved.resolvedName}" is disabled and no enabled core agent was found. Proceeding with "${
|
|
74418
|
-
return
|
|
74525
|
+
console.log(import_picocolors12.default.yellow(`Requested agent "${resolved.resolvedName}" is disabled and no enabled core agent was found. Proceeding with "${fallbackDisplayName}".`));
|
|
74526
|
+
return fallbackRuntimeName;
|
|
74419
74527
|
}
|
|
74420
|
-
console.log(import_picocolors12.default.yellow(`Requested agent "${resolved.resolvedName}" is disabled. Falling back to "${
|
|
74421
|
-
return
|
|
74528
|
+
console.log(import_picocolors12.default.yellow(`Requested agent "${resolved.resolvedName}" is disabled. Falling back to "${fallbackDisplayName}".`));
|
|
74529
|
+
return fallbackRuntimeName;
|
|
74422
74530
|
}
|
|
74423
74531
|
return resolved.resolvedName;
|
|
74424
74532
|
};
|
|
@@ -74460,19 +74568,19 @@ var BOULDER_STATE_PATH = `${BOULDER_DIR}/${BOULDER_FILE}`;
|
|
|
74460
74568
|
var NOTEPAD_DIR = "notepads";
|
|
74461
74569
|
var NOTEPAD_BASE_PATH = `${BOULDER_DIR}/${NOTEPAD_DIR}`;
|
|
74462
74570
|
// src/features/boulder-state/storage.ts
|
|
74463
|
-
import { existsSync as
|
|
74464
|
-
import { dirname as
|
|
74571
|
+
import { existsSync as existsSync20, readFileSync as readFileSync14, writeFileSync as writeFileSync5, mkdirSync as mkdirSync8, readdirSync as readdirSync3 } from "fs";
|
|
74572
|
+
import { dirname as dirname9, join as join19, basename as basename5 } from "path";
|
|
74465
74573
|
var RESERVED_KEYS = new Set(["__proto__", "prototype", "constructor"]);
|
|
74466
74574
|
function getBoulderFilePath(directory) {
|
|
74467
|
-
return
|
|
74575
|
+
return join19(directory, BOULDER_DIR, BOULDER_FILE);
|
|
74468
74576
|
}
|
|
74469
74577
|
function readBoulderState(directory) {
|
|
74470
74578
|
const filePath = getBoulderFilePath(directory);
|
|
74471
|
-
if (!
|
|
74579
|
+
if (!existsSync20(filePath)) {
|
|
74472
74580
|
return null;
|
|
74473
74581
|
}
|
|
74474
74582
|
try {
|
|
74475
|
-
const content =
|
|
74583
|
+
const content = readFileSync14(filePath, "utf-8");
|
|
74476
74584
|
const parsed = JSON.parse(content);
|
|
74477
74585
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
74478
74586
|
return null;
|
|
@@ -74505,11 +74613,11 @@ var CHECKED_CHECKBOX_PATTERN = /^(\s*)[-*]\s*\[[xX]\]\s*(.+)$/;
|
|
|
74505
74613
|
var TODO_TASK_PATTERN = /^\d+\.\s+/;
|
|
74506
74614
|
var FINAL_WAVE_TASK_PATTERN = /^F\d+\.\s+/i;
|
|
74507
74615
|
function getPlanProgress(planPath) {
|
|
74508
|
-
if (!
|
|
74616
|
+
if (!existsSync20(planPath)) {
|
|
74509
74617
|
return { total: 0, completed: 0, isComplete: true };
|
|
74510
74618
|
}
|
|
74511
74619
|
try {
|
|
74512
|
-
const content =
|
|
74620
|
+
const content = readFileSync14(planPath, "utf-8");
|
|
74513
74621
|
const lines = content.split(/\r?\n/);
|
|
74514
74622
|
const hasStructuredSections = lines.some((line) => TODO_HEADING_PATTERN.test(line) || FINAL_VERIFICATION_HEADING_PATTERN.test(line));
|
|
74515
74623
|
if (hasStructuredSections) {
|
|
@@ -74581,17 +74689,17 @@ function getSessionAgent(sessionID) {
|
|
|
74581
74689
|
// src/features/run-continuation-state/constants.ts
|
|
74582
74690
|
var CONTINUATION_MARKER_DIR = ".sisyphus/run-continuation";
|
|
74583
74691
|
// src/features/run-continuation-state/storage.ts
|
|
74584
|
-
import { existsSync as
|
|
74585
|
-
import { join as
|
|
74692
|
+
import { existsSync as existsSync21, mkdirSync as mkdirSync9, readFileSync as readFileSync15, rmSync as rmSync2, writeFileSync as writeFileSync6 } from "fs";
|
|
74693
|
+
import { join as join20 } from "path";
|
|
74586
74694
|
function getMarkerPath(directory, sessionID) {
|
|
74587
|
-
return
|
|
74695
|
+
return join20(directory, CONTINUATION_MARKER_DIR, `${sessionID}.json`);
|
|
74588
74696
|
}
|
|
74589
74697
|
function readContinuationMarker(directory, sessionID) {
|
|
74590
74698
|
const markerPath = getMarkerPath(directory, sessionID);
|
|
74591
|
-
if (!
|
|
74699
|
+
if (!existsSync21(markerPath))
|
|
74592
74700
|
return null;
|
|
74593
74701
|
try {
|
|
74594
|
-
const raw =
|
|
74702
|
+
const raw = readFileSync15(markerPath, "utf-8");
|
|
74595
74703
|
const parsed = JSON.parse(raw);
|
|
74596
74704
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed))
|
|
74597
74705
|
return null;
|
|
@@ -74652,8 +74760,8 @@ async function isSessionInBoulderLineage(input) {
|
|
|
74652
74760
|
// src/hooks/atlas/session-last-agent.ts
|
|
74653
74761
|
init_shared();
|
|
74654
74762
|
init_compaction_marker();
|
|
74655
|
-
import { readFileSync as
|
|
74656
|
-
import { join as
|
|
74763
|
+
import { readFileSync as readFileSync16, readdirSync as readdirSync4 } from "fs";
|
|
74764
|
+
import { join as join21 } from "path";
|
|
74657
74765
|
var defaultSessionLastAgentDeps = {
|
|
74658
74766
|
getMessageDir,
|
|
74659
74767
|
isSqliteBackend,
|
|
@@ -74701,7 +74809,7 @@ async function getLastAgentFromSession(sessionID, client3, deps = {}) {
|
|
|
74701
74809
|
try {
|
|
74702
74810
|
const messages = readdirSync4(messageDir).filter((fileName) => fileName.endsWith(".json")).map((fileName) => {
|
|
74703
74811
|
try {
|
|
74704
|
-
const content =
|
|
74812
|
+
const content = readFileSync16(join21(messageDir, fileName), "utf-8");
|
|
74705
74813
|
const parsed = JSON.parse(content);
|
|
74706
74814
|
return {
|
|
74707
74815
|
fileName,
|
|
@@ -74734,8 +74842,8 @@ init_agent_display_names();
|
|
|
74734
74842
|
|
|
74735
74843
|
// src/hooks/ralph-loop/storage.ts
|
|
74736
74844
|
init_frontmatter();
|
|
74737
|
-
import { existsSync as
|
|
74738
|
-
import { dirname as
|
|
74845
|
+
import { existsSync as existsSync22, readFileSync as readFileSync17, writeFileSync as writeFileSync7, unlinkSync as unlinkSync3, mkdirSync as mkdirSync10 } from "fs";
|
|
74846
|
+
import { dirname as dirname10, join as join22 } from "path";
|
|
74739
74847
|
|
|
74740
74848
|
// src/hooks/ralph-loop/constants.ts
|
|
74741
74849
|
var DEFAULT_STATE_FILE = ".sisyphus/ralph-loop.local.md";
|
|
@@ -74744,15 +74852,15 @@ var DEFAULT_COMPLETION_PROMISE = "DONE";
|
|
|
74744
74852
|
|
|
74745
74853
|
// src/hooks/ralph-loop/storage.ts
|
|
74746
74854
|
function getStateFilePath(directory, customPath) {
|
|
74747
|
-
return customPath ?
|
|
74855
|
+
return customPath ? join22(directory, customPath) : join22(directory, DEFAULT_STATE_FILE);
|
|
74748
74856
|
}
|
|
74749
74857
|
function readState(directory, customPath) {
|
|
74750
74858
|
const filePath = getStateFilePath(directory, customPath);
|
|
74751
|
-
if (!
|
|
74859
|
+
if (!existsSync22(filePath)) {
|
|
74752
74860
|
return null;
|
|
74753
74861
|
}
|
|
74754
74862
|
try {
|
|
74755
|
-
const content =
|
|
74863
|
+
const content = readFileSync17(filePath, "utf-8");
|
|
74756
74864
|
const { data, body } = parseFrontmatter(content);
|
|
74757
74865
|
const active = data.active;
|
|
74758
74866
|
const iteration = data.iteration;
|
|
@@ -74961,7 +75069,7 @@ async function pollForCompletion(ctx, eventState, abortController, options = {})
|
|
|
74961
75069
|
let secondaryTimeoutChecked = false;
|
|
74962
75070
|
const pollStartTimestamp = Date.now();
|
|
74963
75071
|
while (!abortController.signal.aborted) {
|
|
74964
|
-
await new Promise((
|
|
75072
|
+
await new Promise((resolve4) => setTimeout(resolve4, pollIntervalMs));
|
|
74965
75073
|
if (abortController.signal.aborted) {
|
|
74966
75074
|
return 130;
|
|
74967
75075
|
}
|
|
@@ -75192,7 +75300,7 @@ var EVENT_PROCESSOR_SHUTDOWN_TIMEOUT_MS = 2000;
|
|
|
75192
75300
|
async function waitForEventProcessorShutdown(eventProcessor, timeoutMs = EVENT_PROCESSOR_SHUTDOWN_TIMEOUT_MS) {
|
|
75193
75301
|
const completed = await Promise.race([
|
|
75194
75302
|
eventProcessor.then(() => true),
|
|
75195
|
-
new Promise((
|
|
75303
|
+
new Promise((resolve4) => setTimeout(() => resolve4(false), timeoutMs))
|
|
75196
75304
|
]);
|
|
75197
75305
|
}
|
|
75198
75306
|
async function run(options) {
|
|
@@ -75520,12 +75628,12 @@ async function getLocalVersion(options = {}) {
|
|
|
75520
75628
|
}
|
|
75521
75629
|
}
|
|
75522
75630
|
// src/cli/doctor/checks/system.ts
|
|
75523
|
-
import { existsSync as
|
|
75631
|
+
import { existsSync as existsSync33, readFileSync as readFileSync27 } from "fs";
|
|
75524
75632
|
|
|
75525
75633
|
// src/cli/doctor/checks/system-binary.ts
|
|
75526
|
-
import { existsSync as
|
|
75527
|
-
import { homedir as
|
|
75528
|
-
import { join as
|
|
75634
|
+
import { existsSync as existsSync30 } from "fs";
|
|
75635
|
+
import { homedir as homedir6 } from "os";
|
|
75636
|
+
import { join as join29 } from "path";
|
|
75529
75637
|
|
|
75530
75638
|
// src/cli/doctor/spawn-with-timeout.ts
|
|
75531
75639
|
init_spawn_with_windows_hide();
|
|
@@ -75538,8 +75646,8 @@ async function spawnWithTimeout(command, options, timeoutMs = DEFAULT_SPAWN_TIME
|
|
|
75538
75646
|
return { stdout: "", stderr: "", exitCode: 1, timedOut: false };
|
|
75539
75647
|
}
|
|
75540
75648
|
let timer;
|
|
75541
|
-
const timeoutPromise = new Promise((
|
|
75542
|
-
timer = setTimeout(() =>
|
|
75649
|
+
const timeoutPromise = new Promise((resolve4) => {
|
|
75650
|
+
timer = setTimeout(() => resolve4("timeout"), timeoutMs);
|
|
75543
75651
|
});
|
|
75544
75652
|
const processPromise = (async () => {
|
|
75545
75653
|
await proc.exited;
|
|
@@ -75559,22 +75667,22 @@ async function spawnWithTimeout(command, options, timeoutMs = DEFAULT_SPAWN_TIME
|
|
|
75559
75667
|
|
|
75560
75668
|
// src/cli/doctor/checks/system-binary.ts
|
|
75561
75669
|
function getDesktopAppPaths(platform) {
|
|
75562
|
-
const home =
|
|
75670
|
+
const home = homedir6();
|
|
75563
75671
|
switch (platform) {
|
|
75564
75672
|
case "darwin":
|
|
75565
75673
|
return [
|
|
75566
75674
|
"/Applications/OpenCode.app/Contents/MacOS/OpenCode",
|
|
75567
|
-
|
|
75675
|
+
join29(home, "Applications", "OpenCode.app", "Contents", "MacOS", "OpenCode")
|
|
75568
75676
|
];
|
|
75569
75677
|
case "win32": {
|
|
75570
75678
|
const programFiles = process.env.ProgramFiles;
|
|
75571
75679
|
const localAppData = process.env.LOCALAPPDATA;
|
|
75572
75680
|
const paths = [];
|
|
75573
75681
|
if (programFiles) {
|
|
75574
|
-
paths.push(
|
|
75682
|
+
paths.push(join29(programFiles, "OpenCode", "OpenCode.exe"));
|
|
75575
75683
|
}
|
|
75576
75684
|
if (localAppData) {
|
|
75577
|
-
paths.push(
|
|
75685
|
+
paths.push(join29(localAppData, "OpenCode", "OpenCode.exe"));
|
|
75578
75686
|
}
|
|
75579
75687
|
return paths;
|
|
75580
75688
|
}
|
|
@@ -75582,8 +75690,8 @@ function getDesktopAppPaths(platform) {
|
|
|
75582
75690
|
return [
|
|
75583
75691
|
"/usr/bin/opencode",
|
|
75584
75692
|
"/usr/lib/opencode/opencode",
|
|
75585
|
-
|
|
75586
|
-
|
|
75693
|
+
join29(home, "Applications", "opencode-desktop-linux-x86_64.AppImage"),
|
|
75694
|
+
join29(home, "Applications", "opencode-desktop-linux-aarch64.AppImage")
|
|
75587
75695
|
];
|
|
75588
75696
|
default:
|
|
75589
75697
|
return [];
|
|
@@ -75595,7 +75703,7 @@ function buildVersionCommand(binaryPath, platform) {
|
|
|
75595
75703
|
}
|
|
75596
75704
|
return [binaryPath, "--version"];
|
|
75597
75705
|
}
|
|
75598
|
-
function findDesktopBinary(platform = process.platform, checkExists =
|
|
75706
|
+
function findDesktopBinary(platform = process.platform, checkExists = existsSync30) {
|
|
75599
75707
|
for (const desktopPath of getDesktopAppPaths(platform)) {
|
|
75600
75708
|
if (checkExists(desktopPath)) {
|
|
75601
75709
|
return { binary: "opencode", path: desktopPath };
|
|
@@ -75641,12 +75749,12 @@ function compareVersions3(current, minimum) {
|
|
|
75641
75749
|
|
|
75642
75750
|
// src/cli/doctor/checks/system-plugin.ts
|
|
75643
75751
|
init_shared();
|
|
75644
|
-
import { existsSync as
|
|
75752
|
+
import { existsSync as existsSync31, readFileSync as readFileSync25 } from "fs";
|
|
75645
75753
|
function detectConfigPath() {
|
|
75646
75754
|
const paths = getOpenCodeConfigPaths({ binary: "opencode", version: null });
|
|
75647
|
-
if (
|
|
75755
|
+
if (existsSync31(paths.configJsonc))
|
|
75648
75756
|
return paths.configJsonc;
|
|
75649
|
-
if (
|
|
75757
|
+
if (existsSync31(paths.configJson))
|
|
75650
75758
|
return paths.configJson;
|
|
75651
75759
|
return null;
|
|
75652
75760
|
}
|
|
@@ -75692,7 +75800,7 @@ function getPluginInfo() {
|
|
|
75692
75800
|
};
|
|
75693
75801
|
}
|
|
75694
75802
|
try {
|
|
75695
|
-
const content =
|
|
75803
|
+
const content = readFileSync25(configPath, "utf-8");
|
|
75696
75804
|
const parsedConfig = parseJsonc(content);
|
|
75697
75805
|
const pluginEntry = findPluginEntry2(parsedConfig.plugin ?? []);
|
|
75698
75806
|
if (!pluginEntry) {
|
|
@@ -75730,37 +75838,37 @@ function getPluginInfo() {
|
|
|
75730
75838
|
init_file_utils();
|
|
75731
75839
|
init_checker();
|
|
75732
75840
|
init_auto_update_checker();
|
|
75733
|
-
import { existsSync as
|
|
75734
|
-
import { homedir as
|
|
75735
|
-
import { join as
|
|
75841
|
+
import { existsSync as existsSync32, readFileSync as readFileSync26 } from "fs";
|
|
75842
|
+
import { homedir as homedir7 } from "os";
|
|
75843
|
+
import { join as join30 } from "path";
|
|
75736
75844
|
init_shared();
|
|
75737
75845
|
function getPlatformDefaultCacheDir(platform = process.platform) {
|
|
75738
75846
|
if (platform === "darwin")
|
|
75739
|
-
return
|
|
75847
|
+
return join30(homedir7(), "Library", "Caches");
|
|
75740
75848
|
if (platform === "win32")
|
|
75741
|
-
return process.env.LOCALAPPDATA ??
|
|
75742
|
-
return
|
|
75849
|
+
return process.env.LOCALAPPDATA ?? join30(homedir7(), "AppData", "Local");
|
|
75850
|
+
return join30(homedir7(), ".cache");
|
|
75743
75851
|
}
|
|
75744
75852
|
function resolveOpenCodeCacheDir() {
|
|
75745
75853
|
const xdgCacheHome = process.env.XDG_CACHE_HOME;
|
|
75746
75854
|
if (xdgCacheHome)
|
|
75747
|
-
return
|
|
75855
|
+
return join30(xdgCacheHome, "opencode");
|
|
75748
75856
|
const fromShared = getOpenCodeCacheDir();
|
|
75749
|
-
const platformDefault =
|
|
75750
|
-
if (
|
|
75857
|
+
const platformDefault = join30(getPlatformDefaultCacheDir(), "opencode");
|
|
75858
|
+
if (existsSync32(fromShared) || !existsSync32(platformDefault))
|
|
75751
75859
|
return fromShared;
|
|
75752
75860
|
return platformDefault;
|
|
75753
75861
|
}
|
|
75754
75862
|
function resolveExistingDir(dirPath) {
|
|
75755
|
-
if (!
|
|
75863
|
+
if (!existsSync32(dirPath))
|
|
75756
75864
|
return dirPath;
|
|
75757
75865
|
return resolveSymlink(dirPath);
|
|
75758
75866
|
}
|
|
75759
75867
|
function readPackageJson(filePath) {
|
|
75760
|
-
if (!
|
|
75868
|
+
if (!existsSync32(filePath))
|
|
75761
75869
|
return null;
|
|
75762
75870
|
try {
|
|
75763
|
-
const content =
|
|
75871
|
+
const content = readFileSync26(filePath, "utf-8");
|
|
75764
75872
|
return parseJsonc(content);
|
|
75765
75873
|
} catch {
|
|
75766
75874
|
return null;
|
|
@@ -75775,11 +75883,11 @@ function normalizeVersion(value) {
|
|
|
75775
75883
|
function createPackageCandidates(rootDir) {
|
|
75776
75884
|
return ACCEPTED_PACKAGE_NAMES.map((packageName) => ({
|
|
75777
75885
|
packageName,
|
|
75778
|
-
installedPackagePath:
|
|
75886
|
+
installedPackagePath: join30(rootDir, "node_modules", packageName, "package.json")
|
|
75779
75887
|
}));
|
|
75780
75888
|
}
|
|
75781
75889
|
function selectInstalledPackage(candidate) {
|
|
75782
|
-
return candidate.packageCandidates.find((packageCandidate) =>
|
|
75890
|
+
return candidate.packageCandidates.find((packageCandidate) => existsSync32(packageCandidate.installedPackagePath)) ?? candidate.packageCandidates[0];
|
|
75783
75891
|
}
|
|
75784
75892
|
function getExpectedVersion(cachePackage, packageName) {
|
|
75785
75893
|
return normalizeVersion(cachePackage?.dependencies?.[packageName]) ?? normalizeVersion(cachePackage?.dependencies?.[PACKAGE_NAME]);
|
|
@@ -75791,16 +75899,16 @@ function getLoadedPluginVersion() {
|
|
|
75791
75899
|
const candidates = [
|
|
75792
75900
|
{
|
|
75793
75901
|
cacheDir: configDir,
|
|
75794
|
-
cachePackagePath:
|
|
75902
|
+
cachePackagePath: join30(configDir, "package.json"),
|
|
75795
75903
|
packageCandidates: createPackageCandidates(configDir)
|
|
75796
75904
|
},
|
|
75797
75905
|
{
|
|
75798
75906
|
cacheDir,
|
|
75799
|
-
cachePackagePath:
|
|
75907
|
+
cachePackagePath: join30(cacheDir, "package.json"),
|
|
75800
75908
|
packageCandidates: createPackageCandidates(cacheDir)
|
|
75801
75909
|
}
|
|
75802
75910
|
];
|
|
75803
|
-
const selectedCandidate = candidates.find((candidate) => candidate.packageCandidates.some((packageCandidate) =>
|
|
75911
|
+
const selectedCandidate = candidates.find((candidate) => candidate.packageCandidates.some((packageCandidate) => existsSync32(packageCandidate.installedPackagePath))) ?? candidates[0];
|
|
75804
75912
|
const { cacheDir: selectedDir, cachePackagePath } = selectedCandidate;
|
|
75805
75913
|
const selectedPackage = selectInstalledPackage(selectedCandidate);
|
|
75806
75914
|
const installedPackagePath = selectedPackage.installedPackagePath;
|
|
@@ -75839,10 +75947,10 @@ var defaultDeps3 = {
|
|
|
75839
75947
|
function isConfigValid(configPath) {
|
|
75840
75948
|
if (!configPath)
|
|
75841
75949
|
return true;
|
|
75842
|
-
if (!
|
|
75950
|
+
if (!existsSync33(configPath))
|
|
75843
75951
|
return false;
|
|
75844
75952
|
try {
|
|
75845
|
-
parseJsonc(
|
|
75953
|
+
parseJsonc(readFileSync27(configPath, "utf-8"));
|
|
75846
75954
|
return true;
|
|
75847
75955
|
} catch {
|
|
75848
75956
|
return false;
|
|
@@ -75964,32 +76072,32 @@ async function checkSystem(deps = defaultDeps3) {
|
|
|
75964
76072
|
}
|
|
75965
76073
|
|
|
75966
76074
|
// src/cli/doctor/checks/config.ts
|
|
75967
|
-
import { readFileSync as
|
|
75968
|
-
import { join as
|
|
76075
|
+
import { readFileSync as readFileSync30 } from "fs";
|
|
76076
|
+
import { join as join34 } from "path";
|
|
75969
76077
|
init_shared();
|
|
75970
76078
|
|
|
75971
76079
|
// src/cli/doctor/checks/model-resolution-cache.ts
|
|
75972
76080
|
init_shared();
|
|
75973
|
-
import { existsSync as
|
|
75974
|
-
import { homedir as
|
|
75975
|
-
import { join as
|
|
76081
|
+
import { existsSync as existsSync34, readFileSync as readFileSync28 } from "fs";
|
|
76082
|
+
import { homedir as homedir8 } from "os";
|
|
76083
|
+
import { join as join31 } from "path";
|
|
75976
76084
|
function getUserConfigDir2() {
|
|
75977
76085
|
const xdgConfig = process.env.XDG_CONFIG_HOME;
|
|
75978
76086
|
if (xdgConfig)
|
|
75979
|
-
return
|
|
75980
|
-
return
|
|
76087
|
+
return join31(xdgConfig, "opencode");
|
|
76088
|
+
return join31(homedir8(), ".config", "opencode");
|
|
75981
76089
|
}
|
|
75982
76090
|
function loadCustomProviderNames() {
|
|
75983
76091
|
const configDir = getUserConfigDir2();
|
|
75984
76092
|
const candidatePaths = [
|
|
75985
|
-
|
|
75986
|
-
|
|
76093
|
+
join31(configDir, "opencode.json"),
|
|
76094
|
+
join31(configDir, "opencode.jsonc")
|
|
75987
76095
|
];
|
|
75988
76096
|
for (const configPath of candidatePaths) {
|
|
75989
|
-
if (!
|
|
76097
|
+
if (!existsSync34(configPath))
|
|
75990
76098
|
continue;
|
|
75991
76099
|
try {
|
|
75992
|
-
const content =
|
|
76100
|
+
const content = readFileSync28(configPath, "utf-8");
|
|
75993
76101
|
const data = parseJsonc(content);
|
|
75994
76102
|
if (data?.provider && typeof data.provider === "object") {
|
|
75995
76103
|
return Object.keys(data.provider);
|
|
@@ -75999,16 +76107,16 @@ function loadCustomProviderNames() {
|
|
|
75999
76107
|
return [];
|
|
76000
76108
|
}
|
|
76001
76109
|
function loadAvailableModelsFromCache() {
|
|
76002
|
-
const cacheFile =
|
|
76110
|
+
const cacheFile = join31(getOpenCodeCacheDir(), "models.json");
|
|
76003
76111
|
const customProviders = loadCustomProviderNames();
|
|
76004
|
-
if (!
|
|
76112
|
+
if (!existsSync34(cacheFile)) {
|
|
76005
76113
|
if (customProviders.length > 0) {
|
|
76006
76114
|
return { providers: customProviders, modelCount: 0, cacheExists: true };
|
|
76007
76115
|
}
|
|
76008
76116
|
return { providers: [], modelCount: 0, cacheExists: false };
|
|
76009
76117
|
}
|
|
76010
76118
|
try {
|
|
76011
|
-
const content =
|
|
76119
|
+
const content = readFileSync28(cacheFile, "utf-8");
|
|
76012
76120
|
const data = parseJsonc(content);
|
|
76013
76121
|
const cacheProviders = Object.keys(data);
|
|
76014
76122
|
let modelCount = 0;
|
|
@@ -76031,14 +76139,14 @@ init_model_capabilities();
|
|
|
76031
76139
|
|
|
76032
76140
|
// src/cli/doctor/checks/model-resolution-config.ts
|
|
76033
76141
|
init_shared();
|
|
76034
|
-
import { readFileSync as
|
|
76035
|
-
import { join as
|
|
76036
|
-
var PROJECT_CONFIG_DIR =
|
|
76142
|
+
import { readFileSync as readFileSync29 } from "fs";
|
|
76143
|
+
import { join as join32 } from "path";
|
|
76144
|
+
var PROJECT_CONFIG_DIR = join32(process.cwd(), ".opencode");
|
|
76037
76145
|
function loadOmoConfig() {
|
|
76038
76146
|
const projectDetected = detectPluginConfigFile(PROJECT_CONFIG_DIR);
|
|
76039
76147
|
if (projectDetected.format !== "none") {
|
|
76040
76148
|
try {
|
|
76041
|
-
const content =
|
|
76149
|
+
const content = readFileSync29(projectDetected.path, "utf-8");
|
|
76042
76150
|
return parseJsonc(content);
|
|
76043
76151
|
} catch {
|
|
76044
76152
|
return null;
|
|
@@ -76048,7 +76156,7 @@ function loadOmoConfig() {
|
|
|
76048
76156
|
const userDetected = detectPluginConfigFile(userConfigDir);
|
|
76049
76157
|
if (userDetected.format !== "none") {
|
|
76050
76158
|
try {
|
|
76051
|
-
const content =
|
|
76159
|
+
const content = readFileSync29(userDetected.path, "utf-8");
|
|
76052
76160
|
return parseJsonc(content);
|
|
76053
76161
|
} catch {
|
|
76054
76162
|
return null;
|
|
@@ -76059,7 +76167,7 @@ function loadOmoConfig() {
|
|
|
76059
76167
|
|
|
76060
76168
|
// src/cli/doctor/checks/model-resolution-details.ts
|
|
76061
76169
|
init_shared();
|
|
76062
|
-
import { join as
|
|
76170
|
+
import { join as join33 } from "path";
|
|
76063
76171
|
|
|
76064
76172
|
// src/cli/doctor/checks/model-resolution-variant.ts
|
|
76065
76173
|
function formatModelWithVariant(model, variant) {
|
|
@@ -76101,7 +76209,7 @@ function formatCapabilityResolutionLabel(mode) {
|
|
|
76101
76209
|
}
|
|
76102
76210
|
function buildModelResolutionDetails(options) {
|
|
76103
76211
|
const details = [];
|
|
76104
|
-
const cacheFile =
|
|
76212
|
+
const cacheFile = join33(getOpenCodeCacheDir(), "models.json");
|
|
76105
76213
|
details.push("\u2550\u2550\u2550 Available Models (from cache) \u2550\u2550\u2550");
|
|
76106
76214
|
details.push("");
|
|
76107
76215
|
if (options.available.cacheExists) {
|
|
@@ -76256,7 +76364,7 @@ async function checkModels() {
|
|
|
76256
76364
|
}
|
|
76257
76365
|
|
|
76258
76366
|
// src/cli/doctor/checks/config.ts
|
|
76259
|
-
var PROJECT_CONFIG_DIR2 =
|
|
76367
|
+
var PROJECT_CONFIG_DIR2 = join34(process.cwd(), ".opencode");
|
|
76260
76368
|
function findConfigPath() {
|
|
76261
76369
|
const projectConfig = detectPluginConfigFile(PROJECT_CONFIG_DIR2);
|
|
76262
76370
|
if (projectConfig.format !== "none")
|
|
@@ -76273,7 +76381,7 @@ function validateConfig() {
|
|
|
76273
76381
|
return { exists: false, path: null, valid: true, config: null, errors: [] };
|
|
76274
76382
|
}
|
|
76275
76383
|
try {
|
|
76276
|
-
const content =
|
|
76384
|
+
const content = readFileSync30(configPath, "utf-8");
|
|
76277
76385
|
const rawConfig = parseJsonc(content);
|
|
76278
76386
|
const schemaResult = OhMyOpenCodeConfigSchema.safeParse(rawConfig);
|
|
76279
76387
|
if (!schemaResult.success) {
|
|
@@ -76376,27 +76484,27 @@ async function checkConfig() {
|
|
|
76376
76484
|
}
|
|
76377
76485
|
|
|
76378
76486
|
// src/cli/doctor/checks/dependencies.ts
|
|
76379
|
-
import { existsSync as
|
|
76487
|
+
import { existsSync as existsSync35 } from "fs";
|
|
76380
76488
|
import { createRequire } from "module";
|
|
76381
|
-
import { dirname as
|
|
76489
|
+
import { dirname as dirname14, join as join36 } from "path";
|
|
76382
76490
|
|
|
76383
76491
|
// src/hooks/comment-checker/downloader.ts
|
|
76384
|
-
import { join as
|
|
76385
|
-
import { homedir as
|
|
76492
|
+
import { join as join35 } from "path";
|
|
76493
|
+
import { homedir as homedir9, tmpdir as tmpdir3 } from "os";
|
|
76386
76494
|
init_binary_downloader();
|
|
76387
76495
|
init_logger();
|
|
76388
76496
|
init_plugin_identity();
|
|
76389
76497
|
var DEBUG = process.env.COMMENT_CHECKER_DEBUG === "1";
|
|
76390
|
-
var DEBUG_FILE =
|
|
76498
|
+
var DEBUG_FILE = join35(tmpdir3(), "comment-checker-debug.log");
|
|
76391
76499
|
function getCacheDir2() {
|
|
76392
76500
|
if (process.platform === "win32") {
|
|
76393
76501
|
const localAppData = process.env.LOCALAPPDATA || process.env.APPDATA;
|
|
76394
|
-
const base2 = localAppData ||
|
|
76395
|
-
return
|
|
76502
|
+
const base2 = localAppData || join35(homedir9(), "AppData", "Local");
|
|
76503
|
+
return join35(base2, CACHE_DIR_NAME, "bin");
|
|
76396
76504
|
}
|
|
76397
76505
|
const xdgCache = process.env.XDG_CACHE_HOME;
|
|
76398
|
-
const base = xdgCache ||
|
|
76399
|
-
return
|
|
76506
|
+
const base = xdgCache || join35(homedir9(), ".cache");
|
|
76507
|
+
return join35(base, CACHE_DIR_NAME, "bin");
|
|
76400
76508
|
}
|
|
76401
76509
|
function getBinaryName() {
|
|
76402
76510
|
return process.platform === "win32" ? "comment-checker.exe" : "comment-checker";
|
|
@@ -76460,15 +76568,15 @@ async function checkAstGrepNapi() {
|
|
|
76460
76568
|
path: null
|
|
76461
76569
|
};
|
|
76462
76570
|
} catch {
|
|
76463
|
-
const { existsSync:
|
|
76464
|
-
const { join:
|
|
76465
|
-
const { homedir:
|
|
76571
|
+
const { existsSync: existsSync36 } = await import("fs");
|
|
76572
|
+
const { join: join37 } = await import("path");
|
|
76573
|
+
const { homedir: homedir10 } = await import("os");
|
|
76466
76574
|
const pathsToCheck = [
|
|
76467
|
-
|
|
76468
|
-
|
|
76575
|
+
join37(homedir10(), ".config", "opencode", "node_modules", "@ast-grep", "napi"),
|
|
76576
|
+
join37(process.cwd(), "node_modules", "@ast-grep", "napi")
|
|
76469
76577
|
];
|
|
76470
76578
|
for (const napiPath of pathsToCheck) {
|
|
76471
|
-
if (
|
|
76579
|
+
if (existsSync36(napiPath)) {
|
|
76472
76580
|
return {
|
|
76473
76581
|
name: "AST-Grep NAPI",
|
|
76474
76582
|
required: false,
|
|
@@ -76493,8 +76601,8 @@ function findCommentCheckerPackageBinary() {
|
|
|
76493
76601
|
try {
|
|
76494
76602
|
const require2 = createRequire(import.meta.url);
|
|
76495
76603
|
const pkgPath = require2.resolve("@code-yeongyu/comment-checker/package.json");
|
|
76496
|
-
const binaryPath =
|
|
76497
|
-
if (
|
|
76604
|
+
const binaryPath = join36(dirname14(pkgPath), "bin", binaryName);
|
|
76605
|
+
if (existsSync35(binaryPath))
|
|
76498
76606
|
return binaryPath;
|
|
76499
76607
|
} catch {}
|
|
76500
76608
|
return null;
|
|
@@ -76655,15 +76763,15 @@ var BUILTIN_SERVERS = {
|
|
|
76655
76763
|
"kotlin-ls": { command: ["kotlin-lsp"], extensions: [".kt", ".kts"] }
|
|
76656
76764
|
};
|
|
76657
76765
|
// src/tools/lsp/server-config-loader.ts
|
|
76658
|
-
import { existsSync as
|
|
76659
|
-
import { join as
|
|
76766
|
+
import { existsSync as existsSync36, readFileSync as readFileSync31 } from "fs";
|
|
76767
|
+
import { join as join37 } from "path";
|
|
76660
76768
|
init_shared();
|
|
76661
76769
|
init_jsonc_parser();
|
|
76662
76770
|
function loadJsonFile(path12) {
|
|
76663
|
-
if (!
|
|
76771
|
+
if (!existsSync36(path12))
|
|
76664
76772
|
return null;
|
|
76665
76773
|
try {
|
|
76666
|
-
return parseJsonc(
|
|
76774
|
+
return parseJsonc(readFileSync31(path12, "utf-8"));
|
|
76667
76775
|
} catch {
|
|
76668
76776
|
return null;
|
|
76669
76777
|
}
|
|
@@ -76672,9 +76780,9 @@ function getConfigPaths2() {
|
|
|
76672
76780
|
const cwd = process.cwd();
|
|
76673
76781
|
const configDir = getOpenCodeConfigDir({ binary: "opencode" });
|
|
76674
76782
|
return {
|
|
76675
|
-
project: detectPluginConfigFile(
|
|
76783
|
+
project: detectPluginConfigFile(join37(cwd, ".opencode")).path,
|
|
76676
76784
|
user: detectPluginConfigFile(configDir).path,
|
|
76677
|
-
opencode: detectConfigFile(
|
|
76785
|
+
opencode: detectConfigFile(join37(configDir, "opencode")).path
|
|
76678
76786
|
};
|
|
76679
76787
|
}
|
|
76680
76788
|
function loadAllConfigs() {
|
|
@@ -76743,21 +76851,21 @@ function getMergedServers() {
|
|
|
76743
76851
|
}
|
|
76744
76852
|
|
|
76745
76853
|
// src/tools/lsp/server-installation.ts
|
|
76746
|
-
import { existsSync as
|
|
76747
|
-
import { delimiter as delimiter2, join as
|
|
76854
|
+
import { existsSync as existsSync37 } from "fs";
|
|
76855
|
+
import { delimiter as delimiter2, join as join39 } from "path";
|
|
76748
76856
|
|
|
76749
76857
|
// src/tools/lsp/server-path-bases.ts
|
|
76750
76858
|
init_shared();
|
|
76751
|
-
import { join as
|
|
76859
|
+
import { join as join38 } from "path";
|
|
76752
76860
|
function getLspServerAdditionalPathBases(workingDirectory) {
|
|
76753
76861
|
const configDir = getOpenCodeConfigDir({ binary: "opencode" });
|
|
76754
|
-
const dataDir =
|
|
76862
|
+
const dataDir = join38(getDataDir(), "opencode");
|
|
76755
76863
|
return [
|
|
76756
|
-
|
|
76757
|
-
|
|
76758
|
-
|
|
76759
|
-
|
|
76760
|
-
|
|
76864
|
+
join38(workingDirectory, "node_modules", ".bin"),
|
|
76865
|
+
join38(configDir, "bin"),
|
|
76866
|
+
join38(configDir, "node_modules", ".bin"),
|
|
76867
|
+
join38(dataDir, "bin"),
|
|
76868
|
+
join38(dataDir, "bin", "node_modules", ".bin")
|
|
76761
76869
|
];
|
|
76762
76870
|
}
|
|
76763
76871
|
|
|
@@ -76767,7 +76875,7 @@ function isServerInstalled(command) {
|
|
|
76767
76875
|
return false;
|
|
76768
76876
|
const cmd = command[0];
|
|
76769
76877
|
if (cmd.includes("/") || cmd.includes("\\")) {
|
|
76770
|
-
if (
|
|
76878
|
+
if (existsSync37(cmd))
|
|
76771
76879
|
return true;
|
|
76772
76880
|
}
|
|
76773
76881
|
const isWindows = process.platform === "win32";
|
|
@@ -76788,14 +76896,14 @@ function isServerInstalled(command) {
|
|
|
76788
76896
|
const paths = pathEnv.split(delimiter2);
|
|
76789
76897
|
for (const p2 of paths) {
|
|
76790
76898
|
for (const suffix of exts) {
|
|
76791
|
-
if (
|
|
76899
|
+
if (existsSync37(join39(p2, cmd + suffix))) {
|
|
76792
76900
|
return true;
|
|
76793
76901
|
}
|
|
76794
76902
|
}
|
|
76795
76903
|
}
|
|
76796
76904
|
for (const base of getLspServerAdditionalPathBases(process.cwd())) {
|
|
76797
76905
|
for (const suffix of exts) {
|
|
76798
|
-
if (
|
|
76906
|
+
if (existsSync37(join39(base, cmd + suffix))) {
|
|
76799
76907
|
return true;
|
|
76800
76908
|
}
|
|
76801
76909
|
}
|
|
@@ -76857,24 +76965,24 @@ function getInstalledLspServers() {
|
|
|
76857
76965
|
|
|
76858
76966
|
// src/cli/doctor/checks/tools-mcp.ts
|
|
76859
76967
|
init_shared();
|
|
76860
|
-
import { existsSync as
|
|
76861
|
-
import { homedir as
|
|
76862
|
-
import { join as
|
|
76968
|
+
import { existsSync as existsSync38, readFileSync as readFileSync32 } from "fs";
|
|
76969
|
+
import { homedir as homedir10 } from "os";
|
|
76970
|
+
import { join as join40 } from "path";
|
|
76863
76971
|
var BUILTIN_MCP_SERVERS = ["context7", "grep_app"];
|
|
76864
76972
|
function getMcpConfigPaths() {
|
|
76865
76973
|
return [
|
|
76866
|
-
|
|
76867
|
-
|
|
76868
|
-
|
|
76974
|
+
join40(homedir10(), ".claude", ".mcp.json"),
|
|
76975
|
+
join40(process.cwd(), ".mcp.json"),
|
|
76976
|
+
join40(process.cwd(), ".claude", ".mcp.json")
|
|
76869
76977
|
];
|
|
76870
76978
|
}
|
|
76871
76979
|
function loadUserMcpConfig() {
|
|
76872
76980
|
const servers = {};
|
|
76873
76981
|
for (const configPath of getMcpConfigPaths()) {
|
|
76874
|
-
if (!
|
|
76982
|
+
if (!existsSync38(configPath))
|
|
76875
76983
|
continue;
|
|
76876
76984
|
try {
|
|
76877
|
-
const content =
|
|
76985
|
+
const content = readFileSync32(configPath, "utf-8");
|
|
76878
76986
|
const config2 = parseJsonc(content);
|
|
76879
76987
|
if (config2.mcpServers) {
|
|
76880
76988
|
Object.assign(servers, config2.mcpServers);
|
|
@@ -77372,11 +77480,11 @@ async function refreshModelCapabilities(options, deps = {}) {
|
|
|
77372
77480
|
|
|
77373
77481
|
// src/features/mcp-oauth/storage.ts
|
|
77374
77482
|
init_shared();
|
|
77375
|
-
import { chmodSync as chmodSync2, existsSync as
|
|
77376
|
-
import { dirname as
|
|
77483
|
+
import { chmodSync as chmodSync2, existsSync as existsSync39, mkdirSync as mkdirSync12, readFileSync as readFileSync33, renameSync as renameSync4, unlinkSync as unlinkSync6, writeFileSync as writeFileSync10 } from "fs";
|
|
77484
|
+
import { dirname as dirname15, join as join41 } from "path";
|
|
77377
77485
|
var STORAGE_FILE_NAME = "mcp-oauth.json";
|
|
77378
77486
|
function getMcpOauthStoragePath() {
|
|
77379
|
-
return
|
|
77487
|
+
return join41(getOpenCodeConfigDir({ binary: "opencode" }), STORAGE_FILE_NAME);
|
|
77380
77488
|
}
|
|
77381
77489
|
function normalizeHost(serverHost) {
|
|
77382
77490
|
let host = serverHost.trim();
|
|
@@ -77413,11 +77521,11 @@ function buildKey(serverHost, resource) {
|
|
|
77413
77521
|
}
|
|
77414
77522
|
function readStore() {
|
|
77415
77523
|
const filePath = getMcpOauthStoragePath();
|
|
77416
|
-
if (!
|
|
77524
|
+
if (!existsSync39(filePath)) {
|
|
77417
77525
|
return null;
|
|
77418
77526
|
}
|
|
77419
77527
|
try {
|
|
77420
|
-
const content =
|
|
77528
|
+
const content = readFileSync33(filePath, "utf-8");
|
|
77421
77529
|
return JSON.parse(content);
|
|
77422
77530
|
} catch {
|
|
77423
77531
|
return null;
|
|
@@ -77426,8 +77534,8 @@ function readStore() {
|
|
|
77426
77534
|
function writeStore(store2) {
|
|
77427
77535
|
const filePath = getMcpOauthStoragePath();
|
|
77428
77536
|
try {
|
|
77429
|
-
const dir =
|
|
77430
|
-
if (!
|
|
77537
|
+
const dir = dirname15(filePath);
|
|
77538
|
+
if (!existsSync39(dir)) {
|
|
77431
77539
|
mkdirSync12(dir, { recursive: true });
|
|
77432
77540
|
}
|
|
77433
77541
|
const tempPath = `${filePath}.tmp.${Date.now()}`;
|
|
@@ -77464,7 +77572,7 @@ function deleteToken(serverHost, resource) {
|
|
|
77464
77572
|
if (Object.keys(store2).length === 0) {
|
|
77465
77573
|
try {
|
|
77466
77574
|
const filePath = getMcpOauthStoragePath();
|
|
77467
|
-
if (
|
|
77575
|
+
if (existsSync39(filePath)) {
|
|
77468
77576
|
unlinkSync6(filePath);
|
|
77469
77577
|
}
|
|
77470
77578
|
return true;
|
|
@@ -77684,7 +77792,7 @@ function buildAuthorizationUrl(authorizationEndpoint, options) {
|
|
|
77684
77792
|
}
|
|
77685
77793
|
var CALLBACK_TIMEOUT_MS = 5 * 60 * 1000;
|
|
77686
77794
|
function startCallbackServer(port) {
|
|
77687
|
-
return new Promise((
|
|
77795
|
+
return new Promise((resolve4, reject) => {
|
|
77688
77796
|
let timeoutId;
|
|
77689
77797
|
const server2 = createServer((request, response) => {
|
|
77690
77798
|
clearTimeout(timeoutId);
|
|
@@ -77710,7 +77818,7 @@ function startCallbackServer(port) {
|
|
|
77710
77818
|
response.writeHead(200, { "content-type": "text/html" });
|
|
77711
77819
|
response.end("<html><body><h1>Authorization successful. You can close this tab.</h1></body></html>");
|
|
77712
77820
|
server2.close();
|
|
77713
|
-
|
|
77821
|
+
resolve4({ code, state: state2 });
|
|
77714
77822
|
});
|
|
77715
77823
|
timeoutId = setTimeout(() => {
|
|
77716
77824
|
server2.close();
|