@codmir/contracts 0.1.0 → 0.1.1

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/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import { z } from 'zod';
2
+
1
3
  /**
2
4
  * @fileoverview
3
5
  * Codmir Contract Schema v1
@@ -1165,6 +1167,428 @@ declare const prAnalysisContract: CodmirContract;
1165
1167
  */
1166
1168
  declare const prAnalysisWithLlmContract: CodmirContract;
1167
1169
 
1170
+ /**
1171
+ * @fileoverview
1172
+ * Zod schemas for the Codmir cluster-first compute plane.
1173
+ *
1174
+ * All types shared between:
1175
+ * - Control Plane (NestJS orchestrator)
1176
+ * - Node Agent (Jetson / x86 / Mac mini workers)
1177
+ * - IDE client (Next.js 15)
1178
+ */
1179
+
1180
+ /** All recognised node capabilities. */
1181
+ declare const NODE_CAPABILITIES: readonly ["llm.chat", "llm.completion", "embeddings.encode", "repo.index", "tools.run", "build.compile", "build.test", "vision.detect", "audio.transcribe", "audio.tts"];
1182
+ /** All recognised job types. */
1183
+ declare const JOB_TYPES: readonly ["chat", "embed", "patch", "build", "test", "index", "transcribe", "custom"];
1184
+ declare const NodeCapabilitySchema: z.ZodEnum<["llm.chat", "llm.completion", "embeddings.encode", "repo.index", "tools.run", "build.compile", "build.test", "vision.detect", "audio.transcribe", "audio.tts"]>;
1185
+ type NodeCapability = z.infer<typeof NodeCapabilitySchema>;
1186
+ declare const NodeHardwareSchema: z.ZodObject<{
1187
+ arch: z.ZodEnum<["arm64", "x86_64", "aarch64"]>;
1188
+ gpuType: z.ZodOptional<z.ZodString>;
1189
+ gpuMemoryMb: z.ZodOptional<z.ZodNumber>;
1190
+ ramMb: z.ZodNumber;
1191
+ cpuCores: z.ZodNumber;
1192
+ cudaCores: z.ZodOptional<z.ZodNumber>;
1193
+ tensorCores: z.ZodOptional<z.ZodNumber>;
1194
+ }, "strip", z.ZodTypeAny, {
1195
+ arch: "arm64" | "x86_64" | "aarch64";
1196
+ ramMb: number;
1197
+ cpuCores: number;
1198
+ gpuType?: string | undefined;
1199
+ gpuMemoryMb?: number | undefined;
1200
+ cudaCores?: number | undefined;
1201
+ tensorCores?: number | undefined;
1202
+ }, {
1203
+ arch: "arm64" | "x86_64" | "aarch64";
1204
+ ramMb: number;
1205
+ cpuCores: number;
1206
+ gpuType?: string | undefined;
1207
+ gpuMemoryMb?: number | undefined;
1208
+ cudaCores?: number | undefined;
1209
+ tensorCores?: number | undefined;
1210
+ }>;
1211
+ type NodeHardware = z.infer<typeof NodeHardwareSchema>;
1212
+ declare const NodeStatusSchema: z.ZodEnum<["online", "offline", "draining", "error"]>;
1213
+ type NodeStatus = z.infer<typeof NodeStatusSchema>;
1214
+ declare const NodeSchema: z.ZodObject<{
1215
+ id: z.ZodString;
1216
+ name: z.ZodString;
1217
+ capabilities: z.ZodArray<z.ZodEnum<["llm.chat", "llm.completion", "embeddings.encode", "repo.index", "tools.run", "build.compile", "build.test", "vision.detect", "audio.transcribe", "audio.tts"]>, "many">;
1218
+ labels: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
1219
+ hardware: z.ZodObject<{
1220
+ arch: z.ZodEnum<["arm64", "x86_64", "aarch64"]>;
1221
+ gpuType: z.ZodOptional<z.ZodString>;
1222
+ gpuMemoryMb: z.ZodOptional<z.ZodNumber>;
1223
+ ramMb: z.ZodNumber;
1224
+ cpuCores: z.ZodNumber;
1225
+ cudaCores: z.ZodOptional<z.ZodNumber>;
1226
+ tensorCores: z.ZodOptional<z.ZodNumber>;
1227
+ }, "strip", z.ZodTypeAny, {
1228
+ arch: "arm64" | "x86_64" | "aarch64";
1229
+ ramMb: number;
1230
+ cpuCores: number;
1231
+ gpuType?: string | undefined;
1232
+ gpuMemoryMb?: number | undefined;
1233
+ cudaCores?: number | undefined;
1234
+ tensorCores?: number | undefined;
1235
+ }, {
1236
+ arch: "arm64" | "x86_64" | "aarch64";
1237
+ ramMb: number;
1238
+ cpuCores: number;
1239
+ gpuType?: string | undefined;
1240
+ gpuMemoryMb?: number | undefined;
1241
+ cudaCores?: number | undefined;
1242
+ tensorCores?: number | undefined;
1243
+ }>;
1244
+ modelsAvailable: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
1245
+ status: z.ZodDefault<z.ZodEnum<["online", "offline", "draining", "error"]>>;
1246
+ maxConcurrency: z.ZodDefault<z.ZodNumber>;
1247
+ runningJobs: z.ZodDefault<z.ZodNumber>;
1248
+ lastHeartbeatAt: z.ZodOptional<z.ZodString>;
1249
+ registeredAt: z.ZodString;
1250
+ endpoint: z.ZodString;
1251
+ }, "strip", z.ZodTypeAny, {
1252
+ id: string;
1253
+ labels: string[];
1254
+ status: "error" | "online" | "offline" | "draining";
1255
+ name: string;
1256
+ capabilities: ("llm.chat" | "llm.completion" | "embeddings.encode" | "repo.index" | "tools.run" | "build.compile" | "build.test" | "vision.detect" | "audio.transcribe" | "audio.tts")[];
1257
+ hardware: {
1258
+ arch: "arm64" | "x86_64" | "aarch64";
1259
+ ramMb: number;
1260
+ cpuCores: number;
1261
+ gpuType?: string | undefined;
1262
+ gpuMemoryMb?: number | undefined;
1263
+ cudaCores?: number | undefined;
1264
+ tensorCores?: number | undefined;
1265
+ };
1266
+ modelsAvailable: string[];
1267
+ maxConcurrency: number;
1268
+ runningJobs: number;
1269
+ registeredAt: string;
1270
+ endpoint: string;
1271
+ lastHeartbeatAt?: string | undefined;
1272
+ }, {
1273
+ id: string;
1274
+ name: string;
1275
+ capabilities: ("llm.chat" | "llm.completion" | "embeddings.encode" | "repo.index" | "tools.run" | "build.compile" | "build.test" | "vision.detect" | "audio.transcribe" | "audio.tts")[];
1276
+ hardware: {
1277
+ arch: "arm64" | "x86_64" | "aarch64";
1278
+ ramMb: number;
1279
+ cpuCores: number;
1280
+ gpuType?: string | undefined;
1281
+ gpuMemoryMb?: number | undefined;
1282
+ cudaCores?: number | undefined;
1283
+ tensorCores?: number | undefined;
1284
+ };
1285
+ registeredAt: string;
1286
+ endpoint: string;
1287
+ labels?: string[] | undefined;
1288
+ status?: "error" | "online" | "offline" | "draining" | undefined;
1289
+ modelsAvailable?: string[] | undefined;
1290
+ maxConcurrency?: number | undefined;
1291
+ runningJobs?: number | undefined;
1292
+ lastHeartbeatAt?: string | undefined;
1293
+ }>;
1294
+ type ComputeNode = z.infer<typeof NodeSchema>;
1295
+ declare const RegisterNodeSchema: z.ZodObject<{
1296
+ name: z.ZodString;
1297
+ capabilities: z.ZodArray<z.ZodEnum<["llm.chat", "llm.completion", "embeddings.encode", "repo.index", "tools.run", "build.compile", "build.test", "vision.detect", "audio.transcribe", "audio.tts"]>, "many">;
1298
+ labels: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
1299
+ hardware: z.ZodObject<{
1300
+ arch: z.ZodEnum<["arm64", "x86_64", "aarch64"]>;
1301
+ gpuType: z.ZodOptional<z.ZodString>;
1302
+ gpuMemoryMb: z.ZodOptional<z.ZodNumber>;
1303
+ ramMb: z.ZodNumber;
1304
+ cpuCores: z.ZodNumber;
1305
+ cudaCores: z.ZodOptional<z.ZodNumber>;
1306
+ tensorCores: z.ZodOptional<z.ZodNumber>;
1307
+ }, "strip", z.ZodTypeAny, {
1308
+ arch: "arm64" | "x86_64" | "aarch64";
1309
+ ramMb: number;
1310
+ cpuCores: number;
1311
+ gpuType?: string | undefined;
1312
+ gpuMemoryMb?: number | undefined;
1313
+ cudaCores?: number | undefined;
1314
+ tensorCores?: number | undefined;
1315
+ }, {
1316
+ arch: "arm64" | "x86_64" | "aarch64";
1317
+ ramMb: number;
1318
+ cpuCores: number;
1319
+ gpuType?: string | undefined;
1320
+ gpuMemoryMb?: number | undefined;
1321
+ cudaCores?: number | undefined;
1322
+ tensorCores?: number | undefined;
1323
+ }>;
1324
+ modelsAvailable: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
1325
+ maxConcurrency: z.ZodDefault<z.ZodNumber>;
1326
+ endpoint: z.ZodString;
1327
+ }, "strip", z.ZodTypeAny, {
1328
+ labels: string[];
1329
+ name: string;
1330
+ capabilities: ("llm.chat" | "llm.completion" | "embeddings.encode" | "repo.index" | "tools.run" | "build.compile" | "build.test" | "vision.detect" | "audio.transcribe" | "audio.tts")[];
1331
+ hardware: {
1332
+ arch: "arm64" | "x86_64" | "aarch64";
1333
+ ramMb: number;
1334
+ cpuCores: number;
1335
+ gpuType?: string | undefined;
1336
+ gpuMemoryMb?: number | undefined;
1337
+ cudaCores?: number | undefined;
1338
+ tensorCores?: number | undefined;
1339
+ };
1340
+ modelsAvailable: string[];
1341
+ maxConcurrency: number;
1342
+ endpoint: string;
1343
+ }, {
1344
+ name: string;
1345
+ capabilities: ("llm.chat" | "llm.completion" | "embeddings.encode" | "repo.index" | "tools.run" | "build.compile" | "build.test" | "vision.detect" | "audio.transcribe" | "audio.tts")[];
1346
+ hardware: {
1347
+ arch: "arm64" | "x86_64" | "aarch64";
1348
+ ramMb: number;
1349
+ cpuCores: number;
1350
+ gpuType?: string | undefined;
1351
+ gpuMemoryMb?: number | undefined;
1352
+ cudaCores?: number | undefined;
1353
+ tensorCores?: number | undefined;
1354
+ };
1355
+ endpoint: string;
1356
+ labels?: string[] | undefined;
1357
+ modelsAvailable?: string[] | undefined;
1358
+ maxConcurrency?: number | undefined;
1359
+ }>;
1360
+ type RegisterNodePayload = z.infer<typeof RegisterNodeSchema>;
1361
+ declare const HeartbeatSchema: z.ZodObject<{
1362
+ runningJobs: z.ZodNumber;
1363
+ modelsAvailable: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1364
+ load: z.ZodOptional<z.ZodObject<{
1365
+ cpuPercent: z.ZodOptional<z.ZodNumber>;
1366
+ gpuPercent: z.ZodOptional<z.ZodNumber>;
1367
+ ramUsedMb: z.ZodOptional<z.ZodNumber>;
1368
+ }, "strip", z.ZodTypeAny, {
1369
+ cpuPercent?: number | undefined;
1370
+ gpuPercent?: number | undefined;
1371
+ ramUsedMb?: number | undefined;
1372
+ }, {
1373
+ cpuPercent?: number | undefined;
1374
+ gpuPercent?: number | undefined;
1375
+ ramUsedMb?: number | undefined;
1376
+ }>>;
1377
+ }, "strip", z.ZodTypeAny, {
1378
+ runningJobs: number;
1379
+ modelsAvailable?: string[] | undefined;
1380
+ load?: {
1381
+ cpuPercent?: number | undefined;
1382
+ gpuPercent?: number | undefined;
1383
+ ramUsedMb?: number | undefined;
1384
+ } | undefined;
1385
+ }, {
1386
+ runningJobs: number;
1387
+ modelsAvailable?: string[] | undefined;
1388
+ load?: {
1389
+ cpuPercent?: number | undefined;
1390
+ gpuPercent?: number | undefined;
1391
+ ramUsedMb?: number | undefined;
1392
+ } | undefined;
1393
+ }>;
1394
+ type HeartbeatPayload = z.infer<typeof HeartbeatSchema>;
1395
+ declare const JobTypeSchema: z.ZodEnum<["chat", "embed", "patch", "build", "test", "index", "transcribe", "custom"]>;
1396
+ type JobType = z.infer<typeof JobTypeSchema>;
1397
+ declare const JobStatusSchema: z.ZodEnum<["queued", "assigned", "running", "succeeded", "failed", "canceled"]>;
1398
+ type JobStatus = z.infer<typeof JobStatusSchema>;
1399
+ declare const JobPrioritySchema: z.ZodEnum<["critical", "high", "normal", "low"]>;
1400
+ type JobPriority = z.infer<typeof JobPrioritySchema>;
1401
+ declare const SubmitJobSchema: z.ZodObject<{
1402
+ workspaceId: z.ZodString;
1403
+ type: z.ZodEnum<["chat", "embed", "patch", "build", "test", "index", "transcribe", "custom"]>;
1404
+ priority: z.ZodDefault<z.ZodEnum<["critical", "high", "normal", "low"]>>;
1405
+ requiredCapabilities: z.ZodArray<z.ZodEnum<["llm.chat", "llm.completion", "embeddings.encode", "repo.index", "tools.run", "build.compile", "build.test", "vision.detect", "audio.transcribe", "audio.tts"]>, "many">;
1406
+ preferredModel: z.ZodOptional<z.ZodString>;
1407
+ payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1408
+ timeoutMs: z.ZodDefault<z.ZodNumber>;
1409
+ idempotencyKey: z.ZodOptional<z.ZodString>;
1410
+ }, "strip", z.ZodTypeAny, {
1411
+ priority: "critical" | "high" | "low" | "normal";
1412
+ payload: Record<string, unknown>;
1413
+ type: "chat" | "embed" | "patch" | "build" | "test" | "index" | "transcribe" | "custom";
1414
+ workspaceId: string;
1415
+ requiredCapabilities: ("llm.chat" | "llm.completion" | "embeddings.encode" | "repo.index" | "tools.run" | "build.compile" | "build.test" | "vision.detect" | "audio.transcribe" | "audio.tts")[];
1416
+ timeoutMs: number;
1417
+ preferredModel?: string | undefined;
1418
+ idempotencyKey?: string | undefined;
1419
+ }, {
1420
+ payload: Record<string, unknown>;
1421
+ type: "chat" | "embed" | "patch" | "build" | "test" | "index" | "transcribe" | "custom";
1422
+ workspaceId: string;
1423
+ requiredCapabilities: ("llm.chat" | "llm.completion" | "embeddings.encode" | "repo.index" | "tools.run" | "build.compile" | "build.test" | "vision.detect" | "audio.transcribe" | "audio.tts")[];
1424
+ priority?: "critical" | "high" | "low" | "normal" | undefined;
1425
+ preferredModel?: string | undefined;
1426
+ timeoutMs?: number | undefined;
1427
+ idempotencyKey?: string | undefined;
1428
+ }>;
1429
+ type SubmitJobPayload = z.infer<typeof SubmitJobSchema>;
1430
+ declare const JobResultSchema: z.ZodObject<{
1431
+ success: z.ZodBoolean;
1432
+ output: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1433
+ error: z.ZodOptional<z.ZodString>;
1434
+ artifactRefs: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
1435
+ durationMs: z.ZodOptional<z.ZodNumber>;
1436
+ }, "strip", z.ZodTypeAny, {
1437
+ success: boolean;
1438
+ artifactRefs: string[];
1439
+ error?: string | undefined;
1440
+ output?: Record<string, unknown> | undefined;
1441
+ durationMs?: number | undefined;
1442
+ }, {
1443
+ success: boolean;
1444
+ error?: string | undefined;
1445
+ output?: Record<string, unknown> | undefined;
1446
+ artifactRefs?: string[] | undefined;
1447
+ durationMs?: number | undefined;
1448
+ }>;
1449
+ type JobResult = z.infer<typeof JobResultSchema>;
1450
+ declare const JobSchema: z.ZodObject<{
1451
+ id: z.ZodString;
1452
+ workspaceId: z.ZodString;
1453
+ type: z.ZodEnum<["chat", "embed", "patch", "build", "test", "index", "transcribe", "custom"]>;
1454
+ priority: z.ZodEnum<["critical", "high", "normal", "low"]>;
1455
+ status: z.ZodEnum<["queued", "assigned", "running", "succeeded", "failed", "canceled"]>;
1456
+ requiredCapabilities: z.ZodArray<z.ZodEnum<["llm.chat", "llm.completion", "embeddings.encode", "repo.index", "tools.run", "build.compile", "build.test", "vision.detect", "audio.transcribe", "audio.tts"]>, "many">;
1457
+ preferredModel: z.ZodOptional<z.ZodString>;
1458
+ payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1459
+ timeoutMs: z.ZodNumber;
1460
+ assignedNodeId: z.ZodOptional<z.ZodString>;
1461
+ result: z.ZodOptional<z.ZodObject<{
1462
+ success: z.ZodBoolean;
1463
+ output: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1464
+ error: z.ZodOptional<z.ZodString>;
1465
+ artifactRefs: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
1466
+ durationMs: z.ZodOptional<z.ZodNumber>;
1467
+ }, "strip", z.ZodTypeAny, {
1468
+ success: boolean;
1469
+ artifactRefs: string[];
1470
+ error?: string | undefined;
1471
+ output?: Record<string, unknown> | undefined;
1472
+ durationMs?: number | undefined;
1473
+ }, {
1474
+ success: boolean;
1475
+ error?: string | undefined;
1476
+ output?: Record<string, unknown> | undefined;
1477
+ artifactRefs?: string[] | undefined;
1478
+ durationMs?: number | undefined;
1479
+ }>>;
1480
+ createdAt: z.ZodString;
1481
+ startedAt: z.ZodOptional<z.ZodString>;
1482
+ completedAt: z.ZodOptional<z.ZodString>;
1483
+ }, "strip", z.ZodTypeAny, {
1484
+ id: string;
1485
+ priority: "critical" | "high" | "low" | "normal";
1486
+ payload: Record<string, unknown>;
1487
+ type: "chat" | "embed" | "patch" | "build" | "test" | "index" | "transcribe" | "custom";
1488
+ status: "queued" | "assigned" | "running" | "succeeded" | "failed" | "canceled";
1489
+ workspaceId: string;
1490
+ requiredCapabilities: ("llm.chat" | "llm.completion" | "embeddings.encode" | "repo.index" | "tools.run" | "build.compile" | "build.test" | "vision.detect" | "audio.transcribe" | "audio.tts")[];
1491
+ timeoutMs: number;
1492
+ createdAt: string;
1493
+ result?: {
1494
+ success: boolean;
1495
+ artifactRefs: string[];
1496
+ error?: string | undefined;
1497
+ output?: Record<string, unknown> | undefined;
1498
+ durationMs?: number | undefined;
1499
+ } | undefined;
1500
+ preferredModel?: string | undefined;
1501
+ assignedNodeId?: string | undefined;
1502
+ startedAt?: string | undefined;
1503
+ completedAt?: string | undefined;
1504
+ }, {
1505
+ id: string;
1506
+ priority: "critical" | "high" | "low" | "normal";
1507
+ payload: Record<string, unknown>;
1508
+ type: "chat" | "embed" | "patch" | "build" | "test" | "index" | "transcribe" | "custom";
1509
+ status: "queued" | "assigned" | "running" | "succeeded" | "failed" | "canceled";
1510
+ workspaceId: string;
1511
+ requiredCapabilities: ("llm.chat" | "llm.completion" | "embeddings.encode" | "repo.index" | "tools.run" | "build.compile" | "build.test" | "vision.detect" | "audio.transcribe" | "audio.tts")[];
1512
+ timeoutMs: number;
1513
+ createdAt: string;
1514
+ result?: {
1515
+ success: boolean;
1516
+ error?: string | undefined;
1517
+ output?: Record<string, unknown> | undefined;
1518
+ artifactRefs?: string[] | undefined;
1519
+ durationMs?: number | undefined;
1520
+ } | undefined;
1521
+ preferredModel?: string | undefined;
1522
+ assignedNodeId?: string | undefined;
1523
+ startedAt?: string | undefined;
1524
+ completedAt?: string | undefined;
1525
+ }>;
1526
+ type ComputeJob = z.infer<typeof JobSchema>;
1527
+ declare const WorkspaceSchema: z.ZodObject<{
1528
+ id: z.ZodString;
1529
+ projectId: z.ZodString;
1530
+ repoUrl: z.ZodString;
1531
+ defaultBranch: z.ZodDefault<z.ZodString>;
1532
+ allowedCapabilities: z.ZodOptional<z.ZodArray<z.ZodEnum<["llm.chat", "llm.completion", "embeddings.encode", "repo.index", "tools.run", "build.compile", "build.test", "vision.detect", "audio.transcribe", "audio.tts"]>, "many">>;
1533
+ createdAt: z.ZodString;
1534
+ }, "strip", z.ZodTypeAny, {
1535
+ id: string;
1536
+ projectId: string;
1537
+ createdAt: string;
1538
+ repoUrl: string;
1539
+ defaultBranch: string;
1540
+ allowedCapabilities?: ("llm.chat" | "llm.completion" | "embeddings.encode" | "repo.index" | "tools.run" | "build.compile" | "build.test" | "vision.detect" | "audio.transcribe" | "audio.tts")[] | undefined;
1541
+ }, {
1542
+ id: string;
1543
+ projectId: string;
1544
+ createdAt: string;
1545
+ repoUrl: string;
1546
+ defaultBranch?: string | undefined;
1547
+ allowedCapabilities?: ("llm.chat" | "llm.completion" | "embeddings.encode" | "repo.index" | "tools.run" | "build.compile" | "build.test" | "vision.detect" | "audio.transcribe" | "audio.tts")[] | undefined;
1548
+ }>;
1549
+ type ComputeWorkspace = z.infer<typeof WorkspaceSchema>;
1550
+ declare const RegisterWorkspaceSchema: z.ZodObject<{
1551
+ projectId: z.ZodString;
1552
+ repoUrl: z.ZodString;
1553
+ defaultBranch: z.ZodDefault<z.ZodString>;
1554
+ allowedCapabilities: z.ZodOptional<z.ZodArray<z.ZodEnum<["llm.chat", "llm.completion", "embeddings.encode", "repo.index", "tools.run", "build.compile", "build.test", "vision.detect", "audio.transcribe", "audio.tts"]>, "many">>;
1555
+ }, "strip", z.ZodTypeAny, {
1556
+ projectId: string;
1557
+ repoUrl: string;
1558
+ defaultBranch: string;
1559
+ allowedCapabilities?: ("llm.chat" | "llm.completion" | "embeddings.encode" | "repo.index" | "tools.run" | "build.compile" | "build.test" | "vision.detect" | "audio.transcribe" | "audio.tts")[] | undefined;
1560
+ }, {
1561
+ projectId: string;
1562
+ repoUrl: string;
1563
+ defaultBranch?: string | undefined;
1564
+ allowedCapabilities?: ("llm.chat" | "llm.completion" | "embeddings.encode" | "repo.index" | "tools.run" | "build.compile" | "build.test" | "vision.detect" | "audio.transcribe" | "audio.tts")[] | undefined;
1565
+ }>;
1566
+ type RegisterWorkspacePayload = z.infer<typeof RegisterWorkspaceSchema>;
1567
+ declare const JobEventTypeSchema: z.ZodEnum<["job.queued", "job.assigned", "job.started", "job.token", "job.log", "job.progress", "job.artifact", "job.succeeded", "job.failed", "job.canceled"]>;
1568
+ type JobEventType = z.infer<typeof JobEventTypeSchema>;
1569
+ declare const JobEventSchema: z.ZodObject<{
1570
+ type: z.ZodEnum<["job.queued", "job.assigned", "job.started", "job.token", "job.log", "job.progress", "job.artifact", "job.succeeded", "job.failed", "job.canceled"]>;
1571
+ jobId: z.ZodString;
1572
+ nodeId: z.ZodOptional<z.ZodString>;
1573
+ timestamp: z.ZodString;
1574
+ data: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1575
+ }, "strip", z.ZodTypeAny, {
1576
+ timestamp: string;
1577
+ type: "job.queued" | "job.assigned" | "job.started" | "job.token" | "job.log" | "job.progress" | "job.artifact" | "job.succeeded" | "job.failed" | "job.canceled";
1578
+ data: Record<string, unknown>;
1579
+ jobId: string;
1580
+ nodeId?: string | undefined;
1581
+ }, {
1582
+ timestamp: string;
1583
+ type: "job.queued" | "job.assigned" | "job.started" | "job.token" | "job.log" | "job.progress" | "job.artifact" | "job.succeeded" | "job.failed" | "job.canceled";
1584
+ jobId: string;
1585
+ data?: Record<string, unknown> | undefined;
1586
+ nodeId?: string | undefined;
1587
+ }>;
1588
+ type JobEvent = z.infer<typeof JobEventSchema>;
1589
+ declare const ProviderModeSchema: z.ZodEnum<["local", "cloud", "auto"]>;
1590
+ type ProviderMode = z.infer<typeof ProviderModeSchema>;
1591
+
1168
1592
  /**
1169
1593
  * @fileoverview
1170
1594
  * Voice Create Ticket Contract
@@ -1230,4 +1654,4 @@ declare function getVoiceContract(contractId: string): CodmirContract | undefine
1230
1654
  */
