@neta-art/cohub 1.2.1 → 1.2.2

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.
@@ -231,6 +231,11 @@ export class SessionPatchReducer {
231
231
  const isDifferentKnownTurn = Boolean(currentTurnId && inputTurnId && currentTurnId !== inputTurnId);
232
232
  const isFreshKnownTurn = isDifferentKnownTurn && input.baseSeq === 0;
233
233
  const currentSeq = isFreshKnownTurn ? 0 : current.patchSeq;
234
+ const isSameTurnKeyframe = Boolean(currentTurnId &&
235
+ inputTurnId &&
236
+ currentTurnId === inputTurnId &&
237
+ input.baseSeq === 0 &&
238
+ input.seq > currentSeq);
234
239
  const isTerminalSameTurn = (current.status === "completed" || current.status === "failed") &&
235
240
  Boolean(currentTurnId) &&
236
241
  currentTurnId === inputTurnId;
@@ -243,10 +248,10 @@ export class SessionPatchReducer {
243
248
  if (input.seq <= currentSeq) {
244
249
  return { applied: false, reason: "duplicate", state: current };
245
250
  }
246
- if (input.baseSeq !== currentSeq) {
251
+ if (!isSameTurnKeyframe && input.baseSeq !== currentSeq) {
247
252
  return { applied: false, reason: "version_mismatch", state: current };
248
253
  }
249
- const startingFresh = input.baseSeq === 0 || isFreshKnownTurn;
254
+ const startingFresh = input.baseSeq === 0 || isFreshKnownTurn || isSameTurnKeyframe;
250
255
  const baseBlocks = startingFresh ? [] : current.contentBlocks;
251
256
  const patched = applyPatchOpsToBlocks(baseBlocks, input.ops, startingFresh ? null : current.appendPath);
252
257
  if (patched.failed) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neta-art/cohub",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "description": "Cohub SDK for spaces, sessions, checkpoints, and realtime agent collaboration.",
5
5
  "license": "UNLICENSED",
6
6
  "private": false,
@@ -44,7 +44,7 @@
44
44
  "README.md"
45
45
  ],
46
46
  "dependencies": {
47
- "@neta-art/cohub-protocol": "1.2.1"
47
+ "@neta-art/cohub-protocol": "1.2.2"
48
48
  },
49
49
  "devDependencies": {
50
50
  "typescript": "^6.0.3"