@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.
Files changed (53) hide show
  1. package/CHANGELOG.md +1281 -0
  2. package/README.md +105 -31
  3. package/docs/agent-protocol.md +28 -27
  4. package/docs/permissions.md +148 -0
  5. package/package.json +24 -12
  6. package/skills/mem.pages/SKILL.md +35 -16
  7. package/skills/mem.sharing/SKILL.md +39 -6
  8. package/skills/mem.sources/SKILL.md +41 -10
  9. package/skills/mem.usage/SKILL.md +37 -16
  10. package/src/backend/records.js +8 -0
  11. package/src/backend/v3.js +15 -10
  12. package/src/call-shapes.js +18 -25
  13. package/src/capture-pause.js +136 -0
  14. package/src/capture.js +7 -5
  15. package/src/collector-service.js +212 -35
  16. package/src/collector.js +186 -47
  17. package/src/commands.js +37 -0
  18. package/src/compaction.js +4 -2
  19. package/src/config.js +151 -1
  20. package/src/curation.js +6 -10
  21. package/src/events.js +144 -36
  22. package/src/forget-purge.js +377 -0
  23. package/src/forgotten.js +152 -0
  24. package/src/hooks.js +9 -4
  25. package/src/index.js +5 -3
  26. package/src/permissions.js +116 -38
  27. package/src/protocol.js +21 -11
  28. package/src/records.js +4 -1
  29. package/src/runtime.js +202 -15
  30. package/src/shapes.js +63 -0
  31. package/src/sources.js +183 -12
  32. package/src/spaces.js +58 -1
  33. package/src/spool.js +442 -64
  34. package/src/stated.js +334 -0
  35. package/src/storable.js +477 -0
  36. package/src/tools/aliases.js +36 -147
  37. package/src/tools/commitments.js +69 -12
  38. package/src/tools/index.js +25 -43
  39. package/src/tools/ingest.js +33 -128
  40. package/src/tools/memory.js +503 -904
  41. package/src/tools/page-sections.js +147 -0
  42. package/src/tools/page.js +314 -82
  43. package/src/tools/recall-browse.js +173 -0
  44. package/src/tools/recall.js +36 -8
  45. package/src/tools/share.js +494 -131
  46. package/src/tools/shared.js +97 -19
  47. package/src/tools/spaces.js +194 -101
  48. package/src/tools/status.js +31 -3
  49. package/src/tools/wiki.js +5 -13
  50. package/src/util.js +10 -59
  51. package/src/views/profile.js +2 -3
  52. package/src/views/records-reads.js +6 -1
  53. 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
- if (text) out.push({ name: clip(name.replaceAll("_", " "), 40), value: clip(text, 300) })
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
- }