@kya-os/consent 0.1.43 → 0.1.46

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 (49) hide show
  1. package/dist/bundle/inline.d.ts +17 -0
  2. package/dist/bundle/inline.d.ts.map +1 -1
  3. package/dist/bundle/inline.js +19 -2
  4. package/dist/bundle/inline.js.map +1 -1
  5. package/dist/bundle/shell.d.ts +13 -8
  6. package/dist/bundle/shell.d.ts.map +1 -1
  7. package/dist/bundle/shell.js +33 -30
  8. package/dist/bundle/shell.js.map +1 -1
  9. package/dist/cjs/bundle/inline.js +20 -3
  10. package/dist/cjs/bundle/inline.js.map +1 -1
  11. package/dist/cjs/bundle/shell.js +32 -29
  12. package/dist/cjs/bundle/shell.js.map +1 -1
  13. package/dist/cjs/components/consent-capabilities-screen.js +52 -12
  14. package/dist/cjs/components/consent-capabilities-screen.js.map +1 -1
  15. package/dist/cjs/components/consent-capability-card.js +191 -32
  16. package/dist/cjs/components/consent-capability-card.js.map +1 -1
  17. package/dist/cjs/components/mcp-consent.js +180 -77
  18. package/dist/cjs/components/mcp-consent.js.map +1 -1
  19. package/dist/cjs/index.js +3 -1
  20. package/dist/cjs/index.js.map +1 -1
  21. package/dist/cjs/mcp-app/inline.js +2 -2
  22. package/dist/cjs/mcp-app/inline.js.map +1 -1
  23. package/dist/cjs/resolution/credential-capabilities.js +53 -0
  24. package/dist/cjs/resolution/credential-capabilities.js.map +1 -0
  25. package/dist/components/consent-capabilities-screen.d.ts +32 -0
  26. package/dist/components/consent-capabilities-screen.d.ts.map +1 -1
  27. package/dist/components/consent-capabilities-screen.js +53 -13
  28. package/dist/components/consent-capabilities-screen.js.map +1 -1
  29. package/dist/components/consent-capability-card.d.ts.map +1 -1
  30. package/dist/components/consent-capability-card.js +191 -32
  31. package/dist/components/consent-capability-card.js.map +1 -1
  32. package/dist/components/mcp-consent.d.ts +33 -0
  33. package/dist/components/mcp-consent.d.ts.map +1 -1
  34. package/dist/components/mcp-consent.js +180 -77
  35. package/dist/components/mcp-consent.js.map +1 -1
  36. package/dist/consent.js +430 -165
  37. package/dist/consent.min.js +278 -119
  38. package/dist/index.d.ts +2 -2
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/index.js +2 -2
  41. package/dist/index.js.map +1 -1
  42. package/dist/mcp-app/inline.d.ts.map +1 -1
  43. package/dist/mcp-app/inline.js +2 -2
  44. package/dist/mcp-app/inline.js.map +1 -1
  45. package/dist/resolution/credential-capabilities.d.ts +25 -0
  46. package/dist/resolution/credential-capabilities.d.ts.map +1 -0
  47. package/dist/resolution/credential-capabilities.js +46 -0
  48. package/dist/resolution/credential-capabilities.js.map +1 -0
  49. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"inline.js","sourceRoot":"","sources":["../../src/mcp-app/inline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,sEAAsE;AACtE,MAAM,CAAC,MAAM,oBAAoB,GAAW,gp/uBAAgp/uB,CAAC;AAE7r/uB,4CAA4C;AAC5C,MAAM,CAAC,MAAM,yBAAyB,GAAW,MAAM,CAAC"}
