robotrock 1.3.2 → 1.3.4
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/README.md +22 -0
- package/dist/ai/index.js +8 -0
- package/dist/ai/index.js.map +1 -1
- package/dist/ai/trigger.js +8 -0
- package/dist/ai/trigger.js.map +1 -1
- package/dist/ai/workflow.js +8 -0
- package/dist/ai/workflow.js.map +1 -1
- package/dist/eve/agent/index.d.ts +67 -3
- package/dist/eve/agent/index.js +209 -153
- package/dist/eve/agent/index.js.map +1 -1
- package/dist/eve/index.d.ts +2 -1
- package/dist/eve/index.js +62 -47
- package/dist/eve/index.js.map +1 -1
- package/dist/eve/tools/admin/assign-tasks.d.ts +15 -4
- package/dist/eve/tools/admin/assign-tasks.js +8 -43
- package/dist/eve/tools/admin/assign-tasks.js.map +1 -1
- package/dist/eve/tools/admin/manage-groups.d.ts +2 -3
- package/dist/eve/tools/admin/manage-groups.js +18 -71
- package/dist/eve/tools/admin/manage-groups.js.map +1 -1
- package/dist/eve/tools/admin/manage-team-members.d.ts +2 -3
- package/dist/eve/tools/admin/manage-team-members.js +20 -64
- package/dist/eve/tools/admin/manage-team-members.js.map +1 -1
- package/dist/eve/tools/admin/query-tasks.d.ts +5 -6
- package/dist/eve/tools/admin/query-tasks.js +22 -86
- package/dist/eve/tools/admin/query-tasks.js.map +1 -1
- package/dist/eve/tools/catalog/search-products.d.ts +4 -5
- package/dist/eve/tools/catalog/search-products.js +2 -33
- package/dist/eve/tools/catalog/search-products.js.map +1 -1
- package/dist/eve/tools/identity/index.d.ts +0 -1
- package/dist/eve/tools/identity/index.js +15 -44
- package/dist/eve/tools/identity/index.js.map +1 -1
- package/dist/eve/tools/identity/my-access.d.ts +2 -3
- package/dist/eve/tools/identity/my-access.js +15 -44
- package/dist/eve/tools/identity/my-access.js.map +1 -1
- package/dist/eve/tools/identity/whoami.js.map +1 -1
- package/dist/eve/tools/inbox/create-task.js.map +1 -1
- package/dist/eve/tools/inbox/index.js.map +1 -1
- package/dist/eve/tools/index.d.ts +1 -1
- package/dist/eve/tools/index.js +44 -193
- package/dist/eve/tools/index.js.map +1 -1
- package/dist/{index-DePyAbTI.d.ts → index-Blq0XoAr.d.ts} +17 -16
- package/dist/index.d.ts +2 -1
- package/dist/index.js +19 -7
- package/dist/index.js.map +1 -1
- package/dist/tool-ui-hint-CMpug5sC.d.ts +13 -0
- package/package.json +2 -2
package/dist/eve/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export { C as ChatToolAuditInput, p as ChatToolAuditPayload, D as DEFAULT_TOOL_DISPLAY_LABELS, E as EVE_INPUT_OTHER_CHOICE_ID, a as EVE_INPUT_OTHER_CHOICE_LABEL, b as EVE_INPUT_SUBMIT_ACTION_ID, q as EveInputActionSubmission, u as EveInputAuditContext, c as EveInputOption, d as EveInputRequest, e as EveInputRequestDisplay, f as EveInputResponse, F as FormatToolListResultOptions, w as FormatToolObjectResultOptions, R as ROBOTROCK_READY_HOOK_SLUG, T as ToolDisplayResultOptions, x as buildChatToolAuditPayload, y as buildEveInputAuditSubmissionData, j as buildTaskHandledResumeMessage, k as eveInputRequestTaskType, l as eveInputRequestToActions, z as eveInputResponseToActionSubmission, m as formatEveApprovalTitle, A as formatToolListResult, B as formatToolObjectResult, n as getToolDisplayLabel, G as isAgentAdminErrorResult, H as isEveApprovalInputRequest, o as normalizeEveSelectFormData, I as parseEveAskQuestionToolOutput, J as resolveEveFreeformTextToInputResponse, r as resolveEveInputDisplay, K as sanitizeToolAuditInput, s as setToolDisplayLabelOverrides, L as shouldAuditToolExecution, t as taskHandledToEveInputResponse, M as toolDisplayResult } from '../index-
|
|
1
|
+
export { C as ChatToolAuditInput, p as ChatToolAuditPayload, D as DEFAULT_TOOL_DISPLAY_LABELS, E as EVE_INPUT_OTHER_CHOICE_ID, a as EVE_INPUT_OTHER_CHOICE_LABEL, b as EVE_INPUT_SUBMIT_ACTION_ID, q as EveInputActionSubmission, u as EveInputAuditContext, c as EveInputOption, d as EveInputRequest, e as EveInputRequestDisplay, f as EveInputResponse, F as FormatToolListResultOptions, w as FormatToolObjectResultOptions, R as ROBOTROCK_READY_HOOK_SLUG, T as ToolDisplayResultOptions, x as buildChatToolAuditPayload, y as buildEveInputAuditSubmissionData, j as buildTaskHandledResumeMessage, k as eveInputRequestTaskType, l as eveInputRequestToActions, z as eveInputResponseToActionSubmission, m as formatEveApprovalTitle, A as formatToolListResult, B as formatToolObjectResult, n as getToolDisplayLabel, G as isAgentAdminErrorResult, H as isEveApprovalInputRequest, o as normalizeEveSelectFormData, I as parseEveAskQuestionToolOutput, J as resolveEveFreeformTextToInputResponse, r as resolveEveInputDisplay, K as sanitizeToolAuditInput, s as setToolDisplayLabelOverrides, L as shouldAuditToolExecution, t as taskHandledToEveInputResponse, M as toolDisplayResult } from '../index-Blq0XoAr.js';
|
|
2
|
+
export { a as TOOL_UI_HINT_FIELD, T as ToolUiHint, e as extractToolUiHint, i as isToolUiHint, w as withUiHint } from '../tool-ui-hint-CMpug5sC.js';
|
|
2
3
|
export { A as ADMIN_MUTATION_REPLY_GUIDANCE, C as CREATE_INBOX_TASK_REPLY_GUIDANCE, D as DEPLOY_RELEASE_REPLY_GUIDANCE, G as GET_WEATHER_REPLY_GUIDANCE, M as MANAGE_GROUPS_DETAIL_REPLY_GUIDANCE, a as MANAGE_GROUPS_LIST_REPLY_GUIDANCE, b as MANAGE_TEAM_MEMBERS_DETAIL_REPLY_GUIDANCE, c as MANAGE_TEAM_MEMBERS_LIST_REPLY_GUIDANCE, d as MY_ACCESS_REPLY_GUIDANCE, Q as QUERY_TASKS_DETAIL_REPLY_GUIDANCE, e as QUERY_TASKS_LIST_REPLY_GUIDANCE, R as REFUND_CHARGE_REPLY_GUIDANCE, S as SEARCH_PRODUCTS_REPLY_GUIDANCE, f as TOOL_REPLY_GUIDANCE_FIELD, T as ToolResultWithReplyGuidance, W as WHOAMI_REPLY_GUIDANCE, s as stripAgentOnlyToolFields, w as withReplyGuidance } from '../tool-reply-guidance-C3qrT1In.js';
|
|
3
4
|
import '../client-CZ5eWH5v.js';
|
|
4
5
|
import '../schemas/index.js';
|
package/dist/eve/index.js
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
// ../core/src/utils/decode-html-entities.ts
|
|
2
|
+
function decodeHtmlEntities(value) {
|
|
3
|
+
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'").replace(/'/g, "'").replace(/&#(\d+);/g, (_, code) => String.fromCharCode(Number(code))).replace(
|
|
4
|
+
/&#x([0-9a-f]+);/gi,
|
|
5
|
+
(_, code) => String.fromCharCode(parseInt(code, 16))
|
|
6
|
+
);
|
|
7
|
+
}
|
|
8
|
+
|
|
1
9
|
// src/platform-actions.ts
|
|
2
10
|
var PLATFORM_MARK_DONE_ACTION_ID = "robotrock:mark-done";
|
|
3
11
|
var PLATFORM_REJECT_REQUEST_ACTION_ID = "robotrock:reject-request";
|
|
@@ -48,6 +56,9 @@ function readStringField(data, key) {
|
|
|
48
56
|
const trimmed = value.trim();
|
|
49
57
|
return trimmed.length > 0 ? trimmed : void 0;
|
|
50
58
|
}
|
|
59
|
+
function decodeDisplayText(value) {
|
|
60
|
+
return decodeHtmlEntities(value);
|
|
61
|
+
}
|
|
51
62
|
function resolveEveInputDisplay(request, toolName) {
|
|
52
63
|
if (request.display) {
|
|
53
64
|
return request.display;
|
|
@@ -64,11 +75,12 @@ function confirmationActions(request) {
|
|
|
64
75
|
const options = request.options && request.options.length > 0 ? request.options : CONFIRMATION_DEFAULT_OPTIONS;
|
|
65
76
|
return options.map((option) => ({
|
|
66
77
|
id: option.id,
|
|
67
|
-
title: option.label,
|
|
68
|
-
...option.description ? { description: option.description } : {}
|
|
78
|
+
title: decodeDisplayText(option.label),
|
|
79
|
+
...option.description ? { description: decodeDisplayText(option.description) } : {}
|
|
69
80
|
}));
|
|
70
81
|
}
|
|
71
82
|
function textSubmitAction(prompt) {
|
|
83
|
+
const decodedPrompt = decodeDisplayText(prompt);
|
|
72
84
|
return {
|
|
73
85
|
id: EVE_INPUT_SUBMIT_ACTION_ID,
|
|
74
86
|
title: "Submit",
|
|
@@ -84,7 +96,7 @@ function textSubmitAction(prompt) {
|
|
|
84
96
|
},
|
|
85
97
|
ui: {
|
|
86
98
|
answer: {
|
|
87
|
-
"ui:title":
|
|
99
|
+
"ui:title": decodedPrompt.trim() || "Your answer",
|
|
88
100
|
"ui:widget": "textarea"
|
|
89
101
|
}
|
|
90
102
|
}
|
|
@@ -93,15 +105,15 @@ function textSubmitAction(prompt) {
|
|
|
93
105
|
function selectPerOptionActions(options) {
|
|
94
106
|
return options.map((option) => ({
|
|
95
107
|
id: option.id,
|
|
96
|
-
title: option.label,
|
|
97
|
-
...option.description ? { description: option.description } : {}
|
|
108
|
+
title: decodeDisplayText(option.label),
|
|
109
|
+
...option.description ? { description: decodeDisplayText(option.description) } : {}
|
|
98
110
|
}));
|
|
99
111
|
}
|
|
100
112
|
function selectFormAction(request) {
|
|
101
113
|
const options = request.options ?? [];
|
|
102
114
|
const allowFreeform = request.allowFreeform === true;
|
|
103
115
|
const enumValues = options.map((option) => option.id);
|
|
104
|
-
const enumNames = options.map((option) => option.label);
|
|
116
|
+
const enumNames = options.map((option) => decodeDisplayText(option.label));
|
|
105
117
|
if (allowFreeform) {
|
|
106
118
|
enumValues.push(EVE_INPUT_OTHER_CHOICE_ID);
|
|
107
119
|
enumNames.push(EVE_INPUT_OTHER_CHOICE_LABEL);
|
|
@@ -292,6 +304,12 @@ function isEveApprovalInputRequest(request) {
|
|
|
292
304
|
const options = request.options ?? [];
|
|
293
305
|
return options.length === 2 && options[0]?.id === "approve" && options[1]?.id === "deny";
|
|
294
306
|
}
|
|
307
|
+
function buildOptionIdFormData(display, optionId) {
|
|
308
|
+
if (display === "select" || display === "confirmation") {
|
|
309
|
+
return { choice: optionId };
|
|
310
|
+
}
|
|
311
|
+
return {};
|
|
312
|
+
}
|
|
295
313
|
function eveInputResponseToActionSubmission(request, response, options) {
|
|
296
314
|
const display = resolveEveInputDisplay(request, options?.toolName);
|
|
297
315
|
const actions = eveInputRequestToActions(request, options);
|
|
@@ -301,7 +319,7 @@ function eveInputResponseToActionSubmission(request, response, options) {
|
|
|
301
319
|
return {
|
|
302
320
|
actionId: response.optionId,
|
|
303
321
|
actionTitle: action.title,
|
|
304
|
-
formData:
|
|
322
|
+
formData: buildOptionIdFormData(display, response.optionId)
|
|
305
323
|
};
|
|
306
324
|
}
|
|
307
325
|
const option = request.options?.find((entry) => entry.id === response.optionId);
|
|
@@ -309,13 +327,13 @@ function eveInputResponseToActionSubmission(request, response, options) {
|
|
|
309
327
|
return {
|
|
310
328
|
actionId: response.optionId,
|
|
311
329
|
actionTitle: option.label,
|
|
312
|
-
formData:
|
|
330
|
+
formData: buildOptionIdFormData(display, response.optionId)
|
|
313
331
|
};
|
|
314
332
|
}
|
|
315
333
|
return {
|
|
316
334
|
actionId: response.optionId,
|
|
317
335
|
actionTitle: response.optionId,
|
|
318
|
-
formData:
|
|
336
|
+
formData: buildOptionIdFormData(display, response.optionId)
|
|
319
337
|
};
|
|
320
338
|
}
|
|
321
339
|
const text = response.text?.trim();
|
|
@@ -470,24 +488,35 @@ function getToolDisplayLabel(toolName) {
|
|
|
470
488
|
function formatEveApprovalTitle(request, toolName) {
|
|
471
489
|
const display = resolveEveInputDisplay(request, toolName);
|
|
472
490
|
if (display !== "confirmation" || !toolName) {
|
|
473
|
-
return request.prompt;
|
|
491
|
+
return decodeHtmlEntities(request.prompt);
|
|
474
492
|
}
|
|
475
493
|
return `Approve: ${getToolDisplayLabel(toolName)}`;
|
|
476
494
|
}
|
|
477
495
|
|
|
478
496
|
// src/eve/tool-result-display.ts
|
|
479
|
-
function toolDisplayResult(data,
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
497
|
+
function toolDisplayResult(data, _options) {
|
|
498
|
+
return data;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
// src/eve/tool-ui-hint.ts
|
|
502
|
+
var TOOL_UI_HINT_FIELD = "uiHint";
|
|
503
|
+
var TOOL_UI_HINTS = /* @__PURE__ */ new Set(["list", "chart", "table"]);
|
|
504
|
+
function isToolUiHint(value) {
|
|
505
|
+
return typeof value === "string" && TOOL_UI_HINTS.has(value);
|
|
506
|
+
}
|
|
507
|
+
function withUiHint(result, hint) {
|
|
485
508
|
return {
|
|
486
|
-
...
|
|
487
|
-
|
|
488
|
-
...options?.ui ? { ui: options.ui } : {}
|
|
509
|
+
...result,
|
|
510
|
+
[TOOL_UI_HINT_FIELD]: hint
|
|
489
511
|
};
|
|
490
512
|
}
|
|
513
|
+
function extractToolUiHint(output) {
|
|
514
|
+
if (typeof output !== "object" || output === null || Array.isArray(output)) {
|
|
515
|
+
return void 0;
|
|
516
|
+
}
|
|
517
|
+
const hint = output[TOOL_UI_HINT_FIELD];
|
|
518
|
+
return isToolUiHint(hint) ? hint : void 0;
|
|
519
|
+
}
|
|
491
520
|
|
|
492
521
|
// src/eve/tool-reply-guidance.ts
|
|
493
522
|
var TOOL_REPLY_GUIDANCE_FIELD = "replyGuidance";
|
|
@@ -517,40 +546,22 @@ function stripAgentOnlyToolFields(output) {
|
|
|
517
546
|
}
|
|
518
547
|
const record = { ...output };
|
|
519
548
|
delete record[TOOL_REPLY_GUIDANCE_FIELD];
|
|
549
|
+
delete record[TOOL_UI_HINT_FIELD];
|
|
520
550
|
return record;
|
|
521
551
|
}
|
|
522
552
|
|
|
523
553
|
// src/eve/tool-display-format.ts
|
|
524
554
|
function formatToolObjectResult(data, options) {
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
}),
|
|
531
|
-
options.replyGuidance
|
|
532
|
-
);
|
|
555
|
+
const withGuidance = withReplyGuidance(data, options.replyGuidance);
|
|
556
|
+
if (options.uiHint) {
|
|
557
|
+
return withUiHint(withGuidance, options.uiHint);
|
|
558
|
+
}
|
|
559
|
+
return withGuidance;
|
|
533
560
|
}
|
|
534
561
|
function formatToolListResult(listKey, items, options) {
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
"ui:widget": options.itemWidget,
|
|
539
|
-
...options.itemUi ?? {}
|
|
540
|
-
}
|
|
541
|
-
} : {
|
|
542
|
-
"ui:widget": "table",
|
|
543
|
-
...options.itemUi ? { items: options.itemUi } : {}
|
|
544
|
-
};
|
|
545
|
-
return formatToolObjectResult(
|
|
546
|
-
{ [listKey]: items },
|
|
547
|
-
{
|
|
548
|
-
title: options.title,
|
|
549
|
-
ui: {
|
|
550
|
-
[listKey]: listFieldUi
|
|
551
|
-
},
|
|
552
|
-
replyGuidance: options.replyGuidance
|
|
553
|
-
}
|
|
562
|
+
return withUiHint(
|
|
563
|
+
withReplyGuidance({ [listKey]: items }, options.replyGuidance),
|
|
564
|
+
"list"
|
|
554
565
|
);
|
|
555
566
|
}
|
|
556
567
|
function isAgentAdminErrorResult(result) {
|
|
@@ -586,6 +597,7 @@ export {
|
|
|
586
597
|
ROBOTROCK_READY_HOOK_SLUG,
|
|
587
598
|
SEARCH_PRODUCTS_REPLY_GUIDANCE,
|
|
588
599
|
TOOL_REPLY_GUIDANCE_FIELD,
|
|
600
|
+
TOOL_UI_HINT_FIELD,
|
|
589
601
|
WHOAMI_REPLY_GUIDANCE,
|
|
590
602
|
buildChatToolAuditPayload,
|
|
591
603
|
buildEveInputAuditSubmissionData,
|
|
@@ -593,12 +605,14 @@ export {
|
|
|
593
605
|
eveInputRequestTaskType,
|
|
594
606
|
eveInputRequestToActions,
|
|
595
607
|
eveInputResponseToActionSubmission,
|
|
608
|
+
extractToolUiHint,
|
|
596
609
|
formatEveApprovalTitle,
|
|
597
610
|
formatToolListResult,
|
|
598
611
|
formatToolObjectResult,
|
|
599
612
|
getToolDisplayLabel,
|
|
600
613
|
isAgentAdminErrorResult,
|
|
601
614
|
isEveApprovalInputRequest,
|
|
615
|
+
isToolUiHint,
|
|
602
616
|
normalizeEveSelectFormData,
|
|
603
617
|
parseEveAskQuestionToolOutput,
|
|
604
618
|
resolveEveFreeformTextToInputResponse,
|
|
@@ -609,6 +623,7 @@ export {
|
|
|
609
623
|
stripAgentOnlyToolFields,
|
|
610
624
|
taskHandledToEveInputResponse,
|
|
611
625
|
toolDisplayResult,
|
|
612
|
-
withReplyGuidance
|
|
626
|
+
withReplyGuidance,
|
|
627
|
+
withUiHint
|
|
613
628
|
};
|
|
614
629
|
//# sourceMappingURL=index.js.map
|
package/dist/eve/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/platform-actions.ts","../../src/eve/input-request.ts","../../src/eve/input-audit.ts","../../src/eve/tool-audit.ts","../../src/eve/tool-display.ts","../../src/eve/tool-result-display.ts","../../src/eve/tool-reply-guidance.ts","../../src/eve/tool-display-format.ts","../../src/eve/resume-message.ts","../../src/eve/index.ts"],"sourcesContent":["/**\n * Reserved inbox actions that reviewers can take outside your task's defined actions.\n * Agents and integrations must treat these as terminal — stop the run and do not retry sendToHuman.\n */\n\nexport const PLATFORM_MARK_DONE_ACTION_ID = \"robotrock:mark-done\" as const;\nexport const PLATFORM_REJECT_REQUEST_ACTION_ID = \"robotrock:reject-request\" as const;\n\nexport const PLATFORM_MARK_DONE_ACTION_TITLE = \"Mark as done\";\nexport const PLATFORM_REJECT_REQUEST_ACTION_TITLE = \"Reject request\";\n\nexport const PLATFORM_TERMINAL_ACTION_IDS = [\n PLATFORM_MARK_DONE_ACTION_ID,\n PLATFORM_REJECT_REQUEST_ACTION_ID,\n] as const;\n\nexport type PlatformTerminalActionId = (typeof PLATFORM_TERMINAL_ACTION_IDS)[number];\n\nexport type PlatformRejectRequestData = {\n feedback: string;\n};\n\nexport type HandledActionInput = {\n actionId: string;\n data?: unknown;\n handledBy?: string;\n handledAt?: number | Date;\n};\n\nexport type PlatformMarkDoneOutcome = {\n source: \"platform\";\n kind: \"mark-done\";\n actionId: typeof PLATFORM_MARK_DONE_ACTION_ID;\n data: Record<string, never>;\n handledBy?: string;\n handledAt?: Date;\n};\n\nexport type PlatformRejectRequestOutcome = {\n source: \"platform\";\n kind: \"reject-request\";\n actionId: typeof PLATFORM_REJECT_REQUEST_ACTION_ID;\n data: PlatformRejectRequestData;\n handledBy?: string;\n handledAt?: Date;\n};\n\nexport type TaskActionOutcome = {\n source: \"task\";\n actionId: string;\n data: unknown;\n handledBy?: string;\n handledAt?: Date;\n};\n\nexport type HandledOutcome =\n | PlatformMarkDoneOutcome\n | PlatformRejectRequestOutcome\n | TaskActionOutcome;\n\nexport class PlatformRejectRequestError extends Error {\n readonly actionId = PLATFORM_REJECT_REQUEST_ACTION_ID;\n readonly feedback: string;\n\n constructor(feedback: string, message?: string) {\n super(message ?? `Human rejected the request: ${feedback}`);\n this.name = \"PlatformRejectRequestError\";\n this.feedback = feedback;\n }\n}\n\nexport function isPlatformMarkDoneAction(\n actionId: string | undefined\n): actionId is typeof PLATFORM_MARK_DONE_ACTION_ID {\n return actionId === PLATFORM_MARK_DONE_ACTION_ID;\n}\n\nexport function isPlatformRejectRequestAction(\n actionId: string | undefined\n): actionId is typeof PLATFORM_REJECT_REQUEST_ACTION_ID {\n return actionId === PLATFORM_REJECT_REQUEST_ACTION_ID;\n}\n\nexport function isPlatformTerminalAction(\n actionId: string | undefined\n): actionId is PlatformTerminalActionId {\n return (\n isPlatformMarkDoneAction(actionId) || isPlatformRejectRequestAction(actionId)\n );\n}\n\nexport function parsePlatformRejectRequestData(\n data: unknown\n): PlatformRejectRequestData | null {\n if (data == null || typeof data !== \"object\") {\n return null;\n }\n const feedback = (data as { feedback?: unknown }).feedback;\n if (typeof feedback !== \"string\") {\n return null;\n }\n const trimmed = feedback.trim();\n if (!trimmed) {\n return null;\n }\n return { feedback: trimmed };\n}\n\nfunction toHandledAt(value: number | Date | undefined): Date | undefined {\n if (value === undefined) {\n return undefined;\n }\n return value instanceof Date ? value : new Date(value);\n}\n\n/**\n * Classify a handled task action as a platform terminal outcome or a normal task action.\n */\nexport function parseHandledOutcome(input: HandledActionInput): HandledOutcome {\n const handledAt = toHandledAt(input.handledAt);\n const handledBy = input.handledBy;\n\n if (isPlatformMarkDoneAction(input.actionId)) {\n return {\n source: \"platform\",\n kind: \"mark-done\",\n actionId: PLATFORM_MARK_DONE_ACTION_ID,\n data: {},\n handledBy,\n handledAt,\n };\n }\n\n if (isPlatformRejectRequestAction(input.actionId)) {\n return {\n source: \"platform\",\n kind: \"reject-request\",\n actionId: PLATFORM_REJECT_REQUEST_ACTION_ID,\n data: parsePlatformRejectRequestData(input.data) ?? { feedback: \"\" },\n handledBy,\n handledAt,\n };\n }\n\n return {\n source: \"task\",\n actionId: input.actionId,\n data: input.data ?? {},\n handledBy,\n handledAt,\n };\n}\n\n/**\n * Throw when a human rejected the request from the inbox (not your task's reject action).\n * Use after polling, webhooks, or getTask when you want agents to stop immediately.\n */\nexport function assertNotPlatformRejectRequest(\n actionId: string,\n data?: unknown\n): void {\n if (!isPlatformRejectRequestAction(actionId)) {\n return;\n }\n const parsed = parsePlatformRejectRequestData(data);\n throw new PlatformRejectRequestError(\n parsed?.feedback ?? \"No feedback provided\"\n );\n}\n\n/**\n * Returns true when the agent should stop — platform mark-done or reject-request.\n */\nexport function shouldStopAgentForHandledAction(actionId: string | undefined): boolean {\n return isPlatformTerminalAction(actionId);\n}\n","import type { SendToHumanActionInput } from \"../client.js\";\nimport {\n isPlatformTerminalAction,\n parsePlatformRejectRequestData,\n} from \"../platform-actions.js\";\n\n/** One selectable option in an Eve HITL input request. */\nexport type EveInputOption = {\n readonly id: string;\n readonly label: string;\n readonly description?: string;\n readonly style?: \"danger\" | \"default\" | \"primary\";\n};\n\n/** Eve HITL display mode — mirrors `InputRequest.display` from the eve runtime. */\nexport type EveInputRequestDisplay = \"confirmation\" | \"select\" | \"text\";\n\n/**\n * Minimal Eve `InputRequest` shape for RobotRock bridging. Intentionally\n * self-contained so the SDK does not depend on the `eve` package.\n */\nexport type EveInputRequest = {\n readonly requestId: string;\n readonly prompt: string;\n readonly display?: EveInputRequestDisplay;\n readonly allowFreeform?: boolean;\n readonly options?: readonly EveInputOption[];\n};\n\n/** Eve `InputResponse` shape returned when resuming a parked session. */\nexport type EveInputResponse = {\n readonly requestId: string;\n readonly optionId?: string;\n readonly text?: string;\n};\n\nexport const EVE_INPUT_SUBMIT_ACTION_ID = \"submit\" as const;\nexport const EVE_INPUT_OTHER_CHOICE_ID = \"__other__\" as const;\nexport const EVE_INPUT_OTHER_CHOICE_LABEL = \"Type your own answer\" as const;\n\nconst CONFIRMATION_DEFAULT_OPTIONS: readonly EveInputOption[] = [\n { id: \"approve\", label: \"Approve\", style: \"primary\" },\n { id: \"deny\", label: \"Deny\", style: \"danger\" },\n];\n\nconst SELECT_PER_OPTION_THRESHOLD = 6;\n\nfunction asRecord(value: unknown): Record<string, unknown> | null {\n if (value == null || typeof value !== \"object\" || Array.isArray(value)) {\n return null;\n }\n return value as Record<string, unknown>;\n}\n\nfunction readStringField(data: Record<string, unknown>, key: string): string | undefined {\n const value = data[key];\n if (typeof value !== \"string\") {\n return undefined;\n }\n const trimmed = value.trim();\n return trimmed.length > 0 ? trimmed : undefined;\n}\n\n/** Resolve the effective display mode when Eve omits `display`. */\nexport function resolveEveInputDisplay(\n request: EveInputRequest,\n toolName?: string\n): EveInputRequestDisplay {\n if (request.display) {\n return request.display;\n }\n if (toolName === \"ask_question\") {\n return request.options && request.options.length > 0 ? \"select\" : \"text\";\n }\n if (request.options && request.options.length > 0) {\n return \"select\";\n }\n return \"confirmation\";\n}\n\nfunction confirmationActions(request: EveInputRequest): readonly SendToHumanActionInput[] {\n const options =\n request.options && request.options.length > 0\n ? request.options\n : CONFIRMATION_DEFAULT_OPTIONS;\n\n return options.map((option) => ({\n id: option.id,\n title: option.label,\n ...(option.description ? { description: option.description } : {}),\n }));\n}\n\nfunction textSubmitAction(prompt: string): SendToHumanActionInput {\n return {\n id: EVE_INPUT_SUBMIT_ACTION_ID,\n title: \"Submit\",\n schema: {\n type: \"object\",\n required: [\"answer\"],\n properties: {\n answer: {\n type: \"string\",\n title: \"Your answer\",\n },\n },\n },\n ui: {\n answer: {\n \"ui:title\": prompt.trim() || \"Your answer\",\n \"ui:widget\": \"textarea\",\n },\n },\n };\n}\n\nfunction selectPerOptionActions(\n options: readonly EveInputOption[]\n): readonly SendToHumanActionInput[] {\n return options.map((option) => ({\n id: option.id,\n title: option.label,\n ...(option.description ? { description: option.description } : {}),\n }));\n}\n\nfunction selectFormAction(request: EveInputRequest): SendToHumanActionInput {\n const options = request.options ?? [];\n const allowFreeform = request.allowFreeform === true;\n const enumValues = options.map((option) => option.id);\n const enumNames = options.map((option) => option.label);\n\n if (allowFreeform) {\n enumValues.push(EVE_INPUT_OTHER_CHOICE_ID);\n enumNames.push(EVE_INPUT_OTHER_CHOICE_LABEL);\n }\n\n const properties: Record<string, unknown> = {\n choice: {\n type: \"string\",\n title: \"Choose one\",\n enum: enumValues,\n },\n };\n\n if (allowFreeform) {\n properties.other = {\n type: \"string\",\n title: \"Your answer\",\n };\n }\n\n const schema: Record<string, unknown> = {\n type: \"object\",\n required: [\"choice\"],\n properties,\n };\n\n if (allowFreeform) {\n schema.allOf = [\n {\n if: {\n properties: {\n choice: { const: EVE_INPUT_OTHER_CHOICE_ID },\n },\n required: [\"choice\"],\n },\n then: {\n required: [\"other\"],\n properties: {\n other: {\n type: \"string\",\n minLength: 1,\n },\n },\n },\n },\n ];\n }\n\n const ui: Record<string, unknown> = {\n choice: {\n \"ui:widget\": \"radio\",\n \"ui:enumNames\": enumNames,\n },\n };\n\n if (allowFreeform) {\n ui.other = {\n \"ui:placeholder\": \"Enter your answer\",\n };\n }\n\n return {\n id: EVE_INPUT_SUBMIT_ACTION_ID,\n title: \"Submit\",\n schema: schema as SendToHumanActionInput[\"schema\"],\n ui: ui as SendToHumanActionInput[\"ui\"],\n };\n}\n\n/** Keep select-form submissions mutually exclusive between preset choice and freeform other. */\nexport function normalizeEveSelectFormData(\n data: Record<string, unknown>\n): Record<string, unknown> {\n const choice =\n typeof data.choice === \"string\" ? data.choice.trim() : undefined;\n if (!choice) {\n return data;\n }\n if (choice === EVE_INPUT_OTHER_CHOICE_ID) {\n return {\n choice,\n ...(data.other !== undefined ? { other: data.other } : {}),\n };\n }\n return { choice };\n}\n\n/**\n * Map an Eve `InputRequest` to RobotRock inbox actions.\n */\nexport function eveInputRequestToActions(\n request: EveInputRequest,\n options?: { toolName?: string }\n): readonly SendToHumanActionInput[] {\n const display = resolveEveInputDisplay(request, options?.toolName);\n\n switch (display) {\n case \"confirmation\":\n return confirmationActions(request);\n case \"text\":\n return [textSubmitAction(request.prompt)];\n case \"select\": {\n const selectOptions = request.options ?? [];\n if (selectOptions.length === 0) {\n return [textSubmitAction(request.prompt)];\n }\n if (\n selectOptions.length <= SELECT_PER_OPTION_THRESHOLD &&\n request.allowFreeform !== true\n ) {\n return selectPerOptionActions(selectOptions);\n }\n return [selectFormAction(request)];\n }\n }\n}\n\n/** Task type slug for an Eve input request. */\nexport function eveInputRequestTaskType(\n request: EveInputRequest,\n options?: { toolName?: string }\n): string {\n const display = resolveEveInputDisplay(request, options?.toolName);\n if (display === \"confirmation\" && options?.toolName) {\n return `eve-approval:${options.toolName}`;\n }\n return `eve-input:${display}`;\n}\n\n/**\n * Map a handled RobotRock task action back to an Eve `InputResponse`.\n */\nexport function taskHandledToEveInputResponse(\n request: EveInputRequest,\n actionId: string,\n actionData: unknown,\n options?: { toolName?: string }\n): EveInputResponse {\n const base = { requestId: request.requestId };\n\n if (isPlatformTerminalAction(actionId)) {\n const feedback = parsePlatformRejectRequestData(actionData)?.feedback;\n return {\n ...base,\n optionId: \"deny\",\n ...(feedback ? { text: feedback } : {}),\n };\n }\n\n const display = resolveEveInputDisplay(request, options?.toolName);\n const selectOptions = request.options ?? [];\n const data = asRecord(actionData);\n\n if (display === \"confirmation\") {\n return { ...base, optionId: actionId };\n }\n\n const matchingOption = selectOptions.find((option) => option.id === actionId);\n if (matchingOption) {\n return { ...base, optionId: actionId };\n }\n\n if (actionId === EVE_INPUT_SUBMIT_ACTION_ID && data) {\n const submissionData =\n display === \"select\" && request.allowFreeform === true\n ? normalizeEveSelectFormData(data)\n : data;\n\n const answer = readStringField(submissionData, \"answer\");\n if (answer) {\n return { ...base, text: answer };\n }\n\n const choice = readStringField(submissionData, \"choice\");\n if (choice === EVE_INPUT_OTHER_CHOICE_ID) {\n const other = readStringField(submissionData, \"other\");\n if (other) {\n return { ...base, text: other };\n }\n }\n\n if (choice) {\n if (selectOptions.some((option) => option.id === choice)) {\n return { ...base, optionId: choice };\n }\n return { ...base, text: choice };\n }\n }\n\n if (data) {\n const answer = readStringField(data, \"answer\");\n if (answer) {\n return { ...base, text: answer };\n }\n }\n\n return { ...base, optionId: actionId };\n}\n","import {\n EVE_INPUT_SUBMIT_ACTION_ID,\n eveInputRequestToActions,\n resolveEveInputDisplay,\n type EveInputOption,\n type EveInputRequest,\n type EveInputRequestDisplay,\n type EveInputResponse,\n} from \"./input-request.js\";\n\nexport type EveInputAuditContext = {\n toolCallId: string;\n toolName?: string;\n requestId?: string;\n display?: EveInputRequestDisplay;\n toolInput?: unknown;\n};\n\nfunction matchOptionByText(\n text: string,\n options: readonly EveInputOption[]\n): EveInputOption | undefined {\n const normalized = text.trim().toLowerCase();\n if (normalized.length === 0) {\n return undefined;\n }\n\n const byId = options.find((option) => option.id.toLowerCase() === normalized);\n if (byId) {\n return byId;\n }\n\n const byLabel = options.find((option) => option.label.toLowerCase() === normalized);\n if (byLabel) {\n return byLabel;\n }\n\n const index = Number(normalized);\n if (Number.isInteger(index) && index > 0 && index <= options.length) {\n return options[index - 1];\n }\n\n return undefined;\n}\n\n/**\n * Map freeform composer text to an Eve `InputResponse`, mirroring Eve's\n * `resolveTextToResponse` rules (option id/label, numeric index, freeform text).\n */\nexport function resolveEveFreeformTextToInputResponse(\n request: EveInputRequest,\n text: string\n): EveInputResponse | undefined {\n const trimmed = text.trim();\n if (trimmed.length === 0) {\n return undefined;\n }\n\n const options = request.options ?? [];\n if (options.length > 0) {\n const matched = matchOptionByText(trimmed, options);\n if (matched) {\n return { requestId: request.requestId, optionId: matched.id };\n }\n }\n\n if (request.allowFreeform === true || options.length === 0) {\n return { requestId: request.requestId, text: trimmed };\n }\n\n return undefined;\n}\n\n/** Returns true for Eve's default approval gate (approve / deny options). */\nexport function isEveApprovalInputRequest(request: EveInputRequest): boolean {\n const options = request.options ?? [];\n return (\n options.length === 2 &&\n options[0]?.id === \"approve\" &&\n options[1]?.id === \"deny\"\n );\n}\n\nexport type EveInputActionSubmission = {\n actionId: string;\n actionTitle: string;\n formData: Record<string, unknown>;\n};\n\n/**\n * Map a resolved Eve `InputResponse` to RobotRock audit fields (action id/title).\n */\nexport function eveInputResponseToActionSubmission(\n request: EveInputRequest,\n response: EveInputResponse,\n options?: { toolName?: string }\n): EveInputActionSubmission {\n const display = resolveEveInputDisplay(request, options?.toolName);\n const actions = eveInputRequestToActions(request, options);\n\n if (response.optionId) {\n const action = actions.find((entry) => entry.id === response.optionId);\n if (action) {\n return {\n actionId: response.optionId,\n actionTitle: action.title,\n formData: {},\n };\n }\n\n const option = request.options?.find((entry) => entry.id === response.optionId);\n if (option) {\n return {\n actionId: response.optionId,\n actionTitle: option.label,\n formData: {},\n };\n }\n\n return {\n actionId: response.optionId,\n actionTitle: response.optionId,\n formData: {},\n };\n }\n\n const text = response.text?.trim();\n if (text) {\n if (display === \"text\") {\n return {\n actionId: EVE_INPUT_SUBMIT_ACTION_ID,\n actionTitle: text,\n formData: { answer: text },\n };\n }\n\n if (display === \"select\") {\n const option = request.options?.find((entry) => entry.id === text);\n if (option) {\n return {\n actionId: EVE_INPUT_SUBMIT_ACTION_ID,\n actionTitle: option.label,\n formData: { choice: option.id },\n };\n }\n return {\n actionId: EVE_INPUT_SUBMIT_ACTION_ID,\n actionTitle: text,\n formData: { choice: text },\n };\n }\n\n return {\n actionId: EVE_INPUT_SUBMIT_ACTION_ID,\n actionTitle: text,\n formData: { answer: text },\n };\n }\n\n return {\n actionId: EVE_INPUT_SUBMIT_ACTION_ID,\n actionTitle: \"Responded\",\n formData: {},\n };\n}\n\n/** Audit payload for `chat_action_input_submitted`. */\nexport function buildEveInputAuditSubmissionData(\n context: EveInputAuditContext,\n formData: Record<string, unknown>\n): Record<string, unknown> {\n return {\n toolCallId: context.toolCallId,\n ...(context.toolName ? { toolName: context.toolName } : {}),\n ...(context.requestId ? { requestId: context.requestId } : {}),\n ...(context.display ? { display: context.display } : {}),\n ...(context.toolInput !== undefined ? { toolInput: context.toolInput } : {}),\n ...formData,\n };\n}\n\n/**\n * Parse an `ask_question` tool result output into an Eve input response shape.\n */\nexport function parseEveAskQuestionToolOutput(\n output: unknown\n): Pick<EveInputResponse, \"optionId\" | \"text\"> | null {\n if (output == null || typeof output !== \"object\") {\n return null;\n }\n\n const record = output as Record<string, unknown>;\n const value =\n record.type === \"json\" && record.value != null && typeof record.value === \"object\"\n ? (record.value as Record<string, unknown>)\n : record;\n\n const optionId = typeof value.optionId === \"string\" ? value.optionId : undefined;\n const text = typeof value.text === \"string\" ? value.text : undefined;\n\n if (!optionId && !text) {\n return null;\n }\n\n return { ...(optionId ? { optionId } : {}), ...(text ? { text } : {}) };\n}\n","const CREATE_INBOX_TASK_TOOL_NAME = \"create_robotrock_task\";\n\nconst SKIP_TOOL_NAMES = new Set([\n CREATE_INBOX_TASK_TOOL_NAME,\n \"ask_question\",\n \"closeChat\",\n \"requestActionInput\",\n]);\n\nexport type ChatToolAuditInput = Record<string, unknown>;\n\nexport type ChatToolAuditPayload = {\n toolCallId: string;\n toolName: string;\n input: ChatToolAuditInput;\n success: boolean;\n status: \"completed\" | \"failed\" | \"rejected\";\n error?: string;\n};\n\n/**\n * Whether a completed tool call should appear on the RobotRock audit trail.\n * Admin mutations are logged via chat-correlated API audit instead.\n */\nexport function shouldAuditToolExecution(\n toolName: string,\n _input: ChatToolAuditInput\n): boolean {\n if (SKIP_TOOL_NAMES.has(toolName)) {\n return false;\n }\n\n return false;\n}\n\nconst AUDIT_INPUT_KEYS = new Set([\n \"action\",\n \"email\",\n \"userId\",\n \"role\",\n \"name\",\n \"groupId\",\n \"description\",\n]);\n\n/** Keep only fields useful for audit display (no secrets or large blobs). */\nexport function sanitizeToolAuditInput(\n input: ChatToolAuditInput\n): ChatToolAuditInput {\n const sanitized: ChatToolAuditInput = {};\n for (const [key, value] of Object.entries(input)) {\n if (!AUDIT_INPUT_KEYS.has(key)) {\n continue;\n }\n if (value == null || value === \"\") {\n continue;\n }\n if (typeof value === \"string\" || typeof value === \"boolean\") {\n sanitized[key] = value;\n continue;\n }\n if (typeof value === \"number\") {\n sanitized[key] = value;\n }\n }\n return sanitized;\n}\n\nexport function buildChatToolAuditPayload(input: {\n toolCallId: string;\n toolName: string;\n toolInput: ChatToolAuditInput;\n status: \"completed\" | \"failed\" | \"rejected\";\n error?: string;\n isError?: boolean;\n}): ChatToolAuditPayload | null {\n const sanitized = sanitizeToolAuditInput(input.toolInput);\n if (!shouldAuditToolExecution(input.toolName, sanitized)) {\n return null;\n }\n\n const success =\n input.status === \"completed\" && input.isError !== true;\n\n return {\n toolCallId: input.toolCallId,\n toolName: input.toolName,\n input: sanitized,\n success,\n status: input.status,\n ...(input.error ? { error: input.error } : {}),\n };\n}\n","import {\n resolveEveInputDisplay,\n type EveInputRequest,\n} from \"./input-request.js\";\n\n/** Default per-tool labels for common Eve demo/integration tools. */\nexport const DEFAULT_TOOL_DISPLAY_LABELS: Readonly<Record<string, string>> = {\n refund_charge: \"Refund a customer charge\",\n deploy_release: \"Deploy a release\",\n get_weather: \"Get weather\",\n get_my_access: \"Check my access\",\n whoami: \"Who am I\",\n create_robotrock_task: \"Create a RobotRock task\",\n search_products: \"Search products\",\n manage_team_members: \"Manage team members\",\n manage_groups: \"Manage groups\",\n query_tasks: \"Query tasks\",\n};\n\nlet toolDisplayLabelOverrides: Readonly<Record<string, string>> = {};\n\n/** Register additional or overriding tool display labels at runtime. */\nexport function setToolDisplayLabelOverrides(\n overrides: Readonly<Record<string, string>>\n): void {\n toolDisplayLabelOverrides = overrides;\n}\n\nfunction formatToolName(toolName: string): string {\n const spaced = toolName\n .replace(/([a-z0-9])([A-Z])/g, \"$1 $2\")\n .replace(/[-_]+/g, \" \")\n .trim();\n\n if (!spaced) {\n return \"Tool\";\n }\n\n return spaced.charAt(0).toUpperCase() + spaced.slice(1);\n}\n\n/** Resolve a user-facing label for a tool slug. */\nexport function getToolDisplayLabel(toolName: string): string {\n const trimmed = toolName.trim();\n if (!trimmed) {\n return \"Tool\";\n }\n\n return (\n toolDisplayLabelOverrides[trimmed] ??\n DEFAULT_TOOL_DISPLAY_LABELS[trimmed] ??\n formatToolName(trimmed)\n );\n}\n\n/** Format an Eve input request prompt for human-facing approval UIs. */\nexport function formatEveApprovalTitle(\n request: EveInputRequest,\n toolName?: string\n): string {\n const display = resolveEveInputDisplay(request, toolName);\n if (display !== \"confirmation\" || !toolName) {\n return request.prompt;\n }\n\n return `Approve: ${getToolDisplayLabel(toolName)}`;\n}\n","import type {\n ToolDisplayEnvelope,\n ToolDisplayMetadata,\n UiSchema,\n} from \"@robotrock/core/schemas\";\n\nexport type ToolDisplayResultOptions = {\n widget?: string;\n title?: string;\n description?: string;\n ui?: Record<string, UiSchema>;\n};\n\n/**\n * Wrap tool execute output with optional dashboard display hints.\n * Agents return plain JSON by default; use this when schema-driven widgets help.\n */\nexport function toolDisplayResult<T extends Record<string, unknown>>(\n data: T,\n options?: ToolDisplayResultOptions\n): ToolDisplayEnvelope<T> {\n const display: ToolDisplayMetadata | undefined =\n options?.widget || options?.title || options?.description\n ? {\n ...(options.widget ? { widget: options.widget } : {}),\n ...(options.title ? { title: options.title } : {}),\n ...(options.description ? { description: options.description } : {}),\n }\n : undefined;\n\n return {\n ...(display ? { display } : {}),\n data,\n ...(options?.ui ? { ui: options.ui } : {}),\n };\n}\n","/** Field name agents read; dashboard widgets must ignore when rendering. */\nexport const TOOL_REPLY_GUIDANCE_FIELD = \"replyGuidance\" as const;\n\nexport const WHOAMI_REPLY_GUIDANCE =\n \"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).\";\n\nexport const MY_ACCESS_REPLY_GUIDANCE =\n \"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 ≥ $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 — do not tell them to find an admin manually without offering delegation first.\";\n\nexport const CREATE_INBOX_TASK_REPLY_GUIDANCE =\n \"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.\";\n\nexport const SEARCH_PRODUCTS_REPLY_GUIDANCE =\n \"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).\";\n\nexport const MANAGE_TEAM_MEMBERS_LIST_REPLY_GUIDANCE =\n \"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).\";\n\nexport const MANAGE_TEAM_MEMBERS_DETAIL_REPLY_GUIDANCE =\n \"Team member details render in chat UI. Do not restate name, email, or role from the card. Only add next steps or policy context.\";\n\nexport const MANAGE_GROUPS_LIST_REPLY_GUIDANCE =\n \"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.\";\n\nexport const MANAGE_GROUPS_DETAIL_REPLY_GUIDANCE =\n \"Group details render in chat UI. Do not restate fields already visible in the card. Only add next steps.\";\n\nexport const QUERY_TASKS_LIST_REPLY_GUIDANCE =\n \"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).\";\n\nexport const QUERY_TASKS_DETAIL_REPLY_GUIDANCE =\n \"Task details render in chat UI. Do not restate fields already visible in the card. Only add analysis or next steps.\";\n\nexport const ASSIGN_TASKS_REPLY_GUIDANCE =\n \"Reassignment results render in chat UI. Do not restate task ids or assignee emails from the card. Only mention failures, partial success, or next steps.\";\n\nexport const REFUND_CHARGE_REPLY_GUIDANCE =\n \"Refund details render in chat UI. Do not restate charge id, amount, or status from the card. Only add policy context or next steps.\";\n\nexport const DEPLOY_RELEASE_REPLY_GUIDANCE =\n \"Deploy details render in chat UI. Do not restate service, version, or environment from the card. Only add rollout context or next steps.\";\n\nexport const GET_WEATHER_REPLY_GUIDANCE =\n \"Weather details render in chat UI. Do not restate city, condition, or temperature from the card. Only add conversational context if needed.\";\n\nexport const ADMIN_MUTATION_REPLY_GUIDANCE =\n \"The action result renders in chat UI. Do not restate fields already visible in the card. Confirm outcome briefly or add next steps only.\";\n\nexport type ToolResultWithReplyGuidance<T extends Record<string, unknown>> = T & {\n replyGuidance: string;\n};\n\n/** Attach model-facing narration hints to a tool execute result. */\nexport function withReplyGuidance<T extends Record<string, unknown>>(\n result: T,\n guidance: string\n): ToolResultWithReplyGuidance<T> {\n return {\n ...result,\n [TOOL_REPLY_GUIDANCE_FIELD]: guidance,\n };\n}\n\n/** Remove agent-only fields before showing raw JSON in the dashboard. */\nexport function stripAgentOnlyToolFields(output: unknown): unknown {\n if (typeof output !== \"object\" || output === null || Array.isArray(output)) {\n return output;\n }\n\n const record = { ...(output as Record<string, unknown>) };\n delete record[TOOL_REPLY_GUIDANCE_FIELD];\n return record;\n}\n","import type { UiSchema } from \"@robotrock/core/schemas\";\nimport { toolDisplayResult } from \"./tool-result-display.js\";\nimport { withReplyGuidance } from \"./tool-reply-guidance.js\";\n\nexport type FormatToolObjectResultOptions = {\n title?: string;\n description?: string;\n ui?: Record<string, UiSchema>;\n replyGuidance: string;\n};\n\nexport type FormatToolListResultOptions = {\n title: string;\n itemUi?: UiSchema;\n /** Composite widget for each row (uses list layout instead of table). */\n itemWidget?: string;\n replyGuidance: string;\n};\n\n/** Wrap a flat object for schema-driven chat rendering. */\nexport function formatToolObjectResult(\n data: Record<string, unknown>,\n options: FormatToolObjectResultOptions\n) {\n return withReplyGuidance(\n toolDisplayResult(data, {\n title: options.title,\n description: options.description,\n ui: options.ui,\n }),\n options.replyGuidance\n );\n}\n\n/** Wrap an array field as a list widget inside a display envelope. */\nexport function formatToolListResult(\n listKey: string,\n items: Record<string, unknown>[],\n options: FormatToolListResultOptions\n) {\n const listFieldUi = options.itemWidget\n ? {\n \"ui:widget\": \"list\" as const,\n items: {\n \"ui:widget\": options.itemWidget,\n ...(options.itemUi ?? {}),\n },\n }\n : {\n \"ui:widget\": \"table\" as const,\n ...(options.itemUi ? { items: options.itemUi } : {}),\n };\n\n return formatToolObjectResult(\n { [listKey]: items },\n {\n title: options.title,\n ui: {\n [listKey]: listFieldUi,\n },\n replyGuidance: options.replyGuidance,\n }\n );\n}\n\nexport function isAgentAdminErrorResult(\n result: unknown\n): result is { ok: false; message: string } {\n return (\n typeof result === \"object\" &&\n result !== null &&\n (result as { ok?: unknown }).ok === false &&\n typeof (result as { message?: unknown }).message === \"string\"\n );\n}\n","import type { RobotRockWebhookPayload } from \"../webhook.js\";\n\n/** Build the assistant resume prompt when an inbox task linked to a chat is handled. */\nexport function buildTaskHandledResumeMessage(\n payload: RobotRockWebhookPayload\n): string {\n const handledBy = payload.handledBy?.trim() || \"someone\";\n const actionTitle = payload.action.title.trim();\n return `RobotRock task ${payload.taskId} was handled: ${actionTitle} by ${handledBy}. Briefly tell the user what was decided and what happens next.`;\n}\n","export {\n EVE_INPUT_OTHER_CHOICE_ID,\n EVE_INPUT_OTHER_CHOICE_LABEL,\n EVE_INPUT_SUBMIT_ACTION_ID,\n eveInputRequestTaskType,\n eveInputRequestToActions,\n normalizeEveSelectFormData,\n resolveEveInputDisplay,\n taskHandledToEveInputResponse,\n type EveInputOption,\n type EveInputRequest,\n type EveInputRequestDisplay,\n type EveInputResponse,\n} from \"./input-request.js\";\nexport {\n buildEveInputAuditSubmissionData,\n eveInputResponseToActionSubmission,\n isEveApprovalInputRequest,\n parseEveAskQuestionToolOutput,\n resolveEveFreeformTextToInputResponse,\n type EveInputActionSubmission,\n type EveInputAuditContext,\n} from \"./input-audit.js\";\nexport {\n buildChatToolAuditPayload,\n sanitizeToolAuditInput,\n shouldAuditToolExecution,\n type ChatToolAuditInput,\n type ChatToolAuditPayload,\n} from \"./tool-audit.js\";\nexport {\n DEFAULT_TOOL_DISPLAY_LABELS,\n formatEveApprovalTitle,\n getToolDisplayLabel,\n setToolDisplayLabelOverrides,\n} from \"./tool-display.js\";\nexport {\n toolDisplayResult,\n type ToolDisplayResultOptions,\n} from \"./tool-result-display.js\";\nexport {\n formatToolListResult,\n formatToolObjectResult,\n isAgentAdminErrorResult,\n type FormatToolListResultOptions,\n type FormatToolObjectResultOptions,\n} from \"./tool-display-format.js\";\nexport {\n CREATE_INBOX_TASK_REPLY_GUIDANCE,\n MY_ACCESS_REPLY_GUIDANCE,\n SEARCH_PRODUCTS_REPLY_GUIDANCE,\n MANAGE_TEAM_MEMBERS_LIST_REPLY_GUIDANCE,\n MANAGE_TEAM_MEMBERS_DETAIL_REPLY_GUIDANCE,\n MANAGE_GROUPS_LIST_REPLY_GUIDANCE,\n MANAGE_GROUPS_DETAIL_REPLY_GUIDANCE,\n QUERY_TASKS_LIST_REPLY_GUIDANCE,\n QUERY_TASKS_DETAIL_REPLY_GUIDANCE,\n REFUND_CHARGE_REPLY_GUIDANCE,\n DEPLOY_RELEASE_REPLY_GUIDANCE,\n GET_WEATHER_REPLY_GUIDANCE,\n ADMIN_MUTATION_REPLY_GUIDANCE,\n TOOL_REPLY_GUIDANCE_FIELD,\n WHOAMI_REPLY_GUIDANCE,\n stripAgentOnlyToolFields,\n withReplyGuidance,\n type ToolResultWithReplyGuidance,\n} from \"./tool-reply-guidance.js\";\n/** Hook slug advertised in GET /eve/v1/info for RobotRock-ready auto-detection. */\nexport const ROBOTROCK_READY_HOOK_SLUG = \"robotrock-ready\";\n\nexport { buildTaskHand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AA,MACtB,OAAO,QAAQ;AAAA,MACf,aAAa,QAAQ;AAAA,MACrB,IAAI,QAAQ;AAAA,IACd,CAAC;AAAA,IACD,QAAQ;AAAA,EACV;AACF;AAGO,SAAS,qBACd,SACA,OACA,SACA;AACA,QAAM,cAAc,QAAQ,aACxB;AAAA,IACE,aAAa;AAAA,IACb,OAAO;AAAA,MACL,aAAa,QAAQ;AAAA,MACrB,GAAI,QAAQ,UAAU,CAAC;AAAA,IACzB;AAAA,EACF,IACA;AAAA,IACE,aAAa;AAAA,IACb,GAAI,QAAQ,SAAS,EAAE,OAAO,QAAQ,OAAO,IAAI,CAAC;AAAA,EACpD;AAEJ,SAAO;AAAA,IACL,EAAE,CAAC,OAAO,GAAG,MAAM;AAAA,IACnB;AAAA,MACE,OAAO,QAAQ;AAAA,MACf,IAAI;AAAA,QACF,CAAC,OAAO,GAAG;AAAA,MACb;AAAA,MACA,eAAe,QAAQ;AAAA,IACzB;AAAA,EACF;AACF;AAEO,SAAS,wBACd,QAC0C;AAC1C,SACE,OAAO,WAAW,YAClB,WAAW,QACV,OAA4B,OAAO,SACpC,OAAQ,OAAiC,YAAY;AAEzD;;;ACvEO,SAAS,8BACd,SACQ;AACR,QAAM,YAAY,QAAQ,WAAW,KAAK,KAAK;AAC/C,QAAM,cAAc,QAAQ,OAAO,MAAM,KAAK;AAC9C,SAAO,kBAAkB,QAAQ,MAAM,iBAAiB,WAAW,OAAO,SAAS;AACrF;;;AC2DO,IAAM,4BAA4B;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../core/src/utils/decode-html-entities.ts","../../src/platform-actions.ts","../../src/eve/input-request.ts","../../src/eve/input-audit.ts","../../src/eve/tool-audit.ts","../../src/eve/tool-display.ts","../../src/eve/tool-result-display.ts","../../src/eve/tool-ui-hint.ts","../../src/eve/tool-reply-guidance.ts","../../src/eve/tool-display-format.ts","../../src/eve/resume-message.ts","../../src/eve/index.ts"],"sourcesContent":["/** Decode common HTML entities for UI display (inverse of email/HTML escaping). */\nexport function decodeHtmlEntities(value: string): string {\n return value\n .replace(/&/g, \"&\")\n .replace(/</g, \"<\")\n .replace(/>/g, \">\")\n .replace(/"/g, '\"')\n .replace(/'/g, \"'\")\n .replace(/'/g, \"'\")\n .replace(/&#(\\d+);/g, (_, code) => String.fromCharCode(Number(code)))\n .replace(/&#x([0-9a-f]+);/gi, (_, code) =>\n String.fromCharCode(parseInt(code, 16))\n );\n}\n","/**\n * Reserved inbox actions that reviewers can take outside your task's defined actions.\n * Agents and integrations must treat these as terminal — stop the run and do not retry sendToHuman.\n */\n\nexport const PLATFORM_MARK_DONE_ACTION_ID = \"robotrock:mark-done\" as const;\nexport const PLATFORM_REJECT_REQUEST_ACTION_ID = \"robotrock:reject-request\" as const;\n\nexport const PLATFORM_MARK_DONE_ACTION_TITLE = \"Mark as done\";\nexport const PLATFORM_REJECT_REQUEST_ACTION_TITLE = \"Reject request\";\n\nexport const PLATFORM_TERMINAL_ACTION_IDS = [\n PLATFORM_MARK_DONE_ACTION_ID,\n PLATFORM_REJECT_REQUEST_ACTION_ID,\n] as const;\n\nexport type PlatformTerminalActionId = (typeof PLATFORM_TERMINAL_ACTION_IDS)[number];\n\nexport type PlatformRejectRequestData = {\n feedback: string;\n};\n\nexport type HandledActionInput = {\n actionId: string;\n data?: unknown;\n handledBy?: string;\n handledAt?: number | Date;\n};\n\nexport type PlatformMarkDoneOutcome = {\n source: \"platform\";\n kind: \"mark-done\";\n actionId: typeof PLATFORM_MARK_DONE_ACTION_ID;\n data: Record<string, never>;\n handledBy?: string;\n handledAt?: Date;\n};\n\nexport type PlatformRejectRequestOutcome = {\n source: \"platform\";\n kind: \"reject-request\";\n actionId: typeof PLATFORM_REJECT_REQUEST_ACTION_ID;\n data: PlatformRejectRequestData;\n handledBy?: string;\n handledAt?: Date;\n};\n\nexport type TaskActionOutcome = {\n source: \"task\";\n actionId: string;\n data: unknown;\n handledBy?: string;\n handledAt?: Date;\n};\n\nexport type HandledOutcome =\n | PlatformMarkDoneOutcome\n | PlatformRejectRequestOutcome\n | TaskActionOutcome;\n\nexport class PlatformRejectRequestError extends Error {\n readonly actionId = PLATFORM_REJECT_REQUEST_ACTION_ID;\n readonly feedback: string;\n\n constructor(feedback: string, message?: string) {\n super(message ?? `Human rejected the request: ${feedback}`);\n this.name = \"PlatformRejectRequestError\";\n this.feedback = feedback;\n }\n}\n\nexport function isPlatformMarkDoneAction(\n actionId: string | undefined\n): actionId is typeof PLATFORM_MARK_DONE_ACTION_ID {\n return actionId === PLATFORM_MARK_DONE_ACTION_ID;\n}\n\nexport function isPlatformRejectRequestAction(\n actionId: string | undefined\n): actionId is typeof PLATFORM_REJECT_REQUEST_ACTION_ID {\n return actionId === PLATFORM_REJECT_REQUEST_ACTION_ID;\n}\n\nexport function isPlatformTerminalAction(\n actionId: string | undefined\n): actionId is PlatformTerminalActionId {\n return (\n isPlatformMarkDoneAction(actionId) || isPlatformRejectRequestAction(actionId)\n );\n}\n\nexport function parsePlatformRejectRequestData(\n data: unknown\n): PlatformRejectRequestData | null {\n if (data == null || typeof data !== \"object\") {\n return null;\n }\n const feedback = (data as { feedback?: unknown }).feedback;\n if (typeof feedback !== \"string\") {\n return null;\n }\n const trimmed = feedback.trim();\n if (!trimmed) {\n return null;\n }\n return { feedback: trimmed };\n}\n\nfunction toHandledAt(value: number | Date | undefined): Date | undefined {\n if (value === undefined) {\n return undefined;\n }\n return value instanceof Date ? value : new Date(value);\n}\n\n/**\n * Classify a handled task action as a platform terminal outcome or a normal task action.\n */\nexport function parseHandledOutcome(input: HandledActionInput): HandledOutcome {\n const handledAt = toHandledAt(input.handledAt);\n const handledBy = input.handledBy;\n\n if (isPlatformMarkDoneAction(input.actionId)) {\n return {\n source: \"platform\",\n kind: \"mark-done\",\n actionId: PLATFORM_MARK_DONE_ACTION_ID,\n data: {},\n handledBy,\n handledAt,\n };\n }\n\n if (isPlatformRejectRequestAction(input.actionId)) {\n return {\n source: \"platform\",\n kind: \"reject-request\",\n actionId: PLATFORM_REJECT_REQUEST_ACTION_ID,\n data: parsePlatformRejectRequestData(input.data) ?? { feedback: \"\" },\n handledBy,\n handledAt,\n };\n }\n\n return {\n source: \"task\",\n actionId: input.actionId,\n data: input.data ?? {},\n handledBy,\n handledAt,\n };\n}\n\n/**\n * Throw when a human rejected the request from the inbox (not your task's reject action).\n * Use after polling, webhooks, or getTask when you want agents to stop immediately.\n */\nexport function assertNotPlatformRejectRequest(\n actionId: string,\n data?: unknown\n): void {\n if (!isPlatformRejectRequestAction(actionId)) {\n return;\n }\n const parsed = parsePlatformRejectRequestData(data);\n throw new PlatformRejectRequestError(\n parsed?.feedback ?? \"No feedback provided\"\n );\n}\n\n/**\n * Returns true when the agent should stop — platform mark-done or reject-request.\n */\nexport function shouldStopAgentForHandledAction(actionId: string | undefined): boolean {\n return isPlatformTerminalAction(actionId);\n}\n","import type { SendToHumanActionInput } from \"../client.js\";\nimport { decodeHtmlEntities } from \"@robotrock/core/utils\";\nimport {\n isPlatformTerminalAction,\n parsePlatformRejectRequestData,\n} from \"../platform-actions.js\";\n\n/** One selectable option in an Eve HITL input request. */\nexport type EveInputOption = {\n readonly id: string;\n readonly label: string;\n readonly description?: string;\n readonly style?: \"danger\" | \"default\" | \"primary\";\n};\n\n/** Eve HITL display mode — mirrors `InputRequest.display` from the eve runtime. */\nexport type EveInputRequestDisplay = \"confirmation\" | \"select\" | \"text\";\n\n/**\n * Minimal Eve `InputRequest` shape for RobotRock bridging. Intentionally\n * self-contained so the SDK does not depend on the `eve` package.\n */\nexport type EveInputRequest = {\n readonly requestId: string;\n readonly prompt: string;\n readonly display?: EveInputRequestDisplay;\n readonly allowFreeform?: boolean;\n readonly options?: readonly EveInputOption[];\n};\n\n/** Eve `InputResponse` shape returned when resuming a parked session. */\nexport type EveInputResponse = {\n readonly requestId: string;\n readonly optionId?: string;\n readonly text?: string;\n};\n\nexport const EVE_INPUT_SUBMIT_ACTION_ID = \"submit\" as const;\nexport const EVE_INPUT_OTHER_CHOICE_ID = \"__other__\" as const;\nexport const EVE_INPUT_OTHER_CHOICE_LABEL = \"Type your own answer\" as const;\n\nconst CONFIRMATION_DEFAULT_OPTIONS: readonly EveInputOption[] = [\n { id: \"approve\", label: \"Approve\", style: \"primary\" },\n { id: \"deny\", label: \"Deny\", style: \"danger\" },\n];\n\nconst SELECT_PER_OPTION_THRESHOLD = 6;\n\nfunction asRecord(value: unknown): Record<string, unknown> | null {\n if (value == null || typeof value !== \"object\" || Array.isArray(value)) {\n return null;\n }\n return value as Record<string, unknown>;\n}\n\nfunction readStringField(data: Record<string, unknown>, key: string): string | undefined {\n const value = data[key];\n if (typeof value !== \"string\") {\n return undefined;\n }\n const trimmed = value.trim();\n return trimmed.length > 0 ? trimmed : undefined;\n}\n\nfunction decodeDisplayText(value: string): string {\n return decodeHtmlEntities(value);\n}\n\n/** Resolve the effective display mode when Eve omits `display`. */\nexport function resolveEveInputDisplay(\n request: EveInputRequest,\n toolName?: string\n): EveInputRequestDisplay {\n if (request.display) {\n return request.display;\n }\n if (toolName === \"ask_question\") {\n return request.options && request.options.length > 0 ? \"select\" : \"text\";\n }\n if (request.options && request.options.length > 0) {\n return \"select\";\n }\n return \"confirmation\";\n}\n\nfunction confirmationActions(request: EveInputRequest): readonly SendToHumanActionInput[] {\n const options =\n request.options && request.options.length > 0\n ? request.options\n : CONFIRMATION_DEFAULT_OPTIONS;\n\n return options.map((option) => ({\n id: option.id,\n title: decodeDisplayText(option.label),\n ...(option.description\n ? { description: decodeDisplayText(option.description) }\n : {}),\n }));\n}\n\nfunction textSubmitAction(prompt: string): SendToHumanActionInput {\n const decodedPrompt = decodeDisplayText(prompt);\n return {\n id: EVE_INPUT_SUBMIT_ACTION_ID,\n title: \"Submit\",\n schema: {\n type: \"object\",\n required: [\"answer\"],\n properties: {\n answer: {\n type: \"string\",\n title: \"Your answer\",\n },\n },\n },\n ui: {\n answer: {\n \"ui:title\": decodedPrompt.trim() || \"Your answer\",\n \"ui:widget\": \"textarea\",\n },\n },\n };\n}\n\nfunction selectPerOptionActions(\n options: readonly EveInputOption[]\n): readonly SendToHumanActionInput[] {\n return options.map((option) => ({\n id: option.id,\n title: decodeDisplayText(option.label),\n ...(option.description\n ? { description: decodeDisplayText(option.description) }\n : {}),\n }));\n}\n\nfunction selectFormAction(request: EveInputRequest): SendToHumanActionInput {\n const options = request.options ?? [];\n const allowFreeform = request.allowFreeform === true;\n const enumValues = options.map((option) => option.id);\n const enumNames = options.map((option) => decodeDisplayText(option.label));\n\n if (allowFreeform) {\n enumValues.push(EVE_INPUT_OTHER_CHOICE_ID);\n enumNames.push(EVE_INPUT_OTHER_CHOICE_LABEL);\n }\n\n const properties: Record<string, unknown> = {\n choice: {\n type: \"string\",\n title: \"Choose one\",\n enum: enumValues,\n },\n };\n\n if (allowFreeform) {\n properties.other = {\n type: \"string\",\n title: \"Your answer\",\n };\n }\n\n const schema: Record<string, unknown> = {\n type: \"object\",\n required: [\"choice\"],\n properties,\n };\n\n if (allowFreeform) {\n schema.allOf = [\n {\n if: {\n properties: {\n choice: { const: EVE_INPUT_OTHER_CHOICE_ID },\n },\n required: [\"choice\"],\n },\n then: {\n required: [\"other\"],\n properties: {\n other: {\n type: \"string\",\n minLength: 1,\n },\n },\n },\n },\n ];\n }\n\n const ui: Record<string, unknown> = {\n choice: {\n \"ui:widget\": \"radio\",\n \"ui:enumNames\": enumNames,\n },\n };\n\n if (allowFreeform) {\n ui.other = {\n \"ui:placeholder\": \"Enter your answer\",\n };\n }\n\n return {\n id: EVE_INPUT_SUBMIT_ACTION_ID,\n title: \"Submit\",\n schema: schema as SendToHumanActionInput[\"schema\"],\n ui: ui as SendToHumanActionInput[\"ui\"],\n };\n}\n\n/** Keep select-form submissions mutually exclusive between preset choice and freeform other. */\nexport function normalizeEveSelectFormData(\n data: Record<string, unknown>\n): Record<string, unknown> {\n const choice =\n typeof data.choice === \"string\" ? data.choice.trim() : undefined;\n if (!choice) {\n return data;\n }\n if (choice === EVE_INPUT_OTHER_CHOICE_ID) {\n return {\n choice,\n ...(data.other !== undefined ? { other: data.other } : {}),\n };\n }\n return { choice };\n}\n\n/**\n * Map an Eve `InputRequest` to RobotRock inbox actions.\n */\nexport function eveInputRequestToActions(\n request: EveInputRequest,\n options?: { toolName?: string }\n): readonly SendToHumanActionInput[] {\n const display = resolveEveInputDisplay(request, options?.toolName);\n\n switch (display) {\n case \"confirmation\":\n return confirmationActions(request);\n case \"text\":\n return [textSubmitAction(request.prompt)];\n case \"select\": {\n const selectOptions = request.options ?? [];\n if (selectOptions.length === 0) {\n return [textSubmitAction(request.prompt)];\n }\n if (\n selectOptions.length <= SELECT_PER_OPTION_THRESHOLD &&\n request.allowFreeform !== true\n ) {\n return selectPerOptionActions(selectOptions);\n }\n return [selectFormAction(request)];\n }\n }\n}\n\n/** Task type slug for an Eve input request. */\nexport function eveInputRequestTaskType(\n request: EveInputRequest,\n options?: { toolName?: string }\n): string {\n const display = resolveEveInputDisplay(request, options?.toolName);\n if (display === \"confirmation\" && options?.toolName) {\n return `eve-approval:${options.toolName}`;\n }\n return `eve-input:${display}`;\n}\n\n/**\n * Map a handled RobotRock task action back to an Eve `InputResponse`.\n */\nexport function taskHandledToEveInputResponse(\n request: EveInputRequest,\n actionId: string,\n actionData: unknown,\n options?: { toolName?: string }\n): EveInputResponse {\n const base = { requestId: request.requestId };\n\n if (isPlatformTerminalAction(actionId)) {\n const feedback = parsePlatformRejectRequestData(actionData)?.feedback;\n return {\n ...base,\n optionId: \"deny\",\n ...(feedback ? { text: feedback } : {}),\n };\n }\n\n const display = resolveEveInputDisplay(request, options?.toolName);\n const selectOptions = request.options ?? [];\n const data = asRecord(actionData);\n\n if (display === \"confirmation\") {\n return { ...base, optionId: actionId };\n }\n\n const matchingOption = selectOptions.find((option) => option.id === actionId);\n if (matchingOption) {\n return { ...base, optionId: actionId };\n }\n\n if (actionId === EVE_INPUT_SUBMIT_ACTION_ID && data) {\n const submissionData =\n display === \"select\" && request.allowFreeform === true\n ? normalizeEveSelectFormData(data)\n : data;\n\n const answer = readStringField(submissionData, \"answer\");\n if (answer) {\n return { ...base, text: answer };\n }\n\n const choice = readStringField(submissionData, \"choice\");\n if (choice === EVE_INPUT_OTHER_CHOICE_ID) {\n const other = readStringField(submissionData, \"other\");\n if (other) {\n return { ...base, text: other };\n }\n }\n\n if (choice) {\n if (selectOptions.some((option) => option.id === choice)) {\n return { ...base, optionId: choice };\n }\n return { ...base, text: choice };\n }\n }\n\n if (data) {\n const answer = readStringField(data, \"answer\");\n if (answer) {\n return { ...base, text: answer };\n }\n }\n\n return { ...base, optionId: actionId };\n}\n","import {\n EVE_INPUT_SUBMIT_ACTION_ID,\n eveInputRequestToActions,\n resolveEveInputDisplay,\n type EveInputOption,\n type EveInputRequest,\n type EveInputRequestDisplay,\n type EveInputResponse,\n} from \"./input-request.js\";\n\nexport type EveInputAuditContext = {\n toolCallId: string;\n toolName?: string;\n requestId?: string;\n display?: EveInputRequestDisplay;\n toolInput?: unknown;\n};\n\nfunction matchOptionByText(\n text: string,\n options: readonly EveInputOption[]\n): EveInputOption | undefined {\n const normalized = text.trim().toLowerCase();\n if (normalized.length === 0) {\n return undefined;\n }\n\n const byId = options.find((option) => option.id.toLowerCase() === normalized);\n if (byId) {\n return byId;\n }\n\n const byLabel = options.find((option) => option.label.toLowerCase() === normalized);\n if (byLabel) {\n return byLabel;\n }\n\n const index = Number(normalized);\n if (Number.isInteger(index) && index > 0 && index <= options.length) {\n return options[index - 1];\n }\n\n return undefined;\n}\n\n/**\n * Map freeform composer text to an Eve `InputResponse`, mirroring Eve's\n * `resolveTextToResponse` rules (option id/label, numeric index, freeform text).\n */\nexport function resolveEveFreeformTextToInputResponse(\n request: EveInputRequest,\n text: string\n): EveInputResponse | undefined {\n const trimmed = text.trim();\n if (trimmed.length === 0) {\n return undefined;\n }\n\n const options = request.options ?? [];\n if (options.length > 0) {\n const matched = matchOptionByText(trimmed, options);\n if (matched) {\n return { requestId: request.requestId, optionId: matched.id };\n }\n }\n\n if (request.allowFreeform === true || options.length === 0) {\n return { requestId: request.requestId, text: trimmed };\n }\n\n return undefined;\n}\n\n/** Returns true for Eve's default approval gate (approve / deny options). */\nexport function isEveApprovalInputRequest(request: EveInputRequest): boolean {\n const options = request.options ?? [];\n return (\n options.length === 2 &&\n options[0]?.id === \"approve\" &&\n options[1]?.id === \"deny\"\n );\n}\n\nexport type EveInputActionSubmission = {\n actionId: string;\n actionTitle: string;\n formData: Record<string, unknown>;\n};\n\nfunction buildOptionIdFormData(\n display: EveInputRequestDisplay | undefined,\n optionId: string\n): Record<string, unknown> {\n if (display === \"select\" || display === \"confirmation\") {\n return { choice: optionId };\n }\n return {};\n}\n\n/**\n * Map a resolved Eve `InputResponse` to RobotRock audit fields (action id/title).\n */\nexport function eveInputResponseToActionSubmission(\n request: EveInputRequest,\n response: EveInputResponse,\n options?: { toolName?: string }\n): EveInputActionSubmission {\n const display = resolveEveInputDisplay(request, options?.toolName);\n const actions = eveInputRequestToActions(request, options);\n\n if (response.optionId) {\n const action = actions.find((entry) => entry.id === response.optionId);\n if (action) {\n return {\n actionId: response.optionId,\n actionTitle: action.title,\n formData: buildOptionIdFormData(display, response.optionId),\n };\n }\n\n const option = request.options?.find((entry) => entry.id === response.optionId);\n if (option) {\n return {\n actionId: response.optionId,\n actionTitle: option.label,\n formData: buildOptionIdFormData(display, response.optionId),\n };\n }\n\n return {\n actionId: response.optionId,\n actionTitle: response.optionId,\n formData: buildOptionIdFormData(display, response.optionId),\n };\n }\n\n const text = response.text?.trim();\n if (text) {\n if (display === \"text\") {\n return {\n actionId: EVE_INPUT_SUBMIT_ACTION_ID,\n actionTitle: text,\n formData: { answer: text },\n };\n }\n\n if (display === \"select\") {\n const option = request.options?.find((entry) => entry.id === text);\n if (option) {\n return {\n actionId: EVE_INPUT_SUBMIT_ACTION_ID,\n actionTitle: option.label,\n formData: { choice: option.id },\n };\n }\n return {\n actionId: EVE_INPUT_SUBMIT_ACTION_ID,\n actionTitle: text,\n formData: { choice: text },\n };\n }\n\n return {\n actionId: EVE_INPUT_SUBMIT_ACTION_ID,\n actionTitle: text,\n formData: { answer: text },\n };\n }\n\n return {\n actionId: EVE_INPUT_SUBMIT_ACTION_ID,\n actionTitle: \"Responded\",\n formData: {},\n };\n}\n\n/** Audit payload for `chat_action_input_submitted`. */\nexport function buildEveInputAuditSubmissionData(\n context: EveInputAuditContext,\n formData: Record<string, unknown>\n): Record<string, unknown> {\n return {\n toolCallId: context.toolCallId,\n ...(context.toolName ? { toolName: context.toolName } : {}),\n ...(context.requestId ? { requestId: context.requestId } : {}),\n ...(context.display ? { display: context.display } : {}),\n ...(context.toolInput !== undefined ? { toolInput: context.toolInput } : {}),\n ...formData,\n };\n}\n\n/**\n * Parse an `ask_question` tool result output into an Eve input response shape.\n */\nexport function parseEveAskQuestionToolOutput(\n output: unknown\n): Pick<EveInputResponse, \"optionId\" | \"text\"> | null {\n if (output == null || typeof output !== \"object\") {\n return null;\n }\n\n const record = output as Record<string, unknown>;\n const value =\n record.type === \"json\" && record.value != null && typeof record.value === \"object\"\n ? (record.value as Record<string, unknown>)\n : record;\n\n const optionId = typeof value.optionId === \"string\" ? value.optionId : undefined;\n const text = typeof value.text === \"string\" ? value.text : undefined;\n\n if (!optionId && !text) {\n return null;\n }\n\n return { ...(optionId ? { optionId } : {}), ...(text ? { text } : {}) };\n}\n","const CREATE_INBOX_TASK_TOOL_NAME = \"create_robotrock_task\";\n\nconst SKIP_TOOL_NAMES = new Set([\n CREATE_INBOX_TASK_TOOL_NAME,\n \"ask_question\",\n \"closeChat\",\n \"requestActionInput\",\n]);\n\nexport type ChatToolAuditInput = Record<string, unknown>;\n\nexport type ChatToolAuditPayload = {\n toolCallId: string;\n toolName: string;\n input: ChatToolAuditInput;\n success: boolean;\n status: \"completed\" | \"failed\" | \"rejected\";\n error?: string;\n};\n\n/**\n * Whether a completed tool call should appear on the RobotRock audit trail.\n * Admin mutations are logged via chat-correlated API audit instead.\n */\nexport function shouldAuditToolExecution(\n toolName: string,\n _input: ChatToolAuditInput\n): boolean {\n if (SKIP_TOOL_NAMES.has(toolName)) {\n return false;\n }\n\n return false;\n}\n\nconst AUDIT_INPUT_KEYS = new Set([\n \"action\",\n \"email\",\n \"userId\",\n \"role\",\n \"name\",\n \"groupId\",\n \"description\",\n]);\n\n/** Keep only fields useful for audit display (no secrets or large blobs). */\nexport function sanitizeToolAuditInput(\n input: ChatToolAuditInput\n): ChatToolAuditInput {\n const sanitized: ChatToolAuditInput = {};\n for (const [key, value] of Object.entries(input)) {\n if (!AUDIT_INPUT_KEYS.has(key)) {\n continue;\n }\n if (value == null || value === \"\") {\n continue;\n }\n if (typeof value === \"string\" || typeof value === \"boolean\") {\n sanitized[key] = value;\n continue;\n }\n if (typeof value === \"number\") {\n sanitized[key] = value;\n }\n }\n return sanitized;\n}\n\nexport function buildChatToolAuditPayload(input: {\n toolCallId: string;\n toolName: string;\n toolInput: ChatToolAuditInput;\n status: \"completed\" | \"failed\" | \"rejected\";\n error?: string;\n isError?: boolean;\n}): ChatToolAuditPayload | null {\n const sanitized = sanitizeToolAuditInput(input.toolInput);\n if (!shouldAuditToolExecution(input.toolName, sanitized)) {\n return null;\n }\n\n const success =\n input.status === \"completed\" && input.isError !== true;\n\n return {\n toolCallId: input.toolCallId,\n toolName: input.toolName,\n input: sanitized,\n success,\n status: input.status,\n ...(input.error ? { error: input.error } : {}),\n };\n}\n","import {\n resolveEveInputDisplay,\n type EveInputRequest,\n} from \"./input-request.js\";\nimport { decodeHtmlEntities } from \"@robotrock/core/utils\";\n\n/** Default per-tool labels for common Eve demo/integration tools. */\nexport const DEFAULT_TOOL_DISPLAY_LABELS: Readonly<Record<string, string>> = {\n refund_charge: \"Refund a customer charge\",\n deploy_release: \"Deploy a release\",\n get_weather: \"Get weather\",\n get_my_access: \"Check my access\",\n whoami: \"Who am I\",\n create_robotrock_task: \"Create a RobotRock task\",\n search_products: \"Search products\",\n manage_team_members: \"Manage team members\",\n manage_groups: \"Manage groups\",\n query_tasks: \"Query tasks\",\n};\n\nlet toolDisplayLabelOverrides: Readonly<Record<string, string>> = {};\n\n/** Register additional or overriding tool display labels at runtime. */\nexport function setToolDisplayLabelOverrides(\n overrides: Readonly<Record<string, string>>\n): void {\n toolDisplayLabelOverrides = overrides;\n}\n\nfunction formatToolName(toolName: string): string {\n const spaced = toolName\n .replace(/([a-z0-9])([A-Z])/g, \"$1 $2\")\n .replace(/[-_]+/g, \" \")\n .trim();\n\n if (!spaced) {\n return \"Tool\";\n }\n\n return spaced.charAt(0).toUpperCase() + spaced.slice(1);\n}\n\n/** Resolve a user-facing label for a tool slug. */\nexport function getToolDisplayLabel(toolName: string): string {\n const trimmed = toolName.trim();\n if (!trimmed) {\n return \"Tool\";\n }\n\n return (\n toolDisplayLabelOverrides[trimmed] ??\n DEFAULT_TOOL_DISPLAY_LABELS[trimmed] ??\n formatToolName(trimmed)\n );\n}\n\n/** Format an Eve input request prompt for human-facing approval UIs. */\nexport function formatEveApprovalTitle(\n request: EveInputRequest,\n toolName?: string\n): string {\n const display = resolveEveInputDisplay(request, toolName);\n if (display !== \"confirmation\" || !toolName) {\n return decodeHtmlEntities(request.prompt);\n }\n\n return `Approve: ${getToolDisplayLabel(toolName)}`;\n}\n","import type {\n ToolDisplayEnvelope,\n ToolDisplayMetadata,\n UiSchema,\n} from \"@robotrock/core/schemas\";\n\nexport type ToolDisplayResultOptions = {\n widget?: string;\n title?: string;\n description?: string;\n ui?: Record<string, UiSchema>;\n};\n\n/**\n * @deprecated Tool results should return plain JSON. Display envelopes are ignored\n * by the dashboard TRL renderer. Kept for backwards-compatible call sites.\n */\nexport function toolDisplayResult<T extends Record<string, unknown>>(\n data: T,\n _options?: ToolDisplayResultOptions\n): T {\n return data;\n}\n\nexport type { ToolDisplayEnvelope, ToolDisplayMetadata, UiSchema };\n","/** Field name for optional layout hints on tool execute results. */\nexport const TOOL_UI_HINT_FIELD = \"uiHint\" as const;\n\n/** Top-level layout hint for RobotRock TRL rendering. Optional — omit to let the dashboard infer. */\nexport type ToolUiHint = \"list\" | \"chart\" | \"table\";\n\nconst TOOL_UI_HINTS = new Set<ToolUiHint>([\"list\", \"chart\", \"table\"]);\n\nexport function isToolUiHint(value: unknown): value is ToolUiHint {\n return typeof value === \"string\" && TOOL_UI_HINTS.has(value as ToolUiHint);\n}\n\n/** Attach an optional layout hint to a tool execute result. */\nexport function withUiHint<T extends Record<string, unknown>>(\n result: T,\n hint: ToolUiHint\n): T & { uiHint: ToolUiHint } {\n return {\n ...result,\n [TOOL_UI_HINT_FIELD]: hint,\n };\n}\n\n/** Read a validated layout hint from tool output; unknown values are ignored. */\nexport function extractToolUiHint(output: unknown): ToolUiHint | undefined {\n if (typeof output !== \"object\" || output === null || Array.isArray(output)) {\n return undefined;\n }\n\n const hint = (output as Record<string, unknown>)[TOOL_UI_HINT_FIELD];\n return isToolUiHint(hint) ? hint : undefined;\n}\n","import { TOOL_UI_HINT_FIELD } from \"./tool-ui-hint.js\";\n\n/** Field name agents read; dashboard widgets must ignore when rendering. */\nexport const TOOL_REPLY_GUIDANCE_FIELD = \"replyGuidance\" as const;\n\nexport const WHOAMI_REPLY_GUIDANCE =\n \"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).\";\n\nexport const MY_ACCESS_REPLY_GUIDANCE =\n \"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 ≥ $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 — do not tell them to find an admin manually without offering delegation first.\";\n\nexport const CREATE_INBOX_TASK_REPLY_GUIDANCE =\n \"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.\";\n\nexport const SEARCH_PRODUCTS_REPLY_GUIDANCE =\n \"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).\";\n\nexport const MANAGE_TEAM_MEMBERS_LIST_REPLY_GUIDANCE =\n \"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).\";\n\nexport const MANAGE_TEAM_MEMBERS_DETAIL_REPLY_GUIDANCE =\n \"Team member details render in chat UI. Do not restate name, email, or role from the card. Only add next steps or policy context.\";\n\nexport const MANAGE_GROUPS_LIST_REPLY_GUIDANCE =\n \"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.\";\n\nexport const MANAGE_GROUPS_DETAIL_REPLY_GUIDANCE =\n \"Group details render in chat UI. Do not restate fields already visible in the card. Only add next steps.\";\n\nexport const QUERY_TASKS_LIST_REPLY_GUIDANCE =\n \"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).\";\n\nexport const QUERY_TASKS_DETAIL_REPLY_GUIDANCE =\n \"Task details render in chat UI. Do not restate fields already visible in the card. Only add analysis or next steps.\";\n\nexport const ASSIGN_TASKS_REPLY_GUIDANCE =\n \"Reassignment results render in chat UI. Do not restate task ids or assignee emails from the card. Only mention failures, partial success, or next steps.\";\n\nexport const REFUND_CHARGE_REPLY_GUIDANCE =\n \"Refund details render in chat UI. Do not restate charge id, amount, or status from the card. Only add policy context or next steps.\";\n\nexport const DEPLOY_RELEASE_REPLY_GUIDANCE =\n \"Deploy details render in chat UI. Do not restate service, version, or environment from the card. Only add rollout context or next steps.\";\n\nexport const GET_WEATHER_REPLY_GUIDANCE =\n \"Weather details render in chat UI. Do not restate city, condition, or temperature from the card. Only add conversational context if needed.\";\n\nexport const ADMIN_MUTATION_REPLY_GUIDANCE =\n \"The action result renders in chat UI. Do not restate fields already visible in the card. Confirm outcome briefly or add next steps only.\";\n\nexport type ToolResultWithReplyGuidance<T extends Record<string, unknown>> = T & {\n replyGuidance: string;\n};\n\n/** Attach model-facing narration hints to a tool execute result. */\nexport function withReplyGuidance<T extends Record<string, unknown>>(\n result: T,\n guidance: string\n): ToolResultWithReplyGuidance<T> {\n return {\n ...result,\n [TOOL_REPLY_GUIDANCE_FIELD]: guidance,\n };\n}\n\n/** Remove agent-only fields before showing raw JSON in the dashboard. */\nexport function stripAgentOnlyToolFields(output: unknown): unknown {\n if (typeof output !== \"object\" || output === null || Array.isArray(output)) {\n return output;\n }\n\n const record = { ...(output as Record<string, unknown>) };\n delete record[TOOL_REPLY_GUIDANCE_FIELD];\n delete record[TOOL_UI_HINT_FIELD];\n return record;\n}\n","import { withReplyGuidance } from \"./tool-reply-guidance.js\";\nimport { withUiHint, type ToolUiHint } from \"./tool-ui-hint.js\";\n\nexport type FormatToolObjectResultOptions = {\n replyGuidance: string;\n /** Optional layout hint for TRL rendering. Omit to let the dashboard infer. */\n uiHint?: ToolUiHint;\n};\n\nexport type FormatToolListResultOptions = {\n replyGuidance: string;\n};\n\n/** Attach agent narration hints to plain tool JSON. No display/ui envelope. */\nexport function formatToolObjectResult(\n data: Record<string, unknown>,\n options: FormatToolObjectResultOptions\n) {\n const withGuidance = withReplyGuidance(data, options.replyGuidance);\n if (options.uiHint) {\n return withUiHint(withGuidance, options.uiHint);\n }\n return withGuidance;\n}\n\n/** Wrap an array field as plain tool JSON with reply guidance and list layout hint. */\nexport function formatToolListResult(\n listKey: string,\n items: Record<string, unknown>[],\n options: FormatToolListResultOptions\n) {\n return withUiHint(\n withReplyGuidance({ [listKey]: items }, options.replyGuidance),\n \"list\"\n );\n}\n\nexport function isAgentAdminErrorResult(\n result: unknown\n): result is { ok: false; message: string } {\n return (\n typeof result === \"object\" &&\n result !== null &&\n (result as { ok?: unknown }).ok === false &&\n typeof (result as { message?: unknown }).message === \"string\"\n );\n}\n","import type { RobotRockWebhookPayload } from \"../webhook.js\";\n\n/** Build the assistant resume prompt when an inbox task linked to a chat is handled. */\nexport function buildTaskHandledResumeMessage(\n payload: RobotRockWebhookPayload\n): string {\n const handledBy = payload.handledBy?.trim() || \"someone\";\n const actionTitle = payload.action.title.trim();\n return `RobotRock task ${payload.taskId} was handled: ${actionTitle} by ${handledBy}. Briefly tell the user what was decided and what happens next.`;\n}\n","export {\n EVE_INPUT_OTHER_CHOICE_ID,\n EVE_INPUT_OTHER_CHOICE_LABEL,\n EVE_INPUT_SUBMIT_ACTION_ID,\n eveInputRequestTaskType,\n eveInputRequestToActions,\n normalizeEveSelectFormData,\n resolveEveInputDisplay,\n taskHandledToEveInputResponse,\n type EveInputOption,\n type EveInputRequest,\n type EveInputRequestDisplay,\n type EveInputResponse,\n} from \"./input-request.js\";\nexport {\n buildEveInputAuditSubmissionData,\n eveInputResponseToActionSubmission,\n isEveApprovalInputRequest,\n parseEveAskQuestionToolOutput,\n resolveEveFreeformTextToInputResponse,\n type EveInputActionSubmission,\n type EveInputAuditContext,\n} from \"./input-audit.js\";\nexport {\n buildChatToolAuditPayload,\n sanitizeToolAuditInput,\n shouldAuditToolExecution,\n type ChatToolAuditInput,\n type ChatToolAuditPayload,\n} from \"./tool-audit.js\";\nexport {\n DEFAULT_TOOL_DISPLAY_LABELS,\n formatEveApprovalTitle,\n getToolDisplayLabel,\n setToolDisplayLabelOverrides,\n} from \"./tool-display.js\";\nexport {\n toolDisplayResult,\n type ToolDisplayResultOptions,\n} from \"./tool-result-display.js\";\nexport {\n formatToolListResult,\n formatToolObjectResult,\n isAgentAdminErrorResult,\n type FormatToolListResultOptions,\n type FormatToolObjectResultOptions,\n} from \"./tool-display-format.js\";\nexport {\n TOOL_UI_HINT_FIELD,\n extractToolUiHint,\n isToolUiHint,\n withUiHint,\n type ToolUiHint,\n} from \"./tool-ui-hint.js\";\nexport {\n CREATE_INBOX_TASK_REPLY_GUIDANCE,\n MY_ACCESS_REPLY_GUIDANCE,\n SEARCH_PRODUCTS_REPLY_GUIDANCE,\n MANAGE_TEAM_MEMBERS_LIST_REPLY_GUIDANCE,\n MANAGE_TEAM_MEMBERS_DETAIL_REPLY_GUIDANCE,\n MANAGE_GROUPS_LIST_REPLY_GUIDANCE,\n MANAGE_GROUPS_DETAIL_REPLY_GUIDANCE,\n QUERY_TASKS_LIST_REPLY_GUIDANCE,\n QUERY_TASKS_DETAIL_REPLY_GUIDANCE,\n REFUND_CHARGE_REPLY_GUIDANCE,\n DEPLOY_RELEASE_REPLY_GUIDANCE,\n GET_WEATHER_REPLY_GUIDANCE,\n ADMIN_MUTATION_REPLY_GUIDANCE,\n TOOL_REPLY_GUIDANCE_FIELD,\n WHOAMI_REPLY_GUIDANCE,\n stripAgentOnlyToolFields,\n withReplyGuidance,\n type ToolResultWithReplyGuidance,\n} from \"./tool-reply-guidance.js\";\n/** Hook slug advertised in GET /eve/v1/info for RobotRock-ready auto-detection. */\nexport const ROBOTROCK_READY_HOOK_SLUG = \"robotrock-ready\";\n\nexport { buildTaskHandledResumeMessage } from \"./resume-message.js\";\n"],"mappings":";AACO,SAAS,mBAAmB,OAAuB;AACxD,SAAO,MACJ,QAAQ,UAAU,GAAG,EACrB,QAAQ,SAAS,GAAG,EACpB,QAAQ,SAAS,GAAG,EACpB,QAAQ,WAAW,GAAG,EACtB,QAAQ,WAAW,GAAG,EACtB,QAAQ,WAAW,GAAG,EACtB,QAAQ,aAAa,CAAC,GAAG,SAAS,OAAO,aAAa,OAAO,IAAI,CAAC,CAAC,EACnE;AAAA,IAAQ;AAAA,IAAqB,CAAC,GAAG,SAChC,OAAO,aAAa,SAAS,MAAM,EAAE,CAAC;AAAA,EACxC;AACJ;;;ACRO,IAAM,+BAA+B;AACrC,IAAM,oCAAoC;AAiE1C,SAAS,yBACd,UACiD;AACjD,SAAO,aAAa;AACtB;AAEO,SAAS,8BACd,UACsD;AACtD,SAAO,aAAa;AACtB;AAEO,SAAS,yBACd,UACsC;AACtC,SACE,yBAAyB,QAAQ,KAAK,8BAA8B,QAAQ;AAEhF;AAEO,SAAS,+BACd,MACkC;AAClC,MAAI,QAAQ,QAAQ,OAAO,SAAS,UAAU;AAC5C,WAAO;AAAA,EACT;AACA,QA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;AACvC,SAAO,OAAO,kBAAkB;AAChC,SAAO;AACT;;;AC7DO,SAAS,uBACd,MACA,SACA;AACA,QAAM,eAAe,kBAAkB,MAAM,QAAQ,aAAa;AAClE,MAAI,QAAQ,QAAQ;AAClB,WAAO,WAAW,cAAc,QAAQ,MAAM;AAAA,EAChD;AACA,SAAO;AACT;AAGO,SAAS,qBACd,SACA,OACA,SACA;AACA,SAAO;AAAA,IACL,kBAAkB,EAAE,CAAC,OAAO,GAAG,MAAM,GAAG,QAAQ,aAAa;AAAA,IAC7D;AAAA,EACF;AACF;AAEO,SAAS,wBACd,QAC0C;AAC1C,SACE,OAAO,WAAW,YAClB,WAAW,QACV,OAA4B,OAAO,SACpC,OAAQ,OAAiC,YAAY;AAEzD;;;AC3CO,SAAS,8BACd,SACQ;AACR,QAAM,YAAY,QAAQ,WAAW,KAAK,KAAK;AAC/C,QAAM,cAAc,QAAQ,OAAO,MAAM,KAAK;AAC9C,SAAO,kBAAkB,QAAQ,MAAM,iBAAiB,WAAW,OAAO,SAAS;AACrF;;;ACkEO,IAAM,4BAA4B;","names":[]}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as eve_tools from 'eve/tools';
|
|
2
|
-
import { T as
|
|
3
|
-
import * as _robotrock_core from '@robotrock/core';
|
|
2
|
+
import { T as ToolUiHint } from '../../../tool-ui-hint-CMpug5sC.js';
|
|
4
3
|
import { z } from 'zod';
|
|
5
4
|
|
|
6
5
|
declare const ASSIGN_TASKS_TOOL_NAME = "assign_tasks";
|
|
@@ -17,7 +16,13 @@ declare function defineAssignTasksTool(): eve_tools.ToolDefinition<{
|
|
|
17
16
|
users?: string[] | undefined;
|
|
18
17
|
groups?: string[] | undefined;
|
|
19
18
|
};
|
|
20
|
-
},
|
|
19
|
+
}, ({
|
|
20
|
+
[x: string]: Record<string, unknown>[];
|
|
21
|
+
} & {
|
|
22
|
+
replyGuidance: string;
|
|
23
|
+
} & {
|
|
24
|
+
uiHint: ToolUiHint;
|
|
25
|
+
}) | {
|
|
21
26
|
ok: false;
|
|
22
27
|
status: number;
|
|
23
28
|
message: string;
|
|
@@ -29,7 +34,13 @@ declare const assignTasksTool: eve_tools.ToolDefinition<{
|
|
|
29
34
|
users?: string[] | undefined;
|
|
30
35
|
groups?: string[] | undefined;
|
|
31
36
|
};
|
|
32
|
-
},
|
|
37
|
+
}, ({
|
|
38
|
+
[x: string]: Record<string, unknown>[];
|
|
39
|
+
} & {
|
|
40
|
+
replyGuidance: string;
|
|
41
|
+
} & {
|
|
42
|
+
uiHint: ToolUiHint;
|
|
43
|
+
}) | {
|
|
33
44
|
ok: false;
|
|
34
45
|
status: number;
|
|
35
46
|
message: string;
|
|
@@ -968,17 +968,12 @@ function createBoundAgentAdminClient(ctx) {
|
|
|
968
968
|
);
|
|
969
969
|
}
|
|
970
970
|
|
|
971
|
-
// src/eve/tool-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
...options.widget ? { widget: options.widget } : {},
|
|
975
|
-
...options.title ? { title: options.title } : {},
|
|
976
|
-
...options.description ? { description: options.description } : {}
|
|
977
|
-
} : void 0;
|
|
971
|
+
// src/eve/tool-ui-hint.ts
|
|
972
|
+
var TOOL_UI_HINT_FIELD = "uiHint";
|
|
973
|
+
function withUiHint(result, hint) {
|
|
978
974
|
return {
|
|
979
|
-
...
|
|
980
|
-
|
|
981
|
-
...options?.ui ? { ui: options.ui } : {}
|
|
975
|
+
...result,
|
|
976
|
+
[TOOL_UI_HINT_FIELD]: hint
|
|
982
977
|
};
|
|
983
978
|
}
|
|
984
979
|
|
|
@@ -993,36 +988,10 @@ function withReplyGuidance(result, guidance) {
|
|
|
993
988
|
}
|
|
994
989
|
|
|
995
990
|
// src/eve/tool-display-format.ts
|
|
996
|
-
function formatToolObjectResult(data, options) {
|
|
997
|
-
return withReplyGuidance(
|
|
998
|
-
toolDisplayResult(data, {
|
|
999
|
-
title: options.title,
|
|
1000
|
-
description: options.description,
|
|
1001
|
-
ui: options.ui
|
|
1002
|
-
}),
|
|
1003
|
-
options.replyGuidance
|
|
1004
|
-
);
|
|
1005
|
-
}
|
|
1006
991
|
function formatToolListResult(listKey, items, options) {
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
"ui:widget": options.itemWidget,
|
|
1011
|
-
...options.itemUi ?? {}
|
|
1012
|
-
}
|
|
1013
|
-
} : {
|
|
1014
|
-
"ui:widget": "table",
|
|
1015
|
-
...options.itemUi ? { items: options.itemUi } : {}
|
|
1016
|
-
};
|
|
1017
|
-
return formatToolObjectResult(
|
|
1018
|
-
{ [listKey]: items },
|
|
1019
|
-
{
|
|
1020
|
-
title: options.title,
|
|
1021
|
-
ui: {
|
|
1022
|
-
[listKey]: listFieldUi
|
|
1023
|
-
},
|
|
1024
|
-
replyGuidance: options.replyGuidance
|
|
1025
|
-
}
|
|
992
|
+
return withUiHint(
|
|
993
|
+
withReplyGuidance({ [listKey]: items }, options.replyGuidance),
|
|
994
|
+
"list"
|
|
1026
995
|
);
|
|
1027
996
|
}
|
|
1028
997
|
|
|
@@ -1031,8 +1000,6 @@ function resolveTaskCardLabel(task) {
|
|
|
1031
1000
|
return task.name?.trim() || task.description?.trim() || task.type?.trim() || task.id?.trim() || "Untitled task";
|
|
1032
1001
|
}
|
|
1033
1002
|
function formatAssignTasksResult(results, _assignTo) {
|
|
1034
|
-
const succeeded = results.filter((row) => row.success).length;
|
|
1035
|
-
const title = succeeded === results.length ? `${succeeded === 1 ? "1 task" : `${succeeded} tasks`} reassigned` : `${succeeded}/${results.length} tasks reassigned`;
|
|
1036
1003
|
return formatToolListResult(
|
|
1037
1004
|
"results",
|
|
1038
1005
|
results.map((row) => ({
|
|
@@ -1048,8 +1015,6 @@ function formatAssignTasksResult(results, _assignTo) {
|
|
|
1048
1015
|
status: row.success ? "reassigned" : "failed"
|
|
1049
1016
|
})),
|
|
1050
1017
|
{
|
|
1051
|
-
title,
|
|
1052
|
-
itemWidget: "tenantTask",
|
|
1053
1018
|
replyGuidance: ASSIGN_TASKS_REPLY_GUIDANCE
|
|
1054
1019
|
}
|
|
1055
1020
|
);
|