robotrock 1.3.1 → 1.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/dist/agent-admin.d.ts +2 -1
  2. package/dist/agent-admin.js +44 -0
  3. package/dist/agent-admin.js.map +1 -1
  4. package/dist/ai/index.d.ts +6 -6
  5. package/dist/ai/index.js +34 -2
  6. package/dist/ai/index.js.map +1 -1
  7. package/dist/ai/trigger.d.ts +4 -4
  8. package/dist/ai/trigger.js +34 -2
  9. package/dist/ai/trigger.js.map +1 -1
  10. package/dist/ai/workflow.d.ts +4 -4
  11. package/dist/ai/workflow.js +34 -2
  12. package/dist/ai/workflow.js.map +1 -1
  13. package/dist/{auth-headers-qL-ZeEtd.d.ts → chat-correlation-BsHD-tOQ.d.ts} +6 -1
  14. package/dist/{client-YO9Y1rkH.d.ts → client-CZ5eWH5v.d.ts} +6 -1
  15. package/dist/eve/agent/index.d.ts +69 -6
  16. package/dist/eve/agent/index.js +165 -238
  17. package/dist/eve/agent/index.js.map +1 -1
  18. package/dist/eve/index.d.ts +3 -3
  19. package/dist/eve/index.js +1 -26
  20. package/dist/eve/index.js.map +1 -1
  21. package/dist/eve/tools/admin/assign-tasks.js +44 -0
  22. package/dist/eve/tools/admin/assign-tasks.js.map +1 -1
  23. package/dist/eve/tools/admin/manage-groups.js +44 -0
  24. package/dist/eve/tools/admin/manage-groups.js.map +1 -1
  25. package/dist/eve/tools/admin/manage-team-members.js +44 -0
  26. package/dist/eve/tools/admin/manage-team-members.js.map +1 -1
  27. package/dist/eve/tools/admin/query-tasks.js +44 -0
  28. package/dist/eve/tools/admin/query-tasks.js.map +1 -1
  29. package/dist/eve/tools/identity/index.d.ts +1 -1
  30. package/dist/eve/tools/identity/index.js +2 -0
  31. package/dist/eve/tools/identity/index.js.map +1 -1
  32. package/dist/eve/tools/identity/my-access.js +2 -0
  33. package/dist/eve/tools/identity/my-access.js.map +1 -1
  34. package/dist/eve/tools/identity/whoami.d.ts +1 -1
  35. package/dist/eve/tools/identity/whoami.js +2 -0
  36. package/dist/eve/tools/identity/whoami.js.map +1 -1
  37. package/dist/eve/tools/inbox/create-task.d.ts +1 -1
  38. package/dist/eve/tools/inbox/create-task.js +56 -31
  39. package/dist/eve/tools/inbox/create-task.js.map +1 -1
  40. package/dist/eve/tools/inbox/index.d.ts +1 -1
  41. package/dist/eve/tools/inbox/index.js +56 -31
  42. package/dist/eve/tools/inbox/index.js.map +1 -1
  43. package/dist/eve/tools/index.d.ts +1 -1
  44. package/dist/eve/tools/index.js +68 -31
  45. package/dist/eve/tools/index.js.map +1 -1
  46. package/dist/{index-DoQN48Bm.d.ts → index-DePyAbTI.d.ts} +6 -3
  47. package/dist/index.d.ts +4 -4
  48. package/dist/index.js +26 -2
  49. package/dist/index.js.map +1 -1
  50. package/dist/{tenant-5YKDrdC-.d.ts → tenant-DmN0MMyC.d.ts} +1 -0
  51. package/dist/{tool-approval-bridge-aMA79Z1B.d.ts → tool-approval-bridge-DnGaRES4.d.ts} +1 -1
  52. package/dist/trigger/index.d.ts +2 -2
  53. package/dist/trigger/index.js +26 -2
  54. package/dist/trigger/index.js.map +1 -1
  55. package/dist/{trigger-CXrbKVCL.d.ts → trigger--qTIK0s6.d.ts} +2 -2
  56. package/dist/workflow/index.d.ts +2 -2
  57. package/dist/workflow/index.js +26 -2
  58. package/dist/workflow/index.js.map +1 -1
  59. package/package.json +1 -1
