@clawos-dev/clawd 0.2.174 → 0.2.175-beta.351.b6b1f4d
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 +92 -13
- package/dist/shift/mcp-server.cjs +3 -1
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -253,7 +253,11 @@ var init_events = __esm({
|
|
|
253
253
|
"skill-hint",
|
|
254
254
|
"meta-text",
|
|
255
255
|
"attachment-skills",
|
|
256
|
-
"attachment-deferred-tools"
|
|
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"
|
|
257
261
|
];
|
|
258
262
|
SKILL_SOURCE_VALUES = ["builtin", "global", "project", "plugin"];
|
|
259
263
|
AGENT_SOURCE_VALUES = [
|
|
@@ -11230,6 +11234,7 @@ function classifyUserMessage(input) {
|
|
|
11230
11234
|
if (SYSTEM_REMINDER_RE.test(text) || OPENSPEC_BLOCK_RE.test(text)) {
|
|
11231
11235
|
return { meta: "system-reminder" };
|
|
11232
11236
|
}
|
|
11237
|
+
if (CLAWD_SHIFT_FIRE_RE.test(text)) return { meta: "clawd-shift-fire" };
|
|
11233
11238
|
if (SKILL_HINT_RE.test(text)) return { meta: "skill-hint" };
|
|
11234
11239
|
const flags = raw;
|
|
11235
11240
|
if (flags.isMeta === true || flags.isSynthetic === true) return { meta: "meta-text" };
|
|
@@ -11444,7 +11449,7 @@ function readCurrentContent(filePath) {
|
|
|
11444
11449
|
return null;
|
|
11445
11450
|
}
|
|
11446
11451
|
}
|
|
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;
|
|
11452
|
+
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;
|
|
11448
11453
|
var init_claude_history = __esm({
|
|
11449
11454
|
"src/tools/claude-history.ts"() {
|
|
11450
11455
|
"use strict";
|
|
@@ -11461,6 +11466,7 @@ var init_claude_history = __esm({
|
|
|
11461
11466
|
SYSTEM_REMINDER_RE = /^\s*<system-reminder\b/i;
|
|
11462
11467
|
OPENSPEC_BLOCK_RE = /^\s*<!--\s*OPENSPEC\b/i;
|
|
11463
11468
|
SKILL_HINT_RE = /^\s*Base directory for this skill:\s/;
|
|
11469
|
+
CLAWD_SHIFT_FIRE_RE = /^\s*<clawd-shift-fire\b/i;
|
|
11464
11470
|
ATTACHMENT_SILENT_SUBTYPES = /* @__PURE__ */ new Set([
|
|
11465
11471
|
"hook_additional_context",
|
|
11466
11472
|
"hook_success",
|
|
@@ -41261,6 +41267,22 @@ function composeGuestSandbox(base, userWorkDir, spawnCwd) {
|
|
|
41261
41267
|
return s;
|
|
41262
41268
|
}
|
|
41263
41269
|
|
|
41270
|
+
// src/shift/wrap.ts
|
|
41271
|
+
function wrapShiftFirePrompt(args) {
|
|
41272
|
+
return [
|
|
41273
|
+
`<clawd-shift-fire target-persona="${escapeAttr(args.targetPersona)}">`,
|
|
41274
|
+
"This is a scheduled shift fire \u2014 not a live user message.",
|
|
41275
|
+
"Respond as an assistant turn (start your output directly).",
|
|
41276
|
+
"",
|
|
41277
|
+
"Instruction:",
|
|
41278
|
+
args.prompt,
|
|
41279
|
+
"</clawd-shift-fire>"
|
|
41280
|
+
].join("\n");
|
|
41281
|
+
}
|
|
41282
|
+
function escapeAttr(v2) {
|
|
41283
|
+
return v2.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">");
|
|
41284
|
+
}
|
|
41285
|
+
|
|
41264
41286
|
// src/session/reducer.ts
|
|
41265
41287
|
init_runtime();
|
|
41266
41288
|
|
|
@@ -43991,7 +44013,16 @@ var SessionManager = class {
|
|
|
43991
44013
|
});
|
|
43992
44014
|
const runner = this.ensureRunnerForScope(file, scope);
|
|
43993
44015
|
this.deps.logger?.info("shift.createShiftSession.runner-ready", { sessionId });
|
|
43994
|
-
runner.input({
|
|
44016
|
+
runner.input({
|
|
44017
|
+
kind: "command",
|
|
44018
|
+
command: {
|
|
44019
|
+
kind: "send",
|
|
44020
|
+
text: wrapShiftFirePrompt({
|
|
44021
|
+
prompt: args.prompt,
|
|
44022
|
+
targetPersona: args.targetPersona
|
|
44023
|
+
})
|
|
44024
|
+
}
|
|
44025
|
+
});
|
|
43995
44026
|
const kill = () => {
|
|
43996
44027
|
const r = this.runners.get(sessionId);
|
|
43997
44028
|
if (!r) return;
|
|
@@ -55606,11 +55637,22 @@ function buildAppBuilderHandlers(deps) {
|
|
|
55606
55637
|
}
|
|
55607
55638
|
|
|
55608
55639
|
// src/handlers/shift.ts
|
|
55640
|
+
var UI_DEFAULT_DURATION_MS = 30 * 6e4;
|
|
55641
|
+
var UI_MAX_DURATION_MS = 60 * 6e4;
|
|
55642
|
+
function pickUiDurationMs(timeoutMs) {
|
|
55643
|
+
return Math.min(timeoutMs ?? UI_DEFAULT_DURATION_MS, UI_MAX_DURATION_MS);
|
|
55644
|
+
}
|
|
55645
|
+
function everyMsToCron(everyMs) {
|
|
55646
|
+
if (everyMs <= 6e4) return "* * * * *";
|
|
55647
|
+
const minutes = Math.floor(everyMs / 6e4);
|
|
55648
|
+
if (minutes < 60) return `*/${minutes} * * * *`;
|
|
55649
|
+
const hours = Math.floor(minutes / 60);
|
|
55650
|
+
if (hours < 24) return `0 */${hours} * * *`;
|
|
55651
|
+
const days = Math.max(1, Math.floor(hours / 24));
|
|
55652
|
+
return `0 0 */${days} * *`;
|
|
55653
|
+
}
|
|
55609
55654
|
function daemonShiftToUiShift(d, nowMs) {
|
|
55610
|
-
|
|
55611
|
-
const atMs = Date.parse(d.schedule.at);
|
|
55612
|
-
if (Number.isNaN(atMs) || atMs <= nowMs) return null;
|
|
55613
|
-
}
|
|
55655
|
+
const durationMs = pickUiDurationMs(d.timeoutMs);
|
|
55614
55656
|
const noteParts = [d.name];
|
|
55615
55657
|
if (d.prompt && d.prompt.length > 0) {
|
|
55616
55658
|
const promptPreview = d.prompt.length > 120 ? `${d.prompt.slice(0, 117)}\u2026` : d.prompt;
|
|
@@ -55618,12 +55660,49 @@ function daemonShiftToUiShift(d, nowMs) {
|
|
|
55618
55660
|
}
|
|
55619
55661
|
if (!d.enabled) noteParts.push("(disabled)");
|
|
55620
55662
|
const note = noteParts.join(" \u2014 ");
|
|
55621
|
-
|
|
55622
|
-
|
|
55623
|
-
|
|
55624
|
-
|
|
55625
|
-
|
|
55626
|
-
|
|
55663
|
+
switch (d.schedule.kind) {
|
|
55664
|
+
case "at": {
|
|
55665
|
+
const startMs = Date.parse(d.schedule.at);
|
|
55666
|
+
if (Number.isNaN(startMs)) return null;
|
|
55667
|
+
if (startMs + durationMs <= nowMs) return null;
|
|
55668
|
+
return {
|
|
55669
|
+
id: d.id,
|
|
55670
|
+
agentId: d.targetPersona,
|
|
55671
|
+
schedule: {
|
|
55672
|
+
kind: "single",
|
|
55673
|
+
start: new Date(startMs).toISOString(),
|
|
55674
|
+
end: new Date(startMs + durationMs).toISOString()
|
|
55675
|
+
},
|
|
55676
|
+
note
|
|
55677
|
+
};
|
|
55678
|
+
}
|
|
55679
|
+
case "cron": {
|
|
55680
|
+
return {
|
|
55681
|
+
id: d.id,
|
|
55682
|
+
agentId: d.targetPersona,
|
|
55683
|
+
schedule: {
|
|
55684
|
+
kind: "recurring",
|
|
55685
|
+
cron: d.schedule.expr,
|
|
55686
|
+
...d.schedule.tz ? { tz: d.schedule.tz } : {},
|
|
55687
|
+
durationMs
|
|
55688
|
+
},
|
|
55689
|
+
note
|
|
55690
|
+
};
|
|
55691
|
+
}
|
|
55692
|
+
case "every": {
|
|
55693
|
+
const cron = everyMsToCron(d.schedule.everyMs);
|
|
55694
|
+
return {
|
|
55695
|
+
id: d.id,
|
|
55696
|
+
agentId: d.targetPersona,
|
|
55697
|
+
schedule: {
|
|
55698
|
+
kind: "recurring",
|
|
55699
|
+
cron,
|
|
55700
|
+
durationMs
|
|
55701
|
+
},
|
|
55702
|
+
note
|
|
55703
|
+
};
|
|
55704
|
+
}
|
|
55705
|
+
}
|
|
55627
55706
|
}
|
|
55628
55707
|
function buildShiftHandlers(deps) {
|
|
55629
55708
|
return {
|
|
@@ -21251,7 +21251,9 @@ 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(
|
|
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
|
+
),
|
|
21255
21257
|
targetPersona: external_exports.string().optional().describe("which persona to spawn; defaults to the calling persona"),
|
|
21256
21258
|
timeoutMs: external_exports.number().optional().describe("hard timeout per fire; default 30 minutes")
|
|
21257
21259
|
}
|
package/package.json
CHANGED