@mirasoth/soothe-client 0.5.3 → 0.5.5
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-ZMZVHADX.js → chunk-XEZBHENR.js} +13 -27
- package/dist/chunk-XEZBHENR.js.map +1 -0
- package/dist/client-TQNJNIH2.js +7 -0
- package/dist/index.cjs +96 -54
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +52 -28
- package/dist/index.d.ts +52 -28
- package/dist/index.js +86 -34
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-ZMZVHADX.js.map +0 -1
- package/dist/client-SBKRN2OQ.js +0 -7
- /package/dist/{client-SBKRN2OQ.js.map → client-TQNJNIH2.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -485,16 +485,12 @@ function isSubagentProgressEvent(eventType) {
|
|
|
485
485
|
}
|
|
486
486
|
return parsed.action === "started" || parsed.action === "completed";
|
|
487
487
|
}
|
|
488
|
-
var EventPlanCreated,
|
|
488
|
+
var EventPlanCreated, EventDeepResearchStarted, EventDeepResearchProgress, EventDeepResearchStepCompleted, EventDeepResearchGatherSummary, EventDeepResearchCrawlSummary, EventDeepResearchCompleted, EventReplayComplete, EventLoopReattachedWire, EventCardCreated, EventCardUpdated, EventCardFinalized, EventCardReplayBegin, EventCardReplayEnd, EventToolStarted, EventToolCompleted, EventToolError, EventStreamToolCallUpdate, EventToolCallUpdatesBatch, EventStrangeLoopStarted, EventStrangeLoopCompleted, EventStrangeLoopPlanDecision, EventStrangeLoopReasoned, EventStrangeLoopStepStarted, EventStrangeLoopStepQueued, EventStrangeLoopStepCompleted, EventStrangeLoopContextCompacted, EventMessageReceived, EventMessageSent, EventFinalReport, EventAutopilotGoalStatus, EventAutopilotGoalProgress, EventAutopilotGoalCreated, EventAutopilotGoalCompleted, EventAutopilotWorkerAssigned, EventAutopilotWorkerUnassigned, EventGeneralFailed;
|
|
489
489
|
var init_events = __esm({
|
|
490
490
|
"src/events.ts"() {
|
|
491
491
|
"use strict";
|
|
492
492
|
init_verbosity();
|
|
493
493
|
EventPlanCreated = "soothe.cognition.plan.created";
|
|
494
|
-
EventExplorerStarted = "soothe.subagent.explorer.started";
|
|
495
|
-
EventExplorerMilestone = "soothe.subagent.explorer.milestone";
|
|
496
|
-
EventExplorerStepCompleted = "soothe.subagent.explorer.step.completed";
|
|
497
|
-
EventExplorerCompleted = "soothe.subagent.explorer.completed";
|
|
498
494
|
EventDeepResearchStarted = "soothe.subagent.deep_research.started";
|
|
499
495
|
EventDeepResearchProgress = "soothe.subagent.deep_research.progress";
|
|
500
496
|
EventDeepResearchStepCompleted = "soothe.subagent.deep_research.step.completed";
|
|
@@ -503,9 +499,11 @@ var init_events = __esm({
|
|
|
503
499
|
EventDeepResearchCompleted = "soothe.subagent.deep_research.completed";
|
|
504
500
|
EventReplayComplete = "replay_complete";
|
|
505
501
|
EventLoopReattachedWire = "loop_reattached";
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
502
|
+
EventCardCreated = "soothe.card.created";
|
|
503
|
+
EventCardUpdated = "soothe.card.updated";
|
|
504
|
+
EventCardFinalized = "soothe.card.finalized";
|
|
505
|
+
EventCardReplayBegin = "soothe.card.replay.begin";
|
|
506
|
+
EventCardReplayEnd = "soothe.card.replay.end";
|
|
509
507
|
EventToolStarted = "soothe.tool.execution.started";
|
|
510
508
|
EventToolCompleted = "soothe.tool.execution.completed";
|
|
511
509
|
EventToolError = "soothe.tool.execution.error";
|
|
@@ -777,7 +775,10 @@ var init_stream_terminal = __esm({
|
|
|
777
775
|
EventPlanCreated,
|
|
778
776
|
EventStrangeLoopStepStarted,
|
|
779
777
|
EventStrangeLoopStepQueued,
|
|
780
|
-
EventStrangeLoopStepCompleted
|
|
778
|
+
EventStrangeLoopStepCompleted,
|
|
779
|
+
EventCardCreated,
|
|
780
|
+
EventCardUpdated,
|
|
781
|
+
EventCardFinalized
|
|
781
782
|
]);
|
|
782
783
|
STALE_TURN_PENDING_TYPES = /* @__PURE__ */ new Set([
|
|
783
784
|
"connection_ack",
|
|
@@ -1700,10 +1701,6 @@ var init_client = __esm({
|
|
|
1700
1701
|
if (asNode) params.as_node = asNode;
|
|
1701
1702
|
return this.sendMessage(requestEnvelope("loop_state_update", params));
|
|
1702
1703
|
}
|
|
1703
|
-
/** Requests display card ledger snapshot. */
|
|
1704
|
-
sendLoopCardsFetch(loopID) {
|
|
1705
|
-
return this.sendMessage(requestEnvelope("loop_cards_fetch", { loop_id: loopID }));
|
|
1706
|
-
}
|
|
1707
1704
|
/** Requests the full loop history. */
|
|
1708
1705
|
sendLoopHistoryFetch(loopID) {
|
|
1709
1706
|
return this.sendMessage(requestEnvelope("loop_history_fetch", { loop_id: loopID }));
|
|
@@ -1754,15 +1751,6 @@ var init_client = __esm({
|
|
|
1754
1751
|
timeout ?? 15e3
|
|
1755
1752
|
);
|
|
1756
1753
|
}
|
|
1757
|
-
/** Requests display cards and waits for response. */
|
|
1758
|
-
fetchLoopCards(loopID, timeout) {
|
|
1759
|
-
return this.requestResponse(
|
|
1760
|
-
"loop_cards_fetch",
|
|
1761
|
-
{ loop_id: loopID },
|
|
1762
|
-
"loop_cards_fetch",
|
|
1763
|
-
timeout ?? 15e3
|
|
1764
|
-
);
|
|
1765
|
-
}
|
|
1766
1754
|
/** Requests MCP status and waits for response. */
|
|
1767
1755
|
getMCPStatus(timeout) {
|
|
1768
1756
|
return this.requestResponse("mcp_status", {}, "mcp_status", timeout ?? 15e3);
|
|
@@ -1998,6 +1986,7 @@ var init_client = __esm({
|
|
|
1998
1986
|
var index_exports = {};
|
|
1999
1987
|
__export(index_exports, {
|
|
2000
1988
|
CLIENT_VERSION: () => CLIENT_VERSION,
|
|
1989
|
+
CardProjection: () => CardProjection,
|
|
2001
1990
|
ChatEventTerminal: () => ChatEventTerminal,
|
|
2002
1991
|
Client: () => Client,
|
|
2003
1992
|
CommandClient: () => CommandClient,
|
|
@@ -2021,8 +2010,10 @@ __export(index_exports, {
|
|
|
2021
2010
|
EventAutopilotWorkerAssigned: () => EventAutopilotWorkerAssigned,
|
|
2022
2011
|
EventAutopilotWorkerUnassigned: () => EventAutopilotWorkerUnassigned,
|
|
2023
2012
|
EventCardCreated: () => EventCardCreated,
|
|
2013
|
+
EventCardFinalized: () => EventCardFinalized,
|
|
2024
2014
|
EventCardReplayBegin: () => EventCardReplayBegin,
|
|
2025
2015
|
EventCardReplayEnd: () => EventCardReplayEnd,
|
|
2016
|
+
EventCardUpdated: () => EventCardUpdated,
|
|
2026
2017
|
EventClassifier: () => EventClassifier,
|
|
2027
2018
|
EventDeepResearchCompleted: () => EventDeepResearchCompleted,
|
|
2028
2019
|
EventDeepResearchCrawlSummary: () => EventDeepResearchCrawlSummary,
|
|
@@ -2030,10 +2021,6 @@ __export(index_exports, {
|
|
|
2030
2021
|
EventDeepResearchProgress: () => EventDeepResearchProgress,
|
|
2031
2022
|
EventDeepResearchStarted: () => EventDeepResearchStarted,
|
|
2032
2023
|
EventDeepResearchStepCompleted: () => EventDeepResearchStepCompleted,
|
|
2033
|
-
EventExplorerCompleted: () => EventExplorerCompleted,
|
|
2034
|
-
EventExplorerMilestone: () => EventExplorerMilestone,
|
|
2035
|
-
EventExplorerStarted: () => EventExplorerStarted,
|
|
2036
|
-
EventExplorerStepCompleted: () => EventExplorerStepCompleted,
|
|
2037
2024
|
EventFinalReport: () => EventFinalReport,
|
|
2038
2025
|
EventGeneralFailed: () => EventGeneralFailed,
|
|
2039
2026
|
EventLoopReattachedWire: () => EventLoopReattachedWire,
|
|
@@ -2097,7 +2084,6 @@ __export(index_exports, {
|
|
|
2097
2084
|
extractSootheLoopID: () => extractSootheLoopID,
|
|
2098
2085
|
extractThinkingStep: () => extractThinkingStep,
|
|
2099
2086
|
fetchConfigSection: () => fetchConfigSection,
|
|
2100
|
-
fetchLoopCards: () => fetchLoopCards,
|
|
2101
2087
|
fetchLoopHistory: () => fetchLoopHistory,
|
|
2102
2088
|
fetchLoopMessages: () => fetchLoopMessages,
|
|
2103
2089
|
fetchSkillsCatalog: () => fetchSkillsCatalog,
|
|
@@ -2117,6 +2103,7 @@ __export(index_exports, {
|
|
|
2117
2103
|
newLoopSubscribeMessage: () => newLoopSubscribeMessage,
|
|
2118
2104
|
newRequestID: () => newRequestID,
|
|
2119
2105
|
notificationEnvelope: () => notificationEnvelope,
|
|
2106
|
+
parseCardCustomPayload: () => parseCardCustomPayload,
|
|
2120
2107
|
parseNamespace: () => parseNamespace,
|
|
2121
2108
|
pingEnvelope: () => pingEnvelope,
|
|
2122
2109
|
pongEnvelope: () => pongEnvelope,
|
|
@@ -2426,9 +2413,6 @@ async function refreshAuthToken(client, refreshToken, timeout) {
|
|
|
2426
2413
|
timeout ?? 15e3
|
|
2427
2414
|
);
|
|
2428
2415
|
}
|
|
2429
|
-
async function fetchLoopCards(client, loopID, timeout) {
|
|
2430
|
-
return client.fetchLoopCards(loopID, timeout);
|
|
2431
|
-
}
|
|
2432
2416
|
async function fetchLoopMessages(client, loopID, opts) {
|
|
2433
2417
|
return client.getLoopMessages(
|
|
2434
2418
|
loopID,
|
|
@@ -4201,25 +4185,6 @@ var DaemonSession = class {
|
|
|
4201
4185
|
return this.rpcClient.listLoops(15e3);
|
|
4202
4186
|
});
|
|
4203
4187
|
}
|
|
4204
|
-
async fetchLoopCards(loopId) {
|
|
4205
|
-
const lid = String(loopId || "").trim();
|
|
4206
|
-
if (!lid) return { cards: [], seq: 0, contextTokens: 0, success: false };
|
|
4207
|
-
return this.withRpcLock(async () => {
|
|
4208
|
-
await this.ensureRpcConnected();
|
|
4209
|
-
try {
|
|
4210
|
-
const resp = await this.rpcClient.fetchLoopCards(lid, 3e4);
|
|
4211
|
-
const rawCards = resp.cards;
|
|
4212
|
-
return {
|
|
4213
|
-
cards: Array.isArray(rawCards) ? rawCards : [],
|
|
4214
|
-
seq: Number(resp.seq ?? 0),
|
|
4215
|
-
contextTokens: typeof resp.context_tokens === "number" && resp.context_tokens >= 0 ? resp.context_tokens : 0,
|
|
4216
|
-
success: true
|
|
4217
|
-
};
|
|
4218
|
-
} catch {
|
|
4219
|
-
return { cards: [], seq: 0, contextTokens: 0, success: false };
|
|
4220
|
-
}
|
|
4221
|
-
});
|
|
4222
|
-
}
|
|
4223
4188
|
async fetchLoopHistory(loopId) {
|
|
4224
4189
|
const lid = String(loopId || "").trim();
|
|
4225
4190
|
if (!lid) {
|
|
@@ -4367,9 +4332,88 @@ var DaemonSession = class {
|
|
|
4367
4332
|
}
|
|
4368
4333
|
}
|
|
4369
4334
|
};
|
|
4335
|
+
|
|
4336
|
+
// src/display/cardProjection.ts
|
|
4337
|
+
init_events();
|
|
4338
|
+
var CARD_MUTATION_TYPES = /* @__PURE__ */ new Set([
|
|
4339
|
+
EventCardCreated,
|
|
4340
|
+
EventCardUpdated,
|
|
4341
|
+
EventCardFinalized,
|
|
4342
|
+
EventCardReplayBegin,
|
|
4343
|
+
EventCardReplayEnd
|
|
4344
|
+
]);
|
|
4345
|
+
function parseCardCustomPayload(data) {
|
|
4346
|
+
if (!data || typeof data !== "object") return null;
|
|
4347
|
+
const d = data;
|
|
4348
|
+
const wireType = String(d.type ?? "").trim();
|
|
4349
|
+
if (!CARD_MUTATION_TYPES.has(wireType)) return null;
|
|
4350
|
+
if (wireType === EventCardReplayBegin || wireType === EventCardReplayEnd) {
|
|
4351
|
+
return { wireType, card: null, patch: {} };
|
|
4352
|
+
}
|
|
4353
|
+
const payload = d.data && typeof d.data === "object" ? { ...d.data } : {};
|
|
4354
|
+
const cardId = String(d.card_id ?? payload.id ?? "").trim();
|
|
4355
|
+
if (wireType === EventCardCreated) {
|
|
4356
|
+
if (!payload.type || payload.content === void 0) return null;
|
|
4357
|
+
if (!payload.id && cardId) payload.id = cardId;
|
|
4358
|
+
return { wireType, card: payload, patch: {} };
|
|
4359
|
+
}
|
|
4360
|
+
if (!payload.id && cardId) payload.id = cardId;
|
|
4361
|
+
return {
|
|
4362
|
+
wireType,
|
|
4363
|
+
card: null,
|
|
4364
|
+
patch: payload
|
|
4365
|
+
};
|
|
4366
|
+
}
|
|
4367
|
+
var CardProjection = class {
|
|
4368
|
+
cards = /* @__PURE__ */ new Map();
|
|
4369
|
+
_replaying = false;
|
|
4370
|
+
get replaying() {
|
|
4371
|
+
return this._replaying;
|
|
4372
|
+
}
|
|
4373
|
+
snapshot() {
|
|
4374
|
+
return [...this.cards.values()];
|
|
4375
|
+
}
|
|
4376
|
+
get(cardId) {
|
|
4377
|
+
return this.cards.get(cardId);
|
|
4378
|
+
}
|
|
4379
|
+
/** Apply one custom-mode card payload. Returns true when handled. */
|
|
4380
|
+
apply(data) {
|
|
4381
|
+
const parsed = parseCardCustomPayload(data);
|
|
4382
|
+
if (!parsed) return false;
|
|
4383
|
+
if (parsed.wireType === EventCardReplayBegin) {
|
|
4384
|
+
this._replaying = true;
|
|
4385
|
+
this.cards.clear();
|
|
4386
|
+
return true;
|
|
4387
|
+
}
|
|
4388
|
+
if (parsed.wireType === EventCardReplayEnd) {
|
|
4389
|
+
this._replaying = false;
|
|
4390
|
+
return true;
|
|
4391
|
+
}
|
|
4392
|
+
if (parsed.wireType === EventCardCreated && parsed.card) {
|
|
4393
|
+
const id = String(parsed.card.id ?? "").trim();
|
|
4394
|
+
if (id) this.cards.set(id, { ...parsed.card });
|
|
4395
|
+
return true;
|
|
4396
|
+
}
|
|
4397
|
+
if (parsed.wireType === EventCardUpdated || parsed.wireType === EventCardFinalized) {
|
|
4398
|
+
const id = String(parsed.patch.id ?? "").trim();
|
|
4399
|
+
if (!id) return true;
|
|
4400
|
+
const existing = this.cards.get(id);
|
|
4401
|
+
if (!existing) return true;
|
|
4402
|
+
const next = { ...existing };
|
|
4403
|
+
for (const [key, value] of Object.entries(parsed.patch)) {
|
|
4404
|
+
if (key === "id" || key === "type") continue;
|
|
4405
|
+
next[key] = value;
|
|
4406
|
+
}
|
|
4407
|
+
this.cards.set(id, next);
|
|
4408
|
+
return true;
|
|
4409
|
+
}
|
|
4410
|
+
return true;
|
|
4411
|
+
}
|
|
4412
|
+
};
|
|
4370
4413
|
// Annotate the CommonJS export names for ESM import in node:
|
|
4371
4414
|
0 && (module.exports = {
|
|
4372
4415
|
CLIENT_VERSION,
|
|
4416
|
+
CardProjection,
|
|
4373
4417
|
ChatEventTerminal,
|
|
4374
4418
|
Client,
|
|
4375
4419
|
CommandClient,
|
|
@@ -4393,8 +4437,10 @@ var DaemonSession = class {
|
|
|
4393
4437
|
EventAutopilotWorkerAssigned,
|
|
4394
4438
|
EventAutopilotWorkerUnassigned,
|
|
4395
4439
|
EventCardCreated,
|
|
4440
|
+
EventCardFinalized,
|
|
4396
4441
|
EventCardReplayBegin,
|
|
4397
4442
|
EventCardReplayEnd,
|
|
4443
|
+
EventCardUpdated,
|
|
4398
4444
|
EventClassifier,
|
|
4399
4445
|
EventDeepResearchCompleted,
|
|
4400
4446
|
EventDeepResearchCrawlSummary,
|
|
@@ -4402,10 +4448,6 @@ var DaemonSession = class {
|
|
|
4402
4448
|
EventDeepResearchProgress,
|
|
4403
4449
|
EventDeepResearchStarted,
|
|
4404
4450
|
EventDeepResearchStepCompleted,
|
|
4405
|
-
EventExplorerCompleted,
|
|
4406
|
-
EventExplorerMilestone,
|
|
4407
|
-
EventExplorerStarted,
|
|
4408
|
-
EventExplorerStepCompleted,
|
|
4409
4451
|
EventFinalReport,
|
|
4410
4452
|
EventGeneralFailed,
|
|
4411
4453
|
EventLoopReattachedWire,
|
|
@@ -4469,7 +4511,6 @@ var DaemonSession = class {
|
|
|
4469
4511
|
extractSootheLoopID,
|
|
4470
4512
|
extractThinkingStep,
|
|
4471
4513
|
fetchConfigSection,
|
|
4472
|
-
fetchLoopCards,
|
|
4473
4514
|
fetchLoopHistory,
|
|
4474
4515
|
fetchLoopMessages,
|
|
4475
4516
|
fetchSkillsCatalog,
|
|
@@ -4489,6 +4530,7 @@ var DaemonSession = class {
|
|
|
4489
4530
|
newLoopSubscribeMessage,
|
|
4490
4531
|
newRequestID,
|
|
4491
4532
|
notificationEnvelope,
|
|
4533
|
+
parseCardCustomPayload,
|
|
4492
4534
|
parseNamespace,
|
|
4493
4535
|
pingEnvelope,
|
|
4494
4536
|
pongEnvelope,
|