@kya-os/contracts 1.6.17 → 1.6.19
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/cli.d.ts +56 -11
- package/dist/cli.js +38 -14
- package/dist/config/identity.d.ts +117 -0
- package/dist/config/identity.js +34 -2
- package/dist/config/tool-protection.d.ts +32 -7
- package/dist/consent/schemas.d.ts +90 -90
- package/dist/deploy/index.d.ts +27 -0
- package/dist/deploy/index.js +62 -0
- package/dist/deploy/schemas.d.ts +1001 -0
- package/dist/deploy/schemas.js +283 -0
- package/dist/deploy/types.d.ts +256 -0
- package/dist/deploy/types.js +10 -0
- package/dist/identity/index.d.ts +3 -0
- package/dist/identity/index.js +7 -0
- package/dist/index.js +1 -0
- package/dist/reputation/api.d.ts +2883 -0
- package/dist/reputation/api.js +417 -0
- package/dist/reputation/constants.d.ts +242 -0
- package/dist/reputation/constants.js +259 -0
- package/dist/reputation/credentials.d.ts +1493 -0
- package/dist/reputation/credentials.js +302 -0
- package/dist/reputation/index.d.ts +20 -0
- package/dist/reputation/index.js +40 -0
- package/dist/reputation/schemas.d.ts +1600 -0
- package/dist/reputation/schemas.js +499 -0
- package/package.json +9 -1
package/dist/cli.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { KTARegistrationSchema } from "./config/identity.js";
|
|
2
3
|
/**
|
|
3
4
|
* CLI command schemas and results
|
|
4
5
|
*/
|
|
6
|
+
export { KTARegistration, KTARegistrationSchema } from "./config/identity.js";
|
|
5
7
|
/**
|
|
6
8
|
* CLI Identity File Format Schema
|
|
7
9
|
*
|
|
@@ -17,6 +19,23 @@ export declare const CLIIdentityFileSchema: z.ZodEffects<z.ZodEffects<z.ZodObjec
|
|
|
17
19
|
publicKey: z.ZodString;
|
|
18
20
|
createdAt: z.ZodString;
|
|
19
21
|
lastRotated: z.ZodOptional<z.ZodString>;
|
|
22
|
+
/**
|
|
23
|
+
* Know That AI registration information
|
|
24
|
+
* Present when agent is registered with KTA for reputation tracking
|
|
25
|
+
*/
|
|
26
|
+
kta: z.ZodOptional<z.ZodObject<{
|
|
27
|
+
registered: z.ZodBoolean;
|
|
28
|
+
registeredAt: z.ZodString;
|
|
29
|
+
claimUrl: z.ZodNullable<z.ZodString>;
|
|
30
|
+
}, "strip", z.ZodTypeAny, {
|
|
31
|
+
registered: boolean;
|
|
32
|
+
registeredAt: string;
|
|
33
|
+
claimUrl: string | null;
|
|
34
|
+
}, {
|
|
35
|
+
registered: boolean;
|
|
36
|
+
registeredAt: string;
|
|
37
|
+
claimUrl: string | null;
|
|
38
|
+
}>>;
|
|
20
39
|
}, "strip", z.ZodTypeAny, {
|
|
21
40
|
version: "1.0";
|
|
22
41
|
did: string;
|
|
@@ -26,6 +45,11 @@ export declare const CLIIdentityFileSchema: z.ZodEffects<z.ZodEffects<z.ZodObjec
|
|
|
26
45
|
kid?: string | undefined;
|
|
27
46
|
keyId?: string | undefined;
|
|
28
47
|
lastRotated?: string | undefined;
|
|
48
|
+
kta?: {
|
|
49
|
+
registered: boolean;
|
|
50
|
+
registeredAt: string;
|
|
51
|
+
claimUrl: string | null;
|
|
52
|
+
} | undefined;
|
|
29
53
|
}, {
|
|
30
54
|
version: "1.0";
|
|
31
55
|
did: string;
|
|
@@ -35,6 +59,11 @@ export declare const CLIIdentityFileSchema: z.ZodEffects<z.ZodEffects<z.ZodObjec
|
|
|
35
59
|
kid?: string | undefined;
|
|
36
60
|
keyId?: string | undefined;
|
|
37
61
|
lastRotated?: string | undefined;
|
|
62
|
+
kta?: {
|
|
63
|
+
registered: boolean;
|
|
64
|
+
registeredAt: string;
|
|
65
|
+
claimUrl: string | null;
|
|
66
|
+
} | undefined;
|
|
38
67
|
}>, {
|
|
39
68
|
version: "1.0";
|
|
40
69
|
did: string;
|
|
@@ -44,6 +73,11 @@ export declare const CLIIdentityFileSchema: z.ZodEffects<z.ZodEffects<z.ZodObjec
|
|
|
44
73
|
kid?: string | undefined;
|
|
45
74
|
keyId?: string | undefined;
|
|
46
75
|
lastRotated?: string | undefined;
|
|
76
|
+
kta?: {
|
|
77
|
+
registered: boolean;
|
|
78
|
+
registeredAt: string;
|
|
79
|
+
claimUrl: string | null;
|
|
80
|
+
} | undefined;
|
|
47
81
|
}, {
|
|
48
82
|
version: "1.0";
|
|
49
83
|
did: string;
|
|
@@ -53,6 +87,11 @@ export declare const CLIIdentityFileSchema: z.ZodEffects<z.ZodEffects<z.ZodObjec
|
|
|
53
87
|
kid?: string | undefined;
|
|
54
88
|
keyId?: string | undefined;
|
|
55
89
|
lastRotated?: string | undefined;
|
|
90
|
+
kta?: {
|
|
91
|
+
registered: boolean;
|
|
92
|
+
registeredAt: string;
|
|
93
|
+
claimUrl: string | null;
|
|
94
|
+
} | undefined;
|
|
56
95
|
}>, {
|
|
57
96
|
version: "1.0";
|
|
58
97
|
did: string;
|
|
@@ -60,7 +99,8 @@ export declare const CLIIdentityFileSchema: z.ZodEffects<z.ZodEffects<z.ZodObjec
|
|
|
60
99
|
privateKey: string;
|
|
61
100
|
publicKey: string;
|
|
62
101
|
createdAt: string;
|
|
63
|
-
lastRotated
|
|
102
|
+
lastRotated?: string;
|
|
103
|
+
kta?: z.infer<typeof KTARegistrationSchema>;
|
|
64
104
|
}, {
|
|
65
105
|
version: "1.0";
|
|
66
106
|
did: string;
|
|
@@ -70,6 +110,11 @@ export declare const CLIIdentityFileSchema: z.ZodEffects<z.ZodEffects<z.ZodObjec
|
|
|
70
110
|
kid?: string | undefined;
|
|
71
111
|
keyId?: string | undefined;
|
|
72
112
|
lastRotated?: string | undefined;
|
|
113
|
+
kta?: {
|
|
114
|
+
registered: boolean;
|
|
115
|
+
registeredAt: string;
|
|
116
|
+
claimUrl: string | null;
|
|
117
|
+
} | undefined;
|
|
73
118
|
}>;
|
|
74
119
|
export declare const KeyRotationResultSchema: z.ZodObject<{
|
|
75
120
|
success: z.ZodBoolean;
|
|
@@ -259,6 +304,11 @@ export declare const DoctorResultSchema: z.ZodObject<{
|
|
|
259
304
|
issues?: string[] | undefined;
|
|
260
305
|
}>;
|
|
261
306
|
}, "strip", z.ZodTypeAny, {
|
|
307
|
+
kta: {
|
|
308
|
+
reachable: boolean;
|
|
309
|
+
authenticated: boolean;
|
|
310
|
+
issues?: string[] | undefined;
|
|
311
|
+
};
|
|
262
312
|
environment: {
|
|
263
313
|
valid: boolean;
|
|
264
314
|
missing: string[];
|
|
@@ -275,17 +325,17 @@ export declare const DoctorResultSchema: z.ZodObject<{
|
|
|
275
325
|
compatible: boolean;
|
|
276
326
|
issues?: string[] | undefined;
|
|
277
327
|
};
|
|
278
|
-
kta: {
|
|
279
|
-
reachable: boolean;
|
|
280
|
-
authenticated: boolean;
|
|
281
|
-
issues?: string[] | undefined;
|
|
282
|
-
};
|
|
283
328
|
cache: {
|
|
284
329
|
type: string;
|
|
285
330
|
functional: boolean;
|
|
286
331
|
issues?: string[] | undefined;
|
|
287
332
|
};
|
|
288
333
|
}, {
|
|
334
|
+
kta: {
|
|
335
|
+
reachable: boolean;
|
|
336
|
+
authenticated: boolean;
|
|
337
|
+
issues?: string[] | undefined;
|
|
338
|
+
};
|
|
289
339
|
environment: {
|
|
290
340
|
valid: boolean;
|
|
291
341
|
missing: string[];
|
|
@@ -302,11 +352,6 @@ export declare const DoctorResultSchema: z.ZodObject<{
|
|
|
302
352
|
compatible: boolean;
|
|
303
353
|
issues?: string[] | undefined;
|
|
304
354
|
};
|
|
305
|
-
kta: {
|
|
306
|
-
reachable: boolean;
|
|
307
|
-
authenticated: boolean;
|
|
308
|
-
issues?: string[] | undefined;
|
|
309
|
-
};
|
|
310
355
|
cache: {
|
|
311
356
|
type: string;
|
|
312
357
|
functional: boolean;
|
package/dist/cli.js
CHANGED
|
@@ -1,37 +1,61 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CLI_EXIT_CODES = exports.ERROR_CODES = exports.ScaffolderResultSchema = exports.ScaffolderOptionsSchema = exports.DoctorResultSchema = exports.CacheInfoSchema = exports.KTAInfoSchema = exports.EnvironmentInfoSchema = exports.XMCPUpstreamInfoSchema = exports.PackageInfoSchema = exports.StatusReportSchema = exports.KeyRotationResultSchema = exports.CLIIdentityFileSchema = void 0;
|
|
3
|
+
exports.CLI_EXIT_CODES = exports.ERROR_CODES = exports.ScaffolderResultSchema = exports.ScaffolderOptionsSchema = exports.DoctorResultSchema = exports.CacheInfoSchema = exports.KTAInfoSchema = exports.EnvironmentInfoSchema = exports.XMCPUpstreamInfoSchema = exports.PackageInfoSchema = exports.StatusReportSchema = exports.KeyRotationResultSchema = exports.CLIIdentityFileSchema = exports.KTARegistrationSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
+
const identity_js_1 = require("./config/identity.js");
|
|
5
6
|
/**
|
|
6
7
|
* CLI command schemas and results
|
|
7
8
|
*/
|
|
9
|
+
// Re-export KTARegistration types for convenience
|
|
10
|
+
var identity_js_2 = require("./config/identity.js");
|
|
11
|
+
Object.defineProperty(exports, "KTARegistrationSchema", { enumerable: true, get: function () { return identity_js_2.KTARegistrationSchema; } });
|
|
8
12
|
/**
|
|
9
13
|
* CLI Identity File Format Schema
|
|
10
14
|
*
|
|
11
15
|
* Format for identity.json files stored on disk.
|
|
12
16
|
* Used by CLI tools for identity management.
|
|
13
17
|
*/
|
|
14
|
-
exports.CLIIdentityFileSchema = zod_1.z
|
|
18
|
+
exports.CLIIdentityFileSchema = zod_1.z
|
|
19
|
+
.object({
|
|
15
20
|
version: zod_1.z.literal("1.0"),
|
|
16
21
|
did: zod_1.z.string().min(1),
|
|
17
22
|
// Accept both kid and keyId for backward compatibility with pre-1.3 identity files
|
|
18
23
|
kid: zod_1.z.string().min(1).optional(),
|
|
19
24
|
keyId: zod_1.z.string().min(1).optional(),
|
|
20
|
-
privateKey: zod_1.z
|
|
21
|
-
|
|
25
|
+
privateKey: zod_1.z
|
|
26
|
+
.string()
|
|
27
|
+
.regex(/^[A-Za-z0-9+/]{43}=$/, "Must be a valid base64-encoded Ed25519 private key (44 characters)"),
|
|
28
|
+
publicKey: zod_1.z
|
|
29
|
+
.string()
|
|
30
|
+
.regex(/^[A-Za-z0-9+/]{43}=$/, "Must be a valid base64-encoded Ed25519 public key (44 characters)"),
|
|
22
31
|
createdAt: zod_1.z.string().datetime(),
|
|
23
32
|
lastRotated: zod_1.z.string().datetime().optional(),
|
|
24
|
-
|
|
33
|
+
/**
|
|
34
|
+
* Know That AI registration information
|
|
35
|
+
* Present when agent is registered with KTA for reputation tracking
|
|
36
|
+
*/
|
|
37
|
+
kta: identity_js_1.KTARegistrationSchema.optional(),
|
|
38
|
+
})
|
|
39
|
+
.refine((data) => data.kid || data.keyId, {
|
|
25
40
|
message: "Either kid or keyId must be provided",
|
|
26
|
-
})
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
41
|
+
})
|
|
42
|
+
.transform((data) => {
|
|
43
|
+
const result = {
|
|
44
|
+
version: data.version,
|
|
45
|
+
did: data.did,
|
|
46
|
+
kid: data.kid || data.keyId,
|
|
47
|
+
privateKey: data.privateKey,
|
|
48
|
+
publicKey: data.publicKey,
|
|
49
|
+
createdAt: data.createdAt,
|
|
50
|
+
};
|
|
51
|
+
if (data.lastRotated) {
|
|
52
|
+
result.lastRotated = data.lastRotated;
|
|
53
|
+
}
|
|
54
|
+
if (data.kta) {
|
|
55
|
+
result.kta = data.kta;
|
|
56
|
+
}
|
|
57
|
+
return result;
|
|
58
|
+
});
|
|
35
59
|
exports.KeyRotationResultSchema = zod_1.z.object({
|
|
36
60
|
success: zod_1.z.boolean(),
|
|
37
61
|
oldKeyId: zod_1.z.string().min(1),
|
|
@@ -772,6 +772,51 @@ export interface IdpTokens {
|
|
|
772
772
|
/** Granted scopes */
|
|
773
773
|
scope?: string;
|
|
774
774
|
}
|
|
775
|
+
/**
|
|
776
|
+
* Know That AI Registration
|
|
777
|
+
*
|
|
778
|
+
* Tracks whether and when this agent was registered with Know That AI
|
|
779
|
+
* for reputation tracking and discovery.
|
|
780
|
+
*
|
|
781
|
+
* Present when agent is registered via:
|
|
782
|
+
* - CLI: `mcpi register`
|
|
783
|
+
* - Scaffolder: `create-mcpi-app --register`
|
|
784
|
+
* - Shadow registration (automatic for did:key)
|
|
785
|
+
*/
|
|
786
|
+
export interface KTARegistration {
|
|
787
|
+
/**
|
|
788
|
+
* Whether registration was successful
|
|
789
|
+
*/
|
|
790
|
+
registered: boolean;
|
|
791
|
+
/**
|
|
792
|
+
* ISO 8601 timestamp of when the agent was registered
|
|
793
|
+
* @example '2025-01-15T10:30:00.000Z'
|
|
794
|
+
*/
|
|
795
|
+
registeredAt: string;
|
|
796
|
+
/**
|
|
797
|
+
* Claim URL for did:web identity verification
|
|
798
|
+
* - For did:web agents: URL to claim public listing
|
|
799
|
+
* - For did:key agents: null (shadow registration, no public listing)
|
|
800
|
+
* @example 'https://knowthat.ai/agents/claim/abc123'
|
|
801
|
+
*/
|
|
802
|
+
claimUrl: string | null;
|
|
803
|
+
}
|
|
804
|
+
/**
|
|
805
|
+
* Zod schema for KTARegistration
|
|
806
|
+
*/
|
|
807
|
+
export declare const KTARegistrationSchema: z.ZodObject<{
|
|
808
|
+
registered: z.ZodBoolean;
|
|
809
|
+
registeredAt: z.ZodString;
|
|
810
|
+
claimUrl: z.ZodNullable<z.ZodString>;
|
|
811
|
+
}, "strip", z.ZodTypeAny, {
|
|
812
|
+
registered: boolean;
|
|
813
|
+
registeredAt: string;
|
|
814
|
+
claimUrl: string | null;
|
|
815
|
+
}, {
|
|
816
|
+
registered: boolean;
|
|
817
|
+
registeredAt: string;
|
|
818
|
+
claimUrl: string | null;
|
|
819
|
+
}>;
|
|
775
820
|
/**
|
|
776
821
|
* Agent identity representation
|
|
777
822
|
* The actual identity data structure used at runtime
|
|
@@ -795,6 +840,18 @@ export interface AgentIdentity {
|
|
|
795
840
|
* ISO 8601 timestamp of when the identity was created
|
|
796
841
|
*/
|
|
797
842
|
createdAt: string;
|
|
843
|
+
/**
|
|
844
|
+
* Know That AI registration information
|
|
845
|
+
* Present when agent is registered with KTA for reputation tracking.
|
|
846
|
+
*
|
|
847
|
+
* @example
|
|
848
|
+
* ```typescript
|
|
849
|
+
* if (identity.kta?.registered) {
|
|
850
|
+
* // Agent is registered, reputation tracking is enabled
|
|
851
|
+
* }
|
|
852
|
+
* ```
|
|
853
|
+
*/
|
|
854
|
+
kta?: KTARegistration;
|
|
798
855
|
/**
|
|
799
856
|
* Optional metadata about the identity
|
|
800
857
|
*/
|
|
@@ -813,3 +870,63 @@ export interface AgentIdentity {
|
|
|
813
870
|
[key: string]: unknown;
|
|
814
871
|
};
|
|
815
872
|
}
|
|
873
|
+
/**
|
|
874
|
+
* Zod schema for AgentIdentity validation
|
|
875
|
+
*/
|
|
876
|
+
export declare const AgentIdentitySchema: z.ZodObject<{
|
|
877
|
+
did: z.ZodEffects<z.ZodString, string, string>;
|
|
878
|
+
publicKey: z.ZodString;
|
|
879
|
+
privateKey: z.ZodString;
|
|
880
|
+
createdAt: z.ZodString;
|
|
881
|
+
kta: z.ZodOptional<z.ZodObject<{
|
|
882
|
+
registered: z.ZodBoolean;
|
|
883
|
+
registeredAt: z.ZodString;
|
|
884
|
+
claimUrl: z.ZodNullable<z.ZodString>;
|
|
885
|
+
}, "strip", z.ZodTypeAny, {
|
|
886
|
+
registered: boolean;
|
|
887
|
+
registeredAt: string;
|
|
888
|
+
claimUrl: string | null;
|
|
889
|
+
}, {
|
|
890
|
+
registered: boolean;
|
|
891
|
+
registeredAt: string;
|
|
892
|
+
claimUrl: string | null;
|
|
893
|
+
}>>;
|
|
894
|
+
metadata: z.ZodOptional<z.ZodObject<{
|
|
895
|
+
name: z.ZodOptional<z.ZodString>;
|
|
896
|
+
version: z.ZodOptional<z.ZodString>;
|
|
897
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
898
|
+
name: z.ZodOptional<z.ZodString>;
|
|
899
|
+
version: z.ZodOptional<z.ZodString>;
|
|
900
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
901
|
+
name: z.ZodOptional<z.ZodString>;
|
|
902
|
+
version: z.ZodOptional<z.ZodString>;
|
|
903
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
904
|
+
}, "strip", z.ZodTypeAny, {
|
|
905
|
+
did: string;
|
|
906
|
+
publicKey: string;
|
|
907
|
+
privateKey: string;
|
|
908
|
+
createdAt: string;
|
|
909
|
+
kta?: {
|
|
910
|
+
registered: boolean;
|
|
911
|
+
registeredAt: string;
|
|
912
|
+
claimUrl: string | null;
|
|
913
|
+
} | undefined;
|
|
914
|
+
metadata?: z.objectOutputType<{
|
|
915
|
+
name: z.ZodOptional<z.ZodString>;
|
|
916
|
+
version: z.ZodOptional<z.ZodString>;
|
|
917
|
+
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
918
|
+
}, {
|
|
919
|
+
did: string;
|
|
920
|
+
publicKey: string;
|
|
921
|
+
privateKey: string;
|
|
922
|
+
createdAt: string;
|
|
923
|
+
kta?: {
|
|
924
|
+
registered: boolean;
|
|
925
|
+
registeredAt: string;
|
|
926
|
+
claimUrl: string | null;
|
|
927
|
+
} | undefined;
|
|
928
|
+
metadata?: z.objectInputType<{
|
|
929
|
+
name: z.ZodOptional<z.ZodString>;
|
|
930
|
+
version: z.ZodOptional<z.ZodString>;
|
|
931
|
+
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
932
|
+
}>;
|
package/dist/config/identity.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @module @kya-os/contracts/config
|
|
9
9
|
*/
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
exports.AuthProviderSchema = exports.OAuth2ProviderConfigSchema = exports.OAuthConfigSchema = exports.OAuthProviderSchema = exports.CredentialProviderConfigSchema = void 0;
|
|
11
|
+
exports.AgentIdentitySchema = exports.KTARegistrationSchema = exports.AuthProviderSchema = exports.OAuth2ProviderConfigSchema = exports.OAuthConfigSchema = exports.OAuthProviderSchema = exports.CredentialProviderConfigSchema = void 0;
|
|
12
12
|
const zod_1 = require("zod");
|
|
13
13
|
/**
|
|
14
14
|
* Zod schema for CredentialProviderConfig validation
|
|
@@ -64,7 +64,9 @@ exports.OAuthProviderSchema = zod_1.z.object({
|
|
|
64
64
|
proxyMode: zod_1.z.boolean().optional(),
|
|
65
65
|
// Phase 3: Custom IDP Support
|
|
66
66
|
customParams: zod_1.z.record(zod_1.z.string()).optional(),
|
|
67
|
-
tokenEndpointAuthMethod: zod_1.z
|
|
67
|
+
tokenEndpointAuthMethod: zod_1.z
|
|
68
|
+
.enum(["client_secret_post", "client_secret_basic"])
|
|
69
|
+
.optional(),
|
|
68
70
|
responseType: zod_1.z.string().optional().default("code"),
|
|
69
71
|
grantType: zod_1.z.string().optional().default("authorization_code"),
|
|
70
72
|
});
|
|
@@ -105,3 +107,33 @@ exports.AuthProviderSchema = zod_1.z.discriminatedUnion("type", [
|
|
|
105
107
|
exports.OAuth2ProviderConfigSchema,
|
|
106
108
|
exports.CredentialProviderConfigSchema,
|
|
107
109
|
]);
|
|
110
|
+
/**
|
|
111
|
+
* Zod schema for KTARegistration
|
|
112
|
+
*/
|
|
113
|
+
exports.KTARegistrationSchema = zod_1.z.object({
|
|
114
|
+
registered: zod_1.z.boolean(),
|
|
115
|
+
registeredAt: zod_1.z.string().datetime(),
|
|
116
|
+
claimUrl: zod_1.z.string().url().nullable(),
|
|
117
|
+
});
|
|
118
|
+
/**
|
|
119
|
+
* Zod schema for AgentIdentity validation
|
|
120
|
+
*/
|
|
121
|
+
exports.AgentIdentitySchema = zod_1.z.object({
|
|
122
|
+
did: zod_1.z
|
|
123
|
+
.string()
|
|
124
|
+
.min(1)
|
|
125
|
+
.refine((val) => val.startsWith("did:"), {
|
|
126
|
+
message: 'DID must start with "did:"',
|
|
127
|
+
}),
|
|
128
|
+
publicKey: zod_1.z.string().min(1),
|
|
129
|
+
privateKey: zod_1.z.string().min(1),
|
|
130
|
+
createdAt: zod_1.z.string().datetime(),
|
|
131
|
+
kta: exports.KTARegistrationSchema.optional(),
|
|
132
|
+
metadata: zod_1.z
|
|
133
|
+
.object({
|
|
134
|
+
name: zod_1.z.string().optional(),
|
|
135
|
+
version: zod_1.z.string().optional(),
|
|
136
|
+
})
|
|
137
|
+
.passthrough()
|
|
138
|
+
.optional(),
|
|
139
|
+
});
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @module @kya-os/contracts/config
|
|
8
8
|
*/
|
|
9
|
-
import type { ToolProtection as BaseToolProtection, ToolProtectionMap as BaseToolProtectionMap, DelegationRequiredErrorData as BaseDelegationRequiredErrorData, ToolProtectionResponse as BaseToolProtectionResponse } from
|
|
9
|
+
import type { ToolProtection as BaseToolProtection, ToolProtectionMap as BaseToolProtectionMap, DelegationRequiredErrorData as BaseDelegationRequiredErrorData, ToolProtectionResponse as BaseToolProtectionResponse } from "../tool-protection/index.js";
|
|
10
10
|
export type ToolProtection = BaseToolProtection;
|
|
11
11
|
export type ToolProtectionMap = BaseToolProtectionMap;
|
|
12
12
|
export type DelegationRequiredErrorData = BaseDelegationRequiredErrorData;
|
|
@@ -14,7 +14,7 @@ export type ToolProtectionResponse = BaseToolProtectionResponse;
|
|
|
14
14
|
/**
|
|
15
15
|
* Tool protection source types
|
|
16
16
|
*/
|
|
17
|
-
export type ToolProtectionSourceType =
|
|
17
|
+
export type ToolProtectionSourceType = "inline" | "local" | "agentshield" | "kta" | "multi";
|
|
18
18
|
/**
|
|
19
19
|
* Tool protection source configuration
|
|
20
20
|
* Defines where tool protection settings come from
|
|
@@ -83,7 +83,7 @@ export interface ToolProtectionSourceConfig {
|
|
|
83
83
|
/**
|
|
84
84
|
* Source configuration
|
|
85
85
|
*/
|
|
86
|
-
config: Omit<ToolProtectionSourceConfig,
|
|
86
|
+
config: Omit<ToolProtectionSourceConfig, "source" | "sources">;
|
|
87
87
|
/**
|
|
88
88
|
* Priority (higher number = higher priority)
|
|
89
89
|
* @default 0
|
|
@@ -96,9 +96,29 @@ export interface ToolProtectionSourceConfig {
|
|
|
96
96
|
exclusive?: boolean;
|
|
97
97
|
}>;
|
|
98
98
|
/**
|
|
99
|
-
*
|
|
99
|
+
* Local configuration (LOWEST priority after defaults)
|
|
100
|
+
*
|
|
101
|
+
* This config serves as a base that gets OVERRIDDEN by remote config.
|
|
102
|
+
* Use this for development defaults or project-specific base settings.
|
|
103
|
+
*
|
|
104
|
+
* Precedence order (highest to lowest):
|
|
105
|
+
* 1. Remote config (AgentShield API) - WINS
|
|
106
|
+
* 2. Local config (this field)
|
|
107
|
+
* 3. Framework defaults
|
|
100
108
|
*/
|
|
101
|
-
|
|
109
|
+
localConfig?: BaseToolProtectionMap;
|
|
110
|
+
/**
|
|
111
|
+
* Offline fallback configuration (ONLY used when API is unavailable)
|
|
112
|
+
*
|
|
113
|
+
* Unlike localConfig, this is NOT merged with remote config.
|
|
114
|
+
* It's only used as a complete replacement when the API cannot be reached.
|
|
115
|
+
*
|
|
116
|
+
* Fallback order when API fails:
|
|
117
|
+
* 1. Stale cache (if allowStaleCache=true)
|
|
118
|
+
* 2. This offlineFallbackConfig
|
|
119
|
+
* 3. failSafeBehavior (deny-all or allow-all)
|
|
120
|
+
*/
|
|
121
|
+
offlineFallbackConfig?: BaseToolProtectionMap;
|
|
102
122
|
/**
|
|
103
123
|
* Enable debug logging
|
|
104
124
|
* @default false
|
|
@@ -128,9 +148,14 @@ export interface ToolProtectionServiceConfig {
|
|
|
128
148
|
*/
|
|
129
149
|
cacheTtl?: number;
|
|
130
150
|
/**
|
|
131
|
-
*
|
|
151
|
+
* Local configuration (LOWEST priority after defaults)
|
|
152
|
+
* Gets OVERRIDDEN by remote config from AgentShield API.
|
|
153
|
+
*/
|
|
154
|
+
localConfig?: BaseToolProtectionMap;
|
|
155
|
+
/**
|
|
156
|
+
* Offline fallback configuration (ONLY used when API is unavailable)
|
|
132
157
|
*/
|
|
133
|
-
|
|
158
|
+
offlineFallbackConfig?: BaseToolProtectionMap;
|
|
134
159
|
/**
|
|
135
160
|
* Enable debug logging
|
|
136
161
|
* @default false
|