@hyperwindmill/caretaker-cli 0.11.2 → 0.12.1

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.
@@ -15396,7 +15396,7 @@ ${text}</tr>
15396
15396
  ] });
15397
15397
  case "assistant":
15398
15398
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "bubble bubble--assistant", children: [
15399
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "bubble__role", children: "assistant" }),
15399
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "bubble__role", children: item.label || "assistant" }),
15400
15400
  /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "bubble__text", children: [
15401
15401
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(MarkdownText, { content: item.text }),
15402
15402
  item.streaming && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "bubble__caret", children: "\u258C" })
@@ -16147,6 +16147,8 @@ ${text}</tr>
16147
16147
  const [planningEnabled, setPlanningEnabled] = (0, import_react7.useState)(null);
16148
16148
  const [reviewEnabled, setReviewEnabled] = (0, import_react7.useState)(null);
16149
16149
  const [sddEnabled, setSddEnabled] = (0, import_react7.useState)(null);
16150
+ const [bootstrapText, setBootstrapText] = (0, import_react7.useState)("");
16151
+ const [maxRunSecondsText, setMaxRunSecondsText] = (0, import_react7.useState)("");
16150
16152
  const [errorMsg, setErrorMsg] = (0, import_react7.useState)(null);
16151
16153
  const projects = config.projects || [];
16152
16154
  const startEdit = (proj) => {
@@ -16161,6 +16163,8 @@ ${text}</tr>
16161
16163
  setPlanningEnabled(proj.planningEnabled !== void 0 ? proj.planningEnabled : null);
16162
16164
  setReviewEnabled(proj.reviewEnabled !== void 0 ? proj.reviewEnabled : null);
16163
16165
  setSddEnabled(proj.sddEnabled !== void 0 ? proj.sddEnabled : null);
16166
+ setBootstrapText((proj.bootstrapCommands || []).join("\n"));
16167
+ setMaxRunSecondsText(proj.maxRunSeconds ? String(proj.maxRunSeconds) : "");
16164
16168
  setErrorMsg(null);
16165
16169
  };
16166
16170
  const startCreate = () => {
@@ -16175,6 +16179,8 @@ ${text}</tr>
16175
16179
  setPlanningEnabled(null);
16176
16180
  setReviewEnabled(null);
16177
16181
  setSddEnabled(null);
16182
+ setBootstrapText("");
16183
+ setMaxRunSecondsText("");
16178
16184
  setErrorMsg(null);
16179
16185
  };
16180
16186
  const cancelForm = () => {
@@ -16198,6 +16204,9 @@ ${text}</tr>
16198
16204
  setErrorMsg("An Agent must be assigned.");
16199
16205
  return;
16200
16206
  }
16207
+ const bootstrapCommands = bootstrapText.split("\n").map((c) => c.trim()).filter(Boolean);
16208
+ const parsedMaxRun = parseInt(maxRunSecondsText.trim(), 10);
16209
+ const maxRunSeconds = Number.isFinite(parsedMaxRun) && parsedMaxRun > 0 ? parsedMaxRun : null;
16201
16210
  const updatedProjects = [...projects];
16202
16211
  if (isCreating) {
16203
16212
  const nextId = projects.length > 0 ? Math.max(...projects.map((p) => p.id)) + 1 : 1;
@@ -16212,7 +16221,9 @@ ${text}</tr>
16212
16221
  reviewerAgentId: reviewerAgentId || null,
16213
16222
  planningEnabled,
16214
16223
  reviewEnabled,
16215
- sddEnabled
16224
+ sddEnabled,
16225
+ bootstrapCommands,
16226
+ maxRunSeconds
16216
16227
  };
16217
16228
  updatedProjects.push(newProj);
16218
16229
  } else if (editingProject) {
@@ -16228,7 +16239,9 @@ ${text}</tr>
16228
16239
  reviewerAgentId: reviewerAgentId || null,
16229
16240
  planningEnabled,
16230
16241
  reviewEnabled,
16231
- sddEnabled
16242
+ sddEnabled,
16243
+ bootstrapCommands,
16244
+ maxRunSeconds
16232
16245
  };
16233
16246
  }
16234
16247
  }
@@ -16404,6 +16417,40 @@ ${text}</tr>
16404
16417
  ] })
16405
16418
  ] }),
