@kya-os/consent 0.1.46 → 0.1.48
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/README.md +89 -0
- package/dist/bundle/index.d.ts +2 -0
- package/dist/bundle/index.d.ts.map +1 -1
- package/dist/bundle/index.js +1 -0
- package/dist/bundle/index.js.map +1 -1
- package/dist/bundle/inline.d.ts.map +1 -1
- package/dist/bundle/inline.js +4 -4
- package/dist/bundle/inline.js.map +1 -1
- package/dist/capabilities/registry.d.ts.map +1 -1
- package/dist/capabilities/registry.js +5 -1
- package/dist/capabilities/registry.js.map +1 -1
- package/dist/cedar/compile.d.ts +67 -2
- package/dist/cedar/compile.d.ts.map +1 -1
- package/dist/cedar/compile.js +34 -5
- package/dist/cedar/compile.js.map +1 -1
- package/dist/cedar/index.d.ts +1 -0
- package/dist/cedar/index.d.ts.map +1 -1
- package/dist/cedar/index.js.map +1 -1
- package/dist/cjs/bundle/index.js +3 -1
- package/dist/cjs/bundle/index.js.map +1 -1
- package/dist/cjs/bundle/inline.js +4 -4
- package/dist/cjs/bundle/inline.js.map +1 -1
- package/dist/cjs/capabilities/registry.js +5 -1
- package/dist/cjs/capabilities/registry.js.map +1 -1
- package/dist/cjs/cedar/compile.js +34 -5
- package/dist/cjs/cedar/compile.js.map +1 -1
- package/dist/cjs/cedar/index.js.map +1 -1
- package/dist/cjs/components/consent-action-bar.js +16 -5
- package/dist/cjs/components/consent-action-bar.js.map +1 -1
- package/dist/cjs/components/consent-capabilities-screen.js +92 -37
- package/dist/cjs/components/consent-capabilities-screen.js.map +1 -1
- package/dist/cjs/components/consent-capability-card.js +35 -4
- package/dist/cjs/components/consent-capability-card.js.map +1 -1
- package/dist/cjs/components/mcp-consent.js +91 -25
- package/dist/cjs/components/mcp-consent.js.map +1 -1
- package/dist/cjs/constants/capabilities.js +10 -0
- package/dist/cjs/constants/capabilities.js.map +1 -0
- package/dist/cjs/constants/index.js +3 -1
- package/dist/cjs/constants/index.js.map +1 -1
- package/dist/cjs/mcp-app/inline.js +2 -2
- package/dist/cjs/mcp-app/inline.js.map +1 -1
- package/dist/cjs/resolution/credential-capabilities.js +16 -0
- package/dist/cjs/resolution/credential-capabilities.js.map +1 -1
- package/dist/cjs/resolution/selected-capabilities.js +73 -0
- package/dist/cjs/resolution/selected-capabilities.js.map +1 -0
- package/dist/cjs/schemas/capabilities.schemas.js +14 -2
- package/dist/cjs/schemas/capabilities.schemas.js.map +1 -1
- package/dist/cjs/security/identity-assertion.js +69 -0
- package/dist/cjs/security/identity-assertion.js.map +1 -0
- package/dist/cjs/security/index.js +1 -0
- package/dist/cjs/security/index.js.map +1 -1
- package/dist/cjs/types/capabilities.types.js +55 -0
- package/dist/cjs/types/capabilities.types.js.map +1 -1
- package/dist/components/consent-action-bar.d.ts +2 -0
- package/dist/components/consent-action-bar.d.ts.map +1 -1
- package/dist/components/consent-action-bar.js +16 -5
- package/dist/components/consent-action-bar.js.map +1 -1
- package/dist/components/consent-capabilities-screen.d.ts +18 -5
- package/dist/components/consent-capabilities-screen.d.ts.map +1 -1
- package/dist/components/consent-capabilities-screen.js +92 -37
- package/dist/components/consent-capabilities-screen.js.map +1 -1
- package/dist/components/consent-capability-card.d.ts +2 -0
- package/dist/components/consent-capability-card.d.ts.map +1 -1
- package/dist/components/consent-capability-card.js +35 -4
- package/dist/components/consent-capability-card.js.map +1 -1
- package/dist/components/mcp-consent.d.ts +30 -0
- package/dist/components/mcp-consent.d.ts.map +1 -1
- package/dist/components/mcp-consent.js +92 -26
- package/dist/components/mcp-consent.js.map +1 -1
- package/dist/consent.js +280 -48
- package/dist/consent.min.js +200 -153
- package/dist/constants/capabilities.d.ts +7 -0
- package/dist/constants/capabilities.d.ts.map +1 -0
- package/dist/constants/capabilities.js +7 -0
- package/dist/constants/capabilities.js.map +1 -0
- package/dist/constants/index.d.ts +1 -0
- package/dist/constants/index.d.ts.map +1 -1
- package/dist/constants/index.js +1 -0
- package/dist/constants/index.js.map +1 -1
- package/dist/mcp-app/inline.d.ts.map +1 -1
- package/dist/mcp-app/inline.js +2 -2
- package/dist/mcp-app/inline.js.map +1 -1
- package/dist/resolution/credential-capabilities.d.ts +15 -2
- package/dist/resolution/credential-capabilities.d.ts.map +1 -1
- package/dist/resolution/credential-capabilities.js +15 -0
- package/dist/resolution/credential-capabilities.js.map +1 -1
- package/dist/resolution/selected-capabilities.d.ts +26 -0
- package/dist/resolution/selected-capabilities.d.ts.map +1 -0
- package/dist/resolution/selected-capabilities.js +69 -0
- package/dist/resolution/selected-capabilities.js.map +1 -0
- package/dist/schemas/api.schemas.d.ts +88 -68
- package/dist/schemas/api.schemas.d.ts.map +1 -1
- package/dist/schemas/branding.schemas.d.ts +2 -2
- package/dist/schemas/capabilities.schemas.d.ts +58 -12
- package/dist/schemas/capabilities.schemas.d.ts.map +1 -1
- package/dist/schemas/capabilities.schemas.js +14 -2
- package/dist/schemas/capabilities.schemas.js.map +1 -1
- package/dist/schemas/config.schemas.d.ts +140 -100
- package/dist/schemas/config.schemas.d.ts.map +1 -1
- package/dist/security/identity-assertion.d.ts +49 -0
- package/dist/security/identity-assertion.d.ts.map +1 -0
- package/dist/security/identity-assertion.js +66 -0
- package/dist/security/identity-assertion.js.map +1 -0
- package/dist/security/index.d.ts +1 -0
- package/dist/security/index.d.ts.map +1 -1
- package/dist/security/index.js +1 -0
- package/dist/security/index.js.map +1 -1
- package/dist/types/capabilities.types.d.ts +69 -0
- package/dist/types/capabilities.types.d.ts.map +1 -1
- package/dist/types/capabilities.types.js +53 -1
- package/dist/types/capabilities.types.js.map +1 -1
- package/package.json +6 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inline.js","sourceRoot":"","sources":["../../src/bundle/inline.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAW,
|
|
1
|
+
{"version":3,"file":"inline.js","sourceRoot":"","sources":["../../src/bundle/inline.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAW,u/6QAAu/6Q,CAAC;AAE9h7Q;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAW,MAAM,CAAC;AAElD;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAW,kBAAkB,CAAC;AAE9D;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAW,8BAA8B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/capabilities/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAEjE;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/capabilities/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAEjE;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAyG3D,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,MAAM,EAAE,EAChB,SAAS,GAAE,UAAU,EAAO,GAC3B,UAAU,EAAE,CAsCd"}
|
|
@@ -68,7 +68,11 @@ export const DEFAULT_CAPABILITIES = {
|
|
|
68
68
|
description: "Pay with cards already on your account. The agent never sees the card numbers.",
|
|
69
69
|
icon: "card",
|
|
70
70
|
riskLevel: "high",
|
|
71
|
-
|
|
71
|
+
// First-Contact Scope Cap (design doc section 3, rule 1): high/critical
|
|
72
|
+
// capabilities can never ship pre-checked. hardwareworld's demo now
|
|
73
|
+
// requires one extra click to grant saved-payment use; see the PR
|
|
74
|
+
// description for the reasoning.
|
|
75
|
+
defaultOn: false,
|
|
72
76
|
cedar: [
|
|
73
77
|
"permit (",
|
|
74
78
|
' principal == Agent::"{{agent_did}}",',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/capabilities/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAA+B;IAC9D,aAAa,EAAE;QACb,EAAE,EAAE,aAAa;QACjB,KAAK,EAAE,kCAAkC;QACzC,WAAW,EACT,oEAAoE;QACtE,IAAI,EAAE,QAAQ;QACd,SAAS,EAAE,KAAK;QAChB,SAAS,EAAE,IAAI;QACf,KAAK,EAAE;YACL,UAAU;YACV,wCAAwC;YACxC,eAAe;YACf,qCAAqC;YACrC,iCAAiC;YACjC,mCAAmC;YACnC,iCAAiC;YACjC,MAAM;YACN,4CAA4C;YAC5C,IAAI;SACL,CAAC,IAAI,CAAC,IAAI,CAAC;QACZ,MAAM,EAAE;YACN,sBAAsB;YACtB,kBAAkB;YAClB,oBAAoB;YACpB,mBAAmB;SACpB;QACD,QAAQ,EAAE,QAAQ;KACnB;IACD,UAAU,EAAE;QACV,EAAE,EAAE,UAAU;QACd,KAAK,EAAE,wBAAwB;QAC/B,WAAW,EACT,mEAAmE;QACrE,IAAI,EAAE,MAAM;QACZ,SAAS,EAAE,QAAQ;QACnB,SAAS,EAAE,IAAI;QACf,KAAK,EAAE;YACL,UAAU;YACV,wCAAwC;YACxC,4CAA4C;YAC5C,yCAAyC;YACzC,IAAI;SACL,CAAC,IAAI,CAAC,IAAI,CAAC;QACZ,MAAM,EAAE,CAAC,qBAAqB,CAAC;QAC/B,QAAQ,EAAE,MAAM;KACjB;IACD,mBAAmB,EAAE;QACnB,EAAE,EAAE,mBAAmB;QACvB,KAAK,EAAE,gCAAgC;QACvC,WAAW,EACT,gFAAgF;QAClF,IAAI,EAAE,MAAM;QACZ,SAAS,EAAE,MAAM;QACjB,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/capabilities/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAA+B;IAC9D,aAAa,EAAE;QACb,EAAE,EAAE,aAAa;QACjB,KAAK,EAAE,kCAAkC;QACzC,WAAW,EACT,oEAAoE;QACtE,IAAI,EAAE,QAAQ;QACd,SAAS,EAAE,KAAK;QAChB,SAAS,EAAE,IAAI;QACf,KAAK,EAAE;YACL,UAAU;YACV,wCAAwC;YACxC,eAAe;YACf,qCAAqC;YACrC,iCAAiC;YACjC,mCAAmC;YACnC,iCAAiC;YACjC,MAAM;YACN,4CAA4C;YAC5C,IAAI;SACL,CAAC,IAAI,CAAC,IAAI,CAAC;QACZ,MAAM,EAAE;YACN,sBAAsB;YACtB,kBAAkB;YAClB,oBAAoB;YACpB,mBAAmB;SACpB;QACD,QAAQ,EAAE,QAAQ;KACnB;IACD,UAAU,EAAE;QACV,EAAE,EAAE,UAAU;QACd,KAAK,EAAE,wBAAwB;QAC/B,WAAW,EACT,mEAAmE;QACrE,IAAI,EAAE,MAAM;QACZ,SAAS,EAAE,QAAQ;QACnB,SAAS,EAAE,IAAI;QACf,KAAK,EAAE;YACL,UAAU;YACV,wCAAwC;YACxC,4CAA4C;YAC5C,yCAAyC;YACzC,IAAI;SACL,CAAC,IAAI,CAAC,IAAI,CAAC;QACZ,MAAM,EAAE,CAAC,qBAAqB,CAAC;QAC/B,QAAQ,EAAE,MAAM;KACjB;IACD,mBAAmB,EAAE;QACnB,EAAE,EAAE,mBAAmB;QACvB,KAAK,EAAE,gCAAgC;QACvC,WAAW,EACT,gFAAgF;QAClF,IAAI,EAAE,MAAM;QACZ,SAAS,EAAE,MAAM;QACjB,wEAAwE;QACxE,oEAAoE;QACpE,kEAAkE;QAClE,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AAM,KAAK,GAAG,KAAK;SAChB,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC;SACvB,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;IAC5C,OAAO;QACL,EAAE,EAAE,WAAW,KAAK,CAAC,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE;QAChE,KAAK;QACL,WAAW,EAAE,8BAA8B,KAAK,SAAS;QACzD,IAAI,EAAE,SAAS;QACf,SAAS,EAAE,QAAQ;QACnB,SAAS,EAAE,KAAK;QAChB,KAAK,EAAE;YACL,UAAU;YACV,wCAAwC;YACxC,wBAAwB,KAAK,IAAI;YACjC,6CAA6C;YAC7C,IAAI;SACL,CAAC,IAAI,CAAC,IAAI,CAAC;QACZ,MAAM,EAAE,CAAC,KAAK,CAAC;KAChB,CAAC;AACJ,CAAC"}
|
package/dist/cedar/compile.d.ts
CHANGED
|
@@ -10,7 +10,55 @@
|
|
|
10
10
|
*
|
|
11
11
|
* @module @kya-os/consent/cedar/compile
|
|
12
12
|
*/
|
|
13
|
-
import type { Capability, CedarTemplateContext } from "../types/capabilities.types.js";
|
|
13
|
+
import type { Capability, CedarTemplateContext, RelationshipContext } from "../types/capabilities.types.js";
|
|
14
|
+
/**
|
|
15
|
+
* Result of `compileCapabilitiesToCedar`: the compiled policy source, plus
|
|
16
|
+
* any grants the First-Contact Scope Cap withheld so the caller can tell a
|
|
17
|
+
* fragment was dropped rather than silently losing it (design doc section 3).
|
|
18
|
+
*
|
|
19
|
+
* Known limitation: this cap is a compile-time filter, not a credential-level
|
|
20
|
+
* constraint. `cedar` and `grantedScopes` are what this one call decided to
|
|
21
|
+
* emit; neither field, and nothing on the delegation VC they feed, records
|
|
22
|
+
* *that* a cap was applied or *why*. The DID layer already has the vocabulary
|
|
23
|
+
* a real fix would sit on (`capabilityDelegation` / `capabilityInvocation`
|
|
24
|
+
* verification relationships, `@kya-os/contracts/did`), and `checkpoint`
|
|
25
|
+
* carries an independent duplicate of this same schema and gate
|
|
26
|
+
* (`checkpoint-shared/src/schemas/bouncer.ts`, `ConsentCapabilitySchema`) —
|
|
27
|
+
* so today the invariant is reasserted at every screen that renders a
|
|
28
|
+
* consent flow, not carried by the credential itself. If checkpoint's
|
|
29
|
+
* delegations become ZCAP-shaped (a `parentCapability` / `allowedAction` /
|
|
30
|
+
* caveat structure), a probe-capped grant needs to say so on the capability
|
|
31
|
+
* object so the constraint survives delegation and re-verification outside
|
|
32
|
+
* this function, not just on the one call site that happened to have fresh
|
|
33
|
+
* `RelationshipContext` in hand. Out of scope here; tracked as follow-on
|
|
34
|
+
* design work, not implemented by this result type.
|
|
35
|
+
*/
|
|
36
|
+
export interface CompileCapabilitiesResult {
|
|
37
|
+
/** Compiled Cedar source for the probe-eligible grants. */
|
|
38
|
+
cedar: string;
|
|
39
|
+
/**
|
|
40
|
+
* The granted scope set: the deduplicated union of `scopes` across every
|
|
41
|
+
* probe-eligible grant, in the same order those scopes were first seen.
|
|
42
|
+
* Within this call, it is the one place to read what got granted — read
|
|
43
|
+
* it from here rather than re-deriving it by filtering the input `grants`
|
|
44
|
+
* array against `withheld`.
|
|
45
|
+
*
|
|
46
|
+
* That re-derivation is the trap: a scope string can be declared by more
|
|
47
|
+
* than one capability. If one of them is withheld and another is not,
|
|
48
|
+
* naively removing every scope `withheld` declares (e.g.
|
|
49
|
+
* `allScopes.filter(s => !withheldScopes.has(s))`) strips a scope the
|
|
50
|
+
* surviving capability still grants. `grantedScopes` is built from
|
|
51
|
+
* `eligible` directly, so that failure mode can't happen here — a caller
|
|
52
|
+
* that reads this field instead of re-deriving inherits the fix for free.
|
|
53
|
+
*/
|
|
54
|
+
grantedScopes: string[];
|
|
55
|
+
/**
|
|
56
|
+
* Grants that were withheld because the requesting agent is capped at
|
|
57
|
+
* probe (rule 2: first contact; rule 3: unverified) and the grant's
|
|
58
|
+
* riskLevel is `high` or `critical`.
|
|
59
|
+
*/
|
|
60
|
+
withheld: Capability[];
|
|
61
|
+
}
|
|
14
62
|
/**
|
|
15
63
|
* Compile a single capability's Cedar fragment by binding placeholders to the
|
|
16
64
|
* given template context. Used by the per-row "View policy" disclosure so the
|
|
@@ -25,6 +73,23 @@ export declare function compileSingleCapability(capability: Capability, context:
|
|
|
25
73
|
* a delegation VC. Each capability's fragment is bound and concatenated with
|
|
26
74
|
* a comment header that records the capability id and label, so reviewers can
|
|
27
75
|
* map a `permit (...)` block back to the row the user clicked.
|
|
76
|
+
*
|
|
77
|
+
* First-Contact Scope Cap (design doc section 3, rules 2 + 3): a `high` or
|
|
78
|
+
* `critical` grant is withheld, never compiled, whenever the requesting
|
|
79
|
+
* agent is capped at probe (no verified Entity Card, or no established
|
|
80
|
+
* relationship). The caller must pass the agent's relationship context on
|
|
81
|
+
* every call, so a different renderer cannot compile the full grant set
|
|
82
|
+
* without deciding what the agent is entitled to. `agent` may be `undefined`:
|
|
83
|
+
* real stored configs carry no agent metadata at all, and that counts as
|
|
84
|
+
* unverified too, so it fails closed rather than throwing. Withheld grants
|
|
85
|
+
* are dropped rather than throwing so the rest of the (probe-eligible)
|
|
86
|
+
* policy still compiles, but they are always returned to the caller, never
|
|
87
|
+
* lost silently — from *this call*. That guarantee ends at the return value:
|
|
88
|
+
* nothing withheld, or the fact that a cap was applied at all, is recorded
|
|
89
|
+
* on the compiled Cedar or on the delegation VC it feeds, so re-deriving or
|
|
90
|
+
* attenuating a credential downstream without calling this function again
|
|
91
|
+
* (with fresh `RelationshipContext`) will not rediscover the cap. See the
|
|
92
|
+
* "Known limitation" note on `CompileCapabilitiesResult`.
|
|
28
93
|
*/
|
|
29
|
-
export declare function compileCapabilitiesToCedar(grants: Capability[], context: CedarTemplateContext):
|
|
94
|
+
export declare function compileCapabilitiesToCedar(grants: Capability[], context: CedarTemplateContext, agent: RelationshipContext | undefined): CompileCapabilitiesResult;
|
|
30
95
|
//# sourceMappingURL=compile.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../src/cedar/compile.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;
|
|
1
|
+
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../src/cedar/compile.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,KAAK,EACV,UAAU,EACV,oBAAoB,EACpB,mBAAmB,EACpB,MAAM,gCAAgC,CAAC;AAIxC;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,WAAW,yBAAyB;IACxC,2DAA2D;IAC3D,KAAK,EAAE,MAAM,CAAC;IAEd;;;;;;;;;;;;;;OAcG;IACH,aAAa,EAAE,MAAM,EAAE,CAAC;IAExB;;;;OAIG;IACH,QAAQ,EAAE,UAAU,EAAE,CAAC;CACxB;AAED;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,oBAAoB,GAC5B,MAAM,CAkBR;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,UAAU,EAAE,EACpB,OAAO,EAAE,oBAAoB,EAC7B,KAAK,EAAE,mBAAmB,GAAG,SAAS,GACrC,yBAAyB,CA6B3B"}
|
package/dist/cedar/compile.js
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
*
|
|
11
11
|
* @module @kya-os/consent/cedar/compile
|
|
12
12
|
*/
|
|
13
|
+
import { isCappedAtProbe, isProbeEligible } from "../types/capabilities.types.js";
|
|
13
14
|
const PLACEHOLDER_PATTERN = /\{\{\s*(agent_did|user_did|org|deployment)\s*\}\}/g;
|
|
14
15
|
/**
|
|
15
16
|
* Compile a single capability's Cedar fragment by binding placeholders to the
|
|
@@ -37,12 +38,40 @@ export function compileSingleCapability(capability, context) {
|
|
|
37
38
|
* a delegation VC. Each capability's fragment is bound and concatenated with
|
|
38
39
|
* a comment header that records the capability id and label, so reviewers can
|
|
39
40
|
* map a `permit (...)` block back to the row the user clicked.
|
|
41
|
+
*
|
|
42
|
+
* First-Contact Scope Cap (design doc section 3, rules 2 + 3): a `high` or
|
|
43
|
+
* `critical` grant is withheld, never compiled, whenever the requesting
|
|
44
|
+
* agent is capped at probe (no verified Entity Card, or no established
|
|
45
|
+
* relationship). The caller must pass the agent's relationship context on
|
|
46
|
+
* every call, so a different renderer cannot compile the full grant set
|
|
47
|
+
* without deciding what the agent is entitled to. `agent` may be `undefined`:
|
|
48
|
+
* real stored configs carry no agent metadata at all, and that counts as
|
|
49
|
+
* unverified too, so it fails closed rather than throwing. Withheld grants
|
|
50
|
+
* are dropped rather than throwing so the rest of the (probe-eligible)
|
|
51
|
+
* policy still compiles, but they are always returned to the caller, never
|
|
52
|
+
* lost silently — from *this call*. That guarantee ends at the return value:
|
|
53
|
+
* nothing withheld, or the fact that a cap was applied at all, is recorded
|
|
54
|
+
* on the compiled Cedar or on the delegation VC it feeds, so re-deriving or
|
|
55
|
+
* attenuating a credential downstream without calling this function again
|
|
56
|
+
* (with fresh `RelationshipContext`) will not rediscover the cap. See the
|
|
57
|
+
* "Known limitation" note on `CompileCapabilitiesResult`.
|
|
40
58
|
*/
|
|
41
|
-
export function compileCapabilitiesToCedar(grants, context) {
|
|
42
|
-
|
|
43
|
-
|
|
59
|
+
export function compileCapabilitiesToCedar(grants, context, agent) {
|
|
60
|
+
const capped = isCappedAtProbe(agent);
|
|
61
|
+
const eligible = [];
|
|
62
|
+
const withheld = [];
|
|
63
|
+
for (const grant of grants) {
|
|
64
|
+
if (capped && !isProbeEligible(grant.riskLevel)) {
|
|
65
|
+
withheld.push(grant);
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
eligible.push(grant);
|
|
69
|
+
}
|
|
70
|
+
const grantedScopes = Array.from(new Set(eligible.flatMap((grant) => grant.scopes)));
|
|
71
|
+
if (eligible.length === 0) {
|
|
72
|
+
return { cedar: "", grantedScopes, withheld };
|
|
44
73
|
}
|
|
45
|
-
const blocks =
|
|
74
|
+
const blocks = eligible.map((grant) => {
|
|
46
75
|
const compiled = compileSingleCapability(grant, context);
|
|
47
76
|
return [
|
|
48
77
|
`// capability: ${grant.id} — ${grant.label}`,
|
|
@@ -50,6 +79,6 @@ export function compileCapabilitiesToCedar(grants, context) {
|
|
|
50
79
|
compiled.trim(),
|
|
51
80
|
].join("\n");
|
|
52
81
|
});
|
|
53
|
-
return blocks.join("\n\n");
|
|
82
|
+
return { cedar: blocks.join("\n\n"), grantedScopes, withheld };
|
|
54
83
|
}
|
|
55
84
|
//# sourceMappingURL=compile.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile.js","sourceRoot":"","sources":["../../src/cedar/compile.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;
|
|
1
|
+
{"version":3,"file":"compile.js","sourceRoot":"","sources":["../../src/cedar/compile.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAOlF,MAAM,mBAAmB,GAAG,oDAAoD,CAAC;AAqDjF;;;;;;;GAOG;AACH,MAAM,UAAU,uBAAuB,CACrC,UAAsB,EACtB,OAA6B;IAE7B,MAAM,QAAQ,GAAG,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAAC,EAAE,GAAW,EAAE,EAAE;QAChF,MAAM,KAAK,GAAG,OAAO,CAAC,GAAiC,CAAC,CAAC;QACzD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACpD,MAAM,IAAI,KAAK,CACb,mEAAmE,GAAG,IAAI,CAC3E,CAAC;QACJ,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC,CAAC,CAAC;IAEH,IAAI,QAAQ,CAAC,IAAI,EAAE,CAAC,MAAM,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,CAAC,EAAE;YACrE,QAAQ,CAAC,IAAI,EAAE;SAChB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACf,CAAC,CAAC,CAAC;IAEH,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,aAAa,EAAE,QAAQ,EAAE,CAAC;AACjE,CAAC"}
|
package/dist/cedar/index.d.ts
CHANGED
|
@@ -4,5 +4,6 @@
|
|
|
4
4
|
* @module @kya-os/consent/cedar
|
|
5
5
|
*/
|
|
6
6
|
export { compileSingleCapability, compileCapabilitiesToCedar, } from "./compile.js";
|
|
7
|
+
export type { CompileCapabilitiesResult } from "./compile.js";
|
|
7
8
|
export { explainCedarFragment } from "./explain.js";
|
|
8
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cedar/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,uBAAuB,EACvB,0BAA0B,GAC3B,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cedar/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,uBAAuB,EACvB,0BAA0B,GAC3B,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/cedar/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cedar/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,uBAAuB,EACvB,0BAA0B,GAC3B,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cedar/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,uBAAuB,EACvB,0BAA0B,GAC3B,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/cjs/bundle/index.js
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
* @module @kya-os/consent/bundle
|
|
24
24
|
*/
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.ConsentCapabilitiesScreen = exports.ConsentConnectorHeader = exports.ConsentRevocationNotice = exports.ConsentFooter = exports.ConsentActionBar = exports.ConsentCapabilityCard = exports.ConsentAgentHeader = exports.ConsentOTPInput = exports.ConsentOAuthButton = exports.ConsentTerms = exports.ConsentPermissions = exports.ConsentShell = exports.ConsentInput = exports.ConsentCheckbox = exports.ConsentButton = exports.McpConsent = void 0;
|
|
26
|
+
exports.CONSENT_CAPABILITIES_FEATURES = exports.ConsentCapabilitiesScreen = exports.ConsentConnectorHeader = exports.ConsentRevocationNotice = exports.ConsentFooter = exports.ConsentActionBar = exports.ConsentCapabilityCard = exports.ConsentAgentHeader = exports.ConsentOTPInput = exports.ConsentOAuthButton = exports.ConsentTerms = exports.ConsentPermissions = exports.ConsentShell = exports.ConsentInput = exports.ConsentCheckbox = exports.ConsentButton = exports.McpConsent = void 0;
|
|
27
27
|
// Import all components - this registers them as custom elements
|
|
28
28
|
require("../components/consent-button.js");
|
|
29
29
|
require("../components/consent-checkbox.js");
|
|
@@ -75,4 +75,6 @@ var consent_connector_header_js_1 = require("../components/consent-connector-hea
|
|
|
75
75
|
Object.defineProperty(exports, "ConsentConnectorHeader", { enumerable: true, get: function () { return consent_connector_header_js_1.ConsentConnectorHeader; } });
|
|
76
76
|
var consent_capabilities_screen_js_1 = require("../components/consent-capabilities-screen.js");
|
|
77
77
|
Object.defineProperty(exports, "ConsentCapabilitiesScreen", { enumerable: true, get: function () { return consent_capabilities_screen_js_1.ConsentCapabilitiesScreen; } });
|
|
78
|
+
var capabilities_js_1 = require("../constants/capabilities.js");
|
|
79
|
+
Object.defineProperty(exports, "CONSENT_CAPABILITIES_FEATURES", { enumerable: true, get: function () { return capabilities_js_1.CONSENT_CAPABILITIES_FEATURES; } });
|
|
78
80
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/bundle/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;;;AAEH,iEAAiE;AACjE,2CAAyC;AACzC,6CAA2C;AAC3C,0CAAwC;AACxC,0CAAwC;AACxC,gDAA8C;AAC9C,0CAAwC;AACxC,iDAA+C;AAC/C,8CAA4C;AAC5C,iDAA+C;AAC/C,oDAAkD;AAClD,+CAA6C;AAC7C,2CAAyC;AACzC,sDAAoD;AACpD,qDAAmD;AACnD,wDAAsD;AACtD,wCAAsC;AAEtC,8DAA8D;AAC9D,+DAA0D;AAAjD,4GAAA,UAAU,OAAA;AAEnB,qDAAqD;AACrD,qEAAgE;AAAvD,kHAAA,aAAa,OAAA;AACtB,yEAAoE;AAA3D,sHAAA,eAAe,OAAA;AACxB,mEAA8D;AAArD,gHAAA,YAAY,OAAA;AACrB,mEAA8D;AAArD,gHAAA,YAAY,OAAA;AACrB,+EAA0E;AAAjE,4HAAA,kBAAkB,OAAA;AAC3B,mEAA8D;AAArD,gHAAA,YAAY,OAAA;AACrB,iFAA2E;AAAlE,6HAAA,kBAAkB,OAAA;AAC3B,2EAAqE;AAA5D,uHAAA,eAAe,OAAA;AACxB,iFAA2E;AAAlE,6HAAA,kBAAkB,OAAA;AAC3B,uFAAiF;AAAxE,mIAAA,qBAAqB,OAAA;AAC9B,6EAAuE;AAA9D,yHAAA,gBAAgB,OAAA;AACzB,qEAAgE;AAAvD,kHAAA,aAAa,OAAA;AACtB,2FAAqF;AAA5E,uIAAA,uBAAuB,OAAA;AA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