ltcai 3.0.1 → 3.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 (96) hide show
  1. package/README.md +27 -20
  2. package/docs/CHANGELOG.md +37 -0
  3. package/docs/V3_FRONTEND.md +20 -17
  4. package/latticeai/__init__.py +1 -1
  5. package/latticeai/api/auth.py +4 -1
  6. package/latticeai/api/search.py +4 -0
  7. package/latticeai/core/config.py +2 -0
  8. package/latticeai/core/embedding_providers.py +123 -0
  9. package/latticeai/core/workspace_os.py +1 -1
  10. package/latticeai/server_app.py +22 -6
  11. package/package.json +9 -4
  12. package/scripts/build_v3_assets.mjs +164 -0
  13. package/scripts/capture/README.md +28 -0
  14. package/scripts/capture/capture_enterprise.js +8 -0
  15. package/scripts/capture/capture_graph.js +8 -0
  16. package/scripts/capture/capture_onboarding.js +8 -0
  17. package/scripts/capture/capture_page.js +43 -0
  18. package/scripts/capture/capture_release_media.js +125 -0
  19. package/scripts/capture/capture_skills.js +8 -0
  20. package/scripts/capture/capture_workspace.js +8 -0
  21. package/scripts/generate_diagrams.py +513 -0
  22. package/scripts/lint_v3.mjs +33 -0
  23. package/scripts/release-0.3.1.sh +105 -0
  24. package/scripts/take_screenshots.js +69 -0
  25. package/scripts/validate_release_artifacts.py +167 -0
  26. package/static/account.html +9 -9
  27. package/static/activity.html +4 -4
  28. package/static/admin.html +8 -8
  29. package/static/agents.html +4 -4
  30. package/static/chat.html +9 -9
  31. package/static/css/tokens.5a595671.css +260 -0
  32. package/static/css/tokens.css +1 -1
  33. package/static/graph.html +9 -9
  34. package/static/plugins.html +4 -4
  35. package/static/sw.js +3 -1
  36. package/static/v3/asset-manifest.json +47 -0
  37. package/static/v3/css/lattice.base.e4cdd05d.css +128 -0
  38. package/static/v3/css/lattice.components.011e988b.css +447 -0
  39. package/static/v3/css/lattice.components.css +2 -2
  40. package/static/v3/css/lattice.shell.4920f42d.css +407 -0
  41. package/static/v3/css/lattice.tokens.c597ff81.css +132 -0
  42. package/static/v3/css/lattice.views.3ee19d4e.css +277 -0
  43. package/static/v3/index.html +38 -9
  44. package/static/v3/js/app.46fb61d9.js +26 -0
  45. package/static/v3/js/core/api.22a41d42.js +344 -0
  46. package/static/v3/js/core/api.js +68 -51
  47. package/static/v3/js/core/components.4c83e0a9.js +222 -0
  48. package/static/v3/js/core/components.js +9 -2
  49. package/static/v3/js/core/dom.a2773eb0.js +148 -0
  50. package/static/v3/js/core/router.584570f2.js +37 -0
  51. package/static/v3/js/core/routes.f935dd50.js +78 -0
  52. package/static/v3/js/core/routes.js +6 -1
  53. package/static/v3/js/core/shell.1b6199d6.js +363 -0
  54. package/static/v3/js/core/store.34ebd5e6.js +113 -0
  55. package/static/v3/js/views/admin-audit.660a1fb1.js +185 -0
  56. package/static/v3/js/views/admin-audit.js +1 -1
  57. package/static/v3/js/views/admin-permissions.a7ae5f09.js +177 -0
  58. package/static/v3/js/views/admin-permissions.js +4 -5
  59. package/static/v3/js/views/admin-policies.3658fd86.js +102 -0
  60. package/static/v3/js/views/admin-policies.js +4 -5
  61. package/static/v3/js/views/admin-private-vpc.7d342d36.js +135 -0
  62. package/static/v3/js/views/admin-private-vpc.js +2 -5
  63. package/static/v3/js/views/admin-security.07c66b72.js +180 -0
  64. package/static/v3/js/views/admin-security.js +4 -5
  65. package/static/v3/js/views/admin-users.03bac88c.js +168 -0
  66. package/static/v3/js/views/admin-users.js +6 -6
  67. package/static/v3/js/views/agents.14e48bdd.js +193 -0
  68. package/static/v3/js/views/agents.js +1 -2
  69. package/static/v3/js/views/chat.718144ce.js +449 -0
  70. package/static/v3/js/views/chat.js +2 -3
  71. package/static/v3/js/views/files.4935197e.js +186 -0
  72. package/static/v3/js/views/files.js +27 -21
  73. package/static/v3/js/views/home.cdde3b32.js +119 -0
  74. package/static/v3/js/views/hybrid-search.b22b97e0.js +195 -0
  75. package/static/v3/js/views/hybrid-search.js +1 -1
  76. package/static/v3/js/views/knowledge-graph.a14ea7e7.js +237 -0
  77. package/static/v3/js/views/knowledge-graph.js +2 -3
  78. package/static/v3/js/views/models.a1ffa147.js +256 -0
  79. package/static/v3/js/views/models.js +17 -8
  80. package/static/v3/js/views/my-computer.1b2ff621.js +237 -0
  81. package/static/v3/js/views/my-computer.js +5 -5
  82. package/static/v3/js/views/pipeline.c522f1ce.js +157 -0
  83. package/static/v3/js/views/pipeline.js +3 -7
  84. package/static/v3/js/views/settings.4f777210.js +250 -0
  85. package/static/v3/js/views/settings.js +6 -14
  86. package/static/workflows.html +4 -4
  87. package/static/workspace.html +5 -5
  88. package/docs/images/tmp_frames/frame_00.png +0 -0
  89. package/docs/images/tmp_frames/frame_01.png +0 -0
  90. package/docs/images/tmp_frames/frame_02.png +0 -0
  91. package/docs/images/tmp_frames/frame_03.png +0 -0
  92. package/docs/images/tmp_frames/hero_00.png +0 -0
  93. package/docs/images/tmp_frames/hero_01.png +0 -0
  94. package/docs/images/tmp_frames/hero_02.png +0 -0
  95. package/docs/images/tmp_frames/hero_03.png +0 -0
  96. package/static/v3/js/core/fixtures.js +0 -171
