@agentrix/shared 2.0.11 → 2.0.13
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/index.cjs +145 -86
- package/dist/index.d.cts +1306 -9304
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -49,12 +49,15 @@ const FileStatsSchema = zod.z.object({
|
|
|
49
49
|
insertions: zod.z.number(),
|
|
50
50
|
deletions: zod.z.number()
|
|
51
51
|
});
|
|
52
|
+
const SenderTypeSchema = zod.z.enum(["human", "system", "agent"]);
|
|
52
53
|
|
|
53
54
|
const UserBasicInfoSchema = zod.z.object({
|
|
54
55
|
id: IdSchema,
|
|
55
56
|
username: zod.z.string(),
|
|
56
57
|
email: zod.z.string().email().nullable(),
|
|
57
|
-
avatar: zod.z.string().url().nullable()
|
|
58
|
+
avatar: zod.z.string().url().nullable(),
|
|
59
|
+
role: zod.z.string().optional()
|
|
60
|
+
// User role: "user", "admin", etc.
|
|
58
61
|
});
|
|
59
62
|
const OAuthAccountInfoSchema = zod.z.object({
|
|
60
63
|
provider: zod.z.string(),
|
|
@@ -92,6 +95,11 @@ const UserProfileResponseSchema = zod.z.object({
|
|
|
92
95
|
oauthAccounts: zod.z.array(OAuthAccountInfoSchema).optional()
|
|
93
96
|
})
|
|
94
97
|
});
|
|
98
|
+
const UpdateUserProfileRequestSchema = zod.z.object({
|
|
99
|
+
username: zod.z.string().min(1).optional(),
|
|
100
|
+
avatar: zod.z.string().nullable().optional()
|
|
101
|
+
});
|
|
102
|
+
const UpdateUserProfileResponseSchema = UserProfileResponseSchema;
|
|
95
103
|
const LogoutResponseSchema = zod.z.object({
|
|
96
104
|
success: zod.z.literal(true)
|
|
97
105
|
});
|
|
@@ -193,6 +201,11 @@ const ShareAuthResponseSchema = zod.z.object({
|
|
|
193
201
|
permissions: TaskSharePermissionsSchema
|
|
194
202
|
});
|
|
195
203
|
|
|
204
|
+
const TaskTodoSchema = zod.z.object({
|
|
205
|
+
agentId: zod.z.string(),
|
|
206
|
+
title: zod.z.string().min(1).max(200),
|
|
207
|
+
instructions: zod.z.string()
|
|
208
|
+
});
|
|
196
209
|
const StartTaskRequestSchema = zod.z.object({
|
|
197
210
|
chatId: zod.z.string(),
|
|
198
211
|
customTitle: zod.z.string().min(1).max(200).optional(),
|
|
@@ -224,8 +237,10 @@ const StartTaskRequestSchema = zod.z.object({
|
|
|
224
237
|
// Multi-agent collaboration fields
|
|
225
238
|
agentId: zod.z.string().optional(),
|
|
226
239
|
// Agent ID to execute the task (overrides chat's first agent)
|
|
227
|
-
parentTaskId: zod.z.string().optional()
|
|
240
|
+
parentTaskId: zod.z.string().optional(),
|
|
228
241
|
// Parent task ID (for creating child tasks, machineId/cloudId inherited from parent)
|
|
242
|
+
todos: zod.z.array(TaskTodoSchema).optional()
|
|
243
|
+
// Structured todos for group tasks
|
|
229
244
|
}).refine((data) => data.machineId || data.cloudId || data.parentTaskId, {
|
|
230
245
|
message: "Must provide either machineId, cloudId, or parentTaskId (for sub-tasks)"
|
|
231
246
|
}).refine(
|
|
@@ -250,6 +265,7 @@ const StartTaskResponseSchema = zod.z.object({
|
|
|
250
265
|
taskId: IdSchema,
|
|
251
266
|
chatId: IdSchema,
|
|
252
267
|
agentId: zod.z.string(),
|
|
268
|
+
taskAgentIds: zod.z.array(zod.z.string()),
|
|
253
269
|
userId: zod.z.string(),
|
|
254
270
|
state: zod.z.string(),
|
|
255
271
|
machineId: zod.z.string().nullable(),
|
|
@@ -309,6 +325,8 @@ const TaskItemSchema = zod.z.object({
|
|
|
309
325
|
// Root task ID. If rootTaskId = id, this is a root task
|
|
310
326
|
parentTaskId: zod.z.string().nullable(),
|
|
311
327
|
// Direct parent task ID. Root task has parentTaskId = null
|
|
328
|
+
taskAgentIds: zod.z.array(zod.z.string()),
|
|
329
|
+
// Persisted agent IDs for this task
|
|
312
330
|
createdAt: zod.z.string(),
|
|
313
331
|
// ISO 8601 string
|
|
314
332
|
updatedAt: zod.z.string()
|
|
@@ -486,8 +504,11 @@ const SendTaskMessageRequestSchema = zod.z.object({
|
|
|
486
504
|
),
|
|
487
505
|
target: zod.z.enum(["agent", "user"]),
|
|
488
506
|
// Target: 'agent' or 'user' (required)
|
|
489
|
-
fromTaskId: zod.z.string().optional()
|
|
507
|
+
fromTaskId: zod.z.string().optional(),
|
|
490
508
|
// Source task ID (for inter-task messaging)
|
|
509
|
+
senderType: SenderTypeSchema,
|
|
510
|
+
senderId: zod.z.string(),
|
|
511
|
+
senderName: zod.z.string()
|
|
491
512
|
});
|
|
492
513
|
const SendTaskMessageResponseSchema = zod.z.object({
|
|
493
514
|
success: zod.z.boolean()
|
|
@@ -495,7 +516,7 @@ const SendTaskMessageResponseSchema = zod.z.object({
|
|
|
495
516
|
const ShowModalRequestSchema = zod.z.object({
|
|
496
517
|
modalName: zod.z.string(),
|
|
497
518
|
// Modal identifier, e.g., "configure-env-vars"
|
|
498
|
-
modalData: zod.z.record(zod.z.any())
|
|
519
|
+
modalData: zod.z.record(zod.z.string(), zod.z.any())
|
|
499
520
|
// Modal-specific data
|
|
500
521
|
});
|
|
501
522
|
const ShowModalResponseSchema = zod.z.object({
|
|
@@ -505,6 +526,17 @@ const GetTaskSessionResponseSchema = zod.z.object({
|
|
|
505
526
|
sessionPath: zod.z.string(),
|
|
506
527
|
state: zod.z.string()
|
|
507
528
|
});
|
|
529
|
+
const ListSubTasksRequestSchema = zod.z.object({
|
|
530
|
+
parentTaskId: IdSchema
|
|
531
|
+
});
|
|
532
|
+
const SubTaskSummarySchema = zod.z.object({
|
|
533
|
+
taskId: IdSchema,
|
|
534
|
+
title: zod.z.string().nullable(),
|
|
535
|
+
cwd: zod.z.string().nullable()
|
|
536
|
+
});
|
|
537
|
+
const ListSubTasksResponseSchema = zod.z.object({
|
|
538
|
+
tasks: zod.z.array(SubTaskSummarySchema)
|
|
539
|
+
});
|
|
508
540
|
const FindTaskByAgentRequestSchema = zod.z.object({
|
|
509
541
|
parentTaskId: zod.z.string(),
|
|
510
542
|
agentId: zod.z.string()
|
|
@@ -653,7 +685,9 @@ const CreateAgentRequestSchema = zod.z.object({
|
|
|
653
685
|
placeholderMsg: zod.z.string().default("Ask me anything..."),
|
|
654
686
|
gitRepoId: zod.z.string().optional(),
|
|
655
687
|
supportLocal: zod.z.boolean().default(false),
|
|
656
|
-
config: AgentCustomConfigSchema.nullable().optional()
|
|
688
|
+
config: AgentCustomConfigSchema.nullable().optional(),
|
|
689
|
+
isSystem: zod.z.boolean().optional()
|
|
690
|
+
// If true, userId will be set to 'system' (admin only)
|
|
657
691
|
});
|
|
658
692
|
const CreateAgentResponseSchema = AgentSchema;
|
|
659
693
|
const UpdateAgentRequestSchema = zod.z.object({
|
|
@@ -1133,7 +1167,7 @@ const RpcCallEventSchema = zod.z.object({
|
|
|
1133
1167
|
method: zod.z.enum(["GET", "POST", "PATCH", "DELETE"]),
|
|
1134
1168
|
path: zod.z.string(),
|
|
1135
1169
|
// API path, e.g., "/v1/draft-agent"
|
|
1136
|
-
query: zod.z.record(zod.z.any()).optional(),
|
|
1170
|
+
query: zod.z.record(zod.z.string(), zod.z.any()).optional(),
|
|
1137
1171
|
// Query params for GET requests
|
|
1138
1172
|
body: zod.z.any().optional()
|
|
1139
1173
|
// Request body for POST/PATCH/DELETE
|
|
@@ -1179,15 +1213,11 @@ const AskUserResponseMessageSchema = zod.z.object({
|
|
|
1179
1213
|
status: AskUserResponseStatusSchema.optional(),
|
|
1180
1214
|
reason: AskUserResponseReasonSchema.optional()
|
|
1181
1215
|
});
|
|
1182
|
-
const
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
totalInsertions: zod.z.number(),
|
|
1188
|
-
totalDeletions: zod.z.number(),
|
|
1189
|
-
files: zod.z.array(FileStatsSchema)
|
|
1190
|
-
})
|
|
1216
|
+
const TaskAgentInfoSchema = zod.z.object({
|
|
1217
|
+
id: zod.z.string(),
|
|
1218
|
+
name: zod.z.string(),
|
|
1219
|
+
type: zod.z.enum(["claude", "codex"]).optional().default("claude"),
|
|
1220
|
+
description: zod.z.string().optional()
|
|
1191
1221
|
});
|
|
1192
1222
|
function isAskUserMessage(message) {
|
|
1193
1223
|
return typeof message === "object" && message !== null && "type" in message && message.type === "ask_user";
|
|
@@ -1195,11 +1225,11 @@ function isAskUserMessage(message) {
|
|
|
1195
1225
|
function isAskUserResponseMessage(message) {
|
|
1196
1226
|
return typeof message === "object" && message !== null && "type" in message && message.type === "ask_user_response";
|
|
1197
1227
|
}
|
|
1198
|
-
function isTaskArtifactsMessage(message) {
|
|
1199
|
-
return typeof message === "object" && message !== null && "type" in message && message.type === "task_artifacts_updated";
|
|
1200
|
-
}
|
|
1201
1228
|
function isSDKMessage(message) {
|
|
1202
|
-
return typeof message === "object" && message !== null && "type" in message && message.type !== "ask_user" && message.type !== "ask_user_response"
|
|
1229
|
+
return typeof message === "object" && message !== null && "type" in message && message.type !== "ask_user" && message.type !== "ask_user_response";
|
|
1230
|
+
}
|
|
1231
|
+
function isSDKUserMessage(message) {
|
|
1232
|
+
return isSDKMessage(message) && message.type === "user";
|
|
1203
1233
|
}
|
|
1204
1234
|
const EventBaseSchema = zod.z.object({
|
|
1205
1235
|
eventId: zod.z.string()
|
|
@@ -1247,12 +1277,17 @@ const WorkerReadySchema = EventBaseSchema.extend({
|
|
|
1247
1277
|
duration: zod.z.number().optional()
|
|
1248
1278
|
// Duration of this execution round (milliseconds)
|
|
1249
1279
|
});
|
|
1280
|
+
const ActiveAgentSchema = zod.z.object({
|
|
1281
|
+
agentId: zod.z.string(),
|
|
1282
|
+
agentName: zod.z.string()
|
|
1283
|
+
});
|
|
1250
1284
|
const WorkerAliveEventSchema = EventBaseSchema.extend({
|
|
1251
1285
|
taskId: zod.z.string(),
|
|
1252
1286
|
machineId: zod.z.string(),
|
|
1253
1287
|
status: zod.z.string(),
|
|
1254
1288
|
// running, ready
|
|
1255
|
-
timestamp: zod.z.string()
|
|
1289
|
+
timestamp: zod.z.string(),
|
|
1290
|
+
activeAgents: zod.z.array(ActiveAgentSchema).optional()
|
|
1256
1291
|
});
|
|
1257
1292
|
const WorkerExitSchema = EventBaseSchema.extend({
|
|
1258
1293
|
taskId: zod.z.string(),
|
|
@@ -1263,7 +1298,8 @@ const WorkerExitSchema = EventBaseSchema.extend({
|
|
|
1263
1298
|
const WorkerRunningSchema = EventBaseSchema.extend({
|
|
1264
1299
|
taskId: zod.z.string(),
|
|
1265
1300
|
machineId: zod.z.string(),
|
|
1266
|
-
timestamp: zod.z.string()
|
|
1301
|
+
timestamp: zod.z.string(),
|
|
1302
|
+
activeAgents: zod.z.array(ActiveAgentSchema).optional()
|
|
1267
1303
|
});
|
|
1268
1304
|
const WorkerStatusRequestSchema = EventBaseSchema.extend({
|
|
1269
1305
|
taskId: zod.z.string(),
|
|
@@ -1312,7 +1348,7 @@ const baseTaskSchema = EventBaseSchema.extend({
|
|
|
1312
1348
|
// Maximum number of turns for the agent (default: 50)
|
|
1313
1349
|
repositoryId: zod.z.string().optional(),
|
|
1314
1350
|
// Existing repository ID (used to skip auto-association)
|
|
1315
|
-
repositorySourceType: zod.z.enum(["temporary", "directory", "git-server"]).optional(),
|
|
1351
|
+
repositorySourceType: zod.z.enum(["temporary", "directory", "git-server"]).optional().default("temporary"),
|
|
1316
1352
|
// Repository source type (determines workspace mode)
|
|
1317
1353
|
environmentVariables: zod.z.record(zod.z.string(), zod.z.string()).optional(),
|
|
1318
1354
|
// Environment variables for task execution
|
|
@@ -1321,46 +1357,23 @@ const baseTaskSchema = EventBaseSchema.extend({
|
|
|
1321
1357
|
// Root task ID of the task tree
|
|
1322
1358
|
parentTaskId: zod.z.string().optional(),
|
|
1323
1359
|
// Parent task ID (for sub tasks)
|
|
1324
|
-
|
|
1325
|
-
//
|
|
1360
|
+
taskAgents: zod.z.array(TaskAgentInfoSchema).optional(),
|
|
1361
|
+
// Agents available for this task
|
|
1362
|
+
todos: zod.z.array(TaskTodoSchema).optional(),
|
|
1363
|
+
// Structured todos for group tasks
|
|
1326
1364
|
taskType: zod.z.enum(["chat", "work"]).optional().default("work"),
|
|
1327
1365
|
// Task type: 'chat' for main chat, 'work' for task execution
|
|
1328
1366
|
customTitle: zod.z.string().min(1).max(200).optional()
|
|
1329
1367
|
// Custom task title (set by user/tool)
|
|
1330
1368
|
});
|
|
1331
1369
|
const createTaskSchema = baseTaskSchema.extend({
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
},
|
|
1336
|
-
{
|
|
1337
|
-
message: "Invalid SDKMessage format"
|
|
1338
|
-
}
|
|
1339
|
-
).optional(),
|
|
1340
|
-
encryptedMessage: zod.z.string().optional()
|
|
1341
|
-
// base64 sealed-box payload for local machines
|
|
1342
|
-
}).refine(
|
|
1343
|
-
(data) => {
|
|
1344
|
-
return !!data.message !== !!data.encryptedMessage;
|
|
1345
|
-
},
|
|
1346
|
-
{
|
|
1347
|
-
message: "Exactly one of message or encryptedMessage must be provided"
|
|
1348
|
-
}
|
|
1349
|
-
);
|
|
1370
|
+
event: zod.z.string(),
|
|
1371
|
+
eventData: zod.z.any()
|
|
1372
|
+
});
|
|
1350
1373
|
const resumeTaskSchema = baseTaskSchema.extend({
|
|
1351
1374
|
agentSessionId: zod.z.string(),
|
|
1352
|
-
event: zod.z.string()
|
|
1353
|
-
eventData: zod.z.any()
|
|
1354
|
-
message: zod.z.custom(
|
|
1355
|
-
(data) => {
|
|
1356
|
-
return typeof data === "object" && data !== null && "type" in data;
|
|
1357
|
-
},
|
|
1358
|
-
{
|
|
1359
|
-
message: "Invalid SDKMessage format"
|
|
1360
|
-
}
|
|
1361
|
-
).optional(),
|
|
1362
|
-
encryptedMessage: zod.z.string().optional()
|
|
1363
|
-
// base64 sealed-box for local tasks
|
|
1375
|
+
event: zod.z.string(),
|
|
1376
|
+
eventData: zod.z.any()
|
|
1364
1377
|
});
|
|
1365
1378
|
const cancelTaskSchema = EventBaseSchema.extend({
|
|
1366
1379
|
taskId: zod.z.string(),
|
|
@@ -1373,10 +1386,10 @@ const StopTaskSchema = EventBaseSchema.extend({
|
|
|
1373
1386
|
taskId: zod.z.string(),
|
|
1374
1387
|
reason: zod.z.string().optional()
|
|
1375
1388
|
});
|
|
1376
|
-
const
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1389
|
+
const TaskArtifactsStatsSchema = zod.z.object({
|
|
1390
|
+
totalInsertions: zod.z.number(),
|
|
1391
|
+
totalDeletions: zod.z.number(),
|
|
1392
|
+
files: zod.z.array(FileStatsSchema)
|
|
1380
1393
|
});
|
|
1381
1394
|
const PreviewProjectTypeSchema = zod.z.enum([
|
|
1382
1395
|
"html",
|
|
@@ -1402,9 +1415,9 @@ const PreviewMetadataSchema = zod.z.object({
|
|
|
1402
1415
|
tailwindVersion: zod.z.union([zod.z.literal(3), zod.z.literal(4), zod.z.null()]).optional(),
|
|
1403
1416
|
isStaticFileCollection: zod.z.boolean().optional()
|
|
1404
1417
|
});
|
|
1405
|
-
const
|
|
1418
|
+
const TaskArtifactsSummarySchema = zod.z.object({
|
|
1406
1419
|
commitHash: zod.z.string(),
|
|
1407
|
-
|
|
1420
|
+
stats: TaskArtifactsStatsSchema,
|
|
1408
1421
|
preview: PreviewMetadataSchema.nullable()
|
|
1409
1422
|
// Preview metadata computed by CLI
|
|
1410
1423
|
});
|
|
@@ -1414,6 +1427,7 @@ const TaskMessageSchema = EventBaseSchema.extend({
|
|
|
1414
1427
|
from: zod.z.enum(["app", "api-server", "machine", "worker"]),
|
|
1415
1428
|
opCode: zod.z.string().optional(),
|
|
1416
1429
|
// eventId of the message this is responding to (e.g., ask_user_response → ask_user)
|
|
1430
|
+
groupId: zod.z.string().optional(),
|
|
1417
1431
|
sequence: zod.z.number().int().min(0).optional(),
|
|
1418
1432
|
message: zod.z.custom(
|
|
1419
1433
|
(data) => {
|
|
@@ -1428,10 +1442,13 @@ const TaskMessageSchema = EventBaseSchema.extend({
|
|
|
1428
1442
|
// Multi-agent collaboration fields
|
|
1429
1443
|
agentId: zod.z.string().optional(),
|
|
1430
1444
|
// Agent ID for message attribution
|
|
1445
|
+
senderType: SenderTypeSchema,
|
|
1446
|
+
senderId: zod.z.string(),
|
|
1447
|
+
senderName: zod.z.string(),
|
|
1431
1448
|
rootTaskId: zod.z.string().optional(),
|
|
1432
1449
|
// Root task ID for event routing
|
|
1433
|
-
// Artifacts summary - attached to result messages for
|
|
1434
|
-
artifacts:
|
|
1450
|
+
// Artifacts summary - attached to result messages for task completion
|
|
1451
|
+
artifacts: TaskArtifactsSummarySchema.optional()
|
|
1435
1452
|
}).refine(
|
|
1436
1453
|
(data) => {
|
|
1437
1454
|
return !!data.message !== !!data.encryptedMessage;
|
|
@@ -1440,13 +1457,6 @@ const TaskMessageSchema = EventBaseSchema.extend({
|
|
|
1440
1457
|
message: "Exactly one of message or encryptedMessage must be provided"
|
|
1441
1458
|
}
|
|
1442
1459
|
);
|
|
1443
|
-
const TaskArtifactsUpdatedEventSchema = EventBaseSchema.extend({
|
|
1444
|
-
taskId: zod.z.string(),
|
|
1445
|
-
stats: zod.z.object({
|
|
1446
|
-
totalInsertions: zod.z.number(),
|
|
1447
|
-
totalDeletions: zod.z.number()
|
|
1448
|
-
})
|
|
1449
|
-
});
|
|
1450
1460
|
const ShowModalEventDataSchema = EventBaseSchema.extend({
|
|
1451
1461
|
taskId: zod.z.string(),
|
|
1452
1462
|
chatId: zod.z.string().optional(),
|
|
@@ -1454,7 +1464,7 @@ const ShowModalEventDataSchema = EventBaseSchema.extend({
|
|
|
1454
1464
|
timestamp: zod.z.string(),
|
|
1455
1465
|
modalName: zod.z.string(),
|
|
1456
1466
|
// e.g., "configure-env-vars"
|
|
1457
|
-
modalData: zod.z.record(zod.z.any())
|
|
1467
|
+
modalData: zod.z.record(zod.z.string(), zod.z.any())
|
|
1458
1468
|
// Modal-specific data
|
|
1459
1469
|
});
|
|
1460
1470
|
const ChangeTaskTitleEventSchema = EventBaseSchema.extend({
|
|
@@ -1562,7 +1572,7 @@ const UpdateTaskAgentSessionIdEventSchema = EventBaseSchema.extend({
|
|
|
1562
1572
|
const TaskInfoUpdateEventDataSchema = EventBaseSchema.extend({
|
|
1563
1573
|
taskId: zod.z.string(),
|
|
1564
1574
|
chatId: zod.z.string(),
|
|
1565
|
-
updates: zod.z.record(zod.z.any()).optional(),
|
|
1575
|
+
updates: zod.z.record(zod.z.string(), zod.z.any()).optional(),
|
|
1566
1576
|
// Flexible updates object for any task fields
|
|
1567
1577
|
updatedAt: zod.z.string()
|
|
1568
1578
|
// ISO 8601 timestamp
|
|
@@ -1595,7 +1605,7 @@ const SubTaskResultUpdatedEventSchema = EventBaseSchema.extend({
|
|
|
1595
1605
|
is_error: zod.z.boolean().optional()
|
|
1596
1606
|
}),
|
|
1597
1607
|
// Optional artifacts summary (for displaying in parent task chat)
|
|
1598
|
-
artifacts:
|
|
1608
|
+
artifacts: TaskArtifactsSummarySchema.optional()
|
|
1599
1609
|
});
|
|
1600
1610
|
const MergePullRequestEventSchema = EventBaseSchema.extend({
|
|
1601
1611
|
taskId: zod.z.string(),
|
|
@@ -1725,8 +1735,6 @@ const EventSchemaMap = {
|
|
|
1725
1735
|
"task-state-change": TaskStateChangeEventSchema,
|
|
1726
1736
|
"update-task-agent-session-id": UpdateTaskAgentSessionIdEventSchema,
|
|
1727
1737
|
"task-info-update": TaskInfoUpdateEventDataSchema,
|
|
1728
|
-
// Artifacts events
|
|
1729
|
-
"task-artifacts-updated": TaskArtifactsUpdatedEventSchema,
|
|
1730
1738
|
// Modal events
|
|
1731
1739
|
"show-modal": ShowModalEventDataSchema,
|
|
1732
1740
|
// Merge request events
|
|
@@ -1766,7 +1774,6 @@ const workerTaskEvents = [
|
|
|
1766
1774
|
"worker-exit",
|
|
1767
1775
|
"change-task-title",
|
|
1768
1776
|
"update-task-agent-session-id",
|
|
1769
|
-
"task-artifacts-updated",
|
|
1770
1777
|
"merge-request",
|
|
1771
1778
|
"merge-pr",
|
|
1772
1779
|
"associate-repo"
|
|
@@ -1818,7 +1825,7 @@ const ClaudeConfigSchema = zod.z.object({
|
|
|
1818
1825
|
fallbackModel: zod.z.string().optional(),
|
|
1819
1826
|
maxTurns: zod.z.number().int().positive().optional(),
|
|
1820
1827
|
// SDK native extra arguments
|
|
1821
|
-
extraArgs: zod.z.record(zod.z.string().nullable()).optional(),
|
|
1828
|
+
extraArgs: zod.z.record(zod.z.string(), zod.z.string().nullable()).optional(),
|
|
1822
1829
|
systemPrompt: zod.z.object({
|
|
1823
1830
|
path: zod.z.string(),
|
|
1824
1831
|
mode: zod.z.enum(["append", "replace"]).optional().default("append")
|
|
@@ -1964,7 +1971,8 @@ async function loadAgentConfig(options) {
|
|
|
1964
1971
|
console.warn(`[AGENT] Warnings for agent "${agentId}":`, validation.warnings);
|
|
1965
1972
|
}
|
|
1966
1973
|
const metadata = await loadAgentMetadata(agentDir);
|
|
1967
|
-
const
|
|
1974
|
+
const frameworkDirName = framework === "claude" ? "claude" : `.${framework}`;
|
|
1975
|
+
const frameworkDir = node_path.join(agentDir, frameworkDirName);
|
|
1968
1976
|
if (!node_fs.existsSync(frameworkDir)) {
|
|
1969
1977
|
throw new FrameworkNotSupportedError(agentId, framework);
|
|
1970
1978
|
}
|
|
@@ -2002,7 +2010,7 @@ async function loadAgentMetadata(agentDir) {
|
|
|
2002
2010
|
}
|
|
2003
2011
|
}
|
|
2004
2012
|
async function loadClaudeConfiguration(agentDir, metadata) {
|
|
2005
|
-
const claudeDir = node_path.join(agentDir, "
|
|
2013
|
+
const claudeDir = node_path.join(agentDir, "claude");
|
|
2006
2014
|
const validation = validateFrameworkDirectory(claudeDir, "claude");
|
|
2007
2015
|
if (!validation.valid) {
|
|
2008
2016
|
throw new AgentConfigValidationError(
|
|
@@ -2030,7 +2038,7 @@ async function loadClaudeConfiguration(agentDir, metadata) {
|
|
|
2030
2038
|
}
|
|
2031
2039
|
async function loadClaudeConfig(claudeDir) {
|
|
2032
2040
|
const configPath = node_path.join(claudeDir, "config.json");
|
|
2033
|
-
assertFileExists(configPath, "
|
|
2041
|
+
assertFileExists(configPath, "claude/config.json");
|
|
2034
2042
|
try {
|
|
2035
2043
|
const content = node_fs.readFileSync(configPath, "utf-8");
|
|
2036
2044
|
const rawConfig = JSON.parse(content);
|
|
@@ -2039,7 +2047,7 @@ async function loadClaudeConfig(claudeDir) {
|
|
|
2039
2047
|
} catch (error) {
|
|
2040
2048
|
if (error instanceof SyntaxError) {
|
|
2041
2049
|
throw new AgentConfigValidationError(
|
|
2042
|
-
"Invalid JSON in
|
|
2050
|
+
"Invalid JSON in claude/config.json"
|
|
2043
2051
|
);
|
|
2044
2052
|
}
|
|
2045
2053
|
throw new AgentConfigValidationError(
|
|
@@ -2050,7 +2058,7 @@ async function loadClaudeConfig(claudeDir) {
|
|
|
2050
2058
|
async function loadSystemPrompt(claudeDir, promptFile) {
|
|
2051
2059
|
const promptPath = node_path.join(claudeDir, promptFile);
|
|
2052
2060
|
if (!node_fs.existsSync(promptPath)) {
|
|
2053
|
-
throw new MissingAgentFileError(
|
|
2061
|
+
throw new MissingAgentFileError(`claude/${promptFile}`);
|
|
2054
2062
|
}
|
|
2055
2063
|
try {
|
|
2056
2064
|
return node_fs.readFileSync(promptPath, "utf-8");
|
|
@@ -2560,8 +2568,52 @@ async function findEntryFile(files, projectType, fs) {
|
|
|
2560
2568
|
return path;
|
|
2561
2569
|
}
|
|
2562
2570
|
}
|
|
2571
|
+
const commonSubdirs = ["src", "app", "client", "frontend"];
|
|
2572
|
+
const commonEntryNames = [
|
|
2573
|
+
"index.html",
|
|
2574
|
+
"index.tsx",
|
|
2575
|
+
"index.ts",
|
|
2576
|
+
"index.jsx",
|
|
2577
|
+
"index.js",
|
|
2578
|
+
"main.tsx",
|
|
2579
|
+
"main.ts",
|
|
2580
|
+
"main.jsx",
|
|
2581
|
+
"main.js",
|
|
2582
|
+
"App.tsx",
|
|
2583
|
+
"App.ts",
|
|
2584
|
+
"App.jsx",
|
|
2585
|
+
"App.js"
|
|
2586
|
+
];
|
|
2587
|
+
for (const subdir of commonSubdirs) {
|
|
2588
|
+
for (const entryName of commonEntryNames) {
|
|
2589
|
+
const path = `${subdir}/${entryName}`;
|
|
2590
|
+
if (files.includes(path)) {
|
|
2591
|
+
const isValid = isValidEntryForProjectType(path, projectType);
|
|
2592
|
+
if (isValid) {
|
|
2593
|
+
return path;
|
|
2594
|
+
}
|
|
2595
|
+
}
|
|
2596
|
+
}
|
|
2597
|
+
}
|
|
2563
2598
|
return null;
|
|
2564
2599
|
}
|
|
2600
|
+
function isValidEntryForProjectType(filePath, projectType) {
|
|
2601
|
+
const ext = getFileExtension(filePath);
|
|
2602
|
+
switch (projectType) {
|
|
2603
|
+
case "html":
|
|
2604
|
+
return ext === ".html" || ext === ".htm";
|
|
2605
|
+
case "react":
|
|
2606
|
+
return [".tsx", ".jsx", ".ts", ".js", ".html"].includes(ext);
|
|
2607
|
+
case "vue":
|
|
2608
|
+
return [".vue", ".ts", ".js", ".html"].includes(ext);
|
|
2609
|
+
case "vite":
|
|
2610
|
+
return [".tsx", ".jsx", ".ts", ".js", ".vue", ".html"].includes(ext);
|
|
2611
|
+
case "nextjs":
|
|
2612
|
+
return [".tsx", ".jsx"].includes(ext);
|
|
2613
|
+
case "unknown":
|
|
2614
|
+
return false;
|
|
2615
|
+
}
|
|
2616
|
+
}
|
|
2565
2617
|
function getPossibleEntryPaths(projectType) {
|
|
2566
2618
|
switch (projectType) {
|
|
2567
2619
|
case "html":
|
|
@@ -2606,6 +2658,7 @@ function getFileExtension(filePath) {
|
|
|
2606
2658
|
return filePath.substring(lastDot).toLowerCase();
|
|
2607
2659
|
}
|
|
2608
2660
|
|
|
2661
|
+
exports.ActiveAgentSchema = ActiveAgentSchema;
|
|
2609
2662
|
exports.AddChatMemberRequestSchema = AddChatMemberRequestSchema;
|
|
2610
2663
|
exports.AddChatMemberResponseSchema = AddChatMemberResponseSchema;
|
|
2611
2664
|
exports.AgentConfigValidationError = AgentConfigValidationError;
|
|
@@ -2728,6 +2781,8 @@ exports.ListOAuthServersResponseSchema = ListOAuthServersResponseSchema;
|
|
|
2728
2781
|
exports.ListPackagesQuerySchema = ListPackagesQuerySchema;
|
|
2729
2782
|
exports.ListPackagesResponseSchema = ListPackagesResponseSchema;
|
|
2730
2783
|
exports.ListRepositoriesResponseSchema = ListRepositoriesResponseSchema;
|
|
2784
|
+
exports.ListSubTasksRequestSchema = ListSubTasksRequestSchema;
|
|
2785
|
+
exports.ListSubTasksResponseSchema = ListSubTasksResponseSchema;
|
|
2731
2786
|
exports.ListTasksRequestSchema = ListTasksRequestSchema;
|
|
2732
2787
|
exports.ListTasksResponseSchema = ListTasksResponseSchema;
|
|
2733
2788
|
exports.ListTransactionsQuerySchema = ListTransactionsQuerySchema;
|
|
@@ -2785,6 +2840,7 @@ exports.RtcSignalSchema = RtcSignalSchema;
|
|
|
2785
2840
|
exports.STATIC_FILE_EXTENSIONS = STATIC_FILE_EXTENSIONS;
|
|
2786
2841
|
exports.SendTaskMessageRequestSchema = SendTaskMessageRequestSchema;
|
|
2787
2842
|
exports.SendTaskMessageResponseSchema = SendTaskMessageResponseSchema;
|
|
2843
|
+
exports.SenderTypeSchema = SenderTypeSchema;
|
|
2788
2844
|
exports.SetEnvironmentVariablesRequestSchema = SetEnvironmentVariablesRequestSchema;
|
|
2789
2845
|
exports.ShareAuthQuerySchema = ShareAuthQuerySchema;
|
|
2790
2846
|
exports.ShareAuthResponseSchema = ShareAuthResponseSchema;
|
|
@@ -2801,21 +2857,22 @@ exports.StatsQuerySchema = StatsQuerySchema;
|
|
|
2801
2857
|
exports.StopTaskRequestSchema = StopTaskRequestSchema;
|
|
2802
2858
|
exports.StopTaskResponseSchema = StopTaskResponseSchema;
|
|
2803
2859
|
exports.StopTaskSchema = StopTaskSchema;
|
|
2804
|
-
exports.SubTaskArtifactsSummarySchema = SubTaskArtifactsSummarySchema;
|
|
2805
|
-
exports.SubTaskGitStatsSchema = SubTaskGitStatsSchema;
|
|
2806
2860
|
exports.SubTaskResultUpdatedEventSchema = SubTaskResultUpdatedEventSchema;
|
|
2861
|
+
exports.SubTaskSummarySchema = SubTaskSummarySchema;
|
|
2807
2862
|
exports.SyncCloudMachineResponseSchema = SyncCloudMachineResponseSchema;
|
|
2808
2863
|
exports.SyncLocalMachineResponseSchema = SyncLocalMachineResponseSchema;
|
|
2809
2864
|
exports.SyncMachineRequestSchema = SyncMachineRequestSchema;
|
|
2810
2865
|
exports.SystemMessageSchema = SystemMessageSchema;
|
|
2811
|
-
exports.
|
|
2812
|
-
exports.
|
|
2866
|
+
exports.TaskAgentInfoSchema = TaskAgentInfoSchema;
|
|
2867
|
+
exports.TaskArtifactsStatsSchema = TaskArtifactsStatsSchema;
|
|
2868
|
+
exports.TaskArtifactsSummarySchema = TaskArtifactsSummarySchema;
|
|
2813
2869
|
exports.TaskInfoUpdateEventDataSchema = TaskInfoUpdateEventDataSchema;
|
|
2814
2870
|
exports.TaskItemSchema = TaskItemSchema;
|
|
2815
2871
|
exports.TaskMessageSchema = TaskMessageSchema;
|
|
2816
2872
|
exports.TaskSharePermissionsSchema = TaskSharePermissionsSchema;
|
|
2817
2873
|
exports.TaskStateChangeEventSchema = TaskStateChangeEventSchema;
|
|
2818
2874
|
exports.TaskStoppedEventSchema = TaskStoppedEventSchema;
|
|
2875
|
+
exports.TaskTodoSchema = TaskTodoSchema;
|
|
2819
2876
|
exports.TaskTransactionsResponseSchema = TaskTransactionsResponseSchema;
|
|
2820
2877
|
exports.ToggleOAuthServerRequestSchema = ToggleOAuthServerRequestSchema;
|
|
2821
2878
|
exports.ToggleOAuthServerResponseSchema = ToggleOAuthServerResponseSchema;
|
|
@@ -2833,6 +2890,8 @@ exports.UpdateOAuthServerResponseSchema = UpdateOAuthServerResponseSchema;
|
|
|
2833
2890
|
exports.UpdateTaskAgentSessionIdEventSchema = UpdateTaskAgentSessionIdEventSchema;
|
|
2834
2891
|
exports.UpdateTaskTitleRequestSchema = UpdateTaskTitleRequestSchema;
|
|
2835
2892
|
exports.UpdateTaskTitleResponseSchema = UpdateTaskTitleResponseSchema;
|
|
2893
|
+
exports.UpdateUserProfileRequestSchema = UpdateUserProfileRequestSchema;
|
|
2894
|
+
exports.UpdateUserProfileResponseSchema = UpdateUserProfileResponseSchema;
|
|
2836
2895
|
exports.UploadUrlResultSchema = UploadUrlResultSchema;
|
|
2837
2896
|
exports.UserBalanceResponseSchema = UserBalanceResponseSchema;
|
|
2838
2897
|
exports.UserBasicInfoSchema = UserBasicInfoSchema;
|
|
@@ -2883,7 +2942,7 @@ exports.getRandomBytes = getRandomBytes;
|
|
|
2883
2942
|
exports.isAskUserMessage = isAskUserMessage;
|
|
2884
2943
|
exports.isAskUserResponseMessage = isAskUserResponseMessage;
|
|
2885
2944
|
exports.isSDKMessage = isSDKMessage;
|
|
2886
|
-
exports.
|
|
2945
|
+
exports.isSDKUserMessage = isSDKUserMessage;
|
|
2887
2946
|
exports.loadAgentConfig = loadAgentConfig;
|
|
2888
2947
|
exports.machineAuth = machineAuth;
|
|
2889
2948
|
exports.permissionResponseRequestSchema = permissionResponseRequestSchema;
|