@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.
Files changed (39) hide show
  1. package/README.md +2 -2
  2. package/THIRD_PARTY_NOTICES.txt +6 -2
  3. package/app/codexhost-distribution.json +1 -1
  4. package/app/console-server.mjs +129 -28
  5. package/app/console-web.js +336 -78
  6. package/app/desktop-controller.mjs +1741 -60
  7. package/app/host-runtime.mjs +4983 -2002
  8. package/app/plugins/antigravity/plugin.mjs +423 -63
  9. package/app/plugins/claude-code/plugin.mjs +417 -264
  10. package/app/plugins/codebuddy/plugin.mjs +256 -134
  11. package/app/plugins/codex-usage/plugin.mjs +97 -32
  12. package/app/plugins/copilot/plugin.mjs +122 -57
  13. package/app/plugins/cursor-cli/plugin.mjs +236 -139
  14. package/app/plugins/deepseek-harness/plugin.mjs +584 -86
  15. package/app/plugins/devin/assets/icon.svg +1 -0
  16. package/app/plugins/devin/manifest.json +30 -0
  17. package/app/plugins/devin/plugin.mjs +23425 -0
  18. package/app/plugins/enabled.json +2 -0
  19. package/app/plugins/grok/plugin.mjs +839 -500
  20. package/app/plugins/hermes/plugin.mjs +522 -200
  21. package/app/plugins/kimi-code/plugin.mjs +134 -22
  22. package/app/plugins/kiro-cli/plugin.mjs +84 -19
  23. package/app/plugins/muse/plugin.mjs +74 -9
  24. package/app/plugins/omp/plugin.mjs +104 -39
  25. package/app/plugins/opencode/plugin.mjs +126 -61
  26. package/app/plugins/pi/plugin.mjs +1769 -468
  27. package/app/plugins/qoder/plugin.mjs +9617 -8682
  28. package/app/plugins/qoder-cn/plugin.mjs +9617 -8682
  29. package/app/plugins/qwen-code/assets/icon.svg +1 -0
  30. package/app/plugins/qwen-code/manifest.json +29 -0
  31. package/app/plugins/qwen-code/plugin.mjs +29366 -0
  32. package/app/plugins/workbuddy/plugin.mjs +256 -134
  33. package/app/plugins/zcode/plugin.mjs +265 -42
  34. package/app/renderer-extension.js +3286 -528
  35. package/bin/boft +0 -0
  36. package/libexec/boft-shim +0 -0
  37. package/libexec/boft-updater +0 -0
  38. package/licenses/Qwen-Code-SDK-LICENSE.txt +203 -0
  39. package/package.json +2 -2
