@kya-os/contracts 1.5.4-canary.3 → 1.6.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.
@@ -0,0 +1,193 @@
1
+ /**
2
+ * Audit Types and Schemas
3
+ *
4
+ * Types and Zod schemas for audit logging in the MCP-I framework.
5
+ * These types are platform-agnostic and used across all implementations.
6
+ */
7
+ import { z } from "zod";
8
+ import type { AgentIdentity } from "../config/identity.js";
9
+ import type { SessionContext } from "../handshake.js";
10
+ /**
11
+ * Audit context schema for logging audit records
12
+ *
13
+ * Contains all metadata needed to generate an audit record.
14
+ * Privacy Note: Only metadata is extracted from these objects.
15
+ * The identity's private key, session's nonce, and other sensitive
16
+ * fields are NEVER included in the audit log.
17
+ */
18
+ export declare const AuditContextSchema: z.ZodObject<{
19
+ /**
20
+ * Agent identity
21
+ * Only `did` and `keyId` are logged. Private key is NEVER logged.
22
+ */
23
+ identity: z.ZodObject<{
24
+ did: z.ZodString;
25
+ kid: z.ZodString;
26
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
27
+ did: z.ZodString;
28
+ kid: z.ZodString;
29
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
30
+ did: z.ZodString;
31
+ kid: z.ZodString;
32
+ }, z.ZodTypeAny, "passthrough">>;
33
+ /**
34
+ * Session context
35
+ * Only `sessionId` and `audience` are logged. Nonce is NEVER logged.
36
+ */
37
+ session: z.ZodObject<{
38
+ sessionId: z.ZodString;
39
+ audience: z.ZodString;
40
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
41
+ sessionId: z.ZodString;
42
+ audience: z.ZodString;
43
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
44
+ sessionId: z.ZodString;
45
+ audience: z.ZodString;
46
+ }, z.ZodTypeAny, "passthrough">>;
47
+ /**
48
+ * Request hash (SHA-256 with `sha256:` prefix)
49
+ */
50
+ requestHash: z.ZodString;
51
+ /**
52
+ * Response hash (SHA-256 with `sha256:` prefix)
53
+ */
54
+ responseHash: z.ZodString;
55
+ /**
56
+ * Verification result
57
+ * - 'yes': Proof was verified successfully
58
+ * - 'no': Proof verification failed
59
+ */
60
+ verified: z.ZodEnum<["yes", "no"]>;
61
+ /**
62
+ * Optional scope identifier
63
+ * Application-level scope (e.g., 'orders.create', 'users.read').
64
+ * If not provided, '-' is used in the audit log.
65
+ */
66
+ scopeId: z.ZodOptional<z.ZodString>;
67
+ }, "strip", z.ZodTypeAny, {
68
+ requestHash: string;
69
+ responseHash: string;
70
+ session: {
71
+ audience: string;
72
+ sessionId: string;
73
+ } & {
74
+ [k: string]: unknown;
75
+ };
76
+ verified: "yes" | "no";
77
+ identity: {
78
+ did: string;
79
+ kid: string;
80
+ } & {
81
+ [k: string]: unknown;
82
+ };
83
+ scopeId?: string | undefined;
84
+ }, {
85
+ requestHash: string;
86
+ responseHash: string;
87
+ session: {
88
+ audience: string;
89
+ sessionId: string;
90
+ } & {
91
+ [k: string]: unknown;
92
+ };
93
+ verified: "yes" | "no";
94
+ identity: {
95
+ did: string;
96
+ kid: string;
97
+ } & {
98
+ [k: string]: unknown;
99
+ };
100
+ scopeId?: string | undefined;
101
+ }>;
102
+ export type AuditContext = {
103
+ identity: AgentIdentity;
104
+ session: SessionContext;
105
+ requestHash: string;
106
+ responseHash: string;
107
+ verified: "yes" | "no";
108
+ scopeId?: string;
109
+ };
110
+ /**
111
+ * Event context schema for logging events that bypass session deduplication
112
+ *
113
+ * Used for consent events where multiple events occur in the same session.
114
+ * Unlike AuditContext, this allows multiple events per session.
115
+ */
116
+ export declare const AuditEventContextSchema: z.ZodObject<{
117
+ /**
118
+ * Event type identifier
119
+ * @example "consent:page_viewed", "consent:approved", "runtime:initialized"
120
+ */
121
+ eventType: z.ZodString;
122
+ /**
123
+ * Agent identity
124
+ * Only `did` and `keyId` are logged. Private key is NEVER logged.
125
+ */
126
+ identity: z.ZodObject<{
127
+ did: z.ZodString;
128
+ kid: z.ZodString;
129
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
130
+ did: z.ZodString;
131
+ kid: z.ZodString;
132
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
133
+ did: z.ZodString;
134
+ kid: z.ZodString;
135
+ }, z.ZodTypeAny, "passthrough">>;
136
+ /**
137
+ * Session context
138
+ * Only `sessionId` and `audience` are logged. Nonce is NEVER logged.
139
+ */
140
+ session: z.ZodObject<{
141
+ sessionId: z.ZodString;
142
+ audience: z.ZodString;
143
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
144
+ sessionId: z.ZodString;
145
+ audience: z.ZodString;
146
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
147
+ sessionId: z.ZodString;
148
+ audience: z.ZodString;
149
+ }, z.ZodTypeAny, "passthrough">>;
150
+ /**
151
+ * Optional event-specific data
152
+ * Used for generating event hash. Not logged directly.
153
+ */
154
+ eventData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
155
+ }, "strip", z.ZodTypeAny, {
156
+ session: {
157
+ audience: string;
158
+ sessionId: string;
159
+ } & {
160
+ [k: string]: unknown;
161
+ };
162
+ identity: {
163
+ did: string;
164
+ kid: string;
165
+ } & {
166
+ [k: string]: unknown;
167
+ };
168
+ eventType: string;
169
+ eventData?: Record<string, unknown> | undefined;
170
+ }, {
171
+ session: {
172
+ audience: string;
173
+ sessionId: string;
174
+ } & {
175
+ [k: string]: unknown;
176
+ };
177
+ identity: {
178
+ did: string;
179
+ kid: string;
180
+ } & {
181
+ [k: string]: unknown;
182
+ };
183
+ eventType: string;
184
+ eventData?: Record<string, unknown> | undefined;
185
+ }>;
186
+ export type AuditEventContext = {
187
+ eventType: string;
188
+ identity: AgentIdentity;
189
+ session: SessionContext;
190
+ eventData?: Record<string, any>;
191
+ };
192
+ export type { AuditRecord } from "../proof.js";
193
+ export { AuditRecordSchema } from "../proof.js";
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+ /**
3
+ * Audit Types and Schemas
4
+ *
5
+ * Types and Zod schemas for audit logging in the MCP-I framework.
6
+ * These types are platform-agnostic and used across all implementations.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.AuditRecordSchema = exports.AuditEventContextSchema = exports.AuditContextSchema = void 0;
10
+ const zod_1 = require("zod");
11
+ /**
12
+ * Audit context schema for logging audit records
13
+ *
14
+ * Contains all metadata needed to generate an audit record.
15
+ * Privacy Note: Only metadata is extracted from these objects.
16
+ * The identity's private key, session's nonce, and other sensitive
17
+ * fields are NEVER included in the audit log.
18
+ */
19
+ exports.AuditContextSchema = zod_1.z.object({
20
+ /**
21
+ * Agent identity
22
+ * Only `did` and `keyId` are logged. Private key is NEVER logged.
23
+ */
24
+ identity: zod_1.z
25
+ .object({
26
+ did: zod_1.z.string().min(1),
27
+ kid: zod_1.z.string().min(1),
28
+ })
29
+ .passthrough(), // Allow additional fields but only did/kid are used
30
+ /**
31
+ * Session context
32
+ * Only `sessionId` and `audience` are logged. Nonce is NEVER logged.
33
+ */
34
+ session: zod_1.z
35
+ .object({
36
+ sessionId: zod_1.z.string().min(1),
37
+ audience: zod_1.z.string().min(1),
38
+ })
39
+ .passthrough(), // Allow additional fields but only sessionId/audience are used
40
+ /**
41
+ * Request hash (SHA-256 with `sha256:` prefix)
42
+ */
43
+ requestHash: zod_1.z.string().regex(/^sha256:[a-f0-9]{64}$/),
44
+ /**
45
+ * Response hash (SHA-256 with `sha256:` prefix)
46
+ */
47
+ responseHash: zod_1.z.string().regex(/^sha256:[a-f0-9]{64}$/),
48
+ /**
49
+ * Verification result
50
+ * - 'yes': Proof was verified successfully
51
+ * - 'no': Proof verification failed
52
+ */
53
+ verified: zod_1.z.enum(["yes", "no"]),
54
+ /**
55
+ * Optional scope identifier
56
+ * Application-level scope (e.g., 'orders.create', 'users.read').
57
+ * If not provided, '-' is used in the audit log.
58
+ */
59
+ scopeId: zod_1.z.string().optional(),
60
+ });
61
+ /**
62
+ * Event context schema for logging events that bypass session deduplication
63
+ *
64
+ * Used for consent events where multiple events occur in the same session.
65
+ * Unlike AuditContext, this allows multiple events per session.
66
+ */
67
+ exports.AuditEventContextSchema = zod_1.z.object({
68
+ /**
69
+ * Event type identifier
70
+ * @example "consent:page_viewed", "consent:approved", "runtime:initialized"
71
+ */
72
+ eventType: zod_1.z.string().min(1),
73
+ /**
74
+ * Agent identity
75
+ * Only `did` and `keyId` are logged. Private key is NEVER logged.
76
+ */
77
+ identity: zod_1.z
78
+ .object({
79
+ did: zod_1.z.string().min(1),
80
+ kid: zod_1.z.string().min(1),
81
+ })
82
+ .passthrough(), // Allow additional fields but only did/kid are used
83
+ /**
84
+ * Session context
85
+ * Only `sessionId` and `audience` are logged. Nonce is NEVER logged.
86
+ */
87
+ session: zod_1.z
88
+ .object({
89
+ sessionId: zod_1.z.string().min(1),
90
+ audience: zod_1.z.string().min(1),
91
+ })
92
+ .passthrough(), // Allow additional fields but only sessionId/audience are used
93
+ /**
94
+ * Optional event-specific data
95
+ * Used for generating event hash. Not logged directly.
96
+ */
97
+ eventData: zod_1.z.record(zod_1.z.unknown()).optional(),
98
+ });
99
+ var proof_js_1 = require("../proof.js");
100
+ Object.defineProperty(exports, "AuditRecordSchema", { enumerable: true, get: function () { return proof_js_1.AuditRecordSchema; } });
@@ -6,6 +6,7 @@
6
6
  *
