@agentrix/shared 2.0.6 → 2.0.8

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 CHANGED
@@ -218,8 +218,11 @@ const StartTaskRequestSchema = zod.z.object({
218
218
  // Base branch for the repository
219
219
  repositorySourceType: zod.z.enum(["temporary", "directory", "git-server"]).optional(),
220
220
  // Repository source type
221
- dataEncryptionKey: zod.z.string().optional()
221
+ dataEncryptionKey: zod.z.string().optional(),
222
222
  // base64 sealed-box: app public key encrypted by machine public key
223
+ // Multi-agent collaboration fields
224
+ parentTaskId: zod.z.string().optional()
225
+ // Parent task ID (for creating child tasks)
223
226
  }).refine((data) => data.machineId || data.cloudId, {
224
227
  message: "Must provide either machineId or cloudId"
225
228
  }).refine(
@@ -292,6 +295,11 @@ const TaskItemSchema = zod.z.object({
292
295
  }).nullable(),
293
296
  totalDuration: zod.z.number().nullable(),
294
297
  // Cumulative execution time (milliseconds)
298
+ // Multi-agent collaboration fields
299
+ rootTaskId: zod.z.string().nullable(),
300
+ // Root task ID. If rootTaskId = id, this is a root task
301
+ parentTaskId: zod.z.string().nullable(),
302
+ // Direct parent task ID. Root task has parentTaskId = null
295
303
  createdAt: zod.z.string(),
296
304
  // ISO 8601 string
297
305
  updatedAt: zod.z.string()
@@ -458,6 +466,43 @@ const UpdateTaskTitleResponseSchema = zod.z.object({
458
466
  success: zod.z.boolean(),
459
467
  task: TaskItemSchema
460
468
  });
469
+ const SendTaskMessageRequestSchema = zod.z.object({
470
+ message: zod.z.custom(
471
+ (data) => {
472
+ return typeof data === "object" && data !== null && "type" in data;
473
+ },
474
+ {
475
+ message: "Invalid SDKMessage format"
476
+ }
477
+ ),
478
+ target: zod.z.enum(["agent", "user"]),
479
+ // Target: 'agent' or 'user' (required)
480
+ fromTaskId: zod.z.string().optional()
481
+ // Source task ID (for inter-task messaging)
482
+ });
483
+ const SendTaskMessageResponseSchema = zod.z.object({
484
+ success: zod.z.boolean()
485
+ });
486
+ const ShowModalRequestSchema = zod.z.object({
487
+ modalName: zod.z.string(),
488
+ // Modal identifier, e.g., "configure-env-vars"
489
+ modalData: zod.z.record(zod.z.any())
490
+ // Modal-specific data
491
+ });
492
+ const ShowModalResponseSchema = zod.z.object({
493
+ success: zod.z.boolean()
494
+ });
495
+ const GetTaskSessionResponseSchema = zod.z.object({
496
+ sessionPath: zod.z.string(),
497
+ state: zod.z.string()
498
+ });
499
+ const FindTaskByAgentRequestSchema = zod.z.object({
500
+ parentTaskId: zod.z.string(),
501
+ agentId: zod.z.string()
502
+ });
503
+ const FindTaskByAgentResponseSchema = zod.z.object({
504
+ taskId: zod.z.string().nullable()
505
+ });
461
506
 
462
507
  const ChatMemberSchema = zod.z.object({
463
508
  id: IdSchema,
@@ -476,6 +521,7 @@ const ChatSchema = zod.z.object({
476
521
  owner: IdSchema,
477
522
  // Group: userId of owner; Direct: "memberCode1:memberCode2" (sorted)
478
523
  type: ChatTypeSchema,
524
+ title: zod.z.string().nullable().optional(),
479
525
  createdAt: zod.z.string(),
480
526
  // ISO 8601 string
481
527
  updatedAt: zod.z.string()
@@ -664,6 +710,32 @@ const GetUserAgentsResponseSchema = zod.z.object({
664
710
  draftAgents: zod.z.array(DraftAgentSchema)
665
711
  // Draft agents
666
712
  });
713
+ const PublishDraftAgentRequestSchema = zod.z.object({
714
+ draftAgentId: zod.z.string(),
715
+ machineId: zod.z.string().optional(),
716
+ cloudId: zod.z.string().optional(),
717
+ name: zod.z.string().optional(),
718
+ // Optional custom agent name (defaults to draft agent's displayName)
719
+ avatar: zod.z.string().optional(),
720
+ // Optional custom avatar (defaults to draft agent's avatar)
721
+ isSystemAgent: zod.z.boolean().optional(),
722
+ // If true, userId will be set to 'system'
723
+ supportLocal: zod.z.boolean().optional()
724
+ // Support local mode (defaults to false)
725
+ }).refine(
726
+ (data) => {
727
+ return !!data.machineId !== !!data.cloudId;
728
+ },
729
+ {
730
+ message: "Exactly one of machineId or cloudId must be provided"
731
+ }
732
+ );
733
+ const PublishDraftAgentResponseSchema = zod.z.object({
734
+ agentId: zod.z.string(),
735
+ // Generated agent ID (Agent record created after deployment)
736
+ taskId: zod.z.string()
737
+ // Deployment task ID
738
+ });
667
739
 
668
740
  const LocalMachineSchema = zod.z.object({
669
741
  id: IdSchema,
@@ -1196,8 +1268,15 @@ const baseTaskSchema = EventBaseSchema.extend({
1196
1268
  // Existing repository ID (used to skip auto-association)
1197
1269
  repositorySourceType: zod.z.enum(["temporary", "directory", "git-server"]).optional(),
1198
1270
  // Repository source type (determines workspace mode)
1199
- environmentVariables: zod.z.record(zod.z.string(), zod.z.string()).optional()
1271
+ environmentVariables: zod.z.record(zod.z.string(), zod.z.string()).optional(),
1200
1272
  // Environment variables for task execution
1273
+ // Multi-agent collaboration fields
1274
+ rootTaskId: zod.z.string().optional(),
1275
+ // Root task ID of the task tree
1276
+ parentTaskId: zod.z.string().optional(),
1277
+ // Parent task ID (for sub tasks)
1278
+ chatAgents: zod.z.record(zod.z.string(), zod.z.string()).optional()
1279
+ // All agents in chat: { displayName: agentId }
1201
1280
  });
1202
1281
  const createTaskSchema = baseTaskSchema.extend({
1203
1282
  message: zod.z.custom(
@@ -1259,8 +1338,13 @@ const TaskMessageSchema = EventBaseSchema.extend({
1259
1338
  message: "Invalid TaskMessagePayload format"
1260
1339
  }
1261
1340
  ).optional(),
1262
- encryptedMessage: zod.z.string().optional()
1341
+ encryptedMessage: zod.z.string().optional(),
1263
1342
  // base64 sealed-box payload (local mode)
1343
+ // Multi-agent collaboration fields
1344
+ agentId: zod.z.string().optional(),
1345
+ // Agent ID for message attribution
1346
+ rootTaskId: zod.z.string().optional()
1347
+ // Root task ID for event routing
1264
1348
  }).refine(
1265
1349
  (data) => {
1266
1350
  return !!data.message !== !!data.encryptedMessage;
@@ -1401,10 +1485,69 @@ const MergeRequestEventSchema = EventBaseSchema.extend({
1401
1485
  summary: zod.z.string(),
1402
1486
  description: zod.z.string().optional()
1403
1487
  });
1488
+ const TaskStoppedEventSchema = EventBaseSchema.extend({
1489
+ taskId: zod.z.string()
1490
+ });
1491
+ const SubTaskCompletedEventSchema = EventBaseSchema.extend({
1492
+ taskId: zod.z.string(),
1493
+ // Completed sub task ID
1494
+ parentTaskId: zod.z.string(),
1495
+ // Parent task ID
1496
+ rootTaskId: zod.z.string(),
1497
+ // Root task ID
1498
+ agentName: zod.z.string(),
1499
+ // Agent display name (e.g., "Test Agent")
1500
+ taskName: zod.z.string().optional(),
1501
+ // Task title/name
1502
+ sessionPath: zod.z.string().optional(),
1503
+ // Session file path for analysis
1504
+ cwd: zod.z.string().optional()
1505
+ // Working directory containing generated results
1506
+ });
1404
1507
  const MergePullRequestEventSchema = EventBaseSchema.extend({
1405
1508
  taskId: zod.z.string(),
1406
1509
  mergeMethod: zod.z.enum(["merge", "squash", "rebase"]).optional().default("squash")
1407
1510
  });
1511
+ const DeployAgentEventSchema = EventBaseSchema.extend({
1512
+ taskId: zod.z.string(),
1513
+ draftAgentId: zod.z.string(),
1514
+ userId: zod.z.string(),
1515
+ machineId: zod.z.string().optional(),
1516
+ cloudId: zod.z.string().optional(),
1517
+ sourcePath: zod.z.string(),
1518
+ // Draft agent directory path
1519
+ targetAgentId: zod.z.string(),
1520
+ // New agent ID to deploy to
1521
+ name: zod.z.string().optional(),
1522
+ // Optional custom agent name
1523
+ avatar: zod.z.string().optional(),
1524
+ // Optional custom avatar
1525
+ isSystemAgent: zod.z.boolean().optional(),
1526
+ // If true, use 'system' as userId
1527
+ supportLocal: zod.z.boolean().optional()
1528
+ // Support local mode
1529
+ }).refine(
1530
+ (data) => {
1531
+ return !!data.machineId !== !!data.cloudId;
1532
+ },
1533
+ {
1534
+ message: "Exactly one of machineId or cloudId must be provided"
1535
+ }
1536
+ );
1537
+ const DeployAgentCompleteEventSchema = EventBaseSchema.extend({
1538
+ taskId: zod.z.string(),
1539
+ targetAgentId: zod.z.string(),
1540
+ success: zod.z.boolean(),
1541
+ error: zod.z.string().optional(),
1542
+ name: zod.z.string().optional(),
1543
+ // Optional custom agent name
1544
+ avatar: zod.z.string().optional(),
1545
+ // Optional custom avatar
1546
+ isSystemAgent: zod.z.boolean().optional(),
1547
+ // If true, use 'system' as userId
1548
+ supportLocal: zod.z.boolean().optional()
1549
+ // Support local mode
1550
+ });
1408
1551
  const AssociateRepoEventDataSchema = EventBaseSchema.extend({
1409
1552
  taskId: zod.z.string(),
1410
1553
  gitServerHost: zod.z.string(),
@@ -1490,6 +1633,12 @@ const EventSchemaMap = {
1490
1633
  // Merge request events
1491
1634
  "merge-request": MergeRequestEventSchema,
1492
1635
  "merge-pr": MergePullRequestEventSchema,
1636
+ // Deploy agent events
1637
+ "deploy-agent": DeployAgentEventSchema,
1638
+ "deploy-agent-complete": DeployAgentCompleteEventSchema,
1639
+ // Multi-agent collaboration events
1640
+ "task-stopped": TaskStoppedEventSchema,
1641
+ "sub-task-completed": SubTaskCompletedEventSchema,
1493
1642
  // Repository association events
1494
1643
  "associate-repo": AssociateRepoEventDataSchema,
1495
1644
  // System message events
@@ -2161,6 +2310,8 @@ exports.CreditsPackageSchema = CreditsPackageSchema;
2161
2310
  exports.DateSchema = DateSchema;
2162
2311
  exports.DeleteAgentResponseSchema = DeleteAgentResponseSchema;
2163
2312
  exports.DeleteOAuthServerResponseSchema = DeleteOAuthServerResponseSchema;
2313
+ exports.DeployAgentCompleteEventSchema = DeployAgentCompleteEventSchema;
2314
+ exports.DeployAgentEventSchema = DeployAgentEventSchema;
2164
2315
  exports.DisplayConfigKeysSchema = DisplayConfigKeysSchema;
2165
2316
  exports.DisplayConfigSchema = DisplayConfigSchema;
2166
2317
  exports.DraftAgentConfigSchema = DraftAgentConfigSchema;
@@ -2173,6 +2324,8 @@ exports.FileItemSchema = FileItemSchema;
2173
2324
  exports.FileStatsSchema = FileStatsSchema;
2174
2325
  exports.FileVisibilitySchema = FileVisibilitySchema;
2175
2326
  exports.FillEventsRequestSchema = FillEventsRequestSchema;
2327
+ exports.FindTaskByAgentRequestSchema = FindTaskByAgentRequestSchema;
2328
+ exports.FindTaskByAgentResponseSchema = FindTaskByAgentResponseSchema;
2176
2329
  exports.FrameworkNotSupportedError = FrameworkNotSupportedError;
2177
2330
  exports.GetAgentResponseSchema = GetAgentResponseSchema;
2178
2331
  exports.GetChatResponseSchema = GetChatResponseSchema;
@@ -2183,6 +2336,7 @@ exports.GetGitUrlResponseSchema = GetGitUrlResponseSchema;
2183
2336
  exports.GetInstallUrlResponseSchema = GetInstallUrlResponseSchema;
2184
2337
  exports.GetOAuthServerResponseSchema = GetOAuthServerResponseSchema;
2185
2338
  exports.GetRepositoryResponseSchema = GetRepositoryResponseSchema;
2339
+ exports.GetTaskSessionResponseSchema = GetTaskSessionResponseSchema;
2186
2340
  exports.GetUploadUrlsRequestSchema = GetUploadUrlsRequestSchema;
2187
2341
  exports.GetUploadUrlsResponseSchema = GetUploadUrlsResponseSchema;
2188
2342
  exports.GetUserAgentsResponseSchema = GetUserAgentsResponseSchema;
@@ -2240,6 +2394,8 @@ exports.PermissionResponseRequestSchema = PermissionResponseRequestSchema;
2240
2394
  exports.PermissionResponseResponseSchema = PermissionResponseResponseSchema;
2241
2395
  exports.ProjectDirectoryResponseSchema = ProjectDirectoryResponseSchema;
2242
2396
  exports.ProjectEntrySchema = ProjectEntrySchema;
2397
+ exports.PublishDraftAgentRequestSchema = PublishDraftAgentRequestSchema;
2398
+ exports.PublishDraftAgentResponseSchema = PublishDraftAgentResponseSchema;
2243
2399
  exports.QueryEventsRequestSchema = QueryEventsRequestSchema;
2244
2400
  exports.RTC_CHUNK_HEADER_SIZE = RTC_CHUNK_HEADER_SIZE;
2245
2401
  exports.RechargeResponseSchema = RechargeResponseSchema;
@@ -2256,10 +2412,14 @@ exports.RtcIceServerSchema = RtcIceServerSchema;
2256
2412
  exports.RtcIceServersRequestSchema = RtcIceServersRequestSchema;
2257
2413
  exports.RtcIceServersResponseSchema = RtcIceServersResponseSchema;
2258
2414
  exports.RtcSignalSchema = RtcSignalSchema;
2415
+ exports.SendTaskMessageRequestSchema = SendTaskMessageRequestSchema;
2416
+ exports.SendTaskMessageResponseSchema = SendTaskMessageResponseSchema;
2259
2417
  exports.SetEnvironmentVariablesRequestSchema = SetEnvironmentVariablesRequestSchema;
2260
2418
  exports.ShareAuthQuerySchema = ShareAuthQuerySchema;
2261
2419
  exports.ShareAuthResponseSchema = ShareAuthResponseSchema;
2262
2420
  exports.ShowModalEventDataSchema = ShowModalEventDataSchema;
2421
+ exports.ShowModalRequestSchema = ShowModalRequestSchema;
2422
+ exports.ShowModalResponseSchema = ShowModalResponseSchema;
2263
2423
  exports.ShutdownMachineSchema = ShutdownMachineSchema;
2264
2424
  exports.SignatureAuthRequestSchema = SignatureAuthRequestSchema;
2265
2425
  exports.SignatureAuthResponseSchema = SignatureAuthResponseSchema;
@@ -2270,6 +2430,7 @@ exports.StatsQuerySchema = StatsQuerySchema;
2270
2430
  exports.StopTaskRequestSchema = StopTaskRequestSchema;
2271
2431
  exports.StopTaskResponseSchema = StopTaskResponseSchema;
2272
2432
  exports.StopTaskSchema = StopTaskSchema;
2433
+ exports.SubTaskCompletedEventSchema = SubTaskCompletedEventSchema;
2273
2434
  exports.SyncCloudMachineResponseSchema = SyncCloudMachineResponseSchema;
2274
2435
  exports.SyncLocalMachineResponseSchema = SyncLocalMachineResponseSchema;
2275
2436
  exports.SyncMachineRequestSchema = SyncMachineRequestSchema;
@@ -2281,6 +2442,7 @@ exports.TaskItemSchema = TaskItemSchema;
2281
2442
  exports.TaskMessageSchema = TaskMessageSchema;
2282
2443
  exports.TaskSharePermissionsSchema = TaskSharePermissionsSchema;
2283
2444
  exports.TaskStateChangeEventSchema = TaskStateChangeEventSchema;
2445
+ exports.TaskStoppedEventSchema = TaskStoppedEventSchema;
2284
2446
  exports.TaskTransactionsResponseSchema = TaskTransactionsResponseSchema;
2285
2447
  exports.ToggleOAuthServerRequestSchema = ToggleOAuthServerRequestSchema;
2286
2448
  exports.ToggleOAuthServerResponseSchema = ToggleOAuthServerResponseSchema;