@try-works/dsh-memory 0.1.24 → 0.1.26
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/host.js +16 -3
- package/src/tools.js +6 -1
package/package.json
CHANGED
package/src/host.js
CHANGED
|
@@ -326,11 +326,11 @@ export function wireHost(ctx, store, cfg) {
|
|
|
326
326
|
*/
|
|
327
327
|
const recoverNow = {
|
|
328
328
|
plan() {
|
|
329
|
-
const p = planRecovery(store.root, { thresholdBytes: cfg.recoverApprovalThresholdBytes })
|
|
329
|
+
const p = planRecovery(store.root, { thresholdBytes: cfg.recoverApprovalThresholdBytes, bytesOf: cfg.recoverBytesOf })
|
|
330
330
|
return { total: p.total, recoverable: p.recoverable, oversized: p.oversized, missing: p.missing, thresholdBytes: p.threshold }
|
|
331
331
|
},
|
|
332
332
|
async run(args, exec) {
|
|
333
|
-
const p = planRecovery(store.root, { thresholdBytes: cfg.recoverApprovalThresholdBytes })
|
|
333
|
+
const p = planRecovery(store.root, { thresholdBytes: cfg.recoverApprovalThresholdBytes, bytesOf: cfg.recoverBytesOf })
|
|
334
334
|
const candidates = args.id
|
|
335
335
|
? p.entries.filter((e) => e.id === args.id)
|
|
336
336
|
: p.entries.filter((e) => !e.needsApproval).sort((a, b) => (a.bytes ?? 0) - (b.bytes ?? 0)).slice(0, args.limit ?? 1)
|
|
@@ -357,7 +357,20 @@ export function wireHost(ctx, store, cfg) {
|
|
|
357
357
|
if (outcome !== 'allowed-once') { declined.push({ id: target.id, why: String(outcome) }); continue }
|
|
358
358
|
}
|
|
359
359
|
try {
|
|
360
|
-
|
|
360
|
+
// Services are resolved at CALL time, never at wire time: cordis ctx.get() returns
|
|
361
|
+
// undefined while the providing fiber is not active (mount), and this run path executes
|
|
362
|
+
// inside a tool call, when the host is fully up. The first version referenced a
|
|
363
|
+
// `services` binding that was never defined - a ReferenceError the catch quietly turned
|
|
364
|
+
// into "1 declined or refused", which is how 75 recoverable candidates sat behind a
|
|
365
|
+
// tool that could only refuse them.
|
|
366
|
+
const sessionQuery = ctx.get('sessionQuery')
|
|
367
|
+
if (!sessionQuery) { declined.push({ id: target.id, why: 'sessionQuery service unavailable' }); continue }
|
|
368
|
+
// The recovered session has no live agent to route through, so the summary uses the
|
|
369
|
+
// plugin's own memory model ladder.
|
|
370
|
+
await recoverOne(store, {
|
|
371
|
+
sessionQuery,
|
|
372
|
+
llm: (prompt) => runLlm(undefined, prompt, 'memory-summary', 1200),
|
|
373
|
+
}, target.id, { cfg, now: () => Date.now() })
|
|
361
374
|
recovered.push({ id: target.id, bytes: target.bytes })
|
|
362
375
|
logRun(store.root, 'recover', { count: 1, detail: { id: target.id } })
|
|
363
376
|
} catch (error) {
|
package/src/tools.js
CHANGED
|
@@ -758,7 +758,12 @@ export function registerTools(ctx, store, extras = {}) {
|
|
|
758
758
|
if (!syncNow) return { synced: false }
|
|
759
759
|
const status = await syncNow()
|
|
760
760
|
return {
|
|
761
|
-
synced
|
|
761
|
+
// `synced` means SYNCED, not 'it did something'. It used to include committed and
|
|
762
|
+
// initialized, so a push that FAILED still reported synced:true whenever the local commit
|
|
763
|
+
// had succeeded - the result read {"synced":true,"conflict":true}, claiming success and
|
|
764
|
+
// failure at once. A local commit is progress, not a sync, and saying otherwise is the same
|
|
765
|
+
// defect as every other one this layer has produced: a green answer over a silent failure.
|
|
766
|
+
synced: Boolean(status && status.synced),
|
|
762
767
|
...(status && status.conflict ? { conflict: true } : {}),
|
|
763
768
|
...(status && status.error ? { error: String(status.error) } : {}),
|
|
764
769
|
}
|