@rivus/agent 0.14.3 → 0.15.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/README.md +1 -1
- package/dist/acp.js +1 -2
- package/dist/bootstrap/pi-feishu.d.ts +2 -2
- package/dist/bootstrap/pi-feishu.js +4119 -389
- package/dist/chunks/agent-loop.d.ts +55 -300
- package/dist/chunks/agent-loop.js +3 -1123
- package/dist/chunks/background-session-authority.js +230 -0
- package/dist/chunks/background-session-control-input.js +51 -0
- package/dist/chunks/background-session-service.d.ts +382 -0
- package/dist/chunks/index.d.ts +1294 -515
- package/dist/chunks/pi-tool-proxy.d.ts +22 -90
- package/dist/chunks/pi.js +60 -20
- package/dist/chunks/rivus-agent-definition-resolver.js +508 -0
- package/dist/chunks/rivus-daemon-cli.js +3004 -3164
- package/dist/chunks/rivus-model-management-wire.js +344 -0
- package/dist/chunks/rivus-plugin-testkit.d.ts +175 -2
- package/dist/chunks/rivus-plugin-testkit.js +11 -4
- package/dist/chunks/rivus-skill.d.ts +95 -0
- package/dist/chunks/rivus-tool.js +158 -0
- package/dist/chunks/sha256-digest.js +2 -7
- package/dist/chunks/src.js +13402 -8264
- package/dist/cli.js +901 -698
- package/dist/index.d.ts +7 -8
- package/dist/index.js +8 -9
- package/dist/mcp.d.ts +46 -7
- package/dist/mcp.js +145 -19
- package/dist/pi.d.ts +5 -4
- package/dist/pi.js +1 -1
- package/examples/pi-feishu-deployment.bootstrap.ts +557 -462
- package/package.json +9 -7
- package/skills/runtime-management/SKILL.md +61 -0
- package/dist/chunks/api.d.ts +0 -70
- package/dist/chunks/api.js +0 -471
- package/dist/chunks/api2.d.ts +0 -387
- package/dist/chunks/api2.js +0 -1331
- package/dist/chunks/api3.d.ts +0 -402
- package/dist/chunks/module.js +0 -267
- package/dist/chunks/pi-skill-tool.js +0 -460
- package/dist/chunks/spi.d.ts +0 -1
- package/dist/chunks/spi.js +0 -2
|
@@ -1,7 +1,52 @@
|
|
|
1
|
-
import { s as AgentMemoryIdentity } from "./api.js";
|
|
2
1
|
import { Effect, Stream } from "effect";
|
|
3
2
|
|
|
4
|
-
//#region src/
|
|
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
|
|
5
50
|
type AgentRunId = string;
|
|
6
51
|
type SessionKey = string;
|
|
7
52
|
interface AgentRunAccepted {
|
|
@@ -132,22 +177,22 @@ interface AgentRunFailed {
|
|
|
132
177
|
readonly errorMessage: string;
|
|
133
178
|
readonly occurredAt: Date;
|
|
134
179
|
}
|
|
135
|
-
interface AgentRunCancelled
|
|
180
|
+
interface AgentRunCancelled {
|
|
136
181
|
readonly type: "agent_run_cancelled";
|
|
137
182
|
readonly runId: AgentRunId;
|
|
138
183
|
readonly reason?: string;
|
|
139
184
|
readonly occurredAt: Date;
|
|
140
185
|
}
|
|
141
|
-
type AgentDomainEvent = AgentRunAccepted | AgentTurnStarted | AssistantTextDelta | AssistantThinkingDelta | AgentModelExecutionStarted | AgentModelExecutionEnded | AgentSkillExecutionStarted | AgentSkillExecutionEnded | AgentToolExecutionStarted | AgentToolExecutionUpdated | AgentToolExecutionEnded | AgentTurnCompleted | AgentRunCompleted | AgentRunFailed | AgentRunCancelled
|
|
186
|
+
type AgentDomainEvent = AgentRunAccepted | AgentTurnStarted | AssistantTextDelta | AssistantThinkingDelta | AgentModelExecutionStarted | AgentModelExecutionEnded | AgentSkillExecutionStarted | AgentSkillExecutionEnded | AgentToolExecutionStarted | AgentToolExecutionUpdated | AgentToolExecutionEnded | AgentTurnCompleted | AgentRunCompleted | AgentRunFailed | AgentRunCancelled;
|
|
142
187
|
type AgentToolExecutionEvent = AgentToolExecutionStarted | AgentToolExecutionUpdated | AgentToolExecutionEnded;
|
|
143
188
|
type AgentModelExecutionEvent = AgentModelExecutionStarted | AgentModelExecutionEnded;
|
|
144
|
-
type TerminalAgentDomainEvent = AgentRunCompleted | AgentRunFailed | AgentRunCancelled
|
|
189
|
+
type TerminalAgentDomainEvent = AgentRunCompleted | AgentRunFailed | AgentRunCancelled;
|
|
145
190
|
declare function isAssistantTextDeltaEvent(event: AgentDomainEvent): event is AssistantTextDelta;
|
|
146
191
|
declare function isAssistantThinkingDeltaEvent(event: AgentDomainEvent): event is AssistantThinkingDelta;
|
|
147
192
|
declare function isAgentToolExecutionEvent(event: AgentDomainEvent): event is AgentToolExecutionEvent;
|
|
148
193
|
declare function isTerminalAgentDomainEvent(event: AgentDomainEvent): event is TerminalAgentDomainEvent;
|
|
149
194
|
//#endregion
|
|
150
|
-
//#region src/
|
|
195
|
+
//#region src/core/application/agent-execution/contracts/agent-run-state.d.ts
|
|
151
196
|
type AgentRunPhase = "idle" | "accepted" | "running" | "completed" | "failed" | "cancelled";
|
|
152
197
|
interface AgentRunState {
|
|
153
198
|
readonly phase: AgentRunPhase;
|
|
@@ -180,11 +225,8 @@ interface AgentToolExecutionState {
|
|
|
180
225
|
readonly isError?: boolean;
|
|
181
226
|
readonly status: "running" | "completed";
|
|
182
227
|
}
|
|
183
|
-
declare const initialAgentRunState: AgentRunState;
|
|
184
|
-
declare function isTerminalAgentRunPhase(phase: AgentRunPhase): boolean;
|
|
185
|
-
declare function evolveAgentRun(state: AgentRunState, event: AgentDomainEvent): AgentRunState;
|
|
186
228
|
//#endregion
|
|
187
|
-
//#region src/
|
|
229
|
+
//#region src/core/application/agent-execution/history/agent-history.d.ts
|
|
188
230
|
interface AgentRunSummary {
|
|
189
231
|
readonly acceptedAt?: Date;
|
|
190
232
|
readonly cancellationReason?: string;
|
|
@@ -228,7 +270,7 @@ interface AgentHistory {
|
|
|
228
270
|
}
|
|
229
271
|
declare function replayAgentHistory(events: ReadonlyArray<AgentDomainEvent>): AgentHistory;
|
|
230
272
|
//#endregion
|
|
231
|
-
//#region src/
|
|
273
|
+
//#region src/core/application/agent-execution/transcript/agent-transcript.d.ts
|
|
232
274
|
interface AgentTranscript {
|
|
233
275
|
readonly latestTurn?: AgentTranscriptTurn;
|
|
234
276
|
readonly sessionKey: SessionKey;
|
|
@@ -268,47 +310,7 @@ declare function createAgentTranscriptTurn(summary: AgentRunSummary & {
|
|
|
268
310
|
declare function createAgentTranscriptMessages(transcript: AgentTranscript): ReadonlyArray<AgentTranscriptMessage>;
|
|
269
311
|
declare function createAgentConversationMessages(options: AgentConversationMessagesOptions): ReadonlyArray<AgentTranscriptMessage>;
|
|
270
312
|
//#endregion
|
|
271
|
-
//#region src/
|
|
272
|
-
type AgentMemoryInvocationIdentity = AgentMemoryIdentity;
|
|
273
|
-
interface FeishuAgentInvocationOrigin {
|
|
274
|
-
readonly allowedActorOpenIds: ReadonlyArray<string>;
|
|
275
|
-
readonly endpointId: string;
|
|
276
|
-
readonly kind: "feishu";
|
|
277
|
-
readonly memory?: AgentMemoryInvocationIdentity;
|
|
278
|
-
readonly sourceMessageId: string;
|
|
279
|
-
readonly tenantKey: string;
|
|
280
|
-
}
|
|
281
|
-
interface LocalCliAgentInvocationOrigin {
|
|
282
|
-
readonly allowedActorOpenIds: readonly [];
|
|
283
|
-
readonly endpointId: string;
|
|
284
|
-
readonly kind: "local-cli";
|
|
285
|
-
readonly memory?: AgentMemoryInvocationIdentity;
|
|
286
|
-
readonly sourceMessageId: string;
|
|
287
|
-
readonly tenantKey: "local";
|
|
288
|
-
}
|
|
289
|
-
interface AutomationAgentInvocationOrigin {
|
|
290
|
-
readonly allowedActorOpenIds: readonly [];
|
|
291
|
-
readonly automationId: string;
|
|
292
|
-
readonly endpointId: string;
|
|
293
|
-
readonly kind: "automation";
|
|
294
|
-
readonly memory?: AgentMemoryInvocationIdentity;
|
|
295
|
-
readonly sourceMessageId: string;
|
|
296
|
-
readonly tenantKey: "automation";
|
|
297
|
-
readonly tickId: string;
|
|
298
|
-
}
|
|
299
|
-
interface BackgroundSessionAgentInvocationOrigin {
|
|
300
|
-
readonly allowedActorOpenIds: ReadonlyArray<string>;
|
|
301
|
-
readonly conversationId?: string;
|
|
302
|
-
readonly endpointId: string;
|
|
303
|
-
readonly kind: "background-session";
|
|
304
|
-
readonly memory?: AgentMemoryInvocationIdentity;
|
|
305
|
-
readonly sessionId: string;
|
|
306
|
-
readonly sourceMessageId: string;
|
|
307
|
-
readonly tenantKey: string;
|
|
308
|
-
}
|
|
309
|
-
type AgentInvocationOrigin = FeishuAgentInvocationOrigin | LocalCliAgentInvocationOrigin | AutomationAgentInvocationOrigin | BackgroundSessionAgentInvocationOrigin;
|
|
310
|
-
//#endregion
|
|
311
|
-
//#region src/modules/agent-execution/application/loop/agent-loop.d.ts
|
|
313
|
+
//#region src/core/application/agent-execution/loop/agent-loop.d.ts
|
|
312
314
|
type AgentLoopEvent = AgentLoopTurnStart | AgentLoopTextDelta | AgentLoopThinkingDelta | AgentLoopModelExecutionStart | AgentLoopModelExecutionEnd | AgentLoopSkillExecutionStart | AgentLoopSkillExecutionEnd | AgentLoopToolExecutionStart | AgentLoopToolExecutionUpdate | AgentLoopToolExecutionEnd;
|
|
313
315
|
type AgentLoopEventLike = AgentLoopEvent | string;
|
|
314
316
|
interface AgentLoopTextDelta {
|
|
@@ -400,253 +402,6 @@ declare function createAgentLoopToolExecutionStart(options: AgentLoopToolExecuti
|
|
|
400
402
|
declare function createAgentLoopToolExecutionUpdate(options: AgentLoopToolExecutionUpdateOptions): AgentLoopToolExecutionUpdate;
|
|
401
403
|
declare function createAgentLoopToolExecutionEnd(options: AgentLoopToolExecutionEndOptions): AgentLoopToolExecutionEnd;
|
|
402
404
|
//#endregion
|
|
403
|
-
//#region src/modules/agent-execution/application/contracts/agent-execution-contracts.d.ts
|
|
404
|
-
interface AgentClock {
|
|
405
|
-
readonly now: Effect.Effect<Date>;
|
|
406
|
-
}
|
|
407
|
-
interface RunIdGenerator {
|
|
408
|
-
readonly next: Effect.Effect<AgentRunId>;
|
|
409
|
-
}
|
|
410
|
-
interface PromptCommand {
|
|
411
|
-
readonly invocation?: AgentInvocationOrigin;
|
|
412
|
-
readonly sessionKey: SessionKey;
|
|
413
|
-
readonly text: string;
|
|
414
|
-
}
|
|
415
|
-
interface AgentPromptResult {
|
|
416
|
-
readonly runId: AgentRunId;
|
|
417
|
-
readonly events: ReadonlyArray<AgentDomainEvent>;
|
|
418
|
-
readonly finalText: string;
|
|
419
|
-
readonly runSnapshot: AgentRunSnapshot;
|
|
420
|
-
readonly snapshot: AgentSessionSnapshot;
|
|
421
|
-
readonly state: AgentRunState;
|
|
422
|
-
readonly turn: AgentTranscriptTurn;
|
|
423
|
-
readonly updates: ReadonlyArray<AgentRunUpdate>;
|
|
424
|
-
}
|
|
425
|
-
interface AgentRunUpdate {
|
|
426
|
-
readonly event: AgentDomainEvent;
|
|
427
|
-
readonly previousState?: AgentRunState;
|
|
428
|
-
readonly state: AgentRunState;
|
|
429
|
-
}
|
|
430
|
-
interface AgentRunSnapshot {
|
|
431
|
-
readonly events: ReadonlyArray<AgentDomainEvent>;
|
|
432
|
-
readonly runId: AgentRunId;
|
|
433
|
-
readonly state?: AgentRunState;
|
|
434
|
-
readonly summary: AgentRunSummary;
|
|
435
|
-
readonly updates: ReadonlyArray<AgentRunUpdate>;
|
|
436
|
-
}
|
|
437
|
-
interface ActiveAgentRun {
|
|
438
|
-
readonly runId: AgentRunId;
|
|
439
|
-
readonly sessionKey: SessionKey;
|
|
440
|
-
}
|
|
441
|
-
type AgentHarnessAvailability = AgentHarnessIdleAvailability | AgentHarnessBusyAvailability;
|
|
442
|
-
type AgentSessionAvailability = AgentHarnessIdleAvailability | AgentSessionBusyAvailability;
|
|
443
|
-
interface AgentHarnessIdleAvailability {
|
|
444
|
-
readonly busy: false;
|
|
445
|
-
}
|
|
446
|
-
interface AgentHarnessBusyAvailability {
|
|
447
|
-
readonly activeRun: ActiveAgentRun;
|
|
448
|
-
readonly activeRunId: AgentRunId;
|
|
449
|
-
readonly activeSessionKey: SessionKey;
|
|
450
|
-
readonly activeState?: AgentRunState;
|
|
451
|
-
readonly busy: true;
|
|
452
|
-
}
|
|
453
|
-
type AgentSessionBusyAvailability = AgentSessionOwnedBusyAvailability | AgentSessionOtherBusyAvailability;
|
|
454
|
-
interface AgentSessionOwnedBusyAvailability {
|
|
455
|
-
readonly activeInSession: true;
|
|
456
|
-
readonly activeRun: ActiveAgentRun;
|
|
457
|
-
readonly activeRunId: AgentRunId;
|
|
458
|
-
readonly activeState?: AgentRunState;
|
|
459
|
-
readonly busy: true;
|
|
460
|
-
}
|
|
461
|
-
interface AgentSessionOtherBusyAvailability {
|
|
462
|
-
readonly activeInSession: false;
|
|
463
|
-
readonly busy: true;
|
|
464
|
-
}
|
|
465
|
-
interface AgentSessionSnapshot {
|
|
466
|
-
readonly availability: AgentSessionAvailability;
|
|
467
|
-
readonly latestRunSummary?: AgentRunSummary;
|
|
468
|
-
readonly runs: ReadonlyArray<AgentRunSummary>;
|
|
469
|
-
readonly sessionKey: SessionKey;
|
|
470
|
-
readonly state?: AgentRunState;
|
|
471
|
-
readonly summary?: AgentSessionSummary;
|
|
472
|
-
readonly transcript: AgentTranscript;
|
|
473
|
-
}
|
|
474
|
-
type AgentHarnessError = AgentHarnessBusy | AgentLoopFailed | AgentEventSinkFailed | AgentEventHandlerFailed | AgentRunCancelled;
|
|
475
|
-
interface AgentRunSubscriptionCapabilities {
|
|
476
|
-
subscribe(listener: AgentDomainEventListener): () => void;
|
|
477
|
-
subscribeRun(runId: AgentRunId, listener: AgentDomainEventListener): () => void;
|
|
478
|
-
subscribeRunUpdates(runId: AgentRunId, listener: AgentRunUpdateListener): () => void;
|
|
479
|
-
subscribeUpdates(listener: AgentRunUpdateListener): () => void;
|
|
480
|
-
}
|
|
481
|
-
interface AgentHarness extends AgentRunSubscriptionCapabilities {
|
|
482
|
-
cancelActiveRun(reason?: string): Effect.Effect<boolean>;
|
|
483
|
-
cancelRun(runId: AgentRunId, reason?: string): Effect.Effect<boolean>;
|
|
484
|
-
steerRun(runId: AgentRunId, text: string): Effect.Effect<boolean>;
|
|
485
|
-
forSession(sessionKey: SessionKey): AgentSessionHandle;
|
|
486
|
-
getActiveRun(): ActiveAgentRun | undefined;
|
|
487
|
-
getActiveRunId(): AgentRunId | undefined;
|
|
488
|
-
getActiveRunState(): AgentRunState | undefined;
|
|
489
|
-
getAvailability(): AgentHarnessAvailability;
|
|
490
|
-
getHistory(): AgentHistory;
|
|
491
|
-
getRunEvents(runId: AgentRunId): ReadonlyArray<AgentDomainEvent> | undefined;
|
|
492
|
-
getRunSnapshot(runId: AgentRunId): AgentRunSnapshot | undefined;
|
|
493
|
-
getRunSummary(runId: AgentRunId): AgentRunSummary | undefined;
|
|
494
|
-
getRunState(runId: AgentRunId): AgentRunState | undefined;
|
|
495
|
-
getRunUpdates(runId: AgentRunId): ReadonlyArray<AgentRunUpdate> | undefined;
|
|
496
|
-
getSessionHistory(sessionKey: SessionKey): AgentHistory;
|
|
497
|
-
getSessionLatestRunSnapshot(sessionKey: SessionKey): AgentRunSnapshot | undefined;
|
|
498
|
-
getSessionLatestRunSummary(sessionKey: SessionKey): AgentRunSummary | undefined;
|
|
499
|
-
getSessionRuns(sessionKey: SessionKey): ReadonlyArray<AgentRunSummary>;
|
|
500
|
-
getSessionSnapshot(sessionKey: SessionKey): AgentSessionSnapshot;
|
|
501
|
-
getSessionSummary(sessionKey: SessionKey): AgentSessionSummary | undefined;
|
|
502
|
-
getSessionTranscript(sessionKey: SessionKey): AgentTranscript;
|
|
503
|
-
getSessionState(sessionKey: SessionKey): AgentRunState | undefined;
|
|
504
|
-
getState(): AgentRunState;
|
|
505
|
-
prompt(command: PromptCommand): Effect.Effect<AgentPromptResult, AgentHarnessError>;
|
|
506
|
-
promptRunSnapshot(command: PromptCommand): Effect.Effect<AgentRunSnapshot, AgentHarnessError>;
|
|
507
|
-
promptSnapshot(command: PromptCommand): Effect.Effect<AgentSessionSnapshot, AgentHarnessError>;
|
|
508
|
-
promptText(command: PromptCommand): Effect.Effect<string, AgentHarnessError>;
|
|
509
|
-
promptTurn(command: PromptCommand): Effect.Effect<AgentTranscriptTurn, AgentHarnessError>;
|
|
510
|
-
promptWithEvents<R>(command: PromptCommand, onEvent: AgentDomainEventHandler<R>): Effect.Effect<AgentPromptResult, AgentHarnessError, R>;
|
|
511
|
-
promptWithUpdates<R>(command: PromptCommand, onUpdate: AgentRunUpdateHandler<R>): Effect.Effect<AgentPromptResult, AgentHarnessError, R>;
|
|
512
|
-
stream(command: PromptCommand): Stream.Stream<AgentDomainEvent, AgentHarnessError>;
|
|
513
|
-
streamText(command: PromptCommand): Stream.Stream<string, AgentHarnessError>;
|
|
514
|
-
streamUpdates(command: PromptCommand): Stream.Stream<AgentRunUpdate, AgentHarnessError>;
|
|
515
|
-
}
|
|
516
|
-
interface AgentSessionHandle extends AgentRunSubscriptionCapabilities {
|
|
517
|
-
readonly sessionKey: SessionKey;
|
|
518
|
-
cancelActiveRun(reason?: string): Effect.Effect<boolean>;
|
|
519
|
-
cancelRun(runId: AgentRunId, reason?: string): Effect.Effect<boolean>;
|
|
520
|
-
steerRun(runId: AgentRunId, text: string): Effect.Effect<boolean>;
|
|
521
|
-
getActiveRun(): ActiveAgentRun | undefined;
|
|
522
|
-
getActiveRunState(): AgentRunState | undefined;
|
|
523
|
-
getAvailability(): AgentSessionAvailability;
|
|
524
|
-
getHistory(): AgentHistory;
|
|
525
|
-
getLatestRunSnapshot(): AgentRunSnapshot | undefined;
|
|
526
|
-
getLatestRunSummary(): AgentRunSummary | undefined;
|
|
527
|
-
getRunEvents(runId: AgentRunId): ReadonlyArray<AgentDomainEvent> | undefined;
|
|
528
|
-
getRunSnapshot(runId: AgentRunId): AgentRunSnapshot | undefined;
|
|
529
|
-
getRunSummary(runId: AgentRunId): AgentRunSummary | undefined;
|
|
530
|
-
getRuns(): ReadonlyArray<AgentRunSummary>;
|
|
531
|
-
getSnapshot(): AgentSessionSnapshot;
|
|
532
|
-
getSummary(): AgentSessionSummary | undefined;
|
|
533
|
-
getTranscript(): AgentTranscript;
|
|
534
|
-
getRunState(runId: AgentRunId): AgentRunState | undefined;
|
|
535
|
-
getRunUpdates(runId: AgentRunId): ReadonlyArray<AgentRunUpdate> | undefined;
|
|
536
|
-
getState(): AgentRunState | undefined;
|
|
537
|
-
prompt(text: string): Effect.Effect<AgentPromptResult, AgentHarnessError>;
|
|
538
|
-
promptRunSnapshot(text: string): Effect.Effect<AgentRunSnapshot, AgentHarnessError>;
|
|
539
|
-
promptSnapshot(text: string): Effect.Effect<AgentSessionSnapshot, AgentHarnessError>;
|
|
540
|
-
promptText(text: string): Effect.Effect<string, AgentHarnessError>;
|
|
541
|
-
promptTurn(text: string): Effect.Effect<AgentTranscriptTurn, AgentHarnessError>;
|
|
542
|
-
promptWithEvents<R>(text: string, onEvent: AgentDomainEventHandler<R>): Effect.Effect<AgentPromptResult, AgentHarnessError, R>;
|
|
543
|
-
promptWithUpdates<R>(text: string, onUpdate: AgentRunUpdateHandler<R>): Effect.Effect<AgentPromptResult, AgentHarnessError, R>;
|
|
544
|
-
stream(text: string): Stream.Stream<AgentDomainEvent, AgentHarnessError>;
|
|
545
|
-
streamText(text: string): Stream.Stream<string, AgentHarnessError>;
|
|
546
|
-
streamUpdates(text: string): Stream.Stream<AgentRunUpdate, AgentHarnessError>;
|
|
547
|
-
}
|
|
548
|
-
type AgentDomainEventListener = (event: AgentDomainEvent) => void;
|
|
549
|
-
type AgentRunUpdateListener = (update: AgentRunUpdate) => void;
|
|
550
|
-
type AgentDomainEventHandler<R = never> = (event: AgentDomainEvent) => Effect.Effect<void, unknown, R>;
|
|
551
|
-
type AgentRunUpdateHandler<R = never> = (update: AgentRunUpdate) => Effect.Effect<void, unknown, R>;
|
|
552
|
-
interface AgentDomainEventSink {
|
|
553
|
-
append(event: AgentDomainEvent): Effect.Effect<void, unknown>;
|
|
554
|
-
}
|
|
555
|
-
//#endregion
|
|
556
|
-
//#region src/modules/agent-execution/application/contracts/agent-execution-errors.d.ts
|
|
557
|
-
declare class AgentHarnessBusy {
|
|
558
|
-
readonly activeRun: ActiveAgentRun;
|
|
559
|
-
readonly activeState?: AgentRunState | undefined;
|
|
560
|
-
readonly _tag = "AgentHarnessBusy";
|
|
561
|
-
readonly activeRunId: AgentRunId;
|
|
562
|
-
readonly activeSessionKey: SessionKey;
|
|
563
|
-
constructor(activeRun: ActiveAgentRun, activeState?: AgentRunState | undefined);
|
|
564
|
-
}
|
|
565
|
-
declare class AgentLoopFailed {
|
|
566
|
-
readonly runId: AgentRunId;
|
|
567
|
-
readonly errorMessage: string;
|
|
568
|
-
readonly cause: unknown;
|
|
569
|
-
readonly state?: AgentRunState | undefined;
|
|
570
|
-
readonly _tag = "AgentLoopFailed";
|
|
571
|
-
constructor(runId: AgentRunId, errorMessage: string, cause: unknown, state?: AgentRunState | undefined);
|
|
572
|
-
}
|
|
573
|
-
declare class AgentEventSinkFailed {
|
|
574
|
-
readonly runId: AgentRunId;
|
|
575
|
-
readonly eventType: AgentDomainEvent["type"];
|
|
576
|
-
readonly cause: unknown;
|
|
577
|
-
readonly _tag = "AgentEventSinkFailed";
|
|
578
|
-
constructor(runId: AgentRunId, eventType: AgentDomainEvent["type"], cause: unknown);
|
|
579
|
-
}
|
|
580
|
-
declare class AgentEventHandlerFailed {
|
|
581
|
-
readonly runId: AgentRunId;
|
|
582
|
-
readonly eventType: AgentDomainEvent["type"];
|
|
583
|
-
readonly cause: unknown;
|
|
584
|
-
readonly state?: AgentRunState | undefined;
|
|
585
|
-
readonly _tag = "AgentEventHandlerFailed";
|
|
586
|
-
constructor(runId: AgentRunId, eventType: AgentDomainEvent["type"], cause: unknown, state?: AgentRunState | undefined);
|
|
587
|
-
}
|
|
588
|
-
declare class AgentRunCancelled {
|
|
589
|
-
readonly runId: AgentRunId;
|
|
590
|
-
readonly reason: string | undefined;
|
|
591
|
-
readonly state: AgentRunState;
|
|
592
|
-
readonly _tag = "AgentRunCancelled";
|
|
593
|
-
constructor(runId: AgentRunId, reason: string | undefined, state: AgentRunState);
|
|
594
|
-
}
|
|
595
|
-
//#endregion
|
|
596
|
-
//#region src/modules/agent-execution/application/execution/agent-event-sink.d.ts
|
|
597
|
-
declare function createAgentDomainEventSink(append: (event: AgentDomainEvent) => Effect.Effect<void, unknown>): AgentDomainEventSink;
|
|
598
|
-
//#endregion
|
|
599
|
-
//#region src/modules/agent-execution/application/history/agent-history.d.ts
|
|
600
|
-
interface AgentHistoryEventLog {
|
|
601
|
-
readAll(): Effect.Effect<ReadonlyArray<AgentDomainEvent>, unknown>;
|
|
602
|
-
}
|
|
603
|
-
declare function restoreAgentHistory(eventLog: AgentHistoryEventLog): Effect.Effect<AgentHistory, unknown>;
|
|
604
|
-
//#endregion
|
|
605
|
-
//#region src/modules/agent-execution/application/context/agent-context-assembler.d.ts
|
|
606
|
-
type AgentContextLayerKind = "host-safety" | "system-prompt" | "managed-instructions" | "workspace-instructions" | "tool-schema" | "skill" | "memory" | "compaction" | "transcript" | "current-input";
|
|
607
|
-
interface AgentContextLayer {
|
|
608
|
-
readonly kind: AgentContextLayerKind;
|
|
609
|
-
readonly content: string;
|
|
610
|
-
}
|
|
611
|
-
interface AgentContextInput {
|
|
612
|
-
readonly hostSafety: string;
|
|
613
|
-
readonly systemPrompt: string;
|
|
614
|
-
readonly managedInstructions?: string;
|
|
615
|
-
readonly workspaceInstructions?: ReadonlyArray<string>;
|
|
616
|
-
readonly toolSchemas: ReadonlyArray<string>;
|
|
617
|
-
readonly skills?: ReadonlyArray<string>;
|
|
618
|
-
readonly memory?: ReadonlyArray<string>;
|
|
619
|
-
readonly compaction?: string;
|
|
620
|
-
readonly transcript?: ReadonlyArray<string>;
|
|
621
|
-
readonly currentInput: string;
|
|
622
|
-
readonly maxBytes: number;
|
|
623
|
-
}
|
|
624
|
-
interface AssembledAgentContext {
|
|
625
|
-
readonly layers: ReadonlyArray<AgentContextLayer>;
|
|
626
|
-
readonly omittedKinds: ReadonlyArray<AgentContextLayerKind>;
|
|
627
|
-
readonly bytes: number;
|
|
628
|
-
}
|
|
629
|
-
declare class AgentContextBudgetExceeded extends Error {
|
|
630
|
-
readonly name = "AgentContextBudgetExceeded";
|
|
631
|
-
}
|
|
632
|
-
declare function assembleAgentContext(input: AgentContextInput): AssembledAgentContext;
|
|
633
|
-
//#endregion
|
|
634
|
-
//#region src/modules/agent-execution/application/observation/agent-model-content-observer.d.ts
|
|
635
|
-
interface AgentModelInputObservation {
|
|
636
|
-
readonly input: unknown;
|
|
637
|
-
readonly modelCallId: string;
|
|
638
|
-
readonly runId: AgentRunId;
|
|
639
|
-
}
|
|
640
|
-
interface AgentModelOutputObservation {
|
|
641
|
-
readonly modelCallId: string;
|
|
642
|
-
readonly output: unknown;
|
|
643
|
-
readonly runId: AgentRunId;
|
|
644
|
-
}
|
|
645
|
-
interface AgentModelContentObserver {
|
|
646
|
-
observeInput(observation: AgentModelInputObservation): void;
|
|
647
|
-
observeOutput(observation: AgentModelOutputObservation): void;
|
|
648
|
-
}
|
|
649
|
-
//#endregion
|
|
650
405
|
//#region src/adapters/compatibility/agent-execution/loop/agent-loop.d.ts
|
|
651
406
|
interface AgentLoopInput {
|
|
652
407
|
readonly runId: AgentRunId;
|
|
@@ -687,4 +442,4 @@ declare function createAgentLoopFromCallback(run: AgentLoopCallback): AgentLoop;
|
|
|
687
442
|
declare function createTextAgentLoop(options: TextAgentLoopOptions): AgentLoop;
|
|
688
443
|
declare function createTextAgentLoopFromCallback(generate: TextAgentLoopCallback): AgentLoop;
|
|
689
444
|
//#endregion
|
|
690
|
-
export {
|
|
445
|
+
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 };
|