@kya-os/consent 0.1.38 → 0.1.41

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 (186) hide show
  1. package/dist/bundle/index.d.ts +14 -0
  2. package/dist/bundle/index.d.ts.map +1 -1
  3. package/dist/bundle/index.js +14 -0
  4. package/dist/bundle/index.js.map +1 -1
  5. package/dist/bundle/inline.d.ts.map +1 -1
  6. package/dist/bundle/inline.js +2 -2
  7. package/dist/bundle/inline.js.map +1 -1
  8. package/dist/bundle/shell.d.ts +23 -0
  9. package/dist/bundle/shell.d.ts.map +1 -1
  10. package/dist/bundle/shell.js +25 -1
  11. package/dist/bundle/shell.js.map +1 -1
  12. package/dist/capabilities/index.d.ts +7 -0
  13. package/dist/capabilities/index.d.ts.map +1 -0
  14. package/dist/capabilities/index.js +7 -0
  15. package/dist/capabilities/index.js.map +1 -0
  16. package/dist/capabilities/registry.d.ts +29 -0
  17. package/dist/capabilities/registry.d.ts.map +1 -0
  18. package/dist/capabilities/registry.js +178 -0
  19. package/dist/capabilities/registry.js.map +1 -0
  20. package/dist/cedar/compile.d.ts +30 -0
  21. package/dist/cedar/compile.d.ts.map +1 -0
  22. package/dist/cedar/compile.js +55 -0
  23. package/dist/cedar/compile.js.map +1 -0
  24. package/dist/cedar/explain.d.ts +22 -0
  25. package/dist/cedar/explain.d.ts.map +1 -0
  26. package/dist/cedar/explain.js +72 -0
  27. package/dist/cedar/explain.js.map +1 -0
  28. package/dist/cedar/index.d.ts +8 -0
  29. package/dist/cedar/index.d.ts.map +1 -0
  30. package/dist/cedar/index.js +8 -0
  31. package/dist/cedar/index.js.map +1 -0
  32. package/dist/cjs/bundle/index.js +22 -1
  33. package/dist/cjs/bundle/index.js.map +1 -1
  34. package/dist/cjs/bundle/inline.js +2 -2
  35. package/dist/cjs/bundle/inline.js.map +1 -1
  36. package/dist/cjs/bundle/shell.js +25 -1
  37. package/dist/cjs/bundle/shell.js.map +1 -1
  38. package/dist/cjs/capabilities/index.js +12 -0
  39. package/dist/cjs/capabilities/index.js.map +1 -0
  40. package/dist/cjs/capabilities/registry.js +182 -0
  41. package/dist/cjs/capabilities/registry.js.map +1 -0
  42. package/dist/cjs/cedar/compile.js +59 -0
  43. package/dist/cjs/cedar/compile.js.map +1 -0
  44. package/dist/cjs/cedar/explain.js +75 -0
  45. package/dist/cjs/cedar/explain.js.map +1 -0
  46. package/dist/cjs/cedar/index.js +14 -0
  47. package/dist/cjs/cedar/index.js.map +1 -0
  48. package/dist/cjs/components/consent-action-bar.js +138 -0
  49. package/dist/cjs/components/consent-action-bar.js.map +1 -0
  50. package/dist/cjs/components/consent-agent-header.js +205 -0
  51. package/dist/cjs/components/consent-agent-header.js.map +1 -0
  52. package/dist/cjs/components/consent-capabilities-screen.js +346 -0
  53. package/dist/cjs/components/consent-capabilities-screen.js.map +1 -0
  54. package/dist/cjs/components/consent-capability-card.js +399 -0
  55. package/dist/cjs/components/consent-capability-card.js.map +1 -0
  56. package/dist/cjs/components/consent-connector-header.js +247 -0
  57. package/dist/cjs/components/consent-connector-header.js.map +1 -0
  58. package/dist/cjs/components/consent-footer.js +99 -0
  59. package/dist/cjs/components/consent-footer.js.map +1 -0
  60. package/dist/cjs/components/consent-revocation-notice.js +101 -0
  61. package/dist/cjs/components/consent-revocation-notice.js.map +1 -0
  62. package/dist/cjs/components/index.js +16 -1
  63. package/dist/cjs/components/index.js.map +1 -1
  64. package/dist/cjs/components/mcp-consent.js +193 -7
  65. package/dist/cjs/components/mcp-consent.js.map +1 -1
  66. package/dist/cjs/copy/index.js +12 -0
  67. package/dist/cjs/copy/index.js.map +1 -0
  68. package/dist/cjs/copy/tokens.js +101 -0
  69. package/dist/cjs/copy/tokens.js.map +1 -0
  70. package/dist/cjs/index.js +8 -0
  71. package/dist/cjs/index.js.map +1 -1
  72. package/dist/cjs/mcp-app/inline.js +2 -2
  73. package/dist/cjs/mcp-app/inline.js.map +1 -1
  74. package/dist/cjs/popup/index.js +15 -0
  75. package/dist/cjs/popup/index.js.map +1 -0
  76. package/dist/cjs/popup/launcher.js +77 -0
  77. package/dist/cjs/popup/launcher.js.map +1 -0
  78. package/dist/cjs/schemas/capabilities.schemas.js +129 -0
  79. package/dist/cjs/schemas/capabilities.schemas.js.map +1 -0
  80. package/dist/cjs/schemas/config.schemas.js +18 -0
  81. package/dist/cjs/schemas/config.schemas.js.map +1 -1
  82. package/dist/cjs/schemas/index.js +1 -0
  83. package/dist/cjs/schemas/index.js.map +1 -1
  84. package/dist/cjs/styles/index.js +1 -0
  85. package/dist/cjs/styles/index.js.map +1 -1
  86. package/dist/cjs/styles/theme.js +86 -0
  87. package/dist/cjs/styles/theme.js.map +1 -0
  88. package/dist/cjs/types/capabilities.types.js +12 -0
  89. package/dist/cjs/types/capabilities.types.js.map +1 -0
  90. package/dist/cjs/types/index.js +1 -0
  91. package/dist/cjs/types/index.js.map +1 -1
  92. package/dist/components/consent-action-bar.d.ts +30 -0
  93. package/dist/components/consent-action-bar.d.ts.map +1 -0
  94. package/dist/components/consent-action-bar.js +135 -0
  95. package/dist/components/consent-action-bar.js.map +1 -0
  96. package/dist/components/consent-agent-header.d.ts +31 -0
  97. package/dist/components/consent-agent-header.d.ts.map +1 -0
  98. package/dist/components/consent-agent-header.js +202 -0
  99. package/dist/components/consent-agent-header.js.map +1 -0
  100. package/dist/components/consent-capabilities-screen.d.ts +75 -0
  101. package/dist/components/consent-capabilities-screen.d.ts.map +1 -0
  102. package/dist/components/consent-capabilities-screen.js +343 -0
  103. package/dist/components/consent-capabilities-screen.js.map +1 -0
  104. package/dist/components/consent-capability-card.d.ts +52 -0
  105. package/dist/components/consent-capability-card.d.ts.map +1 -0
  106. package/dist/components/consent-capability-card.js +396 -0
  107. package/dist/components/consent-capability-card.js.map +1 -0
  108. package/dist/components/consent-connector-header.d.ts +64 -0
  109. package/dist/components/consent-connector-header.d.ts.map +1 -0
  110. package/dist/components/consent-connector-header.js +244 -0
  111. package/dist/components/consent-connector-header.js.map +1 -0
  112. package/dist/components/consent-footer.d.ts +22 -0
  113. package/dist/components/consent-footer.d.ts.map +1 -0
  114. package/dist/components/consent-footer.js +96 -0
  115. package/dist/components/consent-footer.js.map +1 -0
  116. package/dist/components/consent-revocation-notice.d.ts +22 -0
  117. package/dist/components/consent-revocation-notice.d.ts.map +1 -0
  118. package/dist/components/consent-revocation-notice.js +98 -0
  119. package/dist/components/consent-revocation-notice.js.map +1 -0
  120. package/dist/components/index.d.ts +7 -0
  121. package/dist/components/index.d.ts.map +1 -1
  122. package/dist/components/index.js +8 -0
  123. package/dist/components/index.js.map +1 -1
  124. package/dist/components/mcp-consent.d.ts +41 -0
  125. package/dist/components/mcp-consent.d.ts.map +1 -1
  126. package/dist/components/mcp-consent.js +193 -7
  127. package/dist/components/mcp-consent.js.map +1 -1
  128. package/dist/consent.js +1642 -7
  129. package/dist/consent.min.js +888 -119
  130. package/dist/copy/index.d.ts +8 -0
  131. package/dist/copy/index.d.ts.map +1 -0
  132. package/dist/copy/index.js +7 -0
  133. package/dist/copy/index.js.map +1 -0
  134. package/dist/copy/tokens.d.ts +93 -0
  135. package/dist/copy/tokens.d.ts.map +1 -0
  136. package/dist/copy/tokens.js +97 -0
  137. package/dist/copy/tokens.js.map +1 -0
  138. package/dist/index.d.ts +4 -0
  139. package/dist/index.d.ts.map +1 -1
  140. package/dist/index.js +8 -0
  141. package/dist/index.js.map +1 -1
  142. package/dist/mcp-app/inline.d.ts.map +1 -1
  143. package/dist/mcp-app/inline.js +2 -2
  144. package/dist/mcp-app/inline.js.map +1 -1
  145. package/dist/popup/index.d.ts +8 -0
  146. package/dist/popup/index.d.ts.map +1 -0
  147. package/dist/popup/index.js +7 -0
  148. package/dist/popup/index.js.map +1 -0
  149. package/dist/popup/launcher.d.ts +81 -0
  150. package/dist/popup/launcher.d.ts.map +1 -0
  151. package/dist/popup/launcher.js +71 -0
  152. package/dist/popup/launcher.js.map +1 -0
  153. package/dist/schemas/api.schemas.d.ts +366 -162
  154. package/dist/schemas/api.schemas.d.ts.map +1 -1
  155. package/dist/schemas/capabilities.schemas.d.ts +186 -0
  156. package/dist/schemas/capabilities.schemas.d.ts.map +1 -0
  157. package/dist/schemas/capabilities.schemas.js +123 -0
  158. package/dist/schemas/capabilities.schemas.js.map +1 -0
  159. package/dist/schemas/config.schemas.d.ts +480 -184
  160. package/dist/schemas/config.schemas.d.ts.map +1 -1
  161. package/dist/schemas/config.schemas.js +18 -0
  162. package/dist/schemas/config.schemas.js.map +1 -1
  163. package/dist/schemas/index.d.ts +1 -0
  164. package/dist/schemas/index.d.ts.map +1 -1
  165. package/dist/schemas/index.js +1 -0
  166. package/dist/schemas/index.js.map +1 -1
  167. package/dist/schemas/modes.schemas.d.ts +6 -6
  168. package/dist/styles/index.d.ts +1 -0
  169. package/dist/styles/index.d.ts.map +1 -1
  170. package/dist/styles/index.js +1 -0
  171. package/dist/styles/index.js.map +1 -1
  172. package/dist/styles/theme.d.ts +72 -0
  173. package/dist/styles/theme.d.ts.map +1 -0
  174. package/dist/styles/theme.js +81 -0
  175. package/dist/styles/theme.js.map +1 -0
  176. package/dist/types/capabilities.types.d.ts +126 -0
  177. package/dist/types/capabilities.types.d.ts.map +1 -0
  178. package/dist/types/capabilities.types.js +11 -0
  179. package/dist/types/capabilities.types.js.map +1 -0
  180. package/dist/types/config.types.d.ts +33 -0
  181. package/dist/types/config.types.d.ts.map +1 -1
  182. package/dist/types/index.d.ts +1 -0
  183. package/dist/types/index.d.ts.map +1 -1
  184. package/dist/types/index.js +1 -0
  185. package/dist/types/index.js.map +1 -1
  186. package/package.json +1 -1
