seren-margin 5.2.2__tar.gz → 5.4.0__tar.gz

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 (56) hide show
  1. {seren_margin-5.2.2 → seren_margin-5.4.0}/PKG-INFO +2 -2
  2. {seren_margin-5.2.2 → seren_margin-5.4.0}/pyproject.toml +1 -1
  3. {seren_margin-5.2.2 → seren_margin-5.4.0}/seren_margin/_version.py +3 -3
  4. {seren_margin-5.2.2 → seren_margin-5.4.0}/seren_margin/app.py +24 -3
  5. {seren_margin-5.2.2 → seren_margin-5.4.0}/seren_margin/viewer/ui/styles.css +2 -7
  6. {seren_margin-5.2.2 → seren_margin-5.4.0}/seren_margin.egg-info/PKG-INFO +2 -2
  7. {seren_margin-5.2.2 → seren_margin-5.4.0}/seren_margin.egg-info/requires.txt +1 -1
  8. seren_margin-5.4.0/seren_margin.egg-info/scm_version.json +8 -0
  9. {seren_margin-5.2.2 → seren_margin-5.4.0}/tests/test_bookmark_and_letters.py +24 -0
  10. seren_margin-5.2.2/seren_margin.egg-info/scm_version.json +0 -8
  11. {seren_margin-5.2.2 → seren_margin-5.4.0}/LICENSE +0 -0
  12. {seren_margin-5.2.2 → seren_margin-5.4.0}/README.md +0 -0
  13. {seren_margin-5.2.2 → seren_margin-5.4.0}/SerenMargin.pyproj +0 -0
  14. {seren_margin-5.2.2 → seren_margin-5.4.0}/seren-margin.service.sample +0 -0
  15. {seren_margin-5.2.2 → seren_margin-5.4.0}/seren-margin.yaml.sample +0 -0
  16. {seren_margin-5.2.2 → seren_margin-5.4.0}/seren_margin/__init__.py +0 -0
  17. {seren_margin-5.2.2 → seren_margin-5.4.0}/seren_margin/__main__.py +0 -0
  18. {seren_margin-5.2.2 → seren_margin-5.4.0}/seren_margin/_diag.py +0 -0
  19. {seren_margin-5.2.2 → seren_margin-5.4.0}/seren_margin/bookmark.py +0 -0
  20. {seren_margin-5.2.2 → seren_margin-5.4.0}/seren_margin/config.py +0 -0
  21. {seren_margin-5.2.2 → seren_margin-5.4.0}/seren_margin/keepsakes.py +0 -0
  22. {seren_margin-5.2.2 → seren_margin-5.4.0}/seren_margin/mcp/__init__.py +0 -0
  23. {seren_margin-5.2.2 → seren_margin-5.4.0}/seren_margin/mcp/server.py +0 -0
  24. {seren_margin-5.2.2 → seren_margin-5.4.0}/seren_margin/mcp/tools.py +0 -0
  25. {seren_margin-5.2.2 → seren_margin-5.4.0}/seren_margin/mcp-manifest.yaml +0 -0
  26. {seren_margin-5.2.2 → seren_margin-5.4.0}/seren_margin/models.py +0 -0
  27. {seren_margin-5.2.2 → seren_margin-5.4.0}/seren_margin/store.py +0 -0
  28. {seren_margin-5.2.2 → seren_margin-5.4.0}/seren_margin/viewer/ui/body.html +0 -0
  29. {seren_margin-5.2.2 → seren_margin-5.4.0}/seren_margin/viewer/ui/header_aside.html +0 -0
  30. {seren_margin-5.2.2 → seren_margin-5.4.0}/seren_margin/viewer/ui/scripts.js +0 -0
  31. {seren_margin-5.2.2 → seren_margin-5.4.0}/seren_margin/viewer/ui/tabs.html +0 -0
  32. {seren_margin-5.2.2 → seren_margin-5.4.0}/seren_margin.egg-info/SOURCES.txt +0 -0
  33. {seren_margin-5.2.2 → seren_margin-5.4.0}/seren_margin.egg-info/dependency_links.txt +0 -0
  34. {seren_margin-5.2.2 → seren_margin-5.4.0}/seren_margin.egg-info/entry_points.txt +0 -0
  35. {seren_margin-5.2.2 → seren_margin-5.4.0}/seren_margin.egg-info/scm_file_list.json +0 -0
  36. {seren_margin-5.2.2 → seren_margin-5.4.0}/seren_margin.egg-info/top_level.txt +0 -0
  37. {seren_margin-5.2.2 → seren_margin-5.4.0}/setup.cfg +0 -0
  38. {seren_margin-5.2.2 → seren_margin-5.4.0}/tests/__init__.py +0 -0
  39. {seren_margin-5.2.2 → seren_margin-5.4.0}/tests/conftest.py +0 -0
  40. {seren_margin-5.2.2 → seren_margin-5.4.0}/tests/test_amend_and_topics.py +0 -0
  41. {seren_margin-5.2.2 → seren_margin-5.4.0}/tests/test_config.py +0 -0
  42. {seren_margin-5.2.2 → seren_margin-5.4.0}/tests/test_exposure_is_wired.py +0 -0
  43. {seren_margin-5.2.2 → seren_margin-5.4.0}/tests/test_keepsakes.py +0 -0
  44. {seren_margin-5.2.2 → seren_margin-5.4.0}/tests/test_letters_off_the_board.py +0 -0
  45. {seren_margin-5.2.2 → seren_margin-5.4.0}/tests/test_manifest_parity.py +0 -0
  46. {seren_margin-5.2.2 → seren_margin-5.4.0}/tests/test_mcp_fallback.py +0 -0
  47. {seren_margin-5.2.2 → seren_margin-5.4.0}/tests/test_mcp_mount.py +0 -0
  48. {seren_margin-5.2.2 → seren_margin-5.4.0}/tests/test_mcp_tools.py +0 -0
  49. {seren_margin-5.2.2 → seren_margin-5.4.0}/tests/test_optional_bearer.py +0 -0
  50. {seren_margin-5.2.2 → seren_margin-5.4.0}/tests/test_reads_stay_private.py +0 -0
  51. {seren_margin-5.2.2 → seren_margin-5.4.0}/tests/test_search.py +0 -0
  52. {seren_margin-5.2.2 → seren_margin-5.4.0}/tests/test_smoke.py +0 -0
  53. {seren_margin-5.2.2 → seren_margin-5.4.0}/tests/test_stats_content_blind.py +0 -0
  54. {seren_margin-5.2.2 → seren_margin-5.4.0}/tests/test_stores_snapshot.py +0 -0
  55. {seren_margin-5.2.2 → seren_margin-5.4.0}/tests/test_updates_contract.py +0 -0
  56. {seren_margin-5.2.2 → seren_margin-5.4.0}/tests/test_viewer.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: seren-margin
