@clawos-dev/clawd 0.2.241 → 0.2.243

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 CHANGED
@@ -5330,7 +5330,19 @@ var init_schemas = __esm({
5330
5330
  * selfUrl 保留:它只是"可达地址"(auto-reverse 反向连接用),不是身份——填错只影响
5331
5331
  * 反向连通性,不构成伪造风险,且 url 不在 token 里(token 只签身份不签地址)。
5332
5332
  */
5333
- selfUrl: external_exports.string().min(1).optional()
5333
+ selfUrl: external_exports.string().min(1).optional(),
5334
+ /**
5335
+ * 客户端自报的 user-agent 性质标签(诊断/展示用)。
5336
+ * 同 selfUrl 性质的「自报事实」,非身份(决策 #16 边界):不参与鉴权、不参与路由、
5337
+ * 任何 handler 不得据此做权限判断。name 约定命名('clawd-desktop' / 'clawd-web' /
5338
+ * 'clawd-mobile-android' / ...),宽容未知值(将来加新客户端不动 schema)。
5339
+ * instanceId:客户端首启生成 UUID 并本地持久化——区分同种类多实例(多手机/多 desktop 同连)。
5340
+ */
5341
+ clientInfo: external_exports.object({
5342
+ name: external_exports.string().min(1),
5343
+ version: external_exports.string().min(1),
5344
+ instanceId: external_exports.string().min(1)
5345
+ }).optional()
5334
5346
  });
5335
5347
  AuthOkFrameSchema = external_exports.object({
5336
5348
  type: external_exports.literal("auth:ok"),
@@ -46143,7 +46155,7 @@ function tryLoadViewerAssets(logger) {
46143
46155
  }
46144
46156
  logger?.warn("share-md-viewer.assets-not-found", {
46145
46157
  candidates,
46146
- hint: "run `pnpm -F @clawos/ext-clawd-ui build && pnpm -F @clawos-dev/clawd build`"
46158
+ hint: "run `pnpm -F @clawos/clawd-ui build && pnpm -F @clawos-dev/clawd build`"
46147
46159
  });
46148
46160
  return null;
46149
46161
  }
@@ -46216,7 +46228,7 @@ function tryLoadShareUi(logger) {
46216
46228
  }
46217
46229
  logger?.warn("share-ui.assets-not-found", {
46218
46230
  candidates,
46219
- hint: "run `pnpm -F @clawos/ext-clawd-ui build && pnpm -F @clawos-dev/clawd build`"
46231
+ hint: "run `pnpm -F @clawos/clawd-ui build && pnpm -F @clawos-dev/clawd build`"
46220
46232
  });
46221
46233
  return null;
46222
46234
  }
@@ -50120,6 +50132,16 @@ var LocalWsServer = class {
50120
50132
  const c = this.clients.get(clientId);
50121
50133
  if (!c) return;
50122
50134
  c.ctx = ctx;
50135
+ if (ctx.clientInfo) {
50136
+ this.logger?.info("client authed", {
50137
+ clientId,
50138
+ principalId: ctx.principal.id,
50139
+ principalKind: ctx.principal.kind,
50140
+ clientName: ctx.clientInfo.name,
50141
+ clientVersion: ctx.clientInfo.version,
50142
+ clientInstanceId: ctx.clientInfo.instanceId
50143
+ });
50144
+ }
50123
50145
  if (ctx.principal.kind === "guest") {
50124
50146
  let set = this.guestIdToClients.get(ctx.principal.id);
50125
50147
  if (!set) {
@@ -50492,6 +50514,9 @@ var AuthGate = class {
50492
50514
  }
50493
50515
  ctx = this.opts.buildOwnerContext?.() ?? null;
50494
50516
  }
50517
+ if (ctx && parsed.data.clientInfo) {
50518
+ ctx = { ...ctx, clientInfo: parsed.data.clientInfo };
50519
+ }
50495
50520
  if (st.timer != null) {
50496
50521
  const clear = this.opts.clearTimer ?? ((h) => clearTimeout(h));
50497
50522
  clear(st.timer);
@@ -40380,7 +40380,19 @@ var AuthRequestFrameSchema = external_exports.object({
40380
40380
  * selfUrl 保留:它只是"可达地址"(auto-reverse 反向连接用),不是身份——填错只影响
40381
40381
  * 反向连通性,不构成伪造风险,且 url 不在 token 里(token 只签身份不签地址)。
40382
40382
  */
40383
- selfUrl: external_exports.string().min(1).optional()
40383
+ selfUrl: external_exports.string().min(1).optional(),
40384
+ /**
40385
+ * 客户端自报的 user-agent 性质标签(诊断/展示用)。
40386
+ * 同 selfUrl 性质的「自报事实」,非身份(决策 #16 边界):不参与鉴权、不参与路由、
40387
+ * 任何 handler 不得据此做权限判断。name 约定命名('clawd-desktop' / 'clawd-web' /
40388
+ * 'clawd-mobile-android' / ...),宽容未知值(将来加新客户端不动 schema)。
40389
+ * instanceId:客户端首启生成 UUID 并本地持久化——区分同种类多实例(多手机/多 desktop 同连)。
40390
+ */
40391
+ clientInfo: external_exports.object({
40392
+ name: external_exports.string().min(1),
40393
+ version: external_exports.string().min(1),
40394
+ instanceId: external_exports.string().min(1)
40395
+ }).optional()
40384
40396
  });
40385
40397
  var AuthOkFrameSchema = external_exports.object({
40386
40398
  type: external_exports.literal("auth:ok"),
@@ -92,7 +92,7 @@ clawd 的 OwnerProfile 是 `~/.clawd/profile.json`,schema v1 只有一个字
92
92
  - **拿不准就查**:涉及 clawd 之外的通用知识、第三方库、最新文档时,主动用 WebFetch / context7 / 读源码去查,不要猜
93
93
  - **不猜**:宁可说"我去查一下",也不要编造功能、命令、配置项
94
94
  - **描述 UI 操作步骤时严格区分两层**(对照上面「概念地图」):
95
- - **clawd Extension 内部的 UI**(Personas 区、Session 列表、新建 persona 弹窗、设置抽屉等)—— 代码在 `<clawos>/clawd/ext-clawd/ui/`,**必须读源码确认**按钮位置 / 字段 / 流程后再回答,不要凭印象
95
+ - **clawd 应用内部的 UI**(Personas 区、Session 列表、新建 persona 弹窗、设置抽屉等)—— 代码在 `<clawos>/clawd/ui/`,**必须读源码确认**按钮位置 / 字段 / 流程后再回答,不要凭印象
96
96
  - **ClawOS host 端的 UI**(怎么打开 clawd Extension、Extension 管理、桌面壳本身的入口)—— 本地仓库**没有** host 端代码,不能凭印象编。这部分要么明说"我不确定 ClawOS host 当前 UI 长什么样",要么请老板告诉我入口在哪
97
97
 
98
98
  ## 回答风格