clay-server 5.1.0-beta.1 → 5.1.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (231) hide show
  1. package/LICENSES/README.md +4 -0
  2. package/LICENSES/dicebear-avatars.md +16 -0
  3. package/bin/cli.js +9 -91
  4. package/lib/builtin-mates.js +7 -7
  5. package/lib/daemon-project-access.js +7 -1
  6. package/lib/daemon-settings.js +11 -0
  7. package/lib/daemon.js +10 -37
  8. package/lib/dicebear-avatar.js +62 -0
  9. package/lib/knowledge-db-service.js +175 -0
  10. package/lib/knowledge-db-validation.js +0 -0
  11. package/lib/knowledge-document-index.js +49 -0
  12. package/lib/knowledge-draft-store.js +56 -0
  13. package/lib/knowledge-file-store.js +199 -0
  14. package/lib/knowledge-markdown.js +128 -0
  15. package/lib/linear-store.js +35 -8
  16. package/lib/mate-identity-file.js +39 -0
  17. package/lib/mate-knowledge-mcp-server.js +29 -6
  18. package/lib/mate-knowledge-service.js +23 -2
  19. package/lib/mate-knowledge-sync.js +37 -22
  20. package/lib/mate-ready-creation.js +2 -1
  21. package/lib/mate-workspace-color.js +4 -0
  22. package/lib/mates-identity.js +4 -4
  23. package/lib/mates-prompts.js +4 -3
  24. package/lib/mates.js +30 -11
  25. package/lib/os-users.js +5 -16
  26. package/lib/project-connection.js +36 -9
  27. package/lib/project-debate-proposal.js +6 -0
  28. package/lib/project-debate-workspace.js +43 -0
  29. package/lib/project-debate.js +4 -2
  30. package/lib/project-filesystem.js +21 -39
  31. package/lib/project-knowledge.js +315 -136
  32. package/lib/project-mate-creation-proposal.js +1 -0
  33. package/lib/project-mate-interaction.js +7 -6
  34. package/lib/project-server-settings.js +31 -0
  35. package/lib/project-sessions.js +92 -182
  36. package/lib/project-user-knowledge.js +60 -0
  37. package/lib/project.js +62 -21
  38. package/lib/public/app.js +79 -71
  39. package/lib/public/clay-studio-wordmark-bold.svg +20 -0
  40. package/lib/public/css/clay-workspace.css +105 -0
  41. package/lib/public/css/debates-workbench.css +47 -0
  42. package/lib/public/css/home-debate-live.css +26 -0
  43. package/lib/public/css/home-hub.css +3 -1
  44. package/lib/public/css/home-mate-model-picker.css +15 -131
  45. package/lib/public/css/home-mate-settings.css +168 -16
  46. package/lib/public/css/icon-strip.css +249 -32
  47. package/lib/public/css/input.css +3 -1
  48. package/lib/public/css/mate-conversation.css +176 -0
  49. package/lib/public/css/mate-knowledge-workbench.css +118 -0
  50. package/lib/public/css/mate-workspace-color.css +16 -0
  51. package/lib/public/css/mates.css +28 -28
  52. package/lib/public/css/menus.css +3 -0
  53. package/lib/public/css/messages.css +1 -114
  54. package/lib/public/css/mobile-nav.css +16 -16
  55. package/lib/public/css/overlays.css +15 -0
  56. package/lib/public/css/project-logs.css +7 -0
  57. package/lib/public/css/project-mate-creation.css +105 -0
  58. package/lib/public/css/project-settings-modal.css +56 -0
  59. package/lib/public/css/right-workbench.css +3 -3
  60. package/lib/public/css/server-settings-system.css +125 -0
  61. package/lib/public/css/session-folders.css +80 -21
  62. package/lib/public/css/session-github.css +25 -16
  63. package/lib/public/css/settings-ui.css +247 -22
  64. package/lib/public/css/shared-browser.css +7 -3
  65. package/lib/public/css/sidebar.css +183 -107
  66. package/lib/public/css/title-bar.css +156 -1
  67. package/lib/public/css/worker-delegation.css +47 -0
  68. package/lib/public/css/worker-proposal.css +72 -150
  69. package/lib/public/css/you.css +74 -0
  70. package/lib/public/index.html +206 -548
  71. package/lib/public/modules/account-island.js +232 -0
  72. package/lib/public/modules/admin-settings-email.js +197 -0
  73. package/lib/public/modules/admin-settings-invitations.js +183 -0
  74. package/lib/public/modules/admin-settings-projects.js +198 -0
  75. package/lib/public/modules/admin-settings-ui.js +100 -0
  76. package/lib/public/modules/admin-settings-users.js +331 -0
  77. package/lib/public/modules/admin.js +19 -949
  78. package/lib/public/modules/app-cursors.js +19 -43
  79. package/lib/public/modules/app-debate-ui.js +4 -3
  80. package/lib/public/modules/app-dm.js +0 -2
  81. package/lib/public/modules/app-header.js +106 -0
  82. package/lib/public/modules/app-message-router.js +12 -3
  83. package/lib/public/modules/app-messages.js +47 -61
  84. package/lib/public/modules/app-notifications.js +4 -7
  85. package/lib/public/modules/app-projects.js +5 -38
  86. package/lib/public/modules/app-rate-limit.js +70 -12
  87. package/lib/public/modules/app-rendering.js +12 -13
  88. package/lib/public/modules/avatar.js +30 -9
  89. package/lib/public/modules/chat-render-runtime.js +16 -4
  90. package/lib/public/modules/command-palette.js +2 -15
  91. package/lib/public/modules/context-sources.js +27 -18
  92. package/lib/public/modules/cursor-sharing-preference.js +3 -3
  93. package/lib/public/modules/debate-controls.js +299 -0
  94. package/lib/public/modules/debate.js +2 -0
  95. package/lib/public/modules/debates-workbench.js +339 -0
  96. package/lib/public/modules/default-ai.js +88 -65
  97. package/lib/public/modules/header-tui-font.js +10 -20
  98. package/lib/public/modules/home-debate-controls.js +18 -289
  99. package/lib/public/modules/home-mate-avatar-editor.js +228 -0
  100. package/lib/public/modules/home-mate-color-picker.js +66 -0
  101. package/lib/public/modules/home-mate-creation.js +1 -1
  102. package/lib/public/modules/home-mate-instructions.js +90 -0
  103. package/lib/public/modules/home-mate-model-picker.js +80 -271
  104. package/lib/public/modules/home-mate-profile-editor.js +72 -0
  105. package/lib/public/modules/home-mate-settings.js +118 -125
  106. package/lib/public/modules/home-shell.js +3 -0
  107. package/lib/public/modules/home-surface-boot.js +1 -9
  108. package/lib/public/modules/icon-strip-tooltip.js +95 -0
  109. package/lib/public/modules/knowledge-db-edit-state.js +35 -0
  110. package/lib/public/modules/knowledge-db-workbench.js +234 -0
  111. package/lib/public/modules/knowledge-history-state.js +55 -0
  112. package/lib/public/modules/knowledge-markdown-editor.js +57 -0
  113. package/lib/public/modules/knowledge-preview-links.js +70 -0
  114. package/lib/public/modules/knowledge-workbench-shell.js +21 -0
  115. package/lib/public/modules/linear-settings.js +3 -2
  116. package/lib/public/modules/markdown.js +5 -6
  117. package/lib/public/modules/mate-knowledge-workbench-state.js +174 -0
  118. package/lib/public/modules/mate-knowledge-workbench.js +500 -0
  119. package/lib/public/modules/mate-knowledge.js +11 -3
  120. package/lib/public/modules/mate-management.js +54 -10
  121. package/lib/public/modules/mate-sidebar.js +11 -1
  122. package/lib/public/modules/mate-workspace-color.js +33 -0
  123. package/lib/public/modules/mention.js +5 -13
  124. package/lib/public/modules/notification-settings.js +81 -0
  125. package/lib/public/modules/notifications.js +44 -28
  126. package/lib/public/modules/personal-settings-dialog.js +51 -0
  127. package/lib/public/modules/profile.js +66 -24
  128. package/lib/public/modules/project-chat-identity.js +79 -0
  129. package/lib/public/modules/project-debate-planning-workspace.js +250 -0
  130. package/lib/public/modules/project-debate-workspace.js +185 -0
  131. package/lib/public/modules/project-header-identity.js +127 -0
  132. package/lib/public/modules/project-logs-render.js +9 -4
  133. package/lib/public/modules/project-mate-creation-workspace.js +414 -0
  134. package/lib/public/modules/project-mate-navigation.js +238 -0
  135. package/lib/public/modules/project-session-navigation.js +29 -0
  136. package/lib/public/modules/project-settings-environment.js +106 -0
  137. package/lib/public/modules/project-settings.js +72 -628
  138. package/lib/public/modules/project-switcher.js +6 -8
  139. package/lib/public/modules/projects-hub-view.js +5 -6
  140. package/lib/public/modules/projects-hub.js +2 -6
  141. package/lib/public/modules/qrcode.js +27 -8
  142. package/lib/public/modules/search-clay-chat.js +8 -11
  143. package/lib/public/modules/server-settings-controls.js +316 -0
  144. package/lib/public/modules/server-settings-environment.js +194 -0
  145. package/lib/public/modules/server-settings-navigation.js +39 -0
  146. package/lib/public/modules/server-settings-state.js +54 -0
  147. package/lib/public/modules/server-settings.js +116 -788
  148. package/lib/public/modules/server-storage-settings.js +84 -0
  149. package/lib/public/modules/session-activity-tooltip.js +12 -0
  150. package/lib/public/modules/session-create-form.js +86 -14
  151. package/lib/public/modules/session-create.js +50 -7
  152. package/lib/public/modules/session-github.js +2 -1
  153. package/lib/public/modules/session-list-visibility.js +41 -0
  154. package/lib/public/modules/session-presence-ui.js +3 -0
  155. package/lib/public/modules/session-title-marquee.js +51 -0
  156. package/lib/public/modules/settings-env-values.js +34 -0
  157. package/lib/public/modules/settings-select.js +121 -0
  158. package/lib/public/modules/shared-browser.js +22 -12
  159. package/lib/public/modules/sidebar-mates.js +3 -50
  160. package/lib/public/modules/sidebar-mobile.js +63 -60
  161. package/lib/public/modules/sidebar-projects.js +84 -97
  162. package/lib/public/modules/sidebar-session-folders-ui.js +2 -2
  163. package/lib/public/modules/sidebar-session-hierarchy.js +149 -70
  164. package/lib/public/modules/sidebar-sessions.js +49 -50
  165. package/lib/public/modules/sidebar.js +11 -13
  166. package/lib/public/modules/stt-picker.js +14 -5
  167. package/lib/public/modules/terminal-prefs.js +22 -0
  168. package/lib/public/modules/theme.js +88 -52
  169. package/lib/public/modules/thinking-lifecycle.js +7 -6
  170. package/lib/public/modules/tool-palette-order.js +4 -3
  171. package/lib/public/modules/tool-palette.js +13 -3
  172. package/lib/public/modules/tools.js +22 -22
  173. package/lib/public/modules/user-settings-account.js +318 -0
  174. package/lib/public/modules/user-settings-appearance.js +55 -0
  175. package/lib/public/modules/user-settings-editors.js +24 -0
  176. package/lib/public/modules/user-settings-integrations.js +104 -0
  177. package/lib/public/modules/user-settings-layout.js +80 -0
  178. package/lib/public/modules/user-settings-preferences.js +48 -0
  179. package/lib/public/modules/user-settings-profile.js +53 -0
  180. package/lib/public/modules/user-settings-themes.js +38 -0
  181. package/lib/public/modules/user-settings-voice.js +75 -0
  182. package/lib/public/modules/user-settings.js +53 -480
  183. package/lib/public/modules/worker-proposal.js +42 -8
  184. package/lib/public/modules/worker-runtime-picker.js +115 -0
  185. package/lib/public/modules/you-activity.js +121 -0
  186. package/lib/public/modules/you.js +251 -0
  187. package/lib/public/style.css +20 -8
  188. package/lib/public/vendor/codemirror/LICENSE +21 -0
  189. package/lib/public/vendor/codemirror/codemirror.css +344 -0
  190. package/lib/public/vendor/codemirror/codemirror.js +9884 -0
  191. package/lib/public/vendor/codemirror/continuelist.js +101 -0
  192. package/lib/public/vendor/codemirror/markdown.js +886 -0
  193. package/lib/public/vendor/codemirror/show-hint.css +37 -0
  194. package/lib/public/vendor/codemirror/show-hint.js +523 -0
  195. package/lib/sdk-bridge.js +15 -3
  196. package/lib/sdk-message-processor.js +16 -4
  197. package/lib/sdk-quota-snapshot.js +37 -0
  198. package/lib/server-admin.js +11 -0
  199. package/lib/server-appearance-settings.js +71 -0
  200. package/lib/server-home-chat-events.js +1 -1
  201. package/lib/server-home-chat.js +25 -3
  202. package/lib/server-home-debate-planning.js +4 -1
  203. package/lib/server-home-debates.js +2 -0
  204. package/lib/server-home-mate-creation.js +4 -1
  205. package/lib/server-linear.js +14 -8
  206. package/lib/server-mate-instructions.js +44 -0
  207. package/lib/server-mates.js +14 -4
  208. package/lib/server-notification-settings.js +67 -0
  209. package/lib/server-palette.js +1 -1
  210. package/lib/server-settings.js +69 -1
  211. package/lib/server-storage.js +57 -0
  212. package/lib/server-user-knowledge.js +119 -0
  213. package/lib/server.js +31 -3
  214. package/lib/session-visibility.js +7 -2
  215. package/lib/sessions.js +35 -10
  216. package/lib/startup-projects.js +40 -0
  217. package/lib/storage-native-walk.js +85 -0
  218. package/lib/storage-usage.js +144 -0
  219. package/lib/user-knowledge-service.js +167 -0
  220. package/lib/users-permissions.js +7 -0
  221. package/lib/users-preferences.js +0 -74
  222. package/lib/users-project-mate-filter-preferences.js +39 -0
  223. package/lib/users.js +6 -4
  224. package/lib/workspace-query-access.js +4 -1
  225. package/lib/ws-schema.js +52 -4
  226. package/lib/yoke/acp-process-manager.js +2 -2
  227. package/lib/yoke/adapters/codex.js +12 -52
  228. package/lib/yoke/codex-app-server.js +2 -2
  229. package/lib/yoke/codex-model-catalog.js +52 -0
  230. package/lib/yoke/codex-rate-limits.js +26 -0
  231. package/package.json +12 -3
