rehydra 0.14.0 → 0.16.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.
@@ -2,5 +2,36 @@
2
2
  * Rehydra OpenCode Plugin
3
3
  * Anonymizes secrets in LLM context via OpenCode's native plugin hooks.
4
4
  */
5
- export { createRehydraPlugin, default } from "./plugin.js";
5
+ import { createRehydraPlugin } from "./plugin.js";
6
+ import { createRehydraPluginV2 } from "./plugin-v2.js";
7
+ export { createRehydraPlugin } from "./plugin.js";
8
+ export { createRehydraPluginV2 } from "./plugin-v2.js";
9
+ /**
10
+ * Dual V1/V2 default export.
11
+ *
12
+ * - OpenCode 2 reads the `id` and `setup()` members and ignores `server()`.
13
+ * - OpenCode 1 object entrypoints (>= 1.18.29) call `server()` and use the
14
+ * returned V1 hooks.
15
+ *
16
+ * V1 releases older than 1.18.29 expect a function export; on those, import
17
+ * `createRehydraPlugin()` (the callable factory) instead of using the default
18
+ * export.
19
+ */
20
+ const defaultV2Plugin = createRehydraPluginV2();
21
+ export default {
22
+ id: defaultV2Plugin.id,
23
+ setup: defaultV2Plugin.setup,
24
+ async server(input, options) {
25
+ // Deprecated V1 entrypoint. Fall back to a no-op client and the current
26
+ // working directory when the harness calls `server()` without input.
27
+ const resolved = input ?? {
28
+ client: {
29
+ app: { log: () => Promise.resolve(undefined) },
30
+ },
31
+ directory: process.cwd(),
32
+ worktree: process.cwd(),
33
+ };
34
+ return await createRehydraPlugin()(resolved, options);
35
+ },
36
+ };
6
37
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/opencode-plugin/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,mBAAmB,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/opencode-plugin/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAQvD;;;;;;;;;;GAUG;AACH,MAAM,eAAe,GAAG,qBAAqB,EAAE,CAAC;AAEhD,eAAe;IACb,EAAE,EAAE,eAAe,CAAC,EAAE;IACtB,KAAK,EAAE,eAAe,CAAC,KAAK;IAC5B,KAAK,CAAC,MAAM,CACV,KAA6D,EAC7D,OAAiC;QAEjC,wEAAwE;QACxE,qEAAqE;QACrE,MAAM,QAAQ,GAAG,KAAK,IAAI;YACxB,MAAM,EAAE;gBACN,GAAG,EAAE,EAAE,GAAG,EAAE,GAAuB,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE;aACnE;YACD,SAAS,EAAE,OAAO,CAAC,GAAG,EAAE;YACxB,QAAQ,EAAE,OAAO,CAAC,GAAG,EAAE;SACxB,CAAC;QACF,OAAO,MAAM,mBAAmB,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACxD,CAAC;CACF,CAAC"}
@@ -0,0 +1,91 @@
1
+ /**
2
+ * Rehydra OpenCode Plugin — OpenCode 2 (V2 plugin API) implementation.
3
+ *
4
+ * OpenCode 2 replaces the V1 hooks-object entrypoint with a plugin definition
5
+ * that exposes a stable `id` and registers hooks through a plugin context.
6
+ * Mapping from the V1 hooks:
7
+ *
8
+ * V1 hook V2 registration
9
+ * -------------------------------------- -----------------------------------------------------
10
+ * experimental.chat.messages.transform ctx.session.hook("context" | "compaction" | "generate" | "title")
11
+ * experimental.chat.system.transform same hooks — event.system.push({ type: "text", text })
12
+ * tool.execute.before ctx.tool.hook("execute.before") — mutate event.input in place
13
+ * tool.execute.after ctx.tool.hook("execute.after") — event.result / event.status
14
+ * experimental.text.complete no V2 equivalent (documented gap — see README)
15
+ * client.app.log console.* (captured by OpenCode's log service)
16
+ *
17
+ * The V2 session-request event shape (@opencode/ai SessionRequest) differs from
18
+ * V1: { sessionID, system, messages: Message[] } where each Message has a role
19
+ * and content parts. Text/reasoning parts carry `text`; tool-call parts carry
20
+ * `input`; tool-result parts carry `result`. Tool calls and results share the
21
+ * same `id` across messages, which is used to pair VCS commands with outputs.
22
+ *
23
+ * Registering the scrubber on all four session-request kinds also protects the
24
+ * session-title request, closing the V1 title leak (OpenCode issue #46115)
25
+ * without disabling the title agent.
26
+ *
27
+ * Structural types only: the plugin declares its own minimal shapes for the
28
+ * OpenCode plugin context, so there is no runtime (or build) dependency on
29
+ * OpenCode packages.
30
+ */
31
+ import type { RehydraPluginOptions } from "./types.js";
32
+ /**
33
+ * The part of the OpenCode 2 plugin context this plugin uses. The real context
34
+ * (@opencode/plugin Context) satisfies this structurally.
35
+ */
36
+ export interface RehydraV2PluginContext {
37
+ readonly app: {
38
+ readonly name: string;
39
+ readonly version: string;
40
+ };
41
+ readonly location: {
42
+ readonly directory: string;
43
+ readonly project?: unknown;
44
+ };
45
+ readonly options: Record<string, unknown>;
46
+ readonly session: {
47
+ hook(name: string, callback: (event: unknown) => void | Promise<void>): Promise<unknown>;
48
+ };
49
+ readonly tool: {
50
+ hook(name: string, callback: (event: unknown) => void | Promise<void>): Promise<unknown>;
51
+ };
52
+ }
53
+ export type RehydraCleanup = () => void | Promise<void>;
54
+ /** Default-exported plugin definition consumed by OpenCode 2. */
55
+ export interface RehydraV2Plugin {
56
+ readonly id: string;
57
+ readonly setup: (context: RehydraV2PluginContext) => Promise<RehydraCleanup | void>;
58
+ }
59
+ /**
60
+ * Creates a Rehydra plugin definition for OpenCode 2.
61
+ *
62
+ * @example
63
+ * ```json
64
+ * // opencode.json — published npm package with default options
65
+ * { "plugins": ["@rehydra/opencode"] }
66
+ * ```
67
+ *
68
+ * @example
69
+ * ```json
70
+ * // opencode.json — npm package with custom options
71
+ * {
72
+ * "plugins": [{
73
+ * "package": "@rehydra/opencode",
74
+ * "options": { "envFiles": [".env", ".env.local"] }
75
+ * }]
76
+ * }
77
+ * ```
78
+ *
79
+ * @example
80
+ * ```typescript
81
+ * // .opencode/plugins/rehydra.ts — local plugin with custom options
82
+ * import { createRehydraPluginV2 } from "@rehydra/opencode";
83
+ * export default createRehydraPluginV2({
84
+ * envFiles: [".env", ".env.local"],
85
+ * });
86
+ * ```
87
+ */
88
+ export declare function createRehydraPluginV2(options?: RehydraPluginOptions): RehydraV2Plugin;
89
+ declare const _default: RehydraV2Plugin;
90
+ export default _default;
91
+ //# sourceMappingURL=plugin-v2.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-v2.d.ts","sourceRoot":"","sources":["../../src/opencode-plugin/plugin-v2.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAIH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAkDvD;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,GAAG,EAAE;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAClE,QAAQ,CAAC,QAAQ,EAAE;QAAE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;IAC9E,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC1C,QAAQ,CAAC,OAAO,EAAE;QAChB,IAAI,CACF,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GACjD,OAAO,CAAC,OAAO,CAAC,CAAC;KACrB,CAAC;IACF,QAAQ,CAAC,IAAI,EAAE;QACb,IAAI,CACF,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GACjD,OAAO,CAAC,OAAO,CAAC,CAAC;KACrB,CAAC;CACH;AAED,MAAM,MAAM,cAAc,GAAG,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAExD,iEAAiE;AACjE,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,CACd,OAAO,EAAE,sBAAsB,KAC5B,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;CACrC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,CAAC,EAAE,oBAAoB,GAC7B,eAAe,CA0HjB;;AAED,wBAAuC"}
@@ -0,0 +1,166 @@
1
+ /**
2
+ * Rehydra OpenCode Plugin — OpenCode 2 (V2 plugin API) implementation.
3
+ *
4
+ * OpenCode 2 replaces the V1 hooks-object entrypoint with a plugin definition
5
+ * that exposes a stable `id` and registers hooks through a plugin context.
6
+ * Mapping from the V1 hooks:
7
+ *
8
+ * V1 hook V2 registration
9
+ * -------------------------------------- -----------------------------------------------------
10
+ * experimental.chat.messages.transform ctx.session.hook("context" | "compaction" | "generate" | "title")
11
+ * experimental.chat.system.transform same hooks — event.system.push({ type: "text", text })
12
+ * tool.execute.before ctx.tool.hook("execute.before") — mutate event.input in place
13
+ * tool.execute.after ctx.tool.hook("execute.after") — event.result / event.status
14
+ * experimental.text.complete no V2 equivalent (documented gap — see README)
15
+ * client.app.log console.* (captured by OpenCode's log service)
16
+ *
17
+ * The V2 session-request event shape (@opencode/ai SessionRequest) differs from
18
+ * V1: { sessionID, system, messages: Message[] } where each Message has a role
19
+ * and content parts. Text/reasoning parts carry `text`; tool-call parts carry
20
+ * `input`; tool-result parts carry `result`. Tool calls and results share the
21
+ * same `id` across messages, which is used to pair VCS commands with outputs.
22
+ *
23
+ * Registering the scrubber on all four session-request kinds also protects the
24
+ * session-title request, closing the V1 title leak (OpenCode issue #46115)
25
+ * without disabling the title agent.
26
+ *
27
+ * Structural types only: the plugin declares its own minimal shapes for the
28
+ * OpenCode plugin context, so there is no runtime (or build) dependency on
29
+ * OpenCode packages.
30
+ */
31
+ import { createRehydraCore, mergeOptions } from "./core.js";
32
+ /** Session request kinds that can be hooked in OpenCode 2. */
33
+ const REQUEST_KINDS = [
34
+ "context",
35
+ "compaction",
36
+ "generate",
37
+ "title",
38
+ ];
39
+ /**
40
+ * Creates a Rehydra plugin definition for OpenCode 2.
41
+ *
42
+ * @example
43
+ * ```json
44
+ * // opencode.json — published npm package with default options
45
+ * { "plugins": ["@rehydra/opencode"] }
46
+ * ```
47
+ *
48
+ * @example
49
+ * ```json
50
+ * // opencode.json — npm package with custom options
51
+ * {
52
+ * "plugins": [{
53
+ * "package": "@rehydra/opencode",
54
+ * "options": { "envFiles": [".env", ".env.local"] }
55
+ * }]
56
+ * }
57
+ * ```
58
+ *
59
+ * @example
60
+ * ```typescript
61
+ * // .opencode/plugins/rehydra.ts — local plugin with custom options
62
+ * import { createRehydraPluginV2 } from "@rehydra/opencode";
63
+ * export default createRehydraPluginV2({
64
+ * envFiles: [".env", ".env.local"],
65
+ * });
66
+ * ```
67
+ */
68
+ export function createRehydraPluginV2(options) {
69
+ return {
70
+ id: "rehydra",
71
+ async setup(ctx) {
72
+ const SERVICE = "rehydra";
73
+ // OpenCode 2 removes client.app.log from the plugin context. Plain console
74
+ // output is captured by OpenCode's log service, so the structured
75
+ // "service=rehydra …" entries survive in the log directory.
76
+ function log(level, message, extra) {
77
+ const payload = {
78
+ service: SERVICE,
79
+ level,
80
+ message,
81
+ ...extra,
82
+ };
83
+ if (level === "error") {
84
+ console.error(payload);
85
+ }
86
+ else if (level === "warn") {
87
+ console.warn(payload);
88
+ }
89
+ else {
90
+ console.log(payload);
91
+ }
92
+ }
93
+ // Factory options take precedence over options from opencode.json
94
+ // (ctx.options). Both feed the same RehydraPluginOptions shape.
95
+ const core = await createRehydraCore(mergeOptions(ctx.options, options), {
96
+ directory: ctx.location.directory,
97
+ log,
98
+ info: { opencode: `${ctx.app.name} ${ctx.app.version}` },
99
+ });
100
+ /**
101
+ * Scrubs one outgoing model request. OpenCode 2 delivers the same request
102
+ * shape to the `context` (agent loop), `compaction`, `generate`, and
103
+ * `title` session hooks, so one implementation covers every kind.
104
+ */
105
+ async function scrubRequest(event) {
106
+ await core.refreshSecrets();
107
+ const request = core.startRequest();
108
+ // Commands by tool-call id, captured before scrubbing so VCS detection
109
+ // tokens survive anonymization. Tool results pair with their call by id.
110
+ const commandsByCallId = new Map();
111
+ for (const msg of event.messages) {
112
+ const content = msg.content;
113
+ if (!Array.isArray(content))
114
+ continue;
115
+ for (const part of content) {
116
+ if (part.type === "tool-call") {
117
+ const input = part.input;
118
+ if (typeof part.id === "string" && input !== null && typeof input === "object") {
119
+ commandsByCallId.set(part.id, input.command);
120
+ }
121
+ part.input = await request.copy(event.sessionID, part.input);
122
+ }
123
+ else if (part.type === "text" || part.type === "reasoning") {
124
+ if (typeof part.text === "string") {
125
+ part.text = await request.text(event.sessionID, part.text);
126
+ }
127
+ }
128
+ else if (part.type === "tool-result" &&
129
+ part.result !== undefined &&
130
+ part.result !== null) {
131
+ const command = typeof part.id === "string" ? commandsByCallId.get(part.id) : undefined;
132
+ part.result = await request.copy(event.sessionID, part.result, core.outputPolicy(command));
133
+ }
134
+ }
135
+ }
136
+ request.finish(event.messages.length);
137
+ if (core.hasAnonymized) {
138
+ log("debug", "injected rehydra instruction into system prompt");
139
+ event.system.push({ type: "text", text: core.rehydraInstruction });
140
+ }
141
+ }
142
+ // Register the scrubber on every model-request kind OpenCode 2 can issue:
143
+ // agent loop, checkpoint compaction, transient generates, session titles.
144
+ for (const kind of REQUEST_KINDS) {
145
+ await ctx.session.hook(kind, (event) => scrubRequest(event));
146
+ }
147
+ await ctx.tool.hook("execute.before", async (event) => {
148
+ const toolEvent = event;
149
+ toolEvent.input = await core.beforeTool(toolEvent.tool, toolEvent.sessionID, toolEvent.id, toolEvent.input);
150
+ });
151
+ // Result shape varies by tool type: native tools return their result
152
+ // object while MCP tools return the raw CallToolResult
153
+ // ({ content: [{type,text}], … }). Every string is rehydrated.
154
+ await ctx.tool.hook("execute.after", async (event) => {
155
+ const toolEvent = event;
156
+ if (toolEvent.status === "error")
157
+ return;
158
+ toolEvent.result = await core.afterTool(toolEvent.tool, toolEvent.sessionID, toolEvent.id, toolEvent.result);
159
+ });
160
+ // Drop the PII maps when the plugin unloads.
161
+ return () => core.dispose();
162
+ },
163
+ };
164
+ }
165
+ export default createRehydraPluginV2();
166
+ //# sourceMappingURL=plugin-v2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-v2.js","sourceRoot":"","sources":["../../src/opencode-plugin/plugin-v2.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAKH,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAE5D,8DAA8D;AAC9D,MAAM,aAAa,GAA4D;IAC7E,SAAS;IACT,YAAY;IACZ,UAAU;IACV,OAAO;CACC,CAAC;AAyEX;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,UAAU,qBAAqB,CACnC,OAA8B;IAE9B,OAAO;QACL,EAAE,EAAE,SAAS;QACb,KAAK,CAAC,KAAK,CAAC,GAAG;YACb,MAAM,OAAO,GAAG,SAAS,CAAC;YAE1B,2EAA2E;YAC3E,kEAAkE;YAClE,4DAA4D;YAC5D,SAAS,GAAG,CACV,KAA0C,EAC1C,OAAe,EACf,KAA+B;gBAE/B,MAAM,OAAO,GAA4B;oBACvC,OAAO,EAAE,OAAO;oBAChB,KAAK;oBACL,OAAO;oBACP,GAAG,KAAK;iBACT,CAAC;gBACF,IAAI,KAAK,KAAK,OA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AAED,eAAe,qBAAqB,EAAE,CAAC"}
@@ -34,7 +34,7 @@ interface OpencodeClient {
34
34
  };
