@joe-broadhead/opencode-mem 0.9.5 → 0.9.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/CHANGELOG.md +1281 -0
- package/README.md +105 -31
- package/docs/agent-protocol.md +28 -27
- package/docs/permissions.md +148 -0
- package/package.json +24 -12
- package/skills/mem.pages/SKILL.md +35 -16
- package/skills/mem.sharing/SKILL.md +39 -6
- package/skills/mem.sources/SKILL.md +41 -10
- package/skills/mem.usage/SKILL.md +37 -16
- package/src/backend/records.js +8 -0
- package/src/backend/v3.js +15 -10
- package/src/call-shapes.js +18 -25
- package/src/capture-pause.js +136 -0
- package/src/capture.js +7 -5
- package/src/collector-service.js +212 -35
- package/src/collector.js +186 -47
- package/src/commands.js +37 -0
- package/src/compaction.js +4 -2
- package/src/config.js +151 -1
- package/src/curation.js +6 -10
- package/src/events.js +144 -36
- package/src/forget-purge.js +377 -0
- package/src/forgotten.js +152 -0
- package/src/hooks.js +9 -4
- package/src/index.js +5 -3
- package/src/permissions.js +116 -38
- package/src/protocol.js +21 -11
- package/src/records.js +4 -1
- package/src/runtime.js +202 -15
- package/src/shapes.js +63 -0
- package/src/sources.js +183 -12
- package/src/spaces.js +58 -1
- package/src/spool.js +442 -64
- package/src/stated.js +334 -0
- package/src/storable.js +477 -0
- package/src/tools/aliases.js +36 -147
- package/src/tools/commitments.js +69 -12
- package/src/tools/index.js +25 -43
- package/src/tools/ingest.js +33 -128
- package/src/tools/memory.js +503 -904
- package/src/tools/page-sections.js +147 -0
- package/src/tools/page.js +314 -82
- package/src/tools/recall-browse.js +173 -0
- package/src/tools/recall.js +36 -8
- package/src/tools/share.js +494 -131
- package/src/tools/shared.js +97 -19
- package/src/tools/spaces.js +194 -101
- package/src/tools/status.js +31 -3
- package/src/tools/wiki.js +5 -13
- package/src/util.js +10 -59
- package/src/views/profile.js +2 -3
- package/src/views/records-reads.js +6 -1
- package/src/erase.js +0 -36
|
@@ -189,6 +189,9 @@ export function splitJournal(body) {
|
|
|
189
189
|
return { body: lines.join("\n"), sources, footer }
|
|
190
190
|
}
|
|
191
191
|
|
|
192
|
+
/** Fields a writer sets about where a record came from; nothing checks them. */
|
|
193
|
+
const UNVERIFIED_FIELDS = new Set(["moved_from", "copied_from"])
|
|
194
|
+
|
|
192
195
|
/** A record's fields as name and value lines, for the page's field list. */
|
|
193
196
|
export function fieldLines(fields) {
|
|
194
197
|
const out = []
|
|
@@ -207,7 +210,9 @@ export function fieldLines(fields) {
|
|
|
207
210
|
for (const [name, inner] of Object.entries(fields && typeof fields === "object" ? fields : {})) {
|
|
208
211
|
if (HIDDEN_FIELDS.has(name)) continue
|
|
209
212
|
const text = value(inner)
|
|
210
|
-
|
|
213
|
+
// Provenance any writer can send is shown as a claim.
|
|
214
|
+
const shown = UNVERIFIED_FIELDS.has(name) ? `${name.replaceAll("_", " ")} (not verified)` : name.replaceAll("_", " ")
|
|
215
|
+
if (text) out.push({ name: clip(shown, 40), value: clip(text, 300) })
|
|
211
216
|
if (out.length >= FIELDS_MAX) break
|
|
212
217
|
}
|
|
213
218
|
return out
|
package/src/erase.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Deterministic line erase for the L2 scenarios and the L3 persona.
|
|
3
|
-
*
|
|
4
|
-
* Upstream has no delete route for either layer, but both are files the
|
|
5
|
-
* backend lets a caller read and overwrite (`scenario/read`/`scenario/write`,
|
|
6
|
-
* `core/read`/`core/write`). An erase removes every line that contains the
|
|
7
|
-
* phrase, case-insensitively, and nothing else. It is a text operation, not a
|
|
8
|
-
* model call, so the preview is exactly what the write will do.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
/** A phrase shorter than this would match unrelated lines. */
|
|
12
|
-
export const MIN_ERASE_CHARS = 4
|
|
13
|
-
|
|
14
|
-
function normalise(text) {
|
|
15
|
-
return String(text ?? "").toLowerCase()
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/** True when the text contains the phrase, case-insensitively. */
|
|
19
|
-
export function containsPhrase(text, phrase) {
|
|
20
|
-
const needle = normalise(phrase).trim()
|
|
21
|
-
return needle.length > 0 && normalise(text).includes(needle)
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/** The lines of `content` that contain the phrase. */
|
|
25
|
-
export function matchingLines(content, phrase) {
|
|
26
|
-
return String(content ?? "")
|
|
27
|
-
.split("\n")
|
|
28
|
-
.filter((line) => containsPhrase(line, phrase))
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/** `content` without the lines that contain the phrase. */
|
|
32
|
-
export function eraseLines(content, phrase) {
|
|
33
|
-
const lines = String(content ?? "").split("\n")
|
|
34
|
-
const kept = lines.filter((line) => !containsPhrase(line, phrase))
|
|
35
|
-
return { content: kept.join("\n"), removed: lines.length - kept.length }
|
|
36
|
-
}
|