@clawdreyhepburn/carapace 0.3.1 → 0.3.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clawdreyhepburn/carapace",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "Immutable policy boundaries for MCP tool access. Powered by Cedar + Cedarling WASM.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -276,6 +276,10 @@ export class CedarlingEngine {
276
276
  return true;
277
277
  }
278
278
 
279
+ getDefaultPolicy(): "deny-all" | "allow-all" {
280
+ return this.defaultPolicy;
281
+ }
282
+
279
283
  getPolicies(): Array<{ id: string; effect: string; raw: string }> {
280
284
  return [...this.policies.entries()].map(([id, p]) => ({ id, ...p }));
281
285
  }
@@ -218,6 +218,10 @@ export class CedarEngine {
218
218
  }
219
219
 
220
220
  /** Get all policies as raw text */
221
+ getDefaultPolicy(): "deny-all" | "allow-all" {
222
+ return this.defaultPolicy;
223
+ }
224
+
221
225
  getPolicies(): Array<{ id: string; effect: string; raw: string }> {
222
226
  return [...this.policies.values()].map((p) => ({
223
227
  id: p.id,
package/src/gui/html.ts CHANGED
@@ -341,7 +341,7 @@ export function guiHtml(): string {
341
341
 
342
342
  <div class="container">
343
343
  <div id="servers-section">
344
- <h2>Servers</h2>
344
+ <h2>MCP Servers</h2>
345
345
  <div class="servers" id="servers"></div>
346
346
  </div>
347
347
 
@@ -540,8 +540,18 @@ export function guiHtml(): string {
540
540
  }
541
541
 
542
542
  function renderServers() {
543
+ const section = document.getElementById('servers-section');
543
544
  const el = document.getElementById('servers');
544
545
  const serverFilter = document.getElementById('server-filter');
546
+ const serverNames = Object.keys(state.servers);
547
+
548
+ // Hide entire section when no MCP servers are configured
549
+ if (serverNames.length === 0) {
550
+ section.style.display = 'none';
551
+ return;
552
+ }
553
+ section.style.display = '';
554
+
545
555
  el.innerHTML = Object.entries(state.servers).map(([name, s]) =>
546
556
  '<div class="server-card"><div class="name">' +
547
557
  '<span class="dot ' + (s.connected ? 'connected' : 'disconnected') + '"></span>' +
@@ -552,7 +562,7 @@ export function guiHtml(): string {
552
562
  // Update server filter dropdown (preserve selection)
553
563
  const prev = serverFilter.value;
554
564
  serverFilter.innerHTML = '<option value="all">All servers</option>' +
555
- Object.keys(state.servers).map(n => '<option value="' + esc(n) + '">' + esc(n) + '</option>').join('');
565
+ serverNames.map(n => '<option value="' + esc(n) + '">' + esc(n) + '</option>').join('');
556
566
  serverFilter.value = prev || 'all';
557
567
  }
558
568
 
@@ -665,7 +675,8 @@ export function guiHtml(): string {
665
675
  const el = document.getElementById('policies-list');
666
676
  const policies = state.policies ?? [];
667
677
  if (policies.length === 0) {
668
- el.innerHTML = '<div class="empty-state">No policies loaded. Default deny is active.<br><br>' +
678
+ const mode = state.defaultPolicy === 'deny-all' ? 'Default deny is active — all tools are blocked.' : 'Default allow is active — all tools are permitted.';
679
+ el.innerHTML = '<div class="empty-state">No policies loaded. ' + mode + '<br><br>' +
669
680
  '<button class="primary" onclick="openBuilder()">+ Create your first policy</button></div>';
670
681
  return;
671
682
  }
package/src/gui/server.ts CHANGED
@@ -66,6 +66,7 @@ export class ControlGui {
66
66
  policies: this.cedar.getPolicies(),
67
67
  toolCount: tools.length,
68
68
  enabledCount: tools.filter((t) => t.enabled).length,
69
+ defaultPolicy: this.cedar.getDefaultPolicy?.() ?? "allow-all",
69
70
  });
70
71
  return;
71
72
  }
package/src/types.ts CHANGED
@@ -105,6 +105,7 @@ export interface CedarEngineInterface {
105
105
  isToolEnabled(qualifiedName: string): boolean;
106
106
  savePolicy(id: string, raw: string): void;
107
107
  deletePolicy(id: string): boolean;
108
+ getDefaultPolicy(): "deny-all" | "allow-all";
108
109
  getPolicies(): Array<{ id: string; effect: string; raw: string }>;
109
110
  getSchema(): CedarSchemaInfo;
110
111
  saveSchema(raw: string): void;