@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
@@ -898,7 +898,7 @@ Current working directory.
898
898
 
899
899
  Backend-aware file and shell operations for extensions. These APIs use the same active backend as Grip's built-in tools: local by default, or a remote daemon when configured.
900
900
 
901
- Use these APIs for extension tools and extension-owned automation that reads files, writes files, lists directories, or executes shell commands. This is the only safe way for extension tools to run shell commands because it preserves Grip's active execution boundary. Direct local process APIs (`child_process`, `pi.exec`, shell libraries, etc.) bypass the configured tool backend and will run on the local machine even when Grip tools are remote.
901
+ Use these APIs for extension tools and extension-owned automation that reads files, writes files, lists directories, or executes shell commands in the active backend. For deliberate host execution from a managed sandbox, use the separately approved `ctx.execHostProcess()` (direct argv) or `ctx.execHostCommand()` (shell) below. Direct local process APIs (`child_process`, `pi.exec`, shell libraries, etc.) bypass the configured tool backend and will run on the local machine even when Grip tools are remote.
902
902
 
903
903
  ```typescript
904
904
  pi.registerTool({
@@ -941,6 +941,36 @@ Options:
941
941
 
942
942
  Use `ctx.toolOperations` directly when you need backend-aware file operations such as `readFile`, `writeFile`, `stat`, `readdir`, `glob`, or `grep`.
943
943
 
944
+ `ctx.isSandbox()` returns `true` while this session has an active sandbox daemon connection, whether started or attached; it updates when you switch sessions or disconnect. It is `false` for local sessions and other remote tool backends. This indicates where workspace tools run, **not** whether guest paths have a verified host mount: both approved host APIs still require a known mapping and per-command approval.
945
+
946
+ ### ctx.execHostProcess() (direct host argv)
947
+
948
+ `ctx.execHostProcess(executable, args, { question, explanation?, cwd?, signal?, timeout? })` uses the **same per-invocation approval and mount checks** as the shell API below, but runs a host executable with an argument array using `spawn(..., { shell: false })`. Grip displays the executable, argument array, and translated host cwd. When provided, `explanation` is displayed separately as **unverified** context alongside the extension's `question`; it can contain model-generated text and does not replace the exact argv or cwd. It returns `{ stdout, stderr, code, killed }`; `timeout` is in milliseconds. **Stdout and stderr are raw host output and may contain secrets; filter them before returning tool results to the model.** Use this for host Git when shell execution is not acceptable. This API is unavailable outside a connected mapped sandbox; use `pi.exec(file, args, options)` for direct local processes when no sandbox is active (no approval prompt).
949
+
950
+ ```typescript
951
+ await ctx.execHostProcess("git", ["pull", "--rebase", "origin", "main"], {
952
+ question: "Run Git pull using host credentials?",
953
+ explanation: params.explanation, // model input, clearly labeled unverified in the approval
954
+ signal: ctx.signal,
955
+ });
956
+ ```
957
+
958
+ ### ctx.execHostCommand() (managed sandboxes)
959
+
960
+ A reviewed extension can deliberately run a shell command on the host while a Lima-managed sandbox is active. Use `ctx.execHostCommand(command, { question, cwd?, signal?, timeout?, onChunk? })`. Grip prompts **for every invocation** in the editor area, with the extension's question plus the exact command and translated host cwd generated by Grip. "No", Escape, cancellation, or missing UI denies execution; there is no remember/always-allow option. In RPC mode, the client must answer the `select` dialog; print and JSON modes cannot approve.
961
+
962
+ ```typescript
963
+ const result = await ctx.execHostCommand("printf diagnostics", {
964
+ question: "Run diagnostics on the host?",
965
+ cwd: ctx.toolOperations.cwd, // guest path, e.g. /workspace/project
966
+ signal: ctx.signal,
967
+ });
968
+ ```
969
+
970
+ The optional `cwd` is a **guest** directory, defaulting to the active guest working directory. `ctx.toolOperations.mapWorkspaceDirectoryToHost?.(guestPath)` maps an existing directory within a verified mount to its host counterpart, without executing anything. Host commands run in that translated directory; they do not change the guest cwd or run the configured backend shell prefix. Grip automatically supplies a mount mapping only for sandboxes it starts with a known host source. Arbitrarily attached daemons and remote backends without a verified mapping fail closed, even if their paths look similar to host paths. Guest paths outside the mount and host symlinks escaping the mount are rejected.
971
+
972
+ **Trust boundary:** Extensions run as host-side JavaScript and can still use Node `fs`, `child_process`, or legacy `pi.exec` directly without this prompt. The approval is mandatory for `ctx.execHostCommand()` and `ctx.execHostProcess()`, **not** a process-wide restriction on extension code. Review extensions before loading them; use `ctx.execToolBackend()` for ordinary sandbox work. Host Git can load repository-controlled config, remotes, credential helpers or filters from a writable mount; unrestricted Git argv can also select remote URLs or programs to run on the host. An approved direct Git process and a model-provided explanation alone are not isolation for host credentials.
973
+
944
974
  ### ctx.getLspStatus() / ctx.configureLsp()
945
975
 
946
976
  Normal Grip extensions share the single `AgentSession`-owned LSP runtime. Inspect it without creating a parallel manager:
package/docs/sandbox.md CHANGED
@@ -4,9 +4,9 @@
4
4
 
5
5
  The command appears in slash-command completion but not in model-visible catalogs, system prompts, tool definitions, templates, skills, or rules. This is not a permission boundary: a model with host shell access may still invoke Lima directly.
6
6
 
7
- `/new --sandbox` starts a fresh conversation in the same connected sandbox (started or attached) without starting another VM. Plain `/new` starts a local session; if there is no active sandbox, `/new --sandbox` does the same. Sandbox connections are remembered in memory only while Grip remains running.
7
+ `/new` starts a fresh conversation in the same connected sandbox (started or attached) without starting another VM. When no sandbox is connected, `/new` starts a local session. Sandbox connections are remembered in memory only while Grip remains running.
8
8
 
9
- Inside a connected sandbox, `/cd <directory>` changes the guest working directory for subsequent tools within the existing mounted workspace. `/cd` without an argument returns to the guest workspace root. It does not change the host session directory, remount the workspace, or reconnect the daemon. The guest working directory resets to the mount root after a session switch or reconnection.
9
+ Inside a connected sandbox, `/cd <directory>` changes the guest working directory for subsequent tools within the existing mounted workspace; completion lists directories from the guest, and the footer displays the guest working directory. `/cd` without an argument returns to the guest workspace root. It does not change the host session directory, remount the workspace, or reconnect the daemon. In a VM that mounts one host project at `/workspace`, `/workspace/planner` is not another mounted host project; open that project as a separate workspace, or attach a daemon whose workspace root contains both projects. The guest working directory resets to the mount root after a session switch or reconnection. Reviewed extensions may explicitly call `ctx.execHostProcess()` (direct argv) or `ctx.execHostCommand()` (shell) to run on the host after per-operation user approval; only managed sandboxes with a verified mount can translate guest directories to host directories. See [Extensions](extensions.md#ctxexechostprocess-direct-host-argv).
10
10
 
11
11
  Lima-managed sandboxes allow workspace tools (`read`, `write`, `edit`, `ls`, `find`, and `grep`) to access paths anywhere in the guest filesystem, including outside the mounted workspace. This does not mount additional host directories; guest OS permissions still apply. `/cd` remains within the mounted workspace. An attached daemon stays workspace-confined by default: only enable `--daemon-allow-full-filesystem` when the daemon runs inside an intentionally isolated guest, never on an untrusted host. Existing guest daemons need an update or restart to enable this access.
12
12
 
package/docs/sessions.md CHANGED
@@ -23,7 +23,7 @@ For the JSONL file format, active `Session` API, and `SessionManager` lifecycle
23
23
  | Command | Description |
24
24
  |---------|-------------|
25
25
  | `/resume` | Browse and select previous sessions |
26
- | `/new [--sandbox]` | Start a new session; `--sandbox` reuses the active sandbox connection |
26
+ | `/new` | Start a new session, reusing the active sandbox connection if connected |
27
27
  | `/name <name>` | Set the current session display name |
28
28
  | `/session` | Show session info |
29
29
  | `/tree` | Navigate the current session tree |
package/docs/skills.md CHANGED
@@ -64,11 +64,11 @@ For project-level Claude Code skills, add to `.grip/settings.json`:
64
64
  ## How Skills Work
65
65
 
66
66
  1. At startup, Grip scans skill locations and extracts names and descriptions
67
- 2. The system prompt includes available skills in XML format per the [specification](https://agentskills.io/integrate-skills)
68
- 3. When a task matches, the agent uses `read` to load the full SKILL.md (models don't always do this; use prompting or `/skill:name` to force it)
67
+ 2. The system prompt includes available skill names and descriptions in XML, without file locations
68
+ 3. When a task matches, the agent calls `load_skill` with a skill name (or an array of names) to load the full instructions. The tool reports the skill directory for resolving relative references. Use `/skill:name` to force a skill from the UI.
69
69
  4. The agent follows the instructions, using relative paths to reference scripts and assets
70
70
 
71
- This is progressive disclosure: only descriptions are always in context, full instructions load on-demand.
71
+ This is progressive disclosure: only descriptions are always in context, full instructions load on-demand. For example, use `load_skill({"name":"pdf-processing"})` for one skill or `load_skill({"name":["pdf-processing","data-analysis"]})` for several. Skills with `disable-model-invocation: true` remain user-only via `/skill:name`.
72
72
 
73
73
  ## Skill Commands
74
74
 
@@ -146,7 +146,7 @@ Per the [Agent Skills specification](https://agentskills.io/specification#frontm
146
146
  | `compatibility` | No | Max 500 chars. Environment requirements. |
147
147
  | `metadata` | No | Arbitrary key-value mapping. |
148
148
  | `allowed-tools` | No | Space-delimited list of pre-approved tools (experimental). |
149
- | `tools` | No | Tool name or YAML list of lazy tools to load automatically when the skill is loaded via `read` or `/skill:name`. |
149
+ | `tools` | No | Tool name or YAML list of lazy tools to load automatically when the skill is loaded via `load_skill`, `read`, or `/skill:name`. |
150
150
  | `disable-model-invocation` | No | When `true`, skill is hidden from system prompt. Users must use `/skill:name`. |
151
151
 
152
152
  Example with associated lazy tools:
package/docs/usage.md CHANGED
@@ -41,7 +41,7 @@ Type `/` in the editor to open command completion. Extensions can register custo
41
41
  | `/scoped-models` | Enable/disable models for Ctrl+P cycling |
42
42
  | `/settings` | Thinking level, theme, message delivery, transport |
43
43
  | `/resume` | Pick from previous sessions |
44
- | `/new [--sandbox]` | Start a new session; `--sandbox` reuses the active sandbox connection |
44
+ | `/new` | Start a new session, reusing the active sandbox connection if connected |
45
45
  | `/cd [directory]` | Change working directory (within the existing guest mount when sandboxed) |
46
46
  | `/name <name>` | Set session display name |
47
47
  | `/session` | Show session file, ID, messages, tokens, and cost |
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "grip-extension-custom-provider-anthropic",
3
3
  "private": true,
4
- "version": "0.1.6",
4
+ "version": "0.1.7",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "grip-extension-custom-provider-gitlab-duo",
3
3
  "private": true,
4
- "version": "0.1.6",
4
+ "version": "0.1.7",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "grip-extension-sandbox",
3
3
  "private": true,
4
- "version": "0.1.6",
4
+ "version": "0.1.7",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "grip-extension-with-deps",
3
3
  "private": true,
4
- "version": "0.1.6",
4
+ "version": "0.1.7",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@greppleai/grip",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@greppleai/grip",
9
- "version": "0.1.6",
9
+ "version": "0.1.7",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
- "@greppleai/grip-agent-core": "^0.1.6",
13
- "@greppleai/grip-ai": "^0.1.6",
14
- "@greppleai/grip-tui": "^0.1.6",
12
+ "@greppleai/grip-agent-core": "^0.1.7",
13
+ "@greppleai/grip-ai": "^0.1.7",
14
+ "@greppleai/grip-tui": "^0.1.7",
15
15
  "@silvia-odwyer/photon-node": "0.3.4",
16
16
  "chalk": "6.0.1",
17
17
  "cross-spawn": "7.0.6",
@@ -72,11 +72,11 @@
72
72
  }
73
73
  },
74
74
  "node_modules/@greppleai/grip-agent-core": {
75
- "version": "0.1.6",
76
- "resolved": "https://registry.npmjs.org/@greppleai/grip-agent-core/-/grip-agent-core-0.1.6.tgz",
75
+ "version": "0.1.7",
76
+ "resolved": "https://registry.npmjs.org/@greppleai/grip-agent-core/-/grip-agent-core-0.1.7.tgz",
77
77
  "license": "MIT",
78
78
  "dependencies": {
79
- "@greppleai/grip-ai": "^0.1.6",
79
+ "@greppleai/grip-ai": "^0.1.7",
80
80
  "ignore": "7.0.13",
81
81
  "typebox": "1.4.3",
82
82
  "yaml": "2.9.1"
@@ -86,8 +86,8 @@
86
86
  }
87
87
  },
88
88
  "node_modules/@greppleai/grip-ai": {
89
- "version": "0.1.6",
90
- "resolved": "https://registry.npmjs.org/@greppleai/grip-ai/-/grip-ai-0.1.6.tgz",
89
+ "version": "0.1.7",
90
+ "resolved": "https://registry.npmjs.org/@greppleai/grip-ai/-/grip-ai-0.1.7.tgz",
91
91
  "license": "MIT",
92
92
  "dependencies": {
93
93
  "@anthropic-ai/sdk": "1.1.0",
@@ -110,8 +110,8 @@
110
110
  }
111
111
  },
112
112
  "node_modules/@greppleai/grip-tui": {
113
- "version": "0.1.6",
114
- "resolved": "https://registry.npmjs.org/@greppleai/grip-tui/-/grip-tui-0.1.6.tgz",
113
+ "version": "0.1.7",
114
+ "resolved": "https://registry.npmjs.org/@greppleai/grip-tui/-/grip-tui-0.1.7.tgz",
115
115
  "license": "MIT",
116
116
  "dependencies": {
117
117
  "get-east-asian-width": "1.7.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@greppleai/grip",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "Coding agent CLI with read, bash, edit, write tools and session management",
5
5
  "type": "module",
6
6
  "gripConfig": {
@@ -38,9 +38,9 @@
38
38
  "prepublishOnly": "npm run clean && npm run build && npm run shrinkwrap"
39
39
  },
40
40
  "dependencies": {
41
- "@greppleai/grip-agent-core": "^0.1.6",
42
- "@greppleai/grip-ai": "^0.1.6",
43
- "@greppleai/grip-tui": "^0.1.6",
41
+ "@greppleai/grip-agent-core": "^0.1.7",
42
+ "@greppleai/grip-ai": "^0.1.7",
43
+ "@greppleai/grip-tui": "^0.1.7",
44
44
  "@silvia-odwyer/photon-node": "0.3.4",
45
45
  "chalk": "6.0.1",
46
46
  "cross-spawn": "7.0.6",