@ashx-j/lunr 0.2.7 → 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 (59) 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/publication.json +3 -3
  27. package/dist/core/rollback.d.ts +1 -1
  28. package/dist/core/rollback.d.ts.map +1 -1
  29. package/dist/core/rollback.js +1 -1
  30. package/dist/core/rollback.js.map +1 -1
  31. package/dist/core/slash-commands.d.ts.map +1 -1
  32. package/dist/core/slash-commands.js +2 -1
  33. package/dist/core/slash-commands.js.map +1 -1
  34. package/dist/modes/interactive/components/assistant-message.d.ts +6 -1
  35. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  36. package/dist/modes/interactive/components/assistant-message.js +92 -64
  37. package/dist/modes/interactive/components/assistant-message.js.map +1 -1
  38. package/dist/modes/interactive/components/thinking-summary.d.ts +4 -4
  39. package/dist/modes/interactive/components/thinking-summary.d.ts.map +1 -1
  40. package/dist/modes/interactive/components/thinking-summary.js +7 -5
  41. package/dist/modes/interactive/components/thinking-summary.js.map +1 -1
  42. package/dist/modes/interactive/components/thinking-tail.d.ts.map +1 -1
  43. package/dist/modes/interactive/components/thinking-tail.js +5 -3
  44. package/dist/modes/interactive/components/thinking-tail.js.map +1 -1
  45. package/dist/modes/interactive/interactive-mode.d.ts +2 -0
  46. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  47. package/dist/modes/interactive/interactive-mode.js +42 -40
  48. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  49. package/docs/providers.md +2 -0
  50. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  51. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  52. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  53. package/examples/extensions/gondolin/package-lock.json +2 -2
  54. package/examples/extensions/gondolin/package.json +1 -1
  55. package/examples/extensions/sandbox/package-lock.json +2 -2
  56. package/examples/extensions/sandbox/package.json +1 -1
  57. package/examples/extensions/with-deps/package-lock.json +2 -2
  58. package/examples/extensions/with-deps/package.json +1 -1
  59. 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) {
@@ -5478,16 +5476,15 @@ export class InteractiveMode {
5478
5476
  this.setExtensionStatus("research", "research ● active");
5479
5477
  await this.sendUserMessageAfterDeferredBuiltins(buildResearchPrompt(question, depth, breadth));
5480
5478
  }
5481
- // lunr: /undo persists the rewind by forking the session to just before the
5482
- // last user message (same fork mechanism /rollback uses, but WITHOUT touching files).
5483
- // The branched session file survives restart/`-c`, so undone turns stay gone.
5484
- // /redo stays ephemeral and cannot redo across a fork, so the redo stack is cleared.
5485
- 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) {
5486
5483
  if (this.session.isStreaming) {
5487
- this.showWarning("Wait for the current response to finish before running /undo.");
5488
- return;
5484
+ this.showWarning(`Wait for the current response to finish before running /${command}.`);
5485
+ return undefined;
5489
5486
  }
5490
- // Find the last user message on the current branch (root leaf order)
5487
+ const nothingLabel = command === "undo" ? "Nothing to undo" : "Nothing to edit";
5491
5488
  const branch = this.sessionManager.getBranch();
5492
5489
  let lastUserIndex = -1;
5493
5490
  for (let i = branch.length - 1; i >= 0; i--) {
@@ -5498,17 +5495,16 @@ export class InteractiveMode {
5498
5495
  }
5499
5496
  }
5500
5497
  if (lastUserIndex === -1) {
5501
- this.showStatus("Nothing to undo");
5502
- return;
5498
+ this.showStatus(nothingLabel);
5499
+ return undefined;
5503
5500
  }
5504
5501
  const lastUser = branch[lastUserIndex];
5505
5502
  const leafId = this.sessionManager.getLeafId();
5506
5503
  let targetId;
5507
5504
  if (lastUser.id === leafId) {
5508
- // User message with no response yet (e.g. aborted stream) — undo to its parent.
5509
5505
  if (!lastUser.parentId) {
5510
- this.showStatus("Nothing to undo");
5511
- return;
5506
+ this.showStatus(nothingLabel);
5507
+ return undefined;
5512
5508
  }
5513
5509
  targetId = lastUser.parentId;
5514
5510
  }
@@ -5516,31 +5512,37 @@ export class InteractiveMode {
5516
5512
  targetId = lastUser.id;
5517
5513
  }
5518
5514
  try {
5519
- // Fork to just before the target — writes a branched session file so the
5520
- // rewind survives restart. Unlike /rollback, this must NOT touch files.
5521
- // lunr: fork teardown skips the rollback wipe (reason === "fork"), so carry
5522
- // the surviving snapshots over to the forked session id.
5523
- const oldSid = this.sessionManager.getSessionId();
5524
- const forkResult = await this.runtimeHost.fork(targetId, { position: "before" });
5525
- if (forkResult.cancelled) {
5526
- this.showStatus("Undo cancelled");
5527
- 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);
5528
5522
  }
5529
- migrateRollbackSession(oldSid, this.sessionManager.getSessionId());
5530
- // /redo cannot redo across a fork — clear the ephemeral redo stack.
5531
- this.redoStack.length = 0;
5532
5523
  this.chatContainer.clear();
5533
5524
  this.renderInitialMessages();
5534
- if (forkResult.selectedText && !this.editor.getText().trim()) {
5535
- this.editor.setText(forkResult.selectedText);
5536
- }
5537
- this.showStatus("Undone — branched session created (persistent). /redo unavailable after a fork.");
5538
5525
  void this.flushCompactionQueue({ willRetry: false });
5526
+ return { editorText: result.editorText };
5539
5527
  }
5540
5528
  catch (error) {
5541
5529
  this.showError(error instanceof Error ? error.message : String(error));
5530
+ return undefined;
5542
5531
  }
5543
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
+ }
5544
5546
  async handleRedoCommand() {
5545
5547
  if (this.session.isStreaming) {
5546
5548
  this.showWarning("Wait for the current response to finish before running /redo.");