robotrock 1.3.4 → 1.4.0

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.
Files changed (80) hide show
  1. package/README.md +11 -1
  2. package/dist/agent-admin.d.ts +5 -0
  3. package/dist/agent-admin.js +75 -2
  4. package/dist/agent-admin.js.map +1 -1
  5. package/dist/ai/index.d.ts +5 -5
  6. package/dist/ai/index.js +120 -4
  7. package/dist/ai/index.js.map +1 -1
  8. package/dist/ai/trigger.d.ts +3 -3
  9. package/dist/ai/trigger.js +120 -4
  10. package/dist/ai/trigger.js.map +1 -1
  11. package/dist/ai/workflow.d.ts +3 -3
  12. package/dist/ai/workflow.js +120 -4
  13. package/dist/ai/workflow.js.map +1 -1
  14. package/dist/{client-CZ5eWH5v.d.ts → client-BxbxttFH.d.ts} +19 -1
  15. package/dist/eve/agent/index.d.ts +4 -4
  16. package/dist/eve/agent/index.js +565 -261
  17. package/dist/eve/agent/index.js.map +1 -1
  18. package/dist/eve/index.d.ts +4 -4
  19. package/dist/eve/index.js +384 -7
  20. package/dist/eve/index.js.map +1 -1
  21. package/dist/eve/tools/admin/assign-tasks.d.ts +40 -19
  22. package/dist/eve/tools/admin/assign-tasks.js +322 -25
  23. package/dist/eve/tools/admin/assign-tasks.js.map +1 -1
  24. package/dist/eve/tools/admin/get-workspace-usage.d.ts +71 -0
  25. package/dist/eve/tools/admin/get-workspace-usage.js +1353 -0
  26. package/dist/eve/tools/admin/get-workspace-usage.js.map +1 -0
  27. package/dist/eve/tools/admin/manage-groups.d.ts +122 -7
  28. package/dist/eve/tools/admin/manage-groups.js +338 -31
  29. package/dist/eve/tools/admin/manage-groups.js.map +1 -1
  30. package/dist/eve/tools/admin/manage-team-members.d.ts +86 -7
  31. package/dist/eve/tools/admin/manage-team-members.js +306 -16
  32. package/dist/eve/tools/admin/manage-team-members.js.map +1 -1
  33. package/dist/eve/tools/admin/query-tasks.d.ts +85 -10
  34. package/dist/eve/tools/admin/query-tasks.js +351 -40
  35. package/dist/eve/tools/admin/query-tasks.js.map +1 -1
  36. package/dist/eve/tools/catalog/generate-image.d.ts +64 -0
  37. package/dist/eve/tools/catalog/generate-image.js +2065 -0
  38. package/dist/eve/tools/catalog/generate-image.js.map +1 -0
  39. package/dist/eve/tools/catalog/generate-random-chart.d.ts +71 -0
  40. package/dist/eve/tools/catalog/generate-random-chart.js +372 -0
  41. package/dist/eve/tools/catalog/generate-random-chart.js.map +1 -0
  42. package/dist/eve/tools/catalog/search-products.d.ts +36 -43
  43. package/dist/eve/tools/catalog/search-products.js +241 -6
  44. package/dist/eve/tools/catalog/search-products.js.map +1 -1
  45. package/dist/eve/tools/identity/index.d.ts +2 -1
  46. package/dist/eve/tools/identity/index.js +26 -6
  47. package/dist/eve/tools/identity/index.js.map +1 -1
  48. package/dist/eve/tools/identity/my-access.d.ts +90 -5
  49. package/dist/eve/tools/identity/my-access.js +26 -6
  50. package/dist/eve/tools/identity/my-access.js.map +1 -1
  51. package/dist/eve/tools/identity/whoami.d.ts +1 -1
  52. package/dist/eve/tools/identity/whoami.js.map +1 -1
  53. package/dist/eve/tools/inbox/create-task.d.ts +1 -1
  54. package/dist/eve/tools/inbox/create-task.js +119 -2
  55. package/dist/eve/tools/inbox/create-task.js.map +1 -1
  56. package/dist/eve/tools/inbox/index.d.ts +1 -1
  57. package/dist/eve/tools/inbox/index.js +119 -2
  58. package/dist/eve/tools/inbox/index.js.map +1 -1
  59. package/dist/eve/tools/index.d.ts +5 -2
  60. package/dist/eve/tools/index.js +908 -115
  61. package/dist/eve/tools/index.js.map +1 -1
  62. package/dist/index-Drj0Rzf_.d.ts +905 -0
  63. package/dist/index.d.ts +5 -5
  64. package/dist/index.js +316 -13
  65. package/dist/index.js.map +1 -1
  66. package/dist/schemas/index.js +67 -1
  67. package/dist/schemas/index.js.map +1 -1
  68. package/dist/{tool-approval-bridge-DnGaRES4.d.ts → tool-approval-bridge-Cz7qQUpw.d.ts} +1 -1
  69. package/dist/{tool-reply-guidance-C3qrT1In.d.ts → tool-reply-guidance-CJko9liH.d.ts} +5 -2
  70. package/dist/tool-result-ui-meta-KT0VafEO.d.ts +52 -0
  71. package/dist/trigger/index.d.ts +1 -1
  72. package/dist/trigger/index.js +118 -2
  73. package/dist/trigger/index.js.map +1 -1
  74. package/dist/{trigger--qTIK0s6.d.ts → trigger-C1ooSegc.d.ts} +2 -2
  75. package/dist/workflow/index.d.ts +1 -1
  76. package/dist/workflow/index.js +118 -2
  77. package/dist/workflow/index.js.map +1 -1
  78. package/package.json +21 -4
  79. package/dist/index-Blq0XoAr.d.ts +0 -204
  80. package/dist/tool-ui-hint-CMpug5sC.d.ts +0 -13
