@arbidocs/blocks 0.4.27 → 0.4.29

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 (107) hide show
  1. package/README.md +17 -0
  2. package/dist/agents/index.cjs +224 -212
  3. package/dist/agents/index.js +6 -6
  4. package/dist/agents/tasks/TaskRowMenu.d.ts +4 -1
  5. package/dist/agents/tasks/TaskRunsDialog.d.ts +3 -1
  6. package/dist/agents/tasks/taskRows.d.ts +2 -0
  7. package/dist/agents/workflows/WorkflowDocumentsField.d.ts +12 -0
  8. package/dist/agents/workflows/index.d.ts +2 -0
  9. package/dist/agents/workflows/workspaceScope.d.ts +18 -0
  10. package/dist/chat/ChatPage.d.ts +1 -1
  11. package/dist/chat/chat-page-types.d.ts +12 -1
  12. package/dist/chat/index.cjs +129 -129
  13. package/dist/chat/index.js +2 -2
  14. package/dist/chunk-4XJZ6AAY.js +407 -0
  15. package/dist/chunk-4XJZ6AAY.js.map +1 -0
  16. package/dist/{chunk-UOLMFC5K.js → chunk-6YVI74BC.js} +498 -108
  17. package/dist/chunk-6YVI74BC.js.map +1 -0
  18. package/dist/{chunk-CQ6CYPV4.js → chunk-7FF473XB.js} +7 -119
  19. package/dist/chunk-7FF473XB.js.map +1 -0
  20. package/dist/{chunk-ZEIOREJY.js → chunk-EHXSBH6U.js} +37 -6
  21. package/dist/chunk-EHXSBH6U.js.map +1 -0
  22. package/dist/chunk-EYPPB5CY.cjs +85 -0
  23. package/dist/chunk-EYPPB5CY.cjs.map +1 -0
  24. package/dist/{chunk-ENY6XXKR.js → chunk-I7FJS7WG.js} +155 -39
  25. package/dist/chunk-I7FJS7WG.js.map +1 -0
  26. package/dist/{chunk-557EU3G4.js → chunk-JLOYWXRB.js} +3 -3
  27. package/dist/{chunk-557EU3G4.js.map → chunk-JLOYWXRB.js.map} +1 -1
  28. package/dist/chunk-KF4EC5XU.js +68 -0
  29. package/dist/chunk-KF4EC5XU.js.map +1 -0
  30. package/dist/{chunk-3ZXXHROK.cjs → chunk-L6YRTT5M.cjs} +158 -39
  31. package/dist/chunk-L6YRTT5M.cjs.map +1 -0
  32. package/dist/chunk-S5HZBXZA.cjs +430 -0
  33. package/dist/chunk-S5HZBXZA.cjs.map +1 -0
  34. package/dist/{chunk-JCVZKCXC.cjs → chunk-TLQQV7WW.cjs} +37 -6
  35. package/dist/chunk-TLQQV7WW.cjs.map +1 -0
  36. package/dist/{chunk-NNH7N62N.cjs → chunk-VMCOH3AY.cjs} +497 -105
  37. package/dist/chunk-VMCOH3AY.cjs.map +1 -0
  38. package/dist/{chunk-JLPYOPCX.js → chunk-WSJVHSGN.js} +225 -36
  39. package/dist/chunk-WSJVHSGN.js.map +1 -0
  40. package/dist/{chunk-DCEI37AX.cjs → chunk-YVIOCITQ.cjs} +3 -3
  41. package/dist/{chunk-DCEI37AX.cjs.map → chunk-YVIOCITQ.cjs.map} +1 -1
  42. package/dist/{chunk-J22DXUJY.cjs → chunk-ZHLMDJCO.cjs} +226 -34
  43. package/dist/chunk-ZHLMDJCO.cjs.map +1 -0
  44. package/dist/{chunk-TL2DHSC5.cjs → chunk-ZXGBUHES.cjs} +5 -120
  45. package/dist/chunk-ZXGBUHES.cjs.map +1 -0
  46. package/dist/connect/docx.cjs +26 -8
  47. package/dist/connect/docx.cjs.map +1 -1
  48. package/dist/connect/docx.d.ts +1 -0
  49. package/dist/connect/docx.js +24 -7
  50. package/dist/connect/docx.js.map +1 -1
  51. package/dist/connect/index.cjs +303 -61
  52. package/dist/connect/index.cjs.map +1 -1
  53. package/dist/connect/index.d.ts +4 -0
  54. package/dist/connect/index.js +263 -25
  55. package/dist/connect/index.js.map +1 -1
  56. package/dist/connection/ConnectedAgentChatPanel.d.ts +7 -0
  57. package/dist/connection/ConnectedNativeDocxEditor.d.ts +2 -1
  58. package/dist/connection/ConnectedSkillUpload.d.ts +2 -0
  59. package/dist/connection/ConnectedStreamedWordArtifact.d.ts +4 -0
  60. package/dist/connection/ConnectedTaskAccessRequest.d.ts +4 -0
  61. package/dist/connection/ai.d.ts +4 -1
  62. package/dist/connection/useConnectedWorkNotifications.d.ts +21 -0
  63. package/dist/docx/DocxMentions.d.ts +9 -2
  64. package/dist/docx/NativeDocxEditor.d.ts +11 -3
  65. package/dist/docx/StreamedWordArtifact.d.ts +15 -0
  66. package/dist/docx/index.cjs +16 -8
  67. package/dist/docx/index.d.ts +3 -2
  68. package/dist/docx/index.js +2 -2
  69. package/dist/docx/streamWordDocument.d.ts +12 -0
  70. package/dist/facts/index.cjs +1 -1
  71. package/dist/facts/index.js +1 -1
  72. package/dist/files/index.cjs +3 -3
  73. package/dist/files/index.js +3 -3
  74. package/dist/index.cjs +778 -766
  75. package/dist/index.js +15 -15
  76. package/dist/settings/index.cjs +42 -232
  77. package/dist/settings/index.cjs.map +1 -1
  78. package/dist/settings/index.js +7 -203
  79. package/dist/settings/index.js.map +1 -1
  80. package/dist/site/index.cjs +5 -5
  81. package/dist/site/index.js +1 -1
  82. package/dist/studio/index.cjs +7 -6
  83. package/dist/studio/index.cjs.map +1 -1
  84. package/dist/studio/index.js +5 -4
  85. package/dist/studio/index.js.map +1 -1
  86. package/dist/workspaces/index.cjs +2 -2
  87. package/dist/workspaces/index.js +2 -2
  88. package/package.json +3 -3
  89. package/src/docx/styles.css +13 -0
  90. package/dist/chunk-3ZXXHROK.cjs.map +0 -1
  91. package/dist/chunk-5TRALRWN.js +0 -42
  92. package/dist/chunk-5TRALRWN.js.map +0 -1
  93. package/dist/chunk-CQ6CYPV4.js.map +0 -1
  94. package/dist/chunk-CQCC7LE7.js +0 -210
  95. package/dist/chunk-CQCC7LE7.js.map +0 -1
  96. package/dist/chunk-ENY6XXKR.js.map +0 -1
  97. package/dist/chunk-EUOGPUMJ.cjs +0 -59
  98. package/dist/chunk-EUOGPUMJ.cjs.map +0 -1
  99. package/dist/chunk-J22DXUJY.cjs.map +0 -1
  100. package/dist/chunk-JCVZKCXC.cjs.map +0 -1
  101. package/dist/chunk-JLPYOPCX.js.map +0 -1
  102. package/dist/chunk-NNH7N62N.cjs.map +0 -1
  103. package/dist/chunk-RFIBUWLF.cjs +0 -232
  104. package/dist/chunk-RFIBUWLF.cjs.map +0 -1
  105. package/dist/chunk-TL2DHSC5.cjs.map +0 -1
  106. package/dist/chunk-UOLMFC5K.js.map +0 -1
  107. package/dist/chunk-ZEIOREJY.js.map +0 -1
