@codexhost/cli-linux-arm64 0.18.0 → 0.19.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 (56) hide show
  1. package/README.md +1 -1
  2. package/app/codexhost-distribution.json +1 -1
  3. package/app/console-server.mjs +59 -2
  4. package/app/console-web.js +76 -4
  5. package/app/desktop-controller.mjs +274 -11
  6. package/app/host-runtime.mjs +12322 -2469
  7. package/app/plugins/antigravity/plugin.mjs +654 -216
  8. package/app/plugins/claude-code/plugin.mjs +138 -11
  9. package/app/plugins/codebuddy/plugin.mjs +152 -20
  10. package/app/plugins/codex-usage/plugin.mjs +59 -2
  11. package/app/plugins/copilot/plugin.mjs +59 -2
  12. package/app/plugins/cursor-cli/plugin.mjs +134 -12
  13. package/app/plugins/deepseek-harness/manifest.json +2 -2
  14. package/app/plugins/deepseek-harness/plugin.mjs +86 -7
  15. package/app/plugins/devin/plugin.mjs +59 -2
  16. package/app/plugins/grok/plugin.mjs +392 -269
  17. package/app/plugins/hermes/plugin.mjs +138 -14
  18. package/app/plugins/kimi-code/plugin.mjs +59 -2
  19. package/app/plugins/kiro-cli/plugin.mjs +287 -18
  20. package/app/plugins/omp/plugin.mjs +788 -627
  21. package/app/plugins/opencode/plugin.mjs +59 -2
  22. package/app/plugins/pi/plugin.mjs +899 -773
  23. package/app/plugins/qoder/plugin.mjs +61 -6
  24. package/app/plugins/qoder-cn/plugin.mjs +61 -6
  25. package/app/plugins/qwen-code/plugin.mjs +168 -94
  26. package/app/plugins/workbuddy/plugin.mjs +152 -20
  27. package/app/plugins/zcode/plugin.mjs +132 -5
  28. package/app/renderer-extension.js +657 -270
  29. package/app/web/assets/index-BNQIOOHE.css +1 -0
  30. package/app/web/assets/index-Feo4BkqN.js +199 -0
  31. package/app/web/codexhost-settings.js +76 -4
  32. package/app/web/index.html +2 -2
  33. package/app/web/plugins/deepseek-ai__dsh-api-remotes/client.js +1 -1
  34. package/app/web/plugins/deepseek-ai__dsh-api-session-controller/client.js +8 -8
  35. package/app/web/plugins/deepseek-ai__dsh-client-file-upload/client.js +1 -1
  36. package/app/web/plugins/deepseek-ai__dsh-client-locale/client.js +3 -3
  37. package/app/web/plugins/deepseek-ai__dsh-client-ui-attachment/client.js +1 -1
  38. package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +129 -8
  39. package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +65 -63
  40. package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +95 -93
  41. package/app/web/plugins/deepseek-ai__dsh-client-ui-input-trigger/client.js +1 -1
  42. package/app/web/plugins/deepseek-ai__dsh-client-ui-layout/client.js +2 -2
  43. package/app/web/plugins/deepseek-ai__dsh-client-ui-model-selection/client.js +1 -1
  44. package/app/web/plugins/deepseek-ai__dsh-client-ui-settings-general/client.js +1 -1
  45. package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-documentpreview/client.excel.js +1 -1
  46. package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-files/client.js +1 -1
  47. package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +16 -16
  48. package/app/web/plugins/deepseek-ai__dsh-client-ui-user-questions/client.js +1 -1
  49. package/app/web/plugins/deepseek-ai__dsh-client-ui-workspace/client.js +11 -11
  50. package/app/web-modules/server.mjs +2339 -1514
  51. package/bin/codexhost +0 -0
  52. package/libexec/codexhost-shim +0 -0
  53. package/libexec/codexhost-updater +0 -0
  54. package/package.json +1 -1
  55. package/app/web/assets/index-C0aXz2jD.js +0 -199
  56. package/app/web/assets/index-C3lniEH1.css +0 -1
