@hyperspaceng/neural-coding-agent 0.63.0 → 0.63.2

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 (100) hide show
  1. package/CHANGELOG.md +71 -0
  2. package/README.md +2 -2
  3. package/dist/core/agent-session.d.ts +9 -6
  4. package/dist/core/agent-session.d.ts.map +1 -1
  5. package/dist/core/agent-session.js +98 -54
  6. package/dist/core/agent-session.js.map +1 -1
  7. package/dist/core/auth-storage.d.ts +3 -1
  8. package/dist/core/auth-storage.d.ts.map +1 -1
  9. package/dist/core/auth-storage.js +5 -2
  10. package/dist/core/auth-storage.js.map +1 -1
  11. package/dist/core/compaction/branch-summarization.d.ts +2 -0
  12. package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
  13. package/dist/core/compaction/branch-summarization.js +2 -2
  14. package/dist/core/compaction/branch-summarization.js.map +1 -1
  15. package/dist/core/compaction/compaction.d.ts +3 -3
  16. package/dist/core/compaction/compaction.d.ts.map +1 -1
  17. package/dist/core/compaction/compaction.js +27 -26
  18. package/dist/core/compaction/compaction.js.map +1 -1
  19. package/dist/core/export-html/index.d.ts.map +1 -1
  20. package/dist/core/export-html/index.js +5 -4
  21. package/dist/core/export-html/index.js.map +1 -1
  22. package/dist/core/extensions/types.d.ts +7 -1
  23. package/dist/core/extensions/types.d.ts.map +1 -1
  24. package/dist/core/extensions/types.js.map +1 -1
  25. package/dist/core/model-registry.d.ts +18 -2
  26. package/dist/core/model-registry.d.ts.map +1 -1
  27. package/dist/core/model-registry.js +83 -69
  28. package/dist/core/model-registry.js.map +1 -1
  29. package/dist/core/model-resolver.d.ts.map +1 -1
  30. package/dist/core/model-resolver.js +4 -4
  31. package/dist/core/model-resolver.js.map +1 -1
  32. package/dist/core/package-manager.d.ts.map +1 -1
  33. package/dist/core/package-manager.js +88 -24
  34. package/dist/core/package-manager.js.map +1 -1
  35. package/dist/core/resolve-config-value.d.ts +6 -0
  36. package/dist/core/resolve-config-value.d.ts.map +1 -1
  37. package/dist/core/resolve-config-value.js +37 -5
  38. package/dist/core/resolve-config-value.js.map +1 -1
  39. package/dist/core/sdk.d.ts +1 -1
  40. package/dist/core/sdk.d.ts.map +1 -1
  41. package/dist/core/sdk.js +13 -22
  42. package/dist/core/sdk.js.map +1 -1
  43. package/dist/core/settings-manager.d.ts +2 -0
  44. package/dist/core/settings-manager.d.ts.map +1 -1
  45. package/dist/core/settings-manager.js +3 -0
  46. package/dist/core/settings-manager.js.map +1 -1
  47. package/dist/core/timings.d.ts +1 -0
  48. package/dist/core/timings.d.ts.map +1 -1
  49. package/dist/core/timings.js +6 -0
  50. package/dist/core/timings.js.map +1 -1
  51. package/dist/core/tools/edit-diff.d.ts +23 -1
  52. package/dist/core/tools/edit-diff.d.ts.map +1 -1
  53. package/dist/core/tools/edit-diff.js +150 -57
  54. package/dist/core/tools/edit-diff.js.map +1 -1
  55. package/dist/core/tools/edit.d.ts +18 -6
  56. package/dist/core/tools/edit.d.ts.map +1 -1
  57. package/dist/core/tools/edit.js +108 -59
  58. package/dist/core/tools/edit.js.map +1 -1
  59. package/dist/core/tools/file-mutation-queue.d.ts.map +1 -1
  60. package/dist/core/tools/file-mutation-queue.js +4 -4
  61. package/dist/core/tools/file-mutation-queue.js.map +1 -1
  62. package/dist/core/tools/index.d.ts +12 -4
  63. package/dist/core/tools/index.d.ts.map +1 -1
  64. package/dist/main.d.ts.map +1 -1
  65. package/dist/main.js +28 -10
  66. package/dist/main.js.map +1 -1
  67. package/dist/modes/interactive/components/bash-execution.d.ts +0 -1
  68. package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
  69. package/dist/modes/interactive/components/bash-execution.js +18 -5
  70. package/dist/modes/interactive/components/bash-execution.js.map +1 -1
  71. package/dist/modes/interactive/components/tool-execution.d.ts +0 -1
  72. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  73. package/dist/modes/interactive/components/tool-execution.js +2 -7
  74. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  75. package/dist/modes/interactive/interactive-mode.d.ts +0 -1
  76. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  77. package/dist/modes/interactive/interactive-mode.js +28 -65
  78. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  79. package/dist/modes/print-mode.d.ts +1 -1
  80. package/dist/modes/print-mode.d.ts.map +1 -1
  81. package/dist/modes/print-mode.js +83 -71
  82. package/dist/modes/print-mode.js.map +1 -1
  83. package/docs/development.md +3 -1
  84. package/docs/extensions.md +13 -2
  85. package/docs/models.md +6 -0
  86. package/docs/rpc.md +11 -2
  87. package/docs/settings.md +12 -0
  88. package/docs/skills.md +3 -2
  89. package/examples/extensions/custom-compaction.ts +17 -4
  90. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  91. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  92. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  93. package/examples/extensions/custom-provider-qwen-cli/package.json +1 -1
  94. package/examples/extensions/handoff.ts +5 -2
  95. package/examples/extensions/qna.ts +5 -2
  96. package/examples/extensions/summarize.ts +15 -4
  97. package/examples/extensions/trigger-compact.ts +11 -1
  98. package/examples/extensions/with-deps/package-lock.json +2 -2
  99. package/examples/extensions/with-deps/package.json +1 -1
  100. package/package.json +5 -4
