icex-dsh-memory 0.2.4 → 0.2.5
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/index.js +12 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
* `memory` tool; when it does not, the policy falls back to editing the file
|
|
20
20
|
* with the built-in filesystem tools.
|
|
21
21
|
*/
|
|
22
|
+
import { randomUUID } from 'node:crypto'
|
|
22
23
|
import { existsSync, mkdirSync, readFileSync, writeFileSync, renameSync, rmSync, statSync } from 'node:fs'
|
|
23
24
|
import { createHash } from 'node:crypto'
|
|
24
25
|
import { homedir } from 'node:os'
|
|
@@ -357,6 +358,16 @@ function policy(storePaths) {
|
|
|
357
358
|
].join('\n')
|
|
358
359
|
}
|
|
359
360
|
|
|
361
|
+
/** Build a complete user message: the inbox accepts UserMessage, not a partial literal. */
|
|
362
|
+
export function memoryMessage(text) {
|
|
363
|
+
return {
|
|
364
|
+
id: randomUUID(),
|
|
365
|
+
role: 'user',
|
|
366
|
+
content: [{ type: 'text', text }],
|
|
367
|
+
source: { kind: 'user' },
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
|
|
360
371
|
/** Resolve the session working directory, falling back to the process cwd. */
|
|
361
372
|
async function workingDirectory(ctx, agent, signal) {
|
|
362
373
|
try {
|
|
@@ -510,7 +521,7 @@ export function apply(ctx, config) {
|
|
|
510
521
|
}
|
|
511
522
|
const text = renderDigest(cwd)
|
|
512
523
|
if (text === '') return
|
|
513
|
-
agent.inject(
|
|
524
|
+
agent.inject(memoryMessage(text))
|
|
514
525
|
} catch (error) {
|
|
515
526
|
ctx.logger?.warn?.('icex-dsh-memory: digest injection failed: ' + String(error))
|
|
516
527
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "icex-dsh-memory",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Cross-session memory for DeepSeek Harness: a budgeted MEMORY.md digest injected once per session, plus one memory tool with provenance back to the producing session.",
|
|
6
6
|
"exports": {
|