1231
1655
  declare function getVoiceContractForAction(actionName: string): CodmirContract | undefined;
1232
1656
 
1233
- export { type ApprovalStep, type AuditStep, type BranchStep, type BudgetConfig, type CodmirContract, type ConditionExpr, type ContractId, type ContractLimits, type ContractOutputs, type ContractQuery, type ContractStep, type ContractSummary, type ContractTrigger, ContractValidationError, type ContractVersion, type CostUnit, DEFAULT_GRACE_EXTENSIONS, DURATION_SYNC_THRESHOLDS, type EmitStep, type EthicalAssessment, type EthicalImpact, type EthicalImpactCategory, type EventName, type ExecutionHints, type ExecutionMode, type ExpectedDuration, GRACE_PRINCIPLES, type GraceAuditEvent, type GraceExtensions, type GracePolicyCondition, type GracePolicyRule, type ImpactSeverity, type IsoDateString, type JsonValue, type LlmStep, type Permission, type ResourceAllocation, type RetryPolicy, type ReversibilityConfig, type RunId, type SkillStep, type SocietalImpact, type StepBase, type StepId, type StepKind, type StepTimeout, type TaskStep, type TransformStep, VOICE_CONTRACTS, type ValidationResult, type WaitStep, type WorkforceImpact, and, calculateRiskScore, cloneJson, codeReviewContract, contains, deepMergeJson, deleteByPath, endsWith, eq, evalCondition, exists, extractTemplatePath, getByPath, getVoiceContract, getVoiceContractForAction, gt, gte, hasPermission, isTemplate, lt, lte, mergeJson, neq, not, or, prAnalysisContract, prAnalysisWithLlmContract, requiresHumanReview, resolveStepInput, resolveTemplates, setByPath, startsWith, ticketTriageContract, validateCondition, validateContract, validateContractSafe, voiceCreateTicketContract, voiceDeployPreviewContract, voiceSaveNoteContract, voiceSearchCodebaseContract };
1657
+ export { type ApprovalStep, type AuditStep, type BranchStep, type BudgetConfig, type CodmirContract, type ComputeJob, type ComputeNode, type ComputeWorkspace, type ConditionExpr, type ContractId, type ContractLimits, type ContractOutputs, type ContractQuery, type ContractStep, type ContractSummary, type ContractTrigger, ContractValidationError, type ContractVersion, type CostUnit, DEFAULT_GRACE_EXTENSIONS, DURATION_SYNC_THRESHOLDS, type EmitStep, type EthicalAssessment, type EthicalImpact, type EthicalImpactCategory, type EventName, type ExecutionHints, type ExecutionMode, type ExpectedDuration, GRACE_PRINCIPLES, type GraceAuditEvent, type GraceExtensions, type GracePolicyCondition, type GracePolicyRule, type HeartbeatPayload, HeartbeatSchema, type ImpactSeverity, type IsoDateString, JOB_TYPES, type JobEvent, JobEventSchema, type JobEventType, JobEventTypeSchema, type JobPriority, JobPrioritySchema, type JobResult, JobResultSchema, JobSchema, type JobStatus, JobStatusSchema, type JobType, JobTypeSchema, type JsonValue, type LlmStep, NODE_CAPABILITIES, type NodeCapability, NodeCapabilitySchema, type NodeHardware, NodeHardwareSchema, NodeSchema, type NodeStatus, NodeStatusSchema, type Permission, type ProviderMode, ProviderModeSchema, type RegisterNodePayload, RegisterNodeSchema, type RegisterWorkspacePayload, RegisterWorkspaceSchema, type ResourceAllocation, type RetryPolicy, type ReversibilityConfig, type RunId, type SkillStep, type SocietalImpact, type StepBase, type StepId, type StepKind, type StepTimeout, type SubmitJobPayload, SubmitJobSchema, type TaskStep, type TransformStep, VOICE_CONTRACTS, type ValidationResult, type WaitStep, type WorkforceImpact, WorkspaceSchema, and, calculateRiskScore, cloneJson, codeReviewContract, contains, deepMergeJson, deleteByPath, endsWith, eq, evalCondition, exists, extractTemplatePath, getByPath, getVoiceContract, getVoiceContractForAction, gt, gte, hasPermission, isTemplate, lt, lte, mergeJson, neq, not, or, prAnalysisContract, prAnalysisWithLlmContract, requiresHumanReview, resolveStepInput, resolveTemplates, setByPath, startsWith, ticketTriageContract, validateCondition, validateContract, validateContractSafe, voiceCreateTicketContract, voiceDeployPreviewContract, voiceSaveNoteContract, voiceSearchCodebaseContract };
package/dist/index.js CHANGED
@@ -1,3 +1,5 @@
1
+ import { z } from 'zod';
2
+
1
3
  // src/schema.ts
