@rehydra/opencode 0.15.0 → 0.16.1
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 +9 -3
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -35,7 +35,7 @@ Add to `opencode.json` — **OpenCode 2** uses the plural `plugins` key:
|
|
|
35
35
|
|
|
36
36
|
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.
|
|
37
37
|
|
|
38
|
-
`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.
|
|
38
|
+
`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. Before a model request, the plugin checks the files again if at least `envRefreshInterval` milliseconds (default 2000) have passed since the last check, so new or changed secrets are picked up without restarting OpenCode. Set `envRefreshInterval: false` to load them only at startup. 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.
|
|
39
39
|
|
|
40
40
|
## Configuration
|
|
41
41
|
|
|
@@ -53,6 +53,7 @@ OpenCode 2 passes options natively, with no local plugin file needed:
|
|
|
53
53
|
"redactValues": ["sk-live-abc123..."],
|
|
54
54
|
"minValueLength": 6,
|
|
55
55
|
"disableTypes": ["URL", "IP_ADDRESS"],
|
|
56
|
+
"redactTools": ["webfetch", "websearch", "*image_generate", "exa_*"],
|
|
56
57
|
"vcsIdentities": true
|
|
57
58
|
}
|
|
58
59
|
}
|
|
@@ -96,6 +97,9 @@ export default createRehydraPluginV2({
|
|
|
96
97
|
// Disable detection of specific PII types
|
|
97
98
|
disableTypes: ["URL", "IP_ADDRESS"],
|
|
98
99
|
|
|
100
|
+
// Keep placeholders in the arguments of tools that call external services
|
|
101
|
+
redactTools: ["webfetch", "websearch", "*image_generate", "exa_*"],
|
|
102
|
+
|
|
99
103
|
// Redact identities in Git and GitHub CLI output
|
|
100
104
|
vcsIdentities: true,
|
|
101
105
|
});
|
|
@@ -105,6 +109,8 @@ On OpenCode 1, import `createRehydraPlugin` instead (it returns the callable V1
|
|
|
105
109
|
|
|
106
110
|
`vcsIdentities` detects logins in `gh pr` and `gh api` output, plus author and committer names in `git log`, `git show`, and `git blame` output. It redacts every occurrence of those identities in the same tool output without touching npm scopes or other `@` identifiers in unrelated commands. GitHub display names outside these structured fields still require the optional local NER model.
|
|
107
111
|
|
|
112
|
+
`redactTools` lists tools whose arguments keep their placeholders. The plugin normally restores real values before a tool runs. For these tools it leaves the placeholders in place and redacts any other detected values in the arguments, so secrets and PII don't reach external services through tools such as `webfetch`, `websearch`, or OpenCode 2's `experimental_image_generate`, which sends its prompt to an image model. `*` matches any characters, which helps with MCP tools: `"exa_*"`. The default is `["webfetch", "websearch", "*image_generate"]`. Setting `redactTools` replaces it, so keep those in your list, or pass `[]` to restore real values for every tool.
|
|
113
|
+
|
|
108
114
|
## What gets detected
|
|
109
115
|
|
|
110
116
|
- Environment variable values from `.env` files
|
|
@@ -121,7 +127,7 @@ On OpenCode 1, import `createRehydraPlugin` instead (it returns the callable V1
|
|
|
121
127
|
| --------------------------------------------------------------- | -------------------------------------------------------------- |
|
|
122
128
|
| `session.hook("context" / "compaction" / "generate" / "title")` | Scrubs secrets from all message text before each model request |
|
|
123
129
|
| `event.system.push(...)` | Tells the LLM to treat placeholders as real values |
|
|
124
|
-
| `tool.hook("execute.before")` | Restores real values in tool arguments before local execution
|
|
130
|
+
| `tool.hook("execute.before")` | Restores real values in tool arguments before local execution, except for `redactTools` |
|
|
125
131
|
| `tool.hook("execute.after")` | Restores real values in displayed tool output |
|
|
126
132
|
|
|
127
133
|
The scrubber is registered on all four session-request kinds, so title generation, checkpoint compaction, and transient generates are protected too.
|
|
@@ -132,7 +138,7 @@ The scrubber is registered on all four session-request kinds, so title generatio
|
|
|
132
138
|
| -------------------------------------- | -------------------------------------------------------------- |
|
|
133
139
|
| `experimental.chat.messages.transform` | Scrubs secrets from all message text before it reaches the LLM |
|
|
134
140
|
| `experimental.chat.system.transform` | Tells the LLM to treat placeholders as real values |
|
|
135
|
-
| `tool.execute.before` | Restores real values in tool arguments before local execution
|
|
141
|
+
| `tool.execute.before` | Restores real values in tool arguments before local execution, except for `redactTools` |
|
|
136
142
|
| `tool.execute.after` | Restores real values in displayed tool output |
|
|
137
143
|
| `experimental.text.complete` | Restores real values in LLM response text shown to you |
|
|
138
144
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rehydra/opencode",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.1",
|
|
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.16.1"
|
|
33
33
|
},
|
|
34
34
|
"engines": {
|
|
35
35
|
"node": ">=18.0.0"
|