@@ -0,0 +1,177 @@
1
+ /* ============================================================================
2
+ * View: Permissions — Administration · roles and capability mapping (RBAC).
3
+ * Renders the role → capability matrix and per-role summaries from the admin
4
+ * roles endpoint. Capabilities map to product areas; "all" grants everything.
5
+ * Role editing is read-only unless a backend mutation route is added.
6
+ *
7
+ * View contract (shared by all views):
8
+ * export async function render(ctx) -> single DOM node
9
+ * ctx = { h, icon, api, store, c, route, params, navigate, toast }
10
+ * ========================================================================== */
11
+
12
+ /* Capability columns, in product-area order. Each maps to a routable surface
13
+ * and a Tabler icon so the matrix reads at a glance. */
14
+ const CAPS = [
15
+ { key: "chat", label: "Chat", icon: "message-2", route: "chat" },
16
+ { key: "search", label: "Search", icon: "arrows-join", route: "hybrid-search" },
17
+ { key: "files", label: "Files", icon: "folders", route: "files" },
18
+ { key: "pipeline", label: "Pipeline", icon: "git-branch", route: "pipeline" },
19
+ { key: "users", label: "Users", icon: "users", route: "admin/users" },
20
+ { key: "policies", label: "Policies", icon: "shield-lock", route: "admin/policies" },
21
+ { key: "audit", label: "Audit", icon: "history", route: "admin/audit" },
22
+ { key: "security", label: "Security", icon: "shield-check", route: "admin/security" },
23
+ ];
24
+
25
+ const ROLE_META = {
26
+ owner: { icon: "crown", variant: "ok" },
27
+ admin: { icon: "shield-check", variant: "info" },
28
+ member: { icon: "user-check", variant: "" },
29
+ viewer: { icon: "eye", variant: "warn" },
30
+ };
31
+ const metaFor = (role) => ROLE_META[String(role).toLowerCase()] || { icon: "user", variant: "" };
32
+
33
+ /** A role grants a capability when it holds "all" or that specific cap. */
34
+ const grants = (caps, key) => Array.isArray(caps) && (caps.includes("all") || caps.includes(key));
35
+ const capLabel = (key) => (CAPS.find((cc) => cc.key === key)?.label) || key;
36
+
37
+ export async function render(ctx) {
38
+ const { h, icon, c, navigate, toast } = ctx;
39
+
40
+ // Live RBAC roles from /admin/roles.
41
+ const res = await ctx.api.adminRoles();
42
+ const roles = Array.isArray(res.data && res.data.roles) ? res.data.roles
43
+ : (Array.isArray(res.data) ? res.data : []);
44
+ const source = res.source;
45
+ const totalMembers = roles.reduce((sum, r) => sum + (r.members || 0), 0);
46
+
47
+ const root = h("div.lt3-stack-6",
48
+ c.viewHeader({
49
+ eyebrow: "Administration",
50
+ title: "Permissions",
51
+ sub: "Roles and capability mapping.",
52
+ actions: [
53
+ c.sourceBadge(source),
54
+ h("button.lt3-btn.lt3-btn--ghost", { on: { click: () => navigate("admin/users") } }, icon("users"), "Members"),
55
+ h("button.lt3-btn.lt3-btn--primary", { on: { click: () => pendingToast(toast, "Creating a role") } }, icon("plus"), "New role"),
56
+ ],
57
+ }),
58
+
59
+ c.banner(
60
+ "Access is role-based (RBAC): every member holds exactly one role, and each role grants a set of capabilities that map to product areas. The owner role grants all capabilities.",
61
+ "info",
62
+ "shield-lock",
63
+ ),
64
+
65
+ h("div.lt3-statrow",
66
+ c.stat({ label: "Roles", value: roles.length, icon: "id-badge-2" }),
67
+ c.stat({ label: "Members", value: c.fmtNum(totalMembers), icon: "users" }),
68
+ c.stat({ label: "Capabilities", value: CAPS.length, icon: "key" }),
69
+ c.stat({ label: "Full-access roles", value: roles.filter((r) => (r.caps || []).includes("all")).length, icon: "crown" }),
70
+ ),
71
+
72
+ c.panel({
73
+ eyebrow: "RBAC",
74
+ title: "Capability matrix",
75
+ sub: "Which product areas each role can reach. Scroll horizontally to see every capability.",
76
+ children: buildMatrix(ctx, roles),
77
+ }),
78
+
79
+ h("section",
80
+ c.sectionHead("Roles", c.sourceBadge(source)),
81
+ buildRoleGrid(ctx, roles),
82
+ ),
83
+ );
84
+
85
+ return root;
86
+ }
87
+
88
+ /* ── Capability matrix ──────────────────────────────────────────────────── */
89
+ function buildMatrix(ctx, roles) {
90
+ const { h, icon, c } = ctx;
91
+
92
+ if (!roles.length) {
93
+ return c.emptyState({ icon: "lock-off", title: "No roles defined", body: "Define a role to start mapping capabilities." });
94
+ }
95
+
96
+ const columns = [
97
+ {
98
+ key: "role",
99
+ label: "Role",
100
+ width: "180px",
101
+ render: (r) => {
102
+ const m = metaFor(r.role);
103
+ return h("div.lt3-row-2", { style: { "align-items": "center" } },
104
+ h("span.lt3-result__rank", { style: { color: "var(--accent)" } }, icon(m.icon)),
105
+ h("div.lt3-stack",
106
+ h("b", { style: { "font-size": "var(--lt3-text-sm)", "text-transform": "capitalize" } }, r.role),
107
+ c.pill(`${c.fmtNum(r.members || 0)} ${(r.members === 1) ? "member" : "members"}`, m.variant || "", { dot: true }),
108
+ ),
109
+ );
110
+ },
111
+ },
112
+ ...CAPS.map((cap) => ({
113
+ key: cap.key,
114
+ label: cap.label,
115
+ render: (r) => cell(ctx, grants(r.caps, cap.key)),
116
+ })),
117
+ ];
118
+
119
+ return c.table(columns, roles);
120
+ }
121
+
122
+ /** A matrix cell: accent check when granted, muted dash when not. */
123
+ function cell({ h, icon }, granted) {
124
+ return h("div", { style: { display: "grid", "place-items": "center" }, "aria-label": granted ? "granted" : "not granted" },
125
+ granted
126
+ ? h("span", { style: { color: "var(--accent)", "font-size": "var(--lt3-text-lg)", "line-height": "1" } }, icon("check"))
127
+ : h("span.lt3-faint", { style: { "font-size": "var(--lt3-text-lg)", "line-height": "1" }, "aria-hidden": "true" }, "–"),
128
+ );
129
+ }
130
+
131
+ /* ── Per-role summary cards ─────────────────────────────────────────────── */
132
+ function buildRoleGrid(ctx, roles) {
133
+ const { h } = ctx;
134
+ if (!roles.length) {
135
+ return ctx.c.emptyState({ icon: "lock-off", title: "No roles defined", body: "Define a role to map capabilities." });
136
+ }
137
+ return h("div.lt3-grid-auto", roles.map((r) => roleCard(ctx, r)));
138
+ }
139
+
140
+ function roleCard(ctx, r) {
141
+ const { h, icon, c, toast } = ctx;
142
+ const m = metaFor(r.role);
143
+ const isAll = (r.caps || []).includes("all");
144
+ const grantedKeys = isAll ? CAPS.map((cc) => cc.key) : CAPS.filter((cc) => (r.caps || []).includes(cc.key)).map((cc) => cc.key);
145
+
146
+ return c.card(
147
+ h("div.lt3-stack-3",
148
+ h("div.lt3-row", { style: { "justify-content": "space-between", "align-items": "flex-start" } },
149
+ h("div.lt3-row-2", { style: { "align-items": "center" } },
150
+ h("span.lt3-quick__icon", icon(m.icon)),
151
+ h("div.lt3-stack",
152
+ h("b", { style: { "font-size": "var(--lt3-text-md)", "text-transform": "capitalize" } }, r.role),
153
+ h("div.lt3-faint", { style: { "font-size": "var(--lt3-text-2xs)" } }, `${c.fmtNum(r.members || 0)} ${(r.members === 1) ? "member" : "members"}`),
154
+ ),
155
+ ),
156
+ c.pill(isAll ? "Full access" : `${grantedKeys.length}/${CAPS.length}`, m.variant || "info"),
157
+ ),
158
+
159
+ h("div.lt3-cluster", { "aria-label": `${r.role} capabilities` },
160
+ isAll
161
+ ? h("span.lt3-chip", { dataset: { active: "true" } }, icon("infinity"), "All capabilities")
162
+ : (grantedKeys.length
163
+ ? grantedKeys.map((k) => h("span.lt3-chip", { dataset: { active: "true" } }, icon(CAPS.find((cc) => cc.key === k).icon), capLabel(k)))
164
+ : h("span.lt3-faint", { style: { "font-size": "var(--lt3-text-xs)" } }, "No capabilities")),
165
+ ),
166
+
167
+ h("button.lt3-btn.lt3-btn--subtle.lt3-btn--sm", { style: { "align-self": "flex-start" }, on: { click: () => pendingToast(toast, `Editing the ${r.role} role`) } },
168
+ icon("edit"), "Edit role"),
169
+ ),
170
+ { attrs: { "data-role": r.role } },
171
+ );
172
+ }
173
+
174
+ /* ── Read-only affordance ───────────────────────────────────────────────── */
175
+ function pendingToast(toast, what) {
176
+ toast(`${what} is not available in this build — roles are a fixed RBAC model (owner · admin · member · viewer).`, "warn");
177
+ }
@@ -1,9 +1,8 @@
1
1
  /* ============================================================================
2
2
  * View: Permissions — Administration · roles and capability mapping (RBAC).
3
3
  * Renders the role → capability matrix and per-role summaries from the admin
4
- * roles fixture. Capabilities map to product areas; "all" grants everything.
5
- * Role editing is integration-ready (no backend logic here) actions surface
6
- * a clearly-labeled "pending backend" toast.
4
+ * roles endpoint. Capabilities map to product areas; "all" grants everything.
5
+ * Role editing is read-only unless a backend mutation route is added.
7
6
  *
8
7
  * View contract (shared by all views):
9
8
  * export async function render(ctx) -> single DOM node
@@ -38,7 +37,7 @@ const capLabel = (key) => (CAPS.find((cc) => cc.key === key)?.label) || key;
38
37
  export async function render(ctx) {
39
38
  const { h, icon, c, navigate, toast } = ctx;
40
39
 
41
- // Live RBAC roles from /admin/roles; clearly-badged sample data on fallback.
40
+ // Live RBAC roles from /admin/roles.
42
41
  const res = await ctx.api.adminRoles();
43
42
  const roles = Array.isArray(res.data && res.data.roles) ? res.data.roles
44
43
  : (Array.isArray(res.data) ? res.data : []);
@@ -172,7 +171,7 @@ function roleCard(ctx, r) {
172
171
  );
173
172
  }
174
173
 
175
- /* ── Pending-backend affordance ─────────────────────────────────────────── */
174
+ /* ── Read-only affordance ───────────────────────────────────────────────── */
176
175
  function pendingToast(toast, what) {
177
176
  toast(`${what} is not available in this build — roles are a fixed RBAC model (owner · admin · member · viewer).`, "warn");
178
177
  }
