@liberseek/boft-cli-win32-arm64 0.7.4 → 0.7.6
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/THIRD_PARTY_NOTICES.txt +4 -0
- package/app/codexhost-distribution.json +1 -1
- package/app/console-server.mjs +17934 -0
- package/app/console-web.js +27017 -0
- package/app/desktop-controller.mjs +154 -14
- package/app/host-runtime.mjs +3379 -1152
- package/app/plugins/antigravity/plugin.mjs +355 -74
- package/app/plugins/claude-code/plugin.mjs +2851 -2155
- package/app/plugins/codebuddy/plugin.mjs +436 -95
- package/app/plugins/cursor-cli/manifest.json +1 -1
- package/app/plugins/cursor-cli/plugin.mjs +1144 -497
- package/app/plugins/deepseek-harness/plugin.mjs +1212 -163
- package/app/plugins/grok/plugin.mjs +301 -81
- package/app/plugins/hermes/plugin.mjs +321 -87
- package/app/plugins/kimi-code/plugin.mjs +669 -76
- package/app/plugins/kiro-cli/plugin.mjs +237 -57
- package/app/plugins/muse/plugin.mjs +123 -8
- package/app/plugins/omp/plugin.mjs +470 -147
- package/app/plugins/opencode/plugin.mjs +3611 -208
- package/app/plugins/pi/plugin.mjs +911 -278
- package/app/plugins/qoder/plugin.mjs +407 -48
- package/app/plugins/qoder-cn/plugin.mjs +414 -49
- package/app/plugins/workbuddy/plugin.mjs +126 -8
- package/app/renderer-extension.js +3824 -2314
- 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/licenses/OpenCode-v2-Client-LICENSE.txt +21 -0
- package/package.json +1 -1
|
@@ -105,16 +105,16 @@ var Diff = class {
|
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
|
-
addToPath(
|
|
109
|
-
const last =
|
|
108
|
+
addToPath(path7, added, removed, oldPosInc, options) {
|
|
109
|
+
const last = path7.lastComponent;
|
|
110
110
|
if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {
|
|
111
111
|
return {
|
|
112
|
-
oldPos:
|
|
112
|
+
oldPos: path7.oldPos + oldPosInc,
|
|
113
113
|
lastComponent: { count: last.count + 1, added, removed, previousComponent: last.previousComponent }
|
|
114
114
|
};
|
|
115
115
|
} else {
|
|
116
116
|
return {
|
|
117
|
-
oldPos:
|
|
117
|
+
oldPos: path7.oldPos + oldPosInc,
|
|
118
118
|
lastComponent: { count: 1, added, removed, previousComponent: last }
|
|
119
119
|
};
|
|
120
120
|
}
|
|
@@ -527,7 +527,8 @@ function splitLines(text) {
|
|
|
527
527
|
|
|
528
528
|
// dist/omp-adapter.js
|
|
529
529
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
530
|
-
import
|
|
530
|
+
import { realpath as realpath2, stat } from "node:fs/promises";
|
|
531
|
+
import path5 from "node:path";
|
|
531
532
|
|
|
532
533
|
// ../../../node_modules/zod/v4/classic/external.js
|
|
533
534
|
var external_exports = {};
|
|
@@ -1295,10 +1296,10 @@ function mergeDefs(...defs) {
|
|
|
1295
1296
|
function cloneDef(schema) {
|
|
1296
1297
|
return mergeDefs(schema._zod.def);
|
|
1297
1298
|
}
|
|
1298
|
-
function getElementAtPath(obj,
|
|
1299
|
-
if (!
|
|
1299
|
+
function getElementAtPath(obj, path7) {
|
|
1300
|
+
if (!path7)
|
|
1300
1301
|
return obj;
|
|
1301
|
-
return
|
|
1302
|
+
return path7.reduce((acc, key) => acc?.[key], obj);
|
|
1302
1303
|
}
|
|
1303
1304
|
function promiseAllObject(promisesObj) {
|
|
1304
1305
|
const keys = Object.keys(promisesObj);
|
|
@@ -1707,11 +1708,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
1707
1708
|
}
|
|
1708
1709
|
return false;
|
|
1709
1710
|
}
|
|
1710
|
-
function prefixIssues(
|
|
1711
|
+
function prefixIssues(path7, issues) {
|
|
1711
1712
|
return issues.map((iss) => {
|
|
1712
1713
|
var _a3;
|
|
1713
1714
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
1714
|
-
iss.path.unshift(
|
|
1715
|
+
iss.path.unshift(path7);
|
|
1715
1716
|
return iss;
|
|
1716
1717
|
});
|
|
1717
1718
|
}
|
|
@@ -1858,16 +1859,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
|
|
|
1858
1859
|
}
|
|
1859
1860
|
function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
1860
1861
|
const fieldErrors = { _errors: [] };
|
|
1861
|
-
const processError = (error52,
|
|
1862
|
+
const processError = (error52, path7 = []) => {
|
|
1862
1863
|
for (const issue2 of error52.issues) {
|
|
1863
1864
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
1864
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
1865
|
+
issue2.errors.map((issues) => processError({ issues }, [...path7, ...issue2.path]));
|
|
1865
1866
|
} else if (issue2.code === "invalid_key") {
|
|
1866
|
-
processError({ issues: issue2.issues }, [...
|
|
1867
|
+
processError({ issues: issue2.issues }, [...path7, ...issue2.path]);
|
|
1867
1868
|
} else if (issue2.code === "invalid_element") {
|
|
1868
|
-
processError({ issues: issue2.issues }, [...
|
|
1869
|
+
processError({ issues: issue2.issues }, [...path7, ...issue2.path]);
|
|
1869
1870
|
} else {
|
|
1870
|
-
const fullpath = [...
|
|
1871
|
+
const fullpath = [...path7, ...issue2.path];
|
|
1871
1872
|
if (fullpath.length === 0) {
|
|
1872
1873
|
fieldErrors._errors.push(mapper(issue2));
|
|
1873
1874
|
} else {
|
|
@@ -1894,17 +1895,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
|
1894
1895
|
}
|
|
1895
1896
|
function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
1896
1897
|
const result = { errors: [] };
|
|
1897
|
-
const processError = (error52,
|
|
1898
|
+
const processError = (error52, path7 = []) => {
|
|
1898
1899
|
var _a3, _b;
|
|
1899
1900
|
for (const issue2 of error52.issues) {
|
|
1900
1901
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
1901
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
1902
|
+
issue2.errors.map((issues) => processError({ issues }, [...path7, ...issue2.path]));
|
|
1902
1903
|
} else if (issue2.code === "invalid_key") {
|
|
1903
|
-
processError({ issues: issue2.issues }, [...
|
|
1904
|
+
processError({ issues: issue2.issues }, [...path7, ...issue2.path]);
|
|
1904
1905
|
} else if (issue2.code === "invalid_element") {
|
|
1905
|
-
processError({ issues: issue2.issues }, [...
|
|
1906
|
+
processError({ issues: issue2.issues }, [...path7, ...issue2.path]);
|
|
1906
1907
|
} else {
|
|
1907
|
-
const fullpath = [...
|
|
1908
|
+
const fullpath = [...path7, ...issue2.path];
|
|
1908
1909
|
if (fullpath.length === 0) {
|
|
1909
1910
|
result.errors.push(mapper(issue2));
|
|
1910
1911
|
continue;
|
|
@@ -1936,8 +1937,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
|
1936
1937
|
}
|
|
1937
1938
|
function toDotPath(_path) {
|
|
1938
1939
|
const segs = [];
|
|
1939
|
-
const
|
|
1940
|
-
for (const seg of
|
|
1940
|
+
const path7 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
1941
|
+
for (const seg of path7) {
|
|
1941
1942
|
if (typeof seg === "number")
|
|
1942
1943
|
segs.push(`[${seg}]`);
|
|
1943
1944
|
else if (typeof seg === "symbol")
|
|
@@ -14629,13 +14630,13 @@ function resolveRef(ref, ctx) {
|
|
|
14629
14630
|
if (!ref.startsWith("#")) {
|
|
14630
14631
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
14631
14632
|
}
|
|
14632
|
-
const
|
|
14633
|
-
if (
|
|
14633
|
+
const path7 = ref.slice(1).split("/").filter(Boolean);
|
|
14634
|
+
if (path7.length === 0) {
|
|
14634
14635
|
return ctx.rootSchema;
|
|
14635
14636
|
}
|
|
14636
14637
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
14637
|
-
if (
|
|
14638
|
-
const key =
|
|
14638
|
+
if (path7[0] === defsKey) {
|
|
14639
|
+
const key = path7[1];
|
|
14639
14640
|
if (!key || !ctx.defs[key]) {
|
|
14640
14641
|
throw new Error(`Reference not found: ${ref}`);
|
|
14641
14642
|
}
|
|
@@ -15098,6 +15099,55 @@ var credentialImportsParamsSchema = external_exports.object({
|
|
|
15098
15099
|
request: credentialImportsRequestSchema
|
|
15099
15100
|
}).strict();
|
|
15100
15101
|
|
|
15102
|
+
// ../../shared-contracts/dist/harness-display-settings.js
|
|
15103
|
+
var harnessDisplayEntriesSchema = external_exports.array(external_exports.strictObject({
|
|
15104
|
+
agent: external_exports.string().min(1).max(128),
|
|
15105
|
+
section: external_exports.enum(["main", "more", "auto"])
|
|
15106
|
+
})).max(256).refine((entries) => new Set(entries.map((entry) => entry.agent)).size === entries.length, "Duplicate Harness IDs");
|
|
15107
|
+
var harnessDisplaySettingsSchema = external_exports.strictObject({
|
|
15108
|
+
entries: harnessDisplayEntriesSchema.nullable()
|
|
15109
|
+
});
|
|
15110
|
+
var harnessDisplayGetSchema = external_exports.strictObject({});
|
|
15111
|
+
var harnessDisplaySetSchema = external_exports.strictObject({
|
|
15112
|
+
entries: harnessDisplayEntriesSchema,
|
|
15113
|
+
/** Import legacy Desktop preferences only if no shared settings exist yet. */
|
|
15114
|
+
initializeOnly: external_exports.boolean().optional()
|
|
15115
|
+
});
|
|
15116
|
+
|
|
15117
|
+
// ../../shared-contracts/dist/console.js
|
|
15118
|
+
var consoleAnnouncementSchema = external_exports.strictObject({
|
|
15119
|
+
title: external_exports.string().trim().min(1).max(200),
|
|
15120
|
+
type: external_exports.enum(["info", "warning", "danger"]),
|
|
15121
|
+
body: external_exports.string().trim().min(1).max(16 * 1024)
|
|
15122
|
+
});
|
|
15123
|
+
var consoleOpenParamsSchema = external_exports.strictObject({});
|
|
15124
|
+
var consoleOpenResultSchema = external_exports.strictObject({
|
|
15125
|
+
/** The console address. */
|
|
15126
|
+
url: external_exports.string().max(2048).regex(/^http:\/\/(?:127\.0\.0\.1|localhost):\d{1,5}\/(?:\?.*)?$/u)
|
|
15127
|
+
});
|
|
15128
|
+
var CONSOLE_HOST_METHODS = Object.freeze([
|
|
15129
|
+
"codexhost/harness/plugins/list",
|
|
15130
|
+
"codexhost/harness/display-settings/get",
|
|
15131
|
+
"codexhost/harness/display-settings/set",
|
|
15132
|
+
"codexhost/harness/inspect",
|
|
15133
|
+
"codexhost/harness/launch-settings/get",
|
|
15134
|
+
"codexhost/harness/launch-settings/set",
|
|
15135
|
+
"codexhost/harness/web-ui/open",
|
|
15136
|
+
"codexhost/harness/accounts/sources",
|
|
15137
|
+
"codexhost/harness/accounts/list",
|
|
15138
|
+
"codexhost/harness/accounts/inspect",
|
|
15139
|
+
"codexhost/harness/credential-imports",
|
|
15140
|
+
"codexhost/harness/session-import/sources",
|
|
15141
|
+
"codexhost/harness/session-import/list",
|
|
15142
|
+
"codexhost/harness/session-import/import",
|
|
15143
|
+
"codexhost/account/list",
|
|
15144
|
+
"codexhost/account/refresh",
|
|
15145
|
+
"codexhost/account/usage/inspect",
|
|
15146
|
+
"codexhost/update/check",
|
|
15147
|
+
"codexhost/update/start",
|
|
15148
|
+
"codexhost/update/status"
|
|
15149
|
+
]);
|
|
15150
|
+
|
|
15101
15151
|
// ../../shared-contracts/dist/version.js
|
|
15102
15152
|
var WORKSPACE_CONTRACT_VERSION = 1;
|
|
15103
15153
|
|
|
@@ -15151,6 +15201,12 @@ var hostTurnIdSchema = opaqueIdSchema.brand();
|
|
|
15151
15201
|
var hostItemIdSchema = opaqueIdSchema.brand();
|
|
15152
15202
|
var hostInteractionIdSchema = opaqueIdSchema.brand();
|
|
15153
15203
|
|
|
15204
|
+
// ../../shared-contracts/dist/manual-compaction.js
|
|
15205
|
+
var threadManualCompactionStartedSchema = external_exports.strictObject({
|
|
15206
|
+
threadId: hostThreadIdSchema,
|
|
15207
|
+
turnId: hostTurnIdSchema
|
|
15208
|
+
});
|
|
15209
|
+
|
|
15154
15210
|
// ../../shared-contracts/dist/thread-usage.js
|
|
15155
15211
|
var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonnegative();
|
|
15156
15212
|
var finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative();
|
|
@@ -15211,6 +15267,10 @@ var threadUsageSnapshotSchema = external_exports.object({
|
|
|
15211
15267
|
var usagePercentSchema = external_exports.number().finite().min(0).max(100);
|
|
15212
15268
|
var accountCreditsProductUsageSchema = external_exports.object({
|
|
15213
15269
|
product: external_exports.string().min(1),
|
|
15270
|
+
used: external_exports.number().finite().nonnegative().optional(),
|
|
15271
|
+
// Zero is a real empty cap, not an absent field.
|
|
15272
|
+
limit: external_exports.number().finite().nonnegative().optional(),
|
|
15273
|
+
unit: external_exports.string().min(1).max(32).optional(),
|
|
15214
15274
|
usagePercent: usagePercentSchema,
|
|
15215
15275
|
resetsAt: external_exports.string().min(1).optional()
|
|
15216
15276
|
}).strict();
|
|
@@ -15220,11 +15280,14 @@ var accountResetCreditsSchema = external_exports.object({
|
|
|
15220
15280
|
expiresAt: external_exports.array(external_exports.string().min(1)).min(1).max(32).optional()
|
|
15221
15281
|
}).strict();
|
|
15222
15282
|
var accountCreditsSnapshotSchema = external_exports.object({
|
|
15283
|
+
used: external_exports.number().finite().nonnegative().optional(),
|
|
15284
|
+
// Zero is a real empty cap, not an absent field.
|
|
15285
|
+
limit: external_exports.number().finite().nonnegative().optional(),
|
|
15286
|
+
unit: external_exports.string().trim().min(1).max(32).optional(),
|
|
15223
15287
|
/** Native label when the primary limit is scoped to a model or product group. */
|
|
15224
15288
|
label: external_exports.string().min(1).optional(),
|
|
15225
15289
|
usedPercent: usagePercentSchema.optional(),
|
|
15226
15290
|
remaining: external_exports.number().finite().optional(),
|
|
15227
|
-
unit: external_exports.string().trim().min(1).max(32).optional(),
|
|
15228
15291
|
resetsAt: external_exports.string().min(1).optional(),
|
|
15229
15292
|
periodType: external_exports.enum(["weekly", "monthly", "five_hour", "seven_day", "unknown"]),
|
|
15230
15293
|
productUsage: external_exports.array(accountCreditsProductUsageSchema).min(1).optional(),
|
|
@@ -15255,12 +15318,27 @@ var threadUsageInspectionSchema = external_exports.object({
|
|
|
15255
15318
|
}).strict();
|
|
15256
15319
|
|
|
15257
15320
|
// ../../shared-contracts/dist/harness-accounts.js
|
|
15258
|
-
var
|
|
15321
|
+
var accountBalanceSnapshotSchema = external_exports.object({
|
|
15322
|
+
amount: external_exports.number().finite().nonnegative(),
|
|
15323
|
+
/** ISO 4217 code as reported by the Provider, for example `CNY`. */
|
|
15324
|
+
currency: external_exports.string().trim().min(1).max(8),
|
|
15325
|
+
/** Native label when the Harness exposes several Billing Sources. */
|
|
15326
|
+
label: external_exports.string().trim().min(1).max(128).optional()
|
|
15327
|
+
}).strict();
|
|
15328
|
+
var harnessAccountSnapshotObject = external_exports.object({
|
|
15259
15329
|
email: external_exports.string().trim().min(1).max(320).optional(),
|
|
15260
15330
|
label: external_exports.string().trim().min(1).max(256).optional(),
|
|
15261
15331
|
plan: external_exports.string().trim().min(1).max(128).optional(),
|
|
15262
|
-
credits: accountCreditsSnapshotSchema
|
|
15332
|
+
credits: accountCreditsSnapshotSchema.optional(),
|
|
15333
|
+
balance: accountBalanceSnapshotSchema.optional()
|
|
15263
15334
|
}).strict();
|
|
15335
|
+
function requireReportedQuota(schema) {
|
|
15336
|
+
return schema.refine((value) => {
|
|
15337
|
+
const reported = value;
|
|
15338
|
+
return reported.credits !== void 0 || reported.balance !== void 0;
|
|
15339
|
+
}, { message: "Account must report either credits or a balance" });
|
|
15340
|
+
}
|
|
15341
|
+
var harnessAccountSnapshotSchema = requireReportedQuota(harnessAccountSnapshotObject);
|
|
15264
15342
|
var harnessAccountIdentityShape = {
|
|
15265
15343
|
harnessId: harnessIdSchema,
|
|
15266
15344
|
harnessName: external_exports.string().trim().min(1).max(128)
|
|
@@ -15271,11 +15349,13 @@ var harnessAccountSourceListResultSchema = external_exports.object({ sources: ex
|
|
|
15271
15349
|
var harnessAccountInspectParamsSchema = external_exports.object({ harnessId: harnessIdSchema, refresh: external_exports.boolean().optional() }).strict();
|
|
15272
15350
|
var harnessAccountInspectResultSchema = external_exports.object({
|
|
15273
15351
|
...harnessAccountIdentityShape,
|
|
15274
|
-
account: harnessAccountSnapshotSchema.nullable()
|
|
15352
|
+
account: harnessAccountSnapshotSchema.nullable(),
|
|
15353
|
+
/** Every Billing Source from one Harness; `account` remains the first for older clients. */
|
|
15354
|
+
accounts: external_exports.array(harnessAccountSnapshotSchema).max(8).optional()
|
|
15275
15355
|
}).strict();
|
|
15276
15356
|
var harnessAccountListParamsSchema = external_exports.object({ refresh: external_exports.boolean().optional() }).strict();
|
|
15277
15357
|
var harnessAccountListResultSchema = external_exports.object({
|
|
15278
|
-
accounts: external_exports.array(
|
|
15358
|
+
accounts: external_exports.array(requireReportedQuota(harnessAccountSnapshotObject.extend(harnessAccountIdentityShape))).max(128)
|
|
15279
15359
|
}).strict();
|
|
15280
15360
|
|
|
15281
15361
|
// ../../shared-contracts/dist/json-value.js
|
|
@@ -15413,6 +15493,8 @@ var harnessModelSchema = external_exports.object({
|
|
|
15413
15493
|
ref: harnessModelRefSchema,
|
|
15414
15494
|
label: nonBlankTextSchema2.max(HARNESS_MODEL_LABEL_MAX_LENGTH),
|
|
15415
15495
|
resolvedModelLabel: harnessResolvedModelLabelSchema.optional(),
|
|
15496
|
+
/** Optional opaque selection for this same Model with priority processing enabled. */
|
|
15497
|
+
fastModel: harnessModelRefSchema.optional(),
|
|
15416
15498
|
supportedThinkingOptionIds: external_exports.array(harnessThinkingOptionIdSchema).optional()
|
|
15417
15499
|
}).strict();
|
|
15418
15500
|
var harnessThinkingOptionsSchema = external_exports.array(harnessThinkingOptionSchema).superRefine((options, context) => {
|
|
@@ -15445,6 +15527,16 @@ var harnessModelCatalogSchema = external_exports.object({
|
|
|
15445
15527
|
});
|
|
15446
15528
|
}
|
|
15447
15529
|
refs.add(model.ref.id);
|
|
15530
|
+
if (model.fastModel) {
|
|
15531
|
+
if (refs.has(model.fastModel.id) || catalog.models.some((entry) => entry.ref.id === model.fastModel?.id)) {
|
|
15532
|
+
context.addIssue({
|
|
15533
|
+
code: "custom",
|
|
15534
|
+
message: "Fast Model refs must be distinct and unique",
|
|
15535
|
+
path: ["models", index, "fastModel"]
|
|
15536
|
+
});
|
|
15537
|
+
}
|
|
15538
|
+
refs.add(model.fastModel.id);
|
|
15539
|
+
}
|
|
15448
15540
|
const supportedThinkingIds = /* @__PURE__ */ new Set();
|
|
15449
15541
|
for (const [optionIndex, optionId] of (model.supportedThinkingOptionIds ?? []).entries()) {
|
|
15450
15542
|
if (supportedThinkingIds.has(optionId)) {
|
|
@@ -15567,11 +15659,13 @@ var threadThinkingSelectParamsSchema = external_exports.object({
|
|
|
15567
15659
|
thinkingOptionId: harnessThinkingOptionIdSchema
|
|
15568
15660
|
}).strict();
|
|
15569
15661
|
var threadInspectionParamsSchema = external_exports.object({
|
|
15570
|
-
threadId: hostThreadIdSchema
|
|
15662
|
+
threadId: hostThreadIdSchema,
|
|
15663
|
+
includeReferenceCapability: external_exports.boolean().optional()
|
|
15571
15664
|
}).strict();
|
|
15572
15665
|
var codexThreadInspectionSchema = external_exports.object({
|
|
15573
15666
|
owner: external_exports.literal("codex"),
|
|
15574
|
-
locked: external_exports.literal(true)
|
|
15667
|
+
locked: external_exports.literal(true),
|
|
15668
|
+
supportsThreadReferences: external_exports.literal(true).optional()
|
|
15575
15669
|
}).strict();
|
|
15576
15670
|
var externalThreadInspectionSchema = external_exports.object({
|
|
15577
15671
|
owner: external_exports.literal("external"),
|
|
@@ -15699,10 +15793,31 @@ var harnessLaunchSettingsSchema = external_exports.object({
|
|
|
15699
15793
|
restartRequired: external_exports.boolean()
|
|
15700
15794
|
}).strict();
|
|
15701
15795
|
|
|
15796
|
+
// ../../shared-contracts/dist/harness-installation.js
|
|
15797
|
+
var harnessInstallationParamsSchema = external_exports.object({
|
|
15798
|
+
harnessId: harnessIdSchema,
|
|
15799
|
+
action: external_exports.enum(["check", "update"])
|
|
15800
|
+
}).strict();
|
|
15801
|
+
var harnessInstallationStateSchema = external_exports.object({
|
|
15802
|
+
currentVersion: external_exports.string().min(1).max(128),
|
|
15803
|
+
latestVersion: external_exports.string().min(1).max(128),
|
|
15804
|
+
updateAvailable: external_exports.boolean(),
|
|
15805
|
+
canUpdate: external_exports.boolean(),
|
|
15806
|
+
message: external_exports.string().max(2048).optional()
|
|
15807
|
+
}).strict();
|
|
15808
|
+
|
|
15702
15809
|
// ../../shared-contracts/dist/codex-accounts.js
|
|
15703
15810
|
var accountIdSchema = external_exports.string().min(1).max(256).regex(/^[A-Za-z0-9._~-]+$/u);
|
|
15704
15811
|
var nonBlankTextSchema3 = external_exports.string().trim().min(1);
|
|
15705
15812
|
var codexAccountAuthKindSchema = external_exports.enum(["api", "chatgpt"]);
|
|
15813
|
+
var codexAccountSiteUrlPattern = /^https?:\/\/(?:\[[0-9a-fA-F:]+\]|[^/\s:@?#]+)(?::\d{1,5})?(?:[/?#][^\s]*)?$/u;
|
|
15814
|
+
function isCodexAccountSiteUrl(value) {
|
|
15815
|
+
return value.length > 0 && value.length <= 2048 && codexAccountSiteUrlPattern.test(value);
|
|
15816
|
+
}
|
|
15817
|
+
var externalUrlOpenParamsSchema = external_exports.object({
|
|
15818
|
+
url: external_exports.string().max(2048).refine(isCodexAccountSiteUrl, "External URL must be http(s)")
|
|
15819
|
+
}).strict();
|
|
15820
|
+
var externalUrlOpenResultSchema = external_exports.object({}).strict();
|
|
15706
15821
|
var codexAccountPlanTypeSchema = external_exports.enum([
|
|
15707
15822
|
"free",
|
|
15708
15823
|
"go",
|
|
@@ -15728,7 +15843,8 @@ var codexAccountSchema = external_exports.object({
|
|
|
15728
15843
|
email: external_exports.string().email().max(320).optional(),
|
|
15729
15844
|
planType: codexAccountPlanTypeSchema.optional(),
|
|
15730
15845
|
authKind: codexAccountAuthKindSchema.optional(),
|
|
15731
|
-
authIdentity: nonBlankTextSchema3.max(256).optional()
|
|
15846
|
+
authIdentity: nonBlankTextSchema3.max(256).optional(),
|
|
15847
|
+
siteUrl: external_exports.string().refine(isCodexAccountSiteUrl, "Account site URL must be http(s)").optional()
|
|
15732
15848
|
}).strict();
|
|
15733
15849
|
var codexAccountPhaseSchema = external_exports.enum(["ready", "unavailable"]);
|
|
15734
15850
|
var codexAccountListResultSchema = external_exports.object({
|
|
@@ -16736,6 +16852,100 @@ function resolveOmpForkBoundary(history, checkpointId) {
|
|
|
16736
16852
|
};
|
|
16737
16853
|
}
|
|
16738
16854
|
|
|
16855
|
+
// dist/omp-session-file.js
|
|
16856
|
+
import { createReadStream } from "node:fs";
|
|
16857
|
+
import { open, realpath } from "node:fs/promises";
|
|
16858
|
+
import readline from "node:readline";
|
|
16859
|
+
var MAX_SESSION_HEADER_BYTES = 64 * 1024;
|
|
16860
|
+
var utf8Decoder = new TextDecoder("utf-8", { fatal: true });
|
|
16861
|
+
function isRecord5(value) {
|
|
16862
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
16863
|
+
}
|
|
16864
|
+
function historyEntry(value) {
|
|
16865
|
+
if (!isRecord5(value) || value.type === "title" || value.type === "session" || typeof value.id !== "string" || value.id.length === 0 || value.parentId !== null && typeof value.parentId !== "string" || typeof value.type !== "string") {
|
|
16866
|
+
return null;
|
|
16867
|
+
}
|
|
16868
|
+
return value;
|
|
16869
|
+
}
|
|
16870
|
+
async function readOmpSessionHistory(sessionFile, maxBytes) {
|
|
16871
|
+
const entries = [];
|
|
16872
|
+
let leafId = null;
|
|
16873
|
+
const lines = readline.createInterface({
|
|
16874
|
+
input: createReadStream(sessionFile, {
|
|
16875
|
+
encoding: "utf8",
|
|
16876
|
+
...maxBytes === void 0 ? {} : { end: maxBytes - 1 }
|
|
16877
|
+
}),
|
|
16878
|
+
crlfDelay: Number.POSITIVE_INFINITY
|
|
16879
|
+
});
|
|
16880
|
+
try {
|
|
16881
|
+
for await (const line of lines) {
|
|
16882
|
+
if (line.length === 0)
|
|
16883
|
+
continue;
|
|
16884
|
+
let parsed;
|
|
16885
|
+
try {
|
|
16886
|
+
parsed = JSON.parse(line);
|
|
16887
|
+
} catch {
|
|
16888
|
+
continue;
|
|
16889
|
+
}
|
|
16890
|
+
const entry = historyEntry(parsed);
|
|
16891
|
+
if (!entry)
|
|
16892
|
+
continue;
|
|
16893
|
+
entries.push(entry);
|
|
16894
|
+
leafId = entry.id;
|
|
16895
|
+
}
|
|
16896
|
+
} finally {
|
|
16897
|
+
lines.close();
|
|
16898
|
+
}
|
|
16899
|
+
return { entries, leafId };
|
|
16900
|
+
}
|
|
16901
|
+
async function readOmpSessionHeader(sessionFile) {
|
|
16902
|
+
const handle = await open(sessionFile, "r");
|
|
16903
|
+
try {
|
|
16904
|
+
const buffer = Buffer.allocUnsafe(MAX_SESSION_HEADER_BYTES);
|
|
16905
|
+
const { bytesRead } = await handle.read(buffer, 0, buffer.length, 0);
|
|
16906
|
+
const contents = buffer.subarray(0, bytesRead);
|
|
16907
|
+
const newline = contents.indexOf(10);
|
|
16908
|
+
if (newline < 0 && bytesRead === buffer.length) {
|
|
16909
|
+
throw new Error("Omp Session header exceeds the supported size");
|
|
16910
|
+
}
|
|
16911
|
+
const contentsText = utf8Decoder.decode(contents);
|
|
16912
|
+
for (const line of contentsText.split("\n")) {
|
|
16913
|
+
if (line.length === 0)
|
|
16914
|
+
continue;
|
|
16915
|
+
let parsed;
|
|
16916
|
+
try {
|
|
16917
|
+
parsed = JSON.parse(line);
|
|
16918
|
+
} catch {
|
|
16919
|
+
continue;
|
|
16920
|
+
}
|
|
16921
|
+
if (!isRecord5(parsed) || parsed.type !== "session")
|
|
16922
|
+
continue;
|
|
16923
|
+
if (typeof parsed.id !== "string" || parsed.id.length === 0 || typeof parsed.cwd !== "string" || parsed.cwd.length === 0) {
|
|
16924
|
+
throw new Error("Omp Session header is invalid");
|
|
16925
|
+
}
|
|
16926
|
+
return { type: "session", id: parsed.id, cwd: parsed.cwd };
|
|
16927
|
+
}
|
|
16928
|
+
throw new Error("Omp Session header is invalid");
|
|
16929
|
+
} finally {
|
|
16930
|
+
await handle.close();
|
|
16931
|
+
}
|
|
16932
|
+
}
|
|
16933
|
+
async function verifyOmpSessionCwd(input) {
|
|
16934
|
+
if (!input.sessionFile)
|
|
16935
|
+
throw new Error("Omp Fork Session has no persisted Session file");
|
|
16936
|
+
const header = await readOmpSessionHeader(input.sessionFile);
|
|
16937
|
+
if (header.id !== input.sessionId) {
|
|
16938
|
+
throw new Error("Omp Fork Session header identity does not match RPC state");
|
|
16939
|
+
}
|
|
16940
|
+
const [actualCwd, expectedCwd] = await Promise.all([
|
|
16941
|
+
realpath(header.cwd),
|
|
16942
|
+
realpath(input.expectedCwd)
|
|
16943
|
+
]);
|
|
16944
|
+
if (actualCwd !== expectedCwd) {
|
|
16945
|
+
throw new Error("Omp Fork Session did not bind the requested cwd");
|
|
16946
|
+
}
|
|
16947
|
+
}
|
|
16948
|
+
|
|
16739
16949
|
// dist/omp-last-turn-rollback.js
|
|
16740
16950
|
function modelFromState(state) {
|
|
16741
16951
|
if (state.provider === null && state.modelId === null)
|
|
@@ -16791,7 +17001,7 @@ async function rollbackOmpLastTurn(transport, sourceSessionId, cwd) {
|
|
|
16791
17001
|
// dist/omp-rpc-session.js
|
|
16792
17002
|
import { spawn, spawnSync } from "node:child_process";
|
|
16793
17003
|
import { randomUUID } from "node:crypto";
|
|
16794
|
-
import
|
|
17004
|
+
import path4 from "node:path";
|
|
16795
17005
|
|
|
16796
17006
|
// ../../harness-discovery/dist/environment.js
|
|
16797
17007
|
import fs from "node:fs";
|
|
@@ -16839,12 +17049,28 @@ function newestFirst(names) {
|
|
|
16839
17049
|
return [...names].sort((left, right) => right.localeCompare(left, void 0, { numeric: true }));
|
|
16840
17050
|
}
|
|
16841
17051
|
|
|
16842
|
-
// ../../harness-discovery/dist/
|
|
17052
|
+
// ../../harness-discovery/dist/invocation.js
|
|
16843
17053
|
import path2 from "node:path";
|
|
17054
|
+
function commandInvocation(command, arguments_, environment, platform = process.platform) {
|
|
17055
|
+
const extension = path2.win32.extname(command).toLowerCase();
|
|
17056
|
+
if (platform !== "win32" || ![".cmd", ".bat"].includes(extension)) {
|
|
17057
|
+
return { command, arguments: [...arguments_], windowsVerbatimArguments: false };
|
|
17058
|
+
}
|
|
17059
|
+
const quote = (value) => `"${value.replaceAll("%", "%%").replaceAll('"', '""')}"`;
|
|
17060
|
+
const commandLine = [command, ...arguments_].map(quote).join(" ");
|
|
17061
|
+
return {
|
|
17062
|
+
command: environmentValue(environment, "ComSpec") ?? "cmd.exe",
|
|
17063
|
+
arguments: ["/d", "/v:off", "/s", "/c", `"${commandLine}"`],
|
|
17064
|
+
windowsVerbatimArguments: true
|
|
17065
|
+
};
|
|
17066
|
+
}
|
|
17067
|
+
|
|
17068
|
+
// ../../harness-discovery/dist/node-runtime.js
|
|
17069
|
+
import path3 from "node:path";
|
|
16844
17070
|
function withNodeRuntimeOnPath(environment, runtimeExecutable = process.execPath, platform = process.platform) {
|
|
16845
17071
|
const pathKey = Object.keys(environment).find((name) => name.toLowerCase() === "path") ?? "PATH";
|
|
16846
17072
|
const delimiter = platform === "win32" ? ";" : ":";
|
|
16847
|
-
const runtimeDirectory =
|
|
17073
|
+
const runtimeDirectory = path3.dirname(runtimeExecutable);
|
|
16848
17074
|
const directories = (environment[pathKey] ?? "").split(delimiter).filter(Boolean);
|
|
16849
17075
|
const equal = platform === "win32" ? (value) => value.toLowerCase() : (value) => value;
|
|
16850
17076
|
if (!directories.some((directory) => equal(directory) === equal(runtimeDirectory))) {
|
|
@@ -17016,6 +17242,101 @@ function resolveHarnessExecutable(spec, input, dependencies = {}) {
|
|
|
17016
17242
|
return void 0;
|
|
17017
17243
|
}
|
|
17018
17244
|
|
|
17245
|
+
// ../../harness-discovery/dist/installation.js
|
|
17246
|
+
import { execFile } from "node:child_process";
|
|
17247
|
+
import { homedir } from "node:os";
|
|
17248
|
+
function runInstallationCommand(command, args, environment, timeout = 3e4) {
|
|
17249
|
+
const env = withNodeRuntimeOnPath(environment);
|
|
17250
|
+
const invocation = /\.[cm]?js$/i.test(command) ? commandInvocation(process.execPath, [command, ...args], env) : commandInvocation(command, args, env);
|
|
17251
|
+
return new Promise((resolve, reject) => {
|
|
17252
|
+
const child = execFile(invocation.command, invocation.arguments, {
|
|
17253
|
+
env,
|
|
17254
|
+
cwd: env.HOME ?? env.USERPROFILE ?? homedir(),
|
|
17255
|
+
encoding: "utf8",
|
|
17256
|
+
timeout,
|
|
17257
|
+
killSignal: "SIGKILL",
|
|
17258
|
+
maxBuffer: 1024 * 1024,
|
|
17259
|
+
windowsHide: true,
|
|
17260
|
+
windowsVerbatimArguments: invocation.windowsVerbatimArguments
|
|
17261
|
+
}, (error51, stdout, stderr) => {
|
|
17262
|
+
if (error51)
|
|
17263
|
+
reject(new Error(error51.killed ? "Harness command timed out" : "Harness command failed; check the native installation and retry"));
|
|
17264
|
+
else
|
|
17265
|
+
resolve((stdout || stderr).trim());
|
|
17266
|
+
});
|
|
17267
|
+
child.stdin?.end();
|
|
17268
|
+
});
|
|
17269
|
+
}
|
|
17270
|
+
function installationVersion(value) {
|
|
17271
|
+
if (typeof value !== "string" || !/^v?\d+(?:\.\d+){1,3}(?:-[\w.-]+)?(?:\+[\w.-]+)?$/.test(value.trim()))
|
|
17272
|
+
throw new Error("Harness returned an invalid version");
|
|
17273
|
+
return value.trim().replace(/^v/, "");
|
|
17274
|
+
}
|
|
17275
|
+
function versionFromOutput(output) {
|
|
17276
|
+
return installationVersion(output.match(/\b\d+(?:\.\d+){1,3}(?:-[\w.-]+)?(?:\+[\w.-]+)?\b/)?.[0]);
|
|
17277
|
+
}
|
|
17278
|
+
function newerInstallationVersion(current, latest) {
|
|
17279
|
+
const a = installationVersion(current).replace(/\+.*/, "");
|
|
17280
|
+
const b = installationVersion(latest).replace(/\+.*/, "");
|
|
17281
|
+
const coreA = a.replace(/-.*/, "").split(".").map(BigInt);
|
|
17282
|
+
const coreB = b.replace(/-.*/, "").split(".").map(BigInt);
|
|
17283
|
+
for (let i = 0; i < Math.max(coreA.length, coreB.length); i++) {
|
|
17284
|
+
if ((coreA[i] ?? 0n) !== (coreB[i] ?? 0n))
|
|
17285
|
+
return (coreB[i] ?? 0n) > (coreA[i] ?? 0n);
|
|
17286
|
+
}
|
|
17287
|
+
const preA = a.includes("-") ? a.slice(a.indexOf("-") + 1).split(".") : [];
|
|
17288
|
+
const preB = b.includes("-") ? b.slice(b.indexOf("-") + 1).split(".") : [];
|
|
17289
|
+
if (!preA.length || !preB.length)
|
|
17290
|
+
return !!preA.length && !preB.length;
|
|
17291
|
+
for (let i = 0; i < Math.max(preA.length, preB.length); i++) {
|
|
17292
|
+
const x = preA[i];
|
|
17293
|
+
const y = preB[i];
|
|
17294
|
+
if (x === y)
|
|
17295
|
+
continue;
|
|
17296
|
+
if (x === void 0 || y === void 0)
|
|
17297
|
+
return x === void 0;
|
|
17298
|
+
const numericX = /^\d+$/.test(x);
|
|
17299
|
+
const numericY = /^\d+$/.test(y);
|
|
17300
|
+
if (numericX && numericY) {
|
|
17301
|
+
if (BigInt(x) === BigInt(y))
|
|
17302
|
+
continue;
|
|
17303
|
+
return BigInt(y) > BigInt(x);
|
|
17304
|
+
}
|
|
17305
|
+
if (numericX !== numericY)
|
|
17306
|
+
return numericX;
|
|
17307
|
+
return y > x;
|
|
17308
|
+
}
|
|
17309
|
+
return false;
|
|
17310
|
+
}
|
|
17311
|
+
function createInstallationManager(options) {
|
|
17312
|
+
let checking;
|
|
17313
|
+
let updating;
|
|
17314
|
+
const check2 = () => checking ??= options.check().finally(() => {
|
|
17315
|
+
checking = void 0;
|
|
17316
|
+
});
|
|
17317
|
+
return (action) => {
|
|
17318
|
+
if (updating)
|
|
17319
|
+
return updating;
|
|
17320
|
+
if (action === "check")
|
|
17321
|
+
return check2();
|
|
17322
|
+
updating = (async () => {
|
|
17323
|
+
const before = await check2();
|
|
17324
|
+
if (!before.updateAvailable)
|
|
17325
|
+
return before;
|
|
17326
|
+
if (!before.canUpdate)
|
|
17327
|
+
throw new Error(before.message ?? "This installation cannot be updated automatically");
|
|
17328
|
+
await options.update(before);
|
|
17329
|
+
const after = await check2();
|
|
17330
|
+
if (after.currentVersion === before.currentVersion)
|
|
17331
|
+
throw new Error("The Harness version did not change; check the native updater and retry");
|
|
17332
|
+
return after;
|
|
17333
|
+
})().finally(() => {
|
|
17334
|
+
updating = void 0;
|
|
17335
|
+
});
|
|
17336
|
+
return updating;
|
|
17337
|
+
};
|
|
17338
|
+
}
|
|
17339
|
+
|
|
17019
17340
|
// dist/command.js
|
|
17020
17341
|
var ompDiscoverySpec = {
|
|
17021
17342
|
id: "omp",
|
|
@@ -17043,14 +17364,14 @@ function resolveOmpExecutable(input, dependencies = {}) {
|
|
|
17043
17364
|
}
|
|
17044
17365
|
|
|
17045
17366
|
// dist/omp-usage.js
|
|
17046
|
-
function
|
|
17367
|
+
function isRecord6(value) {
|
|
17047
17368
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
17048
17369
|
}
|
|
17049
17370
|
function nonNegativeSafeInteger(value) {
|
|
17050
17371
|
return typeof value === "number" && Number.isSafeInteger(value) && value >= 0 ? value : null;
|
|
17051
17372
|
}
|
|
17052
17373
|
function optionalOmpCacheHitRatePercent(value) {
|
|
17053
|
-
if (!
|
|
17374
|
+
if (!isRecord6(value) || value.role !== "assistant" || !isRecord6(value.usage))
|
|
17054
17375
|
return null;
|
|
17055
17376
|
const input = nonNegativeSafeInteger(value.usage.input);
|
|
17056
17377
|
const cacheRead = nonNegativeSafeInteger(value.usage.cacheRead);
|
|
@@ -17063,20 +17384,20 @@ function optionalOmpCacheHitRatePercent(value) {
|
|
|
17063
17384
|
function latestOmpCacheHitRatePercent(history) {
|
|
17064
17385
|
let latest = null;
|
|
17065
17386
|
for (const entry of activeOmpEntries(history)) {
|
|
17066
|
-
if (entry.type === "message" &&
|
|
17387
|
+
if (entry.type === "message" && isRecord6(entry.message) && entry.message.role === "assistant") {
|
|
17067
17388
|
latest = optionalOmpCacheHitRatePercent(entry.message);
|
|
17068
17389
|
}
|
|
17069
17390
|
}
|
|
17070
17391
|
return latest;
|
|
17071
17392
|
}
|
|
17072
17393
|
function responseData(response, operation) {
|
|
17073
|
-
if (!
|
|
17394
|
+
if (!isRecord6(response.data)) {
|
|
17074
17395
|
throw new Error(`Omp RPC ${operation} response has no data`);
|
|
17075
17396
|
}
|
|
17076
17397
|
return response.data;
|
|
17077
17398
|
}
|
|
17078
17399
|
function contextUsage(value) {
|
|
17079
|
-
if (!
|
|
17400
|
+
if (!isRecord6(value))
|
|
17080
17401
|
throw new Error("Omp RPC context Usage is invalid");
|
|
17081
17402
|
return parseHostUsage({
|
|
17082
17403
|
contextUsedTokens: value.tokens,
|
|
@@ -17086,15 +17407,15 @@ function contextUsage(value) {
|
|
|
17086
17407
|
function parseOmpSessionUsage(response) {
|
|
17087
17408
|
const data = responseData(response, "Session stats");
|
|
17088
17409
|
const tokens = data.tokens;
|
|
17089
|
-
if (tokens !== void 0 && !
|
|
17410
|
+
if (tokens !== void 0 && !isRecord6(tokens)) {
|
|
17090
17411
|
throw new Error("Omp RPC Session stats tokens are invalid");
|
|
17091
17412
|
}
|
|
17092
17413
|
return parseHostUsage({
|
|
17093
|
-
...
|
|
17094
|
-
...
|
|
17095
|
-
...
|
|
17096
|
-
...
|
|
17097
|
-
...
|
|
17414
|
+
...isRecord6(tokens) && tokens.input !== void 0 ? { inputTokens: tokens.input } : {},
|
|
17415
|
+
...isRecord6(tokens) && tokens.cacheRead !== void 0 ? { cachedInputTokens: tokens.cacheRead } : {},
|
|
17416
|
+
...isRecord6(tokens) && tokens.cacheWrite !== void 0 ? { cacheWriteInputTokens: tokens.cacheWrite } : {},
|
|
17417
|
+
...isRecord6(tokens) && tokens.output !== void 0 ? { outputTokens: tokens.output } : {},
|
|
17418
|
+
...isRecord6(tokens) && tokens.total !== void 0 ? { totalTokens: tokens.total } : {},
|
|
17098
17419
|
...data.cost !== void 0 ? { totalCostUsd: data.cost } : {},
|
|
17099
17420
|
...data.contextUsage !== void 0 ? contextUsage(data.contextUsage) : {}
|
|
17100
17421
|
});
|
|
@@ -17113,97 +17434,6 @@ function optionalOmpStateContextUsage(value) {
|
|
|
17113
17434
|
}
|
|
17114
17435
|
}
|
|
17115
17436
|
|
|
17116
|
-
// dist/omp-session-file.js
|
|
17117
|
-
import { createReadStream } from "node:fs";
|
|
17118
|
-
import { open, realpath } from "node:fs/promises";
|
|
17119
|
-
import readline from "node:readline";
|
|
17120
|
-
var MAX_SESSION_HEADER_BYTES = 64 * 1024;
|
|
17121
|
-
var utf8Decoder = new TextDecoder("utf-8", { fatal: true });
|
|
17122
|
-
function isRecord6(value) {
|
|
17123
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
17124
|
-
}
|
|
17125
|
-
function historyEntry(value) {
|
|
17126
|
-
if (!isRecord6(value) || value.type === "title" || value.type === "session" || typeof value.id !== "string" || value.id.length === 0 || value.parentId !== null && typeof value.parentId !== "string" || typeof value.type !== "string") {
|
|
17127
|
-
return null;
|
|
17128
|
-
}
|
|
17129
|
-
return value;
|
|
17130
|
-
}
|
|
17131
|
-
async function readOmpSessionHistory(sessionFile) {
|
|
17132
|
-
const entries = [];
|
|
17133
|
-
let leafId = null;
|
|
17134
|
-
const lines = readline.createInterface({
|
|
17135
|
-
input: createReadStream(sessionFile, { encoding: "utf8" }),
|
|
17136
|
-
crlfDelay: Number.POSITIVE_INFINITY
|
|
17137
|
-
});
|
|
17138
|
-
try {
|
|
17139
|
-
for await (const line of lines) {
|
|
17140
|
-
if (line.length === 0)
|
|
17141
|
-
continue;
|
|
17142
|
-
let parsed;
|
|
17143
|
-
try {
|
|
17144
|
-
parsed = JSON.parse(line);
|
|
17145
|
-
} catch {
|
|
17146
|
-
continue;
|
|
17147
|
-
}
|
|
17148
|
-
const entry = historyEntry(parsed);
|
|
17149
|
-
if (!entry)
|
|
17150
|
-
continue;
|
|
17151
|
-
entries.push(entry);
|
|
17152
|
-
leafId = entry.id;
|
|
17153
|
-
}
|
|
17154
|
-
} finally {
|
|
17155
|
-
lines.close();
|
|
17156
|
-
}
|
|
17157
|
-
return { entries, leafId };
|
|
17158
|
-
}
|
|
17159
|
-
async function readOmpSessionHeader(sessionFile) {
|
|
17160
|
-
const handle = await open(sessionFile, "r");
|
|
17161
|
-
try {
|
|
17162
|
-
const buffer = Buffer.allocUnsafe(MAX_SESSION_HEADER_BYTES);
|
|
17163
|
-
const { bytesRead } = await handle.read(buffer, 0, buffer.length, 0);
|
|
17164
|
-
const contents = buffer.subarray(0, bytesRead);
|
|
17165
|
-
const newline = contents.indexOf(10);
|
|
17166
|
-
if (newline < 0 && bytesRead === buffer.length) {
|
|
17167
|
-
throw new Error("Omp Session header exceeds the supported size");
|
|
17168
|
-
}
|
|
17169
|
-
const contentsText = utf8Decoder.decode(contents);
|
|
17170
|
-
for (const line of contentsText.split("\n")) {
|
|
17171
|
-
if (line.length === 0)
|
|
17172
|
-
continue;
|
|
17173
|
-
let parsed;
|
|
17174
|
-
try {
|
|
17175
|
-
parsed = JSON.parse(line);
|
|
17176
|
-
} catch {
|
|
17177
|
-
continue;
|
|
17178
|
-
}
|
|
17179
|
-
if (!isRecord6(parsed) || parsed.type !== "session")
|
|
17180
|
-
continue;
|
|
17181
|
-
if (typeof parsed.id !== "string" || parsed.id.length === 0 || typeof parsed.cwd !== "string" || parsed.cwd.length === 0) {
|
|
17182
|
-
throw new Error("Omp Session header is invalid");
|
|
17183
|
-
}
|
|
17184
|
-
return { type: "session", id: parsed.id, cwd: parsed.cwd };
|
|
17185
|
-
}
|
|
17186
|
-
throw new Error("Omp Session header is invalid");
|
|
17187
|
-
} finally {
|
|
17188
|
-
await handle.close();
|
|
17189
|
-
}
|
|
17190
|
-
}
|
|
17191
|
-
async function verifyOmpSessionCwd(input) {
|
|
17192
|
-
if (!input.sessionFile)
|
|
17193
|
-
throw new Error("Omp Fork Session has no persisted Session file");
|
|
17194
|
-
const header = await readOmpSessionHeader(input.sessionFile);
|
|
17195
|
-
if (header.id !== input.sessionId) {
|
|
17196
|
-
throw new Error("Omp Fork Session header identity does not match RPC state");
|
|
17197
|
-
}
|
|
17198
|
-
const [actualCwd, expectedCwd] = await Promise.all([
|
|
17199
|
-
realpath(header.cwd),
|
|
17200
|
-
realpath(input.expectedCwd)
|
|
17201
|
-
]);
|
|
17202
|
-
if (actualCwd !== expectedCwd) {
|
|
17203
|
-
throw new Error("Omp Fork Session did not bind the requested cwd");
|
|
17204
|
-
}
|
|
17205
|
-
}
|
|
17206
|
-
|
|
17207
17437
|
// dist/omp-protocol.js
|
|
17208
17438
|
var MAX_FRAME_BYTES = 1024 * 1024;
|
|
17209
17439
|
var MAX_REASSEMBLED_BYTES = 64 * 1024 * 1024;
|
|
@@ -17479,7 +17709,7 @@ function ompRpcProcessCommand(options, dependencies = {}) {
|
|
|
17479
17709
|
...modelArguments,
|
|
17480
17710
|
...sessionArguments
|
|
17481
17711
|
];
|
|
17482
|
-
const extension =
|
|
17712
|
+
const extension = path4.win32.extname(command).toLowerCase();
|
|
17483
17713
|
if (platform !== "win32" || ![".cmd", ".bat"].includes(extension)) {
|
|
17484
17714
|
return { command, arguments: arguments_, windowsVerbatimArguments: false };
|
|
17485
17715
|
}
|
|
@@ -17598,6 +17828,9 @@ var OmpRpcSession = class {
|
|
|
17598
17828
|
new Promise((_resolve, reject) => setTimeout(() => reject(new Error("Omp RPC ready signal timed out")), this.#options.commandTimeoutMs))
|
|
17599
17829
|
]);
|
|
17600
17830
|
await this.#send("negotiate_protocol", { protocolVersion: 2 }).catch(() => void 0);
|
|
17831
|
+
if (this.#options.subscribeSubagentEvents !== false) {
|
|
17832
|
+
await this.#send("set_subagent_subscription", { level: "events" }).catch(() => void 0);
|
|
17833
|
+
}
|
|
17601
17834
|
try {
|
|
17602
17835
|
this.#state = parseSessionState(await this.#send("get_state", {}));
|
|
17603
17836
|
} catch (error51) {
|
|
@@ -18743,6 +18976,46 @@ function sessionFileFromRef(ref) {
|
|
|
18743
18976
|
}
|
|
18744
18977
|
return ref.locator.sessionFile;
|
|
18745
18978
|
}
|
|
18979
|
+
var MAX_SUBAGENT_TRANSCRIPT_BYTES = 8 * 1024 * 1024;
|
|
18980
|
+
function subagentTranscriptPath(parentSessionFile, nativeSubagentId) {
|
|
18981
|
+
if (nativeSubagentId.includes("/") || nativeSubagentId.includes("\\") || nativeSubagentId.includes("\0") || nativeSubagentId === "." || nativeSubagentId === "..") {
|
|
18982
|
+
throw new Error("Omp Subagent ID is not a plain transcript file name");
|
|
18983
|
+
}
|
|
18984
|
+
if (!parentSessionFile.endsWith(".jsonl") || !path5.isAbsolute(parentSessionFile)) {
|
|
18985
|
+
return null;
|
|
18986
|
+
}
|
|
18987
|
+
return `${parentSessionFile.slice(0, -".jsonl".length)}/${nativeSubagentId}.jsonl`;
|
|
18988
|
+
}
|
|
18989
|
+
async function readSubagentTranscriptFile(parentSessionFile, nativeSubagentId) {
|
|
18990
|
+
const transcriptFile = subagentTranscriptPath(parentSessionFile, nativeSubagentId);
|
|
18991
|
+
if (transcriptFile === null)
|
|
18992
|
+
return { status: "missing" };
|
|
18993
|
+
const parentDirectory = path5.dirname(transcriptFile);
|
|
18994
|
+
let metadata;
|
|
18995
|
+
try {
|
|
18996
|
+
metadata = await stat(transcriptFile);
|
|
18997
|
+
} catch (error51) {
|
|
18998
|
+
if (error51.code === "ENOENT")
|
|
18999
|
+
return { status: "missing" };
|
|
19000
|
+
throw error51;
|
|
19001
|
+
}
|
|
19002
|
+
if (!metadata.isFile())
|
|
19003
|
+
return { status: "missing" };
|
|
19004
|
+
if (metadata.size > MAX_SUBAGENT_TRANSCRIPT_BYTES) {
|
|
19005
|
+
throw new Error("Omp Subagent transcript exceeds the supported size");
|
|
19006
|
+
}
|
|
19007
|
+
const [resolvedTranscript, resolvedParentDirectory] = await Promise.all([
|
|
19008
|
+
realpath2(transcriptFile),
|
|
19009
|
+
realpath2(parentDirectory)
|
|
19010
|
+
]);
|
|
19011
|
+
if (path5.dirname(resolvedTranscript) !== resolvedParentDirectory) {
|
|
19012
|
+
throw new Error("Omp Subagent transcript resolves outside its parent Session directory");
|
|
19013
|
+
}
|
|
19014
|
+
return {
|
|
19015
|
+
status: "read",
|
|
19016
|
+
history: await readOmpSessionHistory(transcriptFile, MAX_SUBAGENT_TRANSCRIPT_BYTES)
|
|
19017
|
+
};
|
|
19018
|
+
}
|
|
18746
19019
|
function toolFailure(toolName) {
|
|
18747
19020
|
return {
|
|
18748
19021
|
code: "nativeFailure",
|
|
@@ -18800,10 +19073,10 @@ function stripDiffPrefix(pathString) {
|
|
|
18800
19073
|
return pathString.startsWith("a/") || pathString.startsWith("b/") ? pathString.slice(2) : pathString;
|
|
18801
19074
|
}
|
|
18802
19075
|
function displayPath(nativePath, cwd) {
|
|
18803
|
-
const resolvedCwd =
|
|
18804
|
-
const resolvedPath =
|
|
18805
|
-
const relative =
|
|
18806
|
-
const inside = relative.length > 0 && relative !== ".." && !relative.startsWith(`..${
|
|
19076
|
+
const resolvedCwd = path5.resolve(cwd);
|
|
19077
|
+
const resolvedPath = path5.isAbsolute(nativePath) ? path5.resolve(nativePath) : path5.resolve(cwd, nativePath);
|
|
19078
|
+
const relative = path5.relative(resolvedCwd, resolvedPath);
|
|
19079
|
+
const inside = relative.length > 0 && relative !== ".." && !relative.startsWith(`..${path5.sep}`);
|
|
18807
19080
|
const selected = inside ? relative : resolvedPath;
|
|
18808
19081
|
const normalized = selected.replaceAll("\\", "/");
|
|
18809
19082
|
if (normalized.length === 0 || normalized === ".")
|
|
@@ -20349,9 +20622,18 @@ var OmpAdapter = class {
|
|
|
20349
20622
|
}
|
|
20350
20623
|
let transport;
|
|
20351
20624
|
try {
|
|
20625
|
+
const transcriptFile = await readSubagentTranscriptFile(sessionFileFromRef(input.parent), input.nativeSubagentId);
|
|
20626
|
+
if (transcriptFile.status === "read") {
|
|
20627
|
+
const snapshot2 = mapOmpSnapshot(transcriptFile.history, {
|
|
20628
|
+
sessionId: input.parent.nativeSessionId,
|
|
20629
|
+
model: null
|
|
20630
|
+
});
|
|
20631
|
+
return { ok: true, value: snapshot2 };
|
|
20632
|
+
}
|
|
20352
20633
|
transport = this.#createTransport({
|
|
20353
20634
|
cwd: input.cwd,
|
|
20354
20635
|
sessionFile: sessionFileFromRef(input.parent),
|
|
20636
|
+
subscribeSubagentEvents: false,
|
|
20355
20637
|
onFault: () => void 0
|
|
20356
20638
|
});
|
|
20357
20639
|
await transport.start();
|
|
@@ -20423,7 +20705,11 @@ var OmpAdapter = class {
|
|
|
20423
20705
|
async #inspectCwd(cwd) {
|
|
20424
20706
|
const startedAt = Date.now();
|
|
20425
20707
|
let stage = "spawn";
|
|
20426
|
-
const transport = this.#createTransport({
|
|
20708
|
+
const transport = this.#createTransport({
|
|
20709
|
+
cwd,
|
|
20710
|
+
subscribeSubagentEvents: false,
|
|
20711
|
+
onFault: () => void 0
|
|
20712
|
+
});
|
|
20427
20713
|
this.#inspections.add(transport);
|
|
20428
20714
|
try {
|
|
20429
20715
|
stage = "startup";
|
|
@@ -20650,14 +20936,51 @@ var OmpAdapter = class {
|
|
|
20650
20936
|
}
|
|
20651
20937
|
};
|
|
20652
20938
|
|
|
20939
|
+
// dist/installation.js
|
|
20940
|
+
import { realpath as realpath3 } from "node:fs/promises";
|
|
20941
|
+
import path6 from "node:path";
|
|
20942
|
+
function createOmpInstallation(environment, command) {
|
|
20943
|
+
let executable;
|
|
20944
|
+
let env;
|
|
20945
|
+
return createInstallationManager({
|
|
20946
|
+
async check() {
|
|
20947
|
+
executable = resolveOmpExecutable({ environment, ...command ? { command } : {} });
|
|
20948
|
+
const selected = await realpath3(executable);
|
|
20949
|
+
const pathKey = Object.keys(environment).find((key) => key.toLowerCase() === "path") ?? "PATH";
|
|
20950
|
+
env = {
|
|
20951
|
+
...environment,
|
|
20952
|
+
[pathKey]: `${path6.dirname(executable)}${path6.delimiter}${environment[pathKey] ?? ""}`
|
|
20953
|
+
};
|
|
20954
|
+
const target = resolveHarnessExecutable({ id: "omp", command: "omp", installRoots: { posix: [], windows: [] } }, { environment: env });
|
|
20955
|
+
const canUpdate = !selected.includes("/nix/store/") && !!target && await realpath3(target.executable) === selected;
|
|
20956
|
+
const output = await runInstallationCommand(executable, ["update", "--check"], env);
|
|
20957
|
+
const currentVersion = versionFromOutput(output);
|
|
20958
|
+
const available = output.match(/New version available:\s*(\S+)/i);
|
|
20959
|
+
if (!available && !/already up to date/i.test(output))
|
|
20960
|
+
throw new Error("OMP update check returned an unknown response");
|
|
20961
|
+
const latestVersion = available ? installationVersion(available[1]) : currentVersion;
|
|
20962
|
+
return {
|
|
20963
|
+
currentVersion,
|
|
20964
|
+
latestVersion,
|
|
20965
|
+
updateAvailable: newerInstallationVersion(currentVersion, latestVersion),
|
|
20966
|
+
canUpdate,
|
|
20967
|
+
...!canUpdate ? { message: "Update this installation with its original package manager or launcher." } : {}
|
|
20968
|
+
};
|
|
20969
|
+
},
|
|
20970
|
+
async update() {
|
|
20971
|
+
await runInstallationCommand(executable, ["update"], env, 3e5);
|
|
20972
|
+
}
|
|
20973
|
+
});
|
|
20974
|
+
}
|
|
20975
|
+
|
|
20653
20976
|
// dist/plugin.js
|
|
20654
20977
|
var OMP_COMMAND_ENV = "CODEXHOST_OMP_COMMAND";
|
|
20655
20978
|
function createHarnessAdapter(context) {
|
|
20656
20979
|
const environment = { ...context.environment };
|
|
20657
|
-
return new OmpAdapter({
|
|
20980
|
+
return Object.assign(new OmpAdapter({
|
|
20658
20981
|
...environment[OMP_COMMAND_ENV] ? { command: environment[OMP_COMMAND_ENV] } : {},
|
|
20659
20982
|
environment
|
|
20660
|
-
});
|
|
20983
|
+
}), { installation: createOmpInstallation(environment, environment[OMP_COMMAND_ENV]) });
|
|
20661
20984
|
}
|
|
20662
20985
|
export {
|
|
20663
20986
|
OMP_COMMAND_ENV,
|