16406
16419
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { style: { fontSize: "11px", opacity: 0.65, margin: "6px 0 0 0" }, children: "SDD mode lets the planner write markdown documents (specs, plans) during the planning phase. How and where they are written is up to this project's own conventions (AGENTS.md, agent prompt \u2014 e.g. superpowers specs). Everything else stays read-only." }),
16420
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "form-group", children: [
16421
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("label", { htmlFor: "project-bootstrap", children: "Bootstrap Commands (one per line)" }),
16422
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
16423
+ "textarea",
16424
+ {
16425
+ id: "project-bootstrap",
16426
+ value: bootstrapText,
16427
+ onChange: (e) => setBootstrapText(e.target.value),
16428
+ placeholder: "pnpm install\npnpm build",
16429
+ rows: 3,
16430
+ style: { fontFamily: "var(--font-mono)", fontSize: "11px" }
16431
+ }
16432
+ ),
16433
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("p", { style: { fontSize: "11px", opacity: 0.65, margin: "6px 0 0 0" }, children: [
16434
+ "Run once, in order, right after a task worktree is created (git projects only) \u2014 before the agent's first cycle, so it doesn't spend tokens on setup like ",
16435
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("code", { children: "pnpm install" }),
16436
+ ". The run stops and the task is blocked if any command fails."
16437
+ ] })
16438
+ ] }),
16439
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "form-group", children: [
16440
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("label", { htmlFor: "project-max-run", children: "Max run seconds per cycle (optional)" }),
16441
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
16442
+ "input",
16443
+ {
16444
+ id: "project-max-run",
16445
+ type: "number",
16446
+ min: 1,
16447
+ value: maxRunSecondsText,
16448
+ onChange: (e) => setMaxRunSecondsText(e.target.value),
16449
+ placeholder: "Default: 120 (native) / 900 (claude-code)"
16450
+ }
16451
+ ),
16452
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { style: { fontSize: "11px", opacity: 0.65, margin: "6px 0 0 0" }, children: "Wall-clock budget for a single heartbeat cycle, enforced as an abort for every provider. Tasks inherit this and can override it. Leave empty for the default." })
16453
+ ] }),
16407
16454
  /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "form-actions", children: [
16408
16455
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { className: "btn btn--secondary", onClick: cancelForm, children: "Cancel" }),
16409
16456
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { className: "btn btn--primary", onClick: validateAndSave, children: "Save" })
@@ -18449,7 +18496,7 @@ ${text}</tr>
18449
18496
  } catch {
18450
18497
  }
18451
18498
  }
18452
- function taskMessagesToChatItems(msgs) {
18499
+ function taskMessagesToChatItems(msgs, labels) {
18453
18500
  const items = [];
18454
18501
  for (const msg of msgs) {
18455
18502
  if (msg.messageType === "system" || msg.messageType === "block") {
@@ -18473,7 +18520,7 @@ ${text}</tr>
18473
18520
  if (msg.messageType === "plan") {
18474
18521
  items.push({ kind: "assistant", text: `**\u{1F4CB} Plan submitted**
18475
18522
 
18476
- ${msg.content}`, streaming: false });
18523
+ ${msg.content}`, streaming: false, label: labels?.planner });
18477
18524
  continue;
18478
18525
  }
18479
18526
  if (msg.role === "user") {
@@ -18495,7 +18542,7 @@ ${msg.content}`, streaming: false });
18495
18542
  }
18496
18543
  }
18497
18544
  if (thinking) items.push({ kind: "thinking", text: thinking });
18498
- items.push({ kind: "assistant", text, streaming: false });
18545
+ items.push({ kind: "assistant", text, streaming: false, label: labels?.developer });
18499
18546
  }
18500
18547
  return items;
18501
18548
  }
@@ -18827,6 +18874,24 @@ ${msg.content}`, streaming: false });
18827
18874
  setTaskError("Failed to update task setting");
18828
18875
  }
18829
18876
  };
18877
+ const handleSetTaskMaxRun = async (task, value) => {
18878
+ try {
18879
+ const res = await fetch(`/api/tasks/${task.id}/flags`, {
18880
+ method: "PATCH",
18881
+ headers: { "Content-Type": "application/json" },
18882
+ body: JSON.stringify({ maxRunSeconds: value })
18883
+ });
18884
+ if (res.ok) {
18885
+ if (selectedProjectId !== null) fetchTasks(selectedProjectId);
18886
+ } else {
18887
+ const data = await res.json().catch(() => ({}));
18888
+ setTaskError(data.error || "Failed to update task setting");
18889
+ }
18890
+ } catch (err) {
18891
+ console.error("Failed to set task max run seconds:", err);
18892
+ setTaskError("Failed to update task setting");
18893
+ }
18894
+ };
18830
18895
  const backToList = () => {
18831
18896
  setView("list");
18832
18897
  setSelectedTaskId(null);
@@ -18836,6 +18901,16 @@ ${msg.content}`, streaming: false });
18836
18901
  const selectedProject = projects.find((p) => p.id === selectedProjectId);
