@rehydra/opencode 0.13.0 → 0.14.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.
- package/README.md +34 -4
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# @rehydra/opencode
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Scrub detected secrets from OpenCode messages before the main LLM request.
|
|
4
4
|
|
|
5
5
|
This plugin intercepts the conversation between [OpenCode](https://github.com/sst/opencode) and the LLM. Secrets from your `.env` files are replaced with placeholders before they leave your machine, and transparently restored before any tool (shell commands, file writes, etc.) executes locally.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Detected values are masked in requests that pass through the plugin hooks. Local tools receive the restored values. See the title-generation limitation below.
|
|
8
8
|
|
|
9
9
|
## Install
|
|
10
10
|
|
|
@@ -20,7 +20,26 @@ Add to `opencode.json`:
|
|
|
20
20
|
}
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
By default, the plugin
|
|
23
|
+
By default, the plugin discovers `**/.env*` under the OpenCode project directory, including files such as `packages/api/.env` and `apps/web/.env.local`. It skips `node_modules`, `.git`, and symbolic links. Secrets with values of 4+ characters are detected and scrubbed.
|
|
24
|
+
|
|
25
|
+
`envFiles` accepts exact paths and glob patterns, resolved against the project directory even when OpenCode starts elsewhere. Use `envFiles: [".env"]` for root-only loading, or `envFiles: []` to disable file loading. Files are loaded once when the plugin initializes; restart OpenCode after changing them. Missing files are ignored. An advanced `anonymizer` configuration keeps control of its own `secrets` settings, with relative paths still rooted at the project directory unless `secrets.envBaseDirectory` is set.
|
|
26
|
+
|
|
27
|
+
## Session title limitation
|
|
28
|
+
|
|
29
|
+
OpenCode also sends the first user message to a separate LLM call to generate a session title. That call bypasses `experimental.chat.messages.transform`, so the plugin cannot scrub it. The first message can reach the title model with secrets intact even when the main conversation is anonymized. This limitation is tracked in [OpenCode issue #46115](https://github.com/anomalyco/opencode/issues/46115).
|
|
30
|
+
|
|
31
|
+
To prevent that request, disable OpenCode's title agent in `opencode.json`:
|
|
32
|
+
|
|
33
|
+
```json
|
|
34
|
+
{
|
|
35
|
+
"plugin": ["@rehydra/opencode"],
|
|
36
|
+
"agent": {
|
|
37
|
+
"title": { "disable": true }
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
This turns off automatic session titles. Restart OpenCode after changing the configuration. The plugin protects requests that invoke its hooks; it cannot intercept other model calls made outside those hooks.
|
|
24
43
|
|
|
25
44
|
## Configuration
|
|
26
45
|
|
|
@@ -41,9 +60,18 @@ export default createRehydraPlugin({
|
|
|
41
60
|
|
|
42
61
|
// Disable detection of specific PII types
|
|
43
62
|
disableTypes: ["URL", "IP_ADDRESS"],
|
|
63
|
+
|
|
64
|
+
// Redact identities in Git and GitHub CLI output
|
|
65
|
+
vcsIdentities: true,
|
|
44
66
|
});
|
|
45
67
|
```
|
|
46
68
|
|
|
69
|
+
`vcsIdentities` detects logins in `gh pr` and `gh api` output, plus author and
|
|
70
|
+
committer names in `git log`, `git show`, and `git blame` output. It redacts
|
|
71
|
+
every occurrence of those identities in the same tool output without touching
|
|
72
|
+
npm scopes or other `@` identifiers in unrelated commands. GitHub display names
|
|
73
|
+
outside these structured fields still require the optional local NER model.
|
|
74
|
+
|
|
47
75
|
## What gets detected
|
|
48
76
|
|
|
49
77
|
- Environment variable values from `.env` files
|
|
@@ -64,7 +92,7 @@ The plugin uses five OpenCode hooks:
|
|
|
64
92
|
| `tool.execute.after` | Restores real values in displayed tool output |
|
|
65
93
|
| `text.complete` | Restores real values in LLM response text shown to you |
|
|
66
94
|
|
|
67
|
-
|
|
95
|
+
Detection and rehydration run locally. The main conversation is scrubbed through the message hook before forwarding to the LLM provider. The separate title request described above needs its own opt-out.
|
|
68
96
|
|
|
69
97
|
## Logging
|
|
70
98
|
|
|
@@ -84,3 +112,5 @@ Full documentation at [docs.rehydra.ai](https://docs.rehydra.ai).
|
|
|
84
112
|
## License
|
|
85
113
|
|
|
86
114
|
MIT
|
|
115
|
+
|
|
116
|
+
VCS identity discovery supports direct `gh pr`, `gh api`, `git log`, `git show`, and `git blame` commands, including global options such as `git -C` and `gh --repo`. Commands hidden inside shell scripts or aliases need explicit integration or NER. GitHub discovery masks participant fields and mentions of those participants; it preserves JSON keys and npm scopes. `disableTypes` still takes precedence over identity detection.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rehydra/opencode",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"description": "Rehydra plugin for OpenCode — anonymizes secrets in LLM context using native plugin hooks",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"directory": "packages/opencode-plugin"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"rehydra": "^0.
|
|
32
|
+
"rehydra": "^0.14.0"
|
|
33
33
|
},
|
|
34
34
|
"engines": {
|
|
35
35
|
"node": ">=18.0.0"
|