@mariozechner/pi-coding-agent 0.49.2 → 0.49.3

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 (62) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +3 -2
  3. package/dist/cli/args.d.ts.map +1 -1
  4. package/dist/cli/args.js +1 -0
  5. package/dist/cli/args.js.map +1 -1
  6. package/dist/config.d.ts +2 -0
  7. package/dist/config.d.ts.map +1 -1
  8. package/dist/config.js +6 -0
  9. package/dist/config.js.map +1 -1
  10. package/dist/core/sdk.d.ts.map +1 -1
  11. package/dist/core/sdk.js +2 -2
  12. package/dist/core/sdk.js.map +1 -1
  13. package/dist/core/settings-manager.d.ts +5 -0
  14. package/dist/core/settings-manager.d.ts.map +1 -1
  15. package/dist/core/settings-manager.js +3 -0
  16. package/dist/core/settings-manager.js.map +1 -1
  17. package/dist/modes/interactive/components/assistant-message.d.ts +3 -2
  18. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  19. package/dist/modes/interactive/components/assistant-message.js +5 -3
  20. package/dist/modes/interactive/components/assistant-message.js.map +1 -1
  21. package/dist/modes/interactive/components/branch-summary-message.d.ts +3 -2
  22. package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -1
  23. package/dist/modes/interactive/components/branch-summary-message.js +4 -2
  24. package/dist/modes/interactive/components/branch-summary-message.js.map +1 -1
  25. package/dist/modes/interactive/components/compaction-summary-message.d.ts +3 -2
  26. package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -1
  27. package/dist/modes/interactive/components/compaction-summary-message.js +4 -2
  28. package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -1
  29. package/dist/modes/interactive/components/custom-message.d.ts +3 -2
  30. package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
  31. package/dist/modes/interactive/components/custom-message.js +4 -2
  32. package/dist/modes/interactive/components/custom-message.js.map +1 -1
  33. package/dist/modes/interactive/components/footer.d.ts.map +1 -1
  34. package/dist/modes/interactive/components/footer.js +5 -0
  35. package/dist/modes/interactive/components/footer.js.map +1 -1
  36. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  37. package/dist/modes/interactive/components/tool-execution.js +7 -0
  38. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  39. package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
  40. package/dist/modes/interactive/components/tree-selector.js +2 -2
  41. package/dist/modes/interactive/components/tree-selector.js.map +1 -1
  42. package/dist/modes/interactive/components/user-message.d.ts +2 -2
  43. package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
  44. package/dist/modes/interactive/components/user-message.js +2 -2
  45. package/dist/modes/interactive/components/user-message.js.map +1 -1
  46. package/dist/modes/interactive/interactive-mode.d.ts +5 -0
  47. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  48. package/dist/modes/interactive/interactive-mode.js +33 -13
  49. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  50. package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  51. package/dist/modes/interactive/theme/theme.js +7 -3
  52. package/dist/modes/interactive/theme/theme.js.map +1 -1
  53. package/dist/utils/shell.d.ts.map +1 -1
  54. package/dist/utils/shell.js +3 -2
  55. package/dist/utils/shell.js.map +1 -1
  56. package/examples/extensions/README.md +2 -0
  57. package/examples/extensions/antigravity-image-gen.ts +413 -0
  58. package/examples/extensions/inline-bash.ts +94 -0
  59. package/examples/extensions/space-invaders.ts +560 -0
  60. package/examples/extensions/with-deps/package-lock.json +2 -2
  61. package/examples/extensions/with-deps/package.json +1 -1
  62. package/package.json +4 -4
@@ -9,7 +9,7 @@ import * as path from "node:path";
9
9
  import { getOAuthProviders, } from "@mariozechner/pi-ai";
10
10
  import { CombinedAutocompleteProvider, Container, fuzzyFilter, Loader, Markdown, matchesKey, ProcessTerminal, Spacer, Text, TruncatedText, TUI, visibleWidth, } from "@mariozechner/pi-tui";
11
11
  import { spawn, spawnSync } from "child_process";
12
- import { APP_NAME, getAuthPath, getDebugLogPath, isBunBinary, isBunRuntime, VERSION } from "../../config.js";
12
+ import { APP_NAME, getAuthPath, getDebugLogPath, getShareViewerUrl, isBunBinary, isBunRuntime, VERSION, } from "../../config.js";
13
13
  import { FooterDataProvider } from "../../core/footer-data-provider.js";
