@kya-os/contracts 1.5.2-canary.3 → 1.5.2-canary.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/package.json +5 -5
  2. package/dist/agentshield-api/endpoints.d.ts +0 -51
  3. package/dist/agentshield-api/endpoints.js +0 -47
  4. package/dist/agentshield-api/index.d.ts +0 -13
  5. package/dist/agentshield-api/index.js +0 -37
  6. package/dist/agentshield-api/schemas.d.ts +0 -5867
  7. package/dist/agentshield-api/schemas.js +0 -207
  8. package/dist/agentshield-api/types.d.ts +0 -194
  9. package/dist/agentshield-api/types.js +0 -26
  10. package/dist/cli.d.ts +0 -388
  11. package/dist/cli.js +0 -121
  12. package/dist/config/base.d.ts +0 -96
  13. package/dist/config/base.js +0 -11
  14. package/dist/config/builder.d.ts +0 -34
  15. package/dist/config/builder.js +0 -74
  16. package/dist/config/delegation.d.ts +0 -194
  17. package/dist/config/delegation.js +0 -10
  18. package/dist/config/identity.d.ts +0 -117
  19. package/dist/config/identity.js +0 -11
  20. package/dist/config/index.d.ts +0 -35
  21. package/dist/config/index.js +0 -15
  22. package/dist/config/proofing.d.ts +0 -120
  23. package/dist/config/proofing.js +0 -10
  24. package/dist/config/tool-protection.d.ts +0 -139
  25. package/dist/config/tool-protection.js +0 -10
  26. package/dist/consent/index.d.ts +0 -6
  27. package/dist/consent/index.js +0 -22
  28. package/dist/consent/schemas.d.ts +0 -738
  29. package/dist/consent/schemas.js +0 -186
  30. package/dist/consent/types.d.ts +0 -155
  31. package/dist/consent/types.js +0 -10
  32. package/dist/dashboard-config/default-config.d.ts +0 -50
  33. package/dist/dashboard-config/default-config.js +0 -241
  34. package/dist/dashboard-config/index.d.ts +0 -11
  35. package/dist/dashboard-config/index.js +0 -36
  36. package/dist/dashboard-config/schemas.d.ts +0 -5905
  37. package/dist/dashboard-config/schemas.js +0 -255
  38. package/dist/dashboard-config/types.d.ts +0 -338
  39. package/dist/dashboard-config/types.js +0 -11
  40. package/dist/delegation/constraints.d.ts +0 -1022
  41. package/dist/delegation/constraints.js +0 -219
  42. package/dist/delegation/index.d.ts +0 -7
  43. package/dist/delegation/index.js +0 -24
  44. package/dist/delegation/schemas.d.ts +0 -8458
  45. package/dist/delegation/schemas.js +0 -476
  46. package/dist/did/index.d.ts +0 -8
  47. package/dist/did/index.js +0 -24
  48. package/dist/did/resolve-contract.d.ts +0 -219
  49. package/dist/did/resolve-contract.js +0 -31
  50. package/dist/did/schemas.d.ts +0 -112
  51. package/dist/did/schemas.js +0 -172
  52. package/dist/did/types.d.ts +0 -163
  53. package/dist/did/types.js +0 -70
  54. package/dist/env/constants.d.ts +0 -57
  55. package/dist/env/constants.js +0 -59
  56. package/dist/env/index.d.ts +0 -4
  57. package/dist/env/index.js +0 -20
  58. package/dist/handshake.d.ts +0 -167
  59. package/dist/handshake.js +0 -60
  60. package/dist/index.d.ts +0 -25
  61. package/dist/index.js +0 -55
  62. package/dist/proof/index.d.ts +0 -8
  63. package/dist/proof/index.js +0 -24
  64. package/dist/proof/proof-record.d.ts +0 -837
  65. package/dist/proof/proof-record.js +0 -133
  66. package/dist/proof/signing-spec.d.ts +0 -146
  67. package/dist/proof/signing-spec.js +0 -122
  68. package/dist/proof.d.ts +0 -415
  69. package/dist/proof.js +0 -83
  70. package/dist/registry.d.ts +0 -342
  71. package/dist/registry.js +0 -118
  72. package/dist/runtime/errors.d.ts +0 -347
  73. package/dist/runtime/errors.js +0 -119
  74. package/dist/runtime/headers.d.ts +0 -83
  75. package/dist/runtime/headers.js +0 -81
  76. package/dist/runtime/index.d.ts +0 -5
  77. package/dist/runtime/index.js +0 -21
  78. package/dist/test.d.ts +0 -251
  79. package/dist/test.js +0 -119
  80. package/dist/tlkrc/index.d.ts +0 -4
  81. package/dist/tlkrc/index.js +0 -20
  82. package/dist/tlkrc/rotation.d.ts +0 -245
  83. package/dist/tlkrc/rotation.js +0 -126
  84. package/dist/tool-protection/index.d.ts +0 -227
  85. package/dist/tool-protection/index.js +0 -113
  86. package/dist/utils/validation.d.ts +0 -30
  87. package/dist/utils/validation.js +0 -69
  88. package/dist/vc/index.d.ts +0 -7
  89. package/dist/vc/index.js +0 -23
  90. package/dist/vc/schemas.d.ts +0 -2483
  91. package/dist/vc/schemas.js +0 -224
  92. package/dist/vc/statuslist.d.ts +0 -493
  93. package/dist/vc/statuslist.js +0 -132
  94. package/dist/verifier.d.ts +0 -205
  95. package/dist/verifier.js +0 -83
  96. package/dist/well-known/index.d.ts +0 -308
  97. package/dist/well-known/index.js +0 -134
