@spine-event-engine/storage 2.0.0-snapshot.22 → 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.
Files changed (95) hide show
  1. package/README.md +7 -0
  2. package/REFERENCE.md +106 -1
  3. package/dist/entity/agent-execution-record-spec.d.ts +87 -0
  4. package/dist/entity/agent-execution-record-spec.d.ts.map +1 -0
  5. package/dist/entity/agent-execution-record-spec.js +230 -0
  6. package/dist/entity/agent-execution-record-spec.js.map +1 -0
  7. package/dist/entity/agent-execution-sizes.d.ts +30 -0
  8. package/dist/entity/agent-execution-sizes.d.ts.map +1 -0
  9. package/dist/entity/agent-execution-sizes.js +51 -0
  10. package/dist/entity/agent-execution-sizes.js.map +1 -0
  11. package/dist/entity/agent-execution-transitions.d.ts +71 -0
  12. package/dist/entity/agent-execution-transitions.d.ts.map +1 -0
  13. package/dist/entity/agent-execution-transitions.js +182 -0
  14. package/dist/entity/agent-execution-transitions.js.map +1 -0
  15. package/dist/entity/agent-execution-values.d.ts +142 -0
  16. package/dist/entity/agent-execution-values.d.ts.map +1 -0
  17. package/dist/entity/agent-execution-values.js +250 -0
  18. package/dist/entity/agent-execution-values.js.map +1 -0
  19. package/dist/entity/agent-execution.d.ts +234 -0
  20. package/dist/entity/agent-execution.d.ts.map +1 -0
  21. package/dist/entity/agent-execution.js +15 -0
  22. package/dist/entity/agent-execution.js.map +1 -0
  23. package/dist/entity/agent-history-conformance.d.ts +78 -0
  24. package/dist/entity/agent-history-conformance.d.ts.map +1 -0
  25. package/dist/entity/agent-history-conformance.js +493 -0
  26. package/dist/entity/agent-history-conformance.js.map +1 -0
  27. package/dist/entity/agent-history-provider-page.d.ts +39 -0
  28. package/dist/entity/agent-history-provider-page.d.ts.map +1 -0
  29. package/dist/entity/agent-history-provider-page.js +82 -0
  30. package/dist/entity/agent-history-provider-page.js.map +1 -0
  31. package/dist/entity/agent-history-record-spec.d.ts +79 -0
  32. package/dist/entity/agent-history-record-spec.d.ts.map +1 -0
  33. package/dist/entity/agent-history-record-spec.js +147 -0
  34. package/dist/entity/agent-history-record-spec.js.map +1 -0
  35. package/dist/entity/agent-history.d.ts +196 -0
  36. package/dist/entity/agent-history.d.ts.map +1 -0
  37. package/dist/entity/agent-history.js +136 -0
  38. package/dist/entity/agent-history.js.map +1 -0
  39. package/dist/event/event-store.d.ts +52 -4
  40. package/dist/event/event-store.d.ts.map +1 -1
  41. package/dist/event/event-store.js +153 -4
  42. package/dist/event/event-store.js.map +1 -1
  43. package/dist/internal/agent-execution.d.ts +51 -0
  44. package/dist/internal/agent-execution.d.ts.map +1 -0
  45. package/dist/internal/agent-execution.js +53 -0
  46. package/dist/internal/agent-execution.js.map +1 -0
  47. package/dist/internal/agent-history.d.ts +48 -0
  48. package/dist/internal/agent-history.d.ts.map +1 -0
  49. package/dist/internal/agent-history.js +52 -0
  50. package/dist/internal/agent-history.js.map +1 -0
  51. package/dist/internal/entity-history.d.ts +11 -0
  52. package/dist/internal/entity-history.d.ts.map +1 -1
  53. package/dist/internal/entity-history.js +10 -0
  54. package/dist/internal/entity-history.js.map +1 -1
  55. package/dist/internal/tenancy.d.ts +87 -1
  56. package/dist/internal/tenancy.d.ts.map +1 -1
  57. package/dist/internal/tenancy.js +39 -0
  58. package/dist/internal/tenancy.js.map +1 -1
  59. package/dist/memory/agent-execution-head-index.d.ts +52 -0
  60. package/dist/memory/agent-execution-head-index.d.ts.map +1 -0
  61. package/dist/memory/agent-execution-head-index.js +91 -0
  62. package/dist/memory/agent-execution-head-index.js.map +1 -0
  63. package/dist/memory/agent-history-index.d.ts +49 -0
  64. package/dist/memory/agent-history-index.d.ts.map +1 -0
  65. package/dist/memory/agent-history-index.js +239 -0
  66. package/dist/memory/agent-history-index.js.map +1 -0
  67. package/dist/memory/agent-history-mutation-queue.d.ts +17 -0
  68. package/dist/memory/agent-history-mutation-queue.d.ts.map +1 -0
  69. package/dist/memory/agent-history-mutation-queue.js +31 -0
  70. package/dist/memory/agent-history-mutation-queue.js.map +1 -0
  71. package/dist/memory/in-memory-agent-execution.d.ts +21 -0
  72. package/dist/memory/in-memory-agent-execution.d.ts.map +1 -0
  73. package/dist/memory/in-memory-agent-execution.js +587 -0
  74. package/dist/memory/in-memory-agent-execution.js.map +1 -0
  75. package/dist/memory/in-memory-agent-history.d.ts +21 -0
  76. package/dist/memory/in-memory-agent-history.d.ts.map +1 -0
  77. package/dist/memory/in-memory-agent-history.js +133 -0
  78. package/dist/memory/in-memory-agent-history.js.map +1 -0
  79. package/dist/memory/in-memory-entity-commit.d.ts +17 -0
  80. package/dist/memory/in-memory-entity-commit.d.ts.map +1 -1
  81. package/dist/memory/in-memory-entity-commit.js +47 -3
  82. package/dist/memory/in-memory-entity-commit.js.map +1 -1
  83. package/dist/memory/in-memory-entity-history.d.ts +1 -1
  84. package/dist/memory/in-memory-entity-history.d.ts.map +1 -1
  85. package/dist/memory/in-memory-entity-history.js.map +1 -1
  86. package/dist/memory/in-memory-storage-backend.d.ts +18 -0
  87. package/dist/memory/in-memory-storage-backend.d.ts.map +1 -1
  88. package/dist/memory/in-memory-storage-backend.js +71 -0
  89. package/dist/memory/in-memory-storage-backend.js.map +1 -1
  90. package/dist/memory/in-memory-storage-factory.d.ts +37 -2
  91. package/dist/memory/in-memory-storage-factory.d.ts.map +1 -1
  92. package/dist/memory/in-memory-storage-factory.js +144 -3
  93. package/dist/memory/in-memory-storage-factory.js.map +1 -1
  94. package/dist/tsconfig.tsbuildinfo +1 -1
  95. package/package.json +3 -2