14
14
  import { KeybindingsManager } from "../../core/keybindings.js";
15
15
  import { createCompactionSummaryMessage } from "../../core/messages.js";
@@ -280,7 +280,7 @@ export class InteractiveMode {
280
280
  else {
281
281
  this.ui.addChild(new Text(theme.bold(theme.fg("accent", "What's New")), 1, 0));
282
282
  this.ui.addChild(new Spacer(1));
283
- this.ui.addChild(new Markdown(this.changelogMarkdown.trim(), 1, 0, getMarkdownTheme()));
283
+ this.ui.addChild(new Markdown(this.changelogMarkdown.trim(), 1, 0, this.getMarkdownThemeWithSettings()));
284
284
  this.ui.addChild(new Spacer(1));
285
285
  }
286
286
  this.ui.addChild(new DynamicBorder());
@@ -313,8 +313,7 @@ export class InteractiveMode {
313
313
  this.ui.start();
314
314
  this.isInitialized = true;
315
315
  // Set terminal title
316
- const cwdBasename = path.basename(process.cwd());
317
- this.ui.terminal.setTitle(`pi - ${cwdBasename}`);
316
+ this.updateTerminalTitle();
318
317
  // Initialize extensions with TUI-based UI context
319
318
  await this.initExtensions();
320
319
  // Subscribe to agent events
@@ -330,6 +329,19 @@ export class InteractiveMode {
330
329
  this.ui.requestRender();
331
330
  });
332
331
  }
