@rallycry/conveyor-agent 7.1.1 → 7.1.4

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.
@@ -1,10 +1,13 @@
1
+ import {
2
+ imageBlock,
3
+ isImageMimeType,
4
+ textResult
5
+ } from "./chunk-C5YAMQJ2.js";
1
6
  import {
2
7
  createHarness,
8
+ createServiceLogger,
3
9
  defineTool
4
- } from "./chunk-KNBG2634.js";
5
- import {
6
- createServiceLogger
7
- } from "./chunk-CYZPFJGN.js";
10
+ } from "./chunk-U6AYNVS7.js";
8
11
 
9
12
  // src/connection/agent-connection.ts
10
13
  import { io } from "socket.io-client";
@@ -513,6 +516,26 @@ var ModeController = class {
513
516
  const m = this.effectiveMode;
514
517
  return m === "building" || m === "review" || m === "auto" && this._hasExitedPlanMode;
515
518
  }
519
+ /**
520
+ * Apply authoritative mode from the server's task context.
521
+ * Called after getTaskContext to override env-var defaults with the
522
+ * actual task state — ensures pods that launch without CONVEYOR_AGENT_MODE
523
+ * still get the correct mode.
524
+ */
525
+ applyServerMode(agentMode, isAuto) {
526
+ if (agentMode) {
527
+ this._mode = agentMode;
528
+ this._isAuto = agentMode === "auto" || !!isAuto;
529
+ } else if (isAuto !== void 0) {
530
+ this._isAuto = isAuto;
531
+ if (isAuto && this._runnerMode === "pm" && !this._mode) {
532
+ this._mode = "auto";
533
+ }
534
+ }
535
+ if (this._isAuto && this._mode === "discovery") {
536
+ this._mode = "auto";
537
+ }
538
+ }
516
539
  // ── Mode resolution ────────────────────────────────────────────────
517
540
  /** Resolve the initial mode based on task context */
518
541
  resolveInitialMode(context) {
@@ -541,6 +564,11 @@ var ModeController = class {
541
564
  this._mode = newMode;
542
565
  return { type: "restart_query", newMode: "review" };
543
566
  }
567
+ if (this._runnerMode === "task" && newMode === "building") {
568
+ this._mode = newMode;
569
+ this._hasExitedPlanMode = true;
570
+ return { type: "restart_query", newMode: "building" };
571
+ }
544
572
  if (this._runnerMode !== "pm") return { type: "noop" };
545
573
  this._mode = newMode;
546
574
  this.updateExitedPlanModeFlag(newMode);
@@ -946,522 +974,6 @@ var PlanSync = class {
946
974
  }
947
975
  };
948
976
 
