@codexhost/cli-win32-arm64 0.27.0 → 0.28.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.
Files changed (50) hide show
  1. package/README.md +1 -1
  2. package/app/codexhost-distribution.json +1 -1
  3. package/app/console-server.mjs +340 -161
  4. package/app/console-web.js +194 -5
  5. package/app/desktop-controller.mjs +105 -4
  6. package/app/host-runtime.mjs +1891 -1006
  7. package/app/plugins/antigravity/plugin.mjs +390 -135
  8. package/app/plugins/claude-code/plugin.mjs +383 -32
  9. package/app/plugins/codebuddy/plugin.mjs +213 -30
  10. package/app/plugins/codex-usage/plugin.mjs +370 -52
  11. package/app/plugins/copilot/plugin.mjs +105 -4
  12. package/app/plugins/cursor-cli/plugin.mjs +126 -4
  13. package/app/plugins/deepseek-harness/plugin.mjs +107 -4
  14. package/app/plugins/devin/plugin.mjs +106 -4
  15. package/app/plugins/grok/plugin.mjs +186 -25
  16. package/app/plugins/hermes/plugin.mjs +107 -4
  17. package/app/plugins/kimi-code/plugin.mjs +105 -4
  18. package/app/plugins/kiro-cli/plugin.mjs +105 -4
  19. package/app/plugins/omp/plugin.mjs +261 -45
  20. package/app/plugins/opencode/plugin.mjs +107 -4
  21. package/app/plugins/pi/plugin.mjs +312 -48
  22. package/app/plugins/qoder/plugin.mjs +179 -18
  23. package/app/plugins/qoder-cn/plugin.mjs +179 -18
  24. package/app/plugins/qwen-code/plugin.mjs +105 -4
  25. package/app/plugins/workbuddy/plugin.mjs +213 -30
  26. package/app/plugins/zcode/plugin.mjs +107 -4
  27. package/app/renderer-extension.js +12013 -11533
  28. package/app/web/assets/{index-nw2RXcDu.css → index-DBPgg32z.css} +1 -1
  29. package/app/web/assets/index-DWxiVzuS.js +204 -0
  30. package/app/web/codexhost-settings.js +81 -46
  31. package/app/web/index.html +2 -2
  32. package/app/web/plugins/deepseek-ai__dsh-api-remotes/client.js +65 -65
  33. package/app/web/plugins/deepseek-ai__dsh-api-session-controller/client.js +69 -69
  34. package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +75 -75
  35. package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +72 -72
  36. package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +14 -14
  37. package/app/web/plugins/deepseek-ai__dsh-client-ui-input-trigger/client.js +1 -1
  38. package/app/web/plugins/deepseek-ai__dsh-client-ui-layout/client.js +1 -1
  39. package/app/web/plugins/deepseek-ai__dsh-client-ui-model-selection/client.js +5 -5
  40. package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-documentpreview/client.pdf.js +2 -2
  41. package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +18 -18
  42. package/app/web/plugins/deepseek-ai__dsh-client-ui-workspace/client.js +8 -8
  43. package/app/web-modules/server.mjs +2476 -1131
  44. package/bin/codexhost.exe +0 -0
  45. package/libexec/codexhost-node-repl.exe +0 -0
  46. package/libexec/codexhost-shell.exe +0 -0
  47. package/libexec/codexhost-shim.exe +0 -0
  48. package/libexec/codexhost-updater.exe +0 -0
  49. package/package.json +1 -1
  50. package/app/web/assets/index-D9l7_ThH.js +0 -199
@@ -27895,11 +27895,21 @@ var harnessThinkingOptionsSchema = external_exports.array(harnessThinkingOptionS
27895
27895
  ids.add(option.id);
27896
27896
  }
27897
27897
  });
