@sideboard-ai/core 0.1.324 → 0.1.326

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 (83) hide show
  1. package/dist/{abletime-CU2UPMJF.js → abletime-RDHYSZL2.js} +5 -4
  2. package/dist/{abletime-5ZY3ZUUO.js → abletime-RYYFGKMU.js} +6 -5
  3. package/dist/{abletime-oauth-7EOSBEFM.js → abletime-oauth-OYGS2DAU.js} +3 -3
  4. package/dist/{abletime-oauth-4TTCR3CT.js → abletime-oauth-QR2QDVMK.js} +3 -3
  5. package/dist/{abletime-rest-KOKE7V4B.js → abletime-rest-BKYKNPTC.js} +3 -3
  6. package/dist/{abletime-rest-3TG4G7LW.js → abletime-rest-QDPTWNS4.js} +3 -3
  7. package/dist/agents/claude-runner.cjs +59 -22
  8. package/dist/agents/claude-runner.js +39 -16
  9. package/dist/agents/cursor-runner.cjs +97 -32
  10. package/dist/agents/cursor-runner.js +74 -24
  11. package/dist/{agents-YK65UDLT.js → agents-HANWZNI6.js} +9 -8
  12. package/dist/{agents-LUSTCMDN.js → agents-QO7GKBYT.js} +12 -11
  13. package/dist/{app-settings-XIF4EC4K.js → app-settings-RXBH7KY4.js} +1 -1
  14. package/dist/{app-settings-I5HM5RMP.js → app-settings-TUVLZNDE.js} +1 -1
  15. package/dist/{chunk-7MQSYPAY.js → chunk-2EOLWHXH.js} +206 -188
  16. package/dist/{chunk-QOS4465Y.js → chunk-3Q4XNYHY.js} +1 -1
  17. package/dist/{chunk-RR4WCGNB.js → chunk-46FECFZU.js} +18 -15
  18. package/dist/{chunk-5GDJSFCT.js → chunk-4H5MWZ6J.js} +2 -2
  19. package/dist/{chunk-EQ52JR3Q.js → chunk-5MXLDDYF.js} +1 -1
  20. package/dist/{chunk-NCHOTN3C.js → chunk-5YCKATG6.js} +4 -3
  21. package/dist/{chunk-ROOZDDFA.js → chunk-75RPUXJS.js} +7 -8
  22. package/dist/{chunk-INBUV7HY.js → chunk-B244TJWC.js} +2 -2
  23. package/dist/{chunk-JH5SMVM5.js → chunk-BBNWKL4I.js} +268 -235
  24. package/dist/{chunk-ODH3XHMI.js → chunk-C7HUCBX7.js} +5 -5
  25. package/dist/{chunk-OIHRC2ZJ.js → chunk-D744HOI5.js} +25 -3
  26. package/dist/chunk-DBKHL7NC.js +214 -0
  27. package/dist/chunk-F6GE7V3Q.js +216 -0
  28. package/dist/{chunk-JE3JLHMO.js → chunk-FWVUGLBG.js} +3 -3
  29. package/dist/{chunk-DF5BM5OY.js → chunk-GP3RLZ6A.js} +207 -186
  30. package/dist/{chunk-FR3SAYUL.js → chunk-JM2TGOHP.js} +5 -5
  31. package/dist/{chunk-Y3WREIPQ.js → chunk-K7M7MIWL.js} +12 -210
  32. package/dist/{chunk-FUFNMUNR.js → chunk-KECHK3ZT.js} +7 -8
  33. package/dist/{chunk-EKU7FQVG.js → chunk-KXRF6RNL.js} +2 -2
  34. package/dist/chunk-LRHUBGEM.js +1259 -0
  35. package/dist/{chunk-MZIZTSR2.js → chunk-MAW7DIG7.js} +2 -2
  36. package/dist/{chunk-ZHGMRBSC.js → chunk-NURZOXGN.js} +4 -4
  37. package/dist/{chunk-QIC2JXHW.js → chunk-OOXRMTU6.js} +1 -1
  38. package/dist/{chunk-5XNT6BCG.js → chunk-OPXEJJBM.js} +1 -1
  39. package/dist/chunk-OYRN356W.js +80 -0
  40. package/dist/{chunk-7PVT73H6.js → chunk-PB6HW7SA.js} +12 -210
  41. package/dist/{chunk-B4CDSSRN.js → chunk-Q3FHTGIW.js} +2 -0
  42. package/dist/{chunk-7D5QIU3N.js → chunk-QG4CYRA3.js} +301 -268
  43. package/dist/{chunk-EJ66LEKH.js → chunk-QPSKQP6E.js} +24 -3
  44. package/dist/{chunk-Q3YJZPQI.js → chunk-RZVOX2MT.js} +3 -3
  45. package/dist/chunk-SO7G6O24.js +1445 -0
  46. package/dist/{chunk-YDUHLWI5.js → chunk-SUZOPJZC.js} +21 -7
  47. package/dist/chunk-TMCK5TLA.js +25 -0
  48. package/dist/chunk-W3ZLE4PO.js +77 -0
  49. package/dist/chunk-WUCAVIIP.js +28 -0
  50. package/dist/{chunk-BYUCNIXK.js → chunk-XLVLMQKN.js} +13 -9
  51. package/dist/{chunk-ZIRQZUZY.js → chunk-YGVGXQA7.js} +3 -3
  52. package/dist/{chunk-NXUN4U5P.js → chunk-YWQF7WAG.js} +2 -2
  53. package/dist/{chunk-IFWGG2M2.js → chunk-ZSHS46V5.js} +2 -0
  54. package/dist/{chunk-74OPNF7U.js → chunk-ZUAYA57W.js} +2 -2
  55. package/dist/{conductor-SPZOTC7W.js → conductor-4GVTHUUB.js} +7 -7
  56. package/dist/{conductor-JFABMXDA.js → conductor-TGWI6ETZ.js} +6 -6
  57. package/dist/{coordinator-prompt-K66RGNWK.js → coordinator-prompt-3E6SIDTM.js} +4 -4
  58. package/dist/{coordinator-prompt-Z6UFHFDH.js → coordinator-prompt-WEYJREV6.js} +4 -4
  59. package/dist/{cursor-recover-TEBFKAZ4.js → cursor-recover-7F46PAJ5.js} +1 -1
  60. package/dist/{cursor-recover-OWPQUHFH.js → cursor-recover-BDIAZIE3.js} +1 -1
  61. package/dist/{global-workspace-A6UO6PJV.js → global-workspace-FPDZKUPF.js} +4 -4
  62. package/dist/{global-workspace-RHEO55B4.js → global-workspace-UIEXAG2B.js} +4 -4
  63. package/dist/index.cjs +21094 -20840
  64. package/dist/index.d.cts +36 -17
  65. package/dist/index.d.ts +36 -17
  66. package/dist/index.js +343 -1678
  67. package/dist/linear-6S7MK5YK.js +69 -0
  68. package/dist/linear-Z2T4KUAQ.js +67 -0
  69. package/dist/linear-list-A37WLUBO.js +6 -0
  70. package/dist/linear-list-Q4M7AZO2.js +8 -0
  71. package/dist/mcp/run-stdio.cjs +15903 -15640
  72. package/dist/mcp/run-stdio.js +67 -1247
  73. package/dist/{optional-cli-RMMS5L6F.js → optional-cli-AANBL4U5.js} +3 -3
  74. package/dist/{optional-cli-Y3Z3GIPZ.js → optional-cli-CA4LL322.js} +4 -4
  75. package/dist/{orchestrator-7VTAUY24.js → orchestrator-7FVDBE7Y.js} +15 -13
  76. package/dist/{orchestrator-2O6OJQLX.js → orchestrator-RQXRZW7Z.js} +14 -12
  77. package/dist/{thread-store-3F7GR64A.js → thread-store-4ZN3DS2W.js} +1 -1
  78. package/dist/{thread-store-JRSL4HQY.js → thread-store-IC4BQXDW.js} +1 -1
  79. package/dist/{workspaces-NRKEXOYR.js → workspaces-LEW4UP56.js} +4 -4
  80. package/dist/{workspaces-42E6AGXD.js → workspaces-QONNLHNR.js} +4 -4
  81. package/dist/{worktree-ZDA2UJ7C.js → worktree-6GIONDQO.js} +3 -3
  82. package/dist/{worktree-4NGXCCUO.js → worktree-KFEJAQ2H.js} +3 -3
  83. package/package.json +1 -1
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-YBTSZ2SW.js";
10
10
  import {
11
11
  resolveAgentExecutable
12
- } from "./chunk-OIHRC2ZJ.js";
12
+ } from "./chunk-D744HOI5.js";
13
13
 
