@fgv/ts-agent-memory 5.1.0-49 → 5.1.0-50
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/packlets/index/memoryIndex.js +23 -16
- package/dist/packlets/index/memoryIndex.js.map +1 -1
- package/dist/packlets/ingest/orchestrator.js +13 -1
- package/dist/packlets/ingest/orchestrator.js.map +1 -1
- package/dist/packlets/retrieve/linkTraversalRetriever.js +12 -26
- package/dist/packlets/retrieve/linkTraversalRetriever.js.map +1 -1
- package/dist/packlets/retrieve/recencyRetriever.js +7 -7
- package/dist/packlets/retrieve/recencyRetriever.js.map +1 -1
- package/dist/packlets/retrieve/retriever.js +91 -10
- package/dist/packlets/retrieve/retriever.js.map +1 -1
- package/dist/packlets/retrieve/semanticRetriever.js +16 -16
- package/dist/packlets/retrieve/semanticRetriever.js.map +1 -1
- package/dist/packlets/retrieve/structuredFilterRetriever.js +7 -7
- package/dist/packlets/retrieve/structuredFilterRetriever.js.map +1 -1
- package/dist/packlets/retrieve/tagRetriever.js +7 -7
- package/dist/packlets/retrieve/tagRetriever.js.map +1 -1
- package/dist/packlets/retrieve/temporalRetrievers.js +23 -20
- package/dist/packlets/retrieve/temporalRetrievers.js.map +1 -1
- package/dist/packlets/store/coverage.js +6 -0
- package/dist/packlets/store/coverage.js.map +1 -0
- package/dist/packlets/store/fileTreeMemoryStore.js +221 -79
- package/dist/packlets/store/fileTreeMemoryStore.js.map +1 -1
- package/dist/packlets/store/index.js +4 -0
- package/dist/packlets/store/index.js.map +1 -1
- package/dist/packlets/store/listSelection.js +36 -0
- package/dist/packlets/store/listSelection.js.map +1 -0
- package/dist/packlets/store/memoryStore.js +6 -0
- package/dist/packlets/store/memoryStore.js.map +1 -0
- package/dist/packlets/store/reconcile.js +6 -0
- package/dist/packlets/store/reconcile.js.map +1 -0
- package/dist/packlets/store/storeCoverage.js +102 -0
- package/dist/packlets/store/storeCoverage.js.map +1 -0
- package/dist/packlets/store/storeReconcile.js +122 -0
- package/dist/packlets/store/storeReconcile.js.map +1 -0
- package/dist/packlets/store/vectorMaintenance.js +116 -8
- package/dist/packlets/store/vectorMaintenance.js.map +1 -1
- package/dist/packlets/store/vectorRecordSource.js +44 -0
- package/dist/packlets/store/vectorRecordSource.js.map +1 -0
- package/dist/packlets/tools/memoryTools.js +25 -2
- package/dist/packlets/tools/memoryTools.js.map +1 -1
- package/dist/packlets/types/envelope.js +25 -0
- package/dist/packlets/types/envelope.js.map +1 -1
- package/dist/packlets/types/index.js +1 -0
- package/dist/packlets/types/index.js.map +1 -1
- package/dist/packlets/types/recordResolver.js +6 -0
- package/dist/packlets/types/recordResolver.js.map +1 -0
- package/dist/packlets/types/temporal.js.map +1 -1
- package/dist/packlets/vector/inMemoryCosineIndex.js +39 -18
- package/dist/packlets/vector/inMemoryCosineIndex.js.map +1 -1
- package/dist/packlets/vector/inMemoryFragmentCosineIndex.js +67 -12
- package/dist/packlets/vector/inMemoryFragmentCosineIndex.js.map +1 -1
- package/dist/packlets/vector/rebuildHelpers.js +38 -0
- package/dist/packlets/vector/rebuildHelpers.js.map +1 -0
- package/dist/packlets/vector/vectorIndex.js.map +1 -1
- package/dist/ts-agent-memory.d.ts +1035 -106
- package/lib/packlets/index/memoryIndex.d.ts +118 -27
- package/lib/packlets/index/memoryIndex.d.ts.map +1 -1
- package/lib/packlets/index/memoryIndex.js +23 -16
- package/lib/packlets/index/memoryIndex.js.map +1 -1
- package/lib/packlets/ingest/orchestrator.d.ts.map +1 -1
- package/lib/packlets/ingest/orchestrator.js +13 -1
- package/lib/packlets/ingest/orchestrator.js.map +1 -1
- package/lib/packlets/retrieve/linkTraversalRetriever.d.ts +3 -10
- package/lib/packlets/retrieve/linkTraversalRetriever.d.ts.map +1 -1
- package/lib/packlets/retrieve/linkTraversalRetriever.js +11 -25
- package/lib/packlets/retrieve/linkTraversalRetriever.js.map +1 -1
- package/lib/packlets/retrieve/recencyRetriever.d.ts +3 -3
- package/lib/packlets/retrieve/recencyRetriever.d.ts.map +1 -1
- package/lib/packlets/retrieve/recencyRetriever.js +6 -6
- package/lib/packlets/retrieve/recencyRetriever.js.map +1 -1
- package/lib/packlets/retrieve/retriever.d.ts +88 -7
- package/lib/packlets/retrieve/retriever.d.ts.map +1 -1
- package/lib/packlets/retrieve/retriever.js +94 -9
- package/lib/packlets/retrieve/retriever.js.map +1 -1
- package/lib/packlets/retrieve/semanticRetriever.d.ts +3 -5
- package/lib/packlets/retrieve/semanticRetriever.d.ts.map +1 -1
- package/lib/packlets/retrieve/semanticRetriever.js +15 -15
- package/lib/packlets/retrieve/semanticRetriever.js.map +1 -1
- package/lib/packlets/retrieve/structuredFilterRetriever.d.ts +3 -3
- package/lib/packlets/retrieve/structuredFilterRetriever.d.ts.map +1 -1
- package/lib/packlets/retrieve/structuredFilterRetriever.js +6 -6
- package/lib/packlets/retrieve/structuredFilterRetriever.js.map +1 -1
- package/lib/packlets/retrieve/tagRetriever.d.ts +3 -3
- package/lib/packlets/retrieve/tagRetriever.d.ts.map +1 -1
- package/lib/packlets/retrieve/tagRetriever.js +6 -6
- package/lib/packlets/retrieve/tagRetriever.js.map +1 -1
- package/lib/packlets/retrieve/temporalRetrievers.d.ts +7 -5
- package/lib/packlets/retrieve/temporalRetrievers.d.ts.map +1 -1
- package/lib/packlets/retrieve/temporalRetrievers.js +22 -19
- package/lib/packlets/retrieve/temporalRetrievers.js.map +1 -1
- package/lib/packlets/store/coverage.d.ts +102 -0
- package/lib/packlets/store/coverage.d.ts.map +1 -0
- package/lib/packlets/store/coverage.js +7 -0
- package/lib/packlets/store/coverage.js.map +1 -0
- package/lib/packlets/store/fileTreeMemoryStore.d.ts +53 -166
- package/lib/packlets/store/fileTreeMemoryStore.d.ts.map +1 -1
- package/lib/packlets/store/fileTreeMemoryStore.js +221 -79
- package/lib/packlets/store/fileTreeMemoryStore.js.map +1 -1
- package/lib/packlets/store/index.d.ts +4 -0
- package/lib/packlets/store/index.d.ts.map +1 -1
- package/lib/packlets/store/index.js +4 -0
- package/lib/packlets/store/index.js.map +1 -1
- package/lib/packlets/store/listSelection.d.ts +101 -0
- package/lib/packlets/store/listSelection.d.ts.map +1 -0
- package/lib/packlets/store/listSelection.js +40 -0
- package/lib/packlets/store/listSelection.js.map +1 -0
- package/lib/packlets/store/memoryStore.d.ts +237 -0
- package/lib/packlets/store/memoryStore.d.ts.map +1 -0
- package/lib/packlets/store/memoryStore.js +7 -0
- package/lib/packlets/store/memoryStore.js.map +1 -0
- package/lib/packlets/store/reconcile.d.ts +82 -0
- package/lib/packlets/store/reconcile.d.ts.map +1 -0
- package/lib/packlets/store/reconcile.js +7 -0
- package/lib/packlets/store/reconcile.js.map +1 -0
- package/lib/packlets/store/storeCoverage.d.ts +45 -0
- package/lib/packlets/store/storeCoverage.d.ts.map +1 -0
- package/lib/packlets/store/storeCoverage.js +105 -0
- package/lib/packlets/store/storeCoverage.js.map +1 -0
- package/lib/packlets/store/storeReconcile.d.ts +41 -0
- package/lib/packlets/store/storeReconcile.d.ts.map +1 -0
- package/lib/packlets/store/storeReconcile.js +125 -0
- package/lib/packlets/store/storeReconcile.js.map +1 -0
- package/lib/packlets/store/vectorMaintenance.d.ts +74 -0
- package/lib/packlets/store/vectorMaintenance.d.ts.map +1 -1
- package/lib/packlets/store/vectorMaintenance.js +117 -8
- package/lib/packlets/store/vectorMaintenance.js.map +1 -1
- package/lib/packlets/store/vectorRecordSource.d.ts +36 -0
- package/lib/packlets/store/vectorRecordSource.d.ts.map +1 -0
- package/lib/packlets/store/vectorRecordSource.js +47 -0
- package/lib/packlets/store/vectorRecordSource.js.map +1 -0
- package/lib/packlets/tools/memoryTools.d.ts.map +1 -1
- package/lib/packlets/tools/memoryTools.js +25 -2
- package/lib/packlets/tools/memoryTools.js.map +1 -1
- package/lib/packlets/types/envelope.d.ts +24 -2
- package/lib/packlets/types/envelope.d.ts.map +1 -1
- package/lib/packlets/types/envelope.js +26 -0
- package/lib/packlets/types/envelope.js.map +1 -1
- package/lib/packlets/types/index.d.ts +1 -0
- package/lib/packlets/types/index.d.ts.map +1 -1
- package/lib/packlets/types/index.js +1 -0
- package/lib/packlets/types/index.js.map +1 -1
- package/lib/packlets/types/recordResolver.d.ts +39 -0
- package/lib/packlets/types/recordResolver.d.ts.map +1 -0
- package/lib/packlets/types/recordResolver.js +7 -0
- package/lib/packlets/types/recordResolver.js.map +1 -0
- package/lib/packlets/types/temporal.d.ts +26 -6
- package/lib/packlets/types/temporal.d.ts.map +1 -1
- package/lib/packlets/types/temporal.js.map +1 -1
- package/lib/packlets/vector/inMemoryCosineIndex.d.ts +9 -2
- package/lib/packlets/vector/inMemoryCosineIndex.d.ts.map +1 -1
- package/lib/packlets/vector/inMemoryCosineIndex.js +40 -19
- package/lib/packlets/vector/inMemoryCosineIndex.js.map +1 -1
- package/lib/packlets/vector/inMemoryFragmentCosineIndex.d.ts +6 -3
- package/lib/packlets/vector/inMemoryFragmentCosineIndex.d.ts.map +1 -1
- package/lib/packlets/vector/inMemoryFragmentCosineIndex.js +66 -11
- package/lib/packlets/vector/inMemoryFragmentCosineIndex.js.map +1 -1
- package/lib/packlets/vector/rebuildHelpers.d.ts +30 -0
- package/lib/packlets/vector/rebuildHelpers.d.ts.map +1 -0
- package/lib/packlets/vector/rebuildHelpers.js +42 -0
- package/lib/packlets/vector/rebuildHelpers.js.map +1 -0
- package/lib/packlets/vector/vectorIndex.d.ts +270 -15
- package/lib/packlets/vector/vectorIndex.d.ts.map +1 -1
- package/lib/packlets/vector/vectorIndex.js.map +1 -1
- package/package.json +7 -7
|
@@ -1,28 +1,14 @@
|
|
|
1
1
|
import { Logging, Result } from '@fgv/ts-utils';
|
|
2
2
|
import { FileTree } from '@fgv/ts-json-base';
|
|
3
|
-
import { DedupScope, EntityId, IIdentityCodec, IMemoryRecord, IWritePolicy, Kind, MemoryId, MemoryScopeKey, RankProjector
|
|
3
|
+
import { DedupScope, EntityId, IIdentityCodec, IMemoryRecord, IWritePolicy, Kind, MemoryId, MemoryScopeKey, RankProjector } from '../types';
|
|
4
4
|
import { IBodyConverterRegistry as IRegistry } from '../converters';
|
|
5
|
-
import {
|
|
5
|
+
import { IDerivedStateCoverage } from './coverage';
|
|
6
|
+
import { DerivedArtifact, ReconcileReport } from './reconcile';
|
|
7
|
+
import { IIndexedMemoryEntry, IMemoryIndex } from '../index';
|
|
6
8
|
import { IMemoryObserver } from '../observe';
|
|
7
9
|
import { FragmentEmbedder, IFragmentVectorIndex, IMemoryRecordSource, IScopedMemoryRecord, IVectorIndex, MemoryEmbedder } from '../vector';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
* @public
|
|
11
|
-
*/
|
|
12
|
-
export interface IMemoryStoreListFilter {
|
|
13
|
-
/** Restrict to records in this scope. */
|
|
14
|
-
readonly scope?: MemoryScopeKey;
|
|
15
|
-
/** Restrict to records of this kind. */
|
|
16
|
-
readonly kind?: Kind;
|
|
17
|
-
/** Restrict to records carrying this tag (exact match). */
|
|
18
|
-
readonly tag?: Tag;
|
|
19
|
-
/**
|
|
20
|
-
* For temporal (versioned) kinds: collapse each entity to the single version
|
|
21
|
-
* valid at this epoch ms. Non-temporal records are timeless and pass through
|
|
22
|
-
* unchanged. Absent = no temporal projection (every version is returned).
|
|
23
|
-
*/
|
|
24
|
-
readonly asOf?: number;
|
|
25
|
-
}
|
|
10
|
+
import { IMemoryStore } from './memoryStore';
|
|
11
|
+
import { MemoryListSelection } from './listSelection';
|
|
26
12
|
/**
|
|
27
13
|
* Policy for how {@link FileTreeMemoryStore.create}'s initial vault walk reacts
|
|
28
14
|
* to a record that fails to parse or validate.
|
|
@@ -54,147 +40,6 @@ export interface ISkippedRecord {
|
|
|
54
40
|
/** The parse/validation failure message (includes the record path). */
|
|
55
41
|
readonly error: string;
|
|
56
42
|
}
|
|
57
|
-
/**
|
|
58
|
-
* The writable, FileTree-backed, content-hash-deduped memory store.
|
|
59
|
-
* @public
|
|
60
|
-
*/
|
|
61
|
-
export interface IMemoryStore {
|
|
62
|
-
/**
|
|
63
|
-
* Keyed read by entity id. Resolves `entityId` to a storage address via the
|
|
64
|
-
* registered {@link IIdentityCodec} for `kind`. Returns `undefined` when no
|
|
65
|
-
* record exists. For a versioned (temporal) kind this returns the current
|
|
66
|
-
* version, resolved from the derived in-memory index (not re-read/re-verified
|
|
67
|
-
* from disk per call — the index is kept in sync with every write).
|
|
68
|
-
*/
|
|
69
|
-
get(kind: Kind, entityId: EntityId): Promise<Result<IMemoryRecord<unknown> | undefined>>;
|
|
70
|
-
/**
|
|
71
|
-
* Direct read by `(scope, MemoryId)`. Returns `undefined` when not found.
|
|
72
|
-
*/
|
|
73
|
-
getById(scope: MemoryScopeKey, id: MemoryId): Promise<Result<IMemoryRecord<unknown> | undefined>>;
|
|
74
|
-
/**
|
|
75
|
-
* List records, filtered in-memory over the derived index.
|
|
76
|
-
*/
|
|
77
|
-
list(filter?: IMemoryStoreListFilter): Promise<Result<ReadonlyArray<IMemoryRecord<unknown>>>>;
|
|
78
|
-
/**
|
|
79
|
-
* List EVERY record in the vault, each paired with its scope-qualified
|
|
80
|
-
* `(scope, id)` address — the projection {@link IMemoryRecordSource} requires.
|
|
81
|
-
* Unlike {@link IMemoryStore.list | list}, it takes no filter (whole-vault) and
|
|
82
|
-
* returns {@link IScopedMemoryRecord}s so a re-index keys each entry on the same
|
|
83
|
-
* scoped target the incremental embed-on-write path uses. Two records that share
|
|
84
|
-
* a filename stem across scopes appear as distinct entries.
|
|
85
|
-
*/
|
|
86
|
-
listScoped(): Promise<Result<ReadonlyArray<IScopedMemoryRecord>>>;
|
|
87
|
-
/**
|
|
88
|
-
* Adapt this store to the {@link IMemoryRecordSource} seam so it can drive
|
|
89
|
-
* {@link IVectorIndex} rebuilds (e.g. `InMemoryCosineIndex.rebuild`). The
|
|
90
|
-
* returned source's `list()` delegates to {@link IMemoryStore.listScoped},
|
|
91
|
-
* **filtered to the kinds {@link IMemoryStore.embedsKind | embedsKind} reports** —
|
|
92
|
-
* this source exists to feed the record vector index, so a kind excluded from
|
|
93
|
-
* that index is excluded here too, and a reopen does not re-embed records the
|
|
94
|
-
* index will never return. With no
|
|
95
|
-
* {@link IFileTreeMemoryStoreCreateParams.embedKinds | embedKinds} declaration
|
|
96
|
-
* every kind participates and the filter is the identity. `listScoped` itself is
|
|
97
|
-
* **not** filtered and remains the whole-vault surface.
|
|
98
|
-
*
|
|
99
|
-
* The store cannot implement {@link IMemoryRecordSource} directly because its
|
|
100
|
-
* `list(filter?)` returns bare records (the ergonomic query surface) while the
|
|
101
|
-
* seam's `list()` returns scope-qualified records.
|
|
102
|
-
*/
|
|
103
|
-
asRecordSource(): IMemoryRecordSource;
|
|
104
|
-
/**
|
|
105
|
-
* The EFFECTIVE {@link DedupScope} for `kind` — the granularity at which a
|
|
106
|
-
* write for this kind deduplicates against the existing vault.
|
|
107
|
-
*
|
|
108
|
-
* @remarks
|
|
109
|
-
* This is a **read accessor over the store's already-injected write policies**,
|
|
110
|
-
* and it is the single place any caller — the store's own write path included —
|
|
111
|
-
* asks what a kind's dedup granularity is. It resolves the full chain the store
|
|
112
|
-
* applies on write: the kind's registered {@link IWritePolicy}, falling back to
|
|
113
|
-
* the store's default policy, then that policy's
|
|
114
|
-
* {@link IWritePolicy.dedupScope | dedupScope}, falling back to
|
|
115
|
-
* {@link DEFAULT_DEDUP_SCOPE}. Note the store's default policy is a
|
|
116
|
-
* {@link KnowledgeLwwPolicy}, which declares `'content'` — so a kind with NO
|
|
117
|
-
* registered policy resolves to `'content'`, not to `DEFAULT_DEDUP_SCOPE`.
|
|
118
|
-
*
|
|
119
|
-
* It exists so a caller that must agree with the store about dedup granularity
|
|
120
|
-
* — notably the ingest orchestrator's stage-4 layer-1 exact match — can read the
|
|
121
|
-
* declaration through this seam instead of being handed a second copy of the
|
|
122
|
-
* policy map. A second declaration site is precisely the defect this accessor
|
|
123
|
-
* was added to remove.
|
|
124
|
-
*
|
|
125
|
-
* Deliberately synchronous, total, and NOT `Result`-returning: it reads
|
|
126
|
-
* constructor-injected configuration, touches no I/O, and cannot fail (every
|
|
127
|
-
* link in the fallback chain has a total default). It exposes only the scope,
|
|
128
|
-
* never the {@link IWritePolicy} itself, so it can never become a back door for
|
|
129
|
-
* invoking admission or merge logic out of band.
|
|
130
|
-
*/
|
|
131
|
-
dedupScopeFor(kind: Kind): DedupScope;
|
|
132
|
-
/**
|
|
133
|
-
* Whether records of `kind` participate in the **record-granular** vector index.
|
|
134
|
-
*
|
|
135
|
-
* @remarks
|
|
136
|
-
* A read accessor over the store's injected {@link IFileTreeMemoryStoreCreateParams.embedKinds | embedKinds}
|
|
137
|
-
* declaration, in the same spirit as {@link IMemoryStore.dedupScopeFor} — one
|
|
138
|
-
* place to ask, so the store's write path and any caller reasoning about index
|
|
139
|
-
* coverage cannot disagree. `true` for every kind when no declaration was made.
|
|
140
|
-
*
|
|
141
|
-
* **This is distinct from a {@link MemoryEmbedder} decline, and the difference is
|
|
142
|
-
* cost.** An embedder that returns `undefined` has already been called: the
|
|
143
|
-
* round trip is paid, and on a locally-hosted model that round trip is the
|
|
144
|
-
* expense. A kind excluded here is never handed to the embedder at all. The
|
|
145
|
-
* decline makes the intent *expressible*; this makes it *free*.
|
|
146
|
-
*
|
|
147
|
-
* Deliberately synchronous, total, and NOT `Result`-returning: it reads
|
|
148
|
-
* constructor-injected configuration, touches no I/O, and cannot fail.
|
|
149
|
-
*/
|
|
150
|
-
embedsKind(kind: Kind): boolean;
|
|
151
|
-
/**
|
|
152
|
-
* Write a record. Validates the body, computes a content hash, deduplicates
|
|
153
|
-
* (scope-wide, before policy), applies the kind's {@link IWritePolicy}, stamps
|
|
154
|
-
* transaction-time metadata (`created` / `updated` / `seq` / `contentHash`),
|
|
155
|
-
* writes the file, and patches the index. Returns the written record — or the
|
|
156
|
-
* existing record unchanged on a dedup no-op.
|
|
157
|
-
*/
|
|
158
|
-
put(record: IMemoryRecord<unknown>): Promise<Result<IMemoryRecord<unknown>>>;
|
|
159
|
-
/**
|
|
160
|
-
* Re-apply the kind's {@link RankProjector} to every record of `kind` already
|
|
161
|
-
* in the store, restamping {@link IMemoryEnvelope.rank}. Returns the number of
|
|
162
|
-
* records whose `rank` actually changed.
|
|
163
|
-
*
|
|
164
|
-
* @remarks
|
|
165
|
-
* **This exists because `rank` is otherwise new-store-only, and fails in a way
|
|
166
|
-
* that looks like it works.** The projector runs on the write path only, so
|
|
167
|
-
* registering one against a populated store ranks nothing already written —
|
|
168
|
-
* and because an absent `rank` sorts *last*, every pre-registration record
|
|
169
|
-
* lands below every post-registration one no matter what the projector would
|
|
170
|
-
* have scored it. The ordering is not merely partial; it is **inverted with
|
|
171
|
-
* respect to the projector's own intent**, with no failure anywhere to say so.
|
|
172
|
-
*
|
|
173
|
-
* Deliberately **does not** touch `created` / `updated` / `seq`, and fires no
|
|
174
|
-
* `'write'` observation. Routing a reconcile through {@link IMemoryStore.put}
|
|
175
|
-
* would bump transaction time on every record — trading a wrong `rank` order
|
|
176
|
-
* for a wrong recency order, and flooding any wired observer with writes that
|
|
177
|
-
* are not writes. The body is re-serialized verbatim from the file's own
|
|
178
|
-
* bytes; only the envelope's `rank` moves.
|
|
179
|
-
*
|
|
180
|
-
* Fails loudly if `kind` has no registered projector: asking to reconcile a
|
|
181
|
-
* kind you never configured is a caller error, not a no-op.
|
|
182
|
-
*
|
|
183
|
-
* **Not atomic, and safe for it.** A failure part-way leaves earlier records
|
|
184
|
-
* restamped. That is benign because restamping is idempotent — re-running
|
|
185
|
-
* converges — which is also why no report shape is offered here. A count is
|
|
186
|
-
* enough.
|
|
187
|
-
*/
|
|
188
|
-
reconcileRank(kind: Kind): Promise<Result<number>>;
|
|
189
|
-
/**
|
|
190
|
-
* Delete a record by `(kind, entityId)`. Non-temporal kinds physically delete
|
|
191
|
-
* the file and return the deleted record's {@link MemoryId}. Temporal
|
|
192
|
-
* (versioned) kinds SOFT-delete: the current version is invalidated
|
|
193
|
-
* (`invalid_at` set), history is retained, and the invalidated version's
|
|
194
|
-
* {@link MemoryId} is returned.
|
|
195
|
-
*/
|
|
196
|
-
delete(kind: Kind, entityId: EntityId): Promise<Result<MemoryId>>;
|
|
197
|
-
}
|
|
198
43
|
/**
|
|
199
44
|
* Parameters for {@link FileTreeMemoryStore.create}.
|
|
200
45
|
* @public
|
|
@@ -471,9 +316,49 @@ export declare class FileTreeMemoryStore implements IMemoryStore {
|
|
|
471
316
|
/** {@inheritDoc IMemoryStore.getById} */
|
|
472
317
|
getById(scope: MemoryScopeKey, id: MemoryId): Promise<Result<IMemoryRecord<unknown> | undefined>>;
|
|
473
318
|
/** {@inheritDoc IMemoryStore.list} */
|
|
474
|
-
list(
|
|
319
|
+
list(selection: MemoryListSelection): Promise<Result<ReadonlyArray<IMemoryRecord<unknown>>>>;
|
|
320
|
+
/** {@inheritDoc IMemoryStore.coverage} */
|
|
321
|
+
coverage(): Promise<Result<IDerivedStateCoverage>>;
|
|
322
|
+
/** {@inheritDoc IMemoryStore.listEntries} */
|
|
323
|
+
listEntries(): Promise<Result<ReadonlyArray<IIndexedMemoryEntry>>>;
|
|
475
324
|
/** {@inheritDoc IMemoryStore.listScoped} */
|
|
476
325
|
listScoped(): Promise<Result<ReadonlyArray<IScopedMemoryRecord>>>;
|
|
326
|
+
/** {@inheritDoc IMemoryRecordResolver.resolveRecord} */
|
|
327
|
+
resolveRecord(scope: MemoryScopeKey, id: MemoryId): Result<IMemoryRecord<unknown> | undefined>;
|
|
328
|
+
/**
|
|
329
|
+
* Materialize a selected set of entries into records, dropping any that have
|
|
330
|
+
* vanished since selection.
|
|
331
|
+
*
|
|
332
|
+
* @remarks
|
|
333
|
+
* A miss is not a failure. Selection reads the in-memory index and
|
|
334
|
+
* materialization reads storage, so a record deleted in between is a legitimate
|
|
335
|
+
* race and yields a shorter list rather than an error. A read that FAILS is a
|
|
336
|
+
* real fault and propagates.
|
|
337
|
+
*/
|
|
338
|
+
private _materialize;
|
|
339
|
+
/**
|
|
340
|
+
* Materialize one entry, treating "gone" as a fault rather than a miss.
|
|
341
|
+
*
|
|
342
|
+
* @remarks
|
|
343
|
+
* For paths where a vanished record really does mean the index and the vault
|
|
344
|
+
* disagree, rather than that something legitimately removed it in between.
|
|
345
|
+
*
|
|
346
|
+
* Three of the four callers hold the write lock, so nothing can have removed
|
|
347
|
+
* the record since the entry was read. `get()`'s versioned path does not, and
|
|
348
|
+
* is safe only because temporal kinds never physically delete a version — they
|
|
349
|
+
* invalidate in place, and cap-cull does not apply to them. **If eviction is
|
|
350
|
+
* ever added to the temporal path, that caller must change**, or it
|
|
351
|
+
* reintroduces the race this method exists to detect.
|
|
352
|
+
*
|
|
353
|
+
* `listScoped` also does not hold the lock, and uses this deliberately anyway:
|
|
354
|
+
* it feeds a coverage report, so a silent drop there is worse than a loud
|
|
355
|
+
* failure. See its comment, and `docs/FUTURE.md` for the eviction window.
|
|
356
|
+
*
|
|
357
|
+
* The drop-tolerant counterpart is {@link FileTreeMemoryStore._materialize},
|
|
358
|
+
* for readers where a record that vanished between selection and
|
|
359
|
+
* materialization is a miss rather than a fault.
|
|
360
|
+
*/
|
|
361
|
+
private _resolveRequired;
|
|
477
362
|
/** {@inheritDoc IMemoryStore.asRecordSource} */
|
|
478
363
|
asRecordSource(): IMemoryRecordSource;
|
|
479
364
|
/**
|
|
@@ -484,8 +369,8 @@ export declare class FileTreeMemoryStore implements IMemoryStore {
|
|
|
484
369
|
* contributes nothing.
|
|
485
370
|
*/
|
|
486
371
|
private static _projectAsOf;
|
|
487
|
-
/** {@inheritDoc IMemoryStore.
|
|
488
|
-
|
|
372
|
+
/** {@inheritDoc IMemoryStore.reconcile} */
|
|
373
|
+
reconcile(kind: Kind, artifact: DerivedArtifact): Promise<Result<ReconcileReport>>;
|
|
489
374
|
/** {@inheritDoc IMemoryStore.put} */
|
|
490
375
|
put(record: IMemoryRecord<unknown>): Promise<Result<IMemoryRecord<unknown>>>;
|
|
491
376
|
/** {@inheritDoc IMemoryStore.delete} */
|
|
@@ -661,7 +546,7 @@ export declare class FileTreeMemoryStore implements IMemoryStore {
|
|
|
661
546
|
private _isMutableMetadataUnchanged;
|
|
662
547
|
private _contentHash;
|
|
663
548
|
/**
|
|
664
|
-
* The
|
|
549
|
+
* The rank branch of {@link FileTreeMemoryStore.reconcile}, under the write lock.
|
|
665
550
|
*
|
|
666
551
|
* @remarks
|
|
667
552
|
* Re-reads each record's file rather than trusting the in-memory index, for
|
|
@@ -690,13 +575,15 @@ export declare class FileTreeMemoryStore implements IMemoryStore {
|
|
|
690
575
|
* another on a reconcile. `_stampRank` itself is reused verbatim, which also
|
|
691
576
|
* inherits its throw semantics (logged at `warn`, `rank` cleared).
|
|
692
577
|
*/
|
|
578
|
+
private _reconcileLocked;
|
|
579
|
+
/** The rank branch of {@link FileTreeMemoryStore._reconcileLocked}. */
|
|
693
580
|
private _reconcileRankLocked;
|
|
694
581
|
/**
|
|
695
582
|
* Re-apply the rank projector to one record on disk. Returns whether `rank`
|
|
696
583
|
* actually changed — an unchanged rank writes nothing, so a reconcile over an
|
|
697
584
|
* already-consistent store touches no files.
|
|
698
585
|
*/
|
|
699
|
-
private
|
|
586
|
+
private _rewriteEnvelope;
|
|
700
587
|
/**
|
|
701
588
|
* Stamp the store-computed {@link IMemoryEnvelope.rank} onto a fully-built,
|
|
702
589
|
* fully-stamped record by running the kind's registered {@link RankProjector}.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fileTreeMemoryStore.d.ts","sourceRoot":"","sources":["../../../src/packlets/store/fileTreeMemoryStore.ts"],"names":[],"mappings":"AAKA,OAAO,EAAQ,OAAO,EAAE,MAAM,EAAyC,MAAM,eAAe,CAAC;AAC7F,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAGL,UAAU,EACV,QAAQ,
|
|
1
|
+
{"version":3,"file":"fileTreeMemoryStore.d.ts","sourceRoot":"","sources":["../../../src/packlets/store/fileTreeMemoryStore.ts"],"names":[],"mappings":"AAKA,OAAO,EAAQ,OAAO,EAAE,MAAM,EAAyC,MAAM,eAAe,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