@@ -312,7 +312,8 @@ export class InteractiveMode {
312
312
  hint("app.clipboard.pasteImage", "to paste image"),
313
313
  rawKeyHint("drop files", "to attach"),
314
314
  ].join("\n");
315
- this.builtInHeader = new Text(`${logo}\n${instructions}`, 1, 0);
315
+ const onboarding = theme.fg("dim", `Pi can explain its own features and look up its docs. Ask it how to use or extend Pi.`);
316
+ this.builtInHeader = new Text(`${logo}\n${instructions}\n\n${onboarding}`, 1, 0);
316
317
  // Setup UI layout
317
318
  this.headerContainer.addChild(new Spacer(1));
318
319
  this.headerContainer.addChild(this.builtInHeader);
@@ -999,10 +1000,8 @@ export class InteractiveMode {
999
1000
  compact: (options) => {
1000
1001
  void (async () => {
1001
1002
  try {
1002
- const result = await this.executeCompaction(options?.customInstructions, false);
1003
- if (result) {
1004
- options?.onComplete?.(result);
1005
- }
1003
+ const result = await this.session.compact(options?.customInstructions);
1004
+ options?.onComplete?.(result);
1006
1005
  }
1007
1006
  catch (error) {
1008
1007
  const err = error instanceof Error ? error : new Error(String(error));
@@ -1965,54 +1964,54 @@ export class InteractiveMode {
1965
1964
  await this.checkShutdownRequested();
1966
1965
  this.ui.requestRender();
1967
1966
  break;
1968
- case "auto_compaction_start": {
1967
+ case "compaction_start": {
1969
1968
  // Keep editor active; submissions are queued during compaction.
1970
- // Set up escape to abort auto-compaction
1971
1969
  this.autoCompactionEscapeHandler = this.defaultEditor.onEscape;
1972
1970
  this.defaultEditor.onEscape = () => {
1973
1971
  this.session.abortCompaction();
1974
1972
  };
1975
- // Show compacting indicator with reason
1976
1973
  this.statusContainer.clear();
1977
- const reasonText = event.reason === "overflow" ? "Context overflow detected, " : "";
1978
- this.autoCompactionLoader = new Loader(this.ui, (spinner) => theme.fg("accent", spinner), (text) => theme.fg("muted", text), `${reasonText}Auto-compacting... (${keyText("app.interrupt")} to cancel)`);
1974
+ const cancelHint = `(${keyText("app.interrupt")} to cancel)`;
1975
+ const label = event.reason === "manual"
1976
+ ? `Compacting context... ${cancelHint}`
1977
+ : `${event.reason === "overflow" ? "Context overflow detected, " : ""}Auto-compacting... ${cancelHint}`;
1978
+ this.autoCompactionLoader = new Loader(this.ui, (spinner) => theme.fg("accent", spinner), (text) => theme.fg("muted", text), label);
1979
1979
  this.statusContainer.addChild(this.autoCompactionLoader);
1980
1980
  this.ui.requestRender();
1981
1981
  break;
1982
1982
  }
1983
- case "auto_compaction_end": {
1984
- // Restore escape handler
1983
+ case "compaction_end": {
1985
1984
  if (this.autoCompactionEscapeHandler) {
1986
1985
  this.defaultEditor.onEscape = this.autoCompactionEscapeHandler;
1987
1986
  this.autoCompactionEscapeHandler = undefined;
1988
1987
  }
1989
- // Stop loader
1990
1988
  if (this.autoCompactionLoader) {
1991
1989
  this.autoCompactionLoader.stop();
1992
1990
  this.autoCompactionLoader = undefined;
1993
1991
  this.statusContainer.clear();
1994
1992
  }
1995
- // Handle result
1996
1993
  if (event.aborted) {
1997
- this.showStatus("Auto-compaction cancelled");
1994
+ if (event.reason === "manual") {
1995
+ this.showError("Compaction cancelled");
1996
+ }
1997
+ else {
1998
+ this.showStatus("Auto-compaction cancelled");
1999
+ }
1998
2000
  }
1999
2001
  else if (event.result) {
2000
- // Rebuild chat to show compacted state
2001
2002
  this.chatContainer.clear();
2002
2003
  this.rebuildChatFromMessages();
2003
- // Add compaction component at bottom so user sees it without scrolling
2004
- this.addMessageToChat({
2005
- role: "compactionSummary",
2006
- tokensBefore: event.result.tokensBefore,
2007
- summary: event.result.summary,
2008
- timestamp: Date.now(),
2009
- });
2004
+ this.addMessageToChat(createCompactionSummaryMessage(event.result.summary, event.result.tokensBefore, new Date().toISOString()));
2010
2005
  this.footer.invalidate();
2011
2006
  }
2012
2007
  else if (event.errorMessage) {
2013
- // Compaction failed (e.g., quota exceeded, API error)
2014
- this.chatContainer.addChild(new Spacer(1));
2015
- this.chatContainer.addChild(new Text(theme.fg("error", event.errorMessage), 1, 0));
2008
+ if (event.reason === "manual") {
2009
+ this.showError(event.errorMessage);
2010
+ }
2011
+ else {
2012
+ this.chatContainer.addChild(new Spacer(1));
2013
+ this.chatContainer.addChild(new Text(theme.fg("error", event.errorMessage), 1, 0));
2014
+ }
2016
2015
  }
2017
2016
  void this.flushCompactionQueue({ willRetry: event.willRetry });
2018
2017
  this.ui.requestRender();
@@ -3852,53 +3851,17 @@ export class InteractiveMode {
3852
3851
  this.showWarning("Nothing to compact (no messages yet)");
3853
3852
  return;
3854
3853
  }
3855
- await this.executeCompaction(customInstructions, false);
3856
- }
3857
- async executeCompaction(customInstructions, isAuto = false) {
3858
- // Stop loading animation
3859
3854
  if (this.loadingAnimation) {
3860
3855
  this.loadingAnimation.stop();
3861
3856
  this.loadingAnimation = undefined;
3862
3857
  }
3863
3858
  this.statusContainer.clear();
3864
- // Set up escape handler during compaction
3865
- const originalOnEscape = this.defaultEditor.onEscape;
3866
- this.defaultEditor.onEscape = () => {
3867
- this.session.abortCompaction();
3868
- };
3869
- // Show compacting status
3870
- this.chatContainer.addChild(new Spacer(1));
3871
- const cancelHint = `(${keyText("app.interrupt")} to cancel)`;
3872
- const label = isAuto ? `Auto-compacting context... ${cancelHint}` : `Compacting context... ${cancelHint}`;
3873
- const compactingLoader = new Loader(this.ui, (spinner) => theme.fg("accent", spinner), (text) => theme.fg("muted", text), label);
3874
- this.statusContainer.addChild(compactingLoader);
3875
- this.ui.requestRender();
3876
- let result;
3877
3859
  try {
3878
- result = await this.session.compact(customInstructions);
3879
- // Rebuild UI
3880
- this.rebuildChatFromMessages();
3881
- // Add compaction component at bottom so user sees it without scrolling
3882
- const msg = createCompactionSummaryMessage(result.summary, result.tokensBefore, new Date().toISOString());
3883
- this.addMessageToChat(msg);
3884
- this.footer.invalidate();
3885
- }
3886
- catch (error) {
3887
- const message = error instanceof Error ? error.message : String(error);
3888
- if (message === "Compaction cancelled" || (error instanceof Error && error.name === "AbortError")) {
3889
- this.showError("Compaction cancelled");
3890
- }
3891
- else {
3892
- this.showError(`Compaction failed: ${message}`);
3893
- }
3860
+ await this.session.compact(customInstructions);
3894
3861
  }
3895
- finally {
3896
- compactingLoader.stop();
3897
- this.statusContainer.clear();
3898
- this.defaultEditor.onEscape = originalOnEscape;
3862
+ catch {
3863
+ // Ignore, will be emitted as an event
3899
3864
  }
3900
- void this.flushCompactionQueue({ willRetry: false });
3901
- return result;
3902
3865
  }
3903
3866
  stop() {
3904
3867
  if (this.loadingAnimation) {