@clawos-dev/clawd 0.2.396 → 0.2.397

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
@@ -8672,7 +8672,7 @@ var init_methods = __esm({
8672
8672
  args: NO_ARGS
8673
8673
  },
8674
8674
  "persona:get": {
8675
- summary: "\u53D6\u5355\u4E2A persona \u8BE6\u60C5\uFF0C**\u542B personality\uFF08CLAUDE.md \u6B63\u6587\uFF09**\u2014\u2014\u552F\u4E00\u643A\u5E26\u6B63\u6587\u7684 method",
8675
+ summary: "\u53D6\u5355\u4E2A persona \u8BE6\u60C5\uFF0C**\u542B personality\uFF08CLAUDE.md \u6B63\u6587\uFF09**\u2014\u2014\u552F\u4E00\u643A\u5E26\u6B63\u6587\u7684 method\u3002\u54CD\u5E94\u628A PersonaFile \u5E73\u94FA\u5728\u5E27\u4E0A\uFF08\u65E0 persona \u5305\u88F9\u952E\uFF09\uFF1B\u67E5\u4E0D\u5230 / guest \u65E0\u6743\u9650\u629B PERSONA_NOT_FOUND",
8676
8676
  args: PersonaIdArgsSchema
8677
8677
  },
8678
8678
  "persona:update": {
@@ -8971,7 +8971,10 @@ var init_errors2 = __esm({
8971
8971
  CONTACT_NOT_FOUND: "CONTACT_NOT_FOUND",
8972
8972
  // 统一 RPC 鉴权(spec 2026-07-28):personaDispatch:get 查不到台账行,或 guest ctx
8973
8973
  // 查非自己发起的行(越权与未知 id 同码,不泄露存在性)。A 端轮询遇此码立即判失败。
8974
- DISPATCH_NOT_FOUND: "DISPATCH_NOT_FOUND"
8974
+ DISPATCH_NOT_FOUND: "DISPATCH_NOT_FOUND",
8975
+ // persona:get 查不到该 personaId,或 guest ctx 查非 public / 无 read grant 的 persona
8976
+ // (与 DISPATCH_NOT_FOUND 同款:越权与未知 id 同码,不泄露存在性)。
8977
+ PERSONA_NOT_FOUND: "PERSONA_NOT_FOUND"
8975
8978
  };
8976
8979
  ClawdError = class extends Error {
8977
8980
  constructor(code, message) {
@@ -62096,7 +62099,7 @@ function computeMethodAccess(args) {
62096
62099
  }
62097
62100
 
62098
62101
  // src/version.ts
62099
- var version = "0.2.396".length > 0 ? "0.2.396" : "dev";
62102
+ var version = "0.2.397".length > 0 ? "0.2.397" : "dev";
62100
62103
 
62101
62104
  // src/cli-probe/probe.ts
62102
62105
  var fs66 = __toESM(require("fs"), 1);
@@ -62241,16 +62244,18 @@ function buildPersonaHandlers(deps) {
62241
62244
  };
62242
62245
  const get = async (frame, _client, ctx) => {
62243
62246
  const args = parseArgs2(PersonaIdArgsSchema, frame, "persona:get");
62244
- const persona = personaRegistry.get(args.personaId) ?? null;
62247
+ let persona = personaRegistry.get(args.personaId) ?? null;
62245
62248
  if (!persona) {
62246
- return { response: { type: "persona:info", persona: null } };
62249
+ personaRegistry.reload();
62250
+ persona = personaRegistry.get(args.personaId) ?? null;
62247
62251
  }
62248
62252
  const isGuest = ctx?.principal.kind === "guest";
62249
- if (isGuest) {
62250
- const allowed = persona.public && assertGrant(ctx.grants, { type: "persona", id: persona.personaId }, "read");
62251
- if (!allowed) {
62252
- return { response: { type: "persona:info", persona: null } };
62253
- }
62253
+ const denied = isGuest && !(persona?.public && assertGrant(ctx.grants, { type: "persona", id: persona.personaId }, "read"));
62254
+ if (!persona || denied) {
62255
+ throw new ClawdError(
62256
+ ERROR_CODES.PERSONA_NOT_FOUND,
62257
+ `unknown personaId: ${args.personaId}`
62258
+ );
62254
62259
  }
62255
62260
  const personality = personaManager.readPersonality(args.personaId) ?? "";
62256
62261
  const skills = personaManager.listSkills(args.personaId);
@@ -62275,7 +62280,7 @@ function buildPersonaHandlers(deps) {
62275
62280
  return { response: { type: "persona:info", ...persona } };
62276
62281
  };
62277
62282
  const del = async (frame) => {
62278
- const args = parseArgs2(PersonaIdArgsSchema, frame, "persona:get");
62283
+ const args = parseArgs2(PersonaIdArgsSchema, frame, "persona:delete");
62279
62284
  personaManager.delete(args.personaId);
62280
62285
  return {
62281
62286
  response: { type: "persona:deleted", personaId: args.personaId }
@@ -23732,7 +23732,7 @@ var METHOD_DOCS = {
23732
23732
  args: NO_ARGS
23733
23733
  },
23734
23734
  "persona:get": {
23735
- summary: "\u53D6\u5355\u4E2A persona \u8BE6\u60C5\uFF0C**\u542B personality\uFF08CLAUDE.md \u6B63\u6587\uFF09**\u2014\u2014\u552F\u4E00\u643A\u5E26\u6B63\u6587\u7684 method",
23735
+ summary: "\u53D6\u5355\u4E2A persona \u8BE6\u60C5\uFF0C**\u542B personality\uFF08CLAUDE.md \u6B63\u6587\uFF09**\u2014\u2014\u552F\u4E00\u643A\u5E26\u6B63\u6587\u7684 method\u3002\u54CD\u5E94\u628A PersonaFile \u5E73\u94FA\u5728\u5E27\u4E0A\uFF08\u65E0 persona \u5305\u88F9\u952E\uFF09\uFF1B\u67E5\u4E0D\u5230 / guest \u65E0\u6743\u9650\u629B PERSONA_NOT_FOUND",
23736
23736
  args: PersonaIdArgsSchema
23737
23737
  },
23738
23738
  "persona:update": {