@clawos-dev/clawd 0.2.279 → 0.2.280
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 +25 -17
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -54574,14 +54574,17 @@ function createHttpRouter(deps) {
|
|
|
54574
54574
|
return true;
|
|
54575
54575
|
}
|
|
54576
54576
|
const dispatchArgs = typeof body === "object" && body != null ? body : {};
|
|
54577
|
+
let broadcastAfterResponse;
|
|
54577
54578
|
try {
|
|
54578
54579
|
const result = await deps.authedRpc.dispatch(method, dispatchArgs, auth.context);
|
|
54579
54580
|
sendJson(res, 200, { ok: true, result: result.response }, AUTHED_RPC_CORS_HEADERS);
|
|
54581
|
+
broadcastAfterResponse = result.broadcast;
|
|
54580
54582
|
} catch (err) {
|
|
54581
54583
|
const e = err;
|
|
54582
54584
|
const code = e?.code ?? "INTERNAL";
|
|
54583
54585
|
sendJson(res, authedRpcErrorStatus(code), { ok: false, error: code, message: e?.message ?? String(err) }, AUTHED_RPC_CORS_HEADERS);
|
|
54584
54586
|
}
|
|
54587
|
+
if (broadcastAfterResponse?.length) deps.authedRpc.fanOutBroadcast?.(broadcastAfterResponse);
|
|
54585
54588
|
return true;
|
|
54586
54589
|
}
|
|
54587
54590
|
if (url.pathname.startsWith("/preview/")) {
|
|
@@ -58074,7 +58077,7 @@ function computeMethodAccess(args) {
|
|
|
58074
58077
|
}
|
|
58075
58078
|
|
|
58076
58079
|
// src/version.ts
|
|
58077
|
-
var version = "0.2.
|
|
58080
|
+
var version = "0.2.280".length > 0 ? "0.2.280" : "dev";
|
|
58078
58081
|
|
|
58079
58082
|
// src/cli-probe/probe.ts
|
|
58080
58083
|
var fs54 = __toESM(require("fs"), 1);
|
|
@@ -62076,6 +62079,23 @@ async function startDaemon(config) {
|
|
|
62076
62079
|
const authResolver = new AuthContextResolver({
|
|
62077
62080
|
ownerToken: resolvedAuthToken
|
|
62078
62081
|
});
|
|
62082
|
+
const fanOutBroadcast = (broadcast) => {
|
|
62083
|
+
for (const { frame: bf, target } of broadcast ?? []) {
|
|
62084
|
+
if (target === "all") {
|
|
62085
|
+
transport?.broadcastAll(bf);
|
|
62086
|
+
continue;
|
|
62087
|
+
}
|
|
62088
|
+
const sid = bf.sessionId;
|
|
62089
|
+
if (target === "first-subscriber" && sid) {
|
|
62090
|
+
const handle = transport?.firstSubscriber(sid);
|
|
62091
|
+
if (handle) handle.send(bf);
|
|
62092
|
+
continue;
|
|
62093
|
+
}
|
|
62094
|
+
if (sid) {
|
|
62095
|
+
transport?.broadcastToSession(sid, bf);
|
|
62096
|
+
}
|
|
62097
|
+
}
|
|
62098
|
+
};
|
|
62079
62099
|
const authedRpc = {
|
|
62080
62100
|
authenticate: (token) => authenticate(token, buildConnectAuthDeps()),
|
|
62081
62101
|
dispatch: (method, body, ctx) => {
|
|
@@ -62091,7 +62111,9 @@ async function startDaemon(config) {
|
|
|
62091
62111
|
handlers,
|
|
62092
62112
|
feishuActive: () => feishuActive
|
|
62093
62113
|
});
|
|
62094
|
-
}
|
|
62114
|
+
},
|
|
62115
|
+
// mutating RPC 经 HTTP 调用时 handler broadcast 帧的外推(http-router 在 response 送出后调)
|
|
62116
|
+
fanOutBroadcast
|
|
62095
62117
|
};
|
|
62096
62118
|
const viewerAssetLoader = tryLoadViewerAssets(logger);
|
|
62097
62119
|
const shareUiAssetLoader = tryLoadShareUi(logger);
|
|
@@ -62243,21 +62265,7 @@ async function startDaemon(config) {
|
|
|
62243
62265
|
if (requestId && result.response) {
|
|
62244
62266
|
client.send({ ...result.response, requestId });
|
|
62245
62267
|
}
|
|
62246
|
-
|
|
62247
|
-
if (target === "all") {
|
|
62248
|
-
transport?.broadcastAll(bf);
|
|
62249
|
-
continue;
|
|
62250
|
-
}
|
|
62251
|
-
const sid = bf.sessionId;
|
|
62252
|
-
if (target === "first-subscriber" && sid) {
|
|
62253
|
-
const handle = transport?.firstSubscriber(sid);
|
|
62254
|
-
if (handle) handle.send(bf);
|
|
62255
|
-
continue;
|
|
62256
|
-
}
|
|
62257
|
-
if (sid) {
|
|
62258
|
-
transport?.broadcastToSession(sid, bf);
|
|
62259
|
-
}
|
|
62260
|
-
}
|
|
62268
|
+
fanOutBroadcast(result.broadcast);
|
|
62261
62269
|
});
|
|
62262
62270
|
manager.sweepEphemeralOnStartup();
|
|
62263
62271
|
await wss.start();
|