@panaversity/ksor 0.0.2 → 0.0.4

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 (31) hide show
  1. package/CHANGELOG.md +87 -0
  2. package/README.md +6 -4
  3. package/dist/cli.mjs +6348 -8
  4. package/dist/index.d.mts +3 -2
  5. package/dist/index.mjs +1 -36
  6. package/dist/src-CpDIVudJ.mjs +43 -0
  7. package/docs/index.md +10 -4
  8. package/package.json +18 -5
  9. package/schema/schema.sql +316 -0
  10. package/templates/scaffold/.agents/skills/add-sources/SKILL.md +4 -1
  11. package/templates/scaffold/.agents/skills/format-checker/SKILL.md +8 -1
  12. package/templates/scaffold/.agents/skills/format-checker/check.mjs +241 -9
  13. package/templates/scaffold/.agents/skills/intake-interview/SKILL.md +27 -7
  14. package/templates/scaffold/.claude/skills/add-sources/SKILL.md +4 -1
  15. package/templates/scaffold/.claude/skills/format-checker/SKILL.md +8 -1
  16. package/templates/scaffold/.claude/skills/format-checker/check.mjs +241 -9
  17. package/templates/scaffold/.claude/skills/intake-interview/SKILL.md +27 -7
  18. package/templates/scaffold/AGENTS.md +137 -14
  19. package/templates/scaffold/README.md +55 -3
  20. package/templates/scaffold/gitignore +3 -0
  21. package/templates/scaffold/instance.md +3 -2
  22. package/templates/scaffold/package.json +8 -1
  23. package/templates/scaffold/pnpm-workspace.yaml +21 -5
  24. package/templates/scaffold/system/site/app/(home)/page.tsx +2 -2
  25. package/templates/scaffold/system/site/app/docs/layout.tsx +2 -2
  26. package/templates/scaffold/system/site/components/footer-mark.tsx +22 -0
  27. package/templates/scaffold/system/site/lib/audience.ts +178 -0
  28. package/templates/scaffold/system/site/lib/shared.ts +14 -5
  29. package/templates/scaffold/system/site/lib/stage-knowledge.ts +301 -0
  30. package/templates/scaffold/system/site/source.config.ts +7 -1
  31. package/templates/scaffold/vercel.json +8 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,92 @@
1
1
  # @panaversity/ksor
2
2
 