949
- // ../shared/dist/index.js
950
- import { z } from "zod";
951
- import { z as z2 } from "zod";
952
- import { z as z3 } from "zod";
953
- var MAX_FILE_SIZE_BYTES = 25 * 1024 * 1024;
954
- var EMBED_THRESHOLD_IMAGES = 5 * 1024 * 1024;
955
- var EMBED_THRESHOLD_TEXT = 2 * 1024 * 1024;
956
- var AgentHeartbeatSchema = z.object({
957
- sessionId: z.string().optional(),
958
- timestamp: z.string(),
959
- status: z.enum(["active", "idle", "building"]),
960
- currentAction: z.string().optional()
961
- });
962
- var CreatePRInputSchema = z.object({
963
- title: z.string().min(1),
964
- body: z.string(),
965
- head: z.string().optional(),
966
- base: z.string().optional()
967
- });
968
- var PostToChatInputSchema = z.object({
969
- message: z.string().min(1),
970
- type: z.enum(["message", "question", "update"]).optional().default("message")
971
- });
972
- var GetTaskContextRequestSchema = z.object({
973
- sessionId: z.string(),
974
- includeHistory: z.boolean().optional().default(false)
975
- });
976
- var GetChatMessagesRequestSchema = z.object({
977
- sessionId: z.string(),
978
- limit: z.number().int().positive().optional().default(50),
979
- offset: z.number().int().nonnegative().optional().default(0)
980
- });
981
- var GetTaskFilesRequestSchema = z.object({
982
- sessionId: z.string()
983
- });
984
- var GetTaskFileRequestSchema = z.object({
985
- sessionId: z.string(),
986
- fileId: z.string()
987
- });
988
- var GetTaskRequestSchema = z.object({
989
- sessionId: z.string(),
990
- taskSlugOrId: z.string()
991
- });
992
- var GetCliHistoryRequestSchema = z.object({
993
- sessionId: z.string(),
994
- limit: z.number().int().positive().optional().default(100),
995
- source: z.enum(["agent", "application"]).optional()
996
- });
997
- var ListSubtasksRequestSchema = z.object({
998
- sessionId: z.string()
999
- });
1000
- var GetDependenciesRequestSchema = z.object({
1001
- sessionId: z.string()
1002
- });
1003
- var GetSuggestionsRequestSchema = z.object({
1004
- sessionId: z.string()
1005
- });
1006
- var GetTaskIncidentsRequestSchema = z.object({
1007
- sessionId: z.string(),
1008
- taskId: z.string().optional()
1009
- });
1010
- var CreatePullRequestRequestSchema = CreatePRInputSchema.extend({ sessionId: z.string() });
1011
- var UpdateTaskStatusRequestSchema = z.object({
1012
- sessionId: z.string(),
1013
- status: z.string(),
1014
- force: z.boolean().optional().default(false)
1015
- });
1016
- var StoreSessionIdRequestSchema = z.object({
1017
- sessionId: z.string(),
1018
- sdkSessionId: z.string()
1019
- });
1020
- var TrackSpendingRequestSchema = z.object({
1021
- sessionId: z.string(),
1022
- inputTokens: z.number().int().nonnegative(),
1023
- outputTokens: z.number().int().nonnegative(),
1024
- costUsd: z.number().nonnegative(),
1025
- model: z.string()
1026
- });
1027
- var SessionStartRequestSchema = z.object({
1028
- sessionId: z.string(),
1029
- agentVersion: z.string(),
1030
- capabilities: z.array(z.string())
1031
- });
1032
- var SessionStopRequestSchema = z.object({
1033
- sessionId: z.string(),
1034
- reason: z.string().optional()
1035
- });
1036
- var ConnectAgentRequestSchema = z.object({
1037
- sessionId: z.string()
1038
- });
1039
- var ReportAgentStatusRequestSchema = z.object({
1040
- sessionId: z.string(),
1041
- status: z.string()
1042
- });
1043
- var NotifyAgentVersionRequestSchema = z.object({
1044
- sessionId: z.string(),
1045
- agentVersion: z.string()
1046
- });
1047
- var CreateSubtaskRequestSchema = z.object({
1048
- sessionId: z.string(),
1049
- title: z.string().min(1),
1050
- description: z.string().optional(),
1051
- plan: z.string().optional(),
1052
- storyPointValue: z.number().int().positive().optional(),
1053
- ordinal: z.number().int().nonnegative().optional()
1054
- });
1055
- var UpdateSubtaskRequestSchema = z.object({
1056
- sessionId: z.string(),
1057
- subtaskId: z.string(),
1058
- title: z.string().min(1).optional(),
1059
- description: z.string().optional(),
1060
- plan: z.string().optional(),
1061
- status: z.string().optional(),
1062
- storyPointValue: z.number().int().positive().optional()
1063
- });
1064
- var DeleteSubtaskRequestSchema = z.object({
1065
- sessionId: z.string(),
1066
- subtaskId: z.string()
1067
- });
1068
- var SearchIncidentsRequestSchema = z.object({
1069
- sessionId: z.string(),
1070
- status: z.string().optional(),
1071
- source: z.string().optional()
1072
- });
1073
- var QueryGcpLogsRequestSchema = z.object({
1074
- sessionId: z.string(),
1075
- filter: z.string().optional(),
1076
- startTime: z.string().optional(),
1077
- endTime: z.string().optional(),
1078
- severity: z.string().optional(),
1079
- pageSize: z.number().int().positive().optional().default(100)
1080
- });
1081
- var GetTaskPropertiesRequestSchema = z.object({
1082
- sessionId: z.string()
1083
- });
1084
- var UpdateTaskFieldsRequestSchema = z.object({
1085
- sessionId: z.string(),
1086
- plan: z.string().optional(),
1087
- description: z.string().optional()
1088
- });
1089
- var UpdateTaskPropertiesRequestSchema = z.object({
1090
- sessionId: z.string(),
1091
- title: z.string().optional(),
1092
- storyPointValue: z.number().int().positive().optional(),
1093
- tagIds: z.array(z.string()).optional(),
1094
- githubPRUrl: z.string().url().optional()
1095
- });
1096
- var ListIconsRequestSchema = z.object({
1097
- sessionId: z.string()
1098
- });
1099
- var GenerateTaskIconRequestSchema = z.object({
1100
- sessionId: z.string(),
1101
- prompt: z.string().min(1),
1102
- aspectRatio: z.string().optional()
1103
- });
1104
- var SearchFaIconsRequestSchema = z.object({
1105
- sessionId: z.string(),
1106
- query: z.string().min(1),
1107
- first: z.number().int().positive().optional()
1108
- });
1109
- var PickFaIconRequestSchema = z.object({
1110
- sessionId: z.string(),
1111
- fontAwesomeId: z.string().min(1),
1112
- fontAwesomeStyle: z.string().optional()
1113
- });
1114
- var CreateFollowUpTaskRequestSchema = z.object({
1115
- sessionId: z.string(),
1116
- title: z.string().min(1),
1117
- description: z.string().optional(),
1118
- plan: z.string().optional(),
1119
- storyPointValue: z.number().int().positive().optional()
1120
- });
1121
- var AddDependencyRequestSchema = z.object({
1122
- sessionId: z.string(),
1123
- dependsOnSlugOrId: z.string()
1124
- });
1125
- var RemoveDependencyRequestSchema = z.object({
1126
- sessionId: z.string(),
1127
- dependsOnSlugOrId: z.string()
1128
- });
1129
- var CreateSuggestionRequestSchema = z.object({
1130
- sessionId: z.string(),
1131
- title: z.string().min(1),
1132
- description: z.string().optional(),
1133
- tagNames: z.array(z.string()).optional()
1134
- });
1135
- var VoteSuggestionRequestSchema = z.object({
1136
- sessionId: z.string(),
1137
- suggestionId: z.string(),
1138
- value: z.union([z.literal(1), z.literal(-1)])
1139
- });
1140
- var ScaleUpResourcesRequestSchema = z.object({
1141
- sessionId: z.string(),
1142
- tier: z.string(),
1143
- reason: z.string().optional()
1144
- });
1145
- var TriggerIdentificationRequestSchema = z.object({
1146
- sessionId: z.string()
1147
- });
1148
- var SubmitCodeReviewResultRequestSchema = z.object({
1149
- sessionId: z.string(),
1150
- approved: z.boolean(),
1151
- content: z.string()
1152
- });
1153
- var StartChildCloudBuildRequestSchema = z.object({
1154
- sessionId: z.string(),
1155
- childTaskId: z.string()
1156
- });
1157
- var StopChildBuildRequestSchema = z.object({
1158
- sessionId: z.string(),
1159
- childTaskId: z.string()
1160
- });
1161
- var ApproveAndMergePRRequestSchema = z.object({
1162
- sessionId: z.string(),
1163
- childTaskId: z.string()
1164
- });
1165
- var PostChildChatMessageRequestSchema = z.object({
1166
- sessionId: z.string(),
1167
- childTaskId: z.string(),
1168
- message: z.string().min(1)
1169
- });
1170
- var UpdateChildStatusRequestSchema = z.object({
1171
- sessionId: z.string(),
1172
- childTaskId: z.string(),
1173
- status: z.string()
1174
- });
1175
- var GetAgentStatusRequestSchema = z.object({
1176
- taskId: z.string()
1177
- });
1178
- var GetUiCliHistoryRequestSchema = z.object({
1179
- taskId: z.string()
1180
- });
1181
- var SendSoftStopRequestSchema = z.object({
1182
- taskId: z.string().optional(),
1183
- projectId: z.string().optional()
1184
- });
1185
- var FlushTaskQueueRequestSchema = z.object({
1186
- taskId: z.string()
1187
- });
1188
- var FlushProjectQueueRequestSchema = z.object({
1189
- projectId: z.string()
1190
- });
1191
- var CancelTaskQueuedMessageRequestSchema = z.object({
1192
- taskId: z.string(),
1193
- messageId: z.string()
1194
- });
1195
- var FlushSingleQueuedMessageRequestSchema = z.object({
1196
- taskId: z.string(),
1197
- messageId: z.string()
1198
- });
1199
- var FlushSingleProjectQueuedMessageRequestSchema = z.object({
1200
- projectId: z.string(),
1201
- index: z.number().int().nonnegative()
1202
- });
1203
- var AnswerAgentQuestionRequestSchema = z.object({
1204
- taskId: z.string(),
1205
- requestId: z.string(),
1206
- answers: z.record(z.string(), z.string())
1207
- });
1208
- var ClearAgentTodosRequestSchema = z.object({
1209
- taskId: z.string()
1210
- });
1211
- var AgentQuestionOptionSchema = z.object({
1212
- label: z.string(),
1213
- description: z.string(),
1214
- preview: z.string().optional()
1215
- });
1216
- var AgentQuestionSchema = z.object({
1217
- question: z.string(),
1218
- header: z.string(),
1219
- options: z.array(AgentQuestionOptionSchema),
1220
- multiSelect: z.boolean().optional()
1221
- });
1222
- var AskUserQuestionRequestSchema = z.object({
1223
- sessionId: z.string(),
1224
- question: z.string().min(1),
1225
- requestId: z.string().min(1),
1226
- questions: z.array(AgentQuestionSchema).min(1)
1227
- });
1228
- var RefreshGithubTokenRequestSchema = z.object({
1229
- sessionId: z.string()
1230
- });
1231
- var RefreshGithubTokenResponseSchema = z.object({
1232
- token: z.string()
1233
- });
1234
- var CreatePRResponseSchema = z.object({
1235
- prNumber: z.number().int().positive(),
1236
- prUrl: z.string().url()
1237
- });
1238
- var PostToChatResponseSchema = z.object({
1239
- messageId: z.string()
1240
- });
1241
- var UpdateTaskStatusResponseSchema = z.object({
1242
- taskId: z.string(),
1243
- status: z.string()
1244
- });
1245
- var StoreSessionIdResponseSchema = z.object({
1246
- success: z.boolean()
1247
- });
1248
- var HeartbeatResponseSchema = z.object({
1249
- acknowledged: z.boolean()
1250
- });
1251
- var SessionStartResponseSchema = z.object({
1252
- sessionId: z.string(),
1253
- startedAt: z.string()
1254
- });
1255
- var SessionStopResponseSchema = z.object({
1256
- sessionId: z.string(),
1257
- stoppedAt: z.string()
1258
- });
1259
- var DeleteSubtaskResponseSchema = z.object({
1260
- deleted: z.boolean()
1261
- });
1262
- var RegisterProjectAgentResponseSchema = z.object({
1263
- registered: z.boolean(),
1264
- agentName: z.string(),
1265
- agentInstructions: z.string(),
1266
- model: z.string(),
1267
- agentSettings: z.record(z.string(), z.unknown()).nullable(),
1268
- branchSwitchCommand: z.string().nullable()
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
- });
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
- });
1464
-
1465
977
  // src/execution/pack-runner-prompt.ts