14
14
  // src/agents/install.ts
15
15
  import { existsSync } from "fs";
@@ -267,7 +267,7 @@ async function loginAgent(agent) {
267
267
  };
268
268
  }
269
269
  async function loginManagedAccount(accountId) {
270
- const { loadAppSettings } = await import("./app-settings-I5HM5RMP.js");
270
+ const { loadAppSettings } = await import("./app-settings-TUVLZNDE.js");
271
271
  const { loginEnvPrefix } = await import("./managed-accounts-PITLFLKU.js");
272
272
  const account = loadAppSettings().accounts.accounts.find((a) => a.id === accountId);
273
273
  if (!account) {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  extractJsonErrorMessage,
3
3
  formatUnknownDetail
4
- } from "./chunk-5XNT6BCG.js";
4
+ } from "./chunk-OPXEJJBM.js";
5
5
  import {
6
6
  npmGlobalNodeModules,
7
7
  run
@@ -555,7 +555,8 @@ function preferredCursorCostCents(cost) {
555
555
  }
556
556
  function turnCostUsdFromCursorUsage(before, after) {
557
557
  if (!after) return void 0;
558
- const beforeIds = new Set((before?.runs ?? []).map((r) => r.runId));
558
+ if (before == null) return void 0;
559
+ const beforeIds = new Set((before.runs ?? []).map((r) => r.runId));
559
560
  const newRuns = (after.runs ?? []).filter((r) => !beforeIds.has(r.runId));
560
561
  let sum = 0;
561
562
  let any = false;
@@ -567,7 +568,6 @@ function turnCostUsdFromCursorUsage(before, after) {
567
568
  }
568
569
  }
569
570
  if (any) return sum / 100;
570
- if (before == null) return void 0;
571
571
  const afterCents = preferredCursorCostCents(after.cost);
572
572
  if (afterCents == null) return void 0;
573
573
  const beforeCents = preferredCursorCostCents(before.cost) ?? 0;
@@ -757,7 +757,7 @@ function cursorSdkMessageToEvents(msg) {
757
757
  }
758
758
  if (msg.type === "usage") {
759
759
  const usage = usageFromCursor(msg.usage);
760
- if (usage) return [{ type: "usage", data: usage, scope: "request" }];
760
+ if (usage) return [{ type: "usage", data: usage, scope: "turn" }];
761
761
  }
762
762
  if (msg.type === "status" && msg.status === "ERROR") {
763
763
  const rawMessage = msg.message;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  clipToolResultForStore
3
- } from "./chunk-5XNT6BCG.js";
3
+ } from "./chunk-OPXEJJBM.js";
4
4
 