package/dist/consent.js CHANGED
@@ -2616,6 +2616,1492 @@ ConsentOTPInput = __decorateClass([
2616
2616
  t3("consent-otp-input")
2617
2617
  ], ConsentOTPInput);
2618
2618
 
2619
+ // src/copy/tokens.ts
2620
+ var CONSENT_COPY_TOKENS = {
2621
+ eyebrow: {
2622
+ /** Light theme (consent screen). */
2623
+ permissionRequest: "PERMISSION REQUEST",
2624
+ /** Dark theme (gateway). `{Brand}` → operator-set brand name. */
2625
+ gatewayBrand: "{Brand} Gateway"
2626
+ },
2627
+ headline: {
2628
+ /**
2629
+ * `{Agent}` → agent display name (serif italic at render time).
2630
+ * `{Verb}` → operator verb, default "use".
2631
+ * `{Org}` → organization display name (serif italic at render time).
2632
+ */
2633
+ template: "{Agent} would like to {Verb} at {Org} for you."
2634
+ },
2635
+ subhead: {
2636
+ /** `{Agent}` → agent display name. */
2637
+ template: "Pick what {Agent} is allowed to do on your behalf. You stay in charge \u2014 change or cancel anytime."
2638
+ },
2639
+ agentTile: {
2640
+ verifiedPill: "Verified",
2641
+ unverifiedPill: "UNVERIFIED",
2642
+ /** `{Vendor}` → vendor name. `{Surface}` → surface label. */
2643
+ metaTemplate: "Made by {Vendor} \xB7 Asking from your {Surface} \xB7 {Connected}",
2644
+ connectedJustNow: "Connected just now",
2645
+ /** `{Minutes}` → minutes since connection. */
2646
+ connectedMinutesAgo: "Connected {Minutes} min ago"
2647
+ },
2648
+ section: {
2649
+ /** `{Agent}` → agent display name (uppercased at render time). */
2650
+ capabilitiesHeader: "WHAT {Agent} CAN DO FOR YOU",
2651
+ tapToToggle: "Tap to toggle",
2652
+ /** Used in the dark gateway theme. */
2653
+ permissionsRequested: "PERMISSIONS REQUESTED"
2654
+ },
2655
+ capabilityRow: {
2656
+ higherRiskChip: "HIGHER RISK",
2657
+ viewPolicyLink: "View policy",
2658
+ /** Disclosure title above the raw Cedar. */
2659
+ rawPolicyTitle: "Cedar policy",
2660
+ /** Disclosure title above the plain-language gloss. */
2661
+ glossTitle: "What this allows",
2662
+ /** Used in the gloss when no resource is extractable. */
2663
+ glossUnknownResource: "this deployment"
2664
+ },
2665
+ footer: {
2666
+ /**
2667
+ * `{RevocationPath}` → e.g. "Account → Connected Agents".
2668
+ * `{Org}` → organization display name.
2669
+ */
2670
+ revocationTemplate: "You can change or revoke any of these permissions anytime under {RevocationPath} at {Org}.",
2671
+ /** `{Days}` → inactivity days, default 90. */
2672
+ inactivityTemplate: "Permissions automatically expire after {Days} days of inactivity."
2673
+ },
2674
+ actions: {
2675
+ /** Light theme primary. `{Agent}` → agent display name. */
2676
+ allowAgentTemplate: "Allow {Agent}",
2677
+ /** Dark theme primary. */
2678
+ allowAccess: "Allow access",
2679
+ /** Light theme secondary. */
2680
+ notNow: "Not now",
2681
+ /** Dark theme secondary. */
2682
+ deny: "Deny"
2683
+ },
2684
+ attribution: {
2685
+ /** Light theme. */
2686
+ protectedBy: "Protected by Checkpoint",
2687
+ /** Dark theme. */
2688
+ securedBy: "Secured by Checkpoint",
2689
+ howThisWorks: "How does this work?"
2690
+ }
2691
+ };
2692
+ function formatToken(template, values) {
2693
+ return template.replace(/\{(\w+)\}/g, (match, key) => {
2694
+ const value = values[key];
2695
+ return value === void 0 ? match : String(value);
2696
+ });
2697
+ }
2698
+
2699
+ // src/components/consent-agent-header.ts
2700
+ var ConsentAgentHeader = class extends i4 {
2701
+ constructor() {
2702
+ super(...arguments);
2703
+ this.agentName = "";
2704
+ this.vendor = "";
2705
+ this.surfaceLabel = "";
2706
+ this.verified = false;
2707
+ this.logoUrl = "";
2708
+ this.connectedAt = "";
2709
+ }
2710
+ renderConnectedFragment() {
2711
+ if (!this.connectedAt) {
2712
+ return CONSENT_COPY_TOKENS.agentTile.connectedJustNow;
2713
+ }
2714
+ const ts = Date.parse(this.connectedAt);
2715
+ if (Number.isNaN(ts)) {
2716
+ return CONSENT_COPY_TOKENS.agentTile.connectedJustNow;
2717
+ }
2718
+ const minutes = Math.max(0, Math.floor((Date.now() - ts) / 6e4));
2719
+ if (minutes < 1) {
2720
+ return CONSENT_COPY_TOKENS.agentTile.connectedJustNow;
2721
+ }
2722
+ return formatToken(CONSENT_COPY_TOKENS.agentTile.connectedMinutesAgo, {
2723
+ Minutes: minutes
2724
+ });
2725
+ }
2726
+ renderMeta() {
2727
+ if (!this.vendor && !this.surfaceLabel) {
2728
+ return this.renderConnectedFragment();
2729
+ }
2730
+ return formatToken(CONSENT_COPY_TOKENS.agentTile.metaTemplate, {
2731
+ Vendor: this.vendor || "\u2014",
2732
+ Surface: this.surfaceLabel || "this device",
2733
+ Connected: this.renderConnectedFragment()
2734
+ });
2735
+ }
2736
+ render() {
2737
+ const initial = (this.agentName || "?").trim().charAt(0).toUpperCase();
2738
+ const verifiedLabel = this.verified ? CONSENT_COPY_TOKENS.agentTile.verifiedPill : CONSENT_COPY_TOKENS.agentTile.unverifiedPill;
2739
+ const verifiedClass = this.verified ? "verified" : "unverified";
2740
+ return b2`
2741
+ <div class="tile" part="tile">
2742
+ <div class="logo" aria-hidden="true">
2743
+ ${this.logoUrl ? b2`<img src="${this.logoUrl}" alt="" />` : b2`<div class="placeholder">${initial}</div>`}
2744
+ </div>
2745
+ <div class="body">
2746
+ <div class="row-name">
2747
+ <span class="name">${this.agentName || A}</span>
2748
+ <span class="pill ${verifiedClass}" part="pill">
2749
+ ${verifiedLabel}
2750
+ </span>
2751
+ </div>
2752
+ <div class="meta">${this.renderMeta()}</div>
2753
+ </div>
2754
+ </div>
2755
+ `;
2756
+ }
2757
+ };
2758
+ ConsentAgentHeader.styles = i`
2759
+ :host {
2760
+ display: block;
2761
+ width: 100%;
2762
+ }
2763
+
2764
+ .tile {
2765
+ display: flex;
2766
+ align-items: center;
2767
+ gap: 16px;
2768
+ padding: 16px 18px;
2769
+ border-radius: 14px;
2770
+ background: var(--cs-surface-inset, transparent);
2771
+ border: 1px solid var(--cs-surface-border, transparent);
2772
+ }
2773
+
2774
+ .logo {
2775
+ width: 44px;
2776
+ height: 44px;
2777
+ border-radius: 12px;
2778
+ flex-shrink: 0;
2779
+ background: var(--cs-surface-card, #fff);
2780
+ display: flex;
2781
+ align-items: center;
2782
+ justify-content: center;
2783
+ overflow: hidden;
2784
+ border: 1px solid var(--cs-surface-border, transparent);
2785
+ }
2786
+
2787
+ .logo img {
2788
+ width: 100%;
2789
+ height: 100%;
2790
+ object-fit: cover;
2791
+ }
2792
+
2793
+ .logo .placeholder {
2794
+ width: 100%;
2795
+ height: 100%;
2796
+ background: var(--cs-surface-accent, #0F172A);
2797
+ color: var(--cs-surface-accent-text, #fff);
2798
+ display: flex;
2799
+ align-items: center;
2800
+ justify-content: center;
2801
+ font-weight: 600;
2802
+ font-size: 18px;
2803
+ }
2804
+
2805
+ .body {
2806
+ display: flex;
2807
+ flex-direction: column;
2808
+ gap: 4px;
2809
+ min-width: 0;
2810
+ }
2811
+
2812
+ .row-name {
2813
+ display: flex;
2814
+ align-items: center;
2815
+ gap: 10px;
2816
+ flex-wrap: wrap;
2817
+ }
2818
+
2819
+ .name {
2820
+ font-size: 16px;
2821
+ font-weight: 600;
2822
+ color: var(--cs-text-primary, #0F172A);
2823
+ letter-spacing: -0.01em;
2824
+ }
2825
+
2826
+ .pill {
2827
+ display: inline-flex;
2828
+ align-items: center;
2829
+ gap: 4px;
2830
+ padding: 2px 8px;
2831
+ border-radius: 999px;
2832
+ font-size: 11px;
2833
+ font-weight: 600;
2834
+ letter-spacing: 0.04em;
2835
+ }
2836
+
2837
+ .pill.verified {
2838
+ background: var(--cs-pill-verified-bg, #DCFCE7);
2839
+ color: var(--cs-pill-verified-text, #166534);
2840
+ }
2841
+
2842
+ .pill.unverified {
2843
+ background: var(--cs-pill-unverified-bg, #F1F5F9);
2844
+ color: var(--cs-pill-unverified-text, #475569);
2845
+ letter-spacing: 0.08em;
2846
+ }
2847
+
2848
+ .meta {
2849
+ font-size: 12px;
2850
+ color: var(--cs-text-tertiary, #64748B);
2851
+ line-height: 1.5;
2852
+ }
2853
+ `;
2854
+ __decorateClass([
2855
+ n4({ type: String })
2856
+ ], ConsentAgentHeader.prototype, "agentName", 2);
2857
+ __decorateClass([
2858
+ n4({ type: String })
2859
+ ], ConsentAgentHeader.prototype, "vendor", 2);
2860
+ __decorateClass([
2861
+ n4({ type: String })
2862
+ ], ConsentAgentHeader.prototype, "surfaceLabel", 2);
2863
+ __decorateClass([
2864
+ n4({ type: Boolean })
2865
+ ], ConsentAgentHeader.prototype, "verified", 2);
2866
+ __decorateClass([
2867
+ n4({ type: String })
2868
+ ], ConsentAgentHeader.prototype, "logoUrl", 2);
2869
+ __decorateClass([
2870
+ n4({ type: String })
2871
+ ], ConsentAgentHeader.prototype, "connectedAt", 2);
2872
+ ConsentAgentHeader = __decorateClass([
2873
+ t3("consent-agent-header")
2874
+ ], ConsentAgentHeader);
2875
+
2876
+ // src/cedar/explain.ts
2877
+ var ACTION_SINGLE = /action\s*==\s*Action::"([^"]+)"/g;
2878
+ var ACTION_LIST = /action\s+in\s*\[([^\]]+)\]/g;
2879
+ var ACTION_STRING_IN_LIST = /Action::"([^"]+)"/g;
2880
+ var RESOURCE_IN = /resource\s+in\s+([^,)\n]+)/i;
2881
+ var RESOURCE_EQ = /resource\s*==\s*([^,)\n]+)/i;
2882
+ var CONDITION_BLOCK = /(when|unless)\s*\{([^}]+)\}/g;
2883
+ function explainCedarFragment(cedar) {
2884
+ return {
2885
+ actions: extractActions(cedar),
2886
+ resource: extractResource(cedar),
2887
+ conditions: extractConditions(cedar)
2888
+ };
2889
+ }
2890
+ function extractActions(cedar) {
2891
+ const actions = /* @__PURE__ */ new Set();
2892
+ for (const match of cedar.matchAll(ACTION_SINGLE)) {
2893
+ if (match[1]) actions.add(match[1]);
2894
+ }
2895
+ for (const listMatch of cedar.matchAll(ACTION_LIST)) {
2896
+ const inner = listMatch[1];
2897
+ if (!inner) continue;
2898
+ for (const stringMatch of inner.matchAll(ACTION_STRING_IN_LIST)) {
2899
+ if (stringMatch[1]) actions.add(stringMatch[1]);
2900
+ }
2901
+ }
2902
+ return Array.from(actions);
2903
+ }
2904
+ function extractResource(cedar) {
2905
+ const inMatch = RESOURCE_IN.exec(cedar);
2906
+ if (inMatch && inMatch[1]) {
2907
+ return inMatch[1].trim();
2908
+ }
2909
+ const eqMatch = RESOURCE_EQ.exec(cedar);
2910
+ if (eqMatch && eqMatch[1]) {
2911
+ return eqMatch[1].trim();
2912
+ }
2913
+ return "";
2914
+ }
2915
+ function extractConditions(cedar) {
2916
+ const conditions = [];
2917
+ for (const match of cedar.matchAll(CONDITION_BLOCK)) {
2918
+ const keyword = match[1];
2919
+ const body = match[2];
2920
+ if (!keyword || !body) continue;
2921
+ conditions.push(`${keyword} ${body.trim().replace(/\s+/g, " ")}`);
2922
+ }
2923
+ return conditions;
2924
+ }
2925
+
2926
+ // src/components/consent-capability-card.ts
2927
+ var ConsentCapabilityCard = class extends i4 {
2928
+ constructor() {
2929
+ super(...arguments);
2930
+ this.capabilityId = "";
2931
+ this.label = "";
2932
+ this.description = "";
2933
+ this.icon = "neutral";
2934
+ this.riskLevel = "low";
2935
+ this.checked = false;
2936
+ this.compiledCedar = "";
2937
+ this.policyOpen = false;
2938
+ }
2939
+ toggleChecked() {
2940
+ this.checked = !this.checked;
2941
+ const detail = {
2942
+ id: this.capabilityId,
2943
+ checked: this.checked
2944
+ };
2945
+ this.dispatchEvent(
2946
+ new CustomEvent("capability-toggle", {
2947
+ detail,
2948
+ bubbles: true,
2949
+ composed: true
2950
+ })
2951
+ );
2952
+ }
2953
+ /**
2954
+ * Row-level click handler. Makes the entire row a click target for
2955
+ * toggling the checkbox — a UX nicety that matches Plaid/Apple-style
2956
+ * consent rows. Skips when the user clicks the per-row "View policy"
2957
+ * button, the policy disclosure, or any link inside the description, so
2958
+ * those interactive children retain their own behavior.
2959
+ */
2960
+ onRowClick(event) {
2961
+ const target = event.target;
2962
+ if (!target) return;
2963
+ const path = event.composedPath?.() || [];
2964
+ for (const node of path) {
2965
+ if (!(node instanceof HTMLElement)) continue;
2966
+ if (node === this) break;
2967
+ if (node.classList?.contains("policy-toggle") || node.classList?.contains("policy-disclosure") || node.tagName === "A" || node.tagName === "BUTTON") {
2968
+ return;
2969
+ }
2970
+ }
2971
+ this.toggleChecked();
2972
+ }
2973
+ togglePolicy(event) {
2974
+ event?.stopPropagation();
2975
+ this.policyOpen = !this.policyOpen;
2976
+ }
2977
+ isHigherRisk() {
2978
+ return this.riskLevel === "high" || this.riskLevel === "critical";
2979
+ }
2980
+ renderIcon() {
2981
+ return iconSvgFor(this.icon);
2982
+ }
2983
+ renderPolicy() {
2984
+ if (!this.policyOpen) return A;
2985
+ if (!this.compiledCedar) return A;
2986
+ const explanation = explainCedarFragment(this.compiledCedar);
2987
+ const tokens = CONSENT_COPY_TOKENS.capabilityRow;
2988
+ return b2`
2989
+ <div class="policy-disclosure" part="policy">
2990
+ <h4>${tokens.glossTitle}</h4>
2991
+ <ul>
2992
+ ${explanation.actions.length === 0 ? b2`<li>—</li>` : explanation.actions.map(
2993
+ (action) => b2`<li><code>${action}</code></li>`
2994
+ )}
2995
+ </ul>
2996
+ ${explanation.resource ? b2`<p>
2997
+ On <code>${explanation.resource}</code>
2998
+ </p>` : b2`<p>On ${tokens.glossUnknownResource}</p>`}
2999
+ <h4>${tokens.rawPolicyTitle}</h4>
3000
+ <pre><code>${this.compiledCedar}</code></pre>
3001
+ </div>
3002
+ `;
3003
+ }
3004
+ render() {
3005
+ const tokens = CONSENT_COPY_TOKENS.capabilityRow;
3006
+ return b2`
3007
+ <div
3008
+ class="row"
3009
+ part="row"
3010
+ role="button"
3011
+ tabindex="0"
3012
+ @click=${this.onRowClick}
3013
+ @keydown=${(e8) => {
3014
+ if (e8.key === " " || e8.key === "Enter") {
3015
+ e8.preventDefault();
3016
+ this.toggleChecked();
3017
+ }
3018
+ }}
3019
+ >
3020
+ <button
3021
+ class="checkbox"
3022
+ part="checkbox"
3023
+ role="checkbox"
3024
+ aria-checked="${String(this.checked)}"
3025
+ aria-label="${this.label}"
3026
+ @click=${(e8) => {
3027
+ e8.stopPropagation();
3028
+ this.toggleChecked();
3029
+ }}
3030
+ type="button"
3031
+ tabindex="-1"
3032
+ >
3033
+ ${this.checked ? b2`<span class="check-mark">✓</span>` : A}
3034
+ </button>
3035
+ <div class="icon-tile" aria-hidden="true">${this.renderIcon()}</div>
3036
+ <div class="body">
3037
+ <div class="row-label">
3038
+ <span><strong>${this.label}</strong> <span class="description">${this.description}</span></span>
3039
+ ${this.isHigherRisk() ? b2`<span class="risk-chip">${tokens.higherRiskChip}</span>` : A}
3040
+ </div>
3041
+ <button
3042
+ class="policy-toggle"
3043
+ type="button"
3044
+ @click=${this.togglePolicy}
3045
+ aria-expanded="${String(this.policyOpen)}"
3046
+ >
3047
+ ${tokens.viewPolicyLink}
3048
+ </button>
3049
+ ${this.renderPolicy()}
3050
+ </div>
3051
+ </div>
3052
+ `;
3053
+ }
3054
+ };
3055
+ ConsentCapabilityCard.styles = i`
3056
+ :host {
3057
+ display: block;
3058
+ border-bottom: 1px solid var(--cs-surface-border, rgba(15, 23, 42, 0.08));
3059
+ }
3060
+
3061
+ :host(:last-of-type) {
3062
+ border-bottom: none;
3063
+ }
3064
+
3065
+ .row {
3066
+ display: grid;
3067
+ grid-template-columns: 22px 36px 1fr;
3068
+ gap: 14px;
3069
+ padding: 16px 0;
3070
+ align-items: flex-start;
3071
+ cursor: pointer;
3072
+ transition: background 0.12s ease;
3073
+ margin: 0 -10px;
3074
+ padding-left: 10px;
3075
+ padding-right: 10px;
3076
+ border-radius: 8px;
3077
+ }
3078
+
3079
+ .row:hover {
3080
+ background: var(--cs-row-hover-bg, rgba(15, 23, 42, 0.025));
3081
+ }
3082
+
3083
+ .checkbox {
3084
+ width: 22px;
3085
+ height: 22px;
3086
+ border-radius: 6px;
3087
+ border: 1.5px solid var(--cs-text-secondary, #334155);
3088
+ background: transparent;
3089
+ cursor: pointer;
3090
+ display: flex;
3091
+ align-items: center;
3092
+ justify-content: center;
3093
+ padding: 0;
3094
+ transition: background 0.12s ease, border-color 0.12s ease;
3095
+ }
3096
+
3097
+ .checkbox[aria-checked="true"] {
3098
+ background: var(--cs-surface-accent, #0F172A);
3099
+ border-color: var(--cs-surface-accent, #0F172A);
3100
+ }
3101
+
3102
+ .checkbox:focus-visible {
3103
+ outline: 2px solid var(--cs-focus-ring, #0F172A);
3104
+ outline-offset: 2px;
3105
+ }
3106
+
3107
+ .check-mark {
3108
+ color: var(--cs-surface-accent-text, #fff);
3109
+ font-size: 14px;
3110
+ line-height: 1;
3111
+ }
3112
+
3113
+ .icon-tile {
3114
+ width: 36px;
3115
+ height: 36px;
3116
+ border-radius: 10px;
3117
+ background: var(--cs-surface-inset, #F1ECE2);
3118
+ display: flex;
3119
+ align-items: center;
3120
+ justify-content: center;
3121
+ color: var(--cs-text-secondary, #334155);
3122
+ }
3123
+
3124
+ .icon-tile svg {
3125
+ width: 18px;
3126
+ height: 18px;
3127
+ }
3128
+
3129
+ .body {
3130
+ display: flex;
3131
+ flex-direction: column;
3132
+ gap: 6px;
3133
+ min-width: 0;
3134
+ }
3135
+
3136
+ .row-label {
3137
+ display: flex;
3138
+ align-items: center;
3139
+ gap: 10px;
3140
+ flex-wrap: wrap;
3141
+ font-size: 14.5px;
3142
+ color: var(--cs-text-primary, #0F172A);
3143
+ line-height: 1.45;
3144
+ }
3145
+
3146
+ .row-label strong {
3147
+ font-weight: 600;
3148
+ }
3149
+
3150
+ .description {
3151
+ color: var(--cs-text-secondary, #334155);
3152
+ }
3153
+
3154
+ .risk-chip {
3155
+ display: inline-flex;
3156
+ padding: 2px 8px;
3157
+ border-radius: 999px;
3158
+ font-size: 10.5px;
3159
+ font-weight: 700;
3160
+ letter-spacing: 0.06em;
3161
+ background: var(--cs-chip-risk-bg, #FCE7B6);
3162
+ color: var(--cs-chip-risk-text, #7A4F00);
3163
+ }
3164
+
3165
+ .policy-toggle {
3166
+ align-self: flex-start;
3167
+ background: none;
3168
+ border: none;
3169
+ padding: 0;
3170
+ font-size: 12px;
3171
+ font-weight: 500;
3172
+ color: var(--cs-text-tertiary, #64748B);
3173
+ text-decoration: underline;
3174
+ text-underline-offset: 2px;
3175
+ cursor: pointer;
3176
+ }
3177
+
3178
+ .policy-toggle:focus-visible {
3179
+ outline: 2px solid var(--cs-focus-ring, #0F172A);
3180
+ outline-offset: 2px;
3181
+ }
3182
+
3183
+ .policy-disclosure {
3184
+ margin-top: 8px;
3185
+ border-radius: 10px;
3186
+ background: var(--cs-surface-inset, #F1ECE2);
3187
+ padding: 10px 12px;
3188
+ font-size: 12px;
3189
+ color: var(--cs-text-secondary, #334155);
3190
+ display: flex;
3191
+ flex-direction: column;
3192
+ gap: 8px;
3193
+ }
3194
+
3195
+ .policy-disclosure h4 {
3196
+ margin: 0;
3197
+ font-size: 11px;
3198
+ letter-spacing: 0.08em;
3199
+ text-transform: uppercase;
3200
+ color: var(--cs-text-tertiary, #64748B);
3201
+ }
3202
+
3203
+ .policy-disclosure pre {
3204
+ margin: 0;
3205
+ font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
3206
+ font-size: 11.5px;
3207
+ line-height: 1.5;
3208
+ white-space: pre-wrap;
3209
+ word-break: break-word;
3210
+ color: var(--cs-text-primary, #0F172A);
3211
+ }
3212
+
3213
+ .policy-disclosure ul {
3214
+ margin: 0;
3215
+ padding-left: 18px;
3216
+ }
3217
+ `;
3218
+ __decorateClass([
3219
+ n4({ type: String })
3220
+ ], ConsentCapabilityCard.prototype, "capabilityId", 2);
3221
+ __decorateClass([
3222
+ n4({ type: String })
3223
+ ], ConsentCapabilityCard.prototype, "label", 2);
3224
+ __decorateClass([
3225
+ n4({ type: String })
3226
+ ], ConsentCapabilityCard.prototype, "description", 2);
3227
+ __decorateClass([
3228
+ n4({ type: String })
3229
+ ], ConsentCapabilityCard.prototype, "icon", 2);
3230
+ __decorateClass([
3231
+ n4({ type: String })
3232
+ ], ConsentCapabilityCard.prototype, "riskLevel", 2);
3233
+ __decorateClass([
3234
+ n4({ type: Boolean, reflect: true })
3235
+ ], ConsentCapabilityCard.prototype, "checked", 2);
3236
+ __decorateClass([
3237
+ n4({ type: String, attribute: "compiled-cedar" })
3238
+ ], ConsentCapabilityCard.prototype, "compiledCedar", 2);
3239
+ __decorateClass([
3240
+ r5()
3241
+ ], ConsentCapabilityCard.prototype, "policyOpen", 2);
3242
+ ConsentCapabilityCard = __decorateClass([
3243
+ t3("consent-capability-card")
3244
+ ], ConsentCapabilityCard);
3245
+ function iconSvgFor(icon) {
3246
+ switch (icon) {
3247
+ case "search":
3248
+ return b2`<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><circle cx="9" cy="9" r="5.25"/><path d="m13.25 13.25 3.5 3.5"/></svg>`;
3249
+ case "cart":
3250
+ return b2`<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><path d="M3 3h2l1.4 9.4a1.5 1.5 0 0 0 1.5 1.3h7.6a1.5 1.5 0 0 0 1.5-1.2L18 6H6"/><circle cx="9" cy="17" r="1.2"/><circle cx="15" cy="17" r="1.2"/></svg>`;
3251
+ case "card":
3252
+ return b2`<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><rect x="2.5" y="4.5" width="15" height="11" rx="2"/><path d="M2.5 9h15"/><path d="M5.5 13h3"/></svg>`;
3253
+ case "pin":
3254
+ return b2`<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><path d="M10 17s-5.5-5-5.5-9a5.5 5.5 0 1 1 11 0c0 4-5.5 9-5.5 9z"/><circle cx="10" cy="8" r="2"/></svg>`;
3255
+ case "pin-new":
3256
+ return b2`<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><path d="M10 17s-5.5-5-5.5-9a5.5 5.5 0 1 1 11 0c0 4-5.5 9-5.5 9z"/><path d="M10 6v4"/><path d="M8 8h4"/></svg>`;
3257
+ case "shield":
3258
+ return b2`<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><path d="M10 2.5 4 5v5.5C4 14 6.5 16.5 10 17.5c3.5-1 6-3.5 6-7V5z"/></svg>`;
3259
+ case "key":
3260
+ return b2`<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><circle cx="7" cy="13" r="3.25"/><path d="m9.5 11 6.5-6.5"/><path d="m13.5 7 2 2"/></svg>`;
3261
+ case "tools":
3262
+ return b2`<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><path d="m4 4 6 6"/><path d="m10 4 6 6"/><path d="m4 16 12-12"/></svg>`;
3263
+ case "user":
3264
+ return b2`<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><circle cx="10" cy="7" r="3"/><path d="M3 17a7 7 0 0 1 14 0"/></svg>`;
3265
+ case "calendar":
3266
+ return b2`<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="4" width="14" height="13" rx="2"/><path d="M3 8h14"/><path d="M7 2v4M13 2v4"/></svg>`;
3267
+ case "lock":
3268
+ return b2`<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><rect x="4" y="9" width="12" height="8" rx="2"/><path d="M7 9V6a3 3 0 0 1 6 0v3"/></svg>`;
3269
+ case "eye":
3270
+ return b2`<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><path d="M2 10s3-6 8-6 8 6 8 6-3 6-8 6-8-6-8-6z"/><circle cx="10" cy="10" r="2.25"/></svg>`;
3271
+ case "send":
3272
+ return b2`<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><path d="m17 3-7 7-2 7-3-9z"/></svg>`;
3273
+ case "package":
3274
+ return b2`<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><path d="m10 2 7 4v8l-7 4-7-4V6z"/><path d="m3 6 7 4 7-4"/><path d="M10 18V10"/></svg>`;
3275
+ default:
3276
+ return b2`<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><circle cx="10" cy="10" r="5"/></svg>`;
3277
+ }
3278
+ }
3279
+
3280
+ // src/components/consent-action-bar.ts
3281
+ var ConsentActionBar = class extends i4 {
3282
+ constructor() {
3283
+ super(...arguments);
3284
+ this.agentName = "";
3285
+ this.theme = "light";
3286
+ this.disabled = false;
3287
+ this.loading = false;
3288
+ }
3289
+ emitAllow() {
3290
+ if (this.disabled || this.loading) return;
3291
+ this.dispatchEvent(
3292
+ new CustomEvent("consent-allow", { bubbles: true, composed: true })
3293
+ );
3294
+ }
3295
+ emitDeny() {
3296
+ if (this.loading) return;
3297
+ this.dispatchEvent(
3298
+ new CustomEvent("consent-deny", { bubbles: true, composed: true })
3299
+ );
3300
+ }
3301
+ render() {
3302
+ const allowLabel = this.theme === "dark" ? CONSENT_COPY_TOKENS.actions.allowAccess : `${formatToken(CONSENT_COPY_TOKENS.actions.allowAgentTemplate, {
3303
+ Agent: this.agentName || "this agent"
3304
+ })} \u2192`;
3305
+ const denyLabel = this.theme === "dark" ? CONSENT_COPY_TOKENS.actions.deny : CONSENT_COPY_TOKENS.actions.notNow;
3306
+ return b2`
3307
+ <button
3308
+ class="primary"
3309
+ type="button"
3310
+ ?disabled=${this.disabled || this.loading}
3311
+ @click=${this.emitAllow}
3312
+ >
3313
+ ${allowLabel}
3314
+ </button>
3315
+ <button
3316
+ class="secondary"
3317
+ type="button"
3318
+ ?disabled=${this.loading}
3319
+ @click=${this.emitDeny}
3320
+ >
3321
+ ${denyLabel}
3322
+ </button>
3323
+ `;
3324
+ }
3325
+ };
3326
+ ConsentActionBar.styles = i`
3327
+ :host {
3328
+ display: flex;
3329
+ flex-direction: column;
3330
+ gap: 4px;
3331
+ width: 100%;
3332
+ }
3333
+
3334
+ button {
3335
+ width: 100%;
3336
+ padding: 14px 18px;
3337
+ border-radius: 999px;
3338
+ font-size: 15px;
3339
+ font-weight: 500;
3340
+ font-family: inherit;
3341
+ cursor: pointer;
3342
+ transition: opacity 0.15s ease, transform 0.05s ease;
3343
+ border: none;
3344
+ }
3345
+
3346
+ button:disabled {
3347
+ opacity: 0.5;
3348
+ cursor: not-allowed;
3349
+ }
3350
+
3351
+ button:focus-visible {
3352
+ outline: 2px solid var(--cs-focus-ring, #0F172A);
3353
+ outline-offset: 3px;
3354
+ }
3355
+
3356
+ .primary {
3357
+ background: var(--cs-surface-accent, #0F172A);
3358
+ color: var(--cs-surface-accent-text, #FFFFFF);
3359
+ }
3360
+
3361
+ .primary:hover:not(:disabled) {
3362
+ opacity: 0.92;
3363
+ }
3364
+
3365
+ .secondary {
3366
+ background: transparent;
3367
+ color: var(--cs-text-secondary, #334155);
3368
+ padding: 10px 18px;
3369
+ font-weight: 500;
3370
+ }
3371
+
3372
+ .secondary:hover:not(:disabled) {
3373
+ color: var(--cs-text-primary, #0F172A);
3374
+ }
3375
+ `;
3376
+ __decorateClass([
3377
+ n4({ type: String })
3378
+ ], ConsentActionBar.prototype, "agentName", 2);
3379
+ __decorateClass([
3380
+ n4({ type: String })
3381
+ ], ConsentActionBar.prototype, "theme", 2);
3382
+ __decorateClass([
3383
+ n4({ type: Boolean })
3384
+ ], ConsentActionBar.prototype, "disabled", 2);
3385
+ __decorateClass([
3386
+ n4({ type: Boolean })
3387
+ ], ConsentActionBar.prototype, "loading", 2);
3388
+ ConsentActionBar = __decorateClass([
3389
+ t3("consent-action-bar")
3390
+ ], ConsentActionBar);
3391
+
3392
+ // src/components/consent-footer.ts
3393
+ var ConsentFooter = class extends i4 {
3394
+ constructor() {
3395
+ super(...arguments);
3396
+ this.theme = "light";
3397
+ this.howItWorksUrl = "";
3398
+ }
3399
+ render() {
3400
+ const attribution = this.theme === "dark" ? CONSENT_COPY_TOKENS.attribution.securedBy : CONSENT_COPY_TOKENS.attribution.protectedBy;
3401
+ return b2`
3402
+ <span class="left">
3403
+ <svg
3404
+ class="check"
3405
+ viewBox="0 0 16 16"
3406
+ fill="none"
3407
+ stroke="currentColor"
3408
+ stroke-width="1.8"
3409
+ stroke-linecap="round"
3410
+ stroke-linejoin="round"
3411
+ aria-hidden="true"
3412
+ >
3413
+ <path d="m3.5 8.5 3 3 6-6.5" />
3414
+ </svg>
3415
+ ${attribution}
3416
+ </span>
3417
+ ${this.howItWorksUrl ? b2`<a href="${this.howItWorksUrl}" target="_blank" rel="noopener">
3418
+ ${CONSENT_COPY_TOKENS.attribution.howThisWorks}
3419
+ </a>` : b2`<span>${CONSENT_COPY_TOKENS.attribution.howThisWorks}</span>`}
3420
+ `;
3421
+ }
3422
+ };
3423
+ ConsentFooter.styles = i`
3424
+ :host {
3425
+ display: flex;
3426
+ align-items: center;
3427
+ justify-content: space-between;
3428
+ gap: 16px;
3429
+ padding-top: 12px;
3430
+ font-size: 12px;
3431
+ color: var(--cs-text-tertiary, #64748B);
3432
+ border-top: 1px solid var(--cs-surface-border, transparent);
3433
+ }
3434
+
3435
+ .left {
3436
+ display: inline-flex;
3437
+ align-items: center;
3438
+ gap: 6px;
3439
+ }
3440
+
3441
+ .check {
3442
+ width: 14px;
3443
+ height: 14px;
3444
+ color: var(--cs-text-secondary, #334155);
3445
+ }
3446
+
3447
+ a {
3448
+ color: inherit;
3449
+ text-decoration: underline;
3450
+ text-underline-offset: 2px;
3451
+ }
3452
+
3453
+ a:hover {
3454
+ color: var(--cs-text-primary, #0F172A);
3455
+ }
3456
+ `;
3457
+ __decorateClass([
3458
+ n4({ type: String })
3459
+ ], ConsentFooter.prototype, "theme", 2);
3460
+ __decorateClass([
3461
+ n4({ type: String })
3462
+ ], ConsentFooter.prototype, "howItWorksUrl", 2);
3463
+ ConsentFooter = __decorateClass([
3464
+ t3("consent-footer")
3465
+ ], ConsentFooter);
3466
+
3467
+ // src/components/consent-revocation-notice.ts
3468
+ var ConsentRevocationNotice = class extends i4 {
3469
+ constructor() {
3470
+ super(...arguments);
3471
+ this.revocationPath = "Account \u2192 Connected Agents";
3472
+ this.orgName = "this site";
3473
+ this.inactivityDays = 90;
3474
+ }
3475
+ render() {
3476
+ const revoke = formatToken(CONSENT_COPY_TOKENS.footer.revocationTemplate, {
3477
+ RevocationPath: this.revocationPath,
3478
+ Org: this.orgName
3479
+ });
3480
+ const inactivity = formatToken(
3481
+ CONSENT_COPY_TOKENS.footer.inactivityTemplate,
3482
+ { Days: this.inactivityDays }
3483
+ );
3484
+ return b2`
3485
+ <svg
3486
+ class="icon"
3487
+ viewBox="0 0 20 20"
3488
+ fill="none"
3489
+ stroke="currentColor"
3490
+ stroke-width="1.6"
3491
+ stroke-linecap="round"
3492
+ stroke-linejoin="round"
3493
+ aria-hidden="true"
3494
+ >
3495
+ <circle cx="10" cy="10" r="7.5" />
3496
+ <path d="M10 6v4l2.5 1.5" />
3497
+ </svg>
3498
+ <div class="content">
3499
+ <span>${revoke}</span>
3500
+ <span>${inactivity}</span>
3501
+ </div>
3502
+ `;
3503
+ }
3504
+ };
3505
+ ConsentRevocationNotice.styles = i`
3506
+ :host {
3507
+ display: flex;
3508
+ align-items: flex-start;
3509
+ gap: 10px;
3510
+ padding: 12px 14px;
3511
+ border-radius: 12px;
3512
+ background: var(--cs-surface-inset, #F1ECE2);
3513
+ color: var(--cs-text-secondary, #334155);
3514
+ font-size: 12.5px;
3515
+ line-height: 1.5;
3516
+ }
3517
+
3518
+ .icon {
3519
+ width: 16px;
3520
+ height: 16px;
3521
+ flex-shrink: 0;
3522
+ margin-top: 2px;
3523
+ color: var(--cs-text-tertiary, #64748B);
3524
+ }
3525
+
3526
+ .content {
3527
+ display: flex;
3528
+ flex-direction: column;
3529
+ gap: 4px;
3530
+ }
3531
+
3532
+ em {
3533
+ font-style: normal;
3534
+ color: var(--cs-text-primary, #0F172A);
3535
+ font-weight: 500;
3536
+ }
3537
+ `;
3538
+ __decorateClass([
3539
+ n4({ type: String })
3540
+ ], ConsentRevocationNotice.prototype, "revocationPath", 2);
3541
+ __decorateClass([
3542
+ n4({ type: String })
3543
+ ], ConsentRevocationNotice.prototype, "orgName", 2);
3544
+ __decorateClass([
3545
+ n4({ type: Number })
3546
+ ], ConsentRevocationNotice.prototype, "inactivityDays", 2);
3547
+ ConsentRevocationNotice = __decorateClass([
3548
+ t3("consent-revocation-notice")
3549
+ ], ConsentRevocationNotice);
3550
+
3551
+ // src/components/consent-connector-header.ts
3552
+ var ConsentConnectorHeader = class extends i4 {
3553
+ constructor() {
3554
+ super(...arguments);
3555
+ this.clientName = "";
3556
+ this.clientDid = "";
3557
+ this.clientLogoUrl = "";
3558
+ this.serverName = "";
3559
+ this.serverDomain = "";
3560
+ this.serverLogoUrl = "";
3561
+ this.logoDevToken = "";
3562
+ this.clientImageOk = true;
3563
+ this.serverImageOk = true;
3564
+ }
3565
+ /**
3566
+ * Derive a logo URL for an agent DID via KTA hosting convention.
3567
+ * `did:web:knowthat.ai:agents:claude` → `https://knowthat.ai/img/agents/claude.png`
3568
+ */
3569
+ ktaLogoFromDid(did) {
3570
+ if (!did) return void 0;
3571
+ const match = did.match(/^did:web:knowthat\.ai:agents:([a-z0-9-]+)$/i);
3572
+ if (!match) return void 0;
3573
+ return `https://knowthat.ai/img/agents/${match[1]}.png`;
3574
+ }
3575
+ /**
3576
+ * Derive a brand logo URL via logo.dev given a domain. Returns undefined
3577
+ * when no token is configured or the domain is unparseable.
3578
+ */
3579
+ logoDevLogo(domain) {
3580
+ if (!domain || !this.logoDevToken) return void 0;
3581
+ const cleaned = domain.replace(/^https?:\/\//, "").replace(/\/.*$/, "");
3582
+ if (!cleaned) return void 0;
3583
+ return `https://img.logo.dev/${cleaned}?token=${encodeURIComponent(
3584
+ this.logoDevToken
3585
+ )}&size=120&format=png`;
3586
+ }
3587
+ resolveClientLogo() {
3588
+ if (this.clientLogoUrl) return this.clientLogoUrl;
3589
+ return this.ktaLogoFromDid(this.clientDid);
3590
+ }
3591
+ resolveServerLogo() {
3592
+ if (this.serverLogoUrl) return this.serverLogoUrl;
3593
+ return this.logoDevLogo(this.serverDomain);
3594
+ }
3595
+ monogram(name) {
3596
+ return (name || "?").trim().charAt(0).toUpperCase();
3597
+ }
3598
+ render() {
3599
+ const clientLogo = this.resolveClientLogo();
3600
+ const serverLogo = this.resolveServerLogo();
3601
+ return b2`
3602
+ <div class="tile client" aria-hidden="true">
3603
+ ${clientLogo && this.clientImageOk ? b2`<img
3604
+ src="${clientLogo}"
3605
+ alt=""
3606
+ @error=${() => this.clientImageOk = false}
3607
+ />` : b2`<span class="monogram">${this.monogram(this.clientName)}</span>`}
3608
+ </div>
3609
+ <div class="bridge" aria-hidden="true">
3610
+ <span class="dots"><span></span><span></span><span></span></span>
3611
+ <span class="shield" title="Protected by Checkpoint">
3612
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round">
3613
+ <path d="M12 3l8 3v5c0 4.5-3.5 8.5-8 10-4.5-1.5-8-5.5-8-10V6l8-3z" />
3614
+ <path d="m9 12 2 2 4-4" />
3615
+ </svg>
3616
+ </span>
3617
+ <span class="dots"><span></span><span></span><span></span></span>
3618
+ </div>
3619
+ <div class="tile server" aria-hidden="true">
3620
+ ${serverLogo && this.serverImageOk ? b2`<img
3621
+ src="${serverLogo}"
3622
+ alt=""
3623
+ @error=${() => this.serverImageOk = false}
3624
+ />` : b2`<span class="monogram">${this.monogram(this.serverName)}</span>`}
3625
+ </div>
3626
+ <span style="position:absolute;left:-9999px">${this.clientName || ""} connecting to ${this.serverName || ""} via Checkpoint</span>
3627
+ `;
3628
+ }
3629
+ };
3630
+ ConsentConnectorHeader.styles = i`
3631
+ :host {
3632
+ display: flex;
3633
+ align-items: center;
3634
+ justify-content: center;
3635
+ gap: 18px;
3636
+ padding: 22px 0 4px;
3637
+ }
3638
+
3639
+ .tile {
3640
+ width: 56px;
3641
+ height: 56px;
3642
+ border-radius: 14px;
3643
+ overflow: hidden;
3644
+ display: flex;
3645
+ align-items: center;
3646
+ justify-content: center;
3647
+ flex-shrink: 0;
3648
+ background: var(--cs-surface-card, #fff);
3649
+ border: 1px solid var(--cs-surface-border, rgba(15, 23, 42, 0.08));
3650
+ }
3651
+
3652
+ .tile.client {
3653
+ background: var(--cs-surface-accent, #0F172A);
3654
+ border-color: transparent;
3655
+ }
3656
+
3657
+ .tile img {
3658
+ width: 100%;
3659
+ height: 100%;
3660
+ object-fit: cover;
3661
+ }
3662
+
3663
+ .tile .monogram {
3664
+ width: 100%;
3665
+ height: 100%;
3666
+ display: flex;
3667
+ align-items: center;
3668
+ justify-content: center;
3669
+ font-weight: 600;
3670
+ font-size: 22px;
3671
+ }
3672
+
3673
+ .tile.client .monogram {
3674
+ color: var(--cs-surface-accent-text, #fff);
3675
+ }
3676
+
3677
+ .tile.server .monogram {
3678
+ color: var(--cs-text-primary, #0F172A);
3679
+ }
3680
+
3681
+ .bridge {
3682
+ display: inline-flex;
3683
+ align-items: center;
3684
+ gap: 8px;
3685
+ }
3686
+
3687
+ .dots {
3688
+ display: inline-flex;
3689
+ gap: 4px;
3690
+ }
3691
+
3692
+ .dots span {
3693
+ width: 4px;
3694
+ height: 4px;
3695
+ border-radius: 50%;
3696
+ background: var(--cs-text-tertiary, #94A3B8);
3697
+ opacity: 0.55;
3698
+ }
3699
+
3700
+ .shield {
3701
+ width: 30px;
3702
+ height: 30px;
3703
+ border-radius: 50%;
3704
+ background: rgba(34, 197, 94, 0.14);
3705
+ display: inline-flex;
3706
+ align-items: center;
3707
+ justify-content: center;
3708
+ color: #15803D;
3709
+ flex-shrink: 0;
3710
+ }
3711
+
3712
+ .shield svg {
3713
+ width: 16px;
3714
+ height: 16px;
3715
+ }
3716
+ `;
3717
+ __decorateClass([
3718
+ n4({ type: String })
3719
+ ], ConsentConnectorHeader.prototype, "clientName", 2);
3720
+ __decorateClass([
3721
+ n4({ type: String })
3722
+ ], ConsentConnectorHeader.prototype, "clientDid", 2);
3723
+ __decorateClass([
3724
+ n4({ type: String, attribute: "client-logo-url" })
3725
+ ], ConsentConnectorHeader.prototype, "clientLogoUrl", 2);
3726
+ __decorateClass([
3727
+ n4({ type: String })
3728
+ ], ConsentConnectorHeader.prototype, "serverName", 2);
3729
+ __decorateClass([
3730
+ n4({ type: String, attribute: "server-domain" })
3731
+ ], ConsentConnectorHeader.prototype, "serverDomain", 2);
3732
+ __decorateClass([
3733
+ n4({ type: String, attribute: "server-logo-url" })
3734
+ ], ConsentConnectorHeader.prototype, "serverLogoUrl", 2);
3735
+ __decorateClass([
3736
+ n4({ type: String, attribute: "logo-dev-token" })
3737
+ ], ConsentConnectorHeader.prototype, "logoDevToken", 2);
3738
+ __decorateClass([
3739
+ r5()
3740
+ ], ConsentConnectorHeader.prototype, "clientImageOk", 2);
3741
+ __decorateClass([
3742
+ r5()
3743
+ ], ConsentConnectorHeader.prototype, "serverImageOk", 2);
3744
+ ConsentConnectorHeader = __decorateClass([
3745
+ t3("consent-connector-header")
3746
+ ], ConsentConnectorHeader);
3747
+
3748
+ // src/styles/theme.ts
3749
+ var FIXED_RISK_CHIP_BG = "#FCE7B6";
3750
+ var FIXED_RISK_CHIP_TEXT = "#7A4F00";
3751
+ var lightTheme = {
3752
+ surfaceBg: "#F4F1EA",
3753
+ surfaceCard: "#FFFFFF",
3754
+ surfaceBorder: "rgba(15, 23, 42, 0.10)",
3755
+ surfaceInset: "#F1ECE2",
3756
+ textPrimary: "#0F172A",
3757
+ textSecondary: "#334155",
3758
+ textTertiary: "#64748B",
3759
+ surfaceAccent: "#0F172A",
3760
+ surfaceAccentText: "#FFFFFF",
3761
+ pillVerifiedBg: "#DCFCE7",
3762
+ pillVerifiedText: "#166534",
3763
+ pillUnverifiedBg: "#F1F5F9",
3764
+ pillUnverifiedText: "#475569",
3765
+ chipRiskBg: FIXED_RISK_CHIP_BG,
3766
+ chipRiskText: FIXED_RISK_CHIP_TEXT,
3767
+ focusRing: "rgba(15, 23, 42, 0.35)",
3768
+ cardShadow: "0 30px 80px -40px rgba(15, 23, 42, 0.40)"
3769
+ };
3770
+ var darkTheme = {
3771
+ surfaceBg: "#0B0808",
3772
+ surfaceCard: "rgba(20, 20, 22, 0.92)",
3773
+ surfaceBorder: "rgba(255, 255, 255, 0.08)",
3774
+ surfaceInset: "rgba(255, 255, 255, 0.04)",
3775
+ textPrimary: "#F8FAFC",
3776
+ textSecondary: "#CBD5E1",
3777
+ textTertiary: "#94A3B8",
3778
+ surfaceAccent: "#F8FAFC",
3779
+ surfaceAccentText: "#0F172A",
3780
+ pillVerifiedBg: "rgba(34, 197, 94, 0.16)",
3781
+ pillVerifiedText: "#86EFAC",
3782
+ pillUnverifiedBg: "rgba(148, 163, 184, 0.18)",
3783
+ pillUnverifiedText: "#CBD5E1",
3784
+ chipRiskBg: FIXED_RISK_CHIP_BG,
3785
+ chipRiskText: FIXED_RISK_CHIP_TEXT,
3786
+ focusRing: "rgba(248, 250, 252, 0.55)",
3787
+ cardShadow: "0 40px 90px -40px rgba(0, 0, 0, 0.85)"
3788
+ };
3789
+ function getConsentTheme(theme) {
3790
+ return theme === "dark" ? darkTheme : lightTheme;
3791
+ }
3792
+ function themeToCssVariables(tokens) {
3793
+ const declarations = [];
3794
+ for (const [key, value] of Object.entries(tokens)) {
3795
+ declarations.push(` --cs-${camelToKebab(key)}: ${value};`);
3796
+ }
3797
+ return declarations.join("\n");
3798
+ }
3799
+ function camelToKebab(value) {
3800
+ return value.replace(/[A-Z]/g, (c4) => `-${c4.toLowerCase()}`);
3801
+ }
3802
+
3803
+ // src/cedar/compile.ts
3804
+ var PLACEHOLDER_PATTERN = /\{\{\s*(agent_did|user_did|org|deployment)\s*\}\}/g;
3805
+ function compileSingleCapability(capability, context) {
3806
+ const compiled = capability.cedar.replace(PLACEHOLDER_PATTERN, (_2, key) => {
3807
+ const value = context[key];
3808
+ if (typeof value !== "string" || value.length === 0) {
3809
+ throw new Error(
3810
+ `Cedar template context missing required value for placeholder \`${key}\``
3811
+ );
3812
+ }
3813
+ return value;
3814
+ });
3815
+ if (compiled.trim().length === 0) {
3816
+ throw new Error(
3817
+ `Cedar fragment for capability \`${capability.id}\` is empty after compilation`
3818
+ );
3819
+ }
3820
+ return compiled;
3821
+ }
3822
+
3823
+ // src/components/consent-capabilities-screen.ts
3824
+ var ConsentCapabilitiesScreen = class extends i4 {
3825
+ constructor() {
3826
+ super(...arguments);
3827
+ this.capabilities = [];
3828
+ this.orgName = "";
3829
+ this.headlineVerb = "use";
3830
+ this.revocationPath = "Account \u2192 Connected Agents";
3831
+ this.inactivityDays = 90;
3832
+ this.theme = "light";
3833
+ this.howItWorksUrl = "";
3834
+ this.loading = false;
3835
+ this.serverDomain = "";
3836
+ this.logoDevToken = "";
3837
+ this.selected = /* @__PURE__ */ new Set();
3838
+ this.onCapabilityToggle = (event) => {
3839
+ const detail = event.detail;
3840
+ const next = new Set(this.selected);
3841
+ if (detail.checked) next.add(detail.id);
3842
+ else next.delete(detail.id);
3843
+ this.selected = next;
3844
+ };
3845
+ this.onAllow = () => {
3846
+ if (this.loading) return;
3847
+ const selectedIds = Array.from(this.selected);
3848
+ const selectedScopes = this.capabilities.filter((c4) => this.selected.has(c4.id)).flatMap((c4) => c4.scopes);
3849
+ const detail = {
3850
+ selectedCapabilityIds: selectedIds,
3851
+ selectedScopes
3852
+ };
3853
+ this.dispatchEvent(
3854
+ new CustomEvent("capabilities-allow", {
3855
+ detail,
3856
+ bubbles: true,
3857
+ composed: true
3858
+ })
3859
+ );
3860
+ };
3861
+ this.onDeny = () => {
3862
+ this.dispatchEvent(
3863
+ new CustomEvent("capabilities-deny", { bubbles: true, composed: true })
3864
+ );
3865
+ };
3866
+ }
3867
+ connectedCallback() {
3868
+ super.connectedCallback();
3869
+ this.seedDefaults();
3870
+ }
3871
+ willUpdate(changed) {
3872
+ if (changed.has("capabilities")) {
3873
+ this.seedDefaults();
3874
+ }
3875
+ }
3876
+ seedDefaults() {
3877
+ const next = /* @__PURE__ */ new Set();
3878
+ for (const capability of this.capabilities) {
3879
+ if (capability.defaultOn) next.add(capability.id);
3880
+ }
3881
+ this.selected = next;
3882
+ }
3883
+ hostStyle() {
3884
+ return `:host { ${themeToCssVariables(getConsentTheme(this.theme))} }`;
3885
+ }
3886
+ compileCapabilityCedar(capability) {
3887
+ if (!this.cedarContext) {
3888
+ return capability.cedar;
3889
+ }
3890
+ try {
3891
+ return compileSingleCapability(capability, this.cedarContext);
3892
+ } catch {
3893
+ return capability.cedar;
3894
+ }
3895
+ }
3896
+ renderHeadline() {
3897
+ const agentName = this.agentMetadata?.name || "this agent";
3898
+ const tokens = CONSENT_COPY_TOKENS;
3899
+ const raw = formatToken(tokens.headline.template, {
3900
+ Agent: "@@AGENT@@",
3901
+ Verb: this.headlineVerb || "use",
3902
+ Org: "@@ORG@@"
3903
+ });
3904
+ const escaped = escapeHtml(raw);
3905
+ const withSerifEntities = escaped.replace("@@AGENT@@", `<em>${nbspEscape(agentName)}</em>`).replace("@@ORG@@", `<em>${nbspEscape(this.orgName || "this site")}</em>`);
3906
+ return b2`<h1
3907
+ class="headline"
3908
+ .innerHTML=${withSerifEntities}
3909
+ ></h1>`;
3910
+ }
3911
+ render() {
3912
+ const tokens = CONSENT_COPY_TOKENS;
3913
+ const agentName = this.agentMetadata?.name || "this agent";
3914
+ const subhead = formatToken(tokens.subhead.template, { Agent: agentName });
3915
+ const sectionHeader = formatToken(tokens.section.capabilitiesHeader, {
3916
+ Agent: agentName.toUpperCase()
3917
+ });
3918
+ return b2`
3919
+ <style>
3920
+ ${this.hostStyle()}
3921
+ </style>
3922
+ <consent-connector-header
3923
+ clientName="${this.agentMetadata?.name || ""}"
3924
+ clientDid="${this.agentMetadata?.did || ""}"
3925
+ client-logo-url="${this.agentMetadata?.logoUrl || ""}"
3926
+ serverName="${this.orgName || ""}"
3927
+ server-domain="${this.serverDomain}"
3928
+ logo-dev-token="${this.logoDevToken}"
3929
+ ></consent-connector-header>
3930
+ <div class="card" part="card">
3931
+ <span class="eyebrow">${tokens.eyebrow.permissionRequest}</span>
3932
+ ${this.renderHeadline()}
3933
+ <p class="subhead">${subhead}</p>
3934
+ ${this.agentMetadata ? b2`<consent-agent-header
3935
+ agentName="${this.agentMetadata.name}"
3936
+ vendor="${this.agentMetadata.vendor || ""}"
3937
+ surfaceLabel="${this.agentMetadata.surfaceLabel || ""}"
3938
+ ?verified=${this.agentMetadata.verified}
3939
+ logoUrl="${this.agentMetadata.logoUrl || ""}"
3940
+ connectedAt="${this.agentMetadata.connectedAt || ""}"
3941
+ ></consent-agent-header>` : A}
3942
+ <div>
3943
+ <div class="section-header">
3944
+ <span>${sectionHeader}</span>
3945
+ <span class="hint">${tokens.section.tapToToggle}</span>
3946
+ </div>
3947
+ <div class="rows" @capability-toggle=${this.onCapabilityToggle}>
3948
+ ${this.capabilities.map(
3949
+ (capability) => b2`
3950
+ <consent-capability-card
3951
+ capabilityId="${capability.id}"
3952
+ label="${capability.label}"
3953
+ description="${capability.description}"
3954
+ icon="${capability.icon}"
3955
+ riskLevel="${capability.riskLevel}"
3956
+ ?checked=${this.selected.has(capability.id)}
3957
+ compiled-cedar="${this.compileCapabilityCedar(capability)}"
3958
+ ></consent-capability-card>
3959
+ `
3960
+ )}
3961
+ </div>
3962
+ </div>
3963
+ <consent-revocation-notice
3964
+ revocationPath="${this.revocationPath}"
3965
+ orgName="${this.orgName || "this site"}"
3966
+ inactivityDays=${this.inactivityDays}
3967
+ ></consent-revocation-notice>
3968
+ <consent-action-bar
3969
+ agentName="${agentName}"
3970
+ theme="${this.theme}"
3971
+ ?loading=${this.loading}
3972
+ ?disabled=${this.selected.size === 0}
3973
+ @consent-allow=${this.onAllow}
3974
+ @consent-deny=${this.onDeny}
3975
+ ></consent-action-bar>
3976
+ <consent-footer
3977
+ theme="${this.theme}"
3978
+ howItWorksUrl="${this.howItWorksUrl}"
3979
+ ></consent-footer>
3980
+ </div>
3981
+ `;
3982
+ }
3983
+ };
3984
+ ConsentCapabilitiesScreen.styles = i`
3985
+ :host {
3986
+ display: block;
3987
+ box-sizing: border-box;
3988
+ width: 100%;
3989
+ max-width: 560px;
3990
+ margin: 0 auto;
3991
+ }
3992
+
3993
+ .card {
3994
+ background: var(--cs-surface-card);
3995
+ border: 1px solid var(--cs-surface-border);
3996
+ border-radius: 22px;
3997
+ box-shadow: var(--cs-card-shadow);
3998
+ padding: 28px 28px 22px;
3999
+ display: flex;
4000
+ flex-direction: column;
4001
+ gap: 22px;
4002
+ color: var(--cs-text-primary);
4003
+ }
4004
+
4005
+ .eyebrow {
4006
+ font-size: 11px;
4007
+ letter-spacing: 0.16em;
4008
+ font-weight: 600;
4009
+ color: var(--cs-text-tertiary);
4010
+ text-transform: uppercase;
4011
+ }
4012
+
4013
+ .headline {
4014
+ font-family: "Times New Roman", Georgia, serif;
4015
+ font-size: 30px;
4016
+ line-height: 1.18;
4017
+ letter-spacing: -0.01em;
4018
+ color: var(--cs-text-primary);
4019
+ margin: 0;
4020
+ }
4021
+
4022
+ .headline em {
4023
+ font-style: italic;
4024
+ }
4025
+
4026
+ .subhead {
4027
+ font-size: 14.5px;
4028
+ color: var(--cs-text-secondary);
4029
+ line-height: 1.55;
4030
+ margin: 0;
4031
+ }
4032
+
4033
+ .section-header {
4034
+ display: flex;
4035
+ align-items: center;
4036
+ justify-content: space-between;
4037
+ font-size: 11px;
4038
+ letter-spacing: 0.14em;
4039
+ font-weight: 600;
4040
+ color: var(--cs-text-tertiary);
4041
+ text-transform: uppercase;
4042
+ }
4043
+
4044
+ .section-header .hint {
4045
+ letter-spacing: 0;
4046
+ font-weight: 400;
4047
+ text-transform: none;
4048
+ font-size: 12px;
4049
+ }
4050
+
4051
+ .rows {
4052
+ display: flex;
4053
+ flex-direction: column;
4054
+ }
4055
+ `;
4056
+ __decorateClass([
4057
+ n4({ type: Array })
4058
+ ], ConsentCapabilitiesScreen.prototype, "capabilities", 2);
4059
+ __decorateClass([
4060
+ n4({ type: Object })
4061
+ ], ConsentCapabilitiesScreen.prototype, "agentMetadata", 2);
4062
+ __decorateClass([
4063
+ n4({ type: Object })
4064
+ ], ConsentCapabilitiesScreen.prototype, "cedarContext", 2);
4065
+ __decorateClass([
4066
+ n4({ type: String })
4067
+ ], ConsentCapabilitiesScreen.prototype, "orgName", 2);
4068
+ __decorateClass([
4069
+ n4({ type: String })
4070
+ ], ConsentCapabilitiesScreen.prototype, "headlineVerb", 2);
4071
+ __decorateClass([
4072
+ n4({ type: String })
4073
+ ], ConsentCapabilitiesScreen.prototype, "revocationPath", 2);
4074
+ __decorateClass([
4075
+ n4({ type: Number })
4076
+ ], ConsentCapabilitiesScreen.prototype, "inactivityDays", 2);
4077
+ __decorateClass([
4078
+ n4({ type: String })
4079
+ ], ConsentCapabilitiesScreen.prototype, "theme", 2);
4080
+ __decorateClass([
4081
+ n4({ type: String, attribute: "how-it-works-url" })
4082
+ ], ConsentCapabilitiesScreen.prototype, "howItWorksUrl", 2);
4083
+ __decorateClass([
4084
+ n4({ type: Boolean })
4085
+ ], ConsentCapabilitiesScreen.prototype, "loading", 2);
4086
+ __decorateClass([
4087
+ n4({ type: String, attribute: "server-domain" })
4088
+ ], ConsentCapabilitiesScreen.prototype, "serverDomain", 2);
4089
+ __decorateClass([
4090
+ n4({ type: String, attribute: "logo-dev-token" })
4091
+ ], ConsentCapabilitiesScreen.prototype, "logoDevToken", 2);
4092
+ __decorateClass([
4093
+ r5()
4094
+ ], ConsentCapabilitiesScreen.prototype, "selected", 2);
4095
+ ConsentCapabilitiesScreen = __decorateClass([
4096
+ t3("consent-capabilities-screen")
4097
+ ], ConsentCapabilitiesScreen);
4098
+ function escapeHtml(value) {
4099
+ return value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
4100
+ }
4101
+ function nbspEscape(value) {
4102
+ return escapeHtml(value).replace(/\s+/g, "\xA0");
4103
+ }
4104
+
2619
4105
  // src/types/modes.types.ts
2620
4106
  var AUTH_MODES = {
2621
4107
  /** Simple consent with no authentication - Consent → Success (2 screens) */
@@ -2950,6 +4436,13 @@ var McpConsent = class extends i4 {
2950
4436
  this.credentialUserEmail = "";
2951
4437
  this.credentialProviderUserId = "";
2952
4438
  this.oauthUrl = "";
4439
+ this.capabilities = [];
4440
+ this.orgName = "";
4441
+ this.headlineVerb = "use";
4442
+ this.revocationPath = "Account \u2192 Connected Agents";
4443
+ this.inactivityDays = 90;
4444
+ this.consentTheme = "light";
4445
+ this.howItWorksUrl = "";
2953
4446
  this.authorizationType = "password";
2954
4447
  this.oauthProviderType = "";
2955
4448
  this.currentMode = AUTH_MODES.CONSENT_ONLY;
@@ -2959,6 +4452,17 @@ var McpConsent = class extends i4 {
2959
4452
  this.formData = {};
2960
4453
  this.resendCooldown = 0;
2961
4454
  this.selectedScopes = [];
4455
+ this.closeFailed = false;
4456
+ this.onCapabilitiesAllow = (event) => {
4457
+ const detail = event.detail;
4458
+ if (detail.selectedCapabilityIds.length === 0) {
4459
+ this.handleDeny();
4460
+ return;
4461
+ }
4462
+ this.selectedScopes = [...this.scopes];
4463
+ this.termsAccepted = true;
4464
+ void this.handleApprove();
4465
+ };
2962
4466
  }
2963
4467
  // === LIFECYCLE ===
2964
4468
  connectedCallback() {
@@ -3153,6 +4657,12 @@ var McpConsent = class extends i4 {
3153
4657
  );
3154
4658
  window.close();
3155
4659
  }
4660
+ handleClose() {
4661
+ window.close();
4662
+ setTimeout(() => {
4663
+ this.closeFailed = true;
4664
+ }, 300);
4665
+ }
3156
4666
  handleTermsChange(e8) {
3157
4667
  this.termsAccepted = e8.detail.checked;
3158
4668
  }
@@ -3568,13 +5078,15 @@ var McpConsent = class extends i4 {
3568
5078
 
3569
5079
  <!-- Footer with Continue Button -->
3570
5080
  <div class="success-footer">
3571
- <consent-button
3572
- variant="primary"
3573
- full-width
3574
- @click=${() => window.close()}
3575
- >
3576
- ${success?.continueButtonText ?? "Continue"}
3577
- </consent-button>
5081
+ ${this.closeFailed ? b2`<p class="close-message">You can safely close this tab.</p>` : b2`
5082
+ <consent-button
5083
+ variant="primary"
5084
+ full-width
5085
+ @click=${this.handleClose}
5086
+ >
5087
+ ${success?.continueButtonText ?? "Continue"}
5088
+ </consent-button>
5089
+ `}
3578
5090
  </div>
3579
5091
  </div>
3580
5092
  `;
@@ -3585,6 +5097,9 @@ var McpConsent = class extends i4 {
3585
5097
  if (displayStep === "success") {
3586
5098
  return this.renderSuccess();
3587
5099
  }
5100
+ if (this.capabilities.length > 0 && this.currentMode === AUTH_MODES.CONSENT_ONLY) {
5101
+ return this.renderCapabilitiesScreen();
5102
+ }
3588
5103
  switch (this.currentMode) {
3589
5104
  case AUTH_MODES.CREDENTIALS:
3590
5105
  return this.renderCredentials();
@@ -3599,6 +5114,39 @@ var McpConsent = class extends i4 {
3599
5114
  return this.renderConsentOnly();
3600
5115
  }
3601
5116
  }
5117
+ /**
5118
+ * Render the new humanized capability layout. Selection state is owned by
5119
+ * `<consent-capabilities-screen>`; on `capabilities-allow`, we hydrate the
5120
+ * legacy form-data path (selectedScopes, terms accepted) and reuse the
5121
+ * existing handleApprove submission logic.
5122
+ */
5123
+ renderCapabilitiesScreen() {
5124
+ const flatCapabilities = this.capabilities.flatMap(
5125
+ (group) => group.capabilities
5126
+ );
5127
+ return b2`
5128
+ ${this.error ? b2`<div role="alert" style="
5129
+ color: var(--cs-text-danger, #b91c1c);
5130
+ margin: 0 auto 12px;
5131
+ max-width: 560px;
5132
+ font-size: 13px;
5133
+ ">${this.error}</div>` : A}
5134
+ <consent-capabilities-screen
5135
+ .capabilities=${flatCapabilities}
5136
+ .agentMetadata=${this.agentMetadata}
5137
+ .cedarContext=${this.cedarContext}
5138
+ orgName="${this.orgName}"
5139
+ headlineVerb="${this.headlineVerb}"
5140
+ revocationPath="${this.revocationPath}"
5141
+ inactivityDays=${this.inactivityDays}
5142
+ theme="${this.consentTheme}"
5143
+ how-it-works-url="${this.howItWorksUrl}"
5144
+ ?loading=${this.loading}
5145
+ @capabilities-allow=${this.onCapabilitiesAllow}
5146
+ @capabilities-deny=${this.handleDeny}
5147
+ ></consent-capabilities-screen>
5148
+ `;
5149
+ }
3602
5150
  };
3603
5151
  McpConsent.styles = i`
3604
5152
  :host {
@@ -3920,6 +5468,14 @@ McpConsent.styles = i`
3920
5468
  margin-top: 1.5rem;
3921
5469
  }
3922
5470
 
5471
+ .close-message {
5472
+ text-align: center;
5473
+ color: #6b7280;
5474
+ font-size: 0.875rem;
5475
+ margin: 0;
5476
+ padding: 0.75rem 0;
5477
+ }
5478
+
3923
5479
  /* OTP section */
3924
5480
  .otp-section {
3925
5481
  text-align: center;
@@ -4034,6 +5590,75 @@ __decorateClass([
4034
5590
  __decorateClass([
4035
5591
  n4({ type: String, attribute: "oauth-url" })
4036
5592
  ], McpConsent.prototype, "oauthUrl", 2);
5593
+ __decorateClass([
5594
+ n4({
5595
+ type: Array,
5596
+ converter: {
5597
+ fromAttribute: (value) => {
5598
+ if (!value) return [];
5599
+ try {
5600
+ const parsed = JSON.parse(value);
5601
+ return Array.isArray(parsed) ? parsed : [];
5602
+ } catch {
5603
+ return [];
5604
+ }
5605
+ },
5606
+ toAttribute: (value) => JSON.stringify(value)
5607
+ }
5608
+ })
5609
+ ], McpConsent.prototype, "capabilities", 2);
5610
+ __decorateClass([
5611
+ n4({
5612
+ type: Object,
5613
+ attribute: "agent-metadata",
5614
+ converter: {
5615
+ fromAttribute: (value) => {
5616
+ if (!value) return void 0;
5617
+ try {
5618
+ return JSON.parse(value);
5619
+ } catch {
5620
+ return void 0;
5621
+ }
5622
+ },
5623
+ toAttribute: (value) => value ? JSON.stringify(value) : ""
5624
+ }
5625
+ })
5626
+ ], McpConsent.prototype, "agentMetadata", 2);
5627
+ __decorateClass([
5628
+ n4({ type: String, attribute: "org-name" })
5629
+ ], McpConsent.prototype, "orgName", 2);
5630
+ __decorateClass([
5631
+ n4({ type: String, attribute: "headline-verb" })
5632
+ ], McpConsent.prototype, "headlineVerb", 2);
5633
+ __decorateClass([
5634
+ n4({ type: String, attribute: "revocation-path" })
5635
+ ], McpConsent.prototype, "revocationPath", 2);
5636
+ __decorateClass([
5637
+ n4({ type: Number, attribute: "inactivity-days" })
5638
+ ], McpConsent.prototype, "inactivityDays", 2);
5639
+ __decorateClass([
5640
+ n4({ type: String, attribute: "consent-theme" })
5641
+ ], McpConsent.prototype, "consentTheme", 2);
5642
+ __decorateClass([
5643
+ n4({ type: String, attribute: "how-it-works-url" })
5644
+ ], McpConsent.prototype, "howItWorksUrl", 2);
5645
+ __decorateClass([
5646
+ n4({
5647
+ type: Object,
5648
+ attribute: "cedar-context",
5649
+ converter: {
5650
+ fromAttribute: (value) => {
5651
+ if (!value) return void 0;
5652
+ try {
5653
+ return JSON.parse(value);
5654
+ } catch {
5655
+ return void 0;
5656
+ }
5657
+ },
5658
+ toAttribute: (value) => value ? JSON.stringify(value) : ""
5659
+ }
5660
+ })
5661
+ ], McpConsent.prototype, "cedarContext", 2);
4037
5662
  __decorateClass([
4038
5663
  n4({ type: String, attribute: "authorization-type" })
4039
5664
  ], McpConsent.prototype, "authorizationType", 2);
@@ -4086,16 +5711,26 @@ __decorateClass([
4086
5711
  __decorateClass([
4087
5712
  r5()
4088
5713
  ], McpConsent.prototype, "selectedScopes", 2);
5714
+ __decorateClass([
5715
+ r5()
5716
+ ], McpConsent.prototype, "closeFailed", 2);
4089
5717
  McpConsent = __decorateClass([
4090
5718
  t3("mcp-consent")
4091
5719
  ], McpConsent);
4092
5720
  export {
5721
+ ConsentActionBar,
5722
+ ConsentAgentHeader,
4093
5723
  ConsentButton,
5724
+ ConsentCapabilitiesScreen,
5725
+ ConsentCapabilityCard,
4094
5726
  ConsentCheckbox,
5727
+ ConsentConnectorHeader,
5728
+ ConsentFooter,
4095
5729
  ConsentInput,
4096
5730
  ConsentOAuthButton,
4097
5731
  ConsentOTPInput,
4098
5732
  ConsentPermissions,
5733
+ ConsentRevocationNotice,
4099
5734
  ConsentShell,
4100
5735
  ConsentTerms,
4101
5736
  McpConsent