Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ deliberately declines) is documented in [SEAMS.md](./SEAMS.md).
contract in the manifest) when cards are due, and a desktop wake triggers a
due check via the lifecycle-hook seam.

Storage is instance-scoped SQLite (`instance_paths().store("learning_wiki")`),
Storage is instance-scoped SQLite (`sdk.plugin_store(plugin_id="learning_wiki")`),
no runtime pip deps; the FSRS-4.5 scheduler is pure Python with the published
default weights (overridable via config).

Expand Down
9 changes: 4 additions & 5 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,11 @@ def _data_dir(cfg: dict) -> Path:
if override:
p = Path(override).expanduser()
else:
try:
from infra.paths import instance_paths # host-only; lazy by design
# Lazy so the package stays importable in its host-free test suite. The
# manifest's v0.148 floor guarantees this seam in a real host.
from graph import sdk

p = instance_paths().store("learning_wiki")
except Exception: # noqa: BLE001 — standalone / tests / older host
p = Path.home() / ".protoagent" / "learning_wiki"
p = sdk.plugin_store(plugin_id="learning_wiki")
p.mkdir(parents=True, exist_ok=True)
return p

Expand Down
6 changes: 3 additions & 3 deletions protoagent.plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# (tests/test_packaging.py enforces it).
id: learning_wiki
name: Learning Wiki
version: 0.3.3
version: 0.3.4
description: >-
An adaptive learning wiki: the agent maintains a persistent, interlinked wiki
of concept pages (Karpathy's LLM-wiki pattern) PLUS a learner ledger — per-concept
Expand All @@ -21,11 +21,11 @@ description: >-
enabled: false
repository: https://github.com/protoLabsAI/learningWiki-plugin
guide_url: https://github.com/protoLabsAI/learningWiki-plugin#install--enable
min_protoagent_version: "0.34.0"
min_protoagent_version: "0.148.0" # sdk.plugin_store

config_section: learning_wiki
config:
data_dir: "" # override the store dir; default = instance_paths().store("learning_wiki")
data_dir: "" # override the store dir; default = this instance's plugin store
desired_retention: 0.9 # FSRS target retrievability at review time (0.7–0.97 sane)
fsrs_weights: [] # 17 floats overriding the FSRS-4.5 defaults (empty = published defaults)
nudge_interval_hours: 0 # >0 = background surface checks due cards every N hours
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "learning-wiki"
version = "0.3.3"
version = "0.3.4"
description = "Adaptive learning-wiki plugin for protoAgent: LLM-maintained wiki + learner ledger + FSRS spaced review."
requires-python = ">=3.11"

Expand Down
35 changes: 35 additions & 0 deletions tests/test_store_path.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
from __future__ import annotations

import sys
import types

import learning_wiki


def test_default_store_comes_from_the_plugin_sdk(monkeypatch, tmp_path):
monkeypatch.delenv("LEARNING_WIKI_DIR", raising=False)
calls = []
sdk = types.ModuleType("graph.sdk")

def plugin_store(*, plugin_id):
calls.append(plugin_id)
tmp_path.mkdir(parents=True, exist_ok=True)
return tmp_path

sdk.plugin_store = plugin_store
graph = types.ModuleType("graph")
graph.sdk = sdk
monkeypatch.setitem(sys.modules, "graph", graph)
monkeypatch.setitem(sys.modules, "graph.sdk", sdk)

assert learning_wiki._data_dir({}) == tmp_path
assert calls == ["learning_wiki"]


def test_config_and_env_overrides_stay_literal_and_skip_the_sdk(monkeypatch, tmp_path):
environment = tmp_path / "environment"
configured = tmp_path / "configured"
monkeypatch.setenv("LEARNING_WIKI_DIR", str(environment))

assert learning_wiki._data_dir({}) == environment
assert learning_wiki._data_dir({"data_dir": str(configured)}) == configured
Loading