@steventsao/agent-session 0.1.23 → 0.1.25
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/index.d.ts +86 -26
- package/dist/index.js +244 -39
- package/dist/react.d.ts +66 -24
- package/dist/react.js +482 -26
- package/dist/slice.d.ts +78 -60
- package/dist/slice.js +832 -796
- package/package.json +4 -4
- package/dist/client.d.ts +0 -88
- package/dist/client.d.ts.map +0 -1
- package/dist/client.js +0 -255
- package/dist/client.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/react.d.ts.map +0 -1
- package/dist/react.js.map +0 -1
- package/dist/slice.d.ts.map +0 -1
- package/dist/slice.js.map +0 -1
- package/dist/use-agent-session.d.ts +0 -64
- package/dist/use-agent-session.d.ts.map +0 -1
- package/dist/use-agent-session.js +0 -229
- package/dist/use-agent-session.js.map +0 -1
package/dist/slice.d.ts
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
*
|
|
7
|
-
* Singleton socket pattern to avoid React reconnection loops
|
|
8
|
-
*/
|
|
9
|
-
import type { SandboxLifecycle, SandboxStatus, ContentBlock, SandboxFile, MessageAuthor } from '@steventsao/agent-session-core';
|
|
10
|
-
export interface AgentMessage {
|
|
1
|
+
import * as _reduxjs_toolkit from '@reduxjs/toolkit';
|
|
2
|
+
import * as _steventsao_agent_session_core from '@steventsao/agent-session-core';
|
|
3
|
+
import { SandboxStatus, SandboxLifecycle, ContentBlock, MessageAuthor, SandboxFile } from '@steventsao/agent-session-core';
|
|
4
|
+
|
|
5
|
+
interface AgentMessage {
|
|
11
6
|
id: string;
|
|
12
7
|
role: 'user' | 'assistant';
|
|
13
8
|
content: string | ContentBlock[];
|
|
@@ -16,7 +11,7 @@ export interface AgentMessage {
|
|
|
16
11
|
status?: 'pending' | 'sent' | 'failed';
|
|
17
12
|
author?: MessageAuthor;
|
|
18
13
|
}
|
|
19
|
-
|
|
14
|
+
interface UploadedFile {
|
|
20
15
|
path: string;
|
|
21
16
|
filename: string;
|
|
22
17
|
url: string;
|
|
@@ -73,7 +68,7 @@ declare class SessionSocketManager {
|
|
|
73
68
|
private handleMessage;
|
|
74
69
|
send(message: object): boolean;
|
|
75
70
|
init(metadata?: Record<string, unknown>): void;
|
|
76
|
-
startSandbox(template?: string, bootstrap?:
|
|
71
|
+
startSandbox(template?: string, bootstrap?: _steventsao_agent_session_core.SandboxBootstrapOptions): void;
|
|
77
72
|
stopSandbox(): void;
|
|
78
73
|
exec(cmd: string, cwd?: string): void;
|
|
79
74
|
sendAgentMessage(content: string, model?: {
|
|
@@ -116,24 +111,24 @@ declare class SessionSocketManager {
|
|
|
116
111
|
private clearReconnect;
|
|
117
112
|
private maybeReconnect;
|
|
118
113
|
}
|
|
119
|
-
|
|
120
|
-
|
|
114
|
+
declare const sessionSocketManager: SessionSocketManager;
|
|
115
|
+
declare const connectSession: _reduxjs_toolkit.AsyncThunk<void, {
|
|
121
116
|
url: string;
|
|
122
117
|
sessionId: string;
|
|
123
118
|
userId?: string;
|
|
124
|
-
},
|
|
125
|
-
|
|
126
|
-
|
|
119
|
+
}, _reduxjs_toolkit.AsyncThunkConfig>;
|
|
120
|
+
declare const disconnectSession: _reduxjs_toolkit.AsyncThunk<void, void, _reduxjs_toolkit.AsyncThunkConfig>;
|
|
121
|
+
interface StartSandboxPayload {
|
|
127
122
|
template?: string;
|
|
128
|
-
bootstrap?:
|
|
123
|
+
bootstrap?: _steventsao_agent_session_core.SandboxBootstrapOptions;
|
|
129
124
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
125
|
+
declare const startSandbox: _reduxjs_toolkit.AsyncThunk<void, string | StartSandboxPayload | undefined, _reduxjs_toolkit.AsyncThunkConfig>;
|
|
126
|
+
declare const stopSandbox: _reduxjs_toolkit.AsyncThunk<void, void, _reduxjs_toolkit.AsyncThunkConfig>;
|
|
127
|
+
declare const execCommand: _reduxjs_toolkit.AsyncThunk<void, {
|
|
133
128
|
cmd: string;
|
|
134
129
|
cwd?: string;
|
|
135
|
-
},
|
|
136
|
-
|
|
130
|
+
}, _reduxjs_toolkit.AsyncThunkConfig>;
|
|
131
|
+
declare const sendAgentMessage: _reduxjs_toolkit.AsyncThunk<void, {
|
|
137
132
|
content: string;
|
|
138
133
|
model?: {
|
|
139
134
|
id: string;
|
|
@@ -146,69 +141,92 @@ export declare const sendAgentMessage: import("@reduxjs/toolkit").AsyncThunk<voi
|
|
|
146
141
|
systemPrompt?: string;
|
|
147
142
|
agentType?: string;
|
|
148
143
|
author?: MessageAuthor;
|
|
149
|
-
},
|
|
150
|
-
|
|
151
|
-
|
|
144
|
+
}, _reduxjs_toolkit.AsyncThunkConfig>;
|
|
145
|
+
declare const stopAgent: _reduxjs_toolkit.AsyncThunk<void, void, _reduxjs_toolkit.AsyncThunkConfig>;
|
|
146
|
+
declare const resetAgent: _reduxjs_toolkit.AsyncThunk<void, void, _reduxjs_toolkit.AsyncThunkConfig>;
|
|
152
147
|
/**
|
|
153
148
|
* Force reconnect - useful when connection is stale/dead
|
|
154
149
|
* Inspired by tldraw's restart() method
|
|
155
150
|
*/
|
|
156
|
-
|
|
157
|
-
|
|
151
|
+
declare const forceReconnect: _reduxjs_toolkit.AsyncThunk<void, void, _reduxjs_toolkit.AsyncThunkConfig>;
|
|
152
|
+
declare const setConnected: _reduxjs_toolkit.ActionCreatorWithPayload<{
|
|
158
153
|
clientId: string;
|
|
159
154
|
sessionId: string;
|
|
160
|
-
}, "agentSession/setConnected"
|
|
155
|
+
}, "agentSession/setConnected">;
|
|
156
|
+
declare const setDisconnected: _reduxjs_toolkit.ActionCreatorWithoutPayload<"agentSession/setDisconnected">;
|
|
157
|
+
declare const setLastEventId: _reduxjs_toolkit.ActionCreatorWithPayload<string, "agentSession/setLastEventId">;
|
|
158
|
+
declare const updateLastServerInteraction: _reduxjs_toolkit.ActionCreatorWithPayload<number, "agentSession/updateLastServerInteraction">;
|
|
159
|
+
declare const setConnectionHealth: _reduxjs_toolkit.ActionCreatorWithPayload<"healthy" | "stale" | "dead", "agentSession/setConnectionHealth">;
|
|
160
|
+
declare const setReconnectAttempts: _reduxjs_toolkit.ActionCreatorWithPayload<number, "agentSession/setReconnectAttempts">;
|
|
161
|
+
declare const setReady: _reduxjs_toolkit.ActionCreatorWithPayload<{
|
|
161
162
|
sandboxId?: string;
|
|
162
163
|
sandboxUrl?: string;
|
|
163
|
-
}, "agentSession/setReady"
|
|
164
|
+
}, "agentSession/setReady">;
|
|
165
|
+
declare const setSandboxStatus: _reduxjs_toolkit.ActionCreatorWithPayload<{
|
|
164
166
|
status: SandboxStatus;
|
|
165
167
|
sandboxId?: string;
|
|
166
168
|
sandboxUrl?: string;
|
|
167
169
|
error?: string;
|
|
168
|
-
}, "agentSession/setSandboxStatus"
|
|
170
|
+
}, "agentSession/setSandboxStatus">;
|
|
171
|
+
declare const setLifecycle: _reduxjs_toolkit.ActionCreatorWithPayload<{
|
|
169
172
|
phase: SandboxLifecycle;
|
|
170
173
|
message?: string;
|
|
171
|
-
}, "agentSession/setLifecycle"
|
|
174
|
+
}, "agentSession/setLifecycle">;
|
|
175
|
+
declare const agentStarted: _reduxjs_toolkit.ActionCreatorWithOptionalPayload<{
|
|
172
176
|
prompt?: string;
|
|
173
177
|
clientMessageId?: string;
|
|
174
178
|
author?: MessageAuthor;
|
|
175
|
-
} | undefined, "agentSession/agentStarted"
|
|
179
|
+
} | undefined, "agentSession/agentStarted">;
|
|
180
|
+
declare const updateAgentMessage: _reduxjs_toolkit.ActionCreatorWithPayload<{
|
|
176
181
|
content: ContentBlock[];
|
|
177
|
-
}, "agentSession/updateAgentMessage"
|
|
182
|
+
}, "agentSession/updateAgentMessage">;
|
|
183
|
+
declare const agentDone: _reduxjs_toolkit.ActionCreatorWithPayload<{
|
|
178
184
|
sessionId?: string;
|
|
179
|
-
}, "agentSession/agentDone"
|
|
185
|
+
}, "agentSession/agentDone">;
|
|
186
|
+
declare const agentError: _reduxjs_toolkit.ActionCreatorWithPayload<{
|
|
180
187
|
error: string;
|
|
181
|
-
}, "agentSession/agentError"
|
|
188
|
+
}, "agentSession/agentError">;
|
|
189
|
+
declare const addUserMessage: _reduxjs_toolkit.ActionCreatorWithPayload<{
|
|
182
190
|
content: string;
|
|
183
191
|
clientMessageId?: string;
|
|
184
192
|
author?: MessageAuthor;
|
|
185
|
-
}, "agentSession/addUserMessage"
|
|
193
|
+
}, "agentSession/addUserMessage">;
|
|
194
|
+
declare const markMessageSent: _reduxjs_toolkit.ActionCreatorWithPayload<{
|
|
186
195
|
clientMessageId: string;
|
|
187
|
-
}, "agentSession/markMessageSent"
|
|
196
|
+
}, "agentSession/markMessageSent">;
|
|
197
|
+
declare const markMessageFailed: _reduxjs_toolkit.ActionCreatorWithPayload<{
|
|
188
198
|
clientMessageId: string;
|
|
189
199
|
error: string;
|
|
190
|
-
}, "agentSession/markMessageFailed"
|
|
200
|
+
}, "agentSession/markMessageFailed">;
|
|
201
|
+
declare const addUploadedFile: _reduxjs_toolkit.ActionCreatorWithPayload<UploadedFile, "agentSession/addUploadedFile">;
|
|
202
|
+
declare const clearUploadedFiles: _reduxjs_toolkit.ActionCreatorWithoutPayload<"agentSession/clearUploadedFiles">;
|
|
203
|
+
declare const setSandboxFiles: _reduxjs_toolkit.ActionCreatorWithPayload<SandboxFile[], "agentSession/setSandboxFiles">;
|
|
204
|
+
declare const setError: _reduxjs_toolkit.ActionCreatorWithPayload<string, "agentSession/setError">;
|
|
205
|
+
declare const clearMessages: _reduxjs_toolkit.ActionCreatorWithoutPayload<"agentSession/clearMessages">;
|
|
206
|
+
declare const clearAgentSession: _reduxjs_toolkit.ActionCreatorWithoutPayload<"agentSession/clearAgentSession">;
|
|
207
|
+
declare const resetState: _reduxjs_toolkit.ActionCreatorWithoutPayload<"agentSession/resetState">;
|
|
208
|
+
declare const resetSessionState: _reduxjs_toolkit.ActionCreatorWithoutPayload<"agentSession/resetSessionState">;
|
|
191
209
|
type RootState = {
|
|
192
210
|
agentSession: AgentSessionState;
|
|
193
211
|
};
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
declare const _default:
|
|
213
|
-
|
|
214
|
-
|
|
212
|
+
declare const selectIsConnected: (state: RootState) => boolean;
|
|
213
|
+
declare const selectClientId: (state: RootState) => string | null;
|
|
214
|
+
declare const selectSessionId: (state: RootState) => string | null;
|
|
215
|
+
declare const selectLastEventId: (state: RootState) => string | null;
|
|
216
|
+
declare const selectLastServerInteraction: (state: RootState) => number;
|
|
217
|
+
declare const selectConnectionHealth: (state: RootState) => "healthy" | "stale" | "dead";
|
|
218
|
+
declare const selectReconnectAttempts: (state: RootState) => number;
|
|
219
|
+
declare const selectSandboxStatus: (state: RootState) => SandboxStatus;
|
|
220
|
+
declare const selectSandboxId: (state: RootState) => string | null;
|
|
221
|
+
declare const selectSandboxUrl: (state: RootState) => string | null;
|
|
222
|
+
declare const selectLifecycle: (state: RootState) => SandboxLifecycle;
|
|
223
|
+
declare const selectLifecycleMessage: (state: RootState) => string | null;
|
|
224
|
+
declare const selectAgentStatus: (state: RootState) => "error" | "idle" | "streaming";
|
|
225
|
+
declare const selectAgentSessionId: (state: RootState) => string | null;
|
|
226
|
+
declare const selectMessages: (state: RootState) => AgentMessage[];
|
|
227
|
+
declare const selectUploadedFiles: (state: RootState) => UploadedFile[];
|
|
228
|
+
declare const selectSandboxFiles: (state: RootState) => SandboxFile[];
|
|
229
|
+
declare const selectError: (state: RootState) => string | null;
|
|
230
|
+
declare const _default: _reduxjs_toolkit.Reducer<AgentSessionState>;
|
|
231
|
+
|
|
232
|
+
export { type AgentMessage, type StartSandboxPayload, type UploadedFile, addUploadedFile, addUserMessage, agentDone, agentError, agentStarted, clearAgentSession, clearMessages, clearUploadedFiles, connectSession, _default as default, disconnectSession, execCommand, forceReconnect, markMessageFailed, markMessageSent, resetAgent, resetSessionState, resetState, selectAgentSessionId, selectAgentStatus, selectClientId, selectConnectionHealth, selectError, selectIsConnected, selectLastEventId, selectLastServerInteraction, selectLifecycle, selectLifecycleMessage, selectMessages, selectReconnectAttempts, selectSandboxFiles, selectSandboxId, selectSandboxStatus, selectSandboxUrl, selectSessionId, selectUploadedFiles, sendAgentMessage, sessionSocketManager, setConnected, setConnectionHealth, setDisconnected, setError, setLastEventId, setLifecycle, setReady, setReconnectAttempts, setSandboxFiles, setSandboxStatus, startSandbox, stopAgent, stopSandbox, updateAgentMessage, updateLastServerInteraction };
|