18837
18902
  const selectedTask = tasks.find((t) => t.id === selectedTaskId);
18838
18903
  const selectedProjectAgentName = agents.find((a) => a.id === selectedProject?.agentId)?.name || "Default Agent";
18904
+ const agentLabelFor = (agentId) => {
18905
+ const a = agents.find((x) => x.id === agentId);
18906
+ return a ? `${a.name} \xB7 ${a.model}` : void 0;
18907
+ };
18908
+ const taskAgentLabels = selectedTask ? {
18909
+ developer: agentLabelFor(selectedTask.agentId || selectedProject?.agentId || agents[0]?.id),
18910
+ planner: agentLabelFor(
18911
+ selectedTask.plannerAgentId || selectedProject?.plannerAgentId || selectedTask.agentId || selectedProject?.agentId || agents[0]?.id
18912
+ )
18913
+ } : void 0;
18839
18914
  const reviewRound = selectedTask ? taskMessages.filter((m) => m.messageType === "review").length + 1 : 1;
18840
18915
  const isActiveLike = selectedTask ? selectedTask.status === "active" || selectedTask.status === "reviewing" || selectedTask.status === "planning" : false;
18841
18916
  const statusColor = (status) => {
@@ -18888,6 +18963,7 @@ ${msg.content}`, streaming: false });
18888
18963
  {
18889
18964
  task: selectedTask,
18890
18965
  taskMessages,
18966
+ agentLabels: taskAgentLabels,
18891
18967
  isActiveLike,
18892
18968
  reviewRound,
18893
18969
  composerText,
@@ -18896,6 +18972,7 @@ ${msg.content}`, streaming: false });
18896
18972
  isSending,
18897
18973
  onBack: backToList,
18898
18974
  onToggleChecklistItem: handleToggleChecklistItem,
18975
+ onToggleStatus: handleToggleTaskStatus,
18899
18976
  statusColor
18900
18977
  }
18901
18978
  ) : view === "edit" && selectedTask ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
@@ -18911,6 +18988,7 @@ ${msg.content}`, streaming: false });
18911
18988
  onToggleChecklistItem: handleToggleChecklistItem,
18912
18989
  onSetAgent: handleSetTaskAgent,
18913
18990
  onSetFlag: handleSetTaskFlag,
18991
+ onSetMaxRun: handleSetTaskMaxRun,
18914
18992
  onOpenLog: () => setView("log"),
18915
18993
  statusColor
18916
18994
  }
@@ -19329,6 +19407,7 @@ ${msg.content}`, streaming: false });
19329
19407
  function TaskLogView({
19330
19408
  task,
19331
19409
  taskMessages,
19410
+ agentLabels,
19332
19411
  isActiveLike,
19333
19412
  reviewRound,
19334
19413
  composerText,
@@ -19337,6 +19416,7 @@ ${msg.content}`, streaming: false });
19337
19416
  isSending,
19338
19417
  onBack,
19339
19418
  onToggleChecklistItem,
19419
+ onToggleStatus,
19340
19420
  statusColor
19341
19421
  }) {
19342
19422
  const completedCount = task.checklist.filter((c) => c.status === "done").length;
@@ -19364,14 +19444,32 @@ ${msg.content}`, streaming: false });
19364
19444
  ] })
19365
19445
  ] })
19366
19446
  ] }),
