ltcai 4.0.1 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. package/README.md +28 -23
  2. package/desktop/electron/main.cjs +44 -0
  3. package/docs/CHANGELOG.md +42 -0
  4. package/docs/V4_1_FRONTEND_ARCHITECTURE_REVIEW.md +65 -0
  5. package/docs/V4_1_FRONTEND_MIGRATION_REPORT.md +70 -0
  6. package/docs/V4_1_VALIDATION_REPORT.md +47 -0
  7. package/docs/V4_DIGITAL_BRAIN_RECOVERY.md +26 -19
  8. package/frontend/index.html +24 -0
  9. package/frontend/openapi.json +14190 -0
  10. package/frontend/src/App.tsx +184 -0
  11. package/frontend/src/api/client.ts +317 -0
  12. package/frontend/src/api/openapi.ts +16637 -0
  13. package/frontend/src/components/primitives.tsx +204 -0
  14. package/frontend/src/components/ui/badge.tsx +27 -0
  15. package/frontend/src/components/ui/button.tsx +37 -0
  16. package/frontend/src/components/ui/card.tsx +22 -0
  17. package/frontend/src/components/ui/input.tsx +16 -0
  18. package/frontend/src/components/ui/textarea.tsx +16 -0
  19. package/frontend/src/lib/utils.ts +33 -0
  20. package/frontend/src/main.tsx +23 -0
  21. package/frontend/src/pages/Act.tsx +245 -0
  22. package/frontend/src/pages/Ask.tsx +200 -0
  23. package/frontend/src/pages/Brain.tsx +267 -0
  24. package/frontend/src/pages/Capture.tsx +158 -0
  25. package/frontend/src/pages/Library.tsx +187 -0
  26. package/frontend/src/pages/System.tsx +344 -0
  27. package/frontend/src/routes.ts +85 -0
  28. package/frontend/src/store/appStore.ts +54 -0
  29. package/frontend/src/styles.css +107 -0
  30. package/latticeai/__init__.py +1 -1
  31. package/latticeai/api/setup.py +5 -4
  32. package/latticeai/api/static_routes.py +4 -4
  33. package/latticeai/core/marketplace.py +1 -1
  34. package/latticeai/core/multi_agent.py +1 -1
  35. package/latticeai/core/workspace_os.py +1 -1
  36. package/package.json +54 -15
  37. package/scripts/build_frontend_assets.mjs +38 -0
  38. package/scripts/bump_version.py +1 -1
  39. package/scripts/export_openapi.py +31 -0
  40. package/scripts/lint_frontend.mjs +86 -0
  41. package/scripts/run_python.mjs +47 -0
  42. package/src-tauri/Cargo.lock +4833 -0
  43. package/src-tauri/Cargo.toml +19 -0
  44. package/src-tauri/build.rs +3 -0
  45. package/src-tauri/capabilities/default.json +7 -0
  46. package/src-tauri/src/main.rs +78 -0
  47. package/src-tauri/tauri.conf.json +36 -0
  48. package/static/app/asset-manifest.json +32 -0
  49. package/static/app/assets/core-CwxXejkd.js +2 -0
  50. package/static/app/assets/core-CwxXejkd.js.map +1 -0
  51. package/static/app/assets/index-CJRAzNnf.js +333 -0
  52. package/static/app/assets/index-CJRAzNnf.js.map +1 -0
  53. package/static/app/assets/index-CSwBBgf4.css +2 -0
  54. package/static/app/index.html +25 -0
  55. package/static/manifest.json +2 -2
  56. package/static/sw.js +4 -4
  57. package/scripts/build_v3_assets.mjs +0 -170
  58. package/scripts/lint_v3.mjs +0 -120
  59. package/static/v3/asset-manifest.json +0 -63
  60. package/static/v3/css/lattice.base.49deefb5.css +0 -128
  61. package/static/v3/css/lattice.base.css +0 -128
  62. package/static/v3/css/lattice.components.cde18231.css +0 -472
  63. package/static/v3/css/lattice.components.css +0 -472
  64. package/static/v3/css/lattice.shell.29d36d85.css +0 -452
  65. package/static/v3/css/lattice.shell.css +0 -452
  66. package/static/v3/css/lattice.tokens.304cbc40.css +0 -135
  67. package/static/v3/css/lattice.tokens.css +0 -135
  68. package/static/v3/css/lattice.views.0a18b6c5.css +0 -360
  69. package/static/v3/css/lattice.views.css +0 -360
  70. package/static/v3/index.html +0 -68
  71. package/static/v3/js/app.c5c80c46.js +0 -26
  72. package/static/v3/js/app.js +0 -26
  73. package/static/v3/js/core/api.ba0fbf14.js +0 -625
  74. package/static/v3/js/core/api.js +0 -625
  75. package/static/v3/js/core/components.f25b3b93.js +0 -230
  76. package/static/v3/js/core/components.js +0 -230
  77. package/static/v3/js/core/dom.a2773eb0.js +0 -148
  78. package/static/v3/js/core/dom.js +0 -148
  79. package/static/v3/js/core/i18n.880e1fec.js +0 -575
  80. package/static/v3/js/core/i18n.js +0 -575
  81. package/static/v3/js/core/router.584570f2.js +0 -37
  82. package/static/v3/js/core/router.js +0 -37
  83. package/static/v3/js/core/routes.37522821.js +0 -101
  84. package/static/v3/js/core/routes.js +0 -101
  85. package/static/v3/js/core/shell.e3f6bbfa.js +0 -420
  86. package/static/v3/js/core/shell.js +0 -420
  87. package/static/v3/js/core/store.7b2aa044.js +0 -123
  88. package/static/v3/js/core/store.js +0 -123
  89. package/static/v3/js/views/account.eff40715.js +0 -143
  90. package/static/v3/js/views/account.js +0 -143
  91. package/static/v3/js/views/activity.0d271ef9.js +0 -67
  92. package/static/v3/js/views/activity.js +0 -67
  93. package/static/v3/js/views/admin-audit.660a1fb1.js +0 -185
  94. package/static/v3/js/views/admin-audit.js +0 -185
  95. package/static/v3/js/views/admin-permissions.a7ae5f09.js +0 -177
  96. package/static/v3/js/views/admin-permissions.js +0 -177
  97. package/static/v3/js/views/admin-policies.3658fd86.js +0 -102
  98. package/static/v3/js/views/admin-policies.js +0 -102
  99. package/static/v3/js/views/admin-private-vpc.7d342d36.js +0 -135
  100. package/static/v3/js/views/admin-private-vpc.js +0 -135
  101. package/static/v3/js/views/admin-security.07c66b72.js +0 -180
  102. package/static/v3/js/views/admin-security.js +0 -180
  103. package/static/v3/js/views/admin-users.f7ac7b43.js +0 -166
  104. package/static/v3/js/views/admin-users.js +0 -166
  105. package/static/v3/js/views/agents.17c5288d.js +0 -564
  106. package/static/v3/js/views/agents.js +0 -564
  107. package/static/v3/js/views/chat.e250e2cc.js +0 -624
  108. package/static/v3/js/views/chat.js +0 -624
  109. package/static/v3/js/views/files.adad14c1.js +0 -365
  110. package/static/v3/js/views/files.js +0 -365
  111. package/static/v3/js/views/graph-canvas.17c15d65.js +0 -509
  112. package/static/v3/js/views/graph-canvas.js +0 -509
  113. package/static/v3/js/views/home.24f8b8ae.js +0 -200
  114. package/static/v3/js/views/home.js +0 -200
  115. package/static/v3/js/views/hooks.37895880.js +0 -220
  116. package/static/v3/js/views/hooks.js +0 -220
  117. package/static/v3/js/views/hybrid-search.2fb63ed9.js +0 -194
  118. package/static/v3/js/views/hybrid-search.js +0 -194
  119. package/static/v3/js/views/knowledge-graph.4d09c537.js +0 -529
  120. package/static/v3/js/views/knowledge-graph.js +0 -529
  121. package/static/v3/js/views/marketplace.ab0583d4.js +0 -141
  122. package/static/v3/js/views/marketplace.js +0 -141
  123. package/static/v3/js/views/mcp.99b5c6a7.js +0 -114
  124. package/static/v3/js/views/mcp.js +0 -114
  125. package/static/v3/js/views/memory.4ebdf474.js +0 -147
  126. package/static/v3/js/views/memory.js +0 -147
  127. package/static/v3/js/views/models.a1ffa147.js +0 -256
  128. package/static/v3/js/views/models.js +0 -256
  129. package/static/v3/js/views/my-computer.d9d9ae1c.js +0 -463
  130. package/static/v3/js/views/my-computer.js +0 -463
  131. package/static/v3/js/views/network.52a4f181.js +0 -97
  132. package/static/v3/js/views/network.js +0 -97
  133. package/static/v3/js/views/pipeline.c522f1ce.js +0 -157
  134. package/static/v3/js/views/pipeline.js +0 -157
  135. package/static/v3/js/views/planning.4876fd77.js +0 -174
  136. package/static/v3/js/views/planning.js +0 -174
  137. package/static/v3/js/views/runs.b63b2afa.js +0 -144
  138. package/static/v3/js/views/runs.js +0 -144
  139. package/static/v3/js/views/settings.b7140634.js +0 -317
  140. package/static/v3/js/views/settings.js +0 -317
  141. package/static/v3/js/views/skills.c6c2f965.js +0 -109
  142. package/static/v3/js/views/skills.js +0 -109
  143. package/static/v3/js/views/snapshots.6f5db095.js +0 -135
  144. package/static/v3/js/views/snapshots.js +0 -135
  145. package/static/v3/js/views/tools.e4f11276.js +0 -108
  146. package/static/v3/js/views/tools.js +0 -108
  147. package/static/v3/js/views/workflows.7752225a.js +0 -213
  148. package/static/v3/js/views/workflows.js +0 -213
  149. package/static/v3/js/views/workspace-admin.c466029b.js +0 -156
  150. package/static/v3/js/views/workspace-admin.js +0 -156
