@liberseek/boft-cli-linux-x64 0.8.4 → 0.8.5
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 +59 -8
- package/app/console-web.js +278 -63
- package/app/desktop-controller.mjs +641 -33
- package/app/host-runtime.mjs +1811 -685
- package/app/plugins/antigravity/plugin.mjs +346 -54
- package/app/plugins/claude-code/plugin.mjs +391 -259
- package/app/plugins/codebuddy/plugin.mjs +231 -134
- package/app/plugins/codex-usage/plugin.mjs +82 -32
- package/app/plugins/copilot/plugin.mjs +107 -57
- package/app/plugins/cursor-cli/plugin.mjs +193 -131
- package/app/plugins/deepseek-harness/plugin.mjs +112 -42
- package/app/plugins/grok/plugin.mjs +371 -115
- package/app/plugins/hermes/plugin.mjs +54 -4
- package/app/plugins/kimi-code/plugin.mjs +69 -19
- package/app/plugins/kiro-cli/plugin.mjs +69 -19
- package/app/plugins/muse/plugin.mjs +59 -9
- package/app/plugins/omp/plugin.mjs +89 -39
- package/app/plugins/opencode/plugin.mjs +111 -61
- package/app/plugins/pi/plugin.mjs +185 -68
- package/app/plugins/qoder/plugin.mjs +79 -29
- package/app/plugins/qoder-cn/plugin.mjs +79 -29
- package/app/plugins/workbuddy/plugin.mjs +231 -134
- package/app/plugins/zcode/plugin.mjs +108 -33
- package/app/renderer-extension.js +2634 -329
- package/bin/boft +0 -0
- package/libexec/boft-shim +0 -0
- package/libexec/boft-updater +0 -0
- package/package.json +1 -1
|
@@ -3516,10 +3516,10 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
3516
3516
|
const shape = def.shape;
|
|
3517
3517
|
const propValues = {};
|
|
3518
3518
|
for (const key in shape) {
|
|
3519
|
-
const
|
|
3520
|
-
if (
|
|
3519
|
+
const field2 = shape[key]._zod;
|
|
3520
|
+
if (field2.values) {
|
|
3521
3521
|
propValues[key] ?? (propValues[key] = /* @__PURE__ */ new Set());
|
|
3522
|
-
for (const v of
|
|
3522
|
+
for (const v of field2.values)
|
|
3523
3523
|
propValues[key].add(v);
|
|
3524
3524
|
}
|
|
3525
3525
|
}
|
|
@@ -15159,6 +15159,8 @@ var usageStatisticsTotalsSchema = external_exports.strictObject({
|
|
|
15159
15159
|
cachedInputTokens: count,
|
|
15160
15160
|
cacheWriteInputTokens: count,
|
|
15161
15161
|
cacheKnownInputTokens: count,
|
|
15162
|
+
cacheHitCachedInputTokens: count,
|
|
15163
|
+
cacheHitInputTokens: count,
|
|
15162
15164
|
outputTokens: count,
|
|
15163
15165
|
reasoningOutputTokens: count,
|
|
15164
15166
|
/** USD at the public price, summed over the priced requests only. */
|
|
@@ -15266,6 +15268,51 @@ var hostInteractionIdSchema = opaqueIdSchema.brand();
|
|
|
15266
15268
|
var threadPrewarmDiscardParamsSchema = external_exports.object({ threadId: hostThreadIdSchema });
|
|
15267
15269
|
var threadPrewarmDiscardResultSchema = external_exports.object({ discarded: external_exports.boolean() });
|
|
15268
15270
|
|
|
15271
|
+
// ../../shared-contracts/dist/thread-questions.js
|
|
15272
|
+
var field = external_exports.discriminatedUnion("type", [
|
|
15273
|
+
external_exports.object({
|
|
15274
|
+
id: external_exports.string().min(1),
|
|
15275
|
+
type: external_exports.literal("choice"),
|
|
15276
|
+
prompt: external_exports.string(),
|
|
15277
|
+
options: external_exports.array(external_exports.object({
|
|
15278
|
+
value: external_exports.string().min(1),
|
|
15279
|
+
label: external_exports.string(),
|
|
15280
|
+
description: external_exports.string().optional()
|
|
15281
|
+
})).min(1),
|
|
15282
|
+
multiple: external_exports.boolean(),
|
|
15283
|
+
allowOther: external_exports.boolean(),
|
|
15284
|
+
optional: external_exports.boolean()
|
|
15285
|
+
}),
|
|
15286
|
+
external_exports.object({
|
|
15287
|
+
id: external_exports.string().min(1),
|
|
15288
|
+
type: external_exports.literal("text"),
|
|
15289
|
+
prompt: external_exports.string(),
|
|
15290
|
+
multiline: external_exports.boolean(),
|
|
15291
|
+
secret: external_exports.literal(false),
|
|
15292
|
+
optional: external_exports.boolean(),
|
|
15293
|
+
placeholder: external_exports.string().optional(),
|
|
15294
|
+
prefill: external_exports.string().optional()
|
|
15295
|
+
})
|
|
15296
|
+
]);
|
|
15297
|
+
var threadQuestionSchema = external_exports.object({
|
|
15298
|
+
interactionId: external_exports.string().min(1),
|
|
15299
|
+
turnId: external_exports.string().min(1),
|
|
15300
|
+
title: external_exports.string().optional(),
|
|
15301
|
+
questions: external_exports.array(field).min(1)
|
|
15302
|
+
}).refine(({ questions }) => questions.some((q) => q.type === "choice" && q.multiple), {
|
|
15303
|
+
message: "Shared cards require at least one multi-select question"
|
|
15304
|
+
});
|
|
15305
|
+
var threadQuestionsListParamsSchema = external_exports.strictObject({ threadId: external_exports.string().min(1) });
|
|
15306
|
+
var threadQuestionsResultSchema = external_exports.object({ questions: external_exports.array(threadQuestionSchema) });
|
|
15307
|
+
var threadQuestionRespondParamsSchema = external_exports.strictObject({
|
|
15308
|
+
threadId: external_exports.string().min(1),
|
|
15309
|
+
turnId: external_exports.string().min(1),
|
|
15310
|
+
interactionId: external_exports.string().min(1),
|
|
15311
|
+
answers: external_exports.record(external_exports.string(), external_exports.array(external_exports.string())),
|
|
15312
|
+
cancelled: external_exports.boolean().default(false)
|
|
15313
|
+
});
|
|
15314
|
+
var threadQuestionRespondResultSchema = external_exports.object({ accepted: external_exports.literal(true) });
|
|
15315
|
+
|
|
15269
15316
|
// ../../shared-contracts/dist/harness-plugins.js
|
|
15270
15317
|
var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
|
|
15271
15318
|
var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
|
|
@@ -16035,7 +16082,10 @@ var harnessPluginRouteSchema = external_exports.object({
|
|
|
16035
16082
|
harnessId: harnessPluginIdSchema,
|
|
16036
16083
|
model: harnessModelRefSchema.optional(),
|
|
16037
16084
|
thinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
16038
|
-
permissionModeId: harnessPermissionModeIdSchema.optional()
|
|
16085
|
+
permissionModeId: harnessPermissionModeIdSchema.optional(),
|
|
16086
|
+
/** A draft prewarm create: stays unsubmitted until the user's first Turn.
|
|
16087
|
+
* Desktop forwards only the Model of a main-process prewarm to thread/start. */
|
|
16088
|
+
prewarm: external_exports.literal(true).optional()
|
|
16039
16089
|
}).strict();
|
|
16040
16090
|
|
|
16041
16091
|
// ../../shared-contracts/dist/harness-launch-settings.js
|
|
@@ -16663,26 +16713,26 @@ function parseHostUsage(value) {
|
|
|
16663
16713
|
}
|
|
16664
16714
|
}
|
|
16665
16715
|
const indicators = value.composerIndicators === void 0 ? {} : { composerIndicators: composerIndicatorsSchema.parse(value.composerIndicators) };
|
|
16666
|
-
for (const
|
|
16716
|
+
for (const field2 of [
|
|
16667
16717
|
"totalCredits",
|
|
16668
16718
|
"contextUsagePercent",
|
|
16669
16719
|
"apiOutputTokensPerSecond"
|
|
16670
16720
|
]) {
|
|
16671
|
-
const candidate = value[
|
|
16721
|
+
const candidate = value[field2];
|
|
16672
16722
|
if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isFinite(candidate) || candidate < 0)) {
|
|
16673
|
-
throw new Error(`Harness Usage '${
|
|
16723
|
+
throw new Error(`Harness Usage '${field2}' must be a finite non-negative number`);
|
|
16674
16724
|
}
|
|
16675
16725
|
}
|
|
16676
|
-
for (const
|
|
16677
|
-
const candidate = value[
|
|
16726
|
+
for (const field2 of tokenFields) {
|
|
16727
|
+
const candidate = value[field2];
|
|
16678
16728
|
if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isSafeInteger(candidate) || candidate < 0)) {
|
|
16679
|
-
throw new Error(`Harness Usage '${
|
|
16729
|
+
throw new Error(`Harness Usage '${field2}' must be a non-negative safe integer`);
|
|
16680
16730
|
}
|
|
16681
16731
|
}
|
|
16682
|
-
for (const
|
|
16683
|
-
const candidate = value[
|
|
16732
|
+
for (const field2 of safeIntegerFields) {
|
|
16733
|
+
const candidate = value[field2];
|
|
16684
16734
|
if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isSafeInteger(candidate) || candidate < 0)) {
|
|
16685
|
-
throw new Error(`Harness Usage '${
|
|
16735
|
+
throw new Error(`Harness Usage '${field2}' must be a non-negative safe integer`);
|
|
16686
16736
|
}
|
|
16687
16737
|
}
|
|
16688
16738
|
if (value.outputTokensPerSecond !== void 0 && (typeof value.outputTokensPerSecond !== "number" || !Number.isFinite(value.outputTokensPerSecond) || value.outputTokensPerSecond < 0)) {
|
|
@@ -16691,16 +16741,16 @@ function parseHostUsage(value) {
|
|
|
16691
16741
|
if (value.totalCostUsd !== void 0 && (typeof value.totalCostUsd !== "number" || !Number.isFinite(value.totalCostUsd) || value.totalCostUsd < 0)) {
|
|
16692
16742
|
throw new Error("Harness Usage 'totalCostUsd' must be a finite non-negative number");
|
|
16693
16743
|
}
|
|
16694
|
-
for (const
|
|
16695
|
-
const candidate = value[
|
|
16744
|
+
for (const field2 of ["totalCredits", "contextUsagePercent"]) {
|
|
16745
|
+
const candidate = value[field2];
|
|
16696
16746
|
if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isFinite(candidate) || candidate < 0)) {
|
|
16697
|
-
throw new Error(`Harness Usage '${
|
|
16747
|
+
throw new Error(`Harness Usage '${field2}' must be a finite non-negative number`);
|
|
16698
16748
|
}
|
|
16699
16749
|
}
|
|
16700
|
-
for (const
|
|
16701
|
-
const candidate = value[
|
|
16750
|
+
for (const field2 of percentFields) {
|
|
16751
|
+
const candidate = value[field2];
|
|
16702
16752
|
if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isFinite(candidate) || candidate < 0 || candidate > 100)) {
|
|
16703
|
-
throw new Error(`Harness Usage '${
|
|
16753
|
+
throw new Error(`Harness Usage '${field2}' must be between 0 and 100`);
|
|
16704
16754
|
}
|
|
16705
16755
|
}
|
|
16706
16756
|
if (value.sessionCacheUsage !== void 0) {
|
|
@@ -16771,19 +16821,19 @@ function parseHostUsageRequest(value) {
|
|
|
16771
16821
|
if (typeof value.requestId !== "string" || value.requestId.length === 0) {
|
|
16772
16822
|
throw new Error("Harness Usage request 'requestId' must be a non-empty string");
|
|
16773
16823
|
}
|
|
16774
|
-
for (const
|
|
16775
|
-
const candidate = value[
|
|
16824
|
+
for (const field2 of ["model", "provider"]) {
|
|
16825
|
+
const candidate = value[field2];
|
|
16776
16826
|
if (candidate !== void 0 && (typeof candidate !== "string" || candidate.length === 0)) {
|
|
16777
|
-
throw new Error(`Harness Usage request '${
|
|
16827
|
+
throw new Error(`Harness Usage request '${field2}' must be a non-empty string`);
|
|
16778
16828
|
}
|
|
16779
16829
|
}
|
|
16780
16830
|
if (value.historical !== void 0 && typeof value.historical !== "boolean") {
|
|
16781
16831
|
throw new Error("Harness Usage request 'historical' must be a boolean");
|
|
16782
16832
|
}
|
|
16783
|
-
for (const
|
|
16784
|
-
const candidate = value[
|
|
16833
|
+
for (const field2 of requestTokenFields) {
|
|
16834
|
+
const candidate = value[field2];
|
|
16785
16835
|
if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isSafeInteger(candidate) || candidate < 0)) {
|
|
16786
|
-
throw new Error(`Harness Usage request '${
|
|
16836
|
+
throw new Error(`Harness Usage request '${field2}' must be a non-negative safe integer`);
|
|
16787
16837
|
}
|
|
16788
16838
|
}
|
|
16789
16839
|
if (value.inputTokens === void 0 || value.outputTokens === void 0) {
|
|
@@ -18248,7 +18298,17 @@ function pendingNativeHistoryRewind(contents) {
|
|
|
18248
18298
|
const last = parseRows(contents).findLast((row) => row.type === "resend-fork-notice" || NATIVE_MESSAGE_TYPES.has(text(row.type)));
|
|
18249
18299
|
return last?.type === "resend-fork-notice" ? { forkPointId: text(last.parentId) || null } : void 0;
|
|
18250
18300
|
}
|
|
18301
|
+
function isNativeCompactionSummary(row) {
|
|
18302
|
+
const data = record2(row.providerData);
|
|
18303
|
+
return row.type === "message" && row.role === "user" && data.isCompactInternal === true;
|
|
18304
|
+
}
|
|
18251
18305
|
function nativeHistoryRows(contents) {
|
|
18306
|
+
return collectNativeHistoryRows(contents, false);
|
|
18307
|
+
}
|
|
18308
|
+
function nativeDisplayHistoryRows(contents) {
|
|
18309
|
+
return collectNativeHistoryRows(contents, true);
|
|
18310
|
+
}
|
|
18311
|
+
function collectNativeHistoryRows(contents, followCompactionParent) {
|
|
18252
18312
|
const entries = /* @__PURE__ */ new Map();
|
|
18253
18313
|
let leaf = "";
|
|
18254
18314
|
for (const row of parseRows(contents)) {
|
|
@@ -18273,10 +18333,16 @@ function nativeHistoryRows(contents) {
|
|
|
18273
18333
|
throw new CodeBuddyError("protocolError", "Native history parent is missing");
|
|
18274
18334
|
chain.push(row);
|
|
18275
18335
|
leaf = text(row.parentId);
|
|
18336
|
+
if (!leaf && followCompactionParent && isNativeCompactionSummary(row)) {
|
|
18337
|
+
const logicalParent = text(row.logicalParentId);
|
|
18338
|
+
if (logicalParent && !entries.has(logicalParent))
|
|
18339
|
+
throw new CodeBuddyError("protocolError", "Native compaction parent is missing");
|
|
18340
|
+
leaf = logicalParent;
|
|
18341
|
+
}
|
|
18276
18342
|
}
|
|
18277
18343
|
return chain.reverse();
|
|
18278
18344
|
}
|
|
18279
|
-
function snapshotFromHistory(contents, ref, cwd, profile = CODEBUDDY_RUNTIME_PROFILE) {
|
|
18345
|
+
function snapshotFromHistory(contents, ref, cwd, profile = CODEBUDDY_RUNTIME_PROFILE, options = {}) {
|
|
18280
18346
|
const supportsNativeCommands = nativeCommandsEnabled(profile);
|
|
18281
18347
|
const supportsFork = capabilitiesForProfile(profile).history.fork;
|
|
18282
18348
|
const turns = [];
|
|
@@ -18302,7 +18368,8 @@ function snapshotFromHistory(contents, ref, cwd, profile = CODEBUDDY_RUNTIME_PRO
|
|
|
18302
18368
|
snapshot.item.outputTruncated = Boolean(output.truncated);
|
|
18303
18369
|
}
|
|
18304
18370
|
};
|
|
18305
|
-
const
|
|
18371
|
+
const includeCompactionHistory = options.includeCompactionHistory !== false;
|
|
18372
|
+
const history = includeCompactionHistory ? nativeDisplayHistoryRows(contents) : nativeHistoryRows(contents);
|
|
18306
18373
|
const manualCompactions = /* @__PURE__ */ new Set();
|
|
18307
18374
|
let compactUser;
|
|
18308
18375
|
if (supportsNativeCommands)
|
|
@@ -18336,6 +18403,22 @@ function snapshotFromHistory(contents, ref, cwd, profile = CODEBUDDY_RUNTIME_PRO
|
|
|
18336
18403
|
continue;
|
|
18337
18404
|
if (supportsNativeCommands && row.type === "message" && row.role === "user" && data.agent === "compact" && !manualCompactions.has(text(row.id)))
|
|
18338
18405
|
continue;
|
|
18406
|
+
if (includeCompactionHistory && isNativeCompactionSummary(row)) {
|
|
18407
|
+
if (supportsNativeCommands && current) {
|
|
18408
|
+
const outcome = data.isCompacted === true ? { status: "succeeded" } : {
|
|
18409
|
+
status: "failed",
|
|
18410
|
+
error: nativeError(new CodeBuddyError("nativeFailure", "Native compaction did not complete"), profile)
|
|
18411
|
+
};
|
|
18412
|
+
current.items.push({
|
|
18413
|
+
item: {
|
|
18414
|
+
type: "contextCompaction",
|
|
18415
|
+
itemId: hostItemIdSchema.parse(`compact-${text(row.id)}`)
|
|
18416
|
+
},
|
|
18417
|
+
outcome
|
|
18418
|
+
});
|
|
18419
|
+
}
|
|
18420
|
+
continue;
|
|
18421
|
+
}
|
|
18339
18422
|
if (row.type === "message" && row.role === "user") {
|
|
18340
18423
|
current = {
|
|
18341
18424
|
nativeTurnRef: nativeTurnRefSchema.parse({
|
|
@@ -23317,7 +23400,9 @@ function commandCaveat(row) {
|
|
|
23317
23400
|
}
|
|
23318
23401
|
function retainedRowCount(input, contents, sourceCwd = input.cwd, profile = CODEBUDDY_RUNTIME_PROFILE) {
|
|
23319
23402
|
const rows2 = nativeHistoryRows(contents);
|
|
23320
|
-
const turns = snapshotFromHistory(contents, input.sourceRef, sourceCwd, profile
|
|
23403
|
+
const turns = snapshotFromHistory(contents, input.sourceRef, sourceCwd, profile, {
|
|
23404
|
+
includeCompactionHistory: false
|
|
23405
|
+
}).turns;
|
|
23321
23406
|
let excluded2;
|
|
23322
23407
|
if (input.kind === "rollbackLastTurn") {
|
|
23323
23408
|
if (!turns.length)
|
|
@@ -25430,30 +25515,6 @@ function consumeBrokerFrames(socket, onFrame, onError) {
|
|
|
25430
25515
|
});
|
|
25431
25516
|
}
|
|
25432
25517
|
|
|
25433
|
-
// ../../harness-broker/dist/paths.js
|
|
25434
|
-
import os2 from "node:os";
|
|
25435
|
-
import path11 from "node:path";
|
|
25436
|
-
var HARNESS_BROKER_DESCRIPTOR_ENV = "CODEXHOST_CLAUDE_BROKER_DESCRIPTOR";
|
|
25437
|
-
var HARNESS_BROKER_DESCRIPTOR_FILE = "claude-code-broker-v1.json";
|
|
25438
|
-
function defaultHarnessBrokerDirectory(environment = process.env) {
|
|
25439
|
-
const home = environment.HOME || os2.homedir();
|
|
25440
|
-
return path11.join(home, ".codexhost", "harness-broker");
|
|
25441
|
-
}
|
|
25442
|
-
function defaultHarnessBrokerDescriptorPath(environment = process.env, harnessId = "claude-code") {
|
|
25443
|
-
harnessPluginIdSchema.parse(harnessId);
|
|
25444
|
-
if (harnessId !== "claude-code")
|
|
25445
|
-
return path11.join(defaultHarnessBrokerDirectory(environment), `${harnessId}-broker-v1.json`);
|
|
25446
|
-
return environment[HARNESS_BROKER_DESCRIPTOR_ENV] ?? path11.join(defaultHarnessBrokerDirectory(environment), HARNESS_BROKER_DESCRIPTOR_FILE);
|
|
25447
|
-
}
|
|
25448
|
-
function harnessBrokerLaunchAgentLabel(harnessId = "claude-code") {
|
|
25449
|
-
harnessPluginIdSchema.parse(harnessId);
|
|
25450
|
-
return harnessId === "claude-code" ? "ai.bytepioneer.codexhost.native-harness-broker" : `ai.bytepioneer.codexhost.${harnessId}-broker`;
|
|
25451
|
-
}
|
|
25452
|
-
function harnessBrokerLaunchAgentPlistPath(environment = process.env, harnessId = "claude-code") {
|
|
25453
|
-
const home = environment.HOME || os2.homedir();
|
|
25454
|
-
return path11.join(home, "Library", "LaunchAgents", `${harnessBrokerLaunchAgentLabel(harnessId)}.plist`);
|
|
25455
|
-
}
|
|
25456
|
-
|
|
25457
25518
|
// ../../harness-broker/dist/validation.js
|
|
25458
25519
|
var cwdSchema = external_exports.string().min(1).max(16384);
|
|
25459
25520
|
var brokerEnvironmentSchema = external_exports.object({
|
|
@@ -25504,7 +25565,11 @@ var brokerOpenInputSchema = external_exports.discriminatedUnion("kind", [
|
|
|
25504
25565
|
forkSchema,
|
|
25505
25566
|
rollbackSchema
|
|
25506
25567
|
]);
|
|
25507
|
-
var brokerInspectInputSchema = external_exports.object({
|
|
25568
|
+
var brokerInspectInputSchema = external_exports.object({
|
|
25569
|
+
cwd: cwdSchema.optional(),
|
|
25570
|
+
refresh: external_exports.boolean().optional(),
|
|
25571
|
+
purpose: external_exports.literal("availability").optional()
|
|
25572
|
+
}).strict();
|
|
25508
25573
|
var brokerSessionImportListParamsSchema = external_exports.object({
|
|
25509
25574
|
offset: external_exports.number().int().nonnegative().safe(),
|
|
25510
25575
|
limit: external_exports.number().int().min(1).max(HARNESS_BROKER_SESSION_IMPORT_PAGE_SIZE)
|
|
@@ -25519,10 +25584,10 @@ var brokerSessionImportSourceSchema = external_exports.object({
|
|
|
25519
25584
|
candidate: harnessSessionImportCandidateSchema,
|
|
25520
25585
|
nativeRef: nativeSessionRefSchema
|
|
25521
25586
|
}).strict().superRefine((source, context) => {
|
|
25522
|
-
if (source.nativeRef.
|
|
25587
|
+
if (source.nativeRef.nativeSessionId !== source.candidate.nativeSessionId) {
|
|
25523
25588
|
context.addIssue({
|
|
25524
25589
|
code: "custom",
|
|
25525
|
-
message: "
|
|
25590
|
+
message: "Session import source identity does not match"
|
|
25526
25591
|
});
|
|
25527
25592
|
}
|
|
25528
25593
|
});
|
|
@@ -25696,6 +25761,107 @@ var harnessOutputSchema = external_exports.custom((value) => {
|
|
|
25696
25761
|
return false;
|
|
25697
25762
|
});
|
|
25698
25763
|
|
|
25764
|
+
// ../../harness-broker/dist/session-import-client.js
|
|
25765
|
+
function createBrokerSessionImportCapability(input) {
|
|
25766
|
+
let listing = null;
|
|
25767
|
+
const closed = () => ({
|
|
25768
|
+
ok: false,
|
|
25769
|
+
error: { code: "invalidState", message: "Harness broker adapter is closed", retryable: false }
|
|
25770
|
+
});
|
|
25771
|
+
const invalid = () => ({
|
|
25772
|
+
ok: false,
|
|
25773
|
+
error: {
|
|
25774
|
+
code: "protocolError",
|
|
25775
|
+
message: "Harness broker returned invalid Session import metadata",
|
|
25776
|
+
retryable: false
|
|
25777
|
+
}
|
|
25778
|
+
});
|
|
25779
|
+
const list = async () => {
|
|
25780
|
+
try {
|
|
25781
|
+
const candidates = [];
|
|
25782
|
+
const identities = /* @__PURE__ */ new Set();
|
|
25783
|
+
let total;
|
|
25784
|
+
for (; ; ) {
|
|
25785
|
+
if (input.isClosed())
|
|
25786
|
+
return closed();
|
|
25787
|
+
const result = await input.request("adapter.sessionImport.list", {
|
|
25788
|
+
offset: candidates.length,
|
|
25789
|
+
limit: HARNESS_BROKER_SESSION_IMPORT_PAGE_SIZE
|
|
25790
|
+
});
|
|
25791
|
+
if (input.isClosed())
|
|
25792
|
+
return closed();
|
|
25793
|
+
if (!result.ok)
|
|
25794
|
+
return result;
|
|
25795
|
+
const page = brokerSessionImportPageSchema.safeParse(result.value);
|
|
25796
|
+
if (!page.success || total !== void 0 && total !== page.data.total || page.data.total < candidates.length + page.data.candidates.length || page.data.candidates.length === 0 && candidates.length < page.data.total)
|
|
25797
|
+
return invalid();
|
|
25798
|
+
total = page.data.total;
|
|
25799
|
+
for (const candidate of page.data.candidates) {
|
|
25800
|
+
if (identities.has(candidate.nativeSessionId))
|
|
25801
|
+
return invalid();
|
|
25802
|
+
identities.add(candidate.nativeSessionId);
|
|
25803
|
+
candidates.push(candidate);
|
|
25804
|
+
}
|
|
25805
|
+
if (candidates.length === total)
|
|
25806
|
+
return { ok: true, value: candidates };
|
|
25807
|
+
}
|
|
25808
|
+
} catch (error51) {
|
|
25809
|
+
return { ok: false, error: input.error(error51) };
|
|
25810
|
+
}
|
|
25811
|
+
};
|
|
25812
|
+
return {
|
|
25813
|
+
listCandidates() {
|
|
25814
|
+
if (input.isClosed())
|
|
25815
|
+
return Promise.resolve(closed());
|
|
25816
|
+
listing ??= list().finally(() => {
|
|
25817
|
+
listing = null;
|
|
25818
|
+
});
|
|
25819
|
+
return listing;
|
|
25820
|
+
},
|
|
25821
|
+
async resolveCandidate(nativeSessionId) {
|
|
25822
|
+
if (input.isClosed())
|
|
25823
|
+
return closed();
|
|
25824
|
+
try {
|
|
25825
|
+
const result = await input.request("adapter.sessionImport.resolve", { nativeSessionId });
|
|
25826
|
+
if (input.isClosed())
|
|
25827
|
+
return closed();
|
|
25828
|
+
if (!result.ok)
|
|
25829
|
+
return result;
|
|
25830
|
+
const source = brokerSessionImportSourceSchema.safeParse(result.value);
|
|
25831
|
+
if (!source.success || source.data.nativeRef.harnessId !== input.harnessId || source.data.candidate.nativeSessionId !== nativeSessionId)
|
|
25832
|
+
return invalid();
|
|
25833
|
+
return { ok: true, value: source.data };
|
|
25834
|
+
} catch (error51) {
|
|
25835
|
+
return { ok: false, error: input.error(error51) };
|
|
25836
|
+
}
|
|
25837
|
+
}
|
|
25838
|
+
};
|
|
25839
|
+
}
|
|
25840
|
+
|
|
25841
|
+
// ../../harness-broker/dist/paths.js
|
|
25842
|
+
import os2 from "node:os";
|
|
25843
|
+
import path11 from "node:path";
|
|
25844
|
+
var HARNESS_BROKER_DESCRIPTOR_ENV = "CODEXHOST_CLAUDE_BROKER_DESCRIPTOR";
|
|
25845
|
+
var HARNESS_BROKER_DESCRIPTOR_FILE = "claude-code-broker-v1.json";
|
|
25846
|
+
function defaultHarnessBrokerDirectory(environment = process.env) {
|
|
25847
|
+
const home = environment.HOME || os2.homedir();
|
|
25848
|
+
return path11.join(home, ".codexhost", "harness-broker");
|
|
25849
|
+
}
|
|
25850
|
+
function defaultHarnessBrokerDescriptorPath(environment = process.env, harnessId = "claude-code") {
|
|
25851
|
+
harnessPluginIdSchema.parse(harnessId);
|
|
25852
|
+
if (harnessId !== "claude-code")
|
|
25853
|
+
return path11.join(defaultHarnessBrokerDirectory(environment), `${harnessId}-broker-v1.json`);
|
|
25854
|
+
return environment[HARNESS_BROKER_DESCRIPTOR_ENV] ?? path11.join(defaultHarnessBrokerDirectory(environment), HARNESS_BROKER_DESCRIPTOR_FILE);
|
|
25855
|
+
}
|
|
25856
|
+
function harnessBrokerLaunchAgentLabel(harnessId = "claude-code") {
|
|
25857
|
+
harnessPluginIdSchema.parse(harnessId);
|
|
25858
|
+
return harnessId === "claude-code" ? "ai.bytepioneer.codexhost.native-harness-broker" : `ai.bytepioneer.codexhost.${harnessId}-broker`;
|
|
25859
|
+
}
|
|
25860
|
+
function harnessBrokerLaunchAgentPlistPath(environment = process.env, harnessId = "claude-code") {
|
|
25861
|
+
const home = environment.HOME || os2.homedir();
|
|
25862
|
+
return path11.join(home, "Library", "LaunchAgents", `${harnessBrokerLaunchAgentLabel(harnessId)}.plist`);
|
|
25863
|
+
}
|
|
25864
|
+
|
|
25699
25865
|
// ../../harness-broker/dist/client.js
|
|
25700
25866
|
function unavailable(message, retryable = true) {
|
|
25701
25867
|
return { code: "unavailable", message, retryable, stage: "harnessBroker" };
|
|
@@ -26232,6 +26398,7 @@ var BrokeredHarnessAdapter = class {
|
|
|
26232
26398
|
commandCatalog;
|
|
26233
26399
|
liveCommandCatalog;
|
|
26234
26400
|
harnessId;
|
|
26401
|
+
sessionImport;
|
|
26235
26402
|
credits;
|
|
26236
26403
|
refreshCredits;
|
|
26237
26404
|
#descriptorPath;
|
|
@@ -26241,7 +26408,6 @@ var BrokeredHarnessAdapter = class {
|
|
|
26241
26408
|
#startTimeoutMs;
|
|
26242
26409
|
#connection = null;
|
|
26243
26410
|
#closed = false;
|
|
26244
|
-
#sessionImportListing = null;
|
|
26245
26411
|
#credits = null;
|
|
26246
26412
|
#creditsRefresh = null;
|
|
26247
26413
|
subagents = {
|
|
@@ -26253,86 +26419,16 @@ var BrokeredHarnessAdapter = class {
|
|
|
26253
26419
|
}
|
|
26254
26420
|
}
|
|
26255
26421
|
};
|
|
26256
|
-
sessionImport = Object.freeze({
|
|
26257
|
-
listCandidates: () => {
|
|
26258
|
-
this.#sessionImportListing ??= this.#listSessionImportCandidates().finally(() => {
|
|
26259
|
-
this.#sessionImportListing = null;
|
|
26260
|
-
});
|
|
26261
|
-
return this.#sessionImportListing;
|
|
26262
|
-
},
|
|
26263
|
-
resolveCandidate: async (nativeSessionId) => {
|
|
26264
|
-
if (this.#closed) {
|
|
26265
|
-
return {
|
|
26266
|
-
ok: false,
|
|
26267
|
-
error: unavailable("Claude Aqua broker adapter is closed", false)
|
|
26268
|
-
};
|
|
26269
|
-
}
|
|
26270
|
-
try {
|
|
26271
|
-
const result = parseHarnessResult(await (await this.#connect()).request("adapter.sessionImport.resolve", {
|
|
26272
|
-
nativeSessionId
|
|
26273
|
-
}));
|
|
26274
|
-
if (!result.ok)
|
|
26275
|
-
return result;
|
|
26276
|
-
const parsed = brokerSessionImportSourceSchema.safeParse(result.value);
|
|
26277
|
-
if (!parsed.success || parsed.data.candidate.nativeSessionId !== nativeSessionId) {
|
|
26278
|
-
return {
|
|
26279
|
-
ok: false,
|
|
26280
|
-
error: {
|
|
26281
|
-
...unavailable("Harness broker returned an invalid Session source", false),
|
|
26282
|
-
code: "protocolError"
|
|
26283
|
-
}
|
|
26284
|
-
};
|
|
26285
|
-
}
|
|
26286
|
-
return { ok: true, value: parsed.data };
|
|
26287
|
-
} catch (error51) {
|
|
26288
|
-
this.#connection = null;
|
|
26289
|
-
return {
|
|
26290
|
-
ok: false,
|
|
26291
|
-
error: unavailable(error51 instanceof Error ? error51.message : String(error51))
|
|
26292
|
-
};
|
|
26293
|
-
}
|
|
26294
|
-
}
|
|
26295
|
-
});
|
|
26296
|
-
async #listSessionImportCandidates() {
|
|
26297
|
-
if (this.#closed) {
|
|
26298
|
-
return {
|
|
26299
|
-
ok: false,
|
|
26300
|
-
error: unavailable("Claude Aqua broker adapter is closed", false)
|
|
26301
|
-
};
|
|
26302
|
-
}
|
|
26303
|
-
try {
|
|
26304
|
-
const candidates = [];
|
|
26305
|
-
for (; ; ) {
|
|
26306
|
-
const result = parseHarnessResult(await (await this.#connect()).request("adapter.sessionImport.list", {
|
|
26307
|
-
offset: candidates.length,
|
|
26308
|
-
limit: HARNESS_BROKER_SESSION_IMPORT_PAGE_SIZE
|
|
26309
|
-
}));
|
|
26310
|
-
if (!result.ok)
|
|
26311
|
-
return result;
|
|
26312
|
-
const parsed = brokerSessionImportPageSchema.safeParse(result.value);
|
|
26313
|
-
if (!parsed.success || parsed.data.total < candidates.length + parsed.data.candidates.length || parsed.data.candidates.length === 0 && candidates.length < parsed.data.total) {
|
|
26314
|
-
return {
|
|
26315
|
-
ok: false,
|
|
26316
|
-
error: {
|
|
26317
|
-
...unavailable("Harness broker returned invalid Session candidates", false),
|
|
26318
|
-
code: "protocolError"
|
|
26319
|
-
}
|
|
26320
|
-
};
|
|
26321
|
-
}
|
|
26322
|
-
candidates.push(...parsed.data.candidates);
|
|
26323
|
-
if (candidates.length === parsed.data.total)
|
|
26324
|
-
return { ok: true, value: candidates };
|
|
26325
|
-
}
|
|
26326
|
-
} catch (error51) {
|
|
26327
|
-
this.#connection = null;
|
|
26328
|
-
return {
|
|
26329
|
-
ok: false,
|
|
26330
|
-
error: unavailable(error51 instanceof Error ? error51.message : String(error51))
|
|
26331
|
-
};
|
|
26332
|
-
}
|
|
26333
|
-
}
|
|
26334
26422
|
constructor(input = {}) {
|
|
26335
26423
|
this.harnessId = harnessPluginIdSchema.parse(input.harnessId ?? "claude-code");
|
|
26424
|
+
if (input.sessionImport) {
|
|
26425
|
+
this.sessionImport = createBrokerSessionImportCapability({
|
|
26426
|
+
harnessId: this.harnessId,
|
|
26427
|
+
request: async (method, params) => parseHarnessResult(await this.#request(method, params, method === "adapter.sessionImport.resolve")),
|
|
26428
|
+
isClosed: () => this.#closed,
|
|
26429
|
+
error: (error51) => this.#error(error51)
|
|
26430
|
+
});
|
|
26431
|
+
}
|
|
26336
26432
|
if (input.accountCredits !== false) {
|
|
26337
26433
|
this.credits = () => this.#credits;
|
|
26338
26434
|
this.refreshCredits = () => this.#refreshAccountCredits();
|
|
@@ -26520,6 +26616,7 @@ function createHarnessAdapter(context) {
|
|
|
26520
26616
|
if (context.platform === "darwin" && context.managedRemoteHost) {
|
|
26521
26617
|
const environment2 = { ...context.environment };
|
|
26522
26618
|
return new BrokeredHarnessAdapter({
|
|
26619
|
+
sessionImport: true,
|
|
26523
26620
|
accountCredits: false,
|
|
26524
26621
|
harnessId: "codebuddy",
|
|
26525
26622
|
forwardDelegationEnvironment: true,
|