@averyyy/pi-coding-agent 1.2.0-piclient.2 → 1.3.0-piclient.1

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 (143) hide show
  1. package/CHANGELOG.md +61 -0
  2. package/dist/bundle/chunks/anthropic-messages-3X7RGZOH.js +6 -0
  3. package/dist/bundle/chunks/{azure-openai-responses-ONC234KU.js → azure-openai-responses-NCLIAF3T.js} +1 -1
  4. package/dist/bundle/chunks/bedrock-converse-stream.js +5 -2
  5. package/dist/bundle/chunks/chunk-62UE2F77.js +11 -0
  6. package/dist/bundle/chunks/{chunk-OK5HMGJH.js → chunk-AHZ6SVN5.js} +1 -1
  7. package/dist/bundle/chunks/{chunk-RUVBX4HZ.js → chunk-HYJBDAY7.js} +39 -38
  8. package/dist/bundle/chunks/{chunk-MCRRDQUQ.js → chunk-JBOKZR45.js} +10 -10
  9. package/dist/bundle/chunks/{chunk-QNH5RXIC.js → chunk-LPK46NYT.js} +2 -2
  10. package/dist/bundle/chunks/{chunk-TRDNDS6A.js → chunk-PYGXRV27.js} +5 -2
  11. package/dist/bundle/chunks/{chunk-KHMP74W7.js → chunk-UQE6EICI.js} +1 -1
  12. package/dist/bundle/chunks/{execute-G3X3GRKI.js → execute-ZWI524ZI.js} +3 -3
  13. package/dist/bundle/chunks/{google-generative-ai-OPRBPNHR.js → google-generative-ai-MQTWSDFG.js} +1 -1
  14. package/dist/bundle/chunks/{google-vertex-VC2DWOR5.js → google-vertex-3SS26JHC.js} +1 -1
  15. package/dist/bundle/chunks/mistral-conversations-52JCPM2W.js +5 -0
  16. package/dist/bundle/chunks/{openai-codex-responses-NQKFQIGV.js → openai-codex-responses-2TJ4XIVX.js} +1 -1
  17. package/dist/bundle/chunks/{openai-completions-NNHMY5BP.js → openai-completions-UPWOEWKS.js} +1 -1
  18. package/dist/bundle/chunks/openai-responses-PWAHY2XA.js +3 -0
  19. package/dist/bundle/chunks/{pi-messages-EMTA6VNL.js → pi-messages-CCIZT6RQ.js} +1 -1
  20. package/dist/bundle/chunks/{virtual-modules-PGCF2Z7J.js → virtual-modules-AOQNHCN5.js} +1 -1
  21. package/dist/bundle/cli-runtime.js +1 -1
  22. package/dist/bundle/index.js +1 -1
  23. package/dist/bundle/rpc-entry.js +1 -1
  24. package/dist/cli/credential-print.d.ts.map +1 -1
  25. package/dist/cli/credential-print.js +4 -4
  26. package/dist/cli/credential-print.js.map +1 -1
  27. package/dist/cli/list-models.js +1 -1
  28. package/dist/cli/list-models.js.map +1 -1
  29. package/dist/core/agent-session-services.js +2 -1
  30. package/dist/core/agent-session-services.js.map +1 -1
  31. package/dist/core/agent-session.d.ts +4 -2
  32. package/dist/core/agent-session.d.ts.map +1 -1
  33. package/dist/core/agent-session.js +5 -4
  34. package/dist/core/agent-session.js.map +1 -1
  35. package/dist/core/cache-warmer.d.ts +1 -1
  36. package/dist/core/cache-warmer.d.ts.map +1 -1
  37. package/dist/core/cache-warmer.js +16 -8
  38. package/dist/core/cache-warmer.js.map +1 -1
  39. package/dist/core/exec.d.ts.map +1 -1
  40. package/dist/core/exec.js +43 -63
  41. package/dist/core/exec.js.map +1 -1
  42. package/dist/core/export-html/template.js +21 -16
  43. package/dist/core/extensions/runner.d.ts.map +1 -1
  44. package/dist/core/extensions/runner.js +7 -0
  45. package/dist/core/extensions/runner.js.map +1 -1
  46. package/dist/core/model-config.d.ts +24 -8
  47. package/dist/core/model-config.d.ts.map +1 -1
  48. package/dist/core/model-resolver.d.ts +56 -43
  49. package/dist/core/model-resolver.d.ts.map +1 -1
  50. package/dist/core/model-resolver.js +251 -356
  51. package/dist/core/model-resolver.js.map +1 -1
  52. package/dist/core/model-runtime.d.ts +1 -1
  53. package/dist/core/model-runtime.d.ts.map +1 -1
  54. package/dist/core/model-runtime.js +8 -11
  55. package/dist/core/model-runtime.js.map +1 -1
  56. package/dist/core/pi-client-runtime-update.d.ts +3 -1
  57. package/dist/core/pi-client-runtime-update.d.ts.map +1 -1
  58. package/dist/core/pi-client-runtime-update.js +11 -9
  59. package/dist/core/pi-client-runtime-update.js.map +1 -1
  60. package/dist/core/pi-server-client.d.ts.map +1 -1
  61. package/dist/core/pi-server-client.js +5 -3
  62. package/dist/core/pi-server-client.js.map +1 -1
  63. package/dist/core/prompt-templates.d.ts.map +1 -1
  64. package/dist/core/prompt-templates.js +7 -2
  65. package/dist/core/prompt-templates.js.map +1 -1
  66. package/dist/core/resource-loader.d.ts.map +1 -1
  67. package/dist/core/resource-loader.js +10 -18
  68. package/dist/core/resource-loader.js.map +1 -1
  69. package/dist/core/sdk.js +4 -4
  70. package/dist/core/sdk.js.map +1 -1
  71. package/dist/core/settings-defaults.d.ts +1 -0
  72. package/dist/core/settings-defaults.d.ts.map +1 -1
  73. package/dist/core/settings-defaults.js +1 -0
  74. package/dist/core/settings-defaults.js.map +1 -1
  75. package/dist/core/settings-manager.d.ts +4 -2
  76. package/dist/core/settings-manager.d.ts.map +1 -1
  77. package/dist/core/settings-manager.js +11 -0
  78. package/dist/core/settings-manager.js.map +1 -1
  79. package/dist/core/settings-schema.d.ts +2 -0
  80. package/dist/core/settings-schema.d.ts.map +1 -1
  81. package/dist/core/settings-schema.js +4 -0
  82. package/dist/core/settings-schema.js.map +1 -1
  83. package/dist/core/slash-commands.js +1 -1
  84. package/dist/core/slash-commands.js.map +1 -1
  85. package/dist/core/tools/render-utils.d.ts +2 -0
  86. package/dist/core/tools/render-utils.d.ts.map +1 -1
  87. package/dist/core/tools/render-utils.js +21 -0
  88. package/dist/core/tools/render-utils.js.map +1 -1
  89. package/dist/core/tools/renderers/read.d.ts.map +1 -1
  90. package/dist/core/tools/renderers/read.js +7 -11
  91. package/dist/core/tools/renderers/read.js.map +1 -1
  92. package/dist/extensions/codemode/execute.d.ts.map +1 -1
  93. package/dist/extensions/codemode/execute.js +12 -0
  94. package/dist/extensions/codemode/execute.js.map +1 -1
  95. package/dist/index.d.ts +1 -0
  96. package/dist/index.d.ts.map +1 -1
  97. package/dist/index.js +1 -0
  98. package/dist/index.js.map +1 -1
  99. package/dist/main.d.ts +1 -0
  100. package/dist/main.d.ts.map +1 -1
  101. package/dist/main.js +109 -10
  102. package/dist/main.js.map +1 -1
  103. package/dist/modes/interactive/components/settings-selector.d.ts +3 -1
  104. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  105. package/dist/modes/interactive/components/settings-selector.js +10 -0
  106. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  107. package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
  108. package/dist/modes/interactive/components/tree-selector.js +2 -9
  109. package/dist/modes/interactive/components/tree-selector.js.map +1 -1
  110. package/dist/modes/interactive/interactive-mode.d.ts +3 -0
  111. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  112. package/dist/modes/interactive/interactive-mode.js +86 -25
  113. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  114. package/dist/modes/interactive/session-share.d.ts.map +1 -1
  115. package/dist/modes/interactive/session-share.js +9 -2
  116. package/dist/modes/interactive/session-share.js.map +1 -1
  117. package/docs/cli.md +3 -3
  118. package/docs/codemode.md +2 -0
  119. package/docs/docs.json +4 -0
  120. package/docs/extensions.md +4 -2
  121. package/docs/llama-cpp.md +1 -1
  122. package/docs/nvidia-rtx-llama-cpp.md +96 -0
  123. package/docs/sessions.md +1 -1
  124. package/docs/settings.md +1 -0
  125. package/docs/usage.md +1 -1
  126. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  127. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  128. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  129. package/examples/extensions/gondolin/package-lock.json +2 -2
  130. package/examples/extensions/gondolin/package.json +1 -1
  131. package/examples/extensions/minimal-mode.ts +4 -5
  132. package/examples/extensions/sandbox/package-lock.json +2 -2
  133. package/examples/extensions/sandbox/package.json +1 -1
  134. package/examples/extensions/subagent/index.ts +4 -6
  135. package/examples/extensions/with-deps/package-lock.json +2 -2
  136. package/examples/extensions/with-deps/package.json +1 -1
  137. package/package.json +6 -6
  138. package/schemas/models.schema.json +5 -5
  139. package/schemas/settings.schema.json +18 -0
  140. package/dist/bundle/chunks/anthropic-messages-Y556A57W.js +0 -6
  141. package/dist/bundle/chunks/chunk-5UQLMALR.js +0 -11
  142. package/dist/bundle/chunks/mistral-conversations-JJ6S2EPK.js +0 -5
  143. package/dist/bundle/chunks/openai-responses-XDTCR5JC.js +0 -3
