bazilion 0.55.0 → 0.57.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (193) hide show
  1. package/dist/cli.js +193 -37
  2. package/dist/cli.js.map +1 -1
  3. package/dist/daemon.js +1821 -788
  4. package/dist/daemon.js.map +1 -1
  5. package/dist/web/client/assets/AddProviderDialog-DwUu2FGE.js +1 -0
  6. package/dist/web/client/assets/AgentTemplateParts-C3BasVck.js +1 -0
  7. package/dist/web/client/assets/{Button-bTJUy9Qf.js → Button-CoKQRO-s.js} +1 -1
  8. package/dist/web/client/assets/ConfigPage-DFmHgEaL.js +1 -0
  9. package/dist/web/client/assets/ConfirmDialog-BCOfW63x.js +1 -0
  10. package/dist/web/client/assets/ConnectionsView-BbpY5YbI.js +1 -0
  11. package/dist/web/client/assets/ManagePage-BzyMHGqs.js +1 -0
  12. package/dist/web/client/assets/SectionTabs-C8H_LunZ.js +1 -0
  13. package/dist/web/client/assets/{Segmented-oPkAHPO1.js → Segmented-iylzLwE6.js} +1 -1
  14. package/dist/web/client/assets/SkillsParts-DoygBgF2.js +1 -0
  15. package/dist/web/client/assets/SpawnTeamModal-BVf4yN9X.js +1 -0
  16. package/dist/web/client/assets/TeamForm-Bfb5hVUX.js +1 -0
  17. package/dist/web/client/assets/TeamThread-BFmaBj82.js +1 -0
  18. package/dist/web/client/assets/UnsavedChangesGuard-BUsIHSxO.js +1 -0
  19. package/dist/web/client/assets/_id-BRD3kxrX.js +1 -0
  20. package/dist/web/client/assets/_id-BapVoTMJ.js +1 -0
  21. package/dist/web/client/assets/access-CqcKius1.js +1 -0
  22. package/dist/web/client/assets/{agent-actions-CUee6aJq.js → agent-actions-B-9KIwn6.js} +1 -1
  23. package/dist/web/client/assets/agents-BC_ITk28.js +1 -0
  24. package/dist/web/client/assets/agents-DQ8nQnD6.js +1 -0
  25. package/dist/web/client/assets/arrow-right-BqqfPqVi.js +1 -0
  26. package/dist/web/client/assets/attention-BnCihfi0.js +1 -0
  27. package/dist/web/client/assets/{bot-BCone8es.js → bot-BHky7KAX.js} +1 -1
  28. package/dist/web/client/assets/chart-column-DTsDbzL0.js +1 -0
  29. package/dist/web/client/assets/chevron-right-D1shxvdo.js +1 -0
  30. package/dist/web/client/assets/config-DYS8bkQl.js +1 -0
  31. package/dist/web/client/assets/{createLucideIcon-jxSFpY0Q.js → createLucideIcon-CZHSSDYA.js} +1 -1
  32. package/dist/web/client/assets/{download-Dy88XavQ.js → download-Dr0PgyMr.js} +1 -1
  33. package/dist/web/client/assets/es2015-DZDOQ3kj.js +41 -0
  34. package/dist/web/client/assets/{file-text-DPsZ8-h9.js → file-text-D6OTHixJ.js} +1 -1
  35. package/dist/web/client/assets/{images-QBh_rL8b.js → images-BULrW-FC.js} +1 -1
  36. package/dist/web/client/assets/index-CxXsZzDC.js +14 -0
  37. package/dist/web/client/assets/{key-round-C-I8fAG0.js → key-round-DmSZN0Kq.js} +1 -1
  38. package/dist/web/client/assets/{list-checks-C9Q-bjEi.js → list-checks-DdTdAQXS.js} +1 -1
  39. package/dist/web/client/assets/login-DFVsVP0s.js +1 -0
  40. package/dist/web/client/assets/{manage-BaIU5zKy.js → manage-CpXaObuS.js} +1 -1
  41. package/dist/web/client/assets/mcp-DslGDHmN.js +1 -0
  42. package/dist/web/client/assets/{message-square-Bwf9cHOx.js → message-square-B_pULba_.js} +1 -1
  43. package/dist/web/client/assets/{network-B3FA93gC.js → network-BqmVqC4_.js} +1 -1
  44. package/dist/web/client/assets/parts-C104qEuC.js +1 -0
  45. package/dist/web/client/assets/plus-CEKaHPBw.js +1 -0
  46. package/dist/web/client/assets/preload-helper-CZOd_z6l.js +1 -0
  47. package/dist/web/client/assets/routes-D1wFPm0n.js +85 -0
  48. package/dist/web/client/assets/skills-DmIo3vN3.js +1 -0
  49. package/dist/web/client/assets/{square-terminal-DaNLwvEs.js → square-terminal-CYfGBHPC.js} +1 -1
  50. package/dist/web/client/assets/style-CqkCFvvz.js +7 -0
  51. package/dist/web/client/assets/styles-C7NsCHeU.css +2 -0
  52. package/dist/web/client/assets/{system-CrTSr5_t.js → system-CUW9JZ9c.js} +1 -1
  53. package/dist/web/client/assets/teams-DJzYsuh9.js +1 -0
  54. package/dist/web/client/assets/teams-DrhG8KiS.js +1 -0
  55. package/dist/web/client/assets/telegram-Bk_kg8hb.js +1 -0
  56. package/dist/web/client/assets/tools-z9Ixmuu2.js +1 -0
  57. package/dist/web/client/assets/usage-DGe3x1m7.js +1 -0
  58. package/dist/web/client/assets/use-resource-qjIkNQDY.js +1 -0
  59. package/dist/web/client/assets/{users-round-BElBVSnw.js → users-round-cxQ5HF-C.js} +1 -1
  60. package/dist/web/client/assets/welcome-DDKqxHkF.js +1 -0
  61. package/dist/web/client/assets/{wrench-DotqSqSm.js → wrench-BLEJjETg.js} +1 -1
  62. package/dist/web/server/assets/{AddProviderDialog-BbpuvC2a.js → AddProviderDialog-CpLDHOcA.js} +6 -3
  63. package/dist/web/server/assets/AgentAvatar-8gTAy_tP.js +37 -0
  64. package/dist/web/server/assets/{AgentTemplateParts-Ce7snK3m.js → AgentTemplateParts-Dh9F_-T_.js} +7 -3
  65. package/dist/web/server/assets/Button-Dsnw22OF.js +17 -0
  66. package/dist/web/server/assets/{ConfigPage-qP9ejjuw.js → ConfigPage-CrxctbtN.js} +2 -2
  67. package/dist/web/server/assets/{ConfirmDialog-Z-uYbE9B.js → ConfirmDialog-C89B8qKM.js} +3 -1
  68. package/dist/web/server/assets/{ConnectionsView-CLIV7V5D.js → ConnectionsView-DslcKQmA.js} +9 -7
  69. package/dist/web/server/assets/Dialog-_Gt_Nt86.js +85 -0
  70. package/dist/web/server/assets/{ManagePage-BR9FwVZM.js → ManagePage-DGYNJ6XG.js} +2 -2
  71. package/dist/web/server/assets/{ModelMenu-D-hTgYOO.js → ModelMenu-DEJoYASj.js} +13 -1
  72. package/dist/web/server/assets/{SectionTabs-CWQ5orUW.js → SectionTabs--vMBvaUz.js} +9 -2
  73. package/dist/web/server/assets/{SkillsParts-DWpdydCJ.js → SkillsParts-CqS2B45v.js} +7 -3
  74. package/dist/web/server/assets/SpawnDialog-BNKj2Lup.js +127 -0
  75. package/dist/web/server/assets/{SpawnTeamModal-C-YMvoaB.js → SpawnTeamModal-zcLxtFOO.js} +6 -2
  76. package/dist/web/server/assets/{TeamForm-CL45gBdt.js → TeamForm-XFP0l2TB.js} +11 -5
  77. package/dist/web/server/assets/{TeamThread-CVVH6kKj.js → TeamThread-gYV_ToRM.js} +59 -12
  78. package/dist/web/server/assets/{UnsavedChangesGuard-CXK75QQp.js → UnsavedChangesGuard-CB_TugFF.js} +1 -1
  79. package/dist/web/server/assets/{_id-d2OwovYV.js → _id-517adSuB.js} +2 -2
  80. package/dist/web/server/assets/{_id-BKzOw78O.js → _id-BTyd2i5U.js} +1 -1
  81. package/dist/web/server/assets/{_id-8zsImuGa.js → _id-BsQnL9LV.js} +14 -9
  82. package/dist/web/server/assets/{_id-2I4CSMQj.js → _id-CyinHJam.js} +17 -11
  83. package/dist/web/server/assets/{_id-De3Bm0SG.js → _id-D4RFNqaJ.js} +2 -2
  84. package/dist/web/server/assets/{_id-BpfoPuTv.js → _id-josYXBx3.js} +2 -2
  85. package/dist/web/server/assets/_tanstack-start-manifest_v-w2xn07aY.js +275 -0
  86. package/dist/web/server/assets/{access-WWspT0v4.js → access-B97-94Wt.js} +1 -1
  87. package/dist/web/server/assets/{access-CyUoElTP.js → access-BdQmjMJV.js} +2 -2
  88. package/dist/web/server/assets/{access-CwZ27Wsl.js → access-Cc7fMMod.js} +7 -4
  89. package/dist/web/server/assets/activity-Czfq-5_F.js +471 -0
  90. package/dist/web/server/assets/{agent-actions-C07Cp5Ue.js → agent-actions-ChH7Mne4.js} +1 -1
  91. package/dist/web/server/assets/{agents-DCWEoaxY.js → agents-BL918wVc.js} +2 -2
  92. package/dist/web/server/assets/{agents-vuXrAv1j.js → agents-BlUZqqJn.js} +14 -8
  93. package/dist/web/server/assets/{agents-CRtMfKqX.js → agents-BzJFjA2i.js} +2 -2
  94. package/dist/web/server/assets/{agents-CwzhpDPm.js → agents-CjrkaEz8.js} +11 -8
  95. package/dist/web/server/assets/{agents-DQowl6Ly.js → agents-Tg3zkmQv.js} +2 -2
  96. package/dist/web/server/assets/{agents-DTub-rJk.js → agents-uw32jPWx.js} +2 -2
  97. package/dist/web/server/assets/{attention-Dki8rmGZ.js → attention-2unmuO-q.js} +1 -1
  98. package/dist/web/server/assets/{attention-BqCnJ1hg.js → attention-C94WWwQe.js} +2 -2
  99. package/dist/web/server/assets/{attention-DwGaur_w.js → attention-a_OmC6L3.js} +9 -7
  100. package/dist/web/server/assets/{auth-dJnrFW6y.js → auth-DuIqEAed.js} +1 -1
  101. package/dist/web/server/assets/{config-B9dJiji_.js → config-BG1KOtwA.js} +2 -2
  102. package/dist/web/server/assets/{config-D3MR2VjE.js → config-Bhem9XER.js} +10 -7
  103. package/dist/web/server/assets/{config-X7qWbbpH.js → config-D1Li_7Yt2.js} +1 -1
  104. package/dist/web/server/assets/createSsrRpc-6LHNEsSK.js +16 -0
  105. package/dist/web/server/assets/{daemon-client-B_ZRIIrT.js → daemon-client-D-NWKQto.js} +1 -1
  106. package/dist/web/server/assets/form-Bwsyt9OY.js +416 -0
  107. package/dist/web/server/assets/live-DbJeq6KP.js +263 -0
  108. package/dist/web/server/assets/{login-CRd1yTH5.js → login-BJdJ219n.js} +1 -1
  109. package/dist/web/server/assets/{login-ZN6KV8n-.js → login-C4lL4AxI.js} +2 -2
  110. package/dist/web/server/assets/{manage-Ce6cI4eW.js → manage-C7ReF2ZZ.js} +3 -2
  111. package/dist/web/server/assets/{mcp-CYQuYWGX.js → mcp-BFixpBQk.js} +2 -2
  112. package/dist/web/server/assets/{mcp-BQ15a9dG.js → mcp-BTZkDvdc.js} +7 -4
  113. package/dist/web/server/assets/{mcp-C97uAZe1.js → mcp-Ceg9gzKE.js} +1 -1
  114. package/dist/web/server/assets/open-groups-C89TEK85.js +12 -0
  115. package/dist/web/server/assets/{page-title-CVY-c2Pd.js → page-title-PTpFHXWo.js} +1 -1
  116. package/dist/web/server/assets/parts-B0wbj_yK.js +436 -0
  117. package/dist/web/server/assets/{router-CPdWGKQ5.js → router-Ci_9VxDk.js} +244 -104
  118. package/dist/web/server/assets/{routes-BPloBDc8.js → routes-CVrH9qgo.js} +3 -3
  119. package/dist/web/server/assets/{routes-Dw1K3TQw.js → routes-D9Mw1_VV.js} +1453 -403
  120. package/dist/web/server/assets/{routes-xDPesCQu.js → routes-DsuaDPTO.js} +3 -3
  121. package/dist/web/server/assets/{skills-DWzlT_hC.js → skills-BNbZ75am.js} +1 -1
  122. package/dist/web/server/assets/{skills-6VSpEORe.js → skills-BWwEFc4a.js} +2 -2
  123. package/dist/web/server/assets/{skills-D0xrNc2_.js → skills-D5rnOmKJ.js} +9 -7
  124. package/dist/web/server/assets/src-BeMh8Fze.js +113 -0
  125. package/dist/web/server/assets/{start-DhW7sy23.js → start-2MvkBRdC.js} +1 -1
  126. package/dist/web/server/assets/{style-aMybyKzc.js → style-B3l0Wtlf.js} +1 -1
  127. package/dist/web/server/assets/{system-B5sPgdQW.js → system-Cr4C-YRw.js} +2 -2
  128. package/dist/web/server/assets/{system-CXmiWyDG.js → system-DT7AU0e6.js} +3 -3
  129. package/dist/web/server/assets/{system-D3th6n2E.js → system-DsmXkgqn.js} +1 -1
  130. package/dist/web/server/assets/{teams-ClRBVSYU.js → teams-BeStcDvQ.js} +2 -2
  131. package/dist/web/server/assets/{teams-yF3I_Zjq.js → teams-CsEBLW8-.js} +14 -8
  132. package/dist/web/server/assets/{teams-Dq4RCxis.js → teams-Dix5XVIx.js} +2 -2
  133. package/dist/web/server/assets/{teams-iXiCnN2i.js → teams-DjE0swAZ.js} +10 -6
  134. package/dist/web/server/assets/{teams-70u1XQTr.js → teams-Rk_RED7X.js} +1 -1
  135. package/dist/web/server/assets/{teams-BopOP4x7.js → teams-u6m6JzuU.js} +1 -1
  136. package/dist/web/server/assets/{telegram-DwEgyR1x.js → telegram-BjqABrl-.js} +287 -273
  137. package/dist/web/server/assets/{telegram-CGol0CKX2.js → telegram-CQpF3EHA.js} +1 -1
  138. package/dist/web/server/assets/{telegram-D9U9c1MN.js → telegram-DhzHgDfg.js} +2 -2
  139. package/dist/web/server/assets/{tools-C-wwWjLI.js → tools-DC69leH7.js} +1 -1
  140. package/dist/web/server/assets/{tools-DflVIdDd.js → tools-Dn6RnOFu.js} +2 -2
  141. package/dist/web/server/assets/{tools-VPIKjr3y.js → tools-x_DQTQtE.js} +6 -4
  142. package/dist/web/server/assets/usage-4zMG0sab.js +465 -0
  143. package/dist/web/server/assets/usage-mvQegG4l.js +46 -0
  144. package/dist/web/server/assets/{use-resource-CbHGYti0.js → use-resource-BjN1uJoL.js} +10 -2
  145. package/dist/web/server/assets/{welcome-7DrYZVs6.js → welcome-BuE9FRf4.js} +2 -2
  146. package/dist/web/server/assets/{welcome-CxXMI4HI.js → welcome-DYw35wl5.js} +1 -1
  147. package/dist/web/server/assets/{welcome-966nOyyK.js → welcome-DrYbWGd_.js} +8 -6
  148. package/dist/web/server/assets/workspace-0XPILV1W.js +82 -0
  149. package/dist/web/server/server.js +20 -20
  150. package/dist/worker.js +143 -18
  151. package/dist/worker.js.map +1 -1
  152. package/package.json +1 -1
  153. package/dist/web/client/assets/AddProviderDialog-DfFOaCjC.js +0 -1
  154. package/dist/web/client/assets/AgentTemplateParts-IMJmAQjN.js +0 -1
  155. package/dist/web/client/assets/ConfigPage-CzLHZa5o.js +0 -1
  156. package/dist/web/client/assets/ConfirmDialog-Cu_evkgc.js +0 -1
  157. package/dist/web/client/assets/ConnectionsView-D7Fmutl2.js +0 -1
  158. package/dist/web/client/assets/ManagePage-BfvlCrmz.js +0 -1
  159. package/dist/web/client/assets/SectionTabs-D7kPQGoh.js +0 -1
  160. package/dist/web/client/assets/SkillsParts-BuTxcCam.js +0 -1
  161. package/dist/web/client/assets/SpawnTeamModal-B1UnOvtp.js +0 -1
  162. package/dist/web/client/assets/TeamForm-DbzxtRjj.js +0 -1
  163. package/dist/web/client/assets/TeamThread-jpsWq6vI.js +0 -1
  164. package/dist/web/client/assets/UnsavedChangesGuard-BfyU9v9i.js +0 -1
  165. package/dist/web/client/assets/_id-BCNBLF-2.js +0 -1
  166. package/dist/web/client/assets/_id-D8_H79U2.js +0 -1
  167. package/dist/web/client/assets/access-CDWe1Kwy.js +0 -1
  168. package/dist/web/client/assets/agents-sE686DTf.js +0 -1
  169. package/dist/web/client/assets/agents-yrur1NDa.js +0 -1
  170. package/dist/web/client/assets/arrow-right-U66krZnr.js +0 -1
  171. package/dist/web/client/assets/attention-DYEHDfmx.js +0 -1
  172. package/dist/web/client/assets/chevron-right-CuqJFXTe.js +0 -1
  173. package/dist/web/client/assets/config-BHv886pr.js +0 -1
  174. package/dist/web/client/assets/index-GOthyyE-.js +0 -14
  175. package/dist/web/client/assets/login-Dhe15Uuc.js +0 -1
  176. package/dist/web/client/assets/mcp-A_Eo7x3q.js +0 -1
  177. package/dist/web/client/assets/parts-CpIfn_BH.js +0 -41
  178. package/dist/web/client/assets/plus-CQPjc8uR.js +0 -1
  179. package/dist/web/client/assets/routes-CTg_yjbY.js +0 -85
  180. package/dist/web/client/assets/skills-CLjtYtkA.js +0 -1
  181. package/dist/web/client/assets/style-mjEbxhf5.js +0 -7
  182. package/dist/web/client/assets/styles-DzcEC3Rd.css +0 -2
  183. package/dist/web/client/assets/teams-Bhje5n2h.js +0 -1
  184. package/dist/web/client/assets/teams-Cbgw0Qhv.js +0 -1
  185. package/dist/web/client/assets/telegram-HtUczmaA.js +0 -1
  186. package/dist/web/client/assets/tools-BpjFvmoX.js +0 -1
  187. package/dist/web/client/assets/use-resource-BnvgCpBi.js +0 -1
  188. package/dist/web/client/assets/welcome-D47LKWYO.js +0 -1
  189. package/dist/web/server/assets/Rail-b6EbjBB-.js +0 -605
  190. package/dist/web/server/assets/SpawnDialog-3wNx0W1R.js +0 -1851
  191. package/dist/web/server/assets/_tanstack-start-manifest_v-kkY_s_uR.js +0 -256
  192. package/dist/web/server/assets/createSsrRpc-qesavJv-.js +0 -72
  193. package/dist/web/server/assets/public-origin-BpDkdS5Q.js +0 -34
