robotrock 1.0.0 → 1.3.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 (71) hide show
  1. package/dist/agent-admin.d.ts +82 -0
  2. package/dist/agent-admin.js +938 -0
  3. package/dist/agent-admin.js.map +1 -0
  4. package/dist/ai/index.d.ts +6 -5
  5. package/dist/ai/index.js +682 -225
  6. package/dist/ai/index.js.map +1 -1
  7. package/dist/ai/trigger.d.ts +4 -3
  8. package/dist/ai/trigger.js +682 -225
  9. package/dist/ai/trigger.js.map +1 -1
  10. package/dist/ai/workflow.d.ts +4 -3
  11. package/dist/ai/workflow.js +679 -222
  12. package/dist/ai/workflow.js.map +1 -1
  13. package/dist/auth-headers-qL-ZeEtd.d.ts +13 -0
  14. package/dist/{client-CzVmjXpz.d.ts → client-YO9Y1rkH.d.ts} +51 -10
  15. package/dist/eve/agent/index.d.ts +164 -0
  16. package/dist/eve/agent/index.js +2854 -0
  17. package/dist/eve/agent/index.js.map +1 -0
  18. package/dist/eve/index.d.ts +8 -0
  19. package/dist/eve/index.js +639 -0
  20. package/dist/eve/index.js.map +1 -0
  21. package/dist/eve/tools/admin/assign-tasks.d.ts +39 -0
  22. package/dist/eve/tools/admin/assign-tasks.js +1060 -0
  23. package/dist/eve/tools/admin/assign-tasks.js.map +1 -0
  24. package/dist/eve/tools/admin/manage-groups.d.ts +53 -0
  25. package/dist/eve/tools/admin/manage-groups.js +1218 -0
  26. package/dist/eve/tools/admin/manage-groups.js.map +1 -0
  27. package/dist/eve/tools/admin/manage-team-members.d.ts +45 -0
  28. package/dist/eve/tools/admin/manage-team-members.js +1160 -0
  29. package/dist/eve/tools/admin/manage-team-members.js.map +1 -0
  30. package/dist/eve/tools/admin/query-tasks.d.ts +71 -0
  31. package/dist/eve/tools/admin/query-tasks.js +1161 -0
  32. package/dist/eve/tools/admin/query-tasks.js.map +1 -0
  33. package/dist/eve/tools/catalog/search-products.d.ts +57 -0
  34. package/dist/eve/tools/catalog/search-products.js +94 -0
  35. package/dist/eve/tools/catalog/search-products.js.map +1 -0
  36. package/dist/eve/tools/identity/index.d.ts +8 -0
  37. package/dist/eve/tools/identity/index.js +234 -0
  38. package/dist/eve/tools/identity/index.js.map +1 -0
  39. package/dist/eve/tools/identity/my-access.d.ts +18 -0
  40. package/dist/eve/tools/identity/my-access.js +187 -0
  41. package/dist/eve/tools/identity/my-access.js.map +1 -0
  42. package/dist/eve/tools/identity/whoami.d.ts +44 -0
  43. package/dist/eve/tools/identity/whoami.js +117 -0
  44. package/dist/eve/tools/identity/whoami.js.map +1 -0
  45. package/dist/eve/tools/inbox/create-task.d.ts +114 -0
  46. package/dist/eve/tools/inbox/create-task.js +1785 -0
  47. package/dist/eve/tools/inbox/create-task.js.map +1 -0
  48. package/dist/eve/tools/inbox/index.d.ts +6 -0
  49. package/dist/eve/tools/inbox/index.js +1785 -0
  50. package/dist/eve/tools/inbox/index.js.map +1 -0
  51. package/dist/eve/tools/index.d.ts +24 -0
  52. package/dist/eve/tools/index.js +2848 -0
  53. package/dist/eve/tools/index.js.map +1 -0
  54. package/dist/index-DoQN48Bm.d.ts +200 -0
  55. package/dist/index.d.ts +8 -44
  56. package/dist/index.js +842 -137
  57. package/dist/index.js.map +1 -1
  58. package/dist/schemas/index.d.ts +6 -1
  59. package/dist/schemas/index.js +251 -59
  60. package/dist/schemas/index.js.map +1 -1
  61. package/dist/tenant-5YKDrdC-.d.ts +23 -0
  62. package/dist/{tool-approval-bridge-DbwUEBHv.d.ts → tool-approval-bridge-aMA79Z1B.d.ts} +1 -1
  63. package/dist/tool-reply-guidance-C3qrT1In.d.ts +25 -0
  64. package/dist/trigger/index.d.ts +2 -1
  65. package/dist/trigger/index.js +543 -127
  66. package/dist/trigger/index.js.map +1 -1
  67. package/dist/{trigger-BCKBbAV7.d.ts → trigger-CXrbKVCL.d.ts} +2 -2
  68. package/dist/workflow/index.d.ts +2 -1
  69. package/dist/workflow/index.js +543 -127
  70. package/dist/workflow/index.js.map +1 -1
  71. package/package.json +69 -8
