@agentrix/shared 2.0.3 → 2.0.5

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
@@ -207,6 +207,8 @@ const StartTaskRequestSchema = zod.z.object({
207
207
  // base64 sealed-box payload for local machines
208
208
  cwd: zod.z.string().optional(),
209
209
  // For local mode: current working directory
210
+ forceUserCwd: zod.z.boolean().optional(),
211
+ // For local mode: force using user-provided cwd (no worktree)
210
212
  machineId: zod.z.string().optional(),
211
213
  // For local mode: specific machine
212
214
  cloudId: zod.z.string().optional(),
@@ -247,6 +249,7 @@ const StartTaskResponseSchema = zod.z.object({
247
249
  baseBranch: zod.z.string().nullable(),
248
250
  title: zod.z.string().nullable(),
249
251
  userCwd: zod.z.string().nullable(),
252
+ forceUserCwd: zod.z.boolean().nullable(),
250
253
  createdAt: DateSchema,
251
254
  updatedAt: DateSchema
252
255
  });
@@ -272,6 +275,8 @@ const TaskItemSchema = zod.z.object({
272
275
  // Current working directory from CLI worker
273
276
  userCwd: zod.z.string().nullable(),
274
277
  // User-provided working directory for local mode
278
+ forceUserCwd: zod.z.boolean().nullable(),
279
+ // Force using user-provided cwd (no worktree)
275
280
  repositorySourceType: zod.z.enum(["temporary", "directory", "git-server"]).nullable(),
276
281
  // Repository source type
277
282
  pullRequestNumber: zod.z.number().nullable(),
@@ -388,9 +393,11 @@ const ProjectDirectoryResponseSchema = zod.z.object({
388
393
  const QueryEventsRequestSchema = zod.z.object({
389
394
  limit: zod.z.coerce.number().min(1).max(100).optional(),
390
395
  offset: zod.z.coerce.number().min(0).optional(),
391
- before: zod.z.string().datetime().optional(),
392
- after: zod.z.string().datetime().optional(),
393
- eventType: zod.z.enum(["task-message", "task-artifacts-updated"]).optional()
396
+ before: zod.z.coerce.number().int().min(0).optional(),
397
+ after: zod.z.coerce.number().int().min(0).optional()
398
+ });
399
+ const FillEventsRequestSchema = zod.z.object({
400
+ sequences: zod.z.array(zod.z.coerce.number().int().min(0)).min(1)
394
401
  });
395
402
  const CreateMergeRequestSchema = zod.z.object({
396
403
  taskId: zod.z.string(),
@@ -487,8 +494,16 @@ const CreateChatRequestSchema = zod.z.object({
487
494
  members: zod.z.array(ChatMemberInputSchema)
488
495
  });
489
496
  const CreateChatResponseSchema = ChatWithMembersSchema;
497
+ const ListChatsQuerySchema = zod.z.object({
498
+ before: zod.z.string().optional(),
499
+ // ISO 8601 string
500
+ after: zod.z.string().optional(),
501
+ // ISO 8601 string
502
+ limit: zod.z.coerce.number().min(1).max(200).optional()
503
+ });
490
504
  const ListChatsResponseSchema = zod.z.object({
491
- chats: zod.z.array(ChatWithMembersSchema)
505
+ chats: zod.z.array(ChatWithMembersSchema),
506
+ hasMore: zod.z.boolean()
492
507
  });
493
508
  const GetChatResponseSchema = ChatWithMembersSchema;
494
509
  const ListChatMembersResponseSchema = zod.z.object({
@@ -591,23 +606,20 @@ const DeleteAgentResponseSchema = zod.z.object({
591
606
  message: zod.z.string(),
592
607
  agentId: IdSchema
593
608
  });
594
- const DeploymentVariableSchema = zod.z.object({
609
+ const EnvironmentVariableSchema = zod.z.object({
595
610
  name: zod.z.string(),
596
611
  type: zod.z.enum(["string", "number", "boolean", "secret"]),
597
612
  description: zod.z.string().optional(),
598
613
  required: zod.z.boolean().default(false),
599
614
  defaultValue: zod.z.string().optional()
600
615
  });
601
- const AgentBuilderConfigSchema = zod.z.object({
602
- // UI messages (moved from top-level Agent fields)
603
- guildMsg: zod.z.string().default("what can I do for you today?"),
604
- placeholderMsg: zod.z.string().default("Ask me anything..."),
605
- // Deployment configuration (from CLI envVars)
606
- deploymentSchema: zod.z.array(DeploymentVariableSchema).optional(),
616
+ const DraftAgentConfigSchema = zod.z.object({
617
+ // environment configuration (from CLI envVars)
618
+ environmentSchema: zod.z.array(EnvironmentVariableSchema).optional(),
607
619
  // Display configuration (same as AgentCustomConfig)
608
620
  displayConfig: DisplayConfigSchema.optional()
609
621
  });
610
- const CreateAgentBuilderRequestSchema = zod.z.object({
622
+ const CreateDraftAgentRequestSchema = zod.z.object({
611
623
  name: zod.z.string().min(1, "Name is required"),
612
624
  agentDir: zod.z.string().min(1, "Agent directory is required"),
613
625
  type: AgentTypeSchema.default("claude"),
@@ -615,10 +627,21 @@ const CreateAgentBuilderRequestSchema = zod.z.object({
615
627
  description: zod.z.string().optional(),
616
628
  userId: zod.z.string(),
617
629
  taskId: zod.z.string(),
618
- envVars: zod.z.array(DeploymentVariableSchema).optional()
630
+ envVars: zod.z.array(EnvironmentVariableSchema).optional(),
619
631
  // From CLI tool
632
+ isUpdate: zod.z.boolean().optional().default(false).describe("Whether is agent updated")
620
633
  });
621
- const AgentBuilderSchema = zod.z.object({
634
+ const SetEnvironmentVariablesRequestSchema = zod.z.object({
635
+ ownerType: zod.z.enum(["draft-agent", "agent", "machine", "cloud"]),
636
+ ownerId: zod.z.string(),
637
+ variables: zod.z.record(zod.z.string(), zod.z.string())
638
+ // { name: value }
639
+ });
640
+ const GetEnvironmentVariablesResponseSchema = zod.z.object({
641
+ variables: zod.z.record(zod.z.string(), zod.z.string())
642
+ // { name: value }
643
+ });
644
+ const DraftAgentSchema = zod.z.object({
622
645
  id: IdSchema,
623
646
  name: zod.z.string(),
624
647
  displayName: zod.z.string(),
@@ -628,7 +651,7 @@ const AgentBuilderSchema = zod.z.object({
628
651
  userId: zod.z.string(),
629
652
  description: zod.z.string().nullable(),
630
653
  enable: zod.z.boolean(),
631
- config: AgentBuilderConfigSchema.nullable(),
654
+ config: DraftAgentConfigSchema.nullable(),
632
655
  permissions: AgentPermissionsSchema.nullable(),
633
656
  publishedAgentId: zod.z.string().nullable(),
634
657
  sourceTaskId: zod.z.string().nullable(),
@@ -638,8 +661,8 @@ const AgentBuilderSchema = zod.z.object({
638
661
  const GetUserAgentsResponseSchema = zod.z.object({
639
662
  agents: zod.z.array(AgentSchema),
640
663
  // Published agents
641
- builders: zod.z.array(AgentBuilderSchema)
642
- // Draft agent-builders
664
+ draftAgents: zod.z.array(DraftAgentSchema)
665
+ // Draft agents
643
666
  });
644
667
 
645
668
  const LocalMachineSchema = zod.z.object({
@@ -1004,7 +1027,7 @@ const RpcCallEventSchema = zod.z.object({
1004
1027
  taskId: zod.z.string(),
1005
1028
  method: zod.z.enum(["GET", "POST", "PATCH", "DELETE"]),
1006
1029
  path: zod.z.string(),
1007
- // API path, e.g., "/v1/agent-builder"
1030
+ // API path, e.g., "/v1/draft-agent"
1008
1031
  query: zod.z.record(zod.z.any()).optional(),
1009
1032
  // Query params for GET requests
1010
1033
  body: zod.z.any().optional()
@@ -1051,14 +1074,27 @@ const AskUserResponseMessageSchema = zod.z.object({
1051
1074
  status: AskUserResponseStatusSchema.optional(),
1052
1075
  reason: AskUserResponseReasonSchema.optional()
1053
1076
  });
1077
+ const TaskArtifactsMessageSchema = zod.z.object({
1078
+ type: zod.z.literal("task_artifacts_updated"),
1079
+ commitHash: zod.z.string(),
1080
+ timestamp: zod.z.string(),
1081
+ stats: zod.z.object({
1082
+ totalInsertions: zod.z.number(),
1083
+ totalDeletions: zod.z.number(),
1084
+ files: zod.z.array(FileStatsSchema)
1085
+ })
1086
+ });
1054
1087
  function isAskUserMessage(message) {
1055
1088
  return typeof message === "object" && message !== null && "type" in message && message.type === "ask_user";
1056
1089
  }
1057
1090
  function isAskUserResponseMessage(message) {
1058
1091
  return typeof message === "object" && message !== null && "type" in message && message.type === "ask_user_response";
1059
1092
  }
1093
+ function isTaskArtifactsMessage(message) {
1094
+ return typeof message === "object" && message !== null && "type" in message && message.type === "task_artifacts_updated";
1095
+ }
1060
1096
  function isSDKMessage(message) {
1061
- return typeof message === "object" && message !== null && "type" in message && message.type !== "ask_user" && message.type !== "ask_user_response";
1097
+ return typeof message === "object" && message !== null && "type" in message && message.type !== "ask_user" && message.type !== "ask_user_response" && message.type !== "task_artifacts_updated";
1062
1098
  }
1063
1099
  const EventBaseSchema = zod.z.object({
1064
1100
  eventId: zod.z.string()
@@ -1135,13 +1171,15 @@ const baseTaskSchema = EventBaseSchema.extend({
1135
1171
  agentId: zod.z.string(),
1136
1172
  agentType: zod.z.string().optional().default("claude"),
1137
1173
  agentDir: zod.z.string().optional(),
1138
- // Absolute path to agent directory (only for agent-builders)
1174
+ // Absolute path to agent directory (only for draft agents)
1139
1175
  gitUrl: zod.z.string().optional(),
1140
1176
  baseBranch: zod.z.string().optional(),
1141
1177
  cwd: zod.z.string().optional(),
1142
1178
  // Current working directory for the task, only used under 'local' mode
1143
1179
  userCwd: zod.z.string().optional(),
1144
1180
  // User-provided working directory for local mode
1181
+ forceUserCwd: zod.z.boolean().optional(),
1182
+ // Force using user-provided cwd (no worktree)
1145
1183
  dataEncryptionKey: zod.z.string().optional(),
1146
1184
  // User's public key for encrypting sensitive data
1147
1185
  model: zod.z.string().optional(),
@@ -1156,8 +1194,10 @@ const baseTaskSchema = EventBaseSchema.extend({
1156
1194
  // Maximum number of turns for the agent (default: 50)
1157
1195
  repositoryId: zod.z.string().optional(),
1158
1196
  // Existing repository ID (used to skip auto-association)
1159
- repositorySourceType: zod.z.enum(["temporary", "directory", "git-server"]).optional()
1197
+ repositorySourceType: zod.z.enum(["temporary", "directory", "git-server"]).optional(),
1160
1198
  // Repository source type (determines workspace mode)
1199
+ environmentVariables: zod.z.record(zod.z.string(), zod.z.string()).optional()
1200
+ // Environment variables for task execution
1161
1201
  });
1162
1202
  const createTaskSchema = baseTaskSchema.extend({
1163
1203
  message: zod.z.custom(
@@ -1206,9 +1246,11 @@ const StopTaskSchema = EventBaseSchema.extend({
1206
1246
  });
1207
1247
  const TaskMessageSchema = EventBaseSchema.extend({
1208
1248
  taskId: zod.z.string(),
1249
+ chatId: zod.z.string().optional(),
1209
1250
  from: zod.z.enum(["app", "api-server", "machine", "worker"]),
1210
1251
  opCode: zod.z.string().optional(),
1211
1252
  // eventId of the message this is responding to (e.g., ask_user_response → ask_user)
1253
+ sequence: zod.z.number().int().min(0).optional(),
1212
1254
  message: zod.z.custom(
1213
1255
  (data) => {
1214
1256
  return typeof data === "object" && data !== null && "type" in data;
@@ -1229,14 +1271,21 @@ const TaskMessageSchema = EventBaseSchema.extend({
1229
1271
  );
1230
1272
  const TaskArtifactsUpdatedEventSchema = EventBaseSchema.extend({
1231
1273
  taskId: zod.z.string(),
1232
- commitHash: zod.z.string(),
1233
- timestamp: zod.z.string(),
1234
1274
  stats: zod.z.object({
1235
1275
  totalInsertions: zod.z.number(),
1236
- totalDeletions: zod.z.number(),
1237
- files: zod.z.array(FileStatsSchema)
1276
+ totalDeletions: zod.z.number()
1238
1277
  })
1239
1278
  });
1279
+ const ShowModalEventDataSchema = EventBaseSchema.extend({
1280
+ taskId: zod.z.string(),
1281
+ chatId: zod.z.string().optional(),
1282
+ sequence: zod.z.number().int().min(0).optional(),
1283
+ timestamp: zod.z.string(),
1284
+ modalName: zod.z.string(),
1285
+ // e.g., "configure-env-vars"
1286
+ modalData: zod.z.record(zod.z.any())
1287
+ // Modal-specific data
1288
+ });
1240
1289
  const ChangeTaskTitleEventSchema = EventBaseSchema.extend({
1241
1290
  taskId: zod.z.string(),
1242
1291
  title: zod.z.string()
@@ -1390,7 +1439,7 @@ const SystemMessageSchema = EventBaseSchema.extend({
1390
1439
  "repo-added",
1391
1440
  "repo-removed",
1392
1441
  "pr-state-changed",
1393
- "agent-builder-added"
1442
+ "draft-agent-added"
1394
1443
  ]),
1395
1444
  data: zod.z.union([
1396
1445
  IdOnlySchema,
@@ -1405,8 +1454,8 @@ const SystemMessageSchema = EventBaseSchema.extend({
1405
1454
  // repo-added
1406
1455
  PrStateChangedSchema,
1407
1456
  // pr-state-changed
1408
- AgentBuilderSchema
1409
- // agent-builder-added
1457
+ DraftAgentSchema
1458
+ // draft-agent-added
1410
1459
  ]),
1411
1460
  timestamp: zod.z.string()
1412
1461
  });
@@ -1436,6 +1485,8 @@ const EventSchemaMap = {
1436
1485
  "task-info-update": TaskInfoUpdateEventDataSchema,
1437
1486
  // Artifacts events
1438
1487
  "task-artifacts-updated": TaskArtifactsUpdatedEventSchema,
1488
+ // Modal events
1489
+ "show-modal": ShowModalEventDataSchema,
1439
1490
  // Merge request events
1440
1491
  "merge-request": MergeRequestEventSchema,
1441
1492
  "merge-pr": MergePullRequestEventSchema,
@@ -2047,8 +2098,6 @@ function splitRtcChunkFrame(data) {
2047
2098
 
2048
2099
  exports.AddChatMemberRequestSchema = AddChatMemberRequestSchema;
2049
2100
  exports.AddChatMemberResponseSchema = AddChatMemberResponseSchema;
2050
- exports.AgentBuilderConfigSchema = AgentBuilderConfigSchema;
2051
- exports.AgentBuilderSchema = AgentBuilderSchema;
2052
2101
  exports.AgentConfigValidationError = AgentConfigValidationError;
2053
2102
  exports.AgentCustomConfigSchema = AgentCustomConfigSchema;
2054
2103
  exports.AgentError = AgentError;
@@ -2094,13 +2143,13 @@ exports.CloudSchema = CloudSchema;
2094
2143
  exports.ConfirmUploadRequestSchema = ConfirmUploadRequestSchema;
2095
2144
  exports.ConfirmUploadResponseSchema = ConfirmUploadResponseSchema;
2096
2145
  exports.ConsumeTransactionSchema = ConsumeTransactionSchema;
2097
- exports.CreateAgentBuilderRequestSchema = CreateAgentBuilderRequestSchema;
2098
2146
  exports.CreateAgentRequestSchema = CreateAgentRequestSchema;
2099
2147
  exports.CreateAgentResponseSchema = CreateAgentResponseSchema;
2100
2148
  exports.CreateChatRequestSchema = CreateChatRequestSchema;
2101
2149
  exports.CreateChatResponseSchema = CreateChatResponseSchema;
2102
2150
  exports.CreateCloudRequestSchema = CreateCloudRequestSchema;
2103
2151
  exports.CreateCloudResponseSchema = CreateCloudResponseSchema;
2152
+ exports.CreateDraftAgentRequestSchema = CreateDraftAgentRequestSchema;
2104
2153
  exports.CreateMergeRequestResponseSchema = CreateMergeRequestResponseSchema;
2105
2154
  exports.CreateMergeRequestSchema = CreateMergeRequestSchema;
2106
2155
  exports.CreateOAuthServerRequestSchema = CreateOAuthServerRequestSchema;
@@ -2112,18 +2161,22 @@ exports.CreditsPackageSchema = CreditsPackageSchema;
2112
2161
  exports.DateSchema = DateSchema;
2113
2162
  exports.DeleteAgentResponseSchema = DeleteAgentResponseSchema;
2114
2163
  exports.DeleteOAuthServerResponseSchema = DeleteOAuthServerResponseSchema;
2115
- exports.DeploymentVariableSchema = DeploymentVariableSchema;
2116
2164
  exports.DisplayConfigKeysSchema = DisplayConfigKeysSchema;
2117
2165
  exports.DisplayConfigSchema = DisplayConfigSchema;
2166
+ exports.DraftAgentConfigSchema = DraftAgentConfigSchema;
2167
+ exports.DraftAgentSchema = DraftAgentSchema;
2168
+ exports.EnvironmentVariableSchema = EnvironmentVariableSchema;
2118
2169
  exports.EventAckSchema = EventAckSchema;
2119
2170
  exports.EventSchemaMap = EventSchemaMap;
2120
2171
  exports.FRAMEWORK_TYPES = FRAMEWORK_TYPES;
2121
2172
  exports.FileItemSchema = FileItemSchema;
2122
2173
  exports.FileStatsSchema = FileStatsSchema;
2123
2174
  exports.FileVisibilitySchema = FileVisibilitySchema;
2175
+ exports.FillEventsRequestSchema = FillEventsRequestSchema;
2124
2176
  exports.FrameworkNotSupportedError = FrameworkNotSupportedError;
2125
2177
  exports.GetAgentResponseSchema = GetAgentResponseSchema;
2126
2178
  exports.GetChatResponseSchema = GetChatResponseSchema;
2179
+ exports.GetEnvironmentVariablesResponseSchema = GetEnvironmentVariablesResponseSchema;
2127
2180
  exports.GetGitServerResponseSchema = GetGitServerResponseSchema;
2128
2181
  exports.GetGitUrlQuerySchema = GetGitUrlQuerySchema;
2129
2182
  exports.GetGitUrlResponseSchema = GetGitUrlResponseSchema;
@@ -2141,6 +2194,7 @@ exports.ListAgentsResponseSchema = ListAgentsResponseSchema;
2141
2194
  exports.ListBranchesResponseSchema = ListBranchesResponseSchema;
2142
2195
  exports.ListChatMembersResponseSchema = ListChatMembersResponseSchema;
2143
2196
  exports.ListChatTasksResponseSchema = ListChatTasksResponseSchema;
2197
+ exports.ListChatsQuerySchema = ListChatsQuerySchema;
2144
2198
  exports.ListChatsResponseSchema = ListChatsResponseSchema;
2145
2199
  exports.ListFilesQuerySchema = ListFilesQuerySchema;
2146
2200
  exports.ListFilesResponseSchema = ListFilesResponseSchema;
@@ -2202,8 +2256,10 @@ exports.RtcIceServerSchema = RtcIceServerSchema;
2202
2256
  exports.RtcIceServersRequestSchema = RtcIceServersRequestSchema;
2203
2257
  exports.RtcIceServersResponseSchema = RtcIceServersResponseSchema;
2204
2258
  exports.RtcSignalSchema = RtcSignalSchema;
2259
+ exports.SetEnvironmentVariablesRequestSchema = SetEnvironmentVariablesRequestSchema;
2205
2260
  exports.ShareAuthQuerySchema = ShareAuthQuerySchema;
2206
2261
  exports.ShareAuthResponseSchema = ShareAuthResponseSchema;
2262
+ exports.ShowModalEventDataSchema = ShowModalEventDataSchema;
2207
2263
  exports.ShutdownMachineSchema = ShutdownMachineSchema;
2208
2264
  exports.SignatureAuthRequestSchema = SignatureAuthRequestSchema;
2209
2265
  exports.SignatureAuthResponseSchema = SignatureAuthResponseSchema;
@@ -2218,6 +2274,7 @@ exports.SyncCloudMachineResponseSchema = SyncCloudMachineResponseSchema;
2218
2274
  exports.SyncLocalMachineResponseSchema = SyncLocalMachineResponseSchema;
2219
2275
  exports.SyncMachineRequestSchema = SyncMachineRequestSchema;
2220
2276
  exports.SystemMessageSchema = SystemMessageSchema;
2277
+ exports.TaskArtifactsMessageSchema = TaskArtifactsMessageSchema;
2221
2278
  exports.TaskArtifactsUpdatedEventSchema = TaskArtifactsUpdatedEventSchema;
2222
2279
  exports.TaskInfoUpdateEventDataSchema = TaskInfoUpdateEventDataSchema;
2223
2280
  exports.TaskItemSchema = TaskItemSchema;
@@ -2285,6 +2342,7 @@ exports.getRandomBytes = getRandomBytes;
2285
2342
  exports.isAskUserMessage = isAskUserMessage;
2286
2343
  exports.isAskUserResponseMessage = isAskUserResponseMessage;
2287
2344
  exports.isSDKMessage = isSDKMessage;
2345
+ exports.isTaskArtifactsMessage = isTaskArtifactsMessage;
2288
2346
  exports.loadAgentConfig = loadAgentConfig;
2289
2347
  exports.machineAuth = machineAuth;
2290
2348
  exports.permissionResponseRequestSchema = permissionResponseRequestSchema;