19367
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
19368
- "span",
19369
- {
19370
- className: "task-table__badge",
19371
- style: { background: statusColor(task.status) },
19372
- children: task.status
19373
- }
19374
- )
19447
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [
19448
+ task.status !== "done" && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
19449
+ "button",
19450
+ {
19451
+ className: "confirm__btn confirm__btn--primary",
19452
+ onClick: () => onToggleStatus(task),
19453
+ title: isActiveLike ? "Pause this task (aborts the running agent)" : "Activate this task",
19454
+ style: { padding: "3px 10px", fontSize: "10px", display: "inline-flex", alignItems: "center", gap: "4px" },
19455
+ children: isActiveLike ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
19456
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Pause, { size: 12 }),
19457
+ " Pause"
19458
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
19459
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Play, { size: 12 }),
19460
+ " Activate"
19461
+ ] })
19462
+ }
19463
+ ),
19464
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
19465
+ "span",
19466
+ {
19467
+ className: "task-table__badge",
19468
+ style: { background: statusColor(task.status) },
19469
+ children: task.status
19470
+ }
19471
+ )
19472
+ ] })
19375
19473
  ] }),
19376
19474
  /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { style: { flex: 1, minHeight: 0, display: "flex", flexDirection: "row" }, children: [
19377
19475
  /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
@@ -19435,7 +19533,7 @@ ${msg.content}`, streaming: false });
19435
19533
  }
19436
19534
  ),
19437
19535
  /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { style: { flex: 1, minWidth: 0, display: "flex", flexDirection: "column" }, children: [
19438
- taskMessages.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "messages messages--empty", children: "No messages in this execution yet. Agent will start on next tick." }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(MessageList, { items: taskMessagesToChatItems(taskMessages), sessionId: null }),
19536
+ taskMessages.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "messages messages--empty", children: "No messages in this execution yet. Agent will start on next tick." }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(MessageList, { items: taskMessagesToChatItems(taskMessages, agentLabels), sessionId: null }),
19439
19537
  /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("form", { className: "composer", onSubmit: onSend, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { style: { display: "flex", gap: "8px", alignItems: "flex-end" }, children: [
19440
19538
  /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
19441
19539
  "textarea",
@@ -19479,6 +19577,7 @@ ${msg.content}`, streaming: false });
19479
19577
  onToggleChecklistItem,
19480
19578
  onSetAgent,
19481
19579
  onSetFlag,
19580
+ onSetMaxRun,
19482
19581
  onOpenLog,
19483
19582
  statusColor
19484
19583
  }) {
@@ -19546,7 +19645,7 @@ ${msg.content}`, streaming: false });
19546
19645
  className: "confirm__btn confirm__btn--primary",
19547
19646
  onClick: () => onToggleStatus(task),
19548
19647
  style: { padding: "3px 10px", fontSize: "10px", display: "inline-flex", alignItems: "center", gap: "4px" },
19549
- children: task.status === "active" || task.status === "reviewing" ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
19648
+ children: task.status === "active" || task.status === "reviewing" || task.status === "planning" ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
19550
19649
  /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Pause, { size: 12 }),
19551
19650
  " Pause"
19552
19651
  ] }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
@@ -19678,7 +19777,31 @@ ${msg.content}`, streaming: false });
19678
19777
  ]
19679
19778
  }
19680
19779
  )
19681
- ] }, flag)) })
19780
+ ] }, flag)) }),
19781
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { style: { fontSize: "11px", display: "flex", flexDirection: "column", gap: "4px", marginTop: "12px", maxWidth: "260px" }, children: [
19782
+ "Max run seconds per cycle",
19783
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
19784
+ "input",
19785
+ {
19786
+ type: "number",
19787
+ min: 1,
19788
+ defaultValue: task.maxRunSeconds ?? "",
19789
+ placeholder: "Project default",
19790
+ title: "Wall-clock budget for one cycle, enforced as an abort. Empty = inherit the project (or the 120s native / 900s claude-code default).",
19791
+ onBlur: (e) => {
19792
+ const raw = e.target.value.trim();
19793
+ const n = raw === "" ? null : parseInt(raw, 10);
19794
+ const next = n !== null && Number.isFinite(n) && n > 0 ? n : null;
19795
+ if (next !== (task.maxRunSeconds ?? null)) onSetMaxRun(task, next);
19796
+ },
19797
+ onKeyDown: (e) => {
19798
+ if (e.key === "Enter") e.target.blur();
19799
+ },
19800
+ style: { background: "var(--vscode-input-background, #252526)", color: "var(--vscode-input-foreground)", border: "1px solid var(--vscode-input-border, #3c3c3c)", borderRadius: "4px", padding: "6px 8px", fontSize: "12px", outline: "none" }
19801
+ },
19802
+ task.maxRunSeconds ?? "default"
19803
+ )
19804
+ ] })
19682
19805
  ] }),
19683
19806
  task.status === "blocked" && task.blockedReason && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
19684
19807
  "div",