clay-server 5.6.0-beta.4 → 5.7.0-beta.1
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/lib/clay-product-control.js +2 -1
- package/lib/daemon.js +12 -0
- package/lib/mcp-agent-management.js +98 -0
- package/lib/mcp-agent-tools.js +4 -3
- package/lib/mcp-local-configuration.js +20 -0
- package/lib/mcp-management-service.js +96 -0
- package/lib/mcp-remote-connections.js +127 -35
- package/lib/mcp-settings-navigation.js +34 -0
- package/lib/mcp-xcode.js +43 -0
- package/lib/project-admin-overview.js +2 -2
- package/lib/project-mcp.js +28 -6
- package/lib/project-ownership-diagnostics.js +37 -0
- package/lib/project-ownership-recovery.js +59 -0
- package/lib/project-ownership.js +1 -34
- package/lib/public/app.js +3 -0
- package/lib/public/css/mcp-connections.css +15 -0
- package/lib/public/css/mcp-skills-workbench.css +6 -4
- package/lib/public/css/project-admin-overview.css +4 -0
- package/lib/public/css/project-settings-modal.css +8 -0
- package/lib/public/css/settings-shell.css +42 -0
- package/lib/public/index.html +4 -4
- package/lib/public/modules/clay-tool-presentation.js +7 -0
- package/lib/public/modules/extension-settings.js +1 -1
- package/lib/public/modules/mcp-connection-view.js +52 -24
- package/lib/public/modules/mcp-skills-workbench.js +10 -3
- package/lib/public/modules/mcp-ui.js +40 -11
- package/lib/public/modules/mcp-xcode-view.js +42 -0
- package/lib/public/modules/project-admin-overview.js +9 -0
- package/lib/public/modules/project-ownership-recovery.js +56 -0
- package/lib/public/modules/project-session-visibility-settings.js +1 -1
- package/lib/public/modules/project-settings-access.js +91 -0
- package/lib/public/modules/project-settings-environment.js +3 -2
- package/lib/public/modules/project-settings.js +39 -5
- package/lib/public/modules/settings-project-tree.js +74 -0
- package/lib/public/modules/settings-shell-view.js +3 -1
- package/lib/public/modules/settings-shell.js +3 -2
- package/lib/public/pane-assets/{app-QR6W64PK.js → app-KYK2HXZR.js} +1 -1
- package/lib/public/pane-assets/chunk-3CGVMON5.js +1 -0
- package/lib/public/pane-assets/{chunk-YDQZXMHJ.js → chunk-3WQWIQ53.js} +1 -1
- package/lib/public/pane-assets/{chunk-I5RM7KNO.js → chunk-42POZKMA.js} +1 -1
- package/lib/public/pane-assets/chunk-53PJD7FQ.js +1 -0
- package/lib/public/pane-assets/{chunk-HXD34AZT.js → chunk-5525OCE4.js} +1 -1
- package/lib/public/pane-assets/{chunk-K3AFWB4T.js → chunk-6WHHBK62.js} +100 -100
- package/lib/public/pane-assets/{chunk-H6RI6IG5.js → chunk-7DMFCL3J.js} +1 -1
- package/lib/public/pane-assets/chunk-7IDJFDUF.js +1 -0
- package/lib/public/pane-assets/chunk-C4BC5QKM.js +1 -0
- package/lib/public/pane-assets/{chunk-OHKQX2VV.js → chunk-G2OD6CYE.js} +1 -1
- package/lib/public/pane-assets/{chunk-TUZOISN6.js → chunk-H2Z5IANY.js} +1 -1
- package/lib/public/pane-assets/{chunk-4KCNVBBD.js → chunk-I74MAWWL.js} +1 -1
- package/lib/public/pane-assets/{chunk-UBGZO6GV.js → chunk-IPEGITRJ.js} +1 -1
- package/lib/public/pane-assets/{chunk-25X3V6RW.js → chunk-NTWCEBHU.js} +1 -1
- package/lib/public/pane-assets/{chunk-KLRVHJC5.js → chunk-NZYCUCTU.js} +1 -1
- package/lib/public/pane-assets/chunk-OX66WEZB.js +1 -0
- package/lib/public/pane-assets/{chunk-WI7YYJ5R.js → chunk-SDEVOBXA.js} +1 -1
- package/lib/public/pane-assets/chunk-TA6KA3QG.js +1 -0
- package/lib/public/pane-assets/chunk-TDKHZ2NU.js +1 -0
- package/lib/public/pane-assets/{chunk-H3BOT3SB.js → chunk-UEQM5YNB.js} +1 -1
- package/lib/public/pane-assets/{chunk-IIZZTDLB.js → chunk-WBLXJD4Q.js} +1 -1
- package/lib/public/pane-assets/{chunk-TKD25TLY.js → chunk-YZAEN74U.js} +1 -1
- package/lib/public/pane-assets/chunk-ZBCR4WTM.js +1 -0
- package/lib/public/pane-assets/manifest.json +408 -404
- package/lib/public/pane-assets/style-WRLOVB6B.css +1 -0
- package/lib/server-project-ownership.js +39 -0
- package/lib/server.js +5 -0
- package/package.json +1 -1
- package/lib/public/pane-assets/chunk-AKFJO7SA.js +0 -1
- package/lib/public/pane-assets/chunk-DX7R6GRL.js +0 -1
- package/lib/public/pane-assets/chunk-F33TBKP2.js +0 -1
- package/lib/public/pane-assets/chunk-PTZ2QTNA.js +0 -1
- package/lib/public/pane-assets/chunk-QWNMLSVA.js +0 -1
- package/lib/public/pane-assets/chunk-VG32EEIQ.js +0 -1
- package/lib/public/pane-assets/chunk-W2W4CPO7.js +0 -1
- package/lib/public/pane-assets/chunk-XX2GY7T5.js +0 -1
- package/lib/public/pane-assets/style-BCUGGAD3.css +0 -1
package/lib/project-ownership.js
CHANGED
|
@@ -1,44 +1,11 @@
|
|
|
1
1
|
// Ownership recovery changes project metadata only; session owners stay intact.
|
|
2
|
-
var fs = require("fs");
|
|
3
|
-
var path = require("path");
|
|
4
2
|
|
|
5
3
|
function isPersonal(project) {
|
|
6
4
|
return project.isMate === true || /^mate-/.test(project.slug || "");
|
|
7
5
|
}
|
|
8
6
|
|
|
9
7
|
function verifiedPrivateOwner(project, accounts, resolveIdentity) {
|
|
10
|
-
|
|
11
|
-
var stat;
|
|
12
|
-
try {
|
|
13
|
-
root = fs.realpathSync(project.path);
|
|
14
|
-
if (root !== path.resolve(project.path)) return null;
|
|
15
|
-
stat = fs.statSync(root);
|
|
16
|
-
} catch (e) { return null; }
|
|
17
|
-
var matches = [];
|
|
18
|
-
var identities = [];
|
|
19
|
-
for (var i = 0; i < accounts.length; i++) {
|
|
20
|
-
var account = accounts[i];
|
|
21
|
-
if (!account.linuxUser) continue;
|
|
22
|
-
try {
|
|
23
|
-
var identity = resolveIdentity(account.linuxUser);
|
|
24
|
-
var home = fs.realpathSync(identity.home);
|
|
25
|
-
if (!Number.isInteger(identity.uid) || identity.uid < 0 || fs.statSync(home).uid !== identity.uid || home !== path.resolve(identity.home) || home === path.parse(home).root) continue;
|
|
26
|
-
identities.push({ account: account, uid: identity.uid, home: home });
|
|
27
|
-
} catch (e) { return null; }
|
|
28
|
-
}
|
|
29
|
-
for (var j = 0; j < identities.length; j++) {
|
|
30
|
-
var candidate = identities[j];
|
|
31
|
-
var relative = path.relative(candidate.home, root);
|
|
32
|
-
if (candidate.uid !== stat.uid || relative === ".." || relative.indexOf(".." + path.sep) === 0 || path.isAbsolute(relative)) continue;
|
|
33
|
-
// A shared UID or overlapping home is never authoritative evidence.
|
|
34
|
-
var ambiguous = identities.some(function (other) {
|
|
35
|
-
if (other === candidate) return false;
|
|
36
|
-
var overlap = path.relative(other.home, root);
|
|
37
|
-
return other.uid === candidate.uid || (!path.isAbsolute(overlap) && overlap !== ".." && overlap.indexOf(".." + path.sep) !== 0);
|
|
38
|
-
});
|
|
39
|
-
if (!ambiguous) matches.push(candidate.account.id);
|
|
40
|
-
}
|
|
41
|
-
return matches.length === 1 ? matches[0] : null;
|
|
8
|
+
return require('./project-ownership-diagnostics').inspectPrivateOwner(project, accounts, resolveIdentity).ownerId;
|
|
42
9
|
}
|
|
43
10
|
|
|
44
11
|
function repair(config, accounts, persist, resolveIdentity) {
|
package/lib/public/app.js
CHANGED
|
@@ -679,6 +679,9 @@ import { initDebate, handleDebatePreparing, handleDebateStarted, handleDebateRes
|
|
|
679
679
|
myUserId: null,
|
|
680
680
|
contextViewPreferenceState: { mode: "off", canonicalMode: "off", preferencePresent: false, loading: false, saving: false, requestId: null, saveRequestId: null, pendingSaves: [], accountId: null, serverEpoch: null, rejectedEpoch: null, canonicalRevision: 0, error: "" },
|
|
681
681
|
contextViewOverride: null,
|
|
682
|
+
settingsProjectTree: { expanded: {}, query: '' },
|
|
683
|
+
projectSettingsAccess: null,
|
|
684
|
+
ownershipRecoveryPanels: {},
|
|
682
685
|
isMultiUserMode: false,
|
|
683
686
|
dmUnread: {},
|
|
684
687
|
dmRemovedUsers: {},
|
|
@@ -81,6 +81,21 @@
|
|
|
81
81
|
.mc-command code { display:block; white-space:pre-wrap; overflow-wrap:anywhere; margin-bottom:8px; font-size:11px; }
|
|
82
82
|
.mc-working { display:flex; gap:8px; align-items:center; color:var(--text-muted); font-size:12px; margin-top:16px; }
|
|
83
83
|
.mc-working svg { animation:mc-spin 1s linear infinite; }
|
|
84
|
+
.mc-xcode .mc-heading { margin:8px 0 18px; }
|
|
85
|
+
.mc-xcode .mc-heading h2 { font-size:18px; }
|
|
86
|
+
.mc-xcode .mc-emblem { padding:8px; border-radius:8px; }
|
|
87
|
+
.mc-xcode .mc-emblem svg { width:20px; height:20px; }
|
|
88
|
+
.mc-xcode .mc-footnote { margin:12px 0; }
|
|
89
|
+
.mc-xcode-steps { margin:22px 0 0; }
|
|
90
|
+
.mc-xcode-steps li { padding-bottom:14px; }
|
|
91
|
+
.mc-xcode-steps p { margin:4px 0 0; font-size:12px; }
|
|
92
|
+
.mc-xcode .mc-detail-actions { margin-top:16px; }
|
|
93
|
+
.mc-extension .mc-heading { margin:8px 0 18px; }
|
|
94
|
+
.mc-extension .mc-heading h2 { font-size:18px; }
|
|
95
|
+
.mc-extension .mc-emblem { padding:8px; border-radius:8px; }
|
|
96
|
+
.mc-extension .mc-emblem svg { width:20px; height:20px; }
|
|
97
|
+
.mc-extension > .mc-status { margin-bottom:16px; }
|
|
98
|
+
.mc-extension > .mc-button { margin-top:16px; }
|
|
84
99
|
@keyframes mc-spin { to { transform:rotate(360deg); } }
|
|
85
100
|
@media (prefers-reduced-motion:reduce) { .mc-working svg { animation:none; } .mc-switch>span { transition:none; } }
|
|
86
101
|
@media (max-width:480px) { .mc-screen { padding:0 0 20px; } .mc-empty { padding:40px 12px; } .mc-heading h2 { font-size:21px; } }
|
|
@@ -7,12 +7,12 @@
|
|
|
7
7
|
.mcp-skills-header svg { width:15px; height:15px; }
|
|
8
8
|
.mcp-skills-header button { display:flex; padding:6px; background:transparent; border:0; border-radius:6px; color:var(--text-muted); cursor:pointer; }
|
|
9
9
|
.mcp-skills-header button:hover { background:var(--bg-alt); color:var(--text); }
|
|
10
|
-
.mcp-skills-tabs { display:flex; padding:0
|
|
11
|
-
.mcp-skills-tabs button { padding:13px 0 11px; background:none; border:0; border-bottom:2px solid transparent; color:var(--text-muted); font:inherit; font-size:12px; cursor:pointer; }
|
|
10
|
+
.mcp-skills-tabs { display:flex; padding:0 12px; border-bottom:1px solid var(--border); gap:clamp(8px,2vw,18px); flex-shrink:0; overflow-x:auto; }
|
|
11
|
+
.mcp-skills-tabs button { padding:13px 0 11px; background:none; border:0; border-bottom:2px solid transparent; color:var(--text-muted); font:inherit; font-size:12px; cursor:pointer; flex-shrink:0; white-space:nowrap; }
|
|
12
12
|
.mcp-skills-tabs button[aria-selected="true"] { color:var(--text); border-bottom-color:var(--accent); }
|
|
13
13
|
.mcp-skills-tabs button[hidden] { display:none; }
|
|
14
|
-
#mcp-skills-workbench #skills-modal,#mcp-skills-workbench #mcp-modal { position:static; inset:auto; z-index:auto; display:flex; flex:1; min-height:0; align-items:stretch; justify-content:stretch; }
|
|
15
|
-
#mcp-skills-workbench #skills-modal.hidden,#mcp-skills-workbench #mcp-modal.hidden { display:none; }
|
|
14
|
+
#mcp-skills-workbench #skills-modal,#mcp-skills-workbench #mcp-modal { position:static; inset:auto; z-index:auto; display:flex; flex:1; min-height:0; min-width:0; align-items:stretch; justify-content:stretch; }
|
|
15
|
+
#mcp-skills-workbench #skills-modal.hidden,#mcp-skills-workbench #mcp-modal.hidden.hidden { display:none; }
|
|
16
16
|
#mcp-skills-workbench .skills-dialog,#mcp-skills-workbench .mcp-dialog { width:100%; max-width:none; min-width:0; height:100%; max-height:none; padding:0; display:flex; flex-direction:column; overflow:hidden; }
|
|
17
17
|
#mcp-skills-workbench .mcp-header,#mcp-skills-workbench #skills-modal-close { display:none; }
|
|
18
18
|
#mcp-skills-workbench .skills-header { padding:12px 16px 0; }
|
|
@@ -49,3 +49,5 @@
|
|
|
49
49
|
#mcp-skills-workbench .ext-feature-list { margin:0 0 16px; padding-left:18px; }
|
|
50
50
|
#mcp-skills-workbench .ext-feature-list li { margin-bottom:8px; line-height:1.6; }
|
|
51
51
|
#mcp-skills-workbench .ext-feature-list strong { color:var(--text); font-weight:500; }
|
|
52
|
+
|
|
53
|
+
#mcp-skills-workbench .ext-pill-wrap[hidden] { display:none; }
|
|
@@ -40,3 +40,7 @@
|
|
|
40
40
|
.project-admin-role { font-size: 10px; }
|
|
41
41
|
.project-admin-page #icon-strip { display: flex; width: 60px; }
|
|
42
42
|
}
|
|
43
|
+
.ownership-recovery { max-width:700px; margin-top:24px; padding-top:20px; border-top:1px solid var(--border); font-size:13px; line-height:1.5; }
|
|
44
|
+
.ownership-recovery h3 { font-size:14px; }
|
|
45
|
+
.ownership-recovery button { min-height:32px; margin:4px 8px 4px 0; padding:4px 10px; border:1px solid var(--border); border-radius:8px; color:var(--text); background:var(--bg-alt); cursor:pointer; font:inherit; }
|
|
46
|
+
.ownership-review { padding:12px; border:1px solid var(--border); border-radius:8px; }
|
|
@@ -54,3 +54,11 @@
|
|
|
54
54
|
#project-settings .ps-project-path { font-size: 13px; font-family: var(--font-mono, monospace); overflow-wrap: anywhere; margin: 0 0 8px; color: var(--text); user-select: text; }
|
|
55
55
|
|
|
56
56
|
#project-settings .ps-project-icon .ps-icon-preview svg { width: 28px; height: 28px; color: var(--text-muted); }
|
|
57
|
+
#project-settings .ps-access-editor { padding:12px 0; }
|
|
58
|
+
#project-settings .ps-access-editor h3 { margin:20px 0 8px; font-size:14px; }
|
|
59
|
+
#project-settings .ps-access-editor select { max-width:100%; min-height:36px; border:1px solid var(--border); border-radius:8px; background:var(--bg); color:var(--text); padding:0 8px; }
|
|
60
|
+
#project-settings .ps-access-member { display:flex; gap:8px; align-items:center; min-height:32px; font-size:13px; }
|
|
61
|
+
#project-settings .ownership-recovery { border-top:1px solid var(--border-subtle); margin-top:16px; padding-top:16px; }
|
|
62
|
+
#project-settings .ownership-recovery p { font-size:13px; line-height:1.5; overflow-wrap:anywhere; }
|
|
63
|
+
.ownership-review { margin-top:12px; padding:12px; border:1px solid var(--border); border-radius:8px; }
|
|
64
|
+
.ownership-review button + button { margin-left:8px; }
|
|
@@ -114,3 +114,45 @@
|
|
|
114
114
|
#user-settings [data-section="us-providers"] .us-integration-state { grid-column:2; grid-row:2; }
|
|
115
115
|
#user-settings [data-section="us-providers"] .us-voice-row-controls > button { grid-column:3; grid-row:1 / span 2; }
|
|
116
116
|
}
|
|
117
|
+
|
|
118
|
+
/* Project navigation keeps the hierarchy visible; worktrees require disclosure. */
|
|
119
|
+
.settings-project-scope .settings-shell-nav { flex-basis:280px; width:280px; }
|
|
120
|
+
.settings-project-scope #settings-page-nav, .settings-project-scope #settings-page-select { display:none !important; }
|
|
121
|
+
.settings-project-scope #settings-project-picker > select, .settings-project-scope #settings-project-picker > .settings-picker { display:none !important; }
|
|
122
|
+
#settings-project-tree > input { box-sizing:border-box; width:100%; height:36px; padding:0 10px; margin-bottom:12px; border:1px solid var(--border); border-radius:8px; background:var(--bg); color:var(--text); font:inherit; font-size:13px; }
|
|
123
|
+
.settings-project-row { display:flex; align-items:center; min-width:0; }
|
|
124
|
+
.settings-project-expand, .settings-project-expand-spacer { flex:0 0 24px; width:24px; }
|
|
125
|
+
.settings-project-expand { height:32px; border:0; border-radius:6px; background:none; color:var(--text-muted); cursor:pointer; font-size:20px; }
|
|
126
|
+
.settings-project-expand:hover, .settings-project-item:hover { background:rgba(var(--overlay-rgb),.05); }
|
|
127
|
+
.settings-project-item { display:flex; flex:1; align-items:center; gap:8px; min-width:0; min-height:36px; padding:6px 8px; border:0; border-radius:8px; background:none; color:var(--text); text-align:left; font:inherit; font-size:13px; cursor:pointer; }
|
|
128
|
+
.settings-project-label { min-width:0; flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
|
|
129
|
+
.settings-project-item small { flex:0 0 auto; max-width:100px; color:var(--text-muted); font-size:11px; }
|
|
130
|
+
.settings-project-item.active { background:rgba(var(--overlay-rgb),.08); font-weight:600; }
|
|
131
|
+
.settings-worktree-row { padding-left:20px; }
|
|
132
|
+
#project-settings .ps-target-heading h2 { margin:0 0 4px; font-size:20px; overflow-wrap:anywhere; }
|
|
133
|
+
#project-settings .ps-target-heading { margin-bottom:28px; }
|
|
134
|
+
#project-settings .ps-section { display:block; margin-bottom:32px; scroll-margin-top:16px; }
|
|
135
|
+
#project-settings .ps-section h2 { font-size:14px; margin-bottom:10px; }
|
|
136
|
+
#project-settings .ps-project-identity { gap:16px; padding-top:0; }
|
|
137
|
+
#project-settings .ps-project-mark, #project-settings .ps-project-icon { width:48px; }
|
|
138
|
+
#project-settings .ps-project-mark { flex-basis:48px; }
|
|
139
|
+
#project-settings .ps-project-icon { height:48px; }
|
|
140
|
+
@media(max-width:800px) {
|
|
141
|
+
.settings-project-scope .settings-shell-nav { flex-basis:auto; width:100%; max-height:32vh; }
|
|
142
|
+
.settings-project-scope .settings-shell-nav-inner { display:block; }
|
|
143
|
+
.settings-project-scope .settings-project-picker { display:block; }
|
|
144
|
+
.settings-project-item { min-height:40px; }
|
|
145
|
+
}
|
|
146
|
+
@media(max-width:600px) {
|
|
147
|
+
#project-settings .ps-env-row { flex-wrap:wrap; }
|
|
148
|
+
#project-settings .ps-env-key, #project-settings .ps-env-val { flex:1 1 100%; min-width:0; width:100%; box-sizing:border-box; }
|
|
149
|
+
#project-settings .ps-env-header { flex-wrap:wrap; }
|
|
150
|
+
#project-settings .ps-env-header .ps-save-status { width:100%; }
|
|
151
|
+
}
|
|
152
|
+
#settings-project-tree { min-width:0; max-width:100%; }
|
|
153
|
+
.settings-project-row { width:100%; box-sizing:border-box; }
|
|
154
|
+
.settings-project-item { overflow:hidden; }
|
|
155
|
+
.settings-project-item small { max-width:88px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
|
|
156
|
+
#project-settings .ps-target-heading { display:flex; align-items:center; justify-content:space-between; gap:16px; }
|
|
157
|
+
#project-settings .ps-target-heading > div { min-width:0; }
|
|
158
|
+
#project-settings .ps-target-heading > a { flex-shrink:0; text-decoration:none; }
|
package/lib/public/index.html
CHANGED
|
@@ -693,7 +693,7 @@ body { background: transparent; color: inherit; }
|
|
|
693
693
|
<div class="ps-modal">
|
|
694
694
|
<div class="project-settings-layout">
|
|
695
695
|
<div class="project-settings-content"><div class="project-settings-content-inner">
|
|
696
|
-
<div class="settings-empty" id="ps-empty" hidden><h2 tabindex="-1">No project selected</h2><p id="ps-empty-text" class="settings-hint"></p></div>
|
|
696
|
+
<header class="ps-target-heading"><div><h2 id="ps-target-title"></h2><p class="settings-hint" id="ps-target-context"></p></div><a class="settings-btn-sm" id="ps-open-project">Open project</a></header><div class="settings-empty" id="ps-empty" hidden><h2 tabindex="-1">No project selected</h2><p id="ps-empty-text" class="settings-hint"></p></div>
|
|
697
697
|
<section class="ps-section active" data-section="profile">
|
|
698
698
|
<h2>General</h2><p class="ps-section-desc">Identify this project in your workspace.</p>
|
|
699
699
|
<div class="ps-project-identity">
|
|
@@ -706,7 +706,7 @@ body { background: transparent; color: inherit; }
|
|
|
706
706
|
<div id="ps-emoji-picker-anchor"></div>
|
|
707
707
|
<div class="ps-project-location"><h3>Project folder</h3><p id="ps-project-path" class="ps-project-path"></p><p class="settings-hint">The working directory for this project.</p></div>
|
|
708
708
|
</section>
|
|
709
|
-
<section class="ps-section" data-section="access"><h2>Access</h2><p class="ps-section-desc" id="ps-access-note"></p><div class="settings-card">
|
|
709
|
+
<section class="ps-section" data-section="access"><h2>Access</h2><p class="ps-section-desc" id="ps-access-note"></p><div id="ps-access-management"></div><div class="settings-card">
|
|
710
710
|
<div class="settings-field" id="ps-session-visibility-default-field" style="display:none">
|
|
711
711
|
<label class="settings-label" for="ps-session-visibility-default">New session visibility</label>
|
|
712
712
|
<div class="settings-hint">Applies to new project conversations and Issue Start work sessions. Existing sessions, hidden work, and delegated workflows keep their current visibility.</div>
|
|
@@ -721,7 +721,7 @@ body { background: transparent; color: inherit; }
|
|
|
721
721
|
<section class="ps-section" data-section="environment">
|
|
722
722
|
<h2>Environment</h2>
|
|
723
723
|
<p class="ps-section-desc">Variables for newly created coding-agent processes in this project; active processes, terminals, the daemon, and the browser keep their current environment. Shared variables are managed in Server Settings.</p>
|
|
724
|
-
<div class="ps-env-header"><button class="settings-btn-sm" id="ps-env-add-btn" disabled><i data-lucide="plus"></i> Add variable</button><button class="settings-btn-sm" id="ps-env-save" disabled>Save changes</button><span class="ps-save-status" id="ps-env-save-status" role="status"></span></div>
|
|
724
|
+
<div class="ps-env-header"><button class="settings-btn-sm" id="ps-env-add-btn" disabled><i data-lucide="plus"></i> Add variable</button><button class="settings-btn-sm" id="ps-env-save" disabled>Save changes</button><button class="settings-btn-sm" id="ps-env-retry" hidden>Retry loading variables</button><span class="ps-save-status" id="ps-env-save-status" role="status"></span></div>
|
|
725
725
|
<div class="ps-env-list" id="ps-env-list"></div>
|
|
726
726
|
</section>
|
|
727
727
|
</div></div>
|
|
@@ -803,7 +803,7 @@ body { background: transparent; color: inherit; }
|
|
|
803
803
|
<nav class="settings-shell-nav" aria-label="Settings navigation">
|
|
804
804
|
<div class="settings-shell-nav-inner">
|
|
805
805
|
<div class="settings-scope-head"><strong id="settings-scope-title">Settings</strong><small id="settings-server-name" hidden></small><span id="settings-scope-hint" class="settings-scope-hint"></span></div>
|
|
806
|
-
<div class="settings-project-picker" id="settings-project-picker" hidden><
|
|
806
|
+
<div class="settings-project-picker" id="settings-project-picker" hidden><div id="settings-project-tree"></div><select id="settings-project-select" class="settings-nav-dropdown" aria-label="Project" hidden></select></div>
|
|
807
807
|
<select id="settings-page-select" class="settings-nav-dropdown" aria-label="Settings page"></select>
|
|
808
808
|
<div class="settings-shell-nav-items" id="settings-page-nav"></div>
|
|
809
809
|
</div>
|
|
@@ -11,6 +11,13 @@ function register(server, name, running, completed, noun, subject, rule) {
|
|
|
11
11
|
function rows(server, entries) {
|
|
12
12
|
entries.forEach(function (entry) { register.apply(null, [server].concat(entry)); });
|
|
13
13
|
}
|
|
14
|
+
rows('clay-mcp-connections', [
|
|
15
|
+
['discover_mcp_connections', 'Checking MCP sources', 'MCP source check returned', 'MCP discovery'],
|
|
16
|
+
['propose_mcp_import', 'Requesting MCP import review', 'MCP import review returned', 'MCP import'],
|
|
17
|
+
['read_mcp_connections', 'Checking MCP connections', 'MCP connection check returned', 'MCP connections'],
|
|
18
|
+
['inspect_mcp_connection_change', 'Preparing MCP change review', 'MCP change prepared for review', 'MCP change'],
|
|
19
|
+
['apply_mcp_connection_change', 'Requesting MCP change approval', 'MCP change result returned', 'MCP change']
|
|
20
|
+
]);
|
|
14
21
|
rows('clay-you', [
|
|
15
22
|
['search_user_knowledge', 'Checking your preferences', 'Preferences checked', 'Preference search', 'query'],
|
|
16
23
|
['read_user_knowledge', 'Reading your preference', 'Preference read', 'Preference'],
|
|
@@ -40,7 +40,7 @@ export function initExtensionSettings() {
|
|
|
40
40
|
// Toggle popover
|
|
41
41
|
extPillBtn.addEventListener("click", function (e) {
|
|
42
42
|
e.stopPropagation();
|
|
43
|
-
openMcpSkillsWorkbench("
|
|
43
|
+
openMcpSkillsWorkbench("extension");
|
|
44
44
|
var expanded = extPopover.classList.toggle("visible");
|
|
45
45
|
extPillBtn.setAttribute("aria-expanded", String(expanded));
|
|
46
46
|
refreshIcons(extPopover);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { renderXcode } from './mcp-xcode-view.js';
|
|
1
2
|
import { enhanceSettingsSelects } from './settings-select.js';
|
|
2
3
|
import { discoveryView, credentialsView } from './mcp-discovery-view.js';
|
|
3
4
|
import { escapeHtml } from './utils.js';
|
|
@@ -19,21 +20,36 @@ function switchControl(row, busy) {
|
|
|
19
20
|
}
|
|
20
21
|
function rows(servers, busy) {
|
|
21
22
|
return '<div class="mc-list">' + servers.map(function (row) {
|
|
22
|
-
return '<div class="mc-row"><button type="button" class="mc-row-open" data-open="' + text(row.id) + '"><span class="mc-server-icon">' + iconHtml(row.source === 'url' ? 'globe' : 'monitor') + '</span><span class="mc-row-info"><strong>' + text(row.label || row.name) + '</strong><span>' + (row.source === 'url' ? 'Remote' : row.source === 'local' ? '
|
|
23
|
+
return '<div class="mc-row"><button type="button" class="mc-row-open" data-open="' + text(row.id) + '"><span class="mc-server-icon">' + iconHtml(row.source === 'url' ? 'globe' : 'monitor') + '</span><span class="mc-row-info"><strong>' + text(row.label || row.name) + '</strong><span>' + (row.source === 'url' ? 'Remote MCP' : row.source === 'local' ? 'Local MCP' : 'Client MCP') + ' · ' + row.toolCount + ' tools</span>' + status(row) + '</span></button>' + switchControl(row, busy) + '</div>';
|
|
23
24
|
}).join('') + '</div>';
|
|
24
25
|
}
|
|
25
26
|
function search(value, placeholder) { return '<label class="mc-search">' + iconHtml('search') + '<input type="search" data-search value="' + text(value) + '" placeholder="' + placeholder + '" aria-label="' + placeholder + '"></label>'; }
|
|
26
27
|
function listView(state) {
|
|
27
28
|
if (!state.loaded) return heading('Your connections', 'Loading your MCP servers…', 'cable');
|
|
28
|
-
if (!state.servers.length) return '<div class="mc-empty">' + heading('Connect tools to Clay', '
|
|
29
|
+
if (!state.servers.length) return '<div class="mc-empty">' + heading('Connect tools to Clay', 'Connect remote services or programs on the Clay Studio server.', 'cable') + button('Add connection', 'add', true, 'plus') + '</div>';
|
|
29
30
|
var servers = state.servers.filter(function (row) { return (row.label || row.name).toLowerCase().includes((state.search || '').toLowerCase()); });
|
|
30
|
-
return search(state.search, 'Search servers…') + '<div class="mc-section-heading"><h2>
|
|
31
|
+
return search(state.search, 'Search servers…') + '<div class="mc-section-heading"><h2>MCP connections</h2>' + button('Add', 'add', false, 'plus') + '</div>' + rows(servers, !!state.pending) + (!servers.length ? '<p class="mc-muted">No matching connections.</p>' : '') + '<p class="mc-footnote">Local and remote connections are available to your supported private sessions and Mates. Client MCP connections are enabled per project.</p>';
|
|
32
|
+
}
|
|
33
|
+
function choice(label, description, action, icon) {
|
|
34
|
+
return '<button type="button" class="mc-choice" data-action="' + action + '"><span class="mc-choice-icon">' + iconHtml(icon) + '</span><span><strong>' + label + '</strong><small>' + description + '</small></span>' + iconHtml('arrow-right') + '</button>';
|
|
31
35
|
}
|
|
32
36
|
function addView() {
|
|
33
|
-
return heading('Add connection', 'Choose
|
|
34
|
-
'
|
|
35
|
-
|
|
36
|
-
|
|
37
|
+
return heading('Add connection', 'Choose how to connect your MCP server.') + '<div class="mc-choices">' +
|
|
38
|
+
choice('Local MCP', 'Run an MCP server where Clay Studio is installed. No extension required.', 'local', 'monitor') +
|
|
39
|
+
choice('Remote MCP URL', 'Connect a hosted service using its MCP server address.', 'remote', 'globe') +
|
|
40
|
+
choice('Import vendor config', 'Import existing MCP settings from a supported coding agent.', 'discovery', 'folder-search') +
|
|
41
|
+
choice('Client MCP', 'Use MCP servers installed on the device you’re connecting from when Clay runs on another machine. Requires the Clay extension and local bridge.', 'client', 'puzzle') + '</div>';
|
|
42
|
+
}
|
|
43
|
+
function localView(state) {
|
|
44
|
+
var draft = state.localDraft || {};
|
|
45
|
+
return heading('Local MCP', 'Run an MCP server where Clay Studio is installed, under your authorized OS account. No browser extension is needed.', 'monitor') +
|
|
46
|
+
'<div class="mc-choices">' + choice('Xcode', 'Connect Xcode on the same Mac with guided setup.', 'xcode', 'hammer') + '</div>' +
|
|
47
|
+
'<div class="mc-section-heading"><h3>Custom MCP server</h3></div><form data-form="local" class="mc-form">' +
|
|
48
|
+
'<label>Name<input name="label" required maxlength="100" value="' + text(draft.label) + '" placeholder="My MCP server"></label>' +
|
|
49
|
+
'<label>Command<input name="command" required maxlength="4096" value="' + text(draft.command) + '" placeholder="npx" spellcheck="false"></label>' +
|
|
50
|
+
'<label>Arguments (JSON array)<input name="args" required maxlength="16384" value="' + text(draft.args === undefined ? '[]' : draft.args) + '" placeholder="["-y", "your-mcp-package"]" spellcheck="false"></label>' +
|
|
51
|
+
'<label>Working directory<input name="cwd" maxlength="4096" value="' + text(draft.cwd) + '" placeholder="Default: your OS account home" spellcheck="false"></label>' +
|
|
52
|
+
'<p class="mc-muted">Save creates a disabled connection. Enable it or use Test connection to start the program. Arguments are passed directly to the command.</p><button type="submit" class="mc-button mc-primary"' + (state.pending ? ' disabled' : '') + '>Save connection</button></form>';
|
|
37
53
|
}
|
|
38
54
|
function remoteView(state) {
|
|
39
55
|
return heading('Connect a remote server', 'Use the MCP address supplied by your service provider.', 'globe') +
|
|
@@ -41,12 +57,12 @@ function remoteView(state) {
|
|
|
41
57
|
'<p class="mc-muted">Public HTTPS servers are supported. You can sign in with Clay’s private browser if the service requires it.</p><button class="mc-button mc-primary" type="submit"' + (state.pending ? ' disabled' : '') + '>' + (state.pending ? 'Checking server…' : 'Continue') + '</button></form>';
|
|
42
58
|
}
|
|
43
59
|
function computerView(state) {
|
|
44
|
-
var servers = state.servers.filter(function (row) { return row.source === 'computer'; });
|
|
60
|
+
var servers = state.servers.filter(function (row) { return row.source === 'computer' && (row.label || row.name).toLowerCase().includes((state.search || '').toLowerCase()); });
|
|
45
61
|
var command = 'npx clay-mcp-bridge install ' + (state.extensionId || '<extension-id>');
|
|
46
|
-
return heading('
|
|
47
|
-
'<ol class="mc-steps"><li><span class="mc-step-marker">' + (state.extensionConnected ? iconHtml('check') : '1') + '</span><div><strong>Browser extension</strong><p>' + (state.extensionConnected ? 'Connected to this browser.' : 'Install Clay for Chrome, then refresh this page.') + '</p>' + (!state.extensionConnected ? button('Set up extension', 'setup', false, 'puzzle') : '') + '</div></li>' +
|
|
62
|
+
return heading('Client MCP', 'Use MCP servers installed on the device you’re connecting from when Clay runs on another machine. Requires the Clay extension and local bridge.', 'puzzle') +
|
|
63
|
+
(state.extensionConnected && state.hostConnected ? '<p class="mc-status" data-status="ready"><span aria-hidden="true"></span>Extension and local bridge connected</p>' : '<ol class="mc-steps"><li><span class="mc-step-marker">' + (state.extensionConnected ? iconHtml('check') : '1') + '</span><div><strong>Browser extension</strong><p>' + (state.extensionConnected ? 'Connected to this browser.' : 'Install Clay for Chrome, then refresh this page.') + '</p>' + (!state.extensionConnected ? button('Set up extension', 'setup', false, 'puzzle') : '') + '</div></li>' +
|
|
48
64
|
'<li><span class="mc-step-marker">' + (state.hostConnected ? iconHtml('check') : '2') + '</span><div><strong>Local bridge</strong><p>' + (state.hostConnected ? 'Connected to your computer.' : 'Run this command on your computer, then restart your browser.') + '</p>' + (!state.hostConnected ? '<div class="mc-command"><code>' + text(command) + '</code>' + button('Copy', 'copy', false) + '</div>' : '') + '</div></li>' +
|
|
49
|
-
'<li><span class="mc-step-marker">3</span><div><strong>Choose your tools</strong><p>Add servers from the extension popup. They appear here when connected.</p></div></li></ol>' + rows(servers, !!state.pending) + button('Refresh connections', 'refresh', false, 'refresh-cw');
|
|
65
|
+
'<li><span class="mc-step-marker">3</span><div><strong>Choose your tools</strong><p>Add servers from the extension popup. They appear here when connected.</p></div></li></ol>') + (state.servers.some(function (row) { return row.source === 'computer'; }) ? search(state.search, 'Search Client MCP servers…') : '<p class="mc-muted">Add MCP servers in the Chrome extension popup to see them here.</p>') + rows(servers, !!state.pending) + (state.servers.some(function (row) { return row.source === 'computer'; }) && !servers.length ? '<p class="mc-muted">No matching connections.</p>' : '') + button('Refresh connections', 'refresh', false, 'refresh-cw') + '<p class="mc-footnote">Enable these tools for this project. Keep the extension and local bridge connected while using them.</p>';
|
|
50
66
|
}
|
|
51
67
|
function permissionsView(row) {
|
|
52
68
|
var current = store.snap(), availability = mcpPermissionModeApplicability(current);
|
|
@@ -59,7 +75,7 @@ function detailView(state, row) {
|
|
|
59
75
|
var remote = row.source === 'url', local = row.source === 'local', managed = remote || local;
|
|
60
76
|
var html = heading(row.label || row.name, remote ? 'Remote MCP connection' : local ? 'MCP process on the Clay server' : 'Connected through your browser extension', remote ? 'globe' : 'monitor');
|
|
61
77
|
html += status(row) + '<div class="mc-enable"><span>' + (managed ? 'Enabled for your private sessions and Mates' : 'Enabled in this project') + '</span>' + switchControl(row, !!state.pending) + '</div>';
|
|
62
|
-
html += '<dl class="mc-metadata"><dt>Access</dt><dd>Your account only</dd><dt>' + (remote ? 'Server' : 'Location') + '</dt><dd>' + (remote ? text(row.url) : (local ? 'Clay
|
|
78
|
+
html += '<dl class="mc-metadata"><dt>Access</dt><dd>Your account only</dd><dt>' + (remote ? 'Server' : 'Location') + '</dt><dd>' + (remote ? text(row.url) : (local ? 'Clay Studio host · your account' : 'Accessing device · extension bridge')) + '</dd></dl>';
|
|
63
79
|
if (row.provenance) html += '<p class="mc-muted">Imported from ' + text(row.provenance.vendor + ' · ' + row.provenance.scope + ' · ' + row.provenance.file) + '</p>';
|
|
64
80
|
html += credentialsView(row);
|
|
65
81
|
if (row.error) html += '<div class="mc-alert" role="status">' + iconHtml('circle-alert') + '<span>' + text(row.error) + '</span></div>';
|
|
@@ -72,7 +88,7 @@ function detailView(state, row) {
|
|
|
72
88
|
var tools = (row.tools || []).filter(function (tool) { return (tool.name + ' ' + (tool.description || '')).toLowerCase().includes((state.search || '').toLowerCase()); });
|
|
73
89
|
html += '<div class="mc-tools">' + tools.map(function (tool) { return '<details><summary>' + text(tool.name) + '</summary><p>' + text(tool.description || 'No description provided.') + '</p><h4>Inputs</h4><pre>' + text(JSON.stringify(tool.inputSchema || {}, null, 2)) + '</pre></details>'; }).join('') + (!tools.length ? '<p class="mc-muted">' + (row.toolCount ? 'No matching tools.' : 'No tools available. Test the connection to refresh its catalog.') + '</p>' : '') + '</div>';
|
|
74
90
|
}
|
|
75
|
-
html += '<div class="mc-detail-actions">' + (managed ? button('Test connection', 'test', false, 'refresh-cw') + (!remote || row.status === 'auth_required' ? '' : button('Sign in again', 'signin', false, 'log-in')) : button('
|
|
91
|
+
html += '<div class="mc-detail-actions">' + (managed ? button('Test connection', 'test', false, 'refresh-cw') + (!remote || row.status === 'auth_required' ? '' : button('Sign in again', 'signin', false, 'log-in')) : button('Client MCP setup', 'client', false, 'monitor')) + '</div>';
|
|
76
92
|
if (managed) html += '<details class="mc-manage"><summary>Manage connection</summary><form data-form="rename" class="mc-form"><label>Name<input name="label" required maxlength="100" value="' + text(row.label) + '"></label><button type="submit" class="mc-button">Save name</button></form>' + button('Remove connection', 'remove', false, 'trash-2') + '</details>';
|
|
77
93
|
return html;
|
|
78
94
|
}
|
|
@@ -85,41 +101,48 @@ export function renderConnections(root, state, events) {
|
|
|
85
101
|
var searchFocused = focused && focused.hasAttribute('data-search');
|
|
86
102
|
var start = focused && focused.tagName === 'INPUT' ? focused.selectionStart : null;
|
|
87
103
|
var focusedName = focused && focused.name;
|
|
104
|
+
var focusedXcode = focused && focused.dataset.xcode;
|
|
88
105
|
var row = state.servers.find(function (item) { return item.id === state.selected; });
|
|
89
|
-
var screen = state.screen || 'list';
|
|
90
|
-
var
|
|
106
|
+
var screen = state.screen === 'computer' ? 'local' : state.screen || 'list';
|
|
107
|
+
var backLabel = screen === 'xcode' ? 'Local MCP' : ['local', 'client', 'remote', 'discovery'].includes(screen) ? 'Add connection' : 'MCP connections';
|
|
108
|
+
var html = screen !== 'list' ? '<button type="button" class="mc-back" data-action="back">' + iconHtml('arrow-left') + backLabel + '</button>' : '';
|
|
91
109
|
if (state.error) html += '<div class="mc-alert" role="alert">' + iconHtml('circle-alert') + '<span>' + text(state.error) + '</span></div>';
|
|
92
110
|
html += '<p class="mc-muted">Clay connections require a runtime that supports session-bound tools. Availability follows the selected runtime’s capabilities.</p>';
|
|
93
111
|
if (state.notice) html += '<p class="mc-notice" role="status">' + text(state.notice) + '</p>';
|
|
94
112
|
if (screen === 'add') html += addView();
|
|
95
113
|
else if (screen === 'remote') html += remoteView(state);
|
|
96
114
|
else if (screen === 'discovery') html += discoveryView(state);
|
|
97
|
-
else if (screen === '
|
|
115
|
+
else if (screen === 'local') html += localView(state);
|
|
116
|
+
else if (screen === 'client') html += computerView(state);
|
|
117
|
+
else if (screen === 'xcode') html += '<div data-xcode-setup></div>';
|
|
98
118
|
else if (screen === 'remove' && row) html += heading('Remove ' + row.label + '?', 'This removes saved credentials and disables this connection for your private sessions and Mates.') + '<div role="group" aria-label="Confirm removal">' + button('Cancel', 'cancel-remove', false) + button('Remove connection', 'confirm-remove', true, 'trash-2') + '</div>';
|
|
99
119
|
else if (screen === 'detail' && row) html += detailView(state, row);
|
|
100
120
|
else html += listView(state);
|
|
101
|
-
if (state.pending && screen !== 'remote') html += '<p class="mc-working" role="status">' + iconHtml('loader-circle') + 'Updating connection…</p>';
|
|
102
|
-
root.innerHTML = '<div class="mc-screen">' + html + '</div>';
|
|
121
|
+
if (state.pending && screen !== 'remote' && (!state.pending.tab || state.pending.tab === 'mcp')) html += '<p class="mc-working" role="status">' + iconHtml('loader-circle') + 'Updating connection…</p>';
|
|
122
|
+
root.innerHTML = '<div class="mc-screen' + (screen === 'client' ? ' mc-extension' : '') + '">' + html + '</div>';
|
|
123
|
+
var xcodeRoot = root.querySelector('[data-xcode-setup]');
|
|
124
|
+
if (xcodeRoot) renderXcode(xcodeRoot, state, { action: events.action, disconnect: function () { events.action('xcode_disconnect'); } });
|
|
125
|
+
if (!sameScreen) root.scrollTop = 0;
|
|
103
126
|
root.dataset.screenKey = screen + ':' + (state.selected || '');
|
|
104
127
|
root.querySelectorAll('details').forEach(function (el) { el.open = disclosures.indexOf(el.className || el.querySelector('summary').textContent) >= 0; });
|
|
105
128
|
root.querySelectorAll('input[name]:not([type="password"])').forEach(function (el) {
|
|
106
129
|
if (Object.prototype.hasOwnProperty.call(drafts, el.name)) el.value = drafts[el.name];
|
|
107
130
|
if (focusedName === el.name) { el.focus(); try { el.setSelectionRange(start, start); } catch (error) {} }
|
|
108
131
|
});
|
|
109
|
-
if (!sameScreen) { var title = root.querySelector('h2'); if (title) title.focus({ preventScroll: true }); }
|
|
132
|
+
if (!sameScreen && !root.closest('.hidden')) { var title = root.querySelector('h2'); if (title) title.focus({ preventScroll: true }); }
|
|
110
133
|
root.querySelectorAll('[data-action]').forEach(function (el) {
|
|
111
134
|
var action = el.dataset.action;
|
|
112
135
|
if (action === 'copy' && !state.extensionId) el.disabled = true;
|
|
113
136
|
if (state.pending && ['signin', 'test', 'remove', 'confirm-remove'].includes(action)) el.disabled = true;
|
|
114
|
-
el.onclick = function () {
|
|
115
|
-
if (action === 'back') events.navigate('list');
|
|
116
|
-
else if (['add', 'remote', 'computer', 'discovery'].includes(action)) events.navigate(action);
|
|
137
|
+
el.onclick = function (event) {
|
|
138
|
+
if (action === 'back') events.navigate(screen === 'xcode' ? 'local' : ['local', 'client', 'remote', 'discovery'].includes(screen) ? 'add' : 'list');
|
|
139
|
+
else if (['add', 'remote', 'local', 'client', 'computer', 'discovery', 'xcode'].includes(action)) events.navigate(action);
|
|
117
140
|
else if (action === 'remove' && row) events.remove(row);
|
|
118
141
|
else if (action === 'cancel-remove') events.navigate('detail', row.id);
|
|
119
142
|
else if (action === 'confirm-remove') events.action('remove', { id: row.id });
|
|
120
143
|
else if (action === 'discover') events.discover();
|
|
121
144
|
else if (action === 'refresh') events.refresh();
|
|
122
|
-
else if (action === 'setup') events.setup();
|
|
145
|
+
else if (action === 'setup') { event.stopPropagation(); events.setup(); }
|
|
123
146
|
else if (action === 'copy') navigator.clipboard.writeText('npx clay-mcp-bridge install ' + (state.extensionId || '<extension-id>')).then(function () { el.textContent = 'Copied'; }).catch(function () { el.textContent = 'Select command to copy'; });
|
|
124
147
|
else events.action(action);
|
|
125
148
|
};
|
|
@@ -127,7 +150,7 @@ export function renderConnections(root, state, events) {
|
|
|
127
150
|
root.querySelectorAll('[data-import]').forEach(function (el) { el.onclick = function () { events.action('import', { scanId: state.discovery.scanId, candidateId: el.dataset.import }); }; });
|
|
128
151
|
root.querySelectorAll('[data-open]').forEach(function (el) { el.onclick = function () { events.navigate('detail', el.dataset.open); }; });
|
|
129
152
|
root.querySelectorAll('[data-toggle]').forEach(function (el) { el.onclick = function () { var item = state.servers.find(function (server) { return server.id === el.dataset.toggle; }); if (item) events.toggle(item, !item.projectEnabled); }; });
|
|
130
|
-
root.querySelectorAll('[data-tab]').forEach(function (el) { el.onclick = function () {
|
|
153
|
+
root.querySelectorAll('[data-tab]').forEach(function (el) { el.onclick = function () { events.detailTab(el.dataset.tab); }; });
|
|
131
154
|
var input = root.querySelector('[data-search]');
|
|
132
155
|
if (input) { input.oninput = function () { events.search(input.value); }; if (searchFocused) { input.focus(); try { input.setSelectionRange(start, start); } catch (error) {} } }
|
|
133
156
|
var discoveryForm = root.querySelector('[data-form="discovery"]');
|
|
@@ -136,10 +159,14 @@ export function renderConnections(root, state, events) {
|
|
|
136
159
|
discoveryForm.elements.vendor.onchange = saveSourceDraft;
|
|
137
160
|
discoveryForm.elements.file.oninput = saveSourceDraft;
|
|
138
161
|
}
|
|
162
|
+
var localForm = root.querySelector('[data-form="local"]');
|
|
163
|
+
if (localForm) localForm.oninput = function () { events.localDraft({ label: localForm.elements.label.value, command: localForm.elements.command.value, args: localForm.elements.args.value, cwd: localForm.elements.cwd.value }); };
|
|
164
|
+
|
|
139
165
|
var urlInput = root.querySelector('[name="url"]'); if (urlInput) urlInput.oninput = function () { events.draft(urlInput.value); };
|
|
140
166
|
root.querySelectorAll('form').forEach(function (form) {
|
|
141
167
|
form.onsubmit = function (event) {
|
|
142
168
|
event.preventDefault(); if (state.pending) return;
|
|
169
|
+
if (form.dataset.form === 'local') events.action('add_local', { label: form.elements.label.value, command: form.elements.command.value, argumentsJson: form.elements.args.value, cwd: form.elements.cwd.value });
|
|
143
170
|
if (form.dataset.form === 'remote') events.action('add', { url: form.elements.url.value });
|
|
144
171
|
if (form.dataset.form === 'token') { var token = form.elements.token.value; form.reset(); events.action('token', { token: token }); }
|
|
145
172
|
if (form.dataset.form === 'discovery') events.discover({ vendor: form.elements.vendor.value.trim(), file: form.elements.file.value.trim() });
|
|
@@ -149,6 +176,7 @@ export function renderConnections(root, state, events) {
|
|
|
149
176
|
});
|
|
150
177
|
var permission = root.querySelector('[data-permission]');
|
|
151
178
|
if (permission) permission.onchange = function () { sendMcpPermissionMode(store.get('currentSlug'), store.get('activeSessionId'), row.name, permission.value); };
|
|
179
|
+
if (focusedXcode) { var target = root.querySelector('[data-xcode="' + focusedXcode + '"]'); if (target && !target.disabled) target.focus({ preventScroll: true }); }
|
|
152
180
|
enhanceSettingsSelects(root);
|
|
153
181
|
refreshIcons(root);
|
|
154
182
|
}
|
|
@@ -15,13 +15,14 @@ export function ensureMcpSkillsWorkbench() {
|
|
|
15
15
|
'<button type="button" data-workbench="wide" aria-label="Widen MCP / Skills">' + iconHtml('chevrons-left-right') + '</button>' +
|
|
16
16
|
'<button type="button" data-workbench="fullscreen" aria-label="Toggle MCP / Skills fullscreen">' + iconHtml('maximize-2') + '</button>' +
|
|
17
17
|
'<button type="button" data-workbench="close" aria-label="Close MCP / Skills">' + iconHtml('x') + '</button></div></header>' +
|
|
18
|
-
'<div class="mcp-skills-tabs" role="tablist" aria-label="MCP / Skills sections"><button id="mcp-workbench-tab" role="tab" data-section="mcp" aria-controls="mcp-modal">MCP
|
|
18
|
+
'<div class="mcp-skills-tabs" role="tablist" aria-label="MCP / Skills sections"><button id="mcp-workbench-tab" role="tab" data-section="mcp" aria-controls="mcp-modal">MCP</button><button id="skills-workbench-tab" role="tab" data-section="skills" aria-controls="skills-modal">Skills</button></div>';
|
|
19
19
|
['mcp', 'skills'].forEach(function (name) {
|
|
20
20
|
var section = document.getElementById(name + '-modal');
|
|
21
21
|
if (!section) return;
|
|
22
22
|
var backdrop = section.querySelector('.confirm-backdrop'); if (backdrop) backdrop.remove();
|
|
23
23
|
var dialog = section.querySelector('.confirm-dialog'); if (dialog) dialog.classList.remove('confirm-dialog');
|
|
24
24
|
section.setAttribute('role', 'tabpanel'); section.setAttribute('aria-labelledby', name + '-workbench-tab');
|
|
25
|
+
if (name === 'mcp') { var setup = document.getElementById('ext-pill-wrap'); if (setup) { setup.hidden = true; section.querySelector('.mcp-dialog').prepend(setup); } }
|
|
25
26
|
panel.appendChild(section);
|
|
26
27
|
});
|
|
27
28
|
root.appendChild(panel);
|
|
@@ -31,8 +32,9 @@ export function ensureMcpSkillsWorkbench() {
|
|
|
31
32
|
button.onclick = function () { openMcpSkillsWorkbench(button.dataset.section); };
|
|
32
33
|
button.onkeydown = function (event) {
|
|
33
34
|
if (!['ArrowLeft', 'ArrowRight', 'Home', 'End'].includes(event.key)) return;
|
|
34
|
-
event.preventDefault(); var
|
|
35
|
-
|
|
35
|
+
event.preventDefault(); var tabs = skillsAllowed() ? ['mcp', 'skills'] : ['mcp'];
|
|
36
|
+
var tab = tabs[(tabs.indexOf(button.dataset.section) + (event.key === 'ArrowLeft' ? tabs.length - 1 : 1)) % tabs.length];
|
|
37
|
+
if (event.key === 'Home') tab = tabs[0]; if (event.key === 'End') tab = tabs[tabs.length - 1];
|
|
36
38
|
openMcpSkillsWorkbench(tab); panel.querySelector('[data-section="' + tab + '"]').focus();
|
|
37
39
|
};
|
|
38
40
|
});
|
|
@@ -47,6 +49,11 @@ export function ensureMcpSkillsWorkbench() {
|
|
|
47
49
|
export function openMcpSkillsWorkbench(tab) {
|
|
48
50
|
if (!ensureMcpSkillsWorkbench()) return;
|
|
49
51
|
tab = tab || state().tab || 'mcp';
|
|
52
|
+
if (tab === 'extension' || tab === 'xcode') {
|
|
53
|
+
store.set({ mcpConnections: Object.assign({}, store.get('mcpConnections'), { screen: tab === 'extension' ? 'client' : 'xcode', selected: null, search: '' }) });
|
|
54
|
+
tab = 'mcp';
|
|
55
|
+
}
|
|
56
|
+
if (tab !== 'skills') tab = 'mcp';
|
|
50
57
|
if (tab === 'skills' && !skillsAllowed()) tab = 'mcp';
|
|
51
58
|
claimRightWorkbench('mcp-skills'); patch({ open: true, tab: tab });
|
|
52
59
|
}
|
|
@@ -14,11 +14,16 @@ function send(message) {
|
|
|
14
14
|
}
|
|
15
15
|
function requestState() { send({ type: 'mcp_state_request' }); }
|
|
16
16
|
function clearActionTimer() { var timer = store.get('mcpActionTimer'); if (timer) clearTimeout(timer); store.set({ mcpActionTimer: null }); }
|
|
17
|
-
function navigate(screen, id) {
|
|
17
|
+
function navigate(screen, id) {
|
|
18
|
+
if (screen === 'computer') screen = 'local';
|
|
19
|
+
patch({ screen: screen, selected: id || null, error: '', notice: '', search: '', detailTab: 'tools' });
|
|
20
|
+
if (screen === 'xcode') { requestState(); action('xcode_check'); }
|
|
21
|
+
}
|
|
18
22
|
function action(name, args) {
|
|
19
|
-
if (state().pending) return;
|
|
23
|
+
if (state().pending && name !== 'xcode_disconnect') return;
|
|
20
24
|
var requestId = crypto.randomUUID();
|
|
21
|
-
|
|
25
|
+
var tab = (store.get('mcpSkillsWorkbench') || {}).tab || 'mcp';
|
|
26
|
+
patch({ pending: { requestId: requestId, action: name, tab: tab, screen: state().screen }, feedbackTab: tab, error: '', notice: '' });
|
|
22
27
|
clearActionTimer();
|
|
23
28
|
store.set({ mcpActionTimer: setTimeout(function () {
|
|
24
29
|
if (state().pending && state().pending.requestId === requestId) { patch({ pending: null, error: 'The server is taking longer than expected. Refresh connections to check its state.' }); requestState(); }
|
|
@@ -28,7 +33,7 @@ function action(name, args) {
|
|
|
28
33
|
function discover(options) {
|
|
29
34
|
if (state().pending) return;
|
|
30
35
|
var requestId = crypto.randomUUID();
|
|
31
|
-
patch({ pending: { requestId: requestId, action: 'discover' }, error: '' });
|
|
36
|
+
patch({ pending: { requestId: requestId, action: 'discover', tab: 'mcp' }, feedbackTab: 'mcp', error: '' });
|
|
32
37
|
clearActionTimer();
|
|
33
38
|
store.set({ mcpActionTimer: setTimeout(function () {
|
|
34
39
|
if (state().pending && state().pending.requestId === requestId) { clearActionTimer(); patch({ pending: null, error: 'The scan did not respond. Your draft and previous results are retained. Reconnect or scan again.' }); }
|
|
@@ -36,19 +41,22 @@ function discover(options) {
|
|
|
36
41
|
if (!send(Object.assign({ type: 'mcp_discovery_request', requestId: requestId }, options || {}))) { clearActionTimer(); patch({ pending: null }); }
|
|
37
42
|
}
|
|
38
43
|
function toggle(row, value) {
|
|
39
|
-
if (row.
|
|
40
|
-
else
|
|
44
|
+
if (row.integration === 'xcode' && value) action('xcode_connect');
|
|
45
|
+
else if (row.source !== 'computer') action('enable', { id: row.id, enabled: value });
|
|
46
|
+
else { patch({ feedbackTab: 'mcp', error: '', notice: '' }); send({ type: 'mcp_toggle_server', name: row.name, enabled: value }); }
|
|
41
47
|
}
|
|
42
48
|
function render() {
|
|
43
49
|
var element = document.getElementById('mcp-content');
|
|
44
50
|
if (!element) return;
|
|
45
51
|
var current = state();
|
|
46
52
|
var extension = document.getElementById('ext-pill-wrap');
|
|
47
|
-
if (extension) extension.hidden = current.screen !== '
|
|
53
|
+
if (extension) extension.hidden = current.screen !== 'client';
|
|
48
54
|
renderConnections(element, current, {
|
|
49
55
|
navigate: navigate, action: action, toggle: toggle, discover: discover,
|
|
56
|
+
localDraft: function (value) { patch({ localDraft: value }); },
|
|
50
57
|
sourceDraft: function (value) { patch({ sourceDraft: value }); },
|
|
51
58
|
search: function (value) { patch({ search: value }); },
|
|
59
|
+
detailTab: function (value) { patch({ detailTab: value, search: '' }); },
|
|
52
60
|
draft: function (value) { store.set({ mcpConnectionDraft: value }); },
|
|
53
61
|
refresh: requestState,
|
|
54
62
|
setup: function () { var button = document.getElementById('ext-pill'); if (button) button.click(); },
|
|
@@ -70,20 +78,39 @@ export function initMcp() {
|
|
|
70
78
|
}
|
|
71
79
|
if (current.connected !== previous.connected) {
|
|
72
80
|
if (current.connected) requestState();
|
|
73
|
-
else { clearActionTimer(); patch({ pending: null, error: 'Connection lost. Reconnect to manage your servers.' }); }
|
|
81
|
+
else { clearActionTimer(); patch({ pending: null, feedbackTab: null, error: 'Connection lost. Reconnect to manage your servers.' }); }
|
|
74
82
|
}
|
|
83
|
+
if (current.mcpSkillsWorkbench !== previous.mcpSkillsWorkbench && current.mcpSkillsWorkbench && current.mcpSkillsWorkbench.open && current.mcpSkillsWorkbench.tab === 'mcp' && state().screen === 'xcode') { requestState(); action('xcode_check'); }
|
|
75
84
|
if (current.mcpConnections !== previous.mcpConnections || current.mcpSkillsWorkbench !== previous.mcpSkillsWorkbench || current.activeSessionId !== previous.activeSessionId || current.mcpPermissionModeOverrides !== previous.mcpPermissionModeOverrides || current.permissionCapabilities !== previous.permissionCapabilities || current.effectivePermissionMode !== previous.effectivePermissionMode || current.mcpPermissionModePendingByTarget !== previous.mcpPermissionModePendingByTarget) { render(); badge(); }
|
|
76
85
|
});
|
|
77
86
|
render();
|
|
78
87
|
}
|
|
79
88
|
export function handleMcpServersState(msg) {
|
|
80
89
|
if (msg.slug && msg.slug !== store.get('currentSlug')) return;
|
|
81
|
-
patch({ servers: msg.servers || [], loaded: true, extensionConnected: !!msg.extensionConnected, hostConnected: !!msg.hostConnected, extensionId: msg.extensionId || null });
|
|
90
|
+
patch({ servers: (msg.servers || []).map(function (row) { return row.source === 'computer' ? Object.assign({}, row, { id: 'client:' + row.id }) : row; }), xcode: msg.xcode || null, loaded: true, extensionConnected: !!msg.extensionConnected, hostConnected: !!msg.hostConnected, extensionId: msg.extensionId || null });
|
|
82
91
|
}
|
|
83
92
|
export function setExtensionConnected(value) { patch({ extensionConnected: !!value }); }
|
|
84
93
|
export function getMcpServers() { return state().servers; }
|
|
85
94
|
export function handleMcpConnectionMessage(msg) {
|
|
86
|
-
if (msg.slug && msg.slug !== store.get('currentSlug')) return false;
|
|
95
|
+
if (msg.slug && msg.slug !== store.get('currentSlug') && msg.type !== 'mcp_settings_request') return false;
|
|
96
|
+
if (msg.type === 'mcp_settings_request') {
|
|
97
|
+
var accepted = false;
|
|
98
|
+
if (msg.slug === store.get('currentSlug') && msg.sessionId === store.get('activeSessionId') && ['client', 'credentials', 'token', 'permissions'].includes(msg.screen)) {
|
|
99
|
+
var row = state().servers.find(function (item) { return item.id === msg.connectionId; });
|
|
100
|
+
if (msg.screen === 'client' || row) {
|
|
101
|
+
navigate(msg.screen === 'client' ? 'client' : 'detail', row && row.id);
|
|
102
|
+
if (msg.screen === 'permissions') patch({ detailTab: 'permissions' });
|
|
103
|
+
openMcpSkillsWorkbench('mcp');
|
|
104
|
+
var root = document.getElementById('mcp-content');
|
|
105
|
+
var selector = msg.screen === 'credentials' ? '[data-form="credentials"]' : msg.screen === 'token' ? '[data-form="token"]' : null;
|
|
106
|
+
var form = root && selector && root.querySelector(selector);
|
|
107
|
+
accepted = !selector || !!form;
|
|
108
|
+
if (form) { var details = form.closest('details'); if (details) details.open = true; var input = form.querySelector('input'); if (input) input.focus({ preventScroll: true }); }
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
send({ type: 'mcp_settings_result', requestId: msg.requestId, slug: msg.slug, sessionId: msg.sessionId, accepted: accepted });
|
|
112
|
+
return true;
|
|
113
|
+
}
|
|
87
114
|
if (msg.type === 'mcp_discovery_result') {
|
|
88
115
|
var scanPending = state().pending;
|
|
89
116
|
if (!scanPending || scanPending.requestId !== msg.requestId) return true;
|
|
@@ -96,9 +123,11 @@ export function handleMcpConnectionMessage(msg) {
|
|
|
96
123
|
if (msg.requestId && (!pending || msg.requestId !== pending.requestId)) return true;
|
|
97
124
|
clearActionTimer();
|
|
98
125
|
patch({ pending: null, error: msg.ok ? '' : msg.error || 'Could not update connection.' });
|
|
99
|
-
if (msg.ok && (msg.action === 'add' || msg.action === 'import')) { store.set({ mcpConnectionDraft: '' }); navigate('detail', msg.id); }
|
|
126
|
+
if (msg.ok && (!pending || pending.screen === state().screen) && (msg.action === 'add' || msg.action === 'add_local' || msg.action === 'import')) { store.set({ mcpConnectionDraft: '' }); if (msg.action === 'add_local') patch({ localDraft: null }); navigate('detail', msg.id); }
|
|
100
127
|
if (msg.ok && msg.action === 'remove') navigate('list');
|
|
101
128
|
if (msg.ok && msg.action === 'enable') patch({ notice: 'Saved. Tool availability updates on the next turn; some runtimes may need a new session.' });
|
|
129
|
+
if (msg.ok && msg.action === 'xcode_connect') patch({ notice: 'Xcode tools enabled. Use them on your next turn; some runtimes may need a new session.' });
|
|
130
|
+
if (msg.ok && msg.action === 'xcode_disconnect') patch({ notice: 'Xcode tools disabled. Work already performed in Xcode is not undone.' });
|
|
102
131
|
return true;
|
|
103
132
|
}
|
|
104
133
|
if (msg.type === 'mcp_login_ready') {
|