3
+ ## 0.0.4
4
+
5
+ ### Patch Changes
6
+
7
+ - 473302a: feat: `@panaversity/ksor` now ships the whole Knowledge System of Record as ONE
8
+ package. The kernel (corpus store, hybrid retrieval, calibrated abstention, and
9
+ the MCP gateway) is bundled into the CLI, which exposes one `ksor` binary with
10
+ all verbs: `init`, `dev`/`build` (still exit 2), `serve` (runs the MCP server
11
+ in-process, reading `./instance.md`), and the corpus operations `ingest`,
12
+ `schema`, `calibrate`, `gc`. An adopter installs one thing and the content SoR
13
+ is always present. Note: the CLI is no longer zero-dependency — installing it
14
+ now pulls the server runtime (pg, the embedding SDK, the MCP SDK).
15
+
16
+ Because MCP serving is a core surface, `ksor init` now declares
17
+ `@panaversity/ksor` as a dependency of the scaffolded project — pinned to the
18
+ exact CLI version that scaffolded it — with `pnpm serve` and `pnpm ingest`
19
+ scripts, so the served tool is a first-class, version-pinned command rather
20
+ than an `npx` afterthought. The scaffold's first `pnpm install` is non-frozen
21
+ (it resolves the tool and writes the lockfile); `pnpm dev` still needs no
22
+ database.
23
+
24
+ The MCP surface ships on the **2026-07-28** spec revision, via SDK v2
25
+ (`@modelcontextprotocol/server`). Since this release is the agent surface's
26
+ debut, it ships current rather than one revision behind: the door serves the
27
+ handshake-free modern era (`server/discover`, per-request envelope) and keeps
28
+ serving 2025-era clients through the same stateless idiom, so nothing that
29
+ works today stops working.
30
+
31
+ New verb: **`ksor grant`** authorizes ingest for a corpus (and `--revoke`
32
+ withdraws it) — the row row-level security requires before any write. It runs
33
+ through the same `pg` driver every other verb uses, so finishing setup no
34
+ longer requires dropping out of ksor into `psql`. Idempotent, and it reports
35
+ the state it established rather than a bare "ok". Kept a separate act from
36
+ `schema --apply` on purpose: a schema step that granted itself write access
37
+ would make the tool its own authorizer.
38
+
39
+ Scaffold serve-rung fixes (from a multi-agent operability review): the
40
+ scaffolded format checker (`pnpm check`) now accepts the `database:`/`embedding:`/
41
+ `retrieval:`/`budgets:` blocks that `ksor serve`/`ingest` require, so a project
42
+ climbing to serving is no longer rejected by its own CI; the scaffold's
43
+ `pnpm ingest` script now `--flip`s (a first ingest without it left the server
44
+ answering from an unactivated generation); the kernel's build-scripted deps
45
+ (`@google/genai`, `protobufjs`) are denied under `allowBuilds` so the first
46
+ install does not exit 1; and the scaffold `AGENTS.md`/`README.md` now carry the
47
+ full serve runbook — the ordered `schema` → grant → `ingest` → `serve` pipeline,
48
+ the `instance.md` block shapes, the env contract, the generation model, and the
49
+ fail-closed security posture.
50
+
51
+ - af53bed: fix: `ksor serve` no longer exits when the database terminates an idle
52
+ connection. The Postgres pool had no `'error'` listener, so an idle client
53
+ dropped by a restart, a failover, or an administrative `pg_terminate_backend`
54
+ became an uncaught exception and killed the process instead of being discarded
55
+ and reconnected. Long-running servers were exposed to this on any routine
56
+ database maintenance; the pool now logs the discarded connection's error class
57
+ and keeps serving.
58
+ - 4fa4906: test(ci): make the scaffold browser e2e reliable — retry `pnpm build` once on the
59
+ known upstream Turbopack static-image flake (`TurbopackInternalError: Input image
60
+ not found`), scoped to that exact signature so a real build break still fails on
61
+ the first try. Test-infrastructure only: the published CLI tarball is unchanged
62
+ (the retry helper is not reachable from the CLI entry and does not ship). The
63
+ durable fix — dropping the scaffold home page's static `app/icon.png` import — is
64
+ tracked as an owner call.
65
+
66
+ ## 0.0.3
67
+
68
+ ### Patch Changes
69
+
70
+ - 8e88899: The scaffold now answers Vercel's deploy interview: a shipped
71
+ `vercel.json` declares the repo root as the deploy directory (pinning
72
+ `system/site` omits the record — the interview's natural answer breaks
73
+ the build), the static export as the deliverable, and matching trailing
74
+ slashes. The README gains a Deploying section documenting what was
75
+ always true but never written down: the built site is a folder of files
76
+ with zero host-specific dependencies — Vercel, GitHub Pages, nginx, or
77
+ `python3 -m http.server` all serve it, with `KSOR_BASE_PATH` for
78
+ sub-path hosts.
79
+ - 113fddd: The record can now declare its audience. A governed `visibility:` key
80
+ (one value, orthogonal to `status:`) against an `audiences:` model in
81
+ instance.md; per-audience **staged** builds enforce it — a build below a
82
+ document's tier carries no trace of it: no page, no search entry, no
83
+ llms.txt line, no sidebar title, no asset bytes, and nothing about the
84
+ filter itself in the client bundle. Non-public builds name themselves.
85
+ Seven checker rules guard the model, including the cross-audience link
86
+ no single build can catch. Absent `audiences:`, nothing changes —
87
+ purely additive. Evidence and the measured build-time-vs-per-request
88
+ decision: the ksor repository's research/visibility.md and issue #10.
89
+
3
90
  ## 0.0.2
4
91
 
5
92
  ### Patch Changes
package/README.md CHANGED
@@ -23,11 +23,13 @@ search and `llms.txt`, adopter CI, a dependency-free format checker
23
23
  operate it. Everything emitted is yours (the templates are MIT-0), the
24
24
  scaffold is deterministic and offline, and every refusal explains itself.
25
25
 
26
- > **`0.x` status:** `init` works; `dev`, `build` and `serve` are designed,
27
- > not implementedeach prints an honest notice and exits `2` (inside a
28
- > scaffolded project, `pnpm dev` / `pnpm build` cover local work).
26
+ > **`0.x` status:** `init` works, and `serve` runs the MCP server over a built
27
+ > record (with `ingest`/`schema`/`calibrate`/`gc` the climbed rung, needing
28
+ > Postgres and a provider key). Only `dev` and `build` are designed, not
29
+ > implemented — each prints an honest notice and exits `2` (inside a scaffolded
30
+ > project, `pnpm dev` / `pnpm build` cover local work).
29
31
  > [`docs/status.md`](https://github.com/panaversity/ksor/blob/main/docs/status.md)
30
- > and the released version number are authoritative for implemented
32
+ > and the released version number are authoritative for the exact released
31
33
  > functionality.
32
34
 
33
35
  Full concept, design goals, and project status: