@namzu/cli 26.3.0 → 27.0.0
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/CHANGELOG.md +214 -0
- package/README.md +49 -34
- package/dist/bin.js +7 -0
- package/dist/bin.js.map +1 -1
- package/dist/checkpoints/store.d.ts +17 -4
- package/dist/checkpoints/store.d.ts.map +1 -1
- package/dist/checkpoints/store.js +20 -5
- package/dist/checkpoints/store.js.map +1 -1
- package/dist/cli.js +2 -2
- package/dist/cli.js.map +1 -1
- package/dist/commands/acp.d.ts +23 -1
- package/dist/commands/acp.d.ts.map +1 -1
- package/dist/commands/acp.js +41 -2
- package/dist/commands/acp.js.map +1 -1
- package/dist/commands/drain.d.ts +69 -2
- package/dist/commands/drain.d.ts.map +1 -1
- package/dist/commands/drain.js +214 -134
- package/dist/commands/drain.js.map +1 -1
- package/dist/commands/eval.js +1 -1
- package/dist/commands/eval.js.map +1 -1
- package/dist/commands/provider-wait.d.ts +5 -5
- package/dist/commands/provider-wait.d.ts.map +1 -1
- package/dist/commands/provider-wait.js +2 -2
- package/dist/commands/resident.d.ts.map +1 -1
- package/dist/commands/resident.js +2 -1
- package/dist/commands/resident.js.map +1 -1
- package/dist/commands/run-flags.d.ts +7 -7
- package/dist/commands/run-flags.js +4 -4
- package/dist/commands/run-stream.d.ts +16 -12
- package/dist/commands/run-stream.d.ts.map +1 -1
- package/dist/commands/run-stream.js +142 -98
- package/dist/commands/run-stream.js.map +1 -1
- package/dist/commands/run.d.ts +6 -4
- package/dist/commands/run.d.ts.map +1 -1
- package/dist/commands/run.js +129 -45
- package/dist/commands/run.js.map +1 -1
- package/dist/commands/serve.js +2 -2
- package/dist/commands/serve.js.map +1 -1
- package/dist/commands/state.js +8 -8
- package/dist/commands/state.js.map +1 -1
- package/dist/config/load.d.ts +1 -1
- package/dist/config/load.d.ts.map +1 -1
- package/dist/config/load.js +17 -5
- package/dist/config/load.js.map +1 -1
- package/dist/config/run-limits.d.ts +20 -8
- package/dist/config/run-limits.d.ts.map +1 -1
- package/dist/config/run-limits.js +28 -46
- package/dist/config/run-limits.js.map +1 -1
- package/dist/config/schema.d.ts +44 -19
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/schema.js.map +1 -1
- package/dist/config/tool-result-screens.js +1 -1
- package/dist/context/directories.d.ts +37 -0
- package/dist/context/directories.d.ts.map +1 -0
- package/dist/context/directories.js +69 -0
- package/dist/context/directories.js.map +1 -0
- package/dist/context/environment.d.ts +55 -0
- package/dist/context/environment.d.ts.map +1 -1
- package/dist/context/environment.js +96 -0
- package/dist/context/environment.js.map +1 -1
- package/dist/context/project-tracker.d.ts +3 -3
- package/dist/context/project-tracker.d.ts.map +1 -1
- package/dist/context/project-tracker.js +3 -3
- package/dist/context/project-tracker.js.map +1 -1
- package/dist/context/project.d.ts +1 -1
- package/dist/context/project.js +1 -1
- package/dist/context/sandbox.d.ts +22 -3
- package/dist/context/sandbox.d.ts.map +1 -1
- package/dist/context/sandbox.js +42 -4
- package/dist/context/sandbox.js.map +1 -1
- package/dist/doctor/checks/chain.d.ts +1 -1
- package/dist/doctor/checks/chain.js +5 -5
- package/dist/doctor/checks/chain.js.map +1 -1
- package/dist/doctor/checks/invariants.d.ts +2 -2
- package/dist/doctor/checks/invariants.js +5 -5
- package/dist/doctor/checks/invariants.js.map +1 -1
- package/dist/doctor/checks/logging.js +1 -1
- package/dist/doctor/checks/logging.js.map +1 -1
- package/dist/doctor/checks/sandbox.js +1 -1
- package/dist/doctor/checks/sandbox.js.map +1 -1
- package/dist/doctor/checks/session-export.d.ts +1 -1
- package/dist/doctor/checks/session-export.js +2 -2
- package/dist/doctor/checks/session-export.js.map +1 -1
- package/dist/doctor/checks/telemetry.d.ts +1 -1
- package/dist/doctor/checks/telemetry.js +1 -1
- package/dist/doctor/registry.js +2 -2
- package/dist/doctor/registry.js.map +1 -1
- package/dist/exit-codes.d.ts +2 -2
- package/dist/exit-codes.js +2 -2
- package/dist/integrations/mcp/servers.d.ts +1 -1
- package/dist/integrations/providers/chain-capabilities.d.ts +6 -6
- package/dist/integrations/providers/chain-capabilities.js +8 -8
- package/dist/integrations/providers/chain-capabilities.js.map +1 -1
- package/dist/integrations/providers/register.d.ts +1 -1
- package/dist/integrations/providers/register.js +1 -1
- package/dist/integrations/providers/registry.d.ts +1 -1
- package/dist/integrations/resident/inspection.d.ts +4 -1
- package/dist/integrations/resident/inspection.d.ts.map +1 -1
- package/dist/integrations/resident/inspection.js +53 -34
- package/dist/integrations/resident/inspection.js.map +1 -1
- package/dist/integrations/resident/learning-storage.d.ts +7 -2
- package/dist/integrations/resident/learning-storage.d.ts.map +1 -1
- package/dist/integrations/resident/learning-storage.js +12 -8
- package/dist/integrations/resident/learning-storage.js.map +1 -1
- package/dist/integrations/resident/runner-store.d.ts +1 -1
- package/dist/integrations/resident/runner-store.d.ts.map +1 -1
- package/dist/integrations/resident/runner-store.js +5 -2
- package/dist/integrations/resident/runner-store.js.map +1 -1
- package/dist/integrations/resident/runner-worker.js +1 -0
- package/dist/integrations/resident/runner-worker.js.map +1 -1
- package/dist/integrations/resident/session-log-reads.d.ts +37 -0
- package/dist/integrations/resident/session-log-reads.d.ts.map +1 -0
- package/dist/integrations/resident/session-log-reads.js +125 -0
- package/dist/integrations/resident/session-log-reads.js.map +1 -0
- package/dist/integrations/resident/session-step.d.ts +2 -0
- package/dist/integrations/resident/session-step.d.ts.map +1 -1
- package/dist/integrations/resident/session-step.js +15 -13
- package/dist/integrations/resident/session-step.js.map +1 -1
- package/dist/integrations/resident/storage.d.ts +23 -1
- package/dist/integrations/resident/storage.d.ts.map +1 -1
- package/dist/integrations/resident/storage.js +60 -17
- package/dist/integrations/resident/storage.js.map +1 -1
- package/dist/integrations/resident/tool-evidence.d.ts +4 -2
- package/dist/integrations/resident/tool-evidence.d.ts.map +1 -1
- package/dist/integrations/resident/tool-evidence.js +36 -30
- package/dist/integrations/resident/tool-evidence.js.map +1 -1
- package/dist/integrations/resident/verification.d.ts +2 -2
- package/dist/integrations/resident/verification.d.ts.map +1 -1
- package/dist/integrations/resident/verification.js +4 -4
- package/dist/integrations/resident/verification.js.map +1 -1
- package/dist/integrations/sessions/checkpoint-view.d.ts +13 -0
- package/dist/integrations/sessions/checkpoint-view.d.ts.map +1 -0
- package/dist/integrations/sessions/checkpoint-view.js +48 -0
- package/dist/integrations/sessions/checkpoint-view.js.map +1 -0
- package/dist/integrations/sessions/context-inventory.js +1 -1
- package/dist/integrations/sessions/context-inventory.js.map +1 -1
- package/dist/integrations/sessions/conversation-search.d.ts +16 -20
- package/dist/integrations/sessions/conversation-search.d.ts.map +1 -1
- package/dist/integrations/sessions/conversation-search.js +305 -731
- package/dist/integrations/sessions/conversation-search.js.map +1 -1
- package/dist/integrations/sessions/evidence-page-validation.d.ts +4 -4
- package/dist/integrations/sessions/evidence-page-validation.d.ts.map +1 -1
- package/dist/integrations/sessions/evidence-page-validation.js +1 -1
- package/dist/integrations/sessions/evidence-page-validation.js.map +1 -1
- package/dist/integrations/sessions/evidence-recall.d.ts +40 -2
- package/dist/integrations/sessions/evidence-recall.d.ts.map +1 -1
- package/dist/integrations/sessions/evidence-recall.js +41 -97
- package/dist/integrations/sessions/evidence-recall.js.map +1 -1
- package/dist/integrations/sessions/store.d.ts +153 -85
- package/dist/integrations/sessions/store.d.ts.map +1 -1
- package/dist/integrations/sessions/store.js +414 -484
- package/dist/integrations/sessions/store.js.map +1 -1
- package/dist/integrations/sessions/task-context.d.ts +15 -2
- package/dist/integrations/sessions/task-context.d.ts.map +1 -1
- package/dist/integrations/sessions/task-context.js +34 -11
- package/dist/integrations/sessions/task-context.js.map +1 -1
- package/dist/integrations/sessions/transcript-export.d.ts +13 -6
- package/dist/integrations/sessions/transcript-export.d.ts.map +1 -1
- package/dist/integrations/sessions/transcript-export.js +148 -263
- package/dist/integrations/sessions/transcript-export.js.map +1 -1
- package/dist/integrations/state/home.d.ts +4 -16
- package/dist/integrations/state/home.d.ts.map +1 -1
- package/dist/integrations/state/home.js +6 -42
- package/dist/integrations/state/home.js.map +1 -1
- package/dist/integrations/state/project.d.ts +6 -7
- package/dist/integrations/state/project.d.ts.map +1 -1
- package/dist/integrations/state/project.js +7 -9
- package/dist/integrations/state/project.js.map +1 -1
- package/dist/integrations/state/report.d.ts +27 -41
- package/dist/integrations/state/report.d.ts.map +1 -1
- package/dist/integrations/state/report.js +172 -464
- package/dist/integrations/state/report.js.map +1 -1
- package/dist/integrations/state/retention.d.ts +18 -0
- package/dist/integrations/state/retention.d.ts.map +1 -0
- package/dist/integrations/state/retention.js +18 -0
- package/dist/integrations/state/retention.js.map +1 -0
- package/dist/integrations/subagents/activity.d.ts +36 -31
- package/dist/integrations/subagents/activity.d.ts.map +1 -1
- package/dist/integrations/subagents/activity.js +27 -23
- package/dist/integrations/subagents/activity.js.map +1 -1
- package/dist/integrations/subagents/batches.d.ts +91 -0
- package/dist/integrations/subagents/batches.d.ts.map +1 -0
- package/dist/integrations/subagents/batches.js +172 -0
- package/dist/integrations/subagents/batches.js.map +1 -0
- package/dist/integrations/subagents/parent.d.ts +26 -11
- package/dist/integrations/subagents/parent.d.ts.map +1 -1
- package/dist/integrations/subagents/parent.js +13 -28
- package/dist/integrations/subagents/parent.js.map +1 -1
- package/dist/integrations/subagents/policy.d.ts +2 -2
- package/dist/integrations/subagents/policy.d.ts.map +1 -1
- package/dist/integrations/subagents/policy.js +2 -2
- package/dist/integrations/subagents/policy.js.map +1 -1
- package/dist/integrations/subagents/replay.d.ts +91 -26
- package/dist/integrations/subagents/replay.d.ts.map +1 -1
- package/dist/integrations/subagents/replay.js +216 -114
- package/dist/integrations/subagents/replay.js.map +1 -1
- package/dist/integrations/subagents/runtime.d.ts +50 -26
- package/dist/integrations/subagents/runtime.d.ts.map +1 -1
- package/dist/integrations/subagents/runtime.js +132 -126
- package/dist/integrations/subagents/runtime.js.map +1 -1
- package/dist/integrations/subagents/saved-agents.d.ts +57 -0
- package/dist/integrations/subagents/saved-agents.d.ts.map +1 -0
- package/dist/integrations/subagents/saved-agents.js +102 -0
- package/dist/integrations/subagents/saved-agents.js.map +1 -0
- package/dist/integrations/subagents/slash.d.ts +55 -0
- package/dist/integrations/subagents/slash.d.ts.map +1 -0
- package/dist/integrations/subagents/slash.js +45 -0
- package/dist/integrations/subagents/slash.js.map +1 -0
- package/dist/integrations/telemetry/session-export.d.ts +6 -6
- package/dist/integrations/telemetry/session-export.d.ts.map +1 -1
- package/dist/integrations/telemetry/session-export.js +2 -2
- package/dist/memory/presentation.d.ts +11 -0
- package/dist/memory/presentation.d.ts.map +1 -1
- package/dist/memory/presentation.js +25 -0
- package/dist/memory/presentation.js.map +1 -1
- package/dist/memory/store.d.ts +13 -7
- package/dist/memory/store.d.ts.map +1 -1
- package/dist/memory/store.js +37 -11
- package/dist/memory/store.js.map +1 -1
- package/dist/memory/typed.d.ts +116 -0
- package/dist/memory/typed.d.ts.map +1 -0
- package/dist/memory/typed.js +336 -0
- package/dist/memory/typed.js.map +1 -0
- package/dist/permissions/checks.d.ts +1 -1
- package/dist/permissions/checks.js +1 -1
- package/dist/permissions/headless-trust.d.ts +2 -2
- package/dist/permissions/headless-trust.d.ts.map +1 -1
- package/dist/permissions/headless-trust.js +3 -3
- package/dist/permissions/headless-trust.js.map +1 -1
- package/dist/permissions/mode.d.ts +4 -4
- package/dist/permissions/mode.js +1 -1
- package/dist/permissions/rules.d.ts +1 -1
- package/dist/permissions/rules.js +1 -1
- package/dist/termination.d.ts +75 -0
- package/dist/termination.d.ts.map +1 -0
- package/dist/termination.js +143 -0
- package/dist/termination.js.map +1 -0
- package/dist/tui/AgentExplorer.d.ts +2 -2
- package/dist/tui/AgentExplorer.js +4 -4
- package/dist/tui/AgentExplorer.js.map +1 -1
- package/dist/tui/App.d.ts +9 -1
- package/dist/tui/App.d.ts.map +1 -1
- package/dist/tui/App.js +452 -303
- package/dist/tui/App.js.map +1 -1
- package/dist/tui/LiveActivity.d.ts +1 -1
- package/dist/tui/LiveActivity.d.ts.map +1 -1
- package/dist/tui/PermissionOverlay.d.ts +8 -0
- package/dist/tui/PermissionOverlay.d.ts.map +1 -1
- package/dist/tui/PermissionOverlay.js +25 -2
- package/dist/tui/PermissionOverlay.js.map +1 -1
- package/dist/tui/Picker.js +1 -1
- package/dist/tui/agent.d.ts +208 -132
- package/dist/tui/agent.d.ts.map +1 -1
- package/dist/tui/agent.js +523 -313
- package/dist/tui/agent.js.map +1 -1
- package/dist/tui/conversation-evidence-view.js +3 -3
- package/dist/tui/conversation-evidence-view.js.map +1 -1
- package/dist/tui/conversation-history.d.ts +4 -21
- package/dist/tui/conversation-history.d.ts.map +1 -1
- package/dist/tui/conversation-history.js +4 -28
- package/dist/tui/conversation-history.js.map +1 -1
- package/dist/tui/index.d.ts.map +1 -1
- package/dist/tui/index.js +27 -1
- package/dist/tui/index.js.map +1 -1
- package/dist/tui/log-pane.js +1 -1
- package/dist/tui/markdownParser.d.ts +1 -1
- package/dist/tui/markdownParser.js +1 -1
- package/dist/tui/permission-review.d.ts +16 -0
- package/dist/tui/permission-review.d.ts.map +1 -1
- package/dist/tui/permission-review.js +25 -2
- package/dist/tui/permission-review.js.map +1 -1
- package/dist/tui/slashCommands.d.ts +29 -40
- package/dist/tui/slashCommands.d.ts.map +1 -1
- package/dist/tui/slashCommands.js +70 -61
- package/dist/tui/slashCommands.js.map +1 -1
- package/dist/tui/{run-interruption.d.ts → turn-interruption.d.ts} +4 -4
- package/dist/tui/turn-interruption.d.ts.map +1 -0
- package/dist/tui/{run-interruption.js → turn-interruption.js} +20 -20
- package/dist/tui/turn-interruption.js.map +1 -0
- package/dist/tui/turn-limits-settings.d.ts +39 -0
- package/dist/tui/turn-limits-settings.d.ts.map +1 -0
- package/dist/tui/{run-limits-settings.js → turn-limits-settings.js} +18 -18
- package/dist/tui/turn-limits-settings.js.map +1 -0
- package/dist/tui/types.d.ts +3 -3
- package/dist/tui/types.d.ts.map +1 -1
- package/dist/user-commands/store.d.ts +1 -1
- package/dist/user-commands/store.js +1 -1
- package/package.json +7 -7
- package/dist/integrations/sessions/compaction-evidence.d.ts +0 -5
- package/dist/integrations/sessions/compaction-evidence.d.ts.map +0 -1
- package/dist/integrations/sessions/compaction-evidence.js +0 -59
- package/dist/integrations/sessions/compaction-evidence.js.map +0 -1
- package/dist/integrations/sessions/database.d.ts +0 -5
- package/dist/integrations/sessions/database.d.ts.map +0 -1
- package/dist/integrations/sessions/database.js +0 -34
- package/dist/integrations/sessions/database.js.map +0 -1
- package/dist/integrations/sessions/paths.d.ts +0 -7
- package/dist/integrations/sessions/paths.d.ts.map +0 -1
- package/dist/integrations/sessions/paths.js +0 -14
- package/dist/integrations/sessions/paths.js.map +0 -1
- package/dist/integrations/sessions/run-discovery.d.ts +0 -24
- package/dist/integrations/sessions/run-discovery.d.ts.map +0 -1
- package/dist/integrations/sessions/run-discovery.js +0 -142
- package/dist/integrations/sessions/run-discovery.js.map +0 -1
- package/dist/integrations/sessions/turn-evidence.d.ts +0 -129
- package/dist/integrations/sessions/turn-evidence.d.ts.map +0 -1
- package/dist/integrations/sessions/turn-evidence.js +0 -517
- package/dist/integrations/sessions/turn-evidence.js.map +0 -1
- package/dist/integrations/subagents/history.d.ts +0 -26
- package/dist/integrations/subagents/history.d.ts.map +0 -1
- package/dist/integrations/subagents/history.js +0 -76
- package/dist/integrations/subagents/history.js.map +0 -1
- package/dist/integrations/subagents/runs.d.ts +0 -72
- package/dist/integrations/subagents/runs.d.ts.map +0 -1
- package/dist/integrations/subagents/runs.js +0 -155
- package/dist/integrations/subagents/runs.js.map +0 -1
- package/dist/tui/run-interruption.d.ts.map +0 -1
- package/dist/tui/run-interruption.js.map +0 -1
- package/dist/tui/run-limits-settings.d.ts +0 -39
- package/dist/tui/run-limits-settings.d.ts.map +0 -1
- package/dist/tui/run-limits-settings.js.map +0 -1
package/dist/memory/store.d.ts
CHANGED
|
@@ -4,20 +4,24 @@
|
|
|
4
4
|
* Two scopes, three files:
|
|
5
5
|
* - `~/.namzu/USER.md` — who the operator is. User scope.
|
|
6
6
|
* - `~/.namzu/MEMORY.md` — facts that hold in every project. User scope.
|
|
7
|
-
* - `<project>/.namzu/MEMORY.md` — facts about this repository
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
7
|
+
* - `<project>/.namzu/MEMORY.md` — facts about this repository, written by the
|
|
8
|
+
* operator. Project scope. It used to be where `#note` appended; those
|
|
9
|
+
* bullets stay. `/memory import-notes` copies them into stored memory
|
|
10
|
+
* (`importCuratedNotes`) without changing the file, and a launch only
|
|
11
|
+
* offers it (`migrateMemoryOnce`).
|
|
12
12
|
*
|
|
13
13
|
* Each section is capped before injection. A memory file grows for months;
|
|
14
14
|
* an uncapped one would spend the context every turn on the part nobody
|
|
15
15
|
* curated. The cap keeps the head, says how much it left out, and the fix is
|
|
16
16
|
* to edit the file — which is the whole point of a curated memory.
|
|
17
17
|
*
|
|
18
|
-
* Separate from
|
|
19
|
-
*
|
|
18
|
+
* Separate from stored memory (`memory/typed.ts`): typed Markdown files the
|
|
19
|
+
* kernel's memory tools search and update, whose generated index the prompt
|
|
20
|
+
* carries under its own heading. `#note` and `/memory add` write there now;
|
|
21
|
+
* `/memory --user add` still appends to the user file here, because stored
|
|
22
|
+
* memory belongs to one project.
|
|
20
23
|
*/
|
|
24
|
+
import { type MemoryLocation } from './io.js';
|
|
21
25
|
export { MEMORY_FILE_MAX_BYTES } from './io.js';
|
|
22
26
|
/** Characters of one section injected before the rest is left to the file. */
|
|
23
27
|
export declare const MEMORY_SECTION_MAX_CHARS = 8000;
|
|
@@ -38,6 +42,8 @@ export interface MemoryContent {
|
|
|
38
42
|
readonly project: string | null;
|
|
39
43
|
readonly diagnostics?: readonly MemoryDiagnostic[];
|
|
40
44
|
}
|
|
45
|
+
/** The project's curated file and the root it must resolve within. */
|
|
46
|
+
export declare function projectMemoryLocation(cwd: string): MemoryLocation;
|
|
41
47
|
/** Read bounded, valid UTF-8 files; distinguish missing/empty files from refused content. */
|
|
42
48
|
export declare function readMemory(home?: string, cwd?: string): MemoryContent;
|
|
43
49
|
export declare function composeMemoryPrompt(content: MemoryContent): string | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/memory/store.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/memory/store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAQH,OAAO,EAAE,KAAK,cAAc,EAAuD,MAAM,SAAS,CAAA;AAElG,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAE/C,8EAA8E;AAC9E,eAAO,MAAM,wBAAwB,OAAQ,CAAA;AAE7C,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,MAAM,CAAA;AAE5C,wBAAgB,SAAS,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED,wBAAgB,YAAY,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAElD;AAED,wBAAgB,cAAc,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED,8EAA8E;AAC9E,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAYzD;AAED,MAAM,WAAW,gBAAgB;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CACvB;AAED,MAAM,WAAW,aAAa;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IAC9B,qFAAqF;IACrF,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IAC/B,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,gBAAgB,EAAE,CAAA;CAClD;AAED,sEAAsE;AACtE,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,CAEjE;AAOD,6FAA6F;AAC7F,wBAAgB,UAAU,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,aAAa,CAkCrE;AAyBD,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM,GAAG,IAAI,CAsBzE;AAED,MAAM,WAAW,kBAAkB;IAClC,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAA;IAC3B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;IACtB,sCAAsC;IACtC,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CACrB;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,kBAAkB,GAAG,MAAM,CAEvF;AAED,MAAM,WAAW,kBAAkB;IAClC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAA;IAC3B,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAA;IAC1B,oFAAoF;IACpF,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAA;CAClC;AAED,wBAAgB,sBAAsB,CACrC,IAAI,EAAE,MAAM,EACZ,MAAM,CAAC,EAAE,MAAM,GAAG,kBAAkB,GAClC,kBAAkB,CAqBpB"}
|
package/dist/memory/store.js
CHANGED
|
@@ -4,19 +4,22 @@
|
|
|
4
4
|
* Two scopes, three files:
|
|
5
5
|
* - `~/.namzu/USER.md` — who the operator is. User scope.
|
|
6
6
|
* - `~/.namzu/MEMORY.md` — facts that hold in every project. User scope.
|
|
7
|
-
* - `<project>/.namzu/MEMORY.md` — facts about this repository
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
7
|
+
* - `<project>/.namzu/MEMORY.md` — facts about this repository, written by the
|
|
8
|
+
* operator. Project scope. It used to be where `#note` appended; those
|
|
9
|
+
* bullets stay. `/memory import-notes` copies them into stored memory
|
|
10
|
+
* (`importCuratedNotes`) without changing the file, and a launch only
|
|
11
|
+
* offers it (`migrateMemoryOnce`).
|
|
12
12
|
*
|
|
13
13
|
* Each section is capped before injection. A memory file grows for months;
|
|
14
14
|
* an uncapped one would spend the context every turn on the part nobody
|
|
15
15
|
* curated. The cap keeps the head, says how much it left out, and the fix is
|
|
16
16
|
* to edit the file — which is the whole point of a curated memory.
|
|
17
17
|
*
|
|
18
|
-
* Separate from
|
|
19
|
-
*
|
|
18
|
+
* Separate from stored memory (`memory/typed.ts`): typed Markdown files the
|
|
19
|
+
* kernel's memory tools search and update, whose generated index the prompt
|
|
20
|
+
* carries under its own heading. `#note` and `/memory add` write there now;
|
|
21
|
+
* `/memory --user add` still appends to the user file here, because stored
|
|
22
|
+
* memory belongs to one project.
|
|
20
23
|
*/
|
|
21
24
|
import { realpathSync } from 'node:fs';
|
|
22
25
|
import { join, resolve } from 'node:path';
|
|
@@ -52,6 +55,10 @@ export function projectMemoryFilePath(cwd) {
|
|
|
52
55
|
return local;
|
|
53
56
|
return join(root, '.namzu', 'MEMORY.md');
|
|
54
57
|
}
|
|
58
|
+
/** The project's curated file and the root it must resolve within. */
|
|
59
|
+
export function projectMemoryLocation(cwd) {
|
|
60
|
+
return projectLocation(cwd);
|
|
61
|
+
}
|
|
55
62
|
function projectLocation(cwd) {
|
|
56
63
|
const directory = realpathSync(resolve(cwd));
|
|
57
64
|
return { path: projectMemoryFilePath(directory), root: cliProjectRoot(directory) };
|
|
@@ -84,11 +91,26 @@ export function readMemory(home, cwd) {
|
|
|
84
91
|
root: userRoot,
|
|
85
92
|
path: join(userRoot, 'MEMORY.md'),
|
|
86
93
|
}));
|
|
87
|
-
|
|
94
|
+
// Started in the home directory, the project's `.namzu/MEMORY.md` IS the
|
|
95
|
+
// user's `MEMORY.md` — same file, read twice, injected under two headings
|
|
96
|
+
// into every prompt. It is the user's file; it is read once, as that.
|
|
97
|
+
const project = cwd && !isUserMemoryFile(join(resolve(cwd), '.namzu', 'MEMORY.md'), userRoot)
|
|
88
98
|
? read(join(resolve(cwd), '.namzu', 'MEMORY.md'), () => projectLocation(cwd))
|
|
89
99
|
: null;
|
|
90
100
|
return { user, memory, project, ...(diagnostics.length > 0 ? { diagnostics } : {}) };
|
|
91
101
|
}
|
|
102
|
+
/** Whether a project memory path names the user's own `MEMORY.md`, symlinks resolved. */
|
|
103
|
+
function isUserMemoryFile(projectPath, userRoot) {
|
|
104
|
+
const canonical = (path) => {
|
|
105
|
+
try {
|
|
106
|
+
return realpathSync(path);
|
|
107
|
+
}
|
|
108
|
+
catch {
|
|
109
|
+
return resolve(path);
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
return canonical(projectPath) === canonical(join(userRoot, 'MEMORY.md'));
|
|
113
|
+
}
|
|
92
114
|
function capped(text, file) {
|
|
93
115
|
if (text.length <= MEMORY_SECTION_MAX_CHARS)
|
|
94
116
|
return text;
|
|
@@ -105,10 +127,14 @@ export function composeMemoryPrompt(content) {
|
|
|
105
127
|
const sections = [];
|
|
106
128
|
if (content.user)
|
|
107
129
|
sections.push(`## About the user\n\n${capped(content.user, 'USER.md')}`);
|
|
108
|
-
|
|
109
|
-
|
|
130
|
+
// "Curated", never "durable" or bare "memory": the stored-memory index sits
|
|
131
|
+
// beside these sections under its own heading, and the model must be able
|
|
132
|
+
// to tell operator-written text from records it can search and update.
|
|
133
|
+
if (content.memory) {
|
|
134
|
+
sections.push(`## Curated memory (all projects)\n\n${capped(content.memory, 'MEMORY.md')}`);
|
|
135
|
+
}
|
|
110
136
|
if (content.project) {
|
|
111
|
-
sections.push(`##
|
|
137
|
+
sections.push(`## Curated memory (this project)\n\n${capped(content.project, '.namzu/MEMORY.md')}`);
|
|
112
138
|
}
|
|
113
139
|
if (sections.length === 0)
|
|
114
140
|
return null;
|
package/dist/memory/store.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../src/memory/store.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../src/memory/store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEzC,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAA;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAA;AAEjE,OAAO,EAAuB,gBAAgB,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAElG,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAE/C,8EAA8E;AAC9E,MAAM,CAAC,MAAM,wBAAwB,GAAG,KAAK,CAAA;AAI7C,MAAM,UAAU,SAAS,CAAC,IAAa;IACtC,OAAO,aAAa,CAAC,IAAI,CAAC,CAAA;AAC3B,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,IAAa;IACzC,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC,CAAA;AACxC,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,IAAa;IAC3C,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,WAAW,CAAC,CAAA;AAC1C,CAAC;AAED,8EAA8E;AAC9E,MAAM,UAAU,qBAAqB,CAAC,GAAW;IAChD,IAAI,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,CAAA;IAC5B,IAAI,CAAC;QACJ,SAAS,GAAG,YAAY,CAAC,SAAS,CAAC,CAAA;IACpC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,IAAK,KAA+B,CAAC,IAAI,KAAK,QAAQ;YAAE,MAAM,KAAK,CAAA;IACpE,CAAC;IACD,M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,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAA;QAC/D,IAAI,CAAC,GAAG;YAAE,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAA;QACxF,QAAQ,GAAG,eAAe,CAAC,GAAG,CAAC,CAAA;IAChC,CAAC;SAAM,CAAC;QACP,QAAQ,GAAG,EAAE,IAAI,EAAE,cAAc,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,EAAE,CAAA;IACjE,CAAC;IACD,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QACvB,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,CAAA;IAChF,MAAM,QAAQ,GAAG,gBAAgB,CAAC,QAAQ,EAAE,KAAK,OAAO,IAAI,CAAC,CAAA;IAC7D,OAAO;QACN,IAAI,EAAE,QAAQ,CAAC,IAAI;QACnB,KAAK;QACL,QAAQ,EAAE,IAAI;QACd,gBAAgB,EAAE,QAAQ,CAAC,IAAI,EAAE,CAAC,MAAM,IAAI,wBAAwB;KACpE,CAAA;AACF,CAAC"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stored memory: the typed, one-file-per-memory store the kernel's memory
|
|
3
|
+
* tools read and write, as the CLI uses it.
|
|
4
|
+
*
|
|
5
|
+
* Four jobs live here. `saveTypedNote` is what `#note` and `/memory add`
|
|
6
|
+
* write through. `composeStoredMemoryPrompt` turns the store's generated index
|
|
7
|
+
* into the prompt section the model sees every turn. `migrateMemoryOnce`
|
|
8
|
+
* moves the JSON store into typed files, once, and offers the project's
|
|
9
|
+
* curated bullets; `importCuratedNotes` copies those when the operator asks,
|
|
10
|
+
* never editing the curated file.
|
|
11
|
+
*
|
|
12
|
+
* The CURATED files (`USER.md`, `MEMORY.md` in the application home and the
|
|
13
|
+
* project) stay what they were: operator-authored text read into every turn.
|
|
14
|
+
* The two are never given the same heading in the prompt.
|
|
15
|
+
*/
|
|
16
|
+
import { type MarkdownMemoryStore, type MemoryType, type RenderedMemoryIndex } from '@namzu/sdk';
|
|
17
|
+
export interface TypedNoteResult {
|
|
18
|
+
/** False when the note was empty or an identical memory already exists. */
|
|
19
|
+
readonly saved: boolean;
|
|
20
|
+
readonly name?: string;
|
|
21
|
+
readonly type: MemoryType;
|
|
22
|
+
/** The memory file, or the existing duplicate's file. */
|
|
23
|
+
readonly path?: string;
|
|
24
|
+
/** Set when an active memory with this exact text already existed. */
|
|
25
|
+
readonly duplicate?: boolean;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Save an operator note as a typed memory, default type `project`. A note
|
|
29
|
+
* whose exact text an active memory already holds is not saved twice; the
|
|
30
|
+
* result names the one that holds it.
|
|
31
|
+
*/
|
|
32
|
+
export declare function saveTypedNote(store: MarkdownMemoryStore, text: string, type?: MemoryType): Promise<TypedNoteResult>;
|
|
33
|
+
/**
|
|
34
|
+
* The prompt section for the stored-memory index, or null when the store
|
|
35
|
+
* holds no active memory. Named so it can never be mistaken for the curated
|
|
36
|
+
* sections beside it.
|
|
37
|
+
*/
|
|
38
|
+
export declare function composeStoredMemoryPrompt(index: RenderedMemoryIndex): string | null;
|
|
39
|
+
/** What one launch's migration did, for the operator notice. */
|
|
40
|
+
export interface MemoryMigrationReport {
|
|
41
|
+
readonly importedRecords: number;
|
|
42
|
+
/** JSON records the Markdown store refused (too large, a NUL byte); kept in the retired files. */
|
|
43
|
+
readonly skippedRecords: readonly string[];
|
|
44
|
+
/**
|
|
45
|
+
* The project's curated file holds top-level bullets, offered once per
|
|
46
|
+
* file: nothing is copied until the operator runs `/memory import-notes`,
|
|
47
|
+
* and the file itself is never changed.
|
|
48
|
+
*/
|
|
49
|
+
readonly notesOffer?: {
|
|
50
|
+
readonly path: string;
|
|
51
|
+
readonly count: number;
|
|
52
|
+
};
|
|
53
|
+
/** Things that did not happen and why; the migration is retried next launch. */
|
|
54
|
+
readonly problems: readonly string[];
|
|
55
|
+
}
|
|
56
|
+
/** What `/memory import-notes` did. The curated file is never changed. */
|
|
57
|
+
export interface CuratedNotesImport {
|
|
58
|
+
readonly path: string;
|
|
59
|
+
/** Top-level bullets the file holds, each counted once. */
|
|
60
|
+
readonly found: number;
|
|
61
|
+
/** Memories created by this turn. */
|
|
62
|
+
readonly copied: number;
|
|
63
|
+
/** Bullets already in stored memory, by an earlier import, a `#note`, or by hand. */
|
|
64
|
+
readonly alreadyStored: number;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* The text of every top-level bullet (`- text`) in a curated file, each once,
|
|
68
|
+
* in order. No bullet is judged to be a note or not: the file is never
|
|
69
|
+
* changed, so copying one the operator wrote costs a memory they can archive,
|
|
70
|
+
* never a line of their file. A nested bullet belongs to its parent and is not
|
|
71
|
+
* taken; only a bullet's first line is.
|
|
72
|
+
*/
|
|
73
|
+
export declare function curatedBullets(text: string): string[];
|
|
74
|
+
/**
|
|
75
|
+
* Move what the JSON store held into typed files, once and safely again, and
|
|
76
|
+
* say once per curated file whether it holds notes that could move.
|
|
77
|
+
*
|
|
78
|
+
* 1. A JSON store (`index.json` + `content/`) in `directory` is imported
|
|
79
|
+
* record by record with its ids, timestamps and status, then moved aside
|
|
80
|
+
* to `index.json.migrated` and `content.migrated`. A record the Markdown
|
|
81
|
+
* store refuses to write — over its size limit, or holding a NUL byte —
|
|
82
|
+
* is reported and stays in the retired files; stopping on it would leave
|
|
83
|
+
* `index.json` in place and the store refusing every operation for good.
|
|
84
|
+
* Any other failure leaves the JSON store where it is, to retry next launch.
|
|
85
|
+
* 2. The project's curated `MEMORY.md` is never changed. When it holds
|
|
86
|
+
* top-level bullets — some may be notes `#note` used to append — the
|
|
87
|
+
* report offers them once per file, since the checkout's file and a
|
|
88
|
+
* subdirectory's own `.namzu/MEMORY.md` are different files, and
|
|
89
|
+
* `/memory import-notes` copies them into typed memories when the
|
|
90
|
+
* operator asks. They stay curated, read into every turn as before, until
|
|
91
|
+
* the operator deletes them from the file.
|
|
92
|
+
*/
|
|
93
|
+
export declare function migrateMemoryOnce(options: {
|
|
94
|
+
readonly store: MarkdownMemoryStore;
|
|
95
|
+
/** The store's directory, where a JSON store would have lived. */
|
|
96
|
+
readonly directory: string;
|
|
97
|
+
readonly cwd: string;
|
|
98
|
+
}): Promise<MemoryMigrationReport>;
|
|
99
|
+
/**
|
|
100
|
+
* Copy the project's curated bullets into typed memory files, because the
|
|
101
|
+
* operator asked (`/memory import-notes`). The curated file is read, never
|
|
102
|
+
* written: deleting a bullet from it is the operator's call. Idempotent: a
|
|
103
|
+
* bullet already stored — by an earlier or concurrent import, as a `#note`
|
|
104
|
+
* with the same text, or under its name with the same text — is not copied
|
|
105
|
+
* again.
|
|
106
|
+
*/
|
|
107
|
+
export declare function importCuratedNotes(options: {
|
|
108
|
+
readonly store: MarkdownMemoryStore;
|
|
109
|
+
readonly directory: string;
|
|
110
|
+
readonly cwd: string;
|
|
111
|
+
}): Promise<CuratedNotesImport>;
|
|
112
|
+
/** Operator notices for a migration; empty when nothing moved, nothing is offered and nothing failed. */
|
|
113
|
+
export declare function describeMemoryMigration(report: MemoryMigrationReport, directory: string): string[];
|
|
114
|
+
/** The operator's report for `/memory import-notes`. */
|
|
115
|
+
export declare function describeCuratedNotesImport(result: CuratedNotesImport, directory: string): string;
|
|
116
|
+
//# sourceMappingURL=typed.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typed.d.ts","sourceRoot":"","sources":["../../src/memory/typed.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAMH,OAAO,EAEN,KAAK,mBAAmB,EAGxB,KAAK,UAAU,EACf,KAAK,mBAAmB,EAExB,MAAM,YAAY,CAAA;AAKnB,MAAM,WAAW,eAAe;IAC/B,2EAA2E;IAC3E,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;IACvB,QAAQ,CAA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AAsB,iBAAiB,CAAC,OAAO,EAAE;IAChD,QAAQ,CAAC,KAAK,EAAE,mBAAmB,CAAA;IACnC,kEAAkE;IAClE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CACpB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAsEjC;AAED;;;;;;;GAOG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,EAAE;IACjD,QAAQ,CAAC,KAAK,EAAE,mBAAmB,CAAA;IACnC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CACpB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CA8B9B;AAED,yGAAyG;AACzG,wBAAgB,uBAAuB,CACtC,MAAM,EAAE,qBAAqB,EAC7B,SAAS,EAAE,MAAM,GACf,MAAM,EAAE,CAgBV;AAED,wDAAwD;AACxD,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAUhG"}
|
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stored memory: the typed, one-file-per-memory store the kernel's memory
|
|
3
|
+
* tools read and write, as the CLI uses it.
|
|
4
|
+
*
|
|
5
|
+
* Four jobs live here. `saveTypedNote` is what `#note` and `/memory add`
|
|
6
|
+
* write through. `composeStoredMemoryPrompt` turns the store's generated index
|
|
7
|
+
* into the prompt section the model sees every turn. `migrateMemoryOnce`
|
|
8
|
+
* moves the JSON store into typed files, once, and offers the project's
|
|
9
|
+
* curated bullets; `importCuratedNotes` copies those when the operator asks,
|
|
10
|
+
* never editing the curated file.
|
|
11
|
+
*
|
|
12
|
+
* The CURATED files (`USER.md`, `MEMORY.md` in the application home and the
|
|
13
|
+
* project) stay what they were: operator-authored text read into every turn.
|
|
14
|
+
* The two are never given the same heading in the prompt.
|
|
15
|
+
*/
|
|
16
|
+
import { createHash } from 'node:crypto';
|
|
17
|
+
import { access, readFile, rename, writeFile } from 'node:fs/promises';
|
|
18
|
+
import { join } from 'node:path';
|
|
19
|
+
import { DiskMemoryStore, MemoryContentRejectedError, MemoryNameConflictError, slugifyMemoryName, } from '@namzu/sdk';
|
|
20
|
+
import { readMemoryFile } from './io.js';
|
|
21
|
+
import { projectMemoryLocation } from './store.js';
|
|
22
|
+
function firstLine(text, limit) {
|
|
23
|
+
const line = (text.split(/\r?\n/).find((part) => part.trim()) ?? '').replace(/\s+/g, ' ').trim();
|
|
24
|
+
if (line.length <= limit)
|
|
25
|
+
return line;
|
|
26
|
+
let head = line.slice(0, limit - 1);
|
|
27
|
+
if (/[\uD800-\uDBFF]$/.test(head))
|
|
28
|
+
head = head.slice(0, -1);
|
|
29
|
+
return `${head.trimEnd()}…`;
|
|
30
|
+
}
|
|
31
|
+
function digest(text) {
|
|
32
|
+
return createHash('sha256').update(text).digest('hex');
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Save an operator note as a typed memory, default type `project`. A note
|
|
36
|
+
* whose exact text an active memory already holds is not saved twice; the
|
|
37
|
+
* result names the one that holds it.
|
|
38
|
+
*/
|
|
39
|
+
export async function saveTypedNote(store, text, type = 'project') {
|
|
40
|
+
const note = text.trim();
|
|
41
|
+
if (!note)
|
|
42
|
+
return { saved: false, type };
|
|
43
|
+
const candidates = await store.list({ query: note, status: 'active', limit: 20 });
|
|
44
|
+
for (const entry of candidates.entries) {
|
|
45
|
+
const record = await store.getRecord(entry.id);
|
|
46
|
+
if (record?.entry.status === 'active' && record.content.content.trim() === note) {
|
|
47
|
+
return {
|
|
48
|
+
saved: false,
|
|
49
|
+
duplicate: true,
|
|
50
|
+
type: record.entry.type ?? type,
|
|
51
|
+
...(record.entry.name
|
|
52
|
+
? { name: record.entry.name, path: join(store.path, `${record.entry.name}.md`) }
|
|
53
|
+
: {}),
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
const { entry } = await store.create({
|
|
58
|
+
title: firstLine(note, 72),
|
|
59
|
+
summary: firstLine(note, 300),
|
|
60
|
+
description: firstLine(note, 150),
|
|
61
|
+
content: note,
|
|
62
|
+
type,
|
|
63
|
+
metadata: { source: 'operator-note', noteDigest: digest(note) },
|
|
64
|
+
});
|
|
65
|
+
return {
|
|
66
|
+
saved: true,
|
|
67
|
+
type,
|
|
68
|
+
...(entry.name ? { name: entry.name, path: join(store.path, `${entry.name}.md`) } : {}),
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* The prompt section for the stored-memory index, or null when the store
|
|
73
|
+
* holds no active memory. Named so it can never be mistaken for the curated
|
|
74
|
+
* sections beside it.
|
|
75
|
+
*/
|
|
76
|
+
export function composeStoredMemoryPrompt(index) {
|
|
77
|
+
if (!index.text)
|
|
78
|
+
return null;
|
|
79
|
+
return [
|
|
80
|
+
'## Stored memories (index)',
|
|
81
|
+
'',
|
|
82
|
+
'Memories saved in earlier sessions, one line each: `- [name](name.md) — description`. Read one with read_memory (by name) when it bears on the task. Correct or archive a wrong one with update_memory rather than saving a second copy. Memories are point-in-time: verify a file, function or flag a memory names against the current code before relying on it. What earlier turns recorded on their own is not listed here; search_memory finds it.',
|
|
83
|
+
'',
|
|
84
|
+
index.text,
|
|
85
|
+
].join('\n');
|
|
86
|
+
}
|
|
87
|
+
/** Records per curated file when it was offered and imported, so a launch offers it once. */
|
|
88
|
+
const MARKER = 'migration.json';
|
|
89
|
+
async function readMarker(directory) {
|
|
90
|
+
try {
|
|
91
|
+
const parsed = JSON.parse(await readFile(join(directory, MARKER), 'utf8'));
|
|
92
|
+
return parsed !== null && typeof parsed === 'object' ? parsed : {};
|
|
93
|
+
}
|
|
94
|
+
catch (error) {
|
|
95
|
+
if (error.code === 'ENOENT')
|
|
96
|
+
return {};
|
|
97
|
+
throw error;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
/** Merge `state` into the marker's record for `path`, re-reading it first. */
|
|
101
|
+
async function markCuratedFile(directory, path, state) {
|
|
102
|
+
const marker = await readMarker(directory).catch(() => ({}));
|
|
103
|
+
const files = { ...(marker.curatedFiles ?? {}) };
|
|
104
|
+
files[path] = { ...(files[path] ?? {}), ...state };
|
|
105
|
+
await writeFile(join(directory, MARKER), `${JSON.stringify({ ...marker, curatedFiles: files }, null, 2)}\n`, { mode: 0o600 });
|
|
106
|
+
}
|
|
107
|
+
async function exists(path) {
|
|
108
|
+
try {
|
|
109
|
+
await access(path);
|
|
110
|
+
return true;
|
|
111
|
+
}
|
|
112
|
+
catch {
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
/** Move `path` aside to `path.migrated`, or a numbered name when that is taken. */
|
|
117
|
+
async function retire(path) {
|
|
118
|
+
let target = `${path}.migrated`;
|
|
119
|
+
for (let n = 2; await exists(target); n++)
|
|
120
|
+
target = `${path}.migrated-${n}`;
|
|
121
|
+
try {
|
|
122
|
+
await rename(path, target);
|
|
123
|
+
}
|
|
124
|
+
catch (error) {
|
|
125
|
+
// Another process retired it first.
|
|
126
|
+
if (error.code !== 'ENOENT')
|
|
127
|
+
throw error;
|
|
128
|
+
}
|
|
129
|
+
return target;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* The text of every top-level bullet (`- text`) in a curated file, each once,
|
|
133
|
+
* in order. No bullet is judged to be a note or not: the file is never
|
|
134
|
+
* changed, so copying one the operator wrote costs a memory they can archive,
|
|
135
|
+
* never a line of their file. A nested bullet belongs to its parent and is not
|
|
136
|
+
* taken; only a bullet's first line is.
|
|
137
|
+
*/
|
|
138
|
+
export function curatedBullets(text) {
|
|
139
|
+
const bullets = new Set();
|
|
140
|
+
for (const line of text.split('\n')) {
|
|
141
|
+
const match = /^- (\S.*)$/.exec(line.replace(/\r$/, ''));
|
|
142
|
+
const bullet = match?.[1]?.trim();
|
|
143
|
+
if (bullet)
|
|
144
|
+
bullets.add(bullet);
|
|
145
|
+
}
|
|
146
|
+
return [...bullets];
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Create the memory for one curated bullet, false when it is already stored.
|
|
150
|
+
*
|
|
151
|
+
* Under the name its text slugs to, first: the store refuses a taken name
|
|
152
|
+
* inside its lock, so two turns copying the same bullet at once write it once,
|
|
153
|
+
* the second finding the first's record by its source digest. A name held by
|
|
154
|
+
* a memory with the same text is that bullet already stored; one held by an
|
|
155
|
+
* unrelated memory falls back to a suffixed name.
|
|
156
|
+
*/
|
|
157
|
+
async function copyBullet(store, bullet, sourceDigest, importedFrom) {
|
|
158
|
+
const params = {
|
|
159
|
+
title: firstLine(bullet, 72),
|
|
160
|
+
summary: firstLine(bullet, 300),
|
|
161
|
+
description: firstLine(bullet, 150),
|
|
162
|
+
content: bullet,
|
|
163
|
+
type: 'project',
|
|
164
|
+
metadata: { source: 'curated-bullet', sourceDigest, importedFrom },
|
|
165
|
+
};
|
|
166
|
+
const name = slugifyMemoryName(bullet);
|
|
167
|
+
try {
|
|
168
|
+
await store.create({ ...params, name });
|
|
169
|
+
return true;
|
|
170
|
+
}
|
|
171
|
+
catch (error) {
|
|
172
|
+
if (!(error instanceof MemoryNameConflictError))
|
|
173
|
+
throw error;
|
|
174
|
+
}
|
|
175
|
+
const holder = await store.getByName(name);
|
|
176
|
+
if (holder?.content.metadata?.sourceDigest === sourceDigest ||
|
|
177
|
+
holder?.content.content.trim() === bullet) {
|
|
178
|
+
return false;
|
|
179
|
+
}
|
|
180
|
+
await store.create(params);
|
|
181
|
+
return true;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Move what the JSON store held into typed files, once and safely again, and
|
|
185
|
+
* say once per curated file whether it holds notes that could move.
|
|
186
|
+
*
|
|
187
|
+
* 1. A JSON store (`index.json` + `content/`) in `directory` is imported
|
|
188
|
+
* record by record with its ids, timestamps and status, then moved aside
|
|
189
|
+
* to `index.json.migrated` and `content.migrated`. A record the Markdown
|
|
190
|
+
* store refuses to write — over its size limit, or holding a NUL byte —
|
|
191
|
+
* is reported and stays in the retired files; stopping on it would leave
|
|
192
|
+
* `index.json` in place and the store refusing every operation for good.
|
|
193
|
+
* Any other failure leaves the JSON store where it is, to retry next launch.
|
|
194
|
+
* 2. The project's curated `MEMORY.md` is never changed. When it holds
|
|
195
|
+
* top-level bullets — some may be notes `#note` used to append — the
|
|
196
|
+
* report offers them once per file, since the checkout's file and a
|
|
197
|
+
* subdirectory's own `.namzu/MEMORY.md` are different files, and
|
|
198
|
+
* `/memory import-notes` copies them into typed memories when the
|
|
199
|
+
* operator asks. They stay curated, read into every turn as before, until
|
|
200
|
+
* the operator deletes them from the file.
|
|
201
|
+
*/
|
|
202
|
+
export async function migrateMemoryOnce(options) {
|
|
203
|
+
const { store, directory, cwd } = options;
|
|
204
|
+
const problems = [];
|
|
205
|
+
const skippedRecords = [];
|
|
206
|
+
let importedRecords = 0;
|
|
207
|
+
let notesOffer;
|
|
208
|
+
const indexPath = join(directory, 'index.json');
|
|
209
|
+
if (await exists(indexPath)) {
|
|
210
|
+
try {
|
|
211
|
+
const disk = new DiskMemoryStore({ baseDir: directory, directory });
|
|
212
|
+
const { entries } = await disk.list();
|
|
213
|
+
const refused = [];
|
|
214
|
+
for (const entry of entries) {
|
|
215
|
+
const record = await disk.getRecord(entry.id);
|
|
216
|
+
if (!record)
|
|
217
|
+
continue;
|
|
218
|
+
try {
|
|
219
|
+
if ((await store.importRecord(record, { type: 'project' })) === 'imported') {
|
|
220
|
+
importedRecords++;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
catch (error) {
|
|
224
|
+
if (!(error instanceof MemoryContentRejectedError))
|
|
225
|
+
throw error;
|
|
226
|
+
refused.push({
|
|
227
|
+
id: entry.id,
|
|
228
|
+
title: entry.title,
|
|
229
|
+
reason: error.message,
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
await retire(indexPath);
|
|
234
|
+
const content = join(directory, 'content');
|
|
235
|
+
const retiredContent = (await exists(content)) ? await retire(content) : content;
|
|
236
|
+
for (const record of refused) {
|
|
237
|
+
skippedRecords.push(`"${record.title}" (${record.id}) was not moved: ${record.reason} It is kept in ${join(retiredContent, `${record.id}.json`)}.`);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
catch (error) {
|
|
241
|
+
problems.push(`The JSON memory store in ${directory} was not migrated: ${error instanceof Error ? error.message : String(error)}`);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
try {
|
|
245
|
+
const location = projectMemoryLocation(cwd);
|
|
246
|
+
const marker = await readMarker(directory);
|
|
247
|
+
const state = marker.curatedFiles?.[location.path];
|
|
248
|
+
if (!state?.offeredAt && !state?.importedAt) {
|
|
249
|
+
const text = readMemoryFile(location);
|
|
250
|
+
const bullets = text === null ? [] : curatedBullets(text);
|
|
251
|
+
if (bullets.length > 0) {
|
|
252
|
+
notesOffer = { path: location.path, count: bullets.length };
|
|
253
|
+
await markCuratedFile(directory, location.path, {
|
|
254
|
+
offeredAt: new Date().toISOString(),
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
catch (error) {
|
|
260
|
+
problems.push(`Could not check the project's curated memory for notes: ${error instanceof Error ? error.message : String(error)}`);
|
|
261
|
+
}
|
|
262
|
+
return {
|
|
263
|
+
importedRecords,
|
|
264
|
+
skippedRecords,
|
|
265
|
+
...(notesOffer ? { notesOffer } : {}),
|
|
266
|
+
problems,
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Copy the project's curated bullets into typed memory files, because the
|
|
271
|
+
* operator asked (`/memory import-notes`). The curated file is read, never
|
|
272
|
+
* written: deleting a bullet from it is the operator's call. Idempotent: a
|
|
273
|
+
* bullet already stored — by an earlier or concurrent import, as a `#note`
|
|
274
|
+
* with the same text, or under its name with the same text — is not copied
|
|
275
|
+
* again.
|
|
276
|
+
*/
|
|
277
|
+
export async function importCuratedNotes(options) {
|
|
278
|
+
const { store, directory, cwd } = options;
|
|
279
|
+
const location = projectMemoryLocation(cwd);
|
|
280
|
+
const text = readMemoryFile(location);
|
|
281
|
+
const bullets = text === null ? [] : curatedBullets(text);
|
|
282
|
+
if (bullets.length === 0) {
|
|
283
|
+
return { path: location.path, found: 0, copied: 0, alreadyStored: 0 };
|
|
284
|
+
}
|
|
285
|
+
// Digests of what is stored already, archived memories included: a copy
|
|
286
|
+
// the operator archived stays archived rather than coming back.
|
|
287
|
+
const stored = new Set();
|
|
288
|
+
for (const entry of (await store.list({})).entries) {
|
|
289
|
+
const metadata = (await store.get(entry.id))?.metadata;
|
|
290
|
+
stored.add(metadata?.sourceDigest);
|
|
291
|
+
stored.add(metadata?.noteDigest);
|
|
292
|
+
}
|
|
293
|
+
let copied = 0;
|
|
294
|
+
for (const bullet of bullets) {
|
|
295
|
+
const sourceDigest = digest(bullet);
|
|
296
|
+
if (stored.has(sourceDigest))
|
|
297
|
+
continue;
|
|
298
|
+
if (await copyBullet(store, bullet, sourceDigest, location.path))
|
|
299
|
+
copied++;
|
|
300
|
+
stored.add(sourceDigest);
|
|
301
|
+
}
|
|
302
|
+
await markCuratedFile(directory, location.path, { importedAt: new Date().toISOString() });
|
|
303
|
+
return {
|
|
304
|
+
path: location.path,
|
|
305
|
+
found: bullets.length,
|
|
306
|
+
copied,
|
|
307
|
+
alreadyStored: bullets.length - copied,
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
/** Operator notices for a migration; empty when nothing moved, nothing is offered and nothing failed. */
|
|
311
|
+
export function describeMemoryMigration(report, directory) {
|
|
312
|
+
const notices = [];
|
|
313
|
+
if (report.importedRecords > 0) {
|
|
314
|
+
notices.push(`Stored memory: moved ${report.importedRecords} record${report.importedRecords === 1 ? '' : 's'} from the JSON store into Markdown files in ${directory}.`);
|
|
315
|
+
}
|
|
316
|
+
for (const skipped of report.skippedRecords)
|
|
317
|
+
notices.push(`Stored memory: ${skipped}`);
|
|
318
|
+
if (report.notesOffer) {
|
|
319
|
+
const { path, count } = report.notesOffer;
|
|
320
|
+
notices.push(`Stored memory: ${path} has ${count} top-level bullet${count === 1 ? '' : 's'}, some perhaps notes #note saved before notes became typed memory files. They stay curated and still reach every turn. Run /memory import-notes to copy them into ${directory} as typed memories; the curated file is never changed. New #note and /memory add notes are saved there already.`);
|
|
321
|
+
}
|
|
322
|
+
notices.push(...report.problems);
|
|
323
|
+
return notices;
|
|
324
|
+
}
|
|
325
|
+
/** The operator's report for `/memory import-notes`. */
|
|
326
|
+
export function describeCuratedNotesImport(result, directory) {
|
|
327
|
+
if (result.found === 0) {
|
|
328
|
+
return `No top-level bullets to copy in ${result.path}; it is unchanged.`;
|
|
329
|
+
}
|
|
330
|
+
const plural = (n) => (n === 1 ? '' : 's');
|
|
331
|
+
const already = result.alreadyStored > 0
|
|
332
|
+
? ` ${result.alreadyStored} ${result.alreadyStored === 1 ? 'was' : 'were'} already stored and not copied again.`
|
|
333
|
+
: '';
|
|
334
|
+
return `Copied ${result.copied} of ${result.found} bullet${plural(result.found)} from ${result.path} into typed memory files in ${directory}.${already} ${result.path} is unchanged: its bullets are still curated text in every turn. Delete the ones you no longer want there yourself.`;
|
|
335
|
+
}
|
|
336
|
+
//# sourceMappingURL=typed.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typed.js","sourceRoot":"","sources":["../../src/memory/typed.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACtE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC,OAAO,EACN,eAAe,EAEf,0BAA0B,EAC1B,uBAAuB,EAGvB,iBAAiB,GACjB,MAAM,YAAY,CAAA;AAEnB,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AACx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