@codexhost/cli-win32-arm64 0.11.0 → 0.12.0
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 +1 -1
- package/app/codexhost-distribution.json +1 -1
- package/app/console-server.mjs +44 -2
- package/app/console-web.js +2216 -492
- package/app/desktop-controller.mjs +391 -189
- package/app/host-runtime.mjs +3917 -625
- package/app/plugins/antigravity/plugin.mjs +15634 -15526
- package/app/plugins/claude-code/plugin.mjs +215 -70
- package/app/plugins/codebuddy/plugin.mjs +1260 -827
- package/app/plugins/cursor-cli/plugin.mjs +529 -370
- package/app/plugins/deepseek-harness/plugin.mjs +25467 -26242
- package/app/plugins/enabled.json +2 -1
- package/app/plugins/grok/plugin.mjs +936 -505
- package/app/plugins/hermes/plugin.mjs +18659 -23012
- package/app/plugins/kimi-code/plugin.mjs +1046 -703
- package/app/plugins/kiro-cli/plugin.mjs +959 -590
- package/app/plugins/omp/plugin.mjs +1038 -576
- package/app/plugins/opencode/plugin.mjs +961 -700
- package/app/plugins/pi/plugin.mjs +15911 -15724
- package/app/plugins/qoder/plugin.mjs +679 -375
- package/app/plugins/qoder-cn/plugin.mjs +345 -39
- package/app/plugins/workbuddy/plugin.mjs +417 -40
- package/app/plugins/zcode/assets/icon.svg +8 -0
- package/app/plugins/zcode/manifest.json +14 -0
- package/app/plugins/zcode/plugin.mjs +19202 -0
- package/app/renderer-extension.js +2495 -486
- package/bin/codexhost.exe +0 -0
- package/libexec/codexhost-node-repl.exe +0 -0
- package/libexec/codexhost-shim.exe +0 -0
- package/libexec/codexhost-updater.exe +0 -0
- package/package.json +1 -1
|
@@ -3229,8 +3229,8 @@ var require_utils = __commonJS({
|
|
|
3229
3229
|
}
|
|
3230
3230
|
return ind;
|
|
3231
3231
|
}
|
|
3232
|
-
function removeDotSegments(
|
|
3233
|
-
let input =
|
|
3232
|
+
function removeDotSegments(path7) {
|
|
3233
|
+
let input = path7;
|
|
3234
3234
|
const output = [];
|
|
3235
3235
|
let nextSlash = -1;
|
|
3236
3236
|
let len = 0;
|
|
@@ -3482,8 +3482,8 @@ var require_schemes = __commonJS({
|
|
|
3482
3482
|
wsComponent.secure = void 0;
|
|
3483
3483
|
}
|
|
3484
3484
|
if (wsComponent.resourceName) {
|
|
3485
|
-
const [
|
|
3486
|
-
wsComponent.path =
|
|
3485
|
+
const [path7, query] = wsComponent.resourceName.split("?");
|
|
3486
|
+
wsComponent.path = path7 && path7 !== "/" ? path7 : void 0;
|
|
3487
3487
|
wsComponent.query = query;
|
|
3488
3488
|
wsComponent.resourceName = void 0;
|
|
3489
3489
|
}
|
|
@@ -12592,7 +12592,7 @@ var require_dist = __commonJS({
|
|
|
12592
12592
|
|
|
12593
12593
|
// ../qoder/dist/qoder-adapter.js
|
|
12594
12594
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
12595
|
-
import
|
|
12595
|
+
import path6 from "node:path";
|
|
12596
12596
|
|
|
12597
12597
|
// ../../../node_modules/zod/v4/classic/external.js
|
|
12598
12598
|
var external_exports = {};
|
|
@@ -13360,10 +13360,10 @@ function mergeDefs(...defs) {
|
|
|
13360
13360
|
function cloneDef(schema) {
|
|
13361
13361
|
return mergeDefs(schema._zod.def);
|
|
13362
13362
|
}
|
|
13363
|
-
function getElementAtPath(obj,
|
|
13364
|
-
if (!
|
|
13363
|
+
function getElementAtPath(obj, path7) {
|
|
13364
|
+
if (!path7)
|
|
13365
13365
|
return obj;
|
|
13366
|
-
return
|
|
13366
|
+
return path7.reduce((acc, key) => acc?.[key], obj);
|
|
13367
13367
|
}
|
|
13368
13368
|
function promiseAllObject(promisesObj) {
|
|
13369
13369
|
const keys = Object.keys(promisesObj);
|
|
@@ -13772,11 +13772,11 @@ function explicitlyAborted(x3, startIndex = 0) {
|
|
|
13772
13772
|
}
|
|
13773
13773
|
return false;
|
|
13774
13774
|
}
|
|
13775
|
-
function prefixIssues(
|
|
13775
|
+
function prefixIssues(path7, issues) {
|
|
13776
13776
|
return issues.map((iss) => {
|
|
13777
13777
|
var _a5;
|
|
13778
13778
|
(_a5 = iss).path ?? (_a5.path = []);
|
|
13779
|
-
iss.path.unshift(
|
|
13779
|
+
iss.path.unshift(path7);
|
|
13780
13780
|
return iss;
|
|
13781
13781
|
});
|
|
13782
13782
|
}
|
|
@@ -13923,16 +13923,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
|
|
|
13923
13923
|
}
|
|
13924
13924
|
function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
13925
13925
|
const fieldErrors = { _errors: [] };
|
|
13926
|
-
const processError = (error52,
|
|
13926
|
+
const processError = (error52, path7 = []) => {
|
|
13927
13927
|
for (const issue2 of error52.issues) {
|
|
13928
13928
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
13929
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
13929
|
+
issue2.errors.map((issues) => processError({ issues }, [...path7, ...issue2.path]));
|
|
13930
13930
|
} else if (issue2.code === "invalid_key") {
|
|
13931
|
-
processError({ issues: issue2.issues }, [...
|
|
13931
|
+
processError({ issues: issue2.issues }, [...path7, ...issue2.path]);
|
|
13932
13932
|
} else if (issue2.code === "invalid_element") {
|
|
13933
|
-
processError({ issues: issue2.issues }, [...
|
|
13933
|
+
processError({ issues: issue2.issues }, [...path7, ...issue2.path]);
|
|
13934
13934
|
} else {
|
|
13935
|
-
const fullpath = [...
|
|
13935
|
+
const fullpath = [...path7, ...issue2.path];
|
|
13936
13936
|
if (fullpath.length === 0) {
|
|
13937
13937
|
fieldErrors._errors.push(mapper(issue2));
|
|
13938
13938
|
} else {
|
|
@@ -13959,17 +13959,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
|
13959
13959
|
}
|
|
13960
13960
|
function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
13961
13961
|
const result = { errors: [] };
|
|
13962
|
-
const processError = (error52,
|
|
13962
|
+
const processError = (error52, path7 = []) => {
|
|
13963
13963
|
var _a5, _b;
|
|
13964
13964
|
for (const issue2 of error52.issues) {
|
|
13965
13965
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
13966
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
13966
|
+
issue2.errors.map((issues) => processError({ issues }, [...path7, ...issue2.path]));
|
|
13967
13967
|
} else if (issue2.code === "invalid_key") {
|
|
13968
|
-
processError({ issues: issue2.issues }, [...
|
|
13968
|
+
processError({ issues: issue2.issues }, [...path7, ...issue2.path]);
|
|
13969
13969
|
} else if (issue2.code === "invalid_element") {
|
|
13970
|
-
processError({ issues: issue2.issues }, [...
|
|
13970
|
+
processError({ issues: issue2.issues }, [...path7, ...issue2.path]);
|
|
13971
13971
|
} else {
|
|
13972
|
-
const fullpath = [...
|
|
13972
|
+
const fullpath = [...path7, ...issue2.path];
|
|
13973
13973
|
if (fullpath.length === 0) {
|
|
13974
13974
|
result.errors.push(mapper(issue2));
|
|
13975
13975
|
continue;
|
|
@@ -14001,8 +14001,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
|
14001
14001
|
}
|
|
14002
14002
|
function toDotPath(_path) {
|
|
14003
14003
|
const segs = [];
|
|
14004
|
-
const
|
|
14005
|
-
for (const seg of
|
|
14004
|
+
const path7 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
14005
|
+
for (const seg of path7) {
|
|
14006
14006
|
if (typeof seg === "number")
|
|
14007
14007
|
segs.push(`[${seg}]`);
|
|
14008
14008
|
else if (typeof seg === "symbol")
|
|
@@ -26694,13 +26694,13 @@ function resolveRef(ref, ctx) {
|
|
|
26694
26694
|
if (!ref.startsWith("#")) {
|
|
26695
26695
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
26696
26696
|
}
|
|
26697
|
-
const
|
|
26698
|
-
if (
|
|
26697
|
+
const path7 = ref.slice(1).split("/").filter(Boolean);
|
|
26698
|
+
if (path7.length === 0) {
|
|
26699
26699
|
return ctx.rootSchema;
|
|
26700
26700
|
}
|
|
26701
26701
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
26702
|
-
if (
|
|
26703
|
-
const key =
|
|
26702
|
+
if (path7[0] === defsKey) {
|
|
26703
|
+
const key = path7[1];
|
|
26704
26704
|
if (!key || !ctx.defs[key]) {
|
|
26705
26705
|
throw new Error(`Reference not found: ${ref}`);
|
|
26706
26706
|
}
|
|
@@ -27194,6 +27194,7 @@ var CONSOLE_HOST_METHODS = Object.freeze([
|
|
|
27194
27194
|
"codexhost/harness/display-settings/get",
|
|
27195
27195
|
"codexhost/harness/display-settings/set",
|
|
27196
27196
|
"codexhost/harness/inspect",
|
|
27197
|
+
"codexhost/harness/installation",
|
|
27197
27198
|
"codexhost/harness/launch-settings/get",
|
|
27198
27199
|
"codexhost/harness/launch-settings/set",
|
|
27199
27200
|
"codexhost/harness/web-ui/open",
|
|
@@ -27840,14 +27841,17 @@ var harnessLaunchSettingsSchema = external_exports.object({
|
|
|
27840
27841
|
// ../../shared-contracts/dist/harness-installation.js
|
|
27841
27842
|
var harnessInstallationParamsSchema = external_exports.object({
|
|
27842
27843
|
harnessId: harnessIdSchema,
|
|
27843
|
-
action: external_exports.enum(["check", "update"])
|
|
27844
|
+
action: external_exports.enum(["check", "update", "install"])
|
|
27844
27845
|
}).strict();
|
|
27845
27846
|
var harnessInstallationStateSchema = external_exports.object({
|
|
27846
27847
|
currentVersion: external_exports.string().min(1).max(128),
|
|
27847
27848
|
latestVersion: external_exports.string().min(1).max(128),
|
|
27848
27849
|
updateAvailable: external_exports.boolean(),
|
|
27849
27850
|
canUpdate: external_exports.boolean(),
|
|
27850
|
-
|
|
27851
|
+
// Adapter-owned diagnostic text; UI uses messageCode rather than displaying it verbatim.
|
|
27852
|
+
message: external_exports.string().max(2048).optional(),
|
|
27853
|
+
messageCode: external_exports.string().min(1).max(128).optional(),
|
|
27854
|
+
latestVersionKind: external_exports.enum(["unknown", "tracking-branch"]).optional()
|
|
27851
27855
|
}).strict();
|
|
27852
27856
|
|
|
27853
27857
|
// ../../shared-contracts/dist/codex-accounts.js
|
|
@@ -28149,6 +28153,38 @@ var updateStatusResultSchema = external_exports.strictObject({
|
|
|
28149
28153
|
status: updateStatusSchema.nullable()
|
|
28150
28154
|
});
|
|
28151
28155
|
|
|
28156
|
+
// ../../shared-contracts/dist/remote-runtime.js
|
|
28157
|
+
var remoteUpdatePhaseSchema = external_exports.enum([
|
|
28158
|
+
"idle",
|
|
28159
|
+
"installing",
|
|
28160
|
+
"restarting",
|
|
28161
|
+
"succeeded",
|
|
28162
|
+
"failed"
|
|
28163
|
+
]);
|
|
28164
|
+
var runtimeStatusSchema = external_exports.object({
|
|
28165
|
+
runningVersion: external_exports.string().nullable(),
|
|
28166
|
+
installedVersion: external_exports.string().nullable(),
|
|
28167
|
+
restartRequired: external_exports.boolean(),
|
|
28168
|
+
remote: external_exports.boolean(),
|
|
28169
|
+
updateSupported: external_exports.boolean(),
|
|
28170
|
+
update: external_exports.object({
|
|
28171
|
+
phase: remoteUpdatePhaseSchema,
|
|
28172
|
+
targetVersion: external_exports.string().nullable(),
|
|
28173
|
+
error: external_exports.string().nullable()
|
|
28174
|
+
})
|
|
28175
|
+
});
|
|
28176
|
+
var remoteUpdateParamsSchema = external_exports.object({
|
|
28177
|
+
version: external_exports.string().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/u)
|
|
28178
|
+
}).strict();
|
|
28179
|
+
var remoteSshSetupParamsSchema = external_exports.object({
|
|
28180
|
+
hostname: external_exports.string().min(1).max(1024).refine((value) => !value.startsWith("-") && !/\s/u.test(value)),
|
|
28181
|
+
port: external_exports.number().int().min(1).max(65535).nullable(),
|
|
28182
|
+
identity: external_exports.string().max(4096).nullable(),
|
|
28183
|
+
action: external_exports.enum(["inspect", "install", "update", "repair"]),
|
|
28184
|
+
version: external_exports.string().regex(/^\d+\.\d+\.\d+$/u).nullable()
|
|
28185
|
+
}).strict();
|
|
28186
|
+
var remoteSshSetupResultSchema = external_exports.object({ state: external_exports.enum(["installed", "not-installed"]) }).strict();
|
|
28187
|
+
|
|
28152
28188
|
// ../../shared-contracts/dist/index.js
|
|
28153
28189
|
var workspaceContractVersionSchema = external_exports.literal(WORKSPACE_CONTRACT_VERSION);
|
|
28154
28190
|
|
|
@@ -28488,6 +28524,75 @@ function createInstallationManager(options) {
|
|
|
28488
28524
|
return updating;
|
|
28489
28525
|
};
|
|
28490
28526
|
}
|
|
28527
|
+
async function fetchInstallationText(url2) {
|
|
28528
|
+
const request = async () => {
|
|
28529
|
+
const response = await fetch(url2, { signal: AbortSignal.timeout(15e3) });
|
|
28530
|
+
if (!response.ok)
|
|
28531
|
+
throw new Error("Could not check the latest Harness version");
|
|
28532
|
+
return response.text();
|
|
28533
|
+
};
|
|
28534
|
+
try {
|
|
28535
|
+
return await request();
|
|
28536
|
+
} catch (error51) {
|
|
28537
|
+
if (error51 instanceof DOMException && (error51.name === "AbortError" || error51.name === "TimeoutError"))
|
|
28538
|
+
throw error51;
|
|
28539
|
+
return request();
|
|
28540
|
+
}
|
|
28541
|
+
}
|
|
28542
|
+
|
|
28543
|
+
// ../../harness-discovery/dist/installer.js
|
|
28544
|
+
import { mkdtemp, rm, writeFile } from "node:fs/promises";
|
|
28545
|
+
import { tmpdir } from "node:os";
|
|
28546
|
+
import { join } from "node:path";
|
|
28547
|
+
function createHarnessInstaller(environment, source) {
|
|
28548
|
+
return async () => {
|
|
28549
|
+
if (!["darwin", "linux", "win32"].includes(process.platform))
|
|
28550
|
+
throw new Error("Unsupported installation platform");
|
|
28551
|
+
const env = withNodeRuntimeOnPath(environment);
|
|
28552
|
+
if ("npm" in source) {
|
|
28553
|
+
const npm = resolveHarnessExecutable({
|
|
28554
|
+
id: "npm",
|
|
28555
|
+
command: "npm",
|
|
28556
|
+
installRoots: {
|
|
28557
|
+
posix: [
|
|
28558
|
+
"~/.npm-global/bin",
|
|
28559
|
+
"~/.local/bin",
|
|
28560
|
+
VERSION_MANAGER_ROOTS,
|
|
28561
|
+
"/opt/homebrew/bin",
|
|
28562
|
+
"/usr/local/bin",
|
|
28563
|
+
"/usr/bin"
|
|
28564
|
+
],
|
|
28565
|
+
windows: [
|
|
28566
|
+
"${APPDATA}/npm",
|
|
28567
|
+
VERSION_MANAGER_ROOTS,
|
|
28568
|
+
"${ProgramFiles}/nodejs",
|
|
28569
|
+
"${LOCALAPPDATA}/Programs/nodejs"
|
|
28570
|
+
]
|
|
28571
|
+
}
|
|
28572
|
+
}, { environment: env });
|
|
28573
|
+
if (!npm)
|
|
28574
|
+
throw new Error("Install Node.js and npm first");
|
|
28575
|
+
await runInstallationCommand(npm.executable, ["install", "--global", source.npm], {
|
|
28576
|
+
...env,
|
|
28577
|
+
...source.allowScripts ? { npm_config_allow_scripts: source.allowScripts } : {}
|
|
28578
|
+
}, 6e5);
|
|
28579
|
+
return;
|
|
28580
|
+
}
|
|
28581
|
+
const windows = process.platform === "win32";
|
|
28582
|
+
const url2 = windows ? source.windows : source.posix;
|
|
28583
|
+
if (new URL(url2).protocol !== "https:")
|
|
28584
|
+
throw new Error("Installer requires HTTPS");
|
|
28585
|
+
const script = await fetchInstallationText(url2);
|
|
28586
|
+
const directory = await mkdtemp(join(tmpdir(), "codexhost-installer-"));
|
|
28587
|
+
try {
|
|
28588
|
+
const file2 = join(directory, windows ? "install.ps1" : "install.sh");
|
|
28589
|
+
await writeFile(file2, script, { mode: 384 });
|
|
28590
|
+
await runInstallationCommand(windows ? "powershell.exe" : source.shell ?? "bash", windows ? ["-NoProfile", "-NonInteractive", "-ExecutionPolicy", "Bypass", "-File", file2] : [file2], env, 6e5);
|
|
28591
|
+
} finally {
|
|
28592
|
+
await rm(directory, { recursive: true, force: true });
|
|
28593
|
+
}
|
|
28594
|
+
};
|
|
28595
|
+
}
|
|
28491
28596
|
|
|
28492
28597
|
// ../qoder/dist/qoder-command.js
|
|
28493
28598
|
var QoderExecutableError = class extends Error {
|
|
@@ -28745,6 +28850,26 @@ function mapQoderException(error51) {
|
|
|
28745
28850
|
};
|
|
28746
28851
|
}
|
|
28747
28852
|
|
|
28853
|
+
// ../qoder/dist/qoder-login-check.js
|
|
28854
|
+
import { execFile as execFile2 } from "node:child_process";
|
|
28855
|
+
function qoderLoginRequired(text) {
|
|
28856
|
+
return /\bnot logged in\b|\bauthentication (?:required|expired)\b/i.test(text);
|
|
28857
|
+
}
|
|
28858
|
+
function checkQoderLogin(executable, environment, cwd) {
|
|
28859
|
+
return new Promise((resolve) => {
|
|
28860
|
+
execFile2(executable, ["--list-models"], {
|
|
28861
|
+
env: environment,
|
|
28862
|
+
cwd,
|
|
28863
|
+
timeout: 1e4,
|
|
28864
|
+
maxBuffer: 64 * 1024,
|
|
28865
|
+
windowsHide: true
|
|
28866
|
+
}, (error51, stdout, stderr) => {
|
|
28867
|
+
resolve(Boolean(error51 && !error51.killed && qoderLoginRequired(`${stdout}
|
|
28868
|
+
${stderr}`)));
|
|
28869
|
+
});
|
|
28870
|
+
});
|
|
28871
|
+
}
|
|
28872
|
+
|
|
28748
28873
|
// ../../harness-adapter/dist/approval.js
|
|
28749
28874
|
function invalidRequest(message) {
|
|
28750
28875
|
return { code: "invalidRequest", message, retryable: false };
|
|
@@ -30096,8 +30221,8 @@ function getErrorMap2() {
|
|
|
30096
30221
|
|
|
30097
30222
|
// ../../../node_modules/zod/v3/helpers/parseUtil.js
|
|
30098
30223
|
var makeIssue = (params) => {
|
|
30099
|
-
const { data, path:
|
|
30100
|
-
const fullPath = [...
|
|
30224
|
+
const { data, path: path7, errorMaps, issueData } = params;
|
|
30225
|
+
const fullPath = [...path7, ...issueData.path || []];
|
|
30101
30226
|
const fullIssue = {
|
|
30102
30227
|
...issueData,
|
|
30103
30228
|
path: fullPath
|
|
@@ -30212,11 +30337,11 @@ var errorUtil;
|
|
|
30212
30337
|
|
|
30213
30338
|
// ../../../node_modules/zod/v3/types.js
|
|
30214
30339
|
var ParseInputLazyPath = class {
|
|
30215
|
-
constructor(parent, value,
|
|
30340
|
+
constructor(parent, value, path7, key) {
|
|
30216
30341
|
this._cachedPath = [];
|
|
30217
30342
|
this.parent = parent;
|
|
30218
30343
|
this.data = value;
|
|
30219
|
-
this._path =
|
|
30344
|
+
this._path = path7;
|
|
30220
30345
|
this._key = key;
|
|
30221
30346
|
}
|
|
30222
30347
|
get path() {
|
|
@@ -33743,11 +33868,11 @@ function normalizeObjectSchema(schema) {
|
|
|
33743
33868
|
}
|
|
33744
33869
|
return void 0;
|
|
33745
33870
|
}
|
|
33746
|
-
function getDotPath(
|
|
33747
|
-
if (
|
|
33871
|
+
function getDotPath(path7) {
|
|
33872
|
+
if (path7.length === 0) {
|
|
33748
33873
|
return "object root";
|
|
33749
33874
|
}
|
|
33750
|
-
return
|
|
33875
|
+
return path7.reduce((acc, seg, index) => {
|
|
33751
33876
|
if (index === 0) {
|
|
33752
33877
|
return String(seg);
|
|
33753
33878
|
}
|
|
@@ -52318,12 +52443,171 @@ var QoderSession = class {
|
|
|
52318
52443
|
}
|
|
52319
52444
|
};
|
|
52320
52445
|
|
|
52446
|
+
// ../qoder/dist/qoder-session-import.js
|
|
52447
|
+
import { stat } from "node:fs/promises";
|
|
52448
|
+
import path5 from "node:path";
|
|
52449
|
+
|
|
52450
|
+
// ../../harness-adapter/dist/session-import.js
|
|
52451
|
+
var STORAGE_ACCESS_ERRORS = /* @__PURE__ */ new Set(["EACCES", "EPERM", "EIO", "EMFILE", "ENFILE"]);
|
|
52452
|
+
function isStorageAccessError(error51) {
|
|
52453
|
+
return typeof error51 === "object" && error51 !== null && "code" in error51 && typeof error51.code === "string" && STORAGE_ACCESS_ERRORS.has(error51.code);
|
|
52454
|
+
}
|
|
52455
|
+
function sessionImportTitle(value, maxLength = HARNESS_SESSION_IMPORT_TITLE_MAX_LENGTH) {
|
|
52456
|
+
if (typeof value !== "string")
|
|
52457
|
+
return null;
|
|
52458
|
+
const normalized = value.replaceAll("\0", "").replaceAll(/\s+/gu, " ").trim();
|
|
52459
|
+
if (!normalized)
|
|
52460
|
+
return null;
|
|
52461
|
+
if (normalized.length <= maxLength)
|
|
52462
|
+
return normalized;
|
|
52463
|
+
const characters = [...normalized];
|
|
52464
|
+
if (characters.length <= maxLength)
|
|
52465
|
+
return normalized;
|
|
52466
|
+
return `${characters.slice(0, maxLength - 1).join("").trimEnd()}…`;
|
|
52467
|
+
}
|
|
52468
|
+
function sessionImportCandidate(input) {
|
|
52469
|
+
const time3 = typeof input.updatedAt === "number" ? input.updatedAt : typeof input.updatedAt === "string" ? Date.parse(input.updatedAt) : Number.NaN;
|
|
52470
|
+
const parsed = harnessSessionImportCandidateSchema.safeParse({
|
|
52471
|
+
nativeSessionId: input.nativeSessionId,
|
|
52472
|
+
cwd: input.cwd,
|
|
52473
|
+
title: typeof input.title === "string" && input.title.trim().length > 0 ? input.title : null,
|
|
52474
|
+
updatedAt: Math.floor(time3),
|
|
52475
|
+
// Unknown must stay unknown; only an explicit boolean is a native statement.
|
|
52476
|
+
running: typeof input.running === "boolean" ? input.running : null
|
|
52477
|
+
});
|
|
52478
|
+
return parsed.success ? parsed.data : null;
|
|
52479
|
+
}
|
|
52480
|
+
var SessionImportScope = class {
|
|
52481
|
+
#abort = new AbortController();
|
|
52482
|
+
#options;
|
|
52483
|
+
#pending = /* @__PURE__ */ new Set();
|
|
52484
|
+
constructor(options) {
|
|
52485
|
+
this.#options = options;
|
|
52486
|
+
}
|
|
52487
|
+
#closed() {
|
|
52488
|
+
return {
|
|
52489
|
+
ok: false,
|
|
52490
|
+
error: { code: "invalidState", message: this.#options.closedMessage, retryable: false }
|
|
52491
|
+
};
|
|
52492
|
+
}
|
|
52493
|
+
read(operation) {
|
|
52494
|
+
const signal = this.#abort.signal;
|
|
52495
|
+
if (signal.aborted)
|
|
52496
|
+
return Promise.resolve(this.#closed());
|
|
52497
|
+
let started;
|
|
52498
|
+
try {
|
|
52499
|
+
started = operation(signal);
|
|
52500
|
+
} catch (error51) {
|
|
52501
|
+
started = Promise.reject(error51 instanceof Error ? error51 : new Error("Session read failed"));
|
|
52502
|
+
}
|
|
52503
|
+
const request = started.then((value) => signal.aborted ? this.#closed() : { ok: true, value }).catch(() => signal.aborted ? this.#closed() : {
|
|
52504
|
+
ok: false,
|
|
52505
|
+
error: {
|
|
52506
|
+
code: "unavailable",
|
|
52507
|
+
message: this.#options.unavailableMessage,
|
|
52508
|
+
retryable: true
|
|
52509
|
+
}
|
|
52510
|
+
}).finally(() => this.#pending.delete(request));
|
|
52511
|
+
this.#pending.add(request);
|
|
52512
|
+
return request;
|
|
52513
|
+
}
|
|
52514
|
+
/** `read` for `resolveCandidate`: a null source is the selected Session having disappeared. */
|
|
52515
|
+
async resolve(operation) {
|
|
52516
|
+
const result = await this.read(operation);
|
|
52517
|
+
if (!result.ok)
|
|
52518
|
+
return result;
|
|
52519
|
+
return result.value ? { ok: true, value: result.value } : {
|
|
52520
|
+
ok: false,
|
|
52521
|
+
error: {
|
|
52522
|
+
code: "sessionNotFound",
|
|
52523
|
+
message: this.#options.notFoundMessage,
|
|
52524
|
+
retryable: false
|
|
52525
|
+
}
|
|
52526
|
+
};
|
|
52527
|
+
}
|
|
52528
|
+
/** Idempotent. Resolves after every started read has settled. */
|
|
52529
|
+
async close() {
|
|
52530
|
+
this.#abort.abort();
|
|
52531
|
+
await Promise.allSettled(this.#pending);
|
|
52532
|
+
}
|
|
52533
|
+
};
|
|
52534
|
+
|
|
52535
|
+
// ../qoder/dist/qoder-session-import.js
|
|
52536
|
+
var QoderSessionImport = class {
|
|
52537
|
+
#dependencies;
|
|
52538
|
+
#scope;
|
|
52539
|
+
constructor(dependencies) {
|
|
52540
|
+
this.#dependencies = dependencies;
|
|
52541
|
+
const name = dependencies.displayName;
|
|
52542
|
+
this.#scope = new SessionImportScope({
|
|
52543
|
+
closedMessage: `${name} Session import is closed`,
|
|
52544
|
+
unavailableMessage: `${name} sessions could not be read; check storage access and retry`,
|
|
52545
|
+
notFoundMessage: `${name} Session is no longer importable`
|
|
52546
|
+
});
|
|
52547
|
+
}
|
|
52548
|
+
listCandidates() {
|
|
52549
|
+
return this.#scope.read(async (signal) => {
|
|
52550
|
+
const candidates = /* @__PURE__ */ new Map();
|
|
52551
|
+
for (const info of await this.#dependencies.listSessions()) {
|
|
52552
|
+
signal.throwIfAborted();
|
|
52553
|
+
const candidate = await this.#candidate(info);
|
|
52554
|
+
if (candidate && !candidates.has(candidate.nativeSessionId))
|
|
52555
|
+
candidates.set(candidate.nativeSessionId, candidate);
|
|
52556
|
+
}
|
|
52557
|
+
return [...candidates.values()];
|
|
52558
|
+
});
|
|
52559
|
+
}
|
|
52560
|
+
resolveCandidate(nativeSessionId) {
|
|
52561
|
+
return this.#scope.resolve(async (signal) => {
|
|
52562
|
+
const info = await this.#dependencies.getSessionInfo(nativeSessionId);
|
|
52563
|
+
signal.throwIfAborted();
|
|
52564
|
+
if (info?.sessionId !== nativeSessionId)
|
|
52565
|
+
return null;
|
|
52566
|
+
const candidate = await this.#candidate(info);
|
|
52567
|
+
if (!candidate)
|
|
52568
|
+
return null;
|
|
52569
|
+
return {
|
|
52570
|
+
candidate,
|
|
52571
|
+
nativeRef: nativeSessionRefSchema.parse({
|
|
52572
|
+
harnessId: this.#dependencies.harnessId,
|
|
52573
|
+
nativeSessionId,
|
|
52574
|
+
formatVersion: 1
|
|
52575
|
+
})
|
|
52576
|
+
};
|
|
52577
|
+
});
|
|
52578
|
+
}
|
|
52579
|
+
close() {
|
|
52580
|
+
return this.#scope.close();
|
|
52581
|
+
}
|
|
52582
|
+
async #candidate(info) {
|
|
52583
|
+
if (typeof info.cwd !== "string" || !path5.isAbsolute(info.cwd))
|
|
52584
|
+
return null;
|
|
52585
|
+
const cwd = path5.resolve(info.cwd);
|
|
52586
|
+
try {
|
|
52587
|
+
if (!(await stat(cwd)).isDirectory())
|
|
52588
|
+
return null;
|
|
52589
|
+
} catch (error51) {
|
|
52590
|
+
if (isStorageAccessError(error51))
|
|
52591
|
+
throw error51;
|
|
52592
|
+
return null;
|
|
52593
|
+
}
|
|
52594
|
+
return sessionImportCandidate({
|
|
52595
|
+
nativeSessionId: info.sessionId,
|
|
52596
|
+
cwd,
|
|
52597
|
+
title: sessionImportTitle(info.customTitle) ?? sessionImportTitle(info.summary) ?? sessionImportTitle(info.firstPrompt),
|
|
52598
|
+
updatedAt: info.lastModified
|
|
52599
|
+
// The SDK exposes no cross-process activity marker: idleness cannot be established.
|
|
52600
|
+
});
|
|
52601
|
+
}
|
|
52602
|
+
};
|
|
52603
|
+
|
|
52321
52604
|
// ../qoder/dist/qoder-adapter.js
|
|
52322
52605
|
var QoderAdapter = class {
|
|
52323
52606
|
harnessId;
|
|
52324
52607
|
#variant;
|
|
52325
52608
|
commandCatalog = QODER_FALLBACK_COMMAND_CATALOG;
|
|
52326
52609
|
liveCommandCatalog = true;
|
|
52610
|
+
sessionImport;
|
|
52327
52611
|
#commandOverride;
|
|
52328
52612
|
#environment;
|
|
52329
52613
|
#platform;
|
|
@@ -52347,6 +52631,12 @@ var QoderAdapter = class {
|
|
|
52347
52631
|
this.#forkSession = options.forkSession ?? runtime.sdk.forkSession;
|
|
52348
52632
|
this.#getSessionMessages = options.getSessionMessages ?? runtime.sdk.getSessionMessages;
|
|
52349
52633
|
this.#getSessionInfo = options.getSessionInfo ?? runtime.sdk.getSessionInfo;
|
|
52634
|
+
this.sessionImport = new QoderSessionImport({
|
|
52635
|
+
harnessId: this.harnessId,
|
|
52636
|
+
displayName: this.#variant === "cn" ? "Qoder CN" : "Qoder",
|
|
52637
|
+
listSessions: options.listSessions ?? (() => runtime.sdk.listSessions()),
|
|
52638
|
+
getSessionInfo: this.#getSessionInfo
|
|
52639
|
+
});
|
|
52350
52640
|
this.#getAvailableModels = options.getAvailableModels;
|
|
52351
52641
|
this.#resolveExecutable = options.resolveExecutable ?? ((input, dependencies) => resolveQoderExecutable({ ...input, variant: this.#variant }, dependencies));
|
|
52352
52642
|
}
|
|
@@ -52411,11 +52701,15 @@ var QoderAdapter = class {
|
|
|
52411
52701
|
} catch {
|
|
52412
52702
|
}
|
|
52413
52703
|
} else {
|
|
52704
|
+
let stderr = "";
|
|
52414
52705
|
try {
|
|
52415
52706
|
const probeQuery = this.#queryFactory({
|
|
52416
52707
|
prompt: "",
|
|
52417
52708
|
options: {
|
|
52418
52709
|
cwd: input?.cwd ?? process.cwd(),
|
|
52710
|
+
stderr: (chunk) => {
|
|
52711
|
+
stderr = (stderr + chunk).slice(-8192);
|
|
52712
|
+
},
|
|
52419
52713
|
pathToQoderCLIExecutable: executable,
|
|
52420
52714
|
...this.#environment ? { env: this.#environment } : {},
|
|
52421
52715
|
auth: qoderAuthForEnvironment(this.#variant, this.#environment)
|
|
@@ -52432,9 +52726,14 @@ var QoderAdapter = class {
|
|
|
52432
52726
|
}
|
|
52433
52727
|
}
|
|
52434
52728
|
} catch (error51) {
|
|
52729
|
+
const needsLogin = qoderLoginRequired(stderr) || error51 instanceof Error && error51.message === "Transport closed" && qoderAuthForEnvironment(this.#variant, this.#environment).type === "qodercli" && await checkQoderLogin(executable, this.#environment, input?.cwd);
|
|
52435
52730
|
const result2 = {
|
|
52436
52731
|
status: "unavailable",
|
|
52437
|
-
error:
|
|
52732
|
+
error: needsLogin ? {
|
|
52733
|
+
code: "authenticationRequired",
|
|
52734
|
+
message: `Please run ${this.#variant === "cn" ? "qoderclicn" : "qodercli"} login to authenticate.`,
|
|
52735
|
+
retryable: false
|
|
52736
|
+
} : mapQoderException(error51)
|
|
52438
52737
|
};
|
|
52439
52738
|
return result2;
|
|
52440
52739
|
}
|
|
@@ -52556,7 +52855,7 @@ var QoderAdapter = class {
|
|
|
52556
52855
|
sourceInfo = await this.#getSessionInfo(sourceRef.data.nativeSessionId, { dir: input.cwd });
|
|
52557
52856
|
} catch {
|
|
52558
52857
|
}
|
|
52559
|
-
if (sourceInfo?.cwd &&
|
|
52858
|
+
if (sourceInfo?.cwd && path6.resolve(sourceInfo.cwd) !== path6.resolve(input.cwd)) {
|
|
52560
52859
|
return {
|
|
52561
52860
|
ok: false,
|
|
52562
52861
|
error: {
|
|
@@ -52706,7 +53005,7 @@ var QoderAdapter = class {
|
|
|
52706
53005
|
this.#sessions.clear();
|
|
52707
53006
|
this.#inspections.clear();
|
|
52708
53007
|
this.#inFlightInspections.clear();
|
|
52709
|
-
await Promise.all(sessions.map((s) => s.close()));
|
|
53008
|
+
await Promise.all([this.sessionImport.close(), ...sessions.map((s) => s.close())]);
|
|
52710
53009
|
}
|
|
52711
53010
|
};
|
|
52712
53011
|
|
|
@@ -52722,6 +53021,7 @@ function createQoderInstallation(environment, command, variant = "global") {
|
|
|
52722
53021
|
latestVersion: "Unknown",
|
|
52723
53022
|
updateAvailable: false,
|
|
52724
53023
|
canUpdate: false,
|
|
53024
|
+
messageCode: "qoder-check-unavailable",
|
|
52725
53025
|
message: "This Qoder China release does not expose a non-installing update check. Use its original installer."
|
|
52726
53026
|
};
|
|
52727
53027
|
const output = await run(["update", "--check"]);
|
|
@@ -52757,7 +53057,13 @@ function createHarnessAdapter(context, variant = "global") {
|
|
|
52757
53057
|
variant,
|
|
52758
53058
|
environment,
|
|
52759
53059
|
platform: context.platform
|
|
52760
|
-
}), {
|
|
53060
|
+
}), {
|
|
53061
|
+
installation: createQoderInstallation(environment, command, variant),
|
|
53062
|
+
install: createHarnessInstaller(environment, variant === "cn" ? {
|
|
53063
|
+
posix: "https://static.qoder.com.cn/qoder-cli-cn/install.sh",
|
|
53064
|
+
windows: "https://static.qoder.com.cn/qoder-cli-cn/install.ps1"
|
|
53065
|
+
} : { posix: "https://qoder.com/install", windows: "https://qoder.com/install.ps1" })
|
|
53066
|
+
});
|
|
52761
53067
|
}
|
|
52762
53068
|
|
|
52763
53069
|
// dist/plugin.js
|