@@ -0,0 +1,102 @@
1
+ /* ============================================================================
2
+ * View: Policies — administration · governance and enforcement.
3
+ * Surfaces the local-first guardrails the workspace enforces and the open-core
4
+ * seam where Enterprise governance packs extend them. Policy state reflects the
5
+ * live /admin/policies contract; missing backend data renders unavailable.
6
+ * ========================================================================== */
7
+
8
+ // Governance capabilities that live behind the open-core Enterprise seam. These
9
+ // are extension points, not implemented backend logic.
10
+ const PACKS = [
11
+ { id: "siem", icon: "broadcast", title: "SIEM export", desc: "Stream the audit trail to an external SIEM (Splunk, Elastic, Sentinel)." },
12
+ { id: "retention", icon: "archive", title: "Compliance retention", desc: "Configurable retention windows and legal-hold for messages and traces." },
13
+ { id: "isolation", icon: "wall", title: "Tenant isolation", desc: "Hard multi-tenant boundaries with per-tenant keys and storage." },
14
+ ];
15
+
16
+ export async function render(ctx) {
17
+ const { h, icon, c, toast } = ctx;
18
+
19
+ // Live governance posture from /admin/policies.
20
+ const res = await ctx.api.adminPolicies();
21
+ const policies = Array.isArray(res.data && res.data.policies) ? res.data.policies
22
+ : (Array.isArray(res.data) ? res.data : []);
23
+ const source = res.source;
24
+
25
+ const root = h("div.lt3-stack-6",
26
+ c.viewHeader({
27
+ eyebrow: "Administration",
28
+ title: "Policies",
29
+ sub: "Governance and enforcement.",
30
+ actions: [c.sourceBadge(source)],
31
+ }),
32
+
33
+ c.banner(
34
+ "Policies enforce Lattice's local-first guardrails. Enterprise packs extend them with org-wide governance.",
35
+ "info",
36
+ "shield-lock",
37
+ ),
38
+
39
+ h("section.lt3-stack-3",
40
+ c.sectionHead(
41
+ "Active guardrails",
42
+ c.sourceBadge(source),
43
+ ),
44
+ policies.length
45
+ ? h("div.lt3-stack-3", policies.map((p) => policyRow(ctx, p)))
46
+ : c.emptyState({ icon: "shield-off", title: "No policies defined", body: "Policies appear once the governance backend is connected." }),
47
+ ),
48
+
49
+ packsPanel(ctx),
50
+ );
51
+
52
+ return root;
53
+ }
54
+
55
+ /* ── One policy row: description and its real, runtime-enforced state ─────── */
56
+ // Policies are enforced by the runtime (approval gating, local-only egress,
57
+ // local storage). They are reported read-only — not user-toggleable — so the UI
58
+ // never implies a guardrail can be relaxed from the browser.
59
+ function policyRow({ h, icon, c }, p) {
60
+ return c.card(
61
+ h("div.lt3-row", { style: { "justify-content": "space-between", "align-items": "flex-start", "gap": "var(--lt3-space-4)", "flex-wrap": "wrap" } },
62
+ h("div.lt3-stack-2", { style: { "min-width": "0", "flex": "1 1 320px" } },
63
+ h("div.lt3-row-2",
64
+ h("span.lt3-card__icon", { style: { color: "var(--accent)" } }, icon("shield-check")),
65
+ h("h3", { style: { "font-size": "var(--lt3-text-base)", "font-weight": "var(--lt3-weight-semibold)", "margin": "0" } }, p.label),
66
+ ),
67
+ h("p.lt3-muted", { style: { "font-size": "var(--lt3-text-sm)", "margin": "0" } }, p.value),
68
+ ),
69
+ h("div.lt3-row-2", { style: { "flex": "none", "align-items": "center" } },
70
+ c.statePill(p.enforced ? "active" : "idle"),
71
+ h("span.lt3-faint", { style: { "font-size": "var(--lt3-text-2xs)" } }, p.enforced ? "Enforced" : "Not enforced"),
72
+ ),
73
+ ),
74
+ );
75
+ }
76
+
77
+ /* ── Enterprise governance packs (open-core extension points) ────────────── */
78
+ function packsPanel({ h, icon, c }) {
79
+ return c.panel({
80
+ eyebrow: "Open core",
81
+ title: "Policy packs",
82
+ sub: "Governance capabilities available as Enterprise extension points on top of the local-first core.",
83
+ actions: c.sourceBadge("unavailable"),
84
+ children: h("div.lt3-stack-2",
85
+ PACKS.map((pk) => h("div.lt3-card.lt3-card--flat",
86
+ h("div.lt3-row", { style: { "justify-content": "space-between", "align-items": "center", "gap": "var(--lt3-space-4)", "flex-wrap": "wrap" } },
87
+ h("div.lt3-row-2", { style: { "min-width": "0", "flex": "1 1 320px" } },
88
+ h("span.lt3-card__icon", { style: { color: "var(--muted)" } }, icon(pk.icon)),
89
+ h("div.lt3-stack-2", { style: { "min-width": "0" } },
90
+ h("div", { style: { "font-weight": "var(--lt3-weight-medium)" } }, pk.title),
91
+ h("div.lt3-faint", { style: { "font-size": "var(--lt3-text-xs)" } }, pk.desc),
92
+ ),
93
+ ),
94
+ h("div.lt3-row-2", { style: { "flex": "none" } },
95
+ c.pill("Enterprise", "info"),
96
+ h("span.lt3-faint", { style: { "font-size": "var(--lt3-text-2xs)" } }, "Available as an extension point"),
97
+ ),
98
+ ),
99
+ )),
100
+ ),
101
+ });
102
+ }
@@ -2,12 +2,11 @@
2
2
  * View: Policies — administration · governance and enforcement.
