agentfootprint 9.36.0 → 9.37.0
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/dist/adapters/hosting/firestoreSessions.js +28 -6
- package/dist/adapters/hosting/firestoreSessions.js.map +1 -1
- package/dist/adapters/hosting/googleAgentEngine.js +64 -0
- package/dist/adapters/hosting/googleAgentEngine.js.map +1 -1
- package/dist/adapters/memory/agentcore.js +7 -1
- package/dist/adapters/memory/agentcore.js.map +1 -1
- package/dist/adapters/memory/memoryBank.js +29 -8
- package/dist/adapters/memory/memoryBank.js.map +1 -1
- package/dist/adapters/memory/redis.js +28 -1
- package/dist/adapters/memory/redis.js.map +1 -1
- package/dist/artifacts/scopePath.js +13 -2
- package/dist/artifacts/scopePath.js.map +1 -1
- package/dist/esm/adapters/hosting/firestoreSessions.js +29 -7
- package/dist/esm/adapters/hosting/firestoreSessions.js.map +1 -1
- package/dist/esm/adapters/hosting/googleAgentEngine.js +64 -0
- package/dist/esm/adapters/hosting/googleAgentEngine.js.map +1 -1
- package/dist/esm/adapters/memory/agentcore.js +7 -1
- package/dist/esm/adapters/memory/agentcore.js.map +1 -1
- package/dist/esm/adapters/memory/memoryBank.d.ts +13 -3
- package/dist/esm/adapters/memory/memoryBank.js +29 -8
- package/dist/esm/adapters/memory/memoryBank.js.map +1 -1
- package/dist/esm/adapters/memory/redis.d.ts +25 -0
- package/dist/esm/adapters/memory/redis.js +28 -1
- package/dist/esm/adapters/memory/redis.js.map +1 -1
- package/dist/esm/artifacts/scopePath.d.ts +9 -1
- package/dist/esm/artifacts/scopePath.js +13 -2
- package/dist/esm/artifacts/scopePath.js.map +1 -1
- package/dist/esm/hosting/conformance/cases.d.ts +15 -0
- package/dist/esm/hosting/conformance/cases.js +395 -0
- package/dist/esm/hosting/conformance/cases.js.map +1 -0
- package/dist/esm/hosting/conformance/index.d.ts +11 -0
- package/dist/esm/hosting/conformance/index.js +11 -0
- package/dist/esm/hosting/conformance/index.js.map +1 -0
- package/dist/esm/hosting/conformance/run.d.ts +46 -0
- package/dist/esm/hosting/conformance/run.js +182 -0
- package/dist/esm/hosting/conformance/run.js.map +1 -0
- package/dist/esm/hosting/conformance/types.d.ts +140 -0
- package/dist/esm/hosting/conformance/types.js +6 -0
- package/dist/esm/hosting/conformance/types.js.map +1 -0
- package/dist/esm/hosting/errors.d.ts +34 -0
- package/dist/esm/hosting/errors.js +47 -0
- package/dist/esm/hosting/errors.js.map +1 -1
- package/dist/esm/hosting/index.d.ts +4 -1
- package/dist/esm/hosting/index.js +11 -1
- package/dist/esm/hosting/index.js.map +1 -1
- package/dist/esm/hosting/memorySessions.d.ts +5 -0
- package/dist/esm/hosting/memorySessions.js +25 -17
- package/dist/esm/hosting/memorySessions.js.map +1 -1
- package/dist/esm/hosting/sessionOwnership.d.ts +86 -0
- package/dist/esm/hosting/sessionOwnership.js +106 -0
- package/dist/esm/hosting/sessionOwnership.js.map +1 -0
- package/dist/esm/hosting/sqliteSessions.js +41 -10
- package/dist/esm/hosting/sqliteSessions.js.map +1 -1
- package/dist/esm/hosting/types.d.ts +68 -4
- package/dist/esm/hosting/types.js.map +1 -1
- package/dist/esm/memory/identity/encode.d.ts +67 -0
- package/dist/esm/memory/identity/encode.js +91 -0
- package/dist/esm/memory/identity/encode.js.map +1 -0
- package/dist/esm/memory/identity/index.d.ts +1 -0
- package/dist/esm/memory/identity/index.js +1 -0
- package/dist/esm/memory/identity/index.js.map +1 -1
- package/dist/esm/memory/identity/types.d.ts +21 -4
- package/dist/esm/memory/identity/types.js +27 -7
- package/dist/esm/memory/identity/types.js.map +1 -1
- package/dist/hosting/conformance/cases.js +398 -0
- package/dist/hosting/conformance/cases.js.map +1 -0
- package/dist/hosting/conformance/index.js +18 -0
- package/dist/hosting/conformance/index.js.map +1 -0
- package/dist/hosting/conformance/run.js +188 -0
- package/dist/hosting/conformance/run.js.map +1 -0
- package/dist/hosting/conformance/types.js +7 -0
- package/dist/hosting/conformance/types.js.map +1 -0
- package/dist/hosting/errors.js +49 -1
- package/dist/hosting/errors.js.map +1 -1
- package/dist/hosting/index.js +18 -2
- package/dist/hosting/index.js.map +1 -1
- package/dist/hosting/memorySessions.js +25 -17
- package/dist/hosting/memorySessions.js.map +1 -1
- package/dist/hosting/sessionOwnership.js +110 -0
- package/dist/hosting/sessionOwnership.js.map +1 -0
- package/dist/hosting/sqliteSessions.js +41 -10
- package/dist/hosting/sqliteSessions.js.map +1 -1
- package/dist/hosting/types.js.map +1 -1
- package/dist/memory/identity/encode.js +96 -0
- package/dist/memory/identity/encode.js.map +1 -0
- package/dist/memory/identity/index.js +5 -1
- package/dist/memory/identity/index.js.map +1 -1
- package/dist/memory/identity/types.js +27 -7
- package/dist/memory/identity/types.js.map +1 -1
- package/dist/types/adapters/hosting/firestoreSessions.d.ts.map +1 -1
- package/dist/types/adapters/hosting/googleAgentEngine.d.ts.map +1 -1
- package/dist/types/adapters/memory/agentcore.d.ts.map +1 -1
- package/dist/types/adapters/memory/memoryBank.d.ts +13 -3
- package/dist/types/adapters/memory/memoryBank.d.ts.map +1 -1
- package/dist/types/adapters/memory/redis.d.ts +25 -0
- package/dist/types/adapters/memory/redis.d.ts.map +1 -1
- package/dist/types/artifacts/scopePath.d.ts +9 -1
- package/dist/types/artifacts/scopePath.d.ts.map +1 -1
- package/dist/types/hosting/conformance/cases.d.ts +16 -0
- package/dist/types/hosting/conformance/cases.d.ts.map +1 -0
- package/dist/types/hosting/conformance/index.d.ts +12 -0
- package/dist/types/hosting/conformance/index.d.ts.map +1 -0
- package/dist/types/hosting/conformance/run.d.ts +47 -0
- package/dist/types/hosting/conformance/run.d.ts.map +1 -0
- package/dist/types/hosting/conformance/types.d.ts +141 -0
- package/dist/types/hosting/conformance/types.d.ts.map +1 -0
- package/dist/types/hosting/errors.d.ts +34 -0
- package/dist/types/hosting/errors.d.ts.map +1 -1
- package/dist/types/hosting/index.d.ts +4 -1
- package/dist/types/hosting/index.d.ts.map +1 -1
- package/dist/types/hosting/memorySessions.d.ts +5 -0
- package/dist/types/hosting/memorySessions.d.ts.map +1 -1
- package/dist/types/hosting/sessionOwnership.d.ts +87 -0
- package/dist/types/hosting/sessionOwnership.d.ts.map +1 -0
- package/dist/types/hosting/sqliteSessions.d.ts.map +1 -1
- package/dist/types/hosting/types.d.ts +68 -4
- package/dist/types/hosting/types.d.ts.map +1 -1
- package/dist/types/memory/identity/encode.d.ts +68 -0
- package/dist/types/memory/identity/encode.d.ts.map +1 -0
- package/dist/types/memory/identity/index.d.ts +1 -0
- package/dist/types/memory/identity/index.d.ts.map +1 -1
- package/dist/types/memory/identity/types.d.ts +21 -4
- package/dist/types/memory/identity/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* hosting/conformance/run — running the battery, and saying honestly how it
|
|
4
|
+
* went.
|
|
5
|
+
*
|
|
6
|
+
* The runner owns exactly three decisions, and all three are about the ways a
|
|
7
|
+
* case can NOT run:
|
|
8
|
+
*
|
|
9
|
+
* 1. the case is about an OPTIONAL port member this store does not implement
|
|
10
|
+
* → `'not-applicable'`, naming the member. Feature detection, which is the
|
|
11
|
+
* port's own rule applied to its own battery.
|
|
12
|
+
* 2. the store implements it and cannot satisfy the case, and the harness said
|
|
13
|
+
* so by name → `'declared'`, carrying the reason. It is run ANYWAY, so a
|
|
14
|
+
* declaration that has quietly become untrue is visible rather than
|
|
15
|
+
* permanent.
|
|
16
|
+
* 3. the case needs a harness hook nobody supplied and nobody declared →
|
|
17
|
+
* `'failed'`. This is the one that matters: an undeclared skip is a pass
|
|
18
|
+
* with the evidence removed, which is the same shape as every defect this
|
|
19
|
+
* suite exists to catch.
|
|
20
|
+
*/
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.formatConformanceReport = exports.runSessionLifecycleConformance = exports.runSessionLifecycleCase = void 0;
|
|
23
|
+
const cases_js_1 = require("./cases.js");
|
|
24
|
+
/** Unique enough that two runs against one shared backend cannot collide. */
|
|
25
|
+
let counter = 0;
|
|
26
|
+
function kitFor(harness) {
|
|
27
|
+
const run = `cnf-${Date.now().toString(36)}-${(++counter).toString(36)}`;
|
|
28
|
+
let nth = 0;
|
|
29
|
+
return {
|
|
30
|
+
harness,
|
|
31
|
+
id: (suffix) => `${run}-${(++nth).toString(36)}-${suffix}`,
|
|
32
|
+
envelope: (text, principal, savedAt) => buildEnvelope(text, principal, savedAt),
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* A minimal, VALID stored conversation.
|
|
37
|
+
*
|
|
38
|
+
* Built here rather than through `toEnvelope` so `savedAt` is the caller's —
|
|
39
|
+
* the paging case needs several conversations to share one timestamp, which is
|
|
40
|
+
* the only way to make a listing's tie-break the thing under test.
|
|
41
|
+
*/
|
|
42
|
+
function buildEnvelope(text, principal, savedAt) {
|
|
43
|
+
return {
|
|
44
|
+
format: 'conversation-v1',
|
|
45
|
+
savedAt: savedAt ?? 1_700_000_000_000,
|
|
46
|
+
data: {
|
|
47
|
+
version: 1,
|
|
48
|
+
runId: `run-${text.replace(/\W+/g, '-')}`,
|
|
49
|
+
history: [
|
|
50
|
+
{ role: 'user', content: text },
|
|
51
|
+
{ role: 'assistant', content: `re: ${text}` },
|
|
52
|
+
],
|
|
53
|
+
lastCompletedIteration: 1,
|
|
54
|
+
originalInput: { message: text },
|
|
55
|
+
checkpointedAt: savedAt ?? 1_700_000_000_000,
|
|
56
|
+
...(principal !== undefined && { identity: { principal } }),
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
/** Is this member there to be called? The same detection every door uses. */
|
|
61
|
+
function has(store, member) {
|
|
62
|
+
return typeof store[member] === 'function';
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Run ONE case against one store, building and disposing the store around it.
|
|
66
|
+
*
|
|
67
|
+
* Exported because a test framework wants one assertion per case: iterate
|
|
68
|
+
* {@link sessionLifecycleConformance}, call this, and turn the outcome into a
|
|
69
|
+
* `it()`. That gives per-case granularity in any framework without this module
|
|
70
|
+
* knowing what a framework is.
|
|
71
|
+
*/
|
|
72
|
+
async function runSessionLifecycleCase(testCase, harness) {
|
|
73
|
+
const head = { case: testCase.name, law: testCase.law };
|
|
74
|
+
const declaredReason = harness.declared?.[testCase.name];
|
|
75
|
+
let store;
|
|
76
|
+
try {
|
|
77
|
+
store = await harness.createStore();
|
|
78
|
+
for (const member of testCase.members ?? []) {
|
|
79
|
+
// Not applicable BEFORE declared: a store that does not implement
|
|
80
|
+
// `ownerOf` at all has nothing to declare about it, and reporting a
|
|
81
|
+
// declaration there would make the store look like it fell short of
|
|
82
|
+
// something the port never asked it for.
|
|
83
|
+
if (!has(store, member))
|
|
84
|
+
return { ...head, status: 'not-applicable', missing: member };
|
|
85
|
+
}
|
|
86
|
+
if (testCase.harnessNeeds?.includes('corrupt') && harness.corrupt === undefined) {
|
|
87
|
+
if (declaredReason !== undefined) {
|
|
88
|
+
return { ...head, status: 'declared', reason: declaredReason, stillFails: true };
|
|
89
|
+
}
|
|
90
|
+
return {
|
|
91
|
+
...head,
|
|
92
|
+
status: 'failed',
|
|
93
|
+
error: new Error(`[conformance] '${testCase.name}' needs harness.corrupt() and this harness has ` +
|
|
94
|
+
`none — so the case did not run, and a case that did not run must never look ` +
|
|
95
|
+
`like one that passed. Supply the hook, or DECLARE this case by name with the ` +
|
|
96
|
+
`reason your store cannot be corrupted from outside:\n` +
|
|
97
|
+
` declared: { '${testCase.name}': 'why not' }`),
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
await testCase.run(store, kitFor(harness));
|
|
101
|
+
}
|
|
102
|
+
catch (err) {
|
|
103
|
+
const error = err instanceof Error ? err : new Error(String(err));
|
|
104
|
+
// A declared case that still fails is the harness telling the truth.
|
|
105
|
+
if (declaredReason !== undefined) {
|
|
106
|
+
return { ...head, status: 'declared', reason: declaredReason, stillFails: true };
|
|
107
|
+
}
|
|
108
|
+
return { ...head, status: 'failed', error };
|
|
109
|
+
}
|
|
110
|
+
finally {
|
|
111
|
+
if (store !== undefined) {
|
|
112
|
+
try {
|
|
113
|
+
await harness.disposeStore?.(store);
|
|
114
|
+
}
|
|
115
|
+
catch {
|
|
116
|
+
/* A store that could not be torn down must not rewrite the verdict of
|
|
117
|
+
the case that was using it — the case's own result is the finding. */
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
// It PASSED. If it was declared, the declaration is stale — worth saying,
|
|
122
|
+
// because a suppression nobody revisits is how a fixed defect keeps its
|
|
123
|
+
// exemption and a real one inherits it later.
|
|
124
|
+
if (declaredReason !== undefined) {
|
|
125
|
+
return { ...head, status: 'declared', reason: declaredReason, stillFails: false };
|
|
126
|
+
}
|
|
127
|
+
return { ...head, status: 'passed' };
|
|
128
|
+
}
|
|
129
|
+
exports.runSessionLifecycleCase = runSessionLifecycleCase;
|
|
130
|
+
/**
|
|
131
|
+
* Run the whole battery against one store and report.
|
|
132
|
+
*
|
|
133
|
+
* @example Claiming the port for a store of your own
|
|
134
|
+
* const report = await runSessionLifecycleConformance({
|
|
135
|
+
* name: 'ourOwnSessions',
|
|
136
|
+
* createStore: () => ourOwnSessions({ pool }),
|
|
137
|
+
* disposeStore: (store) => store.close(),
|
|
138
|
+
* });
|
|
139
|
+
* if (!report.ok) throw new Error(formatConformanceReport(report));
|
|
140
|
+
*/
|
|
141
|
+
async function runSessionLifecycleConformance(harness) {
|
|
142
|
+
const outcomes = [];
|
|
143
|
+
for (const testCase of cases_js_1.sessionLifecycleConformance) {
|
|
144
|
+
outcomes.push(await runSessionLifecycleCase(testCase, harness));
|
|
145
|
+
}
|
|
146
|
+
const count = (status) => outcomes.filter((o) => o.status === status).length;
|
|
147
|
+
const failed = count('failed');
|
|
148
|
+
return {
|
|
149
|
+
store: harness.name,
|
|
150
|
+
outcomes,
|
|
151
|
+
passed: count('passed'),
|
|
152
|
+
notApplicable: count('not-applicable'),
|
|
153
|
+
declared: count('declared'),
|
|
154
|
+
failed,
|
|
155
|
+
ok: failed === 0,
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
exports.runSessionLifecycleConformance = runSessionLifecycleConformance;
|
|
159
|
+
/**
|
|
160
|
+
* The report as something to put in a failure message or a log — one line per
|
|
161
|
+
* case, with the reason a case did not simply pass.
|
|
162
|
+
*/
|
|
163
|
+
function formatConformanceReport(report) {
|
|
164
|
+
const lines = [
|
|
165
|
+
`SessionLifecycle conformance — ${report.store}: ${report.passed} passed, ` +
|
|
166
|
+
`${report.declared} declared, ${report.notApplicable} n/a, ${report.failed} FAILED`,
|
|
167
|
+
];
|
|
168
|
+
for (const outcome of report.outcomes) {
|
|
169
|
+
if (outcome.status === 'passed') {
|
|
170
|
+
lines.push(` ok ${outcome.case}`);
|
|
171
|
+
}
|
|
172
|
+
else if (outcome.status === 'not-applicable') {
|
|
173
|
+
lines.push(` n/a ${outcome.case} — no ${outcome.missing}() on this store`);
|
|
174
|
+
}
|
|
175
|
+
else if (outcome.status === 'declared') {
|
|
176
|
+
lines.push(` declared ${outcome.case} — ${outcome.reason}` +
|
|
177
|
+
(outcome.stillFails ? '' : ' [STALE: it passes now]'));
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
lines.push(` FAILED ${outcome.case}`);
|
|
181
|
+
lines.push(` law: ${outcome.law}`);
|
|
182
|
+
lines.push(` ${outcome.error.message.split('\n').join('\n ')}`);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
return lines.join('\n');
|
|
186
|
+
}
|
|
187
|
+
exports.formatConformanceReport = formatConformanceReport;
|
|
188
|
+
//# sourceMappingURL=run.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../../src/hosting/conformance/run.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;GAkBG;;;AAEH,yCAAyD;AAWzD,6EAA6E;AAC7E,IAAI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AAkB,CAAC,CAAC;QACpF,CAAC;aAAM,IAAI,OAAO,CAAC,MAAM,KAAK,UAAU,EAAE,CAAC;YACzC,KAAK,CAAC,IAAI,CACR,eAAe,OAAO,CAAC,IAAI,MAAM,OAAO,CAAC,MAAM,EAAE;gBAC/C,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,0BAA0B,CAAC,CACzD,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,KAAK,CAAC,IAAI,CAAC,eAAe,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;YAC1C,KAAK,CAAC,IAAI,CAAC,oBAAoB,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;YAC9C,KAAK,CAAC,IAAI,CAAC,eAAe,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC;QACxF,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAtBD,0DAsBC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/hosting/conformance/types.ts"],"names":[],"mappings":";AAAA;;;GAGG"}
|
package/dist/hosting/errors.js
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* say so loudly and name the adapter it is talking about.
|
|
20
20
|
*/
|
|
21
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.requireCapability = exports.SessionsNotCarriedError = exports.SessionNotFoundError = exports.SessionIndexUnavailableError = exports.SessionOpNeedsIdentityError = exports.AdmissionRefusedError = exports.VerifierUnavailableError = exports.IdentityNotVerifiedError = exports.UnreadableEnvelopeError = exports.ArtifactNotCarriedError = exports.ArtifactNotFoundError = exports.NoArtifactStoreError = exports.ArtifactSessionRequiredError = exports.InvalidWireOpError = exports.FrameTooLargeError = exports.ConversationClosedError = exports.NoPendingAskError = exports.AwaitingDecisionError = exports.PauseNotCarriedError = exports.ConcurrentRunError = exports.HostClosedError = void 0;
|
|
22
|
+
exports.requireCapability = exports.SessionsNotCarriedError = exports.SessionOwnershipConflictError = exports.SessionNotFoundError = exports.SessionIndexUnavailableError = exports.SessionOpNeedsIdentityError = exports.AdmissionRefusedError = exports.VerifierUnavailableError = exports.IdentityNotVerifiedError = exports.UnreadableEnvelopeError = exports.ArtifactNotCarriedError = exports.ArtifactNotFoundError = exports.NoArtifactStoreError = exports.ArtifactSessionRequiredError = exports.InvalidWireOpError = exports.FrameTooLargeError = exports.ConversationClosedError = exports.NoPendingAskError = exports.AwaitingDecisionError = exports.PauseNotCarriedError = exports.ConcurrentRunError = exports.HostClosedError = void 0;
|
|
23
23
|
const storedPreview_js_1 = require("../lib/storedPreview.js");
|
|
24
24
|
/**
|
|
25
25
|
* Thrown when a request arrives at a host that is shutting down or shut down.
|
|
@@ -615,6 +615,54 @@ class SessionNotFoundError extends Error {
|
|
|
615
615
|
}
|
|
616
616
|
}
|
|
617
617
|
exports.SessionNotFoundError = SessionNotFoundError;
|
|
618
|
+
/**
|
|
619
|
+
* A `persist` would have left the ownership index naming one person and the
|
|
620
|
+
* stored conversation naming another (9.36.1).
|
|
621
|
+
*
|
|
622
|
+
* ── The split brain this exists to prevent ──────────────────────────────────
|
|
623
|
+
* The write-once rule protects the INDEX and said nothing about the PAYLOAD.
|
|
624
|
+
* Two writers signing the same fresh session therefore produced a store where
|
|
625
|
+
* `ownerOf(session)` answered the FIRST writer and the stored envelope carried
|
|
626
|
+
* the SECOND writer's whole conversation — and the envelope carries its own
|
|
627
|
+
* identity. The first writer lists the session, opens it, and reads somebody
|
|
628
|
+
* else's conversation. That is not a race in one backend: it was reproduced in
|
|
629
|
+
* a live trial and then found, by inspection, in every store implementing this
|
|
630
|
+
* contract, because the flaw was in the contract rather than in any of them.
|
|
631
|
+
*
|
|
632
|
+
* So the rule gained its missing half: **a different non-empty identity is
|
|
633
|
+
* refused, and an absent one is allowed.** A leaner turn claims nobody and
|
|
634
|
+
* cannot contradict anybody — the contract explicitly blesses it — while a
|
|
635
|
+
* turn signed by somebody else is a contradiction, and a store that stored it
|
|
636
|
+
* would be a store where ownership is decided by who wrote last.
|
|
637
|
+
*
|
|
638
|
+
* ── What this refusal will not tell you ─────────────────────────────────────
|
|
639
|
+
* Neither name. Not the owner, not the caller, not a line of either
|
|
640
|
+
* conversation. An error is read by whoever provoked it, and a refusal that
|
|
641
|
+
* names the person who owns a session is an oracle for who is signed in — the
|
|
642
|
+
* same law {@link SessionNotFoundError} and {@link ArtifactNotFoundError}
|
|
643
|
+
* follow. The session id is here because it is the caller's own string, which
|
|
644
|
+
* is the one thing the message teaches nobody anything by repeating.
|
|
645
|
+
*/
|
|
646
|
+
class SessionOwnershipConflictError extends Error {
|
|
647
|
+
code = 'ERR_SESSION_OWNERSHIP_CONFLICT';
|
|
648
|
+
/** The id that was written to — the caller's own string, nothing learned. */
|
|
649
|
+
sessionId;
|
|
650
|
+
constructor(sessionId) {
|
|
651
|
+
super(`[hosting] refusing to persist session '${sessionId}': it already belongs to a ` +
|
|
652
|
+
`different signed-in person than the one this conversation is signed by. ` +
|
|
653
|
+
`Ownership is established by the FIRST turn that signs for a conversation and no ` +
|
|
654
|
+
`later write moves it, so storing this envelope would leave the ownership index ` +
|
|
655
|
+
`naming one person and the stored conversation naming another — and the person the ` +
|
|
656
|
+
`index names would open it and read the other one's conversation. ` +
|
|
657
|
+
`Neither name appears in this message on purpose. ` +
|
|
658
|
+
`What to do: write this turn under a NEW session id, or continue the existing one ` +
|
|
659
|
+
`under the identity that already owns it. Configuring 'identity' on standingAgent ` +
|
|
660
|
+
`refuses a foreign turn at the door, before it ever reaches the store.`);
|
|
661
|
+
this.name = 'SessionOwnershipConflictError';
|
|
662
|
+
this.sessionId = sessionId;
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
exports.SessionOwnershipConflictError = SessionOwnershipConflictError;
|
|
618
666
|
/**
|
|
619
667
|
* A session-history result resolved and the reply cannot describe it.
|
|
620
668
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/hosting/errors.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;GAkBG;;;AAEH,8DAAwD;AAGxD;;;;;GAKG;AACH,MAAa,eAAgB,SAAQ,KAAK;IAC/B,IAAI,GAAG,iBAA0B,CAAC;IAC3C,6BAA6B;IACpB,QAAQ,CAAS;IAE1B,YAAY,QAAgB;QAC1B,KAAK,CACH,kBAAkB,QAAQ,sDAAsD;YAC9E,wFAAwF;YACxF,iDAAiD,CACpD,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;QAC9B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;CACF;AAdD,0CAcC;AAED;;;;;;;;GAQG;AACH,MAAa,kBAAmB,SAAQ,KAAK;IAClC,IAAI,GAAG,oBAA6B,CAAC;IAC9C,gDAAgD;IACvC,SAAS,CAAS;IAC3B,mEAAmE;IAC1D,WAAW,CAAU;IAE9B,YAAY,SAAiB,EAAE,WAAoB;QACjD,KAAK,CACH,sBAAsB,SAAS,+BAA+B;YAC5D,CAAC,WAAW,CAAC,CAAC,CAAC,UAAU,WAAW,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;YAC9C,yEAAyE;YACzE,mEAAmE;YACnE,4DAA4D;YAC5D,qEAAqE,CACxE,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;QACjC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,WAAW,KAAK,SAAS;YAAE,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IAChE,CAAC;CACF;AApBD,gDAoBC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAa,oBAAqB,SAAQ,KAAK;IACpC,IAAI,GAAG,uBAAgC,C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,KAAK;IACvC,IAAI,GAAG,0BAAmC,CAAC;IAC3C,EAAE,CAAS;IAEpB,YAAY,EAAU,EAAE,QAAiB;QACvC,KAAK,CACH,cAAc,EAAE,kBAAkB;YAChC,CAAC,QAAQ,KAAK,SAAS;gBACrB,CAAC,CAAC,QAAQ,QAAQ,8CAA8C;gBAChE,CAAC,CAAC,iDAAiD,CAAC;YACtD,oFAAoF;YACpF,mFAAmF;YACnF,yCAAyC,CAC5C,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,yBAAyB,CAAC;QACtC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IACf,CAAC;CACF;AAjBD,0DAiBC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAgB,iBAAiB,CAC/B,IAAkC,EAClC,UAA0B;IAE1B,IAAI,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,UAAU,CAAC;QAAE,OAAO;IACnD,MAAM,GAAG,GAAG,IAAI,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;IACjF,MAAM,IAAI,KAAK,CACb,kBAAkB,IAAI,CAAC,IAAI,4BAA4B,UAAU,KAAK;QACpE,eAAe,GAAG,wBAAwB;QAC1C,+BAA+B,UAAU,uCAAuC;QAChF,oFAAoF,CACvF,CAAC;AACJ,CAAC;AAZD,8CAYC"}
|
package/dist/hosting/index.js
CHANGED
|
@@ -87,8 +87,8 @@
|
|
|
87
87
|
* process.on('SIGTERM', () => void handle.close());
|
|
88
88
|
*/
|
|
89
89
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
90
|
-
exports.
|
|
91
|
-
exports.ARTIFACT_GET_OP = exports.ARTIFACT_HEAD_OP = exports.artifactWireBody = exports.readArtifactWireOp = exports.WIRE_OPS = exports.refuseUnknownWireOp = exports.isWireOp = void 0;
|
|
90
|
+
exports.spendLedger = exports.spendKeyFor = exports.verifyRequestIdentity = exports.bearerToken = exports.sessionLifecycleConformance = exports.runSessionLifecycleConformance = exports.runSessionLifecycleCase = exports.formatConformanceReport = exports.resolveSessionOwner = exports.SessionsNotCarriedError = exports.SessionOwnershipConflictError = exports.SessionNotFoundError = exports.SessionIndexUnavailableError = exports.SessionOpNeedsIdentityError = exports.AdmissionRefusedError = exports.VerifierUnavailableError = exports.IdentityNotVerifiedError = exports.ArtifactNotCarriedError = exports.ArtifactNotFoundError = exports.NoArtifactStoreError = exports.ArtifactSessionRequiredError = exports.InvalidWireOpError = exports.FrameTooLargeError = exports.ConversationClosedError = exports.UnreadableEnvelopeError = exports.NoPendingAskError = exports.AwaitingDecisionError = exports.PauseNotCarriedError = exports.ConcurrentRunError = exports.HostClosedError = exports.requireCapability = exports.DEFAULT_MAX_ACTIVE_SESSIONS = exports.standingAgent = exports.checkEnvelope = exports.readPausedRun = exports.readEnvelope = exports.toPausedEnvelope = exports.envelopeTranscript = exports.envelopeOwner = exports.toEnvelope = exports.UnreadableSessionFileError = exports.SqliteUnavailableError = exports.sqliteSessions = exports.memorySessions = exports.headerValue = exports.httpHost = exports.DEFAULT_SESSION_HEADER = exports.jsonWireWith = exports.jsonWire = exports.nodeHost = void 0;
|
|
91
|
+
exports.ARTIFACT_GET_OP = exports.ARTIFACT_HEAD_OP = exports.artifactWireBody = exports.readArtifactWireOp = exports.WIRE_OPS = exports.refuseUnknownWireOp = exports.isWireOp = exports.ALL_WIRE_OPS = exports.SESSION_TRANSCRIPT_OP = exports.SESSION_LIST_OP = exports.sessionWireBody = exports.readSessionWireOp = exports.turnsPerHour = void 0;
|
|
92
92
|
var nodeHost_js_1 = require("./nodeHost.js");
|
|
93
93
|
Object.defineProperty(exports, "nodeHost", { enumerable: true, get: function () { return nodeHost_js_1.nodeHost; } });
|
|
94
94
|
Object.defineProperty(exports, "jsonWire", { enumerable: true, get: function () { return nodeHost_js_1.jsonWire; } });
|
|
@@ -142,7 +142,23 @@ Object.defineProperty(exports, "AdmissionRefusedError", { enumerable: true, get:
|
|
|
142
142
|
Object.defineProperty(exports, "SessionOpNeedsIdentityError", { enumerable: true, get: function () { return errors_js_1.SessionOpNeedsIdentityError; } });
|
|
143
143
|
Object.defineProperty(exports, "SessionIndexUnavailableError", { enumerable: true, get: function () { return errors_js_1.SessionIndexUnavailableError; } });
|
|
144
144
|
Object.defineProperty(exports, "SessionNotFoundError", { enumerable: true, get: function () { return errors_js_1.SessionNotFoundError; } });
|
|
145
|
+
Object.defineProperty(exports, "SessionOwnershipConflictError", { enumerable: true, get: function () { return errors_js_1.SessionOwnershipConflictError; } });
|
|
145
146
|
Object.defineProperty(exports, "SessionsNotCarriedError", { enumerable: true, get: function () { return errors_js_1.SessionsNotCarriedError; } });
|
|
147
|
+
// The one owner-transition rule (9.36.1) — shared by every store here, and
|
|
148
|
+
// available to any store anybody else writes. Four adapters each spelling this
|
|
149
|
+
// rule out in their own dialect is how all four came to be missing the same
|
|
150
|
+
// half of it.
|
|
151
|
+
var sessionOwnership_js_1 = require("./sessionOwnership.js");
|
|
152
|
+
Object.defineProperty(exports, "resolveSessionOwner", { enumerable: true, get: function () { return sessionOwnership_js_1.resolveSessionOwner; } });
|
|
153
|
+
// The battery a store must pass to CLAIM the port (9.36.1), exported beside
|
|
154
|
+
// the port itself so an out-of-tree store imports the check the same way it
|
|
155
|
+
// imports the interface it is implementing.
|
|
156
|
+
// See src/hosting/conformance/README.md.
|
|
157
|
+
var index_js_1 = require("./conformance/index.js");
|
|
158
|
+
Object.defineProperty(exports, "formatConformanceReport", { enumerable: true, get: function () { return index_js_1.formatConformanceReport; } });
|
|
159
|
+
Object.defineProperty(exports, "runSessionLifecycleCase", { enumerable: true, get: function () { return index_js_1.runSessionLifecycleCase; } });
|
|
160
|
+
Object.defineProperty(exports, "runSessionLifecycleConformance", { enumerable: true, get: function () { return index_js_1.runSessionLifecycleConformance; } });
|
|
161
|
+
Object.defineProperty(exports, "sessionLifecycleConformance", { enumerable: true, get: function () { return index_js_1.sessionLifecycleConformance; } });
|
|
146
162
|
// Verified identity at the door (9.26.0) — the badge is CHECKED instead of
|
|
147
163
|
// read off. `IdentityVerifier` is the port; `jwksIdentity` (from
|
|
148
164
|
// `agentfootprint/security`) is the shipped adapter; `bearerToken` is the one
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hosting/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsFG;;;;AAEH,6CAAyF;AAAhF,uGAAA,QAAQ,OAAA;AAAE,uGAAA,QAAQ,OAAA;AAAE,2GAAA,YAAY,OAAA;AAAE,qHAAA,sBAAsB,OAAA;AAEjE,6EAA6E;AAC7E,2EAA2E;AAC3E,+EAA+E;AAC/E,0EAA0E;AAC1E,+EAA+E;AAC/E,oCAAoC;AAEpC,6CAAsD;AAA7C,uGAAA,QAAQ,OAAA;AAAE,0GAAA,WAAW,OAAA;AAW9B,yDAAqD;AAA5C,mHAAA,cAAc,OAAA;AACvB,yDAI6B;AAH3B,mHAAA,cAAc,OAAA;AACd,2HAAA,sBAAsB,OAAA;AACtB,+HAAA,0BAA0B,OAAA;AAM5B,6CAQuB;AAPrB,yGAAA,UAAU,OAAA;AACV,4GAAA,aAAa,OAAA;AACb,iHAAA,kBAAkB,OAAA;AAClB,+GAAA,gBAAgB,OAAA;AAChB,2GAAA,YAAY,OAAA;AACZ,4GAAA,aAAa,OAAA;AACb,4GAAA,aAAa,OAAA;AAEf,uDAAmD;AAA1C,iHAAA,aAAa,OAAA;AAEtB,uCAAyD;AAAhD,uHAAA,2BAA2B,OAAA;AAEpC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hosting/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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"}
|
|
@@ -23,10 +23,16 @@
|
|
|
23
23
|
* a store that let you state an owner is a store where owning somebody's
|
|
24
24
|
* session is a matter of asking. A conversation that ran anonymously has no
|
|
25
25
|
* owner and appears in nobody's list.
|
|
26
|
+
*
|
|
27
|
+
* Since 9.36.1 the owner rule is not written out here at all: it is
|
|
28
|
+
* `resolveSessionOwner`, shared with every other store, because four stores
|
|
29
|
+
* each spelling the same rule in their own dialect is how all four came to be
|
|
30
|
+
* missing the same half of it.
|
|
26
31
|
*/
|
|
27
32
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
33
|
exports.memorySessions = void 0;
|
|
29
34
|
const envelope_js_1 = require("./envelope.js");
|
|
35
|
+
const sessionOwnership_js_1 = require("./sessionOwnership.js");
|
|
30
36
|
/** How many rows one `listByUser` page carries when the caller names no limit. */
|
|
31
37
|
const DEFAULT_PAGE = 50;
|
|
32
38
|
/**
|
|
@@ -63,25 +69,27 @@ function memorySessions() {
|
|
|
63
69
|
};
|
|
64
70
|
return {
|
|
65
71
|
hydrate: (sessionId) => Promise.resolve(stored.get(sessionId)),
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
72
|
+
// `async` so the ownership refusal below arrives as a REJECTION. This
|
|
73
|
+
// method returns a promise on the happy path, and one that threw
|
|
74
|
+
// synchronously on the sad one would need two error handlers from every
|
|
75
|
+
// caller — and the one they forget is the one that fires at 3am. The
|
|
76
|
+
// sibling file store states the same rule over its three methods.
|
|
77
|
+
// eslint-disable-next-line @typescript-eslint/require-await
|
|
78
|
+
persist: async (sessionId, envelope) => {
|
|
79
|
+
// DECIDE BEFORE WRITING. The order is the whole fix (9.36.1): this used
|
|
80
|
+
// to store the envelope first and then guard only the index, so a turn
|
|
81
|
+
// signed by somebody else kept the first writer's `owner` and stored the
|
|
82
|
+
// second writer's entire conversation — index and payload naming
|
|
83
|
+
// different people, and the one the index named reading the other's
|
|
84
|
+
// conversation. `resolveSessionOwner` is the one rule; see its table.
|
|
71
85
|
//
|
|
72
|
-
//
|
|
73
|
-
//
|
|
74
|
-
//
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
//
|
|
79
|
-
// The composer refuses a foreign turn long before this line is reached;
|
|
80
|
-
// this is the store keeping its own promise, for every caller that holds
|
|
81
|
-
// it directly.
|
|
82
|
-
if (owner !== undefined && !owners.has(sessionId))
|
|
86
|
+
// A conflict throws out of here having touched nothing. Single-threaded
|
|
87
|
+
// is all the atomicity a `Map` needs: no `await` sits between the read
|
|
88
|
+
// and the writes below, so nothing can interleave into them.
|
|
89
|
+
const owner = (0, sessionOwnership_js_1.resolveSessionOwner)(sessionId, owners.get(sessionId), (0, envelope_js_1.envelopeOwner)(envelope));
|
|
90
|
+
stored.set(sessionId, envelope);
|
|
91
|
+
if (owner !== undefined)
|
|
83
92
|
owners.set(sessionId, owner);
|
|
84
|
-
return Promise.resolve();
|
|
85
93
|
},
|
|
86
94
|
listByUser: (userId, options) => {
|
|
87
95
|
const rows = [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memorySessions.js","sourceRoot":"","sources":["../../src/hosting/memorySessions.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"memorySessions.js","sourceRoot":"","sources":["../../src/hosting/memorySessions.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;;;AAEH,+CAA8C;AAC9C,+DAA4D;AAQ5D,kFAAkF;AAClF,MAAM,YAAY,GAAG,EAAE,CAAC;AAExB;;;;;;GAMG;AACH,SAAgB,cAAc;IAC5B,MAAM,MAAM,GAAG,IAAI,GAAG,EAA8B,CAAC;IACrD;;;+BAG2B;IAC3B,MAAM,MAAM,GAAG,IAAI,GAAG,EAAkB,CAAC;IAEzC;;gEAE4D;IAC5D,MAAM,OAAO,GAAG,CAAC,QAA4B,EAAU,EAAE;QACvD,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAmE,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AAI,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,CAAC,CAAC;YAC9C,MAAM,IAAI,GAAG,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC;YACjC,OAAO,OAAO,CAAC,OAAO,CAAC;gBACrB,QAAQ,EAAE,IAAI;gBACd,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,MAAM,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;aACpD,CAAC,CAAC;QACL,CAAC;QACD,OAAO,EAAE,CAAC,SAAiB,EAA+B,EAAE;QAC1D,qEAAqE;QACrE,yEAAyE;QACzE,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;KAC7E,CAAC;AACJ,CAAC;AAnFD,wCAmFC"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* hosting/sessionOwnership — the ONE owner-transition rule, so four stores
|
|
4
|
+
* cannot each get it slightly wrong (9.36.1).
|
|
5
|
+
*
|
|
6
|
+
* Every store implementing {@link SessionLifecycle} keeps an owner index, and
|
|
7
|
+
* every one of them wrote the write-once rule out longhand in its own dialect:
|
|
8
|
+
* a `COALESCE` in SQL, a `has()` on a `Map`, a read-then-decide inside a
|
|
9
|
+
* transaction. Four spellings of one sentence, and all four were missing the
|
|
10
|
+
* same half of it — which is what a rule that lives in prose rather than in
|
|
11
|
+
* code eventually costs.
|
|
12
|
+
*
|
|
13
|
+
* ── The rule, whole ─────────────────────────────────────────────────────────
|
|
14
|
+
* An owner is a fact about the CONVERSATION, established by the first turn
|
|
15
|
+
* that signs for it. Given what is stored and what a turn is carrying:
|
|
16
|
+
*
|
|
17
|
+
* | stored | incoming | outcome |
|
|
18
|
+
* |------------|------------|-----------------------------------------------|
|
|
19
|
+
* | nobody | nobody | still nobody — an anonymous conversation |
|
|
20
|
+
* | nobody | somebody | FILLED IN — the first turn that signs, owns |
|
|
21
|
+
* | somebody | nobody | KEPT — a leaner turn erases nothing |
|
|
22
|
+
* | somebody | the same | KEPT — the ordinary turn |
|
|
23
|
+
* | somebody | DIFFERENT | REFUSED, by name |
|
|
24
|
+
*
|
|
25
|
+
* The last row is the one that was missing, and the difference between the
|
|
26
|
+
* last two rows is the whole design decision:
|
|
27
|
+
*
|
|
28
|
+
* - **A different identity is a CONTRADICTION.** Two people cannot both have
|
|
29
|
+
* signed for one conversation. Keeping the index and storing the payload
|
|
30
|
+
* anyway — which is what every store did — leaves the index naming one
|
|
31
|
+
* person and the conversation naming another, and the person the index
|
|
32
|
+
* names opens it and reads the other one's conversation.
|
|
33
|
+
* - **An absent identity is not a contradiction.** It claims nobody. The
|
|
34
|
+
* contract blesses it in as many words ("a later turn carrying a leaner
|
|
35
|
+
* identity must not erase it"), and refusing it would fail a flow the
|
|
36
|
+
* library's own documentation describes as intended, to protect against a
|
|
37
|
+
* claim nobody made.
|
|
38
|
+
*
|
|
39
|
+
* ── Why this is a function and not a base class ─────────────────────────────
|
|
40
|
+
* Stores share no ancestry and should not start now: one is a `Map`, one is a
|
|
41
|
+
* SQL upsert, one is a distributed transaction, one is somebody's managed
|
|
42
|
+
* service where the owner field is immutable. What they share is a DECISION,
|
|
43
|
+
* so what they share is a decision function — called at the point each of them
|
|
44
|
+
* already had to decide, inside whatever atomicity that store can offer.
|
|
45
|
+
*
|
|
46
|
+
* The atomicity is deliberately NOT this module's business, and cannot be: a
|
|
47
|
+
* read-then-decide is only as safe as the transaction it happens inside, and
|
|
48
|
+
* only the store knows what it has. What this owns is the answer; where it is
|
|
49
|
+
* safe to ask is the store's own promise, and the conformance suite is what
|
|
50
|
+
* checks that the store kept it (`contested-write-leaves-no-split-brain`).
|
|
51
|
+
*/
|
|
52
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
|
+
exports.resolveSessionOwner = void 0;
|
|
54
|
+
const errors_js_1 = require("./errors.js");
|
|
55
|
+
/**
|
|
56
|
+
* Which owner a store should record, given what it already has and what the
|
|
57
|
+
* turn being written is signed by — or a refusal.
|
|
58
|
+
*
|
|
59
|
+
* Call it INSIDE whatever the store uses to make read-then-write atomic (a
|
|
60
|
+
* transaction, a lock, a single-threaded map), with the owner already derived
|
|
61
|
+
* from the stored conversation by `envelopeOwner`. The return value is the
|
|
62
|
+
* owner to store; a refusal means the whole `persist` must not land, including
|
|
63
|
+
* the envelope.
|
|
64
|
+
*
|
|
65
|
+
* **The envelope is the part that matters.** A store that catches this and
|
|
66
|
+
* writes the payload anyway has re-created the exact defect: the refusal
|
|
67
|
+
* exists to stop the CONVERSATION being replaced, not merely to protect an
|
|
68
|
+
* index column.
|
|
69
|
+
*
|
|
70
|
+
* Empty strings are read as "nobody" on both sides, matching `envelopeOwner`,
|
|
71
|
+
* so a store that keeps `''` for an unowned row cannot accidentally make it a
|
|
72
|
+
* principal that conflicts with everybody.
|
|
73
|
+
*
|
|
74
|
+
* @param sessionId the id being written — the caller's own string, and the
|
|
75
|
+
* only thing the refusal repeats back.
|
|
76
|
+
* @param storedOwner the owner already recorded for this session, or
|
|
77
|
+
* `undefined` for a session that is new or that nobody has signed for.
|
|
78
|
+
* @param incomingOwner the owner derived from the envelope being written —
|
|
79
|
+
* `envelopeOwner(envelope)`, never anything a caller supplied.
|
|
80
|
+
* @returns the owner to record. `undefined` means "record nobody".
|
|
81
|
+
* @throws SessionOwnershipConflictError when the two name DIFFERENT people.
|
|
82
|
+
*
|
|
83
|
+
* @example Inside a store's persist
|
|
84
|
+
* const incoming = envelopeOwner(checked);
|
|
85
|
+
* const owner = resolveSessionOwner(sessionId, rows.get(sessionId), incoming);
|
|
86
|
+
* // Only now — a refusal above must leave the stored conversation alone.
|
|
87
|
+
* rows.set(sessionId, checked);
|
|
88
|
+
* if (owner !== undefined) owners.set(sessionId, owner);
|
|
89
|
+
*/
|
|
90
|
+
function resolveSessionOwner(sessionId, storedOwner, incomingOwner) {
|
|
91
|
+
const stored = nonEmpty(storedOwner);
|
|
92
|
+
const incoming = nonEmpty(incomingOwner);
|
|
93
|
+
// Nothing is claimed yet: the first turn that signs owns the conversation,
|
|
94
|
+
// and a turn that signs for nothing leaves it unowned.
|
|
95
|
+
if (stored === undefined)
|
|
96
|
+
return incoming;
|
|
97
|
+
// The blessed leaner turn. It claims nobody, so it contradicts nobody, and
|
|
98
|
+
// the established owner stands.
|
|
99
|
+
if (incoming === undefined)
|
|
100
|
+
return stored;
|
|
101
|
+
if (incoming === stored)
|
|
102
|
+
return stored;
|
|
103
|
+
throw new errors_js_1.SessionOwnershipConflictError(sessionId);
|
|
104
|
+
}
|
|
105
|
+
exports.resolveSessionOwner = resolveSessionOwner;
|
|
106
|
+
/** `''` is nobody, exactly as `envelopeOwner` reads it. */
|
|
107
|
+
function nonEmpty(value) {
|
|
108
|
+
return typeof value === 'string' && value.length > 0 ? value : undefined;
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=sessionOwnership.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sessionOwnership.js","sourceRoot":"","sources":["../../src/hosting/sessionOwnership.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;;;AAEH,2CAA4D;AAE5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,SAAgB,mBAAmB,CACjC,SAAiB,EACjB,WAA+B,EAC/B,aAAiC;IAEjC,MAAM,MAAM,GAAG,QAAQ,CAAC,WAAW,CAAC,CAAC;IACrC,MAAM,QAAQ,GAAG,QAAQ,CAAC,aAAa,CAAC,CAAC;IACzC,2EAA2E;IAC3E,uDAAuD;IACvD,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,QAAQ,CAAC;IAC1C,2EAA2E;IAC3E,gCAAgC;IAChC,IAAI,QAAQ,KAAK,SAAS;QAAE,OAAO,MAAM,CAAC;IAC1C,IAAI,QAAQ,KAAK,MAAM;QAAE,OAAO,MAAM,CAAC;IACvC,MAAM,IAAI,yCAA6B,CAAC,SAAS,CAAC,CAAC;AACrD,CAAC;AAfD,kDAeC;AAED,2DAA2D;AAC3D,SAAS,QAAQ,CAAC,KAAyB;IACzC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AAC3E,CAAC"}
|