robotrock 1.3.3 → 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 (79) hide show
  1. package/README.md +32 -0
  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 +128 -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 +128 -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 +128 -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 -3
  16. package/dist/eve/agent/index.js +736 -414
  17. package/dist/eve/agent/index.js.map +1 -1
  18. package/dist/eve/index.d.ts +4 -3
  19. package/dist/eve/index.js +437 -45
  20. package/dist/eve/index.js.map +1 -1
  21. package/dist/eve/tools/admin/assign-tasks.d.ts +40 -8
  22. package/dist/eve/tools/admin/assign-tasks.js +328 -66
  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 -8
  28. package/dist/eve/tools/admin/manage-groups.js +348 -94
  29. package/dist/eve/tools/admin/manage-groups.js.map +1 -1
  30. package/dist/eve/tools/admin/manage-team-members.d.ts +86 -8
  31. package/dist/eve/tools/admin/manage-team-members.js +318 -72
  32. package/dist/eve/tools/admin/manage-team-members.js.map +1 -1
  33. package/dist/eve/tools/admin/query-tasks.d.ts +82 -8
  34. package/dist/eve/tools/admin/query-tasks.js +360 -113
  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 -44
  43. package/dist/eve/tools/catalog/search-products.js +237 -33
  44. package/dist/eve/tools/catalog/search-products.js.map +1 -1
  45. package/dist/eve/tools/identity/index.d.ts +2 -2
  46. package/dist/eve/tools/identity/index.js +35 -44
  47. package/dist/eve/tools/identity/index.js.map +1 -1
  48. package/dist/eve/tools/identity/my-access.d.ts +90 -6
  49. package/dist/eve/tools/identity/my-access.js +35 -44
  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 +932 -288
  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 -4
  64. package/dist/index.js +335 -20
  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-DePyAbTI.d.ts +0 -203
@@ -1,6 +1,4 @@
1
1
  import * as eve_tools from 'eve/tools';
2
- import { T as ToolResultWithReplyGuidance } from '../../../tool-reply-guidance-C3qrT1In.js';
3
- import * as _robotrock_core from '@robotrock/core';
4
2
  import { z } from 'zod';
5
3
 
6
4
  declare const QUERY_TASKS_TOOL_NAME = "query_tasks";
@@ -44,11 +42,49 @@ declare function defineQueryTasksTool(): eve_tools.ToolDefinition<{
44
42
  cursor?: string | undefined;
45
43
  taskId?: string | undefined;
46
44
  query?: string | undefined;
47
- }, ToolResultWithReplyGuidance<_robotrock_core.ToolDisplayEnvelope<Record<string, unknown>>> | {
45
+ }, {
48
46
  ok: false;
49
- status: number;
50
47
  message: string;
51
- 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;
52
88
  }>;
53
89
  declare const queryTasksTool: eve_tools.ToolDefinition<{
54
90
  action: "search" | "list" | "get";
@@ -61,11 +97,49 @@ declare const queryTasksTool: eve_tools.ToolDefinition<{
61
97
  cursor?: string | undefined;
62
98
  taskId?: string | undefined;
63
99
  query?: string | undefined;
64
- }, ToolResultWithReplyGuidance<_robotrock_core.ToolDisplayEnvelope<Record<string, unknown>>> | {
100
+ }, {
65
101
  ok: false;
66
- status: number;
67
102
  message: string;
68
- 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;
69
143
  }>;
70
144
 
71
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,20 +1052,223 @@ function requireBoundAgentAdminClient(ctx) {
979
1052
  return createBoundAgentAdminClient(ctx);
980
1053
  }
981
1054
 
982
- // src/eve/tool-result-display.ts
983
- function toolDisplayResult(data, options) {
984
- const display = options?.widget || options?.title || options?.description ? {
985
- ...options.widget ? { widget: options.widget } : {},
986
- ...options.title ? { title: options.title } : {},
987
- ...options.description ? { description: options.description } : {}
988
- } : void 0;
1055
+ // src/eve/entity-schemas.ts
1056
+ import { z as z5 } from "zod";
1057
+
1058
+ // src/eve/tool-ui-hint.ts
1059
+ var TOOL_UI_HINT_FIELD = "uiHint";
1060
+ function withUiHint(result, hint) {
989
1061
  return {
990
- ...display ? { display } : {},
991
- data,
992
- ...options?.ui ? { ui: options.ui } : {}
1062
+ ...result,
1063
+ [TOOL_UI_HINT_FIELD]: hint
1064
+ };
1065
+ }
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
+ }
993
1078
  };
