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
|
@@ -12,7 +12,7 @@ import '../../tool-reply-guidance-C3qrT1In.js';
|
|
|
12
12
|
import 'zod';
|
|
13
13
|
import '../../tenant-DmN0MMyC.js';
|
|
14
14
|
import 'eve/context';
|
|
15
|
-
import '
|
|
15
|
+
import '../../tool-ui-hint-CMpug5sC.js';
|
|
16
16
|
|
|
17
17
|
type CreateRobotrockToolsOptions = {
|
|
18
18
|
inbox?: false | DefineCreateInboxTaskToolOptions;
|
package/dist/eve/tools/index.js
CHANGED
|
@@ -1710,6 +1710,15 @@ async function postRobotRockLinkChatTask(ctx, input) {
|
|
|
1710
1710
|
}
|
|
1711
1711
|
}
|
|
1712
1712
|
|
|
1713
|
+
// src/eve/tool-ui-hint.ts
|
|
1714
|
+
var TOOL_UI_HINT_FIELD = "uiHint";
|
|
1715
|
+
function withUiHint(result, hint) {
|
|
1716
|
+
return {
|
|
1717
|
+
...result,
|
|
1718
|
+
[TOOL_UI_HINT_FIELD]: hint
|
|
1719
|
+
};
|
|
1720
|
+
}
|
|
1721
|
+
|
|
1713
1722
|
// src/eve/tool-reply-guidance.ts
|
|
1714
1723
|
var TOOL_REPLY_GUIDANCE_FIELD = "replyGuidance";
|
|
1715
1724
|
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).";
|
|
@@ -1824,69 +1833,22 @@ var createInboxTaskTool = defineCreateInboxTaskTool();
|
|
|
1824
1833
|
import { defineTool as defineTool2 } from "eve/tools";
|
|
1825
1834
|
import { z as z7 } from "zod";
|
|
1826
1835
|
|
|
1827
|
-
// src/eve/tool-result-display.ts
|
|
1828
|
-
function toolDisplayResult(data, options) {
|
|
1829
|
-
const display = options?.widget || options?.title || options?.description ? {
|
|
1830
|
-
...options.widget ? { widget: options.widget } : {},
|
|
1831
|
-
...options.title ? { title: options.title } : {},
|
|
1832
|
-
...options.description ? { description: options.description } : {}
|
|
1833
|
-
} : void 0;
|
|
1834
|
-
return {
|
|
1835
|
-
...display ? { display } : {},
|
|
1836
|
-
data,
|
|
1837
|
-
...options?.ui ? { ui: options.ui } : {}
|
|
1838
|
-
};
|
|
1839
|
-
}
|
|
1840
|
-
|
|
1841
1836
|
// src/eve/tool-display-format.ts
|
|
1842
1837
|
function formatToolObjectResult(data, options) {
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
}),
|
|
1849
|
-
options.replyGuidance
|
|
1850
|
-
);
|
|
1838
|
+
const withGuidance = withReplyGuidance(data, options.replyGuidance);
|
|
1839
|
+
if (options.uiHint) {
|
|
1840
|
+
return withUiHint(withGuidance, options.uiHint);
|
|
1841
|
+
}
|
|
1842
|
+
return withGuidance;
|
|
1851
1843
|
}
|
|
1852
1844
|
function formatToolListResult(listKey, items, options) {
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
"ui:widget": options.itemWidget,
|
|
1857
|
-
...options.itemUi ?? {}
|
|
1858
|
-
}
|
|
1859
|
-
} : {
|
|
1860
|
-
"ui:widget": "table",
|
|
1861
|
-
...options.itemUi ? { items: options.itemUi } : {}
|
|
1862
|
-
};
|
|
1863
|
-
return formatToolObjectResult(
|
|
1864
|
-
{ [listKey]: items },
|
|
1865
|
-
{
|
|
1866
|
-
title: options.title,
|
|
1867
|
-
ui: {
|
|
1868
|
-
[listKey]: listFieldUi
|
|
1869
|
-
},
|
|
1870
|
-
replyGuidance: options.replyGuidance
|
|
1871
|
-
}
|
|
1845
|
+
return withUiHint(
|
|
1846
|
+
withReplyGuidance({ [listKey]: items }, options.replyGuidance),
|
|
1847
|
+
"list"
|
|
1872
1848
|
);
|
|
1873
1849
|
}
|
|
1874
1850
|
|
|
1875
1851
|
// src/eve/tools/identity/format-my-access.ts
|
|
1876
|
-
var ACCESS_FIELD_UI = {
|
|
1877
|
-
workspace: { "ui:title": "Workspace" },
|
|
1878
|
-
role: { "ui:title": "Role" },
|
|
1879
|
-
tenantAdmin: { "ui:title": "Tenant admin", "ui:widget": "boolean" },
|
|
1880
|
-
groups: { "ui:title": "Groups" },
|
|
1881
|
-
manageSettings: { "ui:title": "Manage settings", "ui:widget": "boolean" },
|
|
1882
|
-
manageBilling: { "ui:title": "Manage billing", "ui:widget": "boolean" },
|
|
1883
|
-
manageTeam: { "ui:title": "Manage team", "ui:widget": "boolean" },
|
|
1884
|
-
manageIntegrations: {
|
|
1885
|
-
"ui:title": "Manage integrations",
|
|
1886
|
-
"ui:widget": "boolean"
|
|
1887
|
-
},
|
|
1888
|
-
email: { "ui:title": "Email" }
|
|
1889
|
-
};
|
|
1890
1852
|
function formatMyAccessResult(input) {
|
|
1891
1853
|
return formatToolObjectResult(
|
|
1892
1854
|
{
|
|
@@ -1903,13 +1865,6 @@ function formatMyAccessResult(input) {
|
|
|
1903
1865
|
}
|
|
1904
1866
|
},
|
|
1905
1867
|
{
|
|
1906
|
-
ui: {
|
|
1907
|
-
access: {
|
|
1908
|
-
"ui:widget": "access",
|
|
1909
|
-
"ui:title": "Your access",
|
|
1910
|
-
items: ACCESS_FIELD_UI
|
|
1911
|
-
}
|
|
1912
|
-
},
|
|
1913
1868
|
replyGuidance: MY_ACCESS_REPLY_GUIDANCE
|
|
1914
1869
|
}
|
|
1915
1870
|
);
|
|
@@ -1928,7 +1883,7 @@ function tenantCapabilities(isAdmin) {
|
|
|
1928
1883
|
}
|
|
1929
1884
|
function defineMyAccessTool() {
|
|
1930
1885
|
return defineTool2({
|
|
1931
|
-
description: "Check the authenticated user's tenant role, group memberships, and admin capabilities in RobotRock. Results render as
|
|
1886
|
+
description: "Check the authenticated user's tenant role, group memberships, and admin capabilities in RobotRock. Always call this before tenant-admin tools (manage_team_members, manage_groups, query_tasks) in the same turn \u2014 including read-only requests like listing users. Results render as a visible access tool card in chat like other tools; do not restate role, groups, or capabilities in your reply.",
|
|
1932
1887
|
inputSchema: myAccessInputSchema,
|
|
1933
1888
|
async execute(_input, ctx) {
|
|
1934
1889
|
const caller = tryResolveTenantCaller(ctx);
|
|
@@ -2026,31 +1981,14 @@ var DEMO_PRODUCTS = [
|
|
|
2026
1981
|
];
|
|
2027
1982
|
function defineSearchProductsTool() {
|
|
2028
1983
|
return defineTool4({
|
|
2029
|
-
description: "Search the product catalog and return matching items
|
|
1984
|
+
description: "Search the product catalog and return matching items. Results render in chat UI \u2014 do not restate product names, prices, or SKUs in your reply.",
|
|
2030
1985
|
inputSchema: searchProductsInputSchema,
|
|
2031
1986
|
async execute({ query }) {
|
|
2032
1987
|
const normalized = query.trim().toLowerCase();
|
|
2033
1988
|
const items = DEMO_PRODUCTS.filter(
|
|
2034
1989
|
(product) => product.name.toLowerCase().includes(normalized) || product.id.toLowerCase().includes(normalized)
|
|
2035
1990
|
);
|
|
2036
|
-
return withReplyGuidance(
|
|
2037
|
-
toolDisplayResult(
|
|
2038
|
-
{ items: [...items] },
|
|
2039
|
-
{
|
|
2040
|
-
title: items.length === 1 ? "1 product" : `${items.length} products`,
|
|
2041
|
-
ui: {
|
|
2042
|
-
items: {
|
|
2043
|
-
"ui:widget": "list",
|
|
2044
|
-
"ui:title": "Results",
|
|
2045
|
-
items: {
|
|
2046
|
-
"ui:widget": "productInfo"
|
|
2047
|
-
}
|
|
2048
|
-
}
|
|
2049
|
-
}
|
|
2050
|
-
}
|
|
2051
|
-
),
|
|
2052
|
-
SEARCH_PRODUCTS_REPLY_GUIDANCE
|
|
2053
|
-
);
|
|
1991
|
+
return withReplyGuidance({ items: [...items] }, SEARCH_PRODUCTS_REPLY_GUIDANCE);
|
|
2054
1992
|
}
|
|
2055
1993
|
});
|
|
2056
1994
|
}
|
|
@@ -2227,12 +2165,6 @@ function requireBoundAgentAdminClient(ctx) {
|
|
|
2227
2165
|
}
|
|
2228
2166
|
|
|
2229
2167
|
// src/eve/tools/admin/format-team-members-list.ts
|
|
2230
|
-
var MEMBER_DETAIL_UI = {
|
|
2231
|
-
name: { "ui:title": "Name" },
|
|
2232
|
-
email: { "ui:title": "Email" },
|
|
2233
|
-
role: { "ui:title": "Role" },
|
|
2234
|
-
membershipKind: { "ui:title": "Membership" }
|
|
2235
|
-
};
|
|
2236
2168
|
function serializeMemberRow(member) {
|
|
2237
2169
|
return {
|
|
2238
2170
|
name: member.user.name,
|
|
@@ -2242,21 +2174,16 @@ function serializeMemberRow(member) {
|
|
|
2242
2174
|
};
|
|
2243
2175
|
}
|
|
2244
2176
|
function formatTeamMembersListResult(members) {
|
|
2245
|
-
const countLabel = members.length === 1 ? "1 team member" : `${members.length} team members`;
|
|
2246
2177
|
return formatToolListResult(
|
|
2247
2178
|
"members",
|
|
2248
2179
|
members.map(serializeMemberRow),
|
|
2249
2180
|
{
|
|
2250
|
-
title: countLabel,
|
|
2251
|
-
itemWidget: "tenantMember",
|
|
2252
2181
|
replyGuidance: MANAGE_TEAM_MEMBERS_LIST_REPLY_GUIDANCE
|
|
2253
2182
|
}
|
|
2254
2183
|
);
|
|
2255
2184
|
}
|
|
2256
|
-
function formatTeamMemberDetailResult(member
|
|
2185
|
+
function formatTeamMemberDetailResult(member) {
|
|
2257
2186
|
return formatToolObjectResult(serializeMemberRow(member), {
|
|
2258
|
-
title: options?.title ?? member.user.name,
|
|
2259
|
-
ui: MEMBER_DETAIL_UI,
|
|
2260
2187
|
replyGuidance: MANAGE_TEAM_MEMBERS_DETAIL_REPLY_GUIDANCE
|
|
2261
2188
|
});
|
|
2262
2189
|
}
|
|
@@ -2308,19 +2235,14 @@ var manageTeamMembersInputSchema = z10.object({
|
|
|
2308
2235
|
function resolveMemberRef(input) {
|
|
2309
2236
|
return input.userId ?? input.email;
|
|
2310
2237
|
}
|
|
2311
|
-
function formatMemberMutationResult(payload
|
|
2238
|
+
function formatMemberMutationResult(payload) {
|
|
2312
2239
|
return formatToolObjectResult(payload, {
|
|
2313
|
-
title,
|
|
2314
|
-
ui: {
|
|
2315
|
-
success: { "ui:title": "Success", "ui:widget": "boolean" },
|
|
2316
|
-
promoted: { "ui:title": "Promoted existing user", "ui:widget": "boolean" }
|
|
2317
|
-
},
|
|
2318
2240
|
replyGuidance: ADMIN_MUTATION_REPLY_GUIDANCE
|
|
2319
2241
|
});
|
|
2320
2242
|
}
|
|
2321
2243
|
function defineManageTeamMembersTool() {
|
|
2322
2244
|
return defineTool5({
|
|
2323
|
-
description: "Tenant-admin tool for workspace team members: list, get, invite, change role, or remove. Requires tenant admin access. Use member email from list results for get, update_role, and remove \u2014 internal ids are optional. Results render as chat UI cards \u2014 do not restate member names, emails, or roles in your reply.",
|
|
2245
|
+
description: "Tenant-admin tool for workspace team members: list, get, invite, change role, or remove. Requires tenant admin access. Call get_my_access in the same turn before this tool to verify admin access (the check renders as its own chat tool card). Use member email from list results for get, update_role, and remove \u2014 internal ids are optional. Results render as chat UI cards \u2014 do not restate member names, emails, or roles in your reply.",
|
|
2324
2246
|
inputSchema: manageTeamMembersInputSchema,
|
|
2325
2247
|
async execute(input, ctx) {
|
|
2326
2248
|
const api = requireBoundAgentAdminClient(ctx);
|
|
@@ -2343,13 +2265,11 @@ function defineManageTeamMembersTool() {
|
|
|
2343
2265
|
});
|
|
2344
2266
|
if (result.member) {
|
|
2345
2267
|
return formatTeamMemberDetailResult(
|
|
2346
|
-
result.member
|
|
2347
|
-
{ title: "Member invited" }
|
|
2268
|
+
result.member
|
|
2348
2269
|
);
|
|
2349
2270
|
}
|
|
2350
2271
|
return formatMemberMutationResult(
|
|
2351
|
-
result
|
|
2352
|
-
"Invitation sent"
|
|
2272
|
+
result
|
|
2353
2273
|
);
|
|
2354
2274
|
}
|
|
2355
2275
|
case "update_role": {
|
|
@@ -2358,16 +2278,14 @@ function defineManageTeamMembersTool() {
|
|
|
2358
2278
|
input.role
|
|
2359
2279
|
);
|
|
2360
2280
|
return formatMemberMutationResult(
|
|
2361
|
-
result
|
|
2362
|
-
"Member role updated"
|
|
2281
|
+
result
|
|
2363
2282
|
);
|
|
2364
2283
|
}
|
|
2365
2284
|
case "remove": {
|
|
2366
2285
|
const memberId = resolveMemberRef(input);
|
|
2367
2286
|
const result = await api.members.remove(memberId);
|
|
2368
2287
|
return formatMemberMutationResult(
|
|
2369
|
-
result
|
|
2370
|
-
"Member removed"
|
|
2288
|
+
result
|
|
2371
2289
|
);
|
|
2372
2290
|
}
|
|
2373
2291
|
}
|
|
@@ -2392,12 +2310,6 @@ import { defineTool as defineTool6 } from "eve/tools";
|
|
|
2392
2310
|
import { z as z11 } from "zod";
|
|
2393
2311
|
|
|
2394
2312
|
// src/eve/tools/admin/format-groups-list.ts
|
|
2395
|
-
var GROUP_ITEM_UI = {
|
|
2396
|
-
name: { "ui:title": "Name" },
|
|
2397
|
-
slug: { "ui:title": "Slug" },
|
|
2398
|
-
description: { "ui:title": "Description" },
|
|
2399
|
-
memberCount: { "ui:title": "Members", "ui:widget": "number" }
|
|
2400
|
-
};
|
|
2401
2313
|
function serializeGroupRow(group) {
|
|
2402
2314
|
return {
|
|
2403
2315
|
name: group.name,
|
|
@@ -2407,13 +2319,10 @@ function serializeGroupRow(group) {
|
|
|
2407
2319
|
};
|
|
2408
2320
|
}
|
|
2409
2321
|
function formatGroupsListResult(groups) {
|
|
2410
|
-
const countLabel = groups.length === 1 ? "1 group" : `${groups.length} groups`;
|
|
2411
2322
|
return formatToolListResult(
|
|
2412
2323
|
"groups",
|
|
2413
2324
|
groups.map(serializeGroupRow),
|
|
2414
2325
|
{
|
|
2415
|
-
title: countLabel,
|
|
2416
|
-
itemWidget: "tenantGroup",
|
|
2417
2326
|
replyGuidance: MANAGE_GROUPS_LIST_REPLY_GUIDANCE
|
|
2418
2327
|
}
|
|
2419
2328
|
);
|
|
@@ -2430,28 +2339,12 @@ function formatGroupDetailResult(group) {
|
|
|
2430
2339
|
}))
|
|
2431
2340
|
},
|
|
2432
2341
|
{
|
|
2433
|
-
title: group.name,
|
|
2434
|
-
ui: {
|
|
2435
|
-
name: { "ui:title": "Name" },
|
|
2436
|
-
slug: { "ui:title": "Slug" },
|
|
2437
|
-
description: { "ui:title": "Description" },
|
|
2438
|
-
members: {
|
|
2439
|
-
"ui:widget": "list",
|
|
2440
|
-
"ui:title": "Members",
|
|
2441
|
-
items: {
|
|
2442
|
-
name: { "ui:title": "Name" },
|
|
2443
|
-
email: { "ui:title": "Email" }
|
|
2444
|
-
}
|
|
2445
|
-
}
|
|
2446
|
-
},
|
|
2447
2342
|
replyGuidance: MANAGE_GROUPS_DETAIL_REPLY_GUIDANCE
|
|
2448
2343
|
}
|
|
2449
2344
|
);
|
|
2450
2345
|
}
|
|
2451
2346
|
function formatGroupSummaryResult(group) {
|
|
2452
2347
|
return formatToolObjectResult(serializeGroupRow(group), {
|
|
2453
|
-
title: group.name,
|
|
2454
|
-
ui: GROUP_ITEM_UI,
|
|
2455
2348
|
replyGuidance: MANAGE_GROUPS_DETAIL_REPLY_GUIDANCE
|
|
2456
2349
|
});
|
|
2457
2350
|
}
|
|
@@ -2520,9 +2413,8 @@ var manageGroupsInputSchema = z11.object({
|
|
|
2520
2413
|
break;
|
|
2521
2414
|
}
|
|
2522
2415
|
});
|
|
2523
|
-
function formatGroupMutationResult(payload
|
|
2416
|
+
function formatGroupMutationResult(payload) {
|
|
2524
2417
|
return formatToolObjectResult(payload, {
|
|
2525
|
-
title,
|
|
2526
2418
|
replyGuidance: ADMIN_MUTATION_REPLY_GUIDANCE
|
|
2527
2419
|
});
|
|
2528
2420
|
}
|
|
@@ -2534,7 +2426,7 @@ function resolveMemberRef2(input) {
|
|
|
2534
2426
|
}
|
|
2535
2427
|
function defineManageGroupsTool() {
|
|
2536
2428
|
return defineTool6({
|
|
2537
|
-
description: "Tenant-admin tool for workspace groups: list, get, create, update, delete, and manage group membership. Requires tenant admin access. Use group slug (e.g. finance) from list results for get and membership actions \u2014 internal ids are optional. Use member email for add_member and remove_member when user ids are unknown. Results render as chat UI cards \u2014 do not restate group or member fields in your reply.",
|
|
2429
|
+
description: "Tenant-admin tool for workspace groups: list, get, create, update, delete, and manage group membership. Requires tenant admin access. Call get_my_access in the same turn before this tool to verify admin access (the check renders as its own chat tool card). Use group slug (e.g. finance) from list results for get and membership actions \u2014 internal ids are optional. Use member email for add_member and remove_member when user ids are unknown. Results render as chat UI cards \u2014 do not restate group or member fields in your reply.",
|
|
2538
2430
|
inputSchema: manageGroupsInputSchema,
|
|
2539
2431
|
async execute(input, ctx) {
|
|
2540
2432
|
const api = requireBoundAgentAdminClient(ctx);
|
|
@@ -2565,8 +2457,7 @@ function defineManageGroupsTool() {
|
|
|
2565
2457
|
case "delete": {
|
|
2566
2458
|
const result = await api.groups.delete(resolveGroupRef(input));
|
|
2567
2459
|
return formatGroupMutationResult(
|
|
2568
|
-
result
|
|
2569
|
-
"Group deleted"
|
|
2460
|
+
result
|
|
2570
2461
|
);
|
|
2571
2462
|
}
|
|
2572
2463
|
case "add_member": {
|
|
@@ -2575,8 +2466,7 @@ function defineManageGroupsTool() {
|
|
|
2575
2466
|
resolveMemberRef2(input)
|
|
2576
2467
|
);
|
|
2577
2468
|
return formatGroupMutationResult(
|
|
2578
|
-
result
|
|
2579
|
-
"Group member added"
|
|
2469
|
+
result
|
|
2580
2470
|
);
|
|
2581
2471
|
}
|
|
2582
2472
|
case "remove_member": {
|
|
@@ -2585,8 +2475,7 @@ function defineManageGroupsTool() {
|
|
|
2585
2475
|
resolveMemberRef2(input)
|
|
2586
2476
|
);
|
|
2587
2477
|
return formatGroupMutationResult(
|
|
2588
|
-
result
|
|
2589
|
-
"Group member removed"
|
|
2478
|
+
result
|
|
2590
2479
|
);
|
|
2591
2480
|
}
|
|
2592
2481
|
}
|
|
@@ -2615,49 +2504,26 @@ function resolveTaskCardLabel(task) {
|
|
|
2615
2504
|
return task.name?.trim() || task.description?.trim() || task.type?.trim() || task.id?.trim() || "Untitled task";
|
|
2616
2505
|
}
|
|
2617
2506
|
function formatTasksListResult(items, options) {
|
|
2618
|
-
const
|
|
2619
|
-
|
|
2620
|
-
"items",
|
|
2621
|
-
items.map((task) => ({
|
|
2507
|
+
const payload = {
|
|
2508
|
+
items: items.map((task) => ({
|
|
2622
2509
|
id: task.id,
|
|
2623
2510
|
name: resolveTaskCardLabel(task),
|
|
2624
2511
|
status: task.status,
|
|
2625
2512
|
type: task.type,
|
|
2626
2513
|
description: task.description
|
|
2627
|
-
}))
|
|
2628
|
-
|
|
2629
|
-
title,
|
|
2630
|
-
itemWidget: "tenantTask",
|
|
2631
|
-
replyGuidance: QUERY_TASKS_LIST_REPLY_GUIDANCE
|
|
2632
|
-
}
|
|
2633
|
-
);
|
|
2514
|
+
}))
|
|
2515
|
+
};
|
|
2634
2516
|
if (options?.nextCursor) {
|
|
2635
|
-
|
|
2636
|
-
...result,
|
|
2637
|
-
data: {
|
|
2638
|
-
...result.data,
|
|
2639
|
-
nextCursor: options.nextCursor
|
|
2640
|
-
},
|
|
2641
|
-
display: {
|
|
2642
|
-
...result.display,
|
|
2643
|
-
description: "More tasks available \u2014 pass nextCursor to list again."
|
|
2644
|
-
}
|
|
2645
|
-
};
|
|
2517
|
+
payload.nextCursor = options.nextCursor;
|
|
2646
2518
|
}
|
|
2647
|
-
return
|
|
2648
|
-
|
|
2649
|
-
function formatTaskSearchResult(items, total) {
|
|
2650
|
-
return formatTasksListResult(items, {
|
|
2651
|
-
title: total === 1 ? "1 matching task" : `${total} matching tasks`
|
|
2519
|
+
return formatToolObjectResult(payload, {
|
|
2520
|
+
replyGuidance: QUERY_TASKS_LIST_REPLY_GUIDANCE
|
|
2652
2521
|
});
|
|
2653
2522
|
}
|
|
2523
|
+
function formatTaskSearchResult(items) {
|
|
2524
|
+
return formatTasksListResult(items);
|
|
2525
|
+
}
|
|
2654
2526
|
function formatTaskDetailResult(task) {
|
|
2655
|
-
const title = resolveTaskCardLabel({
|
|
2656
|
-
name: typeof task.name === "string" ? task.name : null,
|
|
2657
|
-
description: typeof task.description === "string" ? task.description : null,
|
|
2658
|
-
type: typeof task.type === "string" ? task.type : null,
|
|
2659
|
-
id: typeof task.id === "string" ? task.id : null
|
|
2660
|
-
});
|
|
2661
2527
|
return formatToolObjectResult(
|
|
2662
2528
|
{
|
|
2663
2529
|
id: task.id ?? null,
|
|
@@ -2669,23 +2535,11 @@ function formatTaskDetailResult(task) {
|
|
|
2669
2535
|
createdAt: task.createdAt ?? null
|
|
2670
2536
|
},
|
|
2671
2537
|
{
|
|
2672
|
-
title,
|
|
2673
|
-
ui: {
|
|
2674
|
-
id: { "ui:title": "Task ID" },
|
|
2675
|
-
status: { "ui:title": "Status" },
|
|
2676
|
-
type: { "ui:title": "Type" },
|
|
2677
|
-
name: { "ui:title": "Name" },
|
|
2678
|
-
description: { "ui:title": "Description" },
|
|
2679
|
-
validUntil: { "ui:title": "Valid until", "ui:widget": "date" },
|
|
2680
|
-
createdAt: { "ui:title": "Created", "ui:widget": "date" }
|
|
2681
|
-
},
|
|
2682
2538
|
replyGuidance: QUERY_TASKS_DETAIL_REPLY_GUIDANCE
|
|
2683
2539
|
}
|
|
2684
2540
|
);
|
|
2685
2541
|
}
|
|
2686
2542
|
function formatAssignTasksResult(results, _assignTo) {
|
|
2687
|
-
const succeeded = results.filter((row) => row.success).length;
|
|
2688
|
-
const title = succeeded === results.length ? `${succeeded === 1 ? "1 task" : `${succeeded} tasks`} reassigned` : `${succeeded}/${results.length} tasks reassigned`;
|
|
2689
2543
|
return formatToolListResult(
|
|
2690
2544
|
"results",
|
|
2691
2545
|
results.map((row) => ({
|
|
@@ -2701,8 +2555,6 @@ function formatAssignTasksResult(results, _assignTo) {
|
|
|
2701
2555
|
status: row.success ? "reassigned" : "failed"
|
|
2702
2556
|
})),
|
|
2703
2557
|
{
|
|
2704
|
-
title,
|
|
2705
|
-
itemWidget: "tenantTask",
|
|
2706
2558
|
replyGuidance: ASSIGN_TASKS_REPLY_GUIDANCE
|
|
2707
2559
|
}
|
|
2708
2560
|
);
|
|
@@ -2745,7 +2597,7 @@ var queryTasksInputSchema = z12.object({
|
|
|
2745
2597
|
});
|
|
2746
2598
|
function defineQueryTasksTool() {
|
|
2747
2599
|
return defineTool7({
|
|
2748
|
-
description: "Tenant-admin tool to list, fetch detail, or search inbox tasks in the workspace. Requires tenant admin access. Results render as chat UI cards \u2014 do not restate task names, ids, or statuses in your reply.",
|
|
2600
|
+
description: "Tenant-admin tool to list, fetch detail, or search inbox tasks in the workspace. Requires tenant admin access. Call get_my_access in the same turn before this tool to verify admin access (the check renders as its own chat tool card). Results render as chat UI cards \u2014 do not restate task names, ids, or statuses in your reply.",
|
|
2749
2601
|
inputSchema: queryTasksInputSchema,
|
|
2750
2602
|
async execute(input, ctx) {
|
|
2751
2603
|
const api = requireBoundAgentAdminClient(ctx);
|
|
@@ -2772,8 +2624,7 @@ function defineQueryTasksTool() {
|
|
|
2772
2624
|
case "search": {
|
|
2773
2625
|
const result = await api.tasks.search(input.query, input.limit);
|
|
2774
2626
|
return formatTaskSearchResult(
|
|
2775
|
-
result.items
|
|
2776
|
-
result.total
|
|
2627
|
+
result.items
|
|
2777
2628
|
);
|
|
2778
2629
|
}
|
|
2779
2630
|
}
|