2
4
  var DURATION_SYNC_THRESHOLDS = {
3
5
  instant: 5e3,
@@ -1441,6 +1443,153 @@ Respond in JSON format with an "issues" array containing objects with:
1441
1443
  tags: ["github", "pr-analysis", "ai-review", "automation", "webhook"],
1442
1444
  author: "codmir-team"
1443
1445
  };
1446
+ var NODE_CAPABILITIES = [
1447
+ "llm.chat",
1448
+ "llm.completion",
1449
+ "embeddings.encode",
1450
+ "repo.index",
1451
+ "tools.run",
1452
+ "build.compile",
1453
+ "build.test",
1454
+ "vision.detect",
1455
+ "audio.transcribe",
1456
+ "audio.tts"
1457
+ ];
1458
+ var JOB_TYPES = [
1459
+ "chat",
1460
+ "embed",
1461
+ "patch",
1462
+ "build",
1463
+ "test",
1464
+ "index",
1465
+ "transcribe",
1466
+ "custom"
1467
+ ];
1468
+ var NodeCapabilitySchema = z.enum(NODE_CAPABILITIES);
1469
+ var NodeHardwareSchema = z.object({
1470
+ arch: z.enum(["arm64", "x86_64", "aarch64"]),
1471
+ gpuType: z.string().optional(),
1472
+ gpuMemoryMb: z.number().int().nonnegative().optional(),
1473
+ ramMb: z.number().int().positive(),
1474
+ cpuCores: z.number().int().positive(),
1475
+ cudaCores: z.number().int().nonnegative().optional(),
1476
+ tensorCores: z.number().int().nonnegative().optional()
1477
+ });
1478
+ var NodeStatusSchema = z.enum([
1479
+ "online",
1480
+ "offline",
1481
+ "draining",
1482
+ "error"
1483
+ ]);
1484
+ var NodeSchema = z.object({
1485
+ id: z.string().min(1),
1486
+ name: z.string().min(1),
1487
+ capabilities: z.array(NodeCapabilitySchema).min(1),
1488
+ labels: z.array(z.string()).default([]),
1489
+ hardware: NodeHardwareSchema,
1490
+ modelsAvailable: z.array(z.string()).default([]),
1491
+ status: NodeStatusSchema.default("offline"),
1492
+ maxConcurrency: z.number().int().positive().default(2),
1493
+ runningJobs: z.number().int().nonnegative().default(0),
1494
+ lastHeartbeatAt: z.string().datetime().optional(),
1495
+ registeredAt: z.string().datetime(),
1496
+ endpoint: z.string().url()
1497
+ });
1498
+ var RegisterNodeSchema = z.object({
1499
+ name: z.string().min(1),
1500
+ capabilities: z.array(NodeCapabilitySchema).min(1),
1501
+ labels: z.array(z.string()).default([]),
1502
+ hardware: NodeHardwareSchema,
1503
+ modelsAvailable: z.array(z.string()).default([]),
1504
+ maxConcurrency: z.number().int().positive().default(2),
1505
+ endpoint: z.string().url()
1506
+ });
1507
+ var HeartbeatSchema = z.object({
1508
+ runningJobs: z.number().int().nonnegative(),
1509
+ modelsAvailable: z.array(z.string()).optional(),
1510
+ load: z.object({
1511
+ cpuPercent: z.number().min(0).max(100).optional(),
1512
+ gpuPercent: z.number().min(0).max(100).optional(),
1513
+ ramUsedMb: z.number().nonnegative().optional()
1514
+ }).optional()
1515
+ });
1516
+ var JobTypeSchema = z.enum(JOB_TYPES);
1517
+ var JobStatusSchema = z.enum([
1518
+ "queued",
1519
+ "assigned",
1520
+ "running",
1521
+ "succeeded",
1522
+ "failed",
1523
+ "canceled"
1524
+ ]);
1525
+ var JobPrioritySchema = z.enum(["critical", "high", "normal", "low"]);
1526
+ var SubmitJobSchema = z.object({
1527
+ workspaceId: z.string().min(1),
1528
+ type: JobTypeSchema,
1529
+ priority: JobPrioritySchema.default("normal"),
1530
+ requiredCapabilities: z.array(NodeCapabilitySchema).min(1),
1531
+ preferredModel: z.string().optional(),
1532
+ payload: z.record(z.unknown()),
1533
+ timeoutMs: z.number().int().positive().default(12e4),
1534
+ idempotencyKey: z.string().optional()
1535
+ });
1536
+ var JobResultSchema = z.object({
1537
+ success: z.boolean(),
1538
+ output: z.record(z.unknown()).optional(),
1539
+ error: z.string().optional(),
1540
+ artifactRefs: z.array(z.string()).default([]),
1541
+ durationMs: z.number().int().nonnegative().optional()
1542
+ });
1543
+ var JobSchema = z.object({
1544
+ id: z.string().min(1),
1545
+ workspaceId: z.string().min(1),
1546
+ type: JobTypeSchema,
1547
+ priority: JobPrioritySchema,
1548
+ status: JobStatusSchema,
1549
+ requiredCapabilities: z.array(NodeCapabilitySchema),
1550
+ preferredModel: z.string().optional(),
1551
+ payload: z.record(z.unknown()),
1552
+ timeoutMs: z.number().int().positive(),
1553
+ assignedNodeId: z.string().optional(),
1554
+ result: JobResultSchema.optional(),
1555
+ createdAt: z.string().datetime(),
1556
+ startedAt: z.string().datetime().optional(),
1557
+ completedAt: z.string().datetime().optional()
1558
+ });
1559
+ var WorkspaceSchema = z.object({
1560
+ id: z.string().min(1),
1561
+ projectId: z.string().min(1),
1562
+ repoUrl: z.string().url(),
1563
+ defaultBranch: z.string().default("main"),
1564
+ allowedCapabilities: z.array(NodeCapabilitySchema).optional(),
1565
+ createdAt: z.string().datetime()
1566
+ });
1567
+ var RegisterWorkspaceSchema = z.object({
1568
+ projectId: z.string().min(1),
1569
+ repoUrl: z.string().url(),
1570
+ defaultBranch: z.string().default("main"),
1571
+ allowedCapabilities: z.array(NodeCapabilitySchema).optional()
1572
+ });
1573
+ var JobEventTypeSchema = z.enum([
1574
+ "job.queued",
1575
+ "job.assigned",
1576
+ "job.started",
1577
+ "job.token",
1578
+ "job.log",
1579
+ "job.progress",
1580
+ "job.artifact",
1581
+ "job.succeeded",
1582
+ "job.failed",
1583
+ "job.canceled"
1584
+ ]);
1585
+ var JobEventSchema = z.object({
1586
+ type: JobEventTypeSchema,
1587
+ jobId: z.string().min(1),
1588
+ nodeId: z.string().optional(),
1589
+ timestamp: z.string().datetime(),
1590
+ data: z.record(z.unknown()).default({})
1591
+ });
1592
+ var ProviderModeSchema = z.enum(["local", "cloud", "auto"]);
1444
1593
 
