@kya-os/contracts 1.3.3 → 1.3.5

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 (66) hide show
  1. package/package.json +3 -2
  2. package/README.md +0 -130
  3. package/dist/agentshield-api/endpoints.d.ts +0 -21
  4. package/dist/agentshield-api/endpoints.js +0 -20
  5. package/dist/agentshield-api/index.d.ts +0 -5
  6. package/dist/agentshield-api/index.js +0 -27
  7. package/dist/agentshield-api/schemas.d.ts +0 -9846
  8. package/dist/agentshield-api/schemas.js +0 -92
  9. package/dist/agentshield-api/types.d.ts +0 -92
  10. package/dist/agentshield-api/types.js +0 -12
  11. package/dist/config/base.d.ts +0 -19
  12. package/dist/config/base.js +0 -2
  13. package/dist/config/delegation.d.ts +0 -46
  14. package/dist/config/delegation.js +0 -2
  15. package/dist/config/identity.d.ts +0 -22
  16. package/dist/config/identity.js +0 -2
  17. package/dist/config/index.d.ts +0 -17
  18. package/dist/config/index.js +0 -2
  19. package/dist/config/proofing.d.ts +0 -26
  20. package/dist/config/proofing.js +0 -2
  21. package/dist/config/tool-protection.d.ts +0 -36
  22. package/dist/config/tool-protection.js +0 -2
  23. package/dist/delegation/constraints.d.ts +0 -726
  24. package/dist/delegation/constraints.js +0 -103
  25. package/dist/delegation/index.d.ts +0 -2
  26. package/dist/delegation/index.js +0 -18
  27. package/dist/delegation/schemas.d.ts +0 -8042
  28. package/dist/delegation/schemas.js +0 -232
  29. package/dist/did/index.d.ts +0 -3
  30. package/dist/did/index.js +0 -19
  31. package/dist/did/resolve-contract.d.ts +0 -53
  32. package/dist/did/resolve-contract.js +0 -12
  33. package/dist/did/schemas.d.ts +0 -33
  34. package/dist/did/schemas.js +0 -80
  35. package/dist/did/types.d.ts +0 -38
  36. package/dist/did/types.js +0 -37
  37. package/dist/env/constants.d.ts +0 -13
  38. package/dist/env/constants.js +0 -15
  39. package/dist/env/index.d.ts +0 -1
  40. package/dist/env/index.js +0 -17
  41. package/dist/proof/index.d.ts +0 -2
  42. package/dist/proof/index.js +0 -18
  43. package/dist/proof/proof-record.d.ts +0 -728
  44. package/dist/proof/proof-record.js +0 -60
  45. package/dist/proof/signing-spec.d.ts +0 -73
  46. package/dist/proof/signing-spec.js +0 -52
  47. package/dist/runtime/errors.d.ts +0 -179
  48. package/dist/runtime/errors.js +0 -51
  49. package/dist/runtime/headers.d.ts +0 -34
  50. package/dist/runtime/headers.js +0 -52
  51. package/dist/runtime/index.d.ts +0 -2
  52. package/dist/runtime/index.js +0 -18
  53. package/dist/tlkrc/index.d.ts +0 -1
  54. package/dist/tlkrc/index.js +0 -17
  55. package/dist/tlkrc/rotation.d.ts +0 -168
  56. package/dist/tlkrc/rotation.js +0 -55
  57. package/dist/tool-protection/index.d.ts +0 -129
  58. package/dist/tool-protection/index.js +0 -80
  59. package/dist/vc/index.d.ts +0 -2
  60. package/dist/vc/index.js +0 -18
  61. package/dist/vc/schemas.d.ts +0 -1888
  62. package/dist/vc/schemas.js +0 -116
  63. package/dist/vc/statuslist.d.ts +0 -292
  64. package/dist/vc/statuslist.js +0 -61
  65. package/dist/well-known/index.d.ts +0 -248
  66. package/dist/well-known/index.js +0 -104