7
7
  * @module @kya-os/contracts/config
8
8
  */
9
+ import { z } from "zod";
9
10
  /**
10
11
  * Runtime Identity Configuration
11
12
  *
@@ -25,7 +26,7 @@ export interface RuntimeIdentityConfig {
25
26
  * Runtime environment for identity
26
27
  * Determines where keys come from and how they're managed
27
28
  */
28
- environment: 'development' | 'production';
29
+ environment: "development" | "production";
29
30
  /**
30
31
  * Production identity configuration
31
32
  * Used when environment is 'production'
@@ -71,7 +72,218 @@ export interface RuntimeIdentityConfig {
71
72
  * - 'persistent': User DIDs are persisted in storage (requires did:web setup)
72
73
  * @default 'ephemeral'
73
74
  */
74
- userDidStorage?: 'ephemeral' | 'persistent';
75
+ userDidStorage?: "ephemeral" | "persistent";
76
+ }
77
+ /**
78
+ * OAuth Provider Configuration
79
+ *
80
+ * Configuration for a single OAuth provider (GitHub, Google, etc.)
81
+ */
82
+ export interface OAuthProvider {
83
+ /** OAuth client ID (public, safe to expose) */
84
+ clientId: string;
85
+ /** OAuth client secret (NOT returned in API response for security) */
86
+ clientSecret?: string | null;
87
+ /** OAuth authorization URL */
88
+ authorizationUrl: string;
89
+ /** OAuth token exchange URL */
90
+ tokenUrl: string;
91
+ /** OAuth user info endpoint URL */
92
+ userInfoUrl?: string;
93
+ /** Whether provider supports PKCE (Proof Key for Code Exchange) */
94
+ supportsPKCE: boolean;
95
+ /** Whether provider requires client secret (false for PKCE-only providers) */
96
+ requiresClientSecret: boolean;
97
+ /** Available scopes for this provider */
98
+ scopes?: string[];
99
+ /** Default scopes to request */
100
+ defaultScopes?: string[];
101
+ /** Whether provider uses proxy mode (via AgentShield) */
102
+ proxyMode?: boolean;
103
+ /** Custom OAuth parameters to include in authorization URL (e.g., audience, acr_values) */
104
+ customParams?: Record<string, string>;
105
+ /** Token endpoint authentication method */
106
+ tokenEndpointAuthMethod?: "client_secret_post" | "client_secret_basic";
107
+ /** OAuth response type (default: "code") */
108
+ responseType?: string;
109
+ /** OAuth grant type (default: "authorization_code") */
110
+ grantType?: string;
111
+ }
112
+ /**
113
+ * OAuth Configuration
114
+ *
115
+ * Configuration for OAuth providers fetched from AgentShield API.
116
+ * Contains all available providers for a project.
117
+ *
118
+ * The `configuredProvider` field indicates which provider (if any) has been
119
+ * explicitly configured in the AgentShield dashboard for this project.
120
+ * Phase 2+ requires tools to explicitly specify oauthProvider.
121
+ */
122
+ export interface OAuthConfig {
123
+ /** Map of provider names to provider configurations */
124
+ providers: Record<string, OAuthProvider>;
125
+ /**
126
+ * The explicitly configured OAuth provider for this project.
127
+ * Null if no provider has been configured in AgentShield dashboard.
128
+ * Used by ProviderResolver as fallback when tool doesn't specify oauthProvider.
129
+ */
130
+ configuredProvider?: string | null;
131
+ }
132
+ /**
133
+ * Zod schema for OAuthProvider validation
134
+ */
135
+ export declare const OAuthProviderSchema: z.ZodObject<{
136
+ clientId: z.ZodString;
137
+ clientSecret: z.ZodOptional<z.ZodNullable<z.ZodString>>;
138
+ authorizationUrl: z.ZodString;
139
+ tokenUrl: z.ZodString;
140
+ userInfoUrl: z.ZodOptional<z.ZodString>;
141
+ supportsPKCE: z.ZodBoolean;
142
+ requiresClientSecret: z.ZodBoolean;
143
+ scopes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
144
+ defaultScopes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
145
+ proxyMode: z.ZodOptional<z.ZodBoolean>;
146
+ customParams: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
147
+ tokenEndpointAuthMethod: z.ZodOptional<z.ZodEnum<["client_secret_post", "client_secret_basic"]>>;
148
+ responseType: z.ZodDefault<z.ZodOptional<z.ZodString>>;
149
+ grantType: z.ZodDefault<z.ZodOptional<z.ZodString>>;
150
+ }, "strip", z.ZodTypeAny, {
151
+ clientId: string;
152
+ authorizationUrl: string;
153
+ tokenUrl: string;
154
+ supportsPKCE: boolean;
155
+ requiresClientSecret: boolean;
156
+ responseType: string;
157
+ grantType: string;
158
+ scopes?: string[] | undefined;
159
+ clientSecret?: string | null | undefined;
160
+ userInfoUrl?: string | undefined;
161
+ defaultScopes?: string[] | undefined;
162
+ proxyMode?: boolean | undefined;
163
+ customParams?: Record<string, string> | undefined;
164
+ tokenEndpointAuthMethod?: "client_secret_post" | "client_secret_basic" | undefined;
165
+ }, {
166
+ clientId: string;
167
+ authorizationUrl: string;
168
+ tokenUrl: string;
169
+ supportsPKCE: boolean;
170
+ requiresClientSecret: boolean;
171
+ scopes?: string[] | undefined;
172
+ clientSecret?: string | null | undefined;
173
+ userInfoUrl?: string | undefined;
174
+ defaultScopes?: string[] | undefined;
175
+ proxyMode?: boolean | undefined;
176
+ customParams?: Record<string, string> | undefined;
177
+ tokenEndpointAuthMethod?: "client_secret_post" | "client_secret_basic" | undefined;
178
+ responseType?: string | undefined;
179
+ grantType?: string | undefined;
180
+ }>;
181
+ /**
182
+ * Zod schema for OAuthConfig validation
183
+ */
184
+ export declare const OAuthConfigSchema: z.ZodObject<{
185
+ providers: z.ZodRecord<z.ZodString, z.ZodObject<{
186
+ clientId: z.ZodString;
187
+ clientSecret: z.ZodOptional<z.ZodNullable<z.ZodString>>;
188
+ authorizationUrl: z.ZodString;
189
+ tokenUrl: z.ZodString;
190
+ userInfoUrl: z.ZodOptional<z.ZodString>;
191
+ supportsPKCE: z.ZodBoolean;
192
+ requiresClientSecret: z.ZodBoolean;
193
+ scopes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
194
+ defaultScopes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
195
+ proxyMode: z.ZodOptional<z.ZodBoolean>;
196
+ customParams: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
197
+ tokenEndpointAuthMethod: z.ZodOptional<z.ZodEnum<["client_secret_post", "client_secret_basic"]>>;
198
+ responseType: z.ZodDefault<z.ZodOptional<z.ZodString>>;
199
+ grantType: z.ZodDefault<z.ZodOptional<z.ZodString>>;
200
+ }, "strip", z.ZodTypeAny, {
201
+ clientId: string;
202
+ authorizationUrl: string;
203
+ tokenUrl: string;
204
+ supportsPKCE: boolean;
205
+ requiresClientSecret: boolean;
206
+ responseType: string;
207
+ grantType: string;
208
+ scopes?: string[] | undefined;
209
+ clientSecret?: string | null | undefined;
210
+ userInfoUrl?: string | undefined;
211
+ defaultScopes?: string[] | undefined;
212
+ proxyMode?: boolean | undefined;
213
+ customParams?: Record<string, string> | undefined;
214
+ tokenEndpointAuthMethod?: "client_secret_post" | "client_secret_basic" | undefined;
215
+ }, {
216
+ clientId: string;
217
+ authorizationUrl: string;
218
+ tokenUrl: string;
219
+ supportsPKCE: boolean;
220
+ requiresClientSecret: boolean;
221
+ scopes?: string[] | undefined;
222
+ clientSecret?: string | null | undefined;
223
+ userInfoUrl?: string | undefined;
224
+ defaultScopes?: string[] | undefined;
225
+ proxyMode?: boolean | undefined;
226
+ customParams?: Record<string, string> | undefined;
227
+ tokenEndpointAuthMethod?: "client_secret_post" | "client_secret_basic" | undefined;
228
+ responseType?: string | undefined;
229
+ grantType?: string | undefined;
230
+ }>>;
231
+ configuredProvider: z.ZodOptional<z.ZodNullable<z.ZodString>>;
232
+ }, "strip", z.ZodTypeAny, {
233
+ providers: Record<string, {
234
+ clientId: string;
235
+ authorizationUrl: string;
236
+ tokenUrl: string;
237
+ supportsPKCE: boolean;
238
+ requiresClientSecret: boolean;
239
+ responseType: string;
240
+ grantType: string;
241
+ scopes?: string[] | undefined;
242
+ clientSecret?: string | null | undefined;
243
+ userInfoUrl?: string | undefined;
244
+ defaultScopes?: string[] | undefined;
245
+ proxyMode?: boolean | undefined;
246
+ customParams?: Record<string, string> | undefined;
247
+ tokenEndpointAuthMethod?: "client_secret_post" | "client_secret_basic" | undefined;
248
+ }>;
249
+ configuredProvider?: string | null | undefined;
250
+ }, {
251
+ providers: Record<string, {
252
+ clientId: string;
253
+ authorizationUrl: string;
254
+ tokenUrl: string;
255
+ supportsPKCE: boolean;
256
+ requiresClientSecret: boolean;
257
+ scopes?: string[] | undefined;
258
+ clientSecret?: string | null | undefined;
259
+ userInfoUrl?: string | undefined;
260
+ defaultScopes?: string[] | undefined;
261
+ proxyMode?: boolean | undefined;
262
+ customParams?: Record<string, string> | undefined;
263
+ tokenEndpointAuthMethod?: "client_secret_post" | "client_secret_basic" | undefined;
264
+ responseType?: string | undefined;
265
+ grantType?: string | undefined;
266
+ }>;
267
+ configuredProvider?: string | null | undefined;
268
+ }>;
269
+ /**
270
+ * IDP Tokens
271
+ *
272
+ * Tokens received from OAuth provider (IDP = Identity Provider)
273
+ */
274
+ export interface IdpTokens {
275
+ /** OAuth access token for API calls */
276
+ access_token: string;
277
+ /** OAuth refresh token (optional) */
278
+ refresh_token?: string;
279
+ /** Token expiration time in seconds */
280
+ expires_in?: number;
281
+ /** Token expiration timestamp (milliseconds since epoch) */
282
+ expires_at: number;
283
+ /** Token type (usually "Bearer") */
284
+ token_type: string;
285
+ /** Granted scopes */
286
+ scope?: string;
75
287
  }
