@clawos-dev/clawd 0.2.544 → 0.2.545

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();
@@ -62471,7 +62497,9 @@ var GATEWAY_ROUTES = {
62471
62497
  session: (personaId2) => `/p/${encodeURIComponent(personaId2)}/session`,
62472
62498
  sessionSend: (personaId2, sessionId) => `/p/${encodeURIComponent(personaId2)}/session/${encodeURIComponent(sessionId)}`,
62473
62499
  // 历史文件不挂在 persona 下:使用者卷跨 persona 共用(design 2026-09-14-codex-native-memories §3.2f)
62474
- thread: (threadId) => `/threads/${encodeURIComponent(threadId)}`
62500
+ thread: (threadId) => `/threads/${encodeURIComponent(threadId)}`,
62501
+ // 调用方自己那块盘的用量(design 2026-09-19-cloud-volume-usage §3.3):同样按人、不挂 persona
62502
+ volume: () => "/me/volume"
62475
62503
  };
62476
62504
  var trimSlash = (u2) => u2.replace(/\/+$/, "");
62477
62505
  var CloudApiKeyRequiredError = class extends Error {
@@ -62570,6 +62598,20 @@ var CloudGatewayClient = class {
62570
62598
  logger: this.deps.logger
62571
62599
  });
62572
62600
  }
62601
+ /**
62602
+ * 这个人云盘上一轮末的用量(design 2026-09-19-cloud-volume-usage §3.3)。gateway 回 `volume: null` = 还没跑过任务(没有盘)。
62603
+ * 没登录 / 没 key 走 credentials() 的抛法,调用方(cloud:volume:get 的 handler)把它们和网络错一并折成 null——角标不该弹错。
62604
+ */
62605
+ async fetchVolume() {
62606
+ const { apiKey, gatewayUrl } = await this.credentials();
62607
+ const res = await this.fetchImpl(gatewayUrl + GATEWAY_ROUTES.volume(), {
62608
+ headers: { authorization: `Bearer ${apiKey}` }
62609
+ });
62610
+ if (!res.ok) throw new Error(`gateway /me/volume \u56DE ${res.status}`);
62611
+ const body = await res.json();
62612
+ if (body.volume == null) return null;
62613
+ return CloudVolumeUsageSchema.parse(body.volume);
62614
+ }
62573
62615
  /** rollout 原文;404 = 没这条 thread(还没开过第一轮 / 卷被清)→ null */
62574
62616
  async fetchRollout(threadId) {
62575
62617
  const { apiKey, gatewayUrl } = await this.credentials();
@@ -70620,6 +70662,30 @@ function buildCloudConnectorsHandlers(deps) {
70620
70662
  };
70621
70663
  }
70622
70664
 
70665
+ // src/handlers/cloud-volume.ts
70666
+ init_protocol();
70667
+ function ensureOwner7(ctx) {
70668
+ if (!ctx || ctx.principal.kind !== "owner") {
70669
+ throw new ClawdError(ERROR_CODES.UNAUTHORIZED, "UNAUTHORIZED: cloud:volume:get requires owner ctx");
70670
+ }
70671
+ }
70672
+ function buildCloudVolumeHandlers(deps) {
70673
+ const get = async (_frame, _client, ctx) => {
70674
+ ensureOwner7(ctx);
70675
+ let volume = null;
70676
+ if (deps.getLoginPass()) {
70677
+ try {
70678
+ volume = await deps.fetchVolume();
70679
+ } catch (err) {
70680
+ deps.logger?.debug("cloud:volume:get skipped", { reason: err.message });
70681
+ volume = null;
70682
+ }
70683
+ }
70684
+ return { response: { type: "cloud:volume:get:ok", volume } };
70685
+ };
70686
+ return { "cloud:volume:get": get };
70687
+ }
70688
+
70623
70689
  // src/handlers/meta.ts
70624
70690
  var import_node_os23 = __toESM(require("os"), 1);
