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.
- package/LICENSES/README.md +4 -0
- package/LICENSES/dicebear-avatars.md +16 -0
- package/bin/cli.js +9 -91
- package/lib/builtin-mates.js +7 -7
- package/lib/daemon-project-access.js +7 -1
- package/lib/daemon-settings.js +11 -0
- package/lib/daemon.js +10 -37
- package/lib/dicebear-avatar.js +62 -0
- package/lib/knowledge-db-service.js +175 -0
- package/lib/knowledge-db-validation.js +0 -0
- package/lib/knowledge-document-index.js +49 -0
- package/lib/knowledge-draft-store.js +56 -0
- package/lib/knowledge-file-store.js +199 -0
- package/lib/knowledge-markdown.js +128 -0
- package/lib/linear-store.js +35 -8
- package/lib/mate-identity-file.js +39 -0
- package/lib/mate-knowledge-mcp-server.js +29 -6
- package/lib/mate-knowledge-service.js +23 -2
- package/lib/mate-knowledge-sync.js +37 -22
- package/lib/mate-ready-creation.js +2 -1
- package/lib/mate-workspace-color.js +4 -0
- package/lib/mates-identity.js +4 -4
- package/lib/mates-prompts.js +4 -3
- package/lib/mates.js +30 -11
- package/lib/os-users.js +5 -16
- package/lib/project-connection.js +36 -9
- package/lib/project-debate-proposal.js +6 -0
- package/lib/project-debate-workspace.js +43 -0
- package/lib/project-debate.js +4 -2
- package/lib/project-filesystem.js +21 -39
- package/lib/project-knowledge.js +315 -136
- package/lib/project-mate-creation-proposal.js +1 -0
- package/lib/project-mate-interaction.js +7 -6
- package/lib/project-server-settings.js +31 -0
- package/lib/project-sessions.js +92 -182
- package/lib/project-user-knowledge.js +60 -0
- package/lib/project.js +62 -21
- package/lib/public/app.js +79 -71
- package/lib/public/clay-studio-wordmark-bold.svg +20 -0
- package/lib/public/css/clay-workspace.css +105 -0
- package/lib/public/css/debates-workbench.css +47 -0
- package/lib/public/css/home-debate-live.css +26 -0
- package/lib/public/css/home-hub.css +3 -1
- package/lib/public/css/home-mate-model-picker.css +15 -131
- package/lib/public/css/home-mate-settings.css +168 -16
- package/lib/public/css/icon-strip.css +249 -32
- package/lib/public/css/input.css +3 -1
- package/lib/public/css/mate-conversation.css +176 -0
- package/lib/public/css/mate-knowledge-workbench.css +118 -0
- package/lib/public/css/mate-workspace-color.css +16 -0
- package/lib/public/css/mates.css +28 -28
- package/lib/public/css/menus.css +3 -0
- package/lib/public/css/messages.css +1 -114
- package/lib/public/css/mobile-nav.css +16 -16
- package/lib/public/css/overlays.css +15 -0
- package/lib/public/css/project-logs.css +7 -0
- package/lib/public/css/project-mate-creation.css +105 -0
- package/lib/public/css/project-settings-modal.css +56 -0
- package/lib/public/css/right-workbench.css +3 -3
- package/lib/public/css/server-settings-system.css +125 -0
- package/lib/public/css/session-folders.css +80 -21
- package/lib/public/css/session-github.css +25 -16
- package/lib/public/css/settings-ui.css +247 -22
- package/lib/public/css/shared-browser.css +7 -3
- package/lib/public/css/sidebar.css +183 -107
- package/lib/public/css/title-bar.css +156 -1
- package/lib/public/css/worker-delegation.css +47 -0
- package/lib/public/css/worker-proposal.css +72 -150
- package/lib/public/css/you.css +74 -0
- package/lib/public/index.html +206 -548
- package/lib/public/modules/account-island.js +232 -0
- package/lib/public/modules/admin-settings-email.js +197 -0
- package/lib/public/modules/admin-settings-invitations.js +183 -0
- package/lib/public/modules/admin-settings-projects.js +198 -0
- package/lib/public/modules/admin-settings-ui.js +100 -0
- package/lib/public/modules/admin-settings-users.js +331 -0
- package/lib/public/modules/admin.js +19 -949
- package/lib/public/modules/app-cursors.js +19 -43
- package/lib/public/modules/app-debate-ui.js +4 -3
- package/lib/public/modules/app-dm.js +0 -2
- package/lib/public/modules/app-header.js +106 -0
- package/lib/public/modules/app-message-router.js +12 -3
- package/lib/public/modules/app-messages.js +47 -61
- package/lib/public/modules/app-notifications.js +4 -7
- package/lib/public/modules/app-projects.js +5 -38
- package/lib/public/modules/app-rate-limit.js +70 -12
- package/lib/public/modules/app-rendering.js +12 -13
- package/lib/public/modules/avatar.js +30 -9
- package/lib/public/modules/chat-render-runtime.js +16 -4
- package/lib/public/modules/command-palette.js +2 -15
- package/lib/public/modules/context-sources.js +27 -18
- package/lib/public/modules/cursor-sharing-preference.js +3 -3
- package/lib/public/modules/debate-controls.js +299 -0
- package/lib/public/modules/debate.js +2 -0
- package/lib/public/modules/debates-workbench.js +339 -0
- package/lib/public/modules/default-ai.js +88 -65
- package/lib/public/modules/header-tui-font.js +10 -20
- package/lib/public/modules/home-debate-controls.js +18 -289
- package/lib/public/modules/home-mate-avatar-editor.js +228 -0
- package/lib/public/modules/home-mate-color-picker.js +66 -0
- package/lib/public/modules/home-mate-creation.js +1 -1
- package/lib/public/modules/home-mate-instructions.js +90 -0
- package/lib/public/modules/home-mate-model-picker.js +80 -271
- package/lib/public/modules/home-mate-profile-editor.js +72 -0
- package/lib/public/modules/home-mate-settings.js +118 -125
- package/lib/public/modules/home-shell.js +3 -0
- package/lib/public/modules/home-surface-boot.js +1 -9
- package/lib/public/modules/icon-strip-tooltip.js +95 -0
- package/lib/public/modules/knowledge-db-edit-state.js +35 -0
- package/lib/public/modules/knowledge-db-workbench.js +234 -0
- package/lib/public/modules/knowledge-history-state.js +55 -0
- package/lib/public/modules/knowledge-markdown-editor.js +57 -0
- package/lib/public/modules/knowledge-preview-links.js +70 -0
- package/lib/public/modules/knowledge-workbench-shell.js +21 -0
- package/lib/public/modules/linear-settings.js +3 -2
- package/lib/public/modules/markdown.js +5 -6
- package/lib/public/modules/mate-knowledge-workbench-state.js +174 -0
- package/lib/public/modules/mate-knowledge-workbench.js +500 -0
- package/lib/public/modules/mate-knowledge.js +11 -3
- package/lib/public/modules/mate-management.js +54 -10
- package/lib/public/modules/mate-sidebar.js +11 -1
- package/lib/public/modules/mate-workspace-color.js +33 -0
- package/lib/public/modules/mention.js +5 -13
- package/lib/public/modules/notification-settings.js +81 -0
- package/lib/public/modules/notifications.js +44 -28
- package/lib/public/modules/personal-settings-dialog.js +51 -0
- package/lib/public/modules/profile.js +66 -24
- package/lib/public/modules/project-chat-identity.js +79 -0
- package/lib/public/modules/project-debate-planning-workspace.js +250 -0
- package/lib/public/modules/project-debate-workspace.js +185 -0
- package/lib/public/modules/project-header-identity.js +127 -0
- package/lib/public/modules/project-logs-render.js +9 -4
- package/lib/public/modules/project-mate-creation-workspace.js +414 -0
- package/lib/public/modules/project-mate-navigation.js +238 -0
- package/lib/public/modules/project-session-navigation.js +29 -0
- package/lib/public/modules/project-settings-environment.js +106 -0
- package/lib/public/modules/project-settings.js +72 -628
- package/lib/public/modules/project-switcher.js +6 -8
- package/lib/public/modules/projects-hub-view.js +5 -6
- package/lib/public/modules/projects-hub.js +2 -6
- package/lib/public/modules/qrcode.js +27 -8
- package/lib/public/modules/search-clay-chat.js +8 -11
- package/lib/public/modules/server-settings-controls.js +316 -0
- package/lib/public/modules/server-settings-environment.js +194 -0
- package/lib/public/modules/server-settings-navigation.js +39 -0
- package/lib/public/modules/server-settings-state.js +54 -0
- package/lib/public/modules/server-settings.js +116 -788
- package/lib/public/modules/server-storage-settings.js +84 -0
- package/lib/public/modules/session-activity-tooltip.js +12 -0
- package/lib/public/modules/session-create-form.js +86 -14
- package/lib/public/modules/session-create.js +50 -7
- package/lib/public/modules/session-github.js +2 -1
- package/lib/public/modules/session-list-visibility.js +41 -0
- package/lib/public/modules/session-presence-ui.js +3 -0
- package/lib/public/modules/session-title-marquee.js +51 -0
- package/lib/public/modules/settings-env-values.js +34 -0
- package/lib/public/modules/settings-select.js +121 -0
- package/lib/public/modules/shared-browser.js +22 -12
- package/lib/public/modules/sidebar-mates.js +3 -50
- package/lib/public/modules/sidebar-mobile.js +63 -60
- package/lib/public/modules/sidebar-projects.js +84 -97
- package/lib/public/modules/sidebar-session-folders-ui.js +2 -2
- package/lib/public/modules/sidebar-session-hierarchy.js +149 -70
- package/lib/public/modules/sidebar-sessions.js +49 -50
- package/lib/public/modules/sidebar.js +11 -13
- package/lib/public/modules/stt-picker.js +14 -5
- package/lib/public/modules/terminal-prefs.js +22 -0
- package/lib/public/modules/theme.js +88 -52
- package/lib/public/modules/thinking-lifecycle.js +7 -6
- package/lib/public/modules/tool-palette-order.js +4 -3
- package/lib/public/modules/tool-palette.js +13 -3
- package/lib/public/modules/tools.js +22 -22
- package/lib/public/modules/user-settings-account.js +318 -0
- package/lib/public/modules/user-settings-appearance.js +55 -0
- package/lib/public/modules/user-settings-editors.js +24 -0
- package/lib/public/modules/user-settings-integrations.js +104 -0
- package/lib/public/modules/user-settings-layout.js +80 -0
- package/lib/public/modules/user-settings-preferences.js +48 -0
- package/lib/public/modules/user-settings-profile.js +53 -0
- package/lib/public/modules/user-settings-themes.js +38 -0
- package/lib/public/modules/user-settings-voice.js +75 -0
- package/lib/public/modules/user-settings.js +53 -480
- package/lib/public/modules/worker-proposal.js +42 -8
- package/lib/public/modules/worker-runtime-picker.js +115 -0
- package/lib/public/modules/you-activity.js +121 -0
- package/lib/public/modules/you.js +251 -0
- package/lib/public/style.css +20 -8
- package/lib/public/vendor/codemirror/LICENSE +21 -0
- package/lib/public/vendor/codemirror/codemirror.css +344 -0
- package/lib/public/vendor/codemirror/codemirror.js +9884 -0
- package/lib/public/vendor/codemirror/continuelist.js +101 -0
- package/lib/public/vendor/codemirror/markdown.js +886 -0
- package/lib/public/vendor/codemirror/show-hint.css +37 -0
- package/lib/public/vendor/codemirror/show-hint.js +523 -0
- package/lib/sdk-bridge.js +15 -3
- package/lib/sdk-message-processor.js +16 -4
- package/lib/sdk-quota-snapshot.js +37 -0
- package/lib/server-admin.js +11 -0
- package/lib/server-appearance-settings.js +71 -0
- package/lib/server-home-chat-events.js +1 -1
- package/lib/server-home-chat.js +25 -3
- package/lib/server-home-debate-planning.js +4 -1
- package/lib/server-home-debates.js +2 -0
- package/lib/server-home-mate-creation.js +4 -1
- package/lib/server-linear.js +14 -8
- package/lib/server-mate-instructions.js +44 -0
- package/lib/server-mates.js +14 -4
- package/lib/server-notification-settings.js +67 -0
- package/lib/server-palette.js +1 -1
- package/lib/server-settings.js +69 -1
- package/lib/server-storage.js +57 -0
- package/lib/server-user-knowledge.js +119 -0
- package/lib/server.js +31 -3
- package/lib/session-visibility.js +7 -2
- package/lib/sessions.js +35 -10
- package/lib/startup-projects.js +40 -0
- package/lib/storage-native-walk.js +85 -0
- package/lib/storage-usage.js +144 -0
- package/lib/user-knowledge-service.js +167 -0
- package/lib/users-permissions.js +7 -0
- package/lib/users-preferences.js +0 -74
- package/lib/users-project-mate-filter-preferences.js +39 -0
- package/lib/users.js +6 -4
- package/lib/workspace-query-access.js +4 -1
- package/lib/ws-schema.js +52 -4
- package/lib/yoke/acp-process-manager.js +2 -2
- package/lib/yoke/adapters/codex.js +12 -52
- package/lib/yoke/codex-app-server.js +2 -2
- package/lib/yoke/codex-model-catalog.js +52 -0
- package/lib/yoke/codex-rate-limits.js +26 -0
- package/package.json +12 -3
package/lib/project.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
var handleProjectDebateControl = require("./project-debate-workspace").handleProjectDebateControl;
|
|
1
2
|
var fs = require("fs");
|
|
2
3
|
var path = require("path");
|
|
3
4
|
var os = require("os");
|
|
@@ -421,9 +422,13 @@ function createProjectContext(opts) {
|
|
|
421
422
|
});
|
|
422
423
|
}
|
|
423
424
|
|
|
425
|
+
function canReceiveMate(ws) {
|
|
426
|
+
return !isMate || !usersModule.isMultiUser() || !!(ws && ws._clayUser && projectOwnerId && ws._clayUser.id === projectOwnerId);
|
|
427
|
+
}
|
|
428
|
+
|
|
424
429
|
function send(obj) {
|
|
425
430
|
for (var ws of clients) {
|
|
426
|
-
if (ws.readyState !== 1) continue;
|
|
431
|
+
if (ws.readyState !== 1 || !canReceiveMate(ws)) continue;
|
|
427
432
|
var payload = obj;
|
|
428
433
|
if (obj && obj.type === "info") {
|
|
429
434
|
var infoUserId = ws._clayUser ? ws._clayUser.id : null;
|
|
@@ -438,7 +443,7 @@ function createProjectContext(opts) {
|
|
|
438
443
|
}
|
|
439
444
|
|
|
440
445
|
function sendTo(ws, obj) {
|
|
441
|
-
if (ws.readyState !== 1) return;
|
|
446
|
+
if (ws.readyState !== 1 || !canReceiveMate(ws)) return;
|
|
442
447
|
var payload = obj;
|
|
443
448
|
if (obj && (obj.type === "loop_registry_updated" || obj.type === "hub_schedules")) {
|
|
444
449
|
var userId = ws._clayUser ? ws._clayUser.id : null;
|
|
@@ -464,7 +469,7 @@ function createProjectContext(opts) {
|
|
|
464
469
|
var now = Date.now();
|
|
465
470
|
var payload = JSON.stringify({ type: "update_available", version: version });
|
|
466
471
|
for (var ws of clients) {
|
|
467
|
-
if (ws.readyState !== 1) continue;
|
|
472
|
+
if (ws.readyState !== 1 || !canReceiveMate(ws)) continue;
|
|
468
473
|
if (!updateSnooze.isUpdateAdmin(ws, usersModule)) continue;
|
|
469
474
|
var key = updateSnooze.userKeyFor(ws, usersModule);
|
|
470
475
|
if (updateSnooze.isSnoozed(key, version, now)) continue;
|
|
@@ -480,7 +485,7 @@ function createProjectContext(opts) {
|
|
|
480
485
|
var withVersion = JSON.stringify({ type: "update_started", version: version || "" });
|
|
481
486
|
var withoutVersion = JSON.stringify({ type: "update_started" });
|
|
482
487
|
for (var ws of clients) {
|
|
483
|
-
if (ws.readyState !== 1) continue;
|
|
488
|
+
if (ws.readyState !== 1 || !canReceiveMate(ws)) continue;
|
|
484
489
|
ws.send(updateSnooze.isUpdateAdmin(ws, usersModule) ? withVersion : withoutVersion);
|
|
485
490
|
}
|
|
486
491
|
}
|
|
@@ -493,7 +498,7 @@ function createProjectContext(opts) {
|
|
|
493
498
|
if (!userKey) return;
|
|
494
499
|
var data = JSON.stringify(obj);
|
|
495
500
|
for (var ws of clients) {
|
|
496
|
-
if (ws.readyState !== 1) continue;
|
|
501
|
+
if (ws.readyState !== 1 || !canReceiveMate(ws)) continue;
|
|
497
502
|
if (updateSnooze.userKeyFor(ws, usersModule) !== userKey) continue;
|
|
498
503
|
ws.send(data);
|
|
499
504
|
}
|
|
@@ -528,27 +533,33 @@ function createProjectContext(opts) {
|
|
|
528
533
|
function sendToOthers(sender, obj) {
|
|
529
534
|
var data = JSON.stringify(obj);
|
|
530
535
|
for (var ws of clients) {
|
|
531
|
-
if (ws !== sender && ws.readyState === 1) ws.send(data);
|
|
536
|
+
if (ws !== sender && ws.readyState === 1 && canReceiveMate(ws)) ws.send(data);
|
|
532
537
|
}
|
|
533
538
|
}
|
|
534
539
|
|
|
540
|
+
function canReceiveYou(ws, sessionId) {
|
|
541
|
+
var session = sm.sessions.get(sessionId);
|
|
542
|
+
return !session || !session.userKnowledgeOwnerId || !usersModule.isMultiUser()
|
|
543
|
+
|| !!(ws._clayUser && ws._clayUser.id === session.userKnowledgeOwnerId);
|
|
544
|
+
}
|
|
545
|
+
|
|
535
546
|
function sendToSession(sessionId, obj) {
|
|
536
547
|
var data = JSON.stringify(obj);
|
|
537
548
|
for (var ws of clients) {
|
|
538
|
-
if (ws.readyState === 1 && ws._clayActiveSession === sessionId) {
|
|
549
|
+
if (ws.readyState === 1 && canReceiveMate(ws) && canReceiveYou(ws, sessionId) && ws._clayActiveSession === sessionId) {
|
|
539
550
|
ws.send(data);
|
|
540
551
|
}
|
|
541
552
|
}
|
|
542
553
|
homeDebateClients.forEach(function (ws) {
|
|
543
554
|
if (ws.readyState !== 1) { homeDebateClients.delete(ws); return; }
|
|
544
|
-
if (!clients.has(ws) && ws._clayHomeDebateSlug === slug && ws._clayActiveSession === sessionId) ws.send(data);
|
|
555
|
+
if (canReceiveMate(ws) && canReceiveYou(ws, sessionId) && !clients.has(ws) && ws._clayHomeDebateSlug === slug && ws._clayActiveSession === sessionId) ws.send(data);
|
|
545
556
|
});
|
|
546
557
|
}
|
|
547
558
|
|
|
548
559
|
function sendToSessionOthers(sender, sessionId, obj) {
|
|
549
560
|
var data = JSON.stringify(obj);
|
|
550
561
|
for (var ws of clients) {
|
|
551
|
-
if (ws !== sender && ws.readyState === 1 && ws._clayActiveSession === sessionId) {
|
|
562
|
+
if (ws !== sender && ws.readyState === 1 && canReceiveMate(ws) && canReceiveYou(ws, sessionId) && ws._clayActiveSession === sessionId) {
|
|
552
563
|
ws.send(data);
|
|
553
564
|
}
|
|
554
565
|
}
|
|
@@ -589,6 +600,7 @@ function createProjectContext(opts) {
|
|
|
589
600
|
// --- Session manager ---
|
|
590
601
|
var _gitAttribution = null;
|
|
591
602
|
var sm = createSessionManager({
|
|
603
|
+
isMate: isMate,
|
|
592
604
|
cwd: cwd,
|
|
593
605
|
send: send,
|
|
594
606
|
sendTo: sendTo,
|
|
@@ -814,7 +826,7 @@ function createProjectContext(opts) {
|
|
|
814
826
|
sm: sm, resolveDefaultAi: opts.resolveDefaultAi, getSdk: function () { return sdk; },
|
|
815
827
|
getLinuxUserForSession: getLinuxUserForSession, osUsers: osUsers,
|
|
816
828
|
getProjectAccess: function () {
|
|
817
|
-
if (isMate) return { visibility: "private", ownerId: projectOwnerId || null, allowedUsers: [] };
|
|
829
|
+
if (isMate) return { isMate: true, visibility: "private", ownerId: projectOwnerId || null, allowedUsers: [] };
|
|
818
830
|
return opts.getProjectAccess ? opts.getProjectAccess() : { visibility: "public", ownerId: projectOwnerId || null };
|
|
819
831
|
},
|
|
820
832
|
ensureProjectAccessForSession: ensureProjectAccessForSession,
|
|
@@ -870,6 +882,10 @@ function createProjectContext(opts) {
|
|
|
870
882
|
return !usersModule.isMultiUser() || !!(ws._clayUser && ws._clayUser.id === session.ownerId);
|
|
871
883
|
},
|
|
872
884
|
});
|
|
885
|
+
var _userKnowledge = require('./project-user-knowledge').attachProjectUserKnowledge({
|
|
886
|
+
service: opts.userKnowledgeService, schedule: opts.scheduleUserKnowledge, slug: slug, sendTo: sendTo,
|
|
887
|
+
isMultiUser: function () { return usersModule.isMultiUser(); }
|
|
888
|
+
});
|
|
873
889
|
var _mateKnowledge = attachProjectMateKnowledge({
|
|
874
890
|
service: opts.mateKnowledgeService || null,
|
|
875
891
|
sm: sm,
|
|
@@ -1002,6 +1018,7 @@ function createProjectContext(opts) {
|
|
|
1002
1018
|
isMultiUser: usersModule.isMultiUser,
|
|
1003
1019
|
getProjectOwnerId: function () { return projectOwnerId; },
|
|
1004
1020
|
recordSessionEvent: function (session, event) { sm.sendAndRecord(session, event); },
|
|
1021
|
+
persistSession: function (session) { return sm.saveSessionFile(session); },
|
|
1005
1022
|
getVendorModelCatalog: function (ws, vendor) { return _models.getVendorCatalog(ws, vendor); },
|
|
1006
1023
|
createReadyMate: opts.createReadyMate,
|
|
1007
1024
|
});
|
|
@@ -1052,6 +1069,7 @@ function createProjectContext(opts) {
|
|
|
1052
1069
|
// get the read-only cross-project set only when the Mate registry confirms
|
|
1053
1070
|
// authoritative builtin Clay.
|
|
1054
1071
|
try {
|
|
1072
|
+
if (opts.userKnowledgeService) servers['clay-you'] = _userKnowledge.createMcpServer(adapter, null);
|
|
1055
1073
|
var linearMcpConfig = _sessionLinear.createMcpServer(adapter, null);
|
|
1056
1074
|
if (linearMcpConfig) servers['clay-linear'] = linearMcpConfig;
|
|
1057
1075
|
var githubMcpConfig = _sessionGithub.createMcpServer(adapter, null);
|
|
@@ -1222,6 +1240,11 @@ function createProjectContext(opts) {
|
|
|
1222
1240
|
var hasAny = false;
|
|
1223
1241
|
for (var i = 0; i < keys.length; i++) {
|
|
1224
1242
|
var name = keys[i];
|
|
1243
|
+
if (forSession && forSession.youCurator && name !== 'clay-you') continue;
|
|
1244
|
+
if (name === 'clay-you') {
|
|
1245
|
+
if (forSession) { filtered[name] = _userKnowledge.createMcpServer(adapter, forSession); hasAny = true; }
|
|
1246
|
+
continue;
|
|
1247
|
+
}
|
|
1225
1248
|
if (name === "clay-browser" && !extConnected) continue;
|
|
1226
1249
|
if (name === "clay-email" && !emailAvailable) continue;
|
|
1227
1250
|
if (name === "clay-workspace" && forSession) {
|
|
@@ -1421,6 +1444,7 @@ function createProjectContext(opts) {
|
|
|
1421
1444
|
return false;
|
|
1422
1445
|
},
|
|
1423
1446
|
getSessionSystemPrompt: function (session) {
|
|
1447
|
+
if (session.youCurator) return _userKnowledge.getSystemPrompt(session);
|
|
1424
1448
|
return composeSystemPrompts([
|
|
1425
1449
|
_sessionPair.getSystemPrompt(session),
|
|
1426
1450
|
_sessionNotes.getSystemPrompt(session),
|
|
@@ -1435,6 +1459,7 @@ function createProjectContext(opts) {
|
|
|
1435
1459
|
_sessionLinear.getSystemPrompt(session),
|
|
1436
1460
|
_scheduledTasks ? _scheduledTasks.getSystemPrompt(session) : "",
|
|
1437
1461
|
_mateKnowledge.getSystemPrompt(session),
|
|
1462
|
+
_userKnowledge.getSystemPrompt(session),
|
|
1438
1463
|
_autonomousRun ? _autonomousRun.getSystemPrompt(session) : "",
|
|
1439
1464
|
]);
|
|
1440
1465
|
},
|
|
@@ -1443,6 +1468,7 @@ function createProjectContext(opts) {
|
|
|
1443
1468
|
return _askUser.createHandler(session)(request, respond);
|
|
1444
1469
|
},
|
|
1445
1470
|
getSessionToolDefs: function (session) {
|
|
1471
|
+
if (session.youCurator) return _userKnowledge.getDynamicToolDefs(session);
|
|
1446
1472
|
return _sessionPair.getToolDefs(session)
|
|
1447
1473
|
.concat(_sessionNotes.getToolDefs(session))
|
|
1448
1474
|
.concat(_sessionHandoff.getToolDefs(session))
|
|
@@ -1458,6 +1484,7 @@ function createProjectContext(opts) {
|
|
|
1458
1484
|
.concat(_sessionGithub.getDynamicToolDefs(session))
|
|
1459
1485
|
.concat(_sessionLinear.getDynamicToolDefs(session))
|
|
1460
1486
|
.concat(_mateKnowledge.getDynamicToolDefs(session))
|
|
1487
|
+
.concat(opts.userKnowledgeService ? _userKnowledge.getDynamicToolDefs(session) : [])
|
|
1461
1488
|
.concat(_loopInterview ? _loopInterview.getToolDefs(session) : [])
|
|
1462
1489
|
.concat(_scheduledTasks ? _scheduledTasks.getToolDefs(session) : [])
|
|
1463
1490
|
.concat(_scheduledTaskExecution ? _scheduledTaskExecution.getToolDefs(session) : [])
|
|
@@ -1526,7 +1553,7 @@ function createProjectContext(opts) {
|
|
|
1526
1553
|
onProcessingChanged: onProcessingChanged,
|
|
1527
1554
|
ensureProjectAccessForSession: ensureProjectAccessForSession,
|
|
1528
1555
|
getProjectAccess: function () {
|
|
1529
|
-
if (isMate) return { visibility: "private", ownerId: projectOwnerId || null, allowedUsers: [] };
|
|
1556
|
+
if (isMate) return { isMate: true, visibility: "private", ownerId: projectOwnerId || null, allowedUsers: [] };
|
|
1530
1557
|
return opts.getProjectAccess ? opts.getProjectAccess() : { visibility: "public", ownerId: projectOwnerId || null };
|
|
1531
1558
|
},
|
|
1532
1559
|
canAccessProjectSlug: opts.canAccessProjectSlug || function () { return !usersModule.isMultiUser(); },
|
|
@@ -1668,7 +1695,7 @@ function createProjectContext(opts) {
|
|
|
1668
1695
|
},
|
|
1669
1696
|
});
|
|
1670
1697
|
|
|
1671
|
-
// Mate
|
|
1698
|
+
// Mate AGENTS.md crisis safety watcher
|
|
1672
1699
|
var crisisWatcher = null;
|
|
1673
1700
|
var crisisDebounce = null;
|
|
1674
1701
|
|
|
@@ -1763,7 +1790,7 @@ function createProjectContext(opts) {
|
|
|
1763
1790
|
if (typeof opts.onDmMessage === "function") opts.onDmMessage(ws, msg, slug);
|
|
1764
1791
|
return;
|
|
1765
1792
|
}
|
|
1766
|
-
if (msg.type === "project_assignment_response" || msg.type === "dm_open" || msg.type === "dm_send" || msg.type === "dm_list" || msg.type === "dm_typing" || msg.type === "dm_add_favorite" || msg.type === "dm_remove_favorite" || msg.type === "mate_create" || msg.type === "mate_list" || msg.type === "mate_delete" || msg.type === "mate_update" || msg.type === "mate_readd_builtin" || msg.type === "mate_list_available_builtins" || msg.type === "email_accounts_list" || msg.type === "email_account_add" || msg.type === "email_account_remove" || msg.type === "email_account_test" || msg.type === "home_debates_list" || msg.type === "home_mate_present" || msg.type === "home_mate_open" || msg.type === "home_mate_sessions_list" || msg.type === "home_mate_session_open" || msg.type === "home_mate_send" || msg.type === "home_mate_new_session" || msg.type === "home_mate_debate_plan" || msg.type === "home_debate_proposal_response" || msg.type === "home_mate_creation_plan" || msg.type === "home_mate_creation_proposal_response" || msg.type === "home_mate_close" || msg.type === "home_mate_memory_list" || msg.type === "home_mate_knowledge_list" || msg.type === "home_mate_models_get" || msg.type === "home_mate_model_set" || msg.type === "home_dock_get" || msg.type === "home_dock_set" || msg.type === "home_surface_get" || msg.type === "home_surface_set" || msg.type === "tools_list" || msg.type === "tool_get" || msg.type === "tool_install" || msg.type === "tool_remove" || msg.type === "tool_storage_op" || msg.type === "tool_llm_op" || msg.type === "tool_llm_config_get" || msg.type === "tool_control_response" || msg.type === "tool_source_get" || msg.type === "tool_mate_access_set" || msg.type === "tool_server_control" || msg.type === "tool_frame_url") {
|
|
1793
|
+
if (msg.type === "project_assignment_response" || msg.type === "dm_open" || msg.type === "dm_send" || msg.type === "dm_list" || msg.type === "dm_typing" || msg.type === "dm_add_favorite" || msg.type === "dm_remove_favorite" || msg.type === "mate_create" || msg.type === "mate_list" || msg.type === "mate_delete" || msg.type === "mate_update" || msg.type === "mate_instructions_get" || msg.type === "mate_instructions_set" || msg.type === "mate_readd_builtin" || msg.type === "mate_list_available_builtins" || msg.type === "email_accounts_list" || msg.type === "email_account_add" || msg.type === "email_account_remove" || msg.type === "email_account_test" || msg.type === "home_debates_list" || msg.type === "home_mate_present" || msg.type === "home_mate_open" || msg.type === "home_mate_sessions_list" || msg.type === "home_mate_session_open" || msg.type === "home_mate_send" || msg.type === "home_mate_new_session" || msg.type === "home_mate_debate_plan" || msg.type === "home_debate_proposal_response" || msg.type === "home_mate_creation_plan" || msg.type === "home_mate_creation_proposal_response" || msg.type === "home_mate_close" || msg.type === "home_mate_memory_list" || msg.type === "home_mate_knowledge_list" || msg.type === "home_mate_models_get" || msg.type === "home_mate_model_set" || msg.type === "home_dock_get" || msg.type === "home_dock_set" || msg.type === "home_surface_get" || msg.type === "home_surface_set" || msg.type === "tools_list" || msg.type === "tool_get" || msg.type === "tool_install" || msg.type === "tool_remove" || msg.type === "tool_storage_op" || msg.type === "tool_llm_op" || msg.type === "tool_llm_config_get" || msg.type === "tool_control_response" || msg.type === "tool_source_get" || msg.type === "tool_mate_access_set" || msg.type === "tool_server_control" || msg.type === "tool_frame_url") {
|
|
1767
1794
|
if (typeof opts.onDmMessage === "function") {
|
|
1768
1795
|
opts.onDmMessage(ws, msg, slug);
|
|
1769
1796
|
}
|
|
@@ -1801,6 +1828,7 @@ function createProjectContext(opts) {
|
|
|
1801
1828
|
}
|
|
1802
1829
|
|
|
1803
1830
|
// --- Debate ---
|
|
1831
|
+
if (handleProjectDebateControl(ws, msg, getSessionForWs(ws), _debate, sendTo)) return;
|
|
1804
1832
|
if (msg.type === "debate_start") {
|
|
1805
1833
|
handleDebateStart(ws, msg);
|
|
1806
1834
|
return;
|
|
@@ -1838,6 +1866,7 @@ function createProjectContext(opts) {
|
|
|
1838
1866
|
if (_knowledge.handleKnowledgeMessage(ws, msg)) return;
|
|
1839
1867
|
|
|
1840
1868
|
// --- Project Logs (delegated to project-logs.js) ---
|
|
1869
|
+
if (opts.userKnowledgeService && _userKnowledge.handleMessage(ws, msg)) return;
|
|
1841
1870
|
if (_projectLogs.handleLogsMessage(ws, msg)) return;
|
|
1842
1871
|
if (_issues.handleMessage(ws, msg)) return;
|
|
1843
1872
|
if (_sessionGithub.handleMessage(ws, msg)) return;
|
|
@@ -2072,6 +2101,7 @@ function createProjectContext(opts) {
|
|
|
2072
2101
|
pushModule: pushModule,
|
|
2073
2102
|
getSessionForWs: getSessionForWs,
|
|
2074
2103
|
resolveDefaultAi: opts.resolveDefaultAi,
|
|
2104
|
+
resolveMateSessionDefaults: opts.resolveMateSessionDefaults,
|
|
2075
2105
|
getVendorAvailability: function (ws) { return _models.getVendorAvailability(ws); },
|
|
2076
2106
|
canCreateScheduledTaskInterview: function (ws, session) { return !!(_scheduledTasks && _scheduledTasks.canCreateInterview(ws, session)); },
|
|
2077
2107
|
canStartScheduledTaskInterview: function (ws, session) { return !!(_scheduledTasks && _scheduledTasks.canStartInterview(ws, session)); },
|
|
@@ -2104,7 +2134,7 @@ function createProjectContext(opts) {
|
|
|
2104
2134
|
cancelScheduledMessage: cancelScheduledMessage,
|
|
2105
2135
|
sendScheduledMessageNow: sendScheduledMessageNow,
|
|
2106
2136
|
getProjectOwnerId: function () { return projectOwnerId; },
|
|
2107
|
-
setProjectOwnerId: function (id) { projectOwnerId = id; },
|
|
2137
|
+
setProjectOwnerId: function (id) { if (!isMate) projectOwnerId = id; },
|
|
2108
2138
|
getUpdateChannel: function () { return updateChannel; },
|
|
2109
2139
|
setUpdateChannel: function (ch) { updateChannel = ch; },
|
|
2110
2140
|
getLatestVersion: function () { return latestVersion; },
|
|
@@ -2347,6 +2377,7 @@ function createProjectContext(opts) {
|
|
|
2347
2377
|
}
|
|
2348
2378
|
}
|
|
2349
2379
|
|
|
2380
|
+
if (boundSession && boundSession.youCurator) return Promise.resolve(_userKnowledge.getBridgeTools(boundSession, normalizeToolSchema));
|
|
2350
2381
|
if (boundSession) {
|
|
2351
2382
|
var queryTools = queryToolBridge.listTools(queryGeneration);
|
|
2352
2383
|
for (var qti = 0; qti < queryTools.length; qti++) tools.push(queryTools[qti]);
|
|
@@ -2411,6 +2442,10 @@ function createProjectContext(opts) {
|
|
|
2411
2442
|
tools = tools.concat(_issues.getBridgeTools(boundSession, normalizeToolSchema));
|
|
2412
2443
|
tools = tools.concat(_sessionGithub.getBridgeTools(boundSession, normalizeToolSchema));
|
|
2413
2444
|
tools = tools.concat(_sessionLinear.getBridgeTools(boundSession, normalizeToolSchema));
|
|
2445
|
+
if (opts.userKnowledgeService) {
|
|
2446
|
+
var youTools = _userKnowledge.getBridgeTools(boundSession, normalizeToolSchema);
|
|
2447
|
+
for (var yti = 0; yti < youTools.length; yti++) tools.push(youTools[yti]);
|
|
2448
|
+
}
|
|
2414
2449
|
var logsTools = _projectLogs.getBridgeTools(boundSession, normalizeToolSchema);
|
|
2415
2450
|
for (var plti = 0; plti < logsTools.length; plti++) tools.push(logsTools[plti]);
|
|
2416
2451
|
var knowledgeTools = _mateKnowledge.getBridgeTools(boundSession, normalizeToolSchema);
|
|
@@ -2439,7 +2474,7 @@ function createProjectContext(opts) {
|
|
|
2439
2474
|
// Debate tools were added above only when this request had an
|
|
2440
2475
|
// exact session. Never duplicate them or advertise the static,
|
|
2441
2476
|
// intentionally unbound proposal server.
|
|
2442
|
-
if (inAppNames[i] === "clay-debate" || inAppNames[i] === "clay-mate-creation" || inAppNames[i] === "clay-workspace" || inAppNames[i] === "clay-history" || inAppNames[i] === "clay-github" || inAppNames[i] === "clay-linear" || inAppNames[i] === "clay-issues" || inAppNames[i] === "clay-logs" || inAppNames[i] === "clay-knowledge") continue;
|
|
2477
|
+
if (inAppNames[i] === "clay-debate" || inAppNames[i] === "clay-mate-creation" || inAppNames[i] === "clay-workspace" || inAppNames[i] === "clay-history" || inAppNames[i] === "clay-github" || inAppNames[i] === "clay-linear" || inAppNames[i] === "clay-issues" || inAppNames[i] === "clay-logs" || inAppNames[i] === "clay-knowledge" || inAppNames[i] === "clay-you") continue;
|
|
2443
2478
|
extractServerTools(inAppNames[i], localMcp[inAppNames[i]]);
|
|
2444
2479
|
}
|
|
2445
2480
|
}
|
|
@@ -2459,6 +2494,8 @@ function createProjectContext(opts) {
|
|
|
2459
2494
|
if (sessionOnly && !sessionQueryValid()) {
|
|
2460
2495
|
return Promise.reject(new Error("Session tool unavailable or older query: " + serverName + "/" + toolName));
|
|
2461
2496
|
}
|
|
2497
|
+
if (boundSession && boundSession.youCurator && serverName !== 'clay-you') return Promise.reject(new Error('Clay review only permits User Knowledge tools.'));
|
|
2498
|
+
if (boundSession && serverName === 'clay-you') return _userKnowledge.callBridgeTool(boundSession, toolName, args);
|
|
2462
2499
|
var queryCall = queryToolBridge.callTool(queryGeneration, serverName, toolName, args);
|
|
2463
2500
|
if (queryCall) return queryCall;
|
|
2464
2501
|
if (boundSession && serverName === "clay-sessions") {
|
|
@@ -2538,7 +2575,7 @@ function createProjectContext(opts) {
|
|
|
2538
2575
|
if (boundSession && serverName === "clay-knowledge") {
|
|
2539
2576
|
return _mateKnowledge.callBridgeTool(boundSession, toolName, args);
|
|
2540
2577
|
}
|
|
2541
|
-
if (serverName === "clay-sessions" || serverName === "clay-notes" || serverName === "clay-handoff" || serverName === "clay-documents" || serverName === "clay-shared-browser" || serverName === "clay-debate" || serverName === "clay-mate-creation" || serverName === "clay-workspace" || serverName === "clay-history" || serverName === "clay-github" || serverName === "clay-linear" || serverName === "clay-issues" || serverName === "clay-logs" || serverName === "clay-knowledge") {
|
|
2578
|
+
if (serverName === "clay-sessions" || serverName === "clay-notes" || serverName === "clay-handoff" || serverName === "clay-documents" || serverName === "clay-shared-browser" || serverName === "clay-debate" || serverName === "clay-mate-creation" || serverName === "clay-workspace" || serverName === "clay-history" || serverName === "clay-github" || serverName === "clay-linear" || serverName === "clay-issues" || serverName === "clay-logs" || serverName === "clay-knowledge" || serverName === "clay-you") {
|
|
2542
2579
|
return Promise.reject(new Error("Session-bound tool requires a valid Clay session: " + serverName + "/" + toolName));
|
|
2543
2580
|
}
|
|
2544
2581
|
if (sessionOnly) return Promise.reject(new Error("Session tool not found: " + serverName + "/" + toolName));
|
|
@@ -2597,6 +2634,8 @@ function createProjectContext(opts) {
|
|
|
2597
2634
|
cwd: cwd,
|
|
2598
2635
|
slug: slug,
|
|
2599
2636
|
isMate: isMate,
|
|
2637
|
+
mateId: mateId,
|
|
2638
|
+
mateDisplayName: opts.mateDisplayName || "",
|
|
2600
2639
|
osUsers: osUsers,
|
|
2601
2640
|
debug: debug,
|
|
2602
2641
|
dangerouslySkipPermissions: dangerouslySkipPermissions,
|
|
@@ -2632,7 +2671,7 @@ function createProjectContext(opts) {
|
|
|
2632
2671
|
stopFileWatch: stopFileWatch,
|
|
2633
2672
|
stopAllDirWatches: stopAllDirWatches,
|
|
2634
2673
|
getProjectOwnerId: function () { return projectOwnerId; },
|
|
2635
|
-
setProjectOwnerId: function (id) { projectOwnerId = id; },
|
|
2674
|
+
setProjectOwnerId: function (id) { if (!isMate) projectOwnerId = id; },
|
|
2636
2675
|
getLatestVersion: function () { return latestVersion; },
|
|
2637
2676
|
getTitle: function () { return title; },
|
|
2638
2677
|
getProject: function () { return project; },
|
|
@@ -2799,16 +2838,16 @@ function createProjectContext(opts) {
|
|
|
2799
2838
|
|
|
2800
2839
|
function setTitle(newTitle) {
|
|
2801
2840
|
title = newTitle || null;
|
|
2802
|
-
send({ type: "info", cwd: cwd, slug: slug, project: title || project, version: currentVersion, debug: !!debug, osUsers: osUsers, lanHost: lanHost, projectCount: getProjectCount(), projects: getProjectList(), projectOwnerId: projectOwnerId });
|
|
2841
|
+
send({ type: "info", cwd: cwd, slug: slug, project: title || project, version: currentVersion, debug: !!debug, osUsers: osUsers, lanHost: lanHost, projectCount: getProjectCount(), projects: getProjectList(), projectOwnerId: projectOwnerId, isMate: isMate, mateId: isMate ? mateId : null, mateDisplayName: isMate ? (opts.mateDisplayName || title || project || "Mate") : "" });
|
|
2803
2842
|
}
|
|
2804
2843
|
|
|
2805
2844
|
function setIcon(newIcon) {
|
|
2806
2845
|
icon = newIcon || null;
|
|
2807
2846
|
}
|
|
2808
2847
|
|
|
2809
|
-
// Mate projects: watch
|
|
2848
|
+
// Mate projects: watch AGENTS.md and enforce system-managed sections
|
|
2810
2849
|
if (isMate) {
|
|
2811
|
-
var claudeMdPath =
|
|
2850
|
+
var claudeMdPath = require("./mate-identity-file").resolveMateIdentityFile(cwd);
|
|
2812
2851
|
// Derive mateId from cwd (last path segment) and build ctx for dynamic team section
|
|
2813
2852
|
var _mateId = path.basename(cwd);
|
|
2814
2853
|
var _mateCtx = matesModule.buildMateCtx(projectOwnerId);
|
|
@@ -2868,6 +2907,7 @@ function createProjectContext(opts) {
|
|
|
2868
2907
|
isMcpBridgeAuthenticated: function (req) {
|
|
2869
2908
|
return !!(req && req.headers && req.headers["x-clay-bridge-token"] && req.headers["x-clay-bridge-token"] === mcpBridgeToken);
|
|
2870
2909
|
},
|
|
2910
|
+
getYouLinuxUser: getLinuxUserForSession,
|
|
2871
2911
|
getStatus: getStatus,
|
|
2872
2912
|
getSessionManager: function () { return sm; },
|
|
2873
2913
|
createDelegatedSession: _delegatedSession.createDelegatedSession,
|
|
@@ -2885,6 +2925,7 @@ function createProjectContext(opts) {
|
|
|
2885
2925
|
getVendorModelAvailability: _models.getVendorAvailability,
|
|
2886
2926
|
getMemoryState: _memory.readMemoryState,
|
|
2887
2927
|
listKnowledgeFiles: _knowledge.listKnowledgeFiles,
|
|
2928
|
+
getKnowledgeDbService: function () { return _knowledge.databases; },
|
|
2888
2929
|
refreshCapsuleCatalog: _capsuleCatalog.refreshSessions,
|
|
2889
2930
|
getNotificationsModule: function () { return _notifications; },
|
|
2890
2931
|
refreshVendorAuth: _vendorLogin.refreshVendorAuth,
|
|
@@ -2893,7 +2934,7 @@ function createProjectContext(opts) {
|
|
|
2893
2934
|
removeSchedule: _loop.removeSchedule,
|
|
2894
2935
|
setTitle: setTitle,
|
|
2895
2936
|
setIcon: setIcon,
|
|
2896
|
-
setProjectOwner: function (ownerId) { projectOwnerId = ownerId; },
|
|
2937
|
+
setProjectOwner: function (ownerId) { if (!isMate) projectOwnerId = ownerId; },
|
|
2897
2938
|
getProjectOwner: function () { return projectOwnerId; },
|
|
2898
2939
|
getToolLlmConfig: function (ws, alias) {
|
|
2899
2940
|
return _toolLlmRuntime.getConfiguration(ws, alias);
|
package/lib/public/app.js
CHANGED
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
} from './modules/sidebar-mobile.js';
|
|
26
26
|
import { initMateSidebar, showMateSidebar, hideMateSidebar, renderMateSessionList, updateMateSidebarProfile, handleMateSearchResults } from './modules/mate-sidebar.js';
|
|
27
27
|
import { initMateKnowledge, requestKnowledgeList, renderKnowledgeList, handleKnowledgeContent, hideKnowledge } from './modules/mate-knowledge.js';
|
|
28
|
+
import { initMateKnowledgeWorkbench } from './modules/mate-knowledge-workbench.js';
|
|
28
29
|
import { initMateMemory, renderMemoryList, hideMemory } from './modules/mate-memory.js';
|
|
29
30
|
import { initRewind, setRewindMode, showRewindModal, clearPendingRewindUuid, addRewindButton, onRewindComplete, onRewindError } from './modules/rewind.js';
|
|
30
31
|
import { initNotifications, showDoneNotification, playDoneSound, isNotifAlertEnabled, isNotifSoundEnabled } from './modules/notifications.js';
|
|
@@ -41,17 +42,21 @@ import { initStickyNotes, handleNotesList, handleNoteCreated, handleNoteUpdated,
|
|
|
41
42
|
import { initNotesBrowser, openNotesBrowser, closeNotesBrowser, isNotesBrowserOpen, renderNotesBrowser } from './modules/sticky-notes-browser.js';
|
|
42
43
|
import { initTheme, getThemeColor, getComputedVar, onThemeChange, getCurrentTheme, getChatLayout } from './modules/theme.js';
|
|
43
44
|
import { initTools, resetToolState, saveToolState, restoreToolState, renderAskUserQuestion, markAskUserAnswered, renderPermissionRequest, markPermissionResolved, markPermissionCancelled, renderElicitationRequest, markElicitationResolved, renderPlanBanner, renderPlanCard, handleTodoWrite, handleTaskCreate, handleTaskUpdate, startThinking, appendThinking, stopThinking, resetThinkingGroup, createToolItem, updateToolExecuting, updateToolResult, markAllToolsDone, addTurnMeta, resetTurnMetaCost, enableMainInput, getTools, getPlanContent, setPlanContent, isPlanFilePath, getTodoTools, updateSubagentActivity, addSubagentToolEntry, markSubagentDone, updateSubagentProgress, initSubagentStop, closeToolGroup, removeToolFromGroup } from './modules/tools.js';
|
|
44
|
-
import { initServerSettings, updateSettingsStats, updateDaemonConfig, handleSetPinResult, handleKeepAwakeChanged, handleAutoContinueChanged, handleRestartResult, handleShutdownResult, handleSharedEnv, handleSharedEnvSaved
|
|
45
|
-
import { initProjectSettings
|
|
45
|
+
import { initServerSettings, updateSettingsStats, updateDaemonConfig, handleSetPinResult, handleKeepAwakeChanged, handleAutoContinueChanged, handleRestartResult, handleShutdownResult, handleSharedEnv, handleSharedEnvSaved } from './modules/server-settings.js';
|
|
46
|
+
import { initProjectSettings } from './modules/project-settings.js';
|
|
46
47
|
import { initSkills, handleSkillInstalled, handleSkillUninstalled } from './modules/skills.js';
|
|
47
48
|
import { initMcp } from './modules/mcp-ui.js';
|
|
48
49
|
import { initScheduler, resetScheduler, handleLoopRegistryUpdated, handleScheduleRunStarted, handleScheduleRunFinished, handleLoopScheduled, openSchedulerToTab, isSchedulerOpen, closeScheduler, enterCraftingMode, exitCraftingMode, handleLoopRegistryFiles, getUpcomingSchedules } from './modules/scheduler.js';
|
|
49
50
|
import { initScheduledTasks, closeScheduledTasks } from './modules/scheduled-tasks.js';
|
|
51
|
+
import { initDebatesWorkbench } from './modules/debates-workbench.js';
|
|
50
52
|
import { initPlaybook, openPlaybook, getPlaybooks, getPlaybookForTip, isCompleted as isPlaybookCompleted } from './modules/playbook.js';
|
|
51
53
|
import { initSTT } from './modules/stt.js';
|
|
52
54
|
import { initProfile, getProfileLang } from './modules/profile.js';
|
|
55
|
+
import { initAccountIsland } from './modules/account-island.js';
|
|
53
56
|
import { initUserSettings } from './modules/user-settings.js';
|
|
54
57
|
import { initToolPalettes } from './modules/tool-palette.js';
|
|
58
|
+
import { initYou } from './modules/you.js';
|
|
59
|
+
import { initYouActivity } from './modules/you-activity.js';
|
|
55
60
|
import { initProjectLogs, closeProjectLogs } from './modules/project-logs.js';
|
|
56
61
|
import { initProjectSwitcher } from './modules/project-switcher.js';
|
|
57
62
|
import { initSplitView } from './modules/split-view.js';
|
|
@@ -65,9 +70,6 @@ import { initShellCommand } from './modules/shell-command.js';
|
|
|
65
70
|
import { initConnection, connect as _connConnect, setStatus as _connSetStatus, scheduleReconnect as _connScheduleReconnect, cancelReconnect as _connCancelReconnect } from './modules/app-connection.js';
|
|
66
71
|
import { processMessage as _msgProcessMessage } from './modules/app-messages.js';
|
|
67
72
|
import { getWs as _getWsRef, setWs as _setWsRef } from './modules/ws-ref.js';
|
|
68
|
-
import { initHomeHub, showHomeHub as _hubShowHomeHub, hideHomeHub as _hubHideHomeHub, isHomeHubVisible, renderHomeMateSwitcher, updateHomeIconBadge } from './modules/app-home-hub.js';
|
|
69
|
-
import { initHomeSidebar } from './modules/home-sidebar.js';
|
|
70
|
-
import { openHomeMateAction } from './modules/home-mate-chat.js';
|
|
71
73
|
import { initProjectsHub, showProjectsHub, hideProjectsHub } from './modules/projects-hub.js';
|
|
72
74
|
import { initHomeSurfaceBoot } from './modules/home-surface-boot.js';
|
|
73
75
|
import { rememberHomePrimarySurface } from './modules/home-surface.js';
|
|
@@ -88,6 +90,10 @@ import { initPendingMessageQueue } from './modules/pending-message-queue.js';
|
|
|
88
90
|
import { initAppNotifications, handleNotificationsState as _notifHandleState, handleNotificationCreated as _notifHandleCreated, handleNotificationDismissed as _notifHandleDismissed, handleNotificationDismissedAll as _notifHandleDismissedAll } from './modules/app-notifications.js';
|
|
89
91
|
import { initHeaderTuiFont } from './modules/header-tui-font.js';
|
|
90
92
|
import { createStore, store } from './modules/store.js';
|
|
93
|
+
import { initProjectMateNavigation } from './modules/project-mate-navigation.js';
|
|
94
|
+
import { initProjectMateCreationWorkspace } from './modules/project-mate-creation-workspace.js';
|
|
95
|
+
import { initProjectDebatePlanningWorkspace } from './modules/project-debate-planning-workspace.js';
|
|
96
|
+
import { initProjectSessionNavigation } from './modules/project-session-navigation.js';
|
|
91
97
|
import { initPanels, updateConfigChip as _panUpdateConfigChip, getModelEffortLevels as _panGetModelEffortLevels, accumulateUsage as _panAccumulateUsage, updateUsagePanel as _panUpdateUsagePanel, resetUsage as _panResetUsage, toggleUsagePanel as _panToggleUsagePanel, formatTokens as _panFormatTokens, updateStatusPanel as _panUpdateStatusPanel, requestProcessStats as _panRequestProcessStats, toggleStatusPanel as _panToggleStatusPanel, accumulateContext as _panAccumulateContext, updateContextPanel as _panUpdateContextPanel, resetContext as _panResetContext, resetContextData as _panResetContextData, minimizeContext as _panMinimizeContext, expandContext as _panExpandContext, toggleContextPanel as _panToggleContextPanel, getContextView as _panGetContextView, renderCtxPopover as _panRenderCtxPopover, hideCtxPopover as _panHideCtxPopover, formatBytes as _panFormatBytes, formatUptime as _panFormatUptime, getModelSupportsEffort as _panGetModelSupportsEffort, getSessionUsage, setSessionUsage, getContextData, setContextData, setContextView as _panSetContextView, applyContextView as _panApplyContextView } from './modules/app-panels.js';
|
|
92
98
|
import { initProjects, updateProjectList as _projUpdateProjectList, renderProjectList as _projRenderProjectList, renderTopbarPresence as _projRenderTopbarPresence, switchProject as _projSwitchProject, resetClientState as _projResetClientState, confirmRemoveProject as _projConfirmRemoveProject, handleRemoveProjectCheckResult as _projHandleRemoveProjectCheckResult, handleRemoveProjectResult as _projHandleRemoveProjectResult, openAddProjectModal as _projOpenAddProjectModal, closeAddProjectModal as _projCloseAddProjectModal, handleBrowseDirResult as _projHandleBrowseDirResult, handleAddProjectResult as _projHandleAddProjectResult, handleCloneProgress as _projHandleCloneProgress, showUpdateAvailable as _projShowUpdateAvailable, getCachedProjects, setCachedProjects, getCachedProjectCount, getCachedRemovedProjects, setCachedRemovedProjects } from './modules/app-projects.js';
|
|
93
99
|
import { initRendering, addToMessages as _renAddToMessages, scrollToBottom as _renScrollToBottom, forceScrollToBottom as _renForceScrollToBottom, addUserMessage as _renAddUserMessage, getMsgTime as _renGetMsgTime, shouldGroupMessage as _renShouldGroupMessage, ensureAssistantBlock as _renEnsureAssistantBlock, addCopyHandler as _renAddCopyHandler, appendDelta as _renAppendDelta, flushStreamBuffer as _renFlushStreamBuffer, finalizeAssistantBlock as _renFinalizeAssistantBlock, addSystemMessage as _renAddSystemMessage, addConflictMessage as _renAddConflictMessage, addContextOverflowMessage as _renAddContextOverflowMessage, showClaudePreThinking as _renShowClaudePreThinking, showMatePreThinking as _renShowMatePreThinking, removeMatePreThinking as _renRemoveMatePreThinking, showSuggestionChips as _renShowSuggestionChips, hideSuggestionChips as _renHideSuggestionChips, getGhostSuggestion as _renGetGhostSuggestion, getTurnCounter, setTurnCounter, getPrependAnchor, setPrependAnchor, getActivityEl, setActivityEl, getIsUserScrolledUp, setIsUserScrolledUp, getStickyBottom, armStickyBottom, disarmStickyBottom } from './modules/app-rendering.js';
|
|
@@ -148,11 +154,12 @@ import { initDebate, handleDebatePreparing, handleDebateStarted, handleDebateRes
|
|
|
148
154
|
|
|
149
155
|
|
|
150
156
|
// --- Home Hub (delegated to app-home-hub.js) ---
|
|
151
|
-
function showHomeHub(fromHistory) {
|
|
152
|
-
function hideHomeHub() {
|
|
157
|
+
function showHomeHub(fromHistory) { showProjectsHub(fromHistory); }
|
|
158
|
+
function hideHomeHub() {}
|
|
159
|
+
function isHomeHubVisible() { return false; }
|
|
153
160
|
function startClayMateCreation() {
|
|
154
|
-
|
|
155
|
-
|
|
161
|
+
var add = document.getElementById('icon-strip-add');
|
|
162
|
+
if (add) add.click();
|
|
156
163
|
}
|
|
157
164
|
|
|
158
165
|
// --- DM (delegated to app-dm.js) ---
|
|
@@ -273,6 +280,8 @@ import { initDebate, handleDebatePreparing, handleDebateStarted, handleDebateRes
|
|
|
273
280
|
sharedBrowser: null,
|
|
274
281
|
sharedBrowsers: [],
|
|
275
282
|
mcpSkillsWorkbench: {},
|
|
283
|
+
mateKnowledgeWorkspaces: {},
|
|
284
|
+
mateColorSave: null,
|
|
276
285
|
mcpConnections: { screen: "list", servers: [], search: "", loaded: false },
|
|
277
286
|
sharedBrowserOpen: false,
|
|
278
287
|
sharedBrowserUi: {},
|
|
@@ -314,12 +323,55 @@ import { initDebate, handleDebatePreparing, handleDebateStarted, handleDebateRes
|
|
|
314
323
|
githubWorkProject: null,
|
|
315
324
|
githubWorkRefresh: null,
|
|
316
325
|
activeProjectSlug: null,
|
|
326
|
+
activeProjectMateId: null,
|
|
327
|
+
activeProjectMateName: '',
|
|
328
|
+
activeSessionMateId: null,
|
|
329
|
+
activeSessionMateName: '',
|
|
317
330
|
sessionActivatedProjectSlug: null,
|
|
318
331
|
sessionListProjectSlug: null,
|
|
319
332
|
splitGroupsProjectSlug: null,
|
|
320
333
|
socketPath: null,
|
|
321
334
|
pendingHomeProjectSlug: null,
|
|
322
335
|
homeProjectEmptyVisible: false,
|
|
336
|
+
homeShellVisible: false,
|
|
337
|
+
projectMateFilterMode: 'all',
|
|
338
|
+
projectMateFilterTurns: 0,
|
|
339
|
+
projectMateFilterActivated: false,
|
|
340
|
+
projectMateCreationActive: false,
|
|
341
|
+
projectMateCreationMateId: null,
|
|
342
|
+
projectMateCreationSessionId: null,
|
|
343
|
+
projectMateCreationRequestId: null,
|
|
344
|
+
projectMateCreationPendingStart: false,
|
|
345
|
+
projectMateCreationAwaitingHistory: false,
|
|
346
|
+
projectMateCreationAwaitingMateList: false,
|
|
347
|
+
projectMateCreationHistoryReady: false,
|
|
348
|
+
projectMateCreationLocalId: null,
|
|
349
|
+
projectMateCreationMessages: [],
|
|
350
|
+
projectMateCreationPendingMateId: null,
|
|
351
|
+
projectDebatePlanningActive: false,
|
|
352
|
+
projectDebatePlanningMateId: null,
|
|
353
|
+
projectDebatePlanningSessionId: null,
|
|
354
|
+
projectDebatePlanningLocalId: null,
|
|
355
|
+
projectDebatePlanningRequestId: null,
|
|
356
|
+
projectDebatePlanningPendingStart: false,
|
|
357
|
+
projectDebatePlanningAwaitingHistory: false,
|
|
358
|
+
projectDebatePlanningAwaitingMateList: false,
|
|
359
|
+
projectDebatePlanningHistoryReady: false,
|
|
360
|
+
projectDebatePlanningTopic: "",
|
|
361
|
+
projectDebatePlanningMessages: [],
|
|
362
|
+
projectDebatePlanningError: "",
|
|
363
|
+
projectDebatePlanningRetryable: false,
|
|
364
|
+
debatesWorkbenchStatus: "idle",
|
|
365
|
+
debatesWorkbenchRequestId: null,
|
|
366
|
+
debatesWorkbenchItems: [],
|
|
367
|
+
debatesWorkbenchError: "",
|
|
368
|
+
debatesWorkbenchFilter: "all",
|
|
369
|
+
debatesWorkbenchCreating: false,
|
|
370
|
+
debatesWorkbenchWide: false,
|
|
371
|
+
debatesWorkbenchFullscreen: false,
|
|
372
|
+
debatesWorkbenchScrollTop: 0,
|
|
373
|
+
pendingDebateNavigation: null,
|
|
374
|
+
pendingProjectSessionNavigation: null,
|
|
323
375
|
projectsHubVisible: false,
|
|
324
376
|
projectsHubMarkup: null,
|
|
325
377
|
projectsHubList: [],
|
|
@@ -387,6 +439,7 @@ import { initDebate, handleDebatePreparing, handleDebateStarted, handleDebateRes
|
|
|
387
439
|
fileViewerOpenRevision: 0,
|
|
388
440
|
cursorSharingEnabled: false,
|
|
389
441
|
cursorSharingHydrated: false,
|
|
442
|
+
cursorSharingPending: null,
|
|
390
443
|
pendingOutboundMessages: [],
|
|
391
444
|
pendingMessageQueue: { projectSlug: null, sessionId: null, revision: 0, paused: false, items: [], loading: false, error: "" },
|
|
392
445
|
pendingMessageQueueRecovery: false,
|
|
@@ -426,6 +479,9 @@ import { initDebate, handleDebatePreparing, handleDebateStarted, handleDebateRes
|
|
|
426
479
|
dockWidth: null,
|
|
427
480
|
dockHasActivity: false,
|
|
428
481
|
dockActivityToolId: null,
|
|
482
|
+
you: {},
|
|
483
|
+
youActivity: {},
|
|
484
|
+
youSequence: 0,
|
|
429
485
|
projectLogsOpen: false,
|
|
430
486
|
projectLogsWide: false,
|
|
431
487
|
projectLogsFullscreen: false,
|
|
@@ -498,7 +554,7 @@ import { initDebate, handleDebatePreparing, handleDebateStarted, handleDebateRes
|
|
|
498
554
|
cachedMatesList: [],
|
|
499
555
|
cachedDmFavorites: [],
|
|
500
556
|
cachedAvailableBuiltins: [],
|
|
501
|
-
projectMateDmsEnabled:
|
|
557
|
+
projectMateDmsEnabled: true,
|
|
502
558
|
returningFromMateDm: false,
|
|
503
559
|
pendingMateInterview: null,
|
|
504
560
|
pendingTermCommand: null,
|
|
@@ -546,10 +602,6 @@ import { initDebate, handleDebatePreparing, handleDebateStarted, handleDebateRes
|
|
|
546
602
|
vendorInfo: {},
|
|
547
603
|
// Rate-limit data is projected only for the displayed session/vendor.
|
|
548
604
|
rateLimitState: {},
|
|
549
|
-
// How Claude sessions open: "gui" (default) or "tui". The server sends
|
|
550
|
-
// claude_open_mode_changed on connect; this seeds it beforehand so the
|
|
551
|
-
// new-session menu doesn't flash the TUI-only entry.
|
|
552
|
-
claudeOpenMode: "gui",
|
|
553
605
|
currentMode: "default",
|
|
554
606
|
effectivePermissionMode: null,
|
|
555
607
|
permissionCapabilities: { auto: false, mcpOverride: false },
|
|
@@ -655,14 +707,18 @@ import { initDebate, handleDebatePreparing, handleDebateStarted, handleDebateRes
|
|
|
655
707
|
// mcp-ui.js / etc.) attach click handlers by ID.
|
|
656
708
|
initToolPalettes();
|
|
657
709
|
initProjectLogs();
|
|
710
|
+
initYou();
|
|
711
|
+
initYouActivity();
|
|
658
712
|
initIssues();
|
|
659
713
|
initIssuesContext();
|
|
660
714
|
initIssueLinks();
|
|
661
715
|
initScheduledTasks();
|
|
716
|
+
initDebatesWorkbench();
|
|
662
717
|
initSidebar(sidebarCtx);
|
|
663
718
|
var wsGetter = function () { return _getWsRef(); };
|
|
664
719
|
initMateSidebar(wsGetter);
|
|
665
720
|
initMateKnowledge(wsGetter);
|
|
721
|
+
initMateKnowledgeWorkbench();
|
|
666
722
|
initMateMemory(wsGetter, { onShow: function () { hideKnowledge(); hideNotes(); } });
|
|
667
723
|
initCommandPalette({
|
|
668
724
|
switchProject: function (slug) { switchProject(slug); },
|
|
@@ -936,7 +992,7 @@ import { initDebate, handleDebatePreparing, handleDebateStarted, handleDebateRes
|
|
|
936
992
|
var m = location.pathname.match(/^\/p\/([a-z0-9_-]+)/);
|
|
937
993
|
var newSlug = m ? m[1] : null;
|
|
938
994
|
if (!newSlug) {
|
|
939
|
-
|
|
995
|
+
showProjectsHub(true);
|
|
940
996
|
return;
|
|
941
997
|
}
|
|
942
998
|
rememberHomePrimarySurface("project", newSlug);
|
|
@@ -1073,9 +1129,7 @@ import { initDebate, handleDebatePreparing, handleDebateStarted, handleDebateRes
|
|
|
1073
1129
|
|
|
1074
1130
|
// --- Admin (multi-user mode) ---
|
|
1075
1131
|
// isMultiUserMode, isHeadlessMode, myUserId -> store
|
|
1076
|
-
initAdmin(
|
|
1077
|
-
get projectList() { return getCachedProjects(); },
|
|
1078
|
-
});
|
|
1132
|
+
initAdmin();
|
|
1079
1133
|
fetch("/api/me").then(function (r) { return r.json(); }).then(function (d) {
|
|
1080
1134
|
if (d.multiUser) {
|
|
1081
1135
|
store.set({ isMultiUserMode: true });
|
|
@@ -1096,6 +1150,7 @@ import { initDebate, handleDebatePreparing, handleDebateStarted, handleDebateRes
|
|
|
1096
1150
|
}
|
|
1097
1151
|
initCursorToggle();
|
|
1098
1152
|
initDefaultAi();
|
|
1153
|
+
initAccountIsland();
|
|
1099
1154
|
// Apply RBAC UI gating
|
|
1100
1155
|
var _perms = store.get('permissions');
|
|
1101
1156
|
if (_perms) {
|
|
@@ -1156,35 +1211,10 @@ import { initDebate, handleDebatePreparing, handleDebateStarted, handleDebateRes
|
|
|
1156
1211
|
});
|
|
1157
1212
|
|
|
1158
1213
|
// --- Server Settings ---
|
|
1159
|
-
initServerSettings(
|
|
1160
|
-
get ws() { return _getWsRef(); },
|
|
1161
|
-
get projectName() { return store.get('projectName'); },
|
|
1162
|
-
get currentSlug() { return store.get('currentSlug'); },
|
|
1163
|
-
wsPath: wsPath,
|
|
1164
|
-
get currentModels() { return store.get('currentModels'); },
|
|
1165
|
-
set currentModels(v) { store.set({ currentModels: v }); },
|
|
1166
|
-
get currentModel() { return store.get('currentModel'); },
|
|
1167
|
-
get currentMode() { return store.get('currentMode'); },
|
|
1168
|
-
get currentEffort() { return store.get('currentEffort'); },
|
|
1169
|
-
get currentBetas() { return store.get('currentBetas'); },
|
|
1170
|
-
get currentThinking() { return store.get('currentThinking'); },
|
|
1171
|
-
get currentThinkingBudget() { return store.get('currentThinkingBudget'); },
|
|
1172
|
-
setContextView: function (v) { _panSetContextView(v); },
|
|
1173
|
-
applyContextView: function (v) { _panApplyContextView(v); },
|
|
1174
|
-
});
|
|
1214
|
+
initServerSettings();
|
|
1175
1215
|
|
|
1176
1216
|
// --- Project Settings ---
|
|
1177
|
-
initProjectSettings(
|
|
1178
|
-
get ws() { return _getWsRef(); },
|
|
1179
|
-
get connected() { return store.get('connected'); },
|
|
1180
|
-
get currentModels() { return store.get('currentModels'); },
|
|
1181
|
-
get currentModel() { return store.get('currentModel'); },
|
|
1182
|
-
get currentMode() { return store.get('currentMode'); },
|
|
1183
|
-
get currentEffort() { return store.get('currentEffort'); },
|
|
1184
|
-
get currentBetas() { return store.get('currentBetas'); },
|
|
1185
|
-
get currentThinking() { return store.get('currentThinking'); },
|
|
1186
|
-
get currentThinkingBudget() { return store.get('currentThinkingBudget'); },
|
|
1187
|
-
}, getEmojiCategories());
|
|
1217
|
+
initProjectSettings(getEmojiCategories());
|
|
1188
1218
|
|
|
1189
1219
|
// --- QR code ---
|
|
1190
1220
|
initQrCode();
|
|
@@ -1332,18 +1362,6 @@ import { initDebate, handleDebatePreparing, handleDebateStarted, handleDebateRes
|
|
|
1332
1362
|
function handleSkillInstallWs(msg) { _siHandleSkillInstallWs(msg); }
|
|
1333
1363
|
|
|
1334
1364
|
|
|
1335
|
-
// Debate button in mate sidebar (only visible in DM mode)
|
|
1336
|
-
var debateBtn = document.getElementById("mate-debate-btn");
|
|
1337
|
-
if (debateBtn) {
|
|
1338
|
-
debateBtn.addEventListener("click", function () {
|
|
1339
|
-
var contextMessages = dmMessageCache.map(function (m) {
|
|
1340
|
-
return { text: m.text, isMate: m.from !== store.get('myUserId') };
|
|
1341
|
-
});
|
|
1342
|
-
openDebateModal({ dmContext: contextMessages });
|
|
1343
|
-
});
|
|
1344
|
-
}
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
1365
|
// --- Debate UI (delegated to app-debate-ui.js) ---
|
|
1348
1366
|
// debateStickyState, debateHandRaiseOpen, debateFloorMode, debateConcludeMode, debateEndedMode -> modules/app-debate-ui.js
|
|
1349
1367
|
function showDebateConcludeConfirm(msg) { _debShowDebateConcludeConfirm(msg); }
|
|
@@ -1408,23 +1426,13 @@ import { initDebate, handleDebatePreparing, handleDebateStarted, handleDebateRes
|
|
|
1408
1426
|
initProjects();
|
|
1409
1427
|
|
|
1410
1428
|
// --- Home Hub module ---
|
|
1411
|
-
|
|
1412
|
-
|
|
1429
|
+
initProjectMateNavigation();
|
|
1430
|
+
initProjectSessionNavigation();
|
|
1431
|
+
initProjectMateCreationWorkspace();
|
|
1432
|
+
initProjectDebatePlanningWorkspace();
|
|
1413
1433
|
initProjectsHub();
|
|
1414
1434
|
initHomeSurfaceBoot();
|
|
1415
1435
|
|
|
1416
|
-
// Mates live on the home hub now, so keep that pane and the C button
|
|
1417
|
-
// badge in sync with the mate list, unread DMs, and mention activity.
|
|
1418
|
-
store.subscribe(function (state, prev) {
|
|
1419
|
-
if (state.cachedMatesList !== prev.cachedMatesList || state.dmUnread !== prev.dmUnread) {
|
|
1420
|
-
renderHomeMateSwitcher();
|
|
1421
|
-
updateHomeIconBadge();
|
|
1422
|
-
}
|
|
1423
|
-
});
|
|
1424
|
-
onMentionActiveChange(function () {
|
|
1425
|
-
renderHomeMateSwitcher();
|
|
1426
|
-
});
|
|
1427
|
-
updateHomeIconBadge();
|
|
1428
1436
|
|
|
1429
1437
|
// --- DM module ---
|
|
1430
1438
|
initDm();
|