@clawos-dev/clawd 0.2.545 → 0.2.547

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 +47 -16
  2. package/package.json +1 -1
package/dist/cli.cjs CHANGED
@@ -45639,7 +45639,9 @@ function cloneState(s2) {
45639
45639
  currentTurnSender: s2.currentTurnSender
45640
45640
  };
45641
45641
  }
45642
+ var CLOUD_IDLE_KILL_DELAY_MS = 5 * 6e4;
45642
45643
  function idleKillDelayOf(state) {
45644
+ if (state.file.tool === CODEX_CLOUD_TOOL_ID) return CLOUD_IDLE_KILL_DELAY_MS;
45643
45645
  const ms = state.subSessionMeta?.idleKillDelayMs;
45644
45646
  return ms !== void 0 && ms > 0 ? ms : void 0;
45645
45647
  }
@@ -46082,7 +46084,7 @@ function pushEventToBufferInPlace(next, event, deps) {
46082
46084
  if (canCloseStdin) {
46083
46085
  next.stdinClosed = true;
46084
46086
  effects.push({ kind: "close-stdin" });
46085
- } else if (isRpcAgentTool(tool)) {
46087
+ } else if (isRpcAgentTool(tool) && tool !== CODEX_CLOUD_TOOL_ID) {
46086
46088
  if (tool === PI_TOOL_ID) next.stdinClosed = true;
46087
46089
  effects.push({ kind: "kill", signal: "SIGTERM" });
46088
46090
  } else {
@@ -62409,6 +62411,32 @@ async function centralGetApiKey(opts) {
62409
62411
  gatewayUrl: typeof body.gatewayUrl === "string" ? body.gatewayUrl : null
62410
62412
  };
62411
62413
  }
62414
+ async function centralGetThread(opts) {
62415
+ const f2 = opts.fetchImpl ?? globalThis.fetch;
62416
+ const url = `${opts.api.replace(/\/+$/, "")}/api/persona-cloud/threads/${encodeURIComponent(opts.threadId)}`;
62417
+ const ctrl = new AbortController();
62418
+ const timer = setTimeout(() => ctrl.abort(), opts.timeoutMs ?? 15e3);
62419
+ let res;
62420
+ try {
62421
+ res = await f2(url, { method: "GET", headers: { authorization: `Bearer ${opts.loginPass}` }, signal: ctrl.signal });
62422
+ } catch (err) {
62423
+ clearTimeout(timer);
62424
+ throw new CentralClientError("NETWORK", `central server request failed: ${err.message}`, err);
62425
+ }
62426
+ clearTimeout(timer);
62427
+ if (res.status === 404) return null;
62428
+ if (res.status === 401) throw new CentralClientError("UNAUTHORIZED", "login pass rejected by center");
62429
+ if (!res.ok) {
62430
+ let detail = "";
62431
+ try {
62432
+ const body = await res.json();
62433
+ if (typeof body?.message === "string" && body.message) detail = `: ${body.message}`;
62434
+ } catch {
62435
+ }
62436
+ throw new CentralClientError("API_ERROR", `central server HTTP ${res.status}${detail}`);
62437
+ }
62438
+ return await res.text();
62439
+ }
62412
62440
  async function centralIssueApiKey(opts) {
62413
62441
  const body = await centralRequest(opts, "/api/persona-cloud/api-key", {
62414
62442
  method: "POST",
@@ -62496,8 +62524,6 @@ var GATEWAY_ROUTES = {
62496
62524
  healthz: () => "/healthz",
62497
62525
  session: (personaId2) => `/p/${encodeURIComponent(personaId2)}/session`,
62498
62526
  sessionSend: (personaId2, sessionId) => `/p/${encodeURIComponent(personaId2)}/session/${encodeURIComponent(sessionId)}`,
62499
- // 历史文件不挂在 persona 下:使用者卷跨 persona 共用(design 2026-09-14-codex-native-memories §3.2f)
62500
- thread: (threadId) => `/threads/${encodeURIComponent(threadId)}`,
62501
62527
  // 调用方自己那块盘的用量(design 2026-09-19-cloud-volume-usage §3.3):同样按人、不挂 persona
62502
62528
  volume: () => "/me/volume"
62503
62529
  };
@@ -62612,16 +62638,6 @@ var CloudGatewayClient = class {
62612
62638
  if (body.volume == null) return null;
62613
62639
  return CloudVolumeUsageSchema.parse(body.volume);
62614
62640
  }
62615
- /** rollout 原文;404 = 没这条 thread(还没开过第一轮 / 卷被清)→ null */
62616
- async fetchRollout(threadId) {
62617
- const { apiKey, gatewayUrl } = await this.credentials();
62618
- const res = await this.fetchImpl(gatewayUrl + GATEWAY_ROUTES.thread(threadId), {
62619
- headers: { authorization: `Bearer ${apiKey}` }
62620
- });
62621
- if (res.status === 404) return null;
62622
- if (!res.ok) throw new Error(`gateway threads \u8DEF\u7531\u56DE ${res.status}`);
62623
- return await res.text();
62624
- }
62625
62641
  };
62626
62642
  function parseControlLine(line) {
62627
62643
  let o2;
@@ -63018,7 +63034,7 @@ var CloudCodexAdapter = class {
63018
63034
  this.client = opts.client;
63019
63035
  this.logger = opts.logger;
63020
63036
  this.getSignSecret = opts.getSignSecret;
63021
- this.historyReader = new CloudCodexHistoryReader(opts.client, opts.logger);
63037
+ this.historyReader = new CloudCodexHistoryReader(opts.history, opts.logger);
63022
63038
  }
63023
63039
  /** 可用 = 能拿到凭据(登了飞书、生成过 key、中心配了 gateway),与本机装没装 codex 无关 */
63024
63040
  async probe() {
@@ -70995,7 +71011,7 @@ function computeMethodAccess(args) {
70995
71011
  }
70996
71012
 
70997
71013
  // src/version.ts
70998
- var version = "0.2.545".length > 0 ? "0.2.545" : "dev";
71014
+ var version = "0.2.547".length > 0 ? "0.2.547" : "dev";
70999
71015
 
71000
71016
  // src/cli-probe/probe.ts
71001
71017
  var fs78 = __toESM(require("fs"), 1);
@@ -74199,7 +74215,22 @@ async function startDaemon(config) {
74199
74215
  getSignSecret: () => authFile.token
74200
74216
  })
74201
74217
  );
74202
- registerAdapter(CODEX_CLOUD_TOOL_ID, new CloudCodexAdapter({ client: cloudGateway, logger, getSignSecret: () => authFile.token }));
74218
+ registerAdapter(
74219
+ CODEX_CLOUD_TOOL_ID,
74220
+ new CloudCodexAdapter({
74221
+ client: cloudGateway,
74222
+ // 历史副本从中心拉(design 2026-09-19-cloud-session-oss §3.4):没登录就没有历史,不抛
74223
+ history: {
74224
+ fetchRollout: (threadId) => {
74225
+ const loginPass = ownerIdentityStore.read()?.loginPass;
74226
+ if (!loginPass) return Promise.resolve(null);
74227
+ return centralGetThread({ api: config.clawosApi ?? DEFAULT_CLAWOS_API, loginPass, threadId });
74228
+ }
74229
+ },
74230
+ logger,
74231
+ getSignSecret: () => authFile.token
74232
+ })
74233
+ );
74203
74234
  const piMcpBridgeCandidates = [
74204
74235
  import_node_path80.default.join(here, "pi-mcp-bridge", "extension.cjs"),
74205
74236
  import_node_path80.default.join(here, "..", "dist", "pi-mcp-bridge", "extension.cjs")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clawos-dev/clawd",
3
- "version": "0.2.545",
3
+ "version": "0.2.547",
4
4
  "description": "Standalone clawd daemon — Claude Code (and future Codex) session server over WebSocket",
5
5
  "type": "module",
6
6
  "license": "MIT",