@vincemakes/kiso-runtime 0.46.0 → 0.46.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.
package/dist/agent.d.ts CHANGED
@@ -34,6 +34,12 @@ export interface AgentDefinition {
34
34
  /** 0.40.0: the config profile that named this binding, recorded per
35
35
  * revision for display. Never part of drift. */
36
36
  readonly profileName?: string;
37
+ /** B1: a NEW session's initial reasoning (the CLI passes the effort last
38
+ * picked for the profile). Recorded in the session's first profile
39
+ * revision; never read for a session that has a recorded profile — its
40
+ * own wins, and a changed binding resets to defaults as before.
41
+ * `setModelBinding` stays the one way to change a live binding. */
42
+ readonly reasoning?: import("./provider/metadata.js").ReasoningSetting;
37
43
  /** `Tool<any>` like the registry: typed tools register without casts. */
38
44
  readonly tools: readonly Tool<any>[];
39
45
  readonly store: SessionStore;
package/dist/agent.js CHANGED
@@ -155,7 +155,11 @@ export class AgentRuntime {
155
155
  ...((restored !== null ? restored.scope : startupScope) !== undefined
156
156
  ? { continuationScope: (restored !== null ? restored.scope : startupScope) }
157
157
  : {}),
158
- ...(restored !== null ? { reasoning: restored.reasoning } : {}),
158
+ ...(restored !== null
159
+ ? { reasoning: restored.reasoning }
160
+ : newSession !== null && this.#definition.reasoning !== undefined
161
+ ? { reasoning: this.#definition.reasoning }
162
+ : {}),
159
163
  ...(profilePending ? { profilePending: true } : {}),
160
164
  ...(newSession !== null ? { newSession } : {}),
161
165
  ...(this.#definition.profileName !== undefined ? { profileName: this.#definition.profileName } : {}),
package/dist/session.d.ts CHANGED
@@ -130,7 +130,7 @@ export declare class AgentSession {
130
130
  /** Deliver this session's task transitions to the model: into a live
131
131
  * run at its next safe point, or — idle — held for the next run, or one
132
132
  * continuation run through `onWake` (off with `wake: false`). */
133
- useTasks(manager: TaskManager, options?: Pick<TaskDeliveryOptions, "wake" | "onWake" | "windowMs"> & {
133
+ useTasks(manager: TaskManager, options?: Pick<TaskDeliveryOptions, "wake" | "onWake" | "windowMs" | "onLost"> & {
134
134
  readonly autoDetachMinAgeMs?: number;
135
135
  }): () => void;
136
136
  /** ADR-0057 §5 (3e D1) — a person's steer arrived: the foreground
@@ -56,6 +56,10 @@ export interface TaskDeliveryOptions {
56
56
  }) => void;
57
57
  /** Transitions within this window merge into one notice. Default 1 s. */
58
58
  readonly windowMs?: number;
59
+ /** ADR-0058 Amendment 8: a loss the model has not been told of, at
60
+ * startup or as it is heard — the person can be told at once, while
61
+ * the model's notice keeps its own turn. A claimed loss never comes. */
62
+ readonly onLost?: (taskIds: readonly string[]) => void;
59
63
  /** How much of a failed task's output rides its notice. Default 2 KB. */
60
64
  readonly tailBytes?: number;
61
65
  /** Read a task's output tail (injectable for tests). */
@@ -69,6 +69,7 @@ export class TaskDelivery {
69
69
  // delivered, is delivered now as a notify — never a wake at startup
70
70
  this.#scan();
71
71
  const missed = [];
72
+ const lost = [];
72
73
  for (const task of this.#safeList()) {
73
74
  const item = itemOf(task);
74
75
  if (item === null || item.transition === "ready" || this.#receipts.has(key(item)))
@@ -76,6 +77,8 @@ export class TaskDelivery {
76
77
  // a tool result reported it: the claim alone decides (Amendment 7)
77
78
  if (task.claims?.some((c) => c.transition === item.transition) === true)
78
79
  continue;
80
+ if (item.transition === "unknown")
81
+ lost.push(task.id);
79
82
  if (task.agent !== undefined)
80
83
  this.#ended.set(task.id, { restart: true });
81
84
  else
@@ -85,6 +88,8 @@ export class TaskDelivery {
85
88
  this.#pending.push({ notice: { lines: missed.map((m) => m.line), items: missed.map((m) => m.item) }, wake: false });
86
89
  if (this.#ended.size > 0)
87
90
  this.#groups();
91
+ if (lost.length > 0)
92
+ options.onLost?.(lost);
88
93
  }
89
94
  close() {
90
95
  this.#unsubscribe();
@@ -154,6 +159,8 @@ export class TaskDelivery {
154
159
  const item = itemOf(task, transition);
155
160
  if (item === null)
156
161
  return;
162
+ if (item.transition === "unknown")
163
+ this.#o.onLost?.([task.id]);
157
164
  if (task.agent !== undefined && item.transition !== "ready")
158
165
  return this.#agentEnded(task, item);
159
166
  const mode = this.#modeOf(task, item);
@@ -76,6 +76,15 @@ export class TaskManager {
76
76
  if (cached !== undefined && cached.key === key && (cached.verdict === "gone" || (!fresh && Date.now() - cached.at < this.#identifyEveryMs)))
77
77
  return cached.verdict;
78
78
  const verdict = this.#backend.identify(runner.pid, runner.startedAt);
79
+ // Amendment 8: a probe that could not READ the identity just now (a
80
+ // loaded machine) is not a lost runner. For the state, a runner last
81
+ // verified, with a recorded start time, keeps that verdict until the
82
+ // next window; a stop checks fresh and still gets the raw answer, so
83
+ // a runner not verified NOW is never signalled.
84
+ if (verdict === "unverifiable" && runner.startedAt !== "" && cached?.key === key && cached.verdict === "verified") {
85
+ this.#identity.set(id, { key, verdict: "verified", at: Date.now() });
86
+ return fresh ? verdict : "verified";
87
+ }
79
88
  this.#identity.set(id, { key, verdict, at: Date.now() });
80
89
  return verdict;
81
90
  }
@@ -373,7 +382,9 @@ export class TaskManager {
373
382
  if (this.#waiting.has(id))
374
383
  continue;
375
384
  const before = this.#seen.get(id);
376
- if (before === "ended" || before === "unknown" || before === "not_run")
385
+ // a lost (`unknown`) task is still read: if its end is recorded
386
+ // later, that end is announced (Amendment 8)
387
+ if (before === "ended" || before === "not_run")
377
388
  continue;
378
389
  let info;
379
390
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vincemakes/kiso-runtime",
3
- "version": "0.46.0",
3
+ "version": "0.46.2",
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.46.0"
28
+ "@vincemakes/kiso-core": "0.46.2"
29
29
  },
30
30
  "peerDependencies": {
31
- "@vincemakes/kiso-provider-anthropic": "0.46.0",
32
- "@vincemakes/kiso-provider-openai": "0.46.0",
33
- "@vincemakes/kiso-provider-openai-responses": "0.46.0"
31
+ "@vincemakes/kiso-provider-anthropic": "0.46.2",
32
+ "@vincemakes/kiso-provider-openai": "0.46.2",
33
+ "@vincemakes/kiso-provider-openai-responses": "0.46.2"
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.46.0",
47
+ "@vincemakes/kiso-evals": "0.46.2",
48
48
  "@types/node": "^26.1.2",
49
49
  "typescript": "^5.7.2",
50
50
  "vitest": "^3.0.0"