@mirasoth/soothe-client 0.5.1 → 0.5.2
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-R43B23MJ.js → chunk-NSWLUFSA.js} +2 -2
- package/dist/{chunk-R43B23MJ.js.map → chunk-NSWLUFSA.js.map} +1 -1
- package/dist/client-YTWVWNAN.js +7 -0
- package/dist/index.cjs +140 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +33 -9
- package/dist/index.d.ts +33 -9
- package/dist/index.js +133 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/client-SCSBM3EL.js +0 -7
- /package/dist/{client-SCSBM3EL.js.map → client-YTWVWNAN.js.map} +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -167,7 +167,7 @@ declare const PROTO_VERSION = "1";
|
|
|
167
167
|
/** Default client capabilities declared in the connection_init handshake. */
|
|
168
168
|
declare const DEFAULT_CLIENT_CAPABILITIES: string[];
|
|
169
169
|
/** Client version reported in the connection_init handshake. */
|
|
170
|
-
declare const CLIENT_VERSION = "0.5.
|
|
170
|
+
declare const CLIENT_VERSION = "0.5.2";
|
|
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
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_cards_fetch" | "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" | "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";
|
|
@@ -1064,9 +1064,8 @@ interface ClassifierConfig {
|
|
|
1064
1064
|
/** Optional app override of the default thinking-step event allowlist. */
|
|
1065
1065
|
thinkingStepEvents?: ReadonlySet<string>;
|
|
1066
1066
|
/**
|
|
1067
|
-
*
|
|
1068
|
-
*
|
|
1069
|
-
* Default false keeps Continue-on-status behaviour.
|
|
1067
|
+
* Standalone classify only. Prefer TurnRunner + TurnBoundary for turn end
|
|
1068
|
+
* (DaemonSession contract). Default false.
|
|
1070
1069
|
*/
|
|
1071
1070
|
treatStatusIdleAsComplete?: boolean;
|
|
1072
1071
|
}
|
|
@@ -1336,11 +1335,10 @@ declare function compactAttachments(atts: Record<string, unknown>[], opts?: Comp
|
|
|
1336
1335
|
* Turn runner for appkit.
|
|
1337
1336
|
*
|
|
1338
1337
|
* Executes one query turn end-to-end: acquire a pooled connection, enforce
|
|
1339
|
-
* single-flight, send loop_input, consume the event stream,
|
|
1340
|
-
* resolve the deliverable, persist the reply, and broadcast completion.
|
|
1338
|
+
* single-flight, send loop_input, consume the event stream, persist/broadcast.
|
|
1341
1339
|
*
|
|
1342
|
-
*
|
|
1343
|
-
*
|
|
1340
|
+
* Turn end is owned by TurnBoundary (DaemonSession.iterTurnChunks contract).
|
|
1341
|
+
* EventClassifier selects content and may early-complete on deliverable phases.
|
|
1344
1342
|
*/
|
|
1345
1343
|
|
|
1346
1344
|
/** Returned when a turn exceeds the configured timeout and policy is Fail. */
|
|
@@ -1430,6 +1428,32 @@ declare class TurnRunner {
|
|
|
1430
1428
|
private broadcastError;
|
|
1431
1429
|
}
|
|
1432
1430
|
|
|
1431
|
+
/**
|
|
1432
|
+
* DaemonSession turn-end contract for the pool TurnRunner path.
|
|
1433
|
+
* TurnRunner owns one TurnBoundary per execute; EventClassifier may
|
|
1434
|
+
* early-complete on deliverable phases for UX only.
|
|
1435
|
+
*/
|
|
1436
|
+
|
|
1437
|
+
declare const TURN_END_STREAM_END = "soothe.stream.end";
|
|
1438
|
+
declare const TURN_END_IDLE = "status.idle";
|
|
1439
|
+
declare const TURN_END_STOPPED = "status.stopped";
|
|
1440
|
+
declare class TurnLifecycleGate {
|
|
1441
|
+
sawRunning: boolean;
|
|
1442
|
+
sawStreamPayload: boolean;
|
|
1443
|
+
sawTurnProgress: boolean;
|
|
1444
|
+
observe(msg: unknown): void;
|
|
1445
|
+
allowStreamEnd(): boolean;
|
|
1446
|
+
allowIdleComplete(): boolean;
|
|
1447
|
+
}
|
|
1448
|
+
declare class TurnBoundary {
|
|
1449
|
+
readonly gate: TurnLifecycleGate;
|
|
1450
|
+
ended: boolean;
|
|
1451
|
+
reason: string;
|
|
1452
|
+
feed(msg: unknown): [boolean, string];
|
|
1453
|
+
private mark;
|
|
1454
|
+
}
|
|
1455
|
+
declare function isDaemonTurnEndEvent(completionEvent: string): boolean;
|
|
1456
|
+
|
|
1433
1457
|
/**
|
|
1434
1458
|
* Per-turn observability counters for daemon stream consumption.
|
|
1435
1459
|
*/
|
|
@@ -1546,4 +1570,4 @@ declare class DaemonSession {
|
|
|
1546
1570
|
}): AsyncGenerator<TurnChunk>;
|
|
1547
1571
|
}
|
|
1548
1572
|
|
|
1549
|
-
export { type Attachment, type BaseEnvelope, CLIENT_VERSION, 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, EventCardReplayBegin, EventCardReplayEnd, EventClassifier, EventDeepResearchCompleted, EventDeepResearchCrawlSummary, EventDeepResearchGatherSummary, EventDeepResearchProgress, EventDeepResearchStarted, EventDeepResearchStepCompleted, EventExplorerCompleted, EventExplorerMilestone, EventExplorerStarted, EventExplorerStepCompleted, 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 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 SessionEntry, type SessionMessage, type SessionStore, StaleLoopError, type StatusFrame, StreamCloseFail, type StreamClosePolicy, StreamCloseSoftComplete, type StreamEventPayload, type SubscribeEnvelope, TimeoutError, TimeoutPolicy, type TurnChunk, type TurnConfig, TurnEventStats, TurnRunner, type UnsubscribeEnvelope, type VerbosityLevel, VerbosityTier, authenticate, bootstrapLoopSession, checkDaemonStatus, classifyEventVerbosity, compactAttachments, compactImageAttachment, connectWithRetries, connectedWebsocket, connectionInitEnvelope, decodeMessage, defaultConfig, defaultPoolConfig, disconnectCauseName, disconnectEnvelope, encodeMessage, extractSootheLoopID, extractThinkingStep, fetchConfigSection, fetchLoopCards, fetchLoopHistory, fetchLoopMessages, fetchSkillsCatalog, idleTimeoutForTurn, inboundNeedsDeliveryAck, inputMessageForLoop, isCompletionEvent, isDaemonLive, isSubagentProgressEvent, isTurnEndCustomData, isTurnProgressChunk, isValidVerbosityLevel, loadConfigFromEnv, newLoopInputMessage, newLoopNewMessage, newLoopSubscribeMessage, newRequestID, notificationEnvelope, parseNamespace, pingEnvelope, pongEnvelope, protocol1Rpc, refreshAuthToken, requestDaemonConfigReload, requestDaemonShutdown, requestEnvelope, shouldShow, splitWirePayload, subscribeEnvelope, unsubscribeEnvelope, validateLoopInputIntentHint, waitDaemonReady, waitLoopStatusWithID, waitSubscriptionConfirmed };
|
|
1573
|
+
export { type Attachment, type BaseEnvelope, CLIENT_VERSION, 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, EventCardReplayBegin, EventCardReplayEnd, EventClassifier, EventDeepResearchCompleted, EventDeepResearchCrawlSummary, EventDeepResearchGatherSummary, EventDeepResearchProgress, EventDeepResearchStarted, EventDeepResearchStepCompleted, EventExplorerCompleted, EventExplorerMilestone, EventExplorerStarted, EventExplorerStepCompleted, 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 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 SessionEntry, type SessionMessage, type SessionStore, 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, fetchLoopCards, fetchLoopHistory, fetchLoopMessages, fetchSkillsCatalog, idleTimeoutForTurn, inboundNeedsDeliveryAck, inputMessageForLoop, isCompletionEvent, isDaemonLive, isDaemonTurnEndEvent, isSubagentProgressEvent, isTurnEndCustomData, isTurnProgressChunk, isValidVerbosityLevel, loadConfigFromEnv, newLoopInputMessage, newLoopNewMessage, newLoopSubscribeMessage, newRequestID, notificationEnvelope, parseNamespace, pingEnvelope, pongEnvelope, protocol1Rpc, refreshAuthToken, requestDaemonConfigReload, requestDaemonShutdown, requestEnvelope, shouldShow, splitWirePayload, subscribeEnvelope, unsubscribeEnvelope, validateLoopInputIntentHint, waitDaemonReady, waitLoopStatusWithID, waitSubscriptionConfirmed };
|
package/dist/index.d.ts
CHANGED
|
@@ -167,7 +167,7 @@ declare const PROTO_VERSION = "1";
|
|
|
167
167
|
/** Default client capabilities declared in the connection_init handshake. */
|
|
168
168
|
declare const DEFAULT_CLIENT_CAPABILITIES: string[];
|
|
169
169
|
/** Client version reported in the connection_init handshake. */
|
|
170
|
-
declare const CLIENT_VERSION = "0.5.
|
|
170
|
+
declare const CLIENT_VERSION = "0.5.2";
|
|
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
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_cards_fetch" | "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" | "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";
|
|
@@ -1064,9 +1064,8 @@ interface ClassifierConfig {
|
|
|
1064
1064
|
/** Optional app override of the default thinking-step event allowlist. */
|
|
1065
1065
|
thinkingStepEvents?: ReadonlySet<string>;
|
|
1066
1066
|
/**
|
|
1067
|
-
*
|
|
1068
|
-
*
|
|
1069
|
-
* Default false keeps Continue-on-status behaviour.
|
|
1067
|
+
* Standalone classify only. Prefer TurnRunner + TurnBoundary for turn end
|
|
1068
|
+
* (DaemonSession contract). Default false.
|
|
1070
1069
|
*/
|
|
1071
1070
|
treatStatusIdleAsComplete?: boolean;
|
|
1072
1071
|
}
|
|
@@ -1336,11 +1335,10 @@ declare function compactAttachments(atts: Record<string, unknown>[], opts?: Comp
|
|
|
1336
1335
|
* Turn runner for appkit.
|
|
1337
1336
|
*
|
|
1338
1337
|
* Executes one query turn end-to-end: acquire a pooled connection, enforce
|
|
1339
|
-
* single-flight, send loop_input, consume the event stream,
|
|
1340
|
-
* resolve the deliverable, persist the reply, and broadcast completion.
|
|
1338
|
+
* single-flight, send loop_input, consume the event stream, persist/broadcast.
|
|
1341
1339
|
*
|
|
1342
|
-
*
|
|
1343
|
-
*
|
|
1340
|
+
* Turn end is owned by TurnBoundary (DaemonSession.iterTurnChunks contract).
|
|
1341
|
+
* EventClassifier selects content and may early-complete on deliverable phases.
|
|
1344
1342
|
*/
|
|
1345
1343
|
|
|
1346
1344
|
/** Returned when a turn exceeds the configured timeout and policy is Fail. */
|
|
@@ -1430,6 +1428,32 @@ declare class TurnRunner {
|
|
|
1430
1428
|
private broadcastError;
|
|
1431
1429
|
}
|
|
1432
1430
|
|
|
1431
|
+
/**
|
|
1432
|
+
* DaemonSession turn-end contract for the pool TurnRunner path.
|
|
1433
|
+
* TurnRunner owns one TurnBoundary per execute; EventClassifier may
|
|
1434
|
+
* early-complete on deliverable phases for UX only.
|
|
1435
|
+
*/
|
|
1436
|
+
|
|
1437
|
+
declare const TURN_END_STREAM_END = "soothe.stream.end";
|
|
1438
|
+
declare const TURN_END_IDLE = "status.idle";
|
|
1439
|
+
declare const TURN_END_STOPPED = "status.stopped";
|
|
1440
|
+
declare class TurnLifecycleGate {
|
|
1441
|
+
sawRunning: boolean;
|
|
1442
|
+
sawStreamPayload: boolean;
|
|
1443
|
+
sawTurnProgress: boolean;
|
|
1444
|
+
observe(msg: unknown): void;
|
|
1445
|
+
allowStreamEnd(): boolean;
|
|
1446
|
+
allowIdleComplete(): boolean;
|
|
1447
|
+
}
|
|
1448
|
+
declare class TurnBoundary {
|
|
1449
|
+
readonly gate: TurnLifecycleGate;
|
|
1450
|
+
ended: boolean;
|
|
1451
|
+
reason: string;
|
|
1452
|
+
feed(msg: unknown): [boolean, string];
|
|
1453
|
+
private mark;
|
|
1454
|
+
}
|
|
1455
|
+
declare function isDaemonTurnEndEvent(completionEvent: string): boolean;
|
|
1456
|
+
|
|
1433
1457
|
/**
|
|
1434
1458
|
* Per-turn observability counters for daemon stream consumption.
|
|
1435
1459
|
*/
|
|
@@ -1546,4 +1570,4 @@ declare class DaemonSession {
|
|
|
1546
1570
|
}): AsyncGenerator<TurnChunk>;
|
|
1547
1571
|
}
|
|
1548
1572
|
|
|
1549
|
-
export { type Attachment, type BaseEnvelope, CLIENT_VERSION, 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, EventCardReplayBegin, EventCardReplayEnd, EventClassifier, EventDeepResearchCompleted, EventDeepResearchCrawlSummary, EventDeepResearchGatherSummary, EventDeepResearchProgress, EventDeepResearchStarted, EventDeepResearchStepCompleted, EventExplorerCompleted, EventExplorerMilestone, EventExplorerStarted, EventExplorerStepCompleted, 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 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 SessionEntry, type SessionMessage, type SessionStore, StaleLoopError, type StatusFrame, StreamCloseFail, type StreamClosePolicy, StreamCloseSoftComplete, type StreamEventPayload, type SubscribeEnvelope, TimeoutError, TimeoutPolicy, type TurnChunk, type TurnConfig, TurnEventStats, TurnRunner, type UnsubscribeEnvelope, type VerbosityLevel, VerbosityTier, authenticate, bootstrapLoopSession, checkDaemonStatus, classifyEventVerbosity, compactAttachments, compactImageAttachment, connectWithRetries, connectedWebsocket, connectionInitEnvelope, decodeMessage, defaultConfig, defaultPoolConfig, disconnectCauseName, disconnectEnvelope, encodeMessage, extractSootheLoopID, extractThinkingStep, fetchConfigSection, fetchLoopCards, fetchLoopHistory, fetchLoopMessages, fetchSkillsCatalog, idleTimeoutForTurn, inboundNeedsDeliveryAck, inputMessageForLoop, isCompletionEvent, isDaemonLive, isSubagentProgressEvent, isTurnEndCustomData, isTurnProgressChunk, isValidVerbosityLevel, loadConfigFromEnv, newLoopInputMessage, newLoopNewMessage, newLoopSubscribeMessage, newRequestID, notificationEnvelope, parseNamespace, pingEnvelope, pongEnvelope, protocol1Rpc, refreshAuthToken, requestDaemonConfigReload, requestDaemonShutdown, requestEnvelope, shouldShow, splitWirePayload, subscribeEnvelope, unsubscribeEnvelope, validateLoopInputIntentHint, waitDaemonReady, waitLoopStatusWithID, waitSubscriptionConfirmed };
|
|
1573
|
+
export { type Attachment, type BaseEnvelope, CLIENT_VERSION, 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, EventCardReplayBegin, EventCardReplayEnd, EventClassifier, EventDeepResearchCompleted, EventDeepResearchCrawlSummary, EventDeepResearchGatherSummary, EventDeepResearchProgress, EventDeepResearchStarted, EventDeepResearchStepCompleted, EventExplorerCompleted, EventExplorerMilestone, EventExplorerStarted, EventExplorerStepCompleted, 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 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 SessionEntry, type SessionMessage, type SessionStore, 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, fetchLoopCards, fetchLoopHistory, fetchLoopMessages, fetchSkillsCatalog, idleTimeoutForTurn, inboundNeedsDeliveryAck, inputMessageForLoop, isCompletionEvent, isDaemonLive, isDaemonTurnEndEvent, isSubagentProgressEvent, isTurnEndCustomData, isTurnProgressChunk, isValidVerbosityLevel, loadConfigFromEnv, newLoopInputMessage, newLoopNewMessage, newLoopSubscribeMessage, newRequestID, notificationEnvelope, parseNamespace, pingEnvelope, pongEnvelope, protocol1Rpc, refreshAuthToken, requestDaemonConfigReload, requestDaemonShutdown, requestEnvelope, shouldShow, splitWirePayload, subscribeEnvelope, unsubscribeEnvelope, validateLoopInputIntentHint, waitDaemonReady, waitLoopStatusWithID, waitSubscriptionConfirmed };
|
package/dist/index.js
CHANGED
|
@@ -86,7 +86,7 @@ import {
|
|
|
86
86
|
subscribeEnvelope,
|
|
87
87
|
unsubscribeEnvelope,
|
|
88
88
|
validateLoopInputIntentHint
|
|
89
|
-
} from "./chunk-
|
|
89
|
+
} from "./chunk-NSWLUFSA.js";
|
|
90
90
|
|
|
91
91
|
// src/session.ts
|
|
92
92
|
async function bootstrapLoopSession(client, resumeLoopId, config, loopNew) {
|
|
@@ -289,7 +289,7 @@ async function checkDaemonStatus(client, timeout) {
|
|
|
289
289
|
return client.requestResponse("daemon_status", {}, "daemon_status", timeout ?? 5e3);
|
|
290
290
|
}
|
|
291
291
|
async function isDaemonLive(wsURL, timeout) {
|
|
292
|
-
const { Client: Client2 } = await import("./client-
|
|
292
|
+
const { Client: Client2 } = await import("./client-YTWVWNAN.js");
|
|
293
293
|
const t = timeout ?? 5e3;
|
|
294
294
|
const client = new Client2(wsURL, defaultConfig());
|
|
295
295
|
try {
|
|
@@ -376,7 +376,7 @@ async function fetchLoopMessages(client, loopID, opts) {
|
|
|
376
376
|
);
|
|
377
377
|
}
|
|
378
378
|
async function connectedWebsocket(wsUrl, fn, timeoutMs = 3e4) {
|
|
379
|
-
const { Client: Client2 } = await import("./client-
|
|
379
|
+
const { Client: Client2 } = await import("./client-YTWVWNAN.js");
|
|
380
380
|
const client = new Client2(wsUrl, defaultConfig());
|
|
381
381
|
const deadline = Date.now() + timeoutMs;
|
|
382
382
|
try {
|
|
@@ -679,6 +679,8 @@ var EventClassifier = class {
|
|
|
679
679
|
if (!eventType) return false;
|
|
680
680
|
switch (eventType) {
|
|
681
681
|
case "status.idle":
|
|
682
|
+
case "status.stopped":
|
|
683
|
+
case "soothe.stream.end":
|
|
682
684
|
case "idle_timeout":
|
|
683
685
|
case "query_timeout":
|
|
684
686
|
case "stream_closed":
|
|
@@ -1381,6 +1383,107 @@ async function compactAttachments(atts, opts) {
|
|
|
1381
1383
|
return out;
|
|
1382
1384
|
}
|
|
1383
1385
|
|
|
1386
|
+
// src/appkit/turn_boundary.ts
|
|
1387
|
+
var TURN_END_STREAM_END = STREAM_END;
|
|
1388
|
+
var TURN_END_IDLE = "status.idle";
|
|
1389
|
+
var TURN_END_STOPPED = "status.stopped";
|
|
1390
|
+
var TurnLifecycleGate = class {
|
|
1391
|
+
sawRunning = false;
|
|
1392
|
+
sawStreamPayload = false;
|
|
1393
|
+
sawTurnProgress = false;
|
|
1394
|
+
observe(msg) {
|
|
1395
|
+
const frame = normalizeFrame(msg);
|
|
1396
|
+
if (!frame) return;
|
|
1397
|
+
const typ = String(frame.type ?? "");
|
|
1398
|
+
if (typ === "status") {
|
|
1399
|
+
if (String(frame.state ?? "").trim().toLowerCase() === "running") {
|
|
1400
|
+
this.sawRunning = true;
|
|
1401
|
+
}
|
|
1402
|
+
return;
|
|
1403
|
+
}
|
|
1404
|
+
if (typ === "event") {
|
|
1405
|
+
this.sawStreamPayload = true;
|
|
1406
|
+
const mode = String(frame.mode ?? "");
|
|
1407
|
+
if (isTurnProgressChunk(mode, frame.data)) {
|
|
1408
|
+
this.sawTurnProgress = true;
|
|
1409
|
+
}
|
|
1410
|
+
}
|
|
1411
|
+
}
|
|
1412
|
+
allowStreamEnd() {
|
|
1413
|
+
return this.sawRunning && this.sawTurnProgress;
|
|
1414
|
+
}
|
|
1415
|
+
allowIdleComplete() {
|
|
1416
|
+
return this.sawRunning && this.sawStreamPayload;
|
|
1417
|
+
}
|
|
1418
|
+
};
|
|
1419
|
+
var TurnBoundary = class {
|
|
1420
|
+
gate = new TurnLifecycleGate();
|
|
1421
|
+
ended = false;
|
|
1422
|
+
reason = "";
|
|
1423
|
+
feed(msg) {
|
|
1424
|
+
if (this.ended) return [true, this.reason];
|
|
1425
|
+
this.gate.observe(msg);
|
|
1426
|
+
const frame = normalizeFrame(msg);
|
|
1427
|
+
if (!frame) return [false, ""];
|
|
1428
|
+
const typ = String(frame.type ?? "");
|
|
1429
|
+
if (typ === "status") {
|
|
1430
|
+
const state = String(frame.state ?? "").trim().toLowerCase();
|
|
1431
|
+
if (state === "stopped" && this.gate.sawRunning) {
|
|
1432
|
+
return this.mark(TURN_END_STOPPED);
|
|
1433
|
+
}
|
|
1434
|
+
if (state === "idle" && this.gate.allowIdleComplete()) {
|
|
1435
|
+
return this.mark(TURN_END_IDLE);
|
|
1436
|
+
}
|
|
1437
|
+
return [false, ""];
|
|
1438
|
+
}
|
|
1439
|
+
if (typ === "event") {
|
|
1440
|
+
const mode = String(frame.mode ?? "");
|
|
1441
|
+
if (mode === "custom" && isTurnEndCustomData(frame.data) && this.gate.allowStreamEnd()) {
|
|
1442
|
+
return this.mark(TURN_END_STREAM_END);
|
|
1443
|
+
}
|
|
1444
|
+
}
|
|
1445
|
+
return [false, ""];
|
|
1446
|
+
}
|
|
1447
|
+
mark(reason) {
|
|
1448
|
+
this.ended = true;
|
|
1449
|
+
this.reason = reason;
|
|
1450
|
+
return [true, reason];
|
|
1451
|
+
}
|
|
1452
|
+
};
|
|
1453
|
+
function isDaemonTurnEndEvent(completionEvent) {
|
|
1454
|
+
const e = (completionEvent ?? "").trim();
|
|
1455
|
+
return e === TURN_END_STREAM_END || e === TURN_END_IDLE || e === TURN_END_STOPPED;
|
|
1456
|
+
}
|
|
1457
|
+
function normalizeFrame(msg) {
|
|
1458
|
+
if (!msg || typeof msg !== "object") return null;
|
|
1459
|
+
const m = msg;
|
|
1460
|
+
if (m.type === "next") {
|
|
1461
|
+
const payload = m.payload ?? {};
|
|
1462
|
+
const inner = payload.data;
|
|
1463
|
+
if (inner && typeof inner === "object" && inner.type === "status") {
|
|
1464
|
+
return inner;
|
|
1465
|
+
}
|
|
1466
|
+
if (inner && typeof inner === "object" && inner.mode) {
|
|
1467
|
+
return {
|
|
1468
|
+
type: "event",
|
|
1469
|
+
mode: inner.mode,
|
|
1470
|
+
data: inner.data,
|
|
1471
|
+
namespace: inner.namespace ?? payload.namespace
|
|
1472
|
+
};
|
|
1473
|
+
}
|
|
1474
|
+
if (payload.mode) {
|
|
1475
|
+
return {
|
|
1476
|
+
type: "event",
|
|
1477
|
+
mode: payload.mode,
|
|
1478
|
+
data: payload.data,
|
|
1479
|
+
namespace: payload.namespace
|
|
1480
|
+
};
|
|
1481
|
+
}
|
|
1482
|
+
return null;
|
|
1483
|
+
}
|
|
1484
|
+
return m;
|
|
1485
|
+
}
|
|
1486
|
+
|
|
1384
1487
|
// src/appkit/turn_runner.ts
|
|
1385
1488
|
var ErrQueryTimeout = class extends Error {
|
|
1386
1489
|
constructor() {
|
|
@@ -1521,6 +1624,7 @@ var TurnRunner = class {
|
|
|
1521
1624
|
}
|
|
1522
1625
|
let assistantContent = "";
|
|
1523
1626
|
const startedAt = Date.now();
|
|
1627
|
+
const boundary = new TurnBoundary();
|
|
1524
1628
|
const idleForTurn = idleTimeoutForTurn(this.cfg, (attachments?.length ?? 0) > 0);
|
|
1525
1629
|
let idleReject = null;
|
|
1526
1630
|
const armIdle = () => {
|
|
@@ -1613,6 +1717,7 @@ var TurnRunner = class {
|
|
|
1613
1717
|
}
|
|
1614
1718
|
idleRace = armIdle();
|
|
1615
1719
|
const msg = res.value;
|
|
1720
|
+
const [ended, endReason] = boundary.feed(msg);
|
|
1616
1721
|
const eventResult = this.classifier.classify(msg, assistantContent);
|
|
1617
1722
|
if (eventResult.err && eventResult.terminal === 2 /* FailedComplete */) {
|
|
1618
1723
|
clearIdle();
|
|
@@ -1634,7 +1739,7 @@ var TurnRunner = class {
|
|
|
1634
1739
|
eventResult,
|
|
1635
1740
|
assistantContent
|
|
1636
1741
|
);
|
|
1637
|
-
if (deliverable) {
|
|
1742
|
+
if (deliverable && !isDaemonTurnEndEvent(eventResult.completionEvent ?? "")) {
|
|
1638
1743
|
clearIdle();
|
|
1639
1744
|
await this.completeTurn(
|
|
1640
1745
|
sessionID,
|
|
@@ -1645,6 +1750,24 @@ var TurnRunner = class {
|
|
|
1645
1750
|
);
|
|
1646
1751
|
return;
|
|
1647
1752
|
}
|
|
1753
|
+
if (ended) {
|
|
1754
|
+
clearIdle();
|
|
1755
|
+
if (this.classifier.isSubstantiveAssistantReply(assistantContent)) {
|
|
1756
|
+
await this.completeTurn(
|
|
1757
|
+
sessionID,
|
|
1758
|
+
loopID,
|
|
1759
|
+
assistantContent.trim(),
|
|
1760
|
+
startedAt,
|
|
1761
|
+
endReason
|
|
1762
|
+
);
|
|
1763
|
+
return;
|
|
1764
|
+
}
|
|
1765
|
+
const err = new Error(`turn ended (${endReason}) with no assistant content`);
|
|
1766
|
+
await this.persistFailed(sessionID, loopID, err);
|
|
1767
|
+
this.broadcastError(sessionID, err);
|
|
1768
|
+
this.onError?.(sessionID, loopID, err);
|
|
1769
|
+
throw err;
|
|
1770
|
+
}
|
|
1648
1771
|
}
|
|
1649
1772
|
} finally {
|
|
1650
1773
|
clearIdle();
|
|
@@ -2231,9 +2354,14 @@ export {
|
|
|
2231
2354
|
StaleLoopError,
|
|
2232
2355
|
StreamCloseFail,
|
|
2233
2356
|
StreamCloseSoftComplete,
|
|
2357
|
+
TURN_END_IDLE,
|
|
2358
|
+
TURN_END_STOPPED,
|
|
2359
|
+
TURN_END_STREAM_END,
|
|
2234
2360
|
TimeoutError,
|
|
2235
2361
|
TimeoutPolicy,
|
|
2362
|
+
TurnBoundary,
|
|
2236
2363
|
TurnEventStats,
|
|
2364
|
+
TurnLifecycleGate,
|
|
2237
2365
|
TurnRunner,
|
|
2238
2366
|
VerbosityTier,
|
|
2239
2367
|
authenticate,
|
|
@@ -2263,6 +2391,7 @@ export {
|
|
|
2263
2391
|
inputMessageForLoop,
|
|
2264
2392
|
isCompletionEvent,
|
|
2265
2393
|
isDaemonLive,
|
|
2394
|
+
isDaemonTurnEndEvent,
|
|
2266
2395
|
isSubagentProgressEvent,
|
|
2267
2396
|
isTurnEndCustomData,
|
|
2268
2397
|
isTurnProgressChunk,
|