toc-ocra 0.3.9 → 0.3.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -8
- package/dist/cli/cli.mjs +126 -101
- package/dist/plugin/renderer.js +1 -1
- package/dist/plugin/renderer.js.map +3 -3
- package/dist/service/agent.mjs +120 -94
- package/dist/src/acp/acp-launch-specs.d.ts +1 -1
- package/dist/src/acp/acp-launch-specs.js +0 -77
- package/dist/src/acp/acp-launch-specs.js.map +1 -1
- package/dist/src/acp/acp-model-catalog-probe.js +1 -1
- package/dist/src/acp/acp-model-catalog-probe.js.map +1 -1
- package/dist/src/index.js +4 -3
- package/dist/src/index.js.map +1 -1
- package/dist/src/platform/posix.js +8 -1
- package/dist/src/platform/posix.js.map +1 -1
- package/dist/src/platform/win32.js +84 -12
- package/dist/src/platform/win32.js.map +1 -1
- package/dist/src/providers/cli-specs.js +0 -11
- package/dist/src/providers/cli-specs.js.map +1 -1
- package/dist/src/providers/detection.js +10 -6
- package/dist/src/providers/detection.js.map +1 -1
- package/dist/src/providers/provider.js +1 -1
- package/dist/src/providers/provider.js.map +1 -1
- package/dist/src/runtime/agent-service.js +4 -2
- package/dist/src/runtime/agent-service.js.map +1 -1
- package/dist/src/shared/node-cli-command-resolution.js +5 -1
- package/dist/src/shared/node-cli-command-resolution.js.map +1 -1
- package/locales/en.json +1 -0
- package/locales/zh-CN.json +1 -0
- package/package.json +1 -1
- package/scripts/service.mjs +48 -12
- package/dist/src/providers/acp/acp-agents.d.ts +0 -14
- package/dist/src/providers/acp/acp-agents.js +0 -55
- package/dist/src/providers/acp/acp-agents.js.map +0 -1
package/dist/service/agent.mjs
CHANGED
|
@@ -20505,7 +20505,14 @@ function createPosixPlatform(id) {
|
|
|
20505
20505
|
// Why: pnpm uses platform-specific global bin directories that differ
|
|
20506
20506
|
// from npm's ~/.local/bin.
|
|
20507
20507
|
id === "darwin" ? join4(home, "Library", "pnpm") : join4(home, ".local", "share", "pnpm"),
|
|
20508
|
-
join4(home, ".yarn", "bin")
|
|
20508
|
+
join4(home, ".yarn", "bin"),
|
|
20509
|
+
// ChatGPT ships the Codex CLI inside the app bundle. GUI-launched
|
|
20510
|
+
// services do not inherit the app's private PATH entry, so include the
|
|
20511
|
+
// stable bundle bin location when resolving installed CLIs on macOS.
|
|
20512
|
+
...id === "darwin" ? [
|
|
20513
|
+
"/Applications/ChatGPT.app/Contents/Resources/codex-cli/bin",
|
|
20514
|
+
join4(home, "Applications", "ChatGPT.app", "Contents", "Resources", "codex-cli", "bin")
|
|
20515
|
+
] : []
|
|
20509
20516
|
],
|
|
20510
20517
|
fallbackBinDirectories: (home) => ["/opt/homebrew/bin", "/usr/local/bin", join4(home, ".local", "bin")],
|
|
20511
20518
|
normalizeEnvironment: (env) => ({ ...env }),
|
|
@@ -20536,11 +20543,12 @@ function createPosixPlatform(id) {
|
|
|
20536
20543
|
|
|
20537
20544
|
// src/platform/win32.ts
|
|
20538
20545
|
import { execFile as execFile2, spawn as spawn2 } from "node:child_process";
|
|
20539
|
-
import { readFileSync as readFileSync4, statSync as statSync3 } from "node:fs";
|
|
20540
|
-
import { join as join5, win32 } from "node:path";
|
|
20546
|
+
import { readFileSync as readFileSync4, readdirSync, statSync as statSync3 } from "node:fs";
|
|
20547
|
+
import { dirname as dirname3, join as join5, win32 } from "node:path";
|
|
20541
20548
|
var SYSTEM_ROOT = process.env.SystemRoot || process.env.windir || "C:\\Windows";
|
|
20542
20549
|
var POWERSHELL = join5(SYSTEM_ROOT, "System32", "WindowsPowerShell", "v1.0", "powershell.exe");
|
|
20543
20550
|
var HELPER_TIMEOUT_MS = 5e3;
|
|
20551
|
+
var bundledCliDirectories = [];
|
|
20544
20552
|
var SHIM_TARGET_RE = /%~?dp0%?\\?([^"%\r\n]+)/gi;
|
|
20545
20553
|
var SHIM_TARGET_EXTENSIONS = /\.(c|m)?js$|\.exe$/i;
|
|
20546
20554
|
var MAX_SHIM_BYTES = 64 * 1024;
|
|
@@ -20589,6 +20597,47 @@ function runPowerShell(script) {
|
|
|
20589
20597
|
function expandVariables(value) {
|
|
20590
20598
|
return value.replace(/%([^%;]+)%/g, (whole2, name) => process.env[name] ?? whole2);
|
|
20591
20599
|
}
|
|
20600
|
+
async function bundledCodexDirectories() {
|
|
20601
|
+
const local = process.env.LOCALAPPDATA;
|
|
20602
|
+
const roots = [local, process.env.ProgramFiles, process.env["ProgramFiles(x86)"]].filter((value) => Boolean(value)).flatMap((base) => ["ChatGPT", "Codex", join5("Programs", "ChatGPT"), join5("Programs", "Codex")].map((name) => join5(base, name)));
|
|
20603
|
+
const result = await runPowerShell("@(Get-AppxPackage -ErrorAction SilentlyContinue | Where-Object { $_.Name -match 'OpenAI|ChatGPT|Codex' } | Select-Object -ExpandProperty InstallLocation) | ConvertTo-Json -Compress");
|
|
20604
|
+
if (result.ok) {
|
|
20605
|
+
try {
|
|
20606
|
+
const locations = JSON.parse(result.stdout.trim());
|
|
20607
|
+
for (const location of Array.isArray(locations) ? locations : [locations]) {
|
|
20608
|
+
if (typeof location === "string" && location) roots.push(location);
|
|
20609
|
+
}
|
|
20610
|
+
} catch {
|
|
20611
|
+
}
|
|
20612
|
+
}
|
|
20613
|
+
const found = /* @__PURE__ */ new Set();
|
|
20614
|
+
for (const root2 of new Set(roots)) {
|
|
20615
|
+
const pending = ["resources", join5("app", "resources"), "codex-cli", join5("app", "codex-cli")].map((relative4) => ({ directory: join5(root2, relative4), depth: 0 }));
|
|
20616
|
+
for (let visited = 0; pending.length && visited < 256; visited++) {
|
|
20617
|
+
const { directory, depth } = pending.shift();
|
|
20618
|
+
try {
|
|
20619
|
+
for (const entry of readdirSync(directory, { withFileTypes: true })) {
|
|
20620
|
+
const file2 = join5(directory, entry.name);
|
|
20621
|
+
if (entry.isFile() && entry.name.toLowerCase() === "codex.exe") found.add(dirname3(file2));
|
|
20622
|
+
else if (entry.isDirectory() && depth < 5) pending.push({ directory: file2, depth: depth + 1 });
|
|
20623
|
+
}
|
|
20624
|
+
} catch {
|
|
20625
|
+
}
|
|
20626
|
+
}
|
|
20627
|
+
}
|
|
20628
|
+
return [...found];
|
|
20629
|
+
}
|
|
20630
|
+
function npmPrefix(home) {
|
|
20631
|
+
let prefix = process.env.npm_config_prefix ?? process.env.NPM_CONFIG_PREFIX;
|
|
20632
|
+
if (!prefix) {
|
|
20633
|
+
try {
|
|
20634
|
+
prefix = /^\s*prefix\s*=\s*(.+?)\s*$/mi.exec(readFileSync4(process.env.NPM_CONFIG_USERCONFIG ?? join5(home, ".npmrc"), "utf8"))?.[1];
|
|
20635
|
+
} catch {
|
|
20636
|
+
}
|
|
20637
|
+
}
|
|
20638
|
+
if (!prefix) return void 0;
|
|
20639
|
+
return expandVariables(prefix.replace(/^(["'])(.*)\1$/, "$2").replace(/^~(?=[\\/]|$)/, home).replace(/\$\{([^}]+)\}/g, (whole2, name) => process.env[name] ?? whole2));
|
|
20640
|
+
}
|
|
20592
20641
|
async function readRegistryEnvironment() {
|
|
20593
20642
|
const names = [...new Set(PROXY_KEYS.map((key) => key.toLowerCase()))];
|
|
20594
20643
|
const script = [
|
|
@@ -20599,7 +20648,8 @@ async function readRegistryEnvironment() {
|
|
|
20599
20648
|
"$v=[Environment]::GetEnvironmentVariable($k,'User');if(-not $v){$v=[Environment]::GetEnvironmentVariable($k,'Machine')};if($v){$r.proxy[$k]=$v}};",
|
|
20600
20649
|
"$r|ConvertTo-Json -Compress -Depth 4"
|
|
20601
20650
|
].join("");
|
|
20602
|
-
const result = await runPowerShell(script);
|
|
20651
|
+
const [result, bundled] = await Promise.all([runPowerShell(script), bundledCodexDirectories()]);
|
|
20652
|
+
bundledCliDirectories = bundled;
|
|
20603
20653
|
if (!result.ok) return { ok: false, segments: [], failureReason: result.reason };
|
|
20604
20654
|
let parsed;
|
|
20605
20655
|
try {
|
|
@@ -20608,7 +20658,7 @@ async function readRegistryEnvironment() {
|
|
|
20608
20658
|
return { ok: false, segments: [], failureReason: "empty_path" };
|
|
20609
20659
|
}
|
|
20610
20660
|
const raw = (Array.isArray(parsed.path) ? parsed.path : [parsed.path]).filter((value) => typeof value === "string");
|
|
20611
|
-
const segments = [...new Set(raw.flatMap((value) => value.split(";")).map((segment) => expandVariables(segment.trim())).filter(Boolean))];
|
|
20661
|
+
const segments = [...new Set(raw.flatMap((value) => value.split(";")).map((segment) => expandVariables(segment.trim().replace(/^"(.*)"$/, "$1"))).filter(Boolean))];
|
|
20612
20662
|
if (segments.length === 0) return { ok: false, segments: [], failureReason: "empty_path" };
|
|
20613
20663
|
const proxyEnv = Object.fromEntries(Object.entries(parsed.proxy ?? {}).filter((entry) => typeof entry[1] === "string" && entry[1].length > 0));
|
|
20614
20664
|
return { ok: true, segments, proxyEnv, failureReason: "none" };
|
|
@@ -20623,14 +20673,29 @@ var win32Platform = {
|
|
|
20623
20673
|
return false;
|
|
20624
20674
|
}
|
|
20625
20675
|
},
|
|
20626
|
-
userBinDirectories: (home) =>
|
|
20627
|
-
|
|
20628
|
-
|
|
20629
|
-
|
|
20630
|
-
|
|
20631
|
-
|
|
20632
|
-
|
|
20633
|
-
|
|
20676
|
+
userBinDirectories: (home) => {
|
|
20677
|
+
const roaming = process.env.APPDATA ?? join5(home, "AppData", "Roaming");
|
|
20678
|
+
const local = process.env.LOCALAPPDATA ?? join5(home, "AppData", "Local");
|
|
20679
|
+
return [
|
|
20680
|
+
// Native Windows CLI installers use this directory even without PATH.
|
|
20681
|
+
join5(home, ".local", "bin"),
|
|
20682
|
+
join5(roaming, "npm"),
|
|
20683
|
+
join5(roaming, "pnpm"),
|
|
20684
|
+
join5(local, "pnpm"),
|
|
20685
|
+
join5(local, "Yarn", "bin"),
|
|
20686
|
+
join5(local, "Microsoft", "WindowsApps"),
|
|
20687
|
+
join5(local, "Microsoft", "WinGet", "Links"),
|
|
20688
|
+
join5(home, "npm-global"),
|
|
20689
|
+
join5(process.env.SCOOP ?? join5(home, "scoop"), "shims"),
|
|
20690
|
+
npmPrefix(home),
|
|
20691
|
+
process.env.PNPM_HOME,
|
|
20692
|
+
process.env.NVM_SYMLINK,
|
|
20693
|
+
process.env.NVM_HOME,
|
|
20694
|
+
process.env.FNM_MULTISHELL_PATH,
|
|
20695
|
+
process.env.VOLTA_HOME && join5(process.env.VOLTA_HOME, "bin"),
|
|
20696
|
+
...bundledCliDirectories
|
|
20697
|
+
].filter((value) => Boolean(value));
|
|
20698
|
+
},
|
|
20634
20699
|
fallbackBinDirectories: (home) => [join5(home, ".local", "bin")],
|
|
20635
20700
|
normalizeEnvironment(env) {
|
|
20636
20701
|
const copy = { ...env };
|
|
@@ -20718,17 +20783,6 @@ var SOURCES = [
|
|
|
20718
20783
|
{ id: "opencode", label: "OpenCode", command: "opencode", versionArguments: ["--version"], installHint: "npm i -g opencode-ai" },
|
|
20719
20784
|
{ id: "kiro", label: "Kiro CLI", aliases: ["kiro-cli"], command: "kiro-cli", commandAliases: ["kiro"], versionArguments: ["--version"], promptStdin: "omit", restrictedPermission: true },
|
|
20720
20785
|
{ id: "omp", label: "OMP", command: "omp", versionArguments: ["--version"] },
|
|
20721
|
-
// Chinese coding CLIs that serve ACP themselves (acp/acp-launch-specs.ts). Only
|
|
20722
|
-
// the main command is detected: launches use it, never an alias.
|
|
20723
|
-
{ id: "qwen", label: "Qwen Code", aliases: ["qwen-code"], command: "qwen", versionArguments: ["--version"], installHint: "npm i -g @qwen-code/qwen-code" },
|
|
20724
|
-
{ id: "kimi", label: "Kimi Code", aliases: ["kimi-code"], command: "kimi", versionArguments: ["--version"] },
|
|
20725
|
-
{ id: "qoder", label: "Qoder CLI", command: "qodercli", versionArguments: ["--version"] },
|
|
20726
|
-
{ id: "qoder-cn", label: "Qoder CN CLI", aliases: ["qodercn"], command: "qoderclicn", versionArguments: ["--version"], installHint: "npm i -g @qodercn-ai/qoderclicn" },
|
|
20727
|
-
{ id: "codebuddy", label: "CodeBuddy Code", aliases: ["codebuddy-code"], command: "codebuddy", versionArguments: ["--version"], installHint: "npm i -g @tencent-ai/codebuddy-code" },
|
|
20728
|
-
// TRAE CN's own name: `trae-cli` is also installed by the unrelated bytedance/trae-agent.
|
|
20729
|
-
{ id: "trae", label: "TRAE CLI", command: "traecli", versionArguments: ["--version"] },
|
|
20730
|
-
{ id: "mimo", label: "MiMo Code", aliases: ["mimo-code"], command: "mimo", versionArguments: ["--version"] },
|
|
20731
|
-
{ id: "dsh", label: "DeepSeek Harness", aliases: ["deepseek", "deepseek-harness"], command: "dsh", versionArguments: ["--version"] },
|
|
20732
20786
|
{ id: "cursor", label: "Cursor Agent", command: "cursor-agent", commandAliases: ["cursor"] },
|
|
20733
20787
|
{ id: "copilot", label: "GitHub Copilot CLI", command: "copilot" },
|
|
20734
20788
|
{ id: "aider", label: "Aider", command: "aider" },
|
|
@@ -20768,18 +20822,18 @@ function detectedCliVersion(id) {
|
|
|
20768
20822
|
// src/providers/provider.ts
|
|
20769
20823
|
import { realpathSync } from "node:fs";
|
|
20770
20824
|
import { homedir as homedir3 } from "node:os";
|
|
20771
|
-
import { delimiter as delimiter4, dirname as
|
|
20825
|
+
import { delimiter as delimiter4, dirname as dirname5 } from "node:path";
|
|
20772
20826
|
|
|
20773
20827
|
// src/shared/node-cli-command-resolution.ts
|
|
20774
|
-
import { existsSync as existsSync4, readdirSync } from "node:fs";
|
|
20828
|
+
import { existsSync as existsSync4, readdirSync as readdirSync2 } from "node:fs";
|
|
20775
20829
|
import { homedir as homedir2 } from "node:os";
|
|
20776
|
-
import { dirname as
|
|
20830
|
+
import { dirname as dirname4, join as join6 } from "node:path";
|
|
20777
20831
|
function adapterOf(options) {
|
|
20778
20832
|
return platformFor(options.platform ?? process.platform);
|
|
20779
20833
|
}
|
|
20780
20834
|
function splitPath(platform2, pathEnv) {
|
|
20781
20835
|
if (!pathEnv) return [];
|
|
20782
|
-
return pathEnv.split(platform2.id === "win32" ? ";" : ":").map((entry) => entry.trim()).filter(Boolean);
|
|
20836
|
+
return pathEnv.split(platform2.id === "win32" ? ";" : ":").map((entry) => entry.trim().replace(/^"(.*)"$/, "$1")).filter(Boolean);
|
|
20783
20837
|
}
|
|
20784
20838
|
function parseVersionSegment(raw) {
|
|
20785
20839
|
return raw.replace(/^v/i, "").split(".").map((segment) => Number.parseInt(segment, 10)).map((segment) => Number.isFinite(segment) ? segment : 0);
|
|
@@ -20813,12 +20867,12 @@ function getBaseVersionManagerDirectories(platform2, homePath) {
|
|
|
20813
20867
|
function getNvmVersionDirectories(homePath) {
|
|
20814
20868
|
const nvmVersionsDir = join6(homePath, ".nvm", "versions", "node");
|
|
20815
20869
|
if (!existsSync4(nvmVersionsDir)) return [];
|
|
20816
|
-
return
|
|
20870
|
+
return readdirSync2(nvmVersionsDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort(compareVersionDesc).map((entry) => join6(nvmVersionsDir, entry, "bin"));
|
|
20817
20871
|
}
|
|
20818
20872
|
function getVersionManagerDirectories(platform2, homePath, executableNames) {
|
|
20819
20873
|
const directories = getBaseVersionManagerDirectories(platform2, homePath);
|
|
20820
20874
|
const firstNvmMatch = findFirstExecutable(platform2, getNvmVersionDirectories(homePath), executableNames);
|
|
20821
|
-
if (firstNvmMatch) directories.unshift(
|
|
20875
|
+
if (firstNvmMatch) directories.unshift(dirname4(firstNvmMatch));
|
|
20822
20876
|
return directories;
|
|
20823
20877
|
}
|
|
20824
20878
|
function resolveCliCommand(commandName, options = {}) {
|
|
@@ -20826,6 +20880,7 @@ function resolveCliCommand(commandName, options = {}) {
|
|
|
20826
20880
|
}
|
|
20827
20881
|
function findCliCommand(commandName, options = {}) {
|
|
20828
20882
|
const platform2 = adapterOf(options);
|
|
20883
|
+
if (/[\\/]/.test(commandName)) return platform2.isRunnableFile(commandName) ? commandName : null;
|
|
20829
20884
|
const executableNames = platform2.executableNames(commandName);
|
|
20830
20885
|
const pathEnv = options.pathEnv ?? process.env.PATH ?? process.env.Path ?? null;
|
|
20831
20886
|
const pathCandidate = findFirstExecutable(platform2, splitPath(platform2, pathEnv), executableNames);
|
|
@@ -20892,9 +20947,9 @@ function toolCallRows(name, path) {
|
|
|
20892
20947
|
function providerEnvironment() {
|
|
20893
20948
|
const env = currentPlatform.normalizeEnvironment(process.env);
|
|
20894
20949
|
const commandPaths = [
|
|
20895
|
-
|
|
20896
|
-
...getVersionManagerBinPaths(),
|
|
20950
|
+
dirname5(process.execPath),
|
|
20897
20951
|
env.PATH,
|
|
20952
|
+
...getVersionManagerBinPaths(),
|
|
20898
20953
|
...currentPlatform.fallbackBinDirectories(homedir3())
|
|
20899
20954
|
].filter((value) => Boolean(value));
|
|
20900
20955
|
env.PATH = [...new Set(commandPaths)].join(delimiter4);
|
|
@@ -20962,7 +21017,7 @@ import { spawn as spawn3 } from "node:child_process";
|
|
|
20962
21017
|
import { statSync as statSync4 } from "node:fs";
|
|
20963
21018
|
import { chmod as chmod3, mkdir as mkdir3, readFile as readFile3, rename as rename3, stat, writeFile as writeFile3 } from "node:fs/promises";
|
|
20964
21019
|
import { homedir as homedir4 } from "node:os";
|
|
20965
|
-
import { dirname as
|
|
21020
|
+
import { dirname as dirname6, isAbsolute, join as join7, resolve as resolve2 } from "node:path";
|
|
20966
21021
|
var codexHome = () => process.env.CODEX_HOME?.trim() || join7(homedir4(), ".codex");
|
|
20967
21022
|
var BUNDLED_TIMEOUT_MS = 1e4;
|
|
20968
21023
|
function configuredCatalogPath(config2, home = codexHome()) {
|
|
@@ -21071,7 +21126,7 @@ async function rebuild() {
|
|
|
21071
21126
|
return;
|
|
21072
21127
|
}
|
|
21073
21128
|
const path = overlayPath();
|
|
21074
|
-
await mkdir3(
|
|
21129
|
+
await mkdir3(dirname6(path), { recursive: true, mode: 448 });
|
|
21075
21130
|
const temporary = `${path}.${process.pid}.tmp`;
|
|
21076
21131
|
await writeFile3(temporary, JSON.stringify(filled), { mode: 384 });
|
|
21077
21132
|
await rename3(temporary, path);
|
|
@@ -21605,10 +21660,6 @@ var MODEL_SOURCES = {
|
|
|
21605
21660
|
}
|
|
21606
21661
|
};
|
|
21607
21662
|
|
|
21608
|
-
// src/acp/acp-dialects/acp-dialect.ts
|
|
21609
|
-
var GENERIC_ACP_DIALECT = {};
|
|
21610
|
-
var record2 = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
21611
|
-
|
|
21612
21663
|
// src/acp/acp-dialects/gemini-dialect.ts
|
|
21613
21664
|
var GEMINI_FAILURE_RULES = [
|
|
21614
21665
|
{ kind: "sessionMissing", pattern: /session[^\n]{0,60}(?:not found|does not exist)|no session found|invalid session/i },
|
|
@@ -21616,6 +21667,9 @@ var GEMINI_FAILURE_RULES = [
|
|
|
21616
21667
|
];
|
|
21617
21668
|
var GEMINI_ACP_DIALECT = { failureRules: GEMINI_FAILURE_RULES };
|
|
21618
21669
|
|
|
21670
|
+
// src/acp/acp-dialects/acp-dialect.ts
|
|
21671
|
+
var record2 = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
21672
|
+
|
|
21619
21673
|
// src/acp/acp-dialects/grok-dialect.ts
|
|
21620
21674
|
function modelEfforts(model) {
|
|
21621
21675
|
const meta3 = record2(model._meta);
|
|
@@ -22126,7 +22180,7 @@ import { spawn as spawn6 } from "node:child_process";
|
|
|
22126
22180
|
import { createHash } from "node:crypto";
|
|
22127
22181
|
import { existsSync as existsSync5, readFileSync as readFileSync5 } from "node:fs";
|
|
22128
22182
|
import { copyFile, mkdir as mkdir4, rename as rename4, rm as rm2, writeFile as writeFile4 } from "node:fs/promises";
|
|
22129
|
-
import { dirname as
|
|
22183
|
+
import { dirname as dirname7, join as join11, resolve as resolve4 } from "node:path";
|
|
22130
22184
|
import { fileURLToPath } from "node:url";
|
|
22131
22185
|
var AcpRuntimeUnavailable = class extends Error {
|
|
22132
22186
|
constructor(message) {
|
|
@@ -22136,7 +22190,7 @@ var AcpRuntimeUnavailable = class extends Error {
|
|
|
22136
22190
|
};
|
|
22137
22191
|
var NPM_INSTALL_TIMEOUT_MS = 10 * 6e4;
|
|
22138
22192
|
function packageRoot() {
|
|
22139
|
-
let directory =
|
|
22193
|
+
let directory = dirname7(fileURLToPath(import.meta.url));
|
|
22140
22194
|
while (true) {
|
|
22141
22195
|
const path = resolve4(directory, "package.json");
|
|
22142
22196
|
if (existsSync5(path)) {
|
|
@@ -22145,7 +22199,7 @@ function packageRoot() {
|
|
|
22145
22199
|
} catch {
|
|
22146
22200
|
}
|
|
22147
22201
|
}
|
|
22148
|
-
const parent =
|
|
22202
|
+
const parent = dirname7(directory);
|
|
22149
22203
|
if (parent === directory) return void 0;
|
|
22150
22204
|
directory = parent;
|
|
22151
22205
|
}
|
|
@@ -22173,7 +22227,7 @@ var installs = /* @__PURE__ */ new Map();
|
|
|
22173
22227
|
function ensureClaudeRuntime(dataDir2) {
|
|
22174
22228
|
const entry = vendoredAdapter("claude");
|
|
22175
22229
|
if (!entry) return Promise.reject(new AcpRuntimeUnavailable("\u8FD9\u4E2A\u7248\u672C\u7684\u8BBE\u5907\u4EE3\u7406\u6CA1\u6709\u9644\u5E26 Claude ACP \u9002\u914D\u5668"));
|
|
22176
|
-
const manifestPath = join11(
|
|
22230
|
+
const manifestPath = join11(dirname7(entry), "runtime.json");
|
|
22177
22231
|
let manifest;
|
|
22178
22232
|
try {
|
|
22179
22233
|
manifest = JSON.parse(readFileSync5(manifestPath, "utf8"));
|
|
@@ -22296,32 +22350,6 @@ var OMP_LAUNCH_SPEC = {
|
|
|
22296
22350
|
// Its CLI listing includes disabled models, and it cannot delete sessions: list in a disposable session folder.
|
|
22297
22351
|
modelDiscovery: { kind: "session", sessionFolderArgs: (folder) => ["--session-dir", folder] }
|
|
22298
22352
|
};
|
|
22299
|
-
function plainAcpRow(agent, args, rest = {}) {
|
|
22300
|
-
return { agent, headless: "acp", args: () => [...args], dialect: GENERIC_ACP_DIALECT, modelDiscovery: { kind: "session" }, ...rest };
|
|
22301
|
-
}
|
|
22302
|
-
var QWEN_LAUNCH_SPEC = {
|
|
22303
|
-
agent: "qwen",
|
|
22304
|
-
headless: "acp",
|
|
22305
|
-
args: ({ access }) => ["--acp", "--approval-mode", access === "bypassPermissions" ? "yolo" : "default"],
|
|
22306
|
-
dialect: GEMINI_ACP_DIALECT,
|
|
22307
|
-
modelDiscovery: { kind: "session" }
|
|
22308
|
-
};
|
|
22309
|
-
var KIMI_LAUNCH_SPEC = plainAcpRow("kimi", ["acp"], {
|
|
22310
|
-
dialect: { failureRules: [{ kind: "notSignedIn", pattern: /LLM not set|send "?\/login/i }] }
|
|
22311
|
-
});
|
|
22312
|
-
var QODER_LAUNCH_SPEC = plainAcpRow("qoder", ["--acp"]);
|
|
22313
|
-
var QODER_CN_LAUNCH_SPEC = plainAcpRow("qoder-cn", ["--acp"]);
|
|
22314
|
-
var CODEBUDDY_LAUNCH_SPEC = plainAcpRow("codebuddy", ["--acp"]);
|
|
22315
|
-
var TRAE_LAUNCH_SPEC = plainAcpRow("trae", ["acp", "serve"]);
|
|
22316
|
-
var MIMO_LAUNCH_SPEC = plainAcpRow("mimo", ["acp"], {
|
|
22317
|
-
env: { MIMOCODE_CLIENT: "acp", MIMOCODE_ENABLE_QUESTION_TOOL: "false" },
|
|
22318
|
-
dialect: OPENCODE_ACP_DIALECT
|
|
22319
|
-
});
|
|
22320
|
-
var DSH_LAUNCH_SPEC = plainAcpRow("dsh", ["--profile", "acp"], {
|
|
22321
|
-
// Sessions open without a key; the first prompt then fails naming DEEPSEEK_API_KEY.
|
|
22322
|
-
dialect: { failureRules: [{ kind: "notSignedIn", pattern: /no API key for provider route/i }] },
|
|
22323
|
-
modelDiscovery: { kind: "unavailable", reason: "DeepSeek Harness \u7684 ACP \u4E0D\u80FD\u5220\u9664\u4F1A\u8BDD\uFF0C\u4E0D\u8BFB\u53D6\u6A21\u578B\u5217\u8868" }
|
|
22324
|
-
});
|
|
22325
22353
|
function installedCli(spec) {
|
|
22326
22354
|
const override = process.env[spec.overrideEnv]?.trim();
|
|
22327
22355
|
const found = override || findCliCommand(cliCommand(spec), { pathEnv: providerEnvironment().PATH ?? null });
|
|
@@ -22393,14 +22421,6 @@ var ACP_LAUNCH_SPECS = [
|
|
|
22393
22421
|
GROK_LAUNCH_SPEC,
|
|
22394
22422
|
OPENCODE_LAUNCH_SPEC,
|
|
22395
22423
|
OMP_LAUNCH_SPEC,
|
|
22396
|
-
QWEN_LAUNCH_SPEC,
|
|
22397
|
-
KIMI_LAUNCH_SPEC,
|
|
22398
|
-
QODER_LAUNCH_SPEC,
|
|
22399
|
-
QODER_CN_LAUNCH_SPEC,
|
|
22400
|
-
CODEBUDDY_LAUNCH_SPEC,
|
|
22401
|
-
TRAE_LAUNCH_SPEC,
|
|
22402
|
-
MIMO_LAUNCH_SPEC,
|
|
22403
|
-
DSH_LAUNCH_SPEC,
|
|
22404
22424
|
CLAUDE_LAUNCH_SPEC,
|
|
22405
22425
|
CODEX_LAUNCH_SPEC
|
|
22406
22426
|
];
|
|
@@ -23065,7 +23085,7 @@ async function readSessionModels(row, clientVersion = "1") {
|
|
|
23065
23085
|
stderr: () => void 0
|
|
23066
23086
|
}, clientVersion);
|
|
23067
23087
|
try {
|
|
23068
|
-
if (!connection.deleteSession && !folderArgs.length) throw new Error(`${cli.label} \u4E0D\u80FD\u5220\u9664\u4F1A\u8BDD\uFF0C\
|
|
23088
|
+
if (!connection.deleteSession && !folderArgs.length) throw new Error(`${cli.label} \u4E0D\u80FD\u5220\u9664\u4F1A\u8BDD\uFF0C\u53EA\u80FD\u5728\u804A\u5929\u4E2D\u8BFB\u53D6\u6A21\u578B\u5217\u8868`);
|
|
23069
23089
|
const state = await connection.newSession(folder);
|
|
23070
23090
|
if (connection.deleteSession) await connection.removeSession(state.sessionId).catch(() => void 0);
|
|
23071
23091
|
const listed = sessionModels(state, row.dialect);
|
|
@@ -23683,7 +23703,7 @@ function isWriterConflict(message) {
|
|
|
23683
23703
|
}
|
|
23684
23704
|
|
|
23685
23705
|
// src/providers/cli/claude.ts
|
|
23686
|
-
import { readdirSync as
|
|
23706
|
+
import { readdirSync as readdirSync3, readFileSync as readFileSync6 } from "node:fs";
|
|
23687
23707
|
import { homedir as homedir8 } from "node:os";
|
|
23688
23708
|
import { join as join14 } from "node:path";
|
|
23689
23709
|
var CLAUDE = requireCliSpec("claude");
|
|
@@ -23700,13 +23720,13 @@ function claudeTranscriptPath(sessionId) {
|
|
|
23700
23720
|
for (const root2 of claudeProjectRoots()) {
|
|
23701
23721
|
let projects;
|
|
23702
23722
|
try {
|
|
23703
|
-
projects =
|
|
23723
|
+
projects = readdirSync3(root2);
|
|
23704
23724
|
} catch {
|
|
23705
23725
|
continue;
|
|
23706
23726
|
}
|
|
23707
23727
|
for (const project of projects) {
|
|
23708
23728
|
try {
|
|
23709
|
-
if (
|
|
23729
|
+
if (readdirSync3(join14(root2, project)).includes(file2)) return join14(root2, project, file2);
|
|
23710
23730
|
} catch {
|
|
23711
23731
|
}
|
|
23712
23732
|
}
|
|
@@ -24835,7 +24855,7 @@ function resolveDetectedProviderCommands(foundCommands, commands = DETECTION_COM
|
|
|
24835
24855
|
function probeVersion(path, args) {
|
|
24836
24856
|
if (args.length === 0) return Promise.resolve({});
|
|
24837
24857
|
return new Promise((resolve9) => {
|
|
24838
|
-
const launch = directLaunch2(path, args);
|
|
24858
|
+
const launch = directLaunch2(path, args, process.env.TOC_OCRA_NODE_PATH || process.execPath);
|
|
24839
24859
|
const child = spawn9(launch.executable, launch.args, { stdio: ["ignore", "pipe", "pipe"], shell: false, windowsHide: true });
|
|
24840
24860
|
let stdout = "";
|
|
24841
24861
|
let stderr = "";
|
|
@@ -24884,13 +24904,15 @@ var CliDetectionService = class {
|
|
|
24884
24904
|
const foundCommands = new Set(commands.filter((command) => resolved.get(command)?.found));
|
|
24885
24905
|
const detected = resolveDetectedProviderCommands(foundCommands, DETECTION_COMMANDS);
|
|
24886
24906
|
const providers2 = await Promise.all(CLI_CATALOG.map(async (config2) => {
|
|
24887
|
-
const
|
|
24888
|
-
const
|
|
24907
|
+
const override = process.env[config2.overrideEnv]?.trim();
|
|
24908
|
+
const unsupported = config2.detectUnsupportedRuntimes?.includes(process.platform) ?? false;
|
|
24909
|
+
const requiredPresent = (config2.detectRequiredCommands ?? []).every((command) => foundCommands.has(command));
|
|
24910
|
+
const matchedDetectionCommand = unsupported || !requiredPresent ? void 0 : override ? config2.detectCmd : detected.get(config2.id);
|
|
24911
|
+
const result = matchedDetectionCommand ? override ? resolveCliCommandDetailed(override) : resolved.get(matchedDetectionCommand) : void 0;
|
|
24889
24912
|
const executablePath = result?.found ? result.path : void 0;
|
|
24890
24913
|
const installed = Boolean(executablePath);
|
|
24891
|
-
const unsupported = config2.detectUnsupportedRuntimes?.includes(process.platform) ?? false;
|
|
24892
24914
|
const diagnostic = executablePath ? await probeVersion(executablePath, config2.versionArguments ?? []) : {};
|
|
24893
|
-
const detail = installed ? diagnostic.detail : unsupported ? "unsupported runtime" :
|
|
24915
|
+
const detail = installed ? diagnostic.detail : unsupported ? "unsupported runtime" : !requiredPresent ? "command or required command not found" : override && !result?.found ? `${config2.overrideEnv} \u6307\u5411\u7684\u7A0B\u5E8F\u4E0D\u5B58\u5728\uFF1A${override}` : "command not found";
|
|
24894
24916
|
return {
|
|
24895
24917
|
id: config2.id,
|
|
24896
24918
|
installed,
|
|
@@ -25322,7 +25344,7 @@ async function controlTbSwitch(payload) {
|
|
|
25322
25344
|
|
|
25323
25345
|
// src/runs/orphan-registry.ts
|
|
25324
25346
|
import { mkdir as mkdir5, readFile as readFile7, rename as rename5, writeFile as writeFile5 } from "node:fs/promises";
|
|
25325
|
-
import { basename, dirname as
|
|
25347
|
+
import { basename, dirname as dirname8 } from "node:path";
|
|
25326
25348
|
var OrphanRegistry = class {
|
|
25327
25349
|
constructor(file2) {
|
|
25328
25350
|
this.file = file2;
|
|
@@ -25340,7 +25362,7 @@ var OrphanRegistry = class {
|
|
|
25340
25362
|
persist() {
|
|
25341
25363
|
const snapshot = JSON.stringify([...this.records.values()]);
|
|
25342
25364
|
this.writing = this.writing.then(async () => {
|
|
25343
|
-
await mkdir5(
|
|
25365
|
+
await mkdir5(dirname8(this.file), { recursive: true, mode: 448 });
|
|
25344
25366
|
const temporary = `${this.file}.${process.pid}.tmp`;
|
|
25345
25367
|
await writeFile5(temporary, snapshot, { mode: 384 });
|
|
25346
25368
|
await rename5(temporary, this.file);
|
|
@@ -28494,7 +28516,7 @@ var GatewayClient = class {
|
|
|
28494
28516
|
// src/workspace/directory-browser.ts
|
|
28495
28517
|
import { readdir as readdir3, realpath as realpath3, stat as stat7 } from "node:fs/promises";
|
|
28496
28518
|
import { homedir as homedir11 } from "node:os";
|
|
28497
|
-
import { dirname as
|
|
28519
|
+
import { dirname as dirname9, parse as parse3, resolve as resolve6 } from "node:path";
|
|
28498
28520
|
var MAX_ENTRIES = 1e3;
|
|
28499
28521
|
async function listDirectory(requested, allowedRoots) {
|
|
28500
28522
|
const raw = requested.trim().replace(/^~(?=$|[\\/])/, homedir11()) || homedir11();
|
|
@@ -28514,7 +28536,7 @@ async function listDirectory(requested, allowedRoots) {
|
|
|
28514
28536
|
if (entry.isDirectory()) directories.push(item);
|
|
28515
28537
|
else if (entry.isFile()) files.push(item);
|
|
28516
28538
|
}
|
|
28517
|
-
const parent =
|
|
28539
|
+
const parent = dirname9(directory);
|
|
28518
28540
|
const places = [{ label: "\u4E3B\u76EE\u5F55", path: homedir11() }];
|
|
28519
28541
|
for (const root2 of allowedRoots) if (root2 !== homedir11()) places.push({ label: "\u5141\u8BB8\u7684\u76EE\u5F55", path: root2 });
|
|
28520
28542
|
places.push({ label: "\u6839\u76EE\u5F55", path: process.platform === "win32" ? parse3(directory).root : "/" });
|
|
@@ -29677,7 +29699,9 @@ var AgentService = class {
|
|
|
29677
29699
|
await this.stop();
|
|
29678
29700
|
throw error62;
|
|
29679
29701
|
}
|
|
29680
|
-
} else process.stdout.write(
|
|
29702
|
+
} else process.stdout.write(`\u672C\u673A\u5C1A\u672A\u7ED1\u5B9A\u670D\u52A1\u5668\uFF0C\u8BF7\u5728\u300C\u8BBE\u5907\u4EE3\u7406\u300D\u63D2\u4EF6\u4E2D\u5B8C\u6210\u7ED1\u5B9A\uFF0C\u6216\u8FD0\u884C toc-ocra setup --server <\u670D\u52A1\u5668\u5730\u5740>
|
|
29703
|
+
\u5F53\u524D\u914D\u7F6E\uFF1A${this.config.configPath}
|
|
29704
|
+
`);
|
|
29681
29705
|
}
|
|
29682
29706
|
stop() {
|
|
29683
29707
|
return this.stopPromise ??= (async () => {
|
|
@@ -29747,7 +29771,9 @@ var AgentService = class {
|
|
|
29747
29771
|
id: provider.id,
|
|
29748
29772
|
installed: provider.installed,
|
|
29749
29773
|
runnable: provider.available,
|
|
29750
|
-
version: provider.version ?? ""
|
|
29774
|
+
version: provider.version ?? "",
|
|
29775
|
+
path: provider.resolvedPath ?? "",
|
|
29776
|
+
detail: provider.detail ?? ""
|
|
29751
29777
|
}))
|
|
29752
29778
|
};
|
|
29753
29779
|
}
|
|
@@ -29817,11 +29843,11 @@ function errorMessage3(error62) {
|
|
|
29817
29843
|
|
|
29818
29844
|
// src/runtime/run-service.ts
|
|
29819
29845
|
import { existsSync as existsSync6, readFileSync as readFileSync7 } from "node:fs";
|
|
29820
|
-
import { dirname as
|
|
29846
|
+
import { dirname as dirname10, resolve as resolve8 } from "node:path";
|
|
29821
29847
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
29822
29848
|
var PACKAGE_NAME = "toc-ocra";
|
|
29823
29849
|
function agentPackageRoot() {
|
|
29824
|
-
let directory =
|
|
29850
|
+
let directory = dirname10(fileURLToPath2(import.meta.url));
|
|
29825
29851
|
while (true) {
|
|
29826
29852
|
const packagePath = resolve8(directory, "package.json");
|
|
29827
29853
|
if (existsSync6(packagePath)) {
|
|
@@ -29831,7 +29857,7 @@ function agentPackageRoot() {
|
|
|
29831
29857
|
} catch {
|
|
29832
29858
|
}
|
|
29833
29859
|
}
|
|
29834
|
-
const parent =
|
|
29860
|
+
const parent = dirname10(directory);
|
|
29835
29861
|
if (parent === directory) return void 0;
|
|
29836
29862
|
directory = parent;
|
|
29837
29863
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ModelSource } from '../providers/model-catalog.js';
|
|
2
2
|
import { type AgentAccess, type RunSettingsSupport } from '../providers/provider.js';
|
|
3
3
|
import type { AgentLaunch } from './agent-process.js';
|
|
4
|
-
import {
|
|
4
|
+
import type { AcpDialect } from './acp-dialects/acp-dialect.js';
|
|
5
5
|
import type { AcpAuthMethodPicker } from './acp-session-setup.js';
|
|
6
6
|
import type { TurnAccess } from './chat-agents.js';
|
|
7
7
|
/**
|
|
@@ -5,7 +5,6 @@ import { codexCatalogOverlay, prepareCodexCatalog } from '../providers/cli/codex
|
|
|
5
5
|
import { MODEL_SOURCES } from '../providers/model-catalog.js';
|
|
6
6
|
import { providerEnvironment } from '../providers/provider.js';
|
|
7
7
|
import { findCliCommand } from '../shared/node-cli-command-resolution.js';
|
|
8
|
-
import { GENERIC_ACP_DIALECT } from './acp-dialects/acp-dialect.js';
|
|
9
8
|
import { GEMINI_ACP_DIALECT } from './acp-dialects/gemini-dialect.js';
|
|
10
9
|
import { GROK_ACP_DIALECT } from './acp-dialects/grok-dialect.js';
|
|
11
10
|
import { KIRO_ACP_DIALECT } from './acp-dialects/kiro-dialect.js';
|
|
@@ -76,74 +75,6 @@ const OMP_LAUNCH_SPEC = {
|
|
|
76
75
|
// Its CLI listing includes disabled models, and it cannot delete sessions: list in a disposable session folder.
|
|
77
76
|
modelDiscovery: { kind: 'session', sessionFolderArgs: (folder) => ['--session-dir', folder] }
|
|
78
77
|
};
|
|
79
|
-
/*
|
|
80
|
-
* Chinese coding CLIs. Each serves ACP itself; the commands are the vendors'
|
|
81
|
-
* documented ACP launches (and acpx's agent registry). None of them is set up
|
|
82
|
-
* with a bypass flag or agent-enforced modes: their mode ids are not
|
|
83
|
-
* documented, so the shared driver enforces every level by answering the
|
|
84
|
-
* permission requests (full access approves them one by one). Models are set
|
|
85
|
-
* over ACP and listed from a disposable session, which the probe opens only
|
|
86
|
-
* when the agent can delete it.
|
|
87
|
-
*/
|
|
88
|
-
/**
|
|
89
|
-
* A row for a CLI that follows plain ACP: fixed arguments, the generic dialect
|
|
90
|
-
* and session model discovery unless `rest` says otherwise.
|
|
91
|
-
*/
|
|
92
|
-
function plainAcpRow(agent, args, rest = {}) {
|
|
93
|
-
return { agent, headless: 'acp', args: () => [...args], dialect: GENERIC_ACP_DIALECT, modelDiscovery: { kind: 'session' }, ...rest };
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Qwen Code (Alibaba), a Gemini CLI fork: `qwen --acp`. Its default is the
|
|
97
|
-
* classifier-driven Auto mode, so the turn pins `default` (asks before every
|
|
98
|
-
* edit and command) or `yolo` for full access. The model goes over ACP: its
|
|
99
|
-
* listed ids are what `session/set_model` takes.
|
|
100
|
-
*/
|
|
101
|
-
const QWEN_LAUNCH_SPEC = {
|
|
102
|
-
agent: 'qwen',
|
|
103
|
-
headless: 'acp',
|
|
104
|
-
args: ({ access }) => ['--acp', '--approval-mode', access === 'bypassPermissions' ? 'yolo' : 'default'],
|
|
105
|
-
dialect: GEMINI_ACP_DIALECT,
|
|
106
|
-
modelDiscovery: { kind: 'session' }
|
|
107
|
-
};
|
|
108
|
-
/**
|
|
109
|
-
* Kimi Code (Moonshot): `kimi acp`. Its only sign-in is a terminal device-code
|
|
110
|
-
* login (`kimi login`), so it is never started from here; older releases say
|
|
111
|
-
* `LLM not set` until then.
|
|
112
|
-
*/
|
|
113
|
-
const KIMI_LAUNCH_SPEC = plainAcpRow('kimi', ['acp'], {
|
|
114
|
-
dialect: { failureRules: [{ kind: 'notSignedIn', pattern: /LLM not set|send "?\/login/i }] }
|
|
115
|
-
});
|
|
116
|
-
/**
|
|
117
|
-
* Qoder CLI: `qodercli --acp`; signs in from a terminal login or
|
|
118
|
-
* `QODER_PERSONAL_ACCESS_TOKEN`. Its advertised `qodercli-login` method is
|
|
119
|
-
* never picked: signed out, `authenticate` with it does not return (1.1.81).
|
|
120
|
-
*/
|
|
121
|
-
const QODER_LAUNCH_SPEC = plainAcpRow('qoder', ['--acp']);
|
|
122
|
-
/** Qoder CN CLI (Alibaba Cloud): the China build of Qoder CLI, launched the same way (`qoderclicn-login` likewise). */
|
|
123
|
-
const QODER_CN_LAUNCH_SPEC = plainAcpRow('qoder-cn', ['--acp']);
|
|
124
|
-
/** CodeBuddy Code (Tencent): `codebuddy --acp`; `CODEBUDDY_API_KEY` with `CODEBUDDY_INTERNET_ENVIRONMENT=internal` for the China edition. */
|
|
125
|
-
const CODEBUDDY_LAUNCH_SPEC = plainAcpRow('codebuddy', ['--acp']);
|
|
126
|
-
/** TRAE CLI (TRAE CN, ByteDance): `traecli acp serve`. */
|
|
127
|
-
const TRAE_LAUNCH_SPEC = plainAcpRow('trae', ['acp', 'serve']);
|
|
128
|
-
/**
|
|
129
|
-
* MiMo Code (Xiaomi), an OpenCode derivative: `mimo acp`, OpenCode's tool
|
|
130
|
-
* output shapes and the same environment as the OpenCode row under MiMo's
|
|
131
|
-
* `MIMOCODE_` names.
|
|
132
|
-
*/
|
|
133
|
-
const MIMO_LAUNCH_SPEC = plainAcpRow('mimo', ['acp'], {
|
|
134
|
-
env: { MIMOCODE_CLIENT: 'acp', MIMOCODE_ENABLE_QUESTION_TOOL: 'false' },
|
|
135
|
-
dialect: OPENCODE_ACP_DIALECT
|
|
136
|
-
});
|
|
137
|
-
/**
|
|
138
|
-
* DeepSeek Harness: `dsh --profile acp`, the automation profile (model and
|
|
139
|
-
* reasoning_effort config options, session/list, resume and close). It cannot
|
|
140
|
-
* delete sessions, so the model list is not probed.
|
|
141
|
-
*/
|
|
142
|
-
const DSH_LAUNCH_SPEC = plainAcpRow('dsh', ['--profile', 'acp'], {
|
|
143
|
-
// Sessions open without a key; the first prompt then fails naming DEEPSEEK_API_KEY.
|
|
144
|
-
dialect: { failureRules: [{ kind: 'notSignedIn', pattern: /no API key for provider route/i }] },
|
|
145
|
-
modelDiscovery: { kind: 'unavailable', reason: 'DeepSeek Harness 的 ACP 不能删除会话,不读取模型列表' }
|
|
146
|
-
});
|
|
147
78
|
/** The installed CLI's executable, for adapters that drive it. */
|
|
148
79
|
function installedCli(spec) {
|
|
149
80
|
const override = process.env[spec.overrideEnv]?.trim();
|
|
@@ -225,14 +156,6 @@ export const ACP_LAUNCH_SPECS = [
|
|
|
225
156
|
GROK_LAUNCH_SPEC,
|
|
226
157
|
OPENCODE_LAUNCH_SPEC,
|
|
227
158
|
OMP_LAUNCH_SPEC,
|
|
228
|
-
QWEN_LAUNCH_SPEC,
|
|
229
|
-
KIMI_LAUNCH_SPEC,
|
|
230
|
-
QODER_LAUNCH_SPEC,
|
|
231
|
-
QODER_CN_LAUNCH_SPEC,
|
|
232
|
-
CODEBUDDY_LAUNCH_SPEC,
|
|
233
|
-
TRAE_LAUNCH_SPEC,
|
|
234
|
-
MIMO_LAUNCH_SPEC,
|
|
235
|
-
DSH_LAUNCH_SPEC,
|
|
236
159
|
CLAUDE_LAUNCH_SPEC,
|
|
237
160
|
CODEX_LAUNCH_SPEC
|
|
238
161
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acp-launch-specs.js","sourceRoot":"","sources":["../../../src/acp/acp-launch-specs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC,OAAO,EAAE,UAAU,EAAE,cAAc,EAAgB,MAAM,2BAA2B,CAAA;AACpF,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAA;AAC5F,OAAO,EAAE,aAAa,EAAoB,MAAM,+BAA+B,CAAA;AAC/E,OAAO,EAAE,mBAAmB,EAA6C,MAAM,0BAA0B,CAAA;AACzG,OAAO,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAA;
|
|
1
|
+
{"version":3,"file":"acp-launch-specs.js","sourceRoot":"","sources":["../../../src/acp/acp-launch-specs.ts"],"names":[],"mappings":"AAAA,OAA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GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC;QACzE,MAAM,IAAI,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAA;QACrD,IAAI,IAAI;YAAE,OAAO,IAAI,CAAA;IACvB,CAAC;IACD,OAAO,CAAC,CAAA;AACV,CAAC;AAED,sFAAsF;AACtF,MAAM,UAAU,aAAa,CAAC,IAAwB;IACpD,OAAO,IAAI,CAAC,CAAC,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;AAC3D,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAA4C,EAAE,eAAmC;IACnH,MAAM,OAAO,GAAG,aAAa,CAAC,eAAe,CAAC,CAAA;IAC9C,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,MAAM,IAAI,CAAC,OAAO;QAAE,OAAO,IAAI,CAAA;IAC1D,MAAM,OAAO,GAAG,iBAAiB,CAAC,OAAO,EAAE,IAAI,CAAC,eAAe,CAAC,CAAA;IAChE,OAAO,CAAC,OAAO,IAAI,eAAe,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,CAAA;AAC3D,CAAC"}
|
|
@@ -41,7 +41,7 @@ export async function readSessionModels(row, clientVersion = '1') {
|
|
|
41
41
|
try {
|
|
42
42
|
// Without deletion or a disposable folder every listing would leave a conversation behind.
|
|
43
43
|
if (!connection.deleteSession && !folderArgs.length)
|
|
44
|
-
throw new Error(`${cli.label}
|
|
44
|
+
throw new Error(`${cli.label} 不能删除会话,只能在聊天中读取模型列表`);
|
|
45
45
|
const state = await connection.newSession(folder);
|
|
46
46
|
if (connection.deleteSession)
|
|
47
47
|
await connection.removeSession(state.sessionId).catch(() => undefined);
|