@rivus/gateway 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.
Files changed (39) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +6 -0
  3. package/dist/bootstrap/pi-feishu.d.ts +20 -0
  4. package/dist/bootstrap/pi-feishu.js +671 -0
  5. package/dist/chunks/background-session-authority.js +230 -0
  6. package/dist/chunks/background-session-control-input.js +45 -0
  7. package/dist/chunks/background-session-service.d.ts +390 -0
  8. package/dist/chunks/index.d.ts +4703 -0
  9. package/dist/chunks/node-rivus-deployment-manifest.js +1650 -0
  10. package/dist/chunks/rivus-node-entrypoint.js +4464 -0
  11. package/dist/chunks/service.js +12112 -0
  12. package/dist/cli.d.ts +1 -0
  13. package/dist/cli.js +16 -0
  14. package/dist/index.d.ts +3 -0
  15. package/dist/index.js +1215 -0
  16. package/dist/mcp.d.ts +92 -0
  17. package/dist/mcp.js +455 -0
  18. package/package.json +64 -0
  19. package/skills/runtime-management/SKILL.md +65 -0
  20. package/templates/a-share-briefing-analysis.mjs +93 -0
  21. package/templates/a-share-briefing-renderer.mjs +257 -0
  22. package/templates/a-share-index-evidence.mjs +99 -0
  23. package/templates/a-share-market-briefing.mjs +83 -0
  24. package/templates/a-share-market-date.mjs +10 -0
  25. package/templates/a-share-overseas-evidence.mjs +86 -0
  26. package/templates/a-share-policy-evidence.mjs +145 -0
  27. package/templates/a-share-provider-response.mjs +21 -0
  28. package/templates/a-share-sector-evidence.mjs +70 -0
  29. package/templates/acp-stdio-proxy.mjs +58 -0
  30. package/templates/current-weather.mjs +117 -0
  31. package/templates/html-drive-tools.mjs +262 -0
  32. package/templates/https-response-reader.mjs +36 -0
  33. package/templates/langfuse-drive-e2e.mjs +175 -0
  34. package/templates/pi-feishu-deployment.bootstrap.ts +3 -0
  35. package/templates/pi-feishu.bootstrap.ts +242 -0
  36. package/templates/rivus-agents.plugin.mjs +290 -0
  37. package/templates/rivus-langfuse-demo.config.json +37 -0
  38. package/templates/rivus-starter.plugin.mjs +47 -0
  39. package/templates/rivus.config.json +114 -0
