@spine-event-engine/storage-mysql 2.0.0-snapshot.21 → 2.0.0-snapshot.23
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 +8 -0
- package/REFERENCE.md +39 -3
- package/dist/mysql/agent-execution.d.ts +278 -0
- package/dist/mysql/agent-execution.d.ts.map +1 -0
- package/dist/mysql/agent-execution.js +638 -0
- package/dist/mysql/agent-execution.js.map +1 -0
- package/dist/mysql/agent-history.d.ts +104 -0
- package/dist/mysql/agent-history.d.ts.map +1 -0
- package/dist/mysql/agent-history.js +212 -0
- package/dist/mysql/agent-history.js.map +1 -0
- package/dist/mysql/record-storage.d.ts +33 -0
- package/dist/mysql/record-storage.d.ts.map +1 -1
- package/dist/mysql/record-storage.js +92 -11
- package/dist/mysql/record-storage.js.map +1 -1
- package/dist/mysql/storage-factory.d.ts +22 -0
- package/dist/mysql/storage-factory.d.ts.map +1 -1
- package/dist/mysql/storage-factory.js +164 -11
- package/dist/mysql/storage-factory.js.map +1 -1
- package/dist/mysql/table-spec.d.ts +13 -0
- package/dist/mysql/table-spec.d.ts.map +1 -1
- package/dist/mysql/table-spec.js +81 -1
- package/dist/mysql/table-spec.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -5
|
@@ -0,0 +1,638 @@
|
|
|
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 { create, toBinary } from "@bufbuild/protobuf";
|
|
15
|
+
import { Time } from "@spine-event-engine/core";
|
|
16
|
+
import { AgentExecutionHeadSchema, AgentExecutionRecordSchema, AgentInvocationStatus, } from "@spine-event-engine/proto/generated/spine/server/agent/execution_record_pb.js";
|
|
17
|
+
import { AgentExecutionRecords, AgentExecutionSizes, AgentExecutionTransitions, AgentExecutionValues, AgentHistoryRecords, } from "@spine-event-engine/storage/provider";
|
|
18
|
+
import { AgentHistoryHash } from "./agent-history.js";
|
|
19
|
+
import { mysqlEntityLockKey, MysqlEntityCommitCoordinator } from "./entity-commit.js";
|
|
20
|
+
import { MysqlEntityStorage } from "./entity-history.js";
|
|
21
|
+
import { MysqlRecordStorage } from "./record-storage.js";
|
|
22
|
+
import { AgentExecutionIndexBytes } from "./table-spec.js";
|
|
23
|
+
/**
|
|
24
|
+
* Persists Agent claims and evidence through one required InnoDB transaction.
|
|
25
|
+
*
|
|
26
|
+
* @typeParam I Typed Agent identifier.
|
|
27
|
+
* @typeParam S Generated Agent state.
|
|
28
|
+
*/
|
|
29
|
+
export class MysqlAgentExecution {
|
|
30
|
+
input;
|
|
31
|
+
rows;
|
|
32
|
+
coordinator;
|
|
33
|
+
databaseName;
|
|
34
|
+
/**
|
|
35
|
+
* Native BLOB row limits for complete internal Protobuf wrappers.
|
|
36
|
+
*/
|
|
37
|
+
capacity = Object.freeze({
|
|
38
|
+
executionRecordBytes: 65_535,
|
|
39
|
+
executionHeadBytes: 65_535,
|
|
40
|
+
historyRecordBytes: 65_535,
|
|
41
|
+
});
|
|
42
|
+
#open = true;
|
|
43
|
+
#ready;
|
|
44
|
+
/**
|
|
45
|
+
* Binds tenant-scoped record families and the native transaction coordinator.
|
|
46
|
+
*
|
|
47
|
+
* @param coordinator Native transaction coordinator.
|
|
48
|
+
* @param databaseName Tenant database name.
|
|
49
|
+
* @param input Requested fenced execution change.
|
|
50
|
+
* @param rows Provider record handles bound to the tenant.
|
|
51
|
+
*/
|
|
52
|
+
constructor(input, rows, coordinator, databaseName) {
|
|
53
|
+
this.input = input;
|
|
54
|
+
this.rows = rows;
|
|
55
|
+
this.coordinator = coordinator;
|
|
56
|
+
this.databaseName = databaseName;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Persists original accepted work once under the per-instance row lock.
|
|
60
|
+
*
|
|
61
|
+
* @param accepted Original accepted signal and selected bindings.
|
|
62
|
+
* @returns Persisted invocation with the original accepted facts.
|
|
63
|
+
*/
|
|
64
|
+
async admit(accepted) {
|
|
65
|
+
const key = AgentExecutionValues.requiredKey(accepted.key, this.input.stateType);
|
|
66
|
+
await this.ready();
|
|
67
|
+
const record = create(AgentExecutionRecordSchema, {
|
|
68
|
+
accepted,
|
|
69
|
+
status: AgentInvocationStatus.AGENT_INVOCATION_ACCEPTED,
|
|
70
|
+
});
|
|
71
|
+
this.validateRecord(record);
|
|
72
|
+
return this.transaction(key, async () => {
|
|
73
|
+
const head = (await this.currentHead(key)) ?? create(AgentExecutionHeadSchema, { scope: key.scope });
|
|
74
|
+
const prior = await this.existing(key);
|
|
75
|
+
if (prior !== undefined) {
|
|
76
|
+
if (!AgentExecutionValues.sameAccepted(prior.accepted, accepted))
|
|
77
|
+
throw new Error("Agent execution admission conflicts with immutable source facts.");
|
|
78
|
+
return prior;
|
|
79
|
+
}
|
|
80
|
+
this.offerCandidate(head, record);
|
|
81
|
+
await this.rows.head.write(head);
|
|
82
|
+
await this.rows.invocation.writeImmutable(record);
|
|
83
|
+
return AgentExecutionValues.cloneRecord(record);
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Reads one bounded page from complete native pending indexes.
|
|
88
|
+
*
|
|
89
|
+
* @param request Bounded pending-page request.
|
|
90
|
+
* @returns Bounded eligible work and continuation cursor.
|
|
91
|
+
*/
|
|
92
|
+
async pending(request) {
|
|
93
|
+
await this.ready();
|
|
94
|
+
if (!Number.isSafeInteger(request.count) || request.count < 1)
|
|
95
|
+
throw new RangeError("Agent pending count must be a positive safe integer.");
|
|
96
|
+
const asOf = request.after?.asOf ?? Time.currentTime();
|
|
97
|
+
const { sql, values } = this.pendingQuery(request, asOf);
|
|
98
|
+
const found = await this.rows.head.historyPage(sql, values);
|
|
99
|
+
const observed = found.slice(0, request.count);
|
|
100
|
+
const records = [];
|
|
101
|
+
for (const head of observed) {
|
|
102
|
+
if (head.scope?.stateType !== this.input.stateType || head.pending === undefined)
|
|
103
|
+
throw new Error("MySQL Agent execution head scope or candidate is invalid.");
|
|
104
|
+
const record = await this.read(head.pending);
|
|
105
|
+
if (record !== undefined)
|
|
106
|
+
records.push(record);
|
|
107
|
+
}
|
|
108
|
+
const last = observed.at(-1);
|
|
109
|
+
return {
|
|
110
|
+
records,
|
|
111
|
+
hasMore: found.length > request.count,
|
|
112
|
+
...(last?.scope === undefined || last.eligibleAt === undefined
|
|
113
|
+
? {}
|
|
114
|
+
: { after: { asOf, key: { scope: last.scope, eligibleAt: last.eligibleAt } } }),
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Builds the indexed native query for one fixed eligibility cutoff.
|
|
119
|
+
*
|
|
120
|
+
* @param request Bounded pending-page request.
|
|
121
|
+
* @param asOf Fixed provider-time eligibility cutoff.
|
|
122
|
+
* @returns Native SQL and exact bound values.
|
|
123
|
+
*/
|
|
124
|
+
pendingQuery(request, asOf) {
|
|
125
|
+
const after = request.after?.key;
|
|
126
|
+
const values = [
|
|
127
|
+
AgentHistoryHash.value(this.input.stateType),
|
|
128
|
+
this.input.stateType,
|
|
129
|
+
AgentExecutionRecords.pendingLower(asOf),
|
|
130
|
+
];
|
|
131
|
+
const clauses = ["`state_digest`=?", "BINARY `state_type`=BINARY ?", "`pending_key`<?"];
|
|
132
|
+
if (after !== undefined) {
|
|
133
|
+
clauses.push("`pending_key`>?");
|
|
134
|
+
values.push(AgentExecutionRecords.pendingKey(after.eligibleAt, after.scope));
|
|
135
|
+
}
|
|
136
|
+
values.push(request.count + 1);
|
|
137
|
+
const sql = `SELECT \`bytes\` FROM \`${this.rows.head.tableName}\` WHERE ${clauses.join(" AND ")} ` +
|
|
138
|
+
"ORDER BY `pending_key` ASC LIMIT ?";
|
|
139
|
+
return { sql, values };
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Reads one complete invocation after provider reconstruction.
|
|
143
|
+
*
|
|
144
|
+
* @param key Original Agent invocation identity.
|
|
145
|
+
* @returns Complete stored invocation when present.
|
|
146
|
+
*/
|
|
147
|
+
async read(key) {
|
|
148
|
+
await this.ready();
|
|
149
|
+
const record = await this.rows.invocation.read(invocationId(AgentExecutionValues.requiredKey(key, this.input.stateType)));
|
|
150
|
+
this.checkIdentity(record, key);
|
|
151
|
+
return record;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Acquires earliest unresolved work and records the current exclusive token.
|
|
155
|
+
*
|
|
156
|
+
* @param expiresAt Requested future lease expiry.
|
|
157
|
+
* @param key Original Agent invocation identity.
|
|
158
|
+
* @param token Exclusive claim token.
|
|
159
|
+
* @returns Claimed work and preferences when eligible.
|
|
160
|
+
*/
|
|
161
|
+
async claim(key, token, expiresAt) {
|
|
162
|
+
await this.ready();
|
|
163
|
+
return this.transaction(key, () => this.claimLocked(key, token, expiresAt));
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Checks the locked instance and writes one current lease.
|
|
167
|
+
*
|
|
168
|
+
* @param key Original Agent invocation identity.
|
|
169
|
+
* @param token New exclusive claim token.
|
|
170
|
+
* @param expiresAt Requested future lease expiry.
|
|
171
|
+
* @returns Claimed record and preferences when eligible.
|
|
172
|
+
*/
|
|
173
|
+
async claimLocked(key, token, expiresAt) {
|
|
174
|
+
const now = Time.currentTime();
|
|
175
|
+
if (!token || AgentExecutionValues.compareTime(expiresAt, now) <= 0)
|
|
176
|
+
throw new TypeError("Agent claim requires a future expiry and token.");
|
|
177
|
+
const head = await this.currentHead(key);
|
|
178
|
+
const record = await this.existing(key);
|
|
179
|
+
if (head === undefined || record === undefined || !AgentExecutionValues.isPending(record, now))
|
|
180
|
+
return undefined;
|
|
181
|
+
if (!(await this.eligibleClaim(head, key, now)))
|
|
182
|
+
return undefined;
|
|
183
|
+
record.claimToken = token;
|
|
184
|
+
record.claimExpiresAt = expiresAt;
|
|
185
|
+
if (record.status === AgentInvocationStatus.AGENT_INVOCATION_ACCEPTED)
|
|
186
|
+
record.status = AgentInvocationStatus.AGENT_INVOCATION_ACTIVE;
|
|
187
|
+
head.active = key;
|
|
188
|
+
head.claimToken = token;
|
|
189
|
+
head.claimExpiresAt = expiresAt;
|
|
190
|
+
head.eligibleAt = expiresAt;
|
|
191
|
+
await this.rows.invocation.write(record);
|
|
192
|
+
await this.rows.head.write(head);
|
|
193
|
+
return {
|
|
194
|
+
record,
|
|
195
|
+
preferences: head.preferences.map((item) => item),
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Checks the current head and earliest same-instance source.
|
|
200
|
+
*
|
|
201
|
+
* @param head Per-instance pending and lease record.
|
|
202
|
+
* @param key Original Agent invocation identity.
|
|
203
|
+
* @param now Fresh time read in the locked transaction.
|
|
204
|
+
* @returns Whether this invocation may receive the next lease.
|
|
205
|
+
*/
|
|
206
|
+
async eligibleClaim(head, key, now) {
|
|
207
|
+
if (head.active !== undefined &&
|
|
208
|
+
head.claimExpiresAt !== undefined &&
|
|
209
|
+
AgentExecutionValues.compareTime(head.claimExpiresAt, now) > 0)
|
|
210
|
+
return false;
|
|
211
|
+
return (head.pending !== undefined &&
|
|
212
|
+
AgentExecutionRecords.invocation(head.pending) === AgentExecutionRecords.invocation(key) &&
|
|
213
|
+
(await this.earliest(key)));
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Updates a still-live token under a fresh transaction clock.
|
|
217
|
+
*
|
|
218
|
+
* @param expiresAt Requested future lease expiry.
|
|
219
|
+
* @param key Original Agent invocation identity.
|
|
220
|
+
* @param token Exclusive claim token.
|
|
221
|
+
* @returns Whether the current lease was extended.
|
|
222
|
+
*/
|
|
223
|
+
async renew(key, token, expiresAt) {
|
|
224
|
+
await this.ready();
|
|
225
|
+
return this.transaction(key, async () => {
|
|
226
|
+
const pair = await this.claimed(key, token);
|
|
227
|
+
if (pair?.record.claimExpiresAt === undefined ||
|
|
228
|
+
AgentExecutionValues.compareTime(expiresAt, pair.record.claimExpiresAt) <= 0)
|
|
229
|
+
return false;
|
|
230
|
+
pair.record.claimExpiresAt = expiresAt;
|
|
231
|
+
pair.head.claimExpiresAt = expiresAt;
|
|
232
|
+
pair.head.eligibleAt = expiresAt;
|
|
233
|
+
await this.rows.invocation.write(pair.record);
|
|
234
|
+
await this.rows.head.write(pair.head);
|
|
235
|
+
return true;
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Persists a journal update and its immutable history under one transaction.
|
|
240
|
+
*
|
|
241
|
+
* @param input Requested fenced execution change.
|
|
242
|
+
* @returns Completion after fenced evidence is persisted.
|
|
243
|
+
*/
|
|
244
|
+
async update(input) {
|
|
245
|
+
await this.ready();
|
|
246
|
+
this.validateRecord(input.next);
|
|
247
|
+
await this.transaction(input.key, async () => {
|
|
248
|
+
const pair = await this.expected(input);
|
|
249
|
+
AgentExecutionTransitions.assertUpdate(pair.record, input.next);
|
|
250
|
+
await this.appendHistory(input.key, input.historyEntries ?? []);
|
|
251
|
+
await this.rows.invocation.write(input.next);
|
|
252
|
+
if (input.next.status === AgentInvocationStatus.AGENT_INVOCATION_TERMINATED) {
|
|
253
|
+
await this.advanceCandidate(pair.head, input.key, AgentExecutionValues.requiredOrder(pair.record));
|
|
254
|
+
await this.rows.head.write(pair.head);
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Commits state, history, preferences and outgoing obligations together.
|
|
260
|
+
*
|
|
261
|
+
* @param input Requested fenced execution change.
|
|
262
|
+
* @returns Completion after conditional Entity and evidence commit.
|
|
263
|
+
*/
|
|
264
|
+
async complete(input) {
|
|
265
|
+
await this.ready();
|
|
266
|
+
this.validateRecord(input.next);
|
|
267
|
+
await this.transaction(input.key, async () => {
|
|
268
|
+
const pair = await this.expected(input);
|
|
269
|
+
const expectedVersion = this.validateCompletion(input, pair.record);
|
|
270
|
+
AgentExecutionTransitions.assertCompletion(input.next);
|
|
271
|
+
await this.completeEntity(input, expectedVersion);
|
|
272
|
+
await this.appendHistory(input.key, input.historyEntries ?? []);
|
|
273
|
+
await this.rows.invocation.write(input.next);
|
|
274
|
+
pair.head.preferences = AgentExecutionValues.requiredCompletion(input.next).preferences.map((item) => item);
|
|
275
|
+
if (input.next.status === AgentInvocationStatus.AGENT_INVOCATION_COMPLETED)
|
|
276
|
+
await this.advanceCandidate(pair.head, input.key, AgentExecutionValues.requiredOrder(pair.record));
|
|
277
|
+
await this.rows.head.write(pair.head);
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Marks original outgoing IDs delivered under the still-current token.
|
|
282
|
+
*
|
|
283
|
+
* @param expectedRecordBytes Exact prior execution record bytes.
|
|
284
|
+
* @param key Original Agent invocation identity.
|
|
285
|
+
* @param signals Original outgoing signal identities.
|
|
286
|
+
* @param token Exclusive claim token.
|
|
287
|
+
* @returns Completion after original output IDs are marked delivered.
|
|
288
|
+
*/
|
|
289
|
+
async markDelivered(key, token, expectedRecordBytes, signals) {
|
|
290
|
+
await this.ready();
|
|
291
|
+
await this.transaction(key, () => this.deliverLocked(key, token, expectedRecordBytes, signals));
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Marks exact saved output IDs within the current per-instance transaction.
|
|
295
|
+
*
|
|
296
|
+
* @param key Original Agent invocation identity.
|
|
297
|
+
* @param token Current exclusive claim token.
|
|
298
|
+
* @param expectedRecordBytes Exact prior execution record bytes.
|
|
299
|
+
* @param signals Original accepted output IDs.
|
|
300
|
+
* @returns Completion after persisted output status is updated.
|
|
301
|
+
*/
|
|
302
|
+
async deliverLocked(key, token, expectedRecordBytes, signals) {
|
|
303
|
+
const pair = await this.expected({
|
|
304
|
+
key,
|
|
305
|
+
token,
|
|
306
|
+
expectedRecordBytes,
|
|
307
|
+
next: create(AgentExecutionRecordSchema),
|
|
308
|
+
}, false);
|
|
309
|
+
if (pair.record.completion === undefined)
|
|
310
|
+
throw new Error("Agent execution has no completed output.");
|
|
311
|
+
AgentExecutionTransitions.assertDelivery(pair.record, signals);
|
|
312
|
+
for (const signal of signals)
|
|
313
|
+
AgentExecutionValues.markSignal(AgentExecutionValues.requiredCompletion(pair.record), signal);
|
|
314
|
+
if (pair.record.completion.outgoing.every((item) => item.delivered)) {
|
|
315
|
+
pair.record.status = AgentInvocationStatus.AGENT_INVOCATION_COMPLETED;
|
|
316
|
+
await this.advanceCandidate(pair.head, key, AgentExecutionValues.requiredOrder(pair.record));
|
|
317
|
+
}
|
|
318
|
+
await this.rows.invocation.write(pair.record);
|
|
319
|
+
await this.rows.head.write(pair.head);
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* Closes record handles without deleting accepted work.
|
|
323
|
+
*/
|
|
324
|
+
close() {
|
|
325
|
+
if (!this.#open)
|
|
326
|
+
return;
|
|
327
|
+
this.#open = false;
|
|
328
|
+
this.rows.invocation.close();
|
|
329
|
+
this.rows.head.close();
|
|
330
|
+
this.rows.history.close();
|
|
331
|
+
this.rows.entity.close();
|
|
332
|
+
this.rows.events.close();
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Prepares existing record families and verifies complete binary indexes.
|
|
336
|
+
*
|
|
337
|
+
* @returns Completion after provider capabilities are checked.
|
|
338
|
+
*/
|
|
339
|
+
ready() {
|
|
340
|
+
if (!this.#open)
|
|
341
|
+
throw new Error("Agent execution storage handle is closed.");
|
|
342
|
+
return (this.#ready ??= this.initialize());
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Prepares every table before transactions and checks the native indexes.
|
|
346
|
+
*
|
|
347
|
+
* @returns Completion after native tables and indexes are prepared.
|
|
348
|
+
*/
|
|
349
|
+
async initialize() {
|
|
350
|
+
await Promise.all([
|
|
351
|
+
this.rows.invocation.prepare(),
|
|
352
|
+
this.rows.head.prepare(),
|
|
353
|
+
this.rows.history.prepare(),
|
|
354
|
+
this.rows.entity.prepare(),
|
|
355
|
+
this.rows.events.prepare(),
|
|
356
|
+
]);
|
|
357
|
+
await this.rows.head.ensureHistoryIndex("agent_execution_pending", [
|
|
358
|
+
"state_digest",
|
|
359
|
+
"pending_key",
|
|
360
|
+
]);
|
|
361
|
+
await this.rows.invocation.ensureHistoryIndex("agent_execution_instance", [
|
|
362
|
+
"scope_digest",
|
|
363
|
+
"status",
|
|
364
|
+
"order_key",
|
|
365
|
+
]);
|
|
366
|
+
}
|
|
367
|
+
/**
|
|
368
|
+
* Executes all record-family work on one required InnoDB connection.
|
|
369
|
+
*
|
|
370
|
+
* @param key Original Agent invocation identity.
|
|
371
|
+
* @param work Operation executed inside the transaction.
|
|
372
|
+
* @returns Callback result after the native transaction commits.
|
|
373
|
+
* @typeParam T Result returned by the transaction callback.
|
|
374
|
+
*/
|
|
375
|
+
async transaction(key, work) {
|
|
376
|
+
AgentExecutionValues.requiredKey(key, this.input.stateType);
|
|
377
|
+
const rows = this.rows;
|
|
378
|
+
const tables = [
|
|
379
|
+
rows.invocation.tableName,
|
|
380
|
+
rows.head.tableName,
|
|
381
|
+
rows.history.tableName,
|
|
382
|
+
...rows.entity.tableNames(),
|
|
383
|
+
rows.events.tableName,
|
|
384
|
+
];
|
|
385
|
+
const lock = mysqlEntityLockKey({
|
|
386
|
+
databaseName: this.databaseName,
|
|
387
|
+
entityKey: AgentExecutionRecords.scope(AgentExecutionValues.requiredScope(key)),
|
|
388
|
+
sourceTypeName: this.input.stateType,
|
|
389
|
+
});
|
|
390
|
+
return this.coordinator.commit(tables, lock, (connection) => rows.invocation.withConnection(connection, () => rows.head.withConnection(connection, () => rows.history.withConnection(connection, () => rows.entity.withConnection(connection, () => rows.events.withConnection(connection, work))))), { requireTransaction: true });
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* Reads a head under the transaction lock and verifies the full scope.
|
|
394
|
+
*
|
|
395
|
+
* @param key Original Agent invocation identity.
|
|
396
|
+
* @returns Per-instance head when present.
|
|
397
|
+
*/
|
|
398
|
+
async currentHead(key) {
|
|
399
|
+
const scope = AgentExecutionValues.requiredScope(key);
|
|
400
|
+
const found = await this.rows.head.readLocked(AgentHistoryHash.value(AgentExecutionRecords.scope(scope)));
|
|
401
|
+
if (found !== undefined &&
|
|
402
|
+
AgentExecutionRecords.scope(AgentExecutionValues.requiredHeadScope(found)) !==
|
|
403
|
+
AgentExecutionRecords.scope(scope))
|
|
404
|
+
throw new Error("Agent execution head physical ID conflicts with another scope.");
|
|
405
|
+
return found;
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
* Reads the invocation under the transaction lock and verifies its identity.
|
|
409
|
+
*
|
|
410
|
+
* @param key Original Agent invocation identity.
|
|
411
|
+
* @returns Stored invocation when present.
|
|
412
|
+
*/
|
|
413
|
+
async existing(key) {
|
|
414
|
+
const found = await this.rows.invocation.readLocked(invocationId(key));
|
|
415
|
+
this.checkIdentity(found, key);
|
|
416
|
+
return found;
|
|
417
|
+
}
|
|
418
|
+
/**
|
|
419
|
+
* Rejects a physical digest collision on an invocation row.
|
|
420
|
+
*
|
|
421
|
+
* @param found Stored record read in this transaction.
|
|
422
|
+
* @param key Original Agent invocation identity.
|
|
423
|
+
*/
|
|
424
|
+
checkIdentity(found, key) {
|
|
425
|
+
if (found !== undefined &&
|
|
426
|
+
AgentExecutionRecords.invocation(AgentExecutionValues.requiredKey(AgentExecutionValues.requiredAccepted(found).key, this.input.stateType)) !== AgentExecutionRecords.invocation(key))
|
|
427
|
+
throw new Error("Agent execution physical ID conflicts with another invocation.");
|
|
428
|
+
}
|
|
429
|
+
/**
|
|
430
|
+
* Checks this is the earliest unresolved invocation in the full scope.
|
|
431
|
+
*
|
|
432
|
+
* @param key Original Agent invocation identity.
|
|
433
|
+
* @returns Whether this invocation is earliest unresolved work.
|
|
434
|
+
*/
|
|
435
|
+
async earliest(key) {
|
|
436
|
+
const first = await this.successor(key);
|
|
437
|
+
return (first !== undefined &&
|
|
438
|
+
AgentExecutionRecords.invocation(AgentExecutionValues.requiredInvocation(first)) ===
|
|
439
|
+
AgentExecutionRecords.invocation(key));
|
|
440
|
+
}
|
|
441
|
+
/**
|
|
442
|
+
* Reads at most two native rows for each unresolved status.
|
|
443
|
+
*
|
|
444
|
+
* @param exclude Invocation omitted while selecting the successor.
|
|
445
|
+
* @param key Original Agent invocation identity.
|
|
446
|
+
* @returns Earliest unresolved invocation when present.
|
|
447
|
+
*/
|
|
448
|
+
async successor(key, exclude) {
|
|
449
|
+
const scope = AgentExecutionValues.requiredScope(key);
|
|
450
|
+
const candidates = [];
|
|
451
|
+
for (const status of ["1", "2", "3"]) {
|
|
452
|
+
const sql = `SELECT \`bytes\` FROM \`${this.rows.invocation.tableName}\` WHERE ` +
|
|
453
|
+
"`scope_digest`=? AND BINARY `state_type`=BINARY ? AND BINARY `agent_key`=BINARY ? " +
|
|
454
|
+
"AND `status`=? ORDER BY `order_key` ASC LIMIT 2";
|
|
455
|
+
candidates.push(...(await this.rows.invocation.historyPage(sql, [
|
|
456
|
+
AgentHistoryHash.value(AgentExecutionRecords.scope(scope)),
|
|
457
|
+
scope.stateType,
|
|
458
|
+
scope.agentKey,
|
|
459
|
+
status,
|
|
460
|
+
])));
|
|
461
|
+
}
|
|
462
|
+
return candidates
|
|
463
|
+
.filter((record) => exclude === undefined ||
|
|
464
|
+
AgentExecutionRecords.invocation(AgentExecutionValues.requiredInvocation(record)) !==
|
|
465
|
+
AgentExecutionRecords.invocation(exclude))
|
|
466
|
+
.sort((left, right) => AgentExecutionValues.compareText(AgentExecutionRecords.order(AgentExecutionValues.requiredOrder(left)), AgentExecutionRecords.order(AgentExecutionValues.requiredOrder(right))))[0];
|
|
467
|
+
}
|
|
468
|
+
/**
|
|
469
|
+
* Adds an earlier source while retaining the prior eligibility value.
|
|
470
|
+
*
|
|
471
|
+
* @param head Per-instance pending and lease record.
|
|
472
|
+
* @param record Persisted Agent execution record.
|
|
473
|
+
*/
|
|
474
|
+
offerCandidate(head, record) {
|
|
475
|
+
AgentExecutionValues.offerCandidate(head, record);
|
|
476
|
+
this.validateHead(head);
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
* Updates terminal work to the next same-instance source in one transaction.
|
|
480
|
+
*
|
|
481
|
+
* @param head Per-instance pending and lease record.
|
|
482
|
+
* @param key Original Agent invocation identity.
|
|
483
|
+
* @param order Original Inbox order.
|
|
484
|
+
* @returns Completion after updating the next pending head.
|
|
485
|
+
*/
|
|
486
|
+
async advanceCandidate(head, key, order) {
|
|
487
|
+
const next = await this.successor(key, key);
|
|
488
|
+
AgentExecutionValues.advanceCandidate(head, order, next);
|
|
489
|
+
this.validateHead(head);
|
|
490
|
+
}
|
|
491
|
+
/**
|
|
492
|
+
* Reads the current claim with fresh Time inside the native transaction.
|
|
493
|
+
*
|
|
494
|
+
* @param key Original Agent invocation identity.
|
|
495
|
+
* @param token Exclusive claim token.
|
|
496
|
+
* @returns Current record and head if the token remains valid.
|
|
497
|
+
*/
|
|
498
|
+
async claimed(key, token) {
|
|
499
|
+
const head = await this.currentHead(key);
|
|
500
|
+
const record = await this.existing(key);
|
|
501
|
+
if (!token ||
|
|
502
|
+
head?.claimToken !== token ||
|
|
503
|
+
record?.claimToken !== token ||
|
|
504
|
+
head.claimExpiresAt === undefined ||
|
|
505
|
+
AgentExecutionValues.compareTime(head.claimExpiresAt, Time.currentTime()) <= 0)
|
|
506
|
+
return undefined;
|
|
507
|
+
return { head, record };
|
|
508
|
+
}
|
|
509
|
+
/**
|
|
510
|
+
* Checks exact prior bytes and preserves immutable source facts.
|
|
511
|
+
*
|
|
512
|
+
* @param checkNext Whether to validate the proposed next record.
|
|
513
|
+
* @param input Requested fenced execution change.
|
|
514
|
+
* @returns Current fenced record and head.
|
|
515
|
+
*/
|
|
516
|
+
async expected(input, checkNext = true) {
|
|
517
|
+
const pair = await this.claimed(input.key, input.token);
|
|
518
|
+
if (pair === undefined ||
|
|
519
|
+
!AgentExecutionValues.sameBytes(toBinary(AgentExecutionRecordSchema, pair.record), input.expectedRecordBytes))
|
|
520
|
+
throw new Error("Agent execution claim or expected record is no longer current.");
|
|
521
|
+
if (checkNext && !AgentExecutionValues.sameAccepted(pair.record.accepted, input.next.accepted))
|
|
522
|
+
throw new Error("Agent execution cannot change immutable accepted source facts.");
|
|
523
|
+
return pair;
|
|
524
|
+
}
|
|
525
|
+
/**
|
|
526
|
+
* Prepares immutable history records under the same fenced transaction.
|
|
527
|
+
*
|
|
528
|
+
* @param entries Immutable history entries to append.
|
|
529
|
+
* @param key Original Agent invocation identity.
|
|
530
|
+
* @returns Completion after immutable history is appended.
|
|
531
|
+
*/
|
|
532
|
+
async appendHistory(key, entries) {
|
|
533
|
+
const scope = AgentExecutionValues.requiredScope(key);
|
|
534
|
+
for (const entry of entries)
|
|
535
|
+
if (AgentExecutionSizes.history(scope, entry) > this.capacity.historyRecordBytes)
|
|
536
|
+
throw new RangeError("Agent history record exceeds MySQL BLOB capacity.");
|
|
537
|
+
const records = entries.map((entry) => AgentHistoryRecords.record(scope.stateType, scope.agentKey, entry));
|
|
538
|
+
for (const record of records)
|
|
539
|
+
await this.rows.history.assertImmutable(record);
|
|
540
|
+
for (const record of records)
|
|
541
|
+
await this.rows.history.writeImmutable(record);
|
|
542
|
+
}
|
|
543
|
+
/**
|
|
544
|
+
* Rejects a changed initial Version and applies Entity rows in this transaction.
|
|
545
|
+
*
|
|
546
|
+
* @param expectedVersion Expected current Entity Version.
|
|
547
|
+
* @param input Requested fenced execution change.
|
|
548
|
+
* @returns Completion after conditional Entity state and Version write.
|
|
549
|
+
*/
|
|
550
|
+
async completeEntity(input, expectedVersion) {
|
|
551
|
+
const recipient = AgentExecutionValues.requiredAccepted(input.next).recipientId;
|
|
552
|
+
const id = recipient === undefined ? undefined : this.input.entity.id.unpack(recipient);
|
|
553
|
+
if (id === undefined)
|
|
554
|
+
throw new TypeError("Agent completion recipient ID has the wrong type.");
|
|
555
|
+
const current = await this.rows.entity.readCurrentLocked(id);
|
|
556
|
+
if ((current?.version?.number ?? 0) !== expectedVersion)
|
|
557
|
+
throw new Error("Agent execution initial Entity Version is no longer current.");
|
|
558
|
+
const commit = input.entityCommit;
|
|
559
|
+
if (commit === undefined)
|
|
560
|
+
return;
|
|
561
|
+
if (commit.entity.sourceType.typeName !== this.input.entity.sourceType.typeName ||
|
|
562
|
+
this.input.entity.id.key(commit.entityId) !== this.input.entity.id.key(id))
|
|
563
|
+
throw new TypeError("Agent Entity commit scope differs from accepted recipient.");
|
|
564
|
+
if (!this.input.entity.stateHistory && (commit.states?.length ?? 0) > 0)
|
|
565
|
+
throw new Error("Agent Entity state history is disabled.");
|
|
566
|
+
if (!this.input.entity.eventHistory && (commit.diagnostics?.length ?? 0) > 0)
|
|
567
|
+
throw new Error("Agent Entity diagnostic history is disabled.");
|
|
568
|
+
for (const state of commit.states ?? [])
|
|
569
|
+
await this.rows.entity.commitCapability().appendStateImmutable(state);
|
|
570
|
+
for (const diagnostic of commit.diagnostics ?? [])
|
|
571
|
+
await this.rows.entity.commitCapability().appendDiagnosticImmutable(diagnostic);
|
|
572
|
+
for (const event of commit.events ?? [])
|
|
573
|
+
await this.rows.events.writeImmutable(event);
|
|
574
|
+
await this.rows.entity.current.write(commit.next);
|
|
575
|
+
}
|
|
576
|
+
/**
|
|
577
|
+
* Checks exactly one Version advance or a no-op completion.
|
|
578
|
+
*
|
|
579
|
+
* @param input Requested fenced execution change.
|
|
580
|
+
* @param prior Previously persisted execution record.
|
|
581
|
+
* @returns Expected initial Entity Version.
|
|
582
|
+
*/
|
|
583
|
+
validateCompletion(input, prior) {
|
|
584
|
+
const completion = input.next.completion;
|
|
585
|
+
if (completion?.initialVersion === undefined ||
|
|
586
|
+
completion.resultingVersion === undefined ||
|
|
587
|
+
input.next.accepted === undefined ||
|
|
588
|
+
!AgentExecutionValues.sameAccepted(prior.accepted, input.next.accepted))
|
|
589
|
+
throw new TypeError("Agent completion requires immutable acceptance and both Versions.");
|
|
590
|
+
if (prior.status !== AgentInvocationStatus.AGENT_INVOCATION_ACTIVE ||
|
|
591
|
+
![
|
|
592
|
+
AgentInvocationStatus.AGENT_INVOCATION_COMPLETED,
|
|
593
|
+
AgentInvocationStatus.AGENT_INVOCATION_COMPLETED_PENDING_DELIVERY,
|
|
594
|
+
].includes(input.next.status))
|
|
595
|
+
throw new Error("Agent completion requires active work and completed status.");
|
|
596
|
+
const initial = completion.initialVersion.number;
|
|
597
|
+
const final = completion.resultingVersion.number;
|
|
598
|
+
if (input.entityCommit === undefined
|
|
599
|
+
? final !== initial
|
|
600
|
+
: final !== initial + 1 || input.entityCommit.next.version?.number !== final)
|
|
601
|
+
throw new Error("Agent completion must commit exactly one Version or a no-op.");
|
|
602
|
+
return initial;
|
|
603
|
+
}
|
|
604
|
+
/**
|
|
605
|
+
* Rejects values outside the full InnoDB index or record payload budget.
|
|
606
|
+
*
|
|
607
|
+
* @param record Persisted Agent execution record.
|
|
608
|
+
*/
|
|
609
|
+
validateRecord(record) {
|
|
610
|
+
const key = record.accepted?.key;
|
|
611
|
+
if (key?.scope === undefined || record.accepted?.order === undefined)
|
|
612
|
+
throw new TypeError("Agent execution requires immutable acceptance and Inbox order.");
|
|
613
|
+
if (AgentExecutionRecords.order(record.accepted.order).length > AgentExecutionIndexBytes)
|
|
614
|
+
throw new RangeError("Agent execution key exceeds the complete MySQL index capacity.");
|
|
615
|
+
if (AgentExecutionSizes.record(record) > this.capacity.executionRecordBytes)
|
|
616
|
+
throw new RangeError("Agent execution record exceeds the MySQL BLOB capacity.");
|
|
617
|
+
}
|
|
618
|
+
/**
|
|
619
|
+
* Checks complete indexed discovery and native record payload budgets.
|
|
620
|
+
*
|
|
621
|
+
* @param head Per-instance pending and lease record.
|
|
622
|
+
*/
|
|
623
|
+
validateHead(head) {
|
|
624
|
+
if (head.pending !== undefined &&
|
|
625
|
+
head.eligibleAt !== undefined &&
|
|
626
|
+
AgentExecutionRecords.pendingKey(head.eligibleAt, AgentExecutionValues.requiredHeadScope(head)).length > AgentExecutionIndexBytes)
|
|
627
|
+
throw new RangeError("Agent head key exceeds complete MySQL index capacity.");
|
|
628
|
+
if (AgentExecutionSizes.head(head) > this.capacity.executionHeadBytes)
|
|
629
|
+
throw new RangeError("Agent execution head exceeds MySQL BLOB capacity.");
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
/**
|
|
633
|
+
* Maps a complete immutable invocation identity to one physical row.
|
|
634
|
+
*/
|
|
635
|
+
function invocationId(key) {
|
|
636
|
+
return AgentHistoryHash.value(AgentExecutionRecords.invocation(key));
|
|
637
|
+
}
|
|
638
|
+
//# sourceMappingURL=agent-execution.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-execution.js","sourceRoot":"","sources":["../../src/mysql/agent-execution.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAgB,MAAM,oBAAoB,CAAC;AAEpE,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAGhD,OAAO,EACL,wBAAwB,EACxB,0BAA0B,EAC1B,qBAAqB,GAMtB,MAAM,+EAA+E,CAAC;AAEvF,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,yBAAyB,EACzB,oBAAoB,EACpB,mBAAmB,GASpB,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AACtF,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD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