@aibyzero/byz 0.1.6 → 0.1.9

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 (29) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/cli.js +3 -16
  3. package/dist/conversation/conversation-extension.js +402 -0
  4. package/dist/conversation/interaction-policy.js +53 -0
  5. package/dist/conversation/routing-policy.js +102 -0
  6. package/dist/runtime/bundle/chunks/{chunk-SKWR5IN4.js → chunk-IUR2NDXL.js} +7 -7
  7. package/dist/runtime/bundle/cli.js +1 -1
  8. package/dist/runtime/bundle/index.js +1 -1
  9. package/dist/runtime/bundle/rpc-entry.js +1 -1
  10. package/dist/runtime/config.d.ts.map +1 -1
  11. package/dist/runtime/config.js +3 -3
  12. package/dist/runtime/config.js.map +1 -1
  13. package/dist/runtime/core/extensions/index.d.ts +1 -1
  14. package/dist/runtime/core/extensions/index.d.ts.map +1 -1
  15. package/dist/runtime/core/extensions/index.js.map +1 -1
  16. package/dist/runtime/core/extensions/runner.d.ts.map +1 -1
  17. package/dist/runtime/core/extensions/runner.js +3 -0
  18. package/dist/runtime/core/extensions/runner.js.map +1 -1
  19. package/dist/runtime/core/extensions/types.d.ts +17 -0
  20. package/dist/runtime/core/extensions/types.d.ts.map +1 -1
  21. package/dist/runtime/core/extensions/types.js.map +1 -1
  22. package/dist/runtime/modes/interactive/interactive-mode.d.ts +5 -0
  23. package/dist/runtime/modes/interactive/interactive-mode.d.ts.map +1 -1
  24. package/dist/runtime/modes/interactive/interactive-mode.js +59 -6
  25. package/dist/runtime/modes/interactive/interactive-mode.js.map +1 -1
  26. package/dist/runtime/modes/rpc/rpc-mode.d.ts.map +1 -1
  27. package/dist/runtime/modes/rpc/rpc-mode.js +9 -0
  28. package/dist/runtime/modes/rpc/rpc-mode.js.map +1 -1
  29. package/package.json +1 -1
