@clawos-dev/clawd 0.2.391 → 0.2.393

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
@@ -6654,7 +6654,7 @@ var init_channel = __esm({
6654
6654
  });
6655
6655
 
6656
6656
  // ../protocol/src/topic.ts
6657
- var nonBlank2, TOPIC_STATES, TopicStateSchema, TopicActivityEntrySchema, TopicLineMetaSchema, TopicSchema, TopicLineViewSchema, TopicListArgsSchema, TopicGetArgsSchema, TopicCreateArgsSchema, TopicSetPlanArgsSchema, TopicAppendArgsSchema, TopicRejectArgsSchema, TopicAcceptArgsSchema, TopicCloseArgsSchema, TopicListItemSchema, TopicListResultSchema, TopicGetResultSchema, TopicCreateResultSchema, TopicRejectResultSchema, TopicAcceptResultSchema, TopicResultSchema;
6657
+ var nonBlank2, TOPIC_STATES, TopicStateSchema, TopicActivityEntrySchema, TopicLineMetaSchema, TopicSchema, TopicLineViewSchema, TopicListArgsSchema, TopicGetArgsSchema, TopicCreateArgsSchema, TopicSetPlanArgsSchema, TopicAppendArgsSchema, TopicRejectArgsSchema, TopicAcceptArgsSchema, TopicCloseArgsSchema, TopicRenameArgsSchema, TopicDeleteArgsSchema, TopicListItemSchema, TopicListResultSchema, TopicGetResultSchema, TopicCreateResultSchema, TopicRejectResultSchema, TopicAcceptResultSchema, TopicResultSchema, TopicDeleteResultSchema;
6658
6658
  var init_topic = __esm({
6659
6659
  "../protocol/src/topic.ts"() {
6660
6660
  "use strict";
@@ -6771,6 +6771,11 @@ var init_topic = __esm({
6771
6771
  topicId: external_exports.string().min(1),
6772
6772
  state: external_exports.enum(["done", "archived"])
6773
6773
  });
6774
+ TopicRenameArgsSchema = external_exports.object({
6775
+ topicId: external_exports.string().min(1),
6776
+ title: nonBlank2
6777
+ });
6778
+ TopicDeleteArgsSchema = external_exports.object({ topicId: external_exports.string().min(1) });
6774
6779
  TopicListItemSchema = TopicSchema.extend({
6775
6780
  lineCount: external_exports.number().int().min(0)
6776
6781
  });
@@ -6802,6 +6807,10 @@ var init_topic = __esm({
6802
6807
  needsOwnerAttention: external_exports.boolean()
6803
6808
  });
6804
6809
  TopicResultSchema = external_exports.object({ topic: TopicSchema });
6810
+ TopicDeleteResultSchema = external_exports.object({
6811
+ ok: external_exports.literal(true),
6812
+ removedMasterSessionId: external_exports.string().min(1).nullable()
6813
+ });
6805
6814
  }
6806
6815
  });
6807
6816
 
@@ -8509,6 +8518,14 @@ var init_methods = __esm({
8509
8518
  summary: "\u6536\u655B\u8BDD\u9898\uFF1Astate \u7F6E done / archived",
8510
8519
  args: TopicCloseArgsSchema
8511
8520
  },
8521
+ "topic:rename": {
8522
+ summary: "\u53EA\u6539\u8BDD\u9898\u6807\u9898\uFF08title \u975E\u7A7A\uFF09\uFF0C\u4E0D\u78B0\u4E09\u8981\u7D20\u4E0E\u72B6\u6001\u3002\u6539\u8FC7\u540D\u7684\u8BDD\u9898\u663E\u793A\u540D\u4EE5\u5B83\u4E3A\u51C6\uFF0C\u4E0D\u518D\u56DE\u843D Master session \u7684 AI \u540D",
8523
+ args: TopicRenameArgsSchema
8524
+ },
8525
+ "topic:delete": {
8526
+ summary: "\u5220\u8BDD\u9898\uFF1A\u8FDE\u5E26\u5220\u5B83\u7684 Master session\uFF081:1\uFF09\uFF0C\u8BE5\u8BDD\u9898\u6D3E\u51FA\u53BB\u7684 worker session \u4FDD\u7559\u3002Master session \u5DF2\u4E0D\u5728\u65F6\u8BDD\u9898\u7167\u5220\uFF0CremovedMasterSessionId \u56DE null",
8527
+ args: TopicDeleteArgsSchema
8528
+ },
8512
8529
  // ---- master:*(授权查表,Master 经 clawd-rpc 桥调)----
8513
8530
  "master:authorityCheck": {
8514
8531
  summary: "\u67E5 Master \u7684\u6388\u6743\u8BBE\u5B9A\uFF08\u5168\u5C40\u4E00\u5957\uFF09\uFF1A\u8FD4\u56DE ask / allow / deny\u3002\u8868\u7F3A\u5931\u3001\u8BFB\u574F\u3001\u7ED3\u6784\u4E0D\u5BF9\u3001action \u62FC\u9519\u3001id \u672A\u767B\u8BB0\uFF0C\u4E00\u5F8B\u88C1\u51B3 ask",
@@ -52759,6 +52776,14 @@ function createTopicStore(deps) {
52759
52776
  file.scheduleFlush();
52760
52777
  return t;
52761
52778
  },
52779
+ rename(topicId, title) {
52780
+ const t = get(topicId);
52781
+ if (!t) return void 0;
52782
+ t.title = title;
52783
+ touch(t);
52784
+ file.scheduleFlush();
52785
+ return t;
52786
+ },
52762
52787
  appendActivity(topicId, entry) {
52763
52788
  const t = get(topicId);
52764
52789
  if (!t) return void 0;
@@ -52817,6 +52842,14 @@ function createTopicStore(deps) {
52817
52842
  }
52818
52843
  if (removed) file.scheduleFlush();
52819
52844
  return removed;
52845
+ },
52846
+ remove(topicId) {
52847
+ const items = file.all();
52848
+ const i = items.findIndex((t) => t.id === topicId);
52849
+ if (i < 0) return false;
52850
+ items.splice(i, 1);
52851
+ file.scheduleFlush();
52852
+ return true;
52820
52853
  }
52821
52854
  };
52822
52855
  }