@@ -1,207 +0,0 @@
1
- "use strict";
2
- /**
3
- * AgentShield/Bouncer API Zod Validation Schemas
4
- *
5
- * Runtime validation schemas matching the API contract types.
6
- * These schemas ensure request/response validation before sending/receiving.
7
- *
8
- * @package @kya-os/contracts/agentshield-api
9
- */
10
- Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.revokeDelegationAPIResponseSchema = exports.revokeDelegationResponseSchema = exports.revokeDelegationRequestSchema = exports.createDelegationAPIResponseSchema = exports.createDelegationResponseSchema = exports.createDelegationRequestSchema = exports.toolProtectionConfigAPIResponseSchema = exports.toolProtectionConfigResponseSchema = exports.agentShieldToolProtectionSchema = exports.verifyDelegationAPIResponseSchema = exports.verifyDelegationResponseSchema = exports.verifyDelegationRequestSchema = exports.delegationCredentialSchema = exports.proofSubmissionResponseSchema = exports.proofSubmissionRequestSchema = exports.agentShieldAPIResponseSchema = exports.agentShieldAPIErrorSchema = void 0;
12
- const zod_1 = require("zod");
13
- const proof_js_1 = require("../proof.js");
14
- const index_js_1 = require("../delegation/index.js");
15
- /**
16
- * Standard error schema
17
- */
18
- exports.agentShieldAPIErrorSchema = zod_1.z.object({
19
- code: zod_1.z.string(),
20
- message: zod_1.z.string(),
21
- details: zod_1.z.record(zod_1.z.unknown()).optional(),
22
- });
23
- /**
24
- * Standard API response wrapper schema
25
- */
26
- const agentShieldAPIResponseSchema = (dataSchema) => zod_1.z.object({
27
- success: zod_1.z.boolean(),
28
- data: dataSchema,
29
- metadata: zod_1.z
30
- .object({
31
- requestId: zod_1.z.string(),
32
- timestamp: zod_1.z.string(),
33
- })
34
- .optional(),
35
- });
36
- exports.agentShieldAPIResponseSchema = agentShieldAPIResponseSchema;
37
- // ============================================================================
38
- // Proof Submission Schemas
39
- // ============================================================================
40
- /**
41
- * Proof submission request schema
42
- */
43
- exports.proofSubmissionRequestSchema = zod_1.z.object({
44
- delegation_id: zod_1.z.string().uuid().nullable(),
45
- session_id: zod_1.z.string().uuid(),
46
- proofs: zod_1.z.array(proof_js_1.DetachedProofSchema).min(1),
47
- });
48
- /**
49
- * Proof submission response schema
50
- */
51
- exports.proofSubmissionResponseSchema = zod_1.z.object({
52
- success: zod_1.z.boolean(),
53
- received: zod_1.z.number().int().min(0),
54
- processed: zod_1.z.number().int().min(0),
55
- errors: zod_1.z
56
- .array(zod_1.z.object({
57
- proofId: zod_1.z.string(),
58
- error: zod_1.z.string(),
59
- }))
60
- .optional(),
61
- });
62
- // ============================================================================
63
- // Delegation Verification Schemas
64
- // ============================================================================
65
- /**
66
- * Delegation credential schema
67
- */
68
- exports.delegationCredentialSchema = zod_1.z.object({
69
- agent_did: zod_1.z.string(),
70
- user_id: zod_1.z.string().optional(),
71
- user_identifier: zod_1.z.string().optional(),
72
- scopes: zod_1.z.array(zod_1.z.string()),
73
- constraints: zod_1.z.record(zod_1.z.unknown()).optional(),
74
- issued_at: zod_1.z.number().int().positive(),
75
- created_at: zod_1.z.number().int().positive(),
76
- });
77
- /**
78
- * Delegation verification request schema
79
- */
80
- exports.verifyDelegationRequestSchema = zod_1.z.object({
81
- agent_did: zod_1.z.string(),
82
- scopes: zod_1.z.array(zod_1.z.string()).min(1),
83
- timestamp: zod_1.z.number().int().positive().optional(),
84
- client_info: zod_1.z
85
- .object({
86
- ip_address: zod_1.z.string().ip().optional(),
87
- origin: zod_1.z.string().url().optional(),
88
- user_agent: zod_1.z.string().optional(),
89
- })
90
- .optional(),
91
- });
92
- /**
93
- * Delegation verification response schema
94
- */
95
- exports.verifyDelegationResponseSchema = zod_1.z.object({
96
- valid: zod_1.z.boolean(),
97
- delegation: index_js_1.DelegationRecordSchema.optional(),
98
- delegation_id: zod_1.z.string().uuid().optional(),
99
- credential: exports.delegationCredentialSchema.optional(),
100
- error: exports.agentShieldAPIErrorSchema.optional(),
101
- reason: zod_1.z.string().optional(),
102
- });
103
- /**
104
- * Wrapped verification response schema
105
- */
106
- exports.verifyDelegationAPIResponseSchema = (0, exports.agentShieldAPIResponseSchema)(exports.verifyDelegationResponseSchema);
107
- // ============================================================================
108
- // Tool Protection Configuration Schemas
109
- // ============================================================================
110
- /**
111
- * AgentShield tool protection schema (supports both snake_case and camelCase)
112
- * This is the API-specific format, not the MCP-I spec schema
113
- */
114
- exports.agentShieldToolProtectionSchema = zod_1.z
115
- .object({
116
- scopes: zod_1.z.array(zod_1.z.string()),
117
- requires_delegation: zod_1.z.boolean().optional(),
118
- requiresDelegation: zod_1.z.boolean().optional(),
119
- required_scopes: zod_1.z.array(zod_1.z.string()).optional(),
120
- })
121
- .passthrough(); // Allow additional properties
122
- /**
123
- * Tool protection config response schema
124
- */
125
- exports.toolProtectionConfigResponseSchema = zod_1.z.object({
126
- agent_did: zod_1.z.string(),
127
- tools: zod_1.z.record(zod_1.z.string(), exports.agentShieldToolProtectionSchema),
128
- reputation_threshold: zod_1.z.number().min(0).max(1).optional(),
129
- denied_agents: zod_1.z.array(zod_1.z.string()).optional(),
130
- });
131
- /**
132
- * Wrapped config response schema
133
- */
134
- exports.toolProtectionConfigAPIResponseSchema = (0, exports.agentShieldAPIResponseSchema)(exports.toolProtectionConfigResponseSchema);
135
- // ============================================================================
136
- // Delegation Management Schemas
137
- // ============================================================================
138
- /**
139
- * Create delegation request schema
140
- *
141
- * Note: AgentShield API accepts a simplified format, not the full DelegationRecord.
142
- * The API accepts: agent_did, scopes, expires_in_days, expires_at, session_id, project_id, custom_fields
143
- *
144
- * IMPORTANT: expires_in_days and expires_at are mutually exclusive - use one or the other, not both.
145
- */
146
- exports.createDelegationRequestSchema = zod_1.z
147
- .object({
148
- agent_did: zod_1.z.string().min(1),
149
- scopes: zod_1.z.array(zod_1.z.string()).min(1),
150
- expires_in_days: zod_1.z.number().int().positive().optional(),
151
- expires_at: zod_1.z.string().datetime().optional(),
152
- session_id: zod_1.z.string().optional(),
153
- project_id: zod_1.z.string().uuid().optional(),
154
- custom_fields: zod_1.z.record(zod_1.z.unknown()).optional(),
155
- })
156
- .passthrough()
157
- .refine((data) => {
158
- // expires_in_days and expires_at are mutually exclusive
159
- const hasExpiresInDays = data.expires_in_days !== undefined;
160
- const hasExpiresAt = data.expires_at !== undefined;
161
- return !(hasExpiresInDays && hasExpiresAt);
162
- }, {
163
- message: "expires_in_days and expires_at are mutually exclusive - use one or the other, not both",
164
- path: ["expires_in_days", "expires_at"],
165
- });
166
- /**
167
- * Create delegation response schema
168
- *
169
- * Canonical format returned by POST /api/v1/bouncer/delegations
170
- *
171
- * IMPORTANT: delegation_token is NOT returned by this endpoint.
172
- * delegation_token is only available via OAuth callback flow (/api/v1/bouncer/oauth/callback)
173
- * and is passed as a URL parameter, not in the API response body.
174
- */
175
- exports.createDelegationResponseSchema = zod_1.z.object({
176
- delegation_id: zod_1.z.string().uuid(),
177
- agent_did: zod_1.z.string().min(1),
178
- user_id: zod_1.z.string().optional(),
179
- user_identifier: zod_1.z.string().optional(),
180
- scopes: zod_1.z.array(zod_1.z.string()),
181
- status: zod_1.z.literal("active"),
182
- issued_at: zod_1.z.string().datetime(),
183
- expires_at: zod_1.z.string().datetime().optional(),
184
- created_at: zod_1.z.string().datetime(),
185
- });
186
- /**
187
- * Wrapped creation response schema
188
- */
189
- exports.createDelegationAPIResponseSchema = (0, exports.agentShieldAPIResponseSchema)(exports.createDelegationResponseSchema);
190
- /**
191
- * Revoke delegation request schema
192
- */
193
- exports.revokeDelegationRequestSchema = zod_1.z.object({
194
- reason: zod_1.z.string().optional(),
195
- });
196
- /**
197
- * Revoke delegation response schema
198
- */
199
- exports.revokeDelegationResponseSchema = zod_1.z.object({
200
- delegation_id: zod_1.z.string().uuid(),
201
- revoked: zod_1.z.boolean(),
202
- revoked_at: zod_1.z.number().int().positive(),
203
- });
204
- /**
205
- * Wrapped revocation response schema
206
- */
207
- exports.revokeDelegationAPIResponseSchema = (0, exports.agentShieldAPIResponseSchema)(exports.revokeDelegationResponseSchema);
@@ -1,194 +0,0 @@
1
- /**
2
- * AgentShield/Bouncer API Type Definitions
3
- *
4
- * TypeScript interfaces matching the AgentShield dashboard API contract.
5
- * These types ensure parity between xmcp-i clients and the AgentShield service.
6
- *
7
- * @package @kya-os/contracts/agentshield-api
8
- */
9
- import type { DetachedProof } from "../proof.js";
10
- import type { DelegationRecord } from "../delegation/index.js";
11
- /**
12
- * Standard AgentShield API response wrapper
13
- */
14
- export interface AgentShieldAPIResponse<T> {
15
- success: boolean;
16
- data: T;
17
- metadata?: {
18
- requestId: string;
19
- timestamp: string;
20
- };
21
- }
22
- /**
23
- * Standard AgentShield API error response structure
24
- * (Use AgentShieldAPIError class for runtime errors)
25
- */
26
- export interface AgentShieldAPIErrorResponse {
27
- code: string;
28
- message: string;
29
- details?: Record<string, unknown>;
30
- }
31
- /**
32
- * Request body for proof submission endpoint
33
- * POST /api/v1/bouncer/proofs
34
- */
35
- export interface ProofSubmissionRequest {
36
- /** Delegation ID (null if no delegation context) */
37
- delegation_id: string | null;
38
- /** Session ID for grouping proofs */
39
- session_id: string;
40
- /** Array of proofs to submit */
41
- proofs: DetachedProof[];
42
- }
43
- /**
44
- * Response from proof submission endpoint
45
- */
46
- export interface ProofSubmissionResponse {
47
- success: boolean;
48
- received: number;
49
- processed: number;
50
- errors?: Array<{
51
- proofId: string;
52
- error: string;
53
- }>;
54
- }
55
- /**
56
- * Request body for delegation verification endpoint
57
- * POST /api/v1/bouncer/delegations/verify
58
- */
59
- export interface VerifyDelegationRequest {
60
- /** Agent DID to verify */
61
- agent_did: string;
62
- /** Required scopes */
63
- scopes: string[];
64
- /** Optional timestamp for verification */
65
- timestamp?: number;
66
- /** Optional client info for IP/origin checking */
67
- client_info?: {
68
- ip_address?: string;
69
- origin?: string;
70
- user_agent?: string;
71
- };
72
- }
73
- /**
74
- * Credential information returned in verification response
75
- */
76
- export interface DelegationCredential {
77
- agent_did: string;
78
- user_id?: string;
79
- user_identifier?: string;
80
- scopes: string[];
81
- constraints?: Record<string, unknown>;
82
- issued_at: number;
83
- created_at: number;
84
- }
85
- /**
86
- * Response from delegation verification endpoint
87
- */
88
- export interface VerifyDelegationResponse {
89
- valid: boolean;
90
- delegation?: DelegationRecord;
91
- delegation_id?: string;
92
- credential?: DelegationCredential;
93
- error?: AgentShieldAPIErrorResponse;
94
- reason?: string;
95
- }
96
- /**
97
- * Wrapped verification response (AgentShield wraps in success/data)
98
- */
99
- export type VerifyDelegationAPIResponse = AgentShieldAPIResponse<VerifyDelegationResponse>;
100
- /**
101
- * AgentShield API tool protection format for a single tool
102
- * This is the API-specific format, not the MCP-I spec type
103
- */
104
- export interface AgentShieldToolProtection {
105
- scopes: string[];
106
- requires_delegation?: boolean;
107
- requiresDelegation?: boolean;
108
- required_scopes?: string[];
109
- }
110
- /**
111
- * Response from tool protection config endpoint
112
- * GET /api/v1/bouncer/projects/{projectId}/config
113
- */
114
- export interface ToolProtectionConfigResponse {
115
- agent_did: string;
116
- tools: Record<string, AgentShieldToolProtection>;
117
- reputation_threshold?: number;
118
- denied_agents?: string[];
119
- }
120
- /**
121
- * Wrapped config response
122
- */
123
- export type ToolProtectionConfigAPIResponse = AgentShieldAPIResponse<ToolProtectionConfigResponse>;
124
- /**
125
- * Request body for creating a delegation
126
- * POST /api/v1/bouncer/delegations
127
- *
128
- * Note: AgentShield API accepts a simplified format, not the full DelegationRecord.
129
- * The API accepts: agent_did, scopes, expires_in_days, expires_at, session_id, project_id, custom_fields
130
- *
131
- * IMPORTANT: expires_in_days and expires_at are mutually exclusive - use one or the other, not both.
132
- */
133
- export interface CreateDelegationRequest {
134
- agent_did: string;
135
- scopes: string[];
136
- /** Number of days until expiration (1-365). Mutually exclusive with expires_at. */
137
- expires_in_days?: number;
138
- /** ISO 8601 datetime when delegation expires. Mutually exclusive with expires_in_days. */
139
- expires_at?: string;
140
- session_id?: string;
141
- project_id?: string;
142
- custom_fields?: Record<string, unknown>;
143
- }
144
- /**
145
- * Response from delegation creation endpoint
146
- *
147
- * Canonical format returned by POST /api/v1/bouncer/delegations
148
- *
149
- * IMPORTANT: delegation_token is NOT returned by this endpoint.
150
- * delegation_token is only available via OAuth callback flow (/api/v1/bouncer/oauth/callback)
151
- * and is passed as a URL parameter, not in the API response body.
152
- */
153
- export interface CreateDelegationResponse {
154
- delegation_id: string;
155
- agent_did: string;
156
- user_id?: string;
157
- user_identifier?: string;
158
- scopes: string[];
159
- status: "active";
160
- issued_at: string;
161
- expires_at?: string;
162
- created_at: string;
163
- }
164
- /**
165
- * Wrapped creation response
166
- */
167
- export type CreateDelegationAPIResponse = AgentShieldAPIResponse<CreateDelegationResponse>;
168
- /**
169
- * Request body for revoking a delegation
170
- * POST /api/v1/bouncer/delegations/{id}/revoke
171
- */
172
- export interface RevokeDelegationRequest {
173
- reason?: string;
174
- }
175
- /**
176
- * Response from delegation revocation endpoint
177
- */
178
- export interface RevokeDelegationResponse {
179
- delegation_id: string;
180
- revoked: boolean;
181
- revoked_at: number;
182
- }
183
- /**
184
- * Wrapped revocation response
185
- */
186
- export type RevokeDelegationAPIResponse = AgentShieldAPIResponse<RevokeDelegationResponse>;
187
- /**
188
- * AgentShield API error class
189
- */
190
- export declare class AgentShieldAPIError extends Error {
191
- readonly code: string;
192
- readonly details?: Record<string, unknown> | undefined;
193
- constructor(code: string, message: string, details?: Record<string, unknown> | undefined);
194
- }
@@ -1,26 +0,0 @@
1
- "use strict";
2
- /**
3
- * AgentShield/Bouncer API Type Definitions
4
- *
5
- * TypeScript interfaces matching the AgentShield dashboard API contract.
6
- * These types ensure parity between xmcp-i clients and the AgentShield service.
7
- *
8
- * @package @kya-os/contracts/agentshield-api
9
- */
10
- Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.AgentShieldAPIError = void 0;
12
- // ============================================================================
13
- // Error Types
14
- // ============================================================================
15
- /**
16
- * AgentShield API error class
17
- */
18
- class AgentShieldAPIError extends Error {
19
- constructor(code, message, details) {
20
- super(message);
21
- this.code = code;
22
- this.details = details;
23
- this.name = "AgentShieldAPIError";
24
- }
25
- }
26
- exports.AgentShieldAPIError = AgentShieldAPIError;