@arbidocs/blocks 0.4.2 → 0.4.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.
Files changed (156) hide show
  1. package/README.md +42 -0
  2. package/dist/agents/definitions/AgentCreator.d.ts +11 -2
  3. package/dist/agents/definitions/index.d.ts +1 -0
  4. package/dist/agents/definitions/persona.d.ts +16 -0
  5. package/dist/agents/index.cjs +199 -146
  6. package/dist/agents/index.js +3 -2
  7. package/dist/agents/tasks/TaskRunsDialog.d.ts +15 -3
  8. package/dist/agents/tasks/index.d.ts +1 -0
  9. package/dist/agents/tasks/taskRequest.d.ts +61 -0
  10. package/dist/chat/AssistantDock.d.ts +39 -0
  11. package/dist/chat/ChatDocuments.d.ts +17 -0
  12. package/dist/chat/ChatPage.d.ts +16 -0
  13. package/dist/chat/ChatThreads.d.ts +28 -0
  14. package/dist/chat/chat-page-types.d.ts +121 -0
  15. package/dist/chat/chat-surface.d.ts +9 -0
  16. package/dist/chat/index.cjs +247 -205
  17. package/dist/chat/index.d.ts +6 -0
  18. package/dist/chat/index.js +4 -2
  19. package/dist/{chunk-OBLSURHV.js → chunk-2NNTQLBY.js} +3 -3
  20. package/dist/{chunk-OBLSURHV.js.map → chunk-2NNTQLBY.js.map} +1 -1
  21. package/dist/chunk-2VBJ763Y.js +296 -0
  22. package/dist/chunk-2VBJ763Y.js.map +1 -0
  23. package/dist/{chunk-2ORA62OF.js → chunk-67MKU5U7.js} +3 -3
  24. package/dist/{chunk-2ORA62OF.js.map → chunk-67MKU5U7.js.map} +1 -1
  25. package/dist/{chunk-AE5FHFZ5.cjs → chunk-6CHMNKXC.cjs} +6 -6
  26. package/dist/{chunk-AE5FHFZ5.cjs.map → chunk-6CHMNKXC.cjs.map} +1 -1
  27. package/dist/{chunk-TYZUCAT7.js → chunk-7YADKWZT.js} +43 -6
  28. package/dist/chunk-7YADKWZT.js.map +1 -0
  29. package/dist/chunk-ATXPAD6S.cjs +1952 -0
  30. package/dist/chunk-ATXPAD6S.cjs.map +1 -0
  31. package/dist/{chunk-YBXCZEWS.js → chunk-B673CCW5.js} +29 -6
  32. package/dist/chunk-B673CCW5.js.map +1 -0
  33. package/dist/{chunk-ITGHMJOM.js → chunk-BBEMPS6C.js} +169 -26
  34. package/dist/chunk-BBEMPS6C.js.map +1 -0
  35. package/dist/{chunk-XNBAXRY7.cjs → chunk-DGVKBOY5.cjs} +188 -32
  36. package/dist/chunk-DGVKBOY5.cjs.map +1 -0
  37. package/dist/{chunk-2K33YGM6.cjs → chunk-DN3NFNIA.cjs} +63 -294
  38. package/dist/chunk-DN3NFNIA.cjs.map +1 -0
  39. package/dist/{chunk-XQ7PKKDY.cjs → chunk-G4YOH5DU.cjs} +3 -3
  40. package/dist/{chunk-XQ7PKKDY.cjs.map → chunk-G4YOH5DU.cjs.map} +1 -1
  41. package/dist/{chunk-AXIZ2MDV.js → chunk-HER7MTRR.js} +3 -3
  42. package/dist/{chunk-AXIZ2MDV.js.map → chunk-HER7MTRR.js.map} +1 -1
  43. package/dist/{chunk-SYDHKKRZ.cjs → chunk-IZHWP6WQ.cjs} +47 -5
  44. package/dist/chunk-IZHWP6WQ.cjs.map +1 -0
  45. package/dist/chunk-JPO3F4J7.js +1899 -0
  46. package/dist/chunk-JPO3F4J7.js.map +1 -0
  47. package/dist/{chunk-WJMEXTVD.cjs → chunk-KDG6FER6.cjs} +28 -2
  48. package/dist/chunk-KDG6FER6.cjs.map +1 -0
  49. package/dist/chunk-KHX2BX3S.cjs +307 -0
  50. package/dist/chunk-KHX2BX3S.cjs.map +1 -0
  51. package/dist/{chunk-WTNMWEBC.js → chunk-NJL4LIXX.js} +4 -3
  52. package/dist/chunk-NJL4LIXX.js.map +1 -0
  53. package/dist/{chunk-J2BGSWXM.cjs → chunk-O637DUKS.cjs} +27 -27
  54. package/dist/{chunk-J2BGSWXM.cjs.map → chunk-O637DUKS.cjs.map} +1 -1
  55. package/dist/{chunk-WW6EOVZA.js → chunk-OXF2IFXG.js} +26 -3
  56. package/dist/chunk-OXF2IFXG.js.map +1 -0
  57. package/dist/{chunk-6HIPFEID.cjs → chunk-PBS5MFIY.cjs} +4 -4
  58. package/dist/{chunk-6HIPFEID.cjs.map → chunk-PBS5MFIY.cjs.map} +1 -1
  59. package/dist/{chunk-AZQDNYH4.js → chunk-RCP6THBS.js} +9 -1249
  60. package/dist/chunk-RCP6THBS.js.map +1 -0
  61. package/dist/{chunk-GDFWJ73C.cjs → chunk-RIL7G7AS.cjs} +4 -1286
  62. package/dist/chunk-RIL7G7AS.cjs.map +1 -0
  63. package/dist/{chunk-DREI7EQ2.cjs → chunk-SS23F63U.cjs} +9 -9
  64. package/dist/{chunk-DREI7EQ2.cjs.map → chunk-SS23F63U.cjs.map} +1 -1
  65. package/dist/{chunk-7PEELPMA.js → chunk-TI4UTYRL.js} +62 -285
  66. package/dist/chunk-TI4UTYRL.js.map +1 -0
  67. package/dist/{chunk-6P6AEQJB.js → chunk-WJZBJUPX.js} +4 -4
  68. package/dist/{chunk-6P6AEQJB.js.map → chunk-WJZBJUPX.js.map} +1 -1
  69. package/dist/{chunk-UFHMLHIR.cjs → chunk-XAJIKT6Y.cjs} +32 -11
  70. package/dist/chunk-XAJIKT6Y.cjs.map +1 -0
  71. package/dist/{chunk-G3G7LZPM.cjs → chunk-XKKGGUU2.cjs} +29 -3
  72. package/dist/chunk-XKKGGUU2.cjs.map +1 -0
  73. package/dist/{chunk-UWGIB3VQ.js → chunk-XNOASBGW.js} +33 -12
  74. package/dist/chunk-XNOASBGW.js.map +1 -0
  75. package/dist/{chunk-CTZ5745I.js → chunk-XQKGYGCJ.js} +3 -3
  76. package/dist/{chunk-CTZ5745I.js.map → chunk-XQKGYGCJ.js.map} +1 -1
  77. package/dist/{chunk-54Q3RNJU.cjs → chunk-ZVPTFTGV.cjs} +4 -3
  78. package/dist/chunk-ZVPTFTGV.cjs.map +1 -0
  79. package/dist/citations/index.cjs +11 -11
  80. package/dist/citations/index.js +2 -2
  81. package/dist/collaboration/contacts/AddContactsParts.d.ts +9 -4
  82. package/dist/collaboration/contacts/index.d.ts +1 -0
  83. package/dist/collaboration/contacts/parseEmails.d.ts +26 -0
  84. package/dist/collaboration/index.cjs +51 -31
  85. package/dist/collaboration/index.js +1 -1
  86. package/dist/components/MemberAvatarStack.d.ts +7 -2
  87. package/dist/connect/index.cjs +41 -12
  88. package/dist/connect/index.cjs.map +1 -1
  89. package/dist/connect/index.d.ts +3 -2
  90. package/dist/connect/index.js +20 -4
  91. package/dist/connect/index.js.map +1 -1
  92. package/dist/connection/ConnectionProvider.d.ts +2 -0
  93. package/dist/connection/ai.d.ts +13 -1
  94. package/dist/connection/useConnectedShellWorkspaces.d.ts +15 -0
  95. package/dist/facts/index.cjs +3 -3
  96. package/dist/facts/index.cjs.map +1 -1
  97. package/dist/facts/index.js +2 -2
  98. package/dist/facts/index.js.map +1 -1
  99. package/dist/files/index.cjs +4 -3
  100. package/dist/files/index.cjs.map +1 -1
  101. package/dist/files/index.js +4 -3
  102. package/dist/files/index.js.map +1 -1
  103. package/dist/home/index.cjs +18 -17
  104. package/dist/home/index.cjs.map +1 -1
  105. package/dist/home/index.js +3 -2
  106. package/dist/home/index.js.map +1 -1
  107. package/dist/index.cjs +824 -695
  108. package/dist/index.cjs.map +1 -1
  109. package/dist/index.d.ts +1 -1
  110. package/dist/index.js +16 -15
  111. package/dist/index.js.map +1 -1
  112. package/dist/lib/format.d.ts +31 -0
  113. package/dist/retrieval/index.cjs +36 -36
  114. package/dist/retrieval/index.js +1 -1
  115. package/dist/settings/index.cjs +13 -11
  116. package/dist/settings/index.cjs.map +1 -1
  117. package/dist/settings/index.js +13 -11
  118. package/dist/settings/index.js.map +1 -1
  119. package/dist/shell/SplitLayout.d.ts +32 -0
  120. package/dist/shell/index.cjs +72 -68
  121. package/dist/shell/index.d.ts +1 -0
  122. package/dist/shell/index.js +2 -2
  123. package/dist/site/index.cjs +71 -71
  124. package/dist/site/index.js +3 -3
  125. package/dist/studio/index.cjs +79 -76
  126. package/dist/studio/index.cjs.map +1 -1
  127. package/dist/studio/index.js +9 -6
  128. package/dist/studio/index.js.map +1 -1
  129. package/dist/workspaces/WorkspaceGallery.d.ts +42 -0
  130. package/dist/workspaces/index.cjs +74 -7
  131. package/dist/workspaces/index.cjs.map +1 -1
  132. package/dist/workspaces/index.d.ts +2 -0
  133. package/dist/workspaces/index.js +73 -7
  134. package/dist/workspaces/index.js.map +1 -1
  135. package/package.json +3 -3
  136. package/src/blocks.css +10 -13
  137. package/dist/chunk-2K33YGM6.cjs.map +0 -1
  138. package/dist/chunk-54Q3RNJU.cjs.map +0 -1
  139. package/dist/chunk-7PEELPMA.js.map +0 -1
  140. package/dist/chunk-AZQDNYH4.js.map +0 -1
  141. package/dist/chunk-G3G7LZPM.cjs.map +0 -1
  142. package/dist/chunk-GDFWJ73C.cjs.map +0 -1
  143. package/dist/chunk-ITGHMJOM.js.map +0 -1
  144. package/dist/chunk-SCFYPAG6.cjs +0 -18
  145. package/dist/chunk-SCFYPAG6.cjs.map +0 -1
  146. package/dist/chunk-SYDHKKRZ.cjs.map +0 -1
  147. package/dist/chunk-TYZUCAT7.js.map +0 -1
  148. package/dist/chunk-UFHMLHIR.cjs.map +0 -1
  149. package/dist/chunk-UWGIB3VQ.js.map +0 -1
  150. package/dist/chunk-WJMEXTVD.cjs.map +0 -1
  151. package/dist/chunk-WTNMWEBC.js.map +0 -1
  152. package/dist/chunk-WW6EOVZA.js.map +0 -1
  153. package/dist/chunk-XNBAXRY7.cjs.map +0 -1
  154. package/dist/chunk-YBXCZEWS.js.map +0 -1
  155. package/dist/chunk-YDHO4AVL.js +0 -16
  156. package/dist/chunk-YDHO4AVL.js.map +0 -1
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  'use strict';
3
3
 
