@codexhost/cli-darwin-x64 0.13.3 → 0.15.0

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.
@@ -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
  }
@@ -15138,10 +15138,19 @@ var model = external_exports.string().min(1).max(512);
15138
15138
  var project = external_exports.string().min(1).max(4096);
15139
15139
  var usageStatisticsParamsSchema = external_exports.strictObject({
15140
15140
  range: external_exports.enum(USAGE_STATISTICS_RANGES),
15141
+ /** Display timezone for ranges, dates and hourly buckets; omitted means the Host's local zone. */
15142
+ timeZone: external_exports.string().min(1).max(128).refine((value) => {
15143
+ try {
15144
+ new Intl.DateTimeFormat("en", { timeZone: value });
15145
+ return true;
15146
+ } catch {
15147
+ return false;
15148
+ }
15149
+ }, "Unsupported usage statistics timezone").optional(),
15141
15150
  harness: harness.optional(),
15142
15151
  model: model.nullable().optional(),
15143
15152
  project: project.nullable().optional(),
15144
- /** One local date inside the range. */
15153
+ /** One date in the query timezone inside the range. */
15145
15154
  date: localDate.optional()
15146
15155
  });
15147
15156
  var usageStatisticsTotalsSchema = external_exports.strictObject({
@@ -15177,7 +15186,7 @@ var usageStatisticsSessionSchema = external_exports.strictObject({
15177
15186
  });
15178
15187
  var usageStatisticsResultSchema = external_exports.strictObject({
15179
15188
  range: external_exports.enum(USAGE_STATISTICS_RANGES),
15180
- /** First local date of the range; null for all time. */
15189
+ /** First date in the query timezone (Host local when omitted); null for all time. */
15181
15190
  from: localDate.nullable(),
15182
15191
  to: localDate,
15183
15192
  /** The filters these figures apply, echoed so a late answer to older filters is recognised. */
@@ -15217,7 +15226,7 @@ var usageStatisticsResultSchema = external_exports.strictObject({
15217
15226
  totals: usageStatisticsTotalsSchema,
15218
15227
  /** Each date and Harness of the range: every filter except the day. */
15219
15228
  daily: external_exports.array(external_exports.strictObject({ date: localDate, harness, ...totals })).max(2e5),
15220
- /** Local weekday (0 = Sunday) and hour, all filters applied. */
15229
+ /** Weekday (0 = Sunday) and hour in the query timezone, all filters applied. */
15221
15230
  hourly: external_exports.array(external_exports.strictObject({
15222
15231
  weekday: external_exports.number().int().min(0).max(6),
15223
15232
  hour: external_exports.number().int().min(0).max(23),
@@ -15257,6 +15266,51 @@ var hostInteractionIdSchema = opaqueIdSchema.brand();
15257
15266
  var threadPrewarmDiscardParamsSchema = external_exports.object({ threadId: hostThreadIdSchema });
15258
15267
  var threadPrewarmDiscardResultSchema = external_exports.object({ discarded: external_exports.boolean() });
15259
15268
 
15269
+ // ../../shared-contracts/dist/thread-questions.js
15270
+ var field = external_exports.discriminatedUnion("type", [
15271
+ external_exports.object({
15272
+ id: external_exports.string().min(1),
15273
+ type: external_exports.literal("choice"),
15274
+ prompt: external_exports.string(),
15275
+ options: external_exports.array(external_exports.object({
15276
+ value: external_exports.string().min(1),
15277
+ label: external_exports.string(),
15278
+ description: external_exports.string().optional()
15279
+ })).min(1),
15280
+ multiple: external_exports.boolean(),
15281
+ allowOther: external_exports.boolean(),
15282
+ optional: external_exports.boolean()
15283
+ }),
15284
+ external_exports.object({
15285
+ id: external_exports.string().min(1),
15286
+ type: external_exports.literal("text"),
15287
+ prompt: external_exports.string(),
15288
+ multiline: external_exports.boolean(),
15289
+ secret: external_exports.literal(false),
15290
+ optional: external_exports.boolean(),
15291
+ placeholder: external_exports.string().optional(),
15292
+ prefill: external_exports.string().optional()
15293
+ })
15294
+ ]);
15295
+ var threadQuestionSchema = external_exports.object({
15296
+ interactionId: external_exports.string().min(1),
15297
+ turnId: external_exports.string().min(1),
15298
+ title: external_exports.string().optional(),
15299
+ questions: external_exports.array(field).min(1)
15300
+ }).refine(({ questions }) => questions.some((q) => q.type === "choice" && q.multiple), {
15301
+ message: "Shared cards require at least one multi-select question"
15302
+ });
15303
+ var threadQuestionsListParamsSchema = external_exports.strictObject({ threadId: external_exports.string().min(1) });
15304
+ var threadQuestionsResultSchema = external_exports.object({ questions: external_exports.array(threadQuestionSchema) });
15305
+ var threadQuestionRespondParamsSchema = external_exports.strictObject({
15306
+ threadId: external_exports.string().min(1),
15307
+ turnId: external_exports.string().min(1),
15308
+ interactionId: external_exports.string().min(1),
15309
+ answers: external_exports.record(external_exports.string(), external_exports.array(external_exports.string())),
15310
+ cancelled: external_exports.boolean().default(false)
15311
+ });
15312
+ var threadQuestionRespondResultSchema = external_exports.object({ accepted: external_exports.literal(true) });
15313
+
15260
15314
  // ../../shared-contracts/dist/console.js
15261
15315
  var consoleAnnouncementSchema = external_exports.strictObject({
15262
15316
  title: external_exports.string().trim().min(1).max(200),
@@ -15277,6 +15331,8 @@ var CONSOLE_HOST_METHODS = Object.freeze([
15277
15331
  "codexhost/harness/display-settings/set",
15278
15332
  "codexhost/harness/inspect",
15279
15333
  "codexhost/harness/installation",
15334
+ "codexhost/harness/installation/start",
15335
+ "codexhost/harness/installation/status",
15280
15336
  "codexhost/harness/launch-settings/get",
15281
15337
  "codexhost/harness/launch-settings/set",
15282
15338
  "codexhost/harness/web-ui/open",
@@ -15352,7 +15408,18 @@ var threadManualCompactionStartedSchema = external_exports.strictObject({
15352
15408
  var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonnegative();
15353
15409
  var finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative();
15354
15410
  var cacheHitRatePercentSchema = external_exports.number().finite().min(0).max(100);
15411
+ var indicatorTextSchema = (maximum) => harnessLocalizedTextSchema.refine((entries) => Object.values(entries).every((text2) => text2.length <= maximum));
15412
+ var composerIndicatorsSchema = external_exports.array(external_exports.object({
15413
+ kind: external_exports.literal("countdown"),
15414
+ id: external_exports.string().min(1).max(64),
15415
+ expiresAtUnix: nonNegativeSafeIntegerSchema,
15416
+ label: indicatorTextSchema(256).optional(),
15417
+ tooltip: indicatorTextSchema(1024).optional()
15418
+ }).strict()).max(2).refine((entries) => new Set(entries.map(({ id }) => id)).size === entries.length, {
15419
+ message: "Composer indicator IDs must be unique"
15420
+ });
15355
15421
  var threadUsageSnapshotSchema = external_exports.object({
15422
+ composerIndicators: composerIndicatorsSchema.optional(),
15356
15423
  inputTokens: nonNegativeSafeIntegerSchema.optional(),
15357
15424
  cachedInputTokens: nonNegativeSafeIntegerSchema.optional(),
15358
15425
  cacheWriteInputTokens: nonNegativeSafeIntegerSchema.optional(),
@@ -15760,7 +15827,9 @@ var harnessSessionCapabilitiesSchema = external_exports.object({
15760
15827
  }).strict().optional(),
15761
15828
  autonomousTurns: external_exports.object({
15762
15829
  observe: external_exports.boolean()
15763
- }).strict().optional()
15830
+ }).strict().optional(),
15831
+ /** True only when `turn.steer` delivers input into the active Turn through a native primitive. */
15832
+ steer: external_exports.boolean().optional()
15764
15833
  }).strict();
15765
15834
  var harnessConfigurationStateSchema = external_exports.object({
15766
15835
  effectiveModel: harnessModelRefSchema.optional(),
@@ -15807,7 +15876,9 @@ var harnessInspectionSchema = external_exports.union([
15807
15876
  var harnessInspectParamsSchema = external_exports.object({
15808
15877
  harnessId: harnessIdSchema,
15809
15878
  cwd: nonBlankTextSchema2.max(16384).optional(),
15810
- refresh: external_exports.boolean().optional()
15879
+ refresh: external_exports.boolean().optional(),
15880
+ /** `availability` asks only whether the Harness can run; see `InspectHarnessInput.purpose`. */
15881
+ purpose: external_exports.literal("availability").optional()
15811
15882
  }).strict();
15812
15883
  var harnessWebUiOpenParamsSchema = external_exports.object({
15813
15884
  harnessId: harnessIdSchema
@@ -15890,6 +15961,15 @@ var threadOwnershipListResultSchema = external_exports.object({
15890
15961
  seen.add(thread.threadId);
15891
15962
  }
15892
15963
  });
15964
+ var threadSteeringInspectParamsSchema = external_exports.object({
15965
+ threadId: hostThreadIdSchema,
15966
+ /** The text about to be steered; a Harness command always stops and restarts. */
15967
+ text: external_exports.string().optional()
15968
+ }).strict();
15969
+ var threadSteerDeliverySchema = external_exports.enum(["activeTurn", "newTurn"]);
15970
+ var threadSteeringInspectResultSchema = external_exports.object({
15971
+ delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
15972
+ }).strict();
15893
15973
 
15894
15974
  // ../../shared-contracts/dist/harness-plugins.js
15895
15975
  var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
@@ -15991,6 +16071,10 @@ var harnessInstallationStateSchema = external_exports.object({
15991
16071
  latestVersion: external_exports.string().min(1).max(128),
15992
16072
  updateAvailable: external_exports.boolean(),
15993
16073
  canUpdate: external_exports.boolean(),
16074
+ /** Defaults to CLI; some Harnesses ship only inside a desktop application. */
16075
+ versionKind: external_exports.enum(["cli", "application"]).optional(),
16076
+ /** Official download opened by the user; does not imply an automatic installation. */
16077
+ manualUpdateUrl: external_exports.url().max(2048).refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Manual updates require a credential-free HTTPS URL").optional(),
15994
16078
  // Adapter-owned diagnostic text; UI uses messageCode rather than displaying it verbatim.
15995
16079
  message: external_exports.string().max(2048).optional(),
15996
16080
  messageCode: external_exports.string().min(1).max(128).optional(),
@@ -15998,6 +16082,20 @@ var harnessInstallationStateSchema = external_exports.object({
15998
16082
  notice: harnessLocalizedTextSchema.optional(),
15999
16083
  latestVersionKind: external_exports.enum(["unknown", "tracking-branch"]).optional()
16000
16084
  }).strict();
16085
+ var harnessInstallationTaskParamsSchema = external_exports.object({ taskId: external_exports.string().uuid() }).strict();
16086
+ var harnessInstallationTaskSchema = external_exports.discriminatedUnion("status", [
16087
+ external_exports.object({ taskId: external_exports.string().uuid(), status: external_exports.literal("running") }).strict(),
16088
+ external_exports.object({
16089
+ taskId: external_exports.string().uuid(),
16090
+ status: external_exports.literal("succeeded"),
16091
+ result: harnessInstallationStateSchema
16092
+ }).strict(),
16093
+ external_exports.object({
16094
+ taskId: external_exports.string().uuid(),
16095
+ status: external_exports.literal("failed"),
16096
+ error: external_exports.object({ code: external_exports.number().int(), message: external_exports.string().min(1).max(2048) }).strict()
16097
+ }).strict()
16098
+ ]);
16001
16099
 
16002
16100
  // ../../shared-contracts/dist/codex-accounts.js
16003
16101
  var accountIdSchema = external_exports.string().min(1).max(256).regex(/^[A-Za-z0-9._~-]+$/u);
@@ -16500,6 +16598,18 @@ function sanitizeDiagnosticTail(value) {
16500
16598
  return redacted.length <= DIAGNOSTIC_TAIL_MAX_LENGTH ? redacted : redacted.slice(-DIAGNOSTIC_TAIL_MAX_LENGTH);
16501
16599
  }
16502
16600
 
16601
+ // ../../harness-adapter/dist/steer.js
16602
+ function unsupportedSteer(harnessLabel) {
16603
+ return {
16604
+ ok: false,
16605
+ error: {
16606
+ code: "unsupported",
16607
+ message: `${harnessLabel} cannot steer an active Turn natively`,
16608
+ retryable: false
16609
+ }
16610
+ };
16611
+ }
16612
+
16503
16613
  // ../../harness-adapter/dist/usage.js
16504
16614
  var tokenFields = [
16505
16615
  "inputTokens",
@@ -16527,6 +16637,7 @@ var usageFields = /* @__PURE__ */ new Set([
16527
16637
  ...safeIntegerFields,
16528
16638
  ...percentFields,
16529
16639
  "sessionCacheUsage",
16640
+ "composerIndicators",
16530
16641
  "totalCostUsd",
16531
16642
  "totalCredits",
16532
16643
  "contextUsagePercent",
@@ -16549,26 +16660,27 @@ function parseHostUsage(value) {
16549
16660
  throw new Error(`Harness Usage contains unknown field '${key}'`);
16550
16661
  }
16551
16662
  }
16552
- for (const field of [
16663
+ const indicators = value.composerIndicators === void 0 ? {} : { composerIndicators: composerIndicatorsSchema.parse(value.composerIndicators) };
16664
+ for (const field2 of [
16553
16665
  "totalCredits",
16554
16666
  "contextUsagePercent",
16555
16667
  "apiOutputTokensPerSecond"
16556
16668
  ]) {
16557
- const candidate = value[field];
16669
+ const candidate = value[field2];
16558
16670
  if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isFinite(candidate) || candidate < 0)) {
16559
- throw new Error(`Harness Usage '${field}' must be a finite non-negative number`);
16671
+ throw new Error(`Harness Usage '${field2}' must be a finite non-negative number`);
16560
16672
  }
16561
16673
  }
16562
- for (const field of tokenFields) {
16563
- const candidate = value[field];
16674
+ for (const field2 of tokenFields) {
16675
+ const candidate = value[field2];
16564
16676
  if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isSafeInteger(candidate) || candidate < 0)) {
16565
- throw new Error(`Harness Usage '${field}' must be a non-negative safe integer`);
16677
+ throw new Error(`Harness Usage '${field2}' must be a non-negative safe integer`);
16566
16678
  }
16567
16679
  }
16568
- for (const field of safeIntegerFields) {
16569
- const candidate = value[field];
16680
+ for (const field2 of safeIntegerFields) {
16681
+ const candidate = value[field2];
16570
16682
  if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isSafeInteger(candidate) || candidate < 0)) {
16571
- throw new Error(`Harness Usage '${field}' must be a non-negative safe integer`);
16683
+ throw new Error(`Harness Usage '${field2}' must be a non-negative safe integer`);
16572
16684
  }
16573
16685
  }
16574
16686
  if (value.outputTokensPerSecond !== void 0 && (typeof value.outputTokensPerSecond !== "number" || !Number.isFinite(value.outputTokensPerSecond) || value.outputTokensPerSecond < 0)) {
@@ -16577,10 +16689,10 @@ function parseHostUsage(value) {
16577
16689
  if (value.totalCostUsd !== void 0 && (typeof value.totalCostUsd !== "number" || !Number.isFinite(value.totalCostUsd) || value.totalCostUsd < 0)) {
16578
16690
  throw new Error("Harness Usage 'totalCostUsd' must be a finite non-negative number");
16579
16691
  }
16580
- for (const field of percentFields) {
16581
- const candidate = value[field];
16692
+ for (const field2 of percentFields) {
16693
+ const candidate = value[field2];
16582
16694
  if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isFinite(candidate) || candidate < 0 || candidate > 100)) {
16583
- throw new Error(`Harness Usage '${field}' must be between 0 and 100`);
16695
+ throw new Error(`Harness Usage '${field2}' must be between 0 and 100`);
16584
16696
  }
16585
16697
  }
16586
16698
  if (value.sessionCacheUsage !== void 0) {
@@ -16619,9 +16731,9 @@ function parseHostUsage(value) {
16619
16731
  if (value.costSource !== "publicPrice") {
16620
16732
  throw new Error("Harness Usage 'unpricedModels' must be provided with a 'publicPrice' cost");
16621
16733
  }
16622
- return { ...value, unpricedModels: [...models] };
16734
+ return { ...value, ...indicators, unpricedModels: [...models] };
16623
16735
  }
16624
- return { ...value };
16736
+ return { ...value, ...indicators };
16625
16737
  }
16626
16738
  var requestTokenFields = [
16627
16739
  "inputTokens",
@@ -16651,19 +16763,19 @@ function parseHostUsageRequest(value) {
16651
16763
  if (typeof value.requestId !== "string" || value.requestId.length === 0) {
16652
16764
  throw new Error("Harness Usage request 'requestId' must be a non-empty string");
16653
16765
  }
16654
- for (const field of ["model", "provider"]) {
16655
- const candidate = value[field];
16766
+ for (const field2 of ["model", "provider"]) {
16767
+ const candidate = value[field2];
16656
16768
  if (candidate !== void 0 && (typeof candidate !== "string" || candidate.length === 0)) {
16657
- throw new Error(`Harness Usage request '${field}' must be a non-empty string`);
16769
+ throw new Error(`Harness Usage request '${field2}' must be a non-empty string`);
16658
16770
  }
16659
16771
  }
16660
16772
  if (value.historical !== void 0 && typeof value.historical !== "boolean") {
16661
16773
  throw new Error("Harness Usage request 'historical' must be a boolean");
16662
16774
  }
16663
- for (const field of requestTokenFields) {
16664
- const candidate = value[field];
16775
+ for (const field2 of requestTokenFields) {
16776
+ const candidate = value[field2];
16665
16777
  if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isSafeInteger(candidate) || candidate < 0)) {
16666
- throw new Error(`Harness Usage request '${field}' must be a non-negative safe integer`);
16778
+ throw new Error(`Harness Usage request '${field2}' must be a non-negative safe integer`);
16667
16779
  }
16668
16780
  }
16669
16781
  if (value.inputTokens === void 0 || value.outputTokens === void 0) {
@@ -16978,10 +17090,13 @@ function usageSessionTitle(value) {
16978
17090
  return void 0;
16979
17091
  if (normalized.length <= MAX_SESSION_TITLE_LENGTH)
16980
17092
  return normalized;
16981
- const characters = [...normalized];
16982
- if (characters.length <= MAX_SESSION_TITLE_LENGTH)
16983
- return normalized;
16984
- return `${characters.slice(0, MAX_SESSION_TITLE_LENGTH - 1).join("").trimEnd()}…`;
17093
+ let title = "";
17094
+ for (const character of normalized) {
17095
+ if (title.length + character.length >= MAX_SESSION_TITLE_LENGTH)
17096
+ break;
17097
+ title += character;
17098
+ }
17099
+ return `${title.trimEnd()}…`;
16985
17100
  }
16986
17101
  function sessionIdOk(value) {
16987
17102
  return typeof value === "string" && value.length > 0 && value.length <= MAX_SESSION_ID_LENGTH;
@@ -22631,9 +22746,23 @@ var ClientSideConnection = class {
22631
22746
 
22632
22747
  // dist/copy-cleanup.js
22633
22748
  import { randomBytes } from "node:crypto";
22749
+
22750
+ // dist/acp-stdio.js
22634
22751
  import { createInterface as createInterface2 } from "node:readline";
22635
- import { stripVTControlCharacters } from "node:util";
22636
22752
  import { Readable } from "node:stream";
22753
+ import { stripVTControlCharacters } from "node:util";
22754
+ function codeBuddyAcpOutput(stdout, onLine) {
22755
+ return Readable.from((async function* () {
22756
+ for await (const line of createInterface2({ input: stdout })) {
22757
+ onLine?.(stripVTControlCharacters(line));
22758
+ if (line.trimStart().startsWith("{"))
22759
+ yield Buffer.from(`${line}
22760
+ `);
22761
+ }
22762
+ })());
22763
+ }
22764
+
22765
+ // dist/copy-cleanup.js
22637
22766
  var CodeBuddyCopyCleanup = class {
22638
22767
  copyId;
22639
22768
  cwd;
@@ -22663,17 +22792,11 @@ var CodeBuddyCopyCleanup = class {
22663
22792
  }
22664
22793
  /** Native --serve banners include its password; never pass them to the ACP parser/logs. */
22665
22794
  protocolOutput(stdout) {
22666
- return Readable.from(this.#protocolLines(stdout));
22667
- }
22668
- async *#protocolLines(stdout) {
22669
- for await (const line of createInterface2({ input: stdout })) {
22670
- const endpoint = /^\s*Endpoint\s+(http:\/\/127\.0\.0\.1:\d+)\s*$/u.exec(stripVTControlCharacters(line));
22795
+ return codeBuddyAcpOutput(stdout, (line) => {
22796
+ const endpoint = /^\s*Endpoint\s+(http:\/\/127\.0\.0\.1:\d+)\s*$/u.exec(line);
22671
22797
  if (endpoint)
22672
22798
  this.#endpoint = endpoint[1];
22673
- if (line.trimStart().startsWith("{"))
22674
- yield Buffer.from(`${line}
22675
- `);
22676
- }
22799
+ });
22677
22800
  }
22678
22801
  async remove() {
22679
22802
  if (!this.#endpoint)
@@ -22753,7 +22876,7 @@ var CodeBuddyAcpClient = class {
22753
22876
  return { outcome: "cancelled" };
22754
22877
  return options.handlers.question(params);
22755
22878
  }
22756
- }), ndJsonStream2(Writable.toWeb(this.#child.stdin), Readable2.toWeb(this.#copyCleanup?.protocolOutput(this.#child.stdout) ?? this.#child.stdout)));
22879
+ }), ndJsonStream2(Writable.toWeb(this.#child.stdin), Readable2.toWeb(this.#copyCleanup?.protocolOutput(this.#child.stdout) ?? (invocation.arguments.includes("--serve") ? codeBuddyAcpOutput(this.#child.stdout) : this.#child.stdout))));
22757
22880
  void this.#connection.closed.then(() => {
22758
22881
  this.#fault(new CodeBuddyError("processExited", "ACP connection closed"));
22759
22882
  }).catch((error51) => {
@@ -24780,6 +24903,8 @@ var CodeBuddySession = class {
24780
24903
  async #execute(command, nativeCommand = false) {
24781
24904
  if (this.#closed || this.#fault)
24782
24905
  return failure("invalidState", "Session is closed or faulted", this.profile);
24906
+ if (command.type === "turn.steer")
24907
+ return unsupportedSteer(this.profile.displayName);
24783
24908
  if (command.type === "interaction.respond")
24784
24909
  return this.#interactions.respond(command);
24785
24910
  if (command.type === "turn.cancel") {
@@ -25184,6 +25309,7 @@ var HARNESS_BROKER_PROTOCOL_VERSION = 1;
25184
25309
  var HARNESS_BROKER_MAX_FRAME_BYTES = 8 * 1024 * 1024;
25185
25310
  var HARNESS_BROKER_MAX_PENDING_REQUESTS = 32;
25186
25311
  var HARNESS_BROKER_REQUEST_TIMEOUT_MS = 15e3;
25312
+ var HARNESS_BROKER_SESSION_IMPORT_PAGE_SIZE = 100;
25187
25313
  var HARNESS_BROKER_IDLE_TIMEOUT_MS = 60 * 60 * 1e3;
25188
25314
  var HARNESS_BROKER_RETIRING_ERROR_CODE = "brokerRetiring";
25189
25315
  var harnessBrokerMethodSchema = external_exports.enum([
@@ -25191,8 +25317,11 @@ var harnessBrokerMethodSchema = external_exports.enum([
25191
25317
  "adapter.inspectAccount",
25192
25318
  "adapter.credits",
25193
25319
  "adapter.open",
25320
+ "adapter.sessionImport.list",
25321
+ "adapter.sessionImport.resolve",
25194
25322
  "adapter.subagent.readSnapshot",
25195
25323
  "session.readSnapshot",
25324
+ "session.readCapabilities",
25196
25325
  "session.refreshUsage",
25197
25326
  "session.execute",
25198
25327
  "session.commands.list",
@@ -25292,30 +25421,6 @@ function consumeBrokerFrames(socket, onFrame, onError) {
25292
25421
  });
25293
25422
  }
25294
25423
 
25295
- // ../../harness-broker/dist/paths.js
25296
- import os2 from "node:os";
25297
- import path11 from "node:path";
25298
- var HARNESS_BROKER_DESCRIPTOR_ENV = "CODEXHOST_CLAUDE_BROKER_DESCRIPTOR";
25299
- var HARNESS_BROKER_DESCRIPTOR_FILE = "claude-code-broker-v1.json";
25300
- function defaultHarnessBrokerDirectory(environment = process.env) {
25301
- const home = environment.HOME || os2.homedir();
25302
- return path11.join(home, ".codexhost", "harness-broker");
25303
- }
25304
- function defaultHarnessBrokerDescriptorPath(environment = process.env, harnessId = "claude-code") {
25305
- harnessPluginIdSchema.parse(harnessId);
25306
- if (harnessId !== "claude-code")
25307
- return path11.join(defaultHarnessBrokerDirectory(environment), `${harnessId}-broker-v1.json`);
25308
- return environment[HARNESS_BROKER_DESCRIPTOR_ENV] ?? path11.join(defaultHarnessBrokerDirectory(environment), HARNESS_BROKER_DESCRIPTOR_FILE);
25309
- }
25310
- function harnessBrokerLaunchAgentLabel(harnessId = "claude-code") {
25311
- harnessPluginIdSchema.parse(harnessId);
25312
- return harnessId === "claude-code" ? "ai.bytepioneer.codexhost.native-harness-broker" : `ai.bytepioneer.codexhost.${harnessId}-broker`;
25313
- }
25314
- function harnessBrokerLaunchAgentPlistPath(environment = process.env, harnessId = "claude-code") {
25315
- const home = environment.HOME || os2.homedir();
25316
- return path11.join(home, "Library", "LaunchAgents", `${harnessBrokerLaunchAgentLabel(harnessId)}.plist`);
25317
- }
25318
-
25319
25424
  // ../../harness-broker/dist/validation.js
25320
25425
  var cwdSchema = external_exports.string().min(1).max(16384);
25321
25426
  var brokerEnvironmentSchema = external_exports.object({
@@ -25366,13 +25471,42 @@ var brokerOpenInputSchema = external_exports.discriminatedUnion("kind", [
25366
25471
  forkSchema,
25367
25472
  rollbackSchema
25368
25473
  ]);
25369
- var brokerInspectInputSchema = external_exports.object({ cwd: cwdSchema.optional(), refresh: external_exports.boolean().optional() }).strict();
25474
+ var brokerInspectInputSchema = external_exports.object({
25475
+ cwd: cwdSchema.optional(),
25476
+ refresh: external_exports.boolean().optional(),
25477
+ purpose: external_exports.literal("availability").optional()
25478
+ }).strict();
25479
+ var brokerSessionImportListParamsSchema = external_exports.object({
25480
+ offset: external_exports.number().int().nonnegative().safe(),
25481
+ limit: external_exports.number().int().min(1).max(HARNESS_BROKER_SESSION_IMPORT_PAGE_SIZE)
25482
+ }).strict();
25483
+ var brokerSessionImportResolveParamsSchema = external_exports.object({ nativeSessionId: harnessSessionImportIdSchema }).strict();
25484
+ var brokerSessionImportPageSchema = external_exports.object({
25485
+ candidates: external_exports.array(harnessSessionImportCandidateSchema).max(HARNESS_BROKER_SESSION_IMPORT_PAGE_SIZE),
25486
+ total: external_exports.number().int().nonnegative().safe()
25487
+ }).strict();
25488
+ var brokerSessionImportSourceSchema = external_exports.object({
25489
+ candidate: harnessSessionImportCandidateSchema,
25490
+ nativeRef: nativeSessionRefSchema
25491
+ }).strict().superRefine((source, context) => {
25492
+ if (source.nativeRef.nativeSessionId !== source.candidate.nativeSessionId) {
25493
+ context.addIssue({
25494
+ code: "custom",
25495
+ message: "Session import source identity does not match"
25496
+ });
25497
+ }
25498
+ });
25370
25499
  var textInputSchema = external_exports.object({ type: external_exports.literal("text"), text: external_exports.string().max(4e6) }).strict();
25371
25500
  var turnStartSchema = external_exports.object({
25372
25501
  type: external_exports.literal("turn.start"),
25373
25502
  turnId: hostTurnIdSchema,
25374
25503
  input: external_exports.array(textInputSchema)
25375
25504
  }).strict();
25505
+ var turnSteerSchema = external_exports.object({
25506
+ type: external_exports.literal("turn.steer"),
25507
+ turnId: hostTurnIdSchema,
25508
+ input: external_exports.array(textInputSchema)
25509
+ }).strict();
25376
25510
  var turnCancelSchema = external_exports.object({ type: external_exports.literal("turn.cancel"), turnId: hostTurnIdSchema }).strict();
25377
25511
  var interactionResponseSchema = external_exports.union([
25378
25512
  external_exports.object({
@@ -25398,6 +25532,7 @@ var permissionSelectSchema = external_exports.object({
25398
25532
  }).strict();
25399
25533
  var brokerHostCommandSchema = external_exports.discriminatedUnion("type", [
25400
25534
  turnStartSchema,
25535
+ turnSteerSchema,
25401
25536
  turnCancelSchema,
25402
25537
  interactionRespondSchema,
25403
25538
  modelSelectSchema,
@@ -25531,6 +25666,107 @@ var harnessOutputSchema = external_exports.custom((value) => {
25531
25666
  return false;
25532
25667
  });
25533
25668
 
25669
+ // ../../harness-broker/dist/session-import-client.js
25670
+ function createBrokerSessionImportCapability(input) {
25671
+ let listing = null;
25672
+ const closed = () => ({
25673
+ ok: false,
25674
+ error: { code: "invalidState", message: "Harness broker adapter is closed", retryable: false }
25675
+ });
25676
+ const invalid = () => ({
25677
+ ok: false,
25678
+ error: {
25679
+ code: "protocolError",
25680
+ message: "Harness broker returned invalid Session import metadata",
25681
+ retryable: false
25682
+ }
25683
+ });
25684
+ const list = async () => {
25685
+ try {
25686
+ const candidates = [];
25687
+ const identities = /* @__PURE__ */ new Set();
25688
+ let total;
25689
+ for (; ; ) {
25690
+ if (input.isClosed())
25691
+ return closed();
25692
+ const result = await input.request("adapter.sessionImport.list", {
25693
+ offset: candidates.length,
25694
+ limit: HARNESS_BROKER_SESSION_IMPORT_PAGE_SIZE
25695
+ });
25696
+ if (input.isClosed())
25697
+ return closed();
25698
+ if (!result.ok)
25699
+ return result;
25700
+ const page = brokerSessionImportPageSchema.safeParse(result.value);
25701
+ 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)
25702
+ return invalid();
25703
+ total = page.data.total;
25704
+ for (const candidate of page.data.candidates) {
25705
+ if (identities.has(candidate.nativeSessionId))
25706
+ return invalid();
25707
+ identities.add(candidate.nativeSessionId);
25708
+ candidates.push(candidate);
25709
+ }
25710
+ if (candidates.length === total)
25711
+ return { ok: true, value: candidates };
25712
+ }
25713
+ } catch (error51) {
25714
+ return { ok: false, error: input.error(error51) };
25715
+ }
25716
+ };
25717
+ return {
25718
+ listCandidates() {
25719
+ if (input.isClosed())
25720
+ return Promise.resolve(closed());
25721
+ listing ??= list().finally(() => {
25722
+ listing = null;
25723
+ });
25724
+ return listing;
25725
+ },
25726
+ async resolveCandidate(nativeSessionId) {
25727
+ if (input.isClosed())
25728
+ return closed();
25729
+ try {
25730
+ const result = await input.request("adapter.sessionImport.resolve", { nativeSessionId });
25731
+ if (input.isClosed())
25732
+ return closed();
25733
+ if (!result.ok)
25734
+ return result;
25735
+ const source = brokerSessionImportSourceSchema.safeParse(result.value);
25736
+ if (!source.success || source.data.nativeRef.harnessId !== input.harnessId || source.data.candidate.nativeSessionId !== nativeSessionId)
25737
+ return invalid();
25738
+ return { ok: true, value: source.data };
25739
+ } catch (error51) {
25740
+ return { ok: false, error: input.error(error51) };
25741
+ }
25742
+ }
25743
+ };
25744
+ }
25745
+
25746
+ // ../../harness-broker/dist/paths.js
25747
+ import os2 from "node:os";
25748
+ import path11 from "node:path";
25749
+ var HARNESS_BROKER_DESCRIPTOR_ENV = "CODEXHOST_CLAUDE_BROKER_DESCRIPTOR";
25750
+ var HARNESS_BROKER_DESCRIPTOR_FILE = "claude-code-broker-v1.json";
25751
+ function defaultHarnessBrokerDirectory(environment = process.env) {
25752
+ const home = environment.HOME || os2.homedir();
25753
+ return path11.join(home, ".codexhost", "harness-broker");
25754
+ }
25755
+ function defaultHarnessBrokerDescriptorPath(environment = process.env, harnessId = "claude-code") {
25756
+ harnessPluginIdSchema.parse(harnessId);
25757
+ if (harnessId !== "claude-code")
25758
+ return path11.join(defaultHarnessBrokerDirectory(environment), `${harnessId}-broker-v1.json`);
25759
+ return environment[HARNESS_BROKER_DESCRIPTOR_ENV] ?? path11.join(defaultHarnessBrokerDirectory(environment), HARNESS_BROKER_DESCRIPTOR_FILE);
25760
+ }
25761
+ function harnessBrokerLaunchAgentLabel(harnessId = "claude-code") {
25762
+ harnessPluginIdSchema.parse(harnessId);
25763
+ return harnessId === "claude-code" ? "ai.bytepioneer.codexhost.native-harness-broker" : `ai.bytepioneer.codexhost.${harnessId}-broker`;
25764
+ }
25765
+ function harnessBrokerLaunchAgentPlistPath(environment = process.env, harnessId = "claude-code") {
25766
+ const home = environment.HOME || os2.homedir();
25767
+ return path11.join(home, "Library", "LaunchAgents", `${harnessBrokerLaunchAgentLabel(harnessId)}.plist`);
25768
+ }
25769
+
25534
25770
  // ../../harness-broker/dist/client.js
25535
25771
  function unavailable(message, retryable = true) {
25536
25772
  return { code: "unavailable", message, retryable, stage: "harnessBroker" };
@@ -25590,6 +25826,7 @@ function parseSessionMetadata(value) {
25590
25826
  sessionId: candidate.sessionId,
25591
25827
  sessionGeneration: candidate.sessionGeneration,
25592
25828
  capabilities: harnessSessionCapabilitiesSchema.parse(candidate.capabilities),
25829
+ readCapabilities: candidate.readCapabilities === true,
25593
25830
  initialState: state,
25594
25831
  initialUsage: candidate.initialUsage === null ? null : parseHostUsage(candidate.initialUsage),
25595
25832
  commands: candidate.commands === true
@@ -25941,6 +26178,11 @@ var BrokeredHarnessSession = class {
25941
26178
  event: { type: "session.faulted", error: unavailable(error51.message) }
25942
26179
  });
25943
26180
  }
26181
+ async readCapabilities() {
26182
+ if (!this.#metadata.readCapabilities)
26183
+ return { ...this.capabilities, steer: false };
26184
+ return harnessSessionCapabilitiesSchema.parse(await this.#request("session.readCapabilities", {}));
26185
+ }
25944
26186
  async refreshUsage() {
25945
26187
  await this.#request("session.refreshUsage", {});
25946
26188
  }
@@ -25972,6 +26214,8 @@ var BrokeredHarnessSession = class {
25972
26214
  try {
25973
26215
  return parseHarnessResult(await this.#request("session.execute", { command }));
25974
26216
  } catch (error51) {
26217
+ if (command.type === "turn.steer")
26218
+ throw error51;
25975
26219
  return {
25976
26220
  ok: false,
25977
26221
  error: unavailable(error51 instanceof Error ? error51.message : String(error51))
@@ -26059,6 +26303,7 @@ var BrokeredHarnessAdapter = class {
26059
26303
  commandCatalog;
26060
26304
  liveCommandCatalog;
26061
26305
  harnessId;
26306
+ sessionImport;
26062
26307
  credits;
26063
26308
  refreshCredits;
26064
26309
  #descriptorPath;
@@ -26081,6 +26326,14 @@ var BrokeredHarnessAdapter = class {
26081
26326
  };
26082
26327
  constructor(input = {}) {
26083
26328
  this.harnessId = harnessPluginIdSchema.parse(input.harnessId ?? "claude-code");
26329
+ if (input.sessionImport) {
26330
+ this.sessionImport = createBrokerSessionImportCapability({
26331
+ harnessId: this.harnessId,
26332
+ request: async (method, params) => parseHarnessResult(await this.#request(method, params, method === "adapter.sessionImport.resolve")),
26333
+ isClosed: () => this.#closed,
26334
+ error: (error51) => this.#error(error51)
26335
+ });
26336
+ }
26084
26337
  if (input.accountCredits !== false) {
26085
26338
  this.credits = () => this.#credits;
26086
26339
  this.refreshCredits = () => this.#refreshAccountCredits();
@@ -26268,6 +26521,7 @@ function createHarnessAdapter(context) {
26268
26521
  if (context.platform === "darwin" && context.managedRemoteHost) {
26269
26522
  const environment2 = { ...context.environment };
26270
26523
  return new BrokeredHarnessAdapter({
26524
+ sessionImport: true,
26271
26525
  accountCredits: false,
26272
26526
  harnessId: "codebuddy",
26273
26527
  forwardDelegationEnvironment: true,