@cuylabs/agent-core 0.9.0 → 0.10.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 (116) hide show
  1. package/README.md +33 -17
  2. package/dist/chunk-2O4MCSQS.js +780 -0
  3. package/dist/chunk-2TTOLHBT.js +198 -0
  4. package/dist/chunk-5FMSGQVX.js +281 -0
  5. package/dist/chunk-5NVVNXPQ.js +288 -0
  6. package/dist/{chunk-EKR6PKXU.js → chunk-6HZBHFOL.js} +3 -3
  7. package/dist/chunk-CJI7PVS2.js +58 -0
  8. package/dist/{chunk-WKHDSSXG.js → chunk-CMYN2RCB.js} +146 -46
  9. package/dist/chunk-FII65CN7.js +117 -0
  10. package/dist/{chunk-UHCJEM2E.js → chunk-ICZ66572.js} +13 -6
  11. package/dist/chunk-KYLPMBHD.js +316 -0
  12. package/dist/chunk-MXAP4UG6.js +2956 -0
  13. package/dist/{chunk-4QFNWPIF.js → chunk-N3VX7FEE.js} +35 -2
  14. package/dist/{chunk-MAZ5DY5B.js → chunk-NDZWXCBZ.js} +213 -78
  15. package/dist/{chunk-MHKK374K.js → chunk-Q742PSH3.js} +11 -27
  16. package/dist/{chunk-WGZAPU6N.js → chunk-QAL3OMI3.js} +15 -1
  17. package/dist/{chunk-UDCZ673N.js → chunk-RN6WZEUF.js} +27 -23
  18. package/dist/{chunk-ZXAKHMWH.js → chunk-ROTGCYDW.js} +22 -84
  19. package/dist/chunk-SPBFQXOT.js +0 -0
  20. package/dist/chunk-SSFBF3US.js +602 -0
  21. package/dist/chunk-SZ2XBPTW.js +8 -0
  22. package/dist/chunk-T4UIX5D7.js +115 -0
  23. package/dist/{chunk-IYWQOJMQ.js → chunk-TIHPYVAJ.js} +34 -34
  24. package/dist/{chunk-RKEW5WXI.js → chunk-TOTDGK3P.js} +1 -1
  25. package/dist/chunk-V4RFNEET.js +563 -0
  26. package/dist/chunk-VOUEJSW6.js +0 -0
  27. package/dist/{chunk-J4QDGZIA.js → chunk-WBPOZ7CL.js} +659 -275
  28. package/dist/chunk-X4VN4GIJ.js +185 -0
  29. package/dist/dispatch/index.d.ts +93 -0
  30. package/dist/dispatch/index.js +37 -0
  31. package/dist/events/index.d.ts +93 -0
  32. package/dist/events/index.js +6 -0
  33. package/dist/{runtime → execution}/index.d.ts +120 -35
  34. package/dist/{runtime → execution}/index.js +17 -11
  35. package/dist/index.d.ts +489 -115
  36. package/dist/index.js +1665 -462
  37. package/dist/inference/errors/index.js +1 -1
  38. package/dist/inference/index.d.ts +13 -21
  39. package/dist/inference/index.js +15 -12
  40. package/dist/instance-BqV2D5pc.d.ts +5723 -0
  41. package/dist/logger/index.d.ts +50 -0
  42. package/dist/logger/index.js +11 -0
  43. package/dist/mcp/index.d.ts +5 -9
  44. package/dist/mcp/index.js +2 -3
  45. package/dist/middleware/index.d.ts +10 -150
  46. package/dist/middleware/index.js +10 -2
  47. package/dist/model-messages-B4nK9D1-.d.ts +13 -0
  48. package/dist/models/index.d.ts +5 -2
  49. package/dist/models/index.js +2 -1
  50. package/dist/models/reasoning/index.js +2 -1
  51. package/dist/plugin/index.d.ts +55 -11
  52. package/dist/plugin/index.js +1 -1
  53. package/dist/profiles/index.d.ts +55 -0
  54. package/dist/{presets → profiles}/index.js +10 -10
  55. package/dist/prompt/index.d.ts +8 -13
  56. package/dist/safety/index.d.ts +109 -14
  57. package/dist/safety/index.js +59 -3
  58. package/dist/sandbox/index.d.ts +81 -0
  59. package/dist/sandbox/index.js +1 -0
  60. package/dist/skill/index.d.ts +10 -8
  61. package/dist/skill/index.js +2 -2
  62. package/dist/storage/index.d.ts +12 -4
  63. package/dist/storage/index.js +1 -1
  64. package/dist/subagents/index.d.ts +177 -0
  65. package/dist/subagents/index.js +78 -0
  66. package/dist/team/index.d.ts +544 -0
  67. package/dist/team/index.js +41 -0
  68. package/dist/tool/host/index.d.ts +41 -0
  69. package/dist/tool/host/index.js +10 -0
  70. package/dist/tool/index.d.ts +111 -21
  71. package/dist/tool/index.js +20 -13
  72. package/dist/{types-VQgymC1N.d.ts → types-Bj_J8u_W.d.ts} +44 -64
  73. package/dist/{types-CHiPh8U2.d.ts → types-C_LCeYNg.d.ts} +7 -7
  74. package/dist/types-RSCv7nQ4.d.ts +59 -0
  75. package/package.json +46 -47
  76. package/dist/builder-BgZ_j4Vs.d.ts +0 -35
  77. package/dist/chunk-5ARZJWD2.js +0 -259
  78. package/dist/chunk-DXFBQMXP.js +0 -53
  79. package/dist/chunk-H3FUYU52.js +0 -81
  80. package/dist/chunk-JLXG2SH7.js +0 -905
  81. package/dist/chunk-N7P4PN3O.js +0 -84
  82. package/dist/chunk-OFDKHNCX.js +0 -727
  83. package/dist/chunk-SDSBEQXG.js +0 -157
  84. package/dist/chunk-VEKUXUVF.js +0 -41
  85. package/dist/chunk-VNQBHPCT.js +0 -398
  86. package/dist/chunk-WWYYNWEW.js +0 -259
  87. package/dist/context/index.d.ts +0 -259
  88. package/dist/context/index.js +0 -26
  89. package/dist/events-CE72w8W4.d.ts +0 -149
  90. package/dist/host/index.d.ts +0 -45
  91. package/dist/host/index.js +0 -8
  92. package/dist/index-DQuTZ8xL.d.ts +0 -1335
  93. package/dist/messages-BYWGn8TY.d.ts +0 -110
  94. package/dist/presets/index.d.ts +0 -53
  95. package/dist/registry-DwYqsQkX.d.ts +0 -164
  96. package/dist/runner-CI-XeR16.d.ts +0 -91
  97. package/dist/scope/index.d.ts +0 -10
  98. package/dist/scope/index.js +0 -14
  99. package/dist/session-manager-KbYt2WUh.d.ts +0 -282
  100. package/dist/signal/index.d.ts +0 -28
  101. package/dist/signal/index.js +0 -6
  102. package/dist/sub-agent/index.d.ts +0 -24
  103. package/dist/sub-agent/index.js +0 -32
  104. package/dist/tool-CZWN3KbO.d.ts +0 -141
  105. package/dist/tool-DkhSCV2Y.d.ts +0 -145
  106. package/dist/tracker-DClqYqTj.d.ts +0 -96
  107. package/dist/tracking/index.d.ts +0 -111
  108. package/dist/tracking/index.js +0 -20
  109. package/dist/types-BfNpU8NS.d.ts +0 -270
  110. package/dist/types-BlOKk-Bb.d.ts +0 -330
  111. package/dist/types-BlZwmnuW.d.ts +0 -50
  112. package/dist/types-CQL-SvTn.d.ts +0 -29
  113. package/dist/types-CWm-7rvB.d.ts +0 -55
  114. package/dist/types-DTSkxakL.d.ts +0 -651
  115. package/dist/types-DmDwi2zI.d.ts +0 -339
  116. package/dist/types-YuWV4ag7.d.ts +0 -72
