@kya-os/contracts 1.7.20 → 1.7.22
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/agentshield-api/schemas.d.ts +188 -188
- package/dist/audit/index.d.ts +21 -21
- package/dist/config/base.d.ts +8 -0
- package/dist/config/index.d.ts +3 -0
- package/dist/consent/schemas.d.ts +112 -112
- package/dist/dashboard-config/schemas.d.ts +1759 -1759
- package/dist/dashboard-config/types.d.ts +11 -1
- package/dist/delegation/schemas.d.ts +235 -235
- package/dist/delegation/schemas.js +1 -1
- package/dist/handshake.d.ts +30 -30
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -0
- package/dist/molti/admin-ws.d.ts +1260 -0
- package/dist/molti/admin-ws.js +100 -0
- package/dist/molti/index.d.ts +30 -0
- package/dist/molti/index.js +80 -0
- package/dist/molti/schemas.d.ts +837 -0
- package/dist/molti/schemas.js +267 -0
- package/dist/molti/types.d.ts +216 -0
- package/dist/molti/types.js +25 -0
- package/dist/policy/index.d.ts +8 -0
- package/dist/policy/index.js +41 -0
- package/dist/policy/schemas.d.ts +3839 -0
- package/dist/policy/schemas.js +424 -0
- package/dist/registry.d.ts +53 -53
- package/dist/registry.js +3 -3
- package/dist/reputation/credentials.d.ts +61 -61
- package/dist/reputation/credentials.js +1 -1
- package/dist/tool-protection/index.d.ts +6 -6
- package/dist/verifier.d.ts +6 -6
- package/package.json +28 -16
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Molti Deployment Zod Validation Schemas
|
|
4
|
+
*
|
|
5
|
+
* Runtime validation schemas for the Molti deployment API.
|
|
6
|
+
* These schemas ensure request/response validation at API boundaries.
|
|
7
|
+
*
|
|
8
|
+
* @package @kya-os/contracts/molti
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.moltiSSEEventSchema = exports.moltiSSEKeepaliveEventSchema = exports.moltiSSEErrorEventSchema = exports.moltiSSECompleteEventSchema = exports.moltiSSEProgressEventSchema = exports.moltiHealthStatusSchema = exports.moltiDeployResponseSchema = exports.moltiDeploySuccessResponseSchema = exports.moltiDeployErrorResponseSchema = exports.moltiDeployErrorCodeSchema = exports.moltiDeployResultSchema = exports.moltiDeployProgressSchema = exports.moltiDeployStepSchema = exports.moltiDeployStepStatusSchema = exports.moltiDeployStepIdSchema = exports.moltiDeployStartResponseSchema = exports.moltiDeployRequestSchema = exports.moltiDeployConfigSchema = exports.moltiContainerStatusSchema = exports.moltiInstanceTypeSchema = exports.moltiIdentityConfigSchema = void 0;
|
|
12
|
+
const zod_1 = require("zod");
|
|
13
|
+
// ============================================================================
|
|
14
|
+
// Shared Validation
|
|
15
|
+
// ============================================================================
|
|
16
|
+
/**
|
|
17
|
+
* Shared project name validation — lowercase alphanumeric with hyphens.
|
|
18
|
+
* Reused by both moltiDeployConfigSchema and moltiDeployRequestSchema.
|
|
19
|
+
*/
|
|
20
|
+
const projectNameSchema = zod_1.z
|
|
21
|
+
.string()
|
|
22
|
+
.min(1, "Project name is required")
|
|
23
|
+
.max(100, "Project name must be 100 characters or less")
|
|
24
|
+
.regex(/^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/, "Project name must be lowercase, alphanumeric with hyphens");
|
|
25
|
+
// ============================================================================
|
|
26
|
+
// Identity Schemas
|
|
27
|
+
// ============================================================================
|
|
28
|
+
/**
|
|
29
|
+
* Molti identity configuration schema
|
|
30
|
+
*/
|
|
31
|
+
exports.moltiIdentityConfigSchema = zod_1.z.object({
|
|
32
|
+
did: zod_1.z.string().min(1).startsWith("did:key:"),
|
|
33
|
+
publicKey: zod_1.z.string().min(1),
|
|
34
|
+
agentName: zod_1.z.string().max(255).optional(),
|
|
35
|
+
agentDescription: zod_1.z.string().max(2000).optional(),
|
|
36
|
+
});
|
|
37
|
+
// ============================================================================
|
|
38
|
+
// Container Schemas
|
|
39
|
+
// ============================================================================
|
|
40
|
+
/**
|
|
41
|
+
* Container instance type schema
|
|
42
|
+
*/
|
|
43
|
+
exports.moltiInstanceTypeSchema = zod_1.z.enum([
|
|
44
|
+
"lite",
|
|
45
|
+
"basic",
|
|
46
|
+
"standard-1",
|
|
47
|
+
"standard-2",
|
|
48
|
+
"standard-3",
|
|
49
|
+
"standard-4",
|
|
50
|
+
]);
|
|
51
|
+
/**
|
|
52
|
+
* Container runtime status schema
|
|
53
|
+
*/
|
|
54
|
+
exports.moltiContainerStatusSchema = zod_1.z.enum([
|
|
55
|
+
"pending",
|
|
56
|
+
"deploying",
|
|
57
|
+
"running",
|
|
58
|
+
"stopped",
|
|
59
|
+
"unhealthy",
|
|
60
|
+
"error",
|
|
61
|
+
]);
|
|
62
|
+
// ============================================================================
|
|
63
|
+
// Deploy Configuration Schemas
|
|
64
|
+
// ============================================================================
|
|
65
|
+
/**
|
|
66
|
+
* Molti deploy configuration schema
|
|
67
|
+
*/
|
|
68
|
+
exports.moltiDeployConfigSchema = zod_1.z.object({
|
|
69
|
+
projectName: projectNameSchema,
|
|
70
|
+
agentName: zod_1.z.string().max(255).optional(),
|
|
71
|
+
agentDescription: zod_1.z.string().max(2000).optional(),
|
|
72
|
+
agentShieldProjectId: zod_1.z.string().optional(),
|
|
73
|
+
agentShieldApiKey: zod_1.z.string().optional(),
|
|
74
|
+
instanceType: exports.moltiInstanceTypeSchema.optional(),
|
|
75
|
+
enableReputation: zod_1.z.boolean().optional(),
|
|
76
|
+
});
|
|
77
|
+
// ============================================================================
|
|
78
|
+
// Deploy Request/Response Schemas
|
|
79
|
+
// ============================================================================
|
|
80
|
+
/**
|
|
81
|
+
* Molti deploy request schema
|
|
82
|
+
* POST /api/internal/deploy/molti/start
|
|
83
|
+
*/
|
|
84
|
+
exports.moltiDeployRequestSchema = zod_1.z.object({
|
|
85
|
+
projectName: projectNameSchema,
|
|
86
|
+
agentName: zod_1.z.string().max(255).optional(),
|
|
87
|
+
agentDescription: zod_1.z.string().max(2000).optional(),
|
|
88
|
+
organizationId: zod_1.z.string().uuid(),
|
|
89
|
+
existingProjectId: zod_1.z.string().uuid().optional(),
|
|
90
|
+
instanceType: exports.moltiInstanceTypeSchema.optional(),
|
|
91
|
+
enableReputation: zod_1.z.boolean().default(true),
|
|
92
|
+
});
|
|
93
|
+
/**
|
|
94
|
+
* Molti deploy start response schema
|
|
95
|
+
*/
|
|
96
|
+
exports.moltiDeployStartResponseSchema = zod_1.z.object({
|
|
97
|
+
success: zod_1.z.literal(true),
|
|
98
|
+
deploymentId: zod_1.z.string().uuid(),
|
|
99
|
+
});
|
|
100
|
+
// ============================================================================
|
|
101
|
+
// Deploy Progress Schemas
|
|
102
|
+
// ============================================================================
|
|
103
|
+
/**
|
|
104
|
+
* Deploy step ID schema
|
|
105
|
+
*/
|
|
106
|
+
exports.moltiDeployStepIdSchema = zod_1.z.enum([
|
|
107
|
+
"github_verify",
|
|
108
|
+
"project_create",
|
|
109
|
+
"api_key_create",
|
|
110
|
+
"kta_register",
|
|
111
|
+
"scaffold",
|
|
112
|
+
"repo_create",
|
|
113
|
+
"commit_files",
|
|
114
|
+
"add_secrets",
|
|
115
|
+
"gateway_route",
|
|
116
|
+
]);
|
|
117
|
+
/**
|
|
118
|
+
* Deploy step status schema
|
|
119
|
+
*/
|
|
120
|
+
exports.moltiDeployStepStatusSchema = zod_1.z.enum([
|
|
121
|
+
"pending",
|
|
122
|
+
"in_progress",
|
|
123
|
+
"completed",
|
|
124
|
+
"failed",
|
|
125
|
+
"skipped",
|
|
126
|
+
]);
|
|
127
|
+
/**
|
|
128
|
+
* Individual deploy step schema
|
|
129
|
+
*/
|
|
130
|
+
exports.moltiDeployStepSchema = zod_1.z.object({
|
|
131
|
+
id: exports.moltiDeployStepIdSchema,
|
|
132
|
+
name: zod_1.z.string().min(1),
|
|
133
|
+
status: exports.moltiDeployStepStatusSchema,
|
|
134
|
+
message: zod_1.z.string().optional(),
|
|
135
|
+
startedAt: zod_1.z.string().datetime().optional(),
|
|
136
|
+
completedAt: zod_1.z.string().datetime().optional(),
|
|
137
|
+
});
|
|
138
|
+
/**
|
|
139
|
+
* Overall deployment progress schema
|
|
140
|
+
*/
|
|
141
|
+
exports.moltiDeployProgressSchema = zod_1.z.object({
|
|
142
|
+
deploymentId: zod_1.z.string().uuid(),
|
|
143
|
+
steps: zod_1.z.array(exports.moltiDeployStepSchema),
|
|
144
|
+
currentStep: zod_1.z.number().int().min(0),
|
|
145
|
+
totalSteps: zod_1.z.number().int().positive(),
|
|
146
|
+
overallStatus: zod_1.z.enum(["pending", "in_progress", "completed", "failed"]),
|
|
147
|
+
});
|
|
148
|
+
// ============================================================================
|
|
149
|
+
// Deploy Result Schemas
|
|
150
|
+
// ============================================================================
|
|
151
|
+
/**
|
|
152
|
+
* Successful deploy result schema
|
|
153
|
+
*/
|
|
154
|
+
exports.moltiDeployResultSchema = zod_1.z.object({
|
|
155
|
+
agentDid: zod_1.z.string().min(1).startsWith("did:key:"),
|
|
156
|
+
repoUrl: zod_1.z.string().url(),
|
|
157
|
+
repoFullName: zod_1.z.string().regex(/^[a-zA-Z0-9_-]+\/[a-zA-Z0-9_.-]+$/),
|
|
158
|
+
projectId: zod_1.z.string().uuid(),
|
|
159
|
+
projectFriendlyId: zod_1.z.string().min(1),
|
|
160
|
+
ktaClaimUrl: zod_1.z.string().url().optional(),
|
|
161
|
+
deployButtonUrl: zod_1.z.string().url(),
|
|
162
|
+
gatewayHostname: zod_1.z.string().optional(),
|
|
163
|
+
});
|
|
164
|
+
/**
|
|
165
|
+
* Molti deploy error codes schema
|
|
166
|
+
*/
|
|
167
|
+
exports.moltiDeployErrorCodeSchema = zod_1.z.enum([
|
|
168
|
+
"GITHUB_NOT_CONNECTED",
|
|
169
|
+
"REPO_NAME_TAKEN",
|
|
170
|
+
"REPO_NAME_INVALID",
|
|
171
|
+
"RATE_LIMIT_EXCEEDED",
|
|
172
|
+
"PLAN_LIMIT_EXCEEDED",
|
|
173
|
+
"SCAFFOLDER_ERROR",
|
|
174
|
+
"IDENTITY_ERROR",
|
|
175
|
+
"PROJECT_CREATION_ERROR",
|
|
176
|
+
"KTA_REGISTRATION_ERROR",
|
|
177
|
+
"SECRETS_ERROR",
|
|
178
|
+
"GATEWAY_ERROR",
|
|
179
|
+
"GITHUB_API_ERROR",
|
|
180
|
+
"INTERNAL_ERROR",
|
|
181
|
+
]);
|
|
182
|
+
/**
|
|
183
|
+
* Molti deploy error response schema
|
|
184
|
+
*/
|
|
185
|
+
exports.moltiDeployErrorResponseSchema = zod_1.z.object({
|
|
186
|
+
success: zod_1.z.literal(false),
|
|
187
|
+
error: zod_1.z.object({
|
|
188
|
+
code: exports.moltiDeployErrorCodeSchema,
|
|
189
|
+
message: zod_1.z.string(),
|
|
190
|
+
details: zod_1.z.record(zod_1.z.unknown()).optional(),
|
|
191
|
+
}),
|
|
192
|
+
});
|
|
193
|
+
/**
|
|
194
|
+
* Molti deploy success response schema
|
|
195
|
+
*/
|
|
196
|
+
exports.moltiDeploySuccessResponseSchema = zod_1.z.object({
|
|
197
|
+
success: zod_1.z.literal(true),
|
|
198
|
+
data: exports.moltiDeployResultSchema,
|
|
199
|
+
});
|
|
200
|
+
/**
|
|
201
|
+
* Molti deploy response union schema
|
|
202
|
+
*/
|
|
203
|
+
exports.moltiDeployResponseSchema = zod_1.z.discriminatedUnion("success", [
|
|
204
|
+
exports.moltiDeploySuccessResponseSchema,
|
|
205
|
+
exports.moltiDeployErrorResponseSchema,
|
|
206
|
+
]);
|
|
207
|
+
// ============================================================================
|
|
208
|
+
// Health Status Schemas
|
|
209
|
+
// ============================================================================
|
|
210
|
+
/**
|
|
211
|
+
* Health check response schema
|
|
212
|
+
*/
|
|
213
|
+
exports.moltiHealthStatusSchema = zod_1.z.object({
|
|
214
|
+
agentDid: zod_1.z.string().min(1),
|
|
215
|
+
containerStatus: exports.moltiContainerStatusSchema,
|
|
216
|
+
gatewayRunning: zod_1.z.boolean(),
|
|
217
|
+
gatewayPort: zod_1.z.number().int().positive(),
|
|
218
|
+
uptimeSeconds: zod_1.z.number().min(0).optional(),
|
|
219
|
+
lastCheckedAt: zod_1.z.string().datetime(),
|
|
220
|
+
workerUrl: zod_1.z.string().url().optional(),
|
|
221
|
+
});
|
|
222
|
+
// ============================================================================
|
|
223
|
+
// SSE Event Schemas
|
|
224
|
+
// ============================================================================
|
|
225
|
+
/**
|
|
226
|
+
* SSE progress event schema
|
|
227
|
+
*/
|
|
228
|
+
exports.moltiSSEProgressEventSchema = zod_1.z.object({
|
|
229
|
+
type: zod_1.z.literal("progress"),
|
|
230
|
+
data: exports.moltiDeployProgressSchema,
|
|
231
|
+
});
|
|
232
|
+
/**
|
|
233
|
+
* SSE completion event schema
|
|
234
|
+
*/
|
|
235
|
+
exports.moltiSSECompleteEventSchema = zod_1.z.object({
|
|
236
|
+
type: zod_1.z.literal("complete"),
|
|
237
|
+
data: exports.moltiDeployResultSchema,
|
|
238
|
+
});
|
|
239
|
+
/**
|
|
240
|
+
* SSE error event schema
|
|
241
|
+
*/
|
|
242
|
+
exports.moltiSSEErrorEventSchema = zod_1.z.object({
|
|
243
|
+
type: zod_1.z.literal("error"),
|
|
244
|
+
data: zod_1.z.object({
|
|
245
|
+
code: exports.moltiDeployErrorCodeSchema,
|
|
246
|
+
message: zod_1.z.string(),
|
|
247
|
+
step: exports.moltiDeployStepIdSchema.optional(),
|
|
248
|
+
}),
|
|
249
|
+
});
|
|
250
|
+
/**
|
|
251
|
+
* SSE keepalive event schema
|
|
252
|
+
*/
|
|
253
|
+
exports.moltiSSEKeepaliveEventSchema = zod_1.z.object({
|
|
254
|
+
type: zod_1.z.literal("keepalive"),
|
|
255
|
+
data: zod_1.z.object({
|
|
256
|
+
timestamp: zod_1.z.string().datetime(),
|
|
257
|
+
}),
|
|
258
|
+
});
|
|
259
|
+
/**
|
|
260
|
+
* Union of all SSE event schemas
|
|
261
|
+
*/
|
|
262
|
+
exports.moltiSSEEventSchema = zod_1.z.discriminatedUnion("type", [
|
|
263
|
+
exports.moltiSSEProgressEventSchema,
|
|
264
|
+
exports.moltiSSECompleteEventSchema,
|
|
265
|
+
exports.moltiSSEErrorEventSchema,
|
|
266
|
+
exports.moltiSSEKeepaliveEventSchema,
|
|
267
|
+
]);
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Molti Deployment Type Definitions
|
|
3
|
+
*
|
|
4
|
+
* TypeScript interfaces for the Molti (Moltworker + Identity) deployment system.
|
|
5
|
+
* Molti scaffolds Cloudflare Worker + Container projects with MCP-I identity.
|
|
6
|
+
*
|
|
7
|
+
* @package @kya-os/contracts/molti
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* MCP-I identity for a Molti agent
|
|
11
|
+
*/
|
|
12
|
+
export interface MoltiIdentityConfig {
|
|
13
|
+
/** Agent DID (did:key:z6Mk...) */
|
|
14
|
+
did: string;
|
|
15
|
+
/** Base64-encoded Ed25519 public key */
|
|
16
|
+
publicKey: string;
|
|
17
|
+
/** Optional human-readable agent name */
|
|
18
|
+
agentName?: string;
|
|
19
|
+
/** Optional agent description */
|
|
20
|
+
agentDescription?: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Cloudflare Container instance types
|
|
24
|
+
*/
|
|
25
|
+
export type MoltiInstanceType = "lite" | "basic" | "standard-1" | "standard-2" | "standard-3" | "standard-4";
|
|
26
|
+
/**
|
|
27
|
+
* Container runtime status
|
|
28
|
+
*/
|
|
29
|
+
export type MoltiContainerStatus = "pending" | "deploying" | "running" | "stopped" | "unhealthy" | "error";
|
|
30
|
+
/**
|
|
31
|
+
* Molti deploy configuration — what the scaffolder needs
|
|
32
|
+
*/
|
|
33
|
+
export interface MoltiDeployConfig {
|
|
34
|
+
/** Project name (npm-compatible, used as Worker name) */
|
|
35
|
+
projectName: string;
|
|
36
|
+
/** Human-readable agent name */
|
|
37
|
+
agentName?: string;
|
|
38
|
+
/** Agent description */
|
|
39
|
+
agentDescription?: string;
|
|
40
|
+
/** AgentShield project ID for monitoring */
|
|
41
|
+
agentShieldProjectId?: string;
|
|
42
|
+
/** AgentShield API key (stored as secret) */
|
|
43
|
+
agentShieldApiKey?: string;
|
|
44
|
+
/** Container instance type */
|
|
45
|
+
instanceType?: MoltiInstanceType;
|
|
46
|
+
/** Enable KTA reputation tracking */
|
|
47
|
+
enableReputation?: boolean;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Request to start a Molti deployment via agent-shield
|
|
51
|
+
* POST /api/internal/deploy/molti/start
|
|
52
|
+
*/
|
|
53
|
+
export interface MoltiDeployRequest {
|
|
54
|
+
/** Project name (used as repo name and Worker name) */
|
|
55
|
+
projectName: string;
|
|
56
|
+
/** Human-readable agent name */
|
|
57
|
+
agentName?: string;
|
|
58
|
+
/** Agent description */
|
|
59
|
+
agentDescription?: string;
|
|
60
|
+
/** Organization ID in AgentShield */
|
|
61
|
+
organizationId: string;
|
|
62
|
+
/** Existing AgentShield project ID (if linking to existing) */
|
|
63
|
+
existingProjectId?: string;
|
|
64
|
+
/** Container instance type */
|
|
65
|
+
instanceType?: MoltiInstanceType;
|
|
66
|
+
/** Enable KTA reputation tracking */
|
|
67
|
+
enableReputation?: boolean;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Response from deploy start endpoint
|
|
71
|
+
*/
|
|
72
|
+
export interface MoltiDeployStartResponse {
|
|
73
|
+
success: true;
|
|
74
|
+
deploymentId: string;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Steps in the Molti deploy pipeline
|
|
78
|
+
*/
|
|
79
|
+
export type MoltiDeployStepId = "github_verify" | "project_create" | "api_key_create" | "kta_register" | "scaffold" | "repo_create" | "commit_files" | "add_secrets" | "gateway_route";
|
|
80
|
+
/**
|
|
81
|
+
* Human-readable names for each deploy step
|
|
82
|
+
*/
|
|
83
|
+
export declare const MOLTI_DEPLOY_STEP_NAMES: Record<MoltiDeployStepId, string>;
|
|
84
|
+
/**
|
|
85
|
+
* Status of an individual deploy step
|
|
86
|
+
*/
|
|
87
|
+
export type MoltiDeployStepStatus = "pending" | "in_progress" | "completed" | "failed" | "skipped";
|
|
88
|
+
/**
|
|
89
|
+
* Individual deploy step progress
|
|
90
|
+
*/
|
|
91
|
+
export interface MoltiDeployStep {
|
|
92
|
+
id: MoltiDeployStepId;
|
|
93
|
+
name: string;
|
|
94
|
+
status: MoltiDeployStepStatus;
|
|
95
|
+
message?: string;
|
|
96
|
+
startedAt?: string;
|
|
97
|
+
completedAt?: string;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Overall deployment progress (sent via SSE)
|
|
101
|
+
*/
|
|
102
|
+
export interface MoltiDeployProgress {
|
|
103
|
+
deploymentId: string;
|
|
104
|
+
steps: MoltiDeployStep[];
|
|
105
|
+
currentStep: number;
|
|
106
|
+
totalSteps: number;
|
|
107
|
+
overallStatus: "pending" | "in_progress" | "completed" | "failed";
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Successful Molti deployment result
|
|
111
|
+
*/
|
|
112
|
+
export interface MoltiDeployResult {
|
|
113
|
+
/** Agent DID */
|
|
114
|
+
agentDid: string;
|
|
115
|
+
/** GitHub repository URL */
|
|
116
|
+
repoUrl: string;
|
|
117
|
+
/** Repository full name (owner/name) */
|
|
118
|
+
repoFullName: string;
|
|
119
|
+
/** AgentShield project ID */
|
|
120
|
+
projectId: string;
|
|
121
|
+
/** AgentShield project friendly ID */
|
|
122
|
+
projectFriendlyId: string;
|
|
123
|
+
/** KTA claim URL (if reputation enabled) */
|
|
124
|
+
ktaClaimUrl?: string;
|
|
125
|
+
/** Cloudflare deploy button URL */
|
|
126
|
+
deployButtonUrl: string;
|
|
127
|
+
/** Gateway hostname (for detection routing) */
|
|
128
|
+
gatewayHostname?: string;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Molti deploy error codes
|
|
132
|
+
*/
|
|
133
|
+
export type MoltiDeployErrorCode = "GITHUB_NOT_CONNECTED" | "REPO_NAME_TAKEN" | "REPO_NAME_INVALID" | "RATE_LIMIT_EXCEEDED" | "PLAN_LIMIT_EXCEEDED" | "SCAFFOLDER_ERROR" | "IDENTITY_ERROR" | "PROJECT_CREATION_ERROR" | "KTA_REGISTRATION_ERROR" | "SECRETS_ERROR" | "GATEWAY_ERROR" | "GITHUB_API_ERROR" | "INTERNAL_ERROR";
|
|
134
|
+
/**
|
|
135
|
+
* Molti deploy error response
|
|
136
|
+
*/
|
|
137
|
+
export interface MoltiDeployErrorResponse {
|
|
138
|
+
success: false;
|
|
139
|
+
error: {
|
|
140
|
+
code: MoltiDeployErrorCode;
|
|
141
|
+
message: string;
|
|
142
|
+
details?: Record<string, unknown>;
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Molti deploy success response
|
|
147
|
+
*/
|
|
148
|
+
export interface MoltiDeploySuccessResponse {
|
|
149
|
+
success: true;
|
|
150
|
+
data: MoltiDeployResult;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Union type for Molti deploy response
|
|
154
|
+
*/
|
|
155
|
+
export type MoltiDeployResponse = MoltiDeploySuccessResponse | MoltiDeployErrorResponse;
|
|
156
|
+
/**
|
|
157
|
+
* Health check response from a deployed Molti agent
|
|
158
|
+
*/
|
|
159
|
+
export interface MoltiHealthStatus {
|
|
160
|
+
/** Agent DID */
|
|
161
|
+
agentDid: string;
|
|
162
|
+
/** Container runtime status */
|
|
163
|
+
containerStatus: MoltiContainerStatus;
|
|
164
|
+
/** Whether the gateway process is running */
|
|
165
|
+
gatewayRunning: boolean;
|
|
166
|
+
/** Gateway port (expected: 18789) */
|
|
167
|
+
gatewayPort: number;
|
|
168
|
+
/** Agent uptime in seconds */
|
|
169
|
+
uptimeSeconds?: number;
|
|
170
|
+
/** Last health check timestamp */
|
|
171
|
+
lastCheckedAt: string;
|
|
172
|
+
/** Worker URL (if deployed) */
|
|
173
|
+
workerUrl?: string;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* SSE event types for the Molti deploy stream
|
|
177
|
+
*/
|
|
178
|
+
export type MoltiSSEEventType = "progress" | "complete" | "error" | "keepalive";
|
|
179
|
+
/**
|
|
180
|
+
* SSE progress event data
|
|
181
|
+
*/
|
|
182
|
+
export interface MoltiSSEProgressEvent {
|
|
183
|
+
type: "progress";
|
|
184
|
+
data: MoltiDeployProgress;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* SSE completion event data
|
|
188
|
+
*/
|
|
189
|
+
export interface MoltiSSECompleteEvent {
|
|
190
|
+
type: "complete";
|
|
191
|
+
data: MoltiDeployResult;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* SSE error event data
|
|
195
|
+
*/
|
|
196
|
+
export interface MoltiSSEErrorEvent {
|
|
197
|
+
type: "error";
|
|
198
|
+
data: {
|
|
199
|
+
code: MoltiDeployErrorCode;
|
|
200
|
+
message: string;
|
|
201
|
+
step?: MoltiDeployStepId;
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* SSE keepalive event data
|
|
206
|
+
*/
|
|
207
|
+
export interface MoltiSSEKeepaliveEvent {
|
|
208
|
+
type: "keepalive";
|
|
209
|
+
data: {
|
|
210
|
+
timestamp: string;
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Union of all SSE event types
|
|
215
|
+
*/
|
|
216
|
+
export type MoltiSSEEvent = MoltiSSEProgressEvent | MoltiSSECompleteEvent | MoltiSSEErrorEvent | MoltiSSEKeepaliveEvent;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Molti Deployment Type Definitions
|
|
4
|
+
*
|
|
5
|
+
* TypeScript interfaces for the Molti (Moltworker + Identity) deployment system.
|
|
6
|
+
* Molti scaffolds Cloudflare Worker + Container projects with MCP-I identity.
|
|
7
|
+
*
|
|
8
|
+
* @package @kya-os/contracts/molti
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.MOLTI_DEPLOY_STEP_NAMES = void 0;
|
|
12
|
+
/**
|
|
13
|
+
* Human-readable names for each deploy step
|
|
14
|
+
*/
|
|
15
|
+
exports.MOLTI_DEPLOY_STEP_NAMES = {
|
|
16
|
+
github_verify: "Verifying GitHub connection",
|
|
17
|
+
project_create: "Creating AgentShield project",
|
|
18
|
+
api_key_create: "Generating API key",
|
|
19
|
+
kta_register: "Registering with KTA",
|
|
20
|
+
scaffold: "Scaffolding Moltworker project",
|
|
21
|
+
repo_create: "Creating GitHub repository",
|
|
22
|
+
commit_files: "Committing project files",
|
|
23
|
+
add_secrets: "Configuring secrets",
|
|
24
|
+
gateway_route: "Setting up gateway routing",
|
|
25
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Policy Module
|
|
3
|
+
*
|
|
4
|
+
* Types and schemas for agent detection policy configuration.
|
|
5
|
+
*
|
|
6
|
+
* @module @kya-os/contracts/policy
|
|
7
|
+
*/
|
|
8
|
+
export { EnforcementActionSchema, type EnforcementAction, ThresholdConfigSchema, type ThresholdConfig, DenyListEntrySchema, type DenyListEntry, AllowListEntrySchema, type AllowListEntry, PolicyConditionSchema, type PolicyCondition, PolicyRuleSchema, type PolicyRule, PolicyConfigSchema, PolicyConfigPartialSchema, type PolicyConfig, type PolicyConfigPartial, GetPolicyRequestSchema, type GetPolicyRequest, GetPolicyResponseSchema, type GetPolicyResponse, UpdatePolicyRequestSchema, type UpdatePolicyRequest, UpdatePolicyResponseSchema, type UpdatePolicyResponse, validatePolicyConfig, safeParsePolicyConfig, validateDenyListEntry, validatePolicyRule, DEFAULT_POLICY_CONFIG, EXAMPLE_BLOCK_AI_AGENTS, EXAMPLE_ALLOW_CHATGPT, EXAMPLE_CHALLENGE_LOW_REP, } from './schemas.js';
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Policy Module
|
|
4
|
+
*
|
|
5
|
+
* Types and schemas for agent detection policy configuration.
|
|
6
|
+
*
|
|
7
|
+
* @module @kya-os/contracts/policy
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.EXAMPLE_CHALLENGE_LOW_REP = exports.EXAMPLE_ALLOW_CHATGPT = exports.EXAMPLE_BLOCK_AI_AGENTS = exports.DEFAULT_POLICY_CONFIG = exports.validatePolicyRule = exports.validateDenyListEntry = exports.safeParsePolicyConfig = exports.validatePolicyConfig = exports.UpdatePolicyResponseSchema = exports.UpdatePolicyRequestSchema = exports.GetPolicyResponseSchema = exports.GetPolicyRequestSchema = exports.PolicyConfigPartialSchema = exports.PolicyConfigSchema = exports.PolicyRuleSchema = exports.PolicyConditionSchema = exports.AllowListEntrySchema = exports.DenyListEntrySchema = exports.ThresholdConfigSchema = exports.EnforcementActionSchema = void 0;
|
|
11
|
+
// Schema exports
|
|
12
|
+
var schemas_js_1 = require("./schemas.js");
|
|
13
|
+
// Action types
|
|
14
|
+
Object.defineProperty(exports, "EnforcementActionSchema", { enumerable: true, get: function () { return schemas_js_1.EnforcementActionSchema; } });
|
|
15
|
+
// Threshold configuration
|
|
16
|
+
Object.defineProperty(exports, "ThresholdConfigSchema", { enumerable: true, get: function () { return schemas_js_1.ThresholdConfigSchema; } });
|
|
17
|
+
// Deny/Allow list entries
|
|
18
|
+
Object.defineProperty(exports, "DenyListEntrySchema", { enumerable: true, get: function () { return schemas_js_1.DenyListEntrySchema; } });
|
|
19
|
+
Object.defineProperty(exports, "AllowListEntrySchema", { enumerable: true, get: function () { return schemas_js_1.AllowListEntrySchema; } });
|
|
20
|
+
// Policy rules
|
|
21
|
+
Object.defineProperty(exports, "PolicyConditionSchema", { enumerable: true, get: function () { return schemas_js_1.PolicyConditionSchema; } });
|
|
22
|
+
Object.defineProperty(exports, "PolicyRuleSchema", { enumerable: true, get: function () { return schemas_js_1.PolicyRuleSchema; } });
|
|
23
|
+
// Main policy config
|
|
24
|
+
Object.defineProperty(exports, "PolicyConfigSchema", { enumerable: true, get: function () { return schemas_js_1.PolicyConfigSchema; } });
|
|
25
|
+
Object.defineProperty(exports, "PolicyConfigPartialSchema", { enumerable: true, get: function () { return schemas_js_1.PolicyConfigPartialSchema; } });
|
|
26
|
+
// API schemas
|
|
27
|
+
Object.defineProperty(exports, "GetPolicyRequestSchema", { enumerable: true, get: function () { return schemas_js_1.GetPolicyRequestSchema; } });
|
|
28
|
+
Object.defineProperty(exports, "GetPolicyResponseSchema", { enumerable: true, get: function () { return schemas_js_1.GetPolicyResponseSchema; } });
|
|
29
|
+
Object.defineProperty(exports, "UpdatePolicyRequestSchema", { enumerable: true, get: function () { return schemas_js_1.UpdatePolicyRequestSchema; } });
|
|
30
|
+
Object.defineProperty(exports, "UpdatePolicyResponseSchema", { enumerable: true, get: function () { return schemas_js_1.UpdatePolicyResponseSchema; } });
|
|
31
|
+
// Validation helpers
|
|
32
|
+
Object.defineProperty(exports, "validatePolicyConfig", { enumerable: true, get: function () { return schemas_js_1.validatePolicyConfig; } });
|
|
33
|
+
Object.defineProperty(exports, "safeParsePolicyConfig", { enumerable: true, get: function () { return schemas_js_1.safeParsePolicyConfig; } });
|
|
34
|
+
Object.defineProperty(exports, "validateDenyListEntry", { enumerable: true, get: function () { return schemas_js_1.validateDenyListEntry; } });
|
|
35
|
+
Object.defineProperty(exports, "validatePolicyRule", { enumerable: true, get: function () { return schemas_js_1.validatePolicyRule; } });
|
|
36
|
+
// Defaults
|
|
37
|
+
Object.defineProperty(exports, "DEFAULT_POLICY_CONFIG", { enumerable: true, get: function () { return schemas_js_1.DEFAULT_POLICY_CONFIG; } });
|
|
38
|
+
// Examples (for documentation)
|
|
39
|
+
Object.defineProperty(exports, "EXAMPLE_BLOCK_AI_AGENTS", { enumerable: true, get: function () { return schemas_js_1.EXAMPLE_BLOCK_AI_AGENTS; } });
|
|
40
|
+
Object.defineProperty(exports, "EXAMPLE_ALLOW_CHATGPT", { enumerable: true, get: function () { return schemas_js_1.EXAMPLE_ALLOW_CHATGPT; } });
|
|
41
|
+
Object.defineProperty(exports, "EXAMPLE_CHALLENGE_LOW_REP", { enumerable: true, get: function () { return schemas_js_1.EXAMPLE_CHALLENGE_LOW_REP; } });
|