opencode-self-improvement 0.14.11 → 0.14.12
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/README.md +2 -2
- package/package.json +1 -1
- package/src/evidence.ts +31 -1
- package/src/gates.ts +13 -1
- package/src/index.ts +171 -53
- package/src/init.ts +16 -7
- package/src/inject.ts +27 -19
- package/src/memory.ts +140 -19
- package/src/portable.ts +10 -4
- package/src/prune.ts +18 -9
- package/src/repokey.ts +34 -0
- package/src/schema.ts +12 -3
- package/src/triggers.ts +24 -10
- package/src/viewer/mutate.ts +31 -3
- package/src/viewer/page.html +7 -5
- package/src/viewer/server.ts +21 -1
package/src/viewer/page.html
CHANGED
|
@@ -209,7 +209,7 @@ function render() {
|
|
|
209
209
|
const actions = kind === "blocked"
|
|
210
210
|
? `<button class="btn warn" data-action="unblock" data-ts="${esc(m.ts)}" title="Restore this memory to the read paths">unblock</button>`
|
|
211
211
|
: kind === "deleted"
|
|
212
|
-
? `<button class="btn warn" data-action="restore-deleted" data-ts="${esc(m.ts)}" data-type="${esc(m.type)}" data-scope="${esc(m.scope)}" data-content="${esc(m.content)}" title="Re-add this deleted entry to memory">restore</button>`
|
|
212
|
+
? `<button class="btn warn" data-action="restore-deleted" data-ts="${esc(m.ts)}" data-type="${esc(m.type)}" data-scope="${esc(m.scope)}" data-content="${esc(m.content)}" data-repo="${esc(m.repo ?? "")}" data-repo-path="${esc(m.repoPath ?? "")}" title="Re-add this deleted entry to memory">restore</button>`
|
|
213
213
|
: `<button class="btn" data-action="edit" data-ts="${esc(m.ts)}" title="Edit: snapshot, supersede this entry, append the replacement">edit</button>
|
|
214
214
|
<button class="btn danger" data-action="delete" data-ts="${esc(m.ts)}" title="Delete: snapshot the file, then remove this entry (audited)">delete</button>
|
|
215
215
|
<button class="btn danger" data-action="block" data-ts="${esc(m.ts)}" title="Block (poison): keep on disk but hide from recall/inject">block</button>`;
|
|
@@ -306,14 +306,16 @@ async function unblock(ts) {
|
|
|
306
306
|
} catch (e) { toast(String(e.message), true); }
|
|
307
307
|
}
|
|
308
308
|
|
|
309
|
-
function restoreEntry(type, scope, content) {
|
|
309
|
+
function restoreEntry(type, scope, content, repo, repoPath) {
|
|
310
310
|
askModal(
|
|
311
311
|
"Restore deleted memory?",
|
|
312
312
|
"Re-adds this entry to memory from its audit record.",
|
|
313
313
|
"Restore",
|
|
314
314
|
async () => {
|
|
315
315
|
try {
|
|
316
|
-
|
|
316
|
+
// The audit line's origin stamp rides along (#129): a restore keeps the
|
|
317
|
+
// row's ORIGINAL visibility instead of silently landing global.
|
|
318
|
+
await api("/api/restore-entry", { type, scope, content, repo: repo || undefined, repoPath: repoPath || undefined });
|
|
317
319
|
toast("restored to memory");
|
|
318
320
|
await refresh();
|
|
319
321
|
} catch (e) { toast(String(e.message), true); }
|
|
@@ -336,8 +338,8 @@ $("rows").addEventListener("click", (e) => {
|
|
|
336
338
|
else if (action === "block") block(ts);
|
|
337
339
|
else if (action === "unblock") unblock(ts);
|
|
338
340
|
else if (action === "restore-deleted") {
|
|
339
|
-
const { type, scope, content } = btn.dataset;
|
|
340
|
-
restoreEntry(type, scope, content);
|
|
341
|
+
const { type, scope, content, repo, repoPath } = btn.dataset;
|
|
342
|
+
restoreEntry(type, scope, content, repo, repoPath);
|
|
341
343
|
}
|
|
342
344
|
});
|
|
343
345
|
|
package/src/viewer/server.ts
CHANGED
|
@@ -76,6 +76,10 @@ interface Row {
|
|
|
76
76
|
scope: string;
|
|
77
77
|
content: string;
|
|
78
78
|
reason?: string;
|
|
79
|
+
// Origin stamp (#129): what the row carried when it was deleted, so the
|
|
80
|
+
// restore-entry round trip can restore the row's ORIGINAL visibility.
|
|
81
|
+
repo?: string;
|
|
82
|
+
repoPath?: string;
|
|
79
83
|
}
|
|
80
84
|
|
|
81
85
|
// Deleted entries live only in the audit log (their memory line was removed),
|
|
@@ -91,6 +95,8 @@ async function deletedRows(): Promise<Row[]> {
|
|
|
91
95
|
scope: String(f.scope ?? ""),
|
|
92
96
|
content: String(f.content ?? ""),
|
|
93
97
|
reason: String(f.reason ?? ""),
|
|
98
|
+
...(typeof f.repo === "string" && f.repo ? { repo: f.repo } : {}),
|
|
99
|
+
...(typeof f.repoPath === "string" && f.repoPath ? { repoPath: f.repoPath } : {}),
|
|
94
100
|
}));
|
|
95
101
|
}
|
|
96
102
|
|
|
@@ -186,6 +192,10 @@ async function loaded(): Promise<Record<string, unknown>> {
|
|
|
186
192
|
tags: m.tags,
|
|
187
193
|
superseded_by: m.superseded_by,
|
|
188
194
|
reason: m.reason,
|
|
195
|
+
// The viewer is the explicit ADMIN read surface (header comment): it
|
|
196
|
+
// lists every repository, and now says WHICH one each row belongs to.
|
|
197
|
+
repo: m.repo,
|
|
198
|
+
repoPath: m.repoPath,
|
|
189
199
|
blocked: blockedByTs.has(m.ts),
|
|
190
200
|
})),
|
|
191
201
|
blocked,
|
|
@@ -256,7 +266,17 @@ async function unblockRoute(body: z.infer<typeof UnblockBody>): Promise<Response
|
|
|
256
266
|
}
|
|
257
267
|
|
|
258
268
|
async function restoreEntryRoute(body: z.infer<typeof RestoreEntryBody>): Promise<Response> {
|
|
259
|
-
|
|
269
|
+
// Origin survives the restore round trip (#129): when the audit line carried
|
|
270
|
+
// a repo stamp, the restored row carries it again — the viewer's own missing
|
|
271
|
+
// repository scope must never be what decides a row's visibility. No repo
|
|
272
|
+
// fields = the documented legacy/global restore path, unchanged.
|
|
273
|
+
const t = await appendMemory({
|
|
274
|
+
type: body.type,
|
|
275
|
+
scope: body.scope,
|
|
276
|
+
content: body.content,
|
|
277
|
+
repo: body.repo,
|
|
278
|
+
repoPath: body.repoPath,
|
|
279
|
+
});
|
|
260
280
|
return json({ restored: t });
|
|
261
281
|
}
|
|
262
282
|
|