@codex-infinity/pi-infinity 0.60.1 → 0.60.2

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 (36) hide show
  1. package/CHANGELOG.md +1 -0
  2. package/dist/core/agent-session.d.ts +14 -0
  3. package/dist/core/agent-session.d.ts.map +1 -1
  4. package/dist/core/agent-session.js +57 -3
  5. package/dist/core/agent-session.js.map +1 -1
  6. package/dist/core/exec.d.ts.map +1 -1
  7. package/dist/core/exec.js +7 -3
  8. package/dist/core/exec.js.map +1 -1
  9. package/dist/core/slash-commands.d.ts.map +1 -1
  10. package/dist/core/slash-commands.js +2 -1
  11. package/dist/core/slash-commands.js.map +1 -1
  12. package/dist/core/tools/bash.d.ts.map +1 -1
  13. package/dist/core/tools/bash.js +12 -10
  14. package/dist/core/tools/bash.js.map +1 -1
  15. package/dist/modes/interactive/interactive-mode.d.ts +1 -0
  16. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  17. package/dist/modes/interactive/interactive-mode.js +55 -5
  18. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  19. package/dist/utils/child-process.d.ts +11 -0
  20. package/dist/utils/child-process.d.ts.map +1 -0
  21. package/dist/utils/child-process.js +78 -0
  22. package/dist/utils/child-process.js.map +1 -0
  23. package/dist/utils/clipboard-native.d.ts +1 -0
  24. package/dist/utils/clipboard-native.d.ts.map +1 -1
  25. package/dist/utils/clipboard-native.js.map +1 -1
  26. package/dist/utils/clipboard.d.ts +1 -1
  27. package/dist/utils/clipboard.d.ts.map +1 -1
  28. package/dist/utils/clipboard.js +11 -1
  29. package/dist/utils/clipboard.js.map +1 -1
  30. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  31. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  32. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  33. package/examples/extensions/custom-provider-qwen-cli/package.json +1 -1
  34. package/examples/extensions/with-deps/package-lock.json +2 -2
  35. package/examples/extensions/with-deps/package.json +1 -1
  36. package/package.json +4 -4
@@ -1607,13 +1607,18 @@ export class InteractiveMode {
1607
1607
  this.editor.setText("");
1608
1608
  return;
1609
1609
  }
1610
+ if (text.startsWith("/import")) {
1611
+ await this.handleImportCommand(text);
1612
+ this.editor.setText("");
1613
+ return;
1614
+ }
1610
1615
  if (text === "/share") {
1611
1616
  await this.handleShareCommand();
1612
1617
  this.editor.setText("");
1613
1618
  return;
1614
1619
  }
1615
1620
  if (text === "/copy") {
1616
- this.handleCopyCommand();
1621
+ await this.handleCopyCommand();
1617
1622
  this.editor.setText("");
1618
1623
  return;
1619
1624
  }
@@ -3285,13 +3290,58 @@ export class InteractiveMode {
3285
3290
  const parts = text.split(/\s+/);
3286
3291
  const outputPath = parts.length > 1 ? parts[1] : undefined;
3287
3292
  try {
3288
- const filePath = await this.session.exportToHtml(outputPath);
3289
- this.showStatus(`Session exported to: ${filePath}`);
3293
+ if (outputPath?.endsWith(".jsonl")) {
3294
+ const filePath = this.session.exportToJsonl(outputPath);
3295
+ this.showStatus(`Session exported to: ${filePath}`);
3296
+ }
3297
+ else {
3298
+ const filePath = await this.session.exportToHtml(outputPath);
3299
+ this.showStatus(`Session exported to: ${filePath}`);
3300
+ }
3290
3301
  }
3291
3302
  catch (error) {
3292
3303
  this.showError(`Failed to export session: ${error instanceof Error ? error.message : "Unknown error"}`);
3293
3304
  }
3294
3305
  }
3306
+ async handleImportCommand(text) {
3307
+ const parts = text.split(/\s+/);
3308
+ if (parts.length < 2 || !parts[1]) {
3309
+ this.showError("Usage: /import <path.jsonl>");
3310
+ return;
3311
+ }
3312
+ const inputPath = parts[1];
3313
+ const confirmed = await this.showExtensionConfirm("Import session", `Replace current session with ${inputPath}?`);
3314
+ if (!confirmed) {
3315
+ this.showStatus("Import cancelled");
3316
+ return;
3317
+ }
3318
+ try {
3319
+ // Stop loading animation
3320
+ if (this.loadingAnimation) {
3321
+ this.loadingAnimation.stop();
3322
+ this.loadingAnimation = undefined;
3323
+ }
3324
+ this.statusContainer.clear();
3325
+ // Clear UI state
3326
+ this.pendingMessagesContainer.clear();
3327
+ this.compactionQueuedMessages = [];
3328
+ this.streamingComponent = undefined;
3329
+ this.streamingMessage = undefined;
3330
+ this.pendingTools.clear();
3331
+ const success = await this.session.importFromJsonl(inputPath);
3332
+ if (!success) {
3333
+ this.showWarning("Import cancelled");
3334
+ return;
3335
+ }
3336
+ // Clear and re-render the chat
3337
+ this.chatContainer.clear();
3338
+ this.renderInitialMessages();
3339
+ this.showStatus(`Session imported from: ${inputPath}`);
3340
+ }
3341
+ catch (error) {
3342
+ this.showError(`Failed to import session: ${error instanceof Error ? error.message : "Unknown error"}`);
3343
+ }
3344
+ }
3295
3345
  async handleShareCommand() {
3296
3346
  // Check if gh is available and logged in
3297
3347
  try {
@@ -3379,14 +3429,14 @@ export class InteractiveMode {
3379
3429
  }
3380
3430
  }
3381
3431
  }
3382
- handleCopyCommand() {
3432
+ async handleCopyCommand() {
3383
3433
  const text = this.session.getLastAssistantText();
3384
3434
  if (!text) {
3385
3435
  this.showError("No agent messages to copy yet.");
3386
3436
  return;
3387
3437
  }
3388
3438
  try {
3389
- copyToClipboard(text);
3439
+ await copyToClipboard(text);
3390
3440
  this.showStatus("Copied last agent message to clipboard");
3391
3441
  }
3392
3442
  catch (error) {