@@ -1,28 +1,29 @@
1
1
  "use client";
2
2
  'use strict';
3
3
 
4
- var chunkEUOGPUMJ_cjs = require('../chunk-EUOGPUMJ.cjs');
5
- var chunkDCEI37AX_cjs = require('../chunk-DCEI37AX.cjs');
4
+ var chunkEYPPB5CY_cjs = require('../chunk-EYPPB5CY.cjs');
5
+ var chunkYVIOCITQ_cjs = require('../chunk-YVIOCITQ.cjs');
6
6
  var chunkQVBZESYQ_cjs = require('../chunk-QVBZESYQ.cjs');
7
7
  require('../chunk-ADOKTJHV.cjs');
8
- require('../chunk-J22DXUJY.cjs');
8
+ var chunkZHLMDJCO_cjs = require('../chunk-ZHLMDJCO.cjs');
9
9
  require('../chunk-VGOFFCMT.cjs');
10
10
  require('../chunk-PPCATBOY.cjs');
11
- require('../chunk-DCDVWPMB.cjs');
12
11
  var chunkKDG6FER6_cjs = require('../chunk-KDG6FER6.cjs');
13
- var chunkJCVZKCXC_cjs = require('../chunk-JCVZKCXC.cjs');
12
+ require('../chunk-DCDVWPMB.cjs');
13
+ var chunkTLQQV7WW_cjs = require('../chunk-TLQQV7WW.cjs');
14
+ require('../chunk-7UTB4PHM.cjs');
14
15
  require('../chunk-MHVNT4J3.cjs');
15
16
  var react = require('react');
16
17
  var reactQuery = require('@tanstack/react-query');
17
18
  var react$1 = require('@arbidocs/react');
18
19
  var jsxRuntime = require('react/jsx-runtime');
20
+ var ui = require('@arbidocs/react/ui');
19
21
  var artifacts = require('@arbidocs/react/artifacts');
20
22
  var lucideReact = require('lucide-react');
21
- var ui = require('@arbidocs/react/ui');
22
23
  var shell = require('@arbidocs/react/shell');
23
24
 
24
25
  function ConnectionBoundWebSocket({ children }) {
25
- const { status } = chunkJCVZKCXC_cjs.useConnection();
26
+ const { status } = chunkTLQQV7WW_cjs.useConnection();
26
27
  return /* @__PURE__ */ jsxRuntime.jsx(react$1.ArbiWebSocketProvider, { enabled: status === "authenticated", children });
27
28
  }
