@clawos-dev/clawd 0.2.544 → 0.2.546

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.
@@ -24201,6 +24201,11 @@ var METHOD_DOCS = {
24201
24201
  summary: "\u586B\u5199\u578B\u8FDE\u63A5\u5668\uFF1A\u628A\u4F7F\u7528\u8005\u672C\u4EBA\u7684\u51ED\u636E\u503C\u4EA4\u7ED9\u4E2D\u5FC3\u52A0\u5BC6\u5165\u5E93\uFF08\u4E00\u6B21\u586B\u5199\u5168\u5C40\u5171\u7528\uFF09\u3002**\u8FD9\u662F\u503C\u552F\u4E00\u7684\u5165\u53E3**\uFF1A\u5165\u53C2\u4E0D\u8FDB\u65E5\u5FD7\u3001\u54CD\u5E94\u4E0D\u56DE\u663E\u3001\u672C\u673A\u4E0D\u843D\u76D8\uFF1B\u683C\u540D\u5FC5\u987B\u662F\u8BE5\u8FDE\u63A5\u5668\u58F0\u660E\u8FC7\u7684\uFF1Bowner-only",
24202
24202
  args: CloudConnectorFillArgsSchema
24203
24203
  },
24204
+ // ---- cloud:volume:get(云上会话聊天页顶栏的云盘角标;design 2026-09-19-cloud-volume-usage §3.3)----
24205
+ "cloud:volume:get": {
24206
+ summary: "\u8C03\u7528\u65B9\u81EA\u5DF1\u90A3\u5757\u4E91\u76D8\u4E0A\u4E00\u8F6E\u672B\u7684\u7528\u91CF\uFF08usedBytes / sizeBytes / measuredAt\uFF09\u3002\u6309\u4EBA\u4E0D\u6309 persona\uFF1A\u4E91\u4E0A\u6240\u6709 persona \u5171\u7528\u4E00\u5757\u76D8\u3002daemon \u62FF\u672C\u673A api key \u95EE gateway /me/volume\uFF1B\u6CA1\u767B\u5F55 / \u6CA1 key / gateway \u4E0D\u901A / \u6CA1\u8DD1\u8FC7\u4EFB\u52A1\u4E00\u5F8B\u56DE volume:null\uFF08\u89D2\u6807\u4E0D\u6E32\uFF09\uFF0C\u4E0D\u629B\uFF1Bowner-only\u3002\u65E0\u53C2\u6570\uFF08\u67E5\u7684\u662F\u8C03\u7528\u65B9\u81EA\u5DF1\u7684\u76D8\uFF09",
24207
+ args: NO_ARGS
24208
+ },
24204
24209
  "shift:list": {
24205
24210
  summary: "\u5217\u51FA owner \u7684\u5168\u90E8 shift\uFF08\u6392\u73ED\uFF09\uFF0C\u7ED9 UI \u65E5\u5386\u6E32\u67D3\u7528\uFF1Bowner-only",
24206
24211
  args: NO_ARGS
@@ -24645,6 +24650,19 @@ var MetaMethodsResultSchema = external_exports.object({
24645
24650
  methods: external_exports.array(RpcMethodInfoSchema)
24646
24651
  });
24647
24652
 
24653
+ // ../protocol/src/cloud-volume-schemas.ts
24654
+ var CloudVolumeUsageSchema = external_exports.object({
24655
+ /** 已用字节(df 的 Used 列) */
24656
+ usedBytes: external_exports.number().int().nonnegative(),
24657
+ /** 盘的总字节(df 的 1B-blocks 列;ext4 预留之后比 PVC 的 5Gi 略小) */
24658
+ sizeBytes: external_exports.number().int().positive(),
24659
+ /** 量的时刻(ms)= 上一轮结束时 */
24660
+ measuredAt: external_exports.number().int().nonnegative()
24661
+ }).strict();
24662
+ var CloudVolumeGetResultSchema = external_exports.object({
24663
+ volume: CloudVolumeUsageSchema.nullable()
24664
+ }).strict();
24665
+
24648
24666
  // ../protocol/src/log.ts
24649
24667
  var LOG_SOURCES = ["daemon", "main", "renderer"];
24650
24668
  var LogSourceSchema = external_exports.enum(LOG_SOURCES);
package/dist/cli.cjs CHANGED
@@ -9028,6 +9028,11 @@ var init_methods = __esm({
9028
9028
  summary: "\u586B\u5199\u578B\u8FDE\u63A5\u5668\uFF1A\u628A\u4F7F\u7528\u8005\u672C\u4EBA\u7684\u51ED\u636E\u503C\u4EA4\u7ED9\u4E2D\u5FC3\u52A0\u5BC6\u5165\u5E93\uFF08\u4E00\u6B21\u586B\u5199\u5168\u5C40\u5171\u7528\uFF09\u3002**\u8FD9\u662F\u503C\u552F\u4E00\u7684\u5165\u53E3**\uFF1A\u5165\u53C2\u4E0D\u8FDB\u65E5\u5FD7\u3001\u54CD\u5E94\u4E0D\u56DE\u663E\u3001\u672C\u673A\u4E0D\u843D\u76D8\uFF1B\u683C\u540D\u5FC5\u987B\u662F\u8BE5\u8FDE\u63A5\u5668\u58F0\u660E\u8FC7\u7684\uFF1Bowner-only",
9029
9029
  args: CloudConnectorFillArgsSchema
9030
9030
  },
9031
+ // ---- cloud:volume:get(云上会话聊天页顶栏的云盘角标;design 2026-09-19-cloud-volume-usage §3.3)----
9032
+ "cloud:volume:get": {
9033
+ summary: "\u8C03\u7528\u65B9\u81EA\u5DF1\u90A3\u5757\u4E91\u76D8\u4E0A\u4E00\u8F6E\u672B\u7684\u7528\u91CF\uFF08usedBytes / sizeBytes / measuredAt\uFF09\u3002\u6309\u4EBA\u4E0D\u6309 persona\uFF1A\u4E91\u4E0A\u6240\u6709 persona \u5171\u7528\u4E00\u5757\u76D8\u3002daemon \u62FF\u672C\u673A api key \u95EE gateway /me/volume\uFF1B\u6CA1\u767B\u5F55 / \u6CA1 key / gateway \u4E0D\u901A / \u6CA1\u8DD1\u8FC7\u4EFB\u52A1\u4E00\u5F8B\u56DE volume:null\uFF08\u89D2\u6807\u4E0D\u6E32\uFF09\uFF0C\u4E0D\u629B\uFF1Bowner-only\u3002\u65E0\u53C2\u6570\uFF08\u67E5\u7684\u662F\u8C03\u7528\u65B9\u81EA\u5DF1\u7684\u76D8\uFF09",
9034
+ args: NO_ARGS
9035
+ },
9031
9036
  "shift:list": {
9032
9037
  summary: "\u5217\u51FA owner \u7684\u5168\u90E8 shift\uFF08\u6392\u73ED\uFF09\uFF0C\u7ED9 UI \u65E5\u5386\u6E32\u67D3\u7528\uFF1Bowner-only",
9033
9038
  args: NO_ARGS
@@ -9534,6 +9539,26 @@ var init_frames = __esm({
9534
9539
  }
9535
9540
  });
9536
9541
 
9542
+ // ../protocol/src/cloud-volume-schemas.ts
9543
+ var CloudVolumeUsageSchema, CloudVolumeGetResultSchema;
9544
+ var init_cloud_volume_schemas = __esm({
9545
+ "../protocol/src/cloud-volume-schemas.ts"() {
9546
+ "use strict";
9547
+ init_zod();
9548
+ CloudVolumeUsageSchema = external_exports.object({
9549
+ /** 已用字节(df 的 Used 列) */
9550
+ usedBytes: external_exports.number().int().nonnegative(),
9551
+ /** 盘的总字节(df 的 1B-blocks 列;ext4 预留之后比 PVC 的 5Gi 略小) */
9552
+ sizeBytes: external_exports.number().int().positive(),
9553
+ /** 量的时刻(ms)= 上一轮结束时 */
9554
+ measuredAt: external_exports.number().int().nonnegative()
9555
+ }).strict();
9556
+ CloudVolumeGetResultSchema = external_exports.object({
9557
+ volume: CloudVolumeUsageSchema.nullable()
9558
+ }).strict();
9559
+ }
9560
+ });
9561
+
9537
9562
  // ../protocol/src/persona-mode.ts
9538
9563
  var init_persona_mode = __esm({
9539
9564
  "../protocol/src/persona-mode.ts"() {
@@ -9705,6 +9730,7 @@ var init_runtime = __esm({
9705
9730
  init_frames();
9706
9731
  init_environment_schemas();
9707
9732
  init_cloud_connector_schemas();
9733
+ init_cloud_volume_schemas();
9708
9734
  init_deploy_schemas();
9709
9735
  init_github_auth_schemas();
9710
9736
  init_persona_schemas();
@@ -45613,7 +45639,9 @@ function cloneState(s2) {
45613
45639
  currentTurnSender: s2.currentTurnSender
45614
45640
  };
45615
45641
  }
45642
+ var CLOUD_IDLE_KILL_DELAY_MS = 5 * 6e4;
45616
45643
  function idleKillDelayOf(state) {
45644
+ if (state.file.tool === CODEX_CLOUD_TOOL_ID) return CLOUD_IDLE_KILL_DELAY_MS;
45617
45645
  const ms = state.subSessionMeta?.idleKillDelayMs;
45618
45646
  return ms !== void 0 && ms > 0 ? ms : void 0;
45619
45647
  }
@@ -46056,7 +46084,7 @@ function pushEventToBufferInPlace(next, event, deps) {
46056
46084
  if (canCloseStdin) {
46057
46085
  next.stdinClosed = true;
46058
46086
  effects.push({ kind: "close-stdin" });
46059
- } else if (isRpcAgentTool(tool)) {
46087
+ } else if (isRpcAgentTool(tool) && tool !== CODEX_CLOUD_TOOL_ID) {
46060
46088
  if (tool === PI_TOOL_ID) next.stdinClosed = true;
46061
46089
  effects.push({ kind: "kill", signal: "SIGTERM" });
46062
46090
  } else {
@@ -62471,7 +62499,9 @@ var GATEWAY_ROUTES = {
62471
62499
  session: (personaId2) => `/p/${encodeURIComponent(personaId2)}/session`,
62472
62500
  sessionSend: (personaId2, sessionId) => `/p/${encodeURIComponent(personaId2)}/session/${encodeURIComponent(sessionId)}`,
62473
62501
  // 历史文件不挂在 persona 下:使用者卷跨 persona 共用(design 2026-09-14-codex-native-memories §3.2f)
62474
- thread: (threadId) => `/threads/${encodeURIComponent(threadId)}`
62502
+ thread: (threadId) => `/threads/${encodeURIComponent(threadId)}`,
62503
+ // 调用方自己那块盘的用量(design 2026-09-19-cloud-volume-usage §3.3):同样按人、不挂 persona
62504
+ volume: () => "/me/volume"
62475
62505
  };
62476
62506
  var trimSlash = (u2) => u2.replace(/\/+$/, "");
62477
62507
  var CloudApiKeyRequiredError = class extends Error {
@@ -62570,6 +62600,20 @@ var CloudGatewayClient = class {
62570
62600
  logger: this.deps.logger
62571
62601
  });
62572
62602
  }
62603
+ /**
62604
+ * 这个人云盘上一轮末的用量(design 2026-09-19-cloud-volume-usage §3.3)。gateway 回 `volume: null` = 还没跑过任务(没有盘)。
62605
+ * 没登录 / 没 key 走 credentials() 的抛法,调用方(cloud:volume:get 的 handler)把它们和网络错一并折成 null——角标不该弹错。
62606
+ */
62607
+ async fetchVolume() {
62608
+ const { apiKey, gatewayUrl } = await this.credentials();
62609
+ const res = await this.fetchImpl(gatewayUrl + GATEWAY_ROUTES.volume(), {
62610
+ headers: { authorization: `Bearer ${apiKey}` }
62611
+ });
62612
+ if (!res.ok) throw new Error(`gateway /me/volume \u56DE ${res.status}`);
62613
+ const body = await res.json();
62614
+ if (body.volume == null) return null;
62615
+ return CloudVolumeUsageSchema.parse(body.volume);
62616
+ }
62573
62617
  /** rollout 原文;404 = 没这条 thread(还没开过第一轮 / 卷被清)→ null */
62574
62618
  async fetchRollout(threadId) {
62575
62619
  const { apiKey, gatewayUrl } = await this.credentials();
@@ -70620,6 +70664,30 @@ function buildCloudConnectorsHandlers(deps) {
70620
70664
  };
70621
70665
  }
70622
70666
 
70667
+ // src/handlers/cloud-volume.ts
70668
+ init_protocol();
70669
+ function ensureOwner7(ctx) {
70670
+ if (!ctx || ctx.principal.kind !== "owner") {
70671
+ throw new ClawdError(ERROR_CODES.UNAUTHORIZED, "UNAUTHORIZED: cloud:volume:get requires owner ctx");
70672
+ }
70673
+ }
70674
+ function buildCloudVolumeHandlers(deps) {
70675
+ const get = async (_frame, _client, ctx) => {
70676
+ ensureOwner7(ctx);
70677
+ let volume = null;
70678
+ if (deps.getLoginPass()) {
70679
+ try {
70680
+ volume = await deps.fetchVolume();
70681
+ } catch (err) {
70682
+ deps.logger?.debug("cloud:volume:get skipped", { reason: err.message });
70683
+ volume = null;
70684
+ }
70685
+ }
70686
+ return { response: { type: "cloud:volume:get:ok", volume } };
70687
+ };
70688
+ return { "cloud:volume:get": get };
70689
+ }
70690
+
70623
70691
  // src/handlers/meta.ts
70624
70692
  var import_node_os23 = __toESM(require("os"), 1);
70625
70693
  init_protocol();
@@ -70679,6 +70747,8 @@ var METHOD_GRANT_MAP = {
70679
70747
  // 拿本机登录凭证向中心代查 / 代填使用者本人的凭据,guest 一律够不着
70680
70748
  "cloud:connectors:list": ADMIN_ANY,
70681
70749
  "cloud:connectors:fill": ADMIN_ANY,
70750
+ // cloud:volume:get(云上会话顶栏的云盘角标;design 2026-09-19-cloud-volume-usage):本机 api key 问 gateway,guest 够不着
70751
+ "cloud:volume:get": ADMIN_ANY,
70682
70752
  // ---- session:* / chat:* 业务方法(v2 Phase 8 两层模型)----
70683
70753
  // dispatcher 不验资源,handler 内按 ctx + frame.args 反查 ownerPersonaId 调 assertGrant。
70684
70754
  // owner 自动通过(ctx 自带 '*':'admin' grant 一切 match);guest 在被授权 persona 内可调。
@@ -70927,7 +70997,7 @@ function computeMethodAccess(args) {
70927
70997
  }
70928
70998
 
70929
70999
  // src/version.ts
70930
- var version = "0.2.544".length > 0 ? "0.2.544" : "dev";
71000
+ var version = "0.2.546".length > 0 ? "0.2.546" : "dev";
70931
71001
 
70932
71002
  // src/cli-probe/probe.ts
70933
71003
  var fs78 = __toESM(require("fs"), 1);
@@ -72586,7 +72656,7 @@ function buildGithubHandlers(deps) {
72586
72656
 
72587
72657
  // src/handlers/visitor.ts
72588
72658
  init_protocol();
72589
- function ensureOwner7(ctx) {
72659
+ function ensureOwner8(ctx) {
72590
72660
  if (!ctx || ctx.principal.kind !== "owner") {
72591
72661
  throw new ClawdError(
72592
72662
  ERROR_CODES.UNAUTHORIZED,
@@ -72596,7 +72666,7 @@ function ensureOwner7(ctx) {
72596
72666
  }
72597
72667
  function buildVisitorHandlers(deps) {
72598
72668
  const list = async (_frame, _client, ctx) => {
72599
- ensureOwner7(ctx);
72669
+ ensureOwner8(ctx);
72600
72670
  return {
72601
72671
  response: {
72602
72672
  type: "visitor:list",
@@ -72882,6 +72952,7 @@ function buildMethodHandlers(deps) {
72882
72952
  ...buildFeishuAuthHandlers(deps.feishuAuth),
72883
72953
  ...buildDeviceHandlers(deps.feishuDevice),
72884
72954
  ...buildCloudConnectorsHandlers(deps.cloudConnectors),
72955
+ ...buildCloudVolumeHandlers(deps.cloudVolume),
72885
72956
  ...deps.attachment ? buildAttachmentHandlers(deps.attachment) : {},
72886
72957
  ...buildExtensionHandlers({
72887
72958
  loadAll,
@@ -74523,6 +74594,12 @@ async function startDaemon(config) {
74523
74594
  fill: (args) => centralConnectorFill({ api: config.clawosApi ?? DEFAULT_CLAWOS_API, ...args })
74524
74595
  }
74525
74596
  },
74597
+ // 云盘角标(design 2026-09-19-cloud-volume-usage):拿不到一律 null,handler 自己折
74598
+ cloudVolume: {
74599
+ getLoginPass: () => ownerIdentityStore.read()?.loginPass ?? null,
74600
+ fetchVolume: () => cloudGateway.fetchVolume(),
74601
+ logger
74602
+ },
74526
74603
  // 设备目录 + 连接(决策 #15:daemon 代理中心 server)。
74527
74604
  // exchange/listDevices 包掉本机登录票(每次现读 store——热切换后立即用新身份);
74528
74605
  // dispatcher 的 FEISHU_GATED_METHODS gate 已保证未登录时这些 RPC 到不了 handler,
@@ -24016,6 +24016,11 @@ var METHOD_DOCS = {
24016
24016
  summary: "\u586B\u5199\u578B\u8FDE\u63A5\u5668\uFF1A\u628A\u4F7F\u7528\u8005\u672C\u4EBA\u7684\u51ED\u636E\u503C\u4EA4\u7ED9\u4E2D\u5FC3\u52A0\u5BC6\u5165\u5E93\uFF08\u4E00\u6B21\u586B\u5199\u5168\u5C40\u5171\u7528\uFF09\u3002**\u8FD9\u662F\u503C\u552F\u4E00\u7684\u5165\u53E3**\uFF1A\u5165\u53C2\u4E0D\u8FDB\u65E5\u5FD7\u3001\u54CD\u5E94\u4E0D\u56DE\u663E\u3001\u672C\u673A\u4E0D\u843D\u76D8\uFF1B\u683C\u540D\u5FC5\u987B\u662F\u8BE5\u8FDE\u63A5\u5668\u58F0\u660E\u8FC7\u7684\uFF1Bowner-only",
24017
24017
  args: CloudConnectorFillArgsSchema
24018
24018
  },
24019
+ // ---- cloud:volume:get(云上会话聊天页顶栏的云盘角标;design 2026-09-19-cloud-volume-usage §3.3)----
24020
+ "cloud:volume:get": {
24021
+ summary: "\u8C03\u7528\u65B9\u81EA\u5DF1\u90A3\u5757\u4E91\u76D8\u4E0A\u4E00\u8F6E\u672B\u7684\u7528\u91CF\uFF08usedBytes / sizeBytes / measuredAt\uFF09\u3002\u6309\u4EBA\u4E0D\u6309 persona\uFF1A\u4E91\u4E0A\u6240\u6709 persona \u5171\u7528\u4E00\u5757\u76D8\u3002daemon \u62FF\u672C\u673A api key \u95EE gateway /me/volume\uFF1B\u6CA1\u767B\u5F55 / \u6CA1 key / gateway \u4E0D\u901A / \u6CA1\u8DD1\u8FC7\u4EFB\u52A1\u4E00\u5F8B\u56DE volume:null\uFF08\u89D2\u6807\u4E0D\u6E32\uFF09\uFF0C\u4E0D\u629B\uFF1Bowner-only\u3002\u65E0\u53C2\u6570\uFF08\u67E5\u7684\u662F\u8C03\u7528\u65B9\u81EA\u5DF1\u7684\u76D8\uFF09",
24022
+ args: NO_ARGS
24023
+ },
24019
24024
  "shift:list": {
24020
24025
  summary: "\u5217\u51FA owner \u7684\u5168\u90E8 shift\uFF08\u6392\u73ED\uFF09\uFF0C\u7ED9 UI \u65E5\u5386\u6E32\u67D3\u7528\uFF1Bowner-only",
24021
24026
  args: NO_ARGS
@@ -24460,6 +24465,19 @@ var MetaMethodsResultSchema = external_exports.object({
24460
24465
  methods: external_exports.array(RpcMethodInfoSchema)
24461
24466
  });
24462
24467
 
24468
+ // ../protocol/src/cloud-volume-schemas.ts
24469
+ var CloudVolumeUsageSchema = external_exports.object({
24470
+ /** 已用字节(df 的 Used 列) */
24471
+ usedBytes: external_exports.number().int().nonnegative(),
24472
+ /** 盘的总字节(df 的 1B-blocks 列;ext4 预留之后比 PVC 的 5Gi 略小) */
24473
+ sizeBytes: external_exports.number().int().positive(),
24474
+ /** 量的时刻(ms)= 上一轮结束时 */
24475
+ measuredAt: external_exports.number().int().nonnegative()
24476
+ }).strict();
24477
+ var CloudVolumeGetResultSchema = external_exports.object({
24478
+ volume: CloudVolumeUsageSchema.nullable()
24479
+ }).strict();
24480
+
24463
24481
  // ../protocol/src/log.ts
24464
24482
  var LOG_SOURCES = ["daemon", "main", "renderer"];
24465
24483
  var LogSourceSchema = external_exports.enum(LOG_SOURCES);