chainlesschain 0.81.0 → 0.132.0

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 (110) hide show
  1. package/bin/chainlesschain.js +0 -0
  2. package/package.json +1 -1
  3. package/src/commands/agent-network.js +254 -1
  4. package/src/commands/audit.js +302 -0
  5. package/src/commands/automation.js +271 -1
  6. package/src/commands/codegen.js +224 -0
  7. package/src/commands/collab.js +341 -0
  8. package/src/commands/compliance.js +1035 -0
  9. package/src/commands/cowork.js +221 -0
  10. package/src/commands/dbevo.js +284 -0
  11. package/src/commands/dev.js +252 -0
  12. package/src/commands/did.js +358 -0
  13. package/src/commands/encrypt.js +341 -0
  14. package/src/commands/export.js +256 -1
  15. package/src/commands/fusion.js +258 -0
  16. package/src/commands/governance.js +325 -0
  17. package/src/commands/hardening.js +411 -0
  18. package/src/commands/hook.js +148 -0
  19. package/src/commands/import.js +252 -0
  20. package/src/commands/incentive.js +322 -0
  21. package/src/commands/infra.js +244 -0
  22. package/src/commands/instinct.js +260 -0
  23. package/src/commands/ipfs.js +318 -0
  24. package/src/commands/kg.js +387 -0
  25. package/src/commands/llm.js +263 -0
  26. package/src/commands/mcp.js +221 -0
  27. package/src/commands/memory.js +248 -0
  28. package/src/commands/multimodal.js +296 -0
  29. package/src/commands/nlprog.js +356 -0
  30. package/src/commands/note.js +244 -0
  31. package/src/commands/ops.js +354 -0
  32. package/src/commands/orchestrate.js +166 -0
  33. package/src/commands/org.js +277 -0
  34. package/src/commands/p2p.js +390 -0
  35. package/src/commands/perception.js +290 -0
  36. package/src/commands/permmem.js +251 -0
  37. package/src/commands/plugin-ecosystem.js +273 -0
  38. package/src/commands/pqc.js +393 -0
  39. package/src/commands/quantization.js +351 -0
  40. package/src/commands/rcache.js +271 -0
  41. package/src/commands/recommend.js +340 -0
  42. package/src/commands/runtime.js +307 -0
  43. package/src/commands/scim.js +262 -0
  44. package/src/commands/session.js +258 -0
  45. package/src/commands/skill.js +267 -1
  46. package/src/commands/social.js +256 -0
  47. package/src/commands/sso.js +186 -1
  48. package/src/commands/sync.js +256 -0
  49. package/src/commands/tech.js +338 -0
  50. package/src/commands/tenant.js +351 -0
  51. package/src/commands/tokens.js +269 -0
  52. package/src/commands/trust.js +249 -0
  53. package/src/commands/wallet.js +277 -0
  54. package/src/commands/workflow.js +171 -0
  55. package/src/index.js +4 -0
  56. package/src/lib/agent-coordinator.js +325 -0
  57. package/src/lib/agent-network.js +387 -0
  58. package/src/lib/agent-router.js +395 -0
  59. package/src/lib/aiops.js +478 -0
  60. package/src/lib/audit-logger.js +379 -0
  61. package/src/lib/automation-engine.js +330 -0
  62. package/src/lib/autonomous-developer.js +350 -0
  63. package/src/lib/code-agent.js +323 -0
  64. package/src/lib/collaboration-governance.js +364 -0
  65. package/src/lib/community-governance.js +436 -0
  66. package/src/lib/compliance-manager.js +434 -0
  67. package/src/lib/content-recommendation.js +469 -0
  68. package/src/lib/crypto-manager.js +350 -0
  69. package/src/lib/dbevo.js +338 -0
  70. package/src/lib/decentral-infra.js +340 -0
  71. package/src/lib/did-manager.js +367 -0
  72. package/src/lib/hardening-manager.js +348 -0
  73. package/src/lib/hook-manager.js +380 -0
  74. package/src/lib/instinct-manager.js +332 -0
  75. package/src/lib/ipfs-storage.js +334 -0
  76. package/src/lib/knowledge-exporter.js +381 -0
  77. package/src/lib/knowledge-graph.js +432 -0
  78. package/src/lib/knowledge-importer.js +379 -0
  79. package/src/lib/llm-providers.js +391 -0
  80. package/src/lib/mcp-registry.js +333 -0
  81. package/src/lib/memory-manager.js +330 -0
  82. package/src/lib/multimodal.js +346 -0
  83. package/src/lib/nl-programming.js +343 -0
  84. package/src/lib/note-versioning.js +327 -0
  85. package/src/lib/org-manager.js +323 -0
  86. package/src/lib/p2p-manager.js +387 -0
  87. package/src/lib/perception.js +346 -0
  88. package/src/lib/perf-tuning.js +4 -1
  89. package/src/lib/permanent-memory.js +320 -0
  90. package/src/lib/plugin-ecosystem.js +377 -0
  91. package/src/lib/pqc-manager.js +368 -0
  92. package/src/lib/protocol-fusion.js +417 -0
  93. package/src/lib/quantization.js +325 -0
  94. package/src/lib/response-cache.js +327 -0
  95. package/src/lib/scim-manager.js +329 -0
  96. package/src/lib/session-manager.js +329 -0
  97. package/src/lib/skill-loader.js +377 -0
  98. package/src/lib/social-manager.js +326 -0
  99. package/src/lib/sso-manager.js +332 -0
  100. package/src/lib/sync-manager.js +326 -0
  101. package/src/lib/tech-learning-engine.js +369 -0
  102. package/src/lib/tenant-saas.js +460 -0
  103. package/src/lib/threat-intel.js +335 -0
  104. package/src/lib/token-incentive.js +293 -0
  105. package/src/lib/token-tracker.js +329 -0
  106. package/src/lib/trust-security.js +390 -0
  107. package/src/lib/ueba.js +389 -0
  108. package/src/lib/universal-runtime.js +325 -0
  109. package/src/lib/wallet-manager.js +326 -0
  110. package/src/lib/workflow-engine.js +322 -0
