@vincemakes/kiso-runtime 0.45.1 → 0.45.3

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/run.js CHANGED
@@ -575,7 +575,7 @@ export class Run {
575
575
  let verdict;
576
576
  try {
577
577
  if (approvalChain !== undefined) {
578
- const chainVerdict = await abortable(Promise.resolve(approvalChain.decide(policyCall, { signal, sessionId: this.#session.id })), signal);
578
+ const chainVerdict = await abortable(Promise.resolve(approvalChain.decide(policyCall, { signal, sessionId: this.#session.id, callId: call.callId })), signal);
579
579
  if (chainVerdict === ABORTED)
580
580
  return;
581
581
  verdict = chainVerdict;
package/dist/store.d.ts CHANGED
@@ -94,7 +94,10 @@ export declare class SessionStore {
94
94
  * close can never release another writer's lock (ADR-0050).
95
95
  */
96
96
  private releaseLock;
97
- /** Write-ahead: durable (written + fsynced) before returning. */
97
+ /** Write-ahead: every correctness-bearing event is durable (written +
98
+ * fsynced) before returning; a streamed fragment is written, and the
99
+ * next synced event makes it durable (ADR-0025 Decision 5 as amended,
100
+ * ADR-0052). */
98
101
  append(sessionId: string, runId: string, event: Event): Promise<void>;
99
102
  /**
100
103
  * Open (creating if needed) the session file. The torn tail is repaired
package/dist/store.js CHANGED
@@ -248,7 +248,10 @@ export class SessionStore {
248
248
  handle.release();
249
249
  }
250
250
  // ── append: lock, open, repair, CAS, write, fsync ────────────────────
251
- /** Write-ahead: durable (written + fsynced) before returning. */
251
+ /** Write-ahead: every correctness-bearing event is durable (written +
252
+ * fsynced) before returning; a streamed fragment is written, and the
253
+ * next synced event makes it durable (ADR-0025 Decision 5 as amended,
254
+ * ADR-0052). */
252
255
  async append(sessionId, runId, event) {
253
256
  if (this.#closed.has(sessionId)) {
254
257
  throw new Error(`session store is closed for ${sessionId}`);
@@ -310,7 +313,14 @@ export class SessionStore {
310
313
  throw new StaleWriterError(expected, event.seq);
311
314
  }
312
315
  appendFileSync(fd, `${JSON.stringify({ runId, ts: Date.now(), event })}\n`);
313
- fsyncSync(fd);
316
+ // A streamed fragment is not a durability boundary: it belongs to a
317
+ // turn that is uncommitted until its stop is durable, and the next
318
+ // synced event (the call's end, the text's end, the stop) flushes
319
+ // it. Syncing each one cost minutes for a long streamed argument.
320
+ // A process kill loses nothing either way: the write is already in
321
+ // the OS page cache.
322
+ if (!STREAMED_FRAGMENTS.has(event.type))
323
+ fsyncSync(fd);
314
324
  // round 5(P1-3): a close() that landed during the write must not
315
325
  // leave our helper behind.
316
326
  if (this.#closed.has(sessionId)) {
@@ -525,6 +535,8 @@ function lastCommittedSeq(fd) {
525
535
  chunk *= 2;
526
536
  }
527
537
  }
538
+ /** The streamed fragments the store writes without their own sync. */
539
+ const STREAMED_FRAGMENTS = new Set(["text_delta", "thinking", "tool_call_input_delta"]);
528
540
  /** Durability of directory entries: fsync the directory itself. */
529
541
  function fsyncDir(dir) {
530
542
  let fd;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vincemakes/kiso-runtime",
3
- "version": "0.45.1",
3
+ "version": "0.45.3",
4
4
  "description": "kiso runtime \u2014 durable multi-turn agent sessions: AgentDefinition, AgentRuntime, AgentSession, Run, append-only JSONL store.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -25,12 +25,12 @@
25
25
  "test": "vitest run"
26
26
  },
27
27
  "dependencies": {
28
- "@vincemakes/kiso-core": "0.45.1"
28
+ "@vincemakes/kiso-core": "0.45.3"
29
29
  },
30
30
  "peerDependencies": {
31
- "@vincemakes/kiso-provider-anthropic": "0.45.1",
32
- "@vincemakes/kiso-provider-openai": "0.45.1",
33
- "@vincemakes/kiso-provider-openai-responses": "0.45.1"
31
+ "@vincemakes/kiso-provider-anthropic": "0.45.3",
32
+ "@vincemakes/kiso-provider-openai": "0.45.3",
33
+ "@vincemakes/kiso-provider-openai-responses": "0.45.3"
34
34
  },
35
35
  "peerDependenciesMeta": {
36
36
  "@vincemakes/kiso-provider-anthropic": {
@@ -44,7 +44,7 @@
44
44
  }
45
45
  },
46
46
  "devDependencies": {
47
- "@vincemakes/kiso-evals": "0.45.1",
47
+ "@vincemakes/kiso-evals": "0.45.3",
48
48
  "@types/node": "^26.1.2",
49
49
  "typescript": "^5.7.2",
50
50
  "vitest": "^3.0.0"