@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
|
@@ -18,25 +18,25 @@
|
|
|
18
18
|
* - tool_executing
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
|
-
import
|
|
21
|
+
import { createLogger } from "commonxjs/logger";
|
|
22
22
|
import type {
|
|
23
|
+
ConversationEndEvent,
|
|
24
|
+
ConversationInterruptedEvent,
|
|
25
|
+
ConversationRespondingEvent,
|
|
26
|
+
// Output: State events
|
|
27
|
+
ConversationStartEvent,
|
|
23
28
|
// Base type
|
|
24
29
|
EngineEvent,
|
|
25
|
-
|
|
26
|
-
StreamEvent,
|
|
30
|
+
ErrorOccurredEvent,
|
|
27
31
|
MessageStartEvent,
|
|
28
32
|
MessageStopEvent,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
ConversationStartEvent,
|
|
32
|
-
ConversationRespondingEvent,
|
|
33
|
-
ConversationEndEvent,
|
|
34
|
-
ConversationInterruptedEvent,
|
|
35
|
-
ToolPlannedEvent,
|
|
33
|
+
// Input: StreamEvent (from agent layer)
|
|
34
|
+
StreamEvent,
|
|
36
35
|
ToolExecutingEvent,
|
|
37
|
-
|
|
36
|
+
ToolPlannedEvent,
|
|
37
|
+
ToolUseStartEvent,
|
|
38
38
|
} from "../../types";
|
|
39
|
-
import {
|
|
39
|
+
import type { Processor, ProcessorDefinition } from "../mealy";
|
|
40
40
|
|
|
41
41
|
const logger = createLogger("engine/stateEventProcessor");
|
|
42
42
|
|
|
@@ -50,9 +50,7 @@ const logger = createLogger("engine/stateEventProcessor");
|
|
|
50
50
|
*
|
|
51
51
|
* Currently empty - no context needed as all information comes from events.
|
|
52
52
|
*/
|
|
53
|
-
export
|
|
54
|
-
// Empty - all information comes from events
|
|
55
|
-
}
|
|
53
|
+
export type StateEventProcessorContext = {};
|
|
56
54
|
|
|
57
55
|
/**
|
|
58
56
|
* Initial context factory for StateEventProcessor
|
|
@@ -13,17 +13,17 @@
|
|
|
13
13
|
* - turn_response
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
-
import type { Processor, ProcessorDefinition } from "../mealy";
|
|
17
16
|
import type {
|
|
18
|
-
StreamEvent,
|
|
19
17
|
MessageStartEvent,
|
|
20
18
|
MessageStopEvent,
|
|
19
|
+
StreamEvent,
|
|
20
|
+
// Data types
|
|
21
|
+
TokenUsage,
|
|
21
22
|
// Output: Turn events
|
|
22
23
|
TurnRequestEvent,
|
|
23
24
|
TurnResponseEvent,
|
|
24
|
-
// Data types
|
|
25
|
-
TokenUsage,
|
|
26
25
|
} from "../../types";
|
|
26
|
+
import type { Processor, ProcessorDefinition } from "../mealy";
|
|
27
27
|
|
|
28
28
|
// ===== State Types =====
|
|
29
29
|
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
* ```
|
|
32
32
|
*/
|
|
33
33
|
|
|
34
|
+
import { createLogger } from "commonxjs/logger";
|
|
34
35
|
import type { Processor } from "./Processor";
|
|
35
|
-
import type { Store } from "./Store";
|
|
36
36
|
import type { Sink, SinkDefinition } from "./Sink";
|
|
37
|
-
import {
|
|
37
|
+
import type { Store } from "./Store";
|
|
38
38
|
|
|
39
39
|
const logger = createLogger("engine/Mealy");
|
|
40
40
|
|
|
@@ -28,13 +28,11 @@ import type { Processor } from "./Processor";
|
|
|
28
28
|
* });
|
|
29
29
|
* ```
|
|
30
30
|
*/
|
|
31
|
-
export function combineProcessors<
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
[K in keyof TState]: Processor<TState[K], TInput, TOutput>;
|
|
37
|
-
}): Processor<TState, TInput, TOutput> {
|
|
31
|
+
export function combineProcessors<TState extends Record<string, unknown>, TInput, TOutput>(
|
|
32
|
+
processors: {
|
|
33
|
+
[K in keyof TState]: Processor<TState[K], TInput, TOutput>;
|
|
34
|
+
}
|
|
35
|
+
): Processor<TState, TInput, TOutput> {
|
|
38
36
|
return (state: Readonly<TState>, event: TInput): [TState, TOutput[]] => {
|
|
39
37
|
const newState = {} as TState;
|
|
40
38
|
const allOutputs: TOutput[] = [];
|
|
@@ -55,9 +53,11 @@ export function combineProcessors<
|
|
|
55
53
|
/**
|
|
56
54
|
* combineInitialStates - Helper to create initial state for combined processors
|
|
57
55
|
*/
|
|
58
|
-
export function combineInitialStates<TState extends Record<string, unknown>>(
|
|
59
|
-
|
|
60
|
-
|
|
56
|
+
export function combineInitialStates<TState extends Record<string, unknown>>(
|
|
57
|
+
initialStates: {
|
|
58
|
+
[K in keyof TState]: () => TState[K];
|
|
59
|
+
}
|
|
60
|
+
): () => TState {
|
|
61
61
|
return () => {
|
|
62
62
|
const state = {} as TState;
|
|
63
63
|
for (const key in initialStates) {
|
|
@@ -16,30 +16,28 @@
|
|
|
16
16
|
|
|
17
17
|
// ===== Core Components =====
|
|
18
18
|
|
|
19
|
-
// Source - Input (input adapter)
|
|
20
|
-
export { type Source, type SourceDefinition } from "./Source";
|
|
21
|
-
|
|
22
19
|
// Processor - Processing (pure Mealy transition function)
|
|
23
|
-
export {
|
|
24
|
-
|
|
20
|
+
export type { Processor, ProcessorDefinition, ProcessorResult } from "./Processor";
|
|
25
21
|
// Sink - Output (output adapter)
|
|
26
|
-
export {
|
|
22
|
+
export type { Sink, SinkDefinition } from "./Sink";
|
|
23
|
+
// Source - Input (input adapter)
|
|
24
|
+
export type { Source, SourceDefinition } from "./Source";
|
|
27
25
|
|
|
28
26
|
// Store - State storage
|
|
29
|
-
export { type Store
|
|
27
|
+
export { MemoryStore, type Store } from "./Store";
|
|
30
28
|
|
|
31
29
|
// ===== Mealy Runtime =====
|
|
32
30
|
|
|
33
|
-
export {
|
|
31
|
+
export { createMealy, Mealy, type MealyConfig, type ProcessResult } from "./Mealy";
|
|
34
32
|
|
|
35
33
|
// ===== Combinators =====
|
|
36
34
|
|
|
37
35
|
export {
|
|
38
|
-
combineProcessors,
|
|
39
|
-
combineInitialStates,
|
|
40
36
|
chainProcessors,
|
|
37
|
+
combineInitialStates,
|
|
38
|
+
combineProcessors,
|
|
41
39
|
filterProcessor,
|
|
40
|
+
identityProcessor,
|
|
42
41
|
mapOutput,
|
|
43
42
|
withLogging,
|
|
44
|
-
identityProcessor,
|
|
45
43
|
} from "./combinators";
|
package/src/agent/index.ts
CHANGED
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
// Core API
|
|
31
31
|
// ============================================================================
|
|
32
32
|
|
|
33
|
-
export { createAgent } from "./createAgent";
|
|
34
33
|
export { AgentStateMachine } from "./AgentStateMachine";
|
|
34
|
+
export { createAgent } from "./createAgent";
|
|
35
35
|
export type { AgentEngine, CreateAgentOptions } from "./types";
|
|
36
36
|
|
|
37
37
|
// ============================================================================
|
|
@@ -44,63 +44,61 @@ export * from "./types";
|
|
|
44
44
|
// Engine (Stateless)
|
|
45
45
|
// ============================================================================
|
|
46
46
|
|
|
47
|
-
// MealyMachine
|
|
48
|
-
export { MealyMachine, createMealyMachine } from "./engine/MealyMachine";
|
|
49
|
-
|
|
50
47
|
// AgentProcessor (for advanced use cases)
|
|
51
48
|
export {
|
|
52
|
-
agentProcessor,
|
|
53
|
-
createInitialAgentEngineState,
|
|
54
49
|
type AgentEngineState,
|
|
55
50
|
type AgentProcessorInput,
|
|
56
51
|
type AgentProcessorOutput,
|
|
52
|
+
agentProcessor,
|
|
53
|
+
createInitialAgentEngineState,
|
|
57
54
|
} from "./engine/AgentProcessor";
|
|
58
|
-
|
|
59
55
|
// Internal Processors (for advanced use cases)
|
|
60
56
|
export {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
57
|
+
createInitialMessageAssemblerState,
|
|
58
|
+
createInitialStateEventProcessorContext,
|
|
59
|
+
createInitialTurnTrackerState,
|
|
64
60
|
type MessageAssemblerInput,
|
|
65
61
|
type MessageAssemblerOutput,
|
|
66
62
|
type MessageAssemblerState,
|
|
63
|
+
// MessageAssembler
|
|
64
|
+
messageAssemblerProcessor,
|
|
65
|
+
messageAssemblerProcessorDef,
|
|
67
66
|
type PendingContent,
|
|
68
|
-
|
|
67
|
+
type PendingTurn,
|
|
68
|
+
type StateEventProcessorContext,
|
|
69
|
+
type StateEventProcessorInput,
|
|
70
|
+
type StateEventProcessorOutput,
|
|
69
71
|
// StateEventProcessor
|
|
70
72
|
stateEventProcessor,
|
|
71
73
|
stateEventProcessorDef,
|
|
72
|
-
type StateEventProcessorInput,
|
|
73
|
-
type StateEventProcessorOutput,
|
|
74
|
-
type StateEventProcessorContext,
|
|
75
|
-
createInitialStateEventProcessorContext,
|
|
76
|
-
// TurnTracker
|
|
77
|
-
turnTrackerProcessor,
|
|
78
|
-
turnTrackerProcessorDef,
|
|
79
74
|
type TurnTrackerInput,
|
|
80
75
|
type TurnTrackerOutput,
|
|
81
76
|
type TurnTrackerState,
|
|
82
|
-
|
|
83
|
-
|
|
77
|
+
// TurnTracker
|
|
78
|
+
turnTrackerProcessor,
|
|
79
|
+
turnTrackerProcessorDef,
|
|
84
80
|
} from "./engine/internal";
|
|
81
|
+
// MealyMachine
|
|
82
|
+
export { createMealyMachine, MealyMachine } from "./engine/MealyMachine";
|
|
85
83
|
|
|
86
84
|
// Mealy Machine Core (for building custom processors)
|
|
87
85
|
export {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
86
|
+
chainProcessors,
|
|
87
|
+
combineInitialStates,
|
|
88
|
+
// Combinators
|
|
89
|
+
combineProcessors,
|
|
90
|
+
filterProcessor,
|
|
91
|
+
identityProcessor,
|
|
92
|
+
MemoryStore,
|
|
93
|
+
mapOutput,
|
|
91
94
|
type Processor,
|
|
92
|
-
type ProcessorResult,
|
|
93
95
|
type ProcessorDefinition,
|
|
96
|
+
type ProcessorResult,
|
|
94
97
|
type Sink,
|
|
95
98
|
type SinkDefinition,
|
|
99
|
+
// Core types
|
|
100
|
+
type Source,
|
|
101
|
+
type SourceDefinition,
|
|
96
102
|
type Store,
|
|
97
|
-
MemoryStore,
|
|
98
|
-
// Combinators
|
|
99
|
-
combineProcessors,
|
|
100
|
-
combineInitialStates,
|
|
101
|
-
chainProcessors,
|
|
102
|
-
filterProcessor,
|
|
103
|
-
mapOutput,
|
|
104
103
|
withLogging,
|
|
105
|
-
identityProcessor,
|
|
106
104
|
} from "./engine/mealy";
|
|
@@ -13,14 +13,14 @@
|
|
|
13
13
|
* @packageDocumentation
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
-
import type { UserMessage } from "./message";
|
|
17
16
|
import type {
|
|
18
|
-
AgentState,
|
|
19
17
|
AgentOutput,
|
|
18
|
+
AgentOutputCallback,
|
|
19
|
+
AgentState,
|
|
20
20
|
StreamEvent,
|
|
21
21
|
Unsubscribe,
|
|
22
|
-
AgentOutputCallback,
|
|
23
22
|
} from "./event";
|
|
23
|
+
import type { UserMessage } from "./message";
|
|
24
24
|
|
|
25
25
|
// =============================================================================
|
|
26
26
|
// Message Queue
|
package/src/agent/types/event.ts
CHANGED
|
@@ -13,11 +13,11 @@
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
import type {
|
|
16
|
-
UserMessage,
|
|
17
16
|
AssistantMessage,
|
|
18
|
-
ToolResultMessage,
|
|
19
17
|
ErrorMessage,
|
|
20
18
|
TokenUsage,
|
|
19
|
+
ToolResultMessage,
|
|
20
|
+
UserMessage,
|
|
21
21
|
} from "./message";
|
|
22
22
|
|
|
23
23
|
// =============================================================================
|
|
@@ -234,13 +234,9 @@ export interface ConversationStartData {
|
|
|
234
234
|
messageId: string;
|
|
235
235
|
}
|
|
236
236
|
|
|
237
|
-
export
|
|
238
|
-
// Empty
|
|
239
|
-
}
|
|
237
|
+
export type ConversationThinkingData = {};
|
|
240
238
|
|
|
241
|
-
export
|
|
242
|
-
// Empty
|
|
243
|
-
}
|
|
239
|
+
export type ConversationRespondingData = {};
|
|
244
240
|
|
|
245
241
|
export interface ConversationEndData {
|
|
246
242
|
reason: "completed" | "interrupted" | "error";
|
package/src/agent/types/index.ts
CHANGED
|
@@ -59,25 +59,25 @@
|
|
|
59
59
|
// =============================================================================
|
|
60
60
|
|
|
61
61
|
export type {
|
|
62
|
+
AssistantMessage,
|
|
63
|
+
ContentPart,
|
|
64
|
+
ErrorMessage,
|
|
65
|
+
FilePart,
|
|
66
|
+
ImagePart,
|
|
67
|
+
Message,
|
|
68
|
+
// Message Types
|
|
69
|
+
MessageRole,
|
|
70
|
+
MessageSubtype,
|
|
62
71
|
// Content Parts
|
|
63
72
|
TextPart,
|
|
64
73
|
ThinkingPart,
|
|
65
|
-
|
|
66
|
-
FilePart,
|
|
74
|
+
TokenUsage,
|
|
67
75
|
ToolCallPart,
|
|
76
|
+
ToolResultMessage,
|
|
68
77
|
ToolResultOutput,
|
|
69
78
|
ToolResultPart,
|
|
70
|
-
ContentPart,
|
|
71
79
|
UserContentPart,
|
|
72
|
-
// Message Types
|
|
73
|
-
MessageRole,
|
|
74
|
-
MessageSubtype,
|
|
75
|
-
TokenUsage,
|
|
76
80
|
UserMessage,
|
|
77
|
-
AssistantMessage,
|
|
78
|
-
ToolResultMessage,
|
|
79
|
-
ErrorMessage,
|
|
80
|
-
Message,
|
|
81
81
|
} from "./message";
|
|
82
82
|
|
|
83
83
|
// =============================================================================
|
|
@@ -85,111 +85,111 @@ export type {
|
|
|
85
85
|
// =============================================================================
|
|
86
86
|
|
|
87
87
|
export type {
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
AgentError,
|
|
89
|
+
AgentErrorCategory,
|
|
90
|
+
AgentErrorOccurredEvent,
|
|
90
91
|
AgentEvent,
|
|
92
|
+
AgentEventHandler,
|
|
93
|
+
AgentMessageEvent,
|
|
94
|
+
// Agent Output
|
|
95
|
+
AgentOutput,
|
|
96
|
+
AgentOutputCallback,
|
|
91
97
|
// Agent State and Error
|
|
92
98
|
AgentState,
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
StopReason,
|
|
97
|
-
MessageStartData,
|
|
98
|
-
MessageDeltaData,
|
|
99
|
-
MessageStopData,
|
|
100
|
-
TextDeltaData,
|
|
101
|
-
ToolUseStartData,
|
|
102
|
-
InputJsonDeltaData,
|
|
103
|
-
ToolUseStopData,
|
|
104
|
-
ToolResultData,
|
|
105
|
-
ErrorReceivedData,
|
|
106
|
-
MessageStartEvent,
|
|
107
|
-
MessageDeltaEvent,
|
|
108
|
-
MessageStopEvent,
|
|
109
|
-
TextDeltaEvent,
|
|
110
|
-
ToolUseStartEvent,
|
|
111
|
-
InputJsonDeltaEvent,
|
|
112
|
-
ToolUseStopEvent,
|
|
113
|
-
ToolResultEvent,
|
|
114
|
-
ErrorReceivedEvent,
|
|
115
|
-
StreamEvent,
|
|
116
|
-
StreamEventType,
|
|
117
|
-
// State Events
|
|
118
|
-
ConversationQueuedData,
|
|
119
|
-
ConversationStartData,
|
|
120
|
-
ConversationThinkingData,
|
|
121
|
-
ConversationRespondingData,
|
|
99
|
+
AgentStateEvent,
|
|
100
|
+
AgentTurnEvent,
|
|
101
|
+
AssistantMessageEvent,
|
|
122
102
|
ConversationEndData,
|
|
103
|
+
ConversationEndEvent,
|
|
123
104
|
ConversationInterruptedData,
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
ToolFailedData,
|
|
128
|
-
ErrorOccurredData,
|
|
129
|
-
StateEvent,
|
|
105
|
+
ConversationInterruptedEvent,
|
|
106
|
+
// State Events
|
|
107
|
+
ConversationQueuedData,
|
|
130
108
|
ConversationQueuedEvent,
|
|
109
|
+
ConversationRespondingData,
|
|
110
|
+
ConversationRespondingEvent,
|
|
111
|
+
ConversationStartData,
|
|
131
112
|
ConversationStartEvent,
|
|
113
|
+
ConversationThinkingData,
|
|
132
114
|
ConversationThinkingEvent,
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
ToolExecutingEvent,
|
|
138
|
-
ToolCompletedEvent,
|
|
139
|
-
ToolFailedEvent,
|
|
115
|
+
// Base Types
|
|
116
|
+
EngineEvent,
|
|
117
|
+
ErrorMessageEvent,
|
|
118
|
+
ErrorOccurredData,
|
|
140
119
|
ErrorOccurredEvent,
|
|
141
|
-
|
|
142
|
-
|
|
120
|
+
ErrorReceivedData,
|
|
121
|
+
ErrorReceivedEvent,
|
|
122
|
+
InputJsonDeltaData,
|
|
123
|
+
InputJsonDeltaEvent,
|
|
124
|
+
MessageDeltaData,
|
|
125
|
+
MessageDeltaEvent,
|
|
143
126
|
// Message Events
|
|
144
127
|
MessageEvent,
|
|
145
|
-
|
|
146
|
-
|
|
128
|
+
MessageStartData,
|
|
129
|
+
MessageStartEvent,
|
|
130
|
+
MessageStopData,
|
|
131
|
+
MessageStopEvent,
|
|
132
|
+
StateEvent,
|
|
133
|
+
// Stream Events
|
|
134
|
+
StopReason,
|
|
135
|
+
StreamEvent,
|
|
136
|
+
StreamEventType,
|
|
137
|
+
TextDeltaData,
|
|
138
|
+
TextDeltaEvent,
|
|
139
|
+
ToolCompletedData,
|
|
140
|
+
ToolCompletedEvent,
|
|
141
|
+
ToolExecutingData,
|
|
142
|
+
ToolExecutingEvent,
|
|
143
|
+
ToolFailedData,
|
|
144
|
+
ToolFailedEvent,
|
|
145
|
+
ToolPlannedData,
|
|
146
|
+
ToolPlannedEvent,
|
|
147
|
+
ToolResultData,
|
|
148
|
+
ToolResultEvent,
|
|
147
149
|
ToolResultMessageEvent,
|
|
148
|
-
|
|
149
|
-
|
|
150
|
+
ToolUseStartData,
|
|
151
|
+
ToolUseStartEvent,
|
|
152
|
+
ToolUseStopData,
|
|
153
|
+
ToolUseStopEvent,
|
|
154
|
+
TurnEvent,
|
|
150
155
|
// Turn Events
|
|
151
156
|
TurnRequestData,
|
|
152
|
-
TurnResponseData,
|
|
153
|
-
TurnEvent,
|
|
154
157
|
TurnRequestEvent,
|
|
158
|
+
TurnResponseData,
|
|
155
159
|
TurnResponseEvent,
|
|
156
|
-
AgentTurnEvent,
|
|
157
|
-
// Agent Output
|
|
158
|
-
AgentOutput,
|
|
159
160
|
// Event Handling
|
|
160
161
|
Unsubscribe,
|
|
161
|
-
|
|
162
|
-
AgentEventHandler,
|
|
162
|
+
UserMessageEvent,
|
|
163
163
|
} from "./event";
|
|
164
164
|
|
|
165
165
|
// Type guards (functions, not types)
|
|
166
|
-
export {
|
|
166
|
+
export { isMessageEvent, isStateEvent, isTurnEvent } from "./event";
|
|
167
167
|
|
|
168
168
|
// =============================================================================
|
|
169
169
|
// Engine Types - Engine, Source, Presenter, Middleware, Interceptor
|
|
170
170
|
// =============================================================================
|
|
171
171
|
|
|
172
172
|
export type {
|
|
173
|
-
// Message Queue
|
|
174
|
-
MessageQueue,
|
|
175
|
-
// Middleware & Interceptor
|
|
176
|
-
AgentMiddlewareNext,
|
|
177
|
-
AgentMiddleware,
|
|
178
|
-
AgentInterceptorNext,
|
|
179
|
-
AgentInterceptor,
|
|
180
|
-
// State Machine
|
|
181
|
-
StateChange,
|
|
182
|
-
StateChangeHandler,
|
|
183
|
-
AgentStateMachineInterface,
|
|
184
|
-
// Event Handler Maps
|
|
185
|
-
EventHandlerMap,
|
|
186
|
-
ReactHandlerMap,
|
|
187
173
|
// Agent Engine
|
|
188
174
|
AgentEngine,
|
|
175
|
+
AgentEventBus,
|
|
176
|
+
AgentInterceptor,
|
|
177
|
+
AgentInterceptorNext,
|
|
178
|
+
AgentMiddleware,
|
|
179
|
+
// Middleware & Interceptor
|
|
180
|
+
AgentMiddlewareNext,
|
|
181
|
+
AgentPresenter,
|
|
189
182
|
// Source & Presenter (EventBus adapters)
|
|
190
183
|
AgentSource,
|
|
191
|
-
|
|
192
|
-
AgentEventBus,
|
|
184
|
+
AgentStateMachineInterface,
|
|
193
185
|
// Factory Options
|
|
194
186
|
CreateAgentOptions,
|
|
187
|
+
// Event Handler Maps
|
|
188
|
+
EventHandlerMap,
|
|
189
|
+
// Message Queue
|
|
190
|
+
MessageQueue,
|
|
191
|
+
ReactHandlerMap,
|
|
192
|
+
// State Machine
|
|
193
|
+
StateChange,
|
|
194
|
+
StateChangeHandler,
|
|
195
195
|
} from "./engine";
|
package/src/bash/index.ts
CHANGED
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
* - External LoggerFactory can be injected via Runtime
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import type { Logger, LoggerFactory, LogContext, LogLevel } from "./types";
|
|
11
10
|
import { ConsoleLogger, type ConsoleLoggerOptions } from "./ConsoleLogger";
|
|
11
|
+
import type { LogContext, Logger, LoggerFactory, LogLevel } from "./types";
|
|
12
12
|
|
|
13
13
|
// External factory injected via Runtime
|
|
14
14
|
let externalFactory: LoggerFactory | null = null;
|
|
@@ -36,22 +36,22 @@ export class LoggerFactoryImpl {
|
|
|
36
36
|
static getLogger(nameOrClass: string | (new (...args: unknown[]) => unknown)): Logger {
|
|
37
37
|
const name = typeof nameOrClass === "string" ? nameOrClass : nameOrClass.name;
|
|
38
38
|
|
|
39
|
-
if (
|
|
40
|
-
return
|
|
39
|
+
if (LoggerFactoryImpl.loggers.has(name)) {
|
|
40
|
+
return LoggerFactoryImpl.loggers.get(name)!;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
const lazyLogger =
|
|
44
|
-
|
|
43
|
+
const lazyLogger = LoggerFactoryImpl.createLazyLogger(name);
|
|
44
|
+
LoggerFactoryImpl.loggers.set(name, lazyLogger);
|
|
45
45
|
return lazyLogger;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
static configure(config: LoggerFactoryConfig): void {
|
|
49
|
-
|
|
49
|
+
LoggerFactoryImpl.config = { ...LoggerFactoryImpl.config, ...config };
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
static reset(): void {
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
LoggerFactoryImpl.loggers.clear();
|
|
54
|
+
LoggerFactoryImpl.config = { defaultLevel: "info" };
|
|
55
55
|
externalFactory = null;
|
|
56
56
|
factoryVersion++; // Invalidate all cached real loggers
|
|
57
57
|
}
|
|
@@ -63,7 +63,7 @@ export class LoggerFactoryImpl {
|
|
|
63
63
|
const getRealLogger = (): Logger => {
|
|
64
64
|
// Recreate logger if factory version changed (setLoggerFactory was called)
|
|
65
65
|
if (!realLogger || loggerVersion !== factoryVersion) {
|
|
66
|
-
realLogger =
|
|
66
|
+
realLogger = LoggerFactoryImpl.createLogger(name);
|
|
67
67
|
loggerVersion = factoryVersion;
|
|
68
68
|
}
|
|
69
69
|
return realLogger;
|
|
@@ -71,7 +71,7 @@ export class LoggerFactoryImpl {
|
|
|
71
71
|
|
|
72
72
|
return {
|
|
73
73
|
name,
|
|
74
|
-
level:
|
|
74
|
+
level: LoggerFactoryImpl.config.defaultLevel || "info",
|
|
75
75
|
debug: (message: string, context?: LogContext) => getRealLogger().debug(message, context),
|
|
76
76
|
info: (message: string, context?: LogContext) => getRealLogger().info(message, context),
|
|
77
77
|
warn: (message: string, context?: LogContext) => getRealLogger().warn(message, context),
|
|
@@ -89,13 +89,13 @@ export class LoggerFactoryImpl {
|
|
|
89
89
|
return externalFactory.getLogger(name);
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
if (
|
|
93
|
-
return
|
|
92
|
+
if (LoggerFactoryImpl.config.defaultImplementation) {
|
|
93
|
+
return LoggerFactoryImpl.config.defaultImplementation(name);
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
return new ConsoleLogger(name, {
|
|
97
|
-
level:
|
|
98
|
-
...
|
|
97
|
+
level: LoggerFactoryImpl.config.defaultLevel,
|
|
98
|
+
...LoggerFactoryImpl.config.consoleOptions,
|
|
99
99
|
});
|
|
100
100
|
}
|
|
101
101
|
}
|
|
@@ -16,11 +16,11 @@
|
|
|
16
16
|
* ```
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
export type { Logger, LoggerFactory, LogContext, LogLevel } from "./types";
|
|
20
19
|
export { ConsoleLogger, type ConsoleLoggerOptions } from "./ConsoleLogger";
|
|
21
20
|
export {
|
|
22
|
-
|
|
21
|
+
createLogger,
|
|
23
22
|
type LoggerFactoryConfig,
|
|
23
|
+
LoggerFactoryImpl,
|
|
24
24
|
setLoggerFactory,
|
|
25
|
-
createLogger,
|
|
26
25
|
} from "./LoggerFactoryImpl";
|
|
26
|
+
export type { LogContext, Logger, LoggerFactory, LogLevel } from "./types";
|
package/src/container/index.ts
CHANGED
|
@@ -32,13 +32,12 @@
|
|
|
32
32
|
* ```
|
|
33
33
|
*/
|
|
34
34
|
|
|
35
|
+
export { ContainerImpl, createContainer, getOrCreateContainer, loadContainer } from "./Container";
|
|
35
36
|
export type {
|
|
36
|
-
ContainerRecord,
|
|
37
|
-
ContainerConfig,
|
|
38
|
-
ContainerRepository,
|
|
39
37
|
Container,
|
|
38
|
+
ContainerConfig,
|
|
40
39
|
ContainerContext,
|
|
41
40
|
ContainerCreateConfig,
|
|
41
|
+
ContainerRecord,
|
|
42
|
+
ContainerRepository,
|
|
42
43
|
} from "./types";
|
|
43
|
-
|
|
44
|
-
export { ContainerImpl, createContainer, loadContainer, getOrCreateContainer } from "./Container";
|
package/src/container/types.ts
CHANGED
|
@@ -16,7 +16,7 @@ import type { SessionRepository } from "../session/types";
|
|
|
16
16
|
// Re-export from persistence (storage schema)
|
|
17
17
|
// ============================================================================
|
|
18
18
|
|
|
19
|
-
export type {
|
|
19
|
+
export type { ContainerConfig, ContainerRecord, ContainerRepository } from "../persistence/types";
|
|
20
20
|
|
|
21
21
|
// ============================================================================
|
|
22
22
|
// Container Interface
|