@greppleai/grip 0.1.6 → 0.1.7

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 (76) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +1 -1
  3. package/dist/config.d.ts.map +1 -1
  4. package/dist/config.js +2 -0
  5. package/dist/config.js.map +1 -1
  6. package/dist/core/agent-session.d.ts +11 -1
  7. package/dist/core/agent-session.d.ts.map +1 -1
  8. package/dist/core/agent-session.js +172 -2
  9. package/dist/core/agent-session.js.map +1 -1
  10. package/dist/core/compaction/compaction.d.ts.map +1 -1
  11. package/dist/core/compaction/compaction.js +9 -2
  12. package/dist/core/compaction/compaction.js.map +1 -1
  13. package/dist/core/extensions/runner.d.ts +3 -0
  14. package/dist/core/extensions/runner.d.ts.map +1 -1
  15. package/dist/core/extensions/runner.js +22 -0
  16. package/dist/core/extensions/runner.js.map +1 -1
  17. package/dist/core/extensions/types.d.ts +21 -1
  18. package/dist/core/extensions/types.d.ts.map +1 -1
  19. package/dist/core/extensions/types.js.map +1 -1
  20. package/dist/core/instruction-resource-loader.d.ts +1 -0
  21. package/dist/core/instruction-resource-loader.d.ts.map +1 -1
  22. package/dist/core/instruction-resource-loader.js +2 -1
  23. package/dist/core/instruction-resource-loader.js.map +1 -1
  24. package/dist/core/messages.d.ts.map +1 -1
  25. package/dist/core/messages.js +30 -1
  26. package/dist/core/messages.js.map +1 -1
  27. package/dist/core/skills.d.ts.map +1 -1
  28. package/dist/core/skills.js +3 -2
  29. package/dist/core/skills.js.map +1 -1
  30. package/dist/core/system-prompt.d.ts +1 -1
  31. package/dist/core/system-prompt.d.ts.map +1 -1
  32. package/dist/core/system-prompt.js +3 -2
  33. package/dist/core/system-prompt.js.map +1 -1
  34. package/dist/core/tools/bash.d.ts +1 -0
  35. package/dist/core/tools/bash.d.ts.map +1 -1
  36. package/dist/core/tools/bash.js +26 -23
  37. package/dist/core/tools/bash.js.map +1 -1
  38. package/dist/core/tools/operations.d.ts +6 -0
  39. package/dist/core/tools/operations.d.ts.map +1 -1
  40. package/dist/core/tools/operations.js +28 -4
  41. package/dist/core/tools/operations.js.map +1 -1
  42. package/dist/index.d.ts +1 -1
  43. package/dist/index.d.ts.map +1 -1
  44. package/dist/index.js.map +1 -1
  45. package/dist/main.d.ts.map +1 -1
  46. package/dist/main.js +8 -3
  47. package/dist/main.js.map +1 -1
  48. package/dist/modes/interactive/components/footer.d.ts.map +1 -1
  49. package/dist/modes/interactive/components/footer.js +7 -1
  50. package/dist/modes/interactive/components/footer.js.map +1 -1
  51. package/dist/modes/interactive/interactive-mode.d.ts +0 -1
  52. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  53. package/dist/modes/interactive/interactive-mode.js +25 -23
  54. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  55. package/dist/package-manager-cli.d.ts.map +1 -1
  56. package/dist/package-manager-cli.js +33 -2
  57. package/dist/package-manager-cli.js.map +1 -1
  58. package/dist/utils/binary-self-update.d.ts +25 -0
  59. package/dist/utils/binary-self-update.d.ts.map +1 -0
  60. package/dist/utils/binary-self-update.js +159 -0
  61. package/dist/utils/binary-self-update.js.map +1 -0
  62. package/dist/utils/directory-completions.d.ts +8 -0
  63. package/dist/utils/directory-completions.d.ts.map +1 -1
  64. package/dist/utils/directory-completions.js +42 -1
  65. package/dist/utils/directory-completions.js.map +1 -1
  66. package/docs/extensions.md +31 -1
  67. package/docs/sandbox.md +2 -2
  68. package/docs/sessions.md +1 -1
  69. package/docs/skills.md +4 -4
  70. package/docs/usage.md +1 -1
  71. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  72. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  73. package/examples/extensions/sandbox/package.json +1 -1
  74. package/examples/extensions/with-deps/package.json +1 -1
  75. package/npm-shrinkwrap.json +12 -12
  76. package/package.json +4 -4
