kavachos 0.4.0 → 0.4.1

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.
@@ -2,6 +2,7 @@ import { z } from 'zod';
2
2
  import { a5 as AuthAdapter, o as ResolvedUser, X as KavachPlugin, D as Database, _ as AdminConfig, p as SessionManager, a2 as ApiKeyManagerConfig, aa as EmailOtpConfig, P as Permission, ae as MagicLinkConfig, aj as OrgConfig, ao as PasskeyConfig, N as PluginEndpoint, aF as TotpConfig } from '../types-RJPOU4un.js';
3
3
  export { u as AdminModule, $ as AdminUser, a1 as ApiKey, v as ApiKeyManagerModule, a6 as CaptchaConfig, G as CaptchaModule, a7 as CaptchaVerifyResult, a8 as CreateTokenInput, E as EmailOtpModule, ab as EmailVerificationConfig, y as EmailVerificationModule, r as MagicLinkModule, ag as OidcProvider, ah as OneTimeTokenConfig, z as OneTimeTokenModule, ai as OneTimeTokenPurpose, ak as OrgInvitation, al as OrgMember, O as OrgModule, am as OrgRole, an as Organization, ap as PasskeyCredential, s as PasskeyModule, aq as PasswordResetConfig, x as PasswordResetModule, as as PhoneAuthConfig, F as PhoneAuthModule, av as RevokeTokensResult, aw as SSO_ERROR, ax as SamlProvider, aA as SsoAuditEvent, aB as SsoConfig, aC as SsoConnection, aD as SsoError, t as SsoModule, T as TotpModule, aG as TotpSetup, aH as UsernameAuthConfig, w as UsernameAuthModule, aI as ValidateTokenResult, bu as WebhookConfig, bv as WebhookEvent, W as WebhookModule, aS as createAdminModule, aT as createApiKeyManagerModule, aV as createCaptchaModule, aY as createEmailOtpModule, aZ as createEmailVerificationModule, a_ as createMagicLinkModule, a$ as createOneTimeTokenModule, b0 as createOrgModule, b1 as createPasskeyModule, b2 as createPasswordResetModule, b3 as createPhoneAuthModule, b6 as createSsoModule, b7 as createTotpModule, b8 as createUsernameAuthModule, bw as createWebhookModule } from '../types-RJPOU4un.js';
4
4
  import { R as Result } from '../types-BiUe9e8u.js';
5
+ import { AgentType, TrustTier } from '../standards/index.js';
5
6
  import * as jose from 'jose';
6
7
  import 'drizzle-orm/sqlite-core';
7
8
  import '../redirect/index.js';
@@ -982,37 +983,6 @@ declare class HibpApiError extends Error {
982
983
  constructor(message: string);
983
984
  }
984
985
 