@@ -1,92 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- 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;
4
- const zod_1 = require("zod");
5
- const proof_js_1 = require("../proof.js");
6
- const index_js_1 = require("../delegation/index.js");
7
- exports.agentShieldAPIErrorSchema = zod_1.z.object({
8
- code: zod_1.z.string(),
9
- message: zod_1.z.string(),
10
- details: zod_1.z.record(zod_1.z.unknown()).optional(),
11
- });
12
- const agentShieldAPIResponseSchema = (dataSchema) => zod_1.z.object({
13
- success: zod_1.z.boolean(),
14
- data: dataSchema,
15
- metadata: zod_1.z.object({
16
- requestId: zod_1.z.string(),
17
- timestamp: zod_1.z.string(),
18
- }).optional(),
19
- });
20
- exports.agentShieldAPIResponseSchema = agentShieldAPIResponseSchema;
21
- exports.proofSubmissionRequestSchema = zod_1.z.object({
22
- delegation_id: zod_1.z.string().uuid().nullable(),
23
- session_id: zod_1.z.string().uuid(),
24
- proofs: zod_1.z.array(proof_js_1.DetachedProofSchema).min(1),
25
- });
26
- exports.proofSubmissionResponseSchema = zod_1.z.object({
27
- success: zod_1.z.boolean(),
28
- received: zod_1.z.number().int().min(0),
29
- processed: zod_1.z.number().int().min(0),
30
- errors: zod_1.z.array(zod_1.z.object({
31
- proofId: zod_1.z.string(),
32
- error: zod_1.z.string(),
33
- })).optional(),
34
- });
35
- exports.delegationCredentialSchema = zod_1.z.object({
36
- agent_did: zod_1.z.string(),
37
- user_id: zod_1.z.string().optional(),
38
- user_identifier: zod_1.z.string().optional(),
39
- scopes: zod_1.z.array(zod_1.z.string()),
40
- constraints: zod_1.z.record(zod_1.z.unknown()).optional(),
41
- issued_at: zod_1.z.number().int().positive(),
42
- created_at: zod_1.z.number().int().positive(),
43
- });
44
- exports.verifyDelegationRequestSchema = zod_1.z.object({
45
- agent_did: zod_1.z.string(),
46
- scopes: zod_1.z.array(zod_1.z.string()).min(1),
47
- timestamp: zod_1.z.number().int().positive().optional(),
48
- client_info: zod_1.z.object({
49
- ip_address: zod_1.z.string().ip().optional(),
50
- origin: zod_1.z.string().url().optional(),
51
- user_agent: zod_1.z.string().optional(),
52
- }).optional(),
53
- });
54
- exports.verifyDelegationResponseSchema = zod_1.z.object({
55
- valid: zod_1.z.boolean(),
56
- delegation: index_js_1.DelegationRecordSchema.optional(),
57
- delegation_id: zod_1.z.string().uuid().optional(),
58
- credential: exports.delegationCredentialSchema.optional(),
59
- error: exports.agentShieldAPIErrorSchema.optional(),
60
- reason: zod_1.z.string().optional(),
61
- });
62
- exports.verifyDelegationAPIResponseSchema = (0, exports.agentShieldAPIResponseSchema)(exports.verifyDelegationResponseSchema);
63
- exports.agentShieldToolProtectionSchema = zod_1.z.object({
64
- scopes: zod_1.z.array(zod_1.z.string()),
65
- requires_delegation: zod_1.z.boolean().optional(),
66
- requiresDelegation: zod_1.z.boolean().optional(),
67
- required_scopes: zod_1.z.array(zod_1.z.string()).optional(),
68
- }).passthrough();
69
- exports.toolProtectionConfigResponseSchema = zod_1.z.object({
70
- agent_did: zod_1.z.string(),
71
- tools: zod_1.z.record(zod_1.z.string(), exports.agentShieldToolProtectionSchema),
72
- reputation_threshold: zod_1.z.number().min(0).max(1).optional(),
73
- denied_agents: zod_1.z.array(zod_1.z.string()).optional(),
74
- });
75
- exports.toolProtectionConfigAPIResponseSchema = (0, exports.agentShieldAPIResponseSchema)(exports.toolProtectionConfigResponseSchema);
76
- exports.createDelegationRequestSchema = zod_1.z.object({
77
- delegation: index_js_1.DelegationRecordSchema,
78
- });
79
- exports.createDelegationResponseSchema = zod_1.z.object({
80
- delegation_id: zod_1.z.string().uuid(),
81
- delegation: index_js_1.DelegationRecordSchema,
82
- });
83
- exports.createDelegationAPIResponseSchema = (0, exports.agentShieldAPIResponseSchema)(exports.createDelegationResponseSchema);
84
- exports.revokeDelegationRequestSchema = zod_1.z.object({
85
- reason: zod_1.z.string().optional(),
86
- });
87
- exports.revokeDelegationResponseSchema = zod_1.z.object({
88
- delegation_id: zod_1.z.string().uuid(),
89
- revoked: zod_1.z.boolean(),
90
- revoked_at: zod_1.z.number().int().positive(),
91
- });
92
- exports.revokeDelegationAPIResponseSchema = (0, exports.agentShieldAPIResponseSchema)(exports.revokeDelegationResponseSchema);
@@ -1,92 +0,0 @@
1
- import type { DetachedProof } from '../proof.js';
2
- import type { DelegationRecord } from '../delegation/index.js';
3
- export interface AgentShieldAPIResponse<T> {
4
- success: boolean;
5
- data: T;
6
- metadata?: {
7
- requestId: string;
8
- timestamp: string;
9
- };
10
- }
11
- export interface AgentShieldAPIErrorResponse {
12
- code: string;
13
- message: string;
14
- details?: Record<string, unknown>;
15
- }
16
- export interface ProofSubmissionRequest {
17
- delegation_id: string | null;
18
- session_id: string;
19
- proofs: DetachedProof[];
20
- }
21
- export interface ProofSubmissionResponse {
22
- success: boolean;
23
- received: number;
24
- processed: number;
25
- errors?: Array<{
26
- proofId: string;
27
- error: string;
28
- }>;
29
- }
30
- export interface VerifyDelegationRequest {
31
- agent_did: string;
32
- scopes: string[];
33
- timestamp?: number;
34
- client_info?: {
35
- ip_address?: string;
36
- origin?: string;
37
- user_agent?: string;
38
- };
39
- }
40
- export interface DelegationCredential {
41
- agent_did: string;
42
- user_id?: string;
43
- user_identifier?: string;
44
- scopes: string[];
45
- constraints?: Record<string, unknown>;
46
- issued_at: number;
47
- created_at: number;
48
- }
49
- export interface VerifyDelegationResponse {
50
- valid: boolean;
51
- delegation?: DelegationRecord;
52
- delegation_id?: string;
53
- credential?: DelegationCredential;
54
- error?: AgentShieldAPIErrorResponse;
55
- reason?: string;
56
- }
57
- export type VerifyDelegationAPIResponse = AgentShieldAPIResponse<VerifyDelegationResponse>;
58
- export interface AgentShieldToolProtection {
59
- scopes: string[];
60
- requires_delegation?: boolean;
61
- requiresDelegation?: boolean;
62
- required_scopes?: string[];
63
- }
64
- export interface ToolProtectionConfigResponse {
65
- agent_did: string;
66
- tools: Record<string, AgentShieldToolProtection>;
67
- reputation_threshold?: number;
68
- denied_agents?: string[];
69
- }
70
- export type ToolProtectionConfigAPIResponse = AgentShieldAPIResponse<ToolProtectionConfigResponse>;
71
- export interface CreateDelegationRequest {
72
- delegation: DelegationRecord;
73
- }
74
- export interface CreateDelegationResponse {
75
- delegation_id: string;
76
- delegation: DelegationRecord;
77
- }
78
- export type CreateDelegationAPIResponse = AgentShieldAPIResponse<CreateDelegationResponse>;
79
- export interface RevokeDelegationRequest {
80
- reason?: string;
81
- }
82
- export interface RevokeDelegationResponse {
83
- delegation_id: string;
84
- revoked: boolean;
85
- revoked_at: number;
86
- }
87
- export type RevokeDelegationAPIResponse = AgentShieldAPIResponse<RevokeDelegationResponse>;
88
- export declare class AgentShieldAPIError extends Error {
89
- readonly code: string;
90
- readonly details?: Record<string, unknown> | undefined;
91
- constructor(code: string, message: string, details?: Record<string, unknown> | undefined);
92
- }
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AgentShieldAPIError = void 0;
4
- class AgentShieldAPIError extends Error {
5
- constructor(code, message, details) {
6
- super(message);
7
- this.code = code;
8
- this.details = details;
9
- this.name = 'AgentShieldAPIError';
10
- }
11
- }
12
- exports.AgentShieldAPIError = AgentShieldAPIError;
@@ -1,19 +0,0 @@
1
- export interface MCPIBaseConfig {
2
- environment: 'development' | 'production';
3
- session?: {
4
- timestampSkewSeconds?: number;
5
- ttlMinutes?: number;
6
- absoluteLifetime?: number;
7
- };
8
- audit?: {
9
- enabled: boolean;
10
- includeProofHashes?: boolean;
11
- includePayloads?: boolean;
12
- logFunction?: (record: string) => void;
13
- };
14
- wellKnown?: {
15
- enabled: boolean;
16
- serviceName?: string;
17
- serviceEndpoint?: string;
18
- };
19
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,46 +0,0 @@
1
- export type DelegationVerifierType = 'agentshield' | 'kta' | 'memory' | 'cloudflare-kv' | 'redis' | 'dynamodb' | 'custom';
2
- export interface DelegationVerifierConfig {
3
- type: DelegationVerifierType;
4
- apiUrl?: string;
5
- apiKey?: string;
6
- cacheTtl?: number;
7
- customVerifier?: {
8
- verify: (agentDid: string, scopes: string[]) => Promise<boolean>;
9
- invalidate?: (agentDid: string) => Promise<void>;
10
- };
11
- options?: Record<string, unknown>;
12
- }
13
- export interface AuthorizationConfig {
14
- authorizationUrl?: string;
15
- kta?: {
16
- apiUrl: string;
17
- apiKey?: string;
18
- };
19
- minReputationScore?: number;
20
- resumeTokenTtl?: number;
21
- requireAuthForUnknown?: boolean;
22
- buildAuthUrl?: (toolName: string, scopes: string[], context: any) => string;
23
- }
24
- export interface DelegationConfig {
25
- enabled: boolean;
26
- enforceDelegations?: boolean;
27
- verifier: DelegationVerifierConfig;
28
- authorization?: AuthorizationConfig;
29
- debug?: boolean;
30
- }
31
- export interface DelegationRecord {
32
- id: string;
33
- userId: string;
34
- agentDid: string;
35
- scopes: string[];
36
- createdAt: string;
37
- expiresAt?: string;
38
- revoked?: boolean;
39
- constraints?: {
40
- allowedIps?: string[];
41
- allowedOrigins?: string[];
42
- maxUses?: number;
43
- currentUses?: number;
44
- [key: string]: unknown;
45
- };
46
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,22 +0,0 @@
1
- export interface RuntimeIdentityConfig {
2
- enabled: boolean;
3
- environment: 'development' | 'production';
4
- production?: {
5
- privateKeyEnv?: string;
6
- publicKeyEnv?: string;
7
- didEnv?: string;
8
- };
9
- privacyMode?: boolean;
10
- debug?: boolean;
11
- }
12
- export interface AgentIdentity {
13
- did: string;
14
- publicKey: string;
15
- privateKey: string;
16
- createdAt: string;
17
- metadata?: {
18
- name?: string;
19
- version?: string;
20
- [key: string]: unknown;
21
- };
22
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,17 +0,0 @@
1
- import type { MCPIBaseConfig } from './base.js';
2
- import type { RuntimeIdentityConfig } from './identity.js';
3
- import type { ProofingConfig } from './proofing.js';
4
- import type { DelegationConfig } from './delegation.js';
5
- import type { ToolProtectionSourceConfig } from './tool-protection.js';
6
- export { MCPIBaseConfig } from './base.js';
7
- export { RuntimeIdentityConfig, AgentIdentity } from './identity.js';
8
- export type IdentityConfig = RuntimeIdentityConfig;
9
- export { ProofingConfig, ProofBatchQueueConfig, ProofDestination, ProofDestinationType } from './proofing.js';
10
- export { DelegationConfig, DelegationVerifierConfig, DelegationVerifierType, AuthorizationConfig, DelegationRecord } from './delegation.js';
11
- export { ToolProtection, ToolProtectionMap, ToolProtectionSourceConfig, ToolProtectionSourceType, ToolProtectionServiceConfig, DelegationRequiredErrorData, ToolProtectionResponse } from './tool-protection.js';
12
- export interface MCPIConfig extends MCPIBaseConfig {
13
- identity?: RuntimeIdentityConfig;
14
- proofing?: ProofingConfig;
15
- delegation?: DelegationConfig;
16
- toolProtection?: ToolProtectionSourceConfig;
17
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,26 +0,0 @@
1
- export type ProofDestinationType = 'agentshield' | 'kta' | 'custom';
2
- export interface ProofDestination {
3
- type: ProofDestinationType;
4
- apiUrl?: string;
5
- apiKey?: string;
6
- submit?: (proofs: any[]) => Promise<void>;
7
- options?: Record<string, unknown>;
8
- }
9
- export interface ProofBatchQueueConfig {
10
- destinations: ProofDestination[];
11
- maxBatchSize?: number;
12
- flushIntervalMs?: number;
13
- maxRetries?: number;
14
- retryBackoff?: number;
15
- debug?: boolean;
16
- }
17
- export interface ProofingConfig {
18
- enabled: boolean;
19
- batchQueue?: ProofBatchQueueConfig;
20
- includeMetadata?: boolean;
21
- options?: {
22
- includeTimestamp?: boolean;
23
- includeSession?: boolean;
24
- customFields?: Record<string, unknown>;
25
- };
26
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,36 +0,0 @@
1
- import type { ToolProtection as BaseToolProtection, ToolProtectionMap as BaseToolProtectionMap, DelegationRequiredErrorData as BaseDelegationRequiredErrorData, ToolProtectionResponse as BaseToolProtectionResponse } from '../tool-protection/index.js';
2
- export type ToolProtection = BaseToolProtection;
3
- export type ToolProtectionMap = BaseToolProtectionMap;
4
- export type DelegationRequiredErrorData = BaseDelegationRequiredErrorData;
5
- export type ToolProtectionResponse = BaseToolProtectionResponse;
6
- export type ToolProtectionSourceType = 'inline' | 'local' | 'agentshield' | 'kta' | 'multi';
7
- export interface ToolProtectionSourceConfig {
8
- source: ToolProtectionSourceType;
9
- inline?: BaseToolProtectionMap;
10
- localFile?: string;
11
- agentShield?: {
12
- apiUrl: string;
13
- apiKey?: string;
14
- projectId?: string;
15
- cacheTtl?: number;
16
- };
17
- kta?: {
18
- apiUrl: string;
19
- apiKey?: string;
20
- };
21
- sources?: Array<{
22
- config: Omit<ToolProtectionSourceConfig, 'source' | 'sources'>;
23
- priority?: number;
24
- exclusive?: boolean;
25
- }>;
26
- fallback?: BaseToolProtectionMap;
27
- debug?: boolean;
28
- }
29
- export interface ToolProtectionServiceConfig {
30
- apiUrl: string;
31
- apiKey: string;
32
- projectId?: string;
33
- cacheTtl?: number;
34
- fallbackConfig?: BaseToolProtectionMap;
35
- debug?: boolean;
36
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });