@ashx-j/lunr 0.2.5 → 0.2.8

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 (68) hide show
  1. package/dist/builtin-extensions/pi-subagents/src/extension/control-notices.d.ts.map +1 -1
  2. package/dist/builtin-extensions/pi-subagents/src/extension/control-notices.js +2 -2
  3. package/dist/builtin-extensions/pi-subagents/src/extension/control-notices.js.map +1 -1
  4. package/dist/builtin-extensions/pi-subagents/src/extension/index.d.ts.map +1 -1
  5. package/dist/builtin-extensions/pi-subagents/src/extension/index.js +1 -7
  6. package/dist/builtin-extensions/pi-subagents/src/extension/index.js.map +1 -1
  7. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/execution.d.ts.map +1 -1
  8. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/execution.js +21 -0
  9. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/execution.js.map +1 -1
  10. package/dist/builtin-extensions/pi-subagents/src/shared/types.d.ts +1 -0
  11. package/dist/builtin-extensions/pi-subagents/src/shared/types.d.ts.map +1 -1
  12. package/dist/builtin-extensions/pi-subagents/src/shared/types.js.map +1 -1
  13. package/dist/builtin-extensions/pi-subagents/src/tui/render.d.ts +3 -0
  14. package/dist/builtin-extensions/pi-subagents/src/tui/render.d.ts.map +1 -1
  15. package/dist/builtin-extensions/pi-subagents/src/tui/render.js +9 -11
  16. package/dist/builtin-extensions/pi-subagents/src/tui/render.js.map +1 -1
  17. package/dist/catalog/models.json +1 -1
  18. package/dist/catalog/providers/github-copilot.json +1 -1
  19. package/dist/catalog/providers/google-vertex.json +1 -1
  20. package/dist/catalog/providers/google.json +1 -1
  21. package/dist/catalog/providers/nvidia.json +1 -1
  22. package/dist/catalog/providers/opencode-go.json +1 -1
  23. package/dist/catalog/providers/opencode.json +1 -1
  24. package/dist/catalog/providers/openrouter.json +1 -1
  25. package/dist/catalog/providers/vercel-ai-gateway.json +1 -1
  26. package/dist/catalog/providers/xai.json +1 -1
  27. package/dist/catalog/publication.json +3 -3
  28. package/dist/core/agent-session.d.ts +4 -1
  29. package/dist/core/agent-session.d.ts.map +1 -1
  30. package/dist/core/agent-session.js +26 -4
  31. package/dist/core/agent-session.js.map +1 -1
  32. package/dist/core/catalog-merge.d.ts +1 -1
  33. package/dist/core/catalog-merge.d.ts.map +1 -1
  34. package/dist/core/catalog-merge.js +2 -1
  35. package/dist/core/catalog-merge.js.map +1 -1
  36. package/dist/core/rollback.d.ts +1 -1
  37. package/dist/core/rollback.d.ts.map +1 -1
  38. package/dist/core/rollback.js +1 -1
  39. package/dist/core/rollback.js.map +1 -1
  40. package/dist/core/slash-commands.d.ts.map +1 -1
  41. package/dist/core/slash-commands.js +2 -1
  42. package/dist/core/slash-commands.js.map +1 -1
  43. package/dist/modes/interactive/components/assistant-message.d.ts +6 -1
  44. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  45. package/dist/modes/interactive/components/assistant-message.js +92 -64
  46. package/dist/modes/interactive/components/assistant-message.js.map +1 -1
  47. package/dist/modes/interactive/components/thinking-summary.d.ts +4 -4
  48. package/dist/modes/interactive/components/thinking-summary.d.ts.map +1 -1
  49. package/dist/modes/interactive/components/thinking-summary.js +7 -5
  50. package/dist/modes/interactive/components/thinking-summary.js.map +1 -1
  51. package/dist/modes/interactive/components/thinking-tail.d.ts.map +1 -1
  52. package/dist/modes/interactive/components/thinking-tail.js +5 -3
  53. package/dist/modes/interactive/components/thinking-tail.js.map +1 -1
  54. package/dist/modes/interactive/interactive-mode.d.ts +2 -0
  55. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  56. package/dist/modes/interactive/interactive-mode.js +43 -40
  57. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  58. package/docs/providers.md +2 -0
  59. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  60. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  61. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  62. package/examples/extensions/gondolin/package-lock.json +2 -2
  63. package/examples/extensions/gondolin/package.json +1 -1
  64. package/examples/extensions/sandbox/package-lock.json +2 -2
  65. package/examples/extensions/sandbox/package.json +1 -1
  66. package/examples/extensions/with-deps/package-lock.json +2 -2
  67. package/examples/extensions/with-deps/package.json +1 -1
  68. package/package.json +4 -4
