@clawos-dev/clawd 0.2.175 → 0.2.176-beta.354.c832bc0

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
@@ -253,11 +253,7 @@ var init_events = __esm({
253
253
  "skill-hint",
254
254
  "meta-text",
255
255
  "attachment-skills",
256
- "attachment-deferred-tools",
257
- // clawd shift v1:scheduler fire 时 daemon 给新 cc 的首条 user message 用
258
- // <clawd-shift-fire> wrap 起头;classifyUserMessage 识别后路由到 UserMetaLine 折叠渲染,
259
- // 不显示成 user 气泡(避免 instruction 文本被当 owner 实时对话)。
260
- "clawd-shift-fire"
256
+ "attachment-deferred-tools"
261
257
  ];
262
258
  SKILL_SOURCE_VALUES = ["builtin", "global", "project", "plugin"];
263
259
  AGENT_SOURCE_VALUES = [
@@ -4788,16 +4784,6 @@ var init_schemas = __esm({
4788
4784
  * 反查路径走错;按 #750 一族防线处理,跟 ownerPersonaId 同地点 strip)。
4789
4785
  */
4790
4786
  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(),
4801
4787
  createdAt: external_exports.string().min(1),
4802
4788
  updatedAt: external_exports.string().min(1)
4803
4789
  });
@@ -11244,7 +11230,6 @@ function classifyUserMessage(input) {
11244
11230
  if (SYSTEM_REMINDER_RE.test(text) || OPENSPEC_BLOCK_RE.test(text)) {
11245
11231
  return { meta: "system-reminder" };
11246
11232
  }
11247
- if (CLAWD_SHIFT_FIRE_RE.test(text)) return { meta: "clawd-shift-fire" };
11248
11233
  if (SKILL_HINT_RE.test(text)) return { meta: "skill-hint" };
11249
11234
  const flags = raw;
11250
11235
  if (flags.isMeta === true || flags.isSynthetic === true) return { meta: "meta-text" };
@@ -11459,7 +11444,7 @@ function readCurrentContent(filePath) {
11459
11444
  return null;
11460
11445
  }
11461
11446
  }
11462
- var import_node_fs10, import_node_os5, import_node_path9, TASK_NOTIFICATION_RE, TASK_ID_RE, TOOL_USE_ID_RE, SLASH_COMMAND_RE, LOCAL_COMMAND_RE, SYSTEM_REMINDER_RE, OPENSPEC_BLOCK_RE, SKILL_HINT_RE, CLAWD_SHIFT_FIRE_RE, ATTACHMENT_SILENT_SUBTYPES, ClaudeHistoryReader;
11447
+ var import_node_fs10, import_node_os5, import_node_path9, TASK_NOTIFICATION_RE, TASK_ID_RE, TOOL_USE_ID_RE, SLASH_COMMAND_RE, LOCAL_COMMAND_RE, SYSTEM_REMINDER_RE, OPENSPEC_BLOCK_RE, SKILL_HINT_RE, ATTACHMENT_SILENT_SUBTYPES, ClaudeHistoryReader;
11463
11448
  var init_claude_history = __esm({
11464
11449
  "src/tools/claude-history.ts"() {
11465
11450
  "use strict";
@@ -11476,7 +11461,6 @@ var init_claude_history = __esm({
11476
11461
  SYSTEM_REMINDER_RE = /^\s*<system-reminder\b/i;
11477
11462
  OPENSPEC_BLOCK_RE = /^\s*<!--\s*OPENSPEC\b/i;
11478
11463
  SKILL_HINT_RE = /^\s*Base directory for this skill:\s/;
11479
- CLAWD_SHIFT_FIRE_RE = /^\s*<clawd-shift-fire\b/i;
11480
11464
  ATTACHMENT_SILENT_SUBTYPES = /* @__PURE__ */ new Set([
11481
11465
  "hook_additional_context",
11482
11466
  "hook_success",
@@ -41277,22 +41261,6 @@ function composeGuestSandbox(base, userWorkDir, spawnCwd) {
41277
41261
  return s;
41278
41262
  }
41279
41263
 
41280
- // src/shift/wrap.ts
41281
- function wrapShiftFirePrompt(args) {
41282
- return [
41283
- `<clawd-shift-fire target-persona="${escapeAttr(args.targetPersona)}">`,
41284
- "This is a scheduled shift fire \u2014 not a live user message.",
41285
- "Respond as an assistant turn (start your output directly).",
41286
- "",
41287
- "Instruction:",
41288
- args.prompt,
41289
- "</clawd-shift-fire>"
41290
- ].join("\n");
41291
- }
41292
- function escapeAttr(v2) {
41293
- return v2.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
41294
- }
41295
-
41296
41264
  // src/session/reducer.ts
41297
41265
  init_runtime();
41298
41266
 
@@ -41345,7 +41313,7 @@ function buildConnectionPrompt(args) {
41345
41313
  }
41346
41314
  if (args.workDir) {
41347
41315
  result += `
41348
- \u4F60\u7684\u6587\u4EF6\u5DE5\u4F5C\u76EE\u5F55\u662F ${args.workDir}\uFF0C\u6240\u6709\u6587\u4EF6\u8BFB\u5199\u90FD\u653E\u5728\u8FD9\u4E2A\u76EE\u5F55\u4E0B\u3002persona \u76EE\u5F55\u5BF9\u4F60\u53EA\u8BFB\uFF0C\u4E0D\u8981\u5F80\u91CC\u5199\u3002`;
41316
+ \u4F60\u7684\u6587\u4EF6\u5DE5\u4F5C\u76EE\u5F55\u662F ${args.workDir}\uFF0C\u8FD9\u4E2A\u76EE\u5F55\u5BF9\u4F60\u53EF\u8BFB\u53EF\u5199\uFF0C\u6587\u4EF6\u7684\u8BFB\u53D6/\u521B\u5EFA/\u4FEE\u6539\u90FD\u5728\u8FD9\u91CC\u8FDB\u884C\u3002persona \u76EE\u5F55\u5BF9\u4F60\u53EA\u8BFB\uFF0C\u4E0D\u8981\u5F80\u91CC\u5199\u3002`;
41349
41317
  }
41350
41318
  return result;
41351
41319
  }
@@ -43274,14 +43242,10 @@ var SessionManager = class {
43274
43242
  // 强制走 deps.store(即 default scope),不走 scopeForFile:mirror 物理落 default 即可。
43275
43243
  // 远端 creator / origin 字段原值保留(不被本机 ctx 派生覆写)。
43276
43244
  //
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 处理姿势对齐)。
43245
+ // strip 远端 personaId / dispatchedFromSessionId:mirror SessionFile 上这两个字段都指向
43246
+ // 朋友 daemon 上的本地 id,本机不持有对应 persona / 源 session。留着会让按这些字段反查的
43247
+ // 本机消费者(MyPersonasSection 按 ownerPersonaId 反查 persona、sidebar 按
43248
+ // dispatchedFromSessionId 折叠 sub-session)走错分支。写入前清掉。#750 一族防线。
43285
43249
  //
43286
43250
  // 与 manager.create / manager.update 区别:
43287
43251
  // - 不走 newRunner / attachObserver / cwd 校验(mirror 是纯 metadata 层)
@@ -43290,7 +43254,6 @@ var SessionManager = class {
43290
43254
  const {
43291
43255
  ownerPersonaId: _strippedPid,
43292
43256
  dispatchedFromSessionId: _strippedDsp,
43293
- shiftFiredFromSessionId: _strippedSft,
43294
43257
  ...rest
43295
43258
  } = file;
43296
43259
  return this.deps.store.write(rest);
@@ -43993,7 +43956,6 @@ var SessionManager = class {
43993
43956
  cwd,
43994
43957
  tool: "claude",
43995
43958
  ownerPersonaId: args.targetPersona,
43996
- ...args.sourceSessionId ? { shiftFiredFromSessionId: args.sourceSessionId } : {},
43997
43959
  createdAt: now,
43998
43960
  updatedAt: now
43999
43961
  };
@@ -44029,16 +43991,7 @@ var SessionManager = class {
44029
43991
  });
44030
43992
  const runner = this.ensureRunnerForScope(file, scope);
44031
43993
  this.deps.logger?.info("shift.createShiftSession.runner-ready", { sessionId });
44032
- runner.input({
44033
- kind: "command",
44034
- command: {
44035
- kind: "send",
44036
- text: wrapShiftFirePrompt({
44037
- prompt: args.prompt,
44038
- targetPersona: args.targetPersona
44039
- })
44040
- }
44041
- });
43994
+ runner.input({ kind: "command", command: { kind: "send", text: args.prompt } });
44042
43995
  const kill = () => {
44043
43996
  const r = this.runners.get(sessionId);
44044
43997
  if (!r) return;
@@ -47560,8 +47513,7 @@ function createShiftScheduler(deps) {
47560
47513
  shiftId: shift.id,
47561
47514
  targetPersona: shift.targetPersona,
47562
47515
  prompt: shift.prompt,
47563
- timeoutMs,
47564
- ...shift.createdBySessionId ? { sourceSessionId: shift.createdBySessionId } : {}
47516
+ timeoutMs
47565
47517
  });
47566
47518
  sessionId = spawned.sessionId;
47567
47519
  const startRun = {
@@ -47615,12 +47567,8 @@ function createShiftScheduler(deps) {
47615
47567
 
47616
47568
  // src/shift/spawn.ts
47617
47569
  function createShiftSpawnFn(deps) {
47618
- return async ({ targetPersona, prompt, timeoutMs, sourceSessionId }) => {
47619
- const created = deps.sessionManager.createShiftSession({
47620
- targetPersona,
47621
- prompt,
47622
- ...sourceSessionId ? { sourceSessionId } : {}
47623
- });
47570
+ return async ({ targetPersona, prompt, timeoutMs }) => {
47571
+ const created = deps.sessionManager.createShiftSession({ targetPersona, prompt });
47624
47572
  let resolveOuter = () => {
47625
47573
  };
47626
47574
  const ended = new Promise((r) => {
@@ -47674,14 +47622,12 @@ function validateSchedule(schedule) {
47674
47622
  function buildShiftInternalHandlers(deps) {
47675
47623
  const add = async (frame) => {
47676
47624
  const persona = readPersonaId(frame);
47677
- const callerSessionId = typeof frame.sessionId === "string" ? frame.sessionId : void 0;
47678
47625
  const { type: _t, requestId: _r, personaId: _p, sessionId: _s, ...rest } = frame;
47679
47626
  const args = rest;
47680
47627
  validateSchedule(args.schedule);
47681
47628
  const shift = deps.store.add({
47682
47629
  ownerId: deps.ownerIdProvider(),
47683
47630
  createdByPersona: persona,
47684
- ...callerSessionId ? { createdBySessionId: callerSessionId } : {},
47685
47631
  name: args.name,
47686
47632
  enabled: true,
47687
47633
  schedule: args.schedule,
@@ -21251,9 +21251,7 @@ async function main() {
21251
21251
  inputSchema: {
21252
21252
  name: external_exports.string().describe("short label shown in shift.json + future UI"),
21253
21253
  schedule: ScheduleSchema,
21254
- prompt: external_exports.string().describe(
21255
- "instruction the spawned cc executes on startup (NOT a chat message from the owner). Write what you want the persona to DO or SAY at fire time, in instruction form \u2014 daemon wraps it in a <clawd-shift-fire> tag so the spawned cc treats it as a scheduled action and responds as an assistant turn (no user-bubble appears in the owner's UI)."
21256
- ),
21254
+ prompt: external_exports.string().describe("first user message injected when the new cc starts"),
21257
21255
  targetPersona: external_exports.string().optional().describe("which persona to spawn; defaults to the calling persona"),
21258
21256
  timeoutMs: external_exports.number().optional().describe("hard timeout per fire; default 30 minutes")
21259
21257
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clawos-dev/clawd",
3
- "version": "0.2.175",
3
+ "version": "0.2.176-beta.354.c832bc0",
4
4
  "description": "Standalone clawd daemon — Claude Code (and future Codex) session server over WebSocket",
5
5
  "type": "module",
6
6
  "license": "MIT",