@spine-event-engine/storage 2.0.0-snapshot.23 → 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 +90 -63
- 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 +80 -74
- package/dist/event/event-store.d.ts.map +1 -1
- package/dist/event/event-store.js +264 -264
- package/dist/event/event-store.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.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 +92 -17
- package/dist/internal/entity-commit.d.ts.map +1 -1
- package/dist/internal/entity-commit.js +45 -2
- 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 +237 -42
- package/dist/memory/in-memory-entity-commit.d.ts.map +1 -1
- package/dist/memory/in-memory-entity-commit.js +529 -325
- 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 +72 -13
- package/dist/memory/in-memory-storage-factory.d.ts.map +1 -1
- package/dist/memory/in-memory-storage-factory.js +199 -30
- package/dist/memory/in-memory-storage-factory.js.map +1 -1
- package/dist/memory/tenant-records.d.ts +1 -1
- package/dist/memory/tenant-records.d.ts.map +1 -1
- package/dist/memory/tenant-records.js +3 -2
- package/dist/memory/tenant-records.js.map +1 -1
- package/dist/provider.d.ts +2 -1
- package/dist/provider.d.ts.map +1 -1
- package/dist/provider.js +2 -1
- package/dist/provider.js.map +1 -1
- package/dist/record/record-query.d.ts +10 -2
- package/dist/record/record-query.d.ts.map +1 -1
- package/dist/record/record-query.js +9 -0
- package/dist/record/record-query.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 -71
- package/dist/entity/agent-execution-transitions.d.ts.map +0 -1
- package/dist/entity/agent-execution-transitions.js +0 -182
- package/dist/entity/agent-execution-transitions.js.map +0 -1
- package/dist/entity/agent-execution-values.d.ts +0 -142
- package/dist/entity/agent-execution-values.d.ts.map +0 -1
- package/dist/entity/agent-execution-values.js +0 -250
- package/dist/entity/agent-execution-values.js.map +0 -1
- package/dist/entity/agent-execution.d.ts +0 -234
- 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/internal/delivery-cleanup.d.ts +0 -99
- package/dist/internal/delivery-cleanup.d.ts.map +0 -1
- package/dist/internal/delivery-cleanup.js +0 -38
- package/dist/internal/delivery-cleanup.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/dist/memory/memory-delivery-cleanup.d.ts +0 -32
- package/dist/memory/memory-delivery-cleanup.d.ts.map +0 -1
- package/dist/memory/memory-delivery-cleanup.js +0 -61
- package/dist/memory/memory-delivery-cleanup.js.map +0 -1
|
@@ -1,234 +0,0 @@
|
|
|
1
|
-
import type { Message } from "@bufbuild/protobuf";
|
|
2
|
-
import type { Timestamp } from "@bufbuild/protobuf/wkt";
|
|
3
|
-
import type { AgentHistoryEntry, ModelPreference } from "@spine-event-engine/proto/agent";
|
|
4
|
-
import type { AgentAcceptedInvocation, AgentExecutionRecord, AgentExecutionScope, AgentInvocationKey, AgentSignalKey } from "@spine-event-engine/proto/generated/spine/server/agent/execution_record_pb.js";
|
|
5
|
-
import type { EntityCommitInput } from "../internal/entity-commit.js";
|
|
6
|
-
import type { EntityStorageInput } from "../internal/entity-history.js";
|
|
7
|
-
/**
|
|
8
|
-
* Defines one Agent repository scope for a provider handle.
|
|
9
|
-
*
|
|
10
|
-
* @typeParam I Typed Agent identifier.
|
|
11
|
-
* @typeParam S Generated Agent state.
|
|
12
|
-
*/
|
|
13
|
-
export interface AgentExecutionStorageInput<I, S extends Message> {
|
|
14
|
-
/**
|
|
15
|
-
* Entity layout and complete tenant boundary used by conditional completion.
|
|
16
|
-
*/
|
|
17
|
-
readonly entity: EntityStorageInput<I, S>;
|
|
18
|
-
/**
|
|
19
|
-
* Generated Agent state type named in every execution scope.
|
|
20
|
-
*/
|
|
21
|
-
readonly stateType: string;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Selects a bounded page of provider-observed candidate heads in one Agent state type.
|
|
25
|
-
*/
|
|
26
|
-
export interface AgentPendingRead {
|
|
27
|
-
/**
|
|
28
|
-
* Provider-observed continuation and fixed time boundary from the preceding page.
|
|
29
|
-
*/
|
|
30
|
-
readonly after?: AgentPendingCursor;
|
|
31
|
-
/**
|
|
32
|
-
* Maximum number of observed candidates returned.
|
|
33
|
-
*/
|
|
34
|
-
readonly count: number;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Orders observed candidate heads without allocating a history position.
|
|
38
|
-
*/
|
|
39
|
-
export interface AgentPendingKey {
|
|
40
|
-
/**
|
|
41
|
-
* Complete Agent instance identity.
|
|
42
|
-
*/
|
|
43
|
-
readonly scope: AgentExecutionScope;
|
|
44
|
-
/**
|
|
45
|
-
* Provider time at which this instance became eligible.
|
|
46
|
-
*/
|
|
47
|
-
readonly eligibleAt: Timestamp;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Fixed sweep time and complete index key observed by a provider page.
|
|
51
|
-
*/
|
|
52
|
-
export interface AgentPendingCursor {
|
|
53
|
-
/**
|
|
54
|
-
* Time sampled once when the sweep began.
|
|
55
|
-
*/
|
|
56
|
-
readonly asOf: Timestamp;
|
|
57
|
-
/**
|
|
58
|
-
* Last examined head index key, before any concurrent mutation.
|
|
59
|
-
*/
|
|
60
|
-
readonly key: AgentPendingKey;
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Returns detached records for observed candidates and their continuation.
|
|
64
|
-
* A concurrent mutation can make a record stale; claim decides whether work is current.
|
|
65
|
-
*/
|
|
66
|
-
export interface AgentPendingPage {
|
|
67
|
-
/**
|
|
68
|
-
* Candidate records observed through the pending-head index.
|
|
69
|
-
*/
|
|
70
|
-
readonly records: readonly AgentExecutionRecord[];
|
|
71
|
-
/**
|
|
72
|
-
* Last examined provider index key; advance it even when no claim succeeds.
|
|
73
|
-
*/
|
|
74
|
-
readonly after?: AgentPendingCursor;
|
|
75
|
-
/**
|
|
76
|
-
* Whether another indexed candidate was observed during this page read.
|
|
77
|
-
*/
|
|
78
|
-
readonly hasMore: boolean;
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Provides a claimed record and queryable current model preferences.
|
|
82
|
-
*/
|
|
83
|
-
export interface AgentExecutionClaim {
|
|
84
|
-
/**
|
|
85
|
-
* Complete claimed execution record.
|
|
86
|
-
*/
|
|
87
|
-
readonly record: AgentExecutionRecord;
|
|
88
|
-
/**
|
|
89
|
-
* Current per-instance preferences at the claim boundary.
|
|
90
|
-
*/
|
|
91
|
-
readonly preferences: readonly ModelPreference[];
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Replaces one fenced execution record and appends its conversation or System history.
|
|
95
|
-
*/
|
|
96
|
-
export interface AgentExecutionUpdate {
|
|
97
|
-
/**
|
|
98
|
-
* Exact accepted invocation identity.
|
|
99
|
-
*/
|
|
100
|
-
readonly key: AgentInvocationKey;
|
|
101
|
-
/**
|
|
102
|
-
* Exclusive token granted by the current per-instance claim.
|
|
103
|
-
*/
|
|
104
|
-
readonly token: string;
|
|
105
|
-
/**
|
|
106
|
-
* Exact binary image read before constructing this update.
|
|
107
|
-
*/
|
|
108
|
-
readonly expectedRecordBytes: Uint8Array;
|
|
109
|
-
/**
|
|
110
|
-
* Complete next record with immutable acceptance unchanged.
|
|
111
|
-
*/
|
|
112
|
-
readonly next: AgentExecutionRecord;
|
|
113
|
-
/**
|
|
114
|
-
* Original conversation or System entries committed with the journal.
|
|
115
|
-
*/
|
|
116
|
-
readonly historyEntries?: readonly AgentHistoryEntry[];
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* Commits an Agent transition and its fenced execution record together.
|
|
120
|
-
*
|
|
121
|
-
* @typeParam I Typed Agent identifier.
|
|
122
|
-
* @typeParam S Generated Agent state.
|
|
123
|
-
*/
|
|
124
|
-
export interface AgentExecutionComplete<I, S extends Message> extends AgentExecutionUpdate {
|
|
125
|
-
/**
|
|
126
|
-
* Current-state and framework history mutation; absent for a no-op.
|
|
127
|
-
*/
|
|
128
|
-
readonly entityCommit?: EntityCommitInput<I, S>;
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Native serialized payload bounds available before model or tool dispatch.
|
|
132
|
-
*
|
|
133
|
-
* Every limit applies to the complete internal Protobuf record, including its
|
|
134
|
-
* scope and metadata. An absent limit means this provider enforces no tighter
|
|
135
|
-
* fixed bound for that record.
|
|
136
|
-
*/
|
|
137
|
-
export interface AgentExecutionCapacity {
|
|
138
|
-
/**
|
|
139
|
-
* Maximum serialized AgentExecutionRecord bytes.
|
|
140
|
-
*/
|
|
141
|
-
readonly executionRecordBytes?: number;
|
|
142
|
-
/**
|
|
143
|
-
* Maximum serialized AgentExecutionHead bytes.
|
|
144
|
-
*/
|
|
145
|
-
readonly executionHeadBytes?: number;
|
|
146
|
-
/**
|
|
147
|
-
* Maximum serialized AgentHistoryRecord bytes.
|
|
148
|
-
*/
|
|
149
|
-
readonly historyRecordBytes?: number;
|
|
150
|
-
/**
|
|
151
|
-
* Maximum aggregate staged native transaction payload bytes.
|
|
152
|
-
*/
|
|
153
|
-
readonly transactionPayloadBytes?: number;
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* Provider-only durable execution capability for one Agent repository scope.
|
|
157
|
-
*
|
|
158
|
-
* @typeParam I Typed Agent identifier.
|
|
159
|
-
* @typeParam S Generated Agent state.
|
|
160
|
-
*/
|
|
161
|
-
export interface AgentExecutionStorage<I, S extends Message> {
|
|
162
|
-
/**
|
|
163
|
-
* Native bounds used to reject unjournalable work before external dispatch.
|
|
164
|
-
*/
|
|
165
|
-
readonly capacity: AgentExecutionCapacity;
|
|
166
|
-
/**
|
|
167
|
-
* Persists accepted source work before its Inbox handoff is acknowledged.
|
|
168
|
-
*
|
|
169
|
-
* @param accepted Exact source envelope and selected handler bindings.
|
|
170
|
-
* @returns Stored record, accepting an identical repeat only.
|
|
171
|
-
*/
|
|
172
|
-
admit(accepted: AgentAcceptedInvocation): Promise<AgentExecutionRecord>;
|
|
173
|
-
/**
|
|
174
|
-
* Reads bounded, time-eligible unresolved work through a provider index.
|
|
175
|
-
*
|
|
176
|
-
* @param request Page count and complete continuation.
|
|
177
|
-
* @returns Independent records and continuation state.
|
|
178
|
-
*/
|
|
179
|
-
pending(request: AgentPendingRead): Promise<AgentPendingPage>;
|
|
180
|
-
/**
|
|
181
|
-
* Reads a complete execution record after reconstruction.
|
|
182
|
-
*
|
|
183
|
-
* @param key Exact source and Agent instance identity.
|
|
184
|
-
* @returns Stored record, if present.
|
|
185
|
-
*/
|
|
186
|
-
read(key: AgentInvocationKey): Promise<AgentExecutionRecord | undefined>;
|
|
187
|
-
/**
|
|
188
|
-
* Acquires the earliest unresolved invocation with a fresh provider-side time check.
|
|
189
|
-
*
|
|
190
|
-
* @param key Exact source and Agent instance identity.
|
|
191
|
-
* @param token New unpredictable exclusive token.
|
|
192
|
-
* @param expiresAt Requested claim expiry.
|
|
193
|
-
* @returns Claimed record and current preferences, if eligible.
|
|
194
|
-
*/
|
|
195
|
-
claim(key: AgentInvocationKey, token: string, expiresAt: Timestamp): Promise<AgentExecutionClaim | undefined>;
|
|
196
|
-
/**
|
|
197
|
-
* Updates the same unexpired token under the per-instance claim lock.
|
|
198
|
-
*
|
|
199
|
-
* @param key Exact source and Agent instance identity.
|
|
200
|
-
* @param token Current exclusive token.
|
|
201
|
-
* @param expiresAt Requested later expiry.
|
|
202
|
-
* @returns Whether the current token was renewed.
|
|
203
|
-
*/
|
|
204
|
-
renew(key: AgentInvocationKey, token: string, expiresAt: Timestamp): Promise<boolean>;
|
|
205
|
-
/**
|
|
206
|
-
* Persists fenced budgets, evidence and conversation/System history atomically.
|
|
207
|
-
*
|
|
208
|
-
* @param input Expected exact record and next retained evidence.
|
|
209
|
-
* @returns Completion after fenced evidence is persisted.
|
|
210
|
-
*/
|
|
211
|
-
update(input: AgentExecutionUpdate): Promise<void>;
|
|
212
|
-
/**
|
|
213
|
-
* Persists Entity, history, preferences, execution result and output obligations atomically.
|
|
214
|
-
*
|
|
215
|
-
* @param input Expected exact record and complete transition.
|
|
216
|
-
* @returns Completion after conditional Entity and evidence commit.
|
|
217
|
-
*/
|
|
218
|
-
complete(input: AgentExecutionComplete<I, S>): Promise<void>;
|
|
219
|
-
/**
|
|
220
|
-
* Marks output IDs accepted by normal delivery without rerunning handlers.
|
|
221
|
-
*
|
|
222
|
-
* @param key Exact source and Agent instance identity.
|
|
223
|
-
* @param token Current exclusive token.
|
|
224
|
-
* @param expectedRecordBytes Exact binary image before acknowledgement.
|
|
225
|
-
* @param signals Original IDs accepted by delivery.
|
|
226
|
-
* @returns Completion after original output IDs are marked delivered.
|
|
227
|
-
*/
|
|
228
|
-
markDelivered(key: AgentInvocationKey, token: string, expectedRecordBytes: Uint8Array, signals: readonly AgentSignalKey[]): Promise<void>;
|
|
229
|
-
/**
|
|
230
|
-
* Closes this handle without deleting any persisted work.
|
|
231
|
-
*/
|
|
232
|
-
close(): void;
|
|
233
|
-
}
|
|
234
|
-
//# sourceMappingURL=agent-execution.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agent-execution.d.ts","sourceRoot":"","sources":["../../src/entity/agent-execution.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAC1F,OAAO,KAAK,EACV,uBAAuB,EACvB,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACf,MAAM,+EAA+E,CAAC;AAEvF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAExE;;;;;GAKG;AACH,MAAM,WAAW,0BAA0B,CAAC,CAAC,EAAE,CAAC,SAAS,OAAO;IAC9D;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAE1C;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH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B,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEnD;;;;;OAKG;IACH,QAAQ,CAAC,KAAK,EAAE,sBAAsB,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE7D;;;;;;;;OAQG;IACH,aAAa,CACX,GAAG,EAAE,kBAAkB,EACvB,KAAK,EAAE,MAAM,EACb,mBAAmB,EAAE,UAAU,EAC/B,OAAO,EAAE,SAAS,cAAc,EAAE,GACjC,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjB;;OAEG;IACH,KAAK,IAAI,IAAI,CAAC;CACf"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2026, CodeMatters. All rights reserved.
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
|
|
5
|
-
* in compliance with the License. You may obtain a copy of the License at
|
|
6
|
-
*
|
|
7
|
-
* https://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
*
|
|
9
|
-
* Unless required by applicable law or agreed to in writing, software distributed under the License
|
|
10
|
-
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
|
11
|
-
* or implied. See the License for the specific language governing permissions and limitations under
|
|
12
|
-
* the License.
|
|
13
|
-
*/
|
|
14
|
-
export {};
|
|
15
|
-
//# sourceMappingURL=agent-execution.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agent-execution.js","sourceRoot":"","sources":["../../src/entity/agent-execution.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG"}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import type { Message } from "@bufbuild/protobuf";
|
|
2
|
-
import type { AgentExecutionStorage, AgentExecutionStorageInput } from "../entity/agent-execution.js";
|
|
3
|
-
import type { StorageFactory } from "../storage/storage-factory.js";
|
|
4
|
-
/**
|
|
5
|
-
* Opens provider handles for durable Agent execution.
|
|
6
|
-
*/
|
|
7
|
-
export interface AgentExecutionStorageFactory {
|
|
8
|
-
/**
|
|
9
|
-
* Opens a closeable provider handle for one Agent repository.
|
|
10
|
-
*
|
|
11
|
-
* @typeParam I Typed Agent identifier.
|
|
12
|
-
* @typeParam S Generated Agent state.
|
|
13
|
-
* @param input Entity layout and generated Agent state type.
|
|
14
|
-
* @returns Provider execution handle.
|
|
15
|
-
*/
|
|
16
|
-
createAgentExecutionStorage<I, S extends Message>(input: AgentExecutionStorageInput<I, S>): AgentExecutionStorage<I, S>;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Registers and opens the provider-only durable Agent execution capability.
|
|
20
|
-
*/
|
|
21
|
-
export interface AgentExecutionFactoryAccess {
|
|
22
|
-
/**
|
|
23
|
-
* Returns whether a storage factory registered durable Agent execution.
|
|
24
|
-
*
|
|
25
|
-
* @param factory Storage factory checked at Bounded Context registration.
|
|
26
|
-
* @returns Whether the provider offers Agent execution handles.
|
|
27
|
-
*/
|
|
28
|
-
supports(factory: StorageFactory): boolean;
|
|
29
|
-
/**
|
|
30
|
-
* Registers a provider capability.
|
|
31
|
-
*
|
|
32
|
-
* @param factory Storage factory offering execution.
|
|
33
|
-
* @param creator Provider-specific handle creator.
|
|
34
|
-
*/
|
|
35
|
-
register(factory: StorageFactory, creator: AgentExecutionStorageFactory): void;
|
|
36
|
-
/**
|
|
37
|
-
* Opens the required provider capability.
|
|
38
|
-
*
|
|
39
|
-
* @typeParam I Typed Agent identifier.
|
|
40
|
-
* @typeParam S Generated Agent state.
|
|
41
|
-
* @param factory Storage factory offering execution.
|
|
42
|
-
* @param input Agent repository scope and Entity layout.
|
|
43
|
-
* @returns Closeable provider execution handle.
|
|
44
|
-
*/
|
|
45
|
-
create<I, S extends Message>(factory: StorageFactory, input: AgentExecutionStorageInput<I, S>): AgentExecutionStorage<I, S>;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Registers and creates provider execution handles without exposing them to applications.
|
|
49
|
-
*/
|
|
50
|
-
export declare const AgentExecutionStorageFactories: AgentExecutionFactoryAccess;
|
|
51
|
-
//# sourceMappingURL=agent-execution.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agent-execution.d.ts","sourceRoot":"","sources":["../../src/internal/agent-execution.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,KAAK,EACV,qBAAqB,EACrB,0BAA0B,EAC3B,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAEpE;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C;;;;;;;OAOG;IACH,2BAA2B,CAAC,CAAC,EAAE,CAAC,SAAS,OAAO,EAC9C,KAAK,EAAE,0BAA0B,CAAC,CAAC,EAAE,CAAC,CAAC,GACtC,qBAAqB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;CAChC;AAID;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC;IAE3C;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,4BAA4B,GAAG,IAAI,CAAC;IAE/E;;;;;;;;OAQG;IACH,MAAM,CAAC,CAAC,EAAE,CAAC,SAAS,OAAO,EACzB,OAAO,EAAE,cAAc,EACvB,KAAK,EAAE,0BAA0B,CAAC,CAAC,EAAE,CAAC,CAAC,GACtC,qBAAqB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;CAChC;AAED;;GAEG;AACH,eAAO,MAAM,8BAA8B,EAAE,2BAuC3C,CAAC"}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2026, CodeMatters. All rights reserved.
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
|
|
5
|
-
* in compliance with the License. You may obtain a copy of the License at
|
|
6
|
-
*
|
|
7
|
-
* https://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
*
|
|
9
|
-
* Unless required by applicable law or agreed to in writing, software distributed under the License
|
|
10
|
-
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
|
11
|
-
* or implied. See the License for the specific language governing permissions and limitations under
|
|
12
|
-
* the License.
|
|
13
|
-
*/
|
|
14
|
-
const factories = new WeakMap();
|
|
15
|
-
/**
|
|
16
|
-
* Registers and creates provider execution handles without exposing them to applications.
|
|
17
|
-
*/
|
|
18
|
-
export const AgentExecutionStorageFactories = Object.freeze({
|
|
19
|
-
/**
|
|
20
|
-
* Checks provider registration without selecting or fabricating a tenant.
|
|
21
|
-
*
|
|
22
|
-
* @param factory Storage factory checked at Bounded Context registration.
|
|
23
|
-
* @returns Whether the provider offers Agent execution handles.
|
|
24
|
-
*/
|
|
25
|
-
supports(factory) {
|
|
26
|
-
return factories.has(factory);
|
|
27
|
-
},
|
|
28
|
-
/**
|
|
29
|
-
* Registers one provider's execution capability.
|
|
30
|
-
*
|
|
31
|
-
* @param factory Storage factory offering execution.
|
|
32
|
-
* @param creator Provider-specific handle creator.
|
|
33
|
-
*/
|
|
34
|
-
register(factory, creator) {
|
|
35
|
-
factories.set(factory, creator);
|
|
36
|
-
},
|
|
37
|
-
/**
|
|
38
|
-
* Rejects providers without durable Agent execution support before intake.
|
|
39
|
-
*
|
|
40
|
-
* @typeParam I Typed Agent identifier.
|
|
41
|
-
* @typeParam S Generated Agent state.
|
|
42
|
-
* @param factory Storage factory offering execution.
|
|
43
|
-
* @param input Agent repository scope and Entity layout.
|
|
44
|
-
* @returns Closeable provider execution handle.
|
|
45
|
-
*/
|
|
46
|
-
create(factory, input) {
|
|
47
|
-
const creator = factories.get(factory);
|
|
48
|
-
if (creator === undefined)
|
|
49
|
-
throw new Error("StorageFactory does not provide durable Agent execution storage.");
|
|
50
|
-
return creator.createAgentExecutionStorage(input);
|
|
51
|
-
},
|
|
52
|
-
});
|
|
53
|
-
//# sourceMappingURL=agent-execution.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agent-execution.js","sourceRoot":"","sources":["../../src/internal/agent-execution.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AA2BH,MAAM,SAAS,GAAG,IAAI,OAAO,EAAgD,CAAC;AAqC9E;;GAEG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAgC,MAAM,CAAC,MAAM,CAAC;IACvF;;;;;OAKG;IACH,QAAQ,CAAC,OAAuB;QAC9B,OAAO,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAChC,CAAC;IAED;;;;;OAKG;IACH,QAAQ,CAAC,OAAuB,EAAE,OAAqC;QACrE,SAAS,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAClC,CAAC;IAED;;;;;;;;OAQG;IACH,MAAM,CACJ,OAAuB,EACvB,KAAuC;QAEvC,MAAM,OAAO,GAAG,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACvC,IAAI,OAAO,KAAK,SAAS;YACvB,MAAM,IAAI,KAAK,CAAC,kEAAkE,CAAC,CAAC;QACtF,OAAO,OAAO,CAAC,2BAA2B,CAAC,KAAK,CAAC,CAAC;IACpD,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import type { Message } from "@bufbuild/protobuf";
|
|
2
|
-
import type { RecordSpec } from "../record/record-spec.js";
|
|
3
|
-
import type { StorageContext } from "../storage/storage.js";
|
|
4
|
-
import type { StorageFactory } from "../storage/storage-factory.js";
|
|
5
|
-
/**
|
|
6
|
-
* Describes cooperative operation state at a provider safe boundary.
|
|
7
|
-
*/
|
|
8
|
-
export interface CleanupOperation {
|
|
9
|
-
/**
|
|
10
|
-
* Indicates whether cancellation has been requested.
|
|
11
|
-
*/
|
|
12
|
-
readonly signal?: {
|
|
13
|
-
readonly aborted: boolean;
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* Carries the admitted non-negative timeout budget.
|
|
17
|
-
*/
|
|
18
|
-
readonly timeoutMs?: number;
|
|
19
|
-
/**
|
|
20
|
-
* Determines whether the admission-relative deadline remains active.
|
|
21
|
-
*
|
|
22
|
-
* @returns Whether provider work remains within its admitted deadline.
|
|
23
|
-
*/
|
|
24
|
-
readonly isActive?: () => boolean;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Determines whether a cleanup operation may proceed at a provider safe boundary.
|
|
28
|
-
*
|
|
29
|
-
* @param operation Supplies cooperative cancellation and deadline state.
|
|
30
|
-
* @returns Whether provider work may continue.
|
|
31
|
-
*/
|
|
32
|
-
export declare function cleanupOperationActive(operation: CleanupOperation | undefined): boolean;
|
|
33
|
-
/**
|
|
34
|
-
* Describes provider input for one fenced exact delivered-row removal.
|
|
35
|
-
*/
|
|
36
|
-
export interface DeliveryCleanupInput<InboxId, InboxRecord extends Message, SessionId, SessionRecord extends Message> {
|
|
37
|
-
/**
|
|
38
|
-
* Selects the tenant and storage group containing both records.
|
|
39
|
-
*/
|
|
40
|
-
readonly context: StorageContext;
|
|
41
|
-
/**
|
|
42
|
-
* Carries cooperative cancellation and an internal admission-relative activity predicate.
|
|
43
|
-
*/
|
|
44
|
-
readonly operation?: CleanupOperation;
|
|
45
|
-
/**
|
|
46
|
-
* Describes the exact delivered Inbox record expected for deletion.
|
|
47
|
-
*/
|
|
48
|
-
readonly inbox: {
|
|
49
|
-
readonly spec: RecordSpec<InboxId, InboxRecord>;
|
|
50
|
-
readonly id: InboxId;
|
|
51
|
-
readonly expected: InboxRecord;
|
|
52
|
-
};
|
|
53
|
-
/**
|
|
54
|
-
* Describes the current shard-session record that fences deletion.
|
|
55
|
-
*/
|
|
56
|
-
readonly session: {
|
|
57
|
-
readonly spec: RecordSpec<SessionId, SessionRecord>;
|
|
58
|
-
readonly id: SessionId;
|
|
59
|
-
readonly expected: SessionRecord;
|
|
60
|
-
readonly isCurrent: (record: SessionRecord) => boolean;
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Defines a provider-owned handle for atomically deleting a fenced Inbox record.
|
|
65
|
-
*/
|
|
66
|
-
export interface DeliveryCleanupStorage {
|
|
67
|
-
/**
|
|
68
|
-
* Removes an exact Inbox record after validating the current session.
|
|
69
|
-
*
|
|
70
|
-
* @param input Describes the records and ownership predicate for deletion.
|
|
71
|
-
* @returns Whether the provider deleted the exact Inbox record.
|
|
72
|
-
*/
|
|
73
|
-
remove<InboxId, InboxRecord extends Message, SessionId, SessionRecord extends Message>(input: DeliveryCleanupInput<InboxId, InboxRecord, SessionId, SessionRecord>): Promise<boolean>;
|
|
74
|
-
/**
|
|
75
|
-
* Closes this cleanup handle to further removal operations.
|
|
76
|
-
*/
|
|
77
|
-
close(): void;
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Defines a provider factory capability narrower than a general transaction API.
|
|
81
|
-
*/
|
|
82
|
-
export interface DeliveryCleanupStorageFactory {
|
|
83
|
-
/**
|
|
84
|
-
* Creates a provider-owned cleanup handle.
|
|
85
|
-
*
|
|
86
|
-
* @returns The cleanup handle bound to this provider.
|
|
87
|
-
*/
|
|
88
|
-
createDeliveryCleanupStorage(): DeliveryCleanupStorage;
|
|
89
|
-
}
|
|
90
|
-
interface DeliveryCleanupFactoryAccess {
|
|
91
|
-
register(factory: StorageFactory, creator: DeliveryCleanupStorageFactory): void;
|
|
92
|
-
create(factory: StorageFactory): DeliveryCleanupStorage;
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Registers and resolves provider cleanup handles for direct delivery.
|
|
96
|
-
*/
|
|
97
|
-
export declare const DeliveryCleanupStorageFactories: DeliveryCleanupFactoryAccess;
|
|
98
|
-
export {};
|
|
99
|
-
//# sourceM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AAO,EAAE;QAChB,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;QACpD,QAAQ,CAAC,EAAE,EAAE,SAAS,CAAC;QACvB,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC;QACjC,QAAQ,CAAC,SAAS,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,OAAO,CAAC;KACxD,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IAGrC;;;;;OAKG;IACH,MAAM,CAAC,OAAO,EAAE,WAAW,SAAS,OAAO,EAAE,SAAS,EAAE,aAAa,SAAS,OAAO,EACnF,KAAK,EAAE,oBAAoB,CAAC,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,aAAa,CAAC,GAC1E,OAAO,CAAC,OAAO,CAAC,CAAC;IAGpB;;OAEG;IACH,KAAK,IAAI,IAAI,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,6BAA6B;IAG5C;;;;OAIG;IACH,4BAA4B,IAAI,sBAAsB,CAAC;CACxD;AAED,UAAU,4BAA4B;IACpC,QAAQ,CAAC,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,6BAA6B,GAAG,IAAI,CAAC;IAChF,MAAM,CAAC,OAAO,EAAE,cAAc,GAAG,sBAAsB,CAAC;CACzD;AAED;;GAEG;AACH,eAAO,MAAM,+BAA+B,EAAE,4BAU5C,CAAC"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2026, CodeMatters. All rights reserved.
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
|
|
5
|
-
* in compliance with the License. You may obtain a copy of the License at
|
|
6
|
-
*
|
|
7
|
-
* https://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
*
|
|
9
|
-
* Unless required by applicable law or agreed to in writing, software distributed under the License
|
|
10
|
-
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
|
11
|
-
* or implied. See the License for the specific language governing permissions and limitations under
|
|
12
|
-
* the License.
|
|
13
|
-
*/
|
|
14
|
-
/**
|
|
15
|
-
* Determines whether a cleanup operation may proceed at a provider safe boundary.
|
|
16
|
-
*
|
|
17
|
-
* @param operation Supplies cooperative cancellation and deadline state.
|
|
18
|
-
* @returns Whether provider work may continue.
|
|
19
|
-
*/
|
|
20
|
-
export function cleanupOperationActive(operation) {
|
|
21
|
-
return (!operation?.signal?.aborted && operation?.timeoutMs !== 0 && operation?.isActive?.() !== false);
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Registers and resolves provider cleanup handles for direct delivery.
|
|
25
|
-
*/
|
|
26
|
-
export const DeliveryCleanupStorageFactories = Object.freeze({
|
|
27
|
-
register(factory, creator) {
|
|
28
|
-
creators.set(factory, creator);
|
|
29
|
-
},
|
|
30
|
-
create(factory) {
|
|
31
|
-
const creator = creators.get(factory);
|
|
32
|
-
if (creator === undefined)
|
|
33
|
-
throw new Error("StorageFactory does not provide atomic delivery cleanup storage.");
|
|
34
|
-
return creator.createDeliveryCleanupStorage();
|
|
35
|
-
},
|
|
36
|
-
});
|
|
37
|
-
const creators = new WeakMap();
|
|
38
|
-
//# sourceMappingURL=delivery-cleanup.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"delivery-cleanup.js","sourceRoot":"","sources":["../../src/internal/delivery-cleanup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAgCH;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CAAC,SAAuC;IAC5E,OAAO,CACL,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,IAAI,SAAS,EAAE,SAAS,KAAK,CAAC,IAAI,SAAS,EAAE,QAAQ,EAAE,EAAE,KAAK,KAAK,CAC/F,CAAC;AACJ,CAAC;AAqFD;;GAEG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAiC,MAAM,CAAC,MAAM,CAAC;IACzF,QAAQ,CAAC,OAAuB,EAAE,OAAsC;QACtE,QAAQ,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACjC,CAAC;IACD,MAAM,CAAC,OAAuB;QAC5B,MAAM,OAAO,GAAG,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACtC,IAAI,OAAO,KAAK,SAAS;YACvB,MAAM,IAAI,KAAK,CAAC,kEAAkE,CAAC,CAAC;QACtF,OAAO,OAAO,CAAC,4BAA4B,EAAE,CAAC;IAChD,CAAC;CACF,CAAC,CAAC;AAEH,MAAM,QAAQ,GAAG,IAAI,OAAO,EAAiD,CAAC"}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import type { Timestamp } from "@bufbuild/protobuf/wkt";
|
|
2
|
-
import { type AgentExecutionHead } from "@spine-event-engine/proto/generated/spine/server/agent/execution_record_pb.js";
|
|
3
|
-
/**
|
|
4
|
-
* One complete observed head-index entry.
|
|
5
|
-
*/
|
|
6
|
-
export interface MemoryPendingHead {
|
|
7
|
-
/**
|
|
8
|
-
* Complete native-equivalent order key.
|
|
9
|
-
*/
|
|
10
|
-
readonly orderKey: string;
|
|
11
|
-
/**
|
|
12
|
-
* Independent head snapshot at the page read.
|
|
13
|
-
*/
|
|
14
|
-
readonly head: AgentExecutionHead;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Keeps one ordered discovery entry per Agent instance.
|
|
18
|
-
*/
|
|
19
|
-
export declare class MemoryPendingHeadIndex {
|
|
20
|
-
#private;
|
|
21
|
-
/**
|
|
22
|
-
* Replaces the visible entry for one complete Agent scope.
|
|
23
|
-
*
|
|
24
|
-
* @param head Per-instance pending and lease record.
|
|
25
|
-
* @param scope Generated state type and Agent key.
|
|
26
|
-
*/
|
|
27
|
-
set(scope: string, head: AgentExecutionHead): void;
|
|
28
|
-
/**
|
|
29
|
-
* Reads no more than count plus one candidate before the fixed cutoff.
|
|
30
|
-
*
|
|
31
|
-
* @param after Observed pending-page cursor.
|
|
32
|
-
* @param asOf Fixed eligibility cutoff for the page.
|
|
33
|
-
* @param count Maximum number of records in the page.
|
|
34
|
-
* @returns Ordered bounded per-instance head entries.
|
|
35
|
-
*/
|
|
36
|
-
page(after: string | undefined, asOf: Timestamp, count: number): readonly MemoryPendingHead[];
|
|
37
|
-
/**
|
|
38
|
-
* Finds the first index entry whose key is not smaller than value.
|
|
39
|
-
*
|
|
40
|
-
* @param value Value read from a provider boundary.
|
|
41
|
-
* @returns First matching index position.
|
|
42
|
-
*/
|
|
43
|
-
private lower;
|
|
44
|
-
/**
|
|
45
|
-
* Finds the first index entry strictly after the cursor.
|
|
46
|
-
*
|
|
47
|
-
* @param value Value read from a provider boundary.
|
|
48
|
-
* @returns Position after the last matching index entry.
|
|
49
|
-
*/
|
|
50
|
-
private upper;
|
|
51
|
-
}
|
|
52
|
-
//# sourceMappingURL=agent-execution-head-index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agent-execution-head-index.d.ts","sourceRoot":"","sources":["../../src/memory/agent-execution-head-index.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,+EAA+E,CAAC;AAIvF;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAE1B;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAC;CACnC;AAED;;GAEG;AACH,qBAAa,sBAAsB;;IAKjC;;;;;OAKG;IACH,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,kBAAkB,GAAG,IAAI;IAelD;;;;;;;OAOG;IACH,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,iBAAiB,EAAE;IAM7F;;;;;OAKG;IACH,OAAO,CAAC,KAAK;IAab;;;;;OAKG;IACH,OAAO,CAAC,KAAK;CAKd"}
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2026, CodeMatters. All rights reserved.
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
|
|
5
|
-
* in compliance with the License. You may obtain a copy of the License at
|
|
6
|
-
*
|
|
7
|
-
* https://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
*
|
|
9
|
-
* Unless required by applicable law or agreed to in writing, software distributed under the License
|
|
10
|
-
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
|
11
|
-
* or implied. See the License for the specific language governing permissions and limitations under
|
|
12
|
-
* the License.
|
|
13
|
-
*/
|
|
14
|
-
import { fromBinary, toBinary } from "@bufbuild/protobuf";
|
|
15
|
-
import { AgentExecutionHeadSchema, } from "@spine-event-engine/proto/generated/spine/server/agent/execution_record_pb.js";
|
|
16
|
-
import { AgentExecutionRecords } from "../entity/agent-execution-record-spec.js";
|
|
17
|
-
/**
|
|
18
|
-
* Keeps one ordered discovery entry per Agent instance.
|
|
19
|
-
*/
|
|
20
|
-
export class MemoryPendingHeadIndex {
|
|
21
|
-
#byScope = new Map();
|
|
22
|
-
#ordered = [];
|
|
23
|
-
/**
|
|
24
|
-
* Replaces the visible entry for one complete Agent scope.
|
|
25
|
-
*
|
|
26
|
-
* @param head Per-instance pending and lease record.
|
|
27
|
-
* @param scope Generated state type and Agent key.
|
|
28
|
-
*/
|
|
29
|
-
set(scope, head) {
|
|
30
|
-
const previous = this.#byScope.get(scope);
|
|
31
|
-
if (previous !== undefined)
|
|
32
|
-
this.#ordered.splice(this.lower(previous.orderKey), 1);
|
|
33
|
-
if (head.pending === undefined || head.eligibleAt === undefined || head.scope === undefined) {
|
|
34
|
-
this.#byScope.delete(scope);
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
const entry = {
|
|
38
|
-
orderKey: AgentExecutionRecords.pendingKey(head.eligibleAt, head.scope),
|
|
39
|
-
head: fromBinary(AgentExecutionHeadSchema, toBinary(AgentExecutionHeadSchema, head)),
|
|
40
|
-
};
|
|
41
|
-
this.#ordered.splice(this.lower(entry.orderKey), 0, entry);
|
|
42
|
-
this.#byScope.set(scope, entry);
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Reads no more than count plus one candidate before the fixed cutoff.
|
|
46
|
-
*
|
|
47
|
-
* @param after Observed pending-page cursor.
|
|
48
|
-
* @param asOf Fixed eligibility cutoff for the page.
|
|
49
|
-
* @param count Maximum number of records in the page.
|
|
50
|
-
* @returns Ordered bounded per-instance head entries.
|
|
51
|
-
*/
|
|
52
|
-
page(after, asOf, count) {
|
|
53
|
-
const start = after === undefined ? 0 : this.upper(after);
|
|
54
|
-
const end = this.lower(AgentExecutionRecords.pendingLower(asOf));
|
|
55
|
-
return this.#ordered.slice(start, Math.min(end, start + count + 1));
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Finds the first index entry whose key is not smaller than value.
|
|
59
|
-
*
|
|
60
|
-
* @param value Value read from a provider boundary.
|
|
61
|
-
* @returns First matching index position.
|
|
62
|
-
*/
|
|
63
|
-
lower(value) {
|
|
64
|
-
let left = 0;
|
|
65
|
-
let right = this.#ordered.length;
|
|
66
|
-
while (left < right) {
|
|
67
|
-
const middle = (left + right) >>> 1;
|
|
68
|
-
const entry = this.#ordered[middle];
|
|
69
|
-
if (entry === undefined)
|
|
70
|
-
throw new Error("Agent head index position is missing.");
|
|
71
|
-
if (entry.orderKey < value)
|
|
72
|
-
left = middle + 1;
|
|
73
|
-
else
|
|
74
|
-
right = middle;
|
|
75
|
-
}
|
|
76
|
-
return left;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Finds the first index entry strictly after the cursor.
|
|
80
|
-
*
|
|
81
|
-
* @param value Value read from a provider boundary.
|
|
82
|
-
* @returns Position after the last matching index entry.
|
|
83
|
-
*/
|
|
84
|
-
upper(value) {
|
|
85
|
-
let left = this.lower(value);
|
|
86
|
-
while (this.#ordered[left]?.orderKey === value)
|
|
87
|
-
left += 1;
|
|
88
|
-
return left;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
//# sourceMappingURL=agent-execution-head-index.js.map
|