76
288
  /**
77
289
  * Agent identity representation
@@ -8,3 +8,32 @@
8
8
  * @module @kya-os/contracts/config
9
9
  */
10
10
  Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.OAuthConfigSchema = exports.OAuthProviderSchema = void 0;
12
+ const zod_1 = require("zod");
13
+ /**
14
+ * Zod schema for OAuthProvider validation
15
+ */
16
+ exports.OAuthProviderSchema = zod_1.z.object({
17
+ clientId: zod_1.z.string().min(1),
18
+ clientSecret: zod_1.z.string().nullable().optional(),
19
+ authorizationUrl: zod_1.z.string().url(),
20
+ tokenUrl: zod_1.z.string().url(),
21
+ userInfoUrl: zod_1.z.string().url().optional(),
22
+ supportsPKCE: zod_1.z.boolean(),
23
+ requiresClientSecret: zod_1.z.boolean(),
24
+ scopes: zod_1.z.array(zod_1.z.string()).optional(),
25
+ defaultScopes: zod_1.z.array(zod_1.z.string()).optional(),
26
+ proxyMode: zod_1.z.boolean().optional(),
27
+ // Phase 3: Custom IDP Support
28
+ customParams: zod_1.z.record(zod_1.z.string()).optional(),
29
+ tokenEndpointAuthMethod: zod_1.z.enum(["client_secret_post", "client_secret_basic"]).optional(),
30
+ responseType: zod_1.z.string().optional().default("code"),
31
+ grantType: zod_1.z.string().optional().default("authorization_code"),
32
+ });
33
+ /**
34
+ * Zod schema for OAuthConfig validation
35
+ */
36
+ exports.OAuthConfigSchema = zod_1.z.object({
37
+ providers: zod_1.z.record(zod_1.z.string(), exports.OAuthProviderSchema),
38
+ configuredProvider: zod_1.z.string().nullable().optional(),
39
+ });
@@ -12,7 +12,8 @@ import type { ProofingConfig } from "./proofing.js";
12
12
  import type { DelegationConfig } from "./delegation.js";
