@liberseek/boft-cli-win32-arm64 0.8.4 → 0.8.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3040,10 +3040,10 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
3040
3040
  const shape = def.shape;
3041
3041
  const propValues = {};
3042
3042
  for (const key in shape) {
3043
- const field = shape[key]._zod;
3044
- if (field.values) {
3043
+ const field2 = shape[key]._zod;
3044
+ if (field2.values) {
3045
3045
  propValues[key] ?? (propValues[key] = /* @__PURE__ */ new Set());
3046
- for (const v of field.values)
3046
+ for (const v of field2.values)
3047
3047
  propValues[key].add(v);
3048
3048
  }
3049
3049
  }
@@ -14683,6 +14683,8 @@ var usageStatisticsTotalsSchema = external_exports.strictObject({
14683
14683
  cachedInputTokens: count,
14684
14684
  cacheWriteInputTokens: count,
14685
14685
  cacheKnownInputTokens: count,
14686
+ cacheHitCachedInputTokens: count,
14687
+ cacheHitInputTokens: count,
14686
14688
  outputTokens: count,
14687
14689
  reasoningOutputTokens: count,
14688
14690
  /** USD at the public price, summed over the priced requests only. */
@@ -14790,6 +14792,51 @@ var hostInteractionIdSchema = opaqueIdSchema.brand();
14790
14792
  var threadPrewarmDiscardParamsSchema = external_exports.object({ threadId: hostThreadIdSchema });
14791
14793
  var threadPrewarmDiscardResultSchema = external_exports.object({ discarded: external_exports.boolean() });
14792
14794
 
14795
+ // ../../shared-contracts/dist/thread-questions.js
14796
+ var field = external_exports.discriminatedUnion("type", [
14797
+ external_exports.object({
14798
+ id: external_exports.string().min(1),
14799
+ type: external_exports.literal("choice"),
14800
+ prompt: external_exports.string(),
14801
+ options: external_exports.array(external_exports.object({
14802
+ value: external_exports.string().min(1),
14803
+ label: external_exports.string(),
14804
+ description: external_exports.string().optional()
14805
+ })).min(1),
14806
+ multiple: external_exports.boolean(),
14807
+ allowOther: external_exports.boolean(),
14808
+ optional: external_exports.boolean()
14809
+ }),
14810
+ external_exports.object({
14811
+ id: external_exports.string().min(1),
14812
+ type: external_exports.literal("text"),
14813
+ prompt: external_exports.string(),
14814
+ multiline: external_exports.boolean(),
14815
+ secret: external_exports.literal(false),
14816
+ optional: external_exports.boolean(),
14817
+ placeholder: external_exports.string().optional(),
14818
+ prefill: external_exports.string().optional()
14819
+ })
14820
+ ]);
14821
+ var threadQuestionSchema = external_exports.object({
14822
+ interactionId: external_exports.string().min(1),
14823
+ turnId: external_exports.string().min(1),
14824
+ title: external_exports.string().optional(),
14825
+ questions: external_exports.array(field).min(1)
14826
+ }).refine(({ questions }) => questions.some((q) => q.type === "choice" && q.multiple), {
14827
+ message: "Shared cards require at least one multi-select question"
14828
+ });
14829
+ var threadQuestionsListParamsSchema = external_exports.strictObject({ threadId: external_exports.string().min(1) });
14830
+ var threadQuestionsResultSchema = external_exports.object({ questions: external_exports.array(threadQuestionSchema) });
14831
+ var threadQuestionRespondParamsSchema = external_exports.strictObject({
14832
+ threadId: external_exports.string().min(1),
14833
+ turnId: external_exports.string().min(1),
14834
+ interactionId: external_exports.string().min(1),
14835
+ answers: external_exports.record(external_exports.string(), external_exports.array(external_exports.string())),
14836
+ cancelled: external_exports.boolean().default(false)
14837
+ });
14838
+ var threadQuestionRespondResultSchema = external_exports.object({ accepted: external_exports.literal(true) });
14839
+
14793
14840
  // ../../shared-contracts/dist/harness-plugins.js
14794
14841
  var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
14795
14842
  var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
@@ -15559,7 +15606,10 @@ var harnessPluginRouteSchema = external_exports.object({
15559
15606
  harnessId: harnessPluginIdSchema,
15560
15607
  model: harnessModelRefSchema.optional(),
15561
15608
  thinkingOptionId: harnessThinkingOptionIdSchema.optional(),
15562
- permissionModeId: harnessPermissionModeIdSchema.optional()
15609
+ permissionModeId: harnessPermissionModeIdSchema.optional(),
15610
+ /** A draft prewarm create: stays unsubmitted until the user's first Turn.
15611
+ * Desktop forwards only the Model of a main-process prewarm to thread/start. */
15612
+ prewarm: external_exports.literal(true).optional()
15563
15613
  }).strict();
15564
15614
 
15565
15615
  // ../../shared-contracts/dist/harness-launch-settings.js
@@ -16187,26 +16237,26 @@ function parseHostUsage(value) {
16187
16237
  }
16188
16238
  }
16189
16239
  const indicators = value.composerIndicators === void 0 ? {} : { composerIndicators: composerIndicatorsSchema.parse(value.composerIndicators) };
16190
- for (const field of [
16240
+ for (const field2 of [
16191
16241
  "totalCredits",
16192
16242
  "contextUsagePercent",
16193
16243
  "apiOutputTokensPerSecond"
16194
16244
  ]) {
16195
- const candidate = value[field];
16245
+ const candidate = value[field2];
16196
16246
  if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isFinite(candidate) || candidate < 0)) {
16197
- throw new Error(`Harness Usage '${field}' must be a finite non-negative number`);
16247
+ throw new Error(`Harness Usage '${field2}' must be a finite non-negative number`);
16198
16248
  }
16199
16249
  }
16200
- for (const field of tokenFields) {
16201
- const candidate = value[field];
16250
+ for (const field2 of tokenFields) {
16251
+ const candidate = value[field2];
16202
16252
  if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isSafeInteger(candidate) || candidate < 0)) {
16203
- throw new Error(`Harness Usage '${field}' must be a non-negative safe integer`);
16253
+ throw new Error(`Harness Usage '${field2}' must be a non-negative safe integer`);
16204
16254
  }
16205
16255
  }
16206
- for (const field of safeIntegerFields) {
16207
- const candidate = value[field];
16256
+ for (const field2 of safeIntegerFields) {
16257
+ const candidate = value[field2];
16208
16258
  if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isSafeInteger(candidate) || candidate < 0)) {
16209
- throw new Error(`Harness Usage '${field}' must be a non-negative safe integer`);
16259
+ throw new Error(`Harness Usage '${field2}' must be a non-negative safe integer`);
16210
16260
  }
16211
16261
  }
