@geteigen/cli 0.0.0-stage → 3.1.0

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 (172) hide show
  1. package/README.md +154 -2
  2. package/dist/agent.d.ts +32 -0
  3. package/dist/agent.js +246 -0
  4. package/dist/auth.d.ts +5 -0
  5. package/dist/auth.js +33 -0
  6. package/dist/cli/src/agent.d.ts +24 -0
  7. package/dist/cli/src/agent.js +263 -0
  8. package/dist/cli/src/agentTools.d.ts +6 -0
  9. package/dist/cli/src/agentTools.js +104 -0
  10. package/dist/cli/src/auth.d.ts +5 -0
  11. package/dist/cli/src/auth.js +33 -0
  12. package/dist/cli/src/cliEnv.d.ts +6 -0
  13. package/dist/cli/src/cliEnv.js +26 -0
  14. package/dist/cli/src/config.d.ts +11 -0
  15. package/dist/cli/src/config.js +51 -0
  16. package/dist/cli/src/cursorAuth.d.ts +10 -0
  17. package/dist/cli/src/cursorAuth.js +92 -0
  18. package/dist/cli/src/gitAuthEnv.d.ts +5 -0
  19. package/dist/cli/src/gitAuthEnv.js +35 -0
  20. package/dist/cli/src/index.d.ts +2 -0
  21. package/dist/cli/src/index.js +244 -0
  22. package/dist/cli/src/listModels.d.ts +14 -0
  23. package/dist/cli/src/listModels.js +196 -0
  24. package/dist/cli/src/listSessions.d.ts +9 -0
  25. package/dist/cli/src/listSessions.js +37 -0
  26. package/dist/cli/src/machineConfig.d.ts +20 -0
  27. package/dist/cli/src/machineConfig.js +66 -0
  28. package/dist/cli/src/pickFolder.d.ts +5 -0
  29. package/dist/cli/src/pickFolder.js +65 -0
  30. package/dist/cli/src/proc.d.ts +31 -0
  31. package/dist/cli/src/proc.js +97 -0
  32. package/dist/cli/src/service.d.ts +17 -0
  33. package/dist/cli/src/service.js +255 -0
  34. package/dist/cli/src/workRoots.d.ts +30 -0
  35. package/dist/cli/src/workRoots.js +228 -0
  36. package/dist/cli/src/worker.d.ts +8 -0
  37. package/dist/cli/src/worker.js +51 -0
  38. package/dist/cli/src/workerCore.d.ts +47 -0
  39. package/dist/cli/src/workerCore.js +721 -0
  40. package/dist/cli/src/workspace.d.ts +10 -0
  41. package/dist/cli/src/workspace.js +329 -0
  42. package/dist/config.d.ts +11 -0
  43. package/dist/config.js +51 -0
  44. package/dist/cursorAuth.d.ts +10 -0
  45. package/dist/cursorAuth.js +95 -0
  46. package/dist/index.d.ts +2 -0
  47. package/dist/index.js +108 -0
  48. package/dist/listModels.d.ts +6 -0
  49. package/dist/listModels.js +62 -0
  50. package/dist/listSessions.d.ts +9 -0
  51. package/dist/listSessions.js +37 -0
  52. package/dist/pickFolder.d.ts +5 -0
  53. package/dist/pickFolder.js +65 -0
  54. package/dist/shared/actionDrafts.d.ts +83 -0
  55. package/dist/shared/actionDrafts.js +169 -0
  56. package/dist/shared/agentArtifacts.d.ts +49 -0
  57. package/dist/shared/agentArtifacts.js +169 -0
  58. package/dist/shared/agentLabel.d.ts +18 -0
  59. package/dist/shared/agentLabel.js +22 -0
  60. package/dist/shared/agentMentions.d.ts +38 -0
  61. package/dist/shared/agentMentions.js +110 -0
  62. package/dist/shared/agentRepos.d.ts +28 -0
  63. package/dist/shared/agentRepos.js +60 -0
  64. package/dist/shared/agentRunStatus.d.ts +12 -0
  65. package/dist/shared/agentRunStatus.js +17 -0
  66. package/dist/shared/agentUsage.d.ts +24 -0
  67. package/dist/shared/agentUsage.js +139 -0
  68. package/dist/shared/approvals.d.ts +44 -0
  69. package/dist/shared/approvals.js +97 -0
  70. package/dist/shared/askEigen.d.ts +190 -0
  71. package/dist/shared/askEigen.js +76 -0
  72. package/dist/shared/attribution.d.ts +25 -0
  73. package/dist/shared/attribution.js +63 -0
  74. package/dist/shared/automations.d.ts +135 -0
  75. package/dist/shared/automations.js +553 -0
  76. package/dist/shared/backends/claudeCode.d.ts +44 -0
  77. package/dist/shared/backends/claudeCode.js +548 -0
  78. package/dist/shared/backends/codex.d.ts +15 -0
  79. package/dist/shared/backends/codex.js +287 -0
  80. package/dist/shared/backends/cursor.d.ts +111 -0
  81. package/dist/shared/backends/cursor.js +1216 -0
  82. package/dist/shared/backends/index.d.ts +18 -0
  83. package/dist/shared/backends/index.js +58 -0
  84. package/dist/shared/backends/opencode.d.ts +43 -0
  85. package/dist/shared/backends/opencode.js +415 -0
  86. package/dist/shared/backends/types.d.ts +171 -0
  87. package/dist/shared/backends/types.js +19 -0
  88. package/dist/shared/backends/usage.d.ts +8 -0
  89. package/dist/shared/backends/usage.js +71 -0
  90. package/dist/shared/billingPlans.d.ts +60 -0
  91. package/dist/shared/billingPlans.js +262 -0
  92. package/dist/shared/brain.d.ts +353 -0
  93. package/dist/shared/brain.js +487 -0
  94. package/dist/shared/clarifyingQuestions.d.ts +13 -0
  95. package/dist/shared/clarifyingQuestions.js +207 -0
  96. package/dist/shared/claudeModels.d.ts +10 -0
  97. package/dist/shared/claudeModels.js +52 -0
  98. package/dist/shared/cloudBackends.d.ts +21 -0
  99. package/dist/shared/cloudBackends.js +29 -0
  100. package/dist/shared/codexModels.d.ts +10 -0
  101. package/dist/shared/codexModels.js +28 -0
  102. package/dist/shared/contextWindows.d.ts +2 -0
  103. package/dist/shared/contextWindows.js +30 -0
  104. package/dist/shared/cursorMcpConfig.d.ts +14 -0
  105. package/dist/shared/cursorMcpConfig.js +43 -0
  106. package/dist/shared/cursorProjectMcp.d.ts +10 -0
  107. package/dist/shared/cursorProjectMcp.js +42 -0
  108. package/dist/shared/docs.d.ts +59 -0
  109. package/dist/shared/docs.js +87 -0
  110. package/dist/shared/events.d.ts +932 -0
  111. package/dist/shared/events.js +57 -0
  112. package/dist/shared/integrations.d.ts +266 -0
  113. package/dist/shared/integrations.js +449 -0
  114. package/dist/shared/issueTranscript.d.ts +64 -0
  115. package/dist/shared/issueTranscript.js +387 -0
  116. package/dist/shared/issues.d.ts +139 -0
  117. package/dist/shared/issues.js +217 -0
  118. package/dist/shared/machines.d.ts +119 -0
  119. package/dist/shared/machines.js +58 -0
  120. package/dist/shared/markdownMedia.d.ts +13 -0
  121. package/dist/shared/markdownMedia.js +41 -0
  122. package/dist/shared/notificationText.d.ts +6 -0
  123. package/dist/shared/notificationText.js +38 -0
  124. package/dist/shared/opencodeModels.d.ts +19 -0
  125. package/dist/shared/opencodeModels.js +62 -0
  126. package/dist/shared/opencodeSession.d.ts +7 -0
  127. package/dist/shared/opencodeSession.js +30 -0
  128. package/dist/shared/orchestration.d.ts +58 -0
  129. package/dist/shared/orchestration.js +12 -0
  130. package/dist/shared/orgs.d.ts +47 -0
  131. package/dist/shared/orgs.js +49 -0
  132. package/dist/shared/personalOrg.d.ts +5 -0
  133. package/dist/shared/personalOrg.js +12 -0
  134. package/dist/shared/plans.d.ts +3 -0
  135. package/dist/shared/plans.js +19 -0
  136. package/dist/shared/providerModels.d.ts +40 -0
  137. package/dist/shared/providerModels.js +503 -0
  138. package/dist/shared/roomAttention.d.ts +17 -0
  139. package/dist/shared/roomAttention.js +36 -0
  140. package/dist/shared/roomContext.d.ts +120 -0
  141. package/dist/shared/roomContext.js +133 -0
  142. package/dist/shared/roomPermissions.d.ts +56 -0
  143. package/dist/shared/roomPermissions.js +133 -0
  144. package/dist/shared/sessionSeats.d.ts +29 -0
  145. package/dist/shared/sessionSeats.js +57 -0
  146. package/dist/shared/slashCommands.d.ts +39 -0
  147. package/dist/shared/slashCommands.js +166 -0
  148. package/dist/shared/space.d.ts +33 -0
  149. package/dist/shared/space.js +54 -0
  150. package/dist/shared/spaceFeed.d.ts +78 -0
  151. package/dist/shared/spaceFeed.js +194 -0
  152. package/dist/shared/stringifyUnknown.d.ts +1 -0
  153. package/dist/shared/stringifyUnknown.js +1 -0
  154. package/dist/shared/swarm.d.ts +320 -0
  155. package/dist/shared/swarm.js +328 -0
  156. package/dist/shared/swarmVisual.d.ts +79 -0
  157. package/dist/shared/swarmVisual.js +212 -0
  158. package/dist/shared/terminalFilter.d.ts +13 -0
  159. package/dist/shared/terminalFilter.js +46 -0
  160. package/dist/shared/toolIntegration.d.ts +56 -0
  161. package/dist/shared/toolIntegration.js +180 -0
  162. package/dist/shared/typing.d.ts +9 -0
  163. package/dist/shared/typing.js +37 -0
  164. package/dist/shared/uploads.d.ts +31 -0
  165. package/dist/shared/uploads.js +65 -0
  166. package/dist/shared/voiceApprovals.d.ts +36 -0
  167. package/dist/shared/voiceApprovals.js +229 -0
  168. package/dist/shared/workspace.d.ts +49 -0
  169. package/dist/shared/workspace.js +53 -0
  170. package/dist/worker.d.ts +1 -0
  171. package/dist/worker.js +266 -0
  172. package/package.json +51 -4