332
+ /**
333
+ * Update terminal title with session name and cwd.
334
+ */
335
+ updateTerminalTitle() {
336
+ const cwdBasename = path.basename(process.cwd());
337
+ const sessionName = this.sessionManager.getSessionName();
338
+ if (sessionName) {
339
+ this.ui.terminal.setTitle(`π - ${sessionName} - ${cwdBasename}`);
340
+ }
341
+ else {
342
+ this.ui.terminal.setTitle(`π - ${cwdBasename}`);
343
+ }
344
+ }
333
345
  /**
334
346
  * Run the interactive mode. This is the main entry point.
335
347
  * Initializes the UI, shows warnings, processes initial messages, and starts the interactive loop.
@@ -435,6 +447,12 @@ export class InteractiveMode {
435
447
  }
436
448
  return undefined;
437
449
  }
450
+ getMarkdownThemeWithSettings() {
451
+ return {
452
+ ...getMarkdownTheme(),
453
+ codeBlockIndent: this.settingsManager.getCodeBlockIndent(),
454
+ };
455
+ }
438
456
  // =========================================================================
439
457
  // Extension System
440
458
  // =========================================================================
@@ -509,6 +527,7 @@ export class InteractiveMode {
509
527
  },
510
528
  setSessionName: (name) => {
511
529
  this.sessionManager.appendSessionInfo(name);
530
+ this.updateTerminalTitle();
512
531
  },
513
532
  getSessionName: () => {
514
533
  return this.sessionManager.getSessionName();
@@ -1413,7 +1432,7 @@ export class InteractiveMode {
1413
1432
  this.ui.requestRender();
1414
1433
  }
1415
1434
  else if (event.message.role === "assistant") {
1416
- this.streamingComponent = new AssistantMessageComponent(undefined, this.hideThinkingBlock);
1435
+ this.streamingComponent = new AssistantMessageComponent(undefined, this.hideThinkingBlock, this.getMarkdownThemeWithSettings());
1417
1436
  this.streamingMessage = event.message;
1418
1437
  this.chatContainer.addChild(this.streamingComponent);
1419
1438
  this.streamingComponent.updateContent(this.streamingMessage);
@@ -1663,20 +1682,20 @@ export class InteractiveMode {
1663
1682
  case "custom": {
1664
1683
  if (message.display) {
1665
1684
  const renderer = this.session.extensionRunner?.getMessageRenderer(message.customType);
1666
- this.chatContainer.addChild(new CustomMessageComponent(message, renderer));
1685
+ this.chatContainer.addChild(new CustomMessageComponent(message, renderer, this.getMarkdownThemeWithSettings()));
1667
1686
  }
1668
1687
  break;
1669
1688
  }
1670
1689
  case "compactionSummary": {
1671
1690
  this.chatContainer.addChild(new Spacer(1));
1672
- const component = new CompactionSummaryMessageComponent(message);
1691
+ const component = new CompactionSummaryMessageComponent(message, this.getMarkdownThemeWithSettings());
1673
1692
  component.setExpanded(this.toolOutputExpanded);
1674
1693
  this.chatContainer.addChild(component);
1675
1694
  break;
1676
1695
  }
1677
1696
  case "branchSummary": {
1678
1697
  this.chatContainer.addChild(new Spacer(1));
1679
- const component = new BranchSummaryMessageComponent(message);
1698
+ const component = new BranchSummaryMessageComponent(message, this.getMarkdownThemeWithSettings());
1680
1699
  component.setExpanded(this.toolOutputExpanded);
1681
1700
  this.chatContainer.addChild(component);
1682
1701
  break;
@@ -1684,7 +1703,7 @@ export class InteractiveMode {
1684
1703
  case "user": {
1685
1704
  const textContent = this.getUserMessageText(message);
1686
1705
  if (textContent) {
1687
- const userComponent = new UserMessageComponent(textContent);
1706
+ const userComponent = new UserMessageComponent(textContent, this.getMarkdownThemeWithSettings());
1688
1707
  this.chatContainer.addChild(userComponent);
1689
1708
  if (options?.populateHistory) {
1690
1709
  this.editor.addToHistory?.(textContent);
@@ -1693,7 +1712,7 @@ export class InteractiveMode {
1693
1712
  break;
1694
1713
  }
1695
1714
  case "assistant": {
1696
- const assistantComponent = new AssistantMessageComponent(message, this.hideThinkingBlock);
1715
+ const assistantComponent = new AssistantMessageComponent(message, this.hideThinkingBlock, this.getMarkdownThemeWithSettings());
1697
1716
  this.chatContainer.addChild(assistantComponent);
1698
1717
  break;
1699
1718
  }
@@ -2840,7 +2859,7 @@ export class InteractiveMode {
2840
2859
  return;
2841
2860
  }
2842
2861
  // Create the preview URL
2843
- const previewUrl = `https://buildwithpi.ai/session/#${gistId}`;
2862
+ const previewUrl = getShareViewerUrl(gistId);
2844
2863
  this.showStatus(`Share URL: ${previewUrl}\nGist: ${gistUrl}`);
2845
2864
  }
2846
2865
  catch (error) {
@@ -2879,6 +2898,7 @@ export class InteractiveMode {
2879
2898
  return;
2880
2899
  }
2881
2900
  this.sessionManager.appendSessionInfo(name);
2901
+ this.updateTerminalTitle();
2882
2902
  this.chatContainer.addChild(new Spacer(1));
2883
2903
  this.chatContainer.addChild(new Text(theme.fg("dim", `Session name set: ${name}`), 1, 0));
2884
2904
  this.ui.requestRender();
@@ -2929,7 +2949,7 @@ export class InteractiveMode {
2929
2949
  this.chatContainer.addChild(new DynamicBorder());
2930
2950
  this.chatContainer.addChild(new Text(theme.bold(theme.fg("accent", "What's New")), 1, 0));
2931
2951
  this.chatContainer.addChild(new Spacer(1));
2932
- this.chatContainer.addChild(new Markdown(changelogMarkdown, 1, 1, getMarkdownTheme()));
2952
+ this.chatContainer.addChild(new Markdown(changelogMarkdown, 1, 1, this.getMarkdownThemeWithSettings()));
2933
2953
  this.chatContainer.addChild(new DynamicBorder());
2934
2954
  this.ui.requestRender();
2935
2955
  }
@@ -3048,7 +3068,7 @@ export class InteractiveMode {
3048
3068
  this.chatContainer.addChild(new DynamicBorder());
3049
3069
  this.chatContainer.addChild(new Text(theme.bold(theme.fg("accent", "Keyboard Shortcuts")), 1, 0));
3050
3070
  this.chatContainer.addChild(new Spacer(1));
3051
- this.chatContainer.addChild(new Markdown(hotkeys.trim(), 1, 1, getMarkdownTheme()));
3071
+ this.chatContainer.addChild(new Markdown(hotkeys.trim(), 1, 1, this.getMarkdownThemeWithSettings()));
3052
3072
  this.chatContainer.addChild(new DynamicBorder());
3053
3073
  this.ui.requestRender();
3054
3074
  }