@openviking/opencode-plugin 2026.9.9-1 → 2026.9.10
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/lib/shared/pending-queue.mjs +41 -5
- package/package.json +2 -2
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
*
|
|
5
5
|
* When the OpenViking server is temporarily unreachable, write operations
|
|
6
6
|
* (addMessage, commitSession) serialize their payloads to
|
|
7
|
-
* `~/.openviking/pending/` as JSON files.
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* `~/.openviking/pending/` as JSON files. The queue is replayed in small
|
|
8
|
+
* batches, either at session-start (consuming retry budgets, with
|
|
9
|
+
* maxRetries/TTL) or by a long-running drainer that passes
|
|
10
|
+
* `consumeRetries: false` so transient failures stay retryable.
|
|
10
11
|
*
|
|
11
12
|
* Each file contains: { type, sessionId, payload, createdAt, retries, dedupKey }
|
|
12
13
|
*
|
|
@@ -274,6 +275,23 @@ export async function claimForReplay(filename) {
|
|
|
274
275
|
}
|
|
275
276
|
}
|
|
276
277
|
|
|
278
|
+
/**
|
|
279
|
+
* Release a claimed file back to the queue without consuming a retry. The
|
|
280
|
+
* entry keeps its original filename, retry count, and createdAt position, so a
|
|
281
|
+
* later run retries it as if this attempt never happened.
|
|
282
|
+
*/
|
|
283
|
+
export async function releaseClaim(claimedFilename) {
|
|
284
|
+
if (!claimedFilename.endsWith(".processing")) return null;
|
|
285
|
+
const dir = getPendingDir();
|
|
286
|
+
const restored = pendingFromProcessingFilename(claimedFilename);
|
|
287
|
+
try {
|
|
288
|
+
await rename(join(dir, claimedFilename), join(dir, restored));
|
|
289
|
+
return restored;
|
|
290
|
+
} catch {
|
|
291
|
+
return null;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
277
295
|
/**
|
|
278
296
|
* Remove a pending entry after successful replay.
|
|
279
297
|
*/
|
|
@@ -350,9 +368,16 @@ export async function cleanStale() {
|
|
|
350
368
|
*
|
|
351
369
|
* @param {Function} fetchJSON - the configured fetchJSON from makeFetchJSON
|
|
352
370
|
* @param {Function} log - logger function
|
|
371
|
+
* @param {object} [options]
|
|
372
|
+
* @param {boolean} [options.consumeRetries=true] - when false, retryable
|
|
373
|
+
* failures release their claim instead of incrementing the retry count, so
|
|
374
|
+
* a background drainer can keep retrying a transient failure without
|
|
375
|
+
* burning the session-start retry budget. Exhausted and non-retryable
|
|
376
|
+
* entries are deleted exactly as in the default mode.
|
|
353
377
|
* @returns {{ replayed: number, failed: number, skipped: number, deferred: number }}
|
|
354
378
|
*/
|
|
355
|
-
export async function replayPending(fetchJSON, log) {
|
|
379
|
+
export async function replayPending(fetchJSON, log, options = {}) {
|
|
380
|
+
const consumeRetries = options.consumeRetries !== false;
|
|
356
381
|
const pending = await listPending();
|
|
357
382
|
|
|
358
383
|
if (pending.length === 0) {
|
|
@@ -427,7 +452,18 @@ export async function replayPending(fetchJSON, log) {
|
|
|
427
452
|
await dequeue(claimedFilename);
|
|
428
453
|
skipped++;
|
|
429
454
|
} else {
|
|
430
|
-
|
|
455
|
+
if (consumeRetries) {
|
|
456
|
+
await incrementRetry(claimedFilename, entry);
|
|
457
|
+
} else {
|
|
458
|
+
const released = await releaseClaim(claimedFilename);
|
|
459
|
+
log("pending-queue", {
|
|
460
|
+
action: released ? "replay-deferred" : "release-failed",
|
|
461
|
+
sessionId: entry.sessionId,
|
|
462
|
+
type: entry.type,
|
|
463
|
+
status: res?.result?.status || res?.status,
|
|
464
|
+
retries: entry.retries || 0,
|
|
465
|
+
});
|
|
466
|
+
}
|
|
431
467
|
failed++;
|
|
432
468
|
if (entry.type === "addMessage") {
|
|
433
469
|
deferred += Math.max(0, pending.length - processed);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openviking/opencode-plugin",
|
|
3
|
-
"version": "2026.9.
|
|
3
|
+
"version": "2026.9.10",
|
|
4
4
|
"author": "@openviking",
|
|
5
5
|
"description": "Unified OpenCode plugin for OpenViking repository retrieval and long-term memory",
|
|
6
6
|
"type": "module",
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"code-search"
|
|
45
45
|
],
|
|
46
46
|
"license": "Apache-2.0",
|
|
47
|
-
"openvikingSourceCommit": "
|
|
47
|
+
"openvikingSourceCommit": "3841e6f2992bc2299142f5ec50143e6b30e55ac0"
|
|
48
48
|
}
|