@liberseek/boft-cli-linux-x64 0.8.3 → 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 +117 -13
- package/app/console-web.js +713 -129
- package/app/desktop-controller.mjs +713 -42
- package/app/host-runtime.mjs +2535 -855
- package/app/plugins/antigravity/plugin.mjs +437 -67
- package/app/plugins/claude-code/plugin.mjs +758 -248
- package/app/plugins/codebuddy/plugin.mjs +348 -156
- package/app/plugins/codex-usage/plugin.mjs +258 -106
- package/app/plugins/copilot/assets/icon.png +0 -0
- package/app/plugins/copilot/manifest.json +26 -0
- package/app/plugins/copilot/plugin.mjs +34651 -0
- package/app/plugins/cursor-cli/plugin.mjs +20905 -44961
- package/app/plugins/deepseek-harness/plugin.mjs +195 -53
- package/app/plugins/enabled.json +1 -0
- package/app/plugins/grok/plugin.mjs +584 -138
- package/app/plugins/hermes/plugin.mjs +134 -13
- package/app/plugins/kimi-code/plugin.mjs +145 -26
- package/app/plugins/kiro-cli/plugin.mjs +145 -26
- package/app/plugins/muse/plugin.mjs +132 -14
- package/app/plugins/omp/plugin.mjs +2245 -2040
- package/app/plugins/opencode/plugin.mjs +196 -72
- package/app/plugins/pi/plugin.mjs +2643 -2309
- package/app/plugins/qoder/plugin.mjs +162 -40
- package/app/plugins/qoder-cn/plugin.mjs +162 -40
- package/app/plugins/workbuddy/plugin.mjs +609 -180
- package/app/plugins/zcode/plugin.mjs +192 -44
- package/app/renderer-extension.js +3405 -429
- 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
|
}
|
|
@@ -15138,10 +15138,19 @@ var model = external_exports.string().min(1).max(512);
|
|
|
15138
15138
|
var project = external_exports.string().min(1).max(4096);
|
|
15139
15139
|
var usageStatisticsParamsSchema = external_exports.strictObject({
|
|
15140
15140
|
range: external_exports.enum(USAGE_STATISTICS_RANGES),
|
|
15141
|
+
/** Display timezone for ranges, dates and hourly buckets; omitted means the Host's local zone. */
|
|
15142
|
+
timeZone: external_exports.string().min(1).max(128).refine((value) => {
|
|
15143
|
+
try {
|
|
15144
|
+
new Intl.DateTimeFormat("en", { timeZone: value });
|
|
15145
|
+
return true;
|
|
15146
|
+
} catch {
|
|
15147
|
+
return false;
|
|
15148
|
+
}
|
|
15149
|
+
}, "Unsupported usage statistics timezone").optional(),
|
|
15141
15150
|
harness: harness.optional(),
|
|
15142
15151
|
model: model.nullable().optional(),
|
|
15143
15152
|
project: project.nullable().optional(),
|
|
15144
|
-
/** One
|
|
15153
|
+
/** One date in the query timezone inside the range. */
|
|
15145
15154
|
date: localDate.optional()
|
|
15146
15155
|
});
|
|
15147
15156
|
var usageStatisticsTotalsSchema = external_exports.strictObject({
|
|
@@ -15150,6 +15159,8 @@ var usageStatisticsTotalsSchema = external_exports.strictObject({
|
|
|
15150
15159
|
cachedInputTokens: count,
|
|
15151
15160
|
cacheWriteInputTokens: count,
|
|
15152
15161
|
cacheKnownInputTokens: count,
|
|
15162
|
+
cacheHitCachedInputTokens: count,
|
|
15163
|
+
cacheHitInputTokens: count,
|
|
15153
15164
|
outputTokens: count,
|
|
15154
15165
|
reasoningOutputTokens: count,
|
|
15155
15166
|
/** USD at the public price, summed over the priced requests only. */
|
|
@@ -15177,7 +15188,7 @@ var usageStatisticsSessionSchema = external_exports.strictObject({
|
|
|
15177
15188
|
});
|
|
15178
15189
|
var usageStatisticsResultSchema = external_exports.strictObject({
|
|
15179
15190
|
range: external_exports.enum(USAGE_STATISTICS_RANGES),
|
|
15180
|
-
/** First
|
|
15191
|
+
/** First date in the query timezone (Host local when omitted); null for all time. */
|
|
15181
15192
|
from: localDate.nullable(),
|
|
15182
15193
|
to: localDate,
|
|
15183
15194
|
/** The filters these figures apply, echoed so a late answer to older filters is recognised. */
|
|
@@ -15217,7 +15228,7 @@ var usageStatisticsResultSchema = external_exports.strictObject({
|
|
|
15217
15228
|
totals: usageStatisticsTotalsSchema,
|
|
15218
15229
|
/** Each date and Harness of the range: every filter except the day. */
|
|
15219
15230
|
daily: external_exports.array(external_exports.strictObject({ date: localDate, harness, ...totals })).max(2e5),
|
|
15220
|
-
/**
|
|
15231
|
+
/** Weekday (0 = Sunday) and hour in the query timezone, all filters applied. */
|
|
15221
15232
|
hourly: external_exports.array(external_exports.strictObject({
|
|
15222
15233
|
weekday: external_exports.number().int().min(0).max(6),
|
|
15223
15234
|
hour: external_exports.number().int().min(0).max(23),
|
|
@@ -15257,6 +15268,51 @@ var hostInteractionIdSchema = opaqueIdSchema.brand();
|
|
|
15257
15268
|
var threadPrewarmDiscardParamsSchema = external_exports.object({ threadId: hostThreadIdSchema });
|
|
15258
15269
|
var threadPrewarmDiscardResultSchema = external_exports.object({ discarded: external_exports.boolean() });
|
|
15259
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
|
+
|
|
15260
15316
|
// ../../shared-contracts/dist/harness-plugins.js
|
|
15261
15317
|
var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
|
|
15262
15318
|
var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
|
|
@@ -15359,6 +15415,8 @@ var CONSOLE_HOST_METHODS = Object.freeze([
|
|
|
15359
15415
|
"codexhost/harness/display-settings/set",
|
|
15360
15416
|
"codexhost/harness/inspect",
|
|
15361
15417
|
"codexhost/harness/installation",
|
|
15418
|
+
"codexhost/harness/installation/start",
|
|
15419
|
+
"codexhost/harness/installation/status",
|
|
15362
15420
|
"codexhost/harness/launch-settings/get",
|
|
15363
15421
|
"codexhost/harness/launch-settings/set",
|
|
15364
15422
|
HARNESS_LONG_CONTEXT_GET_METHOD,
|
|
@@ -15436,7 +15494,18 @@ var threadManualCompactionStartedSchema = external_exports.strictObject({
|
|
|
15436
15494
|
var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonnegative();
|
|
15437
15495
|
var finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative();
|
|
15438
15496
|
var cacheHitRatePercentSchema = external_exports.number().finite().min(0).max(100);
|
|
15497
|
+
var indicatorTextSchema = (maximum) => harnessLocalizedTextSchema.refine((entries) => Object.values(entries).every((text2) => text2.length <= maximum));
|
|
15498
|
+
var composerIndicatorsSchema = external_exports.array(external_exports.object({
|
|
15499
|
+
kind: external_exports.literal("countdown"),
|
|
15500
|
+
id: external_exports.string().min(1).max(64),
|
|
15501
|
+
expiresAtUnix: nonNegativeSafeIntegerSchema,
|
|
15502
|
+
label: indicatorTextSchema(256).optional(),
|
|
15503
|
+
tooltip: indicatorTextSchema(1024).optional()
|
|
15504
|
+
}).strict()).max(2).refine((entries) => new Set(entries.map(({ id }) => id)).size === entries.length, {
|
|
15505
|
+
message: "Composer indicator IDs must be unique"
|
|
15506
|
+
});
|
|
15439
15507
|
var threadUsageSnapshotSchema = external_exports.object({
|
|
15508
|
+
composerIndicators: composerIndicatorsSchema.optional(),
|
|
15440
15509
|
inputTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
15441
15510
|
cachedInputTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
15442
15511
|
cacheWriteInputTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
@@ -15862,7 +15931,9 @@ var harnessSessionCapabilitiesSchema = external_exports.object({
|
|
|
15862
15931
|
}).strict().optional(),
|
|
15863
15932
|
input: external_exports.object({
|
|
15864
15933
|
image: external_exports.boolean()
|
|
15865
|
-
}).strict().optional()
|
|
15934
|
+
}).strict().optional(),
|
|
15935
|
+
/** True only when `turn.steer` delivers input into the active Turn through a native primitive. */
|
|
15936
|
+
steer: external_exports.boolean().optional()
|
|
15866
15937
|
}).strict();
|
|
15867
15938
|
var harnessConfigurationStateSchema = external_exports.object({
|
|
15868
15939
|
effectiveModel: harnessModelRefSchema.optional(),
|
|
@@ -15909,7 +15980,9 @@ var harnessInspectionSchema = external_exports.union([
|
|
|
15909
15980
|
var harnessInspectParamsSchema = external_exports.object({
|
|
15910
15981
|
harnessId: harnessIdSchema,
|
|
15911
15982
|
cwd: nonBlankTextSchema2.max(16384).optional(),
|
|
15912
|
-
refresh: external_exports.boolean().optional()
|
|
15983
|
+
refresh: external_exports.boolean().optional(),
|
|
15984
|
+
/** `availability` asks only whether the Harness can run; see `InspectHarnessInput.purpose`. */
|
|
15985
|
+
purpose: external_exports.literal("availability").optional()
|
|
15913
15986
|
}).strict();
|
|
15914
15987
|
var harnessWebUiOpenParamsSchema = external_exports.object({
|
|
15915
15988
|
harnessId: harnessIdSchema
|
|
@@ -15994,13 +16067,25 @@ var threadOwnershipListResultSchema = external_exports.object({
|
|
|
15994
16067
|
seen.add(thread.threadId);
|
|
15995
16068
|
}
|
|
15996
16069
|
});
|
|
16070
|
+
var threadSteeringInspectParamsSchema = external_exports.object({
|
|
16071
|
+
threadId: hostThreadIdSchema,
|
|
16072
|
+
/** The text about to be steered; a Harness command always stops and restarts. */
|
|
16073
|
+
text: external_exports.string().optional()
|
|
16074
|
+
}).strict();
|
|
16075
|
+
var threadSteerDeliverySchema = external_exports.enum(["activeTurn", "newTurn"]);
|
|
16076
|
+
var threadSteeringInspectResultSchema = external_exports.object({
|
|
16077
|
+
delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
|
|
16078
|
+
}).strict();
|
|
15997
16079
|
|
|
15998
16080
|
// ../../shared-contracts/dist/harness-route.js
|
|
15999
16081
|
var harnessPluginRouteSchema = external_exports.object({
|
|
16000
16082
|
harnessId: harnessPluginIdSchema,
|
|
16001
16083
|
model: harnessModelRefSchema.optional(),
|
|
16002
16084
|
thinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
16003
|
-
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()
|
|
16004
16089
|
}).strict();
|
|
16005
16090
|
|
|
16006
16091
|
// ../../shared-contracts/dist/harness-launch-settings.js
|
|
@@ -16026,6 +16111,10 @@ var harnessInstallationStateSchema = external_exports.object({
|
|
|
16026
16111
|
latestVersion: external_exports.string().min(1).max(128),
|
|
16027
16112
|
updateAvailable: external_exports.boolean(),
|
|
16028
16113
|
canUpdate: external_exports.boolean(),
|
|
16114
|
+
/** Defaults to CLI; some Harnesses ship only inside a desktop application. */
|
|
16115
|
+
versionKind: external_exports.enum(["cli", "application"]).optional(),
|
|
16116
|
+
/** Official download opened by the user; does not imply an automatic installation. */
|
|
16117
|
+
manualUpdateUrl: external_exports.url().max(2048).refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Manual updates require a credential-free HTTPS URL").optional(),
|
|
16029
16118
|
// Adapter-owned diagnostic text; UI uses messageCode rather than displaying it verbatim.
|
|
16030
16119
|
message: external_exports.string().max(2048).optional(),
|
|
16031
16120
|
messageCode: external_exports.string().min(1).max(128).optional(),
|
|
@@ -16033,6 +16122,20 @@ var harnessInstallationStateSchema = external_exports.object({
|
|
|
16033
16122
|
notice: harnessLocalizedTextSchema.optional(),
|
|
16034
16123
|
latestVersionKind: external_exports.enum(["unknown", "tracking-branch"]).optional()
|
|
16035
16124
|
}).strict();
|
|
16125
|
+
var harnessInstallationTaskParamsSchema = external_exports.object({ taskId: external_exports.string().uuid() }).strict();
|
|
16126
|
+
var harnessInstallationTaskSchema = external_exports.discriminatedUnion("status", [
|
|
16127
|
+
external_exports.object({ taskId: external_exports.string().uuid(), status: external_exports.literal("running") }).strict(),
|
|
16128
|
+
external_exports.object({
|
|
16129
|
+
taskId: external_exports.string().uuid(),
|
|
16130
|
+
status: external_exports.literal("succeeded"),
|
|
16131
|
+
result: harnessInstallationStateSchema
|
|
16132
|
+
}).strict(),
|
|
16133
|
+
external_exports.object({
|
|
16134
|
+
taskId: external_exports.string().uuid(),
|
|
16135
|
+
status: external_exports.literal("failed"),
|
|
16136
|
+
error: external_exports.object({ code: external_exports.number().int(), message: external_exports.string().min(1).max(2048) }).strict()
|
|
16137
|
+
}).strict()
|
|
16138
|
+
]);
|
|
16036
16139
|
|
|
16037
16140
|
// ../../shared-contracts/dist/codex-accounts.js
|
|
16038
16141
|
var accountIdSchema = external_exports.string().min(1).max(256).regex(/^[A-Za-z0-9._~-]+$/u);
|
|
@@ -16547,6 +16650,18 @@ function sanitizeDiagnosticTail(value) {
|
|
|
16547
16650
|
return redacted.length <= DIAGNOSTIC_TAIL_MAX_LENGTH ? redacted : redacted.slice(-DIAGNOSTIC_TAIL_MAX_LENGTH);
|
|
16548
16651
|
}
|
|
16549
16652
|
|
|
16653
|
+
// ../../harness-adapter/dist/steer.js
|
|
16654
|
+
function unsupportedSteer(harnessLabel) {
|
|
16655
|
+
return {
|
|
16656
|
+
ok: false,
|
|
16657
|
+
error: {
|
|
16658
|
+
code: "unsupported",
|
|
16659
|
+
message: `${harnessLabel} cannot steer an active Turn natively`,
|
|
16660
|
+
retryable: false
|
|
16661
|
+
}
|
|
16662
|
+
};
|
|
16663
|
+
}
|
|
16664
|
+
|
|
16550
16665
|
// ../../harness-adapter/dist/usage.js
|
|
16551
16666
|
var tokenFields = [
|
|
16552
16667
|
"inputTokens",
|
|
@@ -16574,6 +16689,7 @@ var usageFields = /* @__PURE__ */ new Set([
|
|
|
16574
16689
|
...safeIntegerFields,
|
|
16575
16690
|
...percentFields,
|
|
16576
16691
|
"sessionCacheUsage",
|
|
16692
|
+
"composerIndicators",
|
|
16577
16693
|
"totalCostUsd",
|
|
16578
16694
|
"totalCredits",
|
|
16579
16695
|
"contextUsagePercent",
|
|
@@ -16596,26 +16712,27 @@ function parseHostUsage(value) {
|
|
|
16596
16712
|
throw new Error(`Harness Usage contains unknown field '${key}'`);
|
|
16597
16713
|
}
|
|
16598
16714
|
}
|
|
16599
|
-
|
|
16715
|
+
const indicators = value.composerIndicators === void 0 ? {} : { composerIndicators: composerIndicatorsSchema.parse(value.composerIndicators) };
|
|
16716
|
+
for (const field2 of [
|
|
16600
16717
|
"totalCredits",
|
|
16601
16718
|
"contextUsagePercent",
|
|
16602
16719
|
"apiOutputTokensPerSecond"
|
|
16603
16720
|
]) {
|
|
16604
|
-
const candidate = value[
|
|
16721
|
+
const candidate = value[field2];
|
|
16605
16722
|
if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isFinite(candidate) || candidate < 0)) {
|
|
16606
|
-
throw new Error(`Harness Usage '${
|
|
16723
|
+
throw new Error(`Harness Usage '${field2}' must be a finite non-negative number`);
|
|
16607
16724
|
}
|
|
16608
16725
|
}
|
|
16609
|
-
for (const
|
|
16610
|
-
const candidate = value[
|
|
16726
|
+
for (const field2 of tokenFields) {
|
|
16727
|
+
const candidate = value[field2];
|
|
16611
16728
|
if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isSafeInteger(candidate) || candidate < 0)) {
|
|
16612
|
-
throw new Error(`Harness Usage '${
|
|
16729
|
+
throw new Error(`Harness Usage '${field2}' must be a non-negative safe integer`);
|
|
16613
16730
|
}
|
|
16614
16731
|
}
|
|
16615
|
-
for (const
|
|
16616
|
-
const candidate = value[
|
|
16732
|
+
for (const field2 of safeIntegerFields) {
|
|
16733
|
+
const candidate = value[field2];
|
|
16617
16734
|
if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isSafeInteger(candidate) || candidate < 0)) {
|
|
16618
|
-
throw new Error(`Harness Usage '${
|
|
16735
|
+
throw new Error(`Harness Usage '${field2}' must be a non-negative safe integer`);
|
|
16619
16736
|
}
|
|
16620
16737
|
}
|
|
16621
16738
|
if (value.outputTokensPerSecond !== void 0 && (typeof value.outputTokensPerSecond !== "number" || !Number.isFinite(value.outputTokensPerSecond) || value.outputTokensPerSecond < 0)) {
|
|
@@ -16624,16 +16741,16 @@ function parseHostUsage(value) {
|
|
|
16624
16741
|
if (value.totalCostUsd !== void 0 && (typeof value.totalCostUsd !== "number" || !Number.isFinite(value.totalCostUsd) || value.totalCostUsd < 0)) {
|
|
16625
16742
|
throw new Error("Harness Usage 'totalCostUsd' must be a finite non-negative number");
|
|
16626
16743
|
}
|
|
16627
|
-
for (const
|
|
16628
|
-
const candidate = value[
|
|
16744
|
+
for (const field2 of ["totalCredits", "contextUsagePercent"]) {
|
|
16745
|
+
const candidate = value[field2];
|
|
16629
16746
|
if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isFinite(candidate) || candidate < 0)) {
|
|
16630
|
-
throw new Error(`Harness Usage '${
|
|
16747
|
+
throw new Error(`Harness Usage '${field2}' must be a finite non-negative number`);
|
|
16631
16748
|
}
|
|
16632
16749
|
}
|
|
16633
|
-
for (const
|
|
16634
|
-
const candidate = value[
|
|
16750
|
+
for (const field2 of percentFields) {
|
|
16751
|
+
const candidate = value[field2];
|
|
16635
16752
|
if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isFinite(candidate) || candidate < 0 || candidate > 100)) {
|
|
16636
|
-
throw new Error(`Harness Usage '${
|
|
16753
|
+
throw new Error(`Harness Usage '${field2}' must be between 0 and 100`);
|
|
16637
16754
|
}
|
|
16638
16755
|
}
|
|
16639
16756
|
if (value.sessionCacheUsage !== void 0) {
|
|
@@ -16672,9 +16789,9 @@ function parseHostUsage(value) {
|
|
|
16672
16789
|
if (value.costSource !== "publicPrice") {
|
|
16673
16790
|
throw new Error("Harness Usage 'unpricedModels' must be provided with a 'publicPrice' cost");
|
|
16674
16791
|
}
|
|
16675
|
-
return { ...value, unpricedModels: [...models] };
|
|
16792
|
+
return { ...value, ...indicators, unpricedModels: [...models] };
|
|
16676
16793
|
}
|
|
16677
|
-
return { ...value };
|
|
16794
|
+
return { ...value, ...indicators };
|
|
16678
16795
|
}
|
|
16679
16796
|
var requestTokenFields = [
|
|
16680
16797
|
"inputTokens",
|
|
@@ -16704,19 +16821,19 @@ function parseHostUsageRequest(value) {
|
|
|
16704
16821
|
if (typeof value.requestId !== "string" || value.requestId.length === 0) {
|
|
16705
16822
|
throw new Error("Harness Usage request 'requestId' must be a non-empty string");
|
|
16706
16823
|
}
|
|
16707
|
-
for (const
|
|
16708
|
-
const candidate = value[
|
|
16824
|
+
for (const field2 of ["model", "provider"]) {
|
|
16825
|
+
const candidate = value[field2];
|
|
16709
16826
|
if (candidate !== void 0 && (typeof candidate !== "string" || candidate.length === 0)) {
|
|
16710
|
-
throw new Error(`Harness Usage request '${
|
|
16827
|
+
throw new Error(`Harness Usage request '${field2}' must be a non-empty string`);
|
|
16711
16828
|
}
|
|
16712
16829
|
}
|
|
16713
16830
|
if (value.historical !== void 0 && typeof value.historical !== "boolean") {
|
|
16714
16831
|
throw new Error("Harness Usage request 'historical' must be a boolean");
|
|
16715
16832
|
}
|
|
16716
|
-
for (const
|
|
16717
|
-
const candidate = value[
|
|
16833
|
+
for (const field2 of requestTokenFields) {
|
|
16834
|
+
const candidate = value[field2];
|
|
16718
16835
|
if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isSafeInteger(candidate) || candidate < 0)) {
|
|
16719
|
-
throw new Error(`Harness Usage request '${
|
|
16836
|
+
throw new Error(`Harness Usage request '${field2}' must be a non-negative safe integer`);
|
|
16720
16837
|
}
|
|
16721
16838
|
}
|
|
16722
16839
|
if (value.inputTokens === void 0 || value.outputTokens === void 0) {
|
|
@@ -17031,10 +17148,13 @@ function usageSessionTitle(value) {
|
|
|
17031
17148
|
return void 0;
|
|
17032
17149
|
if (normalized.length <= MAX_SESSION_TITLE_LENGTH)
|
|
17033
17150
|
return normalized;
|
|
17034
|
-
|
|
17035
|
-
|
|
17036
|
-
|
|
17037
|
-
|
|
17151
|
+
let title = "";
|
|
17152
|
+
for (const character of normalized) {
|
|
17153
|
+
if (title.length + character.length >= MAX_SESSION_TITLE_LENGTH)
|
|
17154
|
+
break;
|
|
17155
|
+
title += character;
|
|
17156
|
+
}
|
|
17157
|
+
return `${title.trimEnd()}…`;
|
|
17038
17158
|
}
|
|
17039
17159
|
function sessionIdOk(value) {
|
|
17040
17160
|
return typeof value === "string" && value.length > 0 && value.length <= MAX_SESSION_ID_LENGTH;
|
|
@@ -18178,7 +18298,17 @@ function pendingNativeHistoryRewind(contents) {
|
|
|
18178
18298
|
const last = parseRows(contents).findLast((row) => row.type === "resend-fork-notice" || NATIVE_MESSAGE_TYPES.has(text(row.type)));
|
|
18179
18299
|
return last?.type === "resend-fork-notice" ? { forkPointId: text(last.parentId) || null } : void 0;
|
|
18180
18300
|
}
|
|
18301
|
+
function isNativeCompactionSummary(row) {
|
|
18302
|
+
const data = record2(row.providerData);
|
|
18303
|
+
return row.type === "message" && row.role === "user" && data.isCompactInternal === true;
|
|
18304
|
+
}
|
|
18181
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) {
|
|
18182
18312
|
const entries = /* @__PURE__ */ new Map();
|
|
18183
18313
|
let leaf = "";
|
|
18184
18314
|
for (const row of parseRows(contents)) {
|
|
@@ -18203,10 +18333,16 @@ function nativeHistoryRows(contents) {
|
|
|
18203
18333
|
throw new CodeBuddyError("protocolError", "Native history parent is missing");
|
|
18204
18334
|
chain.push(row);
|
|
18205
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
|
+
}
|
|
18206
18342
|
}
|
|
18207
18343
|
return chain.reverse();
|
|
18208
18344
|
}
|
|
18209
|
-
function snapshotFromHistory(contents, ref, cwd, profile = CODEBUDDY_RUNTIME_PROFILE) {
|
|
18345
|
+
function snapshotFromHistory(contents, ref, cwd, profile = CODEBUDDY_RUNTIME_PROFILE, options = {}) {
|
|
18210
18346
|
const supportsNativeCommands = nativeCommandsEnabled(profile);
|
|
18211
18347
|
const supportsFork = capabilitiesForProfile(profile).history.fork;
|
|
18212
18348
|
const turns = [];
|
|
@@ -18232,7 +18368,8 @@ function snapshotFromHistory(contents, ref, cwd, profile = CODEBUDDY_RUNTIME_PRO
|
|
|
18232
18368
|
snapshot.item.outputTruncated = Boolean(output.truncated);
|
|
18233
18369
|
}
|
|
18234
18370
|
};
|
|
18235
|
-
const
|
|
18371
|
+
const includeCompactionHistory = options.includeCompactionHistory !== false;
|
|
18372
|
+
const history = includeCompactionHistory ? nativeDisplayHistoryRows(contents) : nativeHistoryRows(contents);
|
|
18236
18373
|
const manualCompactions = /* @__PURE__ */ new Set();
|
|
18237
18374
|
let compactUser;
|
|
18238
18375
|
if (supportsNativeCommands)
|
|
@@ -18266,6 +18403,22 @@ function snapshotFromHistory(contents, ref, cwd, profile = CODEBUDDY_RUNTIME_PRO
|
|
|
18266
18403
|
continue;
|
|
18267
18404
|
if (supportsNativeCommands && row.type === "message" && row.role === "user" && data.agent === "compact" && !manualCompactions.has(text(row.id)))
|
|
18268
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
|
+
}
|
|
18269
18422
|
if (row.type === "message" && row.role === "user") {
|
|
18270
18423
|
current = {
|
|
18271
18424
|
nativeTurnRef: nativeTurnRefSchema.parse({
|
|
@@ -22684,9 +22837,23 @@ var ClientSideConnection = class {
|
|
|
22684
22837
|
|
|
22685
22838
|
// dist/copy-cleanup.js
|
|
22686
22839
|
import { randomBytes } from "node:crypto";
|
|
22840
|
+
|
|
22841
|
+
// dist/acp-stdio.js
|
|
22687
22842
|
import { createInterface as createInterface2 } from "node:readline";
|
|
22688
|
-
import { stripVTControlCharacters } from "node:util";
|
|
22689
22843
|
import { Readable } from "node:stream";
|
|
22844
|
+
import { stripVTControlCharacters } from "node:util";
|
|
22845
|
+
function codeBuddyAcpOutput(stdout, onLine) {
|
|
22846
|
+
return Readable.from((async function* () {
|
|
22847
|
+
for await (const line of createInterface2({ input: stdout })) {
|
|
22848
|
+
onLine?.(stripVTControlCharacters(line));
|
|
22849
|
+
if (line.trimStart().startsWith("{"))
|
|
22850
|
+
yield Buffer.from(`${line}
|
|
22851
|
+
`);
|
|
22852
|
+
}
|
|
22853
|
+
})());
|
|
22854
|
+
}
|
|
22855
|
+
|
|
22856
|
+
// dist/copy-cleanup.js
|
|
22690
22857
|
var CodeBuddyCopyCleanup = class {
|
|
22691
22858
|
copyId;
|
|
22692
22859
|
cwd;
|
|
@@ -22716,17 +22883,11 @@ var CodeBuddyCopyCleanup = class {
|
|
|
22716
22883
|
}
|
|
22717
22884
|
/** Native --serve banners include its password; never pass them to the ACP parser/logs. */
|
|
22718
22885
|
protocolOutput(stdout) {
|
|
22719
|
-
return
|
|
22720
|
-
|
|
22721
|
-
async *#protocolLines(stdout) {
|
|
22722
|
-
for await (const line of createInterface2({ input: stdout })) {
|
|
22723
|
-
const endpoint = /^\s*Endpoint\s+(http:\/\/127\.0\.0\.1:\d+)\s*$/u.exec(stripVTControlCharacters(line));
|
|
22886
|
+
return codeBuddyAcpOutput(stdout, (line) => {
|
|
22887
|
+
const endpoint = /^\s*Endpoint\s+(http:\/\/127\.0\.0\.1:\d+)\s*$/u.exec(line);
|
|
22724
22888
|
if (endpoint)
|
|
22725
22889
|
this.#endpoint = endpoint[1];
|
|
22726
|
-
|
|
22727
|
-
yield Buffer.from(`${line}
|
|
22728
|
-
`);
|
|
22729
|
-
}
|
|
22890
|
+
});
|
|
22730
22891
|
}
|
|
22731
22892
|
async remove() {
|
|
22732
22893
|
if (!this.#endpoint)
|
|
@@ -22806,7 +22967,7 @@ var CodeBuddyAcpClient = class {
|
|
|
22806
22967
|
return { outcome: "cancelled" };
|
|
22807
22968
|
return options.handlers.question(params);
|
|
22808
22969
|
}
|
|
22809
|
-
}), ndJsonStream2(Writable.toWeb(this.#child.stdin), Readable2.toWeb(this.#copyCleanup?.protocolOutput(this.#child.stdout) ?? this.#child.stdout)));
|
|
22970
|
+
}), ndJsonStream2(Writable.toWeb(this.#child.stdin), Readable2.toWeb(this.#copyCleanup?.protocolOutput(this.#child.stdout) ?? (invocation.arguments.includes("--serve") ? codeBuddyAcpOutput(this.#child.stdout) : this.#child.stdout))));
|
|
22810
22971
|
void this.#connection.closed.then(() => {
|
|
22811
22972
|
this.#fault(new CodeBuddyError("processExited", "ACP connection closed"));
|
|
22812
22973
|
}).catch((error51) => {
|
|
@@ -23239,7 +23400,9 @@ function commandCaveat(row) {
|
|
|
23239
23400
|
}
|
|
23240
23401
|
function retainedRowCount(input, contents, sourceCwd = input.cwd, profile = CODEBUDDY_RUNTIME_PROFILE) {
|
|
23241
23402
|
const rows2 = nativeHistoryRows(contents);
|
|
23242
|
-
const turns = snapshotFromHistory(contents, input.sourceRef, sourceCwd, profile
|
|
23403
|
+
const turns = snapshotFromHistory(contents, input.sourceRef, sourceCwd, profile, {
|
|
23404
|
+
includeCompactionHistory: false
|
|
23405
|
+
}).turns;
|
|
23243
23406
|
let excluded2;
|
|
23244
23407
|
if (input.kind === "rollbackLastTurn") {
|
|
23245
23408
|
if (!turns.length)
|
|
@@ -24833,6 +24996,8 @@ var CodeBuddySession = class {
|
|
|
24833
24996
|
async #execute(command, nativeCommand = false) {
|
|
24834
24997
|
if (this.#closed || this.#fault)
|
|
24835
24998
|
return failure("invalidState", "Session is closed or faulted", this.profile);
|
|
24999
|
+
if (command.type === "turn.steer")
|
|
25000
|
+
return unsupportedSteer(this.profile.displayName);
|
|
24836
25001
|
if (command.type === "interaction.respond")
|
|
24837
25002
|
return this.#interactions.respond(command);
|
|
24838
25003
|
if (command.type === "turn.cancel") {
|
|
@@ -25250,6 +25415,7 @@ var harnessBrokerMethodSchema = external_exports.enum([
|
|
|
25250
25415
|
"adapter.sessionImport.resolve",
|
|
25251
25416
|
"adapter.subagent.readSnapshot",
|
|
25252
25417
|
"session.readSnapshot",
|
|
25418
|
+
"session.readCapabilities",
|
|
25253
25419
|
"session.refreshUsage",
|
|
25254
25420
|
"session.execute",
|
|
25255
25421
|
"session.commands.list",
|
|
@@ -25349,30 +25515,6 @@ function consumeBrokerFrames(socket, onFrame, onError) {
|
|
|
25349
25515
|
});
|
|
25350
25516
|
}
|
|
25351
25517
|
|
|
25352
|
-
// ../../harness-broker/dist/paths.js
|
|
25353
|
-
import os2 from "node:os";
|
|
25354
|
-
import path11 from "node:path";
|
|
25355
|
-
var HARNESS_BROKER_DESCRIPTOR_ENV = "CODEXHOST_CLAUDE_BROKER_DESCRIPTOR";
|
|
25356
|
-
var HARNESS_BROKER_DESCRIPTOR_FILE = "claude-code-broker-v1.json";
|
|
25357
|
-
function defaultHarnessBrokerDirectory(environment = process.env) {
|
|
25358
|
-
const home = environment.HOME || os2.homedir();
|
|
25359
|
-
return path11.join(home, ".codexhost", "harness-broker");
|
|
25360
|
-
}
|
|
25361
|
-
function defaultHarnessBrokerDescriptorPath(environment = process.env, harnessId = "claude-code") {
|
|
25362
|
-
harnessPluginIdSchema.parse(harnessId);
|
|
25363
|
-
if (harnessId !== "claude-code")
|
|
25364
|
-
return path11.join(defaultHarnessBrokerDirectory(environment), `${harnessId}-broker-v1.json`);
|
|
25365
|
-
return environment[HARNESS_BROKER_DESCRIPTOR_ENV] ?? path11.join(defaultHarnessBrokerDirectory(environment), HARNESS_BROKER_DESCRIPTOR_FILE);
|
|
25366
|
-
}
|
|
25367
|
-
function harnessBrokerLaunchAgentLabel(harnessId = "claude-code") {
|
|
25368
|
-
harnessPluginIdSchema.parse(harnessId);
|
|
25369
|
-
return harnessId === "claude-code" ? "ai.bytepioneer.codexhost.native-harness-broker" : `ai.bytepioneer.codexhost.${harnessId}-broker`;
|
|
25370
|
-
}
|
|
25371
|
-
function harnessBrokerLaunchAgentPlistPath(environment = process.env, harnessId = "claude-code") {
|
|
25372
|
-
const home = environment.HOME || os2.homedir();
|
|
25373
|
-
return path11.join(home, "Library", "LaunchAgents", `${harnessBrokerLaunchAgentLabel(harnessId)}.plist`);
|
|
25374
|
-
}
|
|
25375
|
-
|
|
25376
25518
|
// ../../harness-broker/dist/validation.js
|
|
25377
25519
|
var cwdSchema = external_exports.string().min(1).max(16384);
|
|
25378
25520
|
var brokerEnvironmentSchema = external_exports.object({
|
|
@@ -25423,7 +25565,11 @@ var brokerOpenInputSchema = external_exports.discriminatedUnion("kind", [
|
|
|
25423
25565
|
forkSchema,
|
|
25424
25566
|
rollbackSchema
|
|
25425
25567
|
]);
|
|
25426
|
-
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();
|
|
25427
25573
|
var brokerSessionImportListParamsSchema = external_exports.object({
|
|
25428
25574
|
offset: external_exports.number().int().nonnegative().safe(),
|
|
25429
25575
|
limit: external_exports.number().int().min(1).max(HARNESS_BROKER_SESSION_IMPORT_PAGE_SIZE)
|
|
@@ -25438,10 +25584,10 @@ var brokerSessionImportSourceSchema = external_exports.object({
|
|
|
25438
25584
|
candidate: harnessSessionImportCandidateSchema,
|
|
25439
25585
|
nativeRef: nativeSessionRefSchema
|
|
25440
25586
|
}).strict().superRefine((source, context) => {
|
|
25441
|
-
if (source.nativeRef.
|
|
25587
|
+
if (source.nativeRef.nativeSessionId !== source.candidate.nativeSessionId) {
|
|
25442
25588
|
context.addIssue({
|
|
25443
25589
|
code: "custom",
|
|
25444
|
-
message: "
|
|
25590
|
+
message: "Session import source identity does not match"
|
|
25445
25591
|
});
|
|
25446
25592
|
}
|
|
25447
25593
|
});
|
|
@@ -25451,6 +25597,11 @@ var turnStartSchema = external_exports.object({
|
|
|
25451
25597
|
turnId: hostTurnIdSchema,
|
|
25452
25598
|
input: external_exports.array(textInputSchema)
|
|
25453
25599
|
}).strict();
|
|
25600
|
+
var turnSteerSchema = external_exports.object({
|
|
25601
|
+
type: external_exports.literal("turn.steer"),
|
|
25602
|
+
turnId: hostTurnIdSchema,
|
|
25603
|
+
input: external_exports.array(textInputSchema)
|
|
25604
|
+
}).strict();
|
|
25454
25605
|
var turnCancelSchema = external_exports.object({ type: external_exports.literal("turn.cancel"), turnId: hostTurnIdSchema }).strict();
|
|
25455
25606
|
var interactionResponseSchema = external_exports.union([
|
|
25456
25607
|
external_exports.object({
|
|
@@ -25476,6 +25627,7 @@ var permissionSelectSchema = external_exports.object({
|
|
|
25476
25627
|
}).strict();
|
|
25477
25628
|
var brokerHostCommandSchema = external_exports.discriminatedUnion("type", [
|
|
25478
25629
|
turnStartSchema,
|
|
25630
|
+
turnSteerSchema,
|
|
25479
25631
|
turnCancelSchema,
|
|
25480
25632
|
interactionRespondSchema,
|
|
25481
25633
|
modelSelectSchema,
|
|
@@ -25609,6 +25761,107 @@ var harnessOutputSchema = external_exports.custom((value) => {
|
|
|
25609
25761
|
return false;
|
|
25610
25762
|
});
|
|
25611
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
|
+
|
|
25612
25865
|
// ../../harness-broker/dist/client.js
|
|
25613
25866
|
function unavailable(message, retryable = true) {
|
|
25614
25867
|
return { code: "unavailable", message, retryable, stage: "harnessBroker" };
|
|
@@ -25668,6 +25921,7 @@ function parseSessionMetadata(value) {
|
|
|
25668
25921
|
sessionId: candidate.sessionId,
|
|
25669
25922
|
sessionGeneration: candidate.sessionGeneration,
|
|
25670
25923
|
capabilities: harnessSessionCapabilitiesSchema.parse(candidate.capabilities),
|
|
25924
|
+
readCapabilities: candidate.readCapabilities === true,
|
|
25671
25925
|
initialState: state,
|
|
25672
25926
|
initialUsage: candidate.initialUsage === null ? null : parseHostUsage(candidate.initialUsage),
|
|
25673
25927
|
commands: candidate.commands === true
|
|
@@ -26019,6 +26273,11 @@ var BrokeredHarnessSession = class {
|
|
|
26019
26273
|
event: { type: "session.faulted", error: unavailable(error51.message) }
|
|
26020
26274
|
});
|
|
26021
26275
|
}
|
|
26276
|
+
async readCapabilities() {
|
|
26277
|
+
if (!this.#metadata.readCapabilities)
|
|
26278
|
+
return { ...this.capabilities, steer: false };
|
|
26279
|
+
return harnessSessionCapabilitiesSchema.parse(await this.#request("session.readCapabilities", {}));
|
|
26280
|
+
}
|
|
26022
26281
|
async refreshUsage() {
|
|
26023
26282
|
await this.#request("session.refreshUsage", {});
|
|
26024
26283
|
}
|
|
@@ -26050,6 +26309,8 @@ var BrokeredHarnessSession = class {
|
|
|
26050
26309
|
try {
|
|
26051
26310
|
return parseHarnessResult(await this.#request("session.execute", { command }));
|
|
26052
26311
|
} catch (error51) {
|
|
26312
|
+
if (command.type === "turn.steer")
|
|
26313
|
+
throw error51;
|
|
26053
26314
|
return {
|
|
26054
26315
|
ok: false,
|
|
26055
26316
|
error: unavailable(error51 instanceof Error ? error51.message : String(error51))
|
|
@@ -26137,6 +26398,7 @@ var BrokeredHarnessAdapter = class {
|
|
|
26137
26398
|
commandCatalog;
|
|
26138
26399
|
liveCommandCatalog;
|
|
26139
26400
|
harnessId;
|
|
26401
|
+
sessionImport;
|
|
26140
26402
|
credits;
|
|
26141
26403
|
refreshCredits;
|
|
26142
26404
|
#descriptorPath;
|
|
@@ -26146,7 +26408,6 @@ var BrokeredHarnessAdapter = class {
|
|
|
26146
26408
|
#startTimeoutMs;
|
|
26147
26409
|
#connection = null;
|
|
26148
26410
|
#closed = false;
|
|
26149
|
-
#sessionImportListing = null;
|
|
26150
26411
|
#credits = null;
|
|
26151
26412
|
#creditsRefresh = null;
|
|
26152
26413
|
subagents = {
|
|
@@ -26158,86 +26419,16 @@ var BrokeredHarnessAdapter = class {
|
|
|
26158
26419
|
}
|
|
26159
26420
|
}
|
|
26160
26421
|
};
|
|
26161
|
-
sessionImport = Object.freeze({
|
|
26162
|
-
listCandidates: () => {
|
|
26163
|
-
this.#sessionImportListing ??= this.#listSessionImportCandidates().finally(() => {
|
|
26164
|
-
this.#sessionImportListing = null;
|
|
26165
|
-
});
|
|
26166
|
-
return this.#sessionImportListing;
|
|
26167
|
-
},
|
|
26168
|
-
resolveCandidate: async (nativeSessionId) => {
|
|
26169
|
-
if (this.#closed) {
|
|
26170
|
-
return {
|
|
26171
|
-
ok: false,
|
|
26172
|
-
error: unavailable("Claude Aqua broker adapter is closed", false)
|
|
26173
|
-
};
|
|
26174
|
-
}
|
|
26175
|
-
try {
|
|
26176
|
-
const result = parseHarnessResult(await (await this.#connect()).request("adapter.sessionImport.resolve", {
|
|
26177
|
-
nativeSessionId
|
|
26178
|
-
}));
|
|
26179
|
-
if (!result.ok)
|
|
26180
|
-
return result;
|
|
26181
|
-
const parsed = brokerSessionImportSourceSchema.safeParse(result.value);
|
|
26182
|
-
if (!parsed.success || parsed.data.candidate.nativeSessionId !== nativeSessionId) {
|
|
26183
|
-
return {
|
|
26184
|
-
ok: false,
|
|
26185
|
-
error: {
|
|
26186
|
-
...unavailable("Harness broker returned an invalid Session source", false),
|
|
26187
|
-
code: "protocolError"
|
|
26188
|
-
}
|
|
26189
|
-
};
|
|
26190
|
-
}
|
|
26191
|
-
return { ok: true, value: parsed.data };
|
|
26192
|
-
} catch (error51) {
|
|
26193
|
-
this.#connection = null;
|
|
26194
|
-
return {
|
|
26195
|
-
ok: false,
|
|
26196
|
-
error: unavailable(error51 instanceof Error ? error51.message : String(error51))
|
|
26197
|
-
};
|
|
26198
|
-
}
|
|
26199
|
-
}
|
|
26200
|
-
});
|
|
26201
|
-
async #listSessionImportCandidates() {
|
|
26202
|
-
if (this.#closed) {
|
|
26203
|
-
return {
|
|
26204
|
-
ok: false,
|
|
26205
|
-
error: unavailable("Claude Aqua broker adapter is closed", false)
|
|
26206
|
-
};
|
|
26207
|
-
}
|
|
26208
|
-
try {
|
|
26209
|
-
const candidates = [];
|
|
26210
|
-
for (; ; ) {
|
|
26211
|
-
const result = parseHarnessResult(await (await this.#connect()).request("adapter.sessionImport.list", {
|
|
26212
|
-
offset: candidates.length,
|
|
26213
|
-
limit: HARNESS_BROKER_SESSION_IMPORT_PAGE_SIZE
|
|
26214
|
-
}));
|
|
26215
|
-
if (!result.ok)
|
|
26216
|
-
return result;
|
|
26217
|
-
const parsed = brokerSessionImportPageSchema.safeParse(result.value);
|
|
26218
|
-
if (!parsed.success || parsed.data.total < candidates.length + parsed.data.candidates.length || parsed.data.candidates.length === 0 && candidates.length < parsed.data.total) {
|
|
26219
|
-
return {
|
|
26220
|
-
ok: false,
|
|
26221
|
-
error: {
|
|
26222
|
-
...unavailable("Harness broker returned invalid Session candidates", false),
|
|
26223
|
-
code: "protocolError"
|
|
26224
|
-
}
|
|
26225
|
-
};
|
|
26226
|
-
}
|
|
26227
|
-
candidates.push(...parsed.data.candidates);
|
|
26228
|
-
if (candidates.length === parsed.data.total)
|
|
26229
|
-
return { ok: true, value: candidates };
|
|
26230
|
-
}
|
|
26231
|
-
} catch (error51) {
|
|
26232
|
-
this.#connection = null;
|
|
26233
|
-
return {
|
|
26234
|
-
ok: false,
|
|
26235
|
-
error: unavailable(error51 instanceof Error ? error51.message : String(error51))
|
|
26236
|
-
};
|
|
26237
|
-
}
|
|
26238
|
-
}
|
|
26239
26422
|
constructor(input = {}) {
|
|
26240
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
|
+
}
|
|
26241
26432
|
if (input.accountCredits !== false) {
|
|
26242
26433
|
this.credits = () => this.#credits;
|
|
26243
26434
|
this.refreshCredits = () => this.#refreshAccountCredits();
|
|
@@ -26425,6 +26616,7 @@ function createHarnessAdapter(context) {
|
|
|
26425
26616
|
if (context.platform === "darwin" && context.managedRemoteHost) {
|
|
26426
26617
|
const environment2 = { ...context.environment };
|
|
26427
26618
|
return new BrokeredHarnessAdapter({
|
|
26619
|
+
sessionImport: true,
|
|
26428
26620
|
accountCredits: false,
|
|
26429
26621
|
harnessId: "codebuddy",
|
|
26430
26622
|
forwardDelegationEnvironment: true,
|