@spine-event-engine/storage 2.0.0-snapshot.24 → 2.0.0-snapshot.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -3
- package/REFERENCE.md +76 -68
- package/dist/entity/agent-history-record-spec.d.ts +8 -0
- package/dist/entity/agent-history-record-spec.d.ts.map +1 -1
- package/dist/entity/agent-history-record-spec.js +12 -1
- package/dist/entity/agent-history-record-spec.js.map +1 -1
- package/dist/entity/agent-history.d.ts +25 -0
- package/dist/entity/agent-history.d.ts.map +1 -1
- package/dist/entity/agent-history.js.map +1 -1
- package/dist/entity/history-conformance.d.ts +38 -8
- package/dist/entity/history-conformance.d.ts.map +1 -1
- package/dist/entity/history-conformance.js +103 -58
- package/dist/entity/history-conformance.js.map +1 -1
- package/dist/event/event-store.d.ts +51 -3
- package/dist/event/event-store.d.ts.map +1 -1
- package/dist/event/event-store.js +171 -27
- package/dist/event/event-store.js.map +1 -1
- package/dist/internal/agent-model-preferences.d.ts +76 -0
- package/dist/internal/agent-model-preferences.d.ts.map +1 -0
- package/dist/internal/agent-model-preferences.js +133 -0
- package/dist/internal/agent-model-preferences.js.map +1 -0
- package/dist/internal/entity-commit.d.ts +64 -8
- package/dist/internal/entity-commit.d.ts.map +1 -1
- package/dist/internal/entity-commit.js.map +1 -1
- package/dist/internal/entity-history.d.ts +1 -7
- package/dist/internal/entity-history.d.ts.map +1 -1
- package/dist/internal/entity-history.js +0 -5
- package/dist/internal/entity-history.js.map +1 -1
- package/dist/internal/event-store.d.ts +1 -1
- package/dist/internal/event-store.d.ts.map +1 -1
- package/dist/internal/event-store.js +1 -1
- package/dist/internal/event-store.js.map +1 -1
- package/dist/internal/storage-preparation.d.ts +88 -0
- package/dist/internal/storage-preparation.d.ts.map +1 -0
- package/dist/internal/storage-preparation.js +41 -0
- package/dist/internal/storage-preparation.js.map +1 -0
- package/dist/internal/tenancy.d.ts +7 -0
- package/dist/internal/tenancy.d.ts.map +1 -1
- package/dist/memory/in-memory-agent-history.d.ts.map +1 -1
- package/dist/memory/in-memory-agent-history.js +22 -7
- package/dist/memory/in-memory-agent-history.js.map +1 -1
- package/dist/memory/in-memory-entity-commit.d.ts +154 -21
- package/dist/memory/in-memory-entity-commit.d.ts.map +1 -1
- package/dist/memory/in-memory-entity-commit.js +396 -60
- package/dist/memory/in-memory-entity-commit.js.map +1 -1
- package/dist/memory/in-memory-entity-history.d.ts.map +1 -1
- package/dist/memory/in-memory-entity-history.js +4 -3
- package/dist/memory/in-memory-entity-history.js.map +1 -1
- package/dist/memory/in-memory-storage-backend.d.ts +33 -1
- package/dist/memory/in-memory-storage-backend.d.ts.map +1 -1
- package/dist/memory/in-memory-storage-backend.js +118 -1
- package/dist/memory/in-memory-storage-backend.js.map +1 -1
- package/dist/memory/in-memory-storage-factory.d.ts +71 -12
- package/dist/memory/in-memory-storage-factory.d.ts.map +1 -1
- package/dist/memory/in-memory-storage-factory.js +199 -25
- package/dist/memory/in-memory-storage-factory.js.map +1 -1
- package/dist/provider.d.ts +2 -0
- package/dist/provider.d.ts.map +1 -1
- package/dist/provider.js +2 -0
- package/dist/provider.js.map +1 -1
- package/dist/storage/storage-factory.d.ts +27 -4
- package/dist/storage/storage-factory.d.ts.map +1 -1
- package/dist/storage/storage-factory.js +30 -1
- package/dist/storage/storage-factory.js.map +1 -1
- package/dist/storage/storage.d.ts +2 -1
- package/dist/storage/storage.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/dist/entity/agent-execution-record-spec.d.ts +0 -87
- package/dist/entity/agent-execution-record-spec.d.ts.map +0 -1
- package/dist/entity/agent-execution-record-spec.js +0 -230
- package/dist/entity/agent-execution-record-spec.js.map +0 -1
- package/dist/entity/agent-execution-sizes.d.ts +0 -30
- package/dist/entity/agent-execution-sizes.d.ts.map +0 -1
- package/dist/entity/agent-execution-sizes.js +0 -51
- package/dist/entity/agent-execution-sizes.js.map +0 -1
- package/dist/entity/agent-execution-transitions.d.ts +0 -72
- package/dist/entity/agent-execution-transitions.d.ts.map +0 -1
- package/dist/entity/agent-execution-transitions.js +0 -165
- package/dist/entity/agent-execution-transitions.js.map +0 -1
- package/dist/entity/agent-execution-values.d.ts +0 -143
- package/dist/entity/agent-execution-values.d.ts.map +0 -1
- package/dist/entity/agent-execution-values.js +0 -251
- package/dist/entity/agent-execution-values.js.map +0 -1
- package/dist/entity/agent-execution.d.ts +0 -235
- package/dist/entity/agent-execution.d.ts.map +0 -1
- package/dist/entity/agent-execution.js +0 -15
- package/dist/entity/agent-execution.js.map +0 -1
- package/dist/internal/agent-execution.d.ts +0 -51
- package/dist/internal/agent-execution.d.ts.map +0 -1
- package/dist/internal/agent-execution.js +0 -53
- package/dist/internal/agent-execution.js.map +0 -1
- package/dist/memory/agent-execution-head-index.d.ts +0 -52
- package/dist/memory/agent-execution-head-index.d.ts.map +0 -1
- package/dist/memory/agent-execution-head-index.js +0 -91
- package/dist/memory/agent-execution-head-index.js.map +0 -1
- package/dist/memory/in-memory-agent-execution.d.ts +0 -21
- package/dist/memory/in-memory-agent-execution.d.ts.map +0 -1
- package/dist/memory/in-memory-agent-execution.js +0 -587
- package/dist/memory/in-memory-agent-execution.js.map +0 -1
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
import type { Timestamp } from "@bufbuild/protobuf/wkt";
|
|
2
|
-
import type { CommandId } from "@spine-event-engine/proto";
|
|
3
|
-
import { type AgentAcceptedInvocation, type AgentExecutionCompletion, type AgentExecutionHead, type AgentExecutionRecord, type AgentExecutionScope, type AgentInboxOrder, type AgentInvocationKey } from "@spine-event-engine/proto/generated/spine/server/agent/execution_record_pb.js";
|
|
4
|
-
/**
|
|
5
|
-
* Reads and compares original Agent execution values across storage providers.
|
|
6
|
-
*/
|
|
7
|
-
export declare const AgentExecutionValues: {
|
|
8
|
-
/**
|
|
9
|
-
* Validates a present value at a provider trust boundary.
|
|
10
|
-
*
|
|
11
|
-
* @param value Optional decoded or selected value.
|
|
12
|
-
* @returns The present value.
|
|
13
|
-
* @typeParam T Value type.
|
|
14
|
-
*/
|
|
15
|
-
require<T>(value: T | undefined): T;
|
|
16
|
-
/**
|
|
17
|
-
* Validates an invocation in the configured state family.
|
|
18
|
-
*
|
|
19
|
-
* @param key Complete original invocation key.
|
|
20
|
-
* @param stateType Configured generated state type.
|
|
21
|
-
* @returns Validated key.
|
|
22
|
-
*/
|
|
23
|
-
requiredKey(key: AgentInvocationKey | undefined, stateType: string): AgentInvocationKey;
|
|
24
|
-
/**
|
|
25
|
-
* Validates immutable source facts and original Inbox order.
|
|
26
|
-
*
|
|
27
|
-
* @param record Persisted execution record.
|
|
28
|
-
* @returns Complete accepted source facts.
|
|
29
|
-
*/
|
|
30
|
-
requiredAccepted(record: AgentExecutionRecord): AgentAcceptedInvocation;
|
|
31
|
-
/**
|
|
32
|
-
* Reads the accepted invocation key.
|
|
33
|
-
*
|
|
34
|
-
* @param record Persisted execution record.
|
|
35
|
-
* @returns Complete key.
|
|
36
|
-
*/
|
|
37
|
-
requiredInvocation(record: AgentExecutionRecord): AgentInvocationKey;
|
|
38
|
-
/**
|
|
39
|
-
* Validates the generated state type and Agent key.
|
|
40
|
-
*
|
|
41
|
-
* @param key Original invocation identity.
|
|
42
|
-
* @returns Complete instance scope.
|
|
43
|
-
*/
|
|
44
|
-
requiredScope(key: AgentInvocationKey | undefined): AgentExecutionScope;
|
|
45
|
-
/**
|
|
46
|
-
* Validates the scope stored in one per-instance head.
|
|
47
|
-
*
|
|
48
|
-
* @param head Persisted claim and discovery head.
|
|
49
|
-
* @returns Complete instance scope.
|
|
50
|
-
*/
|
|
51
|
-
requiredHeadScope(head: AgentExecutionHead): AgentExecutionScope;
|
|
52
|
-
/**
|
|
53
|
-
* Reads original Inbox order from immutable acceptance.
|
|
54
|
-
*
|
|
55
|
-
* @param record Persisted execution record.
|
|
56
|
-
* @returns Complete Inbox order.
|
|
57
|
-
*/
|
|
58
|
-
requiredOrder(record: AgentExecutionRecord): AgentInboxOrder;
|
|
59
|
-
/**
|
|
60
|
-
* Validates completed output obligations.
|
|
61
|
-
*
|
|
62
|
-
* @param record Persisted execution record.
|
|
63
|
-
* @returns Complete result.
|
|
64
|
-
*/
|
|
65
|
-
requiredCompletion(record: AgentExecutionRecord): AgentExecutionCompletion;
|
|
66
|
-
/**
|
|
67
|
-
* Compares binary indexed strings without locale collation.
|
|
68
|
-
*
|
|
69
|
-
* @param left First full index key.
|
|
70
|
-
* @param right Second full index key.
|
|
71
|
-
* @returns Negative, zero, or positive order.
|
|
72
|
-
*/
|
|
73
|
-
compareText(left: string, right: string): number;
|
|
74
|
-
/**
|
|
75
|
-
* Compares complete accepted source facts.
|
|
76
|
-
*
|
|
77
|
-
* @param left Previous accepted facts.
|
|
78
|
-
* @param right Proposed accepted facts.
|
|
79
|
-
* @returns Whether all original bytes match.
|
|
80
|
-
*/
|
|
81
|
-
sameAccepted(left: AgentAcceptedInvocation | undefined, right: AgentAcceptedInvocation | undefined): boolean;
|
|
82
|
-
/**
|
|
83
|
-
* Compares exact binary images without integer conversion.
|
|
84
|
-
*
|
|
85
|
-
* @param left Previous Protobuf image.
|
|
86
|
-
* @param right Proposed Protobuf image.
|
|
87
|
-
* @returns Whether each byte matches.
|
|
88
|
-
*/
|
|
89
|
-
sameBytes(left: Uint8Array, right: Uint8Array): boolean;
|
|
90
|
-
/**
|
|
91
|
-
* Returns an independent exact execution record.
|
|
92
|
-
*
|
|
93
|
-
* @param record Persisted record.
|
|
94
|
-
* @returns Binary round-tripped record.
|
|
95
|
-
*/
|
|
96
|
-
cloneRecord(record: AgentExecutionRecord): AgentExecutionRecord;
|
|
97
|
-
/**
|
|
98
|
-
* Compares full seconds and nanos.
|
|
99
|
-
*
|
|
100
|
-
* @param left First Timestamp.
|
|
101
|
-
* @param right Second Timestamp.
|
|
102
|
-
* @returns Negative, zero, or positive order.
|
|
103
|
-
*/
|
|
104
|
-
compareTime(left: Timestamp, right: Timestamp): number;
|
|
105
|
-
/**
|
|
106
|
-
* Checks whether accepted or expired work is claimable now.
|
|
107
|
-
*
|
|
108
|
-
* @param record Persisted invocation.
|
|
109
|
-
* @param now Fresh provider Timestamp.
|
|
110
|
-
* @returns Whether a claim may attempt it.
|
|
111
|
-
*/
|
|
112
|
-
isPending(record: AgentExecutionRecord, now: Timestamp): boolean;
|
|
113
|
-
/**
|
|
114
|
-
* Clears the resolved claim while retaining original order.
|
|
115
|
-
*
|
|
116
|
-
* @param head Per-instance claim and discovery record.
|
|
117
|
-
* @param order Original Inbox order of resolved work.
|
|
118
|
-
*/
|
|
119
|
-
release(head: AgentExecutionHead, order: AgentInboxOrder): void;
|
|
120
|
-
/**
|
|
121
|
-
* Updates a discoverable head for earlier original Inbox work without resetting eligibility.
|
|
122
|
-
*
|
|
123
|
-
* @param head Current per-instance claim and discovery row.
|
|
124
|
-
* @param record Newly accepted original invocation.
|
|
125
|
-
*/
|
|
126
|
-
offerCandidate(head: AgentExecutionHead, record: AgentExecutionRecord): void;
|
|
127
|
-
/**
|
|
128
|
-
* Updates the resolved head with its earliest unresolved successor.
|
|
129
|
-
*
|
|
130
|
-
* @param head Current per-instance claim and discovery row.
|
|
131
|
-
* @param order Original Inbox order of resolved work.
|
|
132
|
-
* @param next Earliest remaining invocation when present.
|
|
133
|
-
*/
|
|
134
|
-
advanceCandidate(head: AgentExecutionHead, order: AgentInboxOrder, next: AgentExecutionRecord | undefined): void;
|
|
135
|
-
/**
|
|
136
|
-
* Marks one original recorded outgoing ID delivered.
|
|
137
|
-
*
|
|
138
|
-
* @param record Completion carrying original outputs.
|
|
139
|
-
* @param signal Typed outgoing Command ID.
|
|
140
|
-
*/
|
|
141
|
-
markSignal(record: AgentExecutionCompletion, signal: CommandId): void;
|
|
142
|
-
};
|
|
143
|
-
//# sourceMappingURL=agent-execution-values.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agent-execution-values.d.ts","sourceRoot":"","sources":["../../src/entity/agent-execution-values.ts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UAAU,oBAAoB,GAAG,IAAI;IAc5E;;;;;;OAMG;2BAEK,kBAAkB,SACjB,eAAe,QAChB,oBAAoB,GAAG,SAAS,GACrC,IAAI;IAOP;;;;;OAKG;uBACgB,wBAAwB,UAAU,SAAS,GAAG,IAAI;CAKtE,CAAC"}
|
|
@@ -1,251 +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 { clone, fromBinary, toBinary } from "@bufbuild/protobuf";
|
|
15
|
-
import { Time } from "@spine-event-engine/core";
|
|
16
|
-
import { AgentAcceptedInvocationSchema, AgentExecutionRecordSchema, AgentInvocationStatus, } from "@spine-event-engine/proto/generated/spine/server/agent/execution_record_pb.js";
|
|
17
|
-
import { AgentExecutionRecords } from "./agent-execution-record-spec.js";
|
|
18
|
-
/**
|
|
19
|
-
* Reads and compares original Agent execution values across storage providers.
|
|
20
|
-
*/
|
|
21
|
-
export const AgentExecutionValues = {
|
|
22
|
-
/**
|
|
23
|
-
* Validates a present value at a provider trust boundary.
|
|
24
|
-
*
|
|
25
|
-
* @param value Optional decoded or selected value.
|
|
26
|
-
* @returns The present value.
|
|
27
|
-
* @typeParam T Value type.
|
|
28
|
-
*/
|
|
29
|
-
require(value) {
|
|
30
|
-
if (value === undefined)
|
|
31
|
-
throw new TypeError("Agent execution value is missing.");
|
|
32
|
-
return value;
|
|
33
|
-
},
|
|
34
|
-
/**
|
|
35
|
-
* Validates an invocation in the configured state family.
|
|
36
|
-
*
|
|
37
|
-
* @param key Complete original invocation key.
|
|
38
|
-
* @param stateType Configured generated state type.
|
|
39
|
-
* @returns Validated key.
|
|
40
|
-
*/
|
|
41
|
-
requiredKey(key, stateType) {
|
|
42
|
-
if (key?.scope?.stateType !== stateType ||
|
|
43
|
-
!key.scope.agentKey ||
|
|
44
|
-
key.sourceSignal === undefined)
|
|
45
|
-
throw new TypeError("Agent execution requires configured state type, Agent key and source ID.");
|
|
46
|
-
AgentExecutionRecords.invocation(key);
|
|
47
|
-
return key;
|
|
48
|
-
},
|
|
49
|
-
/**
|
|
50
|
-
* Validates immutable source facts and original Inbox order.
|
|
51
|
-
*
|
|
52
|
-
* @param record Persisted execution record.
|
|
53
|
-
* @returns Complete accepted source facts.
|
|
54
|
-
*/
|
|
55
|
-
requiredAccepted(record) {
|
|
56
|
-
if (record.accepted?.key?.scope === undefined || record.accepted.order === undefined)
|
|
57
|
-
throw new TypeError("Agent execution requires accepted source facts and Inbox order.");
|
|
58
|
-
return record.accepted;
|
|
59
|
-
},
|
|
60
|
-
/**
|
|
61
|
-
* Reads the accepted invocation key.
|
|
62
|
-
*
|
|
63
|
-
* @param record Persisted execution record.
|
|
64
|
-
* @returns Complete key.
|
|
65
|
-
*/
|
|
66
|
-
requiredInvocation(record) {
|
|
67
|
-
const key = this.requiredAccepted(record).key;
|
|
68
|
-
if (key === undefined)
|
|
69
|
-
throw new TypeError("Agent invocation key is missing.");
|
|
70
|
-
return key;
|
|
71
|
-
},
|
|
72
|
-
/**
|
|
73
|
-
* Validates the generated state type and Agent key.
|
|
74
|
-
*
|
|
75
|
-
* @param key Original invocation identity.
|
|
76
|
-
* @returns Complete instance scope.
|
|
77
|
-
*/
|
|
78
|
-
requiredScope(key) {
|
|
79
|
-
if (key?.scope === undefined)
|
|
80
|
-
throw new TypeError("Agent execution scope is missing.");
|
|
81
|
-
return key.scope;
|
|
82
|
-
},
|
|
83
|
-
/**
|
|
84
|
-
* Validates the scope stored in one per-instance head.
|
|
85
|
-
*
|
|
86
|
-
* @param head Persisted claim and discovery head.
|
|
87
|
-
* @returns Complete instance scope.
|
|
88
|
-
*/
|
|
89
|
-
requiredHeadScope(head) {
|
|
90
|
-
if (head.scope === undefined)
|
|
91
|
-
throw new TypeError("Agent execution head scope is missing.");
|
|
92
|
-
return head.scope;
|
|
93
|
-
},
|
|
94
|
-
/**
|
|
95
|
-
* Reads original Inbox order from immutable acceptance.
|
|
96
|
-
*
|
|
97
|
-
* @param record Persisted execution record.
|
|
98
|
-
* @returns Complete Inbox order.
|
|
99
|
-
*/
|
|
100
|
-
requiredOrder(record) {
|
|
101
|
-
const order = this.requiredAccepted(record).order;
|
|
102
|
-
if (order === undefined)
|
|
103
|
-
throw new TypeError("Agent Inbox order is missing.");
|
|
104
|
-
return order;
|
|
105
|
-
},
|
|
106
|
-
/**
|
|
107
|
-
* Validates completed output obligations.
|
|
108
|
-
*
|
|
109
|
-
* @param record Persisted execution record.
|
|
110
|
-
* @returns Complete result.
|
|
111
|
-
*/
|
|
112
|
-
requiredCompletion(record) {
|
|
113
|
-
if (record.completion === undefined)
|
|
114
|
-
throw new TypeError("Agent completion is missing.");
|
|
115
|
-
return record.completion;
|
|
116
|
-
},
|
|
117
|
-
/**
|
|
118
|
-
* Compares binary indexed strings without locale collation.
|
|
119
|
-
*
|
|
120
|
-
* @param left First full index key.
|
|
121
|
-
* @param right Second full index key.
|
|
122
|
-
* @returns Negative, zero, or positive order.
|
|
123
|
-
*/
|
|
124
|
-
compareText(left, right) {
|
|
125
|
-
return left < right ? -1 : left > right ? 1 : 0;
|
|
126
|
-
},
|
|
127
|
-
/**
|
|
128
|
-
* Compares complete accepted source facts.
|
|
129
|
-
*
|
|
130
|
-
* @param left Previous accepted facts.
|
|
131
|
-
* @param right Proposed accepted facts.
|
|
132
|
-
* @returns Whether all original bytes match.
|
|
133
|
-
*/
|
|
134
|
-
sameAccepted(left, right) {
|
|
135
|
-
if (left === undefined || right === undefined)
|
|
136
|
-
return false;
|
|
137
|
-
const original = clone(AgentAcceptedInvocationSchema, left);
|
|
138
|
-
const repeated = clone(AgentAcceptedInvocationSchema, right);
|
|
139
|
-
// A retry may arrive in a new Inbox row after receipt retention expires.
|
|
140
|
-
// Keep the first order while requiring every source and binding fact to match.
|
|
141
|
-
original.order = undefined;
|
|
142
|
-
repeated.order = undefined;
|
|
143
|
-
return this.sameBytes(toBinary(AgentAcceptedInvocationSchema, original), toBinary(AgentAcceptedInvocationSchema, repeated));
|
|
144
|
-
},
|
|
145
|
-
/**
|
|
146
|
-
* Compares exact binary images without integer conversion.
|
|
147
|
-
*
|
|
148
|
-
* @param left Previous Protobuf image.
|
|
149
|
-
* @param right Proposed Protobuf image.
|
|
150
|
-
* @returns Whether each byte matches.
|
|
151
|
-
*/
|
|
152
|
-
sameBytes(left, right) {
|
|
153
|
-
return left.length === right.length && left.every((byte, index) => byte === right[index]);
|
|
154
|
-
},
|
|
155
|
-
/**
|
|
156
|
-
* Returns an independent exact execution record.
|
|
157
|
-
*
|
|
158
|
-
* @param record Persisted record.
|
|
159
|
-
* @returns Binary round-tripped record.
|
|
160
|
-
*/
|
|
161
|
-
cloneRecord(record) {
|
|
162
|
-
return fromBinary(AgentExecutionRecordSchema, toBinary(AgentExecutionRecordSchema, record));
|
|
163
|
-
},
|
|
164
|
-
/**
|
|
165
|
-
* Compares full seconds and nanos.
|
|
166
|
-
*
|
|
167
|
-
* @param left First Timestamp.
|
|
168
|
-
* @param right Second Timestamp.
|
|
169
|
-
* @returns Negative, zero, or positive order.
|
|
170
|
-
*/
|
|
171
|
-
compareTime(left, right) {
|
|
172
|
-
return left.seconds < right.seconds
|
|
173
|
-
? -1
|
|
174
|
-
: left.seconds > right.seconds
|
|
175
|
-
? 1
|
|
176
|
-
: left.nanos - right.nanos;
|
|
177
|
-
},
|
|
178
|
-
/**
|
|
179
|
-
* Checks whether accepted or expired work is claimable now.
|
|
180
|
-
*
|
|
181
|
-
* @param record Persisted invocation.
|
|
182
|
-
* @param now Fresh provider Timestamp.
|
|
183
|
-
* @returns Whether a claim may attempt it.
|
|
184
|
-
*/
|
|
185
|
-
isPending(record, now) {
|
|
186
|
-
if (record.status === AgentInvocationStatus.AGENT_INVOCATION_ACCEPTED ||
|
|
187
|
-
record.status === AgentInvocationStatus.AGENT_INVOCATION_COMPLETED_PENDING_COMMANDS)
|
|
188
|
-
return true;
|
|
189
|
-
return (record.status === AgentInvocationStatus.AGENT_INVOCATION_ACTIVE &&
|
|
190
|
-
record.claimExpiresAt !== undefined &&
|
|
191
|
-
this.compareTime(record.claimExpiresAt, now) <= 0);
|
|
192
|
-
},
|
|
193
|
-
/**
|
|
194
|
-
* Clears the resolved claim while retaining original order.
|
|
195
|
-
*
|
|
196
|
-
* @param head Per-instance claim and discovery record.
|
|
197
|
-
* @param order Original Inbox order of resolved work.
|
|
198
|
-
*/
|
|
199
|
-
release(head, order) {
|
|
200
|
-
head.active = undefined;
|
|
201
|
-
head.claimToken = "";
|
|
202
|
-
head.claimExpiresAt = undefined;
|
|
203
|
-
head.lastResolved = order;
|
|
204
|
-
},
|
|
205
|
-
/**
|
|
206
|
-
* Updates a discoverable head for earlier original Inbox work without resetting eligibility.
|
|
207
|
-
*
|
|
208
|
-
* @param head Current per-instance claim and discovery row.
|
|
209
|
-
* @param record Newly accepted original invocation.
|
|
210
|
-
*/
|
|
211
|
-
offerCandidate(head, record) {
|
|
212
|
-
const order = this.requiredOrder(record);
|
|
213
|
-
if (head.pendingOrder !== undefined &&
|
|
214
|
-
AgentExecutionRecords.order(head.pendingOrder) <= AgentExecutionRecords.order(order))
|
|
215
|
-
return;
|
|
216
|
-
head.pending = this.requiredInvocation(record);
|
|
217
|
-
head.pendingOrder = order;
|
|
218
|
-
if (head.active === undefined)
|
|
219
|
-
head.eligibleAt ??= Time.currentTime();
|
|
220
|
-
else if (head.claimExpiresAt !== undefined)
|
|
221
|
-
head.eligibleAt = head.claimExpiresAt;
|
|
222
|
-
else
|
|
223
|
-
throw new Error("Agent active head requires lease expiry.");
|
|
224
|
-
},
|
|
225
|
-
/**
|
|
226
|
-
* Updates the resolved head with its earliest unresolved successor.
|
|
227
|
-
*
|
|
228
|
-
* @param head Current per-instance claim and discovery row.
|
|
229
|
-
* @param order Original Inbox order of resolved work.
|
|
230
|
-
* @param next Earliest remaining invocation when present.
|
|
231
|
-
*/
|
|
232
|
-
advanceCandidate(head, order, next) {
|
|
233
|
-
this.release(head, order);
|
|
234
|
-
head.pending = next === undefined ? undefined : this.requiredInvocation(next);
|
|
235
|
-
head.pendingOrder = next === undefined ? undefined : this.requiredOrder(next);
|
|
236
|
-
head.eligibleAt = next === undefined ? undefined : Time.currentTime();
|
|
237
|
-
},
|
|
238
|
-
/**
|
|
239
|
-
* Marks one original recorded outgoing ID delivered.
|
|
240
|
-
*
|
|
241
|
-
* @param record Completion carrying original outputs.
|
|
242
|
-
* @param signal Typed outgoing Command ID.
|
|
243
|
-
*/
|
|
244
|
-
markSignal(record, signal) {
|
|
245
|
-
const outgoing = record.commands.find((item) => item.command?.id?.uuid === signal.uuid);
|
|
246
|
-
if (outgoing === undefined)
|
|
247
|
-
throw new Error("Agent outgoing signal ID was not recorded.");
|
|
248
|
-
outgoing.delivered = true;
|
|
249
|
-
},
|
|
250
|
-
};
|
|
251
|
-
//# sourceMappingURL=agent-execution-values.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agent-execution-values.js","sourceRoot":"","sources":["../../src/entity/agent-execution-values.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAEjE,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAEhD,OAAO,EACL,6BAA6B,EAC7B,0BAA0B,EAC1B,qBAAqB,GAQtB,MAAM,+EAA+E,CAAC;AAEvF,OA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AC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QAC9E,IAAI,CAAC,UAAU,GAAG,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;IACxE,CAAC;IAED;;;;;OAKG;IACH,UAAU,CAAC,MAAgC,EAAE,MAAiB;QAC5D,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,EAAE,IAAI,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC;QACxF,IAAI,QAAQ,KAAK,SAAS;YAAE,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;QAC1F,QAAQ,CAAC,SAAS,GAAG,IAAI,CAAC;IAC5B,CAAC;CACF,CAAC"}
|
|
@@ -1,235 +0,0 @@
|
|
|
1
|
-
import type { Message } from "@bufbuild/protobuf";
|
|
2
|
-
import type { Timestamp } from "@bufbuild/protobuf/wkt";
|
|
3
|
-
import type { CommandId } from "@spine-event-engine/proto";
|
|
4
|
-
import type { AgentHistoryEntry, ModelPreference } from "@spine-event-engine/proto/agent";
|
|
5
|
-
import type { AgentAcceptedInvocation, AgentExecutionRecord, AgentExecutionScope, AgentInvocationKey } from "@spine-event-engine/proto/generated/spine/server/agent/execution_record_pb.js";
|
|
6
|
-
import type { EntityCommitInput } from "../internal/entity-commit.js";
|
|
7
|
-
import type { EntityStorageInput } from "../internal/entity-history.js";
|
|
8
|
-
/**
|
|
9
|
-
* Defines one Agent repository scope for a provider handle.
|
|
10
|
-
*
|
|
11
|
-
* @typeParam I Typed Agent identifier.
|
|
12
|
-
* @typeParam S Generated Agent state.
|
|
13
|
-
*/
|
|
14
|
-
export interface AgentExecutionStorageInput<I, S extends Message> {
|
|
15
|
-
/**
|
|
16
|
-
* Entity layout and complete tenant boundary used by conditional completion.
|
|
17
|
-
*/
|
|
18
|
-
readonly entity: EntityStorageInput<I, S>;
|
|
19
|
-
/**
|
|
20
|
-
* Generated Agent state type named in every execution scope.
|
|
21
|
-
*/
|
|
22
|
-
readonly stateType: string;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Selects a bounded page of provider-observed candidate heads in one Agent state type.
|
|
26
|
-
*/
|
|
27
|
-
export interface AgentPendingRead {
|
|
28
|
-
/**
|
|
29
|
-
* Provider-observed continuation and fixed time boundary from the preceding page.
|
|
30
|
-
*/
|
|
31
|
-
readonly after?: AgentPendingCursor;
|
|
32
|
-
/**
|
|
33
|
-
* Maximum number of observed candidates returned.
|
|
34
|
-
*/
|
|
35
|
-
readonly count: number;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Orders observed candidate heads without allocating a history position.
|
|
39
|
-
*/
|
|
40
|
-
export interface AgentPendingKey {
|
|
41
|
-
/**
|
|
42
|
-
* Complete Agent instance identity.
|
|
43
|
-
*/
|
|
44
|
-
readonly scope: AgentExecutionScope;
|
|
45
|
-
/**
|
|
46
|
-
* Provider time at which this instance became eligible.
|
|
47
|
-
*/
|
|
48
|
-
readonly eligibleAt: Timestamp;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Fixed sweep time and complete index key observed by a provider page.
|
|
52
|
-
*/
|
|
53
|
-
export interface AgentPendingCursor {
|
|
54
|
-
/**
|
|
55
|
-
* Time sampled once when the sweep began.
|
|
56
|
-
*/
|
|
57
|
-
readonly asOf: Timestamp;
|
|
58
|
-
/**
|
|
59
|
-
* Last examined head index key, before any concurrent mutation.
|
|
60
|
-
*/
|
|
61
|
-
readonly key: AgentPendingKey;
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Returns detached records for observed candidates and their continuation.
|
|
65
|
-
* A concurrent mutation can make a record stale; claim decides whether work is current.
|
|
66
|
-
*/
|
|
67
|
-
export interface AgentPendingPage {
|
|
68
|
-
/**
|
|
69
|
-
* Candidate records observed through the pending-head index.
|
|
70
|
-
*/
|
|
71
|
-
readonly records: readonly AgentExecutionRecord[];
|
|
72
|
-
/**
|
|
73
|
-
* Last examined provider index key; advance it even when no claim succeeds.
|
|
74
|
-
*/
|
|
75
|
-
readonly after?: AgentPendingCursor;
|
|
76
|
-
/**
|
|
77
|
-
* Whether another indexed candidate was observed during this page read.
|
|
78
|
-
*/
|
|
79
|
-
readonly hasMore: boolean;
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Provides a claimed record and queryable current model preferences.
|
|
83
|
-
*/
|
|
84
|
-
export interface AgentExecutionClaim {
|
|
85
|
-
/**
|
|
86
|
-
* Complete claimed execution record.
|
|
87
|
-
*/
|
|
88
|
-
readonly record: AgentExecutionRecord;
|
|
89
|
-
/**
|
|
90
|
-
* Current per-instance preferences at the claim boundary.
|
|
91
|
-
*/
|
|
92
|
-
readonly preferences: readonly ModelPreference[];
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Replaces one fenced execution record and appends its conversation or System history.
|
|
96
|
-
*/
|
|
97
|
-
export interface AgentExecutionUpdate {
|
|
98
|
-
/**
|
|
99
|
-
* Exact accepted invocation identity.
|
|
100
|
-
*/
|
|
101
|
-
readonly key: AgentInvocationKey;
|
|
102
|
-
/**
|
|
103
|
-
* Exclusive token granted by the current per-instance claim.
|
|
104
|
-
*/
|
|
105
|
-
readonly token: string;
|
|
106
|
-
/**
|
|
107
|
-
* Exact binary image read before constructing this update.
|
|
108
|
-
*/
|
|
109
|
-
readonly expectedRecordBytes: Uint8Array;
|
|
110
|
-
/**
|
|
111
|
-
* Complete next record with immutable acceptance unchanged.
|
|
112
|
-
*/
|
|
113
|
-
readonly next: AgentExecutionRecord;
|
|
114
|
-
/**
|
|
115
|
-
* Original conversation or System entries committed with the journal.
|
|
116
|
-
*/
|
|
117
|
-
readonly historyEntries?: readonly AgentHistoryEntry[];
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Commits an Agent transition and its fenced execution record together.
|
|
121
|
-
*
|
|
122
|
-
* @typeParam I Typed Agent identifier.
|
|
123
|
-
* @typeParam S Generated Agent state.
|
|
124
|
-
*/
|
|
125
|
-
export interface AgentExecutionComplete<I, S extends Message> extends AgentExecutionUpdate {
|
|
126
|
-
/**
|
|
127
|
-
* Current-state and framework history mutation; absent for a no-op.
|
|
128
|
-
*/
|
|
129
|
-
readonly entityCommit?: EntityCommitInput<I, S>;
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* Native serialized payload bounds available before model or tool dispatch.
|
|
133
|
-
*
|
|
134
|
-
* Every limit applies to the complete internal Protobuf record, including its
|
|
135
|
-
* scope and metadata. An absent limit means this provider enforces no tighter
|
|
136
|
-
* fixed bound for that record.
|
|
137
|
-
*/
|
|
138
|
-
export interface AgentExecutionCapacity {
|
|
139
|
-
/**
|
|
140
|
-
* Maximum serialized AgentExecutionRecord bytes.
|
|
141
|
-
*/
|
|
142
|
-
readonly executionRecordBytes?: number;
|
|
143
|
-
/**
|
|
144
|
-
* Maximum serialized AgentExecutionHead bytes.
|
|
145
|
-
*/
|
|
146
|
-
readonly executionHeadBytes?: number;
|
|
147
|
-
/**
|
|
148
|
-
* Maximum serialized AgentHistoryRecord bytes.
|
|
149
|
-
*/
|
|
150
|
-
readonly historyRecordBytes?: number;
|
|
151
|
-
/**
|
|
152
|
-
* Maximum aggregate staged native transaction payload bytes.
|
|
153
|
-
*/
|
|
154
|
-
readonly transactionPayloadBytes?: number;
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* Provider-only durable execution capability for one Agent repository scope.
|
|
158
|
-
*
|
|
159
|
-
* @typeParam I Typed Agent identifier.
|
|
160
|
-
* @typeParam S Generated Agent state.
|
|
161
|
-
*/
|
|
162
|
-
export interface AgentExecutionStorage<I, S extends Message> {
|
|
163
|
-
/**
|
|
164
|
-
* Native bounds used to reject unjournalable work before external dispatch.
|
|
165
|
-
*/
|
|
166
|
-
readonly capacity: AgentExecutionCapacity;
|
|
167
|
-
/**
|
|
168
|
-
* Persists accepted source work before its Inbox handoff is acknowledged.
|
|
169
|
-
*
|
|
170
|
-
* @param accepted Exact source envelope and selected handler bindings.
|
|
171
|
-
* @returns Stored record, accepting an identical repeat only.
|
|
172
|
-
*/
|
|
173
|
-
admit(accepted: AgentAcceptedInvocation): Promise<AgentExecutionRecord>;
|
|
174
|
-
/**
|
|
175
|
-
* Reads bounded, time-eligible unresolved work through a provider index.
|
|
176
|
-
*
|
|
177
|
-
* @param request Page count and complete continuation.
|
|
178
|
-
* @returns Independent records and continuation state.
|
|
179
|
-
*/
|
|
180
|
-
pending(request: AgentPendingRead): Promise<AgentPendingPage>;
|
|
181
|
-
/**
|
|
182
|
-
* Reads a complete execution record after reconstruction.
|
|
183
|
-
*
|
|
184
|
-
* @param key Exact source and Agent instance identity.
|
|
185
|
-
* @returns Stored record, if present.
|
|
186
|
-
*/
|
|
187
|
-
read(key: AgentInvocationKey): Promise<AgentExecutionRecord | undefined>;
|
|
188
|
-
/**
|
|
189
|
-
* Acquires the earliest unresolved invocation with a fresh provider-side time check.
|
|
190
|
-
*
|
|
191
|
-
* @param key Exact source and Agent instance identity.
|
|
192
|
-
* @param token New unpredictable exclusive token.
|
|
193
|
-
* @param expiresAt Requested claim expiry.
|
|
194
|
-
* @returns Claimed record and current preferences, if eligible.
|
|
195
|
-
*/
|
|
196
|
-
claim(key: AgentInvocationKey, token: string, expiresAt: Timestamp): Promise<AgentExecutionClaim | undefined>;
|
|
197
|
-
/**
|
|
198
|
-
* Updates the same unexpired token under the per-instance claim lock.
|
|
199
|
-
*
|
|
200
|
-
* @param key Exact source and Agent instance identity.
|
|
201
|
-
* @param token Current exclusive token.
|
|
202
|
-
* @param expiresAt Requested later expiry.
|
|
203
|
-
* @returns Whether the current token was renewed.
|
|
204
|
-
*/
|
|
205
|
-
renew(key: AgentInvocationKey, token: string, expiresAt: Timestamp): Promise<boolean>;
|
|
206
|
-
/**
|
|
207
|
-
* Persists fenced budgets, evidence and conversation/System history atomically.
|
|
208
|
-
*
|
|
209
|
-
* @param input Expected exact record and next retained evidence.
|
|
210
|
-
* @returns Completion after fenced evidence is persisted.
|
|
211
|
-
*/
|
|
212
|
-
update(input: AgentExecutionUpdate): Promise<void>;
|
|
213
|
-
/**
|
|
214
|
-
* Persists Entity, history, preferences, execution result and output obligations atomically.
|
|
215
|
-
*
|
|
216
|
-
* @param input Expected exact record and complete transition.
|
|
217
|
-
* @returns Completion after conditional Entity and evidence commit.
|
|
218
|
-
*/
|
|
219
|
-
complete(input: AgentExecutionComplete<I, S>): Promise<void>;
|
|
220
|
-
/**
|
|
221
|
-
* Marks outgoing Command IDs accepted by normal delivery without rerunning handlers.
|
|
222
|
-
*
|
|
223
|
-
* @param key Exact source and Agent instance identity.
|
|
224
|
-
* @param token Current exclusive token.
|
|
225
|
-
* @param expectedRecordBytes Exact binary image before acknowledgement.
|
|
226
|
-
* @param signals Original Command IDs accepted by delivery.
|
|
227
|
-
* @returns Completion after original Commands are marked delivered.
|
|
228
|
-
*/
|
|
229
|
-
markDelivered(key: AgentInvocationKey, token: string, expectedRecordBytes: Uint8Array, signals: readonly CommandId[]): Promise<void>;
|
|
230
|
-
/**
|
|
231
|
-
* Closes this handle without deleting any persisted work.
|
|
232
|
-
*/
|
|
233
|
-
close(): void;
|
|
234
|
-
}
|
|
235
|
-
//# 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,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC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,EAAE,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAE9D;;;;;OAKG;IACH,IAAI,CAAC,GAAG,EAAE,kBAAkB,GAAG,OAAO,CAAC,oBAAoB,GAAG,SAAS,CAAC,CAAC;IAEzE;;;;;;;OAOG;IACH,KAAK,CACH,GAAG,EAAE,kBAAkB,EACvB,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,SAAS,GACnB,OAAO,CAAC,mBAAmB,GAAG,SAAS,CAAC,CAAC;IAE5C;;;;;;;OAOG;IACH,KAAK,CAAC,GAAG,EAAE,kBAAkB,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAEtF;;;;;OAKG;IACH,MAAM,CAAC,KAAK,EAAE,oBAAoB,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,SAAS,EAAE,GAC5B,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"}
|