@rivus/runtime 0.16.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +5 -0
- package/dist/acp.d.ts +179 -0
- package/dist/acp.js +768 -0
- package/dist/chunks/agent-loop.d.ts +481 -0
- package/dist/chunks/agent-loop.js +164 -0
- package/dist/chunks/rivus-runtime-tool.d.ts +386 -0
- package/dist/chunks/tool-input-digest.js +119 -0
- package/dist/index.d.ts +1306 -0
- package/dist/index.js +4164 -0
- package/dist/pi.d.ts +840 -0
- package/dist/pi.js +2143 -0
- package/package.json +69 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,1306 @@
|
|
|
1
|
+
import { $ as createAgentLoopTurnStart, A as AgentLoopSkillExecutionStart, At as AgentModelUsage, B as AgentLoopTurnStart, Bt as AgentToolExecutionUpdated, C as AgentLoopInput, Ct as AgentRunState, D as AgentLoopModelExecutionStartOptions, Dt as AgentModelExecutionEnded, E as AgentLoopModelExecutionStart, Et as AgentDomainEvent, F as AgentLoopToolExecutionEndOptions, Ft as AgentSkillExecutionEnded, G as createAgentLoopModelExecutionStart, Gt as SessionKey, H as EventAgentLoopOptions, Ht as AgentTurnStarted, I as AgentLoopToolExecutionStart, It as AgentSkillExecutionStarted, J as createAgentLoopTextDelta, Jt as isAssistantTextDeltaEvent, K as createAgentLoopSkillExecutionEnd, Kt as TerminalAgentDomainEvent, L as AgentLoopToolExecutionStartOptions, Lt as AgentToolExecutionEnded, M as AgentLoopTextDelta, Mt as AgentRunCompleted, N as AgentLoopThinkingDelta, Nt as AgentRunFailed, O as AgentLoopSkillExecutionEnd, Ot as AgentModelExecutionEvent, P as AgentLoopToolExecutionEnd, Pt as AgentRunId, Q as createAgentLoopToolExecutionUpdate, R as AgentLoopToolExecutionUpdate, Rt as AgentToolExecutionEvent, S as AgentLoopEventLike, St as AgentRunPhase, T as AgentLoopModelExecutionEndOptions, Tt as AgentToolExecutionState, U as TextAgentLoopOptions$1, Ut as AssistantTextDelta, V as AgentSteeringChannel, Vt as AgentTurnCompleted, W as createAgentLoopModelExecutionEnd, Wt as AssistantThinkingDelta, X as createAgentLoopToolExecutionEnd, Xt as isTerminalAgentDomainEvent, Y as createAgentLoopThinkingDelta, Yt as isAssistantThinkingDeltaEvent, Z as createAgentLoopToolExecutionStart, _ as toCompatibilityAgentLoopInput, _t as replayAgentTranscript, a as AgentLoopInput$1, at as AutomationAgentInvocationOrigin, b as AgentLoop, bt as AgentSessionSummary, c as EventAgentLoopOptions$1, ct as LocalCliAgentInvocationOrigin, d as createAgentLoopFromCallback, dt as AgentTranscriptMessage, et as createEventAgentLoop, f as createAsyncIterableAgentLoop, ft as AgentTranscriptMessageRole, g as fromEffectAgentLoop, gt as createAgentTranscriptTurn, h as createTextAgentLoopFromCallback, ht as createAgentTranscriptMessages, i as AgentLoopCallbackResult, it as AgentMemoryInvocationIdentity, j as AgentLoopSkillExecutionStartOptions, jt as AgentRunAccepted, k as AgentLoopSkillExecutionEndOptions, kt as AgentModelExecutionStarted, l as TextAgentLoopCallback, lt as AgentConversationMessagesOptions, m as createTextAgentLoop, mt as createAgentConversationMessages, n as AgentLoopCallback, nt as normalizeAgentLoopEvent, o as AgentSteeringChannel$1, ot as BackgroundSessionAgentInvocationOrigin, p as createEventAgentLoop$1, pt as AgentTranscriptTurn, q as createAgentLoopSkillExecutionStart, qt as isAgentToolExecutionEvent, r as AgentLoopCallbackOutput, rt as AgentInvocationOrigin, s as AsyncIterableAgentLoopOptions, st as FeishuAgentInvocationOrigin, t as AgentLoop$1, tt as createTextAgentLoop$1, u as TextAgentLoopOptions, ut as AgentTranscript, v as toEffectAgentLoop, vt as AgentHistory, w as AgentLoopModelExecutionEnd, wt as AgentSkillExecutionState, x as AgentLoopEvent, xt as replayAgentHistory, y as toEffectAgentLoopInput, yt as AgentRunSummary, z as AgentLoopToolExecutionUpdateOptions, zt as AgentToolExecutionStarted } from "./chunks/agent-loop.js";
|
|
2
|
+
import { $ as RegisteredRivusSkill, A as AgentModelContentObserver, B as RivusToolExecutionOrigin, C as InvocationMemoryAuthority, D as resolveInvocationAuthority, E as createInvocationAuthority, F as RivusMemoryAuthority, G as RivusToolIdempotency, H as RivusToolFactoryContext, I as RivusMemoryScope, J as ModelChangeBoundaryDeadlineError, K as RivusToolInputRejected, L as RivusResolvedToolDescriptor, M as AgentModelOutputObservation, N as RegisteredRivusTool, O as NormalizedAgentInvocation, P as RivusHostToolDescriptor, Q as RunAdmissionOptions, R as RivusToolDescriptor, S as InvocationAuthorityRef, T as InvocationToolGrantSet, U as RivusToolGrantSet, V as RivusToolExecutor, W as RivusToolGrantSetOperations, X as RunAdmission, Y as ModelChangeClock, Z as RunAdmissionLease, _ as ToolRisk, a as AuthorizationPolicyProvider, at as ModelChangeExecutionBudget, b as InvocationAuthority, c as ToolApprovalService, ct as ModelChangeRuntimeContext, d as ToolExecutionContext, dt as ModelReference, et as RivusSkillDescriptor, f as ToolExecutionOrigin, g as ToolIdempotency, h as ToolExecutorInputRejected, i as isRivusRuntimeToolId, it as ModelChangeBudgetReservation, j as AgentModelInputObservation, k as normalizeAgentInvocation, l as ToolCatalog, lt as ModelChangeRuntimePort, m as ToolExecutor, n as RivusRuntimeToolGrantSet, nt as ModelBinding, o as AuthorizationPolicyState, ot as ModelChangePaidCallKind, p as ToolExecutionRequest, q as RivusToolRisk, r as RivusRuntimeToolId, rt as ModelChangeActivationResult, s as ToolApprovalRequest, st as ModelChangeRestoreResult, t as RIVUS_RUNTIME_TOOL_IDS, tt as RivusSkillGrantSet, u as ToolDescriptor, ut as ModelChangeValidationResult, v as requiresToolApproval$1, w as InvocationMemoryScope, x as InvocationAuthorityIdentity, y as InvalidInvocationAuthority, z as RivusToolExecutionContext } from "./chunks/rivus-runtime-tool.js";
|
|
3
|
+
import { Effect, Stream } from "effect";
|
|
4
|
+
import { Tracer } from "@opentelemetry/api";
|
|
5
|
+
|
|
6
|
+
//#region src/core/application/agent-execution/contracts/agent-execution-errors.d.ts
|
|
7
|
+
declare class AgentHarnessBusy {
|
|
8
|
+
readonly activeRun: ActiveAgentRun;
|
|
9
|
+
readonly activeState?: AgentRunState | undefined;
|
|
10
|
+
readonly _tag = "AgentHarnessBusy";
|
|
11
|
+
readonly activeRunId: AgentRunId;
|
|
12
|
+
readonly activeSessionKey: SessionKey;
|
|
13
|
+
constructor(activeRun: ActiveAgentRun, activeState?: AgentRunState | undefined);
|
|
14
|
+
}
|
|
15
|
+
declare class AgentLoopFailed {
|
|
16
|
+
readonly runId: AgentRunId;
|
|
17
|
+
readonly errorMessage: string;
|
|
18
|
+
readonly cause: unknown;
|
|
19
|
+
readonly state?: AgentRunState | undefined;
|
|
20
|
+
readonly _tag = "AgentLoopFailed";
|
|
21
|
+
constructor(runId: AgentRunId, errorMessage: string, cause: unknown, state?: AgentRunState | undefined);
|
|
22
|
+
}
|
|
23
|
+
declare class AgentEventSinkFailed {
|
|
24
|
+
readonly runId: AgentRunId;
|
|
25
|
+
readonly eventType: AgentDomainEvent["type"];
|
|
26
|
+
readonly cause: unknown;
|
|
27
|
+
readonly _tag = "AgentEventSinkFailed";
|
|
28
|
+
constructor(runId: AgentRunId, eventType: AgentDomainEvent["type"], cause: unknown);
|
|
29
|
+
}
|
|
30
|
+
declare class AgentEventHandlerFailed {
|
|
31
|
+
readonly runId: AgentRunId;
|
|
32
|
+
readonly eventType: AgentDomainEvent["type"];
|
|
33
|
+
readonly cause: unknown;
|
|
34
|
+
readonly state?: AgentRunState | undefined;
|
|
35
|
+
readonly _tag = "AgentEventHandlerFailed";
|
|
36
|
+
constructor(runId: AgentRunId, eventType: AgentDomainEvent["type"], cause: unknown, state?: AgentRunState | undefined);
|
|
37
|
+
}
|
|
38
|
+
declare class AgentRunCancelled {
|
|
39
|
+
readonly runId: AgentRunId;
|
|
40
|
+
readonly reason: string | undefined;
|
|
41
|
+
readonly state: AgentRunState;
|
|
42
|
+
readonly _tag = "AgentRunCancelled";
|
|
43
|
+
constructor(runId: AgentRunId, reason: string | undefined, state: AgentRunState);
|
|
44
|
+
}
|
|
45
|
+
//#endregion
|
|
46
|
+
//#region src/core/application/agent-execution/contracts/agent-execution-contracts.d.ts
|
|
47
|
+
interface AgentClock {
|
|
48
|
+
readonly now: Effect.Effect<Date>;
|
|
49
|
+
}
|
|
50
|
+
interface RunIdGenerator {
|
|
51
|
+
readonly next: Effect.Effect<AgentRunId>;
|
|
52
|
+
}
|
|
53
|
+
interface AgentHarnessOptions {
|
|
54
|
+
readonly clock: AgentClock;
|
|
55
|
+
readonly eventSinks?: ReadonlyArray<AgentDomainEventSink>;
|
|
56
|
+
readonly initialEvents?: ReadonlyArray<AgentDomainEvent>;
|
|
57
|
+
readonly initialRunStates?: ReadonlyArray<AgentRunState>;
|
|
58
|
+
readonly loop: AgentLoop;
|
|
59
|
+
readonly runTimeoutMs?: number;
|
|
60
|
+
readonly runIds: RunIdGenerator;
|
|
61
|
+
}
|
|
62
|
+
interface PromptCommand {
|
|
63
|
+
readonly invocation?: AgentInvocationOrigin;
|
|
64
|
+
readonly sessionKey: SessionKey;
|
|
65
|
+
readonly text: string;
|
|
66
|
+
}
|
|
67
|
+
interface AgentPromptResult {
|
|
68
|
+
readonly runId: AgentRunId;
|
|
69
|
+
readonly events: ReadonlyArray<AgentDomainEvent>;
|
|
70
|
+
readonly finalText: string;
|
|
71
|
+
readonly runSnapshot: AgentRunSnapshot;
|
|
72
|
+
readonly snapshot: AgentSessionSnapshot;
|
|
73
|
+
readonly state: AgentRunState;
|
|
74
|
+
readonly turn: AgentTranscriptTurn;
|
|
75
|
+
readonly updates: ReadonlyArray<AgentRunUpdate>;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Standard typed result of a single Agent Run. The public AgentHostRuntime
|
|
79
|
+
* extension point returns `unknown`; the standard Gateway binding validates the
|
|
80
|
+
* result into this shape.
|
|
81
|
+
*/
|
|
82
|
+
interface StandardAgentRunResult {
|
|
83
|
+
readonly finalText: string;
|
|
84
|
+
readonly runId: AgentRunId;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Execution control operations shared by the legacy Feishu execution port and
|
|
88
|
+
* the normalized Gateway execution port. These methods do not depend on the
|
|
89
|
+
* prompt command shape, so they can be shared without pulling the normalized
|
|
90
|
+
* invocation graph into the legacy Feishu adapter.
|
|
91
|
+
*/
|
|
92
|
+
interface AgentExecutionControlPort {
|
|
93
|
+
cancelActiveRun(input: {
|
|
94
|
+
readonly reason: string;
|
|
95
|
+
readonly sessionKey: SessionKey;
|
|
96
|
+
}): Effect.Effect<AgentRunId | undefined, unknown>;
|
|
97
|
+
cancelRun(input: {
|
|
98
|
+
readonly reason: string;
|
|
99
|
+
readonly runId: AgentRunId;
|
|
100
|
+
readonly sessionKey?: SessionKey;
|
|
101
|
+
}): Effect.Effect<boolean, unknown>;
|
|
102
|
+
getActiveRun?(input: {
|
|
103
|
+
readonly sessionKey: SessionKey;
|
|
104
|
+
}): Effect.Effect<AgentRunId | undefined, unknown>;
|
|
105
|
+
steerRun(input: {
|
|
106
|
+
readonly sessionKey: SessionKey;
|
|
107
|
+
readonly text: string;
|
|
108
|
+
}): Effect.Effect<{
|
|
109
|
+
readonly runId: AgentRunId;
|
|
110
|
+
readonly steered: true;
|
|
111
|
+
} | undefined, unknown>;
|
|
112
|
+
}
|
|
113
|
+
interface AgentRunUpdate {
|
|
114
|
+
readonly event: AgentDomainEvent;
|
|
115
|
+
readonly previousState?: AgentRunState;
|
|
116
|
+
readonly state: AgentRunState;
|
|
117
|
+
}
|
|
118
|
+
interface AgentRunSnapshot {
|
|
119
|
+
readonly events: ReadonlyArray<AgentDomainEvent>;
|
|
120
|
+
readonly runId: AgentRunId;
|
|
121
|
+
readonly state?: AgentRunState;
|
|
122
|
+
readonly summary: AgentRunSummary;
|
|
123
|
+
readonly updates: ReadonlyArray<AgentRunUpdate>;
|
|
124
|
+
}
|
|
125
|
+
interface ActiveAgentRun {
|
|
126
|
+
readonly runId: AgentRunId;
|
|
127
|
+
readonly sessionKey: SessionKey;
|
|
128
|
+
}
|
|
129
|
+
type AgentHarnessAvailability = AgentHarnessIdleAvailability | AgentHarnessBusyAvailability;
|
|
130
|
+
type AgentSessionAvailability = AgentHarnessIdleAvailability | AgentSessionBusyAvailability;
|
|
131
|
+
interface AgentHarnessIdleAvailability {
|
|
132
|
+
readonly busy: false;
|
|
133
|
+
}
|
|
134
|
+
interface AgentHarnessBusyAvailability {
|
|
135
|
+
readonly activeRun: ActiveAgentRun;
|
|
136
|
+
readonly activeRunId: AgentRunId;
|
|
137
|
+
readonly activeSessionKey: SessionKey;
|
|
138
|
+
readonly activeState?: AgentRunState;
|
|
139
|
+
readonly busy: true;
|
|
140
|
+
}
|
|
141
|
+
type AgentSessionBusyAvailability = AgentSessionOwnedBusyAvailability | AgentSessionOtherBusyAvailability;
|
|
142
|
+
interface AgentSessionOwnedBusyAvailability {
|
|
143
|
+
readonly activeInSession: true;
|
|
144
|
+
readonly activeRun: ActiveAgentRun;
|
|
145
|
+
readonly activeRunId: AgentRunId;
|
|
146
|
+
readonly activeState?: AgentRunState;
|
|
147
|
+
readonly busy: true;
|
|
148
|
+
}
|
|
149
|
+
interface AgentSessionOtherBusyAvailability {
|
|
150
|
+
readonly activeInSession: false;
|
|
151
|
+
readonly busy: true;
|
|
152
|
+
}
|
|
153
|
+
interface AgentSessionSnapshot {
|
|
154
|
+
readonly availability: AgentSessionAvailability;
|
|
155
|
+
readonly latestRunSummary?: AgentRunSummary;
|
|
156
|
+
readonly runs: ReadonlyArray<AgentRunSummary>;
|
|
157
|
+
readonly sessionKey: SessionKey;
|
|
158
|
+
readonly state?: AgentRunState;
|
|
159
|
+
readonly summary?: AgentSessionSummary;
|
|
160
|
+
readonly transcript: AgentTranscript;
|
|
161
|
+
}
|
|
162
|
+
type AgentHarnessError = AgentHarnessBusy | AgentLoopFailed | AgentEventSinkFailed | AgentEventHandlerFailed | AgentRunCancelled;
|
|
163
|
+
interface AgentRunSubscriptionCapabilities {
|
|
164
|
+
subscribe(listener: AgentDomainEventListener): () => void;
|
|
165
|
+
subscribeRun(runId: AgentRunId, listener: AgentDomainEventListener): () => void;
|
|
166
|
+
subscribeRunUpdates(runId: AgentRunId, listener: AgentRunUpdateListener): () => void;
|
|
167
|
+
subscribeUpdates(listener: AgentRunUpdateListener): () => void;
|
|
168
|
+
}
|
|
169
|
+
interface AgentHarness extends AgentRunSubscriptionCapabilities {
|
|
170
|
+
cancelActiveRun(reason?: string): Effect.Effect<boolean>;
|
|
171
|
+
cancelRun(runId: AgentRunId, reason?: string): Effect.Effect<boolean>;
|
|
172
|
+
steerRun(runId: AgentRunId, text: string): Effect.Effect<boolean>;
|
|
173
|
+
forSession(sessionKey: SessionKey): AgentSessionHandle;
|
|
174
|
+
getActiveRun(): ActiveAgentRun | undefined;
|
|
175
|
+
getActiveRunId(): AgentRunId | undefined;
|
|
176
|
+
getActiveRunState(): AgentRunState | undefined;
|
|
177
|
+
getAvailability(): AgentHarnessAvailability;
|
|
178
|
+
getHistory(): AgentHistory;
|
|
179
|
+
getRunEvents(runId: AgentRunId): ReadonlyArray<AgentDomainEvent> | undefined;
|
|
180
|
+
getRunSnapshot(runId: AgentRunId): AgentRunSnapshot | undefined;
|
|
181
|
+
getRunSummary(runId: AgentRunId): AgentRunSummary | undefined;
|
|
182
|
+
getRunState(runId: AgentRunId): AgentRunState | undefined;
|
|
183
|
+
getRunUpdates(runId: AgentRunId): ReadonlyArray<AgentRunUpdate> | undefined;
|
|
184
|
+
getSessionHistory(sessionKey: SessionKey): AgentHistory;
|
|
185
|
+
getSessionLatestRunSnapshot(sessionKey: SessionKey): AgentRunSnapshot | undefined;
|
|
186
|
+
getSessionLatestRunSummary(sessionKey: SessionKey): AgentRunSummary | undefined;
|
|
187
|
+
getSessionRuns(sessionKey: SessionKey): ReadonlyArray<AgentRunSummary>;
|
|
188
|
+
getSessionSnapshot(sessionKey: SessionKey): AgentSessionSnapshot;
|
|
189
|
+
getSessionSummary(sessionKey: SessionKey): AgentSessionSummary | undefined;
|
|
190
|
+
getSessionTranscript(sessionKey: SessionKey): AgentTranscript;
|
|
191
|
+
getSessionState(sessionKey: SessionKey): AgentRunState | undefined;
|
|
192
|
+
getState(): AgentRunState;
|
|
193
|
+
prompt(command: PromptCommand): Effect.Effect<AgentPromptResult, AgentHarnessError>;
|
|
194
|
+
promptRunSnapshot(command: PromptCommand): Effect.Effect<AgentRunSnapshot, AgentHarnessError>;
|
|
195
|
+
promptSnapshot(command: PromptCommand): Effect.Effect<AgentSessionSnapshot, AgentHarnessError>;
|
|
196
|
+
promptText(command: PromptCommand): Effect.Effect<string, AgentHarnessError>;
|
|
197
|
+
promptTurn(command: PromptCommand): Effect.Effect<AgentTranscriptTurn, AgentHarnessError>;
|
|
198
|
+
promptWithEvents<R>(command: PromptCommand, onEvent: AgentDomainEventHandler<R>): Effect.Effect<AgentPromptResult, AgentHarnessError, R>;
|
|
199
|
+
promptWithUpdates<R>(command: PromptCommand, onUpdate: AgentRunUpdateHandler<R>): Effect.Effect<AgentPromptResult, AgentHarnessError, R>;
|
|
200
|
+
stream(command: PromptCommand): Stream.Stream<AgentDomainEvent, AgentHarnessError>;
|
|
201
|
+
streamText(command: PromptCommand): Stream.Stream<string, AgentHarnessError>;
|
|
202
|
+
streamUpdates(command: PromptCommand): Stream.Stream<AgentRunUpdate, AgentHarnessError>;
|
|
203
|
+
}
|
|
204
|
+
interface AgentSessionHandle extends AgentRunSubscriptionCapabilities {
|
|
205
|
+
readonly sessionKey: SessionKey;
|
|
206
|
+
cancelActiveRun(reason?: string): Effect.Effect<boolean>;
|
|
207
|
+
cancelRun(runId: AgentRunId, reason?: string): Effect.Effect<boolean>;
|
|
208
|
+
steerRun(runId: AgentRunId, text: string): Effect.Effect<boolean>;
|
|
209
|
+
getActiveRun(): ActiveAgentRun | undefined;
|
|
210
|
+
getActiveRunState(): AgentRunState | undefined;
|
|
211
|
+
getAvailability(): AgentSessionAvailability;
|
|
212
|
+
getHistory(): AgentHistory;
|
|
213
|
+
getLatestRunSnapshot(): AgentRunSnapshot | undefined;
|
|
214
|
+
getLatestRunSummary(): AgentRunSummary | undefined;
|
|
215
|
+
getRunEvents(runId: AgentRunId): ReadonlyArray<AgentDomainEvent> | undefined;
|
|
216
|
+
getRunSnapshot(runId: AgentRunId): AgentRunSnapshot | undefined;
|
|
217
|
+
getRunSummary(runId: AgentRunId): AgentRunSummary | undefined;
|
|
218
|
+
getRuns(): ReadonlyArray<AgentRunSummary>;
|
|
219
|
+
getSnapshot(): AgentSessionSnapshot;
|
|
220
|
+
getSummary(): AgentSessionSummary | undefined;
|
|
221
|
+
getTranscript(): AgentTranscript;
|
|
222
|
+
getRunState(runId: AgentRunId): AgentRunState | undefined;
|
|
223
|
+
getRunUpdates(runId: AgentRunId): ReadonlyArray<AgentRunUpdate> | undefined;
|
|
224
|
+
getState(): AgentRunState | undefined;
|
|
225
|
+
prompt(text: string): Effect.Effect<AgentPromptResult, AgentHarnessError>;
|
|
226
|
+
promptRunSnapshot(text: string): Effect.Effect<AgentRunSnapshot, AgentHarnessError>;
|
|
227
|
+
promptSnapshot(text: string): Effect.Effect<AgentSessionSnapshot, AgentHarnessError>;
|
|
228
|
+
promptText(text: string): Effect.Effect<string, AgentHarnessError>;
|
|
229
|
+
promptTurn(text: string): Effect.Effect<AgentTranscriptTurn, AgentHarnessError>;
|
|
230
|
+
promptWithEvents<R>(text: string, onEvent: AgentDomainEventHandler<R>): Effect.Effect<AgentPromptResult, AgentHarnessError, R>;
|
|
231
|
+
promptWithUpdates<R>(text: string, onUpdate: AgentRunUpdateHandler<R>): Effect.Effect<AgentPromptResult, AgentHarnessError, R>;
|
|
232
|
+
stream(text: string): Stream.Stream<AgentDomainEvent, AgentHarnessError>;
|
|
233
|
+
streamText(text: string): Stream.Stream<string, AgentHarnessError>;
|
|
234
|
+
streamUpdates(text: string): Stream.Stream<AgentRunUpdate, AgentHarnessError>;
|
|
235
|
+
}
|
|
236
|
+
type AgentDomainEventListener = (event: AgentDomainEvent) => void;
|
|
237
|
+
type AgentRunUpdateListener = (update: AgentRunUpdate) => void;
|
|
238
|
+
type AgentDomainEventHandler<R = never> = (event: AgentDomainEvent) => Effect.Effect<void, unknown, R>;
|
|
239
|
+
type AgentRunUpdateHandler<R = never> = (update: AgentRunUpdate) => Effect.Effect<void, unknown, R>;
|
|
240
|
+
interface AgentDomainEventSink {
|
|
241
|
+
append(event: AgentDomainEvent): Effect.Effect<void, unknown>;
|
|
242
|
+
}
|
|
243
|
+
//#endregion
|
|
244
|
+
//#region src/core/application/agent-execution/contracts/workspace-instructions.d.ts
|
|
245
|
+
interface WorkspaceRootHandle {
|
|
246
|
+
readonly id: string;
|
|
247
|
+
}
|
|
248
|
+
interface WorkspaceInstructionSource {
|
|
249
|
+
readonly relativePath: string;
|
|
250
|
+
readonly digest: string;
|
|
251
|
+
readonly bytes: number;
|
|
252
|
+
readonly content: string;
|
|
253
|
+
}
|
|
254
|
+
type WorkspaceInstructionsDiagnosticCode = "workspace-instructions-refresh-required" | "workspace-instructions-source-omitted";
|
|
255
|
+
interface WorkspaceInstructionsDiagnostic {
|
|
256
|
+
readonly code: WorkspaceInstructionsDiagnosticCode;
|
|
257
|
+
readonly relativePath?: string;
|
|
258
|
+
readonly reason: string;
|
|
259
|
+
}
|
|
260
|
+
interface WorkspaceInstructionsRequest {
|
|
261
|
+
readonly workspaceRoot: WorkspaceRootHandle;
|
|
262
|
+
readonly workingDirectory: string;
|
|
263
|
+
readonly targetPath?: string;
|
|
264
|
+
readonly maxBytes: number;
|
|
265
|
+
readonly operation?: "read" | "mutate";
|
|
266
|
+
readonly presentedDigests?: ReadonlyArray<string>;
|
|
267
|
+
}
|
|
268
|
+
interface WorkspaceInstructionsView {
|
|
269
|
+
readonly sources: ReadonlyArray<WorkspaceInstructionSource>;
|
|
270
|
+
readonly content: string;
|
|
271
|
+
readonly digest: string;
|
|
272
|
+
readonly truncated: boolean;
|
|
273
|
+
readonly refreshRequired: boolean;
|
|
274
|
+
readonly diagnostics: ReadonlyArray<WorkspaceInstructionsDiagnostic>;
|
|
275
|
+
}
|
|
276
|
+
interface WorkspaceInstructionsSourceRequest {
|
|
277
|
+
readonly maxBytes: number;
|
|
278
|
+
readonly targetPath?: string;
|
|
279
|
+
readonly workingDirectory: string;
|
|
280
|
+
readonly workspaceRoot: WorkspaceRootHandle;
|
|
281
|
+
}
|
|
282
|
+
interface WorkspaceInstructionsSourceResult {
|
|
283
|
+
readonly diagnostics: ReadonlyArray<WorkspaceInstructionsDiagnostic>;
|
|
284
|
+
readonly sources: ReadonlyArray<WorkspaceInstructionSource>;
|
|
285
|
+
}
|
|
286
|
+
interface WorkspaceInstructionsSourcePort {
|
|
287
|
+
load(request: WorkspaceInstructionsSourceRequest): Effect.Effect<WorkspaceInstructionsSourceResult, unknown>;
|
|
288
|
+
}
|
|
289
|
+
//#endregion
|
|
290
|
+
//#region src/core/application/agent-execution/context/workspace-instructions-resolver.d.ts
|
|
291
|
+
declare class InvalidWorkspaceRoot extends Error {
|
|
292
|
+
readonly name = "InvalidWorkspaceRoot";
|
|
293
|
+
}
|
|
294
|
+
declare class WorkspaceInstructionsSourceError extends Error {
|
|
295
|
+
readonly relativePath: string;
|
|
296
|
+
readonly reason: string;
|
|
297
|
+
readonly name = "WorkspaceInstructionsSourceError";
|
|
298
|
+
constructor(relativePath: string, reason: string);
|
|
299
|
+
}
|
|
300
|
+
interface WorkspaceInstructionsResolver {
|
|
301
|
+
resolve(request: WorkspaceInstructionsRequest): Effect.Effect<WorkspaceInstructionsView, unknown>;
|
|
302
|
+
}
|
|
303
|
+
type WorkspaceInstructionsDigest = (value: string) => string;
|
|
304
|
+
declare function createWorkspaceInstructionsResolver(source: WorkspaceInstructionsSourcePort, digest: WorkspaceInstructionsDigest): WorkspaceInstructionsResolver;
|
|
305
|
+
//#endregion
|
|
306
|
+
//#region src/core/application/agent-execution/context/agent-context-assembler.d.ts
|
|
307
|
+
type AgentContextLayerKind = "host-safety" | "system-prompt" | "managed-instructions" | "workspace-instructions" | "tool-schema" | "skill" | "memory" | "compaction" | "transcript" | "current-input";
|
|
308
|
+
interface AgentContextLayer {
|
|
309
|
+
readonly kind: AgentContextLayerKind;
|
|
310
|
+
readonly content: string;
|
|
311
|
+
}
|
|
312
|
+
interface AgentContextInput {
|
|
313
|
+
readonly hostSafety: string;
|
|
314
|
+
readonly systemPrompt: string;
|
|
315
|
+
readonly managedInstructions?: string;
|
|
316
|
+
readonly workspaceInstructions?: ReadonlyArray<string>;
|
|
317
|
+
readonly toolSchemas: ReadonlyArray<string>;
|
|
318
|
+
readonly skills?: ReadonlyArray<string>;
|
|
319
|
+
readonly memory?: ReadonlyArray<string>;
|
|
320
|
+
readonly compaction?: string;
|
|
321
|
+
readonly transcript?: ReadonlyArray<string>;
|
|
322
|
+
readonly currentInput: string;
|
|
323
|
+
readonly maxBytes: number;
|
|
324
|
+
}
|
|
325
|
+
interface AssembledAgentContext {
|
|
326
|
+
readonly layers: ReadonlyArray<AgentContextLayer>;
|
|
327
|
+
readonly omittedKinds: ReadonlyArray<AgentContextLayerKind>;
|
|
328
|
+
readonly bytes: number;
|
|
329
|
+
}
|
|
330
|
+
declare class AgentContextBudgetExceeded extends Error {
|
|
331
|
+
readonly name = "AgentContextBudgetExceeded";
|
|
332
|
+
}
|
|
333
|
+
declare function assembleAgentContext(input: AgentContextInput): AssembledAgentContext;
|
|
334
|
+
//#endregion
|
|
335
|
+
//#region src/core/domain/memory/value-objects/scope.d.ts
|
|
336
|
+
type MemoryScope$1 = "conversation" | "agent-private" | "project" | "shared-user-profile";
|
|
337
|
+
//#endregion
|
|
338
|
+
//#region src/core/domain/memory/value-objects/binding.d.ts
|
|
339
|
+
interface MemoryBinding {
|
|
340
|
+
readonly agentId: string;
|
|
341
|
+
readonly conversationId?: string;
|
|
342
|
+
readonly projectId?: string;
|
|
343
|
+
readonly scope: MemoryScope$1;
|
|
344
|
+
readonly subjectId: string;
|
|
345
|
+
readonly tenantId: string;
|
|
346
|
+
}
|
|
347
|
+
//#endregion
|
|
348
|
+
//#region src/core/domain/memory/aggregate/snapshot.d.ts
|
|
349
|
+
type MemoryState = "proposed" | "confirmed" | "superseded" | "tombstoned";
|
|
350
|
+
type MemoryRecordSnapshot = Readonly<{
|
|
351
|
+
readonly content: string;
|
|
352
|
+
readonly conversationSafe: boolean;
|
|
353
|
+
readonly id: string;
|
|
354
|
+
readonly revision: number;
|
|
355
|
+
readonly scope: MemoryScope$1;
|
|
356
|
+
readonly state: MemoryState;
|
|
357
|
+
readonly tombstoneReason?: string;
|
|
358
|
+
readonly [extension: string]: unknown;
|
|
359
|
+
}>;
|
|
360
|
+
type AgentMemorySnapshot = Readonly<{
|
|
361
|
+
readonly binding: MemoryBinding;
|
|
362
|
+
readonly record: MemoryRecordSnapshot;
|
|
363
|
+
readonly [extension: string]: unknown;
|
|
364
|
+
}>;
|
|
365
|
+
//#endregion
|
|
366
|
+
//#region src/core/domain/memory/aggregate/memory-record.d.ts
|
|
367
|
+
interface ConfirmMemoryRecordInput {
|
|
368
|
+
readonly expectedRevision: number;
|
|
369
|
+
readonly conversationSafe?: boolean;
|
|
370
|
+
}
|
|
371
|
+
interface TombstoneMemoryRecordInput {
|
|
372
|
+
readonly expectedRevision: number;
|
|
373
|
+
readonly reason?: string;
|
|
374
|
+
}
|
|
375
|
+
//#endregion
|
|
376
|
+
//#region src/core/application/memory/ports/agent-memory-repository.d.ts
|
|
377
|
+
declare class AgentMemoryRepositoryConflict extends Error {
|
|
378
|
+
readonly name = "AgentMemoryRepositoryConflict";
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* Repository implementations exchange this transition-capable record with the
|
|
382
|
+
* application service. The domain aggregate remains an internal construction
|
|
383
|
+
* detail of Runtime and is not part of the persistence port.
|
|
384
|
+
*/
|
|
385
|
+
interface AgentMemoryRepositoryRecord extends MemoryRecordSnapshot {
|
|
386
|
+
readonly binding: MemoryBinding;
|
|
387
|
+
readonly scope: MemoryScope$1;
|
|
388
|
+
readonly state: MemoryState;
|
|
389
|
+
confirm(input: ConfirmMemoryRecordInput): AgentMemoryRepositoryRecord;
|
|
390
|
+
tombstone(input: TombstoneMemoryRecordInput): AgentMemoryRepositoryRecord;
|
|
391
|
+
forget(input: TombstoneMemoryRecordInput): AgentMemoryRepositoryRecord;
|
|
392
|
+
validateTransitionTo(next: AgentMemoryRepositoryRecord): boolean;
|
|
393
|
+
toSnapshot(): AgentMemorySnapshot;
|
|
394
|
+
}
|
|
395
|
+
interface AgentMemoryRepository {
|
|
396
|
+
get(binding: MemoryBinding, id: string): Effect.Effect<AgentMemoryRepositoryRecord | undefined, unknown>;
|
|
397
|
+
list(binding: MemoryBinding): Effect.Effect<ReadonlyArray<AgentMemoryRepositoryRecord>, unknown>;
|
|
398
|
+
save(snapshot: AgentMemorySnapshot): Effect.Effect<AgentMemoryRepositoryRecord, unknown>;
|
|
399
|
+
}
|
|
400
|
+
//#endregion
|
|
401
|
+
//#region src/core/application/memory/commands/agent-memory-service.d.ts
|
|
402
|
+
interface MemorySearchQuery {
|
|
403
|
+
readonly query: string;
|
|
404
|
+
}
|
|
405
|
+
interface MemoryHandle {
|
|
406
|
+
readonly namespace: string;
|
|
407
|
+
readonly scope: MemoryScope$1;
|
|
408
|
+
confirm(input: {
|
|
409
|
+
readonly id: string;
|
|
410
|
+
readonly expectedRevision: number;
|
|
411
|
+
readonly conversationSafe?: boolean;
|
|
412
|
+
}): Effect.Effect<MemoryRecordSnapshot, unknown>;
|
|
413
|
+
forgetRequest(input: {
|
|
414
|
+
readonly expectedRevision: number;
|
|
415
|
+
readonly id: string;
|
|
416
|
+
readonly reason?: string;
|
|
417
|
+
}): Effect.Effect<MemoryRecordSnapshot, unknown>;
|
|
418
|
+
inspect(id: string): Effect.Effect<MemoryRecordSnapshot | undefined, unknown>;
|
|
419
|
+
propose(input: {
|
|
420
|
+
readonly content: string;
|
|
421
|
+
}): Effect.Effect<MemoryRecordSnapshot, unknown>;
|
|
422
|
+
read(id: string): Effect.Effect<MemoryRecordSnapshot | undefined, unknown>;
|
|
423
|
+
search(query: MemorySearchQuery): Effect.Effect<ReadonlyArray<MemoryRecordSnapshot>, unknown>;
|
|
424
|
+
}
|
|
425
|
+
interface MemoryService {
|
|
426
|
+
bind(binding: MemoryBinding): MemoryHandle;
|
|
427
|
+
}
|
|
428
|
+
interface MemoryIdentity {
|
|
429
|
+
next(): string;
|
|
430
|
+
}
|
|
431
|
+
declare class AgentMemoryError extends Error {
|
|
432
|
+
readonly name = "AgentMemoryError";
|
|
433
|
+
}
|
|
434
|
+
declare function createMemoryService(options: {
|
|
435
|
+
readonly identity: MemoryIdentity;
|
|
436
|
+
readonly repository: AgentMemoryRepository;
|
|
437
|
+
}): MemoryService;
|
|
438
|
+
//#endregion
|
|
439
|
+
//#region src/adapters/agent/memory/memory-handle-contract.d.ts
|
|
440
|
+
/** Shared Promise handle shape used by the canonical and legacy Memory DTOs. */
|
|
441
|
+
interface MemoryHandleContract<MemoryRecord> {
|
|
442
|
+
readonly namespace: string;
|
|
443
|
+
readonly scope: MemoryScope$1;
|
|
444
|
+
confirm(input: {
|
|
445
|
+
readonly id: string;
|
|
446
|
+
readonly expectedRevision: number;
|
|
447
|
+
readonly conversationSafe?: boolean;
|
|
448
|
+
}): Promise<MemoryRecord>;
|
|
449
|
+
forgetRequest(input: {
|
|
450
|
+
readonly expectedRevision: number;
|
|
451
|
+
readonly id: string;
|
|
452
|
+
readonly reason?: string;
|
|
453
|
+
}): Promise<MemoryRecord>;
|
|
454
|
+
inspect(id: string): Promise<MemoryRecord | undefined>;
|
|
455
|
+
propose(input: {
|
|
456
|
+
readonly content: string;
|
|
457
|
+
}): Promise<MemoryRecord>;
|
|
458
|
+
read(id: string): Promise<MemoryRecord | undefined>;
|
|
459
|
+
search(query: MemorySearchQuery): Promise<ReadonlyArray<MemoryRecord>>;
|
|
460
|
+
}
|
|
461
|
+
//#endregion
|
|
462
|
+
//#region src/adapters/agent/memory/agent-memory-access.d.ts
|
|
463
|
+
declare const MEMORY_SCOPES: readonly ["conversation", "agent-private", "project", "shared-user-profile"];
|
|
464
|
+
type MemoryScope = MemoryScope$1;
|
|
465
|
+
type AgentMemoryRecord = MemoryRecordSnapshot;
|
|
466
|
+
type MemoryInvocationAudience = "group" | "private";
|
|
467
|
+
interface AgentMemoryIdentity {
|
|
468
|
+
readonly audience: MemoryInvocationAudience;
|
|
469
|
+
readonly conversationId?: string;
|
|
470
|
+
readonly projectId?: string;
|
|
471
|
+
readonly subjectId: string;
|
|
472
|
+
readonly tenantId: string;
|
|
473
|
+
}
|
|
474
|
+
interface AgentMemoryAuthority extends AgentMemoryIdentity {
|
|
475
|
+
readonly scopes: ReadonlyArray<MemoryScope>;
|
|
476
|
+
}
|
|
477
|
+
/** Promise-based Memory access used by the Host tool compatibility boundary. */
|
|
478
|
+
interface AgentMemoryHandle extends MemoryHandleContract<AgentMemoryRecord> {}
|
|
479
|
+
/** Consumer-owned port implemented by Memory compatibility adapters. */
|
|
480
|
+
interface AgentMemoryService {
|
|
481
|
+
bind(binding: MemoryBinding): AgentMemoryHandle;
|
|
482
|
+
}
|
|
483
|
+
//#endregion
|
|
484
|
+
//#region src/adapters/agent/memory/rivus-memory-tool-contract.d.ts
|
|
485
|
+
declare const RIVUS_MEMORY_TOOL_ID = "memory";
|
|
486
|
+
declare const RIVUS_MEMORY_TOOL_PLUGIN_ID = "rivus-core";
|
|
487
|
+
declare const RIVUS_MEMORY_TOOL_VERSION = "1.0.0";
|
|
488
|
+
declare function createRivusMemoryToolContract(scopes: ReadonlyArray<MemoryScope>): Readonly<{
|
|
489
|
+
description: "Search and read Memory inside Host-bound scopes; propose or request forgetting only in writable private scopes.";
|
|
490
|
+
digest: "sha256:rivus-memory-v3";
|
|
491
|
+
id: "memory";
|
|
492
|
+
idempotency: "required";
|
|
493
|
+
inputSchema: Readonly<{
|
|
494
|
+
additionalProperties: false;
|
|
495
|
+
properties: {
|
|
496
|
+
scope?: {
|
|
497
|
+
description: string;
|
|
498
|
+
enum: MemoryScope$1[];
|
|
499
|
+
type: string;
|
|
500
|
+
};
|
|
501
|
+
command: {
|
|
502
|
+
description: string;
|
|
503
|
+
enum: string[];
|
|
504
|
+
type: string;
|
|
505
|
+
};
|
|
506
|
+
id: {
|
|
507
|
+
description: string;
|
|
508
|
+
minLength: number;
|
|
509
|
+
type: string;
|
|
510
|
+
};
|
|
511
|
+
input: {
|
|
512
|
+
additionalProperties: boolean;
|
|
513
|
+
description: string;
|
|
514
|
+
properties: {
|
|
515
|
+
content: {
|
|
516
|
+
minLength: number;
|
|
517
|
+
type: string;
|
|
518
|
+
};
|
|
519
|
+
};
|
|
520
|
+
required: string[];
|
|
521
|
+
type: string;
|
|
522
|
+
};
|
|
523
|
+
query: {
|
|
524
|
+
additionalProperties: boolean;
|
|
525
|
+
description: string;
|
|
526
|
+
properties: {
|
|
527
|
+
query: {
|
|
528
|
+
type: string;
|
|
529
|
+
};
|
|
530
|
+
};
|
|
531
|
+
required: string[];
|
|
532
|
+
type: string;
|
|
533
|
+
};
|
|
534
|
+
reason: {
|
|
535
|
+
description: string;
|
|
536
|
+
type: string;
|
|
537
|
+
};
|
|
538
|
+
};
|
|
539
|
+
required: string[];
|
|
540
|
+
type: "object";
|
|
541
|
+
}>;
|
|
542
|
+
risk: "mutate";
|
|
543
|
+
version: "1.0.0";
|
|
544
|
+
}>;
|
|
545
|
+
//#endregion
|
|
546
|
+
//#region src/adapters/agent/memory/memory-tool-contract.d.ts
|
|
547
|
+
interface MemoryTombstoneReceipt {
|
|
548
|
+
readonly id: string;
|
|
549
|
+
readonly revision: number;
|
|
550
|
+
readonly scope: MemoryScope$1;
|
|
551
|
+
readonly state: "tombstoned";
|
|
552
|
+
}
|
|
553
|
+
/** Shared command protocol; each Memory surface supplies its own record DTO. */
|
|
554
|
+
interface MemoryToolContract<MemoryRecord> {
|
|
555
|
+
execute(command: {
|
|
556
|
+
readonly command: "forget_request";
|
|
557
|
+
readonly id: string;
|
|
558
|
+
readonly reason?: string;
|
|
559
|
+
}): Promise<MemoryTombstoneReceipt>;
|
|
560
|
+
execute(command: {
|
|
561
|
+
readonly command: "propose";
|
|
562
|
+
readonly input: {
|
|
563
|
+
readonly content: string;
|
|
564
|
+
};
|
|
565
|
+
readonly scope?: Exclude<MemoryScope$1, "shared-user-profile">;
|
|
566
|
+
}): Promise<MemoryRecord>;
|
|
567
|
+
execute(command: {
|
|
568
|
+
readonly command: "read";
|
|
569
|
+
readonly id: string;
|
|
570
|
+
}): Promise<MemoryRecord | undefined>;
|
|
571
|
+
execute(command: {
|
|
572
|
+
readonly command: "search";
|
|
573
|
+
readonly query: MemorySearchQuery;
|
|
574
|
+
readonly scope?: MemoryScope$1;
|
|
575
|
+
}): Promise<ReadonlyArray<MemoryRecord>>;
|
|
576
|
+
replayCompleted(command: unknown, completedResult: unknown): Promise<unknown>;
|
|
577
|
+
}
|
|
578
|
+
//#endregion
|
|
579
|
+
//#region src/adapters/agent/memory/rivus-memory-tool.d.ts
|
|
580
|
+
interface RivusMemoryTool extends MemoryToolContract<AgentMemoryRecord> {}
|
|
581
|
+
declare function createRivusMemoryTool(memory: AgentMemoryHandle | ReadonlyArray<AgentMemoryHandle>): RivusMemoryTool;
|
|
582
|
+
declare function createRivusMemoryToolDescriptor(options: {
|
|
583
|
+
readonly memory: AgentMemoryService;
|
|
584
|
+
}): RivusHostToolDescriptor;
|
|
585
|
+
//#endregion
|
|
586
|
+
//#region src/adapters/agent/memory/project-memory-prompt-preparer.d.ts
|
|
587
|
+
interface ProjectMemoryRecallOptions {
|
|
588
|
+
readonly agentId: string;
|
|
589
|
+
readonly memory: AgentMemoryService;
|
|
590
|
+
readonly projectId: string;
|
|
591
|
+
readonly maxBytes?: number;
|
|
592
|
+
readonly maxRecords?: number;
|
|
593
|
+
readonly identity?: ProjectMemoryRecallIdentity;
|
|
594
|
+
}
|
|
595
|
+
interface ProjectMemoryRecallIdentity {
|
|
596
|
+
readonly subjectId: string;
|
|
597
|
+
readonly tenantId: string;
|
|
598
|
+
}
|
|
599
|
+
interface ProjectMemoryPromptInput {
|
|
600
|
+
readonly invocation?: AgentInvocationOrigin;
|
|
601
|
+
readonly text: string;
|
|
602
|
+
}
|
|
603
|
+
declare function createProjectMemoryPromptPreparer(options: ProjectMemoryRecallOptions): (input: ProjectMemoryPromptInput) => Promise<string>;
|
|
604
|
+
//#endregion
|
|
605
|
+
//#region src/adapters/agent/workspace/agents-md-instructions-source.d.ts
|
|
606
|
+
declare function createAgentsMdInstructionsSource(): WorkspaceInstructionsSourcePort;
|
|
607
|
+
//#endregion
|
|
608
|
+
//#region src/adapters/agent/workspace/node-workspace-root-registry.d.ts
|
|
609
|
+
declare function createWorkspaceRootHandle(rootPath: string): Promise<WorkspaceRootHandle>;
|
|
610
|
+
declare function resolveWorkspaceRootPath(handle: WorkspaceRootHandle): string;
|
|
611
|
+
//#endregion
|
|
612
|
+
//#region src/adapters/agent/memory/persisted-memory-record.d.ts
|
|
613
|
+
/** Persistence codecs use this named transition surface without publishing the domain aggregate class. */
|
|
614
|
+
interface PersistedMemoryRecord extends AgentMemoryRepositoryRecord, AgentMemoryRecord {
|
|
615
|
+
readonly binding: MemoryBinding;
|
|
616
|
+
confirm(input: {
|
|
617
|
+
readonly expectedRevision: number;
|
|
618
|
+
readonly conversationSafe?: boolean;
|
|
619
|
+
}): PersistedMemoryRecord;
|
|
620
|
+
tombstone(input: {
|
|
621
|
+
readonly expectedRevision: number;
|
|
622
|
+
readonly reason?: string;
|
|
623
|
+
}): PersistedMemoryRecord;
|
|
624
|
+
forget(input: {
|
|
625
|
+
readonly expectedRevision: number;
|
|
626
|
+
readonly reason?: string;
|
|
627
|
+
}): PersistedMemoryRecord;
|
|
628
|
+
validateTransitionTo(next: PersistedMemoryRecord): boolean;
|
|
629
|
+
toSnapshot(): AgentMemorySnapshot;
|
|
630
|
+
}
|
|
631
|
+
declare function createPersistedMemoryRecord(input: {
|
|
632
|
+
readonly binding: MemoryBinding;
|
|
633
|
+
readonly content: string;
|
|
634
|
+
readonly id: string;
|
|
635
|
+
}): PersistedMemoryRecord;
|
|
636
|
+
declare function restorePersistedMemoryRecord(snapshot: unknown): PersistedMemoryRecord;
|
|
637
|
+
//#endregion
|
|
638
|
+
//#region src/adapters/observability/content/telemetry-content-redactor.d.ts
|
|
639
|
+
interface TelemetryContentRedactorOptions {
|
|
640
|
+
readonly maxArrayItems?: number;
|
|
641
|
+
readonly maxDepth?: number;
|
|
642
|
+
readonly maxObjectKeys?: number;
|
|
643
|
+
readonly maxSerializedLength?: number;
|
|
644
|
+
readonly maxStringLength?: number;
|
|
645
|
+
}
|
|
646
|
+
type TelemetryContentRedactor = (value: unknown) => string;
|
|
647
|
+
declare function createTelemetryContentRedactor(options?: TelemetryContentRedactorOptions): TelemetryContentRedactor;
|
|
648
|
+
//#endregion
|
|
649
|
+
//#region src/adapters/observability/agent/langfuse-agent-telemetry.d.ts
|
|
650
|
+
type LangfuseTelemetryEnv = Readonly<Record<string, string | undefined>>;
|
|
651
|
+
type LangfuseTelemetryContentMode = "metadata-only" | "redacted";
|
|
652
|
+
interface LangfuseTelemetryConfig {
|
|
653
|
+
readonly contentMode?: LangfuseTelemetryContentMode;
|
|
654
|
+
readonly endpoint: string;
|
|
655
|
+
readonly environment: string;
|
|
656
|
+
readonly publicKey: string;
|
|
657
|
+
readonly secretKey: string;
|
|
658
|
+
readonly serviceName: string;
|
|
659
|
+
}
|
|
660
|
+
interface LangfuseAgentTelemetry {
|
|
661
|
+
readonly modelContentObserver: AgentModelContentObserver;
|
|
662
|
+
readonly sink: AgentDomainEventSink;
|
|
663
|
+
forceFlush(): Promise<void>;
|
|
664
|
+
shutdown(): Promise<void>;
|
|
665
|
+
}
|
|
666
|
+
declare class LangfuseTelemetryConfigError extends Error {
|
|
667
|
+
constructor(message: string);
|
|
668
|
+
}
|
|
669
|
+
declare function resolveLangfuseTelemetryConfig(env: LangfuseTelemetryEnv): LangfuseTelemetryConfig | undefined;
|
|
670
|
+
declare function createLangfuseAgentTelemetry(config: LangfuseTelemetryConfig): LangfuseAgentTelemetry;
|
|
671
|
+
//#endregion
|
|
672
|
+
//#region src/adapters/observability/agent/open-telemetry-agent-event-sink.d.ts
|
|
673
|
+
interface OpenTelemetryAgentEventSinkOptions {
|
|
674
|
+
readonly captureContent?: boolean;
|
|
675
|
+
readonly onProjectionError?: (error: unknown, event: AgentDomainEvent) => Promise<void> | void;
|
|
676
|
+
readonly redactContent?: TelemetryContentRedactor;
|
|
677
|
+
readonly tracer: Tracer;
|
|
678
|
+
}
|
|
679
|
+
interface OpenTelemetryAgentTelemetry {
|
|
680
|
+
readonly modelContentObserver: AgentModelContentObserver;
|
|
681
|
+
readonly sink: AgentDomainEventSink;
|
|
682
|
+
}
|
|
683
|
+
declare function createOpenTelemetryAgentEventSink(options: OpenTelemetryAgentEventSinkOptions): AgentDomainEventSink;
|
|
684
|
+
declare function createOpenTelemetryAgentTelemetry(options: OpenTelemetryAgentEventSinkOptions): OpenTelemetryAgentTelemetry;
|
|
685
|
+
//#endregion
|
|
686
|
+
//#region src/core/domain/tool-operation/value-objects/binding.d.ts
|
|
687
|
+
interface ToolOperationBinding$1 {
|
|
688
|
+
readonly agentId: string;
|
|
689
|
+
readonly inputDigest: string;
|
|
690
|
+
readonly instanceId: string;
|
|
691
|
+
readonly sourceMessageId: string;
|
|
692
|
+
readonly toolId: string;
|
|
693
|
+
readonly toolVersion: string;
|
|
694
|
+
}
|
|
695
|
+
//#endregion
|
|
696
|
+
//#region src/core/domain/tool-operation/aggregate/snapshot.d.ts
|
|
697
|
+
type ToolOperationState$1 = {
|
|
698
|
+
readonly status: "pending";
|
|
699
|
+
} | {
|
|
700
|
+
readonly result: unknown;
|
|
701
|
+
readonly status: "completed";
|
|
702
|
+
} | {
|
|
703
|
+
readonly reason: string;
|
|
704
|
+
readonly status: "reconciliation-required";
|
|
705
|
+
} | {
|
|
706
|
+
readonly status: "aborted";
|
|
707
|
+
};
|
|
708
|
+
interface ToolOperationReconciliationAction {
|
|
709
|
+
readonly actorId: string;
|
|
710
|
+
readonly at: string;
|
|
711
|
+
readonly note: string;
|
|
712
|
+
}
|
|
713
|
+
interface ToolOperationReconciliation$1 extends ToolOperationReconciliationAction {
|
|
714
|
+
readonly outcome: "applied" | "not-applied";
|
|
715
|
+
}
|
|
716
|
+
interface ToolOperationSnapshot {
|
|
717
|
+
readonly binding: ToolOperationBinding$1;
|
|
718
|
+
readonly operationId: string;
|
|
719
|
+
readonly reconciliation?: ToolOperationReconciliation$1;
|
|
720
|
+
readonly revision: number;
|
|
721
|
+
readonly state: ToolOperationState$1;
|
|
722
|
+
}
|
|
723
|
+
type ToolOperationRecord$1 = ToolOperationSnapshot;
|
|
724
|
+
type ToolOperationReconciliationOutcome$1 = {
|
|
725
|
+
readonly result: unknown;
|
|
726
|
+
readonly status: "applied";
|
|
727
|
+
} | {
|
|
728
|
+
readonly status: "not-applied";
|
|
729
|
+
};
|
|
730
|
+
type ToolOperationBeginResult$1 = {
|
|
731
|
+
readonly status: "acquired";
|
|
732
|
+
} | {
|
|
733
|
+
readonly result: unknown;
|
|
734
|
+
readonly status: "completed";
|
|
735
|
+
} | {
|
|
736
|
+
readonly status: "blocked";
|
|
737
|
+
readonly reason: string;
|
|
738
|
+
};
|
|
739
|
+
type ToolOperationInspectResult$1 = {
|
|
740
|
+
readonly status: "missing";
|
|
741
|
+
} | {
|
|
742
|
+
readonly result: unknown;
|
|
743
|
+
readonly status: "completed";
|
|
744
|
+
} | {
|
|
745
|
+
readonly status: "blocked";
|
|
746
|
+
readonly reason: string;
|
|
747
|
+
};
|
|
748
|
+
//#endregion
|
|
749
|
+
//#region src/core/domain/tool-operation/aggregate/tool-operation.d.ts
|
|
750
|
+
interface CreateToolOperationInput {
|
|
751
|
+
readonly binding: ToolOperationBinding$1;
|
|
752
|
+
readonly operationId: string;
|
|
753
|
+
}
|
|
754
|
+
interface ReconcileToolOperationInput {
|
|
755
|
+
readonly action: ToolOperationReconciliationAction;
|
|
756
|
+
readonly expectedRevision: number;
|
|
757
|
+
readonly operationId: string;
|
|
758
|
+
readonly outcome: ToolOperationReconciliationOutcome$1;
|
|
759
|
+
}
|
|
760
|
+
/** Immutable transitions do not serialize concurrent writes; the ledger serializes persisted transitions. */
|
|
761
|
+
declare class ToolOperation {
|
|
762
|
+
#private;
|
|
763
|
+
private constructor();
|
|
764
|
+
static create(input: CreateToolOperationInput): ToolOperation;
|
|
765
|
+
static restore(value: unknown): ToolOperation;
|
|
766
|
+
get binding(): ToolOperationBinding$1;
|
|
767
|
+
get operationId(): string;
|
|
768
|
+
get reconciliation(): ToolOperationReconciliation$1 | undefined;
|
|
769
|
+
get revision(): number;
|
|
770
|
+
get state(): ToolOperationState$1;
|
|
771
|
+
matchesBinding(binding: ToolOperationBinding$1): boolean;
|
|
772
|
+
complete(result: unknown): ToolOperation;
|
|
773
|
+
abort(): ToolOperation;
|
|
774
|
+
requireReconciliation(reason: string): ToolOperation;
|
|
775
|
+
retry(): ToolOperation;
|
|
776
|
+
recoverInterrupted(): ToolOperation;
|
|
777
|
+
reconcile(input: ReconcileToolOperationInput): ToolOperation;
|
|
778
|
+
validateTransitionTo(next: ToolOperation): boolean;
|
|
779
|
+
toSnapshot(): ToolOperationSnapshot;
|
|
780
|
+
private requirePending;
|
|
781
|
+
private next;
|
|
782
|
+
}
|
|
783
|
+
//#endregion
|
|
784
|
+
//#region src/core/domain/tool-operation/factories/restore-tool-operation.d.ts
|
|
785
|
+
declare function restoreToolOperation(snapshot: unknown): ToolOperation;
|
|
786
|
+
//#endregion
|
|
787
|
+
//#region src/core/application/recovery/recovery-action.d.ts
|
|
788
|
+
/** The audited actor, timestamp, and note shared by recovery operations. */
|
|
789
|
+
interface RecoveryAction extends ToolOperationReconciliationAction {}
|
|
790
|
+
declare class InvalidRecoveryAction extends Error {
|
|
791
|
+
readonly name = "InvalidRecoveryAction";
|
|
792
|
+
}
|
|
793
|
+
declare function createRecoveryAction(input: RecoveryAction): RecoveryAction;
|
|
794
|
+
//#endregion
|
|
795
|
+
//#region src/core/application/agent-execution/execution/agent-harness.d.ts
|
|
796
|
+
declare function createAgentHarness(options: AgentHarnessOptions): AgentHarness;
|
|
797
|
+
//#endregion
|
|
798
|
+
//#region src/core/application/agent-execution/execution/agent-event-sink.d.ts
|
|
799
|
+
declare function createAgentDomainEventSink(append: (event: AgentDomainEvent) => Effect.Effect<void, unknown>): AgentDomainEventSink;
|
|
800
|
+
//#endregion
|
|
801
|
+
//#region src/core/application/agent-execution/execution/agent-loop-event-mapper.d.ts
|
|
802
|
+
declare function describeLoopError(error: unknown): string;
|
|
803
|
+
declare function toDomainEvent(runId: AgentRunId, sessionKey: SessionKey, event: AgentLoopEvent, occurredAt: Date): AgentDomainEvent;
|
|
804
|
+
//#endregion
|
|
805
|
+
//#region src/core/application/agent-execution/history/agent-run-state-projection.d.ts
|
|
806
|
+
declare const initialAgentRunState: AgentRunState;
|
|
807
|
+
declare function isTerminalAgentRunPhase(phase: AgentRunPhase): boolean;
|
|
808
|
+
declare function evolveAgentRun(state: AgentRunState, event: AgentDomainEvent): AgentRunState;
|
|
809
|
+
//#endregion
|
|
810
|
+
//#region src/core/application/agent-execution/history/restore-agent-history.d.ts
|
|
811
|
+
interface AgentHistoryEventLog {
|
|
812
|
+
readAll(): Effect.Effect<ReadonlyArray<AgentDomainEvent>, unknown>;
|
|
813
|
+
}
|
|
814
|
+
declare function restoreAgentHistory(eventLog: AgentHistoryEventLog): Effect.Effect<AgentHistory, unknown>;
|
|
815
|
+
//#endregion
|
|
816
|
+
//#region src/core/application/agent-execution/query/agent-execution-query-store.d.ts
|
|
817
|
+
interface AgentExecutionQueryStore {
|
|
818
|
+
project(event: AgentDomainEvent): AgentRunUpdate;
|
|
819
|
+
getHistory(): AgentHistory;
|
|
820
|
+
getLatestState(): AgentRunState;
|
|
821
|
+
getRunEvents(runId: AgentRunId): ReadonlyArray<AgentDomainEvent> | undefined;
|
|
822
|
+
getRunSnapshot(runId: AgentRunId): AgentRunSnapshot | undefined;
|
|
823
|
+
getRunState(runId: AgentRunId): AgentRunState | undefined;
|
|
824
|
+
getRunSummary(runId: AgentRunId): AgentRunSummary | undefined;
|
|
825
|
+
getRunUpdates(runId: AgentRunId): ReadonlyArray<AgentRunUpdate> | undefined;
|
|
826
|
+
getSessionHistory(sessionKey: SessionKey): AgentHistory;
|
|
827
|
+
getSessionLatestRunSnapshot(sessionKey: SessionKey): AgentRunSnapshot | undefined;
|
|
828
|
+
getSessionLatestRunSummary(sessionKey: SessionKey): AgentRunSummary | undefined;
|
|
829
|
+
getSessionRunEvents(sessionKey: SessionKey, runId: AgentRunId): ReadonlyArray<AgentDomainEvent> | undefined;
|
|
830
|
+
getSessionRunSnapshot(sessionKey: SessionKey, runId: AgentRunId): AgentRunSnapshot | undefined;
|
|
831
|
+
getSessionRunState(sessionKey: SessionKey, runId: AgentRunId): AgentRunState | undefined;
|
|
832
|
+
getSessionRunSummary(sessionKey: SessionKey, runId: AgentRunId): AgentRunSummary | undefined;
|
|
833
|
+
getSessionRunUpdates(sessionKey: SessionKey, runId: AgentRunId): ReadonlyArray<AgentRunUpdate> | undefined;
|
|
834
|
+
getSessionRuns(sessionKey: SessionKey): ReadonlyArray<AgentRunSummary>;
|
|
835
|
+
getSessionSnapshot(sessionKey: SessionKey, availability: AgentSessionAvailability): AgentSessionSnapshot;
|
|
836
|
+
getSessionState(sessionKey: SessionKey): AgentRunState | undefined;
|
|
837
|
+
getSessionSummary(sessionKey: SessionKey): AgentSessionSummary | undefined;
|
|
838
|
+
getSessionTranscript(sessionKey: SessionKey): AgentTranscript;
|
|
839
|
+
subscribe(listener: AgentDomainEventListener): () => void;
|
|
840
|
+
subscribeRun(runId: AgentRunId, listener: AgentDomainEventListener): () => void;
|
|
841
|
+
subscribeRunUpdates(runId: AgentRunId, listener: AgentRunUpdateListener): () => void;
|
|
842
|
+
subscribeSession(sessionKey: SessionKey, listener: AgentDomainEventListener): () => void;
|
|
843
|
+
subscribeSessionRun(sessionKey: SessionKey, runId: AgentRunId, listener: AgentDomainEventListener): () => void;
|
|
844
|
+
subscribeSessionRunUpdates(sessionKey: SessionKey, runId: AgentRunId, listener: AgentRunUpdateListener): () => void;
|
|
845
|
+
subscribeSessionUpdates(sessionKey: SessionKey, listener: AgentRunUpdateListener): () => void;
|
|
846
|
+
subscribeUpdates(listener: AgentRunUpdateListener): () => void;
|
|
847
|
+
}
|
|
848
|
+
interface AgentExecutionQueryStoreOptions {
|
|
849
|
+
readonly initialEvents?: ReadonlyArray<AgentDomainEvent>;
|
|
850
|
+
readonly initialRunStates?: ReadonlyArray<AgentRunState>;
|
|
851
|
+
}
|
|
852
|
+
declare function createAgentExecutionQueryStore(options?: AgentExecutionQueryStoreOptions): AgentExecutionQueryStore;
|
|
853
|
+
//#endregion
|
|
854
|
+
//#region src/core/application/agent-execution/query/agent-event-notifications.d.ts
|
|
855
|
+
declare function notifyListeners(listeners: Iterable<AgentDomainEventListener>, event: AgentDomainEvent): void;
|
|
856
|
+
declare function notifyUpdateListeners(listeners: Iterable<AgentRunUpdateListener>, update: AgentRunUpdate): void;
|
|
857
|
+
//#endregion
|
|
858
|
+
//#region src/core/application/agent-execution/query/agent-run-projection.d.ts
|
|
859
|
+
declare function toRunUpdate(event: AgentDomainEvent, state: AgentRunState, previousState: AgentRunState | undefined): AgentRunUpdate;
|
|
860
|
+
declare function replayRunUpdates(events: ReadonlyArray<AgentDomainEvent>): ReadonlyArray<AgentRunUpdate>;
|
|
861
|
+
declare function buildRunSnapshot(runId: AgentRunId, events: ReadonlyArray<AgentDomainEvent>, updates: ReadonlyArray<AgentRunUpdate>, state?: AgentRunState, summary?: AgentRunSummary): AgentRunSnapshot;
|
|
862
|
+
//#endregion
|
|
863
|
+
//#region src/core/application/agent-execution/query/agent-session-history.d.ts
|
|
864
|
+
interface AgentSessionHistoryView {
|
|
865
|
+
readonly history: AgentHistory;
|
|
866
|
+
readonly latestRunSummary?: AgentRunSummary;
|
|
867
|
+
readonly runs: ReadonlyArray<AgentRunSummary>;
|
|
868
|
+
readonly summary?: AgentSessionSummary;
|
|
869
|
+
readonly transcript: AgentTranscript;
|
|
870
|
+
}
|
|
871
|
+
declare function projectAgentSessionHistory(events: ReadonlyArray<AgentDomainEvent>, runStates: ReadonlyMap<AgentRunId, AgentRunState>, sessionKey: SessionKey): AgentSessionHistoryView;
|
|
872
|
+
declare function buildAgentSessionSnapshot(input: {
|
|
873
|
+
readonly availability: AgentSessionAvailability;
|
|
874
|
+
readonly sessionKey: SessionKey;
|
|
875
|
+
readonly state?: AgentRunState;
|
|
876
|
+
readonly view: AgentSessionHistoryView;
|
|
877
|
+
}): AgentSessionSnapshot;
|
|
878
|
+
//#endregion
|
|
879
|
+
//#region src/core/application/agent-execution/run-admission/run-admission.d.ts
|
|
880
|
+
/**
|
|
881
|
+
* Home-wide run admission shared by every foreground/background runtime.
|
|
882
|
+
*
|
|
883
|
+
* This is the single execution-side admission mechanism. The Gateway
|
|
884
|
+
* coordinator wraps it with the model-change request identity and drain
|
|
885
|
+
* deadline via the `ModelChangeBoundaryPort` adapter in the deployment
|
|
886
|
+
* boundary; no second counter or parallel lifecycle is created.
|
|
887
|
+
*/
|
|
888
|
+
declare function createRunAdmission(options: RunAdmissionOptions): RunAdmission;
|
|
889
|
+
declare function remainingUntil(clock: ModelChangeClock, deadlineAt: string): number;
|
|
890
|
+
//#endregion
|
|
891
|
+
//#region src/core/application/agent-execution/streaming/agent-run-streams.d.ts
|
|
892
|
+
type AgentPromptExecutor = <R>(command: PromptCommand, emit: (event: AgentDomainEvent, state: AgentRunState, previousState: AgentRunState | undefined) => Effect.Effect<void, unknown, R>, interruptionReason?: string) => Effect.Effect<AgentPromptResult, AgentHarnessError, R>;
|
|
893
|
+
interface AgentRunStreams {
|
|
894
|
+
events(command: PromptCommand): Stream.Stream<AgentDomainEvent, AgentHarnessError>;
|
|
895
|
+
text(command: PromptCommand): Stream.Stream<string, AgentHarnessError>;
|
|
896
|
+
updates(command: PromptCommand): Stream.Stream<AgentRunUpdate, AgentHarnessError>;
|
|
897
|
+
}
|
|
898
|
+
declare function createAgentRunStreams(runPrompt: AgentPromptExecutor): AgentRunStreams;
|
|
899
|
+
//#endregion
|
|
900
|
+
//#region src/core/application/memory/commands/memory-binding.d.ts
|
|
901
|
+
declare function normalizeMemoryBinding(binding: MemoryBinding): MemoryBinding;
|
|
902
|
+
declare function createMemoryNamespace$1(binding: MemoryBinding): string;
|
|
903
|
+
//#endregion
|
|
904
|
+
//#region src/core/application/memory/ports/compactor.d.ts
|
|
905
|
+
interface CompactionInput {
|
|
906
|
+
readonly tenantId: string;
|
|
907
|
+
readonly agentId: string;
|
|
908
|
+
readonly instanceId: string;
|
|
909
|
+
readonly conversationId: string;
|
|
910
|
+
readonly profileRevision: string;
|
|
911
|
+
readonly watermark: number;
|
|
912
|
+
readonly transcript: ReadonlyArray<string>;
|
|
913
|
+
}
|
|
914
|
+
interface CompactorPort {
|
|
915
|
+
compact(input: CompactionInput): Effect.Effect<string, unknown>;
|
|
916
|
+
}
|
|
917
|
+
//#endregion
|
|
918
|
+
//#region src/core/application/memory/compaction/compaction-service.d.ts
|
|
919
|
+
interface CompactionSnapshot extends Omit<CompactionInput, "transcript"> {
|
|
920
|
+
readonly id: string;
|
|
921
|
+
readonly summary: string;
|
|
922
|
+
}
|
|
923
|
+
interface CompactionService {
|
|
924
|
+
createCandidate(input: CompactionInput): Effect.Effect<CompactionSnapshot, unknown>;
|
|
925
|
+
commit(candidateId: string): Effect.Effect<CompactionSnapshot, unknown>;
|
|
926
|
+
current(instanceId: string, conversationId: string): CompactionSnapshot | undefined;
|
|
927
|
+
}
|
|
928
|
+
declare class CompactionError extends Error {
|
|
929
|
+
readonly name = "CompactionError";
|
|
930
|
+
}
|
|
931
|
+
declare function createEffectCompactionService(options: {
|
|
932
|
+
readonly compactor: CompactorPort;
|
|
933
|
+
readonly identity: {
|
|
934
|
+
readonly next: () => string;
|
|
935
|
+
};
|
|
936
|
+
}): CompactionService;
|
|
937
|
+
//#endregion
|
|
938
|
+
//#region src/adapters/outbound/persistence/memory/agent-memory-snapshot-codec.d.ts
|
|
939
|
+
declare const AGENT_MEMORY_JSONL_VERSION = 1;
|
|
940
|
+
declare function encodeAgentMemorySnapshot(snapshot: AgentMemorySnapshot): string;
|
|
941
|
+
declare function decodeAgentMemorySnapshots(raw: string): ReadonlyArray<AgentMemorySnapshot>;
|
|
942
|
+
//#endregion
|
|
943
|
+
//#region src/adapters/outbound/persistence/memory/in-memory-agent-memory-repository.d.ts
|
|
944
|
+
declare function createInMemoryAgentMemoryRepository(options?: {
|
|
945
|
+
readonly initial?: ReadonlyArray<AgentMemorySnapshot>;
|
|
946
|
+
readonly persist?: (snapshot: AgentMemorySnapshot) => Effect.Effect<void, unknown>;
|
|
947
|
+
}): AgentMemoryRepository;
|
|
948
|
+
//#endregion
|
|
949
|
+
//#region src/adapters/outbound/persistence/memory/jsonl-agent-memory-repository.d.ts
|
|
950
|
+
declare function openJsonlAgentMemoryRepository(options: Readonly<{
|
|
951
|
+
readonly filePath: string;
|
|
952
|
+
}>): Effect.Effect<AgentMemoryRepository, unknown>;
|
|
953
|
+
//#endregion
|
|
954
|
+
//#region src/core/application/tool-execution/brokerage/tool-input-digest.d.ts
|
|
955
|
+
declare class InvalidStableJson extends Error {
|
|
956
|
+
readonly name: string;
|
|
957
|
+
}
|
|
958
|
+
declare class InvalidToolInput extends InvalidStableJson {
|
|
959
|
+
readonly name = "InvalidToolInput";
|
|
960
|
+
}
|
|
961
|
+
type ToolInputDigest = (canonicalJson: string) => string;
|
|
962
|
+
declare function createToolInputDigest$1(input: unknown, digest: ToolInputDigest): string;
|
|
963
|
+
declare function normalizeStableJson(value: unknown): unknown;
|
|
964
|
+
//#endregion
|
|
965
|
+
//#region src/core/application/tool-execution/operation/tool-operation-ledger.d.ts
|
|
966
|
+
interface ToolOperationLedger$1 {
|
|
967
|
+
abort(operationId: string, binding: ToolOperationBinding$1): Effect.Effect<void, unknown>;
|
|
968
|
+
begin(operationId: string, binding: ToolOperationBinding$1): Effect.Effect<ToolOperationBeginResult$1, unknown>;
|
|
969
|
+
complete(operationId: string, binding: ToolOperationBinding$1, result: unknown): Effect.Effect<void, unknown>;
|
|
970
|
+
inspect(operationId: string, binding: ToolOperationBinding$1): Effect.Effect<ToolOperationInspectResult$1, unknown>;
|
|
971
|
+
reconciliationRequired(): ReadonlyArray<ToolOperationRecord$1>;
|
|
972
|
+
reconcile(input: {
|
|
973
|
+
readonly action: ToolOperationReconciliationAction;
|
|
974
|
+
readonly expectedRevision: number;
|
|
975
|
+
readonly operationId: string;
|
|
976
|
+
readonly outcome: ToolOperationReconciliationOutcome$1;
|
|
977
|
+
}): Effect.Effect<ToolOperationRecord$1, unknown>;
|
|
978
|
+
requireReconciliation(operationId: string, binding: ToolOperationBinding$1, reason: string): Effect.Effect<void, unknown>;
|
|
979
|
+
unresolvedForSource(sourceMessageId: string): ReadonlyArray<ToolOperationRecord$1>;
|
|
980
|
+
}
|
|
981
|
+
interface ToolOperationLedgerOptions {
|
|
982
|
+
readonly initial?: ReadonlyArray<ToolOperationRecord$1>;
|
|
983
|
+
readonly persist?: (record: ToolOperationRecord$1) => Effect.Effect<void, unknown>;
|
|
984
|
+
}
|
|
985
|
+
declare class ToolOperationLedgerError extends Error {
|
|
986
|
+
readonly name = "ToolOperationLedgerError";
|
|
987
|
+
}
|
|
988
|
+
declare function createToolOperationLedger$1(options?: ToolOperationLedgerOptions): ToolOperationLedger$1;
|
|
989
|
+
//#endregion
|
|
990
|
+
//#region src/core/application/tool-execution/brokerage/tool-broker.d.ts
|
|
991
|
+
interface ToolBrokerOptions {
|
|
992
|
+
readonly approvals: ToolApprovalService;
|
|
993
|
+
readonly catalog: ToolCatalog;
|
|
994
|
+
readonly digest: ToolInputDigest;
|
|
995
|
+
readonly hostTools?: ReadonlyArray<ToolDescriptor>;
|
|
996
|
+
readonly operations?: ToolOperationLedger$1;
|
|
997
|
+
readonly policy: AuthorizationPolicyProvider;
|
|
998
|
+
}
|
|
999
|
+
interface ToolBroker {
|
|
1000
|
+
execute(request: ToolExecutionRequest): Effect.Effect<unknown, unknown>;
|
|
1001
|
+
}
|
|
1002
|
+
declare class ToolInvocationDenied extends Error {
|
|
1003
|
+
readonly name = "ToolInvocationDenied";
|
|
1004
|
+
}
|
|
1005
|
+
declare function createToolBroker(options: ToolBrokerOptions): ToolBroker;
|
|
1006
|
+
//#endregion
|
|
1007
|
+
//#region src/adapters/outbound/persistence/tool-operation/tool-operation-snapshot-codec.d.ts
|
|
1008
|
+
declare const TOOL_OPERATION_JSONL_VERSION = 1;
|
|
1009
|
+
declare function encodeToolOperationSnapshot(record: ToolOperationRecord$1): string;
|
|
1010
|
+
declare function decodeToolOperationSnapshots(raw: string): ReadonlyArray<ToolOperationRecord$1>;
|
|
1011
|
+
//#endregion
|
|
1012
|
+
//#region src/adapters/outbound/persistence/tool-operation/jsonl-tool-operation-ledger.d.ts
|
|
1013
|
+
declare function openJsonlToolOperationLedger(options: {
|
|
1014
|
+
readonly filePath: string;
|
|
1015
|
+
}): Effect.Effect<ToolOperationLedger$1, unknown>;
|
|
1016
|
+
//#endregion
|
|
1017
|
+
//#region src/adapters/outbound/persistence/agent-run/event-log/jsonl-agent-event-log.d.ts
|
|
1018
|
+
type AgentEventLogOperation = "append" | "read";
|
|
1019
|
+
declare class AgentEventLogStoreError {
|
|
1020
|
+
readonly operation: AgentEventLogOperation;
|
|
1021
|
+
readonly cause: unknown;
|
|
1022
|
+
readonly _tag = "AgentEventLogStoreError";
|
|
1023
|
+
constructor(operation: AgentEventLogOperation, cause: unknown);
|
|
1024
|
+
}
|
|
1025
|
+
interface AgentEventLog extends AgentDomainEventSink {
|
|
1026
|
+
append(event: AgentDomainEvent): Effect.Effect<void, AgentEventLogStoreError>;
|
|
1027
|
+
readAll(): Effect.Effect<ReadonlyArray<AgentDomainEvent>, AgentEventLogStoreError>;
|
|
1028
|
+
readRun(runId: AgentRunId): Effect.Effect<ReadonlyArray<AgentDomainEvent>, AgentEventLogStoreError>;
|
|
1029
|
+
}
|
|
1030
|
+
interface JsonlAgentEventLogOptions {
|
|
1031
|
+
readonly filePath: string;
|
|
1032
|
+
}
|
|
1033
|
+
declare function createJsonlAgentEventLog(options: JsonlAgentEventLogOptions): AgentEventLog;
|
|
1034
|
+
//#endregion
|
|
1035
|
+
//#region src/testing/fakes.d.ts
|
|
1036
|
+
declare function createFixedClock(now: Date): AgentClock;
|
|
1037
|
+
declare function createTestClock(initial: Date): AgentClock & {
|
|
1038
|
+
advance(ms: number): void;
|
|
1039
|
+
};
|
|
1040
|
+
declare function createSequenceRunIds(runIds: ReadonlyArray<AgentRunId>): RunIdGenerator;
|
|
1041
|
+
//#endregion
|
|
1042
|
+
//#region src/adapters/compatibility/agent-execution/loop/agent-loop-prompt-transformer.d.ts
|
|
1043
|
+
declare function createAgentLoopPromptTransformer(options: {
|
|
1044
|
+
readonly loop: AgentLoop$1;
|
|
1045
|
+
readonly transform: (input: AgentLoopInput$1) => Promise<string> | string;
|
|
1046
|
+
}): AgentLoop$1;
|
|
1047
|
+
//#endregion
|
|
1048
|
+
//#region src/adapters/compatibility/agent-execution/runtime/agent-harness.d.ts
|
|
1049
|
+
interface AgentHarnessOptions$1 {
|
|
1050
|
+
readonly loop: AgentLoop$1;
|
|
1051
|
+
readonly runIds: RunIdGenerator;
|
|
1052
|
+
readonly clock: AgentClock;
|
|
1053
|
+
readonly runTimeoutMs?: number;
|
|
1054
|
+
readonly initialRunStates?: ReadonlyArray<AgentRunState>;
|
|
1055
|
+
readonly initialEvents?: ReadonlyArray<AgentDomainEvent>;
|
|
1056
|
+
readonly eventSinks?: ReadonlyArray<AgentDomainEventSink>;
|
|
1057
|
+
}
|
|
1058
|
+
declare function createAgentHarness$1(options: AgentHarnessOptions$1): AgentHarness;
|
|
1059
|
+
//#endregion
|
|
1060
|
+
//#region src/adapters/compatibility/agent-execution/runtime/agent-callback-adapters.d.ts
|
|
1061
|
+
type AgentDomainEventCallback = (event: AgentDomainEvent) => void | Promise<void>;
|
|
1062
|
+
type AgentDomainEventSinkCallback = AgentDomainEventCallback;
|
|
1063
|
+
type AgentRunUpdateCallback = (update: AgentRunUpdate) => void | Promise<void>;
|
|
1064
|
+
declare function createAgentDomainEventSinkFromCallback(append: AgentDomainEventSinkCallback): AgentDomainEventSink;
|
|
1065
|
+
declare function createAgentDomainEventHandler(handle: AgentDomainEventCallback): AgentDomainEventHandler;
|
|
1066
|
+
declare function createAgentRunUpdateHandler(handle: AgentRunUpdateCallback): AgentRunUpdateHandler;
|
|
1067
|
+
//#endregion
|
|
1068
|
+
//#region src/adapters/compatibility/agent-execution/runtime/agent-harness-client.d.ts
|
|
1069
|
+
interface AgentRunLookupClient {
|
|
1070
|
+
getRunSummary(runId: AgentRunId): AgentRunSummary | undefined;
|
|
1071
|
+
getRunUpdates(runId: AgentRunId): ReadonlyArray<AgentRunUpdate> | undefined;
|
|
1072
|
+
getRunEvents(runId: AgentRunId): ReadonlyArray<AgentDomainEvent> | undefined;
|
|
1073
|
+
getRunState(runId: AgentRunId): AgentRunState | undefined;
|
|
1074
|
+
getRunSnapshot(runId: AgentRunId): AgentRunSnapshot | undefined;
|
|
1075
|
+
}
|
|
1076
|
+
interface AgentHarnessClient extends AgentRunLookupClient {
|
|
1077
|
+
readonly harness: AgentHarness;
|
|
1078
|
+
cancelActiveRun(reason?: string): Promise<boolean>;
|
|
1079
|
+
cancelRun(runId: AgentRunId, reason?: string): Promise<boolean>;
|
|
1080
|
+
forSession(sessionKey: SessionKey): AgentSessionClient;
|
|
1081
|
+
getSessionHistory(sessionKey: SessionKey): AgentHistory;
|
|
1082
|
+
getSessionTranscript(sessionKey: SessionKey): AgentTranscript;
|
|
1083
|
+
getSessionSnapshot(sessionKey: SessionKey): AgentSessionSnapshot;
|
|
1084
|
+
getSessionSummary(sessionKey: SessionKey): AgentSessionSummary | undefined;
|
|
1085
|
+
getSessionState(sessionKey: SessionKey): AgentRunState | undefined;
|
|
1086
|
+
getSessionRuns(sessionKey: SessionKey): ReadonlyArray<AgentRunSummary>;
|
|
1087
|
+
getSessionLatestRunSummary(sessionKey: SessionKey): AgentRunSummary | undefined;
|
|
1088
|
+
getSessionLatestRunSnapshot(sessionKey: SessionKey): AgentRunSnapshot | undefined;
|
|
1089
|
+
getActiveRun(): ActiveAgentRun | undefined;
|
|
1090
|
+
getActiveRunId(): AgentRunId | undefined;
|
|
1091
|
+
getActiveRunState(): AgentRunState | undefined;
|
|
1092
|
+
getAvailability(): AgentHarnessAvailability;
|
|
1093
|
+
getHistory(): AgentHistory;
|
|
1094
|
+
getState(): AgentRunState;
|
|
1095
|
+
prompt(command: PromptCommand): Promise<AgentPromptResult>;
|
|
1096
|
+
promptRunSnapshot(command: PromptCommand): Promise<AgentRunSnapshot>;
|
|
1097
|
+
promptSnapshot(command: PromptCommand): Promise<AgentSessionSnapshot>;
|
|
1098
|
+
promptText(command: PromptCommand): Promise<string>;
|
|
1099
|
+
promptTurn(command: PromptCommand): Promise<AgentTranscriptTurn>;
|
|
1100
|
+
promptWithEvents(command: PromptCommand, onEvent: AgentDomainEventCallback): Promise<AgentPromptResult>;
|
|
1101
|
+
promptWithText(command: PromptCommand, onTextDelta: AgentTextDeltaCallback): Promise<AgentPromptResult>;
|
|
1102
|
+
promptWithUpdates(command: PromptCommand, onUpdate: AgentRunUpdateCallback): Promise<AgentPromptResult>;
|
|
1103
|
+
stream(command: PromptCommand): AsyncIterable<AgentDomainEvent>;
|
|
1104
|
+
streamText(command: PromptCommand): AsyncIterable<string>;
|
|
1105
|
+
streamUpdates(command: PromptCommand): AsyncIterable<AgentRunUpdate>;
|
|
1106
|
+
subscribe(listener: AgentDomainEventListener): () => void;
|
|
1107
|
+
subscribeRun(runId: AgentRunId, listener: AgentDomainEventListener): () => void;
|
|
1108
|
+
subscribeRunUpdates(runId: AgentRunId, listener: AgentRunUpdateListener): () => void;
|
|
1109
|
+
subscribeUpdates(listener: AgentRunUpdateListener): () => void;
|
|
1110
|
+
tryPrompt(command: PromptCommand): Promise<AgentClientAttempt<AgentPromptResult, unknown>>;
|
|
1111
|
+
tryPromptText(command: PromptCommand): Promise<AgentClientAttempt<string, unknown>>;
|
|
1112
|
+
}
|
|
1113
|
+
interface AgentSessionClient extends AgentRunLookupClient {
|
|
1114
|
+
readonly handle: AgentSessionHandle;
|
|
1115
|
+
readonly sessionKey: SessionKey;
|
|
1116
|
+
cancelActiveRun(reason?: string): Promise<boolean>;
|
|
1117
|
+
cancelRun(runId: AgentRunId, reason?: string): Promise<boolean>;
|
|
1118
|
+
getSnapshot(): AgentSessionSnapshot;
|
|
1119
|
+
getState(): AgentRunState | undefined;
|
|
1120
|
+
getSummary(): AgentSessionSummary | undefined;
|
|
1121
|
+
getTranscript(): AgentTranscript;
|
|
1122
|
+
getRuns(): ReadonlyArray<AgentRunSummary>;
|
|
1123
|
+
getLatestRunSnapshot(): AgentRunSnapshot | undefined;
|
|
1124
|
+
getLatestRunSummary(): AgentRunSummary | undefined;
|
|
1125
|
+
getActiveRun(): ActiveAgentRun | undefined;
|
|
1126
|
+
getActiveRunState(): AgentRunState | undefined;
|
|
1127
|
+
getAvailability(): AgentSessionAvailability;
|
|
1128
|
+
getHistory(): AgentHistory;
|
|
1129
|
+
prompt(text: string): Promise<AgentPromptResult>;
|
|
1130
|
+
promptRunSnapshot(text: string): Promise<AgentRunSnapshot>;
|
|
1131
|
+
promptSnapshot(text: string): Promise<AgentSessionSnapshot>;
|
|
1132
|
+
promptText(text: string): Promise<string>;
|
|
1133
|
+
promptTurn(text: string): Promise<AgentTranscriptTurn>;
|
|
1134
|
+
promptWithEvents(text: string, onEvent: AgentDomainEventCallback): Promise<AgentPromptResult>;
|
|
1135
|
+
promptWithText(text: string, onTextDelta: AgentTextDeltaCallback): Promise<AgentPromptResult>;
|
|
1136
|
+
promptWithUpdates(text: string, onUpdate: AgentRunUpdateCallback): Promise<AgentPromptResult>;
|
|
1137
|
+
stream(text: string): AsyncIterable<AgentDomainEvent>;
|
|
1138
|
+
streamText(text: string): AsyncIterable<string>;
|
|
1139
|
+
streamUpdates(text: string): AsyncIterable<AgentRunUpdate>;
|
|
1140
|
+
subscribe(listener: AgentDomainEventListener): () => void;
|
|
1141
|
+
subscribeRun(runId: AgentRunId, listener: AgentDomainEventListener): () => void;
|
|
1142
|
+
subscribeRunUpdates(runId: AgentRunId, listener: AgentRunUpdateListener): () => void;
|
|
1143
|
+
subscribeUpdates(listener: AgentRunUpdateListener): () => void;
|
|
1144
|
+
tryPrompt(text: string): Promise<AgentClientAttempt<AgentPromptResult, unknown>>;
|
|
1145
|
+
tryPromptText(text: string): Promise<AgentClientAttempt<string, unknown>>;
|
|
1146
|
+
}
|
|
1147
|
+
type AgentTextDeltaCallback = (delta: string) => void | Promise<void>;
|
|
1148
|
+
type AgentClientAttempt<T, E = unknown> = AgentClientSuccess<T> | AgentClientFailure<E>;
|
|
1149
|
+
interface AgentClientSuccess<T> {
|
|
1150
|
+
readonly ok: true;
|
|
1151
|
+
readonly value: T;
|
|
1152
|
+
}
|
|
1153
|
+
interface AgentClientFailure<E = unknown> {
|
|
1154
|
+
readonly ok: false;
|
|
1155
|
+
readonly error: E;
|
|
1156
|
+
}
|
|
1157
|
+
declare function createAgentHarnessClient(harness: AgentHarness): AgentHarnessClient;
|
|
1158
|
+
//#endregion
|
|
1159
|
+
//#region src/adapters/compatibility/agent-execution/runtime/agent-runtime-primitives.d.ts
|
|
1160
|
+
type DefaultAgentHarnessOptions = Omit<AgentHarnessOptions$1, "clock" | "runIds"> & {
|
|
1161
|
+
readonly clock?: AgentClock;
|
|
1162
|
+
readonly runIds?: RunIdGenerator;
|
|
1163
|
+
};
|
|
1164
|
+
type DefaultAgentHarnessFromCallbackOptions = Omit<DefaultAgentHarnessOptions, "loop">;
|
|
1165
|
+
type DefaultAgentHarnessFromTextCallbackOptions = DefaultAgentHarnessFromCallbackOptions;
|
|
1166
|
+
type DefaultAgentHarnessClientOptions = DefaultAgentHarnessOptions;
|
|
1167
|
+
type DefaultAgentHarnessClientFromCallbackOptions = DefaultAgentHarnessFromCallbackOptions;
|
|
1168
|
+
type DefaultAgentHarnessClientFromTextCallbackOptions = DefaultAgentHarnessFromTextCallbackOptions;
|
|
1169
|
+
interface DefaultAgentRuntimeSessionOptions {
|
|
1170
|
+
readonly mainSessionKey?: SessionKey;
|
|
1171
|
+
}
|
|
1172
|
+
interface AgentRuntime {
|
|
1173
|
+
readonly client: AgentHarnessClient;
|
|
1174
|
+
readonly harness: AgentHarness;
|
|
1175
|
+
readonly mainClient: AgentSessionClient;
|
|
1176
|
+
readonly mainSession: AgentSessionHandle;
|
|
1177
|
+
readonly mainSessionKey: SessionKey;
|
|
1178
|
+
forSession(sessionKey: SessionKey): AgentSessionHandle;
|
|
1179
|
+
forSessionClient(sessionKey: SessionKey): AgentSessionClient;
|
|
1180
|
+
prompt(text: string): Promise<AgentPromptResult>;
|
|
1181
|
+
promptText(text: string): Promise<string>;
|
|
1182
|
+
promptTurn(text: string): Promise<AgentTranscriptTurn>;
|
|
1183
|
+
tryPrompt(text: string): Promise<AgentClientAttempt<AgentPromptResult, unknown>>;
|
|
1184
|
+
tryPromptText(text: string): Promise<AgentClientAttempt<string, unknown>>;
|
|
1185
|
+
}
|
|
1186
|
+
type DefaultAgentRuntimeOptions = DefaultAgentHarnessOptions;
|
|
1187
|
+
type DefaultAgentRuntimeFromCallbackOptions = DefaultAgentHarnessFromCallbackOptions;
|
|
1188
|
+
type DefaultAgentRuntimeFromTextCallbackOptions = DefaultAgentHarnessFromTextCallbackOptions;
|
|
1189
|
+
declare function createDefaultAgentHarness(options: DefaultAgentHarnessOptions): AgentHarness;
|
|
1190
|
+
declare function createDefaultAgentHarnessFromCallback(run: AgentLoopCallback, options?: DefaultAgentHarnessFromCallbackOptions): AgentHarness;
|
|
1191
|
+
declare function createDefaultAgentHarnessFromTextCallback(generate: TextAgentLoopCallback, options?: DefaultAgentHarnessFromTextCallbackOptions): AgentHarness;
|
|
1192
|
+
declare function createDefaultAgentHarnessClient(options: DefaultAgentHarnessClientOptions): AgentHarnessClient;
|
|
1193
|
+
declare function createDefaultAgentHarnessClientFromCallback(run: AgentLoopCallback, options?: DefaultAgentHarnessClientFromCallbackOptions): AgentHarnessClient;
|
|
1194
|
+
declare function createDefaultAgentHarnessClientFromTextCallback(generate: TextAgentLoopCallback, options?: DefaultAgentHarnessClientFromTextCallbackOptions): AgentHarnessClient;
|
|
1195
|
+
declare function createDefaultAgentRuntime(options: DefaultAgentRuntimeOptions, runtimeOptions?: DefaultAgentRuntimeSessionOptions): AgentRuntime;
|
|
1196
|
+
declare function createDefaultAgentRuntimeFromCallback(run: AgentLoopCallback, options?: DefaultAgentRuntimeFromCallbackOptions, runtimeOptions?: DefaultAgentRuntimeSessionOptions): AgentRuntime;
|
|
1197
|
+
declare function createDefaultAgentRuntimeFromTextCallback(generate: TextAgentLoopCallback, options?: DefaultAgentRuntimeFromTextCallbackOptions, runtimeOptions?: DefaultAgentRuntimeSessionOptions): AgentRuntime;
|
|
1198
|
+
declare function createSystemClock(): AgentClock;
|
|
1199
|
+
declare function createUuidRunIds(): RunIdGenerator;
|
|
1200
|
+
declare function createAgentRuntime(harness: AgentHarness, options?: DefaultAgentRuntimeSessionOptions): AgentRuntime;
|
|
1201
|
+
//#endregion
|
|
1202
|
+
//#region src/adapters/compatibility/memory/public-contract.d.ts
|
|
1203
|
+
/** Legacy Promise API record shape; keep this as an interface for consumer augmentation. */
|
|
1204
|
+
interface MemoryRecord {
|
|
1205
|
+
readonly content: string;
|
|
1206
|
+
readonly conversationSafe: boolean;
|
|
1207
|
+
readonly id: string;
|
|
1208
|
+
readonly revision: number;
|
|
1209
|
+
readonly scope: MemoryScope;
|
|
1210
|
+
readonly state: MemoryState;
|
|
1211
|
+
readonly tombstoneReason?: string;
|
|
1212
|
+
}
|
|
1213
|
+
/** Legacy Promise API snapshot shape; keep this as an interface for consumer augmentation. */
|
|
1214
|
+
interface AgentMemorySnapshot$1 {
|
|
1215
|
+
readonly binding: MemoryBinding;
|
|
1216
|
+
readonly record: MemoryRecord;
|
|
1217
|
+
}
|
|
1218
|
+
/** Promise-based Memory access exposed by the legacy host-tool boundary. */
|
|
1219
|
+
interface AgentMemoryHandle$1 extends MemoryHandleContract<MemoryRecord> {}
|
|
1220
|
+
/** Consumer-owned Memory service port used by the legacy Promise API. */
|
|
1221
|
+
interface AgentMemoryService$1 {
|
|
1222
|
+
bind(binding: MemoryBinding): AgentMemoryHandle$1;
|
|
1223
|
+
}
|
|
1224
|
+
declare function createMemoryNamespace(binding: MemoryBinding): string;
|
|
1225
|
+
declare function restrictMemoryScopesForAudience(scopes: ReadonlyArray<MemoryScope>, audience: MemoryInvocationAudience): ReadonlyArray<MemoryScope>;
|
|
1226
|
+
//#endregion
|
|
1227
|
+
//#region src/adapters/compatibility/memory/project-memory-prompt-preparer.d.ts
|
|
1228
|
+
interface LegacyProjectMemoryRecallOptions {
|
|
1229
|
+
readonly agentId: string;
|
|
1230
|
+
readonly memory: AgentMemoryService$1;
|
|
1231
|
+
readonly projectId: string;
|
|
1232
|
+
readonly maxBytes?: number;
|
|
1233
|
+
readonly maxRecords?: number;
|
|
1234
|
+
readonly identity?: LegacyProjectMemoryRecallIdentity;
|
|
1235
|
+
}
|
|
1236
|
+
interface LegacyProjectMemoryRecallIdentity {
|
|
1237
|
+
readonly subjectId: string;
|
|
1238
|
+
readonly tenantId: string;
|
|
1239
|
+
}
|
|
1240
|
+
interface LegacyProjectMemoryPromptInput {
|
|
1241
|
+
readonly invocation?: AgentInvocationOrigin;
|
|
1242
|
+
readonly text: string;
|
|
1243
|
+
}
|
|
1244
|
+
declare function createLegacyProjectMemoryPromptPreparer(options: LegacyProjectMemoryRecallOptions): (input: LegacyProjectMemoryPromptInput) => Promise<string>;
|
|
1245
|
+
//#endregion
|
|
1246
|
+
//#region src/adapters/compatibility/memory/rivus-memory-tool.d.ts
|
|
1247
|
+
interface LegacyRivusMemoryTool extends MemoryToolContract<MemoryRecord> {}
|
|
1248
|
+
declare function createLegacyRivusMemoryTool(memory: AgentMemoryHandle$1 | ReadonlyArray<AgentMemoryHandle$1>): LegacyRivusMemoryTool;
|
|
1249
|
+
declare function createLegacyRivusMemoryToolDescriptor(options: {
|
|
1250
|
+
readonly memory: AgentMemoryService$1;
|
|
1251
|
+
}): RivusHostToolDescriptor;
|
|
1252
|
+
//#endregion
|
|
1253
|
+
//#region src/adapters/compatibility/memory/compaction/compaction-service.d.ts
|
|
1254
|
+
interface CompactorPort$1 {
|
|
1255
|
+
compact(input: CompactionInput): Promise<string>;
|
|
1256
|
+
}
|
|
1257
|
+
interface CompactionService$1 {
|
|
1258
|
+
createCandidate(input: CompactionInput): Promise<CompactionSnapshot>;
|
|
1259
|
+
commit(candidateId: string): CompactionSnapshot;
|
|
1260
|
+
current(instanceId: string, conversationId: string): CompactionSnapshot | undefined;
|
|
1261
|
+
}
|
|
1262
|
+
declare function createCompactionService(options: {
|
|
1263
|
+
readonly compactor: CompactorPort$1;
|
|
1264
|
+
}): CompactionService$1;
|
|
1265
|
+
//#endregion
|
|
1266
|
+
//#region src/adapters/compatibility/tool-execution/public-contract.d.ts
|
|
1267
|
+
interface InvocationAuthorityRef$1 extends InvocationAuthorityRef {}
|
|
1268
|
+
interface InvocationAuthority$1 extends Omit<InvocationAuthority, "memory" | "toolGrantSet"> {
|
|
1269
|
+
readonly memory?: RivusMemoryAuthority;
|
|
1270
|
+
readonly toolGrantSet: RivusToolGrantSet;
|
|
1271
|
+
}
|
|
1272
|
+
declare function createInvocationAuthority$1(authority: InvocationAuthority$1): InvocationAuthorityRef$1;
|
|
1273
|
+
declare function createToolInputDigest(input: unknown): string;
|
|
1274
|
+
declare function requiresToolApproval(risk: RivusToolRisk): boolean;
|
|
1275
|
+
//#endregion
|
|
1276
|
+
//#region src/adapters/compatibility/tool-execution/tool-operation-ledger.d.ts
|
|
1277
|
+
interface ToolOperationBinding extends ToolOperationBinding$1 {}
|
|
1278
|
+
type ToolOperationState = ToolOperationState$1;
|
|
1279
|
+
interface ToolOperationReconciliation extends ToolOperationReconciliation$1 {}
|
|
1280
|
+
interface ToolOperationRecord extends ToolOperationRecord$1 {}
|
|
1281
|
+
type ToolOperationReconciliationOutcome = ToolOperationReconciliationOutcome$1;
|
|
1282
|
+
type ToolOperationBeginResult = ToolOperationBeginResult$1;
|
|
1283
|
+
type ToolOperationInspectResult = ToolOperationInspectResult$1;
|
|
1284
|
+
interface ToolOperationLedger {
|
|
1285
|
+
abort(operationId: string, binding: ToolOperationBinding): Promise<void>;
|
|
1286
|
+
begin(operationId: string, binding: ToolOperationBinding): Promise<ToolOperationBeginResult>;
|
|
1287
|
+
complete(operationId: string, binding: ToolOperationBinding, result: unknown): Promise<void>;
|
|
1288
|
+
inspect(operationId: string, binding: ToolOperationBinding): Promise<ToolOperationInspectResult>;
|
|
1289
|
+
reconciliationRequired(): ReadonlyArray<ToolOperationRecord>;
|
|
1290
|
+
reconcile(input: {
|
|
1291
|
+
readonly action: RecoveryAction;
|
|
1292
|
+
readonly expectedRevision: number;
|
|
1293
|
+
readonly operationId: string;
|
|
1294
|
+
readonly outcome: ToolOperationReconciliationOutcome;
|
|
1295
|
+
}): Promise<ToolOperationRecord>;
|
|
1296
|
+
requireReconciliation(operationId: string, binding: ToolOperationBinding, reason: string): Promise<void>;
|
|
1297
|
+
unresolvedForSource(sourceMessageId: string): ReadonlyArray<ToolOperationRecord>;
|
|
1298
|
+
}
|
|
1299
|
+
declare function createToolOperationLedger(options?: {
|
|
1300
|
+
readonly initial?: ReadonlyArray<ToolOperationRecord>;
|
|
1301
|
+
readonly persist?: (record: ToolOperationRecord) => Promise<void>;
|
|
1302
|
+
}): ToolOperationLedger;
|
|
1303
|
+
declare function adaptEffectToolOperationLedger(ledger: ToolOperationLedger$1): ToolOperationLedger;
|
|
1304
|
+
declare function toEffectToolOperationLedger(ledger: ToolOperationLedger): ToolOperationLedger$1;
|
|
1305
|
+
//#endregion
|
|
1306
|
+
export { AGENT_MEMORY_JSONL_VERSION, type ActiveAgentRun, type AgentClientAttempt, type AgentClientFailure, type AgentClientSuccess, type AgentClock, AgentContextBudgetExceeded, type AgentContextInput, type AgentContextLayer, type AgentContextLayerKind, type AgentConversationMessagesOptions, type AgentDomainEvent, type AgentDomainEventCallback, type AgentDomainEventHandler, type AgentDomainEventListener, type AgentDomainEventSink, type AgentDomainEventSinkCallback, AgentEventHandlerFailed, type AgentEventLog, type AgentEventLogOperation, AgentEventLogStoreError, AgentEventSinkFailed, type AgentExecutionControlPort, type AgentExecutionQueryStore, type AgentExecutionQueryStoreOptions, type AgentHarness, type AgentHarnessAvailability, AgentHarnessBusy, type AgentHarnessBusyAvailability, type AgentHarnessClient, type AgentHarnessError, type AgentHarnessIdleAvailability, type AgentHarnessOptions, type AgentHistory, type AgentHistoryEventLog, type AgentInvocationOrigin, type AgentLoop, type AgentLoopEvent, type AgentLoopEventLike, AgentLoopFailed, type AgentLoopInput, type AgentLoopModelExecutionEnd, type AgentLoopModelExecutionEndOptions, type AgentLoopModelExecutionStart, type AgentLoopModelExecutionStartOptions, type AgentLoopSkillExecutionEnd, type AgentLoopSkillExecutionEndOptions, type AgentLoopSkillExecutionStart, type AgentLoopSkillExecutionStartOptions, type AgentLoopTextDelta, type AgentLoopThinkingDelta, type AgentLoopToolExecutionEnd, type AgentLoopToolExecutionEndOptions, type AgentLoopToolExecutionStart, type AgentLoopToolExecutionStartOptions, type AgentLoopToolExecutionUpdate, type AgentLoopToolExecutionUpdateOptions, type AgentLoopTurnStart, type AgentMemoryAuthority, type AgentMemoryAuthority as LegacyAgentMemoryAuthority, AgentMemoryError, type AgentMemoryHandle, type AgentMemoryIdentity, type AgentMemoryIdentity as LegacyAgentMemoryIdentity, type AgentMemoryInvocationIdentity, type AgentMemoryRecord, type AgentMemoryRepository, AgentMemoryRepositoryConflict, type AgentMemoryRepositoryRecord, type AgentMemoryService, type AgentMemorySnapshot, type AgentModelContentObserver, type AgentModelExecutionEnded, type AgentModelExecutionEvent, type AgentModelExecutionStarted, type AgentModelInputObservation, type AgentModelOutputObservation, type AgentModelUsage, type AgentPromptExecutor, type AgentPromptResult, type AgentRunAccepted, AgentRunCancelled, type AgentRunCancelled as AgentRunCancelledEvent, type AgentRunCompleted, type AgentRunFailed, type AgentRunId, type AgentRunPhase, type AgentRunSnapshot, type AgentRunState, type AgentRunStreams, type AgentRunSummary, type AgentRunUpdate, type AgentRunUpdateCallback, type AgentRunUpdateHandler, type AgentRunUpdateListener, type AgentRuntime, type AgentSessionAvailability, type AgentSessionBusyAvailability, type AgentSessionClient, type AgentSessionHandle, type AgentSessionHistoryView, type AgentSessionOtherBusyAvailability, type AgentSessionOwnedBusyAvailability, type AgentSessionSnapshot, type AgentSessionSummary, type AgentSkillExecutionEnded, type AgentSkillExecutionStarted, type AgentSkillExecutionState, type AgentSteeringChannel, type AgentTextDeltaCallback, type AgentToolExecutionEnded, type AgentToolExecutionEvent, type AgentToolExecutionStarted, type AgentToolExecutionState, type AgentToolExecutionUpdated, type AgentTranscript, type AgentTranscriptMessage, type AgentTranscriptMessageRole, type AgentTranscriptTurn, type AgentTurnCompleted, type AgentTurnStarted, type AssembledAgentContext, type AssistantTextDelta, type AssistantThinkingDelta, type AuthorizationPolicyProvider, type AuthorizationPolicyState, type AutomationAgentInvocationOrigin, type BackgroundSessionAgentInvocationOrigin, CompactionError, CompactionError as LegacyCompactionError, type CompactionInput, type CompactionInput as LegacyCompactionInput, type CompactionService, type CompactionSnapshot, type CompactionSnapshot as LegacyCompactionSnapshot, type CompactorPort, type DefaultAgentHarnessClientFromCallbackOptions, type DefaultAgentHarnessClientFromTextCallbackOptions, type DefaultAgentHarnessClientOptions, type DefaultAgentHarnessFromCallbackOptions, type DefaultAgentHarnessFromTextCallbackOptions, type DefaultAgentHarnessOptions, type DefaultAgentRuntimeFromCallbackOptions, type DefaultAgentRuntimeFromTextCallbackOptions, type DefaultAgentRuntimeOptions, type DefaultAgentRuntimeSessionOptions, type EventAgentLoopOptions, type FeishuAgentInvocationOrigin, InvalidInvocationAuthority, InvalidInvocationAuthority as LegacyInvalidInvocationAuthority, InvalidRecoveryAction, InvalidStableJson, InvalidStableJson as LegacyInvalidStableJson, InvalidToolInput, InvalidToolInput as LegacyInvalidToolInput, InvalidWorkspaceRoot, type InvocationAuthority, type InvocationAuthorityIdentity, type InvocationAuthorityRef, type InvocationMemoryAuthority, type InvocationMemoryScope, type InvocationToolGrantSet, type JsonlAgentEventLogOptions, type LangfuseAgentTelemetry, type LangfuseTelemetryConfig, LangfuseTelemetryConfigError, type LangfuseTelemetryContentMode, type LangfuseTelemetryEnv, type AgentHarnessOptions$1 as LegacyAgentHarnessOptions, type AgentLoop$1 as LegacyAgentLoop, type AgentLoopCallback as LegacyAgentLoopCallback, type AgentLoopCallbackOutput as LegacyAgentLoopCallbackOutput, type AgentLoopCallbackResult as LegacyAgentLoopCallbackResult, type AgentLoopInput$1 as LegacyAgentLoopInput, type AgentMemoryHandle$1 as LegacyAgentMemoryHandle, type AgentMemoryService$1 as LegacyAgentMemoryService, type AgentMemorySnapshot$1 as LegacyAgentMemorySnapshot, type AgentSteeringChannel$1 as LegacyAgentSteeringChannel, type AsyncIterableAgentLoopOptions as LegacyAsyncIterableAgentLoopOptions, type CompactionService$1 as LegacyCompactionService, type CompactorPort$1 as LegacyCompactorPort, type EventAgentLoopOptions$1 as LegacyEventAgentLoopOptions, type InvocationAuthority$1 as LegacyInvocationAuthority, type InvocationAuthorityRef$1 as LegacyInvocationAuthorityRef, type MemoryBinding as LegacyMemoryBinding, type MemoryBinding, type MemoryInvocationAudience as LegacyMemoryInvocationAudience, type MemoryInvocationAudience, type MemoryRecord as LegacyMemoryRecord, type MemoryScope as LegacyMemoryScope, type MemoryScope, type MemorySearchQuery as LegacyMemorySearchQuery, type MemorySearchQuery, type MemoryState as LegacyMemoryState, type MemoryState, type LegacyProjectMemoryPromptInput, type LegacyProjectMemoryRecallIdentity, type LegacyProjectMemoryRecallOptions, type LegacyRivusMemoryTool, type TextAgentLoopCallback as LegacyTextAgentLoopCallback, type TextAgentLoopOptions as LegacyTextAgentLoopOptions, type ToolOperationBeginResult as LegacyToolOperationBeginResult, type ToolOperationBinding as LegacyToolOperationBinding, type ToolOperationInspectResult as LegacyToolOperationInspectResult, type ToolOperationLedger as LegacyToolOperationLedger, type ToolOperationReconciliation as LegacyToolOperationReconciliation, type ToolOperationReconciliationOutcome as LegacyToolOperationReconciliationOutcome, type ToolOperationRecord as LegacyToolOperationRecord, type ToolOperationState as LegacyToolOperationState, type LocalCliAgentInvocationOrigin, MEMORY_SCOPES, type MemoryHandle, type MemoryIdentity, type MemoryService, type MemoryTombstoneReceipt, type ModelBinding, type ModelChangeActivationResult, ModelChangeBoundaryDeadlineError, type ModelChangeBudgetReservation, type ModelChangeClock, type ModelChangeExecutionBudget, type ModelChangePaidCallKind, type ModelChangeRestoreResult, type ModelChangeRuntimeContext, type ModelChangeRuntimePort, type ModelChangeValidationResult, type ModelReference, type NormalizedAgentInvocation, type OpenTelemetryAgentEventSinkOptions, type OpenTelemetryAgentTelemetry, type PersistedMemoryRecord, type ToolOperation as PersistedToolOperation, type ProjectMemoryPromptInput, type ProjectMemoryRecallIdentity, type ProjectMemoryRecallOptions, type PromptCommand, RIVUS_MEMORY_TOOL_ID, RIVUS_MEMORY_TOOL_PLUGIN_ID, RIVUS_MEMORY_TOOL_VERSION, RIVUS_RUNTIME_TOOL_IDS, type RecoveryAction, type RegisteredRivusSkill, type RegisteredRivusTool, type RivusHostToolDescriptor, type RivusMemoryAuthority, type RivusMemoryScope, type RivusMemoryTool, type RivusResolvedToolDescriptor, type RivusRuntimeToolGrantSet, type RivusRuntimeToolId, type RivusSkillDescriptor, type RivusSkillGrantSet, type RivusToolDescriptor, type RivusToolExecutionContext, type RivusToolExecutionOrigin, type RivusToolExecutor, type RivusToolFactoryContext, type RivusToolGrantSet, type RivusToolGrantSetOperations, type RivusToolIdempotency, RivusToolInputRejected, type RivusToolRisk, type RunAdmission, type RunAdmissionLease, type RunAdmissionOptions, type RunIdGenerator, type SessionKey, type StandardAgentRunResult, TOOL_OPERATION_JSONL_VERSION, type TelemetryContentRedactor, type TelemetryContentRedactorOptions, type TerminalAgentDomainEvent, type TextAgentLoopOptions$1 as TextAgentLoopOptions, type ToolApprovalRequest, type ToolApprovalService, type ToolBroker, type ToolBrokerOptions, type ToolCatalog, type ToolDescriptor, type ToolExecutionContext, type ToolExecutionOrigin, type ToolExecutionRequest, type ToolExecutor, ToolExecutorInputRejected, type ToolIdempotency, type ToolInputDigest, ToolInvocationDenied, type ToolOperationBeginResult$1 as ToolOperationBeginResult, type ToolOperationBinding$1 as ToolOperationBinding, type ToolOperationInspectResult$1 as ToolOperationInspectResult, type ToolOperationLedger$1 as ToolOperationLedger, ToolOperationLedgerError, type ToolOperationLedgerOptions, type ToolOperationReconciliation$1 as ToolOperationReconciliation, type ToolOperationReconciliationAction, type ToolOperationReconciliationOutcome$1 as ToolOperationReconciliationOutcome, type ToolOperationRecord$1 as ToolOperationRecord, type ToolOperationState$1 as ToolOperationState, type ToolRisk, type WorkspaceInstructionSource, type WorkspaceInstructionsDiagnostic, type WorkspaceInstructionsDiagnosticCode, type WorkspaceInstructionsRequest, WorkspaceInstructionsSourceError, type WorkspaceInstructionsSourcePort, type WorkspaceInstructionsSourceRequest, type WorkspaceInstructionsSourceResult, type WorkspaceInstructionsView, type WorkspaceRootHandle, adaptEffectToolOperationLedger as adaptLegacyEffectToolOperationLedger, assembleAgentContext, buildAgentSessionSnapshot, buildRunSnapshot, createAgentConversationMessages, createAgentDomainEventHandler, createAgentDomainEventSink, createAgentDomainEventSinkFromCallback, createAgentExecutionQueryStore, createAgentHarness, createAgentHarnessClient, createAgentLoopModelExecutionEnd, createAgentLoopModelExecutionStart, createAgentLoopSkillExecutionEnd, createAgentLoopSkillExecutionStart, createAgentLoopTextDelta, createAgentLoopThinkingDelta, createAgentLoopToolExecutionEnd, createAgentLoopToolExecutionStart, createAgentLoopToolExecutionUpdate, createAgentLoopTurnStart, createAgentRunStreams, createAgentRunUpdateHandler, createAgentRuntime, createAgentTranscriptMessages, createAgentTranscriptTurn, createAgentsMdInstructionsSource, createDefaultAgentHarness, createDefaultAgentHarnessClient, createDefaultAgentHarnessClientFromCallback, createDefaultAgentHarnessClientFromTextCallback, createDefaultAgentHarnessFromCallback, createDefaultAgentHarnessFromTextCallback, createDefaultAgentRuntime, createDefaultAgentRuntimeFromCallback, createDefaultAgentRuntimeFromTextCallback, createEffectCompactionService, createEventAgentLoop, createFixedClock, createInMemoryAgentMemoryRepository, createInvocationAuthority, createJsonlAgentEventLog, createLangfuseAgentTelemetry, createAgentHarness$1 as createLegacyAgentHarness, createAgentLoopFromCallback as createLegacyAgentLoopFromCallback, createAgentLoopPromptTransformer as createLegacyAgentLoopPromptTransformer, createAsyncIterableAgentLoop as createLegacyAsyncIterableAgentLoop, createCompactionService as createLegacyCompactionService, createEventAgentLoop$1 as createLegacyEventAgentLoop, createInvocationAuthority$1 as createLegacyInvocationAuthority, createMemoryNamespace as createLegacyMemoryNamespace, createLegacyProjectMemoryPromptPreparer, createLegacyRivusMemoryTool, createLegacyRivusMemoryToolDescriptor, createTextAgentLoop as createLegacyTextAgentLoop, createTextAgentLoopFromCallback as createLegacyTextAgentLoopFromCallback, createToolInputDigest as createLegacyToolInputDigest, createToolOperationLedger as createLegacyToolOperationLedger, createMemoryNamespace$1 as createMemoryNamespace, createMemoryService, createOpenTelemetryAgentEventSink, createOpenTelemetryAgentTelemetry, createPersistedMemoryRecord, createProjectMemoryPromptPreparer, createRecoveryAction, createRivusMemoryTool, createRivusMemoryToolContract, createRivusMemoryToolDescriptor, createRunAdmission, createSequenceRunIds, createSystemClock, createTelemetryContentRedactor, createTestClock, createTextAgentLoop$1 as createTextAgentLoop, createToolBroker, createToolInputDigest$1 as createToolInputDigest, createToolOperationLedger$1 as createToolOperationLedger, createUuidRunIds, createWorkspaceInstructionsResolver, createWorkspaceRootHandle, decodeAgentMemorySnapshots, decodeToolOperationSnapshots, describeLoopError, encodeAgentMemorySnapshot, encodeToolOperationSnapshot, evolveAgentRun, fromEffectAgentLoop as fromEffectLegacyAgentLoop, initialAgentRunState, isAgentToolExecutionEvent, isAssistantTextDeltaEvent, isAssistantThinkingDeltaEvent, isRivusRuntimeToolId, isTerminalAgentDomainEvent, isTerminalAgentRunPhase, normalizeAgentInvocation, normalizeAgentLoopEvent, normalizeStableJson as normalizeLegacyStableJson, normalizeStableJson, normalizeMemoryBinding, notifyListeners, notifyUpdateListeners, openJsonlAgentMemoryRepository, openJsonlToolOperationLedger, projectAgentSessionHistory, remainingUntil, replayAgentHistory, replayAgentTranscript, replayRunUpdates, requiresToolApproval as requiresLegacyToolApproval, requiresToolApproval$1 as requiresToolApproval, resolveInvocationAuthority, resolveLangfuseTelemetryConfig, resolveWorkspaceRootPath, restoreAgentHistory, restorePersistedMemoryRecord, restoreToolOperation as restorePersistedToolOperation, restrictMemoryScopesForAudience as restrictLegacyMemoryScopesForAudience, toDomainEvent, toEffectAgentLoop as toEffectLegacyAgentLoop, toEffectAgentLoopInput as toEffectLegacyAgentLoopInput, toEffectToolOperationLedger as toEffectLegacyToolOperationLedger, toCompatibilityAgentLoopInput as toLegacyAgentLoopInput, toRunUpdate };
|