instar 1.3.528 → 1.3.530
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.
- package/dist/commands/server.d.ts.map +1 -1
- package/dist/commands/server.js +114 -0
- package/dist/commands/server.js.map +1 -1
- package/dist/config/ConfigDefaults.d.ts.map +1 -1
- package/dist/config/ConfigDefaults.js +29 -0
- package/dist/config/ConfigDefaults.js.map +1 -1
- package/dist/core/CoherenceJournal.d.ts +1 -1
- package/dist/core/CoherenceJournal.d.ts.map +1 -1
- package/dist/core/CoherenceJournal.js +27 -2
- package/dist/core/CoherenceJournal.js.map +1 -1
- package/dist/core/EvolutionManager.d.ts +35 -0
- package/dist/core/EvolutionManager.d.ts.map +1 -1
- package/dist/core/EvolutionManager.js +49 -0
- package/dist/core/EvolutionManager.js.map +1 -1
- package/dist/core/KnowledgeReplicatedStore.d.ts +310 -0
- package/dist/core/KnowledgeReplicatedStore.d.ts.map +1 -0
- package/dist/core/KnowledgeReplicatedStore.js +526 -0
- package/dist/core/KnowledgeReplicatedStore.js.map +1 -0
- package/dist/core/LearningsReplicatedStore.d.ts +298 -0
- package/dist/core/LearningsReplicatedStore.d.ts.map +1 -0
- package/dist/core/LearningsReplicatedStore.js +574 -0
- package/dist/core/LearningsReplicatedStore.js.map +1 -0
- package/dist/core/PostUpdateMigrator.d.ts.map +1 -1
- package/dist/core/PostUpdateMigrator.js +49 -1
- package/dist/core/PostUpdateMigrator.js.map +1 -1
- package/dist/core/devGatedFeatures.d.ts.map +1 -1
- package/dist/core/devGatedFeatures.js +10 -0
- package/dist/core/devGatedFeatures.js.map +1 -1
- package/dist/knowledge/KnowledgeManager.d.ts +37 -0
- package/dist/knowledge/KnowledgeManager.d.ts.map +1 -1
- package/dist/knowledge/KnowledgeManager.js +45 -0
- package/dist/knowledge/KnowledgeManager.js.map +1 -1
- package/dist/scaffold/templates.d.ts.map +1 -1
- package/dist/scaffold/templates.js +3 -1
- package/dist/scaffold/templates.js.map +1 -1
- package/package.json +1 -1
- package/src/data/builtin-manifest.json +20 -20
- package/src/scaffold/templates.ts +3 -1
- package/upgrades/1.3.529.md +33 -0
- package/upgrades/1.3.530.md +33 -0
- package/upgrades/side-effects/ws22-learnings.md +74 -0
- package/upgrades/side-effects/ws24-knowledge.md +77 -0
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LearningsReplicatedStore — the THIRD concrete consumer of the HLC replicated-store
|
|
3
|
+
* foundation (WS2.2) and the SECOND memory-family kind (after WS2.3 relationships).
|
|
4
|
+
* It layers the `learning-record` replicated kind onto the generic substrate
|
|
5
|
+
* (ReplicatedRecordEnvelope / UnionReader / ConflictStore / RollbackUnmerge /
|
|
6
|
+
* ReplicationBudget / StoreSnapshot) so that a lesson the agent learned on machine
|
|
7
|
+
* A is known on machine B — ONE learning registry, not one-per-machine.
|
|
8
|
+
*
|
|
9
|
+
* It is the literal analog of `RelationshipsReplicatedStore.ts` (the WS2.3 PII
|
|
10
|
+
* reference consumer). A learning is a LESSON, not a person, so it is lower-PII than a
|
|
11
|
+
* relationship — but its `description`/`source` CAN reference people, content, or
|
|
12
|
+
* platforms, so it REUSES the WS2.3 PII machinery (type-clamp, disclosure-min
|
|
13
|
+
* projection, tombstones, flag-coherence) rather than reinventing or downgrading it.
|
|
14
|
+
* THIS IS PURE LOGIC. No fs, no Date directly, no network. It defines:
|
|
15
|
+
*
|
|
16
|
+
* A. The `learning-record` store schema — a STRICT typed validator that
|
|
17
|
+
* TYPE-CLAMPS every known field: `source.discoveredAt` ISO-8601-only, `applied`
|
|
18
|
+
* a boolean, `tags[]`/free text length-clamped. The schema is a DISCRIMINATED
|
|
19
|
+
* UNION on `op` — an `op:'put'` VALUE schema AND an `op:'delete'` TOMBSTONE
|
|
20
|
+
* schema coexist under the one kind, so a tombstone is never marked invalid by
|
|
21
|
+
* the value schema.
|
|
22
|
+
*
|
|
23
|
+
* B. The disclosure-minimized PROJECTION — `buildLearningRecordData` emits ONLY the
|
|
24
|
+
* enumerated merge-relevant fields, NEVER the raw on-disk blob and NEVER the
|
|
25
|
+
* local `LRN-NNN` id. `recordKey` is the cross-machine IDENTITY SURFACE, derived
|
|
26
|
+
* deterministically from the stable content (normalize(title) + normalize(category)
|
|
27
|
+
* + (source.contentId || source.discoveredAt)) — never the per-machine,
|
|
28
|
+
* sequentially-assigned `LRN-NNN` id (the cross-machine-UNSTABLE id, exactly the
|
|
29
|
+
* relationship-UUID trap WS2.3 solved with the channel-set key). The SAME lesson
|
|
30
|
+
* learned on two machines collapses to ONE record.
|
|
31
|
+
*
|
|
32
|
+
* C. The TOMBSTONE builder — `buildLearningTombstoneData` emits an `op:'delete'`
|
|
33
|
+
* record `{ recordKey, op, hlc, origin, deletedAt }` so a removal/prune propagates
|
|
34
|
+
* as a positive signal across an offline-then-rejoining peer instead of a record
|
|
35
|
+
* absence. CRITICAL: the EvolutionManager prune-over-maxLearnings path MUST emit
|
|
36
|
+
* a tombstone per pruned learning, else a peer re-replicates the locally-pruned
|
|
37
|
+
* learning forever (resurrection).
|
|
38
|
+
*
|
|
39
|
+
* D. The union-aware read — `mergeUnionToLearnings` collapses a
|
|
40
|
+
* `Map<recordKey, UnionResult>` into the merged learning view. Learnings are
|
|
41
|
+
* HIGH-impact at the REPLICATION layer (a concurrent divergent edit to the SAME
|
|
42
|
+
* recordKey goes through APPEND-BOTH-AND-FLAG — both versions surface, never a
|
|
43
|
+
* silent clobber). The CONSUMER READ path is ADVISORY: it injects BOTH variants
|
|
44
|
+
* of an open conflict as guidance — a learning is guidance, not authority — and
|
|
45
|
+
* NEVER blocks on an unresolved conflict. The read NEVER writes a foreign record
|
|
46
|
+
* into the local store (read-only union).
|
|
47
|
+
*
|
|
48
|
+
* E. Foreign-record render safety — `renderForeignLearningContext` wraps a replicated
|
|
49
|
+
* record in an explicit `<replicated-untrusted-data origin="…">` envelope and
|
|
50
|
+
* sanitizes EVERY rendered field. There is no "trusted because machine-set" render
|
|
51
|
+
* slot for a foreign record.
|
|
52
|
+
*
|
|
53
|
+
* DECIDED FORKS (Echo, 2026-06-13 — recorded verbatim in the PR ELI16):
|
|
54
|
+
* 1. recordKey = a content fingerprint, NEVER the local `LRN-NNN` id (cross-machine
|
|
55
|
+
* identity surface — see deriveLearningRecordKey).
|
|
56
|
+
* 2. Impact tier = HIGH at the REPLICATION layer (append-both-and-flag), ADVISORY at
|
|
57
|
+
* the READ layer (both variants injected as hints, never blocking) — see
|
|
58
|
+
* mergeUnionToLearnings + LEARNING_IMPACT_TIER.
|
|
59
|
+
* 3. `applied`/`appliedTo` are LOCAL-merge fields, replicated but last-writer-witness
|
|
60
|
+
* wins; a concurrent applied-vs-unapplied divergence rides the SAME append-both-
|
|
61
|
+
* and-flag path (NOT a special CRDT merge) — the single conflict path.
|
|
62
|
+
*
|
|
63
|
+
* SAFETY POSTURE: MECHANISM, dark by default. Nothing here blocks a user-initiated
|
|
64
|
+
* action. The local `LRN-NNN` id is NEVER part of the replicated schema and is stripped
|
|
65
|
+
* from every emitted projection (disclosure minimization).
|
|
66
|
+
*/
|
|
67
|
+
import type { LearningEntry, LearningSource } from './types.js';
|
|
68
|
+
import type { StoreFieldSchema, ReplicatedEnvelope } from './ReplicatedRecordEnvelope.js';
|
|
69
|
+
import type { ImpactTier, OriginRecord, UnionResult } from './UnionReader.js';
|
|
70
|
+
import type { ReplicatedKindBounds } from './ReplicationBudget.js';
|
|
71
|
+
import type { HlcTimestamp } from './HybridLogicalClock.js';
|
|
72
|
+
/** The stateSync config sub-key + advert suffix for this store (e.g.
|
|
73
|
+
* `multiMachine.stateSync.learnings.enabled`). Equal to the advert flag key
|
|
74
|
+
* `stateSyncReceive['learnings']`. */
|
|
75
|
+
export declare const LEARNING_STORE_KEY = "learnings";
|
|
76
|
+
/** The JournalKind string this store rides — the DUAL-REGISTRY's dynamic half.
|
|
77
|
+
* MUST also be present in CoherenceJournal.JOURNAL_KINDS (the static half), or the
|
|
78
|
+
* store advertises receive=true yet serves/applies/pulls nothing. */
|
|
79
|
+
export declare const LEARNING_RECORD_KIND = "learning-record";
|
|
80
|
+
/**
|
|
81
|
+
* Learnings are HIGH-impact at the REPLICATION layer (fork #2): a concurrent
|
|
82
|
+
* divergent VALUE edit to the SAME recordKey from different origins goes through
|
|
83
|
+
* APPEND-BOTH-AND-FLAG — both versions preserved, ONE deduped conflict, never a
|
|
84
|
+
* silent overwrite. The READ path (mergeUnionToLearnings) is ADVISORY — both variants
|
|
85
|
+
* surface as guidance hints, the read never blocks on an open conflict — a learning is
|
|
86
|
+
* guidance, not authority. Operator resolution via POST /state/resolve-conflict is
|
|
87
|
+
* OPTIONAL cleanup that collapses the flag, never a gate on the hint.
|
|
88
|
+
*/
|
|
89
|
+
export declare const LEARNING_IMPACT_TIER: ImpactTier;
|
|
90
|
+
/** A learning `description` can be long (a full lesson write-up). Clamp on receive. */
|
|
91
|
+
export declare const MAX_DESCRIPTION_LENGTH = 20000;
|
|
92
|
+
/** Per-free-text-string clamp for title / category / evolutionRelevance / appliedTo /
|
|
93
|
+
* each tag / each source sub-field. */
|
|
94
|
+
export declare const MAX_FREETEXT_LENGTH = 2000;
|
|
95
|
+
/** A category is a short slug. */
|
|
96
|
+
export declare const MAX_CATEGORY_LENGTH = 128;
|
|
97
|
+
/** Tags cap (mirrors a reasonable per-learning tag count). */
|
|
98
|
+
export declare const MAX_TAGS = 50;
|
|
99
|
+
/**
|
|
100
|
+
* Per-kind replication bounds. The learnings store is FEW + bounded (the
|
|
101
|
+
* EvolutionManager prunes to maxLearnings=500), so the per-store retention mirrors the
|
|
102
|
+
* pref-record store (a small window with a few archives). NEVER `rotateKeep: 0`
|
|
103
|
+
* (rotate-but-never-delete would be a compliance defect for any memory-family kind).
|
|
104
|
+
* The rate cap COALESCES (latest state per recordKey per interval) so a churny
|
|
105
|
+
* apply/markApplied loop does not flood the stream.
|
|
106
|
+
*/
|
|
107
|
+
export declare const LEARNING_RECORD_BOUNDS: ReplicatedKindBounds;
|
|
108
|
+
/**
|
|
109
|
+
* Per-entry size cap RAISED to 64KB for this kind. The default
|
|
110
|
+
* APPLIER_MAX_ENTRY_BYTES = 8KB is SMALLER than a fat learning (a 20K description
|
|
111
|
+
* alone exceeds it), so under it the longest learnings would never replicate AND
|
|
112
|
+
* would wedge the stream. 64KB is provably above the disclosure-minimized
|
|
113
|
+
* projection's maximum: description(20k) + 50 tags×2k(100k) is the dominant term, but
|
|
114
|
+
* tags are SHORT slugs in practice and EACH free-text is clamped to 2k — we
|
|
115
|
+
* additionally enforce a HARD post-projection ceiling: a record that STILL exceeds
|
|
116
|
+
* 64KB after projection is REJECTED with a named error (never silent-truncate, never
|
|
117
|
+
* suspect-wedge). See assertProjectionUnderCap.
|
|
118
|
+
*/
|
|
119
|
+
export declare const LEARNING_MAX_ENTRY_BYTES: number;
|
|
120
|
+
/**
|
|
121
|
+
* The store-specific field names the `learning-record` VALUE schema OWNS (the
|
|
122
|
+
* unknown-field counter's allowlist). The local `LRN-NNN` id is DELIBERATELY ABSENT
|
|
123
|
+
* — it is per-machine + sequential and never replicated (the recordKey keys on the
|
|
124
|
+
* content fingerprint, not the id). `recordKey`/`hlc`/`op`/`origin`/`observed` are
|
|
125
|
+
* reserved envelope fields, never store fields.
|
|
126
|
+
*/
|
|
127
|
+
export declare const LEARNING_STORE_KNOWN_FIELDS: ReadonlyArray<string>;
|
|
128
|
+
/** The tombstone's store-owned fields beyond the reserved envelope set. `deletedAt`
|
|
129
|
+
* is the only store field a delete carries. */
|
|
130
|
+
export declare const LEARNING_TOMBSTONE_KNOWN_FIELDS: ReadonlyArray<string>;
|
|
131
|
+
/** Is `v` a valid ISO-8601 date string (and ONLY a date — no smuggled markup)? A
|
|
132
|
+
* string Date.parse rejects, or that contains an injection char (`<`, `>`, `"`), is
|
|
133
|
+
* not a clean ISO date. */
|
|
134
|
+
export declare function isIso8601(v: unknown): v is string;
|
|
135
|
+
/**
|
|
136
|
+
* The `learning-record` store schema — a DISCRIMINATED UNION on `op`. Strict typed
|
|
137
|
+
* validation on top of the envelope: reject free text beyond the known fields,
|
|
138
|
+
* TYPE-CLAMP every known field (discoveredAt ISO-8601, applied boolean, tags string[],
|
|
139
|
+
* description/free text length-clamped) so markup cannot smuggle through a render slot
|
|
140
|
+
* that bypasses sanitize(). Returns the validated store-specific object (known fields
|
|
141
|
+
* only), or null to reject the WHOLE record. PURE (no I/O, no mutation of `raw`).
|
|
142
|
+
*
|
|
143
|
+
* The envelope validator has ALREADY validated `op` ∈ {put,delete} before calling this.
|
|
144
|
+
* We branch on it so a tombstone `{recordKey, op:'delete', hlc, origin, deletedAt}`
|
|
145
|
+
* passes (only `deletedAt` is a legal store field for a delete) WITHOUT being marked
|
|
146
|
+
* invalid by the rich VALUE schema.
|
|
147
|
+
*/
|
|
148
|
+
export declare const learningRecordStoreSchema: StoreFieldSchema;
|
|
149
|
+
/** Normalize a string for the content fingerprint: trim + lowercase + collapse
|
|
150
|
+
* internal whitespace, so trivial formatting differences across machines do not
|
|
151
|
+
* split the same lesson into two records. */
|
|
152
|
+
export declare function normalizeForKey(v: string): string;
|
|
153
|
+
/**
|
|
154
|
+
* Derive the cross-machine-stable recordKey for a learning (fork #1). A lesson is "the
|
|
155
|
+
* same" across machines by its CONTENT, NOT by the per-machine, sequentially-assigned
|
|
156
|
+
* `LRN-NNN` id — VM-A and VM-B mint different LRN ids for the same lesson, so an
|
|
157
|
+
* id-keyed record could never collide them (exactly the relationship-UUID trap WS2.3
|
|
158
|
+
* solved with the channel-set key).
|
|
159
|
+
*
|
|
160
|
+
* The key is a deterministic, collision-resistant hash:
|
|
161
|
+
* sha256(normalize(title) + '\x1f' + normalize(category) + '\x1f' + (source.contentId || source.discoveredAt))
|
|
162
|
+
* hex-truncated to 32 chars (the same shape UnionReader.conflictId uses). The `\x1f`
|
|
163
|
+
* (unit separator) is an un-typeable delimiter so two lessons cannot collide by
|
|
164
|
+
* straddling the field boundary (e.g. title "a" + category "b" vs title "a b").
|
|
165
|
+
*
|
|
166
|
+
* `source.contentId` (a post/thread id) is the stronger disambiguator when present —
|
|
167
|
+
* two distinct lessons from different content never collide even with the same
|
|
168
|
+
* title+category; when ABSENT we fall back to `source.discoveredAt`. Returns null when
|
|
169
|
+
* title OR category is empty (a degenerate record with no stable identity surface — the
|
|
170
|
+
* caller skips emission; it can never collide a stranger by an empty key).
|
|
171
|
+
*
|
|
172
|
+
* COLLISION SAFETY: two DIFFERENT lessons share a key ONLY if they share the EXACT same
|
|
173
|
+
* normalized title AND category AND (contentId || discoveredAt) — which IS the
|
|
174
|
+
* definition of "the same lesson". SPLIT-IDENTITY SAFETY: the same lesson derives the
|
|
175
|
+
* SAME key on both machines IFF both hold the same title/category/content anchor; the
|
|
176
|
+
* normalization absorbs trivial formatting drift.
|
|
177
|
+
*/
|
|
178
|
+
export declare function deriveLearningRecordKey(title: string, category: string, source: LearningSource): string | null;
|
|
179
|
+
/** The `data` object a `learning-record` journal entry carries. */
|
|
180
|
+
export type LearningRecordData = Record<string, unknown>;
|
|
181
|
+
/** Input to buildLearningRecordData: the record to emit, the freshly-ticked hlc, this
|
|
182
|
+
* machine's origin id, and the observed-witness (the hlc already merged for THIS
|
|
183
|
+
* recordKey before writing, or absent). */
|
|
184
|
+
export interface BuildLearningRecordInput {
|
|
185
|
+
record: LearningEntry;
|
|
186
|
+
hlc: HlcTimestamp;
|
|
187
|
+
origin: string;
|
|
188
|
+
observed?: HlcTimestamp;
|
|
189
|
+
}
|
|
190
|
+
/** The named error a record-over-cap surfaces: not silent-truncate, not suspect-wedge. */
|
|
191
|
+
export declare class LearningRecordTooLargeError extends Error {
|
|
192
|
+
readonly recordKey: string;
|
|
193
|
+
readonly bytes: number;
|
|
194
|
+
constructor(recordKey: string, bytes: number);
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Build the disclosure-minimized `learning-record` envelope `data` for an `op:'put'`.
|
|
198
|
+
* Emits ONLY the enumerated projection — NEVER the raw on-disk blob, NEVER the local
|
|
199
|
+
* `LRN-NNN` id. recordKey = the derived content-fingerprint identity surface (fork #1).
|
|
200
|
+
*
|
|
201
|
+
* Returns null when the record has no stable identity surface (empty title/category ⇒
|
|
202
|
+
* deriveLearningRecordKey null — the caller skips emission). Throws
|
|
203
|
+
* LearningRecordTooLargeError when the projection STILL exceeds the 64KB per-entry cap
|
|
204
|
+
* (a NAMED, surfaced rejection — never silent-truncate).
|
|
205
|
+
*/
|
|
206
|
+
export declare function buildLearningRecordData(input: BuildLearningRecordInput): LearningRecordData | null;
|
|
207
|
+
/** Throw LearningRecordTooLargeError if the projected data serializes over the
|
|
208
|
+
* per-entry cap. The cap is set so a legal disclosure-minimized record can never reach
|
|
209
|
+
* it; this is the belt-and-suspenders named rejection. */
|
|
210
|
+
export declare function assertProjectionUnderCap(recordKey: string, data: LearningRecordData): void;
|
|
211
|
+
/** Input to buildLearningTombstoneData: the title/category/source of the deleted
|
|
212
|
+
* learning (to derive the recordKey identity surface), the freshly-ticked hlc, the
|
|
213
|
+
* origin, and the deletedAt timestamp. */
|
|
214
|
+
export interface BuildLearningTombstoneInput {
|
|
215
|
+
title: string;
|
|
216
|
+
category: string;
|
|
217
|
+
source: LearningSource;
|
|
218
|
+
hlc: HlcTimestamp;
|
|
219
|
+
origin: string;
|
|
220
|
+
deletedAt: string;
|
|
221
|
+
observed?: HlcTimestamp;
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Build an `op:'delete'` TOMBSTONE `data` for a learning removal/prune. recordKey = the
|
|
225
|
+
* SAME content-fingerprint identity surface the value records key on, so the tombstone
|
|
226
|
+
* reaches the same lesson's record on every machine even though the local LRN ids
|
|
227
|
+
* differ. Returns null when title/category are empty (no identity surface to tombstone).
|
|
228
|
+
*
|
|
229
|
+
* CRITICAL (fork-adjacent): the EvolutionManager prune-over-maxLearnings path MUST call
|
|
230
|
+
* this for each pruned learning, else a peer re-replicates the locally-pruned learning
|
|
231
|
+
* forever (resurrection). The delete-resurrection guard lives in the merge (a later
|
|
232
|
+
* `delete` hlc wins over an earlier `put`).
|
|
233
|
+
*/
|
|
234
|
+
export declare function buildLearningTombstoneData(input: BuildLearningTombstoneInput): LearningRecordData | null;
|
|
235
|
+
/** A merged learning view entry: the projected record fields PLUS its origin machine
|
|
236
|
+
* id (so a foreign record is rendered inside the untrusted-data envelope). READ-ONLY —
|
|
237
|
+
* NEVER written back into the local store. */
|
|
238
|
+
export interface MergedLearningView {
|
|
239
|
+
recordKey: string;
|
|
240
|
+
origin: string;
|
|
241
|
+
/** The validated, type-clamped projection fields (the receive-side schema already
|
|
242
|
+
* ran on apply; here `data` is that validated portion). */
|
|
243
|
+
data: Record<string, unknown>;
|
|
244
|
+
/** True when this view entry is one of ≥2 concurrent variants of an OPEN conflict
|
|
245
|
+
* (append-both — both surface as advisory hints; the read NEVER suppresses a usable
|
|
246
|
+
* view AND NEVER blocks on the unresolved conflict). */
|
|
247
|
+
conflicted: boolean;
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Collapse a `Map<recordKey, UnionResult>` into the merged learning view.
|
|
251
|
+
* HIGH-impact-at-replication / ADVISORY-at-read contract (fork #2):
|
|
252
|
+
* - A resolved single value ⇒ that one view entry.
|
|
253
|
+
* - An OPEN concurrent conflict ⇒ BOTH (all) `put` variants as separate entries
|
|
254
|
+
* (append-both — both surface as ADVISORY guidance; the read NEVER suppresses a
|
|
255
|
+
* usable view AND NEVER BLOCKS waiting on operator resolution — a learning is
|
|
256
|
+
* guidance, not authority). A `delete` variant contributes nothing to display.
|
|
257
|
+
* - A delete-resolved key (every origin's latest is a tombstone) ⇒ nothing (the
|
|
258
|
+
* delete-resurrection guard: a later delete wins over an earlier put).
|
|
259
|
+
* The read is READ-ONLY: a replicated record NEVER clobbers a divergent local record —
|
|
260
|
+
* the local store files are never written here.
|
|
261
|
+
*/
|
|
262
|
+
export declare function mergeUnionToLearnings(union: Map<string, UnionResult>): MergedLearningView[];
|
|
263
|
+
/**
|
|
264
|
+
* Render a FOREIGN (replicated) learning record into a session-context block, wrapped
|
|
265
|
+
* in an explicit `<replicated-untrusted-data origin="…">` envelope so the session model
|
|
266
|
+
* treats it as a PEER'S learning to re-ground against, never a directive. EVERY rendered
|
|
267
|
+
* field is escaped — there is no "trusted because machine-set" slot. A null `data.title`
|
|
268
|
+
* (a malformed view) yields null.
|
|
269
|
+
*/
|
|
270
|
+
export declare function renderForeignLearningContext(view: MergedLearningView): string | null;
|
|
271
|
+
/**
|
|
272
|
+
* Build an OriginRecord for the OWN learning store (the single-origin materialization
|
|
273
|
+
* the union reader merges against peer replicas). recordKey = derived content-
|
|
274
|
+
* fingerprint identity surface; the envelope carries a SYNTHETIC own-origin HLC stamp
|
|
275
|
+
* derived deterministically from the source.discoveredAt (physical) so the own record
|
|
276
|
+
* has a well-formed, stable position relative to peer records. Returns null for a
|
|
277
|
+
* degenerate record (no identity surface). The local `LRN-NNN` id is NEVER carried into
|
|
278
|
+
* the replicated namespace.
|
|
279
|
+
*/
|
|
280
|
+
export declare function learningToOriginRecord(record: LearningEntry, origin: string): OriginRecord | null;
|
|
281
|
+
/** The ReplicatedKindRegistry registration for the `learning-record` store. server.ts
|
|
282
|
+
* registers this onto the shared registry; the dual-registry coupling test asserts
|
|
283
|
+
* `kind` is also present in JOURNAL_KINDS. */
|
|
284
|
+
export declare const LEARNING_KIND_REGISTRATION: {
|
|
285
|
+
readonly kind: "learning-record";
|
|
286
|
+
readonly store: "learnings";
|
|
287
|
+
readonly schema: StoreFieldSchema;
|
|
288
|
+
};
|
|
289
|
+
/** Convenience: the store's contributing journal kinds (for rollback-unmerge's
|
|
290
|
+
* kindsForStore('learnings') wiring). */
|
|
291
|
+
export declare function learningContributingKinds(): string[];
|
|
292
|
+
/** The store's impact tier resolver, for ReplicatedStoreReader.tierOf. Returns HIGH for
|
|
293
|
+
* the `learnings` store (and HIGH for any unknown store — the conservative
|
|
294
|
+
* append-both-and-flag direction, never a silent clobber). */
|
|
295
|
+
export declare function learningTierOf(_store: string): ImpactTier;
|
|
296
|
+
/** Re-export the envelope type for callers building/applying learning-record envelopes. */
|
|
297
|
+
export type { ReplicatedEnvelope };
|
|
298
|
+
//# sourceMappingURL=LearningsReplicatedStore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LearningsReplicatedStore.d.ts","sourceRoot":"","sources":["../../src/core/LearningsReplicatedStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiEG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAChE,OAAO,KAAK,EACV,gBAAgB,EAEhB,kBAAkB,EAEnB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC9E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAM5D;;uCAEuC;AACvC,eAAO,MAAM,kBAAkB,cAAc,CAAC;AAE9C;;sEAEsE;AACtE,eAAO,MAAM,oBAAoB,oBAAoB,CAAC;AAEtD;;;;;;;;GAQG;AACH,eAAO,MAAM,oBAAoB,EAAE,UAAmB,CAAC;AAKvD,uFAAuF;AACvF,eAAO,MAAM,sBAAsB,QAAS,CAAC;AAC7C;wCACwC;AACxC,eAAO,MAAM,mBAAmB,OAAQ,CAAC;AACzC,kCAAkC;AAClC,eAAO,MAAM,mBAAmB,MAAM,CAAC;AACvC,8DAA8D;AAC9D,eAAO,MAAM,QAAQ,KAAK,CAAC;AAE3B;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,EAAE,oBAIpC,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,wBAAwB,QAAY,CAAC;AAElD;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B,EAAE,aAAa,CA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