@@ -13,6 +13,35 @@ import {
13
13
  getMigrationStatus,
14
14
  migrate,
15
15
  listAlgorithms,
16
+ KEY_MATURITY_V2,
17
+ MIGRATION_LIFECYCLE_V2,
18
+ getMaxActiveKeysPerOwnerV2,
19
+ setMaxActiveKeysPerOwnerV2,
20
+ getMaxPendingMigrationsPerKeyV2,
21
+ setMaxPendingMigrationsPerKeyV2,
22
+ getKeyIdleMsV2,
23
+ setKeyIdleMsV2,
24
+ getMigrationStuckMsV2,
25
+ setMigrationStuckMsV2,
26
+ registerKeyV2,
27
+ getKeyV2,
28
+ listKeysV2,
29
+ activateKeyV2,
30
+ deprecateKeyV2,
31
+ archiveKeyV2,
32
+ touchKeyV2,
33
+ createMigrationV2,
34
+ getMigrationV2,
35
+ listMigrationsV2,
36
+ startMigrationV2,
37
+ completeMigrationV2,
38
+ failMigrationV2,
39
+ cancelMigrationV2,
40
+ getActiveKeyCountV2,
41
+ getPendingMigrationCountV2,
42
+ autoDeprecateIdleKeysV2,
43
+ autoFailStuckMigrationsV2,
44
+ getPqcManagerStatsV2,
16
45
  } from "../lib/pqc-manager.js";
17
46
 
18
47
  export function registerPqcCommand(program) {
@@ -193,4 +222,368 @@ export function registerPqcCommand(program) {
193
222
  process.exit(1);
194
223
  }
195
224
  });