@@ -61711,6 +61744,8 @@ var METHOD_GRANT_MAP = {
61711
61744
  "topic:reject": ADMIN_ANY,
61712
61745
  "topic:accept": ADMIN_ANY,
61713
61746
  "topic:close": ADMIN_ANY,
61747
+ "topic:rename": ADMIN_ANY,
61748
+ "topic:delete": ADMIN_ANY,
61714
61749
  "master:authorityCheck": ADMIN_ANY,
61715
61750
  // project:*(sidebar 项目分区,spec 2026-08-17):registry 是 owner 本机资源,owner-only 一刀切
61716
61751
  "project:list": ADMIN_ANY,
@@ -61877,7 +61912,7 @@ function computeMethodAccess(args) {
61877
61912
  }
61878
61913
 
61879
61914
  // src/version.ts
61880
- var version = "0.2.391".length > 0 ? "0.2.391" : "dev";
61915
+ var version = "0.2.393".length > 0 ? "0.2.393" : "dev";
61881
61916
 
61882
61917
  // src/cli-probe/probe.ts
61883
61918
  var fs66 = __toESM(require("fs"), 1);
@@ -64118,7 +64153,7 @@ function buildTopicHandlers(deps) {
64118
64153
  if (!deps.channelStore.get(args.channelId)) {
64119
64154
  throw new ClawdError(ERROR_CODES.INVALID_PARAM, `channel not found: ${args.channelId}`);
64120
64155
  }
64121
- const { sessionId, file } = deps.createMasterSession({ label: args.title ?? "\u65B0\u8BDD\u9898" });
64156
+ const { sessionId, file } = deps.createMasterSession({ label: args.title });
64122
64157
  const topic = deps.topicStore.create({
64123
64158
  channelId: args.channelId,
64124
64159
  ...args.title ? { title: args.title } : {},
@@ -64222,6 +64257,25 @@ function buildTopicHandlers(deps) {
64222
64257
  mustGet(args.topicId);
64223
64258
  const topic = deps.topicStore.setState(args.topicId, args.state);
64224
64259
  return { response: TopicResultSchema.parse({ topic }) };
64260
+ },
64261
+ "topic:rename": async (frame) => {
64262
+ const args = TopicRenameArgsSchema.parse(frame);
64263
+ mustGet(args.topicId);
64264
+ const topic = deps.topicStore.rename(args.topicId, args.title);
64265
+ return { response: TopicResultSchema.parse({ topic }) };
64266
+ },
64267
+ "topic:delete": async (frame) => {
64268
+ const { topicId } = TopicDeleteArgsSchema.parse(frame);
64269
+ const topic = mustGet(topicId);
64270
+ const { removed, broadcast } = deps.deleteMasterSession(topic.masterSessionId);
64271
+ deps.topicStore.remove(topicId);
64272
+ return {
64273
+ response: TopicDeleteResultSchema.parse({
64274
+ ok: true,
64275
+ removedMasterSessionId: removed ? topic.masterSessionId : null
64276
+ }),
64277
+ broadcast
64278
+ };
64225
64279
  }
64226
64280
  };
64227
64281
  }
@@ -64865,7 +64919,8 @@ function buildMethodHandlers(deps) {
64865
64919
  topicStore: deps.topicStore,
64866
64920
  channelStore: deps.channelStore,
64867
64921
  dispatchStore: deps.dispatchStore,
64868
- createMasterSession: deps.createMasterSession
64922
+ createMasterSession: deps.createMasterSession,
64923
+ deleteMasterSession: deps.deleteMasterSession
64869
64924
  }),
64870
64925
  ...buildShiftHandlers({
64871
64926
  shiftStore: deps.shiftStore,
@@ -66346,6 +66401,19 @@ async function startDaemon(config) {
66346
66401
  }
66347
66402
  return { sessionId, file: response };
66348
66403
  },
66404
+ // 删话题连带删 Master session(1:1)。会话已经不在了不算失败——话题仍要删得掉,
66405
+ // 所以 SESSION_NOT_FOUND 吞掉并回 removed:false,其余错误照抛(别把真故障说成成功)。
66406
+ deleteMasterSession: (sessionId) => {
66407
+ try {
66408
+ const { broadcast } = manager.delete({ sessionId });
66409
+ return { removed: true, broadcast };
66410
+ } catch (err) {
66411
+ if (err instanceof ClawdError && err.code === ERROR_CODES.SESSION_NOT_FOUND) {
66412
+ return { removed: false, broadcast: [] };
66413
+ }
66414
+ throw err;
66415
+ }
66416
+ },
66349
66417
  // meta:methods 自省:飞书 gate getter + 最终 handler 表(下面还会 spread 进
66350
66418
  // dispatch / shift-internal 两组,只看 buildMethodHandlers 内部表会误报死方法)
66351
66419
  feishuActive: () => feishuActive,
@@ -21959,6 +21959,11 @@ var TopicCloseArgsSchema = external_exports.object({
21959
21959
  topicId: external_exports.string().min(1),
21960
21960
  state: external_exports.enum(["done", "archived"])
21961
21961
  });
21962
+ var TopicRenameArgsSchema = external_exports.object({
21963
+ topicId: external_exports.string().min(1),
21964
+ title: nonBlank2
21965
+ });
21966
+ var TopicDeleteArgsSchema = external_exports.object({ topicId: external_exports.string().min(1) });
21962
21967
  var TopicListItemSchema = TopicSchema.extend({
21963
21968
  lineCount: external_exports.number().int().min(0)
21964
21969
  });
@@ -21990,6 +21995,10 @@ var TopicAcceptResultSchema = external_exports.object({
21990
21995
  needsOwnerAttention: external_exports.boolean()
21991
21996
  });
21992
21997
  var TopicResultSchema = external_exports.object({ topic: TopicSchema });
21998
+ var TopicDeleteResultSchema = external_exports.object({
21999
+ ok: external_exports.literal(true),
22000
+ removedMasterSessionId: external_exports.string().min(1).nullable()
22001
+ });
21993
22002
 
21994
22003
  // ../protocol/src/master.ts
21995
22004
  var AUTHORITY_ACTIONS = ["ask", "allow", "deny"];
@@ -23569,6 +23578,14 @@ var METHOD_DOCS = {
23569
23578
  summary: "\u6536\u655B\u8BDD\u9898\uFF1Astate \u7F6E done / archived",
23570
23579
  args: TopicCloseArgsSchema
23571
23580
  },
23581
+ "topic:rename": {
23582
+ summary: "\u53EA\u6539\u8BDD\u9898\u6807\u9898\uFF08title \u975E\u7A7A\uFF09\uFF0C\u4E0D\u78B0\u4E09\u8981\u7D20\u4E0E\u72B6\u6001\u3002\u6539\u8FC7\u540D\u7684\u8BDD\u9898\u663E\u793A\u540D\u4EE5\u5B83\u4E3A\u51C6\uFF0C\u4E0D\u518D\u56DE\u843D Master session \u7684 AI \u540D",
23583
+ args: TopicRenameArgsSchema
23584
+ },
23585
+ "topic:delete": {
23586
+ summary: "\u5220\u8BDD\u9898\uFF1A\u8FDE\u5E26\u5220\u5B83\u7684 Master session\uFF081:1\uFF09\uFF0C\u8BE5\u8BDD\u9898\u6D3E\u51FA\u53BB\u7684 worker session \u4FDD\u7559\u3002Master session \u5DF2\u4E0D\u5728\u65F6\u8BDD\u9898\u7167\u5220\uFF0CremovedMasterSessionId \u56DE null",
23587
+ args: TopicDeleteArgsSchema
23588
+ },
23572
23589
  // ---- master:*(授权查表,Master 经 clawd-rpc 桥调)----
23573
23590
  "master:authorityCheck": {
23574
23591
  summary: "\u67E5 Master \u7684\u6388\u6743\u8BBE\u5B9A\uFF08\u5168\u5C40\u4E00\u5957\uFF09\uFF1A\u8FD4\u56DE ask / allow / deny\u3002\u8868\u7F3A\u5931\u3001\u8BFB\u574F\u3001\u7ED3\u6784\u4E0D\u5BF9\u3001action \u62FC\u9519\u3001id \u672A\u767B\u8BB0\uFF0C\u4E00\u5F8B\u88C1\u51B3 ask",