3
- Version: 5.2.2
3
+ Version: 5.4.0
4
4
  Summary: Private notes-to-self for an AI assistant. Standalone, opt-in, opinionated.
5
5
  Author: Chad Roesler
6
6
  License-Expression: AGPL-3.0-or-later
@@ -15,7 +15,7 @@ Requires-Dist: fastapi>=0.110
15
15
  Requires-Dist: uvicorn[standard]>=0.27
16
16
  Requires-Dist: pydantic>=2.5
17
17
  Requires-Dist: pyyaml>=6.0
18
- Requires-Dist: seren-meninges<6,>=2.4.0
18
+ Requires-Dist: seren-meninges<7,>=6.0.0
19
19
  Requires-Dist: seren-sinew<6,>=5.2.0
20
20
  Requires-Dist: httpx>=0.27
21
21
  Provides-Extra: test
@@ -24,7 +24,7 @@ dependencies = [
24
24
  # The standalone promise is intact as written - it always meant "no other
25
25
  # SERVICES required" (no Workbench, no cluster head), not "no shared
26
26
  # library". Margin still runs alone on localhost with nothing else deployed.
27
- "seren-meninges>=2.4.0,<6",
27
+ "seren-meninges>=6.0.0,<7",
28
28
  # seren_sinew.stores: snapshots of the notes database (1.8.0: the archive gate).
29
29
  "seren-sinew>=5.2.0,<6", # 5.2.0: seren_sinew.blobs and the `blobs` store kind (keepsakes); 1.10.0: stores, rehearsal, restore_at_startup
30
30
  "httpx>=0.27", # keepsakes fetched from a URL (seren_margin.keepsakes); already here through meninges
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
18
18
  commit_id: str | None
19
19
  __commit_id__: str | None
20
20
 
21
- __version__ = version = '5.2.2'
22
- __version_tuple__ = version_tuple = (5, 2, 2)
21
+ __version__ = version = '5.4.0'
22
+ __version_tuple__ = version_tuple = (5, 4, 0)
23
23
 
24
- __commit_id__ = commit_id = 'g7d53bd6e8'
24
+ __commit_id__ = commit_id = 'g96837e658'
@@ -13,8 +13,9 @@ Endpoints:
13
13
  POST /notes/{id}/amend - append to a note (never replaces)
14
14
  DELETE /notes/{id} - retract (hard delete)
15
15
  GET /bookmark - the dedication + a COUNT of unread letters (never text)
16
+ GET /dedication - the dedication; ?history=N its versions (for the carabiner's piton)
16
17
  PUT /dedication - a new version of the dedication (never overwrites)
17
- GET /preface - the page a harness reads to the model as its system prompt
18
+ GET /preface - the page a harness reads to the model as its system prompt; ?history=N
18
19
  PUT /preface - a new version of the preface (never overwrites)
19
20
  POST /letters - a letter to the next session
20
21
  POST /letters/read - open unread letters, oldest first; marks them read *
@@ -424,6 +425,22 @@ def create_app(config: Optional[MarginConfig] = None) -> FastAPI:
424
425
  return Response(content=bm["text"] + "\n", media_type="text/plain; charset=utf-8")
425
426
  return bm
426
427
 
428
+ # How far back a history read goes: every version a page has had, for the
429
+ # carabiner's piton to take the pages over (SerenCarabiners/PITON.md).
430
+ HISTORY_MAX = 1000
431
+
432
+ @app.get("/dedication")
433
+ async def get_dedication(history: int = 0):
434
+ """The dedication as it is now and, with ?history=N, its last N
435
+ versions newest first ({version, text, set_at, why}). Served whatever
436
+ http_reads says, like the bookmark that already carries it: it is the
437
+ page written to be read at the door. Added 16 Nov 2026 so the
438
+ carabiner's piton can take the dedication over with every version."""
439
+ out: dict = {"dedication": store.dedication()}
440
+ if history > 0:
441
+ out["history"] = store.dedication_history(limit=min(history, HISTORY_MAX))
442
+ return out
443
+
427
444
  @app.put("/dedication")
428
445
  async def put_dedication(body: DedicationSet = Body(...)):
429
446
  text = (body.text or "").strip()
@@ -435,15 +452,19 @@ def create_app(config: Optional[MarginConfig] = None) -> FastAPI:
435
452
  return {"ok": True, "version": entry["version"], "changed": changed}
436
453
 
437
454
  @app.get("/preface")
438
- async def get_preface(format: Optional[str] = None):
455
+ async def get_preface(format: Optional[str] = None, history: int = 0):
439
456
  """The preface: the page a harness reads to the model as its system
440
457
  prompt (seren_margin.bookmark). Served whatever http_reads says, like
441
458
  the bookmark: it is written to be read at the door, by the room.
442
- ?format=text gives the page alone, empty when none is written."""
459
+ ?format=text gives the page alone, empty when none is written.
460
+ ?history=N adds its last N versions, newest first (16 Nov 2026, for
461
+ the carabiner's piton)."""
443
462
  pf = build_preface(store)
444
463
  if format == "text":
445
464
  return Response(content=pf["text"] + ("\n" if pf["text"] else ""),
446
465
  media_type="text/plain; charset=utf-8")
466
+ if history > 0:
467
+ pf = {**pf, "history": store.preface_history(limit=min(history, HISTORY_MAX))}
447
468
  return pf
448
469
 
449
470
  @app.put("/preface")
@@ -1,11 +1,6 @@
1
1
  :root {
2
- --bg: #14141f;
3
- --bg-2: #1a1a2e;
4
- --panel: #1f2036;
5
- --panel-2: #262844;
6
- --line: #33365a;
7
- --muted: #9aa0c8;
8
- --faint: #6c7199;
2
+ /* the walls (--bg, --bg-2, --panel, --panel-2, --line, --muted, --faint)
3
+ come from the shell, tinted 5% by this service's accent (24 Oct 2026) */
9
4
  /* --accent (#d1cbba, the page colour Starwright uses for the margin) comes from the shell
10
5
  (render_from_dir accent=...); the baseplate owns it. */
11
6
  --accent-dim: #6f6a5c;
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: seren-margin
3
- Version: 5.2.2
3
+ Version: 5.4.0
4
4
  Summary: Private notes-to-self for an AI assistant. Standalone, opt-in, opinionated.
5
5
  Author: Chad Roesler
6
6
  License-Expression: AGPL-3.0-or-later
@@ -15,7 +15,7 @@ Requires-Dist: fastapi>=0.110
15
15
  Requires-Dist: uvicorn[standard]>=0.27
16
16
  Requires-Dist: pydantic>=2.5
17
17
  Requires-Dist: pyyaml>=6.0
18
- Requires-Dist: seren-meninges<6,>=2.4.0
18
+ Requires-Dist: seren-meninges<7,>=6.0.0
19
19
  Requires-Dist: seren-sinew<6,>=5.2.0
20
20
  Requires-Dist: httpx>=0.27
21
21
  Provides-Extra: test
@@ -2,7 +2,7 @@ fastapi>=0.110
2
2
  uvicorn[standard]>=0.27
3
3
  pydantic>=2.5
4
4
  pyyaml>=6.0
5
- seren-meninges<6,>=2.4.0
5
+ seren-meninges<7,>=6.0.0
6
6
  seren-sinew<6,>=5.2.0
7
7
  httpx>=0.27
8
8
 
@@ -0,0 +1,8 @@
1
+ {
2
+ "tag": "5.4.0",
3
+ "distance": 0,
4
+ "node": "g96837e6587dd09e617f07128b9650002a57d5aff",
5
+ "dirty": false,
6
+ "branch": "HEAD",
7
+ "node_date": "2026-11-17"
8
+ }
@@ -156,6 +156,30 @@ def test_http_preface_is_served_with_reads_off(tmp_path):
156
156
  assert ROOM not in str(c.get("/bookmark").json())
157
157
 
158
158
 
159
+ def test_http_page_history_is_served_with_reads_off(tmp_path):
160
+ """The carabiner's piton takes both pages over with every version
161
+ (16 Nov 2026): GET /dedication?history=N and GET /preface?history=N, with
162
+ http_reads off like the bookmark, newest first, set_at and why kept.
163
+ Letters and notes are still not in it."""
164
+ with _client(tmp_path) as c:
165
+ assert c.get("/dedication").json() == {"dedication": None}
166
+ assert c.get("/dedication?history=10").json() == {"dedication": None, "history": []}
167
+ c.put("/dedication", json={"text": PAGE, "why": "first page"})
168
+ c.put("/dedication", json={"text": PAGE + " Ask the clock.", "why": "the clock got built"})
169
+ c.post("/letters", json={"content": SECRET})
170
+ got = c.get("/dedication?history=10").json()
171
+ assert got["dedication"]["version"] == 2
172
+ assert [v["version"] for v in got["history"]] == [2, 1]
173
+ assert got["history"][1]["why"] == "first page" and got["history"][1]["set_at"] > 0
174
+ assert "history" not in c.get("/dedication").json()
175
+ assert SECRET not in str(got)
176
+ c.put("/preface", json={"text": ROOM, "why": "first room"})
177
+ pf = c.get("/preface?history=10").json()
178
+ assert pf["version"] == 1 and pf["history"][0]["text"] == ROOM
179
+ assert "history" not in c.get("/preface").json()
180
+ assert c.get("/preface?format=text&history=10").text == ROOM + "\n"
181
+
182
+
159
183
  def test_an_old_database_gains_read_at_and_keeps_its_notes(tmp_path):
160
184
  db = tmp_path / "notes.db"
161
185
  with sqlite3.connect(db) as conn:
@@ -1,8 +0,0 @@
1
- {
2
- "tag": "5.2.2",
3
- "distance": 0,
4
- "node": "g7d53bd6e8fc90f0a7787e8fef9d6962f0663b91f",
5
- "dirty": false,
6
- "branch": "HEAD",
7
- "node_date": "2026-10-24"
8
- }
File without changes
File without changes
File without changes