@@ -350,7 +350,7 @@ export class InteractiveMode {
350
350
  resetPermissions(this.settingsManager.getDefaultPermissionMode());
351
351
  // lunr: clear process registry and rollback state
352
352
  processRegistry.clearRegistry();
353
- // lunr: on fork (/rollback, /undo, tree navigation) the snapshots SURVIVE —
353
+ // lunr: on fork (/rollback, tree navigation) the snapshots SURVIVE —
354
354
  // the caller migrates them to the forked session id (migrateRollbackSession).
355
355
  // Any other replacement wipes only the session being torn down.
356
356
  if (reason !== "fork") {
@@ -366,11 +366,6 @@ export class InteractiveMode {
366
366
  this.version = VERSION;
367
367
  this.ui = new TUI(new ProcessTerminal(), this.settingsManager.getShowHardwareCursor());
368
368
  this.ui.setClearOnShrink(this.settingsManager.getClearOnShrink());
369
- this.ui.onTextSelected = (text) => {
370
- void copyToClipboard(text)
371
- .then(() => this.showStatus("Copied."))
372
- .catch((error) => this.showError(error instanceof Error ? error.message : String(error)));
373
- };
374
369
  // lunr: register the permission-mode footer bridge (provider-side: InteractiveMode owns the state).
375
370
  registerPermissionModeBridge(() => getPermissionMode());
376
371
  registerPermissionModeControlBridge({
@@ -2300,6 +2295,11 @@ export class InteractiveMode {
2300
2295
  await this.handleUndoCommand();
2301
2296
  return;
2302
2297
  }
2298
+ if (text === "/edit") {
2299
+ this.editor.setText("");
2300
+ await this.handleEditCommand();
2301
+ return;
2302
+ }
2303
2303
  if (text === "/redo") {
2304
2304
  this.editor.setText("");
2305
2305
  await this.handleRedoCommand();
@@ -2475,7 +2475,7 @@ export class InteractiveMode {
2475
2475
  return;
2476
2476
  const opts = this.getSmoothStreamingOptions();
2477
2477
  const revealed = sliceMessageContent(target, this.streamingDisplayedLength, opts);
2478
- this.streamingComponent.updateContent(revealed);
2478
+ this.streamingComponent.updateContent(revealed, { thinkingSource: target });
2479
2479
  this.syncRevealedStreamingTools(revealed, target);
2480
2480
  this.ui.requestRender();
2481
2481
  }
@@ -2635,7 +2635,7 @@ export class InteractiveMode {
2635
2635
  this.streamingDisplayedLength = 0;
2636
2636
  this.chatContainer.addChild(this.streamingComponent);
2637
2637
  if (this.settingsManager.getSmoothStreaming()) {
2638
- this.streamingComponent.updateContent(sliceMessageContent(this.streamingMessage, 0, this.getSmoothStreamingOptions()));
2638
+ this.streamingComponent.updateContent(sliceMessageContent(this.streamingMessage, 0, this.getSmoothStreamingOptions()), { thinkingSource: this.streamingMessage });
2639
2639
  }
2640
2640
  else {
2641
2641
  this.streamingComponent.updateContent(this.streamingMessage);
@@ -2721,9 +2721,7 @@ export class InteractiveMode {
2721
2721
  case "tool_execution_start": {
2722
2722
  // If smooth streaming still has leading text unrevealed, flush through
2723
2723
  // this tool so the running card is not hidden behind the typewriter.
2724
- if (this.settingsManager.getSmoothStreaming() &&
2725
- this.streamingTargetMessage &&
2726
- this.streamingComponent) {
2724
+ if (this.settingsManager.getSmoothStreaming() && this.streamingTargetMessage && this.streamingComponent) {
2727
2725
  const opts = this.getSmoothStreamingOptions();
2728
2726
  const needed = countGraphemesBeforeToolCall(this.streamingTargetMessage, event.toolCallId, opts);
2729
2727
  if (this.streamingDisplayedLength < needed) {
@@ -4136,6 +4134,7 @@ export class InteractiveMode {
4136
4134
  ollama = `ollama-cloud refresh failed: ${error instanceof Error ? error.message : String(error)}`;
4137
4135
  }
4138
4136
  }
4137
+ this.session.refreshModelFromRegistry();
4139
4138
  this.showStatus(formatCatalogRefreshSummary({
4140
4139
  official: result.official
4141
4140
  ? {
@@ -5477,16 +5476,15 @@ export class InteractiveMode {
5477
5476
  this.setExtensionStatus("research", "research ● active");
5478
5477
  await this.sendUserMessageAfterDeferredBuiltins(buildResearchPrompt(question, depth, breadth));
5479
5478
  }
5480
- // lunr: /undo persists the rewind by forking the session to just before the
5481
- // last user message (same fork mechanism /rollback uses, but WITHOUT touching files).
5482
- // The branched session file survives restart/`-c`, so undone turns stay gone.
5483
- // /redo stays ephemeral and cannot redo across a fork, so the redo stack is cleared.
5484
- async handleUndoCommand() {
5479
+ // lunr: /undo and /edit rewind the same session via navigateTree (no fork).
5480
+ // /undo leaves the editor alone; /edit pastes the undone user text. /redo
5481
+ // pops the previous leaf and navigates back.
5482
+ async rewindLastTurn(command) {
5485
5483
  if (this.session.isStreaming) {
5486
- this.showWarning("Wait for the current response to finish before running /undo.");
5487
- return;
5484
+ this.showWarning(`Wait for the current response to finish before running /${command}.`);
5485
+ return undefined;
5488
5486
  }
5489
- // Find the last user message on the current branch (root leaf order)
5487
+ const nothingLabel = command === "undo" ? "Nothing to undo" : "Nothing to edit";
5490
5488
  const branch = this.sessionManager.getBranch();
5491
5489
  let lastUserIndex = -1;
5492
5490
  for (let i = branch.length - 1; i >= 0; i--) {
@@ -5497,17 +5495,16 @@ export class InteractiveMode {
5497
5495
  }
5498
5496
  }
5499
5497
  if (lastUserIndex === -1) {
5500
- this.showStatus("Nothing to undo");
5501
- return;
5498
+ this.showStatus(nothingLabel);
5499
+ return undefined;
5502
5500
  }
5503
5501
  const lastUser = branch[lastUserIndex];
5504
5502
  const leafId = this.sessionManager.getLeafId();
5505
5503
  let targetId;
5506
5504
  if (lastUser.id === leafId) {
5507
- // User message with no response yet (e.g. aborted stream) — undo to its parent.
5508
5505
  if (!lastUser.parentId) {
5509
- this.showStatus("Nothing to undo");
5510
- return;
5506
+ this.showStatus(nothingLabel);
5507
+ return undefined;
5511
5508
  }
5512
5509
  targetId = lastUser.parentId;
5513
5510
  }
@@ -5515,31 +5512,37 @@ export class InteractiveMode {
5515
5512
  targetId = lastUser.id;
5516
5513
  }
5517
5514
  try {
5518
- // Fork to just before the target — writes a branched session file so the
5519
- // rewind survives restart. Unlike /rollback, this must NOT touch files.
5520
- // lunr: fork teardown skips the rollback wipe (reason === "fork"), so carry
5521
- // the surviving snapshots over to the forked session id.
5522
- const oldSid = this.sessionManager.getSessionId();
5523
- const forkResult = await this.runtimeHost.fork(targetId, { position: "before" });
5524
- if (forkResult.cancelled) {
5525
- this.showStatus("Undo cancelled");
5526
- return;
5515
+ const result = await this.session.navigateTree(targetId, {});
5516
+ if (result.cancelled) {
5517
+ this.showStatus(command === "undo" ? "Undo cancelled" : "Edit cancelled");
5518
+ return undefined;
5519
+ }
5520
+ if (leafId) {
5521
+ this.redoStack.push(leafId);
5527
5522
  }
5528
- migrateRollbackSession(oldSid, this.sessionManager.getSessionId());
5529
- // /redo cannot redo across a fork — clear the ephemeral redo stack.
5530
- this.redoStack.length = 0;
5531
5523
  this.chatContainer.clear();
5532
5524
  this.renderInitialMessages();
5533
- if (forkResult.selectedText && !this.editor.getText().trim()) {
5534
- this.editor.setText(forkResult.selectedText);
5535
- }
5536
- this.showStatus("Undone — branched session created (persistent). /redo unavailable after a fork.");
5537
5525
  void this.flushCompactionQueue({ willRetry: false });
5526
+ return { editorText: result.editorText };
5538
5527
  }
5539
5528
  catch (error) {
5540
5529
  this.showError(error instanceof Error ? error.message : String(error));
5530
+ return undefined;
5541
5531
  }
5542
5532
  }
5533
+ async handleUndoCommand() {
5534
+ const result = await this.rewindLastTurn("undo");
5535
+ if (!result)
5536
+ return;
5537
+ this.showStatus("Undone. /redo to restore.");
5538
+ }
5539
+ async handleEditCommand() {
5540
+ const result = await this.rewindLastTurn("edit");
5541
+ if (!result)
5542
+ return;
5543
+ this.editor.setText(result.editorText ?? "");
5544
+ this.showStatus("Editing last message. /redo to restore.");
5545
+ }
5543
5546
  async handleRedoCommand() {
5544
5547
  if (this.session.isStreaming) {
5545
5548
  this.showWarning("Wait for the current response to finish before running /redo.");