@try-works/dsh-memory 0.1.7 → 0.1.8

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@try-works/dsh-memory",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
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",
@@ -358,6 +358,11 @@ window.__ModuleLoader__.load({
358
358
  */
359
359
  const MEMORY_STATE_NONE = { kind: 'none', meta: null, seq: null, time: null }
360
360
  const MEMORY_STATE_UNAVAILABLE = { kind: 'unavailable', meta: null, seq: null, time: null }
361
+ // Distinct from NONE on purpose. PTC mode dispatches a tool from inside a run_code program and
362
+ // records tool/ptc-dispatch, which carries the rendered text but NO structured value, so there
363
+ // is genuinely nothing to draw - and telling the reader 'memory_map has not run here' would be
364
+ // false.
365
+ const MEMORY_STATE_NESTED = { kind: 'nested', meta: null, seq: null, time: null }
361
366
 
362
367
  /**
363
368
  * Find the newest memory_map result in the window and say what it carried.
@@ -370,10 +375,13 @@ window.__ModuleLoader__.load({
370
375
  const entries = window && Array.isArray(window.entries) ? window.entries : null
371
376
  if (!entries) return MEMORY_STATE_NONE
372
377
  const calls = Object.create(null)
378
+ let nested = false
373
379
  for (let i = 0; i < entries.length; i += 1) {
374
380
  const entry = entries[i]
375
381
  const event = entry && entry.type === 'event' ? entry.event : null
376
382
  if (event && event.type === 'tool/call' && event.data && event.data.name === 'memory_map') calls[event.data.callId] = true
383
+ // A nested dispatch is a real call the agent made; it simply has no structured result.
384
+ if (event && event.type === 'tool/ptc-dispatch' && event.data && event.data.name === 'memory_map') nested = true
377
385
  }
378
386
  // Newest first: the tab describes the session as it stands now, not as it first was.
379
387
  for (let i = entries.length - 1; i >= 0; i -= 1) {
@@ -392,7 +400,7 @@ window.__ModuleLoader__.load({
392
400
  if (meta === null || typeof meta !== 'object') return { kind: 'empty', meta: null, seq: event.seq, time: event.time }
393
401
  return { kind: 'ready', meta: meta, seq: event.seq, time: event.time }
394
402
  }
395
- return MEMORY_STATE_NONE
403
+ return nested ? MEMORY_STATE_NESTED : MEMORY_STATE_NONE
396
404
  }
397
405
 
398
406
  /**
@@ -493,6 +501,15 @@ window.__ModuleLoader__.load({
493
501
  ],
494
502
  }
495
503
  }
504
+ if (state.kind === 'nested') {
505
+ return {
506
+ title: 'memory_map ran here, but not as a readable result',
507
+ lines: [
508
+ 'This session called memory_map from inside a run_code program. Those calls are recorded as nested dispatches, which keep the rendered text and not the structured value this tab draws.',
509
+ 'Calling memory_map directly - scope "session" or "all" - records a result the panels can read.',
510
+ ],
511
+ }
512
+ }
496
513
  return {
497
514
  title: 'No memory_map result in this session yet',
498
515
  lines: [