@mirasoth/soothe-client 0.5.4 → 0.5.7
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/{chunk-B5FIL7O4.js → chunk-56Z7SUGW.js} +11 -14
- package/dist/chunk-56Z7SUGW.js.map +1 -0
- package/dist/client-CUYIRMFW.js +7 -0
- package/dist/index.cjs +174 -57
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +44 -24
- package/dist/index.d.ts +44 -24
- package/dist/index.js +160 -46
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-B5FIL7O4.js.map +0 -1
- package/dist/client-BOND6P6S.js +0 -7
- /package/dist/{client-BOND6P6S.js.map → client-CUYIRMFW.js.map} +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -170,7 +170,7 @@ declare const DEFAULT_CLIENT_CAPABILITIES: string[];
|
|
|
170
170
|
declare const CLIENT_VERSION = "0.5.3";
|
|
171
171
|
type MessageType = "connection_init" | "connection_ack" | "request" | "response" | "notification" | "subscribe" | "next" | "error" | "complete" | "unsubscribe" | "ping" | "pong" | "receipt_response" | "disconnect" | "status";
|
|
172
172
|
/** Method names carried in the envelope `method` field. */
|
|
173
|
-
type MethodName = "loop_list" | "loop_get" | "loop_tree" | "loop_prune" | "loop_delete" | "loop_new" | "loop_reattach" | "loop_detach" | "loop_input" | "loop_messages" | "loop_state_get" | "loop_state_update" | "
|
|
173
|
+
type MethodName = "loop_list" | "loop_get" | "loop_tree" | "loop_prune" | "loop_delete" | "loop_new" | "loop_reattach" | "loop_detach" | "loop_input" | "loop_messages" | "loop_state_get" | "loop_state_update" | "loop_history_fetch" | "loop_events" | "autopilot_events" | "job_create" | "job_status" | "job_pause" | "job_resume" | "job_cancel" | "job_dag" | "job_guidance" | "autopilot_status" | "autopilot_submit" | "autopilot_list_goals" | "autopilot_get_goal" | "autopilot_cancel_goal" | "autopilot_cancel_all" | "autopilot_wake" | "autopilot_dream" | "autopilot_resume" | "autopilot_list_jobs" | "autopilot_get_job" | "autopilot_top" | "daemon_status" | "daemon_shutdown" | "config_get" | "config_reload" | "skills_list" | "invoke_skill" | "models_list" | "mcp_status" | "auth" | "auth_refresh" | "slash_command" | "rpc_command" | "delivery_ack" | "cron_add" | "cron_list" | "cron_show" | "cron_cancel" | "disconnect";
|
|
174
174
|
/** Base fields shared by every protocol-1 message. */
|
|
175
175
|
interface BaseEnvelope {
|
|
176
176
|
proto: string;
|
|
@@ -668,8 +668,6 @@ declare class Client extends EventEmitter {
|
|
|
668
668
|
sendLoopStateGet(loopID: string): Promise<void>;
|
|
669
669
|
/** Applies partial checkpoint values. */
|
|
670
670
|
sendLoopStateUpdate(loopID: string, values: Record<string, unknown>, asNode?: string): Promise<void>;
|
|
671
|
-
/** Requests display card ledger snapshot. */
|
|
672
|
-
sendLoopCardsFetch(loopID: string): Promise<void>;
|
|
673
671
|
/** Requests the full loop history. */
|
|
674
672
|
sendLoopHistoryFetch(loopID: string): Promise<void>;
|
|
675
673
|
/** Requests MCP server status. */
|
|
@@ -686,8 +684,6 @@ declare class Client extends EventEmitter {
|
|
|
686
684
|
getLoopState(loopID: string, timeout?: number): Promise<Record<string, unknown>>;
|
|
687
685
|
/** Updates loop state and waits for response. */
|
|
688
686
|
updateLoopState(loopID: string, values: Record<string, unknown>, asNode?: string, timeout?: number): Promise<Record<string, unknown>>;
|
|
689
|
-
/** Requests display cards and waits for response. */
|
|
690
|
-
fetchLoopCards(loopID: string, timeout?: number): Promise<Record<string, unknown>>;
|
|
691
687
|
/** Requests MCP status and waits for response. */
|
|
692
688
|
getMCPStatus(timeout?: number): Promise<Record<string, unknown>>;
|
|
693
689
|
/** Requests loop history and waits for response. */
|
|
@@ -738,6 +734,11 @@ declare class Client extends EventEmitter {
|
|
|
738
734
|
autopilotListJobs(timeout?: number): Promise<Record<string, unknown>>;
|
|
739
735
|
/** Get a root job with DAG snapshot. Prefer getJobStatus / getJobDag. */
|
|
740
736
|
autopilotGetJob(jobId: string, timeout?: number): Promise<Record<string, unknown>>;
|
|
737
|
+
/** Jobs → goals → loops snapshot for CLI top. */
|
|
738
|
+
autopilotTop(timeoutOrOptions?: number | {
|
|
739
|
+
includeTerminal?: boolean;
|
|
740
|
+
timeout?: number;
|
|
741
|
+
}): Promise<Record<string, unknown>>;
|
|
741
742
|
/** Subscribes to autopilot worker events. */
|
|
742
743
|
autopilotSubscribe(timeout?: number): Promise<string>;
|
|
743
744
|
/** Unsubscribes from autopilot worker events. */
|
|
@@ -802,6 +803,8 @@ declare class CommandClient {
|
|
|
802
803
|
autopilotListJobs(): Promise<Record<string, unknown>>;
|
|
803
804
|
/** Get a root job with DAG snapshot. Prefer jobStatus / getJobDag. */
|
|
804
805
|
autopilotGetJob(jobId: string): Promise<Record<string, unknown>>;
|
|
806
|
+
/** Jobs → goals → loops snapshot for CLI top. */
|
|
807
|
+
autopilotTop(includeTerminal?: boolean): Promise<Record<string, unknown>>;
|
|
805
808
|
cronAdd(text: string, priority?: number): Promise<Record<string, unknown>>;
|
|
806
809
|
cronList(status?: string): Promise<Record<string, unknown>>;
|
|
807
810
|
}
|
|
@@ -828,8 +831,6 @@ declare function fetchLoopHistory(client: Client, loopID: string, timeout?: numb
|
|
|
828
831
|
declare function authenticate(client: Client, accessKey: string, secretKey: string, timeout?: number): Promise<Record<string, unknown>>;
|
|
829
832
|
/** Refreshes the daemon-side auth token and waits for the response. */
|
|
830
833
|
declare function refreshAuthToken(client: Client, refreshToken: string, timeout?: number): Promise<Record<string, unknown>>;
|
|
831
|
-
/** Fetch bound display-card snapshot for a loop. */
|
|
832
|
-
declare function fetchLoopCards(client: Client, loopID: string, timeout?: number): Promise<Record<string, unknown>>;
|
|
833
834
|
/** Fetch persisted conversation/activity rows for a loop. */
|
|
834
835
|
declare function fetchLoopMessages(client: Client, loopID: string, opts?: {
|
|
835
836
|
limit?: number;
|
|
@@ -886,10 +887,34 @@ declare function isTurnProgressChunk(mode: string, data: unknown): boolean;
|
|
|
886
887
|
/** True when the client should bump delivery_ack sequence for this frame. */
|
|
887
888
|
declare function inboundNeedsDeliveryAck(event: Record<string, unknown>): boolean;
|
|
888
889
|
|
|
890
|
+
/**
|
|
891
|
+
* Turn / stream boundary helpers (`turn_id` / `seq`).
|
|
892
|
+
* Used by DaemonSession for demuxing concurrent goal turns.
|
|
893
|
+
*/
|
|
894
|
+
declare function formatTurnId(loopId: string, generation: number): string;
|
|
895
|
+
declare function parseTurnGeneration(turnId: string | null | undefined): number | null;
|
|
896
|
+
declare function frameTurnId(frame: Record<string, unknown> | null | undefined): string | null;
|
|
897
|
+
declare function frameSeq(frame: Record<string, unknown> | null | undefined): number | null;
|
|
898
|
+
/** Absent ids never match. */
|
|
899
|
+
declare function turnIdsMatch(expected: string | null | undefined, candidate: string | null | undefined): boolean;
|
|
900
|
+
declare function isTurnTerminalAllowed(opts: {
|
|
901
|
+
expectedTurnId: string | null | undefined;
|
|
902
|
+
frameTurnId: string | null | undefined;
|
|
903
|
+
queryStarted: boolean;
|
|
904
|
+
turnProgressSeen: boolean;
|
|
905
|
+
}): boolean;
|
|
906
|
+
declare function isIdleTerminalAllowed(opts: {
|
|
907
|
+
expectedTurnId: string | null | undefined;
|
|
908
|
+
frameTurnId: string | null | undefined;
|
|
909
|
+
queryStarted: boolean;
|
|
910
|
+
turnProgressSeen: boolean;
|
|
911
|
+
cancellationSeen?: boolean;
|
|
912
|
+
}): boolean;
|
|
913
|
+
|
|
889
914
|
/**
|
|
890
915
|
* Persistence seam for appkit.
|
|
891
916
|
*
|
|
892
|
-
*
|
|
917
|
+
* LoopSessionStore abstracts per-application storage: the session↔loop-id mapping
|
|
893
918
|
* that ConnectionPool consults to decide bootstrap vs reattach, and the
|
|
894
919
|
* message rows TurnRunner writes back when a turn completes. Applications
|
|
895
920
|
* implement this against their own store (Postgres, Redis, in-memory, …).
|
|
@@ -897,7 +922,7 @@ declare function inboundNeedsDeliveryAck(event: Record<string, unknown>): boolea
|
|
|
897
922
|
* Implementations must be safe for concurrent use.
|
|
898
923
|
*/
|
|
899
924
|
/** Persisted mapping between an application session id and the daemon loop id. */
|
|
900
|
-
interface
|
|
925
|
+
interface LoopSessionEntry {
|
|
901
926
|
workspaceID: string;
|
|
902
927
|
sessionID: string;
|
|
903
928
|
loopID: string;
|
|
@@ -926,9 +951,9 @@ interface SessionMessage {
|
|
|
926
951
|
* loop id once bootstrapped. TurnRunner persists the final assistant reply
|
|
927
952
|
* and error rows via appendMessage.
|
|
928
953
|
*/
|
|
929
|
-
interface
|
|
954
|
+
interface LoopSessionStore {
|
|
930
955
|
/** Returns the persisted entry for sessionID, or null if no record exists. */
|
|
931
|
-
getSession(sessionID: string): Promise<
|
|
956
|
+
getSession(sessionID: string): Promise<LoopSessionEntry | null>;
|
|
932
957
|
/** Persists a new session↔loop mapping. */
|
|
933
958
|
createSession(workspaceID: string, sessionID: string, loopID: string, sessionType: string): Promise<void>;
|
|
934
959
|
/** Stamps the session's last-used timestamp. */
|
|
@@ -1219,7 +1244,7 @@ type BootstrapFunc = (client: ManagedClient, workspaceID: string, userID: string
|
|
|
1219
1244
|
* active connection when still live, otherwise bootstraps a fresh loop
|
|
1220
1245
|
* (loop_new + subscribe) or reattaches an existing one (loop_reattach +
|
|
1221
1246
|
* subscribe + reattachAndProbe). Persistence of session↔loop mappings is
|
|
1222
|
-
* abstracted behind
|
|
1247
|
+
* abstracted behind LoopSessionStore.
|
|
1223
1248
|
*
|
|
1224
1249
|
* The app-agnostic successor to triarch's SoothePoolManager connection
|
|
1225
1250
|
* mechanics.
|
|
@@ -1274,7 +1299,7 @@ declare class ConnectionPool {
|
|
|
1274
1299
|
* defaultPoolConfig is used; if scfg is null, defaultConfig is used; nil
|
|
1275
1300
|
* factory/bootstrap fall back to the defaults.
|
|
1276
1301
|
*/
|
|
1277
|
-
constructor(url: string, store:
|
|
1302
|
+
constructor(url: string, store: LoopSessionStore, cfg?: PoolConfig | null, scfg?: Config | null, factory?: ClientFactory | null);
|
|
1278
1303
|
/** Overrides the loop bootstrap function (useful for test fakes). */
|
|
1279
1304
|
withBootstrap(f: BootstrapFunc): ConnectionPool;
|
|
1280
1305
|
/**
|
|
@@ -1411,7 +1436,7 @@ declare class TurnRunner {
|
|
|
1411
1436
|
private buildInput;
|
|
1412
1437
|
private onComplete;
|
|
1413
1438
|
private onError;
|
|
1414
|
-
constructor(pool: ConnectionPool, gate: QueryGate, classifier: EventClassifier, store:
|
|
1439
|
+
constructor(pool: ConnectionPool, gate: QueryGate, classifier: EventClassifier, store: LoopSessionStore, broadcaster: SSEBroadcaster | null, cfg: TurnConfig);
|
|
1415
1440
|
withInputBuilder(f: typeof inputMessageForLoop): TurnRunner;
|
|
1416
1441
|
withOnComplete(f: OnComplete): TurnRunner;
|
|
1417
1442
|
withOnError(f: OnError): TurnRunner;
|
|
@@ -1437,11 +1462,12 @@ declare const TURN_END_IDLE = "status.idle";
|
|
|
1437
1462
|
declare const TURN_END_STOPPED = "status.stopped";
|
|
1438
1463
|
declare class TurnLifecycleGate {
|
|
1439
1464
|
sawRunning: boolean;
|
|
1440
|
-
sawStreamPayload: boolean;
|
|
1441
1465
|
sawTurnProgress: boolean;
|
|
1466
|
+
expectedTurnId: string | null;
|
|
1467
|
+
cancellationSeen: boolean;
|
|
1442
1468
|
observe(msg: unknown): void;
|
|
1443
|
-
allowStreamEnd(): boolean;
|
|
1444
|
-
allowIdleComplete(): boolean;
|
|
1469
|
+
allowStreamEnd(frameTurn: string | null): boolean;
|
|
1470
|
+
allowIdleComplete(frameTurn: string | null): boolean;
|
|
1445
1471
|
}
|
|
1446
1472
|
declare class TurnBoundary {
|
|
1447
1473
|
readonly gate: TurnLifecycleGate;
|
|
@@ -1545,12 +1571,6 @@ declare class DaemonSession {
|
|
|
1545
1571
|
private withRpcLock;
|
|
1546
1572
|
private ensureRpcConnected;
|
|
1547
1573
|
listLoops(_limit?: number): Promise<Record<string, unknown>>;
|
|
1548
|
-
fetchLoopCards(loopId: string): Promise<{
|
|
1549
|
-
cards: unknown[];
|
|
1550
|
-
seq: number;
|
|
1551
|
-
contextTokens: number;
|
|
1552
|
-
success: boolean;
|
|
1553
|
-
}>;
|
|
1554
1574
|
fetchLoopHistory(loopId: string): Promise<{
|
|
1555
1575
|
goals: unknown[];
|
|
1556
1576
|
liveCards: unknown[];
|
|
@@ -1606,4 +1626,4 @@ declare class CardProjection {
|
|
|
1606
1626
|
apply(data: unknown): boolean;
|
|
1607
1627
|
}
|
|
1608
1628
|
|
|
1609
|
-
export { type Attachment, type BaseEnvelope, CLIENT_VERSION, CardProjection, type CardWireDict, type ChatEventResult, ChatEventTerminal, type ClassifierConfig, Client, CommandClient, type CompactImageOptions, type CompleteEnvelope, type Config, type ConnectionAckEnvelope, ConnectionError, type ConnectionInitEnvelope, ConnectionPool, DEFAULT_CLIENT_CAPABILITIES, DEFAULT_DELIVERABLE_PHASES, DEFAULT_POST_IDLE_DRAIN_MS, DEFAULT_THINKING_STEP_EVENTS, DaemonError, DaemonSession, type DaemonSessionOptions, type DecodedMessage, DisconnectCause, type DisconnectEnvelope, ErrIdleTimeout, ErrPoolExhausted, ErrQueryBusy, ErrQueryTimeout, type ErrorEnvelope, EventAutopilotGoalCompleted, EventAutopilotGoalCreated, EventAutopilotGoalProgress, EventAutopilotGoalStatus, EventAutopilotWorkerAssigned, EventAutopilotWorkerUnassigned, EventCardCreated, EventCardFinalized, EventCardReplayBegin, EventCardReplayEnd, EventCardUpdated, EventClassifier, EventDeepResearchCompleted, EventDeepResearchCrawlSummary, EventDeepResearchGatherSummary, EventDeepResearchProgress, EventDeepResearchStarted, EventDeepResearchStepCompleted, EventFinalReport, EventGeneralFailed, EventLoopReattachedWire, EventMessageReceived, EventMessageSent, EventPlanCreated, EventReplayComplete, EventStrangeLoopCompleted, EventStrangeLoopContextCompacted, EventStrangeLoopPlanDecision, EventStrangeLoopReasoned, EventStrangeLoopStarted, EventStrangeLoopStepCompleted, EventStrangeLoopStepQueued, EventStrangeLoopStepStarted, EventStreamToolCallUpdate, EventToolCallUpdatesBatch, EventToolCompleted, EventToolError, EventToolStarted, INTENT_HINT_EMBED, INTENT_HINT_IMAGE_TO_TEXT, INTENT_HINT_OCR, INTENT_HINT_TEXT_COMPLETION, type InputOptions, type InputOpts, type IntentHint, LOOP_ASSISTANT_OUTPUT_PHASES, type LoopAssistantOutputPhase, type LoopInputIntentHint, type LoopInputParams, type LoopNewOptions, type MessageType, type MethodName, type NegotiatedCapabilities, type NextEnvelope, type NotificationEnvelope, type OnComplete, type OnError, PROTO_VERSION, type ParsedCardFrame, type PingEnvelope, type PongEnvelope, type PoolConfig, PooledConn, QueryGate, REMOVED_INTENT_HINTS, type ReceiptResponseEnvelope, ReconnectError, type RemovedIntentHint, type RequestEnvelope, type ResponseEnvelope, SSEBroadcaster, type SSEEvent, STREAM_END, type
|
|
1629
|
+
export { type Attachment, type BaseEnvelope, CLIENT_VERSION, CardProjection, type CardWireDict, type ChatEventResult, ChatEventTerminal, type ClassifierConfig, Client, CommandClient, type CompactImageOptions, type CompleteEnvelope, type Config, type ConnectionAckEnvelope, ConnectionError, type ConnectionInitEnvelope, ConnectionPool, DEFAULT_CLIENT_CAPABILITIES, DEFAULT_DELIVERABLE_PHASES, DEFAULT_POST_IDLE_DRAIN_MS, DEFAULT_THINKING_STEP_EVENTS, DaemonError, DaemonSession, type DaemonSessionOptions, type DecodedMessage, DisconnectCause, type DisconnectEnvelope, ErrIdleTimeout, ErrPoolExhausted, ErrQueryBusy, ErrQueryTimeout, type ErrorEnvelope, EventAutopilotGoalCompleted, EventAutopilotGoalCreated, EventAutopilotGoalProgress, EventAutopilotGoalStatus, EventAutopilotWorkerAssigned, EventAutopilotWorkerUnassigned, EventCardCreated, EventCardFinalized, EventCardReplayBegin, EventCardReplayEnd, EventCardUpdated, EventClassifier, EventDeepResearchCompleted, EventDeepResearchCrawlSummary, EventDeepResearchGatherSummary, EventDeepResearchProgress, EventDeepResearchStarted, EventDeepResearchStepCompleted, EventFinalReport, EventGeneralFailed, EventLoopReattachedWire, EventMessageReceived, EventMessageSent, EventPlanCreated, EventReplayComplete, EventStrangeLoopCompleted, EventStrangeLoopContextCompacted, EventStrangeLoopPlanDecision, EventStrangeLoopReasoned, EventStrangeLoopStarted, EventStrangeLoopStepCompleted, EventStrangeLoopStepQueued, EventStrangeLoopStepStarted, EventStreamToolCallUpdate, EventToolCallUpdatesBatch, EventToolCompleted, EventToolError, EventToolStarted, INTENT_HINT_EMBED, INTENT_HINT_IMAGE_TO_TEXT, INTENT_HINT_OCR, INTENT_HINT_TEXT_COMPLETION, type InputOptions, type InputOpts, type IntentHint, LOOP_ASSISTANT_OUTPUT_PHASES, type LoopAssistantOutputPhase, type LoopInputIntentHint, type LoopInputParams, type LoopNewOptions, type LoopSessionEntry, type LoopSessionStore, type MessageType, type MethodName, type NegotiatedCapabilities, type NextEnvelope, type NotificationEnvelope, type OnComplete, type OnError, PROTO_VERSION, type ParsedCardFrame, type PingEnvelope, type PongEnvelope, type PoolConfig, PooledConn, QueryGate, REMOVED_INTENT_HINTS, type ReceiptResponseEnvelope, ReconnectError, type RemovedIntentHint, type RequestEnvelope, type ResponseEnvelope, SSEBroadcaster, type SSEEvent, STREAM_END, type SessionMessage, StaleLoopError, type StatusFrame, StreamCloseFail, type StreamClosePolicy, StreamCloseSoftComplete, type StreamEventPayload, type SubscribeEnvelope, TURN_END_IDLE, TURN_END_STOPPED, TURN_END_STREAM_END, TimeoutError, TimeoutPolicy, TurnBoundary, type TurnChunk, type TurnConfig, TurnEventStats, TurnLifecycleGate, TurnRunner, type UnsubscribeEnvelope, type VerbosityLevel, VerbosityTier, authenticate, bootstrapLoopSession, checkDaemonStatus, classifyEventVerbosity, compactAttachments, compactImageAttachment, connectWithRetries, connectedWebsocket, connectionInitEnvelope, decodeMessage, defaultConfig, defaultPoolConfig, disconnectCauseName, disconnectEnvelope, encodeMessage, extractSootheLoopID, extractThinkingStep, fetchConfigSection, fetchLoopHistory, fetchLoopMessages, fetchSkillsCatalog, formatTurnId, frameSeq, frameTurnId, idleTimeoutForTurn, inboundNeedsDeliveryAck, inputMessageForLoop, isCompletionEvent, isDaemonLive, isDaemonTurnEndEvent, isIdleTerminalAllowed, isSubagentProgressEvent, isTurnEndCustomData, isTurnProgressChunk, isTurnTerminalAllowed, isValidVerbosityLevel, loadConfigFromEnv, newLoopInputMessage, newLoopNewMessage, newLoopSubscribeMessage, newRequestID, notificationEnvelope, parseCardCustomPayload, parseNamespace, parseTurnGeneration, pingEnvelope, pongEnvelope, protocol1Rpc, refreshAuthToken, requestDaemonConfigReload, requestDaemonShutdown, requestEnvelope, shouldShow, splitWirePayload, subscribeEnvelope, turnIdsMatch, unsubscribeEnvelope, validateLoopInputIntentHint, waitDaemonReady, waitLoopStatusWithID, waitSubscriptionConfirmed };
|
package/dist/index.d.ts
CHANGED
|
@@ -170,7 +170,7 @@ declare const DEFAULT_CLIENT_CAPABILITIES: string[];
|
|
|
170
170
|
declare const CLIENT_VERSION = "0.5.3";
|
|
171
171
|
type MessageType = "connection_init" | "connection_ack" | "request" | "response" | "notification" | "subscribe" | "next" | "error" | "complete" | "unsubscribe" | "ping" | "pong" | "receipt_response" | "disconnect" | "status";
|
|
172
172
|
/** Method names carried in the envelope `method` field. */
|
|
173
|
-
type MethodName = "loop_list" | "loop_get" | "loop_tree" | "loop_prune" | "loop_delete" | "loop_new" | "loop_reattach" | "loop_detach" | "loop_input" | "loop_messages" | "loop_state_get" | "loop_state_update" | "
|
|
173
|
+
type MethodName = "loop_list" | "loop_get" | "loop_tree" | "loop_prune" | "loop_delete" | "loop_new" | "loop_reattach" | "loop_detach" | "loop_input" | "loop_messages" | "loop_state_get" | "loop_state_update" | "loop_history_fetch" | "loop_events" | "autopilot_events" | "job_create" | "job_status" | "job_pause" | "job_resume" | "job_cancel" | "job_dag" | "job_guidance" | "autopilot_status" | "autopilot_submit" | "autopilot_list_goals" | "autopilot_get_goal" | "autopilot_cancel_goal" | "autopilot_cancel_all" | "autopilot_wake" | "autopilot_dream" | "autopilot_resume" | "autopilot_list_jobs" | "autopilot_get_job" | "autopilot_top" | "daemon_status" | "daemon_shutdown" | "config_get" | "config_reload" | "skills_list" | "invoke_skill" | "models_list" | "mcp_status" | "auth" | "auth_refresh" | "slash_command" | "rpc_command" | "delivery_ack" | "cron_add" | "cron_list" | "cron_show" | "cron_cancel" | "disconnect";
|
|
174
174
|
/** Base fields shared by every protocol-1 message. */
|
|
175
175
|
interface BaseEnvelope {
|
|
176
176
|
proto: string;
|
|
@@ -668,8 +668,6 @@ declare class Client extends EventEmitter {
|
|
|
668
668
|
sendLoopStateGet(loopID: string): Promise<void>;
|
|
669
669
|
/** Applies partial checkpoint values. */
|
|
670
670
|
sendLoopStateUpdate(loopID: string, values: Record<string, unknown>, asNode?: string): Promise<void>;
|
|
671
|
-
/** Requests display card ledger snapshot. */
|
|
672
|
-
sendLoopCardsFetch(loopID: string): Promise<void>;
|
|
673
671
|
/** Requests the full loop history. */
|
|
674
672
|
sendLoopHistoryFetch(loopID: string): Promise<void>;
|
|
675
673
|
/** Requests MCP server status. */
|
|
@@ -686,8 +684,6 @@ declare class Client extends EventEmitter {
|
|
|
686
684
|
getLoopState(loopID: string, timeout?: number): Promise<Record<string, unknown>>;
|
|
687
685
|
/** Updates loop state and waits for response. */
|
|
688
686
|
updateLoopState(loopID: string, values: Record<string, unknown>, asNode?: string, timeout?: number): Promise<Record<string, unknown>>;
|
|
689
|
-
/** Requests display cards and waits for response. */
|
|
690
|
-
fetchLoopCards(loopID: string, timeout?: number): Promise<Record<string, unknown>>;
|
|
691
687
|
/** Requests MCP status and waits for response. */
|
|
692
688
|
getMCPStatus(timeout?: number): Promise<Record<string, unknown>>;
|
|
693
689
|
/** Requests loop history and waits for response. */
|
|
@@ -738,6 +734,11 @@ declare class Client extends EventEmitter {
|
|
|
738
734
|
autopilotListJobs(timeout?: number): Promise<Record<string, unknown>>;
|
|
739
735
|
/** Get a root job with DAG snapshot. Prefer getJobStatus / getJobDag. */
|
|
740
736
|
autopilotGetJob(jobId: string, timeout?: number): Promise<Record<string, unknown>>;
|
|
737
|
+
/** Jobs → goals → loops snapshot for CLI top. */
|
|
738
|
+
autopilotTop(timeoutOrOptions?: number | {
|
|
739
|
+
includeTerminal?: boolean;
|
|
740
|
+
timeout?: number;
|
|
741
|
+
}): Promise<Record<string, unknown>>;
|
|
741
742
|
/** Subscribes to autopilot worker events. */
|
|
742
743
|
autopilotSubscribe(timeout?: number): Promise<string>;
|
|
743
744
|
/** Unsubscribes from autopilot worker events. */
|
|
@@ -802,6 +803,8 @@ declare class CommandClient {
|
|
|
802
803
|
autopilotListJobs(): Promise<Record<string, unknown>>;
|
|
803
804
|
/** Get a root job with DAG snapshot. Prefer jobStatus / getJobDag. */
|
|
804
805
|
autopilotGetJob(jobId: string): Promise<Record<string, unknown>>;
|
|
806
|
+
/** Jobs → goals → loops snapshot for CLI top. */
|
|
807
|
+
autopilotTop(includeTerminal?: boolean): Promise<Record<string, unknown>>;
|
|
805
808
|
cronAdd(text: string, priority?: number): Promise<Record<string, unknown>>;
|
|
806
809
|
cronList(status?: string): Promise<Record<string, unknown>>;
|
|
807
810
|
}
|
|
@@ -828,8 +831,6 @@ declare function fetchLoopHistory(client: Client, loopID: string, timeout?: numb
|
|
|
828
831
|
declare function authenticate(client: Client, accessKey: string, secretKey: string, timeout?: number): Promise<Record<string, unknown>>;
|
|
829
832
|
/** Refreshes the daemon-side auth token and waits for the response. */
|
|
830
833
|
declare function refreshAuthToken(client: Client, refreshToken: string, timeout?: number): Promise<Record<string, unknown>>;
|
|
831
|
-
/** Fetch bound display-card snapshot for a loop. */
|
|
832
|
-
declare function fetchLoopCards(client: Client, loopID: string, timeout?: number): Promise<Record<string, unknown>>;
|
|
833
834
|
/** Fetch persisted conversation/activity rows for a loop. */
|
|
834
835
|
declare function fetchLoopMessages(client: Client, loopID: string, opts?: {
|
|
835
836
|
limit?: number;
|
|
@@ -886,10 +887,34 @@ declare function isTurnProgressChunk(mode: string, data: unknown): boolean;
|
|
|
886
887
|
/** True when the client should bump delivery_ack sequence for this frame. */
|
|
887
888
|
declare function inboundNeedsDeliveryAck(event: Record<string, unknown>): boolean;
|
|
888
889
|
|
|
890
|
+
/**
|
|
891
|
+
* Turn / stream boundary helpers (`turn_id` / `seq`).
|
|
892
|
+
* Used by DaemonSession for demuxing concurrent goal turns.
|
|
893
|
+
*/
|
|
894
|
+
declare function formatTurnId(loopId: string, generation: number): string;
|
|
895
|
+
declare function parseTurnGeneration(turnId: string | null | undefined): number | null;
|
|
896
|
+
declare function frameTurnId(frame: Record<string, unknown> | null | undefined): string | null;
|
|
897
|
+
declare function frameSeq(frame: Record<string, unknown> | null | undefined): number | null;
|
|
898
|
+
/** Absent ids never match. */
|
|
899
|
+
declare function turnIdsMatch(expected: string | null | undefined, candidate: string | null | undefined): boolean;
|
|
900
|
+
declare function isTurnTerminalAllowed(opts: {
|
|
901
|
+
expectedTurnId: string | null | undefined;
|
|
902
|
+
frameTurnId: string | null | undefined;
|
|
903
|
+
queryStarted: boolean;
|
|
904
|
+
turnProgressSeen: boolean;
|
|
905
|
+
}): boolean;
|
|
906
|
+
declare function isIdleTerminalAllowed(opts: {
|
|
907
|
+
expectedTurnId: string | null | undefined;
|
|
908
|
+
frameTurnId: string | null | undefined;
|
|
909
|
+
queryStarted: boolean;
|
|
910
|
+
turnProgressSeen: boolean;
|
|
911
|
+
cancellationSeen?: boolean;
|
|
912
|
+
}): boolean;
|
|
913
|
+
|
|
889
914
|
/**
|
|
890
915
|
* Persistence seam for appkit.
|
|
891
916
|
*
|
|
892
|
-
*
|
|
917
|
+
* LoopSessionStore abstracts per-application storage: the session↔loop-id mapping
|
|
893
918
|
* that ConnectionPool consults to decide bootstrap vs reattach, and the
|
|
894
919
|
* message rows TurnRunner writes back when a turn completes. Applications
|
|
895
920
|
* implement this against their own store (Postgres, Redis, in-memory, …).
|
|
@@ -897,7 +922,7 @@ declare function inboundNeedsDeliveryAck(event: Record<string, unknown>): boolea
|
|
|
897
922
|
* Implementations must be safe for concurrent use.
|
|
898
923
|
*/
|
|
899
924
|
/** Persisted mapping between an application session id and the daemon loop id. */
|
|
900
|
-
interface
|
|
925
|
+
interface LoopSessionEntry {
|
|
901
926
|
workspaceID: string;
|
|
902
927
|
sessionID: string;
|
|
903
928
|
loopID: string;
|
|
@@ -926,9 +951,9 @@ interface SessionMessage {
|
|
|
926
951
|
* loop id once bootstrapped. TurnRunner persists the final assistant reply
|
|
927
952
|
* and error rows via appendMessage.
|
|
928
953
|
*/
|
|
929
|
-
interface
|
|
954
|
+
interface LoopSessionStore {
|
|
930
955
|
/** Returns the persisted entry for sessionID, or null if no record exists. */
|
|
931
|
-
getSession(sessionID: string): Promise<
|
|
956
|
+
getSession(sessionID: string): Promise<LoopSessionEntry | null>;
|
|
932
957
|
/** Persists a new session↔loop mapping. */
|
|
933
958
|
createSession(workspaceID: string, sessionID: string, loopID: string, sessionType: string): Promise<void>;
|
|
934
959
|
/** Stamps the session's last-used timestamp. */
|
|
@@ -1219,7 +1244,7 @@ type BootstrapFunc = (client: ManagedClient, workspaceID: string, userID: string
|
|
|
1219
1244
|
* active connection when still live, otherwise bootstraps a fresh loop
|
|
1220
1245
|
* (loop_new + subscribe) or reattaches an existing one (loop_reattach +
|
|
1221
1246
|
* subscribe + reattachAndProbe). Persistence of session↔loop mappings is
|
|
1222
|
-
* abstracted behind
|
|
1247
|
+
* abstracted behind LoopSessionStore.
|
|
1223
1248
|
*
|
|
1224
1249
|
* The app-agnostic successor to triarch's SoothePoolManager connection
|
|
1225
1250
|
* mechanics.
|
|
@@ -1274,7 +1299,7 @@ declare class ConnectionPool {
|
|
|
1274
1299
|
* defaultPoolConfig is used; if scfg is null, defaultConfig is used; nil
|
|
1275
1300
|
* factory/bootstrap fall back to the defaults.
|
|
1276
1301
|
*/
|
|
1277
|
-
constructor(url: string, store:
|
|
1302
|
+
constructor(url: string, store: LoopSessionStore, cfg?: PoolConfig | null, scfg?: Config | null, factory?: ClientFactory | null);
|
|
1278
1303
|
/** Overrides the loop bootstrap function (useful for test fakes). */
|
|
1279
1304
|
withBootstrap(f: BootstrapFunc): ConnectionPool;
|
|
1280
1305
|
/**
|
|
@@ -1411,7 +1436,7 @@ declare class TurnRunner {
|
|
|
1411
1436
|
private buildInput;
|
|
1412
1437
|
private onComplete;
|
|
1413
1438
|
private onError;
|
|
1414
|
-
constructor(pool: ConnectionPool, gate: QueryGate, classifier: EventClassifier, store:
|
|
1439
|
+
constructor(pool: ConnectionPool, gate: QueryGate, classifier: EventClassifier, store: LoopSessionStore, broadcaster: SSEBroadcaster | null, cfg: TurnConfig);
|
|
1415
1440
|
withInputBuilder(f: typeof inputMessageForLoop): TurnRunner;
|
|
1416
1441
|
withOnComplete(f: OnComplete): TurnRunner;
|
|
1417
1442
|
withOnError(f: OnError): TurnRunner;
|
|
@@ -1437,11 +1462,12 @@ declare const TURN_END_IDLE = "status.idle";
|
|
|
1437
1462
|
declare const TURN_END_STOPPED = "status.stopped";
|
|
1438
1463
|
declare class TurnLifecycleGate {
|
|
1439
1464
|
sawRunning: boolean;
|
|
1440
|
-
sawStreamPayload: boolean;
|
|
1441
1465
|
sawTurnProgress: boolean;
|
|
1466
|
+
expectedTurnId: string | null;
|
|
1467
|
+
cancellationSeen: boolean;
|
|
1442
1468
|
observe(msg: unknown): void;
|
|
1443
|
-
allowStreamEnd(): boolean;
|
|
1444
|
-
allowIdleComplete(): boolean;
|
|
1469
|
+
allowStreamEnd(frameTurn: string | null): boolean;
|
|
1470
|
+
allowIdleComplete(frameTurn: string | null): boolean;
|
|
1445
1471
|
}
|
|
1446
1472
|
declare class TurnBoundary {
|
|
1447
1473
|
readonly gate: TurnLifecycleGate;
|
|
@@ -1545,12 +1571,6 @@ declare class DaemonSession {
|
|
|
1545
1571
|
private withRpcLock;
|
|
1546
1572
|
private ensureRpcConnected;
|
|
1547
1573
|
listLoops(_limit?: number): Promise<Record<string, unknown>>;
|
|
1548
|
-
fetchLoopCards(loopId: string): Promise<{
|
|
1549
|
-
cards: unknown[];
|
|
1550
|
-
seq: number;
|
|
1551
|
-
contextTokens: number;
|
|
1552
|
-
success: boolean;
|
|
1553
|
-
}>;
|
|
1554
1574
|
fetchLoopHistory(loopId: string): Promise<{
|
|
1555
1575
|
goals: unknown[];
|
|
1556
1576
|
liveCards: unknown[];
|
|
@@ -1606,4 +1626,4 @@ declare class CardProjection {
|
|
|
1606
1626
|
apply(data: unknown): boolean;
|
|
1607
1627
|
}
|
|
1608
1628
|
|
|
1609
|
-
export { type Attachment, type BaseEnvelope, CLIENT_VERSION, CardProjection, type CardWireDict, type ChatEventResult, ChatEventTerminal, type ClassifierConfig, Client, CommandClient, type CompactImageOptions, type CompleteEnvelope, type Config, type ConnectionAckEnvelope, ConnectionError, type ConnectionInitEnvelope, ConnectionPool, DEFAULT_CLIENT_CAPABILITIES, DEFAULT_DELIVERABLE_PHASES, DEFAULT_POST_IDLE_DRAIN_MS, DEFAULT_THINKING_STEP_EVENTS, DaemonError, DaemonSession, type DaemonSessionOptions, type DecodedMessage, DisconnectCause, type DisconnectEnvelope, ErrIdleTimeout, ErrPoolExhausted, ErrQueryBusy, ErrQueryTimeout, type ErrorEnvelope, EventAutopilotGoalCompleted, EventAutopilotGoalCreated, EventAutopilotGoalProgress, EventAutopilotGoalStatus, EventAutopilotWorkerAssigned, EventAutopilotWorkerUnassigned, EventCardCreated, EventCardFinalized, EventCardReplayBegin, EventCardReplayEnd, EventCardUpdated, EventClassifier, EventDeepResearchCompleted, EventDeepResearchCrawlSummary, EventDeepResearchGatherSummary, EventDeepResearchProgress, EventDeepResearchStarted, EventDeepResearchStepCompleted, EventFinalReport, EventGeneralFailed, EventLoopReattachedWire, EventMessageReceived, EventMessageSent, EventPlanCreated, EventReplayComplete, EventStrangeLoopCompleted, EventStrangeLoopContextCompacted, EventStrangeLoopPlanDecision, EventStrangeLoopReasoned, EventStrangeLoopStarted, EventStrangeLoopStepCompleted, EventStrangeLoopStepQueued, EventStrangeLoopStepStarted, EventStreamToolCallUpdate, EventToolCallUpdatesBatch, EventToolCompleted, EventToolError, EventToolStarted, INTENT_HINT_EMBED, INTENT_HINT_IMAGE_TO_TEXT, INTENT_HINT_OCR, INTENT_HINT_TEXT_COMPLETION, type InputOptions, type InputOpts, type IntentHint, LOOP_ASSISTANT_OUTPUT_PHASES, type LoopAssistantOutputPhase, type LoopInputIntentHint, type LoopInputParams, type LoopNewOptions, type MessageType, type MethodName, type NegotiatedCapabilities, type NextEnvelope, type NotificationEnvelope, type OnComplete, type OnError, PROTO_VERSION, type ParsedCardFrame, type PingEnvelope, type PongEnvelope, type PoolConfig, PooledConn, QueryGate, REMOVED_INTENT_HINTS, type ReceiptResponseEnvelope, ReconnectError, type RemovedIntentHint, type RequestEnvelope, type ResponseEnvelope, SSEBroadcaster, type SSEEvent, STREAM_END, type
|
|
1629
|
+
export { type Attachment, type BaseEnvelope, CLIENT_VERSION, CardProjection, type CardWireDict, type ChatEventResult, ChatEventTerminal, type ClassifierConfig, Client, CommandClient, type CompactImageOptions, type CompleteEnvelope, type Config, type ConnectionAckEnvelope, ConnectionError, type ConnectionInitEnvelope, ConnectionPool, DEFAULT_CLIENT_CAPABILITIES, DEFAULT_DELIVERABLE_PHASES, DEFAULT_POST_IDLE_DRAIN_MS, DEFAULT_THINKING_STEP_EVENTS, DaemonError, DaemonSession, type DaemonSessionOptions, type DecodedMessage, DisconnectCause, type DisconnectEnvelope, ErrIdleTimeout, ErrPoolExhausted, ErrQueryBusy, ErrQueryTimeout, type ErrorEnvelope, EventAutopilotGoalCompleted, EventAutopilotGoalCreated, EventAutopilotGoalProgress, EventAutopilotGoalStatus, EventAutopilotWorkerAssigned, EventAutopilotWorkerUnassigned, EventCardCreated, EventCardFinalized, EventCardReplayBegin, EventCardReplayEnd, EventCardUpdated, EventClassifier, EventDeepResearchCompleted, EventDeepResearchCrawlSummary, EventDeepResearchGatherSummary, EventDeepResearchProgress, EventDeepResearchStarted, EventDeepResearchStepCompleted, EventFinalReport, EventGeneralFailed, EventLoopReattachedWire, EventMessageReceived, EventMessageSent, EventPlanCreated, EventReplayComplete, EventStrangeLoopCompleted, EventStrangeLoopContextCompacted, EventStrangeLoopPlanDecision, EventStrangeLoopReasoned, EventStrangeLoopStarted, EventStrangeLoopStepCompleted, EventStrangeLoopStepQueued, EventStrangeLoopStepStarted, EventStreamToolCallUpdate, EventToolCallUpdatesBatch, EventToolCompleted, EventToolError, EventToolStarted, INTENT_HINT_EMBED, INTENT_HINT_IMAGE_TO_TEXT, INTENT_HINT_OCR, INTENT_HINT_TEXT_COMPLETION, type InputOptions, type InputOpts, type IntentHint, LOOP_ASSISTANT_OUTPUT_PHASES, type LoopAssistantOutputPhase, type LoopInputIntentHint, type LoopInputParams, type LoopNewOptions, type LoopSessionEntry, type LoopSessionStore, type MessageType, type MethodName, type NegotiatedCapabilities, type NextEnvelope, type NotificationEnvelope, type OnComplete, type OnError, PROTO_VERSION, type ParsedCardFrame, type PingEnvelope, type PongEnvelope, type PoolConfig, PooledConn, QueryGate, REMOVED_INTENT_HINTS, type ReceiptResponseEnvelope, ReconnectError, type RemovedIntentHint, type RequestEnvelope, type ResponseEnvelope, SSEBroadcaster, type SSEEvent, STREAM_END, type SessionMessage, StaleLoopError, type StatusFrame, StreamCloseFail, type StreamClosePolicy, StreamCloseSoftComplete, type StreamEventPayload, type SubscribeEnvelope, TURN_END_IDLE, TURN_END_STOPPED, TURN_END_STREAM_END, TimeoutError, TimeoutPolicy, TurnBoundary, type TurnChunk, type TurnConfig, TurnEventStats, TurnLifecycleGate, TurnRunner, type UnsubscribeEnvelope, type VerbosityLevel, VerbosityTier, authenticate, bootstrapLoopSession, checkDaemonStatus, classifyEventVerbosity, compactAttachments, compactImageAttachment, connectWithRetries, connectedWebsocket, connectionInitEnvelope, decodeMessage, defaultConfig, defaultPoolConfig, disconnectCauseName, disconnectEnvelope, encodeMessage, extractSootheLoopID, extractThinkingStep, fetchConfigSection, fetchLoopHistory, fetchLoopMessages, fetchSkillsCatalog, formatTurnId, frameSeq, frameTurnId, idleTimeoutForTurn, inboundNeedsDeliveryAck, inputMessageForLoop, isCompletionEvent, isDaemonLive, isDaemonTurnEndEvent, isIdleTerminalAllowed, isSubagentProgressEvent, isTurnEndCustomData, isTurnProgressChunk, isTurnTerminalAllowed, isValidVerbosityLevel, loadConfigFromEnv, newLoopInputMessage, newLoopNewMessage, newLoopSubscribeMessage, newRequestID, notificationEnvelope, parseCardCustomPayload, parseNamespace, parseTurnGeneration, pingEnvelope, pongEnvelope, protocol1Rpc, refreshAuthToken, requestDaemonConfigReload, requestDaemonShutdown, requestEnvelope, shouldShow, splitWirePayload, subscribeEnvelope, turnIdsMatch, unsubscribeEnvelope, validateLoopInputIntentHint, waitDaemonReady, waitLoopStatusWithID, waitSubscriptionConfirmed };
|