225
+
226
+ // ===== V2 in-memory governance surface (no DB, no bootstrap) =====
227
+
228
+ pqc
229
+ .command("key-maturities-v2")
230
+ .description("[V2] List key maturity states")
231
+ .option("--json", "Output as JSON")
232
+ .action((opts) => {
233
+ const states = Object.values(KEY_MATURITY_V2);
234
+ if (opts.json) console.log(JSON.stringify(states, null, 2));
235
+ else for (const s of states) logger.log(s);
236
+ });
237
+
238
+ pqc
239
+ .command("migration-lifecycles-v2")
240
+ .description("[V2] List migration lifecycle states")
241
+ .option("--json", "Output as JSON")
242
+ .action((opts) => {
243
+ const states = Object.values(MIGRATION_LIFECYCLE_V2);
244
+ if (opts.json) console.log(JSON.stringify(states, null, 2));
245
+ else for (const s of states) logger.log(s);
246
+ });
247
+
248
+ pqc
249
+ .command("config-v2")
250
+ .description("[V2] Show governance config")
251
+ .option("--json", "Output as JSON")
252
+ .action((opts) => {
253
+ const cfg = {
254
+ maxActiveKeysPerOwner: getMaxActiveKeysPerOwnerV2(),
255
+ maxPendingMigrationsPerKey: getMaxPendingMigrationsPerKeyV2(),
256
+ keyIdleMs: getKeyIdleMsV2(),
257
+ migrationStuckMs: getMigrationStuckMsV2(),
258
+ };
259
+ if (opts.json) console.log(JSON.stringify(cfg, null, 2));
260
+ else for (const [k, v] of Object.entries(cfg)) logger.log(`${k}: ${v}`);
261
+ });
262
+
263
+ pqc
264
+ .command("set-max-active-keys-per-owner-v2 <n>")
265
+ .description("[V2] Set per-owner active key cap")
266
+ .action((n) => {
267
+ try {
268
+ setMaxActiveKeysPerOwnerV2(Number(n));
269
+ logger.success(
270
+ `max active keys/owner = ${getMaxActiveKeysPerOwnerV2()}`,
271
+ );
272
+ } catch (err) {
273
+ logger.error(err.message);
274
+ process.exit(1);
275
+ }
276
+ });
277
+
278
+ pqc
279
+ .command("set-max-pending-migrations-per-key-v2 <n>")
280
+ .description("[V2] Set per-key pending migration cap")
281
+ .action((n) => {
282
+ try {
283
+ setMaxPendingMigrationsPerKeyV2(Number(n));
284
+ logger.success(
285
+ `max pending migrations/key = ${getMaxPendingMigrationsPerKeyV2()}`,
286
+ );
287
+ } catch (err) {
288
+ logger.error(err.message);
289
+ process.exit(1);
290
+ }
291
+ });
292
+
293
+ pqc
294
+ .command("set-key-idle-ms-v2 <ms>")
295
+ .description("[V2] Set key idle threshold (ms)")
296
+ .action((ms) => {
297
+ try {
298
+ setKeyIdleMsV2(Number(ms));
299
+ logger.success(`key idle ms = ${getKeyIdleMsV2()}`);
300
+ } catch (err) {
301
+ logger.error(err.message);
302
+ process.exit(1);
303
+ }
304
+ });
305
+
306
+ pqc
307
+ .command("set-migration-stuck-ms-v2 <ms>")
308
+ .description("[V2] Set migration stuck threshold (ms)")
309
+ .action((ms) => {
310
+ try {
311
+ setMigrationStuckMsV2(Number(ms));
312
+ logger.success(`migration stuck ms = ${getMigrationStuckMsV2()}`);
313
+ } catch (err) {
314
+ logger.error(err.message);
315
+ process.exit(1);
316
+ }
317
+ });
318
+
319
+ pqc
320
+ .command("register-key-v2 <id>")
321
+ .description("[V2] Register a key profile (PENDING)")
322
+ .requiredOption("-o, --owner <id>", "Owner ID")
323
+ .requiredOption("-a, --algorithm <algo>", "Algorithm")
324
+ .option("-p, --purpose <purpose>", "Purpose", "general")
325
+ .action((id, opts) => {
326
+ try {
327
+ const k = registerKeyV2(id, {
328
+ ownerId: opts.owner,
329
+ algorithm: opts.algorithm,
330
+ purpose: opts.purpose,
331
+ });
332
+ logger.success(`key ${k.id} registered (status=${k.status})`);
333
+ } catch (err) {
334
+ logger.error(err.message);
335
+ process.exit(1);
336
+ }
337
+ });
338
+
339
+ pqc
340
+ .command("activate-key-v2 <id>")
341
+ .description("[V2] Activate a key (pending|deprecated -> active)")
342
+ .action((id) => {
343
+ try {
344
+ const k = activateKeyV2(id);
345
+ logger.success(`key ${k.id} active`);
346
+ } catch (err) {
347
+ logger.error(err.message);
348
+ process.exit(1);
349
+ }
350
+ });
351
+
352
+ pqc
353
+ .command("deprecate-key-v2 <id>")
354
+ .description("[V2] Deprecate a key (active -> deprecated)")
355
+ .action((id) => {
356
+ try {
357
+ const k = deprecateKeyV2(id);
358
+ logger.success(`key ${k.id} deprecated`);
359
+ } catch (err) {
360
+ logger.error(err.message);
361
+ process.exit(1);
362
+ }
363
+ });
364
+
365
+ pqc
366
+ .command("archive-key-v2 <id>")
367
+ .description("[V2] Archive a key (terminal)")
368
+ .action((id) => {
369
+ try {
370
+ const k = archiveKeyV2(id);
371
+ logger.success(`key ${k.id} archived`);
372
+ } catch (err) {
373
+ logger.error(err.message);
374
+ process.exit(1);
375
+ }
376
+ });
377
+
378
+ pqc
379
+ .command("touch-key-v2 <id>")
380
+ .description("[V2] Bump key lastSeenAt")
381
+ .action((id) => {
382
+ try {
383
+ const k = touchKeyV2(id);
384
+ logger.success(`key ${k.id} touched`);
385
+ } catch (err) {
386
+ logger.error(err.message);
387
+ process.exit(1);
388
+ }
389
+ });
390
+
391
+ pqc
392
+ .command("get-key-v2 <id>")
393
+ .description("[V2] Show a key profile")
394
+ .option("--json", "Output as JSON")
395
+ .action((id, opts) => {
396
+ try {
397
+ const k = getKeyV2(id);
398
+ if (!k) {
399
+ logger.info("key not found");
400
+ return;
401
+ }
402
+ if (opts.json) console.log(JSON.stringify(k, null, 2));
403
+ else logger.log(JSON.stringify(k, null, 2));
404
+ } catch (err) {
405
+ logger.error(err.message);
406
+ process.exit(1);
407
+ }
408
+ });
409
+
410
+ pqc
411
+ .command("list-keys-v2")
412
+ .description("[V2] List key profiles")
413
+ .option("-o, --owner <id>", "Filter by owner")
414
+ .option("-s, --status <s>", "Filter by status")
415
+ .option("-a, --algorithm <algo>", "Filter by algorithm")
416
+ .option("--json", "Output as JSON")
417
+ .action((opts) => {
418
+ const list = listKeysV2({
419
+ ownerId: opts.owner,
420
+ status: opts.status,
421
+ algorithm: opts.algorithm,
422
+ });
423
+ if (opts.json) console.log(JSON.stringify(list, null, 2));
424
+ else
425
+ for (const k of list)
426
+ logger.log(`${k.id}\t${k.ownerId}\t${k.status}\t${k.algorithm}`);
427
+ });
428
+
429
+ pqc
430
+ .command("create-migration-v2 <id>")
431
+ .description("[V2] Create a queued V2 migration")
432
+ .requiredOption("-k, --key <keyId>", "Key ID")
433
+ .requiredOption("-t, --target <algo>", "Target algorithm")
434
+ .action((id, opts) => {
435
+ try {
436
+ const m = createMigrationV2(id, {
437
+ keyId: opts.key,
438
+ targetAlgorithm: opts.target,
439
+ });
440
+ logger.success(
441
+ `migration ${m.id} queued (key=${m.keyId} ${m.sourceAlgorithm}->${m.targetAlgorithm})`,
442
+ );
443
+ } catch (err) {
444
+ logger.error(err.message);
445
+ process.exit(1);
446
+ }
447
+ });
448
+
449
+ pqc
450
+ .command("start-migration-v2 <id>")
451
+ .description("[V2] Start a migration (queued -> running)")
452
+ .action((id) => {
453
+ try {
454
+ const m = startMigrationV2(id);
455
+ logger.success(`migration ${m.id} running`);
456
+ } catch (err) {
457
+ logger.error(err.message);
458
+ process.exit(1);
459
+ }
460
+ });
461
+
462
+ pqc
463
+ .command("complete-migration-v2 <id>")
464
+ .description("[V2] Complete a migration (running -> completed)")
465
+ .action((id) => {
466
+ try {
467
+ const m = completeMigrationV2(id);
468
+ logger.success(`migration ${m.id} completed`);
469
+ } catch (err) {
470
+ logger.error(err.message);
471
+ process.exit(1);
472
+ }
473
+ });
474
+
475
+ pqc
476
+ .command("fail-migration-v2 <id>")
477
+ .description("[V2] Fail a migration (running -> failed)")
478
+ .action((id) => {
479
+ try {
480
+ const m = failMigrationV2(id);
481
+ logger.success(`migration ${m.id} failed`);
482
+ } catch (err) {
483
+ logger.error(err.message);
484
+ process.exit(1);
485
+ }
486
+ });
487
+
488
+ pqc
489
+ .command("cancel-migration-v2 <id>")
490
+ .description("[V2] Cancel a migration (queued|running -> cancelled)")
491
+ .action((id) => {
492
+ try {
493
+ const m = cancelMigrationV2(id);
494
+ logger.success(`migration ${m.id} cancelled`);
495
+ } catch (err) {
496
+ logger.error(err.message);
497
+ process.exit(1);
498
+ }
499
+ });
500
+
501
+ pqc
502
+ .command("get-migration-v2 <id>")
503
+ .description("[V2] Show migration job")
504
+ .option("--json", "Output as JSON")
505
+ .action((id, opts) => {
506
+ try {
507
+ const m = getMigrationV2(id);
508
+ if (!m) {
509
+ logger.info("migration not found");
510
+ return;
511
+ }
512
+ if (opts.json) console.log(JSON.stringify(m, null, 2));
513
+ else logger.log(JSON.stringify(m, null, 2));
514
+ } catch (err) {
515
+ logger.error(err.message);
516
+ process.exit(1);
517
+ }
518
+ });
519
+
520
+ pqc
521
+ .command("list-migrations-v2")
522
+ .description("[V2] List V2 migrations")
523
+ .option("-k, --key <keyId>", "Filter by key")
524
+ .option("-s, --status <s>", "Filter by status")
525
+ .option("--json", "Output as JSON")
526
+ .action((opts) => {
527
+ const list = listMigrationsV2({ keyId: opts.key, status: opts.status });
528
+ if (opts.json) console.log(JSON.stringify(list, null, 2));
529
+ else
530
+ for (const m of list)
531
+ logger.log(
532
+ `${m.id}\t${m.keyId}\t${m.status}\t${m.sourceAlgorithm}->${m.targetAlgorithm}`,
533
+ );
534
+ });
535
+
536
+ pqc
537
+ .command("active-key-count-v2")
538
+ .description("[V2] Count active keys (optional --owner filter)")
539
+ .option("-o, --owner <id>", "Filter by owner")
540
+ .action((opts) => {
541
+ logger.log(String(getActiveKeyCountV2(opts.owner)));
542
+ });
543
+
544
+ pqc
545
+ .command("pending-migration-count-v2")
546
+ .description(
547
+ "[V2] Count pending migrations (queued+running) (optional --key filter)",
548
+ )
549
+ .option("-k, --key <keyId>", "Filter by key")
550
+ .action((opts) => {
551
+ logger.log(String(getPendingMigrationCountV2(opts.key)));
552
+ });
553
+
554
+ pqc
555
+ .command("auto-deprecate-idle-keys-v2")
556
+ .description("[V2] Deprecate idle active keys")
557
+ .option("--now <ms>", "Override current time (ms)")
558
+ .option("--json", "Output as JSON")
559
+ .action((opts) => {
560
+ const list = autoDeprecateIdleKeysV2(
561
+ opts.now ? { now: Number(opts.now) } : undefined,
562
+ );
563
+ if (opts.json) console.log(JSON.stringify(list, null, 2));
564
+ else logger.success(`deprecated ${list.length} key(s)`);
565
+ });
566
+
567
+ pqc
568
+ .command("auto-fail-stuck-migrations-v2")
569
+ .description("[V2] Fail stuck running migrations")
570
+ .option("--now <ms>", "Override current time (ms)")
571
+ .option("--json", "Output as JSON")
572
+ .action((opts) => {
573
+ const list = autoFailStuckMigrationsV2(
574
+ opts.now ? { now: Number(opts.now) } : undefined,
575
+ );
576
+ if (opts.json) console.log(JSON.stringify(list, null, 2));
577
+ else logger.success(`failed ${list.length} migration(s)`);
578
+ });
579
+
580
+ pqc
581
+ .command("stats-v2")
582
+ .description("[V2] Show governance stats")
583
+ .option("--json", "Output as JSON")
584
+ .action((opts) => {
585
+ const s = getPqcManagerStatsV2();
586
+ if (opts.json) console.log(JSON.stringify(s, null, 2));
587
+ else logger.log(JSON.stringify(s, null, 2));
588
+ });
196
589
  }