bazilion 0.7.0 → 0.9.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 (166) hide show
  1. package/README.md +47 -5
  2. package/dist/cli.js +1257 -638
  3. package/dist/cli.js.map +1 -1
  4. package/dist/daemon.js +5334 -1594
  5. package/dist/daemon.js.map +1 -1
  6. package/dist/migrations/0001_init.sql +318 -88
  7. package/dist/web/client/assets/{FieldRow-CNKma5LE.js → FieldRow-DmwAFfbF.js} +1 -1
  8. package/dist/web/client/assets/ProductionTeamPolicyEditor-1a5jQqUB.js +7 -0
  9. package/dist/web/client/assets/ProductionTeamPolicyEditor-DLioOiRN.css +1 -0
  10. package/dist/web/client/assets/ProfileCommunicationEditor-D1OZ8WE5.js +1 -0
  11. package/dist/web/client/assets/RecoveryState-QfMSuwy3.js +1 -0
  12. package/dist/web/client/assets/TeamTabs-BViZ4sti.js +1 -0
  13. package/dist/web/client/assets/TemplatesTabs-DVcY9pMD.js +1 -0
  14. package/dist/web/client/assets/_id-8P7brhGy.js +1 -0
  15. package/dist/web/client/assets/_id-C3o3MHq8.js +1 -0
  16. package/dist/web/client/assets/_id-DGRrSF1e.js +1 -0
  17. package/dist/web/client/assets/_id-DGyKURCp.js +1 -0
  18. package/dist/web/client/assets/_id-KnJe-aW9.js +1 -0
  19. package/dist/web/client/assets/activity-DJuhhQCb.js +1 -0
  20. package/dist/web/client/assets/activity-WWvJSo4t.js +1 -0
  21. package/dist/web/client/assets/agents-C32T1voV.js +1 -0
  22. package/dist/web/client/assets/agents-nH4m4gZ1.js +1 -0
  23. package/dist/web/client/assets/approvals-DGi0PSx8.js +1 -0
  24. package/dist/web/client/assets/approvals-l8jIZjqz.js +1 -0
  25. package/dist/web/client/assets/{config-BSAVT-17.js → config-C7wvi1nR.js} +2 -2
  26. package/dist/web/client/assets/context-BEGWE3RC.js +1 -0
  27. package/dist/web/client/assets/inbox--4aBaAgG.js +1 -0
  28. package/dist/web/client/assets/index-BCXoh1c8.js +12 -0
  29. package/dist/web/client/assets/{login-D8lNr2SX.js → login-Bk2wwIHQ.js} +1 -1
  30. package/dist/web/client/assets/{mcp-BLnngDsj.js → mcp-vM7xgh9e.js} +1 -1
  31. package/dist/web/client/assets/members-cPKfnrSL.js +1 -0
  32. package/dist/web/client/assets/memory-BOcsaemD.js +1 -0
  33. package/dist/web/client/assets/policy-BGLCJYvS.js +1 -0
  34. package/dist/web/client/assets/policy-K4hIbbIN.js +1 -0
  35. package/dist/web/client/assets/{preload-helper-CvnapA2_.js → preload-helper-eOOCz1Fu.js} +1 -1
  36. package/dist/web/client/assets/routes-DnrP3dwv.js +1 -0
  37. package/dist/web/client/assets/services-C2_O3ifw.js +1 -0
  38. package/dist/web/client/assets/skills-B__fLZjx.js +1 -0
  39. package/dist/web/client/assets/styles-Dn24-ZvP.css +2 -0
  40. package/dist/web/client/assets/team-policy-BdX340m4.js +1 -0
  41. package/dist/web/client/assets/teams-CSNyLz3l.js +1 -0
  42. package/dist/web/client/assets/teams-DZMB4_iw.js +1 -0
  43. package/dist/web/client/assets/teams-rpaYKNIb.js +1 -0
  44. package/dist/web/client/assets/telegram-B1O4Ko0V.js +1 -0
  45. package/dist/web/client/assets/{tokens-D2_O9ARe.js → tokens-D7FH9VgA.js} +1 -1
  46. package/dist/web/client/assets/triggers-3PLy2_Fo.js +1 -0
  47. package/dist/web/client/assets/welcome-B-QQobzq.js +1 -0
  48. package/dist/web/client/assets/{ChatPane-DzEgOEqS.js → wire-constants-BY9Q9Z7d.js} +4 -4
  49. package/dist/web/server/assets/{ChatPane-BvpswYvF.js → ChatPane-Dh3qxzdb.js} +23 -12
  50. package/dist/web/server/assets/ProductionTeamPolicyEditor-Bke5doyl.js +1009 -0
  51. package/dist/web/server/assets/ProfileCommunicationEditor-C2RU-2QB.js +107 -0
  52. package/dist/web/server/assets/RecoveryState-B2SG-mrY.js +37 -0
  53. package/dist/web/server/assets/{Sidebar-DmEiewRN.js → Sidebar-CGmtCnYU.js} +372 -48
  54. package/dist/web/server/assets/TeamTabs-BPxDBfqy.js +50 -0
  55. package/dist/web/server/assets/{TemplatesTabs---7h5GYa.js → TemplatesTabs-zf4YhStd.js} +6 -6
  56. package/dist/web/server/assets/{_id-CXg-Blec.js → _id-5lLzLwcv.js} +52 -40
  57. package/dist/web/server/assets/_id-A8Xiv6Lc.js +11 -0
  58. package/dist/web/server/assets/{_id-BqnDy_Ca.js → _id-B04VaQlh.js} +6 -5
  59. package/dist/web/server/assets/{_id-D0ytyXGY.js → _id-B6g9wmPR.js} +167 -31
  60. package/dist/web/server/assets/_id-ButXHnRH.js +14 -0
  61. package/dist/web/server/assets/_id-C4AOhstq.js +44 -0
  62. package/dist/web/server/assets/{_id-DDixKEud.js → _id-CCHA0gdR.js} +72 -12
  63. package/dist/web/server/assets/{_id-D_Ew11ED.js → _id-CUWgTqMS.js} +8 -8
  64. package/dist/web/server/assets/_id-DJkzwHjM.js +42 -0
  65. package/dist/web/server/assets/{_id-CnQflrRv.js → _id-DdC9wpNN.js} +5 -5
  66. package/dist/web/server/assets/{_id-81NrHA5d.js → _id-DkFgCIb-.js} +9 -1
  67. package/dist/web/server/assets/{_id-D8duqgd5.js → _id-_nFwi9gD.js} +5 -4
  68. package/dist/web/server/assets/{_id-Sjw0zhA6.js → _id-fpFQ9_Ya.js} +4 -4
  69. package/dist/web/server/assets/_tanstack-start-manifest_v-Div-TukY.js +241 -0
  70. package/dist/web/server/assets/activity-C2ZKg1Q9.js +170 -0
  71. package/dist/web/server/assets/activity-CGCf8BQf.js +11 -0
  72. package/dist/web/server/assets/activity-DedraoFj.js +14 -0
  73. package/dist/web/server/assets/activity-GPx8NCeB.js +12 -0
  74. package/dist/web/server/assets/{profiles-CZ5NkmVw.js → agents-B8kinIPW.js} +4 -4
  75. package/dist/web/server/assets/{agents-k5QURC4I.js → agents-BR2qXlXF.js} +4 -4
  76. package/dist/web/server/assets/{agents-ChcAJUI5.js → agents-Bp1nsVs2.js} +1 -1
  77. package/dist/web/server/assets/{profiles-LxcC_L6n.js → agents-CUQmWhTp.js} +36 -10
  78. package/dist/web/server/assets/{agents-C7SBPN0M.js → agents-DU9Hqs58.js} +51 -12
  79. package/dist/web/server/assets/{profiles-C6a3RKgu.js → agents-LHowEI6S.js} +4 -4
  80. package/dist/web/server/assets/approvals-CbFXFvG8.js +11 -0
  81. package/dist/web/server/assets/approvals-DHgARzd8.js +242 -0
  82. package/dist/web/server/assets/approvals-Dw2LJoSA.js +14 -0
  83. package/dist/web/server/assets/approvals-VPc0YpLN.js +12 -0
  84. package/dist/web/server/assets/{auth-DzRAMwVt.js → auth-l-Vf8wlu.js} +5 -1
  85. package/dist/web/server/assets/{config-CdVjqjin.js → config-BvKctDOX.js} +4 -4
  86. package/dist/web/server/assets/{config-Bq3o924J.js → config-QvHaxGlP.js} +1 -1
  87. package/dist/web/server/assets/context-5lrf2ame.js +12 -0
  88. package/dist/web/server/assets/context-CEr4-xiA.js +49 -0
  89. package/dist/web/server/assets/context-D3Egm-vY.js +12 -0
  90. package/dist/web/server/assets/members-40DxRdVj.js +48 -0
  91. package/dist/web/server/assets/members-DlGBKZNl.js +12 -0
  92. package/dist/web/server/assets/members-ksELRsyk.js +12 -0
  93. package/dist/web/server/assets/{memory-Ns2-Z31p.js → memory-B5moRnnp.js} +5 -5
  94. package/dist/web/server/assets/{memory-BaYnfm7K.js → memory-CO0jKGzJ.js} +8 -8
  95. package/dist/web/server/assets/memory-CiTl4cN9.js +289 -0
  96. package/dist/web/server/assets/policy-BYVXqsan.js +11 -0
  97. package/dist/web/server/assets/policy-DNcGZLOB.js +21 -0
  98. package/dist/web/server/assets/policy-Dr55y-Mh.js +496 -0
  99. package/dist/web/server/assets/policy-Dxs78_GO.js +40 -0
  100. package/dist/web/server/assets/{router-BpBZgRwn.js → router-_izWQUeG.js} +156 -101
  101. package/dist/web/server/assets/{routes-Ce2VWrU9.js → routes-BSSKp3Rv.js} +4 -4
  102. package/dist/web/server/assets/{routes-C61gBiXa.js → routes-BrTOoeth.js} +5 -5
  103. package/dist/web/server/assets/{routes-V9URcp1v.js → routes-DOj6ljcm.js} +1 -1
  104. package/dist/web/server/assets/{services-B91w2f-X.js → services-CHe4ihJk.js} +11 -11
  105. package/dist/web/server/assets/{services-Ccc5s2bS.js → services-Pv_V88VA.js} +3 -3
  106. package/dist/web/server/assets/{skills-dLyBZb3B.js → skills-D89ND2kR.js} +67 -7
  107. package/dist/web/server/assets/{skills-CpsyR_WA.js → skills-l2cyQ3zS.js} +1 -1
  108. package/dist/web/server/assets/{start-CYDpZ6cb.js → start-DlHq0RaQ.js} +1 -1
  109. package/dist/web/server/assets/team-policy-Csvc5EDd.js +180 -0
  110. package/dist/web/server/assets/teams-35Oprf6e.js +14 -0
  111. package/dist/web/server/assets/teams-3im0oQnS.js +11 -0
  112. package/dist/web/server/assets/teams-B5IF65p2.js +12 -0
  113. package/dist/web/server/assets/teams-B9O-WDH5.js +108 -0
  114. package/dist/web/server/assets/teams-DFkN7ic7.js +36 -0
  115. package/dist/web/server/assets/teams-DH1CvWmT.js +12 -0
  116. package/dist/web/server/assets/teams-zcm9XaQU.js +174 -0
  117. package/dist/web/server/assets/{telegram-DfAddLdv.js → telegram-C9sQFwWj.js} +7 -7
  118. package/dist/web/server/assets/{telegram-T3l9KtiE.js → telegram-mTnJCOmn.js} +1 -1
  119. package/dist/web/server/assets/{welcome-CP4CZ9B6.js → welcome-CDGE2Sdk.js} +2 -2
  120. package/dist/web/server/assets/{wire-constants-Deb4NxBb.js → wire-constants-C8nBJcU3.js} +3 -3
  121. package/dist/web/server/server.js +64 -42
  122. package/dist/worker.js +180 -128
  123. package/dist/worker.js.map +1 -1
  124. package/package.json +7 -7
  125. package/dist/migrations/0002_profile_groups.sql +0 -38
  126. package/dist/migrations/0003_agent_telegram.sql +0 -40
  127. package/dist/migrations/0004_agent_mirror_mode.sql +0 -17
  128. package/dist/migrations/0005_group_topic_name_format.sql +0 -15
  129. package/dist/migrations/0006_telegram_acl.sql +0 -18
  130. package/dist/migrations/0007_mcp_servers.sql +0 -30
  131. package/dist/migrations/0008_seed_user_md.sql +0 -39
  132. package/dist/web/client/assets/MembersEditor-C6UpqDdV.js +0 -1
  133. package/dist/web/client/assets/SpawnTeamModal-BEkNCKXm.js +0 -1
  134. package/dist/web/client/assets/TemplatesTabs-Da7mg9FI.js +0 -1
  135. package/dist/web/client/assets/_id-BdKmo0gb.js +0 -1
  136. package/dist/web/client/assets/_id-LT6Ejjr0.js +0 -1
  137. package/dist/web/client/assets/_id-MR2XjWh0.js +0 -1
  138. package/dist/web/client/assets/_id-_6jIt0_-.js +0 -1
  139. package/dist/web/client/assets/agents-0arKbVYG.js +0 -1
  140. package/dist/web/client/assets/groups-BqTkhHes.js +0 -1
  141. package/dist/web/client/assets/inbox-ozoCXzr5.js +0 -1
  142. package/dist/web/client/assets/index-iayCEuU2.js +0 -12
  143. package/dist/web/client/assets/memory-D1GQjEvN.js +0 -1
  144. package/dist/web/client/assets/profile-groups-C2yJPTaE.js +0 -1
  145. package/dist/web/client/assets/profiles-BV7AAZjj.js +0 -1
  146. package/dist/web/client/assets/routes-DSHQLA7K.js +0 -1
  147. package/dist/web/client/assets/services-BbCJe1Du.js +0 -1
  148. package/dist/web/client/assets/skills-C6czKR5I.js +0 -1
  149. package/dist/web/client/assets/styles-C06axZZk.css +0 -2
  150. package/dist/web/client/assets/telegram-gE4j8gte.js +0 -1
  151. package/dist/web/client/assets/triggers-WljnfEfJ.js +0 -1
  152. package/dist/web/client/assets/welcome-Dn-zvmBE.js +0 -1
  153. package/dist/web/client/assets/wire-constants-BkT5-597.js +0 -1
  154. package/dist/web/server/assets/MembersEditor-BWQztvrX.js +0 -131
  155. package/dist/web/server/assets/SpawnTeamModal-dSN421k_.js +0 -107
  156. package/dist/web/server/assets/_id-BKev9H1p.js +0 -12
  157. package/dist/web/server/assets/_id-BNwlbWHP.js +0 -24
  158. package/dist/web/server/assets/_id-CRqqi8IE.js +0 -161
  159. package/dist/web/server/assets/_tanstack-start-manifest_v-DBlFH2gg.js +0 -178
  160. package/dist/web/server/assets/groups-CbSwND2r.js +0 -12
  161. package/dist/web/server/assets/groups-CeRRlZaZ.js +0 -150
  162. package/dist/web/server/assets/groups-pk4CYSuf.js +0 -21
  163. package/dist/web/server/assets/memory-CQaqWnyM.js +0 -284
  164. package/dist/web/server/assets/profile-groups-CiU06yN1.js +0 -28
  165. package/dist/web/server/assets/profile-groups-D21MYoLM.js +0 -208
  166. package/dist/web/server/assets/profile-groups-aoJleXHP.js +0 -12
