opencode-lore 0.1.3 → 0.1.4
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/package.json +1 -1
- package/src/index.ts +20 -15
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -312,23 +312,28 @@ export const LorePlugin: Plugin = async (ctx) => {
|
|
|
312
312
|
rawBudget: result.rawBudget,
|
|
313
313
|
updatedAt: Date.now(),
|
|
314
314
|
};
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
);
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
315
|
+
// Use the SDK's internal HTTP client so the request goes through
|
|
316
|
+
// the same base URL, custom fetch, and interceptors that OpenCode
|
|
317
|
+
// configured — no dependency on ctx.serverUrl being reachable.
|
|
318
|
+
const httpClient = (ctx.client as any)._client;
|
|
319
|
+
httpClient.patch({
|
|
320
|
+
url: "/session/{sessionID}/message/{messageID}/part/{partID}",
|
|
321
|
+
path: {
|
|
322
|
+
sessionID,
|
|
323
|
+
messageID: lastUserMsg.info.id,
|
|
324
|
+
partID: statsPart.id,
|
|
325
|
+
},
|
|
326
|
+
body: {
|
|
327
|
+
...(statsPart as Record<string, unknown>),
|
|
328
|
+
metadata: {
|
|
329
|
+
...((statsPart as { metadata?: Record<string, unknown> }).metadata ?? {}),
|
|
330
|
+
lore: loreMeta,
|
|
331
|
+
},
|
|
324
332
|
},
|
|
325
|
-
};
|
|
326
|
-
fetch(url, {
|
|
327
|
-
method: "PATCH",
|
|
328
333
|
headers: { "Content-Type": "application/json" },
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
334
|
+
}).catch(() => {
|
|
335
|
+
// Non-critical: gradient stats metadata is for UI display only.
|
|
336
|
+
// Server may not be reachable (e.g. TUI-only mode). Silently ignore.
|
|
332
337
|
});
|
|
333
338
|
}
|
|
334
339
|
},
|