@@ -1,339 +0,0 @@
1
- import { LanguageModel, TelemetrySettings, ModelMessage, ToolSet } from 'ai';
2
- import { T as Tool } from './tool-CZWN3KbO.js';
3
- import { T as ToolHost } from './types-CHiPh8U2.js';
4
- import { M as MiddlewareRunner } from './runner-CI-XeR16.js';
5
- import { n as InterventionController, T as ToolExecutionMode, I as InferenceStreamInput } from './types-BlOKk-Bb.js';
6
- import { R as ReasoningLevel } from './types-CQaXbRsS.js';
7
- import { N as NormalizedToolReplayPolicy, d as TurnTrackerContext } from './tool-DkhSCV2Y.js';
8
- import { T as TokenUsage, M as Message } from './messages-BYWGn8TY.js';
9
- import { f as StreamProvider } from './types-DTSkxakL.js';
10
- import { S as StepProcessingResult, A as AgentEvent, b as AgentTurnBoundaryKind } from './events-CE72w8W4.js';
11
-
12
- /**
13
- * Doom-loop handling contracts for repeated tool invocations.
14
- */
15
- /**
16
- * Response from a doom-loop handler.
17
- */
18
- type DoomLoopAction = "allow" | "deny" | "remember";
19
- /**
20
- * Doom-loop detection request.
21
- */
22
- interface DoomLoopRequest {
23
- /** The tool being called repeatedly */
24
- tool: string;
25
- /** How many times it has been called with the same input */
26
- repeatCount: number;
27
- /** The repeated input */
28
- input: unknown;
29
- /** Session ID */
30
- sessionId: string;
31
- }
32
- /**
33
- * Handler for doom-loop situations.
34
- */
35
- type DoomLoopHandler = (request: DoomLoopRequest) => Promise<DoomLoopAction>;
36
-
37
- /**
38
- * Options for processing a streamed model result.
39
- */
40
- interface StepProcessingOptions {
41
- /** Session ID (optional - for tracking purposes) */
42
- sessionID?: string;
43
- /** Abort signal */
44
- abort: AbortSignal;
45
- /** Normalize provider/runtime errors before emitting them as events */
46
- normalizeError?: (error: unknown) => Error;
47
- /** Event callback */
48
- onEvent: (event: AgentEvent) => void | Promise<void>;
49
- /** Doom loop threshold (default: 3) */
50
- doomLoopThreshold?: number;
51
- /** Enforce doom loop (throw error vs warn) when no handler is provided */
52
- enforceDoomLoop?: boolean;
53
- /**
54
- * Handler for doom loop detection.
55
- * Allows user choice: allow, deny, or remember.
56
- */
57
- onDoomLoop?: DoomLoopHandler;
58
- /** Tools that are "remembered" (allowed without asking) */
59
- rememberedDoomLoopTools?: Set<string>;
60
- /** Token limit for context overflow detection */
61
- contextTokenLimit?: number;
62
- /** Callback for context overflow */
63
- onContextOverflow?: (tokens: number, limit: number) => void | Promise<void>;
64
- /** Current step number */
65
- currentStep?: number;
66
- /** Max steps */
67
- maxSteps?: number;
68
- }
69
- /**
70
- * Result of stream processing.
71
- */
72
- interface StepProcessingOutput {
73
- /** Processing result */
74
- result: StepProcessingResult;
75
- /** Accumulated text */
76
- text: string;
77
- /** Tool results */
78
- toolResults: Array<{
79
- toolName: string;
80
- toolCallId: string;
81
- result: unknown;
82
- }>;
83
- /** Final usage */
84
- usage?: TokenUsage;
85
- /** Finish reason reported by the most recent completed step */
86
- finishReason?: string;
87
- /** Error if any */
88
- error?: Error;
89
- }
90
- /**
91
- * @deprecated Use `StepProcessingOptions`.
92
- */
93
- type ProcessorOptions = StepProcessingOptions;
94
- /**
95
- * @deprecated Use `StepProcessingOutput`.
96
- */
97
- type ProcessorOutput = StepProcessingOutput;
98
-
99
- interface AgentTurnEngineOptions {
100
- sessionId: string;
101
- startedAt: string;
102
- getToolReplayPolicy?: (toolName: string) => NormalizedToolReplayPolicy | undefined;
103
- }
104
- interface AgentTurnBoundaryMetadata {
105
- step?: number;
106
- messageRole?: Message["role"];
107
- pendingToolCallCount?: number;
108
- }
109
- interface AgentTurnStepCommitToolCall {
110
- toolCallId: string;
111
- toolName: string;
112
- args: unknown;
113
- replayPolicy?: NormalizedToolReplayPolicy;
114
- }
115
- interface AgentTurnStepCommitToolResult {
116
- toolCallId: string;
117
- toolName: string;
118
- result: unknown;
119
- replayPolicy?: NormalizedToolReplayPolicy;
120
- }
121
- interface AgentTurnStepCommitSnapshot {
122
- toolCalls: AgentTurnStepCommitToolCall[];
123
- toolResults: AgentTurnStepCommitToolResult[];
124
- }
125
- interface CreateAgentTurnStepCommitBatchOptions {
126
- assistantMessageId?: string;
127
- toolMessageIds?: Record<string, string>;
128
- createdAt?: Date;
129
- }
130
- interface AgentTurnCommitBatch {
131
- startBoundary: AgentEvent & {
132
- type: "turn-boundary";
133
- };
134
- finishBoundary: AgentEvent & {
135
- type: "turn-boundary";
136
- };
137
- messages: Message[];
138
- }
139
- interface AgentTurnOutputCommitOptions {
140
- text: string;
141
- usage?: TokenUsage;
142
- createdAt?: Date;
143
- id?: string;
144
- }
145
- type AgentTurnBoundaryEvent = AgentEvent & {
146
- type: "turn-boundary";
147
- };
148
-
149
- type AgentTurnPhase = "initializing" | "committing-input" | "running-model" | "running-tools" | "committing-step" | "committing-output" | "completed" | "failed";
150
- interface AgentTurnBoundarySnapshot {
151
- kind: AgentTurnBoundaryKind;
152
- createdAt: string;
153
- step?: number;
154
- messageRole?: "system" | "user" | "assistant" | "tool";
155
- pendingToolCallCount?: number;
156
- }
157
- interface AgentTurnActiveToolCall {
158
- toolCallId: string;
159
- toolName: string;
160
- input: unknown;
161
- startedAt: string;
162
- replayPolicy?: NormalizedToolReplayPolicy;
163
- }
164
- interface AgentTurnResolvedToolCall {
165
- toolCallId: string;
166
- toolName: string;
167
- outcome: "result" | "error";
168
- value: unknown;
169
- resolvedAt: string;
170
- replayPolicy?: NormalizedToolReplayPolicy;
171
- }
172
- /**
173
- * Neutral state model for a single in-flight agent turn.
174
- *
175
- * This is intentionally infrastructure-agnostic. Runtime adapters can persist
176
- * or inspect it without coupling `agent-core` to Dapr, queues, or workflow
177
- * engines. The current shape is suitable for durable tracking and forms the
178
- * basis for future workflow-level resume support.
179
- */
180
- interface AgentTurnState {
181
- sessionId: string;
182
- phase: AgentTurnPhase;
183
- step: number;
184
- maxSteps?: number;
185
- response: string;
186
- usage: TokenUsage;
187
- eventCount: number;
188
- activeToolCalls: AgentTurnActiveToolCall[];
189
- resolvedToolCalls: AgentTurnResolvedToolCall[];
190
- lastFinishReason?: string;
191
- lastBoundary?: AgentTurnBoundarySnapshot;
192
- lastEvent?: AgentEvent;
193
- error?: string;
194
- startedAt: string;
195
- updatedAt: string;
196
- }
197
- interface CreateAgentTurnStateOptions {
198
- sessionId: string;
199
- startedAt: string;
200
- }
201
- interface AgentTurnStateAdvanceOptions {
202
- toolReplayPolicy?: NormalizedToolReplayPolicy;
203
- }
204
- /**
205
- * Create the initial neutral state for a single agent turn.
206
- */
207
- declare function createAgentTurnState(options: CreateAgentTurnStateOptions): AgentTurnState;
208
- /**
209
- * Advance neutral turn state from a streamed `AgentEvent`.
210
- *
211
- * This reducer deliberately models coarse but deterministic boundaries:
212
- * step start, tool activity, step finish, completion, and failure. Runtime
213
- * adapters can persist the resulting state now, and future resume-capable
214
- * engines can build on the same state transitions.
215
- */
216
- declare function advanceAgentTurnState(state: AgentTurnState, event: AgentEvent, updatedAt: string, options?: AgentTurnStateAdvanceOptions): AgentTurnState;
217
- /**
218
- * Mark the turn as failed when execution aborts without a terminal `error`
219
- * event. This covers exceptions thrown by the stream itself or runtime
220
- * wrappers around the loop.
221
- */
222
- declare function failAgentTurnState(state: AgentTurnState, error: Error, updatedAt: string): AgentTurnState;
223
-
224
- /**
225
- * Neutral internal turn engine for one in-flight agent turn.
226
- */
227
- declare class AgentTurnEngine {
228
- private turnState;
229
- private readonly pendingToolCalls;
230
- private readonly pendingToolResults;
231
- private readonly getToolReplayPolicy?;
232
- constructor(options: AgentTurnEngineOptions);
233
- getState(): AgentTurnState;
234
- hasPendingToolCalls(): boolean;
235
- createStepCommitSnapshot(): AgentTurnStepCommitSnapshot | undefined;
236
- recordEvent(event: AgentEvent, updatedAt: string): AgentTurnState;
237
- createBoundaryEvent(boundary: AgentTurnBoundaryKind, metadata?: AgentTurnBoundaryMetadata): AgentTurnBoundaryEvent;
238
- createInputCommit(options: {
239
- content: string;
240
- system?: string;
241
- createdAt?: Date;
242
- id?: string;
243
- }): AgentTurnCommitBatch;
244
- createInterventionCommit(options: {
245
- id: string;
246
- content: string;
247
- createdAt?: Date;
248
- }): AgentTurnCommitBatch;
249
- consumeStepCommit(step: number): AgentTurnCommitBatch | undefined;
250
- createOutputCommit(options: AgentTurnOutputCommitOptions): AgentTurnCommitBatch | undefined;
251
- }
252
- declare function createAgentTurnEngine(options: AgentTurnEngineOptions): AgentTurnEngine;
253
-
254
- interface AgentTurnCommitOptions {
255
- emitMessages?: boolean;
256
- }
257
- type AgentTurnCommitApplier = (batch: AgentTurnCommitBatch, options?: AgentTurnCommitOptions) => AsyncGenerator<AgentEvent>;
258
- interface AgentTurnStepRuntimeConfig {
259
- model: LanguageModel;
260
- cwd: string;
261
- temperature?: number;
262
- topP?: number;
263
- maxOutputTokens?: number;
264
- maxSteps: number;
265
- doomLoopThreshold?: number;
266
- enforceDoomLoop?: boolean;
267
- onDoomLoop?: DoomLoopHandler;
268
- contextWindow?: number;
269
- streamProvider?: StreamProvider;
270
- telemetry?: TelemetrySettings;
271
- }
272
- interface PrepareModelStepOptions {
273
- sessionId: string;
274
- step: number;
275
- systemPrompts: string[];
276
- messages: Message[];
277
- toModelMessages: (messages: Message[]) => ModelMessage[];
278
- abort: AbortSignal;
279
- tools: Record<string, Tool.Info>;
280
- mcpTools?: ToolSet;
281
- config: AgentTurnStepRuntimeConfig;
282
- host?: ToolHost;
283
- turnTracker?: TurnTrackerContext;
284
- intervention?: InterventionController;
285
- middleware?: MiddlewareRunner;
286
- reasoningLevel?: ReasoningLevel;
287
- toolExecutionMode?: ToolExecutionMode;
288
- }
289
- interface PreparedAgentModelStep {
290
- step: number;
291
- messages: Message[];
292
- modelMessages: ModelMessage[];
293
- inferenceInput: InferenceStreamInput;
294
- stepProcessing: {
295
- maxSteps: number;
296
- doomLoopThreshold?: number;
297
- enforceDoomLoop?: boolean;
298
- onDoomLoop?: DoomLoopHandler;
299
- contextTokenLimit?: number;
300
- };
301
- }
302
- interface RunModelStepOptions {
303
- preparedStep: PreparedAgentModelStep;
304
- turnEngine: AgentTurnEngine;
305
- applyCommitBatch: AgentTurnCommitApplier;
306
- rememberedDoomLoopTools?: Set<string>;
307
- }
308
- interface CommitStepOptions {
309
- step: number;
310
- finishReason?: string;
311
- turnEngine: AgentTurnEngine;
312
- applyCommitBatch: AgentTurnCommitApplier;
313
- }
314
- interface CommitOutputOptions {
315
- text: string;
316
- usage?: StepProcessingOutput["usage"];
317
- turnEngine: AgentTurnEngine;
318
- applyCommitBatch: AgentTurnCommitApplier;
319
- }
320
- interface RunToolBatchOptions {
321
- sessionId: string;
322
- snapshot: AgentTurnStepCommitSnapshot;
323
- tools: Record<string, Tool.Info>;
324
- cwd: string;
325
- abort: AbortSignal;
326
- host?: ToolHost;
327
- turnTracker?: TurnTrackerContext;
328
- middleware?: MiddlewareRunner;
329
- turnState?: AgentTurnState;
330
- }
331
- interface RunToolBatchResult {
332
- snapshot: AgentTurnStepCommitSnapshot;
333
- turnState?: AgentTurnState;
334
- events: Array<Extract<AgentEvent, {
335
- type: "tool-result" | "tool-error";
336
- }>>;
337
- }
338
-
339
- export { type AgentTurnActiveToolCall as A, advanceAgentTurnState as B, type CommitOutputOptions as C, type DoomLoopAction as D, createAgentTurnEngine as E, createAgentTurnState as F, failAgentTurnState as G, type PrepareModelStepOptions as P, type RunModelStepOptions as R, type StepProcessingOptions as S, type AgentTurnBoundaryMetadata as a, type AgentTurnBoundarySnapshot as b, type AgentTurnCommitApplier as c, type AgentTurnCommitBatch as d, type AgentTurnCommitOptions as e, AgentTurnEngine as f, type AgentTurnEngineOptions as g, type AgentTurnPhase as h, type AgentTurnResolvedToolCall as i, type AgentTurnState as j, type AgentTurnStateAdvanceOptions as k, type AgentTurnStepCommitSnapshot as l, type AgentTurnStepCommitToolCall as m, type AgentTurnStepCommitToolResult as n, type AgentTurnStepRuntimeConfig as o, type CommitStepOptions as p, type CreateAgentTurnStateOptions as q, type CreateAgentTurnStepCommitBatchOptions as r, type DoomLoopHandler as s, type DoomLoopRequest as t, type PreparedAgentModelStep as u, type ProcessorOptions as v, type ProcessorOutput as w, type RunToolBatchOptions as x, type RunToolBatchResult as y, type StepProcessingOutput as z };
@@ -1,72 +0,0 @@
1
- import { A as AgentEvent } from './events-CE72w8W4.js';
2
-
3
- /**
4
- * Agent Signal — typed event dispatch interface.
5
- *
6
- * Defines how consumers subscribe to {@link AgentEvent}s without being
7
- * part of the middleware stack. Each Agent owns a signal; events are
8
- * scoped to that agent instance.
9
- *
10
- * The default implementation (`LocalSignal`) dispatches in-process via
11
- * plain function calls. A distributed runtime can supply its own
12
- * implementation that bridges to external infrastructure.
13
- */
14
-
15
- /**
16
- * Extract a single variant from the AgentEvent union by its `type` tag.
17
- */
18
- type EventOf<T extends AgentEvent["type"]> = Extract<AgentEvent, {
19
- type: T;
20
- }>;
21
- /** Handler for a specific event type. */
22
- type TypedHandler<T extends AgentEvent["type"]> = (event: EventOf<T>) => void;
23
- /** Handler that receives every event regardless of type. */
24
- type WildcardHandler = (event: AgentEvent) => void;
25
- /** Call to remove a previously registered handler. */
26
- type Unsubscribe = () => void;
27
- /**
28
- * Typed, multi-consumer event dispatch.
29
- *
30
- * Subscribe to agent events from anywhere — SSE routes, TUI renderers,
31
- * plugins, tests. The interface is deliberately minimal so that backend
32
- * implementations (in-process, Dapr, Redis, …) have a small contract to
33
- * fulfil.
34
- *
35
- * @example
36
- * ```ts
37
- * // Subscribe to a specific event
38
- * const off = agent.signal.on("text-delta", (e) => process.stdout.write(e.text));
39
- *
40
- * // Subscribe to everything
41
- * const off2 = agent.signal.onAny((e) => logger.info(e.type));
42
- *
43
- * // Clean up
44
- * off();
45
- * off2();
46
- * ```
47
- */
48
- interface AgentSignal {
49
- /**
50
- * Subscribe to a specific event type.
51
- *
52
- * @returns An unsubscribe function.
53
- */
54
- on<T extends AgentEvent["type"]>(type: T, handler: TypedHandler<T>): Unsubscribe;
55
- /**
56
- * Subscribe to all events.
57
- *
58
- * @returns An unsubscribe function.
59
- */
60
- onAny(handler: WildcardHandler): Unsubscribe;
61
- /**
62
- * Dispatch an event to every matching handler.
63
- *
64
- * Called internally by the Agent — but nothing prevents external code
65
- * from injecting a synthetic event (useful for testing or bridging).
66
- */
67
- emit(event: AgentEvent): void;
68
- /** Remove all handlers. Called during agent disposal. */
69
- clear(): void;
70
- }
71
-
72
- export type { AgentSignal as A, EventOf as E, TypedHandler as T, Unsubscribe as U, WildcardHandler as W };