@sideboard-ai/core 0.1.326 → 0.1.327

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 (73) hide show
  1. package/dist/{abletime-RYYFGKMU.js → abletime-NW4PJGHN.js} +4 -5
  2. package/dist/{abletime-RDHYSZL2.js → abletime-OW7LTFQD.js} +4 -5
  3. package/dist/{abletime-oauth-OYGS2DAU.js → abletime-oauth-KWQQRHOQ.js} +3 -4
  4. package/dist/{abletime-oauth-QR2QDVMK.js → abletime-oauth-TPR2QDRI.js} +3 -4
  5. package/dist/{abletime-rest-QDPTWNS4.js → abletime-rest-5DCWN3P4.js} +3 -4
  6. package/dist/{abletime-rest-BKYKNPTC.js → abletime-rest-UJ6SXDBN.js} +3 -4
  7. package/dist/agents/claude-runner.cjs +11 -0
  8. package/dist/agents/claude-runner.js +7 -1
  9. package/dist/{agents-QO7GKBYT.js → agents-IYBY3JT5.js} +8 -9
  10. package/dist/{agents-HANWZNI6.js → agents-XWIPONJR.js} +8 -9
  11. package/dist/{app-settings-RXBH7KY4.js → app-settings-A5D364JD.js} +1 -2
  12. package/dist/{app-settings-TUVLZNDE.js → app-settings-SA4HX3ZQ.js} +1 -2
  13. package/dist/{chunk-3Q4XNYHY.js → chunk-2GEUFPQQ.js} +1 -1
  14. package/dist/{chunk-MAW7DIG7.js → chunk-4F7THWIO.js} +2 -2
  15. package/dist/{chunk-K7M7MIWL.js → chunk-4G3W23X3.js} +3 -3
  16. package/dist/{chunk-Q3FHTGIW.js → chunk-5Y2C7Q55.js} +441 -20
  17. package/dist/{chunk-TMCK5TLA.js → chunk-ATQLP22S.js} +1 -1
  18. package/dist/{chunk-PB6HW7SA.js → chunk-CHYUUETG.js} +3 -3
  19. package/dist/{chunk-QPSKQP6E.js → chunk-D446IWPP.js} +48 -3
  20. package/dist/{chunk-C7HUCBX7.js → chunk-DACWFN4O.js} +5 -5
  21. package/dist/{chunk-GP3RLZ6A.js → chunk-DEB47BII.js} +51 -487
  22. package/dist/{chunk-B244TJWC.js → chunk-ECY7WL6T.js} +2 -2
  23. package/dist/{chunk-D744HOI5.js → chunk-EJRCHCXM.js} +18 -3
  24. package/dist/{chunk-KXRF6RNL.js → chunk-EUIVQAPK.js} +2 -2
  25. package/dist/{chunk-46FECFZU.js → chunk-IXWPCOLQ.js} +8 -195
  26. package/dist/{chunk-75RPUXJS.js → chunk-JKHCADKB.js} +5 -5
  27. package/dist/{chunk-4H5MWZ6J.js → chunk-KLVW3J2B.js} +2 -2
  28. package/dist/{chunk-QG4CYRA3.js → chunk-MO46K6WK.js} +14 -14
  29. package/dist/{chunk-F2PVRF3B.js → chunk-N6ZF3XRP.js} +2 -1
  30. package/dist/{chunk-BBNWKL4I.js → chunk-NQGLDQYB.js} +8 -8
  31. package/dist/{chunk-YGVGXQA7.js → chunk-Q4UPRQOS.js} +12 -12
  32. package/dist/{chunk-ZUAYA57W.js → chunk-QMLDR63X.js} +2 -2
  33. package/dist/{chunk-KECHK3ZT.js → chunk-R2C45NHT.js} +2 -2
  34. package/dist/{chunk-FWVUGLBG.js → chunk-RDXODLEN.js} +4 -4
  35. package/dist/{chunk-XLVLMQKN.js → chunk-RZJ3QJZT.js} +11 -11
  36. package/dist/{chunk-JM2TGOHP.js → chunk-SB5ADEZZ.js} +5 -5
  37. package/dist/{chunk-SO7G6O24.js → chunk-SFXGD5KJ.js} +1 -1
  38. package/dist/{chunk-LRHUBGEM.js → chunk-TUH4ICHQ.js} +1 -1
  39. package/dist/chunk-ULWPSBAB.js +192 -0
  40. package/dist/{chunk-WUCAVIIP.js → chunk-UMXBH344.js} +1 -1
  41. package/dist/{chunk-RZVOX2MT.js → chunk-XBBZZHJY.js} +3 -3
  42. package/dist/{chunk-ZSHS46V5.js → chunk-Y6OHM672.js} +476 -20
  43. package/dist/{chunk-2EOLWHXH.js → chunk-YUHZEIVG.js} +69 -473
  44. package/dist/{chunk-YWQF7WAG.js → chunk-ZPBOWO64.js} +2 -2
  45. package/dist/{conductor-4GVTHUUB.js → conductor-CP7TW6TN.js} +7 -7
  46. package/dist/{conductor-TGWI6ETZ.js → conductor-D62Q2XJC.js} +6 -7
  47. package/dist/{coordinator-prompt-3E6SIDTM.js → coordinator-prompt-3PJLU3UH.js} +5 -6
  48. package/dist/{coordinator-prompt-WEYJREV6.js → coordinator-prompt-J7O7JB26.js} +5 -6
  49. package/dist/{global-workspace-UIEXAG2B.js → global-workspace-4CTLU2BV.js} +5 -6
  50. package/dist/{global-workspace-FPDZKUPF.js → global-workspace-Y3UDZYJX.js} +5 -6
  51. package/dist/index.cjs +507 -492
  52. package/dist/index.d.cts +5 -2
  53. package/dist/index.d.ts +5 -2
  54. package/dist/index.js +67 -65
  55. package/dist/{linear-6S7MK5YK.js → linear-CXWGH2TW.js} +2 -3
  56. package/dist/{linear-Z2T4KUAQ.js → linear-WLDCJ3AF.js} +2 -3
  57. package/dist/{linear-list-Q4M7AZO2.js → linear-list-52LEDEWO.js} +1 -1
  58. package/dist/{linear-list-A37WLUBO.js → linear-list-FGVN65JU.js} +1 -1
  59. package/dist/mcp/run-stdio.cjs +19654 -19641
  60. package/dist/mcp/run-stdio.js +33 -34
  61. package/dist/{optional-cli-CA4LL322.js → optional-cli-FN4MGB6W.js} +4 -5
  62. package/dist/{optional-cli-AANBL4U5.js → optional-cli-INRVBBBG.js} +3 -4
  63. package/dist/{orchestrator-7FVDBE7Y.js → orchestrator-EN3ZKD73.js} +12 -12
  64. package/dist/{orchestrator-RQXRZW7Z.js → orchestrator-W4TZBBDO.js} +11 -12
  65. package/dist/{thread-store-4ZN3DS2W.js → thread-store-4WE24XA2.js} +6 -2
  66. package/dist/{thread-store-IC4BQXDW.js → thread-store-K2ZNGUSM.js} +7 -3
  67. package/dist/{workspaces-LEW4UP56.js → workspaces-MM7CQYR6.js} +5 -6
  68. package/dist/{workspaces-QONNLHNR.js → workspaces-WYCVZ6XH.js} +5 -6
  69. package/dist/{worktree-KFEJAQ2H.js → worktree-JBNEMJ5Z.js} +7 -8
  70. package/dist/{worktree-6GIONDQO.js → worktree-NNVRGPP4.js} +4 -5
  71. package/package.json +1 -1
  72. package/dist/chunk-77WWLBCI.js +0 -50
  73. package/dist/chunk-KGZBYWZ3.js +0 -23
