@try-works/dsh-memory 0.1.25 → 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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/host.js +16 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@try-works/dsh-memory",
3
- "version": "0.1.25",
3
+ "version": "0.1.26",
4
4
  "description": "Git-backed, workspace-scoped memory for the DeepSeek Harness (global layer + per-workspace layers)",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
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
- await recoverOne(store, services, target.id, { cfg, now: () => Date.now() })
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) {