1466
978
  function findLastAgentMessageIndex(history) {
1467
979
  for (let i = history.length - 1; i >= 0; i--) {
@@ -1985,7 +1497,7 @@ function buildReviewPrompt(context) {
1985
1497
  } else {
1986
1498
  parts.push(
1987
1499
  `### Code Review Process`,
1988
- `1. Run \`git diff <baseBranch>..HEAD\` to see all changes in this PR`,
1500
+ `1. Run \`git diff ${context?.baseBranch ?? "dev"}..HEAD\` to see all changes in this PR`,
1989
1501
  `2. Read the task plan to understand the intended changes`,
1990
1502
  `3. Explore the surrounding codebase to verify pattern consistency`,
1991
1503
  `4. Review against the criteria below`,
@@ -2502,16 +2014,16 @@ CRITICAL: You are in Auto mode. Do NOT report status, ask for confirmation, or g
2502
2014
  return [
2503
2015
  `You are the project manager for this task and its subtasks.`,
2504
2016
  `Review existing subtasks via \`list_subtasks\` and the chat history before taking action.`,
2505
- `Read the task description and chat history carefully \u2014 the team may have already provided context and requirements. Respond to what's been discussed rather than starting from scratch.`,
2506
- `The task details are provided above. Wait for the team to provide instructions before taking action.`,
2017
+ `Read the task description and chat history carefully \u2014 the team has provided the initial context below. Acknowledge what they've asked for and respond in chat before taking silent tool actions.`,
2018
+ `Start planning now \u2014 explore the codebase, ask clarifying questions if needed, and propose a subtask breakdown. Do not wait for additional team input before engaging.`,
2507
2019
  `When you finish planning, save the plan with update_task and end your turn. Your reply will be visible to the team in chat.`
2508
2020
  ];
2509
2021
  }
2510
2022
  if (isPm) {
2511
2023
  return [
2512
2024
  `You are the project manager for this task.`,
2513
- `Read the task description and chat history carefully \u2014 the team may have already provided context and requirements. Respond to what's been discussed rather than starting from scratch.`,
2514
- `The task details are provided above. Wait for the team to ask questions or provide additional requirements before starting to plan.`,
2025
+ `Read the task description and chat history carefully \u2014 the team has provided the initial context below. Acknowledge what they've asked for and respond in chat before taking silent tool actions.`,
2026
+ `Start planning now \u2014 explore the codebase, ask clarifying questions if needed, and draft a plan. Do not wait for additional team input before engaging; the initial message IS the team engaging.`,
2515
2027
  `When you finish planning, save the plan with update_task and end your turn. Your reply summarizing the plan will be visible in chat. A separate task agent will execute the plan after review.`
2516
2028
  ];
2517
2029
  }
@@ -2645,20 +2157,7 @@ async function buildInitialPrompt(mode, context, isAuto, agentMode) {
2645
2157
  }
2646
2158
 
2647
2159
  // src/tools/common-tools.ts
2648
- import { z as z4 } from "zod";
2649
-
2650
- // src/tools/helpers.ts
2651
- function textResult(text) {
2652
- return { content: [{ type: "text", text }] };
2653
- }
2654
- function imageBlock(data, mimeType) {
2655
- return { type: "image", data, mimeType };
2656
- }
2657
- function isImageMimeType(mimeType) {
2658
- return mimeType.startsWith("image/");
2659
- }
2660
-
2661
- // src/tools/common-tools.ts
2160
+ import { z } from "zod";
2662
2161
  var cliEventFormatters = {
2663
2162
  thinking: (e) => e.message ?? "",
2664
2163
  tool_use: (e) => `${e.tool}: ${e.input?.slice(0, 1e3) ?? ""}`,
@@ -2679,8 +2178,8 @@ function buildReadTaskChatTool(connection) {
2679
2178
  "read_task_chat",
2680
2179
  "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.",
2681
2180
  {
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.")
2181
+ limit: z.number().optional().describe("Number of recent messages to fetch (default 20)"),
2182
+ task_id: z.string().optional().describe("Child task ID to read chat from. Omit to read the current task's chat.")
2684
2183
  },
2685
2184
  async ({ limit, task_id }) => {
2686
2185
  try {
@@ -2724,7 +2223,7 @@ function buildGetTaskTool(connection) {
2724
2223
  "get_task",
2725
2224
  "Look up a task by slug or ID to get its title, description, plan, and status",
2726
2225
  {
2727
- slug_or_id: z4.string().describe("The task slug (e.g. 'my-task') or CUID")
2226
+ slug_or_id: z.string().describe("The task slug (e.g. 'my-task') or CUID")
2728
2227
  },
2729
2228
  async ({ slug_or_id }) => {
2730
2229
  try {
@@ -2747,9 +2246,9 @@ function buildGetTaskCliTool(connection) {
2747
2246
  "get_task_cli",
2748
2247
  "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.",
2749
2248
  {
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).")
2249
+ task_id: z.string().optional().describe("Task ID or slug. Omit to read logs from the current task."),
2250
+ source: z.enum(["agent", "application"]).optional().describe("Filter by log source. Omit for all logs."),
2251
+ limit: z.number().optional().describe("Max number of log entries to return (default 50, max 500).")
2753
2252
  },
2754
2253
  async ({ task_id, source, limit }) => {
2755
2254
  try {
@@ -2809,7 +2308,7 @@ function buildGetTaskFileTool(connection) {
2809
2308
  return defineTool(
2810
2309
  "get_task_file",
2811
2310
  "Get a specific task file's content and download URL by file ID",
2812
- { fileId: z4.string().describe("The file ID to retrieve") },
2311
+ { fileId: z.string().describe("The file ID to retrieve") },
2813
2312
  async ({ fileId }) => {
2814
2313
  try {
2815
2314
  const file = await connection.call("getTaskFile", {
@@ -2840,8 +2339,8 @@ function buildSearchIncidentsTool(connection) {
2840
2339
  "search_incidents",
2841
2340
  "Search incidents in the current project. Optionally filter by status (Open, Acknowledged, Investigating, Resolved, Closed) or source.",
2842
2341
  {
2843
- status: z4.string().optional().describe("Filter by incident status"),
2844
- source: z4.string().optional().describe("Filter by source (e.g., 'conveyor', 'agent', 'build')")
2342
+ status: z.string().optional().describe("Filter by incident status"),
2343
+ source: z.string().optional().describe("Filter by source (e.g., 'conveyor', 'agent', 'build')")
2845
2344
  },
2846
2345
  async ({ status, source }) => {
2847
2346
  try {
@@ -2865,7 +2364,7 @@ function buildGetTaskIncidentsTool(connection) {
2865
2364
  "get_task_incidents",
2866
2365
  "Get all incidents linked to the current task (or a specified task). Returns full incident details including title, description, severity, status, and source.",
2867
2366
  {
2868
- task_id: z4.string().optional().describe("Task ID (defaults to current task)")
2367
+ task_id: z.string().optional().describe("Task ID (defaults to current task)")
2869
2368
  },
2870
2369
  async ({ task_id }) => {
2871
2370
  try {
@@ -2888,12 +2387,12 @@ function buildQueryGcpLogsTool(connection) {
2888
2387
  "query_gcp_logs",
2889
2388
  "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.",
2890
2389
  {
2891
- filter: z4.string().optional().describe(
2390
+ filter: z.string().optional().describe(
2892
2391
  `Cloud Logging filter expression (e.g., 'resource.type="gce_instance"'). Max 1000 chars.`
2893
2392
  ),
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([
2393
+ start_time: z.string().optional().describe("Start time in ISO 8601 format (e.g., '2024-01-01T00:00:00Z')"),
2394
+ end_time: z.string().optional().describe("End time in ISO 8601 format (e.g., '2024-01-02T00:00:00Z')"),
2395
+ severity: z.enum([
2897
2396
  "DEFAULT",
2898
2397
  "DEBUG",
2899
2398
  "INFO",
@@ -2904,7 +2403,7 @@ function buildQueryGcpLogsTool(connection) {
2904
2403
  "ALERT",
2905
2404
  "EMERGENCY"
2906
2405
  ]).optional().describe("Minimum severity level to filter by (default: all levels)"),
2907
- page_size: z4.number().optional().describe("Number of log entries to return (default 100, max 500)")
2406
+ page_size: z.number().optional().describe("Number of log entries to return (default 100, max 500)")
2908
2407
  },
2909
2408
  async ({ filter, start_time, end_time, severity, page_size }) => {
2910
2409
  try {
@@ -2958,8 +2457,8 @@ function buildGetSuggestionsTool(connection) {
2958
2457
  "get_suggestions",
2959
2458
  "List project suggestions sorted by vote score. Use this to see what the team thinks is important.",
2960
2459
  {
2961
- status: z4.string().optional().describe("Filter by status: Open, Accepted, Rejected, Implemented"),
2962
- limit: z4.number().optional().describe("Max results (default 20)")
2460
+ status: z.string().optional().describe("Filter by status: Open, Accepted, Rejected, Implemented"),
2461
+ limit: z.number().optional().describe("Max results (default 20)")
2963
2462
  },
2964
2463
  async ({ status: _status, limit: _limit }) => {
2965
2464
  try {
@@ -2984,8 +2483,8 @@ function buildPostToChatTool(connection) {
2984
2483
  "post_to_chat",
2985
2484
  "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.",
2986
2485
  {
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.")
2486
+ message: z.string().describe("The message to post to the team"),
2487
+ task_id: z.string().optional().describe("Child task ID to post to. Omit to post to the current task's chat.")
2989
2488
  },
2990
2489
  async ({ message, task_id }) => {
2991
2490
  try {
@@ -3012,8 +2511,8 @@ function buildForceUpdateTaskStatusTool(connection) {
3012
2511
  "force_update_task_status",
3013
2512
  "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.",
3014
2513
  {
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.")
2514
+ status: z.enum(["InProgress", "ReviewPR", "ReviewDev", "Complete"]).describe("The new status for the task"),
2515
+ task_id: z.string().optional().describe("Child task ID to update. Omit to update the current task.")
3017
2516
  },
3018
2517
  async ({ status, task_id }) => {
3019
2518
  try {
@@ -3044,15 +2543,15 @@ function buildCreatePullRequestTool(connection, config) {
3044
2543
  "create_pull_request",
3045
2544
  "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.",
3046
2545
  {
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(
2546
+ title: z.string().describe("The PR title"),
2547
+ body: z.string().describe("The PR description/body in markdown"),
2548
+ branch: z.string().optional().describe(
3050
2549
  "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."
3051
2550
  ),
3052
- baseBranch: z4.string().optional().describe(
2551
+ baseBranch: z.string().optional().describe(
3053
2552
  "The base branch to target for the PR (e.g. 'main', 'develop'). Defaults to the project's configured dev branch."
3054
2553
  ),
3055
- commitMessage: z4.string().optional().describe(
2554
+ commitMessage: z.string().optional().describe(
3056
2555
  "Commit message for staging uncommitted changes. If not provided, a default message based on the PR title will be used."
3057
2556
  )
3058
2557
  },
@@ -3130,7 +2629,7 @@ function buildAddDependencyTool(connection) {
3130
2629
  "add_dependency",
3131
2630
  "Add a dependency \u2014 this task cannot start until the specified task is merged to dev",
3132
2631
  {
3133
- depends_on_slug_or_id: z4.string().describe("Slug or ID of the task this task depends on")
2632
+ depends_on_slug_or_id: z.string().describe("Slug or ID of the task this task depends on")
3134
2633
  },
3135
2634
  async ({ depends_on_slug_or_id }) => {
3136
2635
  try {
@@ -3152,7 +2651,7 @@ function buildRemoveDependencyTool(connection) {
3152
2651
  "remove_dependency",
3153
2652
  "Remove a dependency from this task",
3154
2653
  {
3155
- depends_on_slug_or_id: z4.string().describe("Slug or ID of the task to remove as dependency")
2654
+ depends_on_slug_or_id: z.string().describe("Slug or ID of the task to remove as dependency")
3156
2655
  },
3157
2656
  async ({ depends_on_slug_or_id }) => {
3158
2657
  try {
@@ -3174,10 +2673,10 @@ function buildCreateFollowUpTaskTool(connection) {
3174
2673
  "create_follow_up_task",
3175
2674
  "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.",
3176
2675
  {
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)")
2676
+ title: z.string().describe("Follow-up task title"),
2677
+ description: z.string().optional().describe("Brief description of the follow-up work"),
2678
+ plan: z.string().optional().describe("Implementation plan if known"),
2679
+ story_point_value: z.number().optional().describe("Story point estimate (1=Common, 2=Magic, 3=Rare, 5=Unique)")
3181
2680
  },
3182
2681
  async ({ title, description, plan, story_point_value }) => {
3183
2682
  try {
@@ -3204,9 +2703,9 @@ function buildCreateSuggestionTool(connection) {
3204
2703
  "create_suggestion",
3205
2704
  "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.",
3206
2705
  {
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")
2706
+ title: z.string().describe("Short title for the suggestion"),
2707
+ description: z.string().optional().describe("Details about the suggestion"),
2708
+ tag_names: z.array(z.string()).optional().describe("Tag names to categorize the suggestion")
3210
2709
  },
3211
2710
  async ({ title, description, tag_names }) => {
3212
2711
  try {
@@ -3235,8 +2734,8 @@ function buildVoteSuggestionTool(connection) {
3235
2734
  "vote_suggestion",
3236
2735
  "Vote on a project suggestion. Use +1 to upvote or -1 to downvote.",
3237
2736
  {
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")
2737
+ suggestion_id: z.string().describe("The suggestion ID to vote on"),
2738
+ value: z.number().refine((v) => v === 1 || v === -1, { message: "Value must be 1 or -1" }).describe("+1 to upvote, -1 to downvote")
3240
2739
  },
3241
2740
  async ({ suggestion_id, value }) => {
3242
2741
  try {
@@ -3259,8 +2758,8 @@ function buildScaleUpResourcesTool(connection) {
3259
2758
  "scale_up_resources",
3260
2759
  "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).",
3261
2760
  {
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')")
2761
+ tier: z.literal("build").describe("The resource phase to scale up to"),
2762
+ reason: z.string().optional().describe("Brief reason for scaling (e.g., 'running test suite')")
3264
2763
  },
3265
2764
  async ({ tier, reason }) => {
3266
2765
  try {
@@ -3313,15 +2812,15 @@ function buildCommonTools(connection, config) {
3313
2812
  }
3314
2813
 
3315
2814
  // src/tools/pm-tools.ts
3316
- import { z as z5 } from "zod";
2815
+ import { z as z2 } from "zod";
3317
2816
  var SP_DESCRIPTION = "Story point value (1=Common, 2=Magic, 3=Rare, 5=Unique)";
3318
2817
  function buildUpdateTaskTool(connection) {
3319
2818
  return defineTool(
3320
2819
  "update_task",
3321
2820
  "Save the finalized task plan and/or description",
3322
2821
  {
3323
- plan: z5.string().optional().describe("The task plan in markdown"),
3324
- description: z5.string().optional().describe("Updated task description")
2822
+ plan: z2.string().optional().describe("The task plan in markdown"),
2823
+ description: z2.string().optional().describe("Updated task description")
3325
2824
  },
3326
2825
  async ({ plan, description }) => {
3327
2826
  try {
@@ -3342,11 +2841,11 @@ function buildCreateSubtaskTool(connection) {
3342
2841
  "create_subtask",
3343
2842
  "Create a subtask under the current parent task. Use for breaking complex tasks into smaller pieces.",
3344
2843
  {
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)
2844
+ title: z2.string().describe("Subtask title"),
2845
+ description: z2.string().optional().describe("Brief description"),
2846
+ plan: z2.string().optional().describe("Implementation plan in markdown"),
2847
+ ordinal: z2.number().optional().describe("Step/order number (0-based)"),
2848
+ storyPointValue: z2.number().optional().describe(SP_DESCRIPTION)
3350
2849
  },
3351
2850
  async ({ title, description, plan, ordinal, storyPointValue }) => {
3352
2851
  try {
@@ -3372,12 +2871,12 @@ function buildUpdateSubtaskTool(connection) {
3372
2871
  "update_subtask",
3373
2872
  "Update an existing subtask's fields",
3374
2873
  {
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)
2874
+ subtaskId: z2.string().describe("The subtask ID to update"),
2875
+ title: z2.string().optional(),
2876
+ description: z2.string().optional(),
2877
+ plan: z2.string().optional(),
2878
+ ordinal: z2.number().optional(),
2879
+ storyPointValue: z2.number().optional().describe(SP_DESCRIPTION)
3381
2880
  },
3382
2881
  async ({ subtaskId, title, description, plan, storyPointValue }) => {
3383
2882
  try {
@@ -3400,7 +2899,7 @@ function buildDeleteSubtaskTool(connection) {
3400
2899
  return defineTool(
3401
2900
  "delete_subtask",
3402
2901
  "Delete a subtask",
3403
- { subtaskId: z5.string().describe("The subtask ID to delete") },
2902
+ { subtaskId: z2.string().describe("The subtask ID to delete") },
3404
2903
  async ({ subtaskId }) => {
3405
2904
  try {
3406
2905
  await connection.call("deleteSubtask", {
@@ -3438,7 +2937,7 @@ function buildPackTools(connection) {
3438
2937
  "start_child_cloud_build",
3439
2938
  "Start a cloud build for a child task. The child must be in Open status with story points and an agent assigned.",
3440
2939
  {
3441
- childTaskId: z5.string().describe("The child task ID to start a cloud build for")
2940
+ childTaskId: z2.string().describe("The child task ID to start a cloud build for")
3442
2941
  },
3443
2942
  async ({ childTaskId }) => {
3444
2943
  try {
@@ -3458,7 +2957,7 @@ function buildPackTools(connection) {
3458
2957
  "stop_child_build",
3459
2958
  "Stop a running cloud build for a child task. Sends a stop signal to the child agent.",
3460
2959
  {
3461
- childTaskId: z5.string().describe("The child task ID whose build should be stopped")
2960
+ childTaskId: z2.string().describe("The child task ID whose build should be stopped")
3462
2961
  },
3463
2962
  async ({ childTaskId }) => {
3464
2963
  try {
@@ -3478,7 +2977,7 @@ function buildPackTools(connection) {
3478
2977
  "approve_and_merge_pr",
3479
2978
  "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.",
3480
2979
  {
3481
- childTaskId: z5.string().describe("The child task ID whose PR should be approved and merged")
2980
+ childTaskId: z2.string().describe("The child task ID whose PR should be approved and merged")
3482
2981
  },
3483
2982
  async ({ childTaskId }) => {
3484
2983
  try {
@@ -3516,7 +3015,7 @@ function buildPmTools(connection, options) {
3516
3015
  }
3517
3016
 
3518
3017
  // src/tools/discovery-tools.ts
3519
- import { z as z6 } from "zod";
3018
+ import { z as z3 } from "zod";
3520
3019
  var SP_DESCRIPTION2 = "Story point value (1=Common, 2=Magic, 3=Rare, 5=Unique)";
3521
3020
  function buildDiscoveryTools(connection) {
3522
3021
  return [
@@ -3524,10 +3023,10 @@ function buildDiscoveryTools(connection) {
3524
3023
  "update_task_properties",
3525
3024
  "Set one or more task properties in a single call. All fields are optional \u2014 only include the fields you want to update.",
3526
3025
  {
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")
3026
+ title: z3.string().optional().describe("The new task title"),
3027
+ storyPointValue: z3.number().optional().describe(SP_DESCRIPTION2),
3028
+ tagIds: z3.array(z3.string()).optional().describe("Array of tag IDs to assign"),
3029
+ githubPRUrl: z3.string().url().optional().describe("GitHub pull request URL to link to this task")
3531
3030
  },
3532
3031
  async ({ title, storyPointValue, tagIds, githubPRUrl }) => {
3533
3032
  try {
@@ -3556,14 +3055,14 @@ function buildDiscoveryTools(connection) {
3556
3055
  }
3557
3056
 
3558
3057
  // src/tools/code-review-tools.ts
3559
- import { z as z7 } from "zod";
3058
+ import { z as z4 } from "zod";
3560
3059
  function buildCodeReviewTools(connection) {
3561
3060
  return [
3562
3061
  defineTool(
3563
3062
  "approve_code_review",
3564
3063
  "Approve the code review. Use this when the code passes all review criteria and is ready to merge.",
3565
3064
  {
3566
- summary: z7.string().describe("Brief summary of what was reviewed and why it looks good")
3065
+ summary: z4.string().describe("Brief summary of what was reviewed and why it looks good")
3567
3066
  },
3568
3067
  async ({ summary }) => {
3569
3068
  const content = `**Code Review: Approved** :white_check_mark:
@@ -3586,15 +3085,15 @@ ${summary}`;
3586
3085
  "request_code_changes",
3587
3086
  "Request changes during code review. Use this when substantive issues are found that need to be fixed before merge.",
3588
3087
  {
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")
3088
+ issues: z4.array(
3089
+ z4.object({
3090
+ file: z4.string().describe("File path where the issue was found"),
3091
+ line: z4.number().optional().describe("Line number (if applicable)"),
3092
+ severity: z4.enum(["critical", "major", "minor"]).describe("Issue severity"),
3093
+ description: z4.string().describe("What is wrong and how to fix it")
3595
3094
  })
3596
3095
  ).describe("List of issues found during review"),
3597
- summary: z7.string().describe("Brief overall summary of the review findings")
3096
+ summary: z4.string().describe("Brief overall summary of the review findings")
3598
3097
  },
3599
3098
  async ({ issues, summary }) => {
3600
3099
  const issueLines = issues.map((issue) => {
@@ -3624,10 +3123,10 @@ ${issueLines}`;
3624
3123
  }
3625
3124
 
3626
3125
  // src/tools/debug-tools.ts
3627
- import { z as z10 } from "zod";
3126
+ import { z as z7 } from "zod";
3628
3127
 
3629
3128
  // src/tools/telemetry-tools.ts
3630
- import { z as z8 } from "zod";
3129
+ import { z as z5 } from "zod";
3631
3130
 
3632
3131
  // src/debug/telemetry-injector.ts
3633
3132
  var BUFFER_SIZE = 200;
@@ -4022,12 +3521,12 @@ function buildGetTelemetryTool(manager) {
4022
3521
  "debug_get_telemetry",
4023
3522
  "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.",
4024
3523
  {
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)")
3524
+ type: z5.enum(["http", "db", "socket", "error"]).optional().describe("Filter by event type"),
3525
+ urlPattern: z5.string().optional().describe("Regex pattern to filter HTTP events by URL"),
3526
+ minDuration: z5.number().optional().describe("Minimum duration in ms \u2014 only return events slower than this"),
3527
+ errorOnly: z5.boolean().optional().describe("Only return error events and HTTP 4xx/5xx responses"),
3528
+ since: z5.number().optional().describe("Only return events after this timestamp (ms since epoch)"),
3529
+ limit: z5.number().optional().describe("Max events to return (default: 20, from most recent)")
4031
3530
  },
4032
3531
  async ({ type, urlPattern, minDuration, errorOnly, since, limit }) => {
4033
3532
  const clientOrErr = requireDebugClient(manager);
@@ -4097,7 +3596,7 @@ function buildTelemetryTools(manager) {
4097
3596
  }
4098
3597
 
4099
3598
  // src/tools/client-debug-tools.ts
4100
- import { z as z9 } from "zod";
3599
+ import { z as z6 } from "zod";
4101
3600
  function requirePlaywrightClient(manager) {
4102
3601
  if (!manager.isClientDebugMode()) {
4103
3602
  return "Client debug mode is not active. Use debug_enter_mode with clientSide: true first.";
@@ -4117,11 +3616,11 @@ function buildClientBreakpointTools(manager) {
4117
3616
  "debug_set_client_breakpoint",
4118
3617
  "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.",
4119
3618
  {
4120
- file: z9.string().describe(
3619
+ file: z6.string().describe(
4121
3620
  "Original source file path (e.g., src/components/App.tsx) \u2014 source maps resolve automatically"
4122
3621
  ),
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")
3622
+ line: z6.number().describe("Line number (1-based) in the original source file"),
3623
+ condition: z6.string().optional().describe("JavaScript condition expression \u2014 breakpoint only triggers when truthy")
4125
3624
  },
4126
3625
  async ({ file, line, condition }) => {
4127
3626
  const clientOrErr = requirePlaywrightClient(manager);
@@ -4143,7 +3642,7 @@ Breakpoint ID: ${breakpointId}${sourceMapNote}`
4143
3642
  "debug_remove_client_breakpoint",
4144
3643
  "Remove a previously set client-side breakpoint by its ID.",
4145
3644
  {
4146
- breakpointId: z9.string().describe("The breakpoint ID returned by debug_set_client_breakpoint")
3645
+ breakpointId: z6.string().describe("The breakpoint ID returned by debug_set_client_breakpoint")
4147
3646
  },
4148
3647
  async ({ breakpointId }) => {
4149
3648
  const clientOrErr = requirePlaywrightClient(manager);
@@ -4223,8 +3722,8 @@ ${JSON.stringify(queuedHits, null, 2)}`
4223
3722
  "debug_evaluate_client",
4224
3723
  "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.",
4225
3724
  {
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.")
3725
+ expression: z6.string().describe("JavaScript expression to evaluate in the browser context"),
3726
+ frameIndex: z6.number().optional().describe("Call stack frame index (0 = top frame). Defaults to the top frame.")
4228
3727
  },
4229
3728
  async ({ expression, frameIndex }) => {
4230
3729
  const clientOrErr = requirePlaywrightClient(manager);
@@ -4297,7 +3796,7 @@ function buildClientInteractionTools(manager) {
4297
3796
  "debug_navigate_client",
4298
3797
  "Navigate the headless browser to a specific URL. Use this to reproduce specific flows or visit different pages.",
4299
3798
  {
4300
- url: z9.string().describe("URL to navigate to (e.g., http://localhost:3000/dashboard)")
3799
+ url: z6.string().describe("URL to navigate to (e.g., http://localhost:3000/dashboard)")
4301
3800
  },
4302
3801
  async ({ url }) => {
4303
3802
  const clientOrErr = requirePlaywrightClient(manager);
@@ -4314,7 +3813,7 @@ function buildClientInteractionTools(manager) {
4314
3813
  "debug_click_client",
4315
3814
  "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.",
4316
3815
  {
4317
- selector: z9.string().describe(
3816
+ selector: z6.string().describe(
4318
3817
  "CSS selector of the element to click (e.g., 'button.submit', '#login-form input[type=submit]')"
4319
3818
  )
4320
3819
  },
@@ -4336,8 +3835,8 @@ function buildClientConsoleTool(manager) {
4336
3835
  "debug_get_client_console",
4337
3836
  "Get console messages captured from the headless browser. Includes console.log, warn, error, etc.",
4338
3837
  {
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)")
3838
+ level: z6.string().optional().describe("Filter by console level: log, warn, error, info, debug"),
3839
+ limit: z6.number().optional().describe("Maximum number of recent messages to return (default: all)")
4341
3840
  },
4342
3841
  // oxlint-disable-next-line require-await
4343
3842
  async ({ level, limit }) => {
@@ -4364,8 +3863,8 @@ function buildClientNetworkTool(manager) {
4364
3863
  "debug_get_client_network",
4365
3864
  "Get network requests captured from the headless browser. Shows URLs, methods, status codes, and timing.",
4366
3865
  {
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)")
3866
+ filter: z6.string().optional().describe("Regex pattern to filter requests by URL"),
3867
+ limit: z6.number().optional().describe("Maximum number of recent requests to return (default: all)")
4369
3868
  },
4370
3869
  // oxlint-disable-next-line require-await
4371
3870
  async ({ filter, limit }) => {
@@ -4393,7 +3892,7 @@ function buildClientErrorsTool(manager) {
4393
3892
  "debug_get_client_errors",
4394
3893
  "Get uncaught errors captured from the headless browser. Includes error messages and source-mapped stack traces.",
4395
3894
  {
4396
- limit: z9.number().optional().describe("Maximum number of recent errors to return (default: all)")
3895
+ limit: z6.number().optional().describe("Maximum number of recent errors to return (default: all)")
4397
3896
  },
4398
3897
  // oxlint-disable-next-line require-await
4399
3898
  async ({ limit }) => {
@@ -4487,12 +3986,12 @@ function buildDebugLifecycleTools(manager) {
4487
3986
  "debug_enter_mode",
4488
3987
  "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.",
4489
3988
  {
4490
- hypothesis: z10.string().optional().describe("Your hypothesis about the bug \u2014 helps track debugging intent"),
4491
- serverSide: z10.boolean().optional().describe(
3989
+ hypothesis: z7.string().optional().describe("Your hypothesis about the bug \u2014 helps track debugging intent"),
3990
+ serverSide: z7.boolean().optional().describe(
4492
3991
  "Enable server-side Node.js debugging (default: true if clientSide is not set)"
4493
3992
  ),
4494
- clientSide: z10.boolean().optional().describe("Enable client-side browser debugging via headless Chromium + Playwright"),
4495
- previewUrl: z10.string().optional().describe(
3993
+ clientSide: z7.boolean().optional().describe("Enable client-side browser debugging via headless Chromium + Playwright"),
3994
+ previewUrl: z7.string().optional().describe(
4496
3995
  "Preview URL for client-side debugging (e.g., http://localhost:3000). Required when clientSide is true."
4497
3996
  )
4498
3997
  },
@@ -4528,9 +4027,9 @@ function buildBreakpointTools(manager) {
4528
4027
  "debug_set_breakpoint",
4529
4028
  "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.",
4530
4029
  {
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")
4030
+ file: z7.string().describe("Absolute or relative file path to set the breakpoint in"),
4031
+ line: z7.number().describe("Line number (1-based) to set the breakpoint on"),
4032
+ condition: z7.string().optional().describe("JavaScript condition expression \u2014 breakpoint only triggers when truthy")
4534
4033
  },
4535
4034
  async ({ file, line, condition }) => {
4536
4035
  const clientOrErr = requireDebugClient2(manager);
@@ -4552,7 +4051,7 @@ Breakpoint ID: ${breakpointId}`
4552
4051
  "debug_remove_breakpoint",
4553
4052
  "Remove a previously set breakpoint by its ID.",
4554
4053
  {
4555
- breakpointId: z10.string().describe("The breakpoint ID returned by debug_set_breakpoint")
4054
+ breakpointId: z7.string().describe("The breakpoint ID returned by debug_set_breakpoint")
4556
4055
  },
4557
4056
  async ({ breakpointId }) => {
4558
4057
  const clientOrErr = requireDebugClient2(manager);
@@ -4633,8 +4132,8 @@ ${JSON.stringify(queuedHits, null, 2)}`
4633
4132
  "debug_evaluate",
4634
4133
  "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.",
4635
4134
  {
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.")
4135
+ expression: z7.string().describe("The JavaScript expression to evaluate"),
4136
+ frameIndex: z7.number().optional().describe("Call stack frame index (0 = top frame). Defaults to the top frame.")
4638
4137
  },
4639
4138
  async ({ expression, frameIndex }) => {
4640
4139
  const clientOrErr = requireDebugClient2(manager);
@@ -4662,12 +4161,12 @@ function buildProbeManagementTools(manager) {
4662
4161
  "debug_add_probe",
4663
4162
  "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.",
4664
4163
  {
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(
4164
+ file: z7.string().describe("File path to probe"),
4165
+ line: z7.number().describe("Line number (1-based) to probe"),
4166
+ expressions: z7.array(z7.string()).describe(
4668
4167
  'JavaScript expressions to capture when the line executes (e.g., ["req.params.id", "user.role"])'
4669
4168
  ),
4670
- label: z10.string().optional().describe("Optional label for this probe (defaults to file:line)")
4169
+ label: z7.string().optional().describe("Optional label for this probe (defaults to file:line)")
4671
4170
  },
4672
4171
  async ({ file, line, expressions, label }) => {
4673
4172
  const clientOrErr = requireDebugClient2(manager);
@@ -4692,7 +4191,7 @@ Trigger the code path, then use debug_get_probe_results to see captured values.`
4692
4191
  "debug_remove_probe",
4693
4192
  "Remove a previously set debug probe by its ID.",
4694
4193
  {
4695
- probeId: z10.string().describe("The probe ID returned by debug_add_probe")
4194
+ probeId: z7.string().describe("The probe ID returned by debug_add_probe")
4696
4195
  },
4697
4196
  async ({ probeId }) => {
4698
4197
  const clientOrErr = requireDebugClient2(manager);
@@ -4732,9 +4231,9 @@ function buildProbeResultTools(manager) {
4732
4231
  "debug_get_probe_results",
4733
4232
  "Fetch captured probe hit data. Returns expression values from each time a probed line executed.",
4734
4233
  {
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)")
4234
+ probeId: z7.string().optional().describe("Filter results by probe ID (resolves to its label)"),
4235
+ label: z7.string().optional().describe("Filter results by probe label"),
4236
+ limit: z7.number().optional().describe("Maximum number of recent hits to return (default: all)")
4738
4237
  },
4739
4238
  async ({ probeId, label, limit }) => {
4740
4239
  const clientOrErr = requireDebugClient2(manager);
@@ -5418,6 +4917,7 @@ async function handleExitPlanMode(host, input) {
5418
4917
  }
5419
4918
  if (host.agentMode === "discovery") {
5420
4919
  host.hasExitedPlanMode = true;
4920
+ host.pendingModeRestart = true;
5421
4921
  void host.connection.triggerIdentification();
5422
4922
  host.connection.postChatMessage(
5423
4923
  "Plan complete. Running identification \u2014 icon and agent assignment will be set automatically."
@@ -5497,6 +4997,12 @@ function buildCanUseTool(host) {
5497
4997
  if (toolName === "ExitPlanMode" && (host.agentMode === "auto" || host.agentMode === "discovery") && !host.hasExitedPlanMode) {
5498
4998
  return await handleExitPlanMode(host, input);
5499
4999
  }
5000
+ if (toolName === "ExitPlanMode" && host.agentMode === "discovery" && host.hasExitedPlanMode) {
5001
+ return {
5002
+ behavior: "deny",
5003
+ message: "Plan mode has already been exited. The team will transition you to Building mode when ready."
5004
+ };
5005
+ }
5500
5006
  if (toolName === "AskUserQuestion") {
5501
5007
  return await handleAskUserQuestion(host, input);
5502
5008
  }
@@ -6114,9 +5620,7 @@ var SessionRunner = class _SessionRunner {
6114
5620
  callbacks;
6115
5621
  _state = "connecting";
6116
5622
  stopped = false;
6117
- hasCompleted = false;
6118
5623
  interrupted = false;
6119
- _isReviewing = false;
6120
5624
  taskContext = null;
6121
5625
  fullContext = null;
6122
5626
  queryBridge = null;
@@ -6224,6 +5728,7 @@ var SessionRunner = class _SessionRunner {
6224
5728
  if (this.fullContext?.baseBranch) {
6225
5729
  syncWithBaseBranch(this.config.workspaceDir, this.fullContext.baseBranch);
6226
5730
  }
5731
+ this.mode.applyServerMode(this.fullContext?.agentMode, this.fullContext?.isAuto);
6227
5732
  this.mode.resolveInitialMode(this.taskContext);
6228
5733
  this.queryBridge = this.createQueryBridge();
6229
5734
  this.logInitialization();
@@ -6232,15 +5737,9 @@ var SessionRunner = class _SessionRunner {
6232
5737
  if (staleMessageCount > 0 && didExecuteInitialQuery) {
6233
5738
  this.pendingMessages.splice(0, staleMessageCount);
6234
5739
  }
6235
- if (!this.stopped && this._state !== "error") {
6236
- this.hasCompleted = true;
6237
- }
6238
5740
  if (!this.stopped && this.pendingMessages.length === 0) {
6239
5741
  await this.maybeSendPRNudge();
6240
5742
  }
6241
- if (!this.stopped && this.pendingMessages.length === 0) {
6242
- await this.maybeTransitionToReview();
6243
- }
6244
5743
  if (!this.stopped) {
6245
5744
  process.stderr.write(
6246
5745
  `[conveyor-agent] Listening for messages (mode: ${this.mode.effectiveMode})
@@ -6258,34 +5757,6 @@ var SessionRunner = class _SessionRunner {
6258
5757
  await this.connect();
6259
5758
  await this.run();
6260
5759
  }
6261
- // ── Message filtering ──────────────────────────────────────────────
6262
- /**
6263
- * Returns true if the message should be skipped (not processed).
6264
- *
6265
- * After the agent has completed, we only process:
6266
- * 1. Critical automated sources (e.g. CI failure) — always process
6267
- * 2. Messages with source: "user" — real user typed in chat
6268
- * 3. Messages from flushAllCombined — have a real userId but no source
6269
- *
6270
- * Everything else (system messages, stale history replays) is skipped.
6271
- */
6272
- shouldSkipMessage(msg) {
6273
- if (!this.hasCompleted) return false;
6274
- const isCritical = !!msg.source && CRITICAL_AUTOMATED_SOURCES.has(msg.source);
6275
- if (isCritical) {
6276
- this.hasCompleted = false;
6277
- return false;
6278
- }
6279
- if (msg.source === "user") {
6280
- this.hasCompleted = false;
6281
- return false;
6282
- }
6283
- if (!msg.source && msg.userId !== "system") {
6284
- this.hasCompleted = false;
6285
- return false;
6286
- }
6287
- return true;
6288
- }
6289
5760
  // ── Core loop ──────────────────────────────────────────────────────
6290
5761
  async coreLoop() {
6291
5762
  while (!this.stopped) {
@@ -6300,7 +5771,6 @@ var SessionRunner = class _SessionRunner {
6300
5771
  }
6301
5772
  break;
6302
5773
  }
6303
- if (this.shouldSkipMessage(msg)) continue;
6304
5774
  await this.setState("running");
6305
5775
  this.interrupted = false;
6306
5776
  await this.callbacks.onEvent({
@@ -6317,7 +5787,6 @@ var SessionRunner = class _SessionRunner {
6317
5787
  if (!this.stopped && this.pendingMessages.length === 0) {
6318
5788
  await this.maybeSendPRNudge();
6319
5789
  }
6320
- this.hasCompleted = true;
6321
5790
  if (!this.stopped) await this.setState("idle");
6322
5791
  } else if (this._state === "error") {
6323
5792
  await this.setState("idle");
@@ -6485,38 +5954,8 @@ var SessionRunner = class _SessionRunner {
6485
5954
  await this.refreshTaskContext();
6486
5955
  }
6487
5956
  }
6488
- // ── Same-box review transition ─────────────────────────────────
6489
- async maybeTransitionToReview() {
6490
- if (!this.config.isAuto || this._isReviewing) return;
6491
- await this.refreshTaskContext();
6492
- if (!this.taskContext?.githubPRUrl || this.taskContext.status !== "ReviewPR") return;
6493
- this._isReviewing = true;
6494
- try {
6495
- this.mode.handleModeChange("review");
6496
- process.stderr.write(
6497
- `[conveyor-agent] Auto-transitioning to review mode (same-box code review)
6498
- `
6499
- );
6500
- this.connection.sendEvent({
6501
- type: "mode_transition",
6502
- from: "building",
6503
- to: "review"
6504
- });
6505
- this.connection.emitModeChanged("review");
6506
- const reviewPrompt = [
6507
- `You have just created a PR for this task. Now perform a self-review of your changes.`,
6508
- `Run \`git diff ${this.fullContext?.baseBranch ?? "dev"}..HEAD\` to see all changes.`,
6509
- `Review the changes according to the review criteria in your instructions.`,
6510
- `If you find issues, fix them directly, commit, and push. Then approve the review.`,
6511
- `If everything looks good, approve the review using \`approve_code_review\`.`
6512
- ].join("\n");
6513
- await this.setState("running");
6514
- await this.executeQuery(reviewPrompt);
6515
- } finally {
6516
- this._isReviewing = false;
6517
- }
6518
- }
6519
5957
  // ── Context & bridge construction ────────────────────────────────
5958
+ // oxlint-disable-next-line complexity
6520
5959
  buildFullContext(ctx) {
6521
5960
  const chatHistory = mapChatHistory(ctx.chatHistory);
6522
5961
  return {
@@ -6543,7 +5982,10 @@ var SessionRunner = class _SessionRunner {
6543
5982
  projectTags: ctx.projectTags ?? void 0,
6544
5983
  taskTagIds: ctx.taskTagIds ?? void 0,
6545
5984
  projectObjectives: ctx.projectObjectives ?? void 0,
6546
- incidents: ctx.incidents ?? void 0
5985
+ incidents: ctx.incidents ?? void 0,
5986
+ agentSettings: ctx.agentSettings ?? null,
5987
+ agentMode: ctx.agentMode ?? void 0,
5988
+ isAuto: ctx.isAuto
6547
5989
  };
6548
5990
  }
6549
5991
  createQueryBridge() {
@@ -6594,6 +6036,9 @@ var SessionRunner = class _SessionRunner {
6594
6036
  this.connection.emitModeChanged(this.mode.effectiveMode);
6595
6037
  this.softStop();
6596
6038
  } else if (action.type === "restart_query") {
6039
+ if (this.fullContext && action.newMode === "review") {
6040
+ this.fullContext.claudeSessionId = null;
6041
+ }
6597
6042
  this.connection.emitModeChanged(action.newMode);
6598
6043
  this.softStop();
6599
6044
  }
@@ -6767,6 +6212,9 @@ var ProjectConnection = class {
6767
6212
  onAuditTags(callback) {
6768
6213
  this.requireSocket().on("projectRunner:auditTags", callback);
6769
6214
  }
6215
+ onAuditTasks(callback) {
6216
+ this.requireSocket().on("projectRunner:auditTasks", callback);
6217
+ }
6770
6218
  // ── Outgoing helpers ───────────────────────────────────────────────────
6771
6219
  sendHeartbeat() {
6772
6220
  void this.call("projectRunnerHeartbeat", { projectId: this.config.projectId }).catch(() => {
@@ -7051,7 +6499,7 @@ import * as path from "path";
7051
6499
  import { fileURLToPath as fileURLToPath2 } from "url";
7052
6500
 
7053
6501
  // src/tools/project-tools.ts
7054
- import { z as z11 } from "zod";
6502
+ import { z as z8 } from "zod";
7055
6503
  function buildTaskListTools(connection) {
7056
6504
  const projectId = connection.projectId;
7057
6505
  return [
@@ -7059,9 +6507,9 @@ function buildTaskListTools(connection) {
7059
6507
  "list_tasks",
7060
6508
  "List tasks in the project. Optionally filter by status or assignee.",
7061
6509
  {
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)")
6510
+ status: z8.string().optional().describe("Filter by task status"),
6511
+ assigneeId: z8.string().optional().describe("Filter by assigned user ID"),
6512
+ limit: z8.number().optional().describe("Max number of tasks to return (default 50)")
7065
6513
  },
7066
6514
  async (params) => {
7067
6515
  try {
@@ -7078,7 +6526,7 @@ function buildTaskListTools(connection) {
7078
6526
  defineTool(
7079
6527
  "get_task",
7080
6528
  "Get detailed information about a task including chat messages, child tasks, and session.",
7081
- { task_id: z11.string().describe("The task ID to look up") },
6529
+ { task_id: z8.string().describe("The task ID to look up") },
7082
6530
  async ({ task_id }) => {
7083
6531
  try {
7084
6532
  const task = await connection.call("getProjectTask", { projectId, taskId: task_id });
@@ -7095,10 +6543,10 @@ function buildTaskListTools(connection) {
7095
6543
  "search_tasks",
7096
6544
  "Search tasks by tags, text query, or status filters.",
7097
6545
  {
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)")
6546
+ tagNames: z8.array(z8.string()).optional().describe("Filter by tag names"),
6547
+ searchQuery: z8.string().optional().describe("Text search in title/description"),
6548
+ statusFilters: z8.array(z8.string()).optional().describe("Filter by statuses"),
6549
+ limit: z8.number().optional().describe("Max results (default 20)")
7102
6550
  },
7103
6551
  async (params) => {
7104
6552
  try {
@@ -7158,11 +6606,11 @@ function buildMutationTools(connection) {
7158
6606
  "create_task",
7159
6607
  "Create a new task in the project.",
7160
6608
  {
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")
6609
+ title: z8.string().describe("Task title"),
6610
+ description: z8.string().optional().describe("Task description"),
6611
+ plan: z8.string().optional().describe("Implementation plan in markdown"),
6612
+ status: z8.string().optional().describe("Initial status (default: Planning)"),
6613
+ isBug: z8.boolean().optional().describe("Whether this is a bug report")
7166
6614
  },
7167
6615
  async (params) => {
7168
6616
  try {
@@ -7179,12 +6627,12 @@ function buildMutationTools(connection) {
7179
6627
  "update_task",
7180
6628
  "Update an existing task's title, description, plan, status, or assignee.",
7181
6629
  {
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")
6630
+ task_id: z8.string().describe("The task ID to update"),
6631
+ title: z8.string().optional().describe("New title"),
6632
+ description: z8.string().optional().describe("New description"),
6633
+ plan: z8.string().optional().describe("New plan in markdown"),
6634
+ status: z8.string().optional().describe("New status"),
6635
+ assignedUserId: z8.string().nullable().optional().describe("Assign to user ID, or null to unassign")
7188
6636
  },
7189
6637
  async ({ task_id, ...fields }) => {
7190
6638
  try {
@@ -7635,6 +7083,7 @@ var ProjectRunner = class {
7635
7083
  );
7636
7084
  });
7637
7085
  this.connection.onAuditTags((request) => void this.handleAuditTags(request));
7086
+ this.connection.onAuditTasks((request) => void this.handleAuditTasks(request));
7638
7087
  this.connection.onSwitchBranch((data, cb) => void this.handleSwitchBranch(data, cb));
7639
7088
  this.connection.onSyncEnvironment((cb) => void this.handleSyncEnvironment(cb));
7640
7089
  this.connection.onRestartStartCommand((cb) => {
@@ -7660,7 +7109,7 @@ var ProjectRunner = class {
7660
7109
  async handleAuditTags(request) {
7661
7110
  this.connection.emitStatus("busy");
7662
7111
  try {
7663
- const { handleTagAudit } = await import("./tag-audit-handler-PACJJEDB.js");
7112
+ const { handleTagAudit } = await import("./tag-audit-handler-BM6MMS5T.js");
7664
7113
  await handleTagAudit(request, this.connection, this.projectDir);
7665
7114
  } catch (error) {
7666
7115
  const msg = error instanceof Error ? error.message : String(error);
@@ -7679,6 +7128,47 @@ var ProjectRunner = class {
7679
7128
  this.connection.emitStatus("idle");
7680
7129
  }
7681
7130
  }
7131
+ // ── Task audit ─────────────────────────────────────────────────────────
7132
+ async handleAuditTasks(request) {
7133
+ this.connection.emitStatus("busy");
7134
+ try {
7135
+ const { handleTaskAudit } = await import("./task-audit-handler-URD2BOC4.js");
7136
+ await handleTaskAudit(request, this.connection, this.projectDir);
7137
+ } catch (error) {
7138
+ const msg = error instanceof Error ? error.message : String(error);
7139
+ logger7.error("Task audit failed", { error: msg, requestId: request.requestId });
7140
+ for (const task of request.tasks) {
7141
+ try {
7142
+ await this.connection.call("reportTaskAuditResult", {
7143
+ projectId: this.connection.projectId,
7144
+ requestId: request.requestId,
7145
+ taskId: task.taskId,
7146
+ summary: "",
7147
+ turnGrades: [],
7148
+ planningAccuracy: null,
7149
+ buildingAccuracy: null,
7150
+ humanAccuracy: null,
7151
+ planningCorrect: 0,
7152
+ planningNeutral: 0,
7153
+ planningBlunder: 0,
7154
+ buildingCorrect: 0,
7155
+ buildingNeutral: 0,
7156
+ buildingBlunder: 0,
7157
+ humanCorrect: 0,
7158
+ humanNeutral: 0,
7159
+ humanBlunder: 0,
7160
+ suggestionIds: [],
7161
+ auditCostUsd: null,
7162
+ model: null,
7163
+ error: `Audit failed: ${msg}`
7164
+ });
7165
+ } catch {
7166
+ }
7167
+ }
7168
+ } finally {
7169
+ this.connection.emitStatus("idle");
7170
+ }
7171
+ }
7682
7172
  // ── Task management ────────────────────────────────────────────────────
7683
7173
  async killAgent(agent, taskId) {
7684
7174
  const shortId = taskId.slice(0, 8);
@@ -8082,4 +7572,4 @@ export {
8082
7572
  loadForwardPorts,
8083
7573
  loadConveyorConfig
8084
7574
  };
8085
- //# sourceMappingURL=chunk-23JCJ2GV.js.map
7575
+ //# sourceMappingURL=chunk-H2GKXPFI.js.map