@rallycry/conveyor-agent 7.0.13 → 7.1.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.
@@ -9,12 +9,15 @@ import {
9
9
  // src/connection/agent-connection.ts
10
10
  import { io } from "socket.io-client";
11
11
  var EVENT_BATCH_MS = 500;
12
+ var MAX_EVENT_BUFFER = 5e3;
12
13
  var AgentConnection = class _AgentConnection {
13
14
  socket = null;
14
15
  config;
15
16
  eventBuffer = [];
16
17
  flushTimer = null;
17
18
  lastEmittedStatus = null;
19
+ lastReportedStatus = null;
20
+ droppedEventCount = 0;
18
21
  // Pending answer resolvers for askUserQuestion room-event fallback
19
22
  pendingAnswerResolvers = /* @__PURE__ */ new Map();
20
23
  // Dedup: suppress near-identical messages within a short window
@@ -186,10 +189,13 @@ var AgentConnection = class _AgentConnection {
186
189
  });
187
190
  this.drainPendingMessages(pendingMessages);
188
191
  process.stderr.write("[conveyor-agent] Reconnected to session successfully\n");
189
- if (this.lastEmittedStatus) {
192
+ if (this.lastEmittedStatus && this.lastEmittedStatus !== this.lastReportedStatus) {
193
+ const status = this.lastEmittedStatus;
190
194
  void this.call("reportAgentStatus", {
191
195
  sessionId: this.config.sessionId,
192
- status: this.lastEmittedStatus
196
+ status
197
+ }).then(() => {
198
+ this.lastReportedStatus = status;
193
199
  }).catch(() => {
194
200
  });
195
201
  }
@@ -260,6 +266,8 @@ var AgentConnection = class _AgentConnection {
260
266
  void this.call("reportAgentStatus", {
261
267
  sessionId: this.config.sessionId,
262
268
  status
269
+ }).then(() => {
270
+ this.lastReportedStatus = status;
263
271
  }).catch(() => {
264
272
  });
265
273
  }
@@ -401,12 +409,13 @@ ${q.question}${q.options.length ? "\n" + q.options.map((o) => `- ${o.label}: ${o
401
409
  triggerIdentification() {
402
410
  return this.call("triggerIdentification", { sessionId: this.config.sessionId });
403
411
  }
404
- requestScaleUp(tier, reason) {
405
- return this.call("scaleUpResources", {
412
+ async requestScaleUp(tier, reason) {
413
+ const r = await this.call("scaleUpResources", {
406
414
  sessionId: this.config.sessionId,
407
415
  tier,
408
416
  reason
409
- }).then((r) => ({ scaled: r.success }));
417
+ });
418
+ return { scaled: r.success };
410
419
  }
411
420
  async refreshAuthToken() {
412
421
  const codespaceName = process.env.CODESPACE_NAME || process.env.CLAUDESPACE_NAME;
@@ -428,6 +437,16 @@ ${q.question}${q.options.length ? "\n" + q.options.map((o) => `- ${o.label}: ${o
428
437
  // ── Event buffering ────────────────────────────────────────────────
429
438
  sendEvent(event) {
430
439
  if (!this.socket) return;
440
+ if (this.eventBuffer.length >= MAX_EVENT_BUFFER) {
441
+ this.eventBuffer.shift();
442
+ this.droppedEventCount++;
443
+ if (this.droppedEventCount === 1 || this.droppedEventCount % 500 === 0) {
444
+ process.stderr.write(
445
+ `[conveyor-agent] eventBuffer overflow \u2014 dropped ${this.droppedEventCount} event(s) (cap: ${MAX_EVENT_BUFFER})
446
+ `
447
+ );
448
+ }
449
+ }
431
450
  this.eventBuffer.push({ event });
432
451
  if (!this.flushTimer) {
433
452
  this.flushTimer = setTimeout(() => void this.flushEvents(), EVENT_BATCH_MS);
@@ -796,6 +815,28 @@ function updateRemoteToken(cwd, token) {
796
815
  } catch {
797
816
  }
798
817
  }
818
+ async function flushPendingChanges(cwd, opts) {
819
+ let committed = false;
820
+ let pushed = false;
821
+ let hadWork = false;
822
+ try {
823
+ if (hasUncommittedChanges(cwd)) {
824
+ hadWork = true;
825
+ const message = opts?.wipMessage ?? "WIP: auto-commit on conveyor-agent shutdown";
826
+ const hash = stageAndCommit(cwd, message);
827
+ committed = hash !== null;
828
+ }
829
+ } catch {
830
+ }
831
+ try {
832
+ if (hasUnpushedCommits(cwd)) {
833
+ hadWork = true;
834
+ pushed = await pushToOrigin(cwd, opts?.refreshToken);
835
+ }
836
+ } catch {
837
+ }
838
+ return { committed, pushed, hadWork };
839
+ }
799
840
  async function pushToOrigin(cwd, refreshToken) {
800
841
  try {
801
842
  const currentBranch = getCurrentBranch(cwd);
@@ -907,6 +948,8 @@ var PlanSync = class {
907
948
 
908
949
  // ../shared/dist/index.js
909
950
  import { z } from "zod";
951
+ import { z as z2 } from "zod";
952
+ import { z as z3 } from "zod";
910
953
  var MAX_FILE_SIZE_BYTES = 25 * 1024 * 1024;
911
954
  var EMBED_THRESHOLD_IMAGES = 5 * 1024 * 1024;
912
955
  var EMBED_THRESHOLD_TEXT = 2 * 1024 * 1024;
@@ -997,6 +1040,10 @@ var ReportAgentStatusRequestSchema = z.object({
997
1040
  sessionId: z.string(),
998
1041
  status: z.string()
999
1042
  });
1043
+ var NotifyAgentVersionRequestSchema = z.object({
1044
+ sessionId: z.string(),
1045
+ agentVersion: z.string()
1046
+ });
1000
1047
  var CreateSubtaskRequestSchema = z.object({
1001
1048
  sessionId: z.string(),
1002
1049
  title: z.string().min(1),
@@ -1125,157 +1172,6 @@ var UpdateChildStatusRequestSchema = z.object({
1125
1172
  childTaskId: z.string(),
1126
1173
  status: z.string()
1127
1174
  });
1128
- var RegisterProjectAgentRequestSchema = z.object({
1129
- projectId: z.string(),
1130
- capabilities: z.array(z.string())
1131
- });
1132
- var ProjectRunnerHeartbeatRequestSchema = z.object({
1133
- projectId: z.string()
1134
- });
1135
- var ReportProjectAgentStatusRequestSchema = z.object({
1136
- projectId: z.string(),
1137
- status: z.enum(["busy", "idle"]),
1138
- activeChatId: z.string().nullish(),
1139
- activeTaskId: z.string().nullish(),
1140
- activeBranch: z.string().nullish()
1141
- });
1142
- var DisconnectProjectRunnerRequestSchema = z.object({
1143
- projectId: z.string()
1144
- });
1145
- var GetProjectAgentContextRequestSchema = z.object({
1146
- projectId: z.string()
1147
- });
1148
- var GetProjectChatHistoryRequestSchema = z.object({
1149
- projectId: z.string(),
1150
- limit: z.number().int().positive().optional().default(50),
1151
- chatId: z.string().optional()
1152
- });
1153
- var PostProjectAgentMessageRequestSchema = z.object({
1154
- projectId: z.string(),
1155
- content: z.string().min(1),
1156
- chatId: z.string().optional()
1157
- });
1158
- var ListProjectTasksRequestSchema = z.object({
1159
- projectId: z.string(),
1160
- status: z.string().optional(),
1161
- assigneeId: z.string().optional(),
1162
- limit: z.number().int().positive().optional().default(50)
1163
- });
1164
- var GetProjectTaskRequestSchema = z.object({
1165
- projectId: z.string(),
1166
- taskId: z.string()
1167
- });
1168
- var SearchProjectTasksRequestSchema = z.object({
1169
- projectId: z.string(),
1170
- tagNames: z.array(z.string()).optional(),
1171
- searchQuery: z.string().optional(),
1172
- statusFilters: z.array(z.string()).optional(),
1173
- limit: z.number().int().positive().optional().default(20)
1174
- });
1175
- var ListProjectTagsRequestSchema = z.object({
1176
- projectId: z.string()
1177
- });
1178
- var GetProjectSummaryRequestSchema = z.object({
1179
- projectId: z.string()
1180
- });
1181
- var CreateProjectTaskRequestSchema = z.object({
1182
- projectId: z.string(),
1183
- title: z.string().min(1),
1184
- description: z.string().optional(),
1185
- plan: z.string().optional(),
1186
- status: z.string().optional(),
1187
- isBug: z.boolean().optional()
1188
- });
1189
- var UpdateProjectTaskRequestSchema = z.object({
1190
- projectId: z.string(),
1191
- taskId: z.string(),
1192
- title: z.string().optional(),
1193
- description: z.string().optional(),
1194
- plan: z.string().optional(),
1195
- status: z.string().optional(),
1196
- assignedUserId: z.string().nullish()
1197
- });
1198
- var ReportProjectAgentEventRequestSchema = z.object({
1199
- projectId: z.string(),
1200
- event: z.record(z.string(), z.unknown())
1201
- });
1202
- var ReportTagAuditProgressRequestSchema = z.object({
1203
- projectId: z.string(),
1204
- requestId: z.string(),
1205
- activity: z.object({
1206
- tool: z.string(),
1207
- input: z.string().optional(),
1208
- timestamp: z.string()
1209
- })
1210
- });
1211
- var ReportTagAuditResultRequestSchema = z.object({
1212
- projectId: z.string(),
1213
- requestId: z.string(),
1214
- recommendations: z.array(z.record(z.string(), z.unknown())),
1215
- summary: z.string(),
1216
- complete: z.boolean()
1217
- });
1218
- var ReportNewCommitsDetectedRequestSchema = z.object({
1219
- projectId: z.string(),
1220
- commits: z.array(
1221
- z.object({
1222
- sha: z.string(),
1223
- message: z.string(),
1224
- author: z.string()
1225
- })
1226
- ),
1227
- branch: z.string()
1228
- });
1229
- var ReportEnvironmentReadyRequestSchema = z.object({
1230
- projectId: z.string(),
1231
- branch: z.string(),
1232
- setupComplete: z.boolean(),
1233
- startCommandRunning: z.boolean()
1234
- });
1235
- var ReportEnvSwitchProgressRequestSchema = z.object({
1236
- projectId: z.string(),
1237
- step: z.string(),
1238
- progress: z.number(),
1239
- message: z.string().optional()
1240
- });
1241
- var ForwardProjectChatMessageRequestSchema = z.object({
1242
- projectId: z.string(),
1243
- chatId: z.string(),
1244
- content: z.string().min(1),
1245
- targetUserId: z.string().optional()
1246
- });
1247
- var CancelQueuedProjectMessageRequestSchema = z.object({
1248
- projectId: z.string(),
1249
- index: z.number().int().nonnegative()
1250
- });
1251
- var GetProjectCliHistoryRequestSchema = z.object({
1252
- projectId: z.string(),
1253
- limit: z.number().int().positive().optional().default(50),
1254
- source: z.string().optional()
1255
- });
1256
- var PostToProjectTaskChatRequestSchema = z.object({
1257
- projectId: z.string(),
1258
- taskId: z.string(),
1259
- content: z.string()
1260
- });
1261
- var GetProjectTaskCliRequestSchema = z.object({
1262
- projectId: z.string(),
1263
- taskId: z.string(),
1264
- limit: z.number().int().positive().optional().default(50),
1265
- source: z.string().optional()
1266
- });
1267
- var StartProjectBuildRequestSchema = z.object({
1268
- projectId: z.string(),
1269
- taskId: z.string()
1270
- });
1271
- var StopProjectBuildRequestSchema = z.object({
1272
- projectId: z.string(),
1273
- taskId: z.string()
1274
- });
1275
- var ApproveProjectMergePRRequestSchema = z.object({
1276
- projectId: z.string(),
1277
- childTaskId: z.string()
1278
- });
1279
1175
  var GetAgentStatusRequestSchema = z.object({
1280
1176
  taskId: z.string()
1281
1177
  });
@@ -1371,7 +1267,200 @@ var RegisterProjectAgentResponseSchema = z.object({
1371
1267
  agentSettings: z.record(z.string(), z.unknown()).nullable(),
1372
1268
  branchSwitchCommand: z.string().nullable()
1373
1269
  });
1270
+ var RegisterProjectAgentRequestSchema = z2.object({
1271
+ projectId: z2.string(),
1272
+ capabilities: z2.array(z2.string())
1273
+ });
1274
+ var ProjectRunnerHeartbeatRequestSchema = z2.object({
1275
+ projectId: z2.string()
1276
+ });
1277
+ var ReportProjectAgentStatusRequestSchema = z2.object({
1278
+ projectId: z2.string(),
1279
+ status: z2.enum(["busy", "idle"]),
1280
+ activeChatId: z2.string().nullish(),
1281
+ activeTaskId: z2.string().nullish(),
1282
+ activeBranch: z2.string().nullish()
1283
+ });
1284
+ var DisconnectProjectRunnerRequestSchema = z2.object({
1285
+ projectId: z2.string()
1286
+ });
1287
+ var GetProjectAgentContextRequestSchema = z2.object({
1288
+ projectId: z2.string()
1289
+ });
1290
+ var GetProjectChatHistoryRequestSchema = z2.object({
1291
+ projectId: z2.string(),
1292
+ limit: z2.number().int().positive().optional().default(50),
1293
+ chatId: z2.string().optional()
1294
+ });
1295
+ var PostProjectAgentMessageRequestSchema = z2.object({
1296
+ projectId: z2.string(),
1297
+ content: z2.string().min(1),
1298
+ chatId: z2.string().optional()
1299
+ });
1300
+ var ListProjectTasksRequestSchema = z2.object({
1301
+ projectId: z2.string(),
1302
+ status: z2.string().optional(),
1303
+ assigneeId: z2.string().optional(),
1304
+ limit: z2.number().int().positive().optional().default(50)
1305
+ });
1306
+ var GetProjectTaskRequestSchema = z2.object({
1307
+ projectId: z2.string(),
1308
+ taskId: z2.string()
1309
+ });
1310
+ var SearchProjectTasksRequestSchema = z2.object({
1311
+ projectId: z2.string(),
1312
+ tagNames: z2.array(z2.string()).optional(),
1313
+ searchQuery: z2.string().optional(),
1314
+ statusFilters: z2.array(z2.string()).optional(),
1315
+ limit: z2.number().int().positive().optional().default(20)
1316
+ });
1317
+ var ListProjectTagsRequestSchema = z2.object({
1318
+ projectId: z2.string()
1319
+ });
1320
+ var GetProjectSummaryRequestSchema = z2.object({
1321
+ projectId: z2.string()
1322
+ });
1323
+ var CreateProjectTaskRequestSchema = z2.object({
1324
+ projectId: z2.string(),
1325
+ title: z2.string().min(1),
1326
+ description: z2.string().optional(),
1327
+ plan: z2.string().optional(),
1328
+ status: z2.string().optional(),
1329
+ isBug: z2.boolean().optional()
1330
+ });
1331
+ var UpdateProjectTaskRequestSchema = z2.object({
1332
+ projectId: z2.string(),
1333
+ taskId: z2.string(),
1334
+ title: z2.string().optional(),
1335
+ description: z2.string().optional(),
1336
+ plan: z2.string().optional(),
1337
+ status: z2.string().optional(),
1338
+ assignedUserId: z2.string().nullish()
1339
+ });
1340
+ var ReportProjectAgentEventRequestSchema = z2.object({
1341
+ projectId: z2.string(),
1342
+ event: z2.record(z2.string(), z2.unknown())
1343
+ });
1344
+ var ReportTagAuditProgressRequestSchema = z2.object({
1345
+ projectId: z2.string(),
1346
+ requestId: z2.string(),
1347
+ activity: z2.object({
1348
+ tool: z2.string(),
1349
+ input: z2.string().optional(),
1350
+ timestamp: z2.string()
1351
+ })
1352
+ });
1353
+ var ReportTagAuditResultRequestSchema = z2.object({
1354
+ projectId: z2.string(),
1355
+ requestId: z2.string(),
1356
+ recommendations: z2.array(z2.record(z2.string(), z2.unknown())),
1357
+ summary: z2.string(),
1358
+ complete: z2.boolean()
1359
+ });
1360
+ var ReportNewCommitsDetectedRequestSchema = z2.object({
1361
+ projectId: z2.string(),
1362
+ commits: z2.array(
1363
+ z2.object({
1364
+ sha: z2.string(),
1365
+ message: z2.string(),
1366
+ author: z2.string()
1367
+ })
1368
+ ),
1369
+ branch: z2.string()
1370
+ });
1371
+ var ReportEnvironmentReadyRequestSchema = z2.object({
1372
+ projectId: z2.string(),
1373
+ branch: z2.string(),
1374
+ setupComplete: z2.boolean(),
1375
+ startCommandRunning: z2.boolean()
1376
+ });
1377
+ var ReportEnvSwitchProgressRequestSchema = z2.object({
1378
+ projectId: z2.string(),
1379
+ step: z2.string(),
1380
+ progress: z2.number(),
1381
+ message: z2.string().optional()
1382
+ });
1383
+ var ForwardProjectChatMessageRequestSchema = z2.object({
1384
+ projectId: z2.string(),
1385
+ chatId: z2.string(),
1386
+ content: z2.string().min(1),
1387
+ targetUserId: z2.string().optional()
1388
+ });
1389
+ var CancelQueuedProjectMessageRequestSchema = z2.object({
1390
+ projectId: z2.string(),
1391
+ index: z2.number().int().nonnegative()
1392
+ });
1393
+ var GetProjectCliHistoryRequestSchema = z2.object({
1394
+ projectId: z2.string(),
1395
+ limit: z2.number().int().positive().optional().default(50),
1396
+ source: z2.string().optional()
1397
+ });
1398
+ var PostToProjectTaskChatRequestSchema = z2.object({
1399
+ projectId: z2.string(),
1400
+ taskId: z2.string(),
1401
+ content: z2.string()
1402
+ });
1403
+ var GetProjectTaskCliRequestSchema = z2.object({
1404
+ projectId: z2.string(),
1405
+ taskId: z2.string(),
1406
+ limit: z2.number().int().positive().optional().default(50),
1407
+ source: z2.string().optional()
1408
+ });
1409
+ var StartProjectBuildRequestSchema = z2.object({
1410
+ projectId: z2.string(),
1411
+ taskId: z2.string()
1412
+ });
1413
+ var StopProjectBuildRequestSchema = z2.object({
1414
+ projectId: z2.string(),
1415
+ taskId: z2.string()
1416
+ });
1417
+ var ApproveProjectMergePRRequestSchema = z2.object({
1418
+ projectId: z2.string(),
1419
+ childTaskId: z2.string()
1420
+ });
1374
1421
  var CRITICAL_AUTOMATED_SOURCES = /* @__PURE__ */ new Set(["ci_failure", "review_trigger"]);
1422
+ var StartTaskAuditRequestSchema = z3.object({
1423
+ projectId: z3.string(),
1424
+ taskIds: z3.array(z3.string()).min(1)
1425
+ });
1426
+ var ReportTaskAuditProgressRequestSchema = z3.object({
1427
+ projectId: z3.string(),
1428
+ requestId: z3.string(),
1429
+ taskId: z3.string(),
1430
+ activity: z3.string()
1431
+ });
1432
+ var ReportTaskAuditResultRequestSchema = z3.object({
1433
+ projectId: z3.string(),
1434
+ requestId: z3.string(),
1435
+ taskId: z3.string(),
1436
+ summary: z3.string(),
1437
+ turnGrades: z3.array(
1438
+ z3.object({
1439
+ turnIndex: z3.number(),
1440
+ phase: z3.enum(["planning", "building", "human"]),
1441
+ grade: z3.enum(["correct", "neutral", "blunder"]),
1442
+ reasoning: z3.string(),
1443
+ eventType: z3.string(),
1444
+ eventSummary: z3.string()
1445
+ })
1446
+ ),
1447
+ planningAccuracy: z3.number().nullable(),
1448
+ buildingAccuracy: z3.number().nullable(),
1449
+ humanAccuracy: z3.number().nullable(),
1450
+ planningCorrect: z3.number(),
1451
+ planningNeutral: z3.number(),
1452
+ planningBlunder: z3.number(),
1453
+ buildingCorrect: z3.number(),
1454
+ buildingNeutral: z3.number(),
1455
+ buildingBlunder: z3.number(),
1456
+ humanCorrect: z3.number(),
1457
+ humanNeutral: z3.number(),
1458
+ humanBlunder: z3.number(),
1459
+ suggestionIds: z3.array(z3.string()),
1460
+ auditCostUsd: z3.number().nullable(),
1461
+ model: z3.string().nullable(),
1462
+ error: z3.string().optional()
1463
+ });
1375
1464
 
1376
1465
  // src/execution/pack-runner-prompt.ts
1377
1466
  function findLastAgentMessageIndex(history) {
@@ -2556,7 +2645,7 @@ async function buildInitialPrompt(mode, context, isAuto, agentMode) {
2556
2645
  }
2557
2646
 
2558
2647
  // src/tools/common-tools.ts
2559
- import { z as z2 } from "zod";
2648
+ import { z as z4 } from "zod";
2560
2649
 
2561
2650
  // src/tools/helpers.ts
2562
2651
  function textResult(text) {
@@ -2590,8 +2679,8 @@ function buildReadTaskChatTool(connection) {
2590
2679
  "read_task_chat",
2591
2680
  "Read recent messages from a task chat. Omit task_id to read the current task's chat, or provide a child task ID to read a child's chat.",
2592
2681
  {
2593
- limit: z2.number().optional().describe("Number of recent messages to fetch (default 20)"),
2594
- task_id: z2.string().optional().describe("Child task ID to read chat from. Omit to read the current task's chat.")
2682
+ limit: z4.number().optional().describe("Number of recent messages to fetch (default 20)"),
2683
+ task_id: z4.string().optional().describe("Child task ID to read chat from. Omit to read the current task's chat.")
2595
2684
  },
2596
2685
  async ({ limit, task_id }) => {
2597
2686
  try {
@@ -2635,7 +2724,7 @@ function buildGetTaskTool(connection) {
2635
2724
  "get_task",
2636
2725
  "Look up a task by slug or ID to get its title, description, plan, and status",
2637
2726
  {
2638
- slug_or_id: z2.string().describe("The task slug (e.g. 'my-task') or CUID")
2727
+ slug_or_id: z4.string().describe("The task slug (e.g. 'my-task') or CUID")
2639
2728
  },
2640
2729
  async ({ slug_or_id }) => {
2641
2730
  try {
@@ -2658,9 +2747,9 @@ function buildGetTaskCliTool(connection) {
2658
2747
  "get_task_cli",
2659
2748
  "Read CLI execution logs from a task. Returns agent reasoning, tool calls, setup output, and other execution events. Use 'source' to filter: 'agent' for agent reasoning/tool calls only, 'application' for setup/dev-server output only.",
2660
2749
  {
2661
- task_id: z2.string().optional().describe("Task ID or slug. Omit to read logs from the current task."),
2662
- source: z2.enum(["agent", "application"]).optional().describe("Filter by log source. Omit for all logs."),
2663
- limit: z2.number().optional().describe("Max number of log entries to return (default 50, max 500).")
2750
+ task_id: z4.string().optional().describe("Task ID or slug. Omit to read logs from the current task."),
2751
+ source: z4.enum(["agent", "application"]).optional().describe("Filter by log source. Omit for all logs."),
2752
+ limit: z4.number().optional().describe("Max number of log entries to return (default 50, max 500).")
2664
2753
  },
2665
2754
  async ({ task_id, source, limit }) => {
2666
2755
  try {
@@ -2720,7 +2809,7 @@ function buildGetTaskFileTool(connection) {
2720
2809
  return defineTool(
2721
2810
  "get_task_file",
2722
2811
  "Get a specific task file's content and download URL by file ID",
2723
- { fileId: z2.string().describe("The file ID to retrieve") },
2812
+ { fileId: z4.string().describe("The file ID to retrieve") },
2724
2813
  async ({ fileId }) => {
2725
2814
  try {
2726
2815
  const file = await connection.call("getTaskFile", {
@@ -2751,8 +2840,8 @@ function buildSearchIncidentsTool(connection) {
2751
2840
  "search_incidents",
2752
2841
  "Search incidents in the current project. Optionally filter by status (Open, Acknowledged, Investigating, Resolved, Closed) or source.",
2753
2842
  {
2754
- status: z2.string().optional().describe("Filter by incident status"),
2755
- source: z2.string().optional().describe("Filter by source (e.g., 'conveyor', 'agent', 'build')")
2843
+ status: z4.string().optional().describe("Filter by incident status"),
2844
+ source: z4.string().optional().describe("Filter by source (e.g., 'conveyor', 'agent', 'build')")
2756
2845
  },
2757
2846
  async ({ status, source }) => {
2758
2847
  try {
@@ -2776,7 +2865,7 @@ function buildGetTaskIncidentsTool(connection) {
2776
2865
  "get_task_incidents",
2777
2866
  "Get all incidents linked to the current task (or a specified task). Returns full incident details including title, description, severity, status, and source.",
2778
2867
  {
2779
- task_id: z2.string().optional().describe("Task ID (defaults to current task)")
2868
+ task_id: z4.string().optional().describe("Task ID (defaults to current task)")
2780
2869
  },
2781
2870
  async ({ task_id }) => {
2782
2871
  try {
@@ -2799,12 +2888,12 @@ function buildQueryGcpLogsTool(connection) {
2799
2888
  "query_gcp_logs",
2800
2889
  "Query GCP Cloud Logging for the current project. Returns log entries matching the given filters. Use severity to filter by minimum log level. The project's GCP credentials are used automatically.",
2801
2890
  {
2802
- filter: z2.string().optional().describe(
2891
+ filter: z4.string().optional().describe(
2803
2892
  `Cloud Logging filter expression (e.g., 'resource.type="gce_instance"'). Max 1000 chars.`
2804
2893
  ),
2805
- start_time: z2.string().optional().describe("Start time in ISO 8601 format (e.g., '2024-01-01T00:00:00Z')"),
2806
- end_time: z2.string().optional().describe("End time in ISO 8601 format (e.g., '2024-01-02T00:00:00Z')"),
2807
- severity: z2.enum([
2894
+ start_time: z4.string().optional().describe("Start time in ISO 8601 format (e.g., '2024-01-01T00:00:00Z')"),
2895
+ end_time: z4.string().optional().describe("End time in ISO 8601 format (e.g., '2024-01-02T00:00:00Z')"),
2896
+ severity: z4.enum([
2808
2897
  "DEFAULT",
2809
2898
  "DEBUG",
2810
2899
  "INFO",
@@ -2815,7 +2904,7 @@ function buildQueryGcpLogsTool(connection) {
2815
2904
  "ALERT",
2816
2905
  "EMERGENCY"
2817
2906
  ]).optional().describe("Minimum severity level to filter by (default: all levels)"),
2818
- page_size: z2.number().optional().describe("Number of log entries to return (default 100, max 500)")
2907
+ page_size: z4.number().optional().describe("Number of log entries to return (default 100, max 500)")
2819
2908
  },
2820
2909
  async ({ filter, start_time, end_time, severity, page_size }) => {
2821
2910
  try {
@@ -2869,8 +2958,8 @@ function buildGetSuggestionsTool(connection) {
2869
2958
  "get_suggestions",
2870
2959
  "List project suggestions sorted by vote score. Use this to see what the team thinks is important.",
2871
2960
  {
2872
- status: z2.string().optional().describe("Filter by status: Open, Accepted, Rejected, Implemented"),
2873
- limit: z2.number().optional().describe("Max results (default 20)")
2961
+ status: z4.string().optional().describe("Filter by status: Open, Accepted, Rejected, Implemented"),
2962
+ limit: z4.number().optional().describe("Max results (default 20)")
2874
2963
  },
2875
2964
  async ({ status: _status, limit: _limit }) => {
2876
2965
  try {
@@ -2895,8 +2984,8 @@ function buildPostToChatTool(connection) {
2895
2984
  "post_to_chat",
2896
2985
  "Post a message to a task chat. Your normal replies already appear in chat \u2014 only use this for explicit out-of-band updates or posting to a child task's chat.",
2897
2986
  {
2898
- message: z2.string().describe("The message to post to the team"),
2899
- task_id: z2.string().optional().describe("Child task ID to post to. Omit to post to the current task's chat.")
2987
+ message: z4.string().describe("The message to post to the team"),
2988
+ task_id: z4.string().optional().describe("Child task ID to post to. Omit to post to the current task's chat.")
2900
2989
  },
2901
2990
  async ({ message, task_id }) => {
2902
2991
  try {
@@ -2923,8 +3012,8 @@ function buildForceUpdateTaskStatusTool(connection) {
2923
3012
  "force_update_task_status",
2924
3013
  "EMERGENCY ONLY: Force-override a task's Kanban status. Status transitions happen automatically (building sets InProgress, PR creation sets ReviewPR, merge sets ReviewDev). Only use this if an automatic transition failed or a task is stuck in the wrong status. Omit task_id to update the current task, or provide a child task ID.",
2925
3014
  {
2926
- status: z2.enum(["InProgress", "ReviewPR", "ReviewDev", "Complete"]).describe("The new status for the task"),
2927
- task_id: z2.string().optional().describe("Child task ID to update. Omit to update the current task.")
3015
+ status: z4.enum(["InProgress", "ReviewPR", "ReviewDev", "Complete"]).describe("The new status for the task"),
3016
+ task_id: z4.string().optional().describe("Child task ID to update. Omit to update the current task.")
2928
3017
  },
2929
3018
  async ({ status, task_id }) => {
2930
3019
  try {
@@ -2955,15 +3044,15 @@ function buildCreatePullRequestTool(connection, config) {
2955
3044
  "create_pull_request",
2956
3045
  "Create a GitHub pull request for this task. Automatically stages uncommitted changes, commits them, and pushes before creating the PR. Use this instead of gh CLI or git commands to create PRs.",
2957
3046
  {
2958
- title: z2.string().describe("The PR title"),
2959
- body: z2.string().describe("The PR description/body in markdown"),
2960
- branch: z2.string().optional().describe(
3047
+ title: z4.string().describe("The PR title"),
3048
+ body: z4.string().describe("The PR description/body in markdown"),
3049
+ branch: z4.string().optional().describe(
2961
3050
  "The head branch name for the PR. If the task doesn't have a branch set, this will be used. Defaults to the task's existing branch."
2962
3051
  ),
2963
- baseBranch: z2.string().optional().describe(
3052
+ baseBranch: z4.string().optional().describe(
2964
3053
  "The base branch to target for the PR (e.g. 'main', 'develop'). Defaults to the project's configured dev branch."
2965
3054
  ),
2966
- commitMessage: z2.string().optional().describe(
3055
+ commitMessage: z4.string().optional().describe(
2967
3056
  "Commit message for staging uncommitted changes. If not provided, a default message based on the PR title will be used."
2968
3057
  )
2969
3058
  },
@@ -3041,7 +3130,7 @@ function buildAddDependencyTool(connection) {
3041
3130
  "add_dependency",
3042
3131
  "Add a dependency \u2014 this task cannot start until the specified task is merged to dev",
3043
3132
  {
3044
- depends_on_slug_or_id: z2.string().describe("Slug or ID of the task this task depends on")
3133
+ depends_on_slug_or_id: z4.string().describe("Slug or ID of the task this task depends on")
3045
3134
  },
3046
3135
  async ({ depends_on_slug_or_id }) => {
3047
3136
  try {
@@ -3063,7 +3152,7 @@ function buildRemoveDependencyTool(connection) {
3063
3152
  "remove_dependency",
3064
3153
  "Remove a dependency from this task",
3065
3154
  {
3066
- depends_on_slug_or_id: z2.string().describe("Slug or ID of the task to remove as dependency")
3155
+ depends_on_slug_or_id: z4.string().describe("Slug or ID of the task to remove as dependency")
3067
3156
  },
3068
3157
  async ({ depends_on_slug_or_id }) => {
3069
3158
  try {
@@ -3085,10 +3174,10 @@ function buildCreateFollowUpTaskTool(connection) {
3085
3174
  "create_follow_up_task",
3086
3175
  "Create a follow-up task in this project that depends on the current task. Use for out-of-scope work, v1.1 features, or cleanup that should happen after this task merges.",
3087
3176
  {
3088
- title: z2.string().describe("Follow-up task title"),
3089
- description: z2.string().optional().describe("Brief description of the follow-up work"),
3090
- plan: z2.string().optional().describe("Implementation plan if known"),
3091
- story_point_value: z2.number().optional().describe("Story point estimate (1=Common, 2=Magic, 3=Rare, 5=Unique)")
3177
+ title: z4.string().describe("Follow-up task title"),
3178
+ description: z4.string().optional().describe("Brief description of the follow-up work"),
3179
+ plan: z4.string().optional().describe("Implementation plan if known"),
3180
+ story_point_value: z4.number().optional().describe("Story point estimate (1=Common, 2=Magic, 3=Rare, 5=Unique)")
3092
3181
  },
3093
3182
  async ({ title, description, plan, story_point_value }) => {
3094
3183
  try {
@@ -3115,9 +3204,9 @@ function buildCreateSuggestionTool(connection) {
3115
3204
  "create_suggestion",
3116
3205
  "Suggest a feature, improvement, or idea for the project. If you want to recommend something \u2014 a document, a rule, a feature, a task, an optimization \u2014 use this tool. If a similar suggestion already exists, your vote will be added to it instead of creating a duplicate.",
3117
3206
  {
3118
- title: z2.string().describe("Short title for the suggestion"),
3119
- description: z2.string().optional().describe("Details about the suggestion"),
3120
- tag_names: z2.array(z2.string()).optional().describe("Tag names to categorize the suggestion")
3207
+ title: z4.string().describe("Short title for the suggestion"),
3208
+ description: z4.string().optional().describe("Details about the suggestion"),
3209
+ tag_names: z4.array(z4.string()).optional().describe("Tag names to categorize the suggestion")
3121
3210
  },
3122
3211
  async ({ title, description, tag_names }) => {
3123
3212
  try {
@@ -3146,8 +3235,8 @@ function buildVoteSuggestionTool(connection) {
3146
3235
  "vote_suggestion",
3147
3236
  "Vote on a project suggestion. Use +1 to upvote or -1 to downvote.",
3148
3237
  {
3149
- suggestion_id: z2.string().describe("The suggestion ID to vote on"),
3150
- value: z2.number().refine((v) => v === 1 || v === -1, { message: "Value must be 1 or -1" }).describe("+1 to upvote, -1 to downvote")
3238
+ suggestion_id: z4.string().describe("The suggestion ID to vote on"),
3239
+ value: z4.number().refine((v) => v === 1 || v === -1, { message: "Value must be 1 or -1" }).describe("+1 to upvote, -1 to downvote")
3151
3240
  },
3152
3241
  async ({ suggestion_id, value }) => {
3153
3242
  try {
@@ -3168,10 +3257,10 @@ function buildVoteSuggestionTool(connection) {
3168
3257
  function buildScaleUpResourcesTool(connection) {
3169
3258
  return defineTool(
3170
3259
  "scale_up_resources",
3171
- "Scale up the pod's CPU and memory resources. Use before running dev servers, tests, builds, or other resource-intensive operations. Phases: 'setup' (installs, basic dev servers), 'build' (full dev servers, test suites, typecheck, builds). Actual CPU/memory values are configured per-project. Scaling is one-way (up only).",
3260
+ "Scale up the pod's CPU and memory resources to the 'build' tier. Use before running heavy operations like full test suites, integration tests, typechecks, or production builds. Pods start at the 'setup' tier by default \u2014 only call this when you actually need more. Scaling is one-way (up only).",
3172
3261
  {
3173
- tier: z2.enum(["initial", "setup", "build"]).describe("The resource phase to scale up to"),
3174
- reason: z2.string().optional().describe("Brief reason for scaling (e.g., 'running test suite')")
3262
+ tier: z4.literal("build").describe("The resource phase to scale up to"),
3263
+ reason: z4.string().optional().describe("Brief reason for scaling (e.g., 'running test suite')")
3175
3264
  },
3176
3265
  async ({ tier, reason }) => {
3177
3266
  try {
@@ -3224,15 +3313,15 @@ function buildCommonTools(connection, config) {
3224
3313
  }
3225
3314
 
3226
3315
  // src/tools/pm-tools.ts
3227
- import { z as z3 } from "zod";
3316
+ import { z as z5 } from "zod";
3228
3317
  var SP_DESCRIPTION = "Story point value (1=Common, 2=Magic, 3=Rare, 5=Unique)";
3229
3318
  function buildUpdateTaskTool(connection) {
3230
3319
  return defineTool(
3231
3320
  "update_task",
3232
3321
  "Save the finalized task plan and/or description",
3233
3322
  {
3234
- plan: z3.string().optional().describe("The task plan in markdown"),
3235
- description: z3.string().optional().describe("Updated task description")
3323
+ plan: z5.string().optional().describe("The task plan in markdown"),
3324
+ description: z5.string().optional().describe("Updated task description")
3236
3325
  },
3237
3326
  async ({ plan, description }) => {
3238
3327
  try {
@@ -3253,11 +3342,11 @@ function buildCreateSubtaskTool(connection) {
3253
3342
  "create_subtask",
3254
3343
  "Create a subtask under the current parent task. Use for breaking complex tasks into smaller pieces.",
3255
3344
  {
3256
- title: z3.string().describe("Subtask title"),
3257
- description: z3.string().optional().describe("Brief description"),
3258
- plan: z3.string().optional().describe("Implementation plan in markdown"),
3259
- ordinal: z3.number().optional().describe("Step/order number (0-based)"),
3260
- storyPointValue: z3.number().optional().describe(SP_DESCRIPTION)
3345
+ title: z5.string().describe("Subtask title"),
3346
+ description: z5.string().optional().describe("Brief description"),
3347
+ plan: z5.string().optional().describe("Implementation plan in markdown"),
3348
+ ordinal: z5.number().optional().describe("Step/order number (0-based)"),
3349
+ storyPointValue: z5.number().optional().describe(SP_DESCRIPTION)
3261
3350
  },
3262
3351
  async ({ title, description, plan, ordinal, storyPointValue }) => {
3263
3352
  try {
@@ -3283,12 +3372,12 @@ function buildUpdateSubtaskTool(connection) {
3283
3372
  "update_subtask",
3284
3373
  "Update an existing subtask's fields",
3285
3374
  {
3286
- subtaskId: z3.string().describe("The subtask ID to update"),
3287
- title: z3.string().optional(),
3288
- description: z3.string().optional(),
3289
- plan: z3.string().optional(),
3290
- ordinal: z3.number().optional(),
3291
- storyPointValue: z3.number().optional().describe(SP_DESCRIPTION)
3375
+ subtaskId: z5.string().describe("The subtask ID to update"),
3376
+ title: z5.string().optional(),
3377
+ description: z5.string().optional(),
3378
+ plan: z5.string().optional(),
3379
+ ordinal: z5.number().optional(),
3380
+ storyPointValue: z5.number().optional().describe(SP_DESCRIPTION)
3292
3381
  },
3293
3382
  async ({ subtaskId, title, description, plan, storyPointValue }) => {
3294
3383
  try {
@@ -3311,7 +3400,7 @@ function buildDeleteSubtaskTool(connection) {
3311
3400
  return defineTool(
3312
3401
  "delete_subtask",
3313
3402
  "Delete a subtask",
3314
- { subtaskId: z3.string().describe("The subtask ID to delete") },
3403
+ { subtaskId: z5.string().describe("The subtask ID to delete") },
3315
3404
  async ({ subtaskId }) => {
3316
3405
  try {
3317
3406
  await connection.call("deleteSubtask", {
@@ -3349,7 +3438,7 @@ function buildPackTools(connection) {
3349
3438
  "start_child_cloud_build",
3350
3439
  "Start a cloud build for a child task. The child must be in Open status with story points and an agent assigned.",
3351
3440
  {
3352
- childTaskId: z3.string().describe("The child task ID to start a cloud build for")
3441
+ childTaskId: z5.string().describe("The child task ID to start a cloud build for")
3353
3442
  },
3354
3443
  async ({ childTaskId }) => {
3355
3444
  try {
@@ -3369,7 +3458,7 @@ function buildPackTools(connection) {
3369
3458
  "stop_child_build",
3370
3459
  "Stop a running cloud build for a child task. Sends a stop signal to the child agent.",
3371
3460
  {
3372
- childTaskId: z3.string().describe("The child task ID whose build should be stopped")
3461
+ childTaskId: z5.string().describe("The child task ID whose build should be stopped")
3373
3462
  },
3374
3463
  async ({ childTaskId }) => {
3375
3464
  try {
@@ -3389,7 +3478,7 @@ function buildPackTools(connection) {
3389
3478
  "approve_and_merge_pr",
3390
3479
  "Approve and merge a child task's pull request. Only succeeds if all CI/CD checks are passing. Returns an error if checks are pending (retry after waiting) or failed (investigate). The child task must be in ReviewPR status.",
3391
3480
  {
3392
- childTaskId: z3.string().describe("The child task ID whose PR should be approved and merged")
3481
+ childTaskId: z5.string().describe("The child task ID whose PR should be approved and merged")
3393
3482
  },
3394
3483
  async ({ childTaskId }) => {
3395
3484
  try {
@@ -3427,7 +3516,7 @@ function buildPmTools(connection, options) {
3427
3516
  }
3428
3517
 
3429
3518
  // src/tools/discovery-tools.ts
3430
- import { z as z4 } from "zod";
3519
+ import { z as z6 } from "zod";
3431
3520
  var SP_DESCRIPTION2 = "Story point value (1=Common, 2=Magic, 3=Rare, 5=Unique)";
3432
3521
  function buildDiscoveryTools(connection) {
3433
3522
  return [
@@ -3435,10 +3524,10 @@ function buildDiscoveryTools(connection) {
3435
3524
  "update_task_properties",
3436
3525
  "Set one or more task properties in a single call. All fields are optional \u2014 only include the fields you want to update.",
3437
3526
  {
3438
- title: z4.string().optional().describe("The new task title"),
3439
- storyPointValue: z4.number().optional().describe(SP_DESCRIPTION2),
3440
- tagIds: z4.array(z4.string()).optional().describe("Array of tag IDs to assign"),
3441
- githubPRUrl: z4.string().url().optional().describe("GitHub pull request URL to link to this task")
3527
+ title: z6.string().optional().describe("The new task title"),
3528
+ storyPointValue: z6.number().optional().describe(SP_DESCRIPTION2),
3529
+ tagIds: z6.array(z6.string()).optional().describe("Array of tag IDs to assign"),
3530
+ githubPRUrl: z6.string().url().optional().describe("GitHub pull request URL to link to this task")
3442
3531
  },
3443
3532
  async ({ title, storyPointValue, tagIds, githubPRUrl }) => {
3444
3533
  try {
@@ -3467,14 +3556,14 @@ function buildDiscoveryTools(connection) {
3467
3556
  }
3468
3557
 
3469
3558
  // src/tools/code-review-tools.ts
3470
- import { z as z5 } from "zod";
3559
+ import { z as z7 } from "zod";
3471
3560
  function buildCodeReviewTools(connection) {
3472
3561
  return [
3473
3562
  defineTool(
3474
3563
  "approve_code_review",
3475
3564
  "Approve the code review. Use this when the code passes all review criteria and is ready to merge.",
3476
3565
  {
3477
- summary: z5.string().describe("Brief summary of what was reviewed and why it looks good")
3566
+ summary: z7.string().describe("Brief summary of what was reviewed and why it looks good")
3478
3567
  },
3479
3568
  async ({ summary }) => {
3480
3569
  const content = `**Code Review: Approved** :white_check_mark:
@@ -3497,15 +3586,15 @@ ${summary}`;
3497
3586
  "request_code_changes",
3498
3587
  "Request changes during code review. Use this when substantive issues are found that need to be fixed before merge.",
3499
3588
  {
3500
- issues: z5.array(
3501
- z5.object({
3502
- file: z5.string().describe("File path where the issue was found"),
3503
- line: z5.number().optional().describe("Line number (if applicable)"),
3504
- severity: z5.enum(["critical", "major", "minor"]).describe("Issue severity"),
3505
- description: z5.string().describe("What is wrong and how to fix it")
3589
+ issues: z7.array(
3590
+ z7.object({
3591
+ file: z7.string().describe("File path where the issue was found"),
3592
+ line: z7.number().optional().describe("Line number (if applicable)"),
3593
+ severity: z7.enum(["critical", "major", "minor"]).describe("Issue severity"),
3594
+ description: z7.string().describe("What is wrong and how to fix it")
3506
3595
  })
3507
3596
  ).describe("List of issues found during review"),
3508
- summary: z5.string().describe("Brief overall summary of the review findings")
3597
+ summary: z7.string().describe("Brief overall summary of the review findings")
3509
3598
  },
3510
3599
  async ({ issues, summary }) => {
3511
3600
  const issueLines = issues.map((issue) => {
@@ -3535,10 +3624,10 @@ ${issueLines}`;
3535
3624
  }
3536
3625
 
3537
3626
  // src/tools/debug-tools.ts
3538
- import { z as z8 } from "zod";
3627
+ import { z as z10 } from "zod";
3539
3628
 
3540
3629
  // src/tools/telemetry-tools.ts
3541
- import { z as z6 } from "zod";
3630
+ import { z as z8 } from "zod";
3542
3631
 
3543
3632
  // src/debug/telemetry-injector.ts
3544
3633
  var BUFFER_SIZE = 200;
@@ -3933,12 +4022,12 @@ function buildGetTelemetryTool(manager) {
3933
4022
  "debug_get_telemetry",
3934
4023
  "Query structured telemetry events (HTTP requests, database queries, Socket.IO events, errors) captured from the running dev server. Returns filtered, structured data instead of raw logs.",
3935
4024
  {
3936
- type: z6.enum(["http", "db", "socket", "error"]).optional().describe("Filter by event type"),
3937
- urlPattern: z6.string().optional().describe("Regex pattern to filter HTTP events by URL"),
3938
- minDuration: z6.number().optional().describe("Minimum duration in ms \u2014 only return events slower than this"),
3939
- errorOnly: z6.boolean().optional().describe("Only return error events and HTTP 4xx/5xx responses"),
3940
- since: z6.number().optional().describe("Only return events after this timestamp (ms since epoch)"),
3941
- limit: z6.number().optional().describe("Max events to return (default: 20, from most recent)")
4025
+ type: z8.enum(["http", "db", "socket", "error"]).optional().describe("Filter by event type"),
4026
+ urlPattern: z8.string().optional().describe("Regex pattern to filter HTTP events by URL"),
4027
+ minDuration: z8.number().optional().describe("Minimum duration in ms \u2014 only return events slower than this"),
4028
+ errorOnly: z8.boolean().optional().describe("Only return error events and HTTP 4xx/5xx responses"),
4029
+ since: z8.number().optional().describe("Only return events after this timestamp (ms since epoch)"),
4030
+ limit: z8.number().optional().describe("Max events to return (default: 20, from most recent)")
3942
4031
  },
3943
4032
  async ({ type, urlPattern, minDuration, errorOnly, since, limit }) => {
3944
4033
  const clientOrErr = requireDebugClient(manager);
@@ -4008,7 +4097,7 @@ function buildTelemetryTools(manager) {
4008
4097
  }
4009
4098
 
4010
4099
  // src/tools/client-debug-tools.ts
4011
- import { z as z7 } from "zod";
4100
+ import { z as z9 } from "zod";
4012
4101
  function requirePlaywrightClient(manager) {
4013
4102
  if (!manager.isClientDebugMode()) {
4014
4103
  return "Client debug mode is not active. Use debug_enter_mode with clientSide: true first.";
@@ -4028,11 +4117,11 @@ function buildClientBreakpointTools(manager) {
4028
4117
  "debug_set_client_breakpoint",
4029
4118
  "Set a breakpoint in client-side code running in the headless Chromium browser. V8 resolves source maps automatically, so original .tsx/.ts file paths work. Use this for React components, client utilities, and browser-side code.",
4030
4119
  {
4031
- file: z7.string().describe(
4120
+ file: z9.string().describe(
4032
4121
  "Original source file path (e.g., src/components/App.tsx) \u2014 source maps resolve automatically"
4033
4122
  ),
4034
- line: z7.number().describe("Line number (1-based) in the original source file"),
4035
- condition: z7.string().optional().describe("JavaScript condition expression \u2014 breakpoint only triggers when truthy")
4123
+ line: z9.number().describe("Line number (1-based) in the original source file"),
4124
+ condition: z9.string().optional().describe("JavaScript condition expression \u2014 breakpoint only triggers when truthy")
4036
4125
  },
4037
4126
  async ({ file, line, condition }) => {
4038
4127
  const clientOrErr = requirePlaywrightClient(manager);
@@ -4054,7 +4143,7 @@ Breakpoint ID: ${breakpointId}${sourceMapNote}`
4054
4143
  "debug_remove_client_breakpoint",
4055
4144
  "Remove a previously set client-side breakpoint by its ID.",
4056
4145
  {
4057
- breakpointId: z7.string().describe("The breakpoint ID returned by debug_set_client_breakpoint")
4146
+ breakpointId: z9.string().describe("The breakpoint ID returned by debug_set_client_breakpoint")
4058
4147
  },
4059
4148
  async ({ breakpointId }) => {
4060
4149
  const clientOrErr = requirePlaywrightClient(manager);
@@ -4134,8 +4223,8 @@ ${JSON.stringify(queuedHits, null, 2)}`
4134
4223
  "debug_evaluate_client",
4135
4224
  "Evaluate a JavaScript expression in the client-side browser context. When paused at a client breakpoint, evaluates in the paused scope. Can access DOM, window, React internals, etc.",
4136
4225
  {
4137
- expression: z7.string().describe("JavaScript expression to evaluate in the browser context"),
4138
- frameIndex: z7.number().optional().describe("Call stack frame index (0 = top frame). Defaults to the top frame.")
4226
+ expression: z9.string().describe("JavaScript expression to evaluate in the browser context"),
4227
+ frameIndex: z9.number().optional().describe("Call stack frame index (0 = top frame). Defaults to the top frame.")
4139
4228
  },
4140
4229
  async ({ expression, frameIndex }) => {
4141
4230
  const clientOrErr = requirePlaywrightClient(manager);
@@ -4208,7 +4297,7 @@ function buildClientInteractionTools(manager) {
4208
4297
  "debug_navigate_client",
4209
4298
  "Navigate the headless browser to a specific URL. Use this to reproduce specific flows or visit different pages.",
4210
4299
  {
4211
- url: z7.string().describe("URL to navigate to (e.g., http://localhost:3000/dashboard)")
4300
+ url: z9.string().describe("URL to navigate to (e.g., http://localhost:3000/dashboard)")
4212
4301
  },
4213
4302
  async ({ url }) => {
4214
4303
  const clientOrErr = requirePlaywrightClient(manager);
@@ -4225,7 +4314,7 @@ function buildClientInteractionTools(manager) {
4225
4314
  "debug_click_client",
4226
4315
  "Click an element on the page in the headless browser. Use CSS selectors to target elements. Useful for reproducing bugs by interacting with the UI programmatically.",
4227
4316
  {
4228
- selector: z7.string().describe(
4317
+ selector: z9.string().describe(
4229
4318
  "CSS selector of the element to click (e.g., 'button.submit', '#login-form input[type=submit]')"
4230
4319
  )
4231
4320
  },
@@ -4247,8 +4336,8 @@ function buildClientConsoleTool(manager) {
4247
4336
  "debug_get_client_console",
4248
4337
  "Get console messages captured from the headless browser. Includes console.log, warn, error, etc.",
4249
4338
  {
4250
- level: z7.string().optional().describe("Filter by console level: log, warn, error, info, debug"),
4251
- limit: z7.number().optional().describe("Maximum number of recent messages to return (default: all)")
4339
+ level: z9.string().optional().describe("Filter by console level: log, warn, error, info, debug"),
4340
+ limit: z9.number().optional().describe("Maximum number of recent messages to return (default: all)")
4252
4341
  },
4253
4342
  // oxlint-disable-next-line require-await
4254
4343
  async ({ level, limit }) => {
@@ -4275,8 +4364,8 @@ function buildClientNetworkTool(manager) {
4275
4364
  "debug_get_client_network",
4276
4365
  "Get network requests captured from the headless browser. Shows URLs, methods, status codes, and timing.",
4277
4366
  {
4278
- filter: z7.string().optional().describe("Regex pattern to filter requests by URL"),
4279
- limit: z7.number().optional().describe("Maximum number of recent requests to return (default: all)")
4367
+ filter: z9.string().optional().describe("Regex pattern to filter requests by URL"),
4368
+ limit: z9.number().optional().describe("Maximum number of recent requests to return (default: all)")
4280
4369
  },
4281
4370
  // oxlint-disable-next-line require-await
4282
4371
  async ({ filter, limit }) => {
@@ -4304,7 +4393,7 @@ function buildClientErrorsTool(manager) {
4304
4393
  "debug_get_client_errors",
4305
4394
  "Get uncaught errors captured from the headless browser. Includes error messages and source-mapped stack traces.",
4306
4395
  {
4307
- limit: z7.number().optional().describe("Maximum number of recent errors to return (default: all)")
4396
+ limit: z9.number().optional().describe("Maximum number of recent errors to return (default: all)")
4308
4397
  },
4309
4398
  // oxlint-disable-next-line require-await
4310
4399
  async ({ limit }) => {
@@ -4398,12 +4487,12 @@ function buildDebugLifecycleTools(manager) {
4398
4487
  "debug_enter_mode",
4399
4488
  "Activate debug mode: restarts the dev server with Node.js --inspect flag and connects the CDP debugger. Optionally launch a headless Chromium browser for client-side debugging. Use serverSide for backend breakpoints, clientSide for frontend breakpoints, or both for full-stack.",
4400
4489
  {
4401
- hypothesis: z8.string().optional().describe("Your hypothesis about the bug \u2014 helps track debugging intent"),
4402
- serverSide: z8.boolean().optional().describe(
4490
+ hypothesis: z10.string().optional().describe("Your hypothesis about the bug \u2014 helps track debugging intent"),
4491
+ serverSide: z10.boolean().optional().describe(
4403
4492
  "Enable server-side Node.js debugging (default: true if clientSide is not set)"
4404
4493
  ),
4405
- clientSide: z8.boolean().optional().describe("Enable client-side browser debugging via headless Chromium + Playwright"),
4406
- previewUrl: z8.string().optional().describe(
4494
+ clientSide: z10.boolean().optional().describe("Enable client-side browser debugging via headless Chromium + Playwright"),
4495
+ previewUrl: z10.string().optional().describe(
4407
4496
  "Preview URL for client-side debugging (e.g., http://localhost:3000). Required when clientSide is true."
4408
4497
  )
4409
4498
  },
@@ -4439,9 +4528,9 @@ function buildBreakpointTools(manager) {
4439
4528
  "debug_set_breakpoint",
4440
4529
  "Set a breakpoint at the specified file and line number. Optionally provide a condition expression that must evaluate to true for the breakpoint to pause execution.",
4441
4530
  {
4442
- file: z8.string().describe("Absolute or relative file path to set the breakpoint in"),
4443
- line: z8.number().describe("Line number (1-based) to set the breakpoint on"),
4444
- condition: z8.string().optional().describe("JavaScript condition expression \u2014 breakpoint only triggers when truthy")
4531
+ file: z10.string().describe("Absolute or relative file path to set the breakpoint in"),
4532
+ line: z10.number().describe("Line number (1-based) to set the breakpoint on"),
4533
+ condition: z10.string().optional().describe("JavaScript condition expression \u2014 breakpoint only triggers when truthy")
4445
4534
  },
4446
4535
  async ({ file, line, condition }) => {
4447
4536
  const clientOrErr = requireDebugClient2(manager);
@@ -4463,7 +4552,7 @@ Breakpoint ID: ${breakpointId}`
4463
4552
  "debug_remove_breakpoint",
4464
4553
  "Remove a previously set breakpoint by its ID.",
4465
4554
  {
4466
- breakpointId: z8.string().describe("The breakpoint ID returned by debug_set_breakpoint")
4555
+ breakpointId: z10.string().describe("The breakpoint ID returned by debug_set_breakpoint")
4467
4556
  },
4468
4557
  async ({ breakpointId }) => {
4469
4558
  const clientOrErr = requireDebugClient2(manager);
@@ -4544,8 +4633,8 @@ ${JSON.stringify(queuedHits, null, 2)}`
4544
4633
  "debug_evaluate",
4545
4634
  "Evaluate a JavaScript expression in the current paused scope (or globally if not paused). When paused, use frameIndex to evaluate in a specific call frame.",
4546
4635
  {
4547
- expression: z8.string().describe("The JavaScript expression to evaluate"),
4548
- frameIndex: z8.number().optional().describe("Call stack frame index (0 = top frame). Defaults to the top frame.")
4636
+ expression: z10.string().describe("The JavaScript expression to evaluate"),
4637
+ frameIndex: z10.number().optional().describe("Call stack frame index (0 = top frame). Defaults to the top frame.")
4549
4638
  },
4550
4639
  async ({ expression, frameIndex }) => {
4551
4640
  const clientOrErr = requireDebugClient2(manager);
@@ -4573,12 +4662,12 @@ function buildProbeManagementTools(manager) {
4573
4662
  "debug_add_probe",
4574
4663
  "Add a debug probe at a specific code location. Captures expression values each time the line executes \u2014 without pausing or modifying source files. Like console.log but better: structured, no diff pollution, auto-cleaned on debug exit.",
4575
4664
  {
4576
- file: z8.string().describe("File path to probe"),
4577
- line: z8.number().describe("Line number (1-based) to probe"),
4578
- expressions: z8.array(z8.string()).describe(
4665
+ file: z10.string().describe("File path to probe"),
4666
+ line: z10.number().describe("Line number (1-based) to probe"),
4667
+ expressions: z10.array(z10.string()).describe(
4579
4668
  'JavaScript expressions to capture when the line executes (e.g., ["req.params.id", "user.role"])'
4580
4669
  ),
4581
- label: z8.string().optional().describe("Optional label for this probe (defaults to file:line)")
4670
+ label: z10.string().optional().describe("Optional label for this probe (defaults to file:line)")
4582
4671
  },
4583
4672
  async ({ file, line, expressions, label }) => {
4584
4673
  const clientOrErr = requireDebugClient2(manager);
@@ -4603,7 +4692,7 @@ Trigger the code path, then use debug_get_probe_results to see captured values.`
4603
4692
  "debug_remove_probe",
4604
4693
  "Remove a previously set debug probe by its ID.",
4605
4694
  {
4606
- probeId: z8.string().describe("The probe ID returned by debug_add_probe")
4695
+ probeId: z10.string().describe("The probe ID returned by debug_add_probe")
4607
4696
  },
4608
4697
  async ({ probeId }) => {
4609
4698
  const clientOrErr = requireDebugClient2(manager);
@@ -4643,9 +4732,9 @@ function buildProbeResultTools(manager) {
4643
4732
  "debug_get_probe_results",
4644
4733
  "Fetch captured probe hit data. Returns expression values from each time a probed line executed.",
4645
4734
  {
4646
- probeId: z8.string().optional().describe("Filter results by probe ID (resolves to its label)"),
4647
- label: z8.string().optional().describe("Filter results by probe label"),
4648
- limit: z8.number().optional().describe("Maximum number of recent hits to return (default: all)")
4735
+ probeId: z10.string().optional().describe("Filter results by probe ID (resolves to its label)"),
4736
+ label: z10.string().optional().describe("Filter results by probe label"),
4737
+ limit: z10.number().optional().describe("Maximum number of recent hits to return (default: all)")
4649
4738
  },
4650
4739
  async ({ probeId, label, limit }) => {
4651
4740
  const clientOrErr = requireDebugClient2(manager);
@@ -5976,7 +6065,10 @@ var QueryBridge = class {
5976
6065
  }
5977
6066
  };
5978
6067
 
5979
- // src/runner/session-runner.ts
6068
+ // src/runner/session-runner-helpers.ts
6069
+ import { readFileSync as readFileSync2 } from "fs";
6070
+ import { dirname, join as join2 } from "path";
6071
+ import { fileURLToPath } from "url";
5980
6072
  function mapChatHistory(messages) {
5981
6073
  if (!messages) return [];
5982
6074
  return messages.map((m) => ({
@@ -5998,6 +6090,22 @@ function mapChatHistory(messages) {
5998
6090
  } : {}
5999
6091
  }));
6000
6092
  }
6093
+ function readAgentVersion() {
6094
+ try {
6095
+ const here = dirname(fileURLToPath(import.meta.url));
6096
+ for (const rel of ["../package.json", "../../package.json"]) {
6097
+ try {
6098
+ const pkg = JSON.parse(readFileSync2(join2(here, rel), "utf-8"));
6099
+ if (pkg.version) return pkg.version;
6100
+ } catch {
6101
+ }
6102
+ }
6103
+ } catch {
6104
+ }
6105
+ return null;
6106
+ }
6107
+
6108
+ // src/runner/session-runner.ts
6001
6109
  var SessionRunner = class _SessionRunner {
6002
6110
  connection;
6003
6111
  mode;
@@ -6076,6 +6184,11 @@ var SessionRunner = class _SessionRunner {
6076
6184
  this.pendingMessages.push({ content: msg.content, userId: msg.userId });
6077
6185
  }
6078
6186
  }
6187
+ const agentVersion = readAgentVersion();
6188
+ if (agentVersion) {
6189
+ this.connection.call("notifyAgentVersion", { sessionId: this.sessionId, agentVersion }).catch(() => {
6190
+ });
6191
+ }
6079
6192
  }
6080
6193
  /**
6081
6194
  * Run the main agent lifecycle: fetch context, resolve mode, execute, loop.
@@ -6267,6 +6380,36 @@ var SessionRunner = class _SessionRunner {
6267
6380
  }
6268
6381
  }
6269
6382
  // ── Stop / soft-stop ───────────────────────────────────────────────
6383
+ /** Best-effort WIP commit + push on shutdown so in-flight work isn't lost
6384
+ * when a claudespace pod is killed. Must be called BEFORE stop() so the
6385
+ * connection is still alive for token refresh. Never throws. */
6386
+ async flushGitOnShutdown() {
6387
+ try {
6388
+ const result = await flushPendingChanges(this.config.workspaceDir, {
6389
+ wipMessage: "WIP: auto-commit on conveyor-agent shutdown",
6390
+ refreshToken: async () => {
6391
+ try {
6392
+ const res = await this.connection.call("refreshGithubToken", {
6393
+ sessionId: this.connection.sessionId
6394
+ });
6395
+ return res.token;
6396
+ } catch {
6397
+ return void 0;
6398
+ }
6399
+ }
6400
+ });
6401
+ if (result.hadWork) {
6402
+ process.stderr.write(
6403
+ `[conveyor-agent] Shutdown git flush: committed=${result.committed} pushed=${result.pushed}
6404
+ `
6405
+ );
6406
+ }
6407
+ } catch (err) {
6408
+ const msg = err instanceof Error ? err.message : String(err);
6409
+ process.stderr.write(`[conveyor-agent] Shutdown git flush failed: ${msg}
6410
+ `);
6411
+ }
6412
+ }
6270
6413
  stop() {
6271
6414
  this.stopped = true;
6272
6415
  this.queryBridge?.stop();
@@ -6838,13 +6981,13 @@ var CommitWatcher = class {
6838
6981
  // src/runner/worktree.ts
6839
6982
  import { execSync as execSync4 } from "child_process";
6840
6983
  import { existsSync } from "fs";
6841
- import { join as join2 } from "path";
6984
+ import { join as join3 } from "path";
6842
6985
  var WORKTREE_DIR = ".worktrees";
6843
6986
  function ensureWorktree(projectDir, taskId, branch) {
6844
6987
  if (projectDir.includes(`/${WORKTREE_DIR}/`)) {
6845
6988
  return projectDir;
6846
6989
  }
6847
- const worktreePath = join2(projectDir, WORKTREE_DIR, taskId);
6990
+ const worktreePath = join3(projectDir, WORKTREE_DIR, taskId);
6848
6991
  if (existsSync(worktreePath)) {
6849
6992
  if (branch) {
6850
6993
  if (hasUncommittedChanges(worktreePath)) {
@@ -6890,7 +7033,7 @@ function detachWorktreeBranch(projectDir, branch) {
6890
7033
  }
6891
7034
  }
6892
7035
  function removeWorktree(projectDir, taskId) {
6893
- const worktreePath = join2(projectDir, WORKTREE_DIR, taskId);
7036
+ const worktreePath = join3(projectDir, WORKTREE_DIR, taskId);
6894
7037
  if (!existsSync(worktreePath)) return;
6895
7038
  try {
6896
7039
  execSync4(`git worktree remove "${worktreePath}" --force`, {
@@ -6905,10 +7048,10 @@ function removeWorktree(projectDir, taskId) {
6905
7048
  import { fork } from "child_process";
6906
7049
  import { execSync as execSync5 } from "child_process";
6907
7050
  import * as path from "path";
6908
- import { fileURLToPath } from "url";
7051
+ import { fileURLToPath as fileURLToPath2 } from "url";
6909
7052
 
6910
7053
  // src/tools/project-tools.ts
6911
- import { z as z9 } from "zod";
7054
+ import { z as z11 } from "zod";
6912
7055
  function buildTaskListTools(connection) {
6913
7056
  const projectId = connection.projectId;
6914
7057
  return [
@@ -6916,9 +7059,9 @@ function buildTaskListTools(connection) {
6916
7059
  "list_tasks",
6917
7060
  "List tasks in the project. Optionally filter by status or assignee.",
6918
7061
  {
6919
- status: z9.string().optional().describe("Filter by task status"),
6920
- assigneeId: z9.string().optional().describe("Filter by assigned user ID"),
6921
- limit: z9.number().optional().describe("Max number of tasks to return (default 50)")
7062
+ status: z11.string().optional().describe("Filter by task status"),
7063
+ assigneeId: z11.string().optional().describe("Filter by assigned user ID"),
7064
+ limit: z11.number().optional().describe("Max number of tasks to return (default 50)")
6922
7065
  },
6923
7066
  async (params) => {
6924
7067
  try {
@@ -6935,7 +7078,7 @@ function buildTaskListTools(connection) {
6935
7078
  defineTool(
6936
7079
  "get_task",
6937
7080
  "Get detailed information about a task including chat messages, child tasks, and session.",
6938
- { task_id: z9.string().describe("The task ID to look up") },
7081
+ { task_id: z11.string().describe("The task ID to look up") },
6939
7082
  async ({ task_id }) => {
6940
7083
  try {
6941
7084
  const task = await connection.call("getProjectTask", { projectId, taskId: task_id });
@@ -6952,10 +7095,10 @@ function buildTaskListTools(connection) {
6952
7095
  "search_tasks",
6953
7096
  "Search tasks by tags, text query, or status filters.",
6954
7097
  {
6955
- tagNames: z9.array(z9.string()).optional().describe("Filter by tag names"),
6956
- searchQuery: z9.string().optional().describe("Text search in title/description"),
6957
- statusFilters: z9.array(z9.string()).optional().describe("Filter by statuses"),
6958
- limit: z9.number().optional().describe("Max results (default 20)")
7098
+ tagNames: z11.array(z11.string()).optional().describe("Filter by tag names"),
7099
+ searchQuery: z11.string().optional().describe("Text search in title/description"),
7100
+ statusFilters: z11.array(z11.string()).optional().describe("Filter by statuses"),
7101
+ limit: z11.number().optional().describe("Max results (default 20)")
6959
7102
  },
6960
7103
  async (params) => {
6961
7104
  try {
@@ -7015,11 +7158,11 @@ function buildMutationTools(connection) {
7015
7158
  "create_task",
7016
7159
  "Create a new task in the project.",
7017
7160
  {
7018
- title: z9.string().describe("Task title"),
7019
- description: z9.string().optional().describe("Task description"),
7020
- plan: z9.string().optional().describe("Implementation plan in markdown"),
7021
- status: z9.string().optional().describe("Initial status (default: Planning)"),
7022
- isBug: z9.boolean().optional().describe("Whether this is a bug report")
7161
+ title: z11.string().describe("Task title"),
7162
+ description: z11.string().optional().describe("Task description"),
7163
+ plan: z11.string().optional().describe("Implementation plan in markdown"),
7164
+ status: z11.string().optional().describe("Initial status (default: Planning)"),
7165
+ isBug: z11.boolean().optional().describe("Whether this is a bug report")
7023
7166
  },
7024
7167
  async (params) => {
7025
7168
  try {
@@ -7036,12 +7179,12 @@ function buildMutationTools(connection) {
7036
7179
  "update_task",
7037
7180
  "Update an existing task's title, description, plan, status, or assignee.",
7038
7181
  {
7039
- task_id: z9.string().describe("The task ID to update"),
7040
- title: z9.string().optional().describe("New title"),
7041
- description: z9.string().optional().describe("New description"),
7042
- plan: z9.string().optional().describe("New plan in markdown"),
7043
- status: z9.string().optional().describe("New status"),
7044
- assignedUserId: z9.string().nullable().optional().describe("Assign to user ID, or null to unassign")
7182
+ task_id: z11.string().describe("The task ID to update"),
7183
+ title: z11.string().optional().describe("New title"),
7184
+ description: z11.string().optional().describe("New description"),
7185
+ plan: z11.string().optional().describe("New plan in markdown"),
7186
+ status: z11.string().optional().describe("New status"),
7187
+ assignedUserId: z11.string().nullable().optional().describe("Assign to user ID, or null to unassign")
7045
7188
  },
7046
7189
  async ({ task_id, ...fields }) => {
7047
7190
  try {
@@ -7257,7 +7400,7 @@ async function handleProjectChatMessage(message, connection, projectDir, session
7257
7400
 
7258
7401
  // src/runner/project-runner.ts
7259
7402
  var logger7 = createServiceLogger("ProjectRunner");
7260
- var __filename = fileURLToPath(import.meta.url);
7403
+ var __filename = fileURLToPath2(import.meta.url);
7261
7404
  var __dirname = path.dirname(__filename);
7262
7405
  var HEARTBEAT_INTERVAL_MS = 3e4;
7263
7406
  var MAX_CONCURRENT = Math.max(1, parseInt(process.env.CONVEYOR_MAX_CONCURRENT ?? "10", 10) || 10);
@@ -7410,6 +7553,32 @@ var ProjectRunner = class {
7410
7553
  this.resolveLifecycle = resolve2;
7411
7554
  });
7412
7555
  }
7556
+ /** Best-effort WIP commit + push of every tracked working tree on shutdown.
7557
+ * Iterates the main project dir plus any active agent worktrees so nothing
7558
+ * pending is lost when the pod is killed. Never throws. */
7559
+ async flushGitOnShutdown() {
7560
+ const dirs = /* @__PURE__ */ new Set([this.projectDir]);
7561
+ for (const agent of this.activeAgents.values()) {
7562
+ if (agent.worktreePath) dirs.add(agent.worktreePath);
7563
+ }
7564
+ for (const dir of dirs) {
7565
+ try {
7566
+ const result = await flushPendingChanges(dir, {
7567
+ wipMessage: "WIP: auto-commit on conveyor-agent shutdown"
7568
+ });
7569
+ if (result.hadWork) {
7570
+ logger7.info("Shutdown git flush", {
7571
+ dir,
7572
+ committed: result.committed,
7573
+ pushed: result.pushed
7574
+ });
7575
+ }
7576
+ } catch (err) {
7577
+ const msg = err instanceof Error ? err.message : String(err);
7578
+ logger7.warn("Shutdown git flush failed", { dir, error: msg });
7579
+ }
7580
+ }
7581
+ }
7413
7582
  async stop() {
7414
7583
  if (this.stopping) return;
7415
7584
  this.stopping = true;
@@ -7437,6 +7606,7 @@ var ProjectRunner = class {
7437
7606
  setTimeout(resolve2, STOP_TIMEOUT_MS + 5e3);
7438
7607
  })
7439
7608
  ]);
7609
+ await this.flushGitOnShutdown();
7440
7610
  try {
7441
7611
  await this.connection.call("disconnectProjectRunner", {
7442
7612
  projectId: this.connection.projectId
@@ -7860,11 +8030,11 @@ var ProjectRunner = class {
7860
8030
 
7861
8031
  // src/setup/config.ts
7862
8032
  import { readFile as readFile2 } from "fs/promises";
7863
- import { join as join3 } from "path";
8033
+ import { join as join4 } from "path";
7864
8034
  var DEVCONTAINER_PATH = ".devcontainer/conveyor/devcontainer.json";
7865
8035
  async function loadForwardPorts(workspaceDir) {
7866
8036
  try {
7867
- const raw = await readFile2(join3(workspaceDir, DEVCONTAINER_PATH), "utf-8");
8037
+ const raw = await readFile2(join4(workspaceDir, DEVCONTAINER_PATH), "utf-8");
7868
8038
  const parsed = JSON.parse(raw);
7869
8039
  return parsed.forwardPorts ?? [];
7870
8040
  } catch {
@@ -7895,6 +8065,7 @@ export {
7895
8065
  hasUnpushedCommits,
7896
8066
  stageAndCommit,
7897
8067
  updateRemoteToken,
8068
+ flushPendingChanges,
7898
8069
  pushToOrigin,
7899
8070
  injectTelemetry,
7900
8071
  PlanSync,
@@ -7911,4 +8082,4 @@ export {
7911
8082
  loadForwardPorts,
7912
8083
  loadConveyorConfig
7913
8084
  };
7914
- //# sourceMappingURL=chunk-3O4P2KST.js.map
8085
+ //# sourceMappingURL=chunk-23JCJ2GV.js.map