@@ -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 field = shape[key]._zod;
3520
- if (field.values) {
3519
+ const field2 = shape[key]._zod;
3520
+ if (field2.values) {
3521
3521
  propValues[key] ?? (propValues[key] = /* @__PURE__ */ new Set());
3522
- for (const v of field.values)
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;
@@ -16025,6 +16072,21 @@ var threadSteeringInspectParamsSchema = external_exports.object({
16025
16072
  /** The text about to be steered; a Harness command always stops and restarts. */
16026
16073
  text: external_exports.string().optional()
16027
16074
  }).strict();
16075
+ var threadSteeringContextSchema = external_exports.object({
16076
+ kind: external_exports.literal("application"),
16077
+ value: external_exports.string().transform((text2, context) => {
16078
+ try {
16079
+ return JSON.parse(text2);
16080
+ } catch {
16081
+ context.addIssue({ code: "custom", message: "Invalid steering context JSON" });
16082
+ return external_exports.NEVER;
16083
+ }
16084
+ }).pipe(external_exports.object({
16085
+ expectedTurnId: hostTurnIdSchema,
16086
+ clientUserMessageId: external_exports.string().min(1),
16087
+ delivery: external_exports.enum(["newTurn", "activeTurn"])
16088
+ }).strict())
16089
+ }).strict().transform((context) => context.value);
16028
16090
  var threadSteerDeliverySchema = external_exports.enum(["activeTurn", "newTurn"]);
16029
16091
  var threadSteeringInspectResultSchema = external_exports.object({
16030
16092
  delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
@@ -16035,7 +16097,10 @@ var harnessPluginRouteSchema = external_exports.object({
16035
16097
  harnessId: harnessPluginIdSchema,
16036
16098
  model: harnessModelRefSchema.optional(),
16037
16099
  thinkingOptionId: harnessThinkingOptionIdSchema.optional(),
16038
- permissionModeId: harnessPermissionModeIdSchema.optional()
16100
+ permissionModeId: harnessPermissionModeIdSchema.optional(),
16101
+ /** A draft prewarm create: stays unsubmitted until the user's first Turn.
16102
+ * Desktop forwards only the Model of a main-process prewarm to thread/start. */
16103
+ prewarm: external_exports.literal(true).optional()
16039
16104
  }).strict();
16040
16105
 
16041
16106
  // ../../shared-contracts/dist/harness-launch-settings.js
@@ -16663,26 +16728,26 @@ function parseHostUsage(value) {
16663
16728
  }
16664
16729
  }
16665
16730
  const indicators = value.composerIndicators === void 0 ? {} : { composerIndicators: composerIndicatorsSchema.parse(value.composerIndicators) };
16666
- for (const field of [
16731
+ for (const field2 of [
16667
16732
  "totalCredits",
16668
16733
  "contextUsagePercent",
16669
16734
  "apiOutputTokensPerSecond"
16670
16735
  ]) {
16671
- const candidate = value[field];
16736
+ const candidate = value[field2];
16672
16737
  if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isFinite(candidate) || candidate < 0)) {
16673
- throw new Error(`Harness Usage '${field}' must be a finite non-negative number`);
16738
+ throw new Error(`Harness Usage '${field2}' must be a finite non-negative number`);
16674
16739
  }
16675
16740
  }
16676
- for (const field of tokenFields) {
16677
- const candidate = value[field];
16741
+ for (const field2 of tokenFields) {
16742
+ const candidate = value[field2];
16678
16743
  if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isSafeInteger(candidate) || candidate < 0)) {
16679
- throw new Error(`Harness Usage '${field}' must be a non-negative safe integer`);
16744
+ throw new Error(`Harness Usage '${field2}' must be a non-negative safe integer`);
16680
16745
  }
16681
16746
  }
16682
- for (const field of safeIntegerFields) {
16683
- const candidate = value[field];
16747
+ for (const field2 of safeIntegerFields) {
16748
+ const candidate = value[field2];
16684
16749
  if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isSafeInteger(candidate) || candidate < 0)) {
16685
- throw new Error(`Harness Usage '${field}' must be a non-negative safe integer`);
16750
+ throw new Error(`Harness Usage '${field2}' must be a non-negative safe integer`);
16686
16751
  }
16687
16752
  }
16688
16753
  if (value.outputTokensPerSecond !== void 0 && (typeof value.outputTokensPerSecond !== "number" || !Number.isFinite(value.outputTokensPerSecond) || value.outputTokensPerSecond < 0)) {
@@ -16691,16 +16756,16 @@ function parseHostUsage(value) {
16691
16756
  if (value.totalCostUsd !== void 0 && (typeof value.totalCostUsd !== "number" || !Number.isFinite(value.totalCostUsd) || value.totalCostUsd < 0)) {
16692
16757
  throw new Error("Harness Usage 'totalCostUsd' must be a finite non-negative number");
16693
16758
  }
16694
- for (const field of ["totalCredits", "contextUsagePercent"]) {
16695
- const candidate = value[field];
16759
+ for (const field2 of ["totalCredits", "contextUsagePercent"]) {
16760
+ const candidate = value[field2];
16696
16761
  if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isFinite(candidate) || candidate < 0)) {
16697
- throw new Error(`Harness Usage '${field}' must be a finite non-negative number`);
16762
+ throw new Error(`Harness Usage '${field2}' must be a finite non-negative number`);
16698
16763
  }
16699
16764
  }
16700
- for (const field of percentFields) {
16701
- const candidate = value[field];
16765
+ for (const field2 of percentFields) {
16766
+ const candidate = value[field2];
16702
16767
  if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isFinite(candidate) || candidate < 0 || candidate > 100)) {
16703
- throw new Error(`Harness Usage '${field}' must be between 0 and 100`);
16768
+ throw new Error(`Harness Usage '${field2}' must be between 0 and 100`);
16704
16769
  }
16705
16770
  }
16706
16771
  if (value.sessionCacheUsage !== void 0) {
@@ -16771,19 +16836,19 @@ function parseHostUsageRequest(value) {
16771
16836
  if (typeof value.requestId !== "string" || value.requestId.length === 0) {
16772
16837
  throw new Error("Harness Usage request 'requestId' must be a non-empty string");
16773
16838
  }
16774
- for (const field of ["model", "provider"]) {
16775
- const candidate = value[field];
16839
+ for (const field2 of ["model", "provider"]) {
16840
+ const candidate = value[field2];
16776
16841
  if (candidate !== void 0 && (typeof candidate !== "string" || candidate.length === 0)) {
16777
- throw new Error(`Harness Usage request '${field}' must be a non-empty string`);
16842
+ throw new Error(`Harness Usage request '${field2}' must be a non-empty string`);
16778
16843
  }
16779
16844
  }
16780
16845
  if (value.historical !== void 0 && typeof value.historical !== "boolean") {
16781
16846
  throw new Error("Harness Usage request 'historical' must be a boolean");
16782
16847
  }
16783
- for (const field of requestTokenFields) {
16784
- const candidate = value[field];
16848
+ for (const field2 of requestTokenFields) {
16849
+ const candidate = value[field2];
16785
16850
  if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isSafeInteger(candidate) || candidate < 0)) {
16786
- throw new Error(`Harness Usage request '${field}' must be a non-negative safe integer`);
16851
+ throw new Error(`Harness Usage request '${field2}' must be a non-negative safe integer`);
16787
16852
  }
16788
16853
  }
16789
16854
  if (value.inputTokens === void 0 || value.outputTokens === void 0) {
@@ -18248,7 +18313,17 @@ function pendingNativeHistoryRewind(contents) {
18248
18313
  const last = parseRows(contents).findLast((row) => row.type === "resend-fork-notice" || NATIVE_MESSAGE_TYPES.has(text(row.type)));
18249
18314
  return last?.type === "resend-fork-notice" ? { forkPointId: text(last.parentId) || null } : void 0;
18250
18315
  }
18316
+ function isNativeCompactionSummary(row) {
18317
+ const data = record2(row.providerData);
18318
+ return row.type === "message" && row.role === "user" && data.isCompactInternal === true;
18319
+ }
18251
18320
  function nativeHistoryRows(contents) {
18321
+ return collectNativeHistoryRows(contents, false);
18322
+ }
18323
+ function nativeDisplayHistoryRows(contents) {
18324
+ return collectNativeHistoryRows(contents, true);
18325
+ }
18326
+ function collectNativeHistoryRows(contents, followCompactionParent) {
18252
18327
  const entries = /* @__PURE__ */ new Map();
18253
18328
  let leaf = "";
18254
18329
  for (const row of parseRows(contents)) {
@@ -18273,10 +18348,16 @@ function nativeHistoryRows(contents) {
18273
18348
  throw new CodeBuddyError("protocolError", "Native history parent is missing");
18274
18349
  chain.push(row);
18275
18350
  leaf = text(row.parentId);
18351
+ if (!leaf && followCompactionParent && isNativeCompactionSummary(row)) {
18352
+ const logicalParent = text(row.logicalParentId);
18353
+ if (logicalParent && !entries.has(logicalParent))
18354
+ throw new CodeBuddyError("protocolError", "Native compaction parent is missing");
18355
+ leaf = logicalParent;
18356
+ }
18276
18357
  }
18277
18358
  return chain.reverse();
18278
18359
  }
18279
- function snapshotFromHistory(contents, ref, cwd, profile = CODEBUDDY_RUNTIME_PROFILE) {
18360
+ function snapshotFromHistory(contents, ref, cwd, profile = CODEBUDDY_RUNTIME_PROFILE, options = {}) {
18280
18361
  const supportsNativeCommands = nativeCommandsEnabled(profile);
18281
18362
  const supportsFork = capabilitiesForProfile(profile).history.fork;
18282
18363
  const turns = [];
@@ -18302,7 +18383,8 @@ function snapshotFromHistory(contents, ref, cwd, profile = CODEBUDDY_RUNTIME_PRO
18302
18383
  snapshot.item.outputTruncated = Boolean(output.truncated);
18303
18384
  }
18304
18385
  };
18305
- const history = nativeHistoryRows(contents);
18386
+ const includeCompactionHistory = options.includeCompactionHistory !== false;
18387
+ const history = includeCompactionHistory ? nativeDisplayHistoryRows(contents) : nativeHistoryRows(contents);
18306
18388
  const manualCompactions = /* @__PURE__ */ new Set();
18307
18389
  let compactUser;
18308
18390
  if (supportsNativeCommands)
@@ -18336,6 +18418,32 @@ function snapshotFromHistory(contents, ref, cwd, profile = CODEBUDDY_RUNTIME_PRO
18336
18418
  continue;
18337
18419
  if (supportsNativeCommands && row.type === "message" && row.role === "user" && data.agent === "compact" && !manualCompactions.has(text(row.id)))
18338
18420
  continue;
18421
+ if (row.type === "message" && row.role === "user" && data.startsNewUserRequest === false && !localCommand && data.agent !== "compact" && !isNativeCompactionSummary(row)) {
18422
+ const contextOnly = body.trim().length > 0 && body.replace(/<system-reminder\b[^>]*\sdata-role=(["'])user-context\1[^>]*>[\s\S]*?<\/system-reminder>/gu, "").trim().length === 0;
18423
+ if (data.isMeta === true || contextOnly)
18424
+ continue;
18425
+ if (current) {
18426
+ if (body)
18427
+ current.input.push({ type: "text", text: body });
18428
+ continue;
18429
+ }
18430
+ }
18431
+ if (includeCompactionHistory && isNativeCompactionSummary(row)) {
18432
+ if (supportsNativeCommands && current) {
18433
+ const outcome = data.isCompacted === true ? { status: "succeeded" } : {
18434
+ status: "failed",
18435
+ error: nativeError(new CodeBuddyError("nativeFailure", "Native compaction did not complete"), profile)
18436
+ };
18437
+ current.items.push({
18438
+ item: {
18439
+ type: "contextCompaction",
18440
+ itemId: hostItemIdSchema.parse(`compact-${text(row.id)}`)
18441
+ },
18442
+ outcome
18443
+ });
18444
+ }
18445
+ continue;
18446
+ }
18339
18447
  if (row.type === "message" && row.role === "user") {
18340
18448
  current = {
18341
18449
  nativeTurnRef: nativeTurnRefSchema.parse({
@@ -23317,7 +23425,9 @@ function commandCaveat(row) {
23317
23425
  }
23318
23426
  function retainedRowCount(input, contents, sourceCwd = input.cwd, profile = CODEBUDDY_RUNTIME_PROFILE) {
23319
23427
  const rows2 = nativeHistoryRows(contents);
23320
- const turns = snapshotFromHistory(contents, input.sourceRef, sourceCwd, profile).turns;
23428
+ const turns = snapshotFromHistory(contents, input.sourceRef, sourceCwd, profile, {
23429
+ includeCompactionHistory: false
23430
+ }).turns;
23321
23431
  let excluded2;
23322
23432
  if (input.kind === "rollbackLastTurn") {
23323
23433
  if (!turns.length)
@@ -25430,30 +25540,6 @@ function consumeBrokerFrames(socket, onFrame, onError) {
25430
25540
  });
25431
25541
  }
25432
25542
 
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
25543
  // ../../harness-broker/dist/validation.js
25458
25544
  var cwdSchema = external_exports.string().min(1).max(16384);
25459
25545
  var brokerEnvironmentSchema = external_exports.object({
@@ -25504,7 +25590,11 @@ var brokerOpenInputSchema = external_exports.discriminatedUnion("kind", [
25504
25590
  forkSchema,
25505
25591
  rollbackSchema
25506
25592
  ]);
25507
- var brokerInspectInputSchema = external_exports.object({ cwd: cwdSchema.optional(), refresh: external_exports.boolean().optional() }).strict();
25593
+ var brokerInspectInputSchema = external_exports.object({
25594
+ cwd: cwdSchema.optional(),
25595
+ refresh: external_exports.boolean().optional(),
25596
+ purpose: external_exports.literal("availability").optional()
25597
+ }).strict();
25508
25598
  var brokerSessionImportListParamsSchema = external_exports.object({
25509
25599
  offset: external_exports.number().int().nonnegative().safe(),
25510
25600
  limit: external_exports.number().int().min(1).max(HARNESS_BROKER_SESSION_IMPORT_PAGE_SIZE)
@@ -25519,10 +25609,10 @@ var brokerSessionImportSourceSchema = external_exports.object({
25519
25609
  candidate: harnessSessionImportCandidateSchema,
25520
25610
  nativeRef: nativeSessionRefSchema
25521
25611
  }).strict().superRefine((source, context) => {
25522
- if (source.nativeRef.harnessId !== "claude-code" || source.nativeRef.nativeSessionId !== source.candidate.nativeSessionId) {
25612
+ if (source.nativeRef.nativeSessionId !== source.candidate.nativeSessionId) {
25523
25613
  context.addIssue({
25524
25614
  code: "custom",
25525
- message: "Claude Session import source identity does not match"
25615
+ message: "Session import source identity does not match"
25526
25616
  });
25527
25617
  }
25528
25618
  });
@@ -25696,6 +25786,107 @@ var harnessOutputSchema = external_exports.custom((value) => {
25696
25786
  return false;
25697
25787
  });
25698
25788
 
25789
+ // ../../harness-broker/dist/session-import-client.js
25790
+ function createBrokerSessionImportCapability(input) {
25791
+ let listing = null;
25792
+ const closed = () => ({
25793
+ ok: false,
25794
+ error: { code: "invalidState", message: "Harness broker adapter is closed", retryable: false }
25795
+ });
25796
+ const invalid = () => ({
25797
+ ok: false,
25798
+ error: {
25799
+ code: "protocolError",
25800
+ message: "Harness broker returned invalid Session import metadata",
25801
+ retryable: false
25802
+ }
25803
+ });
25804
+ const list = async () => {
25805
+ try {
25806
+ const candidates = [];
25807
+ const identities = /* @__PURE__ */ new Set();
25808
+ let total;
25809
+ for (; ; ) {
25810
+ if (input.isClosed())
25811
+ return closed();
25812
+ const result = await input.request("adapter.sessionImport.list", {
25813
+ offset: candidates.length,
25814
+ limit: HARNESS_BROKER_SESSION_IMPORT_PAGE_SIZE
25815
+ });
25816
+ if (input.isClosed())
25817
+ return closed();
25818
+ if (!result.ok)
25819
+ return result;
25820
+ const page = brokerSessionImportPageSchema.safeParse(result.value);
25821
+ 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)
25822
+ return invalid();
25823
+ total = page.data.total;
25824
+ for (const candidate of page.data.candidates) {
25825
+ if (identities.has(candidate.nativeSessionId))
25826
+ return invalid();
25827
+ identities.add(candidate.nativeSessionId);
25828
+ candidates.push(candidate);
25829
+ }
25830
+ if (candidates.length === total)
25831
+ return { ok: true, value: candidates };
25832
+ }
25833
+ } catch (error51) {
25834
+ return { ok: false, error: input.error(error51) };
25835
+ }
25836
+ };
25837
+ return {
25838
+ listCandidates() {
25839
+ if (input.isClosed())
25840
+ return Promise.resolve(closed());
25841
+ listing ??= list().finally(() => {
25842
+ listing = null;
25843
+ });
25844
+ return listing;
25845
+ },
25846
+ async resolveCandidate(nativeSessionId) {
25847
+ if (input.isClosed())
25848
+ return closed();
25849
+ try {
25850
+ const result = await input.request("adapter.sessionImport.resolve", { nativeSessionId });
25851
+ if (input.isClosed())
25852
+ return closed();
25853
+ if (!result.ok)
25854
+ return result;
25855
+ const source = brokerSessionImportSourceSchema.safeParse(result.value);
25856
+ if (!source.success || source.data.nativeRef.harnessId !== input.harnessId || source.data.candidate.nativeSessionId !== nativeSessionId)
25857
+ return invalid();
25858
+ return { ok: true, value: source.data };
25859
+ } catch (error51) {
25860
+ return { ok: false, error: input.error(error51) };
25861
+ }
25862
+ }
25863
+ };
25864
+ }
25865
+
25866
+ // ../../harness-broker/dist/paths.js
25867
+ import os2 from "node:os";
25868
+ import path11 from "node:path";
25869
+ var HARNESS_BROKER_DESCRIPTOR_ENV = "CODEXHOST_CLAUDE_BROKER_DESCRIPTOR";
25870
+ var HARNESS_BROKER_DESCRIPTOR_FILE = "claude-code-broker-v1.json";
25871
+ function defaultHarnessBrokerDirectory(environment = process.env) {
25872
+ const home = environment.HOME || os2.homedir();
25873
+ return path11.join(home, ".codexhost", "harness-broker");
25874
+ }
25875
+ function defaultHarnessBrokerDescriptorPath(environment = process.env, harnessId = "claude-code") {
25876
+ harnessPluginIdSchema.parse(harnessId);
25877
+ if (harnessId !== "claude-code")
25878
+ return path11.join(defaultHarnessBrokerDirectory(environment), `${harnessId}-broker-v1.json`);
25879
+ return environment[HARNESS_BROKER_DESCRIPTOR_ENV] ?? path11.join(defaultHarnessBrokerDirectory(environment), HARNESS_BROKER_DESCRIPTOR_FILE);
25880
+ }
25881
+ function harnessBrokerLaunchAgentLabel(harnessId = "claude-code") {
25882
+ harnessPluginIdSchema.parse(harnessId);
25883
+ return harnessId === "claude-code" ? "ai.bytepioneer.codexhost.native-harness-broker" : `ai.bytepioneer.codexhost.${harnessId}-broker`;
25884
+ }
25885
+ function harnessBrokerLaunchAgentPlistPath(environment = process.env, harnessId = "claude-code") {
25886
+ const home = environment.HOME || os2.homedir();
25887
+ return path11.join(home, "Library", "LaunchAgents", `${harnessBrokerLaunchAgentLabel(harnessId)}.plist`);
25888
+ }
25889
+
25699
25890
  // ../../harness-broker/dist/client.js
25700
25891
  function unavailable(message, retryable = true) {
25701
25892
  return { code: "unavailable", message, retryable, stage: "harnessBroker" };
@@ -26232,6 +26423,7 @@ var BrokeredHarnessAdapter = class {
26232
26423
  commandCatalog;
26233
26424
  liveCommandCatalog;
26234
26425
  harnessId;
26426
+ sessionImport;
26235
26427
  credits;
26236
26428
  refreshCredits;
26237
26429
  #descriptorPath;
@@ -26241,7 +26433,6 @@ var BrokeredHarnessAdapter = class {
26241
26433
  #startTimeoutMs;
26242
26434
  #connection = null;
26243
26435
  #closed = false;
26244
- #sessionImportListing = null;
26245
26436
  #credits = null;
26246
26437
  #creditsRefresh = null;
26247
26438
  subagents = {
@@ -26253,86 +26444,16 @@ var BrokeredHarnessAdapter = class {
26253
26444
  }
26254
26445
  }
26255
26446
  };
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
26447
  constructor(input = {}) {
26335
26448
  this.harnessId = harnessPluginIdSchema.parse(input.harnessId ?? "claude-code");
26449
+ if (input.sessionImport) {
26450
+ this.sessionImport = createBrokerSessionImportCapability({
26451
+ harnessId: this.harnessId,
26452
+ request: async (method, params) => parseHarnessResult(await this.#request(method, params, method === "adapter.sessionImport.resolve")),
26453
+ isClosed: () => this.#closed,
26454
+ error: (error51) => this.#error(error51)
26455
+ });
26456
+ }
26336
26457
  if (input.accountCredits !== false) {
26337
26458
  this.credits = () => this.#credits;
26338
26459
  this.refreshCredits = () => this.#refreshAccountCredits();
@@ -26520,6 +26641,7 @@ function createHarnessAdapter(context) {
26520
26641
  if (context.platform === "darwin" && context.managedRemoteHost) {
26521
26642
  const environment2 = { ...context.environment };
26522
26643
  return new BrokeredHarnessAdapter({
26644
+ sessionImport: true,
26523
26645
  accountCredits: false,
26524
26646
  harnessId: "codebuddy",
26525
26647
  forwardDelegationEnvironment: true,