28
29
  function ArbiAppProvider({
@@ -35,7 +36,76 @@ function ArbiAppProvider({
35
36
  })
36
37
  );
37
38
  const providerUrl = config.apiUrl || config.demoApiUrl || "https://demo.arbi.local";
38
- return /* @__PURE__ */ jsxRuntime.jsx(reactQuery.QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsxRuntime.jsx(react$1.ArbiProvider, { url: providerUrl, children: /* @__PURE__ */ jsxRuntime.jsx(chunkJCVZKCXC_cjs.ConnectionProvider, { config, children: /* @__PURE__ */ jsxRuntime.jsx(ConnectionBoundWebSocket, { children }) }) }) });
39
+ return /* @__PURE__ */ jsxRuntime.jsx(reactQuery.QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsxRuntime.jsx(react$1.ArbiProvider, { url: providerUrl, children: /* @__PURE__ */ jsxRuntime.jsx(chunkTLQQV7WW_cjs.ConnectionProvider, { config, children: /* @__PURE__ */ jsxRuntime.jsx(ConnectionBoundWebSocket, { children }) }) }) });
40
+ }
41
+ function ConnectedTaskAccessRequest({ conversationId }) {
42
+ const { workspaceId } = chunkTLQQV7WW_cjs.useConnection();
43
+ const tasks = react$1.useConversations(workspaceId ?? void 0, { live: true });
44
+ const run = react$1.useRunConversation();
45
+ const task = tasks.data?.find((item) => item.external_id === conversationId);
46
+ if (!task?.pending_auth_request_id || !task.is_owner) return null;
47
+ return /* @__PURE__ */ jsxRuntime.jsxs(
48
+ "section",
49
+ {
50
+ className: "flex flex-wrap items-center gap-3 rounded-lg border bg-card p-3",
51
+ "data-testid": "task-chat-access-request",
52
+ children: [
53
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "flex-1 text-sm", children: "This task is waiting for temporary workspace access." }),
54
+ /* @__PURE__ */ jsxRuntime.jsx(
55
+ ui.Button,
56
+ {
57
+ disabled: run.isPending,
58
+ onClick: () => run.mutate(task.external_id),
59
+ "data-testid": "task-chat-allow-access",
60
+ children: run.isPending ? "Allowing access\u2026" : "Allow access and run"
61
+ }
62
+ ),
63
+ run.error && /* @__PURE__ */ jsxRuntime.jsx("p", { role: "alert", className: "w-full text-sm text-destructive", children: run.error.message })
64
+ ]
65
+ }
66
+ );
67
+ }
68
+ function ConnectedSkillUpload() {
69
+ const [name, setName] = react.useState("");
70
+ const [file, setFile] = react.useState(null);
71
+ const upload = react$1.useUploadSkillFiles();
72
+ const slug = name.trim().toLowerCase().replace(/[^a-z0-9_-]+/g, "-").replace(/^-+|-+$/g, "");
73
+ return /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "space-y-3 rounded-lg border p-4", "data-testid": "skill-upload", children: [
74
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-sm font-semibold", children: "Add a skill" }),
75
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: "Upload a SKILL.md file containing the instructions your assistant should follow." }),
76
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { htmlFor: "skill-upload-name", children: "Skill name" }),
77
+ /* @__PURE__ */ jsxRuntime.jsx(
78
+ ui.Input,
79
+ {
80
+ id: "skill-upload-name",
81
+ value: name,
82
+ onChange: (event) => setName(event.target.value),
83
+ placeholder: "disclosure-review",
84
+ "data-testid": "skill-upload-name"
85
+ }
86
+ ),
87
+ /* @__PURE__ */ jsxRuntime.jsx(
88
+ ui.Input,
89
+ {
90
+ type: "file",
91
+ accept: ".md",
92
+ "aria-label": "Skill instructions file",
93
+ onChange: (event) => setFile(event.target.files?.[0] ?? null),
94
+ "data-testid": "skill-upload-file"
95
+ }
96
+ ),
97
+ /* @__PURE__ */ jsxRuntime.jsx(
98
+ ui.Button,
99
+ {
100
+ disabled: !slug || !file || upload.isPending,
101
+ onClick: () => file && upload.mutate([{ folder: `skills/${slug}`, fileName: "SKILL.md", content: file }]),
102
+ "data-testid": "skill-upload-submit",
103
+ children: upload.isPending ? "Uploading\u2026" : "Upload skill"
104
+ }
105
+ ),
106
+ upload.isSuccess && /* @__PURE__ */ jsxRuntime.jsx("p", { role: "status", className: "text-sm", children: "Uploaded. The skill will appear once processing finishes." }),
107
+ upload.error && /* @__PURE__ */ jsxRuntime.jsx("p", { role: "alert", className: "text-sm text-destructive", children: upload.error.message })
108
+ ] });
39
109
  }
40
110
  var StreamedArtifactEditor = react.lazy(() => import('../StreamedArtifactEditor-L2AZZORU.cjs'));