1445
1594
  // src/voice/create-ticket.ts
1446
1595
  var voiceCreateTicketContract = {
@@ -1919,6 +2068,6 @@ function getVoiceContractForAction(actionName) {
1919
2068
  return VOICE_CONTRACTS[contractId];
1920
2069
  }
1921
2070
 
1922
- export { ContractValidationError, DEFAULT_GRACE_EXTENSIONS, DURATION_SYNC_THRESHOLDS, GRACE_PRINCIPLES, VOICE_CONTRACTS, and, calculateRiskScore, cloneJson, codeReviewContract, contains, deepMergeJson, deleteByPath, endsWith, eq, evalCondition, exists, extractTemplatePath, getByPath, getVoiceContract, getVoiceContractForAction, gt, gte, hasPermission, isTemplate, lt, lte, mergeJson, neq, not, or, prAnalysisContract, prAnalysisWithLlmContract, requiresHumanReview, resolveStepInput, resolveTemplates, setByPath, startsWith, ticketTriageContract, validateCondition, validateContract, validateContractSafe, voiceCreateTicketContract, voiceDeployPreviewContract, voiceSaveNoteContract, voiceSearchCodebaseContract };
2071
+ export { ContractValidationError, DEFAULT_GRACE_EXTENSIONS, DURATION_SYNC_THRESHOLDS, GRACE_PRINCIPLES, HeartbeatSchema, JOB_TYPES, JobEventSchema, JobEventTypeSchema, JobPrioritySchema, JobResultSchema, JobSchema, JobStatusSchema, JobTypeSchema, NODE_CAPABILITIES, NodeCapabilitySchema, NodeHardwareSchema, NodeSchema, NodeStatusSchema, ProviderModeSchema, RegisterNodeSchema, RegisterWorkspaceSchema, SubmitJobSchema, VOICE_CONTRACTS, WorkspaceSchema, and, calculateRiskScore, cloneJson, codeReviewContract, contains, deepMergeJson, deleteByPath, endsWith, eq, evalCondition, exists, extractTemplatePath, getByPath, getVoiceContract, getVoiceContractForAction, gt, gte, hasPermission, isTemplate, lt, lte, mergeJson, neq, not, or, prAnalysisContract, prAnalysisWithLlmContract, requiresHumanReview, resolveStepInput, resolveTemplates, setByPath, startsWith, ticketTriageContract, validateCondition, validateContract, validateContractSafe, voiceCreateTicketContract, voiceDeployPreviewContract, voiceSaveNoteContract, voiceSearchCodebaseContract };
1923
2072
  //# sourceMappingURL=index.js.map
1924
2073
  //# sourceMappingURL=index.js.map