@liberseek/boft-cli-win32-arm64 0.7.7 → 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 +16598 -16440
- package/app/console-web.js +3628 -1789
- package/app/desktop-controller.mjs +16256 -351
- package/app/host-runtime.mjs +4360 -962
- package/app/plugins/antigravity/plugin.mjs +86 -2
- package/app/plugins/claude-code/plugin.mjs +399 -102
- package/app/plugins/codebuddy/plugin.mjs +733 -136
- package/app/plugins/cursor-cli/plugin.mjs +436 -122
- package/app/plugins/deepseek-harness/plugin.mjs +87 -2
- package/app/plugins/enabled.json +2 -1
- package/app/plugins/grok/plugin.mjs +464 -58
- package/app/plugins/hermes/plugin.mjs +3307 -7685
- package/app/plugins/kimi-code/plugin.mjs +376 -43
- package/app/plugins/kiro-cli/plugin.mjs +390 -48
- package/app/plugins/muse/plugin.mjs +86 -2
- package/app/plugins/omp/plugin.mjs +539 -105
- package/app/plugins/opencode/plugin.mjs +333 -79
- package/app/plugins/pi/plugin.mjs +200 -57
- package/app/plugins/qoder/plugin.mjs +317 -38
- package/app/plugins/qoder-cn/plugin.mjs +317 -38
- package/app/plugins/workbuddy/plugin.mjs +704 -98
- 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 +2766 -695
- 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 +2 -2
|
@@ -508,16 +508,16 @@ var Diff = class {
|
|
|
508
508
|
}
|
|
509
509
|
}
|
|
510
510
|
}
|
|
511
|
-
addToPath(
|
|
512
|
-
const last =
|
|
511
|
+
addToPath(path8, added, removed, oldPosInc, options) {
|
|
512
|
+
const last = path8.lastComponent;
|
|
513
513
|
if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {
|
|
514
514
|
return {
|
|
515
|
-
oldPos:
|
|
515
|
+
oldPos: path8.oldPos + oldPosInc,
|
|
516
516
|
lastComponent: { count: last.count + 1, added, removed, previousComponent: last.previousComponent }
|
|
517
517
|
};
|
|
518
518
|
} else {
|
|
519
519
|
return {
|
|
520
|
-
oldPos:
|
|
520
|
+
oldPos: path8.oldPos + oldPosInc,
|
|
521
521
|
lastComponent: { count: 1, added, removed, previousComponent: last }
|
|
522
522
|
};
|
|
523
523
|
}
|
|
@@ -930,8 +930,8 @@ function splitLines(text) {
|
|
|
930
930
|
|
|
931
931
|
// dist/omp-adapter.js
|
|
932
932
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
933
|
-
import { realpath as
|
|
934
|
-
import
|
|
933
|
+
import { realpath as realpath3, stat as stat2 } from "node:fs/promises";
|
|
934
|
+
import path6 from "node:path";
|
|
935
935
|
|
|
936
936
|
// ../../../node_modules/zod/v4/classic/external.js
|
|
937
937
|
var external_exports = {};
|
|
@@ -1699,10 +1699,10 @@ function mergeDefs(...defs) {
|
|
|
1699
1699
|
function cloneDef(schema) {
|
|
1700
1700
|
return mergeDefs(schema._zod.def);
|
|
1701
1701
|
}
|
|
1702
|
-
function getElementAtPath(obj,
|
|
1703
|
-
if (!
|
|
1702
|
+
function getElementAtPath(obj, path8) {
|
|
1703
|
+
if (!path8)
|
|
1704
1704
|
return obj;
|
|
1705
|
-
return
|
|
1705
|
+
return path8.reduce((acc, key) => acc?.[key], obj);
|
|
1706
1706
|
}
|
|
1707
1707
|
function promiseAllObject(promisesObj) {
|
|
1708
1708
|
const keys = Object.keys(promisesObj);
|
|
@@ -2111,11 +2111,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
2111
2111
|
}
|
|
2112
2112
|
return false;
|
|
2113
2113
|
}
|
|
2114
|
-
function prefixIssues(
|
|
2114
|
+
function prefixIssues(path8, issues) {
|
|
2115
2115
|
return issues.map((iss) => {
|
|
2116
2116
|
var _a3;
|
|
2117
2117
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
2118
|
-
iss.path.unshift(
|
|
2118
|
+
iss.path.unshift(path8);
|
|
2119
2119
|
return iss;
|
|
2120
2120
|
});
|
|
2121
2121
|
}
|
|
@@ -2262,16 +2262,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
|
|
|
2262
2262
|
}
|
|
2263
2263
|
function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
2264
2264
|
const fieldErrors = { _errors: [] };
|
|
2265
|
-
const processError = (error52,
|
|
2265
|
+
const processError = (error52, path8 = []) => {
|
|
2266
2266
|
for (const issue2 of error52.issues) {
|
|
2267
2267
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
2268
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
2268
|
+
issue2.errors.map((issues) => processError({ issues }, [...path8, ...issue2.path]));
|
|
2269
2269
|
} else if (issue2.code === "invalid_key") {
|
|
2270
|
-
processError({ issues: issue2.issues }, [...
|
|
2270
|
+
processError({ issues: issue2.issues }, [...path8, ...issue2.path]);
|
|
2271
2271
|
} else if (issue2.code === "invalid_element") {
|
|
2272
|
-
processError({ issues: issue2.issues }, [...
|
|
2272
|
+
processError({ issues: issue2.issues }, [...path8, ...issue2.path]);
|
|
2273
2273
|
} else {
|
|
2274
|
-
const fullpath = [...
|
|
2274
|
+
const fullpath = [...path8, ...issue2.path];
|
|
2275
2275
|
if (fullpath.length === 0) {
|
|
2276
2276
|
fieldErrors._errors.push(mapper(issue2));
|
|
2277
2277
|
} else {
|
|
@@ -2298,17 +2298,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
|
2298
2298
|
}
|
|
2299
2299
|
function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
2300
2300
|
const result = { errors: [] };
|
|
2301
|
-
const processError = (error52,
|
|
2301
|
+
const processError = (error52, path8 = []) => {
|
|
2302
2302
|
var _a3, _b;
|
|
2303
2303
|
for (const issue2 of error52.issues) {
|
|
2304
2304
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
2305
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
2305
|
+
issue2.errors.map((issues) => processError({ issues }, [...path8, ...issue2.path]));
|
|
2306
2306
|
} else if (issue2.code === "invalid_key") {
|
|
2307
|
-
processError({ issues: issue2.issues }, [...
|
|
2307
|
+
processError({ issues: issue2.issues }, [...path8, ...issue2.path]);
|
|
2308
2308
|
} else if (issue2.code === "invalid_element") {
|
|
2309
|
-
processError({ issues: issue2.issues }, [...
|
|
2309
|
+
processError({ issues: issue2.issues }, [...path8, ...issue2.path]);
|
|
2310
2310
|
} else {
|
|
2311
|
-
const fullpath = [...
|
|
2311
|
+
const fullpath = [...path8, ...issue2.path];
|
|
2312
2312
|
if (fullpath.length === 0) {
|
|
2313
2313
|
result.errors.push(mapper(issue2));
|
|
2314
2314
|
continue;
|
|
@@ -2340,8 +2340,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
|
2340
2340
|
}
|
|
2341
2341
|
function toDotPath(_path) {
|
|
2342
2342
|
const segs = [];
|
|
2343
|
-
const
|
|
2344
|
-
for (const seg of
|
|
2343
|
+
const path8 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
2344
|
+
for (const seg of path8) {
|
|
2345
2345
|
if (typeof seg === "number")
|
|
2346
2346
|
segs.push(`[${seg}]`);
|
|
2347
2347
|
else if (typeof seg === "symbol")
|
|
@@ -15033,13 +15033,13 @@ function resolveRef(ref, ctx) {
|
|
|
15033
15033
|
if (!ref.startsWith("#")) {
|
|
15034
15034
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
15035
15035
|
}
|
|
15036
|
-
const
|
|
15037
|
-
if (
|
|
15036
|
+
const path8 = ref.slice(1).split("/").filter(Boolean);
|
|
15037
|
+
if (path8.length === 0) {
|
|
15038
15038
|
return ctx.rootSchema;
|
|
15039
15039
|
}
|
|
15040
15040
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
15041
|
-
if (
|
|
15042
|
-
const key =
|
|
15041
|
+
if (path8[0] === defsKey) {
|
|
15042
|
+
const key = path8[1];
|
|
15043
15043
|
if (!key || !ctx.defs[key]) {
|
|
15044
15044
|
throw new Error(`Reference not found: ${ref}`);
|
|
15045
15045
|
}
|
|
@@ -15527,6 +15527,10 @@ var hostTurnIdSchema = opaqueIdSchema.brand();
|
|
|
15527
15527
|
var hostItemIdSchema = opaqueIdSchema.brand();
|
|
15528
15528
|
var hostInteractionIdSchema = opaqueIdSchema.brand();
|
|
15529
15529
|
|
|
15530
|
+
// ../../shared-contracts/dist/thread-prewarm.js
|
|
15531
|
+
var threadPrewarmDiscardParamsSchema = external_exports.object({ threadId: hostThreadIdSchema });
|
|
15532
|
+
var threadPrewarmDiscardResultSchema = external_exports.object({ discarded: external_exports.boolean() });
|
|
15533
|
+
|
|
15530
15534
|
// ../../shared-contracts/dist/harness-plugins.js
|
|
15531
15535
|
var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
|
|
15532
15536
|
var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
|
|
@@ -15594,6 +15598,9 @@ var consoleOpenResultSchema = external_exports.strictObject({
|
|
|
15594
15598
|
url: external_exports.string().max(2048).regex(/^http:\/\/(?:127\.0\.0\.1|localhost):\d{1,5}\/(?:\?.*)?$/u)
|
|
15595
15599
|
});
|
|
15596
15600
|
var CONSOLE_HOST_METHODS = Object.freeze([
|
|
15601
|
+
"codexhost/console/remote-connections",
|
|
15602
|
+
"codexhost/runtime/status",
|
|
15603
|
+
"codexhost/remote/ssh-setup",
|
|
15597
15604
|
"codexhost/harness/plugins/list",
|
|
15598
15605
|
"codexhost/harness/display-settings/get",
|
|
15599
15606
|
"codexhost/harness/display-settings/set",
|
|
@@ -16222,7 +16229,10 @@ var harnessInstallationStateSchema = external_exports.object({
|
|
|
16222
16229
|
latestVersion: external_exports.string().min(1).max(128),
|
|
16223
16230
|
updateAvailable: external_exports.boolean(),
|
|
16224
16231
|
canUpdate: external_exports.boolean(),
|
|
16225
|
-
|
|
16232
|
+
// Adapter-owned diagnostic text; UI uses messageCode rather than displaying it verbatim.
|
|
16233
|
+
message: external_exports.string().max(2048).optional(),
|
|
16234
|
+
messageCode: external_exports.string().min(1).max(128).optional(),
|
|
16235
|
+
latestVersionKind: external_exports.enum(["unknown", "tracking-branch"]).optional()
|
|
16226
16236
|
}).strict();
|
|
16227
16237
|
|
|
16228
16238
|
// ../../shared-contracts/dist/codex-accounts.js
|
|
@@ -16517,7 +16527,7 @@ var updateStatusSchema = external_exports.strictObject({
|
|
|
16517
16527
|
}
|
|
16518
16528
|
});
|
|
16519
16529
|
var updateEmptyParamsSchema = external_exports.strictObject({});
|
|
16520
|
-
var githubReleaseNotesUrlSchema = external_exports.string().max(300).regex(/^https:\/\/github\.com\/LiberSeek\/BOFT-CLI\/releases\/tag\/v[0-9A-Za-z.+-]+$/u, "release notes URL must identify a codexhost GitHub Release");
|
|
16530
|
+
var githubReleaseNotesUrlSchema = external_exports.string().max(300).regex(/^https:\/\/github\.com\/(LiberSeek|LIBERSEEK)\/BOFT-CLI\/releases\/tag\/v[0-9A-Za-z.+-]+$/u, "release notes URL must identify a codexhost GitHub Release");
|
|
16521
16531
|
var updateCheckResultSchema = external_exports.strictObject({
|
|
16522
16532
|
currentVersion: updateSemanticVersionSchema,
|
|
16523
16533
|
installation: updateInstallationSchema.nullable(),
|
|
@@ -16536,6 +16546,80 @@ var updateStatusResultSchema = external_exports.strictObject({
|
|
|
16536
16546
|
status: updateStatusSchema.nullable()
|
|
16537
16547
|
});
|
|
16538
16548
|
|
|
16549
|
+
// ../../shared-contracts/dist/remote-runtime.js
|
|
16550
|
+
var remoteUpdatePhaseSchema = external_exports.enum([
|
|
16551
|
+
"idle",
|
|
16552
|
+
"installing",
|
|
16553
|
+
"restarting",
|
|
16554
|
+
"succeeded",
|
|
16555
|
+
"failed"
|
|
16556
|
+
]);
|
|
16557
|
+
var runtimeStatusSchema = external_exports.object({
|
|
16558
|
+
runningVersion: external_exports.string().nullable(),
|
|
16559
|
+
installedVersion: external_exports.string().nullable(),
|
|
16560
|
+
restartRequired: external_exports.boolean(),
|
|
16561
|
+
remote: external_exports.boolean(),
|
|
16562
|
+
updateSupported: external_exports.boolean(),
|
|
16563
|
+
update: external_exports.object({
|
|
16564
|
+
phase: remoteUpdatePhaseSchema,
|
|
16565
|
+
targetVersion: external_exports.string().nullable(),
|
|
16566
|
+
error: external_exports.string().nullable()
|
|
16567
|
+
})
|
|
16568
|
+
});
|
|
16569
|
+
var remoteUpdateParamsSchema = external_exports.object({
|
|
16570
|
+
version: external_exports.string().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/u)
|
|
16571
|
+
}).strict();
|
|
16572
|
+
var remoteSshSetupParamsSchema = external_exports.object({
|
|
16573
|
+
hostname: external_exports.string().min(1).max(1024).refine((value) => !value.startsWith("-") && !/\s/u.test(value)),
|
|
16574
|
+
port: external_exports.number().int().min(1).max(65535).nullable(),
|
|
16575
|
+
identity: external_exports.string().max(4096).nullable(),
|
|
16576
|
+
action: external_exports.enum(["inspect", "install", "update", "repair", "uninstall"]),
|
|
16577
|
+
uninstallPackage: external_exports.boolean().optional(),
|
|
16578
|
+
version: external_exports.string().regex(/^\d+\.\d+\.\d+$/u).nullable()
|
|
16579
|
+
}).strict();
|
|
16580
|
+
var remoteSshSetupResultSchema = external_exports.object({ state: external_exports.enum(["installed", "not-installed"]) }).strict();
|
|
16581
|
+
|
|
16582
|
+
// ../../shared-contracts/dist/remote-connections.js
|
|
16583
|
+
var hostId = external_exports.string().min(1).max(1024);
|
|
16584
|
+
var codexSshConnectionSchema = external_exports.object({
|
|
16585
|
+
hostId,
|
|
16586
|
+
displayName: external_exports.string().min(1).max(1024),
|
|
16587
|
+
source: external_exports.enum(["codex-managed", "discovered"]),
|
|
16588
|
+
sshAlias: external_exports.string().max(1024).nullable(),
|
|
16589
|
+
sshHost: external_exports.string().min(1).max(1024),
|
|
16590
|
+
sshPort: external_exports.number().int().min(1).max(65535).nullable(),
|
|
16591
|
+
identity: external_exports.string().max(4096).nullable(),
|
|
16592
|
+
autoConnect: external_exports.boolean(),
|
|
16593
|
+
connectionAnalyticsId: external_exports.string().max(1024).optional()
|
|
16594
|
+
});
|
|
16595
|
+
var codexSshDraftSchema = external_exports.strictObject({
|
|
16596
|
+
displayName: external_exports.string().min(1).max(1024),
|
|
16597
|
+
hostname: external_exports.string().min(1).max(1024),
|
|
16598
|
+
sshPort: external_exports.number().int().min(1).max(65535).nullable(),
|
|
16599
|
+
identity: external_exports.string().max(4096).nullable()
|
|
16600
|
+
});
|
|
16601
|
+
var remoteConnectionsRequestSchema = external_exports.discriminatedUnion("action", [
|
|
16602
|
+
external_exports.strictObject({ action: external_exports.literal("list") }),
|
|
16603
|
+
external_exports.strictObject({
|
|
16604
|
+
action: external_exports.literal("save"),
|
|
16605
|
+
draft: codexSshDraftSchema,
|
|
16606
|
+
previous: codexSshConnectionSchema.nullable()
|
|
16607
|
+
}),
|
|
16608
|
+
external_exports.strictObject({ action: external_exports.literal("remove"), previous: codexSshConnectionSchema }),
|
|
16609
|
+
external_exports.strictObject({ action: external_exports.literal("connect"), hostId, enabled: external_exports.boolean() }),
|
|
16610
|
+
external_exports.strictObject({ action: external_exports.literal("state"), hostId }),
|
|
16611
|
+
external_exports.strictObject({ action: external_exports.literal("runtime"), hostId }),
|
|
16612
|
+
external_exports.strictObject({
|
|
16613
|
+
action: external_exports.literal("update"),
|
|
16614
|
+
hostId: hostId.refine((id) => id !== "local"),
|
|
16615
|
+
version: remoteUpdateParamsSchema.shape.version
|
|
16616
|
+
})
|
|
16617
|
+
]);
|
|
16618
|
+
var remoteConnectionsReplySchema = external_exports.union([
|
|
16619
|
+
external_exports.strictObject({ result: jsonValueSchema }),
|
|
16620
|
+
external_exports.strictObject({ error: external_exports.strictObject({ code: external_exports.number().int(), message: external_exports.string() }) })
|
|
16621
|
+
]);
|
|
16622
|
+
|
|
16539
16623
|
// ../../shared-contracts/dist/index.js
|
|
16540
16624
|
var workspaceContractVersionSchema = external_exports.literal(WORKSPACE_CONTRACT_VERSION);
|
|
16541
16625
|
|
|
@@ -17365,6 +17449,330 @@ async function verifyOmpSessionCwd(input) {
|
|
|
17365
17449
|
}
|
|
17366
17450
|
}
|
|
17367
17451
|
|
|
17452
|
+
// dist/session-import.js
|
|
17453
|
+
import { createReadStream as createReadStream2 } from "node:fs";
|
|
17454
|
+
import { opendir, realpath as realpath2, stat } from "node:fs/promises";
|
|
17455
|
+
import os2 from "node:os";
|
|
17456
|
+
import path4 from "node:path";
|
|
17457
|
+
import { createInterface } from "node:readline";
|
|
17458
|
+
|
|
17459
|
+
// ../../harness-adapter/dist/session-import.js
|
|
17460
|
+
import { lstat } from "node:fs/promises";
|
|
17461
|
+
var SessionImportChangedError = class extends Error {
|
|
17462
|
+
constructor(message3 = "Native Session changed during discovery; refresh and retry") {
|
|
17463
|
+
super(message3);
|
|
17464
|
+
this.name = "SessionImportChangedError";
|
|
17465
|
+
}
|
|
17466
|
+
};
|
|
17467
|
+
function isMissingFileError(error51) {
|
|
17468
|
+
return typeof error51 === "object" && error51 !== null && "code" in error51 && error51.code === "ENOENT";
|
|
17469
|
+
}
|
|
17470
|
+
function sameFileFingerprint(left, right) {
|
|
17471
|
+
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;
|
|
17472
|
+
}
|
|
17473
|
+
var STORAGE_ACCESS_ERRORS = /* @__PURE__ */ new Set(["EACCES", "EPERM", "EIO", "EMFILE", "ENFILE"]);
|
|
17474
|
+
function isStorageAccessError(error51) {
|
|
17475
|
+
return typeof error51 === "object" && error51 !== null && "code" in error51 && typeof error51.code === "string" && STORAGE_ACCESS_ERRORS.has(error51.code);
|
|
17476
|
+
}
|
|
17477
|
+
async function optionalLstat(file2) {
|
|
17478
|
+
try {
|
|
17479
|
+
return await lstat(file2);
|
|
17480
|
+
} catch (error51) {
|
|
17481
|
+
if (isMissingFileError(error51))
|
|
17482
|
+
return null;
|
|
17483
|
+
throw error51;
|
|
17484
|
+
}
|
|
17485
|
+
}
|
|
17486
|
+
async function readStableFiles(files, read) {
|
|
17487
|
+
const before = await Promise.all(files.map(optionalLstat));
|
|
17488
|
+
const value = await read(before);
|
|
17489
|
+
const after = await Promise.all(files.map(optionalLstat));
|
|
17490
|
+
if (before.some((info, index) => !sameFileFingerprint(info, after[index] ?? null)))
|
|
17491
|
+
throw new SessionImportChangedError();
|
|
17492
|
+
return value;
|
|
17493
|
+
}
|
|
17494
|
+
function sessionImportTitle(value, maxLength = HARNESS_SESSION_IMPORT_TITLE_MAX_LENGTH) {
|
|
17495
|
+
if (typeof value !== "string")
|
|
17496
|
+
return null;
|
|
17497
|
+
const normalized = value.replaceAll("\0", "").replaceAll(/\s+/gu, " ").trim();
|
|
17498
|
+
if (!normalized)
|
|
17499
|
+
return null;
|
|
17500
|
+
if (normalized.length <= maxLength)
|
|
17501
|
+
return normalized;
|
|
17502
|
+
const characters = [...normalized];
|
|
17503
|
+
if (characters.length <= maxLength)
|
|
17504
|
+
return normalized;
|
|
17505
|
+
return `${characters.slice(0, maxLength - 1).join("").trimEnd()}…`;
|
|
17506
|
+
}
|
|
17507
|
+
function sessionImportCandidate(input) {
|
|
17508
|
+
const time3 = typeof input.updatedAt === "number" ? input.updatedAt : typeof input.updatedAt === "string" ? Date.parse(input.updatedAt) : Number.NaN;
|
|
17509
|
+
const parsed = harnessSessionImportCandidateSchema.safeParse({
|
|
17510
|
+
nativeSessionId: input.nativeSessionId,
|
|
17511
|
+
cwd: input.cwd,
|
|
17512
|
+
title: typeof input.title === "string" && input.title.trim().length > 0 ? input.title : null,
|
|
17513
|
+
updatedAt: Math.floor(time3),
|
|
17514
|
+
// Unknown must stay unknown; only an explicit boolean is a native statement.
|
|
17515
|
+
running: typeof input.running === "boolean" ? input.running : null
|
|
17516
|
+
});
|
|
17517
|
+
return parsed.success ? parsed.data : null;
|
|
17518
|
+
}
|
|
17519
|
+
var SessionImportScope = class {
|
|
17520
|
+
#abort = new AbortController();
|
|
17521
|
+
#options;
|
|
17522
|
+
#pending = /* @__PURE__ */ new Set();
|
|
17523
|
+
constructor(options) {
|
|
17524
|
+
this.#options = options;
|
|
17525
|
+
}
|
|
17526
|
+
#closed() {
|
|
17527
|
+
return {
|
|
17528
|
+
ok: false,
|
|
17529
|
+
error: { code: "invalidState", message: this.#options.closedMessage, retryable: false }
|
|
17530
|
+
};
|
|
17531
|
+
}
|
|
17532
|
+
read(operation) {
|
|
17533
|
+
const signal = this.#abort.signal;
|
|
17534
|
+
if (signal.aborted)
|
|
17535
|
+
return Promise.resolve(this.#closed());
|
|
17536
|
+
let started;
|
|
17537
|
+
try {
|
|
17538
|
+
started = operation(signal);
|
|
17539
|
+
} catch (error51) {
|
|
17540
|
+
started = Promise.reject(error51 instanceof Error ? error51 : new Error("Session read failed"));
|
|
17541
|
+
}
|
|
17542
|
+
const request = started.then((value) => signal.aborted ? this.#closed() : { ok: true, value }).catch(() => signal.aborted ? this.#closed() : {
|
|
17543
|
+
ok: false,
|
|
17544
|
+
error: {
|
|
17545
|
+
code: "unavailable",
|
|
17546
|
+
message: this.#options.unavailableMessage,
|
|
17547
|
+
retryable: true
|
|
17548
|
+
}
|
|
17549
|
+
}).finally(() => this.#pending.delete(request));
|
|
17550
|
+
this.#pending.add(request);
|
|
17551
|
+
return request;
|
|
17552
|
+
}
|
|
17553
|
+
/** `read` for `resolveCandidate`: a null source is the selected Session having disappeared. */
|
|
17554
|
+
async resolve(operation) {
|
|
17555
|
+
const result = await this.read(operation);
|
|
17556
|
+
if (!result.ok)
|
|
17557
|
+
return result;
|
|
17558
|
+
return result.value ? { ok: true, value: result.value } : {
|
|
17559
|
+
ok: false,
|
|
17560
|
+
error: {
|
|
17561
|
+
code: "sessionNotFound",
|
|
17562
|
+
message: this.#options.notFoundMessage,
|
|
17563
|
+
retryable: false
|
|
17564
|
+
}
|
|
17565
|
+
};
|
|
17566
|
+
}
|
|
17567
|
+
/** Idempotent. Resolves after every started read has settled. */
|
|
17568
|
+
async close() {
|
|
17569
|
+
this.#abort.abort();
|
|
17570
|
+
await Promise.allSettled(this.#pending);
|
|
17571
|
+
}
|
|
17572
|
+
};
|
|
17573
|
+
|
|
17574
|
+
// dist/session-import.js
|
|
17575
|
+
function isRecord6(value) {
|
|
17576
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
17577
|
+
}
|
|
17578
|
+
function expandDirectory(value, home) {
|
|
17579
|
+
return path4.resolve(value === "~" ? home : value.startsWith(`~${path4.sep}`) || value.startsWith("~/") ? path4.join(home, value.slice(2)) : value);
|
|
17580
|
+
}
|
|
17581
|
+
function ompSessionImportDirectory(environment) {
|
|
17582
|
+
const home = (process.platform === "win32" ? environment.USERPROFILE : environment.HOME) || os2.homedir();
|
|
17583
|
+
const custom2 = environment.PI_CODING_AGENT_SESSION_DIR;
|
|
17584
|
+
if (custom2)
|
|
17585
|
+
return { directory: expandDirectory(custom2, home), flat: true };
|
|
17586
|
+
const agent = environment.PI_CODING_AGENT_DIR;
|
|
17587
|
+
return {
|
|
17588
|
+
directory: path4.join(agent ? expandDirectory(agent, home) : path4.join(home, ".omp", "agent"), "sessions"),
|
|
17589
|
+
flat: false
|
|
17590
|
+
};
|
|
17591
|
+
}
|
|
17592
|
+
function messageText(content) {
|
|
17593
|
+
if (typeof content === "string")
|
|
17594
|
+
return content;
|
|
17595
|
+
if (!Array.isArray(content))
|
|
17596
|
+
return "";
|
|
17597
|
+
return content.filter((part) => isRecord6(part) && part.type === "text" && typeof part.text === "string").map((part) => String(part.text)).join(" ");
|
|
17598
|
+
}
|
|
17599
|
+
async function readFacts(file2, signal) {
|
|
17600
|
+
const stream = createReadStream2(file2, { encoding: "utf8", signal });
|
|
17601
|
+
const lines = createInterface({ input: stream, crlfDelay: Infinity });
|
|
17602
|
+
let header = null;
|
|
17603
|
+
let nativeTitle = null;
|
|
17604
|
+
let firstPrompt = null;
|
|
17605
|
+
let updatedAt = null;
|
|
17606
|
+
let leafHasUser = false;
|
|
17607
|
+
const hasUserAncestry = /* @__PURE__ */ new Map();
|
|
17608
|
+
try {
|
|
17609
|
+
for await (const line of lines) {
|
|
17610
|
+
signal.throwIfAborted();
|
|
17611
|
+
if (!line.trim())
|
|
17612
|
+
continue;
|
|
17613
|
+
let entry;
|
|
17614
|
+
try {
|
|
17615
|
+
entry = JSON.parse(line);
|
|
17616
|
+
} catch {
|
|
17617
|
+
continue;
|
|
17618
|
+
}
|
|
17619
|
+
if (!isRecord6(entry))
|
|
17620
|
+
continue;
|
|
17621
|
+
if (entry.type === "title") {
|
|
17622
|
+
nativeTitle = sessionImportTitle(entry.title);
|
|
17623
|
+
continue;
|
|
17624
|
+
}
|
|
17625
|
+
if (entry.type === "session") {
|
|
17626
|
+
if (header)
|
|
17627
|
+
return null;
|
|
17628
|
+
if (typeof entry.id !== "string" || entry.id.length === 0 || typeof entry.cwd !== "string" || !path4.isAbsolute(entry.cwd))
|
|
17629
|
+
return null;
|
|
17630
|
+
header = { id: entry.id, cwd: entry.cwd };
|
|
17631
|
+
continue;
|
|
17632
|
+
}
|
|
17633
|
+
if (typeof entry.id !== "string" || entry.id.length === 0)
|
|
17634
|
+
continue;
|
|
17635
|
+
const message3 = isRecord6(entry.message) ? entry.message : null;
|
|
17636
|
+
const isUser = entry.type === "message" && message3?.role === "user";
|
|
17637
|
+
if (isUser)
|
|
17638
|
+
firstPrompt ??= sessionImportTitle(messageText(message3?.content));
|
|
17639
|
+
leafHasUser = isUser || typeof entry.parentId === "string" && hasUserAncestry.get(entry.parentId) === true;
|
|
17640
|
+
hasUserAncestry.set(entry.id, leafHasUser);
|
|
17641
|
+
if (entry.type === "message" && (message3?.role === "user" || message3?.role === "assistant")) {
|
|
17642
|
+
const time3 = typeof message3.timestamp === "number" ? message3.timestamp : typeof entry.timestamp === "string" ? Date.parse(entry.timestamp) : Number.NaN;
|
|
17643
|
+
if (Number.isFinite(time3) && time3 >= 0)
|
|
17644
|
+
updatedAt = time3;
|
|
17645
|
+
}
|
|
17646
|
+
}
|
|
17647
|
+
} finally {
|
|
17648
|
+
lines.close();
|
|
17649
|
+
stream.destroy();
|
|
17650
|
+
}
|
|
17651
|
+
if (!header || !leafHasUser)
|
|
17652
|
+
return null;
|
|
17653
|
+
return {
|
|
17654
|
+
nativeSessionId: header.id,
|
|
17655
|
+
cwd: header.cwd,
|
|
17656
|
+
title: nativeTitle ?? firstPrompt,
|
|
17657
|
+
updatedAt
|
|
17658
|
+
};
|
|
17659
|
+
}
|
|
17660
|
+
var OmpSessionImport = class {
|
|
17661
|
+
#location;
|
|
17662
|
+
#scope = new SessionImportScope({
|
|
17663
|
+
closedMessage: "Omp Session import is closed",
|
|
17664
|
+
unavailableMessage: "Omp sessions could not be read; close native clients, check storage access and retry",
|
|
17665
|
+
notFoundMessage: "Omp Session is no longer importable"
|
|
17666
|
+
});
|
|
17667
|
+
constructor(environment) {
|
|
17668
|
+
this.#location = ompSessionImportDirectory(environment);
|
|
17669
|
+
}
|
|
17670
|
+
listCandidates() {
|
|
17671
|
+
return this.#scope.read(async (signal) => [...(await this.#sources(signal)).values()].flatMap((sources) => (
|
|
17672
|
+
// One identity in two files cannot be resumed unambiguously.
|
|
17673
|
+
sources.length === 1 && sources[0] ? [sources[0].candidate] : []
|
|
17674
|
+
)));
|
|
17675
|
+
}
|
|
17676
|
+
resolveCandidate(nativeSessionId) {
|
|
17677
|
+
return this.#scope.resolve(async (signal) => {
|
|
17678
|
+
const sources = (await this.#sources(signal)).get(nativeSessionId);
|
|
17679
|
+
if (sources?.length !== 1 || !sources[0])
|
|
17680
|
+
return null;
|
|
17681
|
+
const source = await this.#source(sources[0].file, signal);
|
|
17682
|
+
return source?.nativeRef.nativeSessionId === nativeSessionId ? { candidate: source.candidate, nativeRef: source.nativeRef } : null;
|
|
17683
|
+
});
|
|
17684
|
+
}
|
|
17685
|
+
close() {
|
|
17686
|
+
return this.#scope.close();
|
|
17687
|
+
}
|
|
17688
|
+
async #sessionFiles(signal) {
|
|
17689
|
+
const { directory, flat } = this.#location;
|
|
17690
|
+
const info = await optionalLstat(directory);
|
|
17691
|
+
if (!info)
|
|
17692
|
+
return [];
|
|
17693
|
+
if (!info.isDirectory())
|
|
17694
|
+
throw new Error("Omp Session store is not a directory");
|
|
17695
|
+
const files = [];
|
|
17696
|
+
const visit = async (current, projectLevel) => {
|
|
17697
|
+
const entries = await opendir(current).catch((error51) => {
|
|
17698
|
+
if (isMissingFileError(error51))
|
|
17699
|
+
return null;
|
|
17700
|
+
throw error51;
|
|
17701
|
+
});
|
|
17702
|
+
if (!entries)
|
|
17703
|
+
return;
|
|
17704
|
+
for await (const entry of entries) {
|
|
17705
|
+
signal.throwIfAborted();
|
|
17706
|
+
if (projectLevel && entry.isDirectory())
|
|
17707
|
+
await visit(path4.join(current, entry.name), false);
|
|
17708
|
+
else if (!projectLevel && entry.isFile() && entry.name.endsWith(".jsonl"))
|
|
17709
|
+
files.push(path4.join(current, entry.name));
|
|
17710
|
+
}
|
|
17711
|
+
};
|
|
17712
|
+
await visit(directory, !flat);
|
|
17713
|
+
return files;
|
|
17714
|
+
}
|
|
17715
|
+
/** Session ID to every readable file claiming it. Files changing under the read are skipped. */
|
|
17716
|
+
async #sources(signal) {
|
|
17717
|
+
const found = /* @__PURE__ */ new Map();
|
|
17718
|
+
for (const file2 of await this.#sessionFiles(signal)) {
|
|
17719
|
+
signal.throwIfAborted();
|
|
17720
|
+
try {
|
|
17721
|
+
const source = await this.#source(file2, signal);
|
|
17722
|
+
if (!source)
|
|
17723
|
+
continue;
|
|
17724
|
+
const sources = found.get(source.nativeRef.nativeSessionId) ?? [];
|
|
17725
|
+
sources.push(source);
|
|
17726
|
+
found.set(source.nativeRef.nativeSessionId, sources);
|
|
17727
|
+
} catch (error51) {
|
|
17728
|
+
if (!(error51 instanceof SessionImportChangedError))
|
|
17729
|
+
throw error51;
|
|
17730
|
+
}
|
|
17731
|
+
}
|
|
17732
|
+
return found;
|
|
17733
|
+
}
|
|
17734
|
+
async #source(file2, signal) {
|
|
17735
|
+
signal.throwIfAborted();
|
|
17736
|
+
return readStableFiles([file2], async ([info]) => {
|
|
17737
|
+
if (!info?.isFile() || info.size === 0)
|
|
17738
|
+
return null;
|
|
17739
|
+
try {
|
|
17740
|
+
const facts = await readFacts(file2, signal);
|
|
17741
|
+
if (!facts)
|
|
17742
|
+
return null;
|
|
17743
|
+
const cwd = await realpath2(facts.cwd);
|
|
17744
|
+
if (!(await stat(cwd)).isDirectory())
|
|
17745
|
+
return null;
|
|
17746
|
+
const candidate = sessionImportCandidate({
|
|
17747
|
+
nativeSessionId: facts.nativeSessionId,
|
|
17748
|
+
cwd,
|
|
17749
|
+
title: facts.title,
|
|
17750
|
+
updatedAt: facts.updatedAt ?? info.mtimeMs
|
|
17751
|
+
// OMP has no cross-process activity marker: idleness cannot be established.
|
|
17752
|
+
});
|
|
17753
|
+
if (!candidate)
|
|
17754
|
+
return null;
|
|
17755
|
+
return {
|
|
17756
|
+
file: file2,
|
|
17757
|
+
candidate,
|
|
17758
|
+
// Resume needs the file itself: OMP is started with `--session <file>`.
|
|
17759
|
+
nativeRef: nativeSessionRefSchema.parse({
|
|
17760
|
+
harnessId: "omp",
|
|
17761
|
+
nativeSessionId: facts.nativeSessionId,
|
|
17762
|
+
locator: { sessionFile: await realpath2(file2) },
|
|
17763
|
+
formatVersion: 1
|
|
17764
|
+
})
|
|
17765
|
+
};
|
|
17766
|
+
} catch (error51) {
|
|
17767
|
+
signal.throwIfAborted();
|
|
17768
|
+
if (isStorageAccessError(error51))
|
|
17769
|
+
throw error51;
|
|
17770
|
+
return null;
|
|
17771
|
+
}
|
|
17772
|
+
});
|
|
17773
|
+
}
|
|
17774
|
+
};
|
|
17775
|
+
|
|
17368
17776
|
// dist/omp-last-turn-rollback.js
|
|
17369
17777
|
function modelFromState(state) {
|
|
17370
17778
|
if (state.provider === null && state.modelId === null)
|
|
@@ -17420,7 +17828,7 @@ async function rollbackOmpLastTurn(transport, sourceSessionId, cwd) {
|
|
|
17420
17828
|
// dist/omp-rpc-session.js
|
|
17421
17829
|
import { spawn, spawnSync } from "node:child_process";
|
|
17422
17830
|
import { randomUUID } from "node:crypto";
|
|
17423
|
-
import
|
|
17831
|
+
import path5 from "node:path";
|
|
17424
17832
|
|
|
17425
17833
|
// dist/command.js
|
|
17426
17834
|
var ompDiscoverySpec = {
|
|
@@ -17449,14 +17857,14 @@ function resolveOmpExecutable(input, dependencies = {}) {
|
|
|
17449
17857
|
}
|
|
17450
17858
|
|
|
17451
17859
|
// dist/omp-usage.js
|
|
17452
|
-
function
|
|
17860
|
+
function isRecord7(value) {
|
|
17453
17861
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
17454
17862
|
}
|
|
17455
17863
|
function nonNegativeSafeInteger(value) {
|
|
17456
17864
|
return typeof value === "number" && Number.isSafeInteger(value) && value >= 0 ? value : null;
|
|
17457
17865
|
}
|
|
17458
17866
|
function optionalOmpCacheHitRatePercent(value) {
|
|
17459
|
-
if (!
|
|
17867
|
+
if (!isRecord7(value) || value.role !== "assistant" || !isRecord7(value.usage))
|
|
17460
17868
|
return null;
|
|
17461
17869
|
const input = nonNegativeSafeInteger(value.usage.input);
|
|
17462
17870
|
const cacheRead = nonNegativeSafeInteger(value.usage.cacheRead);
|
|
@@ -17469,20 +17877,20 @@ function optionalOmpCacheHitRatePercent(value) {
|
|
|
17469
17877
|
function latestOmpCacheHitRatePercent(history) {
|
|
17470
17878
|
let latest = null;
|
|
17471
17879
|
for (const entry of activeOmpEntries(history)) {
|
|
17472
|
-
if (entry.type === "message" &&
|
|
17880
|
+
if (entry.type === "message" && isRecord7(entry.message) && entry.message.role === "assistant") {
|
|
17473
17881
|
latest = optionalOmpCacheHitRatePercent(entry.message);
|
|
17474
17882
|
}
|
|
17475
17883
|
}
|
|
17476
17884
|
return latest;
|
|
17477
17885
|
}
|
|
17478
17886
|
function responseData(response, operation) {
|
|
17479
|
-
if (!
|
|
17887
|
+
if (!isRecord7(response.data)) {
|
|
17480
17888
|
throw new Error(`Omp RPC ${operation} response has no data`);
|
|
17481
17889
|
}
|
|
17482
17890
|
return response.data;
|
|
17483
17891
|
}
|
|
17484
17892
|
function contextUsage(value) {
|
|
17485
|
-
if (!
|
|
17893
|
+
if (!isRecord7(value))
|
|
17486
17894
|
throw new Error("Omp RPC context Usage is invalid");
|
|
17487
17895
|
return parseHostUsage({
|
|
17488
17896
|
contextUsedTokens: value.tokens,
|
|
@@ -17492,15 +17900,15 @@ function contextUsage(value) {
|
|
|
17492
17900
|
function parseOmpSessionUsage(response) {
|
|
17493
17901
|
const data = responseData(response, "Session stats");
|
|
17494
17902
|
const tokens = data.tokens;
|
|
17495
|
-
if (tokens !== void 0 && !
|
|
17903
|
+
if (tokens !== void 0 && !isRecord7(tokens)) {
|
|
17496
17904
|
throw new Error("Omp RPC Session stats tokens are invalid");
|
|
17497
17905
|
}
|
|
17498
17906
|
return parseHostUsage({
|
|
17499
|
-
...
|
|
17500
|
-
...
|
|
17501
|
-
...
|
|
17502
|
-
...
|
|
17503
|
-
...
|
|
17907
|
+
...isRecord7(tokens) && tokens.input !== void 0 ? { inputTokens: tokens.input } : {},
|
|
17908
|
+
...isRecord7(tokens) && tokens.cacheRead !== void 0 ? { cachedInputTokens: tokens.cacheRead } : {},
|
|
17909
|
+
...isRecord7(tokens) && tokens.cacheWrite !== void 0 ? { cacheWriteInputTokens: tokens.cacheWrite } : {},
|
|
17910
|
+
...isRecord7(tokens) && tokens.output !== void 0 ? { outputTokens: tokens.output } : {},
|
|
17911
|
+
...isRecord7(tokens) && tokens.total !== void 0 ? { totalTokens: tokens.total } : {},
|
|
17504
17912
|
...data.cost !== void 0 ? { totalCostUsd: data.cost } : {},
|
|
17505
17913
|
...data.contextUsage !== void 0 ? contextUsage(data.contextUsage) : {}
|
|
17506
17914
|
});
|
|
@@ -17615,7 +18023,7 @@ var OmpRpcUnsupportedCommandError = class extends Error {
|
|
|
17615
18023
|
}
|
|
17616
18024
|
};
|
|
17617
18025
|
var textDecoder = new TextDecoder("utf-8", { fatal: true });
|
|
17618
|
-
function
|
|
18026
|
+
function isRecord8(value) {
|
|
17619
18027
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
17620
18028
|
}
|
|
17621
18029
|
function message2(value) {
|
|
@@ -17627,13 +18035,13 @@ function nonBlankString(value) {
|
|
|
17627
18035
|
function parseNativeModel(value, context) {
|
|
17628
18036
|
if (value === null || value === void 0)
|
|
17629
18037
|
return null;
|
|
17630
|
-
if (!
|
|
18038
|
+
if (!isRecord8(value) || !nonBlankString(value.provider) || !nonBlankString(value.id)) {
|
|
17631
18039
|
throw new OmpRpcFaultError("protocolError", `Omp RPC returned an invalid ${context} Model`);
|
|
17632
18040
|
}
|
|
17633
18041
|
return { provider: value.provider, id: value.id };
|
|
17634
18042
|
}
|
|
17635
18043
|
function sessionStateData(response) {
|
|
17636
|
-
const data =
|
|
18044
|
+
const data = isRecord8(response.data) ? response.data : null;
|
|
17637
18045
|
if (!data)
|
|
17638
18046
|
throw new OmpRpcFaultError("protocolError", "Omp RPC state response has no data");
|
|
17639
18047
|
return data;
|
|
@@ -17648,7 +18056,7 @@ function parseSessionState(response) {
|
|
|
17648
18056
|
if (thinkingLevel !== null && !thinkingLevel.success) {
|
|
17649
18057
|
throw new OmpRpcFaultError("protocolError", "Omp RPC state has an invalid Thinking level");
|
|
17650
18058
|
}
|
|
17651
|
-
const thinking =
|
|
18059
|
+
const thinking = isRecord8(data.model) && isRecord8(data.model.thinking) ? data.model.thinking : null;
|
|
17652
18060
|
const availableThinkingLevels = thinking && Array.isArray(thinking.efforts) ? thinking.efforts.flatMap((level) => {
|
|
17653
18061
|
const parsed = harnessThinkingOptionIdSchema.safeParse(level);
|
|
17654
18062
|
return parsed.success ? [parsed.data] : [];
|
|
@@ -17671,25 +18079,25 @@ function parseSessionStreaming(response) {
|
|
|
17671
18079
|
return isStreaming;
|
|
17672
18080
|
}
|
|
17673
18081
|
function parseAvailableModels(response) {
|
|
17674
|
-
const data =
|
|
18082
|
+
const data = isRecord8(response.data) ? response.data : null;
|
|
17675
18083
|
if (!data || !Array.isArray(data.models)) {
|
|
17676
18084
|
throw new OmpRpcFaultError("protocolError", "Omp RPC Model catalog response has no models");
|
|
17677
18085
|
}
|
|
17678
18086
|
return data.models.map((model) => {
|
|
17679
18087
|
const parsed = parseNativeModel(model, "catalog");
|
|
17680
|
-
if (!parsed || !
|
|
18088
|
+
if (!parsed || !isRecord8(model) || typeof model.reasoning !== "boolean") {
|
|
17681
18089
|
throw new OmpRpcFaultError("protocolError", "Omp RPC catalog contains a Model without reasoning capability");
|
|
17682
18090
|
}
|
|
17683
18091
|
return { ...parsed, reasoning: model.reasoning };
|
|
17684
18092
|
});
|
|
17685
18093
|
}
|
|
17686
18094
|
function parseSubagentMessages(response) {
|
|
17687
|
-
const data =
|
|
18095
|
+
const data = isRecord8(response.data) ? response.data : null;
|
|
17688
18096
|
if (!data || !nonBlankString(data.sessionFile) || !Number.isSafeInteger(data.fromByte) || !Number.isSafeInteger(data.nextByte) || data.fromByte < 0 || data.nextByte < data.fromByte || typeof data.reset !== "boolean" || !Array.isArray(data.entries) || !Array.isArray(data.messages)) {
|
|
17689
18097
|
throw new OmpRpcFaultError("protocolError", "Omp RPC Subagent transcript response is invalid");
|
|
17690
18098
|
}
|
|
17691
|
-
const entries = data.entries.flatMap((value) =>
|
|
17692
|
-
const messages = data.messages.flatMap((value) =>
|
|
18099
|
+
const entries = data.entries.flatMap((value) => isRecord8(value) ? [value] : []);
|
|
18100
|
+
const messages = data.messages.flatMap((value) => isRecord8(value) ? [value] : []);
|
|
17693
18101
|
if (entries.length !== data.entries.length || messages.length !== data.messages.length) {
|
|
17694
18102
|
throw new OmpRpcFaultError("protocolError", "Omp RPC Subagent transcript contains invalid data");
|
|
17695
18103
|
}
|
|
@@ -17710,17 +18118,17 @@ function subagentStatus(value) {
|
|
|
17710
18118
|
throw new OmpRpcFaultError("protocolError", "Omp RPC Subagent status is invalid");
|
|
17711
18119
|
}
|
|
17712
18120
|
function assistantText(value) {
|
|
17713
|
-
if (!
|
|
18121
|
+
if (!isRecord8(value) || value.role !== "assistant" || !Array.isArray(value.content))
|
|
17714
18122
|
return null;
|
|
17715
|
-
return value.content.filter((content) =>
|
|
18123
|
+
return value.content.filter((content) => isRecord8(content) && content.type === "text" && typeof content.text === "string").map((content) => content.text).join("");
|
|
17716
18124
|
}
|
|
17717
18125
|
function assistantMessageId(value) {
|
|
17718
|
-
if (!
|
|
18126
|
+
if (!isRecord8(value) || value.role !== "assistant")
|
|
17719
18127
|
return null;
|
|
17720
18128
|
return nonBlankString(value.responseId) ? value.responseId : null;
|
|
17721
18129
|
}
|
|
17722
18130
|
function extractReasoningText(content) {
|
|
17723
|
-
if (!
|
|
18131
|
+
if (!isRecord8(content))
|
|
17724
18132
|
return null;
|
|
17725
18133
|
const type = String(content.type ?? "");
|
|
17726
18134
|
if (type === "thinking" || type === "reasoning" || type === "thought") {
|
|
@@ -17730,12 +18138,12 @@ function extractReasoningText(content) {
|
|
|
17730
18138
|
return null;
|
|
17731
18139
|
}
|
|
17732
18140
|
function assistantReasoning(value) {
|
|
17733
|
-
if (!
|
|
18141
|
+
if (!isRecord8(value) || value.role !== "assistant" || !Array.isArray(value.content))
|
|
17734
18142
|
return null;
|
|
17735
18143
|
return value.content.map(extractReasoningText).filter((text) => typeof text === "string").join("");
|
|
17736
18144
|
}
|
|
17737
18145
|
function assistantFailure(value) {
|
|
17738
|
-
if (!
|
|
18146
|
+
if (!isRecord8(value) || value.role !== "assistant")
|
|
17739
18147
|
return void 0;
|
|
17740
18148
|
if (value.stopReason !== "error" && value.stopReason !== "aborted")
|
|
17741
18149
|
return null;
|
|
@@ -17755,7 +18163,7 @@ function signalProcessTree(child, signal) {
|
|
|
17755
18163
|
try {
|
|
17756
18164
|
process.kill(-child.pid, signal);
|
|
17757
18165
|
} catch (error51) {
|
|
17758
|
-
if (!
|
|
18166
|
+
if (!isRecord8(error51) || error51.code !== "ESRCH")
|
|
17759
18167
|
throw error51;
|
|
17760
18168
|
}
|
|
17761
18169
|
}
|
|
@@ -17794,7 +18202,7 @@ function ompRpcProcessCommand(options, dependencies = {}) {
|
|
|
17794
18202
|
...modelArguments,
|
|
17795
18203
|
...sessionArguments
|
|
17796
18204
|
];
|
|
17797
|
-
const extension =
|
|
18205
|
+
const extension = path5.win32.extname(command).toLowerCase();
|
|
17798
18206
|
if (platform !== "win32" || ![".cmd", ".bat"].includes(extension)) {
|
|
17799
18207
|
return { command, arguments: arguments_, windowsVerbatimArguments: false };
|
|
17800
18208
|
}
|
|
@@ -17837,6 +18245,10 @@ var OmpRpcSession = class {
|
|
|
17837
18245
|
#manualCompaction = null;
|
|
17838
18246
|
#stderrTail = "";
|
|
17839
18247
|
#frameDecoder = new OmpFrameDecoder();
|
|
18248
|
+
#startupFaultResolve = null;
|
|
18249
|
+
#startupFault = new Promise((resolve) => {
|
|
18250
|
+
this.#startupFaultResolve = resolve;
|
|
18251
|
+
});
|
|
17840
18252
|
#readyResolve = null;
|
|
17841
18253
|
#ready = new Promise((resolve) => {
|
|
17842
18254
|
this.#readyResolve = resolve;
|
|
@@ -17893,7 +18305,7 @@ var OmpRpcSession = class {
|
|
|
17893
18305
|
this.#stderrTail = sanitizeDiagnosticTail(`${this.#stderrTail}${chunk.toString()}`);
|
|
17894
18306
|
});
|
|
17895
18307
|
child.once("error", (error51) => {
|
|
17896
|
-
const kind =
|
|
18308
|
+
const kind = isRecord8(error51) && error51.code === "ENOENT" ? "notInstalled" : "unavailable";
|
|
17897
18309
|
this.#fail(new OmpRpcFaultError(kind, `Omp RPC failed to start: ${error51.message}`, this.stderrTail));
|
|
17898
18310
|
});
|
|
17899
18311
|
child.once("exit", (code, signal) => {
|
|
@@ -17908,10 +18320,20 @@ var OmpRpcSession = class {
|
|
|
17908
18320
|
}),
|
|
17909
18321
|
new Promise((_resolve, reject) => setTimeout(() => reject(new Error("Omp RPC start timed out")), this.#options.commandTimeoutMs))
|
|
17910
18322
|
]);
|
|
17911
|
-
|
|
17912
|
-
|
|
17913
|
-
|
|
17914
|
-
|
|
18323
|
+
let readyTimeout;
|
|
18324
|
+
try {
|
|
18325
|
+
await Promise.race([
|
|
18326
|
+
this.#ready,
|
|
18327
|
+
this.#startupFault.then((error51) => {
|
|
18328
|
+
throw error51;
|
|
18329
|
+
}),
|
|
18330
|
+
new Promise((_resolve, reject) => {
|
|
18331
|
+
readyTimeout = setTimeout(() => reject(new Error("Omp RPC ready signal timed out")), this.#options.commandTimeoutMs);
|
|
18332
|
+
})
|
|
18333
|
+
]);
|
|
18334
|
+
} finally {
|
|
18335
|
+
clearTimeout(readyTimeout);
|
|
18336
|
+
}
|
|
17915
18337
|
await this.#send("negotiate_protocol", { protocolVersion: 2 }).catch(() => void 0);
|
|
17916
18338
|
if (this.#options.subscribeSubagentEvents !== false) {
|
|
17917
18339
|
await this.#send("set_subagent_subscription", { level: "events" }).catch(() => void 0);
|
|
@@ -17931,17 +18353,17 @@ var OmpRpcSession = class {
|
|
|
17931
18353
|
return await readOmpSessionHistory(this.state.sessionFile);
|
|
17932
18354
|
}
|
|
17933
18355
|
const response = await this.#send("get_messages", {});
|
|
17934
|
-
const data =
|
|
18356
|
+
const data = isRecord8(response.data) ? response.data : null;
|
|
17935
18357
|
if (!data || !Array.isArray(data.messages)) {
|
|
17936
18358
|
throw new OmpRpcFaultError("protocolError", "Omp RPC messages response has no messages");
|
|
17937
18359
|
}
|
|
17938
18360
|
let branchEntryIds = null;
|
|
17939
18361
|
try {
|
|
17940
18362
|
const branchResponse = await this.#send("get_branch_messages", {});
|
|
17941
|
-
const branchData =
|
|
18363
|
+
const branchData = isRecord8(branchResponse.data) ? branchResponse.data : null;
|
|
17942
18364
|
if (branchData && Array.isArray(branchData.messages)) {
|
|
17943
18365
|
const parsed = branchData.messages.flatMap((entry) => {
|
|
17944
|
-
if (!
|
|
18366
|
+
if (!isRecord8(entry) || !nonBlankString(entry.entryId))
|
|
17945
18367
|
return [];
|
|
17946
18368
|
return [entry.entryId];
|
|
17947
18369
|
});
|
|
@@ -17955,11 +18377,11 @@ var OmpRpcSession = class {
|
|
|
17955
18377
|
let userIndex = 0;
|
|
17956
18378
|
let parentId = null;
|
|
17957
18379
|
const entries = data.messages.map((nativeMessage, index) => {
|
|
17958
|
-
const role =
|
|
18380
|
+
const role = isRecord8(nativeMessage) ? nativeMessage.role : void 0;
|
|
17959
18381
|
const branchId = role === "user" ? branchEntryIds?.[userIndex] : void 0;
|
|
17960
18382
|
if (branchId)
|
|
17961
18383
|
userIndex += 1;
|
|
17962
|
-
const id = branchId ?? (
|
|
18384
|
+
const id = branchId ?? (isRecord8(nativeMessage) && nonBlankString(nativeMessage.id) ? nativeMessage.id : `omp-message-${index}`);
|
|
17963
18385
|
const entry = { id, parentId, type: "message", message: nativeMessage };
|
|
17964
18386
|
parentId = id;
|
|
17965
18387
|
return entry;
|
|
@@ -18039,7 +18461,7 @@ var OmpRpcSession = class {
|
|
|
18039
18461
|
throw new Error("Omp RPC Fork requires an Entry identity");
|
|
18040
18462
|
try {
|
|
18041
18463
|
const response = await this.#send("branch", { entryId });
|
|
18042
|
-
const data =
|
|
18464
|
+
const data = isRecord8(response.data) ? response.data : null;
|
|
18043
18465
|
if (!data || data.cancelled === true) {
|
|
18044
18466
|
throw new OmpRpcFaultError("unavailable", "Omp RPC Fork was cancelled");
|
|
18045
18467
|
}
|
|
@@ -18232,7 +18654,7 @@ var OmpRpcSession = class {
|
|
|
18232
18654
|
continue;
|
|
18233
18655
|
}
|
|
18234
18656
|
const value = decoded;
|
|
18235
|
-
if (!
|
|
18657
|
+
if (!isRecord8(value) || typeof value.type !== "string") {
|
|
18236
18658
|
throw new OmpRpcFaultError("protocolError", "Omp RPC returned an invalid envelope");
|
|
18237
18659
|
}
|
|
18238
18660
|
this.#handle(value);
|
|
@@ -18291,7 +18713,7 @@ var OmpRpcSession = class {
|
|
|
18291
18713
|
this.#armCommandTimeout(id, pending);
|
|
18292
18714
|
}
|
|
18293
18715
|
}
|
|
18294
|
-
const outcome = value.aborted === true ? "cancelled" :
|
|
18716
|
+
const outcome = value.aborted === true ? "cancelled" : isRecord8(value.result) ? "succeeded" : "failed";
|
|
18295
18717
|
const event = {
|
|
18296
18718
|
type: "compaction.completed",
|
|
18297
18719
|
outcome,
|
|
@@ -18324,12 +18746,12 @@ var OmpRpcSession = class {
|
|
|
18324
18746
|
this.#startAssistantMessage(active, value.message);
|
|
18325
18747
|
return;
|
|
18326
18748
|
}
|
|
18327
|
-
if (value.type === "message_update" &&
|
|
18749
|
+
if (value.type === "message_update" && isRecord8(value.assistantMessageEvent)) {
|
|
18328
18750
|
const event = value.assistantMessageEvent;
|
|
18329
18751
|
const eventType = String(event.type ?? "");
|
|
18330
18752
|
const isThinking = eventType === "thinking_delta" || eventType === "reasoning_delta" || eventType === "thought_delta" || eventType === "thinking" || eventType === "reasoning";
|
|
18331
18753
|
const isText = eventType === "text_delta" || eventType === "text" || eventType === "content_block_delta";
|
|
18332
|
-
const delta = typeof event.delta === "string" ? event.delta : typeof event.thinking === "string" ? event.thinking : typeof event.reasoning === "string" ? event.reasoning : typeof event.text === "string" ? event.text :
|
|
18754
|
+
const delta = typeof event.delta === "string" ? event.delta : typeof event.thinking === "string" ? event.thinking : typeof event.reasoning === "string" ? event.reasoning : typeof event.text === "string" ? event.text : isRecord8(event.delta) && typeof event.delta.thinking === "string" ? event.delta.thinking : isRecord8(event.delta) && typeof event.delta.text === "string" ? event.delta.text : null;
|
|
18333
18755
|
if (isThinking && delta !== null && delta.length > 0) {
|
|
18334
18756
|
const messageId = this.#ensureAssistantMessage(active, value.message);
|
|
18335
18757
|
active.reasoningMessageOpen = true;
|
|
@@ -18369,7 +18791,7 @@ var OmpRpcSession = class {
|
|
|
18369
18791
|
if (value.type === "agent_end" && Array.isArray(value.messages)) {
|
|
18370
18792
|
for (let index = value.messages.length - 1; index >= 0; index -= 1) {
|
|
18371
18793
|
const message3 = value.messages[index];
|
|
18372
|
-
if (!
|
|
18794
|
+
if (!isRecord8(message3) || message3.role !== "assistant")
|
|
18373
18795
|
continue;
|
|
18374
18796
|
this.#finalizeAssistantMessage(active, message3);
|
|
18375
18797
|
break;
|
|
@@ -18386,8 +18808,8 @@ var OmpRpcSession = class {
|
|
|
18386
18808
|
if (value.type !== "subagent_lifecycle" && value.type !== "subagent_progress" && value.type !== "subagent_event") {
|
|
18387
18809
|
return false;
|
|
18388
18810
|
}
|
|
18389
|
-
const payload =
|
|
18390
|
-
const progressPayload = value.type === "subagent_progress" && payload &&
|
|
18811
|
+
const payload = isRecord8(value.payload) ? value.payload : null;
|
|
18812
|
+
const progressPayload = value.type === "subagent_progress" && payload && isRecord8(payload.progress) ? payload.progress : null;
|
|
18391
18813
|
const nativeIdValue = progressPayload?.id ?? payload?.id;
|
|
18392
18814
|
if (!payload || !nonBlankString(nativeIdValue)) {
|
|
18393
18815
|
throw new OmpRpcFaultError("protocolError", "Omp RPC Subagent frame has no stable ID");
|
|
@@ -18804,6 +19226,8 @@ var OmpRpcSession = class {
|
|
|
18804
19226
|
if (this.#closed || this.#failed)
|
|
18805
19227
|
return;
|
|
18806
19228
|
this.#failed = true;
|
|
19229
|
+
this.#startupFaultResolve?.(error51);
|
|
19230
|
+
this.#startupFaultResolve = null;
|
|
18807
19231
|
this.#rejectAll(error51);
|
|
18808
19232
|
this.#options.onFault?.(error51);
|
|
18809
19233
|
}
|
|
@@ -18964,7 +19388,7 @@ var ompCommandCatalog = harnessCommandCatalogSchema.parse({
|
|
|
18964
19388
|
]
|
|
18965
19389
|
});
|
|
18966
19390
|
var DEFAULT_TOOL_OUTPUT_LIMIT = 64e3;
|
|
18967
|
-
function
|
|
19391
|
+
function isRecord9(value) {
|
|
18968
19392
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
18969
19393
|
}
|
|
18970
19394
|
function errorMessage(error51) {
|
|
@@ -18979,7 +19403,7 @@ var OmpAdapterFaultError = class extends Error {
|
|
|
18979
19403
|
}
|
|
18980
19404
|
};
|
|
18981
19405
|
function normalizedError(error51, fallbackCode) {
|
|
18982
|
-
if (
|
|
19406
|
+
if (isRecord9(error51) && error51.code === "ENOENT") {
|
|
18983
19407
|
return { code: "notInstalled", message: errorMessage(error51), retryable: false };
|
|
18984
19408
|
}
|
|
18985
19409
|
if (error51 instanceof OmpAdapterFaultError)
|
|
@@ -19056,7 +19480,7 @@ function nativeModelForHistory(state) {
|
|
|
19056
19480
|
return nativeModelFromState(state);
|
|
19057
19481
|
}
|
|
19058
19482
|
function sessionFileFromRef(ref) {
|
|
19059
|
-
if (ref.harnessId !== ompHarnessId2 || !
|
|
19483
|
+
if (ref.harnessId !== ompHarnessId2 || !isRecord9(ref.locator) || typeof ref.locator.sessionFile !== "string" || ref.locator.sessionFile.length === 0) {
|
|
19060
19484
|
throw new Error("Omp Native Session Ref has no resumable Session file");
|
|
19061
19485
|
}
|
|
19062
19486
|
return ref.locator.sessionFile;
|
|
@@ -19066,7 +19490,7 @@ function subagentTranscriptPath(parentSessionFile, nativeSubagentId) {
|
|
|
19066
19490
|
if (nativeSubagentId.includes("/") || nativeSubagentId.includes("\\") || nativeSubagentId.includes("\0") || nativeSubagentId === "." || nativeSubagentId === "..") {
|
|
19067
19491
|
throw new Error("Omp Subagent ID is not a plain transcript file name");
|
|
19068
19492
|
}
|
|
19069
|
-
if (!parentSessionFile.endsWith(".jsonl") || !
|
|
19493
|
+
if (!parentSessionFile.endsWith(".jsonl") || !path6.isAbsolute(parentSessionFile)) {
|
|
19070
19494
|
return null;
|
|
19071
19495
|
}
|
|
19072
19496
|
return `${parentSessionFile.slice(0, -".jsonl".length)}/${nativeSubagentId}.jsonl`;
|
|
@@ -19075,10 +19499,10 @@ async function readSubagentTranscriptFile(parentSessionFile, nativeSubagentId) {
|
|
|
19075
19499
|
const transcriptFile = subagentTranscriptPath(parentSessionFile, nativeSubagentId);
|
|
19076
19500
|
if (transcriptFile === null)
|
|
19077
19501
|
return { status: "missing" };
|
|
19078
|
-
const parentDirectory =
|
|
19502
|
+
const parentDirectory = path6.dirname(transcriptFile);
|
|
19079
19503
|
let metadata;
|
|
19080
19504
|
try {
|
|
19081
|
-
metadata = await
|
|
19505
|
+
metadata = await stat2(transcriptFile);
|
|
19082
19506
|
} catch (error51) {
|
|
19083
19507
|
if (error51.code === "ENOENT")
|
|
19084
19508
|
return { status: "missing" };
|
|
@@ -19090,10 +19514,10 @@ async function readSubagentTranscriptFile(parentSessionFile, nativeSubagentId) {
|
|
|
19090
19514
|
throw new Error("Omp Subagent transcript exceeds the supported size");
|
|
19091
19515
|
}
|
|
19092
19516
|
const [resolvedTranscript, resolvedParentDirectory] = await Promise.all([
|
|
19093
|
-
|
|
19094
|
-
|
|
19517
|
+
realpath3(transcriptFile),
|
|
19518
|
+
realpath3(parentDirectory)
|
|
19095
19519
|
]);
|
|
19096
|
-
if (
|
|
19520
|
+
if (path6.dirname(resolvedTranscript) !== resolvedParentDirectory) {
|
|
19097
19521
|
throw new Error("Omp Subagent transcript resolves outside its parent Session directory");
|
|
19098
19522
|
}
|
|
19099
19523
|
return {
|
|
@@ -19111,9 +19535,9 @@ function toolFailure(toolName) {
|
|
|
19111
19535
|
function nativeText(value) {
|
|
19112
19536
|
if (typeof value === "string")
|
|
19113
19537
|
return value;
|
|
19114
|
-
if (!
|
|
19538
|
+
if (!isRecord9(value) || !Array.isArray(value.content))
|
|
19115
19539
|
return "";
|
|
19116
|
-
return value.content.filter((content) =>
|
|
19540
|
+
return value.content.filter((content) => isRecord9(content) && content.type === "text" && typeof content.text === "string").map(({ text }) => text).join("");
|
|
19117
19541
|
}
|
|
19118
19542
|
function boundedOutput(value, limit) {
|
|
19119
19543
|
const text = nativeText(value);
|
|
@@ -19129,17 +19553,17 @@ function outputText(output) {
|
|
|
19129
19553
|
return output?.content.filter((content) => content.type === "text").map(({ text }) => text).join("") ?? "";
|
|
19130
19554
|
}
|
|
19131
19555
|
function stringField2(value, key) {
|
|
19132
|
-
if (!
|
|
19556
|
+
if (!isRecord9(value))
|
|
19133
19557
|
return void 0;
|
|
19134
19558
|
const field = value[key];
|
|
19135
19559
|
if (typeof field === "string" && field.length > 0)
|
|
19136
19560
|
return field;
|
|
19137
|
-
if (
|
|
19561
|
+
if (isRecord9(value.input)) {
|
|
19138
19562
|
const nested = value.input[key];
|
|
19139
19563
|
if (typeof nested === "string" && nested.length > 0)
|
|
19140
19564
|
return nested;
|
|
19141
19565
|
}
|
|
19142
|
-
if (
|
|
19566
|
+
if (isRecord9(value.arguments)) {
|
|
19143
19567
|
const nested = value.arguments[key];
|
|
19144
19568
|
if (typeof nested === "string" && nested.length > 0)
|
|
19145
19569
|
return nested;
|
|
@@ -19147,7 +19571,7 @@ function stringField2(value, key) {
|
|
|
19147
19571
|
return void 0;
|
|
19148
19572
|
}
|
|
19149
19573
|
function numberField(value, key) {
|
|
19150
|
-
if (!
|
|
19574
|
+
if (!isRecord9(value))
|
|
19151
19575
|
return void 0;
|
|
19152
19576
|
const field = value[key];
|
|
19153
19577
|
return typeof field === "number" || field === null ? field : void 0;
|
|
@@ -19158,10 +19582,10 @@ function stripDiffPrefix(pathString) {
|
|
|
19158
19582
|
return pathString.startsWith("a/") || pathString.startsWith("b/") ? pathString.slice(2) : pathString;
|
|
19159
19583
|
}
|
|
19160
19584
|
function displayPath(nativePath, cwd) {
|
|
19161
|
-
const resolvedCwd =
|
|
19162
|
-
const resolvedPath =
|
|
19163
|
-
const relative =
|
|
19164
|
-
const inside = relative.length > 0 && relative !== ".." && !relative.startsWith(`..${
|
|
19585
|
+
const resolvedCwd = path6.resolve(cwd);
|
|
19586
|
+
const resolvedPath = path6.isAbsolute(nativePath) ? path6.resolve(nativePath) : path6.resolve(cwd, nativePath);
|
|
19587
|
+
const relative = path6.relative(resolvedCwd, resolvedPath);
|
|
19588
|
+
const inside = relative.length > 0 && relative !== ".." && !relative.startsWith(`..${path6.sep}`);
|
|
19165
19589
|
const selected = inside ? relative : resolvedPath;
|
|
19166
19590
|
const normalized = selected.replaceAll("\\", "/");
|
|
19167
19591
|
if (normalized.length === 0 || normalized === ".")
|
|
@@ -19186,7 +19610,7 @@ function fileMutatingKind(toolName) {
|
|
|
19186
19610
|
return null;
|
|
19187
19611
|
}
|
|
19188
19612
|
function nestedToolString(value, keys) {
|
|
19189
|
-
if (!
|
|
19613
|
+
if (!isRecord9(value))
|
|
19190
19614
|
return void 0;
|
|
19191
19615
|
for (const key of keys) {
|
|
19192
19616
|
const field = value[key];
|
|
@@ -19201,14 +19625,14 @@ function nestedToolString(value, keys) {
|
|
|
19201
19625
|
return void 0;
|
|
19202
19626
|
}
|
|
19203
19627
|
function patchFromResult(result) {
|
|
19204
|
-
if (!
|
|
19628
|
+
if (!isRecord9(result))
|
|
19205
19629
|
return void 0;
|
|
19206
19630
|
for (const key of ["patch", "diff", "unifiedDiff"]) {
|
|
19207
19631
|
const field = result[key];
|
|
19208
19632
|
if (typeof field === "string" && field.length > 0)
|
|
19209
19633
|
return field;
|
|
19210
19634
|
}
|
|
19211
|
-
if (
|
|
19635
|
+
if (isRecord9(result.details)) {
|
|
19212
19636
|
for (const key of ["patch", "diff", "unifiedDiff"]) {
|
|
19213
19637
|
const field = result.details[key];
|
|
19214
19638
|
if (typeof field === "string" && field.length > 0)
|
|
@@ -20693,6 +21117,7 @@ var OmpAdapter = class {
|
|
|
20693
21117
|
commandCatalog = ompCommandCatalog;
|
|
20694
21118
|
liveCommandCatalog = true;
|
|
20695
21119
|
harnessId = ompHarnessId2;
|
|
21120
|
+
sessionImport;
|
|
20696
21121
|
subagents = {
|
|
20697
21122
|
readSnapshot: async (input) => {
|
|
20698
21123
|
if (input.parent.harnessId !== this.harnessId || input.nativeSubagentId.trim().length === 0 || input.cwd.length === 0) {
|
|
@@ -20752,6 +21177,7 @@ var OmpAdapter = class {
|
|
|
20752
21177
|
createTransport: (sessionOptions) => new OmpRpcSession({ ...options, ...sessionOptions })
|
|
20753
21178
|
}) {
|
|
20754
21179
|
this.#createTransport = dependencies.createTransport;
|
|
21180
|
+
this.sessionImport = new OmpSessionImport({ ...process.env, ...options.environment });
|
|
20755
21181
|
this.#closeTimeoutMs = options.closeTimeoutMs ?? 2e3;
|
|
20756
21182
|
this.#toolOutputLimit = options.toolOutputLimit ?? DEFAULT_TOOL_OUTPUT_LIMIT;
|
|
20757
21183
|
}
|
|
@@ -20823,7 +21249,11 @@ var OmpAdapter = class {
|
|
|
20823
21249
|
};
|
|
20824
21250
|
} catch (error51) {
|
|
20825
21251
|
await transport.close().catch(() => void 0);
|
|
20826
|
-
const normalized =
|
|
21252
|
+
const normalized = stage === "startup" && /No models available\.\s*Use \/login or set an API key environment variable\./i.test(transport.stderrTail ?? "") ? {
|
|
21253
|
+
code: "configurationRequired",
|
|
21254
|
+
message: "No models are configured for use in Oh My Pi. Configure a Provider and its API key or models.yml, then run `omp` and use `/model` to select a model. For Providers that support it, `/login` configures Provider authentication, not an Oh My Pi account.",
|
|
21255
|
+
retryable: false
|
|
21256
|
+
} : normalizedError(error51, "unavailable");
|
|
20827
21257
|
return {
|
|
20828
21258
|
status: normalized.code === "notInstalled" ? "notInstalled" : "error",
|
|
20829
21259
|
error: {
|
|
@@ -21013,6 +21443,7 @@ var OmpAdapter = class {
|
|
|
21013
21443
|
close() {
|
|
21014
21444
|
if (!this.#closePromise) {
|
|
21015
21445
|
this.#closePromise = Promise.all([
|
|
21446
|
+
this.sessionImport.close(),
|
|
21016
21447
|
...[...this.#inspections].map((transport) => transport.close()),
|
|
21017
21448
|
...[...this.#sessions].map((session) => session.close())
|
|
21018
21449
|
]).then(() => void 0);
|
|
@@ -21022,22 +21453,22 @@ var OmpAdapter = class {
|
|
|
21022
21453
|
};
|
|
21023
21454
|
|
|
21024
21455
|
// dist/installation.js
|
|
21025
|
-
import { realpath as
|
|
21026
|
-
import
|
|
21456
|
+
import { realpath as realpath4 } from "node:fs/promises";
|
|
21457
|
+
import path7 from "node:path";
|
|
21027
21458
|
function createOmpInstallation(environment, command) {
|
|
21028
21459
|
let executable;
|
|
21029
21460
|
let env;
|
|
21030
21461
|
return createInstallationManager({
|
|
21031
21462
|
async check() {
|
|
21032
21463
|
executable = resolveOmpExecutable({ environment, ...command ? { command } : {} });
|
|
21033
|
-
const selected = await
|
|
21464
|
+
const selected = await realpath4(executable);
|
|
21034
21465
|
const pathKey = Object.keys(environment).find((key) => key.toLowerCase() === "path") ?? "PATH";
|
|
21035
21466
|
env = {
|
|
21036
21467
|
...environment,
|
|
21037
|
-
[pathKey]: `${
|
|
21468
|
+
[pathKey]: `${path7.dirname(executable)}${path7.delimiter}${environment[pathKey] ?? ""}`
|
|
21038
21469
|
};
|
|
21039
21470
|
const target = resolveHarnessExecutable({ id: "omp", command: "omp", installRoots: { posix: [], windows: [] } }, { environment: env });
|
|
21040
|
-
const canUpdate = !selected.includes("/nix/store/") && !!target && await
|
|
21471
|
+
const canUpdate = !selected.includes("/nix/store/") && !!target && await realpath4(target.executable) === selected;
|
|
21041
21472
|
const output = await runInstallationCommand(executable, ["update", "--check"], env);
|
|
21042
21473
|
const currentVersion = versionFromOutput(output);
|
|
21043
21474
|
const available = output.match(/New version available:\s*(\S+)/i);
|
|
@@ -21049,7 +21480,10 @@ function createOmpInstallation(environment, command) {
|
|
|
21049
21480
|
latestVersion,
|
|
21050
21481
|
updateAvailable: newerInstallationVersion(currentVersion, latestVersion),
|
|
21051
21482
|
canUpdate,
|
|
21052
|
-
...!canUpdate ? {
|
|
21483
|
+
...!canUpdate ? {
|
|
21484
|
+
messageCode: "original-installer",
|
|
21485
|
+
message: "Update this installation with its original package manager or launcher."
|
|
21486
|
+
} : {}
|
|
21053
21487
|
};
|
|
21054
21488
|
},
|
|
21055
21489
|
async update() {
|