1
+ {"version":3,"file":"inline.js","sourceRoot":"","sources":["../../src/mcp-app/inline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,sEAAsE;AACtE,MAAM,CAAC,MAAM,oBAAoB,GAAW,+qlvBAA+qlvB,CAAC;AAE5tlvB,4CAA4C;AAC5C,MAAM,CAAC,MAAM,yBAAyB,GAAW,MAAM,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { type AuthMode } from "../types/modes.types.js";
2
+ import type { Capability } from "../types/capabilities.types.js";
3
+ export declare function shouldRenderCapabilityScreen(mode: AuthMode, capabilityCount: number): boolean;
4
+ /**
5
+ * The credential path grants a fixed, all-or-nothing scope set (see the
6
+ * scopes constraint in handleApprove), so every capability starts selected —
7
+ * the rows themselves stay interactive, same as the consent-only path.
8
+ */
9
+ export declare function shouldSelectAllCapabilities(mode: AuthMode): boolean;
10
+ export declare function areCredentialsComplete(formData: Record<string, string>): boolean;
11
+ /**
12
+ * Which capabilities count as selected. In disclosure mode every capability is
13
+ * granted, so all ids are returned; otherwise the operator's `defaultOn` seeds
14
+ * the initial selection.
15
+ */
16
+ export declare function capabilityIdsFor(capabilities: Capability[], disclosureMode: boolean): string[];
17
+ /**
18
+ * Identity of a seeding decision: the capability ids in order, plus the
19
+ * all-selected flag. Lit compares properties by reference, so a parent that
20
+ * rebuilds its capability array on every render would otherwise re-seed (and
21
+ * wipe the user's toggles) on every keystroke. Seeding is keyed on this value
22
+ * instead of array identity.
23
+ */
24
+ export declare function capabilitySeedKey(capabilities: Capability[], allSelected: boolean): string;
25
+ //# sourceMappingURL=credential-capabilities.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credential-capabilities.d.ts","sourceRoot":"","sources":["../../src/resolution/credential-capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAYjE,wBAAgB,4BAA4B,CAC1C,IAAI,EAAE,QAAQ,EACd,eAAe,EAAE,MAAM,GACtB,OAAO,CAET;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAEnE;AAED,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,OAAO,CAKT;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,YAAY,EAAE,UAAU,EAAE,EAC1B,cAAc,EAAE,OAAO,GACtB,MAAM,EAAE,CAIV;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,YAAY,EAAE,UAAU,EAAE,EAC1B,WAAW,EAAE,OAAO,GACnB,MAAM,CAER"}
@@ -0,0 +1,46 @@
1
+ import { AUTH_MODES } from "../types/modes.types.js";
2
+ /**
3
+ * Modes whose screen is replaced by the humanized capability layout. Credentials
4
+ * is included so the user sees what is being granted before signing in — on the
5
+ * anchor path the sign-in submit IS the approval, so there is no later screen.
6
+ */
7
+ const CAPABILITY_SCREEN_MODES = [
8
+ AUTH_MODES.CONSENT_ONLY,
9
+ AUTH_MODES.CREDENTIALS,
10
+ ];
11
+ export function shouldRenderCapabilityScreen(mode, capabilityCount) {
12
+ return capabilityCount > 0 && CAPABILITY_SCREEN_MODES.includes(mode);
13
+ }
14
+ /**
15
+ * The credential path grants a fixed, all-or-nothing scope set (see the
16
+ * scopes constraint in handleApprove), so every capability starts selected —
17
+ * the rows themselves stay interactive, same as the consent-only path.
18
+ */
19
+ export function shouldSelectAllCapabilities(mode) {
20
+ return mode === AUTH_MODES.CREDENTIALS;
21
+ }
22
+ export function areCredentialsComplete(formData) {
23
+ return ((formData.username?.trim().length ?? 0) > 0 &&
24
+ (formData.password?.trim().length ?? 0) > 0);
25
+ }
26
+ /**
27
+ * Which capabilities count as selected. In disclosure mode every capability is
28
+ * granted, so all ids are returned; otherwise the operator's `defaultOn` seeds
29
+ * the initial selection.
30
+ */
31
+ export function capabilityIdsFor(capabilities, disclosureMode) {
32
+ return capabilities
33
+ .filter((capability) => disclosureMode || capability.defaultOn)
34
+ .map((capability) => capability.id);
35
+ }
36
+ /**
37
+ * Identity of a seeding decision: the capability ids in order, plus the
38
+ * all-selected flag. Lit compares properties by reference, so a parent that
39
+ * rebuilds its capability array on every render would otherwise re-seed (and
40
+ * wipe the user's toggles) on every keystroke. Seeding is keyed on this value
41
+ * instead of array identity.
42
+ */
43
+ export function capabilitySeedKey(capabilities, allSelected) {
44
+ return `${allSelected ? 1 : 0}:${capabilities.map((c) => c.id).join(" ")}`;
45
+ }
46
+ //# sourceMappingURL=credential-capabilities.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credential-capabilities.js","sourceRoot":"","sources":["../../src/resolution/credential-capabilities.ts"],"names":[],"mappings":"AAAA,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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kya-os/consent",
3
- "version": "0.1.43",
3
+ "version": "0.1.46",
4
4
  "description": "Canonical consent page types, styles, and utilities for MCP-I and AgentShield",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",