@rivus/agent 0.16.1 → 0.16.6

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/package.json CHANGED
@@ -1,57 +1,68 @@
1
1
  {
2
2
  "name": "@rivus/agent",
3
- "version": "0.16.1",
3
+ "version": "0.16.6",
4
4
  "description": "A local agent daemon core built around a usable agent harness and domain events.",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
+ "engines": {
8
+ "node": "^24.11.0"
9
+ },
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git+https://github.com/PerfectPan/rivus-agent.git",
13
+ "directory": "packages/agent"
14
+ },
15
+ "homepage": "https://github.com/PerfectPan/rivus-agent#readme",
16
+ "bugs": {
17
+ "url": "https://github.com/PerfectPan/rivus-agent/issues"
18
+ },
7
19
  "keywords": [
8
20
  "agent",
9
21
  "effect",
10
22
  "feishu",
11
23
  "lark",
12
- "multi-agent",
13
- "typescript"
24
+ "pi",
25
+ "acp",
26
+ "mcp",
27
+ "runtime"
14
28
  ],
15
- "main": "./dist/index.js",
16
- "types": "./dist/index.d.ts",
17
29
  "bin": {
18
30
  "rivus": "dist/cli.js"
19
31
  },
20
- "repository": {
21
- "type": "git",
22
- "url": "git+https://github.com/PerfectPan/rivus-agent.git"
23
- },
24
- "homepage": "https://github.com/PerfectPan/rivus-agent#readme",
25
- "bugs": {
26
- "url": "https://github.com/PerfectPan/rivus-agent/issues"
27
- },
28
32
  "exports": {
29
33
  ".": {
30
34
  "types": "./dist/index.d.ts",
31
- "import": "./dist/index.js"
32
- },
33
- "./acp": {
34
- "types": "./dist/acp.d.ts",
35
- "import": "./dist/acp.js"
35
+ "import": "./dist/index.js",
36
+ "default": "./dist/index.js"
36
37
  },
37
38
  "./pi": {
38
39
  "types": "./dist/pi.d.ts",
39
- "import": "./dist/pi.js"
40
+ "import": "./dist/pi.js",
41
+ "default": "./dist/pi.js"
40
42
  },
41
- "./testing": {
42
- "types": "./dist/testing/index.d.ts",
43
- "import": "./dist/testing/index.js"
43
+ "./acp": {
44
+ "types": "./dist/acp.d.ts",
45
+ "import": "./dist/acp.js",
46
+ "default": "./dist/acp.js"
44
47
  },
45
48
  "./mcp": {
46
49
  "types": "./dist/mcp.d.ts",
47
- "import": "./dist/mcp.js"
50
+ "import": "./dist/mcp.js",
51
+ "default": "./dist/mcp.js"
52
+ },
53
+ "./testing": {
54
+ "types": "./dist/testing/index.d.ts",
55
+ "import": "./dist/testing/index.js",
56
+ "default": "./dist/testing/index.js"
48
57
  },
49
58
  "./bootstrap/pi-feishu": {
50
59
  "types": "./dist/bootstrap/pi-feishu.d.ts",
51
- "import": "./dist/bootstrap/pi-feishu.js"
60
+ "import": "./dist/bootstrap/pi-feishu.js",
61
+ "default": "./dist/bootstrap/pi-feishu.js"
52
62
  },
53
63
  "./plugin/starter": "./examples/rivus-starter.plugin.mjs",
54
- "./skills/runtime-management/SKILL.md": "./skills/runtime-management/SKILL.md"
64
+ "./skills/runtime-management/SKILL.md": "./skills/runtime-management/SKILL.md",
65
+ "./package.json": "./package.json"
55
66
  },
56
67
  "files": [
57
68
  "dist",
@@ -62,74 +73,26 @@
62
73
  "LICENSE",
63
74
  "skills/runtime-management/SKILL.md"
64
75
  ],
65
- "publishConfig": {
66
- "access": "public"
67
- },
68
- "scripts": {
69
- "audit": "npm audit --omit=dev --audit-level=high",
70
- "build": "vp pack",
71
- "changeset": "changeset",
72
- "changeset:status": "changeset status",
73
- "e2e:langfuse-drive": "vp pack && node --env-file=.env.local examples/langfuse-drive-e2e.mjs",
74
- "format": "vp fmt",
75
- "format:check": "vp fmt --check",
76
- "lint": "vp lint",
77
- "lint:fix": "vp lint --fix",
78
- "package-api:update": "vp pack && node scripts/package-api-report.mjs --write",
79
- "package:check": "node scripts/check-npm-package.mjs",
80
- "prepublishOnly": "npm run check && npm run audit",
81
- "release:check": "node scripts/check-npm-release.mjs",
82
- "test": "vp test",
83
- "test:feishu:offline": "node scripts/run-feishu-offline-tests.mjs",
84
- "test:coverage": "vp test --coverage",
85
- "test:watch": "vp test watch",
86
- "typecheck": "vp check --no-fmt --no-lint",
87
- "check": "vp check && vp test --coverage && vp run duplicates && vp pack && vp run package:check && ./scripts/check-repository.sh",
88
- "duplicates": "jscpd src examples --min-lines 6 --min-tokens 40 --threshold 0 --reporters console --ignore '**/*.test.ts,**/*.test.mjs' --format 'typescript,javascript,json'",
89
- "version-packages": "changeset version && npm install --package-lock-only --ignore-scripts",
90
- "version-packages:ci": "npm run version-packages && npm run check && npm run audit"
91
- },
92
76
  "dependencies": {
93
- "@earendil-works/pi-coding-agent": "0.84.4",
94
- "@larksuiteoapi/node-sdk": "1.71.1",
95
- "@opentelemetry/api": "^1.9.1",
96
- "@opentelemetry/exporter-trace-otlp-proto": "^0.222.0",
97
- "@opentelemetry/resources": "^2.11.0",
98
- "@opentelemetry/sdk-trace-base": "^2.11.0",
99
- "@opentelemetry/sdk-trace-node": "^2.11.0",
100
- "axios": "1.18.0",
101
77
  "effect": "^3.21.4",
102
- "typebox": "^1.1.38"
103
- },
104
- "peerDependencies": {
105
- "@agentclientprotocol/sdk": "^1.3.0"
78
+ "@rivus/platform": "0.16.6",
79
+ "@rivus/runtime": "0.16.6",
80
+ "@rivus/gateway": "0.16.6"
106
81
  },
107
- "peerDependenciesMeta": {
108
- "@agentclientprotocol/sdk": {
109
- "optional": true
110
- }
82
+ "publishConfig": {
83
+ "access": "public"
111
84
  },
112
85
  "devDependencies": {
113
- "@agentclientprotocol/sdk": "^1.3.0",
114
- "@changesets/cli": "^2.31.1",
86
+ "vite-plus": "0.2.4",
87
+ "vite": "npm:@voidzero-dev/vite-plus-core@0.2.4",
88
+ "typescript": "6.0.3",
115
89
  "@types/node": "24.13.3",
116
90
  "@vitest/coverage-v8": "4.1.10",
117
- "jscpd": "4.3.0",
118
- "typescript": "6.0.3",
119
- "vite": "npm:@voidzero-dev/vite-plus-core@0.2.4",
120
- "vite-plus": "0.2.4"
91
+ "@larksuiteoapi/node-sdk": "1.71.1"
121
92
  },
122
- "engines": {
123
- "node": "^24.11.0"
124
- },
125
- "overrides": {
126
- "vite": "npm:@voidzero-dev/vite-plus-core@0.2.4"
127
- },
128
- "devEngines": {
129
- "packageManager": {
130
- "name": "npm",
131
- "version": "11.16.0",
132
- "onFail": "download"
133
- }
93
+ "scripts": {
94
+ "build": "node ../../scripts/sync-agent-assets.mjs && vp pack",
95
+ "typecheck": "tsc -p tsconfig.json --noEmit",
96
+ "test": "vp test --run"
134
97
  }
135
- }
98
+ }
@@ -1,446 +0,0 @@
1
- import { Effect, Stream } from "effect";
2
-
3
- //#region src/core/application/agent-execution/invocation/agent-invocation.d.ts
4
- interface AgentMemoryInvocationIdentity {
5
- readonly audience: "group" | "private";
6
- readonly conversationId?: string;
7
- readonly projectId?: string;
8
- readonly subjectId: string;
9
- readonly tenantId: string;
10
- }
11
- interface FeishuAgentInvocationOrigin {
12
- readonly allowedActorOpenIds: ReadonlyArray<string>;
13
- readonly endpointId: string;
14
- readonly kind: "feishu";
15
- readonly memory?: AgentMemoryInvocationIdentity;
16
- readonly sourceMessageId: string;
17
- readonly tenantKey: string;
18
- }
19
- interface LocalCliAgentInvocationOrigin {
20
- readonly allowedActorOpenIds: readonly [];
21
- readonly endpointId: string;
22
- readonly kind: "local-cli";
23
- readonly memory?: AgentMemoryInvocationIdentity;
24
- readonly sourceMessageId: string;
25
- readonly tenantKey: "local";
26
- }
27
- interface AutomationAgentInvocationOrigin {
28
- readonly allowedActorOpenIds: readonly [];
29
- readonly automationId: string;
30
- readonly endpointId: string;
31
- readonly kind: "automation";
32
- readonly memory?: AgentMemoryInvocationIdentity;
33
- readonly sourceMessageId: string;
34
- readonly tenantKey: "automation";
35
- readonly tickId: string;
36
- }
37
- interface BackgroundSessionAgentInvocationOrigin {
38
- readonly allowedActorOpenIds: ReadonlyArray<string>;
39
- readonly conversationId?: string;
40
- readonly endpointId: string;
41
- readonly kind: "background-session";
42
- readonly memory?: AgentMemoryInvocationIdentity;
43
- readonly sessionId: string;
44
- readonly sourceMessageId: string;
45
- readonly tenantKey: string;
46
- }
47
- type AgentInvocationOrigin = FeishuAgentInvocationOrigin | LocalCliAgentInvocationOrigin | AutomationAgentInvocationOrigin | BackgroundSessionAgentInvocationOrigin;
48
- //#endregion
49
- //#region src/core/application/agent-execution/contracts/agent-domain-events.d.ts
50
- type AgentRunId = string;
51
- type SessionKey = string;
52
- interface AgentRunAccepted {
53
- readonly type: "agent_run_accepted";
54
- readonly runId: AgentRunId;
55
- readonly sessionKey: SessionKey;
56
- readonly prompt: string;
57
- readonly occurredAt: Date;
58
- }
59
- interface AgentTurnStarted {
60
- readonly type: "agent_turn_started";
61
- readonly runId: AgentRunId;
62
- readonly sessionKey: SessionKey;
63
- readonly occurredAt: Date;
64
- }
65
- interface AssistantTextDelta {
66
- readonly type: "assistant_text_delta";
67
- readonly runId: AgentRunId;
68
- readonly delta: string;
69
- readonly occurredAt: Date;
70
- }
71
- interface AssistantThinkingDelta {
72
- readonly type: "assistant_thinking_delta";
73
- readonly runId: AgentRunId;
74
- readonly delta: string;
75
- readonly occurredAt: Date;
76
- }
77
- interface AgentModelExecutionStarted {
78
- readonly type: "agent_model_execution_started";
79
- readonly api: string;
80
- readonly model: string;
81
- readonly modelCallId: string;
82
- readonly occurredAt: Date;
83
- readonly provider: string;
84
- readonly runId: AgentRunId;
85
- }
86
- interface AgentModelUsage {
87
- readonly cacheRead: number;
88
- readonly cacheWrite: number;
89
- readonly cost: number;
90
- readonly input: number;
91
- readonly output: number;
92
- readonly reasoning?: number;
93
- readonly total: number;
94
- }
95
- interface AgentModelExecutionEnded {
96
- readonly type: "agent_model_execution_ended";
97
- readonly api: string;
98
- readonly errorMessage?: string;
99
- readonly model: string;
100
- readonly modelCallId: string;
101
- readonly occurredAt: Date;
102
- readonly provider: string;
103
- readonly responseModel?: string;
104
- readonly runId: AgentRunId;
105
- readonly stopReason: string;
106
- readonly usage: AgentModelUsage;
107
- }
108
- interface AgentSkillExecutionStarted {
109
- readonly type: "agent_skill_execution_started";
110
- readonly occurredAt: Date;
111
- readonly runId: AgentRunId;
112
- readonly skillCallId: string;
113
- readonly skillId: string;
114
- }
115
- interface AgentSkillExecutionSucceeded {
116
- readonly type: "agent_skill_execution_ended";
117
- readonly contentLength: number;
118
- readonly digest: string;
119
- readonly isError: false;
120
- readonly occurredAt: Date;
121
- readonly runId: AgentRunId;
122
- readonly skillCallId: string;
123
- readonly skillId: string;
124
- readonly title: string;
125
- readonly version: string;
126
- }
127
- interface AgentSkillExecutionFailed {
128
- readonly type: "agent_skill_execution_ended";
129
- readonly isError: true;
130
- readonly occurredAt: Date;
131
- readonly runId: AgentRunId;
132
- readonly skillCallId: string;
133
- readonly skillId: string;
134
- }
135
- type AgentSkillExecutionEnded = AgentSkillExecutionSucceeded | AgentSkillExecutionFailed;
136
- interface AgentToolExecutionStarted {
137
- readonly type: "agent_tool_execution_started";
138
- readonly runId: AgentRunId;
139
- readonly toolCallId: string;
140
- readonly toolName: string;
141
- readonly input: unknown;
142
- readonly occurredAt: Date;
143
- }
144
- interface AgentToolExecutionUpdated {
145
- readonly type: "agent_tool_execution_updated";
146
- readonly runId: AgentRunId;
147
- readonly toolCallId: string;
148
- readonly toolName: string;
149
- readonly input: unknown;
150
- readonly partialResult: unknown;
151
- readonly occurredAt: Date;
152
- }
153
- interface AgentToolExecutionEnded {
154
- readonly type: "agent_tool_execution_ended";
155
- readonly runId: AgentRunId;
156
- readonly toolCallId: string;
157
- readonly toolName: string;
158
- readonly result: unknown;
159
- readonly isError: boolean;
160
- readonly occurredAt: Date;
161
- }
162
- interface AgentTurnCompleted {
163
- readonly type: "agent_turn_completed";
164
- readonly runId: AgentRunId;
165
- readonly finalText: string;
166
- readonly occurredAt: Date;
167
- }
168
- interface AgentRunCompleted {
169
- readonly type: "agent_run_completed";
170
- readonly runId: AgentRunId;
171
- readonly finalText: string;
172
- readonly occurredAt: Date;
173
- }
174
- interface AgentRunFailed {
175
- readonly type: "agent_run_failed";
176
- readonly runId: AgentRunId;
177
- readonly errorMessage: string;
178
- readonly occurredAt: Date;
179
- }
180
- interface AgentRunCancelled {
181
- readonly type: "agent_run_cancelled";
182
- readonly runId: AgentRunId;
183
- readonly reason?: string;
184
- readonly occurredAt: Date;
185
- }
186
- type AgentDomainEvent = AgentRunAccepted | AgentTurnStarted | AssistantTextDelta | AssistantThinkingDelta | AgentModelExecutionStarted | AgentModelExecutionEnded | AgentSkillExecutionStarted | AgentSkillExecutionEnded | AgentToolExecutionStarted | AgentToolExecutionUpdated | AgentToolExecutionEnded | AgentTurnCompleted | AgentRunCompleted | AgentRunFailed | AgentRunCancelled;
187
- type AgentToolExecutionEvent = AgentToolExecutionStarted | AgentToolExecutionUpdated | AgentToolExecutionEnded;
188
- type AgentModelExecutionEvent = AgentModelExecutionStarted | AgentModelExecutionEnded;
189
- type TerminalAgentDomainEvent = AgentRunCompleted | AgentRunFailed | AgentRunCancelled;
190
- declare function isAssistantTextDeltaEvent(event: AgentDomainEvent): event is AssistantTextDelta;
191
- declare function isAssistantThinkingDeltaEvent(event: AgentDomainEvent): event is AssistantThinkingDelta;
192
- declare function isAgentToolExecutionEvent(event: AgentDomainEvent): event is AgentToolExecutionEvent;
193
- declare function isTerminalAgentDomainEvent(event: AgentDomainEvent): event is TerminalAgentDomainEvent;
194
- //#endregion
195
- //#region src/core/application/agent-execution/contracts/agent-run-state.d.ts
196
- type AgentRunPhase = "idle" | "accepted" | "running" | "completed" | "failed" | "cancelled";
197
- interface AgentRunState {
198
- readonly phase: AgentRunPhase;
199
- readonly runId?: AgentRunId;
200
- readonly sessionKey?: SessionKey;
201
- readonly prompt?: string;
202
- readonly finalText: string;
203
- readonly errorMessage?: string;
204
- readonly cancellationReason?: string;
205
- readonly thinkingText?: string;
206
- readonly skillExecutions: Readonly<Record<string, AgentSkillExecutionState>>;
207
- readonly toolExecutions: Readonly<Record<string, AgentToolExecutionState>>;
208
- }
209
- interface AgentSkillExecutionState {
210
- readonly contentLength?: number;
211
- readonly digest?: string;
212
- readonly isError?: boolean;
213
- readonly skillCallId: string;
214
- readonly skillId: string;
215
- readonly status: "running" | "completed";
216
- readonly title?: string;
217
- readonly version?: string;
218
- }
219
- interface AgentToolExecutionState {
220
- readonly toolCallId: string;
221
- readonly toolName: string;
222
- readonly input: unknown;
223
- readonly partialResult?: unknown;
224
- readonly result?: unknown;
225
- readonly isError?: boolean;
226
- readonly status: "running" | "completed";
227
- }
228
- //#endregion
229
- //#region src/core/application/agent-execution/history/agent-history.d.ts
230
- interface AgentRunSummary {
231
- readonly acceptedAt?: Date;
232
- readonly cancellationReason?: string;
233
- readonly cancelledAt?: Date;
234
- readonly completedAt?: Date;
235
- readonly errorMessage?: string;
236
- readonly eventCount: number;
237
- readonly failedToolExecutionCount: number;
238
- readonly failedSkillExecutionCount: number;
239
- readonly failedAt?: Date;
240
- readonly finalText: string;
241
- readonly phase: AgentRunPhase;
242
- readonly prompt?: string;
243
- readonly runId: AgentRunId;
244
- readonly sessionKey?: SessionKey;
245
- readonly startedAt?: Date;
246
- readonly state: AgentRunState;
247
- readonly thinkingText: string;
248
- readonly skillExecutionCount: number;
249
- readonly toolExecutionCount: number;
250
- readonly updatedAt: Date;
251
- }
252
- interface AgentSessionSummary {
253
- readonly failedToolExecutionCount: number;
254
- readonly failedSkillExecutionCount: number;
255
- readonly finalText: string;
256
- readonly latestPhase: AgentRunPhase;
257
- readonly latestRunId: AgentRunId;
258
- readonly runCount: number;
259
- readonly runIds: ReadonlyArray<AgentRunId>;
260
- readonly sessionKey: SessionKey;
261
- readonly thinkingText: string;
262
- readonly skillExecutionCount: number;
263
- readonly toolExecutionCount: number;
264
- readonly updatedAt: Date;
265
- }
266
- interface AgentHistory {
267
- readonly runs: ReadonlyArray<AgentRunSummary>;
268
- readonly sessions: ReadonlyArray<AgentSessionSummary>;
269
- readonly totalEvents: number;
270
- }
271
- declare function replayAgentHistory(events: ReadonlyArray<AgentDomainEvent>): AgentHistory;
272
- //#endregion
273
- //#region src/core/application/agent-execution/transcript/agent-transcript.d.ts
274
- interface AgentTranscript {
275
- readonly latestTurn?: AgentTranscriptTurn;
276
- readonly sessionKey: SessionKey;
277
- readonly turnCount: number;
278
- readonly turns: ReadonlyArray<AgentTranscriptTurn>;
279
- }
280
- interface AgentTranscriptTurn {
281
- readonly acceptedAt?: Date;
282
- readonly assistantText: string;
283
- readonly cancellationReason?: string;
284
- readonly cancelledAt?: Date;
285
- readonly completedAt?: Date;
286
- readonly errorMessage?: string;
287
- readonly failedAt?: Date;
288
- readonly failedToolExecutionCount: number;
289
- readonly phase: AgentRunPhase;
290
- readonly runId: AgentRunId;
291
- readonly sessionKey: SessionKey;
292
- readonly thinkingText: string;
293
- readonly toolExecutionCount: number;
294
- readonly updatedAt: Date;
295
- readonly userText: string;
296
- }
297
- type AgentTranscriptMessageRole = "assistant" | "user";
298
- interface AgentTranscriptMessage {
299
- readonly content: string;
300
- readonly role: AgentTranscriptMessageRole;
301
- }
302
- interface AgentConversationMessagesOptions {
303
- readonly text: string;
304
- readonly transcript?: AgentTranscript;
305
- }
306
- declare function replayAgentTranscript(events: ReadonlyArray<AgentDomainEvent>, sessionKey: SessionKey): AgentTranscript;
307
- declare function createAgentTranscriptTurn(summary: AgentRunSummary & {
308
- readonly sessionKey: SessionKey;
309
- }): AgentTranscriptTurn;
310
- declare function createAgentTranscriptMessages(transcript: AgentTranscript): ReadonlyArray<AgentTranscriptMessage>;
311
- declare function createAgentConversationMessages(options: AgentConversationMessagesOptions): ReadonlyArray<AgentTranscriptMessage>;
312
- //#endregion
313
- //#region src/core/application/agent-execution/loop/agent-loop.d.ts
314
- type AgentLoopEvent = AgentLoopTurnStart | AgentLoopTextDelta | AgentLoopThinkingDelta | AgentLoopModelExecutionStart | AgentLoopModelExecutionEnd | AgentLoopSkillExecutionStart | AgentLoopSkillExecutionEnd | AgentLoopToolExecutionStart | AgentLoopToolExecutionUpdate | AgentLoopToolExecutionEnd;
315
- type AgentLoopEventLike = AgentLoopEvent | string;
316
- interface AgentLoopTextDelta {
317
- readonly type: "assistant_text_delta";
318
- readonly delta: string;
319
- }
320
- interface AgentLoopTurnStart {
321
- readonly type: "turn_start";
322
- }
323
- interface AgentLoopThinkingDelta {
324
- readonly type: "assistant_thinking_delta";
325
- readonly delta: string;
326
- }
327
- interface AgentLoopModelExecutionStart {
328
- readonly type: "model_execution_start";
329
- readonly api: string;
330
- readonly model: string;
331
- readonly modelCallId: string;
332
- readonly provider: string;
333
- }
334
- interface AgentLoopModelExecutionEnd {
335
- readonly type: "model_execution_end";
336
- readonly api: string;
337
- readonly errorMessage?: string;
338
- readonly model: string;
339
- readonly modelCallId: string;
340
- readonly provider: string;
341
- readonly responseModel?: string;
342
- readonly stopReason: string;
343
- readonly usage: AgentModelUsage;
344
- }
345
- interface AgentLoopSkillExecutionStart {
346
- readonly type: "skill_execution_start";
347
- readonly skillCallId: string;
348
- readonly skillId: string;
349
- }
350
- interface AgentLoopSkillExecutionSucceeded {
351
- readonly type: "skill_execution_end";
352
- readonly contentLength: number;
353
- readonly digest: string;
354
- readonly isError: false;
355
- readonly skillCallId: string;
356
- readonly skillId: string;
357
- readonly title: string;
358
- readonly version: string;
359
- }
360
- interface AgentLoopSkillExecutionFailed {
361
- readonly type: "skill_execution_end";
362
- readonly isError: true;
363
- readonly skillCallId: string;
364
- readonly skillId: string;
365
- }
366
- type AgentLoopSkillExecutionEnd = AgentLoopSkillExecutionSucceeded | AgentLoopSkillExecutionFailed;
367
- interface AgentLoopToolExecutionStart {
368
- readonly type: "tool_execution_start";
369
- readonly toolCallId: string;
370
- readonly toolName: string;
371
- readonly input: unknown;
372
- }
373
- interface AgentLoopToolExecutionUpdate {
374
- readonly type: "tool_execution_update";
375
- readonly toolCallId: string;
376
- readonly toolName: string;
377
- readonly input: unknown;
378
- readonly partialResult: unknown;
379
- }
380
- interface AgentLoopToolExecutionEnd {
381
- readonly type: "tool_execution_end";
382
- readonly toolCallId: string;
383
- readonly toolName: string;
384
- readonly result: unknown;
385
- readonly isError: boolean;
386
- }
387
- type AgentLoopToolExecutionStartOptions = Omit<AgentLoopToolExecutionStart, "type">;
388
- type AgentLoopToolExecutionUpdateOptions = Omit<AgentLoopToolExecutionUpdate, "type">;
389
- type AgentLoopToolExecutionEndOptions = Omit<AgentLoopToolExecutionEnd, "type">;
390
- type AgentLoopModelExecutionStartOptions = Omit<AgentLoopModelExecutionStart, "type">;
391
- type AgentLoopModelExecutionEndOptions = Omit<AgentLoopModelExecutionEnd, "type">;
392
- type AgentLoopSkillExecutionStartOptions = Omit<AgentLoopSkillExecutionStart, "type">;
393
- type AgentLoopSkillExecutionEndOptions = Omit<AgentLoopSkillExecutionSucceeded, "type"> | Omit<AgentLoopSkillExecutionFailed, "type">;
394
- declare function createAgentLoopTextDelta(delta: string): AgentLoopTextDelta;
395
- declare function createAgentLoopTurnStart(): AgentLoopTurnStart;
396
- declare function createAgentLoopThinkingDelta(delta: string): AgentLoopThinkingDelta;
397
- declare function createAgentLoopModelExecutionStart(options: AgentLoopModelExecutionStartOptions): AgentLoopModelExecutionStart;
398
- declare function createAgentLoopModelExecutionEnd(options: AgentLoopModelExecutionEndOptions): AgentLoopModelExecutionEnd;
399
- declare function createAgentLoopSkillExecutionStart(options: AgentLoopSkillExecutionStartOptions): AgentLoopSkillExecutionStart;
400
- declare function createAgentLoopSkillExecutionEnd(options: AgentLoopSkillExecutionEndOptions): AgentLoopSkillExecutionEnd;
401
- declare function createAgentLoopToolExecutionStart(options: AgentLoopToolExecutionStartOptions): AgentLoopToolExecutionStart;
402
- declare function createAgentLoopToolExecutionUpdate(options: AgentLoopToolExecutionUpdateOptions): AgentLoopToolExecutionUpdate;
403
- declare function createAgentLoopToolExecutionEnd(options: AgentLoopToolExecutionEndOptions): AgentLoopToolExecutionEnd;
404
- //#endregion
405
- //#region src/adapters/compatibility/agent-execution/loop/agent-loop.d.ts
406
- interface AgentLoopInput {
407
- readonly runId: AgentRunId;
408
- readonly sessionKey: SessionKey;
409
- readonly text: string;
410
- readonly abortSignal: AbortSignal;
411
- readonly previousSessionState?: AgentRunState;
412
- readonly previousSessionTranscript?: AgentTranscript;
413
- readonly messages?: ReadonlyArray<AgentTranscriptMessage>;
414
- readonly invocation?: AgentInvocationOrigin;
415
- /** Optional mailbox for user steering while the run is active. */
416
- readonly steering?: AgentSteeringChannel;
417
- }
418
- interface AgentSteeringChannel {
419
- next(signal?: AbortSignal): Promise<string>;
420
- close?(): Promise<readonly string[]>;
421
- }
422
- interface AgentLoop {
423
- run(input: AgentLoopInput): Stream.Stream<AgentLoopEvent, unknown>;
424
- /** Provider adapters opt in only when they can consume steering safely. */
425
- readonly supportsSteering?: boolean;
426
- }
427
- type AgentLoopCallbackOutput = Iterable<AgentLoopEventLike> | AsyncIterable<AgentLoopEventLike> | Stream.Stream<AgentLoopEventLike, unknown>;
428
- type AgentLoopCallbackResult = AgentLoopCallbackOutput | PromiseLike<AgentLoopCallbackOutput> | Effect.Effect<AgentLoopCallbackOutput, unknown>;
429
- type AgentLoopCallback = (input: AgentLoopInput) => AgentLoopCallbackResult;
430
- interface AsyncIterableAgentLoopOptions {
431
- readonly run: (input: AgentLoopInput) => AsyncIterable<AgentLoopEventLike>;
432
- }
433
- interface EventAgentLoopOptions {
434
- readonly events: ReadonlyArray<AgentLoopEventLike> | ((input: AgentLoopInput) => ReadonlyArray<AgentLoopEventLike> | Promise<ReadonlyArray<AgentLoopEventLike>>);
435
- }
436
- type TextAgentLoopCallback = (input: AgentLoopInput) => string | Promise<string>;
437
- interface TextAgentLoopOptions {
438
- readonly generate: (input: AgentLoopInput) => Effect.Effect<string, unknown>;
439
- }
440
- declare function createEventAgentLoop(options: EventAgentLoopOptions): AgentLoop;
441
- declare function createAsyncIterableAgentLoop(options: AsyncIterableAgentLoopOptions): AgentLoop;
442
- declare function createAgentLoopFromCallback(run: AgentLoopCallback): AgentLoop;
443
- declare function createTextAgentLoop(options: TextAgentLoopOptions): AgentLoop;
444
- declare function createTextAgentLoopFromCallback(generate: TextAgentLoopCallback): AgentLoop;
445
- //#endregion
446
- export { replayAgentTranscript as $, AgentLoopToolExecutionStart as A, isAssistantThinkingDeltaEvent as At, createAgentLoopThinkingDelta as B, AgentLoopSkillExecutionEndOptions as C, AgentTurnStarted as Ct, AgentLoopThinkingDelta as D, TerminalAgentDomainEvent as Dt, AgentLoopTextDelta as E, SessionKey as Et, createAgentLoopModelExecutionEnd as F, LocalCliAgentInvocationOrigin as Ft, AgentConversationMessagesOptions as G, createAgentLoopToolExecutionStart as H, createAgentLoopModelExecutionStart as I, AgentTranscriptMessageRole as J, AgentTranscript as K, createAgentLoopSkillExecutionEnd as L, AgentLoopToolExecutionUpdate as M, AgentInvocationOrigin as Mt, AgentLoopToolExecutionUpdateOptions as N, AutomationAgentInvocationOrigin as Nt, AgentLoopToolExecutionEnd as O, isAgentToolExecutionEvent as Ot, AgentLoopTurnStart as P, FeishuAgentInvocationOrigin as Pt, createAgentTranscriptTurn as Q, createAgentLoopSkillExecutionStart as R, AgentLoopSkillExecutionEnd as S, AgentTurnCompleted as St, AgentLoopSkillExecutionStartOptions as T, AssistantThinkingDelta as Tt, createAgentLoopToolExecutionUpdate as U, createAgentLoopToolExecutionEnd as V, createAgentLoopTurnStart as W, createAgentConversationMessages as X, AgentTranscriptTurn as Y, createAgentTranscriptMessages as Z, AgentLoopEventLike as _, AgentSkillExecutionStarted as _t, AgentLoopInput as a, AgentRunState as at, AgentLoopModelExecutionStart as b, AgentToolExecutionStarted as bt, EventAgentLoopOptions as c, AgentModelExecutionEnded as ct, createAgentLoopFromCallback as d, AgentModelUsage as dt, AgentHistory as et, createAsyncIterableAgentLoop as f, AgentRunAccepted as ft, AgentLoopEvent as g, AgentSkillExecutionEnded as gt, createTextAgentLoopFromCallback as h, AgentRunId as ht, AgentLoopCallbackResult as i, AgentRunPhase as it, AgentLoopToolExecutionStartOptions as j, isTerminalAgentDomainEvent as jt, AgentLoopToolExecutionEndOptions as k, isAssistantTextDeltaEvent as kt, TextAgentLoopCallback as l, AgentModelExecutionEvent as lt, createTextAgentLoop as m, AgentRunFailed as mt, AgentLoopCallback as n, AgentSessionSummary as nt, AgentSteeringChannel as o, AgentSkillExecutionState as ot, createEventAgentLoop as p, AgentRunCompleted as pt, AgentTranscriptMessage as q, AgentLoopCallbackOutput as r, replayAgentHistory as rt, AsyncIterableAgentLoopOptions as s, AgentDomainEvent as st, AgentLoop as t, AgentRunSummary as tt, TextAgentLoopOptions as u, AgentModelExecutionStarted as ut, AgentLoopModelExecutionEnd as v, AgentToolExecutionEnded as vt, AgentLoopSkillExecutionStart as w, AssistantTextDelta as wt, AgentLoopModelExecutionStartOptions as x, AgentToolExecutionUpdated as xt, AgentLoopModelExecutionEndOptions as y, AgentToolExecutionEvent as yt, createAgentLoopTextDelta as z };