@reactive-agents/interaction 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +46 -0
- package/dist/index.d.ts +423 -0
- package/dist/index.js +782 -0
- package/dist/index.js.map +1 -0
- package/package.json +50 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Tyler Buell
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# @reactive-agents/interaction
|
|
2
|
+
|
|
3
|
+
Interaction modes for the [Reactive Agents](https://tylerjrbuell.github.io/reactive-agents-ts/) framework.
|
|
4
|
+
|
|
5
|
+
Gives agents 5 levels of autonomy — from fully autonomous to human-in-the-loop collaborative — with dynamic transitions based on confidence and cost.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
bun add @reactive-agents/interaction effect
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## The 5 Modes
|
|
14
|
+
|
|
15
|
+
| Mode | Autonomy | When it activates |
|
|
16
|
+
|------|----------|------------------|
|
|
17
|
+
| `autonomous` | Full — no interruptions | High confidence, routine tasks |
|
|
18
|
+
| `supervised` | Periodic checkpoints | Moderate confidence |
|
|
19
|
+
| `collaborative` | Human decides key steps | Complex or ambiguous tasks |
|
|
20
|
+
| `consultative` | Human approves before acting | High-cost or risky operations |
|
|
21
|
+
| `interrogative` | Human provides all direction | Information gathering only |
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
import { ReactiveAgents } from "reactive-agents";
|
|
27
|
+
|
|
28
|
+
const agent = await ReactiveAgents.create()
|
|
29
|
+
.withName("assistant")
|
|
30
|
+
.withProvider("anthropic")
|
|
31
|
+
.withInteraction({
|
|
32
|
+
defaultMode: "supervised",
|
|
33
|
+
onCheckpoint: async (ctx) => {
|
|
34
|
+
// Called when agent wants human approval
|
|
35
|
+
console.log("Agent wants to: ", ctx.proposedAction);
|
|
36
|
+
return { approved: true };
|
|
37
|
+
},
|
|
38
|
+
})
|
|
39
|
+
.build();
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Modes transition automatically — an autonomous agent escalates to `consultative` if it detects a high-cost operation, then de-escalates when confidence recovers.
|
|
43
|
+
|
|
44
|
+
## Documentation
|
|
45
|
+
|
|
46
|
+
Full documentation at [tylerjrbuell.github.io/reactive-agents-ts/guides/interaction-modes/](https://tylerjrbuell.github.io/reactive-agents-ts/guides/interaction-modes/)
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,423 @@
|
|
|
1
|
+
import { Schema, Context, Effect, Layer } from 'effect';
|
|
2
|
+
import * as effect_Cause from 'effect/Cause';
|
|
3
|
+
import * as effect_Types from 'effect/Types';
|
|
4
|
+
import * as _reactive_agents_core from '@reactive-agents/core';
|
|
5
|
+
import { EventBus } from '@reactive-agents/core';
|
|
6
|
+
|
|
7
|
+
declare const InteractionModeType: Schema.Literal<["autonomous", "supervised", "collaborative", "consultative", "interrogative"]>;
|
|
8
|
+
type InteractionModeType = typeof InteractionModeType.Type;
|
|
9
|
+
declare const SessionId: Schema.brand<typeof Schema.String, "SessionId">;
|
|
10
|
+
type SessionId = typeof SessionId.Type;
|
|
11
|
+
declare const InteractionModeSchema: Schema.Struct<{
|
|
12
|
+
mode: Schema.Literal<["autonomous", "supervised", "collaborative", "consultative", "interrogative"]>;
|
|
13
|
+
agentId: typeof Schema.String;
|
|
14
|
+
sessionId: Schema.brand<typeof Schema.String, "SessionId">;
|
|
15
|
+
startedAt: typeof Schema.DateFromSelf;
|
|
16
|
+
metadata: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.Unknown>>;
|
|
17
|
+
}>;
|
|
18
|
+
type InteractionMode = typeof InteractionModeSchema.Type;
|
|
19
|
+
|
|
20
|
+
declare const NotificationChannel: Schema.Literal<["in-app", "callback", "event-bus"]>;
|
|
21
|
+
type NotificationChannel = typeof NotificationChannel.Type;
|
|
22
|
+
declare const NotificationPriority: Schema.Literal<["low", "normal", "high", "urgent"]>;
|
|
23
|
+
type NotificationPriority = typeof NotificationPriority.Type;
|
|
24
|
+
declare const NotificationSchema: Schema.Struct<{
|
|
25
|
+
id: typeof Schema.String;
|
|
26
|
+
agentId: typeof Schema.String;
|
|
27
|
+
channel: Schema.Literal<["in-app", "callback", "event-bus"]>;
|
|
28
|
+
priority: Schema.Literal<["low", "normal", "high", "urgent"]>;
|
|
29
|
+
title: typeof Schema.String;
|
|
30
|
+
body: typeof Schema.String;
|
|
31
|
+
data: Schema.optional<typeof Schema.Unknown>;
|
|
32
|
+
createdAt: typeof Schema.DateFromSelf;
|
|
33
|
+
readAt: Schema.optional<typeof Schema.DateFromSelf>;
|
|
34
|
+
}>;
|
|
35
|
+
type Notification = typeof NotificationSchema.Type;
|
|
36
|
+
declare const ReportingFrequency: Schema.Literal<["realtime", "milestone", "hourly", "daily"]>;
|
|
37
|
+
type ReportingFrequency = typeof ReportingFrequency.Type;
|
|
38
|
+
declare const ReportingDetailLevel: Schema.Literal<["minimal", "summary", "detailed"]>;
|
|
39
|
+
type ReportingDetailLevel = typeof ReportingDetailLevel.Type;
|
|
40
|
+
declare const ReportingConfigSchema: Schema.Struct<{
|
|
41
|
+
frequency: Schema.Literal<["realtime", "milestone", "hourly", "daily"]>;
|
|
42
|
+
channel: Schema.Literal<["in-app", "callback", "event-bus"]>;
|
|
43
|
+
detail: Schema.Literal<["minimal", "summary", "detailed"]>;
|
|
44
|
+
streaming: typeof Schema.Boolean;
|
|
45
|
+
}>;
|
|
46
|
+
type ReportingConfig = typeof ReportingConfigSchema.Type;
|
|
47
|
+
|
|
48
|
+
declare const EscalationConditionType: Schema.Literal<["uncertainty", "cost", "duration", "user-active", "confidence", "consecutive-approvals"]>;
|
|
49
|
+
type EscalationConditionType = typeof EscalationConditionType.Type;
|
|
50
|
+
declare const EscalationConditionSchema: Schema.Struct<{
|
|
51
|
+
type: Schema.Literal<["uncertainty", "cost", "duration", "user-active", "confidence", "consecutive-approvals"]>;
|
|
52
|
+
threshold: typeof Schema.Number;
|
|
53
|
+
}>;
|
|
54
|
+
type EscalationCondition = typeof EscalationConditionSchema.Type;
|
|
55
|
+
declare const ModeTransitionRuleSchema: Schema.Struct<{
|
|
56
|
+
from: Schema.Literal<["autonomous", "supervised", "collaborative", "consultative", "interrogative"]>;
|
|
57
|
+
to: Schema.Literal<["autonomous", "supervised", "collaborative", "consultative", "interrogative"]>;
|
|
58
|
+
conditions: Schema.Array$<Schema.Struct<{
|
|
59
|
+
type: Schema.Literal<["uncertainty", "cost", "duration", "user-active", "confidence", "consecutive-approvals"]>;
|
|
60
|
+
threshold: typeof Schema.Number;
|
|
61
|
+
}>>;
|
|
62
|
+
}>;
|
|
63
|
+
type ModeTransitionRule = typeof ModeTransitionRuleSchema.Type;
|
|
64
|
+
declare const InteractionConfigSchema: Schema.Struct<{
|
|
65
|
+
defaultMode: Schema.Literal<["autonomous", "supervised", "collaborative", "consultative", "interrogative"]>;
|
|
66
|
+
interruptRules: Schema.Array$<Schema.Struct<{
|
|
67
|
+
trigger: Schema.Literal<["error", "uncertainty", "high-cost", "critical-decision", "user-requested", "custom"]>;
|
|
68
|
+
severity: Schema.Literal<["low", "medium", "high", "critical"]>;
|
|
69
|
+
threshold: Schema.optional<typeof Schema.Number>;
|
|
70
|
+
enabled: typeof Schema.Boolean;
|
|
71
|
+
}>>;
|
|
72
|
+
reporting: Schema.Struct<{
|
|
73
|
+
frequency: Schema.Literal<["realtime", "milestone", "hourly", "daily"]>;
|
|
74
|
+
channel: Schema.Literal<["in-app", "callback", "event-bus"]>;
|
|
75
|
+
detail: Schema.Literal<["minimal", "summary", "detailed"]>;
|
|
76
|
+
streaming: typeof Schema.Boolean;
|
|
77
|
+
}>;
|
|
78
|
+
checkpoints: Schema.optional<Schema.Struct<{
|
|
79
|
+
frequency: Schema.Literal<["milestone", "time-based"]>;
|
|
80
|
+
intervalMs: Schema.optional<typeof Schema.Number>;
|
|
81
|
+
milestones: Schema.optional<Schema.Array$<typeof Schema.String>>;
|
|
82
|
+
autoApprove: Schema.Struct<{
|
|
83
|
+
enabled: typeof Schema.Boolean;
|
|
84
|
+
timeoutMs: typeof Schema.Number;
|
|
85
|
+
defaultAction: Schema.Literal<["approve", "reject", "pause"]>;
|
|
86
|
+
}>;
|
|
87
|
+
}>>;
|
|
88
|
+
escalationRules: Schema.Array$<Schema.Struct<{
|
|
89
|
+
from: Schema.Literal<["autonomous", "supervised", "collaborative", "consultative", "interrogative"]>;
|
|
90
|
+
to: Schema.Literal<["autonomous", "supervised", "collaborative", "consultative", "interrogative"]>;
|
|
91
|
+
conditions: Schema.Array$<Schema.Struct<{
|
|
92
|
+
type: Schema.Literal<["uncertainty", "cost", "duration", "user-active", "confidence", "consecutive-approvals"]>;
|
|
93
|
+
threshold: typeof Schema.Number;
|
|
94
|
+
}>>;
|
|
95
|
+
}>>;
|
|
96
|
+
deescalationRules: Schema.Array$<Schema.Struct<{
|
|
97
|
+
from: Schema.Literal<["autonomous", "supervised", "collaborative", "consultative", "interrogative"]>;
|
|
98
|
+
to: Schema.Literal<["autonomous", "supervised", "collaborative", "consultative", "interrogative"]>;
|
|
99
|
+
conditions: Schema.Array$<Schema.Struct<{
|
|
100
|
+
type: Schema.Literal<["uncertainty", "cost", "duration", "user-active", "confidence", "consecutive-approvals"]>;
|
|
101
|
+
threshold: typeof Schema.Number;
|
|
102
|
+
}>>;
|
|
103
|
+
}>>;
|
|
104
|
+
learningEnabled: typeof Schema.Boolean;
|
|
105
|
+
}>;
|
|
106
|
+
type InteractionConfig = typeof InteractionConfigSchema.Type;
|
|
107
|
+
declare const defaultInteractionConfig: InteractionConfig;
|
|
108
|
+
|
|
109
|
+
declare const CheckpointStatus: Schema.Literal<["pending", "approved", "rejected", "auto-approved", "expired"]>;
|
|
110
|
+
type CheckpointStatus = typeof CheckpointStatus.Type;
|
|
111
|
+
declare const CheckpointSchema: Schema.Struct<{
|
|
112
|
+
id: typeof Schema.String;
|
|
113
|
+
agentId: typeof Schema.String;
|
|
114
|
+
taskId: typeof Schema.String;
|
|
115
|
+
milestoneName: typeof Schema.String;
|
|
116
|
+
description: typeof Schema.String;
|
|
117
|
+
status: Schema.Literal<["pending", "approved", "rejected", "auto-approved", "expired"]>;
|
|
118
|
+
createdAt: typeof Schema.DateFromSelf;
|
|
119
|
+
resolvedAt: Schema.optional<typeof Schema.DateFromSelf>;
|
|
120
|
+
userComment: Schema.optional<typeof Schema.String>;
|
|
121
|
+
}>;
|
|
122
|
+
type Checkpoint = typeof CheckpointSchema.Type;
|
|
123
|
+
declare const CheckpointFrequency: Schema.Literal<["milestone", "time-based"]>;
|
|
124
|
+
type CheckpointFrequency = typeof CheckpointFrequency.Type;
|
|
125
|
+
declare const AutoApproveAction: Schema.Literal<["approve", "reject", "pause"]>;
|
|
126
|
+
type AutoApproveAction = typeof AutoApproveAction.Type;
|
|
127
|
+
declare const CheckpointConfigSchema: Schema.Struct<{
|
|
128
|
+
frequency: Schema.Literal<["milestone", "time-based"]>;
|
|
129
|
+
intervalMs: Schema.optional<typeof Schema.Number>;
|
|
130
|
+
milestones: Schema.optional<Schema.Array$<typeof Schema.String>>;
|
|
131
|
+
autoApprove: Schema.Struct<{
|
|
132
|
+
enabled: typeof Schema.Boolean;
|
|
133
|
+
timeoutMs: typeof Schema.Number;
|
|
134
|
+
defaultAction: Schema.Literal<["approve", "reject", "pause"]>;
|
|
135
|
+
}>;
|
|
136
|
+
}>;
|
|
137
|
+
type CheckpointConfig = typeof CheckpointConfigSchema.Type;
|
|
138
|
+
|
|
139
|
+
declare const InterruptTrigger: Schema.Literal<["error", "uncertainty", "high-cost", "critical-decision", "user-requested", "custom"]>;
|
|
140
|
+
type InterruptTrigger = typeof InterruptTrigger.Type;
|
|
141
|
+
declare const InterruptSeverity: Schema.Literal<["low", "medium", "high", "critical"]>;
|
|
142
|
+
type InterruptSeverity = typeof InterruptSeverity.Type;
|
|
143
|
+
declare const InterruptRuleSchema: Schema.Struct<{
|
|
144
|
+
trigger: Schema.Literal<["error", "uncertainty", "high-cost", "critical-decision", "user-requested", "custom"]>;
|
|
145
|
+
severity: Schema.Literal<["low", "medium", "high", "critical"]>;
|
|
146
|
+
threshold: Schema.optional<typeof Schema.Number>;
|
|
147
|
+
enabled: typeof Schema.Boolean;
|
|
148
|
+
}>;
|
|
149
|
+
type InterruptRule = typeof InterruptRuleSchema.Type;
|
|
150
|
+
declare const InterruptEventSchema: Schema.Struct<{
|
|
151
|
+
id: typeof Schema.String;
|
|
152
|
+
trigger: Schema.Literal<["error", "uncertainty", "high-cost", "critical-decision", "user-requested", "custom"]>;
|
|
153
|
+
severity: Schema.Literal<["low", "medium", "high", "critical"]>;
|
|
154
|
+
agentId: typeof Schema.String;
|
|
155
|
+
taskId: typeof Schema.String;
|
|
156
|
+
message: typeof Schema.String;
|
|
157
|
+
context: Schema.optional<typeof Schema.Unknown>;
|
|
158
|
+
timestamp: typeof Schema.DateFromSelf;
|
|
159
|
+
acknowledged: typeof Schema.Boolean;
|
|
160
|
+
}>;
|
|
161
|
+
type InterruptEvent = typeof InterruptEventSchema.Type;
|
|
162
|
+
|
|
163
|
+
declare const CollaborationStatus: Schema.Literal<["active", "paused", "ended"]>;
|
|
164
|
+
type CollaborationStatus = typeof CollaborationStatus.Type;
|
|
165
|
+
declare const QuestionStyle: Schema.Literal<["inline", "batch", "separate"]>;
|
|
166
|
+
type QuestionStyle = typeof QuestionStyle.Type;
|
|
167
|
+
declare const CollaborationSessionSchema: Schema.Struct<{
|
|
168
|
+
id: Schema.brand<typeof Schema.String, "SessionId">;
|
|
169
|
+
agentId: typeof Schema.String;
|
|
170
|
+
taskId: typeof Schema.String;
|
|
171
|
+
status: Schema.Literal<["active", "paused", "ended"]>;
|
|
172
|
+
thinkingVisible: typeof Schema.Boolean;
|
|
173
|
+
streamingEnabled: typeof Schema.Boolean;
|
|
174
|
+
questionStyle: Schema.Literal<["inline", "batch", "separate"]>;
|
|
175
|
+
rollbackEnabled: typeof Schema.Boolean;
|
|
176
|
+
startedAt: typeof Schema.DateFromSelf;
|
|
177
|
+
endedAt: Schema.optional<typeof Schema.DateFromSelf>;
|
|
178
|
+
}>;
|
|
179
|
+
type CollaborationSession = typeof CollaborationSessionSchema.Type;
|
|
180
|
+
declare const CollaborationMessageType: Schema.Literal<["thought", "question", "answer", "suggestion", "update", "action"]>;
|
|
181
|
+
type CollaborationMessageType = typeof CollaborationMessageType.Type;
|
|
182
|
+
declare const CollaborationMessageSchema: Schema.Struct<{
|
|
183
|
+
id: typeof Schema.String;
|
|
184
|
+
sessionId: Schema.brand<typeof Schema.String, "SessionId">;
|
|
185
|
+
type: Schema.Literal<["thought", "question", "answer", "suggestion", "update", "action"]>;
|
|
186
|
+
sender: Schema.Literal<["agent", "user"]>;
|
|
187
|
+
content: typeof Schema.String;
|
|
188
|
+
timestamp: typeof Schema.DateFromSelf;
|
|
189
|
+
}>;
|
|
190
|
+
type CollaborationMessage = typeof CollaborationMessageSchema.Type;
|
|
191
|
+
|
|
192
|
+
declare const ApprovalAction: Schema.Literal<["auto-approve", "auto-reject", "ask"]>;
|
|
193
|
+
type ApprovalAction = typeof ApprovalAction.Type;
|
|
194
|
+
declare const ApprovalPatternSchema: Schema.Struct<{
|
|
195
|
+
id: typeof Schema.String;
|
|
196
|
+
taskType: typeof Schema.String;
|
|
197
|
+
costThreshold: Schema.optional<typeof Schema.Number>;
|
|
198
|
+
action: Schema.Literal<["auto-approve", "auto-reject", "ask"]>;
|
|
199
|
+
confidence: typeof Schema.Number;
|
|
200
|
+
occurrences: typeof Schema.Number;
|
|
201
|
+
lastSeen: typeof Schema.DateFromSelf;
|
|
202
|
+
}>;
|
|
203
|
+
type ApprovalPattern = typeof ApprovalPatternSchema.Type;
|
|
204
|
+
declare const InterruptionTolerance: Schema.Literal<["low", "medium", "high"]>;
|
|
205
|
+
type InterruptionTolerance = typeof InterruptionTolerance.Type;
|
|
206
|
+
declare const UserPreferenceSchema: Schema.Struct<{
|
|
207
|
+
userId: typeof Schema.String;
|
|
208
|
+
learningEnabled: typeof Schema.Boolean;
|
|
209
|
+
interruptionTolerance: Schema.Literal<["low", "medium", "high"]>;
|
|
210
|
+
preferredMode: Schema.optional<typeof Schema.String>;
|
|
211
|
+
approvalPatterns: Schema.Array$<Schema.Struct<{
|
|
212
|
+
id: typeof Schema.String;
|
|
213
|
+
taskType: typeof Schema.String;
|
|
214
|
+
costThreshold: Schema.optional<typeof Schema.Number>;
|
|
215
|
+
action: Schema.Literal<["auto-approve", "auto-reject", "ask"]>;
|
|
216
|
+
confidence: typeof Schema.Number;
|
|
217
|
+
occurrences: typeof Schema.Number;
|
|
218
|
+
lastSeen: typeof Schema.DateFromSelf;
|
|
219
|
+
}>>;
|
|
220
|
+
lastUpdated: typeof Schema.DateFromSelf;
|
|
221
|
+
}>;
|
|
222
|
+
type UserPreference = typeof UserPreferenceSchema.Type;
|
|
223
|
+
|
|
224
|
+
declare const InteractionError_base: new <A extends Record<string, any> = {}>(args: effect_Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => effect_Cause.YieldableError & {
|
|
225
|
+
readonly _tag: "InteractionError";
|
|
226
|
+
} & Readonly<A>;
|
|
227
|
+
declare class InteractionError extends InteractionError_base<{
|
|
228
|
+
readonly message: string;
|
|
229
|
+
readonly cause?: unknown;
|
|
230
|
+
}> {
|
|
231
|
+
}
|
|
232
|
+
declare const ModeError_base: new <A extends Record<string, any> = {}>(args: effect_Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => effect_Cause.YieldableError & {
|
|
233
|
+
readonly _tag: "ModeError";
|
|
234
|
+
} & Readonly<A>;
|
|
235
|
+
declare class ModeError extends ModeError_base<{
|
|
236
|
+
readonly from: string;
|
|
237
|
+
readonly to: string;
|
|
238
|
+
readonly reason: string;
|
|
239
|
+
}> {
|
|
240
|
+
}
|
|
241
|
+
declare const CheckpointError_base: new <A extends Record<string, any> = {}>(args: effect_Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => effect_Cause.YieldableError & {
|
|
242
|
+
readonly _tag: "CheckpointError";
|
|
243
|
+
} & Readonly<A>;
|
|
244
|
+
declare class CheckpointError extends CheckpointError_base<{
|
|
245
|
+
readonly checkpointId: string;
|
|
246
|
+
readonly message: string;
|
|
247
|
+
}> {
|
|
248
|
+
}
|
|
249
|
+
declare const SessionNotFoundError_base: new <A extends Record<string, any> = {}>(args: effect_Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => effect_Cause.YieldableError & {
|
|
250
|
+
readonly _tag: "SessionNotFoundError";
|
|
251
|
+
} & Readonly<A>;
|
|
252
|
+
declare class SessionNotFoundError extends SessionNotFoundError_base<{
|
|
253
|
+
readonly sessionId: string;
|
|
254
|
+
}> {
|
|
255
|
+
}
|
|
256
|
+
declare const NotificationError_base: new <A extends Record<string, any> = {}>(args: effect_Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => effect_Cause.YieldableError & {
|
|
257
|
+
readonly _tag: "NotificationError";
|
|
258
|
+
} & Readonly<A>;
|
|
259
|
+
declare class NotificationError extends NotificationError_base<{
|
|
260
|
+
readonly channel: string;
|
|
261
|
+
readonly message: string;
|
|
262
|
+
readonly cause?: unknown;
|
|
263
|
+
}> {
|
|
264
|
+
}
|
|
265
|
+
declare const InputTimeoutError_base: new <A extends Record<string, any> = {}>(args: effect_Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => effect_Cause.YieldableError & {
|
|
266
|
+
readonly _tag: "InputTimeoutError";
|
|
267
|
+
} & Readonly<A>;
|
|
268
|
+
declare class InputTimeoutError extends InputTimeoutError_base<{
|
|
269
|
+
readonly timeoutMs: number;
|
|
270
|
+
readonly message: string;
|
|
271
|
+
}> {
|
|
272
|
+
}
|
|
273
|
+
type InteractionErrors = InteractionError | ModeError | CheckpointError | SessionNotFoundError | NotificationError | InputTimeoutError;
|
|
274
|
+
|
|
275
|
+
declare const ModeSwitcher_base: Context.TagClass<ModeSwitcher, "ModeSwitcher", {
|
|
276
|
+
readonly getMode: (agentId: string) => Effect.Effect<InteractionModeType>;
|
|
277
|
+
readonly setMode: (agentId: string, targetMode: InteractionModeType) => Effect.Effect<void, ModeError>;
|
|
278
|
+
readonly evaluateTransition: (agentId: string, context: {
|
|
279
|
+
confidence?: number;
|
|
280
|
+
cost?: number;
|
|
281
|
+
durationMs?: number;
|
|
282
|
+
userActive?: boolean;
|
|
283
|
+
consecutiveApprovals?: number;
|
|
284
|
+
}) => Effect.Effect<InteractionModeType | null>;
|
|
285
|
+
}>;
|
|
286
|
+
declare class ModeSwitcher extends ModeSwitcher_base {
|
|
287
|
+
}
|
|
288
|
+
declare const ModeSwitcherLive: (config?: InteractionConfig) => Layer.Layer<ModeSwitcher, never, EventBus>;
|
|
289
|
+
|
|
290
|
+
declare const NotificationService_base: Context.TagClass<NotificationService, "NotificationService", {
|
|
291
|
+
/** Send a notification to user via configured channel. */
|
|
292
|
+
readonly send: (params: {
|
|
293
|
+
readonly agentId: string;
|
|
294
|
+
readonly channel: NotificationChannel;
|
|
295
|
+
readonly priority: NotificationPriority;
|
|
296
|
+
readonly title: string;
|
|
297
|
+
readonly body: string;
|
|
298
|
+
readonly data?: unknown;
|
|
299
|
+
}) => Effect.Effect<Notification, NotificationError>;
|
|
300
|
+
/** List unread notifications. */
|
|
301
|
+
readonly listUnread: () => Effect.Effect<readonly Notification[]>;
|
|
302
|
+
/** Mark a notification as read. */
|
|
303
|
+
readonly markRead: (notificationId: string) => Effect.Effect<void>;
|
|
304
|
+
}>;
|
|
305
|
+
declare class NotificationService extends NotificationService_base {
|
|
306
|
+
}
|
|
307
|
+
declare const NotificationServiceLive: Layer.Layer<NotificationService, never, EventBus>;
|
|
308
|
+
|
|
309
|
+
declare const CheckpointService_base: Context.TagClass<CheckpointService, "CheckpointService", {
|
|
310
|
+
readonly createCheckpoint: (params: {
|
|
311
|
+
agentId: string;
|
|
312
|
+
taskId: string;
|
|
313
|
+
milestoneName: string;
|
|
314
|
+
description: string;
|
|
315
|
+
}) => Effect.Effect<Checkpoint>;
|
|
316
|
+
readonly resolveCheckpoint: (checkpointId: string, status: "approved" | "rejected", comment?: string) => Effect.Effect<Checkpoint, CheckpointError>;
|
|
317
|
+
readonly getCheckpoint: (checkpointId: string) => Effect.Effect<Checkpoint, CheckpointError>;
|
|
318
|
+
readonly listPending: (agentId?: string) => Effect.Effect<readonly Checkpoint[]>;
|
|
319
|
+
}>;
|
|
320
|
+
declare class CheckpointService extends CheckpointService_base {
|
|
321
|
+
}
|
|
322
|
+
declare const CheckpointServiceLive: Layer.Layer<CheckpointService, never, EventBus>;
|
|
323
|
+
|
|
324
|
+
declare const CollaborationService_base: Context.TagClass<CollaborationService, "CollaborationService", {
|
|
325
|
+
readonly startSession: (params: {
|
|
326
|
+
agentId: string;
|
|
327
|
+
taskId: string;
|
|
328
|
+
thinkingVisible?: boolean;
|
|
329
|
+
streamingEnabled?: boolean;
|
|
330
|
+
}) => Effect.Effect<CollaborationSession>;
|
|
331
|
+
readonly endSession: (sessionId: SessionId) => Effect.Effect<void, SessionNotFoundError>;
|
|
332
|
+
readonly sendMessage: (params: {
|
|
333
|
+
sessionId: SessionId;
|
|
334
|
+
type: CollaborationMessage["type"];
|
|
335
|
+
sender: "agent" | "user";
|
|
336
|
+
content: string;
|
|
337
|
+
}) => Effect.Effect<CollaborationMessage, SessionNotFoundError>;
|
|
338
|
+
readonly getMessages: (sessionId: SessionId) => Effect.Effect<readonly CollaborationMessage[], SessionNotFoundError>;
|
|
339
|
+
readonly getSession: (sessionId: SessionId) => Effect.Effect<CollaborationSession, SessionNotFoundError>;
|
|
340
|
+
}>;
|
|
341
|
+
declare class CollaborationService extends CollaborationService_base {
|
|
342
|
+
}
|
|
343
|
+
declare const CollaborationServiceLive: Layer.Layer<CollaborationService, never, EventBus>;
|
|
344
|
+
|
|
345
|
+
declare const PreferenceLearner_base: Context.TagClass<PreferenceLearner, "PreferenceLearner", {
|
|
346
|
+
readonly getPreference: (userId: string) => Effect.Effect<UserPreference>;
|
|
347
|
+
readonly recordApproval: (params: {
|
|
348
|
+
userId: string;
|
|
349
|
+
taskType: string;
|
|
350
|
+
approved: boolean;
|
|
351
|
+
cost?: number;
|
|
352
|
+
}) => Effect.Effect<void>;
|
|
353
|
+
readonly shouldAutoApprove: (params: {
|
|
354
|
+
userId: string;
|
|
355
|
+
taskType: string;
|
|
356
|
+
cost?: number;
|
|
357
|
+
}) => Effect.Effect<boolean>;
|
|
358
|
+
readonly updateTolerance: (userId: string, tolerance: "low" | "medium" | "high") => Effect.Effect<void>;
|
|
359
|
+
}>;
|
|
360
|
+
declare class PreferenceLearner extends PreferenceLearner_base {
|
|
361
|
+
}
|
|
362
|
+
declare const PreferenceLearnerLive: Layer.Layer<PreferenceLearner, never, never>;
|
|
363
|
+
|
|
364
|
+
declare const InteractionManager_base: Context.TagClass<InteractionManager, "InteractionManager", {
|
|
365
|
+
readonly getMode: (agentId: string) => Effect.Effect<InteractionModeType>;
|
|
366
|
+
readonly switchMode: (agentId: string, mode: InteractionModeType) => Effect.Effect<void, InteractionErrors>;
|
|
367
|
+
readonly evaluateTransition: (agentId: string, context: {
|
|
368
|
+
confidence?: number;
|
|
369
|
+
cost?: number;
|
|
370
|
+
durationMs?: number;
|
|
371
|
+
userActive?: boolean;
|
|
372
|
+
consecutiveApprovals?: number;
|
|
373
|
+
}) => Effect.Effect<InteractionModeType | null>;
|
|
374
|
+
readonly notify: (params: {
|
|
375
|
+
readonly agentId: string;
|
|
376
|
+
readonly channel: NotificationChannel;
|
|
377
|
+
readonly priority: NotificationPriority;
|
|
378
|
+
readonly title: string;
|
|
379
|
+
readonly body: string;
|
|
380
|
+
}) => Effect.Effect<Notification, InteractionErrors>;
|
|
381
|
+
readonly listUnread: () => Effect.Effect<readonly Notification[]>;
|
|
382
|
+
readonly markRead: (notificationId: string) => Effect.Effect<void>;
|
|
383
|
+
readonly createCheckpoint: (params: {
|
|
384
|
+
agentId: string;
|
|
385
|
+
taskId: string;
|
|
386
|
+
milestoneName: string;
|
|
387
|
+
description: string;
|
|
388
|
+
}) => Effect.Effect<Checkpoint>;
|
|
389
|
+
readonly resolveCheckpoint: (checkpointId: string, status: "approved" | "rejected", comment?: string) => Effect.Effect<Checkpoint, CheckpointError>;
|
|
390
|
+
readonly listPendingCheckpoints: (agentId?: string) => Effect.Effect<readonly Checkpoint[]>;
|
|
391
|
+
readonly startCollaboration: (params: {
|
|
392
|
+
agentId: string;
|
|
393
|
+
taskId: string;
|
|
394
|
+
thinkingVisible?: boolean;
|
|
395
|
+
}) => Effect.Effect<CollaborationSession>;
|
|
396
|
+
readonly endCollaboration: (sessionId: SessionId) => Effect.Effect<void, SessionNotFoundError>;
|
|
397
|
+
readonly sendCollaborationMessage: (params: {
|
|
398
|
+
sessionId: SessionId;
|
|
399
|
+
type: CollaborationMessage["type"];
|
|
400
|
+
sender: "agent" | "user";
|
|
401
|
+
content: string;
|
|
402
|
+
}) => Effect.Effect<CollaborationMessage, SessionNotFoundError>;
|
|
403
|
+
readonly getPreference: (userId: string) => Effect.Effect<UserPreference>;
|
|
404
|
+
readonly shouldAutoApprove: (params: {
|
|
405
|
+
userId: string;
|
|
406
|
+
taskType: string;
|
|
407
|
+
cost?: number;
|
|
408
|
+
}) => Effect.Effect<boolean>;
|
|
409
|
+
}>;
|
|
410
|
+
declare class InteractionManager extends InteractionManager_base {
|
|
411
|
+
}
|
|
412
|
+
declare const InteractionManagerLive: Layer.Layer<InteractionManager, never, ModeSwitcher | EventBus | NotificationService | CheckpointService | CollaborationService | PreferenceLearner>;
|
|
413
|
+
|
|
414
|
+
/**
|
|
415
|
+
* Create the Interaction layer (Phase 3 — all 5 modes).
|
|
416
|
+
*
|
|
417
|
+
* Provides: InteractionManager, ModeSwitcher, NotificationService,
|
|
418
|
+
* CheckpointService, CollaborationService, PreferenceLearner
|
|
419
|
+
* Requires: EventBus (from @reactive-agents/core)
|
|
420
|
+
*/
|
|
421
|
+
declare const createInteractionLayer: (config?: InteractionConfig) => Layer.Layer<ModeSwitcher | NotificationService | CheckpointService | CollaborationService | PreferenceLearner | InteractionManager, never, _reactive_agents_core.EventBus>;
|
|
422
|
+
|
|
423
|
+
export { ApprovalAction, type ApprovalPattern, ApprovalPatternSchema, AutoApproveAction, type Checkpoint, type CheckpointConfig, CheckpointConfigSchema, CheckpointError, CheckpointFrequency, CheckpointSchema, CheckpointService, CheckpointServiceLive, CheckpointStatus, type CollaborationMessage, CollaborationMessageSchema, CollaborationMessageType, CollaborationService, CollaborationServiceLive, type CollaborationSession, CollaborationSessionSchema, CollaborationStatus, type EscalationCondition, EscalationConditionSchema, EscalationConditionType, InputTimeoutError, type InteractionConfig, InteractionConfigSchema, InteractionError, type InteractionErrors, InteractionManager, InteractionManagerLive, type InteractionMode, InteractionModeSchema, InteractionModeType, type InterruptEvent, InterruptEventSchema, type InterruptRule, InterruptRuleSchema, InterruptSeverity, InterruptTrigger, InterruptionTolerance, ModeError, ModeSwitcher, ModeSwitcherLive, type ModeTransitionRule, ModeTransitionRuleSchema, type Notification, NotificationChannel, NotificationError, NotificationPriority, NotificationSchema, NotificationService, NotificationServiceLive, PreferenceLearner, PreferenceLearnerLive, QuestionStyle, type ReportingConfig, ReportingConfigSchema, ReportingDetailLevel, ReportingFrequency, SessionId, SessionNotFoundError, type UserPreference, UserPreferenceSchema, createInteractionLayer, defaultInteractionConfig };
|