4
- var chunk54Q3RNJU_cjs = require('./chunk-54Q3RNJU.cjs');
4
+ var chunkZVPTFTGV_cjs = require('./chunk-ZVPTFTGV.cjs');
5
5
  var chunkRFIBUWLF_cjs = require('./chunk-RFIBUWLF.cjs');
6
6
  var chunkZW6FPIFC_cjs = require('./chunk-ZW6FPIFC.cjs');
7
7
  var chunkOB5F4577_cjs = require('./chunk-OB5F4577.cjs');
@@ -9,6 +9,7 @@ var chunkULWRNGGE_cjs = require('./chunk-ULWRNGGE.cjs');
9
9
  var chunkV4ISCZJ7_cjs = require('./chunk-V4ISCZJ7.cjs');
10
10
  var chunk5B4PXAKI_cjs = require('./chunk-5B4PXAKI.cjs');
11
11
  var chunkC54XEN5T_cjs = require('./chunk-C54XEN5T.cjs');
12
+ var chunkKDG6FER6_cjs = require('./chunk-KDG6FER6.cjs');
12
13
  var chunkMHVNT4J3_cjs = require('./chunk-MHVNT4J3.cjs');
13
14
  var react = require('react');
14
15
  var ui = require('@arbidocs/react/ui');
