robotrock 1.3.3 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -0
- package/dist/agent-admin.d.ts +5 -0
- package/dist/agent-admin.js +75 -2
- package/dist/agent-admin.js.map +1 -1
- package/dist/ai/index.d.ts +5 -5
- package/dist/ai/index.js +128 -4
- package/dist/ai/index.js.map +1 -1
- package/dist/ai/trigger.d.ts +3 -3
- package/dist/ai/trigger.js +128 -4
- package/dist/ai/trigger.js.map +1 -1
- package/dist/ai/workflow.d.ts +3 -3
- package/dist/ai/workflow.js +128 -4
- package/dist/ai/workflow.js.map +1 -1
- package/dist/{client-CZ5eWH5v.d.ts → client-BxbxttFH.d.ts} +19 -1
- package/dist/eve/agent/index.d.ts +4 -3
- package/dist/eve/agent/index.js +736 -414
- package/dist/eve/agent/index.js.map +1 -1
- package/dist/eve/index.d.ts +4 -3
- package/dist/eve/index.js +437 -45
- package/dist/eve/index.js.map +1 -1
- package/dist/eve/tools/admin/assign-tasks.d.ts +40 -8
- package/dist/eve/tools/admin/assign-tasks.js +328 -66
- package/dist/eve/tools/admin/assign-tasks.js.map +1 -1
- package/dist/eve/tools/admin/get-workspace-usage.d.ts +71 -0
- package/dist/eve/tools/admin/get-workspace-usage.js +1353 -0
- package/dist/eve/tools/admin/get-workspace-usage.js.map +1 -0
- package/dist/eve/tools/admin/manage-groups.d.ts +122 -8
- package/dist/eve/tools/admin/manage-groups.js +348 -94
- package/dist/eve/tools/admin/manage-groups.js.map +1 -1
- package/dist/eve/tools/admin/manage-team-members.d.ts +86 -8
- package/dist/eve/tools/admin/manage-team-members.js +318 -72
- package/dist/eve/tools/admin/manage-team-members.js.map +1 -1
- package/dist/eve/tools/admin/query-tasks.d.ts +82 -8
- package/dist/eve/tools/admin/query-tasks.js +360 -113
- package/dist/eve/tools/admin/query-tasks.js.map +1 -1
- package/dist/eve/tools/catalog/generate-image.d.ts +64 -0
- package/dist/eve/tools/catalog/generate-image.js +2065 -0
- package/dist/eve/tools/catalog/generate-image.js.map +1 -0
- package/dist/eve/tools/catalog/generate-random-chart.d.ts +71 -0
- package/dist/eve/tools/catalog/generate-random-chart.js +372 -0
- package/dist/eve/tools/catalog/generate-random-chart.js.map +1 -0
- package/dist/eve/tools/catalog/search-products.d.ts +36 -44
- package/dist/eve/tools/catalog/search-products.js +237 -33
- package/dist/eve/tools/catalog/search-products.js.map +1 -1
- package/dist/eve/tools/identity/index.d.ts +2 -2
- package/dist/eve/tools/identity/index.js +35 -44
- package/dist/eve/tools/identity/index.js.map +1 -1
- package/dist/eve/tools/identity/my-access.d.ts +90 -6
- package/dist/eve/tools/identity/my-access.js +35 -44
- package/dist/eve/tools/identity/my-access.js.map +1 -1
- package/dist/eve/tools/identity/whoami.d.ts +1 -1
- package/dist/eve/tools/identity/whoami.js.map +1 -1
- package/dist/eve/tools/inbox/create-task.d.ts +1 -1
- package/dist/eve/tools/inbox/create-task.js +119 -2
- package/dist/eve/tools/inbox/create-task.js.map +1 -1
- package/dist/eve/tools/inbox/index.d.ts +1 -1
- package/dist/eve/tools/inbox/index.js +119 -2
- package/dist/eve/tools/inbox/index.js.map +1 -1
- package/dist/eve/tools/index.d.ts +5 -2
- package/dist/eve/tools/index.js +932 -288
- package/dist/eve/tools/index.js.map +1 -1
- package/dist/index-Drj0Rzf_.d.ts +905 -0
- package/dist/index.d.ts +5 -4
- package/dist/index.js +335 -20
- package/dist/index.js.map +1 -1
- package/dist/schemas/index.js +67 -1
- package/dist/schemas/index.js.map +1 -1
- package/dist/{tool-approval-bridge-DnGaRES4.d.ts → tool-approval-bridge-Cz7qQUpw.d.ts} +1 -1
- package/dist/{tool-reply-guidance-C3qrT1In.d.ts → tool-reply-guidance-CJko9liH.d.ts} +5 -2
- package/dist/tool-result-ui-meta-KT0VafEO.d.ts +52 -0
- package/dist/trigger/index.d.ts +1 -1
- package/dist/trigger/index.js +118 -2
- package/dist/trigger/index.js.map +1 -1
- package/dist/{trigger--qTIK0s6.d.ts → trigger-C1ooSegc.d.ts} +2 -2
- package/dist/workflow/index.d.ts +1 -1
- package/dist/workflow/index.js +118 -2
- package/dist/workflow/index.js.map +1 -1
- package/package.json +21 -4
- package/dist/index-DePyAbTI.d.ts +0 -203
package/dist/eve/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
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,
|
|
2
|
-
export {
|
|
3
|
-
|
|
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, x as FormatToolQueryResultOptions, G as GroupEntityRow, M as MemberEntityRow, y as MetricPointEntityRow, P as ProductEntityRow, R as ROBOTROCK_READY_HOOK_SLUG, S as StatusEntityRow, T as TaskEntityRow, z as ToolDisplayResultOptions, A as agentAdminErrorResultSchema, B as agentAdminMutationResultSchema, H as assignTasksOutputSchema, I as buildChatToolAuditPayload, J as buildEveInputAuditSubmissionData, j as buildTaskHandledResumeMessage, K as buildTenantGroupUrl, L as buildTenantTaskUrl, k as eveInputRequestTaskType, l as eveInputRequestToActions, N as eveInputResponseToActionSubmission, m as formatEveApprovalTitle, O as formatToolListResult, Q as formatToolObjectResult, U as formatToolQueryResult, W as generateImageOutputSchema, X as generateRandomChartOutputSchema, n as getToolDisplayLabel, Y as getWorkspaceUsageOutputSchema, Z as groupDetailEntitySchema, _ as groupEntityRowSchema, $ as isAgentAdminErrorResult, a0 as isEveApprovalInputRequest, a1 as manageGroupsDetailOutputSchema, a2 as manageGroupsListOutputSchema, a3 as manageGroupsOutputSchema, a4 as manageGroupsSummaryOutputSchema, a5 as manageTeamMembersDetailOutputSchema, a6 as manageTeamMembersListOutputSchema, a7 as manageTeamMembersOutputSchema, a8 as memberEntityRowSchema, a9 as metricPointEntityRowSchema, o as normalizeEveSelectFormData, aa as parseEveAskQuestionToolOutput, ab as productEntityRowSchema, ac as queryTasksDetailOutputSchema, ad as queryTasksListOutputSchema, ae as queryTasksOutputSchema, af as resolveEveFreeformTextToInputResponse, r as resolveEveInputDisplay, ag as sanitizeToolAuditInput, ah as searchProductsOutputSchema, s as setToolDisplayLabelOverrides, ai as shouldAuditToolExecution, aj as statusEntityRowSchema, ak as taskEntityRowSchema, t as taskHandledToEveInputResponse, al as toolDisplayResult, am as toolResultUiMetaSchema, an as workspaceUsageEntitySchema } from '../index-Drj0Rzf_.js';
|
|
2
|
+
export { c as TOOL_RESULT_UI_ENTITIES, d as TOOL_RESULT_UI_ENTITY_ID_RE, e as TOOL_UI_FIELD, f as TOOL_UI_HINT_FIELD, b as ToolResultUiEntity, g as ToolResultUiLayout, T as ToolResultUiMeta, a as ToolUiHint, h as extractToolResultUiMeta, i as extractToolUiHint, j as isToolResultUiEntity, k as isToolResultUiEntityId, l as isToolUiHint, m as legacyPatternToLayout, u as uiHintToLayout, w as withToolUi, n as withUiHint } from '../tool-result-ui-meta-KT0VafEO.js';
|
|
3
|
+
export { A as ADMIN_MUTATION_REPLY_GUIDANCE, C as CREATE_INBOX_TASK_REPLY_GUIDANCE, D as DEPLOY_RELEASE_REPLY_GUIDANCE, G as GENERATE_IMAGE_REPLY_GUIDANCE, a as GENERATE_RANDOM_CHART_REPLY_GUIDANCE, b as GET_WEATHER_REPLY_GUIDANCE, c as GET_WORKSPACE_USAGE_REPLY_GUIDANCE, M as MANAGE_GROUPS_DETAIL_REPLY_GUIDANCE, d as MANAGE_GROUPS_LIST_REPLY_GUIDANCE, e as MANAGE_TEAM_MEMBERS_DETAIL_REPLY_GUIDANCE, f as MANAGE_TEAM_MEMBERS_LIST_REPLY_GUIDANCE, g as MY_ACCESS_REPLY_GUIDANCE, Q as QUERY_TASKS_DETAIL_REPLY_GUIDANCE, h as QUERY_TASKS_LIST_REPLY_GUIDANCE, R as REFUND_CHARGE_REPLY_GUIDANCE, S as SEARCH_PRODUCTS_REPLY_GUIDANCE, i as TOOL_REPLY_GUIDANCE_FIELD, T as ToolResultWithReplyGuidance, W as WHOAMI_REPLY_GUIDANCE, s as stripAgentOnlyToolFields, w as withReplyGuidance } from '../tool-reply-guidance-CJko9liH.js';
|
|
4
|
+
import '../client-BxbxttFH.js';
|
|
4
5
|
import '../schemas/index.js';
|
|
5
6
|
import 'zod';
|
|
6
7
|
import '@robotrock/core';
|
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();
|
|
@@ -445,9 +463,12 @@ var DEFAULT_TOOL_DISPLAY_LABELS = {
|
|
|
445
463
|
whoami: "Who am I",
|
|
446
464
|
create_robotrock_task: "Create a RobotRock task",
|
|
447
465
|
search_products: "Search products",
|
|
466
|
+
generate_random_chart: "Generate random chart",
|
|
467
|
+
generate_image: "Generate image",
|
|
448
468
|
manage_team_members: "Manage team members",
|
|
449
469
|
manage_groups: "Manage groups",
|
|
450
|
-
query_tasks: "Query tasks"
|
|
470
|
+
query_tasks: "Query tasks",
|
|
471
|
+
get_workspace_usage: "Get workspace usage"
|
|
451
472
|
};
|
|
452
473
|
var toolDisplayLabelOverrides = {};
|
|
453
474
|
function setToolDisplayLabelOverrides(overrides) {
|
|
@@ -470,31 +491,143 @@ function getToolDisplayLabel(toolName) {
|
|
|
470
491
|
function formatEveApprovalTitle(request, toolName) {
|
|
471
492
|
const display = resolveEveInputDisplay(request, toolName);
|
|
472
493
|
if (display !== "confirmation" || !toolName) {
|
|
473
|
-
return request.prompt;
|
|
494
|
+
return decodeHtmlEntities(request.prompt);
|
|
474
495
|
}
|
|
475
496
|
return `Approve: ${getToolDisplayLabel(toolName)}`;
|
|
476
497
|
}
|
|
477
498
|
|
|
478
499
|
// src/eve/tool-result-display.ts
|
|
479
|
-
function toolDisplayResult(data,
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
500
|
+
function toolDisplayResult(data, _options) {
|
|
501
|
+
return data;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
// src/eve/tool-ui-hint.ts
|
|
505
|
+
var TOOL_UI_HINT_FIELD = "uiHint";
|
|
506
|
+
var TOOL_UI_HINTS = /* @__PURE__ */ new Set(["list", "chart", "table"]);
|
|
507
|
+
function isToolUiHint(value) {
|
|
508
|
+
return typeof value === "string" && TOOL_UI_HINTS.has(value);
|
|
509
|
+
}
|
|
510
|
+
function withUiHint(result, hint) {
|
|
485
511
|
return {
|
|
486
|
-
...
|
|
487
|
-
|
|
488
|
-
|
|
512
|
+
...result,
|
|
513
|
+
[TOOL_UI_HINT_FIELD]: hint
|
|
514
|
+
};
|
|
515
|
+
}
|
|
516
|
+
function extractToolUiHint(output) {
|
|
517
|
+
if (typeof output !== "object" || output === null || Array.isArray(output)) {
|
|
518
|
+
return void 0;
|
|
519
|
+
}
|
|
520
|
+
const hint = output[TOOL_UI_HINT_FIELD];
|
|
521
|
+
return isToolUiHint(hint) ? hint : void 0;
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
// src/eve/tool-result-ui-meta.ts
|
|
525
|
+
var TOOL_UI_FIELD = "ui";
|
|
526
|
+
var TOOL_RESULT_UI_ENTITY_ID_RE = /^[a-z][a-z0-9_]{0,63}$/;
|
|
527
|
+
var TOOL_RESULT_UI_ENTITIES = [
|
|
528
|
+
"product",
|
|
529
|
+
"member",
|
|
530
|
+
"task",
|
|
531
|
+
"group",
|
|
532
|
+
"status",
|
|
533
|
+
"object"
|
|
534
|
+
];
|
|
535
|
+
function isToolResultUiEntityId(value) {
|
|
536
|
+
return typeof value === "string" && TOOL_RESULT_UI_ENTITY_ID_RE.test(value);
|
|
537
|
+
}
|
|
538
|
+
function isToolResultUiEntity(value) {
|
|
539
|
+
return isToolResultUiEntityId(value);
|
|
540
|
+
}
|
|
541
|
+
function uiHintToLayout(hint) {
|
|
542
|
+
return hint;
|
|
543
|
+
}
|
|
544
|
+
function legacyPatternToLayout(pattern) {
|
|
545
|
+
switch (pattern) {
|
|
546
|
+
case "chart":
|
|
547
|
+
return "chart";
|
|
548
|
+
case "table":
|
|
549
|
+
return "table";
|
|
550
|
+
case "list":
|
|
551
|
+
case "query":
|
|
552
|
+
return "list";
|
|
553
|
+
default:
|
|
554
|
+
return void 0;
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
function readPresent(value) {
|
|
558
|
+
return typeof value === "boolean" ? value : void 0;
|
|
559
|
+
}
|
|
560
|
+
function readRowsPath(value) {
|
|
561
|
+
if (typeof value !== "string") {
|
|
562
|
+
return void 0;
|
|
563
|
+
}
|
|
564
|
+
const trimmed = value.trim();
|
|
565
|
+
return trimmed.length > 0 ? trimmed : void 0;
|
|
566
|
+
}
|
|
567
|
+
function readEntity(value) {
|
|
568
|
+
if (!isToolResultUiEntityId(value)) {
|
|
569
|
+
return void 0;
|
|
570
|
+
}
|
|
571
|
+
return value;
|
|
572
|
+
}
|
|
573
|
+
function extractToolResultUiMeta(output) {
|
|
574
|
+
if (typeof output !== "object" || output === null || Array.isArray(output)) {
|
|
575
|
+
return void 0;
|
|
576
|
+
}
|
|
577
|
+
const record = output;
|
|
578
|
+
const rawUi = record[TOOL_UI_FIELD];
|
|
579
|
+
const meta = {};
|
|
580
|
+
if (typeof rawUi === "object" && rawUi !== null && !Array.isArray(rawUi)) {
|
|
581
|
+
const ui = rawUi;
|
|
582
|
+
const present = readPresent(ui.present);
|
|
583
|
+
if (present !== void 0) {
|
|
584
|
+
meta.present = present;
|
|
585
|
+
}
|
|
586
|
+
const entity = readEntity(ui.entity);
|
|
587
|
+
if (entity) {
|
|
588
|
+
meta.entity = entity;
|
|
589
|
+
}
|
|
590
|
+
const rowsPath = readRowsPath(ui.rowsPath);
|
|
591
|
+
if (rowsPath) {
|
|
592
|
+
meta.rowsPath = rowsPath;
|
|
593
|
+
}
|
|
594
|
+
if (isToolUiHint(ui.layout)) {
|
|
595
|
+
meta.layout = ui.layout;
|
|
596
|
+
} else if (typeof ui.pattern === "string") {
|
|
597
|
+
const fromPattern = legacyPatternToLayout(ui.pattern);
|
|
598
|
+
if (fromPattern) {
|
|
599
|
+
meta.layout = fromPattern;
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
if (!meta.layout && isToolUiHint(record.uiHint)) {
|
|
604
|
+
meta.layout = uiHintToLayout(record.uiHint);
|
|
605
|
+
}
|
|
606
|
+
if (meta.present === void 0 && meta.entity === void 0 && meta.rowsPath === void 0 && meta.layout === void 0) {
|
|
607
|
+
return void 0;
|
|
608
|
+
}
|
|
609
|
+
return meta;
|
|
610
|
+
}
|
|
611
|
+
function withToolUi(result, ui) {
|
|
612
|
+
const existing = typeof result[TOOL_UI_FIELD] === "object" && result[TOOL_UI_FIELD] !== null && !Array.isArray(result[TOOL_UI_FIELD]) ? result[TOOL_UI_FIELD] : {};
|
|
613
|
+
return {
|
|
614
|
+
...result,
|
|
615
|
+
[TOOL_UI_FIELD]: {
|
|
616
|
+
...existing,
|
|
617
|
+
...ui
|
|
618
|
+
}
|
|
489
619
|
};
|
|
490
620
|
}
|
|
491
621
|
|
|
492
622
|
// src/eve/tool-reply-guidance.ts
|
|
493
623
|
var TOOL_REPLY_GUIDANCE_FIELD = "replyGuidance";
|
|
494
624
|
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).";
|
|
495
|
-
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,
|
|
625
|
+
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, query-tasks, or workspace-usage 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.";
|
|
626
|
+
var GET_WORKSPACE_USAGE_REPLY_GUIDANCE = "Workspace plan and usage render as a card in chat. Do not restate plan name, task counts, seats, groups, API keys, or rate limits from the card. Only add context not shown (e.g. upgrade options, that LLM token/cost meters are not tracked, or next steps). Never invent token or dollar spend numbers.";
|
|
496
627
|
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.";
|
|
497
628
|
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).";
|
|
629
|
+
var GENERATE_RANDOM_CHART_REPLY_GUIDANCE = "Chart metrics render as a chart card in chat. Do not restate series values, dates, or categories from the chart. Only add brief context (e.g. that this is demo data).";
|
|
630
|
+
var GENERATE_IMAGE_REPLY_GUIDANCE = "The generated image renders in chat UI. Do not describe the image pixels or restate the prompt. Only add a short acknowledgement or next-step question if useful.";
|
|
498
631
|
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).";
|
|
499
632
|
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.";
|
|
500
633
|
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.";
|
|
@@ -517,46 +650,260 @@ function stripAgentOnlyToolFields(output) {
|
|
|
517
650
|
}
|
|
518
651
|
const record = { ...output };
|
|
519
652
|
delete record[TOOL_REPLY_GUIDANCE_FIELD];
|
|
653
|
+
delete record[TOOL_UI_HINT_FIELD];
|
|
654
|
+
delete record[TOOL_UI_FIELD];
|
|
520
655
|
return record;
|
|
521
656
|
}
|
|
522
657
|
|
|
523
658
|
// src/eve/tool-display-format.ts
|
|
524
659
|
function formatToolObjectResult(data, options) {
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
title: options.title,
|
|
528
|
-
description: options.description,
|
|
529
|
-
ui: options.ui
|
|
530
|
-
}),
|
|
660
|
+
let result = withReplyGuidance(
|
|
661
|
+
data,
|
|
531
662
|
options.replyGuidance
|
|
532
663
|
);
|
|
664
|
+
if (options.ui) {
|
|
665
|
+
result = withToolUi(result, options.ui);
|
|
666
|
+
}
|
|
667
|
+
if (options.uiHint) {
|
|
668
|
+
result = withUiHint(result, options.uiHint);
|
|
669
|
+
}
|
|
670
|
+
return result;
|
|
533
671
|
}
|
|
534
672
|
function formatToolListResult(listKey, items, options) {
|
|
535
|
-
const
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
}
|
|
541
|
-
} : {
|
|
542
|
-
"ui:widget": "table",
|
|
543
|
-
...options.itemUi ? { items: options.itemUi } : {}
|
|
673
|
+
const ui = {
|
|
674
|
+
...options.ui,
|
|
675
|
+
layout: "list",
|
|
676
|
+
rowsPath: listKey,
|
|
677
|
+
...options.entity ? { entity: options.entity } : {},
|
|
678
|
+
...options.present !== void 0 ? { present: options.present } : {}
|
|
544
679
|
};
|
|
545
|
-
return
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
680
|
+
return withUiHint(
|
|
681
|
+
withToolUi(
|
|
682
|
+
withReplyGuidance({ [listKey]: items }, options.replyGuidance),
|
|
683
|
+
ui
|
|
684
|
+
),
|
|
685
|
+
"list"
|
|
686
|
+
);
|
|
687
|
+
}
|
|
688
|
+
function formatToolQueryResult(meta, rows, options) {
|
|
689
|
+
const rowsPath = options.rowsPath ?? options.ui?.rowsPath ?? "rows";
|
|
690
|
+
const ui = {
|
|
691
|
+
...options.ui,
|
|
692
|
+
layout: options.ui?.layout ?? "list",
|
|
693
|
+
rowsPath,
|
|
694
|
+
...options.entity ? { entity: options.entity } : {},
|
|
695
|
+
...options.present !== void 0 ? { present: options.present } : {}
|
|
696
|
+
};
|
|
697
|
+
return withToolUi(
|
|
698
|
+
withReplyGuidance(
|
|
699
|
+
{
|
|
700
|
+
...meta,
|
|
701
|
+
[rowsPath]: rows
|
|
551
702
|
},
|
|
552
|
-
|
|
553
|
-
|
|
703
|
+
options.replyGuidance
|
|
704
|
+
),
|
|
705
|
+
ui
|
|
554
706
|
);
|
|
555
707
|
}
|
|
556
708
|
function isAgentAdminErrorResult(result) {
|
|
557
709
|
return typeof result === "object" && result !== null && result.ok === false && typeof result.message === "string";
|
|
558
710
|
}
|
|
559
711
|
|
|
712
|
+
// src/eve/entity-schemas.ts
|
|
713
|
+
import { z } from "zod";
|
|
714
|
+
function buildTenantTaskUrl(tenantSlug, task) {
|
|
715
|
+
const q = new URLSearchParams();
|
|
716
|
+
if (task.app && task.app !== "default") {
|
|
717
|
+
q.set("app", task.app);
|
|
718
|
+
}
|
|
719
|
+
if (task.type?.trim()) {
|
|
720
|
+
q.set("type", task.type.trim());
|
|
721
|
+
}
|
|
722
|
+
q.set("selected", task.id);
|
|
723
|
+
return `/${tenantSlug}/inbox?${q.toString()}`;
|
|
724
|
+
}
|
|
725
|
+
function buildTenantGroupUrl(tenantSlug, slug) {
|
|
726
|
+
return `/${tenantSlug}/team/groups/${slug}`;
|
|
727
|
+
}
|
|
728
|
+
var toolResultUiMetaSchema = z.object({
|
|
729
|
+
present: z.boolean().optional(),
|
|
730
|
+
entity: z.string().regex(TOOL_RESULT_UI_ENTITY_ID_RE).optional(),
|
|
731
|
+
rowsPath: z.string().min(1).optional(),
|
|
732
|
+
layout: z.enum(["list", "chart", "table"]).optional()
|
|
733
|
+
}).strict();
|
|
734
|
+
var agentOnlyFields = {
|
|
735
|
+
replyGuidance: z.string().optional(),
|
|
736
|
+
ui: toolResultUiMetaSchema.optional(),
|
|
737
|
+
uiHint: z.enum(["list", "chart", "table"]).optional()
|
|
738
|
+
};
|
|
739
|
+
function withAgentOnlyFields(shape) {
|
|
740
|
+
return z.object({
|
|
741
|
+
...shape,
|
|
742
|
+
...agentOnlyFields
|
|
743
|
+
});
|
|
744
|
+
}
|
|
745
|
+
var productEntityRowSchema = z.object({
|
|
746
|
+
id: z.string().min(1),
|
|
747
|
+
name: z.string().min(1),
|
|
748
|
+
price: z.number(),
|
|
749
|
+
currency: z.string().min(1),
|
|
750
|
+
inStock: z.boolean(),
|
|
751
|
+
url: z.string().min(1)
|
|
752
|
+
});
|
|
753
|
+
var metricPointEntityRowSchema = z.object({
|
|
754
|
+
date: z.string().optional(),
|
|
755
|
+
category: z.string().optional(),
|
|
756
|
+
label: z.string().optional()
|
|
757
|
+
}).catchall(z.union([z.string(), z.number()]));
|
|
758
|
+
var memberEntityRowSchema = z.object({
|
|
759
|
+
name: z.string(),
|
|
760
|
+
email: z.string(),
|
|
761
|
+
role: z.string(),
|
|
762
|
+
membershipKind: z.string(),
|
|
763
|
+
profilePictureUrl: z.string().nullable()
|
|
764
|
+
});
|
|
765
|
+
var taskEntityRowSchema = z.object({
|
|
766
|
+
id: z.string().min(1),
|
|
767
|
+
name: z.string().min(1),
|
|
768
|
+
status: z.string().min(1),
|
|
769
|
+
type: z.string().nullable(),
|
|
770
|
+
description: z.string().nullable(),
|
|
771
|
+
validUntil: z.number(),
|
|
772
|
+
createdAt: z.number(),
|
|
773
|
+
url: z.string().min(1),
|
|
774
|
+
threadPriority: z.string().nullable().optional()
|
|
775
|
+
});
|
|
776
|
+
var groupEntityRowSchema = z.object({
|
|
777
|
+
name: z.string().min(1),
|
|
778
|
+
slug: z.string().min(1),
|
|
779
|
+
description: z.string().nullable(),
|
|
780
|
+
memberCount: z.number().nullable(),
|
|
781
|
+
url: z.string().min(1)
|
|
782
|
+
});
|
|
783
|
+
var groupDetailEntitySchema = z.object({
|
|
784
|
+
name: z.string().min(1),
|
|
785
|
+
slug: z.string().min(1),
|
|
786
|
+
description: z.string().nullable(),
|
|
787
|
+
url: z.string().min(1),
|
|
788
|
+
members: z.array(
|
|
789
|
+
z.object({
|
|
790
|
+
name: z.string(),
|
|
791
|
+
email: z.string(),
|
|
792
|
+
profilePictureUrl: z.string().nullable()
|
|
793
|
+
})
|
|
794
|
+
)
|
|
795
|
+
});
|
|
796
|
+
var statusEntityRowSchema = z.object({
|
|
797
|
+
id: z.string().min(1),
|
|
798
|
+
name: z.string().min(1),
|
|
799
|
+
status: z.string().min(1),
|
|
800
|
+
url: z.string().min(1),
|
|
801
|
+
type: z.string().nullable().optional(),
|
|
802
|
+
description: z.string().nullable().optional()
|
|
803
|
+
});
|
|
804
|
+
var agentAdminErrorResultSchema = z.object({
|
|
805
|
+
ok: z.literal(false),
|
|
806
|
+
status: z.number().optional(),
|
|
807
|
+
message: z.string(),
|
|
808
|
+
response: z.unknown().optional()
|
|
809
|
+
});
|
|
810
|
+
var agentAdminMutationResultSchema = z.object({
|
|
811
|
+
...agentOnlyFields
|
|
812
|
+
}).passthrough();
|
|
813
|
+
var searchProductsOutputSchema = withAgentOnlyFields({
|
|
814
|
+
items: z.array(productEntityRowSchema)
|
|
815
|
+
});
|
|
816
|
+
var generateRandomChartOutputSchema = withAgentOnlyFields({
|
|
817
|
+
title: z.string().min(1),
|
|
818
|
+
axis: z.enum(["time", "category"]),
|
|
819
|
+
series: z.array(metricPointEntityRowSchema)
|
|
820
|
+
});
|
|
821
|
+
var generateImageOutputSchema = withAgentOnlyFields({
|
|
822
|
+
prompt: z.string().min(1),
|
|
823
|
+
mediaType: z.string().min(1),
|
|
824
|
+
model: z.string().min(1),
|
|
825
|
+
storageId: z.string().min(1),
|
|
826
|
+
url: z.string().min(1),
|
|
827
|
+
/** @deprecated Legacy sessions only — prefer storageId/url. */
|
|
828
|
+
base64: z.string().min(1).optional()
|
|
829
|
+
});
|
|
830
|
+
var manageTeamMembersListOutputSchema = withAgentOnlyFields({
|
|
831
|
+
members: z.array(memberEntityRowSchema)
|
|
832
|
+
});
|
|
833
|
+
var manageTeamMembersDetailOutputSchema = withAgentOnlyFields(
|
|
834
|
+
memberEntityRowSchema.shape
|
|
835
|
+
);
|
|
836
|
+
var manageTeamMembersOutputSchema = z.union([
|
|
837
|
+
manageTeamMembersListOutputSchema,
|
|
838
|
+
manageTeamMembersDetailOutputSchema,
|
|
839
|
+
agentAdminMutationResultSchema,
|
|
840
|
+
agentAdminErrorResultSchema
|
|
841
|
+
]);
|
|
842
|
+
var manageGroupsListOutputSchema = withAgentOnlyFields({
|
|
843
|
+
groups: z.array(groupEntityRowSchema)
|
|
844
|
+
});
|
|
845
|
+
var manageGroupsDetailOutputSchema = withAgentOnlyFields(
|
|
846
|
+
groupDetailEntitySchema.shape
|
|
847
|
+
);
|
|
848
|
+
var manageGroupsSummaryOutputSchema = withAgentOnlyFields(
|
|
849
|
+
groupEntityRowSchema.shape
|
|
850
|
+
);
|
|
851
|
+
var manageGroupsOutputSchema = z.union([
|
|
852
|
+
manageGroupsListOutputSchema,
|
|
853
|
+
manageGroupsDetailOutputSchema,
|
|
854
|
+
manageGroupsSummaryOutputSchema,
|
|
855
|
+
agentAdminMutationResultSchema,
|
|
856
|
+
agentAdminErrorResultSchema
|
|
857
|
+
]);
|
|
858
|
+
var queryTasksListOutputSchema = withAgentOnlyFields({
|
|
859
|
+
items: z.array(taskEntityRowSchema),
|
|
860
|
+
nextCursor: z.string().nullable().optional()
|
|
861
|
+
});
|
|
862
|
+
var queryTasksDetailOutputSchema = withAgentOnlyFields({
|
|
863
|
+
id: z.string().nullable(),
|
|
864
|
+
status: z.string().nullable(),
|
|
865
|
+
type: z.string().nullable(),
|
|
866
|
+
name: z.string().nullable(),
|
|
867
|
+
description: z.string().nullable(),
|
|
868
|
+
validUntil: z.number().nullable(),
|
|
869
|
+
createdAt: z.number().nullable(),
|
|
870
|
+
url: z.string().min(1).nullable()
|
|
871
|
+
});
|
|
872
|
+
var queryTasksOutputSchema = z.union([
|
|
873
|
+
queryTasksListOutputSchema,
|
|
874
|
+
queryTasksDetailOutputSchema,
|
|
875
|
+
agentAdminErrorResultSchema
|
|
876
|
+
]);
|
|
877
|
+
var assignTasksOutputSchema = z.union([
|
|
878
|
+
withAgentOnlyFields({
|
|
879
|
+
results: z.array(statusEntityRowSchema)
|
|
880
|
+
}),
|
|
881
|
+
agentAdminErrorResultSchema
|
|
882
|
+
]);
|
|
883
|
+
var workspaceUsageEntitySchema = z.object({
|
|
884
|
+
workspace: z.string(),
|
|
885
|
+
plan: z.string(),
|
|
886
|
+
planType: z.string(),
|
|
887
|
+
trialState: z.string(),
|
|
888
|
+
daysRemaining: z.number().nullable(),
|
|
889
|
+
isPaidPro: z.boolean(),
|
|
890
|
+
subscriptionStatus: z.string(),
|
|
891
|
+
tasksToday: z.string(),
|
|
892
|
+
tasksResetAt: z.string(),
|
|
893
|
+
openTasks: z.number(),
|
|
894
|
+
totalTasks: z.number(),
|
|
895
|
+
seats: z.string(),
|
|
896
|
+
groups: z.string(),
|
|
897
|
+
apiKeys: z.string(),
|
|
898
|
+
rateLimitPerSecond: z.number()
|
|
899
|
+
});
|
|
900
|
+
var getWorkspaceUsageOutputSchema = z.union([
|
|
901
|
+
withAgentOnlyFields({
|
|
902
|
+
usage: workspaceUsageEntitySchema
|
|
903
|
+
}),
|
|
904
|
+
agentAdminErrorResultSchema
|
|
905
|
+
]);
|
|
906
|
+
|
|
560
907
|
// src/eve/resume-message.ts
|
|
561
908
|
function buildTaskHandledResumeMessage(payload) {
|
|
562
909
|
const handledBy = payload.handledBy?.trim() || "someone";
|
|
@@ -574,7 +921,10 @@ export {
|
|
|
574
921
|
EVE_INPUT_OTHER_CHOICE_ID,
|
|
575
922
|
EVE_INPUT_OTHER_CHOICE_LABEL,
|
|
576
923
|
EVE_INPUT_SUBMIT_ACTION_ID,
|
|
924
|
+
GENERATE_IMAGE_REPLY_GUIDANCE,
|
|
925
|
+
GENERATE_RANDOM_CHART_REPLY_GUIDANCE,
|
|
577
926
|
GET_WEATHER_REPLY_GUIDANCE,
|
|
927
|
+
GET_WORKSPACE_USAGE_REPLY_GUIDANCE,
|
|
578
928
|
MANAGE_GROUPS_DETAIL_REPLY_GUIDANCE,
|
|
579
929
|
MANAGE_GROUPS_LIST_REPLY_GUIDANCE,
|
|
580
930
|
MANAGE_TEAM_MEMBERS_DETAIL_REPLY_GUIDANCE,
|
|
@@ -586,29 +936,71 @@ export {
|
|
|
586
936
|
ROBOTROCK_READY_HOOK_SLUG,
|
|
587
937
|
SEARCH_PRODUCTS_REPLY_GUIDANCE,
|
|
588
938
|
TOOL_REPLY_GUIDANCE_FIELD,
|
|
939
|
+
TOOL_RESULT_UI_ENTITIES,
|
|
940
|
+
TOOL_RESULT_UI_ENTITY_ID_RE,
|
|
941
|
+
TOOL_UI_FIELD,
|
|
942
|
+
TOOL_UI_HINT_FIELD,
|
|
589
943
|
WHOAMI_REPLY_GUIDANCE,
|
|
944
|
+
agentAdminErrorResultSchema,
|
|
945
|
+
agentAdminMutationResultSchema,
|
|
946
|
+
assignTasksOutputSchema,
|
|
590
947
|
buildChatToolAuditPayload,
|
|
591
948
|
buildEveInputAuditSubmissionData,
|
|
592
949
|
buildTaskHandledResumeMessage,
|
|
950
|
+
buildTenantGroupUrl,
|
|
951
|
+
buildTenantTaskUrl,
|
|
593
952
|
eveInputRequestTaskType,
|
|
594
953
|
eveInputRequestToActions,
|
|
595
954
|
eveInputResponseToActionSubmission,
|
|
955
|
+
extractToolResultUiMeta,
|
|
956
|
+
extractToolUiHint,
|
|
596
957
|
formatEveApprovalTitle,
|
|
597
958
|
formatToolListResult,
|
|
598
959
|
formatToolObjectResult,
|
|
960
|
+
formatToolQueryResult,
|
|
961
|
+
generateImageOutputSchema,
|
|
962
|
+
generateRandomChartOutputSchema,
|
|
599
963
|
getToolDisplayLabel,
|
|
964
|
+
getWorkspaceUsageOutputSchema,
|
|
965
|
+
groupDetailEntitySchema,
|
|
966
|
+
groupEntityRowSchema,
|
|
600
967
|
isAgentAdminErrorResult,
|
|
601
968
|
isEveApprovalInputRequest,
|
|
969
|
+
isToolResultUiEntity,
|
|
970
|
+
isToolResultUiEntityId,
|
|
971
|
+
isToolUiHint,
|
|
972
|
+
legacyPatternToLayout,
|
|
973
|
+
manageGroupsDetailOutputSchema,
|
|
974
|
+
manageGroupsListOutputSchema,
|
|
975
|
+
manageGroupsOutputSchema,
|
|
976
|
+
manageGroupsSummaryOutputSchema,
|
|
977
|
+
manageTeamMembersDetailOutputSchema,
|
|
978
|
+
manageTeamMembersListOutputSchema,
|
|
979
|
+
manageTeamMembersOutputSchema,
|
|
980
|
+
memberEntityRowSchema,
|
|
981
|
+
metricPointEntityRowSchema,
|
|
602
982
|
normalizeEveSelectFormData,
|
|
603
983
|
parseEveAskQuestionToolOutput,
|
|
984
|
+
productEntityRowSchema,
|
|
985
|
+
queryTasksDetailOutputSchema,
|
|
986
|
+
queryTasksListOutputSchema,
|
|
987
|
+
queryTasksOutputSchema,
|
|
604
988
|
resolveEveFreeformTextToInputResponse,
|
|
605
989
|
resolveEveInputDisplay,
|
|
606
990
|
sanitizeToolAuditInput,
|
|
991
|
+
searchProductsOutputSchema,
|
|
607
992
|
setToolDisplayLabelOverrides,
|
|
608
993
|
shouldAuditToolExecution,
|
|
994
|
+
statusEntityRowSchema,
|
|
609
995
|
stripAgentOnlyToolFields,
|
|
996
|
+
taskEntityRowSchema,
|
|
610
997
|
taskHandledToEveInputResponse,
|
|
611
998
|
toolDisplayResult,
|
|
612
|
-
|
|
999
|
+
toolResultUiMetaSchema,
|
|
1000
|
+
uiHintToLayout,
|
|
1001
|
+
withReplyGuidance,
|
|
1002
|
+
withToolUi,
|
|
1003
|
+
withUiHint,
|
|
1004
|
+
workspaceUsageEntitySchema
|
|
613
1005
|
};
|
|
614
1006
|
//# sourceMappingURL=index.js.map
|