@lloyal-labs/lloyal-agents 1.7.0 → 2.1.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.
Files changed (52) hide show
  1. package/README.md +83 -99
  2. package/dist/Agent.d.ts +29 -3
  3. package/dist/Agent.d.ts.map +1 -1
  4. package/dist/Agent.js +24 -2
  5. package/dist/Agent.js.map +1 -1
  6. package/dist/AgentPolicy.d.ts +34 -17
  7. package/dist/AgentPolicy.d.ts.map +1 -1
  8. package/dist/AgentPolicy.js +87 -25
  9. package/dist/AgentPolicy.js.map +1 -1
  10. package/dist/Tool.d.ts +1 -1
  11. package/dist/Tool.js +1 -1
  12. package/dist/agent-pool.d.ts +18 -6
  13. package/dist/agent-pool.d.ts.map +1 -1
  14. package/dist/agent-pool.js +435 -168
  15. package/dist/agent-pool.js.map +1 -1
  16. package/dist/context.d.ts +22 -5
  17. package/dist/context.d.ts.map +1 -1
  18. package/dist/context.js +22 -5
  19. package/dist/context.js.map +1 -1
  20. package/dist/create-agent-pool.d.ts +39 -21
  21. package/dist/create-agent-pool.d.ts.map +1 -1
  22. package/dist/create-agent-pool.js +41 -17
  23. package/dist/create-agent-pool.js.map +1 -1
  24. package/dist/index.d.ts +7 -3
  25. package/dist/index.d.ts.map +1 -1
  26. package/dist/index.js +12 -3
  27. package/dist/index.js.map +1 -1
  28. package/dist/orchestrators.d.ts +161 -0
  29. package/dist/orchestrators.d.ts.map +1 -0
  30. package/dist/orchestrators.js +173 -0
  31. package/dist/orchestrators.js.map +1 -0
  32. package/dist/replay.d.ts +96 -0
  33. package/dist/replay.d.ts.map +1 -0
  34. package/dist/replay.js +108 -0
  35. package/dist/replay.js.map +1 -0
  36. package/dist/spine.d.ts +106 -0
  37. package/dist/spine.d.ts.map +1 -0
  38. package/dist/spine.js +155 -0
  39. package/dist/spine.js.map +1 -0
  40. package/dist/trace-types.d.ts +25 -5
  41. package/dist/trace-types.d.ts.map +1 -1
  42. package/dist/types.d.ts +50 -16
  43. package/dist/types.d.ts.map +1 -1
  44. package/dist/use-agent.d.ts +3 -3
  45. package/dist/use-agent.d.ts.map +1 -1
  46. package/dist/use-agent.js +16 -20
  47. package/dist/use-agent.js.map +1 -1
  48. package/package.json +5 -5
  49. package/dist/shared-root.d.ts +0 -58
  50. package/dist/shared-root.d.ts.map +0 -1
  51. package/dist/shared-root.js +0 -125
  52. package/dist/shared-root.js.map +0 -1
package/README.md CHANGED
@@ -1,14 +1,14 @@
1
1
  # @lloyal-labs/lloyal-agents
2
2
 
