@vincemakes/kiso-runtime 0.26.2 → 0.27.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/agent.d.ts CHANGED
@@ -46,15 +46,6 @@ export interface AgentDefinition {
46
46
  readonly maxTurns?: number;
47
47
  readonly maxTokens?: number;
48
48
  readonly temperature?: number;
49
- /**
50
- * DEPRECATED (ADR-0044): the classic auto-compaction path is retired —
51
- * the loop ignores this (microcompact absorbed the responsibility; old
52
- * sessions' `compacted` events still replay). Kept so old definitions
53
- * type-check; removed at 1.0.
54
- */
55
- readonly compaction?: {
56
- readonly thresholdTokens: number;
57
- };
58
49
  /** C area: microcompact threshold — passed through to every session. */
59
50
  readonly microcompact?: {
60
51
  readonly thresholdTokens: number;
package/dist/agent.js CHANGED
@@ -139,7 +139,6 @@ export class AgentRuntime {
139
139
  ...(this.#definition.maxTurns !== undefined ? { maxTurns: this.#definition.maxTurns } : {}),
140
140
  ...(this.#definition.maxTokens !== undefined ? { maxTokens: this.#definition.maxTokens } : {}),
141
141
  ...(this.#definition.temperature !== undefined ? { temperature: this.#definition.temperature } : {}),
142
- ...(this.#definition.compaction !== undefined ? { compaction: this.#definition.compaction } : {}),
143
142
  ...(this.#definition.microcompact !== undefined ? { microcompact: this.#definition.microcompact } : {}),
144
143
  ...(this.#definition.contextPolicy !== undefined ? { contextPolicy: this.#definition.contextPolicy } : {}),
145
144
  ...(this.#definition.maxRetries !== undefined ? { maxRetries: this.#definition.maxRetries } : {}),
package/dist/compose.js CHANGED
@@ -73,7 +73,7 @@ export function composeHooks(existing, extensions) {
73
73
  await h(payload, ctx);
74
74
  };
75
75
  };
76
- for (const key of ["onPreLlm", "onEvent", "onPreCompact", "onPostCompact", "onPause", "onStop"]) {
76
+ for (const key of ["onPreLlm", "onEvent", "onPause", "onStop"]) {
77
77
  const handler = observers((h) => h[key]);
78
78
  if (handler !== undefined)
79
79
  out[key] = handler;
package/dist/run.js CHANGED
@@ -32,7 +32,6 @@ export class Run {
32
32
  #abort = new AbortController();
33
33
  #externalSignal;
34
34
  #decisionIds = [];
35
- #uncertaintyIds = [];
36
35
  #started = false;
37
36
  constructor(store, adapter, config, session, input, externalSignal, resume,
38
37
  // TV-1B: durable PROVENANCE for the input (e.g. the verification
@@ -129,7 +128,6 @@ export class Run {
129
128
  ...(this.#config.maxTurns !== undefined ? { maxTurns: this.#config.maxTurns } : {}),
130
129
  ...(this.#config.maxTokens !== undefined ? { maxTokens: this.#config.maxTokens } : {}),
131
130
  ...(this.#config.temperature !== undefined ? { temperature: this.#config.temperature } : {}),
132
- ...(this.#config.compaction !== undefined ? { compaction: this.#config.compaction } : {}),
133
131
  ...(microcompact !== undefined ? { microcompact } : {}),
134
132
  ...(this.#config.maxRetries !== undefined ? { maxRetries: this.#config.maxRetries } : {}),
135
133
  // MG-1 (A5): the kernel stamps committed envelopes with this.
@@ -151,11 +149,6 @@ export class Run {
151
149
  // the human gave in the same instant as the abort is
152
150
  // recorded, exactly once.
153
151
  approvalVerdict: (decisionId) => this.#session.approvalVerdict(decisionId),
154
- uncertaintyVerdict: (executionId) => this.#session.uncertaintyVerdict(executionId),
155
- resolveUncertainty: (executionId) => new Promise((resolve) => {
156
- this.#uncertaintyIds.push(executionId);
157
- this.#session.registerUncertaintyResolver(executionId, resolve);
158
- }),
159
152
  });
160
153
  const self = this;
161
154
  const runLoop = async function* () {
@@ -287,9 +280,6 @@ export class Run {
287
280
  for (const decisionId of this.#decisionIds) {
288
281
  this.#session.dropResolver(decisionId);
289
282
  }
290
- for (const executionId of this.#uncertaintyIds) {
291
- this.#session.dropUncertaintyResolver(executionId);
292
- }
293
283
  // E1: the run's ledger story — the run_end lands synchronously
294
284
  // (a killed run leaves no run_end, and the next init marks it).
295
285
  tracer?.finishRun();
package/dist/session.d.ts CHANGED
@@ -287,13 +287,9 @@ export declare class AgentSession {
287
287
  resolveUncertain(executionId: string, resolution: "rerun" | "abandoned"): Promise<void>;
288
288
  /** The runId that owns an execution — from its durable started record. */
289
289
  private runIdFor;
290
- registerUncertaintyResolver(executionId: string, resolve: (resolution: "rerun" | "abandoned") => void): void;
291
- dropUncertaintyResolver(executionId: string): void;
292
290
  registerResolver(decisionId: string, resolve: (decision: PermissionDecision) => void): void;
293
291
  /** round 4 (adversarial): a verdict the human already gave for a live decision. */
294
292
  approvalVerdict(decisionId: string): boolean | undefined;
295
- /** round 4 (adversarial): a verdict the human already gave for a live execution. */
296
- uncertaintyVerdict(executionId: string): "rerun" | "abandoned" | undefined;
297
293
  /**
298
294
  * round 5(P1-5): flush every verdict submitted to a live resolver that is
299
295
  * not yet durable. Called from the Run iterator's FINALLY — whether the
@@ -386,13 +382,6 @@ export interface SessionConfig {
386
382
  readonly maxTurns?: number;
387
383
  readonly maxTokens?: number;
388
384
  readonly temperature?: number;
389
- /**
390
- * DEPRECATED (ADR-0044): forwarded to the loop's deprecated field,
391
- * which IGNORES it — kept for type compatibility, removed at 1.0.
392
- */
393
- readonly compaction?: {
394
- readonly thresholdTokens: number;
395
- };
396
385
  /** C area: microcompact threshold — passed through to the loop verbatim. */
397
386
  readonly microcompact?: {
398
387
  readonly thresholdTokens: number;
package/dist/session.js CHANGED
@@ -93,26 +93,21 @@ export class AgentSession {
93
93
  // selection or first request — never eagerly at open.
94
94
  #profilePending;
95
95
  #pendingResolvers = new Map();
96
- #uncertaintyResolvers = new Map();
97
96
  #answered = new Set();
98
- /** round 7: verdicts already passed to a live resolver — the resolution event
99
- * lands in the log asynchronously (the loop owns it), so the ledger
100
- * alone cannot make resolveUncertain idempotent across the same tick. */
101
- #uncertaintyAnswered = new Set();
102
97
  /** round 4 (adversarial): verdicts the human GAVE, recorded when passed to a live
103
98
  * resolver. If an abort races the verdict, the loop / recovery queries
104
99
  * these and records the decision (exactly once) instead of losing it. */
105
100
  #approvalVerdicts = new Map();
106
- #uncertaintyVerdicts = new Map();
107
101
  /** round 5(P1-5): verdicts submitted to a LIVE resolver but not yet known
108
- * durable. An async generator only advances on next(), so approve()/
109
- * resolveUncertain() CANNOT wait for the loop to persist — that would
110
- * deadlock (the consumer waits while the generator needs a next()).
111
- * Instead the verdict is recorded here, and the Run's iterator FINALLY
112
- * flushes every not-yet-durable verdict to disk — an abandoned generator
113
- * can never lose a verdict the human gave. */
102
+ * durable. An async generator only advances on next(), so approve()
103
+ * CANNOT wait for the loop to persist — that would deadlock (the
104
+ * consumer waits while the generator needs a next()). Instead the
105
+ * verdict is recorded here, and the Run's iterator FINALLY flushes
106
+ * every not-yet-durable verdict to disk — an abandoned generator can
107
+ * never lose a verdict the human gave. (CT-1: uncertainty verdicts no
108
+ * longer have a live resolver — the loop never took one since
109
+ * ADR-0038 — so they always take the direct-persist path below.) */
114
110
  #pendingDurableApprovals = new Map();
115
- #pendingDurableUncertainties = new Map();
116
111
  #poisoned = null;
117
112
  /** E6 (h): the circuit-breaker counter — consecutive auto-policy
118
113
  * summary failures this session (a success resets it). */
@@ -668,30 +663,10 @@ export class AgentSession {
668
663
  if (!record)
669
664
  throw new Error(`no execution record for ${executionId}`);
670
665
  if (record.status !== "uncertain")
671
- return; // idempotent + irreversible
672
- // round 7: a verdict already passed to a live resolver is FINAL — the
673
- // loop's resolution event lands asynchronously, so the ledger alone
674
- // cannot make this idempotent across the same tick.
675
- if (this.#uncertaintyAnswered.has(executionId))
676
- return;
677
- this.#uncertaintyAnswered.add(executionId);
678
- // round 7: with a LIVE resolver, the active loop / recovery generator
679
- // OWNS the resolution event — it appends, yields, and persists it
680
- // through the Run, so the consumer's stream and the durable log
681
- // stay identical. We only pass the verdict; a hidden append here
682
- // would leave a seq gap. round 4 (adversarial): the verdict is recorded so an
683
- // abort racing it cannot lose it.
684
- const resolver = this.#uncertaintyResolvers.get(executionId);
685
- if (resolver !== undefined) {
686
- this.#uncertaintyVerdicts.set(executionId, resolution);
687
- // round 5(P1-5): submitted — flushed to disk by the Run's finally
688
- // if the generator never persists it.
689
- this.#pendingDurableUncertainties.set(executionId, { resolution, callId: record.callId });
690
- this.#uncertaintyResolvers.delete(executionId);
691
- resolver(resolution);
692
- return;
693
- }
694
- // round 7: OFFLINE verdict — no live resolver: persist directly.
666
+ return; // idempotent + irreversible (the append below is synchronous, so a same-tick second call sees it)
667
+ // CT-1 (ADR-0051 Amendment 6): the verdict is persisted directly — there
668
+ // is no live resolver to hand it to (the loop never read one since
669
+ // ADR-0038; the round-7 live branch that waited for it was unreachable).
695
670
  // round 4: the verdict is attributed to the ORIGINAL run of the execution
696
671
  // — never the fake runId "resolution".
697
672
  const runId = this.runIdFor(executionId);
@@ -738,12 +713,6 @@ export class AgentSession {
738
713
  throw new Error(`no durable execution record for ${executionId}`);
739
714
  return rec.runId;
740
715
  }
741
- registerUncertaintyResolver(executionId, resolve) {
742
- this.#uncertaintyResolvers.set(executionId, resolve);
743
- }
744
- dropUncertaintyResolver(executionId) {
745
- this.#uncertaintyResolvers.delete(executionId);
746
- }
747
716
  // ── internal: the resolver registry ──────────────────────────────────
748
717
  registerResolver(decisionId, resolve) {
749
718
  this.#pendingResolvers.set(decisionId, resolve);
@@ -752,10 +721,6 @@ export class AgentSession {
752
721
  approvalVerdict(decisionId) {
753
722
  return this.#approvalVerdicts.get(decisionId);
754
723
  }
755
- /** round 4 (adversarial): a verdict the human already gave for a live execution. */
756
- uncertaintyVerdict(executionId) {
757
- return this.#uncertaintyVerdicts.get(executionId);
758
- }
759
724
  /**
760
725
  * round 5(P1-5): flush every verdict submitted to a live resolver that is
761
726
  * not yet durable. Called from the Run iterator's FINALLY — whether the
@@ -777,19 +742,6 @@ export class AgentSession {
777
742
  }
778
743
  this.#pendingDurableApprovals.delete(decisionId);
779
744
  }
780
- for (const [executionId, pending] of this.#pendingDurableUncertainties) {
781
- const resolved = log.all.find((e) => e.type === "tool_execution_resolved" && e.executionId === executionId);
782
- if (resolved === undefined) {
783
- const app = log.append({
784
- type: "tool_execution_resolved",
785
- executionId,
786
- callId: pending.callId,
787
- resolution: pending.resolution,
788
- });
789
- await this.persist(runId, app);
790
- }
791
- this.#pendingDurableUncertainties.delete(executionId);
792
- }
793
745
  }
794
746
  dropResolver(decisionId) {
795
747
  this.#pendingResolvers.delete(decisionId);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vincemakes/kiso-runtime",
3
- "version": "0.26.2",
3
+ "version": "0.27.0",
4
4
  "description": "kiso runtime — durable multi-turn agent sessions: AgentDefinition, AgentRuntime, AgentSession, Run, append-only JSONL store.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -25,11 +25,11 @@
25
25
  "test": "vitest run"
26
26
  },
27
27
  "dependencies": {
28
- "@vincemakes/kiso-core": "0.26.2"
28
+ "@vincemakes/kiso-core": "0.27.0"
29
29
  },
30
30
  "peerDependencies": {
31
- "@vincemakes/kiso-provider-anthropic": "0.26.2",
32
- "@vincemakes/kiso-provider-openai": "0.26.2"
31
+ "@vincemakes/kiso-provider-anthropic": "0.27.0",
32
+ "@vincemakes/kiso-provider-openai": "0.27.0"
33
33
  },
34
34
  "peerDependenciesMeta": {
35
35
  "@vincemakes/kiso-provider-anthropic": {
@@ -40,7 +40,7 @@
40
40
  }
41
41
  },
42
42
  "devDependencies": {
43
- "@vincemakes/kiso-evals": "0.26.2",
43
+ "@vincemakes/kiso-evals": "0.27.0",
44
44
  "@types/node": "^26.1.2",
45
45
  "typescript": "^5.7.2",
46
46
  "vitest": "^3.0.0"