@clawos-dev/clawd 0.2.12-beta.9.1f3b33f → 0.2.13-beta.14.45046af
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 +39 -44
- package/package.json +2 -1
package/dist/cli.cjs
CHANGED
|
@@ -8165,6 +8165,18 @@ var METHOD_NAMES = [
|
|
|
8165
8165
|
"ping"
|
|
8166
8166
|
];
|
|
8167
8167
|
|
|
8168
|
+
// ../protocol/src/events.ts
|
|
8169
|
+
var HISTORY_USER_META_VALUES = [
|
|
8170
|
+
"task-notification",
|
|
8171
|
+
"slash-command",
|
|
8172
|
+
"local-command",
|
|
8173
|
+
"system-reminder",
|
|
8174
|
+
"skill-hint",
|
|
8175
|
+
"meta-text",
|
|
8176
|
+
"attachment-skills",
|
|
8177
|
+
"attachment-deferred-tools"
|
|
8178
|
+
];
|
|
8179
|
+
|
|
8168
8180
|
// ../protocol/src/errors.ts
|
|
8169
8181
|
var ERROR_CODES = {
|
|
8170
8182
|
SESSION_NOT_FOUND: "SESSION_NOT_FOUND",
|
|
@@ -12326,16 +12338,7 @@ var ParsedEventBase = {
|
|
|
12326
12338
|
// reducer 用它做跨路径去重(managed stdout 和 observer JSONL 双写)。对齐 cc-direct cc-event-store
|
|
12327
12339
|
uuid: external_exports.string().optional()
|
|
12328
12340
|
};
|
|
12329
|
-
var HistoryUserMetaSchema = external_exports.enum(
|
|
12330
|
-
"task-notification",
|
|
12331
|
-
"slash-command",
|
|
12332
|
-
"local-command",
|
|
12333
|
-
"system-reminder",
|
|
12334
|
-
"skill-hint",
|
|
12335
|
-
"meta-text",
|
|
12336
|
-
"attachment-skills",
|
|
12337
|
-
"attachment-deferred-tools"
|
|
12338
|
-
]);
|
|
12341
|
+
var HistoryUserMetaSchema = external_exports.enum(HISTORY_USER_META_VALUES);
|
|
12339
12342
|
var SubagentToolStatsSchema = external_exports.object({
|
|
12340
12343
|
readCount: external_exports.number().int().nonnegative().optional(),
|
|
12341
12344
|
searchCount: external_exports.number().int().nonnegative().optional(),
|
|
@@ -12888,7 +12891,7 @@ function buildSpawnContext(file) {
|
|
|
12888
12891
|
}
|
|
12889
12892
|
function sessionInfoFrame(file) {
|
|
12890
12893
|
const frame = { type: "session:info", ...file };
|
|
12891
|
-
return { kind: "emit-frame", frame };
|
|
12894
|
+
return { kind: "emit-frame", frame, target: "all" };
|
|
12892
12895
|
}
|
|
12893
12896
|
function eqContextUsage(a, b) {
|
|
12894
12897
|
if (a === b) return true;
|
|
@@ -13096,7 +13099,8 @@ function applyCommand(state, command, deps) {
|
|
|
13096
13099
|
effects.push({ kind: "delete-file" });
|
|
13097
13100
|
effects.push({
|
|
13098
13101
|
kind: "emit-frame",
|
|
13099
|
-
frame: { type: "session:deleted", sessionId }
|
|
13102
|
+
frame: { type: "session:deleted", sessionId },
|
|
13103
|
+
target: "all"
|
|
13100
13104
|
});
|
|
13101
13105
|
return { state: next, effects };
|
|
13102
13106
|
}
|
|
@@ -13152,6 +13156,10 @@ function applyCommand(state, command, deps) {
|
|
|
13152
13156
|
next.seenUuids = [];
|
|
13153
13157
|
effects.push({ kind: "persist-file", file: nextFile });
|
|
13154
13158
|
effects.push(sessionInfoFrame(nextFile));
|
|
13159
|
+
effects.push({
|
|
13160
|
+
kind: "emit-frame",
|
|
13161
|
+
frame: { type: "session:cleared", sessionId }
|
|
13162
|
+
});
|
|
13155
13163
|
if (next.procAlive) {
|
|
13156
13164
|
effects.push({ kind: "kill", signal: "SIGKILL" });
|
|
13157
13165
|
}
|
|
@@ -13766,7 +13774,7 @@ var SessionManager = class {
|
|
|
13766
13774
|
return {
|
|
13767
13775
|
response: { sessionId: args.sessionId },
|
|
13768
13776
|
broadcast: [
|
|
13769
|
-
{ frame: { type: "session:deleted", sessionId: args.sessionId }, target: "
|
|
13777
|
+
{ frame: { type: "session:deleted", sessionId: args.sessionId }, target: "all" }
|
|
13770
13778
|
]
|
|
13771
13779
|
};
|
|
13772
13780
|
}
|
|
@@ -16475,22 +16483,11 @@ var LocalWsServer = class {
|
|
|
16475
16483
|
this.frameHandler = handler;
|
|
16476
16484
|
}
|
|
16477
16485
|
broadcastToSession(sessionId, frame) {
|
|
16478
|
-
let delivered = 0;
|
|
16479
16486
|
for (const c of this.clients.values()) {
|
|
16480
16487
|
if (c.handle.subscribedSessions.has(sessionId)) {
|
|
16481
16488
|
this.safeSend(c.ws, frame);
|
|
16482
|
-
delivered++;
|
|
16483
16489
|
}
|
|
16484
16490
|
}
|
|
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
16491
|
}
|
|
16495
16492
|
/** 测试 / 内部探针:返回某 client 对某 session 的当前 refCount(0 表示未订阅) */
|
|
16496
16493
|
getSubscriptionRefCount(clientId, sessionId) {
|
|
@@ -16608,11 +16605,6 @@ var LocalWsServer = class {
|
|
|
16608
16605
|
}
|
|
16609
16606
|
if (frame.type === "session:subscribe" && typeof frame.sessionId === "string") {
|
|
16610
16607
|
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
16608
|
if (typeof frame.requestId === "string") {
|
|
16617
16609
|
this.safeSend(this.clients.get(client.id).ws, { type: "subscribed", requestId: frame.requestId, sessionId: frame.sessionId });
|
|
16618
16610
|
}
|
|
@@ -16620,11 +16612,6 @@ var LocalWsServer = class {
|
|
|
16620
16612
|
}
|
|
16621
16613
|
if (frame.type === "session:unsubscribe" && typeof frame.sessionId === "string") {
|
|
16622
16614
|
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
16615
|
if (typeof frame.requestId === "string") {
|
|
16629
16616
|
this.safeSend(this.clients.get(client.id).ws, { type: "unsubscribed", requestId: frame.requestId, sessionId: frame.sessionId });
|
|
16630
16617
|
}
|
|
@@ -18054,19 +18041,14 @@ async function startDaemon(config) {
|
|
|
18054
18041
|
getAdapter,
|
|
18055
18042
|
historyReader: history,
|
|
18056
18043
|
broadcastFrame: (frame, target) => {
|
|
18044
|
+
if (target === "all") {
|
|
18045
|
+
transport?.broadcastAll(frame);
|
|
18046
|
+
return;
|
|
18047
|
+
}
|
|
18057
18048
|
const sid = frame.sessionId;
|
|
18058
18049
|
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
18050
|
if (target === "first-subscriber") {
|
|
18068
18051
|
const handle = transport?.firstSubscriber(sid);
|
|
18069
|
-
logger.info("[push.fs]", { sid, type: f.type, hit: !!handle });
|
|
18070
18052
|
if (handle) handle.send(frame);
|
|
18071
18053
|
return;
|
|
18072
18054
|
}
|
|
@@ -18077,7 +18059,16 @@ async function startDaemon(config) {
|
|
|
18077
18059
|
onEvent: ({ sessionId, events }) => {
|
|
18078
18060
|
manager.feedObserverEvents(sessionId, events);
|
|
18079
18061
|
},
|
|
18080
|
-
onStatus: (sessionId, status) =>
|
|
18062
|
+
onStatus: (sessionId, status) => {
|
|
18063
|
+
const r = manager.getActive(sessionId);
|
|
18064
|
+
logger.info("observer.onStatus broadcast", {
|
|
18065
|
+
sessionId,
|
|
18066
|
+
status,
|
|
18067
|
+
hasRunner: !!r,
|
|
18068
|
+
runnerProcAlive: r ? r.getState().procAlive : null
|
|
18069
|
+
});
|
|
18070
|
+
transport?.broadcastToSession(sessionId, { type: "session:status", sessionId, status });
|
|
18071
|
+
},
|
|
18081
18072
|
// jsonl user 行的 real uuid 映射到 buffer 里 synth user_text,rewind 系列 RPC 在
|
|
18082
18073
|
// daemon 内部转译,UI 看到的始终是 events 流里的 synth uuid(详见 manager 注释)
|
|
18083
18074
|
onUserMessageObserved: (sessionId, realUuid, text) => {
|
|
@@ -18108,6 +18099,10 @@ async function startDaemon(config) {
|
|
|
18108
18099
|
client.send({ ...result.response, requestId });
|
|
18109
18100
|
}
|
|
18110
18101
|
for (const { frame: bf, target } of result.broadcast ?? []) {
|
|
18102
|
+
if (target === "all") {
|
|
18103
|
+
transport?.broadcastAll(bf);
|
|
18104
|
+
continue;
|
|
18105
|
+
}
|
|
18111
18106
|
const sid = bf.sessionId;
|
|
18112
18107
|
if (target === "first-subscriber" && sid) {
|
|
18113
18108
|
const handle = transport?.firstSubscriber(sid);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clawos-dev/clawd",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.13-beta.14.45046af",
|
|
4
4
|
"description": "Standalone clawd daemon — Claude Code (and future Codex) session server over WebSocket",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"dev:watch": "tsx watch --clear-screen=false src/cli.ts",
|
|
23
23
|
"test": "vitest run",
|
|
24
24
|
"test:watch": "vitest",
|
|
25
|
+
"test:changed": "vitest run --changed origin/release",
|
|
25
26
|
"depcruise": "depcruise --config .dependency-cruiser.cjs src"
|
|
26
27
|
},
|
|
27
28
|
"devDependencies": {
|