@@ -390,20 +390,6 @@ export class InteractiveMode {
390
390
  path: command.sourceInfo.path,
391
391
  }));
392
392
  }
393
- configureNewCommandAutocomplete(commandsByName) {
394
- const command = commandsByName.get("new");
395
- if (!command)
396
- return;
397
- command.argumentHint = "[--sandbox]";
398
- command.getArgumentCompletions = (prefix) => {
399
- if (prefix.includes(" "))
400
- return null;
401
- return fuzzyFilter(["--sandbox"], prefix, (option) => option).map((option) => ({
402
- value: option,
403
- label: option,
404
- }));
405
- };
406
- }
407
393
  createBaseAutocompleteProvider() {
408
394
  // Commands without arguments remain selectable after a trailing space (e.g. /quit ).
409
395
  const noArgumentCommands = new Set([
@@ -416,6 +402,7 @@ export class InteractiveMode {
416
402
  "hotkeys",
417
403
  "fork",
418
404
  "clone",
405
+ "new",
419
406
  "tree",
420
407
  "login",
421
408
  "logout",
@@ -431,7 +418,13 @@ export class InteractiveMode {
431
418
  const cdCommand = slashCommands.find((command) => command.name === "cd");
432
419
  if (cdCommand) {
433
420
  cdCommand.argumentHint = "<directory>";
434
- cdCommand.getArgumentCompletions = (prefix) => this.session.supportsDirectoryChange() ? getDirectoryCompletions(prefix, this.activeSession.getCwd()) : [];
421
+ cdCommand.getArgumentCompletions = (prefix) => {
422
+ if (this.activeSandboxBackendConnected)
423
+ return this.session.getSandboxDirectoryCompletions(prefix);
424
+ return this.session.supportsDirectoryChange()
425
+ ? getDirectoryCompletions(prefix, this.activeSession.getCwd())
426
+ : [];
427
+ };
435
428
  }
436
429
  const choiceCompletions = (choices) => (prefix) => {
437
430
  if (prefix.includes(" "))
@@ -457,7 +450,6 @@ export class InteractiveMode {
457
450
  command.getArgumentCompletions = choiceCompletions(choices);
458
451
  }
459
452
  }
460
- this.configureNewCommandAutocomplete(commandsByName);
461
453
  const sandboxCommand = slashCommands.find((command) => command.name === "sandbox");
462
454
  if (sandboxCommand) {
463
455
  sandboxCommand.argumentHint = "<status|clear|--attach|start|list|stop>";
@@ -1612,12 +1604,15 @@ export class InteractiveMode {
1612
1604
  cwd: this.activeSession.getCwd(),
1613
1605
  toolOperations: this.session.getToolOperations(),
1614
1606
  getToolBackendInfo: () => this.session.getToolBackendInfo(),
1607
+ isSandbox: () => this.session.isSandbox(),
1615
1608
  getLspStatus: () => this.session.getLspStatus(),
1616
1609
  configureLsp: (configuration) => this.session.configureLsp(configuration),
1617
1610
  execToolBackend: (command, options) => {
1618
1611
  const operations = this.session.getToolOperations();
1619
1612
  return executeBashWithOperations(command, options?.cwd ?? operations.cwd, operations, options);
1620
1613
  },
1614
+ execHostCommand: (command, options) => extensionRunner.createContext().execHostCommand(command, options),
1615
+ execHostProcess: (executable, args, options) => extensionRunner.createContext().execHostProcess(executable, args, options),
1621
1616
  session: this.activeSession,
1622
1617
  modelRegistry: this.session.modelRegistry,
1623
1618
  model: this.session.model,
@@ -1672,7 +1667,7 @@ export class InteractiveMode {
1672
1667
  return theme.fg("dim", `tools: local ${info.cwd}`);
1673
1668
  }
1674
1669
  return info.configured
1675
- ? theme.fg("accent", `tools: remote ${info.url} ${info.cwd}`)
1670
+ ? theme.fg("accent", `tools: remote ${info.url} ${this.activeSandboxBackendConnected ? this.session.getToolOperations().cwd : info.cwd}`)
1676
1671
  : theme.fg("warning", `tools: remote not configured ${info.cwd}`);
1677
1672
  }
1678
1673
  updateToolBackendStatus() {
@@ -2543,11 +2538,11 @@ export class InteractiveMode {
2543
2538
  run: async () => {
2544
2539
  this.editor.setText("");
2545
2540
  const option = text.slice("/new".length).trim();
2546
- if (option && option !== "--sandbox") {
2547
- this.showWarning("Usage: /new [--sandbox]");
2541
+ if (option) {
2542
+ this.showWarning("Usage: /new");
2548
2543
  return;
2549
2544
  }
2550
- await this.handleClearCommand(option === "--sandbox");
2545
+ await this.handleClearCommand();
2551
2546
  },
2552
2547
  };
2553
2548
  }
@@ -4948,10 +4943,14 @@ export class InteractiveMode {
4948
4943
  }
4949
4944
  try {
4950
4945
  const directory = await this.session.changeSandboxWorkingDirectory(argument ?? backend.workspace.root);
4946
+ this.updateToolBackendStatus();
4951
4947
  this.showStatus(`Working directory: ${directory}`);
4952
4948
  }
4953
4949
  catch (error) {
4954
- this.showError(`Failed to change sandbox directory: ${error instanceof Error ? error.message : String(error)}`);
4950
+ const message = error instanceof Error ? error.message : String(error);
4951
+ this.showError(message === "Remote workspace request handler failed"
4952
+ ? `Directory unavailable in sandbox: ${argument ?? backend.workspace.root} (it must exist within the mounted workspace ${backend.workspace.root})`
4953
+ : `Failed to change sandbox directory: ${message}`);
4955
4954
  }
4956
4955
  }
4957
4956
  async handleUnavailableCdCommand(text) {
@@ -5385,6 +5384,7 @@ export class InteractiveMode {
5385
5384
  try {
5386
5385
  await this.session.activateSandboxDaemon({
5387
5386
  url: state.url,
5387
+ hostWorkspaceRoot: state.hostWorkspaceRoot,
5388
5388
  token: state.token,
5389
5389
  expectedCwd: state.expectedCwd,
5390
5390
  });
@@ -5466,6 +5466,7 @@ export class InteractiveMode {
5466
5466
  url: result.daemonUrl,
5467
5467
  token: result.token,
5468
5468
  expectedCwd: result.workspaceMountPath,
5469
+ hostWorkspaceRoot: result.workspaceRoot,
5469
5470
  });
5470
5471
  break;
5471
5472
  }
@@ -5522,6 +5523,7 @@ export class InteractiveMode {
5522
5523
  url: result.daemonUrl,
5523
5524
  token: result.token,
5524
5525
  expectedCwd: result.workspaceMountPath,
5526
+ hostWorkspaceRoot: result.workspaceRoot,
5525
5527
  containerId: result.containerId,
5526
5528
  });
5527
5529
  this.refreshUiAfterBackendChange();
@@ -5831,13 +5833,13 @@ export class InteractiveMode {
5831
5833
  this.chatContainer.addChild(new DynamicBorder());
5832
5834
  this.ui.requestRender();
5833
5835
  }
5834
- async handleClearCommand(reuseSandbox = false) {
5836
+ async handleClearCommand() {
5835
5837
  if (this.loadingAnimation) {
5836
5838
  this.loadingAnimation.stop();
5837
5839
  this.loadingAnimation = undefined;
5838
5840
  }
5839
5841
  this.statusContainer.clear();
5840
- const sandboxState = reuseSandbox && this.activeSandboxBackendConnected
5842
+ const sandboxState = this.activeSandboxBackendConnected
5841
5843
  ? this.sessionSandboxStates.get(getSessionSandboxKey(this.activeSession))
5842
5844
  : undefined;
5843
5845
  let newSessionKey;