@@ -6,6 +6,10 @@ Preexisting MIT-covered portions retain the grants and applicable copyright and
6
6
 
7
7
  Third-party components and assets retain their own licenses and notices. In particular, the bundled Source Serif 4 font remains under the [SIL Open Font License 1.1](../lib/public/fonts/source-serif-4/LICENSE.md).
8
8
 
9
+ The locally generated historical avatar styles retain their DiceBear and
10
+ original artist licenses and attributions, summarized in
11
+ [dicebear-avatars.md](dicebear-avatars.md).
12
+
9
13
  The Salt layout, control geometry, text decoration, color map and diagram chrome
10
14
  in `lib/salt-*.js` and `lib/assets/salt-colors.json` are adapted from PlantUML
11
15
  1.2026.8, copyright 2009–2025 Arnaud Roques, under
@@ -0,0 +1,16 @@
1
+ # DiceBear avatar notices
2
+
3
+ Clay locally generates its seven historical avatar choices with DiceBear 9.4.3.
4
+ The generator code is MIT-licensed, copyright Florian Körner. Each design keeps
5
+ its upstream license and attribution:
6
+
7
+ - Thumbs — DiceBear, CC0 1.0.
8
+ - Bottts — Pablo Stanley, free for personal and commercial use.
9
+ - Pixel Art — DiceBear, CC0 1.0.
10
+ - Adventurer — Lisa Wischofsky, CC BY 4.0.
11
+ - Avatar Illustration System (Micah) — Micah Lanier, CC BY 4.0.
12
+ - Fun Emoji Set — Davis Uche, CC BY 4.0.
13
+ - Bootstrap Icons — The Bootstrap Authors, MIT.
14
+
15
+ The complete notices and license links are distributed with their respective
16
+ `@dicebear/*` packages. Upstream: https://www.dicebear.com/
package/bin/cli.js CHANGED
@@ -37,6 +37,7 @@ var { generateAuthToken } = require("../lib/server");
37
37
  var { enableMultiUser, disableMultiUser, hasAdmin, isMultiUser, getSetupCode } = require("../lib/users");