@@ -2,5 +2,5 @@ export { CREATE_INBOX_TASK_TOOL_NAME, CreateInboxTaskToolInput, DefineCreateInbo
2
2
  import 'eve/tools';
3
3
  import '../../../tool-reply-guidance-C3qrT1In.js';
4
4
  import 'zod';
5
- import '../../../tenant-5YKDrdC-.js';
5
+ import '../../../tenant-DmN0MMyC.js';
6
6
  import 'eve/context';
@@ -868,11 +868,42 @@ function resolveRobotRockAuthConfig(overrides) {
868
868
  return { kind: "apiKey", apiKey };
869
869
  }
870
870
 
871
+ // src/chat-correlation.ts
872
+ var ROBOTROCK_CHAT_ID_HEADER = "x-robotrock-chat-id";
873
+ var ROBOTROCK_EVE_SESSION_ID_HEADER = "x-robotrock-eve-session-id";
874
+ function resolveChatCorrelationFromEnv() {
875
+ const chatId = process.env.ROBOTROCK_CHAT_ID?.trim();
876
+ const eveSessionId = process.env.ROBOTROCK_EVE_SESSION_ID?.trim();
877
+ if (!chatId && !eveSessionId) {
878
+ return void 0;
879
+ }
880
+ return {
881
+ ...chatId ? { chatId } : {},
882
+ ...eveSessionId ? { eveSessionId } : {}
883
+ };
884
+ }
885
+ function buildChatCorrelationHeaders(correlation) {
886
+ if (!correlation) {
887
+ return {};
888
+ }
889
+ const headers = {};
890
+ const chatId = correlation.chatId?.trim();
891
+ const eveSessionId = correlation.eveSessionId?.trim();
892
+ if (chatId) {
893
+ headers[ROBOTROCK_CHAT_ID_HEADER] = chatId;
894
+ }
895
+ if (eveSessionId) {
896
+ headers[ROBOTROCK_EVE_SESSION_ID_HEADER] = eveSessionId;
897
+ }
898
+ return headers;
899
+ }
900
+
871
901
  // src/chats.ts
872
902
  function createChatsApi(config) {
873
903
  const headers = () => ({
874
904
  "Content-Type": "application/json",
875
- ...buildRobotRockAuthHeaders(config.auth)
905
+ ...buildRobotRockAuthHeaders(config.auth),
906
+ ...buildChatCorrelationHeaders(config.chatCorrelation)
876
907
  });
877
908
  return {
878
909
  async create(input) {
@@ -1082,6 +1113,7 @@ function serializeValidUntil(value) {
1082
1113
  }
1083
1114
  var RobotRock = class {
1084
1115
  auth;
1116
+ chatCorrelation;
1085
1117
  baseUrl;
1086
1118
  app;
1087
1119
  agentVersion;
@@ -1109,6 +1141,7 @@ var RobotRock = class {
1109
1141
  ...apiKey ? { apiKey } : {},
1110
1142
  ...agentService ? { agentService } : {}
1111
1143
  });
1144
+ this.chatCorrelation = config.chatCorrelation;
1112
1145
  this.baseUrl = config.baseUrl ?? getRobotRockApiBaseUrl();
1113
1146
  this.app = config.app;
1114
1147
  this.agentVersion = config.version ?? resolveAgentVersionFromEnv();
@@ -1126,13 +1159,15 @@ var RobotRock = class {
1126
1159
  this.chats = createChatsApi({
1127
1160
  baseUrl: this.baseUrl,
1128
1161
  auth: this.auth,
1129
- app: this.app
1162
+ app: this.app,
1163
+ chatCorrelation: this.chatCorrelation
1130
1164
  });
1131
1165
  }
1132
1166
  authHeaders(extra) {
1133
1167
  return {
1134
1168
  "Content-Type": "application/json",
1135
1169
  ...buildRobotRockAuthHeaders(this.auth),
1170
+ ...buildChatCorrelationHeaders(this.chatCorrelation),
1136
1171
  ...extra
1137
1172
  };
1138
1173
  }
@@ -1403,28 +1438,6 @@ function normalizeSendToHumanInput(task, clientDefaults) {
1403
1438
  };
1404
1439
  }
1405
1440
 
1406
- // src/env.ts
1407
- function resolveRobotRockConfig(overrides) {
1408
- const agentService = overrides?.agentService;
1409
- const apiKey = overrides?.apiKey ?? process.env.ROBOTROCK_API_KEY;
1410
- if (agentService && apiKey) {
1411
- throw new Error(
1412
- "RobotRock client cannot configure both apiKey and agentService."
1413
- );
1414
- }
1415
- const baseUrl = overrides?.baseUrl ?? getRobotRockApiBaseUrl();
1416
- const app = overrides?.app ?? process.env.ROBOTROCK_APP;
1417
- if (agentService) {
1418
- return app ? { agentService, baseUrl, app } : { agentService, baseUrl };
1419
- }
1420
- if (!apiKey) {
1421
- throw new Error(
1422
- "RobotRock API key is required. Set ROBOTROCK_API_KEY or pass agentService when creating the client."
1423
- );
1424
- }
1425
- return app ? { apiKey, baseUrl, app } : { apiKey, baseUrl };
1426
- }
1427
-
1428
1441
  // src/eve/agent/attributes.ts
1429
1442
  function readStringAttribute(attributes, key) {
1430
1443
  const value = attributes?.[key];
@@ -1470,6 +1483,7 @@ function tryResolveTenantCaller(ctx) {
1470
1483
  }
1471
1484
  const workosUserId = readStringAttribute(caller.attributes, "workosUserId");
1472
1485
  const connectionId = readStringAttribute(caller.attributes, "connectionId");
1486
+ const chatId = readStringAttribute(caller.attributes, "chatId");
1473
1487
  const groups = readStringArrayAttribute(caller.attributes, "groups");
1474
1488
  return {
1475
1489
  userId: caller.principalId,
@@ -1477,6 +1491,7 @@ function tryResolveTenantCaller(ctx) {
1477
1491
  name: name ?? email.split("@")[0] ?? email,
1478
1492
  tenantSlug,
1479
1493
  ...connectionId ? { connectionId } : {},
1494
+ ...chatId ? { chatId } : {},
1480
1495
  role,
1481
1496
  isAdmin: role === "admin",
1482
1497
  groups,
@@ -1493,27 +1508,37 @@ function requireTenantCaller(ctx) {
1493
1508
 
1494
1509
  // src/eve/agent/client-from-session.ts
1495
1510
  var warnedMissingAuth = false;
1511
+ function resolveBoundChatCorrelation(ctx) {
1512
+ const caller = tryResolveTenantCaller(ctx);
1513
+ return {
1514
+ eveSessionId: ctx.session.id,
1515
+ ...caller?.chatId ? { chatId: caller.chatId } : {},
1516
+ ...resolveChatCorrelationFromEnv()
1517
+ };
1518
+ }
1496
1519
  function tryCreateBoundRobotRockClient(ctx) {
1497
1520
  const caller = tryResolveTenantCaller(ctx);
1498
1521
  const serviceToken = process.env.ROBOTROCK_AGENT_SERVICE_TOKEN?.trim();
1522
+ const chatCorrelation = resolveBoundChatCorrelation(ctx);
1499
1523
  if (caller?.connectionId && serviceToken) {
1500
1524
  return createClient({
1501
1525
  baseUrl: process.env.ROBOTROCK_BASE_URL?.trim(),
1526
+ chatCorrelation,
1502
1527
  agentService: {
1503
1528
  token: serviceToken,
1504
1529
  tenantSlug: caller.tenantSlug,
1505
- connectionId: caller.connectionId
1530
+ connectionId: caller.connectionId,
1531
+ actingUserId: caller.userId
1506
1532
  }
1507
1533
  });
1508
1534
  }
1509
1535
  const apiKey = process.env.ROBOTROCK_API_KEY?.trim();
1510
1536
  if (apiKey) {
1511
- return createClient(
1512
- resolveRobotRockConfig({
1513
- apiKey,
1514
- baseUrl: process.env.ROBOTROCK_BASE_URL?.trim()
1515
- })
1516
- );
1537
+ return createClient({
1538
+ apiKey,
1539
+ baseUrl: process.env.ROBOTROCK_BASE_URL?.trim(),
1540
+ chatCorrelation
1541
+ });
1517
1542
  }
1518
1543
  if (!warnedMissingAuth) {
1519
1544
  warnedMissingAuth = true;