@mariozechner/pi-coding-agent 0.59.0 → 0.60.0

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 (72) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/README.md +14 -1
  3. package/dist/bun/cli.d.ts +3 -0
  4. package/dist/bun/cli.d.ts.map +1 -0
  5. package/dist/bun/cli.js +6 -0
  6. package/dist/bun/cli.js.map +1 -0
  7. package/dist/bun/register-bedrock.d.ts +2 -0
  8. package/dist/bun/register-bedrock.d.ts.map +1 -0
  9. package/dist/bun/register-bedrock.js +85 -0
  10. package/dist/bun/register-bedrock.js.map +1 -0
  11. package/dist/cli/args.d.ts +1 -0
  12. package/dist/cli/args.d.ts.map +1 -1
  13. package/dist/cli/args.js +4 -0
  14. package/dist/cli/args.js.map +1 -1
  15. package/dist/cli/initial-message.d.ts +18 -0
  16. package/dist/cli/initial-message.d.ts.map +1 -0
  17. package/dist/cli/initial-message.js +22 -0
  18. package/dist/cli/initial-message.js.map +1 -0
  19. package/dist/cli.d.ts.map +1 -1
  20. package/dist/cli.js +0 -3
  21. package/dist/cli.js.map +1 -1
  22. package/dist/core/agent-session.d.ts +1 -0
  23. package/dist/core/agent-session.d.ts.map +1 -1
  24. package/dist/core/agent-session.js +22 -2
  25. package/dist/core/agent-session.js.map +1 -1
  26. package/dist/core/bash-executor.d.ts +6 -7
  27. package/dist/core/bash-executor.d.ts.map +1 -1
  28. package/dist/core/bash-executor.js +8 -107
  29. package/dist/core/bash-executor.js.map +1 -1
  30. package/dist/core/extensions/runner.d.ts +5 -2
  31. package/dist/core/extensions/runner.d.ts.map +1 -1
  32. package/dist/core/extensions/runner.js +21 -4
  33. package/dist/core/extensions/runner.js.map +1 -1
  34. package/dist/core/keybindings.d.ts +3 -0
  35. package/dist/core/keybindings.d.ts.map +1 -1
  36. package/dist/core/keybindings.js +21 -11
  37. package/dist/core/keybindings.js.map +1 -1
  38. package/dist/core/package-manager.d.ts +15 -1
  39. package/dist/core/package-manager.d.ts.map +1 -1
  40. package/dist/core/package-manager.js +194 -15
  41. package/dist/core/package-manager.js.map +1 -1
  42. package/dist/core/slash-commands.d.ts.map +1 -1
  43. package/dist/core/slash-commands.js +1 -1
  44. package/dist/core/slash-commands.js.map +1 -1
  45. package/dist/core/tools/bash.d.ts +8 -0
  46. package/dist/core/tools/bash.d.ts.map +1 -1
  47. package/dist/core/tools/bash.js +75 -69
  48. package/dist/core/tools/bash.js.map +1 -1
  49. package/dist/core/tools/index.d.ts +1 -1
  50. package/dist/core/tools/index.d.ts.map +1 -1
  51. package/dist/core/tools/index.js +1 -1
  52. package/dist/core/tools/index.js.map +1 -1
  53. package/dist/index.d.ts +1 -1
  54. package/dist/index.d.ts.map +1 -1
  55. package/dist/index.js +1 -1
  56. package/dist/index.js.map +1 -1
  57. package/dist/main.d.ts.map +1 -1
  58. package/dist/main.js +50 -19
  59. package/dist/main.js.map +1 -1
  60. package/dist/modes/interactive/interactive-mode.d.ts +2 -0
  61. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  62. package/dist/modes/interactive/interactive-mode.js +50 -6
  63. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  64. package/docs/extensions.md +15 -1
  65. package/docs/keybindings.md +2 -0
  66. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  67. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  68. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  69. package/examples/extensions/custom-provider-qwen-cli/package.json +1 -1
  70. package/examples/extensions/with-deps/package-lock.json +2 -2
  71. package/examples/extensions/with-deps/package.json +1 -1
  72. package/package.json +5 -5
@@ -8,12 +8,13 @@ import * as os from "node:os";
8
8
  import * as path from "node:path";
9
9
  import { CombinedAutocompleteProvider, Container, fuzzyFilter, Loader, Markdown, matchesKey, ProcessTerminal, Spacer, Text, TruncatedText, TUI, visibleWidth, } from "@mariozechner/pi-tui";
10
10
  import { spawn, spawnSync } from "child_process";