3
- Continuous Context agent runtime.
3
+ Continuous Context agent runtime for the [lloyal HDK](https://github.com/lloyal-ai/hdk).
4
4
 
5
5
  `lloyal-agents` runs multi-agent inference inside the decode loop. Instead of N independent model calls rebuilding the prompt each step, all agents advance inside one continuous decode process — forked from shared KV cache state, driven through a single GPU forward pass per tick, spawning sub-agents from their own live branches at arbitrary depth.
6
6
 
7
- Built on [lloyal.node](https://github.com/lloyal-ai/lloyal.node), which provides forkable decode state and continuous tree batching over llama.cpp. `lloyal-agents` adds structured concurrency, tool dispatch, and a four-phase tick loop. Orchestration is not a layer above inference. It is inference.
7
+ Built on [lloyal.node](https://github.com/lloyal-ai/lloyal.node), which provides forkable decode state and continuous tree batching over llama.cpp. `lloyal-agents` adds structured concurrency, tool dispatch, and a five-phase tick loop. Orchestration is not a layer above inference it is inference.
8
8
 
9
9
  <picture>
10
- <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/lloyal-ai/sdk/main/assets/continuous-context-dark.svg">
11
- <img src="https://raw.githubusercontent.com/lloyal-ai/sdk/main/assets/continuous-context.svg" alt="Traditional Agents vs Continuous Context Agents — shared KV prefix, tool prefill, sub-agent spawning" width="100%">
10
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/lloyal-ai/hdk/main/assets/continuous-context-dark.svg">
11
+ <img src="https://raw.githubusercontent.com/lloyal-ai/hdk/main/assets/continuous-context.svg" alt="Traditional Agents vs Continuous Context Agents — shared KV prefix, tool prefill, sub-agent spawning" width="100%">
12
12
  </picture>
13
13
 
14
14
  ```bash
@@ -17,26 +17,24 @@ npm i @lloyal-labs/lloyal-agents @lloyal-labs/lloyal.node
17
17
 
18
18
  `lloyal-agents` provides the agent runtime. [`lloyal.node`](https://github.com/lloyal-ai/lloyal.node) provides the native inference backend — prebuilt binaries for macOS (Metal, CPU), Linux (CPU, CUDA, Vulkan), and Windows (CPU, CUDA, Vulkan). Both are required. GPU selection at runtime.
19
19
 
20
- The public API surface:
20
+ ## Public API
21
21
 
22
22
  ```typescript
23
23
  import {
24
- initAgents, // bootstrap: session, store, event channel
25
- generate, // single-branch grammar-constrained generation
26
- diverge, // multi-branch perplexity selection
27
- useAgentPool, // concurrent agents as an Effection resource
28
- runAgents, // same, with automatic branch cleanup
29
- withSharedRoot, // scoped shared KV prefix with guaranteed teardown
30
- createToolkit, // tool registry from Tool[] toolMap + toolsJson
31
- Ctx,
32
- Store,
33
- Events, // Effection contexts — implicit dependency resolution
24
+ initAgents, // bootstrap: session, store, event channel
25
+ useAgent, agent, // single-agent helpers
26
+ agentPool, // multi-agent pool with a swappable orchestrator
27
+ useAgentPool, // lower-level Effection resource (advanced)
28
+ diverge, // multi-branch perplexity selection
29
+ parallel, chain, fanout, dag, reduce, // orchestrators / combinators
30
+ withSpine, // scoped spine branch with guaranteed teardown
31
+ Tool, Source,
32
+ DefaultAgentPolicy,
33
+ Ctx, Store, Events,
34
34
  } from "@lloyal-labs/lloyal-agents";
35
35
  ```
36
36
 
37
- That is essentially the entire framework.
38
-
39
- ### Bootstrap
37
+ ## Bootstrap
40
38
 
41
39
  ```typescript
42
40
  import { main, call } from "effection";
@@ -47,17 +45,16 @@ main(function* () {
47
45
  const ctx = yield* call(() =>
48
46
  createContext({
49
47
  modelPath: "model.gguf",
50
- nCtx: 16384,
48
+ nCtx: 32768,
51
49
  nSeqMax: 8,
52
50
  typeK: "q4_0",
53
51
  typeV: "q4_0",
54
52
  }),
55
53
  );
56
54
 
57
- const { session, events } = yield* initAgents(ctx);
58
- // Ctx, Store, Events now set — generate(), diverge(),
59
- // useAgentPool() find them automatically.
60
- // Session + context disposed on scope exit.
55
+ yield* initAgents(ctx);
56
+ // Ctx, Store, Events now set — useAgent(), agentPool(), diverge()
57
+ // find them automatically. Session + context disposed on scope exit.
61
58
  });
62
59
  ```
63
60
 
@@ -68,62 +65,52 @@ When agents fork from a common branch, they inherit its KV cache — the full at
68
65
  Everything before the frontier is shared context. Everything after is independent reasoning. The model doesn't need to be told what the other agents know — it already attended over the same prefix. Communication happened at prefill time, through the attention mechanism, with zero serialization overhead.
69
66
 
70
67
  ```typescript
71
- yield *
72
- withSharedRoot(
73
- { systemPrompt: RESEARCH_PROMPT, tools: toolsJson },
74
- function* (root, prefixLen) {
75
- // root is a prefilled branch system prompt already in KV cache.
76
- // Every agent forked from root shares that prefix.
77
- // KV saved = prefixLen × (agentCount - 1)
78
- return yield* runAgents({
79
- tasks: questions.map((q) => ({
80
- systemPrompt: RESEARCH_PROMPT,
68
+ yield* withSpine(
69
+ { systemPrompt: PLAYBOOKS, tools },
70
+ function* (spine) {
71
+ // spine is a prefilled branch — system prompt + tool schemas already in KV.
72
+ // Every agent forked from spine shares that prefix.
73
+ return yield* agentPool({
74
+ orchestrate: parallel(
75
+ questions.map((q) => ({
81
76
  content: q,
82
- tools: toolsJson,
83
- parent: root,
77
+ systemPrompt: WORKER_PROMPT,
84
78
  })),
85
- tools: toolMap,
86
- });
87
- },
88
- );
79
+ ),
80
+ tools: [...sourceTools, reportTool],
81
+ parent: spine,
82
+ terminalTool: "report",
83
+ });
84
+ },
85
+ );
89
86
  ```
90
87
 
91
- `withSharedRoot` creates the prefix, passes it to the body, and guarantees cleanup via `try/finally` — the root branch cannot leak out of the block. Effection enforces the lifetime.
88
+ `withSpine` creates the spine branch, passes it to the body, and guarantees cleanup via `try/finally` — the spine cannot leak out of the block. Effection enforces the lifetime.
92
89
 
93
- ## In-Loop Orchestration
90
+ ## Orchestrators
94
91
 
95
- All active agents advance together in a four-phase tick loop:
92
+ `agentPool` accepts an orchestrator that determines how agents are spawned and sequenced:
96
93
 
97
- **PRODUCE.** Every generating agent calls `produceSync()`synchronous sampling with no async gap between agents. This matters because it means the entire produce phase is a single uninterrupted pass over the active set.
94
+ - **`parallel(specs[])`** — agents run concurrently from the shared spine.
95
+ - **`chain(specs[], factory)`** — sequential, with `extendSpine` writing each task's findings onto the spine before the next forks.
96
+ - **`fanout(landscapeSpec, domainSpecs[])`** — landscape pass that informs N parallel domain agents.
97
+ - **`dag(nodes[])`** — arbitrary acyclic graph with multi-parent edges (Task-as-Future pattern).
98
98
 
99
- **COMMIT.** One `store.commit()` call packs all produced tokens into a single `llama_batch` and dispatches once. N branches, one GPU call. No per-agent decode overhead.
99
+ Same `agentPool` call shape; the orchestrator argument changes the topology.
100
100
 
101
- **SETTLE.** Tool results that resolved during COMMIT are drained from a buffer. Each result is tokenized into a delta, budget-checked against a fresh `ContextPressure` snapshot, and batch-prefilled into the agent's branch. Grammar state resets. The agent transitions back to `generating`.
101
+ ## In-Loop Orchestration
102
102
 
103
- **DISPATCH.** Tool calls collected during PRODUCE are executed sequentially via `scoped()` + `call()`. Each tool runs to completion before the next begins — no concurrent `llama_decode` during dispatch. Tools return `Operation<unknown>`, so they can `yield*` into framework primitives like `useAgentPool` or `runAgents`, spawning recursive sub-agents within the calling agent's scope.
103
+ All active agents advance together in a five-phase tick loop:
104
104
 
105
- ```typescript
106
- // From the tick loop — Phase 1
107
- const entries: [Branch, number][] = [];
108
- for (const a of agents) {
109
- if (a.state !== "generating") continue;
110
- if (pressure.critical) {
111
- a.state = "done";
112
- continue;
113
- }
105
+ **SPAWN+EXTEND.** The rendezvous point with the orchestrator fiber. Pending agent spawns and `extendSpine` calls are queued via Effection `action()` and drained at the start of each tick — batched into a single `store.prefill()`. Single-fiber discipline preserved across concurrent orchestrator extends.
114
106
 
115
- const { token, text, isStop } = a.branch.produceSync();
116
- if (isStop) {
117
- /* parse tool calls, dispatch or finalize */ continue;
118
- }
119
- entries.push([a.branch, token]);
120
- }
107
+ **PRODUCE.** Every generating agent calls `produceSync()` synchronous sampling with no async gap between agents. The entire produce phase is a single uninterrupted pass over the active set.
121
108
 
122
- // Phase 2 single GPU dispatch
123
- if (entries.length > 0) {
124
- yield * call(() => store.commit(entries));
125
- }
126
- ```
109
+ **COMMIT.** One `store.commit()` call packs all produced tokens into a single `llama_batch` and dispatches once. N branches, one GPU call.
110
+
111
+ **SETTLE.** Tool results that resolved during the prior DISPATCH are drained from a buffer. Each result is tokenized into a delta, budget-checked against a fresh `ContextPressure` snapshot, and batch-prefilled into the agent's branch. Grammar state resets. The agent transitions back to `generating`.
112
+
113
+ **DISPATCH.** Tool calls collected during PRODUCE are executed sequentially via `scoped()` + `call()`. Each tool runs to completion before the next begins. Tools return `Operation<unknown>`, so they can `yield*` into framework primitives like `useAgent` or `agentPool`, spawning recursive sub-agents within the calling agent's scope.
127
114
 
128
115
  When no agent is generating and tools are still pending, the loop yields control until the next tool resolves. No polling. No sleep loops.
129
116
 
@@ -143,13 +130,11 @@ function* setupAgent(parent, task, ctx) {
143
130
  }
144
131
  ```
145
132
 
146
- If the scope exits — error, cancellation, normal completion — the branch is pruned. Orphaned branches are structurally impossible. Tool dispatch uses `scoped()` + `call()` each tool executes inside a scoped error boundary within the agent pool scope. If the scope tears down, pending tools are cancelled. The DAG is not imposed on the orchestration. It is intrinsic to the Effection task tree.
147
-
148
- `useAgentPool` is an Effection `resource()` — it suspends via `provide()` after all agents complete, but keeps their branches alive. The caller can fork sub-agents from any completed agent's branch. Those sub-agents inherit the parent agent's full KV state — everything it generated, every tool result it consumed, every reasoning step it took. No summarization. No context window management. The sub-agent continues from the parent's frontier.
133
+ If the scope exits — error, cancellation, normal completion — the branch is pruned. Orphaned branches are structurally impossible. Tool dispatch uses `scoped()` + `call()`; each tool executes inside a scoped error boundary within the agent pool scope. If the scope tears down, pending tools are cancelled. The DAG is not imposed on the orchestration. It is intrinsic to the Effection task tree.
149
134
 
150
- Recursive agents work at two levels. At the **harness level**, a completed pool's branches can be forked into follow-up pools sub-agents inherit the parent's full KV state and continue from the fork point. At the **model level**, a tool's `execute()` method returns `Operation<unknown>`, so it can `yield*` directly into `useAgentPool` or `runAgents`. An agent that calls such a tool spawns sub-agents mid-generation inside its own scope, inheriting its KV state, with cleanup guaranteed by structured concurrency.
135
+ `useAgentPool` is an Effection `resource()` it suspends via `provide()` after all agents complete, but keeps their branches alive. The caller can fork sub-agents from any completed agent's branch. Those sub-agents inherit the parent agent's full KV state every tool result it consumed, every reasoning step it took. No summarization. No context window management. The sub-agent continues from the parent's frontier.
151
136
 
152
- In both cases, the sub-agent sees everything the parent saw system prompt, tool calls, partial reasoning because that state is already in the KV cache at the fork point. No summarization. No context reconstruction. The sub-agent just continues from the parent's frontier.
137
+ Recursive agents work at two levels. At the **harness level**, a completed pool's branches can be forked into follow-up pools. At the **model level**, a tool's `execute()` returns `Operation<unknown>`, so it can `yield*` directly into `useAgent` or `agentPool`. An agent that calls such a tool spawns sub-agents mid-generation inside its own scope, inheriting its KV state, with cleanup guaranteed by structured concurrency. `DelegateTool` (from [`@lloyal-labs/rig`](../rig)) is the canonical implementation.
153
138
 
154
139
  There is nothing in the framework that limits depth. Agents can spawn sub-agents that spawn sub-agents. An agent pool can run inside another agent pool's scope. The structured concurrency guarantees compose at every level.
155
140
 
@@ -164,16 +149,14 @@ Enable `trace: true` on agent pools to capture entropy and surprisal on every `a
164
149
  **Multi-branch semantic comparison.** `diverge()` forks N branches from a shared frontier, generates independently, and returns all outputs with their perplexity scores:
165
150
 
166
151
  ```typescript
167
- const result =
168
- yield *
169
- diverge({
170
- parent: root, // shared frontier
171
- attempts: 3, // fork 3 branches
172
- params: { temperature: 0.7 },
173
- });
152
+ const result = yield* diverge({
153
+ parent: root, // shared frontier
154
+ attempts: 3, // fork 3 branches
155
+ params: { temperature: 0.7 },
156
+ });
174
157
  // result.best — lowest-perplexity branch, still alive
175
158
  // result.attempts — all branches with output, ppl, token count
176
- // Losers already pruned. Winner's branch is caller's responsibility.
159
+ // Losers already pruned. Winner's branch is the caller's responsibility.
177
160
  ```
178
161
 
179
162
  The harness decides how to compare. `diverge()` returns all outputs with their perplexity scores — the harness can apply any equivalence measure: bigram overlap, embedding similarity, or model-based evaluation. Where branches agree, the model is confident; where they diverge, hallucination risk is high.
@@ -182,27 +165,29 @@ This directly operationalizes the semantic entropy work from Farquhar et al. ([N
182
165
 
183
166
  ## Session Accumulation
184
167
 
185
- `Session.promote(branch)` retains only that branch and makes it the session trunk. Future queries fork from this trunk — its KV cache already contains everything the promoted branch generated, every tool result it consumed, every verification it passed.
168
+ `Session.commitTurn(query, answer)` extends the trunk with a new query–answer pair. Future queries fork from this trunk — its KV cache already contains everything the prior turn established.
169
+
170
+ A cold query starts from position 0. A warm query starts from an existing trunk. Over multiple queries, the session compounds — each turn advances the frontier, and future agents inherit the accumulated state via attention.
186
171
 
187
- A cold query starts from position 0. A warm query starts from an existing trunk. Over multiple queries, the session compounds — each promote advances the frontier, and future agents inherit the accumulated state.
172
+ The lower-level building blocks (`prefillUser`, `prefillToolResult`, `promote`) are also exposed for harnesses that orchestrate the trunk lifecycle directly.
188
173
 
189
174
  ## Context Pressure
190
175
 
191
- KV cache is finite. `ContextPressure` snapshots the remaining budget on every tick and enforces two thresholds:
176
+ KV cache is finite. `ContextPressure` snapshots the remaining budget on every tick and `DefaultAgentPolicy` enforces two thresholds:
192
177
 
193
178
  - **softLimit** (default 1024 tokens remaining): SETTLE rejects tool results that would cross this floor. PRODUCE hard-cuts agents requesting non-terminal tool calls. Terminal tools (e.g. `report`) still pass — agents can always submit findings. INIT drops agents that don't fit above this floor.
194
179
  - **hardLimit** (default 128 tokens remaining): agents killed immediately before `produceSync()`. No decode call is made below this line — it would crash.
195
180
 
196
- Tool result prefill in the SETTLE phase is budget-gated against a fresh pressure snapshot. If a tool result doesn't fit, the agent is terminated rather than risking a context overflow mid-generation. The softLimit reserves space for downstream work — reporter sub-agents, verification passes.
181
+ Tool result prefill in the SETTLE phase is budget-gated against a fresh pressure snapshot. If a tool result doesn't fit, the agent is terminated rather than risking a context overflow mid-generation. The softLimit reserves space for downstream work — synthesis passes, verification.
197
182
 
198
183
  ```typescript
199
- yield *
200
- useAgentPool({
201
- tasks,
202
- tools: toolMap,
203
- terminalTool: "report",
204
- pressure: { softLimit: 2048 }, // reserve 2K for reporters + verify
205
- });
184
+ yield* agentPool({
185
+ orchestrate: parallel(tasks),
186
+ tools, terminalTool: "report",
187
+ policy: new DefaultAgentPolicy({
188
+ budget: { context: { softLimit: 2048 } }, // reserve 2K for downstream
189
+ }),
190
+ });
206
191
  ```
207
192
 
208
193
  ## Tools
@@ -225,19 +210,13 @@ class SearchTool extends Tool<{ query: string }> {
225
210
  };
226
211
 
227
212
  *execute(args: { query: string }, context?: ToolContext): Operation<unknown> {
228
- const results = yield* call(() =>
229
- this.reranker.rank(args.query, this.chunks),
230
- );
231
- context?.onProgress?.({
232
- filled: results.length,
233
- total: this.chunks.length,
234
- });
213
+ const results = yield* call(() => this.reranker.rank(args.query, this.chunks));
235
214
  return results.slice(0, 10);
236
215
  }
237
216
  }
238
217
  ```
239
218
 
240
- `createToolkit(tools)` aggregates tools into a `{ toolMap, toolsJson }` pair — `toolMap` for runtime dispatch, `toolsJson` for prompt formatting.
219
+ Pass the same `Tool[]` to `withSpine({ systemPrompt, tools })` and to `agentPool({ tools })`: the spine decodes the tool schemas into KV once at setup, and the pool's dispatcher registers the same instances for runtime `execute()`. Two roles, one input see the [playbooks](https://hdk.lloyal.ai/reference/playbooks) convention for mixed-role pools. (Advanced: `createToolkit(tools)` is still exported if you need direct access to the `{ toolMap, toolsJson }` pair, e.g. for the low-level `useAgentPool` primitive.)
241
220
 
242
221
  ## Events
243
222
 
@@ -250,9 +229,14 @@ The runtime emits structured events for TUI, logging, or telemetry:
250
229
  | `agent:tool_call` | `agentId`, `tool`, `args` |
251
230
  | `agent:tool_result` | `agentId`, `tool`, `result` |
252
231
  | `agent:tool_progress` | `agentId`, `tool`, `filled`, `total` |
253
- | `agent:report` | `agentId`, `findings` |
232
+ | `agent:return` | `agentId`, `result` — voluntary completion via terminal tool |
233
+ | `agent:recovered` | `agentId`, `result` — recovery extracted findings from killed agent |
254
234
  | `agent:done` | `agentId` |
255
235
 
236
+ ## Documentation
237
+
238
+ Full positioning, mechanics, learn pages, and reference at [docs.lloyal.ai](https://docs.lloyal.ai).
239
+
256
240
  ## License
257
241
 
258
242
  Apache-2.0
package/dist/Agent.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import type { Branch, SessionContext, ParseChatOutputResult } from '@lloyal-labs/sdk';
2
2
  import type { GrammarTrigger } from '@lloyal-labs/sdk';
3
+ import { type Signal } from 'effection';
3
4
  import type { TraceToken } from './types';
4
5
  /**
5
6
  * Agent status — domain language for where the agent is in its lifecycle.
@@ -18,7 +19,7 @@ export type AgentStatus = 'idle' | 'active' | 'awaiting_tool' | 'disposed';
18
19
  *
19
20
  * @category Agents
20
21
  */
21
- export type ResultSource = 'report_tool' | 'free_text' | 'scratchpad' | 'nudge' | 'tool_error';
22
+ export type ResultSource = 'voluntary_return' | 'free_text' | 'scratchpad' | 'nudge' | 'tool_error';
22
23
  /**
23
24
  * Immutable prompt format configuration set at agent creation.
24
25
  * Derived from `formatChatSync()` output.
@@ -33,6 +34,15 @@ export interface FormatConfig {
33
34
  grammar: string;
34
35
  grammarLazy: boolean;
35
36
  grammarTriggers: GrammarTrigger[];
37
+ /**
38
+ * Whether the template's generation prompt includes `<think>\n` prefill.
39
+ * Must match the value used in every subsequent delta builder call
40
+ * (tool_result, nudge, etc.) for this agent — otherwise the parser's
41
+ * `generation_prompt` diverges from actual KV state and reasoning
42
+ * content leaks into visible content.
43
+ * Captured once at agent setup from the pool's `enableThinking` option.
44
+ */
45
+ enableThinking: boolean;
36
46
  }
37
47
  /**
38
48
  * Metadata for a single tool invocation — what was called, how expensive
@@ -82,6 +92,8 @@ export declare class Agent {
82
92
  /** The task text this agent was assigned — used by echo detection guard */
83
93
  readonly task: string;
84
94
  private _status;
95
+ private _statusSignal;
96
+ private _startedAt;
85
97
  private _rawOutput;
86
98
  private _tokenCount;
87
99
  private _toolCallCount;
@@ -105,6 +117,12 @@ export declare class Agent {
105
117
  task?: string;
106
118
  });
107
119
  get status(): AgentStatus;
120
+ /**
121
+ * Signal that fires on every status transition. Used by `PoolContext.waitFor`
122
+ * to suspend until the agent reaches a terminal status. Multi-subscriber —
123
+ * every active listener receives every transition.
124
+ */
125
+ get statusSignal(): Signal<AgentStatus, void>;
108
126
  /**
109
127
  * Transition to a new status. Enforces valid transitions:
110
128
  * - idle → active (first produce)
@@ -113,8 +131,16 @@ export declare class Agent {
113
131
  * - awaiting_tool → active (tool result settled)
114
132
  * - awaiting_tool → idle (settle reject + kill)
115
133
  * - idle → disposed (branch pruned)
134
+ *
135
+ * Emits the new status via `statusSignal` for orchestrator-side observers.
116
136
  */
117
137
  transition(to: AgentStatus): void;
138
+ /**
139
+ * Wall-clock timestamp (performance.now) when the agent first became active.
140
+ * Null until the first idle→active transition. Used by policies to measure
141
+ * per-agent elapsed time independent of when the enclosing pool was created.
142
+ */
143
+ get startedAt(): number | null;
118
144
  get rawOutput(): string;
119
145
  get tokenCount(): number;
120
146
  get toolCallCount(): number;
@@ -168,8 +194,8 @@ export declare class Agent {
168
194
  walkAncestors<T>(fn: (agent: Agent) => readonly T[]): T[];
169
195
  get result(): string | null;
170
196
  get resultSource(): ResultSource | null;
171
- /** Set findings with provenance tracking — single write path */
172
- reportResult(content: string, source: ResultSource): void;
197
+ /** Set the agent's result with provenance tracking — single write path */
198
+ setResult(content: string, source: ResultSource): void;
173
199
  get position(): number;
174
200
  get forkHead(): number;
175
201
  /** Number of unique KV cells this agent owns above the fork point */
@@ -1 +1 @@
1
- {"version":3,"file":"Agent.d.ts","sourceRoot":"","sources":["../src/Agent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,cAAc,EAA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AM,GAAG,IAAI,CAAyB;IACpD,IAAI,YAAY,IAAI,YAAY,GAAG,IAAI,CAA+B;IAEtE,0EAA0E;IAC1E,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI;IAOtD,IAAI,QAAQ,IAAI,MAAM,CAAiC;IACvD,IAAI,QAAQ,IAAI,MAAM,CAAiC;IACvD,qEAAqE;IACrE,IAAI,WAAW,IAAI,MAAM,CAAwD;IAEjF,uEAAuE;IACvE,IAAI,qBAAqB,IAAI,OAAO,CAEnC;IAID;;;;;;;;;;OAUG;IACI,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,qBAAqB,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IASvF,oEAAoE;IACpE,OAAO,IAAI,IAAI;CAIhB"}
package/dist/Agent.js CHANGED
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Agent = void 0;
4
+ const effection_1 = require("effection");
4
5
  // ── Agent ───────────────────────────────────────────────────
5
6
  /**
6
7
  * An agent is a branch with intent.
@@ -33,6 +34,8 @@ class Agent {
33
34
  task;
34
35
  // ── Mutable state ───────────────────────────────────────
35
36
  _status = 'idle';
37
+ _statusSignal = (0, effection_1.createSignal)();
38
+ _startedAt = null;
36
39
  _rawOutput = '';
37
40
  _tokenCount = 0;
38
41
  _toolCallCount = 0;
@@ -58,6 +61,12 @@ class Agent {
58
61
  }
59
62
  // ── Status ──────────────────────────────────────────────
60
63
  get status() { return this._status; }
64
+ /**
65
+ * Signal that fires on every status transition. Used by `PoolContext.waitFor`
66
+ * to suspend until the agent reaches a terminal status. Multi-subscriber —
67
+ * every active listener receives every transition.
68
+ */
69
+ get statusSignal() { return this._statusSignal; }
61
70
  /**
62
71
  * Transition to a new status. Enforces valid transitions:
63
72
  * - idle → active (first produce)
@@ -66,6 +75,8 @@ class Agent {
66
75
  * - awaiting_tool → active (tool result settled)
67
76
  * - awaiting_tool → idle (settle reject + kill)
68
77
  * - idle → disposed (branch pruned)
78
+ *
79
+ * Emits the new status via `statusSignal` for orchestrator-side observers.
69
80
  */
70
81
  transition(to) {
71
82
  const from = this._status;
@@ -76,7 +87,17 @@ class Agent {
76
87
  throw new Error(`Invalid agent status transition: ${from} → ${to}`);
77
88
  }
78
89
  this._status = to;
90
+ if (to === 'active' && this._startedAt === null) {
91
+ this._startedAt = performance.now();
92
+ }
93
+ this._statusSignal.send(to);
79
94
  }
95
+ /**
96
+ * Wall-clock timestamp (performance.now) when the agent first became active.
97
+ * Null until the first idle→active transition. Used by policies to measure
98
+ * per-agent elapsed time independent of when the enclosing pool was created.
99
+ */
100
+ get startedAt() { return this._startedAt; }
80
101
  // ── Token accounting ────────────────────────────────────
81
102
  get rawOutput() { return this._rawOutput; }
82
103
  get tokenCount() { return this._tokenCount; }
@@ -181,8 +202,8 @@ class Agent {
181
202
  // ── Findings ────────────────────────────────────────────
182
203
  get result() { return this._result; }
183
204
  get resultSource() { return this._resultSource; }
184
- /** Set findings with provenance tracking — single write path */
185
- reportResult(content, source) {
205
+ /** Set the agent's result with provenance tracking — single write path */
206
+ setResult(content, source) {
186
207
  this._result = content;
187
208
  this._resultSource = source;
188
209
  }
@@ -217,6 +238,7 @@ class Agent {
217
238
  /** Mark agent as disposed — called by pool when branch is pruned */
218
239
  dispose() {
219
240
  this._status = 'disposed';
241
+ this._statusSignal.send('disposed');
220
242
  }
221
243
  }
222
244
  exports.Agent = Agent;
package/dist/Agent.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Agent.js","sourceRoot":"","sources":["../src/Agent.ts"],"names":[],"mappings":";;;AAuEA,+DAA+D;AAE/D;;;;;;;;;;;;;;;;GAgBG;AACH,MAAa,KAAK;IAChB,2DAA2D;IAE3D,+CAA+C;IACtC,EAAE,CAAS;IAEpB,uEAAuE;IAC9D,QAAQ,CAAS;IAE1B,sCAAsC;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