@@ -281,6 +281,9 @@ export class InteractiveMode {
281
281
  // Streaming message tracking
282
282
  streamingComponent = undefined;
283
283
  streamingMessage = undefined;
284
+ messagePresenter;
285
+ confirmationPresenter;
286
+ toolExecutionVisible = true;
284
287
  // Tool execution tracking: toolCallId -> component
285
288
  pendingTools = new Map();
286
289
  // Tool output expansion state
@@ -695,7 +698,8 @@ export class InteractiveMode {
695
698
  this.isInitialized = true;
696
699
  await this.themeController.applyFromSettings();
697
700
  // Add header with keybindings from config (unless silenced)
698
- if (this.options.verbose || !this.settingsManager.getQuietStartup()) {
701
+ if (process.env.BYZ_CODING_AGENT !== "true" &&
702
+ (this.options.verbose || !this.settingsManager.getQuietStartup())) {
699
703
  const logo = theme.bold(theme.fg("accent", APP_NAME)) + theme.fg("dim", ` v${this.version}`);
700
704
  // Build startup instructions using keybinding hint helpers
701
705
  const hint = (keybinding, description) => keyHint(keybinding, description);
@@ -1514,7 +1518,9 @@ export class InteractiveMode {
1514
1518
  this.setupAutocompleteProvider();
1515
1519
  const extensionRunner = this.session.extensionRunner;
1516
1520
  this.setupExtensionShortcuts(extensionRunner);
1517
- this.showLoadedResources({ force: false, showDiagnosticsWhenQuiet: true });
1521
+ if (process.env.BYZ_CODING_AGENT !== "true") {
1522
+ this.showLoadedResources({ force: false, showDiagnosticsWhenQuiet: true });
1523
+ }
1518
1524
  this.showStartupNoticesIfNeeded();
1519
1525
  }
1520
1526
  applyFullscreenScrollbarSetting() {
@@ -1780,6 +1786,9 @@ export class InteractiveMode {
1780
1786
  this.activeStatusIndicator.setMessage(`${this.defaultWorkingMessage} (${keyText("app.interrupt")} to interrupt)`);
1781
1787
  }
1782
1788
  this.setHiddenThinkingLabel();
1789
+ this.messagePresenter = undefined;
1790
+ this.confirmationPresenter = undefined;
1791
+ this.toolExecutionVisible = true;
1783
1792
  }
1784
1793
  // Maximum total widget lines to prevent viewport overflow
1785
1794
  static MAX_WIDGET_LINES = 10;
@@ -1906,10 +1915,20 @@ export class InteractiveMode {
1906
1915
  },
1907
1916
  };
1908
1917
  }
1918
+ async showPresentedExtensionConfirm(title, message, opts) {
1919
+ if (!this.confirmationPresenter)
1920
+ return this.showExtensionConfirm(title, message, opts);
1921
+ return this.confirmationPresenter({
1922
+ title,
1923
+ message,
1924
+ options: opts,
1925
+ confirm: () => this.showExtensionConfirm(title, message, opts),
1926
+ });
1927
+ }
1909
1928
  createExtensionUIContext() {
1910
1929
  return {
1911
1930
  select: (title, options, opts) => this.showExtensionSelector(title, options, opts),
1912
- confirm: (title, message, opts) => this.showExtensionConfirm(title, message, opts),
1931
+ confirm: (title, message, opts) => this.showPresentedExtensionConfirm(title, message, opts),
1913
1932
  input: (title, placeholder, opts) => this.showExtensionInput(title, placeholder, opts),
1914
1933
  notify: (message, type) => this.showExtensionNotify(message, type),
1915
1934
  onTerminalInput: (handler) => this.addExtensionTerminalInputListener(handler),
@@ -1923,6 +1942,15 @@ export class InteractiveMode {
1923
1942
  setWorkingVisible: (visible) => this.setWorkingVisible(visible),
1924
1943
  setWorkingIndicator: (options) => this.setWorkingIndicator(options),
1925
1944
  setHiddenThinkingLabel: (label) => this.setHiddenThinkingLabel(label),
1945
+ setMessagePresenter: (presenter) => {
1946
+ this.messagePresenter = presenter;
1947
+ },
1948
+ setToolExecutionVisible: (visible) => {
1949
+ this.toolExecutionVisible = visible;
1950
+ },
1951
+ setConfirmationPresenter: (presenter) => {
1952
+ this.confirmationPresenter = presenter;
1953
+ },
1926
1954
  setWidget: (key, content, options) => this.setExtensionWidget(key, content, options),
1927
1955
  setFooter: (factory) => this.setExtensionFooter(factory),
1928
1956
  setHeader: (factory) => this.setExtensionHeader(factory),
@@ -2559,6 +2587,12 @@ export class InteractiveMode {
2559
2587
  await this.handleEvent(event);
2560
2588
  });
2561
2589
  }
2590
+ presentAssistantMessage(message) {
2591
+ if (!this.messagePresenter)
2592
+ return message;
2593
+ const presented = this.messagePresenter(structuredClone(message));
2594
+ return presented?.role === "assistant" ? presented : undefined;
2595
+ }
2562
2596
  async handleEvent(event) {
2563
2597
  if (!this.isInitialized) {
2564
2598
  await this.init();
@@ -2619,8 +2653,11 @@ export class InteractiveMode {
2619
2653
  this.ui.requestRender();
2620
2654
  }
2621
2655
  else if (event.message.role === "assistant") {
2656
+ const message = this.presentAssistantMessage(event.message);
2657
+ if (!message)
2658
+ break;
2622
2659
  this.streamingComponent = new AssistantMessageComponent(undefined, this.hideThinkingBlock, this.getMarkdownThemeWithSettings(), this.hiddenThinkingLabel, this.outputPad, this.getMarkdownTransformers());
2623
- this.streamingMessage = event.message;
2660
+ this.streamingMessage = message;
2624
2661
  this.chatContainer.addChild(this.streamingComponent);
2625
2662
  this.streamingComponent.updateContent(this.streamingMessage, true);
2626
2663
  this.ui.requestRender();
@@ -2628,7 +2665,14 @@ export class InteractiveMode {
2628
2665
  break;
2629
2666
  case "message_update":
2630
2667
  if (this.streamingComponent && event.message.role === "assistant") {
2631
- this.streamingMessage = event.message;
2668
+ const message = this.presentAssistantMessage(event.message);
2669
+ if (!message) {
2670
+ this.chatContainer.removeChild(this.streamingComponent);
2671
+ this.streamingComponent = undefined;
2672
+ this.streamingMessage = undefined;
2673
+ break;
2674
+ }
2675
+ this.streamingMessage = message;
2632
2676
  this.streamingComponent.updateContent(this.streamingMessage, true);
2633
2677
  for (const content of this.streamingMessage.content) {
2634
2678
  if (content.type === "toolCall") {
@@ -2656,7 +2700,14 @@ export class InteractiveMode {
2656
2700
  if (event.message.role === "user")
2657
2701
  break;
2658
2702
  if (this.streamingComponent && event.message.role === "assistant") {
2659
- this.streamingMessage = event.message;
2703
+ const message = this.presentAssistantMessage(event.message);
2704
+ if (!message) {
2705
+ this.chatContainer.removeChild(this.streamingComponent);
2706
+ this.streamingComponent = undefined;
2707
+ this.streamingMessage = undefined;
2708
+ break;
2709
+ }
2710
+ this.streamingMessage = message;
2660
2711
  let errorMessage;
2661
2712
  if (this.streamingMessage.stopReason === "aborted") {
2662
2713
  const retryAttempt = this.session.retryAttempt;
@@ -2696,6 +2747,8 @@ export class InteractiveMode {
2696
2747
  // The bash execution callback handles TUI output rendering.
2697
2748
  break;
2698
2749
  case "tool_execution_start": {
2750
+ if (!this.toolExecutionVisible)
2751
+ break;
2699
2752
  let component = this.pendingTools.get(event.toolCallId);
2700
2753
  if (!component) {
2701
2754
  component = new ToolExecutionComponent(event.toolName, event.toolCallId, event.args, {