@codexhost/cli-linux-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 +0 -0
- package/libexec/codexhost-shim +0 -0
- package/libexec/codexhost-updater +0 -0
- package/package.json +1 -1
|
@@ -776,10 +776,10 @@ function mergeDefs(...defs) {
|
|
|
776
776
|
function cloneDef(schema) {
|
|
777
777
|
return mergeDefs(schema._zod.def);
|
|
778
778
|
}
|
|
779
|
-
function getElementAtPath(obj,
|
|
780
|
-
if (!
|
|
779
|
+
function getElementAtPath(obj, path10) {
|
|
780
|
+
if (!path10)
|
|
781
781
|
return obj;
|
|
782
|
-
return
|
|
782
|
+
return path10.reduce((acc, key) => acc?.[key], obj);
|
|
783
783
|
}
|
|
784
784
|
function promiseAllObject(promisesObj) {
|
|
785
785
|
const keys = Object.keys(promisesObj);
|
|
@@ -1188,11 +1188,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
1188
1188
|
}
|
|
1189
1189
|
return false;
|
|
1190
1190
|
}
|
|
1191
|
-
function prefixIssues(
|
|
1191
|
+
function prefixIssues(path10, issues) {
|
|
1192
1192
|
return issues.map((iss) => {
|
|
1193
1193
|
var _a3;
|
|
1194
1194
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
1195
|
-
iss.path.unshift(
|
|
1195
|
+
iss.path.unshift(path10);
|
|
1196
1196
|
return iss;
|
|
1197
1197
|
});
|
|
1198
1198
|
}
|
|
@@ -1339,16 +1339,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
|
|
|
1339
1339
|
}
|
|
1340
1340
|
function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
1341
1341
|
const fieldErrors = { _errors: [] };
|
|
1342
|
-
const processError = (error52,
|
|
1342
|
+
const processError = (error52, path10 = []) => {
|
|
1343
1343
|
for (const issue2 of error52.issues) {
|
|
1344
1344
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
1345
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
1345
|
+
issue2.errors.map((issues) => processError({ issues }, [...path10, ...issue2.path]));
|
|
1346
1346
|
} else if (issue2.code === "invalid_key") {
|
|
1347
|
-
processError({ issues: issue2.issues }, [...
|
|
1347
|
+
processError({ issues: issue2.issues }, [...path10, ...issue2.path]);
|
|
1348
1348
|
} else if (issue2.code === "invalid_element") {
|
|
1349
|
-
processError({ issues: issue2.issues }, [...
|
|
1349
|
+
processError({ issues: issue2.issues }, [...path10, ...issue2.path]);
|
|
1350
1350
|
} else {
|
|
1351
|
-
const fullpath = [...
|
|
1351
|
+
const fullpath = [...path10, ...issue2.path];
|
|
1352
1352
|
if (fullpath.length === 0) {
|
|
1353
1353
|
fieldErrors._errors.push(mapper(issue2));
|
|
1354
1354
|
} else {
|
|
@@ -1375,17 +1375,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
|
1375
1375
|
}
|
|
1376
1376
|
function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
1377
1377
|
const result = { errors: [] };
|
|
1378
|
-
const processError = (error52,
|
|
1378
|
+
const processError = (error52, path10 = []) => {
|
|
1379
1379
|
var _a3, _b;
|
|
1380
1380
|
for (const issue2 of error52.issues) {
|
|
1381
1381
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
1382
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
1382
|
+
issue2.errors.map((issues) => processError({ issues }, [...path10, ...issue2.path]));
|
|
1383
1383
|
} else if (issue2.code === "invalid_key") {
|
|
1384
|
-
processError({ issues: issue2.issues }, [...
|
|
1384
|
+
processError({ issues: issue2.issues }, [...path10, ...issue2.path]);
|
|
1385
1385
|
} else if (issue2.code === "invalid_element") {
|
|
1386
|
-
processError({ issues: issue2.issues }, [...
|
|
1386
|
+
processError({ issues: issue2.issues }, [...path10, ...issue2.path]);
|
|
1387
1387
|
} else {
|
|
1388
|
-
const fullpath = [...
|
|
1388
|
+
const fullpath = [...path10, ...issue2.path];
|
|
1389
1389
|
if (fullpath.length === 0) {
|
|
1390
1390
|
result.errors.push(mapper(issue2));
|
|
1391
1391
|
continue;
|
|
@@ -1417,8 +1417,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
|
1417
1417
|
}
|
|
1418
1418
|
function toDotPath(_path) {
|
|
1419
1419
|
const segs = [];
|
|
1420
|
-
const
|
|
1421
|
-
for (const seg of
|
|
1420
|
+
const path10 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
1421
|
+
for (const seg of path10) {
|
|
1422
1422
|
if (typeof seg === "number")
|
|
1423
1423
|
segs.push(`[${seg}]`);
|
|
1424
1424
|
else if (typeof seg === "symbol")
|
|
@@ -14110,13 +14110,13 @@ function resolveRef(ref, ctx) {
|
|
|
14110
14110
|
if (!ref.startsWith("#")) {
|
|
14111
14111
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
14112
14112
|
}
|
|
14113
|
-
const
|
|
14114
|
-
if (
|
|
14113
|
+
const path10 = ref.slice(1).split("/").filter(Boolean);
|
|
14114
|
+
if (path10.length === 0) {
|
|
14115
14115
|
return ctx.rootSchema;
|
|
14116
14116
|
}
|
|
14117
14117
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
14118
|
-
if (
|
|
14119
|
-
const key =
|
|
14118
|
+
if (path10[0] === defsKey) {
|
|
14119
|
+
const key = path10[1];
|
|
14120
14120
|
if (!key || !ctx.defs[key]) {
|
|
14121
14121
|
throw new Error(`Reference not found: ${ref}`);
|
|
14122
14122
|
}
|
|
@@ -14610,6 +14610,7 @@ var CONSOLE_HOST_METHODS = Object.freeze([
|
|
|
14610
14610
|
"codexhost/harness/display-settings/get",
|
|
14611
14611
|
"codexhost/harness/display-settings/set",
|
|
14612
14612
|
"codexhost/harness/inspect",
|
|
14613
|
+
"codexhost/harness/installation",
|
|
14613
14614
|
"codexhost/harness/launch-settings/get",
|
|
14614
14615
|
"codexhost/harness/launch-settings/set",
|
|
14615
14616
|
"codexhost/harness/web-ui/open",
|
|
@@ -15256,14 +15257,17 @@ var harnessLaunchSettingsSchema = external_exports.object({
|
|
|
15256
15257
|
// ../../shared-contracts/dist/harness-installation.js
|
|
15257
15258
|
var harnessInstallationParamsSchema = external_exports.object({
|
|
15258
15259
|
harnessId: harnessIdSchema,
|
|
15259
|
-
action: external_exports.enum(["check", "update"])
|
|
15260
|
+
action: external_exports.enum(["check", "update", "install"])
|
|
15260
15261
|
}).strict();
|
|
15261
15262
|
var harnessInstallationStateSchema = external_exports.object({
|
|
15262
15263
|
currentVersion: external_exports.string().min(1).max(128),
|
|
15263
15264
|
latestVersion: external_exports.string().min(1).max(128),
|
|
15264
15265
|
updateAvailable: external_exports.boolean(),
|
|
15265
15266
|
canUpdate: external_exports.boolean(),
|
|
15266
|
-
|
|
15267
|
+
// Adapter-owned diagnostic text; UI uses messageCode rather than displaying it verbatim.
|
|
15268
|
+
message: external_exports.string().max(2048).optional(),
|
|
15269
|
+
messageCode: external_exports.string().min(1).max(128).optional(),
|
|
15270
|
+
latestVersionKind: external_exports.enum(["unknown", "tracking-branch"]).optional()
|
|
15267
15271
|
}).strict();
|
|
15268
15272
|
|
|
15269
15273
|
// ../../shared-contracts/dist/codex-accounts.js
|
|
@@ -15565,6 +15569,38 @@ var updateStatusResultSchema = external_exports.strictObject({
|
|
|
15565
15569
|
status: updateStatusSchema.nullable()
|
|
15566
15570
|
});
|
|
15567
15571
|
|
|
15572
|
+
// ../../shared-contracts/dist/remote-runtime.js
|
|
15573
|
+
var remoteUpdatePhaseSchema = external_exports.enum([
|
|
15574
|
+
"idle",
|
|
15575
|
+
"installing",
|
|
15576
|
+
"restarting",
|
|
15577
|
+
"succeeded",
|
|
15578
|
+
"failed"
|
|
15579
|
+
]);
|
|
15580
|
+
var runtimeStatusSchema = external_exports.object({
|
|
15581
|
+
runningVersion: external_exports.string().nullable(),
|
|
15582
|
+
installedVersion: external_exports.string().nullable(),
|
|
15583
|
+
restartRequired: external_exports.boolean(),
|
|
15584
|
+
remote: external_exports.boolean(),
|
|
15585
|
+
updateSupported: external_exports.boolean(),
|
|
15586
|
+
update: external_exports.object({
|
|
15587
|
+
phase: remoteUpdatePhaseSchema,
|
|
15588
|
+
targetVersion: external_exports.string().nullable(),
|
|
15589
|
+
error: external_exports.string().nullable()
|
|
15590
|
+
})
|
|
15591
|
+
});
|
|
15592
|
+
var remoteUpdateParamsSchema = external_exports.object({
|
|
15593
|
+
version: external_exports.string().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/u)
|
|
15594
|
+
}).strict();
|
|
15595
|
+
var remoteSshSetupParamsSchema = external_exports.object({
|
|
15596
|
+
hostname: external_exports.string().min(1).max(1024).refine((value) => !value.startsWith("-") && !/\s/u.test(value)),
|
|
15597
|
+
port: external_exports.number().int().min(1).max(65535).nullable(),
|
|
15598
|
+
identity: external_exports.string().max(4096).nullable(),
|
|
15599
|
+
action: external_exports.enum(["inspect", "install", "update", "repair"]),
|
|
15600
|
+
version: external_exports.string().regex(/^\d+\.\d+\.\d+$/u).nullable()
|
|
15601
|
+
}).strict();
|
|
15602
|
+
var remoteSshSetupResultSchema = external_exports.object({ state: external_exports.enum(["installed", "not-installed"]) }).strict();
|
|
15603
|
+
|
|
15568
15604
|
// ../../shared-contracts/dist/index.js
|
|
15569
15605
|
var workspaceContractVersionSchema = external_exports.literal(WORKSPACE_CONTRACT_VERSION);
|
|
15570
15606
|
|
|
@@ -16764,7 +16800,7 @@ var BrokeredHarnessAdapter = class {
|
|
|
16764
16800
|
};
|
|
16765
16801
|
|
|
16766
16802
|
// ../codebuddy/dist/codebuddy-adapter.js
|
|
16767
|
-
import { stat as
|
|
16803
|
+
import { stat as stat3 } from "node:fs/promises";
|
|
16768
16804
|
|
|
16769
16805
|
// ../codebuddy/dist/acp-client.js
|
|
16770
16806
|
import { execFile, spawn } from "node:child_process";
|
|
@@ -21692,16 +21728,16 @@ var Diff = class {
|
|
|
21692
21728
|
}
|
|
21693
21729
|
}
|
|
21694
21730
|
}
|
|
21695
|
-
addToPath(
|
|
21696
|
-
const last =
|
|
21731
|
+
addToPath(path10, added, removed, oldPosInc, options) {
|
|
21732
|
+
const last = path10.lastComponent;
|
|
21697
21733
|
if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {
|
|
21698
21734
|
return {
|
|
21699
|
-
oldPos:
|
|
21735
|
+
oldPos: path10.oldPos + oldPosInc,
|
|
21700
21736
|
lastComponent: { count: last.count + 1, added, removed, previousComponent: last.previousComponent }
|
|
21701
21737
|
};
|
|
21702
21738
|
} else {
|
|
21703
21739
|
return {
|
|
21704
|
-
oldPos:
|
|
21740
|
+
oldPos: path10.oldPos + oldPosInc,
|
|
21705
21741
|
lastComponent: { count: 1, added, removed, previousComponent: last }
|
|
21706
21742
|
};
|
|
21707
21743
|
}
|
|
@@ -23584,6 +23620,345 @@ async function deriveCodeBuddySession(options) {
|
|
|
23584
23620
|
}
|
|
23585
23621
|
}
|
|
23586
23622
|
|
|
23623
|
+
// ../codebuddy/dist/session-import.js
|
|
23624
|
+
import { createReadStream } from "node:fs";
|
|
23625
|
+
import { opendir, readFile as readFile4, stat as stat2 } from "node:fs/promises";
|
|
23626
|
+
import path7 from "node:path";
|
|
23627
|
+
import { createInterface as createInterface2 } from "node:readline";
|
|
23628
|
+
|
|
23629
|
+
// ../../harness-adapter/dist/session-import.js
|
|
23630
|
+
import { lstat as lstat3 } from "node:fs/promises";
|
|
23631
|
+
var SessionImportChangedError = class extends Error {
|
|
23632
|
+
constructor(message = "Native Session changed during discovery; refresh and retry") {
|
|
23633
|
+
super(message);
|
|
23634
|
+
this.name = "SessionImportChangedError";
|
|
23635
|
+
}
|
|
23636
|
+
};
|
|
23637
|
+
function isMissingFileError(error51) {
|
|
23638
|
+
return typeof error51 === "object" && error51 !== null && "code" in error51 && error51.code === "ENOENT";
|
|
23639
|
+
}
|
|
23640
|
+
function sameFileFingerprint(left, right) {
|
|
23641
|
+
return left === null || right === null ? left === right : left.dev === right.dev && left.ino === right.ino && left.size === right.size && left.mtimeMs === right.mtimeMs && left.ctimeMs === right.ctimeMs;
|
|
23642
|
+
}
|
|
23643
|
+
var STORAGE_ACCESS_ERRORS = /* @__PURE__ */ new Set(["EACCES", "EPERM", "EIO", "EMFILE", "ENFILE"]);
|
|
23644
|
+
function isStorageAccessError(error51) {
|
|
23645
|
+
return typeof error51 === "object" && error51 !== null && "code" in error51 && typeof error51.code === "string" && STORAGE_ACCESS_ERRORS.has(error51.code);
|
|
23646
|
+
}
|
|
23647
|
+
async function optionalLstat(file2) {
|
|
23648
|
+
try {
|
|
23649
|
+
return await lstat3(file2);
|
|
23650
|
+
} catch (error51) {
|
|
23651
|
+
if (isMissingFileError(error51))
|
|
23652
|
+
return null;
|
|
23653
|
+
throw error51;
|
|
23654
|
+
}
|
|
23655
|
+
}
|
|
23656
|
+
async function readStableFiles(files, read) {
|
|
23657
|
+
const before = await Promise.all(files.map(optionalLstat));
|
|
23658
|
+
const value = await read(before);
|
|
23659
|
+
const after = await Promise.all(files.map(optionalLstat));
|
|
23660
|
+
if (before.some((info, index) => !sameFileFingerprint(info, after[index] ?? null)))
|
|
23661
|
+
throw new SessionImportChangedError();
|
|
23662
|
+
return value;
|
|
23663
|
+
}
|
|
23664
|
+
function sessionImportTitle(value, maxLength = HARNESS_SESSION_IMPORT_TITLE_MAX_LENGTH) {
|
|
23665
|
+
if (typeof value !== "string")
|
|
23666
|
+
return null;
|
|
23667
|
+
const normalized = value.replaceAll("\0", "").replaceAll(/\s+/gu, " ").trim();
|
|
23668
|
+
if (!normalized)
|
|
23669
|
+
return null;
|
|
23670
|
+
if (normalized.length <= maxLength)
|
|
23671
|
+
return normalized;
|
|
23672
|
+
const characters = [...normalized];
|
|
23673
|
+
if (characters.length <= maxLength)
|
|
23674
|
+
return normalized;
|
|
23675
|
+
return `${characters.slice(0, maxLength - 1).join("").trimEnd()}…`;
|
|
23676
|
+
}
|
|
23677
|
+
function sessionImportCandidate(input) {
|
|
23678
|
+
const time3 = typeof input.updatedAt === "number" ? input.updatedAt : typeof input.updatedAt === "string" ? Date.parse(input.updatedAt) : Number.NaN;
|
|
23679
|
+
const parsed = harnessSessionImportCandidateSchema.safeParse({
|
|
23680
|
+
nativeSessionId: input.nativeSessionId,
|
|
23681
|
+
cwd: input.cwd,
|
|
23682
|
+
title: typeof input.title === "string" && input.title.trim().length > 0 ? input.title : null,
|
|
23683
|
+
updatedAt: Math.floor(time3),
|
|
23684
|
+
// Unknown must stay unknown; only an explicit boolean is a native statement.
|
|
23685
|
+
running: typeof input.running === "boolean" ? input.running : null
|
|
23686
|
+
});
|
|
23687
|
+
return parsed.success ? parsed.data : null;
|
|
23688
|
+
}
|
|
23689
|
+
var SessionImportScope = class {
|
|
23690
|
+
#abort = new AbortController();
|
|
23691
|
+
#options;
|
|
23692
|
+
#pending = /* @__PURE__ */ new Set();
|
|
23693
|
+
constructor(options) {
|
|
23694
|
+
this.#options = options;
|
|
23695
|
+
}
|
|
23696
|
+
#closed() {
|
|
23697
|
+
return {
|
|
23698
|
+
ok: false,
|
|
23699
|
+
error: { code: "invalidState", message: this.#options.closedMessage, retryable: false }
|
|
23700
|
+
};
|
|
23701
|
+
}
|
|
23702
|
+
read(operation) {
|
|
23703
|
+
const signal = this.#abort.signal;
|
|
23704
|
+
if (signal.aborted)
|
|
23705
|
+
return Promise.resolve(this.#closed());
|
|
23706
|
+
let started;
|
|
23707
|
+
try {
|
|
23708
|
+
started = operation(signal);
|
|
23709
|
+
} catch (error51) {
|
|
23710
|
+
started = Promise.reject(error51 instanceof Error ? error51 : new Error("Session read failed"));
|
|
23711
|
+
}
|
|
23712
|
+
const request = started.then((value) => signal.aborted ? this.#closed() : { ok: true, value }).catch(() => signal.aborted ? this.#closed() : {
|
|
23713
|
+
ok: false,
|
|
23714
|
+
error: {
|
|
23715
|
+
code: "unavailable",
|
|
23716
|
+
message: this.#options.unavailableMessage,
|
|
23717
|
+
retryable: true
|
|
23718
|
+
}
|
|
23719
|
+
}).finally(() => this.#pending.delete(request));
|
|
23720
|
+
this.#pending.add(request);
|
|
23721
|
+
return request;
|
|
23722
|
+
}
|
|
23723
|
+
/** `read` for `resolveCandidate`: a null source is the selected Session having disappeared. */
|
|
23724
|
+
async resolve(operation) {
|
|
23725
|
+
const result = await this.read(operation);
|
|
23726
|
+
if (!result.ok)
|
|
23727
|
+
return result;
|
|
23728
|
+
return result.value ? { ok: true, value: result.value } : {
|
|
23729
|
+
ok: false,
|
|
23730
|
+
error: {
|
|
23731
|
+
code: "sessionNotFound",
|
|
23732
|
+
message: this.#options.notFoundMessage,
|
|
23733
|
+
retryable: false
|
|
23734
|
+
}
|
|
23735
|
+
};
|
|
23736
|
+
}
|
|
23737
|
+
/** Idempotent. Resolves after every started read has settled. */
|
|
23738
|
+
async close() {
|
|
23739
|
+
this.#abort.abort();
|
|
23740
|
+
await Promise.allSettled(this.#pending);
|
|
23741
|
+
}
|
|
23742
|
+
};
|
|
23743
|
+
|
|
23744
|
+
// ../codebuddy/dist/session-import.js
|
|
23745
|
+
var SESSION_FILE = /^([A-Za-z0-9][A-Za-z0-9_-]{0,199})\.jsonl$/u;
|
|
23746
|
+
var MAX_HISTORY_BYTES = 64e6;
|
|
23747
|
+
var MAX_MARKER_BYTES = 64 * 1024;
|
|
23748
|
+
function processAlive(pid) {
|
|
23749
|
+
if (typeof pid !== "number" || !Number.isSafeInteger(pid) || pid <= 0)
|
|
23750
|
+
return false;
|
|
23751
|
+
try {
|
|
23752
|
+
process.kill(pid, 0);
|
|
23753
|
+
return true;
|
|
23754
|
+
} catch (error51) {
|
|
23755
|
+
return record2(error51).code === "EPERM";
|
|
23756
|
+
}
|
|
23757
|
+
}
|
|
23758
|
+
function userText(row) {
|
|
23759
|
+
if (row.type !== "message" || row.role !== "user")
|
|
23760
|
+
return null;
|
|
23761
|
+
const { content } = row;
|
|
23762
|
+
if (typeof content === "string")
|
|
23763
|
+
return content;
|
|
23764
|
+
if (!Array.isArray(content))
|
|
23765
|
+
return "";
|
|
23766
|
+
return content.map((part) => record2(part)).filter((part) => typeof part.text === "string").map((part) => String(part.text)).join(" ");
|
|
23767
|
+
}
|
|
23768
|
+
async function readFacts(file2, signal) {
|
|
23769
|
+
const stream = createReadStream(file2, { encoding: "utf8", signal });
|
|
23770
|
+
const lines = createInterface2({ input: stream, crlfDelay: Infinity });
|
|
23771
|
+
let cwd = null;
|
|
23772
|
+
let customTitle = null;
|
|
23773
|
+
let generatedTitle = null;
|
|
23774
|
+
let firstPrompt = null;
|
|
23775
|
+
let hasUser = false;
|
|
23776
|
+
let updatedAt = null;
|
|
23777
|
+
try {
|
|
23778
|
+
for await (const line of lines) {
|
|
23779
|
+
signal.throwIfAborted();
|
|
23780
|
+
if (!line.trim())
|
|
23781
|
+
continue;
|
|
23782
|
+
let parsed;
|
|
23783
|
+
try {
|
|
23784
|
+
parsed = JSON.parse(line);
|
|
23785
|
+
} catch {
|
|
23786
|
+
return null;
|
|
23787
|
+
}
|
|
23788
|
+
const row = record2(parsed);
|
|
23789
|
+
if (typeof row.cwd === "string" && path7.isAbsolute(row.cwd))
|
|
23790
|
+
cwd ??= row.cwd;
|
|
23791
|
+
if (typeof row.timestamp === "number" && Number.isFinite(row.timestamp))
|
|
23792
|
+
updatedAt = row.timestamp;
|
|
23793
|
+
if (row.type === "custom-title")
|
|
23794
|
+
customTitle = sessionImportTitle(row.customTitle);
|
|
23795
|
+
else if (row.type === "ai-title")
|
|
23796
|
+
generatedTitle = sessionImportTitle(row.aiTitle);
|
|
23797
|
+
else {
|
|
23798
|
+
const text2 = userText(row);
|
|
23799
|
+
if (text2 !== null) {
|
|
23800
|
+
hasUser = true;
|
|
23801
|
+
firstPrompt ??= sessionImportTitle(text2);
|
|
23802
|
+
}
|
|
23803
|
+
}
|
|
23804
|
+
}
|
|
23805
|
+
} finally {
|
|
23806
|
+
lines.close();
|
|
23807
|
+
stream.destroy();
|
|
23808
|
+
}
|
|
23809
|
+
if (!hasUser || !cwd)
|
|
23810
|
+
return null;
|
|
23811
|
+
return { cwd, title: customTitle ?? generatedTitle ?? firstPrompt, updatedAt };
|
|
23812
|
+
}
|
|
23813
|
+
var CodeBuddySessionImport = class {
|
|
23814
|
+
#environment;
|
|
23815
|
+
#profile;
|
|
23816
|
+
#scope;
|
|
23817
|
+
constructor(environment, profile = CODEBUDDY_RUNTIME_PROFILE) {
|
|
23818
|
+
this.#environment = { ...environment };
|
|
23819
|
+
this.#profile = profile;
|
|
23820
|
+
this.#scope = new SessionImportScope({
|
|
23821
|
+
closedMessage: `${profile.displayName} Session import is closed`,
|
|
23822
|
+
unavailableMessage: `${profile.displayName} sessions could not be read; close native clients, check storage access and retry`,
|
|
23823
|
+
notFoundMessage: `${profile.displayName} Session is no longer importable`
|
|
23824
|
+
});
|
|
23825
|
+
}
|
|
23826
|
+
listCandidates() {
|
|
23827
|
+
return this.#scope.read(async (signal) => {
|
|
23828
|
+
const active = await this.#activeSessions(signal);
|
|
23829
|
+
const candidates = [];
|
|
23830
|
+
for (const [nativeSessionId, files] of await this.#sessionFiles(signal)) {
|
|
23831
|
+
if (files.length !== 1 || !files[0])
|
|
23832
|
+
continue;
|
|
23833
|
+
try {
|
|
23834
|
+
const source = await this.#source(nativeSessionId, files[0], active, signal);
|
|
23835
|
+
if (source)
|
|
23836
|
+
candidates.push(source.candidate);
|
|
23837
|
+
} catch (error51) {
|
|
23838
|
+
if (!(error51 instanceof SessionImportChangedError))
|
|
23839
|
+
throw error51;
|
|
23840
|
+
}
|
|
23841
|
+
}
|
|
23842
|
+
return candidates;
|
|
23843
|
+
});
|
|
23844
|
+
}
|
|
23845
|
+
resolveCandidate(nativeSessionId) {
|
|
23846
|
+
return this.#scope.resolve(async (signal) => {
|
|
23847
|
+
const files = (await this.#sessionFiles(signal)).get(nativeSessionId);
|
|
23848
|
+
if (files?.length !== 1 || !files[0])
|
|
23849
|
+
return null;
|
|
23850
|
+
return this.#source(nativeSessionId, files[0], await this.#activeSessions(signal), signal);
|
|
23851
|
+
});
|
|
23852
|
+
}
|
|
23853
|
+
close() {
|
|
23854
|
+
return this.#scope.close();
|
|
23855
|
+
}
|
|
23856
|
+
#root() {
|
|
23857
|
+
return codeBuddyConfigRoot(this.#environment, this.#profile);
|
|
23858
|
+
}
|
|
23859
|
+
/** IDs a live native process registered in `<config>/sessions/<pid>.json`. */
|
|
23860
|
+
async #activeSessions(signal) {
|
|
23861
|
+
const active = /* @__PURE__ */ new Set();
|
|
23862
|
+
const directory = path7.join(this.#root(), "sessions");
|
|
23863
|
+
const markers = await opendir(directory).catch((error51) => {
|
|
23864
|
+
if (isMissingFileError(error51) || record2(error51).code === "ENOTDIR")
|
|
23865
|
+
return null;
|
|
23866
|
+
throw error51;
|
|
23867
|
+
});
|
|
23868
|
+
if (!markers)
|
|
23869
|
+
return active;
|
|
23870
|
+
for await (const marker of markers) {
|
|
23871
|
+
signal.throwIfAborted();
|
|
23872
|
+
if (!marker.isFile() || !marker.name.endsWith(".json"))
|
|
23873
|
+
continue;
|
|
23874
|
+
try {
|
|
23875
|
+
const file2 = path7.join(directory, marker.name);
|
|
23876
|
+
if ((await stat2(file2)).size > MAX_MARKER_BYTES)
|
|
23877
|
+
continue;
|
|
23878
|
+
const entry = record2(JSON.parse(await readFile4(file2, { encoding: "utf8", signal })));
|
|
23879
|
+
if (typeof entry.sessionId === "string" && processAlive(entry.pid))
|
|
23880
|
+
active.add(entry.sessionId);
|
|
23881
|
+
} catch (error51) {
|
|
23882
|
+
signal.throwIfAborted();
|
|
23883
|
+
if (isStorageAccessError(error51))
|
|
23884
|
+
throw error51;
|
|
23885
|
+
}
|
|
23886
|
+
}
|
|
23887
|
+
return active;
|
|
23888
|
+
}
|
|
23889
|
+
/** Session ID to every project file claiming it. Enumerated links are not followed. */
|
|
23890
|
+
async #sessionFiles(signal) {
|
|
23891
|
+
const root = path7.join(this.#root(), "projects");
|
|
23892
|
+
const found = /* @__PURE__ */ new Map();
|
|
23893
|
+
const info = await optionalLstat(root);
|
|
23894
|
+
if (!info)
|
|
23895
|
+
return found;
|
|
23896
|
+
if (!info.isDirectory())
|
|
23897
|
+
throw new Error(`${this.#profile.displayName} Session store is not a directory`);
|
|
23898
|
+
for await (const project of await opendir(root)) {
|
|
23899
|
+
signal.throwIfAborted();
|
|
23900
|
+
if (!project.isDirectory())
|
|
23901
|
+
continue;
|
|
23902
|
+
const projectDirectory = path7.join(root, project.name);
|
|
23903
|
+
const entries = await opendir(projectDirectory).catch((error51) => {
|
|
23904
|
+
if (isMissingFileError(error51))
|
|
23905
|
+
return null;
|
|
23906
|
+
throw error51;
|
|
23907
|
+
});
|
|
23908
|
+
if (!entries)
|
|
23909
|
+
continue;
|
|
23910
|
+
for await (const entry of entries) {
|
|
23911
|
+
signal.throwIfAborted();
|
|
23912
|
+
const nativeSessionId = entry.isFile() ? SESSION_FILE.exec(entry.name)?.[1] : void 0;
|
|
23913
|
+
if (!nativeSessionId)
|
|
23914
|
+
continue;
|
|
23915
|
+
const files = found.get(nativeSessionId) ?? [];
|
|
23916
|
+
files.push(path7.join(projectDirectory, entry.name));
|
|
23917
|
+
found.set(nativeSessionId, files);
|
|
23918
|
+
}
|
|
23919
|
+
}
|
|
23920
|
+
return found;
|
|
23921
|
+
}
|
|
23922
|
+
async #source(nativeSessionId, file2, active, signal) {
|
|
23923
|
+
signal.throwIfAborted();
|
|
23924
|
+
return readStableFiles([file2], async ([info]) => {
|
|
23925
|
+
if (!info?.isFile() || info.size === 0 || info.size > MAX_HISTORY_BYTES)
|
|
23926
|
+
return null;
|
|
23927
|
+
try {
|
|
23928
|
+
const facts = await readFacts(file2, signal);
|
|
23929
|
+
if (!facts)
|
|
23930
|
+
return null;
|
|
23931
|
+
const cwd = path7.resolve(facts.cwd);
|
|
23932
|
+
if (!(await stat2(cwd)).isDirectory())
|
|
23933
|
+
return null;
|
|
23934
|
+
const nativeRef = nativeSessionRefSchema.parse({
|
|
23935
|
+
harnessId: this.#profile.harnessId,
|
|
23936
|
+
nativeSessionId,
|
|
23937
|
+
formatVersion: 1
|
|
23938
|
+
});
|
|
23939
|
+
signal.throwIfAborted();
|
|
23940
|
+
const history = await codeBuddyNativeHistory(cwd, nativeRef, this.#environment, this.#profile);
|
|
23941
|
+
if (path7.resolve(history.file) !== path7.resolve(file2))
|
|
23942
|
+
return null;
|
|
23943
|
+
const candidate = sessionImportCandidate({
|
|
23944
|
+
nativeSessionId,
|
|
23945
|
+
cwd,
|
|
23946
|
+
title: facts.title,
|
|
23947
|
+
updatedAt: facts.updatedAt ?? info.mtimeMs,
|
|
23948
|
+
// A registered live process holds the Session. Absence is not proof of idleness.
|
|
23949
|
+
running: active.has(nativeSessionId) ? true : null
|
|
23950
|
+
});
|
|
23951
|
+
return candidate ? { candidate, nativeRef } : null;
|
|
23952
|
+
} catch (error51) {
|
|
23953
|
+
signal.throwIfAborted();
|
|
23954
|
+
if (isStorageAccessError(error51))
|
|
23955
|
+
throw error51;
|
|
23956
|
+
return null;
|
|
23957
|
+
}
|
|
23958
|
+
});
|
|
23959
|
+
}
|
|
23960
|
+
};
|
|
23961
|
+
|
|
23587
23962
|
// ../codebuddy/dist/interactions.js
|
|
23588
23963
|
var CodeBuddyInteractions = class {
|
|
23589
23964
|
emit;
|
|
@@ -23727,7 +24102,7 @@ var CodeBuddyInteractions = class {
|
|
|
23727
24102
|
|
|
23728
24103
|
// ../codebuddy/dist/subagent-history.js
|
|
23729
24104
|
import { readdir as readdir2, realpath as realpath5 } from "node:fs/promises";
|
|
23730
|
-
import
|
|
24105
|
+
import path8 from "node:path";
|
|
23731
24106
|
var equalPath2 = (a, b) => process.platform === "win32" ? a.toLowerCase() === b.toLowerCase() : a === b;
|
|
23732
24107
|
var MAX_CACHED_CHILDREN = 16;
|
|
23733
24108
|
var CodeBuddyChildObserver = class {
|
|
@@ -23791,8 +24166,8 @@ var CodeBuddyChildObserver = class {
|
|
|
23791
24166
|
}
|
|
23792
24167
|
async #directory() {
|
|
23793
24168
|
const history = await this.#parentHistory();
|
|
23794
|
-
const project =
|
|
23795
|
-
const expected =
|
|
24169
|
+
const project = path8.dirname(await realpath5(history.file));
|
|
24170
|
+
const expected = path8.join(project, this.parent.nativeSessionId, "subagents");
|
|
23796
24171
|
const actual = await realpath5(expected);
|
|
23797
24172
|
this.#assertOpen();
|
|
23798
24173
|
if (!equalPath2(actual, expected))
|
|
@@ -23802,7 +24177,7 @@ var CodeBuddyChildObserver = class {
|
|
|
23802
24177
|
async #child(directory, childId) {
|
|
23803
24178
|
if (!validCodeBuddyChildId(childId))
|
|
23804
24179
|
throw new CodeBuddyError("invalidRequest", "Invalid native Subagent ID");
|
|
23805
|
-
const file2 =
|
|
24180
|
+
const file2 = path8.join(directory, `${childId}.jsonl`);
|
|
23806
24181
|
const before = await codeBuddyFileVersion(file2);
|
|
23807
24182
|
if (!equalPath2(before.realFile, file2))
|
|
23808
24183
|
throw new CodeBuddyError("invalidRequest", "Redirected Subagent transcript");
|
|
@@ -24514,6 +24889,7 @@ var CodeBuddyAdapter = class {
|
|
|
24514
24889
|
harnessId;
|
|
24515
24890
|
commandCatalog;
|
|
24516
24891
|
liveCommandCatalog = true;
|
|
24892
|
+
sessionImport;
|
|
24517
24893
|
subagents = {
|
|
24518
24894
|
readSnapshot: async ({ parent, nativeSubagentId, cwd }) => {
|
|
24519
24895
|
try {
|
|
@@ -24547,6 +24923,7 @@ var CodeBuddyAdapter = class {
|
|
|
24547
24923
|
this.commandCatalog = commandCatalog2;
|
|
24548
24924
|
}
|
|
24549
24925
|
this.#environment = { ...options.environment ?? process.env };
|
|
24926
|
+
this.sessionImport = new CodeBuddySessionImport(this.#environment, this.#profile);
|
|
24550
24927
|
this.#invocation = options.invocationFactory ?? codeBuddyInvocation;
|
|
24551
24928
|
this.#factory = options.clientFactory ?? ((clientOptions) => new CodeBuddyAcpClient(clientOptions, void 0, this.#invocation));
|
|
24552
24929
|
}
|
|
@@ -24566,7 +24943,7 @@ var CodeBuddyAdapter = class {
|
|
|
24566
24943
|
try {
|
|
24567
24944
|
if (this.#closed)
|
|
24568
24945
|
throw new CodeBuddyError("invalidState", "Adapter is closed");
|
|
24569
|
-
if (!(await
|
|
24946
|
+
if (!(await stat3(cwd)).isDirectory())
|
|
24570
24947
|
throw new CodeBuddyError("invalidRequest", "Working directory is not a directory");
|
|
24571
24948
|
client2 = this.#factory({
|
|
24572
24949
|
cwd,
|
|
@@ -24612,7 +24989,7 @@ var CodeBuddyAdapter = class {
|
|
|
24612
24989
|
return failure("invalidRequest", "Unattended execution requires native fullAccess permissions", this.#profile);
|
|
24613
24990
|
let session;
|
|
24614
24991
|
try {
|
|
24615
|
-
if (!(await
|
|
24992
|
+
if (!(await stat3(input.cwd)).isDirectory())
|
|
24616
24993
|
throw new CodeBuddyError("invalidRequest", "Working directory is not a directory");
|
|
24617
24994
|
if (this.#closed)
|
|
24618
24995
|
throw new CodeBuddyError("invalidState", "Adapter closed while opening Session");
|
|
@@ -24675,7 +25052,7 @@ var CodeBuddyAdapter = class {
|
|
|
24675
25052
|
async close() {
|
|
24676
25053
|
this.#closed = true;
|
|
24677
25054
|
this.#abort.abort();
|
|
24678
|
-
await Promise.allSettled([...this.#derivations]);
|
|
25055
|
+
await Promise.allSettled([this.sessionImport.close(), ...this.#derivations]);
|
|
24679
25056
|
const results = await Promise.allSettled([...this.#sessions, ...this.#inspections].map((resource) => resource.close()));
|
|
24680
25057
|
this.#sessions.clear();
|
|
24681
25058
|
this.#inspections.clear();
|
|
@@ -24894,8 +25271,8 @@ var WORKBUDDY_RUNTIME_PROFILE = {
|
|
|
24894
25271
|
};
|
|
24895
25272
|
|
|
24896
25273
|
// dist/product-models.js
|
|
24897
|
-
import { readFile as
|
|
24898
|
-
import
|
|
25274
|
+
import { readFile as readFile5, stat as stat4 } from "node:fs/promises";
|
|
25275
|
+
import path9 from "node:path";
|
|
24899
25276
|
var MAX_PRODUCT_SNAPSHOT_BYTES = 8 * 1024 * 1024;
|
|
24900
25277
|
var PRODUCT_CONFIG_PATH_ENV = "ACC_PRODUCT_CONFIG_PATH";
|
|
24901
25278
|
var PRODUCT_CONFIG_INLINE_ENVS = [
|
|
@@ -24948,16 +25325,16 @@ function parseWorkBuddyProductModels(value) {
|
|
|
24948
25325
|
return parsed;
|
|
24949
25326
|
}
|
|
24950
25327
|
async function readProductJson(file2) {
|
|
24951
|
-
const metadata = await
|
|
25328
|
+
const metadata = await stat4(file2);
|
|
24952
25329
|
if (!metadata.isFile() || metadata.size <= 0 || metadata.size > MAX_PRODUCT_SNAPSHOT_BYTES)
|
|
24953
25330
|
return;
|
|
24954
|
-
return JSON.parse(await
|
|
25331
|
+
return JSON.parse(await readFile5(file2, "utf8"));
|
|
24955
25332
|
}
|
|
24956
25333
|
function bundledFallbackProductPath(invocation) {
|
|
24957
25334
|
const cli = invocation.arguments[0];
|
|
24958
25335
|
if (!cli || cli.startsWith("-"))
|
|
24959
25336
|
return;
|
|
24960
|
-
return
|
|
25337
|
+
return path9.join(path9.dirname(path9.dirname(cli)), "product.json");
|
|
24961
25338
|
}
|
|
24962
25339
|
async function loadWorkBuddyProductModels(environment) {
|
|
24963
25340
|
const invocation = workBuddyInvocation(environment, true);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30">
|
|
2
|
+
<path fill="#2D2D2D" stroke="#FFFFFF" stroke-width="0.6317" stroke-miterlimit="10" d="M24.51,28.51H5.49c-2.21,0-4-1.79-4-4V5.49c0-2.21,1.79-4,4-4h19.03c2.21,0,4,1.79,4,4v19.03C28.51,26.72,26.72,28.51,24.51,28.51z"/>
|
|
3
|
+
<g fill="#FFFFFF">
|
|
4
|
+
<path d="M15.47,7.1l-1.3,1.85c-0.2,0.29-0.54,0.47-0.9,0.47h-7.1V7.09C6.16,7.1,15.47,7.1,15.47,7.1z"/>
|
|
5
|
+
<polygon points="24.3,7.1 13.14,22.91 5.7,22.91 16.86,7.1"/>
|
|
6
|
+
<path d="M14.53,22.91l1.31-1.86c0.2-0.29,0.54-0.47,0.9-0.47h7.09v2.33H14.53z"/>
|
|
7
|
+
</g>
|
|
8
|
+
</svg>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"manifestVersion": 1,
|
|
3
|
+
"id": "zcode",
|
|
4
|
+
"name": "ZCode",
|
|
5
|
+
"version": "0.1.0",
|
|
6
|
+
"launchCommand": true,
|
|
7
|
+
"links": {
|
|
8
|
+
"documentation": "https://github.com/zai-org/ZCode",
|
|
9
|
+
"installation": "https://zcode.z.ai/"
|
|
10
|
+
},
|
|
11
|
+
"adapterApiVersion": 1,
|
|
12
|
+
"entry": "plugin.mjs",
|
|
13
|
+
"icon": "assets/icon.svg"
|
|
14
|
+
}
|