@@ -4,16 +4,24 @@ import {
4
4
  cursorSdkStoreDir
5
5
  } from "./chunk-WMZIANPV.js";
6
6
  import {
7
- normalizeThinkingEffort
8
- } from "./chunk-KGZBYWZ3.js";
7
+ caffeinateWhileSchedulesEnabled,
8
+ coerceOrchestratorAgent,
9
+ isOrchestratorCapableAgent,
10
+ normalizeThinkingEffort,
11
+ updateAdvancedSettings
12
+ } from "./chunk-EJRCHCXM.js";
9
13
  import {
14
+ writePrivateFile
15
+ } from "./chunk-NSTQ6QKD.js";
16
+ import {
17
+ appDataDir,
10
18
  threadFilePath,
11
19
  threadLockPath,
12
20
  threadsDir
13
21
  } from "./chunk-WOU343SI.js";
14
22
 
15
23
  // src/store/thread-store.ts
16
- import { randomUUID } from "crypto";
24
+ import { randomUUID as randomUUID2 } from "crypto";
17
25
 
18
26
  // src/review/review-write-gate.ts
19
27
  var REVIEW_TAB_TITLE = "Review";
@@ -961,8 +969,8 @@ function isWorktreeIdentityTitle(title, identities) {
961
969
 
962
970
  // src/store/thread-store.ts
963
971
  import {
964
- existsSync,
965
- readFileSync,
972
+ existsSync as existsSync2,
973
+ readFileSync as readFileSync2,
966
974
  renameSync,
967
975
  rmSync,
968
976
  statSync,
@@ -1008,7 +1016,8 @@ var BASE_ALLOWED_TOOLS = [
1008
1016
  "TaskStop",
1009
1017
  "EnterWorktree",
1010
1018
  "ExitWorktree",
1011
- "Skill"
1019
+ "Skill",
1020
+ "AskUserQuestion"
1012
1021
  ];
1013
1022
  var CLAUDE_PRINT_BG_WAIT_CEILING_MS = 72e5;
1014
1023
  var CLAUDE_CHROME_ALLOWED_TOOLS = [
@@ -1021,8 +1030,412 @@ var CLAUDE_POSTHOG_CONNECTOR_ALLOWED_TOOLS = [
1021
1030
  "mcp__claude_ai_PostHog__*"
1022
1031
  ];
1023
1032
 
1033
+ // src/store/schedules.ts
1034
+ import { randomUUID } from "crypto";
1035
+ import { existsSync, readFileSync } from "fs";
1036
+ import { join } from "path";
1037
+
1038
+ // src/store/schedule-when.ts
1039
+ import { Cron } from "croner";
1040
+ var DURATION_RE = /^(\d+)(s|m|h|d)$/i;
1041
+ var UNIT_MS = {
1042
+ s: 1e3,
1043
+ m: 6e4,
1044
+ h: 36e5,
1045
+ d: 864e5
1046
+ };
1047
+ var DAY_ALIASES = {
1048
+ sun: 0,
1049
+ sunday: 0,
1050
+ mon: 1,
1051
+ monday: 1,
1052
+ tue: 2,
1053
+ tues: 2,
1054
+ tuesday: 2,
1055
+ wed: 3,
1056
+ wednesday: 3,
1057
+ thu: 4,
1058
+ thur: 4,
1059
+ thurs: 4,
1060
+ thursday: 4,
1061
+ fri: 5,
1062
+ friday: 5,
1063
+ sat: 6,
1064
+ saturday: 6
1065
+ };
1066
+ var TIME_RE = /^([01]\d|2[0-3]):([0-5]\d)(?::[0-5]\d)?$/;
1067
+ function parseDurationMs(every) {
1068
+ const m = every.trim().match(DURATION_RE);
1069
+ if (!m) return null;
1070
+ const n = Number.parseInt(m[1], 10);
1071
+ if (!Number.isFinite(n) || n <= 0) return null;
1072
+ const unit = m[2].toLowerCase();
1073
+ return n * UNIT_MS[unit];
1074
+ }
1075
+ function dayIndex(token) {
1076
+ const text = token.trim().toLowerCase();
1077
+ if (/^[0-6]$/.test(text)) return Number(text);
1078
+ return DAY_ALIASES[text];
1079
+ }
1080
+ function normalizeWeekdays(days) {
1081
+ const set = /* @__PURE__ */ new Set();
1082
+ for (const day of days) {
1083
+ if (!Number.isInteger(day) || day < 0 || day > 6) {
1084
+ throw new Error("Days must be 0 (Sunday) through 6 (Saturday)");
1085
+ }
1086
+ set.add(day);
1087
+ }
1088
+ if (set.size === 0) throw new Error("Pick at least one day");
1089
+ return [...set].sort((a, b) => a - b);
1090
+ }
1091
+ function parseWeeklyDays(raw) {
1092
+ const text = raw.trim().toLowerCase();
1093
+ if (!text) throw new Error("Pick at least one day");
1094
+ if (text === "daily" || text === "all" || text === "every day" || text === "everyday") {
1095
+ return [0, 1, 2, 3, 4, 5, 6];
1096
+ }
1097
+ if (text === "weekdays" || text === "weekday") return [1, 2, 3, 4, 5];
1098
+ if (text === "weekends" || text === "weekend") return [0, 6];
1099
+ const days = [];
1100
+ for (const part of text.split(/[\s,]+/).filter(Boolean)) {
1101
+ const range = part.split("-");
1102
+ if (range.length === 2 && range[0] && range[1]) {
1103
+ const start = dayIndex(range[0]);
1104
+ const end = dayIndex(range[1]);
1105
+ if (start === void 0 || end === void 0) {
1106
+ throw new Error(`Unknown day: ${part} (use mon,tue, weekdays, weekends, or daily)`);
1107
+ }
1108
+ if (start <= end) {
1109
+ for (let d = start; d <= end; d++) days.push(d);
1110
+ } else {
1111
+ for (let d = start; d <= 6; d++) days.push(d);
1112
+ for (let d = 0; d <= end; d++) days.push(d);
1113
+ }
1114
+ continue;
1115
+ }
1116
+ const n = dayIndex(part);
1117
+ if (n === void 0) {
1118
+ throw new Error(`Unknown day: ${part} (use mon,tue, weekdays, weekends, or daily)`);
1119
+ }
1120
+ days.push(n);
1121
+ }
1122
+ return normalizeWeekdays(days);
1123
+ }
1124
+ function normalizeWeeklyTime(raw) {
1125
+ const m = raw.trim().match(TIME_RE);
1126
+ if (!m) throw new Error(`Invalid time: ${raw} (use HH:mm, 24-hour)`);
1127
+ return `${m[1]}:${m[2]}`;
1128
+ }
1129
+ function weeklyCronExpr(when) {
1130
+ const time = normalizeWeeklyTime(when.time);
1131
+ const [hh, mm] = time.split(":");
1132
+ const days = normalizeWeekdays(when.days);
1133
+ return `${Number(mm)} ${Number(hh)} * * ${days.join(",")}`;
1134
+ }
1135
+ function computeNextRunAt(when, from = /* @__PURE__ */ new Date()) {
1136
+ if (when.kind === "once") {
1137
+ const at = new Date(when.at);
1138
+ if (Number.isNaN(at.getTime())) {
1139
+ throw new Error(`Invalid once-at datetime: ${when.at}`);
1140
+ }
1141
+ return at;
1142
+ }
1143
+ if (when.kind === "every") {
1144
+ const ms = parseDurationMs(when.every);
1145
+ if (!ms) {
1146
+ throw new Error(`Invalid interval: ${when.every} (use 15m, 1h, 6h, 1d)`);
1147
+ }
1148
+ return new Date(from.getTime() + ms);
1149
+ }
1150
+ if (when.kind === "weekly") {
1151
+ return computeNextRunAt(
1152
+ { kind: "cron", expr: weeklyCronExpr(when), tz: when.tz },
1153
+ from
1154
+ );
1155
+ }
1156
+ try {
1157
+ const job = new Cron(when.expr, {
1158
+ timezone: when.tz?.trim() || void 0,
1159
+ paused: true
1160
+ });
1161
+ const next = job.nextRun(from);
1162
+ if (!next) {
1163
+ throw new Error(`Cron expression has no next run: ${when.expr}`);
1164
+ }
1165
+ return next;
1166
+ } catch (err) {
1167
+ const message = err instanceof Error ? err.message : String(err);
1168
+ throw new Error(`Invalid cron: ${message}`);
1169
+ }
1170
+ }
1171
+ function normalizeWhen(raw) {
1172
+ if (!raw || typeof raw !== "object") {
1173
+ throw new Error("Schedule is missing `when`");
1174
+ }
1175
+ const rec = raw;
1176
+ const kind = rec.kind;
1177
+ if (kind === "once" && typeof rec.at === "string") {
1178
+ return { kind: "once", at: rec.at };
1179
+ }
1180
+ if (kind === "every" && typeof rec.every === "string") {
1181
+ return { kind: "every", every: rec.every };
1182
+ }
1183
+ if (kind === "cron" && typeof rec.expr === "string") {
1184
+ return {
1185
+ kind: "cron",
1186
+ expr: rec.expr,
1187
+ tz: typeof rec.tz === "string" && rec.tz.trim() ? rec.tz.trim() : void 0
1188
+ };
1189
+ }
1190
+ if (kind === "weekly" && Array.isArray(rec.days) && typeof rec.time === "string") {
1191
+ return {
1192
+ kind: "weekly",
1193
+ days: normalizeWeekdays(rec.days.map((day) => Number(day))),
1194
+ time: normalizeWeeklyTime(rec.time),
1195
+ tz: typeof rec.tz === "string" && rec.tz.trim() ? rec.tz.trim() : void 0
1196
+ };
1197
+ }
1198
+ throw new Error("Schedule `when` must be once, every, weekly, or cron");
1199
+ }
1200
+
1201
+ // src/store/schedules.ts
1202
+ function schedulesPath() {
1203
+ return join(appDataDir(), "schedules.json");
1204
+ }
1205
+ function defaultScheduleName(prompt) {
1206
+ const line = prompt.trim().split(/\r?\n/, 1)[0]?.trim() ?? "";
1207
+ if (!line) return "Untitled automation";
1208
+ return line.length > 60 ? `${line.slice(0, 57).trimEnd()}\u2026` : line;
1209
+ }
1210
+ function resolveScheduleThreadId(raw, env = process.env) {
1211
+ const value = raw?.trim() || "";
1212
+ if (!value) return null;
1213
+ if (value.toLowerCase() === "self") {
1214
+ return env.SIDEBOARD_ORCHESTRATOR_THREAD_ID?.trim() || env.SIDEBOARD_THREAD_ID?.trim() || null;
1215
+ }
1216
+ return value;
1217
+ }
1218
+ function nowIso(d = /* @__PURE__ */ new Date()) {
1219
+ return d.toISOString();
1220
+ }
1221
+ var ATTACHMENT_KINDS = /* @__PURE__ */ new Set([
1222
+ "transcript",
1223
+ "file",
1224
+ "issue",
1225
+ "workspace",
1226
+ "diff-comment",
1227
+ "code-ref"
1228
+ ]);
1229
+ function normalizeOptionalBool(raw) {
1230
+ if (raw === true || raw === false) return raw;
1231
+ return null;
1232
+ }
1233
+ function normalizeAutonomy(raw) {
1234
+ return raw === "default" || raw === "full" ? raw : null;
1235
+ }
1236
+ function normalizeAttachments(raw) {
1237
+ if (!Array.isArray(raw)) return [];
1238
+ const out = [];
1239
+ for (const item of raw) {
1240
+ if (!item || typeof item !== "object") continue;
1241
+ const row = item;
1242
+ if (typeof row.id !== "string" || !row.id.trim()) continue;
1243
+ if (typeof row.name !== "string" || !row.name) continue;
1244
+ if (typeof row.content !== "string") continue;
1245
+ if (!ATTACHMENT_KINDS.has(row.kind)) continue;
1246
+ const next = {
1247
+ id: row.id,
1248
+ name: row.name,
1249
+ kind: row.kind,
1250
+ content: row.content
1251
+ };
1252
+ if (typeof row.path === "string" && row.path) next.path = row.path;
1253
+ if (typeof row.previewDataUrl === "string" && row.previewDataUrl) {
1254
+ next.previewDataUrl = row.previewDataUrl;
1255
+ }
1256
+ out.push(next);
1257
+ }
1258
+ return out;
1259
+ }
1260
+ function normalizeTask(raw) {
1261
+ const when = normalizeWhen(raw.when);
1262
+ const agent = raw.agent && isOrchestratorCapableAgent(raw.agent) ? raw.agent : null;
1263
+ return {
1264
+ id: raw.id,
1265
+ name: typeof raw.name === "string" && raw.name.trim() ? raw.name.trim() : defaultScheduleName(raw.prompt),
1266
+ prompt: String(raw.prompt ?? ""),
1267
+ enabled: Boolean(raw.enabled),
1268
+ when,
1269
+ threadId: raw.threadId?.trim() || null,
1270
+ agent,
1271
+ model: raw.model?.trim() || null,
1272
+ effort: normalizeThinkingEffort(raw.effort),
1273
+ fast: normalizeOptionalBool(raw.fast),
1274
+ planMode: normalizeOptionalBool(raw.planMode),
1275
+ autonomy: normalizeAutonomy(raw.autonomy),
1276
+ attachments: normalizeAttachments(raw.attachments),
1277
+ archiveChat: raw.archiveChat !== false,
1278
+ nextRunAt: raw.nextRunAt,
1279
+ lastRunAt: raw.lastRunAt ?? null,
1280
+ lastThreadId: raw.lastThreadId ?? null,
1281
+ lastError: raw.lastError ?? null,
1282
+ createdBy: raw.createdBy === "mcp" || raw.createdBy === "cli" || raw.createdBy === "ui" ? raw.createdBy : "ui",
1283
+ createdAt: raw.createdAt,
1284
+ updatedAt: raw.updatedAt
1285
+ };
1286
+ }
1287
+ function readAll() {
1288
+ const path = schedulesPath();
1289
+ if (!existsSync(path)) return [];
1290
+ try {
1291
+ const parsed = JSON.parse(readFileSync(path, "utf8"));
1292
+ if (!Array.isArray(parsed)) return [];
1293
+ return parsed.map((row) => {
1294
+ try {
1295
+ return normalizeTask(row);
1296
+ } catch {
1297
+ return null;
1298
+ }
1299
+ }).filter((row) => Boolean(row?.id && row.prompt));
1300
+ } catch {
1301
+ return [];
1302
+ }
1303
+ }
1304
+ function writeAll(rows) {
1305
+ writePrivateFile(schedulesPath(), `${JSON.stringify(rows, null, 2)}
1306
+ `);
1307
+ }
1308
+ function buildTask(input, now) {
1309
+ const prompt = input.prompt.trim();
1310
+ if (!prompt) throw new Error("Schedule prompt is required");
1311
+ const when = normalizeWhen(input.when);
1312
+ const nextRunAt = computeNextRunAt(when, now).toISOString();
1313
+ const ts = nowIso(now);
1314
+ const agent = input.agent ? coerceOrchestratorAgent(input.agent) : null;
1315
+ return {
1316
+ id: randomUUID(),
1317
+ name: input.name?.trim() || defaultScheduleName(prompt),
1318
+ prompt,
1319
+ enabled: input.enabled !== false,
1320
+ when,
1321
+ threadId: input.threadId?.trim() || null,
1322
+ agent,
1323
+ model: input.model?.trim() || null,
1324
+ effort: input.effort != null ? normalizeThinkingEffort(input.effort) : null,
1325
+ fast: normalizeOptionalBool(input.fast),
1326
+ planMode: normalizeOptionalBool(input.planMode),
1327
+ autonomy: normalizeAutonomy(input.autonomy),
1328
+ attachments: normalizeAttachments(input.attachments),
1329
+ archiveChat: input.archiveChat !== false,
1330
+ nextRunAt,
1331
+ lastRunAt: null,
1332
+ lastThreadId: null,
1333
+ lastError: null,
1334
+ createdBy: input.createdBy,
1335
+ createdAt: ts,
1336
+ updatedAt: ts
1337
+ };
1338
+ }
1339
+ function listSchedules() {
1340
+ return readAll().sort((a, b) => a.nextRunAt.localeCompare(b.nextRunAt));
1341
+ }
1342
+ function scheduleNeedsCaffeinate(task, now = /* @__PURE__ */ new Date()) {
1343
+ if (!task.enabled) return false;
1344
+ const at = new Date(task.nextRunAt);
1345
+ if (Number.isNaN(at.getTime())) return false;
1346
+ return at.getTime() > now.getTime();
1347
+ }
1348
+ function ensureCaffeinateForFutureSchedule(task) {
1349
+ if (!scheduleNeedsCaffeinate(task)) return;
1350
+ if (caffeinateWhileSchedulesEnabled()) return;
1351
+ updateAdvancedSettings({ caffeinateWhileSchedules: true });
1352
+ }
1353
+ function getSchedule(id) {
1354
+ const key = id.trim();
1355
+ if (!key) return null;
1356
+ return readAll().find(
1357
+ (row) => row.id === key || row.id.startsWith(key) && key.length >= 8
1358
+ ) ?? null;
1359
+ }
1360
+ function createSchedule(input) {
1361
+ const task = buildTask(input, /* @__PURE__ */ new Date());
1362
+ const rows = readAll();
1363
+ rows.push(task);
1364
+ writeAll(rows);
1365
+ ensureCaffeinateForFutureSchedule(task);
1366
+ return task;
1367
+ }
1368
+ function updateSchedule(id, patch) {
1369
+ const rows = readAll();
1370
+ const idx = rows.findIndex((row) => row.id === id || id.length >= 8 && row.id.startsWith(id));
1371
+ if (idx < 0) throw new Error(`Automation not found: ${id}`);
1372
+ const prev = rows[idx];
1373
+ const when = patch.when ? normalizeWhen(patch.when) : prev.when;
1374
+ const prompt = patch.prompt !== void 0 ? patch.prompt.trim() : prev.prompt;
1375
+ if (!prompt) throw new Error("Schedule prompt is required");
1376
+ const whenChanged = patch.when !== void 0;
1377
+ const next = {
1378
+ ...prev,
1379
+ name: patch.name !== void 0 ? patch.name.trim() || defaultScheduleName(prompt) : prev.name,
1380
+ prompt,
1381
+ enabled: patch.enabled ?? prev.enabled,
1382
+ when,
1383
+ threadId: patch.threadId !== void 0 ? patch.threadId?.trim() || null : prev.threadId,
1384
+ agent: patch.agent !== void 0 ? patch.agent ? coerceOrchestratorAgent(patch.agent) : null : prev.agent,
1385
+ model: patch.model !== void 0 ? patch.model?.trim() || null : prev.model,
1386
+ effort: patch.effort !== void 0 ? normalizeThinkingEffort(patch.effort) : prev.effort,
1387
+ fast: patch.fast !== void 0 ? normalizeOptionalBool(patch.fast) : prev.fast,
1388
+ planMode: patch.planMode !== void 0 ? normalizeOptionalBool(patch.planMode) : prev.planMode,
1389
+ autonomy: patch.autonomy !== void 0 ? normalizeAutonomy(patch.autonomy) : prev.autonomy,
1390
+ attachments: patch.attachments !== void 0 ? normalizeAttachments(patch.attachments) : prev.attachments,
1391
+ archiveChat: patch.archiveChat !== void 0 ? patch.archiveChat !== false : prev.archiveChat,
1392
+ nextRunAt: whenChanged ? computeNextRunAt(when).toISOString() : prev.nextRunAt,
1393
+ lastError: whenChanged ? null : prev.lastError,
1394
+ updatedAt: nowIso()
1395
+ };
1396
+ rows[idx] = next;
1397
+ writeAll(rows);
1398
+ ensureCaffeinateForFutureSchedule(next);
1399
+ return next;
1400
+ }
1401
+ function deleteSchedulesForThread(threadId) {
1402
+ const id = threadId.trim();
1403
+ if (!id) return;
1404
+ const rows = readAll();
1405
+ const next = rows.filter((row) => row.threadId !== id);
1406
+ if (next.length === rows.length) return;
1407
+ writeAll(next);
1408
+ }
1409
+ function deleteSchedule(id) {
1410
+ const rows = readAll();
1411
+ const next = rows.filter(
1412
+ (row) => row.id !== id && !(id.length >= 8 && row.id.startsWith(id))
1413
+ );
1414
+ if (next.length === rows.length) throw new Error(`Automation not found: ${id}`);
1415
+ writeAll(next);
1416
+ }
1417
+ function recordScheduleRun(id, result) {
1418
+ const rows = readAll();
1419
+ const idx = rows.findIndex((row) => row.id === id);
1420
+ if (idx < 0) throw new Error(`Automation not found: ${id}`);
1421
+ const prev = rows[idx];
1422
+ const firedAt = result.firedAt ?? /* @__PURE__ */ new Date();
1423
+ const next = {
1424
+ ...prev,
1425
+ enabled: prev.when.kind === "once" ? false : prev.enabled,
1426
+ nextRunAt: prev.when.kind === "once" ? prev.nextRunAt : computeNextRunAt(prev.when, firedAt).toISOString(),
1427
+ lastRunAt: nowIso(firedAt),
1428
+ lastThreadId: result.lastThreadId !== void 0 ? result.lastThreadId : prev.lastThreadId,
1429
+ lastError: result.lastError ?? null,
1430
+ updatedAt: nowIso(firedAt)
1431
+ };
1432
+ rows[idx] = next;
1433
+ writeAll(rows);
1434
+ return next;
1435
+ }
1436
+
1024
1437
  // src/store/thread-store.ts
1025
- function nowIso() {
1438
+ function nowIso2() {
1026
1439
  return (/* @__PURE__ */ new Date()).toISOString();
1027
1440
  }
1028
1441
  function resolveThreadEffort(raw) {
@@ -1111,9 +1524,9 @@ function normalizeThread(raw) {
1111
1524
  };
1112
1525
  }
1113
1526
  function createEmptyThread(partial) {
1114
- const ts = nowIso();
1527
+ const ts = nowIso2();
1115
1528
  return {
1116
- id: randomUUID(),
1529
+ id: randomUUID2(),
1117
1530
  sessionId: partial.sessionId ?? null,
1118
1531
  autonomy: partial.autonomy ?? "default",
1119
1532
  model: partial.model ?? null,
@@ -1221,7 +1634,7 @@ function readThread(id) {
1221
1634
  const cache = cacheForDir();
1222
1635
  const cached = cache.byId.get(id);
1223
1636
  if (cached && cache.mtimeMs.get(id) === mtimeMs) return cached;
1224
- const raw = readFileSync(path, "utf8");
1637
+ const raw = readFileSync2(path, "utf8");
1225
1638
  const thread = normalizeThread(JSON.parse(raw));
1226
1639
  rememberThread(thread, mtimeMs);
1227
1640
  return thread;
@@ -1230,7 +1643,7 @@ var selfWriteMtimes = /* @__PURE__ */ new Map();
1230
1643
  function writeThread(thread, opts) {
1231
1644
  const path = threadFilePath(idPath(thread.id));
1232
1645
  const tmp = `${path}.${process.pid}.tmp`;
1233
- const next = opts?.touch === false ? { ...thread } : { ...thread, updatedAt: nowIso() };
1646
+ const next = opts?.touch === false ? { ...thread } : { ...thread, updatedAt: nowIso2() };
1234
1647
  writeFileSync(tmp, JSON.stringify(next, null, 2), "utf8");
1235
1648
  renameSync(tmp, path);
1236
1649
  const mtimeMs = fileMtimeMs(path) ?? Date.now();
@@ -1274,30 +1687,29 @@ function listThreads(opts) {
1274
1687
  function deleteThreadRecord(id) {
1275
1688
  forgetThread(id);
1276
1689
  const path = threadFilePath(id);
1277
- if (existsSync(path)) unlinkSync(path);
1278
- const lock = threadLockPath(id);
1279
- if (existsSync(lock)) {
1280
- try {
1281
- unlinkSync(lock);
1282
- } catch {
1283
- }
1690
+ if (existsSync2(path)) unlinkSync(path);
1691
+ try {
1692
+ if (existsSync2(threadLockPath(id))) unlinkSync(threadLockPath(id));
1693
+ } catch {
1284
1694
  }
1285
1695
  try {
1286
1696
  rmSync(cursorSdkStoreDir(id), { recursive: true, force: true });
1287
1697
  } catch {
1288
1698
  }
1699
+ deleteSchedulesForThread(id);
1289
1700
  }
1290
1701
  function updateThread(id, patch) {
1291
1702
  const current = readThread(id);
1292
1703
  if (!current) throw new Error(`Thread not found: ${id}`);
1293
- const next = { ...current, ...patch, id: current.id, updatedAt: nowIso() };
1704
+ const next = { ...current, ...patch, id: current.id, updatedAt: nowIso2() };
1294
1705
  if (next.status === "archived") {
1295
- next.archivedAt = typeof next.archivedAt === "string" && next.archivedAt.trim() || current.archivedAt || nowIso();
1706
+ next.archivedAt = typeof next.archivedAt === "string" && next.archivedAt.trim() || current.archivedAt || nowIso2();
1296
1707
  } else {
1297
1708
  delete next.archivedAt;
1298
1709
  }
1299
1710
  if (!next.ephemeralAutomationId?.trim()) delete next.ephemeralAutomationId;
1300
1711
  writeThread(next);
1712
+ if (patch.status === "archived" && current.status !== "archived") deleteSchedulesForThread(current.id);
1301
1713
  return next;
1302
1714
  }
1303
1715
  function appendMessage(id, message) {
@@ -1345,6 +1757,15 @@ export {
1345
1757
  CLAUDE_PRINT_BG_WAIT_CEILING_MS,
1346
1758
  CLAUDE_CHROME_ALLOWED_TOOLS,
1347
1759
  CLAUDE_POSTHOG_CONNECTOR_ALLOWED_TOOLS,
1760
+ parseWeeklyDays,
1761
+ resolveScheduleThreadId,
1762
+ listSchedules,
1763
+ scheduleNeedsCaffeinate,
1764
+ getSchedule,
1765
+ createSchedule,
1766
+ updateSchedule,
1767
+ deleteSchedule,
1768
+ recordScheduleRun,
1348
1769
  resolveThreadEffort,
1349
1770
  normalizeThread,
1350
1771
  createEmptyThread,
@@ -2,7 +2,7 @@
2
2
  var LIST_TIMEOUT_MS = 15e3;
3
3
  async function listAssignedLinearIssues(opts) {
4
4
  try {
5
- const { listLinearIssuesDirect } = await import("./linear-Z2T4KUAQ.js");
5
+ const { listLinearIssuesDirect } = await import("./linear-WLDCJ3AF.js");
6
6
  const listed = listLinearIssuesDirect({ limit: 50 }).catch(() => []);
7
7
  let timer;
8
8
  try {
@@ -10,13 +10,13 @@ import {
10
10
  import {
11
11
  abletimeRestUrl,
12
12
  textFromAbleTimeDoc
13
- } from "./chunk-KXRF6RNL.js";
13
+ } from "./chunk-EUIVQAPK.js";
14
14
  import {
15
15
  assertAbleTimeCredential,
16
16
  callAbleTimeTool,
17
17
  normalizeAbleTimeHost,
18
18
  rewriteAbleTimeError
19
- } from "./chunk-C7HUCBX7.js";
19
+ } from "./chunk-DACWFN4O.js";
20
20
  import {
21
21
  httpFetch
22
22
  } from "./chunk-JAT3JFOS.js";
@@ -25,7 +25,7 @@ import {
25
25
  getAbleTimeHost,
26
26
  isAbleTimeConnected,
27
27
  saveAbleTimeConnection
28
- } from "./chunk-QPSKQP6E.js";
28
+ } from "./chunk-D446IWPP.js";
29
29
 
30
30
  // src/integrations/abletime-attachments.ts
31
31
  function asRecord(value) {
@@ -1,6 +1,3 @@
1
- import {
2
- normalizeThinkingEffort
3
- } from "./chunk-77WWLBCI.js";
4
1
  import {
5
2
  stripNestedElectronEnv
6
3
  } from "./chunk-4TR3HZFT.js";
@@ -53,6 +50,48 @@ function coerceOrchestratorAgent(agent, fallback = "claude") {
53
50
  return isOrchestratorCapableAgent(agent) ? agent : fallback;
54
51
  }
55
52
 
53
+ // src/types/thinking-effort.ts
54
+ var THINKING_EFFORTS = [
55
+ "low",
56
+ "medium",
57
+ "high",
58
+ "xhigh",
59
+ "max"
60
+ ];
61
+ var EFFORT_SET = new Set(THINKING_EFFORTS);
62
+ function normalizeThinkingEffort(value) {
63
+ if (typeof value !== "string") return null;
64
+ const v = value.trim().toLowerCase();
65
+ if (v === "normal") return "medium";
66
+ if (EFFORT_SET.has(v)) return v;
67
+ return null;
68
+ }
69
+ function isThinkingEffort(value) {
70
+ return typeof value === "string" && EFFORT_SET.has(value.trim().toLowerCase());
71
+ }
72
+ function nextThinkingEffort(current) {
73
+ const i = THINKING_EFFORTS.indexOf(current);
74
+ return THINKING_EFFORTS[(i + 1) % THINKING_EFFORTS.length];
75
+ }
76
+ function thinkingEffortBars(effort) {
77
+ const i = THINKING_EFFORTS.indexOf(effort);
78
+ return i >= 0 ? i + 1 : 3;
79
+ }
80
+ function thinkingEffortLabel(effort) {
81
+ switch (effort) {
82
+ case "low":
83
+ return "Low";
84
+ case "medium":
85
+ return "Medium";
86
+ case "high":
87
+ return "High";
88
+ case "xhigh":
89
+ return "Extra High";
90
+ case "max":
91
+ return "Max";
92
+ }
93
+ }
94
+
56
95
  // src/store/thread-option-defaults.ts
57
96
  function normalizeAutonomy(value) {
58
97
  return value === "default" || value === "full" ? value : void 0;
@@ -2583,6 +2622,12 @@ function harnessEnvKey(harness) {
2583
2622
  }
2584
2623
 
2585
2624
  export {
2625
+ THINKING_EFFORTS,
2626
+ normalizeThinkingEffort,
2627
+ isThinkingEffort,
2628
+ nextThinkingEffort,
2629
+ thinkingEffortBars,
2630
+ thinkingEffortLabel,
2586
2631
  ORCHESTRATOR_AGENT_KINDS,
2587
2632
  isOrchestratorCapableAgent,
2588
2633
  assertOrchestratorCapableAgent,
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  getAbleTimeHost,
6
6
  isAbleTimeConnected
7
- } from "./chunk-QPSKQP6E.js";
7
+ } from "./chunk-D446IWPP.js";
8
8
 
9
9
  // src/integrations/abletime-mcp.ts
10
10
  var DEFAULT_ABLETIME_HOST = "https://track.abletime.com";
@@ -153,7 +153,7 @@ function textsFromUnknown(value) {
153
153
  return "";
154
154
  }
155
155
  async function abletimeMcpRequest(method, params, opts) {
156
- const rawToken = opts?.token ?? await import("./abletime-oauth-OYGS2DAU.js").then((m) => m.ensureAbleTimeAccessToken());
156
+ const rawToken = opts?.token ?? await import("./abletime-oauth-KWQQRHOQ.js").then((m) => m.ensureAbleTimeAccessToken());
157
157
  if (!rawToken?.trim()) {
158
158
  throw new Error("AbleTime is not connected \u2014 paste a personal access token in Account settings");
159
159
  }
@@ -224,9 +224,9 @@ async function callAbleTimeTool(name, args = {}, opts) {
224
224
  if (!opts?.token && !isAbleTimeConnected()) {
225
225
  throw new Error("AbleTime is not connected \u2014 paste a personal access token in Account settings");
226
226
  }
227
- const rawToken = opts?.token ?? await import("./abletime-oauth-OYGS2DAU.js").then((m) => m.ensureAbleTimeAccessToken());
227
+ const rawToken = opts?.token ?? await import("./abletime-oauth-KWQQRHOQ.js").then((m) => m.ensureAbleTimeAccessToken());
228
228
  if (rawToken && ableTimeUsesRest(rawToken)) {
229
- const { callAbleTimeRestTool } = await import("./abletime-rest-BKYKNPTC.js");
229
+ const { callAbleTimeRestTool } = await import("./abletime-rest-UJ6SXDBN.js");
230
230
  return callAbleTimeRestTool(name, args, { ...opts, token: rawToken });
231
231
  }
232
232
  const requestOpts = { ...opts, pm: opts?.pm ?? abletimeToolUsesPm(name) };
@@ -242,7 +242,7 @@ async function callAbleTimeTool(name, args = {}, opts) {
242
242
  return await call();
243
243
  }
244
244
  if (rawToken && ableTimeUsesRest(rawToken) && isAbleTimeRejectedCredential(message)) {
245
- const { callAbleTimeRestTool } = await import("./abletime-rest-BKYKNPTC.js");
245
+ const { callAbleTimeRestTool } = await import("./abletime-rest-UJ6SXDBN.js");
246
246
  return callAbleTimeRestTool(name, args, { ...opts, token: rawToken });
247
247
  }
248
248
  throw err instanceof Error ? new Error(rewriteAbleTimeError(err.message)) : err;