@volter/supercode-teams 0.2.155 → 0.2.156
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/package.json +1 -1
- package/server/harness-routes.mjs +11 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@volter/supercode-teams",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.156",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A machine daemon serving this machine's doors, and a local or remote Teams server for shared session discovery, OpenTelemetry ingestion and access to enrolled machines.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -359,14 +359,17 @@ async function captureCommit(api,req,res,auth,sourceId,captureId,requestId){cons
|
|
|
359
359
|
carriedRevision = session.revision;
|
|
360
360
|
const hash = createHash('sha256').update('['), sent = new Set(messages.map(m => m.native_key));
|
|
361
361
|
while (carriedCount < count) {
|
|
362
|
-
const
|
|
363
|
-
WHERE m.team_id=? AND m.session_id=? AND ${MESSAGE_AT()}
|
|
364
|
-
[auth.team_id, origin.session_id,
|
|
365
|
-
if (!
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
362
|
+
const page = await api.store.query(`SELECT ordinal,source_id,native_key,recorded_at,value_json FROM messages m
|
|
363
|
+
WHERE m.team_id=? AND m.session_id=? AND m.ordinal>=? AND m.ordinal<? AND ${MESSAGE_AT()} ORDER BY m.ordinal LIMIT 16`,
|
|
364
|
+
[auth.team_id, origin.session_id, carriedCount, count, carriedRevision, carriedRevision]);
|
|
365
|
+
if (!page.length) fail(409, 'carry_mismatch', 'the carried messages are not what this session holds; send the capture whole');
|
|
366
|
+
for (const row of page) {
|
|
367
|
+
if (row.ordinal !== carriedCount || row.source_id !== sourceId) fail(409, 'carry_mismatch', 'the carried messages are not what this session holds; send the capture whole');
|
|
368
|
+
if (sent.has(row.native_key)) fail(409, 'capture_conflict', 'duplicate native message key');
|
|
369
|
+
if (carriedCount) hash.update(',');
|
|
370
|
+
hash.update(canonicalJson({native_key:row.native_key, recorded_at:row.recorded_at ?? null, value:JSON.parse(row.value_json)}));
|
|
371
|
+
carriedCount++;
|
|
372
|
+
}
|
|
370
373
|
}
|
|
371
374
|
if (hash.update(']').digest('hex') !== digest) fail(409, 'carry_mismatch', 'the carried messages are not what this session holds; send the capture whole');
|
|
372
375
|
}
|