@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,87 +0,0 @@
|
|
|
1
|
-
import type { Timestamp } from "@bufbuild/protobuf/wkt";
|
|
2
|
-
import { type AgentExecutionHead, type AgentExecutionRecord, type AgentExecutionScope, type AgentInboxOrder, type AgentInvocationKey, type AgentSignalKey } from "@spine-event-engine/proto/generated/spine/server/agent/execution_record_pb.js";
|
|
3
|
-
import { RecordSpec } from "../record/record-spec.js";
|
|
4
|
-
import { StorageGroup } from "../record/storage-group.js";
|
|
5
|
-
/**
|
|
6
|
-
* Describes physical execution record families and their indexed keys.
|
|
7
|
-
*/
|
|
8
|
-
interface AgentExecutionRecordLayout {
|
|
9
|
-
/**
|
|
10
|
-
* Shared invocation record family.
|
|
11
|
-
*/
|
|
12
|
-
readonly invocationGroup: StorageGroup;
|
|
13
|
-
/**
|
|
14
|
-
* Shared per-instance claim and preference family.
|
|
15
|
-
*/
|
|
16
|
-
readonly headGroup: StorageGroup;
|
|
17
|
-
/**
|
|
18
|
-
* Encodes the complete Agent instance scope.
|
|
19
|
-
*
|
|
20
|
-
* @param scope Generated state type and Agent key.
|
|
21
|
-
* @returns Complete encoded Agent instance scope.
|
|
22
|
-
*/
|
|
23
|
-
scope(scope: AgentExecutionScope): string;
|
|
24
|
-
/**
|
|
25
|
-
* Encodes full Agent scope for binary-collated continuations.
|
|
26
|
-
*
|
|
27
|
-
* @param scope Generated state type and Agent key.
|
|
28
|
-
* @returns Binary-collated Agent instance scope key.
|
|
29
|
-
*/
|
|
30
|
-
scopeOrder(scope: AgentExecutionScope): string;
|
|
31
|
-
/**
|
|
32
|
-
* Encodes the original source and Agent scope.
|
|
33
|
-
*
|
|
34
|
-
* @param key Original Agent invocation identity.
|
|
35
|
-
* @returns Complete immutable invocation key.
|
|
36
|
-
*/
|
|
37
|
-
invocation(key: AgentInvocationKey): string;
|
|
38
|
-
/**
|
|
39
|
-
* Encodes the typed original Command or Event ID.
|
|
40
|
-
*
|
|
41
|
-
* @param signal Original signal identity.
|
|
42
|
-
* @returns Complete typed source signal key.
|
|
43
|
-
*/
|
|
44
|
-
signal(signal: AgentSignalKey): string;
|
|
45
|
-
/**
|
|
46
|
-
* Encodes full Inbox time, version and source ID for binary order.
|
|
47
|
-
*
|
|
48
|
-
* @param order Original Inbox order.
|
|
49
|
-
* @returns Complete binary-collated Inbox order key.
|
|
50
|
-
*/
|
|
51
|
-
order(order: AgentInboxOrder): string;
|
|
52
|
-
/**
|
|
53
|
-
* Encodes provider eligibility time and complete Agent scope.
|
|
54
|
-
*
|
|
55
|
-
* @param eligibleAt Time when this head becomes eligible.
|
|
56
|
-
* @param scope Generated state type and Agent key.
|
|
57
|
-
* @returns Complete binary-collated eligibility and scope key.
|
|
58
|
-
*/
|
|
59
|
-
pendingKey(eligibleAt: Timestamp, scope: AgentExecutionScope): string;
|
|
60
|
-
/**
|
|
61
|
-
* Encodes the strict upper bound before all scopes at this time.
|
|
62
|
-
*
|
|
63
|
-
* @param asOf Fixed eligibility cutoff for the page.
|
|
64
|
-
* @returns Strict eligibility upper-bound key.
|
|
65
|
-
*/
|
|
66
|
-
pendingLower(asOf: Timestamp): string;
|
|
67
|
-
/**
|
|
68
|
-
* Creates the indexed invocation record specification.
|
|
69
|
-
*
|
|
70
|
-
* @param digest Fixed-width digest of the complete indexed value.
|
|
71
|
-
* @returns Invocation record layout and complete native index columns.
|
|
72
|
-
*/
|
|
73
|
-
invocationSpec(digest: (value: string) => string): RecordSpec<string, AgentExecutionRecord>;
|
|
74
|
-
/**
|
|
75
|
-
* Creates the indexed per-instance head specification.
|
|
76
|
-
*
|
|
77
|
-
* @param digest Fixed-width digest of the complete indexed value.
|
|
78
|
-
* @returns Per-instance head layout and complete native index columns.
|
|
79
|
-
*/
|
|
80
|
-
headSpec(digest: (value: string) => string): RecordSpec<string, AgentExecutionHead>;
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Materializes complete Agent execution records and full indexed identities.
|
|
84
|
-
*/
|
|
85
|
-
export declare const AgentExecutionRecords: AgentExecutionRecordLayout;
|
|
86
|
-
export {};
|
|
87
|
-
//# sourceMappingURL=agent-execution-record-spec.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agent-execution-record-spec.d.ts","sourceRoot":"","sources":["../../src/entity/agent-execution-record-spec.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAGL,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACpB,MAAM,+EAA+E,CAAC;AAIvF,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAM1D;;GAEG;AACH,UAAU,0BAA0B;IAClC;;OAEG;IACH,QAAQ,CAAC,eAAe,EAAE,YAAY,CAAC;IAEvC;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,YAAY,CAAC;IAEjC;;;;;OAKG;IACH,KAAK,CAAC,KAAK,EAAE,mBAAmB,GAAG,MAAM,CAAC;IAE1C;;;;;OAKG;IACH,UAAU,CAAC,KAAK,EAAE,mBAAmB,GAAG,MAAM,CAAC;IAE/C;;;;;OAKG;IACH,UAAU,CAAC,GAAG,EAAE,kBAAkB,GAAG,MAAM,CAAC;IAE5C;;;;;OAKG;IACH,MAAM,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,CAAC;IAEvC;;;;;OAKG;IACH,KAAK,CAAC,KAAK,EAAE,eAAe,GAAG,MAAM,CAAC;IAEtC;;;;;;OAMG;IACH,UAAU,CAAC,UAAU,EAAE,SAAS,EAAE,KAAK,EAAE,mBAAmB,GAAG,MAAM,CAAC;IAEtE;;;;;OAKG;IACH,YAAY,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAAC;IAEtC;;;;;OAKG;IACH,cAAc,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,GAAG,UAAU,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;IAE5F;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,GAAG,UAAU,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;CACrF;AAED;;GAEG;AACH,eAAO,MAAM,qBAAqB,EAAE,0BA8KnC,CAAC"}
|
|
@@ -1,230 +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 { ScalarType } from "@bufbuild/protobuf";
|
|
15
|
-
import { AgentExecutionHeadSchema, AgentExecutionRecordSchema, } from "@spine-event-engine/proto/generated/spine/server/agent/execution_record_pb.js";
|
|
16
|
-
import { RecordColumn } from "../record/record-column.js";
|
|
17
|
-
import { ColumnTypes } from "../record/column-type.js";
|
|
18
|
-
import { RecordSpec } from "../record/record-spec.js";
|
|
19
|
-
import { StorageGroup } from "../record/storage-group.js";
|
|
20
|
-
const string = ColumnTypes.scalar(ScalarType.STRING);
|
|
21
|
-
const invocationGroup = new StorageGroup("agent_execution");
|
|
22
|
-
const headGroup = new StorageGroup("agent_execution_head");
|
|
23
|
-
/**
|
|
24
|
-
* Materializes complete Agent execution records and full indexed identities.
|
|
25
|
-
*/
|
|
26
|
-
export const AgentExecutionRecords = {
|
|
27
|
-
/**
|
|
28
|
-
* Shared physical invocation family inside one provider tenant.
|
|
29
|
-
*/
|
|
30
|
-
invocationGroup: invocationGroup,
|
|
31
|
-
/**
|
|
32
|
-
* Shared physical per-instance head family inside one provider tenant.
|
|
33
|
-
*/
|
|
34
|
-
headGroup: headGroup,
|
|
35
|
-
/**
|
|
36
|
-
* Encodes complete Agent scope without truncation.
|
|
37
|
-
*
|
|
38
|
-
* @param scope Generated state type and canonical typed Agent key.
|
|
39
|
-
* @returns Unambiguous complete scope text.
|
|
40
|
-
*/
|
|
41
|
-
scope(scope) {
|
|
42
|
-
if (!scope.stateType || !scope.agentKey)
|
|
43
|
-
throw new TypeError("Agent execution requires complete state type and Agent key.");
|
|
44
|
-
return JSON.stringify([scope.stateType, scope.agentKey]);
|
|
45
|
-
},
|
|
46
|
-
/**
|
|
47
|
-
* Encodes every scope byte for unambiguous binary continuation order.
|
|
48
|
-
*
|
|
49
|
-
* @param scope Generated state type and canonical typed Agent key.
|
|
50
|
-
* @returns Prefix-safe full ordering text.
|
|
51
|
-
*/
|
|
52
|
-
scopeOrder(scope) {
|
|
53
|
-
this.scope(scope);
|
|
54
|
-
return `${utf8Hex(scope.stateType)}!${utf8Hex(scope.agentKey)}`;
|
|
55
|
-
},
|
|
56
|
-
/**
|
|
57
|
-
* Encodes one original source identity within its Agent scope.
|
|
58
|
-
*
|
|
59
|
-
* @param key Agent instance and original Command or Event ID.
|
|
60
|
-
* @returns Complete immutable invocation identity.
|
|
61
|
-
*/
|
|
62
|
-
invocation(key) {
|
|
63
|
-
if (key.scope === undefined || key.sourceSignal === undefined)
|
|
64
|
-
throw new TypeError("Agent execution requires scope and original source ID.");
|
|
65
|
-
return JSON.stringify([this.scope(key.scope), this.signal(key.sourceSignal)]);
|
|
66
|
-
},
|
|
67
|
-
/**
|
|
68
|
-
* Encodes a typed source ID without optional MessageId Version metadata.
|
|
69
|
-
*
|
|
70
|
-
* @param signal Original Command or Event identity.
|
|
71
|
-
* @returns Complete typed source identity.
|
|
72
|
-
*/
|
|
73
|
-
signal(signal) {
|
|
74
|
-
const id = signal.id;
|
|
75
|
-
if (id.case === "command" && id.value.uuid)
|
|
76
|
-
return JSON.stringify(["command", id.value.uuid]);
|
|
77
|
-
if (id.case === "event" && id.value.value)
|
|
78
|
-
return JSON.stringify(["event", id.value.value]);
|
|
79
|
-
throw new TypeError("Agent execution requires an original Command or Event ID.");
|
|
80
|
-
},
|
|
81
|
-
/**
|
|
82
|
-
* Encodes full Timestamp, Inbox version and source ID for native binary order.
|
|
83
|
-
*
|
|
84
|
-
* @param order Existing Inbox acceptance order.
|
|
85
|
-
* @returns Prefix-safe order text.
|
|
86
|
-
*/
|
|
87
|
-
order(order) {
|
|
88
|
-
const at = order.receivedAt;
|
|
89
|
-
if (at === undefined ||
|
|
90
|
-
order.sourceSignal === undefined ||
|
|
91
|
-
order.inboxVersion < 0n ||
|
|
92
|
-
order.inboxVersion > 18446744073709551615n)
|
|
93
|
-
throw new TypeError("Agent execution requires complete Inbox order.");
|
|
94
|
-
if (at.seconds < -62135596800n ||
|
|
95
|
-
at.seconds > 253402300799n ||
|
|
96
|
-
at.nanos < 0 ||
|
|
97
|
-
at.nanos > 999_999_999)
|
|
98
|
-
throw new RangeError("Agent Inbox Timestamp is out of range.");
|
|
99
|
-
const seconds = (at.seconds + 62135596800n).toString().padStart(12, "0");
|
|
100
|
-
const nanos = at.nanos.toString().padStart(9, "0");
|
|
101
|
-
const version = order.inboxVersion.toString().padStart(20, "0");
|
|
102
|
-
const signal = order.sourceSignal.id;
|
|
103
|
-
const id = signal.case === "command"
|
|
104
|
-
? signal.value.uuid
|
|
105
|
-
: signal.case === "event"
|
|
106
|
-
? signal.value.value
|
|
107
|
-
: undefined;
|
|
108
|
-
if (!id)
|
|
109
|
-
throw new TypeError("Agent Inbox order requires an original source ID.");
|
|
110
|
-
const rank = signal.case === "command" ? "0" : "1";
|
|
111
|
-
return `${seconds}:${nanos}:${version}:${rank}${utf8Hex(id)}`;
|
|
112
|
-
},
|
|
113
|
-
/**
|
|
114
|
-
* Encodes full provider eligibility time and complete instance scope.
|
|
115
|
-
*
|
|
116
|
-
* @param eligibleAt Time when this head becomes eligible.
|
|
117
|
-
* @param scope Generated state type and Agent key.
|
|
118
|
-
* @returns Complete binary-collated eligibility and scope key.
|
|
119
|
-
*/
|
|
120
|
-
pendingKey(eligibleAt, scope) {
|
|
121
|
-
return `${timestampKey(eligibleAt)}!${this.scopeOrder(scope)}`;
|
|
122
|
-
},
|
|
123
|
-
/**
|
|
124
|
-
* Returns an exclusive upper bound before all scopes at the sampled time.
|
|
125
|
-
*
|
|
126
|
-
* @param asOf Fixed eligibility cutoff for the page.
|
|
127
|
-
* @returns Strict eligibility upper-bound key.
|
|
128
|
-
*/
|
|
129
|
-
pendingLower(asOf) {
|
|
130
|
-
return `${timestampKey(asOf)}!`;
|
|
131
|
-
},
|
|
132
|
-
/**
|
|
133
|
-
* Builds materialized invocation columns under one fixed-width provider digest.
|
|
134
|
-
*
|
|
135
|
-
* @param digest Physical identity digest of the full logical key.
|
|
136
|
-
* @returns Shared native record specification.
|
|
137
|
-
*/
|
|
138
|
-
invocationSpec(digest) {
|
|
139
|
-
return new RecordSpec({
|
|
140
|
-
sourceType: AgentExecutionRecordSchema,
|
|
141
|
-
recordType: AgentExecutionRecordSchema,
|
|
142
|
-
idKind: "string",
|
|
143
|
-
extractId: (record) => digest(this.invocation(requiredInvocation(record))),
|
|
144
|
-
columns: [
|
|
145
|
-
new RecordColumn("state_type", string, (record) => requiredInvocation(record).scope.stateType),
|
|
146
|
-
new RecordColumn("agent_key", string, (record) => requiredInvocation(record).scope.agentKey),
|
|
147
|
-
new RecordColumn("scope_digest", string, (record) => digest(this.scope(requiredInvocation(record).scope))),
|
|
148
|
-
new RecordColumn("status", string, (record) => String(record.status)),
|
|
149
|
-
new RecordColumn("order_key", string, (record) => this.order(requiredOrder(record))),
|
|
150
|
-
],
|
|
151
|
-
});
|
|
152
|
-
},
|
|
153
|
-
/**
|
|
154
|
-
* Builds materialized current-head columns under one provider digest.
|
|
155
|
-
*
|
|
156
|
-
* @param digest Physical identity digest of the full Agent scope.
|
|
157
|
-
* @returns Shared native head specification.
|
|
158
|
-
*/
|
|
159
|
-
headSpec(digest) {
|
|
160
|
-
return new RecordSpec({
|
|
161
|
-
sourceType: AgentExecutionHeadSchema,
|
|
162
|
-
recordType: AgentExecutionHeadSchema,
|
|
163
|
-
idKind: "string",
|
|
164
|
-
extractId: (record) => digest(this.scope(requiredScope(record))),
|
|
165
|
-
columns: [
|
|
166
|
-
new RecordColumn("state_type", string, (record) => requiredScope(record).stateType),
|
|
167
|
-
new RecordColumn("agent_key", string, (record) => requiredScope(record).agentKey),
|
|
168
|
-
new RecordColumn("scope_digest", string, (record) => digest(this.scope(requiredScope(record)))),
|
|
169
|
-
new RecordColumn("state_digest", string, (record) => digest(requiredScope(record).stateType)),
|
|
170
|
-
new RecordColumn("pending_key", string, (record) => headPendingKey(record, this)),
|
|
171
|
-
],
|
|
172
|
-
});
|
|
173
|
-
},
|
|
174
|
-
};
|
|
175
|
-
/**
|
|
176
|
-
* Reads the immutable accepted invocation identity from a record.
|
|
177
|
-
*/
|
|
178
|
-
function requiredInvocation(record) {
|
|
179
|
-
const key = record.accepted?.key;
|
|
180
|
-
if (key?.scope === undefined || key.sourceSignal === undefined)
|
|
181
|
-
throw new TypeError("Agent execution record requires its original invocation key.");
|
|
182
|
-
return key;
|
|
183
|
-
}
|
|
184
|
-
/**
|
|
185
|
-
* Reads the original Inbox order from a record.
|
|
186
|
-
*/
|
|
187
|
-
function requiredOrder(record) {
|
|
188
|
-
const order = record.accepted?.order;
|
|
189
|
-
if (order === undefined)
|
|
190
|
-
throw new TypeError("Agent execution record requires Inbox order.");
|
|
191
|
-
return order;
|
|
192
|
-
}
|
|
193
|
-
/**
|
|
194
|
-
* Reads the complete Agent instance scope from a head.
|
|
195
|
-
*/
|
|
196
|
-
function requiredScope(head) {
|
|
197
|
-
if (head.scope === undefined)
|
|
198
|
-
throw new TypeError("Agent execution head requires its scope.");
|
|
199
|
-
return head.scope;
|
|
200
|
-
}
|
|
201
|
-
/**
|
|
202
|
-
* Encodes an optional lease expiry for native index eligibility.
|
|
203
|
-
*/
|
|
204
|
-
function timestampKey(value) {
|
|
205
|
-
if (value.seconds < -62135596800n ||
|
|
206
|
-
value.seconds > 253402300799n ||
|
|
207
|
-
value.nanos < 0 ||
|
|
208
|
-
value.nanos > 999_999_999)
|
|
209
|
-
throw new RangeError("Agent execution Timestamp is out of range.");
|
|
210
|
-
return `${(value.seconds + 62135596800n).toString().padStart(12, "0")}:${value.nanos.toString().padStart(9, "0")}`;
|
|
211
|
-
}
|
|
212
|
-
/**
|
|
213
|
-
* Materializes the head candidate or a value beyond every valid Timestamp.
|
|
214
|
-
*/
|
|
215
|
-
function headPendingKey(head, layout) {
|
|
216
|
-
const present = [head.pending, head.pendingOrder, head.eligibleAt].filter((value) => value !== undefined).length;
|
|
217
|
-
if (present === 0)
|
|
218
|
-
return "~";
|
|
219
|
-
if (present !== 3 || head.eligibleAt === undefined)
|
|
220
|
-
throw new TypeError("Agent execution head has incomplete discovery metadata.");
|
|
221
|
-
return layout.pendingKey(head.eligibleAt, requiredScope(head));
|
|
222
|
-
}
|
|
223
|
-
/**
|
|
224
|
-
* Encodes every UTF-8 byte without locale-dependent collation.
|
|
225
|
-
*/
|
|
226
|
-
function utf8Hex(value) {
|
|
227
|
-
const encoder = new globalThis.TextEncoder();
|
|
228
|
-
return [...encoder.encode(value)].map((byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
229
|
-
}
|
|
230
|
-
//# sourceMappingURL=agent-execution-record-spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"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,yDAAyD,CAAC,CAAC;IACjF,OAAO,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC;AACjE,CAAC;AAED;;GAEG;AACH,SAAS,OAAO,CAAC,KAAa;IAC5B,MAAM,OAAO,GAAG,IACd,UAWD,CAAC,WAAW,EAAE,CAAC;IAChB,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC/F,CAAC"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { AgentHistoryEntry } from "@spine-event-engine/proto/agent";
|
|
2
|
-
import { type AgentExecutionHead, type AgentExecutionRecord, type AgentExecutionScope } from "@spine-event-engine/proto/generated/spine/server/agent/execution_record_pb.js";
|
|
3
|
-
/**
|
|
4
|
-
* Calculates complete internal Protobuf row sizes before an external Agent call.
|
|
5
|
-
*/
|
|
6
|
-
export declare const AgentExecutionSizes: {
|
|
7
|
-
/**
|
|
8
|
-
* Calculates the retained execution journal and accepted source facts.
|
|
9
|
-
*
|
|
10
|
-
* @param record Complete execution record proposed for persistence.
|
|
11
|
-
* @returns Exact serialized execution-record bytes.
|
|
12
|
-
*/
|
|
13
|
-
record(record: AgentExecutionRecord): number;
|
|
14
|
-
/**
|
|
15
|
-
* Calculates per-instance claim, eligibility and preferences.
|
|
16
|
-
*
|
|
17
|
-
* @param head Complete head proposed for persistence.
|
|
18
|
-
* @returns Exact serialized head bytes.
|
|
19
|
-
*/
|
|
20
|
-
head(head: AgentExecutionHead): number;
|
|
21
|
-
/**
|
|
22
|
-
* Calculates a history entry inside its persisted scope envelope.
|
|
23
|
-
*
|
|
24
|
-
* @param scope Generated state type and canonical Agent key.
|
|
25
|
-
* @param entry Original conversation, System or domain entry.
|
|
26
|
-
* @returns Exact serialized internal history-record bytes.
|
|
27
|
-
*/
|
|
28
|
-
history(scope: AgentExecutionScope, entry: AgentHistoryEntry): number;
|
|
29
|
-
};
|
|
30
|
-
//# sourceMappingURL=agent-execution-sizes.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agent-execution-sizes.d.ts","sourceRoot":"","sources":["../../src/entity/agent-execution-sizes.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAGL,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACzB,MAAM,+EAA+E,CAAC;AAKvF;;GAEG;AACH,eAAO,MAAM,mBAAmB;IAC9B;;;;;OAKG;mBACY,oBAAoB,GAAG,MAAM;IAI5C;;;;;OAKG;eACQ,kBAAkB,GAAG,MAAM;IAItC;;;;;;OAMG;mBACY,mBAAmB,SAAS,iBAAiB,GAAG,MAAM;CAMtE,CAAC"}
|
|
@@ -1,51 +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 { toBinary } from "@bufbuild/protobuf";
|
|
15
|
-
import { AgentExecutionHeadSchema, AgentExecutionRecordSchema, } from "@spine-event-engine/proto/generated/spine/server/agent/execution_record_pb.js";
|
|
16
|
-
import { AgentHistoryRecordSchema } from "@spine-event-engine/proto/generated/spine/server/agent/history_record_pb.js";
|
|
17
|
-
import { AgentHistoryRecords } from "./agent-history-record-spec.js";
|
|
18
|
-
/**
|
|
19
|
-
* Calculates complete internal Protobuf row sizes before an external Agent call.
|
|
20
|
-
*/
|
|
21
|
-
export const AgentExecutionSizes = {
|
|
22
|
-
/**
|
|
23
|
-
* Calculates the retained execution journal and accepted source facts.
|
|
24
|
-
*
|
|
25
|
-
* @param record Complete execution record proposed for persistence.
|
|
26
|
-
* @returns Exact serialized execution-record bytes.
|
|
27
|
-
*/
|
|
28
|
-
record(record) {
|
|
29
|
-
return toBinary(AgentExecutionRecordSchema, record).length;
|
|
30
|
-
},
|
|
31
|
-
/**
|
|
32
|
-
* Calculates per-instance claim, eligibility and preferences.
|
|
33
|
-
*
|
|
34
|
-
* @param head Complete head proposed for persistence.
|
|
35
|
-
* @returns Exact serialized head bytes.
|
|
36
|
-
*/
|
|
37
|
-
head(head) {
|
|
38
|
-
return toBinary(AgentExecutionHeadSchema, head).length;
|
|
39
|
-
},
|
|
40
|
-
/**
|
|
41
|
-
* Calculates a history entry inside its persisted scope envelope.
|
|
42
|
-
*
|
|
43
|
-
* @param scope Generated state type and canonical Agent key.
|
|
44
|
-
* @param entry Original conversation, System or domain entry.
|
|
45
|
-
* @returns Exact serialized internal history-record bytes.
|
|
46
|
-
*/
|
|
47
|
-
history(scope, entry) {
|
|
48
|
-
return toBinary(AgentHistoryRecordSchema, AgentHistoryRecords.record(scope.stateType, scope.agentKey, entry)).length;
|
|
49
|
-
},
|
|
50
|
-
};
|
|
51
|
-
//# sourceMappingURL=agent-execution-sizes.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agent-execution-sizes.js","sourceRoot":"","sources":["../../src/entity/agent-execution-sizes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C,OAAO,EACL,wBAAwB,EACxB,0BAA0B,GAI3B,MAAM,+EAA+E,CAAC;AACvF,OAAO,EAAE,wBAAwB,EAAE,MAAM,6EAA6E,CAAC;AAEvH,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAErE;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC;;;;;OAKG;IACH,MAAM,CAAC,MAA4B;QACjC,OAAO,QAAQ,CAAC,0BAA0B,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC;IAC7D,CAAC;IAED;;;;;OAKG;IACH,IAAI,CAAC,IAAwB;QAC3B,OAAO,QAAQ,CAAC,wBAAwB,EAAE,IAAI,CAAC,CAAC,MAAM,CAAC;IACzD,CAAC;IAED;;;;;;OAMG;IACH,OAAO,CAAC,KAA0B,EAAE,KAAwB;QAC1D,OAAO,QAAQ,CACb,wBAAwB,EACxB,mBAAmB,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,CACnE,CAAC,MAAM,CAAC;IACX,CAAC;CACF,CAAC"}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { type AgentExecutionRecord, type AgentOutgoingSignal, type AgentSavedDispatchTarget, type AgentSignalKey } from "@spine-event-engine/proto/generated/spine/server/agent/execution_record_pb.js";
|
|
2
|
-
/**
|
|
3
|
-
* Enforces immutable saved output envelopes and one-time route preparation.
|
|
4
|
-
*/
|
|
5
|
-
export declare const AgentExecutionTransitions: {
|
|
6
|
-
/**
|
|
7
|
-
* Rejects an initial completion that claims transport acceptance or a saved route.
|
|
8
|
-
*
|
|
9
|
-
* @param record Persisted Agent execution record.
|
|
10
|
-
*/
|
|
11
|
-
assertCompletion(record: AgentExecutionRecord): void;
|
|
12
|
-
/**
|
|
13
|
-
* Reads the complete typed ID of one original outgoing envelope.
|
|
14
|
-
*
|
|
15
|
-
* @param output Original Event or Command envelope.
|
|
16
|
-
* @returns Kind and nonempty source ID.
|
|
17
|
-
*/
|
|
18
|
-
originalId(output: AgentOutgoingSignal): string;
|
|
19
|
-
/**
|
|
20
|
-
* Accepts only absent-to-present saved-plan installation after completion.
|
|
21
|
-
*
|
|
22
|
-
* @param next Proposed next execution record.
|
|
23
|
-
* @param prior Previously persisted execution record.
|
|
24
|
-
*/
|
|
25
|
-
assertUpdate(prior: AgentExecutionRecord, next: AgentExecutionRecord): void;
|
|
26
|
-
/**
|
|
27
|
-
* Validates a persisted plan before acknowledging each selected original ID.
|
|
28
|
-
*
|
|
29
|
-
* @param record Persisted Agent execution record.
|
|
30
|
-
* @param signals Original outgoing signal identities.
|
|
31
|
-
*/
|
|
32
|
-
assertDelivery(record: AgentExecutionRecord, signals: readonly AgentSignalKey[]): void;
|
|
33
|
-
/**
|
|
34
|
-
* Checks complete binding identities and typed repository recipients.
|
|
35
|
-
*
|
|
36
|
-
* @param output Saved outgoing signal.
|
|
37
|
-
*/
|
|
38
|
-
validatePlan(output: AgentOutgoingSignal): void;
|
|
39
|
-
/**
|
|
40
|
-
* Rejects a target that cannot be rebound to the original output kind.
|
|
41
|
-
*
|
|
42
|
-
* @param output Saved outgoing signal.
|
|
43
|
-
* @param target Prepared delivery target.
|
|
44
|
-
*/
|
|
45
|
-
validateTarget(output: AgentOutgoingSignal, target: AgentSavedDispatchTarget): void;
|
|
46
|
-
/**
|
|
47
|
-
* Compares complete original plan bytes after installation.
|
|
48
|
-
*
|
|
49
|
-
* @param left First value in the comparison.
|
|
50
|
-
* @param right Second value in the comparison.
|
|
51
|
-
* @returns Whether both saved dispatch plans have identical bytes.
|
|
52
|
-
*/
|
|
53
|
-
samePlan(left: AgentOutgoingSignal, right: AgentOutgoingSignal): boolean;
|
|
54
|
-
/**
|
|
55
|
-
* Compares every execution field after masking the newly installed plans.
|
|
56
|
-
*
|
|
57
|
-
* @param left First value in the comparison.
|
|
58
|
-
* @param right Second value in the comparison.
|
|
59
|
-
* @returns Whether both execution records have identical bytes.
|
|
60
|
-
*/
|
|
61
|
-
sameRecord(left: AgentExecutionRecord, right: AgentExecutionRecord): boolean;
|
|
62
|
-
/**
|
|
63
|
-
* Matches a selected typed original Event or Command ID.
|
|
64
|
-
*
|
|
65
|
-
* @param output Saved outgoing signal.
|
|
66
|
-
* @param signal Original signal identity.
|
|
67
|
-
* @returns Whether the saved output has the original signal identity.
|
|
68
|
-
*/
|
|
69
|
-
matches(output: AgentOutgoingSignal, signal: AgentSignalKey): boolean;
|
|
70
|
-
};
|
|
71
|
-
//# sourceMappingURL=agent-execution-transitions.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agent-execution-transitions.d.ts","sourceRoot":"","sources":["../../src/entity/agent-execution-transitions.ts"],"names":[],"mappings":"AAeA,OAAO,EAKL,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,wBAAwB,EAC7B,KAAK,cAAc,EACpB,MAAM,+EAA+E,CAAC;AAEvF;;GAEG;AACH,eAAO,MAAM,yBAAyB;IACpC;;;;OAIG;6BACsB,oBAAoB,GAAG,IAAI;IAYpD;;;;;OAKG;uBACgB,mBAAmB,GAAG,MAAM;IAc/C;;;;;OAKG;wBACiB,oBAAoB,QAAQ,oBAAoB,GAAG,IAAI;IA6B3E;;;;;OAKG;2BACoB,oBAAoB,WAAW,SAAS,cAAc,EAAE,GAAG,IAAI;IAQtF;;;;OAIG;yBACkB,mBAAmB,GAAG,IAAI;IAK/C;;;;;OAKG;2BACoB,mBAAmB,UAAU,wBAAwB,GAAG,IAAI;IA2BnF;;;;;;OAMG;mBACY,mBAAmB,SAAS,mBAAmB,GAAG,OAAO;IAOxE;;;;;;OAMG;qBACc,oBAAoB,SAAS,oBAAoB,GAAG,OAAO;IAM5E;;;;;;OAMG;oBACa,mBAAmB,UAAU,cAAc,GAAG,OAAO;CAUtE,CAAC"}
|