5
5
  // src/agents/message-parts.ts
6
6
  function asRecord(input) {
@@ -79,7 +79,7 @@ function extractJsonErrorMessage(obj) {
79
79
  const candidates = [
80
80
  typeof obj.message === "string" ? obj.message : null,
81
81
  typeof obj.error === "string" ? obj.error : null,
82
- nested && typeof nested.message === "string" ? nested.message : null,
82
+ nested && typeof nested.message === "string" ? nested.message : typeof nested?.data?.message === "string" ? nested.data.message : null,
83
83
  typeof obj.result === "string" ? obj.result : null,
84
84
  typeof obj.detail === "string" ? obj.detail : null
85
85
  ];
@@ -0,0 +1,80 @@
1
+ #!/usr/bin/env node
2
+
3
+
4
+ // src/integrations/issue-since.ts
5
+ var ISSUE_SINCE_ERROR = "updatedSince must be an ISO datetime, YYYY-MM-DD, or relative time (yesterday, 2d, 3 hours ago)";
6
+ var DATE_ONLY_RE = /^(\d{4})-(\d{2})-(\d{2})$/;
7
+ var DATE_TIME_RE = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/;
8
+ var RELATIVE_RE = /^(\d+)\s*(hours?|hrs?|h|days?|d|weeks?|wks?|w)(?:\s+ago)?$/i;
9
+ function startOfLocalDay(date) {
10
+ return new Date(date.getFullYear(), date.getMonth(), date.getDate());
11
+ }
12
+ function addLocalDays(date, days) {
13
+ return new Date(date.getFullYear(), date.getMonth(), date.getDate() + days);
14
+ }
15
+ function parseIssueSince(input, now = /* @__PURE__ */ new Date()) {
16
+ const raw = input.trim();
17
+ if (!raw) throw new Error(ISSUE_SINCE_ERROR);
18
+ const dateOnly = raw.match(DATE_ONLY_RE);
19
+ if (dateOnly) {
20
+ const year = Number(dateOnly[1]);
21
+ const month = Number(dateOnly[2]);
22
+ const day = Number(dateOnly[3]);
23
+ const local = new Date(year, month - 1, day);
24
+ if (local.getFullYear() !== year || local.getMonth() !== month - 1 || local.getDate() !== day) {
25
+ throw new Error(ISSUE_SINCE_ERROR);
26
+ }
27
+ return startOfLocalDay(local).toISOString();
28
+ }
29
+ if (DATE_TIME_RE.test(raw)) {
30
+ const ms = Date.parse(raw);
31
+ if (!Number.isFinite(ms)) throw new Error(ISSUE_SINCE_ERROR);
32
+ return new Date(ms).toISOString();
33
+ }
34
+ const lower = raw.toLowerCase();
35
+ if (lower === "today") return startOfLocalDay(now).toISOString();
36
+ if (lower === "yesterday") return addLocalDays(startOfLocalDay(now), -1).toISOString();
37
+ if (lower === "last week" || lower === "lastweek") {
38
+ return addLocalDays(startOfLocalDay(now), -7).toISOString();
39
+ }
40
+ const relative = lower.match(RELATIVE_RE);
41
+ if (relative) {
42
+ const n = Number(relative[1]);
43
+ if (!Number.isInteger(n) || n < 1) throw new Error(ISSUE_SINCE_ERROR);
44
+ const unit = relative[2];
45
+ if (unit.startsWith("h")) return new Date(now.getTime() - n * 36e5).toISOString();
46
+ if (unit.startsWith("w")) return addLocalDays(startOfLocalDay(now), -7 * n).toISOString();
47
+ return addLocalDays(startOfLocalDay(now), -n).toISOString();
48
+ }
49
+ throw new Error(ISSUE_SINCE_ERROR);
50
+ }
51
+ function formatGitHubSearchUpdatedSince(iso) {
52
+ return iso.replace(/\.\d{3}Z$/, "Z");
53
+ }
54
+ function issueMatchesUpdatedSince(issue, sinceIso) {
55
+ const ts = issue.updatedAt || issue.createdAt;
56
+ if (!ts) return false;
57
+ const value = Date.parse(ts);
58
+ const since = Date.parse(sinceIso);
59
+ return Number.isFinite(value) && Number.isFinite(since) && value >= since;
60
+ }
61
+ var ISSUE_COMMENT_PREVIEW_CHARS = 240;
62
+ function previewIssueCommentBody(body) {
63
+ const flat = body.replace(/\s+/g, " ").trim();
64
+ if (flat.length <= ISSUE_COMMENT_PREVIEW_CHARS) return flat;
65
+ return `${flat.slice(0, ISSUE_COMMENT_PREVIEW_CHARS - 1).trimEnd()}\u2026`;
66
+ }
67
+ function issueActivityKind(issue, sinceIso) {
68
+ const created = issue.createdAt ? Date.parse(issue.createdAt) : Number.NaN;
69
+ const since = Date.parse(sinceIso);
70
+ if (Number.isFinite(created) && Number.isFinite(since) && created >= since) return "created";
71
+ return "updated";
72
+ }
73
+
74
+ export {
75
+ parseIssueSince,
76
+ formatGitHubSearchUpdatedSince,
77
+ issueMatchesUpdatedSince,
78
+ previewIssueCommentBody,
79
+ issueActivityKind
80
+ };
@@ -1,223 +1,31 @@
1
+ import {
2
+ downloadAuthenticatedFile,
3
+ extractHttpUrls,
4
+ hostMatches,
5
+ issueAttachmentWorktreePath,
6
+ looksLikeFileUrl,
7
+ looksLikeHttpUrl,
8
+ mergeIssueAttachments
9
+ } from "./chunk-DBKHL7NC.js";
1
10
  import {
2
11
  abletimeRestUrl,
3
12
  textFromAbleTimeDoc
4
- } from "./chunk-EKU7FQVG.js";
13
+ } from "./chunk-KXRF6RNL.js";
5
14
  import {
6
15
  assertAbleTimeCredential,
7
16
  callAbleTimeTool,
8
17
  normalizeAbleTimeHost,
9
18
  rewriteAbleTimeError
10
- } from "./chunk-ODH3XHMI.js";
19
+ } from "./chunk-C7HUCBX7.js";
11
20
  import {
12
21
  httpFetch
13
22
  } from "./chunk-JAT3JFOS.js";
