@vorim/sdk 3.15.0 → 3.16.0
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/dist/index.cjs +14 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -2
- package/dist/index.d.ts +14 -2
- package/dist/index.js +14 -1
- package/dist/index.js.map +1 -1
- package/dist/integrations/anthropic.d.cts +1 -1
- package/dist/integrations/anthropic.d.ts +1 -1
- package/dist/integrations/ap2.d.cts +1 -1
- package/dist/integrations/ap2.d.ts +1 -1
- package/dist/integrations/aws-iam.cjs +225 -0
- package/dist/integrations/aws-iam.cjs.map +1 -0
- package/dist/integrations/aws-iam.d.cts +156 -0
- package/dist/integrations/aws-iam.d.ts +156 -0
- package/dist/integrations/aws-iam.js +199 -0
- package/dist/integrations/aws-iam.js.map +1 -0
- package/dist/integrations/bank-rails.d.cts +1 -1
- package/dist/integrations/bank-rails.d.ts +1 -1
- package/dist/integrations/circle.d.cts +1 -1
- package/dist/integrations/circle.d.ts +1 -1
- package/dist/integrations/cloudflare.d.cts +1 -1
- package/dist/integrations/cloudflare.d.ts +1 -1
- package/dist/integrations/coinbase-cdp.d.cts +1 -1
- package/dist/integrations/coinbase-cdp.d.ts +1 -1
- package/dist/integrations/crewai.d.cts +1 -1
- package/dist/integrations/crewai.d.ts +1 -1
- package/dist/integrations/entra.cjs +225 -0
- package/dist/integrations/entra.cjs.map +1 -0
- package/dist/integrations/entra.d.cts +155 -0
- package/dist/integrations/entra.d.ts +155 -0
- package/dist/integrations/entra.js +199 -0
- package/dist/integrations/entra.js.map +1 -0
- package/dist/integrations/fhir.d.cts +1 -1
- package/dist/integrations/fhir.d.ts +1 -1
- package/dist/integrations/guidewire.d.cts +1 -1
- package/dist/integrations/guidewire.d.ts +1 -1
- package/dist/integrations/hermes.d.cts +1 -1
- package/dist/integrations/hermes.d.ts +1 -1
- package/dist/integrations/langchain.d.cts +1 -1
- package/dist/integrations/langchain.d.ts +1 -1
- package/dist/integrations/langgraph.d.cts +1 -1
- package/dist/integrations/langgraph.d.ts +1 -1
- package/dist/integrations/legal.d.cts +1 -1
- package/dist/integrations/legal.d.ts +1 -1
- package/dist/integrations/life-sciences.d.cts +1 -1
- package/dist/integrations/life-sciences.d.ts +1 -1
- package/dist/integrations/lithic.d.cts +1 -1
- package/dist/integrations/lithic.d.ts +1 -1
- package/dist/integrations/llamaindex.d.cts +1 -1
- package/dist/integrations/llamaindex.d.ts +1 -1
- package/dist/integrations/marqeta.d.cts +1 -1
- package/dist/integrations/marqeta.d.ts +1 -1
- package/dist/integrations/modern-treasury.d.cts +1 -1
- package/dist/integrations/modern-treasury.d.ts +1 -1
- package/dist/integrations/nekuda.d.cts +1 -1
- package/dist/integrations/nekuda.d.ts +1 -1
- package/dist/integrations/okta.cjs +229 -0
- package/dist/integrations/okta.cjs.map +1 -0
- package/dist/integrations/okta.d.cts +172 -0
- package/dist/integrations/okta.d.ts +172 -0
- package/dist/integrations/okta.js +203 -0
- package/dist/integrations/okta.js.map +1 -0
- package/dist/integrations/openai.d.cts +1 -1
- package/dist/integrations/openai.d.ts +1 -1
- package/dist/integrations/paypal-agent.d.cts +1 -1
- package/dist/integrations/paypal-agent.d.ts +1 -1
- package/dist/integrations/plaid.d.cts +1 -1
- package/dist/integrations/plaid.d.ts +1 -1
- package/dist/integrations/ramp.d.cts +1 -1
- package/dist/integrations/ramp.d.ts +1 -1
- package/dist/integrations/shopify.d.cts +1 -1
- package/dist/integrations/shopify.d.ts +1 -1
- package/dist/integrations/siem.d.cts +1 -1
- package/dist/integrations/siem.d.ts +1 -1
- package/dist/integrations/skyfire.d.cts +1 -1
- package/dist/integrations/skyfire.d.ts +1 -1
- package/dist/integrations/stripe-acp.d.cts +1 -1
- package/dist/integrations/stripe-acp.d.ts +1 -1
- package/dist/integrations/stripe-issuing.d.cts +1 -1
- package/dist/integrations/stripe-issuing.d.ts +1 -1
- package/dist/integrations/truanon.d.cts +1 -1
- package/dist/integrations/truanon.d.ts +1 -1
- package/dist/integrations/ucp.d.cts +1 -1
- package/dist/integrations/ucp.d.ts +1 -1
- package/dist/integrations/vercel-ai.d.cts +1 -1
- package/dist/integrations/vercel-ai.d.ts +1 -1
- package/dist/integrations/x402.d.cts +1 -1
- package/dist/integrations/x402.d.ts +1 -1
- package/dist/{types-zzK9YOoa.d.cts → types-Lp1iHEDz.d.cts} +21 -1
- package/dist/{types-zzK9YOoa.d.ts → types-Lp1iHEDz.d.ts} +21 -1
- package/package.json +31 -1
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { VorimSDK } from '../index.cjs';
|
|
2
|
+
import { P as PermissionScope } from '../types-Lp1iHEDz.cjs';
|
|
3
|
+
|
|
4
|
+
/** The Microsoft Graph (Entra) operations this guard classifies. */
|
|
5
|
+
type EntraOperation = 'createUser' | 'disableUser' | 'createAppRegistration' | 'addAppSecret' | 'grantAppRoleAssignment' | 'assignDirectoryRole' | 'read';
|
|
6
|
+
interface EntraGuardConfig {
|
|
7
|
+
/** The acting agent's Vorim id (agid_...). */
|
|
8
|
+
agentId: string;
|
|
9
|
+
/** The Entra tenant, e.g. 'contoso.onmicrosoft.com' or a tenant GUID.
|
|
10
|
+
* Recorded on every receipt. */
|
|
11
|
+
tenantId: string;
|
|
12
|
+
/** The human admin who approves privileged operations. Required if any
|
|
13
|
+
* escalation-class op will be run. */
|
|
14
|
+
adminId?: string;
|
|
15
|
+
minTrustScore?: number;
|
|
16
|
+
/** For a privileged op, escalate to the named admin and wait. Default true. */
|
|
17
|
+
escalatePrivileged?: boolean;
|
|
18
|
+
escalationTimeoutMs?: number;
|
|
19
|
+
onError?: 'closed' | 'open';
|
|
20
|
+
}
|
|
21
|
+
interface EntraAction {
|
|
22
|
+
operation: EntraOperation | string;
|
|
23
|
+
/** The target the action affects (user id, app/service-principal id).
|
|
24
|
+
* Recorded for attribution. */
|
|
25
|
+
targetId?: string;
|
|
26
|
+
/** For assignDirectoryRole: the role, e.g. 'Global Administrator'. Recorded. */
|
|
27
|
+
role?: string;
|
|
28
|
+
inputHash?: string;
|
|
29
|
+
}
|
|
30
|
+
type EntraOutcome = 'ordinary' | 'approved-by-admin' | 'privileged-denied';
|
|
31
|
+
interface EntraReceipt {
|
|
32
|
+
authorized: boolean;
|
|
33
|
+
agentId: string;
|
|
34
|
+
tenantId: string;
|
|
35
|
+
operation: string;
|
|
36
|
+
targetId?: string;
|
|
37
|
+
role?: string;
|
|
38
|
+
privileged: boolean;
|
|
39
|
+
outcome: EntraOutcome;
|
|
40
|
+
adminId?: string;
|
|
41
|
+
result: 'success' | 'denied' | 'error';
|
|
42
|
+
scope: PermissionScope;
|
|
43
|
+
reason?: string;
|
|
44
|
+
decisionId?: string;
|
|
45
|
+
recorded: boolean;
|
|
46
|
+
}
|
|
47
|
+
declare class VorimEntra {
|
|
48
|
+
private sdk;
|
|
49
|
+
private agentId;
|
|
50
|
+
private tenantId;
|
|
51
|
+
private adminId?;
|
|
52
|
+
private minTrustScore;
|
|
53
|
+
private escalatePrivileged;
|
|
54
|
+
private escalationTimeoutMs;
|
|
55
|
+
private onError;
|
|
56
|
+
constructor(sdk: VorimSDK, config: EntraGuardConfig);
|
|
57
|
+
private isPrivileged;
|
|
58
|
+
private scopeFor;
|
|
59
|
+
authorize(action: EntraAction): Promise<{
|
|
60
|
+
authorized: boolean;
|
|
61
|
+
reason?: string;
|
|
62
|
+
outcome: EntraOutcome;
|
|
63
|
+
adminId?: string;
|
|
64
|
+
decisionId?: string;
|
|
65
|
+
}>;
|
|
66
|
+
private escalate;
|
|
67
|
+
record(action: EntraAction, result: 'success' | 'denied' | 'error', extra?: {
|
|
68
|
+
reason?: string;
|
|
69
|
+
outcome?: EntraOutcome;
|
|
70
|
+
adminId?: string;
|
|
71
|
+
decisionId?: string;
|
|
72
|
+
}): Promise<boolean>;
|
|
73
|
+
guard<T>(action: EntraAction, run: () => Promise<T>): Promise<{
|
|
74
|
+
receipt: EntraReceipt;
|
|
75
|
+
value?: T;
|
|
76
|
+
}>;
|
|
77
|
+
/** Guard creating a user (POST /users). Requires agent:write. */
|
|
78
|
+
guardedCreateUser<T>(meta: {
|
|
79
|
+
targetId?: string;
|
|
80
|
+
inputHash?: string;
|
|
81
|
+
}, run: () => Promise<T>): Promise<{
|
|
82
|
+
receipt: EntraReceipt;
|
|
83
|
+
value?: T | undefined;
|
|
84
|
+
}>;
|
|
85
|
+
/** Guard disabling a user (PATCH /users/{id} accountEnabled:false). agent:write. */
|
|
86
|
+
guardedDisableUser<T>(meta: {
|
|
87
|
+
targetId?: string;
|
|
88
|
+
inputHash?: string;
|
|
89
|
+
}, run: () => Promise<T>): Promise<{
|
|
90
|
+
receipt: EntraReceipt;
|
|
91
|
+
value?: T | undefined;
|
|
92
|
+
}>;
|
|
93
|
+
/** Guard creating an app registration (POST /applications). agent:write. */
|
|
94
|
+
guardedCreateAppRegistration<T>(meta: {
|
|
95
|
+
targetId?: string;
|
|
96
|
+
inputHash?: string;
|
|
97
|
+
}, run: () => Promise<T>): Promise<{
|
|
98
|
+
receipt: EntraReceipt;
|
|
99
|
+
value?: T | undefined;
|
|
100
|
+
}>;
|
|
101
|
+
/** Guard adding a client secret to an app (POST /applications/{id}/addPassword).
|
|
102
|
+
* Mints a long-lived credential; always escalates to the named admin. */
|
|
103
|
+
guardedAddAppSecret<T>(meta: {
|
|
104
|
+
targetId?: string;
|
|
105
|
+
inputHash?: string;
|
|
106
|
+
}, run: () => Promise<T>): Promise<{
|
|
107
|
+
receipt: EntraReceipt;
|
|
108
|
+
value?: T | undefined;
|
|
109
|
+
}>;
|
|
110
|
+
/** Guard granting an app-role assignment. Always escalates to the named admin
|
|
111
|
+
* (an application-permission grant is tenant-wide privilege). */
|
|
112
|
+
guardedGrantAppRoleAssignment<T>(meta: {
|
|
113
|
+
targetId?: string;
|
|
114
|
+
role?: string;
|
|
115
|
+
inputHash?: string;
|
|
116
|
+
}, run: () => Promise<T>): Promise<{
|
|
117
|
+
receipt: EntraReceipt;
|
|
118
|
+
value?: T | undefined;
|
|
119
|
+
}>;
|
|
120
|
+
/** Guard assigning a directory role (POST /roleManagement/directory/roleAssignments).
|
|
121
|
+
* Always escalates to the named admin. Pass the role (e.g. 'Global Administrator'). */
|
|
122
|
+
guardedAssignDirectoryRole<T>(meta: {
|
|
123
|
+
targetId?: string;
|
|
124
|
+
role?: string;
|
|
125
|
+
inputHash?: string;
|
|
126
|
+
}, run: () => Promise<T>): Promise<{
|
|
127
|
+
receipt: EntraReceipt;
|
|
128
|
+
value?: T | undefined;
|
|
129
|
+
}>;
|
|
130
|
+
private receipt;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Create a VorimEntra guard around a Vorim SDK instance.
|
|
134
|
+
*
|
|
135
|
+
* @example
|
|
136
|
+
* ```typescript
|
|
137
|
+
* import createVorim from '@vorim/sdk';
|
|
138
|
+
* import { createVorimEntra } from '@vorim/sdk/integrations/entra';
|
|
139
|
+
*
|
|
140
|
+
* const vorim = createVorim({ apiKey: 'agid_sk_...' });
|
|
141
|
+
* const entra = createVorimEntra(vorim, {
|
|
142
|
+
* agentId: 'agid_abc123',
|
|
143
|
+
* tenantId: 'contoso.onmicrosoft.com',
|
|
144
|
+
* adminId: 'admin_42',
|
|
145
|
+
* });
|
|
146
|
+
*
|
|
147
|
+
* const { receipt } = await entra.guardedAssignDirectoryRole(
|
|
148
|
+
* { targetId: 'user_9', role: 'Global Administrator' },
|
|
149
|
+
* () => graphClient.api('/roleManagement/directory/roleAssignments').post(body),
|
|
150
|
+
* );
|
|
151
|
+
* ```
|
|
152
|
+
*/
|
|
153
|
+
declare function createVorimEntra(sdk: VorimSDK, config: EntraGuardConfig): VorimEntra;
|
|
154
|
+
|
|
155
|
+
export { type EntraAction, type EntraGuardConfig, type EntraOperation, type EntraOutcome, type EntraReceipt, VorimEntra, createVorimEntra };
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { VorimSDK } from '../index.js';
|
|
2
|
+
import { P as PermissionScope } from '../types-Lp1iHEDz.js';
|
|
3
|
+
|
|
4
|
+
/** The Microsoft Graph (Entra) operations this guard classifies. */
|
|
5
|
+
type EntraOperation = 'createUser' | 'disableUser' | 'createAppRegistration' | 'addAppSecret' | 'grantAppRoleAssignment' | 'assignDirectoryRole' | 'read';
|
|
6
|
+
interface EntraGuardConfig {
|
|
7
|
+
/** The acting agent's Vorim id (agid_...). */
|
|
8
|
+
agentId: string;
|
|
9
|
+
/** The Entra tenant, e.g. 'contoso.onmicrosoft.com' or a tenant GUID.
|
|
10
|
+
* Recorded on every receipt. */
|
|
11
|
+
tenantId: string;
|
|
12
|
+
/** The human admin who approves privileged operations. Required if any
|
|
13
|
+
* escalation-class op will be run. */
|
|
14
|
+
adminId?: string;
|
|
15
|
+
minTrustScore?: number;
|
|
16
|
+
/** For a privileged op, escalate to the named admin and wait. Default true. */
|
|
17
|
+
escalatePrivileged?: boolean;
|
|
18
|
+
escalationTimeoutMs?: number;
|
|
19
|
+
onError?: 'closed' | 'open';
|
|
20
|
+
}
|
|
21
|
+
interface EntraAction {
|
|
22
|
+
operation: EntraOperation | string;
|
|
23
|
+
/** The target the action affects (user id, app/service-principal id).
|
|
24
|
+
* Recorded for attribution. */
|
|
25
|
+
targetId?: string;
|
|
26
|
+
/** For assignDirectoryRole: the role, e.g. 'Global Administrator'. Recorded. */
|
|
27
|
+
role?: string;
|
|
28
|
+
inputHash?: string;
|
|
29
|
+
}
|
|
30
|
+
type EntraOutcome = 'ordinary' | 'approved-by-admin' | 'privileged-denied';
|
|
31
|
+
interface EntraReceipt {
|
|
32
|
+
authorized: boolean;
|
|
33
|
+
agentId: string;
|
|
34
|
+
tenantId: string;
|
|
35
|
+
operation: string;
|
|
36
|
+
targetId?: string;
|
|
37
|
+
role?: string;
|
|
38
|
+
privileged: boolean;
|
|
39
|
+
outcome: EntraOutcome;
|
|
40
|
+
adminId?: string;
|
|
41
|
+
result: 'success' | 'denied' | 'error';
|
|
42
|
+
scope: PermissionScope;
|
|
43
|
+
reason?: string;
|
|
44
|
+
decisionId?: string;
|
|
45
|
+
recorded: boolean;
|
|
46
|
+
}
|
|
47
|
+
declare class VorimEntra {
|
|
48
|
+
private sdk;
|
|
49
|
+
private agentId;
|
|
50
|
+
private tenantId;
|
|
51
|
+
private adminId?;
|
|
52
|
+
private minTrustScore;
|
|
53
|
+
private escalatePrivileged;
|
|
54
|
+
private escalationTimeoutMs;
|
|
55
|
+
private onError;
|
|
56
|
+
constructor(sdk: VorimSDK, config: EntraGuardConfig);
|
|
57
|
+
private isPrivileged;
|
|
58
|
+
private scopeFor;
|
|
59
|
+
authorize(action: EntraAction): Promise<{
|
|
60
|
+
authorized: boolean;
|
|
61
|
+
reason?: string;
|
|
62
|
+
outcome: EntraOutcome;
|
|
63
|
+
adminId?: string;
|
|
64
|
+
decisionId?: string;
|
|
65
|
+
}>;
|
|
66
|
+
private escalate;
|
|
67
|
+
record(action: EntraAction, result: 'success' | 'denied' | 'error', extra?: {
|
|
68
|
+
reason?: string;
|
|
69
|
+
outcome?: EntraOutcome;
|
|
70
|
+
adminId?: string;
|
|
71
|
+
decisionId?: string;
|
|
72
|
+
}): Promise<boolean>;
|
|
73
|
+
guard<T>(action: EntraAction, run: () => Promise<T>): Promise<{
|
|
74
|
+
receipt: EntraReceipt;
|
|
75
|
+
value?: T;
|
|
76
|
+
}>;
|
|
77
|
+
/** Guard creating a user (POST /users). Requires agent:write. */
|
|
78
|
+
guardedCreateUser<T>(meta: {
|
|
79
|
+
targetId?: string;
|
|
80
|
+
inputHash?: string;
|
|
81
|
+
}, run: () => Promise<T>): Promise<{
|
|
82
|
+
receipt: EntraReceipt;
|
|
83
|
+
value?: T | undefined;
|
|
84
|
+
}>;
|
|
85
|
+
/** Guard disabling a user (PATCH /users/{id} accountEnabled:false). agent:write. */
|
|
86
|
+
guardedDisableUser<T>(meta: {
|
|
87
|
+
targetId?: string;
|
|
88
|
+
inputHash?: string;
|
|
89
|
+
}, run: () => Promise<T>): Promise<{
|
|
90
|
+
receipt: EntraReceipt;
|
|
91
|
+
value?: T | undefined;
|
|
92
|
+
}>;
|
|
93
|
+
/** Guard creating an app registration (POST /applications). agent:write. */
|
|
94
|
+
guardedCreateAppRegistration<T>(meta: {
|
|
95
|
+
targetId?: string;
|
|
96
|
+
inputHash?: string;
|
|
97
|
+
}, run: () => Promise<T>): Promise<{
|
|
98
|
+
receipt: EntraReceipt;
|
|
99
|
+
value?: T | undefined;
|
|
100
|
+
}>;
|
|
101
|
+
/** Guard adding a client secret to an app (POST /applications/{id}/addPassword).
|
|
102
|
+
* Mints a long-lived credential; always escalates to the named admin. */
|
|
103
|
+
guardedAddAppSecret<T>(meta: {
|
|
104
|
+
targetId?: string;
|
|
105
|
+
inputHash?: string;
|
|
106
|
+
}, run: () => Promise<T>): Promise<{
|
|
107
|
+
receipt: EntraReceipt;
|
|
108
|
+
value?: T | undefined;
|
|
109
|
+
}>;
|
|
110
|
+
/** Guard granting an app-role assignment. Always escalates to the named admin
|
|
111
|
+
* (an application-permission grant is tenant-wide privilege). */
|
|
112
|
+
guardedGrantAppRoleAssignment<T>(meta: {
|
|
113
|
+
targetId?: string;
|
|
114
|
+
role?: string;
|
|
115
|
+
inputHash?: string;
|
|
116
|
+
}, run: () => Promise<T>): Promise<{
|
|
117
|
+
receipt: EntraReceipt;
|
|
118
|
+
value?: T | undefined;
|
|
119
|
+
}>;
|
|
120
|
+
/** Guard assigning a directory role (POST /roleManagement/directory/roleAssignments).
|
|
121
|
+
* Always escalates to the named admin. Pass the role (e.g. 'Global Administrator'). */
|
|
122
|
+
guardedAssignDirectoryRole<T>(meta: {
|
|
123
|
+
targetId?: string;
|
|
124
|
+
role?: string;
|
|
125
|
+
inputHash?: string;
|
|
126
|
+
}, run: () => Promise<T>): Promise<{
|
|
127
|
+
receipt: EntraReceipt;
|
|
128
|
+
value?: T | undefined;
|
|
129
|
+
}>;
|
|
130
|
+
private receipt;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Create a VorimEntra guard around a Vorim SDK instance.
|
|
134
|
+
*
|
|
135
|
+
* @example
|
|
136
|
+
* ```typescript
|
|
137
|
+
* import createVorim from '@vorim/sdk';
|
|
138
|
+
* import { createVorimEntra } from '@vorim/sdk/integrations/entra';
|
|
139
|
+
*
|
|
140
|
+
* const vorim = createVorim({ apiKey: 'agid_sk_...' });
|
|
141
|
+
* const entra = createVorimEntra(vorim, {
|
|
142
|
+
* agentId: 'agid_abc123',
|
|
143
|
+
* tenantId: 'contoso.onmicrosoft.com',
|
|
144
|
+
* adminId: 'admin_42',
|
|
145
|
+
* });
|
|
146
|
+
*
|
|
147
|
+
* const { receipt } = await entra.guardedAssignDirectoryRole(
|
|
148
|
+
* { targetId: 'user_9', role: 'Global Administrator' },
|
|
149
|
+
* () => graphClient.api('/roleManagement/directory/roleAssignments').post(body),
|
|
150
|
+
* );
|
|
151
|
+
* ```
|
|
152
|
+
*/
|
|
153
|
+
declare function createVorimEntra(sdk: VorimSDK, config: EntraGuardConfig): VorimEntra;
|
|
154
|
+
|
|
155
|
+
export { type EntraAction, type EntraGuardConfig, type EntraOperation, type EntraOutcome, type EntraReceipt, VorimEntra, createVorimEntra };
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
// src/integrations/entra.ts
|
|
2
|
+
var ESCALATION_OPS = /* @__PURE__ */ new Set(["assignDirectoryRole", "addAppSecret", "grantAppRoleAssignment"]);
|
|
3
|
+
var OPERATION_SCOPE = {
|
|
4
|
+
read: "agent:read",
|
|
5
|
+
createUser: "agent:write",
|
|
6
|
+
disableUser: "agent:write",
|
|
7
|
+
createAppRegistration: "agent:write",
|
|
8
|
+
addAppSecret: "agent:elevate",
|
|
9
|
+
grantAppRoleAssignment: "agent:elevate",
|
|
10
|
+
assignDirectoryRole: "agent:elevate"
|
|
11
|
+
};
|
|
12
|
+
var VorimEntra = class {
|
|
13
|
+
sdk;
|
|
14
|
+
agentId;
|
|
15
|
+
tenantId;
|
|
16
|
+
adminId;
|
|
17
|
+
minTrustScore;
|
|
18
|
+
escalatePrivileged;
|
|
19
|
+
escalationTimeoutMs;
|
|
20
|
+
onError;
|
|
21
|
+
constructor(sdk, config) {
|
|
22
|
+
if (!config?.agentId) throw new Error("[vorim] Entra integration requires an agentId.");
|
|
23
|
+
if (!config?.tenantId) throw new Error("[vorim] Entra integration requires a tenantId.");
|
|
24
|
+
this.sdk = sdk;
|
|
25
|
+
this.agentId = config.agentId;
|
|
26
|
+
this.tenantId = config.tenantId;
|
|
27
|
+
this.adminId = config.adminId;
|
|
28
|
+
this.minTrustScore = config.minTrustScore ?? 0;
|
|
29
|
+
this.escalatePrivileged = config.escalatePrivileged ?? true;
|
|
30
|
+
this.escalationTimeoutMs = config.escalationTimeoutMs ?? 3e5;
|
|
31
|
+
this.onError = config.onError ?? "closed";
|
|
32
|
+
}
|
|
33
|
+
isPrivileged(operation) {
|
|
34
|
+
return ESCALATION_OPS.has(operation);
|
|
35
|
+
}
|
|
36
|
+
scopeFor(operation) {
|
|
37
|
+
return OPERATION_SCOPE[operation] ?? "agent:write";
|
|
38
|
+
}
|
|
39
|
+
async authorize(action) {
|
|
40
|
+
const privileged = this.isPrivileged(action.operation);
|
|
41
|
+
const scope = this.scopeFor(action.operation);
|
|
42
|
+
try {
|
|
43
|
+
if (this.minTrustScore > 0) {
|
|
44
|
+
const trust = await this.sdk.verify(this.agentId);
|
|
45
|
+
if ((trust?.trust_score ?? 0) < this.minTrustScore) {
|
|
46
|
+
return { authorized: false, reason: `trust score below ${this.minTrustScore}`, outcome: privileged ? "privileged-denied" : "ordinary" };
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
if (privileged) {
|
|
50
|
+
if (!this.escalatePrivileged) {
|
|
51
|
+
return { authorized: false, reason: `${action.operation} requires a human admin and escalatePrivileged is off`, outcome: "privileged-denied" };
|
|
52
|
+
}
|
|
53
|
+
if (!this.adminId) {
|
|
54
|
+
return {
|
|
55
|
+
authorized: false,
|
|
56
|
+
reason: `${action.operation} requires a configured adminId (the approving human admin)`,
|
|
57
|
+
outcome: "privileged-denied"
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
const esc = await this.escalate(action, scope);
|
|
61
|
+
return {
|
|
62
|
+
authorized: esc.approved,
|
|
63
|
+
reason: esc.approved ? void 0 : esc.reason ?? "admin did not approve",
|
|
64
|
+
outcome: esc.approved ? "approved-by-admin" : "privileged-denied",
|
|
65
|
+
adminId: esc.approved ? this.adminId : void 0,
|
|
66
|
+
decisionId: esc.decisionId
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
const perm = await this.sdk.check(this.agentId, scope);
|
|
70
|
+
return perm.allowed ? { authorized: true, outcome: "ordinary", adminId: this.adminId } : { authorized: false, reason: perm.reason ?? `missing scope ${scope}`, outcome: "ordinary" };
|
|
71
|
+
} catch (e) {
|
|
72
|
+
return this.onError === "open" ? { authorized: true, reason: "vorim unreachable, failed open", outcome: privileged ? "approved-by-admin" : "ordinary" } : { authorized: false, reason: `vorim unreachable: ${e?.message ?? "error"}`, outcome: privileged ? "privileged-denied" : "ordinary" };
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
async escalate(action, scope) {
|
|
76
|
+
const decision = await this.sdk.beforeAction(
|
|
77
|
+
{
|
|
78
|
+
agentId: this.agentId,
|
|
79
|
+
actionType: "api_request",
|
|
80
|
+
actionTarget: `entra:${action.operation}`,
|
|
81
|
+
requiredScope: scope,
|
|
82
|
+
payload: { operation: action.operation, target_id: action.targetId, role: action.role },
|
|
83
|
+
context: { integration: "entra", tenant_id: this.tenantId, requires_human_admin: true, admin_hint: this.adminId }
|
|
84
|
+
},
|
|
85
|
+
{ throwOnDeny: false }
|
|
86
|
+
);
|
|
87
|
+
if (decision.decision === "escalate") {
|
|
88
|
+
const resolved = await this.sdk.waitForDecisionResolution(decision.decisionId, { timeoutMs: this.escalationTimeoutMs });
|
|
89
|
+
const approved = resolved.decision === "allow" || resolved.escalationResolution === "approved";
|
|
90
|
+
return { approved, reason: approved ? void 0 : "admin refused", decisionId: decision.decisionId };
|
|
91
|
+
}
|
|
92
|
+
if (decision.decision === "allow") return { approved: true, decisionId: decision.decisionId };
|
|
93
|
+
if (decision.decision === "fallback")
|
|
94
|
+
return { approved: this.onError === "open", reason: "runtime unreachable", decisionId: decision.decisionId };
|
|
95
|
+
return { approved: false, reason: decision.reason ?? "denied", decisionId: decision.decisionId };
|
|
96
|
+
}
|
|
97
|
+
async record(action, result, extra = {}) {
|
|
98
|
+
const scope = this.scopeFor(action.operation);
|
|
99
|
+
try {
|
|
100
|
+
await this.sdk.emit(
|
|
101
|
+
{
|
|
102
|
+
agent_id: this.agentId,
|
|
103
|
+
event_type: "api_request",
|
|
104
|
+
action: `entra:${action.operation}${action.targetId ? " " + action.targetId : ""}`,
|
|
105
|
+
resource: action.targetId || this.tenantId,
|
|
106
|
+
permission: scope,
|
|
107
|
+
result,
|
|
108
|
+
input_hash: action.inputHash,
|
|
109
|
+
metadata: {
|
|
110
|
+
integration: "entra",
|
|
111
|
+
tenant_id: this.tenantId,
|
|
112
|
+
operation: action.operation,
|
|
113
|
+
privileged: this.isPrivileged(action.operation),
|
|
114
|
+
...action.role ? { role: action.role } : {},
|
|
115
|
+
...extra.outcome ? { outcome: extra.outcome } : {},
|
|
116
|
+
...extra.adminId ?? this.adminId ? { approved_by_admin: extra.adminId ?? this.adminId } : {},
|
|
117
|
+
...extra.decisionId ? { decision_id: extra.decisionId } : {},
|
|
118
|
+
...extra.reason ? { reason: extra.reason } : {}
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
{ sign: true }
|
|
122
|
+
);
|
|
123
|
+
return true;
|
|
124
|
+
} catch {
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
async guard(action, run) {
|
|
129
|
+
const auth = await this.authorize(action);
|
|
130
|
+
if (!auth.authorized) {
|
|
131
|
+
const recorded = await this.record(action, "denied", { reason: auth.reason, outcome: auth.outcome, adminId: auth.adminId, decisionId: auth.decisionId });
|
|
132
|
+
return { receipt: this.receipt(action, false, "denied", auth, recorded) };
|
|
133
|
+
}
|
|
134
|
+
try {
|
|
135
|
+
const value = await run();
|
|
136
|
+
const recorded = await this.record(action, "success", { outcome: auth.outcome, adminId: auth.adminId, decisionId: auth.decisionId });
|
|
137
|
+
return { receipt: this.receipt(action, true, "success", auth, recorded), value };
|
|
138
|
+
} catch (e) {
|
|
139
|
+
const recorded = await this.record(action, "error", { reason: e?.message, outcome: auth.outcome, adminId: auth.adminId, decisionId: auth.decisionId });
|
|
140
|
+
throw Object.assign(e ?? new Error("entra operation failed"), {
|
|
141
|
+
vorimReceipt: this.receipt(action, true, "error", { ...auth, reason: e?.message }, recorded)
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
// --- Named helpers ---------------------------------------------------------
|
|
146
|
+
/** Guard creating a user (POST /users). Requires agent:write. */
|
|
147
|
+
guardedCreateUser(meta, run) {
|
|
148
|
+
return this.guard({ operation: "createUser", targetId: meta.targetId, inputHash: meta.inputHash }, run);
|
|
149
|
+
}
|
|
150
|
+
/** Guard disabling a user (PATCH /users/{id} accountEnabled:false). agent:write. */
|
|
151
|
+
guardedDisableUser(meta, run) {
|
|
152
|
+
return this.guard({ operation: "disableUser", targetId: meta.targetId, inputHash: meta.inputHash }, run);
|
|
153
|
+
}
|
|
154
|
+
/** Guard creating an app registration (POST /applications). agent:write. */
|
|
155
|
+
guardedCreateAppRegistration(meta, run) {
|
|
156
|
+
return this.guard({ operation: "createAppRegistration", targetId: meta.targetId, inputHash: meta.inputHash }, run);
|
|
157
|
+
}
|
|
158
|
+
/** Guard adding a client secret to an app (POST /applications/{id}/addPassword).
|
|
159
|
+
* Mints a long-lived credential; always escalates to the named admin. */
|
|
160
|
+
guardedAddAppSecret(meta, run) {
|
|
161
|
+
return this.guard({ operation: "addAppSecret", targetId: meta.targetId, inputHash: meta.inputHash }, run);
|
|
162
|
+
}
|
|
163
|
+
/** Guard granting an app-role assignment. Always escalates to the named admin
|
|
164
|
+
* (an application-permission grant is tenant-wide privilege). */
|
|
165
|
+
guardedGrantAppRoleAssignment(meta, run) {
|
|
166
|
+
return this.guard({ operation: "grantAppRoleAssignment", targetId: meta.targetId, role: meta.role, inputHash: meta.inputHash }, run);
|
|
167
|
+
}
|
|
168
|
+
/** Guard assigning a directory role (POST /roleManagement/directory/roleAssignments).
|
|
169
|
+
* Always escalates to the named admin. Pass the role (e.g. 'Global Administrator'). */
|
|
170
|
+
guardedAssignDirectoryRole(meta, run) {
|
|
171
|
+
return this.guard({ operation: "assignDirectoryRole", targetId: meta.targetId, role: meta.role, inputHash: meta.inputHash }, run);
|
|
172
|
+
}
|
|
173
|
+
receipt(action, authorized, result, auth, recorded) {
|
|
174
|
+
return {
|
|
175
|
+
authorized,
|
|
176
|
+
agentId: this.agentId,
|
|
177
|
+
tenantId: this.tenantId,
|
|
178
|
+
operation: action.operation,
|
|
179
|
+
targetId: action.targetId,
|
|
180
|
+
role: action.role,
|
|
181
|
+
privileged: this.isPrivileged(action.operation),
|
|
182
|
+
outcome: auth.outcome ?? "ordinary",
|
|
183
|
+
adminId: auth.adminId ?? this.adminId,
|
|
184
|
+
result,
|
|
185
|
+
scope: this.scopeFor(action.operation),
|
|
186
|
+
reason: auth.reason,
|
|
187
|
+
decisionId: auth.decisionId,
|
|
188
|
+
recorded
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
function createVorimEntra(sdk, config) {
|
|
193
|
+
return new VorimEntra(sdk, config);
|
|
194
|
+
}
|
|
195
|
+
export {
|
|
196
|
+
VorimEntra,
|
|
197
|
+
createVorimEntra
|
|
198
|
+
};
|
|
199
|
+
//# sourceMappingURL=entra.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/integrations/entra.ts"],"sourcesContent":["// ============================================================================\n// Vorim AI — Microsoft Entra ID (Microsoft Graph) Integration\n//\n// This guards an AI agent that administers Microsoft Entra ID through the\n// Microsoft Graph v1.0 API — creating users, registering apps, assigning app\n// roles, minting app credentials, assigning directory roles. Before each write\n// runs it verifies the agent's Vorim identity and scoped permission, and for the\n// highest-stakes operations (assigning a directory role, adding an app secret,\n// granting a tenant-wide app-role assignment) it escalates to a named human\n// admin and waits. Either way it signs a tamper-evident record.\n//\n// GRAPH v1.0 ONLY — HONEST SCOPE\n// This connector guards the STABLE, GA Microsoft Graph v1.0 admin writes. It is\n// NOT an integration with \"Entra Agent ID\": that product's identity-create API\n// is Microsoft Graph /beta, which Microsoft states is \"not supported in\n// production.\" We do not imply otherwise. When the Agent ID API reaches v1.0\n// GA, a second connector can guard it.\n//\n// THE ESCALATION RULE (the wedge)\n// Three operations grant standing, tenant-wide authority or mint a long-lived\n// credential and must always route to a named human admin: assigning a directory\n// role (e.g. Global Administrator), adding a client secret to an app (the\n// secretText is returned once and never retrievable again), and granting an\n// app-role assignment that is an application permission. An agent may propose\n// these; a human authorizes them.\n//\n// SCOPE MAPPING (uses Vorim's real scopes)\n// read directory -> agent:read\n// create/disable user, register app -> agent:write\n// assign directory role / add app -> agent:elevate (named-admin approval)\n// secret / grant app-role\n//\n// HONEST COMPLIANCE FRAMING\n// A signed, attributable record of each directory change supports SOC 2 (CC6\n// logical access, CC7 change monitoring). No regime mandates cryptographic\n// signatures on audit logs; signing satisfies the tamper-evident + attributable\n// intent. Say \"cryptographic proof of which agent made which change\", never\n// \"required for compliance\".\n//\n// This layer never holds the Graph app credential and never calls Graph itself.\n// You pass the Graph SDK call as a closure; it authorizes, escalates if needed,\n// runs it, and signs the receipt.\n//\n// Usage:\n// import createVorim from '@vorim/sdk';\n// import { createVorimEntra } from '@vorim/sdk/integrations/entra';\n//\n// const vorim = createVorim({ apiKey: 'agid_sk_...' });\n// const entra = createVorimEntra(vorim, {\n// agentId: 'agid_abc123',\n// tenantId: 'contoso.onmicrosoft.com',\n// adminId: 'admin_42',\n// });\n//\n// const { receipt, value } = await entra.guardedAssignDirectoryRole(\n// { targetId: 'user_9', role: 'Global Administrator' },\n// () => graphClient.api('/roleManagement/directory/roleAssignments').post(body),\n// );\n// ============================================================================\n\nimport type { VorimSDK } from '../index.js';\nimport type { PermissionScope } from '../types.js';\n\n/** The Microsoft Graph (Entra) operations this guard classifies. */\nexport type EntraOperation =\n | 'createUser' // POST /users\n | 'disableUser' // PATCH /users/{id} accountEnabled:false\n | 'createAppRegistration' // POST /applications\n | 'addAppSecret' // POST /applications/{id}/addPassword\n | 'grantAppRoleAssignment' // POST /servicePrincipals/{id}/appRoleAssignedTo\n | 'assignDirectoryRole' // POST /roleManagement/directory/roleAssignments\n | 'read';\n\n/** Operations that grant standing tenant-wide authority or mint a long-lived\n * credential — always escalate to a named human admin. */\nconst ESCALATION_OPS = new Set<string>(['assignDirectoryRole', 'addAppSecret', 'grantAppRoleAssignment']);\n\nconst OPERATION_SCOPE: Record<string, PermissionScope> = {\n read: 'agent:read',\n createUser: 'agent:write',\n disableUser: 'agent:write',\n createAppRegistration: 'agent:write',\n addAppSecret: 'agent:elevate',\n grantAppRoleAssignment: 'agent:elevate',\n assignDirectoryRole: 'agent:elevate',\n};\n\nexport interface EntraGuardConfig {\n /** The acting agent's Vorim id (agid_...). */\n agentId: string;\n /** The Entra tenant, e.g. 'contoso.onmicrosoft.com' or a tenant GUID.\n * Recorded on every receipt. */\n tenantId: string;\n /** The human admin who approves privileged operations. Required if any\n * escalation-class op will be run. */\n adminId?: string;\n minTrustScore?: number;\n /** For a privileged op, escalate to the named admin and wait. Default true. */\n escalatePrivileged?: boolean;\n escalationTimeoutMs?: number;\n onError?: 'closed' | 'open';\n}\n\nexport interface EntraAction {\n operation: EntraOperation | string;\n /** The target the action affects (user id, app/service-principal id).\n * Recorded for attribution. */\n targetId?: string;\n /** For assignDirectoryRole: the role, e.g. 'Global Administrator'. Recorded. */\n role?: string;\n inputHash?: string;\n}\n\nexport type EntraOutcome = 'ordinary' | 'approved-by-admin' | 'privileged-denied';\n\nexport interface EntraReceipt {\n authorized: boolean;\n agentId: string;\n tenantId: string;\n operation: string;\n targetId?: string;\n role?: string;\n privileged: boolean;\n outcome: EntraOutcome;\n adminId?: string;\n result: 'success' | 'denied' | 'error';\n scope: PermissionScope;\n reason?: string;\n decisionId?: string;\n recorded: boolean;\n}\n\nexport class VorimEntra {\n private sdk: VorimSDK;\n private agentId: string;\n private tenantId: string;\n private adminId?: string;\n private minTrustScore: number;\n private escalatePrivileged: boolean;\n private escalationTimeoutMs: number;\n private onError: 'closed' | 'open';\n\n constructor(sdk: VorimSDK, config: EntraGuardConfig) {\n if (!config?.agentId) throw new Error('[vorim] Entra integration requires an agentId.');\n if (!config?.tenantId) throw new Error('[vorim] Entra integration requires a tenantId.');\n this.sdk = sdk;\n this.agentId = config.agentId;\n this.tenantId = config.tenantId;\n this.adminId = config.adminId;\n this.minTrustScore = config.minTrustScore ?? 0;\n this.escalatePrivileged = config.escalatePrivileged ?? true;\n this.escalationTimeoutMs = config.escalationTimeoutMs ?? 300_000;\n this.onError = config.onError ?? 'closed';\n }\n\n private isPrivileged(operation: string): boolean {\n return ESCALATION_OPS.has(operation);\n }\n\n private scopeFor(operation: string): PermissionScope {\n return OPERATION_SCOPE[operation] ?? 'agent:write';\n }\n\n async authorize(\n action: EntraAction,\n ): Promise<{ authorized: boolean; reason?: string; outcome: EntraOutcome; adminId?: string; decisionId?: string }> {\n const privileged = this.isPrivileged(action.operation);\n const scope = this.scopeFor(action.operation);\n\n try {\n if (this.minTrustScore > 0) {\n const trust = await this.sdk.verify(this.agentId);\n if ((trust?.trust_score ?? 0) < this.minTrustScore) {\n return { authorized: false, reason: `trust score below ${this.minTrustScore}`, outcome: privileged ? 'privileged-denied' : 'ordinary' };\n }\n }\n\n if (privileged) {\n if (!this.escalatePrivileged) {\n return { authorized: false, reason: `${action.operation} requires a human admin and escalatePrivileged is off`, outcome: 'privileged-denied' };\n }\n if (!this.adminId) {\n return {\n authorized: false,\n reason: `${action.operation} requires a configured adminId (the approving human admin)`,\n outcome: 'privileged-denied',\n };\n }\n const esc = await this.escalate(action, scope);\n return {\n authorized: esc.approved,\n reason: esc.approved ? undefined : (esc.reason ?? 'admin did not approve'),\n outcome: esc.approved ? 'approved-by-admin' : 'privileged-denied',\n adminId: esc.approved ? this.adminId : undefined,\n decisionId: esc.decisionId,\n };\n }\n\n const perm = await this.sdk.check(this.agentId, scope);\n return perm.allowed\n ? { authorized: true, outcome: 'ordinary', adminId: this.adminId }\n : { authorized: false, reason: perm.reason ?? `missing scope ${scope}`, outcome: 'ordinary' };\n } catch (e: any) {\n return this.onError === 'open'\n ? { authorized: true, reason: 'vorim unreachable, failed open', outcome: privileged ? 'approved-by-admin' : 'ordinary' }\n : { authorized: false, reason: `vorim unreachable: ${e?.message ?? 'error'}`, outcome: privileged ? 'privileged-denied' : 'ordinary' };\n }\n }\n\n private async escalate(action: EntraAction, scope: PermissionScope): Promise<{ approved: boolean; reason?: string; decisionId?: string }> {\n const decision = await this.sdk.beforeAction(\n {\n agentId: this.agentId,\n actionType: 'api_request',\n actionTarget: `entra:${action.operation}`,\n requiredScope: scope,\n payload: { operation: action.operation, target_id: action.targetId, role: action.role },\n context: { integration: 'entra', tenant_id: this.tenantId, requires_human_admin: true, admin_hint: this.adminId },\n },\n { throwOnDeny: false },\n );\n if (decision.decision === 'escalate') {\n const resolved = await this.sdk.waitForDecisionResolution(decision.decisionId, { timeoutMs: this.escalationTimeoutMs });\n const approved = resolved.decision === 'allow' || resolved.escalationResolution === 'approved';\n return { approved, reason: approved ? undefined : 'admin refused', decisionId: decision.decisionId };\n }\n if (decision.decision === 'allow') return { approved: true, decisionId: decision.decisionId };\n if (decision.decision === 'fallback')\n return { approved: this.onError === 'open', reason: 'runtime unreachable', decisionId: decision.decisionId };\n return { approved: false, reason: decision.reason ?? 'denied', decisionId: decision.decisionId };\n }\n\n async record(\n action: EntraAction,\n result: 'success' | 'denied' | 'error',\n extra: { reason?: string; outcome?: EntraOutcome; adminId?: string; decisionId?: string } = {},\n ): Promise<boolean> {\n const scope = this.scopeFor(action.operation);\n try {\n await this.sdk.emit(\n {\n agent_id: this.agentId,\n event_type: 'api_request',\n action: `entra:${action.operation}${action.targetId ? ' ' + action.targetId : ''}`,\n resource: action.targetId || this.tenantId,\n permission: scope,\n result,\n input_hash: action.inputHash,\n metadata: {\n integration: 'entra',\n tenant_id: this.tenantId,\n operation: action.operation,\n privileged: this.isPrivileged(action.operation),\n ...(action.role ? { role: action.role } : {}),\n ...(extra.outcome ? { outcome: extra.outcome } : {}),\n ...(extra.adminId ?? this.adminId ? { approved_by_admin: extra.adminId ?? this.adminId } : {}),\n ...(extra.decisionId ? { decision_id: extra.decisionId } : {}),\n ...(extra.reason ? { reason: extra.reason } : {}),\n },\n },\n { sign: true },\n );\n return true;\n } catch {\n return false;\n }\n }\n\n async guard<T>(action: EntraAction, run: () => Promise<T>): Promise<{ receipt: EntraReceipt; value?: T }> {\n const auth = await this.authorize(action);\n if (!auth.authorized) {\n const recorded = await this.record(action, 'denied', { reason: auth.reason, outcome: auth.outcome, adminId: auth.adminId, decisionId: auth.decisionId });\n return { receipt: this.receipt(action, false, 'denied', auth, recorded) };\n }\n try {\n const value = await run();\n const recorded = await this.record(action, 'success', { outcome: auth.outcome, adminId: auth.adminId, decisionId: auth.decisionId });\n return { receipt: this.receipt(action, true, 'success', auth, recorded), value };\n } catch (e: any) {\n const recorded = await this.record(action, 'error', { reason: e?.message, outcome: auth.outcome, adminId: auth.adminId, decisionId: auth.decisionId });\n throw Object.assign(e ?? new Error('entra operation failed'), {\n vorimReceipt: this.receipt(action, true, 'error', { ...auth, reason: e?.message }, recorded),\n });\n }\n }\n\n // --- Named helpers ---------------------------------------------------------\n\n /** Guard creating a user (POST /users). Requires agent:write. */\n guardedCreateUser<T>(meta: { targetId?: string; inputHash?: string }, run: () => Promise<T>) {\n return this.guard({ operation: 'createUser', targetId: meta.targetId, inputHash: meta.inputHash }, run);\n }\n\n /** Guard disabling a user (PATCH /users/{id} accountEnabled:false). agent:write. */\n guardedDisableUser<T>(meta: { targetId?: string; inputHash?: string }, run: () => Promise<T>) {\n return this.guard({ operation: 'disableUser', targetId: meta.targetId, inputHash: meta.inputHash }, run);\n }\n\n /** Guard creating an app registration (POST /applications). agent:write. */\n guardedCreateAppRegistration<T>(meta: { targetId?: string; inputHash?: string }, run: () => Promise<T>) {\n return this.guard({ operation: 'createAppRegistration', targetId: meta.targetId, inputHash: meta.inputHash }, run);\n }\n\n /** Guard adding a client secret to an app (POST /applications/{id}/addPassword).\n * Mints a long-lived credential; always escalates to the named admin. */\n guardedAddAppSecret<T>(meta: { targetId?: string; inputHash?: string }, run: () => Promise<T>) {\n return this.guard({ operation: 'addAppSecret', targetId: meta.targetId, inputHash: meta.inputHash }, run);\n }\n\n /** Guard granting an app-role assignment. Always escalates to the named admin\n * (an application-permission grant is tenant-wide privilege). */\n guardedGrantAppRoleAssignment<T>(meta: { targetId?: string; role?: string; inputHash?: string }, run: () => Promise<T>) {\n return this.guard({ operation: 'grantAppRoleAssignment', targetId: meta.targetId, role: meta.role, inputHash: meta.inputHash }, run);\n }\n\n /** Guard assigning a directory role (POST /roleManagement/directory/roleAssignments).\n * Always escalates to the named admin. Pass the role (e.g. 'Global Administrator'). */\n guardedAssignDirectoryRole<T>(meta: { targetId?: string; role?: string; inputHash?: string }, run: () => Promise<T>) {\n return this.guard({ operation: 'assignDirectoryRole', targetId: meta.targetId, role: meta.role, inputHash: meta.inputHash }, run);\n }\n\n private receipt(\n action: EntraAction,\n authorized: boolean,\n result: 'success' | 'denied' | 'error',\n auth: { reason?: string; outcome?: EntraOutcome; adminId?: string; decisionId?: string },\n recorded: boolean,\n ): EntraReceipt {\n return {\n authorized,\n agentId: this.agentId,\n tenantId: this.tenantId,\n operation: action.operation,\n targetId: action.targetId,\n role: action.role,\n privileged: this.isPrivileged(action.operation),\n outcome: auth.outcome ?? 'ordinary',\n adminId: auth.adminId ?? this.adminId,\n result,\n scope: this.scopeFor(action.operation),\n reason: auth.reason,\n decisionId: auth.decisionId,\n recorded,\n };\n }\n}\n\n/**\n * Create a VorimEntra guard around a Vorim SDK instance.\n *\n * @example\n * ```typescript\n * import createVorim from '@vorim/sdk';\n * import { createVorimEntra } from '@vorim/sdk/integrations/entra';\n *\n * const vorim = createVorim({ apiKey: 'agid_sk_...' });\n * const entra = createVorimEntra(vorim, {\n * agentId: 'agid_abc123',\n * tenantId: 'contoso.onmicrosoft.com',\n * adminId: 'admin_42',\n * });\n *\n * const { receipt } = await entra.guardedAssignDirectoryRole(\n * { targetId: 'user_9', role: 'Global Administrator' },\n * () => graphClient.api('/roleManagement/directory/roleAssignments').post(body),\n * );\n * ```\n */\nexport function createVorimEntra(sdk: VorimSDK, config: EntraGuardConfig): VorimEntra {\n return new VorimEntra(sdk, config);\n}\n"],"mappings":";AA2EA,IAAM,iBAAiB,oBAAI,IAAY,CAAC,uBAAuB,gBAAgB,wBAAwB,CAAC;AAExG,IAAM,kBAAmD;AAAA,EACvD,MAAM;AAAA,EACN,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,uBAAuB;AAAA,EACvB,cAAc;AAAA,EACd,wBAAwB;AAAA,EACxB,qBAAqB;AACvB;AA+CO,IAAM,aAAN,MAAiB;AAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAER,YAAY,KAAe,QAA0B;AACnD,QAAI,CAAC,QAAQ,QAAS,OAAM,IAAI,MAAM,gDAAgD;AACtF,QAAI,CAAC,QAAQ,SAAU,OAAM,IAAI,MAAM,gDAAgD;AACvF,SAAK,MAAM;AACX,SAAK,UAAU,OAAO;AACtB,SAAK,WAAW,OAAO;AACvB,SAAK,UAAU,OAAO;AACtB,SAAK,gBAAgB,OAAO,iBAAiB;AAC7C,SAAK,qBAAqB,OAAO,sBAAsB;AACvD,SAAK,sBAAsB,OAAO,uBAAuB;AACzD,SAAK,UAAU,OAAO,WAAW;AAAA,EACnC;AAAA,EAEQ,aAAa,WAA4B;AAC/C,WAAO,eAAe,IAAI,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W,0BAA0B,UAAU,KAAK,UAAU,MAAM,KAAK,MAAM,WAAW,KAAK,UAAU,GAAG,GAAG;AAAA,EACrI;AAAA;AAAA;AAAA,EAIA,2BAA8B,MAAgE,KAAuB;AACnH,WAAO,KAAK,MAAM,EAAE,WAAW,uBAAuB,UAAU,KAAK,UAAU,MAAM,KAAK,MAAM,WAAW,KAAK,UAAU,GAAG,GAAG;AAAA,EAClI;AAAA,EAEQ,QACN,QACA,YACA,QACA,MACA,UACc;AACd,WAAO;AAAA,MACL;AAAA,MACA,SAAS,KAAK;AAAA,MACd,UAAU,KAAK;AAAA,MACf,WAAW,OAAO;AAAA,MAClB,UAAU,OAAO;AAAA,MACjB,MAAM,OAAO;AAAA,MACb,YAAY,KAAK,aAAa,OAAO,SAAS;AAAA,MAC9C,SAAS,KAAK,WAAW;AAAA,MACzB,SAAS,KAAK,WAAW,KAAK;AAAA,MAC9B;AAAA,MACA,OAAO,KAAK,SAAS,OAAO,SAAS;AAAA,MACrC,QAAQ,KAAK;AAAA,MACb,YAAY,KAAK;AAAA,MACjB;AAAA,IACF;AAAA,EACF;AACF;AAuBO,SAAS,iBAAiB,KAAe,QAAsC;AACpF,SAAO,IAAI,WAAW,KAAK,MAAM;AACnC;","names":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { VorimSDK } from '../index.cjs';
|
|
2
|
-
import { P as PermissionScope } from '../types-
|
|
2
|
+
import { P as PermissionScope } from '../types-Lp1iHEDz.cjs';
|
|
3
3
|
|
|
4
4
|
/** A FHIR REST write interaction. Reads/searches pass through as 'read'. */
|
|
5
5
|
type FhirInteraction = 'create' | 'update' | 'patch' | 'transaction' | 'read';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { VorimSDK } from '../index.js';
|
|
2
|
-
import { P as PermissionScope } from '../types-
|
|
2
|
+
import { P as PermissionScope } from '../types-Lp1iHEDz.js';
|
|
3
3
|
|
|
4
4
|
/** A FHIR REST write interaction. Reads/searches pass through as 'read'. */
|
|
5
5
|
type FhirInteraction = 'create' | 'update' | 'patch' | 'transaction' | 'read';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { VorimSDK } from '../index.cjs';
|
|
2
|
-
import { P as PermissionScope } from '../types-
|
|
2
|
+
import { P as PermissionScope } from '../types-Lp1iHEDz.cjs';
|
|
3
3
|
|
|
4
4
|
/** The Guidewire Cloud API mutations this guard classifies. Any other label is
|
|
5
5
|
* accepted too; it defaults to the 'write' risk tier (a mutation is at least a
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { VorimSDK } from '../index.js';
|
|
2
|
-
import { P as PermissionScope } from '../types-
|
|
2
|
+
import { P as PermissionScope } from '../types-Lp1iHEDz.js';
|
|
3
3
|
|
|
4
4
|
/** The Guidewire Cloud API mutations this guard classifies. Any other label is
|
|
5
5
|
* accepted too; it defaults to the 'write' risk tier (a mutation is at least a
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { VorimSDK, ReplayInputs } from '../index.cjs';
|
|
2
|
-
import { P as PermissionScope } from '../types-
|
|
2
|
+
import { P as PermissionScope } from '../types-Lp1iHEDz.cjs';
|
|
3
3
|
import { E as EscalationPolicy, T as TransportFailurePolicy } from '../_runtime-gate-DOJUKJBu.cjs';
|
|
4
4
|
|
|
5
5
|
interface HermesTool {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { VorimSDK, ReplayInputs } from '../index.js';
|
|
2
|
-
import { P as PermissionScope } from '../types-
|
|
2
|
+
import { P as PermissionScope } from '../types-Lp1iHEDz.js';
|
|
3
3
|
import { E as EscalationPolicy, T as TransportFailurePolicy } from '../_runtime-gate-DOJUKJBu.js';
|
|
4
4
|
|
|
5
5
|
interface HermesTool {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { P as PermissionScope, A as AgentRegistrationResult } from '../types-
|
|
1
|
+
import { P as PermissionScope, A as AgentRegistrationResult } from '../types-Lp1iHEDz.cjs';
|
|
2
2
|
import { VorimSDK, ReplayInputs } from '../index.cjs';
|
|
3
3
|
import { E as EscalationPolicy, T as TransportFailurePolicy } from '../_runtime-gate-DOJUKJBu.cjs';
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { P as PermissionScope, A as AgentRegistrationResult } from '../types-
|
|
1
|
+
import { P as PermissionScope, A as AgentRegistrationResult } from '../types-Lp1iHEDz.js';
|
|
2
2
|
import { VorimSDK, ReplayInputs } from '../index.js';
|
|
3
3
|
import { E as EscalationPolicy, T as TransportFailurePolicy } from '../_runtime-gate-DOJUKJBu.js';
|
|
4
4
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { VorimSDK } from '../index.cjs';
|
|
2
|
-
import { P as PermissionScope } from '../types-
|
|
2
|
+
import { P as PermissionScope } from '../types-Lp1iHEDz.cjs';
|
|
3
3
|
|
|
4
4
|
/** Which DMS this guard fronts. Configuration, not separate code paths. */
|
|
5
5
|
type LegalDms = 'imanage' | 'netdocuments';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { VorimSDK } from '../index.js';
|
|
2
|
-
import { P as PermissionScope } from '../types-
|
|
2
|
+
import { P as PermissionScope } from '../types-Lp1iHEDz.js';
|
|
3
3
|
|
|
4
4
|
/** Which DMS this guard fronts. Configuration, not separate code paths. */
|
|
5
5
|
type LegalDms = 'imanage' | 'netdocuments';
|