994
1079
  }
995
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
+
996
1272
  // src/eve/tool-reply-guidance.ts
997
1273
  var TOOL_REPLY_GUIDANCE_FIELD = "replyGuidance";
998
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).";
@@ -1006,125 +1282,89 @@ function withReplyGuidance(result, guidance) {
1006
1282
 
1007
1283
  // src/eve/tool-display-format.ts
1008
1284
  function formatToolObjectResult(data, options) {
1009
- return withReplyGuidance(
1010
- toolDisplayResult(data, {
1011
- title: options.title,
1012
- description: options.description,
1013
- ui: options.ui
1014
- }),
1285
+ let result = withReplyGuidance(
1286
+ data,
1015
1287
  options.replyGuidance
1016
1288
  );
1017
- }
1018
- function formatToolListResult(listKey, items, options) {
1019
- const listFieldUi = options.itemWidget ? {
1020
- "ui:widget": "list",
1021
- items: {
1022
- "ui:widget": options.itemWidget,
1023
- ...options.itemUi ?? {}
1024
- }
1025
- } : {
1026
- "ui:widget": "table",
1027
- ...options.itemUi ? { items: options.itemUi } : {}
1028
- };
1029
- return formatToolObjectResult(
1030
- { [listKey]: items },
1031
- {
1032
- title: options.title,
1033
- ui: {
1034
- [listKey]: listFieldUi
1035
- },
1036
- replyGuidance: options.replyGuidance
1037
- }
1038
- );
1289
+ if (options.ui) {
1290
+ result = withToolUi(result, options.ui);
1291
+ }
1292
+ if (options.uiHint) {
1293
+ result = withUiHint(result, options.uiHint);
1294
+ }
1295
+ return result;
1039
1296
  }
1040
1297
 
1041
1298
  // src/eve/tools/admin/format-tasks-list.ts
1042
1299
  function resolveTaskCardLabel(task) {
1043
1300
  return task.name?.trim() || task.description?.trim() || task.type?.trim() || task.id?.trim() || "Untitled task";
1044
1301
  }
1045
- function formatTasksListResult(items, options) {
1046
- const title = options?.title ?? (items.length === 1 ? "1 task" : `${items.length} tasks`);
1047
- const result = formatToolListResult(
1048
- "items",
1049
- items.map((task) => ({
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, {
1050
1313
  id: task.id,
1051
- name: resolveTaskCardLabel(task),
1052
- status: task.status,
1053
- type: task.type,
1054
- description: task.description
1055
- })),
1056
- {
1057
- title,
1058
- itemWidget: "tenantTask",
1059
- replyGuidance: QUERY_TASKS_LIST_REPLY_GUIDANCE
1060
- }
1061
- );
1062
- if (options?.nextCursor) {
1063
- return {
1064
- ...result,
1065
- data: {
1066
- ...result.data,
1067
- nextCursor: options.nextCursor
1068
- },
1069
- display: {
1070
- ...result.display,
1071
- description: "More tasks available \u2014 pass nextCursor to list again."
1072
- }
1073
- };
1074
- }
1075
- return result;
1314
+ type: task.type
1315
+ })
1316
+ };
1076
1317
  }
