@bytespell/amux-client 0.0.29 → 0.0.30

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.
@@ -0,0 +1,77 @@
1
+ import type { SessionUpdate } from '@bytespell/amux-types';
2
+ import type { Message, Turn } from './types.js';
3
+ /**
4
+ * Message and Turn accumulator
5
+ *
6
+ * Processes streaming session updates and builds structured conversation data.
7
+ */
8
+ export declare class Accumulator {
9
+ private _messages;
10
+ private _turns;
11
+ private _currentTurn;
12
+ /**
13
+ * All accumulated messages
14
+ */
15
+ get messages(): Message[];
16
+ /**
17
+ * All turns (grouped user/assistant pairs)
18
+ */
19
+ get turns(): Turn[];
20
+ /**
21
+ * Current active turn (if streaming)
22
+ */
23
+ get currentTurn(): Turn | null;
24
+ /**
25
+ * Last user message
26
+ */
27
+ get lastUserMessage(): Message | null;
28
+ /**
29
+ * Last assistant message
30
+ */
31
+ get lastAssistantMessage(): Message | null;
32
+ /**
33
+ * Start a new turn
34
+ */
35
+ startTurn(): void;
36
+ /**
37
+ * End the current turn
38
+ */
39
+ endTurn(): void;
40
+ /**
41
+ * Set turn status to awaiting permission
42
+ */
43
+ setAwaitingPermission(): void;
44
+ /**
45
+ * Resume streaming after permission
46
+ */
47
+ resumeStreaming(): void;
48
+ /**
49
+ * Process a session update
50
+ */
51
+ processUpdate(update: SessionUpdate): void;
52
+ /**
53
+ * Process user message chunk
54
+ */
55
+ private processUserChunk;
56
+ /**
57
+ * Process assistant message chunk
58
+ */
59
+ private processAssistantChunk;
60
+ /**
61
+ * Process tool call
62
+ */
63
+ private processToolCall;
64
+ /**
65
+ * Process tool call update
66
+ */
67
+ private processToolCallUpdate;
68
+ /**
69
+ * Replay history events
70
+ */
71
+ replayHistory(events: unknown[]): void;
72
+ /**
73
+ * Clear all accumulated data
74
+ */
75
+ clear(): void;
76
+ }
77
+ //# sourceMappingURL=accumulator.d.ts.map
@@ -0,0 +1,155 @@
1
+ import type { AgentInfo, ModelInfo, SessionMetadata } from '@bytespell/amux-types';
2
+ import type { AmuxClientOptions, AmuxClientEvents, ConnectionStatus, Message, Turn } from './types.js';
3
+ /**
4
+ * AmuxClient - WebSocket client for consuming amux
5
+ *
6
+ * Provides:
7
+ * - Connection management with auto-reconnect
8
+ * - Type-safe event subscription
9
+ * - Command methods for server interaction
10
+ * - Message accumulation for UI rendering
11
+ *
12
+ * @example
13
+ * ```typescript
14
+ * const client = new AmuxClient({ url: 'ws://localhost:3000/ws' });
15
+ *
16
+ * client.on('ready', (data) => console.log('Ready:', data.cwd));
17
+ * client.on('update', (update) => console.log('Update:', update));
18
+ *
19
+ * client.connect();
20
+ * client.prompt('Hello!');
21
+ * ```
22
+ */
23
+ export declare class AmuxClient {
24
+ private connection;
25
+ private accumulator;
26
+ private handlers;
27
+ private _cwd;
28
+ private _sessionId;
29
+ private _agent;
30
+ private _availableAgents;
31
+ private _availableModels;
32
+ private _currentModelId;
33
+ private _capabilities;
34
+ private _sessions;
35
+ private _isReady;
36
+ private _isProcessing;
37
+ private _pendingPermission;
38
+ constructor(options: AmuxClientOptions);
39
+ /**
40
+ * Connect to the WebSocket server
41
+ */
42
+ connect(): void;
43
+ /**
44
+ * Disconnect from the WebSocket server
45
+ */
46
+ disconnect(): void;
47
+ /**
48
+ * Whether WebSocket is connected
49
+ */
50
+ get isConnected(): boolean;
51
+ /**
52
+ * Whether client is ready (connected and received 'ready' event)
53
+ */
54
+ get isReady(): boolean;
55
+ /**
56
+ * Current connection status
57
+ */
58
+ get connectionStatus(): ConnectionStatus;
59
+ /**
60
+ * Subscribe to an event
61
+ */
62
+ on<K extends keyof AmuxClientEvents>(event: K, handler: (data: AmuxClientEvents[K]) => void): void;
63
+ /**
64
+ * Unsubscribe from an event
65
+ */
66
+ off<K extends keyof AmuxClientEvents>(event: K, handler: (data: AmuxClientEvents[K]) => void): void;
67
+ /**
68
+ * Emit an event to handlers
69
+ */
70
+ private emit;
71
+ /** Current working directory */
72
+ get cwd(): string | null;
73
+ /** Current session ID */
74
+ get sessionId(): string | null;
75
+ /** Current agent info */
76
+ get agent(): AgentInfo | null;
77
+ /** Available agents */
78
+ get availableAgents(): Array<{
79
+ id: string;
80
+ name: string;
81
+ }>;
82
+ /** Available models */
83
+ get availableModels(): ModelInfo[];
84
+ /** Current model ID */
85
+ get currentModelId(): string | null;
86
+ /** Agent capabilities */
87
+ get capabilities(): unknown;
88
+ /** List of sessions (from list_sessions response) */
89
+ get sessions(): SessionMetadata[];
90
+ /** Whether currently processing a turn */
91
+ get isProcessing(): boolean;
92
+ /** Whether agent is actively streaming */
93
+ get isStreaming(): boolean;
94
+ /** Whether blocked on permission request */
95
+ get isAwaitingPermission(): boolean;
96
+ /** Current pending permission request */
97
+ get pendingPermission(): AmuxClientEvents['permission_request'] | null;
98
+ /** All accumulated messages */
99
+ get messages(): Message[];
100
+ /** All turns */
101
+ get turns(): Turn[];
102
+ /** Current active turn */
103
+ get currentTurn(): Turn | null;
104
+ /** Last user message */
105
+ get lastUserMessage(): Message | null;
106
+ /** Last assistant message */
107
+ get lastAssistantMessage(): Message | null;
108
+ /**
109
+ * Send a prompt to the agent
110
+ */
111
+ prompt(message: string): void;
112
+ /**
113
+ * Cancel current operation
114
+ */
115
+ cancel(): void;
116
+ /**
117
+ * Respond to a permission request
118
+ */
119
+ respondToPermission(requestId: string, optionId: string): void;
120
+ /**
121
+ * Change working directory
122
+ */
123
+ changeCwd(path: string): void;
124
+ /**
125
+ * Create a new session
126
+ */
127
+ newSession(): void;
128
+ /**
129
+ * Change agent type
130
+ */
131
+ changeAgent(agentType: string): void;
132
+ /**
133
+ * Set session mode
134
+ */
135
+ setMode(modeId: string): void;
136
+ /**
137
+ * Set model
138
+ */
139
+ setModel(modelId: string): void;
140
+ /**
141
+ * Request list of sessions
142
+ */
143
+ requestSessions(): void;
144
+ /**
145
+ * Switch to a different session
146
+ */
147
+ switchSession(sessionId: string): void;
148
+ /**
149
+ * Request history for current session
150
+ */
151
+ requestHistory(): void;
152
+ private handleMessage;
153
+ private handleStatusChange;
154
+ }
155
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1,81 @@
1
+ import type { ClientMessage, ServerMessage } from '@bytespell/amux-types';
2
+ import type { ConnectionStatus } from './types.js';
3
+ /**
4
+ * Event handler types for Connection
5
+ */
6
+ export interface ConnectionEvents {
7
+ open: () => void;
8
+ close: (event: {
9
+ code: number;
10
+ reason: string;
11
+ wasClean: boolean;
12
+ }) => void;
13
+ message: (message: ServerMessage) => void;
14
+ error: (error: Event) => void;
15
+ status: (status: ConnectionStatus) => void;
16
+ }
17
+ /**
18
+ * Connection options
19
+ */
20
+ export interface ConnectionOptions {
21
+ url: string;
22
+ reconnect?: boolean;
23
+ reconnectInterval?: number;
24
+ maxReconnectAttempts?: number;
25
+ }
26
+ /**
27
+ * WebSocket connection manager with auto-reconnect
28
+ */
29
+ export declare class Connection {
30
+ private ws;
31
+ private reconnectAttempts;
32
+ private reconnectTimeout;
33
+ private _status;
34
+ private handlers;
35
+ private readonly url;
36
+ private readonly reconnect;
37
+ private readonly reconnectInterval;
38
+ private readonly maxReconnectAttempts;
39
+ constructor(options: ConnectionOptions);
40
+ /**
41
+ * Current connection status
42
+ */
43
+ get status(): ConnectionStatus;
44
+ /**
45
+ * Whether the connection is open
46
+ */
47
+ get isConnected(): boolean;
48
+ /**
49
+ * Add event listener
50
+ */
51
+ on<K extends keyof ConnectionEvents>(event: K, handler: ConnectionEvents[K]): void;
52
+ /**
53
+ * Remove event listener
54
+ */
55
+ off<K extends keyof ConnectionEvents>(event: K, handler: ConnectionEvents[K]): void;
56
+ /**
57
+ * Emit event to handlers
58
+ */
59
+ private emit;
60
+ /**
61
+ * Set and emit status change
62
+ */
63
+ private setStatus;
64
+ /**
65
+ * Connect to WebSocket server
66
+ */
67
+ connect(): void;
68
+ /**
69
+ * Disconnect from WebSocket server
70
+ */
71
+ disconnect(): void;
72
+ /**
73
+ * Send a message to the server
74
+ */
75
+ send(message: ClientMessage): void;
76
+ /**
77
+ * Schedule a reconnection attempt
78
+ */
79
+ private scheduleReconnect;
80
+ }
81
+ //# sourceMappingURL=connection.d.ts.map
@@ -0,0 +1,35 @@
1
+ /**
2
+ * @bytespell/amux-client
3
+ *
4
+ * Client library for consuming amux over WebSocket.
5
+ *
6
+ * @example
7
+ * ```typescript
8
+ * import { AmuxClient } from '@bytespell/amux-client';
9
+ *
10
+ * const client = new AmuxClient({ url: 'ws://localhost:3000/ws' });
11
+ *
12
+ * client.on('ready', (data) => {
13
+ * console.log('Ready:', data.cwd);
14
+ * });
15
+ *
16
+ * client.on('update', (update) => {
17
+ * console.log('Update:', update);
18
+ * });
19
+ *
20
+ * client.connect();
21
+ * client.prompt('Hello!');
22
+ * ```
23
+ *
24
+ * For React integration, use:
25
+ * ```typescript
26
+ * import { AmuxProvider, useAmux } from '@bytespell/amux-client/react';
27
+ * ```
28
+ */
29
+ export { AmuxClient } from './client.js';
30
+ export { Connection } from './connection.js';
31
+ export type { ConnectionOptions, ConnectionEvents } from './connection.js';
32
+ export { Accumulator } from './accumulator.js';
33
+ export type { AmuxClientOptions, AmuxClientEvents, ConnectionStatus, Message, Turn, ToolCallState, ContentBlock, } from './types.js';
34
+ export type { ServerMessage, ClientMessage, SessionUpdate, AgentInfo, ModelInfo, SessionMetadata, PermissionRequest, } from '@bytespell/amux-types';
35
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,65 @@
1
+ import React from 'react';
2
+ import { AmuxClient } from '../client.js';
3
+ import type { AmuxClientOptions, ConnectionStatus, Message, Turn, PermissionOptionData } from '../types.js';
4
+ import type { ModelInfo, SessionMetadata } from '@bytespell/amux-types';
5
+ /**
6
+ * Amux context value
7
+ */
8
+ export interface AmuxContextValue {
9
+ client: AmuxClient;
10
+ connectionStatus: ConnectionStatus;
11
+ isConnected: boolean;
12
+ isReady: boolean;
13
+ cwd: string | null;
14
+ sessionId: string | null;
15
+ agent: {
16
+ type: string;
17
+ name: string;
18
+ } | null;
19
+ availableAgents: Array<{
20
+ id: string;
21
+ name: string;
22
+ }>;
23
+ availableModels: ModelInfo[];
24
+ currentModelId: string | null;
25
+ sessions: SessionMetadata[];
26
+ isProcessing: boolean;
27
+ isStreaming: boolean;
28
+ isAwaitingPermission: boolean;
29
+ pendingPermission: {
30
+ requestId: string;
31
+ toolCall?: unknown;
32
+ options: PermissionOptionData[];
33
+ } | null;
34
+ messages: Message[];
35
+ turns: Turn[];
36
+ currentTurn: Turn | null;
37
+ error: string | null;
38
+ }
39
+ /**
40
+ * Props for AmuxProvider
41
+ */
42
+ export interface AmuxProviderProps extends AmuxClientOptions {
43
+ children: React.ReactNode;
44
+ }
45
+ /**
46
+ * AmuxProvider - Provides AmuxClient to React components
47
+ *
48
+ * @example
49
+ * ```tsx
50
+ * function App() {
51
+ * return (
52
+ * <AmuxProvider url="ws://localhost:3000/ws" autoConnect>
53
+ * <Chat />
54
+ * </AmuxProvider>
55
+ * );
56
+ * }
57
+ * ```
58
+ */
59
+ export declare function AmuxProvider({ children, ...options }: AmuxProviderProps): import("react/jsx-runtime").JSX.Element;
60
+ /**
61
+ * Get the Amux context value
62
+ * @throws Error if used outside AmuxProvider
63
+ */
64
+ export declare function useAmuxContext(): AmuxContextValue;
65
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1,211 @@
1
+ import type { AmuxClientEvents, ConnectionStatus, Message, Turn, PermissionOptionData } from '../types.js';
2
+ import type { AmuxClient } from '../client.js';
3
+ import type { ModelInfo, SessionMetadata } from '@bytespell/amux-types';
4
+ /**
5
+ * Get the AmuxClient instance
6
+ *
7
+ * @example
8
+ * ```tsx
9
+ * function Chat() {
10
+ * const client = useAmux();
11
+ *
12
+ * const handleSubmit = (message: string) => {
13
+ * client.prompt(message);
14
+ * };
15
+ *
16
+ * return <ChatUI onSubmit={handleSubmit} />;
17
+ * }
18
+ * ```
19
+ */
20
+ export declare function useAmux(): AmuxClient;
21
+ /**
22
+ * State returned by useAmuxState
23
+ */
24
+ export interface AmuxState {
25
+ connectionStatus: ConnectionStatus;
26
+ isConnected: boolean;
27
+ isReady: boolean;
28
+ cwd: string | null;
29
+ sessionId: string | null;
30
+ agent: {
31
+ type: string;
32
+ name: string;
33
+ } | null;
34
+ availableAgents: Array<{
35
+ id: string;
36
+ name: string;
37
+ }>;
38
+ sessions: SessionMetadata[];
39
+ error: string | null;
40
+ }
41
+ /**
42
+ * Get reactive session state
43
+ *
44
+ * @example
45
+ * ```tsx
46
+ * function StatusBar() {
47
+ * const { isConnected, isReady, cwd, agent, error } = useAmuxState();
48
+ *
49
+ * if (error) return <div className="error">{error}</div>;
50
+ *
51
+ * return (
52
+ * <div>
53
+ * {isReady ? `${agent?.name} @ ${cwd}` : 'Connecting...'}
54
+ * </div>
55
+ * );
56
+ * }
57
+ * ```
58
+ */
59
+ export declare function useAmuxState(): AmuxState;
60
+ /**
61
+ * Model state returned by useAmuxModels
62
+ */
63
+ export interface AmuxModels {
64
+ availableModels: ModelInfo[];
65
+ currentModelId: string | null;
66
+ }
67
+ /**
68
+ * Get reactive model state
69
+ *
70
+ * @example
71
+ * ```tsx
72
+ * function ModelPicker() {
73
+ * const { availableModels, currentModelId } = useAmuxModels();
74
+ * const client = useAmux();
75
+ *
76
+ * return (
77
+ * <select
78
+ * value={currentModelId ?? ''}
79
+ * onChange={e => client.setModel(e.target.value)}
80
+ * >
81
+ * {availableModels.map(m => (
82
+ * <option key={m.id} value={m.id}>{m.name}</option>
83
+ * ))}
84
+ * </select>
85
+ * );
86
+ * }
87
+ * ```
88
+ */
89
+ export declare function useAmuxModels(): AmuxModels;
90
+ /**
91
+ * Status returned by useAmuxStatus
92
+ */
93
+ export interface AmuxStatus {
94
+ isProcessing: boolean;
95
+ isStreaming: boolean;
96
+ isAwaitingPermission: boolean;
97
+ pendingPermission: {
98
+ requestId: string;
99
+ toolCall?: unknown;
100
+ options: PermissionOptionData[];
101
+ } | null;
102
+ }
103
+ /**
104
+ * Get reactive processing status
105
+ *
106
+ * @example
107
+ * ```tsx
108
+ * function ChatInput() {
109
+ * const { isProcessing, isAwaitingPermission } = useAmuxStatus();
110
+ * const disabled = isProcessing || isAwaitingPermission;
111
+ *
112
+ * return <input disabled={disabled} ... />;
113
+ * }
114
+ * ```
115
+ */
116
+ export declare function useAmuxStatus(): AmuxStatus;
117
+ /**
118
+ * Messages state returned by useAmuxMessages
119
+ */
120
+ export interface AmuxMessages {
121
+ messages: Message[];
122
+ turns: Turn[];
123
+ currentTurn: Turn | null;
124
+ }
125
+ /**
126
+ * Get reactive messages and turns
127
+ *
128
+ * @example
129
+ * ```tsx
130
+ * function MessageList() {
131
+ * const { turns, currentTurn } = useAmuxMessages();
132
+ *
133
+ * return (
134
+ * <>
135
+ * {turns.map(turn => (
136
+ * <Turn key={turn.id} turn={turn} />
137
+ * ))}
138
+ * {currentTurn?.status === 'streaming' && <StreamingIndicator />}
139
+ * </>
140
+ * );
141
+ * }
142
+ * ```
143
+ */
144
+ export declare function useAmuxMessages(): AmuxMessages;
145
+ /**
146
+ * Subscribe to specific client events
147
+ *
148
+ * @example
149
+ * ```tsx
150
+ * function PermissionDialog() {
151
+ * const [pending, setPending] = useState<PermissionRequest | null>(null);
152
+ * const client = useAmux();
153
+ *
154
+ * useAmuxEvent('permission_request', (req) => {
155
+ * setPending(req);
156
+ * });
157
+ *
158
+ * const handleResponse = (optionId: string) => {
159
+ * if (pending) {
160
+ * client.respondToPermission(pending.requestId, optionId);
161
+ * setPending(null);
162
+ * }
163
+ * };
164
+ *
165
+ * if (!pending) return null;
166
+ * return <Dialog options={pending.options} onSelect={handleResponse} />;
167
+ * }
168
+ * ```
169
+ */
170
+ export declare function useAmuxEvent<K extends keyof AmuxClientEvents>(event: K, handler: (data: AmuxClientEvents[K]) => void): void;
171
+ /**
172
+ * Get a function to send prompts
173
+ *
174
+ * @example
175
+ * ```tsx
176
+ * function ChatInput() {
177
+ * const sendPrompt = useAmuxPrompt();
178
+ * const [message, setMessage] = useState('');
179
+ *
180
+ * const handleSubmit = () => {
181
+ * sendPrompt(message);
182
+ * setMessage('');
183
+ * };
184
+ *
185
+ * return <input value={message} onChange={e => setMessage(e.target.value)} onSubmit={handleSubmit} />;
186
+ * }
187
+ * ```
188
+ */
189
+ export declare function useAmuxPrompt(): (message: string) => void;
190
+ /**
191
+ * Clear the current error
192
+ *
193
+ * @example
194
+ * ```tsx
195
+ * function ErrorBanner() {
196
+ * const { error } = useAmuxState();
197
+ * const clearError = useAmuxClearError();
198
+ *
199
+ * if (!error) return null;
200
+ *
201
+ * return (
202
+ * <div className="error">
203
+ * {error}
204
+ * <button onClick={clearError}>Dismiss</button>
205
+ * </div>
206
+ * );
207
+ * }
208
+ * ```
209
+ */
210
+ export declare function useAmuxClearError(): () => void;
211
+ //# sourceMappingURL=hooks.d.ts.map
@@ -0,0 +1,32 @@
1
+ /**
2
+ * React integration for @bytespell/amux-client
3
+ *
4
+ * @example
5
+ * ```tsx
6
+ * import { AmuxProvider, useAmux, useAmuxState, useAmuxMessages, useAmuxModels } from '@bytespell/amux-client/react';
7
+ *
8
+ * function App() {
9
+ * return (
10
+ * <AmuxProvider url="ws://localhost:3000/ws" autoConnect>
11
+ * <Chat />
12
+ * </AmuxProvider>
13
+ * );
14
+ * }
15
+ *
16
+ * function Chat() {
17
+ * const client = useAmux();
18
+ * const { isReady, cwd, agent, error } = useAmuxState();
19
+ * const { turns, currentTurn } = useAmuxMessages();
20
+ * const { availableModels, currentModelId } = useAmuxModels();
21
+ *
22
+ * // ...
23
+ * }
24
+ * ```
25
+ */
26
+ export { AmuxProvider, useAmuxContext } from './context.js';
27
+ export type { AmuxContextValue, AmuxProviderProps } from './context.js';
28
+ export { useAmux, useAmuxState, useAmuxStatus, useAmuxMessages, useAmuxModels, useAmuxEvent, useAmuxPrompt, useAmuxClearError, } from './hooks.js';
29
+ export type { AmuxState, AmuxStatus, AmuxMessages, AmuxModels } from './hooks.js';
30
+ export type { ModelInfo, SessionMetadata } from '@bytespell/amux-types';
31
+ export type { Turn, Message, ContentBlock, ToolCallState, ConnectionStatus } from '../types.js';
32
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,166 @@
1
+ import type { SessionUpdate } from '@bytespell/amux-types';
2
+ export type { SessionUpdate };
3
+ /**
4
+ * Content block types for accumulated messages
5
+ */
6
+ export type ContentBlock = {
7
+ type: 'text';
8
+ text: string;
9
+ } | {
10
+ type: 'thinking';
11
+ text: string;
12
+ } | {
13
+ type: 'tool_use';
14
+ id: string;
15
+ name: string;
16
+ input: unknown;
17
+ } | {
18
+ type: 'tool_result';
19
+ toolUseId: string;
20
+ content: unknown;
21
+ isError?: boolean;
22
+ } | {
23
+ type: 'diff';
24
+ path: string;
25
+ oldText: string;
26
+ newText: string;
27
+ } | {
28
+ type: 'image';
29
+ source: {
30
+ type: 'base64';
31
+ mediaType: string;
32
+ data: string;
33
+ };
34
+ };
35
+ /**
36
+ * Accumulated message
37
+ */
38
+ export interface Message {
39
+ id: string;
40
+ role: 'user' | 'assistant';
41
+ content: ContentBlock[];
42
+ status: 'streaming' | 'complete';
43
+ timestamp: number;
44
+ }
45
+ /**
46
+ * Tool call state tracking
47
+ */
48
+ export interface ToolCallState {
49
+ id: string;
50
+ name: string;
51
+ input: unknown;
52
+ status: 'pending' | 'running' | 'complete' | 'error';
53
+ result?: unknown;
54
+ error?: string;
55
+ }
56
+ /**
57
+ * Turn state - groups user message and assistant response
58
+ */
59
+ export interface Turn {
60
+ id: string;
61
+ userMessage: Message | null;
62
+ assistantMessage: Message | null;
63
+ toolCalls: ToolCallState[];
64
+ status: 'idle' | 'streaming' | 'awaiting_permission' | 'complete';
65
+ }
66
+ /**
67
+ * Connection status
68
+ */
69
+ export type ConnectionStatus = 'disconnected' | 'connecting' | 'connected' | 'ready';
70
+ /**
71
+ * Permission option (from server)
72
+ */
73
+ export interface PermissionOptionData {
74
+ id?: string;
75
+ optionId?: string;
76
+ label?: string;
77
+ title?: string;
78
+ description?: string;
79
+ }
80
+ /**
81
+ * Client event types
82
+ */
83
+ export interface AmuxClientEvents {
84
+ ready: {
85
+ cwd: string;
86
+ sessionId: string | null;
87
+ capabilities: unknown;
88
+ agent: {
89
+ type: string;
90
+ name: string;
91
+ };
92
+ availableAgents: Array<{
93
+ id: string;
94
+ name: string;
95
+ }>;
96
+ availableModels?: Array<{
97
+ id: string;
98
+ name: string;
99
+ provider?: string;
100
+ supportsThinking?: boolean;
101
+ }>;
102
+ currentModelId?: string;
103
+ };
104
+ connecting: Record<string, never>;
105
+ update: SessionUpdate;
106
+ turn_start: Record<string, never>;
107
+ turn_end: Record<string, never>;
108
+ permission_request: {
109
+ requestId: string;
110
+ toolCall?: unknown;
111
+ options: PermissionOptionData[];
112
+ };
113
+ prompt_complete: {
114
+ stopReason?: string;
115
+ };
116
+ session_created: {
117
+ sessionId: string | null;
118
+ };
119
+ session_switched: {
120
+ sessionId: string;
121
+ };
122
+ history_replay: {
123
+ previousSessionId: string;
124
+ events: unknown[];
125
+ eventCount: number;
126
+ };
127
+ history: {
128
+ events: unknown[];
129
+ sessionId: string | null;
130
+ };
131
+ sessions: {
132
+ sessions: unknown[];
133
+ };
134
+ error: {
135
+ message: string;
136
+ };
137
+ agent_exit: {
138
+ code: number | null;
139
+ signal: string | null;
140
+ };
141
+ connection_status: {
142
+ status: ConnectionStatus;
143
+ };
144
+ messages_updated: {
145
+ messages: Message[];
146
+ };
147
+ turns_updated: {
148
+ turns: Turn[];
149
+ };
150
+ }
151
+ /**
152
+ * Options for creating an AmuxClient
153
+ */
154
+ export interface AmuxClientOptions {
155
+ /** WebSocket URL to connect to */
156
+ url: string;
157
+ /** Auto-connect on creation (default: true) */
158
+ autoConnect?: boolean;
159
+ /** Auto-reconnect on disconnect (default: true) */
160
+ reconnect?: boolean;
161
+ /** Reconnect interval in ms (default: 1000) */
162
+ reconnectInterval?: number;
163
+ /** Max reconnect attempts (default: Infinity) */
164
+ maxReconnectAttempts?: number;
165
+ }
166
+ //# sourceMappingURL=types.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytespell/amux-client",
3
- "version": "0.0.29",
3
+ "version": "0.0.30",
4
4
  "description": "Client library for consuming amux over WebSocket",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",