38
38
  var clayStudioCert = require("../lib/clay-studio-cert");
39
39
  var cliWordmark = require("../lib/cli-wordmark");
40
+ var buildStartupProjects = require("../lib/startup-projects").buildStartupProjects;
40
41
 
41
42
  function openUrl(url) {
42
43
  try {
@@ -446,9 +447,6 @@ async function restartDaemonFromConfig() {
446
447
  var newConfig = Object.assign({}, lastConfig, {
447
448
  pid: null,
448
449
  port: targetPort,
449
- projects: (lastConfig.projects || []).filter(function (p) {
450
- return fs.existsSync(p.path);
451
- })
452
450
  });
453
451
 
454
452
  ensureConfigDir();
@@ -1445,56 +1443,15 @@ async function forkDaemon(mode, keepAwake, extraProjects, addCwd, wantOsUsers) {
1445
1443
  return;
1446
1444
  }
1447
1445
 
1448
- var allProjects = [];
1449
- var usedSlugs = [];
1450
-
1451
- // Load previous config to preserve per-project settings (visibility, allowedUsers)
1452
1446
  var prevConfig = loadConfig();
1453
- var prevProjectMap = {};
1454
- if (prevConfig && prevConfig.projects) {
1455
- for (var pi = 0; pi < prevConfig.projects.length; pi++) {
1456
- prevProjectMap[prevConfig.projects[pi].path] = prevConfig.projects[pi];
1457
- }
1458
- }
1459
-
1460
- // Only include cwd if explicitly requested
1447
+ var recentProjects = extraProjects || [];
1461
1448
  if (addCwd) {
1462
- var slug = generateSlug(cwd, []);
1463
- var cwdEntry = { path: cwd, slug: slug, addedAt: Date.now() };
1464
- // Restore title/icon from .clayrc if available
1465
- var cwdRc = loadClayrc();
1466
- var cwdRecent = cwdRc.recentProjects || [];
1467
- for (var cr = 0; cr < cwdRecent.length; cr++) {
1468
- if (cwdRecent[cr].path === cwd) {
1469
- if (cwdRecent[cr].title) cwdEntry.title = cwdRecent[cr].title;
1470
- if (cwdRecent[cr].icon) cwdEntry.icon = cwdRecent[cr].icon;
1471
- break;
1472
- }
1473
- }
1474
- // Restore project-level settings from previous config
1475
- if (prevProjectMap[cwd]) {
1476
- cwdEntry = Object.assign({}, prevProjectMap[cwd], cwdEntry);
1477
- }
1478
- allProjects.push(cwdEntry);
1479
- usedSlugs.push(slug);
1480
- }
1481
-
1482
- // Add restored projects (from ~/.clayrc)
1483
- if (extraProjects && extraProjects.length > 0) {
1484
- for (var ep = 0; ep < extraProjects.length; ep++) {
1485
- var rp = extraProjects[ep];
1486
- if (rp.path === cwd) continue; // skip if same as cwd
1487
- if (!fs.existsSync(rp.path)) continue; // skip missing directories
1488
- var rpSlug = generateSlug(rp.path, usedSlugs);
1489
- usedSlugs.push(rpSlug);
1490
- var rpEntry = { path: rp.path, slug: rpSlug, title: rp.title || undefined, icon: rp.icon || undefined, addedAt: rp.addedAt || Date.now() };
1491
- // Restore project-level settings from previous config
1492
- if (prevProjectMap[rp.path]) {
1493
- rpEntry = Object.assign({}, prevProjectMap[rp.path], rpEntry);
1494
- }
1495
- allProjects.push(rpEntry);
1496
- }
1449
+ var cwdRecent = (loadClayrc().recentProjects || []).filter(function (p) { return p.path === cwd; });
1450
+ recentProjects = cwdRecent.concat(recentProjects);
1497
1451
  }
1452
+ var allProjects = buildStartupProjects(prevConfig, recentProjects, {
1453
+ cwd: cwd, addCwd: addCwd, existsSync: fs.existsSync, generateSlug: generateSlug,
1454
+ });
1498
1455
 
1499
1456
  var config = Object.assign({}, prevConfig || {}, {
1500
1457
  pid: null,
@@ -1629,49 +1586,10 @@ async function devMode(mode, keepAwake, existingPinHash, wantOsUsers) {
1629
1586
  return;
1630
1587
  }
1631
1588
 
1632
- var slug = generateSlug(cwd, []);
1633
- var cwdDevEntry = { path: cwd, slug: slug, addedAt: Date.now() };
1634
-
1635
- // Load previous config to preserve per-project settings (visibility, allowedUsers)
1636
1589
  var prevDevConfig = loadConfig();
1637
- var prevDevProjectMap = {};
1638
- if (prevDevConfig && prevDevConfig.projects) {
1639
- for (var pdi = 0; pdi < prevDevConfig.projects.length; pdi++) {
1640
- prevDevProjectMap[prevDevConfig.projects[pdi].path] = prevDevConfig.projects[pdi];
1641
- }
1642
- }
1643
-
1644
- // Restore previous projects
1645
- var rc = loadClayrc();
1646
- var restorable = (rc.recentProjects || []).filter(function (p) {
1647
- return p.path !== cwd && fs.existsSync(p.path);
1590
+ var allProjects = buildStartupProjects(prevDevConfig, loadClayrc().recentProjects || [], {
1591
+ cwd: cwd, addCwd: true, existsSync: fs.existsSync, generateSlug: generateSlug,
1648
1592
  });
1649
- // Restore title/icon for cwd from .clayrc
1650
- var rcAll = rc.recentProjects || [];
1651
- for (var ci = 0; ci < rcAll.length; ci++) {
1652
- if (rcAll[ci].path === cwd) {
1653
- if (rcAll[ci].title) cwdDevEntry.title = rcAll[ci].title;
1654
- if (rcAll[ci].icon) cwdDevEntry.icon = rcAll[ci].icon;
1655
- break;
1656
- }
1657
- }
1658
- // Restore access settings for cwd from previous config
1659
- if (prevDevProjectMap[cwd]) {
1660
- cwdDevEntry = Object.assign({}, prevDevProjectMap[cwd], cwdDevEntry);
1661
- }
1662
- var allProjects = [cwdDevEntry];
1663
- var usedSlugs = [slug];
1664
- for (var ri = 0; ri < restorable.length; ri++) {
1665
- var rp = restorable[ri];
1666
- var rpSlug = generateSlug(rp.path, usedSlugs);
1667
- usedSlugs.push(rpSlug);
1668
- var rpDevEntry = { path: rp.path, slug: rpSlug, title: rp.title || undefined, icon: rp.icon || undefined, addedAt: rp.addedAt || Date.now() };
1669
- // Restore project-level settings from previous config
1670
- if (prevDevProjectMap[rp.path]) {
1671
- rpDevEntry = Object.assign({}, prevDevProjectMap[rp.path], rpDevEntry);
1672
- }
1673
- allProjects.push(rpDevEntry);
1674
- }
1675
1593
 
1676
1594
  var config = Object.assign({}, prevDevConfig || {}, {
1677
1595
  pid: null,
@@ -156,7 +156,7 @@ var BUILTIN_MATES = [
156
156
  ];
157
157
 
158
158
  // ---------------------------------------------------------------------------
159
- // ALLY CLAUDE.md template
159
+ // ALLY AGENTS.md template
160
160
  // ---------------------------------------------------------------------------
161
161
 
162
162
  var ALLY_TEMPLATE =
@@ -245,7 +245,7 @@ var ALLY_TEMPLATE =
245
245
  "- Do not promote transient information or emotional states.\n";
246
246
 
247
247
  // ---------------------------------------------------------------------------
248
- // CLAY CLAUDE.md template (host agent — the app itself answers)
248
+ // CLAY AGENTS.md template (host agent — the app itself answers)
249
249
  // ---------------------------------------------------------------------------
250
250
 
251
251
  var CLAY_TEMPLATE =
@@ -321,7 +321,7 @@ var CLAY_TEMPLATE =
321
321
  "After that, jump straight into search. No more meta-conversation.\n";
322
322
 
323
323
  // ---------------------------------------------------------------------------
324
- // ARCH CLAUDE.md template
324
+ // ARCH AGENTS.md template
325
325
  // ---------------------------------------------------------------------------
326
326
 
327
327
  var ARCH_TEMPLATE =
@@ -392,7 +392,7 @@ var ARCH_TEMPLATE =
392
392
  "If nothing is there, work without it and learn through the conversation.\n";
393
393
 
394
394
  // ---------------------------------------------------------------------------
395
- // RUSH CLAUDE.md template
395
+ // RUSH AGENTS.md template
396
396
  // ---------------------------------------------------------------------------
397
397
 
398
398
  var RUSH_TEMPLATE =
@@ -459,7 +459,7 @@ var RUSH_TEMPLATE =
459
459
  "and deadlines. Use what is available. If nothing is there, work without it.\n";
460
460
 
461
461
  // ---------------------------------------------------------------------------
462
- // WARD CLAUDE.md template
462
+ // WARD AGENTS.md template
463
463
  // ---------------------------------------------------------------------------
464
464
 
465
465
  var WARD_TEMPLATE =
@@ -527,7 +527,7 @@ var WARD_TEMPLATE =
527
527
  "tech stack, and known risk areas. Use what is available. If nothing is there, work without it.\n";
528
528
 
529
529
  // ---------------------------------------------------------------------------
530
- // PIXEL CLAUDE.md template
530
+ // PIXEL AGENTS.md template
531
531
  // ---------------------------------------------------------------------------
532
532
 
533
533
  var PIXEL_TEMPLATE =
@@ -599,7 +599,7 @@ var PIXEL_TEMPLATE =
599
599
  "target audience, and UX decisions. Use what is available. If nothing is there, work without it.\n";
600
600
 
601
601
  // ---------------------------------------------------------------------------
602
- // BUZZ CLAUDE.md template
602
+ // BUZZ AGENTS.md template
603
603
  // ---------------------------------------------------------------------------
604
604
 
605
605
  var BUZZ_TEMPLATE =
@@ -32,7 +32,11 @@ function getProjectAccess(config, slug, osUsers) {
32
32
  var project = findProject(config, parentSlug || slug);
33
33
  if (!project) return { error: "Project not found" };
34
34
 
35
- var isMateProject = project.slug.indexOf("mate-") === 0;
35
+ var isMateProject = project.isMate === true || project.slug.indexOf("mate-") === 0;
36
+ if (isMateProject) {
37
+ return { slug: slug, isMate: true, visibility: "private", ownerId: project.ownerId || null,
38
+ allowedUsers: [], sessionVisibilityDefault: "private", isWorktree: !!parentSlug };
39
+ }
36
40
  var visibility = isMateProject ? "private" : (project.visibility || (osUsers ? "private" : "public"));
37
41
  var parentAllowedUsers = uniqueUsers(project.allowedUsers);
38
42
  if (!parentSlug) {
@@ -72,6 +76,7 @@ function setAllowedUsers(config, slug, allowedUsers) {
72
76
  var parentSlug = parentSlugFor(slug);
73
77
  var project = findProject(config, parentSlug || slug);
74
78
  if (!project) return { error: "Project not found" };
79
+ if (project.slug.indexOf("mate-") === 0 || project.isMate) return { error: "Clay and Mates cannot be shared." };
75
80
  var clean = uniqueUsers(allowedUsers);
76
81
  if (!parentSlug) {
77
82
  project.allowedUsers = clean;
@@ -92,6 +97,7 @@ function setSessionVisibilityDefault(config, slug, visibility) {
92
97
  if (parentSlugFor(slug)) return { error: "Worktrees inherit this setting from their parent project." };
93
98
  var project = findProject(config, slug);
94
99
  if (!project) return { error: "Project not found" };
100
+ if (project.slug.indexOf("mate-") === 0 || project.isMate) return { error: "Clay and Mates are always private." };
95
101
  if (visibility === "shared") project.sessionVisibilityDefault = "shared";
96
102
  else delete project.sessionVisibilityDefault;
97
103
  return { ok: true, visibility: visibility };
@@ -0,0 +1,11 @@
1
+ // Persist before publishing a setting to live daemon state.
2
+ function saveDaemonSetting(config, key, value, saveConfig) {
3
+ var overrides = {}; overrides[key] = value;
4
+ var next = Object.assign({}, config, overrides);
5
+ if (value === undefined) delete next[key];
6
+ saveConfig(next);
7
+ if (value === undefined) delete config[key];
8
+ Object.assign(config, next);
9
+ return next;
10
+ }
11
+ module.exports = { saveDaemonSetting: saveDaemonSetting };
package/lib/daemon.js CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env node
2
+ var saveDaemonSetting = require("./daemon-settings").saveDaemonSetting;
2
3
 
3
4
  // --- Node version check ---
4
5
  var nodeMajor = parseInt(process.versions.node.split(".")[0], 10);
@@ -72,9 +73,7 @@ if (projectLogContext.initializeProjectKnowledge(config)) {
72
73
  }
73
74
 
74
75
  // --- OS users mode: check required system dependencies ---
75
- // Supplementary-group inheritance (issue #367): default on so sessions behave
76
- // like a normal login; operators can disable via config / the settings toggle.
77
- osUsersMod.setInheritGroups(config.inheritGroups !== false);
76
+ // User-switched processes inherit the account groups, like a normal login.
78
77
  if (config.osUsers) {
79
78
  var checkExec = require("child_process").execFileSync;
80
79
  var missing = [];
@@ -86,11 +85,7 @@ if (config.osUsers) {
86
85
  console.error("[daemon] Install with: sudo apt install " + missing.map(function (m) { return m.split(" ")[0]; }).join(" "));
87
86
  process.exit(78); // EX_CONFIG
88
87
  }
89
- if (config.inheritGroups !== false) {
90
- console.log("[daemon] Sessions inherit each user's supplementary groups (docker, etc.); disable in Settings > User Groups.");
91
- } else {
92
- console.log("[daemon] Sessions run with primary group only (supplementary groups dropped); enable in Settings > User Groups.");
93
- }
88
+ console.log("[daemon] Sessions inherit each user's supplementary groups when setpriv is available.");
94
89
  }
95
90
 
96
91
  // --- TLS ---
@@ -565,6 +560,7 @@ var relay = createServer({
565
560
  return result;
566
561
  },
567
562
  onProjectOwnerChanged: function (slug, ownerId) {
563
+ if (slug.indexOf("mate-") === 0) return {error:"Mate ownership cannot be transferred."};
568
564
  console.log("[daemon] onProjectOwnerChanged:", slug, "→", ownerId);
569
565
  var oldOwnerId = null;
570
566
  var projectIdx = -1;
@@ -636,12 +632,7 @@ var relay = createServer({
636
632
  return { envrc: config.sharedEnv || "" };
637
633
  },
638
634
  onSetSharedEnv: function (envrc) {
639
- if (envrc) {
640
- config.sharedEnv = envrc;
641
- } else {
642
- delete config.sharedEnv;
643
- }
644
- saveConfig(config);
635
+ saveDaemonSetting(config, "sharedEnv", envrc || undefined, saveConfig);
645
636
  return { ok: true };
646
637
  },
647
638
  onGetServerDefaultEffort: function () {
@@ -811,7 +802,6 @@ var relay = createServer({
811
802
  keepAwake: !!config.keepAwake,
812
803
  autoContinueOnRateLimit: !!config.autoContinueOnRateLimit,
813
804
  osUsers: !!config.osUsers,
814
- inheritGroups: config.inheritGroups !== false,
815
805
  chatLayout: config.chatLayout || "channel",
816
806
  matesEnabled: config.matesEnabled === true,
817
807
  capsulesEnabled: config.capsulesEnabled === true,
@@ -826,25 +816,18 @@ var relay = createServer({
826
816
  onSetImageRetention: function (days) {
827
817
  var d = parseInt(days, 10);
828
818
  if (isNaN(d) || d < 0) d = 7;
829
- config.imageRetentionDays = d;
830
- saveConfig(config);
819
+ saveDaemonSetting(config, "imageRetentionDays", d, saveConfig);
831
820
  console.log("[daemon] Image retention:", d === 0 ? "forever" : d + " days");
832
821
  return { ok: true, days: d };
833
822
  },
834
823
  onSetUpdateChannel: function (channel) {
835
- config.updateChannel = channel === "beta" ? "beta" : "stable";
836
- saveConfig(config);
824
+ saveDaemonSetting(config, "updateChannel", channel === "beta" ? "beta" : "stable", saveConfig);
837
825
  console.log("[daemon] Update channel:", config.updateChannel, "(web)");
838
826
  return { ok: true, updateChannel: config.updateChannel };
839
827
  },
840
828
  onSetPin: function (pin) {
841
- if (pin) {
842
- config.pinHash = generateAuthToken(pin);
843
- } else {
844
- config.pinHash = null;
845
- }
829
+ saveDaemonSetting(config, "pinHash", pin ? generateAuthToken(pin) : null, saveConfig);
846
830
  relay.setAuthToken(config.pinHash);
847
- saveConfig(config);
848
831
  console.log("[daemon] PIN", pin ? "set" : "removed", "(web)");
849
832
  return { ok: true, pinEnabled: !!config.pinHash };
850
833
  },
@@ -920,8 +903,7 @@ var relay = createServer({
920
903
  },
921
904
  onSetKeepAwake: function (value) {
922
905
  var want = !!value;
923
- config.keepAwake = want;
924
- saveConfig(config);
906
+ saveDaemonSetting(config, "keepAwake", want, saveConfig);
925
907
  if (want && !caffeinateProc && process.platform === "darwin") {
926
908
  try {
927
909
  var { spawn: spawnCaff } = require("child_process");
@@ -935,16 +917,6 @@ var relay = createServer({
935
917
  console.log("[daemon] Keep awake:", want, "(web)");
936
918
  return { ok: true, keepAwake: want };
937
919
  },
938
- onSetInheritGroups: function (value) {
939
- var want = !!value;
940
- config.inheritGroups = want;
941
- saveConfig(config);
942
- // Apply live so subsequent session/terminal spawns pick it up without a
943
- // daemon restart; already-running sessions keep their current groups.
944
- osUsersMod.setInheritGroups(want);
945
- console.log("[daemon] Inherit supplementary groups:", want, "(web)");
946
- return { ok: true, inheritGroups: want };
947
- },
948
920
  onShutdown: function () {
949
921
  console.log("[daemon] Shutdown requested via web UI");
950
922
  gracefulShutdown();
@@ -954,6 +926,7 @@ var relay = createServer({
954
926
  spawnAndRestart();
955
927
  },
956
928
  onSetProjectVisibility: function (slug, visibility) {
929
+ if (slug.indexOf("mate-") === 0) return {error:"Mates cannot be shared."};
957
930
  for (var i = 0; i < config.projects.length; i++) {
958
931
  if (config.projects[i].slug === slug) {
959
932
  var prevVisibility = config.projects[i].visibility || "public";
@@ -0,0 +1,62 @@
1
+ var STYLE_PACKAGES = {
2
+ thumbs: "@dicebear/thumbs",
3
+ bottts: "@dicebear/bottts",
4
+ "pixel-art": "@dicebear/pixel-art",
5
+ adventurer: "@dicebear/adventurer",
6
+ micah: "@dicebear/micah",
7
+ "fun-emoji": "@dicebear/fun-emoji",
8
+ icons: "@dicebear/icons",
9
+ };
10
+
11
+ var corePromise = null;
12
+ var stylePromises = Object.create(null);
13
+ var avatarCache = new Map();
14
+
15
+ function normalizeRequest(style, seed, size) {
16
+ if (!Object.prototype.hasOwnProperty.call(STYLE_PACKAGES, style)) {
17
+ throw new Error("Unknown avatar style");
18
+ }
19
+ var normalizedSeed = typeof seed === "string" ? seed.substring(0, 80) : "";
20
+ if (!normalizedSeed) normalizedSeed = "anonymous";
21
+ var normalizedSize = Number(size);
22
+ if (!Number.isInteger(normalizedSize) || normalizedSize < 16 || normalizedSize > 256) normalizedSize = 64;
23
+ return { style: style, seed: normalizedSeed, size: normalizedSize };
24
+ }
25
+
26
+ function loadCore() {
27
+ if (!corePromise) corePromise = import("@dicebear/core");
28
+ return corePromise;
29
+ }
30
+
31
+ function loadStyle(style) {
32
+ if (!stylePromises[style]) stylePromises[style] = import(STYLE_PACKAGES[style]);
33
+ return stylePromises[style];
34
+ }
35
+
36
+ function renderAvatar(style, seed, size) {
37
+ var request = normalizeRequest(style, seed, size);
38
+ var cacheKey = [request.style, request.seed, request.size].join("|");
39
+ if (avatarCache.has(cacheKey)) return Promise.resolve(avatarCache.get(cacheKey));
40
+ return Promise.all([loadCore(), loadStyle(request.style)]).then(function (modules) {
41
+ var createAvatar = modules[0].createAvatar;
42
+ var styleDefinition = modules[1];
43
+ var svg = createAvatar(styleDefinition, {
44
+ seed: [request.seed],
45
+ size: request.size,
46
+ }).toString();
47
+ if (avatarCache.size >= 512) avatarCache.delete(avatarCache.keys().next().value);
48
+ avatarCache.set(cacheKey, svg);
49
+ return svg;
50
+ });
51
+ }
52
+
53
+ function isSupportedStyle(style) {
54
+ return Object.prototype.hasOwnProperty.call(STYLE_PACKAGES, style);
55
+ }
56
+
57
+ module.exports = {
58
+ isSupportedStyle: isSupportedStyle,
59
+ normalizeRequest: normalizeRequest,
60
+ renderAvatar: renderAvatar,
61
+ styles: Object.keys(STYLE_PACKAGES),
62
+ };