@mirasoth/soothe-client 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 +83 -0
- package/dist/chunk-OMAC7LA7.js +647 -0
- package/dist/chunk-OMAC7LA7.js.map +1 -0
- package/dist/client-QS23U6WX.js +7 -0
- package/dist/client-QS23U6WX.js.map +1 -0
- package/dist/index.cjs +1127 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +497 -0
- package/dist/index.d.ts +497 -0
- package/dist/index.js +383 -0
- package/dist/index.js.map +1 -0
- package/package.json +45 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,497 @@
|
|
|
1
|
+
import { EventEmitter } from 'node:events';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Custom error types for the Soothe client.
|
|
5
|
+
*/
|
|
6
|
+
/** Represents a WebSocket connection failure. */
|
|
7
|
+
declare class ConnectionError extends Error {
|
|
8
|
+
readonly url: string;
|
|
9
|
+
readonly attempt: number;
|
|
10
|
+
readonly cause: Error;
|
|
11
|
+
constructor(url: string, attempt: number, cause: Error);
|
|
12
|
+
}
|
|
13
|
+
/** Represents an error reported by the Soothe daemon. */
|
|
14
|
+
declare class DaemonError extends Error {
|
|
15
|
+
readonly code: string;
|
|
16
|
+
/** The daemon's error message text. */
|
|
17
|
+
readonly daemonMessage: string;
|
|
18
|
+
constructor(code: string, message: string);
|
|
19
|
+
}
|
|
20
|
+
/** Represents a timeout waiting for a daemon response. */
|
|
21
|
+
declare class TimeoutError extends Error {
|
|
22
|
+
readonly operation: string;
|
|
23
|
+
readonly duration: string;
|
|
24
|
+
constructor(operation: string, duration: string);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Verbosity levels and tiers for event filtering.
|
|
29
|
+
*/
|
|
30
|
+
/** User-configurable verbosity setting. */
|
|
31
|
+
type VerbosityLevel = 'quiet' | 'normal' | 'debug';
|
|
32
|
+
/** Minimum verbosity level at which content is visible. */
|
|
33
|
+
declare enum VerbosityTier {
|
|
34
|
+
/** Always visible (errors, assistant text, final reports) */
|
|
35
|
+
Quiet = 0,
|
|
36
|
+
/** Standard progress (plan updates, milestones, agentic loop) */
|
|
37
|
+
Normal = 1,
|
|
38
|
+
/** Detailed internals (protocol events, tool calls, subagent activity) */
|
|
39
|
+
Detailed = 2,
|
|
40
|
+
/** Everything including internals (thinking, heartbeats) */
|
|
41
|
+
Debug = 3,
|
|
42
|
+
/** Never shown at any level (implementation details) */
|
|
43
|
+
Internal = 99
|
|
44
|
+
}
|
|
45
|
+
/** Returns true if content at the given tier is visible at the given verbosity. */
|
|
46
|
+
declare function shouldShow(tier: VerbosityTier, verbosity: VerbosityLevel): boolean;
|
|
47
|
+
/** Checks whether a string is a valid verbosity level. */
|
|
48
|
+
declare function isValidVerbosityLevel(s: string): s is VerbosityLevel;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Client configuration for connecting to the Soothe daemon.
|
|
52
|
+
*/
|
|
53
|
+
|
|
54
|
+
interface Config {
|
|
55
|
+
/** WebSocket URL for Soothe daemon */
|
|
56
|
+
daemonURL: string;
|
|
57
|
+
/** Event verbosity: quiet/minimal/normal/detailed/debug */
|
|
58
|
+
verbosityLevel: VerbosityLevel;
|
|
59
|
+
/** Maximum connection retry attempts */
|
|
60
|
+
maxRetries: number;
|
|
61
|
+
/** Initial reconnect delay in ms */
|
|
62
|
+
reconnectDelay: number;
|
|
63
|
+
/** Application-level heartbeat interval in ms */
|
|
64
|
+
heartbeatInterval: number;
|
|
65
|
+
/** Handshake: wait for daemon_ready in ms */
|
|
66
|
+
daemonReadyTimeout: number;
|
|
67
|
+
/** Bootstrap: wait for status with loop_id in ms */
|
|
68
|
+
loopStatusTimeout: number;
|
|
69
|
+
/** After loop_subscribe: wait for confirmation in ms */
|
|
70
|
+
subscriptionTimeout: number;
|
|
71
|
+
}
|
|
72
|
+
/** Returns default configuration. */
|
|
73
|
+
declare function defaultConfig(): Config;
|
|
74
|
+
/** Loads configuration from environment variables. */
|
|
75
|
+
declare function loadConfigFromEnv(): Config;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Message types, encode/decode, NDJSON splitting, and factory functions
|
|
79
|
+
* for the Soothe daemon wire protocol.
|
|
80
|
+
*/
|
|
81
|
+
interface BaseMessage {
|
|
82
|
+
type: string;
|
|
83
|
+
request_id?: string;
|
|
84
|
+
}
|
|
85
|
+
/** Loop-scoped user input. */
|
|
86
|
+
interface LoopInputMessage extends BaseMessage {
|
|
87
|
+
type: 'loop_input';
|
|
88
|
+
loop_id: string;
|
|
89
|
+
content: string;
|
|
90
|
+
autonomous?: boolean;
|
|
91
|
+
max_iterations?: number;
|
|
92
|
+
preferred_subagent?: string;
|
|
93
|
+
interactive?: boolean;
|
|
94
|
+
model?: string;
|
|
95
|
+
model_params?: Record<string, unknown>;
|
|
96
|
+
attachments?: Record<string, unknown>[];
|
|
97
|
+
}
|
|
98
|
+
interface CommandMessage extends BaseMessage {
|
|
99
|
+
type: 'command';
|
|
100
|
+
cmd: string;
|
|
101
|
+
}
|
|
102
|
+
interface DaemonStatusMessage extends BaseMessage {
|
|
103
|
+
type: 'daemon_status';
|
|
104
|
+
}
|
|
105
|
+
interface DaemonShutdownMessage extends BaseMessage {
|
|
106
|
+
type: 'daemon_shutdown';
|
|
107
|
+
}
|
|
108
|
+
interface ConfigGetMessage extends BaseMessage {
|
|
109
|
+
type: 'config_get';
|
|
110
|
+
section: string;
|
|
111
|
+
}
|
|
112
|
+
interface LoopNewMessage extends BaseMessage {
|
|
113
|
+
type: 'loop_new';
|
|
114
|
+
/** Project directory; runner uses this path directly when set. */
|
|
115
|
+
client_workspace?: string;
|
|
116
|
+
/** Stable scope for persisted sandbox when client_workspace is unset. */
|
|
117
|
+
client_workspace_id?: string;
|
|
118
|
+
/** User segment under $SOOTHE_HOME/workspaces/ (empty → anonymous). */
|
|
119
|
+
user_id?: string;
|
|
120
|
+
/** When true, loop execution data is GC'd after idle period (workspace retained). */
|
|
121
|
+
is_ephemeral?: boolean;
|
|
122
|
+
/**
|
|
123
|
+
* @deprecated Use `client_workspace`. Still accepted by the daemon as an alias.
|
|
124
|
+
*/
|
|
125
|
+
workspace?: string;
|
|
126
|
+
}
|
|
127
|
+
/** Options for `loop_new` workspace fields. */
|
|
128
|
+
interface LoopNewOptions {
|
|
129
|
+
client_workspace?: string;
|
|
130
|
+
client_workspace_id?: string;
|
|
131
|
+
user_id?: string;
|
|
132
|
+
is_ephemeral?: boolean;
|
|
133
|
+
/** @deprecated Use `client_workspace`. */
|
|
134
|
+
workspace?: string;
|
|
135
|
+
}
|
|
136
|
+
interface LoopSubscribeMessage extends BaseMessage {
|
|
137
|
+
type: 'loop_subscribe';
|
|
138
|
+
loop_id: string;
|
|
139
|
+
verbosity: string;
|
|
140
|
+
stream_delivery?: 'batch' | 'streaming';
|
|
141
|
+
}
|
|
142
|
+
interface LoopDetachMessage extends BaseMessage {
|
|
143
|
+
type: 'loop_detach';
|
|
144
|
+
loop_id: string;
|
|
145
|
+
}
|
|
146
|
+
interface LoopListMessage extends BaseMessage {
|
|
147
|
+
type: 'loop_list';
|
|
148
|
+
filter?: Record<string, unknown>;
|
|
149
|
+
limit?: number;
|
|
150
|
+
}
|
|
151
|
+
interface LoopGetMessage extends BaseMessage {
|
|
152
|
+
type: 'loop_get';
|
|
153
|
+
loop_id: string;
|
|
154
|
+
verbose?: boolean;
|
|
155
|
+
}
|
|
156
|
+
interface LoopTreeMessage extends BaseMessage {
|
|
157
|
+
type: 'loop_tree';
|
|
158
|
+
loop_id: string;
|
|
159
|
+
format?: string;
|
|
160
|
+
}
|
|
161
|
+
interface LoopPruneMessage extends BaseMessage {
|
|
162
|
+
type: 'loop_prune';
|
|
163
|
+
loop_id: string;
|
|
164
|
+
retention_days?: number;
|
|
165
|
+
dry_run?: boolean;
|
|
166
|
+
}
|
|
167
|
+
interface LoopDeleteMessage extends BaseMessage {
|
|
168
|
+
type: 'loop_delete';
|
|
169
|
+
loop_id: string;
|
|
170
|
+
}
|
|
171
|
+
interface LoopReattachMessage extends BaseMessage {
|
|
172
|
+
type: 'loop_reattach';
|
|
173
|
+
loop_id: string;
|
|
174
|
+
}
|
|
175
|
+
interface SkillsListMessage extends BaseMessage {
|
|
176
|
+
type: 'skills_list';
|
|
177
|
+
}
|
|
178
|
+
interface ModelsListMessage extends BaseMessage {
|
|
179
|
+
type: 'models_list';
|
|
180
|
+
}
|
|
181
|
+
interface InvokeSkillMessage extends BaseMessage {
|
|
182
|
+
type: 'invoke_skill';
|
|
183
|
+
skill: string;
|
|
184
|
+
args?: string;
|
|
185
|
+
}
|
|
186
|
+
interface DetachMessage extends BaseMessage {
|
|
187
|
+
type: 'detach';
|
|
188
|
+
}
|
|
189
|
+
interface EventMessage extends BaseMessage {
|
|
190
|
+
type: 'event';
|
|
191
|
+
loop_id?: string;
|
|
192
|
+
namespace: string;
|
|
193
|
+
data: Record<string, unknown>;
|
|
194
|
+
timestamp?: string;
|
|
195
|
+
}
|
|
196
|
+
interface StatusResponse extends BaseMessage {
|
|
197
|
+
type: 'status';
|
|
198
|
+
state: string;
|
|
199
|
+
loop_id?: string;
|
|
200
|
+
workspace: string;
|
|
201
|
+
input_history?: string[];
|
|
202
|
+
conversation_history?: unknown[];
|
|
203
|
+
}
|
|
204
|
+
interface SubscriptionConfirmedResponse extends BaseMessage {
|
|
205
|
+
type: 'subscription_confirmed';
|
|
206
|
+
loop_id?: string;
|
|
207
|
+
client_id: string;
|
|
208
|
+
verbosity: string;
|
|
209
|
+
}
|
|
210
|
+
interface ErrorResponse extends BaseMessage {
|
|
211
|
+
type: 'error';
|
|
212
|
+
code: string;
|
|
213
|
+
message: string;
|
|
214
|
+
}
|
|
215
|
+
interface DaemonReadyResponse extends BaseMessage {
|
|
216
|
+
type: 'daemon_ready';
|
|
217
|
+
state: string;
|
|
218
|
+
message?: string;
|
|
219
|
+
}
|
|
220
|
+
interface DaemonStatusResponse extends BaseMessage {
|
|
221
|
+
type: 'daemon_status_response';
|
|
222
|
+
running: boolean;
|
|
223
|
+
port_live: boolean;
|
|
224
|
+
active_loops: number;
|
|
225
|
+
}
|
|
226
|
+
interface ShutdownAckResponse extends BaseMessage {
|
|
227
|
+
type: 'shutdown_ack';
|
|
228
|
+
status: string;
|
|
229
|
+
}
|
|
230
|
+
interface LoopNewResponse extends BaseMessage {
|
|
231
|
+
type: 'loop_new_response';
|
|
232
|
+
loop_id: string;
|
|
233
|
+
success?: boolean;
|
|
234
|
+
is_ephemeral?: boolean;
|
|
235
|
+
}
|
|
236
|
+
interface LoopSubscribeResponse extends BaseMessage {
|
|
237
|
+
type: 'loop_subscribe_response';
|
|
238
|
+
loop_id?: string;
|
|
239
|
+
success: boolean;
|
|
240
|
+
message?: string;
|
|
241
|
+
}
|
|
242
|
+
interface LoopDetachResponse extends BaseMessage {
|
|
243
|
+
type: 'loop_detach_response';
|
|
244
|
+
loop_id?: string;
|
|
245
|
+
success: boolean;
|
|
246
|
+
}
|
|
247
|
+
interface LoopListResponse extends BaseMessage {
|
|
248
|
+
type: 'loop_list_response';
|
|
249
|
+
loops?: Record<string, unknown>[];
|
|
250
|
+
total?: number;
|
|
251
|
+
}
|
|
252
|
+
interface LoopGetResponse extends BaseMessage {
|
|
253
|
+
type: 'loop_get_response';
|
|
254
|
+
loop?: Record<string, unknown>;
|
|
255
|
+
}
|
|
256
|
+
interface LoopTreeResponse extends BaseMessage {
|
|
257
|
+
type: 'loop_tree_response';
|
|
258
|
+
tree?: Record<string, unknown>;
|
|
259
|
+
}
|
|
260
|
+
interface LoopPruneResponse extends BaseMessage {
|
|
261
|
+
type: 'loop_prune_response';
|
|
262
|
+
result?: Record<string, unknown>;
|
|
263
|
+
}
|
|
264
|
+
interface LoopDeleteResponse extends BaseMessage {
|
|
265
|
+
type: 'loop_delete_response';
|
|
266
|
+
success: boolean;
|
|
267
|
+
message?: string;
|
|
268
|
+
}
|
|
269
|
+
interface LoopReattachResponse extends BaseMessage {
|
|
270
|
+
type: 'loop_reattach_response';
|
|
271
|
+
loop_id?: string;
|
|
272
|
+
success?: boolean;
|
|
273
|
+
}
|
|
274
|
+
interface HistoryReplayMessage extends BaseMessage {
|
|
275
|
+
type: 'history_replay';
|
|
276
|
+
loop_id?: string;
|
|
277
|
+
events?: Record<string, unknown>[];
|
|
278
|
+
total_events?: number;
|
|
279
|
+
}
|
|
280
|
+
interface HistoryReplayCompleteMessage extends BaseMessage {
|
|
281
|
+
type: 'history_replay_complete';
|
|
282
|
+
loop_id?: string;
|
|
283
|
+
}
|
|
284
|
+
interface ReplayCompleteMessage extends BaseMessage {
|
|
285
|
+
type: 'replay_complete';
|
|
286
|
+
loop_id?: string;
|
|
287
|
+
event_count?: number;
|
|
288
|
+
}
|
|
289
|
+
interface LoopReattachedWireMessage extends BaseMessage {
|
|
290
|
+
type: 'loop_reattached';
|
|
291
|
+
loop_id?: string;
|
|
292
|
+
timestamp?: string;
|
|
293
|
+
}
|
|
294
|
+
interface SkillsListResponse extends BaseMessage {
|
|
295
|
+
type: 'skills_list_response';
|
|
296
|
+
skills?: Record<string, unknown>[];
|
|
297
|
+
}
|
|
298
|
+
interface ModelsListResponse extends BaseMessage {
|
|
299
|
+
type: 'models_list_response';
|
|
300
|
+
models?: Record<string, unknown>[];
|
|
301
|
+
}
|
|
302
|
+
type DecodedMessage = LoopInputMessage | CommandMessage | DaemonStatusMessage | DaemonShutdownMessage | ConfigGetMessage | LoopNewMessage | LoopSubscribeMessage | LoopDetachMessage | LoopListMessage | LoopGetMessage | LoopTreeMessage | LoopPruneMessage | LoopDeleteMessage | LoopReattachMessage | SkillsListMessage | ModelsListMessage | InvokeSkillMessage | DetachMessage | EventMessage | StatusResponse | SubscriptionConfirmedResponse | ErrorResponse | DaemonReadyResponse | DaemonStatusResponse | ShutdownAckResponse | LoopNewResponse | LoopSubscribeResponse | LoopDetachResponse | LoopListResponse | LoopGetResponse | LoopTreeResponse | LoopPruneResponse | LoopDeleteResponse | LoopReattachResponse | HistoryReplayMessage | HistoryReplayCompleteMessage | ReplayCompleteMessage | LoopReattachedWireMessage | SkillsListResponse | ModelsListResponse | Record<string, unknown>;
|
|
303
|
+
/** Encodes a message as JSON with newline delimiter. */
|
|
304
|
+
declare function encodeMessage(msg: unknown): string;
|
|
305
|
+
/** Decodes a JSON message and returns a typed object. Unknown types return a raw map. */
|
|
306
|
+
declare function decodeMessage(data: string): DecodedMessage | null;
|
|
307
|
+
/** Splits a single WebSocket text payload into individual JSON lines. */
|
|
308
|
+
declare function splitWirePayload(data: string): string[];
|
|
309
|
+
/**
|
|
310
|
+
* Returns the AgentLoop id when present in a message.
|
|
311
|
+
* Prefers loop_id field.
|
|
312
|
+
*/
|
|
313
|
+
declare function extractSootheLoopID(msg: unknown): [string, boolean];
|
|
314
|
+
/** Generates a new UUID request ID. */
|
|
315
|
+
declare function newRequestID(): string;
|
|
316
|
+
/** Creates a loop_input message with required fields. */
|
|
317
|
+
declare function newLoopInputMessage(loopID: string, content: string): LoopInputMessage;
|
|
318
|
+
/** Creates a loop_new message. */
|
|
319
|
+
declare function newLoopNewMessage(opts?: LoopNewOptions | string): LoopNewMessage;
|
|
320
|
+
/** Creates a loop_subscribe message. */
|
|
321
|
+
declare function newLoopSubscribeMessage(loopID: string, verbosity: string, streamDelivery?: 'batch' | 'streaming'): LoopSubscribeMessage;
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* Client-facing event namespace constants for the Soothe daemon wire protocol.
|
|
325
|
+
*
|
|
326
|
+
* Internal catalog types (`soothe.internal.*`) are server-only and are never
|
|
327
|
+
* broadcast to WebSocket clients. Do not add them here.
|
|
328
|
+
*
|
|
329
|
+
* Format: soothe.<domain>.<component>.<action>
|
|
330
|
+
*/
|
|
331
|
+
|
|
332
|
+
declare const EventPlanCreated = "soothe.cognition.plan.created";
|
|
333
|
+
declare const EventExploreStarted = "soothe.subagent.explore.started";
|
|
334
|
+
declare const EventExploreMilestone = "soothe.subagent.explore.milestone";
|
|
335
|
+
declare const EventExploreStepCompleted = "soothe.subagent.explore.step.completed";
|
|
336
|
+
declare const EventExploreCompleted = "soothe.subagent.explore.completed";
|
|
337
|
+
declare const EventTacitusStarted = "soothe.subagent.tacitus.started";
|
|
338
|
+
declare const EventTacitusGatherSummary = "soothe.subagent.tacitus.gather.summary";
|
|
339
|
+
declare const EventTacitusCompleted = "soothe.subagent.tacitus.completed";
|
|
340
|
+
declare const EventReplayComplete = "replay_complete";
|
|
341
|
+
declare const EventLoopReattachedWire = "loop_reattached";
|
|
342
|
+
declare const EventToolStarted = "soothe.tool.execution.started";
|
|
343
|
+
declare const EventToolCompleted = "soothe.tool.execution.completed";
|
|
344
|
+
declare const EventToolError = "soothe.tool.execution.error";
|
|
345
|
+
declare const EventStreamToolCallUpdate = "soothe.stream.tool_call.update";
|
|
346
|
+
declare const EventToolCallUpdatesBatch = "tool_call_updates_batch";
|
|
347
|
+
declare const EventAgentLoopStarted = "soothe.cognition.agent_loop.started";
|
|
348
|
+
declare const EventAgentLoopIterated = "soothe.cognition.agent_loop.iterated";
|
|
349
|
+
declare const EventAgentLoopCompleted = "soothe.cognition.agent_loop.completed";
|
|
350
|
+
declare const EventAgentLoopReasoned = "soothe.cognition.agent_loop.reasoned";
|
|
351
|
+
declare const EventMessageReceived = "soothe.protocol.message.received";
|
|
352
|
+
declare const EventMessageSent = "soothe.protocol.message.sent";
|
|
353
|
+
declare const EventFinalReport = "soothe.output.autonomous.final_report.reported";
|
|
354
|
+
declare const EventGeneralFailed = "soothe.error.general.failed";
|
|
355
|
+
/** Splits a 4-segment event namespace into domain, component, and action. */
|
|
356
|
+
declare function parseNamespace(ns: string): {
|
|
357
|
+
domain: string;
|
|
358
|
+
component: string;
|
|
359
|
+
action: string;
|
|
360
|
+
} | null;
|
|
361
|
+
/** Returns the VerbosityTier for a given event type string. */
|
|
362
|
+
declare function classifyEventVerbosity(eventTypeOrNamespace: string): VerbosityTier;
|
|
363
|
+
/** Event types that represent completion milestones. */
|
|
364
|
+
declare function isCompletionEvent(eventType: string): boolean;
|
|
365
|
+
/** Lifecycle subagent events (started/completed) for progress UI. */
|
|
366
|
+
declare function isSubagentProgressEvent(eventType: string): boolean;
|
|
367
|
+
/** Essential progress event types for minimal UI surfaces. */
|
|
368
|
+
declare const ESSENTIAL_EVENT_TYPES: ReadonlySet<string>;
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* Client manages a WebSocket session with the Soothe daemon.
|
|
372
|
+
* After close(), a new Client must be created to reconnect.
|
|
373
|
+
*/
|
|
374
|
+
|
|
375
|
+
interface InputOptions {
|
|
376
|
+
/** Subscribed AgentLoop id (required for loop_input). */
|
|
377
|
+
loopID?: string;
|
|
378
|
+
autonomous?: boolean;
|
|
379
|
+
maxIterations?: number;
|
|
380
|
+
subagent?: string;
|
|
381
|
+
interactive?: boolean;
|
|
382
|
+
model?: string;
|
|
383
|
+
modelParams?: Record<string, unknown>;
|
|
384
|
+
attachments?: Record<string, unknown>[];
|
|
385
|
+
}
|
|
386
|
+
declare class Client extends EventEmitter {
|
|
387
|
+
private url;
|
|
388
|
+
private config;
|
|
389
|
+
private ws;
|
|
390
|
+
private messageBuffer;
|
|
391
|
+
private resolvers;
|
|
392
|
+
constructor(url: string, config?: Config);
|
|
393
|
+
/** Dials the Soothe daemon WebSocket. No WS-level ping/pong (RFC-0013). */
|
|
394
|
+
connect(): Promise<void>;
|
|
395
|
+
/** Shuts down the WebSocket connection. */
|
|
396
|
+
close(): void;
|
|
397
|
+
/** Returns whether the client has an active WebSocket connection. */
|
|
398
|
+
isConnected(): boolean;
|
|
399
|
+
/** Serializes msg as JSON and sends it as a WebSocket text frame. */
|
|
400
|
+
sendMessage(msg: unknown): Promise<void>;
|
|
401
|
+
/** Returns an async iterable of decoded messages. Ends when connection closes. */
|
|
402
|
+
receiveMessages(signal?: AbortSignal): AsyncGenerator<DecodedMessage>;
|
|
403
|
+
/** Reads a single event from the daemon. Returns null on connection close. */
|
|
404
|
+
readEvent(): Promise<Record<string, unknown> | null>;
|
|
405
|
+
/** Reads a single event with a timeout. Returns null on timeout or connection close. */
|
|
406
|
+
readEventWithTimeout(timeout: number): Promise<Record<string, unknown> | null>;
|
|
407
|
+
/** Sends user input to the daemon (loop_input; requires loopID). */
|
|
408
|
+
sendInput(text: string, options?: InputOptions): Promise<void>;
|
|
409
|
+
/** Sends a slash command to the daemon. */
|
|
410
|
+
sendCommand(cmd: string): Promise<void>;
|
|
411
|
+
/** Requests the daemon to create a new AgentLoop. */
|
|
412
|
+
sendLoopNew(opts?: LoopNewOptions | string): Promise<void>;
|
|
413
|
+
/** Subscribes to events for a loop. */
|
|
414
|
+
sendLoopSubscribe(loopID: string, verbosity: string, streamDelivery?: 'batch' | 'streaming'): Promise<void>;
|
|
415
|
+
/** Detaches from a loop (keeps loop running). */
|
|
416
|
+
sendLoopDetach(loopID: string, requestID?: string): Promise<void>;
|
|
417
|
+
/** Notifies the daemon that this client is detaching. */
|
|
418
|
+
sendDetach(): Promise<void>;
|
|
419
|
+
/** Sends the daemon_ready handshake message. */
|
|
420
|
+
sendDaemonReady(): Promise<void>;
|
|
421
|
+
/** Requests daemon status check. */
|
|
422
|
+
sendDaemonStatus(requestID?: string): Promise<void>;
|
|
423
|
+
/** Requests daemon shutdown. */
|
|
424
|
+
sendDaemonShutdown(requestID?: string): Promise<void>;
|
|
425
|
+
/** Requests a config section from the daemon. */
|
|
426
|
+
sendConfigGet(section: string, requestID?: string): Promise<void>;
|
|
427
|
+
/** Requests the persisted loop list. */
|
|
428
|
+
sendLoopList(filter?: Record<string, unknown>, limit?: number, requestID?: string): Promise<void>;
|
|
429
|
+
/** Requests detailed loop metadata. */
|
|
430
|
+
sendLoopGet(loopID: string, verbose?: boolean, requestID?: string): Promise<void>;
|
|
431
|
+
/** Requests loop tree visualization. */
|
|
432
|
+
sendLoopTree(loopID: string, format?: string, requestID?: string): Promise<void>;
|
|
433
|
+
/** Requests pruning of old failed branches. */
|
|
434
|
+
sendLoopPrune(loopID: string, retentionDays?: number, dryRun?: boolean, requestID?: string): Promise<void>;
|
|
435
|
+
/** Requests loop deletion. */
|
|
436
|
+
sendLoopDelete(loopID: string, requestID?: string): Promise<void>;
|
|
437
|
+
/** Requests reattachment to a loop with history replay. */
|
|
438
|
+
sendLoopReattach(loopID: string, requestID?: string): Promise<void>;
|
|
439
|
+
/** Requests the skills catalog (RFC-400). */
|
|
440
|
+
sendSkillsList(requestID?: string): Promise<void>;
|
|
441
|
+
/** Requests the models catalog (RFC-400). */
|
|
442
|
+
sendModelsList(requestID?: string): Promise<void>;
|
|
443
|
+
/** Invokes a skill on the daemon (RFC-400). */
|
|
444
|
+
sendInvokeSkill(skill: string, args?: string, requestID?: string): Promise<void>;
|
|
445
|
+
/** Sends a request with a unique request_id and waits for a matching response. */
|
|
446
|
+
requestResponse(payload: Record<string, unknown>, responseType: string, timeout: number): Promise<Record<string, unknown>>;
|
|
447
|
+
/** Requests the skills catalog and waits for the response. */
|
|
448
|
+
listSkills(timeout?: number): Promise<Record<string, unknown>>;
|
|
449
|
+
/** Requests the models catalog and waits for the response. */
|
|
450
|
+
listModels(timeout?: number): Promise<Record<string, unknown>>;
|
|
451
|
+
/** Invokes a skill on the daemon host and receives echo (RFC-400). */
|
|
452
|
+
invokeSkill(skill: string, args?: string, timeout?: number): Promise<Record<string, unknown>>;
|
|
453
|
+
/** Requests loop list and waits for response. */
|
|
454
|
+
listLoops(timeout?: number): Promise<Record<string, unknown>>;
|
|
455
|
+
/** Requests loop details and waits for response. */
|
|
456
|
+
getLoop(loopID: string, timeout?: number): Promise<Record<string, unknown>>;
|
|
457
|
+
/** Requests loop tree and waits for response. */
|
|
458
|
+
getLoopTree(loopID: string, timeout?: number): Promise<Record<string, unknown>>;
|
|
459
|
+
/** Requests loop deletion and waits for response. */
|
|
460
|
+
deleteLoop(loopID: string, timeout?: number): Promise<Record<string, unknown>>;
|
|
461
|
+
/** Reads events until a daemon_ready with state == "ready". */
|
|
462
|
+
waitForDaemonReady(timeout?: number): Promise<Record<string, unknown>>;
|
|
463
|
+
/** Waits for subscription confirmation matching loop id. */
|
|
464
|
+
waitForSubscriptionConfirmed(loopID: string, _verbosity: string, timeout?: number): Promise<void>;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
/**
|
|
468
|
+
* Convenience RPC helper functions for the Soothe client.
|
|
469
|
+
*/
|
|
470
|
+
|
|
471
|
+
/** Checks daemon status via RPC. */
|
|
472
|
+
declare function checkDaemonStatus(client: Client, timeout?: number): Promise<Record<string, unknown>>;
|
|
473
|
+
/** Performs a composite health check: connect + status RPC. */
|
|
474
|
+
declare function isDaemonLive(wsURL: string, timeout?: number): Promise<boolean>;
|
|
475
|
+
/** Requests daemon shutdown via RPC. */
|
|
476
|
+
declare function requestDaemonShutdown(client: Client, timeout?: number): Promise<void>;
|
|
477
|
+
/** Fetches the skills catalog via RPC. */
|
|
478
|
+
declare function fetchSkillsCatalog(client: Client, timeout?: number): Promise<Record<string, unknown>[]>;
|
|
479
|
+
/** Fetches a daemon config section via RPC. */
|
|
480
|
+
declare function fetchConfigSection(client: Client, section: string, timeout?: number): Promise<Record<string, unknown>>;
|
|
481
|
+
|
|
482
|
+
/**
|
|
483
|
+
* Session bootstrap flows, wait helpers, and connect-with-retries.
|
|
484
|
+
*/
|
|
485
|
+
|
|
486
|
+
/** Daemon ready → loop_new (or reuse id) → loop_subscribe; returns loop id. */
|
|
487
|
+
declare function bootstrapLoopSession(client: Client, resumeLoopId: string | null | undefined, config?: Config, loopNew?: LoopNewOptions): Promise<string>;
|
|
488
|
+
/** Blocks until a daemon_ready message with state == "ready". */
|
|
489
|
+
declare function waitDaemonReady(client: Client, timeout: number): Promise<void>;
|
|
490
|
+
/** Waits for a status message with a non-empty ``loop_id``. */
|
|
491
|
+
declare function waitLoopStatusWithID(client: Client, timeout: number): Promise<StatusResponse>;
|
|
492
|
+
/** Waits for subscription_confirmed or loop_subscribe_response matching loop id. */
|
|
493
|
+
declare function waitSubscriptionConfirmed(client: Client, wantLoopID: string, _wantVerbosity: string, timeout: number): Promise<void>;
|
|
494
|
+
/** Attempts to connect to the Soothe daemon with bounded retries. */
|
|
495
|
+
declare function connectWithRetries(client: Client, maxRetries?: number, retryDelay?: number): Promise<void>;
|
|
496
|
+
|
|
497
|
+
export { type BaseMessage, Client, type CommandMessage, type Config, type ConfigGetMessage, ConnectionError, DaemonError, type DaemonReadyResponse, type DaemonShutdownMessage, type DaemonStatusMessage, type DaemonStatusResponse, type DecodedMessage, type DetachMessage, ESSENTIAL_EVENT_TYPES, type ErrorResponse, EventAgentLoopCompleted, EventAgentLoopIterated, EventAgentLoopReasoned, EventAgentLoopStarted, EventExploreCompleted, EventExploreMilestone, EventExploreStarted, EventExploreStepCompleted, EventFinalReport, EventGeneralFailed, EventLoopReattachedWire, type EventMessage, EventMessageReceived, EventMessageSent, EventPlanCreated, EventReplayComplete, EventStreamToolCallUpdate, EventTacitusCompleted, EventTacitusGatherSummary, EventTacitusStarted, EventToolCallUpdatesBatch, EventToolCompleted, EventToolError, EventToolStarted, type HistoryReplayCompleteMessage, type HistoryReplayMessage, type InputOptions, type InvokeSkillMessage, type LoopDeleteMessage, type LoopDeleteResponse, type LoopDetachMessage, type LoopDetachResponse, type LoopGetMessage, type LoopGetResponse, type LoopInputMessage, type LoopListMessage, type LoopListResponse, type LoopNewMessage, type LoopNewOptions, type LoopNewResponse, type LoopPruneMessage, type LoopPruneResponse, type LoopReattachMessage, type LoopReattachResponse, type LoopSubscribeMessage, type LoopSubscribeResponse, type LoopTreeMessage, type LoopTreeResponse, type ModelsListMessage, type ModelsListResponse, type ShutdownAckResponse, type SkillsListMessage, type SkillsListResponse, type StatusResponse, type SubscriptionConfirmedResponse, TimeoutError, type VerbosityLevel, VerbosityTier, bootstrapLoopSession, checkDaemonStatus, classifyEventVerbosity, connectWithRetries, decodeMessage, defaultConfig, encodeMessage, extractSootheLoopID, fetchConfigSection, fetchSkillsCatalog, isCompletionEvent, isDaemonLive, isSubagentProgressEvent, isValidVerbosityLevel, loadConfigFromEnv, newLoopInputMessage, newLoopNewMessage, newLoopSubscribeMessage, newRequestID, parseNamespace, requestDaemonShutdown, shouldShow, splitWirePayload, waitDaemonReady, waitLoopStatusWithID, waitSubscriptionConfirmed };
|