13
13
  import type { ToolProtectionSourceConfig } from "./tool-protection.js";
14
14
  export { MCPIBaseConfig } from "./base.js";
15
- export { RuntimeIdentityConfig, AgentIdentity } from "./identity.js";
15
+ export { RuntimeIdentityConfig, AgentIdentity, OAuthProvider, OAuthConfig, IdpTokens, } from "./identity.js";
16
+ export type { ToolExecutionContext } from "./tool-context.js";
16
17
  /**
17
18
  * @deprecated Use RuntimeIdentityConfig instead
18
19
  * This export is maintained for backward compatibility
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Tool Execution Context
3
+ *
4
+ * Execution context passed to tool handlers, enabling tools to access
5
+ * IDP tokens for external API calls (GitHub, Google, etc.).
6
+ *
7
+ * All fields are optional for backward compatibility - tools that don't
8
+ * require OAuth will receive undefined context.
9
+ *
10
+ * @package @kya-os/contracts
11
+ */
12
+ /**
13
+ * Execution context passed to tool handlers
14
+ *
15
+ * Enables tools to access IDP tokens for external API calls.
16
+ * Context is only provided when:
17
+ * - Tool requires OAuth (has requiredScopes)
18
+ * - User DID is available
19
+ * - IDP token is successfully resolved
20
+ */
21
+ export interface ToolExecutionContext {
22
+ /** IDP access token for external API calls (e.g., GitHub, Google) */
23
+ idpToken?: string;
24
+ /** OAuth provider name (e.g., "github", "google") */
25
+ provider?: string;
26
+ /** Scopes granted for this token */
27
+ scopes?: string[];
28
+ /** User DID associated with this token */
29
+ userDid?: string;
30
+ /** Session ID */
31
+ sessionId?: string;
32
+ /** Delegation token (MCP-I internal authorization) */
33
+ delegationToken?: string;
34
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ /**
3
+ * Tool Execution Context
4
+ *
5
+ * Execution context passed to tool handlers, enabling tools to access
6
+ * IDP tokens for external API calls (GitHub, Google, etc.).
7
+ *
8
+ * All fields are optional for backward compatibility - tools that don't
9
+ * require OAuth will receive undefined context.
10
+ *
11
+ * @package @kya-os/contracts
12
+ */
13
+ Object.defineProperty(exports, "__esModule", { value: true });