11
- import { APP_NAME, getAuthPath, getDebugLogPath, getShareViewerUrl, getUpdateInstruction, VERSION, } from "../../config.js";
11
+ import { APP_NAME, getAgentDir, getAuthPath, getDebugLogPath, getShareViewerUrl, getUpdateInstruction, VERSION, } from "../../config.js";
12
12
  import { parseSkillBlock } from "../../core/agent-session.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";
16
16
  import { findExactModelReferenceMatch, resolveModelScope } from "../../core/model-resolver.js";
17
+ import { DefaultPackageManager } from "../../core/package-manager.js";
17
18
  import { SessionManager } from "../../core/session-manager.js";
18
19
  import { BUILTIN_SLASH_COMMANDS } from "../../core/slash-commands.js";
19
20
  import { getChangelogPath, getNewEntries, parseChangelog } from "../../utils/changelog.js";
@@ -360,6 +361,12 @@ export class InteractiveMode {
360
361
  this.showNewVersionNotification(newVersion);
361
362
  }
362
363
  });
364
+ // Start package update check asynchronously
365
+ this.checkForPackageUpdates().then((updates) => {
366
+ if (updates.length > 0) {
367
+ this.showPackageUpdateNotification(updates);
368
+ }
369
+ });
363
370
  // Check tmux keyboard setup asynchronously