@@ -0,0 +1,82 @@
1
+ //#region src/lib/workspace.ts
2
+ var isOneOf = (values, value) => typeof value === "string" && values.includes(value);
3
+ var PANEL_TABS = [
4
+ "agent",
5
+ "team",
6
+ "connections",
7
+ "changes",
8
+ "files"
9
+ ];
10
+ /** The three screens that take the whole width, with the Agent list folded to avatars. */
11
+ var FOCUS_VIEWS = [
12
+ "connections",
13
+ "changes",
14
+ "files"
15
+ ];
16
+ var PANEL_LABELS = {
17
+ agent: "Agent",
18
+ team: "Team",
19
+ connections: "Connections",
20
+ changes: "Changes",
21
+ files: "Files"
22
+ };
23
+ /** Sheets of the Agent tab. */
24
+ var AGENT_SECTIONS = [
25
+ "schedules",
26
+ "learning",
27
+ "mailbox",
28
+ "skills",
29
+ "telegram",
30
+ "browser"
31
+ ];
32
+ /** Sheets of the Team tab. */
33
+ var TEAM_SECTIONS = [
34
+ "user-md",
35
+ "memory",
36
+ "settings"
37
+ ];
38
+ var SECTIONS = [...AGENT_SECTIONS, ...TEAM_SECTIONS];
39
+ var isAgentSection = (value) => isOneOf(AGENT_SECTIONS, value);
40
+ var isTeamSection = (value) => isOneOf(TEAM_SECTIONS, value);
41
+ var text = (value) => typeof value === "string" && value.length > 0 ? value : void 0;
42
+ /** A whole number from 0, as the router reads it from the address (a number or its text). */
43
+ var count = (value) => {
44
+ const number = typeof value === "string" ? Number(value) : value;
45
+ return typeof number === "number" && Number.isInteger(number) && number >= 0 ? number : void 0;
46
+ };
47
+ /** The search params the workspace understands; anything else is dropped. */
48
+ function parseWorkspaceSearch(search) {
49
+ const panel = search.panel;
50
+ return {
51
+ agent: text(search.agent),
52
+ team: text(search.team),
53
+ panel: panel === "none" || isOneOf(PANEL_TABS, panel) ? panel : void 0,
54
+ view: isOneOf(FOCUS_VIEWS, search.view) ? search.view : void 0,
55
+ file: text(search.file),
56
+ result: text(search.result),
57
+ conversation: text(search.conversation),
58
+ find: text(search.find),
59
+ match: count(search.match),
60
+ section: isOneOf(SECTIONS, search.section) ? search.section : void 0,
61
+ note: text(search.note)
62
+ };
63
+ }
64
+ /**
65
+ * Cookie that remembers the side panel between visits, so the first paint has it: the last tab,
66
+ * prefixed with `none:` while the panel is hidden.
67
+ */
68
+ var PANEL_COOKIE = "bz_panel";
69
+ function parsePanelCookie(raw) {
70
+ const hidden = raw?.startsWith("none:") ?? false;
71
+ const tab = hidden ? raw?.slice(5) : raw;
72
+ return {
73
+ open: !hidden,
74
+ tab: isOneOf(PANEL_TABS, tab) ? tab : "team"
75
+ };
76
+ }
77
+ function writePanelCookie(memory) {
78
+ const value = memory.open ? memory.tab : `none:${memory.tab}`;
79
+ document.cookie = `${PANEL_COOKIE}=${value}; Path=/; Max-Age=31536000; SameSite=Lax`;
80
+ }
81
+ //#endregion
82
+ export { isAgentSection as a, parseWorkspaceSearch as c, PANEL_TABS as i, writePanelCookie as l, PANEL_COOKIE as n, isTeamSection as o, PANEL_LABELS as r, parsePanelCookie as s, FOCUS_VIEWS as t };
@@ -3558,7 +3558,7 @@ var defaultSerovalPlugins = [
3558
3558
  * the dev styles URL for route-scoped CSS collection.
3559
3559
  */
3560
3560
  async function getStartManifest(matchedRoutes) {
3561
- const { tsrStartManifest } = await import("./assets/_tanstack-start-manifest_v-kkY_s_uR.js");
3561
+ const { tsrStartManifest } = await import("./assets/_tanstack-start-manifest_v-w2xn07aY.js");
3562
3562
  const startManifest = tsrStartManifest();
3563
3563
  let routes = startManifest.routes;
3564
3564
  routes[rootRouteId];
@@ -3582,71 +3582,71 @@ async function getStartManifest(matchedRoutes) {
3582
3582
  var manifest = {
3583
3583
  "04bb4df13ae68275e2f037ca67976778d2133273183d30d9ac2821f7cc7e85ad": {
3584
3584
  functionName: "fetchTemplates_createServerFn_handler",
3585
- importer: () => import("./assets/teams-BopOP4x7.js")
3585
+ importer: () => import("./assets/teams-u6m6JzuU.js")
3586
3586
  },
3587
3587
  "22325942f341b7af6fb13fa5fde2b06e1d7d91f9178205ef3eb9e5ba3c9ef2fe": {
3588
3588
  functionName: "fetchWorkspace_createServerFn_handler",
3589
- importer: () => import("./assets/routes-xDPesCQu.js")
3589
+ importer: () => import("./assets/routes-DsuaDPTO.js")
3590
3590
  },
3591
3591
  "278849457893891c3d22806d15e11a0a42cc3630b30e9e62b74cf2d3b982ded7": {
3592
3592
  functionName: "fetchServers_createServerFn_handler",
3593
- importer: () => import("./assets/mcp-C97uAZe1.js")
3593
+ importer: () => import("./assets/mcp-Ceg9gzKE.js")
3594
3594
  },
3595
3595
  "58834496dff9dbc5592f06b548d9eed177e540c1be46c549dbd10fb7987403d7": {
3596
3596
  functionName: "fetchSystem_createServerFn_handler",
3597
- importer: () => import("./assets/system-D3th6n2E.js")
3597
+ importer: () => import("./assets/system-DsmXkgqn.js")
3598
3598
  },
3599
3599
  "71b6b12251ac92cf4ee888c1d2b6eba3beaac079f9c39eaed95fafcd15908731": {
3600
3600
  functionName: "fetchModelsPage_createServerFn_handler",
3601
- importer: () => import("./assets/config-X7qWbbpH.js")
3601
+ importer: () => import("./assets/config-D1Li_7Yt2.js")
3602
3602
  },
3603
3603
  "7bc7f3b145d10e7a733fbe068ce367dda04ec2f1cdb53f0d6dcba3838eb2deeb": {
3604
3604
  functionName: "fetchTemplates_createServerFn_handler",
3605
- importer: () => import("./assets/agents-DQowl6Ly.js")
3605
+ importer: () => import("./assets/agents-Tg3zkmQv.js")
3606
3606
  },
3607
3607
  "818bf71baeed233268a5ad1a4be5a77e488be79b79ad1bd739463445a7be4d58": {
3608
3608
  functionName: "fetchProviders_createServerFn_handler",
3609
- importer: () => import("./assets/welcome-CxXMI4HI.js")
3609
+ importer: () => import("./assets/welcome-DYw35wl5.js")
3610
3610
  },
3611
3611
  "883b401299422096ee31ee824f9a24b49d06bdcedce398789778c4c549a92f3a": {
3612
3612
  functionName: "loadAttention_createServerFn_handler",
3613
- importer: () => import("./assets/attention-Dki8rmGZ.js")
3613
+ importer: () => import("./assets/attention-2unmuO-q.js")
3614
3614
  },
3615
3615
  "9252e07d6f45cb1c4543c2ca6f1b0c4c7697c249f3e6c94fda53b8a603929a92": {
3616
3616
  functionName: "fetchTelegramConfig_createServerFn_handler",
3617
- importer: () => import("./assets/telegram-CGol0CKX2.js")
3617
+ importer: () => import("./assets/telegram-CQpF3EHA.js")
3618
3618
  },
3619
3619
  "946c6cbff3f55931c3fb28c971d20b18b4b8a9f25417a5d1afc0550d7afa393b": {
3620
3620
  functionName: "fetchTools_createServerFn_handler",
3621
- importer: () => import("./assets/tools-C-wwWjLI.js")
3621
+ importer: () => import("./assets/tools-DC69leH7.js")
3622
3622
  },
3623
3623
  "a3ce4c3b27c4c69828cf8a81d1f5312a9f8e2c82de6c7e6e2846eb5c2fc322ea": {
3624
3624
  functionName: "fetchTemplate_createServerFn_handler",
3625
- importer: () => import("./assets/_id-De3Bm0SG.js")
3625
+ importer: () => import("./assets/_id-D4RFNqaJ.js")
3626
3626
  },
3627
3627
  "a5d3825fc69573bb55bab6df578c750ebb0240dd394c3acee3adea02918a5dc2": {
3628
3628
  functionName: "fetchAuthState_createServerFn_handler",
3629
- importer: () => import("./assets/auth-dJnrFW6y.js")
3629
+ importer: () => import("./assets/auth-DuIqEAed.js")
3630
3630
  },
3631
3631
  "ae1d30575b229c1e2622fbaf2252800a9a7acc84afdd68cba025ca890b8d52c5": {
3632
3632
  functionName: "fetchSkills_createServerFn_handler",
3633
- importer: () => import("./assets/skills-DWzlT_hC.js")
3633
+ importer: () => import("./assets/skills-BNbZ75am.js")
3634
3634
  },
3635
3635
  "c13d90cf82cd448c86427091165d0361b92843852a3f73a5bf4412dd2adc6bae": {
3636
3636
  functionName: "fetchTemplate_createServerFn_handler",
3637
- importer: () => import("./assets/_id-BKzOw78O.js")
3637
+ importer: () => import("./assets/_id-BTyd2i5U.js")
3638
3638
  },
3639
3639
  "c945ba2c0b997bf2ce9d965e41ad7655facbaa4c6f6c3284f90fbe6f2d427f52": {
3640
3640
  functionName: "fetchTokens_createServerFn_handler",
3641
- importer: () => import("./assets/access-WWspT0v4.js")
3641
+ importer: () => import("./assets/access-B97-94Wt.js")
3642
3642
  },
3643
3643
  "f715bab0037380aa3db7e237e7cf1e74168c363f48a960bb1ddfa5560de3a74e": {
3644
3644
  functionName: "fetchAgents_createServerFn_handler",
3645
- importer: () => import("./assets/agents-CRtMfKqX.js")
3645
+ importer: () => import("./assets/agents-BzJFjA2i.js")
3646
3646
  },
3647
3647
  "fda651b73911d8ef30f3a6b58894b5d853fdc4997acaf1793c76c06680504b82": {
3648
3648
  functionName: "fetchTeams_createServerFn_handler",
3649
- importer: () => import("./assets/teams-70u1XQTr.js")
3649
+ importer: () => import("./assets/teams-Rk_RED7X.js")
3650
3650
  }
3651
3651
  };
3652
3652
  async function getServerFnById(id, access) {
@@ -5524,8 +5524,8 @@ var getBaseManifest = getProdBaseManifest;
5524
5524
  var createEarlyHintsForRequest = createEarlyHintsCollector;
5525
5525
  async function loadEntries() {
5526
5526
  const [routerEntry, startEntry, pluginAdapters] = await Promise.all([
5527
- import("./assets/router-CPdWGKQ5.js"),
5528
- import("./assets/start-DhW7sy23.js"),
5527
+ import("./assets/router-Ci_9VxDk.js"),
5528
+ import("./assets/start-2MvkBRdC.js"),
5529
5529
  import("./assets/empty-plugin-adapters-Cq4--YW-.js")
5530
5530
  ]);
5531
5531
  return {
package/dist/worker.js CHANGED
@@ -23,6 +23,12 @@ var REVIEW_LIMITS = {
23
23
  patchBytes: 256 * 1024
24
24
  };
25
25
 
26
+ // ../../packages/api-types/src/results.ts
27
+ var TEXT_PREVIEW_MAX_BYTES = 256 * 1024;
28
+ var TEXT_EXTENSIONS = new Set(
29
+ "txt md markdown csv tsv json jsonl ndjson yaml yml toml ini cfg conf log xml css scss js mjs cjs jsx ts tsx py rb go rs java kt swift c h cc cpp hpp cs php sh bash zsh fish ps1 sql r lua pl tex diff patch vue svelte graphql proto dockerfile makefile".split(" ")
30
+ );
31
+
26
32
  // ../daemon/src/core/repos/user-queue.ts
27
33
  var QUEUE_LIMITS = Object.freeze({
28
34
  /** Waiting or running items per Agent. */
@@ -35,13 +41,17 @@ var QUEUE_LIMITS = Object.freeze({
35
41
  keepMs: 7 * 24 * 60 * 6e4
36
42
  });
37
43
 
44
+ // ../daemon/src/core/turn-failures.ts
45
+ var KEPT_MS = 14 * 864e5;
46
+
38
47
  // ../daemon/src/core/attention.ts
39
48
  var RECORDED_ATTENTION_KINDS = [
40
49
  "lesson_proposal",
41
50
  "review_failure",
42
51
  "trigger_failure",
43
52
  "agent_loop_break",
44
- "queue_interrupted"
53
+ "queue_interrupted",
54
+ "turn_failure"
45
55
  ];
46
56
  var WAITING_ATTENTION_KINDS = [
47
57
  "agent_question",
@@ -112,6 +122,7 @@ function apiKey(id, displayName, envVar, options = {}) {
112
122
  id,
113
123
  displayName,
114
124
  ...options.hint ? { hint: options.hint } : {},
125
+ ...options.plan ? { plan: true } : {},
115
126
  keyEnv: [envVar],
116
127
  ...options.modelsUrl ? { modelsUrl: options.modelsUrl } : {},
117
128
  fields: [
@@ -145,6 +156,7 @@ var PROVIDERS = [
145
156
  hint: "Use your ChatGPT Plus, Pro or Team plan. No API key.",
146
157
  // Credentials come from the OAuth flow (/api/auth/openai), not from fields.
147
158
  fields: [],
159
+ plan: true,
148
160
  popular: true,
149
161
  suggested: ["gpt-6.2-sol", "gpt-6-luna"]
150
162
  },
@@ -161,6 +173,7 @@ var PROVIDERS = [
161
173
  displayName: "Anthropic",
162
174
  hint: "Claude models \xB7 console.anthropic.com",
163
175
  keyEnv: ["ANTHROPIC_OAUTH_TOKEN", "ANTHROPIC_API_KEY"],
176
+ planEnv: "ANTHROPIC_OAUTH_TOKEN",
164
177
  fields: [
165
178
  { envVar: "ANTHROPIC_API_KEY", kind: "secret", label: "API key", placeholder: "sk-ant-..." },
166
179
  {
@@ -239,6 +252,7 @@ var PROVIDERS = [
239
252
  displayName: "GitHub Copilot",
240
253
  hint: "Use a GitHub Copilot subscription to call Claude/GPT/Gemini via Copilot",
241
254
  keyEnv: ["COPILOT_GITHUB_TOKEN"],
255
+ plan: true,
242
256
  fields: [
243
257
  {
244
258
  envVar: "COPILOT_GITHUB_TOKEN",
@@ -293,36 +307,41 @@ var PROVIDERS = [
293
307
  }),
294
308
  // Each plan has its own key; Pi also reads the older shared QWEN_TOKEN_PLAN_API_KEY.
295
309
  apiKey("qwen-token-plan", "Qwen Token Plan Team", "QWEN_TOKEN_PLAN_TEAM_API_KEY", {
296
- hint: "Team coding-model subscription \xB7 international endpoint"
310
+ hint: "Team coding-model subscription \xB7 international endpoint",
311
+ plan: true
297
312
  }),
298
313
  apiKey("qwen-token-plan-cn", "Qwen Token Plan Team (CN)", "QWEN_TOKEN_PLAN_TEAM_CN_API_KEY", {
299
- hint: "Team coding-model subscription \xB7 China endpoint"
314
+ hint: "Team coding-model subscription \xB7 China endpoint",
315
+ plan: true
300
316
  }),
301
317
  apiKey(
302
318
  "qwen-token-plan-individual",
303
319
  "Qwen Token Plan Individual",
304
320
  "QWEN_TOKEN_PLAN_INDIVIDUAL_API_KEY",
305
- { hint: "Individual subscription \xB7 international endpoint" }
321
+ { hint: "Individual subscription \xB7 international endpoint", plan: true }
306
322
  ),
307
323
  apiKey(
308
324
  "qwen-token-plan-individual-cn",
309
325
  "Qwen Token Plan Individual (CN)",
310
326
  "QWEN_TOKEN_PLAN_INDIVIDUAL_CN_API_KEY",
311
- { hint: "Individual subscription \xB7 China endpoint" }
327
+ { hint: "Individual subscription \xB7 China endpoint", plan: true }
312
328
  ),
313
329
  apiKey("xiaomi", "Xiaomi MiMo", "XIAOMI_API_KEY", {
314
330
  hint: "API billing endpoint \xB7 platform.xiaomimimo.com"
315
331
  }),
316
332
  apiKey("xiaomi-token-plan-ams", "Xiaomi MiMo Token Plan (AMS)", "XIAOMI_TOKEN_PLAN_AMS_API_KEY", {
317
333
  hint: "MiMo token-plan endpoint in Amsterdam",
334
+ plan: true,
318
335
  modelsUrl: "https://token-plan-ams.xiaomimimo.com/v1"
319
336
  }),
320
337
  apiKey("xiaomi-token-plan-cn", "Xiaomi MiMo Token Plan (CN)", "XIAOMI_TOKEN_PLAN_CN_API_KEY", {
321
338
  hint: "MiMo token-plan endpoint in China",
339
+ plan: true,
322
340
  modelsUrl: "https://token-plan-cn.xiaomimimo.com/v1"
323
341
  }),
324
342
  apiKey("xiaomi-token-plan-sgp", "Xiaomi MiMo Token Plan (SGP)", "XIAOMI_TOKEN_PLAN_SGP_API_KEY", {
325
343
  hint: "MiMo token-plan endpoint in Singapore",
344
+ plan: true,
326
345
  modelsUrl: "https://token-plan-sgp.xiaomimimo.com/v1"
327
346
  }),
328
347
  apiKey("ant-ling", "Ant Ling", "ANT_LING_API_KEY", {
@@ -1005,11 +1024,11 @@ function assertRootUnchanged(root, canonicalRoot) {
1005
1024
  function safeKey(root, key) {
1006
1025
  const segments = key.split(/[\\/]/);
1007
1026
  if (key.length === 0 || key.includes("\0") || isAbsolute(key) || /^[A-Za-z]:[\\/]/.test(key) || key.startsWith("\\\\") || segments.includes("..")) {
1008
- throw new Error(`unsafe memory key: ${key}`);
1027
+ throw new DomainError(400, `unsafe memory key: ${key}`);
1009
1028
  }
1010
- if (!key.endsWith(".md")) throw new Error(`memory keys end in .md: ${key}`);
1029
+ if (!key.endsWith(".md")) throw new DomainError(400, `memory keys end in .md: ${key}`);
1011
1030
  const candidate = resolve2(root, key);
1012
- if (candidate === root) throw new Error(`unsafe memory key: ${key}`);
1031
+ if (candidate === root) throw new DomainError(400, `unsafe memory key: ${key}`);
1013
1032
  assertContained(root, candidate);
1014
1033
  return candidate;
1015
1034
  }
@@ -1466,6 +1485,8 @@ function piMessagesToProviderView(messages, secrets = []) {
1466
1485
  const toolCalls = extractAssistantToolCalls(am);
1467
1486
  const msg = { role: "assistant", content: text };
1468
1487
  if (toolCalls.length > 0) msg.toolCalls = toolCalls;
1488
+ if (am.stopReason === "aborted") msg.stopped = "cancelled";
1489
+ else if (am.stopReason === "error") msg.stopped = "failed";
1469
1490
  out.push(msg);
1470
1491
  break;
1471
1492
  }
@@ -1726,6 +1747,8 @@ function browserGuideSection(attached = false) {
1726
1747
 
1727
1748
  // ../daemon/src/runtime/session/prompt.ts
1728
1749
  var SANDBOX_SKILLS_DIR = "/skills";
1750
+ var MAX_LISTED_TEAMMATES = 40;
1751
+ var MAX_LISTED_OUTSIDE = 20;
1729
1752
  function loadPromptSkills(skillsDir, attachedNames) {
1730
1753
  if (!existsSync(skillsDir) || attachedNames.length === 0) return [];
1731
1754
  const attached = new Set(attachedNames);
@@ -1790,7 +1813,16 @@ ${contextBlocks.join("\n\n")}`
1790
1813
  });
1791
1814
  }
1792
1815
  const bootstrap = homeDocuments["BOOTSTRAP.md"]?.trimEnd();
1793
- if (bootstrap) {
1816
+ if (bootstrap && options.withOperator === false) {
1817
+ parts.push({
1818
+ id: "first-run",
1819
+ text: [
1820
+ "# First-Run Ritual",
1821
+ "",
1822
+ "You have not had your first conversation with the human yet; it waits until they talk to you. This turn was not started by them (a teammate wrote to you, or a schedule fired), so nobody is here to answer its questions: do not greet the human or ask who you are. Do the work this turn asks for, with what you know."
1823
+ ].join("\n")
1824
+ });
1825
+ } else if (bootstrap) {
1794
1826
  parts.push({
1795
1827
  id: "first-run",
1796
1828
  text: [
@@ -1802,6 +1834,9 @@ ${contextBlocks.join("\n\n")}`
1802
1834
  "- Your first reply is ONLY a greeting + ONE question. No tool calls. Wait for the human to answer.",
1803
1835
  "- Each subsequent turn: at most one new question. Wait between turns.",
1804
1836
  "- Only after the ritual is complete (you have enough to write IDENTITY.md): call `home_write` once, then `bootstrap_done`.",
1837
+ ...agent.team.userMd.trim() ? [
1838
+ "- The Team's USER.md (under About the User) already says some things about the human: do not ask what it answers."
1839
+ ] : [],
1805
1840
  "",
1806
1841
  "## BOOTSTRAP.md",
1807
1842
  "",
@@ -1872,6 +1907,7 @@ ${contextBlocks.join("\n\n")}`
1872
1907
  "",
1873
1908
  "An `AGENTS.md` file in the workspace holds repository instructions that govern its own directory and everything below it. The ones from the workspace root down to your working directory are already in your project instructions; read any other `AGENTS.md` on the path to files you edit."
1874
1909
  ];
1910
+ teamLines.push("", ...teammateLines(agent, options));
1875
1911
  parts.push({ id: "team", text: teamLines.join("\n") });
1876
1912
  if (agent.team.userMd.trim()) {
1877
1913
  parts.push({
@@ -1907,6 +1943,44 @@ ${reviewedLessons.map((lesson) => `- ${lesson}`).join("\n")}`
1907
1943
  });
1908
1944
  return parts;
1909
1945
  }
1946
+ function teammateLines(agent, options) {
1947
+ const contacts = options.contacts ?? [];
1948
+ const line = (text) => text.replace(/[\p{Cc}\p{Cf}\u2028\u2029\s]+/gu, " ").trim();
1949
+ const entry = (contact, team) => `- ${line(contact.name)}: id ${contact.id}${team ? "" : `, Team ${line(contact.teamName)}`} (template ${line(contact.template)})`;
1950
+ const listed = (list4, max, team) => [
1951
+ ...list4.slice(0, max).map((contact) => entry(contact, team)),
1952
+ ...list4.length > max ? [`- and ${list4.length - max} more`] : []
1953
+ ];
1954
+ const teammates = contacts.filter((contact) => contact.teamId === agent.team.id);
1955
+ const reachable = teammates.filter((contact) => contact.canMessage);
1956
+ const unreachable = teammates.filter((contact) => !contact.canMessage);
1957
+ const outside = contacts.filter((contact) => contact.teamId !== agent.team.id);
1958
+ const create2 = options.canCreateAgents ? " When the human asks you to add teammates, create them with `agent_create`." : "";
1959
+ const lines = ["## Your teammates", ""];
1960
+ if (teammates.length === 0) {
1961
+ lines.push(`You are the only Agent in this Team so far.${create2}`);
1962
+ } else {
1963
+ lines.push(
1964
+ `Message an Agent with \`send_message\`: put its id (or its exact name) in \`to\`. These are current; do not ask the human for ids.${create2}`
1965
+ );
1966
+ if (reachable.length > 0) lines.push("", ...listed(reachable, MAX_LISTED_TEAMMATES, true));
1967
+ if (unreachable.length > 0) {
1968
+ lines.push(
1969
+ "",
1970
+ "In this restricted Team you have no connection to these teammates, so you cannot message them; the human can connect you in the Team's Connections view:",
1971
+ ...listed(unreachable, MAX_LISTED_TEAMMATES, true)
1972
+ );
1973
+ }
1974
+ }
1975
+ if (outside.length > 0) {
1976
+ lines.push(
1977
+ "",
1978
+ "Team Policy also lets you message these Agents of other Teams:",
1979
+ ...listed(outside, MAX_LISTED_OUTSIDE, false)
1980
+ );
1981
+ }
1982
+ return lines;
1983
+ }
1910
1984
  function boundReviewedLessons(lessons, maxCharacters = 8e3) {
1911
1985
  const selected = [];
1912
1986
  let used = 0;
@@ -2424,7 +2498,7 @@ import { closeSync as closeSync3, constants as constants3, fstatSync as fstatSyn
2424
2498
  import { join as join5 } from "node:path";
2425
2499
  var MAX_SESSION_BYTES = 64 * 1024 * 1024;
2426
2500
  var MAX_HEADER_BYTES = 64 * 1024;
2427
- function readStart(directory, id, limit) {
2501
+ function readStart(directory, id, limit, refuseOver) {
2428
2502
  if (!/^[0-9a-f-]{36}$/i.test(id)) throw new Error("Invalid conversation id");
2429
2503
  const fd = openSync3(
2430
2504
  join5(directory, `${id}.jsonl`),
@@ -2433,6 +2507,8 @@ function readStart(directory, id, limit) {
2433
2507
  try {
2434
2508
  const stat = fstatSync3(fd);
2435
2509
  if (!stat.isFile()) throw new Error("Session file is not a regular file");
2510
+ if (refuseOver !== void 0 && stat.size > refuseOver)
2511
+ throw new Error("Session file is larger than 64 MiB");
2436
2512
  const bytes = Buffer.alloc(Math.min(stat.size, limit));
2437
2513
  let count = 0;
2438
2514
  while (count < bytes.length) {
@@ -2990,11 +3066,11 @@ function messagingTools(host, fromAgentId) {
2990
3066
  {
2991
3067
  def: {
2992
3068
  name: "send_message",
2993
- description: `Send a message to another agent. Use the recipient's agent id (UUID). Use this ONLY for things the recipient needs to ACT on: delegating a task, asking a peer for information you cannot get yourself, escalating a decision. Do NOT use it for status updates or to announce changes to team-shared resources \u2014 USER.md and the team memory backend both propagate to every agent in the team automatically on their next turn, so messages like "I updated USER.md" or "I wrote a new memory note" are pure noise and will trigger an inbox-wake loop on the recipient.`,
3069
+ description: 'Send a message to another agent: `to` is its id, or its exact name (your teammates are listed in your instructions). Use this ONLY for things the recipient needs to ACT on: delegating a task, asking a peer for information you cannot get yourself, escalating a decision. Do NOT use it for status updates or to announce changes to team-shared resources \u2014 USER.md and the team memory backend both propagate to every agent in the team automatically on their next turn, so messages like "I updated USER.md" or "I wrote a new memory note" are pure noise and will trigger an inbox-wake loop on the recipient.',
2994
3070
  parameters: {
2995
3071
  type: "object",
2996
3072
  properties: {
2997
- to: { type: "string", description: "Recipient agent id" },
3073
+ to: { type: "string", description: "Recipient Agent id, or its exact name" },
2998
3074
  text: { type: "string", description: "Message text" },
2999
3075
  reply_to: {
3000
3076
  type: "string",
@@ -3009,9 +3085,6 @@ function messagingTools(host, fromAgentId) {
3009
3085
  const text = String(args.text ?? "");
3010
3086
  if (!to) throw new Error('send_message: "to" is required');
3011
3087
  if (!text) throw new Error('send_message: "text" is required');
3012
- if (!await host.agentExists(to)) {
3013
- throw new Error(`send_message: agent not found: ${to}`);
3014
- }
3015
3088
  const replyTo = typeof args.reply_to === "string" ? args.reply_to : null;
3016
3089
  const { messageId } = await host.sendMessage({
3017
3090
  from: fromAgentId,
@@ -3094,6 +3167,51 @@ function messagingTools(host, fromAgentId) {
3094
3167
  ];
3095
3168
  }
3096
3169
 
3170
+ // ../daemon/src/runtime/tools/team.ts
3171
+ function agentCreateTool(host) {
3172
+ return {
3173
+ def: {
3174
+ name: "agent_create",
3175
+ description: "Add a new Agent to your Team, when the operator asks you to (to build a team, or to hand part of the work to a specialist). It joins your Team, shares its workspace and memory, and starts knowing its role and that you made it: give it a clear name and say what it is for. It uses your model and Agent template unless you name others. In a restricted Team it is connected with you both ways. Message it afterwards with send_message, by the id this returns. Do not create Agents the operator did not ask for, or several for one job.",
3176
+ parameters: {
3177
+ type: "object",
3178
+ properties: {
3179
+ name: {
3180
+ type: "string",
3181
+ description: 'Its name, unique in your Team, e.g. "Lead Researcher"'
3182
+ },
3183
+ role: {
3184
+ type: "string",
3185
+ description: "What it is for and how it should work, in a few sentences: its job, what it delivers and to whom, and its limits"
3186
+ },
3187
+ template: {
3188
+ type: "string",
3189
+ description: "Optional: an Agent template id (default: your own)"
3190
+ },
3191
+ model: {
3192
+ type: "string",
3193
+ description: 'Optional: a model as "provider:model" (default: your own model)'
3194
+ }
3195
+ },
3196
+ required: ["name", "role"]
3197
+ }
3198
+ },
3199
+ async invoke(args) {
3200
+ const created = await host.createAgent({
3201
+ name: String(args.name ?? ""),
3202
+ role: String(args.role ?? ""),
3203
+ ...typeof args.template === "string" && args.template ? { template: args.template } : {},
3204
+ ...typeof args.model === "string" && args.model ? { model: args.model } : {}
3205
+ });
3206
+ return [
3207
+ `Created ${created.name} (id ${created.id}) in ${created.teamName}, from the template ${created.template}, on ${created.model}.`,
3208
+ created.connected ? "It is connected with you both ways." : "",
3209
+ "Brief it with send_message to that id."
3210
+ ].filter(Boolean).join(" ");
3211
+ }
3212
+ };
3213
+ }
3214
+
3097
3215
  // ../daemon/src/runtime/tools/user-md.ts
3098
3216
  function userMdTools(host, teamId) {
3099
3217
  return [
@@ -3800,6 +3918,7 @@ function createBazilionCustomTools(opts) {
3800
3918
  if (opts.fileSink) handlers.push(deliverFileTool(opts.agent.team.path, opts.fileSink));
3801
3919
  if (opts.imageGenerationHost) handlers.push(imageGenerateTool(opts.imageGenerationHost));
3802
3920
  if (opts.askUser) handlers.push(askUserTool(opts.askUser));
3921
+ if (opts.teamHost) handlers.push(agentCreateTool(opts.teamHost));
3803
3922
  return handlers.map(ourToolToPiTool);
3804
3923
  }
3805
3924
 
@@ -3884,6 +4003,7 @@ function turnSurface(opts) {
3884
4003
  imageGenerationHost: opts.imageGenerationHost,
3885
4004
  webSearchHost: opts.webSearchHost,
3886
4005
  askUser: opts.askUser,
4006
+ teamHost: opts.teamHost,
3887
4007
  env
3888
4008
  });
3889
4009
  const promptOptions = {
@@ -3891,7 +4011,10 @@ function turnSurface(opts) {
3891
4011
  sandboxMode: shellTools.config.sandboxMode,
3892
4012
  // The guides ride along exactly when their tools are admitted.
3893
4013
  ...opts.browserHost ? { browserGuide: resolveBrowserConfig(env).attach ? "attached" : true } : {},
3894
- ...opts.webSearchHost ? { searchGuide: true } : {}
4014
+ ...opts.webSearchHost ? { searchGuide: true } : {},
4015
+ contacts: opts.contacts ?? [],
4016
+ canCreateAgents: opts.teamHost !== void 0,
4017
+ withOperator: opts.withOperator ?? true
3895
4018
  };
3896
4019
  return {
3897
4020
  cwd,
@@ -4250,7 +4373,6 @@ async function openAgentTurn(input, call) {
4250
4373
  refreshApiKey: ipcRefresher(input, call),
4251
4374
  mcpTools: input.mcpTools,
4252
4375
  messagingHost: served.has("messagingHost") ? {
4253
- agentExists: (agentId) => call("agentExists", { agentId }),
4254
4376
  sendMessage: (args) => call("sendMessage", args),
4255
4377
  listInbox: (agentId, { unreadOnly }) => call("listInbox", { agentId, unreadOnly }),
4256
4378
  markRead: async (messageId) => {
@@ -4283,7 +4405,10 @@ async function openAgentTurn(input, call) {
4283
4405
  });
4284
4406
  return result;
4285
4407
  } : void 0,
4286
- bashApprovalHost: served.has("bashApprovalHost") ? ipcBashApproval(call, input) : void 0
4408
+ bashApprovalHost: served.has("bashApprovalHost") ? ipcBashApproval(call, input) : void 0,
4409
+ teamHost: served.has("teamHost") ? { createAgent: (args) => call("createAgent", args) } : void 0,
4410
+ contacts: input.contacts,
4411
+ withOperator: input.withOperator
4287
4412
  });
4288
4413
  }
4289
4414
  async function openReview(input, call) {