@clawos-dev/clawd 0.2.169 → 0.2.170-beta.346.c7ac1be

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.
Files changed (2) hide show
  1. package/dist/cli.cjs +56 -11
  2. package/package.json +1 -1
package/dist/cli.cjs CHANGED
@@ -12369,15 +12369,11 @@ var init_claude = __esm({
12369
12369
  label: "Effort",
12370
12370
  description: "Reasoning effort level",
12371
12371
  scope: "tool-specific",
12372
- // CC `--effort` 值域(claude --help, 2.1.187):low / medium / high / xhigh / max。
12373
- // '' = 不传 --effort,用 CLI 默认。
12374
12372
  options: [
12375
12373
  { value: "", label: "Default" },
12376
12374
  { value: "low", label: "Low" },
12377
12375
  { value: "medium", label: "Medium" },
12378
- { value: "high", label: "High" },
12379
- { value: "xhigh", label: "Extra high" },
12380
- { value: "max", label: "Max" }
12376
+ { value: "high", label: "High" }
12381
12377
  ],
12382
12378
  default: ""
12383
12379
  }
@@ -40755,6 +40751,8 @@ async function handleRpcRequest(input) {
40755
40751
  // src/transport/http-router.ts
40756
40752
  var RPC_ROUTE_PREFIX = "/api/rpc/";
40757
40753
  var RPC_BODY_MAX_BYTES = 1 * 1024 * 1024;
40754
+ var DISPATCH_HEARTBEAT_MS = 25e3;
40755
+ var DISPATCH_HOLD_METHOD = "personaDispatch:run";
40758
40756
  var AUTHED_RPC_ROUTE_PREFIX = "/rpc/";
40759
40757
  var AUTHED_RPC_CORS_HEADERS = {
40760
40758
  "Access-Control-Allow-Origin": "*",
@@ -40903,12 +40901,60 @@ function createHttpRouter(deps) {
40903
40901
  sendJson(res, 400, { ok: false, error: "INVALID_BODY", message: err instanceof Error ? err.message : String(err) }, AUTHED_RPC_CORS_HEADERS);
40904
40902
  return true;
40905
40903
  }
40904
+ const dispatchArgs = typeof body === "object" && body != null ? body : {};
40905
+ if (method === DISPATCH_HOLD_METHOD) {
40906
+ const heartbeatMs = deps.dispatchHeartbeatMs ?? DISPATCH_HEARTBEAT_MS;
40907
+ let headSent = false;
40908
+ let hbInterval;
40909
+ const startStreaming = () => {
40910
+ headSent = true;
40911
+ req.socket?.setTimeout?.(0);
40912
+ res.socket?.setTimeout?.(0);
40913
+ res.writeHead(200, {
40914
+ "Content-Type": "application/json; charset=utf-8",
40915
+ "Transfer-Encoding": "chunked",
40916
+ // nginx 专用:禁用该响应缓冲,让心跳字节即时 flush 到上游 read(否则被攒着不重置计时)
40917
+ "X-Accel-Buffering": "no",
40918
+ ...AUTHED_RPC_CORS_HEADERS
40919
+ });
40920
+ res.write(" ");
40921
+ hbInterval = setInterval(() => {
40922
+ try {
40923
+ res.write(" ");
40924
+ } catch {
40925
+ }
40926
+ }, heartbeatMs);
40927
+ };
40928
+ const graceTimer = setTimeout(startStreaming, heartbeatMs);
40929
+ const cleanup = () => {
40930
+ clearTimeout(graceTimer);
40931
+ if (hbInterval) clearInterval(hbInterval);
40932
+ };
40933
+ const safeEnd = (payload) => {
40934
+ if (res.writableEnded || res.destroyed) return;
40935
+ try {
40936
+ res.end(payload);
40937
+ } catch {
40938
+ }
40939
+ };
40940
+ res.on("close", cleanup);
40941
+ try {
40942
+ const result = await deps.authedRpc.dispatch(method, dispatchArgs, auth.context);
40943
+ cleanup();
40944
+ if (headSent) safeEnd(JSON.stringify({ ok: true, result: result.response }));
40945
+ else sendJson(res, 200, { ok: true, result: result.response }, AUTHED_RPC_CORS_HEADERS);
40946
+ } catch (err) {
40947
+ cleanup();
40948
+ const e = err;
40949
+ const code = e?.code ?? "INTERNAL";
40950
+ const payload = { ok: false, error: code, message: e?.message ?? String(err) };
40951
+ if (headSent) safeEnd(JSON.stringify(payload));
40952
+ else sendJson(res, authedRpcErrorStatus(code), payload, AUTHED_RPC_CORS_HEADERS);
40953
+ }
40954
+ return true;
40955
+ }
40906
40956
  try {
40907
- const result = await deps.authedRpc.dispatch(
40908
- method,
40909
- typeof body === "object" && body != null ? body : {},
40910
- auth.context
40911
- );
40957
+ const result = await deps.authedRpc.dispatch(method, dispatchArgs, auth.context);
40912
40958
  sendJson(res, 200, { ok: true, result: result.response }, AUTHED_RPC_CORS_HEADERS);
40913
40959
  } catch (err) {
40914
40960
  const e = err;
@@ -43826,7 +43872,6 @@ function buildPersonaHandlers(deps) {
43826
43872
  return { response: { type: "persona:info", ...persona } };
43827
43873
  };
43828
43874
  const list = async (_frame, _client, ctx) => {
43829
- personaRegistry.reload();
43830
43875
  const all = personaRegistry.list();
43831
43876
  const isGuest = ctx?.principal.kind === "guest";
43832
43877
  const personas = isGuest ? all.filter(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clawos-dev/clawd",
3
- "version": "0.2.169",
3
+ "version": "0.2.170-beta.346.c7ac1be",
4
4
  "description": "Standalone clawd daemon — Claude Code (and future Codex) session server over WebSocket",
5
5
  "type": "module",
6
6
  "license": "MIT",