@spine-event-engine/storage 2.0.0-snapshot.24 → 2.0.0-snapshot.25
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/README.md +12 -3
- package/REFERENCE.md +76 -68
- package/dist/entity/agent-history-record-spec.d.ts +8 -0
- package/dist/entity/agent-history-record-spec.d.ts.map +1 -1
- package/dist/entity/agent-history-record-spec.js +12 -1
- package/dist/entity/agent-history-record-spec.js.map +1 -1
- package/dist/entity/agent-history.d.ts +25 -0
- package/dist/entity/agent-history.d.ts.map +1 -1
- package/dist/entity/agent-history.js.map +1 -1
- package/dist/entity/history-conformance.d.ts +38 -8
- package/dist/entity/history-conformance.d.ts.map +1 -1
- package/dist/entity/history-conformance.js +103 -58
- package/dist/entity/history-conformance.js.map +1 -1
- package/dist/event/event-store.d.ts +51 -3
- package/dist/event/event-store.d.ts.map +1 -1
- package/dist/event/event-store.js +171 -27
- package/dist/event/event-store.js.map +1 -1
- package/dist/internal/agent-model-preferences.d.ts +76 -0
- package/dist/internal/agent-model-preferences.d.ts.map +1 -0
- package/dist/internal/agent-model-preferences.js +133 -0
- package/dist/internal/agent-model-preferences.js.map +1 -0
- package/dist/internal/entity-commit.d.ts +64 -8
- package/dist/internal/entity-commit.d.ts.map +1 -1
- package/dist/internal/entity-commit.js.map +1 -1
- package/dist/internal/entity-history.d.ts +1 -7
- package/dist/internal/entity-history.d.ts.map +1 -1
- package/dist/internal/entity-history.js +0 -5
- package/dist/internal/entity-history.js.map +1 -1
- package/dist/internal/event-store.d.ts +1 -1
- package/dist/internal/event-store.d.ts.map +1 -1
- package/dist/internal/event-store.js +1 -1
- package/dist/internal/event-store.js.map +1 -1
- package/dist/internal/storage-preparation.d.ts +88 -0
- package/dist/internal/storage-preparation.d.ts.map +1 -0
- package/dist/internal/storage-preparation.js +41 -0
- package/dist/internal/storage-preparation.js.map +1 -0
- package/dist/internal/tenancy.d.ts +7 -0
- package/dist/internal/tenancy.d.ts.map +1 -1
- package/dist/memory/in-memory-agent-history.d.ts.map +1 -1
- package/dist/memory/in-memory-agent-history.js +22 -7
- package/dist/memory/in-memory-agent-history.js.map +1 -1
- package/dist/memory/in-memory-entity-commit.d.ts +154 -21
- package/dist/memory/in-memory-entity-commit.d.ts.map +1 -1
- package/dist/memory/in-memory-entity-commit.js +396 -60
- package/dist/memory/in-memory-entity-commit.js.map +1 -1
- package/dist/memory/in-memory-entity-history.d.ts.map +1 -1
- package/dist/memory/in-memory-entity-history.js +4 -3
- package/dist/memory/in-memory-entity-history.js.map +1 -1
- package/dist/memory/in-memory-storage-backend.d.ts +33 -1
- package/dist/memory/in-memory-storage-backend.d.ts.map +1 -1
- package/dist/memory/in-memory-storage-backend.js +118 -1
- package/dist/memory/in-memory-storage-backend.js.map +1 -1
- package/dist/memory/in-memory-storage-factory.d.ts +71 -12
- package/dist/memory/in-memory-storage-factory.d.ts.map +1 -1
- package/dist/memory/in-memory-storage-factory.js +199 -25
- package/dist/memory/in-memory-storage-factory.js.map +1 -1
- package/dist/provider.d.ts +2 -0
- package/dist/provider.d.ts.map +1 -1
- package/dist/provider.js +2 -0
- package/dist/provider.js.map +1 -1
- package/dist/storage/storage-factory.d.ts +27 -4
- package/dist/storage/storage-factory.d.ts.map +1 -1
- package/dist/storage/storage-factory.js +30 -1
- package/dist/storage/storage-factory.js.map +1 -1
- package/dist/storage/storage.d.ts +2 -1
- package/dist/storage/storage.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/dist/entity/agent-execution-record-spec.d.ts +0 -87
- package/dist/entity/agent-execution-record-spec.d.ts.map +0 -1
- package/dist/entity/agent-execution-record-spec.js +0 -230
- package/dist/entity/agent-execution-record-spec.js.map +0 -1
- package/dist/entity/agent-execution-sizes.d.ts +0 -30
- package/dist/entity/agent-execution-sizes.d.ts.map +0 -1
- package/dist/entity/agent-execution-sizes.js +0 -51
- package/dist/entity/agent-execution-sizes.js.map +0 -1
- package/dist/entity/agent-execution-transitions.d.ts +0 -72
- package/dist/entity/agent-execution-transitions.d.ts.map +0 -1
- package/dist/entity/agent-execution-transitions.js +0 -165
- package/dist/entity/agent-execution-transitions.js.map +0 -1
- package/dist/entity/agent-execution-values.d.ts +0 -143
- package/dist/entity/agent-execution-values.d.ts.map +0 -1
- package/dist/entity/agent-execution-values.js +0 -251
- package/dist/entity/agent-execution-values.js.map +0 -1
- package/dist/entity/agent-execution.d.ts +0 -235
- package/dist/entity/agent-execution.d.ts.map +0 -1
- package/dist/entity/agent-execution.js +0 -15
- package/dist/entity/agent-execution.js.map +0 -1
- package/dist/internal/agent-execution.d.ts +0 -51
- package/dist/internal/agent-execution.d.ts.map +0 -1
- package/dist/internal/agent-execution.js +0 -53
- package/dist/internal/agent-execution.js.map +0 -1
- package/dist/memory/agent-execution-head-index.d.ts +0 -52
- package/dist/memory/agent-execution-head-index.d.ts.map +0 -1
- package/dist/memory/agent-execution-head-index.js +0 -91
- package/dist/memory/agent-execution-head-index.js.map +0 -1
- package/dist/memory/in-memory-agent-execution.d.ts +0 -21
- package/dist/memory/in-memory-agent-execution.d.ts.map +0 -1
- package/dist/memory/in-memory-agent-execution.js +0 -587
- package/dist/memory/in-memory-agent-execution.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
# Storage API and in-memory storage for Spine TS
|
|
2
2
|
|
|
3
|
+
See [storage layout and database preparation](https://github.com/SpineEventEngine/spine-ts/blob/master/docs/STORAGE_LAYOUT.md) for
|
|
4
|
+
physical structures, tenant placement, prerequisites, and customization.
|
|
5
|
+
|
|
3
6
|
`@spine-event-engine/storage` defines the storage API used by Spine TS and
|
|
4
7
|
includes an in-memory implementation for local development and tests. Use it
|
|
5
8
|
when an application needs a small record store, or when an adapter needs to
|
|
6
9
|
implement the same storage contract for a durable provider.
|
|
7
10
|
|
|
8
|
-
Agents use the configured storage provider to retain
|
|
9
|
-
recorded model
|
|
10
|
-
the process runs; choose a database provider when
|
|
11
|
+
Agents use the configured storage provider to retain typed admission receipts,
|
|
12
|
+
Entity state, and recorded model interactions. The in-memory factory keeps
|
|
13
|
+
these records only while the process runs; choose a database provider when the
|
|
14
|
+
records must survive a restart. An interrupted handler does not resume from them.
|
|
11
15
|
Applications read an Agent's history through its repository, as shown in the
|
|
12
16
|
[support example](https://github.com/SpineEventEngine/spine-ts/blob/master/examples/support/README.md). Adapter implementation
|
|
13
17
|
details are in the [coding-agent reference](REFERENCE.md#provider-spi).
|
|
@@ -128,6 +132,11 @@ to filter names and values: MySQL checks declared columns, while other adapters
|
|
|
128
132
|
can support different query shapes. A provider can push down supported ID and
|
|
129
133
|
declared-column query parts while preserving the common result semantics.
|
|
130
134
|
|
|
135
|
+
`await factory.checkConnection()` checks the configured shared destination. The
|
|
136
|
+
in-memory factory validates this locally without admitting a tenant or creating
|
|
137
|
+
records. Other adapters must implement the diagnostic explicitly; the base
|
|
138
|
+
factory rejects an unsupported check.
|
|
139
|
+
|
|
131
140
|
The storage API clones data at its boundaries. For the base factory and the
|
|
132
141
|
in-memory implementation, closing a factory prevents new record handles while
|
|
133
142
|
existing handles remain usable. Closing a record handle invalidates that
|
package/REFERENCE.md
CHANGED
|
@@ -19,6 +19,22 @@ history and Entity commit contracts, query values, tenant boundaries/catalogs,
|
|
|
19
19
|
and record access. The storage root intentionally does not export
|
|
20
20
|
these provider seams; application code uses its root storage contracts instead.
|
|
21
21
|
|
|
22
|
+
`StorageFactory.close()` synchronously rejects new handles and returns a Promise
|
|
23
|
+
for admitted provider work and cleanup. Await it to observe cleanup failures;
|
|
24
|
+
repeated calls return the same completion. Provider-only Entity commit handles
|
|
25
|
+
also await admitted commits before releasing retained records. Ordinary
|
|
26
|
+
`RecordStorage.close()` remains synchronous.
|
|
27
|
+
|
|
28
|
+
`StorageFactory.checkConnection()` is a public read-only diagnostic for the
|
|
29
|
+
configured shared destination. The base factory rejects unsupported checks and
|
|
30
|
+
closed factories reject them. The memory factory succeeds locally while open;
|
|
31
|
+
this does not admit a tenant or create records. For model preparation, provider
|
|
32
|
+
adapters register through the provider-only `StoragePreparations` registry. Its `prepareRecord`,
|
|
33
|
+
`prepareEntity`, and `prepareAgentHistory` methods accept declarative definitions
|
|
34
|
+
and a `"create"` or `"check"` mode without constructing Storage. Memory validates
|
|
35
|
+
record-family layouts and the Agent audit tenant boundary and state type locally. An unregistered provider
|
|
36
|
+
rejects preparation rather than reporting success.
|
|
37
|
+
|
|
22
38
|
The provider entry point also exports `AgentHistoryStorage`,
|
|
23
39
|
`AgentHistoryStorageFactories`, `AgentHistoryKeys`, and
|
|
24
40
|
`AgentHistoryConformance`. Calling `AgentHistoryStorageFactories.create()` to
|
|
@@ -68,65 +84,40 @@ still have more candidates. Continue until `hasMore` is false, rather than
|
|
|
68
84
|
stopping at the first empty page. Repeating a valid continuation may repeat the
|
|
69
85
|
page. A fresh sweep starts without a continuation.
|
|
70
86
|
|
|
71
|
-
Memory pages use an
|
|
87
|
+
Memory pages use an explicit-registration index and capture its length for that sweep;
|
|
72
88
|
PostgreSQL and MySQL page their configured tenant collections. Datastore pages
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
Agent claims prevent that duplicate discovery from running the same accepted
|
|
76
|
-
invocation concurrently. An empty native `MORE_RESULTS_AFTER_LIMIT` tail that repeats its cursor ends
|
|
89
|
+
native namespace metadata using a query limit and native cursor. An empty native
|
|
90
|
+
`MORE_RESULTS_AFTER_LIMIT` tail that repeats its cursor ends
|
|
77
91
|
that sweep; other continuing pages must advance. Datastore destroys its query
|
|
78
92
|
stream when the caller cancels the read.
|
|
79
93
|
|
|
80
94
|
Catalogs check cancellation before starting work and before returning a result.
|
|
81
95
|
Paging is a finite traversal, not an atomic catalog snapshot: a concurrent
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
EventBus after completion; they are not saved delivery obligations. This includes
|
|
108
|
-
handlers that change no state or produce only a Command.
|
|
109
|
-
|
|
110
|
-
Pending queries read one pending invocation per Agent instance from an index. A page
|
|
111
|
-
carries its original time cutoff and the provider-observed continuation, so the
|
|
112
|
-
caller can continue even when another execution claims a returned invocation.
|
|
113
|
-
These internal pages are separate from application history pages. Eligibility
|
|
114
|
-
and claim expiry use Spine `Time`; original Inbox order determines which signal
|
|
115
|
-
runs next within an instance.
|
|
116
|
-
|
|
117
|
-
Each saved outgoing Command can receive one dispatch plan before transport
|
|
118
|
-
begins. The plan and original Command envelope cannot be replaced.
|
|
119
|
-
`markDelivered()` requires that plan and a current claim. Command retries must
|
|
120
|
-
still visit every saved recipient; these records do not make downstream
|
|
121
|
-
application callbacks execute exactly once. Independently, the framework's
|
|
122
|
-
internal EventStore retry operation accepts an identical existing envelope;
|
|
123
|
-
ordinary public EventStore append still rejects duplicate IDs. EventStore
|
|
124
|
-
history is not an Agent Event delivery queue.
|
|
125
|
-
|
|
126
|
-
The memory implementation coordinates changes only within a shared in-process
|
|
127
|
-
backend. PostgreSQL, transactional MySQL and Datastore use native transactions.
|
|
128
|
-
Database query, index and payload requirements are documented in each provider's
|
|
129
|
-
reference. No execution-storage operation trims the Agent's history.
|
|
96
|
+
registration can appear in the current or next sweep. The separate `all()`
|
|
97
|
+
operation remains available to callers requiring the complete catalog.
|
|
98
|
+
|
|
99
|
+
## Agent live persistence and history
|
|
100
|
+
|
|
101
|
+
Providers retain indexed Agent history separately from Entity state. The
|
|
102
|
+
provider-only `AgentHistoryStorage.appendAll()` commits one immutable audit
|
|
103
|
+
batch; reads use the same scoped indexes and finite cursors as individual
|
|
104
|
+
appends. A complete System audit group is saved before its original Event is
|
|
105
|
+
published. Its failure remains observable and does not create a replacement
|
|
106
|
+
application Event.
|
|
107
|
+
|
|
108
|
+
A typed receipt records live admission without a replayable execution record.
|
|
109
|
+
`EntityCommitStorage.commitAgent()` atomically compares an exact Entity image
|
|
110
|
+
and model preferences, then writes the accepted state, preference and history
|
|
111
|
+
changes. An unchanged-state or preference-only turn can succeed without
|
|
112
|
+
increasing the Entity Version. Failed comparisons write no prefix. The ordinary
|
|
113
|
+
`commit()` contract below remains separate and can retain prefix writes after
|
|
114
|
+
an error. Built-in providers implement the live Agent operation with their
|
|
115
|
+
native transaction semantics; custom providers must explicitly support it.
|
|
116
|
+
|
|
117
|
+
Memory coordinates these changes within a shared in-process backend;
|
|
118
|
+
PostgreSQL, transactional MySQL/MariaDB, and Datastore use their native atomic
|
|
119
|
+
storage operations. Closing a factory drains admitted work before releasing
|
|
120
|
+
retained private handles.
|
|
130
121
|
|
|
131
122
|
## Record storage
|
|
132
123
|
|
|
@@ -197,14 +188,17 @@ that stated overlap. See each provider reference for mappings and index needs.
|
|
|
197
188
|
|
|
198
189
|
## Lifecycle
|
|
199
190
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
191
|
+
`StorageFactory.close()` fences new storage creation immediately and returns a
|
|
192
|
+
promise that settles after its retained commit work and provider resources close.
|
|
193
|
+
The in-memory factory drains retained commits and closes its tenant catalog;
|
|
194
|
+
independent record handles remain open until their own synchronous
|
|
195
|
+
`RecordStorage.close()`. PostgreSQL and MySQL also close their live record
|
|
196
|
+
handles and connection pools. Datastore closes retained Entity bundles and its
|
|
197
|
+
tenant catalog. Cleanup failures reject the factory close promise. Read the
|
|
198
|
+
[Datastore reference](../storage-datastore/REFERENCE.md),
|
|
199
|
+
[MySQL reference](../storage-mysql/REFERENCE.md), and
|
|
200
|
+
[PostgreSQL reference](../storage-postgres/REFERENCE.md) for provider details.
|
|
201
|
+
The in-memory backend is ephemeral and process-local. Passing one
|
|
208
202
|
`InMemoryStorageBackend` to multiple in-memory factories deliberately shares
|
|
209
203
|
its scoped rows.
|
|
210
204
|
|
|
@@ -229,6 +223,14 @@ runs its callback, then inserts with an atomic absent-slot condition. Competing
|
|
|
229
223
|
callbacks may both run and may each have effects, but at most one Event is stored.
|
|
230
224
|
The framework EventBus dispatches only after strict insertion succeeds.
|
|
231
225
|
|
|
226
|
+
An `EventStore` retains its RecordStorage objects for reuse by the corresponding
|
|
227
|
+
tenants. Always await `eventStore.close()` before closing its factory. Closing
|
|
228
|
+
rejects new storage operations, waits for an already admitted query or insertion
|
|
229
|
+
batch to settle, and then closes every retained store. It leaves the factory open;
|
|
230
|
+
cleanup failures reject the close promise. Repeated calls return the same outcome.
|
|
231
|
+
The callback in `acceptThenAppend()` runs between storage operations: closing from
|
|
232
|
+
that callback completes, and the later insertion rejects because the store is closed.
|
|
233
|
+
|
|
232
234
|
History ports are lazy. When a history is disabled, the in-memory provider does
|
|
233
235
|
not open or allocate its grouped records. Current Entity loading always uses
|
|
234
236
|
the current record, never retained history. Event history is diagnostic data,
|
|
@@ -243,10 +245,16 @@ record layouts are unchanged.
|
|
|
243
245
|
|
|
244
246
|
The built-in providers capture prepared input before I/O and write state history,
|
|
245
247
|
diagnostic Events, delivery Events, then current state as independent records.
|
|
246
|
-
SQL and Datastore providers automatically retry
|
|
247
|
-
persistence failure using
|
|
248
|
-
reuse the same versions and Event IDs without
|
|
249
|
-
failure leaves completed writes in place. The
|
|
250
|
-
alone does not prove the entire Entity save
|
|
251
|
-
interleave, including current-state
|
|
252
|
-
single-record atomic compare-and-set, and
|
|
248
|
+
For ordinary Entity `commit()`, SQL and Datastore providers automatically retry
|
|
249
|
+
one classified transient persistence failure using the captured input. In
|
|
250
|
+
memory, a caller retry must reuse the same versions and Event IDs without
|
|
251
|
+
rerunning the handler. A later failure leaves completed writes in place. The
|
|
252
|
+
presence of a delivery Event alone does not prove the entire Entity save
|
|
253
|
+
completed. Concurrent ordinary saves may interleave, including current-state
|
|
254
|
+
writes. Automatic Entity versions, single-record atomic compare-and-set, and
|
|
255
|
+
immutable-record checks remain.
|
|
256
|
+
|
|
257
|
+
The provider-only `commitAgent()` instead checks the initial Entity version and
|
|
258
|
+
complete model-preference image, then atomically commits any changed Entity
|
|
259
|
+
record, final Agent audit, and replacement preferences. It also checks the
|
|
260
|
+
initial Entity version when the turn has no state change.
|
|
@@ -20,6 +20,14 @@ interface AgentHistoryRecordLayout {
|
|
|
20
20
|
* @returns Internal storage envelope.
|
|
21
21
|
*/
|
|
22
22
|
record(stateType: string, agentKey: string, entry: AgentHistoryEntry): AgentHistoryRecord;
|
|
23
|
+
/**
|
|
24
|
+
* Calculates one complete persisted Agent audit envelope.
|
|
25
|
+
* @param stateType Generated Agent state type.
|
|
26
|
+
* @param agentKey Canonical Agent identifier.
|
|
27
|
+
* @param entry Original typed audit entry.
|
|
28
|
+
* @returns Full encoded AgentHistoryRecord bytes.
|
|
29
|
+
*/
|
|
30
|
+
bytes(stateType: string, agentKey: string, entry: AgentHistoryEntry): number;
|
|
23
31
|
/**
|
|
24
32
|
* Encodes the immutable logical record identity.
|
|
25
33
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-history-record-spec.d.ts","sourceRoot":"","sources":["../../src/entity/agent-history-record-spec.ts"],"names":[],"mappings":"AAeA,OAAO,EAA2B,KAAK,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAClG,OAAO,EAGL,KAAK,kBAAkB,EACxB,MAAM,6EAA6E,CAAC;AAErF,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAQ1D;;GAEG;AACH,UAAU,wBAAwB;IAChC;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;IAE7B;;;;;;;OAOG;IACH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* or implied. See the License for the specific language governing permissions and limitations under
|
|
12
12
|
* the License.
|
|
13
13
|
*/
|
|
14
|
-
import { create, ScalarType } from "@bufbuild/protobuf";
|
|
14
|
+
import { create, ScalarType, toBinary } from "@bufbuild/protobuf";
|
|
15
15
|
import { AgentHistoryEntrySchema } from "@spine-event-engine/proto/agent";
|
|
16
16
|
import { AgentHistoryRecordSchema, AgentHistoryStorageKeySchema as AgentStorageKeySchema, } from "@spine-event-engine/proto/generated/spine/server/agent/history_record_pb.js";
|
|
17
17
|
import { RecordColumn } from "../record/record-column.js";
|
|
@@ -48,6 +48,17 @@ export const AgentHistoryRecords = {
|
|
|
48
48
|
entry,
|
|
49
49
|
});
|
|
50
50
|
},
|
|
51
|
+
/**
|
|
52
|
+
* Calculates the byte size of a complete stored row including its scope and original entry.
|
|
53
|
+
*
|
|
54
|
+
* @param stateType Declared Agent state type.
|
|
55
|
+
* @param agentKey Canonical typed Agent identifier key.
|
|
56
|
+
* @param entry Complete original audit entry.
|
|
57
|
+
* @returns Serialized byte count of the full stored history row.
|
|
58
|
+
*/
|
|
59
|
+
bytes(stateType, agentKey, entry) {
|
|
60
|
+
return toBinary(AgentHistoryRecordSchema, this.record(stateType, agentKey, entry)).length;
|
|
61
|
+
},
|
|
51
62
|
/**
|
|
52
63
|
* Builds the full logical identity hashed into a provider physical ID.
|
|
53
64
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-history-record-spec.js","sourceRoot":"","sources":["../../src/entity/agent-history-record-spec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"agent-history-record-spec.js","sourceRoot":"","sources":["../../src/entity/agent-history-record-spec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,oBAA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AC,MAAM,EAAE,EAAE,CAAC,gBAAgB,CAAC,SAAS,CAAC,mBAAmB,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAC3F;YACD,IAAI,YAAY,CAAC,kBAAkB,EAAE,MAAM,EAAE,YAAY,CAAC;YAC1D,IAAI,YAAY,CAAC,qBAAqB,EAAE,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC;YACzF,IAAI,YAAY,CAAC,WAAW,EAAE,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,CAC/C,gBAAgB,CAAC,UAAU,CACzB,gBAAgB,CAAC,SAAS,CAAC,mBAAmB,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CACtE,CACF;SACF,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -135,12 +135,29 @@ export interface AgentHistoryPage {
|
|
|
135
135
|
*/
|
|
136
136
|
readonly hasMore: boolean;
|
|
137
137
|
}
|
|
138
|
+
/**
|
|
139
|
+
* Provider bounds for complete stored Agent audit rows and one atomic group.
|
|
140
|
+
*/
|
|
141
|
+
export interface AgentHistoryCapacity {
|
|
142
|
+
/**
|
|
143
|
+
* Maximum encoded AgentHistoryRecord bytes, when the provider imposes one.
|
|
144
|
+
*/
|
|
145
|
+
readonly historyRecordBytes?: number;
|
|
146
|
+
/**
|
|
147
|
+
* Maximum native transaction payload bytes, when the provider imposes one.
|
|
148
|
+
*/
|
|
149
|
+
readonly transactionPayloadBytes?: number;
|
|
150
|
+
}
|
|
138
151
|
/**
|
|
139
152
|
* Provider handle for one repository state type and tenant boundary.
|
|
140
153
|
*
|
|
141
154
|
* @typeParam Id Typed Agent identifier.
|
|
142
155
|
*/
|
|
143
156
|
export interface AgentHistoryStorage<Id> {
|
|
157
|
+
/**
|
|
158
|
+
* Physical bounds used to preflight live Agent audit writes.
|
|
159
|
+
*/
|
|
160
|
+
readonly capacity: AgentHistoryCapacity;
|
|
144
161
|
/**
|
|
145
162
|
* Adds one immutable occurrence, or accepts an identical repeated append.
|
|
146
163
|
*
|
|
@@ -149,6 +166,14 @@ export interface AgentHistoryStorage<Id> {
|
|
|
149
166
|
* @returns Resolves after the occurrence is recorded.
|
|
150
167
|
*/
|
|
151
168
|
append(entityId: Id, entry: AgentHistoryEntry): Promise<void>;
|
|
169
|
+
/**
|
|
170
|
+
* Writes atomically adds one immutable group of conversation and System audit rows.
|
|
171
|
+
*
|
|
172
|
+
* @param entityId Typed Agent identifier.
|
|
173
|
+
* @param entries Complete rows, or an empty no-op group.
|
|
174
|
+
* @returns Completion after all rows and indexes are committed together.
|
|
175
|
+
*/
|
|
176
|
+
appendAll(entityId: Id, entries: readonly AgentHistoryEntry[]): Promise<void>;
|
|
152
177
|
/**
|
|
153
178
|
* Reads a bounded live continuation from one indexed view.
|
|
154
179
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-history.d.ts","sourceRoot":"","sources":["../../src/entity/agent-history.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEzF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D;;;;GAIG;AACH,UAAU,mBAAmB,CAAC,EAAE;IAC9B;;;;;OAKG;IACH,QAAQ,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,KAAK,MAAM,CAAC;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,QAAQ,CAAC,UAAU,EAAE,SAAS,CAAC;IAE/B;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,cAAc,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAExD;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED;;G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AG,MAAM,CAAC;CAC1E;AAED;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,yBAyD7B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-history.js","sourceRoot":"","sources":["../../src/entity/agent-history.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;
|
|
1
|
+
{"version":3,"file":"agent-history.js","sourceRoot":"","sources":["../../src/entity/agent-history.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AA+NH,MAAM,UAAU,GAAG,CAAC,YAAY,CAAC;AACjC,MAAM,UAAU,GAAG,aAAa,CAAC;AACjC,MAAM,YAAY,GAAiD;IACjE,YAAY,EAAE,GAAG;IACjB,MAAM,EAAE,GAAG;IACX,MAAM,EAAE,GAAG;CACZ,CAAC;AAgCF;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAA8B,MAAM,CAAC,MAAM,CAAC;IACvE;;;;;OAKG;IACH,SAAS,CAAC,KAAwB;QAChC,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC;QACpC,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;QACxB,IAAI,UAAU,KAAK,SAAS,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS;YACrD,MAAM,IAAI,SAAS,CAAC,yDAAyD,CAAC,CAAC;QACjF,IAAI,IAAI,CAAC,IAAI,KAAK,oBAAoB,EAAE,CAAC;YACvC,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC;YAC1B,IAAI,MAAM,CAAC,YAAY,EAAE,KAAK,KAAK,SAAS,IAAI,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC;gBACpF,MAAM,IAAI,SAAS,CAAC,iDAAiD,CAAC,CAAC;YACzE,iBAAiB,CAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC;YAC1D,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,cA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B,EAAE,QAA+B;QAC1D,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QACxB,IAAI,OAAO,CAAC,OAAO,KAAK,QAAQ,EAAE,OAAO,IAAI,OAAO,CAAC,KAAK,KAAK,QAAQ,CAAC,KAAK;YAC3E,MAAM,IAAI,SAAS,CAAC,qEAAqE,CAAC,CAAC;IAC/F,CAAC;IAED;;;;OAIG;IACH,SAAS,CAAC,KAAgB;QACxB,IACE,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ;YACjC,KAAK,CAAC,OAAO,GAAG,UAAU;YAC1B,KAAK,CAAC,OAAO,GAAG,UAAU;YAE1B,MAAM,IAAI,UAAU,CAAC,iEAAiE,CAAC,CAAC;QAC1F,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,KAAK,GAAG,CAAC,IAAI,KAAK,CAAC,KAAK,GAAG,SAAS;YAC9E,MAAM,IAAI,UAAU,CAAC,qEAAqE,CAAC,CAAC;IAChG,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { type Message } from "@bufbuild/protobuf";
|
|
2
|
-
import {
|
|
2
|
+
import type { GenMessage } from "@bufbuild/protobuf/codegenv2";
|
|
3
3
|
import type { EntityEventHistoryPort, EntityStateHistoryPort } from "./entity-history-storage.js";
|
|
4
4
|
import type { EntityRecordStorage } from "./entity-record.js";
|
|
5
5
|
import type { EntityStorageInput } from "../memory/in-memory-entity-history.js";
|
|
6
6
|
/**
|
|
7
7
|
* Provides the current-record and state-history handles used by adapter conformance checks.
|
|
8
|
+
* @typeParam I Entity identifier type.
|
|
9
|
+
* @typeParam S Generated Entity state type.
|
|
8
10
|
*/
|
|
9
11
|
export interface EntityStorageConformance<I, S extends Message> {
|
|
10
12
|
/**
|
|
@@ -26,26 +28,54 @@ export interface EntityStorageConformance<I, S extends Message> {
|
|
|
26
28
|
}
|
|
27
29
|
/**
|
|
28
30
|
* Creates a provider handle for the reusable current-record and state-history checks.
|
|
31
|
+
* @typeParam S Generated Entity state type.
|
|
29
32
|
*/
|
|
30
|
-
export interface EntityHistoryConformanceAdapter {
|
|
33
|
+
export interface EntityHistoryConformanceAdapter<S extends Message> {
|
|
34
|
+
/**
|
|
35
|
+
* Generated descriptor for the test Entity state.
|
|
36
|
+
*/
|
|
37
|
+
readonly stateSchema: GenMessage<S>;
|
|
38
|
+
/**
|
|
39
|
+
* Creates one domain-correct Entity state fixture.
|
|
40
|
+
* @param id Entity identifier.
|
|
41
|
+
* @param value State title.
|
|
42
|
+
* @returns Generated Entity state.
|
|
43
|
+
*/
|
|
44
|
+
state(id: string, value: string): S;
|
|
45
|
+
/**
|
|
46
|
+
* Reads the title used in conformance assertions.
|
|
47
|
+
* @param state Generated Entity state.
|
|
48
|
+
* @returns State title.
|
|
49
|
+
*/
|
|
50
|
+
value(state: S): string;
|
|
31
51
|
/**
|
|
32
52
|
* Creates storage for the supplied Entity shape.
|
|
33
|
-
*
|
|
34
53
|
* @param input Defines the Entity storage scope and schemas.
|
|
35
54
|
* @returns The provider handle.
|
|
36
55
|
*/
|
|
37
|
-
|
|
56
|
+
create(input: EntityStorageInput<string, S>): EntityStorageConformance<string, S>;
|
|
38
57
|
/**
|
|
39
58
|
* Creates a reopened handle for the same Entity shape.
|
|
40
|
-
*
|
|
41
59
|
* @param input Defines the Entity storage scope and schemas.
|
|
42
60
|
* @returns The reopened provider handle.
|
|
43
61
|
*/
|
|
44
|
-
|
|
62
|
+
reopen(input: EntityStorageInput<string, S>): EntityStorageConformance<string, S>;
|
|
45
63
|
}
|
|
46
64
|
interface EntityHistoryConformanceChecks {
|
|
47
|
-
|
|
48
|
-
|
|
65
|
+
/**
|
|
66
|
+
* Checks current-record querying with the supplied generated state.
|
|
67
|
+
* @typeParam S Generated Entity state type.
|
|
68
|
+
* @param adapter Provider and state fixture.
|
|
69
|
+
* @returns Completion after current-record assertions.
|
|
70
|
+
*/
|
|
71
|
+
checkCurrentQueries<S extends Message>(adapter: EntityHistoryConformanceAdapter<S>): Promise<void>;
|
|
72
|
+
/**
|
|
73
|
+
* Checks current-record and state-history behavior.
|
|
74
|
+
* @typeParam S Generated Entity state type.
|
|
75
|
+
* @param adapter Provider and state fixture.
|
|
76
|
+
* @returns Completion after conformance assertions.
|
|
77
|
+
*/
|
|
78
|
+
check<S extends Message>(adapter: EntityHistoryConformanceAdapter<S>): Promise<void>;
|
|
49
79
|
}
|
|
50
80
|
/**
|
|
51
81
|
* Runs provider-neutral current-record and generated state-history checks.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"history-conformance.d.ts","sourceRoot":"","sources":["../../src/entity/history-conformance.ts"],"names":[],"mappings":"AAcA,OAAO,
|
|
1
|
+
{"version":3,"file":"history-conformance.d.ts","sourceRoot":"","sources":["../../src/entity/history-conformance.ts"],"names":[],"mappings":"AAcA,OAAO,EAAsB,KAAK,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAS/D,OAAO,KAAK,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAClG,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAKhF;;;;GAIG;AACH,MAAM,WAAW,wBAAwB,CAAC,CAAC,EAAE,CAAC,SAAS,OAAO;IAG5D;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,mBAAmB,CAAC,CAAC,CAAC,CAAC;IAEzC;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,sBAAsB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAE9C;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,sBAAsB,CAAC,CAAC,CAAC,CAAC;IAE3C;;OAEG;IACH,KAAK,CAAC,IAAI,IAAI,CA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