@kya-os/contracts 1.5.2-canary.2 → 1.5.2-canary.3
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.
|
@@ -26,10 +26,12 @@ exports.agentShieldAPIErrorSchema = zod_1.z.object({
|
|
|
26
26
|
const agentShieldAPIResponseSchema = (dataSchema) => zod_1.z.object({
|
|
27
27
|
success: zod_1.z.boolean(),
|
|
28
28
|
data: dataSchema,
|
|
29
|
-
metadata: zod_1.z
|
|
29
|
+
metadata: zod_1.z
|
|
30
|
+
.object({
|
|
30
31
|
requestId: zod_1.z.string(),
|
|
31
32
|
timestamp: zod_1.z.string(),
|
|
32
|
-
})
|
|
33
|
+
})
|
|
34
|
+
.optional(),
|
|
33
35
|
});
|
|
34
36
|
exports.agentShieldAPIResponseSchema = agentShieldAPIResponseSchema;
|
|
35
37
|
// ============================================================================
|
|
@@ -50,10 +52,12 @@ exports.proofSubmissionResponseSchema = zod_1.z.object({
|
|
|
50
52
|
success: zod_1.z.boolean(),
|
|
51
53
|
received: zod_1.z.number().int().min(0),
|
|
52
54
|
processed: zod_1.z.number().int().min(0),
|
|
53
|
-
errors: zod_1.z
|
|
55
|
+
errors: zod_1.z
|
|
56
|
+
.array(zod_1.z.object({
|
|
54
57
|
proofId: zod_1.z.string(),
|
|
55
58
|
error: zod_1.z.string(),
|
|
56
|
-
}))
|
|
59
|
+
}))
|
|
60
|
+
.optional(),
|
|
57
61
|
});
|
|
58
62
|
// ============================================================================
|
|
59
63
|
// Delegation Verification Schemas
|
|
@@ -77,11 +81,13 @@ exports.verifyDelegationRequestSchema = zod_1.z.object({
|
|
|
77
81
|
agent_did: zod_1.z.string(),
|
|
78
82
|
scopes: zod_1.z.array(zod_1.z.string()).min(1),
|
|
79
83
|
timestamp: zod_1.z.number().int().positive().optional(),
|
|
80
|
-
client_info: zod_1.z
|
|
84
|
+
client_info: zod_1.z
|
|
85
|
+
.object({
|
|
81
86
|
ip_address: zod_1.z.string().ip().optional(),
|
|
82
87
|
origin: zod_1.z.string().url().optional(),
|
|
83
88
|
user_agent: zod_1.z.string().optional(),
|
|
84
|
-
})
|
|
89
|
+
})
|
|
90
|
+
.optional(),
|
|
85
91
|
});
|
|
86
92
|
/**
|
|
87
93
|
* Delegation verification response schema
|
|
@@ -105,12 +111,14 @@ exports.verifyDelegationAPIResponseSchema = (0, exports.agentShieldAPIResponseSc
|
|
|
105
111
|
* AgentShield tool protection schema (supports both snake_case and camelCase)
|
|
106
112
|
* This is the API-specific format, not the MCP-I spec schema
|
|
107
113
|
*/
|
|
108
|
-
exports.agentShieldToolProtectionSchema = zod_1.z
|
|
114
|
+
exports.agentShieldToolProtectionSchema = zod_1.z
|
|
115
|
+
.object({
|
|
109
116
|
scopes: zod_1.z.array(zod_1.z.string()),
|
|
110
117
|
requires_delegation: zod_1.z.boolean().optional(),
|
|
111
118
|
requiresDelegation: zod_1.z.boolean().optional(),
|
|
112
119
|
required_scopes: zod_1.z.array(zod_1.z.string()).optional(),
|
|
113
|
-
})
|
|
120
|
+
})
|
|
121
|
+
.passthrough(); // Allow additional properties
|
|
114
122
|
/**
|
|
115
123
|
* Tool protection config response schema
|
|
116
124
|
*/
|
|
@@ -129,16 +137,51 @@ exports.toolProtectionConfigAPIResponseSchema = (0, exports.agentShieldAPIRespon
|
|
|
129
137
|
// ============================================================================
|
|
130
138
|
/**
|
|
131
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.
|
|
132
145
|
*/
|
|
133
|
-
exports.createDelegationRequestSchema = zod_1.z
|
|
134
|
-
|
|
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"],
|
|
135
165
|
});
|
|
136
166
|
/**
|
|
137
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.
|
|
138
174
|
*/
|
|
139
175
|
exports.createDelegationResponseSchema = zod_1.z.object({
|
|
140
176
|
delegation_id: zod_1.z.string().uuid(),
|
|
141
|
-
|
|
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(),
|
|
142
185
|
});
|
|
143
186
|
/**
|
|
144
187
|
* Wrapped creation response schema
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @package @kya-os/contracts/agentshield-api
|
|
8
8
|
*/
|
|
9
|
-
import type { DetachedProof } from
|
|
10
|
-
import type { DelegationRecord } from
|
|
9
|
+
import type { DetachedProof } from "../proof.js";
|
|
10
|
+
import type { DelegationRecord } from "../delegation/index.js";
|
|
11
11
|
/**
|
|
12
12
|
* Standard AgentShield API response wrapper
|
|
13
13
|
*/
|
|
@@ -124,16 +124,42 @@ export type ToolProtectionConfigAPIResponse = AgentShieldAPIResponse<ToolProtect
|
|
|
124
124
|
/**
|
|
125
125
|
* Request body for creating a delegation
|
|
126
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.
|
|
127
132
|
*/
|
|
128
133
|
export interface CreateDelegationRequest {
|
|
129
|
-
|
|
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>;
|
|
130
143
|
}
|
|
131
144
|
/**
|
|
132
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.
|
|
133
152
|
*/
|
|
134
153
|
export interface CreateDelegationResponse {
|
|
135
154
|
delegation_id: string;
|
|
136
|
-
|
|
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;
|
|
137
163
|
}
|
|
138
164
|
/**
|
|
139
165
|
* Wrapped creation response
|
|
@@ -166,4 +192,3 @@ export declare class AgentShieldAPIError extends Error {
|
|
|
166
192
|
readonly details?: Record<string, unknown> | undefined;
|
|
167
193
|
constructor(code: string, message: string, details?: Record<string, unknown> | undefined);
|
|
168
194
|
}
|
|
169
|
-
//# sourceMappingURL=types.d.ts.map
|
package/dist/config/builder.js
CHANGED
|
@@ -35,7 +35,7 @@ function buildBaseConfig(env) {
|
|
|
35
35
|
{
|
|
36
36
|
type: 'agentshield',
|
|
37
37
|
apiUrl: env.AGENTSHIELD_API_URL || 'https://kya.vouched.id',
|
|
38
|
-
apiKey: env.AGENTSHIELD_API_KEY
|
|
38
|
+
apiKey: env.AGENTSHIELD_API_KEY
|
|
39
39
|
}
|
|
40
40
|
],
|
|
41
41
|
maxBatchSize: 10,
|
|
@@ -72,4 +72,3 @@ function buildBaseConfig(env) {
|
|
|
72
72
|
};
|
|
73
73
|
return baseConfig;
|
|
74
74
|
}
|
|
75
|
-
//# sourceMappingURL=builder.js.map
|