41
111
  function StreamedArtifact({
@@ -109,7 +179,7 @@ function StreamedArtifact({
109
179
  );
110
180
  }
111
181
  function useConnectedShellWorkspaces(options = {}) {
112
- const { workspaceId, setWorkspace } = chunkJCVZKCXC_cjs.useConnection();
182
+ const { workspaceId, setWorkspace } = chunkTLQQV7WW_cjs.useConnection();
113
183
  const query = react$1.useWorkspaces();
114
184
  return react$1.useShellWorkspaces({
115
185
  ...options,
@@ -129,21 +199,21 @@ var AVATAR_PROBLEMS = {
129
199
  "too-large": "Image must be 5 MB or smaller",
130
200
  unreadable: "Couldn't read that image \u2014 try a different file"
131
201
  };
132
- function ConnectedProfileCard({ notify: notify2, title = "Profile" }) {
202
+ function ConnectedProfileCard({ notify: notify3, title = "Profile" }) {
133
203
  const { data: profile } = react$1.useProfile();
134
204
  const updateProfile = react$1.useUpdateProfile();
135
205
  const requestEmailChange = react$1.useRequestEmailChange();
136
206
  const confirmEmailChange = react$1.useConfirmEmailChange();
137
- const { user } = chunkJCVZKCXC_cjs.useConnection();
207
+ const { user } = chunkTLQQV7WW_cjs.useConnection();
138
208
  const name = react$1.useNameEditor({
139
209
  givenName: profile?.givenName,
140
210
  familyName: profile?.familyName,
141
211
  save: async (next) => {
142
212
  try {
143
213
  await updateProfile.mutateAsync(next);
144
- notify2?.("Name updated", "success");
214
+ notify3?.("Name updated", "success");
145
215
  } catch (e) {
146
- notify2?.("Failed to update name", "error");
216
+ notify3?.("Failed to update name", "error");
147
217
  throw e;
148
218
  }
149
219
  }
@@ -152,41 +222,41 @@ function ConnectedProfileCard({ notify: notify2, title = "Profile" }) {
152
222
  upload: async (picture) => {
153
223
  try {
154
224
  await updateProfile.mutateAsync({ picture });
155
- notify2?.("Profile picture updated", "success");
225
+ notify3?.("Profile picture updated", "success");
156
226
  } catch (e) {
157
- notify2?.("Failed to update picture", "error");
227
+ notify3?.("Failed to update picture", "error");
158
228
  throw e;
159
229
  }
160
230
  },
161
- onProblem: (problem) => notify2?.(AVATAR_PROBLEMS[problem], "error")
231
+ onProblem: (problem) => notify3?.(AVATAR_PROBLEMS[problem], "error")
162
232
  });
163
233
  const email = react$1.useEmailChange({
164
234
  requestCode: async (address) => {
165
235
  try {
166
236
  await requestEmailChange.mutateAsync(address);
167
- notify2?.("Verification code sent to your new email", "success");
237
+ notify3?.("Verification code sent to your new email", "success");
168
238
  } catch (e) {
169
- notify2?.(errorText(e, "Failed to send verification code"), "error");
239
+ notify3?.(errorText(e, "Failed to send verification code"), "error");
170
240
  throw e;
171
241
  }
172
242
  },
173
243
  confirm: async (args) => {
174
244
  try {
175
245
  await confirmEmailChange.mutateAsync(args);
176
- notify2?.("Email address updated", "success");
246
+ notify3?.("Email address updated", "success");
177
247
  } catch (e) {
178
- notify2?.(errorText(e, "Invalid or expired verification code"), "error");
248
+ notify3?.(errorText(e, "Invalid or expired verification code"), "error");
179
249
  throw e;
180
250
  }
181
251
  }
182
252
  });
183
253
  const display = profile?.fullName || user?.name || "Unnamed";
184
- return /* @__PURE__ */ jsxRuntime.jsx(chunkDCEI37AX_cjs.SettingsSection, { icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.UserCircle, {}), title, children: /* @__PURE__ */ jsxRuntime.jsx(
185
- chunkDCEI37AX_cjs.ProfileCard,
254
+ return /* @__PURE__ */ jsxRuntime.jsx(chunkYVIOCITQ_cjs.SettingsSection, { icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.UserCircle, {}), title, children: /* @__PURE__ */ jsxRuntime.jsx(
255
+ chunkYVIOCITQ_cjs.ProfileCard,
186
256
  {
187
257
  avatar: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
188
258
  /* @__PURE__ */ jsxRuntime.jsx(
189
- chunkDCEI37AX_cjs.AvatarPicker,
259
+ chunkYVIOCITQ_cjs.AvatarPicker,
190
260
  {
191
261
  pictureUrl: profile?.picture ?? user?.picture,
192
262
  initials: chunkKDG6FER6_cjs.initials(display),
@@ -226,7 +296,7 @@ function defaultUnmetPasswordRequirement(password) {
226
296
  return null;
227
297
  }
228
298
  function ConnectedSecuritySection({
229
- notify: notify2,
299
+ notify: notify3,
230
300
  getUnmetRequirement = defaultUnmetPasswordRequirement,
231
301
  renderRecoveryKey,
232
302
  children
@@ -239,15 +309,15 @@ function ConnectedSecuritySection({
239
309
  getUnmetRequirement,
240
310
  submit: async (vars) => {
241
311
  const result = await change.mutateAsync(vars);
242
- notify2?.("Password changed successfully", "success");
312
+ notify3?.("Password changed successfully", "success");
243
313
  return result;
244
314
  },
245
315
  onClose: () => setOpen(false)
246
316
  });
247
- return /* @__PURE__ */ jsxRuntime.jsxs(chunkDCEI37AX_cjs.SettingsSection, { icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.KeyRound, {}), title: "Security", children: [
248
- /* @__PURE__ */ jsxRuntime.jsxs(chunkDCEI37AX_cjs.SettingsCard, { padding: "sm", children: [
317
+ return /* @__PURE__ */ jsxRuntime.jsxs(chunkYVIOCITQ_cjs.SettingsSection, { icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.KeyRound, {}), title: "Security", children: [
318
+ /* @__PURE__ */ jsxRuntime.jsxs(chunkYVIOCITQ_cjs.SettingsCard, { padding: "sm", children: [
249
319
  /* @__PURE__ */ jsxRuntime.jsx(
250
- chunkDCEI37AX_cjs.SettingsActionRow,
320
+ chunkYVIOCITQ_cjs.SettingsActionRow,
251
321
  {
252
322
  title: "Change password",
253
323
  description: "Used to sign in and to encrypt your data. Changing it re-encrypts everything in your account.",
@@ -258,7 +328,7 @@ function ConnectedSecuritySection({
258
328
  children
259
329
  ] }),
260
330
  /* @__PURE__ */ jsxRuntime.jsx(
261
- chunkDCEI37AX_cjs.PasswordChangeDialog,
331
+ chunkYVIOCITQ_cjs.PasswordChangeDialog,
262
332
  {
263
333
  open,
264
334
  onClose: form.onCancel,
@@ -282,29 +352,29 @@ function ConnectedSecuritySection({
282
352
  ] });
283
353
  }
284
354
  function ConnectedNotificationPreferences({
285
- categories = chunkDCEI37AX_cjs.EMAIL_NOTIFICATION_CATEGORIES,
355
+ categories = chunkYVIOCITQ_cjs.EMAIL_NOTIFICATION_CATEGORIES,
286
356
  title = "Notifications"
287
357
  }) {
288
358
  const keys = react.useMemo(
289
- () => categories === chunkDCEI37AX_cjs.EMAIL_NOTIFICATION_CATEGORIES ? chunkDCEI37AX_cjs.EMAIL_NOTIFICATION_KEYS : categories.map((c) => c.key),
359
+ () => categories === chunkYVIOCITQ_cjs.EMAIL_NOTIFICATION_CATEGORIES ? chunkYVIOCITQ_cjs.EMAIL_NOTIFICATION_KEYS : categories.map((c) => c.key),
290
360
  [categories]
291
361
  );
292
362
  const prefs = react$1.useNotificationPreferences(keys);
293
- return /* @__PURE__ */ jsxRuntime.jsx(chunkDCEI37AX_cjs.SettingsSection, { title, children: /* @__PURE__ */ jsxRuntime.jsx(chunkDCEI37AX_cjs.SettingsCard, { className: "space-y-0", children: /* @__PURE__ */ jsxRuntime.jsx(
294
- chunkDCEI37AX_cjs.NotificationCategoryList,
363
+ return /* @__PURE__ */ jsxRuntime.jsx(chunkYVIOCITQ_cjs.SettingsSection, { title, children: /* @__PURE__ */ jsxRuntime.jsx(chunkYVIOCITQ_cjs.SettingsCard, { className: "space-y-0", children: /* @__PURE__ */ jsxRuntime.jsx(
364
+ chunkYVIOCITQ_cjs.NotificationCategoryList,
295
365
  {
296
366
  masterId: "emailNotifications",
297
367
  masterTitle: "Email Notifications",
298
368
  masterDescription: "Email me about activity when I\u2019m away",
299
369
  masterChecked: prefs.masterChecked,
300
370
  onMasterChange: prefs.setAll,
301
- categories: chunkDCEI37AX_cjs.toNotificationCategories(prefs.checked, categories),
371
+ categories: chunkYVIOCITQ_cjs.toNotificationCategories(prefs.checked, categories),
302
372
  onCategoryChange: prefs.setCategory
303
373
  }
304
374
  ) }) });
305
375
  }
306
376
  function ConnectedSessionsRow({
307
- notify: notify2,
377
+ notify: notify3,
308
378
  confirm,
309
379
  renderSessionIcon
310
380
  }) {
@@ -312,14 +382,14 @@ function ConnectedSessionsRow({
312
382
  const sessions = react$1.useSessions({ enabled: open });
313
383
  const currentSessionId = react$1.useCurrentSessionId();
314
384
  const terminate = react$1.useTerminateSession();
315
- const views = chunkDCEI37AX_cjs.toActiveSessionViews(sessions.data ?? [], {
385
+ const views = chunkYVIOCITQ_cjs.toActiveSessionViews(sessions.data ?? [], {
316
386
  currentSessionId,
317
387
  terminatingId: terminate.isPending ? terminate.variables : null,
318
388
  renderIcon: renderSessionIcon
319
389
  });
320
390
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
321
391
  /* @__PURE__ */ jsxRuntime.jsx(
322
- chunkDCEI37AX_cjs.SettingsRow,
392
+ chunkYVIOCITQ_cjs.SettingsRow,
323
393
  {
324
394
  label: "Active sessions",
325
395
  description: "Devices and agents currently signed in to your account.",
@@ -341,7 +411,7 @@ function ConnectedSessionsRow({
341
411
  }
342
412
  ),
343
413
  /* @__PURE__ */ jsxRuntime.jsx(
344
- chunkDCEI37AX_cjs.ActiveSessionsDialog,
414
+ chunkYVIOCITQ_cjs.ActiveSessionsDialog,
345
415
  {
346
416
  open,
347
417
  onOpenChange: setOpen,
@@ -358,7 +428,7 @@ function ConnectedSessionsRow({
358
428
  try {
359
429
  await terminate.mutateAsync(id);
360
430
  } catch {
361
- notify2?.("Failed to end session. Please try again.", "error");
431
+ notify3?.("Failed to end session. Please try again.", "error");
362
432
  }
363
433
  })();
364
434
  }
@@ -372,11 +442,11 @@ function ConnectedLogoutDialog({
372
442
  isOnline = true,
373
443
  renderSessionIcon
374
444
  }) {
375
- const { logout } = chunkJCVZKCXC_cjs.useConnection();
445
+ const { logout } = chunkTLQQV7WW_cjs.useConnection();
376
446
  const sessions = react$1.useSessions({ enabled: open });
377
447
  const logoutAll = react$1.useLogoutAllSessions();
378
448
  return /* @__PURE__ */ jsxRuntime.jsx(
379
- chunkDCEI37AX_cjs.LogoutDialog,
449
+ chunkYVIOCITQ_cjs.LogoutDialog,
380
450
  {
381
451
  open,
382
452
  onClose,
@@ -390,26 +460,26 @@ function ConnectedLogoutDialog({
390
460
  },
391
461
  canLogoutAll: true,
392
462
  isOnline,
393
- sessions: chunkDCEI37AX_cjs.toLogoutSessionViews(sessions.data ?? []),
463
+ sessions: chunkYVIOCITQ_cjs.toLogoutSessionViews(sessions.data ?? []),
394
464
  renderSessionIcon
395
465
  }
396
466
  );
397
467
  }
398
- function ConnectedDangerZone({ notify: notify2, renderSubscriptionLink }) {
468
+ function ConnectedDangerZone({ notify: notify3, renderSubscriptionLink }) {
399
469
  const [zoneOpen, setZoneOpen] = react.useState(false);
400
470
  const [dialogOpen, setDialogOpen] = react.useState(false);
401
- const { user, logout } = chunkJCVZKCXC_cjs.useConnection();
471
+ const { user, logout } = chunkTLQQV7WW_cjs.useConnection();
402
472
  const remove = react$1.useDeleteAccount();
403
473
  const flow = react$1.useDeleteAccountFlow({
404
474
  userEmail: user?.email ?? "",
405
475
  remove: () => remove.mutateAsync(),
406
476
  onClose: () => setDialogOpen(false),
407
477
  onDeleted: logout,
408
- onError: () => notify2?.("Failed to delete account. Please try again.", "error")
478
+ onError: () => notify3?.("Failed to delete account. Please try again.", "error")
409
479
  });
410
480
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
411
481
  /* @__PURE__ */ jsxRuntime.jsx(
412
- chunkDCEI37AX_cjs.SettingsDangerZone,
482
+ chunkYVIOCITQ_cjs.SettingsDangerZone,
413
483
  {
414
484
  isOpen: zoneOpen,
415
485
  onToggle: () => setZoneOpen((o) => !o),
@@ -429,12 +499,12 @@ function ConnectedDangerZone({ notify: notify2, renderSubscriptionLink }) {
429
499
  }
430
500
  ),
431
501
  /* @__PURE__ */ jsxRuntime.jsx(
432
- chunkDCEI37AX_cjs.DeleteAccountDialog,
502
+ chunkYVIOCITQ_cjs.DeleteAccountDialog,
433
503
  {
434
504
  open: dialogOpen,
435
505
  onClose: flow.onClose,
436
506
  step: flow.step,
437
- blockers: chunkDCEI37AX_cjs.toDeleteBlockerViews(flow.blockers, renderSubscriptionLink),
507
+ blockers: chunkYVIOCITQ_cjs.toDeleteBlockerViews(flow.blockers, renderSubscriptionLink),
438
508
  onContinue: flow.onContinue,
439
509
  onBack: flow.onBack,
440
510
  userEmail: user?.email ?? "",
@@ -448,7 +518,7 @@ function ConnectedDangerZone({ notify: notify2, renderSubscriptionLink }) {
448
518
  }
449
519
  function useConnectedDocxNotifications(onOpen) {
450
520
  const arbi = react$1.useArbi();
451
- const { status, user, apiUrl } = chunkJCVZKCXC_cjs.useConnection();
521
+ const { status, user, apiUrl } = chunkTLQQV7WW_cjs.useConnection();
452
522
  const queries = reactQuery.useQueryClient();
453
523
  const source = `docx-mentions:${apiUrl}:${user?.externalId || ""}`;
454
524
  const queryKey = ["docx-mentions", apiUrl, user?.externalId];
@@ -511,65 +581,237 @@ function useConnectedDocxNotifications(onOpen) {
511
581
  }
512
582
  };
513
583
  }
584
+ function useConnectedWorkNotifications(onOpen) {
585
+ const { status, user, apiUrl } = chunkTLQQV7WW_cjs.useConnection();
586
+ const source = `work-notifications:${apiUrl}:${user?.externalId || ""}`;
587
+ const { data = [], markRead: persistRead } = react$1.useWorkNotifications({
588
+ apiUrl,
589
+ userId: user?.externalId,
590
+ enabled: status === "authenticated"
591
+ });
592
+ react.useEffect(() => {
593
+ const items = [];
594
+ if (status === "authenticated")
595
+ for (const note of data) {
596
+ if (note.recipient.external_id !== user?.externalId) continue;
597
+ const mapped = mapWorkNotification(note);
598
+ if (!mapped) continue;
599
+ items.push({
600
+ id: `work:${note.external_id}`,
601
+ title: mapped.title,
602
+ variant: note.type === "workflow_failed" ? "error" : note.type === "conversation_done" ? "success" : "info",
603
+ ts: Date.parse(note.created_at),
604
+ read: note.read,
605
+ source,
606
+ onSelect: () => {
607
+ void Promise.resolve().then(() => onOpen(mapped.target)).catch(
608
+ (error) => react$1.notify.error(
609
+ error instanceof Error ? error.message : "Could not open this notification."
610
+ )
611
+ );
612
+ }
613
+ });
614
+ }
615
+ shell.useNotify.getState().syncSource(source, items);
616
+ return () => shell.useNotify.getState().syncSource(source, []);
617
+ }, [data, status, user?.externalId, source, onOpen]);
618
+ const markRead = async (ids) => {
619
+ if (!ids.length) return;
620
+ try {
621
+ await persistRead(ids);
622
+ } catch {
623
+ react$1.notify.error("Could not mark work notifications read.");
624
+ }
625
+ };
626
+ return {
627
+ onMarkRead: (id) => {
628
+ if (data.some(
629
+ (note) => `work:${note.external_id}` === id && note.recipient.external_id === user?.externalId && mapWorkNotification(note)
630
+ ))
631
+ void markRead([id.slice(5)]);
632
+ },
633
+ onMarkAllRead: () => {
634
+ void markRead(
635
+ data.filter(
636
+ (note) => !note.read && note.recipient.external_id === user?.externalId && mapWorkNotification(note)
637
+ ).map((note) => note.external_id)
638
+ );
639
+ }
640
+ };
641
+ }
642
+ function mapWorkNotification(note) {
643
+ const sender = [note.sender.given_name, note.sender.family_name].filter(Boolean).join(" ") || note.sender.email;
644
+ if (note.type === "workflow_failed") {
645
+ try {
646
+ const payload = JSON.parse(note.content || "{}");
647
+ if (!payload.workflow_ext_id?.match(/^wfl-[a-zA-Z0-9]+$/)) return null;
648
+ if (note.workspace_ext_id?.match(/^wrk-[a-zA-Z0-9]+$/) && note.conversation_ext_id?.match(/^con-[a-zA-Z0-9]+$/)) {
649
+ return {
650
+ title: "A workflow failed to run",
651
+ target: {
652
+ kind: "conversation",
653
+ workspaceId: note.workspace_ext_id,
654
+ conversationId: note.conversation_ext_id
655
+ }
656
+ };
657
+ }
658
+ return {
659
+ title: "A workflow failed to run",
660
+ target: {
661
+ kind: "workflow",
662
+ workflowId: payload.workflow_ext_id,
663
+ workspaceId: note.workspace_ext_id || void 0
664
+ }
665
+ };
666
+ } catch {
667
+ return null;
668
+ }
669
+ }
670
+ const titles = {
671
+ mention: `${sender} mentioned you in a conversation`,
672
+ workspace_access_request: `${sender} needs workspace access to run a task`,
673
+ conversation_ready_for_review: `${sender} has a task ready for your review`,
674
+ conversation_approval_request: `${sender} asked you to approve a task`,
675
+ conversation_done: `${sender} marked a task done`
676
+ };
677
+ const title = titles[note.type];
678
+ if (!title || !note.workspace_ext_id || !note.conversation_ext_id?.match(/^con-[a-zA-Z0-9]+$/))
679
+ return null;
680
+ return {
681
+ title,
682
+ target: {
683
+ kind: "conversation",
684
+ workspaceId: note.workspace_ext_id,
685
+ conversationId: note.conversation_ext_id,
686
+ ...note.message_ext_id ? { messageId: note.message_ext_id } : {}
687
+ }
688
+ };
689
+ }
690
+ function ActiveChat({ agentId, workspaceId }) {
691
+ const chat = react$1.useArbiChat({ agentId, workspaceId });
692
+ return /* @__PURE__ */ jsxRuntime.jsx(
693
+ chunkZHLMDJCO_cjs.ChatPage,
694
+ {
695
+ chat: { ...chat, assistantMode: void 0, setAssistantMode: void 0 },
696
+ documentsRequired: false,
697
+ compactHeader: true,
698
+ surface: "dock",
699
+ emptyTitle: "What would you like me to do?",
700
+ emptyDescription: "This agent works through its own login. Upload files here to stage them in its sandbox.",
701
+ className: "h-[min(65vh,650px)] min-h-[380px]"
702
+ }
703
+ );
704
+ }
705
+ function ConnectedAgentChatPanel({
706
+ agentId,
707
+ workspaceId,
708
+ agentName = "Agent"
709
+ }) {
710
+ const session = react$1.useAgentSession(agentId);
711
+ const start = react$1.useStartAgentSession();
712
+ const close = react$1.useCloseAgentSession();
713
+ const ready = session.data?.active && session.data.workspace_ext_id === workspaceId;
714
+ const busy = start.isPending || close.isPending;
715
+ const error = start.error ?? close.error ?? session.error;
716
+ return /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "space-y-3", "data-testid": "agent-chat-panel", children: [
717
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center justify-between gap-2", children: [
718
+ /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-sm", "data-testid": "agent-chat-session-status", children: [
719
+ agentName,
720
+ " \xB7",
721
+ " ",
722
+ ready ? "Signed in to this workspace" : session.data?.active ? `Signed in to ${session.data.workspace_name ?? "another workspace"}` : "Signed out"
723
+ ] }),
724
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-2", children: [
725
+ !ready && /* @__PURE__ */ jsxRuntime.jsx(
726
+ ui.Button,
727
+ {
728
+ type: "button",
729
+ disabled: busy || session.isLoading,
730
+ onClick: () => start.mutate({ agentId, workspaceId }),
731
+ "data-testid": "agent-chat-login",
732
+ children: start.isPending ? "Signing in\u2026" : "Sign in here"
733
+ }
734
+ ),
735
+ session.data?.active && /* @__PURE__ */ jsxRuntime.jsx(
736
+ ui.Button,
737
+ {
738
+ type: "button",
739
+ variant: "outline",
740
+ disabled: busy,
741
+ onClick: () => close.mutate(agentId),
742
+ "data-testid": "agent-chat-logout",
743
+ children: close.isPending ? "Signing out\u2026" : "Sign out agent"
744
+ }
745
+ )
746
+ ] })
747
+ ] }),
748
+ error && /* @__PURE__ */ jsxRuntime.jsx("p", { role: "alert", className: "text-sm text-destructive", children: error.message }),
749
+ ready && /* @__PURE__ */ jsxRuntime.jsx(ActiveChat, { agentId, workspaceId }, `${agentId}:${workspaceId}`)
750
+ ] });
751
+ }
514
752
 
515
753
  Object.defineProperty(exports, "ConnectedAssistantDock", {
516
754
  enumerable: true,
517
- get: function () { return chunkEUOGPUMJ_cjs.ConnectedAssistantDock; }
755
+ get: function () { return chunkEYPPB5CY_cjs.ConnectedAssistantDock; }
518
756
  });
519
757
  Object.defineProperty(exports, "redlineStats", {
520
758
  enumerable: true,
521
- get: function () { return chunkEUOGPUMJ_cjs.redlineStats; }
759
+ get: function () { return chunkEYPPB5CY_cjs.redlineStats; }
522
760
  });
523
761
  Object.defineProperty(exports, "textToArtifact", {
524
762
  enumerable: true,
525
- get: function () { return chunkEUOGPUMJ_cjs.textToArtifact; }
763
+ get: function () { return chunkEYPPB5CY_cjs.textToArtifact; }
526
764
  });
527
765
  Object.defineProperty(exports, "toRedlineMarkdown", {
528
766
  enumerable: true,
529
- get: function () { return chunkEUOGPUMJ_cjs.toRedlineMarkdown; }
767
+ get: function () { return chunkEYPPB5CY_cjs.toRedlineMarkdown; }
530
768
  });
531
769
  Object.defineProperty(exports, "useConnectedAiTask", {
532
770
  enumerable: true,
533
- get: function () { return chunkEUOGPUMJ_cjs.useConnectedAiTask; }
771
+ get: function () { return chunkEYPPB5CY_cjs.useConnectedAiTask; }
534
772
  });
535
773
  Object.defineProperty(exports, "useConnectedChat", {
536
774
  enumerable: true,
537
- get: function () { return chunkEUOGPUMJ_cjs.useConnectedChat; }
775
+ get: function () { return chunkEYPPB5CY_cjs.useConnectedChat; }
538
776
  });
539
777
  Object.defineProperty(exports, "useSemanticSearch", {
540
778
  enumerable: true,
541
- get: function () { return chunkEUOGPUMJ_cjs.useSemanticSearch; }
779
+ get: function () { return chunkEYPPB5CY_cjs.useSemanticSearch; }
542
780
  });
543
781
  Object.defineProperty(exports, "useWorkspaceDocs", {
544
782
  enumerable: true,
545
- get: function () { return chunkEUOGPUMJ_cjs.useWorkspaceDocs; }
783
+ get: function () { return chunkEYPPB5CY_cjs.useWorkspaceDocs; }
546
784
  });
547
785
  Object.defineProperty(exports, "ConnectionProvider", {
548
786
  enumerable: true,
549
- get: function () { return chunkJCVZKCXC_cjs.ConnectionProvider; }
787
+ get: function () { return chunkTLQQV7WW_cjs.ConnectionProvider; }
550
788
  });
551
789
  Object.defineProperty(exports, "SESSION_EXPIRED_MESSAGE", {
552
790
  enumerable: true,
553
- get: function () { return chunkJCVZKCXC_cjs.SESSION_EXPIRED_MESSAGE; }
791
+ get: function () { return chunkTLQQV7WW_cjs.SESSION_EXPIRED_MESSAGE; }
554
792
  });
555
793
  Object.defineProperty(exports, "isAuthenticated", {
556
794
  enumerable: true,
557
- get: function () { return chunkJCVZKCXC_cjs.isAuthenticated; }
795
+ get: function () { return chunkTLQQV7WW_cjs.isAuthenticated; }
558
796
  });
559
797
  Object.defineProperty(exports, "useConnection", {
560
798
  enumerable: true,
561
- get: function () { return chunkJCVZKCXC_cjs.useConnection; }
799
+ get: function () { return chunkTLQQV7WW_cjs.useConnection; }
562
800
  });
563
801
  exports.ArbiAppProvider = ArbiAppProvider;
802
+ exports.ConnectedAgentChatPanel = ConnectedAgentChatPanel;
564
803
  exports.ConnectedDangerZone = ConnectedDangerZone;
565
804
  exports.ConnectedLogoutDialog = ConnectedLogoutDialog;
566
805
  exports.ConnectedNotificationPreferences = ConnectedNotificationPreferences;
567
806
  exports.ConnectedProfileCard = ConnectedProfileCard;
568
807
  exports.ConnectedSecuritySection = ConnectedSecuritySection;
569
808
  exports.ConnectedSessionsRow = ConnectedSessionsRow;
809
+ exports.ConnectedSkillUpload = ConnectedSkillUpload;
810
+ exports.ConnectedTaskAccessRequest = ConnectedTaskAccessRequest;
570
811
  exports.StreamedArtifact = StreamedArtifact;
571
812
  exports.defaultUnmetPasswordRequirement = defaultUnmetPasswordRequirement;
572
813
  exports.useConnectedDocxNotifications = useConnectedDocxNotifications;
573
814
  exports.useConnectedShellWorkspaces = useConnectedShellWorkspaces;
815
+ exports.useConnectedWorkNotifications = useConnectedWorkNotifications;
574
816
  //# sourceMappingURL=index.cjs.map
575
817
  //# sourceMappingURL=index.cjs.map