70625
70691
  init_protocol();
@@ -70679,6 +70745,8 @@ var METHOD_GRANT_MAP = {
70679
70745
  // 拿本机登录凭证向中心代查 / 代填使用者本人的凭据,guest 一律够不着
70680
70746
  "cloud:connectors:list": ADMIN_ANY,
70681
70747
  "cloud:connectors:fill": ADMIN_ANY,
70748
+ // cloud:volume:get(云上会话顶栏的云盘角标;design 2026-09-19-cloud-volume-usage):本机 api key 问 gateway,guest 够不着
70749
+ "cloud:volume:get": ADMIN_ANY,
70682
70750
  // ---- session:* / chat:* 业务方法(v2 Phase 8 两层模型)----
70683
70751
  // dispatcher 不验资源,handler 内按 ctx + frame.args 反查 ownerPersonaId 调 assertGrant。
70684
70752
  // owner 自动通过(ctx 自带 '*':'admin' grant 一切 match);guest 在被授权 persona 内可调。
@@ -70927,7 +70995,7 @@ function computeMethodAccess(args) {
70927
70995
  }
70928
70996
 
70929
70997
  // src/version.ts
70930
- var version = "0.2.544".length > 0 ? "0.2.544" : "dev";
70998
+ var version = "0.2.545".length > 0 ? "0.2.545" : "dev";
70931
70999
 
70932
71000
  // src/cli-probe/probe.ts
70933
71001
  var fs78 = __toESM(require("fs"), 1);
@@ -72586,7 +72654,7 @@ function buildGithubHandlers(deps) {
72586
72654
 
72587
72655
  // src/handlers/visitor.ts
72588
72656
  init_protocol();
72589
- function ensureOwner7(ctx) {
72657
+ function ensureOwner8(ctx) {
72590
72658
  if (!ctx || ctx.principal.kind !== "owner") {
72591
72659
  throw new ClawdError(
72592
72660
  ERROR_CODES.UNAUTHORIZED,
@@ -72596,7 +72664,7 @@ function ensureOwner7(ctx) {
72596
72664
  }
72597
72665
  function buildVisitorHandlers(deps) {
72598
72666
  const list = async (_frame, _client, ctx) => {
72599
- ensureOwner7(ctx);
72667
+ ensureOwner8(ctx);
72600
72668
  return {
72601
72669
  response: {
72602
72670
  type: "visitor:list",
@@ -72882,6 +72950,7 @@ function buildMethodHandlers(deps) {
72882
72950
  ...buildFeishuAuthHandlers(deps.feishuAuth),
72883
72951
  ...buildDeviceHandlers(deps.feishuDevice),
72884
72952
  ...buildCloudConnectorsHandlers(deps.cloudConnectors),
72953
+ ...buildCloudVolumeHandlers(deps.cloudVolume),
72885
72954
  ...deps.attachment ? buildAttachmentHandlers(deps.attachment) : {},
72886
72955
  ...buildExtensionHandlers({
72887
72956
  loadAll,
@@ -74523,6 +74592,12 @@ async function startDaemon(config) {
74523
74592
  fill: (args) => centralConnectorFill({ api: config.clawosApi ?? DEFAULT_CLAWOS_API, ...args })
74524
74593
  }
74525
74594
  },
74595
+ // 云盘角标(design 2026-09-19-cloud-volume-usage):拿不到一律 null,handler 自己折
74596
+ cloudVolume: {
74597
+ getLoginPass: () => ownerIdentityStore.read()?.loginPass ?? null,
74598
+ fetchVolume: () => cloudGateway.fetchVolume(),
74599
+ logger
74600
+ },
74526
74601
  // 设备目录 + 连接(决策 #15:daemon 代理中心 server)。
74527
74602
  // exchange/listDevices 包掉本机登录票(每次现读 store——热切换后立即用新身份);
74528
74603
  // 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);