35
35
  [key: string]: unknown;
36
36
  }
37
- type Plugin = (input: PluginInput) => Promise<Hooks>;
37
+ type Plugin = (input: PluginInput, options?: Record<string, unknown>) => Promise<Hooks>;
38
38
  interface Hooks {
39
39
  [key: string]: unknown;
40
40
  }
@@ -53,10 +53,10 @@ interface Hooks {
53
53
  * @example
54
54
  * ```json
55
55
  * // opencode.json — when published as npm package
56
- * { "plugin": ["@rehydra/opencode-plugin"] }
56
+ * { "plugin": [["@rehydra/opencode", { "disableTypes": ["DATE"] }]] }
57
57
  * ```
58
58
  */
59
- export declare function createRehydraPlugin(options?: RehydraPluginOptions): Plugin;
59
+ export declare function createRehydraPlugin(factoryOptions?: RehydraPluginOptions): Plugin;
60
60
  declare const _default: Plugin;
61
61
  export default _default;
62
62
  //# sourceMappingURL=plugin.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/opencode-plugin/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAQH,OAAO,KAAK,EAAe,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAQpE;;;GAGG;AACH,UAAU,WAAW;IACnB,MAAM,EAAE,cAAc,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,UAAU,cAAc;IACtB,GAAG,EAAE;QACH,GAAG,CAAC,KAAK,EAAE;YACT,IAAI,EAAE;gBACJ,OAAO,EAAE,MAAM,CAAC;gBAChB,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;gBAC3C,OAAO,EAAE,MAAM,CAAC;gBAChB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;aACjC,CAAC;SACH,GAAG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