@@ -26,6 +26,7 @@ import { defaultModelPerProvider, findExactModelReferenceMatch, resolveModelScop
26
26
  import { CredentialSynchronizationError } from "../../core/model-runtime.js";
27
27
  import { DefaultPackageManager } from "../../core/package-manager.js";
28
28
  import { getCliBinName } from "../../core/pi-client-cli-adapter.js";
29
+ import { PI_CLIENT_RUNTIME_RELOAD_EXIT_CODE, readPiClientUpdateMarker, writePiClientRuntimeReloadState, } from "../../core/pi-client-runtime-update.js";
29
30
  import { RADIUS_MCP_URL, RADIUS_PROVIDER_ID } from "../../core/radius.js";
30
31
  import { formatMissingSessionCwdPrompt, MissingSessionCwdError } from "../../core/session-cwd.js";
31
32
  import { SessionManager, sessionEntryToContextMessages, } from "../../core/session-manager.js";
@@ -835,26 +836,32 @@ export class InteractiveMode {
835
836
  */
836
837
  async run() {
837
838
  await this.init();
839
+ const modelCatalogError = this.session.modelRuntime.getError();
840
+ const modelSelectionGuidance = process.env.PI_SERVER_MODE === "true" && (!this.session.model || isUnknownModel(this.session.model))
841
+ ? " Use /model to refresh catalogs and select a model."
842
+ : "";
838
843
  if (!process.env.PI_OFFLINE) {
839
844
  const controller = new AbortController();
840
845
  const timeout = setTimeout(() => controller.abort(), 15_000);
841
- const usesDevinModels = this.session.model?.provider === "devin" ||
842
- this.session.scopedModels.some(({ model }) => model.provider === "devin") ||
843
- (this.settingsManager.getEnabledModels()?.some((pattern) => pattern.toLowerCase().startsWith("devin/")) ??
844
- false);
845
846
  void refreshModelCatalogs(this.session.modelRuntime, controller.signal)
846
847
  .then((result) => {
847
848
  this.updateAvailableProviderCount();
848
- if (!usesDevinModels)
849
+ if (result.aborted)
849
850
  return;
850
- if (result.errors.has("devin")) {
851
- this.showWarning("Could not refresh the Devin model catalog; cached or built-in fallback models remain available.");
852
- }
853
- else if (result.aborted && controller.signal.aborted) {
854
- this.showWarning("Devin model catalog refresh timed out; cached or built-in fallback models remain available.");
851
+ for (const [provider, error] of result.errors) {
852
+ if (provider === "pi-server" &&
853
+ modelCatalogError &&
854
+ this.session.modelRuntime.getError() === modelCatalogError) {
855
+ continue;
856
+ }
857
+ this.showWarning(`Could not refresh ${provider} model catalog: ${error.message}${provider === "pi-server" ? modelSelectionGuidance : ""}`);
855
858
  }
856
859
  })
857
- .catch(() => { })
860
+ .catch((error) => {
861
+ if (controller.signal.aborted || (error instanceof Error && error.name === "AbortError"))
862
+ return;
863
+ this.showWarning(`Could not refresh model catalogs: ${error instanceof Error ? error.message : String(error)}${modelSelectionGuidance}`);
864
+ })
858
865
  .finally(() => clearTimeout(timeout));
859
866
  }
860
867
  // Start version check asynchronously
@@ -899,9 +906,8 @@ export class InteractiveMode {
899
906
  if (migratedProviders && migratedProviders.length > 0) {
900
907
  this.showWarning(`Migrated credentials to auth.json: ${migratedProviders.join(", ")}`);
901
908
  }
902
- const modelsJsonError = this.session.modelRuntime.getError();
903
- if (modelsJsonError) {
904
- this.showError(`models.json error: ${modelsJsonError}`);
909
+ if (modelCatalogError) {
910
+ this.showError(`Model catalog error: ${modelCatalogError}${modelSelectionGuidance}`);
905
911
  }
906
912
  if (modelFallbackMessage) {
907
913
  this.showWarning(modelFallbackMessage);
@@ -2429,13 +2435,15 @@ export class InteractiveMode {
2429
2435
  };
2430
2436
  return new Promise((resolve, reject) => {
2431
2437
  let component;
2438
+ let overlayHandle;
2432
2439
  let closed = false;
2433
2440
  const close = (result) => {
2434
2441
  if (closed)
2435
2442
  return;
2436
2443
  closed = true;
2444
+ // Remove this overlay, not the topmost one: another overlay may have opened above it.
2437
2445
  if (isOverlay)
2438
- this.ui.hideOverlay();
2446
+ overlayHandle?.hide();
2439
2447
  else
2440
2448
  restoreEditor();
2441
2449
  // Note: both branches above already call requestRender
@@ -2465,9 +2473,9 @@ export class InteractiveMode {
2465
2473
  const w = component.width;
2466
2474
  return w ? { width: w } : undefined;
2467
2475
  };
2468
- const handle = this.ui.showOverlay(component, resolveOptions());
2476
+ overlayHandle = this.ui.showOverlay(component, resolveOptions());
2469
2477
  // Expose handle to caller for visibility control
2470
- options?.onHandle?.(handle);
2478
+ options?.onHandle?.(overlayHandle);
2471
2479
  }
2472
2480
  else {
2473
2481
  this.disposeActiveSelector();
@@ -3701,7 +3709,7 @@ export class InteractiveMode {
3701
3709
  this.themeController.disableAutoSync();
3702
3710
  await this.ui.terminal.drainInput(1000);
3703
3711
  this.stop();
3704
- process.exit(0);
3712
+ process.exit(options.exitCode ?? 0);
3705
3713
  }
3706
3714
  // Interactive quit (Ctrl+D, Ctrl+C, /quit, extension shutdown()). Stop the
3707
3715
  // TUI before emitting shutdown events so extension UI cleanup cannot repaint
@@ -3712,11 +3720,13 @@ export class InteractiveMode {
3712
3720
  await this.ui.terminal.drainInput(1000);
3713
3721
  this.stop();
3714
3722
  await this.runtimeHost.dispose();
3715
- const resumeCommand = formatResumeCommand(this.sessionManager);
3716
- if (resumeCommand) {
3717
- process.stdout.write(`${chalk.dim("To resume this session:")} ${resumeCommand}\n`);
3723
+ if (options?.exitCode !== PI_CLIENT_RUNTIME_RELOAD_EXIT_CODE) {
3724
+ const resumeCommand = formatResumeCommand(this.sessionManager);
3725
+ if (resumeCommand) {
3726
+ process.stdout.write(`${chalk.dim("To resume this session:")} ${resumeCommand}\n`);
3727
+ }
3718
3728
  }
3719
- process.exit(0);
3729
+ process.exit(options?.exitCode ?? 0);
3720
3730
  }
3721
3731
  emergencyTerminalExit() {
3722
3732
  this.isShuttingDown = true;
@@ -4281,6 +4291,7 @@ export class InteractiveMode {
4281
4291
  steeringMode: this.session.steeringMode,
4282
4292
  followUpMode: this.session.followUpMode,
4283
4293
  transport: this.settingsManager.getTransport(),
4294
+ sessionShareDestination: this.settingsManager.getSessionShareDestination(),
4284
4295
  httpIdleTimeoutMs: this.settingsManager.getHttpIdleTimeoutMs(),
4285
4296
  cacheWarmingMode: this.settingsManager.getCacheWarmingMode(),
4286
4297
  thinkingLevel: this.settingsManager.getDefaultThinkingLevel() ?? DEFAULT_THINKING_LEVEL,
@@ -4351,6 +4362,9 @@ export class InteractiveMode {
4351
4362
  this.settingsManager.setTransport(transport);
4352
4363
  this.session.agent.transport = transport;
4353
4364
  },
4365
+ onSessionShareDestinationChange: (destination) => {
4366
+ this.settingsManager.setSessionShareDestination(destination);
4367
+ },
4354
4368
  onHttpIdleTimeoutMsChange: (timeoutMs) => {
4355
4369
  this.settingsManager.setHttpIdleTimeoutMs(timeoutMs);
4356
4370
  configureHttpDispatcher(timeoutMs);
@@ -5584,6 +5598,51 @@ export class InteractiveMode {
5584
5598
  // =========================================================================
5585
5599
  // Command handlers
5586
5600
  // =========================================================================
5601
+ async reloadUpdatedPiClientRuntime() {
5602
+ if (process.env.PI_SERVER_MODE !== "true")
5603
+ return false;
5604
+ try {
5605
+ const agentDir = this.runtimeHost.services.agentDir;
5606
+ const marker = readPiClientUpdateMarker(agentDir);
5607
+ if (!marker)
5608
+ return false;
5609
+ if (marker.updatedAt === process.env.PI_CLIENT_RUNTIME_UPDATED_AT)
5610
+ return false;
5611
+ const statePath = process.env.PI_CLIENT_RELOAD_STATE_PATH;
5612
+ if (!statePath) {
5613
+ throw new Error("Runtime reload requires the pi-client launcher. Restart this session with pi-client.");
5614
+ }
5615
+ if (!this.sessionManager.isPersisted()) {
5616
+ throw new Error("Runtime reload cannot resume a --no-session session. Start a persisted session to reload the runtime.");
5617
+ }
5618
+ if (this.session.isAborting ||
5619
+ this.session.isBashRunning ||
5620
+ this.session.pendingMessageCount > 0 ||
5621
+ this.pendingUserInputs.length > 0 ||
5622
+ this.compactionQueuedMessages.length > 0) {
5623
+ throw new Error("Finish pending input, bash commands, and cancellation before reloading the runtime.");
5624
+ }
5625
+ const sessionFile = this.sessionManager.getSessionFile();
5626
+ if (!fs.existsSync(sessionFile)) {
5627
+ this.sessionManager.replaceTree(this.sessionManager.getEntries(), this.sessionManager.getLeafId());
5628
+ }
5629
+ await this.settingsManager.flush();
5630
+ writePiClientRuntimeReloadState(statePath, {
5631
+ sessionId: this.sessionManager.getSessionId(),
5632
+ sessionDir: this.sessionManager.getSessionDir(),
5633
+ leafId: this.sessionManager.getLeafId(),
5634
+ args: this.options.runtimeReloadArgs ?? [],
5635
+ updatedAt: marker.updatedAt,
5636
+ });
5637
+ this.showStatus(`Restarting pi-client on ${marker.version}`);
5638
+ }
5639
+ catch (error) {
5640
+ this.showError(`Runtime reload failed: ${error instanceof Error ? error.message : String(error)}`);
5641
+ return true;
5642
+ }
5643
+ await this.shutdown({ exitCode: PI_CLIENT_RUNTIME_RELOAD_EXIT_CODE });
5644
+ return true;
5645
+ }
5587
5646
  async handleReloadCommand() {
5588
5647
  if (this.session.isStreaming) {
5589
5648
  this.showWarning("Wait for the current response to finish before reloading.");
@@ -5593,6 +5652,8 @@ export class InteractiveMode {
5593
5652
  this.showWarning("Wait for compaction to finish before reloading.");
5594
5653
  return;
5595
5654
  }
5655
+ if (await this.reloadUpdatedPiClientRuntime())
5656
+ return;
5596
5657
  this.resetExtensionUI();
5597
5658
  const reloadBox = new Container();
5598
5659
  const borderColor = (s) => theme.fg("border", s);
@@ -5643,9 +5704,9 @@ export class InteractiveMode {
5643
5704
  showDiagnosticsWhenQuiet: true,
5644
5705
  });
5645
5706
  const savedImplicitProjectTrust = this.maybeSaveImplicitProjectTrustAfterReload();
5646
- const modelsJsonError = this.session.modelRuntime.getError();
5647
- if (modelsJsonError) {
5648
- this.showError(`models.json error: ${modelsJsonError}`);
5707
+ const modelCatalogError = this.session.modelRuntime.getError();
5708
+ if (modelCatalogError) {
5709
+ this.showError(`Model catalog error: ${modelCatalogError}`);
5649
5710
  }
5650
5711
  this.showStatus(savedImplicitProjectTrust
5651
5712
  ? "Reloaded keybindings, extensions, skills, prompts, themes, and context files; saved project trust"