3
3
  * Surfaces the local-first guardrails the workspace enforces and the open-core
4
4
  * seam where Enterprise governance packs extend them. Policy state reflects the
5
- * documented future contract (fx.ADMIN.policies); toggles are integration-ready
6
- * and clearly defer their enforcement to the backend.
5
+ * live /admin/policies contract; missing backend data renders unavailable.
7
6
  * ========================================================================== */
8
7
 
9
8
  // Governance capabilities that live behind the open-core Enterprise seam. These
10
- // are extension points, not implemented backend logic — labeled as sample data.
9
+ // are extension points, not implemented backend logic.
11
10
  const PACKS = [
12
11
  { id: "siem", icon: "broadcast", title: "SIEM export", desc: "Stream the audit trail to an external SIEM (Splunk, Elastic, Sentinel)." },
13
12
  { id: "retention", icon: "archive", title: "Compliance retention", desc: "Configurable retention windows and legal-hold for messages and traces." },
@@ -17,7 +16,7 @@ const PACKS = [
17
16
  export async function render(ctx) {
18
17
  const { h, icon, c, toast } = ctx;
19
18
 
20
- // Live governance posture from /admin/policies; sample data on fallback.
19
+ // Live governance posture from /admin/policies.
21
20
  const res = await ctx.api.adminPolicies();
22
21
  const policies = Array.isArray(res.data && res.data.policies) ? res.data.policies
23
22
  : (Array.isArray(res.data) ? res.data : []);
@@ -81,7 +80,7 @@ function packsPanel({ h, icon, c }) {
81
80
  eyebrow: "Open core",
82
81
  title: "Policy packs",
83
82
  sub: "Governance capabilities available as Enterprise extension points on top of the local-first core.",
84
- actions: c.sourceBadge("placeholder"),
83
+ actions: c.sourceBadge("unavailable"),
85
84
  children: h("div.lt3-stack-2",
86
85
  PACKS.map((pk) => h("div.lt3-card.lt3-card--flat",
87
86
  h("div.lt3-row", { style: { "justify-content": "space-between", "align-items": "center", "gap": "var(--lt3-space-4)", "flex-wrap": "wrap" } },
@@ -0,0 +1,135 @@
1
+ /* ============================================================================
2
+ * View: Admin · Private VPC — network isolation and peering.
3
+ * Lattice is local-first: by default everything runs on-prem with no external
4
+ * network egress. Private VPC is an Enterprise networking extension for teams
5
+ * that need cloud peering. Reads /vpc/status (fallback-safe, badged) and never
6
+ * invents backend mutations.
7
+ * ========================================================================== */
8
+
9
+ const PENDING = "an Enterprise networking feature, not available in this build.";
10
+
11
+ export async function render(ctx) {
12
+ const { h, icon, api, c, toast } = ctx;
13
+
14
+ const statusHost = h("div", c.loading({ lines: 4 }));
15
+ const subnetsHost = h("div", c.loading({ lines: 3 }));
16
+ const srcSlot = h("span", c.sourceBadge("pending"));
17
+
18
+ const root = h("div.lt3-stack-6",
19
+ c.viewHeader({
20
+ eyebrow: "Administration",
21
+ title: "Private VPC",
22
+ sub: "Network isolation and peering.",
23
+ actions: [
24
+ h("button.lt3-btn.lt3-btn--primary",
25
+ { on: { click: () => toast("Configure peering — " + PENDING, "info") } },
26
+ icon("network"), "Configure peering"),
27
+ ],
28
+ }),
29
+
30
+ c.banner(
31
+ "Lattice is local-first. By default everything runs on this machine with no external network egress — Private VPC is an Enterprise networking extension for teams that need cloud peering.",
32
+ "info", "shield-lock"),
33
+
34
+ c.panel({
35
+ eyebrow: "Network",
36
+ head: h("div.lt3-row", { style: { "justify-content": "space-between", width: "100%" } },
37
+ h("div",
38
+ h("div.lt3-eyebrow", "Network"),
39
+ h("h3.lt3-panel__title", "Connectivity status"),
40
+ ),
41
+ srcSlot,
42
+ ),
43
+ children: statusHost,
44
+ }),
45
+
46
+ c.panel({
47
+ eyebrow: "Topology",
48
+ title: "Private subnets",
49
+ sub: "Peered subnets exposed to this workspace.",
50
+ children: subnetsHost,
51
+ }),
52
+
53
+ buildPosture(ctx),
54
+ );
55
+
56
+ hydrate(ctx, { statusHost, subnetsHost, srcSlot });
57
+ return root;
58
+ }
59
+
60
+ /* ── Network posture summary (always-true, local-first facts) ─────────────── */
61
+ function buildPosture({ h, icon, c }) {
62
+ const items = [
63
+ { icon: "plug-connected-x", label: "Egress", value: "None", variant: "ok", note: "No external network calls" },
64
+ { icon: "cpu", label: "Inference", value: "Local", variant: "ok", note: "On-device MLX runtime" },
65
+ { icon: "folder-lock", label: "Storage", value: "~/.ltcai", variant: "info", note: "Single-tenant on disk" },
66
+ ];
67
+ return h("section",
68
+ c.sectionHead("Network posture"),
69
+ h("div.lt3-grid-3",
70
+ items.map((it) => c.card(
71
+ h("div.lt3-stack-2",
72
+ h("div.lt3-row", { style: { "justify-content": "space-between", "align-items": "flex-start" } },
73
+ h("div.lt3-stat__label", icon(it.icon), it.label),
74
+ c.pill(it.value, it.variant, { dot: true }),
75
+ ),
76
+ h("div.lt3-faint", { style: { "font-size": "var(--lt3-text-2xs)" } }, it.note),
77
+ ),
78
+ { flat: true },
79
+ )),
80
+ ),
81
+ );
82
+ }
83
+
84
+ /* ── Hydration ────────────────────────────────────────────────────────────── */
85
+ async function hydrate(ctx, hosts) {
86
+ const { h, icon, api, c } = ctx;
87
+ const { statusHost, subnetsHost, srcSlot } = hosts;
88
+
89
+ const res = await api.vpcStatus();
90
+ const vpc = (res.data && typeof res.data === "object") ? res.data : {};
91
+ srcSlot.replaceChildren(c.sourceBadge(res.source));
92
+
93
+ const subnets = Array.isArray(vpc.private_subnets) ? vpc.private_subnets : [];
94
+
95
+ // Status key/value block.
96
+ const rows = [
97
+ { icon: "cloud", k: "Provider", v: vpc.provider || "local", mono: true },
98
+ { icon: "map-pin", k: "Region", v: vpc.region || "on-prem", mono: true },
99
+ { icon: "lock", k: "VPN status", node: c.statePill(vpc.vpn_status || "standby") },
100
+ { icon: "arrows-transfer-up", k: "Peering status", node: c.statePill(vpc.peering_status || "not_configured") },
101
+ { icon: "plug-connected-x", k: "Egress", node: c.pill("local-only", "ok", { dot: true }) },
102
+ { icon: "subtask", k: "Subnets", v: String(subnets.length) },
103
+ ];
104
+ statusHost.replaceChildren(
105
+ h("dl.lt3-keyval",
106
+ rows.flatMap((r) => [
107
+ h("dt", h("span.lt3-row-2", icon(r.icon), r.k)),
108
+ h("dd", r.node ? r.node : (r.mono ? h("span.lt3-mono", String(r.v)) : String(r.v))),
109
+ ]),
110
+ ),
111
+ !vpc.enabled && h("div.lt3-row-2", { style: { "margin-top": "var(--lt3-space-4)" } },
112
+ c.pill("Enterprise extension", "info", { dot: true }),
113
+ h("span.lt3-faint", { style: { "font-size": "var(--lt3-text-2xs)" } },
114
+ "Private VPC is inactive — Lattice is running fully local."),
115
+ ),
116
+ );
117
+
118
+ // Private subnets table / empty state.
119
+ if (!subnets.length) {
120
+ subnetsHost.replaceChildren(c.emptyState({
121
+ icon: "network-off",
122
+ title: "No private subnets",
123
+ body: "Peering is not configured. Lattice runs fully local by default.",
124
+ }));
125
+ return;
126
+ }
127
+
128
+ const columns = [
129
+ { key: "name", label: "Subnet", render: (s) => h("span.lt3-row-2", icon("subtask"), String(s.name || s.id || "subnet")) },
130
+ { key: "cidr", label: "CIDR", render: (s) => h("span.lt3-mono", String(s.cidr || s.range || "—")) },
131
+ { key: "zone", label: "Zone", render: (s) => String(s.zone || s.az || "—") },
132
+ { key: "state", label: "State", width: "120px", render: (s) => c.statePill(s.state || "active") },
133
+ ];
134
+ subnetsHost.replaceChildren(c.table(columns, subnets));
135
+ }
@@ -3,12 +3,9 @@
3
3
  * Lattice is local-first: by default everything runs on-prem with no external
4
4
  * network egress. Private VPC is an Enterprise networking extension for teams
5
5
  * that need cloud peering. Reads /vpc/status (fallback-safe, badged) and never
6
- * invents backend mutations — the peering control explains the write side is
7
- * pending so the surface stays integration-ready.
6
+ * invents backend mutations.
8
7
  * ========================================================================== */
9
8
 
10
- import * as fx from "../core/fixtures.js";
11
-
12
9
  const PENDING = "an Enterprise networking feature, not available in this build.";
13
10
 
14
11
  export async function render(ctx) {
@@ -90,7 +87,7 @@ async function hydrate(ctx, hosts) {
90
87
  const { statusHost, subnetsHost, srcSlot } = hosts;
91
88
 
92
89
  const res = await api.vpcStatus();
93
- const vpc = (res.data && typeof res.data === "object") ? res.data : fx.ADMIN.vpc;
90
+ const vpc = (res.data && typeof res.data === "object") ? res.data : {};
94
91
  srcSlot.replaceChildren(c.sourceBadge(res.source));
95
92
 
96
93
  const subnets = Array.isArray(vpc.private_subnets) ? vpc.private_subnets : [];