364
371
  this.checkTmuxKeyboardSetup().then((warning) => {
365
372
  if (warning) {
@@ -434,6 +441,23 @@ export class InteractiveMode {
434
441
  return undefined;
435
442
  }
436
443
  }
444
+ async checkForPackageUpdates() {
445
+ if (process.env.PI_OFFLINE) {
446
+ return [];
447
+ }
448
+ try {
449
+ const packageManager = new DefaultPackageManager({
450
+ cwd: process.cwd(),
451
+ agentDir: getAgentDir(),
452
+ settingsManager: this.settingsManager,
453
+ });
454
+ const updates = await packageManager.checkForAvailableUpdates();
455
+ return updates.map((update) => update.displayName);
456
+ }
457
+ catch {
458
+ return [];
459
+ }
460
+ }
437
461
  async checkTmuxKeyboardSetup() {
438
462
  if (!process.env.TMUX)
439
463
  return undefined;
@@ -464,6 +488,9 @@ export class InteractiveMode {
464
488
  runTmuxShow("extended-keys"),
465
489
  runTmuxShow("extended-keys-format"),
466
490
  ]);
491
+ // If we couldn't query tmux (timeout, sandbox, etc.), don't warn
492
+ if (extendedKeys === undefined)
493
+ return undefined;
467
494
  if (extendedKeys !== "on" && extendedKeys !== "always") {
468
495
  return "tmux extended-keys is off. Modified Enter keys may not work. Add `set -g extended-keys on` to ~/.tmux.conf and restart tmux.";
469
496
  }
@@ -2397,6 +2424,16 @@ export class InteractiveMode {
2397
2424
  this.chatContainer.addChild(new DynamicBorder((text) => theme.fg("warning", text)));
2398
2425
  this.ui.requestRender();
2399
2426
  }
2427
+ showPackageUpdateNotification(packages) {
2428
+ const action = theme.fg("accent", `${APP_NAME} update`);
2429
+ const updateInstruction = theme.fg("muted", "Package updates are available. Run ") + action;
2430
+ const packageLines = packages.map((pkg) => `- ${pkg}`).join("\n");
2431
+ this.chatContainer.addChild(new Spacer(1));
2432
+ this.chatContainer.addChild(new DynamicBorder((text) => theme.fg("warning", text)));
2433
+ this.chatContainer.addChild(new Text(`${theme.bold(theme.fg("warning", "Package Updates Available"))}\n${updateInstruction}\n${theme.fg("muted", "Packages:")}\n${packageLines}`, 1, 0));
2434
+ this.chatContainer.addChild(new DynamicBorder((text) => theme.fg("warning", text)));
2435
+ this.ui.requestRender();
2436
+ }
2400
2437
  /**
2401
2438
  * Get all queued messages (read-only).
2402
2439
  * Combines session queue and compaction queue.
@@ -3186,7 +3223,7 @@ export class InteractiveMode {
3186
3223
  return;
3187
3224
  }
3188
3225
  this.resetExtensionUI();
3189
- const loader = new BorderedLoader(this.ui, theme, "Reloading extensions, skills, prompts, themes...", {
3226
+ const loader = new BorderedLoader(this.ui, theme, "Reloading keybindings, extensions, skills, prompts, themes...", {
3190
3227
  cancellable: false,
3191
3228
  });
3192
3229
  const previousEditor = this.editor;
@@ -3203,6 +3240,7 @@ export class InteractiveMode {
3203
3240
  };
3204
3241
  try {
3205
3242
  await this.session.reload();
3243
+ this.keybindings.reload();
3206
3244
  setRegisteredThemes(this.session.resourceLoader.getThemes().themes);
3207
3245
  this.hideThinkingBlock = this.settingsManager.getHideThinkingBlock();
3208
3246
  const themeName = this.settingsManager.getTheme();
@@ -3236,7 +3274,7 @@ export class InteractiveMode {
3236
3274
  if (modelsJsonError) {
3237
3275
  this.showError(`models.json error: ${modelsJsonError}`);
3238
3276
  }
3239
- this.showStatus("Reloaded extensions, skills, prompts, themes");
3277
+ this.showStatus("Reloaded keybindings, extensions, skills, prompts, themes");
3240
3278
  }
3241
3279
  catch (error) {
3242
3280
  dismissLoader(previousEditor);
@@ -3451,6 +3489,10 @@ export class InteractiveMode {
3451
3489
  }
3452
3490
  handleHotkeysCommand() {
3453
3491
  // Navigation keybindings
3492
+ const cursorUp = this.getEditorKeyDisplay("cursorUp");
3493
+ const cursorDown = this.getEditorKeyDisplay("cursorDown");
3494
+ const cursorLeft = this.getEditorKeyDisplay("cursorLeft");
3495
+ const cursorRight = this.getEditorKeyDisplay("cursorRight");
3454
3496
  const cursorWordLeft = this.getEditorKeyDisplay("cursorWordLeft");
3455
3497
  const cursorWordRight = this.getEditorKeyDisplay("cursorWordRight");
3456
3498
  const cursorLineStart = this.getEditorKeyDisplay("cursorLineStart");
@@ -3481,13 +3523,15 @@ export class InteractiveMode {
3481
3523
  const expandTools = this.getAppKeyDisplay("expandTools");
3482
3524
  const toggleThinking = this.getAppKeyDisplay("toggleThinking");
3483
3525
  const externalEditor = this.getAppKeyDisplay("externalEditor");
3526
+ const cycleModelBackward = this.getAppKeyDisplay("cycleModelBackward");
3484
3527
  const followUp = this.getAppKeyDisplay("followUp");
3485
3528
  const dequeue = this.getAppKeyDisplay("dequeue");
3529
+ const pasteImage = this.getAppKeyDisplay("pasteImage");
3486
3530
  let hotkeys = `
3487
3531
  **Navigation**
3488
3532
  | Key | Action |
3489
3533
  |-----|--------|
3490
- | \`Arrow keys\` | Move cursor / browse history (Up when empty) |
3534
+ | \`${cursorUp}\` / \`${cursorDown}\` / \`${cursorLeft}\` / \`${cursorRight}\` | Move cursor / browse history (Up when empty) |
3491
3535
  | \`${cursorWordLeft}\` / \`${cursorWordRight}\` | Move by word |
3492
3536
  | \`${cursorLineStart}\` | Start of line |
3493
3537
  | \`${cursorLineEnd}\` | End of line |
@@ -3517,14 +3561,14 @@ export class InteractiveMode {
3517
3561
  | \`${exit}\` | Exit (when editor is empty) |
3518
3562
  | \`${suspend}\` | Suspend to background |
3519
3563
  | \`${cycleThinkingLevel}\` | Cycle thinking level |
3520
- | \`${cycleModelForward}\` | Cycle models |
3564
+ | \`${cycleModelForward}\` / \`${cycleModelBackward}\` | Cycle models |
3521
3565
  | \`${selectModel}\` | Open model selector |
3522
3566
  | \`${expandTools}\` | Toggle tool output expansion |
3523
3567
  | \`${toggleThinking}\` | Toggle thinking block visibility |
3524
3568
  | \`${externalEditor}\` | Edit message in external editor |
3525
3569
  | \`${followUp}\` | Queue follow-up message |
3526
3570
  | \`${dequeue}\` | Restore queued messages |
3527
- | \`Ctrl+V\` | Paste image from clipboard |
3571
+ | \`${pasteImage}\` | Paste image from clipboard |
3528
3572
  | \`/\` | Slash commands |
3529
3573
  | \`!\` | Run bash command |
3530
3574
  | \`!!\` | Run bash command (excluded from context) |