@diffra-ai/cli 0.1.2 → 0.1.3
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.
- package/CHANGELOG.md +53 -47
- package/dist/bundle/chunks/{anthropic-messages-HME6WDIM.js → anthropic-messages-5EMOURYI.js} +1 -1
- package/dist/bundle/chunks/{azure-openai-responses-WKSFBZF5.js → azure-openai-responses-N67KWG2X.js} +1 -1
- package/dist/bundle/chunks/bedrock-converse-stream.js +1 -1
- package/dist/bundle/chunks/{chunk-SMYD2SB5.js → chunk-3UNTEQ65.js} +1 -1
- package/dist/bundle/chunks/{chunk-MJRIJM22.js → chunk-BF423NQ7.js} +1 -1
- package/dist/bundle/chunks/{chunk-QMZGTPRI.js → chunk-CES65UJH.js} +1 -1
- package/dist/bundle/chunks/{chunk-PXE534VH.js → chunk-HFTZ6OJJ.js} +2 -2
- package/dist/bundle/chunks/{chunk-RUI3NOFB.js → chunk-NEFH2K3C.js} +1 -1
- package/dist/bundle/chunks/{chunk-E3MJ4MPN.js → chunk-PISJX26Y.js} +1 -1
- package/dist/bundle/chunks/{chunk-6L2FT6AE.js → chunk-QYYUGS66.js} +1 -1
- package/dist/bundle/chunks/{chunk-3MKQN3ZR.js → chunk-RLMZZV4Q.js} +1 -1
- package/dist/bundle/chunks/{chunk-GRDBYTYT.js → chunk-RTPG7C5I.js} +4 -4
- package/dist/bundle/chunks/{chunk-MITPYV3F.js → chunk-VOKUVFV4.js} +1 -1
- package/dist/bundle/chunks/{chunk-PQGGR7SQ.js → chunk-VWWMBH3G.js} +1 -1
- package/dist/bundle/chunks/{cli-GKHAGQO6.js → cli-55VO5MAJ.js} +1 -1
- package/dist/bundle/chunks/{cloudflare-workers-ai-system-one-PVUECIVD.js → cloudflare-workers-ai-system-one-HB5U67WC.js} +1 -1
- package/dist/bundle/chunks/{google-generative-ai-2YH7DK5J.js → google-generative-ai-XRHE7R52.js} +1 -1
- package/dist/bundle/chunks/{google-vertex-QNIS4SPE.js → google-vertex-75CQOPKC.js} +1 -1
- package/dist/bundle/chunks/{llama-cpp-classify-EMBT3ZMY.js → llama-cpp-classify-LKIRB7ZR.js} +1 -1
- package/dist/bundle/chunks/{mistral-conversations-RCHJWX2M.js → mistral-conversations-KLGIHK73.js} +1 -1
- package/dist/bundle/chunks/{openai-codex-responses-LBZQ7HUY.js → openai-codex-responses-7L5VV67U.js} +1 -1
- package/dist/bundle/chunks/{openai-completions-U7NS5GFY.js → openai-completions-RBF6UXDW.js} +1 -1
- package/dist/bundle/chunks/{openai-decisions-YC4ZEGAR.js → openai-decisions-W3PJQIOF.js} +1 -1
- package/dist/bundle/chunks/{openai-responses-4YX6XMEO.js → openai-responses-W5ZMLOTR.js} +1 -1
- package/dist/bundle/chunks/{openrouter-images-QPPGKFJY.js → openrouter-images-4FW6VFV4.js} +1 -1
- package/dist/bundle/chunks/{pi-messages-5W3GZ7B6.js → pi-messages-RT7FVQ4G.js} +1 -1
- package/dist/bundle/chunks/{typesafe-system-one-GWMQ2NLX.js → typesafe-system-one-DSJ7OYVL.js} +1 -1
- package/dist/bundle/chunks/{virtual-modules-ENTYMDSQ.js → virtual-modules-M75O3ECA.js} +1 -1
- package/dist/bundle/cli-runtime.js +1 -1
- package/dist/bundle/index.js +1 -1
- package/dist/bundle/rpc-entry.js +1 -1
- package/dist/core/extensions/types.d.ts +2 -2
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/docs/approval-modes.md +99 -99
- package/docs/cli.md +380 -380
- package/docs/docs.json +264 -264
- package/docs/environment-variables.md +110 -110
- package/docs/extensions.md +3 -2
- package/docs/security.md +100 -100
- package/docs/settings.md +198 -198
- package/package.json +6 -6
package/docs/approval-modes.md
CHANGED
|
@@ -1,99 +1,99 @@
|
|
|
1
|
-
# Approve Tool Calls
|
|
2
|
-
|
|
3
|
-
Approval modes decide which tool calls run without asking. Diffra starts in `yolo` mode, which runs every call without asking, as earlier versions did. The other modes ask before edits and commands, let a classifier decide, or keep the session read-only for planning.
|
|
4
|
-
|
|
5
|
-
| Mode | Edits | Shell commands | Other tools |
|
|
6
|
-
|---|---|---|---|
|
|
7
|
-
| `plan` | Blocked | Read-only commands run; state-modifying ones are blocked; others need a one-time approval | Read-only tools only |
|
|
8
|
-
| `default` (Ask Permissions) | Ask | Ask | Ask, except local read-only tools |
|
|
9
|
-
| `auto-edit` | Allowed | Ask | Ask, except local read-only tools |
|
|
10
|
-
| `auto` | Allowed inside the project; classifier elsewhere | Read-only commands run; classifier for the rest | Classifier, except local read-only tools |
|
|
11
|
-
| `yolo` (default) | Allowed | Allowed | Allowed |
|
|
12
|
-
|
|
13
|
-
Local read-only tools are `read`, `grep`, `find`, `ls`, `todo_write`, `tool_search`, `codemode` (its calls are checked one by one), and tools whose annotations mark them read-only without reaching the web. `web_fetch`, `web_search`, and read-only tools that reach the web run in plan mode but ask in `default` and `auto-edit` mode.
|
|
14
|
-
|
|
15
|
-
Approval modes come from the built-in extension `builtin:approval`. Disabling it (`-builtin:approval` in the `extensions` setting, or `--no-extensions`) removes the checks, so every call runs as in `yolo` mode. They do not restrict what an allowed call can reach; the [sandbox](sandbox.md) does, and in `default`, `auto-edit`, and `auto` mode Diffra asks before running an action the sandbox blocked without it. See [Run Diffra Safely](security.md).
|
|
16
|
-
|
|
17
|
-
## Change the mode
|
|
18
|
-
|
|
19
|
-
- Press `alt+m` (`app.approvalMode.cycle`) to step through `plan`, `default`, `auto-edit`, `auto`, and `yolo`. Qwen Code uses Shift+Tab for this; in Diffra Shift+Tab cycles the thinking level, so the approval mode has its own key. Rebind it in [keybindings.json](keybindings.md).
|
|
20
|
-
- `/approval-mode` opens a selector; `/approval-mode <mode>` switches directly. Add `--user` or `--project` to also save the mode as the default for new sessions, in your settings or the project's `.diffra/settings.json`.
|
|
21
|
-
- `/plan` enters plan mode, and `/plan <request>` enters it and sends the request. `/plan exit` returns to the mode you were in before.
|
|
22
|
-
- `--approval-mode <mode>` starts the session in a mode for this run.
|
|
23
|
-
- The `approvalMode` setting sets the mode new sessions start in.
|
|
24
|
-
|
|
25
|
-
The footer shows the mode unless it is `yolo`. A mode change is recorded in the session, so `--resume`, `/tree`, and `/fork` keep the mode of that branch.
|
|
26
|
-
|
|
27
|
-
## Approve calls
|
|
28
|
-
|
|
29
|
-
When a call needs approval, Diffra shows a dialog with three choices:
|
|
30
|
-
|
|
31
|
-
- **Yes, allow once** runs this call.
|
|
32
|
-
- **Yes, always allow** remembers the answer for the rest of the session: for shell commands, every command that starts with the same programs (for example `npm`); for edits, it switches to `auto-edit`; for other tools, every call of that tool.
|
|
33
|
-
- **No** blocks the call, and the model is told you denied it.
|
|
34
|
-
|
|
35
|
-
Dialogs appear one at a time. Without an interactive UI (print and JSON mode), a call that needs approval is blocked and the model is told why. Use `yolo` mode, or `auto` for calls the classifier can approve, in unattended runs.
|
|
36
|
-
|
|
37
|
-
## Plan mode
|
|
38
|
-
|
|
39
|
-
In plan mode the model explores with read-only tools and writes a plan. Every model request carries a reminder of the plan-mode rules, and the model calls `exit_plan_mode` with its plan when it is ready. The tool is declared to the model only in plan mode.
|
|
40
|
-
|
|
41
|
-
`exit_plan_mode` shows the plan and asks how to continue:
|
|
42
|
-
|
|
43
|
-
- **Yes, restore the previous mode** returns to the mode before plan mode.
|
|
44
|
-
- **Yes, and auto-accept edits** continues in `auto-edit`.
|
|
45
|
-
- **Yes, and manually approve edits** continues in `default`.
|
|
46
|
-
- **No, keep planning** stays in plan mode.
|
|
47
|
-
|
|
48
|
-
Only your answer approves a plan; no mode or setting approves it for you. When plan mode ends another way, such as with `/plan exit`, the next model request tells the model that plan mode is over and no plan approval is pending.
|
|
49
|
-
|
|
50
|
-
A shell command that is neither recognized as read-only nor as state-modifying asks for a one-time approval of that exact command. It does not approve related commands or the plan.
|
|
51
|
-
|
|
52
|
-
## Auto mode
|
|
53
|
-
|
|
54
|
-
In auto mode, edits inside the project and read-only commands run directly. Everything else goes to a classifier model: shell commands that are not read-only, `web_fetch` and `web_search`, edits outside the project, and other tools such as MCP tools. Edits inside the project to files that configure the agent or persist across sessions also go to the classifier: `.diffra/`, `.git/`, `.husky/`, `.github/workflows/`, `AGENTS.md`, `CLAUDE.md`, `.mcp.json`, `package.json`, `.npmrc`, and `Makefile`. Symbolic links are resolved first, so a link out of the project counts as outside.
|
|
55
|
-
|
|
56
|
-
The classifier is the [`fastModel`](settings.md) when set, otherwise the session model. It sees the call and your latest message and answers whether to block it, with a reason. It follows a built-in policy: it allows reading, building, testing, installing project dependencies, and local edits; blocks deleting data outside the project, pushing, publishing, deploying, and sending data to third parties unless your latest message asked for exactly that; and always blocks destroying systems, running downloaded code, reading or sending credentials, persistence outside the project, weakening security, and force-pushing to `main` or `master`.
|
|
57
|
-
|
|
58
|
-
- A blocked call fails with the classifier's reason.
|
|
59
|
-
- When the classifier cannot answer (an error, a timeout, or an answer that is not the expected JSON), the call is blocked. After two such calls in a row, the next call asks you instead.
|
|
60
|
-
- After three blocks in a row, the third asks you instead, so the model does not loop on a blocked approach.
|
|
61
|
-
|
|
62
|
-
Add natural-language hints in the `permissions.autoMode` setting:
|
|
63
|
-
|
|
64
|
-
```json
|
|
65
|
-
{
|
|
66
|
-
"approvalMode": "auto",
|
|
67
|
-
"permissions": {
|
|
68
|
-
"autoMode": {
|
|
69
|
-
"hints": {
|
|
70
|
-
"allow": ["Running pytest, mypy, and ruff in this repository"],
|
|
71
|
-
"softDeny": ["Running database migrations"],
|
|
72
|
-
"hardDeny": ["Any network call to intranet.example.com"]
|
|
73
|
-
},
|
|
74
|
-
"environment": ["Private monorepo; commits are signed"],
|
|
75
|
-
"classifyAllShell": false,
|
|
76
|
-
"classifier": { "timeouts": { "stage1Ms": 10000 } }
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
| Setting | Meaning |
|
|
83
|
-
|---|---|
|
|
84
|
-
| `hints.allow` | Actions to allow |
|
|
85
|
-
| `hints.softDeny` | Actions to block unless your latest message asked for exactly that action and scope; `hints.deny` is an older name |
|
|
86
|
-
| `hints.hardDeny` | Actions to block regardless of hints or your request |
|
|
87
|
-
| `environment` | Facts about the environment for the classifier |
|
|
88
|
-
| `classifyAllShell` | Send read-only shell commands to the classifier too (default `false`) |
|
|
89
|
-
| `classifier.timeouts.stage1Ms` | Time limit of one classifier request in milliseconds (default `10000`) |
|
|
90
|
-
|
|
91
|
-
Each hint is cut to 200 characters; each list keeps its first 50 entries and `environment` its first 20.
|
|
92
|
-
|
|
93
|
-
## Differences from Qwen Code
|
|
94
|
-
|
|
95
|
-
- The default mode is `yolo`, not `auto`, so existing sessions keep running without dialogs.
|
|
96
|
-
- The cycle key is `alt+m`, not Shift+Tab, which cycles the thinking level in Diffra.
|
|
97
|
-
- The classifier makes one request per call and returns its reason; Qwen Code runs a fast stage and, after a block, a second reviewing stage.
|
|
98
|
-
- There are no `permissions.allow`, `permissions.ask`, or `permissions.deny` rules. Session approvals are the only remembered answers, and they end with the session.
|
|
99
|
-
- Approved plans are kept in the session (the `exit_plan_mode` call), not saved to a separate plans directory.
|
|
1
|
+
# Approve Tool Calls
|
|
2
|
+
|
|
3
|
+
Approval modes decide which tool calls run without asking. Diffra starts in `yolo` mode, which runs every call without asking, as earlier versions did. The other modes ask before edits and commands, let a classifier decide, or keep the session read-only for planning.
|
|
4
|
+
|
|
5
|
+
| Mode | Edits | Shell commands | Other tools |
|
|
6
|
+
|---|---|---|---|
|
|
7
|
+
| `plan` | Blocked | Read-only commands run; state-modifying ones are blocked; others need a one-time approval | Read-only tools only |
|
|
8
|
+
| `default` (Ask Permissions) | Ask | Ask | Ask, except local read-only tools |
|
|
9
|
+
| `auto-edit` | Allowed | Ask | Ask, except local read-only tools |
|
|
10
|
+
| `auto` | Allowed inside the project; classifier elsewhere | Read-only commands run; classifier for the rest | Classifier, except local read-only tools |
|
|
11
|
+
| `yolo` (default) | Allowed | Allowed | Allowed |
|
|
12
|
+
|
|
13
|
+
Local read-only tools are `read`, `grep`, `find`, `ls`, `todo_write`, `tool_search`, `codemode` (its calls are checked one by one), and tools whose annotations mark them read-only without reaching the web. `web_fetch`, `web_search`, and read-only tools that reach the web run in plan mode but ask in `default` and `auto-edit` mode.
|
|
14
|
+
|
|
15
|
+
Approval modes come from the built-in extension `builtin:approval`. Disabling it (`-builtin:approval` in the `extensions` setting, or `--no-extensions`) removes the checks, so every call runs as in `yolo` mode. They do not restrict what an allowed call can reach; the [sandbox](sandbox.md) does, and in `default`, `auto-edit`, and `auto` mode Diffra asks before running an action the sandbox blocked without it. See [Run Diffra Safely](security.md).
|
|
16
|
+
|
|
17
|
+
## Change the mode
|
|
18
|
+
|
|
19
|
+
- Press `alt+m` (`app.approvalMode.cycle`) to step through `plan`, `default`, `auto-edit`, `auto`, and `yolo`. Qwen Code uses Shift+Tab for this; in Diffra Shift+Tab cycles the thinking level, so the approval mode has its own key. Rebind it in [keybindings.json](keybindings.md).
|
|
20
|
+
- `/approval-mode` opens a selector; `/approval-mode <mode>` switches directly. Add `--user` or `--project` to also save the mode as the default for new sessions, in your settings or the project's `.diffra/settings.json`.
|
|
21
|
+
- `/plan` enters plan mode, and `/plan <request>` enters it and sends the request. `/plan exit` returns to the mode you were in before.
|
|
22
|
+
- `--approval-mode <mode>` starts the session in a mode for this run.
|
|
23
|
+
- The `approvalMode` setting sets the mode new sessions start in.
|
|
24
|
+
|
|
25
|
+
The footer shows the mode unless it is `yolo`. A mode change is recorded in the session, so `--resume`, `/tree`, and `/fork` keep the mode of that branch.
|
|
26
|
+
|
|
27
|
+
## Approve calls
|
|
28
|
+
|
|
29
|
+
When a call needs approval, Diffra shows a dialog with three choices:
|
|
30
|
+
|
|
31
|
+
- **Yes, allow once** runs this call.
|
|
32
|
+
- **Yes, always allow** remembers the answer for the rest of the session: for shell commands, every command that starts with the same programs (for example `npm`); for edits, it switches to `auto-edit`; for other tools, every call of that tool.
|
|
33
|
+
- **No** blocks the call, and the model is told you denied it.
|
|
34
|
+
|
|
35
|
+
Dialogs appear one at a time. Without an interactive UI (print and JSON mode), a call that needs approval is blocked and the model is told why. Use `yolo` mode, or `auto` for calls the classifier can approve, in unattended runs.
|
|
36
|
+
|
|
37
|
+
## Plan mode
|
|
38
|
+
|
|
39
|
+
In plan mode the model explores with read-only tools and writes a plan. Every model request carries a reminder of the plan-mode rules, and the model calls `exit_plan_mode` with its plan when it is ready. The tool is declared to the model only in plan mode.
|
|
40
|
+
|
|
41
|
+
`exit_plan_mode` shows the plan and asks how to continue:
|
|
42
|
+
|
|
43
|
+
- **Yes, restore the previous mode** returns to the mode before plan mode.
|
|
44
|
+
- **Yes, and auto-accept edits** continues in `auto-edit`.
|
|
45
|
+
- **Yes, and manually approve edits** continues in `default`.
|
|
46
|
+
- **No, keep planning** stays in plan mode.
|
|
47
|
+
|
|
48
|
+
Only your answer approves a plan; no mode or setting approves it for you. When plan mode ends another way, such as with `/plan exit`, the next model request tells the model that plan mode is over and no plan approval is pending.
|
|
49
|
+
|
|
50
|
+
A shell command that is neither recognized as read-only nor as state-modifying asks for a one-time approval of that exact command. It does not approve related commands or the plan.
|
|
51
|
+
|
|
52
|
+
## Auto mode
|
|
53
|
+
|
|
54
|
+
In auto mode, edits inside the project and read-only commands run directly. Everything else goes to a classifier model: shell commands that are not read-only, `web_fetch` and `web_search`, edits outside the project, and other tools such as MCP tools. Edits inside the project to files that configure the agent or persist across sessions also go to the classifier: `.diffra/`, `.git/`, `.husky/`, `.github/workflows/`, `AGENTS.md`, `CLAUDE.md`, `.mcp.json`, `package.json`, `.npmrc`, and `Makefile`. Symbolic links are resolved first, so a link out of the project counts as outside.
|
|
55
|
+
|
|
56
|
+
The classifier is the [`fastModel`](settings.md) when set, otherwise the session model. It sees the call and your latest message and answers whether to block it, with a reason. It follows a built-in policy: it allows reading, building, testing, installing project dependencies, and local edits; blocks deleting data outside the project, pushing, publishing, deploying, and sending data to third parties unless your latest message asked for exactly that; and always blocks destroying systems, running downloaded code, reading or sending credentials, persistence outside the project, weakening security, and force-pushing to `main` or `master`.
|
|
57
|
+
|
|
58
|
+
- A blocked call fails with the classifier's reason.
|
|
59
|
+
- When the classifier cannot answer (an error, a timeout, or an answer that is not the expected JSON), the call is blocked. After two such calls in a row, the next call asks you instead.
|
|
60
|
+
- After three blocks in a row, the third asks you instead, so the model does not loop on a blocked approach.
|
|
61
|
+
|
|
62
|
+
Add natural-language hints in the `permissions.autoMode` setting:
|
|
63
|
+
|
|
64
|
+
```json
|
|
65
|
+
{
|
|
66
|
+
"approvalMode": "auto",
|
|
67
|
+
"permissions": {
|
|
68
|
+
"autoMode": {
|
|
69
|
+
"hints": {
|
|
70
|
+
"allow": ["Running pytest, mypy, and ruff in this repository"],
|
|
71
|
+
"softDeny": ["Running database migrations"],
|
|
72
|
+
"hardDeny": ["Any network call to intranet.example.com"]
|
|
73
|
+
},
|
|
74
|
+
"environment": ["Private monorepo; commits are signed"],
|
|
75
|
+
"classifyAllShell": false,
|
|
76
|
+
"classifier": { "timeouts": { "stage1Ms": 10000 } }
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
| Setting | Meaning |
|
|
83
|
+
|---|---|
|
|
84
|
+
| `hints.allow` | Actions to allow |
|
|
85
|
+
| `hints.softDeny` | Actions to block unless your latest message asked for exactly that action and scope; `hints.deny` is an older name |
|
|
86
|
+
| `hints.hardDeny` | Actions to block regardless of hints or your request |
|
|
87
|
+
| `environment` | Facts about the environment for the classifier |
|
|
88
|
+
| `classifyAllShell` | Send read-only shell commands to the classifier too (default `false`) |
|
|
89
|
+
| `classifier.timeouts.stage1Ms` | Time limit of one classifier request in milliseconds (default `10000`) |
|
|
90
|
+
|
|
91
|
+
Each hint is cut to 200 characters; each list keeps its first 50 entries and `environment` its first 20.
|
|
92
|
+
|
|
93
|
+
## Differences from Qwen Code
|
|
94
|
+
|
|
95
|
+
- The default mode is `yolo`, not `auto`, so existing sessions keep running without dialogs.
|
|
96
|
+
- The cycle key is `alt+m`, not Shift+Tab, which cycles the thinking level in Diffra.
|
|
97
|
+
- The classifier makes one request per call and returns its reason; Qwen Code runs a fast stage and, after a block, a second reviewing stage.
|
|
98
|
+
- There are no `permissions.allow`, `permissions.ask`, or `permissions.deny` rules. Session approvals are the only remembered answers, and they end with the session.
|
|
99
|
+
- Approved plans are kept in the session (the `exit_plan_mode` call), not saved to a separate plans directory.
|