27898
+ var harnessThinkingOptionsScopeSchema = external_exports.enum(["catalog", "activeModel"]);
27898
27899
  var harnessModelCatalogSchema = external_exports.object({
27899
27900
  models: external_exports.array(harnessModelSchema),
27900
27901
  defaultModel: harnessModelRefSchema.optional(),
27901
27902
  thinkingOptions: harnessThinkingOptionsSchema,
27902
- defaultThinkingOptionId: harnessThinkingOptionIdSchema.optional()
27903
+ defaultThinkingOptionId: harnessThinkingOptionIdSchema.optional(),
27904
+ /**
27905
+ * Scope of per-Model `supportedThinkingOptionIds` in this catalog.
27906
+ * Omitted or `"catalog"` means each Model's `supportedThinkingOptionIds`
27907
+ * reflects its own options (omitted or `[]` means none).
27908
+ * `"activeModel"` means only the active Model's Thinking options were
27909
+ * observed; other Models omit `supportedThinkingOptionIds` and must be
27910
+ * validated by the Adapter after selecting the Model.
27911
+ */
27912
+ thinkingOptionsScope: harnessThinkingOptionsScopeSchema.optional()
27903
27913
  }).strict().superRefine((catalog, context) => {
27904
27914
  const refs = [];
27905
27915
  const thinkingIds = new Set(catalog.thinkingOptions.map(({ id: id2 }) => id2));
@@ -28813,7 +28823,12 @@ var clientProjectlessWorkspaceSchema = external_exports.object({
28813
28823
  prompt: external_exports.string().max(16384).optional()
28814
28824
  }).strict();
28815
28825
  var clientWorkspaceSnapshotSchema = external_exports.object({
28816
- projects: external_exports.array(external_exports.object({ id: external_exports.string(), name: external_exports.string(), rootPaths: external_exports.array(external_exports.string()) })),
28826
+ projects: external_exports.array(external_exports.object({
28827
+ id: external_exports.string(),
28828
+ name: external_exports.string(),
28829
+ rootPaths: external_exports.array(external_exports.string()),
28830
+ createdAt: external_exports.number().int().optional()
28831
+ })),
28817
28832
  nativeProjects: external_exports.literal(true).optional(),
28818
28833
  assignments: external_exports.record(external_exports.string(), external_exports.string()),
28819
28834
  projectless: external_exports.array(external_exports.string()),
@@ -29226,6 +29241,7 @@ var delegationReadParamsSchema = external_exports.strictObject({
29226
29241
  // ../../shared-contracts/dist/remote-peers.js
29227
29242
  var REMOTE_PEER_ID_PATTERN = /^[a-zA-Z0-9_-]{1,64}$/u;
29228
29243
  var remotePeerIdSchema = external_exports.string().regex(REMOTE_PEER_ID_PATTERN);
29244
+ var remotePeerNodeIdSchema = external_exports.string().regex(REMOTE_PEER_ID_PATTERN);
29229
29245
  var remotePeerHostIdSchema = external_exports.string().regex(/^remote-peer:[a-zA-Z0-9_-]{1,64}$/u);
29230
29246
  var remotePeerTransportKindSchema = external_exports.enum(["relay", "tailscale", "lan", "custom"]);
29231
29247
  var REMOTE_PEER_COLORS = [
@@ -29249,6 +29265,7 @@ var remotePeerStateSchema = external_exports.enum([
29249
29265
  var remotePeerSummarySchema = external_exports.object({
29250
29266
  peerId: remotePeerIdSchema,
29251
29267
  hostId: remotePeerHostIdSchema,
29268
+ nodeId: remotePeerNodeIdSchema.optional(),
29252
29269
  name: external_exports.string().min(1).max(120),
29253
29270
  color: remotePeerColorSchema.optional(),
29254
29271
  origin: external_exports.string().min(1).max(2048),
@@ -29256,6 +29273,11 @@ var remotePeerSummarySchema = external_exports.object({
29256
29273
  encrypted: external_exports.boolean(),
29257
29274
  enabled: external_exports.boolean(),
29258
29275
  state: remotePeerStateSchema,
29276
+ supportsPeerPairing: external_exports.boolean().optional(),
29277
+ /** Omitted when either side's node mapping is unknown. */
29278
+ pairedBack: external_exports.boolean().optional(),
29279
+ /** Other configured remote peerIds on this Hub present in this peer's `manifest.peerNodes`. */
29280
+ linkedPeerIds: external_exports.array(remotePeerIdSchema).max(128).optional(),
29259
29281
  latencyMs: external_exports.number().int().nonnegative().optional(),
29260
29282
  version: external_exports.string().max(128).optional(),
29261
29283
  platform: external_exports.string().max(64).optional(),
@@ -29274,8 +29296,48 @@ var remotePeerAddParamsSchema = external_exports.object({
29274
29296
  origin: external_exports.string().min(1).max(2048).optional(),
29275
29297
  token: external_exports.string().min(1).max(2048).optional(),
29276
29298
  name: external_exports.string().trim().min(1).max(120).optional(),
29277
- color: remotePeerColorSchema.optional()
29299
+ color: remotePeerColorSchema.optional(),
29300
+ pairBack: external_exports.boolean().optional(),
29301
+ meshPeerIds: external_exports.array(remotePeerIdSchema).max(64).optional(),
29302
+ selfOrigin: external_exports.string().min(1).max(2048).optional()
29278
29303
  }).refine((input3) => Boolean(input3.connectionUrl) || Boolean(input3.origin) && Boolean(input3.token), "Provide either connectionUrl or both origin and token");
29304
+ var remotePeerIntroduceParamsSchema = external_exports.strictObject({
29305
+ origin: external_exports.string().min(1).max(2048),
29306
+ token: external_exports.string().min(1).max(2048),
29307
+ name: external_exports.string().trim().min(1).max(120).optional(),
29308
+ color: remotePeerColorSchema.optional(),
29309
+ expectedNodeId: remotePeerNodeIdSchema.optional()
29310
+ });
29311
+ var remotePeerIntroduceResultSchema = external_exports.object({
29312
+ status: external_exports.enum(["added", "updated", "existing"]),
29313
+ peerId: remotePeerIdSchema,
29314
+ hostId: remotePeerHostIdSchema,
29315
+ nodeId: remotePeerNodeIdSchema.optional()
29316
+ });
29317
+ var remotePeerPairingStatusSchema = external_exports.enum([
29318
+ "added",
29319
+ "updated",
29320
+ "existing",
29321
+ "failed",
29322
+ "skipped"
29323
+ ]);
29324
+ var remotePeerPairingStepSchema = external_exports.object({
29325
+ targetPeerId: remotePeerIdSchema,
29326
+ targetName: external_exports.string().min(1).max(120),
29327
+ introducedHost: external_exports.union([external_exports.literal("local"), remotePeerIdSchema]),
29328
+ introducedName: external_exports.string().min(1).max(120),
29329
+ status: remotePeerPairingStatusSchema,
29330
+ error: external_exports.string().max(1e3).optional()
29331
+ });
29332
+ var remotePeerPairingReportSchema = external_exports.object({
29333
+ results: external_exports.array(remotePeerPairingStepSchema)
29334
+ });
29335
+ var remotePeerSyncMeshParamsSchema = external_exports.object({
29336
+ peerIds: external_exports.array(remotePeerIdSchema).max(64).optional(),
29337
+ includeSelf: external_exports.boolean().optional(),
29338
+ includeMesh: external_exports.boolean().optional(),
29339
+ selfOrigin: external_exports.string().min(1).max(2048).optional()
29340
+ });
29279
29341
  var remotePeerUpdateParamsSchema = external_exports.object({
29280
29342
  peerId: remotePeerIdSchema,
29281
29343
  name: external_exports.string().trim().min(1).max(120).optional(),
@@ -29304,6 +29366,9 @@ var remotePeerTestProjectSchema = external_exports.object({
29304
29366
  });
29305
29367
  var remotePeerTestResultSchema = external_exports.object({
29306
29368
  ok: external_exports.boolean(),
29369
+ nodeId: remotePeerNodeIdSchema.optional(),
29370
+ supportsPeerPairing: external_exports.boolean().optional(),
29371
+ pairedBack: external_exports.boolean().optional(),
29307
29372
  latencyMs: external_exports.number().int().nonnegative().optional(),
29308
29373
  origin: external_exports.string().max(2048).optional(),
29309
29374
  transportKind: remotePeerTransportKindSchema.optional(),
@@ -29330,7 +29395,9 @@ var remotePeerCapabilitiesSchema = external_exports.object({
29330
29395
  /** Peer supports officeToPdf/render over /api/peer/v1/workspace-files/rpc. */
29331
29396
  officePreview: external_exports.literal(1).optional(),
29332
29397
  /** /api/peer/v1/delegation is available for fixed-whitelist cross-host delegation. */
29333
- delegation: external_exports.literal(1).optional()
29398
+ delegation: external_exports.literal(1).optional(),
29399
+ /** POST /api/peer/v1/peers is available. */
29400
+ peerPairing: external_exports.literal(1).optional()
29334
29401
  });
29335
29402
  var remotePeerManifestSchema = external_exports.object({
29336
29403
  version: external_exports.string().max(128),
@@ -29338,6 +29405,8 @@ var remotePeerManifestSchema = external_exports.object({
29338
29405
  hostname: external_exports.string().max(255),
29339
29406
  homeDir: external_exports.string().max(4096).optional(),
29340
29407
  epoch: external_exports.string().min(1).max(256),
29408
+ nodeId: remotePeerNodeIdSchema.optional(),
29409
+ peerNodes: external_exports.record(remotePeerHostIdSchema, remotePeerNodeIdSchema).refine((v) => Object.keys(v).length <= 128).optional(),
29341
29410
  projects: external_exports.array(remotePeerManifestProjectSchema),
29342
29411
  capabilities: remotePeerCapabilitiesSchema.optional()
29343
29412
  });
@@ -29424,6 +29493,29 @@ var remotePeerWorkspaceMutationResultSchema = external_exports.object({
29424
29493
  workspaceId: external_exports.string().min(1).max(1024).optional(),
29425
29494
  manifest: remotePeerManifestSchema
29426
29495
  });
29496
+ var delegationRemoteHostsParamsSchema = external_exports.object({
29497
+ sessionHostId: external_exports.string().min(1).max(128).optional()
29498
+ });
29499
+ var delegationRemoteHostOptionSchema = external_exports.object({
29500
+ hostId: external_exports.union([external_exports.literal("local"), remotePeerHostIdSchema]),
29501
+ name: external_exports.string().min(1).max(120),
29502
+ isLocal: external_exports.boolean().optional(),
29503
+ color: remotePeerColorSchema.optional(),
29504
+ hostname: external_exports.string().max(255).optional()
29505
+ });
29506
+ var delegationRemoteHostsResultSchema = external_exports.object({
29507
+ hosts: external_exports.array(delegationRemoteHostOptionSchema)
29508
+ });
29509
+ var delegationHostHarnessesParamsSchema = external_exports.object({
29510
+ hostId: external_exports.union([external_exports.literal("local"), remotePeerHostIdSchema])
29511
+ });
29512
+ var delegationHostHarnessOptionSchema = external_exports.object({
29513
+ id: external_exports.string().regex(/^[a-z0-9][a-z0-9-]*$/u),
29514
+ name: external_exports.string().min(1).max(120)
29515
+ });
29516
+ var delegationHostHarnessesResultSchema = external_exports.object({
29517
+ harnesses: external_exports.array(delegationHostHarnessOptionSchema)
29518
+ });
29427
29519
 
29428
29520
  // ../../shared-contracts/dist/peer-delegation.js
29429
29521
  var PEER_DELEGATION_BRIDGE_VERSION = 1;
@@ -29467,6 +29559,7 @@ var peerDelegationHostProjectSchema = external_exports.strictObject({
29467
29559
  });
29468
29560
  var peerDelegationHostSummarySchema = external_exports.strictObject({
29469
29561
  hostId: remotePeerHostIdSchema,
29562
+ nodeId: remotePeerNodeIdSchema.optional(),
29470
29563
  displayName: external_exports.string().min(1).max(120),
29471
29564
  online: external_exports.boolean(),
29472
29565
  state: remotePeerStateSchema,
@@ -30359,6 +30452,13 @@ var updatePhaseSchema = external_exports.enum([
30359
30452
  "succeeded",
30360
30453
  "failed"
30361
30454
  ]);
30455
+ var npmDownloadProgressSchema = external_exports.strictObject({
30456
+ completed: external_exports.number().int().nonnegative(),
30457
+ total: external_exports.number().int().positive()
30458
+ }).refine((progress) => progress.completed <= progress.total, {
30459
+ path: ["completed"],
30460
+ message: "completed must not exceed total"
30461
+ });
30362
30462
  var updateStatusSchema = external_exports.strictObject({
30363
30463
  version: updateSemanticVersionSchema,
30364
30464
  installation: updateInstallationSchema,
@@ -30366,6 +30466,7 @@ var updateStatusSchema = external_exports.strictObject({
30366
30466
  updatedAt: external_exports.number().int().nonnegative(),
30367
30467
  downloadedBytes: external_exports.number().int().nonnegative().optional(),
30368
30468
  totalBytes: external_exports.number().int().positive().optional(),
30469
+ npmDownload: npmDownloadProgressSchema.optional(),
30369
30470
  error: external_exports.string().min(1).max(UPDATE_ERROR_MAX_LENGTH).nullable(),
30370
30471
  serviceStopOutput: external_exports.string().optional()
30371
30472
  }).superRefine((status, context) => {
@@ -38547,13 +38648,12 @@ ${text3}` : text3 });
38547
38648
  }
38548
38649
 
38549
38650
  // dist/usage-statistics.js
38550
- import { lstat, opendir as opendir2 } from "node:fs/promises";
38651
+ import { lstat, readdir } from "node:fs/promises";
38551
38652
  import os3 from "node:os";
38552
38653
  import path10 from "node:path";
38553
38654
 
38554
38655
  // ../../harness-adapter/dist/usage-statistics.js
38555
38656
  import { createReadStream as createReadStream2 } from "node:fs";
38556
- import { createInterface as createInterface2 } from "node:readline";
38557
38657
  var HarnessUsageSourceChangedError = class extends Error {
38558
38658
  code = "HARNESS_USAGE_SOURCE_CHANGED";
38559
38659
  /** Plugins may bundle their own copy of this contract, so instanceof is insufficient. */
@@ -38599,12 +38699,59 @@ function withUsageSession(entry, session) {
38599
38699
  ...sessionTitle !== void 0 ? { sessionTitle } : {}
38600
38700
  };
38601
38701
  }
38702
+ var JSONL_CHUNK_BYTES = 128 * 1024;
38703
+ var JSONL_HEADER_CHUNK_BYTES = 16 * 1024;
38704
+ function concatParts(parts, total) {
38705
+ const [single] = parts;
38706
+ return single && parts.length === 1 ? single : Buffer.concat(parts, total);
38707
+ }
38708
+ async function* jsonlLineSlices(file2, signal, highWaterMark) {
38709
+ const stream = createReadStream2(file2, { highWaterMark, signal });
38710
+ let parts = [];
38711
+ let buffered = 0;
38712
+ try {
38713
+ for await (const raw of stream) {
38714
+ signal.throwIfAborted();
38715
+ const chunk = raw;
38716
+ let start = 0;
38717
+ let end;
38718
+ while ((end = chunk.indexOf(10, start)) >= 0) {
38719
+ const lineEnd = end > start && chunk[end - 1] === 13 ? end - 1 : end;
38720
+ const slice = chunk.subarray(start, lineEnd);
38721
+ if (buffered === 0) {
38722
+ yield slice;
38723
+ } else {
38724
+ if (slice.length > 0) {
38725
+ parts.push(slice);
38726
+ buffered += slice.length;
38727
+ }
38728
+ const combined = concatParts(parts, buffered);
38729
+ parts = [];
38730
+ buffered = 0;
38731
+ yield combined.length > 0 && combined[combined.length - 1] === 13 ? combined.subarray(0, combined.length - 1) : combined;
38732
+ }
38733
+ start = end + 1;
38734
+ }
38735
+ if (start < chunk.length) {
38736
+ const rest = chunk.subarray(start);
38737
+ parts.push(rest);
38738
+ buffered += rest.length;
38739
+ }
38740
+ }
38741
+ if (buffered > 0) {
38742
+ const combined = concatParts(parts, buffered);
38743
+ yield combined.length > 0 && combined[combined.length - 1] === 13 ? combined.subarray(0, combined.length - 1) : combined;
38744
+ }
38745
+ } finally {
38746
+ stream.destroy();
38747
+ }
38748
+ }
38602
38749
  async function* jsonlRecords(file2, marker, signal) {
38603
- const lines = createInterface2({
38604
- input: createReadStream2(file2, { encoding: "utf8", signal }),
38605
- crlfDelay: Infinity
38606
- });
38607
- for await (const line of lines) {
38750
+ const markerBytes = marker.length > 0 ? Buffer.from(marker, "utf8") : null;
38751
+ for await (const rawLine of jsonlLineSlices(file2, signal, JSONL_CHUNK_BYTES)) {
38752
+ if (markerBytes && !rawLine.includes(markerBytes))
38753
+ continue;
38754
+ const line = rawLine.toString("utf8");
38608
38755
  if (!line.includes(marker))
38609
38756
  continue;
38610
38757
  let value;
@@ -38655,25 +38802,32 @@ async function transcriptFingerprint(file2) {
38655
38802
  const info = await lstatIfPresent(file2);
38656
38803
  return info?.isFile() && info.size > 0 ? `${info.ino}:${info.size}:${info.mtimeMs}` : null;
38657
38804
  }
38805
+ var LIST_CONCURRENCY = 32;
38658
38806
  async function listTranscripts(brainRoot, signal) {
38659
38807
  signal.throwIfAborted();
38660
- const conversations = await opendir2(brainRoot).catch((error62) => {
38808
+ const entries = await readdir(brainRoot, { withFileTypes: true }).catch((error62) => {
38661
38809
  if (error62.code === "ENOENT")
38662
38810
  return null;
38663
38811
  throw error62;
38664
38812
  });
38665
- if (!conversations)
38813
+ if (!entries)
38666
38814
  return [];
38815
+ const directories = entries.filter((entry) => entry.isDirectory());
38667
38816
  const sources = [];
38668
- for await (const entry of conversations) {
38817
+ for (let offset = 0; offset < directories.length; offset += LIST_CONCURRENCY) {
38669
38818
  signal.throwIfAborted();
38670
- if (!entry.isDirectory())
38671
- continue;
38672
- const file2 = transcriptPath(brainRoot, entry.name);
38673
- const fingerprint = await transcriptFingerprint(file2);
38674
- if (fingerprint)
38675
- sources.push({ id: file2, fingerprint });
38819
+ const batch = directories.slice(offset, offset + LIST_CONCURRENCY);
38820
+ const inspected = await Promise.all(batch.map(async (entry) => {
38821
+ const file2 = transcriptPath(brainRoot, entry.name);
38822
+ const fingerprint = await transcriptFingerprint(file2);
38823
+ return fingerprint ? { id: file2, fingerprint } : null;
38824
+ }));
38825
+ for (const source of inspected) {
38826
+ if (source)
38827
+ sources.push(source);
38828
+ }
38676
38829
  }
38830
+ signal.throwIfAborted();
38677
38831
  return sources;
38678
38832
  }
38679
38833
  async function readAntigravityUsage(file2, signal) {
@@ -39309,6 +39463,144 @@ var AntigravityWakeObserver = class {
39309
39463
  }
39310
39464
  };
39311
39465
 
39466
+ // ../../harness-adapter/dist/session-import.js
39467
+ import { lstat as lstat2 } from "node:fs/promises";
39468
+ var SessionImportChangedError = class extends Error {
39469
+ constructor(message3 = "Native Session changed during discovery; refresh and retry") {
39470
+ super(message3);
39471
+ this.name = "SessionImportChangedError";
39472
+ }
39473
+ };
39474
+ function isMissingFileError(error62) {
39475
+ return typeof error62 === "object" && error62 !== null && "code" in error62 && error62.code === "ENOENT";
39476
+ }
39477
+ function sameFileFingerprint(left, right) {
39478
+ return left === null || right === null ? left === right : left.dev === right.dev && left.ino === right.ino && left.size === right.size && left.mtimeMs === right.mtimeMs && left.ctimeMs === right.ctimeMs;
39479
+ }
39480
+ async function optionalLstat(file2) {
39481
+ try {
39482
+ return await lstat2(file2);
39483
+ } catch (error62) {
39484
+ if (isMissingFileError(error62))
39485
+ return null;
39486
+ throw error62;
39487
+ }
39488
+ }
39489
+ async function readStableFiles(files, read) {
39490
+ const before = await Promise.all(files.map(optionalLstat));
39491
+ const value = await read(before);
39492
+ const after = await Promise.all(files.map(optionalLstat));
39493
+ if (before.some((info, index) => !sameFileFingerprint(info, after[index] ?? null)))
39494
+ throw new SessionImportChangedError();
39495
+ return value;
39496
+ }
39497
+ function sessionImportTitle(value, maxLength = HARNESS_SESSION_IMPORT_TITLE_MAX_LENGTH) {
39498
+ if (typeof value !== "string")
39499
+ return null;
39500
+ const normalized = value.replaceAll("\0", "").replaceAll(/\s+/gu, " ").trim();
39501
+ if (!normalized)
39502
+ return null;
39503
+ if (normalized.length <= maxLength)
39504
+ return normalized;
39505
+ const characters = [...normalized];
39506
+ if (characters.length <= maxLength)
39507
+ return normalized;
39508
+ return `${characters.slice(0, maxLength - 1).join("").trimEnd()}…`;
39509
+ }
39510
+ function sessionImportCandidate(input3) {
39511
+ const time3 = typeof input3.updatedAt === "number" ? input3.updatedAt : typeof input3.updatedAt === "string" ? Date.parse(input3.updatedAt) : Number.NaN;
39512
+ const parsed = harnessSessionImportCandidateSchema.safeParse({
39513
+ nativeSessionId: input3.nativeSessionId,
39514
+ cwd: input3.cwd,
39515
+ title: typeof input3.title === "string" && input3.title.trim().length > 0 ? input3.title : null,
39516
+ updatedAt: Math.floor(time3),
39517
+ // Unknown must stay unknown; only an explicit boolean is a native statement.
39518
+ running: typeof input3.running === "boolean" ? input3.running : null
39519
+ });
39520
+ return parsed.success ? parsed.data : null;
39521
+ }
39522
+ var SessionImportScope = class {
39523
+ #abort = new AbortController();
39524
+ #options;
39525
+ #pending = /* @__PURE__ */ new Set();
39526
+ constructor(options) {
39527
+ this.#options = options;
39528
+ }
39529
+ #closed() {
39530
+ return {
39531
+ ok: false,
39532
+ error: { code: "invalidState", message: this.#options.closedMessage, retryable: false }
39533
+ };
39534
+ }
39535
+ read(operation) {
39536
+ const signal = this.#abort.signal;
39537
+ if (signal.aborted)
39538
+ return Promise.resolve(this.#closed());
39539
+ let started;
39540
+ try {
39541
+ started = operation(signal);
39542
+ } catch (error62) {
39543
+ started = Promise.reject(error62 instanceof Error ? error62 : new Error("Session read failed"));
39544
+ }
39545
+ const request = started.then((value) => signal.aborted ? this.#closed() : { ok: true, value }).catch(() => signal.aborted ? this.#closed() : {
39546
+ ok: false,
39547
+ error: {
39548
+ code: "unavailable",
39549
+ message: this.#options.unavailableMessage,
39550
+ retryable: true
39551
+ }
39552
+ }).finally(() => this.#pending.delete(request));
39553
+ this.#pending.add(request);
39554
+ return request;
39555
+ }
39556
+ /** `read` for `resolveCandidate`: a null source is the selected Session having disappeared. */
39557
+ async resolve(operation) {
39558
+ const result = await this.read(operation);
39559
+ if (!result.ok)
39560
+ return result;
39561
+ return result.value ? { ok: true, value: result.value } : {
39562
+ ok: false,
39563
+ error: {
39564
+ code: "sessionNotFound",
39565
+ message: this.#options.notFoundMessage,
39566
+ retryable: false
39567
+ }
39568
+ };
39569
+ }
39570
+ /** Idempotent. Resolves after every started read has settled. */
39571
+ async close() {
39572
+ this.#abort.abort();
39573
+ await Promise.allSettled(this.#pending);
39574
+ }
39575
+ };
39576
+
39577
+ // dist/native-title.js
39578
+ function normalizeAntigravityNativeTitle(value) {
39579
+ return sessionImportTitle(value);
39580
+ }
39581
+ async function readNativeSessionTitle(nativeSessionId, home, signal) {
39582
+ if (signal?.aborted)
39583
+ return null;
39584
+ const file2 = nativeConversationSummariesDbPath(home);
39585
+ const info = await optionalLstat(file2).catch(() => null);
39586
+ if (signal?.aborted || !info?.isFile())
39587
+ return null;
39588
+ try {
39589
+ const { DatabaseSync } = await import("node:sqlite");
39590
+ if (signal?.aborted)
39591
+ return null;
39592
+ const db = new DatabaseSync(file2, { readOnly: true });
39593
+ try {
39594
+ const row = db.prepare("SELECT title FROM conversation_summaries WHERE conversation_id = ?").get(nativeSessionId);
39595
+ return normalizeAntigravityNativeTitle(row?.title);
39596
+ } finally {
39597
+ db.close();
39598
+ }
39599
+ } catch {
39600
+ return null;
39601
+ }
39602
+ }
39603
+
39312
39604
  // dist/permission-modes.js
39313
39605
  var ANTIGRAVITY_ACP_SESSION_MODES = ["default", "accept-edits", "auto", "plan"];
39314
39606
  var ANTIGRAVITY_DEFAULT_PERMISSION_MODE_ID = harnessPermissionModeIdSchema.parse("dangerously-skip-permissions");
@@ -39624,121 +39916,8 @@ async function rollbackAntigravityLastTurn(options) {
39624
39916
  import { constants, createReadStream as createReadStream3 } from "node:fs";
39625
39917
  import { access as access3, stat as stat2 } from "node:fs/promises";
39626
39918
  import path12 from "node:path";
39627
- import { createInterface as createInterface3 } from "node:readline";
39919
+ import { createInterface as createInterface2 } from "node:readline";
39628
39920
  import { fileURLToPath } from "node:url";
39629
-
39630
- // ../../harness-adapter/dist/session-import.js
39631
- import { lstat as lstat2 } from "node:fs/promises";
39632
- var SessionImportChangedError = class extends Error {
39633
- constructor(message3 = "Native Session changed during discovery; refresh and retry") {
39634
- super(message3);
39635
- this.name = "SessionImportChangedError";
39636
- }
39637
- };
39638
- function isMissingFileError(error62) {
39639
- return typeof error62 === "object" && error62 !== null && "code" in error62 && error62.code === "ENOENT";
39640
- }
39641
- function sameFileFingerprint(left, right) {
39642
- return left === null || right === null ? left === right : left.dev === right.dev && left.ino === right.ino && left.size === right.size && left.mtimeMs === right.mtimeMs && left.ctimeMs === right.ctimeMs;
39643
- }
39644
- async function optionalLstat(file2) {
39645
- try {
39646
- return await lstat2(file2);
39647
- } catch (error62) {
39648
- if (isMissingFileError(error62))
39649
- return null;
39650
- throw error62;
39651
- }
39652
- }
39653
- async function readStableFiles(files, read) {
39654
- const before = await Promise.all(files.map(optionalLstat));
39655
- const value = await read(before);
39656
- const after = await Promise.all(files.map(optionalLstat));
39657
- if (before.some((info, index) => !sameFileFingerprint(info, after[index] ?? null)))
39658
- throw new SessionImportChangedError();
39659
- return value;
39660
- }
39661
- function sessionImportTitle(value, maxLength = HARNESS_SESSION_IMPORT_TITLE_MAX_LENGTH) {
39662
- if (typeof value !== "string")
39663
- return null;
39664
- const normalized = value.replaceAll("\0", "").replaceAll(/\s+/gu, " ").trim();
39665
- if (!normalized)
39666
- return null;
39667
- if (normalized.length <= maxLength)
39668
- return normalized;
39669
- const characters = [...normalized];
39670
- if (characters.length <= maxLength)
39671
- return normalized;
39672
- return `${characters.slice(0, maxLength - 1).join("").trimEnd()}…`;
39673
- }
39674
- function sessionImportCandidate(input3) {
39675
- const time3 = typeof input3.updatedAt === "number" ? input3.updatedAt : typeof input3.updatedAt === "string" ? Date.parse(input3.updatedAt) : Number.NaN;
39676
- const parsed = harnessSessionImportCandidateSchema.safeParse({
39677
- nativeSessionId: input3.nativeSessionId,
39678
- cwd: input3.cwd,
39679
- title: typeof input3.title === "string" && input3.title.trim().length > 0 ? input3.title : null,
39680
- updatedAt: Math.floor(time3),
39681
- // Unknown must stay unknown; only an explicit boolean is a native statement.
39682
- running: typeof input3.running === "boolean" ? input3.running : null
39683
- });
39684
- return parsed.success ? parsed.data : null;
39685
- }
39686
- var SessionImportScope = class {
39687
- #abort = new AbortController();
39688
- #options;
39689
- #pending = /* @__PURE__ */ new Set();
39690
- constructor(options) {
39691
- this.#options = options;
39692
- }
39693
- #closed() {
39694
- return {
39695
- ok: false,
39696
- error: { code: "invalidState", message: this.#options.closedMessage, retryable: false }
39697
- };
39698
- }
39699
- read(operation) {
39700
- const signal = this.#abort.signal;
39701
- if (signal.aborted)
39702
- return Promise.resolve(this.#closed());
39703
- let started;
39704
- try {
39705
- started = operation(signal);
39706
- } catch (error62) {
39707
- started = Promise.reject(error62 instanceof Error ? error62 : new Error("Session read failed"));
39708
- }
39709
- const request = started.then((value) => signal.aborted ? this.#closed() : { ok: true, value }).catch(() => signal.aborted ? this.#closed() : {
39710
- ok: false,
39711
- error: {
39712
- code: "unavailable",
39713
- message: this.#options.unavailableMessage,
39714
- retryable: true
39715
- }
39716
- }).finally(() => this.#pending.delete(request));
39717
- this.#pending.add(request);
39718
- return request;
39719
- }
39720
- /** `read` for `resolveCandidate`: a null source is the selected Session having disappeared. */
39721
- async resolve(operation) {
39722
- const result = await this.read(operation);
39723
- if (!result.ok)
39724
- return result;
39725
- return result.value ? { ok: true, value: result.value } : {
39726
- ok: false,
39727
- error: {
39728
- code: "sessionNotFound",
39729
- message: this.#options.notFoundMessage,
39730
- retryable: false
39731
- }
39732
- };
39733
- }
39734
- /** Idempotent. Resolves after every started read has settled. */
39735
- async close() {
39736
- this.#abort.abort();
39737
- await Promise.allSettled(this.#pending);
39738
- }
39739
- };
39740
-
39741
- // dist/session-import.js
39742
39921
  var SESSION_ID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/iu;
39743
39922
  function workspacePaths(raw) {
39744
39923
  if (typeof raw !== "string")
@@ -39777,7 +39956,7 @@ function workspacePaths(raw) {
39777
39956
  }
39778
39957
  async function firstUserTitle(file2, signal) {
39779
39958
  const stream = createReadStream3(file2, { encoding: "utf8", signal });
39780
- const lines = createInterface3({ input: stream, crlfDelay: Infinity });
39959
+ const lines = createInterface2({ input: stream, crlfDelay: Infinity });
39781
39960
  try {
39782
39961
  for await (const line of lines) {
39783
39962
  signal.throwIfAborted();
@@ -40407,6 +40586,12 @@ var AntigravitySession = class {
40407
40586
  #configurationQueue;
40408
40587
  #historyOperation = false;
40409
40588
  #creditsModelId;
40589
+ // A native title must never reach the Host before the first session.state.changed
40590
+ // commits the new Session's nativeRef; #pendingTitle holds it until then.
40591
+ #statePublished = false;
40592
+ #pendingTitle;
40593
+ #publishedTitle;
40594
+ #titleReadWork;
40410
40595
  constructor(options) {
40411
40596
  this.#options = options;
40412
40597
  if (options.nativeRef)
@@ -40425,6 +40610,8 @@ var AntigravitySession = class {
40425
40610
  observationTimeoutMs: options.adapter.subagentObservationTimeoutMs ?? 3e4,
40426
40611
  emit: (event) => this.#emit(event)
40427
40612
  });
40613
+ if (options.nativeRef)
40614
+ void this.#refreshStoredTitle(options.nativeRef.nativeSessionId);
40428
40615
  }
40429
40616
  get initialState() {
40430
40617
  return { ...this.#state };
@@ -40458,12 +40645,45 @@ var AntigravitySession = class {
40458
40645
  }
40459
40646
  #publishState() {
40460
40647
  this.#emit({ type: "session.state.changed", state: { ...this.#state } });
40648
+ this.#statePublished = true;
40649
+ const pendingTitle = this.#pendingTitle;
40650
+ this.#pendingTitle = void 0;
40651
+ if (pendingTitle !== void 0)
40652
+ this.#publishTitle(pendingTitle);
40461
40653
  const modelId2 = this.#state.effectiveModel?.id ?? this.#requested.model?.id;
40462
40654
  if (modelId2 !== this.#creditsModelId) {
40463
40655
  this.#creditsModelId = modelId2;
40464
40656
  this.#emit({ type: "session.accountCredits.changed" });
40465
40657
  }
40466
40658
  }
40659
+ #publishTitle(raw) {
40660
+ if (this.#closed || this.#faulted)
40661
+ return;
40662
+ const title = normalizeAntigravityNativeTitle(raw);
40663
+ if (!title || title === this.#publishedTitle)
40664
+ return;
40665
+ if (!this.#statePublished && !this.#options.nativeRef) {
40666
+ this.#pendingTitle = title;
40667
+ return;
40668
+ }
40669
+ this.#publishedTitle = title;
40670
+ this.#pendingTitle = void 0;
40671
+ this.#emit({ type: "session.title.changed", title });
40672
+ }
40673
+ async #refreshStoredTitle(nativeSessionId) {
40674
+ if (this.#closed || this.#faulted || this.#publishedTitle || this.#titleReadWork)
40675
+ return;
40676
+ const work = (async () => {
40677
+ const title = await readNativeSessionTitle(nativeSessionId, antigravityHome(this.#options.environment), this.#abort.signal);
40678
+ if (title && !this.#publishedTitle)
40679
+ this.#publishTitle(title);
40680
+ })().finally(() => {
40681
+ if (this.#titleReadWork === work)
40682
+ this.#titleReadWork = void 0;
40683
+ });
40684
+ this.#titleReadWork = work;
40685
+ await work;
40686
+ }
40467
40687
  /** Leads with the quota group that bills this Session's current Model. */
40468
40688
  readAccountCredits() {
40469
40689
  if (this.#closed)
@@ -40767,6 +40987,9 @@ var AntigravitySession = class {
40767
40987
  }
40768
40988
  break;
40769
40989
  }
40990
+ case "session.info":
40991
+ this.#publishTitle(event.title);
40992
+ break;
40770
40993
  }
40771
40994
  }
40772
40995
  async #replayUsage() {
@@ -41488,6 +41711,11 @@ var AntigravitySession = class {
41488
41711
  if (this.#postPromptWake && !this.#closed && !this.#faulted)
41489
41712
  this.#wakes?.observe();
41490
41713
  this.#postPromptWake = false;
41714
+ if (outcome.status === "succeeded" && !this.#publishedTitle && !this.#closed && !this.#faulted) {
41715
+ const nativeSessionId = this.nativeRef?.nativeSessionId;
41716
+ if (nativeSessionId)
41717
+ void this.#refreshStoredTitle(nativeSessionId);
41718
+ }
41491
41719
  }
41492
41720
  #permission(turn, request) {
41493
41721
  const ref = this.nativeRef;
@@ -41652,6 +41880,7 @@ var AntigravitySession = class {
41652
41880
  this.#abort.abort();
41653
41881
  this.#wakes?.close();
41654
41882
  this.#postPromptWake = false;
41883
+ this.#pendingTitle = void 0;
41655
41884
  this.#closeInteractions("cancelled");
41656
41885
  const active2 = this.#active;
41657
41886
  if (active2)
@@ -41883,6 +42112,32 @@ var AntigravityAdapter = class {
41883
42112
  return { ok: false, error: normalizeAntigravityError(error62) };
41884
42113
  }
41885
42114
  }
42115
+ async readSnapshot(input3) {
42116
+ if (this.#closed)
42117
+ return err("invalidState", "Adapter is closed");
42118
+ if (!validNativeSessionRef(input3.nativeRef, harnessId)) {
42119
+ return err("invalidRequest", "Invalid Antigravity Native Session");
42120
+ }
42121
+ try {
42122
+ const environment = { ...this.#environment };
42123
+ if (input3.environment) {
42124
+ for (const [key, value] of Object.entries(input3.environment)) {
42125
+ if (value !== void 0)
42126
+ environment[key] = value;
42127
+ }
42128
+ }
42129
+ const { events } = await readNativeHistory(input3.nativeRef.nativeSessionId, antigravityHome(environment));
42130
+ const turns = projectReplayedEventsToTurns({
42131
+ nativeSessionId: input3.nativeRef.nativeSessionId,
42132
+ cwd: input3.cwd,
42133
+ events,
42134
+ ...this.options.toolOutputLimit !== void 0 ? { outputLimit: this.options.toolOutputLimit } : {}
42135
+ });
42136
+ return ok({ turns });
42137
+ } catch {
42138
+ return err("nativeFailure", "Antigravity history unavailable");
42139
+ }
42140
+ }
41886
42141
  subagents = {
41887
42142
  readSnapshot: async (input3) => {
41888
42143
  if (this.#closed)