@@ -0,0 +1,4703 @@
1
+ import { A as BackgroundSessionLease, C as ClaimBackgroundSessionInput, E as BackgroundSessionSnapshot, N as BackgroundSessionMemoryScope, O as BackgroundSessionPhase, P as BackgroundSessionId, S as BackgroundSession, T as SuspendBackgroundSessionInput, b as BackgroundSessionDeliveryRecord, g as BackgroundSessionRepository$1, h as BackgroundSessionLeaseStaleOrAbsent, m as BackgroundSessionLeaseRequirement, p as BackgroundSessionLeasePrecondition, r as BackgroundSessionService, w as CreateBackgroundSessionInput, x as BackgroundSessionDeliveryStore } from "./background-session-service.js";
2
+ import { Effect } from "effect";
3
+ import { ActiveAgentRun, AgentClock, AgentDomainEvent, AgentDomainEventSink, AgentEventLog, AgentExecutionControlPort, AgentHarness, AgentHarnessAvailability, AgentHistory, AgentInvocationOrigin, AgentLoopInput, AgentMemoryError, AgentRunId, AgentRunState, AgentRunUpdate, AgentRunUpdateHandler, AuthorizationPolicyState, InvalidInvocationAuthority, InvocationAuthorityRef, InvocationToolGrantSet, LegacyAgentLoop, LegacyAgentMemoryHandle as AgentMemoryHandle, LegacyAgentMemoryService, LegacyAgentMemoryService as AgentMemoryService, LegacyAgentMemorySnapshot, LegacyInvocationAuthorityRef as InvocationAuthorityRef$1, LegacyToolOperationLedger as ToolOperationLedger$1, MemorySearchQuery, ModelBinding, ModelBinding as ModelBinding$1, ModelChangeBoundaryDeadlineError, ModelChangeClock, ModelChangeClock as ModelChangeClock$1, ModelChangeExecutionBudget, ModelChangePaidCallKind, ModelChangePaidCallKind as ModelChangePaidCallKind$1, ModelChangeRestoreResult, ModelChangeRuntimeContext, ModelChangeRuntimePort, ModelChangeRuntimePort as ModelChangeRuntimePort$1, ModelChangeValidationResult, ModelReference, ModelReference as ModelReference$1, NormalizedAgentInvocation, PromptCommand, RecoveryAction, RegisteredRivusSkill, RegisteredRivusTool, RivusHostToolDescriptor, RivusMemoryScope, RivusResolvedToolDescriptor, RivusRuntimeToolGrantSet, RivusRuntimeToolGrantSet as RivusRuntimeToolGrantSet$1, RivusRuntimeToolId, RivusSkillDescriptor, RivusSkillGrantSet, RivusToolDescriptor, RivusToolGrantSet, RivusToolRisk, RunIdGenerator, SessionKey, StandardAgentRunResult, ToolApprovalRequest, ToolExecutionRequest, ToolInputDigest, ToolInvocationDenied as ToolInvocationDenied$1, ToolOperationLedger, WorkspaceInstructionsRequest, WorkspaceInstructionsView } from "@rivus/runtime";
4
+ import { PiManagedRunProvider, PiManagedRunProviderResult, PiThinkingLevel, PiToolApprovalGateway, createPiModelRuntime } from "@rivus/runtime/pi";
5
+ import { PeriodicEffectLoop } from "@rivus/platform/concurrency";
6
+
7
+ //#region src/core/domain/human-interaction/aggregate/snapshot.d.ts
8
+ type HumanInteractionId$1 = string;
9
+ type HumanInteractionToolRisk = "observe" | "mutate" | "irreversible" | "host-control";
10
+ interface HumanInteractionActor$1 {
11
+ readonly openId: string;
12
+ readonly tenantKey: string;
13
+ }
14
+ interface HumanInteractionFact$1 {
15
+ readonly label: string;
16
+ readonly value: string;
17
+ }
18
+ interface ToolApprovalBinding$1 {
19
+ readonly agentId: string;
20
+ readonly callId: string;
21
+ readonly inputDigest: string;
22
+ readonly instanceId: string;
23
+ readonly operationId: string;
24
+ readonly risk: HumanInteractionToolRisk;
25
+ readonly runId: string;
26
+ readonly sessionKey: string;
27
+ readonly tenantKey: string;
28
+ readonly toolId: string;
29
+ readonly toolVersion: string;
30
+ }
31
+ interface HumanInteractionBase$1 {
32
+ readonly agentId: string;
33
+ readonly allowedActorOpenIds: ReadonlyArray<string>;
34
+ readonly createdAt: string;
35
+ readonly expiresAt: string;
36
+ readonly facts: ReadonlyArray<HumanInteractionFact$1>;
37
+ readonly id: HumanInteractionId$1;
38
+ readonly instanceId: string;
39
+ readonly revision: number;
40
+ readonly runId: string;
41
+ readonly sessionKey: string;
42
+ readonly sourceMessageId: string;
43
+ readonly summary: string;
44
+ readonly tenantKey: string;
45
+ readonly title: string;
46
+ }
47
+ interface PendingHumanInteractionState$1 {
48
+ readonly status: "pending";
49
+ }
50
+ interface ApprovedHumanInteractionState$1 {
51
+ readonly actor: HumanInteractionActor$1;
52
+ readonly consumedAt?: string;
53
+ readonly resolvedAt: string;
54
+ readonly status: "approved";
55
+ }
56
+ interface RejectedHumanInteractionState$1 {
57
+ readonly actor: HumanInteractionActor$1;
58
+ readonly resolvedAt: string;
59
+ readonly status: "rejected";
60
+ }
61
+ interface SelectedHumanInteractionState$1 {
62
+ readonly actor: HumanInteractionActor$1;
63
+ readonly optionId: string;
64
+ readonly resolvedAt: string;
65
+ readonly status: "selected";
66
+ }
67
+ interface ExpiredHumanInteractionState$1 {
68
+ readonly expiredAt: string;
69
+ readonly status: "expired";
70
+ }
71
+ interface CancelledHumanInteractionState$1 {
72
+ readonly cancelledAt: string;
73
+ readonly reason?: string;
74
+ readonly status: "cancelled";
75
+ }
76
+ type ToolApprovalInteractionState$1 = PendingHumanInteractionState$1 | ApprovedHumanInteractionState$1 | RejectedHumanInteractionState$1 | ExpiredHumanInteractionState$1 | CancelledHumanInteractionState$1;
77
+ interface ToolApprovalInteraction$2 extends HumanInteractionBase$1 {
78
+ readonly kind: "tool-approval";
79
+ readonly request: Omit<ToolApprovalBinding$1, "agentId" | "instanceId" | "runId" | "sessionKey" | "tenantKey">;
80
+ readonly state: ToolApprovalInteractionState$1;
81
+ }
82
+ interface UserDecisionOption$1 {
83
+ readonly description: string;
84
+ readonly id: string;
85
+ readonly label: string;
86
+ }
87
+ type UserDecisionInteractionState$1 = PendingHumanInteractionState$1 | SelectedHumanInteractionState$1 | RejectedHumanInteractionState$1 | ExpiredHumanInteractionState$1 | CancelledHumanInteractionState$1;
88
+ interface UserDecisionInteraction$2 extends HumanInteractionBase$1 {
89
+ readonly kind: "user-decision";
90
+ readonly options: ReadonlyArray<UserDecisionOption$1>;
91
+ readonly recommendedOptionId?: string;
92
+ readonly state: UserDecisionInteractionState$1;
93
+ }
94
+ type HumanInteraction$2 = ToolApprovalInteraction$2 | UserDecisionInteraction$2;
95
+ type HumanInteractionSnapshot = HumanInteraction$2;
96
+ type HumanInteractionResolutionAction$1 = "approve" | "reject" | "select";
97
+ type HumanInteractionTransition$1 = {
98
+ readonly action: HumanInteractionResolutionAction$1;
99
+ readonly actor: HumanInteractionActor$1;
100
+ readonly now: string;
101
+ readonly optionId?: string;
102
+ readonly type: "resolve";
103
+ } | {
104
+ readonly binding: ToolApprovalBinding$1;
105
+ readonly now: string;
106
+ readonly type: "consume-approval";
107
+ } | {
108
+ readonly now: string;
109
+ readonly reason?: string;
110
+ readonly type: "cancel";
111
+ };
112
+ interface RequestToolApprovalInput$1 {
113
+ readonly agentId: string;
114
+ readonly allowedActorOpenIds: ReadonlyArray<string>;
115
+ readonly expiresAt: string;
116
+ readonly facts: ReadonlyArray<HumanInteractionFact$1>;
117
+ readonly instanceId: string;
118
+ readonly interactionId: string;
119
+ readonly request: {
120
+ readonly callId: string;
121
+ readonly inputDigest: string;
122
+ readonly operationId: string;
123
+ readonly risk: HumanInteractionToolRisk;
124
+ readonly toolId: string;
125
+ readonly toolVersion: string;
126
+ };
127
+ readonly runId: string;
128
+ readonly sessionKey: string;
129
+ readonly sourceMessageId: string;
130
+ readonly summary: string;
131
+ readonly tenantKey: string;
132
+ readonly title: string;
133
+ }
134
+ interface RequestUserDecisionInput$1 {
135
+ readonly agentId: string;
136
+ readonly allowedActorOpenIds: ReadonlyArray<string>;
137
+ readonly expiresAt: string;
138
+ readonly facts: ReadonlyArray<HumanInteractionFact$1>;
139
+ readonly instanceId: string;
140
+ readonly interactionId: string;
141
+ readonly options: ReadonlyArray<UserDecisionOption$1>;
142
+ readonly recommendedOptionId?: string;
143
+ readonly runId: string;
144
+ readonly sessionKey: string;
145
+ readonly sourceMessageId: string;
146
+ readonly summary: string;
147
+ readonly tenantKey: string;
148
+ readonly title: string;
149
+ }
150
+ //#endregion
151
+ //#region src/core/domain/human-interaction/aggregate/human-interaction.d.ts
152
+ type HumanInteractionTransitionResult = Readonly<{
153
+ readonly events: ReadonlyArray<never>;
154
+ readonly state: HumanInteraction$1;
155
+ }>;
156
+ type HumanInteraction$1 = HumanInteractionRoot & HumanInteraction$2;
157
+ type ToolApprovalInteraction$1 = HumanInteractionRoot & ToolApprovalInteraction$2;
158
+ type UserDecisionInteraction$1 = HumanInteractionRoot & UserDecisionInteraction$2;
159
+ type ResolveHumanInteractionInput$2 = Readonly<{
160
+ readonly action: HumanInteractionResolutionAction$1;
161
+ readonly actor: HumanInteractionActor$1;
162
+ readonly now: string;
163
+ readonly optionId?: string;
164
+ }>;
165
+ type ConsumeHumanInteractionInput = Readonly<{
166
+ readonly binding: ToolApprovalBinding$1;
167
+ readonly now: string;
168
+ }>;
169
+ type CancelHumanInteractionInput = Readonly<{
170
+ readonly now: string;
171
+ readonly reason?: string;
172
+ }>;
173
+ type CreateHumanInteractionInput = (RequestToolApprovalInput$1 & {
174
+ readonly kind: "tool-approval";
175
+ }) | (RequestUserDecisionInput$1 & {
176
+ readonly kind: "user-decision";
177
+ });
178
+ declare class HumanInteractionRoot {
179
+ #private;
180
+ readonly agentId: string;
181
+ readonly allowedActorOpenIds: ReadonlyArray<string>;
182
+ readonly createdAt: string;
183
+ readonly expiresAt: string;
184
+ readonly facts: ReadonlyArray<HumanInteraction$2["facts"][number]>;
185
+ readonly id: string;
186
+ readonly instanceId: string;
187
+ readonly kind: "tool-approval" | "user-decision";
188
+ readonly revision: number;
189
+ readonly runId: string;
190
+ readonly sessionKey: string;
191
+ readonly sourceMessageId: string;
192
+ readonly state: HumanInteraction$2["state"];
193
+ readonly summary: string;
194
+ readonly tenantKey: string;
195
+ readonly title: string;
196
+ private constructor();
197
+ static createToolApproval(input: RequestToolApprovalInput$1, createdAt: string): ToolApprovalInteraction$1;
198
+ static createUserDecision(input: RequestUserDecisionInput$1, createdAt: string): UserDecisionInteraction$1;
199
+ static create(input: CreateHumanInteractionInput, createdAt: string): HumanInteraction$1;
200
+ static restore(value: unknown): HumanInteraction$1;
201
+ resolve(input: ResolveHumanInteractionInput$2): HumanInteractionTransitionResult;
202
+ consume(input: ConsumeHumanInteractionInput): HumanInteractionTransitionResult;
203
+ consumeApproval(input: ConsumeHumanInteractionInput): HumanInteractionTransitionResult;
204
+ cancel(input: CancelHumanInteractionInput): HumanInteractionTransitionResult;
205
+ isSameRequest(other: HumanInteraction$1): boolean;
206
+ hasSameRequest(other: HumanInteraction$1): boolean;
207
+ isSamePersistedIdentity(other: HumanInteraction$1): boolean;
208
+ validateTransitionTo(next: HumanInteraction$1): boolean;
209
+ toSnapshot(): HumanInteraction$2;
210
+ private toJSON;
211
+ private transition;
212
+ }
213
+ //#endregion
214
+ //#region src/core/application/human-interaction/ports/human-interaction-contracts.d.ts
215
+ interface HumanInteractionClock$1 {
216
+ now(): string;
217
+ }
218
+ interface ResolveHumanInteractionInput$1 {
219
+ readonly action: HumanInteractionResolutionAction$1;
220
+ readonly actor: HumanInteractionActor$1;
221
+ readonly interactionId: string;
222
+ readonly optionId?: string;
223
+ }
224
+ interface ConsumeToolApprovalInput$1 {
225
+ readonly approvalId: string;
226
+ readonly binding: ToolApprovalBinding$1;
227
+ }
228
+ interface HumanInteractionServiceContract<Interaction, ToolApprovalInteraction = Interaction, UserDecisionInteraction = Interaction, ToolApprovalInput = RequestToolApprovalInput$1, UserDecisionInput = RequestUserDecisionInput$1, ResolveInput = ResolveHumanInteractionInput$1, ConsumeInput = ConsumeToolApprovalInput$1> {
229
+ consumeToolApproval(input: ConsumeInput): Effect.Effect<boolean, unknown>;
230
+ get(interactionId: string): Effect.Effect<Interaction | undefined, unknown>;
231
+ resolve(input: ResolveInput): Effect.Effect<Interaction, unknown>;
232
+ requestToolApproval(input: ToolApprovalInput): Effect.Effect<ToolApprovalInteraction, unknown>;
233
+ requestUserDecision(input: UserDecisionInput): Effect.Effect<UserDecisionInteraction, unknown>;
234
+ waitForResolution(input: {
235
+ readonly interactionId: string;
236
+ readonly signal?: AbortSignal;
237
+ }): Effect.Effect<Interaction, unknown>;
238
+ }
239
+ interface HumanInteractionServiceOptionsContract<Clock, Presenter, Repository> {
240
+ readonly clock: Clock;
241
+ readonly presenter: Presenter;
242
+ readonly repository: Repository;
243
+ readonly sleep?: (ms: number) => Promise<void>;
244
+ }
245
+ //#endregion
246
+ //#region src/core/application/human-interaction/ports/human-interaction-presenter.d.ts
247
+ interface HumanInteractionPresenterContract<Interaction> {
248
+ present(interaction: Interaction): Effect.Effect<void, unknown>;
249
+ }
250
+ type HumanInteractionPresenter$1 = HumanInteractionPresenterContract<HumanInteraction$1>;
251
+ //#endregion
252
+ //#region src/core/application/human-interaction/ports/human-interaction-repository.d.ts
253
+ declare class HumanInteractionRepositoryError extends Error {
254
+ readonly operation: "create" | "get" | "update";
255
+ readonly cause?: unknown | undefined;
256
+ readonly name = "HumanInteractionRepositoryError";
257
+ constructor(operation: "create" | "get" | "update", message: string, cause?: unknown | undefined);
258
+ }
259
+ interface HumanInteractionRepositoryContract<Interaction> {
260
+ create(interaction: Interaction): Effect.Effect<void, HumanInteractionRepositoryError>;
261
+ get(id: HumanInteractionId$1): Effect.Effect<Interaction | undefined, HumanInteractionRepositoryError>;
262
+ update(id: HumanInteractionId$1, transition: (current: Interaction) => Interaction): Effect.Effect<Interaction, HumanInteractionRepositoryError>;
263
+ }
264
+ type HumanInteractionRepository$1 = HumanInteractionRepositoryContract<HumanInteraction$1>;
265
+ //#endregion
266
+ //#region src/core/application/human-interaction/commands/human-interaction-service.d.ts
267
+ type HumanInteractionService$1 = HumanInteractionServiceContract<HumanInteraction$1, ToolApprovalInteraction$1, UserDecisionInteraction$1>;
268
+ type HumanInteractionServiceOptions$1 = HumanInteractionServiceOptionsContract<HumanInteractionClock$1, HumanInteractionPresenter$1, HumanInteractionRepository$1>;
269
+ declare function createHumanInteractionService$1(options: HumanInteractionServiceOptions$1): HumanInteractionService$1;
270
+ //#endregion
271
+ //#region src/core/application/run-presentation/projection/presented-value.d.ts
272
+ type PresentedValue = {
273
+ readonly kind: "boolean";
274
+ readonly value: boolean;
275
+ } | {
276
+ readonly entries: ReadonlyArray<{
277
+ readonly key: string;
278
+ readonly value: PresentedValue;
279
+ }>;
280
+ readonly kind: "record";
281
+ readonly omittedEntries: number;
282
+ } | {
283
+ readonly items: ReadonlyArray<PresentedValue>;
284
+ readonly kind: "list";
285
+ readonly omittedItems: number;
286
+ } | {
287
+ readonly kind: "null";
288
+ } | {
289
+ readonly kind: "number";
290
+ readonly value: number;
291
+ } | {
292
+ readonly kind: "redacted";
293
+ readonly reason: "sensitive-key" | "sensitive-value";
294
+ } | {
295
+ readonly kind: "text";
296
+ readonly omittedCharacters: number;
297
+ readonly value: string;
298
+ } | {
299
+ readonly kind: "unsupported";
300
+ readonly valueType: string;
301
+ };
302
+ interface PresentedValueOptions {
303
+ readonly maxCollectionItems?: number;
304
+ readonly maxDepth?: number;
305
+ readonly maxNodes?: number;
306
+ readonly maxStringCharacters?: number;
307
+ }
308
+ declare function createPresentedValue(value: unknown, options?: PresentedValueOptions): PresentedValue;
309
+ //#endregion
310
+ //#region src/core/application/run-presentation/projection/run-presentation.d.ts
311
+ declare const RUN_PRESENTATION_SCHEMA_VERSION: 2;
312
+ type AgentRunId$1 = string;
313
+ type RunPresentationPhase = "cancelled" | "completed" | "failed" | "running";
314
+ type PresentationStepStatus = "completed" | "failed" | "running";
315
+ interface PresentationStepBase {
316
+ readonly durationMs?: number;
317
+ readonly endedAt?: string;
318
+ readonly id: string;
319
+ readonly label: string;
320
+ readonly startedAt: string;
321
+ readonly status: PresentationStepStatus;
322
+ }
323
+ interface AssistantPresentationStep extends PresentationStepBase {
324
+ readonly kind: "assistant";
325
+ readonly text: string;
326
+ }
327
+ interface ModelPresentationStep extends PresentationStepBase {
328
+ readonly kind: "model";
329
+ readonly model: string;
330
+ readonly provider: string;
331
+ }
332
+ interface SkillPresentationStep extends PresentationStepBase {
333
+ readonly kind: "skill";
334
+ readonly skillId: string;
335
+ }
336
+ interface ToolPresentationStep extends PresentationStepBase {
337
+ readonly error?: PresentedValue;
338
+ readonly input: PresentedValue;
339
+ readonly kind: "tool";
340
+ readonly output?: PresentedValue;
341
+ readonly skillId?: string;
342
+ readonly toolName: string;
343
+ }
344
+ interface ResponsePresentationStep extends PresentationStepBase {
345
+ readonly kind: "response";
346
+ }
347
+ type PresentationStep = AssistantPresentationStep | ModelPresentationStep | ResponsePresentationStep | SkillPresentationStep | ToolPresentationStep;
348
+ interface RunPresentation {
349
+ readonly answer: {
350
+ readonly format: "markdown";
351
+ readonly text: string;
352
+ };
353
+ readonly omittedStepCount: number;
354
+ readonly phase: RunPresentationPhase;
355
+ readonly revision: number;
356
+ readonly runId: AgentRunId$1;
357
+ readonly schemaVersion: typeof RUN_PRESENTATION_SCHEMA_VERSION;
358
+ readonly steps: ReadonlyArray<PresentationStep>;
359
+ readonly totalStepCount: number;
360
+ readonly totalToolCallCount: number;
361
+ }
362
+ declare function hasInspectableRunProgress(presentation: RunPresentation): boolean;
363
+ //#endregion
364
+ //#region src/core/application/message-gateway/contracts/message-gateway-contracts.d.ts
365
+ /**
366
+ * Normalized prompt action. The invocation is already normalized via the
367
+ * gateway identity contract; the legacy AgentInvocationOrigin is
368
+ * adapted at the channel boundary and never reaches the gateway execution path.
369
+ */
370
+ interface GatewayPromptAction {
371
+ readonly invocation?: NormalizedAgentInvocation;
372
+ readonly messageId: string;
373
+ readonly receiveId: string;
374
+ readonly sessionKey: SessionKey;
375
+ readonly sourceNamespace: string;
376
+ readonly text: string;
377
+ readonly type: "prompt";
378
+ }
379
+ interface GatewayCancelAction {
380
+ /**
381
+ * Optional dedupe identity. When present, the gateway uses this (scoped by
382
+ * sourceNamespace) for deduplication instead of messageId. Card actions use
383
+ * their independent token so they do not collide with the source message
384
+ * that triggered them.
385
+ */
386
+ readonly dedupeId?: string;
387
+ readonly messageId: string;
388
+ readonly reason: string;
389
+ readonly runId?: AgentRunId;
390
+ readonly sessionKey?: SessionKey;
391
+ readonly sourceNamespace: string;
392
+ /** When true, the gateway does not emit a cancellation reply. Used by card
393
+ * actions which have their own reaction-based acknowledgement. */
394
+ readonly silent?: boolean;
395
+ readonly type: "cancel";
396
+ }
397
+ interface GatewaySteerAction {
398
+ readonly messageId: string;
399
+ readonly sessionKey: SessionKey;
400
+ readonly sourceNamespace: string;
401
+ readonly text: string;
402
+ readonly type: "steer";
403
+ }
404
+ interface GatewayResetAction {
405
+ readonly messageId: string;
406
+ readonly previousSessionKey: SessionKey;
407
+ readonly reason: string;
408
+ readonly sessionKey: SessionKey;
409
+ readonly sourceNamespace: string;
410
+ readonly type: "reset";
411
+ }
412
+ interface GatewayResolveInteractionAction {
413
+ readonly action: ResolveHumanInteractionInput$1["action"];
414
+ readonly actor: ResolveHumanInteractionInput$1["actor"];
415
+ readonly dedupeId?: string;
416
+ readonly interactionId: string;
417
+ readonly messageId: string;
418
+ readonly optionId?: string;
419
+ readonly sourceNamespace: string;
420
+ readonly type: "resolve_interaction";
421
+ }
422
+ type GatewayAction = GatewayPromptAction | GatewayCancelAction | GatewaySteerAction | GatewayResetAction | GatewayResolveInteractionAction;
423
+ interface GatewayRunResult {
424
+ readonly finalText: string;
425
+ readonly messageId: string;
426
+ readonly runId: AgentRunId;
427
+ }
428
+ interface GatewaySkippedResult {
429
+ readonly messageId: string;
430
+ readonly reason: "duplicate";
431
+ readonly skipped: true;
432
+ }
433
+ interface GatewayCancelResult {
434
+ readonly cancelled: boolean;
435
+ readonly messageId: string;
436
+ readonly reason?: "not_active";
437
+ readonly runId?: AgentRunId;
438
+ }
439
+ interface GatewaySteeredResult {
440
+ readonly messageId: string;
441
+ readonly runId: AgentRunId;
442
+ readonly steered: true;
443
+ }
444
+ interface GatewayInteractionResult {
445
+ readonly interaction: HumanInteractionSnapshot;
446
+ readonly interactionId: string;
447
+ readonly messageId: string;
448
+ readonly resolved: true;
449
+ }
450
+ interface GatewayResetResult {
451
+ readonly messageId: string;
452
+ readonly previousSessionKey: SessionKey;
453
+ readonly reset: true;
454
+ readonly sessionKey: SessionKey;
455
+ }
456
+ type GatewayActionResult = GatewayRunResult | GatewaySkippedResult | GatewayCancelResult | GatewaySteeredResult | GatewayInteractionResult | GatewayResetResult;
457
+ /**
458
+ * Normalized execution command. Uses the canonical NormalizedAgentInvocation
459
+ * rather than the legacy AgentInvocationOrigin DTO.
460
+ */
461
+ interface GatewayPromptCommand {
462
+ readonly invocation?: NormalizedAgentInvocation;
463
+ readonly sessionKey: SessionKey;
464
+ readonly text: string;
465
+ }
466
+ /**
467
+ * Execution port. The runtime never receives receiveId or reply targets; those
468
+ * are bound to the presentation and reply ports only.
469
+ */
470
+ interface GatewayExecutionPort extends AgentExecutionControlPort {
471
+ promptWithUpdates(command: GatewayPromptCommand, onUpdate: (update: AgentRunUpdate) => Effect.Effect<void, unknown>): Effect.Effect<StandardAgentRunResult, unknown>;
472
+ }
473
+ interface GatewayRunPreparation {
474
+ readonly messageId: string;
475
+ readonly prompt: string;
476
+ readonly receiveId: string;
477
+ readonly runId: AgentRunId;
478
+ readonly sessionKey: SessionKey;
479
+ }
480
+ /**
481
+ * Safe presentation update delivered to the presentation port. The Gateway
482
+ * applies the RunPresentation projection (redacting tool input/result via
483
+ * PresentedValue) before invoking this port. Raw Tool events never reach the
484
+ * presentation port through this boundary; only the safe presentation and the
485
+ * minimal scalar metadata needed for streaming behaviour are passed.
486
+ */
487
+ interface GatewayPresentationUpdate {
488
+ readonly errorMessage?: string;
489
+ readonly eventType: AgentDomainEvent["type"];
490
+ readonly presentation?: RunPresentation;
491
+ readonly reason?: string;
492
+ readonly runId: AgentRunId;
493
+ readonly text?: string;
494
+ }
495
+ /**
496
+ * Presentation port. The Gateway owns the safe RunPresentation projection;
497
+ * the presentation port receives only the safe presentation plus minimal
498
+ * scalar metadata. Raw tool input/result never passes through this port.
499
+ */
500
+ interface GatewayPresentationPort {
501
+ finalizeRun(runId: AgentRunId): Effect.Effect<void>;
502
+ prepareRun(run: GatewayRunPreparation): Effect.Effect<void, unknown>;
503
+ publishPresentation(update: GatewayPresentationUpdate): Effect.Effect<void, unknown>;
504
+ }
505
+ /**
506
+ * Raw observation port. A legacy compatibility hook that receives the original
507
+ * AgentRunUpdate before safe projection. Used by channels (e.g. Feishu) that
508
+ * still expose a raw publishRunUpdate callback. Not part of the standard
509
+ * rendering boundary.
510
+ */
511
+ interface GatewayObservationPort {
512
+ observeUpdate(update: AgentRunUpdate): Effect.Effect<void, unknown>;
513
+ }
514
+ /**
515
+ * Reply port. Channel-specific wording and reaction ACK/fallback live in the
516
+ * adapter implementation; the gateway only signals the semantic outcome.
517
+ */
518
+ interface GatewayReplyPort {
519
+ replyCancelled(messageId: string, hadActiveRun: boolean): Effect.Effect<void, unknown>;
520
+ replyReset(messageId: string, hadActiveRun: boolean): Effect.Effect<void, unknown>;
521
+ replySteered(messageId: string): Effect.Effect<void, unknown>;
522
+ }
523
+ interface GatewayHumanInteractionPort {
524
+ resolve(input: ResolveHumanInteractionInput$1): Effect.Effect<HumanInteractionSnapshot, unknown>;
525
+ }
526
+ /**
527
+ * Per-execution bindings. The gateway is constructed once with stable execution
528
+ * and dedupe state; presentation, reply, observation and an optional execution
529
+ * override are bound to a single execute call so they do not leak across
530
+ * requests. The gateway only ever sees the normalized command; legacy DTOs are
531
+ * captured in the adapter's execution port closure.
532
+ *
533
+ * Direct message execution:
534
+ * When `direct` is provided, the gateway owns the full direct-message
535
+ * lifecycle: it reserves the message identity before any execution, attempts
536
+ * steering, and falls back to prompting via the adapter-supplied
537
+ * `preparePrompt` binding. Any failure releases the reserved identity so the
538
+ * same message can be retried. This keeps the steer→prepare→prompt workflow
539
+ * and its dedupe lifetime inside a single gateway call rather than split
540
+ * across adapter-steered multiple execute invocations.
541
+ *
542
+ * Control execution (no `direct`):
543
+ * Cancel/reset/steer use their own marking timing (cancel after execution,
544
+ * reset before execution, steer after execution+ACK). Cancel and reset retain
545
+ * the mark on failure so a failed ACK does not allow the same message to
546
+ * cancel again.
547
+ */
548
+ interface GatewayDirectExecution {
549
+ /**
550
+ * Deferred prompt preparation. Required only for direct prompt actions;
551
+ * cancel/reset use direct mode for marking semantics without preparation.
552
+ * The adapter resolves the prompt text, normalized invocation, and the
553
+ * per-call execution port (which captures the legacy origin in its closure).
554
+ */
555
+ readonly preparePrompt?: () => Effect.Effect<{
556
+ readonly execution?: GatewayExecutionPort;
557
+ readonly invocation?: NormalizedAgentInvocation;
558
+ readonly text: string;
559
+ }, unknown>;
560
+ }
561
+ interface GatewayExecuteOptions {
562
+ readonly direct?: GatewayDirectExecution;
563
+ readonly execution?: GatewayExecutionPort;
564
+ readonly observation?: GatewayObservationPort;
565
+ readonly presentation?: GatewayPresentationPort;
566
+ readonly reply?: GatewayReplyPort;
567
+ }
568
+ //#endregion
569
+ //#region src/core/application/message-gateway/gateway/message-gateway.d.ts
570
+ interface MessageGatewayOptions {
571
+ readonly dedupe?: boolean;
572
+ readonly execution: GatewayExecutionPort;
573
+ readonly humanInteraction?: GatewayHumanInteractionPort;
574
+ readonly observation?: GatewayObservationPort;
575
+ readonly presentation?: GatewayPresentationPort;
576
+ readonly reply?: GatewayReplyPort;
577
+ }
578
+ interface MessageGateway {
579
+ execute(action: GatewayAction, options?: GatewayExecuteOptions): Effect.Effect<GatewayActionResult | undefined, unknown>;
580
+ }
581
+ declare function createMessageGateway(options: MessageGatewayOptions): MessageGateway;
582
+ //#endregion
583
+ //#region src/core/domain/background-session/factories/create-background-session.d.ts
584
+ declare function createBackgroundSession$1(input: CreateBackgroundSessionInput): BackgroundSession;
585
+ //#endregion
586
+ //#region src/core/domain/automation-occurrence/aggregate/snapshot.d.ts
587
+ type AutomationOccurrenceStatus = "running" | "failed" | "generated" | "suppressed" | "delivered";
588
+ interface AutomationOccurrenceSnapshot {
589
+ readonly automationId: string;
590
+ readonly body?: string;
591
+ readonly error?: string;
592
+ readonly mandateId: string;
593
+ readonly occurrence: string;
594
+ readonly presentation?: unknown;
595
+ readonly providerMessageId?: string;
596
+ readonly revision: number;
597
+ readonly runId?: string;
598
+ readonly status: AutomationOccurrenceStatus;
599
+ readonly suppressionReason?: string;
600
+ readonly tickId: string;
601
+ }
602
+ //#endregion
603
+ //#region src/core/domain/automation-occurrence/aggregate/automation-occurrence.d.ts
604
+ interface CreateAutomationOccurrenceInput {
605
+ readonly automationId: string;
606
+ readonly mandateId: string;
607
+ readonly occurrence: string;
608
+ readonly tickId: string;
609
+ }
610
+ interface GenerateAutomationOccurrenceInput {
611
+ readonly body: string;
612
+ readonly presentation?: unknown;
613
+ readonly runId: string;
614
+ }
615
+ interface SuppressAutomationOccurrenceInput {
616
+ readonly reason: string;
617
+ readonly runId: string;
618
+ }
619
+ declare class AutomationOccurrence {
620
+ #private;
621
+ private constructor();
622
+ static create(input: CreateAutomationOccurrenceInput): AutomationOccurrence;
623
+ static restore(value: unknown): AutomationOccurrence;
624
+ get automationId(): string;
625
+ get mandateId(): string;
626
+ get occurrence(): string;
627
+ get revision(): number;
628
+ get status(): AutomationOccurrenceStatus;
629
+ get tickId(): string;
630
+ restart(): AutomationOccurrence;
631
+ fail(error: string): AutomationOccurrence;
632
+ generate(input: GenerateAutomationOccurrenceInput): AutomationOccurrence;
633
+ suppress(input: SuppressAutomationOccurrenceInput): AutomationOccurrence;
634
+ deliver(providerMessageId: string): AutomationOccurrence;
635
+ validateTransitionTo(next: AutomationOccurrence): boolean;
636
+ toSnapshot(): AutomationOccurrenceSnapshot;
637
+ private requireRunning;
638
+ private next;
639
+ }
640
+ //#endregion
641
+ //#region src/core/application/automation/occurrence/automation-occurrence-repository.d.ts
642
+ interface AutomationOccurrenceRepository {
643
+ get(automationId: string, occurrence: string): Effect.Effect<AutomationOccurrence | undefined, unknown>;
644
+ save(occurrence: AutomationOccurrence): Effect.Effect<AutomationOccurrence, unknown>;
645
+ }
646
+ //#endregion
647
+ //#region src/core/application/automation/policy/automation-mandate.d.ts
648
+ interface AutomationBinding {
649
+ readonly agentId: string;
650
+ readonly bindingId: string;
651
+ readonly delivery: AutomationDeliveryBinding;
652
+ readonly schedule: string;
653
+ readonly servicePrincipalId: string;
654
+ readonly skillGrantRevision: string;
655
+ readonly skillIds: ReadonlyArray<string>;
656
+ readonly templateId: string;
657
+ readonly timeZone: string;
658
+ readonly toolIds: ReadonlyArray<string>;
659
+ }
660
+ interface AutomationDeliveryBinding {
661
+ readonly endpointId: string;
662
+ readonly targetKey: string;
663
+ readonly targetType: "chat_id" | "open_id" | "user_id" | "union_id" | "email";
664
+ }
665
+ interface AutomationMandate extends AutomationBinding {
666
+ readonly id: string;
667
+ readonly active: boolean;
668
+ }
669
+ interface AutomationTick {
670
+ readonly tickId: string;
671
+ readonly mandateId: string;
672
+ readonly occurrence: string;
673
+ readonly claimedBy: string;
674
+ }
675
+ interface AutomationMandateStore {
676
+ activate(binding: AutomationBinding): AutomationMandate;
677
+ revoke(id: string): void;
678
+ claim(id: string, occurrence: string, workerId: string): AutomationTick;
679
+ }
680
+ interface AutomationIdentity {
681
+ mandateId(binding: AutomationBinding): string;
682
+ tickId(mandateId: string, occurrence: string): string;
683
+ }
684
+ declare class AutomationMandateError extends Error {
685
+ readonly name = "AutomationMandateError";
686
+ }
687
+ //#endregion
688
+ //#region src/core/application/automation/presentation/automation-line-chart.d.ts
689
+ interface AutomationLineChart {
690
+ readonly title: string;
691
+ readonly labels: ReadonlyArray<string>;
692
+ readonly unit: string;
693
+ readonly seriesLayout?: "overlay" | "separate";
694
+ readonly series: ReadonlyArray<{
695
+ readonly name: string;
696
+ readonly values: ReadonlyArray<number>;
697
+ }>;
698
+ }
699
+ //#endregion
700
+ //#region src/core/application/automation/presentation/automation-presentation.d.ts
701
+ declare const AUTOMATION_PRESENTATION_SCHEMA_VERSION: 1;
702
+ type AutomationPresentationKind = "daily-ai" | "generic" | "industry" | "news" | "subscriptions";
703
+ interface AutomationPresentationSource {
704
+ readonly label: string;
705
+ readonly url: string;
706
+ }
707
+ interface AutomationPresentationItem {
708
+ readonly headline: string;
709
+ readonly note?: string;
710
+ readonly sources: ReadonlyArray<AutomationPresentationSource>;
711
+ }
712
+ interface AutomationPresentationSection {
713
+ readonly id: string;
714
+ readonly items: ReadonlyArray<AutomationPresentationItem>;
715
+ readonly title: string;
716
+ }
717
+ interface AutomationPresentation {
718
+ readonly lineChart?: AutomationLineChart;
719
+ readonly footnote?: string;
720
+ readonly kind?: AutomationPresentationKind;
721
+ readonly meta: ReadonlyArray<string>;
722
+ readonly schemaVersion: typeof AUTOMATION_PRESENTATION_SCHEMA_VERSION;
723
+ readonly sections: ReadonlyArray<AutomationPresentationSection>;
724
+ readonly summary?: string;
725
+ readonly title: string;
726
+ }
727
+ interface AutomationPresentationInput {
728
+ readonly lineChart?: AutomationLineChart;
729
+ readonly footnote?: string;
730
+ readonly kind?: AutomationPresentationKind;
731
+ readonly meta?: ReadonlyArray<string>;
732
+ readonly sections: ReadonlyArray<{
733
+ readonly id: string;
734
+ readonly items: ReadonlyArray<{
735
+ readonly headline: string;
736
+ readonly note?: string;
737
+ readonly sources?: ReadonlyArray<AutomationPresentationSource>;
738
+ }>;
739
+ readonly title: string;
740
+ }>;
741
+ readonly summary?: string;
742
+ readonly title: string;
743
+ }
744
+ declare class InvalidAutomationPresentation extends Error {
745
+ readonly name = "InvalidAutomationPresentation";
746
+ }
747
+ declare function createAutomationPresentation(input: AutomationPresentationInput): AutomationPresentation;
748
+ declare function readAutomationPresentation(value: unknown): AutomationPresentation;
749
+ //#endregion
750
+ //#region src/core/application/automation/scheduling/automation-scheduler.d.ts
751
+ declare const AUTOMATION_SUPPRESSION_PREFIX = "RIVUS_AUTOMATION_SUPPRESSED:";
752
+ interface ScheduledAutomationRunInput {
753
+ readonly occurrence: string;
754
+ readonly sessionKey: string;
755
+ readonly text: string;
756
+ readonly tickId: string;
757
+ }
758
+ interface ScheduledAutomationRunResult {
759
+ readonly body?: string;
760
+ readonly presentation?: AutomationPresentation;
761
+ readonly runId: string;
762
+ readonly suppressedReason?: string;
763
+ }
764
+ interface ScheduledAutomationDeliveryInput {
765
+ readonly body: string;
766
+ readonly idempotencyKey: string;
767
+ readonly presentation?: AutomationPresentation;
768
+ }
769
+ interface AutomationSchedulerClock {
770
+ now(): Date;
771
+ sleep(milliseconds: number): Effect.Effect<void, unknown>;
772
+ }
773
+ interface AutomationSchedulerOptions {
774
+ readonly automationId: string;
775
+ readonly binding: AutomationBinding;
776
+ readonly clock?: AutomationSchedulerClock;
777
+ readonly createInput: (tick: {
778
+ readonly occurrence: string;
779
+ }) => {
780
+ readonly text: string;
781
+ };
782
+ readonly deliver: (input: ScheduledAutomationDeliveryInput) => Effect.Effect<{
783
+ readonly providerMessageId: string;
784
+ }, unknown>;
785
+ readonly identity: AutomationIdentity;
786
+ readonly repository: AutomationOccurrenceRepository;
787
+ readonly onError?: (error: unknown) => Effect.Effect<void, unknown>;
788
+ readonly retryDelayMs?: number;
789
+ readonly run: (input: ScheduledAutomationRunInput) => Effect.Effect<ScheduledAutomationRunResult, unknown>;
790
+ }
791
+ interface AutomationScheduler {
792
+ running(): boolean;
793
+ runDue(at: Date): Effect.Effect<AutomationOccurrence | undefined, unknown>;
794
+ start(): Effect.Effect<void>;
795
+ stop(): Effect.Effect<void>;
796
+ }
797
+ declare function createAutomationScheduler(options: AutomationSchedulerOptions): AutomationScheduler;
798
+ //#endregion
799
+ //#region src/core/application/automation/outcome/automation-outcome.d.ts
800
+ type AutomationOutcome = {
801
+ readonly kind: "suppressed";
802
+ } | {
803
+ readonly kind: "report" | "alert";
804
+ readonly body: string;
805
+ readonly target: string;
806
+ };
807
+ interface PluginStateRecord {
808
+ readonly pluginId: string;
809
+ readonly agentId: string;
810
+ readonly key: string;
811
+ readonly value: unknown;
812
+ readonly revision: number;
813
+ }
814
+ interface PutPluginState {
815
+ readonly pluginId: string;
816
+ readonly agentId: string;
817
+ readonly key: string;
818
+ readonly value: unknown;
819
+ readonly expectedRevision: number;
820
+ }
821
+ type DeliveryJobStatus = "pending" | "delivered" | "reconciliation-required";
822
+ interface DeliveryJob {
823
+ readonly id: string;
824
+ readonly tickId: string;
825
+ readonly kind: "report" | "alert";
826
+ readonly body: string;
827
+ readonly target: string;
828
+ readonly status: DeliveryJobStatus;
829
+ readonly receiptId?: string;
830
+ }
831
+ type DeliveryAttemptResult = {
832
+ readonly kind: "delivered";
833
+ readonly providerMessageId: string;
834
+ } | {
835
+ readonly kind: "uncertain";
836
+ };
837
+ interface CommitAutomationOutcomeInput$1 {
838
+ readonly tickId: string;
839
+ readonly outcome: AutomationOutcome;
840
+ readonly stateUpdate: PutPluginState;
841
+ }
842
+ interface CommittedAutomationOutcome {
843
+ readonly state: PluginStateRecord;
844
+ readonly job?: DeliveryJob;
845
+ }
846
+ //#endregion
847
+ //#region src/core/application/automation/outcome/automation-outcome-repository.d.ts
848
+ interface AutomationOutcomeRepository {
849
+ commit(input: CommitAutomationOutcomeInput$1): Effect.Effect<CommittedAutomationOutcome, unknown>;
850
+ recordDeliveryAttempt(id: string, result: DeliveryAttemptResult): Effect.Effect<DeliveryJob, unknown>;
851
+ }
852
+ //#endregion
853
+ //#region src/core/application/automation/outcome/commit-automation-outcome.d.ts
854
+ interface CommitAutomationOutcomeCommand extends CommitAutomationOutcomeInput$1 {
855
+ readonly repository: AutomationOutcomeRepository;
856
+ }
857
+ declare function commitAutomationOutcome$1(command: CommitAutomationOutcomeCommand): Effect.Effect<CommittedAutomationOutcome, unknown>;
858
+ //#endregion
859
+ //#region src/core/application/agent-host/contracts/agent-instance.d.ts
860
+ type AgentInstanceBinding = {
861
+ readonly kind: "endpoint";
862
+ readonly endpointId: string;
863
+ } | {
864
+ readonly kind: "automation";
865
+ readonly automationId: string;
866
+ } | {
867
+ readonly kind: "background-session";
868
+ readonly agentId: string;
869
+ };
870
+ interface AgentInstanceRecord {
871
+ readonly agentId: string;
872
+ readonly binding: AgentInstanceBinding;
873
+ readonly bindingKey: string;
874
+ readonly instanceId: string;
875
+ readonly runtimeGenerationId: string;
876
+ }
877
+ interface AgentRuntimeGenerationIdentity {
878
+ readonly agentId: string;
879
+ readonly profileRevision: string;
880
+ readonly projectSpaceId: string | null;
881
+ readonly projectSpaceRevision: string | null;
882
+ readonly runtimeToolGrantRevision: string;
883
+ readonly skillGrantRevision: string;
884
+ readonly toolGrantRevision: string;
885
+ }
886
+ //#endregion
887
+ //#region src/core/application/agent-host/contracts/agent-host-runtime.d.ts
888
+ interface AgentRuntimeInput$1 {
889
+ readonly invocation?: AgentInvocationOrigin;
890
+ readonly onUpdate?: (update: AgentRunUpdate) => Effect.Effect<void, unknown>;
891
+ readonly payload?: unknown;
892
+ readonly sessionKey: SessionKey;
893
+ readonly text: string;
894
+ }
895
+ interface AgentRuntimeCancellation$1 {
896
+ readonly reason?: string;
897
+ readonly runId: AgentRunId;
898
+ readonly sessionKey: SessionKey;
899
+ }
900
+ interface AgentRuntimeSteering$1 {
901
+ readonly runId: AgentRunId;
902
+ readonly sessionKey: SessionKey;
903
+ readonly text: string;
904
+ }
905
+ interface AgentHostRuntime {
906
+ readonly concurrency?: "managed";
907
+ cancel?(input: AgentRuntimeCancellation$1): Effect.Effect<boolean, unknown>;
908
+ dispose?(): Effect.Effect<void, unknown>;
909
+ run(input: AgentRuntimeInput$1): Effect.Effect<unknown, unknown>;
910
+ steer?(input: AgentRuntimeSteering$1): Effect.Effect<boolean, unknown>;
911
+ }
912
+ interface AgentHostRuntimeFactoryPort {
913
+ create(instance: AgentInstanceRecord): Effect.Effect<AgentHostRuntime, unknown>;
914
+ }
915
+ interface AgentHostRuntimePort {
916
+ cancel(instance: AgentInstanceRecord, input: AgentRuntimeCancellation$1): Effect.Effect<boolean, unknown>;
917
+ disposeAll(): Effect.Effect<void, unknown>;
918
+ run(instance: AgentInstanceRecord, input: AgentRuntimeInput$1): Effect.Effect<unknown, unknown>;
919
+ steer(instance: AgentInstanceRecord, input: AgentRuntimeSteering$1): Effect.Effect<boolean, unknown>;
920
+ }
921
+ //#endregion
922
+ //#region src/core/application/agent-catalog/contracts/rivus-agent-definition.d.ts
923
+ interface RivusAgentProfile {
924
+ readonly id: string;
925
+ readonly displayName: string;
926
+ readonly systemPrompt: string;
927
+ readonly model: Readonly<Record<string, unknown>>;
928
+ readonly tools: {
929
+ readonly allow: ReadonlyArray<string>;
930
+ };
931
+ readonly skills: {
932
+ readonly allow: ReadonlyArray<string>;
933
+ };
934
+ readonly memory: {
935
+ readonly scopes: ReadonlyArray<RivusMemoryScope>;
936
+ };
937
+ readonly runtimeTools?: {
938
+ readonly allow: ReadonlyArray<RivusRuntimeToolId>;
939
+ };
940
+ }
941
+ interface RegisteredRivusAgentProfile extends RivusAgentProfile {
942
+ readonly pluginId: string;
943
+ }
944
+ interface RivusAgentGrantRestriction {
945
+ readonly memory: {
946
+ readonly scopes: ReadonlyArray<RivusMemoryScope>;
947
+ readonly tool: boolean;
948
+ };
949
+ readonly runtimeToolIds: ReadonlyArray<RivusRuntimeToolId>;
950
+ readonly skillIds: ReadonlyArray<string>;
951
+ readonly toolIds: ReadonlyArray<string>;
952
+ }
953
+ interface RivusAgentDeployment {
954
+ readonly agentId: string;
955
+ readonly pluginId: string;
956
+ readonly profileId: string;
957
+ readonly projectSpaceId?: string;
958
+ readonly endpointIds: ReadonlyArray<string>;
959
+ readonly memory?: {
960
+ readonly scopes: ReadonlyArray<RivusMemoryScope>;
961
+ readonly tool: boolean;
962
+ };
963
+ readonly runtimeTools?: {
964
+ readonly allow: ReadonlyArray<RivusRuntimeToolId>;
965
+ };
966
+ readonly skills: {
967
+ readonly allow: ReadonlyArray<string>;
968
+ };
969
+ readonly tools: {
970
+ readonly allow: ReadonlyArray<string>;
971
+ };
972
+ }
973
+ interface ResolvedRivusAgentDefinition {
974
+ readonly agentId: string;
975
+ readonly pluginId: string;
976
+ readonly profileId: string;
977
+ readonly projectSpaceId?: string;
978
+ readonly projectSpaceRevision?: string;
979
+ readonly endpointIds: ReadonlyArray<string>;
980
+ readonly profileRevision: string;
981
+ readonly systemPrompt: string;
982
+ readonly model: Readonly<Record<string, unknown>>;
983
+ readonly memory: {
984
+ readonly scopes: ReadonlyArray<RivusMemoryScope>;
985
+ readonly tool: boolean;
986
+ };
987
+ readonly runtimeToolGrantSet: RivusRuntimeToolGrantSet;
988
+ readonly skillGrantSet: RivusSkillGrantSet;
989
+ readonly skills: ReadonlyArray<RegisteredRivusSkill>;
990
+ readonly tools: ReadonlyArray<RivusResolvedToolDescriptor>;
991
+ readonly toolGrantSet: RivusToolGrantSet;
992
+ }
993
+ //#endregion
994
+ //#region src/core/application/agent-host/registry/agent-instance-registry.d.ts
995
+ interface AgentInstanceIdentityFactory {
996
+ createInstanceId(input: {
997
+ readonly bindingKey: string;
998
+ readonly runtimeGenerationId: string;
999
+ }): string;
1000
+ createRuntimeGenerationId(input: AgentRuntimeGenerationIdentity): string;
1001
+ }
1002
+ interface AgentInstanceRegistryOptions {
1003
+ readonly initialRecords?: ReadonlyArray<AgentInstanceRecord>;
1004
+ }
1005
+ interface AgentInstanceRegistry$1 {
1006
+ resolveAutomation(automationId: string, definition: ResolvedRivusAgentDefinition): Effect.Effect<AgentInstanceRecord, AgentInstanceConflict>;
1007
+ resolveBackgroundSession(agentId: string, definition: ResolvedRivusAgentDefinition): Effect.Effect<AgentInstanceRecord, AgentInstanceConflict>;
1008
+ resolveEndpoint(endpointId: string, definition: ResolvedRivusAgentDefinition): Effect.Effect<AgentInstanceRecord, AgentInstanceConflict>;
1009
+ snapshot(): Effect.Effect<ReadonlyArray<AgentInstanceRecord>>;
1010
+ }
1011
+ declare class AgentInstanceConflict extends Error {
1012
+ readonly name = "AgentInstanceConflict";
1013
+ }
1014
+ declare function createEffectAgentInstanceRegistry(identity: AgentInstanceIdentityFactory, options?: AgentInstanceRegistryOptions): AgentInstanceRegistry$1;
1015
+ //#endregion
1016
+ //#region src/core/application/agent-host/routing/agent-host.d.ts
1017
+ interface AgentEndpointDefinition {
1018
+ readonly agentId: string;
1019
+ readonly id: string;
1020
+ }
1021
+ interface AgentAutomationBindingDefinition {
1022
+ readonly definition: ResolvedRivusAgentDefinition;
1023
+ readonly id: string;
1024
+ }
1025
+ interface AgentBackgroundSessionBindingDefinition {
1026
+ readonly agentId: string;
1027
+ readonly definition: ResolvedRivusAgentDefinition;
1028
+ }
1029
+ interface AgentHostOptions {
1030
+ readonly automations?: ReadonlyArray<AgentAutomationBindingDefinition>;
1031
+ readonly backgroundSessions?: ReadonlyArray<AgentBackgroundSessionBindingDefinition>;
1032
+ readonly definitions: ReadonlyArray<ResolvedRivusAgentDefinition>;
1033
+ readonly endpoints: ReadonlyArray<AgentEndpointDefinition>;
1034
+ readonly registry: AgentInstanceRegistry$1;
1035
+ readonly runtime: AgentHostRuntimePort;
1036
+ }
1037
+ interface AgentHost {
1038
+ cancelBackgroundSession(agentId: string, input: AgentRuntimeCancellation$1): Effect.Effect<boolean, unknown>;
1039
+ cancelEndpoint(endpointId: string, input: AgentRuntimeCancellation$1): Effect.Effect<boolean, unknown>;
1040
+ dispose(): Effect.Effect<void, unknown>;
1041
+ handleAutomation(automationId: string, input: AgentRuntimeInput$1): Effect.Effect<unknown, unknown>;
1042
+ handleBackgroundSession(agentId: string, input: AgentRuntimeInput$1): Effect.Effect<unknown, unknown>;
1043
+ handleEndpoint(endpointId: string, input: AgentRuntimeInput$1): Effect.Effect<unknown, unknown>;
1044
+ resolveAutomation(automationId: string): Effect.Effect<AgentInstanceRecord, InvalidAgentHostBinding>;
1045
+ resolveBackgroundSession(agentId: string): Effect.Effect<AgentInstanceRecord, InvalidAgentHostBinding>;
1046
+ resolveEndpoint(endpointId: string): Effect.Effect<AgentInstanceRecord, InvalidAgentHostBinding>;
1047
+ steerEndpoint(endpointId: string, input: AgentRuntimeSteering$1): Effect.Effect<boolean, unknown>;
1048
+ }
1049
+ declare class InvalidAgentHostBinding extends Error {
1050
+ readonly name = "InvalidAgentHostBinding";
1051
+ }
1052
+ declare function createEffectAgentHost(options: AgentHostOptions): Effect.Effect<AgentHost, Error>;
1053
+ //#endregion
1054
+ //#region src/adapters/agent/runtime/effect-agent-runtime-pool.d.ts
1055
+ declare class AgentInstanceBusy extends Error {
1056
+ readonly name = "AgentInstanceBusy";
1057
+ }
1058
+ declare class AgentRuntimeDisposed extends Error {
1059
+ readonly name = "AgentRuntimeDisposed";
1060
+ }
1061
+ declare function createAgentHostRuntimePool(factory: AgentHostRuntimeFactoryPort, disposeTimeoutMs?: number): AgentHostRuntimePort;
1062
+ //#endregion
1063
+ //#region src/adapters/compatibility/agent-host/agent-instance-registry.d.ts
1064
+ interface AgentInstanceRegistry {
1065
+ resolveAutomation(automationId: string, definition: ResolvedRivusAgentDefinition): AgentInstanceRecord;
1066
+ resolveBackgroundSession(agentId: string, definition: ResolvedRivusAgentDefinition): AgentInstanceRecord;
1067
+ resolveEndpoint(endpointId: string, definition: ResolvedRivusAgentDefinition): AgentInstanceRecord;
1068
+ snapshot(): ReadonlyArray<AgentInstanceRecord>;
1069
+ }
1070
+ declare function createAgentInstanceRegistry(options?: AgentInstanceRegistryOptions): AgentInstanceRegistry;
1071
+ //#endregion
1072
+ //#region src/adapters/compatibility/agent-host/agent-runtime-pool.d.ts
1073
+ interface AgentRuntimeInput {
1074
+ readonly invocation?: AgentInvocationOrigin;
1075
+ readonly onUpdate?: (update: AgentRunUpdate) => void | Promise<void>;
1076
+ readonly payload?: unknown;
1077
+ readonly sessionKey: SessionKey;
1078
+ readonly text: string;
1079
+ }
1080
+ interface AgentRuntimeCancellation extends AgentRuntimeCancellation$1 {}
1081
+ interface AgentRuntimeSteering extends AgentRuntimeSteering$1 {}
1082
+ interface PooledAgentRuntime {
1083
+ readonly concurrency?: "managed";
1084
+ cancel?(input: AgentRuntimeCancellation): Promise<boolean>;
1085
+ steer?(input: AgentRuntimeSteering): Promise<boolean>;
1086
+ run(input: AgentRuntimeInput): Promise<unknown>;
1087
+ dispose?(): Promise<void> | void;
1088
+ }
1089
+ interface AgentRuntimePoolOptions {
1090
+ readonly disposeTimeoutMs?: number;
1091
+ readonly registry: AgentInstanceRegistry;
1092
+ readonly createRuntime: (instance: AgentInstanceRecord) => PooledAgentRuntime | Promise<PooledAgentRuntime>;
1093
+ }
1094
+ interface AgentRuntimePool {
1095
+ readonly registry: AgentInstanceRegistry;
1096
+ cancel(instance: AgentInstanceRecord, input: AgentRuntimeCancellation): Promise<boolean>;
1097
+ steer(instance: AgentInstanceRecord, input: AgentRuntimeSteering): Promise<boolean>;
1098
+ run(instance: AgentInstanceRecord, input: AgentRuntimeInput): Promise<unknown>;
1099
+ disposeAll(): Promise<void>;
1100
+ }
1101
+ declare function createAgentRuntimePool(options: AgentRuntimePoolOptions): AgentRuntimePool;
1102
+ //#endregion
1103
+ //#region src/adapters/compatibility/agent-host/rivus-agent-host.d.ts
1104
+ interface RivusEndpointDefinition {
1105
+ readonly id: string;
1106
+ readonly agentId: string;
1107
+ }
1108
+ interface RivusAgentHostOptions {
1109
+ readonly automations?: ReadonlyArray<RivusAutomationDefinition>;
1110
+ readonly backgroundSessions?: ReadonlyArray<RivusBackgroundSessionDefinition>;
1111
+ readonly definitions: ReadonlyArray<ResolvedRivusAgentDefinition>;
1112
+ readonly endpoints: ReadonlyArray<RivusEndpointDefinition>;
1113
+ readonly runtimePool: AgentRuntimePool;
1114
+ }
1115
+ interface RivusAutomationDefinition {
1116
+ readonly definition: ResolvedRivusAgentDefinition;
1117
+ readonly id: string;
1118
+ }
1119
+ interface RivusBackgroundSessionDefinition {
1120
+ readonly agentId: string;
1121
+ readonly definition: ResolvedRivusAgentDefinition;
1122
+ }
1123
+ interface RivusEndpointInput$1 extends AgentRuntimeInput {}
1124
+ interface RivusAgentHost {
1125
+ cancelBackgroundSession(agentId: string, input: AgentRuntimeCancellation): Promise<boolean>;
1126
+ cancelEndpoint(endpointId: string, input: AgentRuntimeCancellation): Promise<boolean>;
1127
+ steerEndpoint(endpointId: string, input: AgentRuntimeSteering): Promise<boolean>;
1128
+ handleAutomation(automationId: string, input: AgentRuntimeInput): Promise<unknown>;
1129
+ handleBackgroundSession(agentId: string, input: AgentRuntimeInput): Promise<unknown>;
1130
+ handleEndpoint(endpointId: string, input: RivusEndpointInput$1): Promise<unknown>;
1131
+ resolveAutomation(automationId: string): AgentInstanceRecord;
1132
+ resolveBackgroundSession(agentId: string): AgentInstanceRecord;
1133
+ resolveEndpoint(endpointId: string): AgentInstanceRecord;
1134
+ }
1135
+ declare class InvalidRivusEndpointBinding extends Error {
1136
+ readonly name = "InvalidRivusEndpointBinding";
1137
+ }
1138
+ declare function createRivusAgentHost(options: RivusAgentHostOptions): RivusAgentHost;
1139
+ //#endregion
1140
+ //#region src/adapters/agent/background-session/background-session-host-tools.d.ts
1141
+ interface CreateBackgroundSessionHostToolsOptions {
1142
+ readonly createSessionId: () => string;
1143
+ readonly definition: ResolvedRivusAgentDefinition;
1144
+ readonly service: BackgroundSessionService;
1145
+ }
1146
+ declare function createBackgroundSessionHostTools(options: CreateBackgroundSessionHostToolsOptions): ReadonlyArray<RivusHostToolDescriptor>;
1147
+ //#endregion
1148
+ //#region src/core/application/agent-catalog/contracts/rivus-plugin.d.ts
1149
+ declare const RIVUS_PLUGIN_API_VERSION = "1";
1150
+ interface RivusPluginManifest {
1151
+ readonly apiVersion: string;
1152
+ readonly id: string;
1153
+ readonly version: string;
1154
+ }
1155
+ interface RegisteredRivusPlugin extends RivusPluginManifest {}
1156
+ declare class InvalidRivusPlugin extends Error {
1157
+ readonly name = "InvalidRivusPlugin";
1158
+ }
1159
+ //#endregion
1160
+ //#region src/core/application/agent-catalog/contracts/rivus-automation-template.d.ts
1161
+ interface RivusAutomationTemplate {
1162
+ readonly id: string;
1163
+ readonly profileId: string;
1164
+ readonly requestedSkillIds: ReadonlyArray<string>;
1165
+ readonly requestedToolIds: ReadonlyArray<string>;
1166
+ readonly createInput: (tick: RivusAutomationTickContext) => RivusAutomationInput;
1167
+ readonly createPresentation?: (output: RivusAutomationOutput) => AutomationPresentation;
1168
+ }
1169
+ interface RivusAutomationTickContext {
1170
+ readonly occurrence: string;
1171
+ }
1172
+ interface RivusAutomationInput {
1173
+ readonly text: string;
1174
+ }
1175
+ interface RivusAutomationOutput {
1176
+ readonly occurrence: string;
1177
+ readonly text: string;
1178
+ }
1179
+ interface RegisteredRivusAutomation extends RivusAutomationTemplate {
1180
+ readonly pluginId: string;
1181
+ }
1182
+ //#endregion
1183
+ //#region src/core/application/agent-catalog/contracts/rivus-tool-descriptor-provider.d.ts
1184
+ type RivusCatalogToolContributionScope = "profile" | "runtime";
1185
+ interface RivusCatalogToolContribution {
1186
+ readonly scope: RivusCatalogToolContributionScope;
1187
+ readonly tool: RivusResolvedToolDescriptor;
1188
+ }
1189
+ interface RivusCatalogToolDescriptorRequest {
1190
+ readonly deployment: RivusAgentDeployment;
1191
+ readonly memoryScopes: ReadonlyArray<RivusMemoryScope>;
1192
+ readonly profile: RegisteredRivusAgentProfile;
1193
+ }
1194
+ interface RivusCatalogToolDescriptorProvider {
1195
+ provide(request: RivusCatalogToolDescriptorRequest): ReadonlyArray<RivusCatalogToolContribution>;
1196
+ }
1197
+ //#endregion
1198
+ //#region src/core/application/agent-catalog/contracts/rivus-plugin-contracts.d.ts
1199
+ interface RivusPluginRegistry {
1200
+ registerAgentProfile(profile: RivusAgentProfile): void;
1201
+ registerTool(tool: RivusToolDescriptor): void;
1202
+ registerSkill(skill: RivusSkillDescriptor): void;
1203
+ registerAutomation(template: RivusAutomationTemplate): void;
1204
+ }
1205
+ interface RivusPlugin {
1206
+ readonly manifest: RivusPluginManifest;
1207
+ register(registry: RivusPluginRegistry): void;
1208
+ }
1209
+ interface RivusPluginCatalogSnapshot {
1210
+ readonly plugins: ReadonlyArray<RegisteredRivusPlugin>;
1211
+ readonly profiles: ReadonlyArray<RegisteredRivusAgentProfile>;
1212
+ readonly tools: ReadonlyArray<RegisteredRivusTool>;
1213
+ readonly skills: ReadonlyArray<RegisteredRivusSkill>;
1214
+ readonly automations: ReadonlyArray<RegisteredRivusAutomation>;
1215
+ }
1216
+ interface RivusPluginCatalog {
1217
+ registerPlugin(plugin: RivusPlugin): void;
1218
+ snapshot(): RivusPluginCatalogSnapshot;
1219
+ }
1220
+ //#endregion
1221
+ //#region src/core/application/agent-catalog/resolution/rivus-agent-definition-resolver.d.ts
1222
+ interface RivusAgentDefinitionResolver {
1223
+ resolve(catalog: RivusPluginCatalog, deployment: RivusAgentDeployment): ResolvedRivusAgentDefinition;
1224
+ }
1225
+ interface RivusAgentCatalog extends RivusAgentDefinitionResolver {
1226
+ createPluginCatalog(): RivusPluginCatalog;
1227
+ readonly restrictGrants: (definition: ResolvedRivusAgentDefinition, restriction: RivusAgentGrantRestriction) => ResolvedRivusAgentDefinition;
1228
+ }
1229
+ //#endregion
1230
+ //#region src/adapters/compatibility/agent-catalog/rivus-agent-catalog.d.ts
1231
+ interface CreateCompatibleRivusAgentCatalogOptions {
1232
+ readonly backgroundSessions?: boolean;
1233
+ }
1234
+ interface CreateRivusAgentCatalogOptions {
1235
+ readonly toolDescriptorProviders?: ReadonlyArray<RivusCatalogToolDescriptorProvider>;
1236
+ }
1237
+ declare function createRivusPluginCatalog(): RivusPluginCatalog;
1238
+ declare function createRivusAgentCatalog(options?: CreateRivusAgentCatalogOptions): RivusAgentCatalog;
1239
+ declare function createCompatibleRivusAgentCatalog(options?: CreateCompatibleRivusAgentCatalogOptions): RivusAgentCatalog;
1240
+ declare function resolveRivusAgentDefinition(catalog: RivusPluginCatalog, deployment: RivusAgentDeployment, options?: {
1241
+ readonly backgroundSessions?: boolean;
1242
+ }): ResolvedRivusAgentDefinition;
1243
+ //#endregion
1244
+ //#region src/core/application/agent-catalog/catalog/rivus-catalog-validation.d.ts
1245
+ declare function validateRivusPluginManifest(manifest: RivusPluginManifest): void;
1246
+ interface RivusCatalogRegistrationItem {
1247
+ readonly id: string;
1248
+ readonly kind: string;
1249
+ readonly namespaced: boolean;
1250
+ readonly pluginId: string;
1251
+ }
1252
+ declare function validateRivusCatalogRegistration(item: RivusCatalogRegistrationItem, existing: ReadonlyMap<string, unknown>, pending: ReadonlySet<string>): void;
1253
+ declare function validateRivusCatalogIdentifier(id: string, kind: string): void;
1254
+ //#endregion
1255
+ //#region src/core/application/deployment/model/model-state-repository.d.ts
1256
+ /** Durable application port for the managed model state snapshot. */
1257
+ interface ModelStateRepository {
1258
+ load(): Effect.Effect<ModelState, unknown>;
1259
+ persist(state: ModelState): Effect.Effect<ModelState, unknown>;
1260
+ }
1261
+ //#endregion
1262
+ //#region src/core/application/deployment/model/model-change-contracts.d.ts
1263
+ /**
1264
+ * Gateway-persistent budget reservation. The Runtime boundary only sees the
1265
+ * minimal {@link import("@rivus/runtime").ModelChangeBudgetReservation}
1266
+ * shape (`id`, `maxOutputTokens`); the coordinator stores the full record
1267
+ * (kind, paid-request count, reservation timestamp) for settlement and
1268
+ * recovery policy.
1269
+ */
1270
+ interface ModelChangeBudgetReservation {
1271
+ readonly id: string;
1272
+ readonly kind: ModelChangePaidCallKind;
1273
+ readonly maxOutputTokens: number;
1274
+ readonly paidRequests: 1;
1275
+ readonly reservedAt: string;
1276
+ }
1277
+ declare const MODEL_STATE_SCHEMA_VERSION: 1;
1278
+ type ModelChangeOperation = "set" | "rollback";
1279
+ type ModelChangeStatus = "pending" | "applied" | "failed" | "restored" | "recovery-required";
1280
+ type ModelChangePhase = "awaiting-approval" | "accepted" | "waiting-for-boundary" | "validating" | "activating" | "committing" | "notifying" | "completed" | "validation-unknown" | "recovery-required";
1281
+ type ModelChangeFailureOutcome = "known" | "unknown";
1282
+ interface ModelChangeSourceHint {
1283
+ /** This is a routing hint only. It does not grant authorization. */
1284
+ readonly kind: "automation" | "human" | "unknown";
1285
+ readonly reference?: string;
1286
+ }
1287
+ interface ModelChangeSubmission {
1288
+ readonly expectedRevision: number;
1289
+ readonly operation: ModelChangeOperation;
1290
+ readonly requestId: string;
1291
+ readonly target?: ModelReference;
1292
+ }
1293
+ /** An opaque transport reference resolved by the trusted authorization adapter. */
1294
+ interface ModelChangeTransportContext {
1295
+ readonly reference: string;
1296
+ }
1297
+ interface ModelChangeSource {
1298
+ readonly kind: "automation" | "human";
1299
+ readonly reference: string;
1300
+ }
1301
+ interface ModelChangePrincipal {
1302
+ readonly homeId: string;
1303
+ readonly ownerId: string;
1304
+ readonly source: ModelChangeSource;
1305
+ }
1306
+ interface ModelChangeBudgetLimits {
1307
+ readonly deadlineAt: string;
1308
+ readonly identity: string;
1309
+ readonly maxOutputTokens: number;
1310
+ readonly maxPaidRequests: number;
1311
+ readonly recoveryReserveOutputTokens: number;
1312
+ readonly recoveryReservePaidRequests: number;
1313
+ }
1314
+ interface ModelChangeAuthorizationInput {
1315
+ readonly current: ModelBinding;
1316
+ readonly homeId: string;
1317
+ readonly request: ModelChangeSubmission;
1318
+ readonly transport: ModelChangeTransportContext;
1319
+ /** Server-derived prior receipt context, used to preserve a pending approval deadline. */
1320
+ readonly existing?: {
1321
+ readonly authorizationId?: string;
1322
+ readonly deadlineAt?: string;
1323
+ };
1324
+ }
1325
+ interface ApprovedModelChangeAuthorization {
1326
+ readonly authorizationId: string;
1327
+ readonly bindingRevision: string;
1328
+ readonly budget: ModelChangeBudgetLimits;
1329
+ readonly principal: ModelChangePrincipal;
1330
+ readonly status: "approved";
1331
+ }
1332
+ interface AwaitingModelChangeAuthorization {
1333
+ readonly authorizationId?: string;
1334
+ readonly bindingRevision?: string;
1335
+ readonly deadlineAt?: string;
1336
+ readonly principal?: ModelChangePrincipal;
1337
+ readonly reason: string;
1338
+ readonly status: "awaiting-approval";
1339
+ }
1340
+ interface RejectedModelChangeAuthorization {
1341
+ readonly code: string;
1342
+ readonly reason: string;
1343
+ readonly status: "rejected";
1344
+ }
1345
+ type ModelChangeAuthorizationDecision = ApprovedModelChangeAuthorization | AwaitingModelChangeAuthorization | RejectedModelChangeAuthorization;
1346
+ interface ModelChangeAuthorizationPort {
1347
+ authorize(input: ModelChangeAuthorizationInput): Effect.Effect<ModelChangeAuthorizationDecision, unknown>;
1348
+ revalidate(input: {
1349
+ readonly authorizationId: string;
1350
+ readonly current: ModelBinding;
1351
+ readonly homeId: string;
1352
+ readonly pending: ModelChangePending;
1353
+ }): Effect.Effect<{
1354
+ readonly bindingRevision: string;
1355
+ readonly status: "approved";
1356
+ } | {
1357
+ readonly code: string;
1358
+ readonly reason: string;
1359
+ readonly status: "rejected";
1360
+ }, unknown>;
1361
+ /** Resolve a durable awaiting approval from the accepted-worker context. */
1362
+ readonly resolvePending?: (input: {
1363
+ readonly current: ModelBinding;
1364
+ readonly homeId: string;
1365
+ readonly pending: ModelChangePending;
1366
+ }) => Effect.Effect<ModelChangeAuthorizationDecision, unknown>;
1367
+ }
1368
+ interface ModelChangeBudget {
1369
+ readonly deadlineAt: string;
1370
+ readonly identity: string;
1371
+ readonly maxOutputTokens: number;
1372
+ readonly maxPaidRequests: number;
1373
+ readonly outputTokens: number;
1374
+ readonly paidRequests: number;
1375
+ readonly recoveryReserveOutputTokens: number;
1376
+ readonly recoveryReservePaidRequests: number;
1377
+ readonly reservations: Readonly<Record<string, ModelChangeBudgetReservation>>;
1378
+ readonly reservedOutputTokens: number;
1379
+ readonly reservedPaidRequests: number;
1380
+ }
1381
+ interface ModelChangeError {
1382
+ readonly code: string;
1383
+ readonly message: string;
1384
+ readonly outcome: ModelChangeFailureOutcome;
1385
+ readonly stage: "activation" | "boundary" | "commit" | "notification" | "restore" | "validation";
1386
+ }
1387
+ interface ModelChangeNotification {
1388
+ readonly attempts: number;
1389
+ readonly lastAttemptAt?: string;
1390
+ readonly status: "pending" | "sent" | "unknown";
1391
+ }
1392
+ interface ModelChangeReceiptFields {
1393
+ readonly acceptedAt: string;
1394
+ readonly current?: ModelBinding;
1395
+ readonly error?: ModelChangeError;
1396
+ readonly expectedRevision: number;
1397
+ readonly operation: ModelChangeOperation;
1398
+ readonly phase: ModelChangePhase;
1399
+ readonly previous?: ModelBinding;
1400
+ readonly requestId: string;
1401
+ readonly revision: number;
1402
+ readonly status: ModelChangeStatus;
1403
+ readonly target?: ModelReference;
1404
+ readonly updatedAt: string;
1405
+ }
1406
+ interface ModelChangeReceipt extends ModelChangeReceiptFields {
1407
+ readonly authorizationId?: string;
1408
+ readonly bindingRevision: string;
1409
+ readonly budget: ModelChangeBudget;
1410
+ readonly budgetIdentity: string;
1411
+ readonly inputDigest: string;
1412
+ readonly notification?: ModelChangeNotification;
1413
+ readonly principal?: ModelChangePrincipal;
1414
+ }
1415
+ interface ModelChangePending {
1416
+ readonly acceptedAt: string;
1417
+ readonly authorizationId?: string;
1418
+ readonly bindingRevision: string;
1419
+ readonly budget: ModelChangeBudget;
1420
+ readonly budgetIdentity: string;
1421
+ readonly expectedRevision: number;
1422
+ readonly inputDigest: string;
1423
+ readonly operation: ModelChangeOperation;
1424
+ readonly ownerId?: string;
1425
+ readonly phase: ModelChangePhase;
1426
+ readonly principal?: ModelChangePrincipal;
1427
+ readonly request: ModelChangeSubmission;
1428
+ readonly recoveryAttemptedAt?: string;
1429
+ readonly target?: ModelReference;
1430
+ readonly unknownPaidCallId?: string;
1431
+ readonly updatedAt: string;
1432
+ }
1433
+ interface ModelState {
1434
+ readonly current: ModelBinding;
1435
+ readonly homeId: string;
1436
+ readonly ownerId: string;
1437
+ readonly pending?: ModelChangePending;
1438
+ readonly previous?: ModelBinding;
1439
+ readonly recoveryRequired?: ModelChangeError;
1440
+ readonly requests: Readonly<Record<string, ModelChangeReceipt>>;
1441
+ readonly revision: number;
1442
+ readonly schemaVersion: typeof MODEL_STATE_SCHEMA_VERSION;
1443
+ readonly updatedAt: string;
1444
+ }
1445
+ interface ModelStatusView {
1446
+ readonly actual?: ModelBinding;
1447
+ readonly current: ModelBinding;
1448
+ readonly homeId: string;
1449
+ readonly pending?: Pick<ModelChangePending, "phase" | "request" | "target" | "updatedAt">;
1450
+ readonly previous?: ModelBinding;
1451
+ readonly request?: ModelChangePublicReceipt;
1452
+ readonly persisted: ModelBinding;
1453
+ readonly recoveryRequired?: ModelChangeError;
1454
+ readonly revision: number;
1455
+ readonly source: "legacy" | "managed";
1456
+ }
1457
+ type ModelChangeStatusView = ModelStatusView;
1458
+ interface ModelChangePublicReceipt extends ModelChangeReceiptFields {
1459
+ readonly budget: Pick<ModelChangeBudget, "deadlineAt" | "maxOutputTokens" | "maxPaidRequests" | "outputTokens" | "paidRequests">;
1460
+ }
1461
+ interface ModelChangeBoundaryInput {
1462
+ readonly deadlineAt: string;
1463
+ readonly requestId: string;
1464
+ }
1465
+ interface ModelChangeBoundaryResult {
1466
+ readonly activeRuns: 0;
1467
+ readonly completedAt: string;
1468
+ }
1469
+ interface ModelChangeBoundaryPort {
1470
+ resumeAfterChange(input: {
1471
+ readonly requestId: string;
1472
+ }): Effect.Effect<void, unknown>;
1473
+ waitForSafeBoundary(input: ModelChangeBoundaryInput): Effect.Effect<ModelChangeBoundaryResult, unknown>;
1474
+ }
1475
+ interface ModelChangeNotificationPort {
1476
+ notify(input: {
1477
+ readonly receipt: ModelChangePublicReceipt;
1478
+ readonly retry: boolean;
1479
+ }): Effect.Effect<{
1480
+ readonly delivered: true;
1481
+ }, unknown>;
1482
+ }
1483
+ interface ModelChangeIdentityPort {
1484
+ digest(input: {
1485
+ readonly bindingRevision: string;
1486
+ readonly expectedRevision: number;
1487
+ readonly homeId: string;
1488
+ readonly ownerId: string;
1489
+ readonly operation: ModelChangeOperation;
1490
+ readonly requestId: string;
1491
+ readonly source: ModelChangeSource;
1492
+ readonly target?: ModelReference;
1493
+ readonly authorizationId?: string;
1494
+ readonly budgetIdentity?: string;
1495
+ }): string;
1496
+ }
1497
+ interface ModelChangeCoordinatorOptions {
1498
+ readonly authorization: ModelChangeAuthorizationPort;
1499
+ readonly boundary: ModelChangeBoundaryPort;
1500
+ readonly clock: ModelChangeClock;
1501
+ readonly homeId: string;
1502
+ readonly identity: ModelChangeIdentityPort;
1503
+ readonly notification?: ModelChangeNotificationPort;
1504
+ readonly repository: ModelStateRepository;
1505
+ readonly runtime: ModelChangeRuntimePort;
1506
+ }
1507
+ interface ModelChangeCoordinator {
1508
+ accept(input: ModelChangeSubmission, transport: ModelChangeTransportContext): Effect.Effect<ModelChangeReceipt, unknown>;
1509
+ recover(): Effect.Effect<ModelState, unknown>;
1510
+ run(requestId: string): Effect.Effect<ModelChangeReceipt, unknown>;
1511
+ status(requestId?: string): Effect.Effect<ModelStatusView, unknown>;
1512
+ }
1513
+ declare class ModelChangeRequestConflict extends Error {
1514
+ readonly name = "ModelChangeRequestConflict";
1515
+ }
1516
+ declare class ModelChangeRevisionConflict extends Error {
1517
+ readonly name = "ModelChangeRevisionConflict";
1518
+ }
1519
+ declare class ModelChangeBusy extends Error {
1520
+ readonly name = "ModelChangeBusy";
1521
+ }
1522
+ declare class ModelChangeNotFound extends Error {
1523
+ readonly name = "ModelChangeNotFound";
1524
+ }
1525
+ declare class ModelChangeAuthorizationRejected extends Error {
1526
+ readonly name = "ModelChangeAuthorizationRejected";
1527
+ }
1528
+ declare class ModelStateCorrupted extends Error {
1529
+ readonly name = "ModelStateCorrupted";
1530
+ }
1531
+ //#endregion
1532
+ //#region src/core/application/deployment/model/model-change-authorization-contracts.d.ts
1533
+ /** A Host-maintained grant. No field in this contract comes from the CLI request. */
1534
+ interface ModelManagementGrant {
1535
+ readonly bindingRevision: string;
1536
+ readonly budget: Omit<ModelChangeBudgetLimits, "identity" | "deadlineAt">;
1537
+ readonly enabled: boolean;
1538
+ readonly endpointId: string;
1539
+ readonly homeId: string;
1540
+ readonly operations: ReadonlyArray<ModelChangeOperation>;
1541
+ readonly ownerId: string;
1542
+ readonly provider: string;
1543
+ readonly revision: number;
1544
+ /** Host policy requiring a durable human decision before this request can run. */
1545
+ readonly requireApproval?: boolean;
1546
+ readonly tenantKey: string;
1547
+ readonly timeoutMs: number;
1548
+ }
1549
+ interface ModelChangeApprovalInput {
1550
+ /** Present only while creating the interaction from a live trusted Run. */
1551
+ readonly authority?: ModelChangeApprovalAuthority;
1552
+ readonly budget: ModelManagementGrant["budget"];
1553
+ readonly expiresAt: string;
1554
+ readonly grantRevision: number;
1555
+ readonly interactionId: string;
1556
+ readonly principal: ModelChangePrincipal;
1557
+ readonly request: ModelChangeSubmission;
1558
+ }
1559
+ interface ModelChangeApprovalAuthority {
1560
+ readonly agentId: string;
1561
+ readonly endpointId?: string;
1562
+ readonly instanceId: string;
1563
+ readonly runId: string;
1564
+ readonly sessionKey: string;
1565
+ readonly sourceMessageId: string;
1566
+ readonly tenantKey: string;
1567
+ }
1568
+ type ModelChangeApprovalStatus = {
1569
+ readonly status: "approved";
1570
+ } | {
1571
+ readonly reason?: string;
1572
+ readonly status: "pending";
1573
+ } | {
1574
+ readonly reason?: string;
1575
+ readonly status: "rejected";
1576
+ };
1577
+ /** Durable approval adapter. Initial authorization must stay non-blocking; accepted workers may wait. */
1578
+ interface ModelChangeApprovalPort {
1579
+ requestOrGet(input: ModelChangeApprovalInput): Effect.Effect<ModelChangeApprovalStatus, unknown>;
1580
+ waitForResolution(input: ModelChangeApprovalInput): Effect.Effect<ModelChangeApprovalStatus, unknown>;
1581
+ }
1582
+ interface ModelManagementTrustedRun {
1583
+ readonly authority: InvocationAuthorityRef;
1584
+ readonly kind: "human";
1585
+ }
1586
+ interface ModelChangeAuthorizationOptions {
1587
+ readonly approval?: ModelChangeApprovalPort;
1588
+ readonly clock: {
1589
+ now(): string;
1590
+ };
1591
+ readonly digest: ToolInputDigest;
1592
+ readonly grant: {
1593
+ current(): Effect.Effect<ModelManagementGrant, unknown>;
1594
+ };
1595
+ /** Host-canonical Agent identity used for the Home-wide model operation. */
1596
+ readonly managementAgentId: string;
1597
+ readonly operations: ToolOperationLedger;
1598
+ readonly resolveRun: (reference: string) => Effect.Effect<ModelManagementTrustedRun | undefined, unknown>;
1599
+ /** Host-issued worker authority; it must be reconstructed from the persisted trusted binding. */
1600
+ readonly resolveWorkerRun?: (input: {
1601
+ readonly authorizationId: string;
1602
+ readonly grant: ModelManagementGrant;
1603
+ readonly principal: ModelChangePrincipal;
1604
+ readonly request: ModelChangeSubmission;
1605
+ }) => Effect.Effect<ModelManagementTrustedRun | undefined, unknown>;
1606
+ }
1607
+ //#endregion
1608
+ //#region src/core/application/deployment/model/model-change-authorization.d.ts
1609
+ /** Reuses Broker policy, exact approval binding and its durable operation ledger. */
1610
+ declare function createModelChangeAuthorization(options: ModelChangeAuthorizationOptions): ModelChangeAuthorizationPort;
1611
+ //#endregion
1612
+ //#region src/core/application/deployment/model/model-change-coordinator.d.ts
1613
+ declare function createModelChangeCoordinator(options: ModelChangeCoordinatorOptions): ModelChangeCoordinator;
1614
+ //#endregion
1615
+ //#region src/core/application/deployment/model/model-change-run-boundary.d.ts
1616
+ interface ModelChangeRunLease {
1617
+ /** Release exactly one active Run. Releasing twice is harmless. */
1618
+ readonly release: () => void;
1619
+ }
1620
+ interface ModelChangeRunBoundaryOptions {
1621
+ readonly clock: ModelChangeClock;
1622
+ }
1623
+ /**
1624
+ * Gateway-facing run boundary. Wraps the single Runtime {@link RunAdmission}
1625
+ * mechanism with the model-change request identity (`requestId`) and drain
1626
+ * deadline semantics owned by the coordinator.
1627
+ *
1628
+ * This is the required Gateway policy adapter; it does not create a second
1629
+ * counter or parallel lifecycle. All foreground/background Runs still share
1630
+ * one admission authority.
1631
+ */
1632
+ interface ModelChangeRunBoundary extends ModelChangeBoundaryPort {
1633
+ /** Acquire admission for one concrete Run before resolving a session/model. */
1634
+ acquireRun(input?: {
1635
+ readonly deadlineAt?: string;
1636
+ readonly signal?: AbortSignal;
1637
+ }): Effect.Effect<ModelChangeRunLease, unknown>;
1638
+ /** Synchronously close admission; existing leases continue to drain. */
1639
+ fence(): void;
1640
+ readonly activeRunCount: () => number;
1641
+ readonly admissionOpen: () => boolean;
1642
+ }
1643
+ declare function createModelChangeRunBoundary(options: ModelChangeRunBoundaryOptions): ModelChangeRunBoundary;
1644
+ //#endregion
1645
+ //#region src/bootstrap/deployment/model-management/model-management-control.d.ts
1646
+ interface ModelManagementControlOptions extends ModelChangeCoordinatorOptions {
1647
+ /** Immediately close admission; this must not wait for existing Runs. */
1648
+ readonly stopBusinessWork: () => void;
1649
+ readonly resolveTrustedReference: (reference: string) => Promise<boolean>;
1650
+ readonly runtimeVersion: string;
1651
+ readonly socketPath: string;
1652
+ }
1653
+ interface ModelManagementControl {
1654
+ /** Acquire the socket first, then recover before constructing business sessions. */
1655
+ recover(): Promise<ModelState>;
1656
+ start(): Promise<void>;
1657
+ close(): Promise<void>;
1658
+ }
1659
+ /** Owns the control socket and the accepted-operation worker for one Home. */
1660
+ declare function createModelManagementControl(options: ModelManagementControlOptions): ModelManagementControl;
1661
+ //#endregion
1662
+ //#region src/platform/home/config/runtime/rivus-daemon-config.d.ts
1663
+ type RivusDaemonEnv = Readonly<Record<string, string | undefined>>;
1664
+ type RivusThinkingLevel = "off" | "minimal" | "low" | "medium" | "high" | "xhigh";
1665
+ type RivusTextFileReader = (path: string) => Promise<string> | string;
1666
+ interface RivusDaemonConfigLoaderOptions {
1667
+ readonly readTextFile?: RivusTextFileReader;
1668
+ }
1669
+ interface RivusDaemonConfig {
1670
+ readonly agentId: string;
1671
+ readonly feishu: {
1672
+ readonly appId: string;
1673
+ readonly appSecret: string;
1674
+ readonly baseUrl: string;
1675
+ readonly cardStreamLeaseMs: number;
1676
+ readonly streamMinIntervalMs: number;
1677
+ };
1678
+ readonly pi: {
1679
+ readonly apiKey?: string;
1680
+ readonly baseUrl?: string;
1681
+ readonly model?: string;
1682
+ readonly thinkingLevel?: RivusThinkingLevel;
1683
+ };
1684
+ }
1685
+ declare class RivusDaemonConfigError {
1686
+ readonly variable: string;
1687
+ readonly message: string;
1688
+ readonly _tag = "RivusDaemonConfigError";
1689
+ constructor(variable: string, message: string);
1690
+ }
1691
+ declare function loadRivusDaemonConfig(env: RivusDaemonEnv, options?: RivusDaemonConfigLoaderOptions): Effect.Effect<RivusDaemonConfig, RivusDaemonConfigError>;
1692
+ //#endregion
1693
+ //#region src/platform/home/config/model-management/rivus-model-management-config-migration.d.ts
1694
+ interface RivusModelReference {
1695
+ readonly model: string;
1696
+ readonly provider: string;
1697
+ }
1698
+ //#endregion
1699
+ //#region src/platform/home/config/model-management/rivus-runtime-management-skill-installer.d.ts
1700
+ type RivusRuntimeManagementSkillInstallStatus = "conflict" | "installed" | "unchanged" | "updated";
1701
+ interface RivusRuntimeManagementSkillInstallResult {
1702
+ readonly destination: string;
1703
+ readonly requiresRefresh: boolean;
1704
+ readonly sourceDigest: string;
1705
+ readonly status: RivusRuntimeManagementSkillInstallStatus;
1706
+ }
1707
+ //#endregion
1708
+ //#region src/adapters/pi/model-management/pi-model-run-context.d.ts
1709
+ type PiBashSpawnHook = PiManagedRunProviderResult["spawnHook"];
1710
+ declare const RIVUS_MODEL_CONTEXT_ENV: "RIVUS_MODEL_CONTEXT";
1711
+ declare const RIVUS_MODEL_SOCKET_ENV: "RIVUS_MODEL_SOCKET";
1712
+ declare const RIVUS_MODEL_CHANGE_TOOL_ID: "rivus.model.change";
1713
+ type PiModelContextReference = string & {
1714
+ readonly __rivusModelContextReference: unique symbol;
1715
+ };
1716
+ interface PiModelRunContext {
1717
+ readonly reference: PiModelContextReference;
1718
+ readonly runId: string;
1719
+ }
1720
+ interface PiModelTrustedRun {
1721
+ readonly authority: InvocationAuthorityRef;
1722
+ readonly kind: "human";
1723
+ }
1724
+ interface PiModelRunContextRegistryOptions {
1725
+ readonly agentId: string;
1726
+ readonly instanceId: string;
1727
+ readonly modelManagementEnabled?: boolean;
1728
+ readonly toolGrantSet: InvocationToolGrantSet;
1729
+ }
1730
+ interface PiModelRunContextRegistry {
1731
+ /** Issue one private context for one concrete AgentLoopInput/run. */
1732
+ issue(input: AgentLoopInput): PiModelRunContext;
1733
+ /** Resolve only a context issued by this registry while its Run is active. */
1734
+ resolveRun(reference: PiModelContextReference | string): PiModelTrustedRun | undefined;
1735
+ /** Revoke one context. Runtime should call this when the Run completes. */
1736
+ revoke(reference: PiModelContextReference | string): boolean;
1737
+ }
1738
+ interface PiModelManagementBashSpawnHookOptions {
1739
+ readonly context: PiModelRunContext;
1740
+ readonly socketPath: string;
1741
+ }
1742
+ declare class PiModelRunContextError extends Error {
1743
+ readonly code: "invalid-input" | "run-aborted" | "untrusted-invocation";
1744
+ readonly name = "PiModelRunContextError";
1745
+ constructor(code: PiModelRunContextError["code"], message: string);
1746
+ }
1747
+ /**
1748
+ * Keep the model-management capability bound to a concrete host-owned Run.
1749
+ * The reference is the only value that crosses into a child process; all
1750
+ * invocation identity stays in this process behind the authority WeakMap.
1751
+ */
1752
+ declare function createPiModelRunContextRegistry(options: PiModelRunContextRegistryOptions): PiModelRunContextRegistry;
1753
+ /**
1754
+ * Inject the private transport values at process spawn time. The SDK passes
1755
+ * this hook the command and environment separately, so the opaque reference
1756
+ * never becomes model prompt content, an argv item, or a JSON request field.
1757
+ */
1758
+ declare function createPiModelManagementBashSpawnHook(options: PiModelManagementBashSpawnHookOptions): PiBashSpawnHook;
1759
+ //#endregion
1760
+ //#region src/platform/home/rivus-home.d.ts
1761
+ type RivusHomeEnvironment = Readonly<Record<string, string | undefined>>;
1762
+ interface RivusHome {
1763
+ readonly bootstrap: string;
1764
+ readonly directory: string;
1765
+ readonly envFilePath: string;
1766
+ readonly logsDirectory: string;
1767
+ readonly manifestPath: string;
1768
+ readonly stateDirectory: string;
1769
+ readonly workspaceDirectory: string;
1770
+ }
1771
+ interface InitializedRivusHome {
1772
+ readonly directory: string;
1773
+ readonly files: ReadonlyArray<string>;
1774
+ }
1775
+ interface RivusHomeDoctorCheck {
1776
+ readonly message: string;
1777
+ readonly name: "node" | "home" | "workspace" | "modules" | "manifest" | "credentials";
1778
+ readonly status: "pass" | "fail";
1779
+ }
1780
+ interface RivusHomeDoctorReport {
1781
+ readonly checks: ReadonlyArray<RivusHomeDoctorCheck>;
1782
+ readonly directory: string;
1783
+ readonly ready: boolean;
1784
+ }
1785
+ interface RivusHomeApi {
1786
+ diagnose(input: {
1787
+ readonly directory: string;
1788
+ readonly env: RivusHomeEnvironment;
1789
+ readonly envFilePath?: string;
1790
+ readonly nodeVersion: string;
1791
+ }): Effect.Effect<RivusHomeDoctorReport, Error>;
1792
+ load(directory: string): Effect.Effect<RivusHome, Error>;
1793
+ setup(directory: string): Effect.Effect<InitializedRivusHome, Error>;
1794
+ }
1795
+ //#endregion
1796
+ //#region src/bootstrap/deployment/model-management/pi-model-management-deployment.d.ts
1797
+ type PiModelManagementRuntime = Parameters<typeof createPiModelRuntime>[0]["modelRuntime"];
1798
+ interface PiModelManagementDeploymentOptions {
1799
+ readonly agentId: string;
1800
+ readonly approval?: ModelChangeApprovalPort;
1801
+ readonly agentCount: number;
1802
+ readonly endpointId: string;
1803
+ readonly env: RivusDaemonEnv;
1804
+ readonly environmentOverrides: RivusDaemonEnv;
1805
+ readonly envFilePath?: string;
1806
+ readonly homeDirectory?: string;
1807
+ readonly modelAuthPath?: string;
1808
+ readonly modelCatalogPath: string;
1809
+ readonly modelRuntime: PiModelManagementRuntime;
1810
+ readonly reply: (sourceMessageId: string, text: string) => Effect.Effect<void, unknown>;
1811
+ readonly runtimeVersion?: string;
1812
+ readonly stateDirectory: string;
1813
+ readonly thinkingLevel: PiThinkingLevel;
1814
+ }
1815
+ /** Assemble one Home's model authority without constructing a business session. */
1816
+ declare function openPiModelManagementDeployment(options: PiModelManagementDeploymentOptions): Promise<{
1817
+ enabled: false;
1818
+ model: RivusModelReference;
1819
+ binDirectory?: never;
1820
+ boundary?: never;
1821
+ close?: never;
1822
+ recoveryRequired?: never;
1823
+ runtime?: never;
1824
+ socketPath?: never;
1825
+ skillInstallation?: never;
1826
+ createRunContexts?: never;
1827
+ } | {
1828
+ binDirectory: string;
1829
+ boundary: ModelChangeRunBoundary;
1830
+ close: () => Promise<void>;
1831
+ enabled: true;
1832
+ recoveryRequired: boolean;
1833
+ runtime: import("@rivus/runtime/pi").PiModelRuntime;
1834
+ socketPath: string;
1835
+ skillInstallation: RivusRuntimeManagementSkillInstallResult;
1836
+ createRunContexts: (input: Omit<PiModelRunContextRegistryOptions, "modelManagementEnabled">) => {
1837
+ registry: PiModelRunContextRegistry;
1838
+ unregister: () => void;
1839
+ };
1840
+ model?: never;
1841
+ } | undefined>;
1842
+ //#endregion
1843
+ //#region src/adapters/pi/model-management/pi-model-management-grant.d.ts
1844
+ interface PiModelManagementGrantOptions {
1845
+ readonly endpointId: string;
1846
+ readonly environmentOverrides: RivusDaemonEnv;
1847
+ readonly envFilePath?: string;
1848
+ readonly modelAuthPath?: string;
1849
+ readonly thinkingLevel: PiThinkingLevel;
1850
+ }
1851
+ /** Read the Host's current grant and provider binding without exposing credentials. */
1852
+ declare function readPiModelManagementGrant(options: PiModelManagementGrantOptions, homeId: string, baseline: ModelReference): Promise<ModelManagementGrant>;
1853
+ //#endregion
1854
+ //#region src/adapters/pi/model-management/pi-managed-run-gateway-provider.d.ts
1855
+ interface PiManagedRunGatewayProviderOptions {
1856
+ readonly binDirectory: string;
1857
+ readonly contexts: PiModelRunContextRegistry;
1858
+ readonly nodeExecutable: string;
1859
+ readonly socketPath: string;
1860
+ /** Returns the active Gateway Run input; read once per bind. */
1861
+ readonly source: () => AgentLoopInput;
1862
+ }
1863
+ /**
1864
+ * Gateway-side provider for the Runtime managed-run binding.
1865
+ *
1866
+ * The provider owns policy: it reads the private active Run from the Gateway
1867
+ * closure, verifies the Runtime binding's run/session/signal match that source,
1868
+ * decides whether the source is a single-actor human Feishu Run, and either
1869
+ * issues a model-management context or falls back to the base environment
1870
+ * policy. The Runtime binding never sees the registry, socket path, or
1871
+ * invocation provenance logic.
1872
+ */
1873
+ declare function createPiManagedRunGatewayProvider(options: PiManagedRunGatewayProviderOptions): PiManagedRunProvider;
1874
+ //#endregion
1875
+ //#region src/platform/project/setup/release-descriptor.d.ts
1876
+ interface RivusReleaseDescriptor {
1877
+ readonly version: string;
1878
+ readonly dependencies: {
1879
+ readonly "@earendil-works/pi-coding-agent": string;
1880
+ readonly "@larksuiteoapi/node-sdk": string;
1881
+ readonly effect: string;
1882
+ };
1883
+ }
1884
+ declare const RIVUS_RELEASE_DESCRIPTOR: RivusReleaseDescriptor;
1885
+ //#endregion
1886
+ //#region src/platform/project/setup/rivus-project-initializer.d.ts
1887
+ interface InitializeRivusProjectOptions {
1888
+ readonly directory: string;
1889
+ readonly nodeExecutable: string;
1890
+ readonly releaseDescriptor?: RivusReleaseDescriptor;
1891
+ readonly templateDirectory: string;
1892
+ readonly writeProjectFile?: (path: string, contents: string) => Promise<void>;
1893
+ }
1894
+ interface InitializedRivusProject {
1895
+ readonly directory: string;
1896
+ readonly files: ReadonlyArray<string>;
1897
+ }
1898
+ declare function initializeRivusProject(options: InitializeRivusProjectOptions): Promise<InitializedRivusProject>;
1899
+ //#endregion
1900
+ //#region src/adapters/deployment/inspection/rivus-project-doctor.d.ts
1901
+ type RivusProjectDoctorStatus = "pass" | "fail";
1902
+ interface RivusProjectDoctorCheck {
1903
+ readonly message: string;
1904
+ readonly name: "node" | "files" | "dependencies" | "manifest" | "credentials";
1905
+ readonly status: RivusProjectDoctorStatus;
1906
+ }
1907
+ interface RivusProjectDoctorReport {
1908
+ readonly checks: ReadonlyArray<RivusProjectDoctorCheck>;
1909
+ readonly directory: string;
1910
+ readonly ready: boolean;
1911
+ }
1912
+ interface DiagnoseRivusProjectOptions {
1913
+ readonly directory: string;
1914
+ readonly env: RivusDaemonEnv;
1915
+ readonly envFilePath?: string;
1916
+ readonly nodeVersion: string;
1917
+ }
1918
+ declare function diagnoseRivusProject(options: DiagnoseRivusProjectOptions): Effect.Effect<RivusProjectDoctorReport, Error>;
1919
+ //#endregion
1920
+ //#region src/adapters/cli/model/rivus-model-cli-protocol.d.ts
1921
+ type RivusModelCliCommand = RivusModelCliStatusCommand | RivusModelCliSetCommand | RivusModelCliRollbackCommand;
1922
+ interface RivusModelCliStatusCommand {
1923
+ readonly json: true;
1924
+ readonly operation: "status";
1925
+ readonly requestId?: string;
1926
+ readonly verbose?: true;
1927
+ }
1928
+ interface RivusModelCliSetCommand {
1929
+ readonly expectedRevision: number;
1930
+ readonly json: true;
1931
+ readonly model: string;
1932
+ readonly operation: "set";
1933
+ readonly requestId: string;
1934
+ readonly verbose?: true;
1935
+ }
1936
+ interface RivusModelCliRollbackCommand {
1937
+ readonly expectedRevision: number;
1938
+ readonly json: true;
1939
+ readonly operation: "rollback";
1940
+ readonly requestId: string;
1941
+ readonly verbose?: true;
1942
+ }
1943
+ type RivusModelCliResponse = Record<string, unknown>;
1944
+ //#endregion
1945
+ //#region src/adapters/cli/model/rivus-model-management-socket-client.d.ts
1946
+ interface RivusModelManagementSocketClient {
1947
+ execute(command: RivusModelCliCommand): Promise<RivusModelCliResponse>;
1948
+ }
1949
+ //#endregion
1950
+ //#region src/platform/daemon/process/rivus-daemon-process.d.ts
1951
+ interface RivusDaemonTransport {
1952
+ running(): boolean;
1953
+ start(): Promise<void> | void;
1954
+ stop(): Promise<void> | void;
1955
+ }
1956
+ interface RivusDaemonWorkerLoop {
1957
+ running(): boolean;
1958
+ start(): void;
1959
+ stop(): Promise<void> | void;
1960
+ }
1961
+ interface RivusDaemonProcessOptions {
1962
+ readonly transport: RivusDaemonTransport;
1963
+ readonly workerLoop: RivusDaemonWorkerLoop;
1964
+ }
1965
+ interface RivusDaemonProcess {
1966
+ running(): boolean;
1967
+ start(): Effect.Effect<void, unknown>;
1968
+ stop(): Effect.Effect<void, unknown>;
1969
+ }
1970
+ declare function createRivusDaemonProcess(options: RivusDaemonProcessOptions): RivusDaemonProcess;
1971
+ //#endregion
1972
+ //#region src/platform/daemon/process/rivus-daemon-shutdown-controller.d.ts
1973
+ type RivusDaemonShutdownSignal = "SIGINT" | "SIGTERM";
1974
+ interface RivusDaemonSignalSource {
1975
+ on(signal: RivusDaemonShutdownSignal, listener: () => void): void;
1976
+ }
1977
+ interface RivusDaemonShutdownControllerOptions {
1978
+ readonly daemon: Pick<RivusDaemonProcess, "stop">;
1979
+ readonly signalSource: RivusDaemonSignalSource;
1980
+ readonly signals?: ReadonlyArray<RivusDaemonShutdownSignal>;
1981
+ readonly onError?: (error: unknown, signal: RivusDaemonShutdownSignal) => void | Promise<void>;
1982
+ readonly onStopped?: (signal: RivusDaemonShutdownSignal) => void | Promise<void>;
1983
+ }
1984
+ interface RivusDaemonShutdownController {
1985
+ handle(signal: RivusDaemonShutdownSignal): Promise<void>;
1986
+ install(): void;
1987
+ stopping(): boolean;
1988
+ }
1989
+ declare function createRivusDaemonShutdownController(options: RivusDaemonShutdownControllerOptions): RivusDaemonShutdownController;
1990
+ //#endregion
1991
+ //#region src/adapters/feishu/protocol/feishu-receive-message.d.ts
1992
+ interface FeishuReceiveMessagePayload {
1993
+ readonly header?: {
1994
+ readonly tenant_key?: string;
1995
+ };
1996
+ readonly event: {
1997
+ readonly sender?: {
1998
+ readonly sender_id?: {
1999
+ readonly open_id?: string;
2000
+ };
2001
+ readonly sender_type?: string;
2002
+ readonly tenant_key?: string;
2003
+ };
2004
+ readonly message: {
2005
+ readonly create_time?: string;
2006
+ readonly message_id: string;
2007
+ readonly chat_id: string;
2008
+ readonly chat_type?: string;
2009
+ readonly thread_id?: string;
2010
+ readonly parent_id?: string;
2011
+ readonly root_id?: string;
2012
+ readonly message_type: string;
2013
+ readonly mentions?: ReadonlyArray<{
2014
+ readonly id?: Readonly<Record<string, string>>;
2015
+ readonly key?: string;
2016
+ readonly name?: string;
2017
+ }>;
2018
+ readonly content: string;
2019
+ };
2020
+ };
2021
+ }
2022
+ //#endregion
2023
+ //#region src/adapters/feishu/conversation-session/feishu-session-key.d.ts
2024
+ type ConversationSessionKey = string;
2025
+ interface FeishuSessionReference {
2026
+ readonly tenantKey: string;
2027
+ readonly chatId: string;
2028
+ readonly threadId?: string;
2029
+ readonly agentId: string;
2030
+ }
2031
+ type FeishuConversationReference = Omit<FeishuSessionReference, "agentId">;
2032
+ declare class InvalidFeishuSessionReference {
2033
+ readonly field: keyof FeishuSessionReference;
2034
+ readonly message: string;
2035
+ readonly _tag = "InvalidFeishuSessionReference";
2036
+ constructor(field: keyof FeishuSessionReference, message: string);
2037
+ }
2038
+ declare function createFeishuSessionKey(reference: FeishuSessionReference): Effect.Effect<ConversationSessionKey, InvalidFeishuSessionReference>;
2039
+ declare function createFeishuConversationId(reference: FeishuConversationReference): Effect.Effect<string, InvalidFeishuSessionReference>;
2040
+ //#endregion
2041
+ //#region src/adapters/feishu/conversation-session/feishu-session-store.d.ts
2042
+ interface FeishuSessionEpochRecord {
2043
+ readonly baseSessionKey: string;
2044
+ readonly generation: number;
2045
+ }
2046
+ interface FeishuSessionResetResult {
2047
+ readonly generation: number;
2048
+ readonly previousSessionKey: string;
2049
+ readonly sessionKey: string;
2050
+ }
2051
+ interface FeishuSessionStore {
2052
+ current(baseSessionKey: string): Effect.Effect<string, Error>;
2053
+ reset(baseSessionKey: string): Effect.Effect<FeishuSessionResetResult, Error>;
2054
+ }
2055
+ interface FeishuSessionStoreOptions {
2056
+ readonly initial?: ReadonlyArray<FeishuSessionEpochRecord>;
2057
+ readonly persist?: (records: ReadonlyArray<FeishuSessionEpochRecord>) => Promise<void>;
2058
+ }
2059
+ declare function createFeishuSessionStore(options?: FeishuSessionStoreOptions): FeishuSessionStore;
2060
+ //#endregion
2061
+ //#region src/adapters/feishu/protocol/feishu-message-content.d.ts
2062
+ declare class UnsupportedFeishuMessage extends Error {
2063
+ readonly messageType: string;
2064
+ readonly name = "UnsupportedFeishuMessage";
2065
+ readonly _tag = "UnsupportedFeishuMessage";
2066
+ constructor(messageType: string);
2067
+ }
2068
+ declare class InvalidFeishuMessageContent extends Error {
2069
+ readonly reason: string;
2070
+ readonly name = "InvalidFeishuMessageContent";
2071
+ readonly _tag = "InvalidFeishuMessageContent";
2072
+ constructor(reason: string, options?: ErrorOptions);
2073
+ }
2074
+ interface FeishuMessageContentInput {
2075
+ readonly content: string;
2076
+ readonly messageType: string;
2077
+ }
2078
+ declare function readFeishuMessageContent(input: FeishuMessageContentInput): Effect.Effect<string, UnsupportedFeishuMessage | InvalidFeishuMessageContent>;
2079
+ //#endregion
2080
+ //#region src/adapters/feishu/intake/feishu-message-intake.d.ts
2081
+ interface FeishuMessageIntakeOptions {
2082
+ readonly agentId: string;
2083
+ readonly botOpenId?: string;
2084
+ readonly sessionStore?: FeishuSessionStore;
2085
+ }
2086
+ interface FeishuPromptAgentCommand {
2087
+ readonly conversationId: string;
2088
+ readonly messageId: string;
2089
+ readonly command: PromptCommand;
2090
+ readonly type: "prompt";
2091
+ }
2092
+ interface FeishuNewSessionCommand {
2093
+ readonly messageId: string;
2094
+ readonly previousSessionKey: SessionKey;
2095
+ readonly sessionKey: SessionKey;
2096
+ readonly type: "new_session";
2097
+ }
2098
+ interface FeishuCancelRunCommand {
2099
+ readonly type: "cancel_run";
2100
+ readonly messageId: string;
2101
+ /** Omitted when `/cancel` targets the active run in this Feishu session. */
2102
+ readonly runId?: AgentRunId;
2103
+ readonly reason: string;
2104
+ readonly sessionKey?: SessionKey;
2105
+ readonly token?: string;
2106
+ }
2107
+ type FeishuAgentCommand = FeishuPromptAgentCommand | FeishuNewSessionCommand | FeishuCancelRunCommand;
2108
+ type FeishuMessageIntakeSummary = FeishuPromptMessageIntakeSummary | FeishuNewSessionMessageIntakeSummary | FeishuCancelMessageIntakeSummary;
2109
+ interface FeishuMessageIntakeBaseSummary {
2110
+ readonly messageId: string;
2111
+ readonly sessionKey: SessionKey;
2112
+ readonly sessionReference: FeishuSessionReference;
2113
+ }
2114
+ interface FeishuPromptMessageIntakeSummary extends FeishuMessageIntakeBaseSummary {
2115
+ readonly commandType: "prompt";
2116
+ readonly text: string;
2117
+ }
2118
+ interface FeishuNewSessionMessageIntakeSummary extends FeishuMessageIntakeBaseSummary {
2119
+ readonly commandType: "new_session";
2120
+ readonly previousSessionKey: SessionKey;
2121
+ }
2122
+ interface FeishuCancelMessageIntakeSummary extends FeishuMessageIntakeBaseSummary {
2123
+ readonly commandType: "cancel_run";
2124
+ readonly reason: string;
2125
+ readonly runId?: AgentRunId;
2126
+ }
2127
+ type FeishuMessageIntakeError = UnsupportedFeishuMessage | InvalidFeishuMessageContent | InvalidFeishuSessionReference;
2128
+ declare function createAgentCommandFromFeishuMessage(payload: FeishuReceiveMessagePayload, options: FeishuMessageIntakeOptions): Effect.Effect<FeishuAgentCommand, FeishuMessageIntakeError>;
2129
+ declare function describeFeishuMessageIntake(payload: FeishuReceiveMessagePayload, options: FeishuMessageIntakeOptions): Effect.Effect<FeishuMessageIntakeSummary, FeishuMessageIntakeError>;
2130
+ //#endregion
2131
+ //#region src/adapters/feishu/intake/feishu-card-action-intake.d.ts
2132
+ interface FeishuCardActionTriggerPayload {
2133
+ readonly action?: {
2134
+ readonly tag?: string;
2135
+ readonly value?: unknown;
2136
+ };
2137
+ readonly context?: {
2138
+ readonly chat_id?: string;
2139
+ readonly open_chat_id?: string;
2140
+ readonly open_message_id?: string;
2141
+ };
2142
+ readonly event?: FeishuCardActionTriggerPayload;
2143
+ readonly event_type?: string;
2144
+ readonly operator?: {
2145
+ readonly open_id?: string;
2146
+ readonly tenant_key?: string;
2147
+ readonly union_id?: string;
2148
+ readonly user_id?: string;
2149
+ };
2150
+ readonly token?: string;
2151
+ }
2152
+ declare class InvalidFeishuCardAction {
2153
+ readonly reason: string;
2154
+ readonly _tag = "InvalidFeishuCardAction";
2155
+ constructor(reason: string);
2156
+ }
2157
+ declare class UnsupportedFeishuCardAction {
2158
+ readonly reason: string;
2159
+ readonly _tag = "UnsupportedFeishuCardAction";
2160
+ constructor(reason: string);
2161
+ }
2162
+ type FeishuCardActionIntakeError = InvalidFeishuCardAction | UnsupportedFeishuCardAction;
2163
+ interface FeishuResolveInteractionCommand {
2164
+ readonly action: HumanInteractionResolutionAction$1;
2165
+ readonly actor: HumanInteractionActor$1;
2166
+ readonly interactionId: string;
2167
+ readonly messageId: string;
2168
+ readonly optionId?: string;
2169
+ readonly token: string;
2170
+ readonly type: "resolve_interaction";
2171
+ }
2172
+ type FeishuCardActionCommand = FeishuCancelRunCommand | FeishuResolveInteractionCommand;
2173
+ declare function createAgentCommandFromFeishuCardAction(payload: FeishuCardActionTriggerPayload): Effect.Effect<FeishuCardActionCommand, FeishuCardActionIntakeError>;
2174
+ //#endregion
2175
+ //#region src/adapters/feishu/card-presentation/streaming/feishu-stream-projector.d.ts
2176
+ type FeishuStreamAction = {
2177
+ readonly type: "update_text";
2178
+ readonly runId: AgentRunId;
2179
+ readonly text: string;
2180
+ } | {
2181
+ readonly presentation: RunPresentation;
2182
+ readonly runId: AgentRunId;
2183
+ readonly type: "update_progress";
2184
+ } | {
2185
+ readonly presentation?: RunPresentation;
2186
+ readonly runId: AgentRunId;
2187
+ readonly sessionKey: string;
2188
+ readonly text?: string;
2189
+ readonly type: "update_presentation";
2190
+ } | {
2191
+ readonly presentation?: RunPresentation;
2192
+ readonly type: "finish";
2193
+ readonly runId: AgentRunId;
2194
+ readonly text: string;
2195
+ } | {
2196
+ readonly presentation?: RunPresentation;
2197
+ readonly type: "fail";
2198
+ readonly runId: AgentRunId;
2199
+ readonly errorMessage: string;
2200
+ } | {
2201
+ readonly presentation?: RunPresentation;
2202
+ readonly type: "cancel";
2203
+ readonly runId: AgentRunId;
2204
+ readonly reason?: string;
2205
+ readonly text?: string;
2206
+ };
2207
+ interface FeishuStreamProjector {
2208
+ apply(event: AgentDomainEvent): ReadonlyArray<FeishuStreamAction>;
2209
+ applyUpdate(update: AgentRunUpdate): ReadonlyArray<FeishuStreamAction>;
2210
+ }
2211
+ declare function createFeishuStreamProjector(): FeishuStreamProjector;
2212
+ //#endregion
2213
+ //#region src/adapters/feishu/protocol/feishu-agent-run-preparation.d.ts
2214
+ interface FeishuAgentRunPreparation {
2215
+ readonly messageId: string;
2216
+ readonly prompt: string;
2217
+ readonly receiveId: string;
2218
+ readonly runId: AgentRunId;
2219
+ readonly sessionKey: SessionKey;
2220
+ }
2221
+ //#endregion
2222
+ //#region src/adapters/feishu/intake/feishu-prompt-context.d.ts
2223
+ interface FeishuPromptContextInput {
2224
+ readonly payload: FeishuReceiveMessagePayload;
2225
+ readonly text: string;
2226
+ }
2227
+ /** Resolves conversation context only when a message is about to start a run. */
2228
+ interface FeishuPromptContextResolver {
2229
+ resolve(input: FeishuPromptContextInput): Effect.Effect<string, unknown>;
2230
+ }
2231
+ declare function composeFeishuTopicPrompt(currentText: string, rootText: string): string;
2232
+ //#endregion
2233
+ //#region src/adapters/feishu/intake/feishu-agent-daemon.d.ts
2234
+ interface FeishuAgentDaemonBaseOptions {
2235
+ readonly acknowledgeSteering?: (messageId: string) => Effect.Effect<void, unknown>;
2236
+ readonly agentId: string;
2237
+ readonly botOpenId?: string;
2238
+ readonly dedupe?: boolean;
2239
+ readonly finalizeRun?: (runId: AgentRunId) => Effect.Effect<void>;
2240
+ readonly interactions?: FeishuHumanInteractionActions;
2241
+ readonly prepareRun?: (run: FeishuAgentRunPreparation) => Effect.Effect<void, unknown>;
2242
+ readonly publish: (action: FeishuStreamAction) => Effect.Effect<void, unknown>;
2243
+ readonly publishRunUpdate?: AgentRunUpdateHandler;
2244
+ readonly reply?: (messageId: string, text: string) => Effect.Effect<void, unknown>;
2245
+ readonly promptContext?: FeishuPromptContextResolver;
2246
+ readonly resolveInvocation?: (payload: FeishuReceiveMessagePayload, conversationId: string) => AgentInvocationOrigin;
2247
+ readonly sessionStore?: FeishuSessionStore;
2248
+ }
2249
+ type FeishuAgentDaemonOptions = FeishuAgentDaemonBaseOptions & ({
2250
+ readonly execution: FeishuAgentExecution;
2251
+ readonly harness?: never;
2252
+ } | {
2253
+ readonly execution?: never;
2254
+ readonly harness: AgentHarness;
2255
+ });
2256
+ interface FeishuAgentExecutionResult extends StandardAgentRunResult {}
2257
+ interface FeishuAgentExecution extends AgentExecutionControlPort {
2258
+ promptWithUpdates(command: PromptCommand, onUpdate: AgentRunUpdateHandler): Effect.Effect<FeishuAgentExecutionResult, unknown>;
2259
+ }
2260
+ interface FeishuAgentDaemonRunResult {
2261
+ readonly messageId: string;
2262
+ readonly runId: string;
2263
+ readonly finalText: string;
2264
+ }
2265
+ interface FeishuAgentDaemonSkippedResult {
2266
+ readonly messageId: string;
2267
+ readonly skipped: true;
2268
+ readonly reason: "duplicate";
2269
+ }
2270
+ interface FeishuAgentDaemonCancelResult {
2271
+ readonly cancelled: boolean;
2272
+ readonly messageId: string;
2273
+ readonly runId?: AgentRunId;
2274
+ readonly reason?: "not_active";
2275
+ }
2276
+ interface FeishuAgentDaemonSteeredResult {
2277
+ readonly messageId: string;
2278
+ readonly runId: AgentRunId;
2279
+ readonly steered: true;
2280
+ }
2281
+ interface FeishuAgentDaemonInteractionResult {
2282
+ readonly interaction: HumanInteractionSnapshot;
2283
+ readonly interactionId: string;
2284
+ readonly messageId: string;
2285
+ readonly resolved: true;
2286
+ }
2287
+ interface FeishuAgentDaemonSessionResetResult {
2288
+ readonly messageId: string;
2289
+ readonly previousSessionKey: SessionKey;
2290
+ readonly sessionKey: SessionKey;
2291
+ readonly reset: true;
2292
+ }
2293
+ interface FeishuHumanInteractionActions {
2294
+ resolve(input: ResolveHumanInteractionInput$1): Effect.Effect<HumanInteractionSnapshot, unknown>;
2295
+ }
2296
+ type FeishuAgentDaemonHandleResult = FeishuAgentDaemonRunResult | FeishuAgentDaemonSkippedResult | FeishuAgentDaemonCancelResult | FeishuAgentDaemonSteeredResult | FeishuAgentDaemonInteractionResult | FeishuAgentDaemonSessionResetResult;
2297
+ interface FeishuAgentPreparedControl {
2298
+ execute(): Effect.Effect<FeishuAgentDaemonHandleResult | undefined, unknown>;
2299
+ }
2300
+ type FeishuAgentMessageSideEffects = "enabled" | "disabled";
2301
+ interface FeishuAgentDaemonHandleMessageOptions {
2302
+ readonly sideEffects?: FeishuAgentMessageSideEffects;
2303
+ }
2304
+ interface FeishuAgentDaemon {
2305
+ handleCardAction(payload: FeishuCardActionTriggerPayload): Effect.Effect<FeishuAgentDaemonHandleResult, unknown>;
2306
+ prepareControlMessage(payload: FeishuReceiveMessagePayload): Effect.Effect<FeishuAgentPreparedControl | undefined, unknown>;
2307
+ trySteerMessage(payload: FeishuReceiveMessagePayload): Effect.Effect<FeishuAgentDaemonHandleResult | undefined, unknown>;
2308
+ handleMessage(payload: FeishuReceiveMessagePayload, options?: FeishuAgentDaemonHandleMessageOptions): Effect.Effect<FeishuAgentDaemonHandleResult, unknown>;
2309
+ }
2310
+ declare function createFeishuAgentDaemon(options: FeishuAgentDaemonOptions): FeishuAgentDaemon;
2311
+ //#endregion
2312
+ //#region src/platform/durable-queue/processing/durable-queue.d.ts
2313
+ interface DurableQueuePreparedAction<Result> {
2314
+ execute(): Effect.Effect<Result | undefined, unknown>;
2315
+ }
2316
+ //#endregion
2317
+ //#region src/adapters/feishu/inbound-delivery/feishu-inbound-delivery.d.ts
2318
+ type FeishuMessageAcceptResult = {
2319
+ readonly accepted: true;
2320
+ readonly messageId: string;
2321
+ readonly pending: number;
2322
+ } | {
2323
+ readonly accepted: false;
2324
+ readonly messageId: string;
2325
+ readonly pending: number;
2326
+ readonly reason: "capacity" | "duplicate" | "ignored";
2327
+ };
2328
+ //#endregion
2329
+ //#region src/adapters/feishu/runtime/feishu-receive-status.d.ts
2330
+ type FeishuReceiveMessageReplayOptions = FeishuAgentDaemonHandleMessageOptions;
2331
+ interface FeishuReceiveMessageSummary {
2332
+ readonly chatId: string;
2333
+ readonly messageId: string;
2334
+ readonly tenantKey?: string;
2335
+ readonly threadId?: string;
2336
+ }
2337
+ interface FeishuReceiveAcceptedObservation {
2338
+ readonly accepted: FeishuMessageAcceptResult;
2339
+ readonly message: FeishuReceiveMessageSummary;
2340
+ readonly observedAt: Date;
2341
+ }
2342
+ interface FeishuReceiveHandledObservation {
2343
+ readonly intake: FeishuMessageIntakeSummary;
2344
+ readonly messageId: string;
2345
+ readonly observedAt: Date;
2346
+ readonly result: FeishuAgentDaemonHandleResult;
2347
+ }
2348
+ interface FeishuReceiveRuntimeStatus {
2349
+ readonly lastAccepted?: FeishuReceiveAcceptedObservation;
2350
+ readonly lastHandled?: FeishuReceiveHandledObservation;
2351
+ }
2352
+ interface FeishuMessageWorkerDrainAvailableResult {
2353
+ readonly drained: number;
2354
+ readonly results: ReadonlyArray<{
2355
+ readonly handled: true;
2356
+ readonly messageId: string;
2357
+ readonly result: FeishuAgentDaemonHandleResult;
2358
+ }>;
2359
+ }
2360
+ interface FeishuReceiveMessageReplayResult {
2361
+ readonly accepted: FeishuMessageAcceptResult;
2362
+ readonly drained: FeishuMessageWorkerDrainAvailableResult;
2363
+ readonly intake: FeishuMessageIntakeSummary;
2364
+ }
2365
+ //#endregion
2366
+ //#region src/adapters/agent/runtime/process-agent-runtime-adapter.d.ts
2367
+ interface ProcessAgentRuntimeInput extends Omit<AgentRuntimeInput$1, "onUpdate"> {
2368
+ readonly onUpdate?: (update: AgentRunUpdate) => void | Promise<void>;
2369
+ }
2370
+ interface ProcessAgentRuntime {
2371
+ readonly concurrency?: "managed";
2372
+ cancel?(input: AgentRuntimeCancellation$1): Promise<boolean>;
2373
+ dispose?(): Promise<void> | void;
2374
+ run(input: ProcessAgentRuntimeInput): Promise<unknown>;
2375
+ steer?(input: AgentRuntimeSteering$1): Promise<boolean>;
2376
+ }
2377
+ //#endregion
2378
+ //#region src/core/application/background-session/supervision/background-session-delivery-queue.d.ts
2379
+ type BackgroundSessionDeliveryKindForSupervisor = "progress" | "final" | "stopped" | "failed" | "reconciliation";
2380
+ type BackgroundSessionDeliverySink = (delivery: {
2381
+ readonly deliveryId: string;
2382
+ readonly kind: BackgroundSessionDeliveryKindForSupervisor;
2383
+ readonly sessionId: string;
2384
+ readonly text: string;
2385
+ }) => Promise<{
2386
+ readonly providerMessageId: string;
2387
+ }>;
2388
+ //#endregion
2389
+ //#region src/core/application/background-session/supervision/background-session-supervisor.d.ts
2390
+ interface BackgroundSessionLimits {
2391
+ readonly intervalMs: number;
2392
+ readonly leaseMs: number;
2393
+ readonly leaseRenewalIntervalMs: number;
2394
+ readonly maxConcurrentSessions: number;
2395
+ readonly maxConsecutiveFailures: number;
2396
+ readonly retryBackoffMs: number;
2397
+ readonly sessionLifetimeMs: number;
2398
+ }
2399
+ interface BackgroundSessionStepResult {
2400
+ readonly finalText: string;
2401
+ readonly runId: string;
2402
+ }
2403
+ interface BackgroundSessionSupervisorOptions$1 {
2404
+ readonly clock: {
2405
+ now(): string;
2406
+ };
2407
+ readonly config: BackgroundSessionLimits;
2408
+ readonly deliveries: BackgroundSessionDeliveryStore;
2409
+ readonly deliver: BackgroundSessionDeliverySink;
2410
+ readonly onError?: (error: unknown) => void;
2411
+ readonly repository: BackgroundSessionRepository$1;
2412
+ readonly runStep: (input: {
2413
+ readonly session: BackgroundSession;
2414
+ readonly signal: AbortSignal;
2415
+ readonly wakeText: string;
2416
+ }) => Promise<BackgroundSessionStepResult>;
2417
+ readonly sleep: (ms: number) => Effect.Effect<void>;
2418
+ }
2419
+ interface BackgroundSessionSupervisorStatus {
2420
+ readonly capacity: number;
2421
+ readonly counters: {
2422
+ readonly completed: number;
2423
+ readonly deliveriesDelivered: number;
2424
+ readonly failed: number;
2425
+ readonly started: number;
2426
+ readonly staleLeaseEventsDropped: number;
2427
+ readonly stopped: number;
2428
+ };
2429
+ readonly inFlightSteps: number;
2430
+ readonly oldestDueAt?: string;
2431
+ readonly owner: string;
2432
+ readonly phaseCounts: Readonly<Record<BackgroundSessionPhase, number>>;
2433
+ readonly reconciliationCount: number;
2434
+ readonly repositoryHealthy: boolean;
2435
+ readonly running: boolean;
2436
+ }
2437
+ interface BackgroundSessionSupervisor {
2438
+ recover(): Effect.Effect<void>;
2439
+ start(): Effect.Effect<void>;
2440
+ status(): BackgroundSessionSupervisorStatus;
2441
+ stop(): Effect.Effect<void>;
2442
+ tick(): Effect.Effect<void>;
2443
+ }
2444
+ //#endregion
2445
+ //#region src/core/application/deployment/contracts/manifest.d.ts
2446
+ interface RivusPluginDeclaration {
2447
+ readonly id: string;
2448
+ readonly module: string;
2449
+ readonly required: boolean;
2450
+ }
2451
+ interface RivusDeploymentManifest {
2452
+ readonly agents: ReadonlyArray<RivusAgentDeployment>;
2453
+ readonly automations?: ReadonlyArray<RivusAutomationDeployment>;
2454
+ readonly backgroundSessions?: RivusBackgroundSessionsDeployment;
2455
+ readonly defaultAgentId: string;
2456
+ readonly defaultEndpointId: string;
2457
+ readonly endpoints: ReadonlyArray<RivusEndpointDeployment>;
2458
+ readonly plugins: ReadonlyArray<RivusPluginDeclaration>;
2459
+ readonly projectSpaces?: ReadonlyArray<RivusProjectSpaceDeployment>;
2460
+ }
2461
+ interface RivusBackgroundSessionsDeployment {
2462
+ readonly enabled: boolean;
2463
+ readonly leaseMs: number;
2464
+ readonly leaseRenewalIntervalMs: number;
2465
+ readonly maxConsecutiveFailures: number;
2466
+ readonly maxConcurrentSessions: number;
2467
+ readonly required: boolean;
2468
+ readonly retryBackoffMs: number;
2469
+ readonly sessionLifetimeMs: number;
2470
+ readonly stepTimeoutMs: number;
2471
+ }
2472
+ type RivusAutomationDeliveryTargetType = "chat_id" | "open_id" | "user_id" | "union_id" | "email";
2473
+ interface RivusAutomationDelivery {
2474
+ readonly endpointId: string;
2475
+ readonly targetRef: string;
2476
+ readonly targetType: RivusAutomationDeliveryTargetType;
2477
+ }
2478
+ interface RivusAutomationDeployment {
2479
+ readonly agentId: string;
2480
+ readonly delivery: RivusAutomationDelivery;
2481
+ readonly enabled: boolean;
2482
+ readonly id: string;
2483
+ readonly required: boolean;
2484
+ readonly schedule: string;
2485
+ readonly templateId: string;
2486
+ readonly timeZone: string;
2487
+ }
2488
+ interface RivusEndpointDeployment {
2489
+ readonly agentId: string;
2490
+ readonly baseUrl: string;
2491
+ readonly cardStreamLeaseMs: number;
2492
+ readonly credentialRef: string;
2493
+ readonly enabled: boolean;
2494
+ readonly experimental?: RivusEndpointExperimentalFeatures;
2495
+ readonly groupPolicy: "mention-only" | "ignore-unmentioned" | "default-responder";
2496
+ readonly id: string;
2497
+ readonly progressDisplay?: "hidden" | "collapsed" | "expanded";
2498
+ readonly required: boolean;
2499
+ readonly sessionNamespace: string;
2500
+ readonly streamMinIntervalMs: number;
2501
+ }
2502
+ interface RivusEndpointExperimentalFeatures {
2503
+ readonly cotMessages: boolean;
2504
+ }
2505
+ interface RivusProjectSpaceDeployment {
2506
+ readonly id: string;
2507
+ readonly root: string;
2508
+ readonly workingDirectory: string;
2509
+ readonly skills: {
2510
+ readonly sources: ReadonlyArray<string>;
2511
+ };
2512
+ }
2513
+ //#endregion
2514
+ //#region src/core/application/deployment/contracts/deployment.d.ts
2515
+ interface RivusPluginLoadStatus {
2516
+ readonly error?: string;
2517
+ readonly id: string;
2518
+ readonly module: string;
2519
+ readonly required: boolean;
2520
+ readonly status: "loaded" | "failed";
2521
+ readonly version?: string;
2522
+ }
2523
+ interface RivusAgentDeploymentStatus {
2524
+ readonly agentId: string;
2525
+ readonly definition?: ResolvedRivusAgentDefinition;
2526
+ readonly pluginId: string;
2527
+ readonly profileId: string;
2528
+ readonly reason?: string;
2529
+ readonly status: "enabled" | "disabled";
2530
+ }
2531
+ interface ResolvedRivusAutomationDefinition extends RivusAutomationDeployment {
2532
+ readonly runtimeDefinition: ResolvedRivusAgentDefinition;
2533
+ readonly template: RegisteredRivusAutomation;
2534
+ }
2535
+ interface ResolvedRivusProjectSpace {
2536
+ readonly id: string;
2537
+ readonly root: string;
2538
+ readonly workingDirectory: string;
2539
+ readonly skillPaths: ReadonlyArray<string>;
2540
+ readonly revision: string;
2541
+ }
2542
+ interface LoadedRivusDeployment {
2543
+ readonly agents: ReadonlyArray<RivusAgentDeploymentStatus>;
2544
+ readonly automationDefinitions: ReadonlyArray<ResolvedRivusAutomationDefinition>;
2545
+ readonly catalog: RivusPluginCatalog;
2546
+ readonly definitions: ReadonlyArray<ResolvedRivusAgentDefinition>;
2547
+ readonly manifest: RivusDeploymentManifest;
2548
+ readonly plugins: ReadonlyArray<RivusPluginLoadStatus>;
2549
+ }
2550
+ interface RivusPluginModuleLoadRequest {
2551
+ readonly deploymentRoot: string;
2552
+ readonly module: string;
2553
+ readonly pluginId: string;
2554
+ }
2555
+ interface RivusDeploymentBackgroundSessionCancellation {
2556
+ readonly agentId: string;
2557
+ readonly reason?: string;
2558
+ readonly runId: string;
2559
+ readonly sessionKey: string;
2560
+ }
2561
+ //#endregion
2562
+ //#region src/adapters/deployment/process/process-deployment-adapters.d.ts
2563
+ interface ProcessDeploymentRuntime extends ProcessAgentRuntime {}
2564
+ interface CreateProcessDeploymentRuntimeInput extends AgentInstanceRecord {
2565
+ readonly catalog: RivusPluginCatalog;
2566
+ readonly definition: ResolvedRivusAgentDefinition;
2567
+ readonly projectSpace?: ResolvedRivusProjectSpace;
2568
+ }
2569
+ interface ProcessDeploymentEndpoint {
2570
+ running(): boolean;
2571
+ start(): Promise<void> | void;
2572
+ stop(): Promise<void> | void;
2573
+ }
2574
+ interface CreateProcessDeploymentEndpointInput {
2575
+ readonly agentId: string;
2576
+ readonly cancel: (input: AgentRuntimeCancellation$1) => Promise<boolean>;
2577
+ readonly definition: RivusEndpointDeployment;
2578
+ readonly endpointId: string;
2579
+ readonly handle: (input: ProcessAgentRuntimeInput) => Promise<unknown>;
2580
+ readonly instanceId: string;
2581
+ readonly projectSpaceId?: string;
2582
+ readonly steer?: (input: AgentRuntimeSteering$1) => Promise<boolean>;
2583
+ }
2584
+ interface ProcessDeploymentAutomation {
2585
+ running(): boolean;
2586
+ start(): Promise<void> | void;
2587
+ stop(): Promise<void> | void;
2588
+ }
2589
+ interface CreateProcessDeploymentAutomationInput {
2590
+ readonly automationId: string;
2591
+ readonly definition: ResolvedRivusAutomationDefinition;
2592
+ readonly deliveryEndpoint: RivusEndpointDeployment;
2593
+ readonly instanceId: string;
2594
+ readonly run: (input: ScheduledAutomationRunInput) => Promise<unknown>;
2595
+ }
2596
+ interface ProcessDeploymentBackgroundSession {
2597
+ running(): boolean;
2598
+ start(): Promise<void> | void;
2599
+ status?(): BackgroundSessionSupervisorStatus;
2600
+ stop(): Promise<void> | void;
2601
+ }
2602
+ interface CreateProcessDeploymentBackgroundSessionInput {
2603
+ readonly agentIds: ReadonlyArray<string>;
2604
+ readonly cancel: (input: RivusDeploymentBackgroundSessionCancellation) => Promise<boolean>;
2605
+ readonly config: RivusBackgroundSessionsDeployment;
2606
+ readonly run: (input: {
2607
+ readonly agentId: string;
2608
+ readonly invocation: AgentInvocationOrigin;
2609
+ readonly onUpdate?: (update: AgentRunUpdate) => void | Promise<void>;
2610
+ readonly sessionKey: string;
2611
+ readonly text: string;
2612
+ }) => Promise<unknown>;
2613
+ }
2614
+ //#endregion
2615
+ //#region src/core/application/background-session/authority/background-session-authority.d.ts
2616
+ declare const BACKGROUND_SESSION_TOOL_IDS: readonly ["background.start", "background.wait", "background.list", "background.status", "background.send", "background.stop"];
2617
+ declare const BACKGROUND_SESSION_START_TOOL_ID = "background.start";
2618
+ declare const BACKGROUND_SESSION_TOOL_PLUGIN_ID = "rivus-core";
2619
+ declare const BACKGROUND_SESSION_TOOL_VERSION = "1.0.0";
2620
+ interface BackgroundSessionToolContract {
2621
+ readonly description: string;
2622
+ readonly digest: string;
2623
+ readonly id: string;
2624
+ readonly idempotency: "none" | "supported" | "required";
2625
+ readonly inputSchema: unknown;
2626
+ readonly pluginId: string;
2627
+ readonly risk: "observe" | "mutate" | "irreversible" | "host-control";
2628
+ readonly version: string;
2629
+ }
2630
+ interface BackgroundSessionToolGrantSet {
2631
+ readonly revision: string;
2632
+ readonly toolIds: ReadonlyArray<string>;
2633
+ }
2634
+ interface BackgroundSessionAgentDefinition {
2635
+ readonly agentId: string;
2636
+ readonly endpointIds: ReadonlyArray<string>;
2637
+ readonly memory: {
2638
+ readonly scopes: ReadonlyArray<BackgroundSessionMemoryScope>;
2639
+ };
2640
+ readonly model: Readonly<Record<string, unknown>>;
2641
+ readonly pluginId: string;
2642
+ readonly profileId: string;
2643
+ readonly profileRevision: string;
2644
+ readonly projectSpaceId?: string;
2645
+ readonly projectSpaceRevision?: string;
2646
+ readonly skillGrantSet: {
2647
+ readonly revision: string;
2648
+ readonly skillIds: ReadonlyArray<string>;
2649
+ };
2650
+ readonly skills: ReadonlyArray<unknown>;
2651
+ readonly systemPrompt: string;
2652
+ readonly tools: ReadonlyArray<BackgroundSessionToolContract>;
2653
+ readonly toolGrantSet: BackgroundSessionToolGrantSet;
2654
+ }
2655
+ type TransformedBackgroundSessionDefinition<T extends BackgroundSessionAgentDefinition> = Omit<T, "toolGrantSet" | "tools"> & {
2656
+ readonly toolGrantSet: BackgroundSessionToolGrantSet;
2657
+ readonly tools: ReadonlyArray<BackgroundSessionToolContract>;
2658
+ };
2659
+ declare function createBackgroundSessionToolContracts(): ReadonlyArray<BackgroundSessionToolContract>;
2660
+ declare function backgroundSessionToolIds(): ReadonlyArray<string>;
2661
+ declare function isBackgroundSessionToolId(toolId: string): boolean;
2662
+ //#endregion
2663
+ //#region src/core/application/deployment/lifecycle/deployment-lifecycle.d.ts
2664
+ type RivusDeploymentComponentLifecycle = "disabled" | "stopped" | "starting" | "running" | "degraded" | "stopping" | "cleanup-required";
2665
+ type RivusDeploymentControlLifecycle = "stopped" | "starting" | "running" | "degraded" | "stopping" | "cleanup-required";
2666
+ declare class RivusDeploymentDaemonLifecycleError extends Error {
2667
+ readonly name = "RivusDeploymentDaemonLifecycleError";
2668
+ }
2669
+ //#endregion
2670
+ //#region src/core/application/deployment/lifecycle/deployment-control.d.ts
2671
+ type RivusDeploymentDaemonLifecycle = RivusDeploymentControlLifecycle;
2672
+ type RivusDeploymentEndpointLifecycle = RivusDeploymentComponentLifecycle;
2673
+ type RivusDeploymentAutomationLifecycle = RivusDeploymentComponentLifecycle;
2674
+ type RivusDeploymentBackgroundSessionLifecycle = RivusDeploymentComponentLifecycle;
2675
+ interface RivusDeploymentEndpointStatus extends RivusDeploymentComponentStatus {
2676
+ readonly agentId: string;
2677
+ readonly endpointId: string;
2678
+ }
2679
+ interface RivusDeploymentAutomationStatus extends RivusDeploymentComponentStatus {
2680
+ readonly agentId: string;
2681
+ readonly automationId: string;
2682
+ }
2683
+ interface RivusDeploymentBackgroundSessionStatus extends RivusDeploymentComponentStatus {
2684
+ readonly supervisor?: BackgroundSessionSupervisorStatus;
2685
+ }
2686
+ interface RivusDeploymentComponentStatus {
2687
+ readonly enabled: boolean;
2688
+ readonly error?: string;
2689
+ readonly lifecycle: RivusDeploymentComponentLifecycle;
2690
+ readonly required: boolean;
2691
+ readonly running: boolean;
2692
+ }
2693
+ interface RivusDeploymentDaemonStatus {
2694
+ readonly agents: LoadedRivusDeployment["agents"];
2695
+ readonly automations: ReadonlyArray<RivusDeploymentAutomationStatus>;
2696
+ readonly backgroundSessions?: RivusDeploymentBackgroundSessionStatus;
2697
+ readonly defaultAgentId: string;
2698
+ readonly defaultEndpointId: string;
2699
+ readonly endpoints: ReadonlyArray<RivusDeploymentEndpointStatus>;
2700
+ readonly lifecycle: RivusDeploymentDaemonLifecycle;
2701
+ readonly plugins: LoadedRivusDeployment["plugins"];
2702
+ readonly ready: boolean;
2703
+ readonly running: boolean;
2704
+ }
2705
+ declare class RivusDeploymentReadinessError extends Error {
2706
+ readonly endpointIds: ReadonlyArray<string>;
2707
+ readonly name = "RivusDeploymentReadinessError";
2708
+ constructor(endpointIds: ReadonlyArray<string>);
2709
+ }
2710
+ declare class RivusDeploymentAutomationReadinessError extends Error {
2711
+ readonly automationIds: ReadonlyArray<string>;
2712
+ readonly name = "RivusDeploymentAutomationReadinessError";
2713
+ constructor(automationIds: ReadonlyArray<string>);
2714
+ }
2715
+ declare class RivusDeploymentBackgroundSessionReadinessError extends Error {
2716
+ readonly name = "RivusDeploymentBackgroundSessionReadinessError";
2717
+ constructor();
2718
+ }
2719
+ //#endregion
2720
+ //#region src/core/application/recovery/contracts/recovery-control.d.ts
2721
+ type RecoveryToolOperationOutcome = {
2722
+ readonly result: unknown;
2723
+ readonly status: "applied";
2724
+ } | {
2725
+ readonly status: "not-applied";
2726
+ };
2727
+ interface DeadLetterRecoveryItem {
2728
+ readonly acceptedAt: string;
2729
+ readonly attempts: number;
2730
+ readonly deliveryId: string;
2731
+ readonly endpointId: string;
2732
+ readonly failureCode: "delivery_failed";
2733
+ readonly failureSummary: string;
2734
+ readonly failedAt: string;
2735
+ readonly revision: number;
2736
+ }
2737
+ interface DeadLetterRequeueResult {
2738
+ readonly acceptedAt: string;
2739
+ readonly attempts: 0;
2740
+ readonly availableAt: string;
2741
+ readonly deliveryId: string;
2742
+ readonly endpointId: string;
2743
+ readonly recoveredAt: string;
2744
+ readonly recoveredBy: string;
2745
+ readonly revision: number;
2746
+ readonly status: "pending";
2747
+ }
2748
+ interface RecoverySnapshot {
2749
+ readonly deadLetters: ReadonlyArray<DeadLetterRecoveryItem>;
2750
+ readonly toolOperations: ReadonlyArray<ToolOperationRecoveryItem>;
2751
+ }
2752
+ interface ToolOperationRecoveryItem {
2753
+ readonly agentId: string;
2754
+ readonly inputDigest: string;
2755
+ readonly instanceId: string;
2756
+ readonly operationId: string;
2757
+ readonly failureCode: "tool_outcome_unknown";
2758
+ readonly failureSummary: string;
2759
+ readonly revision: number;
2760
+ readonly status: "reconciliation-required";
2761
+ readonly toolId: string;
2762
+ readonly toolVersion: string;
2763
+ }
2764
+ interface ToolOperationResolutionResult {
2765
+ readonly agentId: string;
2766
+ readonly inputDigest: string;
2767
+ readonly instanceId: string;
2768
+ readonly operationId: string;
2769
+ readonly reconciledAt: string;
2770
+ readonly reconciledBy: string;
2771
+ readonly revision: number;
2772
+ readonly status: "aborted" | "completed";
2773
+ readonly toolId: string;
2774
+ readonly toolVersion: string;
2775
+ }
2776
+ interface RecoveryControl {
2777
+ inspect(): Effect.Effect<RecoverySnapshot, unknown>;
2778
+ requeueDeadLetter(input: {
2779
+ readonly actorId: string;
2780
+ readonly deliveryId: string;
2781
+ readonly endpointId: string;
2782
+ readonly expectedRevision: number;
2783
+ readonly note: string;
2784
+ }): Effect.Effect<DeadLetterRequeueResult, unknown>;
2785
+ resolveToolOperation(input: {
2786
+ readonly actorId: string;
2787
+ readonly expectedRevision: number;
2788
+ readonly instanceId: string;
2789
+ readonly note: string;
2790
+ readonly operationId: string;
2791
+ readonly outcome: RecoveryToolOperationOutcome;
2792
+ }): Effect.Effect<ToolOperationResolutionResult, unknown>;
2793
+ }
2794
+ //#endregion
2795
+ //#region src/bootstrap/deployment/rivus-deployment-cli-process.d.ts
2796
+ interface RivusDeploymentBootstrapAdapters {
2797
+ readonly initialInstanceRecords?: AgentInstanceRegistryOptions["initialRecords"];
2798
+ readonly dispose?: () => Promise<void> | void;
2799
+ readonly createAutomation?: (input: CreateProcessDeploymentAutomationInput) => ProcessDeploymentAutomation | Promise<ProcessDeploymentAutomation>;
2800
+ readonly createBackgroundSession?: (input: CreateProcessDeploymentBackgroundSessionInput) => ProcessDeploymentBackgroundSession | Promise<ProcessDeploymentBackgroundSession>;
2801
+ readonly createRecoveryControl?: () => Promise<RecoveryControl> | RecoveryControl;
2802
+ readonly createRuntime: (input: CreateProcessDeploymentRuntimeInput) => ProcessDeploymentRuntime | Promise<ProcessDeploymentRuntime>;
2803
+ readonly createEndpoint: (input: CreateProcessDeploymentEndpointInput) => ProcessDeploymentEndpoint | Promise<ProcessDeploymentEndpoint>;
2804
+ readonly replayReceiveMessage?: (handleDefault: (input: ProcessAgentRuntimeInput) => Promise<unknown>, payload: FeishuReceiveMessagePayload, options?: FeishuReceiveMessageReplayOptions) => Effect.Effect<FeishuReceiveMessageReplayResult, unknown>;
2805
+ }
2806
+ interface RivusDeploymentBootstrapContext {
2807
+ readonly argv: ReadonlyArray<string>;
2808
+ readonly env: RivusDaemonEnv;
2809
+ /** Explicit original configuration source, required for controlled export on disable. */
2810
+ readonly envFilePath?: string;
2811
+ /** Environment values before the explicit env file is merged. */
2812
+ readonly environmentOverrides?: RivusDaemonEnv;
2813
+ readonly manifestPath: string;
2814
+ readonly pluginPackageManifestPath?: string;
2815
+ }
2816
+ type RivusDeploymentBootstrapFactory = (context: RivusDeploymentBootstrapContext) => Promise<RivusDeploymentBootstrapAdapters> | RivusDeploymentBootstrapAdapters;
2817
+ interface RivusDeploymentCliProcess extends RivusDaemonProcess {
2818
+ readonly defaultSessionKey: string;
2819
+ openRecoveryControl(): Effect.Effect<RecoveryControl, unknown>;
2820
+ promptText(command: PromptCommand): Effect.Effect<string, unknown>;
2821
+ replayReceiveMessage?(payload: FeishuReceiveMessagePayload, options?: FeishuReceiveMessageReplayOptions): Effect.Effect<FeishuReceiveMessageReplayResult, unknown>;
2822
+ status(): Effect.Effect<RivusDeploymentDaemonStatus>;
2823
+ }
2824
+ declare function createRivusDeploymentCliProcess(factory: RivusDeploymentBootstrapFactory, context: RivusDeploymentBootstrapContext): Promise<RivusDeploymentCliProcess>;
2825
+ //#endregion
2826
+ //#region src/bootstrap/daemon/rivus-daemon-cli.d.ts
2827
+ interface RivusDaemonBootstrapContext {
2828
+ readonly argv: ReadonlyArray<string>;
2829
+ readonly config: RivusDaemonConfig;
2830
+ readonly env: RivusDaemonEnv;
2831
+ }
2832
+ type RivusDaemonBootstrapFactory = (context: RivusDaemonBootstrapContext) => Promise<RivusDaemonProcess> | RivusDaemonProcess;
2833
+ interface RivusDaemonBootstrapModule {
2834
+ readonly createRivusDaemonProcess?: RivusDaemonBootstrapFactory;
2835
+ readonly createRivusDeploymentAdapters?: RivusDeploymentBootstrapFactory;
2836
+ readonly default?: RivusDaemonBootstrapFactory;
2837
+ }
2838
+ interface RivusDaemonCliWriter {
2839
+ write(text: string): unknown;
2840
+ }
2841
+ interface RivusDaemonPromptRunner {
2842
+ readonly defaultSessionKey?: string;
2843
+ promptText(command: PromptCommand): Effect.Effect<string, unknown>;
2844
+ }
2845
+ interface RivusDaemonFeishuReplayRunner {
2846
+ replayReceiveMessage(payload: FeishuReceiveMessagePayload, options?: FeishuReceiveMessageReplayOptions): Effect.Effect<FeishuReceiveMessageReplayResult, unknown>;
2847
+ }
2848
+ interface RivusDaemonRecoveryRunner {
2849
+ openRecoveryControl(): Effect.Effect<RecoveryControl, unknown>;
2850
+ }
2851
+ interface RivusDaemonCliOptions {
2852
+ readonly argv: ReadonlyArray<string>;
2853
+ readonly env: RivusDaemonEnv;
2854
+ readonly exitAfterSignal?: (exitCode: number) => void;
2855
+ readonly loadBootstrap?: (specifier: string) => Promise<RivusDaemonBootstrapModule>;
2856
+ readonly signalSource: RivusDaemonSignalSource;
2857
+ readonly stderr: RivusDaemonCliWriter;
2858
+ readonly stdout: RivusDaemonCliWriter;
2859
+ readonly pluginPackageManifestPath?: string;
2860
+ }
2861
+ declare function runRivusDaemonCli(options: RivusDaemonCliOptions): Effect.Effect<number>;
2862
+ //#endregion
2863
+ //#region src/bootstrap/cli/rivus-cli.d.ts
2864
+ interface RivusCliOptions extends RivusDaemonCliOptions {
2865
+ readonly changeWorkingDirectory: (directory: string) => void;
2866
+ readonly cwd: string;
2867
+ readonly homeApi: RivusHomeApi;
2868
+ readonly homeDirectory: string;
2869
+ readonly nodeExecutable: string;
2870
+ readonly nodeVersion: string;
2871
+ readonly modelManagementClient?: RivusModelManagementSocketClient;
2872
+ }
2873
+ declare function runRivusCli(options: RivusCliOptions): Effect.Effect<number>;
2874
+ //#endregion
2875
+ //#region src/bootstrap/cli/rivus-node-entrypoint.d.ts
2876
+ interface RivusNodeEntrypointOptions {
2877
+ readonly argv: ReadonlyArray<string>;
2878
+ readonly changeWorkingDirectory: (directory: string) => void;
2879
+ readonly cwd: string;
2880
+ readonly env: RivusDaemonEnv;
2881
+ readonly exitAfterSignal?: RivusCliOptions["exitAfterSignal"];
2882
+ readonly signalSource: RivusCliOptions["signalSource"];
2883
+ readonly stderr: RivusCliOptions["stderr"];
2884
+ readonly stdout: RivusCliOptions["stdout"];
2885
+ }
2886
+ declare function runRivusNodeEntrypoint(options: RivusNodeEntrypointOptions): Effect.Effect<number>;
2887
+ //#endregion
2888
+ //#region src/core/application/run-presentation/projection/conversation-progress.d.ts
2889
+ declare const DEFAULT_CONVERSATION_PROGRESS_DISPLAY: "collapsed";
2890
+ type ConversationProgressDisplay = "hidden" | "collapsed" | "expanded";
2891
+ //#endregion
2892
+ //#region src/adapters/feishu/card-presentation/delivery/feishu-card-delivery-ledger.d.ts
2893
+ interface FeishuCardDeliveryRecord {
2894
+ readonly revision: number;
2895
+ readonly runId: AgentRunId;
2896
+ readonly sequence: number;
2897
+ readonly terminalPublished: boolean;
2898
+ }
2899
+ interface FeishuCardDeliveryLedger {
2900
+ isTerminalPublished(runId: AgentRunId): boolean;
2901
+ markTerminal(runId: AgentRunId): Effect.Effect<void, unknown>;
2902
+ reserveSequence(runId: AgentRunId): Effect.Effect<number, unknown>;
2903
+ }
2904
+ interface FeishuCardDeliveryLedgerStateOptions {
2905
+ readonly initial?: ReadonlyArray<FeishuCardDeliveryRecord>;
2906
+ readonly persist?: (record: FeishuCardDeliveryRecord) => Promise<void>;
2907
+ }
2908
+ interface FeishuCardDeliveryReconciler {
2909
+ reconcile(): Effect.Effect<{
2910
+ readonly repaired: number;
2911
+ readonly skipped: number;
2912
+ readonly terminalRuns: number;
2913
+ }, unknown>;
2914
+ }
2915
+ interface FeishuCardDeliveryReconcilerOptions {
2916
+ readonly events: ReadonlyArray<AgentDomainEvent>;
2917
+ readonly ledger: FeishuCardDeliveryLedger;
2918
+ readonly publish: (action: FeishuStreamAction) => Effect.Effect<void, unknown>;
2919
+ }
2920
+ declare function createFeishuCardDeliveryLedger(options?: FeishuCardDeliveryLedgerStateOptions): FeishuCardDeliveryLedger;
2921
+ declare function createFeishuCardDeliveryReconciler(options: FeishuCardDeliveryReconcilerOptions): FeishuCardDeliveryReconciler;
2922
+ //#endregion
2923
+ //#region src/adapters/compatibility/card-presentation/jsonl-feishu-card-delivery-ledger.d.ts
2924
+ interface JsonlFeishuCardDeliveryLedgerOptions {
2925
+ readonly filePath: string;
2926
+ }
2927
+ declare function openJsonlFeishuCardDeliveryLedger(options: JsonlFeishuCardDeliveryLedgerOptions): Promise<FeishuCardDeliveryLedger>;
2928
+ //#endregion
2929
+ //#region src/adapters/compatibility/inbound-delivery/feishu-inbox-repository.d.ts
2930
+ interface FeishuInboxPendingState {
2931
+ readonly availableAt: string;
2932
+ readonly status: "pending";
2933
+ }
2934
+ interface FeishuInboxLeasedState {
2935
+ readonly leaseExpiresAt: string;
2936
+ readonly leaseId: string;
2937
+ readonly leasedAt: string;
2938
+ readonly status: "leased";
2939
+ }
2940
+ interface FeishuInboxCompletedState {
2941
+ readonly completedAt: string;
2942
+ readonly status: "completed";
2943
+ }
2944
+ interface FeishuInboxDeadState {
2945
+ readonly failedAt: string;
2946
+ readonly reason: string;
2947
+ readonly status: "dead";
2948
+ }
2949
+ type FeishuInboxDeliveryState = FeishuInboxPendingState | FeishuInboxLeasedState | FeishuInboxCompletedState | FeishuInboxDeadState;
2950
+ interface FeishuInboxDelivery {
2951
+ readonly acceptedAt: string;
2952
+ readonly attempts: number;
2953
+ readonly id: string;
2954
+ readonly laneKey: string;
2955
+ readonly options?: FeishuAgentDaemonHandleMessageOptions;
2956
+ readonly payload: FeishuReceiveMessagePayload;
2957
+ readonly recovery?: RecoveryAction;
2958
+ readonly revision: number;
2959
+ readonly state: FeishuInboxDeliveryState;
2960
+ }
2961
+ interface FeishuInboxClaimInput {
2962
+ readonly leaseExpiresAt: string;
2963
+ readonly leaseId: string;
2964
+ readonly now: string;
2965
+ }
2966
+ interface FeishuInboxClaimByIdInput extends FeishuInboxClaimInput {
2967
+ readonly id: string;
2968
+ }
2969
+ interface FeishuInboxCompleteInput {
2970
+ readonly completedAt: string;
2971
+ readonly id: string;
2972
+ readonly leaseId: string;
2973
+ }
2974
+ interface FeishuInboxFailInput {
2975
+ readonly availableAt?: string;
2976
+ readonly failedAt: string;
2977
+ readonly id: string;
2978
+ readonly leaseId: string;
2979
+ readonly reason: string;
2980
+ readonly terminal: boolean;
2981
+ }
2982
+ interface FeishuInboxReleaseInput {
2983
+ readonly availableAt: string;
2984
+ readonly id: string;
2985
+ readonly leaseId: string;
2986
+ }
2987
+ interface FeishuInboxRepository {
2988
+ admit(delivery: FeishuInboxDelivery, maxPending: number): Effect.Effect<"created" | "duplicate" | "capacity", unknown>;
2989
+ claim(input: FeishuInboxClaimInput): Effect.Effect<FeishuInboxDelivery | undefined, unknown>;
2990
+ claimById(input: FeishuInboxClaimByIdInput): Effect.Effect<FeishuInboxDelivery | undefined, unknown>;
2991
+ complete(input: FeishuInboxCompleteInput): Effect.Effect<void, unknown>;
2992
+ create(delivery: FeishuInboxDelivery): Effect.Effect<boolean, unknown>;
2993
+ deadLetters(): ReadonlyArray<FeishuInboxDelivery>;
2994
+ fail(input: FeishuInboxFailInput): Effect.Effect<void, unknown>;
2995
+ pendingCount(): number;
2996
+ requeueDeadLetter(input: {
2997
+ readonly availableAt: string;
2998
+ readonly expectedRevision: number;
2999
+ readonly id: string;
3000
+ readonly recovery: RecoveryAction;
3001
+ }): Effect.Effect<FeishuInboxDelivery, unknown>;
3002
+ release(input: FeishuInboxReleaseInput): Effect.Effect<void, unknown>;
3003
+ }
3004
+ interface FeishuInboxRepositoryStateOptions {
3005
+ readonly initial?: ReadonlyArray<FeishuInboxDelivery>;
3006
+ readonly persist?: (delivery: FeishuInboxDelivery) => Promise<void>;
3007
+ }
3008
+ declare function createFeishuInboxRepository(options?: FeishuInboxRepositoryStateOptions): FeishuInboxRepository;
3009
+ //#endregion
3010
+ //#region src/adapters/compatibility/recovery/recovery-control.d.ts
3011
+ interface RecoveryControlOptions {
3012
+ readonly clock: {
3013
+ readonly now: () => string;
3014
+ };
3015
+ readonly inboxes: ReadonlyArray<{
3016
+ readonly endpointId: string;
3017
+ readonly repository: FeishuInboxRepository;
3018
+ }>;
3019
+ readonly toolOperations: ReadonlyArray<{
3020
+ readonly instanceId: string;
3021
+ readonly ledger: ToolOperationLedger$1;
3022
+ }>;
3023
+ }
3024
+ declare function createRecoveryControl(options: RecoveryControlOptions): RecoveryControl;
3025
+ //#endregion
3026
+ //#region src/adapters/compatibility/inbound-delivery/jsonl-feishu-inbox-repository.d.ts
3027
+ interface JsonlFeishuInboxRepositoryOptions {
3028
+ readonly filePath: string;
3029
+ }
3030
+ declare function openJsonlFeishuInboxRepository(options: JsonlFeishuInboxRepositoryOptions): Promise<FeishuInboxRepository>;
3031
+ //#endregion
3032
+ //#region src/adapters/compatibility/conversation-session/json-feishu-session-store.d.ts
3033
+ interface OpenJsonFeishuSessionStoreOptions {
3034
+ readonly filePath: string;
3035
+ }
3036
+ declare function openJsonFeishuSessionStore(options: OpenJsonFeishuSessionStoreOptions): Promise<FeishuSessionStore>;
3037
+ //#endregion
3038
+ //#region src/adapters/compatibility/agent-host/session-scheduler.d.ts
3039
+ interface SessionSchedulerOptions {
3040
+ readonly createRuntime: (sessionKey: string) => PooledAgentRuntime | Promise<PooledAgentRuntime>;
3041
+ readonly maxConcurrentSessions: number;
3042
+ readonly maxQueuedRuns: number;
3043
+ }
3044
+ interface SessionSchedulerStatus {
3045
+ readonly activeSessions: number;
3046
+ readonly queuedRuns: number;
3047
+ readonly sessions: number;
3048
+ }
3049
+ interface SessionScheduler extends PooledAgentRuntime {
3050
+ readonly concurrency: "managed";
3051
+ status(): SessionSchedulerStatus;
3052
+ }
3053
+ declare class SessionSchedulerCapacityExceeded extends Error {
3054
+ readonly name = "SessionSchedulerCapacityExceeded";
3055
+ }
3056
+ declare class SessionSchedulerDisposed extends Error {
3057
+ readonly name = "SessionSchedulerDisposed";
3058
+ }
3059
+ declare function createSessionScheduler(options: SessionSchedulerOptions): SessionScheduler;
3060
+ //#endregion
3061
+ //#region src/adapters/http/client/json-fetch-request.d.ts
3062
+ interface JsonHttpRequest {
3063
+ readonly method: string;
3064
+ readonly url: string;
3065
+ readonly headers?: Readonly<Record<string, string>>;
3066
+ readonly body?: unknown;
3067
+ }
3068
+ interface JsonHttpResponse {
3069
+ readonly status: number;
3070
+ readonly body: unknown;
3071
+ }
3072
+ interface FetchLikeResponse {
3073
+ readonly status: number;
3074
+ json(): Promise<unknown>;
3075
+ }
3076
+ type FetchLike = (url: string, init: {
3077
+ readonly method: string;
3078
+ readonly headers: Readonly<Record<string, string>>;
3079
+ readonly body?: string;
3080
+ readonly signal: AbortSignal;
3081
+ }) => Promise<FetchLikeResponse>;
3082
+ interface JsonFetchRequestOptions {
3083
+ readonly fetch?: FetchLike;
3084
+ }
3085
+ declare function createJsonFetchRequest(options?: JsonFetchRequestOptions): (request: JsonHttpRequest) => Effect.Effect<JsonHttpResponse, unknown>;
3086
+ //#endregion
3087
+ //#region src/adapters/feishu/config/feishu-endpoint-credentials.d.ts
3088
+ interface FeishuEndpointCredentials {
3089
+ readonly appId: string;
3090
+ readonly appSecret: string;
3091
+ }
3092
+ declare class FeishuEndpointCredentialError extends Error {
3093
+ readonly name = "FeishuEndpointCredentialError";
3094
+ }
3095
+ declare function resolveFeishuEndpointCredentials(credentialRef: string, env: RivusDaemonEnv): FeishuEndpointCredentials;
3096
+ //#endregion
3097
+ //#region src/adapters/openclaw/config/openclaw-env-import.d.ts
3098
+ type RivusEnvFileVariables = Readonly<Record<string, string>>;
3099
+ interface OpenClawEnvImportOptions {
3100
+ readonly feishuBaseUrl?: string;
3101
+ readonly piApiKeyFile?: string;
3102
+ readonly streamMinIntervalMs?: number;
3103
+ }
3104
+ interface OpenClawEnvImportResult {
3105
+ readonly env: RivusEnvFileVariables;
3106
+ readonly warnings: ReadonlyArray<string>;
3107
+ }
3108
+ declare class OpenClawEnvImportError extends Error {
3109
+ constructor(message: string);
3110
+ }
3111
+ declare function createRivusEnvFromOpenClawConfig(openClawConfig: unknown, options?: OpenClawEnvImportOptions): OpenClawEnvImportResult;
3112
+ declare function formatRivusEnvFile(env: RivusEnvFileVariables): string;
3113
+ //#endregion
3114
+ //#region src/adapters/compatibility/inbound-delivery/feishu-message-queue.d.ts
3115
+ interface FeishuMessageQueueOptions {
3116
+ readonly clock?: {
3117
+ readonly now: () => string;
3118
+ };
3119
+ /**
3120
+ * Applies cancellation, session reset, or steering immediately after the
3121
+ * message is durably admitted. Returning undefined leaves it on the prompt
3122
+ * lane; returning a result completes the durable delivery.
3123
+ */
3124
+ readonly handleControl?: (payload: FeishuReceiveMessagePayload) => Effect.Effect<FeishuAgentDaemonHandleResult | undefined, unknown>;
3125
+ readonly handleMessage: (payload: FeishuReceiveMessagePayload, options?: FeishuAgentDaemonHandleMessageOptions) => Effect.Effect<FeishuAgentDaemonHandleResult, unknown>;
3126
+ readonly shouldRetryError?: (error: unknown) => boolean;
3127
+ readonly leaseMs?: number;
3128
+ readonly maxAttempts?: number;
3129
+ readonly maxPending?: number;
3130
+ readonly prepareControl?: (payload: FeishuReceiveMessagePayload) => Effect.Effect<FeishuMessagePreparedControl | undefined, unknown>;
3131
+ readonly repository?: FeishuInboxRepository;
3132
+ readonly retryDelayMs?: number;
3133
+ /**
3134
+ * Identifies a delivery that belongs to a run which was interrupted before
3135
+ * the process restarted. Such a delivery is completed as a duplicate rather
3136
+ * than starting the same user prompt a second time.
3137
+ */
3138
+ readonly shouldSkipReplay?: (payload: FeishuReceiveMessagePayload) => Effect.Effect<boolean, unknown>;
3139
+ }
3140
+ type FeishuMessagePreparedControl = DurableQueuePreparedAction<FeishuAgentDaemonHandleResult>;
3141
+ type FeishuMessageDrainResult = {
3142
+ readonly handled: true;
3143
+ readonly messageId: string;
3144
+ readonly result: FeishuAgentDaemonHandleResult;
3145
+ } | {
3146
+ readonly handled: false;
3147
+ readonly reason: "empty";
3148
+ };
3149
+ interface FeishuMessageQueue {
3150
+ accept(payload: FeishuReceiveMessagePayload, options?: FeishuAgentDaemonHandleMessageOptions): Effect.Effect<FeishuMessageAcceptResult, unknown>;
3151
+ drainOne(): Effect.Effect<FeishuMessageDrainResult, unknown>;
3152
+ deadLetters(): ReadonlyArray<FeishuInboxDelivery>;
3153
+ pending(): number;
3154
+ }
3155
+ declare function createFeishuMessageQueue(options: FeishuMessageQueueOptions): FeishuMessageQueue;
3156
+ //#endregion
3157
+ //#region src/adapters/feishu/intake/feishu-group-policy.d.ts
3158
+ type FeishuEndpointGroupPolicy = "mention-only" | "ignore-unmentioned" | "default-responder";
3159
+ declare function shouldAcceptFeishuEndpointMessage(payload: FeishuReceiveMessagePayload, policy: FeishuEndpointGroupPolicy, botOpenId: string): boolean;
3160
+ //#endregion
3161
+ //#region src/adapters/compatibility/inbound-delivery/feishu-message-worker.d.ts
3162
+ interface FeishuMessageWorkerQueue {
3163
+ drainOne(): Effect.Effect<FeishuMessageDrainResult, unknown>;
3164
+ pending(): number;
3165
+ }
3166
+ interface FeishuMessageWorker {
3167
+ drainAvailable(): Effect.Effect<FeishuMessageWorkerDrainAvailableResult, unknown>;
3168
+ }
3169
+ interface FeishuMessageWorkerOptions {
3170
+ readonly concurrency?: number;
3171
+ readonly queue: FeishuMessageWorkerQueue;
3172
+ }
3173
+ declare function createFeishuMessageWorker(options: FeishuMessageWorkerOptions): FeishuMessageWorker;
3174
+ //#endregion
3175
+ //#region src/adapters/compatibility/inbound-delivery/feishu-worker-loop.d.ts
3176
+ interface FeishuWorkerLoopOptions {
3177
+ readonly drainAvailable: () => Effect.Effect<unknown, unknown>;
3178
+ readonly intervalMs: number;
3179
+ readonly onError?: (error: unknown) => void | Promise<void>;
3180
+ readonly sleep: (ms: number) => Effect.Effect<void, unknown>;
3181
+ }
3182
+ type FeishuWorkerLoop = PeriodicEffectLoop;
3183
+ declare function createFeishuWorkerLoop(options: FeishuWorkerLoopOptions): FeishuWorkerLoop;
3184
+ //#endregion
3185
+ //#region src/platform/daemon/transport/rivus-daemon-transport.d.ts
3186
+ interface CompositeRivusDaemonTransportOptions {
3187
+ readonly transports: ReadonlyArray<RivusDaemonTransport>;
3188
+ }
3189
+ declare function createCompositeRivusDaemonTransport(options: CompositeRivusDaemonTransportOptions): RivusDaemonTransport;
3190
+ //#endregion
3191
+ //#region src/core/application/card-presentation/projection/card-presentation.d.ts
3192
+ type CardPresentationStatus = "streaming" | "handoff-pending" | "active" | "closed" | "terminal";
3193
+ interface CardPresentation {
3194
+ readonly runId: string;
3195
+ readonly presentationId: string;
3196
+ readonly generation: number;
3197
+ readonly cardId: string;
3198
+ readonly elementId?: string;
3199
+ readonly sourceMessageId: string;
3200
+ readonly status: CardPresentationStatus;
3201
+ readonly createdAt: string;
3202
+ readonly leaseDeadlineAt: string;
3203
+ readonly handoffAt?: string;
3204
+ readonly handoffFailedAt?: string;
3205
+ readonly predecessorPresentationId?: string;
3206
+ readonly successorPresentationId?: string;
3207
+ readonly terminalReceiptId?: string;
3208
+ }
3209
+ interface CardPresentationChain {
3210
+ readonly runId: string;
3211
+ readonly activeGeneration: number;
3212
+ readonly activePresentationId: string;
3213
+ readonly presentations: ReadonlyArray<CardPresentation>;
3214
+ readonly revision: number;
3215
+ }
3216
+ interface CardPresentationBinding {
3217
+ readonly cardId: string;
3218
+ readonly createdAt: string;
3219
+ readonly elementId?: string;
3220
+ readonly leaseDeadlineAt: string;
3221
+ readonly presentationId: string;
3222
+ readonly runId: string;
3223
+ readonly sourceMessageId: string;
3224
+ }
3225
+ interface CardPresentationSuccessor {
3226
+ readonly cardId: string;
3227
+ readonly createdAt: string;
3228
+ readonly elementId?: string;
3229
+ readonly leaseDeadlineAt: string;
3230
+ readonly presentationId: string;
3231
+ }
3232
+ declare class CardPresentationTransitionDenied extends Error {
3233
+ readonly name = "CardPresentationTransitionDenied";
3234
+ }
3235
+ declare function activeCardPresentation(chain: CardPresentationChain): CardPresentation;
3236
+ declare function acceptsCardPresentationProgress(chain: CardPresentationChain): boolean;
3237
+ declare function isCardPresentationHandoffDue(chain: CardPresentationChain, now: string): boolean;
3238
+ //#endregion
3239
+ //#region src/adapters/feishu/card-presentation/feishu-card-presentation-store.d.ts
3240
+ interface FeishuCardPresentationHandoffStart {
3241
+ readonly presentation: CardPresentation;
3242
+ readonly started: boolean;
3243
+ }
3244
+ interface FeishuCardPresentationStore {
3245
+ bind(binding: CardPresentationBinding): Effect.Effect<CardPresentation, unknown>;
3246
+ beginHandoff(input: {
3247
+ readonly handoffAt: string;
3248
+ readonly runId: string;
3249
+ }): Effect.Effect<FeishuCardPresentationHandoffStart, unknown>;
3250
+ chain(runId: string): CardPresentationChain | undefined;
3251
+ chains(): ReadonlyArray<CardPresentationChain>;
3252
+ compensateInterruptedHandoffs(compensatedAt: string): Effect.Effect<ReadonlyArray<CardPresentationChain>, unknown>;
3253
+ completeHandoff(input: {
3254
+ readonly runId: string;
3255
+ readonly successor: CardPresentationSuccessor;
3256
+ }): Effect.Effect<CardPresentation, unknown>;
3257
+ failHandoff(input: {
3258
+ readonly failedAt: string;
3259
+ readonly runId: string;
3260
+ }): Effect.Effect<void, unknown>;
3261
+ markTerminal(input: {
3262
+ readonly runId: string;
3263
+ readonly terminalReceiptId: string;
3264
+ }): Effect.Effect<void, unknown>;
3265
+ release(runId: string): Effect.Effect<void, unknown>;
3266
+ size(): number;
3267
+ }
3268
+ //#endregion
3269
+ //#region src/core/application/card-presentation/projection/card-presentation-lease.d.ts
3270
+ declare const DEFAULT_CARD_STREAM_LEASE_MS = 510000;
3271
+ //#endregion
3272
+ //#region src/adapters/feishu/card-presentation/rollover/feishu-card-rollover.d.ts
3273
+ interface FeishuCardRolloverTarget {
3274
+ readonly cardId: string;
3275
+ readonly elementId?: string;
3276
+ }
3277
+ interface FeishuCardRolloverSuccessorRequest {
3278
+ readonly generation: number;
3279
+ readonly presentationId: string;
3280
+ readonly run: FeishuAgentRunPreparation;
3281
+ }
3282
+ interface FeishuCardRolloverStreamPublisher {
3283
+ flush(runId?: string): Effect.Effect<void, unknown>;
3284
+ publish(action: FeishuStreamAction): Effect.Effect<void, unknown>;
3285
+ }
3286
+ type FeishuCardRolloverEventType = "handoff_started" | "handoff_succeeded" | "handoff_failed" | "handoff_notice_failed" | "presentation_write_failed" | "stale_update_dropped" | "stream_closed" | "terminal_delivery_failed";
3287
+ interface FeishuCardRolloverEvent {
3288
+ readonly at?: string;
3289
+ readonly cardId?: string;
3290
+ readonly error?: unknown;
3291
+ readonly generation?: number;
3292
+ readonly presentationId?: string;
3293
+ readonly runId?: string;
3294
+ readonly sourceMessageId?: string;
3295
+ readonly successorCardId?: string;
3296
+ readonly type: FeishuCardRolloverEventType;
3297
+ }
3298
+ type FeishuCardRolloverCounters = Readonly<Record<FeishuCardRolloverEventType, number>>;
3299
+ interface FeishuCardRolloverStatus {
3300
+ readonly counters: FeishuCardRolloverCounters;
3301
+ readonly leaseMs: number;
3302
+ readonly live: ReadonlyArray<CardPresentation>;
3303
+ }
3304
+ type FeishuCardRolloverHandoffResult = {
3305
+ readonly presentation: CardPresentation;
3306
+ readonly status: "rolled-over";
3307
+ } | {
3308
+ readonly reason: "already-pending" | "not-due" | "not-live" | "not-streaming";
3309
+ readonly status: "skipped";
3310
+ } | {
3311
+ readonly error: unknown;
3312
+ readonly status: "failed";
3313
+ };
3314
+ interface FeishuCardRolloverOptions {
3315
+ readonly clock: AgentClock;
3316
+ readonly createSuccessor: (request: FeishuCardRolloverSuccessorRequest) => Effect.Effect<FeishuCardRolloverTarget, unknown>;
3317
+ readonly leaseMs?: number;
3318
+ readonly observe?: (event: FeishuCardRolloverEvent) => void;
3319
+ readonly progressDisplay?: ConversationProgressDisplay;
3320
+ readonly publisher: FeishuCardRolloverStreamPublisher;
3321
+ readonly store: FeishuCardPresentationStore;
3322
+ }
3323
+ interface FeishuCardRollover extends FeishuCardRolloverStreamPublisher {
3324
+ bindRun(run: FeishuAgentRunPreparation, target: FeishuCardRolloverTarget): Effect.Effect<CardPresentation, unknown>;
3325
+ dueRunIds(now: Date): ReadonlyArray<string>;
3326
+ handoff(runId: string): Effect.Effect<FeishuCardRolloverHandoffResult, unknown>;
3327
+ observeStreamClosed(cardId: string): void;
3328
+ recover(): Effect.Effect<{
3329
+ readonly compensated: number;
3330
+ }, unknown>;
3331
+ releaseRun(runId: string): Effect.Effect<void>;
3332
+ status(): FeishuCardRolloverStatus;
3333
+ }
3334
+ declare function createFeishuCardRollover(options: FeishuCardRolloverOptions): FeishuCardRollover;
3335
+ //#endregion
3336
+ //#region src/adapters/compatibility/daemon/rivus-daemon-status.d.ts
3337
+ interface RivusDaemonStatus {
3338
+ readonly agentId: string;
3339
+ readonly cards?: FeishuCardRolloverStatus;
3340
+ readonly harness: {
3341
+ readonly activeRunId?: AgentRunId;
3342
+ readonly activeRunState?: AgentRunState;
3343
+ readonly activeSessionKey?: SessionKey;
3344
+ readonly busy: boolean;
3345
+ };
3346
+ readonly history: AgentHistory;
3347
+ readonly process: {
3348
+ readonly running: boolean;
3349
+ };
3350
+ readonly queue: {
3351
+ readonly pending: number;
3352
+ };
3353
+ readonly receive?: FeishuReceiveRuntimeStatus;
3354
+ readonly transport: {
3355
+ readonly running: boolean;
3356
+ };
3357
+ readonly workerLoop: {
3358
+ readonly running: boolean;
3359
+ };
3360
+ }
3361
+ interface RivusDaemonStatusReporter {
3362
+ status(): Effect.Effect<RivusDaemonStatus, unknown>;
3363
+ }
3364
+ interface RivusDaemonStatusReporterOptions {
3365
+ readonly activeRun?: () => ActiveAgentRun | undefined;
3366
+ readonly cardPresentations?: () => FeishuCardRolloverStatus;
3367
+ readonly activeRunId?: () => AgentRunId | undefined;
3368
+ readonly activeRunState?: () => AgentRunState | undefined;
3369
+ readonly agentId: string;
3370
+ readonly availability?: () => AgentHarnessAvailability;
3371
+ readonly pending: () => number;
3372
+ readonly processRunning: () => boolean;
3373
+ readonly receiveStatus?: () => FeishuReceiveRuntimeStatus;
3374
+ readonly restoreHistory: () => Effect.Effect<AgentHistory, unknown>;
3375
+ readonly transportRunning: () => boolean;
3376
+ readonly workerLoopRunning: () => boolean;
3377
+ }
3378
+ declare function createRivusDaemonStatusReporter(options: RivusDaemonStatusReporterOptions): RivusDaemonStatusReporter;
3379
+ //#endregion
3380
+ //#region src/adapters/compatibility/daemon/rivus-daemon-status-http-server.d.ts
3381
+ interface RivusDaemonStatusHttpServerOptions {
3382
+ readonly host?: string;
3383
+ readonly path?: string;
3384
+ readonly port: number;
3385
+ readonly statusReporter: RivusDaemonStatusReporter;
3386
+ }
3387
+ interface RivusDaemonStatusHttpServer extends RivusDaemonTransport {
3388
+ url(): string | undefined;
3389
+ }
3390
+ declare function createRivusDaemonStatusHttpServer(options: RivusDaemonStatusHttpServerOptions): RivusDaemonStatusHttpServer;
3391
+ //#endregion
3392
+ //#region src/adapters/feishu/protocol/feishu-card-protocol.d.ts
3393
+ /** Shared raw-card schema used by Feishu protocol adapters. */
3394
+ interface FeishuRawCardJson {
3395
+ readonly body: {
3396
+ readonly direction?: "horizontal" | "vertical";
3397
+ readonly elements: ReadonlyArray<unknown>;
3398
+ readonly padding?: string;
3399
+ readonly vertical_spacing?: string;
3400
+ };
3401
+ readonly config: {
3402
+ readonly streaming_mode?: boolean;
3403
+ readonly update_multi: true;
3404
+ };
3405
+ readonly header: {
3406
+ readonly padding?: string;
3407
+ readonly template: "blue" | "green" | "grey" | "orange" | "red";
3408
+ readonly title: {
3409
+ readonly content: string;
3410
+ readonly tag: "plain_text";
3411
+ };
3412
+ };
3413
+ readonly schema: "2.0";
3414
+ }
3415
+ //#endregion
3416
+ //#region src/adapters/feishu/runtime/card-action-response.d.ts
3417
+ interface FeishuCardActionCallbackResponse {
3418
+ readonly card?: {
3419
+ readonly data: FeishuRawCardJson;
3420
+ readonly type: "raw";
3421
+ };
3422
+ readonly toast: FeishuCardActionToast;
3423
+ }
3424
+ interface FeishuCardActionToast {
3425
+ readonly type: "success" | "info" | "warning" | "error";
3426
+ readonly content: string;
3427
+ readonly i18n?: {
3428
+ readonly en_us?: string;
3429
+ readonly zh_cn?: string;
3430
+ };
3431
+ }
3432
+ declare function createFeishuCardActionCallbackResponse(result: FeishuAgentDaemonHandleResult): FeishuCardActionCallbackResponse;
3433
+ declare function createFeishuCardActionErrorResponse(): FeishuCardActionCallbackResponse;
3434
+ //#endregion
3435
+ //#region src/adapters/feishu/runtime/event-handlers.d.ts
3436
+ interface FeishuEventHandlerQueue {
3437
+ accept(payload: FeishuReceiveMessagePayload): Effect.Effect<FeishuMessageAcceptResult, unknown>;
3438
+ pending?(): number;
3439
+ }
3440
+ interface FeishuEventHandlerCardActions {
3441
+ handleCardAction(payload: FeishuCardActionTriggerPayload): Effect.Effect<FeishuAgentDaemonHandleResult, unknown>;
3442
+ }
3443
+ interface FeishuEventHandlersOptions {
3444
+ readonly cardActions?: FeishuEventHandlerCardActions;
3445
+ readonly queue: FeishuEventHandlerQueue;
3446
+ }
3447
+ interface FeishuSdkReceiveMessagePayload {
3448
+ readonly message: FeishuReceiveMessagePayload["event"]["message"];
3449
+ readonly sender?: FeishuReceiveMessagePayload["event"]["sender"];
3450
+ readonly tenant_key?: string;
3451
+ }
3452
+ type FeishuReceiveMessageHandlerPayload = FeishuReceiveMessagePayload | FeishuSdkReceiveMessagePayload;
3453
+ interface FeishuEventHandlers {
3454
+ readonly "card.action.trigger"?: (payload: FeishuCardActionTriggerPayload) => Promise<FeishuCardActionCallbackResponse>;
3455
+ readonly "im.message.receive_v1": (payload: FeishuReceiveMessageHandlerPayload) => Promise<FeishuMessageAcceptResult>;
3456
+ }
3457
+ declare function createFeishuEventHandlers(options: FeishuEventHandlersOptions): FeishuEventHandlers;
3458
+ //#endregion
3459
+ //#region src/adapters/feishu/runtime/feishu-receive-runtime.d.ts
3460
+ interface FeishuPeriodicFlushSupervisor {
3461
+ withPeriodicFlush<A, E, R>(effect: Effect.Effect<A, E, R>): Effect.Effect<A, unknown, R>;
3462
+ }
3463
+ //#endregion
3464
+ //#region src/bootstrap/feishu/agent-runtime.d.ts
3465
+ interface FeishuAgentRuntimeOptions {
3466
+ readonly acknowledgeSteering?: (messageId: string) => Effect.Effect<void, unknown>;
3467
+ readonly agentId: string;
3468
+ readonly botOpenId?: string;
3469
+ readonly clock: AgentClock;
3470
+ readonly eventSinks?: ReadonlyArray<AgentDomainEventSink>;
3471
+ readonly finalizeRun?: (runId: AgentRunId) => Effect.Effect<void>;
3472
+ readonly inboxRepository?: FeishuInboxRepository;
3473
+ readonly initialEvents?: ReadonlyArray<AgentDomainEvent>;
3474
+ readonly initialRunStates?: ReadonlyArray<AgentRunState>;
3475
+ readonly loop: LegacyAgentLoop;
3476
+ readonly prepareRun?: (run: FeishuAgentRunPreparation) => Effect.Effect<void, unknown>;
3477
+ readonly promptContext?: FeishuPromptContextResolver;
3478
+ readonly periodicFlush?: FeishuPeriodicFlushSupervisor;
3479
+ readonly publish: (action: FeishuStreamAction) => Effect.Effect<void, unknown>;
3480
+ readonly reply?: (messageId: string, text: string) => Effect.Effect<void, unknown>;
3481
+ readonly runTimeoutMs?: number;
3482
+ readonly runIds: RunIdGenerator;
3483
+ readonly sessionStore?: FeishuSessionStore;
3484
+ }
3485
+ interface FeishuAgentRuntime {
3486
+ readonly handlers: FeishuEventHandlers;
3487
+ readonly harness: AgentHarness;
3488
+ readonly queue: FeishuMessageQueue;
3489
+ readonly worker: FeishuMessageWorker;
3490
+ drainAvailable(): Effect.Effect<FeishuMessageWorkerDrainAvailableResult, unknown>;
3491
+ drainOne(): Effect.Effect<FeishuMessageDrainResult, unknown>;
3492
+ pending(): number;
3493
+ receiveStatus(): FeishuReceiveRuntimeStatus;
3494
+ replayReceiveMessage(payload: FeishuReceiveMessagePayload, options?: FeishuReceiveMessageReplayOptions): Effect.Effect<FeishuReceiveMessageReplayResult, unknown>;
3495
+ }
3496
+ declare function createFeishuAgentRuntime(options: FeishuAgentRuntimeOptions): FeishuAgentRuntime;
3497
+ //#endregion
3498
+ //#region src/platform/daemon/status/daemon-status-reporter.d.ts
3499
+ interface DaemonStatusSnapshot<History, RunState, CardStatus, ReceiveStatus> {
3500
+ readonly agentId: string;
3501
+ readonly cards?: CardStatus;
3502
+ readonly harness: {
3503
+ readonly activeRunId?: string;
3504
+ readonly activeRunState?: RunState;
3505
+ readonly activeSessionKey?: string;
3506
+ readonly busy: boolean;
3507
+ };
3508
+ readonly history: History;
3509
+ readonly process: {
3510
+ readonly running: boolean;
3511
+ };
3512
+ readonly queue: {
3513
+ readonly pending: number;
3514
+ };
3515
+ readonly receive?: ReceiveStatus;
3516
+ readonly transport: {
3517
+ readonly running: boolean;
3518
+ };
3519
+ readonly workerLoop: {
3520
+ readonly running: boolean;
3521
+ };
3522
+ }
3523
+ interface DaemonStatusReporter<History, RunState, CardStatus, ReceiveStatus> {
3524
+ status(): Effect.Effect<DaemonStatusSnapshot<History, RunState, CardStatus, ReceiveStatus>, unknown>;
3525
+ }
3526
+ //#endregion
3527
+ //#region src/adapters/feishu/runtime/websocket-daemon.d.ts
3528
+ interface FeishuWebSocketClientStartOptions {
3529
+ readonly eventDispatcher: unknown;
3530
+ }
3531
+ interface FeishuWebSocketClient {
3532
+ connected?(): boolean;
3533
+ start(options: FeishuWebSocketClientStartOptions): void | Promise<void>;
3534
+ close?(): void | Promise<void>;
3535
+ disconnect?(): void | Promise<void>;
3536
+ stop?(): void | Promise<void>;
3537
+ }
3538
+ interface FeishuWebSocketEventDispatcher {
3539
+ register(handlers: FeishuEventHandlers): unknown;
3540
+ }
3541
+ declare function createLazyFeishuWebSocketEventDispatcher(create: () => FeishuWebSocketEventDispatcher): FeishuWebSocketEventDispatcher;
3542
+ interface FeishuWebSocketRuntime {
3543
+ readonly handlers: FeishuEventHandlers;
3544
+ drainAvailable?(): unknown;
3545
+ }
3546
+ type FeishuWebSocketDaemonOptions = {
3547
+ readonly client: FeishuWebSocketClient;
3548
+ readonly eventDispatcher: FeishuWebSocketEventDispatcher;
3549
+ readonly handlers: FeishuEventHandlers;
3550
+ readonly runtime?: never;
3551
+ } | {
3552
+ readonly client: FeishuWebSocketClient;
3553
+ readonly eventDispatcher: FeishuWebSocketEventDispatcher;
3554
+ readonly handlers?: never;
3555
+ readonly runtime: FeishuWebSocketRuntime;
3556
+ };
3557
+ interface FeishuWebSocketDaemon {
3558
+ running(): boolean;
3559
+ start(): Promise<void>;
3560
+ stop(): Promise<void>;
3561
+ }
3562
+ declare function createFeishuWebSocketDaemon(options: FeishuWebSocketDaemonOptions): FeishuWebSocketDaemon;
3563
+ //#endregion
3564
+ //#region src/adapters/feishu/card-presentation/delivery/feishu-cardkit-publisher.d.ts
3565
+ interface FeishuCardTarget {
3566
+ readonly cardId: string;
3567
+ readonly elementId: string;
3568
+ readonly progressElementId?: string;
3569
+ }
3570
+ interface FeishuCardKitTextUpdate {
3571
+ readonly cardId: string;
3572
+ readonly elementId: string;
3573
+ readonly content: string;
3574
+ readonly sequence: number;
3575
+ }
3576
+ interface FeishuCardKitPresentationUpdate {
3577
+ readonly cardId: string;
3578
+ readonly presentation?: RunPresentation;
3579
+ readonly runId: AgentRunId;
3580
+ readonly sequence: number;
3581
+ readonly sessionKey: string;
3582
+ readonly text?: string;
3583
+ }
3584
+ interface FeishuCardKitFinish {
3585
+ readonly cardId: string;
3586
+ readonly presentation?: RunPresentation;
3587
+ readonly text: string;
3588
+ readonly sequence: number;
3589
+ }
3590
+ interface FeishuCardKitFail {
3591
+ readonly cardId: string;
3592
+ readonly errorMessage: string;
3593
+ readonly presentation?: RunPresentation;
3594
+ readonly sequence: number;
3595
+ }
3596
+ interface FeishuCardKitCancel {
3597
+ readonly cardId: string;
3598
+ readonly presentation?: RunPresentation;
3599
+ readonly reason?: string;
3600
+ readonly sequence: number;
3601
+ readonly text?: string;
3602
+ }
3603
+ interface FeishuCardKitClient {
3604
+ cancel(request: FeishuCardKitCancel): Effect.Effect<void, unknown>;
3605
+ updatePresentation(request: FeishuCardKitPresentationUpdate): Effect.Effect<void, unknown>;
3606
+ updateText(request: FeishuCardKitTextUpdate): Effect.Effect<void, unknown>;
3607
+ finish(request: FeishuCardKitFinish): Effect.Effect<void, unknown>;
3608
+ fail(request: FeishuCardKitFail): Effect.Effect<void, unknown>;
3609
+ }
3610
+ interface FeishuCardKitPublisherOptions {
3611
+ readonly client: FeishuCardKitClient;
3612
+ readonly ledger?: FeishuCardDeliveryLedger;
3613
+ readonly resolveTarget: (runId: AgentRunId) => Effect.Effect<FeishuCardTarget, unknown>;
3614
+ }
3615
+ interface FeishuCardKitPublisher {
3616
+ publish(action: FeishuStreamAction): Effect.Effect<void, unknown>;
3617
+ }
3618
+ declare function createFeishuCardKitPublisher(options: FeishuCardKitPublisherOptions): FeishuCardKitPublisher;
3619
+ //#endregion
3620
+ //#region src/adapters/feishu/card-presentation/target/feishu-card-target-registry.d.ts
3621
+ declare class FeishuCardTargetNotFound {
3622
+ readonly runId: AgentRunId;
3623
+ readonly _tag = "FeishuCardTargetNotFound";
3624
+ constructor(runId: AgentRunId);
3625
+ }
3626
+ type FeishuCardTargetRegistryOperation = "load" | "save";
3627
+ declare class FeishuCardTargetRegistryStoreError {
3628
+ readonly operation: FeishuCardTargetRegistryOperation;
3629
+ readonly cause: unknown;
3630
+ readonly _tag = "FeishuCardTargetRegistryStoreError";
3631
+ constructor(operation: FeishuCardTargetRegistryOperation, cause: unknown);
3632
+ }
3633
+ interface FeishuCardTargetRegistry extends FeishuCardPresentationStore {
3634
+ resolveTarget(runId: AgentRunId): Effect.Effect<FeishuCardTarget, unknown>;
3635
+ }
3636
+ interface JsonFileFeishuCardTargetRegistryOptions {
3637
+ readonly filePath: string;
3638
+ }
3639
+ declare function createInMemoryFeishuCardTargetRegistry(initial?: ReadonlyArray<CardPresentationChain>): FeishuCardTargetRegistry;
3640
+ declare function createJsonFileFeishuCardTargetRegistry(options: JsonFileFeishuCardTargetRegistryOptions): FeishuCardTargetRegistry;
3641
+ //#endregion
3642
+ //#region src/adapters/feishu/card-presentation/rollover/feishu-card-rollover-supervisor.d.ts
3643
+ interface FeishuCardRolloverSupervisorOptions {
3644
+ readonly clock: AgentClock;
3645
+ readonly intervalMs?: number;
3646
+ readonly onError?: (error: unknown) => void | Promise<void>;
3647
+ readonly rollover: Pick<FeishuCardRollover, "dueRunIds" | "handoff" | "recover">;
3648
+ readonly sleep: (ms: number) => Effect.Effect<void, unknown>;
3649
+ }
3650
+ interface FeishuCardRolloverSupervisorTickResult {
3651
+ readonly results: ReadonlyArray<FeishuCardRolloverHandoffResult>;
3652
+ }
3653
+ interface FeishuCardRolloverSupervisor {
3654
+ recover(): Effect.Effect<void, unknown>;
3655
+ running(): boolean;
3656
+ start(): void;
3657
+ stop(): Promise<void>;
3658
+ tick(): Effect.Effect<FeishuCardRolloverSupervisorTickResult, unknown>;
3659
+ }
3660
+ declare function createFeishuCardRolloverSupervisor(options: FeishuCardRolloverSupervisorOptions): FeishuCardRolloverSupervisor;
3661
+ //#endregion
3662
+ //#region src/adapters/feishu/client/feishu-tenant-token-provider.d.ts
3663
+ interface FeishuTenantAccessTokenRequest {
3664
+ readonly method: "POST";
3665
+ readonly url: string;
3666
+ readonly headers: Readonly<Record<string, string>>;
3667
+ readonly body: {
3668
+ readonly app_id: string;
3669
+ readonly app_secret: string;
3670
+ };
3671
+ }
3672
+ interface FeishuTenantAccessTokenResponse {
3673
+ readonly status: number;
3674
+ readonly body: {
3675
+ readonly code?: number;
3676
+ readonly msg?: string;
3677
+ readonly tenant_access_token?: string;
3678
+ readonly expire?: number;
3679
+ };
3680
+ }
3681
+ interface FeishuTenantAccessTokenProviderOptions {
3682
+ readonly appId: string;
3683
+ readonly appSecret: string;
3684
+ readonly baseUrl?: string;
3685
+ readonly refreshWindowMs?: number;
3686
+ readonly now?: () => number;
3687
+ readonly request: (request: FeishuTenantAccessTokenRequest) => Effect.Effect<FeishuTenantAccessTokenResponse, unknown>;
3688
+ }
3689
+ interface FeishuTenantAccessTokenProvider {
3690
+ getTenantAccessToken(): Effect.Effect<string, unknown>;
3691
+ }
3692
+ declare class FeishuTenantAccessTokenError {
3693
+ readonly status: number;
3694
+ readonly code: number | undefined;
3695
+ readonly message: string;
3696
+ readonly _tag = "FeishuTenantAccessTokenError";
3697
+ constructor(status: number, code: number | undefined, message: string);
3698
+ }
3699
+ declare function createFeishuTenantAccessTokenProvider(options: FeishuTenantAccessTokenProviderOptions): FeishuTenantAccessTokenProvider;
3700
+ //#endregion
3701
+ //#region src/adapters/feishu/client/feishu-openapi-client.d.ts
3702
+ interface FeishuOpenApiRequest {
3703
+ readonly method: "GET" | "PATCH" | "POST" | "PUT";
3704
+ readonly url: string;
3705
+ readonly headers: Readonly<Record<string, string>>;
3706
+ readonly body?: unknown;
3707
+ }
3708
+ interface FeishuOpenApiResponse {
3709
+ readonly status: number;
3710
+ readonly body: {
3711
+ readonly code?: number;
3712
+ readonly msg?: string;
3713
+ readonly data?: unknown;
3714
+ };
3715
+ }
3716
+ interface FeishuOpenApiClient {
3717
+ request(request: Omit<FeishuOpenApiRequest, "headers">, errorMessage?: string): Effect.Effect<FeishuOpenApiResponse, unknown>;
3718
+ }
3719
+ type ConfiguredFeishuOpenApiRequest = FeishuOpenApiRequest | FeishuTenantAccessTokenRequest;
3720
+ type ConfiguredFeishuOpenApiResponse = FeishuOpenApiResponse | FeishuTenantAccessTokenResponse;
3721
+ declare class FeishuOpenApiError extends Error {
3722
+ readonly status: number;
3723
+ readonly code: number | undefined;
3724
+ readonly _tag = "FeishuOpenApiError";
3725
+ readonly name = "FeishuOpenApiError";
3726
+ constructor(status: number, code: number | undefined, message: string);
3727
+ }
3728
+ declare function createFeishuOpenApiClient(options: {
3729
+ readonly getTenantAccessToken: () => Effect.Effect<string, unknown>;
3730
+ readonly request: (request: FeishuOpenApiRequest) => Effect.Effect<FeishuOpenApiResponse, unknown>;
3731
+ }): FeishuOpenApiClient;
3732
+ declare function createConfiguredFeishuOpenApiClient(options: {
3733
+ readonly config: RivusDaemonConfig;
3734
+ readonly request: (request: ConfiguredFeishuOpenApiRequest) => Effect.Effect<ConfiguredFeishuOpenApiResponse, unknown>;
3735
+ }): FeishuOpenApiClient;
3736
+ //#endregion
3737
+ //#region src/bootstrap/feishu/card-rollover-runtime.d.ts
3738
+ interface ConfiguredFeishuCardRolloverRuntimeOptions {
3739
+ readonly agentName?: string;
3740
+ readonly cardTargets: FeishuCardTargetRegistry;
3741
+ readonly cancelButton?: boolean;
3742
+ readonly client: FeishuOpenApiClient;
3743
+ readonly clock: AgentClock;
3744
+ readonly config: RivusDaemonConfig;
3745
+ readonly elementId?: string;
3746
+ readonly initialContent?: string;
3747
+ readonly flushIntervalMs?: number;
3748
+ readonly ledger?: FeishuCardDeliveryLedger;
3749
+ readonly observe?: (event: FeishuCardRolloverEvent) => void;
3750
+ readonly onError?: (error: unknown) => void | Promise<void>;
3751
+ readonly progressDisplay?: ConversationProgressDisplay;
3752
+ readonly sleep: (ms: number) => Effect.Effect<void, unknown>;
3753
+ readonly supervisorIntervalMs?: number;
3754
+ readonly title?: string;
3755
+ }
3756
+ interface ConfiguredFeishuCardRolloverRuntime {
3757
+ readonly rollover: FeishuCardRollover;
3758
+ readonly supervisor: FeishuCardRolloverSupervisor;
3759
+ readonly transport: RivusDaemonTransport;
3760
+ prepareRun(run: FeishuAgentRunPreparation): Effect.Effect<void, unknown>;
3761
+ }
3762
+ declare function createConfiguredFeishuCardRolloverRuntime(options: ConfiguredFeishuCardRolloverRuntimeOptions): ConfiguredFeishuCardRolloverRuntime;
3763
+ //#endregion
3764
+ //#region src/bootstrap/feishu/rivus-daemon-bootstrap.d.ts
3765
+ type ConfiguredRivusDaemonBootstrapRequest = ConfiguredFeishuOpenApiRequest;
3766
+ type ConfiguredRivusDaemonBootstrapResponse = ConfiguredFeishuOpenApiResponse;
3767
+ type ConfiguredRivusDaemonStatus = DaemonStatusSnapshot<AgentHistory, AgentRunState, FeishuCardRolloverStatus, FeishuReceiveRuntimeStatus>;
3768
+ type ConfiguredRivusDaemonStatusReporter = DaemonStatusReporter<AgentHistory, AgentRunState, FeishuCardRolloverStatus, FeishuReceiveRuntimeStatus>;
3769
+ interface ConfiguredRivusDaemonBootstrapOptions {
3770
+ readonly botOpenId?: string;
3771
+ readonly cardLedger?: FeishuCardDeliveryLedger;
3772
+ readonly cardRolloverIntervalMs?: number;
3773
+ readonly cardTargets: FeishuCardTargetRegistry;
3774
+ readonly clock: AgentClock;
3775
+ readonly config: RivusDaemonConfig;
3776
+ readonly createStatusTransport?: (statusReporter: ConfiguredRivusDaemonStatusReporter) => RivusDaemonTransport;
3777
+ readonly eventDispatcher: FeishuWebSocketEventDispatcher;
3778
+ readonly eventLog: AgentEventLog;
3779
+ readonly flushIntervalMs?: number;
3780
+ readonly initialEvents?: ReadonlyArray<AgentDomainEvent>;
3781
+ readonly initialRunStates?: ReadonlyArray<AgentRunState>;
3782
+ readonly inboxRepository?: FeishuInboxRepository;
3783
+ readonly loop: LegacyAgentLoop;
3784
+ readonly observeCardRollover?: (event: FeishuCardRolloverEvent) => void;
3785
+ readonly onWorkerError?: (error: unknown) => void | Promise<void>;
3786
+ readonly request: (request: ConfiguredRivusDaemonBootstrapRequest) => Effect.Effect<ConfiguredRivusDaemonBootstrapResponse, unknown>;
3787
+ readonly runIds: RunIdGenerator;
3788
+ readonly runTimeoutMs?: number;
3789
+ readonly sleep: (ms: number) => Effect.Effect<void, unknown>;
3790
+ readonly websocketClient: FeishuWebSocketClient;
3791
+ readonly workerIntervalMs?: number;
3792
+ }
3793
+ interface ConfiguredRivusDaemonBootstrap {
3794
+ readonly cardRollover: ConfiguredFeishuCardRolloverRuntime;
3795
+ readonly cardTargets: FeishuCardTargetRegistry;
3796
+ readonly eventLog: AgentEventLog;
3797
+ readonly process: RivusDaemonProcess;
3798
+ readonly publisher: FeishuCardRollover;
3799
+ readonly runtime: FeishuAgentRuntime;
3800
+ readonly statusReporter: ConfiguredRivusDaemonStatusReporter;
3801
+ readonly transport: RivusDaemonTransport;
3802
+ readonly websocketTransport: FeishuWebSocketDaemon;
3803
+ readonly workerLoop: FeishuWorkerLoop;
3804
+ promptText(command: PromptCommand): Effect.Effect<string, unknown>;
3805
+ restoreHistory(): Effect.Effect<AgentHistory, unknown>;
3806
+ status(): Effect.Effect<ConfiguredRivusDaemonStatus, unknown>;
3807
+ }
3808
+ declare function restoreConfiguredRivusDaemonBootstrap(options: ConfiguredRivusDaemonBootstrapOptions): Effect.Effect<ConfiguredRivusDaemonBootstrap, unknown>;
3809
+ declare function createConfiguredRivusDaemonBootstrap(options: ConfiguredRivusDaemonBootstrapOptions): ConfiguredRivusDaemonBootstrap;
3810
+ //#endregion
3811
+ //#region src/adapters/compatibility/run-presentation/run-presentation-projector.d.ts
3812
+ interface RunPresentationProjector {
3813
+ apply(event: AgentDomainEvent, canonicalText?: string): RunPresentation | undefined;
3814
+ snapshot(runId: AgentRunId): RunPresentation | undefined;
3815
+ }
3816
+ declare function createRunPresentationProjector(): RunPresentationProjector;
3817
+ //#endregion
3818
+ //#region src/adapters/compatibility/card-presentation/feishu-card-presentation-store.d.ts
3819
+ declare class FeishuCardPresentationNotFound {
3820
+ readonly runId: string;
3821
+ readonly _tag = "FeishuCardPresentationNotFound";
3822
+ constructor(runId: string);
3823
+ }
3824
+ interface FeishuCardPresentationStoreOptions {
3825
+ readonly initial?: ReadonlyArray<CardPresentationChain>;
3826
+ readonly persist?: (chains: ReadonlyArray<CardPresentationChain>) => Promise<void>;
3827
+ }
3828
+ declare function createFeishuCardPresentationStore(options?: FeishuCardPresentationStoreOptions): FeishuCardPresentationStore;
3829
+ //#endregion
3830
+ //#region src/adapters/feishu/card-presentation/delivery/feishu-cardkit-openapi-client.d.ts
3831
+ interface FeishuCardKitOpenApiClientOptions {
3832
+ readonly agentName?: string;
3833
+ readonly baseUrl?: string;
3834
+ readonly cancelButton?: boolean;
3835
+ readonly client: FeishuOpenApiClient;
3836
+ readonly onStreamingClosed?: (cardId: string) => void;
3837
+ readonly progressDisplay?: ConversationProgressDisplay;
3838
+ }
3839
+ declare function createFeishuCardKitOpenApiClient(options: FeishuCardKitOpenApiClientOptions): FeishuCardKitClient;
3840
+ //#endregion
3841
+ //#region src/adapters/feishu/intake/feishu-topic-context-resolver.d.ts
3842
+ interface FeishuTopicContextResolverOptions {
3843
+ readonly baseUrl?: string;
3844
+ readonly client: FeishuOpenApiClient;
3845
+ }
3846
+ declare class InvalidFeishuTopicContext extends Error {
3847
+ readonly name = "InvalidFeishuTopicContext";
3848
+ }
3849
+ declare function createFeishuTopicContextResolver(options: FeishuTopicContextResolverOptions): FeishuPromptContextResolver;
3850
+ //#endregion
3851
+ //#region src/adapters/feishu/delivery/cot/feishu-cot-publisher.d.ts
3852
+ type FeishuCotRunPreparation = FeishuAgentRunPreparation;
3853
+ interface FeishuCotPublisher {
3854
+ fail(runId: string): Effect.Effect<void, unknown>;
3855
+ prepare(run: FeishuCotRunPreparation): Effect.Effect<void, unknown>;
3856
+ publish(update: AgentRunUpdate): Effect.Effect<void, unknown>;
3857
+ }
3858
+ interface FeishuCotPublisherOptions {
3859
+ readonly baseUrl: string;
3860
+ readonly client: FeishuOpenApiClient;
3861
+ readonly minIntervalMs: number;
3862
+ readonly now?: () => number;
3863
+ }
3864
+ declare class FeishuCotProtocolError extends Error {
3865
+ readonly name = "FeishuCotProtocolError";
3866
+ }
3867
+ declare function createFeishuCotPublisher(options: FeishuCotPublisherOptions): FeishuCotPublisher;
3868
+ //#endregion
3869
+ //#region src/adapters/feishu/card-presentation/target/feishu-cardkit-target-preparation.d.ts
3870
+ interface FeishuCardTargetCreateOptions {
3871
+ readonly generation?: number;
3872
+ readonly initialContent?: string;
3873
+ readonly initialPresentation?: RunPresentation;
3874
+ }
3875
+ interface FeishuCardTargetCreator {
3876
+ createTarget(run: FeishuAgentRunPreparation, options?: FeishuCardTargetCreateOptions): Effect.Effect<FeishuCardTarget, unknown>;
3877
+ }
3878
+ interface FeishuCardPresentationBinder {
3879
+ bindRun(run: FeishuAgentRunPreparation, target: FeishuCardTarget): Effect.Effect<unknown, unknown>;
3880
+ }
3881
+ interface FeishuCardTargetPreparationOptions {
3882
+ readonly createTarget: (run: FeishuAgentRunPreparation) => Effect.Effect<FeishuCardTarget, unknown>;
3883
+ readonly presentations: FeishuCardPresentationBinder;
3884
+ }
3885
+ interface FeishuCardKitOpenApiTargetCreatorOptions {
3886
+ readonly baseUrl?: string;
3887
+ readonly cancelButton?: boolean;
3888
+ readonly client: FeishuOpenApiClient;
3889
+ readonly elementId: string;
3890
+ readonly initialContent?: string;
3891
+ readonly progressDisplay?: ConversationProgressDisplay;
3892
+ readonly title?: string;
3893
+ }
3894
+ interface ConfiguredFeishuCardKitTargetCreatorOptions {
3895
+ readonly cancelButton?: boolean;
3896
+ readonly client: FeishuOpenApiClient;
3897
+ readonly config: RivusDaemonConfig;
3898
+ readonly elementId?: string;
3899
+ readonly initialContent?: string;
3900
+ readonly progressDisplay?: ConversationProgressDisplay;
3901
+ readonly title?: string;
3902
+ }
3903
+ declare function createFeishuCardTargetPreparation(options: FeishuCardTargetPreparationOptions): (run: FeishuAgentRunPreparation) => Effect.Effect<void, unknown>;
3904
+ declare function createConfiguredFeishuCardKitTargetCreator(options: ConfiguredFeishuCardKitTargetCreatorOptions): FeishuCardTargetCreator;
3905
+ declare function createFeishuCardKitOpenApiTargetCreator(options: FeishuCardKitOpenApiTargetCreatorOptions): FeishuCardTargetCreator;
3906
+ //#endregion
3907
+ //#region src/adapters/feishu/card-presentation/streaming/feishu-rate-limited-publisher.d.ts
3908
+ interface FeishuStreamActionPublisher {
3909
+ publish(action: FeishuStreamAction): Effect.Effect<void, unknown>;
3910
+ }
3911
+ interface RateLimitedFeishuPublisherOptions {
3912
+ readonly publisher: FeishuStreamActionPublisher;
3913
+ readonly minIntervalMs: number;
3914
+ readonly sleep: (ms: number) => Effect.Effect<void, unknown>;
3915
+ }
3916
+ declare function createRateLimitedFeishuPublisher(options: RateLimitedFeishuPublisherOptions): FeishuStreamActionPublisher;
3917
+ //#endregion
3918
+ //#region src/adapters/feishu/card-presentation/streaming/feishu-coalescing-publisher.d.ts
3919
+ interface FeishuCoalescingPublisher extends FeishuStreamActionPublisher {
3920
+ flush(runId?: AgentRunId): Effect.Effect<void, unknown>;
3921
+ }
3922
+ interface FeishuCoalescingPublisherOptions {
3923
+ readonly publisher: FeishuStreamActionPublisher;
3924
+ }
3925
+ declare function createCoalescingFeishuPublisher(options: FeishuCoalescingPublisherOptions): FeishuCoalescingPublisher;
3926
+ //#endregion
3927
+ //#region src/adapters/feishu/card-presentation/delivery/feishu-configured-cardkit-publisher.d.ts
3928
+ interface ConfiguredFeishuCardKitPublisherOptions {
3929
+ readonly agentName?: string;
3930
+ readonly cancelButton?: boolean;
3931
+ readonly client: FeishuOpenApiClient;
3932
+ readonly config: RivusDaemonConfig;
3933
+ readonly ledger?: FeishuCardDeliveryLedger;
3934
+ readonly onStreamingClosed?: (cardId: string) => void;
3935
+ readonly progressDisplay?: ConversationProgressDisplay;
3936
+ readonly resolveTarget: (runId: AgentRunId) => Effect.Effect<FeishuCardTarget, unknown>;
3937
+ readonly sleep: (ms: number) => Effect.Effect<void, unknown>;
3938
+ }
3939
+ declare function createConfiguredFeishuCardKitPublisher(options: ConfiguredFeishuCardKitPublisherOptions): FeishuCoalescingPublisher;
3940
+ //#endregion
3941
+ //#region src/adapters/feishu/delivery/cot/feishu-periodic-flush.d.ts
3942
+ interface FeishuPeriodicFlushOptions {
3943
+ readonly flush: () => Effect.Effect<void, unknown>;
3944
+ readonly intervalMs: number;
3945
+ readonly sleep: (ms: number) => Effect.Effect<void, unknown>;
3946
+ }
3947
+ interface FeishuPeriodicFlush {
3948
+ withPeriodicFlush<A, E, R>(effect: Effect.Effect<A, E, R>): Effect.Effect<A, unknown, R>;
3949
+ }
3950
+ declare function createFeishuPeriodicFlush(options: FeishuPeriodicFlushOptions): FeishuPeriodicFlush;
3951
+ //#endregion
3952
+ //#region src/adapters/compatibility/project-space/workspace-instructions.d.ts
3953
+ interface WorkspaceInstructionsProvider {
3954
+ resolve(request: WorkspaceInstructionsRequest): Promise<WorkspaceInstructionsView>;
3955
+ }
3956
+ declare function createAgentsMdInstructionsProvider(): WorkspaceInstructionsProvider;
3957
+ //#endregion
3958
+ //#region src/adapters/compatibility/tool-execution/tool-broker.d.ts
3959
+ interface AuthorizationPolicyState$1 extends AuthorizationPolicyState {}
3960
+ interface ToolApprovalRequest$1 extends ToolApprovalRequest {
3961
+ readonly risk: RivusToolRisk;
3962
+ }
3963
+ interface AuthorizationPolicyProvider {
3964
+ current(): Promise<AuthorizationPolicyState$1>;
3965
+ }
3966
+ interface ToolApprovalService {
3967
+ consume(request: ToolApprovalRequest$1): Promise<boolean>;
3968
+ }
3969
+ interface ToolBrokerOptions {
3970
+ readonly approvals: ToolApprovalService;
3971
+ readonly catalog: RivusPluginCatalog;
3972
+ readonly hostTools?: ReadonlyArray<RivusHostToolDescriptor>;
3973
+ readonly policy: AuthorizationPolicyProvider;
3974
+ readonly operations?: ToolOperationLedger$1;
3975
+ }
3976
+ interface ToolExecutionRequest$1 extends ToolExecutionRequest {
3977
+ readonly authority: InvocationAuthorityRef$1;
3978
+ }
3979
+ interface ToolBroker {
3980
+ execute(request: ToolExecutionRequest$1): Promise<unknown>;
3981
+ }
3982
+ declare function createToolBroker$1(options: ToolBrokerOptions): ToolBroker;
3983
+ //#endregion
3984
+ //#region src/adapters/compatibility/tool-execution/jsonl-tool-operation-ledger.d.ts
3985
+ declare function openJsonlToolOperationLedger$1(options: {
3986
+ readonly filePath: string;
3987
+ }): Promise<ToolOperationLedger$1>;
3988
+ //#endregion
3989
+ //#region src/adapters/compatibility/recovery/jsonl-recovery-control.d.ts
3990
+ interface JsonlRecoveryControlOptions {
3991
+ readonly clock?: {
3992
+ readonly now: () => string;
3993
+ };
3994
+ readonly endpointsDirectory: string;
3995
+ readonly instancesDirectory: string;
3996
+ }
3997
+ declare function openJsonlRecoveryControl(options: JsonlRecoveryControlOptions): Promise<RecoveryControl>;
3998
+ //#endregion
3999
+ //#region src/adapters/compatibility/agent-host/runtime/agent-harness-pooled-runtime.d.ts
4000
+ declare function createAgentHarnessPooledRuntime(harness: AgentHarness): PooledAgentRuntime;
4001
+ //#endregion
4002
+ //#region src/bootstrap/feishu/deployment-endpoint.d.ts
4003
+ interface FeishuDeploymentEndpointOptions extends Pick<CreateProcessDeploymentEndpointInput, "agentId" | "cancel" | "handle" | "steer"> {
4004
+ readonly acknowledgeSteering?: (messageId: string) => Effect.Effect<void, unknown>;
4005
+ readonly botOpenId: string;
4006
+ readonly cardRollover?: RivusDaemonTransport;
4007
+ readonly endpointId?: string;
4008
+ readonly finalizeRun?: (runId: string) => Effect.Effect<void>;
4009
+ readonly eventDispatcher: FeishuWebSocketEventDispatcher;
4010
+ readonly groupPolicy: FeishuEndpointGroupPolicy;
4011
+ readonly initialEvents?: ReadonlyArray<AgentDomainEvent>;
4012
+ readonly interactions?: FeishuHumanInteractionActions;
4013
+ readonly inboxRepository?: FeishuInboxRepository;
4014
+ readonly maxPendingMessages?: number;
4015
+ readonly memoryTenantId?: string;
4016
+ readonly projectSpaceId?: string;
4017
+ readonly onWorkerError?: (error: unknown) => void | Promise<void>;
4018
+ readonly onCapacityExceeded?: (payload: FeishuReceiveMessagePayload) => Effect.Effect<void, unknown>;
4019
+ readonly prepareRun?: (run: FeishuAgentRunPreparation) => Effect.Effect<void, unknown>;
4020
+ readonly promptContext: FeishuPromptContextResolver;
4021
+ readonly publish: (action: FeishuStreamAction) => Effect.Effect<void, unknown>;
4022
+ readonly publishRunUpdate?: AgentRunUpdateHandler;
4023
+ readonly reply?: (messageId: string, text: string) => Effect.Effect<void, unknown>;
4024
+ readonly sessionStore?: FeishuSessionStore;
4025
+ readonly sessionNamespace: string;
4026
+ readonly shutdownTimeoutMs?: number;
4027
+ readonly sleep: (ms: number) => Effect.Effect<void, unknown>;
4028
+ readonly websocketClient: FeishuWebSocketClient;
4029
+ readonly workerIntervalMs?: number;
4030
+ readonly workerConcurrency?: number;
4031
+ }
4032
+ declare function createFeishuDeploymentEndpoint(options: FeishuDeploymentEndpointOptions): ProcessDeploymentEndpoint;
4033
+ //#endregion
4034
+ //#region src/adapters/feishu/run-presentation/feishu-presentation-preparation.d.ts
4035
+ interface FeishuPresentationPreparationOptions {
4036
+ readonly cotPublisher?: Pick<FeishuCotPublisher, "fail" | "prepare">;
4037
+ readonly prepareCardTarget: (run: FeishuAgentRunPreparation) => Effect.Effect<void, unknown>;
4038
+ readonly reportCotError: (operation: "abort" | "create", error: unknown) => Effect.Effect<void>;
4039
+ }
4040
+ declare function createFeishuPresentationPreparation(options: FeishuPresentationPreparationOptions): (run: FeishuAgentRunPreparation) => Effect.Effect<void, unknown>;
4041
+ //#endregion
4042
+ //#region src/adapters/compatibility/memory/service/agent-memory-service.d.ts
4043
+ interface AgentMemoryServiceOptions {
4044
+ readonly ids?: {
4045
+ readonly next: () => string;
4046
+ };
4047
+ readonly initial?: ReadonlyArray<LegacyAgentMemorySnapshot>;
4048
+ readonly persist?: (snapshot: LegacyAgentMemorySnapshot) => Promise<void>;
4049
+ }
4050
+ declare function createAgentMemoryService(options?: AgentMemoryServiceOptions): LegacyAgentMemoryService;
4051
+ //#endregion
4052
+ //#region src/adapters/compatibility/background-session/transitions.d.ts
4053
+ type BackgroundSessionState = BackgroundSessionSnapshot;
4054
+ declare function isBackgroundSessionTerminalPhase(phase: BackgroundSessionPhase): boolean;
4055
+ declare class BackgroundSessionTransitionDenied extends Error {
4056
+ readonly sessionId: BackgroundSessionId;
4057
+ readonly name = "BackgroundSessionTransitionDenied";
4058
+ constructor(sessionId: BackgroundSessionId, message: string);
4059
+ }
4060
+ declare function createBackgroundSession(input: Parameters<typeof createBackgroundSession$1>[0]): BackgroundSessionState;
4061
+ declare function claimBackgroundSession(state: BackgroundSessionState, input: ClaimBackgroundSessionInput): BackgroundSessionState;
4062
+ declare function renewBackgroundSessionLease(state: BackgroundSessionState, lease: BackgroundSessionLease): BackgroundSessionState;
4063
+ declare function releaseBackgroundSessionLease(state: BackgroundSessionState): BackgroundSessionState;
4064
+ declare function suspendBackgroundSession(state: BackgroundSessionState, input: SuspendBackgroundSessionInput): BackgroundSessionState;
4065
+ declare function completeBackgroundSessionStep(state: BackgroundSessionState, input: {
4066
+ readonly text: string;
4067
+ readonly stepRunId: string;
4068
+ readonly now: string;
4069
+ }): BackgroundSessionState;
4070
+ declare function failBackgroundSessionStep(state: BackgroundSessionState, input: {
4071
+ readonly errorMessage: string;
4072
+ readonly now: string;
4073
+ readonly retryable: boolean;
4074
+ readonly wakeAt?: string;
4075
+ }): BackgroundSessionState;
4076
+ declare function requestBackgroundSessionStop(state: BackgroundSessionState, input: {
4077
+ readonly reason: string;
4078
+ readonly now: string;
4079
+ }): BackgroundSessionState;
4080
+ declare function completeBackgroundSessionStop(state: BackgroundSessionState, input: {
4081
+ readonly now: string;
4082
+ }): BackgroundSessionState;
4083
+ declare function parkBackgroundSessionForReconciliation(state: BackgroundSessionState, input: {
4084
+ readonly reason: string;
4085
+ readonly now: string;
4086
+ }): BackgroundSessionState;
4087
+ declare function resolveBackgroundSessionReconciliation(state: BackgroundSessionState, input: {
4088
+ readonly outcome: "continue" | "stop";
4089
+ readonly now: string;
4090
+ }): BackgroundSessionState;
4091
+ declare function appendBackgroundSessionInput(state: BackgroundSessionState, input: {
4092
+ readonly message: string;
4093
+ readonly now: string;
4094
+ }): BackgroundSessionState;
4095
+ declare function requeueInterruptedBackgroundSessionStep(state: BackgroundSessionState, input: {
4096
+ readonly wakeText: string;
4097
+ readonly now: string;
4098
+ }): BackgroundSessionState;
4099
+ declare function isBackgroundSessionDue(state: BackgroundSessionState, now: string): boolean;
4100
+ declare function isBackgroundSessionLeaseExpired(state: BackgroundSessionState, now: string): boolean;
4101
+ //#endregion
4102
+ //#region src/adapters/compatibility/background-session/repository.d.ts
4103
+ interface BackgroundSessionRepository {
4104
+ create(state: BackgroundSessionState): Promise<BackgroundSessionState>;
4105
+ get(sessionId: string): Promise<BackgroundSessionState | undefined>;
4106
+ list(options?: {
4107
+ readonly phase?: BackgroundSessionPhase;
4108
+ readonly limit?: number;
4109
+ }): Promise<ReadonlyArray<BackgroundSessionState>>;
4110
+ update(input: {
4111
+ readonly sessionId: string;
4112
+ readonly expectedRevision: number;
4113
+ readonly expectedLease?: BackgroundSessionLeasePrecondition | BackgroundSessionLeaseRequirement | BackgroundSessionLeaseStaleOrAbsent;
4114
+ readonly now?: string;
4115
+ readonly build: (state: BackgroundSessionState) => BackgroundSessionState;
4116
+ }): Promise<BackgroundSessionState | undefined>;
4117
+ }
4118
+ //#endregion
4119
+ //#region src/adapters/compatibility/background-session/service.d.ts
4120
+ interface BackgroundSessionServiceOptions {
4121
+ readonly clock: {
4122
+ now(): string;
4123
+ };
4124
+ readonly deliveries: BackgroundSessionDeliveryStore;
4125
+ readonly repository: BackgroundSessionRepository;
4126
+ }
4127
+ declare function createBackgroundSessionService(options: BackgroundSessionServiceOptions): BackgroundSessionService;
4128
+ //#endregion
4129
+ //#region src/adapters/outbound/persistence/background-session/session/jsonl-background-session-repository.d.ts
4130
+ declare const BACKGROUND_SESSION_JSONL_VERSION = 1;
4131
+ interface OpenJsonlBackgroundSessionRepositoryOptions {
4132
+ readonly filePath: string;
4133
+ readonly compactThreshold?: number;
4134
+ }
4135
+ declare function isBackgroundSessionState(value: unknown): value is BackgroundSessionSnapshot;
4136
+ //#endregion
4137
+ //#region src/adapters/outbound/persistence/background-session/delivery/in-memory-background-session-delivery-store.d.ts
4138
+ interface CreateBackgroundSessionDeliveryStoreOptions {
4139
+ readonly initial?: ReadonlyArray<BackgroundSessionDeliveryRecord>;
4140
+ readonly persist?: (record: BackgroundSessionDeliveryRecord) => Promise<void>;
4141
+ }
4142
+ declare function createBackgroundSessionDeliveryStore(options?: CreateBackgroundSessionDeliveryStoreOptions): BackgroundSessionDeliveryStore;
4143
+ //#endregion
4144
+ //#region src/adapters/outbound/persistence/background-session/delivery/jsonl-background-session-delivery-store.d.ts
4145
+ declare const BACKGROUND_SESSION_DELIVERY_JSONL_VERSION = 1;
4146
+ interface OpenJsonlBackgroundSessionDeliveryStoreOptions {
4147
+ readonly filePath: string;
4148
+ readonly compactThreshold?: number;
4149
+ }
4150
+ declare function openJsonlBackgroundSessionDeliveryStore(options: OpenJsonlBackgroundSessionDeliveryStoreOptions): Promise<BackgroundSessionDeliveryStore>;
4151
+ //#endregion
4152
+ //#region src/adapters/compatibility/background-session/persistence.d.ts
4153
+ interface CreateBackgroundSessionRepositoryOptions {
4154
+ readonly initial?: ReadonlyArray<BackgroundSessionState>;
4155
+ readonly persist?: (state: BackgroundSessionState) => Promise<void>;
4156
+ }
4157
+ declare function createBackgroundSessionRepository(options?: CreateBackgroundSessionRepositoryOptions): BackgroundSessionRepository;
4158
+ declare function openJsonlBackgroundSessionRepository(options: OpenJsonlBackgroundSessionRepositoryOptions): Promise<BackgroundSessionRepository>;
4159
+ //#endregion
4160
+ //#region src/adapters/compatibility/background-session/runtime.d.ts
4161
+ interface BackgroundSessionSupervisorOptions extends Pick<BackgroundSessionSupervisorOptions$1, "clock" | "config" | "deliver" | "deliveries" | "onError" | "sleep"> {
4162
+ readonly repository: BackgroundSessionRepository;
4163
+ readonly runStep: (input: {
4164
+ readonly session: BackgroundSessionState;
4165
+ readonly signal: AbortSignal;
4166
+ readonly wakeText: string;
4167
+ }) => Promise<{
4168
+ readonly finalText: string;
4169
+ readonly runId: string;
4170
+ }>;
4171
+ }
4172
+ declare function createBackgroundSessionSupervisor(options: BackgroundSessionSupervisorOptions): BackgroundSessionSupervisor;
4173
+ //#endregion
4174
+ //#region src/adapters/compatibility/background-session/authority.d.ts
4175
+ declare function extendBackgroundSessionDefinition<T extends BackgroundSessionAgentDefinition>(definition: T): TransformedBackgroundSessionDefinition<T>;
4176
+ declare function narrowBackgroundSessionDefinition<T extends BackgroundSessionAgentDefinition>(definition: T): TransformedBackgroundSessionDefinition<T>;
4177
+ //#endregion
4178
+ //#region src/core/application/background-session/supervision/background-session-config.d.ts
4179
+ declare const DEFAULT_BACKGROUND_SESSION_STEP_TIMEOUT_MS: number;
4180
+ declare const DEFAULT_BACKGROUND_SESSION_MAX_CONCURRENT_SESSIONS = 4;
4181
+ declare const DEFAULT_BACKGROUND_SESSION_LEASE_MS = 30000;
4182
+ declare const DEFAULT_BACKGROUND_SESSION_LEASE_RENEWAL_INTERVAL_MS = 10000;
4183
+ declare const DEFAULT_BACKGROUND_SESSION_MAX_CONSECUTIVE_FAILURES = 3;
4184
+ declare const DEFAULT_BACKGROUND_SESSION_RETRY_BACKOFF_MS = 30000;
4185
+ declare const DEFAULT_BACKGROUND_SESSION_LIFETIME_MS: number;
4186
+ declare const DEFAULT_BACKGROUND_SESSION_SUPERVISOR_INTERVAL_MS = 1000;
4187
+ declare function resolveBackgroundSessionSupervisorIntervalMs(leaseMs: number): number;
4188
+ //#endregion
4189
+ //#region src/adapters/feishu/background-session/background-session-delivery.d.ts
4190
+ type FeishuBackgroundSessionDeliveryKind = "progress" | "final" | "stopped" | "failed" | "reconciliation";
4191
+ interface FeishuBackgroundSessionDeliveryInput {
4192
+ readonly chatId: string;
4193
+ readonly deliveryId: string;
4194
+ readonly displayName: string;
4195
+ readonly kind: FeishuBackgroundSessionDeliveryKind;
4196
+ readonly sessionId: string;
4197
+ readonly text: string;
4198
+ }
4199
+ interface FeishuBackgroundSessionDelivery {
4200
+ deliver(input: FeishuBackgroundSessionDeliveryInput): Promise<{
4201
+ readonly providerMessageId: string;
4202
+ }>;
4203
+ }
4204
+ /**
4205
+ * Background sessions keep the transport-authenticated Feishu conversation id
4206
+ * (`feishu:<tenant>:<chat>:<thread>`) as their stable origin. Feishu's send
4207
+ * API, however, accepts only the raw chat id. Keep the translation at the
4208
+ * Feishu adapter boundary and retain support for older sessions that stored a
4209
+ * raw chat id directly.
4210
+ */
4211
+ declare function resolveFeishuDeliveryChatId(conversationId: string): string;
4212
+ declare function createConfiguredFeishuBackgroundSessionDelivery(options: {
4213
+ readonly client: FeishuOpenApiClient;
4214
+ readonly config: RivusDaemonConfig;
4215
+ }): FeishuBackgroundSessionDelivery;
4216
+ declare function createBackgroundSessionCard(input: {
4217
+ readonly displayName: string;
4218
+ readonly kind: FeishuBackgroundSessionDeliveryKind;
4219
+ readonly sessionId: string;
4220
+ readonly text: string;
4221
+ }): FeishuRawCardJson;
4222
+ //#endregion
4223
+ //#region src/core/application/deployment/manifest/deployment-manifest.d.ts
4224
+ declare class InvalidRivusProjectSpace extends Error {
4225
+ readonly name = "InvalidRivusProjectSpace";
4226
+ }
4227
+ declare function validateRivusDeploymentManifest(manifest: RivusDeploymentManifest): void;
4228
+ //#endregion
4229
+ //#region src/adapters/deployment/project-space/node-project-space-resolver.d.ts
4230
+ declare function resolveRivusProjectSpace(input: {
4231
+ readonly declaration: RivusProjectSpaceDeployment;
4232
+ readonly deploymentRoot: string;
4233
+ }): Promise<ResolvedRivusProjectSpace>;
4234
+ //#endregion
4235
+ //#region src/adapters/compatibility/memory/service/jsonl-agent-memory-service.d.ts
4236
+ declare function openJsonlAgentMemoryService(options: {
4237
+ readonly filePath: string;
4238
+ }): Promise<AgentMemoryService>;
4239
+ //#endregion
4240
+ //#region src/adapters/compatibility/automation/automation-mandate-store.d.ts
4241
+ declare function createAutomationMandateStore(): AutomationMandateStore;
4242
+ //#endregion
4243
+ //#region src/adapters/compatibility/automation/automation-tick-record.d.ts
4244
+ type AutomationTickStatus = "running" | "failed" | "generated" | "suppressed" | "delivered";
4245
+ interface AutomationTickRecord {
4246
+ readonly automationId: string;
4247
+ readonly body?: string;
4248
+ readonly error?: string;
4249
+ readonly occurrence: string;
4250
+ readonly mandateId: string;
4251
+ readonly providerMessageId?: string;
4252
+ readonly presentation?: AutomationPresentation;
4253
+ readonly revision: number;
4254
+ readonly runId?: string;
4255
+ readonly suppressionReason?: string;
4256
+ readonly status: AutomationTickStatus;
4257
+ readonly tickId: string;
4258
+ }
4259
+ //#endregion
4260
+ //#region src/adapters/compatibility/automation/scheduled-automation.d.ts
4261
+ interface ScheduledAutomationClock {
4262
+ now(): Date;
4263
+ sleep(milliseconds: number, signal: AbortSignal): Promise<void>;
4264
+ }
4265
+ interface ScheduledAutomationOptions {
4266
+ readonly automationId: string;
4267
+ readonly binding: AutomationBinding;
4268
+ readonly clock?: ScheduledAutomationClock;
4269
+ readonly createInput: (tick: {
4270
+ readonly occurrence: string;
4271
+ }) => {
4272
+ readonly text: string;
4273
+ };
4274
+ readonly deliver: (input: ScheduledAutomationDeliveryInput) => Promise<{
4275
+ readonly providerMessageId: string;
4276
+ }>;
4277
+ readonly repository: AutomationTickRepositoryCompatibility;
4278
+ readonly onError?: (error: unknown) => Promise<void> | void;
4279
+ readonly retryDelayMs?: number;
4280
+ readonly run: (input: ScheduledAutomationRunInput) => Promise<ScheduledAutomationRunResult>;
4281
+ }
4282
+ interface AutomationTickRepositoryCompatibility {
4283
+ get(automationId: string, occurrence: string): Promise<AutomationTickRecord | undefined>;
4284
+ put(record: AutomationTickRecord): Promise<AutomationTickRecord>;
4285
+ }
4286
+ interface ScheduledAutomation {
4287
+ running(): boolean;
4288
+ runDue(at: Date): Promise<AutomationTickRecord | undefined>;
4289
+ start(): Promise<void>;
4290
+ stop(): Promise<void>;
4291
+ }
4292
+ declare function createScheduledAutomation(options: ScheduledAutomationOptions): ScheduledAutomation;
4293
+ //#endregion
4294
+ //#region src/core/application/automation/policy/daily-automation-schedule.d.ts
4295
+ interface DailyAutomationSchedule {
4296
+ currentOccurrence(now: Date): string | undefined;
4297
+ nextOccurrence(now: Date): Date;
4298
+ }
4299
+ declare function createDailyAutomationSchedule(expression: string, timeZone: string, now?: Date): DailyAutomationSchedule;
4300
+ //#endregion
4301
+ //#region src/adapters/compatibility/automation/json-automation-tick-repository.d.ts
4302
+ interface OpenJsonAutomationTickRepositoryOptions {
4303
+ readonly filePath: string;
4304
+ }
4305
+ declare function openJsonAutomationTickRepository(options: OpenJsonAutomationTickRepositoryOptions): Promise<AutomationTickRepositoryCompatibility>;
4306
+ //#endregion
4307
+ //#region src/adapters/compatibility/automation/outcome/plugin-state-store.d.ts
4308
+ interface PluginStateStore {
4309
+ get(pluginId: string, agentId: string, key: string): PluginStateRecord | undefined;
4310
+ put(input: PutPluginState): PluginStateRecord;
4311
+ }
4312
+ declare class PluginStateConflict extends Error {
4313
+ readonly name = "PluginStateConflict";
4314
+ }
4315
+ declare function createPluginStateStore(): PluginStateStore;
4316
+ //#endregion
4317
+ //#region src/adapters/compatibility/automation/outcome/delivery-outbox.d.ts
4318
+ interface DeliveryOutbox {
4319
+ enqueue(job: Omit<DeliveryJob, "status">): DeliveryJob;
4320
+ recordAttempt(id: string, result: DeliveryAttemptResult): DeliveryJob;
4321
+ snapshot(): ReadonlyArray<DeliveryJob>;
4322
+ }
4323
+ declare class DeliveryOutboxError extends Error {
4324
+ readonly name = "DeliveryOutboxError";
4325
+ }
4326
+ declare function createDeliveryOutbox(): DeliveryOutbox;
4327
+ //#endregion
4328
+ //#region src/core/application/delegation/contracts/delegation.d.ts
4329
+ interface DelegationEdge {
4330
+ readonly fromAgentId: string;
4331
+ readonly toAgentId: string;
4332
+ readonly toolIds: ReadonlyArray<string>;
4333
+ readonly maxHops: number;
4334
+ readonly maxBudget: number;
4335
+ }
4336
+ interface DelegationRequest {
4337
+ readonly callerAuthority: InvocationAuthorityRef;
4338
+ readonly targetAgentId: string;
4339
+ readonly targetInstanceId: string;
4340
+ readonly targetToolGrantSet: RivusToolGrantSet;
4341
+ readonly requestedToolIds: ReadonlyArray<string>;
4342
+ readonly hopCount: number;
4343
+ readonly budget: number;
4344
+ }
4345
+ interface DelegationGrant {
4346
+ readonly id: string;
4347
+ readonly request: DelegationRequest;
4348
+ readonly toolGrantSet: RivusToolGrantSet;
4349
+ readonly authority: InvocationAuthorityRef;
4350
+ }
4351
+ //#endregion
4352
+ //#region src/core/application/delegation/grant/delegation-service.d.ts
4353
+ declare class DelegationDenied extends Error {
4354
+ readonly name = "DelegationDenied";
4355
+ }
4356
+ //#endregion
4357
+ //#region src/adapters/compatibility/delegation/delegation-service.d.ts
4358
+ interface DelegationService {
4359
+ delegate(request: DelegationRequest): DelegationGrant;
4360
+ }
4361
+ declare function createDelegationService(options: {
4362
+ readonly edges: ReadonlyArray<DelegationEdge>;
4363
+ }): DelegationService;
4364
+ declare function intersectToolIds(sets: ReadonlyArray<ReadonlyArray<string>>): RivusToolGrantSet;
4365
+ //#endregion
4366
+ //#region src/core/application/delegation/contracts/subagent.d.ts
4367
+ interface SpawnSubagentRequest {
4368
+ readonly parentAuthority: InvocationAuthorityRef;
4369
+ readonly childAgentId: string;
4370
+ readonly childProfileToolIds: ReadonlyArray<string>;
4371
+ readonly childDeploymentToolIds: ReadonlyArray<string>;
4372
+ readonly requestedToolIds: ReadonlyArray<string>;
4373
+ }
4374
+ interface SubagentCapabilities {
4375
+ readonly senderIdentity: false;
4376
+ readonly privateMemory: false;
4377
+ readonly shell: false;
4378
+ }
4379
+ interface SubagentRecord {
4380
+ readonly id: string;
4381
+ readonly parentRunId: string;
4382
+ readonly childAgentId: string;
4383
+ readonly status: "active" | "cancelled";
4384
+ readonly toolGrantSet: RivusToolGrantSet;
4385
+ readonly authority: InvocationAuthorityRef;
4386
+ readonly capabilities: SubagentCapabilities;
4387
+ }
4388
+ //#endregion
4389
+ //#region src/adapters/compatibility/delegation/subagent-coordinator.d.ts
4390
+ interface SubagentCoordinator {
4391
+ spawn(request: SpawnSubagentRequest): SubagentRecord;
4392
+ cancelParent(parentRunId: string): void;
4393
+ get(id: string): SubagentRecord | undefined;
4394
+ }
4395
+ declare function createSubagentCoordinator(): SubagentCoordinator;
4396
+ //#endregion
4397
+ //#region src/core/application/deployment/resolution/deployment-resolution.d.ts
4398
+ declare class RivusPluginLoadError extends Error {
4399
+ readonly pluginId: string;
4400
+ readonly moduleSpecifier: string;
4401
+ readonly name = "RivusPluginLoadError";
4402
+ constructor(pluginId: string, moduleSpecifier: string, message: string, options?: ErrorOptions);
4403
+ }
4404
+ //#endregion
4405
+ //#region src/adapters/compatibility/deployment-control/rivus-plugin-loader.d.ts
4406
+ type RivusPluginModule = RivusPlugin | {
4407
+ readonly default: RivusPlugin | (() => RivusPlugin | Promise<RivusPlugin>);
4408
+ };
4409
+ interface LoadRivusDeploymentOptions {
4410
+ readonly deploymentRoot: string;
4411
+ readonly manifest: RivusDeploymentManifest;
4412
+ readonly loadModule: (request: RivusPluginModuleLoadRequest) => Promise<RivusPluginModule> | RivusPluginModule;
4413
+ }
4414
+ declare function loadRivusDeployment(options: LoadRivusDeploymentOptions): Promise<LoadedRivusDeployment>;
4415
+ //#endregion
4416
+ //#region src/adapters/deployment/plugin/node-rivus-plugin-module-loader.d.ts
4417
+ interface NodeRivusPluginModuleLoaderOptions {
4418
+ readonly packageManifestPath?: string;
4419
+ }
4420
+ //#endregion
4421
+ //#region src/adapters/compatibility/deployment-control/node-rivus-plugin-module-loader.d.ts
4422
+ declare function loadNodeRivusPluginModule(request: RivusPluginModuleLoadRequest, options?: NodeRivusPluginModuleLoaderOptions): Promise<RivusPluginModule>;
4423
+ //#endregion
4424
+ //#region src/adapters/compatibility/deployment-control/rivus-deployment-daemon.d.ts
4425
+ interface RivusDeploymentEndpoint {
4426
+ running(): boolean;
4427
+ start(): Promise<void> | void;
4428
+ stop(): Promise<void> | void;
4429
+ }
4430
+ interface RivusDeploymentAutomation {
4431
+ running(): boolean;
4432
+ start(): Promise<void> | void;
4433
+ stop(): Promise<void> | void;
4434
+ }
4435
+ interface RivusDeploymentBackgroundSession {
4436
+ running(): boolean;
4437
+ start(): Promise<void> | void;
4438
+ status?(): BackgroundSessionSupervisorStatus;
4439
+ stop(): Promise<void> | void;
4440
+ }
4441
+ interface CreateRivusDeploymentAutomationInput {
4442
+ readonly automationId: string;
4443
+ readonly definition: ResolvedRivusAutomationDefinition;
4444
+ readonly deliveryEndpoint: RivusEndpointDeployment;
4445
+ readonly instanceId: string;
4446
+ readonly run: (input: ScheduledAutomationRunInput) => Promise<unknown>;
4447
+ }
4448
+ interface CreateRivusDeploymentEndpointInput {
4449
+ readonly agentId: string;
4450
+ readonly cancel: (input: AgentRuntimeCancellation) => Promise<boolean>;
4451
+ readonly endpointId: string;
4452
+ readonly definition: RivusEndpointDeployment;
4453
+ readonly handle: (input: RivusEndpointInput) => Promise<unknown>;
4454
+ readonly steer?: (input: AgentRuntimeSteering) => Promise<boolean>;
4455
+ readonly instanceId: string;
4456
+ readonly projectSpaceId?: string;
4457
+ }
4458
+ interface CreateRivusDeploymentBackgroundSessionInput {
4459
+ readonly agentIds: ReadonlyArray<string>;
4460
+ readonly config: RivusBackgroundSessionsDeployment;
4461
+ readonly cancel: (input: {
4462
+ readonly agentId: string;
4463
+ readonly reason?: string;
4464
+ readonly runId: string;
4465
+ readonly sessionKey: SessionKey;
4466
+ }) => Promise<boolean>;
4467
+ readonly run: (input: {
4468
+ readonly agentId: string;
4469
+ readonly invocation: AgentInvocationOrigin;
4470
+ readonly onUpdate?: (update: AgentRunUpdate) => void | Promise<void>;
4471
+ readonly sessionKey: SessionKey;
4472
+ readonly text: string;
4473
+ }) => Promise<unknown>;
4474
+ }
4475
+ interface CreateRivusDeploymentRuntimeInput extends AgentInstanceRecord {
4476
+ readonly catalog: RivusPluginCatalog;
4477
+ readonly definition: ResolvedRivusAgentDefinition;
4478
+ readonly projectSpace?: ResolvedRivusProjectSpace;
4479
+ }
4480
+ interface CreateRivusDeploymentDaemonOptions {
4481
+ readonly deploymentRoot: string;
4482
+ readonly manifest: RivusDeploymentManifest;
4483
+ readonly loadModule: (request: RivusPluginModuleLoadRequest) => Promise<RivusPluginModule> | RivusPluginModule;
4484
+ readonly initialInstanceRecords?: AgentInstanceRegistryOptions["initialRecords"];
4485
+ readonly createRuntime: (input: CreateRivusDeploymentRuntimeInput) => PooledAgentRuntime | Promise<PooledAgentRuntime>;
4486
+ readonly createEndpoint: (input: CreateRivusDeploymentEndpointInput) => RivusDeploymentEndpoint | Promise<RivusDeploymentEndpoint>;
4487
+ readonly createAutomation?: (input: CreateRivusDeploymentAutomationInput) => RivusDeploymentAutomation | Promise<RivusDeploymentAutomation>;
4488
+ readonly createBackgroundSession?: (input: CreateRivusDeploymentBackgroundSessionInput) => RivusDeploymentBackgroundSession | Promise<RivusDeploymentBackgroundSession>;
4489
+ readonly resolveProjectSpace?: (input: {
4490
+ readonly declaration: RivusProjectSpaceDeployment;
4491
+ readonly deploymentRoot: string;
4492
+ }) => Promise<ResolvedRivusProjectSpace> | ResolvedRivusProjectSpace;
4493
+ }
4494
+ interface RivusEndpointInput extends AgentRuntimeInput {}
4495
+ interface RivusDeploymentDaemon {
4496
+ readonly deployment: LoadedRivusDeployment;
4497
+ handleDefault(input: RivusEndpointInput): Promise<unknown>;
4498
+ handleEndpoint(endpointId: string, input: RivusEndpointInput): Promise<unknown>;
4499
+ runDefaultAgent(input: RivusEndpointInput): Promise<unknown>;
4500
+ running(): boolean;
4501
+ start(): Promise<void>;
4502
+ status(): RivusDeploymentDaemonStatus;
4503
+ stop(): Promise<void>;
4504
+ }
4505
+ //#endregion
4506
+ //#region src/bootstrap/deployment/rivus-deployment-daemon.d.ts
4507
+ declare function createRivusDeploymentDaemon(options: CreateRivusDeploymentDaemonOptions): Promise<RivusDeploymentDaemon>;
4508
+ //#endregion
4509
+ //#region src/adapters/deployment/manifest/node-rivus-deployment-manifest.d.ts
4510
+ interface LoadRivusDeploymentManifestOptions {
4511
+ readonly maxBytes?: number;
4512
+ }
4513
+ declare class RivusDeploymentManifestError extends Error {
4514
+ readonly manifestPath: string;
4515
+ readonly name = "RivusDeploymentManifestError";
4516
+ constructor(manifestPath: string, message: string, options?: ErrorOptions);
4517
+ }
4518
+ //#endregion
4519
+ //#region src/adapters/compatibility/deployment-control/rivus-deployment-manifest.d.ts
4520
+ declare function loadRivusDeploymentManifest(manifestPath: string, options?: LoadRivusDeploymentManifestOptions): Promise<RivusDeploymentManifest>;
4521
+ //#endregion
4522
+ //#region src/bootstrap/deployment/configured-rivus-deployment-daemon.d.ts
4523
+ type CreateConfiguredRivusDeploymentDaemonOptions = Omit<CreateRivusDeploymentDaemonOptions, "deploymentRoot" | "loadModule" | "manifest"> & {
4524
+ readonly manifestPath: string;
4525
+ readonly manifestOptions?: LoadRivusDeploymentManifestOptions;
4526
+ readonly pluginPackageManifestPath?: string;
4527
+ };
4528
+ declare function createConfiguredRivusDeploymentDaemon(options: CreateConfiguredRivusDeploymentDaemonOptions): Promise<RivusDeploymentDaemon>;
4529
+ //#endregion
4530
+ //#region src/adapters/compatibility/human-interaction/snapshot.d.ts
4531
+ interface ApprovedHumanInteractionState extends ApprovedHumanInteractionState$1 {}
4532
+ interface CancelledHumanInteractionState extends CancelledHumanInteractionState$1 {}
4533
+ interface ExpiredHumanInteractionState extends ExpiredHumanInteractionState$1 {}
4534
+ interface HumanInteractionActor extends HumanInteractionActor$1 {}
4535
+ interface HumanInteractionBase extends HumanInteractionBase$1 {}
4536
+ interface HumanInteractionFact extends HumanInteractionFact$1 {}
4537
+ type HumanInteractionId = HumanInteractionId$1;
4538
+ type HumanInteractionResolutionAction = HumanInteractionResolutionAction$1;
4539
+ type HumanInteractionTransition = HumanInteractionTransition$1;
4540
+ interface PendingHumanInteractionState extends PendingHumanInteractionState$1 {}
4541
+ interface RejectedHumanInteractionState extends RejectedHumanInteractionState$1 {}
4542
+ interface RequestToolApprovalInput extends RequestToolApprovalInput$1 {}
4543
+ interface RequestUserDecisionInput extends RequestUserDecisionInput$1 {}
4544
+ interface SelectedHumanInteractionState extends SelectedHumanInteractionState$1 {}
4545
+ interface ToolApprovalBinding extends ToolApprovalBinding$1 {}
4546
+ type ToolApprovalInteractionState = ToolApprovalInteractionState$1;
4547
+ type UserDecisionInteractionState = UserDecisionInteractionState$1;
4548
+ interface UserDecisionOption extends UserDecisionOption$1 {}
4549
+ type HumanInteraction = ToolApprovalInteraction | UserDecisionInteraction;
4550
+ interface ToolApprovalInteraction extends ToolApprovalInteraction$2 {}
4551
+ interface UserDecisionInteraction extends UserDecisionInteraction$2 {}
4552
+ //#endregion
4553
+ //#region src/adapters/compatibility/human-interaction/transitions.d.ts
4554
+ declare class HumanInteractionTransitionDenied extends Error {
4555
+ readonly name = "HumanInteractionTransitionDenied";
4556
+ }
4557
+ declare function transitionHumanInteraction(interaction: HumanInteraction, transition: HumanInteractionTransition): HumanInteraction;
4558
+ //#endregion
4559
+ //#region src/adapters/compatibility/human-interaction/presenter.d.ts
4560
+ interface HumanInteractionPresenter extends HumanInteractionPresenterContract<HumanInteraction> {}
4561
+ //#endregion
4562
+ //#region src/adapters/compatibility/human-interaction/repository.d.ts
4563
+ interface HumanInteractionRepository extends HumanInteractionRepositoryContract<HumanInteraction> {}
4564
+ //#endregion
4565
+ //#region src/adapters/compatibility/human-interaction/service.d.ts
4566
+ interface HumanInteractionClock extends HumanInteractionClock$1 {}
4567
+ interface ResolveHumanInteractionInput extends ResolveHumanInteractionInput$1 {}
4568
+ interface ConsumeToolApprovalInput extends ConsumeToolApprovalInput$1 {}
4569
+ interface HumanInteractionService extends HumanInteractionServiceContract<HumanInteraction, ToolApprovalInteraction, UserDecisionInteraction, RequestToolApprovalInput, RequestUserDecisionInput, ResolveHumanInteractionInput, ConsumeToolApprovalInput> {}
4570
+ interface HumanInteractionServiceOptions extends HumanInteractionServiceOptionsContract<HumanInteractionClock, HumanInteractionPresenter, HumanInteractionRepository> {}
4571
+ declare function createHumanInteractionService(options: HumanInteractionServiceOptions): HumanInteractionService;
4572
+ //#endregion
4573
+ //#region src/adapters/compatibility/human-interaction/endpoint-registry.d.ts
4574
+ interface HumanInteractionEndpointRegistry {
4575
+ register(endpointId: string, service: HumanInteractionService): void;
4576
+ resolve(endpointId: string): HumanInteractionService | undefined;
4577
+ services(): ReadonlyArray<HumanInteractionService>;
4578
+ }
4579
+ declare function createHumanInteractionEndpointRegistry(): HumanInteractionEndpointRegistry;
4580
+ //#endregion
4581
+ //#region src/adapters/compatibility/human-interaction/tool-approval-gateway.d.ts
4582
+ declare function createHumanInteractionToolApprovalGateway(options: {
4583
+ readonly clock?: {
4584
+ readonly now: () => string;
4585
+ };
4586
+ readonly expiresAfterMs?: number;
4587
+ readonly registry: HumanInteractionEndpointRegistry;
4588
+ }): PiToolApprovalGateway;
4589
+ //#endregion
4590
+ //#region src/adapters/compatibility/human-interaction/model-change-approval.d.ts
4591
+ /** Route accepted model requests through the existing durable human decision service. */
4592
+ declare function createHumanInteractionModelChangeApproval(options: {
4593
+ readonly endpointId: string;
4594
+ readonly registry: HumanInteractionEndpointRegistry;
4595
+ }): ModelChangeApprovalPort;
4596
+ //#endregion
4597
+ //#region src/adapters/compatibility/human-interaction/routed-tool-approval-service.d.ts
4598
+ declare function createRoutedHumanInteractionToolApprovalService(registry: HumanInteractionEndpointRegistry): ToolApprovalService;
4599
+ //#endregion
4600
+ //#region src/adapters/feishu/delivery/feishu-text-reply.d.ts
4601
+ interface FeishuTextReplySender {
4602
+ reply(messageId: string, text: string): Effect.Effect<void, unknown>;
4603
+ }
4604
+ declare function createConfiguredFeishuTextReplySender(options: {
4605
+ readonly client: FeishuOpenApiClient;
4606
+ readonly config: RivusDaemonConfig;
4607
+ }): FeishuTextReplySender;
4608
+ //#endregion
4609
+ //#region src/adapters/feishu/delivery/feishu-message-reaction.d.ts
4610
+ interface FeishuMessageReactionSender {
4611
+ add(messageId: string, emojiType?: string): Effect.Effect<void, unknown>;
4612
+ }
4613
+ declare function createConfiguredFeishuMessageReactionSender(options: {
4614
+ readonly client: FeishuOpenApiClient;
4615
+ readonly config: RivusDaemonConfig;
4616
+ }): FeishuMessageReactionSender;
4617
+ //#endregion
4618
+ //#region src/adapters/feishu/automation/automation-card-sender.d.ts
4619
+ interface FeishuAutomationCardInput {
4620
+ readonly idempotencyKey: string;
4621
+ readonly markdown: string;
4622
+ readonly presentation?: AutomationPresentation;
4623
+ readonly receiveId: string;
4624
+ readonly receiveIdType: RivusAutomationDeliveryTargetType;
4625
+ }
4626
+ interface FeishuAutomationCardSender {
4627
+ send(input: FeishuAutomationCardInput): Effect.Effect<{
4628
+ readonly providerMessageId: string;
4629
+ }, unknown>;
4630
+ }
4631
+ declare function createConfiguredFeishuAutomationCardSender(options: {
4632
+ readonly client: FeishuOpenApiClient;
4633
+ readonly config: RivusDaemonConfig;
4634
+ }): FeishuAutomationCardSender;
4635
+ //#endregion
4636
+ //#region src/adapters/outbound/persistence/human-interaction/jsonl-human-interaction-repository.d.ts
4637
+ interface JsonlHumanInteractionRepositoryOptions {
4638
+ readonly filePath: string;
4639
+ }
4640
+ //#endregion
4641
+ //#region src/adapters/compatibility/human-interaction/persistence.d.ts
4642
+ declare function createInMemoryHumanInteractionRepository(): HumanInteractionRepository;
4643
+ declare function createJsonlHumanInteractionRepository(options: JsonlHumanInteractionRepositoryOptions): HumanInteractionRepository;
4644
+ //#endregion
4645
+ //#region src/adapters/compatibility/human-interaction/feishu.d.ts
4646
+ declare function createFeishuHumanInteractionCard(interaction: HumanInteraction): FeishuRawCardJson;
4647
+ interface FeishuHumanInteractionPresenterOptions {
4648
+ readonly baseUrl?: string;
4649
+ readonly client: FeishuOpenApiClient;
4650
+ }
4651
+ declare function createFeishuHumanInteractionPresenter(options: FeishuHumanInteractionPresenterOptions): HumanInteractionPresenter;
4652
+ interface ConfiguredFeishuHumanInteractionPresenterOptions {
4653
+ readonly client: FeishuOpenApiClient;
4654
+ readonly config: RivusDaemonConfig;
4655
+ }
4656
+ declare function createConfiguredFeishuHumanInteractionPresenter(options: ConfiguredFeishuHumanInteractionPresenterOptions): HumanInteractionPresenter;
4657
+ //#endregion
4658
+ //#region src/adapters/feishu/run-presentation/feishu-agent-run-card.d.ts
4659
+ declare const FEISHU_AGENT_CARD_ELEMENT_ID = "rivus_agent_answer";
4660
+ declare const FEISHU_AGENT_CARD_PROGRESS_ELEMENT_ID = "rivus_agent_progress";
4661
+ type FeishuAgentRunCardInput = {
4662
+ readonly agentName: string;
4663
+ readonly elementId?: string;
4664
+ readonly generation?: number;
4665
+ readonly runId: string;
4666
+ readonly sessionKey: string;
4667
+ readonly status: "running"; /** Disable only when a deployment has not subscribed to the modern card.action.trigger callback. */
4668
+ readonly cancelButton?: boolean;
4669
+ readonly presentation?: RunPresentation;
4670
+ readonly progressDisplay?: ConversationProgressDisplay;
4671
+ readonly text?: string;
4672
+ } | {
4673
+ readonly agentName: string;
4674
+ readonly presentation?: RunPresentation;
4675
+ readonly progressDisplay?: ConversationProgressDisplay;
4676
+ readonly status: "completed";
4677
+ readonly text: string;
4678
+ } | {
4679
+ readonly agentName: string;
4680
+ readonly presentation?: RunPresentation;
4681
+ readonly progressDisplay?: ConversationProgressDisplay;
4682
+ readonly reason?: string;
4683
+ readonly status: "cancelled";
4684
+ readonly text?: string;
4685
+ } | {
4686
+ readonly agentName: string;
4687
+ readonly presentation?: RunPresentation;
4688
+ readonly progressDisplay?: ConversationProgressDisplay;
4689
+ readonly status: "failed";
4690
+ };
4691
+ declare function createFeishuAgentRunCard(input: FeishuAgentRunCardInput): FeishuRawCardJson;
4692
+ //#endregion
4693
+ //#region src/adapters/compatibility/automation/outcome/commit-automation-outcome.d.ts
4694
+ interface CommitAutomationOutcomeInput {
4695
+ readonly tickId: string;
4696
+ readonly outcome: AutomationOutcome;
4697
+ readonly state: PluginStateStore;
4698
+ readonly stateUpdate: PutPluginState;
4699
+ readonly outbox: DeliveryOutbox;
4700
+ }
4701
+ declare function commitAutomationOutcome(input: CommitAutomationOutcomeInput): CommittedAutomationOutcome;
4702
+ //#endregion
4703
+ export { ToolApprovalInteraction as $, createFeishuMessageQueue as $a, describeFeishuMessageIntake as $c, RivusEndpointInput$1 as $d, ScheduledAutomationDeliveryInput as $f, createFeishuAgentRuntime as $i, RivusDaemonConfig as $l, MemorySearchQuery as $n, RivusDaemonBootstrapModule as $o, PresentedValue as $p, createRunPresentationProjector as $r, RivusProjectSpaceDeployment as $s, openJsonlAgentMemoryService as $t, ModelChangePublicReceipt as $u, HumanInteractionServiceOptions as A, FeishuCardPresentationStore as Aa, FeishuAgentRunPreparation as Ac, RivusPluginCatalogSnapshot as Ad, AgentHostRuntime as Af, JsonFileFeishuCardTargetRegistryOptions as Ai, InitializeRivusProjectOptions as Al, BackgroundSessionRepository as An, FeishuInboxDeliveryState as Ao, GatewayPresentationPort as Ap, createRateLimitedFeishuPublisher as Ar, RivusDeploymentDaemonLifecycleError as As, intersectToolIds as At, ModelChangeAuthorizationRejected as Au, HumanInteraction as B, FeishuWorkerLoop as Ba, createAgentCommandFromFeishuCardAction as Bc, RivusAutomationTickContext as Bd, commitAutomationOutcome$1 as Bf, FeishuCardKitTextUpdate as Bi, openPiModelManagementDeployment as Bl, isBackgroundSessionLeaseExpired as Bn, FeishuCardDeliveryReconciler as Bo, GatewaySteerAction as Bp, FeishuCotPublisher as Br, ResolvedRivusAutomationDefinition as Bs, createPluginStateStore as Bt, ModelChangeCoordinatorOptions as Bu, createHumanInteractionModelChangeApproval as C, FeishuCardRolloverEventType as Ca, FeishuAgentMessageSideEffects as Cc, createCompatibleRivusAgentCatalog as Cd, createEffectAgentInstanceRegistry as Cf, FeishuCardRolloverSupervisor as Ci, RivusDaemonWorkerLoop as Cl, openJsonlBackgroundSessionRepository as Cn, JsonlFeishuInboxRepositoryOptions as Co, GatewayActionResult as Cp, ConfiguredFeishuCardKitPublisherOptions as Cr, RivusDeploymentBackgroundSessionStatus as Cs, RivusPluginLoadError as Ct, ApprovedModelChangeAuthorization as Cu, ConsumeToolApprovalInput as D, createFeishuCardRollover as Da, FeishuPromptContextInput as Dc, RivusAgentCatalog as Dd, RivusAgentGrantRestriction as Df, FeishuCardTargetRegistry as Di, RivusProjectDoctorReport as Dl, BACKGROUND_SESSION_JSONL_VERSION as Dn, FeishuInboxCompletedState as Do, GatewayExecutionPort as Dp, createCoalescingFeishuPublisher as Dr, RivusDeploymentEndpointStatus as Ds, SubagentRecord as Dt, ModelChangeAuthorizationDecision as Du, createHumanInteractionEndpointRegistry as E, FeishuCardRolloverStatus as Ea, createFeishuAgentDaemon as Ec, resolveRivusAgentDefinition as Ed, RivusAgentDeployment as Ef, FeishuCardTargetNotFound as Ei, RivusProjectDoctorCheck as El, createBackgroundSessionDeliveryStore as En, createRecoveryControl as Eo, GatewayExecuteOptions as Ep, FeishuCoalescingPublisherOptions as Er, RivusDeploymentEndpointLifecycle as Es, SpawnSubagentRequest as Et, ModelBinding$1 as Eu, HumanInteractionTransitionDenied as F, acceptsCardPresentationProgress as Fa, FeishuCardActionIntakeError as Fc, RivusCatalogToolDescriptorRequest as Fd, AgentRuntimeSteering$1 as Ff, FeishuCardKitFail as Fi, PiManagedRunGatewayProviderOptions as Fl, completeBackgroundSessionStep as Fn, createFeishuInboxRepository as Fo, GatewayResetAction as Fp, FeishuCardTargetPreparationOptions as Fr, backgroundSessionToolIds as Fs, DeliveryOutbox as Ft, ModelChangeBudgetLimits as Fu, HumanInteractionResolutionAction as G, FeishuMessageWorkerQueue as Ga, FeishuMessageIntakeError as Gc, CreateBackgroundSessionHostToolsOptions as Gd, DeliveryAttemptResult as Gf, FeishuWebSocketDaemon as Gi, PiModelRunContextRegistry as Gl, requestBackgroundSessionStop as Gn, ConversationProgressDisplay as Go, PresentationStepStatus as Gp, InvalidFeishuTopicContext as Gr, RivusAutomationDelivery as Gs, AutomationTickRepositoryCompatibility as Gt, ModelChangeNotFound as Gu, HumanInteractionBase as H, createFeishuWorkerLoop as Ha, FeishuCancelMessageIntakeSummary as Hc, RIVUS_PLUGIN_API_VERSION as Hd, AutomationOutcome as Hf, createFeishuCardKitPublisher as Hi, PiModelManagementBashSpawnHookOptions as Hl, parkBackgroundSessionForReconciliation as Hn, FeishuCardDeliveryRecord as Ho, AssistantPresentationStep as Hp, FeishuCotRunPreparation as Hr, RivusAgentDeploymentStatus as Hs, openJsonAutomationTickRepository as Ht, ModelChangeExecutionBudget as Hu, transitionHumanInteraction as I, activeCardPresentation as Ia, FeishuCardActionTriggerPayload as Ic, RegisteredRivusAutomation as Id, AgentInstanceBinding as If, FeishuCardKitFinish as Ii, createPiManagedRunGatewayProvider as Il, completeBackgroundSessionStop as In, JsonlFeishuCardDeliveryLedgerOptions as Io, GatewayResetResult as Ip, createConfiguredFeishuCardKitTargetCreator as Ir, createBackgroundSessionToolContracts as Is, DeliveryOutboxError as It, ModelChangeBudgetReservation as Iu, RejectedHumanInteractionState as J, shouldAcceptFeishuEndpointMessage as Ja, FeishuNewSessionCommand as Jc, RivusAgentHost as Jd, PluginStateRecord as Jf, FeishuWebSocketRuntime as Ji, RIVUS_MODEL_CHANGE_TOOL_ID as Jl, suspendBackgroundSession as Jn, runRivusNodeEntrypoint as Jo, RunPresentation as Jp, createFeishuCardKitOpenApiClient as Jr, RivusBackgroundSessionsDeployment as Js, ScheduledAutomationOptions as Jt, ModelChangeOperation as Ju, HumanInteractionTransition as K, createFeishuMessageWorker as Ka, FeishuMessageIntakeOptions as Kc, createBackgroundSessionHostTools as Kd, DeliveryJob as Kf, FeishuWebSocketDaemonOptions as Ki, PiModelRunContextRegistryOptions as Kl, requeueInterruptedBackgroundSessionStep as Kn, DEFAULT_CONVERSATION_PROGRESS_DISPLAY as Ko, RUN_PRESENTATION_SCHEMA_VERSION as Kp, createFeishuTopicContextResolver as Kr, RivusAutomationDeliveryTargetType as Ks, ScheduledAutomation as Kt, ModelChangeNotification as Ku, ApprovedHumanInteractionState as L, isCardPresentationHandoffDue as La, FeishuResolveInteractionCommand as Lc, RivusAutomationInput as Ld, AgentInstanceRecord as Lf, FeishuCardKitPresentationUpdate as Li, PiModelManagementGrantOptions as Ll, createBackgroundSession as Ln, openJsonlFeishuCardDeliveryLedger as Lo, GatewayResolveInteractionAction as Lp, createFeishuCardKitOpenApiTargetCreator as Lr, isBackgroundSessionToolId as Ls, createDeliveryOutbox as Lt, ModelChangeBusy as Lu, createHumanInteractionService as M, CardPresentationChain as Ma, FeishuStreamProjector as Mc, RivusCatalogToolContribution as Md, AgentHostRuntimePort as Mf, createJsonFileFeishuCardTargetRegistry as Mi, initializeRivusProject as Ml, BackgroundSessionTransitionDenied as Mn, FeishuInboxPendingState as Mo, GatewayPromptAction as Mp, FeishuCardPresentationBinder as Mr, BACKGROUND_SESSION_TOOL_IDS as Ms, DelegationEdge as Mt, ModelChangeBoundaryPort as Mu, HumanInteractionRepository as N, CardPresentationStatus as Na, createFeishuStreamProjector as Nc, RivusCatalogToolContributionScope as Nd, AgentRuntimeCancellation$1 as Nf, FeishuCardKitCancel as Ni, RIVUS_RELEASE_DESCRIPTOR as Nl, appendBackgroundSessionInput as Nn, FeishuInboxRepository as No, GatewayPromptCommand as Np, FeishuCardTargetCreateOptions as Nr, BACKGROUND_SESSION_TOOL_PLUGIN_ID as Ns, DelegationGrant as Nt, ModelChangeBoundaryResult as Nu, HumanInteractionClock as O, DEFAULT_CARD_STREAM_LEASE_MS as Oa, FeishuPromptContextResolver as Oc, RivusPlugin as Od, RivusAgentProfile as Of, FeishuCardTargetRegistryOperation as Oi, RivusProjectDoctorStatus as Ol, isBackgroundSessionState as On, FeishuInboxDeadState as Oo, GatewayHumanInteractionPort as Op, FeishuStreamActionPublisher as Or, RivusDeploymentReadinessError as Os, DelegationService as Ot, ModelChangeAuthorizationInput as Ou, HumanInteractionPresenter as P, CardPresentationTransitionDenied as Pa, FeishuCardActionCommand as Pc, RivusCatalogToolDescriptorProvider as Pd, AgentRuntimeInput$1 as Pf, FeishuCardKitClient as Pi, RivusReleaseDescriptor as Pl, claimBackgroundSession as Pn, FeishuInboxRepositoryStateOptions as Po, GatewayReplyPort as Pp, FeishuCardTargetCreator as Pr, BACKGROUND_SESSION_TOOL_VERSION as Ps, DelegationRequest as Pt, ModelChangeBudget as Pu, ToolApprovalBinding as Q, FeishuMessageQueueOptions as Qa, createAgentCommandFromFeishuMessage as Qc, RivusEndpointDefinition as Qd, AutomationSchedulerOptions as Qf, FeishuAgentRuntimeOptions as Qi, createPiModelRunContextRegistry as Ql, AgentMemoryServiceOptions as Qn, RivusDaemonBootstrapFactory as Qo, hasInspectableRunProgress as Qp, RunPresentationProjector as Qr, RivusPluginDeclaration as Qs, createAutomationMandateStore as Qt, ModelChangePrincipal as Qu, CancelledHumanInteractionState as R, CompositeRivusDaemonTransportOptions as Ra, InvalidFeishuCardAction as Rc, RivusAutomationOutput as Rd, AgentRuntimeGenerationIdentity as Rf, FeishuCardKitPublisher as Ri, readPiModelManagementGrant as Rl, failBackgroundSessionStep as Rn, FeishuCardDeliveryLedger as Ro, GatewayRunResult as Rp, createFeishuCardTargetPreparation as Rr, ProcessDeploymentEndpoint as Rs, PluginStateConflict as Rt, ModelChangeClock$1 as Ru, createRoutedHumanInteractionToolApprovalService as S, FeishuCardRolloverEvent as Sa, FeishuAgentExecutionResult as Sc, CreateRivusAgentCatalogOptions as Sd, AgentInstanceRegistryOptions as Sf, createFeishuTenantAccessTokenProvider as Si, RivusDaemonTransport as Sl, createBackgroundSessionRepository as Sn, openJsonFeishuSessionStore as So, GatewayAction as Sp, createFeishuPeriodicFlush as Sr, RivusDeploymentBackgroundSessionReadinessError as Ss, loadRivusDeployment as St, ModelManagementTrustedRun as Su, HumanInteractionEndpointRegistry as T, FeishuCardRolloverOptions as Ta, FeishuHumanInteractionActions as Tc, createRivusPluginCatalog as Td, ResolvedRivusAgentDefinition as Tf, createFeishuCardRolloverSupervisor as Ti, DiagnoseRivusProjectOptions as Tl, openJsonlBackgroundSessionDeliveryStore as Tn, RecoveryControlOptions as To, GatewayCancelResult as Tp, FeishuCoalescingPublisher as Tr, RivusDeploymentDaemonStatus as Ts, createSubagentCoordinator as Tt, MODEL_STATE_SCHEMA_VERSION as Tu, HumanInteractionFact as U, FeishuMessageWorker as Ua, FeishuCancelRunCommand as Uc, RegisteredRivusPlugin as Ud, CommitAutomationOutcomeInput$1 as Uf, FeishuWebSocketClient as Ui, PiModelRunContext as Ul, releaseBackgroundSessionLease as Un, createFeishuCardDeliveryLedger as Uo, ModelPresentationStep as Up, createFeishuCotPublisher as Ur, RivusPluginLoadStatus as Us, DailyAutomationSchedule as Ut, ModelChangeFailureOutcome as Uu, HumanInteractionActor as V, FeishuWorkerLoopOptions as Va, FeishuAgentCommand as Vc, InvalidRivusPlugin as Vd, AutomationOutcomeRepository as Vf, FeishuCardTarget as Vi, PiModelContextReference as Vl, isBackgroundSessionTerminalPhase as Vn, FeishuCardDeliveryReconcilerOptions as Vo, GatewaySteeredResult as Vp, FeishuCotPublisherOptions as Vr, ResolvedRivusProjectSpace as Vs, OpenJsonAutomationTickRepositoryOptions as Vt, ModelChangeError as Vu, HumanInteractionId as W, FeishuMessageWorkerOptions as Wa, FeishuMessageIntakeBaseSummary as Wc, RivusPluginManifest as Wd, CommittedAutomationOutcome as Wf, FeishuWebSocketClientStartOptions as Wi, PiModelRunContextError as Wl, renewBackgroundSessionLease as Wn, createFeishuCardDeliveryReconciler as Wo, PresentationStep as Wp, FeishuTopicContextResolverOptions as Wr, RivusPluginModuleLoadRequest as Ws, createDailyAutomationSchedule as Wt, ModelChangeIdentityPort as Wu, RequestUserDecisionInput as X, FeishuMessagePreparedControl as Xa, FeishuPromptAgentCommand as Xc, RivusAutomationDefinition as Xd, AUTOMATION_SUPPRESSION_PREFIX as Xf, createLazyFeishuWebSocketEventDispatcher as Xi, RIVUS_MODEL_SOCKET_ENV as Xl, AgentMemoryHandle as Xn, runRivusCli as Xo, SkillPresentationStep as Xp, FeishuCardPresentationStoreOptions as Xr, RivusEndpointDeployment as Xs, AutomationTickRecord as Xt, ModelChangePending as Xu, RequestToolApprovalInput as Y, FeishuMessageDrainResult as Ya, FeishuNewSessionMessageIntakeSummary as Yc, RivusAgentHostOptions as Yd, PutPluginState as Yf, createFeishuWebSocketDaemon as Yi, RIVUS_MODEL_CONTEXT_ENV as Yl, AgentMemoryError as Yn, RivusCliOptions as Yo, RunPresentationPhase as Yp, FeishuCardPresentationNotFound as Yr, RivusDeploymentManifest as Ys, createScheduledAutomation as Yt, ModelChangePaidCallKind$1 as Yu, SelectedHumanInteractionState as Z, FeishuMessageQueue as Za, FeishuPromptMessageIntakeSummary as Zc, RivusBackgroundSessionDefinition as Zd, AutomationScheduler as Zf, FeishuAgentRuntime as Zi, createPiModelManagementBashSpawnHook as Zl, AgentMemoryService as Zn, RivusDaemonBootstrapContext as Zo, ToolPresentationStep as Zp, createFeishuCardPresentationStore as Zr, RivusEndpointExperimentalFeatures as Zs, AutomationTickStatus as Zt, ModelChangePhase as Zu, createConfiguredFeishuAutomationCardSender as _, RivusDaemonStatusReporter as _a, FeishuAgentDaemonRunResult as _c, ModelStateRepository as _d, InvalidAgentHostBinding as _f, FeishuTenantAccessTokenError as _i, RivusDaemonShutdownSignal as _l, resolveBackgroundSessionSupervisorIntervalMs as _n, SessionSchedulerDisposed as _o, AutomationMandateStore as _p, createToolBroker$1 as _r, ToolOperationResolutionResult as _s, RivusDeploymentDaemon as _t, ModelChangeApprovalInput as _u, FeishuAgentRunCardInput as a, FeishuReceiveMessageHandlerPayload as aa, FeishuReceiveHandledObservation as ac, ModelChangeRuntimePort$1 as ad, AgentRuntimeSteering as af, restoreConfiguredRivusDaemonBootstrap as ai, FeishuSessionResetResult as al, HumanInteractionRepository$1 as am, FeishuBackgroundSessionDeliveryKind as an, formatRivusEnvFile as ao, AutomationPresentationInput as ap, createAgentHarnessPooledRuntime as ar, runRivusDaemonCli as as, createConfiguredRivusDeploymentDaemon as at, loadRivusDaemonConfig as au, FeishuTextReplySender as b, FeishuCardRollover as ba, FeishuAgentDaemonSteeredResult as bc, validateRivusPluginManifest as bd, AgentInstanceIdentityFactory as bf, FeishuTenantAccessTokenRequest as bi, RivusDaemonProcess as bl, BackgroundSessionSupervisorOptions as bn, createSessionScheduler as bo, MessageGatewayOptions as bp, FeishuPeriodicFlush as br, RivusDeploymentAutomationStatus as bs, LoadRivusDeploymentOptions as bt, ModelChangeAuthorizationOptions as bu, FeishuHumanInteractionPresenterOptions as c, FeishuCardActionCallbackResponse as ca, FeishuReceiveMessageSummary as cc, ModelChangeStatus as cd, createAgentInstanceRegistry as cf, createConfiguredFeishuCardRolloverRuntime as ci, createFeishuSessionStore as cl, ConsumeToolApprovalInput$1 as cm, resolveFeishuDeliveryChatId as cn, resolveFeishuEndpointCredentials as co, AutomationPresentationSection as cp, openJsonlToolOperationLedger$1 as cr, RivusDeploymentBootstrapFactory as cs, RivusDeploymentManifestError as ct, createModelManagementControl as cu, createFeishuHumanInteractionPresenter as d, createFeishuCardActionErrorResponse as da, FeishuAgentDaemon as dc, ModelChangeTransportContext as dd, createAgentHostRuntimePool as df, FeishuOpenApiClient as di, InvalidFeishuSessionReference as dl, DEFAULT_BACKGROUND_SESSION_LIFETIME_MS as dn, JsonFetchRequestOptions as do, createAutomationPresentation as dp, ToolApprovalRequest$1 as dr, DeadLetterRecoveryItem as ds, CreateRivusDeploymentBackgroundSessionInput as dt, ModelChangeRunBoundaryOptions as du, FeishuPeriodicFlushSupervisor as ea, BackgroundSessionLimits as ec, ModelChangeReceipt as ed, createRivusAgentHost as ef, ConfiguredRivusDaemonBootstrap as ei, FeishuMessageContentInput as el, PresentedValueOptions as em, resolveRivusProjectSpace as en, OpenClawEnvImportError as eo, ScheduledAutomationRunInput as ep, createAgentMemoryService as er, RivusDaemonCliOptions as es, ToolApprovalInteractionState as et, RivusDaemonConfigError as eu, createInMemoryHumanInteractionRepository as f, FeishuRawCardJson as fa, FeishuAgentDaemonCancelResult as fc, ModelChangeValidationResult as fd, AgentAutomationBindingDefinition as ff, FeishuOpenApiError as fi, createFeishuConversationId as fl, DEFAULT_BACKGROUND_SESSION_MAX_CONCURRENT_SESSIONS as fn, JsonHttpRequest as fo, readAutomationPresentation as fp, ToolApprovalService as fr, DeadLetterRequeueResult as fs, CreateRivusDeploymentDaemonOptions as ft, ModelChangeRunLease as fu, FeishuAutomationCardSender as g, RivusDaemonStatus as ga, FeishuAgentDaemonOptions as gc, RejectedModelChangeAuthorization as gd, AgentHostOptions as gf, createFeishuOpenApiClient as gi, RivusDaemonShutdownControllerOptions as gl, DEFAULT_BACKGROUND_SESSION_SUPERVISOR_INTERVAL_MS as gn, SessionSchedulerCapacityExceeded as go, AutomationMandateError as gp, ToolInvocationDenied$1 as gr, ToolOperationRecoveryItem as gs, RivusDeploymentBackgroundSession as gt, ModelChangeApprovalAuthority as gu, FeishuAutomationCardInput as h, createRivusDaemonStatusHttpServer as ha, FeishuAgentDaemonInteractionResult as hc, ModelStateCorrupted as hd, AgentHost as hf, createConfiguredFeishuOpenApiClient as hi, RivusDaemonShutdownController as hl, DEFAULT_BACKGROUND_SESSION_STEP_TIMEOUT_MS as hn, SessionScheduler as ho, AutomationMandate as hp, ToolExecutionRequest$1 as hr, RecoverySnapshot as hs, RivusDeploymentAutomation as ht, createModelChangeAuthorization as hu, FEISHU_AGENT_CARD_PROGRESS_ELEMENT_ID as i, FeishuEventHandlersOptions as ia, FeishuReceiveAcceptedObservation as ic, ModelChangeRuntimeContext as id, AgentRuntimePoolOptions as if, createConfiguredRivusDaemonBootstrap as ii, FeishuSessionEpochRecord as il, createHumanInteractionService$1 as im, FeishuBackgroundSessionDeliveryInput as in, createRivusEnvFromOpenClawConfig as io, AutomationPresentation as ip, createFeishuDeploymentEndpoint as ir, RivusDaemonRecoveryRunner as is, CreateConfiguredRivusDeploymentDaemonOptions as it, RivusThinkingLevel as iu, ResolveHumanInteractionInput as j, CardPresentation as ja, FeishuStreamAction as jc, RivusPluginRegistry as jd, AgentHostRuntimeFactoryPort as jf, createInMemoryFeishuCardTargetRegistry as ji, InitializedRivusProject as jl, BackgroundSessionState as jn, FeishuInboxLeasedState as jo, GatewayPresentationUpdate as jp, FeishuCardKitOpenApiTargetCreatorOptions as jr, BACKGROUND_SESSION_START_TOOL_ID as js, DelegationDenied as jt, ModelChangeBoundaryInput as ju, HumanInteractionService as k, FeishuCardPresentationHandoffStart as ka, composeFeishuTopicPrompt as kc, RivusPluginCatalog as kd, RivusRuntimeToolGrantSet$1 as kf, FeishuCardTargetRegistryStoreError as ki, diagnoseRivusProject as kl, createBackgroundSessionService as kn, FeishuInboxDelivery as ko, GatewayObservationPort as kp, RateLimitedFeishuPublisherOptions as kr, RivusDeploymentComponentLifecycle as ks, createDelegationService as kt, ModelChangeAuthorizationPort as ku, createConfiguredFeishuHumanInteractionPresenter as l, FeishuCardActionToast as la, FeishuReceiveRuntimeStatus as lc, ModelChangeStatusView as ld, AgentInstanceBusy as lf, ConfiguredFeishuOpenApiRequest as li, FeishuConversationReference as ll, ResolveHumanInteractionInput$1 as lm, DEFAULT_BACKGROUND_SESSION_LEASE_MS as ln, FetchLike as lo, AutomationPresentationSource as lp, AuthorizationPolicyProvider as lr, RivusDeploymentCliProcess as ls, createRivusDeploymentDaemon as lt, ModelChangeBoundaryDeadlineError as lu, JsonlHumanInteractionRepositoryOptions as m, RivusDaemonStatusHttpServerOptions as ma, FeishuAgentDaemonHandleResult as mc, ModelState as md, AgentEndpointDefinition as mf, FeishuOpenApiResponse as mi, FeishuReceiveMessagePayload as ml, DEFAULT_BACKGROUND_SESSION_RETRY_BACKOFF_MS as mn, createJsonFetchRequest as mo, AutomationDeliveryBinding as mp, ToolBrokerOptions as mr, RecoveryControl as ms, CreateRivusDeploymentRuntimeInput as mt, createModelChangeCoordinator as mu, commitAutomationOutcome as n, FeishuEventHandlerQueue as na, BackgroundSessionSupervisorStatus as nc, ModelChangeRestoreResult as nd, AgentRuntimeInput as nf, ConfiguredRivusDaemonBootstrapRequest as ni, UnsupportedFeishuMessage as nl, HumanInteractionService$1 as nm, validateRivusDeploymentManifest as nn, OpenClawEnvImportResult as no, createAutomationScheduler as np, createFeishuPresentationPreparation as nr, RivusDaemonFeishuReplayRunner as ns, UserDecisionInteractionState as nt, RivusDaemonEnv as nu, createFeishuAgentRunCard as o, FeishuSdkReceiveMessagePayload as oa, FeishuReceiveMessageReplayOptions as oc, ModelChangeSource as od, PooledAgentRuntime as of, ConfiguredFeishuCardRolloverRuntime as oi, FeishuSessionStore as ol, HumanInteractionRepositoryError as om, createBackgroundSessionCard as on, FeishuEndpointCredentialError as oo, AutomationPresentationItem as op, JsonlRecoveryControlOptions as or, RivusDeploymentBootstrapAdapters as os, loadRivusDeploymentManifest as ot, ModelManagementControl as ou, createJsonlHumanInteractionRepository as p, RivusDaemonStatusHttpServer as pa, FeishuAgentDaemonHandleMessageOptions as pc, ModelReference$1 as pd, AgentBackgroundSessionBindingDefinition as pf, FeishuOpenApiRequest as pi, createFeishuSessionKey as pl, DEFAULT_BACKGROUND_SESSION_MAX_CONSECUTIVE_FAILURES as pn, JsonHttpResponse as po, AutomationBinding as pp, ToolBroker as pr, RecoveryAction as ps, CreateRivusDeploymentEndpointInput as pt, createModelChangeRunBoundary as pu, PendingHumanInteractionState as q, FeishuEndpointGroupPolicy as qa, FeishuMessageIntakeSummary as qc, InvalidRivusEndpointBinding as qd, DeliveryJobStatus as qf, FeishuWebSocketEventDispatcher as qi, PiModelTrustedRun as ql, resolveBackgroundSessionReconciliation as qn, RivusNodeEntrypointOptions as qo, ResponsePresentationStep as qp, FeishuCardKitOpenApiClientOptions as qr, RivusAutomationDeployment as qs, ScheduledAutomationClock as qt, ModelChangeNotificationPort as qu, FEISHU_AGENT_CARD_ELEMENT_ID as r, FeishuEventHandlers as ra, FeishuMessageWorkerDrainAvailableResult as rc, ModelChangeRevisionConflict as rd, AgentRuntimePool as rf, ConfiguredRivusDaemonBootstrapResponse as ri, readFeishuMessageContent as rl, HumanInteractionServiceOptions$1 as rm, FeishuBackgroundSessionDelivery as rn, RivusEnvFileVariables as ro, AUTOMATION_PRESENTATION_SCHEMA_VERSION as rp, FeishuDeploymentEndpointOptions as rr, RivusDaemonPromptRunner as rs, UserDecisionOption as rt, RivusTextFileReader as ru, ConfiguredFeishuHumanInteractionPresenterOptions as s, createFeishuEventHandlers as sa, FeishuReceiveMessageReplayResult as sc, ModelChangeSourceHint as sd, createAgentRuntimePool as sf, ConfiguredFeishuCardRolloverRuntimeOptions as si, FeishuSessionStoreOptions as sl, HumanInteractionPresenter$1 as sm, createConfiguredFeishuBackgroundSessionDelivery as sn, FeishuEndpointCredentials as so, AutomationPresentationKind as sp, openJsonlRecoveryControl as sr, RivusDeploymentBootstrapContext as ss, LoadRivusDeploymentManifestOptions as st, ModelManagementControlOptions as su, CommitAutomationOutcomeInput as t, FeishuEventHandlerCardActions as ta, BackgroundSessionSupervisor as tc, ModelChangeRequestConflict as td, AgentRuntimeCancellation as tf, ConfiguredRivusDaemonBootstrapOptions as ti, InvalidFeishuMessageContent as tl, createPresentedValue as tm, InvalidRivusProjectSpace as tn, OpenClawEnvImportOptions as to, ScheduledAutomationRunResult as tp, FeishuPresentationPreparationOptions as tr, RivusDaemonCliWriter as ts, UserDecisionInteraction as tt, RivusDaemonConfigLoaderOptions as tu, createFeishuHumanInteractionCard as u, createFeishuCardActionCallbackResponse as ua, FeishuMessageAcceptResult as uc, ModelChangeSubmission as ud, AgentRuntimeDisposed as uf, ConfiguredFeishuOpenApiResponse as ui, FeishuSessionReference as ul, DEFAULT_BACKGROUND_SESSION_LEASE_RENEWAL_INTERVAL_MS as un, FetchLikeResponse as uo, InvalidAutomationPresentation as up, AuthorizationPolicyState$1 as ur, createRivusDeploymentCliProcess as us, CreateRivusDeploymentAutomationInput as ut, ModelChangeRunBoundary as uu, FeishuMessageReactionSender as v, RivusDaemonStatusReporterOptions as va, FeishuAgentDaemonSessionResetResult as vc, validateRivusCatalogIdentifier as vd, createEffectAgentHost as vf, FeishuTenantAccessTokenProvider as vi, RivusDaemonSignalSource as vl, extendBackgroundSessionDefinition as vn, SessionSchedulerOptions as vo, AutomationTick as vp, WorkspaceInstructionsProvider as vr, RivusDeploymentAutomationLifecycle as vs, RivusDeploymentEndpoint as vt, ModelChangeApprovalPort as vu, createHumanInteractionToolApprovalGateway as w, FeishuCardRolloverHandoffResult as wa, FeishuAgentPreparedControl as wc, createRivusAgentCatalog as wd, RegisteredRivusAgentProfile as wf, FeishuCardRolloverSupervisorOptions as wi, createRivusDaemonProcess as wl, BACKGROUND_SESSION_DELIVERY_JSONL_VERSION as wn, openJsonlFeishuInboxRepository as wo, GatewayCancelAction as wp, createConfiguredFeishuCardKitPublisher as wr, RivusDeploymentDaemonLifecycle as ws, SubagentCoordinator as wt, AwaitingModelChangeAuthorization as wu, createConfiguredFeishuTextReplySender as x, FeishuCardRolloverCounters as xa, FeishuAgentExecution as xc, CreateCompatibleRivusAgentCatalogOptions as xd, AgentInstanceRegistry$1 as xf, FeishuTenantAccessTokenResponse as xi, RivusDaemonProcessOptions as xl, createBackgroundSessionSupervisor as xn, OpenJsonFeishuSessionStoreOptions as xo, createMessageGateway as xp, FeishuPeriodicFlushOptions as xr, RivusDeploymentBackgroundSessionLifecycle as xs, RivusPluginModule as xt, ModelManagementGrant as xu, createConfiguredFeishuMessageReactionSender as y, createRivusDaemonStatusReporter as ya, FeishuAgentDaemonSkippedResult as yc, validateRivusCatalogRegistration as yd, AgentInstanceConflict as yf, FeishuTenantAccessTokenProviderOptions as yi, createRivusDaemonShutdownController as yl, narrowBackgroundSessionDefinition as yn, SessionSchedulerStatus as yo, MessageGateway as yp, createAgentsMdInstructionsProvider as yr, RivusDeploymentAutomationReadinessError as ys, loadNodeRivusPluginModule as yt, ModelChangeApprovalStatus as yu, ExpiredHumanInteractionState as z, createCompositeRivusDaemonTransport as za, UnsupportedFeishuCardAction as zc, RivusAutomationTemplate as zd, CommitAutomationOutcomeCommand as zf, FeishuCardKitPublisherOptions as zi, PiModelManagementDeploymentOptions as zl, isBackgroundSessionDue as zn, FeishuCardDeliveryLedgerStateOptions as zo, GatewaySkippedResult as zp, FeishuCotProtocolError as zr, LoadedRivusDeployment as zs, PluginStateStore as zt, ModelChangeCoordinator as zu };