@agentxjs/core 2.0.0 → 2.0.1
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/dist/{Processor-DT0N1qI6.d.ts → Processor-CeMyXtsX.d.ts} +1 -1
- package/dist/{RpcClient-BcJ_zAGu.d.ts → RpcClient-CMdhJxjS.d.ts} +2 -2
- package/dist/agent/engine/internal/index.d.ts +4 -5
- package/dist/agent/engine/internal/index.js +1 -1
- package/dist/agent/engine/mealy/index.d.ts +4 -4
- package/dist/agent/engine/mealy/index.js +1 -1
- package/dist/agent/index.d.ts +91 -91
- package/dist/agent/index.js +6 -6
- package/dist/agent/types/index.d.ts +4 -4
- package/dist/agent/types/index.js +1 -1
- package/dist/bash/index.d.ts +4 -4
- package/dist/{chunk-LTVNPHST.js → chunk-22NTRYNO.js} +60 -60
- package/dist/chunk-22NTRYNO.js.map +1 -0
- package/dist/{chunk-7ZDX3O6I.js → chunk-AAFPAF67.js} +2 -2
- package/dist/{chunk-7ZDX3O6I.js.map → chunk-AAFPAF67.js.map} +1 -1
- package/dist/{chunk-EKHT54KN.js → chunk-APCBNCOW.js} +1 -1
- package/dist/{chunk-EKHT54KN.js.map → chunk-APCBNCOW.js.map} +1 -1
- package/dist/{chunk-JTKCV7IS.js → chunk-RWIYC65R.js} +111 -111
- package/dist/{chunk-JTKCV7IS.js.map → chunk-RWIYC65R.js.map} +1 -1
- package/dist/{chunk-DEAR6N3O.js → chunk-TUFZ2YH6.js} +1 -1
- package/dist/chunk-TUFZ2YH6.js.map +1 -0
- package/dist/{chunk-23UUBQXR.js → chunk-YSZG6XIM.js} +1 -1
- package/dist/chunk-YSZG6XIM.js.map +1 -0
- package/dist/{combinators-nEa5dD0T.d.ts → combinators-Dy-7lxKV.d.ts} +50 -50
- package/dist/common/logger/index.js +14 -14
- package/dist/common/logger/index.js.map +1 -1
- package/dist/container/index.d.ts +3 -3
- package/dist/driver/index.d.ts +2 -2
- package/dist/event/index.d.ts +1 -1
- package/dist/event/index.js +2 -2
- package/dist/event/types/index.d.ts +199 -199
- package/dist/event/types/index.js +1 -1
- package/dist/{event-DNWOBSBO.d.ts → event-DNsF9EkO.d.ts} +4 -6
- package/dist/image/index.d.ts +3 -3
- package/dist/image/index.js.map +1 -1
- package/dist/{index-CuS1i5V-.d.ts → index--gxNpY5W.d.ts} +2 -2
- package/dist/index.d.ts +4 -4
- package/dist/index.js +6 -6
- package/dist/{message-03TJzvIX.d.ts → message-Dn-I2vr0.d.ts} +1 -1
- package/dist/mq/index.d.ts +25 -25
- package/dist/mq/index.js +1 -1
- package/dist/mq/index.js.map +1 -1
- package/dist/network/index.d.ts +57 -57
- package/dist/network/index.js +27 -27
- package/dist/network/index.js.map +1 -1
- package/dist/persistence/index.d.ts +2 -2
- package/dist/platform/index.d.ts +4 -4
- package/dist/runtime/index.d.ts +5 -5
- package/dist/runtime/index.js +6 -6
- package/dist/runtime/index.js.map +1 -1
- package/dist/session/index.d.ts +3 -3
- package/dist/{types-aE74Eo6G.d.ts → types-Cb8tKM6Y.d.ts} +1 -1
- package/package.json +1 -1
- package/src/agent/AgentStateMachine.ts +2 -2
- package/src/agent/__tests__/AgentStateMachine.test.ts +2 -2
- package/src/agent/__tests__/createAgent.test.ts +4 -4
- package/src/agent/__tests__/engine/internal/messageAssemblerProcessor.test.ts +10 -10
- package/src/agent/__tests__/engine/internal/stateEventProcessor.test.ts +6 -6
- package/src/agent/__tests__/engine/internal/turnTrackerProcessor.test.ts +4 -4
- package/src/agent/__tests__/engine/mealy/Mealy.test.ts +3 -3
- package/src/agent/__tests__/engine/mealy/Store.test.ts +1 -1
- package/src/agent/__tests__/engine/mealy/combinators.test.ts +4 -4
- package/src/agent/createAgent.ts +15 -15
- package/src/agent/engine/AgentProcessor.ts +7 -7
- package/src/agent/engine/MealyMachine.ts +3 -3
- package/src/agent/engine/internal/index.ts +11 -11
- package/src/agent/engine/internal/messageAssemblerProcessor.ts +14 -14
- package/src/agent/engine/internal/stateEventProcessor.ts +13 -15
- package/src/agent/engine/internal/turnTrackerProcessor.ts +4 -4
- package/src/agent/engine/mealy/Mealy.ts +2 -2
- package/src/agent/engine/mealy/combinators.ts +10 -10
- package/src/agent/engine/mealy/index.ts +9 -11
- package/src/agent/index.ts +30 -32
- package/src/agent/types/engine.ts +3 -3
- package/src/agent/types/event.ts +4 -8
- package/src/agent/types/index.ts +85 -85
- package/src/bash/index.ts +1 -1
- package/src/common/logger/ConsoleLogger.ts +1 -1
- package/src/common/logger/LoggerFactoryImpl.ts +14 -14
- package/src/common/logger/index.ts +3 -3
- package/src/container/index.ts +4 -5
- package/src/container/types.ts +1 -1
- package/src/driver/index.ts +15 -17
- package/src/driver/types.ts +89 -79
- package/src/event/EventBus.ts +10 -10
- package/src/event/__tests__/EventBus.test.ts +1 -1
- package/src/event/index.ts +2 -3
- package/src/event/types/agent.ts +186 -180
- package/src/event/types/bus.ts +1 -1
- package/src/event/types/command.ts +292 -265
- package/src/event/types/container.ts +207 -222
- package/src/event/types/driver.ts +153 -155
- package/src/event/types/index.ts +6 -12
- package/src/event/types/session.ts +117 -130
- package/src/image/Image.ts +1 -1
- package/src/image/index.ts +4 -5
- package/src/mq/OffsetGenerator.ts +1 -1
- package/src/mq/__tests__/OffsetGenerator.test.ts +1 -1
- package/src/mq/index.ts +4 -5
- package/src/network/RpcClient.ts +5 -5
- package/src/network/index.ts +40 -43
- package/src/network/jsonrpc.ts +5 -5
- package/src/persistence/index.ts +5 -5
- package/src/platform/types.ts +3 -3
- package/src/runtime/AgentXRuntime.ts +15 -15
- package/src/runtime/__tests__/AgentXRuntime.test.ts +5 -5
- package/src/runtime/index.ts +5 -6
- package/src/runtime/types.ts +1 -1
- package/src/session/index.ts +2 -3
- package/dist/chunk-23UUBQXR.js.map +0 -1
- package/dist/chunk-DEAR6N3O.js.map +0 -1
- package/dist/chunk-LTVNPHST.js.map +0 -1
|
@@ -13,38 +13,35 @@ import type { SystemEvent } from "./base";
|
|
|
13
13
|
/**
|
|
14
14
|
* Base SessionLifecycleEvent
|
|
15
15
|
*/
|
|
16
|
-
interface BaseSessionLifecycleEvent<T extends string, D = unknown>
|
|
17
|
-
T,
|
|
18
|
-
D,
|
|
19
|
-
"session",
|
|
20
|
-
"lifecycle",
|
|
21
|
-
"notification"
|
|
22
|
-
> {}
|
|
16
|
+
interface BaseSessionLifecycleEvent<T extends string, D = unknown>
|
|
17
|
+
extends SystemEvent<T, D, "session", "lifecycle", "notification"> {}
|
|
23
18
|
|
|
24
19
|
/**
|
|
25
20
|
* SessionCreatedEvent - Session was created
|
|
26
21
|
*/
|
|
27
|
-
export interface SessionCreatedEvent
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
22
|
+
export interface SessionCreatedEvent
|
|
23
|
+
extends BaseSessionLifecycleEvent<
|
|
24
|
+
"session_created",
|
|
25
|
+
{
|
|
26
|
+
sessionId: string;
|
|
27
|
+
imageId: string;
|
|
28
|
+
containerId: string;
|
|
29
|
+
title?: string;
|
|
30
|
+
createdAt: number;
|
|
31
|
+
}
|
|
32
|
+
> {}
|
|
37
33
|
|
|
38
34
|
/**
|
|
39
35
|
* SessionDestroyedEvent - Session was destroyed
|
|
40
36
|
*/
|
|
41
|
-
export interface SessionDestroyedEvent
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
37
|
+
export interface SessionDestroyedEvent
|
|
38
|
+
extends BaseSessionLifecycleEvent<
|
|
39
|
+
"session_destroyed",
|
|
40
|
+
{
|
|
41
|
+
sessionId: string;
|
|
42
|
+
reason?: string;
|
|
43
|
+
}
|
|
44
|
+
> {}
|
|
48
45
|
|
|
49
46
|
/**
|
|
50
47
|
* SessionLifecycleEvent - All session lifecycle events
|
|
@@ -68,72 +65,66 @@ export function isSessionLifecycleEvent(event: {
|
|
|
68
65
|
/**
|
|
69
66
|
* Base SessionPersistRequest
|
|
70
67
|
*/
|
|
71
|
-
interface BaseSessionPersistRequest<T extends string, D = unknown>
|
|
72
|
-
T,
|
|
73
|
-
D,
|
|
74
|
-
"session",
|
|
75
|
-
"persist",
|
|
76
|
-
"request"
|
|
77
|
-
> {}
|
|
68
|
+
interface BaseSessionPersistRequest<T extends string, D = unknown>
|
|
69
|
+
extends SystemEvent<T, D, "session", "persist", "request"> {}
|
|
78
70
|
|
|
79
71
|
/**
|
|
80
72
|
* Base SessionPersistResult
|
|
81
73
|
*/
|
|
82
|
-
interface BaseSessionPersistResult<T extends string, D = unknown>
|
|
83
|
-
T,
|
|
84
|
-
D,
|
|
85
|
-
"session",
|
|
86
|
-
"persist",
|
|
87
|
-
"result"
|
|
88
|
-
> {}
|
|
74
|
+
interface BaseSessionPersistResult<T extends string, D = unknown>
|
|
75
|
+
extends SystemEvent<T, D, "session", "persist", "result"> {}
|
|
89
76
|
|
|
90
77
|
/**
|
|
91
78
|
* SessionSaveRequest - Request to save session
|
|
92
79
|
*/
|
|
93
|
-
export interface SessionSaveRequest
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
80
|
+
export interface SessionSaveRequest
|
|
81
|
+
extends BaseSessionPersistRequest<
|
|
82
|
+
"session_save_request",
|
|
83
|
+
{
|
|
84
|
+
sessionId: string;
|
|
85
|
+
title?: string;
|
|
86
|
+
metadata?: Record<string, unknown>;
|
|
87
|
+
}
|
|
88
|
+
> {}
|
|
101
89
|
|
|
102
90
|
/**
|
|
103
91
|
* SessionSavedEvent - Session was saved
|
|
104
92
|
*/
|
|
105
|
-
export interface SessionSavedEvent
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
93
|
+
export interface SessionSavedEvent
|
|
94
|
+
extends BaseSessionPersistResult<
|
|
95
|
+
"session_saved",
|
|
96
|
+
{
|
|
97
|
+
sessionId: string;
|
|
98
|
+
savedAt: number;
|
|
99
|
+
}
|
|
100
|
+
> {}
|
|
112
101
|
|
|
113
102
|
/**
|
|
114
103
|
* MessagePersistRequest - Request to persist a message
|
|
115
104
|
*/
|
|
116
|
-
export interface MessagePersistRequest
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
105
|
+
export interface MessagePersistRequest
|
|
106
|
+
extends BaseSessionPersistRequest<
|
|
107
|
+
"message_persist_request",
|
|
108
|
+
{
|
|
109
|
+
sessionId: string;
|
|
110
|
+
messageId: string;
|
|
111
|
+
role: "user" | "assistant" | "tool_call" | "tool_result";
|
|
112
|
+
content: unknown;
|
|
113
|
+
}
|
|
114
|
+
> {}
|
|
125
115
|
|
|
126
116
|
/**
|
|
127
117
|
* MessagePersistedEvent - Message was persisted
|
|
128
118
|
*/
|
|
129
|
-
export interface MessagePersistedEvent
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
119
|
+
export interface MessagePersistedEvent
|
|
120
|
+
extends BaseSessionPersistResult<
|
|
121
|
+
"message_persisted",
|
|
122
|
+
{
|
|
123
|
+
sessionId: string;
|
|
124
|
+
messageId: string;
|
|
125
|
+
savedAt: number;
|
|
126
|
+
}
|
|
127
|
+
> {}
|
|
137
128
|
|
|
138
129
|
/**
|
|
139
130
|
* SessionPersistEvent - All session persist events
|
|
@@ -171,94 +162,90 @@ export function isSessionPersistEvent(event: {
|
|
|
171
162
|
/**
|
|
172
163
|
* Base SessionActionRequest
|
|
173
164
|
*/
|
|
174
|
-
interface BaseSessionActionRequest<T extends string, D = unknown>
|
|
175
|
-
T,
|
|
176
|
-
D,
|
|
177
|
-
"session",
|
|
178
|
-
"action",
|
|
179
|
-
"request"
|
|
180
|
-
> {}
|
|
165
|
+
interface BaseSessionActionRequest<T extends string, D = unknown>
|
|
166
|
+
extends SystemEvent<T, D, "session", "action", "request"> {}
|
|
181
167
|
|
|
182
168
|
/**
|
|
183
169
|
* Base SessionActionResult
|
|
184
170
|
*/
|
|
185
|
-
interface BaseSessionActionResult<T extends string, D = unknown>
|
|
186
|
-
T,
|
|
187
|
-
D,
|
|
188
|
-
"session",
|
|
189
|
-
"action",
|
|
190
|
-
"result"
|
|
191
|
-
> {}
|
|
171
|
+
interface BaseSessionActionResult<T extends string, D = unknown>
|
|
172
|
+
extends SystemEvent<T, D, "session", "action", "result"> {}
|
|
192
173
|
|
|
193
174
|
/**
|
|
194
175
|
* SessionResumeRequest - Request to resume a session
|
|
195
176
|
*/
|
|
196
|
-
export interface SessionResumeRequest
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
177
|
+
export interface SessionResumeRequest
|
|
178
|
+
extends BaseSessionActionRequest<
|
|
179
|
+
"session_resume_request",
|
|
180
|
+
{
|
|
181
|
+
sessionId: string;
|
|
182
|
+
containerId?: string;
|
|
183
|
+
}
|
|
184
|
+
> {}
|
|
203
185
|
|
|
204
186
|
/**
|
|
205
187
|
* SessionResumedEvent - Session was resumed
|
|
206
188
|
*/
|
|
207
|
-
export interface SessionResumedEvent
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
189
|
+
export interface SessionResumedEvent
|
|
190
|
+
extends BaseSessionActionResult<
|
|
191
|
+
"session_resumed",
|
|
192
|
+
{
|
|
193
|
+
sessionId: string;
|
|
194
|
+
agentId: string;
|
|
195
|
+
resumedAt: number;
|
|
196
|
+
}
|
|
197
|
+
> {}
|
|
215
198
|
|
|
216
199
|
/**
|
|
217
200
|
* SessionForkRequest - Request to fork a session
|
|
218
201
|
*/
|
|
219
|
-
export interface SessionForkRequest
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
202
|
+
export interface SessionForkRequest
|
|
203
|
+
extends BaseSessionActionRequest<
|
|
204
|
+
"session_fork_request",
|
|
205
|
+
{
|
|
206
|
+
sessionId: string;
|
|
207
|
+
newTitle?: string;
|
|
208
|
+
}
|
|
209
|
+
> {}
|
|
226
210
|
|
|
227
211
|
/**
|
|
228
212
|
* SessionForkedEvent - Session was forked
|
|
229
213
|
*/
|
|
230
|
-
export interface SessionForkedEvent
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
214
|
+
export interface SessionForkedEvent
|
|
215
|
+
extends BaseSessionActionResult<
|
|
216
|
+
"session_forked",
|
|
217
|
+
{
|
|
218
|
+
originalSessionId: string;
|
|
219
|
+
newSessionId: string;
|
|
220
|
+
newImageId: string;
|
|
221
|
+
forkedAt: number;
|
|
222
|
+
}
|
|
223
|
+
> {}
|
|
239
224
|
|
|
240
225
|
/**
|
|
241
226
|
* SessionTitleUpdateRequest - Request to update session title
|
|
242
227
|
*/
|
|
243
|
-
export interface SessionTitleUpdateRequest
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
228
|
+
export interface SessionTitleUpdateRequest
|
|
229
|
+
extends BaseSessionActionRequest<
|
|
230
|
+
"session_title_update_request",
|
|
231
|
+
{
|
|
232
|
+
sessionId: string;
|
|
233
|
+
title: string;
|
|
234
|
+
}
|
|
235
|
+
> {}
|
|
250
236
|
|
|
251
237
|
/**
|
|
252
238
|
* SessionTitleUpdatedEvent - Session title was updated
|
|
253
239
|
*/
|
|
254
|
-
export interface SessionTitleUpdatedEvent
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
240
|
+
export interface SessionTitleUpdatedEvent
|
|
241
|
+
extends BaseSessionActionResult<
|
|
242
|
+
"session_title_updated",
|
|
243
|
+
{
|
|
244
|
+
sessionId: string;
|
|
245
|
+
title: string;
|
|
246
|
+
updatedAt: number;
|
|
247
|
+
}
|
|
248
|
+
> {}
|
|
262
249
|
|
|
263
250
|
/**
|
|
264
251
|
* SessionActionEvent - All session action events
|
package/src/image/Image.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { createLogger } from "commonxjs/logger";
|
|
9
|
-
import type { Image,
|
|
9
|
+
import type { Image, ImageContext, ImageCreateConfig, ImageRecord } from "./types";
|
|
10
10
|
|
|
11
11
|
const logger = createLogger("image/Image");
|
|
12
12
|
|
package/src/image/index.ts
CHANGED
|
@@ -24,13 +24,12 @@
|
|
|
24
24
|
* ```
|
|
25
25
|
*/
|
|
26
26
|
|
|
27
|
+
export { createImage, ImageImpl, loadImage } from "./Image";
|
|
27
28
|
export type {
|
|
28
|
-
ImageMetadata,
|
|
29
|
-
ImageRecord,
|
|
30
|
-
ImageRepository,
|
|
31
29
|
Image,
|
|
32
30
|
ImageContext,
|
|
33
31
|
ImageCreateConfig,
|
|
32
|
+
ImageMetadata,
|
|
33
|
+
ImageRecord,
|
|
34
|
+
ImageRepository,
|
|
34
35
|
} from "./types";
|
|
35
|
-
|
|
36
|
-
export { ImageImpl, createImage, loadImage } from "./Image";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* OffsetGenerator.test.ts - Unit tests for OffsetGenerator
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { beforeEach, describe, expect, it } from "bun:test";
|
|
6
6
|
import { OffsetGenerator } from "../OffsetGenerator";
|
|
7
7
|
|
|
8
8
|
describe("OffsetGenerator", () => {
|
package/src/mq/index.ts
CHANGED
|
@@ -7,12 +7,11 @@
|
|
|
7
7
|
* - OffsetGenerator: Utility for generating monotonic offsets
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
+
export { OffsetGenerator } from "./OffsetGenerator";
|
|
10
11
|
export type {
|
|
11
|
-
QueueEntry,
|
|
12
|
-
QueueConfig,
|
|
13
|
-
Unsubscribe,
|
|
14
12
|
MessageQueue,
|
|
15
13
|
MessageQueueProvider,
|
|
14
|
+
QueueConfig,
|
|
15
|
+
QueueEntry,
|
|
16
|
+
Unsubscribe,
|
|
16
17
|
} from "./types";
|
|
17
|
-
|
|
18
|
-
export { OffsetGenerator } from "./OffsetGenerator";
|
package/src/network/RpcClient.ts
CHANGED
|
@@ -25,19 +25,19 @@
|
|
|
25
25
|
* ```
|
|
26
26
|
*/
|
|
27
27
|
|
|
28
|
+
import type { SystemEvent } from "../event/types/base";
|
|
28
29
|
import {
|
|
29
|
-
createRequest,
|
|
30
30
|
createNotification,
|
|
31
|
-
|
|
32
|
-
isSuccessResponse,
|
|
31
|
+
createRequest,
|
|
33
32
|
isErrorResponse,
|
|
34
33
|
isNotification,
|
|
35
34
|
isStreamEvent,
|
|
36
|
-
|
|
35
|
+
isSuccessResponse,
|
|
37
36
|
type NotificationMethod,
|
|
37
|
+
parseMessage,
|
|
38
|
+
type RpcMethod,
|
|
38
39
|
type StreamEventParams,
|
|
39
40
|
} from "./jsonrpc";
|
|
40
|
-
import type { SystemEvent } from "../event/types/base";
|
|
41
41
|
|
|
42
42
|
// ============================================================================
|
|
43
43
|
// Types
|
package/src/network/index.ts
CHANGED
|
@@ -12,65 +12,62 @@
|
|
|
12
12
|
* - @agentxjs/cloudflare: Durable Objects WebSocket
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
// Types
|
|
16
|
-
export type {
|
|
17
|
-
Unsubscribe,
|
|
18
|
-
MinimalHTTPServer,
|
|
19
|
-
SendReliableOptions,
|
|
20
|
-
ConnectionState,
|
|
21
|
-
ChannelConnection,
|
|
22
|
-
ChannelServer,
|
|
23
|
-
ChannelServerOptions,
|
|
24
|
-
ChannelClient,
|
|
25
|
-
ChannelClientOptions,
|
|
26
|
-
ChannelServerProvider,
|
|
27
|
-
ChannelClientProvider,
|
|
28
|
-
} from "./types";
|
|
29
|
-
|
|
30
|
-
// Protocol (reliable delivery)
|
|
31
|
-
export type { ReliableWrapper, AckMessage } from "./protocol";
|
|
32
|
-
export {
|
|
33
|
-
isReliableWrapper,
|
|
34
|
-
isAckMessage,
|
|
35
|
-
wrapMessage,
|
|
36
|
-
createAck,
|
|
37
|
-
unwrapMessage,
|
|
38
|
-
generateMessageId,
|
|
39
|
-
} from "./protocol";
|
|
40
|
-
|
|
41
15
|
// JSON-RPC 2.0 Protocol
|
|
42
16
|
export type {
|
|
43
|
-
|
|
17
|
+
ControlAckParams,
|
|
44
18
|
NotificationMethod,
|
|
45
|
-
RpcRequest,
|
|
46
|
-
RpcSuccessResponse,
|
|
47
19
|
RpcErrorResponse,
|
|
20
|
+
RpcMethod,
|
|
48
21
|
RpcNotification,
|
|
22
|
+
RpcRequest,
|
|
23
|
+
RpcSuccessResponse,
|
|
49
24
|
StreamEventParams,
|
|
50
|
-
ControlAckParams,
|
|
51
25
|
} from "./jsonrpc";
|
|
52
26
|
export {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
createRequest,
|
|
27
|
+
createAckNotification,
|
|
28
|
+
createErrorResponse,
|
|
56
29
|
createNotification,
|
|
30
|
+
createRequest,
|
|
57
31
|
createStreamEvent,
|
|
58
|
-
createAckNotification,
|
|
59
32
|
createSuccessResponse,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
parseMessageObject,
|
|
63
|
-
isRequest,
|
|
64
|
-
isNotification,
|
|
65
|
-
isSuccessResponse,
|
|
33
|
+
eventTypeToRpcMethod,
|
|
34
|
+
isControlAck,
|
|
66
35
|
isErrorResponse,
|
|
67
36
|
isInvalid,
|
|
37
|
+
isNotification,
|
|
38
|
+
isRequest,
|
|
68
39
|
isStreamEvent,
|
|
69
|
-
|
|
70
|
-
|
|
40
|
+
isSuccessResponse,
|
|
41
|
+
JsonRpcError,
|
|
42
|
+
parseMessage,
|
|
43
|
+
parseMessageObject,
|
|
44
|
+
RpcErrorCodes,
|
|
71
45
|
rpcMethodToResponseType,
|
|
72
46
|
} from "./jsonrpc";
|
|
73
|
-
|
|
47
|
+
// Protocol (reliable delivery)
|
|
48
|
+
export type { AckMessage, ReliableWrapper } from "./protocol";
|
|
49
|
+
export {
|
|
50
|
+
createAck,
|
|
51
|
+
generateMessageId,
|
|
52
|
+
isAckMessage,
|
|
53
|
+
isReliableWrapper,
|
|
54
|
+
unwrapMessage,
|
|
55
|
+
wrapMessage,
|
|
56
|
+
} from "./protocol";
|
|
74
57
|
// RPC Client
|
|
75
58
|
export type { RpcClientConfig, RpcClientState, WebSocketFactory } from "./RpcClient";
|
|
76
59
|
export { RpcClient } from "./RpcClient";
|
|
60
|
+
// Types
|
|
61
|
+
export type {
|
|
62
|
+
ChannelClient,
|
|
63
|
+
ChannelClientOptions,
|
|
64
|
+
ChannelClientProvider,
|
|
65
|
+
ChannelConnection,
|
|
66
|
+
ChannelServer,
|
|
67
|
+
ChannelServerOptions,
|
|
68
|
+
ChannelServerProvider,
|
|
69
|
+
ConnectionState,
|
|
70
|
+
MinimalHTTPServer,
|
|
71
|
+
SendReliableOptions,
|
|
72
|
+
Unsubscribe,
|
|
73
|
+
} from "./types";
|
package/src/network/jsonrpc.ts
CHANGED
|
@@ -11,16 +11,16 @@
|
|
|
11
11
|
* @see https://www.jsonrpc.org/specification
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
+
import type { IParsedObject, JsonRpc } from "jsonrpc-lite";
|
|
14
15
|
import {
|
|
15
|
-
|
|
16
|
-
notification as jsonrpcNotification,
|
|
17
|
-
success as jsonrpcSuccess,
|
|
16
|
+
JsonRpcError,
|
|
18
17
|
error as jsonrpcError,
|
|
18
|
+
notification as jsonrpcNotification,
|
|
19
19
|
parse as jsonrpcParse,
|
|
20
20
|
parseObject as jsonrpcParseObject,
|
|
21
|
-
|
|
21
|
+
request as jsonrpcRequest,
|
|
22
|
+
success as jsonrpcSuccess,
|
|
22
23
|
} from "jsonrpc-lite";
|
|
23
|
-
import type { IParsedObject, JsonRpc } from "jsonrpc-lite";
|
|
24
24
|
import type { SystemEvent } from "../event/types/base";
|
|
25
25
|
|
|
26
26
|
// ============================================================================
|
package/src/persistence/index.ts
CHANGED
|
@@ -12,16 +12,16 @@
|
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
export type {
|
|
15
|
-
// Config types
|
|
16
|
-
McpServerConfig,
|
|
17
15
|
ContainerConfig,
|
|
18
|
-
ImageMetadata,
|
|
19
16
|
// Record types
|
|
20
17
|
ContainerRecord,
|
|
21
|
-
ImageRecord,
|
|
22
|
-
SessionRecord,
|
|
23
18
|
// Repository interfaces
|
|
24
19
|
ContainerRepository,
|
|
20
|
+
ImageMetadata,
|
|
21
|
+
ImageRecord,
|
|
25
22
|
ImageRepository,
|
|
23
|
+
// Config types
|
|
24
|
+
McpServerConfig,
|
|
25
|
+
SessionRecord,
|
|
26
26
|
SessionRepository,
|
|
27
27
|
} from "./types";
|
package/src/platform/types.ts
CHANGED
|
@@ -19,12 +19,12 @@
|
|
|
19
19
|
* ```
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
|
+
import type { BashProvider } from "../bash/types";
|
|
22
23
|
import type { ContainerRepository } from "../container/types";
|
|
23
|
-
import type { ImageRepository } from "../image/types";
|
|
24
|
-
import type { SessionRepository } from "../session/types";
|
|
25
24
|
import type { EventBus } from "../event/types";
|
|
26
|
-
import type {
|
|
25
|
+
import type { ImageRepository } from "../image/types";
|
|
27
26
|
import type { WebSocketFactory } from "../network/RpcClient";
|
|
27
|
+
import type { SessionRepository } from "../session/types";
|
|
28
28
|
|
|
29
29
|
// ============================================================================
|
|
30
30
|
// AgentXPlatform - Dependency Injection
|
|
@@ -12,26 +12,18 @@
|
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
import { createLogger } from "commonxjs/logger";
|
|
15
|
+
import { createAgent as createAgentEngine } from "../agent/createAgent";
|
|
15
16
|
import type {
|
|
16
|
-
AgentXPlatform,
|
|
17
|
-
AgentXRuntime,
|
|
18
|
-
RuntimeAgent,
|
|
19
|
-
CreateAgentOptions,
|
|
20
|
-
AgentEventHandler,
|
|
21
|
-
Subscription,
|
|
22
|
-
AgentLifecycle,
|
|
23
|
-
} from "./types";
|
|
24
|
-
import type {
|
|
25
|
-
UserContentPart,
|
|
26
|
-
UserMessage,
|
|
27
17
|
AgentEngine,
|
|
28
|
-
StreamEvent,
|
|
29
18
|
AgentOutput,
|
|
30
19
|
AgentPresenter,
|
|
31
20
|
AgentSource,
|
|
32
21
|
Message,
|
|
22
|
+
StreamEvent,
|
|
23
|
+
UserContentPart,
|
|
24
|
+
UserMessage,
|
|
33
25
|
} from "../agent/types";
|
|
34
|
-
import
|
|
26
|
+
import { createBashTool } from "../bash/tool";
|
|
35
27
|
import type {
|
|
36
28
|
CreateDriver,
|
|
37
29
|
Driver,
|
|
@@ -39,9 +31,17 @@ import type {
|
|
|
39
31
|
DriverStreamEvent,
|
|
40
32
|
ToolDefinition,
|
|
41
33
|
} from "../driver/types";
|
|
34
|
+
import type { BusEvent } from "../event/types";
|
|
42
35
|
import { createSession } from "../session/Session";
|
|
43
|
-
import {
|
|
44
|
-
|
|
36
|
+
import type {
|
|
37
|
+
AgentEventHandler,
|
|
38
|
+
AgentLifecycle,
|
|
39
|
+
AgentXPlatform,
|
|
40
|
+
AgentXRuntime,
|
|
41
|
+
CreateAgentOptions,
|
|
42
|
+
RuntimeAgent,
|
|
43
|
+
Subscription,
|
|
44
|
+
} from "./types";
|
|
45
45
|
|
|
46
46
|
const logger = createLogger("runtime/AgentXRuntime");
|
|
47
47
|
|
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
* - Message persistence (user + assistant + tool messages)
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
import {
|
|
13
|
-
import { createAgentXRuntime } from "../AgentXRuntime";
|
|
14
|
-
import { EventBusImpl as EventBus } from "../../event/EventBus";
|
|
15
|
-
import type { AgentXPlatform } from "../../platform/types";
|
|
12
|
+
import { afterEach, describe, expect, it } from "bun:test";
|
|
16
13
|
import type { Message } from "../../agent/types";
|
|
17
|
-
import type { BusEvent } from "../../event/types";
|
|
18
14
|
import type { DriverStreamEvent } from "../../driver/types";
|
|
15
|
+
import { EventBusImpl as EventBus } from "../../event/EventBus";
|
|
16
|
+
import type { BusEvent } from "../../event/types";
|
|
17
|
+
import type { AgentXPlatform } from "../../platform/types";
|
|
18
|
+
import { createAgentXRuntime } from "../AgentXRuntime";
|
|
19
19
|
|
|
20
20
|
// ============================================================================
|
|
21
21
|
// Mock Helpers
|
package/src/runtime/index.ts
CHANGED
|
@@ -29,16 +29,15 @@
|
|
|
29
29
|
* ```
|
|
30
30
|
*/
|
|
31
31
|
|
|
32
|
+
export { AgentXRuntimeImpl, createAgentXRuntime } from "./AgentXRuntime";
|
|
32
33
|
export type {
|
|
34
|
+
AgentEventHandler,
|
|
33
35
|
AgentLifecycle,
|
|
34
|
-
RuntimeAgent,
|
|
35
36
|
AgentXPlatform,
|
|
36
|
-
CreateAgentOptions,
|
|
37
|
-
AgentEventHandler,
|
|
38
|
-
Subscription,
|
|
39
37
|
AgentXRuntime,
|
|
40
38
|
AgentXRuntimeConfig,
|
|
39
|
+
CreateAgentOptions,
|
|
41
40
|
CreateAgentXRuntime,
|
|
41
|
+
RuntimeAgent,
|
|
42
|
+
Subscription,
|
|
42
43
|
} from "./types";
|
|
43
|
-
|
|
44
|
-
export { AgentXRuntimeImpl, createAgentXRuntime } from "./AgentXRuntime";
|