diff --git a/AGENTS.md b/AGENTS.md
index 5c03741..f505933 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -34,7 +34,9 @@ tests. The approved scope is the [Support Desk enhancement plan](https://github.
read batching; retain the [historical release receipt](docs/BOOTSTRAP.md#current-verified-015-release).
All four `0.1.6` packages completed verified trusted publication for MCP metadata
compatibility. Retain the [current release receipt](docs/BOOTSTRAP.md#current-verified-016-release).
- The synchronized `0.1.7` source candidate remains unpublished.
+ All four `0.1.7` packages completed verified trusted publication for the staff
+ report-view canonical receipt. Retain the [verified release](https://github.com/pegma-dev/knowledge-base/releases/tag/v0.1.7).
+ The synchronized `0.1.8` source candidate remains unpublished.
Grouped reads establish no universal query or CPU budget. Host dependency
adoption and real-host acceptance remain separate.
- Never implement a database, authorization role model, identity/session/token
diff --git a/README.md b/README.md
index 598238a..94151cc 100644
--- a/README.md
+++ b/README.md
@@ -29,7 +29,9 @@ and exact publication approval. It requires no GitHub connection or AI provider.
> for answering read batching, including strict registry/provenance and public-consumer
> verification. All four `0.1.6` packages completed
> [verified trusted publication](docs/BOOTSTRAP.md#current-verified-016-release)
-> for MCP extension metadata compatibility. The `0.1.7` candidate remains unpublished.
+> for MCP extension metadata compatibility. All four `0.1.7` packages completed
+> [verified trusted publication](https://github.com/pegma-dev/knowledge-base/releases/tag/v0.1.7)
+> for the staff report-view canonical receipt. The `0.1.8` candidate remains unpublished.
> Host dependency adoption remains separate.
> Actual two-host existing-login/client acceptance remains open.
> Host activation remains separately gated; this repository supplies no hosted KB.
@@ -173,7 +175,7 @@ release checkpoint, all four KB packages had `latest: 0.1.5`; Agent Access
remained at `latest: 0.1.1`; all retained `bootstrap: 0.1.0`. Dist-tags are mutable
observations. The [retained `0.1.5` receipt](docs/BOOTSTRAP.md#current-verified-015-release)
binds the original artifact, exact manifest, authenticated original writers and
-strict verification. The [current `0.1.6` receipt](docs/BOOTSTRAP.md#current-verified-016-release)
+strict verification. The [historical `0.1.6` receipt](docs/BOOTSTRAP.md#current-verified-016-release)
records the later verified metadata compatibility release. Read batching establishes no universal backend query or
CPU budget. Neither registry publication nor synthetic proof satisfies real
host acceptance or approves activation.
diff --git a/docs/AGENT_API.md b/docs/AGENT_API.md
index 0339aab..40fee25 100644
--- a/docs/AGENT_API.md
+++ b/docs/AGENT_API.md
@@ -12,7 +12,7 @@ in [`0.1.4`](https://github.com/pegma-dev/knowledge-base/releases/tag/v0.1.4).
All four synchronized `0.1.5` packages have completed verified trusted
publication for answering read batching; see the
[retained receipt](BOOTSTRAP.md#current-verified-015-release). The current verified
-release is [`0.1.6`](BOOTSTRAP.md#current-verified-016-release). The `0.1.7` candidate
+release is [`0.1.7`](https://github.com/pegma-dev/knowledge-base/releases/tag/v0.1.7). The `0.1.8` candidate
remains unpublished. Changed source
requires its own review and current-head gates.
Agent Access's verified public `0.1.1` producer prerequisite is closed; see the
diff --git a/docs/AGENT_WORKFLOW.md b/docs/AGENT_WORKFLOW.md
index d1da881..92c1e7a 100644
--- a/docs/AGENT_WORKFLOW.md
+++ b/docs/AGENT_WORKFLOW.md
@@ -1,8 +1,8 @@
# Agent authoring and test-evidence workflow
The current verified Knowledge Base release is
-[`0.1.6`](BOOTSTRAP.md#current-verified-016-release).
-The `0.1.7` source candidate remains unpublished.
+[`0.1.7`](https://github.com/pegma-dev/knowledge-base/releases/tag/v0.1.7).
+The `0.1.8` source candidate remains unpublished.
The [merged KB-04 source](https://github.com/pegma-dev/knowledge-base/pull/5)
adds optional authoring transports over the existing Knowledge Base
diff --git a/docs/BOOTSTRAP.md b/docs/BOOTSTRAP.md
index 88c883a..d619428 100644
--- a/docs/BOOTSTRAP.md
+++ b/docs/BOOTSTRAP.md
@@ -7,13 +7,13 @@ The maintainer owns npm publication and external configuration. All four KB
postflight passed at **2026-11-07T21:56:24Z**. Agent Access `0.1.0` also completed
manual bootstrap and postflight. Neither bootstrap has OIDC provenance.
KB's current verified trusted release is
-[`0.1.6`](https://github.com/pegma-dev/knowledge-base/releases/tag/v0.1.6); Agent Access
+[`0.1.7`](https://github.com/pegma-dev/knowledge-base/releases/tag/v0.1.7); Agent Access
remains verified at `0.1.1`. Their receipts close public producer release
prerequisites only. The dated trusted KB `0.1.1`, `0.1.2`, `0.1.3`, `0.1.4` and `0.1.5`
receipts remain below as history. The answering read-batching `0.1.5` release
completed its own review, current-head gates, trusted publication and strict
-registry/consumer qualification. The [current `0.1.6` receipt](#current-verified-016-release)
-records the later MCP metadata compatibility release. The `0.1.7` source candidate
+registry/consumer qualification. The [retained `0.1.6` receipt](#current-verified-016-release)
+records the MCP metadata compatibility release. The `0.1.8` source candidate
remains unpublished and requires its own current-head gates and release.
Host dependency adoption and acceptance remain separate.
@@ -88,7 +88,25 @@ the approved dependency set or establishes real-host acceptance.
## Verified Knowledge Base release
-### Current verified `0.1.6` release
+### Verified `0.1.7` release
+
+All four synchronized [`0.1.7` packages](https://github.com/pegma-dev/knowledge-base/releases/tag/v0.1.7)
+completed exact-registry-byte, native signature, source-provenance and clean
+consumer verification. Signed source is `27074b8bba76817ea6960606cf29d8fc239943b0`,
+with annotated tag object `8cd14438d9dbff78eb0e1db288cfa09741e12e99`. The
+[successful attempt 5](https://github.com/pegma-dev/knowledge-base/actions/runs/43271542639/attempts/5)
+verified four identical existing packages and uploaded zero versions. Original
+physical writers were attempts 1 through 4. The original preparation artifact
+`13969137667` has ZIP SHA-256
+`c683fb87be0351ce75d6a99921b5e4428c501f39e22cf6ce04aeba6ad962b75c`;
+its manifest SHA-256 is
+`514cbf58b297dd73939dc37d833254edfc39de561cd40f525717947d06491116`.
+The release adds the canonical receipt to the staff report view. Its original
+package bytes and prior release receipts retain their identities.
+
+
+
+### Historical verified `0.1.6` release
All four synchronized KB `0.1.6` packages completed exact-registry-byte, native
signature, authenticated source-provenance and clean-consumer verification at
@@ -508,11 +526,11 @@ must name this repository's exact `publish.yml` workflow and environment and
explicitly permit direct publishing. Time new configurations to the prepared
trusted release so their first-use expiry does not strand the release.
-The synchronized current KB release is `0.1.6` with exact internal dependency
+The synchronized current verified KB release is `0.1.7` with exact internal dependency
pins. Any changed source needs its own review and current-head gates before a
new release. The historical first advertised trusted release is `0.1.1`; its
receipt and those for `0.1.2` through `0.1.5` remain above alongside the
-current verified `0.1.6` receipt.
+retained verified `0.1.6` receipt and the `0.1.7` release.
A previously manually published version cannot be
republished through OIDC to add provenance. Run the full review/Node 22/24 gate
for the newly reviewed commit, create its approved signed annotated version tag
@@ -528,6 +546,6 @@ results with the release identity and independent manifest digest. The active
KB protocol proof uses the verified registry producer
`@pegma/agent-access@0.1.1`; historical source-producer evidence remains in
[source preparation](SOURCE_PREPARATION.md). The verified KB `0.1.3` receipt
-remains historical; KB `0.1.6` and Agent Access `0.1.1` public producer release
+remains historical; KB `0.1.7` and Agent Access `0.1.1` public producer release
prerequisites are closed. Both hosts still require their retained actual
login/Admin-consent/client/staging acceptance.
diff --git a/docs/COLLECTIONS.md b/docs/COLLECTIONS.md
index a4bd011..8af2479 100644
--- a/docs/COLLECTIONS.md
+++ b/docs/COLLECTIONS.md
@@ -1,8 +1,8 @@
# Declared collections and durable layout
The current verified Knowledge Base release is
-[`0.1.6`](BOOTSTRAP.md#current-verified-016-release).
-The `0.1.7` source candidate remains unpublished.
+[`0.1.7`](https://github.com/pegma-dev/knowledge-base/releases/tag/v0.1.7).
+The `0.1.8` source candidate remains unpublished.
## Design status
diff --git a/docs/EVIDENCE_REPORTS.md b/docs/EVIDENCE_REPORTS.md
index 485d6be..a0c83fd 100644
--- a/docs/EVIDENCE_REPORTS.md
+++ b/docs/EVIDENCE_REPORTS.md
@@ -1,8 +1,8 @@
# Human-reviewed evidence reports
The current verified Knowledge Base release is
-[`0.1.6`](BOOTSTRAP.md#current-verified-016-release).
-The `0.1.7` source candidate remains unpublished.
+[`0.1.7`](https://github.com/pegma-dev/knowledge-base/releases/tag/v0.1.7).
+The `0.1.8` source candidate remains unpublished.
`createKnowledgeEvidenceReports` shipped in the four synchronized, verified
[`0.1.3` packages](https://github.com/pegma-dev/knowledge-base/releases/tag/v0.1.3).
@@ -131,6 +131,52 @@ intact. This source change establishes no universal Workers Free 50-query, CPU
or wall-clock guarantee. Complete host invocations, real authorities, supported
histories, retries and cold composition require their own measured acceptance.
+## Optional report observations (`0.1.8` candidate)
+
+The unpublished `0.1.8` candidate adds `reports.observations` when the factory
+receives the actual `authoringContext` pair. Legacy factories keep this property
+absent. Existing `read`, owner-only `status`, decisions and the verifier retain
+their contracts.
+
+`observe(access, { articleId, ledgerEpoch, reportId })` returns
+`{ view, context, observation }` for a confirmed report. The view has the existing
+`KnowledgeReportView` shape. The context contains the actual governed draft,
+narrow requirements and complete current accepted evidence/revocation history.
+The configured human confirmation permission, draft/evidence reading and either
+evidence-submit or draft-write authority remain required. Current staff authority
+is checked again after all private reads before disclosure.
+
+Treat the returned data as provisional until
+`confirm(access, observation, verification?)` finishes. Its opaque handle belongs
+to that report instance, exact effective actor and one operation. A clone or
+another instance is invalid. A wrong actor cannot consume the original handle.
+An actual confirmation consumes it before awaited work, including failed probes;
+start a fresh observation after failure. Returned data is detached from the
+retained observation, so changing a view cannot change its binding. Keep handles
+out of wire DTOs, storage, command fingerprints and retained receipts.
+
+The confirmation checks the real KB authoring resource versions before its
+closing report read. Fresh actor and reviewer authority are checked in a settled
+read-only wave with the exact report row. The observed reviewer authority and
+report version must still match. The ledger head is the final data await, fencing
+reset, resetting state and changed raw head versions. These separate observations
+establish bounded freshness across collections; they hold no atomic lock.
+
+The result is `{ receipt, attestation }`. Without `verification`, attestation is
+`null`. A trusted host may supply the existing `EvidenceVerificationRequest` for
+the actual original submitter. The method reuses the legacy verifier's receipt,
+whole submission, article, configuration, revocation and freshness predicates
+against the already-observed real context. Current original-owner evidence-submit
+authority remains required. Another staff reader can confirm a private read while
+owner-only status and attestation remain bound to the submitter. Hosts continue
+to obtain privileged current governance through their existing intrinsic port;
+the new context exposes the existing narrow requirements DTO only.
+
+The pair adds no durable row, scope, tool, credential or host session check. Hosts
+retain their current credential, Support/source/product and precommit/ACK fences.
+Query count and CPU acceptance require complete physical host measurements with
+the actual read scheduling and authority callbacks.
+
## Submit, review, then qualify evidence
`report(access, input)` accepts `SubmitKnowledgeReportInput`: `commandId`,
diff --git a/docs/HOST_COMPOSITION.md b/docs/HOST_COMPOSITION.md
index b5450e5..116f503 100644
--- a/docs/HOST_COMPOSITION.md
+++ b/docs/HOST_COMPOSITION.md
@@ -1,8 +1,8 @@
# Application and retrieval host composition
The current verified Knowledge Base release is
-[`0.1.6`](BOOTSTRAP.md#current-verified-016-release).
-The `0.1.7` source candidate remains unpublished.
+[`0.1.7`](https://github.com/pegma-dev/knowledge-base/releases/tag/v0.1.7).
+The `0.1.8` source candidate remains unpublished.
## Status and ownership
@@ -220,6 +220,17 @@ requirements operation; legacy report trios retain their fallback. It returns
no draft body, private evidence, report details, reviewer or provenance. See
[evidence reports](EVIDENCE_REPORTS.md) for composition and exact privacy rules.
+The unpublished `0.1.8` report observation capability reuses the real
+evidence-bearing authoring context within one operation. Its private view remains
+provisional until the paired confirmation checks resource versions, current
+actor/reviewer authority, the exact report and final ledger head. Keep the
+original effective caller and the host's current credential, governance,
+Support/source/product and commit/ACK guards. A different staff reader receives
+no submitter-bound verifier authority. The
+[report contract](EVIDENCE_REPORTS.md#optional-report-observations-018-candidate)
+defines the instance-bound, single-use handle and legacy fallback. Real host
+query and CPU profiles remain pending acceptance work.
+
These are finite current observations across separate partitions, not a global
snapshot or policy lock. Evidence qualification, exact review/publication and
host credential freshness remain independent checks. Private record keys are
diff --git a/docs/RELEASING.md b/docs/RELEASING.md
index 11bca9f..e3748fe 100644
--- a/docs/RELEASING.md
+++ b/docs/RELEASING.md
@@ -66,7 +66,7 @@ Changed source still needs all current-head gates before release preparation.
No source merge configures publishers, creates a tag/release, or publishes npm
packages. The [maintainer bootstrap ledger](BOOTSTRAP.md) retains the actual
manual commands/stdout, exact identities, preparation runs/artifacts, and
-independently retained digests. The qualified release versions are KB `0.1.6`
+independently retained digests. The qualified release versions are KB `0.1.7`
and Agent Access `0.1.1`. The manual `0.1.0` bootstraps and their dated dist-tag
observations remain historical integrity receipts without OIDC provenance.
@@ -103,24 +103,35 @@ signature, source-provenance and clean-consumer verification.
Existing release receipts, tag links and tarballs retain their original
identities. Host and native-client acceptance remain separately gated.
-## Unpublished 0.1.7 candidate
+## Verified 0.1.7 release
-All four source package versions and exact internal pins are synchronized at
-`0.1.7`. The candidate adds the required `receipt: string` to the existing staff
+All four released package versions and exact internal pins were synchronized at
+`0.1.7`. The release added the required `receipt: string` to the existing staff
`KnowledgeReportView` for its authenticated canonical report receipt. The read
refuses observed concurrent report or ledger changes before returning the view.
A host can associate the receipt with Support test results after refreshing the
governed KB context and checking exact accepted evidence and revocation DTOs
through authorized public reads. Actual receipt verification and owner-only
status remain bound to the original submitter. These host association checks
-leave existing KB evidence acceptance unchanged. The candidate adds no tool,
+leave existing KB evidence acceptance unchanged. The release adds no tool,
scope, role or durable state.
-The current qualified release remains `0.1.6`. Combined candidate source requires
-current-head Node 22 and 24 gates, review, signed-tag preparation, trusted
-publication and strict complete-set registry verification before adoption.
-Host and native-client acceptance remain separately gated. Read the
-[application upgrade note](../packages/application/README.md#unpublished-017-candidate) for the receipt boundary and synchronized graph.
+The [qualified `0.1.7` release](https://github.com/pegma-dev/knowledge-base/releases/tag/v0.1.7) completed trusted
+publication and strict complete-set registry and consumer verification. Host and
+native-client acceptance remain separate. Read the
+[application upgrade note](../packages/application/README.md#verified-017-release)
+for the receipt boundary and synchronized graph.
+
+## Unpublished 0.1.8 candidate
+
+All four source versions and internal pins are synchronized at `0.1.8`. The
+optional operation-local [report observation pair](EVIDENCE_REPORTS.md#optional-report-observations-018-candidate)
+reuses the real governed context and confirms its resources, report, ledger and
+current authorities. It adds no wire operation, scope, durable row or migration.
+The candidate requires current-head Node 22 and 24 gates, configured review,
+signed-tag preparation, trusted publication and complete-set registry verification
+before public adoption. Host query and CPU profiles remain measured acceptance
+work.
## Repository and development artifact gates
diff --git a/docs/RETRIEVAL.md b/docs/RETRIEVAL.md
index acbf499..d2fc022 100644
--- a/docs/RETRIEVAL.md
+++ b/docs/RETRIEVAL.md
@@ -1,8 +1,8 @@
# KB-03 bounded retrieval
The current verified Knowledge Base release is
-[`0.1.6`](BOOTSTRAP.md#current-verified-016-release).
-The `0.1.7` source candidate remains unpublished.
+[`0.1.7`](https://github.com/pegma-dev/knowledge-base/releases/tag/v0.1.7).
+The `0.1.8` source candidate remains unpublished.
## Design status
diff --git a/docs/SOURCE_PREPARATION.md b/docs/SOURCE_PREPARATION.md
index c91ecd6..4711fc5 100644
--- a/docs/SOURCE_PREPARATION.md
+++ b/docs/SOURCE_PREPARATION.md
@@ -1,8 +1,8 @@
# KB-05 source preparation
The current verified Knowledge Base release is
-[`0.1.6`](BOOTSTRAP.md#current-verified-016-release).
-The `0.1.7` source candidate remains unpublished.
+[`0.1.7`](https://github.com/pegma-dev/knowledge-base/releases/tag/v0.1.7).
+The `0.1.8` source candidate remains unpublished.
## Scope and readiness
diff --git a/examples/agent/README.md b/examples/agent/README.md
index b98d018..32d2eb8 100644
--- a/examples/agent/README.md
+++ b/examples/agent/README.md
@@ -1,8 +1,8 @@
# Packed local agent protocol proof
The current verified Knowledge Base release is
-[`0.1.6`](../../docs/BOOTSTRAP.md#current-verified-016-release).
-The `0.1.7` source candidate remains unpublished.
+[`0.1.7`](https://github.com/pegma-dev/knowledge-base/releases/tag/v0.1.7).
+The `0.1.8` source candidate remains unpublished.
Run `pnpm run agent:proof` from the repository after
`pnpm install --frozen-lockfile`, on Node 22.6+ or Node 24. npm must be
diff --git a/examples/composition/README.md b/examples/composition/README.md
index 61da573..ea17dd0 100644
--- a/examples/composition/README.md
+++ b/examples/composition/README.md
@@ -1,8 +1,8 @@
# Fictional Knowledge Base composition
The current verified Knowledge Base release is
-[`0.1.6`](../../docs/BOOTSTRAP.md#current-verified-016-release).
-The `0.1.7` source candidate remains unpublished.
+[`0.1.7`](https://github.com/pegma-dev/knowledge-base/releases/tag/v0.1.7).
+The `0.1.8` source candidate remains unpublished.
This runnable Node example uses public package entry points and Storage Core's
real memory Store. It demonstrates authoring, bound synthetic verification
diff --git a/package.json b/package.json
index a9a87ec..0379b50 100644
--- a/package.json
+++ b/package.json
@@ -34,11 +34,11 @@
"@cloudflare/workers-types": "5.20260730.1",
"@modelcontextprotocol/sdk": "1.32.2",
"@pegma/authorization-core": "0.4.0",
- "@pegma/knowledge-base-application": "0.1.7",
+ "@pegma/knowledge-base-application": "0.1.8",
"@pegma/knowledge-base-application-previous": "npm:@pegma/knowledge-base-application@0.1.1",
- "@pegma/knowledge-base-contracts": "0.1.7",
- "@pegma/knowledge-base-core": "0.1.7",
- "@pegma/knowledge-base-mcp": "0.1.7",
+ "@pegma/knowledge-base-contracts": "0.1.8",
+ "@pegma/knowledge-base-core": "0.1.8",
+ "@pegma/knowledge-base-mcp": "0.1.8",
"@pegma/spine": "0.1.2",
"@pegma/storage-azure-tables": "0.4.0",
"@pegma/storage-cloudflare-d1": "0.4.6",
diff --git a/packages/application/README.md b/packages/application/README.md
index 90f9eae..0ba5252 100644
--- a/packages/application/README.md
+++ b/packages/application/README.md
@@ -24,7 +24,7 @@ The synchronized answering read-batching `0.1.5` release has completed verified
trusted publication; see its
[release receipt](https://github.com/pegma-dev/knowledge-base/releases/tag/v0.1.5).
The current verified synchronized release is
-[`0.1.6`](https://github.com/pegma-dev/knowledge-base/releases/tag/v0.1.6).
+[`0.1.7`](https://github.com/pegma-dev/knowledge-base/releases/tag/v0.1.7).
Changed source still requires its own review and current-head gates. Backend
query and CPU budgets require actual host measurements. These source README
corrections apply to a future release. Published `0.1.5` tarballs, including
@@ -197,9 +197,9 @@ no populated-namespace detection, layout switch or migration is automatic.
The factory adds no agent scope, MCP tool, role, login, scheduler or provenance
bridge. Hosts retain exact-publication and activation prerequisites.
-### Unpublished 0.1.7 candidate
+### Verified 0.1.7 release
-The candidate adds required `readonly receipt: string` to the existing staff
+The `0.1.7` release adds required `readonly receipt: string` to the existing staff
`KnowledgeReportView` for pending, confirmed and rejected reads. It returns the
authenticated canonical receipt from the same current report snapshot as its
generation, hash and confirmation. Confirmation preserves the receipt,
@@ -215,14 +215,31 @@ and owner-only status remain bound to the original submitter. Staff and resource
read guards, the five agent operations, scopes, roles and durable report state
remain unchanged.
-The verified [`0.1.6` release](https://github.com/pegma-dev/knowledge-base/releases/tag/v0.1.6)
-remains the released graph. Combined `0.1.7` source requires its current-head
-Node 22 and 24 gates, review and complete release verification before adoption.
-Then align all four exact package versions together. Existing external pins and
+The verified [`0.1.7` release](https://github.com/pegma-dev/knowledge-base/releases/tag/v0.1.7)
+is the released graph. Align all four exact package versions together. Existing external pins and
the previous application writer at `0.1.1` remain unchanged. The extension
requires no data migration. Host acceptance and activation remain separately
gated, and existing release receipts and artifact bytes retain their identities.
+### Unpublished 0.1.8 report observation candidate
+
+With a real `authoringContext` pair, the report factory exposes optional
+`observations.observe(access, key)` and `observations.confirm(access, handle,
+verification?)`. The first returns the existing private report view, complete
+current evidence-bearing context and an instance-bound, single-use handle. It
+checks current staff authority after its private reads. Treat the data as
+provisional until confirmation finishes. The confirmation rechecks real KB
+resource versions, fresh actor/reviewer authority, the exact report row and the
+final ledger head. Its optional original-owner verification request reuses the
+legacy verifier predicates and returns the same attestation without reloading
+the context. Other staff readers receive no owner-verifier authority.
+
+Keep this pair inside one operation and application/report instance. Handles
+cannot be cloned, serialized, persisted or reused after an attempted confirmation.
+The [source contract](https://github.com/pegma-dev/knowledge-base/blob/main/docs/EVIDENCE_REPORTS.md#optional-report-observations-018-candidate)
+describes failure and host ownership. This unpublished candidate adds no durable
+state, MCP tool or scope. Actual host query/CPU acceptance is pending.
+
## Bounded retrieval and repair
`listPortalCollections` and `searchPublishedArticles` require current portal
@@ -285,6 +302,106 @@ authorization cache and do not establish
Workers Free quota acceptance. The `0.1.5` trusted release is complete;
changed-source gates and whole-host measurements remain separate.
+## Background published comparisons
+
+`publishedSearchObservations` is a bounded staff-authoring capability for a host
+queue, timer, or deferred checker. Do not invoke its catalogue work in portal
+search, answering, or another inline request path. It requires current
+`draftRead` **and** `articleRead`, the permissions already held by the intrinsic
+learning-draft service. It needs no customer audience permission, ambient role,
+`collectionRead`, `botRead`, `indexManage`, or administrative grant. At least one
+collection channel must be enabled. Private permission audiences and bot-only
+collections remain valid staff comparison targets.
+
+This is a separate use from customer browsing and answering. Existing
+`searchPublishedArticles` and `getPublishedArticle` retain their portal checks;
+bot retrieval retains its independent bot permission and audience. The shared
+publication checker uses an internal authoring purpose with the same exact
+approval, policy, retained evidence, source eligibility, and current-resource
+fences. A staff read never creates a portal browse permission. No route, MCP
+tool, credential scope, permission name, publication capability, or schema is
+added.
+
+`observe(access, { collectionId, query, applicability, limit })` returns a
+`complete` result containing matching approved `PublishedArticleDto` values, an
+opaque observation, and the actual `scopeState`. An authorized scope with no
+matches may have an empty array. Matching uses the exact collection and
+applicability tuple and normalized lexical terms from approved titles,
+summaries, and tags; it is not a semantic or global duplicate search. Instance
+query character/term limits are checked before I/O. Explicit `null` limits and
+other invalid input throw rather than becoming defaults. A result limit that
+would omit a match yields `partial` with no articles.
+
+The authoritative layout has no per-collection membership index. This background
+fallback therefore scans **all physical KB records**, using actual backend
+continuations in pages of at most eight records. The page count is also bounded;
+every history, private, duplicate, and nonmatching row is charged before
+filtering, and an empty page still costs read work. The existing per-record
+native estimate and fixed 7.2 MB page allowance bound materialized native payload
+independently from the total row count. Only bounded keys, opaque versions, and
+head IDs survive between pages; full page payloads are released before advancing.
+This is not a measured heap, CPU, or backend allocation guarantee.
+
+Each scan pass has a hard 256-physical-row limit and shares the original request
+read allowance with all publication checks and the second pass. Reaching the
+row/work/page bound with a continuation yields `partial`; no possible 257th row
+is fetched as a probe. Consequently an adapter that emits a speculative cursor
+at exactly 256 rows can conservatively hold, even when its next page would be
+empty. A terminal `null` cursor is required for completion. A full page alone
+never proves that no rows remain. There is no new collection, projection index,
+query filter, or adapter API.
+
+After current publication/source and collection-version checks, a second
+completed bounded pass must return the same physical key/version membership.
+Observed changes, including unrelated writes, invalidate the comparison.
+These completed scan cycles and resource checks provide bounded observations
+and change detection, not an atomic cross-partition snapshot or a guarantee
+against concurrent/future membership changes. Large or actively changing stores
+can remain held and need a later host-owned background strategy. No universal
+query/CPU or Workers Free acceptance is claimed.
+
+`readScope(access, { collectionId })` performs only bounded keyed collection
+reads under the same authoring permissions. It returns
+`{ collectionId, generation, scopeHash }`, derived from the actual collection
+generation, opaque backend head version, and current policy digest. A second
+versioned collection read fences asynchronous hashing/public-approval validation.
+It returns no policy, audience, approval actor, or staff metadata. Complete
+`observe` results compute the same `PublishedSearchScopeState` from their already
+read collection. Bind it into the private comparison receipt and recheck it for
+later policy/authority checks, including an empty result, without another scan.
+Keep it outside model payloads. This state is collection authority, not a fresh
+catalogue search; a new article alone need not change it, and it proves no current
+or future absence of additional matches.
+
+`readArticle(access, { articleId })` returns only the current approved
+`PublishedArticleDto` through the same authoring publication checker. It uses
+keyed reads and no enumeration, including for a bot-only or private-audience
+collection. Current private draft text, proof history, and provenance are not
+projected. Missing, retired, held, source-ineligible, or policy-invalid
+publications cannot produce an article. This method supports later checks of
+retained comparison resources without switching to a customer portal read.
+
+Keep the opaque observation in RAM for one bounded background operation on the
+same application instance. `confirm(access, observation)` consumes it before its
+first await, rechecks the same actor's current authoring permissions, repeats
+current scope/publication/source checks and the bounded membership comparison,
+and rejects changed observations. A clone, another instance/actor, reuse,
+partial recheck, or dependency failure cannot confirm it. The host owns operation
+deadlines and fresh access resolution. Neither method grants review/publication
+authority or locks articles.
+
+Known capacity/work limits return content-free `partial`; ordinary authority or
+storage availability failures return content-free `unavailable` from `observe`.
+Keyed reads and confirmation throw on refusal. Integrity and unexpected
+programming faults remain visible to background operators instead of becoming
+normal unavailability. No article subset or private diagnostic fields are added
+to failure DTOs; hosts must keep operational logs safe.
+
+The current factory always constructs this capability. Its type stays optional
+for structural legacy applications and wrappers; it is not a configurable
+factory opt-out. A missing legacy port cannot be replaced by caller-supplied
+empty comparison results.
+
## Storage and limits
All accepted head changes, immutable rows, generic Audit actions, receipts, and
diff --git a/packages/application/package.json b/packages/application/package.json
index 0c2bb56..e873592 100644
--- a/packages/application/package.json
+++ b/packages/application/package.json
@@ -1,6 +1,6 @@
{
"name": "@pegma/knowledge-base-application",
- "version": "0.1.7",
+ "version": "0.1.8",
"description": "Authorized knowledge authoring, evidence, review, and publication over Pegma storage.",
"license": "MIT",
"type": "module",
@@ -31,8 +31,8 @@
"dependencies": {
"@pegma/audit": "0.2.0",
"@pegma/authorization-core": "0.4.0",
- "@pegma/knowledge-base-contracts": "0.1.7",
- "@pegma/knowledge-base-core": "0.1.7",
+ "@pegma/knowledge-base-contracts": "0.1.8",
+ "@pegma/knowledge-base-core": "0.1.8",
"@pegma/spine": "0.1.2",
"@pegma/storage-core": "0.4.0"
},
diff --git a/packages/application/src/evidence-reports-types.ts b/packages/application/src/evidence-reports-types.ts
index 2b5c2f7..ff7306e 100644
--- a/packages/application/src/evidence-reports-types.ts
+++ b/packages/application/src/evidence-reports-types.ts
@@ -5,6 +5,7 @@ import type {
IsoTimestamp,
Logger,
PrincipalId,
+ VerificationEvidence,
} from "@pegma/knowledge-base-contracts";
import type { EvidenceSubmission } from "@pegma/knowledge-base-core";
import type { Store } from "@pegma/storage-core";
@@ -13,6 +14,7 @@ import type {
KnowledgeBaseApplication,
EvidenceDto,
EvidenceVerifier,
+ EvidenceVerificationRequest,
ValidationRequirementsDto,
} from "./types.js";
@@ -110,6 +112,41 @@ export interface KnowledgeReportKey extends KnowledgeReportArticleInput {
readonly reportId: string;
}
+declare const reportObservationBrand: unique symbol;
+/** Single-use, instance-bound read observation. Keep it inside one operation. */
+export interface KnowledgeReportObservation {
+ readonly [reportObservationBrand]: true;
+}
+
+export interface KnowledgeReportObservationRead {
+ /** Provisional private data; await confirm before using it as a current binding. */
+ readonly view: KnowledgeReportView;
+ readonly context: KnowledgeEvidenceContext;
+ readonly observation: KnowledgeReportObservation;
+}
+
+export interface KnowledgeReportObservationConfirmation {
+ readonly receipt: string;
+ /** Present only when the optional original-owner verification request succeeds. */
+ readonly attestation: VerificationEvidence["attestation"] | null;
+}
+
+/** Optional paired reads, available only with the real authoringContext pair. */
+export interface KnowledgeReportObservations {
+ observe(
+ access: AccessContext,
+ input: KnowledgeReportKey,
+ ): Promise;
+ /** Confirms exact KB resources/report/head and current actor/reviewer authority.
+ * The handle is consumed before awaited work, including a failed confirmation.
+ * An optional verification request retains the legacy verifier's owner binding. */
+ confirm(
+ access: AccessContext,
+ observation: KnowledgeReportObservation,
+ verification?: EvidenceVerificationRequest,
+ ): Promise;
+}
+
export interface SubmitKnowledgeReportInput extends KnowledgeReportArticleInput {
readonly commandId: string;
readonly ledgerEpoch: number;
@@ -171,6 +208,7 @@ export interface KnowledgeEvidenceReportsOptions {
export interface KnowledgeEvidenceReports {
readonly verifier: EvidenceVerifier;
+ readonly observations?: KnowledgeReportObservations;
query(
access: AccessContext,
input: KnowledgeReportQueryInput,
diff --git a/packages/application/src/evidence-reports.ts b/packages/application/src/evidence-reports.ts
index e50889a..22f5c18 100644
--- a/packages/application/src/evidence-reports.ts
+++ b/packages/application/src/evidence-reports.ts
@@ -16,6 +16,7 @@ import {
import { defineCollection, type EntityKey } from "@pegma/storage-core";
import type {
EvidenceVerifier,
+ EvidenceVerificationRequest,
KnowledgeAuthoringContextObservation,
} from "./types.js";
import type {
@@ -28,6 +29,10 @@ import type {
KnowledgeEvidenceReportStorageLayout,
KnowledgeEvidenceReportsOptions,
KnowledgeEvidenceReports,
+ KnowledgeReportView,
+ KnowledgeReportObservation,
+ KnowledgeReportObservationConfirmation,
+ KnowledgeReportObservations,
} from "./evidence-reports-types.js";
import {
KnowledgeEvidenceReportsError,
@@ -728,18 +733,17 @@ export function createKnowledgeEvidenceReports(
function now(): string {
return stored("clock_read", () => timestamp(options.clock.now()));
}
- async function current(
- access: AccessContext,
- permission: string,
- ): Promise {
- const caller = callerContext(access);
+ async function resolvePrincipal(id: string): Promise {
const resolved = await ledgerIo("principal_resolve", () =>
- options.resolvePrincipal(caller.principalId),
+ options.resolvePrincipal(id),
);
- const authority =
- resolved === null
- ? null
- : stored("principal_resolve", () => callerContext(resolved));
+ return resolved === null
+ ? null
+ : stored("principal_resolve", () => callerContext(resolved));
+ }
+ async function currentAuthority(access: AccessContext, permission: string) {
+ const caller = callerContext(access);
+ const authority = await resolvePrincipal(caller.principalId);
if (
authority === null ||
authority.principalId !== caller.principalId ||
@@ -750,11 +754,14 @@ export function createKnowledgeEvidenceReports(
throw new KnowledgeEvidenceReportsError("forbidden");
// A current owner/Admin context establishes continued authority; it never
// replaces the original credential's restricted effective permissions.
- return caller;
+ return { caller, authority };
}
- async function staff(access: AccessContext): Promise {
- access = await current(access, confirmationPermission);
+ async function current(access: AccessContext, permission: string) {
+ return (await currentAuthority(access, permission)).caller;
+ }
+ function staffPermissions(access: AccessContext): void {
for (const permission of [
+ confirmationPermission,
knowledgePermissions.draftRead,
knowledgePermissions.evidenceRead,
])
@@ -767,8 +774,24 @@ export function createKnowledgeEvidenceReports(
!hasPermission(access, knowledgePermissions.draftWrite)
)
throw new KnowledgeEvidenceReportsError("forbidden");
+ }
+ async function staff(access: AccessContext): Promise {
+ access = await current(access, confirmationPermission);
+ staffPermissions(access);
return access;
}
+ async function staffAuthority(access: AccessContext) {
+ const resolved = await currentAuthority(access, confirmationPermission);
+ staffPermissions(resolved.caller);
+ return resolved;
+ }
+ async function reviewerAuthority(id: string): Promise {
+ const reviewer = await resolvePrincipal(id);
+ if (reviewer === null || reviewer.principalId !== id)
+ throw new KnowledgeEvidenceReportsError("forbidden");
+ staffPermissions(reviewer);
+ return reviewer;
+ }
async function headVersion(articleId: string) {
const saved = await ledgerIo("head_read", () =>
records.getVersioned(storageKey(articleId, "head")),
@@ -1041,6 +1064,219 @@ export function createKnowledgeEvidenceReports(
Date.parse(report.confirmation.confirmedAt) <= now))
);
}
+ async function verificationIdentityMatches(
+ report: ReportRecord,
+ request: EvidenceVerificationRequest,
+ ): Promise {
+ return (
+ acknowledgement(report).receipt === request.receipt &&
+ report.status === "confirmed" &&
+ report.confirmation !== null &&
+ request.access.principalId === report.submittedBy &&
+ (await knowledgeDigest(request.submission)) === report.submissionHash &&
+ request.configuration.trustedAttesterIds.includes(
+ report.confirmation.reviewerId,
+ )
+ );
+ }
+ async function verificationContextMatches(
+ report: ReportRecord,
+ request: EvidenceVerificationRequest,
+ value: KnowledgeEvidenceContext,
+ ): Promise {
+ return (
+ (await valid(report, request.article, value, now())) &&
+ request.configuration.expectedStagingBuildId ===
+ value.requirements.expectedStagingBuildId &&
+ (await knowledgeDigest(request.configuration.validationPolicy)) ===
+ (await knowledgeDigest(value.requirements.validationPolicy))
+ );
+ }
+ function fulfilled(result: PromiseSettledResult): T {
+ if (result.status === "rejected") throw result.reason;
+ return result.value;
+ }
+ interface ReportObservationState {
+ readonly access: AccessContext;
+ readonly reviewer: AccessContext;
+ readonly head: Awaited>;
+ readonly report: Awaited>;
+ readonly context: KnowledgeEvidenceContext;
+ readonly contextObservation: KnowledgeAuthoringContextObservation;
+ }
+ const reportObservations = new WeakMap