@@ -1,12 +1,11 @@
1
1
  import * as eve_tools from 'eve/tools';
2
- import { T as ToolResultWithReplyGuidance } from '../../../tool-reply-guidance-C3qrT1In.js';
3
2
  import { z } from 'zod';
4
3
 
5
4
  declare const QUERY_TASKS_TOOL_NAME = "query_tasks";
6
5
  declare const queryTasksInputSchema: z.ZodObject<{
7
6
  action: z.ZodEnum<{
8
- list: "list";
9
7
  search: "search";
8
+ list: "list";
10
9
  get: "get";
11
10
  }>;
12
11
  statusFilter: z.ZodOptional<z.ZodEnum<{
@@ -33,7 +32,7 @@ declare const queryTasksInputSchema: z.ZodObject<{
33
32
  query: z.ZodOptional<z.ZodString>;
34
33
  }, z.core.$strip>;
35
34
  declare function defineQueryTasksTool(): eve_tools.ToolDefinition<{
36
- action: "list" | "search" | "get";
35
+ action: "search" | "list" | "get";
37
36
  statusFilter?: "open" | "all" | "handled" | "expired" | undefined;
38
37
  typeFilter?: string | undefined;
39
38
  appFilter?: string | undefined;
@@ -43,14 +42,52 @@ declare function defineQueryTasksTool(): eve_tools.ToolDefinition<{
43
42
  cursor?: string | undefined;
44
43
  taskId?: string | undefined;
45
44
  query?: string | undefined;
46
- }, ToolResultWithReplyGuidance<Record<string, unknown>> | {
45
+ }, {
47
46
  ok: false;
48
- status: number;
49
47
  message: string;
50
- response: unknown;
48
+ status?: number | undefined;
49
+ response?: unknown;
50
+ } | {
51
+ items: {
52
+ id: string;
53
+ name: string;
54
+ status: string;
55
+ type: string | null;
56
+ description: string | null;
57
+ validUntil: number;
58
+ createdAt: number;
59
+ url: string;
60
+ threadPriority?: string | null | undefined;
61
+ }[];
62
+ nextCursor?: string | null | undefined;
63
+ replyGuidance?: string | undefined;
64
+ ui?: {
65
+ present?: boolean | undefined;
66
+ entity?: string | undefined;
67
+ rowsPath?: string | undefined;
68
+ layout?: "list" | "chart" | "table" | undefined;
69
+ } | undefined;
70
+ uiHint?: "list" | "chart" | "table" | undefined;
71
+ } | {
72
+ id: string | null;
73
+ status: string | null;
74
+ type: string | null;
75
+ name: string | null;
76
+ description: string | null;
77
+ validUntil: number | null;
78
+ createdAt: number | null;
79
+ url: string | null;
80
+ replyGuidance?: string | undefined;
81
+ ui?: {
82
+ present?: boolean | undefined;
83
+ entity?: string | undefined;
84
+ rowsPath?: string | undefined;
85
+ layout?: "list" | "chart" | "table" | undefined;
86
+ } | undefined;
87
+ uiHint?: "list" | "chart" | "table" | undefined;
51
88
  }>;
52
89
  declare const queryTasksTool: eve_tools.ToolDefinition<{
53
- action: "list" | "search" | "get";
90
+ action: "search" | "list" | "get";
54
91
  statusFilter?: "open" | "all" | "handled" | "expired" | undefined;
55
92
  typeFilter?: string | undefined;
56
93
  appFilter?: string | undefined;
@@ -60,11 +97,49 @@ declare const queryTasksTool: eve_tools.ToolDefinition<{
60
97
  cursor?: string | undefined;
61
98
  taskId?: string | undefined;
62
99
  query?: string | undefined;
63
- }, ToolResultWithReplyGuidance<Record<string, unknown>> | {
100
+ }, {
64
101
  ok: false;
65
- status: number;
66
102
  message: string;
67
- response: unknown;
103
+ status?: number | undefined;
104
+ response?: unknown;
105
+ } | {
106
+ items: {
107
+ id: string;
108
+ name: string;
109
+ status: string;
110
+ type: string | null;
111
+ description: string | null;
112
+ validUntil: number;
113
+ createdAt: number;
114
+ url: string;
115
+ threadPriority?: string | null | undefined;
116
+ }[];
117
+ nextCursor?: string | null | undefined;
118
+ replyGuidance?: string | undefined;
119
+ ui?: {
120
+ present?: boolean | undefined;
121
+ entity?: string | undefined;
122
+ rowsPath?: string | undefined;
123
+ layout?: "list" | "chart" | "table" | undefined;
124
+ } | undefined;
125
+ uiHint?: "list" | "chart" | "table" | undefined;
126
+ } | {
127
+ id: string | null;
128
+ status: string | null;
129
+ type: string | null;
130
+ name: string | null;
131
+ description: string | null;
132
+ validUntil: number | null;
133
+ createdAt: number | null;
134
+ url: string | null;
135
+ replyGuidance?: string | undefined;
136
+ ui?: {
137
+ present?: boolean | undefined;
138
+ entity?: string | undefined;
139
+ rowsPath?: string | undefined;
140
+ layout?: "list" | "chart" | "table" | undefined;
141
+ } | undefined;
142
+ uiHint?: "list" | "chart" | "table" | undefined;
68
143
  }>;
69
144
 
70
145
  export { QUERY_TASKS_TOOL_NAME, defineQueryTasksTool, queryTasksInputSchema, queryTasksTool };
@@ -1,6 +1,6 @@
1
1
  // src/eve/tools/admin/query-tasks.ts
2
2
  import { defineTool } from "eve/tools";
3
- import { z as z5 } from "zod";
3
+ import { z as z6 } from "zod";
4
4
 
5
5
  // src/http.ts
6
6
  var RobotRockError = class extends Error {
@@ -493,6 +493,40 @@ var agentChatLinkTaskBodySchema = z.object({
493
493
  publicTaskId: z.string().min(1),
494
494
  toolCallId: z.string().min(1)
495
495
  });
496
+ var AGENT_FILE_TAGS_MAX = 20;
497
+ var AGENT_FILE_TAG_MAX_LENGTH = 64;
498
+ function normalizeAgentFileTags(tags) {
499
+ if (!tags?.length) return void 0;
500
+ const seen = /* @__PURE__ */ new Set();
501
+ const out = [];
502
+ for (const raw of tags) {
503
+ const tag = raw.trim().toLowerCase().slice(0, AGENT_FILE_TAG_MAX_LENGTH);
504
+ if (!tag || seen.has(tag)) continue;
505
+ seen.add(tag);
506
+ out.push(tag);
507
+ if (out.length >= AGENT_FILE_TAGS_MAX) break;
508
+ }
509
+ return out.length > 0 ? out : void 0;
510
+ }
511
+ var agentChatUploadImageBodySchema = z.object({
512
+ mediaType: z.string().min(1),
513
+ /** Raw base64 (no data: URL prefix). */
514
+ base64: z.string().min(1),
515
+ chatId: z.string().min(1).optional(),
516
+ publicTaskId: z.string().min(1).optional(),
517
+ source: z.string().min(1).optional(),
518
+ /** Display / search name (e.g. `sunset-robot.png`). */
519
+ filename: z.string().min(1).max(255).optional(),
520
+ /** Human-readable description (e.g. generation prompt). */
521
+ description: z.string().min(1).max(2e3).optional(),
522
+ /**
523
+ * Optional labels for later grouping/filtering.
524
+ * Normalized to lowercase trimmed unique strings (max 20, 64 chars each).
525
+ */
526
+ tags: z.array(z.string().min(1).max(AGENT_FILE_TAG_MAX_LENGTH)).max(AGENT_FILE_TAGS_MAX).optional().transform((tags) => normalizeAgentFileTags(tags))
527
+ }).refine((data) => Boolean(data.chatId || data.publicTaskId), {
528
+ message: "Provide chatId and/or publicTaskId"
529
+ });
496
530
 
497
531
  // ../core/src/schemas/tool-result-display.ts
498
532
  import { z as z2 } from "zod";
@@ -521,7 +555,8 @@ var tenantRoleSchema = z3.enum(["admin", "member"]);
521
555
  var agentAdminUserSchema = z3.object({
522
556
  id: z3.string(),
523
557
  email: z3.string().email(),
524
- name: z3.string()
558
+ name: z3.string(),
559
+ profilePictureUrl: z3.string().nullable().optional()
525
560
  });
526
561
  var agentAdminMemberSchema = z3.object({
527
562
  userId: z3.string(),
@@ -606,6 +641,37 @@ var assignTasksBodySchema = z3.object({
606
641
  { message: "assignTo needs at least one user email or group slug." }
607
642
  )
608
643
  });
644
+ var agentAdminPlanLimitsSchema = z3.object({
645
+ tasksPerDay: z3.number(),
646
+ members: z3.number(),
647
+ apiKeys: z3.number(),
648
+ groups: z3.number(),
649
+ auditLogRetention: z3.number(),
650
+ rateLimitPerSecond: z3.number(),
651
+ taskRetentionDays: z3.number()
652
+ });
653
+ var agentAdminUsageSchema = z3.object({
654
+ workspace: z3.string(),
655
+ planName: z3.string(),
656
+ planType: z3.string(),
657
+ trialState: z3.enum(["none", "active", "expired"]),
658
+ daysRemaining: z3.number().nullable(),
659
+ isPaidPro: z3.boolean(),
660
+ subscriptionStatus: z3.string().nullable(),
661
+ tasksToday: z3.number(),
662
+ maxTasksPerDay: z3.number().nullable(),
663
+ tasksResetAt: z3.number(),
664
+ openTasks: z3.number(),
665
+ totalTasks: z3.number(),
666
+ seatsCurrent: z3.number(),
667
+ seatsMax: z3.number().nullable(),
668
+ groupsCurrent: z3.number(),
669
+ groupsMax: z3.number().nullable(),
670
+ apiKeysCurrent: z3.number(),
671
+ apiKeysMax: z3.number().nullable(),
672
+ rateLimitPerSecond: z3.number(),
673
+ limits: agentAdminPlanLimitsSchema
674
+ });
609
675
 
610
676
  // ../core/src/handler-retry.ts
611
677
  var HANDLER_RETRY_DELAYS_MS = [
@@ -701,7 +767,11 @@ function resolveRobotRockAuthConfig(overrides) {
701
767
  "RobotRock auth is required. Set ROBOTROCK_API_KEY, ROBOTROCK_AGENT_SERVICE_TOKEN with tenant context, or pass auth when creating the client."
702
768
  );
703
769
  }
704
- return { kind: "apiKey", apiKey };
770
+ return {
771
+ kind: "apiKey",
772
+ apiKey,
773
+ ...overrides?.actingUserId?.trim() ? { actingUserId: overrides.actingUserId.trim() } : {}
774
+ };
705
775
  }
706
776
 
707
777
  // src/eve/agent/attributes.ts
@@ -837,6 +907,9 @@ async function agentAdminFetch(config, path, init) {
837
907
  }
838
908
  function createAgentAdminApi(config) {
839
909
  return {
910
+ usage: {
911
+ get: () => agentAdminFetch(config, "/usage")
912
+ },
840
913
  members: {
841
914
  list: () => agentAdminFetch(config, "/members"),
842
915
  get: (memberRef) => agentAdminFetch(config, `/members/${encodeURIComponent(memberRef)}`),
@@ -979,6 +1052,9 @@ function requireBoundAgentAdminClient(ctx) {
979
1052
  return createBoundAgentAdminClient(ctx);
980
1053
  }
981
1054
 
1055
+ // src/eve/entity-schemas.ts
1056
+ import { z as z5 } from "zod";
1057
+
982
1058
  // src/eve/tool-ui-hint.ts
983
1059
  var TOOL_UI_HINT_FIELD = "uiHint";
984
1060
  function withUiHint(result, hint) {
@@ -988,6 +1064,211 @@ function withUiHint(result, hint) {
988
1064
  };
989
1065
  }
990
1066
 
1067
+ // src/eve/tool-result-ui-meta.ts
1068
+ var TOOL_UI_FIELD = "ui";
1069
+ var TOOL_RESULT_UI_ENTITY_ID_RE = /^[a-z][a-z0-9_]{0,63}$/;
1070
+ function withToolUi(result, ui) {
1071
+ const existing = typeof result[TOOL_UI_FIELD] === "object" && result[TOOL_UI_FIELD] !== null && !Array.isArray(result[TOOL_UI_FIELD]) ? result[TOOL_UI_FIELD] : {};
1072
+ return {
1073
+ ...result,
1074
+ [TOOL_UI_FIELD]: {
1075
+ ...existing,
1076
+ ...ui
1077
+ }
1078
+ };
1079
+ }
1080
+
1081
+ // src/eve/entity-schemas.ts
1082
+ function buildTenantTaskUrl(tenantSlug, task) {
1083
+ const q = new URLSearchParams();
1084
+ if (task.app && task.app !== "default") {
1085
+ q.set("app", task.app);
1086
+ }
1087
+ if (task.type?.trim()) {
1088
+ q.set("type", task.type.trim());
1089
+ }
1090
+ q.set("selected", task.id);
1091
+ return `/${tenantSlug}/inbox?${q.toString()}`;
1092
+ }
1093
+ var toolResultUiMetaSchema = z5.object({
1094
+ present: z5.boolean().optional(),
1095
+ entity: z5.string().regex(TOOL_RESULT_UI_ENTITY_ID_RE).optional(),
1096
+ rowsPath: z5.string().min(1).optional(),
1097
+ layout: z5.enum(["list", "chart", "table"]).optional()
1098
+ }).strict();
1099
+ var agentOnlyFields = {
1100
+ replyGuidance: z5.string().optional(),
1101
+ ui: toolResultUiMetaSchema.optional(),
1102
+ uiHint: z5.enum(["list", "chart", "table"]).optional()
1103
+ };
1104
+ function withAgentOnlyFields(shape) {
1105
+ return z5.object({
1106
+ ...shape,
1107
+ ...agentOnlyFields
1108
+ });
1109
+ }
1110
+ var productEntityRowSchema = z5.object({
1111
+ id: z5.string().min(1),
1112
+ name: z5.string().min(1),
1113
+ price: z5.number(),
1114
+ currency: z5.string().min(1),
1115
+ inStock: z5.boolean(),
1116
+ url: z5.string().min(1)
1117
+ });
1118
+ var metricPointEntityRowSchema = z5.object({
1119
+ date: z5.string().optional(),
1120
+ category: z5.string().optional(),
1121
+ label: z5.string().optional()
1122
+ }).catchall(z5.union([z5.string(), z5.number()]));
1123
+ var memberEntityRowSchema = z5.object({
1124
+ name: z5.string(),
1125
+ email: z5.string(),
1126
+ role: z5.string(),
1127
+ membershipKind: z5.string(),
1128
+ profilePictureUrl: z5.string().nullable()
1129
+ });
1130
+ var taskEntityRowSchema = z5.object({
1131
+ id: z5.string().min(1),
1132
+ name: z5.string().min(1),
1133
+ status: z5.string().min(1),
1134
+ type: z5.string().nullable(),
1135
+ description: z5.string().nullable(),
1136
+ validUntil: z5.number(),
1137
+ createdAt: z5.number(),
1138
+ url: z5.string().min(1),
1139
+ threadPriority: z5.string().nullable().optional()
1140
+ });
1141
+ var groupEntityRowSchema = z5.object({
1142
+ name: z5.string().min(1),
1143
+ slug: z5.string().min(1),
1144
+ description: z5.string().nullable(),
1145
+ memberCount: z5.number().nullable(),
1146
+ url: z5.string().min(1)
1147
+ });
1148
+ var groupDetailEntitySchema = z5.object({
1149
+ name: z5.string().min(1),
1150
+ slug: z5.string().min(1),
1151
+ description: z5.string().nullable(),
1152
+ url: z5.string().min(1),
1153
+ members: z5.array(
1154
+ z5.object({
1155
+ name: z5.string(),
1156
+ email: z5.string(),
1157
+ profilePictureUrl: z5.string().nullable()
1158
+ })
1159
+ )
1160
+ });
1161
+ var statusEntityRowSchema = z5.object({
1162
+ id: z5.string().min(1),
1163
+ name: z5.string().min(1),
1164
+ status: z5.string().min(1),
1165
+ url: z5.string().min(1),
1166
+ type: z5.string().nullable().optional(),
1167
+ description: z5.string().nullable().optional()
1168
+ });
1169
+ var agentAdminErrorResultSchema = z5.object({
1170
+ ok: z5.literal(false),
1171
+ status: z5.number().optional(),
1172
+ message: z5.string(),
1173
+ response: z5.unknown().optional()
1174
+ });
1175
+ var agentAdminMutationResultSchema = z5.object({
1176
+ ...agentOnlyFields
1177
+ }).passthrough();
1178
+ var searchProductsOutputSchema = withAgentOnlyFields({
1179
+ items: z5.array(productEntityRowSchema)
1180
+ });
1181
+ var generateRandomChartOutputSchema = withAgentOnlyFields({
1182
+ title: z5.string().min(1),
1183
+ axis: z5.enum(["time", "category"]),
1184
+ series: z5.array(metricPointEntityRowSchema)
1185
+ });
1186
+ var generateImageOutputSchema = withAgentOnlyFields({
1187
+ prompt: z5.string().min(1),
1188
+ mediaType: z5.string().min(1),
1189
+ model: z5.string().min(1),
1190
+ storageId: z5.string().min(1),
1191
+ url: z5.string().min(1),
1192
+ /** @deprecated Legacy sessions only — prefer storageId/url. */
1193
+ base64: z5.string().min(1).optional()
1194
+ });
1195
+ var manageTeamMembersListOutputSchema = withAgentOnlyFields({
1196
+ members: z5.array(memberEntityRowSchema)
1197
+ });
1198
+ var manageTeamMembersDetailOutputSchema = withAgentOnlyFields(
1199
+ memberEntityRowSchema.shape
1200
+ );
1201
+ var manageTeamMembersOutputSchema = z5.union([
1202
+ manageTeamMembersListOutputSchema,
1203
+ manageTeamMembersDetailOutputSchema,
1204
+ agentAdminMutationResultSchema,
1205
+ agentAdminErrorResultSchema
1206
+ ]);
1207
+ var manageGroupsListOutputSchema = withAgentOnlyFields({
1208
+ groups: z5.array(groupEntityRowSchema)
1209
+ });
1210
+ var manageGroupsDetailOutputSchema = withAgentOnlyFields(
1211
+ groupDetailEntitySchema.shape
1212
+ );
1213
+ var manageGroupsSummaryOutputSchema = withAgentOnlyFields(
1214
+ groupEntityRowSchema.shape
1215
+ );
1216
+ var manageGroupsOutputSchema = z5.union([
1217
+ manageGroupsListOutputSchema,
1218
+ manageGroupsDetailOutputSchema,
1219
+ manageGroupsSummaryOutputSchema,
1220
+ agentAdminMutationResultSchema,
1221
+ agentAdminErrorResultSchema
1222
+ ]);
1223
+ var queryTasksListOutputSchema = withAgentOnlyFields({
1224
+ items: z5.array(taskEntityRowSchema),
1225
+ nextCursor: z5.string().nullable().optional()
1226
+ });
1227
+ var queryTasksDetailOutputSchema = withAgentOnlyFields({
1228
+ id: z5.string().nullable(),
1229
+ status: z5.string().nullable(),
1230
+ type: z5.string().nullable(),
1231
+ name: z5.string().nullable(),
1232
+ description: z5.string().nullable(),
1233
+ validUntil: z5.number().nullable(),
1234
+ createdAt: z5.number().nullable(),
1235
+ url: z5.string().min(1).nullable()
1236
+ });
1237
+ var queryTasksOutputSchema = z5.union([
1238
+ queryTasksListOutputSchema,
1239
+ queryTasksDetailOutputSchema,
1240
+ agentAdminErrorResultSchema
1241
+ ]);
1242
+ var assignTasksOutputSchema = z5.union([
1243
+ withAgentOnlyFields({
1244
+ results: z5.array(statusEntityRowSchema)
1245
+ }),
1246
+ agentAdminErrorResultSchema
1247
+ ]);
1248
+ var workspaceUsageEntitySchema = z5.object({
1249
+ workspace: z5.string(),
1250
+ plan: z5.string(),
1251
+ planType: z5.string(),
1252
+ trialState: z5.string(),
1253
+ daysRemaining: z5.number().nullable(),
1254
+ isPaidPro: z5.boolean(),
1255
+ subscriptionStatus: z5.string(),
1256
+ tasksToday: z5.string(),
1257
+ tasksResetAt: z5.string(),
1258
+ openTasks: z5.number(),
1259
+ totalTasks: z5.number(),
1260
+ seats: z5.string(),
1261
+ groups: z5.string(),
1262
+ apiKeys: z5.string(),
1263
+ rateLimitPerSecond: z5.number()
1264
+ });
1265
+ var getWorkspaceUsageOutputSchema = z5.union([
1266
+ withAgentOnlyFields({
1267
+ usage: workspaceUsageEntitySchema
1268
+ }),
1269
+ agentAdminErrorResultSchema
1270
+ ]);
1271
+
991
1272
  // src/eve/tool-reply-guidance.ts
992
1273
  var TOOL_REPLY_GUIDANCE_FIELD = "replyGuidance";
993
1274
  var QUERY_TASKS_LIST_REPLY_GUIDANCE = "Tasks render as a list card in chat. Do not restate task names, ids, or statuses from the list. Only add context not shown (e.g. filters applied, recommended next action).";
@@ -1001,67 +1282,89 @@ function withReplyGuidance(result, guidance) {
1001
1282
 
1002
1283
  // src/eve/tool-display-format.ts
1003
1284
  function formatToolObjectResult(data, options) {
1004
- const withGuidance = withReplyGuidance(data, options.replyGuidance);
1285
+ let result = withReplyGuidance(
1286
+ data,
1287
+ options.replyGuidance
1288
+ );
1289
+ if (options.ui) {
1290
+ result = withToolUi(result, options.ui);
1291
+ }
1005
1292
  if (options.uiHint) {
1006
- return withUiHint(withGuidance, options.uiHint);
1293
+ result = withUiHint(result, options.uiHint);
1007
1294
  }
1008
- return withGuidance;
1295
+ return result;
1009
1296
  }
1010
1297
 
1011
1298
  // src/eve/tools/admin/format-tasks-list.ts
1012
1299
  function resolveTaskCardLabel(task) {
1013
1300
  return task.name?.trim() || task.description?.trim() || task.type?.trim() || task.id?.trim() || "Untitled task";
1014
1301
  }
1302
+ function serializeTaskRow(task, tenantSlug) {
1303
+ return {
1304
+ id: task.id,
1305
+ name: resolveTaskCardLabel(task),
1306
+ status: task.status,
1307
+ type: task.type,
1308
+ description: task.description,
1309
+ validUntil: task.validUntil,
1310
+ createdAt: task.createdAt,
1311
+ threadPriority: task.threadPriority,
1312
+ url: buildTenantTaskUrl(tenantSlug, {
1313
+ id: task.id,
1314
+ type: task.type
1315
+ })
1316
+ };
1317
+ }
1015
1318
  function formatTasksListResult(items, options) {
1016
1319
  const payload = {
1017
- items: items.map((task) => ({
1018
- id: task.id,
1019
- name: resolveTaskCardLabel(task),
1020
- status: task.status,
1021
- type: task.type,
1022
- description: task.description
1023
- }))
1320
+ items: items.map((task) => serializeTaskRow(task, options.tenantSlug))
1024
1321
  };
1025
- if (options?.nextCursor) {
1322
+ if (options.nextCursor) {
1026
1323
  payload.nextCursor = options.nextCursor;
1027
1324
  }
1028
1325
  return formatToolObjectResult(payload, {
1029
- replyGuidance: QUERY_TASKS_LIST_REPLY_GUIDANCE
1326
+ replyGuidance: QUERY_TASKS_LIST_REPLY_GUIDANCE,
1327
+ ui: { layout: "list", entity: "task", rowsPath: "items" }
1030
1328
  });
1031
1329
  }
1032
- function formatTaskSearchResult(items) {
1033
- return formatTasksListResult(items);
1330
+ function formatTaskSearchResult(items, options) {
1331
+ return formatTasksListResult(items, options);
1034
1332
  }
1035
- function formatTaskDetailResult(task) {
1333
+ function formatTaskDetailResult(task, options) {
1334
+ const id = typeof task.id === "string" ? task.id : null;
1335
+ const type = typeof task.type === "string" ? task.type : null;
1336
+ const url = id !== null ? buildTenantTaskUrl(options.tenantSlug, { id, type }) : null;
1036
1337
  return formatToolObjectResult(
1037
1338
  {
1038
- id: task.id ?? null,
1039
- status: task.status ?? null,
1040
- type: task.type ?? null,
1041
- name: task.name ?? null,
1042
- description: task.description ?? null,
1043
- validUntil: task.validUntil ?? null,
1044
- createdAt: task.createdAt ?? null
1339
+ id,
1340
+ status: typeof task.status === "string" ? task.status : null,
1341
+ type,
1342
+ name: typeof task.name === "string" ? task.name : null,
1343
+ description: typeof task.description === "string" ? task.description : null,
1344
+ validUntil: typeof task.validUntil === "number" ? task.validUntil : null,
1345
+ createdAt: typeof task.createdAt === "number" ? task.createdAt : null,
1346
+ url
1045
1347
  },
1046
1348
  {
1047
- replyGuidance: QUERY_TASKS_DETAIL_REPLY_GUIDANCE
1349
+ replyGuidance: QUERY_TASKS_DETAIL_REPLY_GUIDANCE,
1350
+ ui: { entity: "task" }
1048
1351
  }
1049
1352
  );
1050
1353
  }
1051
1354
 
1052
1355
  // src/eve/tools/admin/query-tasks.ts
1053
1356
  var QUERY_TASKS_TOOL_NAME = "query_tasks";
1054
- var queryTasksInputSchema = z5.object({
1055
- action: z5.enum(["list", "get", "search"]),
1056
- statusFilter: z5.enum(["all", "open", "handled", "expired"]).optional().describe("Filter by task status for list."),
1057
- typeFilter: z5.string().optional(),
1058
- appFilter: z5.string().optional(),
1059
- sortField: z5.enum(["type", "date", "status", "validUntil"]).optional(),
1060
- sortDirection: z5.enum(["asc", "desc"]).optional(),
1061
- limit: z5.number().int().positive().max(100).optional(),
1062
- cursor: z5.string().optional(),
1063
- taskId: z5.string().min(1).optional().describe("Public task id or Convex tasks table id for get."),
1064
- query: z5.string().min(1).optional().describe("Search type, name, description, or id for search.")
1357
+ var queryTasksInputSchema = z6.object({
1358
+ action: z6.enum(["list", "get", "search"]),
1359
+ statusFilter: z6.enum(["all", "open", "handled", "expired"]).optional().describe("Filter by task status for list."),
1360
+ typeFilter: z6.string().optional(),
1361
+ appFilter: z6.string().optional(),
1362
+ sortField: z6.enum(["type", "date", "status", "validUntil"]).optional(),
1363
+ sortDirection: z6.enum(["asc", "desc"]).optional(),
1364
+ limit: z6.number().int().positive().max(100).optional(),
1365
+ cursor: z6.string().optional(),
1366
+ taskId: z6.string().min(1).optional().describe("Public task id or Convex tasks table id for get."),
1367
+ query: z6.string().min(1).optional().describe("Search type, name, description, or id for search.")
1065
1368
  }).superRefine((input, ctx) => {
1066
1369
  switch (input.action) {
1067
1370
  case "get":
@@ -1086,10 +1389,13 @@ var queryTasksInputSchema = z5.object({
1086
1389
  });
1087
1390
  function defineQueryTasksTool() {
1088
1391
  return defineTool({
1089
- description: "Tenant-admin tool to list, fetch detail, or search inbox tasks in the workspace. Requires tenant admin access. Call get_my_access in the same turn before this tool to verify admin access (the check renders as its own chat tool card). Results render as chat UI cards \u2014 do not restate task names, ids, or statuses in your reply.",
1392
+ description: "Tenant-admin tool to list, fetch detail, or search inbox tasks in the workspace. Requires tenant admin access. Call get_my_access in the same turn before this tool to verify admin access (the check stays a compact success marker unless it is the only presentable result). Results render as chat UI cards \u2014 do not restate task names, ids, or statuses in your reply.",
1090
1393
  inputSchema: queryTasksInputSchema,
1394
+ outputSchema: queryTasksOutputSchema,
1091
1395
  async execute(input, ctx) {
1396
+ const caller = requireAdminCaller(ctx);
1092
1397
  const api = requireBoundAgentAdminClient(ctx);
1398
+ const tenantSlug = caller.tenantSlug;
1093
1399
  try {
1094
1400
  switch (input.action) {
1095
1401
  case "list": {
@@ -1103,17 +1409,22 @@ function defineQueryTasksTool() {
1103
1409
  cursor: input.cursor
1104
1410
  });
1105
1411
  return formatTasksListResult(result.items, {
1412
+ tenantSlug,
1106
1413
  nextCursor: result.nextCursor
1107
1414
  });
1108
1415
  }
1109
1416
  case "get": {
1110
1417
  const result = await api.tasks.get(input.taskId);
1111
- return formatTaskDetailResult(result.task);
1418
+ return formatTaskDetailResult(
1419
+ result.task,
1420
+ { tenantSlug }
1421
+ );
1112
1422
  }
1113
1423
  case "search": {
1114
1424
  const result = await api.tasks.search(input.query, input.limit);
1115
1425
  return formatTaskSearchResult(
1116
- result.items
1426
+ result.items,
1427
+ { tenantSlug }
1117
1428
  );
1118
1429
  }
1119
1430
  }