@rallycry/conveyor-agent 7.1.3 → 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.
- package/dist/chunk-C5YAMQJ2.js +17 -0
- package/dist/chunk-C5YAMQJ2.js.map +1 -0
- package/dist/{chunk-AZ6CRVYN.js → chunk-H2GKXPFI.js} +218 -697
- package/dist/chunk-H2GKXPFI.js.map +1 -0
- package/dist/cli.js +2 -1
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +10 -13
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/task-audit-handler-URD2BOC4.js +381 -0
- package/dist/task-audit-handler-URD2BOC4.js.map +1 -0
- package/package.json +1 -1
- package/dist/chunk-AZ6CRVYN.js.map +0 -1
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import {
|
|
2
|
+
imageBlock,
|
|
3
|
+
isImageMimeType,
|
|
4
|
+
textResult
|
|
5
|
+
} from "./chunk-C5YAMQJ2.js";
|
|
1
6
|
import {
|
|
2
7
|
createHarness,
|
|
3
8
|
createServiceLogger,
|
|
@@ -511,6 +516,26 @@ var ModeController = class {
|
|
|
511
516
|
const m = this.effectiveMode;
|
|
512
517
|
return m === "building" || m === "review" || m === "auto" && this._hasExitedPlanMode;
|
|
513
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
|
+
}
|
|
514
539
|
// ── Mode resolution ────────────────────────────────────────────────
|
|
515
540
|
/** Resolve the initial mode based on task context */
|
|
516
541
|
resolveInitialMode(context) {
|
|
@@ -539,6 +564,11 @@ var ModeController = class {
|
|
|
539
564
|
this._mode = newMode;
|
|
540
565
|
return { type: "restart_query", newMode: "review" };
|
|
541
566
|
}
|
|
567
|
+
if (this._runnerMode === "task" && newMode === "building") {
|
|
568
|
+
this._mode = newMode;
|
|
569
|
+
this._hasExitedPlanMode = true;
|
|
570
|
+
return { type: "restart_query", newMode: "building" };
|
|
571
|
+
}
|
|
542
572
|
if (this._runnerMode !== "pm") return { type: "noop" };
|
|
543
573
|
this._mode = newMode;
|
|
544
574
|
this.updateExitedPlanModeFlag(newMode);
|
|
@@ -944,522 +974,6 @@ var PlanSync = class {
|
|
|
944
974
|
}
|
|
945
975
|
};
|
|
946
976
|
|
|
947
|
-
// ../shared/dist/index.js
|
|
948
|
-
import { z } from "zod";
|
|
949
|
-
import { z as z2 } from "zod";
|
|
950
|
-
import { z as z3 } from "zod";
|
|
951
|
-
var MAX_FILE_SIZE_BYTES = 25 * 1024 * 1024;
|
|
952
|
-
var EMBED_THRESHOLD_IMAGES = 5 * 1024 * 1024;
|
|
953
|
-
var EMBED_THRESHOLD_TEXT = 2 * 1024 * 1024;
|
|
954
|
-
var AgentHeartbeatSchema = z.object({
|
|
955
|
-
sessionId: z.string().optional(),
|
|
956
|
-
timestamp: z.string(),
|
|
957
|
-
status: z.enum(["active", "idle", "building"]),
|
|
958
|
-
currentAction: z.string().optional()
|
|
959
|
-
});
|
|
960
|
-
var CreatePRInputSchema = z.object({
|
|
961
|
-
title: z.string().min(1),
|
|
962
|
-
body: z.string(),
|
|
963
|
-
head: z.string().optional(),
|
|
964
|
-
base: z.string().optional()
|
|
965
|
-
});
|
|
966
|
-
var PostToChatInputSchema = z.object({
|
|
967
|
-
message: z.string().min(1),
|
|
968
|
-
type: z.enum(["message", "question", "update"]).optional().default("message")
|
|
969
|
-
});
|
|
970
|
-
var GetTaskContextRequestSchema = z.object({
|
|
971
|
-
sessionId: z.string(),
|
|
972
|
-
includeHistory: z.boolean().optional().default(false)
|
|
973
|
-
});
|
|
974
|
-
var GetChatMessagesRequestSchema = z.object({
|
|
975
|
-
sessionId: z.string(),
|
|
976
|
-
limit: z.number().int().positive().optional().default(50),
|
|
977
|
-
offset: z.number().int().nonnegative().optional().default(0)
|
|
978
|
-
});
|
|
979
|
-
var GetTaskFilesRequestSchema = z.object({
|
|
980
|
-
sessionId: z.string()
|
|
981
|
-
});
|
|
982
|
-
var GetTaskFileRequestSchema = z.object({
|
|
983
|
-
sessionId: z.string(),
|
|
984
|
-
fileId: z.string()
|
|
985
|
-
});
|
|
986
|
-
var GetTaskRequestSchema = z.object({
|
|
987
|
-
sessionId: z.string(),
|
|
988
|
-
taskSlugOrId: z.string()
|
|
989
|
-
});
|
|
990
|
-
var GetCliHistoryRequestSchema = z.object({
|
|
991
|
-
sessionId: z.string(),
|
|
992
|
-
limit: z.number().int().positive().optional().default(100),
|
|
993
|
-
source: z.enum(["agent", "application"]).optional()
|
|
994
|
-
});
|
|
995
|
-
var ListSubtasksRequestSchema = z.object({
|
|
996
|
-
sessionId: z.string()
|
|
997
|
-
});
|
|
998
|
-
var GetDependenciesRequestSchema = z.object({
|
|
999
|
-
sessionId: z.string()
|
|
1000
|
-
});
|
|
1001
|
-
var GetSuggestionsRequestSchema = z.object({
|
|
1002
|
-
sessionId: z.string()
|
|
1003
|
-
});
|
|
1004
|
-
var GetTaskIncidentsRequestSchema = z.object({
|
|
1005
|
-
sessionId: z.string(),
|
|
1006
|
-
taskId: z.string().optional()
|
|
1007
|
-
});
|
|
1008
|
-
var CreatePullRequestRequestSchema = CreatePRInputSchema.extend({ sessionId: z.string() });
|
|
1009
|
-
var UpdateTaskStatusRequestSchema = z.object({
|
|
1010
|
-
sessionId: z.string(),
|
|
1011
|
-
status: z.string(),
|
|
1012
|
-
force: z.boolean().optional().default(false)
|
|
1013
|
-
});
|
|
1014
|
-
var StoreSessionIdRequestSchema = z.object({
|
|
1015
|
-
sessionId: z.string(),
|
|
1016
|
-
sdkSessionId: z.string()
|
|
1017
|
-
});
|
|
1018
|
-
var TrackSpendingRequestSchema = z.object({
|
|
1019
|
-
sessionId: z.string(),
|
|
1020
|
-
inputTokens: z.number().int().nonnegative(),
|
|
1021
|
-
outputTokens: z.number().int().nonnegative(),
|
|
1022
|
-
costUsd: z.number().nonnegative(),
|
|
1023
|
-
model: z.string()
|
|
1024
|
-
});
|
|
1025
|
-
var SessionStartRequestSchema = z.object({
|
|
1026
|
-
sessionId: z.string(),
|
|
1027
|
-
agentVersion: z.string(),
|
|
1028
|
-
capabilities: z.array(z.string())
|
|
1029
|
-
});
|
|
1030
|
-
var SessionStopRequestSchema = z.object({
|
|
1031
|
-
sessionId: z.string(),
|
|
1032
|
-
reason: z.string().optional()
|
|
1033
|
-
});
|
|
1034
|
-
var ConnectAgentRequestSchema = z.object({
|
|
1035
|
-
sessionId: z.string()
|
|
1036
|
-
});
|
|
1037
|
-
var ReportAgentStatusRequestSchema = z.object({
|
|
1038
|
-
sessionId: z.string(),
|
|
1039
|
-
status: z.string()
|
|
1040
|
-
});
|
|
1041
|
-
var NotifyAgentVersionRequestSchema = z.object({
|
|
1042
|
-
sessionId: z.string(),
|
|
1043
|
-
agentVersion: z.string()
|
|
1044
|
-
});
|
|
1045
|
-
var CreateSubtaskRequestSchema = z.object({
|
|
1046
|
-
sessionId: z.string(),
|
|
1047
|
-
title: z.string().min(1),
|
|
1048
|
-
description: z.string().optional(),
|
|
1049
|
-
plan: z.string().optional(),
|
|
1050
|
-
storyPointValue: z.number().int().positive().optional(),
|
|
1051
|
-
ordinal: z.number().int().nonnegative().optional()
|
|
1052
|
-
});
|
|
1053
|
-
var UpdateSubtaskRequestSchema = z.object({
|
|
1054
|
-
sessionId: z.string(),
|
|
1055
|
-
subtaskId: z.string(),
|
|
1056
|
-
title: z.string().min(1).optional(),
|
|
1057
|
-
description: z.string().optional(),
|
|
1058
|
-
plan: z.string().optional(),
|
|
1059
|
-
status: z.string().optional(),
|
|
1060
|
-
storyPointValue: z.number().int().positive().optional()
|
|
1061
|
-
});
|
|
1062
|
-
var DeleteSubtaskRequestSchema = z.object({
|
|
1063
|
-
sessionId: z.string(),
|
|
1064
|
-
subtaskId: z.string()
|
|
1065
|
-
});
|
|
1066
|
-
var SearchIncidentsRequestSchema = z.object({
|
|
1067
|
-
sessionId: z.string(),
|
|
1068
|
-
status: z.string().optional(),
|
|
1069
|
-
source: z.string().optional()
|
|
1070
|
-
});
|
|
1071
|
-
var QueryGcpLogsRequestSchema = z.object({
|
|
1072
|
-
sessionId: z.string(),
|
|
1073
|
-
filter: z.string().optional(),
|
|
1074
|
-
startTime: z.string().optional(),
|
|
1075
|
-
endTime: z.string().optional(),
|
|
1076
|
-
severity: z.string().optional(),
|
|
1077
|
-
pageSize: z.number().int().positive().optional().default(100)
|
|
1078
|
-
});
|
|
1079
|
-
var GetTaskPropertiesRequestSchema = z.object({
|
|
1080
|
-
sessionId: z.string()
|
|
1081
|
-
});
|
|
1082
|
-
var UpdateTaskFieldsRequestSchema = z.object({
|
|
1083
|
-
sessionId: z.string(),
|
|
1084
|
-
plan: z.string().optional(),
|
|
1085
|
-
description: z.string().optional()
|
|
1086
|
-
});
|
|
1087
|
-
var UpdateTaskPropertiesRequestSchema = z.object({
|
|
1088
|
-
sessionId: z.string(),
|
|
1089
|
-
title: z.string().optional(),
|
|
1090
|
-
storyPointValue: z.number().int().positive().optional(),
|
|
1091
|
-
tagIds: z.array(z.string()).optional(),
|
|
1092
|
-
githubPRUrl: z.string().url().optional()
|
|
1093
|
-
});
|
|
1094
|
-
var ListIconsRequestSchema = z.object({
|
|
1095
|
-
sessionId: z.string()
|
|
1096
|
-
});
|
|
1097
|
-
var GenerateTaskIconRequestSchema = z.object({
|
|
1098
|
-
sessionId: z.string(),
|
|
1099
|
-
prompt: z.string().min(1),
|
|
1100
|
-
aspectRatio: z.string().optional()
|
|
1101
|
-
});
|
|
1102
|
-
var SearchFaIconsRequestSchema = z.object({
|
|
1103
|
-
sessionId: z.string(),
|
|
1104
|
-
query: z.string().min(1),
|
|
1105
|
-
first: z.number().int().positive().optional()
|
|
1106
|
-
});
|
|
1107
|
-
var PickFaIconRequestSchema = z.object({
|
|
1108
|
-
sessionId: z.string(),
|
|
1109
|
-
fontAwesomeId: z.string().min(1),
|
|
1110
|
-
fontAwesomeStyle: z.string().optional()
|
|
1111
|
-
});
|
|
1112
|
-
var CreateFollowUpTaskRequestSchema = z.object({
|
|
1113
|
-
sessionId: z.string(),
|
|
1114
|
-
title: z.string().min(1),
|
|
1115
|
-
description: z.string().optional(),
|
|
1116
|
-
plan: z.string().optional(),
|
|
1117
|
-
storyPointValue: z.number().int().positive().optional()
|
|
1118
|
-
});
|
|
1119
|
-
var AddDependencyRequestSchema = z.object({
|
|
1120
|
-
sessionId: z.string(),
|
|
1121
|
-
dependsOnSlugOrId: z.string()
|
|
1122
|
-
});
|
|
1123
|
-
var RemoveDependencyRequestSchema = z.object({
|
|
1124
|
-
sessionId: z.string(),
|
|
1125
|
-
dependsOnSlugOrId: z.string()
|
|
1126
|
-
});
|
|
1127
|
-
var CreateSuggestionRequestSchema = z.object({
|
|
1128
|
-
sessionId: z.string(),
|
|
1129
|
-
title: z.string().min(1),
|
|
1130
|
-
description: z.string().optional(),
|
|
1131
|
-
tagNames: z.array(z.string()).optional()
|
|
1132
|
-
});
|
|
1133
|
-
var VoteSuggestionRequestSchema = z.object({
|
|
1134
|
-
sessionId: z.string(),
|
|
1135
|
-
suggestionId: z.string(),
|
|
1136
|
-
value: z.union([z.literal(1), z.literal(-1)])
|
|
1137
|
-
});
|
|
1138
|
-
var ScaleUpResourcesRequestSchema = z.object({
|
|
1139
|
-
sessionId: z.string(),
|
|
1140
|
-
tier: z.string(),
|
|
1141
|
-
reason: z.string().optional()
|
|
1142
|
-
});
|
|
1143
|
-
var TriggerIdentificationRequestSchema = z.object({
|
|
1144
|
-
sessionId: z.string()
|
|
1145
|
-
});
|
|
1146
|
-
var SubmitCodeReviewResultRequestSchema = z.object({
|
|
1147
|
-
sessionId: z.string(),
|
|
1148
|
-
approved: z.boolean(),
|
|
1149
|
-
content: z.string()
|
|
1150
|
-
});
|
|
1151
|
-
var StartChildCloudBuildRequestSchema = z.object({
|
|
1152
|
-
sessionId: z.string(),
|
|
1153
|
-
childTaskId: z.string()
|
|
1154
|
-
});
|
|
1155
|
-
var StopChildBuildRequestSchema = z.object({
|
|
1156
|
-
sessionId: z.string(),
|
|
1157
|
-
childTaskId: z.string()
|
|
1158
|
-
});
|
|
1159
|
-
var ApproveAndMergePRRequestSchema = z.object({
|
|
1160
|
-
sessionId: z.string(),
|
|
1161
|
-
childTaskId: z.string()
|
|
1162
|
-
});
|
|
1163
|
-
var PostChildChatMessageRequestSchema = z.object({
|
|
1164
|
-
sessionId: z.string(),
|
|
1165
|
-
childTaskId: z.string(),
|
|
1166
|
-
message: z.string().min(1)
|
|
1167
|
-
});
|
|
1168
|
-
var UpdateChildStatusRequestSchema = z.object({
|
|
1169
|
-
sessionId: z.string(),
|
|
1170
|
-
childTaskId: z.string(),
|
|
1171
|
-
status: z.string()
|
|
1172
|
-
});
|
|
1173
|
-
var GetAgentStatusRequestSchema = z.object({
|
|
1174
|
-
taskId: z.string()
|
|
1175
|
-
});
|
|
1176
|
-
var GetUiCliHistoryRequestSchema = z.object({
|
|
1177
|
-
taskId: z.string()
|
|
1178
|
-
});
|
|
1179
|
-
var SendSoftStopRequestSchema = z.object({
|
|
1180
|
-
taskId: z.string().optional(),
|
|
1181
|
-
projectId: z.string().optional()
|
|
1182
|
-
});
|
|
1183
|
-
var FlushTaskQueueRequestSchema = z.object({
|
|
1184
|
-
taskId: z.string()
|
|
1185
|
-
});
|
|
1186
|
-
var FlushProjectQueueRequestSchema = z.object({
|
|
1187
|
-
projectId: z.string()
|
|
1188
|
-
});
|
|
1189
|
-
var CancelTaskQueuedMessageRequestSchema = z.object({
|
|
1190
|
-
taskId: z.string(),
|
|
1191
|
-
messageId: z.string()
|
|
1192
|
-
});
|
|
1193
|
-
var FlushSingleQueuedMessageRequestSchema = z.object({
|
|
1194
|
-
taskId: z.string(),
|
|
1195
|
-
messageId: z.string()
|
|
1196
|
-
});
|
|
1197
|
-
var FlushSingleProjectQueuedMessageRequestSchema = z.object({
|
|
1198
|
-
projectId: z.string(),
|
|
1199
|
-
index: z.number().int().nonnegative()
|
|
1200
|
-
});
|
|
1201
|
-
var AnswerAgentQuestionRequestSchema = z.object({
|
|
1202
|
-
taskId: z.string(),
|
|
1203
|
-
requestId: z.string(),
|
|
1204
|
-
answers: z.record(z.string(), z.string())
|
|
1205
|
-
});
|
|
1206
|
-
var ClearAgentTodosRequestSchema = z.object({
|
|
1207
|
-
taskId: z.string()
|
|
1208
|
-
});
|
|
1209
|
-
var AgentQuestionOptionSchema = z.object({
|
|
1210
|
-
label: z.string(),
|
|
1211
|
-
description: z.string(),
|
|
1212
|
-
preview: z.string().optional()
|
|
1213
|
-
});
|
|
1214
|
-
var AgentQuestionSchema = z.object({
|
|
1215
|
-
question: z.string(),
|
|
1216
|
-
header: z.string(),
|
|
1217
|
-
options: z.array(AgentQuestionOptionSchema),
|
|
1218
|
-
multiSelect: z.boolean().optional()
|
|
1219
|
-
});
|
|
1220
|
-
var AskUserQuestionRequestSchema = z.object({
|
|
1221
|
-
sessionId: z.string(),
|
|
1222
|
-
question: z.string().min(1),
|
|
1223
|
-
requestId: z.string().min(1),
|
|
1224
|
-
questions: z.array(AgentQuestionSchema).min(1)
|
|
1225
|
-
});
|
|
1226
|
-
var RefreshGithubTokenRequestSchema = z.object({
|
|
1227
|
-
sessionId: z.string()
|
|
1228
|
-
});
|
|
1229
|
-
var RefreshGithubTokenResponseSchema = z.object({
|
|
1230
|
-
token: z.string()
|
|
1231
|
-
});
|
|
1232
|
-
var CreatePRResponseSchema = z.object({
|
|
1233
|
-
prNumber: z.number().int().positive(),
|
|
1234
|
-
prUrl: z.string().url()
|
|
1235
|
-
});
|
|
1236
|
-
var PostToChatResponseSchema = z.object({
|
|
1237
|
-
messageId: z.string()
|
|
1238
|
-
});
|
|
1239
|
-
var UpdateTaskStatusResponseSchema = z.object({
|
|
1240
|
-
taskId: z.string(),
|
|
1241
|
-
status: z.string()
|
|
1242
|
-
});
|
|
1243
|
-
var StoreSessionIdResponseSchema = z.object({
|
|
1244
|
-
success: z.boolean()
|
|
1245
|
-
});
|
|
1246
|
-
var HeartbeatResponseSchema = z.object({
|
|
1247
|
-
acknowledged: z.boolean()
|
|
1248
|
-
});
|
|
1249
|
-
var SessionStartResponseSchema = z.object({
|
|
1250
|
-
sessionId: z.string(),
|
|
1251
|
-
startedAt: z.string()
|
|
1252
|
-
});
|
|
1253
|
-
var SessionStopResponseSchema = z.object({
|
|
1254
|
-
sessionId: z.string(),
|
|
1255
|
-
stoppedAt: z.string()
|
|
1256
|
-
});
|
|
1257
|
-
var DeleteSubtaskResponseSchema = z.object({
|
|
1258
|
-
deleted: z.boolean()
|
|
1259
|
-
});
|
|
1260
|
-
var RegisterProjectAgentResponseSchema = z.object({
|
|
1261
|
-
registered: z.boolean(),
|
|
1262
|
-
agentName: z.string(),
|
|
1263
|
-
agentInstructions: z.string(),
|
|
1264
|
-
model: z.string(),
|
|
1265
|
-
agentSettings: z.record(z.string(), z.unknown()).nullable(),
|
|
1266
|
-
branchSwitchCommand: z.string().nullable()
|
|
1267
|
-
});
|
|
1268
|
-
var RegisterProjectAgentRequestSchema = z2.object({
|
|
1269
|
-
projectId: z2.string(),
|
|
1270
|
-
capabilities: z2.array(z2.string())
|
|
1271
|
-
});
|
|
1272
|
-
var ProjectRunnerHeartbeatRequestSchema = z2.object({
|
|
1273
|
-
projectId: z2.string()
|
|
1274
|
-
});
|
|
1275
|
-
var ReportProjectAgentStatusRequestSchema = z2.object({
|
|
1276
|
-
projectId: z2.string(),
|
|
1277
|
-
status: z2.enum(["busy", "idle"]),
|
|
1278
|
-
activeChatId: z2.string().nullish(),
|
|
1279
|
-
activeTaskId: z2.string().nullish(),
|
|
1280
|
-
activeBranch: z2.string().nullish()
|
|
1281
|
-
});
|
|
1282
|
-
var DisconnectProjectRunnerRequestSchema = z2.object({
|
|
1283
|
-
projectId: z2.string()
|
|
1284
|
-
});
|
|
1285
|
-
var GetProjectAgentContextRequestSchema = z2.object({
|
|
1286
|
-
projectId: z2.string()
|
|
1287
|
-
});
|
|
1288
|
-
var GetProjectChatHistoryRequestSchema = z2.object({
|
|
1289
|
-
projectId: z2.string(),
|
|
1290
|
-
limit: z2.number().int().positive().optional().default(50),
|
|
1291
|
-
chatId: z2.string().optional()
|
|
1292
|
-
});
|
|
1293
|
-
var PostProjectAgentMessageRequestSchema = z2.object({
|
|
1294
|
-
projectId: z2.string(),
|
|
1295
|
-
content: z2.string().min(1),
|
|
1296
|
-
chatId: z2.string().optional()
|
|
1297
|
-
});
|
|
1298
|
-
var ListProjectTasksRequestSchema = z2.object({
|
|
1299
|
-
projectId: z2.string(),
|
|
1300
|
-
status: z2.string().optional(),
|
|
1301
|
-
assigneeId: z2.string().optional(),
|
|
1302
|
-
limit: z2.number().int().positive().optional().default(50)
|
|
1303
|
-
});
|
|
1304
|
-
var GetProjectTaskRequestSchema = z2.object({
|
|
1305
|
-
projectId: z2.string(),
|
|
1306
|
-
taskId: z2.string()
|
|
1307
|
-
});
|
|
1308
|
-
var SearchProjectTasksRequestSchema = z2.object({
|
|
1309
|
-
projectId: z2.string(),
|
|
1310
|
-
tagNames: z2.array(z2.string()).optional(),
|
|
1311
|
-
searchQuery: z2.string().optional(),
|
|
1312
|
-
statusFilters: z2.array(z2.string()).optional(),
|
|
1313
|
-
limit: z2.number().int().positive().optional().default(20)
|
|
1314
|
-
});
|
|
1315
|
-
var ListProjectTagsRequestSchema = z2.object({
|
|
1316
|
-
projectId: z2.string()
|
|
1317
|
-
});
|
|
1318
|
-
var GetProjectSummaryRequestSchema = z2.object({
|
|
1319
|
-
projectId: z2.string()
|
|
1320
|
-
});
|
|
1321
|
-
var CreateProjectTaskRequestSchema = z2.object({
|
|
1322
|
-
projectId: z2.string(),
|
|
1323
|
-
title: z2.string().min(1),
|
|
1324
|
-
description: z2.string().optional(),
|
|
1325
|
-
plan: z2.string().optional(),
|
|
1326
|
-
status: z2.string().optional(),
|
|
1327
|
-
isBug: z2.boolean().optional()
|
|
1328
|
-
});
|
|
1329
|
-
var UpdateProjectTaskRequestSchema = z2.object({
|
|
1330
|
-
projectId: z2.string(),
|
|
1331
|
-
taskId: z2.string(),
|
|
1332
|
-
title: z2.string().optional(),
|
|
1333
|
-
description: z2.string().optional(),
|
|
1334
|
-
plan: z2.string().optional(),
|
|
1335
|
-
status: z2.string().optional(),
|
|
1336
|
-
assignedUserId: z2.string().nullish()
|
|
1337
|
-
});
|
|
1338
|
-
var ReportProjectAgentEventRequestSchema = z2.object({
|
|
1339
|
-
projectId: z2.string(),
|
|
1340
|
-
event: z2.record(z2.string(), z2.unknown())
|
|
1341
|
-
});
|
|
1342
|
-
var ReportTagAuditProgressRequestSchema = z2.object({
|
|
1343
|
-
projectId: z2.string(),
|
|
1344
|
-
requestId: z2.string(),
|
|
1345
|
-
activity: z2.object({
|
|
1346
|
-
tool: z2.string(),
|
|
1347
|
-
input: z2.string().optional(),
|
|
1348
|
-
timestamp: z2.string()
|
|
1349
|
-
})
|
|
1350
|
-
});
|
|
1351
|
-
var ReportTagAuditResultRequestSchema = z2.object({
|
|
1352
|
-
projectId: z2.string(),
|
|
1353
|
-
requestId: z2.string(),
|
|
1354
|
-
recommendations: z2.array(z2.record(z2.string(), z2.unknown())),
|
|
1355
|
-
summary: z2.string(),
|
|
1356
|
-
complete: z2.boolean()
|
|
1357
|
-
});
|
|
1358
|
-
var ReportNewCommitsDetectedRequestSchema = z2.object({
|
|
1359
|
-
projectId: z2.string(),
|
|
1360
|
-
commits: z2.array(
|
|
1361
|
-
z2.object({
|
|
1362
|
-
sha: z2.string(),
|
|
1363
|
-
message: z2.string(),
|
|
1364
|
-
author: z2.string()
|
|
1365
|
-
})
|
|
1366
|
-
),
|
|
1367
|
-
branch: z2.string()
|
|
1368
|
-
});
|
|
1369
|
-
var ReportEnvironmentReadyRequestSchema = z2.object({
|
|
1370
|
-
projectId: z2.string(),
|
|
1371
|
-
branch: z2.string(),
|
|
1372
|
-
setupComplete: z2.boolean(),
|
|
1373
|
-
startCommandRunning: z2.boolean()
|
|
1374
|
-
});
|
|
1375
|
-
var ReportEnvSwitchProgressRequestSchema = z2.object({
|
|
1376
|
-
projectId: z2.string(),
|
|
1377
|
-
step: z2.string(),
|
|
1378
|
-
progress: z2.number(),
|
|
1379
|
-
message: z2.string().optional()
|
|
1380
|
-
});
|
|
1381
|
-
var ForwardProjectChatMessageRequestSchema = z2.object({
|
|
1382
|
-
projectId: z2.string(),
|
|
1383
|
-
chatId: z2.string(),
|
|
1384
|
-
content: z2.string().min(1),
|
|
1385
|
-
targetUserId: z2.string().optional()
|
|
1386
|
-
});
|
|
1387
|
-
var CancelQueuedProjectMessageRequestSchema = z2.object({
|
|
1388
|
-
projectId: z2.string(),
|
|
1389
|
-
index: z2.number().int().nonnegative()
|
|
1390
|
-
});
|
|
1391
|
-
var GetProjectCliHistoryRequestSchema = z2.object({
|
|
1392
|
-
projectId: z2.string(),
|
|
1393
|
-
limit: z2.number().int().positive().optional().default(50),
|
|
1394
|
-
source: z2.string().optional()
|
|
1395
|
-
});
|
|
1396
|
-
var PostToProjectTaskChatRequestSchema = z2.object({
|
|
1397
|
-
projectId: z2.string(),
|
|
1398
|
-
taskId: z2.string(),
|
|
1399
|
-
content: z2.string()
|
|
1400
|
-
});
|
|
1401
|
-
var GetProjectTaskCliRequestSchema = z2.object({
|
|
1402
|
-
projectId: z2.string(),
|
|
1403
|
-
taskId: z2.string(),
|
|
1404
|
-
limit: z2.number().int().positive().optional().default(50),
|
|
1405
|
-
source: z2.string().optional()
|
|
1406
|
-
});
|
|
1407
|
-
var StartProjectBuildRequestSchema = z2.object({
|
|
1408
|
-
projectId: z2.string(),
|
|
1409
|
-
taskId: z2.string()
|
|
1410
|
-
});
|
|
1411
|
-
var StopProjectBuildRequestSchema = z2.object({
|
|
1412
|
-
projectId: z2.string(),
|
|
1413
|
-
taskId: z2.string()
|
|
1414
|
-
});
|
|
1415
|
-
var ApproveProjectMergePRRequestSchema = z2.object({
|
|
1416
|
-
projectId: z2.string(),
|
|
1417
|
-
childTaskId: z2.string()
|
|
1418
|
-
});
|
|
1419
|
-
var CRITICAL_AUTOMATED_SOURCES = /* @__PURE__ */ new Set(["ci_failure", "review_trigger"]);
|
|
1420
|
-
var StartTaskAuditRequestSchema = z3.object({
|
|
1421
|
-
projectId: z3.string(),
|
|
1422
|
-
taskIds: z3.array(z3.string()).min(1)
|
|
1423
|
-
});
|
|
1424
|
-
var ReportTaskAuditProgressRequestSchema = z3.object({
|
|
1425
|
-
projectId: z3.string(),
|
|
1426
|
-
requestId: z3.string(),
|
|
1427
|
-
taskId: z3.string(),
|
|
1428
|
-
activity: z3.string()
|
|
1429
|
-
});
|
|
1430
|
-
var ReportTaskAuditResultRequestSchema = z3.object({
|
|
1431
|
-
projectId: z3.string(),
|
|
1432
|
-
requestId: z3.string(),
|
|
1433
|
-
taskId: z3.string(),
|
|
1434
|
-
summary: z3.string(),
|
|
1435
|
-
turnGrades: z3.array(
|
|
1436
|
-
z3.object({
|
|
1437
|
-
turnIndex: z3.number(),
|
|
1438
|
-
phase: z3.enum(["planning", "building", "human"]),
|
|
1439
|
-
grade: z3.enum(["correct", "neutral", "blunder"]),
|
|
1440
|
-
reasoning: z3.string(),
|
|
1441
|
-
eventType: z3.string(),
|
|
1442
|
-
eventSummary: z3.string()
|
|
1443
|
-
})
|
|
1444
|
-
),
|
|
1445
|
-
planningAccuracy: z3.number().nullable(),
|
|
1446
|
-
buildingAccuracy: z3.number().nullable(),
|
|
1447
|
-
humanAccuracy: z3.number().nullable(),
|
|
1448
|
-
planningCorrect: z3.number(),
|
|
1449
|
-
planningNeutral: z3.number(),
|
|
1450
|
-
planningBlunder: z3.number(),
|
|
1451
|
-
buildingCorrect: z3.number(),
|
|
1452
|
-
buildingNeutral: z3.number(),
|
|
1453
|
-
buildingBlunder: z3.number(),
|
|
1454
|
-
humanCorrect: z3.number(),
|
|
1455
|
-
humanNeutral: z3.number(),
|
|
1456
|
-
humanBlunder: z3.number(),
|
|
1457
|
-
suggestionIds: z3.array(z3.string()),
|
|
1458
|
-
auditCostUsd: z3.number().nullable(),
|
|
1459
|
-
model: z3.string().nullable(),
|
|
1460
|
-
error: z3.string().optional()
|
|
1461
|
-
});
|
|
1462
|
-
|
|
1463
977
|
// src/execution/pack-runner-prompt.ts
|
|
1464
978
|
function findLastAgentMessageIndex(history) {
|
|
1465
979
|
for (let i = history.length - 1; i >= 0; i--) {
|
|
@@ -2643,20 +2157,7 @@ async function buildInitialPrompt(mode, context, isAuto, agentMode) {
|
|
|
2643
2157
|
}
|
|
2644
2158
|
|
|
2645
2159
|
// src/tools/common-tools.ts
|
|
2646
|
-
import { z
|
|
2647
|
-
|
|
2648
|
-
// src/tools/helpers.ts
|
|
2649
|
-
function textResult(text) {
|
|
2650
|
-
return { content: [{ type: "text", text }] };
|
|
2651
|
-
}
|
|
2652
|
-
function imageBlock(data, mimeType) {
|
|
2653
|
-
return { type: "image", data, mimeType };
|
|
2654
|
-
}
|
|
2655
|
-
function isImageMimeType(mimeType) {
|
|
2656
|
-
return mimeType.startsWith("image/");
|
|
2657
|
-
}
|
|
2658
|
-
|
|
2659
|
-
// src/tools/common-tools.ts
|
|
2160
|
+
import { z } from "zod";
|
|
2660
2161
|
var cliEventFormatters = {
|
|
2661
2162
|
thinking: (e) => e.message ?? "",
|
|
2662
2163
|
tool_use: (e) => `${e.tool}: ${e.input?.slice(0, 1e3) ?? ""}`,
|
|
@@ -2677,8 +2178,8 @@ function buildReadTaskChatTool(connection) {
|
|
|
2677
2178
|
"read_task_chat",
|
|
2678
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.",
|
|
2679
2180
|
{
|
|
2680
|
-
limit:
|
|
2681
|
-
task_id:
|
|
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.")
|
|
2682
2183
|
},
|
|
2683
2184
|
async ({ limit, task_id }) => {
|
|
2684
2185
|
try {
|
|
@@ -2722,7 +2223,7 @@ function buildGetTaskTool(connection) {
|
|
|
2722
2223
|
"get_task",
|
|
2723
2224
|
"Look up a task by slug or ID to get its title, description, plan, and status",
|
|
2724
2225
|
{
|
|
2725
|
-
slug_or_id:
|
|
2226
|
+
slug_or_id: z.string().describe("The task slug (e.g. 'my-task') or CUID")
|
|
2726
2227
|
},
|
|
2727
2228
|
async ({ slug_or_id }) => {
|
|
2728
2229
|
try {
|
|
@@ -2745,9 +2246,9 @@ function buildGetTaskCliTool(connection) {
|
|
|
2745
2246
|
"get_task_cli",
|
|
2746
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.",
|
|
2747
2248
|
{
|
|
2748
|
-
task_id:
|
|
2749
|
-
source:
|
|
2750
|
-
limit:
|
|
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).")
|
|
2751
2252
|
},
|
|
2752
2253
|
async ({ task_id, source, limit }) => {
|
|
2753
2254
|
try {
|
|
@@ -2807,7 +2308,7 @@ function buildGetTaskFileTool(connection) {
|
|
|
2807
2308
|
return defineTool(
|
|
2808
2309
|
"get_task_file",
|
|
2809
2310
|
"Get a specific task file's content and download URL by file ID",
|
|
2810
|
-
{ fileId:
|
|
2311
|
+
{ fileId: z.string().describe("The file ID to retrieve") },
|
|
2811
2312
|
async ({ fileId }) => {
|
|
2812
2313
|
try {
|
|
2813
2314
|
const file = await connection.call("getTaskFile", {
|
|
@@ -2838,8 +2339,8 @@ function buildSearchIncidentsTool(connection) {
|
|
|
2838
2339
|
"search_incidents",
|
|
2839
2340
|
"Search incidents in the current project. Optionally filter by status (Open, Acknowledged, Investigating, Resolved, Closed) or source.",
|
|
2840
2341
|
{
|
|
2841
|
-
status:
|
|
2842
|
-
source:
|
|
2342
|
+
status: z.string().optional().describe("Filter by incident status"),
|
|
2343
|
+
source: z.string().optional().describe("Filter by source (e.g., 'conveyor', 'agent', 'build')")
|
|
2843
2344
|
},
|
|
2844
2345
|
async ({ status, source }) => {
|
|
2845
2346
|
try {
|
|
@@ -2863,7 +2364,7 @@ function buildGetTaskIncidentsTool(connection) {
|
|
|
2863
2364
|
"get_task_incidents",
|
|
2864
2365
|
"Get all incidents linked to the current task (or a specified task). Returns full incident details including title, description, severity, status, and source.",
|
|
2865
2366
|
{
|
|
2866
|
-
task_id:
|
|
2367
|
+
task_id: z.string().optional().describe("Task ID (defaults to current task)")
|
|
2867
2368
|
},
|
|
2868
2369
|
async ({ task_id }) => {
|
|
2869
2370
|
try {
|
|
@@ -2886,12 +2387,12 @@ function buildQueryGcpLogsTool(connection) {
|
|
|
2886
2387
|
"query_gcp_logs",
|
|
2887
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.",
|
|
2888
2389
|
{
|
|
2889
|
-
filter:
|
|
2390
|
+
filter: z.string().optional().describe(
|
|
2890
2391
|
`Cloud Logging filter expression (e.g., 'resource.type="gce_instance"'). Max 1000 chars.`
|
|
2891
2392
|
),
|
|
2892
|
-
start_time:
|
|
2893
|
-
end_time:
|
|
2894
|
-
severity:
|
|
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([
|
|
2895
2396
|
"DEFAULT",
|
|
2896
2397
|
"DEBUG",
|
|
2897
2398
|
"INFO",
|
|
@@ -2902,7 +2403,7 @@ function buildQueryGcpLogsTool(connection) {
|
|
|
2902
2403
|
"ALERT",
|
|
2903
2404
|
"EMERGENCY"
|
|
2904
2405
|
]).optional().describe("Minimum severity level to filter by (default: all levels)"),
|
|
2905
|
-
page_size:
|
|
2406
|
+
page_size: z.number().optional().describe("Number of log entries to return (default 100, max 500)")
|
|
2906
2407
|
},
|
|
2907
2408
|
async ({ filter, start_time, end_time, severity, page_size }) => {
|
|
2908
2409
|
try {
|
|
@@ -2956,8 +2457,8 @@ function buildGetSuggestionsTool(connection) {
|
|
|
2956
2457
|
"get_suggestions",
|
|
2957
2458
|
"List project suggestions sorted by vote score. Use this to see what the team thinks is important.",
|
|
2958
2459
|
{
|
|
2959
|
-
status:
|
|
2960
|
-
limit:
|
|
2460
|
+
status: z.string().optional().describe("Filter by status: Open, Accepted, Rejected, Implemented"),
|
|
2461
|
+
limit: z.number().optional().describe("Max results (default 20)")
|
|
2961
2462
|
},
|
|
2962
2463
|
async ({ status: _status, limit: _limit }) => {
|
|
2963
2464
|
try {
|
|
@@ -2982,8 +2483,8 @@ function buildPostToChatTool(connection) {
|
|
|
2982
2483
|
"post_to_chat",
|
|
2983
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.",
|
|
2984
2485
|
{
|
|
2985
|
-
message:
|
|
2986
|
-
task_id:
|
|
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.")
|
|
2987
2488
|
},
|
|
2988
2489
|
async ({ message, task_id }) => {
|
|
2989
2490
|
try {
|
|
@@ -3010,8 +2511,8 @@ function buildForceUpdateTaskStatusTool(connection) {
|
|
|
3010
2511
|
"force_update_task_status",
|
|
3011
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.",
|
|
3012
2513
|
{
|
|
3013
|
-
status:
|
|
3014
|
-
task_id:
|
|
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.")
|
|
3015
2516
|
},
|
|
3016
2517
|
async ({ status, task_id }) => {
|
|
3017
2518
|
try {
|
|
@@ -3042,15 +2543,15 @@ function buildCreatePullRequestTool(connection, config) {
|
|
|
3042
2543
|
"create_pull_request",
|
|
3043
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.",
|
|
3044
2545
|
{
|
|
3045
|
-
title:
|
|
3046
|
-
body:
|
|
3047
|
-
branch:
|
|
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(
|
|
3048
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."
|
|
3049
2550
|
),
|
|
3050
|
-
baseBranch:
|
|
2551
|
+
baseBranch: z.string().optional().describe(
|
|
3051
2552
|
"The base branch to target for the PR (e.g. 'main', 'develop'). Defaults to the project's configured dev branch."
|
|
3052
2553
|
),
|
|
3053
|
-
commitMessage:
|
|
2554
|
+
commitMessage: z.string().optional().describe(
|
|
3054
2555
|
"Commit message for staging uncommitted changes. If not provided, a default message based on the PR title will be used."
|
|
3055
2556
|
)
|
|
3056
2557
|
},
|
|
@@ -3128,7 +2629,7 @@ function buildAddDependencyTool(connection) {
|
|
|
3128
2629
|
"add_dependency",
|
|
3129
2630
|
"Add a dependency \u2014 this task cannot start until the specified task is merged to dev",
|
|
3130
2631
|
{
|
|
3131
|
-
depends_on_slug_or_id:
|
|
2632
|
+
depends_on_slug_or_id: z.string().describe("Slug or ID of the task this task depends on")
|
|
3132
2633
|
},
|
|
3133
2634
|
async ({ depends_on_slug_or_id }) => {
|
|
3134
2635
|
try {
|
|
@@ -3150,7 +2651,7 @@ function buildRemoveDependencyTool(connection) {
|
|
|
3150
2651
|
"remove_dependency",
|
|
3151
2652
|
"Remove a dependency from this task",
|
|
3152
2653
|
{
|
|
3153
|
-
depends_on_slug_or_id:
|
|
2654
|
+
depends_on_slug_or_id: z.string().describe("Slug or ID of the task to remove as dependency")
|
|
3154
2655
|
},
|
|
3155
2656
|
async ({ depends_on_slug_or_id }) => {
|
|
3156
2657
|
try {
|
|
@@ -3172,10 +2673,10 @@ function buildCreateFollowUpTaskTool(connection) {
|
|
|
3172
2673
|
"create_follow_up_task",
|
|
3173
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.",
|
|
3174
2675
|
{
|
|
3175
|
-
title:
|
|
3176
|
-
description:
|
|
3177
|
-
plan:
|
|
3178
|
-
story_point_value:
|
|
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)")
|
|
3179
2680
|
},
|
|
3180
2681
|
async ({ title, description, plan, story_point_value }) => {
|
|
3181
2682
|
try {
|
|
@@ -3202,9 +2703,9 @@ function buildCreateSuggestionTool(connection) {
|
|
|
3202
2703
|
"create_suggestion",
|
|
3203
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.",
|
|
3204
2705
|
{
|
|
3205
|
-
title:
|
|
3206
|
-
description:
|
|
3207
|
-
tag_names:
|
|
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")
|
|
3208
2709
|
},
|
|
3209
2710
|
async ({ title, description, tag_names }) => {
|
|
3210
2711
|
try {
|
|
@@ -3233,8 +2734,8 @@ function buildVoteSuggestionTool(connection) {
|
|
|
3233
2734
|
"vote_suggestion",
|
|
3234
2735
|
"Vote on a project suggestion. Use +1 to upvote or -1 to downvote.",
|
|
3235
2736
|
{
|
|
3236
|
-
suggestion_id:
|
|
3237
|
-
value:
|
|
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")
|
|
3238
2739
|
},
|
|
3239
2740
|
async ({ suggestion_id, value }) => {
|
|
3240
2741
|
try {
|
|
@@ -3257,8 +2758,8 @@ function buildScaleUpResourcesTool(connection) {
|
|
|
3257
2758
|
"scale_up_resources",
|
|
3258
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).",
|
|
3259
2760
|
{
|
|
3260
|
-
tier:
|
|
3261
|
-
reason:
|
|
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')")
|
|
3262
2763
|
},
|
|
3263
2764
|
async ({ tier, reason }) => {
|
|
3264
2765
|
try {
|
|
@@ -3311,15 +2812,15 @@ function buildCommonTools(connection, config) {
|
|
|
3311
2812
|
}
|
|
3312
2813
|
|
|
3313
2814
|
// src/tools/pm-tools.ts
|
|
3314
|
-
import { z as
|
|
2815
|
+
import { z as z2 } from "zod";
|
|
3315
2816
|
var SP_DESCRIPTION = "Story point value (1=Common, 2=Magic, 3=Rare, 5=Unique)";
|
|
3316
2817
|
function buildUpdateTaskTool(connection) {
|
|
3317
2818
|
return defineTool(
|
|
3318
2819
|
"update_task",
|
|
3319
2820
|
"Save the finalized task plan and/or description",
|
|
3320
2821
|
{
|
|
3321
|
-
plan:
|
|
3322
|
-
description:
|
|
2822
|
+
plan: z2.string().optional().describe("The task plan in markdown"),
|
|
2823
|
+
description: z2.string().optional().describe("Updated task description")
|
|
3323
2824
|
},
|
|
3324
2825
|
async ({ plan, description }) => {
|
|
3325
2826
|
try {
|
|
@@ -3340,11 +2841,11 @@ function buildCreateSubtaskTool(connection) {
|
|
|
3340
2841
|
"create_subtask",
|
|
3341
2842
|
"Create a subtask under the current parent task. Use for breaking complex tasks into smaller pieces.",
|
|
3342
2843
|
{
|
|
3343
|
-
title:
|
|
3344
|
-
description:
|
|
3345
|
-
plan:
|
|
3346
|
-
ordinal:
|
|
3347
|
-
storyPointValue:
|
|
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)
|
|
3348
2849
|
},
|
|
3349
2850
|
async ({ title, description, plan, ordinal, storyPointValue }) => {
|
|
3350
2851
|
try {
|
|
@@ -3370,12 +2871,12 @@ function buildUpdateSubtaskTool(connection) {
|
|
|
3370
2871
|
"update_subtask",
|
|
3371
2872
|
"Update an existing subtask's fields",
|
|
3372
2873
|
{
|
|
3373
|
-
subtaskId:
|
|
3374
|
-
title:
|
|
3375
|
-
description:
|
|
3376
|
-
plan:
|
|
3377
|
-
ordinal:
|
|
3378
|
-
storyPointValue:
|
|
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)
|
|
3379
2880
|
},
|
|
3380
2881
|
async ({ subtaskId, title, description, plan, storyPointValue }) => {
|
|
3381
2882
|
try {
|
|
@@ -3398,7 +2899,7 @@ function buildDeleteSubtaskTool(connection) {
|
|
|
3398
2899
|
return defineTool(
|
|
3399
2900
|
"delete_subtask",
|
|
3400
2901
|
"Delete a subtask",
|
|
3401
|
-
{ subtaskId:
|
|
2902
|
+
{ subtaskId: z2.string().describe("The subtask ID to delete") },
|
|
3402
2903
|
async ({ subtaskId }) => {
|
|
3403
2904
|
try {
|
|
3404
2905
|
await connection.call("deleteSubtask", {
|
|
@@ -3436,7 +2937,7 @@ function buildPackTools(connection) {
|
|
|
3436
2937
|
"start_child_cloud_build",
|
|
3437
2938
|
"Start a cloud build for a child task. The child must be in Open status with story points and an agent assigned.",
|
|
3438
2939
|
{
|
|
3439
|
-
childTaskId:
|
|
2940
|
+
childTaskId: z2.string().describe("The child task ID to start a cloud build for")
|
|
3440
2941
|
},
|
|
3441
2942
|
async ({ childTaskId }) => {
|
|
3442
2943
|
try {
|
|
@@ -3456,7 +2957,7 @@ function buildPackTools(connection) {
|
|
|
3456
2957
|
"stop_child_build",
|
|
3457
2958
|
"Stop a running cloud build for a child task. Sends a stop signal to the child agent.",
|
|
3458
2959
|
{
|
|
3459
|
-
childTaskId:
|
|
2960
|
+
childTaskId: z2.string().describe("The child task ID whose build should be stopped")
|
|
3460
2961
|
},
|
|
3461
2962
|
async ({ childTaskId }) => {
|
|
3462
2963
|
try {
|
|
@@ -3476,7 +2977,7 @@ function buildPackTools(connection) {
|
|
|
3476
2977
|
"approve_and_merge_pr",
|
|
3477
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.",
|
|
3478
2979
|
{
|
|
3479
|
-
childTaskId:
|
|
2980
|
+
childTaskId: z2.string().describe("The child task ID whose PR should be approved and merged")
|
|
3480
2981
|
},
|
|
3481
2982
|
async ({ childTaskId }) => {
|
|
3482
2983
|
try {
|
|
@@ -3514,7 +3015,7 @@ function buildPmTools(connection, options) {
|
|
|
3514
3015
|
}
|
|
3515
3016
|
|
|
3516
3017
|
// src/tools/discovery-tools.ts
|
|
3517
|
-
import { z as
|
|
3018
|
+
import { z as z3 } from "zod";
|
|
3518
3019
|
var SP_DESCRIPTION2 = "Story point value (1=Common, 2=Magic, 3=Rare, 5=Unique)";
|
|
3519
3020
|
function buildDiscoveryTools(connection) {
|
|
3520
3021
|
return [
|
|
@@ -3522,10 +3023,10 @@ function buildDiscoveryTools(connection) {
|
|
|
3522
3023
|
"update_task_properties",
|
|
3523
3024
|
"Set one or more task properties in a single call. All fields are optional \u2014 only include the fields you want to update.",
|
|
3524
3025
|
{
|
|
3525
|
-
title:
|
|
3526
|
-
storyPointValue:
|
|
3527
|
-
tagIds:
|
|
3528
|
-
githubPRUrl:
|
|
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")
|
|
3529
3030
|
},
|
|
3530
3031
|
async ({ title, storyPointValue, tagIds, githubPRUrl }) => {
|
|
3531
3032
|
try {
|
|
@@ -3554,14 +3055,14 @@ function buildDiscoveryTools(connection) {
|
|
|
3554
3055
|
}
|
|
3555
3056
|
|
|
3556
3057
|
// src/tools/code-review-tools.ts
|
|
3557
|
-
import { z as
|
|
3058
|
+
import { z as z4 } from "zod";
|
|
3558
3059
|
function buildCodeReviewTools(connection) {
|
|
3559
3060
|
return [
|
|
3560
3061
|
defineTool(
|
|
3561
3062
|
"approve_code_review",
|
|
3562
3063
|
"Approve the code review. Use this when the code passes all review criteria and is ready to merge.",
|
|
3563
3064
|
{
|
|
3564
|
-
summary:
|
|
3065
|
+
summary: z4.string().describe("Brief summary of what was reviewed and why it looks good")
|
|
3565
3066
|
},
|
|
3566
3067
|
async ({ summary }) => {
|
|
3567
3068
|
const content = `**Code Review: Approved** :white_check_mark:
|
|
@@ -3584,15 +3085,15 @@ ${summary}`;
|
|
|
3584
3085
|
"request_code_changes",
|
|
3585
3086
|
"Request changes during code review. Use this when substantive issues are found that need to be fixed before merge.",
|
|
3586
3087
|
{
|
|
3587
|
-
issues:
|
|
3588
|
-
|
|
3589
|
-
file:
|
|
3590
|
-
line:
|
|
3591
|
-
severity:
|
|
3592
|
-
description:
|
|
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")
|
|
3593
3094
|
})
|
|
3594
3095
|
).describe("List of issues found during review"),
|
|
3595
|
-
summary:
|
|
3096
|
+
summary: z4.string().describe("Brief overall summary of the review findings")
|
|
3596
3097
|
},
|
|
3597
3098
|
async ({ issues, summary }) => {
|
|
3598
3099
|
const issueLines = issues.map((issue) => {
|
|
@@ -3622,10 +3123,10 @@ ${issueLines}`;
|
|
|
3622
3123
|
}
|
|
3623
3124
|
|
|
3624
3125
|
// src/tools/debug-tools.ts
|
|
3625
|
-
import { z as
|
|
3126
|
+
import { z as z7 } from "zod";
|
|
3626
3127
|
|
|
3627
3128
|
// src/tools/telemetry-tools.ts
|
|
3628
|
-
import { z as
|
|
3129
|
+
import { z as z5 } from "zod";
|
|
3629
3130
|
|
|
3630
3131
|
// src/debug/telemetry-injector.ts
|
|
3631
3132
|
var BUFFER_SIZE = 200;
|
|
@@ -4020,12 +3521,12 @@ function buildGetTelemetryTool(manager) {
|
|
|
4020
3521
|
"debug_get_telemetry",
|
|
4021
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.",
|
|
4022
3523
|
{
|
|
4023
|
-
type:
|
|
4024
|
-
urlPattern:
|
|
4025
|
-
minDuration:
|
|
4026
|
-
errorOnly:
|
|
4027
|
-
since:
|
|
4028
|
-
limit:
|
|
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)")
|
|
4029
3530
|
},
|
|
4030
3531
|
async ({ type, urlPattern, minDuration, errorOnly, since, limit }) => {
|
|
4031
3532
|
const clientOrErr = requireDebugClient(manager);
|
|
@@ -4095,7 +3596,7 @@ function buildTelemetryTools(manager) {
|
|
|
4095
3596
|
}
|
|
4096
3597
|
|
|
4097
3598
|
// src/tools/client-debug-tools.ts
|
|
4098
|
-
import { z as
|
|
3599
|
+
import { z as z6 } from "zod";
|
|
4099
3600
|
function requirePlaywrightClient(manager) {
|
|
4100
3601
|
if (!manager.isClientDebugMode()) {
|
|
4101
3602
|
return "Client debug mode is not active. Use debug_enter_mode with clientSide: true first.";
|
|
@@ -4115,11 +3616,11 @@ function buildClientBreakpointTools(manager) {
|
|
|
4115
3616
|
"debug_set_client_breakpoint",
|
|
4116
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.",
|
|
4117
3618
|
{
|
|
4118
|
-
file:
|
|
3619
|
+
file: z6.string().describe(
|
|
4119
3620
|
"Original source file path (e.g., src/components/App.tsx) \u2014 source maps resolve automatically"
|
|
4120
3621
|
),
|
|
4121
|
-
line:
|
|
4122
|
-
condition:
|
|
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")
|
|
4123
3624
|
},
|
|
4124
3625
|
async ({ file, line, condition }) => {
|
|
4125
3626
|
const clientOrErr = requirePlaywrightClient(manager);
|
|
@@ -4141,7 +3642,7 @@ Breakpoint ID: ${breakpointId}${sourceMapNote}`
|
|
|
4141
3642
|
"debug_remove_client_breakpoint",
|
|
4142
3643
|
"Remove a previously set client-side breakpoint by its ID.",
|
|
4143
3644
|
{
|
|
4144
|
-
breakpointId:
|
|
3645
|
+
breakpointId: z6.string().describe("The breakpoint ID returned by debug_set_client_breakpoint")
|
|
4145
3646
|
},
|
|
4146
3647
|
async ({ breakpointId }) => {
|
|
4147
3648
|
const clientOrErr = requirePlaywrightClient(manager);
|
|
@@ -4221,8 +3722,8 @@ ${JSON.stringify(queuedHits, null, 2)}`
|
|
|
4221
3722
|
"debug_evaluate_client",
|
|
4222
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.",
|
|
4223
3724
|
{
|
|
4224
|
-
expression:
|
|
4225
|
-
frameIndex:
|
|
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.")
|
|
4226
3727
|
},
|
|
4227
3728
|
async ({ expression, frameIndex }) => {
|
|
4228
3729
|
const clientOrErr = requirePlaywrightClient(manager);
|
|
@@ -4295,7 +3796,7 @@ function buildClientInteractionTools(manager) {
|
|
|
4295
3796
|
"debug_navigate_client",
|
|
4296
3797
|
"Navigate the headless browser to a specific URL. Use this to reproduce specific flows or visit different pages.",
|
|
4297
3798
|
{
|
|
4298
|
-
url:
|
|
3799
|
+
url: z6.string().describe("URL to navigate to (e.g., http://localhost:3000/dashboard)")
|
|
4299
3800
|
},
|
|
4300
3801
|
async ({ url }) => {
|
|
4301
3802
|
const clientOrErr = requirePlaywrightClient(manager);
|
|
@@ -4312,7 +3813,7 @@ function buildClientInteractionTools(manager) {
|
|
|
4312
3813
|
"debug_click_client",
|
|
4313
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.",
|
|
4314
3815
|
{
|
|
4315
|
-
selector:
|
|
3816
|
+
selector: z6.string().describe(
|
|
4316
3817
|
"CSS selector of the element to click (e.g., 'button.submit', '#login-form input[type=submit]')"
|
|
4317
3818
|
)
|
|
4318
3819
|
},
|
|
@@ -4334,8 +3835,8 @@ function buildClientConsoleTool(manager) {
|
|
|
4334
3835
|
"debug_get_client_console",
|
|
4335
3836
|
"Get console messages captured from the headless browser. Includes console.log, warn, error, etc.",
|
|
4336
3837
|
{
|
|
4337
|
-
level:
|
|
4338
|
-
limit:
|
|
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)")
|
|
4339
3840
|
},
|
|
4340
3841
|
// oxlint-disable-next-line require-await
|
|
4341
3842
|
async ({ level, limit }) => {
|
|
@@ -4362,8 +3863,8 @@ function buildClientNetworkTool(manager) {
|
|
|
4362
3863
|
"debug_get_client_network",
|
|
4363
3864
|
"Get network requests captured from the headless browser. Shows URLs, methods, status codes, and timing.",
|
|
4364
3865
|
{
|
|
4365
|
-
filter:
|
|
4366
|
-
limit:
|
|
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)")
|
|
4367
3868
|
},
|
|
4368
3869
|
// oxlint-disable-next-line require-await
|
|
4369
3870
|
async ({ filter, limit }) => {
|
|
@@ -4391,7 +3892,7 @@ function buildClientErrorsTool(manager) {
|
|
|
4391
3892
|
"debug_get_client_errors",
|
|
4392
3893
|
"Get uncaught errors captured from the headless browser. Includes error messages and source-mapped stack traces.",
|
|
4393
3894
|
{
|
|
4394
|
-
limit:
|
|
3895
|
+
limit: z6.number().optional().describe("Maximum number of recent errors to return (default: all)")
|
|
4395
3896
|
},
|
|
4396
3897
|
// oxlint-disable-next-line require-await
|
|
4397
3898
|
async ({ limit }) => {
|
|
@@ -4485,12 +3986,12 @@ function buildDebugLifecycleTools(manager) {
|
|
|
4485
3986
|
"debug_enter_mode",
|
|
4486
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.",
|
|
4487
3988
|
{
|
|
4488
|
-
hypothesis:
|
|
4489
|
-
serverSide:
|
|
3989
|
+
hypothesis: z7.string().optional().describe("Your hypothesis about the bug \u2014 helps track debugging intent"),
|
|
3990
|
+
serverSide: z7.boolean().optional().describe(
|
|
4490
3991
|
"Enable server-side Node.js debugging (default: true if clientSide is not set)"
|
|
4491
3992
|
),
|
|
4492
|
-
clientSide:
|
|
4493
|
-
previewUrl:
|
|
3993
|
+
clientSide: z7.boolean().optional().describe("Enable client-side browser debugging via headless Chromium + Playwright"),
|
|
3994
|
+
previewUrl: z7.string().optional().describe(
|
|
4494
3995
|
"Preview URL for client-side debugging (e.g., http://localhost:3000). Required when clientSide is true."
|
|
4495
3996
|
)
|
|
4496
3997
|
},
|
|
@@ -4526,9 +4027,9 @@ function buildBreakpointTools(manager) {
|
|
|
4526
4027
|
"debug_set_breakpoint",
|
|
4527
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.",
|
|
4528
4029
|
{
|
|
4529
|
-
file:
|
|
4530
|
-
line:
|
|
4531
|
-
condition:
|
|
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")
|
|
4532
4033
|
},
|
|
4533
4034
|
async ({ file, line, condition }) => {
|
|
4534
4035
|
const clientOrErr = requireDebugClient2(manager);
|
|
@@ -4550,7 +4051,7 @@ Breakpoint ID: ${breakpointId}`
|
|
|
4550
4051
|
"debug_remove_breakpoint",
|
|
4551
4052
|
"Remove a previously set breakpoint by its ID.",
|
|
4552
4053
|
{
|
|
4553
|
-
breakpointId:
|
|
4054
|
+
breakpointId: z7.string().describe("The breakpoint ID returned by debug_set_breakpoint")
|
|
4554
4055
|
},
|
|
4555
4056
|
async ({ breakpointId }) => {
|
|
4556
4057
|
const clientOrErr = requireDebugClient2(manager);
|
|
@@ -4631,8 +4132,8 @@ ${JSON.stringify(queuedHits, null, 2)}`
|
|
|
4631
4132
|
"debug_evaluate",
|
|
4632
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.",
|
|
4633
4134
|
{
|
|
4634
|
-
expression:
|
|
4635
|
-
frameIndex:
|
|
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.")
|
|
4636
4137
|
},
|
|
4637
4138
|
async ({ expression, frameIndex }) => {
|
|
4638
4139
|
const clientOrErr = requireDebugClient2(manager);
|
|
@@ -4660,12 +4161,12 @@ function buildProbeManagementTools(manager) {
|
|
|
4660
4161
|
"debug_add_probe",
|
|
4661
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.",
|
|
4662
4163
|
{
|
|
4663
|
-
file:
|
|
4664
|
-
line:
|
|
4665
|
-
expressions:
|
|
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(
|
|
4666
4167
|
'JavaScript expressions to capture when the line executes (e.g., ["req.params.id", "user.role"])'
|
|
4667
4168
|
),
|
|
4668
|
-
label:
|
|
4169
|
+
label: z7.string().optional().describe("Optional label for this probe (defaults to file:line)")
|
|
4669
4170
|
},
|
|
4670
4171
|
async ({ file, line, expressions, label }) => {
|
|
4671
4172
|
const clientOrErr = requireDebugClient2(manager);
|
|
@@ -4690,7 +4191,7 @@ Trigger the code path, then use debug_get_probe_results to see captured values.`
|
|
|
4690
4191
|
"debug_remove_probe",
|
|
4691
4192
|
"Remove a previously set debug probe by its ID.",
|
|
4692
4193
|
{
|
|
4693
|
-
probeId:
|
|
4194
|
+
probeId: z7.string().describe("The probe ID returned by debug_add_probe")
|
|
4694
4195
|
},
|
|
4695
4196
|
async ({ probeId }) => {
|
|
4696
4197
|
const clientOrErr = requireDebugClient2(manager);
|
|
@@ -4730,9 +4231,9 @@ function buildProbeResultTools(manager) {
|
|
|
4730
4231
|
"debug_get_probe_results",
|
|
4731
4232
|
"Fetch captured probe hit data. Returns expression values from each time a probed line executed.",
|
|
4732
4233
|
{
|
|
4733
|
-
probeId:
|
|
4734
|
-
label:
|
|
4735
|
-
limit:
|
|
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)")
|
|
4736
4237
|
},
|
|
4737
4238
|
async ({ probeId, label, limit }) => {
|
|
4738
4239
|
const clientOrErr = requireDebugClient2(manager);
|
|
@@ -5496,6 +4997,12 @@ function buildCanUseTool(host) {
|
|
|
5496
4997
|
if (toolName === "ExitPlanMode" && (host.agentMode === "auto" || host.agentMode === "discovery") && !host.hasExitedPlanMode) {
|
|
5497
4998
|
return await handleExitPlanMode(host, input);
|
|
5498
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
|
+
}
|
|
5499
5006
|
if (toolName === "AskUserQuestion") {
|
|
5500
5007
|
return await handleAskUserQuestion(host, input);
|
|
5501
5008
|
}
|
|
@@ -6113,7 +5620,6 @@ var SessionRunner = class _SessionRunner {
|
|
|
6113
5620
|
callbacks;
|
|
6114
5621
|
_state = "connecting";
|
|
6115
5622
|
stopped = false;
|
|
6116
|
-
hasCompleted = false;
|
|
6117
5623
|
interrupted = false;
|
|
6118
5624
|
taskContext = null;
|
|
6119
5625
|
fullContext = null;
|
|
@@ -6222,6 +5728,7 @@ var SessionRunner = class _SessionRunner {
|
|
|
6222
5728
|
if (this.fullContext?.baseBranch) {
|
|
6223
5729
|
syncWithBaseBranch(this.config.workspaceDir, this.fullContext.baseBranch);
|
|
6224
5730
|
}
|
|
5731
|
+
this.mode.applyServerMode(this.fullContext?.agentMode, this.fullContext?.isAuto);
|
|
6225
5732
|
this.mode.resolveInitialMode(this.taskContext);
|
|
6226
5733
|
this.queryBridge = this.createQueryBridge();
|
|
6227
5734
|
this.logInitialization();
|
|
@@ -6230,9 +5737,6 @@ var SessionRunner = class _SessionRunner {
|
|
|
6230
5737
|
if (staleMessageCount > 0 && didExecuteInitialQuery) {
|
|
6231
5738
|
this.pendingMessages.splice(0, staleMessageCount);
|
|
6232
5739
|
}
|
|
6233
|
-
if (!this.stopped && this._state !== "error") {
|
|
6234
|
-
this.hasCompleted = true;
|
|
6235
|
-
}
|
|
6236
5740
|
if (!this.stopped && this.pendingMessages.length === 0) {
|
|
6237
5741
|
await this.maybeSendPRNudge();
|
|
6238
5742
|
}
|
|
@@ -6253,34 +5757,6 @@ var SessionRunner = class _SessionRunner {
|
|
|
6253
5757
|
await this.connect();
|
|
6254
5758
|
await this.run();
|
|
6255
5759
|
}
|
|
6256
|
-
// ── Message filtering ──────────────────────────────────────────────
|
|
6257
|
-
/**
|
|
6258
|
-
* Returns true if the message should be skipped (not processed).
|
|
6259
|
-
*
|
|
6260
|
-
* After the agent has completed, we only process:
|
|
6261
|
-
* 1. Critical automated sources (e.g. CI failure) — always process
|
|
6262
|
-
* 2. Messages with source: "user" — real user typed in chat
|
|
6263
|
-
* 3. Messages from flushAllCombined — have a real userId but no source
|
|
6264
|
-
*
|
|
6265
|
-
* Everything else (system messages, stale history replays) is skipped.
|
|
6266
|
-
*/
|
|
6267
|
-
shouldSkipMessage(msg) {
|
|
6268
|
-
if (!this.hasCompleted) return false;
|
|
6269
|
-
const isCritical = !!msg.source && CRITICAL_AUTOMATED_SOURCES.has(msg.source);
|
|
6270
|
-
if (isCritical) {
|
|
6271
|
-
this.hasCompleted = false;
|
|
6272
|
-
return false;
|
|
6273
|
-
}
|
|
6274
|
-
if (msg.source === "user") {
|
|
6275
|
-
this.hasCompleted = false;
|
|
6276
|
-
return false;
|
|
6277
|
-
}
|
|
6278
|
-
if (!msg.source && msg.userId !== "system") {
|
|
6279
|
-
this.hasCompleted = false;
|
|
6280
|
-
return false;
|
|
6281
|
-
}
|
|
6282
|
-
return true;
|
|
6283
|
-
}
|
|
6284
5760
|
// ── Core loop ──────────────────────────────────────────────────────
|
|
6285
5761
|
async coreLoop() {
|
|
6286
5762
|
while (!this.stopped) {
|
|
@@ -6295,7 +5771,6 @@ var SessionRunner = class _SessionRunner {
|
|
|
6295
5771
|
}
|
|
6296
5772
|
break;
|
|
6297
5773
|
}
|
|
6298
|
-
if (this.shouldSkipMessage(msg)) continue;
|
|
6299
5774
|
await this.setState("running");
|
|
6300
5775
|
this.interrupted = false;
|
|
6301
5776
|
await this.callbacks.onEvent({
|
|
@@ -6312,7 +5787,6 @@ var SessionRunner = class _SessionRunner {
|
|
|
6312
5787
|
if (!this.stopped && this.pendingMessages.length === 0) {
|
|
6313
5788
|
await this.maybeSendPRNudge();
|
|
6314
5789
|
}
|
|
6315
|
-
this.hasCompleted = true;
|
|
6316
5790
|
if (!this.stopped) await this.setState("idle");
|
|
6317
5791
|
} else if (this._state === "error") {
|
|
6318
5792
|
await this.setState("idle");
|
|
@@ -6509,7 +5983,9 @@ var SessionRunner = class _SessionRunner {
|
|
|
6509
5983
|
taskTagIds: ctx.taskTagIds ?? void 0,
|
|
6510
5984
|
projectObjectives: ctx.projectObjectives ?? void 0,
|
|
6511
5985
|
incidents: ctx.incidents ?? void 0,
|
|
6512
|
-
agentSettings: ctx.agentSettings ?? null
|
|
5986
|
+
agentSettings: ctx.agentSettings ?? null,
|
|
5987
|
+
agentMode: ctx.agentMode ?? void 0,
|
|
5988
|
+
isAuto: ctx.isAuto
|
|
6513
5989
|
};
|
|
6514
5990
|
}
|
|
6515
5991
|
createQueryBridge() {
|
|
@@ -6736,6 +6212,9 @@ var ProjectConnection = class {
|
|
|
6736
6212
|
onAuditTags(callback) {
|
|
6737
6213
|
this.requireSocket().on("projectRunner:auditTags", callback);
|
|
6738
6214
|
}
|
|
6215
|
+
onAuditTasks(callback) {
|
|
6216
|
+
this.requireSocket().on("projectRunner:auditTasks", callback);
|
|
6217
|
+
}
|
|
6739
6218
|
// ── Outgoing helpers ───────────────────────────────────────────────────
|
|
6740
6219
|
sendHeartbeat() {
|
|
6741
6220
|
void this.call("projectRunnerHeartbeat", { projectId: this.config.projectId }).catch(() => {
|
|
@@ -7020,7 +6499,7 @@ import * as path from "path";
|
|
|
7020
6499
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
7021
6500
|
|
|
7022
6501
|
// src/tools/project-tools.ts
|
|
7023
|
-
import { z as
|
|
6502
|
+
import { z as z8 } from "zod";
|
|
7024
6503
|
function buildTaskListTools(connection) {
|
|
7025
6504
|
const projectId = connection.projectId;
|
|
7026
6505
|
return [
|
|
@@ -7028,9 +6507,9 @@ function buildTaskListTools(connection) {
|
|
|
7028
6507
|
"list_tasks",
|
|
7029
6508
|
"List tasks in the project. Optionally filter by status or assignee.",
|
|
7030
6509
|
{
|
|
7031
|
-
status:
|
|
7032
|
-
assigneeId:
|
|
7033
|
-
limit:
|
|
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)")
|
|
7034
6513
|
},
|
|
7035
6514
|
async (params) => {
|
|
7036
6515
|
try {
|
|
@@ -7047,7 +6526,7 @@ function buildTaskListTools(connection) {
|
|
|
7047
6526
|
defineTool(
|
|
7048
6527
|
"get_task",
|
|
7049
6528
|
"Get detailed information about a task including chat messages, child tasks, and session.",
|
|
7050
|
-
{ task_id:
|
|
6529
|
+
{ task_id: z8.string().describe("The task ID to look up") },
|
|
7051
6530
|
async ({ task_id }) => {
|
|
7052
6531
|
try {
|
|
7053
6532
|
const task = await connection.call("getProjectTask", { projectId, taskId: task_id });
|
|
@@ -7064,10 +6543,10 @@ function buildTaskListTools(connection) {
|
|
|
7064
6543
|
"search_tasks",
|
|
7065
6544
|
"Search tasks by tags, text query, or status filters.",
|
|
7066
6545
|
{
|
|
7067
|
-
tagNames:
|
|
7068
|
-
searchQuery:
|
|
7069
|
-
statusFilters:
|
|
7070
|
-
limit:
|
|
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)")
|
|
7071
6550
|
},
|
|
7072
6551
|
async (params) => {
|
|
7073
6552
|
try {
|
|
@@ -7127,11 +6606,11 @@ function buildMutationTools(connection) {
|
|
|
7127
6606
|
"create_task",
|
|
7128
6607
|
"Create a new task in the project.",
|
|
7129
6608
|
{
|
|
7130
|
-
title:
|
|
7131
|
-
description:
|
|
7132
|
-
plan:
|
|
7133
|
-
status:
|
|
7134
|
-
isBug:
|
|
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")
|
|
7135
6614
|
},
|
|
7136
6615
|
async (params) => {
|
|
7137
6616
|
try {
|
|
@@ -7148,12 +6627,12 @@ function buildMutationTools(connection) {
|
|
|
7148
6627
|
"update_task",
|
|
7149
6628
|
"Update an existing task's title, description, plan, status, or assignee.",
|
|
7150
6629
|
{
|
|
7151
|
-
task_id:
|
|
7152
|
-
title:
|
|
7153
|
-
description:
|
|
7154
|
-
plan:
|
|
7155
|
-
status:
|
|
7156
|
-
assignedUserId:
|
|
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")
|
|
7157
6636
|
},
|
|
7158
6637
|
async ({ task_id, ...fields }) => {
|
|
7159
6638
|
try {
|
|
@@ -7604,6 +7083,7 @@ var ProjectRunner = class {
|
|
|
7604
7083
|
);
|
|
7605
7084
|
});
|
|
7606
7085
|
this.connection.onAuditTags((request) => void this.handleAuditTags(request));
|
|
7086
|
+
this.connection.onAuditTasks((request) => void this.handleAuditTasks(request));
|
|
7607
7087
|
this.connection.onSwitchBranch((data, cb) => void this.handleSwitchBranch(data, cb));
|
|
7608
7088
|
this.connection.onSyncEnvironment((cb) => void this.handleSyncEnvironment(cb));
|
|
7609
7089
|
this.connection.onRestartStartCommand((cb) => {
|
|
@@ -7648,6 +7128,47 @@ var ProjectRunner = class {
|
|
|
7648
7128
|
this.connection.emitStatus("idle");
|
|
7649
7129
|
}
|
|
7650
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
|
+
}
|
|
7651
7172
|
// ── Task management ────────────────────────────────────────────────────
|
|
7652
7173
|
async killAgent(agent, taskId) {
|
|
7653
7174
|
const shortId = taskId.slice(0, 8);
|
|
@@ -8051,4 +7572,4 @@ export {
|
|
|
8051
7572
|
loadForwardPorts,
|
|
8052
7573
|
loadConveyorConfig
|
|
8053
7574
|
};
|
|
8054
|
-
//# sourceMappingURL=chunk-
|
|
7575
|
+
//# sourceMappingURL=chunk-H2GKXPFI.js.map
|