16212
16262
  if (value.outputTokensPerSecond !== void 0 && (typeof value.outputTokensPerSecond !== "number" || !Number.isFinite(value.outputTokensPerSecond) || value.outputTokensPerSecond < 0)) {
@@ -16215,16 +16265,16 @@ function parseHostUsage(value) {
16215
16265
  if (value.totalCostUsd !== void 0 && (typeof value.totalCostUsd !== "number" || !Number.isFinite(value.totalCostUsd) || value.totalCostUsd < 0)) {
16216
16266
  throw new Error("Harness Usage 'totalCostUsd' must be a finite non-negative number");
16217
16267
  }
16218
- for (const field of ["totalCredits", "contextUsagePercent"]) {
16219
- const candidate = value[field];
16268
+ for (const field2 of ["totalCredits", "contextUsagePercent"]) {
16269
+ const candidate = value[field2];
16220
16270
  if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isFinite(candidate) || candidate < 0)) {
16221
- throw new Error(`Harness Usage '${field}' must be a finite non-negative number`);
16271
+ throw new Error(`Harness Usage '${field2}' must be a finite non-negative number`);
16222
16272
  }
16223
16273
  }
16224
- for (const field of percentFields) {
16225
- const candidate = value[field];
16274
+ for (const field2 of percentFields) {
16275
+ const candidate = value[field2];
16226
16276
  if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isFinite(candidate) || candidate < 0 || candidate > 100)) {
16227
- throw new Error(`Harness Usage '${field}' must be between 0 and 100`);
16277
+ throw new Error(`Harness Usage '${field2}' must be between 0 and 100`);
16228
16278
  }
16229
16279
  }
