@steve31415/baselib
v3.14.0
Published
Plasticine new-world shared platform library: logging, auth, service-to-service auth, db, HTTP, sync, app updates
Readme
baselib
The Plasticine new-world shared platform library (@steve31415/baselib).
What it provides and why: docs/SPEC.md. How it's put together:
docs/IMPL.md. Full design rationale with alternatives:
~/migration/research/base-services-design.md (step 5).
Server subpath exports: config, log, auth, s2s, db, http, sync,
app-update, llm, email, and twitter. Browser exports: log-browser, rum,
slow-fetch, sync-browser, and app-update-browser.
sync provides the Postgres event-log and server protocol primitives;
sync-browser provides the IndexedDB outbox and offline-first client.
app-update renders build-aware shells, matches their ETags, and fetches
retained assets for consumer-owned routes;
app-update-browser detects a new traffic build and reloads when the app's
injected safety policy permits. Apps inject their domain mutations, state
adapter, transport/auth-state integration, and update hooks. These modules do
not decide authentication or ownership, contain app domain logic, or act as a
generic Yjs or service-worker coordinator.
llm is the fleet's one LLM client (Anthropic, Gemini, OpenAI): model
registry, automatic cross-provider failover, portable JSON-schema output.
Usage guide: ~/plasticine-way/docs/LLM.md.
email is the fleet's transactional email path: sendEmail through Resend
from a named [email protected] sender, no outbox — a failed send is an
ERROR log (~/plasticine-way/docs/SECURITY.md, "Resend API key").
Bins: check-test-owners — the fleet's structural test-coverage gate; every
app runs it from npm run verify. pw-deploy / pw-rollback — the fleet
deploy (~/plasticine-way/docs/OPERATIONS.md, "Deployment safety").
pw-sql / pw-logs — read-only production queries (database, Axiom), the
first step of any production investigation (same doc, "Investigating
production state").
twitter provides Mirror2-first tweet lookup, TwitterAPI.io batch/search/
article calls, and thread assembly through direct reply edges. It includes
one level of quotes, article bodies and URL expansions. Use one shared
MirrorTweetClient(mirrorUrl, serviceFetch) and TwitterApiIoClient(key)
per run; assembleThread(id, { api, mirror, ancestors: 'all' }) returns
role-tagged tweets, source counts and warnings. Batch prefetching Mirror
ids seeds the shared cache. Reader2 and Snip retain their copies for now.
Releasing: bump version, commit, and run npm run deploy (Coder runs it
automatically when integrating a baselib branch) — it pushes the v<version>
tag, whose workflow gates on verify and publishes via OIDC, and waits for the
registry (~/plasticine-way/docs/OPERATIONS.md, "Publishing baselib").
Reflects Plasticine Way commit: see docs/IMPL.md footer.
