@kya-os/contracts 1.3.2 → 1.3.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.
- package/package.json +28 -5
- package/README.md +0 -130
- package/dist/cli.d.ts +0 -378
- package/dist/cli.js +0 -116
- package/dist/delegation/constraints.d.ts +0 -992
- package/dist/delegation/constraints.js +0 -210
- package/dist/delegation/index.d.ts +0 -8
- package/dist/delegation/index.js +0 -24
- package/dist/delegation/schemas.d.ts +0 -8382
- package/dist/delegation/schemas.js +0 -476
- package/dist/did/index.d.ts +0 -9
- package/dist/did/index.js +0 -25
- package/dist/did/resolve-contract.d.ts +0 -220
- package/dist/did/resolve-contract.js +0 -32
- package/dist/did/schemas.d.ts +0 -113
- package/dist/did/schemas.js +0 -173
- package/dist/did/types.d.ts +0 -164
- package/dist/did/types.js +0 -71
- package/dist/env/constants.d.ts +0 -58
- package/dist/env/constants.js +0 -60
- package/dist/env/index.d.ts +0 -5
- package/dist/env/index.js +0 -21
- package/dist/handshake.d.ts +0 -159
- package/dist/handshake.js +0 -58
- package/dist/index.d.ts +0 -26
- package/dist/index.js +0 -53
- package/dist/proof/index.d.ts +0 -9
- package/dist/proof/index.js +0 -25
- package/dist/proof/proof-record.d.ts +0 -838
- package/dist/proof/proof-record.js +0 -134
- package/dist/proof/signing-spec.d.ts +0 -147
- package/dist/proof/signing-spec.js +0 -123
- package/dist/proof.d.ts +0 -400
- package/dist/proof.js +0 -82
- package/dist/registry.d.ts +0 -343
- package/dist/registry.js +0 -119
- package/dist/runtime/errors.d.ts +0 -348
- package/dist/runtime/errors.js +0 -120
- package/dist/runtime/headers.d.ts +0 -84
- package/dist/runtime/headers.js +0 -82
- package/dist/runtime/index.d.ts +0 -6
- package/dist/runtime/index.js +0 -22
- package/dist/test.d.ts +0 -252
- package/dist/test.js +0 -120
- package/dist/tlkrc/index.d.ts +0 -5
- package/dist/tlkrc/index.js +0 -21
- package/dist/tlkrc/rotation.d.ts +0 -246
- package/dist/tlkrc/rotation.js +0 -127
- package/dist/utils/validation.d.ts +0 -31
- package/dist/utils/validation.js +0 -70
- package/dist/vc/index.d.ts +0 -8
- package/dist/vc/index.js +0 -24
- package/dist/vc/schemas.d.ts +0 -2484
- package/dist/vc/schemas.js +0 -225
- package/dist/vc/statuslist.d.ts +0 -494
- package/dist/vc/statuslist.js +0 -133
- package/dist/verifier.d.ts +0 -206
- package/dist/verifier.js +0 -84
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kya-os/contracts",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.4",
|
|
4
4
|
"description": "Shared types and schemas for XMCP-I ecosystem",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -71,6 +71,26 @@
|
|
|
71
71
|
"types": "./dist/env/index.d.ts",
|
|
72
72
|
"import": "./dist/env/index.js",
|
|
73
73
|
"require": "./dist/env/index.js"
|
|
74
|
+
},
|
|
75
|
+
"./agentshield-api": {
|
|
76
|
+
"types": "./dist/agentshield-api/index.d.ts",
|
|
77
|
+
"import": "./dist/agentshield-api/index.js",
|
|
78
|
+
"require": "./dist/agentshield-api/index.js"
|
|
79
|
+
},
|
|
80
|
+
"./tool-protection": {
|
|
81
|
+
"types": "./dist/tool-protection/index.d.ts",
|
|
82
|
+
"import": "./dist/tool-protection/index.js",
|
|
83
|
+
"require": "./dist/tool-protection/index.js"
|
|
84
|
+
},
|
|
85
|
+
"./well-known": {
|
|
86
|
+
"types": "./dist/well-known/index.d.ts",
|
|
87
|
+
"import": "./dist/well-known/index.js",
|
|
88
|
+
"require": "./dist/well-known/index.js"
|
|
89
|
+
},
|
|
90
|
+
"./config": {
|
|
91
|
+
"types": "./dist/config/index.d.ts",
|
|
92
|
+
"import": "./dist/config/index.js",
|
|
93
|
+
"require": "./dist/config/index.js"
|
|
74
94
|
}
|
|
75
95
|
},
|
|
76
96
|
"files": [
|
|
@@ -81,7 +101,9 @@
|
|
|
81
101
|
"!dist/**/__fixtures__/**",
|
|
82
102
|
"!dist/**/*.spec.*",
|
|
83
103
|
"!dist/**/*.test.*",
|
|
84
|
-
"README.md"
|
|
104
|
+
"!README.md",
|
|
105
|
+
"!*.md",
|
|
106
|
+
"!CHANGELOG.md"
|
|
85
107
|
],
|
|
86
108
|
"scripts": {
|
|
87
109
|
"build": "tsc -p tsconfig.build.json && npm run emit-schemas",
|
|
@@ -91,16 +113,17 @@
|
|
|
91
113
|
"type-check": "tsc --noEmit",
|
|
92
114
|
"test": "vitest run",
|
|
93
115
|
"test:watch": "vitest",
|
|
94
|
-
"test:coverage": "vitest run --coverage"
|
|
116
|
+
"test:coverage": "vitest run --coverage",
|
|
117
|
+
"prepublishOnly": "npm run build && node ../create-mcpi-app/scripts/validate-no-workspace.js"
|
|
95
118
|
},
|
|
96
119
|
"devDependencies": {
|
|
97
120
|
"@types/node": "^20.0.0",
|
|
98
|
-
"@vitest/coverage-v8": "^
|
|
121
|
+
"@vitest/coverage-v8": "^4.0.5",
|
|
99
122
|
"ajv": "^8.12.0",
|
|
100
123
|
"ajv-formats": "^2.1.1",
|
|
101
124
|
"fast-check": "^3.15.0",
|
|
102
125
|
"typescript": "^5.0.0",
|
|
103
|
-
"vitest": "^
|
|
126
|
+
"vitest": "^4.0.5",
|
|
104
127
|
"zod-to-json-schema": "^3.22.0"
|
|
105
128
|
},
|
|
106
129
|
"dependencies": {
|
package/README.md
DELETED
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
# @kya-os/contracts
|
|
2
|
-
|
|
3
|
-
Shared types and schemas for the XMCP-I ecosystem. This package provides a single source of truth for all contracts used across runtime, CLI, verifier, and registry components.
|
|
4
|
-
|
|
5
|
-
## Features
|
|
6
|
-
|
|
7
|
-
- **Type-safe contracts** using Zod schemas
|
|
8
|
-
- **Subpath exports** for modular imports
|
|
9
|
-
- **JSON schemas** with versioning for external validation
|
|
10
|
-
- **Zero runtime dependencies** (except Zod)
|
|
11
|
-
- **ESM-only** with tree-shaking support
|
|
12
|
-
|
|
13
|
-
## Installation
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
npm install @kya-os/contracts
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
## Usage
|
|
20
|
-
|
|
21
|
-
### Subpath Imports
|
|
22
|
-
|
|
23
|
-
```typescript
|
|
24
|
-
// Import specific namespaces
|
|
25
|
-
import { HandshakeRequest, SessionContext } from "@kya-os/contracts/handshake";
|
|
26
|
-
import { DetachedProof, ProofMeta } from "@kya-os/contracts/proof";
|
|
27
|
-
import { AgentContext, AGENT_HEADERS } from "@kya-os/contracts/verifier";
|
|
28
|
-
import {
|
|
29
|
-
RegistrationResult,
|
|
30
|
-
MCP_I_CAPABILITIES,
|
|
31
|
-
} from "@kya-os/contracts/registry";
|
|
32
|
-
import { StatusReport, ERROR_CODES } from "@kya-os/contracts/cli";
|
|
33
|
-
|
|
34
|
-
// Or import everything
|
|
35
|
-
import * as Contracts from "@kya-os/contracts";
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
### Schema Validation
|
|
39
|
-
|
|
40
|
-
```typescript
|
|
41
|
-
import { DetachedProofSchema } from "@kya-os/contracts/proof";
|
|
42
|
-
|
|
43
|
-
// Validate data at runtime
|
|
44
|
-
const result = DetachedProofSchema.safeParse(data);
|
|
45
|
-
if (result.success) {
|
|
46
|
-
// data is now typed as DetachedProof
|
|
47
|
-
console.log(result.data.meta.did);
|
|
48
|
-
}
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
### JSON Schemas
|
|
52
|
-
|
|
53
|
-
JSON schemas are available under the `/schemas/**` subpath:
|
|
54
|
-
|
|
55
|
-
```typescript
|
|
56
|
-
// Access versioned JSON schemas
|
|
57
|
-
import proofSchema from "@kya-os/contracts/schemas/proof/v1.0.0.json";
|
|
58
|
-
import agentSchema from "@kya-os/contracts/schemas/well-known/agent/v1.0.0.json";
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
## Namespaces
|
|
62
|
-
|
|
63
|
-
### Handshake (`/handshake`)
|
|
64
|
-
|
|
65
|
-
- `HandshakeRequest` - Nonce, audience, timestamp validation
|
|
66
|
-
- `SessionContext` - Session management and TTL
|
|
67
|
-
- `NonceCacheEntry` - Nonce cache storage
|
|
68
|
-
|
|
69
|
-
### Proof (`/proof`)
|
|
70
|
-
|
|
71
|
-
- `DetachedProof` - JWS signature with metadata
|
|
72
|
-
- `ProofMeta` - Proof metadata fields
|
|
73
|
-
- `AuditRecord` - Audit logging format
|
|
74
|
-
|
|
75
|
-
### Verifier (`/verifier`)
|
|
76
|
-
|
|
77
|
-
- `AgentContext` - Verified agent information
|
|
78
|
-
- `VerifierResult` - Middleware validation results
|
|
79
|
-
- `AGENT_HEADERS` - Frozen header name constants
|
|
80
|
-
|
|
81
|
-
### Registry (`/registry`)
|
|
82
|
-
|
|
83
|
-
- `RegistrationResult` - KTA registration response
|
|
84
|
-
- `AgentStatus` - Agent status reporting
|
|
85
|
-
- `MCP_I_CAPABILITIES` - Protocol capability constants
|
|
86
|
-
|
|
87
|
-
### CLI (`/cli`)
|
|
88
|
-
|
|
89
|
-
- `StatusReport` - CLI status command output
|
|
90
|
-
- `ScaffolderResult` - Scaffolder operation results
|
|
91
|
-
- `ERROR_CODES` - Error code constants
|
|
92
|
-
|
|
93
|
-
## Versioning
|
|
94
|
-
|
|
95
|
-
This package follows semantic versioning:
|
|
96
|
-
|
|
97
|
-
- **Major**: Breaking changes to existing contracts
|
|
98
|
-
- **Minor**: Additive changes (new fields, optional properties)
|
|
99
|
-
- **Patch**: Bug fixes and documentation updates
|
|
100
|
-
|
|
101
|
-
JSON schemas are versioned independently under `/schemas/{namespace}/v{major}.{minor}.{patch}.json`.
|
|
102
|
-
|
|
103
|
-
## Type Safety
|
|
104
|
-
|
|
105
|
-
All types are derived from Zod schemas to ensure runtime validation matches TypeScript types:
|
|
106
|
-
|
|
107
|
-
```typescript
|
|
108
|
-
// Schema definition
|
|
109
|
-
export const ProofMetaSchema = z.object({
|
|
110
|
-
did: z.string().min(1),
|
|
111
|
-
kid: z.string().min(1),
|
|
112
|
-
// ...
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
// Type derived from schema
|
|
116
|
-
export type ProofMeta = z.infer<typeof ProofMetaSchema>;
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
## Bundle Size
|
|
120
|
-
|
|
121
|
-
This package is optimized for minimal bundle impact:
|
|
122
|
-
|
|
123
|
-
- **Tarball size**: < 50 KB
|
|
124
|
-
- **Side effects**: None (`"sideEffects": false`)
|
|
125
|
-
- **Tree-shaking**: Full ESM support
|
|
126
|
-
- **Dependencies**: Only Zod for schema validation
|
|
127
|
-
|
|
128
|
-
## License
|
|
129
|
-
|
|
130
|
-
MIT
|
package/dist/cli.d.ts
DELETED
|
@@ -1,378 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
/**
|
|
3
|
-
* CLI command schemas and results
|
|
4
|
-
*/
|
|
5
|
-
export declare const IdentityConfigSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
6
|
-
version: z.ZodLiteral<"1.0">;
|
|
7
|
-
did: z.ZodString;
|
|
8
|
-
kid: z.ZodOptional<z.ZodString>;
|
|
9
|
-
keyId: z.ZodOptional<z.ZodString>;
|
|
10
|
-
privateKey: z.ZodString;
|
|
11
|
-
publicKey: z.ZodString;
|
|
12
|
-
createdAt: z.ZodString;
|
|
13
|
-
lastRotated: z.ZodOptional<z.ZodString>;
|
|
14
|
-
}, "strip", z.ZodTypeAny, {
|
|
15
|
-
version: "1.0";
|
|
16
|
-
did: string;
|
|
17
|
-
privateKey: string;
|
|
18
|
-
publicKey: string;
|
|
19
|
-
createdAt: string;
|
|
20
|
-
kid?: string | undefined;
|
|
21
|
-
keyId?: string | undefined;
|
|
22
|
-
lastRotated?: string | undefined;
|
|
23
|
-
}, {
|
|
24
|
-
version: "1.0";
|
|
25
|
-
did: string;
|
|
26
|
-
privateKey: string;
|
|
27
|
-
publicKey: string;
|
|
28
|
-
createdAt: string;
|
|
29
|
-
kid?: string | undefined;
|
|
30
|
-
keyId?: string | undefined;
|
|
31
|
-
lastRotated?: string | undefined;
|
|
32
|
-
}>, {
|
|
33
|
-
version: "1.0";
|
|
34
|
-
did: string;
|
|
35
|
-
privateKey: string;
|
|
36
|
-
publicKey: string;
|
|
37
|
-
createdAt: string;
|
|
38
|
-
kid?: string | undefined;
|
|
39
|
-
keyId?: string | undefined;
|
|
40
|
-
lastRotated?: string | undefined;
|
|
41
|
-
}, {
|
|
42
|
-
version: "1.0";
|
|
43
|
-
did: string;
|
|
44
|
-
privateKey: string;
|
|
45
|
-
publicKey: string;
|
|
46
|
-
createdAt: string;
|
|
47
|
-
kid?: string | undefined;
|
|
48
|
-
keyId?: string | undefined;
|
|
49
|
-
lastRotated?: string | undefined;
|
|
50
|
-
}>, {
|
|
51
|
-
version: "1.0";
|
|
52
|
-
did: string;
|
|
53
|
-
kid: string;
|
|
54
|
-
privateKey: string;
|
|
55
|
-
publicKey: string;
|
|
56
|
-
createdAt: string;
|
|
57
|
-
lastRotated: string | undefined;
|
|
58
|
-
}, {
|
|
59
|
-
version: "1.0";
|
|
60
|
-
did: string;
|
|
61
|
-
privateKey: string;
|
|
62
|
-
publicKey: string;
|
|
63
|
-
createdAt: string;
|
|
64
|
-
kid?: string | undefined;
|
|
65
|
-
keyId?: string | undefined;
|
|
66
|
-
lastRotated?: string | undefined;
|
|
67
|
-
}>;
|
|
68
|
-
export declare const KeyRotationResultSchema: z.ZodObject<{
|
|
69
|
-
success: z.ZodBoolean;
|
|
70
|
-
oldKeyId: z.ZodString;
|
|
71
|
-
newKeyId: z.ZodString;
|
|
72
|
-
did: z.ZodString;
|
|
73
|
-
mode: z.ZodEnum<["dev", "prod"]>;
|
|
74
|
-
delegated: z.ZodBoolean;
|
|
75
|
-
forced: z.ZodBoolean;
|
|
76
|
-
auditLine: z.ZodString;
|
|
77
|
-
}, "strip", z.ZodTypeAny, {
|
|
78
|
-
did: string;
|
|
79
|
-
success: boolean;
|
|
80
|
-
oldKeyId: string;
|
|
81
|
-
newKeyId: string;
|
|
82
|
-
mode: "dev" | "prod";
|
|
83
|
-
delegated: boolean;
|
|
84
|
-
forced: boolean;
|
|
85
|
-
auditLine: string;
|
|
86
|
-
}, {
|
|
87
|
-
did: string;
|
|
88
|
-
success: boolean;
|
|
89
|
-
oldKeyId: string;
|
|
90
|
-
newKeyId: string;
|
|
91
|
-
mode: "dev" | "prod";
|
|
92
|
-
delegated: boolean;
|
|
93
|
-
forced: boolean;
|
|
94
|
-
auditLine: string;
|
|
95
|
-
}>;
|
|
96
|
-
export declare const StatusReportSchema: z.ZodObject<{
|
|
97
|
-
did: z.ZodString;
|
|
98
|
-
kid: z.ZodString;
|
|
99
|
-
ktaURL: z.ZodString;
|
|
100
|
-
mirrorStatus: z.ZodEnum<["pending", "success", "error"]>;
|
|
101
|
-
lastHandshake: z.ZodOptional<z.ZodNumber>;
|
|
102
|
-
environment: z.ZodEnum<["dev", "prod"]>;
|
|
103
|
-
}, "strip", z.ZodTypeAny, {
|
|
104
|
-
did: string;
|
|
105
|
-
kid: string;
|
|
106
|
-
ktaURL: string;
|
|
107
|
-
mirrorStatus: "success" | "pending" | "error";
|
|
108
|
-
environment: "dev" | "prod";
|
|
109
|
-
lastHandshake?: number | undefined;
|
|
110
|
-
}, {
|
|
111
|
-
did: string;
|
|
112
|
-
kid: string;
|
|
113
|
-
ktaURL: string;
|
|
114
|
-
mirrorStatus: "success" | "pending" | "error";
|
|
115
|
-
environment: "dev" | "prod";
|
|
116
|
-
lastHandshake?: number | undefined;
|
|
117
|
-
}>;
|
|
118
|
-
export declare const PackageInfoSchema: z.ZodObject<{
|
|
119
|
-
name: z.ZodString;
|
|
120
|
-
version: z.ZodString;
|
|
121
|
-
compatible: z.ZodBoolean;
|
|
122
|
-
issues: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
123
|
-
}, "strip", z.ZodTypeAny, {
|
|
124
|
-
version: string;
|
|
125
|
-
name: string;
|
|
126
|
-
compatible: boolean;
|
|
127
|
-
issues?: string[] | undefined;
|
|
128
|
-
}, {
|
|
129
|
-
version: string;
|
|
130
|
-
name: string;
|
|
131
|
-
compatible: boolean;
|
|
132
|
-
issues?: string[] | undefined;
|
|
133
|
-
}>;
|
|
134
|
-
export declare const XMCPUpstreamInfoSchema: z.ZodObject<{
|
|
135
|
-
version: z.ZodString;
|
|
136
|
-
compatible: z.ZodBoolean;
|
|
137
|
-
issues: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
138
|
-
}, "strip", z.ZodTypeAny, {
|
|
139
|
-
version: string;
|
|
140
|
-
compatible: boolean;
|
|
141
|
-
issues?: string[] | undefined;
|
|
142
|
-
}, {
|
|
143
|
-
version: string;
|
|
144
|
-
compatible: boolean;
|
|
145
|
-
issues?: string[] | undefined;
|
|
146
|
-
}>;
|
|
147
|
-
export declare const EnvironmentInfoSchema: z.ZodObject<{
|
|
148
|
-
valid: z.ZodBoolean;
|
|
149
|
-
missing: z.ZodArray<z.ZodString, "many">;
|
|
150
|
-
issues: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
151
|
-
}, "strip", z.ZodTypeAny, {
|
|
152
|
-
valid: boolean;
|
|
153
|
-
missing: string[];
|
|
154
|
-
issues?: string[] | undefined;
|
|
155
|
-
}, {
|
|
156
|
-
valid: boolean;
|
|
157
|
-
missing: string[];
|
|
158
|
-
issues?: string[] | undefined;
|
|
159
|
-
}>;
|
|
160
|
-
export declare const KTAInfoSchema: z.ZodObject<{
|
|
161
|
-
reachable: z.ZodBoolean;
|
|
162
|
-
authenticated: z.ZodBoolean;
|
|
163
|
-
issues: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
164
|
-
}, "strip", z.ZodTypeAny, {
|
|
165
|
-
reachable: boolean;
|
|
166
|
-
authenticated: boolean;
|
|
167
|
-
issues?: string[] | undefined;
|
|
168
|
-
}, {
|
|
169
|
-
reachable: boolean;
|
|
170
|
-
authenticated: boolean;
|
|
171
|
-
issues?: string[] | undefined;
|
|
172
|
-
}>;
|
|
173
|
-
export declare const CacheInfoSchema: z.ZodObject<{
|
|
174
|
-
type: z.ZodString;
|
|
175
|
-
functional: z.ZodBoolean;
|
|
176
|
-
issues: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
177
|
-
}, "strip", z.ZodTypeAny, {
|
|
178
|
-
type: string;
|
|
179
|
-
functional: boolean;
|
|
180
|
-
issues?: string[] | undefined;
|
|
181
|
-
}, {
|
|
182
|
-
type: string;
|
|
183
|
-
functional: boolean;
|
|
184
|
-
issues?: string[] | undefined;
|
|
185
|
-
}>;
|
|
186
|
-
export declare const DoctorResultSchema: z.ZodObject<{
|
|
187
|
-
packages: z.ZodArray<z.ZodObject<{
|
|
188
|
-
name: z.ZodString;
|
|
189
|
-
version: z.ZodString;
|
|
190
|
-
compatible: z.ZodBoolean;
|
|
191
|
-
issues: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
192
|
-
}, "strip", z.ZodTypeAny, {
|
|
193
|
-
version: string;
|
|
194
|
-
name: string;
|
|
195
|
-
compatible: boolean;
|
|
196
|
-
issues?: string[] | undefined;
|
|
197
|
-
}, {
|
|
198
|
-
version: string;
|
|
199
|
-
name: string;
|
|
200
|
-
compatible: boolean;
|
|
201
|
-
issues?: string[] | undefined;
|
|
202
|
-
}>, "many">;
|
|
203
|
-
xmcpUpstream: z.ZodObject<{
|
|
204
|
-
version: z.ZodString;
|
|
205
|
-
compatible: z.ZodBoolean;
|
|
206
|
-
issues: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
207
|
-
}, "strip", z.ZodTypeAny, {
|
|
208
|
-
version: string;
|
|
209
|
-
compatible: boolean;
|
|
210
|
-
issues?: string[] | undefined;
|
|
211
|
-
}, {
|
|
212
|
-
version: string;
|
|
213
|
-
compatible: boolean;
|
|
214
|
-
issues?: string[] | undefined;
|
|
215
|
-
}>;
|
|
216
|
-
environment: z.ZodObject<{
|
|
217
|
-
valid: z.ZodBoolean;
|
|
218
|
-
missing: z.ZodArray<z.ZodString, "many">;
|
|
219
|
-
issues: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
220
|
-
}, "strip", z.ZodTypeAny, {
|
|
221
|
-
valid: boolean;
|
|
222
|
-
missing: string[];
|
|
223
|
-
issues?: string[] | undefined;
|
|
224
|
-
}, {
|
|
225
|
-
valid: boolean;
|
|
226
|
-
missing: string[];
|
|
227
|
-
issues?: string[] | undefined;
|
|
228
|
-
}>;
|
|
229
|
-
kta: z.ZodObject<{
|
|
230
|
-
reachable: z.ZodBoolean;
|
|
231
|
-
authenticated: z.ZodBoolean;
|
|
232
|
-
issues: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
233
|
-
}, "strip", z.ZodTypeAny, {
|
|
234
|
-
reachable: boolean;
|
|
235
|
-
authenticated: boolean;
|
|
236
|
-
issues?: string[] | undefined;
|
|
237
|
-
}, {
|
|
238
|
-
reachable: boolean;
|
|
239
|
-
authenticated: boolean;
|
|
240
|
-
issues?: string[] | undefined;
|
|
241
|
-
}>;
|
|
242
|
-
cache: z.ZodObject<{
|
|
243
|
-
type: z.ZodString;
|
|
244
|
-
functional: z.ZodBoolean;
|
|
245
|
-
issues: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
246
|
-
}, "strip", z.ZodTypeAny, {
|
|
247
|
-
type: string;
|
|
248
|
-
functional: boolean;
|
|
249
|
-
issues?: string[] | undefined;
|
|
250
|
-
}, {
|
|
251
|
-
type: string;
|
|
252
|
-
functional: boolean;
|
|
253
|
-
issues?: string[] | undefined;
|
|
254
|
-
}>;
|
|
255
|
-
}, "strip", z.ZodTypeAny, {
|
|
256
|
-
environment: {
|
|
257
|
-
valid: boolean;
|
|
258
|
-
missing: string[];
|
|
259
|
-
issues?: string[] | undefined;
|
|
260
|
-
};
|
|
261
|
-
packages: {
|
|
262
|
-
version: string;
|
|
263
|
-
name: string;
|
|
264
|
-
compatible: boolean;
|
|
265
|
-
issues?: string[] | undefined;
|
|
266
|
-
}[];
|
|
267
|
-
xmcpUpstream: {
|
|
268
|
-
version: string;
|
|
269
|
-
compatible: boolean;
|
|
270
|
-
issues?: string[] | undefined;
|
|
271
|
-
};
|
|
272
|
-
kta: {
|
|
273
|
-
reachable: boolean;
|
|
274
|
-
authenticated: boolean;
|
|
275
|
-
issues?: string[] | undefined;
|
|
276
|
-
};
|
|
277
|
-
cache: {
|
|
278
|
-
type: string;
|
|
279
|
-
functional: boolean;
|
|
280
|
-
issues?: string[] | undefined;
|
|
281
|
-
};
|
|
282
|
-
}, {
|
|
283
|
-
environment: {
|
|
284
|
-
valid: boolean;
|
|
285
|
-
missing: string[];
|
|
286
|
-
issues?: string[] | undefined;
|
|
287
|
-
};
|
|
288
|
-
packages: {
|
|
289
|
-
version: string;
|
|
290
|
-
name: string;
|
|
291
|
-
compatible: boolean;
|
|
292
|
-
issues?: string[] | undefined;
|
|
293
|
-
}[];
|
|
294
|
-
xmcpUpstream: {
|
|
295
|
-
version: string;
|
|
296
|
-
compatible: boolean;
|
|
297
|
-
issues?: string[] | undefined;
|
|
298
|
-
};
|
|
299
|
-
kta: {
|
|
300
|
-
reachable: boolean;
|
|
301
|
-
authenticated: boolean;
|
|
302
|
-
issues?: string[] | undefined;
|
|
303
|
-
};
|
|
304
|
-
cache: {
|
|
305
|
-
type: string;
|
|
306
|
-
functional: boolean;
|
|
307
|
-
issues?: string[] | undefined;
|
|
308
|
-
};
|
|
309
|
-
}>;
|
|
310
|
-
export declare const ScaffolderOptionsSchema: z.ZodObject<{
|
|
311
|
-
projectName: z.ZodString;
|
|
312
|
-
xmcpVersion: z.ZodOptional<z.ZodString>;
|
|
313
|
-
xmcpChannel: z.ZodOptional<z.ZodEnum<["latest", "next"]>>;
|
|
314
|
-
noIdentity: z.ZodDefault<z.ZodBoolean>;
|
|
315
|
-
}, "strip", z.ZodTypeAny, {
|
|
316
|
-
projectName: string;
|
|
317
|
-
noIdentity: boolean;
|
|
318
|
-
xmcpVersion?: string | undefined;
|
|
319
|
-
xmcpChannel?: "latest" | "next" | undefined;
|
|
320
|
-
}, {
|
|
321
|
-
projectName: string;
|
|
322
|
-
xmcpVersion?: string | undefined;
|
|
323
|
-
xmcpChannel?: "latest" | "next" | undefined;
|
|
324
|
-
noIdentity?: boolean | undefined;
|
|
325
|
-
}>;
|
|
326
|
-
export declare const ScaffolderResultSchema: z.ZodObject<{
|
|
327
|
-
success: z.ZodBoolean;
|
|
328
|
-
projectPath: z.ZodString;
|
|
329
|
-
xmcpVersion: z.ZodString;
|
|
330
|
-
identityEnabled: z.ZodBoolean;
|
|
331
|
-
warnings: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
332
|
-
}, "strip", z.ZodTypeAny, {
|
|
333
|
-
success: boolean;
|
|
334
|
-
xmcpVersion: string;
|
|
335
|
-
projectPath: string;
|
|
336
|
-
identityEnabled: boolean;
|
|
337
|
-
warnings?: string[] | undefined;
|
|
338
|
-
}, {
|
|
339
|
-
success: boolean;
|
|
340
|
-
xmcpVersion: string;
|
|
341
|
-
projectPath: string;
|
|
342
|
-
identityEnabled: boolean;
|
|
343
|
-
warnings?: string[] | undefined;
|
|
344
|
-
}>;
|
|
345
|
-
export type IdentityConfig = z.infer<typeof IdentityConfigSchema>;
|
|
346
|
-
export type KeyRotationResult = z.infer<typeof KeyRotationResultSchema>;
|
|
347
|
-
export type StatusReport = z.infer<typeof StatusReportSchema>;
|
|
348
|
-
export type PackageInfo = z.infer<typeof PackageInfoSchema>;
|
|
349
|
-
export type XMCPUpstreamInfo = z.infer<typeof XMCPUpstreamInfoSchema>;
|
|
350
|
-
export type EnvironmentInfo = z.infer<typeof EnvironmentInfoSchema>;
|
|
351
|
-
export type KTAInfo = z.infer<typeof KTAInfoSchema>;
|
|
352
|
-
export type CacheInfo = z.infer<typeof CacheInfoSchema>;
|
|
353
|
-
export type DoctorResult = z.infer<typeof DoctorResultSchema>;
|
|
354
|
-
export type ScaffolderOptions = z.infer<typeof ScaffolderOptionsSchema>;
|
|
355
|
-
export type ScaffolderResult = z.infer<typeof ScaffolderResultSchema>;
|
|
356
|
-
export declare const ERROR_CODES: {
|
|
357
|
-
readonly XMCP_I_EBADPROOF: "XMCP_I_EBADPROOF";
|
|
358
|
-
readonly XMCP_I_ENOIDENTITY: "XMCP_I_ENOIDENTITY";
|
|
359
|
-
readonly XMCP_I_EMIRRORPENDING: "XMCP_I_EMIRRORPENDING";
|
|
360
|
-
readonly XMCP_I_EHANDSHAKE: "XMCP_I_EHANDSHAKE";
|
|
361
|
-
readonly XMCP_I_ESESSION: "XMCP_I_ESESSION";
|
|
362
|
-
readonly XMCP_I_ECLAIM: "XMCP_I_ECLAIM";
|
|
363
|
-
readonly XMCP_I_ECONFIG: "XMCP_I_ECONFIG";
|
|
364
|
-
readonly XMCP_I_ERUNTIME: "XMCP_I_ERUNTIME";
|
|
365
|
-
};
|
|
366
|
-
export type ErrorCode = keyof typeof ERROR_CODES;
|
|
367
|
-
export declare const CLI_EXIT_CODES: {
|
|
368
|
-
readonly SUCCESS: 0;
|
|
369
|
-
readonly GENERAL_ERROR: 1;
|
|
370
|
-
readonly BADPROOF: 20;
|
|
371
|
-
readonly NOIDENTITY: 21;
|
|
372
|
-
readonly HANDSHAKE: 22;
|
|
373
|
-
readonly SESSION: 23;
|
|
374
|
-
readonly CLAIM: 24;
|
|
375
|
-
readonly CONFIG: 25;
|
|
376
|
-
readonly RUNTIME: 26;
|
|
377
|
-
};
|
|
378
|
-
//# sourceMappingURL=cli.d.ts.map
|
package/dist/cli.js
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
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.IdentityConfigSchema = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
/**
|
|
6
|
-
* CLI command schemas and results
|
|
7
|
-
*/
|
|
8
|
-
exports.IdentityConfigSchema = zod_1.z.object({
|
|
9
|
-
version: zod_1.z.literal("1.0"),
|
|
10
|
-
did: zod_1.z.string().min(1),
|
|
11
|
-
// Accept both kid and keyId for backward compatibility with pre-1.3 identity files
|
|
12
|
-
kid: zod_1.z.string().min(1).optional(),
|
|
13
|
-
keyId: zod_1.z.string().min(1).optional(),
|
|
14
|
-
privateKey: zod_1.z.string().regex(/^[A-Za-z0-9+/]{43}=$/, "Must be a valid base64-encoded Ed25519 private key (44 characters)"),
|
|
15
|
-
publicKey: zod_1.z.string().regex(/^[A-Za-z0-9+/]{43}=$/, "Must be a valid base64-encoded Ed25519 public key (44 characters)"),
|
|
16
|
-
createdAt: zod_1.z.string().datetime(),
|
|
17
|
-
lastRotated: zod_1.z.string().datetime().optional(),
|
|
18
|
-
}).refine((data) => data.kid || data.keyId, {
|
|
19
|
-
message: "Either kid or keyId must be provided",
|
|
20
|
-
}).transform((data) => ({
|
|
21
|
-
version: data.version,
|
|
22
|
-
did: data.did,
|
|
23
|
-
kid: data.kid || data.keyId,
|
|
24
|
-
privateKey: data.privateKey,
|
|
25
|
-
publicKey: data.publicKey,
|
|
26
|
-
createdAt: data.createdAt,
|
|
27
|
-
lastRotated: data.lastRotated,
|
|
28
|
-
}));
|
|
29
|
-
exports.KeyRotationResultSchema = zod_1.z.object({
|
|
30
|
-
success: zod_1.z.boolean(),
|
|
31
|
-
oldKeyId: zod_1.z.string().min(1),
|
|
32
|
-
newKeyId: zod_1.z.string().min(1),
|
|
33
|
-
did: zod_1.z.string().min(1),
|
|
34
|
-
mode: zod_1.z.enum(["dev", "prod"]),
|
|
35
|
-
delegated: zod_1.z.boolean(),
|
|
36
|
-
forced: zod_1.z.boolean(),
|
|
37
|
-
auditLine: zod_1.z.string().min(1),
|
|
38
|
-
});
|
|
39
|
-
exports.StatusReportSchema = zod_1.z.object({
|
|
40
|
-
did: zod_1.z.string().min(1),
|
|
41
|
-
kid: zod_1.z.string().min(1), // Changed from keyId to kid for spec compliance
|
|
42
|
-
ktaURL: zod_1.z.string().url(),
|
|
43
|
-
mirrorStatus: zod_1.z.enum(["pending", "success", "error"]),
|
|
44
|
-
lastHandshake: zod_1.z.number().int().positive().optional(),
|
|
45
|
-
environment: zod_1.z.enum(["dev", "prod"]),
|
|
46
|
-
});
|
|
47
|
-
exports.PackageInfoSchema = zod_1.z.object({
|
|
48
|
-
name: zod_1.z.string(),
|
|
49
|
-
version: zod_1.z.string(),
|
|
50
|
-
compatible: zod_1.z.boolean(),
|
|
51
|
-
issues: zod_1.z.array(zod_1.z.string()).optional(),
|
|
52
|
-
});
|
|
53
|
-
exports.XMCPUpstreamInfoSchema = zod_1.z.object({
|
|
54
|
-
version: zod_1.z.string(),
|
|
55
|
-
compatible: zod_1.z.boolean(),
|
|
56
|
-
issues: zod_1.z.array(zod_1.z.string()).optional(),
|
|
57
|
-
});
|
|
58
|
-
exports.EnvironmentInfoSchema = zod_1.z.object({
|
|
59
|
-
valid: zod_1.z.boolean(),
|
|
60
|
-
missing: zod_1.z.array(zod_1.z.string()),
|
|
61
|
-
issues: zod_1.z.array(zod_1.z.string()).optional(),
|
|
62
|
-
});
|
|
63
|
-
exports.KTAInfoSchema = zod_1.z.object({
|
|
64
|
-
reachable: zod_1.z.boolean(),
|
|
65
|
-
authenticated: zod_1.z.boolean(),
|
|
66
|
-
issues: zod_1.z.array(zod_1.z.string()).optional(),
|
|
67
|
-
});
|
|
68
|
-
exports.CacheInfoSchema = zod_1.z.object({
|
|
69
|
-
type: zod_1.z.string(),
|
|
70
|
-
functional: zod_1.z.boolean(),
|
|
71
|
-
issues: zod_1.z.array(zod_1.z.string()).optional(),
|
|
72
|
-
});
|
|
73
|
-
exports.DoctorResultSchema = zod_1.z.object({
|
|
74
|
-
packages: zod_1.z.array(exports.PackageInfoSchema),
|
|
75
|
-
xmcpUpstream: exports.XMCPUpstreamInfoSchema,
|
|
76
|
-
environment: exports.EnvironmentInfoSchema,
|
|
77
|
-
kta: exports.KTAInfoSchema,
|
|
78
|
-
cache: exports.CacheInfoSchema,
|
|
79
|
-
});
|
|
80
|
-
exports.ScaffolderOptionsSchema = zod_1.z.object({
|
|
81
|
-
projectName: zod_1.z.string().min(1),
|
|
82
|
-
xmcpVersion: zod_1.z.string().optional(),
|
|
83
|
-
xmcpChannel: zod_1.z.enum(["latest", "next"]).optional(),
|
|
84
|
-
noIdentity: zod_1.z.boolean().default(false),
|
|
85
|
-
});
|
|
86
|
-
exports.ScaffolderResultSchema = zod_1.z.object({
|
|
87
|
-
success: zod_1.z.boolean(),
|
|
88
|
-
projectPath: zod_1.z.string().min(1),
|
|
89
|
-
xmcpVersion: zod_1.z.string().min(1),
|
|
90
|
-
identityEnabled: zod_1.z.boolean(),
|
|
91
|
-
warnings: zod_1.z.array(zod_1.z.string()).optional(),
|
|
92
|
-
});
|
|
93
|
-
// Error codes as string literal union
|
|
94
|
-
exports.ERROR_CODES = {
|
|
95
|
-
XMCP_I_EBADPROOF: "XMCP_I_EBADPROOF",
|
|
96
|
-
XMCP_I_ENOIDENTITY: "XMCP_I_ENOIDENTITY",
|
|
97
|
-
XMCP_I_EMIRRORPENDING: "XMCP_I_EMIRRORPENDING",
|
|
98
|
-
XMCP_I_EHANDSHAKE: "XMCP_I_EHANDSHAKE",
|
|
99
|
-
XMCP_I_ESESSION: "XMCP_I_ESESSION",
|
|
100
|
-
XMCP_I_ECLAIM: "XMCP_I_ECLAIM",
|
|
101
|
-
XMCP_I_ECONFIG: "XMCP_I_ECONFIG",
|
|
102
|
-
XMCP_I_ERUNTIME: "XMCP_I_ERUNTIME",
|
|
103
|
-
};
|
|
104
|
-
// CLI exit codes
|
|
105
|
-
exports.CLI_EXIT_CODES = {
|
|
106
|
-
SUCCESS: 0,
|
|
107
|
-
GENERAL_ERROR: 1,
|
|
108
|
-
BADPROOF: 20,
|
|
109
|
-
NOIDENTITY: 21,
|
|
110
|
-
HANDSHAKE: 22,
|
|
111
|
-
SESSION: 23,
|
|
112
|
-
CLAIM: 24,
|
|
113
|
-
CONFIG: 25,
|
|
114
|
-
RUNTIME: 26,
|
|
115
|
-
};
|
|
116
|
-
//# sourceMappingURL=cli.js.map
|