16230
16280
  if (value.sessionCacheUsage !== void 0) {
@@ -16295,19 +16345,19 @@ function parseHostUsageRequest(value) {
16295
16345
  if (typeof value.requestId !== "string" || value.requestId.length === 0) {
16296
16346
  throw new Error("Harness Usage request 'requestId' must be a non-empty string");
16297
16347
  }
16298
- for (const field of ["model", "provider"]) {
16299
- const candidate = value[field];
16348
+ for (const field2 of ["model", "provider"]) {
16349
+ const candidate = value[field2];
16300
16350
  if (candidate !== void 0 && (typeof candidate !== "string" || candidate.length === 0)) {
16301
- throw new Error(`Harness Usage request '${field}' must be a non-empty string`);
16351
+ throw new Error(`Harness Usage request '${field2}' must be a non-empty string`);
16302
16352
  }
16303
16353
  }
16304
16354
  if (value.historical !== void 0 && typeof value.historical !== "boolean") {
16305
16355
  throw new Error("Harness Usage request 'historical' must be a boolean");
16306
16356
  }
16307
- for (const field of requestTokenFields) {
16308
- const candidate = value[field];
16357
+ for (const field2 of requestTokenFields) {
16358
+ const candidate = value[field2];
16309
16359
  if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isSafeInteger(candidate) || candidate < 0)) {
16310
- throw new Error(`Harness Usage request '${field}' must be a non-negative safe integer`);
16360
+ throw new Error(`Harness Usage request '${field2}' must be a non-negative safe integer`);
16311
16361
  }
16312
16362
  }
16313
16363
  if (value.inputTokens === void 0 || value.outputTokens === void 0) {
@@ -16525,30 +16575,6 @@ function consumeBrokerFrames(socket, onFrame, onError) {
16525
16575
  });
16526
16576
  }
16527
16577
 
16528
- // ../../harness-broker/dist/paths.js
16529
- import os from "node:os";
16530
- import path from "node:path";
16531
- var HARNESS_BROKER_DESCRIPTOR_ENV = "CODEXHOST_CLAUDE_BROKER_DESCRIPTOR";
16532
- var HARNESS_BROKER_DESCRIPTOR_FILE = "claude-code-broker-v1.json";
16533
- function defaultHarnessBrokerDirectory(environment = process.env) {
16534
- const home = environment.HOME || os.homedir();
16535
- return path.join(home, ".codexhost", "harness-broker");
16536
- }
16537
- function defaultHarnessBrokerDescriptorPath(environment = process.env, harnessId = "claude-code") {
16538
- harnessPluginIdSchema.parse(harnessId);
16539
- if (harnessId !== "claude-code")
16540
- return path.join(defaultHarnessBrokerDirectory(environment), `${harnessId}-broker-v1.json`);
16541
- return environment[HARNESS_BROKER_DESCRIPTOR_ENV] ?? path.join(defaultHarnessBrokerDirectory(environment), HARNESS_BROKER_DESCRIPTOR_FILE);
16542
- }
16543
- function harnessBrokerLaunchAgentLabel(harnessId = "claude-code") {
16544
- harnessPluginIdSchema.parse(harnessId);
16545
- return harnessId === "claude-code" ? "ai.bytepioneer.codexhost.native-harness-broker" : `ai.bytepioneer.codexhost.${harnessId}-broker`;
16546
- }
16547
- function harnessBrokerLaunchAgentPlistPath(environment = process.env, harnessId = "claude-code") {
16548
- const home = environment.HOME || os.homedir();
16549
- return path.join(home, "Library", "LaunchAgents", `${harnessBrokerLaunchAgentLabel(harnessId)}.plist`);
16550
- }
16551
-
16552
16578
  // ../../harness-broker/dist/validation.js
16553
16579
  var cwdSchema = external_exports.string().min(1).max(16384);
16554
16580
  var brokerEnvironmentSchema = external_exports.object({
@@ -16599,7 +16625,11 @@ var brokerOpenInputSchema = external_exports.discriminatedUnion("kind", [
16599
16625
  forkSchema,
16600
16626
  rollbackSchema
16601
16627
  ]);
16602
- var brokerInspectInputSchema = external_exports.object({ cwd: cwdSchema.optional(), refresh: external_exports.boolean().optional() }).strict();
16628
+ var brokerInspectInputSchema = external_exports.object({
16629
+ cwd: cwdSchema.optional(),
16630
+ refresh: external_exports.boolean().optional(),
16631
+ purpose: external_exports.literal("availability").optional()
16632
+ }).strict();
16603
16633
  var brokerSessionImportListParamsSchema = external_exports.object({
16604
16634
  offset: external_exports.number().int().nonnegative().safe(),
16605
16635
  limit: external_exports.number().int().min(1).max(HARNESS_BROKER_SESSION_IMPORT_PAGE_SIZE)
@@ -16614,10 +16644,10 @@ var brokerSessionImportSourceSchema = external_exports.object({
16614
16644
  candidate: harnessSessionImportCandidateSchema,
16615
16645
  nativeRef: nativeSessionRefSchema
16616
16646
  }).strict().superRefine((source, context) => {
16617
- if (source.nativeRef.harnessId !== "claude-code" || source.nativeRef.nativeSessionId !== source.candidate.nativeSessionId) {
16647
+ if (source.nativeRef.nativeSessionId !== source.candidate.nativeSessionId) {
16618
16648
  context.addIssue({
16619
16649
  code: "custom",
16620
- message: "Claude Session import source identity does not match"
16650
+ message: "Session import source identity does not match"
16621
16651
  });
16622
16652
  }
16623
16653
  });
@@ -16791,6 +16821,107 @@ var harnessOutputSchema = external_exports.custom((value) => {
16791
16821
  return false;
16792
16822
  });
16793
16823
 
16824
+ // ../../harness-broker/dist/session-import-client.js
16825
+ function createBrokerSessionImportCapability(input) {
16826
+ let listing = null;
16827
+ const closed = () => ({
16828
+ ok: false,
16829
+ error: { code: "invalidState", message: "Harness broker adapter is closed", retryable: false }
16830
+ });
16831
+ const invalid = () => ({
16832
+ ok: false,
16833
+ error: {
16834
+ code: "protocolError",
16835
+ message: "Harness broker returned invalid Session import metadata",
16836
+ retryable: false
16837
+ }
16838
+ });
16839
+ const list = async () => {
16840
+ try {
16841
+ const candidates = [];
16842
+ const identities = /* @__PURE__ */ new Set();
16843
+ let total;
16844
+ for (; ; ) {
16845
+ if (input.isClosed())
16846
+ return closed();
16847
+ const result = await input.request("adapter.sessionImport.list", {
16848
+ offset: candidates.length,
16849
+ limit: HARNESS_BROKER_SESSION_IMPORT_PAGE_SIZE
16850
+ });
16851
+ if (input.isClosed())
16852
+ return closed();
16853
+ if (!result.ok)
16854
+ return result;
16855
+ const page = brokerSessionImportPageSchema.safeParse(result.value);
16856
+ 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)
16857
+ return invalid();
16858
+ total = page.data.total;
16859
+ for (const candidate of page.data.candidates) {
16860
+ if (identities.has(candidate.nativeSessionId))
16861
+ return invalid();
16862
+ identities.add(candidate.nativeSessionId);
16863
+ candidates.push(candidate);
16864
+ }
16865
+ if (candidates.length === total)
16866
+ return { ok: true, value: candidates };
16867
+ }
16868
+ } catch (error51) {
16869
+ return { ok: false, error: input.error(error51) };
16870
+ }
16871
+ };
16872
+ return {
16873
+ listCandidates() {
16874
+ if (input.isClosed())
16875
+ return Promise.resolve(closed());
16876
+ listing ??= list().finally(() => {
16877
+ listing = null;
16878
+ });
16879
+ return listing;
16880
+ },
16881
+ async resolveCandidate(nativeSessionId) {
16882
+ if (input.isClosed())
16883
+ return closed();
16884
+ try {
16885
+ const result = await input.request("adapter.sessionImport.resolve", { nativeSessionId });
16886
+ if (input.isClosed())
16887
+ return closed();
16888
+ if (!result.ok)
16889
+ return result;
16890
+ const source = brokerSessionImportSourceSchema.safeParse(result.value);
16891
+ if (!source.success || source.data.nativeRef.harnessId !== input.harnessId || source.data.candidate.nativeSessionId !== nativeSessionId)
16892
+ return invalid();
16893
+ return { ok: true, value: source.data };
16894
+ } catch (error51) {
16895
+ return { ok: false, error: input.error(error51) };
16896
+ }
16897
+ }
16898
+ };
16899
+ }
16900
+
16901
+ // ../../harness-broker/dist/paths.js
16902
+ import os from "node:os";
16903
+ import path from "node:path";
16904
+ var HARNESS_BROKER_DESCRIPTOR_ENV = "CODEXHOST_CLAUDE_BROKER_DESCRIPTOR";
16905
+ var HARNESS_BROKER_DESCRIPTOR_FILE = "claude-code-broker-v1.json";
16906
+ function defaultHarnessBrokerDirectory(environment = process.env) {
16907
+ const home = environment.HOME || os.homedir();
16908
+ return path.join(home, ".codexhost", "harness-broker");
16909
+ }
16910
+ function defaultHarnessBrokerDescriptorPath(environment = process.env, harnessId = "claude-code") {
16911
+ harnessPluginIdSchema.parse(harnessId);
16912
+ if (harnessId !== "claude-code")
16913
+ return path.join(defaultHarnessBrokerDirectory(environment), `${harnessId}-broker-v1.json`);
16914
+ return environment[HARNESS_BROKER_DESCRIPTOR_ENV] ?? path.join(defaultHarnessBrokerDirectory(environment), HARNESS_BROKER_DESCRIPTOR_FILE);
16915
+ }
16916
+ function harnessBrokerLaunchAgentLabel(harnessId = "claude-code") {
16917
+ harnessPluginIdSchema.parse(harnessId);
16918
+ return harnessId === "claude-code" ? "ai.bytepioneer.codexhost.native-harness-broker" : `ai.bytepioneer.codexhost.${harnessId}-broker`;
16919
+ }
16920
+ function harnessBrokerLaunchAgentPlistPath(environment = process.env, harnessId = "claude-code") {
16921
+ const home = environment.HOME || os.homedir();
16922
+ return path.join(home, "Library", "LaunchAgents", `${harnessBrokerLaunchAgentLabel(harnessId)}.plist`);
16923
+ }
16924
+
16794
16925
  // ../../harness-broker/dist/client.js
16795
16926
  function unavailable(message, retryable = true) {
16796
16927
  return { code: "unavailable", message, retryable, stage: "harnessBroker" };
@@ -17327,6 +17458,7 @@ var BrokeredHarnessAdapter = class {
17327
17458
  commandCatalog;
17328
17459
  liveCommandCatalog;
17329
17460
  harnessId;
17461
+ sessionImport;
17330
17462
  credits;
17331
17463
  refreshCredits;
17332
17464
  #descriptorPath;
@@ -17336,7 +17468,6 @@ var BrokeredHarnessAdapter = class {
17336
17468
  #startTimeoutMs;
17337
17469
  #connection = null;
17338
17470
  #closed = false;
17339
- #sessionImportListing = null;
17340
17471
  #credits = null;
17341
17472
  #creditsRefresh = null;
17342
17473
  subagents = {
@@ -17348,86 +17479,16 @@ var BrokeredHarnessAdapter = class {
17348
17479
  }
17349
17480
  }
17350
17481
  };
17351
- sessionImport = Object.freeze({
17352
- listCandidates: () => {
17353
- this.#sessionImportListing ??= this.#listSessionImportCandidates().finally(() => {
17354
- this.#sessionImportListing = null;
17355
- });
17356
- return this.#sessionImportListing;
17357
- },
17358
- resolveCandidate: async (nativeSessionId) => {
17359
- if (this.#closed) {
17360
- return {
17361
- ok: false,
17362
- error: unavailable("Claude Aqua broker adapter is closed", false)
17363
- };
17364
- }
17365
- try {
17366
- const result = parseHarnessResult(await (await this.#connect()).request("adapter.sessionImport.resolve", {
17367
- nativeSessionId
17368
- }));
17369
- if (!result.ok)
17370
- return result;
17371
- const parsed = brokerSessionImportSourceSchema.safeParse(result.value);
17372
- if (!parsed.success || parsed.data.candidate.nativeSessionId !== nativeSessionId) {
17373
- return {
17374
- ok: false,
17375
- error: {
17376
- ...unavailable("Harness broker returned an invalid Session source", false),
17377
- code: "protocolError"
17378
- }
17379
- };
17380
- }
17381
- return { ok: true, value: parsed.data };
17382
- } catch (error51) {
17383
- this.#connection = null;
17384
- return {
17385
- ok: false,
17386
- error: unavailable(error51 instanceof Error ? error51.message : String(error51))
17387
- };
17388
- }
17389
- }
17390
- });
17391
- async #listSessionImportCandidates() {
17392
- if (this.#closed) {
17393
- return {
17394
- ok: false,
17395
- error: unavailable("Claude Aqua broker adapter is closed", false)
17396
- };
17397
- }
17398
- try {
17399
- const candidates = [];
17400
- for (; ; ) {
17401
- const result = parseHarnessResult(await (await this.#connect()).request("adapter.sessionImport.list", {
17402
- offset: candidates.length,
17403
- limit: HARNESS_BROKER_SESSION_IMPORT_PAGE_SIZE
17404
- }));
17405
- if (!result.ok)
17406
- return result;
17407
- const parsed = brokerSessionImportPageSchema.safeParse(result.value);
17408
- if (!parsed.success || parsed.data.total < candidates.length + parsed.data.candidates.length || parsed.data.candidates.length === 0 && candidates.length < parsed.data.total) {
17409
- return {
17410
- ok: false,
17411
- error: {
17412
- ...unavailable("Harness broker returned invalid Session candidates", false),
17413
- code: "protocolError"
17414
- }
17415
- };
17416
- }
17417
- candidates.push(...parsed.data.candidates);
17418
- if (candidates.length === parsed.data.total)
17419
- return { ok: true, value: candidates };
17420
- }
17421
- } catch (error51) {
17422
- this.#connection = null;
17423
- return {
17424
- ok: false,
17425
- error: unavailable(error51 instanceof Error ? error51.message : String(error51))
17426
- };
17427
- }
17428
- }
17429
17482
  constructor(input = {}) {
17430
17483
  this.harnessId = harnessPluginIdSchema.parse(input.harnessId ?? "claude-code");
17484
+ if (input.sessionImport) {
17485
+ this.sessionImport = createBrokerSessionImportCapability({
17486
+ harnessId: this.harnessId,
17487
+ request: async (method, params) => parseHarnessResult(await this.#request(method, params, method === "adapter.sessionImport.resolve")),
17488
+ isClosed: () => this.#closed,
17489
+ error: (error51) => this.#error(error51)
17490
+ });
17491
+ }
17431
17492
  if (input.accountCredits !== false) {
17432
17493
  this.credits = () => this.#credits;
17433
17494
  this.refreshCredits = () => this.#refreshAccountCredits();
@@ -18936,7 +18997,17 @@ function pendingNativeHistoryRewind(contents) {
18936
18997
  const last = parseRows(contents).findLast((row) => row.type === "resend-fork-notice" || NATIVE_MESSAGE_TYPES.has(text(row.type)));
18937
18998
  return last?.type === "resend-fork-notice" ? { forkPointId: text(last.parentId) || null } : void 0;
18938
18999
  }
19000
+ function isNativeCompactionSummary(row) {
19001
+ const data = record2(row.providerData);
19002
+ return row.type === "message" && row.role === "user" && data.isCompactInternal === true;
19003
+ }
18939
19004
  function nativeHistoryRows(contents) {
19005
+ return collectNativeHistoryRows(contents, false);
19006
+ }
19007
+ function nativeDisplayHistoryRows(contents) {
19008
+ return collectNativeHistoryRows(contents, true);
19009
+ }
19010
+ function collectNativeHistoryRows(contents, followCompactionParent) {
18940
19011
  const entries = /* @__PURE__ */ new Map();
18941
19012
  let leaf = "";
18942
19013
  for (const row of parseRows(contents)) {
@@ -18961,10 +19032,16 @@ function nativeHistoryRows(contents) {
18961
19032
  throw new CodeBuddyError("protocolError", "Native history parent is missing");
18962
19033
  chain.push(row);
18963
19034
  leaf = text(row.parentId);
19035
+ if (!leaf && followCompactionParent && isNativeCompactionSummary(row)) {
19036
+ const logicalParent = text(row.logicalParentId);
19037
+ if (logicalParent && !entries.has(logicalParent))
19038
+ throw new CodeBuddyError("protocolError", "Native compaction parent is missing");
19039
+ leaf = logicalParent;
19040
+ }
18964
19041
  }
18965
19042
  return chain.reverse();
18966
19043
  }
18967
- function snapshotFromHistory(contents, ref, cwd, profile = CODEBUDDY_RUNTIME_PROFILE) {
19044
+ function snapshotFromHistory(contents, ref, cwd, profile = CODEBUDDY_RUNTIME_PROFILE, options = {}) {
18968
19045
  const supportsNativeCommands = nativeCommandsEnabled(profile);
18969
19046
  const supportsFork = capabilitiesForProfile(profile).history.fork;
18970
19047
  const turns = [];
@@ -18990,7 +19067,8 @@ function snapshotFromHistory(contents, ref, cwd, profile = CODEBUDDY_RUNTIME_PRO
18990
19067
  snapshot.item.outputTruncated = Boolean(output.truncated);
18991
19068
  }
18992
19069
  };
18993
- const history = nativeHistoryRows(contents);
19070
+ const includeCompactionHistory = options.includeCompactionHistory !== false;
19071
+ const history = includeCompactionHistory ? nativeDisplayHistoryRows(contents) : nativeHistoryRows(contents);
18994
19072
  const manualCompactions = /* @__PURE__ */ new Set();
18995
19073
  let compactUser;
18996
19074
  if (supportsNativeCommands)
@@ -19024,6 +19102,22 @@ function snapshotFromHistory(contents, ref, cwd, profile = CODEBUDDY_RUNTIME_PRO
19024
19102
  continue;
19025
19103
  if (supportsNativeCommands && row.type === "message" && row.role === "user" && data.agent === "compact" && !manualCompactions.has(text(row.id)))
19026
19104
  continue;
19105
+ if (includeCompactionHistory && isNativeCompactionSummary(row)) {
19106
+ if (supportsNativeCommands && current) {
19107
+ const outcome = data.isCompacted === true ? { status: "succeeded" } : {
19108
+ status: "failed",
19109
+ error: nativeError(new CodeBuddyError("nativeFailure", "Native compaction did not complete"), profile)
19110
+ };
19111
+ current.items.push({
19112
+ item: {
19113
+ type: "contextCompaction",
19114
+ itemId: hostItemIdSchema.parse(`compact-${text(row.id)}`)
19115
+ },
19116
+ outcome
19117
+ });
19118
+ }
19119
+ continue;
19120
+ }
19027
19121
  if (row.type === "message" && row.role === "user") {
19028
19122
  current = {
19029
19123
  nativeTurnRef: nativeTurnRefSchema.parse({
@@ -24371,7 +24465,9 @@ function commandCaveat(row) {
24371
24465
  }
24372
24466
  function retainedRowCount(input, contents, sourceCwd = input.cwd, profile = CODEBUDDY_RUNTIME_PROFILE) {
24373
24467
  const rows2 = nativeHistoryRows(contents);
24374
- const turns = snapshotFromHistory(contents, input.sourceRef, sourceCwd, profile).turns;
24468
+ const turns = snapshotFromHistory(contents, input.sourceRef, sourceCwd, profile, {
24469
+ includeCompactionHistory: false
24470
+ }).turns;
24375
24471
  let excluded2;
24376
24472
  if (input.kind === "rollbackLastTurn") {
24377
24473
  if (!turns.length)
@@ -26976,6 +27072,7 @@ function createHarnessAdapter(context) {
26976
27072
  ...context.launchCommand ? { CODEXHOST_WORKBUDDY_COMMAND: context.launchCommand } : {}
26977
27073
  };
26978
27074
  return new BrokeredHarnessAdapter({
27075
+ sessionImport: true,
26979
27076
  accountCredits: false,
26980
27077
  harnessId: "workbuddy",
26981
27078
  commandCatalog: WORKBUDDY_COMMAND_CATALOG,