@clawos-dev/clawd 0.2.12-beta.9.1f3b33f → 0.2.12
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/cli.cjs +26 -34
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -12888,7 +12888,7 @@ function buildSpawnContext(file) {
|
|
|
12888
12888
|
}
|
|
12889
12889
|
function sessionInfoFrame(file) {
|
|
12890
12890
|
const frame = { type: "session:info", ...file };
|
|
12891
|
-
return { kind: "emit-frame", frame };
|
|
12891
|
+
return { kind: "emit-frame", frame, target: "all" };
|
|
12892
12892
|
}
|
|
12893
12893
|
function eqContextUsage(a, b) {
|
|
12894
12894
|
if (a === b) return true;
|
|
@@ -13096,7 +13096,8 @@ function applyCommand(state, command, deps) {
|
|
|
13096
13096
|
effects.push({ kind: "delete-file" });
|
|
13097
13097
|
effects.push({
|
|
13098
13098
|
kind: "emit-frame",
|
|
13099
|
-
frame: { type: "session:deleted", sessionId }
|
|
13099
|
+
frame: { type: "session:deleted", sessionId },
|
|
13100
|
+
target: "all"
|
|
13100
13101
|
});
|
|
13101
13102
|
return { state: next, effects };
|
|
13102
13103
|
}
|
|
@@ -13152,6 +13153,10 @@ function applyCommand(state, command, deps) {
|
|
|
13152
13153
|
next.seenUuids = [];
|
|
13153
13154
|
effects.push({ kind: "persist-file", file: nextFile });
|
|
13154
13155
|
effects.push(sessionInfoFrame(nextFile));
|
|
13156
|
+
effects.push({
|
|
13157
|
+
kind: "emit-frame",
|
|
13158
|
+
frame: { type: "session:cleared", sessionId }
|
|
13159
|
+
});
|
|
13155
13160
|
if (next.procAlive) {
|
|
13156
13161
|
effects.push({ kind: "kill", signal: "SIGKILL" });
|
|
13157
13162
|
}
|
|
@@ -13766,7 +13771,7 @@ var SessionManager = class {
|
|
|
13766
13771
|
return {
|
|
13767
13772
|
response: { sessionId: args.sessionId },
|
|
13768
13773
|
broadcast: [
|
|
13769
|
-
{ frame: { type: "session:deleted", sessionId: args.sessionId }, target: "
|
|
13774
|
+
{ frame: { type: "session:deleted", sessionId: args.sessionId }, target: "all" }
|
|
13770
13775
|
]
|
|
13771
13776
|
};
|
|
13772
13777
|
}
|
|
@@ -16475,22 +16480,11 @@ var LocalWsServer = class {
|
|
|
16475
16480
|
this.frameHandler = handler;
|
|
16476
16481
|
}
|
|
16477
16482
|
broadcastToSession(sessionId, frame) {
|
|
16478
|
-
let delivered = 0;
|
|
16479
16483
|
for (const c of this.clients.values()) {
|
|
16480
16484
|
if (c.handle.subscribedSessions.has(sessionId)) {
|
|
16481
16485
|
this.safeSend(c.ws, frame);
|
|
16482
|
-
delivered++;
|
|
16483
16486
|
}
|
|
16484
16487
|
}
|
|
16485
|
-
const f = frame;
|
|
16486
|
-
this.logger?.info("[bcast]", {
|
|
16487
|
-
sid: sessionId,
|
|
16488
|
-
type: f.type,
|
|
16489
|
-
kind: f.event?.kind,
|
|
16490
|
-
seq: f.event?.seq,
|
|
16491
|
-
delivered,
|
|
16492
|
-
totalClients: this.clients.size
|
|
16493
|
-
});
|
|
16494
16488
|
}
|
|
16495
16489
|
/** 测试 / 内部探针:返回某 client 对某 session 的当前 refCount(0 表示未订阅) */
|
|
16496
16490
|
getSubscriptionRefCount(clientId, sessionId) {
|
|
@@ -16608,11 +16602,6 @@ var LocalWsServer = class {
|
|
|
16608
16602
|
}
|
|
16609
16603
|
if (frame.type === "session:subscribe" && typeof frame.sessionId === "string") {
|
|
16610
16604
|
addSubscription(client, frame.sessionId);
|
|
16611
|
-
this.logger?.info("[sub]", {
|
|
16612
|
-
clientId: client.id,
|
|
16613
|
-
sid: frame.sessionId,
|
|
16614
|
-
refCount: client.subscribedSessions.get(frame.sessionId) ?? 0
|
|
16615
|
-
});
|
|
16616
16605
|
if (typeof frame.requestId === "string") {
|
|
16617
16606
|
this.safeSend(this.clients.get(client.id).ws, { type: "subscribed", requestId: frame.requestId, sessionId: frame.sessionId });
|
|
16618
16607
|
}
|
|
@@ -16620,11 +16609,6 @@ var LocalWsServer = class {
|
|
|
16620
16609
|
}
|
|
16621
16610
|
if (frame.type === "session:unsubscribe" && typeof frame.sessionId === "string") {
|
|
16622
16611
|
removeSubscription(client, frame.sessionId);
|
|
16623
|
-
this.logger?.info("[unsub]", {
|
|
16624
|
-
clientId: client.id,
|
|
16625
|
-
sid: frame.sessionId,
|
|
16626
|
-
refCount: client.subscribedSessions.get(frame.sessionId) ?? 0
|
|
16627
|
-
});
|
|
16628
16612
|
if (typeof frame.requestId === "string") {
|
|
16629
16613
|
this.safeSend(this.clients.get(client.id).ws, { type: "unsubscribed", requestId: frame.requestId, sessionId: frame.sessionId });
|
|
16630
16614
|
}
|
|
@@ -18054,19 +18038,14 @@ async function startDaemon(config) {
|
|
|
18054
18038
|
getAdapter,
|
|
18055
18039
|
historyReader: history,
|
|
18056
18040
|
broadcastFrame: (frame, target) => {
|
|
18041
|
+
if (target === "all") {
|
|
18042
|
+
transport?.broadcastAll(frame);
|
|
18043
|
+
return;
|
|
18044
|
+
}
|
|
18057
18045
|
const sid = frame.sessionId;
|
|
18058
18046
|
if (!sid) return;
|
|
18059
|
-
const f = frame;
|
|
18060
|
-
logger.info("[push]", {
|
|
18061
|
-
sid,
|
|
18062
|
-
type: f.type,
|
|
18063
|
-
kind: f.event?.kind,
|
|
18064
|
-
seq: f.event?.seq,
|
|
18065
|
-
target: target ?? "broadcast"
|
|
18066
|
-
});
|
|
18067
18047
|
if (target === "first-subscriber") {
|
|
18068
18048
|
const handle = transport?.firstSubscriber(sid);
|
|
18069
|
-
logger.info("[push.fs]", { sid, type: f.type, hit: !!handle });
|
|
18070
18049
|
if (handle) handle.send(frame);
|
|
18071
18050
|
return;
|
|
18072
18051
|
}
|
|
@@ -18077,7 +18056,16 @@ async function startDaemon(config) {
|
|
|
18077
18056
|
onEvent: ({ sessionId, events }) => {
|
|
18078
18057
|
manager.feedObserverEvents(sessionId, events);
|
|
18079
18058
|
},
|
|
18080
|
-
onStatus: (sessionId, status) =>
|
|
18059
|
+
onStatus: (sessionId, status) => {
|
|
18060
|
+
const r = manager.getActive(sessionId);
|
|
18061
|
+
logger.info("observer.onStatus broadcast", {
|
|
18062
|
+
sessionId,
|
|
18063
|
+
status,
|
|
18064
|
+
hasRunner: !!r,
|
|
18065
|
+
runnerProcAlive: r ? r.getState().procAlive : null
|
|
18066
|
+
});
|
|
18067
|
+
transport?.broadcastToSession(sessionId, { type: "session:status", sessionId, status });
|
|
18068
|
+
},
|
|
18081
18069
|
// jsonl user 行的 real uuid 映射到 buffer 里 synth user_text,rewind 系列 RPC 在
|
|
18082
18070
|
// daemon 内部转译,UI 看到的始终是 events 流里的 synth uuid(详见 manager 注释)
|
|
18083
18071
|
onUserMessageObserved: (sessionId, realUuid, text) => {
|
|
@@ -18108,6 +18096,10 @@ async function startDaemon(config) {
|
|
|
18108
18096
|
client.send({ ...result.response, requestId });
|
|
18109
18097
|
}
|
|
18110
18098
|
for (const { frame: bf, target } of result.broadcast ?? []) {
|
|
18099
|
+
if (target === "all") {
|
|
18100
|
+
transport?.broadcastAll(bf);
|
|
18101
|
+
continue;
|
|
18102
|
+
}
|
|
18111
18103
|
const sid = bf.sessionId;
|
|
18112
18104
|
if (target === "first-subscriber" && sid) {
|
|
18113
18105
|
const handle = transport?.firstSubscriber(sid);
|
package/package.json
CHANGED