@@ -0,0 +1,387 @@
1
+ export function emptyIssueTranscript(partial) {
2
+ return {
3
+ cursorAgentId: null,
4
+ available: false,
5
+ live: false,
6
+ error: null,
7
+ runs: [],
8
+ items: [],
9
+ ...partial,
10
+ };
11
+ }
12
+ export function parseStoredTranscriptItems(raw) {
13
+ if (raw == null)
14
+ return [];
15
+ let parsed = raw;
16
+ if (typeof raw === "string") {
17
+ const trimmed = raw.trim();
18
+ if (!trimmed)
19
+ return [];
20
+ try {
21
+ parsed = JSON.parse(trimmed);
22
+ }
23
+ catch {
24
+ return [];
25
+ }
26
+ }
27
+ if (!Array.isArray(parsed))
28
+ return [];
29
+ const items = [];
30
+ for (const row of parsed) {
31
+ if (!isRecord(row))
32
+ continue;
33
+ const kind = asText(row.kind);
34
+ if (kind !== "user" &&
35
+ kind !== "assistant" &&
36
+ kind !== "thinking" &&
37
+ kind !== "tool" &&
38
+ kind !== "error") {
39
+ continue;
40
+ }
41
+ const text = asText(row.text);
42
+ const toolName = asText(row.toolName);
43
+ if (!text && kind !== "tool")
44
+ continue;
45
+ items.push({
46
+ id: asText(row.id) || `stored:${items.length + 1}`,
47
+ kind,
48
+ text: text || toolName || "tool",
49
+ toolName: toolName || undefined,
50
+ detail: asText(row.detail) || undefined,
51
+ path: asText(row.path) || undefined,
52
+ status: row.status === "running" || row.status === "done" || row.status === "error"
53
+ ? row.status
54
+ : undefined,
55
+ runId: asText(row.runId) || undefined,
56
+ });
57
+ }
58
+ return items;
59
+ }
60
+ export function applyIssueStreamEvent(items, event) {
61
+ const next = items.slice();
62
+ if (event.kind === "user") {
63
+ const text = event.text.trim();
64
+ if (!text)
65
+ return next;
66
+ next.push({
67
+ id: `${event.runId || "run"}:user:${next.length}`,
68
+ kind: "user",
69
+ text,
70
+ runId: event.runId,
71
+ });
72
+ return next;
73
+ }
74
+ if (event.kind === "assistant") {
75
+ const text = event.text.trim();
76
+ if (!text)
77
+ return next;
78
+ for (let i = next.length - 1; i >= 0; i--) {
79
+ const item = next[i];
80
+ if (item.kind === "assistant" && (!event.runId || item.runId === event.runId)) {
81
+ next[i] = { ...item, text };
82
+ return next;
83
+ }
84
+ if (item.kind === "user")
85
+ break;
86
+ }
87
+ next.push({
88
+ id: `${event.runId || "run"}:assistant:${next.length}`,
89
+ kind: "assistant",
90
+ text,
91
+ runId: event.runId,
92
+ });
93
+ return next;
94
+ }
95
+ if (event.kind === "thinking") {
96
+ const text = event.text.trim();
97
+ if (!text)
98
+ return next;
99
+ for (let i = next.length - 1; i >= 0; i--) {
100
+ const item = next[i];
101
+ if (item.kind === "thinking" && (!event.runId || item.runId === event.runId)) {
102
+ next[i] = { ...item, text };
103
+ return next;
104
+ }
105
+ if (item.kind === "user" || item.kind === "assistant" || item.kind === "tool")
106
+ break;
107
+ }
108
+ next.push({
109
+ id: `${event.runId || "run"}:thinking:${next.length}`,
110
+ kind: "thinking",
111
+ text,
112
+ runId: event.runId,
113
+ });
114
+ return next;
115
+ }
116
+ if (event.kind === "error") {
117
+ const text = event.text.trim();
118
+ if (!text)
119
+ return next;
120
+ next.push({
121
+ id: `${event.runId || "run"}:error:${next.length}`,
122
+ kind: "error",
123
+ text,
124
+ runId: event.runId,
125
+ });
126
+ return next;
127
+ }
128
+ const id = `${event.runId || "run"}:tool:${event.callId}`;
129
+ const idx = next.findIndex((item) => item.id === id);
130
+ const row = {
131
+ id,
132
+ kind: "tool",
133
+ text: event.detail || event.path || event.name,
134
+ toolName: event.name,
135
+ detail: event.detail,
136
+ path: event.path,
137
+ status: event.kind === "tool_start" ? "running" : "done",
138
+ runId: event.runId,
139
+ };
140
+ if (idx >= 0)
141
+ next[idx] = row;
142
+ else
143
+ next.push(row);
144
+ return next;
145
+ }
146
+ /**
147
+ * Build a chat timeline from listed/hydrated Cursor run metadata.
148
+ * `run.conversation()` is avoided here — on cloud that replays SSE.
149
+ */
150
+ export function transcriptItemsFromListedRuns(runs) {
151
+ const items = [];
152
+ for (const run of runs) {
153
+ const result = run.result?.trim();
154
+ if (result) {
155
+ items.push({
156
+ id: `${run.id}:result`,
157
+ kind: "assistant",
158
+ text: result,
159
+ runId: run.id,
160
+ });
161
+ }
162
+ const error = run.error?.trim();
163
+ if (run.status === "error" && error) {
164
+ items.push({
165
+ id: `${run.id}:error`,
166
+ kind: "error",
167
+ text: error,
168
+ runId: run.id,
169
+ });
170
+ }
171
+ if (run.status === "running" && !result) {
172
+ items.push({
173
+ id: `${run.id}:running`,
174
+ kind: "tool",
175
+ text: "Run in progress",
176
+ toolName: "run",
177
+ status: "running",
178
+ runId: run.id,
179
+ });
180
+ }
181
+ }
182
+ return items;
183
+ }
184
+ function isRecord(value) {
185
+ return Boolean(value) && typeof value === "object" && !Array.isArray(value);
186
+ }
187
+ function asText(value) {
188
+ return typeof value === "string" ? value : "";
189
+ }
190
+ function toolPath(args, result) {
191
+ const fromArgs = pathFromRecord(args);
192
+ if (fromArgs)
193
+ return fromArgs;
194
+ if (!isRecord(result))
195
+ return undefined;
196
+ if (isRecord(result.value))
197
+ return pathFromRecord(result.value);
198
+ return pathFromRecord(result);
199
+ }
200
+ function pathFromRecord(value) {
201
+ if (!isRecord(value))
202
+ return undefined;
203
+ for (const key of [
204
+ "path",
205
+ "filePath",
206
+ "file_path",
207
+ "target_file",
208
+ "targetFile",
209
+ ]) {
210
+ const raw = value[key];
211
+ if (typeof raw === "string" && raw.trim())
212
+ return raw.trim();
213
+ }
214
+ return undefined;
215
+ }
216
+ function toolDetail(name, args) {
217
+ if (!isRecord(args))
218
+ return "";
219
+ const command = asText(args.command).trim();
220
+ if (command)
221
+ return command.slice(0, 200);
222
+ const query = asText(args.pattern ??
223
+ args.globPattern ??
224
+ args.glob_pattern ??
225
+ args.query ??
226
+ args.targetDirectory).trim();
227
+ if (query)
228
+ return query.slice(0, 200);
229
+ const path = pathFromRecord(args);
230
+ if (path)
231
+ return path;
232
+ if (name === "updateTodos" || name === "todo") {
233
+ const todos = Array.isArray(args.todos) ? args.todos : [];
234
+ return todos.length
235
+ ? `${todos.length} todo${todos.length === 1 ? "" : "s"}`
236
+ : "Updating todos";
237
+ }
238
+ return "";
239
+ }
240
+ function toolStatus(result) {
241
+ if (!isRecord(result))
242
+ return "running";
243
+ if (result.status === "error" || result.status === "failure")
244
+ return "error";
245
+ if (result.status === "success" || result.value !== undefined)
246
+ return "done";
247
+ return "done";
248
+ }
249
+ function toolResultDetail(result, fallback) {
250
+ if (!isRecord(result))
251
+ return fallback;
252
+ if (result.status === "error") {
253
+ const err = result.error;
254
+ if (typeof err === "string" && err.trim())
255
+ return err.trim().slice(0, 240);
256
+ if (isRecord(err) && typeof err.message === "string") {
257
+ return err.message.trim().slice(0, 240);
258
+ }
259
+ return fallback || "error";
260
+ }
261
+ const value = isRecord(result.value) ? result.value : result;
262
+ const stdout = asText(value.stdout).trim();
263
+ if (stdout)
264
+ return stdout.split("\n")[0].slice(0, 200);
265
+ const path = pathFromRecord(value);
266
+ if (path)
267
+ return path;
268
+ if (typeof value.linesCreated === "number") {
269
+ return `${value.linesCreated} lines`;
270
+ }
271
+ if (typeof value.exitCode === "number")
272
+ return `exit ${value.exitCode}`;
273
+ return fallback;
274
+ }
275
+ function nextId(runId, seq) {
276
+ seq.n += 1;
277
+ return `${runId}:${seq.n}`;
278
+ }
279
+ function pushUser(items, runId, seq, text) {
280
+ const trimmed = text.trim();
281
+ if (!trimmed)
282
+ return;
283
+ items.push({
284
+ id: nextId(runId, seq),
285
+ kind: "user",
286
+ text: trimmed,
287
+ runId,
288
+ });
289
+ }
290
+ function convertAgentSteps(items, runId, seq, steps) {
291
+ if (!Array.isArray(steps))
292
+ return;
293
+ for (const step of steps) {
294
+ if (!isRecord(step))
295
+ continue;
296
+ const type = asText(step.type);
297
+ const message = isRecord(step.message) ? step.message : {};
298
+ if (type === "assistantMessage") {
299
+ const text = asText(message.text).trim();
300
+ if (!text)
301
+ continue;
302
+ items.push({
303
+ id: nextId(runId, seq),
304
+ kind: "assistant",
305
+ text,
306
+ runId,
307
+ });
308
+ continue;
309
+ }
310
+ if (type === "thinkingMessage") {
311
+ const text = asText(message.text).trim();
312
+ if (!text)
313
+ continue;
314
+ items.push({
315
+ id: nextId(runId, seq),
316
+ kind: "thinking",
317
+ text,
318
+ runId,
319
+ });
320
+ continue;
321
+ }
322
+ if (type !== "toolCall")
323
+ continue;
324
+ const toolName = asText(message.type) || "tool";
325
+ const args = message.args;
326
+ const result = message.result;
327
+ const startDetail = toolDetail(toolName, args);
328
+ const path = toolPath(args, result);
329
+ const status = toolStatus(result);
330
+ items.push({
331
+ id: nextId(runId, seq),
332
+ kind: "tool",
333
+ text: startDetail || path || toolName,
334
+ toolName,
335
+ detail: toolResultDetail(result, startDetail || path || ""),
336
+ path,
337
+ status,
338
+ runId,
339
+ });
340
+ }
341
+ }
342
+ function convertOneTurn(items, runId, seq, raw) {
343
+ if (!isRecord(raw))
344
+ return;
345
+ const type = asText(raw.type);
346
+ const turn = isRecord(raw.turn) ? raw.turn : raw;
347
+ if (type === "shellConversationTurn" || ("shellCommand" in turn && !("steps" in turn))) {
348
+ const command = isRecord(turn.shellCommand)
349
+ ? asText(turn.shellCommand.command).trim()
350
+ : "";
351
+ const output = isRecord(turn.shellOutput) ? turn.shellOutput : null;
352
+ const stdout = output ? asText(output.stdout).trim() : "";
353
+ const exitCode = output && typeof output.exitCode === "number" ? output.exitCode : undefined;
354
+ items.push({
355
+ id: nextId(runId, seq),
356
+ kind: "tool",
357
+ text: command || "shell",
358
+ toolName: "shell",
359
+ detail: stdout.split("\n")[0]?.slice(0, 200) ||
360
+ (exitCode !== undefined ? `exit ${exitCode}` : command),
361
+ status: output ? (exitCode === 0 || exitCode === undefined ? "done" : "error") : "running",
362
+ runId,
363
+ });
364
+ return;
365
+ }
366
+ if (isRecord(turn.userMessage)) {
367
+ pushUser(items, runId, seq, asText(turn.userMessage.text));
368
+ }
369
+ else if (typeof turn.text === "string" && type === "user") {
370
+ pushUser(items, runId, seq, turn.text);
371
+ }
372
+ convertAgentSteps(items, runId, seq, turn.steps);
373
+ }
374
+ /**
375
+ * Flatten Cursor `run.conversation()` turns into a read-only chat timeline.
376
+ * Pure: does not call Cursor.
377
+ */
378
+ export function conversationTurnsToItems(runId, turns) {
379
+ if (!Array.isArray(turns))
380
+ return [];
381
+ const items = [];
382
+ const seq = { n: 0 };
383
+ for (const turn of turns) {
384
+ convertOneTurn(items, runId, seq, turn);
385
+ }
386
+ return items;
387
+ }
@@ -0,0 +1,139 @@
1
+ import type { AgentBackendKind } from "./backends/types.js";
2
+ export declare const ISSUE_STATUSES: readonly ["draft", "queued", "running", "needs_input", "in_review", "done", "failed", "cancelled"];
3
+ export type IssueStatus = (typeof ISSUE_STATUSES)[number];
4
+ export declare const ISSUE_PRIORITIES: readonly ["low", "medium", "high", "urgent"];
5
+ export type IssuePriority = (typeof ISSUE_PRIORITIES)[number];
6
+ export declare const DEFAULT_PICKUP_DELAY_MS: number;
7
+ export declare const MIN_PICKUP_DELAY_MS = 0;
8
+ export declare const MAX_PICKUP_DELAY_MS: number;
9
+ export declare const DEFAULT_MAX_CONCURRENT_ISSUES = 2;
10
+ export declare const MAX_CONCURRENT_ISSUES_CAP = 8;
11
+ export declare const LINEAR_PROVIDER = "linear";
12
+ export declare const DEFAULT_ALLOW_AGENT_SPAWN = false;
13
+ export declare const DEFAULT_MAX_SPAWN_PER_BATCH = 10;
14
+ export declare const MAX_SPAWN_PER_BATCH_CAP = 20;
15
+ export declare const MAX_LINEAR_IMPORT_ISSUES = 20;
16
+ export declare const ISSUE_LEASE_MS: number;
17
+ export declare const ISSUE_POLL_MS = 15000;
18
+ export declare const ISSUE_HEARTBEAT_MS = 30000;
19
+ export declare const MAX_ISSUE_TITLE = 200;
20
+ export declare const MAX_ISSUE_DESCRIPTION = 20000;
21
+ export declare const MAX_WRITEUP_CHARS = 80000;
22
+ export declare const MAX_ISSUE_ATTACHMENTS = 8;
23
+ export declare const MAX_ISSUE_ATTACHMENT_BYTES: number;
24
+ export declare const MAX_ISSUE_ATTEMPTS = 3;
25
+ export interface IssueAttachmentInfo {
26
+ id: string;
27
+ issueId: string;
28
+ name: string;
29
+ mime: string;
30
+ size: number;
31
+ url: string;
32
+ createdAt: number;
33
+ }
34
+ export interface IssueEventInfo {
35
+ id: string;
36
+ issueId: string;
37
+ kind: string;
38
+ message: string;
39
+ createdAt: number;
40
+ }
41
+ export interface IssueInfo {
42
+ id: string;
43
+ orgId?: string | null;
44
+ creatorId: string;
45
+ creatorName?: string | null;
46
+ title: string;
47
+ description: string;
48
+ repoUrl: string;
49
+ startingRef: string;
50
+ priority: IssuePriority;
51
+ status: IssueStatus;
52
+ pickupDelayMs: number;
53
+ runAfter: number;
54
+ startedAt?: number | null;
55
+ finishedAt?: number | null;
56
+ /** Which agent runs it. Older issues are Cursor. */
57
+ backend: AgentBackendKind;
58
+ /** Run on this Machine instead of the cloud (null = cloud). */
59
+ machineId?: string | null;
60
+ machineName?: string | null;
61
+ modelId: string;
62
+ cursorAgentId?: string | null;
63
+ prUrl?: string | null;
64
+ branch?: string | null;
65
+ error?: string | null;
66
+ writeupMd?: string | null;
67
+ attempt: number;
68
+ createdAt: number;
69
+ updatedAt: number;
70
+ attachments: IssueAttachmentInfo[];
71
+ events?: IssueEventInfo[];
72
+ externalProvider?: string | null;
73
+ externalId?: string | null;
74
+ externalIdentifier?: string | null;
75
+ externalUrl?: string | null;
76
+ }
77
+ export interface IssueSettingsInfo {
78
+ scopeKey: string;
79
+ defaultPickupDelayMs: number;
80
+ autoStart: boolean;
81
+ /** Default agent for new issues in this workspace. */
82
+ backend: AgentBackendKind;
83
+ /** Default machine for new issues (null = cloud). */
84
+ machineId?: string | null;
85
+ modelId: string;
86
+ maxConcurrent: number;
87
+ allowAgentSpawn: boolean;
88
+ maxSpawnPerBatch: number;
89
+ updatedAt: number;
90
+ }
91
+ export declare function isIssueStatus(value: unknown): value is IssueStatus;
92
+ export declare function isIssuePriority(value: unknown): value is IssuePriority;
93
+ export declare function issueSettingsScopeKey(input: {
94
+ orgId?: string | null;
95
+ userId: string;
96
+ }): string;
97
+ export declare function clampPickupDelayMs(raw: unknown, fallback?: number): number;
98
+ export declare function clampMaxConcurrent(raw: unknown, ceiling?: number): number;
99
+ export declare function clampMaxSpawnPerBatch(raw: unknown): number;
100
+ /** `PER-9` / Linear URL tail → uppercase identifier, or null. */
101
+ export declare function parseLinearIdentifier(raw: unknown): string | null;
102
+ export declare function mapLinearPriority(raw: unknown): IssuePriority;
103
+ export declare function parseGithubHttpsRepo(raw: string): string | null;
104
+ export declare function issueStatusLabel(status: IssueStatus): string;
105
+ export declare function canEditIssue(issue: {
106
+ creatorId: string;
107
+ orgId?: string | null;
108
+ }, actor: {
109
+ userId: string;
110
+ orgRole?: string | null;
111
+ }): boolean;
112
+ export declare function canQueueIssue(status: IssueStatus): boolean;
113
+ export declare function canCancelIssue(status: IssueStatus): boolean;
114
+ export declare function canRetryIssue(status: IssueStatus): boolean;
115
+ /** True while the issue page should refresh itself (pickup / agent still moving). */
116
+ export declare function issueStatusIsActive(status: IssueStatus): boolean;
117
+ /** Unwrap a full-document markdown fence the model sometimes wraps around writeups. */
118
+ export declare function sanitizeIssueWriteup(raw: string): string;
119
+ export declare function looksLikeIssueWriteup(text: string): boolean;
120
+ export declare function buildFallbackIssueWriteup(input: {
121
+ title: string;
122
+ description?: string;
123
+ prUrl?: string | null;
124
+ }): string;
125
+ export declare function buildIssueFixPrompt(input: {
126
+ issueId: string;
127
+ title: string;
128
+ description: string;
129
+ repoUrl: string;
130
+ startingRef: string;
131
+ attachmentNotes?: string;
132
+ /** Shown to CLI agents so they upload screenshots and recordings. */
133
+ artifactRules?: string;
134
+ }): string;
135
+ export declare function buildIssueWriteupPrompt(input: {
136
+ issueId: string;
137
+ title: string;
138
+ prUrl?: string | null;
139
+ }): string;