@liberseek/boft-cli-linux-x64 0.8.4 → 0.8.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 +2 -2
- package/THIRD_PARTY_NOTICES.txt +6 -2
- package/app/codexhost-distribution.json +1 -1
- package/app/console-server.mjs +129 -28
- package/app/console-web.js +336 -78
- package/app/desktop-controller.mjs +1741 -60
- package/app/host-runtime.mjs +4983 -2002
- package/app/plugins/antigravity/plugin.mjs +423 -63
- package/app/plugins/claude-code/plugin.mjs +417 -264
- package/app/plugins/codebuddy/plugin.mjs +256 -134
- package/app/plugins/codex-usage/plugin.mjs +97 -32
- package/app/plugins/copilot/plugin.mjs +122 -57
- package/app/plugins/cursor-cli/plugin.mjs +236 -139
- package/app/plugins/deepseek-harness/plugin.mjs +584 -86
- package/app/plugins/devin/assets/icon.svg +1 -0
- package/app/plugins/devin/manifest.json +30 -0
- package/app/plugins/devin/plugin.mjs +23425 -0
- package/app/plugins/enabled.json +2 -0
- package/app/plugins/grok/plugin.mjs +839 -500
- package/app/plugins/hermes/plugin.mjs +522 -200
- package/app/plugins/kimi-code/plugin.mjs +134 -22
- package/app/plugins/kiro-cli/plugin.mjs +84 -19
- package/app/plugins/muse/plugin.mjs +74 -9
- package/app/plugins/omp/plugin.mjs +104 -39
- package/app/plugins/opencode/plugin.mjs +126 -61
- package/app/plugins/pi/plugin.mjs +1769 -468
- package/app/plugins/qoder/plugin.mjs +9617 -8682
- package/app/plugins/qoder-cn/plugin.mjs +9617 -8682
- package/app/plugins/qwen-code/assets/icon.svg +1 -0
- package/app/plugins/qwen-code/manifest.json +29 -0
- package/app/plugins/qwen-code/plugin.mjs +29366 -0
- package/app/plugins/workbuddy/plugin.mjs +256 -134
- package/app/plugins/zcode/plugin.mjs +265 -42
- package/app/renderer-extension.js +3286 -528
- package/bin/boft +0 -0
- package/libexec/boft-shim +0 -0
- package/libexec/boft-updater +0 -0
- package/licenses/Qwen-Code-SDK-LICENSE.txt +203 -0
- package/package.json +2 -2
|
@@ -3040,10 +3040,10 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
3040
3040
|
const shape = def.shape;
|
|
3041
3041
|
const propValues = {};
|
|
3042
3042
|
for (const key in shape) {
|
|
3043
|
-
const
|
|
3044
|
-
if (
|
|
3043
|
+
const field2 = shape[key]._zod;
|
|
3044
|
+
if (field2.values) {
|
|
3045
3045
|
propValues[key] ?? (propValues[key] = /* @__PURE__ */ new Set());
|
|
3046
|
-
for (const v of
|
|
3046
|
+
for (const v of field2.values)
|
|
3047
3047
|
propValues[key].add(v);
|
|
3048
3048
|
}
|
|
3049
3049
|
}
|
|
@@ -14683,6 +14683,8 @@ var usageStatisticsTotalsSchema = external_exports.strictObject({
|
|
|
14683
14683
|
cachedInputTokens: count,
|
|
14684
14684
|
cacheWriteInputTokens: count,
|
|
14685
14685
|
cacheKnownInputTokens: count,
|
|
14686
|
+
cacheHitCachedInputTokens: count,
|
|
14687
|
+
cacheHitInputTokens: count,
|
|
14686
14688
|
outputTokens: count,
|
|
14687
14689
|
reasoningOutputTokens: count,
|
|
14688
14690
|
/** USD at the public price, summed over the priced requests only. */
|
|
@@ -14790,6 +14792,51 @@ var hostInteractionIdSchema = opaqueIdSchema.brand();
|
|
|
14790
14792
|
var threadPrewarmDiscardParamsSchema = external_exports.object({ threadId: hostThreadIdSchema });
|
|
14791
14793
|
var threadPrewarmDiscardResultSchema = external_exports.object({ discarded: external_exports.boolean() });
|
|
14792
14794
|
|
|
14795
|
+
// ../../shared-contracts/dist/thread-questions.js
|
|
14796
|
+
var field = external_exports.discriminatedUnion("type", [
|
|
14797
|
+
external_exports.object({
|
|
14798
|
+
id: external_exports.string().min(1),
|
|
14799
|
+
type: external_exports.literal("choice"),
|
|
14800
|
+
prompt: external_exports.string(),
|
|
14801
|
+
options: external_exports.array(external_exports.object({
|
|
14802
|
+
value: external_exports.string().min(1),
|
|
14803
|
+
label: external_exports.string(),
|
|
14804
|
+
description: external_exports.string().optional()
|
|
14805
|
+
})).min(1),
|
|
14806
|
+
multiple: external_exports.boolean(),
|
|
14807
|
+
allowOther: external_exports.boolean(),
|
|
14808
|
+
optional: external_exports.boolean()
|
|
14809
|
+
}),
|
|
14810
|
+
external_exports.object({
|
|
14811
|
+
id: external_exports.string().min(1),
|
|
14812
|
+
type: external_exports.literal("text"),
|
|
14813
|
+
prompt: external_exports.string(),
|
|
14814
|
+
multiline: external_exports.boolean(),
|
|
14815
|
+
secret: external_exports.literal(false),
|
|
14816
|
+
optional: external_exports.boolean(),
|
|
14817
|
+
placeholder: external_exports.string().optional(),
|
|
14818
|
+
prefill: external_exports.string().optional()
|
|
14819
|
+
})
|
|
14820
|
+
]);
|
|
14821
|
+
var threadQuestionSchema = external_exports.object({
|
|
14822
|
+
interactionId: external_exports.string().min(1),
|
|
14823
|
+
turnId: external_exports.string().min(1),
|
|
14824
|
+
title: external_exports.string().optional(),
|
|
14825
|
+
questions: external_exports.array(field).min(1)
|
|
14826
|
+
}).refine(({ questions }) => questions.some((q) => q.type === "choice" && q.multiple), {
|
|
14827
|
+
message: "Shared cards require at least one multi-select question"
|
|
14828
|
+
});
|
|
14829
|
+
var threadQuestionsListParamsSchema = external_exports.strictObject({ threadId: external_exports.string().min(1) });
|
|
14830
|
+
var threadQuestionsResultSchema = external_exports.object({ questions: external_exports.array(threadQuestionSchema) });
|
|
14831
|
+
var threadQuestionRespondParamsSchema = external_exports.strictObject({
|
|
14832
|
+
threadId: external_exports.string().min(1),
|
|
14833
|
+
turnId: external_exports.string().min(1),
|
|
14834
|
+
interactionId: external_exports.string().min(1),
|
|
14835
|
+
answers: external_exports.record(external_exports.string(), external_exports.array(external_exports.string())),
|
|
14836
|
+
cancelled: external_exports.boolean().default(false)
|
|
14837
|
+
});
|
|
14838
|
+
var threadQuestionRespondResultSchema = external_exports.object({ accepted: external_exports.literal(true) });
|
|
14839
|
+
|
|
14793
14840
|
// ../../shared-contracts/dist/harness-plugins.js
|
|
14794
14841
|
var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
|
|
14795
14842
|
var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
|
|
@@ -15549,6 +15596,21 @@ var threadSteeringInspectParamsSchema = external_exports.object({
|
|
|
15549
15596
|
/** The text about to be steered; a Harness command always stops and restarts. */
|
|
15550
15597
|
text: external_exports.string().optional()
|
|
15551
15598
|
}).strict();
|
|
15599
|
+
var threadSteeringContextSchema = external_exports.object({
|
|
15600
|
+
kind: external_exports.literal("application"),
|
|
15601
|
+
value: external_exports.string().transform((text2, context) => {
|
|
15602
|
+
try {
|
|
15603
|
+
return JSON.parse(text2);
|
|
15604
|
+
} catch {
|
|
15605
|
+
context.addIssue({ code: "custom", message: "Invalid steering context JSON" });
|
|
15606
|
+
return external_exports.NEVER;
|
|
15607
|
+
}
|
|
15608
|
+
}).pipe(external_exports.object({
|
|
15609
|
+
expectedTurnId: hostTurnIdSchema,
|
|
15610
|
+
clientUserMessageId: external_exports.string().min(1),
|
|
15611
|
+
delivery: external_exports.enum(["newTurn", "activeTurn"])
|
|
15612
|
+
}).strict())
|
|
15613
|
+
}).strict().transform((context) => context.value);
|
|
15552
15614
|
var threadSteerDeliverySchema = external_exports.enum(["activeTurn", "newTurn"]);
|
|
15553
15615
|
var threadSteeringInspectResultSchema = external_exports.object({
|
|
15554
15616
|
delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
|
|
@@ -15559,7 +15621,10 @@ var harnessPluginRouteSchema = external_exports.object({
|
|
|
15559
15621
|
harnessId: harnessPluginIdSchema,
|
|
15560
15622
|
model: harnessModelRefSchema.optional(),
|
|
15561
15623
|
thinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
15562
|
-
permissionModeId: harnessPermissionModeIdSchema.optional()
|
|
15624
|
+
permissionModeId: harnessPermissionModeIdSchema.optional(),
|
|
15625
|
+
/** A draft prewarm create: stays unsubmitted until the user's first Turn.
|
|
15626
|
+
* Desktop forwards only the Model of a main-process prewarm to thread/start. */
|
|
15627
|
+
prewarm: external_exports.literal(true).optional()
|
|
15563
15628
|
}).strict();
|
|
15564
15629
|
|
|
15565
15630
|
// ../../shared-contracts/dist/harness-launch-settings.js
|
|
@@ -16187,26 +16252,26 @@ function parseHostUsage(value) {
|
|
|
16187
16252
|
}
|
|
16188
16253
|
}
|
|
16189
16254
|
const indicators = value.composerIndicators === void 0 ? {} : { composerIndicators: composerIndicatorsSchema.parse(value.composerIndicators) };
|
|
16190
|
-
for (const
|
|
16255
|
+
for (const field2 of [
|
|
16191
16256
|
"totalCredits",
|
|
16192
16257
|
"contextUsagePercent",
|
|
16193
16258
|
"apiOutputTokensPerSecond"
|
|
16194
16259
|
]) {
|
|
16195
|
-
const candidate = value[
|
|
16260
|
+
const candidate = value[field2];
|
|
16196
16261
|
if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isFinite(candidate) || candidate < 0)) {
|
|
16197
|
-
throw new Error(`Harness Usage '${
|
|
16262
|
+
throw new Error(`Harness Usage '${field2}' must be a finite non-negative number`);
|
|
16198
16263
|
}
|
|
16199
16264
|
}
|
|
16200
|
-
for (const
|
|
16201
|
-
const candidate = value[
|
|
16265
|
+
for (const field2 of tokenFields) {
|
|
16266
|
+
const candidate = value[field2];
|
|
16202
16267
|
if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isSafeInteger(candidate) || candidate < 0)) {
|
|
16203
|
-
throw new Error(`Harness Usage '${
|
|
16268
|
+
throw new Error(`Harness Usage '${field2}' must be a non-negative safe integer`);
|
|
16204
16269
|
}
|
|
16205
16270
|
}
|
|
16206
|
-
for (const
|
|
16207
|
-
const candidate = value[
|
|
16271
|
+
for (const field2 of safeIntegerFields) {
|
|
16272
|
+
const candidate = value[field2];
|
|
16208
16273
|
if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isSafeInteger(candidate) || candidate < 0)) {
|
|
16209
|
-
throw new Error(`Harness Usage '${
|
|
16274
|
+
throw new Error(`Harness Usage '${field2}' must be a non-negative safe integer`);
|
|
16210
16275
|
}
|
|
16211
16276
|
}
|
|
16212
16277
|
if (value.outputTokensPerSecond !== void 0 && (typeof value.outputTokensPerSecond !== "number" || !Number.isFinite(value.outputTokensPerSecond) || value.outputTokensPerSecond < 0)) {
|
|
@@ -16215,16 +16280,16 @@ function parseHostUsage(value) {
|
|
|
16215
16280
|
if (value.totalCostUsd !== void 0 && (typeof value.totalCostUsd !== "number" || !Number.isFinite(value.totalCostUsd) || value.totalCostUsd < 0)) {
|
|
16216
16281
|
throw new Error("Harness Usage 'totalCostUsd' must be a finite non-negative number");
|
|
16217
16282
|
}
|
|
16218
|
-
for (const
|
|
16219
|
-
const candidate = value[
|
|
16283
|
+
for (const field2 of ["totalCredits", "contextUsagePercent"]) {
|
|
16284
|
+
const candidate = value[field2];
|
|
16220
16285
|
if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isFinite(candidate) || candidate < 0)) {
|
|
16221
|
-
throw new Error(`Harness Usage '${
|
|
16286
|
+
throw new Error(`Harness Usage '${field2}' must be a finite non-negative number`);
|
|
16222
16287
|
}
|
|
16223
16288
|
}
|
|
16224
|
-
for (const
|
|
16225
|
-
const candidate = value[
|
|
16289
|
+
for (const field2 of percentFields) {
|
|
16290
|
+
const candidate = value[field2];
|
|
16226
16291
|
if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isFinite(candidate) || candidate < 0 || candidate > 100)) {
|
|
16227
|
-
throw new Error(`Harness Usage '${
|
|
16292
|
+
throw new Error(`Harness Usage '${field2}' must be between 0 and 100`);
|
|
16228
16293
|
}
|
|
16229
16294
|
}
|
|
16230
16295
|
if (value.sessionCacheUsage !== void 0) {
|
|
@@ -16295,19 +16360,19 @@ function parseHostUsageRequest(value) {
|
|
|
16295
16360
|
if (typeof value.requestId !== "string" || value.requestId.length === 0) {
|
|
16296
16361
|
throw new Error("Harness Usage request 'requestId' must be a non-empty string");
|
|
16297
16362
|
}
|
|
16298
|
-
for (const
|
|
16299
|
-
const candidate = value[
|
|
16363
|
+
for (const field2 of ["model", "provider"]) {
|
|
16364
|
+
const candidate = value[field2];
|
|
16300
16365
|
if (candidate !== void 0 && (typeof candidate !== "string" || candidate.length === 0)) {
|
|
16301
|
-
throw new Error(`Harness Usage request '${
|
|
16366
|
+
throw new Error(`Harness Usage request '${field2}' must be a non-empty string`);
|
|
16302
16367
|
}
|
|
16303
16368
|
}
|
|
16304
16369
|
if (value.historical !== void 0 && typeof value.historical !== "boolean") {
|
|
16305
16370
|
throw new Error("Harness Usage request 'historical' must be a boolean");
|
|
16306
16371
|
}
|
|
16307
|
-
for (const
|
|
16308
|
-
const candidate = value[
|
|
16372
|
+
for (const field2 of requestTokenFields) {
|
|
16373
|
+
const candidate = value[field2];
|
|
16309
16374
|
if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isSafeInteger(candidate) || candidate < 0)) {
|
|
16310
|
-
throw new Error(`Harness Usage request '${
|
|
16375
|
+
throw new Error(`Harness Usage request '${field2}' must be a non-negative safe integer`);
|
|
16311
16376
|
}
|
|
16312
16377
|
}
|
|
16313
16378
|
if (value.inputTokens === void 0 || value.outputTokens === void 0) {
|
|
@@ -16525,30 +16590,6 @@ function consumeBrokerFrames(socket, onFrame, onError) {
|
|
|
16525
16590
|
});
|
|
16526
16591
|
}
|
|
16527
16592
|
|
|
16528
|
-
// ../../harness-broker/dist/paths.js
|
|
16529
|
-
import os from "node:os";
|
|
16530
|
-
import path from "node:path";
|
|
16531
|
-
var HARNESS_BROKER_DESCRIPTOR_ENV = "CODEXHOST_CLAUDE_BROKER_DESCRIPTOR";
|
|
16532
|
-
var HARNESS_BROKER_DESCRIPTOR_FILE = "claude-code-broker-v1.json";
|
|
16533
|
-
function defaultHarnessBrokerDirectory(environment = process.env) {
|
|
16534
|
-
const home = environment.HOME || os.homedir();
|
|
16535
|
-
return path.join(home, ".codexhost", "harness-broker");
|
|
16536
|
-
}
|
|
16537
|
-
function defaultHarnessBrokerDescriptorPath(environment = process.env, harnessId = "claude-code") {
|
|
16538
|
-
harnessPluginIdSchema.parse(harnessId);
|
|
16539
|
-
if (harnessId !== "claude-code")
|
|
16540
|
-
return path.join(defaultHarnessBrokerDirectory(environment), `${harnessId}-broker-v1.json`);
|
|
16541
|
-
return environment[HARNESS_BROKER_DESCRIPTOR_ENV] ?? path.join(defaultHarnessBrokerDirectory(environment), HARNESS_BROKER_DESCRIPTOR_FILE);
|
|
16542
|
-
}
|
|
16543
|
-
function harnessBrokerLaunchAgentLabel(harnessId = "claude-code") {
|
|
16544
|
-
harnessPluginIdSchema.parse(harnessId);
|
|
16545
|
-
return harnessId === "claude-code" ? "ai.bytepioneer.codexhost.native-harness-broker" : `ai.bytepioneer.codexhost.${harnessId}-broker`;
|
|
16546
|
-
}
|
|
16547
|
-
function harnessBrokerLaunchAgentPlistPath(environment = process.env, harnessId = "claude-code") {
|
|
16548
|
-
const home = environment.HOME || os.homedir();
|
|
16549
|
-
return path.join(home, "Library", "LaunchAgents", `${harnessBrokerLaunchAgentLabel(harnessId)}.plist`);
|
|
16550
|
-
}
|
|
16551
|
-
|
|
16552
16593
|
// ../../harness-broker/dist/validation.js
|
|
16553
16594
|
var cwdSchema = external_exports.string().min(1).max(16384);
|
|
16554
16595
|
var brokerEnvironmentSchema = external_exports.object({
|
|
@@ -16599,7 +16640,11 @@ var brokerOpenInputSchema = external_exports.discriminatedUnion("kind", [
|
|
|
16599
16640
|
forkSchema,
|
|
16600
16641
|
rollbackSchema
|
|
16601
16642
|
]);
|
|
16602
|
-
var brokerInspectInputSchema = external_exports.object({
|
|
16643
|
+
var brokerInspectInputSchema = external_exports.object({
|
|
16644
|
+
cwd: cwdSchema.optional(),
|
|
16645
|
+
refresh: external_exports.boolean().optional(),
|
|
16646
|
+
purpose: external_exports.literal("availability").optional()
|
|
16647
|
+
}).strict();
|
|
16603
16648
|
var brokerSessionImportListParamsSchema = external_exports.object({
|
|
16604
16649
|
offset: external_exports.number().int().nonnegative().safe(),
|
|
16605
16650
|
limit: external_exports.number().int().min(1).max(HARNESS_BROKER_SESSION_IMPORT_PAGE_SIZE)
|
|
@@ -16614,10 +16659,10 @@ var brokerSessionImportSourceSchema = external_exports.object({
|
|
|
16614
16659
|
candidate: harnessSessionImportCandidateSchema,
|
|
16615
16660
|
nativeRef: nativeSessionRefSchema
|
|
16616
16661
|
}).strict().superRefine((source, context) => {
|
|
16617
|
-
if (source.nativeRef.
|
|
16662
|
+
if (source.nativeRef.nativeSessionId !== source.candidate.nativeSessionId) {
|
|
16618
16663
|
context.addIssue({
|
|
16619
16664
|
code: "custom",
|
|
16620
|
-
message: "
|
|
16665
|
+
message: "Session import source identity does not match"
|
|
16621
16666
|
});
|
|
16622
16667
|
}
|
|
16623
16668
|
});
|
|
@@ -16791,6 +16836,107 @@ var harnessOutputSchema = external_exports.custom((value) => {
|
|
|
16791
16836
|
return false;
|
|
16792
16837
|
});
|
|
16793
16838
|
|
|
16839
|
+
// ../../harness-broker/dist/session-import-client.js
|
|
16840
|
+
function createBrokerSessionImportCapability(input) {
|
|
16841
|
+
let listing = null;
|
|
16842
|
+
const closed = () => ({
|
|
16843
|
+
ok: false,
|
|
16844
|
+
error: { code: "invalidState", message: "Harness broker adapter is closed", retryable: false }
|
|
16845
|
+
});
|
|
16846
|
+
const invalid = () => ({
|
|
16847
|
+
ok: false,
|
|
16848
|
+
error: {
|
|
16849
|
+
code: "protocolError",
|
|
16850
|
+
message: "Harness broker returned invalid Session import metadata",
|
|
16851
|
+
retryable: false
|
|
16852
|
+
}
|
|
16853
|
+
});
|
|
16854
|
+
const list = async () => {
|
|
16855
|
+
try {
|
|
16856
|
+
const candidates = [];
|
|
16857
|
+
const identities = /* @__PURE__ */ new Set();
|
|
16858
|
+
let total;
|
|
16859
|
+
for (; ; ) {
|
|
16860
|
+
if (input.isClosed())
|
|
16861
|
+
return closed();
|
|
16862
|
+
const result = await input.request("adapter.sessionImport.list", {
|
|
16863
|
+
offset: candidates.length,
|
|
16864
|
+
limit: HARNESS_BROKER_SESSION_IMPORT_PAGE_SIZE
|
|
16865
|
+
});
|
|
16866
|
+
if (input.isClosed())
|
|
16867
|
+
return closed();
|
|
16868
|
+
if (!result.ok)
|
|
16869
|
+
return result;
|
|
16870
|
+
const page = brokerSessionImportPageSchema.safeParse(result.value);
|
|
16871
|
+
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)
|
|
16872
|
+
return invalid();
|
|
16873
|
+
total = page.data.total;
|
|
16874
|
+
for (const candidate of page.data.candidates) {
|
|
16875
|
+
if (identities.has(candidate.nativeSessionId))
|
|
16876
|
+
return invalid();
|
|
16877
|
+
identities.add(candidate.nativeSessionId);
|
|
16878
|
+
candidates.push(candidate);
|
|
16879
|
+
}
|
|
16880
|
+
if (candidates.length === total)
|
|
16881
|
+
return { ok: true, value: candidates };
|
|
16882
|
+
}
|
|
16883
|
+
} catch (error51) {
|
|
16884
|
+
return { ok: false, error: input.error(error51) };
|
|
16885
|
+
}
|
|
16886
|
+
};
|
|
16887
|
+
return {
|
|
16888
|
+
listCandidates() {
|
|
16889
|
+
if (input.isClosed())
|
|
16890
|
+
return Promise.resolve(closed());
|
|
16891
|
+
listing ??= list().finally(() => {
|
|
16892
|
+
listing = null;
|
|
16893
|
+
});
|
|
16894
|
+
return listing;
|
|
16895
|
+
},
|
|
16896
|
+
async resolveCandidate(nativeSessionId) {
|
|
16897
|
+
if (input.isClosed())
|
|
16898
|
+
return closed();
|
|
16899
|
+
try {
|
|
16900
|
+
const result = await input.request("adapter.sessionImport.resolve", { nativeSessionId });
|
|
16901
|
+
if (input.isClosed())
|
|
16902
|
+
return closed();
|
|
16903
|
+
if (!result.ok)
|
|
16904
|
+
return result;
|
|
16905
|
+
const source = brokerSessionImportSourceSchema.safeParse(result.value);
|
|
16906
|
+
if (!source.success || source.data.nativeRef.harnessId !== input.harnessId || source.data.candidate.nativeSessionId !== nativeSessionId)
|
|
16907
|
+
return invalid();
|
|
16908
|
+
return { ok: true, value: source.data };
|
|
16909
|
+
} catch (error51) {
|
|
16910
|
+
return { ok: false, error: input.error(error51) };
|
|
16911
|
+
}
|
|
16912
|
+
}
|
|
16913
|
+
};
|
|
16914
|
+
}
|
|
16915
|
+
|
|
16916
|
+
// ../../harness-broker/dist/paths.js
|
|
16917
|
+
import os from "node:os";
|
|
16918
|
+
import path from "node:path";
|
|
16919
|
+
var HARNESS_BROKER_DESCRIPTOR_ENV = "CODEXHOST_CLAUDE_BROKER_DESCRIPTOR";
|
|
16920
|
+
var HARNESS_BROKER_DESCRIPTOR_FILE = "claude-code-broker-v1.json";
|
|
16921
|
+
function defaultHarnessBrokerDirectory(environment = process.env) {
|
|
16922
|
+
const home = environment.HOME || os.homedir();
|
|
16923
|
+
return path.join(home, ".codexhost", "harness-broker");
|
|
16924
|
+
}
|
|
16925
|
+
function defaultHarnessBrokerDescriptorPath(environment = process.env, harnessId = "claude-code") {
|
|
16926
|
+
harnessPluginIdSchema.parse(harnessId);
|
|
16927
|
+
if (harnessId !== "claude-code")
|
|
16928
|
+
return path.join(defaultHarnessBrokerDirectory(environment), `${harnessId}-broker-v1.json`);
|
|
16929
|
+
return environment[HARNESS_BROKER_DESCRIPTOR_ENV] ?? path.join(defaultHarnessBrokerDirectory(environment), HARNESS_BROKER_DESCRIPTOR_FILE);
|
|
16930
|
+
}
|
|
16931
|
+
function harnessBrokerLaunchAgentLabel(harnessId = "claude-code") {
|
|
16932
|
+
harnessPluginIdSchema.parse(harnessId);
|
|
16933
|
+
return harnessId === "claude-code" ? "ai.bytepioneer.codexhost.native-harness-broker" : `ai.bytepioneer.codexhost.${harnessId}-broker`;
|
|
16934
|
+
}
|
|
16935
|
+
function harnessBrokerLaunchAgentPlistPath(environment = process.env, harnessId = "claude-code") {
|
|
16936
|
+
const home = environment.HOME || os.homedir();
|
|
16937
|
+
return path.join(home, "Library", "LaunchAgents", `${harnessBrokerLaunchAgentLabel(harnessId)}.plist`);
|
|
16938
|
+
}
|
|
16939
|
+
|
|
16794
16940
|
// ../../harness-broker/dist/client.js
|
|
16795
16941
|
function unavailable(message, retryable = true) {
|
|
16796
16942
|
return { code: "unavailable", message, retryable, stage: "harnessBroker" };
|
|
@@ -17327,6 +17473,7 @@ var BrokeredHarnessAdapter = class {
|
|
|
17327
17473
|
commandCatalog;
|
|
17328
17474
|
liveCommandCatalog;
|
|
17329
17475
|
harnessId;
|
|
17476
|
+
sessionImport;
|
|
17330
17477
|
credits;
|
|
17331
17478
|
refreshCredits;
|
|
17332
17479
|
#descriptorPath;
|
|
@@ -17336,7 +17483,6 @@ var BrokeredHarnessAdapter = class {
|
|
|
17336
17483
|
#startTimeoutMs;
|
|
17337
17484
|
#connection = null;
|
|
17338
17485
|
#closed = false;
|
|
17339
|
-
#sessionImportListing = null;
|
|
17340
17486
|
#credits = null;
|
|
17341
17487
|
#creditsRefresh = null;
|
|
17342
17488
|
subagents = {
|
|
@@ -17348,86 +17494,16 @@ var BrokeredHarnessAdapter = class {
|
|
|
17348
17494
|
}
|
|
17349
17495
|
}
|
|
17350
17496
|
};
|
|
17351
|
-
sessionImport = Object.freeze({
|
|
17352
|
-
listCandidates: () => {
|
|
17353
|
-
this.#sessionImportListing ??= this.#listSessionImportCandidates().finally(() => {
|
|
17354
|
-
this.#sessionImportListing = null;
|
|
17355
|
-
});
|
|
17356
|
-
return this.#sessionImportListing;
|
|
17357
|
-
},
|
|
17358
|
-
resolveCandidate: async (nativeSessionId) => {
|
|
17359
|
-
if (this.#closed) {
|
|
17360
|
-
return {
|
|
17361
|
-
ok: false,
|
|
17362
|
-
error: unavailable("Claude Aqua broker adapter is closed", false)
|
|
17363
|
-
};
|
|
17364
|
-
}
|
|
17365
|
-
try {
|
|
17366
|
-
const result = parseHarnessResult(await (await this.#connect()).request("adapter.sessionImport.resolve", {
|
|
17367
|
-
nativeSessionId
|
|
17368
|
-
}));
|
|
17369
|
-
if (!result.ok)
|
|
17370
|
-
return result;
|
|
17371
|
-
const parsed = brokerSessionImportSourceSchema.safeParse(result.value);
|
|
17372
|
-
if (!parsed.success || parsed.data.candidate.nativeSessionId !== nativeSessionId) {
|
|
17373
|
-
return {
|
|
17374
|
-
ok: false,
|
|
17375
|
-
error: {
|
|
17376
|
-
...unavailable("Harness broker returned an invalid Session source", false),
|
|
17377
|
-
code: "protocolError"
|
|
17378
|
-
}
|
|
17379
|
-
};
|
|
17380
|
-
}
|
|
17381
|
-
return { ok: true, value: parsed.data };
|
|
17382
|
-
} catch (error51) {
|
|
17383
|
-
this.#connection = null;
|
|
17384
|
-
return {
|
|
17385
|
-
ok: false,
|
|
17386
|
-
error: unavailable(error51 instanceof Error ? error51.message : String(error51))
|
|
17387
|
-
};
|
|
17388
|
-
}
|
|
17389
|
-
}
|
|
17390
|
-
});
|
|
17391
|
-
async #listSessionImportCandidates() {
|
|
17392
|
-
if (this.#closed) {
|
|
17393
|
-
return {
|
|
17394
|
-
ok: false,
|
|
17395
|
-
error: unavailable("Claude Aqua broker adapter is closed", false)
|
|
17396
|
-
};
|
|
17397
|
-
}
|
|
17398
|
-
try {
|
|
17399
|
-
const candidates = [];
|
|
17400
|
-
for (; ; ) {
|
|
17401
|
-
const result = parseHarnessResult(await (await this.#connect()).request("adapter.sessionImport.list", {
|
|
17402
|
-
offset: candidates.length,
|
|
17403
|
-
limit: HARNESS_BROKER_SESSION_IMPORT_PAGE_SIZE
|
|
17404
|
-
}));
|
|
17405
|
-
if (!result.ok)
|
|
17406
|
-
return result;
|
|
17407
|
-
const parsed = brokerSessionImportPageSchema.safeParse(result.value);
|
|
17408
|
-
if (!parsed.success || parsed.data.total < candidates.length + parsed.data.candidates.length || parsed.data.candidates.length === 0 && candidates.length < parsed.data.total) {
|
|
17409
|
-
return {
|
|
17410
|
-
ok: false,
|
|
17411
|
-
error: {
|
|
17412
|
-
...unavailable("Harness broker returned invalid Session candidates", false),
|
|
17413
|
-
code: "protocolError"
|
|
17414
|
-
}
|
|
17415
|
-
};
|
|
17416
|
-
}
|
|
17417
|
-
candidates.push(...parsed.data.candidates);
|
|
17418
|
-
if (candidates.length === parsed.data.total)
|
|
17419
|
-
return { ok: true, value: candidates };
|
|
17420
|
-
}
|
|
17421
|
-
} catch (error51) {
|
|
17422
|
-
this.#connection = null;
|
|
17423
|
-
return {
|
|
17424
|
-
ok: false,
|
|
17425
|
-
error: unavailable(error51 instanceof Error ? error51.message : String(error51))
|
|
17426
|
-
};
|
|
17427
|
-
}
|
|
17428
|
-
}
|
|
17429
17497
|
constructor(input = {}) {
|
|
17430
17498
|
this.harnessId = harnessPluginIdSchema.parse(input.harnessId ?? "claude-code");
|
|
17499
|
+
if (input.sessionImport) {
|
|
17500
|
+
this.sessionImport = createBrokerSessionImportCapability({
|
|
17501
|
+
harnessId: this.harnessId,
|
|
17502
|
+
request: async (method, params) => parseHarnessResult(await this.#request(method, params, method === "adapter.sessionImport.resolve")),
|
|
17503
|
+
isClosed: () => this.#closed,
|
|
17504
|
+
error: (error51) => this.#error(error51)
|
|
17505
|
+
});
|
|
17506
|
+
}
|
|
17431
17507
|
if (input.accountCredits !== false) {
|
|
17432
17508
|
this.credits = () => this.#credits;
|
|
17433
17509
|
this.refreshCredits = () => this.#refreshAccountCredits();
|
|
@@ -18936,7 +19012,17 @@ function pendingNativeHistoryRewind(contents) {
|
|
|
18936
19012
|
const last = parseRows(contents).findLast((row) => row.type === "resend-fork-notice" || NATIVE_MESSAGE_TYPES.has(text(row.type)));
|
|
18937
19013
|
return last?.type === "resend-fork-notice" ? { forkPointId: text(last.parentId) || null } : void 0;
|
|
18938
19014
|
}
|
|
19015
|
+
function isNativeCompactionSummary(row) {
|
|
19016
|
+
const data = record2(row.providerData);
|
|
19017
|
+
return row.type === "message" && row.role === "user" && data.isCompactInternal === true;
|
|
19018
|
+
}
|
|
18939
19019
|
function nativeHistoryRows(contents) {
|
|
19020
|
+
return collectNativeHistoryRows(contents, false);
|
|
19021
|
+
}
|
|
19022
|
+
function nativeDisplayHistoryRows(contents) {
|
|
19023
|
+
return collectNativeHistoryRows(contents, true);
|
|
19024
|
+
}
|
|
19025
|
+
function collectNativeHistoryRows(contents, followCompactionParent) {
|
|
18940
19026
|
const entries = /* @__PURE__ */ new Map();
|
|
18941
19027
|
let leaf = "";
|
|
18942
19028
|
for (const row of parseRows(contents)) {
|
|
@@ -18961,10 +19047,16 @@ function nativeHistoryRows(contents) {
|
|
|
18961
19047
|
throw new CodeBuddyError("protocolError", "Native history parent is missing");
|
|
18962
19048
|
chain.push(row);
|
|
18963
19049
|
leaf = text(row.parentId);
|
|
19050
|
+
if (!leaf && followCompactionParent && isNativeCompactionSummary(row)) {
|
|
19051
|
+
const logicalParent = text(row.logicalParentId);
|
|
19052
|
+
if (logicalParent && !entries.has(logicalParent))
|
|
19053
|
+
throw new CodeBuddyError("protocolError", "Native compaction parent is missing");
|
|
19054
|
+
leaf = logicalParent;
|
|
19055
|
+
}
|
|
18964
19056
|
}
|
|
18965
19057
|
return chain.reverse();
|
|
18966
19058
|
}
|
|
18967
|
-
function snapshotFromHistory(contents, ref, cwd, profile = CODEBUDDY_RUNTIME_PROFILE) {
|
|
19059
|
+
function snapshotFromHistory(contents, ref, cwd, profile = CODEBUDDY_RUNTIME_PROFILE, options = {}) {
|
|
18968
19060
|
const supportsNativeCommands = nativeCommandsEnabled(profile);
|
|
18969
19061
|
const supportsFork = capabilitiesForProfile(profile).history.fork;
|
|
18970
19062
|
const turns = [];
|
|
@@ -18990,7 +19082,8 @@ function snapshotFromHistory(contents, ref, cwd, profile = CODEBUDDY_RUNTIME_PRO
|
|
|
18990
19082
|
snapshot.item.outputTruncated = Boolean(output.truncated);
|
|
18991
19083
|
}
|
|
18992
19084
|
};
|
|
18993
|
-
const
|
|
19085
|
+
const includeCompactionHistory = options.includeCompactionHistory !== false;
|
|
19086
|
+
const history = includeCompactionHistory ? nativeDisplayHistoryRows(contents) : nativeHistoryRows(contents);
|
|
18994
19087
|
const manualCompactions = /* @__PURE__ */ new Set();
|
|
18995
19088
|
let compactUser;
|
|
18996
19089
|
if (supportsNativeCommands)
|
|
@@ -19024,6 +19117,32 @@ function snapshotFromHistory(contents, ref, cwd, profile = CODEBUDDY_RUNTIME_PRO
|
|
|
19024
19117
|
continue;
|
|
19025
19118
|
if (supportsNativeCommands && row.type === "message" && row.role === "user" && data.agent === "compact" && !manualCompactions.has(text(row.id)))
|
|
19026
19119
|
continue;
|
|
19120
|
+
if (row.type === "message" && row.role === "user" && data.startsNewUserRequest === false && !localCommand && data.agent !== "compact" && !isNativeCompactionSummary(row)) {
|
|
19121
|
+
const contextOnly = body.trim().length > 0 && body.replace(/<system-reminder\b[^>]*\sdata-role=(["'])user-context\1[^>]*>[\s\S]*?<\/system-reminder>/gu, "").trim().length === 0;
|
|
19122
|
+
if (data.isMeta === true || contextOnly)
|
|
19123
|
+
continue;
|
|
19124
|
+
if (current) {
|
|
19125
|
+
if (body)
|
|
19126
|
+
current.input.push({ type: "text", text: body });
|
|
19127
|
+
continue;
|
|
19128
|
+
}
|
|
19129
|
+
}
|
|
19130
|
+
if (includeCompactionHistory && isNativeCompactionSummary(row)) {
|
|
19131
|
+
if (supportsNativeCommands && current) {
|
|
19132
|
+
const outcome = data.isCompacted === true ? { status: "succeeded" } : {
|
|
19133
|
+
status: "failed",
|
|
19134
|
+
error: nativeError(new CodeBuddyError("nativeFailure", "Native compaction did not complete"), profile)
|
|
19135
|
+
};
|
|
19136
|
+
current.items.push({
|
|
19137
|
+
item: {
|
|
19138
|
+
type: "contextCompaction",
|
|
19139
|
+
itemId: hostItemIdSchema.parse(`compact-${text(row.id)}`)
|
|
19140
|
+
},
|
|
19141
|
+
outcome
|
|
19142
|
+
});
|
|
19143
|
+
}
|
|
19144
|
+
continue;
|
|
19145
|
+
}
|
|
19027
19146
|
if (row.type === "message" && row.role === "user") {
|
|
19028
19147
|
current = {
|
|
19029
19148
|
nativeTurnRef: nativeTurnRefSchema.parse({
|
|
@@ -24371,7 +24490,9 @@ function commandCaveat(row) {
|
|
|
24371
24490
|
}
|
|
24372
24491
|
function retainedRowCount(input, contents, sourceCwd = input.cwd, profile = CODEBUDDY_RUNTIME_PROFILE) {
|
|
24373
24492
|
const rows2 = nativeHistoryRows(contents);
|
|
24374
|
-
const turns = snapshotFromHistory(contents, input.sourceRef, sourceCwd, profile
|
|
24493
|
+
const turns = snapshotFromHistory(contents, input.sourceRef, sourceCwd, profile, {
|
|
24494
|
+
includeCompactionHistory: false
|
|
24495
|
+
}).turns;
|
|
24375
24496
|
let excluded2;
|
|
24376
24497
|
if (input.kind === "rollbackLastTurn") {
|
|
24377
24498
|
if (!turns.length)
|
|
@@ -26976,6 +27097,7 @@ function createHarnessAdapter(context) {
|
|
|
26976
27097
|
...context.launchCommand ? { CODEXHOST_WORKBUDDY_COMMAND: context.launchCommand } : {}
|
|
26977
27098
|
};
|
|
26978
27099
|
return new BrokeredHarnessAdapter({
|
|
27100
|
+
sessionImport: true,
|
|
26979
27101
|
accountCredits: false,
|
|
26980
27102
|
harnessId: "workbuddy",
|
|
26981
27103
|
commandCatalog: WORKBUDDY_COMMAND_CATALOG,
|