@clawos-dev/clawd 0.2.175-beta.352.ccf86fc → 0.2.175
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 +30 -63
- 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
|
|
43268
|
-
//
|
|
43269
|
-
//
|
|
43270
|
-
// dispatchedFromSessionId
|
|
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,7 +43993,7 @@ var SessionManager = class {
|
|
|
43978
43993
|
cwd,
|
|
43979
43994
|
tool: "claude",
|
|
43980
43995
|
ownerPersonaId: args.targetPersona,
|
|
43981
|
-
...args.sourceSessionId ? {
|
|
43996
|
+
...args.sourceSessionId ? { shiftFiredFromSessionId: args.sourceSessionId } : {},
|
|
43982
43997
|
createdAt: now,
|
|
43983
43998
|
updatedAt: now
|
|
43984
43999
|
};
|
|
@@ -55645,22 +55660,11 @@ function buildAppBuilderHandlers(deps) {
|
|
|
55645
55660
|
}
|
|
55646
55661
|
|
|
55647
55662
|
// src/handlers/shift.ts
|
|
55648
|
-
var UI_DEFAULT_DURATION_MS = 30 * 6e4;
|
|
55649
|
-
var UI_MAX_DURATION_MS = 60 * 6e4;
|
|
55650
|
-
function pickUiDurationMs(timeoutMs) {
|
|
55651
|
-
return Math.min(timeoutMs ?? UI_DEFAULT_DURATION_MS, UI_MAX_DURATION_MS);
|
|
55652
|
-
}
|
|
55653
|
-
function everyMsToCron(everyMs) {
|
|
55654
|
-
if (everyMs <= 6e4) return "* * * * *";
|
|
55655
|
-
const minutes = Math.floor(everyMs / 6e4);
|
|
55656
|
-
if (minutes < 60) return `*/${minutes} * * * *`;
|
|
55657
|
-
const hours = Math.floor(minutes / 60);
|
|
55658
|
-
if (hours < 24) return `0 */${hours} * * *`;
|
|
55659
|
-
const days = Math.max(1, Math.floor(hours / 24));
|
|
55660
|
-
return `0 0 */${days} * *`;
|
|
55661
|
-
}
|
|
55662
55663
|
function daemonShiftToUiShift(d, nowMs) {
|
|
55663
|
-
|
|
55664
|
+
if (d.schedule.kind === "at") {
|
|
55665
|
+
const atMs = Date.parse(d.schedule.at);
|
|
55666
|
+
if (Number.isNaN(atMs) || atMs <= nowMs) return null;
|
|
55667
|
+
}
|
|
55664
55668
|
const noteParts = [d.name];
|
|
55665
55669
|
if (d.prompt && d.prompt.length > 0) {
|
|
55666
55670
|
const promptPreview = d.prompt.length > 120 ? `${d.prompt.slice(0, 117)}\u2026` : d.prompt;
|
|
@@ -55668,49 +55672,12 @@ function daemonShiftToUiShift(d, nowMs) {
|
|
|
55668
55672
|
}
|
|
55669
55673
|
if (!d.enabled) noteParts.push("(disabled)");
|
|
55670
55674
|
const note = noteParts.join(" \u2014 ");
|
|
55671
|
-
|
|
55672
|
-
|
|
55673
|
-
|
|
55674
|
-
|
|
55675
|
-
|
|
55676
|
-
|
|
55677
|
-
id: d.id,
|
|
55678
|
-
agentId: d.targetPersona,
|
|
55679
|
-
schedule: {
|
|
55680
|
-
kind: "single",
|
|
55681
|
-
start: new Date(startMs).toISOString(),
|
|
55682
|
-
end: new Date(startMs + durationMs).toISOString()
|
|
55683
|
-
},
|
|
55684
|
-
note
|
|
55685
|
-
};
|
|
55686
|
-
}
|
|
55687
|
-
case "cron": {
|
|
55688
|
-
return {
|
|
55689
|
-
id: d.id,
|
|
55690
|
-
agentId: d.targetPersona,
|
|
55691
|
-
schedule: {
|
|
55692
|
-
kind: "recurring",
|
|
55693
|
-
cron: d.schedule.expr,
|
|
55694
|
-
...d.schedule.tz ? { tz: d.schedule.tz } : {},
|
|
55695
|
-
durationMs
|
|
55696
|
-
},
|
|
55697
|
-
note
|
|
55698
|
-
};
|
|
55699
|
-
}
|
|
55700
|
-
case "every": {
|
|
55701
|
-
const cron = everyMsToCron(d.schedule.everyMs);
|
|
55702
|
-
return {
|
|
55703
|
-
id: d.id,
|
|
55704
|
-
agentId: d.targetPersona,
|
|
55705
|
-
schedule: {
|
|
55706
|
-
kind: "recurring",
|
|
55707
|
-
cron,
|
|
55708
|
-
durationMs
|
|
55709
|
-
},
|
|
55710
|
-
note
|
|
55711
|
-
};
|
|
55712
|
-
}
|
|
55713
|
-
}
|
|
55675
|
+
return {
|
|
55676
|
+
id: d.id,
|
|
55677
|
+
agentId: d.targetPersona,
|
|
55678
|
+
schedule: d.schedule,
|
|
55679
|
+
note
|
|
55680
|
+
};
|
|
55714
55681
|
}
|
|
55715
55682
|
function buildShiftHandlers(deps) {
|
|
55716
55683
|
return {
|
package/package.json
CHANGED