pkg-memory
Use when building, serializing, parsing or classifying PKG nanopublications and the nine typed memory fact templates (including the payment-card template that never stores a card number), enforcing purpose policies, or storing memory through PodPort.
- License 许可
- MIT
- 所属仓库
- jeswr/solid-sdk
- 最近更新
- 2026-11-15
- Stars
- ★ 2
- Forks
- 0
01 前言 Front Matter
- name
- pkg-memory
- description
- Use when building, serializing, parsing or classifying PKG nanopublications and the nine typed memory fact templates (including the payment-card template that never stores a card number), enforcing purpose policies, or storing memory through PodPort.
02 资源文件 47
- 参考文档package.json1.2 KB
- 参考文档README.md17.8 KB
- 脚本src/belief.ts3.3 KB
- 脚本src/cards.ts4.7 KB
- 脚本src/chronology.ts455 B
- 脚本src/errors.ts1.2 KB
- 脚本src/ids.ts10.0 KB
- 脚本src/index.ts1.5 KB
- 脚本src/model.ts19.8 KB
- 脚本src/pod-port.ts1.3 KB
- 脚本src/policy.ts4.4 KB
- 脚本src/purpose.ts5.2 KB
- 脚本src/rdf.ts13.4 KB
- 脚本src/store.ts23.1 KB
- 脚本src/templates.ts11.6 KB
- 脚本src/testing.ts1.8 KB
- 脚本src/wac.ts3.5 KB
- 脚本test/belief.test.ts10.4 KB
- 脚本test/blank-node.test.ts3.3 KB
- 脚本test/cards.test.ts15.1 KB
- 参考文档test/fixtures/canonical.json16.5 KB
- 参考文档test/fixtures/literal-parity.json31.1 KB
- 参考文档test/fixtures/README.md3.8 KB
- 参考文档test/fixtures/review-parity.json7.2 KB
- 参考文档test/fixtures/synthetic.claims.json5.3 KB
- 其他test/fixtures/synthetic.expected.trig16.2 KB
- 参考文档test/fixtures/synthetic.ids.json1.4 KB
- 参考文档test/fixtures/temporal.json16.2 KB
- 脚本test/generate-fixtures.py4.8 KB
- 脚本test/generate-literal-fixtures.py3.1 KB
- 脚本test/generate-review-fixtures.py2.6 KB
- 脚本test/generate-temporal-fixtures.py3.6 KB
- 脚本test/ids.test.ts3.6 KB
- 脚本test/language.test.ts8.8 KB
- 脚本test/literal-policy.test.ts7.0 KB
- 脚本test/model.test.ts18.4 KB
- 脚本test/namespaces.test.ts3.3 KB
- 脚本test/policy-store.test.ts8.1 KB
- 脚本test/purpose.test.ts15.0 KB
- 脚本test/scalar.test.ts4.9 KB
- 脚本test/security.test.ts20.0 KB
- 脚本test/store.test.ts92.5 KB
- 脚本test/temporal.test.ts11.5 KB
- 脚本test/wac.test.ts10.2 KB
- 参考文档tsconfig.json241 B
- 参考文档tsconfig.test.json189 B
- 脚本vitest.config.ts424 B
03 SKILL.md 正文
<!-- AUTHORED-BY Codex GPT-6.1-Sol --> <!-- AUTHORED-BY Codex GPT-6 --> <!-- AUTHORED-BY Claude Opus 5.5 -->
PKG nanopublications
Use createFactAssertion for structured facts, buildNanopublications for batches,
serializeNanopublications for TriG, and parseNanopublications to read it back.
The owner WebID is mandatory; never default to a real person's identity.
RDF writes use @rdfjs/wrapper, reads use graph-scoped typed accessors, parsing uses
@jeswr/fetch-rdf, and serialization uses @jeswr/rdf-serialize. Keep assertion
canonicalization compatible with RDFlib 7's builder; RDFC-1.0 labels are different.
Use only fictional example.org identities in fixtures. The five synthetic claims
and Python-generated expected outputs in test/fixtures replace private pilot data.
Supply source digests explicitly; this data-model package never reads source files.
Use classifyNanopublications for derived belief views; acting on a fact also
requires Current validity. Preserve graph-scoped provenance when assertions are
shared. Past/revised claims stay in history; Mentioned is never an inference input.
The paymentCard template stores only the brand, the last four ASCII digits, the
expiry month (gYearMonth) and an optional billing-address IRI. It never stores a
full card number (PAN) or security code. The card is a blank node, so there is no
caller-chosen id. Extra keys are refused. A billing-address IRI with a query, a
fragment, or more than four digits once percent-decoded and NFKC-normalised is
refused, so mint a slug for the address entity. Each field is read once into a snapshot, so getters and proxies cannot
swap values after the check. Refusals never echo the value. Ask the user for the
full number each time a form needs it. The template does not scan other templates
or Turtle bodies; run containsCardNumber on untrusted text (percent-decoded
first) before storing it. findCardNumbers returns UTF-16 spans for redaction.
Use purposeFilter(policy, purpose, clientId) on every personal-data read. It
requires an ODRL permit for every category and denies uncategorized data and
outstanding duties. isSpecialCategory uses a local list; it does not fetch DPV
or infer arbitrary subclasses. The two purpose tokens are ServiceProvision and
Personalisation. Never expose rejected values in a denial message.
Use NanopubStore for one-resource-per-nanopub persistence over the structural
PodPort seam. Its default-policy writer preserves owner edits. ACL writes must
succeed before any private data is written. Require optional head(url) to expose
the unique, unanchored server-advertised WAC { acl } even on 404; never guess
an ACL path. Missing discovery, off-pod links and ACP fail closed with
Memory protection unavailable. Before replacing an existing ACL, use the shared
validateDedicatedWacAcl typed rule checks: all authorizations must be scoped only
to the target, including defaultForNew. Shared, unscoped, malformed and unknown
rules refuse replacement; preserve unrelated grants by leaving the ACL untouched.
Read strong ETags and use If-Match / If-None-Match: * for ACL writes.
Give generic memory test ports explicit WAC metadata when testing private writes.
Use WacDiscoveryOptions.allowAclUrl in NanopubStore's second constructor argument
and discoverWacAcl's third argument when the caller has a protected ACL area.
False or thrown predicate results fail closed before ACL access, without fallback;
the store retains Memory protection unavailable. Do not hard-code consumer paths
in pkg-memory. solid-mcp supplies a predicate derived from the memory layout so
every accepted ACL lies inside its generic-tool boundary; other in-pod ACLs are
refused. The consumer also protects its in-pod WebID profile from generic tools
while retaining policy-enforced Contact reads and internal discovery.
TriG rejection (HTTP 415) or rewriting permits only the same bytes stored as
octet-stream. Strong ETags are required for replacements. Never use a Turtle or
flattened-graph fallback. Retraction appends a revising nanopub; it does not edit
or delete the original. Use the exported memory PodPort for offline tests.
New templates write canonical https://jeswr.org/ns/sectors/health# and
https://jeswr.org/ns/core# terms. Keep supplied assertion graphs and the
reference parser's implicit legacy prefixes unchanged: they are hash inputs.
For new Turtle bodies, declare canonical prefixes explicitly. Read legacy and
mixed graphs without rewriting the terms or their content-derived identifiers.
04 同仓库更多 Skills
storage-conformance
Work on @jeswr/storage-conformance, the shared storage conformance suite package in the Solid SDK workspace.
fetch-rdf-engine-tests
Maintain fetch-rdf's real Node WASM parser integration tests without introducing a reverse engine dependency in fetch-rdf.
alpha
Use when checking fixtures, including folded YAML descriptions.
widget
Use when testing package skills: YAML quoting works.
web-seo
Use when improving technical and entity SEO for a modern personal, portfolio, documentation, or marketing site, including crawlable HTML, canonical metadata, sitemap and robots, Person/ProfilePage JSON-LD, Core Web Vitals, and honest ranking expectations.
solid-wac
Use when implementing or auditing Solid server WAC authorization, ACL creation and inheritance, auxiliary-resource escalation, method-to-mode mapping, 401 versus 403 challenges, WAC-Allow, or defensive typed ACL parsing with @solid/object and @rdfjs/wrapper.