@@ -0,0 +1,50 @@
1
+ import { Link, useRouterState } from "@tanstack/react-router";
2
+ import { jsx } from "react/jsx-runtime";
3
+ //#region src/components/TeamTabs.tsx
4
+ var TABS = [
5
+ {
6
+ suffix: "",
7
+ label: "overview",
8
+ exact: true
9
+ },
10
+ {
11
+ suffix: "/members",
12
+ label: "members"
13
+ },
14
+ {
15
+ suffix: "/policy",
16
+ label: "policy"
17
+ },
18
+ {
19
+ suffix: "/memory",
20
+ label: "memory"
21
+ },
22
+ {
23
+ suffix: "/context",
24
+ label: "context"
25
+ },
26
+ {
27
+ suffix: "/activity",
28
+ label: "activity"
29
+ }
30
+ ];
31
+ function TeamTabs({ teamId }) {
32
+ const pathname = useRouterState({ select: (state) => state.location.pathname });
33
+ const base = `/teams/${encodeURIComponent(teamId)}`;
34
+ return /* @__PURE__ */ jsx("nav", {
35
+ "aria-label": "Team sections",
36
+ className: "-mb-px mb-5 flex flex-wrap gap-1 border-b border-frost",
37
+ children: TABS.map((tab) => {
38
+ const href = `${base}${tab.suffix}`;
39
+ const active = "exact" in tab && tab.exact ? pathname === base || pathname === `${base}/` : pathname.startsWith(href);
40
+ return /* @__PURE__ */ jsx(Link, {
41
+ to: href,
42
+ "aria-current": active ? "page" : void 0,
43
+ className: `whitespace-nowrap border-b-2 px-3 py-2 text-sm font-medium ${active ? "border-sapphire text-sapphire" : "border-transparent text-mocha hover:text-sapphire"}`,
44
+ children: tab.label
45
+ }, tab.label);
46
+ })
47
+ });
48
+ }
49
+ //#endregion
50
+ export { TeamTabs as t };
@@ -7,13 +7,13 @@ function TemplatesTabs() {
7
7
  role: "tablist",
8
8
  className: "-mb-px mb-5 flex gap-1 border-b border-frost",
9
9
  children: [{
10
- to: "/profiles",
11
- label: "profiles",
12
- match: (p) => p.startsWith("/profiles")
10
+ to: "/templates/agents",
11
+ label: "agent templates",
12
+ match: (p) => p.startsWith("/templates/agents")
13
13
  }, {
14
- to: "/profile-groups",
15
- label: "profile groups",
16
- match: (p) => p.startsWith("/profile-groups")
14
+ to: "/templates/teams",
15
+ label: "team templates",
16
+ match: (p) => p.startsWith("/templates/teams")
17
17
  }].map((t) => {
18
18
  const active = t.match(pathname);
19
19
  return /* @__PURE__ */ jsx(Link, {
@@ -1,13 +1,14 @@
1
- import { t as Route } from "./_id-CnQflrRv.js";
1
+ import { t as Route } from "./_id-DdC9wpNN.js";
2
2
  import { t as Button } from "./Button-Dsnw22OF.js";
3
+ import { t as TeamTabs } from "./TeamTabs-BPxDBfqy.js";
3
4
  import { useState } from "react";
4
5
  import { useRouter } from "@tanstack/react-router";
5
6
  import { jsx, jsxs } from "react/jsx-runtime";
6
- //#region src/routes/groups/$id/index.tsx?tsr-split=component
7
- function GroupDetailPage() {
8
- const { group, members, profileGroups } = Route.useLoaderData();
7
+ //#region src/routes/teams/$id/index.tsx?tsr-split=component
8
+ function TeamDetailPage() {
9
+ const { team, members, profileGroups } = Route.useLoaderData();
9
10
  const router = useRouter();
10
- const [userMd, setUserMd] = useState(group.userMd);
11
+ const [userMd, setUserMd] = useState(team.userMd);
11
12
  const [busy, setBusy] = useState(false);
12
13
  const [err, setErr] = useState(null);
13
14
  const [savedAt, setSavedAt] = useState(null);
@@ -15,7 +16,7 @@ function GroupDetailPage() {
15
16
  setBusy(true);
16
17
  setErr(null);
17
18
  try {
18
- const res = await fetch(`/api/groups/${encodeURIComponent(group.id)}/user-md`, {
19
+ const res = await fetch(`/api/teams/${encodeURIComponent(team.id)}/user-md`, {
19
20
  method: "PUT",
20
21
  headers: { "content-type": "application/json" },
21
22
  body: JSON.stringify({ userMd })
@@ -38,13 +39,13 @@ function GroupDetailPage() {
38
39
  /* @__PURE__ */ jsxs("h1", {
39
40
  className: "font-serif text-3xl text-foreground",
40
41
  children: [
41
- group.name,
42
+ team.name,
42
43
  " ",
43
44
  /* @__PURE__ */ jsxs("span", {
44
45
  className: "text-muted-foreground text-base",
45
46
  children: [
46
47
  "(",
47
- group.id,
48
+ team.id,
48
49
  ")"
49
50
  ]
50
51
  })
@@ -55,7 +56,7 @@ function GroupDetailPage() {
55
56
  children: [
56
57
  /* @__PURE__ */ jsx("code", {
57
58
  className: "font-mono",
58
- children: group.path
59
+ children: team.path
59
60
  }),
60
61
  " · ",
61
62
  members.length,
@@ -65,12 +66,13 @@ function GroupDetailPage() {
65
66
  " ·",
66
67
  " ",
67
68
  /* @__PURE__ */ jsx("a", {
68
- href: `/groups/${encodeURIComponent(group.id)}/memory`,
69
+ href: `/teams/${encodeURIComponent(team.id)}/memory`,
69
70
  className: "text-primary underline",
70
71
  children: "shared memory →"
71
72
  })
72
73
  ]
73
74
  }),
75
+ /* @__PURE__ */ jsx(TeamTabs, { teamId: team.id }),
74
76
  /* @__PURE__ */ jsxs("section", {
75
77
  className: "rounded-lg border bg-card p-5 mb-6",
76
78
  children: [
@@ -87,7 +89,7 @@ function GroupDetailPage() {
87
89
  onChange: (e) => setUserMd(e.target.value),
88
90
  rows: 16,
89
91
  className: "w-full rounded-md border bg-background px-3 py-2 font-mono text-sm outline-none focus:ring-2 focus:ring-ring/30",
90
- placeholder: "What the agent should know about you in this group context…"
92
+ placeholder: "What the agent should know about you in this team context…"
91
93
  }),
92
94
  /* @__PURE__ */ jsxs("div", {
93
95
  className: "flex items-center gap-3 mt-3",
@@ -95,7 +97,7 @@ function GroupDetailPage() {
95
97
  /* @__PURE__ */ jsx(Button, {
96
98
  variant: "primary",
97
99
  onClick: save,
98
- disabled: busy || userMd === group.userMd,
100
+ disabled: busy || userMd === team.userMd,
99
101
  children: busy ? "saving…" : "save"
100
102
  }),
101
103
  /* @__PURE__ */ jsxs("span", {
@@ -115,12 +117,12 @@ function GroupDetailPage() {
115
117
  ]
116
118
  }),
117
119
  /* @__PURE__ */ jsx(TopicNameFormatCard, {
118
- group,
120
+ team,
119
121
  sampleAgent: members[0]?.name ?? "researcher",
120
122
  onSaved: () => router.invalidate()
121
123
  }),
122
124
  members.length === 0 && /* @__PURE__ */ jsx(SpawnFromTemplateCard, {
123
- groupId: group.id,
125
+ teamId: team.id,
124
126
  profileGroups,
125
127
  onSpawned: () => router.invalidate()
126
128
  }),
@@ -131,7 +133,7 @@ function GroupDetailPage() {
131
133
  children: "members"
132
134
  }), members.length === 0 ? /* @__PURE__ */ jsx("p", {
133
135
  className: "text-muted-foreground text-sm",
134
- children: "No agents in this group yet."
136
+ children: "No agents in this team yet."
135
137
  }) : /* @__PURE__ */ jsxs("table", {
136
138
  className: "w-full text-sm",
137
139
  children: [/* @__PURE__ */ jsx("thead", {
@@ -172,19 +174,19 @@ function GroupDetailPage() {
172
174
  ]
173
175
  });
174
176
  }
175
- function TopicNameFormatCard({ group, sampleAgent, onSaved }) {
176
- const [format, setFormat] = useState(group.telegramTopicNameFormat ?? "");
177
+ function TopicNameFormatCard({ team, sampleAgent, onSaved }) {
178
+ const [format, setFormat] = useState(team.telegramTopicNameFormat ?? "");
177
179
  const [busy, setBusy] = useState(false);
178
180
  const [err, setErr] = useState(null);
179
181
  const [savedAt, setSavedAt] = useState(null);
180
182
  const trimmed = format.trim();
181
- const preview = trimmed ? trimmed.replaceAll("{agent.name}", sampleAgent).replaceAll("{group.name}", group.name).replaceAll("{group.slug}", group.id) : group.id === "default" ? sampleAgent : `${group.id} › ${sampleAgent}`;
182
- const dirty = (group.telegramTopicNameFormat ?? "") !== format;
183
+ const preview = trimmed ? trimmed.replaceAll("{agent.name}", sampleAgent).replaceAll("{team.name}", team.name).replaceAll("{team.slug}", team.id) : team.id === "default" ? sampleAgent : `${team.id} › ${sampleAgent}`;
184
+ const dirty = (team.telegramTopicNameFormat ?? "") !== format;
183
185
  async function save(clear) {
184
186
  setBusy(true);
185
187
  setErr(null);
186
188
  try {
187
- const res = await fetch(`/api/groups/${encodeURIComponent(group.id)}/topic-format`, {
189
+ const res = await fetch(`/api/teams/${encodeURIComponent(team.id)}/topic-format`, {
188
190
  method: "PUT",
189
191
  headers: { "content-type": "application/json" },
190
192
  body: JSON.stringify({ format: clear ? null : format })
@@ -212,7 +214,7 @@ function TopicNameFormatCard({ group, sampleAgent, onSaved }) {
212
214
  /* @__PURE__ */ jsxs("p", {
213
215
  className: "text-muted-foreground text-sm mb-3",
214
216
  children: [
215
- "Template for this group's Telegram forum-topic titles. Leave empty for built-in naming. Tokens: ",
217
+ "Template for this team's Telegram forum-topic titles. Leave empty for built-in naming. Tokens: ",
216
218
  /* @__PURE__ */ jsx("code", {
217
219
  className: "font-mono",
218
220
  children: "{agent.name}"
@@ -220,12 +222,12 @@ function TopicNameFormatCard({ group, sampleAgent, onSaved }) {
220
222
  " ",
221
223
  /* @__PURE__ */ jsx("code", {
222
224
  className: "font-mono",
223
- children: "{group.name}"
225
+ children: "{team.name}"
224
226
  }),
225
227
  " ",
226
228
  /* @__PURE__ */ jsx("code", {
227
229
  className: "font-mono",
228
- children: "{group.slug}"
230
+ children: "{team.slug}"
229
231
  }),
230
232
  " — must include",
231
233
  " ",
@@ -239,7 +241,7 @@ function TopicNameFormatCard({ group, sampleAgent, onSaved }) {
239
241
  /* @__PURE__ */ jsx("input", {
240
242
  value: format,
241
243
  onChange: (e) => setFormat(e.target.value),
242
- placeholder: "{group.name} / {agent.name}",
244
+ placeholder: "{team.name} / {agent.name}",
243
245
  className: "w-full rounded-md border bg-background px-3 py-2 font-mono text-sm outline-none focus:ring-2 focus:ring-ring/30"
244
246
  }),
245
247
  /* @__PURE__ */ jsxs("p", {
@@ -258,7 +260,7 @@ function TopicNameFormatCard({ group, sampleAgent, onSaved }) {
258
260
  disabled: busy || !dirty || trimmed.length === 0,
259
261
  children: busy ? "saving…" : "save"
260
262
  }),
261
- group.telegramTopicNameFormat && /* @__PURE__ */ jsx(Button, {
263
+ team.telegramTopicNameFormat && /* @__PURE__ */ jsx(Button, {
262
264
  variant: "ghost",
263
265
  onClick: () => save(true),
264
266
  disabled: busy,
@@ -277,8 +279,8 @@ function TopicNameFormatCard({ group, sampleAgent, onSaved }) {
277
279
  ]
278
280
  });
279
281
  }
280
- function SpawnFromTemplateCard({ groupId, profileGroups, onSpawned }) {
281
- const eligible = profileGroups.filter((g) => g.memberCount > 0);
282
+ function SpawnFromTemplateCard({ teamId, profileGroups, onSpawned }) {
283
+ const eligible = profileGroups.filter((g) => g.slotCount > 0 && !g.deletedAt);
282
284
  const [selected, setSelected] = useState(eligible[0]?.id ?? "");
283
285
  const [busy, setBusy] = useState(false);
284
286
  const [err, setErr] = useState(null);
@@ -287,17 +289,25 @@ function SpawnFromTemplateCard({ groupId, profileGroups, onSpawned }) {
287
289
  setBusy(true);
288
290
  setErr(null);
289
291
  try {
290
- const res = await fetch(`/api/profile-groups/${encodeURIComponent(selected)}/spawn`, {
292
+ const template = eligible.find((item) => item.id === selected);
293
+ if (!template) throw new Error("Team template is unavailable.");
294
+ const policyResponse = await fetch(`/api/teams/${encodeURIComponent(teamId)}/policy`);
295
+ if (!policyResponse.ok) throw new Error("The current Team policy is unavailable.");
296
+ const current = await policyResponse.json();
297
+ const res = await fetch(`/api/team-templates/${encodeURIComponent(selected)}/spawn`, {
291
298
  method: "POST",
292
299
  headers: { "content-type": "application/json" },
293
- body: JSON.stringify({ groupSlug: groupId })
300
+ body: JSON.stringify({
301
+ templateExpectedRevision: template.currentRevision,
302
+ teamId,
303
+ teamExpectedRevision: current.teamPolicy.revision,
304
+ mode: "initialize"
305
+ })
294
306
  });
295
307
  if (!res.ok) {
296
308
  const e = await res.json().catch(() => ({}));
297
309
  throw new Error(e.error ?? `${res.status} ${res.statusText}`);
298
310
  }
299
- const result = await res.json();
300
- if (result.orphanAgentIds && result.orphanAgentIds.length > 0) alert(`Spawn completed with warnings: ${result.orphanAgentIds.length} orphan agent dir(s) left on disk.`);
301
311
  onSpawned();
302
312
  } catch (e) {
303
313
  setErr(e.message);
@@ -310,21 +320,21 @@ function SpawnFromTemplateCard({ groupId, profileGroups, onSpawned }) {
310
320
  children: [
311
321
  /* @__PURE__ */ jsx("h3", {
312
322
  className: "font-serif text-xl mb-1",
313
- children: "spawn a team into this group"
323
+ children: "spawn a team into this team"
314
324
  }),
315
325
  /* @__PURE__ */ jsx("p", {
316
326
  className: "text-muted-foreground text-sm mb-3",
317
- children: "This group is empty. Pick a profile group template to spawn its entire roster into it in one transactional call."
327
+ children: "This Team is empty. Pick a canonical Team template to initialize its roster and policy at the current reviewed Team and Team revisions."
318
328
  }),
319
329
  eligible.length === 0 ? /* @__PURE__ */ jsxs("p", {
320
330
  className: "text-muted-foreground text-sm",
321
331
  children: [
322
- "No profile groups with members yet. Build one on",
332
+ "No Team templates with slots yet. Build one on",
323
333
  " ",
324
334
  /* @__PURE__ */ jsx("a", {
325
- href: "/profile-groups",
335
+ href: "/templates/teams",
326
336
  className: "text-primary underline",
327
- children: "/profile-groups"
337
+ children: "Team templates"
328
338
  }),
329
339
  " ",
330
340
  "first."
@@ -341,9 +351,11 @@ function SpawnFromTemplateCard({ groupId, profileGroups, onSpawned }) {
341
351
  children: [
342
352
  g.name,
343
353
  " (",
344
- g.memberCount,
345
- " member",
346
- g.memberCount === 1 ? "" : "s",
354
+ g.slotCount,
355
+ " slot",
356
+ g.slotCount === 1 ? "" : "s",
357
+ ", r",
358
+ g.currentRevision,
347
359
  ")"
348
360
  ]
349
361
  }, g.id))
@@ -364,4 +376,4 @@ function SpawnFromTemplateCard({ groupId, profileGroups, onSpawned }) {
364
376
  });
365
377
  }
366
378
  //#endregion
367
- export { GroupDetailPage as component };
379
+ export { TeamDetailPage as component };
@@ -0,0 +1,11 @@
1
+ import { t as RecoveryState } from "./RecoveryState-B2SG-mrY.js";
2
+ import { jsx } from "react/jsx-runtime";
3
+ //#region src/routes/templates/teams/$id/index.tsx?tsr-split=errorComponent
4
+ var SplitErrorComponent = ({ error, reset }) => /* @__PURE__ */ jsx(RecoveryState, {
5
+ title: "Team template unavailable",
6
+ error,
7
+ reset,
8
+ fallbackHref: "/templates/teams"
9
+ });
10
+ //#endregion
11
+ export { SplitErrorComponent as errorComponent };
@@ -1,13 +1,14 @@
1
1
  import { t as createServerFn } from "../server.js";
2
2
  import { t as createSsrRpc } from "./createSsrRpc-ZBGxhl8t.js";
3
+ import "react";
3
4
  import { createFileRoute, lazyRouteComponent, redirect } from "@tanstack/react-router";
4
- //#region src/routes/profiles/$id.tsx
5
- var $$splitComponentImporter = () => import("./_id-DDixKEud.js");
6
- var fetchProfile = createServerFn({ method: "POST" }).inputValidator((d) => d).handler(createSsrRpc("280ae44073f538bf230afd3a1407fc41f9c78cd0cf71b6a06fb0cceff0872d1c"));
7
- var Route = createFileRoute("/profiles/$id")({
5
+ //#region src/routes/templates/agents/$id/index.tsx
6
+ var $$splitComponentImporter = () => import("./_id-CCHA0gdR.js");
7
+ var fetchProfile = createServerFn({ method: "POST" }).inputValidator((d) => d).handler(createSsrRpc("032d74b7d41c718191dbdde6b06ba44993340ce1154af1fa6723a6d4f7a7236e"));
8
+ var Route = createFileRoute("/templates/agents/$id/")({
8
9
  loader: async ({ params }) => {
9
10
  const data = await fetchProfile({ data: { id: params.id } });
10
- if (!data) throw redirect({ to: "/profiles" });
11
+ if (!data) throw redirect({ to: "/templates/agents" });
11
12
  return data;
12
13
  },
13
14
  component: lazyRouteComponent($$splitComponentImporter, "component")