@@ -0,0 +1,182 @@
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, toBinary } from "@bufbuild/protobuf";
15
+ import { AgentExecutionRecordSchema, AgentSavedDispatchPlanSchema as SavedDispatchPlanSchema, AgentSavedTargetKind, AgentSavedRepositoryFamily, } from "@spine-event-engine/proto/generated/spine/server/agent/execution_record_pb.js";
16
+ /**
17
+ * Enforces immutable saved output envelopes and one-time route preparation.
18
+ */
19
+ export const AgentExecutionTransitions = {
20
+ /**
21
+ * Rejects an initial completion that claims transport acceptance or a saved route.
22
+ *
23
+ * @param record Persisted Agent execution record.
24
+ */
25
+ assertCompletion(record) {
26
+ const originalIds = new Set();
27
+ for (const output of record.completion?.outgoing ?? []) {
28
+ if (output.signal.case === undefined || output.delivered || output.plan !== undefined)
29
+ throw new Error("Agent completion requires an undelivered original output without a plan.");
30
+ const original = this.originalId(output);
31
+ if (originalIds.has(original))
32
+ throw new Error("Agent completion has duplicate outgoing IDs.");
33
+ originalIds.add(original);
34
+ }
35
+ },
36
+ /**
37
+ * Reads the complete typed ID of one original outgoing envelope.
38
+ *
39
+ * @param output Original Event or Command envelope.
40
+ * @returns Kind and nonempty source ID.
41
+ */
42
+ originalId(output) {
43
+ const kind = output.signal.case;
44
+ const id = kind === "event"
45
+ ? output.signal.value.id?.value
46
+ : kind === "command"
47
+ ? output.signal.value.id?.uuid
48
+ : undefined;
49
+ if (!id?.trim())
50
+ throw new Error("Agent outgoing original ID must be nonempty.");
51
+ if (kind !== "event" && kind !== "command")
52
+ throw new Error("Agent outgoing signal must have a typed kind.");
53
+ return `${kind}:${id}`;
54
+ },
55
+ /**
56
+ * Accepts only absent-to-present saved-plan installation after completion.
57
+ *
58
+ * @param next Proposed next execution record.
59
+ * @param prior Previously persisted execution record.
60
+ */
61
+ assertUpdate(prior, next) {
62
+ if (prior.completion === undefined) {
63
+ if (next.completion !== undefined)
64
+ throw new Error("Agent execution update cannot install completion outside conditional commit.");
65
+ return;
66
+ }
67
+ if (next.completion?.outgoing.length !== prior.completion.outgoing.length)
68
+ throw new Error("Agent saved outputs cannot be replaced.");
69
+ const masked = clone(AgentExecutionRecordSchema, next);
70
+ const priorCompletion = prior.completion;
71
+ const maskedCompletion = masked.completion;
72
+ if (maskedCompletion === undefined)
73
+ throw new Error("Agent completion is missing.");
74
+ for (let i = 0; i < prior.completion.outgoing.length; i += 1) {
75
+ const old = priorCompletion.outgoing[i];
76
+ const current = next.completion.outgoing[i];
77
+ const maskedOutput = maskedCompletion.outgoing[i];
78
+ if (old === undefined || current === undefined || maskedOutput === undefined)
79
+ throw new Error("Agent saved output is missing.");
80
+ if (old.plan !== undefined && !this.samePlan(old, current))
81
+ throw new Error("Agent saved output plan is immutable.");
82
+ if (old.plan === undefined && current.plan !== undefined)
83
+ this.validatePlan(current);
84
+ maskedOutput.plan = old.plan;
85
+ }
86
+ if (!this.sameRecord(prior, masked))
87
+ throw new Error("Completed Agent execution permits only one-time output plan installation.");
88
+ },
89
+ /**
90
+ * Validates a persisted plan before acknowledging each selected original ID.
91
+ *
92
+ * @param record Persisted Agent execution record.
93
+ * @param signals Original outgoing signal identities.
94
+ */
95
+ assertDelivery(record, signals) {
96
+ for (const signal of signals) {
97
+ const output = record.completion?.outgoing.find((item) => this.matches(item, signal));
98
+ if (output?.plan === undefined)
99
+ throw new Error("Agent output cannot be acknowledged before its saved plan exists.");
100
+ }
101
+ },
102
+ /**
103
+ * Checks complete binding identities and typed repository recipients.
104
+ *
105
+ * @param output Saved outgoing signal.
106
+ */
107
+ validatePlan(output) {
108
+ if (output.delivered)
109
+ throw new Error("Agent delivered output cannot install a route plan.");
110
+ for (const target of output.plan?.targets ?? [])
111
+ this.validateTarget(output, target);
112
+ },
113
+ /**
114
+ * Rejects a target that cannot be rebound to the original output kind.
115
+ *
116
+ * @param output Saved outgoing signal.
117
+ * @param target Prepared delivery target.
118
+ */
119
+ validateTarget(output, target) {
120
+ const event = output.signal.case === "event";
121
+ const repository = target.kind === AgentSavedTargetKind.AGENT_SAVED_REPOSITORY_EVENT ||
122
+ target.kind === AgentSavedTargetKind.AGENT_SAVED_REPOSITORY_COMMAND;
123
+ if (!target.signalType.trim() ||
124
+ !target.bindingFingerprint.trim() ||
125
+ (event
126
+ ? target.kind !== AgentSavedTargetKind.AGENT_SAVED_REPOSITORY_EVENT &&
127
+ target.kind !== AgentSavedTargetKind.AGENT_SAVED_STANDALONE_EVENT
128
+ : target.kind !== AgentSavedTargetKind.AGENT_SAVED_REPOSITORY_COMMAND &&
129
+ target.kind !== AgentSavedTargetKind.AGENT_SAVED_STANDALONE_COMMAND))
130
+ throw new Error("Agent saved dispatcher does not match the original output.");
131
+ if (repository
132
+ ? !target.receiverStateType.trim() ||
133
+ target.repositoryFamily === AgentSavedRepositoryFamily.AGENT_SAVED_FAMILY_UNSPECIFIED ||
134
+ target.recipients.some((id) => !id.typeUrl.trim())
135
+ : target.receiverStateType !== "" ||
136
+ target.repositoryFamily !== AgentSavedRepositoryFamily.AGENT_SAVED_FAMILY_UNSPECIFIED ||
137
+ target.recipients.length > 0)
138
+ throw new Error("Agent saved dispatcher has invalid repository or standalone identity.");
139
+ },
140
+ /**
141
+ * Compares complete original plan bytes after installation.
142
+ *
143
+ * @param left First value in the comparison.
144
+ * @param right Second value in the comparison.
145
+ * @returns Whether both saved dispatch plans have identical bytes.
146
+ */
147
+ samePlan(left, right) {
148
+ if (left.plan === undefined || right.plan === undefined)
149
+ return left.plan === right.plan;
150
+ const a = toBinary(SavedDispatchPlanSchema, left.plan);
151
+ const b = toBinary(SavedDispatchPlanSchema, right.plan);
152
+ return a.length === b.length && a.every((byte, index) => byte === b[index]);
153
+ },
154
+ /**
155
+ * Compares every execution field after masking the newly installed plans.
156
+ *
157
+ * @param left First value in the comparison.
158
+ * @param right Second value in the comparison.
159
+ * @returns Whether both execution records have identical bytes.
160
+ */
161
+ sameRecord(left, right) {
162
+ const a = toBinary(AgentExecutionRecordSchema, left);
163
+ const b = toBinary(AgentExecutionRecordSchema, right);
164
+ return a.length === b.length && a.every((byte, index) => byte === b[index]);
165
+ },
166
+ /**
167
+ * Matches a selected typed original Event or Command ID.
168
+ *
169
+ * @param output Saved outgoing signal.
170
+ * @param signal Original signal identity.
171
+ * @returns Whether the saved output has the original signal identity.
172
+ */
173
+ matches(output, signal) {
174
+ return ((signal.id.case === "event" &&
175
+ output.signal.case === "event" &&
176
+ output.signal.value.id?.value === signal.id.value.value) ||
177
+ (signal.id.case === "command" &&
178
+ output.signal.case === "command" &&
179
+ output.signal.value.id?.uuid === signal.id.value.uuid));
180
+ },
181
+ };
182
+ //# sourceMappingURL=agent-execution-transitions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-execution-transitions.js","sourceRoot":"","sources":["../../src/entity/agent-execution-transitions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EACL,0BAA0B,EAC1B,4BAA4B,IAAI,uBAAuB,EACvD,oBAAoB,EACpB,0BAA0B,GAK3B,MAAM,+EAA+E,CAAC;AAEvF;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC;;;;OAIG;IACH,gBAAgB,CAAC,MAA4B;QAC3C,MAAM,WAAW,GAAG,IAAI,GAAG,EAAU,CAAC;QACtC,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,UAAU,EAAE,QAAQ,IAAI,EAAE,EAAE,CAAC;YACvD,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,KAAK,SAAS,IAAI,MAAM,CAAC,SAAS,IAAI,MAAM,CAAC,IAAI,KAAK,SAAS;gBACnF,MAAM,IAAI,KAAK,CAAC,0EAA0E,CAAC,CAAC;YAC9F,MAAM,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;YACzC,IAAI,WAAW,CAAC,GAAG,CAAC,QAAQ,CAAC;gBAC3B,MAAM,I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AAC,KAAK,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;IAC9E,CAAC;IAED;;;;;;OAMG;IACH,OAAO,CAAC,MAA2B,EAAE,MAAsB;QACzD,OAAO,CACL,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,KAAK,OAAO;YACzB,MAAM,CAAC,MAAM,CAAC,IAAI,KAAK,OAAO;YAC9B,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,KAAK,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC;YAC1D,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,KAAK,SAAS;gBAC3B,MAAM,CAAC,MAAM,CAAC,IAAI,KAAK,SAAS;gBAChC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,IAAI,KAAK,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CACzD,CAAC;IACJ,CAAC;CACF,CAAC"}
@@ -0,0 +1,142 @@
1
+ import type { Timestamp } from "@bufbuild/protobuf/wkt";
2
+ import { type AgentAcceptedInvocation, type AgentExecutionCompletion, 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
+ /**
4
+ * Reads and compares original Agent execution values across storage providers.
5
+ */
6
+ export declare const AgentExecutionValues: {
7
+ /**
8
+ * Validates a present value at a provider trust boundary.
9
+ *
10
+ * @param value Optional decoded or selected value.
11
+ * @returns The present value.
12
+ * @typeParam T Value type.
13
+ */
14
+ require<T>(value: T | undefined): T;
15
+ /**
16
+ * Validates an invocation in the configured state family.
17
+ *
18
+ * @param key Complete original invocation key.
19
+ * @param stateType Configured generated state type.
20
+ * @returns Validated key.
21
+ */
22
+ requiredKey(key: AgentInvocationKey | undefined, stateType: string): AgentInvocationKey;
23
+ /**
24
+ * Validates immutable source facts and original Inbox order.
25
+ *
26
+ * @param record Persisted execution record.
27
+ * @returns Complete accepted source facts.
28
+ */
29
+ requiredAccepted(record: AgentExecutionRecord): AgentAcceptedInvocation;
30
+ /**
31
+ * Reads the accepted invocation key.
32
+ *
33
+ * @param record Persisted execution record.
34
+ * @returns Complete key.
35
+ */
36
+ requiredInvocation(record: AgentExecutionRecord): AgentInvocationKey;
37
+ /**
38
+ * Validates the generated state type and Agent key.
39
+ *
40
+ * @param key Original invocation identity.
41
+ * @returns Complete instance scope.
42
+ */
43
+ requiredScope(key: AgentInvocationKey | undefined): AgentExecutionScope;
44
+ /**
45
+ * Validates the scope stored in one per-instance head.
46
+ *
47
+ * @param head Persisted claim and discovery head.
48
+ * @returns Complete instance scope.
49
+ */
50
+ requiredHeadScope(head: AgentExecutionHead): AgentExecutionScope;
51
+ /**
52
+ * Reads original Inbox order from immutable acceptance.
53
+ *
54
+ * @param record Persisted execution record.
55
+ * @returns Complete Inbox order.
56
+ */
57
+ requiredOrder(record: AgentExecutionRecord): AgentInboxOrder;
58
+ /**
59
+ * Validates completed output obligations.
60
+ *
61
+ * @param record Persisted execution record.
62
+ * @returns Complete result.
63
+ */
64
+ requiredCompletion(record: AgentExecutionRecord): AgentExecutionCompletion;
65
+ /**
66
+ * Compares binary indexed strings without locale collation.
67
+ *
68
+ * @param left First full index key.
69
+ * @param right Second full index key.
70
+ * @returns Negative, zero, or positive order.
71
+ */
72
+ compareText(left: string, right: string): number;
73
+ /**
74
+ * Compares complete accepted source facts.
75
+ *
76
+ * @param left Previous accepted facts.
77
+ * @param right Proposed accepted facts.
78
+ * @returns Whether all original bytes match.
79
+ */
80
+ sameAccepted(left: AgentAcceptedInvocation | undefined, right: AgentAcceptedInvocation | undefined): boolean;
81
+ /**
82
+ * Compares exact binary images without integer conversion.
83
+ *
84
+ * @param left Previous Protobuf image.
85
+ * @param right Proposed Protobuf image.
86
+ * @returns Whether each byte matches.
87
+ */
88
+ sameBytes(left: Uint8Array, right: Uint8Array): boolean;
89
+ /**
90
+ * Returns an independent exact execution record.
91
+ *
92
+ * @param record Persisted record.
93
+ * @returns Binary round-tripped record.
94
+ */
95
+ cloneRecord(record: AgentExecutionRecord): AgentExecutionRecord;
96
+ /**
97
+ * Compares full seconds and nanos.
98
+ *
99
+ * @param left First Timestamp.
100
+ * @param right Second Timestamp.
101
+ * @returns Negative, zero, or positive order.
102
+ */
103
+ compareTime(left: Timestamp, right: Timestamp): number;
104
+ /**
105
+ * Checks whether accepted or expired work is claimable now.
106
+ *
107
+ * @param record Persisted invocation.
108
+ * @param now Fresh provider Timestamp.
109
+ * @returns Whether a claim may attempt it.
110
+ */
111
+ isPending(record: AgentExecutionRecord, now: Timestamp): boolean;
112
+ /**
113
+ * Clears the resolved claim while retaining original order.
114
+ *
115
+ * @param head Per-instance claim and discovery record.
116
+ * @param order Original Inbox order of resolved work.
117
+ */
118
+ release(head: AgentExecutionHead, order: AgentInboxOrder): void;
119
+ /**
120
+ * Updates a discoverable head for earlier original Inbox work without resetting eligibility.
121
+ *
122
+ * @param head Current per-instance claim and discovery row.
123
+ * @param record Newly accepted original invocation.
124
+ */
125
+ offerCandidate(head: AgentExecutionHead, record: AgentExecutionRecord): void;
126
+ /**
127
+ * Updates the resolved head with its earliest unresolved successor.
128
+ *
129
+ * @param head Current per-instance claim and discovery row.
130
+ * @param order Original Inbox order of resolved work.
131
+ * @param next Earliest remaining invocation when present.
132
+ */
133
+ advanceCandidate(head: AgentExecutionHead, order: AgentInboxOrder, next: AgentExecutionRecord | undefined): void;
134
+ /**
135
+ * Marks one original recorded outgoing ID delivered.
136
+ *
137
+ * @param record Completion carrying original outputs.
138
+ * @param signal Typed Event or Command ID.
139
+ */
140
+ markSignal(record: AgentExecutionCompletion, signal: AgentSignalKey): void;
141
+ };
142
+ //# sourceMappingURL=agent-execution-values.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-execution-values.d.ts","sourceRoot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oB,GAAG,IAAI;IAc5E;;;;;;OAMG;2BAEK,kBAAkB,SACjB,eAAe,QAChB,oBAAoB,GAAG,SAAS,GACrC,IAAI;IAOP;;;;;OAKG;uBACgB,wBAAwB,UAAU,cAAc,GAAG,IAAI;CAa3E,CAAC"}
@@ -0,0 +1,250 @@
1
+ /*
2
+ * Copyright 2026, CodeMatters. All rights reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5
+ * in compliance with the License. You may obtain a copy of the License at
6
+ *
7
+ * https://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
10
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11
+ * or implied. See the License for the specific language governing permissions and limitations under
12
+ * the License.
13
+ */
14
+ import { fromBinary, toBinary } from "@bufbuild/protobuf";
15
+ import { 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
+ return (left !== undefined &&
136
+ right !== undefined &&
137
+ this.sameBytes(toBinary(AgentAcceptedInvocationSchema, left), toBinary(AgentAcceptedInvocationSchema, right)));
138
+ },
139
+ /**
140
+ * Compares exact binary images without integer conversion.
141
+ *
142
+ * @param left Previous Protobuf image.
143
+ * @param right Proposed Protobuf image.
144
+ * @returns Whether each byte matches.
145
+ */
146
+ sameBytes(left, right) {
147
+ return left.length === right.length && left.every((byte, index) => byte === right[index]);
148
+ },
149
+ /**
150
+ * Returns an independent exact execution record.
151
+ *
152
+ * @param record Persisted record.
153
+ * @returns Binary round-tripped record.
154
+ */
155
+ cloneRecord(record) {
156
+ return fromBinary(AgentExecutionRecordSchema, toBinary(AgentExecutionRecordSchema, record));
157
+ },
158
+ /**
159
+ * Compares full seconds and nanos.
160
+ *
161
+ * @param left First Timestamp.
162
+ * @param right Second Timestamp.
163
+ * @returns Negative, zero, or positive order.
164
+ */
165
+ compareTime(left, right) {
166
+ return left.seconds < right.seconds
167
+ ? -1
168
+ : left.seconds > right.seconds
169
+ ? 1
170
+ : left.nanos - right.nanos;
171
+ },
172
+ /**
173
+ * Checks whether accepted or expired work is claimable now.
174
+ *
175
+ * @param record Persisted invocation.
176
+ * @param now Fresh provider Timestamp.
177
+ * @returns Whether a claim may attempt it.
178
+ */
179
+ isPending(record, now) {
180
+ if (record.status === AgentInvocationStatus.AGENT_INVOCATION_ACCEPTED ||
181
+ record.status === AgentInvocationStatus.AGENT_INVOCATION_COMPLETED_PENDING_DELIVERY)
182
+ return true;
183
+ return (record.status === AgentInvocationStatus.AGENT_INVOCATION_ACTIVE &&
184
+ record.claimExpiresAt !== undefined &&
185
+ this.compareTime(record.claimExpiresAt, now) <= 0);
186
+ },
187
+ /**
188
+ * Clears the resolved claim while retaining original order.
189
+ *
190
+ * @param head Per-instance claim and discovery record.
191
+ * @param order Original Inbox order of resolved work.
192
+ */
193
+ release(head, order) {
194
+ head.active = undefined;
195
+ head.claimToken = "";
196
+ head.claimExpiresAt = undefined;
197
+ head.lastResolved = order;
198
+ },
199
+ /**
200
+ * Updates a discoverable head for earlier original Inbox work without resetting eligibility.
201
+ *
202
+ * @param head Current per-instance claim and discovery row.
203
+ * @param record Newly accepted original invocation.
204
+ */
205
+ offerCandidate(head, record) {
206
+ const order = this.requiredOrder(record);
207
+ if (head.pendingOrder !== undefined &&
208
+ AgentExecutionRecords.order(head.pendingOrder) <= AgentExecutionRecords.order(order))
209
+ return;
210
+ head.pending = this.requiredInvocation(record);
211
+ head.pendingOrder = order;
212
+ if (head.active === undefined)
213
+ head.eligibleAt ??= Time.currentTime();
214
+ else if (head.claimExpiresAt !== undefined)
215
+ head.eligibleAt = head.claimExpiresAt;
216
+ else
217
+ throw new Error("Agent active head requires lease expiry.");
218
+ },
219
+ /**
220
+ * Updates the resolved head with its earliest unresolved successor.
221
+ *
222
+ * @param head Current per-instance claim and discovery row.
223
+ * @param order Original Inbox order of resolved work.
224
+ * @param next Earliest remaining invocation when present.
225
+ */
226
+ advanceCandidate(head, order, next) {
227
+ this.release(head, order);
228
+ head.pending = next === undefined ? undefined : this.requiredInvocation(next);
229
+ head.pendingOrder = next === undefined ? undefined : this.requiredOrder(next);
230
+ head.eligibleAt = next === undefined ? undefined : Time.currentTime();
231
+ },
232
+ /**
233
+ * Marks one original recorded outgoing ID delivered.
234
+ *
235
+ * @param record Completion carrying original outputs.
236
+ * @param signal Typed Event or Command ID.
237
+ */
238
+ markSignal(record, signal) {
239
+ const outgoing = record.outgoing.find((item) => (signal.id.case === "event" &&
240
+ item.signal.case === "event" &&
241
+ item.signal.value.id?.value === signal.id.value.value) ||
242
+ (signal.id.case === "command" &&
243
+ item.signal.case === "command" &&
244
+ item.signal.value.id?.uuid === signal.id.value.uuid));
245
+ if (outgoing === undefined)
246
+ throw new Error("Agent outgoing signal ID was not recorded.");
247
+ outgoing.delivered = true;
248
+ },
249
+ };
250
+ //# sourceMappingURL=agent-execution-values.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-execution-values.js","sourceRoot":"","sources":["../../src/entity/agent-execution-values.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE1D,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAChD,OAAO,EACL,6BAA6B,EAC7B,0BAA0B,EAC1B,qBAAqB,GAStB,MAAM,+EAA+E,CAAC;AAEvF,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AAEzE;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC;;;;;;OAMG;IACH,OAAO,CAAI,KAAoB;QAC7B,IAAI,KAAK,KAAK,SAAS;YAAE,MAAM,IAAI,SAAS,CAAC,mCAAmC,CAAC,CAAC;QAClF,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;;;;OAMG;IACH,WAAW,CAAC,GAAmC,EAAE,SAAiB;QAChE,IACE,GAAG,EAAE,KAAK,EAAE,SAAS,KAAK,SAAS;YACnC,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ;YACnB,GAAG,CAAC,YAAY,KAAK,SAAS;YAE9B,MAAM,IAAI,SAAS,CACjB,0EAA0E,CAC3E,CAAC;QACJ,qBAAqB,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;QACtC,OAAO,GAAG,CAAC;IACb,CAAC;IAED;;;;;OAKG;IACH,gBAAgB,CAAC,MAA4B;QAC3C,IAAI,MAAM,CAAC,QAAQ,EAAE,GAAG,EAAE,KAAK,KAAK,SAAS,IAAI,MAA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