1077
- function formatTaskSearchResult(items, total) {
1078
- return formatTasksListResult(items, {
1079
- title: total === 1 ? "1 matching task" : `${total} matching tasks`
1318
+ function formatTasksListResult(items, options) {
1319
+ const payload = {
1320
+ items: items.map((task) => serializeTaskRow(task, options.tenantSlug))
1321
+ };
1322
+ if (options.nextCursor) {
1323
+ payload.nextCursor = options.nextCursor;
1324
+ }
1325
+ return formatToolObjectResult(payload, {
1326
+ replyGuidance: QUERY_TASKS_LIST_REPLY_GUIDANCE,
1327
+ ui: { layout: "list", entity: "task", rowsPath: "items" }
1080
1328
  });
1081
1329
  }
1082
- function formatTaskDetailResult(task) {
1083
- const title = resolveTaskCardLabel({
1084
- name: typeof task.name === "string" ? task.name : null,
1085
- description: typeof task.description === "string" ? task.description : null,
1086
- type: typeof task.type === "string" ? task.type : null,
1087
- id: typeof task.id === "string" ? task.id : null
1088
- });
1330
+ function formatTaskSearchResult(items, options) {
1331
+ return formatTasksListResult(items, options);
1332
+ }
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;
1089
1337
  return formatToolObjectResult(
1090
1338
  {
1091
- id: task.id ?? null,
1092
- status: task.status ?? null,
1093
- type: task.type ?? null,
1094
- name: task.name ?? null,
1095
- description: task.description ?? null,
1096
- validUntil: task.validUntil ?? null,
1097
- 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
1098
1347
  },
1099
1348
  {
1100
- title,
1101
- ui: {
1102
- id: { "ui:title": "Task ID" },
1103
- status: { "ui:title": "Status" },
1104
- type: { "ui:title": "Type" },
1105
- name: { "ui:title": "Name" },
1106
- description: { "ui:title": "Description" },
1107
- validUntil: { "ui:title": "Valid until", "ui:widget": "date" },
1108
- createdAt: { "ui:title": "Created", "ui:widget": "date" }
1109
- },
1110
- replyGuidance: QUERY_TASKS_DETAIL_REPLY_GUIDANCE
1349
+ replyGuidance: QUERY_TASKS_DETAIL_REPLY_GUIDANCE,
1350
+ ui: { entity: "task" }
1111
1351
  }
1112
1352
  );
1113
1353
  }
1114
1354
 
1115
1355
  // src/eve/tools/admin/query-tasks.ts
1116
1356
  var QUERY_TASKS_TOOL_NAME = "query_tasks";
1117
- var queryTasksInputSchema = z5.object({
1118
- action: z5.enum(["list", "get", "search"]),
1119
- statusFilter: z5.enum(["all", "open", "handled", "expired"]).optional().describe("Filter by task status for list."),
1120
- typeFilter: z5.string().optional(),
1121
- appFilter: z5.string().optional(),
1122
- sortField: z5.enum(["type", "date", "status", "validUntil"]).optional(),
1123
- sortDirection: z5.enum(["asc", "desc"]).optional(),
1124
- limit: z5.number().int().positive().max(100).optional(),
1125
- cursor: z5.string().optional(),
1126
- taskId: z5.string().min(1).optional().describe("Public task id or Convex tasks table id for get."),
1127
- 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.")
1128
1368
  }).superRefine((input, ctx) => {
1129
1369
  switch (input.action) {
1130
1370
  case "get":
@@ -1149,10 +1389,13 @@ var queryTasksInputSchema = z5.object({
1149
1389
  });
1150
1390
  function defineQueryTasksTool() {
1151
1391
  return defineTool({
1152
- description: "Tenant-admin tool to list, fetch detail, or search inbox tasks in the workspace. Requires tenant admin access. 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.",
1153
1393
  inputSchema: queryTasksInputSchema,
1394
+ outputSchema: queryTasksOutputSchema,
1154
1395
  async execute(input, ctx) {
1396
+ const caller = requireAdminCaller(ctx);
1155
1397
  const api = requireBoundAgentAdminClient(ctx);
1398
+ const tenantSlug = caller.tenantSlug;
1156
1399
  try {
1157
1400
  switch (input.action) {
1158
1401
  case "list": {
@@ -1166,18 +1409,22 @@ function defineQueryTasksTool() {
1166
1409
  cursor: input.cursor
1167
1410
  });
1168
1411
  return formatTasksListResult(result.items, {
1412
+ tenantSlug,
1169
1413
  nextCursor: result.nextCursor
1170
1414
  });
1171
1415
  }
1172
1416
  case "get": {
1173
1417
  const result = await api.tasks.get(input.taskId);
1174
- return formatTaskDetailResult(result.task);
1418
+ return formatTaskDetailResult(
1419
+ result.task,
1420
+ { tenantSlug }
1421
+ );
1175
1422
  }
1176
1423
  case "search": {
1177
1424
  const result = await api.tasks.search(input.query, input.limit);
1178
1425
  return formatTaskSearchResult(
1179
1426
  result.items,
1180
- result.total
1427
+ { tenantSlug }
1181
1428
  );
1182
1429
  }
1183
1430
  }