@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
@@ -3401,10 +3401,10 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
3401
3401
  const shape = def.shape;
3402
3402
  const propValues = {};
3403
3403
  for (const key in shape) {
3404
- const field = shape[key]._zod;
3405
- if (field.values) {
3404
+ const field2 = shape[key]._zod;
3405
+ if (field2.values) {
3406
3406
  propValues[key] ?? (propValues[key] = /* @__PURE__ */ new Set());
3407
- for (const v of field.values)
3407
+ for (const v of field2.values)
3408
3408
  propValues[key].add(v);
3409
3409
  }
3410
3410
  }
@@ -15044,6 +15044,8 @@ var usageStatisticsTotalsSchema = external_exports.strictObject({
15044
15044
  cachedInputTokens: count,
15045
15045
  cacheWriteInputTokens: count,
15046
15046
  cacheKnownInputTokens: count,
15047
+ cacheHitCachedInputTokens: count,
15048
+ cacheHitInputTokens: count,
15047
15049
  outputTokens: count,
15048
15050
  reasoningOutputTokens: count,
15049
15051
  /** USD at the public price, summed over the priced requests only. */
@@ -15151,6 +15153,51 @@ var hostInteractionIdSchema = opaqueIdSchema.brand();
15151
15153
  var threadPrewarmDiscardParamsSchema = external_exports.object({ threadId: hostThreadIdSchema });
15152
15154
  var threadPrewarmDiscardResultSchema = external_exports.object({ discarded: external_exports.boolean() });
15153
15155
 
15156
+ // ../../shared-contracts/dist/thread-questions.js
15157
+ var field = external_exports.discriminatedUnion("type", [
15158
+ external_exports.object({
15159
+ id: external_exports.string().min(1),
15160
+ type: external_exports.literal("choice"),
15161
+ prompt: external_exports.string(),
15162
+ options: external_exports.array(external_exports.object({
15163
+ value: external_exports.string().min(1),
15164
+ label: external_exports.string(),
15165
+ description: external_exports.string().optional()
15166
+ })).min(1),
15167
+ multiple: external_exports.boolean(),
15168
+ allowOther: external_exports.boolean(),
15169
+ optional: external_exports.boolean()
15170
+ }),
15171
+ external_exports.object({
15172
+ id: external_exports.string().min(1),
15173
+ type: external_exports.literal("text"),
15174
+ prompt: external_exports.string(),
15175
+ multiline: external_exports.boolean(),
15176
+ secret: external_exports.literal(false),
15177
+ optional: external_exports.boolean(),
15178
+ placeholder: external_exports.string().optional(),
15179
+ prefill: external_exports.string().optional()
15180
+ })
15181
+ ]);
15182
+ var threadQuestionSchema = external_exports.object({
15183
+ interactionId: external_exports.string().min(1),
15184
+ turnId: external_exports.string().min(1),
15185
+ title: external_exports.string().optional(),
15186
+ questions: external_exports.array(field).min(1)
15187
+ }).refine(({ questions }) => questions.some((q) => q.type === "choice" && q.multiple), {
15188
+ message: "Shared cards require at least one multi-select question"
15189
+ });
15190
+ var threadQuestionsListParamsSchema = external_exports.strictObject({ threadId: external_exports.string().min(1) });
15191
+ var threadQuestionsResultSchema = external_exports.object({ questions: external_exports.array(threadQuestionSchema) });
15192
+ var threadQuestionRespondParamsSchema = external_exports.strictObject({
15193
+ threadId: external_exports.string().min(1),
15194
+ turnId: external_exports.string().min(1),
15195
+ interactionId: external_exports.string().min(1),
15196
+ answers: external_exports.record(external_exports.string(), external_exports.array(external_exports.string())),
15197
+ cancelled: external_exports.boolean().default(false)
15198
+ });
15199
+ var threadQuestionRespondResultSchema = external_exports.object({ accepted: external_exports.literal(true) });
15200
+
15154
15201
  // ../../shared-contracts/dist/harness-plugins.js
15155
15202
  var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
15156
15203
  var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
@@ -15910,6 +15957,21 @@ var threadSteeringInspectParamsSchema = external_exports.object({
15910
15957
  /** The text about to be steered; a Harness command always stops and restarts. */
15911
15958
  text: external_exports.string().optional()
15912
15959
  }).strict();
15960
+ var threadSteeringContextSchema = external_exports.object({
15961
+ kind: external_exports.literal("application"),
15962
+ value: external_exports.string().transform((text, context) => {
15963
+ try {
15964
+ return JSON.parse(text);
15965
+ } catch {
15966
+ context.addIssue({ code: "custom", message: "Invalid steering context JSON" });
15967
+ return external_exports.NEVER;
15968
+ }
15969
+ }).pipe(external_exports.object({
15970
+ expectedTurnId: hostTurnIdSchema,
15971
+ clientUserMessageId: external_exports.string().min(1),
15972
+ delivery: external_exports.enum(["newTurn", "activeTurn"])
15973
+ }).strict())
15974
+ }).strict().transform((context) => context.value);
15913
15975
  var threadSteerDeliverySchema = external_exports.enum(["activeTurn", "newTurn"]);
15914
15976
  var threadSteeringInspectResultSchema = external_exports.object({
15915
15977
  delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
@@ -15920,7 +15982,10 @@ var harnessPluginRouteSchema = external_exports.object({
15920
15982
  harnessId: harnessPluginIdSchema,
15921
15983
  model: harnessModelRefSchema.optional(),
15922
15984
  thinkingOptionId: harnessThinkingOptionIdSchema.optional(),
15923
- permissionModeId: harnessPermissionModeIdSchema.optional()
15985
+ permissionModeId: harnessPermissionModeIdSchema.optional(),
15986
+ /** A draft prewarm create: stays unsubmitted until the user's first Turn.
15987
+ * Desktop forwards only the Model of a main-process prewarm to thread/start. */
15988
+ prewarm: external_exports.literal(true).optional()
15924
15989
  }).strict();
15925
15990
 
15926
15991
  // ../../shared-contracts/dist/harness-launch-settings.js
@@ -16548,26 +16613,26 @@ function parseHostUsage(value) {
16548
16613
  }
16549
16614
  }
16550
16615
  const indicators = value.composerIndicators === void 0 ? {} : { composerIndicators: composerIndicatorsSchema.parse(value.composerIndicators) };
16551
- for (const field of [
16616
+ for (const field2 of [
16552
16617
  "totalCredits",
16553
16618
  "contextUsagePercent",
16554
16619
  "apiOutputTokensPerSecond"
16555
16620
  ]) {
16556
- const candidate = value[field];
16621
+ const candidate = value[field2];
16557
16622
  if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isFinite(candidate) || candidate < 0)) {
16558
- throw new Error(`Harness Usage '${field}' must be a finite non-negative number`);
16623
+ throw new Error(`Harness Usage '${field2}' must be a finite non-negative number`);
16559
16624
  }
16560
16625
  }
16561
- for (const field of tokenFields) {
16562
- const candidate = value[field];
16626
+ for (const field2 of tokenFields) {
16627
+ const candidate = value[field2];
16563
16628
  if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isSafeInteger(candidate) || candidate < 0)) {
16564
- throw new Error(`Harness Usage '${field}' must be a non-negative safe integer`);
16629
+ throw new Error(`Harness Usage '${field2}' must be a non-negative safe integer`);
16565
16630
  }
16566
16631
  }
16567
- for (const field of safeIntegerFields) {
16568
- const candidate = value[field];
16632
+ for (const field2 of safeIntegerFields) {
16633
+ const candidate = value[field2];
16569
16634
  if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isSafeInteger(candidate) || candidate < 0)) {
16570
- throw new Error(`Harness Usage '${field}' must be a non-negative safe integer`);
16635
+ throw new Error(`Harness Usage '${field2}' must be a non-negative safe integer`);
16571
16636
  }
16572
16637
  }
16573
16638
  if (value.outputTokensPerSecond !== void 0 && (typeof value.outputTokensPerSecond !== "number" || !Number.isFinite(value.outputTokensPerSecond) || value.outputTokensPerSecond < 0)) {
@@ -16576,16 +16641,16 @@ function parseHostUsage(value) {
16576
16641
  if (value.totalCostUsd !== void 0 && (typeof value.totalCostUsd !== "number" || !Number.isFinite(value.totalCostUsd) || value.totalCostUsd < 0)) {
16577
16642
  throw new Error("Harness Usage 'totalCostUsd' must be a finite non-negative number");
16578
16643
  }
16579
- for (const field of ["totalCredits", "contextUsagePercent"]) {
16580
- const candidate = value[field];
16644
+ for (const field2 of ["totalCredits", "contextUsagePercent"]) {
16645
+ const candidate = value[field2];
16581
16646
  if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isFinite(candidate) || candidate < 0)) {
16582
- throw new Error(`Harness Usage '${field}' must be a finite non-negative number`);
16647
+ throw new Error(`Harness Usage '${field2}' must be a finite non-negative number`);
16583
16648
  }
16584
16649
  }
16585
- for (const field of percentFields) {
16586
- const candidate = value[field];
16650
+ for (const field2 of percentFields) {
16651
+ const candidate = value[field2];
16587
16652
  if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isFinite(candidate) || candidate < 0 || candidate > 100)) {
16588
- throw new Error(`Harness Usage '${field}' must be between 0 and 100`);
16653
+ throw new Error(`Harness Usage '${field2}' must be between 0 and 100`);
16589
16654
  }
16590
16655
  }
16591
16656
  if (value.sessionCacheUsage !== void 0) {
@@ -17045,6 +17110,16 @@ function cursorConfigDirectory(environment) {
17045
17110
  const home = environment.HOME ?? environment.USERPROFILE ?? os2.homedir();
17046
17111
  return environment.CURSOR_CONFIG_DIR?.trim() ? path6.resolve(environment.CURSOR_CONFIG_DIR) : environment.XDG_CONFIG_HOME?.trim() ? path6.resolve(environment.XDG_CONFIG_HOME, "cursor") : path6.join(home, ".cursor");
17047
17112
  }
17113
+ function cursorCliApprovalModeIsUnrestricted(environment, cwd = process.cwd()) {
17114
+ try {
17115
+ const home = (process.platform === "win32" ? environment.USERPROFILE : environment.HOME) ?? os2.userInfo().homedir;
17116
+ const directory = environment.CURSOR_CONFIG_DIR?.trim() ? environment.CURSOR_CONFIG_DIR : environment.XDG_CONFIG_HOME?.trim() ? path6.join(environment.XDG_CONFIG_HOME, "cursor") : path6.join(home, ".cursor");
17117
+ const raw = JSON.parse(readFileSync(path6.resolve(cwd, directory, "cli-config.json"), "utf8"));
17118
+ return !!raw && typeof raw === "object" && !Array.isArray(raw) && raw.approvalMode === "unrestricted";
17119
+ } catch {
17120
+ return false;
17121
+ }
17122
+ }
17048
17123
  function cursorSessionDirectory(sessionId, environment) {
17049
17124
  if (!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/iu.test(sessionId))
17050
17125
  throw new Error("Unsupported Cursor native session ID");
@@ -17072,8 +17147,8 @@ function protobufBytes(data) {
17072
17147
  const fields = /* @__PURE__ */ new Map();
17073
17148
  while (offset < data.length) {
17074
17149
  const tag = varint();
17075
- const field = Math.floor(tag / 8), wire = tag % 8;
17076
- if (!Number.isSafeInteger(tag) || field === 0)
17150
+ const field2 = Math.floor(tag / 8), wire = tag % 8;
17151
+ if (!Number.isSafeInteger(tag) || field2 === 0)
17077
17152
  throw new Error("Invalid Cursor native field");
17078
17153
  if (wire === 0) {
17079
17154
  varint();
@@ -17083,16 +17158,16 @@ function protobufBytes(data) {
17083
17158
  if (!Number.isSafeInteger(length) || length < 0 || offset + length > data.length)
17084
17159
  throw new Error("Unsupported Cursor native record");
17085
17160
  if (wire === 2) {
17086
- const values = fields.get(field) ?? [];
17161
+ const values = fields.get(field2) ?? [];
17087
17162
  values.push(Buffer.from(data.subarray(offset, offset + length)));
17088
- fields.set(field, values);
17163
+ fields.set(field2, values);
17089
17164
  }
17090
17165
  offset += length;
17091
17166
  }
17092
17167
  return fields;
17093
17168
  }
17094
- function one(fields, field) {
17095
- const values = fields.get(field);
17169
+ function one(fields, field2) {
17170
+ const values = fields.get(field2);
17096
17171
  if (values?.length !== 1 || !values[0])
17097
17172
  throw new Error("Cursor native history identity is missing or ambiguous");
17098
17173
  return values[0];
@@ -17141,7 +17216,8 @@ function readCursorNativeHistory(sessionId, cwd, environment, allowMissing = fal
17141
17216
  result.push({
17142
17217
  id,
17143
17218
  text: one(user, 1).toString("utf8"),
17144
- ...rewindRoot ? { rewindRoot } : {}
17219
+ ...rewindRoot ? { rewindRoot } : {},
17220
+ ...user.get(15)?.length ? { notification: true } : {}
17145
17221
  });
17146
17222
  }
17147
17223
  }
@@ -17415,12 +17491,17 @@ function cursorCatalog(info) {
17415
17491
  const native = cursorModels(info);
17416
17492
  const thinking = /* @__PURE__ */ new Map();
17417
17493
  const models = native.models.map((model2) => {
17418
- const config2 = model2.value === native.current ? info.configOptions : info.nativeModels?.find((entry) => entry.value === model2.value)?.configOptions;
17494
+ const live = model2.value === native.current;
17495
+ const config2 = live ? info.configOptions : info.nativeModels?.find((entry) => entry.value === model2.value)?.configOptions;
17419
17496
  const options = cursorThinking(config2);
17420
17497
  for (const { id, label } of options)
17421
17498
  thinking.set(id, { id, label });
17422
17499
  return {
17423
- ref: cursorConfiguredModelRef(model2.value, config2),
17500
+ // Only the live model's parameters reflect the user's Cursor settings. The parameterized
17501
+ // catalog reports Cursor's built-in defaults for every other model (for example
17502
+ // `fast=true`), so pinning them would override the user's remembered per-model parameters.
17503
+ // A bare Ref selects only the model and lets Cursor apply those parameters itself.
17504
+ ref: live ? cursorConfiguredModelRef(model2.value, config2) : cursorModelRef(model2.value),
17424
17505
  label: model2.name,
17425
17506
  supportedThinkingOptionIds: options.map(({ id }) => id)
17426
17507
  };
@@ -21719,7 +21800,8 @@ var CursorTransport = class {
21719
21800
  return this.#preparation ??= this.#prepare();
21720
21801
  }
21721
21802
  async #prepare() {
21722
- const invocation = cursorInvocation(this.options.environment, this.options.command, this.options.executionPolicy === "unattended-full-access" ? ["--force", "acp"] : ["acp"]);
21803
+ const useForce = this.options.executionPolicy === "unattended-full-access" || cursorCliApprovalModeIsUnrestricted(this.options.environment, this.options.cwd);
21804
+ const invocation = cursorInvocation(this.options.environment, this.options.command, useForce ? ["--force", "acp"] : ["acp"]);
21723
21805
  const child = spawn(invocation.command, invocation.arguments, {
21724
21806
  cwd: this.options.cwd,
21725
21807
  env: this.options.environment,
@@ -23808,19 +23890,22 @@ var CursorSession = class {
23808
23890
  const administrative = promptText.trim().toLowerCase() === "/copy-request-id";
23809
23891
  if (administrative && JSON.stringify(before) === JSON.stringify(after)) {
23810
23892
  } else {
23811
- if (added.length !== 1 || after.length !== before.length + 1 || before.some((turn, index) => after[index]?.id !== turn.id) || added[0]?.text !== promptText)
23893
+ const prompted = added.filter((turn) => !turn.notification);
23894
+ const own = prompted[0];
23895
+ if (!own || prompted.length !== 1 || after.length !== before.length + added.length || before.some((turn, index) => after[index]?.id !== turn.id) || own.text !== promptText)
23812
23896
  throw new Error("Cursor terminal has no unique, verified native turn identity");
23813
23897
  nativeTurnRef = nativeTurnRefSchema.parse({
23814
23898
  harnessId: "cursor-cli",
23815
23899
  nativeSessionId: this.transport.sessionId,
23816
- nativeTurnKey: added[0].id,
23900
+ nativeTurnKey: own.id,
23817
23901
  formatVersion: 1
23818
23902
  });
23819
23903
  this.#fresh = false;
23820
- if (outcome.status === "succeeded" && cursorForkAvailable())
23904
+ const ownIndex = after.findIndex((turn) => turn.id === own.id);
23905
+ if (outcome.status === "succeeded" && cursorForkAvailable() && (ownIndex === after.length - 1 || after[ownIndex + 1]?.rewindRoot))
23821
23906
  outcome = {
23822
23907
  ...outcome,
23823
- checkpoint: cursorCheckpoint(this.transport.sessionId, added[0].id)
23908
+ checkpoint: cursorCheckpoint(this.transport.sessionId, own.id)
23824
23909
  };
23825
23910
  }
23826
23911
  } catch (error51) {
@@ -23986,30 +24071,6 @@ function consumeBrokerFrames(socket, onFrame, onError) {
23986
24071
  });
23987
24072
  }
23988
24073
 
23989
- // ../../harness-broker/dist/paths.js
23990
- import os4 from "node:os";
23991
- import path10 from "node:path";
23992
- var HARNESS_BROKER_DESCRIPTOR_ENV = "CODEXHOST_CLAUDE_BROKER_DESCRIPTOR";
23993
- var HARNESS_BROKER_DESCRIPTOR_FILE = "claude-code-broker-v1.json";
23994
- function defaultHarnessBrokerDirectory(environment = process.env) {
23995
- const home = environment.HOME || os4.homedir();
23996
- return path10.join(home, ".codexhost", "harness-broker");
23997
- }
23998
- function defaultHarnessBrokerDescriptorPath(environment = process.env, harnessId = "claude-code") {
23999
- harnessPluginIdSchema.parse(harnessId);
24000
- if (harnessId !== "claude-code")
24001
- return path10.join(defaultHarnessBrokerDirectory(environment), `${harnessId}-broker-v1.json`);
24002
- return environment[HARNESS_BROKER_DESCRIPTOR_ENV] ?? path10.join(defaultHarnessBrokerDirectory(environment), HARNESS_BROKER_DESCRIPTOR_FILE);
24003
- }
24004
- function harnessBrokerLaunchAgentLabel(harnessId = "claude-code") {
24005
- harnessPluginIdSchema.parse(harnessId);
24006
- return harnessId === "claude-code" ? "ai.bytepioneer.codexhost.native-harness-broker" : `ai.bytepioneer.codexhost.${harnessId}-broker`;
24007
- }
24008
- function harnessBrokerLaunchAgentPlistPath(environment = process.env, harnessId = "claude-code") {
24009
- const home = environment.HOME || os4.homedir();
24010
- return path10.join(home, "Library", "LaunchAgents", `${harnessBrokerLaunchAgentLabel(harnessId)}.plist`);
24011
- }
24012
-
24013
24074
  // ../../harness-broker/dist/validation.js
24014
24075
  var cwdSchema = external_exports.string().min(1).max(16384);
24015
24076
  var brokerEnvironmentSchema = external_exports.object({
@@ -24060,7 +24121,11 @@ var brokerOpenInputSchema = external_exports.discriminatedUnion("kind", [
24060
24121
  forkSchema,
24061
24122
  rollbackSchema
24062
24123
  ]);
24063
- var brokerInspectInputSchema = external_exports.object({ cwd: cwdSchema.optional(), refresh: external_exports.boolean().optional() }).strict();
24124
+ var brokerInspectInputSchema = external_exports.object({
24125
+ cwd: cwdSchema.optional(),
24126
+ refresh: external_exports.boolean().optional(),
24127
+ purpose: external_exports.literal("availability").optional()
24128
+ }).strict();
24064
24129
  var brokerSessionImportListParamsSchema = external_exports.object({
24065
24130
  offset: external_exports.number().int().nonnegative().safe(),
24066
24131
  limit: external_exports.number().int().min(1).max(HARNESS_BROKER_SESSION_IMPORT_PAGE_SIZE)
@@ -24075,10 +24140,10 @@ var brokerSessionImportSourceSchema = external_exports.object({
24075
24140
  candidate: harnessSessionImportCandidateSchema,
24076
24141
  nativeRef: nativeSessionRefSchema
24077
24142
  }).strict().superRefine((source, context) => {
24078
- if (source.nativeRef.harnessId !== "claude-code" || source.nativeRef.nativeSessionId !== source.candidate.nativeSessionId) {
24143
+ if (source.nativeRef.nativeSessionId !== source.candidate.nativeSessionId) {
24079
24144
  context.addIssue({
24080
24145
  code: "custom",
24081
- message: "Claude Session import source identity does not match"
24146
+ message: "Session import source identity does not match"
24082
24147
  });
24083
24148
  }
24084
24149
  });
@@ -24252,6 +24317,107 @@ var harnessOutputSchema = external_exports.custom((value) => {
24252
24317
  return false;
24253
24318
  });
24254
24319
 
24320
+ // ../../harness-broker/dist/session-import-client.js
24321
+ function createBrokerSessionImportCapability(input) {
24322
+ let listing = null;
24323
+ const closed = () => ({
24324
+ ok: false,
24325
+ error: { code: "invalidState", message: "Harness broker adapter is closed", retryable: false }
24326
+ });
24327
+ const invalid = () => ({
24328
+ ok: false,
24329
+ error: {
24330
+ code: "protocolError",
24331
+ message: "Harness broker returned invalid Session import metadata",
24332
+ retryable: false
24333
+ }
24334
+ });
24335
+ const list = async () => {
24336
+ try {
24337
+ const candidates = [];
24338
+ const identities = /* @__PURE__ */ new Set();
24339
+ let total;
24340
+ for (; ; ) {
24341
+ if (input.isClosed())
24342
+ return closed();
24343
+ const result = await input.request("adapter.sessionImport.list", {
24344
+ offset: candidates.length,
24345
+ limit: HARNESS_BROKER_SESSION_IMPORT_PAGE_SIZE
24346
+ });
24347
+ if (input.isClosed())
24348
+ return closed();
24349
+ if (!result.ok)
24350
+ return result;
24351
+ const page = brokerSessionImportPageSchema.safeParse(result.value);
24352
+ 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)
24353
+ return invalid();
24354
+ total = page.data.total;
24355
+ for (const candidate of page.data.candidates) {
24356
+ if (identities.has(candidate.nativeSessionId))
24357
+ return invalid();
24358
+ identities.add(candidate.nativeSessionId);
24359
+ candidates.push(candidate);
24360
+ }
24361
+ if (candidates.length === total)
24362
+ return { ok: true, value: candidates };
24363
+ }
24364
+ } catch (error51) {
24365
+ return { ok: false, error: input.error(error51) };
24366
+ }
24367
+ };
24368
+ return {
24369
+ listCandidates() {
24370
+ if (input.isClosed())
24371
+ return Promise.resolve(closed());
24372
+ listing ??= list().finally(() => {
24373
+ listing = null;
24374
+ });
24375
+ return listing;
24376
+ },
24377
+ async resolveCandidate(nativeSessionId) {
24378
+ if (input.isClosed())
24379
+ return closed();
24380
+ try {
24381
+ const result = await input.request("adapter.sessionImport.resolve", { nativeSessionId });
24382
+ if (input.isClosed())
24383
+ return closed();
24384
+ if (!result.ok)
24385
+ return result;
24386
+ const source = brokerSessionImportSourceSchema.safeParse(result.value);
24387
+ if (!source.success || source.data.nativeRef.harnessId !== input.harnessId || source.data.candidate.nativeSessionId !== nativeSessionId)
24388
+ return invalid();
24389
+ return { ok: true, value: source.data };
24390
+ } catch (error51) {
24391
+ return { ok: false, error: input.error(error51) };
24392
+ }
24393
+ }
24394
+ };
24395
+ }
24396
+
24397
+ // ../../harness-broker/dist/paths.js
24398
+ import os4 from "node:os";
24399
+ import path10 from "node:path";
24400
+ var HARNESS_BROKER_DESCRIPTOR_ENV = "CODEXHOST_CLAUDE_BROKER_DESCRIPTOR";
24401
+ var HARNESS_BROKER_DESCRIPTOR_FILE = "claude-code-broker-v1.json";
24402
+ function defaultHarnessBrokerDirectory(environment = process.env) {
24403
+ const home = environment.HOME || os4.homedir();
24404
+ return path10.join(home, ".codexhost", "harness-broker");
24405
+ }
24406
+ function defaultHarnessBrokerDescriptorPath(environment = process.env, harnessId = "claude-code") {
24407
+ harnessPluginIdSchema.parse(harnessId);
24408
+ if (harnessId !== "claude-code")
24409
+ return path10.join(defaultHarnessBrokerDirectory(environment), `${harnessId}-broker-v1.json`);
24410
+ return environment[HARNESS_BROKER_DESCRIPTOR_ENV] ?? path10.join(defaultHarnessBrokerDirectory(environment), HARNESS_BROKER_DESCRIPTOR_FILE);
24411
+ }
24412
+ function harnessBrokerLaunchAgentLabel(harnessId = "claude-code") {
24413
+ harnessPluginIdSchema.parse(harnessId);
24414
+ return harnessId === "claude-code" ? "ai.bytepioneer.codexhost.native-harness-broker" : `ai.bytepioneer.codexhost.${harnessId}-broker`;
24415
+ }
24416
+ function harnessBrokerLaunchAgentPlistPath(environment = process.env, harnessId = "claude-code") {
24417
+ const home = environment.HOME || os4.homedir();
24418
+ return path10.join(home, "Library", "LaunchAgents", `${harnessBrokerLaunchAgentLabel(harnessId)}.plist`);
24419
+ }
24420
+
24255
24421
  // ../../harness-broker/dist/client.js
24256
24422
  function unavailable(message, retryable = true) {
24257
24423
  return { code: "unavailable", message, retryable, stage: "harnessBroker" };
@@ -24788,6 +24954,7 @@ var BrokeredHarnessAdapter = class {
24788
24954
  commandCatalog;
24789
24955
  liveCommandCatalog;
24790
24956
  harnessId;
24957
+ sessionImport;
24791
24958
  credits;
24792
24959
  refreshCredits;
24793
24960
  #descriptorPath;
@@ -24797,7 +24964,6 @@ var BrokeredHarnessAdapter = class {
24797
24964
  #startTimeoutMs;
24798
24965
  #connection = null;
24799
24966
  #closed = false;
24800
- #sessionImportListing = null;
24801
24967
  #credits = null;
24802
24968
  #creditsRefresh = null;
24803
24969
  subagents = {
@@ -24809,86 +24975,16 @@ var BrokeredHarnessAdapter = class {
24809
24975
  }
24810
24976
  }
24811
24977
  };
24812
- sessionImport = Object.freeze({
24813
- listCandidates: () => {
24814
- this.#sessionImportListing ??= this.#listSessionImportCandidates().finally(() => {
24815
- this.#sessionImportListing = null;
24816
- });
24817
- return this.#sessionImportListing;
24818
- },
24819
- resolveCandidate: async (nativeSessionId) => {
24820
- if (this.#closed) {
24821
- return {
24822
- ok: false,
24823
- error: unavailable("Claude Aqua broker adapter is closed", false)
24824
- };
24825
- }
24826
- try {
24827
- const result = parseHarnessResult(await (await this.#connect()).request("adapter.sessionImport.resolve", {
24828
- nativeSessionId
24829
- }));
24830
- if (!result.ok)
24831
- return result;
24832
- const parsed = brokerSessionImportSourceSchema.safeParse(result.value);
24833
- if (!parsed.success || parsed.data.candidate.nativeSessionId !== nativeSessionId) {
24834
- return {
24835
- ok: false,
24836
- error: {
24837
- ...unavailable("Harness broker returned an invalid Session source", false),
24838
- code: "protocolError"
24839
- }
24840
- };
24841
- }
24842
- return { ok: true, value: parsed.data };
24843
- } catch (error51) {
24844
- this.#connection = null;
24845
- return {
24846
- ok: false,
24847
- error: unavailable(error51 instanceof Error ? error51.message : String(error51))
24848
- };
24849
- }
24850
- }
24851
- });
24852
- async #listSessionImportCandidates() {
24853
- if (this.#closed) {
24854
- return {
24855
- ok: false,
24856
- error: unavailable("Claude Aqua broker adapter is closed", false)
24857
- };
24858
- }
24859
- try {
24860
- const candidates = [];
24861
- for (; ; ) {
24862
- const result = parseHarnessResult(await (await this.#connect()).request("adapter.sessionImport.list", {
24863
- offset: candidates.length,
24864
- limit: HARNESS_BROKER_SESSION_IMPORT_PAGE_SIZE
24865
- }));
24866
- if (!result.ok)
24867
- return result;
24868
- const parsed = brokerSessionImportPageSchema.safeParse(result.value);
24869
- if (!parsed.success || parsed.data.total < candidates.length + parsed.data.candidates.length || parsed.data.candidates.length === 0 && candidates.length < parsed.data.total) {
24870
- return {
24871
- ok: false,
24872
- error: {
24873
- ...unavailable("Harness broker returned invalid Session candidates", false),
24874
- code: "protocolError"
24875
- }
24876
- };
24877
- }
24878
- candidates.push(...parsed.data.candidates);
24879
- if (candidates.length === parsed.data.total)
24880
- return { ok: true, value: candidates };
24881
- }
24882
- } catch (error51) {
24883
- this.#connection = null;
24884
- return {
24885
- ok: false,
24886
- error: unavailable(error51 instanceof Error ? error51.message : String(error51))
24887
- };
24888
- }
24889
- }
24890
24978
  constructor(input = {}) {
24891
24979
  this.harnessId = harnessPluginIdSchema.parse(input.harnessId ?? "claude-code");
24980
+ if (input.sessionImport) {
24981
+ this.sessionImport = createBrokerSessionImportCapability({
24982
+ harnessId: this.harnessId,
24983
+ request: async (method, params) => parseHarnessResult(await this.#request(method, params, method === "adapter.sessionImport.resolve")),
24984
+ isClosed: () => this.#closed,
24985
+ error: (error51) => this.#error(error51)
24986
+ });
24987
+ }
24892
24988
  if (input.accountCredits !== false) {
24893
24989
  this.credits = () => this.#credits;
24894
24990
  this.refreshCredits = () => this.#refreshAccountCredits();
@@ -25076,6 +25172,7 @@ function createHarnessAdapter(context) {
25076
25172
  if (context.platform === "darwin" && context.managedRemoteHost) {
25077
25173
  const environment2 = { ...context.environment };
25078
25174
  return new BrokeredHarnessAdapter({
25175
+ sessionImport: true,
25079
25176
  accountCredits: false,
25080
25177
  harnessId: "cursor-cli",
25081
25178
  forwardDelegationEnvironment: true,