14
- import {
15
- ATTACHMENTS_DIR,
16
- attachmentsGitignoreBody
17
- } from "./chunk-6K64FJDD.js";
18
23
  import {
19
24
  getAbleTimeAccessToken,
20
25
  getAbleTimeHost,
21
26
  isAbleTimeConnected,
22
27
  saveAbleTimeConnection
23
- } from "./chunk-EJ66LEKH.js";
24
-
25
- // src/integrations/issue-attachments.ts
26
- import { existsSync, mkdirSync, writeFileSync } from "fs";
27
- import { basename, extname, join } from "path";
28
- import { randomUUID } from "crypto";
29
- var ISSUE_ATTACHMENT_MAX_BYTES = 25 * 1024 * 1024;
30
- var MARKDOWN_IMAGE_RE = /!\[[^\]]*]\(\s*<?(https?:\/\/[^)\s>]+)>?/gi;
31
- var MARKDOWN_LINK_RE = /(?<!!)\[[^\]]*]\(\s*<?(https?:\/\/[^)\s>]+)>?/gi;
32
- var HTML_SRC_RE = /\b(?:src|href)\s*=\s*["'](https?:\/\/[^"']+)["']/gi;
33
- var BARE_URL_RE = /https?:\/\/[^\s<>"'`)]+/gi;
34
- var EXT_BY_MIME = {
35
- "image/png": ".png",
36
- "image/jpeg": ".jpg",
37
- "image/jpg": ".jpg",
38
- "image/gif": ".gif",
39
- "image/webp": ".webp",
40
- "image/svg+xml": ".svg",
41
- "application/pdf": ".pdf",
42
- "text/plain": ".txt",
43
- "text/markdown": ".md",
44
- "application/json": ".json",
45
- "application/zip": ".zip"
46
- };
47
- function issueAttachmentWorktreePath(repoPath) {
48
- const raw = (repoPath ?? "").trim();
49
- return raw || process.cwd();
50
- }
51
- function ensureIssueAttachmentsDir(worktreePath) {
52
- const dir = join(worktreePath, ATTACHMENTS_DIR);
53
- mkdirSync(dir, { recursive: true });
54
- const gi = join(dir, ".gitignore");
55
- if (!existsSync(gi)) {
56
- writeFileSync(gi, attachmentsGitignoreBody(), "utf8");
57
- }
58
- return dir;
59
- }
60
- function hostnameOf(url) {
61
- try {
62
- return new URL(url).hostname.toLowerCase();
63
- } catch {
64
- return "";
65
- }
66
- }
67
- function hostMatches(url, suffixes) {
68
- const host = hostnameOf(url);
69
- if (!host) return false;
70
- return suffixes.some((suffix) => host === suffix || host.endsWith(`.${suffix}`));
71
- }
72
- function looksLikeHttpUrl(value) {
73
- return /^https?:\/\//i.test(value.trim());
74
- }
75
- function looksLikeFileUrl(url) {
76
- try {
77
- const path = new URL(url).pathname;
78
- return /\.[a-z0-9]{2,8}$/i.test(path);
79
- } catch {
80
- return false;
81
- }
82
- }
83
- function filenameFromUrl(url, fallback = "attachment") {
84
- try {
85
- const parsed = new URL(url);
86
- const last = decodeURIComponent(basename(parsed.pathname)).replace(/[/\\]/g, "_");
87
- if (last && last !== "/" && last !== ".") return last;
88
- } catch {
89
- }
90
- return fallback;
91
- }
92
- function filenameFromContentDisposition(header) {
93
- if (!header) return void 0;
94
- const star = header.match(/filename\*\s*=\s*(?:UTF-8''|utf-8'')([^;]+)/i);
95
- if (star?.[1]) {
96
- try {
97
- return decodeURIComponent(star[1].trim().replace(/^["']|["']$/g, ""));
98
- } catch {
99
- return star[1].trim().replace(/^["']|["']$/g, "");
100
- }
101
- }
102
- const plain = header.match(/filename\s*=\s*("(?:\\.|[^"])*"|[^;]+)/i);
103
- if (!plain?.[1]) return void 0;
104
- return plain[1].trim().replace(/^["']|["']$/g, "").replace(/\\"/g, '"');
105
- }
106
- function uniqueAttachmentFileName(dir, originalName) {
107
- const safe = originalName.replace(/[/\\]/g, "_").replace(/^\.+/, "") || "file";
108
- if (!existsSync(join(dir, safe))) return safe;
109
- const ext = extname(safe);
110
- const stem = ext ? safe.slice(0, -ext.length) : safe;
111
- for (let i = 1; i < 1e4; i++) {
112
- const candidate = `${stem}-${i}${ext}`;
113
- if (!existsSync(join(dir, candidate))) return candidate;
114
- }
115
- return `${stem}-${randomUUID()}${ext}`;
116
- }
117
- function extractHttpUrls(markdown) {
118
- const text = markdown ?? "";
119
- if (!text.trim()) return [];
120
- const found = [];
121
- const seen = /* @__PURE__ */ new Set();
122
- const push = (raw) => {
123
- const url = raw.replace(/[).,;]+$/, "");
124
- if (!looksLikeHttpUrl(url) || seen.has(url)) return;
125
- seen.add(url);
126
- found.push(url);
127
- };
128
- for (const re of [MARKDOWN_IMAGE_RE, MARKDOWN_LINK_RE, HTML_SRC_RE, BARE_URL_RE]) {
129
- re.lastIndex = 0;
130
- let match;
131
- while (match = re.exec(text)) {
132
- if (match[1]) push(match[1]);
133
- else if (re === BARE_URL_RE) push(match[0]);
134
- }
135
- }
136
- return found;
137
- }
138
- function mergeIssueAttachments(items) {
139
- const out = [];
140
- const seen = /* @__PURE__ */ new Set();
141
- for (const item of items) {
142
- if (!item) continue;
143
- const url = item.url.trim();
144
- const id = item.id.trim() || url;
145
- if (!id && !url) continue;
146
- const key = url || id;
147
- if (seen.has(key) || seen.has(id)) continue;
148
- seen.add(key);
149
- if (id !== key) seen.add(id);
150
- out.push({
151
- id: id || url,
152
- name: item.name.trim() || filenameFromUrl(url),
153
- url,
154
- ...item.contentType ? { contentType: item.contentType } : {},
155
- ...item.sourceType ? { sourceType: item.sourceType } : {}
156
- });
157
- }
158
- return out;
159
- }
160
- function extensionForContentType(contentType, name) {
161
- if (extname(name)) return name;
162
- const mime = (contentType ?? "").split(";")[0]?.trim().toLowerCase() ?? "";
163
- const ext = EXT_BY_MIME[mime];
164
- return ext ? `${name}${ext}` : name;
165
- }
166
- function assertNotHtml(contentType, url) {
167
- const mime = (contentType ?? "").split(";")[0]?.trim().toLowerCase() ?? "";
168
- if (mime === "text/html" || mime === "application/xhtml+xml") {
169
- throw new Error(
170
- `Attachment at ${url} returned HTML, not a file. Use the listed file URL (uploads / user-attachments), not a ticket or PR page.`
171
- );
172
- }
173
- }
174
- async function downloadAuthenticatedFile(opts) {
175
- const url = opts.url.trim();
176
- if (!looksLikeHttpUrl(url)) {
177
- throw new Error(`Attachment URL must be http(s) (got ${url || "empty"})`);
178
- }
179
- const res = await httpFetch(url, {
180
- method: "GET",
181
- redirect: "follow",
182
- headers: {
183
- Accept: "*/*",
184
- ...opts.headers ?? {}
185
- }
186
- });
187
- if (!res.ok) {
188
- const detail = await res.text().catch(() => "");
189
- throw new Error(
190
- `Attachment download failed ${res.status}${detail ? `: ${detail.slice(0, 200)}` : ""} (${url})`
191
- );
192
- }
193
- const contentType = res.headers.get("content-type") ?? void 0;
194
- assertNotHtml(contentType, url);
195
- const lengthHeader = res.headers.get("content-length");
196
- if (lengthHeader) {
197
- const length = Number(lengthHeader);
198
- if (Number.isFinite(length) && length > ISSUE_ATTACHMENT_MAX_BYTES) {
199
- throw new Error(
200
- `Attachment is ${length} bytes; max is ${ISSUE_ATTACHMENT_MAX_BYTES} (${url})`
201
- );
202
- }
203
- }
204
- const buf = Buffer.from(await res.arrayBuffer());
205
- if (buf.length > ISSUE_ATTACHMENT_MAX_BYTES) {
206
- throw new Error(
207
- `Attachment is ${buf.length} bytes; max is ${ISSUE_ATTACHMENT_MAX_BYTES} (${url})`
208
- );
209
- }
210
- const dir = ensureIssueAttachmentsDir(opts.worktreePath);
211
- const hinted = opts.name?.trim() || filenameFromContentDisposition(res.headers.get("content-disposition")) || filenameFromUrl(url);
212
- const name = uniqueAttachmentFileName(dir, extensionForContentType(contentType, hinted));
213
- writeFileSync(join(dir, name), buf);
214
- return {
215
- name,
216
- path: `${ATTACHMENTS_DIR}/${name}`,
217
- bytes: buf.length,
218
- ...contentType ? { contentType } : {}
219
- };
220
- }
28
+ } from "./chunk-QPSKQP6E.js";
221
29
 
222
30
  // src/integrations/abletime-attachments.ts
223
31
  function asRecord(value) {
@@ -839,12 +647,6 @@ async function verifyAbleTimeConnection(input) {
839
647
  }
840
648
 
841
649
  export {
842
- issueAttachmentWorktreePath,
843
- hostMatches,
844
- looksLikeHttpUrl,
845
- extractHttpUrls,
846
- mergeIssueAttachments,
847
- downloadAuthenticatedFile,
848
650
  downloadAbleTimeAttachment,
849
651
  taskUrl,
850
652
  mapAbleTimeTask,
@@ -1081,6 +1081,7 @@ function normalizeThread(raw) {
1081
1081
  approvedMcpServers: normalizeApprovedMcpServers(raw.approvedMcpServers),
1082
1082
  lastError: raw.lastError ?? null,
1083
1083
  agentPid: raw.agentPid ?? null,
1084
+ agentPidStartedAt: raw.agentPidStartedAt ?? null,
1084
1085
  attachments: Array.isArray(raw.attachments) ? raw.attachments : [],
1085
1086
  pendingTurnAttachments: Array.isArray(raw.pendingTurnAttachments) ? raw.pendingTurnAttachments : [],
1086
1087
  queueAttachments: Array.isArray(raw.queueAttachments) ? raw.queueAttachments : [],
@@ -1159,6 +1160,7 @@ function createEmptyThread(partial) {
1159
1160
  agent: partial.agent,
1160
1161
  lastError: null,
1161
1162
  agentPid: null,
1163
+ agentPidStartedAt: null,
1162
1164
  ...partial.accountId !== void 0 ? { accountId: partial.accountId } : {}
1163
1165
  };
1164
1166
  }