@clawos-dev/clawd 0.2.175-beta.351.b6b1f4d → 0.2.175-beta.353.590ff71

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.
Files changed (2) hide show
  1. package/dist/cli.cjs +30 -7
  2. package/package.json +1 -1
package/dist/cli.cjs CHANGED
@@ -4788,6 +4788,16 @@ var init_schemas = __esm({
4788
4788
  * 反查路径走错;按 #750 一族防线处理,跟 ownerPersonaId 同地点 strip)。
4789
4789
  */
4790
4790
  dispatchedFromSessionId: external_exports.string().min(1).optional(),
4791
+ /**
4792
+ * Shift fire 派生的 session 记录调 addShift 的 source cc session id(稳定 key);
4793
+ * sidebar 据此把 fire 出的 session 折叠在 source session 下,跟 dispatchedFromSessionId
4794
+ * 平行但渲染不同 icon(AlarmClock 区别于 dispatch 的 CornerDownRight),让 owner 一眼
4795
+ * 分清"派生于人为委派"还是"派生于定时唤起"。非 shift fire session 缺省。
4796
+ * 跟 dispatchedFromSessionId / forkedFromSessionId 三者互斥(同一 session 不会兼任)。
4797
+ * mirror SessionFile 同 dispatchedFromSessionId 处理(shift fire 本地概念,理论上不会
4798
+ * mirror,留 strip 防御)。
4799
+ */
4800
+ shiftFiredFromSessionId: external_exports.string().min(1).optional(),
4791
4801
  createdAt: external_exports.string().min(1),
4792
4802
  updatedAt: external_exports.string().min(1)
4793
4803
  });
@@ -43264,10 +43274,14 @@ var SessionManager = class {
43264
43274
  // 强制走 deps.store(即 default scope),不走 scopeForFile:mirror 物理落 default 即可。
43265
43275
  // 远端 creator / origin 字段原值保留(不被本机 ctx 派生覆写)。
43266
43276
  //
43267
- // strip 远端 personaId / dispatchedFromSessionId:mirror SessionFile 上这两个字段都指向
43268
- // 朋友 daemon 上的本地 id,本机不持有对应 persona / 源 session。留着会让按这些字段反查的
43269
- // 本机消费者(MyPersonasSection 按 ownerPersonaId 反查 persona、sidebar 按
43270
- // dispatchedFromSessionId 折叠 sub-session)走错分支。写入前清掉。#750 一族防线。
43277
+ // strip 远端 personaId / dispatchedFromSessionId / shiftFiredFromSessionId:mirror
43278
+ // SessionFile 上这些字段都指向朋友 daemon 上的本地 id,本机不持有对应 persona /
43279
+ // 源 session。留着会让按这些字段反查的本机消费者(MyPersonasSection 按 ownerPersonaId
43280
+ // 反查 persona、sidebar 按 dispatchedFromSessionId / shiftFiredFromSessionId 折叠
43281
+ // sub-session)走错分支。写入前清掉。#750 一族防线。
43282
+ //
43283
+ // shift fire 是本地 daemon scheduler 行为,理论上不产生 mirror SessionFile,但留 strip
43284
+ // 防御(同 dispatchedFromSessionId 处理姿势对齐)。
43271
43285
  //
43272
43286
  // 与 manager.create / manager.update 区别:
43273
43287
  // - 不走 newRunner / attachObserver / cwd 校验(mirror 是纯 metadata 层)
@@ -43276,6 +43290,7 @@ var SessionManager = class {
43276
43290
  const {
43277
43291
  ownerPersonaId: _strippedPid,
43278
43292
  dispatchedFromSessionId: _strippedDsp,
43293
+ shiftFiredFromSessionId: _strippedSft,
43279
43294
  ...rest
43280
43295
  } = file;
43281
43296
  return this.deps.store.write(rest);
@@ -43978,6 +43993,7 @@ var SessionManager = class {
43978
43993
  cwd,
43979
43994
  tool: "claude",
43980
43995
  ownerPersonaId: args.targetPersona,
43996
+ ...args.sourceSessionId ? { shiftFiredFromSessionId: args.sourceSessionId } : {},
43981
43997
  createdAt: now,
43982
43998
  updatedAt: now
43983
43999
  };
@@ -47544,7 +47560,8 @@ function createShiftScheduler(deps) {
47544
47560
  shiftId: shift.id,
47545
47561
  targetPersona: shift.targetPersona,
47546
47562
  prompt: shift.prompt,
47547
- timeoutMs
47563
+ timeoutMs,
47564
+ ...shift.createdBySessionId ? { sourceSessionId: shift.createdBySessionId } : {}
47548
47565
  });
47549
47566
  sessionId = spawned.sessionId;
47550
47567
  const startRun = {
@@ -47598,8 +47615,12 @@ function createShiftScheduler(deps) {
47598
47615
 
47599
47616
  // src/shift/spawn.ts
47600
47617
  function createShiftSpawnFn(deps) {
47601
- return async ({ targetPersona, prompt, timeoutMs }) => {
47602
- const created = deps.sessionManager.createShiftSession({ targetPersona, prompt });
47618
+ return async ({ targetPersona, prompt, timeoutMs, sourceSessionId }) => {
47619
+ const created = deps.sessionManager.createShiftSession({
47620
+ targetPersona,
47621
+ prompt,
47622
+ ...sourceSessionId ? { sourceSessionId } : {}
47623
+ });
47603
47624
  let resolveOuter = () => {
47604
47625
  };
47605
47626
  const ended = new Promise((r) => {
@@ -47653,12 +47674,14 @@ function validateSchedule(schedule) {
47653
47674
  function buildShiftInternalHandlers(deps) {
47654
47675
  const add = async (frame) => {
47655
47676
  const persona = readPersonaId(frame);
47677
+ const callerSessionId = typeof frame.sessionId === "string" ? frame.sessionId : void 0;
47656
47678
  const { type: _t, requestId: _r, personaId: _p, sessionId: _s, ...rest } = frame;
47657
47679
  const args = rest;
47658
47680
  validateSchedule(args.schedule);
47659
47681
  const shift = deps.store.add({
47660
47682
  ownerId: deps.ownerIdProvider(),
47661
47683
  createdByPersona: persona,
47684
+ ...callerSessionId ? { createdBySessionId: callerSessionId } : {},
47662
47685
  name: args.name,
47663
47686
  enabled: true,
47664
47687
  schedule: args.schedule,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clawos-dev/clawd",
3
- "version": "0.2.175-beta.351.b6b1f4d",
3
+ "version": "0.2.175-beta.353.590ff71",
4
4
  "description": "Standalone clawd daemon — Claude Code (and future Codex) session server over WebSocket",
5
5
  "type": "module",
6
6
  "license": "MIT",