@@ -1,141 +0,0 @@
1
- /* ============================================================================
2
- * View: Marketplace — agent templates, plugins, and skills.
3
- * Templates come from /marketplace/templates (offline local catalog incl. the
4
- * five named agent templates). Install / Clone / Export use the real backend.
5
- * Plugins and skills marketplace read live directories; unavailable is shown
6
- * honestly with no fabricated catalog.
7
- * ========================================================================== */
8
-
9
- const KIND_VARIANT = { agent: "info", workflow: "warn", plugin: "" };
10
-
11
- export async function render(ctx) {
12
- const { h, c } = ctx;
13
- const body = h("div", c.loading({ lines: 4, block: true }));
14
- let tab = "templates";
15
-
16
- const tabsEl = c.tabs(
17
- [{ key: "templates", label: "Templates" }, { key: "plugins", label: "Plugins" }, { key: "skills", label: "Skills" }],
18
- tab, (k) => { tab = k; paint(); },
19
- );
20
-
21
- const root = h("div.lt3-stack-6",
22
- c.viewHeader({
23
- eyebrow: "Platform",
24
- title: "Marketplace",
25
- sub: "Reusable agent templates, plugins, and skills — install, clone, customize, export, and import, all from /app.",
26
- }),
27
- tabsEl,
28
- body,
29
- );
30
-
31
- paint();
32
- return root;
33
-
34
- function paint() {
35
- [...tabsEl.querySelectorAll(".lt3-tab")].forEach((b, i) => { b.dataset.active = String(["templates", "plugins", "skills"][i] === tab); });
36
- body.replaceChildren(c.loading({ lines: 3, block: true }));
37
- if (tab === "templates") return paintTemplates();
38
- if (tab === "plugins") return paintPlugins();
39
- return paintSkills();
40
- }
41
-
42
- async function paintTemplates() {
43
- const res = await ctx.api.templates();
44
- const list = (res.data && res.data.templates) || [];
45
- if (!list.length) {
46
- body.replaceChildren(stateRow(ctx, res.source), c.emptyState({ icon: "package-off", title: "Catalog unavailable", body: "Start the backend to load the template catalog." }));
47
- return;
48
- }
49
- const byKind = {};
50
- for (const t of list) (byKind[t.kind] = byKind[t.kind] || []).push(t);
51
- const sections = Object.keys(byKind).map((kind) =>
52
- h("section",
53
- c.sectionHead(`${cap(kind)} templates`, c.pill(String(byKind[kind].length))),
54
- h("div.lt3-grid-auto", byKind[kind].map((t) => templateCard(ctx, t))),
55
- ));
56
- body.replaceChildren(h("div.lt3-stack-6", stateRow(ctx, res.source), ...sections));
57
- }
58
-
59
- function templateCard(ctx2, t) {
60
- const def = t.definition || {};
61
- const caps = def.capabilities || def.roles || [];
62
- return c.card(h("div.lt3-stack-3",
63
- h("div.lt3-row", { style: { "justify-content": "space-between", "align-items": "flex-start" } },
64
- h("div", h("b", t.name), h("div.lt3-faint", { style: { "font-size": "var(--lt3-text-2xs)", "font-family": "var(--lt3-font-mono)" } }, t.id)),
65
- c.pill(t.kind, KIND_VARIANT[t.kind] || ""),
66
- ),
67
- h("p.lt3-muted", { style: { margin: 0, "font-size": "var(--lt3-text-sm)" } }, t.description || ""),
68
- caps.length ? h("div.lt3-cluster", caps.slice(0, 6).map((x) => h("span.lt3-chip", x))) : null,
69
- h("div.lt3-row-2",
70
- h("button.lt3-btn.lt3-btn--primary.lt3-btn--sm", { on: { click: () => install(ctx2, t) } }, c.icon("download"), "Install"),
71
- h("button.lt3-btn.lt3-btn--subtle.lt3-btn--sm", { on: { click: () => clone(ctx2, t) } }, c.icon("copy"), "Clone"),
72
- h("button.lt3-btn.lt3-btn--ghost.lt3-btn--sm", { on: { click: () => exportT(ctx2, t) } }, c.icon("file-export"), "Export"),
73
- ),
74
- h("div.lt3-faint", { style: { "font-size": "var(--lt3-text-2xs)" } }, `v${t.version || "1.0.0"} · ${(t.metadata && t.metadata.category) || "general"}`),
75
- ), { interactive: false });
76
- }
77
-
78
- async function install(ctx2, t) {
79
- const res = await ctx2.api.installTemplate(t);
80
- ctx2.toast(res && res.ok ? `Installed ${t.name}` : "Install unavailable", res && res.ok ? "ok" : "err");
81
- }
82
- async function clone(ctx2, t) {
83
- const res = await ctx2.api.cloneTemplate(t.kind, t.id, `${t.name} (Copy)`);
84
- ctx2.toast(res && res.ok ? `Cloned to ${res.data.template.id}` : "Clone unavailable", res && res.ok ? "ok" : "err");
85
- }
86
- async function exportT(ctx2, t) {
87
- const res = await ctx2.api.exportTemplate(t.kind, t.id);
88
- if (res && res.ok && res.data) {
89
- try {
90
- const blob = new Blob([JSON.stringify(res.data, null, 2)], { type: "application/json" });
91
- const a = document.createElement("a");
92
- a.href = URL.createObjectURL(blob); a.download = `${t.id}.template.json`; a.click();
93
- URL.revokeObjectURL(a.href);
94
- ctx2.toast("Exported template", "ok");
95
- } catch { ctx2.toast("Export failed", "err"); }
96
- } else { ctx2.toast("Export unavailable", "err"); }
97
- }
98
-
99
- async function paintPlugins() {
100
- const [reg, dir] = await Promise.all([ctx.api.pluginsRegistry(), ctx.api.pluginsDirectory()]);
101
- const installed = (reg.data && reg.data.plugins) || [];
102
- const directory = (dir.data && dir.data.plugins) || [];
103
- if (!installed.length && !directory.length) {
104
- body.replaceChildren(stateRow(ctx, reg.source), c.emptyState({ icon: "plug-off", title: "No plugins", body: "Plugin registry and directory are unavailable." }));
105
- return;
106
- }
107
- body.replaceChildren(h("div.lt3-stack-6",
108
- stateRow(ctx, reg.source),
109
- h("section", c.sectionHead("Installed plugins", c.pill(String(installed.length))),
110
- installed.length ? h("div.lt3-grid-auto", installed.map((p) => simpleCard(ctx, p.name || p.id, p.description, p.version, "ok"))) : hint(ctx, "No plugins installed.")),
111
- h("section", c.sectionHead("Directory", c.pill(String(directory.length))),
112
- directory.length ? h("div.lt3-grid-auto", directory.slice(0, 30).map((p) => simpleCard(ctx, p.name, p.description, p.version, null, p.author))) : hint(ctx, "Directory unavailable.")),
113
- ));
114
- }
115
-
116
- async function paintSkills() {
117
- const res = await ctx.api.skillsMarketplace();
118
- const skills = (res.data && res.data.skills) || [];
119
- body.replaceChildren(h("div.lt3-stack-3",
120
- stateRow(ctx, res.source),
121
- h("p.lt3-faint", { style: { margin: 0 } }, "Manage installed skills in the Skills view; this is the discovery catalog."),
122
- skills.length
123
- ? h("div.lt3-grid-auto", skills.slice(0, 40).map((s) => simpleCard(ctx, s.skill || s.name, s.description, s.version, s.installed ? "ok" : null, s.author)))
124
- : c.emptyState({ icon: "puzzle-off", title: "Skills catalog unavailable", body: "The skills marketplace did not respond." }),
125
- ));
126
- }
127
- }
128
-
129
- function stateRow(ctx, source) {
130
- return ctx.h("div.lt3-row-2", { style: { "justify-content": "flex-end" } }, ctx.c.sourceBadge(source));
131
- }
132
- function simpleCard(ctx, name, desc, version, state, author) {
133
- const { h, c } = ctx;
134
- return c.card(h("div.lt3-stack-2",
135
- h("div.lt3-row", { style: { "justify-content": "space-between" } }, h("b", name || "Untitled"), state ? c.statePill(state === "ok" ? "ready" : state) : null),
136
- h("p.lt3-muted", { style: { margin: 0, "font-size": "var(--lt3-text-sm)" } }, desc || ""),
137
- h("div.lt3-faint", { style: { "font-size": "var(--lt3-text-2xs)" } }, [version ? `v${version}` : null, author ? `by ${author}` : null].filter(Boolean).join(" · ")),
138
- ), { flat: true });
139
- }
140
- function hint(ctx, text) { return ctx.h("p.lt3-faint", { style: { margin: 0 } }, text); }
141
- function cap(s) { return String(s || "").charAt(0).toUpperCase() + String(s || "").slice(1); }
@@ -1,114 +0,0 @@
1
- /* ============================================================================
2
- * View: MCP Manager — connected MCP servers, available tools, health.
3
- * Reads /mcp/tools, /mcp/installed, /mcp/claude-code-servers, /mcp/custom and
4
- * lets the user inspect connected servers and recommend new ones. Unavailable
5
- * state is explicit; nothing is invented.
6
- * ========================================================================== */
7
-
8
- export async function render(ctx) {
9
- const { h, c } = ctx;
10
- const src = h("span", c.sourceBadge("pending"));
11
- const statHost = h("div.lt3-statrow", c.loading({ lines: 1 }));
12
- const serversHost = h("div", c.loading({ lines: 3, block: true }));
13
- const recHost = h("div");
14
- const recInput = h("input.lt3-input", { type: "text", placeholder: "Describe what you need (e.g. “web search”, “github”)…", "aria-label": "Recommend MCP" });
15
-
16
- const root = h("div.lt3-stack-6",
17
- c.viewHeader({
18
- eyebrow: "Platform",
19
- title: "MCP Manager",
20
- sub: "Model Context Protocol servers: what is connected, the tools they expose, their permissions, and their health — managed from /app.",
21
- actions: [src],
22
- }),
23
- statHost,
24
- c.panel({
25
- title: "Recommend a server", sub: "Find MCP servers that match a capability.",
26
- children: h("div.lt3-stack-3",
27
- h("div.lt3-row-2", recInput, h("button.lt3-btn.lt3-btn--primary", { on: { click: recommend } }, c.icon("search"), "Recommend")),
28
- recHost),
29
- }),
30
- h("section", c.sectionHead("Connected servers"), serversHost),
31
- );
32
-
33
- load();
34
- return root;
35
-
36
- async function load() {
37
- const [tools, claude, custom] = await Promise.all([ctx.api.mcpTools(), ctx.api.mcpClaudeServers(), ctx.api.mcpCustom()]);
38
- src.replaceChildren(c.sourceBadge(tools.source));
39
- const installed = (tools.data && tools.data.installed_mcps) || [];
40
- const claudeServers = (claude.data && claude.data.servers) || [];
41
- const customServers = (custom.data && custom.data.custom) || [];
42
- const toolList = (tools.data && tools.data.tools) || [];
43
- const servers = mergeServers(installed, claudeServers, customServers);
44
-
45
- if (!servers.length && !toolList.length) {
46
- statHost.replaceChildren(c.stat({ label: "MCP", value: "—", icon: "plug-connected" }));
47
- serversHost.replaceChildren(c.emptyState({ icon: "plug-off", title: "MCP unavailable", body: "Start the backend to read MCP servers and tools." }));
48
- return;
49
- }
50
- const connected = servers.filter((s) => s.installed).length;
51
- statHost.replaceChildren(
52
- c.stat({ label: "Servers", value: c.fmtNum(servers.length), icon: "server" }),
53
- c.stat({ label: "Connected", value: c.fmtNum(connected), icon: "plug-connected" }),
54
- c.stat({ label: "Local tools", value: c.fmtNum(toolList.length), icon: "tools" }),
55
- );
56
- if (!servers.length) {
57
- serversHost.replaceChildren(c.emptyState({ icon: "plug", title: "No MCP servers", body: "No MCP servers are registered yet. Use Recommend to find some." }));
58
- return;
59
- }
60
- serversHost.replaceChildren(h("div.lt3-grid-auto", servers.map((s) => serverCard(ctx, s))));
61
- }
62
-
63
- function serverCard(ctx2, s) {
64
- return c.card(h("div.lt3-stack-3",
65
- h("div.lt3-row", { style: { "justify-content": "space-between", "align-items": "flex-start" } },
66
- h("div.lt3-row-2",
67
- h("span.lt3-avatar", { style: { width: "34px", height: "34px", "border-radius": "var(--lt3-radius-md)" } }, s.icon && s.icon.length <= 2 ? s.icon : c.icon("plug")),
68
- h("div", h("b", s.name), h("div.lt3-faint", { style: { "font-size": "var(--lt3-text-2xs)" } }, s.category || s.source || "")),
69
- ),
70
- c.statePill(s.installed ? "ready" : "available"),
71
- ),
72
- s.description ? h("p.lt3-muted", { style: { margin: 0, "font-size": "var(--lt3-text-sm)" } }, s.description) : null,
73
- s.package ? h("div.lt3-faint", { style: { "font-size": "var(--lt3-text-2xs)", "font-family": "var(--lt3-font-mono)", "word-break": "break-all" } }, s.package) : null,
74
- Array.isArray(s.env_vars) && s.env_vars.length ? h("div.lt3-cluster", s.env_vars.slice(0, 4).map((e) => h("span.lt3-chip", c.icon("key"), e.name || e))) : null,
75
- ), { interactive: false });
76
- }
77
-
78
- async function recommend() {
79
- const q = recInput.value.trim();
80
- if (!q) { ctx.toast("Describe what you need", "info"); return; }
81
- recHost.replaceChildren(c.loading({ lines: 2 }));
82
- const res = await ctx.api.mcpRecommend(q, 6);
83
- const recs = (res && res.data && (res.data.recommendations || res.data)) || [];
84
- if (!res || !res.ok || !Array.isArray(recs) || !recs.length) {
85
- recHost.replaceChildren(c.banner("No recommendations available — the MCP registry may be offline.", "info"));
86
- return;
87
- }
88
- recHost.replaceChildren(h("div.lt3-stack-2", recs.slice(0, 6).map((r) => c.card(
89
- h("div.lt3-row", { style: { "justify-content": "space-between" } },
90
- h("div", h("b", r.name || r.id), h("p.lt3-muted", { style: { margin: 0, "font-size": "var(--lt3-text-sm)" } }, r.description || "")),
91
- r.category ? c.pill(r.category) : null),
92
- { flat: true }))));
93
- }
94
- }
95
-
96
- function mergeServers(installed, claude, custom) {
97
- const out = [];
98
- const seen = new Set();
99
- const push = (s, source) => {
100
- const id = s.id || s.name;
101
- if (!id || seen.has(id)) return;
102
- seen.add(id);
103
- out.push({
104
- id, name: s.name || id, description: s.description || "", category: s.category || source,
105
- package: s.package || "", icon: s.icon || "", source: s.source || source,
106
- installed: s.installed != null ? !!s.installed : source === "claude-code",
107
- env_vars: s.env_vars || [],
108
- });
109
- };
110
- (installed || []).forEach((s) => push(s, "registry"));
111
- (claude || []).forEach((s) => push(s, "claude-code"));
112
- (custom || []).forEach((s) => push(s, "custom"));
113
- return out;
114
- }
@@ -1,114 +0,0 @@
1
- /* ============================================================================
2
- * View: MCP Manager — connected MCP servers, available tools, health.
3
- * Reads /mcp/tools, /mcp/installed, /mcp/claude-code-servers, /mcp/custom and
4
- * lets the user inspect connected servers and recommend new ones. Unavailable
5
- * state is explicit; nothing is invented.
6
- * ========================================================================== */
7
-
8
- export async function render(ctx) {
9
- const { h, c } = ctx;
10
- const src = h("span", c.sourceBadge("pending"));
11
- const statHost = h("div.lt3-statrow", c.loading({ lines: 1 }));
12
- const serversHost = h("div", c.loading({ lines: 3, block: true }));
13
- const recHost = h("div");
14
- const recInput = h("input.lt3-input", { type: "text", placeholder: "Describe what you need (e.g. “web search”, “github”)…", "aria-label": "Recommend MCP" });
15
-
16
- const root = h("div.lt3-stack-6",
17
- c.viewHeader({
18
- eyebrow: "Platform",
19
- title: "MCP Manager",
20
- sub: "Model Context Protocol servers: what is connected, the tools they expose, their permissions, and their health — managed from /app.",
21
- actions: [src],
22
- }),
23
- statHost,
24
- c.panel({
25
- title: "Recommend a server", sub: "Find MCP servers that match a capability.",
26
- children: h("div.lt3-stack-3",
27
- h("div.lt3-row-2", recInput, h("button.lt3-btn.lt3-btn--primary", { on: { click: recommend } }, c.icon("search"), "Recommend")),
28
- recHost),
29
- }),
30
- h("section", c.sectionHead("Connected servers"), serversHost),
31
- );
32
-
33
- load();
34
- return root;
35
-
36
- async function load() {
37
- const [tools, claude, custom] = await Promise.all([ctx.api.mcpTools(), ctx.api.mcpClaudeServers(), ctx.api.mcpCustom()]);
38
- src.replaceChildren(c.sourceBadge(tools.source));
39
- const installed = (tools.data && tools.data.installed_mcps) || [];
40
- const claudeServers = (claude.data && claude.data.servers) || [];
41
- const customServers = (custom.data && custom.data.custom) || [];
42
- const toolList = (tools.data && tools.data.tools) || [];
43
- const servers = mergeServers(installed, claudeServers, customServers);
44
-
45
- if (!servers.length && !toolList.length) {
46
- statHost.replaceChildren(c.stat({ label: "MCP", value: "—", icon: "plug-connected" }));
47
- serversHost.replaceChildren(c.emptyState({ icon: "plug-off", title: "MCP unavailable", body: "Start the backend to read MCP servers and tools." }));
48
- return;
49
- }
50
- const connected = servers.filter((s) => s.installed).length;
51
- statHost.replaceChildren(
52
- c.stat({ label: "Servers", value: c.fmtNum(servers.length), icon: "server" }),
53
- c.stat({ label: "Connected", value: c.fmtNum(connected), icon: "plug-connected" }),
54
- c.stat({ label: "Local tools", value: c.fmtNum(toolList.length), icon: "tools" }),
55
- );
56
- if (!servers.length) {
57
- serversHost.replaceChildren(c.emptyState({ icon: "plug", title: "No MCP servers", body: "No MCP servers are registered yet. Use Recommend to find some." }));
58
- return;
59
- }
60
- serversHost.replaceChildren(h("div.lt3-grid-auto", servers.map((s) => serverCard(ctx, s))));
61
- }
62
-
63
- function serverCard(ctx2, s) {
64
- return c.card(h("div.lt3-stack-3",
65
- h("div.lt3-row", { style: { "justify-content": "space-between", "align-items": "flex-start" } },
66
- h("div.lt3-row-2",
67
- h("span.lt3-avatar", { style: { width: "34px", height: "34px", "border-radius": "var(--lt3-radius-md)" } }, s.icon && s.icon.length <= 2 ? s.icon : c.icon("plug")),
68
- h("div", h("b", s.name), h("div.lt3-faint", { style: { "font-size": "var(--lt3-text-2xs)" } }, s.category || s.source || "")),
69
- ),
70
- c.statePill(s.installed ? "ready" : "available"),
71
- ),
72
- s.description ? h("p.lt3-muted", { style: { margin: 0, "font-size": "var(--lt3-text-sm)" } }, s.description) : null,
73
- s.package ? h("div.lt3-faint", { style: { "font-size": "var(--lt3-text-2xs)", "font-family": "var(--lt3-font-mono)", "word-break": "break-all" } }, s.package) : null,
74
- Array.isArray(s.env_vars) && s.env_vars.length ? h("div.lt3-cluster", s.env_vars.slice(0, 4).map((e) => h("span.lt3-chip", c.icon("key"), e.name || e))) : null,
75
- ), { interactive: false });
76
- }
77
-
78
- async function recommend() {
79
- const q = recInput.value.trim();
80
- if (!q) { ctx.toast("Describe what you need", "info"); return; }
81
- recHost.replaceChildren(c.loading({ lines: 2 }));
82
- const res = await ctx.api.mcpRecommend(q, 6);
83
- const recs = (res && res.data && (res.data.recommendations || res.data)) || [];
84
- if (!res || !res.ok || !Array.isArray(recs) || !recs.length) {
85
- recHost.replaceChildren(c.banner("No recommendations available — the MCP registry may be offline.", "info"));
86
- return;
87
- }
88
- recHost.replaceChildren(h("div.lt3-stack-2", recs.slice(0, 6).map((r) => c.card(
89
- h("div.lt3-row", { style: { "justify-content": "space-between" } },
90
- h("div", h("b", r.name || r.id), h("p.lt3-muted", { style: { margin: 0, "font-size": "var(--lt3-text-sm)" } }, r.description || "")),
91
- r.category ? c.pill(r.category) : null),
92
- { flat: true }))));
93
- }
94
- }
95
-
96
- function mergeServers(installed, claude, custom) {
97
- const out = [];
98
- const seen = new Set();
99
- const push = (s, source) => {
100
- const id = s.id || s.name;
101
- if (!id || seen.has(id)) return;
102
- seen.add(id);
103
- out.push({
104
- id, name: s.name || id, description: s.description || "", category: s.category || source,
105
- package: s.package || "", icon: s.icon || "", source: s.source || source,
106
- installed: s.installed != null ? !!s.installed : source === "claude-code",
107
- env_vars: s.env_vars || [],
108
- });
109
- };
110
- (installed || []).forEach((s) => push(s, "registry"));
111
- (claude || []).forEach((s) => push(s, "claude-code"));
112
- (custom || []).forEach((s) => push(s, "custom"));
113
- return out;
114
- }
@@ -1,147 +0,0 @@
1
- /* ============================================================================
2
- * View: Memory — the long-term memory platform + Memory Manager.
3
- * Reads /api/memory/manager (usage / sources / health / size / type) and offers
4
- * recall, inspect, compact, and rebuild. Every number comes from a real store;
5
- * tiers with no backing report unavailable. (Destructive prune/clear are
6
- * available over the API but intentionally not surfaced as one-click UI here.)
7
- * ========================================================================== */
8
-
9
- const TIER_ICON = {
10
- workspace: "building-warehouse", project: "folders", agent: "robot",
11
- conversation: "messages", graph: "chart-dots-3", vector: "grid-dots",
12
- };
13
-
14
- export async function render(ctx) {
15
- const { h, c } = ctx;
16
-
17
- const srcBadge = h("span", c.sourceBadge("pending"));
18
- const statHost = h("div.lt3-statrow", c.loading({ lines: 1 }));
19
- const sourcesHost = h("div", c.loading({ lines: 3, block: true }));
20
- const recallHost = h("div");
21
- const inspectHost = h("div", h("p.lt3-faint", { style: { margin: 0 } }, "Pick a tier to inspect its contents."));
22
-
23
- const recallInput = h("input.lt3-input", { type: "text", placeholder: "Recall from workspace + graph memory…", "aria-label": "Recall memory" });
24
-
25
- const root = h("div.lt3-stack-6",
26
- c.viewHeader({
27
- eyebrow: "Retrieval",
28
- title: "Memory",
29
- sub: "Long-term memory unified across workspace, project, agent, conversation, graph, and vector tiers — recall, inspect, and maintain it without leaving /app.",
30
- actions: [srcBadge],
31
- }),
32
- statHost,
33
- c.panel({
34
- title: "Recall", sub: "Searches your workspace and knowledge-graph memory.",
35
- children: h("div.lt3-stack-3",
36
- h("div.lt3-row-2",
37
- recallInput,
38
- h("button.lt3-btn.lt3-btn--primary", { on: { click: doRecall } }, c.icon("search"), "Recall"),
39
- ),
40
- recallHost,
41
- ),
42
- }),
43
- h("section",
44
- c.sectionHead("Memory sources", h("div.lt3-row-2",
45
- h("button.lt3-btn.lt3-btn--subtle.lt3-btn--sm", { on: { click: () => act("compact") } }, c.icon("arrows-minimize"), "Compact"),
46
- h("button.lt3-btn.lt3-btn--subtle.lt3-btn--sm", { on: { click: () => act("rebuild") } }, c.icon("refresh"), "Rebuild vectors"),
47
- )),
48
- sourcesHost,
49
- ),
50
- c.panel({ title: "Inspect tier", children: h("div.lt3-stack-3", tierTabs(ctx, inspectHost), inspectHost) }),
51
- );
52
-
53
- hydrate();
54
- return root;
55
-
56
- async function hydrate() {
57
- const res = await ctx.api.memoryManager();
58
- const data = res.data || {};
59
- const sources = Array.isArray(data.sources) ? data.sources : [];
60
- srcBadge.replaceChildren(c.sourceBadge(res.source));
61
-
62
- if (!sources.length) {
63
- statHost.replaceChildren(c.stat({ label: "Memory", value: "—", icon: "brain" }));
64
- sourcesHost.replaceChildren(c.emptyState({ icon: "database-off", title: "Memory unavailable", body: "Start the backend to read the memory platform." }));
65
- return;
66
- }
67
- const usage = data.usage || {};
68
- statHost.replaceChildren(
69
- c.stat({ label: "Total items", value: c.fmtNum(usage.total_items), icon: "stack-2" }),
70
- c.stat({ label: "On disk", value: fmtBytes(usage.total_bytes), icon: "database" }),
71
- c.stat({ label: "Tiers", value: c.fmtNum((data.tiers || []).length), icon: "layers" }),
72
- c.stat({ label: "Health", value: data.health || "—", icon: "heartbeat" }),
73
- );
74
- sourcesHost.replaceChildren(c.table(
75
- [
76
- { key: "label", label: "Source", render: (r) => h("div.lt3-row-2", c.icon(TIER_ICON[r.type] || "circle"), h("b", r.label)) },
77
- { key: "type", label: "Type", width: "1%", render: (r) => c.pill(r.type) },
78
- { key: "count", label: "Items", width: "1%", render: (r) => h("span", { style: { "font-variant-numeric": "tabular-nums" } }, r.count == null ? "—" : c.fmtNum(r.count)) },
79
- { key: "size", label: "Size", width: "1%", render: (r) => h("span.lt3-faint", r.size_bytes ? fmtBytes(r.size_bytes) : "—") },
80
- { key: "health", label: "Health", width: "1%", render: (r) => c.statePill(r.health === "ok" ? "ready" : r.health === "unavailable" ? "failed" : "idle") },
81
- { key: "detail", label: "Detail", render: (r) => h("span.lt3-muted", r.detail || "") },
82
- ],
83
- sources,
84
- ));
85
- }
86
-
87
- async function doRecall() {
88
- const q = recallInput.value.trim();
89
- recallHost.replaceChildren(c.loading({ lines: 2 }));
90
- const res = await ctx.api.memoryRecall(q, 25);
91
- const items = (res.data && res.data.results) || [];
92
- if (!res.ok) { recallHost.replaceChildren(c.banner("Recall is unavailable — start the backend.", "warn")); return; }
93
- if (!items.length) { recallHost.replaceChildren(c.emptyState({ icon: "search-off", title: "No matches", body: "Nothing recalled for that query yet." })); return; }
94
- recallHost.replaceChildren(h("div.lt3-stack-2", items.map((it) => c.card(
95
- h("div.lt3-stack-2",
96
- h("div.lt3-row", { style: { "justify-content": "space-between" } }, h("b", it.title || "memory"), c.pill(it.source, it.source === "graph" ? "info" : "")),
97
- h("p.lt3-muted", { style: { margin: 0, "font-size": "var(--lt3-text-sm)" } }, it.snippet || ""),
98
- ), { flat: true },
99
- ))));
100
- }
101
-
102
- async function act(kind) {
103
- const fn = kind === "compact" ? ctx.api.memoryCompact() : ctx.api.memoryRebuild("vector");
104
- const res = await fn;
105
- if (res && (res.ok || res.data)) {
106
- const d = res.data || res;
107
- const msg = kind === "compact" ? `Compacted ${d.compacted ?? 0} duplicate memories` : `Rebuild: ${d.status || "ok"}`;
108
- ctx.toast(msg, d.status === "error" || d.status === "unavailable" ? "err" : "ok");
109
- } else {
110
- ctx.toast(`${kind} unavailable`, "err");
111
- }
112
- hydrate();
113
- }
114
-
115
- function tierTabs(ctx2, host) {
116
- const tiers = ["workspace", "project", "agent", "conversation", "graph", "vector"];
117
- let active = null;
118
- return c.segmented(tiers.map((t) => ({ key: t, label: t })), active, async (key) => {
119
- host.replaceChildren(c.loading({ lines: 2 }));
120
- const res = await ctx2.api.memoryInspect(key, 50);
121
- const d = res.data || {};
122
- if (key === "graph") { host.replaceChildren(jsonBlock(ctx2, d.stats || {}, d.available)); return; }
123
- if (key === "vector") { host.replaceChildren(jsonBlock(ctx2, d.index || {}, d.available)); return; }
124
- const items = d.items || [];
125
- if (!items.length) { host.replaceChildren(c.emptyState({ icon: "inbox", title: `No ${key} memory`, body: "This tier has no items yet." })); return; }
126
- host.replaceChildren(h("div.lt3-stack-2", items.slice(0, 50).map((m) => c.card(
127
- h("div.lt3-stack-2",
128
- h("div.lt3-row-2", m.kind ? c.pill(m.kind) : null, h("b", { style: { "font-size": "var(--lt3-text-sm)" } }, m.title || m.id || "item")),
129
- h("p.lt3-muted", { style: { margin: 0, "font-size": "var(--lt3-text-sm)" } }, m.content || (m.messages != null ? `${m.messages} messages` : "")),
130
- ), { flat: true },
131
- ))));
132
- });
133
- }
134
-
135
- function jsonBlock(ctx2, obj, available) {
136
- if (!available) return c.emptyState({ icon: "database-off", title: "Unavailable", body: "This tier is disabled or empty." });
137
- return h("pre", { style: { margin: 0, "white-space": "pre-wrap", "font-family": "var(--lt3-font-mono)", "font-size": "var(--lt3-text-xs)", color: "var(--muted)" } }, JSON.stringify(obj, null, 2));
138
- }
139
- }
140
-
141
- function fmtBytes(n) {
142
- const v = Number(n) || 0;
143
- if (v <= 0) return "—";
144
- if (v >= 1 << 20) return (v / (1 << 20)).toFixed(1) + " MB";
145
- if (v >= 1 << 10) return (v / (1 << 10)).toFixed(1) + " KB";
146
- return v + " B";
147
- }