@eleboucher/opencode-memini 0.7.12 → 0.7.14
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 +4 -0
- package/memini-v2.js +9 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -60,6 +60,10 @@ The same options and env vars below apply. Recall injects into the request's
|
|
|
60
60
|
> `core/src/plugin/host.ts`. Until then, stay on the v1 entry above with the
|
|
61
61
|
> stable `opencode` binary.
|
|
62
62
|
|
|
63
|
+
The v2 plugin sends diagnostics through the structured `ctx.app.log` logger when
|
|
64
|
+
available. Logging is best-effort and remains silent when that logger is absent
|
|
65
|
+
or unavailable.
|
|
66
|
+
|
|
63
67
|
### Configure
|
|
64
68
|
|
|
65
69
|
Pass options inline via the `[name, options]` form:
|
package/memini-v2.js
CHANGED
|
@@ -144,16 +144,17 @@ export async function setup(ctx) {
|
|
|
144
144
|
// opencode runs the plugin in the project root, so cwd is the project dir —
|
|
145
145
|
// the same input resolveConfig/deriveNamespace expect.
|
|
146
146
|
const dir = process.cwd();
|
|
147
|
+
const emitLog = async (level, message) => {
|
|
148
|
+
try {
|
|
149
|
+
if (typeof ctx?.app?.log !== "function") return;
|
|
150
|
+
await ctx.app.log({ body: { service: "memini", level, message } });
|
|
151
|
+
} catch {
|
|
152
|
+
// Logging is best-effort and must never affect plugin behavior.
|
|
153
|
+
}
|
|
154
|
+
};
|
|
147
155
|
const log = {
|
|
148
156
|
warn: (message) => {
|
|
149
|
-
|
|
150
|
-
// fall back to stderr.
|
|
151
|
-
try {
|
|
152
|
-
ctx?.app?.log?.({ body: { service: "memini", level: "warn", message } });
|
|
153
|
-
} catch {
|
|
154
|
-
/* ignore logging failures */
|
|
155
|
-
}
|
|
156
|
-
console.error(`[memini] ${message}`);
|
|
157
|
+
void emitLog("warn", message);
|
|
157
158
|
},
|
|
158
159
|
};
|
|
159
160
|
|