@liberseek/boft-cli-win32-arm64 0.7.8 → 0.7.9
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 +16583 -16433
- package/app/console-web.js +3524 -1714
- package/app/desktop-controller.mjs +16241 -350
- package/app/host-runtime.mjs +4343 -954
- package/app/plugins/antigravity/plugin.mjs +81 -0
- package/app/plugins/claude-code/plugin.mjs +393 -100
- package/app/plugins/codebuddy/plugin.mjs +727 -134
- package/app/plugins/cursor-cli/plugin.mjs +431 -120
- package/app/plugins/deepseek-harness/plugin.mjs +81 -0
- package/app/plugins/enabled.json +2 -1
- package/app/plugins/grok/plugin.mjs +459 -56
- package/app/plugins/hermes/plugin.mjs +3301 -7739
- package/app/plugins/kimi-code/plugin.mjs +367 -40
- package/app/plugins/kiro-cli/plugin.mjs +374 -35
- package/app/plugins/muse/plugin.mjs +81 -0
- package/app/plugins/omp/plugin.mjs +505 -97
- package/app/plugins/opencode/plugin.mjs +324 -76
- package/app/plugins/pi/plugin.mjs +195 -55
- package/app/plugins/qoder/plugin.mjs +281 -35
- package/app/plugins/qoder-cn/plugin.mjs +281 -35
- package/app/plugins/workbuddy/plugin.mjs +699 -96
- package/app/plugins/zcode/assets/icon.svg +8 -0
- package/app/plugins/zcode/manifest.json +14 -0
- package/app/plugins/zcode/plugin.mjs +19304 -0
- package/app/renderer-extension.js +2514 -526
- package/bin/boft.exe +0 -0
- package/libexec/boft-node-repl.exe +0 -0
- package/libexec/boft-shim.exe +0 -0
- package/libexec/boft-updater.exe +0 -0
- package/package.json +1 -1
|
@@ -233,11 +233,11 @@ function harnessCandidates(spec, input, dependencies = {}) {
|
|
|
233
233
|
}
|
|
234
234
|
function resolveHarnessExecutable(spec, input, dependencies = {}) {
|
|
235
235
|
const platform = input.platform ?? process.platform;
|
|
236
|
-
const isExecutable = dependencies.isExecutable ?? ((
|
|
237
|
-
const runnable = spec.runnableCandidate ?? ((
|
|
236
|
+
const isExecutable = dependencies.isExecutable ?? ((candidate2) => isExecutableFile(candidate2, platform));
|
|
237
|
+
const runnable = spec.runnableCandidate ?? ((candidate2) => candidate2);
|
|
238
238
|
const context = { platform, isExecutable };
|
|
239
|
-
for (const { candidate, source } of harnessCandidates(spec, input, dependencies)) {
|
|
240
|
-
const executable = runnable(
|
|
239
|
+
for (const { candidate: candidate2, source } of harnessCandidates(spec, input, dependencies)) {
|
|
240
|
+
const executable = runnable(candidate2, context);
|
|
241
241
|
if (executable !== void 0 && isExecutable(executable))
|
|
242
242
|
return { executable, source };
|
|
243
243
|
}
|
|
@@ -1258,10 +1258,10 @@ function mergeDefs(...defs) {
|
|
|
1258
1258
|
function cloneDef(schema) {
|
|
1259
1259
|
return mergeDefs(schema._zod.def);
|
|
1260
1260
|
}
|
|
1261
|
-
function getElementAtPath(obj,
|
|
1262
|
-
if (!
|
|
1261
|
+
function getElementAtPath(obj, path13) {
|
|
1262
|
+
if (!path13)
|
|
1263
1263
|
return obj;
|
|
1264
|
-
return
|
|
1264
|
+
return path13.reduce((acc, key) => acc?.[key], obj);
|
|
1265
1265
|
}
|
|
1266
1266
|
function promiseAllObject(promisesObj) {
|
|
1267
1267
|
const keys = Object.keys(promisesObj);
|
|
@@ -1670,11 +1670,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
1670
1670
|
}
|
|
1671
1671
|
return false;
|
|
1672
1672
|
}
|
|
1673
|
-
function prefixIssues(
|
|
1673
|
+
function prefixIssues(path13, issues) {
|
|
1674
1674
|
return issues.map((iss) => {
|
|
1675
1675
|
var _a3;
|
|
1676
1676
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
1677
|
-
iss.path.unshift(
|
|
1677
|
+
iss.path.unshift(path13);
|
|
1678
1678
|
return iss;
|
|
1679
1679
|
});
|
|
1680
1680
|
}
|
|
@@ -1821,16 +1821,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
|
|
|
1821
1821
|
}
|
|
1822
1822
|
function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
1823
1823
|
const fieldErrors = { _errors: [] };
|
|
1824
|
-
const processError = (error52,
|
|
1824
|
+
const processError = (error52, path13 = []) => {
|
|
1825
1825
|
for (const issue2 of error52.issues) {
|
|
1826
1826
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
1827
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
1827
|
+
issue2.errors.map((issues) => processError({ issues }, [...path13, ...issue2.path]));
|
|
1828
1828
|
} else if (issue2.code === "invalid_key") {
|
|
1829
|
-
processError({ issues: issue2.issues }, [...
|
|
1829
|
+
processError({ issues: issue2.issues }, [...path13, ...issue2.path]);
|
|
1830
1830
|
} else if (issue2.code === "invalid_element") {
|
|
1831
|
-
processError({ issues: issue2.issues }, [...
|
|
1831
|
+
processError({ issues: issue2.issues }, [...path13, ...issue2.path]);
|
|
1832
1832
|
} else {
|
|
1833
|
-
const fullpath = [...
|
|
1833
|
+
const fullpath = [...path13, ...issue2.path];
|
|
1834
1834
|
if (fullpath.length === 0) {
|
|
1835
1835
|
fieldErrors._errors.push(mapper(issue2));
|
|
1836
1836
|
} else {
|
|
@@ -1857,17 +1857,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
|
1857
1857
|
}
|
|
1858
1858
|
function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
1859
1859
|
const result = { errors: [] };
|
|
1860
|
-
const processError = (error52,
|
|
1860
|
+
const processError = (error52, path13 = []) => {
|
|
1861
1861
|
var _a3, _b;
|
|
1862
1862
|
for (const issue2 of error52.issues) {
|
|
1863
1863
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
1864
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
1864
|
+
issue2.errors.map((issues) => processError({ issues }, [...path13, ...issue2.path]));
|
|
1865
1865
|
} else if (issue2.code === "invalid_key") {
|
|
1866
|
-
processError({ issues: issue2.issues }, [...
|
|
1866
|
+
processError({ issues: issue2.issues }, [...path13, ...issue2.path]);
|
|
1867
1867
|
} else if (issue2.code === "invalid_element") {
|
|
1868
|
-
processError({ issues: issue2.issues }, [...
|
|
1868
|
+
processError({ issues: issue2.issues }, [...path13, ...issue2.path]);
|
|
1869
1869
|
} else {
|
|
1870
|
-
const fullpath = [...
|
|
1870
|
+
const fullpath = [...path13, ...issue2.path];
|
|
1871
1871
|
if (fullpath.length === 0) {
|
|
1872
1872
|
result.errors.push(mapper(issue2));
|
|
1873
1873
|
continue;
|
|
@@ -1899,8 +1899,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
|
1899
1899
|
}
|
|
1900
1900
|
function toDotPath(_path) {
|
|
1901
1901
|
const segs = [];
|
|
1902
|
-
const
|
|
1903
|
-
for (const seg of
|
|
1902
|
+
const path13 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
1903
|
+
for (const seg of path13) {
|
|
1904
1904
|
if (typeof seg === "number")
|
|
1905
1905
|
segs.push(`[${seg}]`);
|
|
1906
1906
|
else if (typeof seg === "symbol")
|
|
@@ -14592,13 +14592,13 @@ function resolveRef(ref, ctx) {
|
|
|
14592
14592
|
if (!ref.startsWith("#")) {
|
|
14593
14593
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
14594
14594
|
}
|
|
14595
|
-
const
|
|
14596
|
-
if (
|
|
14595
|
+
const path13 = ref.slice(1).split("/").filter(Boolean);
|
|
14596
|
+
if (path13.length === 0) {
|
|
14597
14597
|
return ctx.rootSchema;
|
|
14598
14598
|
}
|
|
14599
14599
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
14600
|
-
if (
|
|
14601
|
-
const key =
|
|
14600
|
+
if (path13[0] === defsKey) {
|
|
14601
|
+
const key = path13[1];
|
|
14602
14602
|
if (!key || !ctx.defs[key]) {
|
|
14603
14603
|
throw new Error(`Reference not found: ${ref}`);
|
|
14604
14604
|
}
|
|
@@ -15086,6 +15086,10 @@ var hostTurnIdSchema = opaqueIdSchema.brand();
|
|
|
15086
15086
|
var hostItemIdSchema = opaqueIdSchema.brand();
|
|
15087
15087
|
var hostInteractionIdSchema = opaqueIdSchema.brand();
|
|
15088
15088
|
|
|
15089
|
+
// ../../shared-contracts/dist/thread-prewarm.js
|
|
15090
|
+
var threadPrewarmDiscardParamsSchema = external_exports.object({ threadId: hostThreadIdSchema });
|
|
15091
|
+
var threadPrewarmDiscardResultSchema = external_exports.object({ discarded: external_exports.boolean() });
|
|
15092
|
+
|
|
15089
15093
|
// ../../shared-contracts/dist/harness-plugins.js
|
|
15090
15094
|
var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
|
|
15091
15095
|
var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
|
|
@@ -15153,6 +15157,9 @@ var consoleOpenResultSchema = external_exports.strictObject({
|
|
|
15153
15157
|
url: external_exports.string().max(2048).regex(/^http:\/\/(?:127\.0\.0\.1|localhost):\d{1,5}\/(?:\?.*)?$/u)
|
|
15154
15158
|
});
|
|
15155
15159
|
var CONSOLE_HOST_METHODS = Object.freeze([
|
|
15160
|
+
"codexhost/console/remote-connections",
|
|
15161
|
+
"codexhost/runtime/status",
|
|
15162
|
+
"codexhost/remote/ssh-setup",
|
|
15156
15163
|
"codexhost/harness/plugins/list",
|
|
15157
15164
|
"codexhost/harness/display-settings/get",
|
|
15158
15165
|
"codexhost/harness/display-settings/set",
|
|
@@ -16098,6 +16105,80 @@ var updateStatusResultSchema = external_exports.strictObject({
|
|
|
16098
16105
|
status: updateStatusSchema.nullable()
|
|
16099
16106
|
});
|
|
16100
16107
|
|
|
16108
|
+
// ../../shared-contracts/dist/remote-runtime.js
|
|
16109
|
+
var remoteUpdatePhaseSchema = external_exports.enum([
|
|
16110
|
+
"idle",
|
|
16111
|
+
"installing",
|
|
16112
|
+
"restarting",
|
|
16113
|
+
"succeeded",
|
|
16114
|
+
"failed"
|
|
16115
|
+
]);
|
|
16116
|
+
var runtimeStatusSchema = external_exports.object({
|
|
16117
|
+
runningVersion: external_exports.string().nullable(),
|
|
16118
|
+
installedVersion: external_exports.string().nullable(),
|
|
16119
|
+
restartRequired: external_exports.boolean(),
|
|
16120
|
+
remote: external_exports.boolean(),
|
|
16121
|
+
updateSupported: external_exports.boolean(),
|
|
16122
|
+
update: external_exports.object({
|
|
16123
|
+
phase: remoteUpdatePhaseSchema,
|
|
16124
|
+
targetVersion: external_exports.string().nullable(),
|
|
16125
|
+
error: external_exports.string().nullable()
|
|
16126
|
+
})
|
|
16127
|
+
});
|
|
16128
|
+
var remoteUpdateParamsSchema = external_exports.object({
|
|
16129
|
+
version: external_exports.string().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/u)
|
|
16130
|
+
}).strict();
|
|
16131
|
+
var remoteSshSetupParamsSchema = external_exports.object({
|
|
16132
|
+
hostname: external_exports.string().min(1).max(1024).refine((value) => !value.startsWith("-") && !/\s/u.test(value)),
|
|
16133
|
+
port: external_exports.number().int().min(1).max(65535).nullable(),
|
|
16134
|
+
identity: external_exports.string().max(4096).nullable(),
|
|
16135
|
+
action: external_exports.enum(["inspect", "install", "update", "repair", "uninstall"]),
|
|
16136
|
+
uninstallPackage: external_exports.boolean().optional(),
|
|
16137
|
+
version: external_exports.string().regex(/^\d+\.\d+\.\d+$/u).nullable()
|
|
16138
|
+
}).strict();
|
|
16139
|
+
var remoteSshSetupResultSchema = external_exports.object({ state: external_exports.enum(["installed", "not-installed"]) }).strict();
|
|
16140
|
+
|
|
16141
|
+
// ../../shared-contracts/dist/remote-connections.js
|
|
16142
|
+
var hostId = external_exports.string().min(1).max(1024);
|
|
16143
|
+
var codexSshConnectionSchema = external_exports.object({
|
|
16144
|
+
hostId,
|
|
16145
|
+
displayName: external_exports.string().min(1).max(1024),
|
|
16146
|
+
source: external_exports.enum(["codex-managed", "discovered"]),
|
|
16147
|
+
sshAlias: external_exports.string().max(1024).nullable(),
|
|
16148
|
+
sshHost: external_exports.string().min(1).max(1024),
|
|
16149
|
+
sshPort: external_exports.number().int().min(1).max(65535).nullable(),
|
|
16150
|
+
identity: external_exports.string().max(4096).nullable(),
|
|
16151
|
+
autoConnect: external_exports.boolean(),
|
|
16152
|
+
connectionAnalyticsId: external_exports.string().max(1024).optional()
|
|
16153
|
+
});
|
|
16154
|
+
var codexSshDraftSchema = external_exports.strictObject({
|
|
16155
|
+
displayName: external_exports.string().min(1).max(1024),
|
|
16156
|
+
hostname: external_exports.string().min(1).max(1024),
|
|
16157
|
+
sshPort: external_exports.number().int().min(1).max(65535).nullable(),
|
|
16158
|
+
identity: external_exports.string().max(4096).nullable()
|
|
16159
|
+
});
|
|
16160
|
+
var remoteConnectionsRequestSchema = external_exports.discriminatedUnion("action", [
|
|
16161
|
+
external_exports.strictObject({ action: external_exports.literal("list") }),
|
|
16162
|
+
external_exports.strictObject({
|
|
16163
|
+
action: external_exports.literal("save"),
|
|
16164
|
+
draft: codexSshDraftSchema,
|
|
16165
|
+
previous: codexSshConnectionSchema.nullable()
|
|
16166
|
+
}),
|
|
16167
|
+
external_exports.strictObject({ action: external_exports.literal("remove"), previous: codexSshConnectionSchema }),
|
|
16168
|
+
external_exports.strictObject({ action: external_exports.literal("connect"), hostId, enabled: external_exports.boolean() }),
|
|
16169
|
+
external_exports.strictObject({ action: external_exports.literal("state"), hostId }),
|
|
16170
|
+
external_exports.strictObject({ action: external_exports.literal("runtime"), hostId }),
|
|
16171
|
+
external_exports.strictObject({
|
|
16172
|
+
action: external_exports.literal("update"),
|
|
16173
|
+
hostId: hostId.refine((id) => id !== "local"),
|
|
16174
|
+
version: remoteUpdateParamsSchema.shape.version
|
|
16175
|
+
})
|
|
16176
|
+
]);
|
|
16177
|
+
var remoteConnectionsReplySchema = external_exports.union([
|
|
16178
|
+
external_exports.strictObject({ result: jsonValueSchema }),
|
|
16179
|
+
external_exports.strictObject({ error: external_exports.strictObject({ code: external_exports.number().int(), message: external_exports.string() }) })
|
|
16180
|
+
]);
|
|
16181
|
+
|
|
16101
16182
|
// ../../shared-contracts/dist/index.js
|
|
16102
16183
|
var workspaceContractVersionSchema = external_exports.literal(WORKSPACE_CONTRACT_VERSION);
|
|
16103
16184
|
|
|
@@ -16247,20 +16328,20 @@ function parseHostUsage(value) {
|
|
|
16247
16328
|
}
|
|
16248
16329
|
}
|
|
16249
16330
|
for (const field of ["totalCredits", "contextUsagePercent"]) {
|
|
16250
|
-
const
|
|
16251
|
-
if (
|
|
16331
|
+
const candidate2 = value[field];
|
|
16332
|
+
if (candidate2 !== void 0 && (typeof candidate2 !== "number" || !Number.isFinite(candidate2) || candidate2 < 0)) {
|
|
16252
16333
|
throw new Error(`Harness Usage '${field}' must be a finite non-negative number`);
|
|
16253
16334
|
}
|
|
16254
16335
|
}
|
|
16255
16336
|
for (const field of tokenFields) {
|
|
16256
|
-
const
|
|
16257
|
-
if (
|
|
16337
|
+
const candidate2 = value[field];
|
|
16338
|
+
if (candidate2 !== void 0 && (typeof candidate2 !== "number" || !Number.isSafeInteger(candidate2) || candidate2 < 0)) {
|
|
16258
16339
|
throw new Error(`Harness Usage '${field}' must be a non-negative safe integer`);
|
|
16259
16340
|
}
|
|
16260
16341
|
}
|
|
16261
16342
|
for (const field of safeIntegerFields) {
|
|
16262
|
-
const
|
|
16263
|
-
if (
|
|
16343
|
+
const candidate2 = value[field];
|
|
16344
|
+
if (candidate2 !== void 0 && (typeof candidate2 !== "number" || !Number.isSafeInteger(candidate2) || candidate2 < 0)) {
|
|
16264
16345
|
throw new Error(`Harness Usage '${field}' must be a non-negative safe integer`);
|
|
16265
16346
|
}
|
|
16266
16347
|
}
|
|
@@ -16271,14 +16352,14 @@ function parseHostUsage(value) {
|
|
|
16271
16352
|
throw new Error("Harness Usage 'totalCostUsd' must be a finite non-negative number");
|
|
16272
16353
|
}
|
|
16273
16354
|
for (const field of ["totalCredits", "contextUsagePercent"]) {
|
|
16274
|
-
const
|
|
16275
|
-
if (
|
|
16355
|
+
const candidate2 = value[field];
|
|
16356
|
+
if (candidate2 !== void 0 && (typeof candidate2 !== "number" || !Number.isFinite(candidate2) || candidate2 < 0)) {
|
|
16276
16357
|
throw new Error(`Harness Usage '${field}' must be a finite non-negative number`);
|
|
16277
16358
|
}
|
|
16278
16359
|
}
|
|
16279
16360
|
for (const field of percentFields) {
|
|
16280
|
-
const
|
|
16281
|
-
if (
|
|
16361
|
+
const candidate2 = value[field];
|
|
16362
|
+
if (candidate2 !== void 0 && (typeof candidate2 !== "number" || !Number.isFinite(candidate2) || candidate2 < 0 || candidate2 > 100)) {
|
|
16282
16363
|
throw new Error(`Harness Usage '${field}' must be between 0 and 100`);
|
|
16283
16364
|
}
|
|
16284
16365
|
}
|
|
@@ -16391,7 +16472,7 @@ function normalizeOpenCodeModelCatalog(catalog) {
|
|
|
16391
16472
|
...Object.keys(model.variants ?? {}).sort(compareText).map(encodeOpenCodeVariant)
|
|
16392
16473
|
]
|
|
16393
16474
|
})).sort((left, right) => compareText(left.label, right.label) || compareText(left.ref.id, right.ref.id));
|
|
16394
|
-
const defaultNative = catalog.connected.map((providerID) => ({ providerID, modelID: catalog.default[providerID] })).find((
|
|
16475
|
+
const defaultNative = catalog.connected.map((providerID) => ({ providerID, modelID: catalog.default[providerID] })).find((candidate2) => typeof candidate2.modelID === "string" && candidate2.modelID.length > 0);
|
|
16395
16476
|
const defaultModel = defaultNative ? encodeOpenCodeModelRef(defaultNative) : void 0;
|
|
16396
16477
|
return harnessModelCatalogSchema.parse({
|
|
16397
16478
|
models,
|
|
@@ -16951,7 +17032,7 @@ var serializeObjectParam = ({ allowReserved, explode, name, style, value, valueO
|
|
|
16951
17032
|
|
|
16952
17033
|
// ../../../node_modules/@opencode-ai/sdk/dist/v2/gen/core/utils.gen.js
|
|
16953
17034
|
var PATH_PARAM_RE = /\{[^{}]+\}/g;
|
|
16954
|
-
var defaultPathSerializer = ({ path:
|
|
17035
|
+
var defaultPathSerializer = ({ path: path13, url: _url2 }) => {
|
|
16955
17036
|
let url2 = _url2;
|
|
16956
17037
|
const matches = _url2.match(PATH_PARAM_RE);
|
|
16957
17038
|
if (matches) {
|
|
@@ -16970,7 +17051,7 @@ var defaultPathSerializer = ({ path: path12, url: _url2 }) => {
|
|
|
16970
17051
|
name = name.substring(1);
|
|
16971
17052
|
style = "matrix";
|
|
16972
17053
|
}
|
|
16973
|
-
const value =
|
|
17054
|
+
const value = path13[name];
|
|
16974
17055
|
if (value === void 0 || value === null) {
|
|
16975
17056
|
continue;
|
|
16976
17057
|
}
|
|
@@ -17001,11 +17082,11 @@ var defaultPathSerializer = ({ path: path12, url: _url2 }) => {
|
|
|
17001
17082
|
}
|
|
17002
17083
|
return url2;
|
|
17003
17084
|
};
|
|
17004
|
-
var getUrl = ({ baseUrl, path:
|
|
17085
|
+
var getUrl = ({ baseUrl, path: path13, query, querySerializer, url: _url2 }) => {
|
|
17005
17086
|
const pathUrl = _url2.startsWith("/") ? _url2 : `/${_url2}`;
|
|
17006
17087
|
let url2 = (baseUrl ?? "") + pathUrl;
|
|
17007
|
-
if (
|
|
17008
|
-
url2 = defaultPathSerializer({ path:
|
|
17088
|
+
if (path13) {
|
|
17089
|
+
url2 = defaultPathSerializer({ path: path13, url: url2 });
|
|
17009
17090
|
}
|
|
17010
17091
|
let search = query ? querySerializer(query) : "";
|
|
17011
17092
|
if (search.startsWith("?")) {
|
|
@@ -22258,14 +22339,14 @@ function signalProcessTree(child, signal) {
|
|
|
22258
22339
|
}
|
|
22259
22340
|
function safeOpenCodeServerCwd(environment) {
|
|
22260
22341
|
const candidates = [environment.USERPROFILE, environment.HOME, homedir2(), tmpdir2()];
|
|
22261
|
-
for (const
|
|
22262
|
-
if (!
|
|
22342
|
+
for (const candidate2 of candidates) {
|
|
22343
|
+
if (!candidate2 || !path6.isAbsolute(candidate2))
|
|
22263
22344
|
continue;
|
|
22264
22345
|
try {
|
|
22265
|
-
if (!fs2.statSync(
|
|
22346
|
+
if (!fs2.statSync(candidate2).isDirectory())
|
|
22266
22347
|
continue;
|
|
22267
|
-
fs2.accessSync(
|
|
22268
|
-
return
|
|
22348
|
+
fs2.accessSync(candidate2, fs2.constants.R_OK | fs2.constants.W_OK);
|
|
22349
|
+
return candidate2;
|
|
22269
22350
|
} catch {
|
|
22270
22351
|
}
|
|
22271
22352
|
}
|
|
@@ -22720,19 +22801,19 @@ function hasDotPathSegment(value) {
|
|
|
22720
22801
|
return segments.some((segment) => segment === "." || segment === "..");
|
|
22721
22802
|
}
|
|
22722
22803
|
function canonicalDirectoryPath(value) {
|
|
22723
|
-
let
|
|
22804
|
+
let candidate2 = path7.resolve(value);
|
|
22724
22805
|
const missingSegments = [];
|
|
22725
22806
|
for (; ; ) {
|
|
22726
22807
|
try {
|
|
22727
|
-
return path7.join(fs3.realpathSync.native(
|
|
22808
|
+
return path7.join(fs3.realpathSync.native(candidate2), ...missingSegments);
|
|
22728
22809
|
} catch (error51) {
|
|
22729
22810
|
if (!missingPath(error51))
|
|
22730
22811
|
return void 0;
|
|
22731
|
-
const parent = path7.dirname(
|
|
22732
|
-
if (parent ===
|
|
22812
|
+
const parent = path7.dirname(candidate2);
|
|
22813
|
+
if (parent === candidate2)
|
|
22733
22814
|
return void 0;
|
|
22734
|
-
missingSegments.unshift(path7.basename(
|
|
22735
|
-
|
|
22815
|
+
missingSegments.unshift(path7.basename(candidate2));
|
|
22816
|
+
candidate2 = parent;
|
|
22736
22817
|
}
|
|
22737
22818
|
}
|
|
22738
22819
|
}
|
|
@@ -22741,8 +22822,8 @@ function canonicalFilePath(value) {
|
|
|
22741
22822
|
const parent = canonicalDirectoryPath(path7.dirname(absolute));
|
|
22742
22823
|
return parent ? path7.join(parent, path7.basename(absolute)) : void 0;
|
|
22743
22824
|
}
|
|
22744
|
-
function pathIsWithin(root,
|
|
22745
|
-
const relative = path7.relative(root,
|
|
22825
|
+
function pathIsWithin(root, candidate2, allowRoot) {
|
|
22826
|
+
const relative = path7.relative(root, candidate2);
|
|
22746
22827
|
return allowRoot && relative === "" || relative !== "" && relative !== ".." && !relative.startsWith(`..${path7.sep}`) && !path7.isAbsolute(relative);
|
|
22747
22828
|
}
|
|
22748
22829
|
function verifiedOpenCodeWorktree(sessionDirectory, paths) {
|
|
@@ -22761,8 +22842,8 @@ function openCodeFileIdentity(file2, worktree) {
|
|
|
22761
22842
|
if (typeof file2 !== "string" || typeof worktree !== "string" || hasDotPathSegment(file2) || hasDotPathSegment(worktree) || !path7.isAbsolute(worktree) || !file2 || file2.includes("\0") || file2.includes("\n") || file2.includes("\r")) {
|
|
22762
22843
|
return void 0;
|
|
22763
22844
|
}
|
|
22764
|
-
const
|
|
22765
|
-
return
|
|
22845
|
+
const candidate2 = canonicalFilePath(path7.isAbsolute(file2) ? file2 : path7.resolve(worktree, file2));
|
|
22846
|
+
return candidate2 && pathIsWithin(worktree, candidate2, false) ? candidate2 : void 0;
|
|
22766
22847
|
}
|
|
22767
22848
|
|
|
22768
22849
|
// dist/usage.js
|
|
@@ -22990,20 +23071,20 @@ async function deriveOpenCodeHistory(options) {
|
|
|
22990
23071
|
retainedCount = boundary.sourceTurnCount - 1;
|
|
22991
23072
|
}
|
|
22992
23073
|
const expectedHistory = structuredClone(semanticHistory(before.snapshot).slice(0, retainedCount));
|
|
22993
|
-
let
|
|
22994
|
-
if (
|
|
23074
|
+
let candidate2 = await transport.forkSession(source.id, messageID);
|
|
23075
|
+
if (candidate2.id === source.id) {
|
|
22995
23076
|
throw new OpenCodeTransportError("protocolError", "OpenCode Fork did not create a distinct Native Session");
|
|
22996
23077
|
}
|
|
22997
|
-
const candidateID =
|
|
22998
|
-
options.onCreated(
|
|
22999
|
-
if (
|
|
23078
|
+
const candidateID = candidate2.id;
|
|
23079
|
+
options.onCreated(candidate2);
|
|
23080
|
+
if (candidate2.directory !== expectedSource.directory) {
|
|
23000
23081
|
throw new OpenCodeTransportError("protocolError", "OpenCode Fork changed working directory");
|
|
23001
23082
|
}
|
|
23002
23083
|
if (expectedSource.model) {
|
|
23003
|
-
|
|
23084
|
+
candidate2 = await transport.updateSessionMetadata(candidateID, selectionMetadata(candidate2, expectedSource.model, expectedSource.variant));
|
|
23004
23085
|
}
|
|
23005
|
-
if (!isDeepStrictEqual(
|
|
23006
|
-
|
|
23086
|
+
if (!isDeepStrictEqual(candidate2.permission ?? [], expectedSource.permission ?? [])) {
|
|
23087
|
+
candidate2 = await transport.updateSessionPermission(candidateID, expectedSource.permission ?? []);
|
|
23007
23088
|
}
|
|
23008
23089
|
const [derived, after, candidateStatus, sourceStatus] = await Promise.all([
|
|
23009
23090
|
read(candidateID),
|
|
@@ -23011,7 +23092,7 @@ async function deriveOpenCodeHistory(options) {
|
|
|
23011
23092
|
transport.getStatus(candidateID),
|
|
23012
23093
|
transport.getStatus(source.id)
|
|
23013
23094
|
]);
|
|
23014
|
-
if (derived.session.id !== candidateID ||
|
|
23095
|
+
if (derived.session.id !== candidateID || candidate2.id !== candidateID || derived.session.directory !== before.session.directory || candidateStatus.type !== "idle" || sourceStatus.type !== "idle" || !isDeepStrictEqual(semanticHistory(derived.snapshot), expectedHistory) || !isDeepStrictEqual(sourceState(after), expectedSource) || !isDeepStrictEqual(derived.model, expectedSource.model) || derived.variant !== expectedSource.variant || !isDeepStrictEqual(derived.session.permission ?? [], expectedSource.permission ?? [])) {
|
|
23015
23096
|
throw new OpenCodeTransportError("protocolError", "OpenCode derived history, source or configuration changed during Fork");
|
|
23016
23097
|
}
|
|
23017
23098
|
return derived.session;
|
|
@@ -24148,9 +24229,9 @@ var OpenCodeHarnessSession = class {
|
|
|
24148
24229
|
if (active.userMessageID)
|
|
24149
24230
|
return;
|
|
24150
24231
|
const candidates = messages.filter(({ info }) => info.role === "user" && !active.preexistingUserMessageIds.has(info.id));
|
|
24151
|
-
const [
|
|
24152
|
-
if (candidates.length === 1 &&
|
|
24153
|
-
this.#bindUserMessage(active,
|
|
24232
|
+
const [candidate2] = candidates;
|
|
24233
|
+
if (candidates.length === 1 && candidate2) {
|
|
24234
|
+
this.#bindUserMessage(active, candidate2.info.id);
|
|
24154
24235
|
return;
|
|
24155
24236
|
}
|
|
24156
24237
|
const parents = new Set(messages.filter(({ info }) => info.role === "assistant").map(({ info }) => info.parentID));
|
|
@@ -24368,8 +24449,8 @@ var OpenCodeAdapter = class {
|
|
|
24368
24449
|
input,
|
|
24369
24450
|
providers,
|
|
24370
24451
|
toolOutputLimit: this.#toolOutputLimit,
|
|
24371
|
-
onCreated: (
|
|
24372
|
-
createdForCleanup =
|
|
24452
|
+
onCreated: (candidate2) => {
|
|
24453
|
+
createdForCleanup = candidate2;
|
|
24373
24454
|
}
|
|
24374
24455
|
});
|
|
24375
24456
|
}
|
|
@@ -24436,7 +24517,7 @@ async function detectOpenCode(options) {
|
|
|
24436
24517
|
}
|
|
24437
24518
|
|
|
24438
24519
|
// dist/v2/adapter.js
|
|
24439
|
-
import
|
|
24520
|
+
import fs7 from "node:fs";
|
|
24440
24521
|
import { isDeepStrictEqual as isDeepStrictEqual2 } from "node:util";
|
|
24441
24522
|
|
|
24442
24523
|
// dist/v2/state.js
|
|
@@ -24511,7 +24592,7 @@ function v2Permissions(current = [], mode) {
|
|
|
24511
24592
|
}
|
|
24512
24593
|
function v2State(session, catalog, policy) {
|
|
24513
24594
|
const model = session.model ? encodeOpenCodeModelRef({ providerID: session.model.providerID, modelID: session.model.id }) : void 0;
|
|
24514
|
-
const entry = catalog.models.find((
|
|
24595
|
+
const entry = catalog.models.find((candidate2) => candidate2.ref.id === model?.id);
|
|
24515
24596
|
const mode = session.permissions?.findLast((rule) => rule.action === "*" && rule.resource === "*");
|
|
24516
24597
|
return {
|
|
24517
24598
|
nativeRef: v2Ref(session, policy),
|
|
@@ -26544,6 +26625,110 @@ function terminalItemOutcome(outcome) {
|
|
|
26544
26625
|
return outcome.status === "unknown" ? { status: "failed", error: failure(outcome.reason, "protocolError") } : outcome;
|
|
26545
26626
|
}
|
|
26546
26627
|
|
|
26628
|
+
// dist/v2/session-import.js
|
|
26629
|
+
import fs6 from "node:fs";
|
|
26630
|
+
import path11 from "node:path";
|
|
26631
|
+
|
|
26632
|
+
// ../../harness-adapter/dist/session-import.js
|
|
26633
|
+
function sessionImportTitle(value, maxLength = HARNESS_SESSION_IMPORT_TITLE_MAX_LENGTH) {
|
|
26634
|
+
if (typeof value !== "string")
|
|
26635
|
+
return null;
|
|
26636
|
+
const normalized = value.replaceAll("\0", "").replaceAll(/\s+/gu, " ").trim();
|
|
26637
|
+
if (!normalized)
|
|
26638
|
+
return null;
|
|
26639
|
+
if (normalized.length <= maxLength)
|
|
26640
|
+
return normalized;
|
|
26641
|
+
const characters = [...normalized];
|
|
26642
|
+
if (characters.length <= maxLength)
|
|
26643
|
+
return normalized;
|
|
26644
|
+
return `${characters.slice(0, maxLength - 1).join("").trimEnd()}…`;
|
|
26645
|
+
}
|
|
26646
|
+
function sessionImportCandidate(input) {
|
|
26647
|
+
const time3 = typeof input.updatedAt === "number" ? input.updatedAt : typeof input.updatedAt === "string" ? Date.parse(input.updatedAt) : Number.NaN;
|
|
26648
|
+
const parsed = harnessSessionImportCandidateSchema.safeParse({
|
|
26649
|
+
nativeSessionId: input.nativeSessionId,
|
|
26650
|
+
cwd: input.cwd,
|
|
26651
|
+
title: typeof input.title === "string" && input.title.trim().length > 0 ? input.title : null,
|
|
26652
|
+
updatedAt: Math.floor(time3),
|
|
26653
|
+
// Unknown must stay unknown; only an explicit boolean is a native statement.
|
|
26654
|
+
running: typeof input.running === "boolean" ? input.running : null
|
|
26655
|
+
});
|
|
26656
|
+
return parsed.success ? parsed.data : null;
|
|
26657
|
+
}
|
|
26658
|
+
|
|
26659
|
+
// dist/v2/session-import.js
|
|
26660
|
+
var PAGE_SIZE = 200;
|
|
26661
|
+
var MAX_PAGES = 1e4;
|
|
26662
|
+
function existingDirectory(directory) {
|
|
26663
|
+
if (typeof directory !== "string" || !path11.isAbsolute(directory))
|
|
26664
|
+
return null;
|
|
26665
|
+
try {
|
|
26666
|
+
return fs6.statSync(directory).isDirectory() ? directory : null;
|
|
26667
|
+
} catch {
|
|
26668
|
+
return null;
|
|
26669
|
+
}
|
|
26670
|
+
}
|
|
26671
|
+
function candidate(info, active) {
|
|
26672
|
+
if (info.parentID || info.time.archived !== void 0)
|
|
26673
|
+
return null;
|
|
26674
|
+
const cwd = existingDirectory(info.location.directory);
|
|
26675
|
+
if (!cwd)
|
|
26676
|
+
return null;
|
|
26677
|
+
return sessionImportCandidate({
|
|
26678
|
+
nativeSessionId: info.id,
|
|
26679
|
+
cwd,
|
|
26680
|
+
title: sessionImportTitle(info.title),
|
|
26681
|
+
updatedAt: info.time.updated,
|
|
26682
|
+
// This server only knows its own executions; another process may still hold the Session.
|
|
26683
|
+
running: active[info.id] ? true : null
|
|
26684
|
+
});
|
|
26685
|
+
}
|
|
26686
|
+
async function listV2SessionCandidates(client2) {
|
|
26687
|
+
const active = await client2.session.active();
|
|
26688
|
+
const candidates = /* @__PURE__ */ new Map();
|
|
26689
|
+
const cursors = /* @__PURE__ */ new Set();
|
|
26690
|
+
let cursor;
|
|
26691
|
+
for (let page = 0; page < MAX_PAGES; page += 1) {
|
|
26692
|
+
const response = await client2.session.list({
|
|
26693
|
+
limit: PAGE_SIZE,
|
|
26694
|
+
...cursor ? { cursor } : {}
|
|
26695
|
+
});
|
|
26696
|
+
for (const info of response.data) {
|
|
26697
|
+
const entry = candidate(info, active);
|
|
26698
|
+
if (entry)
|
|
26699
|
+
candidates.set(entry.nativeSessionId, entry);
|
|
26700
|
+
}
|
|
26701
|
+
const next = response.cursor.next;
|
|
26702
|
+
if (!next || cursors.has(next))
|
|
26703
|
+
break;
|
|
26704
|
+
cursors.add(next);
|
|
26705
|
+
cursor = next;
|
|
26706
|
+
}
|
|
26707
|
+
return [...candidates.values()];
|
|
26708
|
+
}
|
|
26709
|
+
async function resolveV2SessionCandidate(client2, nativeSessionId) {
|
|
26710
|
+
const active = await client2.session.active();
|
|
26711
|
+
const cursors = /* @__PURE__ */ new Set();
|
|
26712
|
+
let cursor;
|
|
26713
|
+
for (let page = 0; page < MAX_PAGES; page += 1) {
|
|
26714
|
+
const response = await client2.session.list({
|
|
26715
|
+
limit: PAGE_SIZE,
|
|
26716
|
+
...cursor ? { cursor } : {}
|
|
26717
|
+
});
|
|
26718
|
+
const info = response.data.find((entry) => entry.id === nativeSessionId);
|
|
26719
|
+
if (info) {
|
|
26720
|
+
const entry = candidate(info, active);
|
|
26721
|
+
return entry ? { candidate: entry, nativeRef: v2Ref(info, "default") } : null;
|
|
26722
|
+
}
|
|
26723
|
+
const next = response.cursor.next;
|
|
26724
|
+
if (!next || cursors.has(next))
|
|
26725
|
+
break;
|
|
26726
|
+
cursors.add(next);
|
|
26727
|
+
cursor = next;
|
|
26728
|
+
}
|
|
26729
|
+
return null;
|
|
26730
|
+
}
|
|
26731
|
+
|
|
26547
26732
|
// dist/v2/interactions.js
|
|
26548
26733
|
function permissionInteraction(request, turnId) {
|
|
26549
26734
|
return {
|
|
@@ -27175,9 +27360,42 @@ var V2Adapter = class {
|
|
|
27175
27360
|
this.#connections.delete(connection);
|
|
27176
27361
|
}
|
|
27177
27362
|
}
|
|
27363
|
+
sessionImport = {
|
|
27364
|
+
listCandidates: () => this.#discover((client2) => listV2SessionCandidates(client2)),
|
|
27365
|
+
resolveCandidate: async (nativeSessionId) => {
|
|
27366
|
+
const source = await this.#discover((client2) => resolveV2SessionCandidate(client2, nativeSessionId));
|
|
27367
|
+
if (!source.ok)
|
|
27368
|
+
return source;
|
|
27369
|
+
return source.value ? { ok: true, value: source.value } : {
|
|
27370
|
+
ok: false,
|
|
27371
|
+
error: failure("OpenCode Session is no longer importable", "sessionNotFound")
|
|
27372
|
+
};
|
|
27373
|
+
}
|
|
27374
|
+
};
|
|
27375
|
+
/** Read-only discovery on a private server: no Session is created, loaded or prompted. */
|
|
27376
|
+
async #discover(read) {
|
|
27377
|
+
if (this.#closed)
|
|
27378
|
+
return { ok: false, error: failure("OpenCode Adapter is closed", "invalidState") };
|
|
27379
|
+
const connection = new V2Connection(this.options, process.cwd());
|
|
27380
|
+
this.#connections.add(connection);
|
|
27381
|
+
try {
|
|
27382
|
+
const value = await read(await connection.client());
|
|
27383
|
+
if (this.#closed)
|
|
27384
|
+
throw new Error("OpenCode Adapter closed during Session discovery");
|
|
27385
|
+
return { ok: true, value };
|
|
27386
|
+
} catch {
|
|
27387
|
+
return {
|
|
27388
|
+
ok: false,
|
|
27389
|
+
error: this.#closed ? failure("OpenCode Adapter is closed", "invalidState") : failure("OpenCode sessions could not be read; check the installation and retry", "unavailable")
|
|
27390
|
+
};
|
|
27391
|
+
} finally {
|
|
27392
|
+
await connection.close();
|
|
27393
|
+
this.#connections.delete(connection);
|
|
27394
|
+
}
|
|
27395
|
+
}
|
|
27178
27396
|
async open(input) {
|
|
27179
27397
|
try {
|
|
27180
|
-
input = { ...input, cwd:
|
|
27398
|
+
input = { ...input, cwd: fs7.realpathSync(input.cwd) };
|
|
27181
27399
|
} catch (error51) {
|
|
27182
27400
|
return errorResult(error51);
|
|
27183
27401
|
}
|
|
@@ -27357,6 +27575,36 @@ var OpenCodeAdapter2 = class {
|
|
|
27357
27575
|
this.#adapters.add(adapter);
|
|
27358
27576
|
return adapter;
|
|
27359
27577
|
}
|
|
27578
|
+
sessionImport = {
|
|
27579
|
+
listCandidates: () => this.#discover((imports) => imports.listCandidates()),
|
|
27580
|
+
resolveCandidate: (nativeSessionId) => this.#discover((imports) => imports.resolveCandidate(nativeSessionId))
|
|
27581
|
+
};
|
|
27582
|
+
/** Session import follows the selected CLI's protocol, like every other operation. */
|
|
27583
|
+
async #discover(read) {
|
|
27584
|
+
if (this.#closed)
|
|
27585
|
+
return { ok: false, error: failure("OpenCode Adapter is closed", "invalidState") };
|
|
27586
|
+
let adapter;
|
|
27587
|
+
try {
|
|
27588
|
+
adapter = await this.#select();
|
|
27589
|
+
if (!(adapter instanceof V2Adapter))
|
|
27590
|
+
return {
|
|
27591
|
+
ok: false,
|
|
27592
|
+
// v1 answers per project only; there is no native listing across projects to import from.
|
|
27593
|
+
error: failure("OpenCode Session import requires OpenCode v2", "unsupported")
|
|
27594
|
+
};
|
|
27595
|
+
return await read(adapter.sessionImport);
|
|
27596
|
+
} catch (error51) {
|
|
27597
|
+
return {
|
|
27598
|
+
ok: false,
|
|
27599
|
+
error: this.#closed ? failure("OpenCode Adapter is closed", "invalidState") : normalize(error51)
|
|
27600
|
+
};
|
|
27601
|
+
} finally {
|
|
27602
|
+
if (adapter) {
|
|
27603
|
+
await adapter.close();
|
|
27604
|
+
this.#adapters.delete(adapter);
|
|
27605
|
+
}
|
|
27606
|
+
}
|
|
27607
|
+
}
|
|
27360
27608
|
async inspect(input = {}) {
|
|
27361
27609
|
let adapter;
|
|
27362
27610
|
try {
|
|
@@ -27413,7 +27661,7 @@ function normalize(error51) {
|
|
|
27413
27661
|
// dist/installation.js
|
|
27414
27662
|
import { realpath as realpath2 } from "node:fs/promises";
|
|
27415
27663
|
import { homedir as homedir3 } from "node:os";
|
|
27416
|
-
import
|
|
27664
|
+
import path12 from "node:path";
|
|
27417
27665
|
function createOpenCodeInstallation(environment, command) {
|
|
27418
27666
|
let update;
|
|
27419
27667
|
return createInstallationManager({
|
|
@@ -27434,8 +27682,8 @@ function createOpenCodeInstallation(environment, command) {
|
|
|
27434
27682
|
const release = JSON.parse(await fetchInstallationText("https://api.github.com/repos/anomalyco/opencode/releases/latest"));
|
|
27435
27683
|
latestVersion = installationVersion(release.tag_name);
|
|
27436
27684
|
const home = environment.HOME ?? environment.USERPROFILE ?? homedir3();
|
|
27437
|
-
const standard =
|
|
27438
|
-
canUpdate = process.platform !== "win32" &&
|
|
27685
|
+
const standard = path12.join(home, ".opencode", "bin", process.platform === "win32" ? "opencode.exe" : "opencode");
|
|
27686
|
+
canUpdate = process.platform !== "win32" && path12.resolve(executable) === standard && await realpath2(executable) === standard;
|
|
27439
27687
|
update = async (version2) => {
|
|
27440
27688
|
await runInstallationCommand(executable, ["upgrade", version2, "--method", "curl"], environment, 3e5);
|
|
27441
27689
|
};
|