@@ -481,7 +482,7 @@ function SchemaForm({
481
482
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: ui.cn("flex flex-col gap-4", className), "data-slot": "schema-form", children: [
482
483
  common.map(render),
483
484
  advanced.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
484
- chunk54Q3RNJU_cjs.FoldSection,
485
+ chunkZVPTFTGV_cjs.FoldSection,
485
486
  {
486
487
  label: l.advanced,
487
488
  open: advancedOpen,
@@ -658,7 +659,7 @@ function WorkflowConfigDialog({
658
659
  const firstField = workflow.inputs.find((f) => !f.advanced);
659
660
  const focusPromptFirst = firstField?.type === "text" || firstField?.type === "longtext";
660
661
  const defaultScopeRender = scopeSource ? (_field, value, onChange) => /* @__PURE__ */ jsxRuntime.jsx(
661
- chunk54Q3RNJU_cjs.ScopePicker,
662
+ chunkZVPTFTGV_cjs.ScopePicker,
662
663
  {
663
664
  folders: scopeSource.folders,
664
665
  unfiledCount: scopeSource.unfiledCount,
@@ -691,7 +692,7 @@ function WorkflowConfigDialog({
691
692
  },
692
693
  children: [
693
694
  /* @__PURE__ */ jsxRuntime.jsx(
694
- chunk54Q3RNJU_cjs.QuickActionDialogHeader,
695
+ chunkZVPTFTGV_cjs.QuickActionDialogHeader,
695
696
  {
696
697
  icon: workflow.icon && renderIcon ? renderIcon(workflow.icon) : null,
697
698
  title: workflow.title,
@@ -709,7 +710,7 @@ function WorkflowConfigDialog({
709
710
  submit();
710
711
  },
711
712
  children: noFiles ? /* @__PURE__ */ jsxRuntime.jsx(
712
- chunk54Q3RNJU_cjs.AddFilesFirst,
713
+ chunkZVPTFTGV_cjs.AddFilesFirst,
713
714
  {
714
715
  reason: l.addFilesReason,
715
716
  action: addFilesAction,
@@ -833,7 +834,7 @@ function WorkflowLauncher({
833
834
  });
834
835
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className, "data-slot": "workflow-launcher", children: [
835
836
  showTiles && /* @__PURE__ */ jsxRuntime.jsx(
836
- chunk54Q3RNJU_cjs.StartTiles,
837
+ chunkZVPTFTGV_cjs.StartTiles,
837
838
  {
838
839
  items: [...tiles, ...extraTiles],
839
840
  caption,
@@ -861,7 +862,7 @@ var DEFAULT_AGENT_CARD_LABELS = {
861
862
  running: "Running",
862
863
  runningIndicator: "Running",
863
864
  runningCount: (count) => `${count} running`,
864
- taskCount: (count) => count > 0 ? `${count} task${count === 1 ? "" : "s"}` : "no tasks yet",
865
+ taskCount: (count) => count > 0 ? chunkKDG6FER6_cjs.formatCount(count, { one: "task", other: "tasks" }) : "no tasks yet",
865
866
  goalMet: (met, total) => `\u2713 ${met}/${total} met`,
866
867
  watch: "Watch",
867
868
  assignTask: "Assign task",
@@ -1221,6 +1222,7 @@ var DEFAULT_AGENT_CREATOR_LABELS = {
1221
1222
  workspaceAccess: "Workspace access",
1222
1223
  workspaceAccessHint: "Each workspace stays separate. The agent can only read the ones you tick here.",
1223
1224
  workspaceAlready: "Already has access",
1225
+ revokeWorkspace: (name) => `Remove access to ${name}`,
1224
1226
  noWorkspacesToGrant: "You have no workspaces yet.",
1225
1227
  name: "Name",
1226
1228
  nameHint: "Letters, digits, - and _ only; must start with a letter or digit.",
@@ -1296,6 +1298,8 @@ function AgentCreator({
1296
1298
  models = [],
1297
1299
  workspaces = [],
1298
1300
  grantedWorkspaceIds = [],
1301
+ onRevokeWorkspace,
1302
+ revokingWorkspaceId,
1299
1303
  avatar,
1300
1304
  types,
1301
1305
  values: valuesProp,
@@ -1442,7 +1446,7 @@ function AgentCreator({
1442
1446
  ] })
1443
1447
  ] }),
1444
1448
  /* @__PURE__ */ jsxRuntime.jsx(
1445
- chunk54Q3RNJU_cjs.FoldSection,
1449
+ chunkZVPTFTGV_cjs.FoldSection,
1446
1450
  {
1447
1451
  label: l.advanced,
1448
1452
  open: advancedOpen,
@@ -1486,26 +1490,40 @@ function AgentCreator({
1486
1490
  workspaces.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: l.noWorkspacesToGrant }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-2", children: workspaces.map((w) => {
1487
1491
  const already = grantedWorkspaceIds.includes(w.id);
1488
1492
  const on = already || values.workspaceIds.includes(w.id);
1489
- return /* @__PURE__ */ jsxRuntime.jsx(
1490
- "button",
1491
- {
1492
- type: "button",
1493
- role: "checkbox",
1494
- "aria-checked": on,
1495
- disabled: already,
1496
- title: already ? l.workspaceAlready : void 0,
1497
- "data-testid": `${id}-workspace-${w.id}`,
1498
- onClick: () => patch({
1499
- workspaceIds: on ? values.workspaceIds.filter((x) => x !== w.id) : [...values.workspaceIds, w.id]
1500
- }),
1501
- className: ui.cn(
1502
- "rounded-md border px-3 py-1.5 text-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-60 pointer-coarse:min-h-11",
1503
- on ? "border-primary bg-primary/10 text-primary" : "border-border [&:hover:not(:disabled)]:bg-accent"
1504
- ),
1505
- children: w.name
1506
- },
1507
- w.id
1508
- );
1493
+ return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "inline-flex items-center gap-1", children: [
1494
+ /* @__PURE__ */ jsxRuntime.jsx(
1495
+ "button",
1496
+ {
1497
+ type: "button",
1498
+ role: "checkbox",
1499
+ "aria-checked": on,
1500
+ disabled: already,
1501
+ title: already ? l.workspaceAlready : void 0,
1502
+ "data-testid": `${id}-workspace-${w.id}`,
1503
+ onClick: () => patch({
1504
+ workspaceIds: on ? values.workspaceIds.filter((x) => x !== w.id) : [...values.workspaceIds, w.id]
1505
+ }),
1506
+ className: ui.cn(
1507
+ "rounded-md border px-3 py-1.5 text-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-60 pointer-coarse:min-h-11",
1508
+ on ? "border-primary bg-primary/10 text-primary" : "border-border [&:hover:not(:disabled)]:bg-accent"
1509
+ ),
1510
+ children: w.name
1511
+ }
1512
+ ),
1513
+ already && onRevokeWorkspace && /* @__PURE__ */ jsxRuntime.jsx(
1514
+ "button",
1515
+ {
1516
+ type: "button",
1517
+ "aria-label": l.revokeWorkspace(w.name),
1518
+ title: l.revokeWorkspace(w.name),
1519
+ disabled: revokingWorkspaceId === w.id,
1520
+ "data-testid": `${id}-workspace-${w.id}-revoke`,
1521
+ onClick: () => onRevokeWorkspace(w.id),
1522
+ className: "flex size-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50 pointer-coarse:size-11",
1523
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "size-4", "aria-hidden": true })
1524
+ }
1525
+ )
1526
+ ] }, w.id);
1509
1527
  }) })
1510
1528
  ] }),
1511
1529
  models.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1.5", children: [
@@ -1562,6 +1580,31 @@ function AgentCreator({
1562
1580
  }
1563
1581
  ) });
1564
1582
  }
1583
+
1584
+ // src/agents/definitions/persona.ts
1585
+ function composePersona(name, description) {
1586
+ const body = description.trim();
1587
+ const preamble = `You are ${name}, an AI agent.`;
1588
+ return body ? `${preamble} ${body}` : preamble;
1589
+ }
1590
+ function stripPersonaPreamble(persona) {
1591
+ return persona.replace(/^You are .+?, an AI agent\.\s*/, "").trim();
1592
+ }
1593
+ function agentCreatorToConfigSection(values, capabilityKeys) {
1594
+ return {
1595
+ PERSONA: composePersona(values.name, values.persona),
1596
+ ...values.modelName ? { AGENT_MODEL_NAME: values.modelName } : {},
1597
+ ...Object.fromEntries(capabilityKeys.map((k) => [k, !!values.capabilities[k]]))
1598
+ };
1599
+ }
1600
+ function agentConfigSectionToValues(section, capabilityKeys) {
1601
+ const s = section ?? {};
1602
+ return {
1603
+ persona: stripPersonaPreamble(String(s.PERSONA ?? "")),
1604
+ modelName: String(s.AGENT_MODEL_NAME ?? ""),
1605
+ capabilities: Object.fromEntries(capabilityKeys.map((k) => [k, Boolean(s[k])]))
1606
+ };
1607
+ }
1565
1608
  function SkillTypeBadge({ type, className }) {
1566
1609
  return /* @__PURE__ */ jsxRuntime.jsx(
1567
1610
  "span",
@@ -3725,7 +3768,7 @@ function TaskComposer({
3725
3768
  ),
3726
3769
  isEdit && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "-mt-3 text-xs text-muted-foreground", children: l.lockedAfterCreation }),
3727
3770
  goalNode != null && /* @__PURE__ */ jsxRuntime.jsx(
3728
- chunk54Q3RNJU_cjs.FoldSection,
3771
+ chunkZVPTFTGV_cjs.FoldSection,
3729
3772
  {
3730
3773
  label: l.goalAndPlan,
3731
3774
  open: goalOpen,
@@ -3752,7 +3795,7 @@ function TaskComposer({
3752
3795
  }
3753
3796
  ),
3754
3797
  /* @__PURE__ */ jsxRuntime.jsx(
3755
- chunk54Q3RNJU_cjs.FoldSection,
3798
+ chunkZVPTFTGV_cjs.FoldSection,
3756
3799
  {
3757
3800
  label: l.more,
3758
3801
  open: moreOpen,
@@ -3867,6 +3910,106 @@ function TaskComposer({
3867
3910
  }
3868
3911
  ) });
3869
3912
  }
3913
+
3914
+ // src/agents/tasks/taskRequest.ts
3915
+ var TRIGGER_FOR = {
3916
+ now: "one_time",
3917
+ once: "one_time",
3918
+ repeat: "recurring",
3919
+ event: "event"
3920
+ };
3921
+ function authModeFor(values) {
3922
+ if (values.when === "now") return "run_now_temp";
3923
+ return values.access === "standing" ? "scheduled_permanent" : "scheduled_require_auth";
3924
+ }
3925
+ function localInputToIso(local) {
3926
+ const d = new Date(local);
3927
+ if (!local || Number.isNaN(d.getTime())) throw new Error("Pick a valid date and time.");
3928
+ return d.toISOString();
3929
+ }
3930
+ function isoToLocalInput(iso) {
3931
+ if (!iso) return "";
3932
+ const d = new Date(iso);
3933
+ if (Number.isNaN(d.getTime())) return "";
3934
+ return new Date(d.getTime() - d.getTimezoneOffset() * 6e4).toISOString().slice(0, 16);
3935
+ }
3936
+ function workflowTaskFields(workflow, inputs, name) {
3937
+ const typed = name?.trim();
3938
+ if (workflow.options?.agent === false) {
3939
+ const message = composeWorkflowPrompt(workflow, inputs);
3940
+ return { name: typed || message, action_type: "notify", prompt: "", skill_ref: null };
3941
+ }
3942
+ if (workflow.skill) {
3943
+ return {
3944
+ name: typed || workflow.title,
3945
+ action_type: "run_skill",
3946
+ prompt: typeof inputs.args === "string" ? inputs.args.trim() : "",
3947
+ skill_ref: workflow.skill
3948
+ };
3949
+ }
3950
+ return {
3951
+ name: typed || workflow.title,
3952
+ action_type: "agent_prompt",
3953
+ prompt: composeWorkflowPrompt(workflow, inputs),
3954
+ skill_ref: null
3955
+ };
3956
+ }
3957
+ var isAgenticWorkflow = (workflow) => workflow.options?.agent !== false;
3958
+ function taskComposerToCreateRequest({ workflow, values }, workspaceId) {
3959
+ const fields = workflowTaskFields(workflow, values.inputs, values.name);
3960
+ const agentic = isAgenticWorkflow(workflow);
3961
+ if (agentic && !workspaceId) throw new Error("Open a workspace to run an agent task.");
3962
+ return {
3963
+ name: fields.name,
3964
+ trigger_type: TRIGGER_FOR[values.when],
3965
+ timezone: values.timezone,
3966
+ action_type: fields.action_type,
3967
+ prompt: fields.prompt,
3968
+ rrule: values.when === "repeat" ? values.rrule.trim() : null,
3969
+ run_at: values.when === "once" ? localInputToIso(values.runAt) : values.when === "now" ? (/* @__PURE__ */ new Date()).toISOString() : null,
3970
+ event_kind: values.when === "event" ? values.eventKind.trim() : null,
3971
+ skill_ref: fields.skill_ref,
3972
+ notify_on_complete: values.notifyOnComplete,
3973
+ auth_mode: authModeFor(values),
3974
+ workspace_ext_id: agentic ? workspaceId ?? null : null,
3975
+ agent_ext_id: values.agentId || null
3976
+ };
3977
+ }
3978
+ function taskComposerToUpdateRequest({
3979
+ workflow,
3980
+ values
3981
+ }) {
3982
+ const fields = workflowTaskFields(workflow, values.inputs, values.name);
3983
+ return {
3984
+ name: fields.name,
3985
+ rrule: values.when === "repeat" ? values.rrule.trim() : null,
3986
+ run_at: values.when === "once" && values.runAt ? localInputToIso(values.runAt) : null,
3987
+ timezone: values.timezone,
3988
+ prompt: fields.prompt,
3989
+ skill_ref: fields.skill_ref,
3990
+ notify_on_complete: values.notifyOnComplete,
3991
+ auth_mode: authModeFor(values)
3992
+ };
3993
+ }
3994
+ var taskNeedsAccess = (task) => !!task.pending_auth_request_id;
3995
+ function taskToComposerValues(task, workflows) {
3996
+ const reminder = task.action_type === "notify";
3997
+ const auth = task.auth_mode ?? "scheduled_permanent";
3998
+ const when = auth === "run_now_temp" ? "now" : task.trigger_type === "recurring" ? "repeat" : task.trigger_type === "event" ? "event" : "once";
3999
+ return {
4000
+ workflowId: reminder ? workflows.reminderWorkflowId : workflows.customWorkflowId,
4001
+ inputs: reminder ? { message: task.name } : { instruction: task.prompt },
4002
+ when,
4003
+ runAt: isoToLocalInput(task.run_at),
4004
+ rrule: task.rrule ?? "",
4005
+ timezone: task.timezone,
4006
+ eventKind: task.event_kind ?? "user_message",
4007
+ agentId: task.agent_ext_id ?? "",
4008
+ name: task.name,
4009
+ notifyOnComplete: task.notify_on_complete ?? false,
4010
+ access: auth === "scheduled_permanent" ? "standing" : "ask_each_run"
4011
+ };
4012
+ }
3870
4013
  var DEFAULT_TUPLE_ARRAY_FIELD_LABELS = {
3871
4014
  addRow: "Add Row",
3872
4015
  empty: 'No examples added yet. Click "Add Row" to start.',
@@ -5639,8 +5782,12 @@ exports.UploadTaskList = UploadTaskList;
5639
5782
  exports.WEEKDAYS = WEEKDAYS;
5640
5783
  exports.WorkflowConfigDialog = WorkflowConfigDialog;
5641
5784
  exports.WorkflowLauncher = WorkflowLauncher;
5785
+ exports.agentConfigSectionToValues = agentConfigSectionToValues;
5786
+ exports.agentCreatorToConfigSection = agentCreatorToConfigSection;
5787
+ exports.authModeFor = authModeFor;
5642
5788
  exports.buildLaunch = buildLaunch;
5643
5789
  exports.buildRRule = buildRRule;
5790
+ exports.composePersona = composePersona;
5644
5791
  exports.composeWorkflowPrompt = composeWorkflowPrompt;
5645
5792
  exports.createTaskColumns = createTaskColumns;
5646
5793
  exports.defaultInputs = defaultInputs;
@@ -5652,22 +5799,31 @@ exports.goalProgress = goalProgress;
5652
5799
  exports.humanizeSection = humanizeSection;
5653
5800
  exports.inferType = inferType;
5654
5801
  exports.inputsFromContext = inputsFromContext;
5802
+ exports.isAgenticWorkflow = isAgenticWorkflow;
5655
5803
  exports.isEmptyWorkflowScope = isEmptyWorkflowScope;
5656
5804
  exports.isOutOfBounds = isOutOfBounds;
5657
5805
  exports.isValidAgentName = isValidAgentName;
5658
5806
  exports.isWorkflowScope = isWorkflowScope;
5807
+ exports.isoToLocalInput = isoToLocalInput;
5808
+ exports.localInputToIso = localInputToIso;
5659
5809
  exports.nextCriterionId = nextCriterionId;
5660
5810
  exports.parseRRule = parseRRule;
5661
5811
  exports.prettifyKey = prettifyKey;
5662
5812
  exports.promptFieldName = promptFieldName;
5663
5813
  exports.skillToWorkflow = skillToWorkflow;
5664
5814
  exports.statusBadgeVariant = statusBadgeVariant;
5815
+ exports.stripPersonaPreamble = stripPersonaPreamble;
5665
5816
  exports.summarizeAgent = summarizeAgent;
5666
5817
  exports.summarizeCapabilities = summarizeCapabilities;
5818
+ exports.taskComposerToCreateRequest = taskComposerToCreateRequest;
5819
+ exports.taskComposerToUpdateRequest = taskComposerToUpdateRequest;
5820
+ exports.taskNeedsAccess = taskNeedsAccess;
5821
+ exports.taskToComposerValues = taskToComposerValues;
5667
5822
  exports.validateInputs = validateInputs;
5668
5823
  exports.workflowAccepts = workflowAccepts;
5669
5824
  exports.workflowFromFrontmatter = workflowFromFrontmatter;
5825
+ exports.workflowTaskFields = workflowTaskFields;
5670
5826
  exports.workflowsAccepting = workflowsAccepting;
5671
5827
  exports.workflowsForHost = workflowsForHost;
5672
- //# sourceMappingURL=chunk-XNBAXRY7.cjs.map
5673
- //# sourceMappingURL=chunk-XNBAXRY7.cjs.map
5828
+ //# sourceMappingURL=chunk-DGVKBOY5.cjs.map
5829
+ //# sourceMappingURL=chunk-DGVKBOY5.cjs.map