@wierdbytes/pi-memory 0.1.1 → 0.1.2
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 +6 -0
- package/index.js +14 -8
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/index.js
CHANGED
|
@@ -122,7 +122,8 @@ function homePaths(home = wmemHome(), memoryDir) {
|
|
|
122
122
|
local,
|
|
123
123
|
state: join(local, "state.json"),
|
|
124
124
|
inbox: join(local, "inbox"),
|
|
125
|
-
|
|
125
|
+
review: join(local, "review.json"),
|
|
126
|
+
decisions: join(local, "decisions.jsonl"),
|
|
126
127
|
runs: join(local, "runs"),
|
|
127
128
|
dreamLogs: join(local, "logs"),
|
|
128
129
|
digests: join(local, "digests"),
|
|
@@ -138,7 +139,7 @@ var STAGES = ["cards", "analyze", "verify"];
|
|
|
138
139
|
function defaults() {
|
|
139
140
|
return {
|
|
140
141
|
port: 7433,
|
|
141
|
-
memory: { dir: "", branch: "main", remote: "origin", sync: true },
|
|
142
|
+
memory: { dir: "", branch: "main", reviewBranch: "dreams", remote: "origin", sync: true },
|
|
142
143
|
language: "Russian",
|
|
143
144
|
inject: true,
|
|
144
145
|
models: {
|
|
@@ -180,10 +181,15 @@ function sanitize(raw) {
|
|
|
180
181
|
cfg.port = Math.round(num(raw.port, 1, 65535, d.port));
|
|
181
182
|
if (isObj(raw.memory)) {
|
|
182
183
|
const m = raw.memory;
|
|
183
|
-
const
|
|
184
|
+
const branchName = (v, fallback) => typeof v === "string" && /^[A-Za-z0-9._/-]{1,100}$/.test(v.trim()) && !v.includes("..") ? v.trim() : fallback;
|
|
185
|
+
const branch = branchName(m.branch, d.memory.branch);
|
|
186
|
+
let reviewBranch = branchName(m.reviewBranch, d.memory.reviewBranch);
|
|
187
|
+
if (reviewBranch === branch)
|
|
188
|
+
reviewBranch = branch === d.memory.reviewBranch ? `${branch}-proposed` : d.memory.reviewBranch;
|
|
184
189
|
cfg.memory = {
|
|
185
190
|
dir: typeof m.dir === "string" ? m.dir.trim() : d.memory.dir,
|
|
186
191
|
branch,
|
|
192
|
+
reviewBranch,
|
|
187
193
|
remote: typeof m.remote === "string" && /^[A-Za-z0-9._-]*$/.test(m.remote.trim()) ? m.remote.trim() : d.memory.remote,
|
|
188
194
|
sync: bool(m.sync, d.memory.sync)
|
|
189
195
|
};
|
|
@@ -290,11 +296,11 @@ var REVIEW = `You are the memory curator of wierd-memory, an offline memory syst
|
|
|
290
296
|
${OPS_SCHEMA}
|
|
291
297
|
|
|
292
298
|
For these operations:
|
|
293
|
-
- Notes marked "pending": true are proposed
|
|
299
|
+
- Notes marked "pending": true are proposed, not approved yet: to drop one use deprecate (the proposal is withdrawn), to change one use update.
|
|
294
300
|
- To move a note to another scope use update with "scope": "global", "project:<key>" (key from the scope titles in the input) or a scope id; the note keeps its id and evidence.
|
|
295
|
-
- A comment with "note" refers to that note; without it, to
|
|
301
|
+
- A comment with "note" refers to that note; without it, to what is proposed as a whole.
|
|
296
302
|
- "scope" may also be a scope id from the input (e.g. "projects/github.com__owner__repo").
|
|
297
|
-
- evidence is the comment: {"s": "
|
|
303
|
+
- evidence is the comment: {"s": "comment:<commentId>", "e": []}.
|
|
298
304
|
- Follow the same writing rules: titles are one self-contained statement in {{language}} (≤ 160 chars), bodies hold the specifics (≤ 120 words).
|
|
299
305
|
- A comment that asks for something you cannot express as an operation goes to "unhandled" with a short reason.
|
|
300
306
|
Reply with JSON only: {"ops": [...], "unhandled": [{"comment": "<commentId>", "reason": "…"}]}`;
|
|
@@ -611,7 +617,7 @@ ${text.trimEnd() || "(empty log)"}`;
|
|
|
611
617
|
} catch {}
|
|
612
618
|
if (last.status === "error")
|
|
613
619
|
ctx.ui.notify(`wierd-memory: the last dream failed — ${last.error ?? ""} (/dream log)`, "warning");
|
|
614
|
-
else if (s.review
|
|
620
|
+
else if (s.review.pending)
|
|
615
621
|
ctx.ui.notify(`wierd-memory: ${s.review.pending} memory change(s) wait for your review — ${s.url}/#/review`, "info");
|
|
616
622
|
}
|
|
617
623
|
async status(ctx) {
|
|
@@ -632,7 +638,7 @@ cwd: ${ctx.cwd}`;
|
|
|
632
638
|
`inbox: ${s.inbox} pending`,
|
|
633
639
|
`dream: ${d.running ? `running (${d.running.id})` : `${d.due.due ? "due" : "not due"} (${d.due.reason})`}`,
|
|
634
640
|
`last: ${d.last ? `${d.last.status} ${d.last.finishedAt ?? d.last.startedAt}${d.last.error ? ` — ${d.last.error}` : ""}` : "never"}`,
|
|
635
|
-
`review: ${s.review ? `${s.review.pending} to decide — ${s.url}/#/review` : "nothing to
|
|
641
|
+
`review: ${s.review.pending ? `${s.review.pending} to decide — ${s.url}/#/review` : "nothing to decide"}`,
|
|
636
642
|
`cwd: ${ctx.cwd}`
|
|
637
643
|
].join(`
|
|
638
644
|
`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wierdbytes/pi-memory",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Long-term memory for pi: injects the approved wierd-memory index into every session and adds memory_search / memory_read / memory_inbox tools and /memory, /dream, /remember commands. Needs the wierd-memory server.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|