985
- /**
986
- * IETF agentic JWT claim name constants.
987
- *
988
- * Sources:
989
- * - draft-goswami-agentic-jwt-00
990
- * - draft-liu-agent-operation-authorization-01
991
- *
992
- * These constants are off by default. Set `emitAgenticJwtClaims: true` in
993
- * KavachConfig to include them in issued tokens.
994
- */
995
- /**
996
- * Operational mode of an agent within a delegation chain.
997
- *
998
- * - `autonomous` — no human-in-the-loop; the agent acts on its own behalf.
999
- * - `delegated` — the agent is acting under explicit delegation from another principal.
1000
- * - `supervised` — the agent acts autonomously but requires human approval for sensitive ops.
1001
- */
1002
- type AgentType = "autonomous" | "delegated" | "supervised";
1003
- /**
1004
- * Trust tier band assigned at token issuance, derived from the numeric trust
1005
- * score. Matches the five-level model in KavachOS trust scoring.
1006
- *
1007
- * Mapping (inclusive lower bound):
1008
- * score 0–19 → "unverified"
1009
- * score 20–39 → "low"
1010
- * score 40–59 → "standard"
1011
- * score 60–79 → "elevated"
1012
- * score 80+ → "high"
1013
- */
1014
- type TrustTier = "unverified" | "low" | "standard" | "elevated" | "high";
1015
-
1016
986
  /**
1017
987
  * JWT session plugin for KavachOS.
1018
988
  *
package/dist/index.d.ts CHANGED
@@ -12,6 +12,7 @@ export { AuditCredentialSubject, AuditExportResult, AuditRecord, CredentialForma
12
12
  import 'drizzle-orm/sqlite-core';
13
13
  import './types-BiUe9e8u.js';
14
14
  import 'zod';
15
+ import './standards/index.js';
15
16
  import 'jose';
16
17
 
17
18
  interface PrivilegeFinding {
@@ -0,0 +1,139 @@
1
+ /**
2
+ * IETF agentic JWT claim name constants.
3
+ *
4
+ * Sources:
5
+ * - draft-goswami-agentic-jwt-00
6
+ * - draft-liu-agent-operation-authorization-01
7
+ *
8
+ * These constants are off by default. Set `emitAgenticJwtClaims: true` in
9
+ * KavachConfig to include them in issued tokens.
10
+ */
11
+ /**
12
+ * Operational mode of an agent within a delegation chain.
13
+ *
14
+ * - `autonomous` — no human-in-the-loop; the agent acts on its own behalf.
15
+ * - `delegated` — the agent is acting under explicit delegation from another principal.
16
+ * - `supervised` — the agent acts autonomously but requires human approval for sensitive ops.
17
+ */
18
+ type AgentType = "autonomous" | "delegated" | "supervised";
19
+ /**
20
+ * Trust tier band assigned at token issuance, derived from the numeric trust
21
+ * score. Matches the five-level model in KavachOS trust scoring.
22
+ *
23
+ * Mapping (inclusive lower bound):
24
+ * score 0–19 → "unverified"
25
+ * score 20–39 → "low"
26
+ * score 40–59 → "standard"
27
+ * score 60–79 → "elevated"
28
+ * score 80+ → "high"
29
+ */
30
+ type TrustTier = "unverified" | "low" | "standard" | "elevated" | "high";
31
+ /**
32
+ * Registered claim names for agentic JWTs.
33
+ *
34
+ * All names are string literals so they can be used directly as JWT payload
35
+ * keys. Consuming code should index into issued token payloads using these
36
+ * constants rather than raw string literals.
37
+ */
38
+ declare const AGENTIC_JWT_CLAIMS: {
39
+ /**
40
+ * Stable identifier of the agent making the call.
41
+ *
42
+ * @see draft-goswami-agentic-jwt-00 §3.1
43
+ */
44
+ readonly AGENT_ID: "agent_id";
45
+ /**
46
+ * Operational mode of the agent: `autonomous`, `delegated`, or `supervised`.
47
+ *
48
+ * @see draft-goswami-agentic-jwt-00 §3.2
49
+ */
50
+ readonly AGENT_TYPE: "agent_type";
51
+ /**
52
+ * Subject principal the agent is acting on behalf of (human user or upstream agent).
53
+ *
54
+ * @see draft-goswami-agentic-jwt-00 §3.3
55
+ */
56
+ readonly ON_BEHALF_OF: "on_behalf_of";
57
+ /**
58
+ * Actor claim per RFC 8693. Identifies the current actor in an
59
+ * impersonation or delegation chain.
60
+ *
61
+ * @see draft-goswami-agentic-jwt-00 §3.4
62
+ * @see RFC 8693
63
+ */
64
+ readonly ACT: "act";
65
+ /**
66
+ * Authorized future actors for delegation chains (RFC 8693 `may_act`).
67
+ *
68
+ * @see draft-goswami-agentic-jwt-00 §3.5
69
+ * @see RFC 8693
70
+ */
71
+ readonly MAY_ACT: "may_act";
72
+ /**
73
+ * Trust score band at token issuance (e.g. `standard`, `elevated`).
74
+ *
75
+ * @see draft-goswami-agentic-jwt-00 §3.6
76
+ */
77
+ readonly TRUST_TIER: "trust_tier";
78
+ /**
79
+ * Correlation id for tracing this token back to an entry in the audit log.
80
+ *
81
+ * @see draft-goswami-agentic-jwt-00 §3.7
82
+ */
83
+ readonly AUDIT_REF: "audit_ref";
84
+ /**
85
+ * Per-tool budget or rate constraints encoded as a structured object.
86
+ *
87
+ * @see draft-goswami-agentic-jwt-00 §3.8
88
+ */
89
+ readonly TOOL_CONSTRAINTS: "tool_constraints";
90
+ /**
91
+ * Workload Identity Token (WIT). Present only when three-layer cryptographic
92
+ * binding is active (draft-liu §4.2). Absent in standard issuance paths.
93
+ *
94
+ * @see draft-liu-agent-operation-authorization-01 §4.2
95
+ * TODO(v3): populate from WIT issuance when three-layer binding is implemented.
96
+ */
97
+ readonly WORKLOAD_BINDING: "wit";
98
+ /**
99
+ * The scoped operation this token authorizes (e.g. `read:documents`).
100
+ *
101
+ * @see draft-liu-agent-operation-authorization-01 §4.3
102
+ */
103
+ readonly OPERATION: "operation";
104
+ };
105
+ /**
106
+ * Optional shape of agentic JWT claims within a token payload.
107
+ *
108
+ * All fields are optional because they are only emitted when
109
+ * `emitAgenticJwtClaims` is enabled and the relevant context is available
110
+ * on the issuance path.
111
+ */
112
+ interface AgenticJwtClaims {
113
+ /** Stable agent identifier. */
114
+ agent_id?: string;
115
+ /** Operational mode of the agent. */
116
+ agent_type?: AgentType;
117
+ /** Principal the agent is acting for. */
118
+ on_behalf_of?: string;
119
+ /** RFC 8693 actor claim (current actor in a delegation chain). */
120
+ act?: Record<string, unknown>;
121
+ /** RFC 8693 may_act claim (authorized future actors). */
122
+ may_act?: Record<string, unknown>;
123
+ /** Trust tier band at issuance time. */
124
+ trust_tier?: TrustTier;
125
+ /** Audit log correlation id. */
126
+ audit_ref?: string;
127
+ /** Per-tool budget or rate constraints. */
128
+ tool_constraints?: Record<string, unknown>;
129
+ /**
130
+ * Workload Identity Token.
131
+ * Absent unless three-layer binding is active.
132
+ * TODO(v3): populate when draft-liu three-layer binding is implemented.
133
+ */
134
+ wit?: string;
135
+ /** Scoped operation this token authorizes. */
136
+ operation?: string;
137
+ }
138
+
139
+ export { AGENTIC_JWT_CLAIMS, type AgentType, type AgenticJwtClaims, type TrustTier };
@@ -0,0 +1,72 @@
1
+ // src/standards/claims.ts
2
+ var AGENTIC_JWT_CLAIMS = {
3
+ /**
4
+ * Stable identifier of the agent making the call.
5
+ *
6
+ * @see draft-goswami-agentic-jwt-00 §3.1
7
+ */
8
+ AGENT_ID: "agent_id",
9
+ /**
10
+ * Operational mode of the agent: `autonomous`, `delegated`, or `supervised`.
11
+ *
12
+ * @see draft-goswami-agentic-jwt-00 §3.2
13
+ */
14
+ AGENT_TYPE: "agent_type",
15
+ /**
16
+ * Subject principal the agent is acting on behalf of (human user or upstream agent).
17
+ *
18
+ * @see draft-goswami-agentic-jwt-00 §3.3
19
+ */
20
+ ON_BEHALF_OF: "on_behalf_of",
21
+ /**
22
+ * Actor claim per RFC 8693. Identifies the current actor in an
23
+ * impersonation or delegation chain.
24
+ *
25
+ * @see draft-goswami-agentic-jwt-00 §3.4
26
+ * @see RFC 8693
27
+ */
28
+ ACT: "act",
29
+ /**
30
+ * Authorized future actors for delegation chains (RFC 8693 `may_act`).
31
+ *
32
+ * @see draft-goswami-agentic-jwt-00 §3.5
33
+ * @see RFC 8693
34
+ */
35
+ MAY_ACT: "may_act",
36
+ /**
37
+ * Trust score band at token issuance (e.g. `standard`, `elevated`).
38
+ *
39
+ * @see draft-goswami-agentic-jwt-00 §3.6
40
+ */
41
+ TRUST_TIER: "trust_tier",
42
+ /**
43
+ * Correlation id for tracing this token back to an entry in the audit log.
44
+ *
45
+ * @see draft-goswami-agentic-jwt-00 §3.7
46
+ */
47
+ AUDIT_REF: "audit_ref",
48
+ /**
49
+ * Per-tool budget or rate constraints encoded as a structured object.
50
+ *
51
+ * @see draft-goswami-agentic-jwt-00 §3.8
52
+ */
53
+ TOOL_CONSTRAINTS: "tool_constraints",
54
+ /**
55
+ * Workload Identity Token (WIT). Present only when three-layer cryptographic
56
+ * binding is active (draft-liu §4.2). Absent in standard issuance paths.
57
+ *
58
+ * @see draft-liu-agent-operation-authorization-01 §4.2
59
+ * TODO(v3): populate from WIT issuance when three-layer binding is implemented.
60
+ */
61
+ WORKLOAD_BINDING: "wit",
62
+ /**
63
+ * The scoped operation this token authorizes (e.g. `read:documents`).
64
+ *
65
+ * @see draft-liu-agent-operation-authorization-01 §4.3
66
+ */
67
+ OPERATION: "operation"
68
+ };
69
+
70
+ export { AGENTIC_JWT_CLAIMS };
71
+ //# sourceMappingURL=index.js.map
72
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/standards/claims.ts"],"names":[],"mappings":";AAgDO,IAAM,kBAAA,GAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMjC,QAAA,EAAU,UAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOV,UAAA,EAAY,YAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOZ,YAAA,EAAc,cAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASd,GAAA,EAAK,KAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQL,OAAA,EAAS,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOT,UAAA,EAAY,YAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOZ,SAAA,EAAW,WAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOX,gBAAA,EAAkB,kBAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASlB,gBAAA,EAAkB,KAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOlB,SAAA,EAAW;AACZ","file":"index.js","sourcesContent":["/**\n * IETF agentic JWT claim name constants.\n *\n * Sources:\n * - draft-goswami-agentic-jwt-00\n * - draft-liu-agent-operation-authorization-01\n *\n * These constants are off by default. Set `emitAgenticJwtClaims: true` in\n * KavachConfig to include them in issued tokens.\n */\n\n// ---------------------------------------------------------------------------\n// Named types\n// ---------------------------------------------------------------------------\n\n/**\n * Operational mode of an agent within a delegation chain.\n *\n * - `autonomous` — no human-in-the-loop; the agent acts on its own behalf.\n * - `delegated` — the agent is acting under explicit delegation from another principal.\n * - `supervised` — the agent acts autonomously but requires human approval for sensitive ops.\n */\nexport type AgentType = \"autonomous\" | \"delegated\" | \"supervised\";\n\n/**\n * Trust tier band assigned at token issuance, derived from the numeric trust\n * score. Matches the five-level model in KavachOS trust scoring.\n *\n * Mapping (inclusive lower bound):\n * score 0–19 → \"unverified\"\n * score 20–39 → \"low\"\n * score 40–59 → \"standard\"\n * score 60–79 → \"elevated\"\n * score 80+ → \"high\"\n */\nexport type TrustTier = \"unverified\" | \"low\" | \"standard\" | \"elevated\" | \"high\";\n\n// ---------------------------------------------------------------------------\n// Claim name constants\n// ---------------------------------------------------------------------------\n\n/**\n * Registered claim names for agentic JWTs.\n *\n * All names are string literals so they can be used directly as JWT payload\n * keys. Consuming code should index into issued token payloads using these\n * constants rather than raw string literals.\n */\nexport const AGENTIC_JWT_CLAIMS = {\n\t/**\n\t * Stable identifier of the agent making the call.\n\t *\n\t * @see draft-goswami-agentic-jwt-00 §3.1\n\t */\n\tAGENT_ID: \"agent_id\",\n\n\t/**\n\t * Operational mode of the agent: `autonomous`, `delegated`, or `supervised`.\n\t *\n\t * @see draft-goswami-agentic-jwt-00 §3.2\n\t */\n\tAGENT_TYPE: \"agent_type\",\n\n\t/**\n\t * Subject principal the agent is acting on behalf of (human user or upstream agent).\n\t *\n\t * @see draft-goswami-agentic-jwt-00 §3.3\n\t */\n\tON_BEHALF_OF: \"on_behalf_of\",\n\n\t/**\n\t * Actor claim per RFC 8693. Identifies the current actor in an\n\t * impersonation or delegation chain.\n\t *\n\t * @see draft-goswami-agentic-jwt-00 §3.4\n\t * @see RFC 8693\n\t */\n\tACT: \"act\",\n\n\t/**\n\t * Authorized future actors for delegation chains (RFC 8693 `may_act`).\n\t *\n\t * @see draft-goswami-agentic-jwt-00 §3.5\n\t * @see RFC 8693\n\t */\n\tMAY_ACT: \"may_act\",\n\n\t/**\n\t * Trust score band at token issuance (e.g. `standard`, `elevated`).\n\t *\n\t * @see draft-goswami-agentic-jwt-00 §3.6\n\t */\n\tTRUST_TIER: \"trust_tier\",\n\n\t/**\n\t * Correlation id for tracing this token back to an entry in the audit log.\n\t *\n\t * @see draft-goswami-agentic-jwt-00 §3.7\n\t */\n\tAUDIT_REF: \"audit_ref\",\n\n\t/**\n\t * Per-tool budget or rate constraints encoded as a structured object.\n\t *\n\t * @see draft-goswami-agentic-jwt-00 §3.8\n\t */\n\tTOOL_CONSTRAINTS: \"tool_constraints\",\n\n\t/**\n\t * Workload Identity Token (WIT). Present only when three-layer cryptographic\n\t * binding is active (draft-liu §4.2). Absent in standard issuance paths.\n\t *\n\t * @see draft-liu-agent-operation-authorization-01 §4.2\n\t * TODO(v3): populate from WIT issuance when three-layer binding is implemented.\n\t */\n\tWORKLOAD_BINDING: \"wit\",\n\n\t/**\n\t * The scoped operation this token authorizes (e.g. `read:documents`).\n\t *\n\t * @see draft-liu-agent-operation-authorization-01 §4.3\n\t */\n\tOPERATION: \"operation\",\n} as const;\n\n// ---------------------------------------------------------------------------\n// Payload shape\n// ---------------------------------------------------------------------------\n\n/**\n * Optional shape of agentic JWT claims within a token payload.\n *\n * All fields are optional because they are only emitted when\n * `emitAgenticJwtClaims` is enabled and the relevant context is available\n * on the issuance path.\n */\nexport interface AgenticJwtClaims {\n\t/** Stable agent identifier. */\n\tagent_id?: string;\n\t/** Operational mode of the agent. */\n\tagent_type?: AgentType;\n\t/** Principal the agent is acting for. */\n\ton_behalf_of?: string;\n\t/** RFC 8693 actor claim (current actor in a delegation chain). */\n\tact?: Record<string, unknown>;\n\t/** RFC 8693 may_act claim (authorized future actors). */\n\tmay_act?: Record<string, unknown>;\n\t/** Trust tier band at issuance time. */\n\ttrust_tier?: TrustTier;\n\t/** Audit log correlation id. */\n\taudit_ref?: string;\n\t/** Per-tool budget or rate constraints. */\n\ttool_constraints?: Record<string, unknown>;\n\t/**\n\t * Workload Identity Token.\n\t * Absent unless three-layer binding is active.\n\t * TODO(v3): populate when draft-liu three-layer binding is implemented.\n\t */\n\twit?: string;\n\t/** Scoped operation this token authorizes. */\n\toperation?: string;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kavachos",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "The auth OS for AI agents - identity, permissions, delegation, and audit for the agentic era",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -55,6 +55,11 @@
55
55
  "types": "./dist/redirect/index.d.ts",
56
56
  "import": "./dist/redirect/index.js",
57
57
  "default": "./dist/redirect/index.js"
58
+ },
59
+ "./standards": {
60
+ "types": "./dist/standards/index.d.ts",
61
+ "import": "./dist/standards/index.js",
62
+ "default": "./dist/standards/index.js"
58
63
  }
59
64
  },
60
65
  "files": [