@@ -0,0 +1,639 @@
1
+ // src/platform-actions.ts
2
+ var PLATFORM_MARK_DONE_ACTION_ID = "robotrock:mark-done";
3
+ var PLATFORM_REJECT_REQUEST_ACTION_ID = "robotrock:reject-request";
4
+ function isPlatformMarkDoneAction(actionId) {
5
+ return actionId === PLATFORM_MARK_DONE_ACTION_ID;
6
+ }
7
+ function isPlatformRejectRequestAction(actionId) {
8
+ return actionId === PLATFORM_REJECT_REQUEST_ACTION_ID;
9
+ }
10
+ function isPlatformTerminalAction(actionId) {
11
+ return isPlatformMarkDoneAction(actionId) || isPlatformRejectRequestAction(actionId);
12
+ }
13
+ function parsePlatformRejectRequestData(data) {
14
+ if (data == null || typeof data !== "object") {
15
+ return null;
16
+ }
17
+ const feedback = data.feedback;
18
+ if (typeof feedback !== "string") {
19
+ return null;
20
+ }
21
+ const trimmed = feedback.trim();
22
+ if (!trimmed) {
23
+ return null;
24
+ }
25
+ return { feedback: trimmed };
26
+ }
27
+
28
+ // src/eve/input-request.ts
29
+ var EVE_INPUT_SUBMIT_ACTION_ID = "submit";
30
+ var EVE_INPUT_OTHER_CHOICE_ID = "__other__";
31
+ var EVE_INPUT_OTHER_CHOICE_LABEL = "Type your own answer";
32
+ var CONFIRMATION_DEFAULT_OPTIONS = [
33
+ { id: "approve", label: "Approve", style: "primary" },
34
+ { id: "deny", label: "Deny", style: "danger" }
35
+ ];
36
+ var SELECT_PER_OPTION_THRESHOLD = 6;
37
+ function asRecord(value) {
38
+ if (value == null || typeof value !== "object" || Array.isArray(value)) {
39
+ return null;
40
+ }
41
+ return value;
42
+ }
43
+ function readStringField(data, key) {
44
+ const value = data[key];
45
+ if (typeof value !== "string") {
46
+ return void 0;
47
+ }
48
+ const trimmed = value.trim();
49
+ return trimmed.length > 0 ? trimmed : void 0;
50
+ }
51
+ function resolveEveInputDisplay(request, toolName) {
52
+ if (request.display) {
53
+ return request.display;
54
+ }
55
+ if (toolName === "ask_question") {
56
+ return request.options && request.options.length > 0 ? "select" : "text";
57
+ }
58
+ if (request.options && request.options.length > 0) {
59
+ return "select";
60
+ }
61
+ return "confirmation";
62
+ }
63
+ function confirmationActions(request) {
64
+ const options = request.options && request.options.length > 0 ? request.options : CONFIRMATION_DEFAULT_OPTIONS;
65
+ return options.map((option) => ({
66
+ id: option.id,
67
+ title: option.label,
68
+ ...option.description ? { description: option.description } : {}
69
+ }));
70
+ }
71
+ function textSubmitAction(prompt) {
72
+ return {
73
+ id: EVE_INPUT_SUBMIT_ACTION_ID,
74
+ title: "Submit",
75
+ schema: {
76
+ type: "object",
77
+ required: ["answer"],
78
+ properties: {
79
+ answer: {
80
+ type: "string",
81
+ title: "Your answer"
82
+ }
83
+ }
84
+ },
85
+ ui: {
86
+ answer: {
87
+ "ui:title": prompt.trim() || "Your answer",
88
+ "ui:widget": "textarea"
89
+ }
90
+ }
91
+ };
92
+ }
93
+ function selectPerOptionActions(options) {
94
+ return options.map((option) => ({
95
+ id: option.id,
96
+ title: option.label,
97
+ ...option.description ? { description: option.description } : {}
98
+ }));
99
+ }
100
+ function selectFormAction(request) {
101
+ const options = request.options ?? [];
102
+ const allowFreeform = request.allowFreeform === true;
103
+ const enumValues = options.map((option) => option.id);
104
+ const enumNames = options.map((option) => option.label);
105
+ if (allowFreeform) {
106
+ enumValues.push(EVE_INPUT_OTHER_CHOICE_ID);
107
+ enumNames.push(EVE_INPUT_OTHER_CHOICE_LABEL);
108
+ }
109
+ const properties = {
110
+ choice: {
111
+ type: "string",
112
+ title: "Choose one",
113
+ enum: enumValues
114
+ }
115
+ };
116
+ if (allowFreeform) {
117
+ properties.other = {
118
+ type: "string",
119
+ title: "Your answer"
120
+ };
121
+ }
122
+ const schema = {
123
+ type: "object",
124
+ required: ["choice"],
125
+ properties
126
+ };
127
+ if (allowFreeform) {
128
+ schema.allOf = [
129
+ {
130
+ if: {
131
+ properties: {
132
+ choice: { const: EVE_INPUT_OTHER_CHOICE_ID }
133
+ },
134
+ required: ["choice"]
135
+ },
136
+ then: {
137
+ required: ["other"],
138
+ properties: {
139
+ other: {
140
+ type: "string",
141
+ minLength: 1
142
+ }
143
+ }
144
+ }
145
+ }
146
+ ];
147
+ }
148
+ const ui = {
149
+ choice: {
150
+ "ui:widget": "radio",
151
+ "ui:enumNames": enumNames
152
+ }
153
+ };
154
+ if (allowFreeform) {
155
+ ui.other = {
156
+ "ui:placeholder": "Enter your answer"
157
+ };
158
+ }
159
+ return {
160
+ id: EVE_INPUT_SUBMIT_ACTION_ID,
161
+ title: "Submit",
162
+ schema,
163
+ ui
164
+ };
165
+ }
166
+ function normalizeEveSelectFormData(data) {
167
+ const choice = typeof data.choice === "string" ? data.choice.trim() : void 0;
168
+ if (!choice) {
169
+ return data;
170
+ }
171
+ if (choice === EVE_INPUT_OTHER_CHOICE_ID) {
172
+ return {
173
+ choice,
174
+ ...data.other !== void 0 ? { other: data.other } : {}
175
+ };
176
+ }
177
+ return { choice };
178
+ }
179
+ function eveInputRequestToActions(request, options) {
180
+ const display = resolveEveInputDisplay(request, options?.toolName);
181
+ switch (display) {
182
+ case "confirmation":
183
+ return confirmationActions(request);
184
+ case "text":
185
+ return [textSubmitAction(request.prompt)];
186
+ case "select": {
187
+ const selectOptions = request.options ?? [];
188
+ if (selectOptions.length === 0) {
189
+ return [textSubmitAction(request.prompt)];
190
+ }
191
+ if (selectOptions.length <= SELECT_PER_OPTION_THRESHOLD && request.allowFreeform !== true) {
192
+ return selectPerOptionActions(selectOptions);
193
+ }
194
+ return [selectFormAction(request)];
195
+ }
196
+ }
197
+ }
198
+ function eveInputRequestTaskType(request, options) {
199
+ const display = resolveEveInputDisplay(request, options?.toolName);
200
+ if (display === "confirmation" && options?.toolName) {
201
+ return `eve-approval:${options.toolName}`;
202
+ }
203
+ return `eve-input:${display}`;
204
+ }
205
+ function taskHandledToEveInputResponse(request, actionId, actionData, options) {
206
+ const base = { requestId: request.requestId };
207
+ if (isPlatformTerminalAction(actionId)) {
208
+ const feedback = parsePlatformRejectRequestData(actionData)?.feedback;
209
+ return {
210
+ ...base,
211
+ optionId: "deny",
212
+ ...feedback ? { text: feedback } : {}
213
+ };
214
+ }
215
+ const display = resolveEveInputDisplay(request, options?.toolName);
216
+ const selectOptions = request.options ?? [];
217
+ const data = asRecord(actionData);
218
+ if (display === "confirmation") {
219
+ return { ...base, optionId: actionId };
220
+ }
221
+ const matchingOption = selectOptions.find((option) => option.id === actionId);
222
+ if (matchingOption) {
223
+ return { ...base, optionId: actionId };
224
+ }
225
+ if (actionId === EVE_INPUT_SUBMIT_ACTION_ID && data) {
226
+ const submissionData = display === "select" && request.allowFreeform === true ? normalizeEveSelectFormData(data) : data;
227
+ const answer = readStringField(submissionData, "answer");
228
+ if (answer) {
229
+ return { ...base, text: answer };
230
+ }
231
+ const choice = readStringField(submissionData, "choice");
232
+ if (choice === EVE_INPUT_OTHER_CHOICE_ID) {
233
+ const other = readStringField(submissionData, "other");
234
+ if (other) {
235
+ return { ...base, text: other };
236
+ }
237
+ }
238
+ if (choice) {
239
+ if (selectOptions.some((option) => option.id === choice)) {
240
+ return { ...base, optionId: choice };
241
+ }
242
+ return { ...base, text: choice };
243
+ }
244
+ }
245
+ if (data) {
246
+ const answer = readStringField(data, "answer");
247
+ if (answer) {
248
+ return { ...base, text: answer };
249
+ }
250
+ }
251
+ return { ...base, optionId: actionId };
252
+ }
253
+
254
+ // src/eve/input-audit.ts
255
+ function matchOptionByText(text, options) {
256
+ const normalized = text.trim().toLowerCase();
257
+ if (normalized.length === 0) {
258
+ return void 0;
259
+ }
260
+ const byId = options.find((option) => option.id.toLowerCase() === normalized);
261
+ if (byId) {
262
+ return byId;
263
+ }
264
+ const byLabel = options.find((option) => option.label.toLowerCase() === normalized);
265
+ if (byLabel) {
266
+ return byLabel;
267
+ }
268
+ const index = Number(normalized);
269
+ if (Number.isInteger(index) && index > 0 && index <= options.length) {
270
+ return options[index - 1];
271
+ }
272
+ return void 0;
273
+ }
274
+ function resolveEveFreeformTextToInputResponse(request, text) {
275
+ const trimmed = text.trim();
276
+ if (trimmed.length === 0) {
277
+ return void 0;
278
+ }
279
+ const options = request.options ?? [];
280
+ if (options.length > 0) {
281
+ const matched = matchOptionByText(trimmed, options);
282
+ if (matched) {
283
+ return { requestId: request.requestId, optionId: matched.id };
284
+ }
285
+ }
286
+ if (request.allowFreeform === true || options.length === 0) {
287
+ return { requestId: request.requestId, text: trimmed };
288
+ }
289
+ return void 0;
290
+ }
291
+ function isEveApprovalInputRequest(request) {
292
+ const options = request.options ?? [];
293
+ return options.length === 2 && options[0]?.id === "approve" && options[1]?.id === "deny";
294
+ }
295
+ function eveInputResponseToActionSubmission(request, response, options) {
296
+ const display = resolveEveInputDisplay(request, options?.toolName);
297
+ const actions = eveInputRequestToActions(request, options);
298
+ if (response.optionId) {
299
+ const action = actions.find((entry) => entry.id === response.optionId);
300
+ if (action) {
301
+ return {
302
+ actionId: response.optionId,
303
+ actionTitle: action.title,
304
+ formData: {}
305
+ };
306
+ }
307
+ const option = request.options?.find((entry) => entry.id === response.optionId);
308
+ if (option) {
309
+ return {
310
+ actionId: response.optionId,
311
+ actionTitle: option.label,
312
+ formData: {}
313
+ };
314
+ }
315
+ return {
316
+ actionId: response.optionId,
317
+ actionTitle: response.optionId,
318
+ formData: {}
319
+ };
320
+ }
321
+ const text = response.text?.trim();
322
+ if (text) {
323
+ if (display === "text") {
324
+ return {
325
+ actionId: EVE_INPUT_SUBMIT_ACTION_ID,
326
+ actionTitle: text,
327
+ formData: { answer: text }
328
+ };
329
+ }
330
+ if (display === "select") {
331
+ const option = request.options?.find((entry) => entry.id === text);
332
+ if (option) {
333
+ return {
334
+ actionId: EVE_INPUT_SUBMIT_ACTION_ID,
335
+ actionTitle: option.label,
336
+ formData: { choice: option.id }
337
+ };
338
+ }
339
+ return {
340
+ actionId: EVE_INPUT_SUBMIT_ACTION_ID,
341
+ actionTitle: text,
342
+ formData: { choice: text }
343
+ };
344
+ }
345
+ return {
346
+ actionId: EVE_INPUT_SUBMIT_ACTION_ID,
347
+ actionTitle: text,
348
+ formData: { answer: text }
349
+ };
350
+ }
351
+ return {
352
+ actionId: EVE_INPUT_SUBMIT_ACTION_ID,
353
+ actionTitle: "Responded",
354
+ formData: {}
355
+ };
356
+ }
357
+ function buildEveInputAuditSubmissionData(context, formData) {
358
+ return {
359
+ toolCallId: context.toolCallId,
360
+ ...context.toolName ? { toolName: context.toolName } : {},
361
+ ...context.requestId ? { requestId: context.requestId } : {},
362
+ ...context.display ? { display: context.display } : {},
363
+ ...context.toolInput !== void 0 ? { toolInput: context.toolInput } : {},
364
+ ...formData
365
+ };
366
+ }
367
+ function parseEveAskQuestionToolOutput(output) {
368
+ if (output == null || typeof output !== "object") {
369
+ return null;
370
+ }
371
+ const record = output;
372
+ const value = record.type === "json" && record.value != null && typeof record.value === "object" ? record.value : record;
373
+ const optionId = typeof value.optionId === "string" ? value.optionId : void 0;
374
+ const text = typeof value.text === "string" ? value.text : void 0;
375
+ if (!optionId && !text) {
376
+ return null;
377
+ }
378
+ return { ...optionId ? { optionId } : {}, ...text ? { text } : {} };
379
+ }
380
+
381
+ // src/eve/tool-audit.ts
382
+ var MANAGE_TEAM_MEMBERS_TOOL_NAME = "manage_team_members";
383
+ var MANAGE_GROUPS_TOOL_NAME = "manage_groups";
384
+ var CREATE_INBOX_TASK_TOOL_NAME = "create_robotrock_task";
385
+ var MUTATING_TEAM_MEMBER_ACTIONS = /* @__PURE__ */ new Set([
386
+ "invite",
387
+ "update_role",
388
+ "remove"
389
+ ]);
390
+ var MUTATING_GROUP_ACTIONS = /* @__PURE__ */ new Set([
391
+ "create",
392
+ "update",
393
+ "delete",
394
+ "add_member",
395
+ "remove_member"
396
+ ]);
397
+ var SKIP_TOOL_NAMES = /* @__PURE__ */ new Set([
398
+ CREATE_INBOX_TASK_TOOL_NAME,
399
+ "ask_question",
400
+ "closeChat",
401
+ "requestActionInput"
402
+ ]);
403
+ function readAction(input) {
404
+ const action = input.action;
405
+ return typeof action === "string" && action.trim().length > 0 ? action.trim() : void 0;
406
+ }
407
+ function shouldAuditToolExecution(toolName, input) {
408
+ if (SKIP_TOOL_NAMES.has(toolName)) {
409
+ return false;
410
+ }
411
+ const action = readAction(input);
412
+ if (toolName === MANAGE_TEAM_MEMBERS_TOOL_NAME) {
413
+ return action != null && MUTATING_TEAM_MEMBER_ACTIONS.has(action);
414
+ }
415
+ if (toolName === MANAGE_GROUPS_TOOL_NAME) {
416
+ return action != null && MUTATING_GROUP_ACTIONS.has(action);
417
+ }
418
+ return false;
419
+ }
420
+ var AUDIT_INPUT_KEYS = /* @__PURE__ */ new Set([
421
+ "action",
422
+ "email",
423
+ "userId",
424
+ "role",
425
+ "name",
426
+ "groupId",
427
+ "description"
428
+ ]);
429
+ function sanitizeToolAuditInput(input) {
430
+ const sanitized = {};
431
+ for (const [key, value] of Object.entries(input)) {
432
+ if (!AUDIT_INPUT_KEYS.has(key)) {
433
+ continue;
434
+ }
435
+ if (value == null || value === "") {
436
+ continue;
437
+ }
438
+ if (typeof value === "string" || typeof value === "boolean") {
439
+ sanitized[key] = value;
440
+ continue;
441
+ }
442
+ if (typeof value === "number") {
443
+ sanitized[key] = value;
444
+ }
445
+ }
446
+ return sanitized;
447
+ }
448
+ function buildChatToolAuditPayload(input) {
449
+ const sanitized = sanitizeToolAuditInput(input.toolInput);
450
+ if (!shouldAuditToolExecution(input.toolName, sanitized)) {
451
+ return null;
452
+ }
453
+ const success = input.status === "completed" && input.isError !== true;
454
+ return {
455
+ toolCallId: input.toolCallId,
456
+ toolName: input.toolName,
457
+ input: sanitized,
458
+ success,
459
+ status: input.status,
460
+ ...input.error ? { error: input.error } : {}
461
+ };
462
+ }
463
+
464
+ // src/eve/tool-display.ts
465
+ var DEFAULT_TOOL_DISPLAY_LABELS = {
466
+ refund_charge: "Refund a customer charge",
467
+ deploy_release: "Deploy a release",
468
+ get_weather: "Get weather",
469
+ get_my_access: "Check my access",
470
+ whoami: "Who am I",
471
+ create_robotrock_task: "Create a RobotRock task",
472
+ search_products: "Search products",
473
+ manage_team_members: "Manage team members",
474
+ manage_groups: "Manage groups",
475
+ query_tasks: "Query tasks"
476
+ };
477
+ var toolDisplayLabelOverrides = {};
478
+ function setToolDisplayLabelOverrides(overrides) {
479
+ toolDisplayLabelOverrides = overrides;
480
+ }
481
+ function formatToolName(toolName) {
482
+ const spaced = toolName.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[-_]+/g, " ").trim();
483
+ if (!spaced) {
484
+ return "Tool";
485
+ }
486
+ return spaced.charAt(0).toUpperCase() + spaced.slice(1);
487
+ }
488
+ function getToolDisplayLabel(toolName) {
489
+ const trimmed = toolName.trim();
490
+ if (!trimmed) {
491
+ return "Tool";
492
+ }
493
+ return toolDisplayLabelOverrides[trimmed] ?? DEFAULT_TOOL_DISPLAY_LABELS[trimmed] ?? formatToolName(trimmed);
494
+ }
495
+ function formatEveApprovalTitle(request, toolName) {
496
+ const display = resolveEveInputDisplay(request, toolName);
497
+ if (display !== "confirmation" || !toolName) {
498
+ return request.prompt;
499
+ }
500
+ return `Approve: ${getToolDisplayLabel(toolName)}`;
501
+ }
502
+
503
+ // src/eve/tool-result-display.ts
504
+ function toolDisplayResult(data, options) {
505
+ const display = options?.widget || options?.title || options?.description ? {
506
+ ...options.widget ? { widget: options.widget } : {},
507
+ ...options.title ? { title: options.title } : {},
508
+ ...options.description ? { description: options.description } : {}
509
+ } : void 0;
510
+ return {
511
+ ...display ? { display } : {},
512
+ data,
513
+ ...options?.ui ? { ui: options.ui } : {}
514
+ };
515
+ }
516
+
517
+ // src/eve/tool-reply-guidance.ts
518
+ var TOOL_REPLY_GUIDANCE_FIELD = "replyGuidance";
519
+ var WHOAMI_REPLY_GUIDANCE = "The dashboard shows a profile card with name, email, workspace, role, and groups. Do not restate those in your reply. Only add context not in the card (e.g. permissions, refund approval rules, missing group membership).";
520
+ var MY_ACCESS_REPLY_GUIDANCE = "Access details may render in chat UI. Do not restate role, groups, or admin capabilities if already visible. Only explain what the user can or cannot do for their question (e.g. finance group required for refunds \u2265 $10,000). When access.tenantAdmin is false and the user needs manageTeam, manageGroups, or query-tasks capabilities, explain briefly then call ask_question to offer sending an admin request to tenant admins \u2014 do not tell them to find an admin manually without offering delegation first.";
521
+ var CREATE_INBOX_TASK_REPLY_GUIDANCE = "A task card shows title, assignee, and inbox status in chat. Do not restate task ID, assignee, or delegation details from the card. Only mention next steps or answer the user's question.";
522
+ var SEARCH_PRODUCTS_REPLY_GUIDANCE = "Product results render as a list card in chat. Do not restate product names, prices, or SKUs. Only add context not in the list (e.g. no matches, recommendations).";
523
+ var MANAGE_TEAM_MEMBERS_LIST_REPLY_GUIDANCE = "Team members render as a list card in chat. Do not restate names, emails, or roles from the list. Only add context not shown (e.g. duplicates, next admin actions).";
524
+ var MANAGE_TEAM_MEMBERS_DETAIL_REPLY_GUIDANCE = "Team member details render in chat UI. Do not restate name, email, or role from the card. Only add next steps or policy context.";
525
+ var MANAGE_GROUPS_LIST_REPLY_GUIDANCE = "Groups render as a list card in chat. Do not restate group names, slugs, or descriptions from the list. Use slug (not internal id) for get, update, delete, and membership actions. Only add context not shown.";
526
+ var MANAGE_GROUPS_DETAIL_REPLY_GUIDANCE = "Group details render in chat UI. Do not restate fields already visible in the card. Only add next steps.";
527
+ 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).";
528
+ var QUERY_TASKS_DETAIL_REPLY_GUIDANCE = "Task details render in chat UI. Do not restate fields already visible in the card. Only add analysis or next steps.";
529
+ var REFUND_CHARGE_REPLY_GUIDANCE = "Refund details render in chat UI. Do not restate charge id, amount, or status from the card. Only add policy context or next steps.";
530
+ var DEPLOY_RELEASE_REPLY_GUIDANCE = "Deploy details render in chat UI. Do not restate service, version, or environment from the card. Only add rollout context or next steps.";
531
+ var GET_WEATHER_REPLY_GUIDANCE = "Weather details render in chat UI. Do not restate city, condition, or temperature from the card. Only add conversational context if needed.";
532
+ var ADMIN_MUTATION_REPLY_GUIDANCE = "The action result renders in chat UI. Do not restate fields already visible in the card. Confirm outcome briefly or add next steps only.";
533
+ function withReplyGuidance(result, guidance) {
534
+ return {
535
+ ...result,
536
+ [TOOL_REPLY_GUIDANCE_FIELD]: guidance
537
+ };
538
+ }
539
+ function stripAgentOnlyToolFields(output) {
540
+ if (typeof output !== "object" || output === null || Array.isArray(output)) {
541
+ return output;
542
+ }
543
+ const record = { ...output };
544
+ delete record[TOOL_REPLY_GUIDANCE_FIELD];
545
+ return record;
546
+ }
547
+
548
+ // src/eve/tool-display-format.ts
549
+ function formatToolObjectResult(data, options) {
550
+ return withReplyGuidance(
551
+ toolDisplayResult(data, {
552
+ title: options.title,
553
+ description: options.description,
554
+ ui: options.ui
555
+ }),
556
+ options.replyGuidance
557
+ );
558
+ }
559
+ function formatToolListResult(listKey, items, options) {
560
+ const listFieldUi = options.itemWidget ? {
561
+ "ui:widget": "list",
562
+ items: {
563
+ "ui:widget": options.itemWidget,
564
+ ...options.itemUi ?? {}
565
+ }
566
+ } : {
567
+ "ui:widget": "table",
568
+ ...options.itemUi ? { items: options.itemUi } : {}
569
+ };
570
+ return formatToolObjectResult(
571
+ { [listKey]: items },
572
+ {
573
+ title: options.title,
574
+ ui: {
575
+ [listKey]: listFieldUi
576
+ },
577
+ replyGuidance: options.replyGuidance
578
+ }
579
+ );
580
+ }
581
+ function isAgentAdminErrorResult(result) {
582
+ return typeof result === "object" && result !== null && result.ok === false && typeof result.message === "string";
583
+ }
584
+
585
+ // src/eve/resume-message.ts
586
+ function buildTaskHandledResumeMessage(payload) {
587
+ const handledBy = payload.handledBy?.trim() || "someone";
588
+ const actionTitle = payload.action.title.trim();
589
+ return `RobotRock task ${payload.taskId} was handled: ${actionTitle} by ${handledBy}. Briefly tell the user what was decided and what happens next.`;
590
+ }
591
+
592
+ // src/eve/index.ts
593
+ var ROBOTROCK_READY_HOOK_SLUG = "robotrock-ready";
594
+ export {
595
+ ADMIN_MUTATION_REPLY_GUIDANCE,
596
+ CREATE_INBOX_TASK_REPLY_GUIDANCE,
597
+ DEFAULT_TOOL_DISPLAY_LABELS,
598
+ DEPLOY_RELEASE_REPLY_GUIDANCE,
599
+ EVE_INPUT_OTHER_CHOICE_ID,
600
+ EVE_INPUT_OTHER_CHOICE_LABEL,
601
+ EVE_INPUT_SUBMIT_ACTION_ID,
602
+ GET_WEATHER_REPLY_GUIDANCE,
603
+ MANAGE_GROUPS_DETAIL_REPLY_GUIDANCE,
604
+ MANAGE_GROUPS_LIST_REPLY_GUIDANCE,
605
+ MANAGE_TEAM_MEMBERS_DETAIL_REPLY_GUIDANCE,
606
+ MANAGE_TEAM_MEMBERS_LIST_REPLY_GUIDANCE,
607
+ MY_ACCESS_REPLY_GUIDANCE,
608
+ QUERY_TASKS_DETAIL_REPLY_GUIDANCE,
609
+ QUERY_TASKS_LIST_REPLY_GUIDANCE,
610
+ REFUND_CHARGE_REPLY_GUIDANCE,
611
+ ROBOTROCK_READY_HOOK_SLUG,
612
+ SEARCH_PRODUCTS_REPLY_GUIDANCE,
613
+ TOOL_REPLY_GUIDANCE_FIELD,
614
+ WHOAMI_REPLY_GUIDANCE,
615
+ buildChatToolAuditPayload,
616
+ buildEveInputAuditSubmissionData,
617
+ buildTaskHandledResumeMessage,
618
+ eveInputRequestTaskType,
619
+ eveInputRequestToActions,
620
+ eveInputResponseToActionSubmission,
621
+ formatEveApprovalTitle,
622
+ formatToolListResult,
623
+ formatToolObjectResult,
624
+ getToolDisplayLabel,
625
+ isAgentAdminErrorResult,
626
+ isEveApprovalInputRequest,
627
+ normalizeEveSelectFormData,
628
+ parseEveAskQuestionToolOutput,
629
+ resolveEveFreeformTextToInputResponse,
630
+ resolveEveInputDisplay,
631
+ sanitizeToolAuditInput,
632
+ setToolDisplayLabelOverrides,
633
+ shouldAuditToolExecution,
634
+ stripAgentOnlyToolFields,
635
+ taskHandledToEveInputResponse,
636
+ toolDisplayResult,
637
+ withReplyGuidance
638
+ };
639
+ //# sourceMappingURL=index.js.map