@@ -327,15 +327,58 @@ async function rendererRemoteSession(target2, operation) {
327
327
  return ids.map((hostId2) => ({ hostId: hostId2, online: !!routing.forHost(hostId2) }));
328
328
  const configured = await api.remoteConnections({ action: "catalog" });
329
329
  const connections = Array.isArray(configured) ? configured : [];
330
- const attempts = state.reconnectAttempts ??= /* @__PURE__ */ new Set();
330
+ const previous = state.reconnectAttempts;
331
+ const attempts = state.reconnectAttempts = previous && !("get" in previous) ? new Map([...previous].map((id) => [id, { failures: 0, retryAt: Infinity }])) : previous ?? /* @__PURE__ */ new Map();
331
332
  return Promise.all(
332
333
  [.../* @__PURE__ */ new Set([...ids, ...connections.map((c) => c.hostId)])].map(async (hostId2) => {
333
334
  const connection = connections.find((c) => c.hostId === hostId2);
334
335
  let status = await api.remoteConnections({ action: "state", hostId: hostId2 }).catch(() => ({ state: "error" }));
335
- if (connection?.autoConnect === false) attempts.delete(hostId2);
336
- if (connection?.autoConnect && status.state === "disconnected" && !attempts.has(hostId2)) {
337
- attempts.add(hostId2);
338
- await api.remoteConnections({ action: "connect", hostId: hostId2, enabled: true }).catch(() => void 0);
336
+ if (connection?.autoConnect === false || status.state === "connected")
337
+ attempts.delete(hostId2);
338
+ if (connection?.autoConnect && status.state === "disconnected") {
339
+ let attempt = attempts.get(hostId2);
340
+ if (!attempt || !attempt.loading && Date.now() >= attempt.retryAt) {
341
+ attempt ??= { failures: 0, retryAt: Infinity };
342
+ const current = attempt;
343
+ current.retryAt = Infinity;
344
+ attempts.set(hostId2, current);
345
+ current.loading = Promise.resolve().then(async () => {
346
+ try {
347
+ const latestStatus = await api.remoteConnections({ action: "state", hostId: hostId2 });
348
+ const latest = await api.remoteConnections({ action: "catalog" });
349
+ if (attempts.get(hostId2) !== current || !Array.isArray(latest) || !latest.some((c) => c.hostId === hostId2 && c.autoConnect === true) || latestStatus.state !== "disconnected") {
350
+ if (attempts.get(hostId2) === current) attempts.delete(hostId2);
351
+ return;
352
+ }
353
+ let acknowledged = false;
354
+ let failureCode;
355
+ try {
356
+ await api.remoteConnections({ action: "connect", hostId: hostId2, enabled: true });
357
+ acknowledged = true;
358
+ } catch (error51) {
359
+ failureCode = error51?.code;
360
+ }
361
+ const result = await api.remoteConnections({ action: "state", hostId: hostId2 });
362
+ const failed = acknowledged || [
363
+ "ECONNREFUSED",
364
+ "ECONNRESET",
365
+ "ENETUNREACH",
366
+ "EHOSTUNREACH",
367
+ "ENOTFOUND",
368
+ "EAI_AGAIN"
369
+ ].includes(String(failureCode));
370
+ if (failed && result.state === "disconnected" && result.error) {
371
+ current.failures = Math.min(current.failures + 1, 4);
372
+ current.retryAt = Date.now() + Math.min(3e4, 5e3 * 2 ** (current.failures - 1));
373
+ }
374
+ } catch {
375
+ } finally {
376
+ delete current.loading;
377
+ }
378
+ });
379
+ attempt = current;
380
+ }
381
+ await attempt.loading;
339
382
  status = await api.remoteConnections({ action: "state", hostId: hostId2 }).catch(() => ({ state: "error" }));
340
383
  }
341
384
  return {
@@ -373,12 +416,128 @@ async function rendererRemoteSession(target2, operation) {
373
416
  return Array.isArray(conversation?.requests) ? conversation.requests : [];
374
417
  };
375
418
  if (operation.kind === "read") {
376
- const result = await manager.sendRequest("thread/read", { threadId, includeTurns: true });
419
+ let result = await manager.sendRequest("thread/read", { threadId, includeTurns: false });
420
+ if (routing.forHost(operation.hostId) !== route)
421
+ throw new Error("Remote connection changed during read");
422
+ const header = result;
423
+ if (header.thread?.historyMode === "paginated") {
424
+ const turns = [], cursors = /* @__PURE__ */ new Set();
425
+ let cursor = null, bytes = 0, complete = false;
426
+ for (let page = 0; page < 100; page++) {
427
+ if (routing.forHost(operation.hostId) !== route)
428
+ throw new Error("Remote connection changed during read");
429
+ const response = await manager.sendRequest("thread/turns/list", {
430
+ threadId,
431
+ cursor,
432
+ limit: 50,
433
+ sortDirection: "asc",
434
+ itemsView: "full"
435
+ });
436
+ if (!Array.isArray(response.data) || response.nextCursor !== null && typeof response.nextCursor !== "string")
437
+ throw new Error("Invalid remote history page");
438
+ bytes += new TextEncoder().encode(JSON.stringify(response.data)).byteLength;
439
+ if (bytes > 14 * 1024 * 1024) throw new Error("Remote history exceeds the snapshot limit");
440
+ turns.push(...response.data);
441
+ cursor = response.nextCursor;
442
+ if (cursor === null) {
443
+ complete = true;
444
+ break;
445
+ }
446
+ if (cursors.has(cursor)) throw new Error("Remote history cursor repeated");
447
+ cursors.add(cursor);
448
+ }
449
+ if (!complete) throw new Error("Remote history exceeds the page limit");
450
+ result = { ...result, thread: { ...header.thread, turns } };
451
+ } else result = await manager.sendRequest("thread/read", { threadId, includeTurns: true });
452
+ if (routing.forHost(operation.hostId) !== route)
453
+ throw new Error("Remote connection changed during read");
454
+ let metadata = {};
455
+ if (header.thread) {
456
+ const cwd = header.thread.cwd;
457
+ try {
458
+ const configuration = await manager.sendRequest("codexhost/thread/inspect", {
459
+ threadId
460
+ });
461
+ if (routing.forHost(operation.hostId) !== route)
462
+ throw new Error("Remote connection changed during read");
463
+ metadata = {
464
+ configuration,
465
+ ...configuration.owner === "codex" ? {
466
+ nativeSettings: {
467
+ model: header.thread.model,
468
+ reasoningEffort: header.thread.reasoningEffort,
469
+ serviceTier: header.thread.serviceTier
470
+ }
471
+ } : {}
472
+ };
473
+ if (configuration.owner === "codex" && manager.getConversation) {
474
+ const conversation = await Promise.resolve().then(() => manager.getConversation?.(threadId)).catch(() => void 0);
475
+ if (routing.forHost(operation.hostId) !== route)
476
+ throw new Error("Remote connection changed during read");
477
+ const settings = conversation?.latestThreadSettings;
478
+ if (settings?.model === header.thread.model && typeof settings?.model === "string")
479
+ metadata.nativeSettings = {
480
+ model: settings.model,
481
+ reasoningEffort: header.thread.reasoningEffort === void 0 ? settings.effort : header.thread.reasoningEffort,
482
+ serviceTier: header.thread.serviceTier === void 0 ? settings.serviceTier : header.thread.serviceTier
483
+ };
484
+ }
485
+ if (configuration.owner === "codex" || configuration.owner === "external" && configuration.harnessId) {
486
+ const harnessId = configuration.owner === "codex" ? "codex" : configuration.harnessId ?? "codex", key = JSON.stringify([harnessId, cwd]);
487
+ const cache = generation.metadata ??= /* @__PURE__ */ new Map();
488
+ let discovery = cache.get(key);
489
+ if (!discovery || Date.now() >= discovery.retryAt) {
490
+ const loading = Promise.all([
491
+ Promise.resolve().then(() => {
492
+ if (routing.forHost(operation.hostId) !== route)
493
+ throw new Error("Remote connection changed during read");
494
+ return manager.sendRequest("codexhost/harness/inspect", {
495
+ harnessId,
496
+ ...cwd ? { cwd } : {}
497
+ });
498
+ }),
499
+ Promise.resolve().then(() => {
500
+ if (routing.forHost(operation.hostId) !== route)
501
+ throw new Error("Remote connection changed during read");
502
+ return manager.sendRequest("codexhost/harness/plugins/list", {});
503
+ }).catch(() => null)
504
+ ]).then(([inspection, catalog]) => {
505
+ if (inspection?.status !== "ready")
506
+ throw new Error("Remote Harness discovery is unavailable");
507
+ return {
508
+ inspection,
509
+ harness: catalog?.plugins?.find(
510
+ (p) => p.id === harnessId
511
+ )
512
+ };
513
+ });
514
+ const attempt = {
515
+ loading,
516
+ failures: discovery?.failures ?? 0,
517
+ retryAt: Infinity
518
+ };
519
+ void loading.catch(() => {
520
+ attempt.failures = Math.min(attempt.failures + 1, 4);
521
+ attempt.retryAt = Date.now() + Math.min(3e4, 5e3 * 2 ** (attempt.failures - 1));
522
+ });
523
+ discovery = attempt;
524
+ if (cache.size >= 64 && !cache.has(key)) {
525
+ const oldest = cache.keys().next().value;
526
+ if (oldest !== void 0) cache.delete(oldest);
527
+ }
528
+ cache.set(key, discovery);
529
+ }
530
+ metadata = { ...metadata, ...await discovery.loading };
531
+ }
532
+ } catch {
533
+ }
534
+ }
377
535
  if (routing.forHost(operation.hostId) !== route)
378
536
  throw new Error("Remote connection changed during read");
379
537
  const requests = await pendingRequests();
380
538
  return {
381
539
  result,
540
+ ...metadata,
382
541
  epoch: generation.epoch,
383
542
  interactionsAvailable: !!manager.getConversation && !!manager.replyWithCommandExecutionApprovalDecision && !!manager.replyWithFileChangeApprovalDecision,
384
543
  requests: requests.filter(
@@ -403,6 +562,34 @@ async function rendererRemoteSession(target2, operation) {
403
562
  return { accepted: true };
404
563
  }
405
564
  switch (operation.kind) {
565
+ case "configure": {
566
+ const configuration = await manager.sendRequest("codexhost/thread/inspect", {
567
+ threadId
568
+ });
569
+ if (routing.forHost(operation.hostId) !== route)
570
+ throw new Error("Remote connection changed during configuration");
571
+ if (configuration.owner !== "external" && configuration.owner !== "codex")
572
+ throw new Error("Remote Thread configuration is unavailable");
573
+ let method, params;
574
+ if (operation.modelId !== void 0) {
575
+ method = "codexhost/thread/model/select";
576
+ params = { threadId, model: { id: operation.modelId } };
577
+ } else if (operation.thinkingOptionId !== void 0) {
578
+ method = "codexhost/thread/thinking/select";
579
+ params = { threadId, thinkingOptionId: operation.thinkingOptionId };
580
+ } else {
581
+ method = "codexhost/thread/permission-mode/select";
582
+ params = { threadId, permissionModeId: operation.permissionModeId };
583
+ }
584
+ try {
585
+ const result = await manager.sendRequest(method, params);
586
+ if (routing.forHost(operation.hostId) !== route)
587
+ throw new Error("Remote connection changed during configuration");
588
+ return result;
589
+ } finally {
590
+ generation.metadata?.clear();
591
+ }
592
+ }
406
593
  case "prompt":
407
594
  await manager.sendRequest("thread/resume", { threadId });
408
595
  if (routing.forHost(operation.hostId) !== route)
@@ -15516,6 +15703,10 @@ var CLIENT_CHANNEL_VERSION = 1;
15516
15703
  var CLIENT_REQUEST_LIMIT_BYTES = 128 * 1024 * 1024;
15517
15704
  var clientThreadPinsSchema = external_exports.object({ threadIds: external_exports.array(external_exports.string().min(1)) }).strict();
15518
15705
  var clientThreadPinParamsSchema = external_exports.object({ threadId: external_exports.string().min(1).max(1024), pinned: external_exports.boolean() }).strict();
15706
+ var clientThreadTreeReadParamsSchema = external_exports.object({}).strict();
15707
+ var clientThreadTreeSchema = external_exports.object({
15708
+ parents: external_exports.record(external_exports.string().min(1), external_exports.string().min(1))
15709
+ }).strict();
15519
15710
  var clientProjectlessWorkspaceSchema = external_exports.object({
15520
15711
  prompt: external_exports.string().max(16384).optional()
15521
15712
  }).strict();
@@ -15532,6 +15723,11 @@ var clientChannelCursorSchema = external_exports.object({
15532
15723
  sequence: external_exports.number().int().nonnegative()
15533
15724
  });
15534
15725
  var clientChannelEventSchema = external_exports.discriminatedUnion("type", [
15726
+ external_exports.object({
15727
+ type: external_exports.literal("skills-changed"),
15728
+ cursor: clientChannelCursorSchema,
15729
+ cwd: external_exports.string().optional()
15730
+ }),
15535
15731
  external_exports.object({ type: external_exports.literal("display-settings-changed"), cursor: clientChannelCursorSchema }),
15536
15732
  external_exports.object({
15537
15733
  type: external_exports.literal("preferences-changed"),
@@ -15729,6 +15925,28 @@ var voiceTranscribeResultSchema = external_exports.discriminatedUnion("ok", [
15729
15925
  external_exports.object({ ok: external_exports.literal(false), error: external_exports.object({ code: voiceErrorCodeSchema }).strict() }).strict()
15730
15926
  ]);
15731
15927
 
15928
+ // packages/shared-contracts/dist/skills.js
15929
+ var skillsListParamsSchema = external_exports.object({
15930
+ threadId: hostThreadIdSchema.optional(),
15931
+ cwd: external_exports.string().min(1).optional()
15932
+ }).strict().refine((params) => !(params.threadId && params.cwd), {
15933
+ message: "Specify threadId or cwd, not both"
15934
+ });
15935
+ var librarySkillSchema = external_exports.object({
15936
+ name: external_exports.string().min(1).regex(/^[^\s[\]]+$/u),
15937
+ description: external_exports.string().optional(),
15938
+ path: external_exports.string().min(1),
15939
+ scope: external_exports.enum(["project", "global"]),
15940
+ source: external_exports.string().min(1)
15941
+ }).strict();
15942
+ var skillsListResultSchema = external_exports.object({
15943
+ revision: external_exports.number().int().nonnegative(),
15944
+ complete: external_exports.boolean(),
15945
+ skills: external_exports.array(librarySkillSchema),
15946
+ warnings: external_exports.array(external_exports.string()).optional()
15947
+ }).strict();
15948
+ var skillsChangedParamsSchema = external_exports.object({ cwd: external_exports.string().min(1).optional() }).strict();
15949
+
15732
15950
  // packages/shared-contracts/dist/web-access-tokens.js
15733
15951
  var webNetworkAccessUrlSchema = external_exports.object({
15734
15952
  /**
@@ -15835,8 +16053,8 @@ var REMOTE_THREAD_CONTROL_TIMEOUT_MS = 4e4;
15835
16053
  var delegationReadParamsSchema = external_exports.strictObject({
15836
16054
  threadId: external_exports.string().min(1).max(1024),
15837
16055
  view: external_exports.enum(["result", "messages"]),
15838
- cursor: external_exports.string().min(1).max(8192).optional(),
15839
- limit: external_exports.number().int().min(1).max(100).optional()
16056
+ from: external_exports.number().int().min(1).max(Number.MAX_SAFE_INTEGER).optional(),
16057
+ to: external_exports.number().int().min(1).max(Number.MAX_SAFE_INTEGER).optional()
15840
16058
  });
15841
16059
 
15842
16060
  // packages/shared-contracts/dist/credential-imports.js
@@ -16784,6 +17002,17 @@ var updateStatusResultSchema = external_exports.strictObject({
16784
17002
  status: updateStatusSchema.nullable()
16785
17003
  });
16786
17004
 
17005
+ // packages/shared-contracts/dist/thread-watch-notice.js
17006
+ var THREAD_WATCH_NOTICE_OUTCOMES = [
17007
+ "completed",
17008
+ "failed",
17009
+ "interrupted",
17010
+ "timedOut",
17011
+ "unreadable",
17012
+ "notFound"
17013
+ ];
17014
+ var ENTRY_PATTERN = new RegExp(String.raw`^- \[([^\]\n]+)\]\(thread://([^\s()<>"?#/]+)\): ` + `(${THREAD_WATCH_NOTICE_OUTCOMES.join("|")})(?:. (.+))?$`, "u");
17015
+
16787
17016
  // packages/shared-contracts/dist/remote-runtime.js
16788
17017
  var remoteUpdatePhaseSchema = external_exports.enum([
16789
17018
  "idle",
@@ -16831,6 +17060,14 @@ var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
16831
17060
  archived: external_exports.boolean()
16832
17061
  }),
16833
17062
  external_exports.strictObject({ kind: external_exports.literal("read"), ...thread }),
17063
+ external_exports.strictObject({
17064
+ kind: external_exports.literal("configure"),
17065
+ ...thread,
17066
+ epoch: identity,
17067
+ modelId: identity.optional(),
17068
+ thinkingOptionId: identity.optional(),
17069
+ permissionModeId: identity.optional()
17070
+ }).refine((value) => [value.modelId, value.thinkingOptionId, value.permissionModeId].filter((v) => v !== void 0).length === 1, "Select exactly one remote setting"),
16834
17071
  external_exports.strictObject({
16835
17072
  kind: external_exports.literal("prompt"),
16836
17073
  ...thread,
@@ -16903,6 +17140,13 @@ var remoteConnectionsReplySchema = external_exports.union([
16903
17140
  external_exports.strictObject({ error: external_exports.strictObject({ code: external_exports.number().int(), message: external_exports.string() }) })
16904
17141
  ]);
16905
17142
 
17143
+ // packages/shared-contracts/dist/thread-title.js
17144
+ var threadTitleInputSchema = external_exports.strictObject({
17145
+ prompt: external_exports.string().trim().min(1).max(2e3),
17146
+ cwd: external_exports.string().max(4096).nullable()
17147
+ });
17148
+ var threadTitleResultSchema = external_exports.string().trim().min(1).max(60).nullable();
17149
+
16906
17150
  // packages/shared-contracts/dist/web-ui-extensions.js
16907
17151
  var webUiExtensionIdSchema = external_exports.string().max(214).regex(/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/u);
16908
17152
  var localizedTextSchema2 = external_exports.union([
@@ -18470,8 +18714,9 @@ function installRendererHostRpcRouting(root, target2, dependencies) {
18470
18714
  model2 = carrier ? prewarmCarrier(carrier) : null;
18471
18715
  }
18472
18716
  if (!model2) return message;
18473
- if (path3[0] === "startConversation" && nativeModel?.startsWith("codexhost/") && nativeModel !== model2)
18474
- return message;
18717
+ if (path3[0] === "startConversation" && nativeModel?.startsWith("codexhost/"))
18718
+ model2 = nativeModel;
18719
+ const config2 = input.config == null ? { model: model2 } : isRecord3(input.config) ? { model: model2, ...input.config } : input.config;
18475
18720
  return [
18476
18721
  "push",
18477
18722
  [
@@ -18481,6 +18726,7 @@ function installRendererHostRpcRouting(root, target2, dependencies) {
18481
18726
  [
18482
18727
  {
18483
18728
  ...input,
18729
+ ...path3[0] === "startConversation" ? { config: config2 } : {},
18484
18730
  collaborationMode: { ...input.collaborationMode, settings: { ...settings, model: model2 } }
18485
18731
  },
18486
18732
  ...args.slice(1)
@@ -20142,6 +20388,7 @@ var TRANSIENT_INSTALL_ATTEMPTS = 3;
20142
20388
  var TRANSIENT_INSTALL_RETRY_MS = 250;
20143
20389
  var RECOVERY_RETRY_INITIAL_MS = 3e4;
20144
20390
  var RECOVERY_RETRY_MAX_MS = 3e5;
20391
+ var REMOTE_CONNECTION_RECOVERY_INTERVAL_MS = 5e3;
20145
20392
  var startupTraceStartedAt = Date.now();
20146
20393
  function startupTrace(stage, detail) {
20147
20394
  if (process.env.CODEXHOST_STARTUP_TRACE !== "1") return;
@@ -20315,6 +20562,21 @@ ${rendererSource}`,
20315
20562
  );
20316
20563
  return next;
20317
20564
  };
20565
+ let remoteRecovery;
20566
+ let nextRemoteRecoveryAt = 0;
20567
+ const restoreRemoteConnections = (current) => {
20568
+ if (signal.aborted || remoteRecovery || now() < nextRemoteRecoveryAt) return;
20569
+ nextRemoteRecoveryAt = now() + REMOTE_CONNECTION_RECOVERY_INTERVAL_MS;
20570
+ remoteRecovery = Promise.resolve().then(() => {
20571
+ if (!signal.aborted && session === current)
20572
+ return current.executeRenderer(
20573
+ remoteConnectionsExpression({ action: "session", operation: { kind: "hosts" } })
20574
+ );
20575
+ return void 0;
20576
+ }).catch(() => void 0).finally(() => {
20577
+ remoteRecovery = void 0;
20578
+ });
20579
+ };
20318
20580
  const resetSession = () => {
20319
20581
  session?.close();
20320
20582
  session = void 0;
@@ -20369,6 +20631,7 @@ ${rendererSource}`,
20369
20631
  try {
20370
20632
  session = await createSession();
20371
20633
  recordRecoverySuccess();
20634
+ restoreRemoteConnections(session);
20372
20635
  } catch (error51) {
20373
20636
  startupTrace("initial Renderer Session unavailable", error51);
20374
20637
  session = void 0;
@@ -20381,7 +20644,7 @@ ${rendererSource}`,
20381
20644
  await useSession(async () => {
20382
20645
  if (!session && now() < nextRecoveryAt) return;
20383
20646
  try {
20384
- await recoverSession();
20647
+ restoreRemoteConnections(await recoverSession());
20385
20648
  } catch {
20386
20649
  }
20387
20650
  });